From: Andrea Bianco Date: Thu, 25 Mar 2021 08:36:55 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.23 X-Git-Url: http://repos.xcallymotion.com/base//%22http:/google.github.io/material-design-icons?a=commitdiff_plain;h=2881ec154a3c637f5214f74d3a241258239563a3;p=motion2.git Built motion from commit (unavailable).|2.5.23 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index a8814eb..9e9b094 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-03-25T07:57:43.819Z", + "time": "2021-03-25T08:27:06.210Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 5373358..b04ea97 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-03-25T07:57:43.819Z", + "time": "2021-03-25T08:27:06.210Z", "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 5e7b062..13cbcc0 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 _0x57c4=['VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports'];(function(_0x545df2,_0x3efeb6){var _0x40d6f4=function(_0x2249fb){while(--_0x2249fb){_0x545df2['push'](_0x545df2['shift']());}};_0x40d6f4(++_0x3efeb6);}(_0x57c4,0x1c9));var _0x457c=function(_0x4c0509,_0x2eef25){_0x4c0509=_0x4c0509-0x0;var _0x245b42=_0x57c4[_0x4c0509];return _0x245b42;};'use strict';var Sequelize=require(_0x457c('0x0'));module[_0x457c('0x1')]={'name':{'type':Sequelize[_0x457c('0x2')],'get':function(_0x531a10){return this[_0x457c('0x3')](_0x457c('0x4'));}},'action':{'type':Sequelize[_0x457c('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x457c('0x6'),_0x457c('0x7'),_0x457c('0x8'),_0x457c('0x9'),_0x457c('0xa'),'browser',_0x457c('0xb'),_0x457c('0xc')]],'msg':_0x457c('0xd')}},'comment':_0x457c('0xd')},'data1':{'type':Sequelize[_0x457c('0x5')](0x1000),'comment':_0x457c('0xe')},'data2':{'type':Sequelize[_0x457c('0x5')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x457c('0x5')](0x1000),'comment':_0x457c('0xf')},'data4':{'type':Sequelize[_0x457c('0x5')](0x1000)},'data5':{'type':Sequelize[_0x457c('0x5')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x457c('0x10')]}}; \ No newline at end of file +var _0x9bab=['motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','urlForward','browser','bot','script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'];(function(_0x1cd045,_0x1135ad){var _0x35eaac=function(_0x45e8f0){while(--_0x45e8f0){_0x1cd045['push'](_0x1cd045['shift']());}};_0x35eaac(++_0x1135ad);}(_0x9bab,0x98));var _0xb9ba=function(_0x43fb37,_0x1504bf){_0x43fb37=_0x43fb37-0x0;var _0x252e58=_0x9bab[_0x43fb37];return _0x252e58;};'use strict';var Sequelize=require(_0xb9ba('0x0'));module[_0xb9ba('0x1')]={'name':{'type':Sequelize[_0xb9ba('0x2')],'get':function(_0x52abbe){return this[_0xb9ba('0x3')](_0xb9ba('0x4'));}},'action':{'type':Sequelize[_0xb9ba('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb9ba('0x6'),_0xb9ba('0x7'),'motionbar','jscripty',_0xb9ba('0x8'),_0xb9ba('0x9'),_0xb9ba('0xa'),_0xb9ba('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xb9ba('0x5')](0x1000),'comment':_0xb9ba('0xc')},'data2':{'type':Sequelize[_0xb9ba('0x5')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0xb9ba('0x5')](0x1000),'comment':_0xb9ba('0xd')},'data4':{'type':Sequelize[_0xb9ba('0x5')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xb9ba('0x5')]},'data7':{'type':Sequelize[_0xb9ba('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 990ef25..e440bf8 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 _0x36c3=['error','stack','name','body','Action','find','params','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','set','Content-Range','update','then','status'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x36c3,0x1a6));var _0x336c=function(_0x592a9d,_0x434abb){_0x592a9d=_0x592a9d-0x0;var _0x59d2b3=_0x36c3[_0x592a9d];return _0x59d2b3;};'use strict';var pdf=require(_0x336c('0x0'));var emlformat=require(_0x336c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x336c('0x2'));var jsonpatch=require(_0x336c('0x3'));var rp=require(_0x336c('0x4'));var moment=require(_0x336c('0x5'));var BPromise=require(_0x336c('0x6'));var Mustache=require(_0x336c('0x7'));var util=require(_0x336c('0x8'));var path=require('path');var sox=require(_0x336c('0x9'));var csv=require(_0x336c('0xa'));var ejs=require(_0x336c('0xb'));var fs=require('fs');var _=require(_0x336c('0xc'));var squel=require(_0x336c('0xd'));var crypto=require('crypto');var jsforce=require(_0x336c('0xe'));var deskjs=require(_0x336c('0xf'));var toCsv=require(_0x336c('0xa'));var querystring=require(_0x336c('0x10'));var Papa=require(_0x336c('0x11'));var Redis=require(_0x336c('0x12'));var authService=require(_0x336c('0x13'));var qs=require(_0x336c('0x14'));var as=require(_0x336c('0x15'));var hardwareService=require(_0x336c('0x16'));var logger=require(_0x336c('0x17'))(_0x336c('0x18'));var utils=require(_0x336c('0x19'));var config=require(_0x336c('0x1a'));var licenseUtil=require(_0x336c('0x1b'));var db=require(_0x336c('0x1c'))['db'];function respondWithStatusCode(_0x94b601,_0x4b08f8){_0x4b08f8=_0x4b08f8||0xcc;return function(_0x592a5b){if(_0x592a5b){return _0x94b601[_0x336c('0x1d')](_0x4b08f8);}return _0x94b601['status'](_0x4b08f8)[_0x336c('0x1e')]();};}function respondWithResult(_0xc6a857,_0x2115ce){_0x2115ce=_0x2115ce||0xc8;return function(_0x345be6){if(_0x345be6){return _0xc6a857['status'](_0x2115ce)[_0x336c('0x1f')](_0x345be6);}};}function respondWithFilteredResult(_0x15bc2b,_0x4ce90a){return function(_0x23b375){if(_0x23b375){var _0x5f5ae1=_0x23b375['count'],_0x2c7474=_0x4ce90a[_0x336c('0x20')],_0x4f73b2=_0x4ce90a[_0x336c('0x20')]+_0x4ce90a['limit'],_0x20f10a;if(_0x4f73b2>=_0x5f5ae1){_0x4f73b2=_0x5f5ae1;_0x20f10a=0xc8;}else{_0x20f10a=0xce;}_0x15bc2b['status'](_0x20f10a);return _0x15bc2b[_0x336c('0x21')](_0x336c('0x22'),_0x2c7474+'-'+_0x4f73b2+'/'+_0x5f5ae1)[_0x336c('0x1f')](_0x23b375);}return null;};}function patchUpdates(_0x221408){return function(_0x366182){try{jsonpatch['apply'](_0x366182,_0x221408,!![]);}catch(_0x327e10){return BPromise['reject'](_0x327e10);}return _0x366182['save']();};}function saveUpdates(_0x5f401e,_0x9d4fc6){return function(_0x17abed){if(_0x17abed){return _0x17abed[_0x336c('0x23')](_0x5f401e)['then'](function(_0x5adb5f){return _0x5adb5f;});}return null;};}function removeEntity(_0x5b6cc3,_0x3ba228){return function(_0x60d259){if(_0x60d259){return _0x60d259['destroy']()[_0x336c('0x24')](function(){_0x5b6cc3[_0x336c('0x25')](0xcc)[_0x336c('0x1e')]();});}};}function handleEntityNotFound(_0x56a6fb,_0x473164){return function(_0x314f5f){if(!_0x314f5f){_0x56a6fb[_0x336c('0x1d')](0x194);}return _0x314f5f;};}function handleError(_0xc46031,_0x4bd54c){_0x4bd54c=_0x4bd54c||0x1f4;return function(_0x401660){logger[_0x336c('0x26')](_0x401660[_0x336c('0x27')]);if(_0x401660[_0x336c('0x28')]){delete _0x401660[_0x336c('0x28')];}_0xc46031[_0x336c('0x25')](_0x4bd54c)['send'](_0x401660);};}exports[_0x336c('0x23')]=function(_0x3d2442,_0x2a1fb3){if(_0x3d2442[_0x336c('0x29')]['id']){delete _0x3d2442['body']['id'];}return db[_0x336c('0x2a')][_0x336c('0x2b')]({'where':{'id':_0x3d2442['params']['id']}})['then'](handleEntityNotFound(_0x2a1fb3,null))['then'](saveUpdates(_0x3d2442[_0x336c('0x29')],null))[_0x336c('0x24')](respondWithResult(_0x2a1fb3,null))['catch'](handleError(_0x2a1fb3,null));};exports['destroy']=function(_0x4dbbc7,_0x209c2b){return db[_0x336c('0x2a')][_0x336c('0x2b')]({'where':{'id':_0x4dbbc7[_0x336c('0x2c')]['id']}})[_0x336c('0x24')](handleEntityNotFound(_0x209c2b,null))[_0x336c('0x24')](removeEntity(_0x209c2b,null))[_0x336c('0x2d')](handleError(_0x209c2b,null));}; \ No newline at end of file +var _0x1b65=['crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','body','Action','find','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel'];(function(_0xa5b907,_0x4c7750){var _0x4120a8=function(_0x2d7080){while(--_0x2d7080){_0xa5b907['push'](_0xa5b907['shift']());}};_0x4120a8(++_0x4c7750);}(_0x1b65,0x1b4));var _0x51b6=function(_0x3167b1,_0x5ad266){_0x3167b1=_0x3167b1-0x0;var _0x362152=_0x1b65[_0x3167b1];return _0x362152;};'use strict';var pdf=require(_0x51b6('0x0'));var emlformat=require(_0x51b6('0x1'));var rimraf=require(_0x51b6('0x2'));var zipdir=require(_0x51b6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51b6('0x4'));var moment=require(_0x51b6('0x5'));var BPromise=require(_0x51b6('0x6'));var Mustache=require(_0x51b6('0x7'));var util=require(_0x51b6('0x8'));var path=require(_0x51b6('0x9'));var sox=require(_0x51b6('0xa'));var csv=require('to-csv');var ejs=require(_0x51b6('0xb'));var fs=require('fs');var _=require(_0x51b6('0xc'));var squel=require(_0x51b6('0xd'));var crypto=require(_0x51b6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x51b6('0xf'));var toCsv=require(_0x51b6('0x10'));var querystring=require('querystring');var Papa=require(_0x51b6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x51b6('0x12'));var as=require(_0x51b6('0x13'));var hardwareService=require(_0x51b6('0x14'));var logger=require(_0x51b6('0x15'))(_0x51b6('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x51b6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cd605,_0x422bd4){_0x422bd4=_0x422bd4||0xcc;return function(_0x4ca143){if(_0x4ca143){return _0x4cd605[_0x51b6('0x18')](_0x422bd4);}return _0x4cd605['status'](_0x422bd4)[_0x51b6('0x19')]();};}function respondWithResult(_0x24a386,_0x2890ee){_0x2890ee=_0x2890ee||0xc8;return function(_0x235d8c){if(_0x235d8c){return _0x24a386[_0x51b6('0x1a')](_0x2890ee)[_0x51b6('0x1b')](_0x235d8c);}};}function respondWithFilteredResult(_0x4c6cd0,_0x23549b){return function(_0x596863){if(_0x596863){var _0x39583d=_0x596863[_0x51b6('0x1c')],_0x4c99fb=_0x23549b[_0x51b6('0x1d')],_0x4007b0=_0x23549b[_0x51b6('0x1d')]+_0x23549b[_0x51b6('0x1e')],_0x500a82;if(_0x4007b0>=_0x39583d){_0x4007b0=_0x39583d;_0x500a82=0xc8;}else{_0x500a82=0xce;}_0x4c6cd0[_0x51b6('0x1a')](_0x500a82);return _0x4c6cd0[_0x51b6('0x1f')]('Content-Range',_0x4c99fb+'-'+_0x4007b0+'/'+_0x39583d)[_0x51b6('0x1b')](_0x596863);}return null;};}function patchUpdates(_0x5b8a31){return function(_0x2974f0){try{jsonpatch[_0x51b6('0x20')](_0x2974f0,_0x5b8a31,!![]);}catch(_0x506367){return BPromise[_0x51b6('0x21')](_0x506367);}return _0x2974f0[_0x51b6('0x22')]();};}function saveUpdates(_0x3fee21,_0x471783){return function(_0x21c90c){if(_0x21c90c){return _0x21c90c[_0x51b6('0x23')](_0x3fee21)[_0x51b6('0x24')](function(_0x1e70fc){return _0x1e70fc;});}return null;};}function removeEntity(_0x4ab876,_0x35d2ab){return function(_0x11db4e){if(_0x11db4e){return _0x11db4e[_0x51b6('0x25')]()[_0x51b6('0x24')](function(){_0x4ab876['status'](0xcc)[_0x51b6('0x19')]();});}};}function handleEntityNotFound(_0x3680af,_0x51c013){return function(_0x5de6e3){if(!_0x5de6e3){_0x3680af[_0x51b6('0x18')](0x194);}return _0x5de6e3;};}function handleError(_0x47499e,_0x3518ba){_0x3518ba=_0x3518ba||0x1f4;return function(_0x59193e){logger['error'](_0x59193e[_0x51b6('0x26')]);if(_0x59193e[_0x51b6('0x27')]){delete _0x59193e[_0x51b6('0x27')];}_0x47499e['status'](_0x3518ba)[_0x51b6('0x28')](_0x59193e);};}exports[_0x51b6('0x23')]=function(_0x5a8a5b,_0x2df2fa){if(_0x5a8a5b[_0x51b6('0x29')]['id']){delete _0x5a8a5b[_0x51b6('0x29')]['id'];}return db[_0x51b6('0x2a')][_0x51b6('0x2b')]({'where':{'id':_0x5a8a5b['params']['id']}})[_0x51b6('0x24')](handleEntityNotFound(_0x2df2fa,null))[_0x51b6('0x24')](saveUpdates(_0x5a8a5b[_0x51b6('0x29')],null))['then'](respondWithResult(_0x2df2fa,null))[_0x51b6('0x2c')](handleError(_0x2df2fa,null));};exports[_0x51b6('0x25')]=function(_0x29d89b,_0x155e67){return db['Action'][_0x51b6('0x2b')]({'where':{'id':_0x29d89b['params']['id']}})[_0x51b6('0x24')](handleEntityNotFound(_0x155e67,null))[_0x51b6('0x24')](removeEntity(_0x155e67,null))['catch'](handleError(_0x155e67,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 83ae045..5348509 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 _0x3d8b=['Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define'];(function(_0x3b8160,_0x595e89){var _0x27141d=function(_0x21e906){while(--_0x21e906){_0x3b8160['push'](_0x3b8160['shift']());}};_0x27141d(++_0x595e89);}(_0x3d8b,0x89));var _0xb3d8=function(_0x3a8e72,_0xe9e69){_0x3a8e72=_0x3a8e72-0x0;var _0x5dcd19=_0x3d8b[_0x3a8e72];return _0x5dcd19;};'use strict';var _=require(_0xb3d8('0x0'));var util=require(_0xb3d8('0x1'));var logger=require(_0xb3d8('0x2'))(_0xb3d8('0x3'));var moment=require(_0xb3d8('0x4'));var BPromise=require(_0xb3d8('0x5'));var rp=require(_0xb3d8('0x6'));var fs=require('fs');var path=require(_0xb3d8('0x7'));var rimraf=require(_0xb3d8('0x8'));var config=require(_0xb3d8('0x9'));var attributes=require(_0xb3d8('0xa'));module[_0xb3d8('0xb')]=function(_0x3c498d,_0x385066){return _0x3c498d[_0xb3d8('0xc')](_0xb3d8('0xd'),attributes,{'tableName':_0xb3d8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5c5=['exports','Action','lodash','util','moment','bluebird','request-promise','../../config/environment','./action.attributes'];(function(_0x3e5830,_0x31b12d){var _0x3bdf52=function(_0xb69a7){while(--_0xb69a7){_0x3e5830['push'](_0x3e5830['shift']());}};_0x3bdf52(++_0x31b12d);}(_0xa5c5,0x185));var _0x5a5c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa5c5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5a5c('0x0'));var util=require(_0x5a5c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5a5c('0x2'));var BPromise=require(_0x5a5c('0x3'));var rp=require(_0x5a5c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5a5c('0x5'));var attributes=require(_0x5a5c('0x6'));module[_0x5a5c('0x7')]=function(_0x4f37e5,_0x1f53ef){return _0x4f37e5['define'](_0x5a5c('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 59ad7b4..93ec43b 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 _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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')]('Action,\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 _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(_0x563493,_0x274414){var _0x52b5fb=function(_0x23772d){while(--_0x23772d){_0x563493['push'](_0x563493['shift']());}};_0x52b5fb(++_0x274414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 4b7cf03..7bb8880 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 _0x87fa=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','update','delete','isAuthenticated','destroy'];(function(_0x4e00b0,_0x21791c){var _0x26376d=function(_0x3d5600){while(--_0x3d5600){_0x4e00b0['push'](_0x4e00b0['shift']());}};_0x26376d(++_0x21791c);}(_0x87fa,0x8c));var _0xa87f=function(_0x1ffe31,_0x5e1cf1){_0x1ffe31=_0x1ffe31-0x0;var _0x5e070e=_0x87fa[_0x1ffe31];return _0x5e070e;};'use strict';var multer=require(_0xa87f('0x0'));var util=require('util');var path=require(_0xa87f('0x1'));var timeout=require(_0xa87f('0x2'));var express=require(_0xa87f('0x3'));var router=express[_0xa87f('0x4')]();var auth=require(_0xa87f('0x5'));var interaction=require(_0xa87f('0x6'));var config=require('../../config/environment');var controller=require(_0xa87f('0x7'));router[_0xa87f('0x8')](_0xa87f('0x9'),auth['isAuthenticated'](),controller[_0xa87f('0xa')]);router[_0xa87f('0xb')](_0xa87f('0x9'),auth[_0xa87f('0xc')](),controller[_0xa87f('0xd')]);module['exports']=router; \ No newline at end of file +var _0x3654=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','exports','multer','util','path'];(function(_0x2c5fe4,_0x2ae8e5){var _0x20a6cf=function(_0x55e50f){while(--_0x55e50f){_0x2c5fe4['push'](_0x2c5fe4['shift']());}};_0x20a6cf(++_0x2ae8e5);}(_0x3654,0x19d));var _0x4365=function(_0x9203df,_0x13ac20){_0x9203df=_0x9203df-0x0;var _0x26b9b9=_0x3654[_0x9203df];return _0x26b9b9;};'use strict';var multer=require(_0x4365('0x0'));var util=require(_0x4365('0x1'));var path=require(_0x4365('0x2'));var timeout=require(_0x4365('0x3'));var express=require('express');var router=express[_0x4365('0x4')]();var auth=require(_0x4365('0x5'));var interaction=require(_0x4365('0x6'));var config=require(_0x4365('0x7'));var controller=require(_0x4365('0x8'));router['put'](_0x4365('0x9'),auth[_0x4365('0xa')](),controller[_0x4365('0xb')]);router['delete'](_0x4365('0x9'),auth[_0x4365('0xa')](),controller['destroy']);module[_0x4365('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 372a65a..0aea8af 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 _0x8175=['sequelize','exports','STRING'];(function(_0x4d399b,_0x3bd4a4){var _0x4435e5=function(_0x587f0a){while(--_0x587f0a){_0x4d399b['push'](_0x4d399b['shift']());}};_0x4435e5(++_0x3bd4a4);}(_0x8175,0x18f));var _0x5817=function(_0x1521be,_0x34aa83){_0x1521be=_0x1521be-0x0;var _0x156a8e=_0x8175[_0x1521be];return _0x156a8e;};'use strict';var Sequelize=require(_0x5817('0x0'));module[_0x5817('0x1')]={'name':{'type':Sequelize[_0x5817('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5817('0x2')]},'parent':{'type':Sequelize[_0x5817('0x2')]},'table':{'type':Sequelize[_0x5817('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9e44=['exports','STRING','TEXT','sequelize'];(function(_0x2dcbde,_0xabbf8){var _0x45cb97=function(_0x61c4f6){while(--_0x61c4f6){_0x2dcbde['push'](_0x2dcbde['shift']());}};_0x45cb97(++_0xabbf8);}(_0x9e44,0x1db));var _0x49e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e44[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x49e4('0x0'));module[_0x49e4('0x1')]={'name':{'type':Sequelize[_0x49e4('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x49e4('0x2')]},'table':{'type':Sequelize[_0x49e4('0x2')]},'conditions':{'type':Sequelize[_0x49e4('0x3')]},'joins':{'type':Sequelize[_0x49e4('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 6c1cf4f..5f31903 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 _0xa665=['get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','debug','Limited\x20Query:','toString','sequelize','QueryTypes','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','Sequelize','ValidationErrorItem','keyBy','select','output','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','operator','alias','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','count','offset','limit','set','apply','update','then','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa665,0x7e));var _0x5a66=function(_0x57b248,_0x2d5053){_0x57b248=_0x57b248-0x0;var _0x3a55f5=_0xa665[_0x57b248];return _0x3a55f5;};'use strict';var pdf=require(_0x5a66('0x0'));var emlformat=require(_0x5a66('0x1'));var rimraf=require(_0x5a66('0x2'));var zipdir=require(_0x5a66('0x3'));var jsonpatch=require(_0x5a66('0x4'));var rp=require(_0x5a66('0x5'));var moment=require('moment');var BPromise=require(_0x5a66('0x6'));var Mustache=require(_0x5a66('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5a66('0x8'));var csv=require(_0x5a66('0x9'));var ejs=require(_0x5a66('0xa'));var fs=require('fs');var _=require(_0x5a66('0xb'));var squel=require(_0x5a66('0xc'));var crypto=require(_0x5a66('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5a66('0x9'));var querystring=require(_0x5a66('0xe'));var Papa=require('papaparse');var Redis=require(_0x5a66('0xf'));var authService=require(_0x5a66('0x10'));var qs=require(_0x5a66('0x11'));var as=require(_0x5a66('0x12'));var hardwareService=require(_0x5a66('0x13'));var logger=require(_0x5a66('0x14'))(_0x5a66('0x15'));var utils=require(_0x5a66('0x16'));var config=require(_0x5a66('0x17'));var licenseUtil=require(_0x5a66('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5a66('0x19'))[_0x5a66('0x1a')];function respondWithStatusCode(_0x1a0d57,_0x16ccde){_0x16ccde=_0x16ccde||0xcc;return function(_0x43364a){if(_0x43364a){return _0x1a0d57[_0x5a66('0x1b')](_0x16ccde);}return _0x1a0d57['status'](_0x16ccde)[_0x5a66('0x1c')]();};}function respondWithResult(_0x53f687,_0x2ec2cc){_0x2ec2cc=_0x2ec2cc||0xc8;return function(_0x51f711){if(_0x51f711){return _0x53f687[_0x5a66('0x1d')](_0x2ec2cc)[_0x5a66('0x1e')](_0x51f711);}};}function respondWithFilteredResult(_0x3e10de,_0x177716){return function(_0x2f9d51){if(_0x2f9d51){var _0x720978=_0x2f9d51[_0x5a66('0x1f')],_0x3691e0=_0x177716[_0x5a66('0x20')],_0x307bd3=_0x177716['offset']+_0x177716[_0x5a66('0x21')],_0x13946d;if(_0x307bd3>=_0x720978){_0x307bd3=_0x720978;_0x13946d=0xc8;}else{_0x13946d=0xce;}_0x3e10de['status'](_0x13946d);return _0x3e10de[_0x5a66('0x22')]('Content-Range',_0x3691e0+'-'+_0x307bd3+'/'+_0x720978)['json'](_0x2f9d51);}return null;};}function patchUpdates(_0x591bba){return function(_0x113fad){try{jsonpatch[_0x5a66('0x23')](_0x113fad,_0x591bba,!![]);}catch(_0x252792){return BPromise['reject'](_0x252792);}return _0x113fad['save']();};}function saveUpdates(_0x177308,_0xf004a){return function(_0x4aba8d){if(_0x4aba8d){return _0x4aba8d[_0x5a66('0x24')](_0x177308)[_0x5a66('0x25')](function(_0x1ad942){return _0x1ad942;});}return null;};}function removeEntity(_0x54813d,_0x1f4382){return function(_0x2cf5c7){if(_0x2cf5c7){return _0x2cf5c7[_0x5a66('0x26')]()[_0x5a66('0x25')](function(){var _0xb43757=_0x2cf5c7[_0x5a66('0x27')]({'plain':!![]});var _0x5d59b5=_0x5a66('0x28');return db[_0x5a66('0x29')][_0x5a66('0x26')]({'where':{'type':_0x5d59b5,'resourceId':_0xb43757['id']}})['then'](function(){return _0x2cf5c7;});})['then'](function(){_0x54813d[_0x5a66('0x1d')](0xcc)[_0x5a66('0x1c')]();});}};}function handleEntityNotFound(_0x185ab4,_0x5aec74){return function(_0x16e22b){if(!_0x16e22b){_0x185ab4[_0x5a66('0x1b')](0x194);}return _0x16e22b;};}function handleError(_0x435b58,_0x396787){_0x396787=_0x396787||0x1f4;return function(_0x1495f8){logger[_0x5a66('0x2a')](_0x1495f8[_0x5a66('0x2b')]);if(_0x1495f8[_0x5a66('0x2c')]){delete _0x1495f8[_0x5a66('0x2c')];}_0x435b58[_0x5a66('0x1d')](_0x396787)[_0x5a66('0x2d')](_0x1495f8);};}exports[_0x5a66('0x2e')]=function(_0x17718e,_0x184f7b){var _0x15f613={},_0x2b90ee={},_0x330341={'count':0x0,'rows':[]};var _0x47da1c=_[_0x5a66('0x2f')](db[_0x5a66('0x30')][_0x5a66('0x31')],function(_0x4dcc68){return{'name':_0x4dcc68[_0x5a66('0x32')],'type':_0x4dcc68[_0x5a66('0x33')][_0x5a66('0x34')]};});_0x2b90ee['model']=_[_0x5a66('0x2f')](_0x47da1c,_0x5a66('0x2c'));_0x2b90ee[_0x5a66('0x35')]=_['keys'](_0x17718e[_0x5a66('0x35')]);_0x2b90ee['filters']=_[_0x5a66('0x36')](_0x2b90ee[_0x5a66('0x37')],_0x2b90ee['query']);_0x15f613[_0x5a66('0x38')]=_[_0x5a66('0x36')](_0x2b90ee['model'],qs[_0x5a66('0x39')](_0x17718e['query']['fields']));_0x15f613['attributes']=_0x15f613[_0x5a66('0x38')][_0x5a66('0x3a')]?_0x15f613[_0x5a66('0x38')]:_0x2b90ee['model'];if(!_0x17718e[_0x5a66('0x35')]['hasOwnProperty'](_0x5a66('0x3b'))){_0x15f613['limit']=qs[_0x5a66('0x21')](_0x17718e[_0x5a66('0x35')][_0x5a66('0x21')]);_0x15f613['offset']=qs[_0x5a66('0x20')](_0x17718e[_0x5a66('0x35')][_0x5a66('0x20')]);}_0x15f613['order']=qs['sort'](_0x17718e[_0x5a66('0x35')][_0x5a66('0x3c')]);_0x15f613['where']=qs[_0x5a66('0x3d')](_[_0x5a66('0x3e')](_0x17718e['query'],_0x2b90ee['filters']),_0x47da1c);if(_0x17718e[_0x5a66('0x35')][_0x5a66('0x3f')]){_0x15f613['where']=_[_0x5a66('0x40')](_0x15f613[_0x5a66('0x41')],{'$or':_[_0x5a66('0x2f')](_0x47da1c,function(_0x157437){if(_0x157437['type']!==_0x5a66('0x42')){var _0x4d04eb={};_0x4d04eb[_0x157437[_0x5a66('0x2c')]]={'$like':'%'+_0x17718e['query']['filter']+'%'};return _0x4d04eb;}})});}_0x15f613=_[_0x5a66('0x40')]({},_0x15f613,_0x17718e[_0x5a66('0x43')]);var _0x448858={'where':_0x15f613[_0x5a66('0x41')]};return db[_0x5a66('0x30')][_0x5a66('0x1f')](_0x448858)[_0x5a66('0x25')](function(_0x15874a){_0x330341[_0x5a66('0x1f')]=_0x15874a;if(_0x17718e[_0x5a66('0x35')][_0x5a66('0x44')]){_0x15f613['include']=[{'all':!![]}];}return db[_0x5a66('0x30')][_0x5a66('0x45')](_0x15f613);})[_0x5a66('0x25')](function(_0x4d23f0){_0x330341['rows']=_0x4d23f0;return _0x330341;})['then'](respondWithFilteredResult(_0x184f7b,_0x15f613))['catch'](handleError(_0x184f7b,null));};exports[_0x5a66('0x46')]=function(_0x1a210c,_0x3665a5){var _0x30efcc={'raw':![],'where':{'id':_0x1a210c['params']['id']}},_0x49b2d1={};_0x49b2d1['model']=_[_0x5a66('0x47')](db[_0x5a66('0x30')][_0x5a66('0x31')]);_0x49b2d1[_0x5a66('0x35')]=_[_0x5a66('0x47')](_0x1a210c[_0x5a66('0x35')]);_0x49b2d1[_0x5a66('0x3d')]=_[_0x5a66('0x36')](_0x49b2d1[_0x5a66('0x37')],_0x49b2d1[_0x5a66('0x35')]);_0x30efcc[_0x5a66('0x38')]=_[_0x5a66('0x36')](_0x49b2d1[_0x5a66('0x37')],qs[_0x5a66('0x39')](_0x1a210c[_0x5a66('0x35')][_0x5a66('0x39')]));_0x30efcc['attributes']=_0x30efcc[_0x5a66('0x38')]['length']?_0x30efcc['attributes']:_0x49b2d1[_0x5a66('0x37')];if(_0x1a210c['query']['includeAll']){_0x30efcc[_0x5a66('0x48')]=[{'all':!![]}];}_0x30efcc=_[_0x5a66('0x40')]({},_0x30efcc,_0x1a210c[_0x5a66('0x43')]);return db[_0x5a66('0x30')][_0x5a66('0x49')](_0x30efcc)[_0x5a66('0x25')](handleEntityNotFound(_0x3665a5,null))[_0x5a66('0x25')](respondWithResult(_0x3665a5,null))[_0x5a66('0x4a')](handleError(_0x3665a5,null));};exports[_0x5a66('0x4b')]=function(_0x18162d,_0x511eb0){return db[_0x5a66('0x30')][_0x5a66('0x4b')](_0x18162d[_0x5a66('0x4c')],{})[_0x5a66('0x25')](function(_0xff441a){var _0x4099ac=_0x18162d[_0x5a66('0x4d')][_0x5a66('0x27')]({'plain':!![]});if(!_0x4099ac)throw new Error(_0x5a66('0x4e'));if(_0x4099ac[_0x5a66('0x4f')]===_0x5a66('0x4d')){var _0x3365ee=_0xff441a['get']({'plain':!![]});var _0x40f7ef='Reports';return db[_0x5a66('0x50')]['find']({'where':{'name':_0x40f7ef,'userProfileId':_0x4099ac['userProfileId']},'raw':!![]})['then'](function(_0x1e4704){if(_0x1e4704&&_0x1e4704[_0x5a66('0x51')]===0x0){return db[_0x5a66('0x29')][_0x5a66('0x4b')]({'name':_0x3365ee[_0x5a66('0x2c')],'resourceId':_0x3365ee['id'],'type':_0x5a66('0x28'),'sectionId':_0x1e4704['id']},{})[_0x5a66('0x25')](function(){return _0xff441a;});}else{return _0xff441a;}})['catch'](function(_0x539642){logger[_0x5a66('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x539642);throw _0x539642;});}return _0xff441a;})[_0x5a66('0x25')](respondWithResult(_0x511eb0,0xc9))['catch'](handleError(_0x511eb0,null));};exports[_0x5a66('0x24')]=function(_0x126438,_0x2a9fdd){if(_0x126438[_0x5a66('0x4c')]['id']){delete _0x126438[_0x5a66('0x4c')]['id'];}return db[_0x5a66('0x30')][_0x5a66('0x49')]({'where':{'id':_0x126438[_0x5a66('0x52')]['id']}})[_0x5a66('0x25')](handleEntityNotFound(_0x2a9fdd,null))['then'](saveUpdates(_0x126438[_0x5a66('0x4c')],null))['then'](respondWithResult(_0x2a9fdd,null))[_0x5a66('0x4a')](handleError(_0x2a9fdd,null));};exports['destroy']=function(_0x121b19,_0x43a178){return db[_0x5a66('0x30')][_0x5a66('0x49')]({'where':{'id':_0x121b19[_0x5a66('0x52')]['id']}})[_0x5a66('0x25')](handleEntityNotFound(_0x43a178,null))[_0x5a66('0x25')](removeEntity(_0x43a178,null))[_0x5a66('0x4a')](handleError(_0x43a178,null));};exports['preview']=function(_0xd2c91e,_0x272cd3){var _0x85f902=0xa;var _0x12bb60=[_0x5a66('0x53'),_0x5a66('0x54'),_0x5a66('0x55'),_0x5a66('0x56')];var _0x5b4a5a={'SUM':_0x5a66('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5a66('0x58'),'MAX':'MAX(%s)','MIN':_0x5a66('0x59'),'AVG':_0x5a66('0x5a'),'GROUP_CONCAT':_0x5a66('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x5a66('0x5c')};var _0x121439={'SEC_TO_TIME':_0x5a66('0x5d'),'DATE':_0x5a66('0x5e'),'HOUR':_0x5a66('0x5f'),'ROUND':_0x5a66('0x60'),'UNIX_TIMESTAMP':_0x5a66('0x61')};var _0x1bb629=function(_0x3c91b2){return!_[_0x5a66('0x62')]([_0x5a66('0x63'),_0x5a66('0x64'),_0x5a66('0x65'),_0x5a66('0x66')],_0x3c91b2);};var _0x513211=function(_0x7e0615){if(!_0x7e0615||!_0x7e0615['rules']['length']){return'';}for(var _0x54e352='(',_0x5ed123=0x0;_0x5ed123<_0x7e0615[_0x5a66('0x67')][_0x5a66('0x3a')];_0x5ed123+=0x1){_0x5ed123>0x0&&(_0x54e352+='\x20'+_0x7e0615['operator']+'\x20');_0x54e352+=_0x7e0615[_0x5a66('0x67')][_0x5ed123][_0x5a66('0x68')]?_0x513211(_0x7e0615[_0x5a66('0x67')][_0x5ed123]['group']):_0x7e0615['rules'][_0x5ed123][_0x5a66('0x69')]+'\x20'+_0x7e0615[_0x5a66('0x67')][_0x5ed123][_0x5a66('0x6a')]+(_0x1bb629(_0x7e0615[_0x5a66('0x67')][_0x5ed123][_0x5a66('0x6a')])?'\x20'+_0x7e0615['rules'][_0x5ed123][_0x5a66('0x6b')]:'');}return _0x54e352+')';};var _0x38578a={'where':{'id':_0xd2c91e[_0x5a66('0x52')]['id']}},_0x313a01,_0x59085f,_0x442f30,_0x22f37e,_0x53924c;_0x38578a=_[_0x5a66('0x40')]({},_0x38578a,_0xd2c91e[_0x5a66('0x43')]);return db['AnalyticCustomReport'][_0x5a66('0x49')](_0x38578a)[_0x5a66('0x25')](function(_0x36e422){if(_0x36e422){_0x313a01=_0x36e422;return _0x36e422[_0x5a66('0x6c')]();}return null;})[_0x5a66('0x25')](function(_0xfd01bf){if(_0xfd01bf){if(!_0xfd01bf[_0x5a66('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5a66('0x6d'),0x193);}_0x59085f=_0xfd01bf;return db[_0x5a66('0x6e')][_0x5a66('0x45')]({'raw':!![]});}return null;})['then'](function(_0x29d51c){if(_0x29d51c){_0x442f30=_['keyBy'](_0x29d51c,'id');var _0x478a55;var _0x1c319f=squel['select']();_0x1c319f[_0x5a66('0x6f')](_0x313a01[_0x5a66('0x70')]);for(var _0x1a4f93=0x0;_0x1a4f93<_0x59085f[_0x5a66('0x3a')];_0x1a4f93+=0x1){_0x478a55=_0x59085f[_0x1a4f93][_0x5a66('0x71')]?_0x442f30[_0x59085f[_0x1a4f93][_0x5a66('0x71')]][_0x5a66('0x72')]:_0x59085f[_0x1a4f93][_0x5a66('0x69')];_0x478a55=_0x59085f[_0x1a4f93][_0x5a66('0x73')]?_[_0x5a66('0x74')](_0x5b4a5a[_0x59085f[_0x1a4f93][_0x5a66('0x73')]],'%s',_0x478a55):_0x478a55;_0x478a55=_0x59085f[_0x1a4f93][_0x5a66('0x75')]?_[_0x5a66('0x74')](_0x121439[_0x59085f[_0x1a4f93][_0x5a66('0x75')]],'%s',_0x478a55):_0x478a55;if(_0x59085f[_0x1a4f93][_0x5a66('0x76')]){_0x1c319f['group'](_0x478a55);}_0x59085f[_0x1a4f93][_0x5a66('0x77')]&&_0x1c319f[_0x5a66('0x78')](_0x478a55,_0x59085f[_0x1a4f93][_0x5a66('0x77')]===_0x5a66('0x79')?![]:!![]);_0x1c319f[_0x5a66('0x69')](_0x478a55,_0x59085f[_0x1a4f93]['alias']||_0x478a55);}if(_0x313a01[_0x5a66('0x7a')]){_0x313a01[_0x5a66('0x7a')]=JSON['parse'](_0x313a01[_0x5a66('0x7a')]);for(var _0x59205b=0x0;_0x59205b<_0x313a01[_0x5a66('0x7a')][_0x5a66('0x3a')];_0x59205b+=0x1){if(_0x313a01[_0x5a66('0x7a')][_0x59205b][_0x5a66('0x33')]&&_[_0x5a66('0x62')](_0x12bb60,_0x313a01['joins'][_0x59205b][_0x5a66('0x33')])&&_0x313a01[_0x5a66('0x7a')][_0x59205b][_0x5a66('0x7b')]&&_0x313a01[_0x5a66('0x7a')][_0x59205b]['foreignTable']&&_0x313a01['joins'][_0x59205b][_0x5a66('0x7c')]){_0x1c319f[_0x313a01[_0x5a66('0x7a')][_0x59205b][_0x5a66('0x33')]](_0x313a01['joins'][_0x59205b][_0x5a66('0x7d')],null,util[_0x5a66('0x75')](_0x5a66('0x7e'),_0x313a01[_0x5a66('0x70')],_0x313a01[_0x5a66('0x7a')][_0x59205b][_0x5a66('0x7b')],_0x313a01[_0x5a66('0x7a')][_0x59205b][_0x5a66('0x7d')],_0x313a01[_0x5a66('0x7a')][_0x59205b]['foreignKey']));}}}if(_0x313a01[_0x5a66('0x7f')]){_0x313a01[_0x5a66('0x7f')]=JSON[_0x5a66('0x80')](_0x313a01[_0x5a66('0x7f')]);_0x1c319f['where'](_0x513211(_0x313a01[_0x5a66('0x7f')][_0x5a66('0x68')]));}_0x53924c=_0x1c319f['clone']();_0x1c319f['limit'](_0x85f902);_0x1c319f[_0x5a66('0x20')](0x0);logger[_0x5a66('0x81')](_0x5a66('0x82'),_0x1c319f[_0x5a66('0x83')]());return dbH[_0x5a66('0x84')]['query'](_0x1c319f[_0x5a66('0x83')](),{'type':dbH[_0x5a66('0x84')][_0x5a66('0x85')]['SELECT']});}})[_0x5a66('0x25')](respondWithResult(_0x272cd3,null))[_0x5a66('0x4a')](handleError(_0x272cd3,null));};function runReport(_0x1401ff,_0x952d79,_0x2b5735){var _0x448cf8=_0x952d79[_0x5a66('0x2c')];var _0x1c0025=0xa;var _0xffdc45=['join','left_join','right_join',_0x5a66('0x56')];var _0x223d53={'SUM':_0x5a66('0x57'),'COUNT':_0x5a66('0x86'),'COUNT DISTINCT':_0x5a66('0x58'),'MAX':_0x5a66('0x87'),'MIN':_0x5a66('0x59'),'AVG':_0x5a66('0x5a'),'GROUP_CONCAT':_0x5a66('0x5b'),'GROUP_CONCAT ASC':_0x5a66('0x88'),'GROUP_CONCAT DESC':_0x5a66('0x5c')};var _0x2102a9={'SEC_TO_TIME':_0x5a66('0x5d'),'DATE':_0x5a66('0x5e'),'HOUR':_0x5a66('0x5f'),'ROUND':_0x5a66('0x60'),'UNIX_TIMESTAMP':_0x5a66('0x61')};var _0x27b7d2=function(_0xcca462){return!_[_0x5a66('0x62')]([_0x5a66('0x63'),_0x5a66('0x64'),_0x5a66('0x65'),'IS\x20NOT\x20EMPTY'],_0xcca462);};var _0x560fe9=function(_0x1aa650){if(!_0x1aa650||!_0x1aa650['rules'][_0x5a66('0x3a')]){return'';}for(var _0x58a046='(',_0x43ae27=0x0;_0x43ae27<_0x1aa650[_0x5a66('0x67')][_0x5a66('0x3a')];_0x43ae27+=0x1){_0x43ae27>0x0&&(_0x58a046+='\x20'+_0x1aa650['operator']+'\x20');_0x58a046+=_0x1aa650[_0x5a66('0x67')][_0x43ae27][_0x5a66('0x68')]?_0x560fe9(_0x1aa650['rules'][_0x43ae27][_0x5a66('0x68')]):_0x1aa650[_0x5a66('0x67')][_0x43ae27]['field']+'\x20'+_0x1aa650['rules'][_0x43ae27]['condition']+(_0x27b7d2(_0x1aa650['rules'][_0x43ae27]['condition'])?'\x20'+_0x1aa650[_0x5a66('0x67')][_0x43ae27][_0x5a66('0x6b')]:'');}return _0x58a046+')';};var _0x5d64e2={'where':{'id':_0x1401ff['id']}},_0x50b452,_0x2b7b54,_0x30686c,_0x25da1f,_0x1c876f;_0x5d64e2=_[_0x5a66('0x40')]({},_0x5d64e2,_0x2b5735);return db[_0x5a66('0x30')][_0x5a66('0x49')](_0x5d64e2)[_0x5a66('0x25')](function(_0x260d2a){if(_0x260d2a){_0x50b452=_0x260d2a;return _0x260d2a[_0x5a66('0x6c')]();}return null;})['then'](function(_0x218fad){if(_0x218fad){if(!_0x218fad['length']){throw new db[(_0x5a66('0x89'))][(_0x5a66('0x8a'))](_0x5a66('0x6d'),0x193);}_0x2b7b54=_0x218fad;return db['AnalyticMetric'][_0x5a66('0x45')]({'raw':!![]});}return null;})[_0x5a66('0x25')](function(_0x1a4203){if(_0x1a4203){_0x30686c=_[_0x5a66('0x8b')](_0x1a4203,'id');var _0x20e036;var _0x2694f0=squel[_0x5a66('0x8c')]();_0x2694f0['from'](_0x50b452[_0x5a66('0x70')]);for(var _0x526da4=0x0;_0x526da4<_0x2b7b54['length'];_0x526da4+=0x1){_0x20e036=_0x2b7b54[_0x526da4][_0x5a66('0x71')]?_0x30686c[_0x2b7b54[_0x526da4]['MetricId']][_0x5a66('0x72')]:_0x2b7b54[_0x526da4][_0x5a66('0x69')];_0x20e036=_0x2b7b54[_0x526da4][_0x5a66('0x73')]?_[_0x5a66('0x74')](_0x223d53[_0x2b7b54[_0x526da4][_0x5a66('0x73')]],'%s',_0x20e036):_0x20e036;_0x20e036=_0x2b7b54[_0x526da4][_0x5a66('0x75')]?_['replace'](_0x2102a9[_0x2b7b54[_0x526da4][_0x5a66('0x75')]],'%s',_0x20e036):_0x20e036;if(_0x2b7b54[_0x526da4]['groupBy']){_0x2694f0[_0x5a66('0x68')](_0x20e036);}_0x2b7b54[_0x526da4]['orderBy']&&_0x2694f0['order'](_0x20e036,_0x2b7b54[_0x526da4][_0x5a66('0x77')]==='DESC'?![]:!![]);_0x2694f0[_0x5a66('0x69')](_0x20e036,_0x2b7b54[_0x526da4]['alias']||_0x20e036);}if(_0x50b452['joins']){_0x50b452[_0x5a66('0x7a')]=JSON[_0x5a66('0x80')](_0x50b452[_0x5a66('0x7a')]);for(var _0x267edb=0x0;_0x267edb<_0x50b452[_0x5a66('0x7a')]['length'];_0x267edb+=0x1){if(_0x50b452[_0x5a66('0x7a')][_0x267edb]['type']&&_[_0x5a66('0x62')](_0xffdc45,_0x50b452['joins'][_0x267edb][_0x5a66('0x33')])&&_0x50b452[_0x5a66('0x7a')][_0x267edb][_0x5a66('0x7b')]&&_0x50b452[_0x5a66('0x7a')][_0x267edb][_0x5a66('0x7d')]&&_0x50b452[_0x5a66('0x7a')][_0x267edb][_0x5a66('0x7c')]){_0x2694f0[_0x50b452['joins'][_0x267edb][_0x5a66('0x33')]](_0x50b452[_0x5a66('0x7a')][_0x267edb][_0x5a66('0x7d')],null,util[_0x5a66('0x75')]('%s.%s\x20=\x20%s.%s',_0x50b452[_0x5a66('0x70')],_0x50b452[_0x5a66('0x7a')][_0x267edb][_0x5a66('0x7b')],_0x50b452[_0x5a66('0x7a')][_0x267edb][_0x5a66('0x7d')],_0x50b452[_0x5a66('0x7a')][_0x267edb]['foreignKey']));}}}if(_0x50b452[_0x5a66('0x7f')]){_0x50b452[_0x5a66('0x7f')]=JSON[_0x5a66('0x80')](_0x50b452[_0x5a66('0x7f')]);_0x2694f0[_0x5a66('0x41')](_0x560fe9(_0x50b452['conditions'][_0x5a66('0x68')]));}_0x1c876f=_0x2694f0['clone']();_0x2694f0[_0x5a66('0x21')](_0x1c0025);_0x2694f0[_0x5a66('0x20')](0x0);return;}})[_0x5a66('0x25')](function(){if(_0x952d79[_0x5a66('0x8d')]==='web'){return null;}var _0x153053=_['merge'](_0x952d79,{'name':_0x952d79['fullPath']||_0x952d79[_0x5a66('0x2c')]||_0x50b452[_0x5a66('0x2c')],'basename':_0x448cf8,'savename':util[_0x5a66('0x75')](_0x5a66('0x8e'),_0x952d79[_0x5a66('0x2c')]||_0x50b452[_0x5a66('0x2c')],require(_0x5a66('0x8f'))[_0x5a66('0x90')](0x4),_0x952d79[_0x5a66('0x8d')]||_0x5a66('0x91')),'reportId':_0x50b452['id'],'reportType':_0x5a66('0x92')});return db[_0x5a66('0x93')][_0x5a66('0x4b')](_0x153053,{'raw':!![]});})[_0x5a66('0x25')](function(_0xb3bf1){if(_0x50b452[_0x5a66('0x70')]===_0x5a66('0x94')){_0x1c876f[_0x5a66('0x41')](_0x50b452[_0x5a66('0x70')]+_0x5a66('0x95'),_0x952d79['startDate'],_0x952d79[_0x5a66('0x96')]);}else{_0x1c876f[_0x5a66('0x41')](_0x50b452['table']+_0x5a66('0x97'),_0x952d79[_0x5a66('0x98')],_0x952d79[_0x5a66('0x96')]);}if(_0xb3bf1){logger[_0x5a66('0x99')]('Run\x20Query:',_0x1c876f[_0x5a66('0x83')]());require(_0x5a66('0x9a'))[_0x5a66('0x9b')](path[_0x5a66('0x53')](__dirname,_0x5a66('0x9c'),_0xb3bf1[_0x5a66('0x8d')]),[_0xb3bf1['id'],_0x1c876f[_0x5a66('0x83')](),path[_0x5a66('0x53')](__dirname,_0x5a66('0x9d'),_0xb3bf1[_0x5a66('0x9e')]),_0x448cf8]);return _0xb3bf1;}else{var _0x10bc84=squel[_0x5a66('0x8c')]();_0x10bc84[_0x5a66('0x6f')]('('+_0x1c876f['toString']()+')',_0x5a66('0x9f'));_0x10bc84[_0x5a66('0x69')](_0x5a66('0xa0'),_0x5a66('0x1f'));_0x1c876f[_0x5a66('0x21')](_0x952d79['limit']||_0x1c0025);_0x1c876f[_0x5a66('0x20')](_0x952d79[_0x5a66('0x20')]||0x0);return dbH['sequelize'][_0x5a66('0x35')](_0x10bc84[_0x5a66('0x83')](),{'type':dbH[_0x5a66('0x84')][_0x5a66('0x85')][_0x5a66('0xa1')]})[_0x5a66('0x25')](function(_0x5c0b74){if(!_0x5c0b74[_0x5a66('0x3a')]){_0x25da1f=0x0;}else{_0x25da1f=_0x5c0b74[0x0][_0x5a66('0x1f')]||0x0;}return dbH[_0x5a66('0x84')][_0x5a66('0x35')](_0x1c876f[_0x5a66('0x83')](),{'type':dbH[_0x5a66('0x84')]['QueryTypes'][_0x5a66('0xa1')]});})[_0x5a66('0x25')](function(_0xb70f34){return{'rows':_0xb70f34||[],'count':_0x25da1f};});}});}exports['run']=function(_0x4a2ca2,_0x4cbcbf){return runReport(_0x4a2ca2[_0x5a66('0x52')],_0x4a2ca2[_0x5a66('0x35')],_0x4a2ca2[_0x5a66('0x43')])[_0x5a66('0x25')](respondWithResult(_0x4cbcbf,null))['catch'](handleError(_0x4cbcbf,null));};exports[_0x5a66('0xa2')]=runReport;exports[_0x5a66('0x35')]=function(_0x433e7b,_0x310905){var _0x41c00e=0xa;var _0x411500=[_0x5a66('0x53'),_0x5a66('0x54'),_0x5a66('0x55'),_0x5a66('0x56')];var _0x2ea0b3={'SUM':_0x5a66('0x57'),'COUNT':_0x5a66('0x86'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5a66('0x59'),'AVG':_0x5a66('0x5a'),'GROUP_CONCAT':_0x5a66('0x5b'),'GROUP_CONCAT ASC':_0x5a66('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6f46be={'SEC_TO_TIME':_0x5a66('0x5d'),'DATE':'DATE(%s)','HOUR':_0x5a66('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5a66('0x61')};var _0x4a087b=function(_0x4cdad3){return!_[_0x5a66('0x62')]([_0x5a66('0x63'),_0x5a66('0x64'),_0x5a66('0x65'),_0x5a66('0x66')],_0x4cdad3);};var _0xfb2927=function(_0x1f9e11){if(!_0x1f9e11||!_0x1f9e11['rules'][_0x5a66('0x3a')]){return'';}for(var _0xd755bb='(',_0x5ceb35=0x0;_0x5ceb35<_0x1f9e11[_0x5a66('0x67')]['length'];_0x5ceb35+=0x1){_0x5ceb35>0x0&&(_0xd755bb+='\x20'+_0x1f9e11[_0x5a66('0xa3')]+'\x20');_0xd755bb+=_0x1f9e11[_0x5a66('0x67')][_0x5ceb35][_0x5a66('0x68')]?_0xfb2927(_0x1f9e11['rules'][_0x5ceb35][_0x5a66('0x68')]):_0x1f9e11['rules'][_0x5ceb35][_0x5a66('0x69')]+'\x20'+_0x1f9e11[_0x5a66('0x67')][_0x5ceb35][_0x5a66('0x6a')]+(_0x4a087b(_0x1f9e11[_0x5a66('0x67')][_0x5ceb35][_0x5a66('0x6a')])?'\x20'+_0x1f9e11[_0x5a66('0x67')][_0x5ceb35][_0x5a66('0x6b')]:'');}return _0xd755bb+')';};var _0x3873b8={'where':{'id':_0x433e7b[_0x5a66('0x52')]['id']}},_0x21ae4a,_0x41291e,_0x35be04,_0x57f0e4,_0x22cc46;_0x3873b8=_[_0x5a66('0x40')]({},_0x3873b8,_0x433e7b[_0x5a66('0x43')]);return db['AnalyticCustomReport']['find'](_0x3873b8)[_0x5a66('0x25')](function(_0x262c55){if(_0x262c55){_0x21ae4a=_0x262c55;return _0x262c55['getFields']();}return null;})[_0x5a66('0x25')](function(_0x428787){if(_0x428787){if(!_0x428787['length']){throw new db[(_0x5a66('0x89'))][(_0x5a66('0x8a'))](_0x5a66('0x6d'),0x193);}_0x41291e=_0x428787;return db[_0x5a66('0x6e')][_0x5a66('0x45')]({'raw':!![]});}return null;})[_0x5a66('0x25')](function(_0x439584){if(_0x439584){_0x35be04=_[_0x5a66('0x8b')](_0x439584,'id');var _0x206118;var _0x5ee256=squel[_0x5a66('0x8c')]();_0x5ee256[_0x5a66('0x6f')](_0x21ae4a[_0x5a66('0x70')]);for(var _0x4cf6cd=0x0;_0x4cf6cd<_0x41291e['length'];_0x4cf6cd+=0x1){_0x206118=_0x41291e[_0x4cf6cd]['MetricId']?_0x35be04[_0x41291e[_0x4cf6cd][_0x5a66('0x71')]][_0x5a66('0x72')]:_0x41291e[_0x4cf6cd]['field'];_0x206118=_0x41291e[_0x4cf6cd][_0x5a66('0x73')]?_[_0x5a66('0x74')](_0x2ea0b3[_0x41291e[_0x4cf6cd]['function']],'%s',_0x206118):_0x206118;_0x206118=_0x41291e[_0x4cf6cd][_0x5a66('0x75')]?_['replace'](_0x6f46be[_0x41291e[_0x4cf6cd]['format']],'%s',_0x206118):_0x206118;if(_0x41291e[_0x4cf6cd][_0x5a66('0x76')]){_0x5ee256[_0x5a66('0x68')](_0x206118);}_0x41291e[_0x4cf6cd][_0x5a66('0x77')]&&_0x5ee256['order'](_0x206118,_0x41291e[_0x4cf6cd]['orderBy']===_0x5a66('0x79')?![]:!![]);_0x5ee256[_0x5a66('0x69')](_0x206118,_0x41291e[_0x4cf6cd][_0x5a66('0xa4')]||_0x206118);}if(_0x21ae4a[_0x5a66('0x7a')]){_0x21ae4a[_0x5a66('0x7a')]=JSON[_0x5a66('0x80')](_0x21ae4a[_0x5a66('0x7a')]);for(var _0x3b9056=0x0;_0x3b9056<_0x21ae4a['joins'][_0x5a66('0x3a')];_0x3b9056+=0x1){if(_0x21ae4a[_0x5a66('0x7a')][_0x3b9056]['type']&&_[_0x5a66('0x62')](_0x411500,_0x21ae4a['joins'][_0x3b9056][_0x5a66('0x33')])&&_0x21ae4a[_0x5a66('0x7a')][_0x3b9056][_0x5a66('0x7b')]&&_0x21ae4a[_0x5a66('0x7a')][_0x3b9056][_0x5a66('0x7d')]&&_0x21ae4a['joins'][_0x3b9056][_0x5a66('0x7c')]){_0x5ee256[_0x21ae4a[_0x5a66('0x7a')][_0x3b9056][_0x5a66('0x33')]](_0x21ae4a[_0x5a66('0x7a')][_0x3b9056]['foreignTable'],null,util[_0x5a66('0x75')](_0x5a66('0x7e'),_0x21ae4a[_0x5a66('0x70')],_0x21ae4a[_0x5a66('0x7a')][_0x3b9056][_0x5a66('0x7b')],_0x21ae4a['joins'][_0x3b9056][_0x5a66('0x7d')],_0x21ae4a['joins'][_0x3b9056][_0x5a66('0x7c')]));}}}if(_0x21ae4a[_0x5a66('0x7f')]){_0x21ae4a[_0x5a66('0x7f')]=JSON[_0x5a66('0x80')](_0x21ae4a[_0x5a66('0x7f')]);_0x5ee256[_0x5a66('0x41')](_0xfb2927(_0x21ae4a['conditions'][_0x5a66('0x68')]));}_0x22cc46=_0x5ee256['clone']();_0x5ee256[_0x5a66('0x21')](_0x41c00e);_0x5ee256[_0x5a66('0x20')](0x0);logger[_0x5a66('0x81')](_0x5a66('0x82'),_0x5ee256['toString']());return dbH[_0x5a66('0x84')][_0x5a66('0x35')](_0x5ee256[_0x5a66('0x83')](),{'type':dbH[_0x5a66('0x84')][_0x5a66('0x85')][_0x5a66('0xa1')]});}})['then'](function(){return{'sql':_0x22cc46['toString']()};})[_0x5a66('0x25')](respondWithResult(_0x310905,null))[_0x5a66('0x4a')](handleError(_0x310905,null));}; \ No newline at end of file +var _0x784c=['error','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','params','intersection','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','table','MetricId','function','replace','format','DESC','joins','parse','includes','foreignTable','parentKey','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','AVG(%s)','DATE(%s)','Please\x20insert\x20at\x20least\x20one\x20field','from','metric','groupBy','orderBy','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource'];(function(_0x861987,_0x556ef0){var _0x77b1c0=function(_0x18b9dc){while(--_0x18b9dc){_0x861987['push'](_0x861987['shift']());}};_0x77b1c0(++_0x556ef0);}(_0x784c,0x78));var _0xc784=function(_0xdb96b4,_0x53bee7){_0xdb96b4=_0xdb96b4-0x0;var _0x19b93f=_0x784c[_0xdb96b4];return _0x19b93f;};'use strict';var pdf=require(_0xc784('0x0'));var emlformat=require(_0xc784('0x1'));var rimraf=require(_0xc784('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc784('0x3'));var rp=require('request-promise');var moment=require(_0xc784('0x4'));var BPromise=require(_0xc784('0x5'));var Mustache=require(_0xc784('0x6'));var util=require(_0xc784('0x7'));var path=require(_0xc784('0x8'));var sox=require(_0xc784('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc784('0xa'));var squel=require(_0xc784('0xb'));var crypto=require(_0xc784('0xc'));var jsforce=require(_0xc784('0xd'));var deskjs=require(_0xc784('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc784('0xf'));var Papa=require('papaparse');var Redis=require(_0xc784('0x10'));var authService=require(_0xc784('0x11'));var qs=require(_0xc784('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc784('0x13'));var logger=require(_0xc784('0x14'))(_0xc784('0x15'));var utils=require(_0xc784('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc784('0x17'))['db'];var dbH=require('../../mysqldb')[_0xc784('0x18')];function respondWithStatusCode(_0x2ebb97,_0x46ace6){_0x46ace6=_0x46ace6||0xcc;return function(_0x2db913){if(_0x2db913){return _0x2ebb97[_0xc784('0x19')](_0x46ace6);}return _0x2ebb97[_0xc784('0x1a')](_0x46ace6)[_0xc784('0x1b')]();};}function respondWithResult(_0x2b2472,_0x36dc49){_0x36dc49=_0x36dc49||0xc8;return function(_0x5d27ec){if(_0x5d27ec){return _0x2b2472[_0xc784('0x1a')](_0x36dc49)[_0xc784('0x1c')](_0x5d27ec);}};}function respondWithFilteredResult(_0x1961e7,_0xb11365){return function(_0x2048fe){if(_0x2048fe){var _0x2e7c87=_0x2048fe['count'],_0x252d3f=_0xb11365[_0xc784('0x1d')],_0x3b9b08=_0xb11365[_0xc784('0x1d')]+_0xb11365[_0xc784('0x1e')],_0x467ddd;if(_0x3b9b08>=_0x2e7c87){_0x3b9b08=_0x2e7c87;_0x467ddd=0xc8;}else{_0x467ddd=0xce;}_0x1961e7[_0xc784('0x1a')](_0x467ddd);return _0x1961e7['set']('Content-Range',_0x252d3f+'-'+_0x3b9b08+'/'+_0x2e7c87)['json'](_0x2048fe);}return null;};}function patchUpdates(_0x321268){return function(_0x183228){try{jsonpatch[_0xc784('0x1f')](_0x183228,_0x321268,!![]);}catch(_0x35abb0){return BPromise[_0xc784('0x20')](_0x35abb0);}return _0x183228[_0xc784('0x21')]();};}function saveUpdates(_0x525cc3,_0x554a57){return function(_0x5eb921){if(_0x5eb921){return _0x5eb921[_0xc784('0x22')](_0x525cc3)[_0xc784('0x23')](function(_0x1ff92d){return _0x1ff92d;});}return null;};}function removeEntity(_0x313b18,_0x5f582d){return function(_0x1ca107){if(_0x1ca107){return _0x1ca107[_0xc784('0x24')]()[_0xc784('0x23')](function(){var _0x324cd3=_0x1ca107[_0xc784('0x25')]({'plain':!![]});var _0x5f2e7d=_0xc784('0x26');return db[_0xc784('0x27')][_0xc784('0x24')]({'where':{'type':_0x5f2e7d,'resourceId':_0x324cd3['id']}})[_0xc784('0x23')](function(){return _0x1ca107;});})[_0xc784('0x23')](function(){_0x313b18['status'](0xcc)[_0xc784('0x1b')]();});}};}function handleEntityNotFound(_0x56e175,_0x39f6a8){return function(_0x2fb6ba){if(!_0x2fb6ba){_0x56e175[_0xc784('0x19')](0x194);}return _0x2fb6ba;};}function handleError(_0x5532ec,_0x33b093){_0x33b093=_0x33b093||0x1f4;return function(_0x2a482c){logger[_0xc784('0x28')](_0x2a482c[_0xc784('0x29')]);if(_0x2a482c[_0xc784('0x2a')]){delete _0x2a482c[_0xc784('0x2a')];}_0x5532ec[_0xc784('0x1a')](_0x33b093)[_0xc784('0x2b')](_0x2a482c);};}exports[_0xc784('0x2c')]=function(_0x30b4a2,_0x2ceec5){var _0x54a345={},_0x162c66={},_0x1d1875={'count':0x0,'rows':[]};var _0x845853=_[_0xc784('0x2d')](db[_0xc784('0x2e')]['rawAttributes'],function(_0x48cc0c){return{'name':_0x48cc0c[_0xc784('0x2f')],'type':_0x48cc0c[_0xc784('0x30')]['key']};});_0x162c66[_0xc784('0x31')]=_[_0xc784('0x2d')](_0x845853,_0xc784('0x2a'));_0x162c66[_0xc784('0x32')]=_[_0xc784('0x33')](_0x30b4a2[_0xc784('0x32')]);_0x162c66[_0xc784('0x34')]=_['intersection'](_0x162c66[_0xc784('0x31')],_0x162c66[_0xc784('0x32')]);_0x54a345[_0xc784('0x35')]=_['intersection'](_0x162c66['model'],qs[_0xc784('0x36')](_0x30b4a2[_0xc784('0x32')]['fields']));_0x54a345['attributes']=_0x54a345['attributes'][_0xc784('0x37')]?_0x54a345[_0xc784('0x35')]:_0x162c66['model'];if(!_0x30b4a2[_0xc784('0x32')][_0xc784('0x38')](_0xc784('0x39'))){_0x54a345[_0xc784('0x1e')]=qs[_0xc784('0x1e')](_0x30b4a2[_0xc784('0x32')]['limit']);_0x54a345['offset']=qs[_0xc784('0x1d')](_0x30b4a2[_0xc784('0x32')][_0xc784('0x1d')]);}_0x54a345[_0xc784('0x3a')]=qs['sort'](_0x30b4a2[_0xc784('0x32')][_0xc784('0x3b')]);_0x54a345[_0xc784('0x3c')]=qs[_0xc784('0x34')](_[_0xc784('0x3d')](_0x30b4a2[_0xc784('0x32')],_0x162c66[_0xc784('0x34')]),_0x845853);if(_0x30b4a2[_0xc784('0x32')][_0xc784('0x3e')]){_0x54a345[_0xc784('0x3c')]=_[_0xc784('0x3f')](_0x54a345[_0xc784('0x3c')],{'$or':_[_0xc784('0x2d')](_0x845853,function(_0x42bc26){if(_0x42bc26['type']!==_0xc784('0x40')){var _0x4e06ce={};_0x4e06ce[_0x42bc26[_0xc784('0x2a')]]={'$like':'%'+_0x30b4a2[_0xc784('0x32')][_0xc784('0x3e')]+'%'};return _0x4e06ce;}})});}_0x54a345=_['merge']({},_0x54a345,_0x30b4a2[_0xc784('0x41')]);var _0x328cde={'where':_0x54a345['where']};return db[_0xc784('0x2e')]['count'](_0x328cde)['then'](function(_0x14ef5b){_0x1d1875[_0xc784('0x42')]=_0x14ef5b;if(_0x30b4a2[_0xc784('0x32')]['includeAll']){_0x54a345['include']=[{'all':!![]}];}return db[_0xc784('0x2e')][_0xc784('0x43')](_0x54a345);})['then'](function(_0x458973){_0x1d1875[_0xc784('0x44')]=_0x458973;return _0x1d1875;})[_0xc784('0x23')](respondWithFilteredResult(_0x2ceec5,_0x54a345))['catch'](handleError(_0x2ceec5,null));};exports['show']=function(_0x5b7ec2,_0x4edb28){var _0x469cf6={'raw':![],'where':{'id':_0x5b7ec2[_0xc784('0x45')]['id']}},_0x101234={};_0x101234[_0xc784('0x31')]=_[_0xc784('0x33')](db[_0xc784('0x2e')]['rawAttributes']);_0x101234['query']=_[_0xc784('0x33')](_0x5b7ec2[_0xc784('0x32')]);_0x101234[_0xc784('0x34')]=_['intersection'](_0x101234[_0xc784('0x31')],_0x101234[_0xc784('0x32')]);_0x469cf6[_0xc784('0x35')]=_[_0xc784('0x46')](_0x101234[_0xc784('0x31')],qs[_0xc784('0x36')](_0x5b7ec2[_0xc784('0x32')][_0xc784('0x36')]));_0x469cf6[_0xc784('0x35')]=_0x469cf6[_0xc784('0x35')]['length']?_0x469cf6['attributes']:_0x101234[_0xc784('0x31')];if(_0x5b7ec2[_0xc784('0x32')][_0xc784('0x47')]){_0x469cf6['include']=[{'all':!![]}];}_0x469cf6=_[_0xc784('0x3f')]({},_0x469cf6,_0x5b7ec2['options']);return db[_0xc784('0x2e')][_0xc784('0x48')](_0x469cf6)['then'](handleEntityNotFound(_0x4edb28,null))['then'](respondWithResult(_0x4edb28,null))[_0xc784('0x49')](handleError(_0x4edb28,null));};exports['create']=function(_0x2ce7b8,_0x45fb3a){return db[_0xc784('0x2e')][_0xc784('0x4a')](_0x2ce7b8['body'],{})[_0xc784('0x23')](function(_0xfe0d76){var _0x508bfb=_0x2ce7b8[_0xc784('0x4b')]['get']({'plain':!![]});if(!_0x508bfb)throw new Error(_0xc784('0x4c'));if(_0x508bfb['role']===_0xc784('0x4b')){var _0x189989=_0xfe0d76[_0xc784('0x25')]({'plain':!![]});var _0x4c623a=_0xc784('0x4d');return db[_0xc784('0x4e')][_0xc784('0x48')]({'where':{'name':_0x4c623a,'userProfileId':_0x508bfb[_0xc784('0x4f')]},'raw':!![]})[_0xc784('0x23')](function(_0x4bcde6){if(_0x4bcde6&&_0x4bcde6['autoAssociation']===0x0){return db[_0xc784('0x27')]['create']({'name':_0x189989['name'],'resourceId':_0x189989['id'],'type':_0xc784('0x26'),'sectionId':_0x4bcde6['id']},{})[_0xc784('0x23')](function(){return _0xfe0d76;});}else{return _0xfe0d76;}})['catch'](function(_0x52db8f){logger[_0xc784('0x28')](_0xc784('0x50'),_0x52db8f);throw _0x52db8f;});}return _0xfe0d76;})[_0xc784('0x23')](respondWithResult(_0x45fb3a,0xc9))[_0xc784('0x49')](handleError(_0x45fb3a,null));};exports['update']=function(_0x552745,_0x11a6a0){if(_0x552745[_0xc784('0x51')]['id']){delete _0x552745[_0xc784('0x51')]['id'];}return db[_0xc784('0x2e')][_0xc784('0x48')]({'where':{'id':_0x552745[_0xc784('0x45')]['id']}})[_0xc784('0x23')](handleEntityNotFound(_0x11a6a0,null))[_0xc784('0x23')](saveUpdates(_0x552745[_0xc784('0x51')],null))[_0xc784('0x23')](respondWithResult(_0x11a6a0,null))[_0xc784('0x49')](handleError(_0x11a6a0,null));};exports[_0xc784('0x24')]=function(_0x329d77,_0x46f2a9){return db[_0xc784('0x2e')]['find']({'where':{'id':_0x329d77['params']['id']}})['then'](handleEntityNotFound(_0x46f2a9,null))[_0xc784('0x23')](removeEntity(_0x46f2a9,null))[_0xc784('0x49')](handleError(_0x46f2a9,null));};exports['preview']=function(_0x275a05,_0x1f8042){var _0x559d46=0xa;var _0x281117=['join','left_join',_0xc784('0x52'),_0xc784('0x53')];var _0x244c06={'SUM':_0xc784('0x54'),'COUNT':_0xc784('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc784('0x56'),'MIN':_0xc784('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc784('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc784('0x59')};var _0x1bcd4d={'SEC_TO_TIME':_0xc784('0x5a'),'DATE':'DATE(%s)','HOUR':_0xc784('0x5b'),'ROUND':_0xc784('0x5c'),'UNIX_TIMESTAMP':_0xc784('0x5d')};var _0x1ebd71=function(_0x38e932){return!_['includes']([_0xc784('0x5e'),_0xc784('0x5f'),_0xc784('0x60'),_0xc784('0x61')],_0x38e932);};var _0x22ed1d=function(_0x54f9e5){if(!_0x54f9e5||!_0x54f9e5[_0xc784('0x62')][_0xc784('0x37')]){return'';}for(var _0x447d0b='(',_0x364f1e=0x0;_0x364f1e<_0x54f9e5[_0xc784('0x62')][_0xc784('0x37')];_0x364f1e+=0x1){_0x364f1e>0x0&&(_0x447d0b+='\x20'+_0x54f9e5[_0xc784('0x63')]+'\x20');_0x447d0b+=_0x54f9e5['rules'][_0x364f1e][_0xc784('0x64')]?_0x22ed1d(_0x54f9e5[_0xc784('0x62')][_0x364f1e]['group']):_0x54f9e5[_0xc784('0x62')][_0x364f1e][_0xc784('0x65')]+'\x20'+_0x54f9e5[_0xc784('0x62')][_0x364f1e][_0xc784('0x66')]+(_0x1ebd71(_0x54f9e5[_0xc784('0x62')][_0x364f1e][_0xc784('0x66')])?'\x20'+_0x54f9e5[_0xc784('0x62')][_0x364f1e][_0xc784('0x67')]:'');}return _0x447d0b+')';};var _0x4da044={'where':{'id':_0x275a05[_0xc784('0x45')]['id']}},_0x4b0e5b,_0x271073,_0x478260,_0xd5eb94,_0x21471a;_0x4da044=_[_0xc784('0x3f')]({},_0x4da044,_0x275a05[_0xc784('0x41')]);return db[_0xc784('0x2e')][_0xc784('0x48')](_0x4da044)[_0xc784('0x23')](function(_0x1e786d){if(_0x1e786d){_0x4b0e5b=_0x1e786d;return _0x1e786d['getFields']();}return null;})[_0xc784('0x23')](function(_0x470b3e){if(_0x470b3e){if(!_0x470b3e[_0xc784('0x37')]){throw new db[(_0xc784('0x68'))][(_0xc784('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x271073=_0x470b3e;return db[_0xc784('0x6a')][_0xc784('0x43')]({'raw':!![]});}return null;})[_0xc784('0x23')](function(_0x598476){if(_0x598476){_0x478260=_[_0xc784('0x6b')](_0x598476,'id');var _0x5bf078;var _0x242b75=squel[_0xc784('0x6c')]();_0x242b75['from'](_0x4b0e5b[_0xc784('0x6d')]);for(var _0x5c40cd=0x0;_0x5c40cd<_0x271073['length'];_0x5c40cd+=0x1){_0x5bf078=_0x271073[_0x5c40cd][_0xc784('0x6e')]?_0x478260[_0x271073[_0x5c40cd][_0xc784('0x6e')]]['metric']:_0x271073[_0x5c40cd][_0xc784('0x65')];_0x5bf078=_0x271073[_0x5c40cd][_0xc784('0x6f')]?_[_0xc784('0x70')](_0x244c06[_0x271073[_0x5c40cd][_0xc784('0x6f')]],'%s',_0x5bf078):_0x5bf078;_0x5bf078=_0x271073[_0x5c40cd][_0xc784('0x71')]?_[_0xc784('0x70')](_0x1bcd4d[_0x271073[_0x5c40cd][_0xc784('0x71')]],'%s',_0x5bf078):_0x5bf078;if(_0x271073[_0x5c40cd]['groupBy']){_0x242b75[_0xc784('0x64')](_0x5bf078);}_0x271073[_0x5c40cd]['orderBy']&&_0x242b75[_0xc784('0x3a')](_0x5bf078,_0x271073[_0x5c40cd]['orderBy']===_0xc784('0x72')?![]:!![]);_0x242b75[_0xc784('0x65')](_0x5bf078,_0x271073[_0x5c40cd]['alias']||_0x5bf078);}if(_0x4b0e5b['joins']){_0x4b0e5b[_0xc784('0x73')]=JSON[_0xc784('0x74')](_0x4b0e5b[_0xc784('0x73')]);for(var _0x14c410=0x0;_0x14c410<_0x4b0e5b[_0xc784('0x73')][_0xc784('0x37')];_0x14c410+=0x1){if(_0x4b0e5b['joins'][_0x14c410]['type']&&_[_0xc784('0x75')](_0x281117,_0x4b0e5b[_0xc784('0x73')][_0x14c410][_0xc784('0x30')])&&_0x4b0e5b[_0xc784('0x73')][_0x14c410]['parentKey']&&_0x4b0e5b[_0xc784('0x73')][_0x14c410][_0xc784('0x76')]&&_0x4b0e5b[_0xc784('0x73')][_0x14c410]['foreignKey']){_0x242b75[_0x4b0e5b['joins'][_0x14c410][_0xc784('0x30')]](_0x4b0e5b[_0xc784('0x73')][_0x14c410][_0xc784('0x76')],null,util[_0xc784('0x71')]('%s.%s\x20=\x20%s.%s',_0x4b0e5b[_0xc784('0x6d')],_0x4b0e5b[_0xc784('0x73')][_0x14c410][_0xc784('0x77')],_0x4b0e5b[_0xc784('0x73')][_0x14c410][_0xc784('0x76')],_0x4b0e5b[_0xc784('0x73')][_0x14c410][_0xc784('0x78')]));}}}if(_0x4b0e5b[_0xc784('0x79')]){_0x4b0e5b[_0xc784('0x79')]=JSON['parse'](_0x4b0e5b[_0xc784('0x79')]);_0x242b75[_0xc784('0x3c')](_0x22ed1d(_0x4b0e5b['conditions']['group']));}_0x21471a=_0x242b75[_0xc784('0x7a')]();_0x242b75['limit'](_0x559d46);_0x242b75['offset'](0x0);logger[_0xc784('0x7b')](_0xc784('0x7c'),_0x242b75[_0xc784('0x7d')]());return dbH[_0xc784('0x7e')][_0xc784('0x32')](_0x242b75[_0xc784('0x7d')](),{'type':dbH[_0xc784('0x7e')][_0xc784('0x7f')][_0xc784('0x80')]});}})['then'](respondWithResult(_0x1f8042,null))[_0xc784('0x49')](handleError(_0x1f8042,null));};function runReport(_0x15c5b3,_0x5cb170,_0x5ddac8){var _0x357613=_0x5cb170['name'];var _0x4691b9=0xa;var _0x1694e7=[_0xc784('0x81'),_0xc784('0x82'),_0xc784('0x52'),'cross_join'];var _0x3b3ab7={'SUM':_0xc784('0x54'),'COUNT':_0xc784('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc784('0x56'),'MIN':_0xc784('0x57'),'AVG':_0xc784('0x83'),'GROUP_CONCAT':_0xc784('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc784('0x59')};var _0x451b28={'SEC_TO_TIME':_0xc784('0x5a'),'DATE':_0xc784('0x84'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2cedfe=function(_0xb7bde6){return!_[_0xc784('0x75')]([_0xc784('0x5e'),_0xc784('0x5f'),_0xc784('0x60'),_0xc784('0x61')],_0xb7bde6);};var _0xe34133=function(_0x4aa8b9){if(!_0x4aa8b9||!_0x4aa8b9[_0xc784('0x62')]['length']){return'';}for(var _0x4c7548='(',_0x584d90=0x0;_0x584d90<_0x4aa8b9[_0xc784('0x62')][_0xc784('0x37')];_0x584d90+=0x1){_0x584d90>0x0&&(_0x4c7548+='\x20'+_0x4aa8b9[_0xc784('0x63')]+'\x20');_0x4c7548+=_0x4aa8b9['rules'][_0x584d90][_0xc784('0x64')]?_0xe34133(_0x4aa8b9[_0xc784('0x62')][_0x584d90][_0xc784('0x64')]):_0x4aa8b9['rules'][_0x584d90][_0xc784('0x65')]+'\x20'+_0x4aa8b9['rules'][_0x584d90][_0xc784('0x66')]+(_0x2cedfe(_0x4aa8b9[_0xc784('0x62')][_0x584d90]['condition'])?'\x20'+_0x4aa8b9[_0xc784('0x62')][_0x584d90][_0xc784('0x67')]:'');}return _0x4c7548+')';};var _0x38b6ae={'where':{'id':_0x15c5b3['id']}},_0x48f06a,_0x20c756,_0x4821a8,_0x55956c,_0x37d183;_0x38b6ae=_[_0xc784('0x3f')]({},_0x38b6ae,_0x5ddac8);return db[_0xc784('0x2e')]['find'](_0x38b6ae)[_0xc784('0x23')](function(_0xd0bcc8){if(_0xd0bcc8){_0x48f06a=_0xd0bcc8;return _0xd0bcc8['getFields']();}return null;})[_0xc784('0x23')](function(_0x2f34fb){if(_0x2f34fb){if(!_0x2f34fb[_0xc784('0x37')]){throw new db[(_0xc784('0x68'))][(_0xc784('0x69'))](_0xc784('0x85'),0x193);}_0x20c756=_0x2f34fb;return db['AnalyticMetric'][_0xc784('0x43')]({'raw':!![]});}return null;})[_0xc784('0x23')](function(_0x3e964d){if(_0x3e964d){_0x4821a8=_['keyBy'](_0x3e964d,'id');var _0x4d5e57;var _0x5a6c35=squel['select']();_0x5a6c35[_0xc784('0x86')](_0x48f06a['table']);for(var _0xff6c6f=0x0;_0xff6c6f<_0x20c756[_0xc784('0x37')];_0xff6c6f+=0x1){_0x4d5e57=_0x20c756[_0xff6c6f][_0xc784('0x6e')]?_0x4821a8[_0x20c756[_0xff6c6f][_0xc784('0x6e')]][_0xc784('0x87')]:_0x20c756[_0xff6c6f]['field'];_0x4d5e57=_0x20c756[_0xff6c6f][_0xc784('0x6f')]?_[_0xc784('0x70')](_0x3b3ab7[_0x20c756[_0xff6c6f][_0xc784('0x6f')]],'%s',_0x4d5e57):_0x4d5e57;_0x4d5e57=_0x20c756[_0xff6c6f][_0xc784('0x71')]?_[_0xc784('0x70')](_0x451b28[_0x20c756[_0xff6c6f][_0xc784('0x71')]],'%s',_0x4d5e57):_0x4d5e57;if(_0x20c756[_0xff6c6f][_0xc784('0x88')]){_0x5a6c35[_0xc784('0x64')](_0x4d5e57);}_0x20c756[_0xff6c6f][_0xc784('0x89')]&&_0x5a6c35['order'](_0x4d5e57,_0x20c756[_0xff6c6f][_0xc784('0x89')]==='DESC'?![]:!![]);_0x5a6c35['field'](_0x4d5e57,_0x20c756[_0xff6c6f][_0xc784('0x8a')]||_0x4d5e57);}if(_0x48f06a[_0xc784('0x73')]){_0x48f06a[_0xc784('0x73')]=JSON[_0xc784('0x74')](_0x48f06a[_0xc784('0x73')]);for(var _0x5b384b=0x0;_0x5b384b<_0x48f06a['joins'][_0xc784('0x37')];_0x5b384b+=0x1){if(_0x48f06a[_0xc784('0x73')][_0x5b384b][_0xc784('0x30')]&&_[_0xc784('0x75')](_0x1694e7,_0x48f06a[_0xc784('0x73')][_0x5b384b][_0xc784('0x30')])&&_0x48f06a[_0xc784('0x73')][_0x5b384b][_0xc784('0x77')]&&_0x48f06a[_0xc784('0x73')][_0x5b384b]['foreignTable']&&_0x48f06a['joins'][_0x5b384b][_0xc784('0x78')]){_0x5a6c35[_0x48f06a[_0xc784('0x73')][_0x5b384b][_0xc784('0x30')]](_0x48f06a[_0xc784('0x73')][_0x5b384b]['foreignTable'],null,util[_0xc784('0x71')](_0xc784('0x8b'),_0x48f06a[_0xc784('0x6d')],_0x48f06a[_0xc784('0x73')][_0x5b384b][_0xc784('0x77')],_0x48f06a[_0xc784('0x73')][_0x5b384b][_0xc784('0x76')],_0x48f06a['joins'][_0x5b384b][_0xc784('0x78')]));}}}if(_0x48f06a[_0xc784('0x79')]){_0x48f06a['conditions']=JSON[_0xc784('0x74')](_0x48f06a[_0xc784('0x79')]);_0x5a6c35['where'](_0xe34133(_0x48f06a[_0xc784('0x79')][_0xc784('0x64')]));}_0x37d183=_0x5a6c35['clone']();_0x5a6c35[_0xc784('0x1e')](_0x4691b9);_0x5a6c35[_0xc784('0x1d')](0x0);return;}})[_0xc784('0x23')](function(){if(_0x5cb170[_0xc784('0x8c')]===_0xc784('0x8d')){return null;}var _0xafea32=_['merge'](_0x5cb170,{'name':_0x5cb170[_0xc784('0x8e')]||_0x5cb170['name']||_0x48f06a[_0xc784('0x2a')],'basename':_0x357613,'savename':util['format'](_0xc784('0x8f'),_0x5cb170['name']||_0x48f06a[_0xc784('0x2a')],require('randomstring')[_0xc784('0x90')](0x4),_0x5cb170[_0xc784('0x8c')]||_0xc784('0x91')),'reportId':_0x48f06a['id'],'reportType':'custom'});return db[_0xc784('0x92')][_0xc784('0x4a')](_0xafea32,{'raw':!![]});})[_0xc784('0x23')](function(_0x514161){if(_0x48f06a[_0xc784('0x6d')]===_0xc784('0x93')){_0x37d183['where'](_0x48f06a[_0xc784('0x6d')]+_0xc784('0x94'),_0x5cb170['startDate'],_0x5cb170['endDate']);}else{_0x37d183['where'](_0x48f06a[_0xc784('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5cb170[_0xc784('0x95')],_0x5cb170[_0xc784('0x96')]);}if(_0x514161){logger['info'](_0xc784('0x97'),_0x37d183['toString']());require(_0xc784('0x98'))[_0xc784('0x99')](path[_0xc784('0x81')](__dirname,_0xc784('0x9a'),_0x514161['output']),[_0x514161['id'],_0x37d183['toString'](),path[_0xc784('0x81')](__dirname,_0xc784('0x9b'),_0x514161[_0xc784('0x9c')]),_0x357613]);return _0x514161;}else{var _0x2d1c34=squel['select']();_0x2d1c34[_0xc784('0x86')]('('+_0x37d183[_0xc784('0x7d')]()+')','countTable');_0x2d1c34['field'](_0xc784('0x9d'),_0xc784('0x42'));_0x37d183[_0xc784('0x1e')](_0x5cb170['limit']||_0x4691b9);_0x37d183['offset'](_0x5cb170['offset']||0x0);return dbH['sequelize'][_0xc784('0x32')](_0x2d1c34[_0xc784('0x7d')](),{'type':dbH['sequelize'][_0xc784('0x7f')][_0xc784('0x80')]})['then'](function(_0x2dffd0){if(!_0x2dffd0[_0xc784('0x37')]){_0x55956c=0x0;}else{_0x55956c=_0x2dffd0[0x0][_0xc784('0x42')]||0x0;}return dbH['sequelize'][_0xc784('0x32')](_0x37d183['toString'](),{'type':dbH[_0xc784('0x7e')][_0xc784('0x7f')][_0xc784('0x80')]});})['then'](function(_0x272264){return{'rows':_0x272264||[],'count':_0x55956c};});}});}exports['run']=function(_0x15975a,_0xa3bd80){return runReport(_0x15975a[_0xc784('0x45')],_0x15975a[_0xc784('0x32')],_0x15975a[_0xc784('0x41')])[_0xc784('0x23')](respondWithResult(_0xa3bd80,null))[_0xc784('0x49')](handleError(_0xa3bd80,null));};exports['runReport']=runReport;exports[_0xc784('0x32')]=function(_0x2b5e3f,_0x4ce2c5){var _0x579bbd=0xa;var _0x156890=[_0xc784('0x81'),_0xc784('0x82'),_0xc784('0x52'),_0xc784('0x53')];var _0x2bb110={'SUM':_0xc784('0x54'),'COUNT':_0xc784('0x55'),'COUNT DISTINCT':_0xc784('0x9e'),'MAX':_0xc784('0x56'),'MIN':_0xc784('0x57'),'AVG':_0xc784('0x83'),'GROUP_CONCAT':_0xc784('0x58'),'GROUP_CONCAT ASC':_0xc784('0x9f'),'GROUP_CONCAT DESC':_0xc784('0x59')};var _0x5232af={'SEC_TO_TIME':_0xc784('0x5a'),'DATE':_0xc784('0x84'),'HOUR':_0xc784('0x5b'),'ROUND':_0xc784('0x5c'),'UNIX_TIMESTAMP':_0xc784('0x5d')};var _0x5257d2=function(_0x21e2f2){return!_['includes'](['IS\x20NULL',_0xc784('0x5f'),_0xc784('0x60'),'IS\x20NOT\x20EMPTY'],_0x21e2f2);};var _0x3a2cff=function(_0x3987cc){if(!_0x3987cc||!_0x3987cc[_0xc784('0x62')]['length']){return'';}for(var _0x167c0e='(',_0x592655=0x0;_0x592655<_0x3987cc['rules'][_0xc784('0x37')];_0x592655+=0x1){_0x592655>0x0&&(_0x167c0e+='\x20'+_0x3987cc[_0xc784('0x63')]+'\x20');_0x167c0e+=_0x3987cc[_0xc784('0x62')][_0x592655][_0xc784('0x64')]?_0x3a2cff(_0x3987cc['rules'][_0x592655][_0xc784('0x64')]):_0x3987cc[_0xc784('0x62')][_0x592655]['field']+'\x20'+_0x3987cc['rules'][_0x592655][_0xc784('0x66')]+(_0x5257d2(_0x3987cc['rules'][_0x592655][_0xc784('0x66')])?'\x20'+_0x3987cc[_0xc784('0x62')][_0x592655][_0xc784('0x67')]:'');}return _0x167c0e+')';};var _0x554156={'where':{'id':_0x2b5e3f[_0xc784('0x45')]['id']}},_0x497656,_0x117d3f,_0x13b726,_0x5aefab,_0x5d0ca8;_0x554156=_[_0xc784('0x3f')]({},_0x554156,_0x2b5e3f['options']);return db['AnalyticCustomReport'][_0xc784('0x48')](_0x554156)[_0xc784('0x23')](function(_0x50f4d3){if(_0x50f4d3){_0x497656=_0x50f4d3;return _0x50f4d3['getFields']();}return null;})[_0xc784('0x23')](function(_0x2aa1d3){if(_0x2aa1d3){if(!_0x2aa1d3[_0xc784('0x37')]){throw new db[(_0xc784('0x68'))][(_0xc784('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x117d3f=_0x2aa1d3;return db['AnalyticMetric'][_0xc784('0x43')]({'raw':!![]});}return null;})[_0xc784('0x23')](function(_0x4c41bb){if(_0x4c41bb){_0x13b726=_[_0xc784('0x6b')](_0x4c41bb,'id');var _0x259698;var _0x4781b4=squel[_0xc784('0x6c')]();_0x4781b4[_0xc784('0x86')](_0x497656[_0xc784('0x6d')]);for(var _0x164d9f=0x0;_0x164d9f<_0x117d3f[_0xc784('0x37')];_0x164d9f+=0x1){_0x259698=_0x117d3f[_0x164d9f][_0xc784('0x6e')]?_0x13b726[_0x117d3f[_0x164d9f][_0xc784('0x6e')]][_0xc784('0x87')]:_0x117d3f[_0x164d9f][_0xc784('0x65')];_0x259698=_0x117d3f[_0x164d9f][_0xc784('0x6f')]?_[_0xc784('0x70')](_0x2bb110[_0x117d3f[_0x164d9f]['function']],'%s',_0x259698):_0x259698;_0x259698=_0x117d3f[_0x164d9f][_0xc784('0x71')]?_[_0xc784('0x70')](_0x5232af[_0x117d3f[_0x164d9f][_0xc784('0x71')]],'%s',_0x259698):_0x259698;if(_0x117d3f[_0x164d9f][_0xc784('0x88')]){_0x4781b4[_0xc784('0x64')](_0x259698);}_0x117d3f[_0x164d9f]['orderBy']&&_0x4781b4[_0xc784('0x3a')](_0x259698,_0x117d3f[_0x164d9f][_0xc784('0x89')]==='DESC'?![]:!![]);_0x4781b4[_0xc784('0x65')](_0x259698,_0x117d3f[_0x164d9f][_0xc784('0x8a')]||_0x259698);}if(_0x497656[_0xc784('0x73')]){_0x497656[_0xc784('0x73')]=JSON[_0xc784('0x74')](_0x497656[_0xc784('0x73')]);for(var _0x60a388=0x0;_0x60a388<_0x497656['joins']['length'];_0x60a388+=0x1){if(_0x497656['joins'][_0x60a388]['type']&&_[_0xc784('0x75')](_0x156890,_0x497656[_0xc784('0x73')][_0x60a388][_0xc784('0x30')])&&_0x497656['joins'][_0x60a388][_0xc784('0x77')]&&_0x497656['joins'][_0x60a388]['foreignTable']&&_0x497656['joins'][_0x60a388][_0xc784('0x78')]){_0x4781b4[_0x497656[_0xc784('0x73')][_0x60a388][_0xc784('0x30')]](_0x497656[_0xc784('0x73')][_0x60a388][_0xc784('0x76')],null,util['format'](_0xc784('0x8b'),_0x497656[_0xc784('0x6d')],_0x497656['joins'][_0x60a388][_0xc784('0x77')],_0x497656['joins'][_0x60a388]['foreignTable'],_0x497656[_0xc784('0x73')][_0x60a388][_0xc784('0x78')]));}}}if(_0x497656[_0xc784('0x79')]){_0x497656[_0xc784('0x79')]=JSON[_0xc784('0x74')](_0x497656['conditions']);_0x4781b4[_0xc784('0x3c')](_0x3a2cff(_0x497656[_0xc784('0x79')][_0xc784('0x64')]));}_0x5d0ca8=_0x4781b4[_0xc784('0x7a')]();_0x4781b4['limit'](_0x579bbd);_0x4781b4['offset'](0x0);logger[_0xc784('0x7b')](_0xc784('0x7c'),_0x4781b4[_0xc784('0x7d')]());return dbH[_0xc784('0x7e')]['query'](_0x4781b4[_0xc784('0x7d')](),{'type':dbH[_0xc784('0x7e')][_0xc784('0x7f')][_0xc784('0x80')]});}})[_0xc784('0x23')](function(){return{'sql':_0x5d0ca8[_0xc784('0x7d')]()};})['then'](respondWithResult(_0x4ce2c5,null))[_0xc784('0x49')](handleError(_0x4ce2c5,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 175d973..67d39cc 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 _0x3a85=['AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2a75c0,_0x3882a1){var _0x4b9aa7=function(_0x15d772){while(--_0x15d772){_0x2a75c0['push'](_0x2a75c0['shift']());}};_0x4b9aa7(++_0x3882a1);}(_0x3a85,0x142));var _0x53a8=function(_0x489c72,_0x5a7fa1){_0x489c72=_0x489c72-0x0;var _0x2c63fe=_0x3a85[_0x489c72];return _0x2c63fe;};'use strict';var _=require(_0x53a8('0x0'));var util=require('util');var logger=require(_0x53a8('0x1'))(_0x53a8('0x2'));var moment=require(_0x53a8('0x3'));var BPromise=require(_0x53a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x53a8('0x5'));var rimraf=require(_0x53a8('0x6'));var config=require(_0x53a8('0x7'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x47aaaa,_0x482f9f){return _0x47aaaa['define'](_0x53a8('0x8'),attributes,{'tableName':_0x53a8('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaacd=['exports','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xaacd,0xb3));var _0xdaac=function(_0x4d400d,_0x30a6e6){_0x4d400d=_0x4d400d-0x0;var _0x327fc4=_0xaacd[_0x4d400d];return _0x327fc4;};'use strict';var _=require(_0xdaac('0x0'));var util=require('util');var logger=require(_0xdaac('0x1'))(_0xdaac('0x2'));var moment=require('moment');var BPromise=require(_0xdaac('0x3'));var rp=require(_0xdaac('0x4'));var fs=require('fs');var path=require(_0xdaac('0x5'));var rimraf=require(_0xdaac('0x6'));var config=require('../../config/environment');var attributes=require(_0xdaac('0x7'));module[_0xdaac('0x8')]=function(_0x5bc382,_0xc2bc00){return _0x5bc382['define'](_0xdaac('0x9'),attributes,{'tableName':_0xdaac('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 9f2381b..63f59e7 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 _0x569f=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x48671c,_0x2b44a3){var _0x32d5e5=function(_0x3a21ac){while(--_0x3a21ac){_0x48671c['push'](_0x48671c['shift']());}};_0x32d5e5(++_0x2b44a3);}(_0x569f,0xf2));var _0xf569=function(_0x585723,_0x25250e){_0x585723=_0x585723-0x0;var _0x54edcf=_0x569f[_0x585723];return _0x54edcf;};'use strict';var _=require(_0xf569('0x0'));var util=require(_0xf569('0x1'));var moment=require(_0xf569('0x2'));var BPromise=require(_0xf569('0x3'));var rs=require(_0xf569('0x4'));var fs=require('fs');var Redis=require(_0xf569('0x5'));var db=require(_0xf569('0x6'))['db'];var utils=require(_0xf569('0x7'));var logger=require(_0xf569('0x8'))(_0xf569('0x9'));var config=require(_0xf569('0xa'));var jayson=require(_0xf569('0xb'));var client=jayson[_0xf569('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x376478,_0x46d2aa,_0x53adad){return new BPromise(function(_0x4b8441,_0x57fbf1){return client['request'](_0x376478,_0x53adad)[_0xf569('0xd')](function(_0x5ddcb3){logger[_0xf569('0xe')](_0xf569('0xf'),_0x46d2aa,'request\x20sent');logger['debug'](_0xf569('0x10'),_0x46d2aa,_0xf569('0x11'),JSON[_0xf569('0x12')](_0x5ddcb3));if(_0x5ddcb3[_0xf569('0x13')]){if(_0x5ddcb3['error'][_0xf569('0x14')]===0x1f4){logger[_0xf569('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x46d2aa,_0x5ddcb3[_0xf569('0x13')]['message']);return _0x57fbf1(_0x5ddcb3[_0xf569('0x13')][_0xf569('0x15')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x46d2aa,_0x5ddcb3['error'][_0xf569('0x15')]);return _0x4b8441(_0x5ddcb3[_0xf569('0x13')][_0xf569('0x15')]);}else{logger['info'](_0xf569('0xf'),_0x46d2aa,_0xf569('0x11'));_0x4b8441(_0x5ddcb3[_0xf569('0x16')]['message']);}})[_0xf569('0x17')](function(_0x16eb72){logger[_0xf569('0x13')](_0xf569('0xf'),_0x46d2aa,_0x16eb72);_0x57fbf1(_0x16eb72);});});} \ No newline at end of file +var _0x3204=['rpc','jayson/promise','client','http','then','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x279a08,_0x251bfc){var _0x5912b4=function(_0xb05807){while(--_0xb05807){_0x279a08['push'](_0x279a08['shift']());}};_0x5912b4(++_0x251bfc);}(_0x3204,0x111));var _0x4320=function(_0x437894,_0x29d1be){_0x437894=_0x437894-0x0;var _0x25322b=_0x3204[_0x437894];return _0x25322b;};'use strict';var _=require(_0x4320('0x0'));var util=require(_0x4320('0x1'));var moment=require(_0x4320('0x2'));var BPromise=require(_0x4320('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4320('0x4'));var db=require(_0x4320('0x5'))['db'];var utils=require(_0x4320('0x6'));var logger=require('../../config/logger')(_0x4320('0x7'));var config=require('../../config/environment');var jayson=require(_0x4320('0x8'));var client=jayson[_0x4320('0x9')][_0x4320('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ce54a,_0x34717a,_0x4060dc){return new BPromise(function(_0xa58b2a,_0x986bb1){return client['request'](_0x1ce54a,_0x4060dc)[_0x4320('0xb')](function(_0x17f78a){logger[_0x4320('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x34717a,_0x4320('0xd'));logger['debug'](_0x4320('0xe'),_0x34717a,'request\x20sent',JSON['stringify'](_0x17f78a));if(_0x17f78a[_0x4320('0xf')]){if(_0x17f78a[_0x4320('0xf')][_0x4320('0x10')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x34717a,_0x17f78a['error'][_0x4320('0x11')]);return _0x986bb1(_0x17f78a[_0x4320('0xf')]['message']);}logger[_0x4320('0xf')](_0x4320('0x12'),_0x34717a,_0x17f78a[_0x4320('0xf')]['message']);return _0xa58b2a(_0x17f78a[_0x4320('0xf')][_0x4320('0x11')]);}else{logger[_0x4320('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x34717a,_0x4320('0xd'));_0xa58b2a(_0x17f78a[_0x4320('0x13')][_0x4320('0x11')]);}})['catch'](function(_0x50569b){logger[_0x4320('0xf')](_0x4320('0x12'),_0x34717a,_0x50569b);_0x986bb1(_0x50569b);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 09b0d1b..0fe083b 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 _0x98e5=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','run','query','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x98e5,0x78));var _0x598e=function(_0x470214,_0x23900d){_0x470214=_0x470214-0x0;var _0x557b88=_0x98e5[_0x470214];return _0x557b88;};'use strict';var multer=require('multer');var util=require(_0x598e('0x0'));var path=require('path');var timeout=require(_0x598e('0x1'));var express=require(_0x598e('0x2'));var router=express[_0x598e('0x3')]();var auth=require(_0x598e('0x4'));var interaction=require(_0x598e('0x5'));var config=require(_0x598e('0x6'));var controller=require(_0x598e('0x7'));router[_0x598e('0x8')]('/',auth[_0x598e('0x9')](),controller[_0x598e('0xa')]);router[_0x598e('0x8')]('/:id',auth[_0x598e('0x9')](),controller[_0x598e('0xb')]);router[_0x598e('0x8')](_0x598e('0xc'),auth[_0x598e('0x9')](),controller['preview']);router['get']('/:id/run',auth[_0x598e('0x9')](),controller[_0x598e('0xd')]);router[_0x598e('0x8')]('/:id/query',auth[_0x598e('0x9')](),controller[_0x598e('0xe')]);router[_0x598e('0xf')]('/',auth[_0x598e('0x9')](),controller[_0x598e('0x10')]);router[_0x598e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x598e('0x12')]);router[_0x598e('0x13')]('/:id',auth[_0x598e('0x9')](),controller[_0x598e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbff3=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0xbff3,0x111));var _0x3bff=function(_0x383bcc,_0x5e1352){_0x383bcc=_0x383bcc-0x0;var _0x3d3a23=_0xbff3[_0x383bcc];return _0x3d3a23;};'use strict';var multer=require(_0x3bff('0x0'));var util=require('util');var path=require(_0x3bff('0x1'));var timeout=require(_0x3bff('0x2'));var express=require(_0x3bff('0x3'));var router=express['Router']();var auth=require(_0x3bff('0x4'));var interaction=require(_0x3bff('0x5'));var config=require(_0x3bff('0x6'));var controller=require(_0x3bff('0x7'));router[_0x3bff('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3bff('0x9'),auth[_0x3bff('0xa')](),controller[_0x3bff('0xb')]);router[_0x3bff('0x8')](_0x3bff('0xc'),auth[_0x3bff('0xa')](),controller['preview']);router[_0x3bff('0x8')](_0x3bff('0xd'),auth[_0x3bff('0xa')](),controller[_0x3bff('0xe')]);router[_0x3bff('0x8')](_0x3bff('0xf'),auth[_0x3bff('0xa')](),controller[_0x3bff('0x10')]);router[_0x3bff('0x11')]('/',auth[_0x3bff('0xa')](),controller[_0x3bff('0x12')]);router[_0x3bff('0x13')](_0x3bff('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x3bff('0x14')](_0x3bff('0x9'),auth[_0x3bff('0xa')](),controller[_0x3bff('0x15')]);module[_0x3bff('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 38ed95a..57adb13 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 _0x97dd=['sequelize','STRING','TEXT'];(function(_0x243afc,_0x2c13b6){var _0x273909=function(_0x3fbf0d){while(--_0x3fbf0d){_0x243afc['push'](_0x243afc['shift']());}};_0x273909(++_0x2c13b6);}(_0x97dd,0x13b));var _0xd97d=function(_0x2f21dd,_0x2ca178){_0x2f21dd=_0x2f21dd-0x0;var _0x5f32fc=_0x97dd[_0x2f21dd];return _0x5f32fc;};'use strict';var Sequelize=require(_0xd97d('0x0'));module['exports']={'name':{'type':Sequelize[_0xd97d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd97d('0x1')]},'parent':{'type':Sequelize[_0xd97d('0x1')]},'table':{'type':Sequelize[_0xd97d('0x1')]},'conditions':{'type':Sequelize[_0xd97d('0x2')]},'joins':{'type':Sequelize[_0xd97d('0x2')]}}; \ No newline at end of file +var _0x7b8e=['TEXT','sequelize','exports','STRING'];(function(_0x23a9a0,_0x5be833){var _0x57d10b=function(_0x56c095){while(--_0x56c095){_0x23a9a0['push'](_0x23a9a0['shift']());}};_0x57d10b(++_0x5be833);}(_0x7b8e,0xe1));var _0xe7b8=function(_0x3f684e,_0x4217c3){_0x3f684e=_0x3f684e-0x0;var _0xa8ae4a=_0x7b8e[_0x3f684e];return _0xa8ae4a;};'use strict';var Sequelize=require(_0xe7b8('0x0'));module[_0xe7b8('0x1')]={'name':{'type':Sequelize[_0xe7b8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe7b8('0x2')]},'parent':{'type':Sequelize[_0xe7b8('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xe7b8('0x3')]},'joins':{'type':Sequelize[_0xe7b8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 43c4570..0e6a1cf 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 _0x9912=['type','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','MetricId','metric','function','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','IS\x20NOT\x20NULL','operator','keyBy','select','output','web','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','sequelize','run','runReport','left_join','right_join','AVG(%s)','SELECT','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge'];(function(_0x5d4ebf,_0x48cb83){var _0x12c003=function(_0x581592){while(--_0x581592){_0x5d4ebf['push'](_0x5d4ebf['shift']());}};_0x12c003(++_0x48cb83);}(_0x9912,0x1a6));var _0x2991=function(_0x415c9a,_0x41ed1f){_0x415c9a=_0x415c9a-0x0;var _0x3fcac8=_0x9912[_0x415c9a];return _0x3fcac8;};'use strict';var pdf=require(_0x2991('0x0'));var emlformat=require(_0x2991('0x1'));var rimraf=require(_0x2991('0x2'));var zipdir=require(_0x2991('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2991('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2991('0x5'));var util=require(_0x2991('0x6'));var path=require(_0x2991('0x7'));var sox=require('sox');var csv=require(_0x2991('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2991('0x9'));var squel=require(_0x2991('0xa'));var crypto=require(_0x2991('0xb'));var jsforce=require(_0x2991('0xc'));var deskjs=require(_0x2991('0xd'));var toCsv=require(_0x2991('0x8'));var querystring=require(_0x2991('0xe'));var Papa=require(_0x2991('0xf'));var Redis=require(_0x2991('0x10'));var authService=require(_0x2991('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2991('0x12'));var hardwareService=require(_0x2991('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2991('0x14'));var config=require(_0x2991('0x15'));var licenseUtil=require(_0x2991('0x16'));var db=require(_0x2991('0x17'))['db'];var dbH=require(_0x2991('0x17'))[_0x2991('0x18')];function respondWithStatusCode(_0x127213,_0x2f1e4c){_0x2f1e4c=_0x2f1e4c||0xcc;return function(_0x92435e){if(_0x92435e){return _0x127213[_0x2991('0x19')](_0x2f1e4c);}return _0x127213[_0x2991('0x1a')](_0x2f1e4c)[_0x2991('0x1b')]();};}function respondWithResult(_0x287307,_0x2e9ff){_0x2e9ff=_0x2e9ff||0xc8;return function(_0x1598e8){if(_0x1598e8){return _0x287307[_0x2991('0x1a')](_0x2e9ff)['json'](_0x1598e8);}};}function respondWithFilteredResult(_0x38edd5,_0x2200b4){return function(_0xce9f51){if(_0xce9f51){var _0x210c70=_0xce9f51[_0x2991('0x1c')],_0x5c6300=_0x2200b4[_0x2991('0x1d')],_0x1c53d4=_0x2200b4[_0x2991('0x1d')]+_0x2200b4['limit'],_0x598dd5;if(_0x1c53d4>=_0x210c70){_0x1c53d4=_0x210c70;_0x598dd5=0xc8;}else{_0x598dd5=0xce;}_0x38edd5[_0x2991('0x1a')](_0x598dd5);return _0x38edd5['set'](_0x2991('0x1e'),_0x5c6300+'-'+_0x1c53d4+'/'+_0x210c70)[_0x2991('0x1f')](_0xce9f51);}return null;};}function patchUpdates(_0x169837){return function(_0x2232f2){try{jsonpatch[_0x2991('0x20')](_0x2232f2,_0x169837,!![]);}catch(_0x309b2b){return BPromise[_0x2991('0x21')](_0x309b2b);}return _0x2232f2[_0x2991('0x22')]();};}function saveUpdates(_0x14ae65,_0x527a21){return function(_0x1ad23b){if(_0x1ad23b){return _0x1ad23b[_0x2991('0x23')](_0x14ae65)[_0x2991('0x24')](function(_0x73614){return _0x73614;});}return null;};}function removeEntity(_0x3e0f51,_0x11571e){return function(_0x30ba28){if(_0x30ba28){return _0x30ba28[_0x2991('0x25')]()[_0x2991('0x24')](function(){var _0xb707af=_0x30ba28[_0x2991('0x26')]({'plain':!![]});var _0x13612d=_0x2991('0x27');return db[_0x2991('0x28')][_0x2991('0x25')]({'where':{'type':_0x13612d,'resourceId':_0xb707af['id']}})[_0x2991('0x24')](function(){return _0x30ba28;});})[_0x2991('0x24')](function(){_0x3e0f51[_0x2991('0x1a')](0xcc)[_0x2991('0x1b')]();});}};}function handleEntityNotFound(_0x422668,_0x48ca54){return function(_0x4ecb2b){if(!_0x4ecb2b){_0x422668[_0x2991('0x19')](0x194);}return _0x4ecb2b;};}function handleError(_0x1e5cc2,_0x3094af){_0x3094af=_0x3094af||0x1f4;return function(_0x19b228){logger[_0x2991('0x29')](_0x19b228['stack']);if(_0x19b228[_0x2991('0x2a')]){delete _0x19b228[_0x2991('0x2a')];}_0x1e5cc2['status'](_0x3094af)[_0x2991('0x2b')](_0x19b228);};}exports[_0x2991('0x2c')]=function(_0x5d20d7,_0x353be7){var _0x490ba5={},_0x49c0d7={},_0x3a4cd4={'count':0x0,'rows':[]};var _0x37f0a3=_[_0x2991('0x2d')](db[_0x2991('0x2e')][_0x2991('0x2f')],function(_0x4e6bf8){return{'name':_0x4e6bf8['fieldName'],'type':_0x4e6bf8['type']['key']};});_0x49c0d7[_0x2991('0x30')]=_[_0x2991('0x2d')](_0x37f0a3,_0x2991('0x2a'));_0x49c0d7[_0x2991('0x31')]=_[_0x2991('0x32')](_0x5d20d7[_0x2991('0x31')]);_0x49c0d7['filters']=_['intersection'](_0x49c0d7[_0x2991('0x30')],_0x49c0d7['query']);_0x490ba5[_0x2991('0x33')]=_[_0x2991('0x34')](_0x49c0d7[_0x2991('0x30')],qs[_0x2991('0x35')](_0x5d20d7[_0x2991('0x31')][_0x2991('0x35')]));_0x490ba5[_0x2991('0x33')]=_0x490ba5[_0x2991('0x33')][_0x2991('0x36')]?_0x490ba5['attributes']:_0x49c0d7[_0x2991('0x30')];if(!_0x5d20d7[_0x2991('0x31')][_0x2991('0x37')](_0x2991('0x38'))){_0x490ba5[_0x2991('0x39')]=qs['limit'](_0x5d20d7[_0x2991('0x31')][_0x2991('0x39')]);_0x490ba5[_0x2991('0x1d')]=qs[_0x2991('0x1d')](_0x5d20d7[_0x2991('0x31')][_0x2991('0x1d')]);}_0x490ba5['order']=qs[_0x2991('0x3a')](_0x5d20d7['query'][_0x2991('0x3a')]);_0x490ba5[_0x2991('0x3b')]=qs[_0x2991('0x3c')](_[_0x2991('0x3d')](_0x5d20d7[_0x2991('0x31')],_0x49c0d7[_0x2991('0x3c')]),_0x37f0a3);if(_0x5d20d7[_0x2991('0x31')][_0x2991('0x3e')]){_0x490ba5[_0x2991('0x3b')]=_[_0x2991('0x3f')](_0x490ba5[_0x2991('0x3b')],{'$or':_['map'](_0x37f0a3,function(_0xde18ed){if(_0xde18ed[_0x2991('0x40')]!==_0x2991('0x41')){var _0x3793eb={};_0x3793eb[_0xde18ed[_0x2991('0x2a')]]={'$like':'%'+_0x5d20d7[_0x2991('0x31')]['filter']+'%'};return _0x3793eb;}})});}_0x490ba5=_['merge']({},_0x490ba5,_0x5d20d7[_0x2991('0x42')]);var _0x1069ee={'where':_0x490ba5[_0x2991('0x3b')]};return db['AnalyticDefaultReport'][_0x2991('0x1c')](_0x1069ee)[_0x2991('0x24')](function(_0x1dc0cb){_0x3a4cd4[_0x2991('0x1c')]=_0x1dc0cb;if(_0x5d20d7[_0x2991('0x31')]['includeAll']){_0x490ba5[_0x2991('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x2991('0x44')](_0x490ba5);})[_0x2991('0x24')](function(_0x51800a){_0x3a4cd4[_0x2991('0x45')]=_0x51800a;return _0x3a4cd4;})[_0x2991('0x24')](respondWithFilteredResult(_0x353be7,_0x490ba5))['catch'](handleError(_0x353be7,null));};exports['show']=function(_0x477b76,_0x331b1c){var _0x12365f={'raw':!![],'where':{'id':_0x477b76[_0x2991('0x46')]['id']}},_0x56d271={};_0x56d271[_0x2991('0x30')]=_[_0x2991('0x32')](db[_0x2991('0x2e')][_0x2991('0x2f')]);_0x56d271[_0x2991('0x31')]=_[_0x2991('0x32')](_0x477b76['query']);_0x56d271[_0x2991('0x3c')]=_[_0x2991('0x34')](_0x56d271[_0x2991('0x30')],_0x56d271[_0x2991('0x31')]);_0x12365f[_0x2991('0x33')]=_[_0x2991('0x34')](_0x56d271[_0x2991('0x30')],qs['fields'](_0x477b76[_0x2991('0x31')][_0x2991('0x35')]));_0x12365f['attributes']=_0x12365f[_0x2991('0x33')][_0x2991('0x36')]?_0x12365f[_0x2991('0x33')]:_0x56d271[_0x2991('0x30')];if(_0x477b76[_0x2991('0x31')][_0x2991('0x47')]){_0x12365f[_0x2991('0x43')]=[{'all':!![]}];}_0x12365f=_['merge']({},_0x12365f,_0x477b76['options']);return db[_0x2991('0x2e')][_0x2991('0x48')](_0x12365f)['then'](handleEntityNotFound(_0x331b1c,null))[_0x2991('0x24')](respondWithResult(_0x331b1c,null))[_0x2991('0x49')](handleError(_0x331b1c,null));};exports['create']=function(_0x9eb763,_0x52ed05){return db[_0x2991('0x2e')][_0x2991('0x4a')](_0x9eb763[_0x2991('0x4b')],{})[_0x2991('0x24')](function(_0x3afc2d){var _0x19048e=_0x9eb763[_0x2991('0x4c')][_0x2991('0x26')]({'plain':!![]});if(!_0x19048e)throw new Error(_0x2991('0x4d'));if(_0x19048e[_0x2991('0x4e')]==='user'){var _0x95f70a=_0x3afc2d['get']({'plain':!![]});var _0x39302a='Reports';return db['UserProfileSection'][_0x2991('0x48')]({'where':{'name':_0x39302a,'userProfileId':_0x19048e[_0x2991('0x4f')]},'raw':!![]})[_0x2991('0x24')](function(_0x24ac12){if(_0x24ac12&&_0x24ac12[_0x2991('0x50')]===0x0){return db[_0x2991('0x28')][_0x2991('0x4a')]({'name':_0x95f70a['name'],'resourceId':_0x95f70a['id'],'type':_0x2991('0x27'),'sectionId':_0x24ac12['id']},{})['then'](function(){return _0x3afc2d;});}else{return _0x3afc2d;}})[_0x2991('0x49')](function(_0x570fd4){logger[_0x2991('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x570fd4);throw _0x570fd4;});}return _0x3afc2d;})[_0x2991('0x24')](respondWithResult(_0x52ed05,0xc9))[_0x2991('0x49')](handleError(_0x52ed05,null));};exports[_0x2991('0x23')]=function(_0x5682eb,_0x420a78){if(_0x5682eb['body']['id']){delete _0x5682eb[_0x2991('0x4b')]['id'];}return db[_0x2991('0x2e')][_0x2991('0x48')]({'where':{'id':_0x5682eb[_0x2991('0x46')]['id']}})['then'](handleEntityNotFound(_0x420a78,null))['then'](saveUpdates(_0x5682eb[_0x2991('0x4b')],null))[_0x2991('0x24')](respondWithResult(_0x420a78,null))[_0x2991('0x49')](handleError(_0x420a78,null));};exports[_0x2991('0x25')]=function(_0x5682c5,_0x3a3e1d){return db[_0x2991('0x2e')][_0x2991('0x48')]({'where':{'id':_0x5682c5[_0x2991('0x46')]['id']}})[_0x2991('0x24')](handleEntityNotFound(_0x3a3e1d,null))[_0x2991('0x24')](removeEntity(_0x3a3e1d,null))[_0x2991('0x49')](handleError(_0x3a3e1d,null));};exports[_0x2991('0x51')]=function(_0x2310ad,_0x1614df){var _0xbac62b=0xa;var _0x26276d=[_0x2991('0x52'),'left_join','right_join',_0x2991('0x53')];var _0x32908b={'SUM':_0x2991('0x54'),'COUNT':_0x2991('0x55'),'COUNT DISTINCT':_0x2991('0x56'),'MAX':_0x2991('0x57'),'MIN':_0x2991('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2991('0x59')};var _0x1760d1={'SEC_TO_TIME':_0x2991('0x5a'),'DATE':'DATE(%s)','HOUR':_0x2991('0x5b'),'ROUND':_0x2991('0x5c'),'UNIX_TIMESTAMP':_0x2991('0x5d')};var _0x4ff805=function(_0x512213){return!_[_0x2991('0x5e')]([_0x2991('0x5f'),'IS\x20NOT\x20NULL',_0x2991('0x60'),'IS\x20NOT\x20EMPTY'],_0x512213);};var _0x15bd16=function(_0x30ec0e){if(!_0x30ec0e||!_0x30ec0e[_0x2991('0x61')][_0x2991('0x36')]){return'';}for(var _0x45e07e='(',_0x52e62c=0x0;_0x52e62c<_0x30ec0e[_0x2991('0x61')][_0x2991('0x36')];_0x52e62c+=0x1){_0x52e62c>0x0&&(_0x45e07e+='\x20'+_0x30ec0e['operator']+'\x20');_0x45e07e+=_0x30ec0e[_0x2991('0x61')][_0x52e62c][_0x2991('0x62')]?_0x15bd16(_0x30ec0e[_0x2991('0x61')][_0x52e62c][_0x2991('0x62')]):_0x30ec0e[_0x2991('0x61')][_0x52e62c][_0x2991('0x63')]+'\x20'+_0x30ec0e[_0x2991('0x61')][_0x52e62c][_0x2991('0x64')]+(_0x4ff805(_0x30ec0e[_0x2991('0x61')][_0x52e62c][_0x2991('0x64')])?'\x20'+_0x30ec0e[_0x2991('0x61')][_0x52e62c][_0x2991('0x65')]:'');}return _0x45e07e+')';};var _0x4634da={'where':{'id':_0x2310ad[_0x2991('0x46')]['id']}},_0x1c32f2,_0x238d9a,_0x44bd42,_0x584a1f,_0x2ceda6;_0x4634da=_['merge']({},_0x4634da,_0x2310ad['options']);return db[_0x2991('0x2e')][_0x2991('0x48')](_0x4634da)[_0x2991('0x24')](function(_0x5eafd9){if(_0x5eafd9){_0x1c32f2=_0x5eafd9;return _0x5eafd9[_0x2991('0x66')]();}return null;})[_0x2991('0x24')](function(_0x5515ce){if(_0x5515ce){if(!_0x5515ce[_0x2991('0x36')]){throw new db[(_0x2991('0x67'))][(_0x2991('0x68'))](_0x2991('0x69'),0x193);}_0x238d9a=_0x5515ce;return db[_0x2991('0x6a')][_0x2991('0x44')]({'raw':!![]});}return null;})['then'](function(_0x4790ca){if(_0x4790ca){_0x44bd42=_['keyBy'](_0x4790ca,'id');var _0x4ec36c;var _0x4d7220=squel['select']();_0x4d7220[_0x2991('0x6b')](_0x1c32f2['table']);for(var _0x2eb0cf=0x0;_0x2eb0cf<_0x238d9a[_0x2991('0x36')];_0x2eb0cf+=0x1){_0x4ec36c=_0x238d9a[_0x2eb0cf][_0x2991('0x6c')]?_0x44bd42[_0x238d9a[_0x2eb0cf][_0x2991('0x6c')]][_0x2991('0x6d')]:_0x238d9a[_0x2eb0cf][_0x2991('0x63')];_0x4ec36c=_0x238d9a[_0x2eb0cf][_0x2991('0x6e')]?_[_0x2991('0x6f')](_0x32908b[_0x238d9a[_0x2eb0cf][_0x2991('0x6e')]],'%s',_0x4ec36c):_0x4ec36c;_0x4ec36c=_0x238d9a[_0x2eb0cf]['format']?_['replace'](_0x1760d1[_0x238d9a[_0x2eb0cf]['format']],'%s',_0x4ec36c):_0x4ec36c;if(_0x238d9a[_0x2eb0cf][_0x2991('0x70')]){_0x4d7220[_0x2991('0x62')](_0x4ec36c);}_0x238d9a[_0x2eb0cf][_0x2991('0x71')]&&_0x4d7220[_0x2991('0x72')](_0x4ec36c,_0x238d9a[_0x2eb0cf][_0x2991('0x71')]===_0x2991('0x73')?![]:!![]);_0x4d7220[_0x2991('0x63')](_0x4ec36c,_0x238d9a[_0x2eb0cf][_0x2991('0x74')]||_0x4ec36c);}if(_0x1c32f2['joins']){_0x1c32f2[_0x2991('0x75')]=JSON[_0x2991('0x76')](_0x1c32f2[_0x2991('0x75')]);for(var _0x197a43=0x0;_0x197a43<_0x1c32f2['joins']['length'];_0x197a43+=0x1){if(_0x1c32f2[_0x2991('0x75')][_0x197a43][_0x2991('0x40')]&&_[_0x2991('0x5e')](_0x26276d,_0x1c32f2[_0x2991('0x75')][_0x197a43][_0x2991('0x40')])&&_0x1c32f2[_0x2991('0x75')][_0x197a43][_0x2991('0x77')]&&_0x1c32f2[_0x2991('0x75')][_0x197a43][_0x2991('0x78')]&&_0x1c32f2[_0x2991('0x75')][_0x197a43][_0x2991('0x79')]){_0x4d7220[_0x1c32f2[_0x2991('0x75')][_0x197a43]['type']](_0x1c32f2[_0x2991('0x75')][_0x197a43]['foreignTable'],null,util[_0x2991('0x7a')](_0x2991('0x7b'),_0x1c32f2[_0x2991('0x7c')],_0x1c32f2[_0x2991('0x75')][_0x197a43][_0x2991('0x77')],_0x1c32f2['joins'][_0x197a43][_0x2991('0x78')],_0x1c32f2[_0x2991('0x75')][_0x197a43][_0x2991('0x79')]));}}}if(_0x1c32f2['conditions']){_0x1c32f2['conditions']=JSON[_0x2991('0x76')](_0x1c32f2[_0x2991('0x7d')]);_0x4d7220[_0x2991('0x3b')](_0x15bd16(_0x1c32f2[_0x2991('0x7d')][_0x2991('0x62')]));}_0x2ceda6=_0x4d7220[_0x2991('0x7e')]();_0x4d7220[_0x2991('0x39')](_0xbac62b);_0x4d7220['offset'](0x0);logger[_0x2991('0x7f')](_0x2991('0x80'),_0x4d7220[_0x2991('0x81')]());return dbH['sequelize'][_0x2991('0x31')](_0x4d7220[_0x2991('0x81')](),{'type':dbH['sequelize'][_0x2991('0x82')]['SELECT']});}})[_0x2991('0x24')](respondWithResult(_0x1614df,null))[_0x2991('0x49')](handleError(_0x1614df,null));};function runReport(_0x39b111,_0x56737b,_0x310654){var _0x5b86ef=_0x56737b[_0x2991('0x2a')];var _0x51fb9b=0xa;var _0x4ac60f=[_0x2991('0x52'),'left_join','right_join',_0x2991('0x53')];var _0x7b1f1b={'SUM':_0x2991('0x54'),'COUNT':_0x2991('0x55'),'COUNT DISTINCT':_0x2991('0x56'),'MAX':_0x2991('0x57'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x2991('0x83'),'GROUP_CONCAT ASC':_0x2991('0x84'),'GROUP_CONCAT DESC':_0x2991('0x59')};var _0x1a98f4={'SEC_TO_TIME':_0x2991('0x5a'),'DATE':_0x2991('0x85'),'HOUR':_0x2991('0x5b'),'ROUND':_0x2991('0x5c'),'UNIX_TIMESTAMP':_0x2991('0x5d')};var _0x43042c=function(_0x4d3e1b){return!_[_0x2991('0x5e')](['IS\x20NULL',_0x2991('0x86'),_0x2991('0x60'),'IS\x20NOT\x20EMPTY'],_0x4d3e1b);};var _0x1c50e3=function(_0x22118e){if(!_0x22118e||!_0x22118e[_0x2991('0x61')][_0x2991('0x36')]){return'';}for(var _0x574556='(',_0x34be32=0x0;_0x34be32<_0x22118e['rules'][_0x2991('0x36')];_0x34be32+=0x1){_0x34be32>0x0&&(_0x574556+='\x20'+_0x22118e[_0x2991('0x87')]+'\x20');_0x574556+=_0x22118e[_0x2991('0x61')][_0x34be32][_0x2991('0x62')]?_0x1c50e3(_0x22118e[_0x2991('0x61')][_0x34be32][_0x2991('0x62')]):_0x22118e['rules'][_0x34be32][_0x2991('0x63')]+'\x20'+_0x22118e[_0x2991('0x61')][_0x34be32][_0x2991('0x64')]+(_0x43042c(_0x22118e[_0x2991('0x61')][_0x34be32][_0x2991('0x64')])?'\x20'+_0x22118e[_0x2991('0x61')][_0x34be32][_0x2991('0x65')]:'');}return _0x574556+')';};var _0x16ea12={'where':{'id':_0x39b111['id']}},_0x3bc6f3,_0x22f94d,_0x2d96ce,_0xd6f22d,_0x201e1a;_0x16ea12=_[_0x2991('0x3f')]({},_0x16ea12,_0x310654);return db['AnalyticDefaultReport'][_0x2991('0x48')](_0x16ea12)[_0x2991('0x24')](function(_0x3383d3){if(_0x3383d3){_0x3bc6f3=_0x3383d3;return _0x3383d3['getFields']();}return null;})[_0x2991('0x24')](function(_0x2174f4){if(_0x2174f4){if(!_0x2174f4[_0x2991('0x36')]){throw new db['Sequelize'][(_0x2991('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x22f94d=_0x2174f4;return db[_0x2991('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x2991('0x24')](function(_0x46320d){if(_0x46320d){_0x2d96ce=_[_0x2991('0x88')](_0x46320d,'id');var _0x1dcd04;var _0x2598eb=squel[_0x2991('0x89')]();_0x2598eb['from'](_0x3bc6f3['table']);for(var _0xeb83b0=0x0;_0xeb83b0<_0x22f94d[_0x2991('0x36')];_0xeb83b0+=0x1){_0x1dcd04=_0x22f94d[_0xeb83b0][_0x2991('0x6c')]?_0x2d96ce[_0x22f94d[_0xeb83b0][_0x2991('0x6c')]]['metric']:_0x22f94d[_0xeb83b0]['field'];_0x1dcd04=_0x22f94d[_0xeb83b0]['function']?_['replace'](_0x7b1f1b[_0x22f94d[_0xeb83b0]['function']],'%s',_0x1dcd04):_0x1dcd04;_0x1dcd04=_0x22f94d[_0xeb83b0][_0x2991('0x7a')]?_[_0x2991('0x6f')](_0x1a98f4[_0x22f94d[_0xeb83b0][_0x2991('0x7a')]],'%s',_0x1dcd04):_0x1dcd04;if(_0x22f94d[_0xeb83b0][_0x2991('0x70')]){_0x2598eb['group'](_0x1dcd04);}_0x22f94d[_0xeb83b0]['orderBy']&&_0x2598eb['order'](_0x1dcd04,_0x22f94d[_0xeb83b0][_0x2991('0x71')]==='DESC'?![]:!![]);_0x2598eb[_0x2991('0x63')](_0x1dcd04,_0x22f94d[_0xeb83b0]['alias']||_0x1dcd04);}if(_0x3bc6f3['joins']){_0x3bc6f3['joins']=JSON[_0x2991('0x76')](_0x3bc6f3['joins']);for(var _0x33ef6b=0x0;_0x33ef6b<_0x3bc6f3[_0x2991('0x75')][_0x2991('0x36')];_0x33ef6b+=0x1){if(_0x3bc6f3[_0x2991('0x75')][_0x33ef6b]['type']&&_[_0x2991('0x5e')](_0x4ac60f,_0x3bc6f3[_0x2991('0x75')][_0x33ef6b][_0x2991('0x40')])&&_0x3bc6f3['joins'][_0x33ef6b][_0x2991('0x77')]&&_0x3bc6f3[_0x2991('0x75')][_0x33ef6b]['foreignTable']&&_0x3bc6f3[_0x2991('0x75')][_0x33ef6b][_0x2991('0x79')]){_0x2598eb[_0x3bc6f3[_0x2991('0x75')][_0x33ef6b][_0x2991('0x40')]](_0x3bc6f3[_0x2991('0x75')][_0x33ef6b][_0x2991('0x78')],null,util['format'](_0x2991('0x7b'),_0x3bc6f3[_0x2991('0x7c')],_0x3bc6f3[_0x2991('0x75')][_0x33ef6b][_0x2991('0x77')],_0x3bc6f3[_0x2991('0x75')][_0x33ef6b][_0x2991('0x78')],_0x3bc6f3[_0x2991('0x75')][_0x33ef6b][_0x2991('0x79')]));}}}if(_0x3bc6f3['conditions']){_0x3bc6f3['conditions']=JSON[_0x2991('0x76')](_0x3bc6f3[_0x2991('0x7d')]);_0x2598eb[_0x2991('0x3b')](_0x1c50e3(_0x3bc6f3[_0x2991('0x7d')]['group']));}_0x201e1a=_0x2598eb[_0x2991('0x7e')]();_0x2598eb[_0x2991('0x39')](_0x51fb9b);_0x2598eb[_0x2991('0x1d')](0x0);return;}})[_0x2991('0x24')](function(){if(_0x56737b[_0x2991('0x8a')]===_0x2991('0x8b')){return null;}var _0x9f96bf=_[_0x2991('0x3f')](_0x56737b,{'name':_0x56737b['fullPath']||_0x56737b['name']||_0x3bc6f3['name'],'basename':_0x5b86ef,'savename':util['format']('%s-%s.%s',_0x56737b[_0x2991('0x2a')]||_0x3bc6f3['name'],require(_0x2991('0x8c'))[_0x2991('0x8d')](0x4),_0x56737b['output']||_0x2991('0x8e')),'reportId':_0x3bc6f3['id'],'reportType':'default'});return db[_0x2991('0x8f')]['create'](_0x9f96bf,{'raw':!![]});})[_0x2991('0x24')](function(_0x2d2387){if(_0x3bc6f3[_0x2991('0x7c')]===_0x2991('0x90')){_0x201e1a[_0x2991('0x3b')](_0x3bc6f3[_0x2991('0x7c')]+_0x2991('0x91'),_0x56737b[_0x2991('0x92')],_0x56737b[_0x2991('0x93')]);}else{_0x201e1a[_0x2991('0x3b')](_0x3bc6f3[_0x2991('0x7c')]+_0x2991('0x94'),_0x56737b[_0x2991('0x92')],_0x56737b[_0x2991('0x93')]);}if(_0x2d2387){logger[_0x2991('0x95')]('Run\x20Query:',_0x201e1a[_0x2991('0x81')]());require(_0x2991('0x96'))[_0x2991('0x97')](path[_0x2991('0x52')](__dirname,_0x2991('0x98'),_0x2d2387[_0x2991('0x8a')]),[_0x2d2387['id'],_0x201e1a[_0x2991('0x81')](),path[_0x2991('0x52')](__dirname,_0x2991('0x99'),_0x2d2387[_0x2991('0x9a')]),_0x5b86ef]);return _0x2d2387;}else{var _0x110e18=squel[_0x2991('0x89')]();_0x110e18[_0x2991('0x6b')]('('+_0x201e1a[_0x2991('0x81')]()+')','countTable');_0x110e18[_0x2991('0x63')]('COUNT(*)',_0x2991('0x1c'));_0x201e1a['limit'](_0x56737b[_0x2991('0x39')]||_0x51fb9b);_0x201e1a[_0x2991('0x1d')](_0x56737b[_0x2991('0x1d')]||0x0);return dbH[_0x2991('0x9b')][_0x2991('0x31')](_0x110e18[_0x2991('0x81')](),{'type':dbH['sequelize'][_0x2991('0x82')]['SELECT']})[_0x2991('0x24')](function(_0x1bb416){if(!_0x1bb416[_0x2991('0x36')]){_0xd6f22d=0x0;}else{_0xd6f22d=_0x1bb416[0x0][_0x2991('0x1c')]||0x0;}return dbH[_0x2991('0x9b')][_0x2991('0x31')](_0x201e1a[_0x2991('0x81')](),{'type':dbH[_0x2991('0x9b')][_0x2991('0x82')]['SELECT']});})['then'](function(_0x250a7f){return{'rows':_0x250a7f||[],'count':_0xd6f22d};});}});}exports[_0x2991('0x9c')]=function(_0x4b1b65,_0x5ac232){return runReport(_0x4b1b65[_0x2991('0x46')],_0x4b1b65[_0x2991('0x31')],_0x4b1b65['options'])[_0x2991('0x24')](respondWithResult(_0x5ac232,null))[_0x2991('0x49')](handleError(_0x5ac232,null));};exports[_0x2991('0x9d')]=runReport;exports[_0x2991('0x31')]=function(_0x9c081e,_0x53c70a){var _0x514222=0xa;var _0x1f1eeb=['join',_0x2991('0x9e'),_0x2991('0x9f'),_0x2991('0x53')];var _0x15f8d8={'SUM':'SUM(%s)','COUNT':_0x2991('0x55'),'COUNT DISTINCT':_0x2991('0x56'),'MAX':'MAX(%s)','MIN':_0x2991('0x58'),'AVG':_0x2991('0xa0'),'GROUP_CONCAT':_0x2991('0x83'),'GROUP_CONCAT ASC':_0x2991('0x84'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2efb3a={'SEC_TO_TIME':_0x2991('0x5a'),'DATE':_0x2991('0x85'),'HOUR':_0x2991('0x5b'),'ROUND':_0x2991('0x5c'),'UNIX_TIMESTAMP':_0x2991('0x5d')};var _0x1b5963=function(_0x2f1780){return!_[_0x2991('0x5e')]([_0x2991('0x5f'),_0x2991('0x86'),_0x2991('0x60'),'IS\x20NOT\x20EMPTY'],_0x2f1780);};var _0x3fe3cd=function(_0xc8509){if(!_0xc8509||!_0xc8509[_0x2991('0x61')][_0x2991('0x36')]){return'';}for(var _0xfd5bd6='(',_0x10e21a=0x0;_0x10e21a<_0xc8509[_0x2991('0x61')][_0x2991('0x36')];_0x10e21a+=0x1){_0x10e21a>0x0&&(_0xfd5bd6+='\x20'+_0xc8509[_0x2991('0x87')]+'\x20');_0xfd5bd6+=_0xc8509['rules'][_0x10e21a][_0x2991('0x62')]?_0x3fe3cd(_0xc8509[_0x2991('0x61')][_0x10e21a][_0x2991('0x62')]):_0xc8509[_0x2991('0x61')][_0x10e21a]['field']+'\x20'+_0xc8509['rules'][_0x10e21a][_0x2991('0x64')]+(_0x1b5963(_0xc8509[_0x2991('0x61')][_0x10e21a][_0x2991('0x64')])?'\x20'+_0xc8509[_0x2991('0x61')][_0x10e21a]['value']:'');}return _0xfd5bd6+')';};var _0x300e0b={'where':{'id':_0x9c081e[_0x2991('0x46')]['id']}},_0x21c52c,_0x4a4fe0,_0x2e8a09,_0x4956e3,_0x3f62ff;_0x300e0b=_['merge']({},_0x300e0b,_0x9c081e['options']);return db[_0x2991('0x2e')][_0x2991('0x48')](_0x300e0b)[_0x2991('0x24')](function(_0x3e0e21){if(_0x3e0e21){_0x21c52c=_0x3e0e21;return _0x3e0e21[_0x2991('0x66')]();}return null;})[_0x2991('0x24')](function(_0x34149a){if(_0x34149a){if(!_0x34149a[_0x2991('0x36')]){throw new db[(_0x2991('0x67'))][(_0x2991('0x68'))](_0x2991('0x69'),0x193);}_0x4a4fe0=_0x34149a;return db[_0x2991('0x6a')][_0x2991('0x44')]({'raw':!![]});}return null;})[_0x2991('0x24')](function(_0x48cb1b){if(_0x48cb1b){_0x2e8a09=_[_0x2991('0x88')](_0x48cb1b,'id');var _0x7e2ce5;var _0x332f1e=squel[_0x2991('0x89')]();_0x332f1e[_0x2991('0x6b')](_0x21c52c[_0x2991('0x7c')]);for(var _0x368f64=0x0;_0x368f64<_0x4a4fe0['length'];_0x368f64+=0x1){_0x7e2ce5=_0x4a4fe0[_0x368f64][_0x2991('0x6c')]?_0x2e8a09[_0x4a4fe0[_0x368f64]['MetricId']][_0x2991('0x6d')]:_0x4a4fe0[_0x368f64][_0x2991('0x63')];_0x7e2ce5=_0x4a4fe0[_0x368f64][_0x2991('0x6e')]?_['replace'](_0x15f8d8[_0x4a4fe0[_0x368f64]['function']],'%s',_0x7e2ce5):_0x7e2ce5;_0x7e2ce5=_0x4a4fe0[_0x368f64]['format']?_[_0x2991('0x6f')](_0x2efb3a[_0x4a4fe0[_0x368f64][_0x2991('0x7a')]],'%s',_0x7e2ce5):_0x7e2ce5;if(_0x4a4fe0[_0x368f64]['groupBy']){_0x332f1e['group'](_0x7e2ce5);}_0x4a4fe0[_0x368f64][_0x2991('0x71')]&&_0x332f1e[_0x2991('0x72')](_0x7e2ce5,_0x4a4fe0[_0x368f64][_0x2991('0x71')]===_0x2991('0x73')?![]:!![]);_0x332f1e[_0x2991('0x63')](_0x7e2ce5,_0x4a4fe0[_0x368f64]['alias']||_0x7e2ce5);}if(_0x21c52c[_0x2991('0x75')]){_0x21c52c['joins']=JSON[_0x2991('0x76')](_0x21c52c[_0x2991('0x75')]);for(var _0x46e4bc=0x0;_0x46e4bc<_0x21c52c[_0x2991('0x75')][_0x2991('0x36')];_0x46e4bc+=0x1){if(_0x21c52c[_0x2991('0x75')][_0x46e4bc][_0x2991('0x40')]&&_[_0x2991('0x5e')](_0x1f1eeb,_0x21c52c[_0x2991('0x75')][_0x46e4bc][_0x2991('0x40')])&&_0x21c52c[_0x2991('0x75')][_0x46e4bc][_0x2991('0x77')]&&_0x21c52c[_0x2991('0x75')][_0x46e4bc][_0x2991('0x78')]&&_0x21c52c[_0x2991('0x75')][_0x46e4bc][_0x2991('0x79')]){_0x332f1e[_0x21c52c['joins'][_0x46e4bc][_0x2991('0x40')]](_0x21c52c[_0x2991('0x75')][_0x46e4bc][_0x2991('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x21c52c[_0x2991('0x7c')],_0x21c52c['joins'][_0x46e4bc][_0x2991('0x77')],_0x21c52c[_0x2991('0x75')][_0x46e4bc]['foreignTable'],_0x21c52c[_0x2991('0x75')][_0x46e4bc][_0x2991('0x79')]));}}}if(_0x21c52c[_0x2991('0x7d')]){_0x21c52c[_0x2991('0x7d')]=JSON[_0x2991('0x76')](_0x21c52c[_0x2991('0x7d')]);_0x332f1e[_0x2991('0x3b')](_0x3fe3cd(_0x21c52c[_0x2991('0x7d')][_0x2991('0x62')]));}_0x3f62ff=_0x332f1e[_0x2991('0x7e')]();_0x332f1e[_0x2991('0x39')](_0x514222);_0x332f1e[_0x2991('0x1d')](0x0);logger[_0x2991('0x7f')]('Limited\x20Query:',_0x332f1e[_0x2991('0x81')]());return dbH[_0x2991('0x9b')][_0x2991('0x31')](_0x332f1e[_0x2991('0x81')](),{'type':dbH[_0x2991('0x9b')][_0x2991('0x82')][_0x2991('0xa1')]});}})[_0x2991('0x24')](function(){return{'sql':_0x3f62ff[_0x2991('0x81')]()};})[_0x2991('0x24')](respondWithResult(_0x53c70a,null))[_0x2991('0x49')](handleError(_0x53c70a,null));}; \ No newline at end of file +var _0x1d0c=['SUM(%s)','COUNT(%s)','DATE(%s)','operator','DESC','%s.%s\x20=\x20%s.%s','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','join','../../components/export/','../../files/reports','run','runReport','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','AnalyticDefaultReport','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','find','user','get','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','alias','joins','parse','includes','foreignTable','foreignKey','parentKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT'];(function(_0x49073,_0x883237){var _0x53d2a7=function(_0x5286c6){while(--_0x5286c6){_0x49073['push'](_0x49073['shift']());}};_0x53d2a7(++_0x883237);}(_0x1d0c,0xc2));var _0xc1d0=function(_0x3637ea,_0x35d383){_0x3637ea=_0x3637ea-0x0;var _0x5ef88b=_0x1d0c[_0x3637ea];return _0x5ef88b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc1d0('0x0'));var rimraf=require(_0xc1d0('0x1'));var zipdir=require(_0xc1d0('0x2'));var jsonpatch=require(_0xc1d0('0x3'));var rp=require(_0xc1d0('0x4'));var moment=require(_0xc1d0('0x5'));var BPromise=require(_0xc1d0('0x6'));var Mustache=require(_0xc1d0('0x7'));var util=require(_0xc1d0('0x8'));var path=require(_0xc1d0('0x9'));var sox=require(_0xc1d0('0xa'));var csv=require(_0xc1d0('0xb'));var ejs=require(_0xc1d0('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc1d0('0xd'));var crypto=require(_0xc1d0('0xe'));var jsforce=require(_0xc1d0('0xf'));var deskjs=require(_0xc1d0('0x10'));var toCsv=require(_0xc1d0('0xb'));var querystring=require(_0xc1d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xc1d0('0x12'));var authService=require(_0xc1d0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc1d0('0x14'));var hardwareService=require(_0xc1d0('0x15'));var logger=require('../../config/logger')(_0xc1d0('0x16'));var utils=require('../../config/utils');var config=require(_0xc1d0('0x17'));var licenseUtil=require(_0xc1d0('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc1d0('0x19'))[_0xc1d0('0x1a')];function respondWithStatusCode(_0x4f385f,_0x56b370){_0x56b370=_0x56b370||0xcc;return function(_0x650531){if(_0x650531){return _0x4f385f[_0xc1d0('0x1b')](_0x56b370);}return _0x4f385f[_0xc1d0('0x1c')](_0x56b370)[_0xc1d0('0x1d')]();};}function respondWithResult(_0x4db489,_0x5513ab){_0x5513ab=_0x5513ab||0xc8;return function(_0x115aca){if(_0x115aca){return _0x4db489[_0xc1d0('0x1c')](_0x5513ab)[_0xc1d0('0x1e')](_0x115aca);}};}function respondWithFilteredResult(_0x179453,_0x11c808){return function(_0x237a2d){if(_0x237a2d){var _0xa840bc=_0x237a2d[_0xc1d0('0x1f')],_0x247d3e=_0x11c808[_0xc1d0('0x20')],_0x1edb7e=_0x11c808['offset']+_0x11c808[_0xc1d0('0x21')],_0xa07ace;if(_0x1edb7e>=_0xa840bc){_0x1edb7e=_0xa840bc;_0xa07ace=0xc8;}else{_0xa07ace=0xce;}_0x179453['status'](_0xa07ace);return _0x179453[_0xc1d0('0x22')](_0xc1d0('0x23'),_0x247d3e+'-'+_0x1edb7e+'/'+_0xa840bc)[_0xc1d0('0x1e')](_0x237a2d);}return null;};}function patchUpdates(_0xb86e8d){return function(_0x4a7c0e){try{jsonpatch['apply'](_0x4a7c0e,_0xb86e8d,!![]);}catch(_0x5acbee){return BPromise[_0xc1d0('0x24')](_0x5acbee);}return _0x4a7c0e[_0xc1d0('0x25')]();};}function saveUpdates(_0x4a1c96,_0x24cf0e){return function(_0x24535d){if(_0x24535d){return _0x24535d[_0xc1d0('0x26')](_0x4a1c96)[_0xc1d0('0x27')](function(_0x5f40c9){return _0x5f40c9;});}return null;};}function removeEntity(_0x4ce2da,_0xf40063){return function(_0x2365eb){if(_0x2365eb){return _0x2365eb[_0xc1d0('0x28')]()[_0xc1d0('0x27')](function(){var _0x34635a=_0x2365eb['get']({'plain':!![]});var _0x255b99='DefaultReports';return db['UserProfileResource'][_0xc1d0('0x28')]({'where':{'type':_0x255b99,'resourceId':_0x34635a['id']}})[_0xc1d0('0x27')](function(){return _0x2365eb;});})[_0xc1d0('0x27')](function(){_0x4ce2da[_0xc1d0('0x1c')](0xcc)[_0xc1d0('0x1d')]();});}};}function handleEntityNotFound(_0x772f3a,_0x184885){return function(_0x251603){if(!_0x251603){_0x772f3a['sendStatus'](0x194);}return _0x251603;};}function handleError(_0x3fafeb,_0xd222a2){_0xd222a2=_0xd222a2||0x1f4;return function(_0xbd928c){logger[_0xc1d0('0x29')](_0xbd928c[_0xc1d0('0x2a')]);if(_0xbd928c[_0xc1d0('0x2b')]){delete _0xbd928c[_0xc1d0('0x2b')];}_0x3fafeb['status'](_0xd222a2)[_0xc1d0('0x2c')](_0xbd928c);};}exports['index']=function(_0x515229,_0xeaff9c){var _0x404130={},_0x15ff2e={},_0x3045a3={'count':0x0,'rows':[]};var _0x5db936=_['map'](db[_0xc1d0('0x2d')][_0xc1d0('0x2e')],function(_0x3eb3ee){return{'name':_0x3eb3ee['fieldName'],'type':_0x3eb3ee[_0xc1d0('0x2f')][_0xc1d0('0x30')]};});_0x15ff2e[_0xc1d0('0x31')]=_[_0xc1d0('0x32')](_0x5db936,_0xc1d0('0x2b'));_0x15ff2e['query']=_[_0xc1d0('0x33')](_0x515229['query']);_0x15ff2e[_0xc1d0('0x34')]=_[_0xc1d0('0x35')](_0x15ff2e['model'],_0x15ff2e['query']);_0x404130['attributes']=_[_0xc1d0('0x35')](_0x15ff2e[_0xc1d0('0x31')],qs['fields'](_0x515229[_0xc1d0('0x36')]['fields']));_0x404130[_0xc1d0('0x37')]=_0x404130[_0xc1d0('0x37')][_0xc1d0('0x38')]?_0x404130[_0xc1d0('0x37')]:_0x15ff2e['model'];if(!_0x515229[_0xc1d0('0x36')]['hasOwnProperty'](_0xc1d0('0x39'))){_0x404130[_0xc1d0('0x21')]=qs['limit'](_0x515229[_0xc1d0('0x36')][_0xc1d0('0x21')]);_0x404130[_0xc1d0('0x20')]=qs[_0xc1d0('0x20')](_0x515229['query'][_0xc1d0('0x20')]);}_0x404130[_0xc1d0('0x3a')]=qs[_0xc1d0('0x3b')](_0x515229[_0xc1d0('0x36')]['sort']);_0x404130['where']=qs[_0xc1d0('0x34')](_[_0xc1d0('0x3c')](_0x515229[_0xc1d0('0x36')],_0x15ff2e[_0xc1d0('0x34')]),_0x5db936);if(_0x515229['query'][_0xc1d0('0x3d')]){_0x404130['where']=_[_0xc1d0('0x3e')](_0x404130[_0xc1d0('0x3f')],{'$or':_[_0xc1d0('0x32')](_0x5db936,function(_0x3922dd){if(_0x3922dd[_0xc1d0('0x2f')]!==_0xc1d0('0x40')){var _0x23bc08={};_0x23bc08[_0x3922dd[_0xc1d0('0x2b')]]={'$like':'%'+_0x515229['query']['filter']+'%'};return _0x23bc08;}})});}_0x404130=_['merge']({},_0x404130,_0x515229[_0xc1d0('0x41')]);var _0x1d30a1={'where':_0x404130[_0xc1d0('0x3f')]};return db[_0xc1d0('0x2d')][_0xc1d0('0x1f')](_0x1d30a1)[_0xc1d0('0x27')](function(_0x357044){_0x3045a3[_0xc1d0('0x1f')]=_0x357044;if(_0x515229[_0xc1d0('0x36')][_0xc1d0('0x42')]){_0x404130[_0xc1d0('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport']['findAll'](_0x404130);})['then'](function(_0x5df4b6){_0x3045a3[_0xc1d0('0x44')]=_0x5df4b6;return _0x3045a3;})[_0xc1d0('0x27')](respondWithFilteredResult(_0xeaff9c,_0x404130))[_0xc1d0('0x45')](handleError(_0xeaff9c,null));};exports[_0xc1d0('0x46')]=function(_0x57b257,_0x32c28b){var _0x9dfc1d={'raw':!![],'where':{'id':_0x57b257[_0xc1d0('0x47')]['id']}},_0x7b4396={};_0x7b4396[_0xc1d0('0x31')]=_[_0xc1d0('0x33')](db[_0xc1d0('0x2d')][_0xc1d0('0x2e')]);_0x7b4396[_0xc1d0('0x36')]=_[_0xc1d0('0x33')](_0x57b257[_0xc1d0('0x36')]);_0x7b4396[_0xc1d0('0x34')]=_[_0xc1d0('0x35')](_0x7b4396[_0xc1d0('0x31')],_0x7b4396[_0xc1d0('0x36')]);_0x9dfc1d[_0xc1d0('0x37')]=_[_0xc1d0('0x35')](_0x7b4396[_0xc1d0('0x31')],qs[_0xc1d0('0x48')](_0x57b257[_0xc1d0('0x36')][_0xc1d0('0x48')]));_0x9dfc1d[_0xc1d0('0x37')]=_0x9dfc1d[_0xc1d0('0x37')]['length']?_0x9dfc1d['attributes']:_0x7b4396['model'];if(_0x57b257['query'][_0xc1d0('0x42')]){_0x9dfc1d['include']=[{'all':!![]}];}_0x9dfc1d=_['merge']({},_0x9dfc1d,_0x57b257[_0xc1d0('0x41')]);return db['AnalyticDefaultReport'][_0xc1d0('0x49')](_0x9dfc1d)[_0xc1d0('0x27')](handleEntityNotFound(_0x32c28b,null))[_0xc1d0('0x27')](respondWithResult(_0x32c28b,null))[_0xc1d0('0x45')](handleError(_0x32c28b,null));};exports['create']=function(_0x1c5601,_0x205126){return db[_0xc1d0('0x2d')]['create'](_0x1c5601['body'],{})[_0xc1d0('0x27')](function(_0x1ab6dd){var _0x315cc=_0x1c5601[_0xc1d0('0x4a')][_0xc1d0('0x4b')]({'plain':!![]});if(!_0x315cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x315cc[_0xc1d0('0x4c')]==='user'){var _0x3a8fd2=_0x1ab6dd['get']({'plain':!![]});var _0x323dbd=_0xc1d0('0x4d');return db[_0xc1d0('0x4e')]['find']({'where':{'name':_0x323dbd,'userProfileId':_0x315cc[_0xc1d0('0x4f')]},'raw':!![]})['then'](function(_0x505158){if(_0x505158&&_0x505158[_0xc1d0('0x50')]===0x0){return db[_0xc1d0('0x51')][_0xc1d0('0x52')]({'name':_0x3a8fd2[_0xc1d0('0x2b')],'resourceId':_0x3a8fd2['id'],'type':_0xc1d0('0x53'),'sectionId':_0x505158['id']},{})['then'](function(){return _0x1ab6dd;});}else{return _0x1ab6dd;}})[_0xc1d0('0x45')](function(_0x8f4c6f){logger[_0xc1d0('0x29')](_0xc1d0('0x54'),_0x8f4c6f);throw _0x8f4c6f;});}return _0x1ab6dd;})['then'](respondWithResult(_0x205126,0xc9))[_0xc1d0('0x45')](handleError(_0x205126,null));};exports[_0xc1d0('0x26')]=function(_0x588217,_0x566edc){if(_0x588217['body']['id']){delete _0x588217[_0xc1d0('0x55')]['id'];}return db[_0xc1d0('0x2d')]['find']({'where':{'id':_0x588217[_0xc1d0('0x47')]['id']}})[_0xc1d0('0x27')](handleEntityNotFound(_0x566edc,null))[_0xc1d0('0x27')](saveUpdates(_0x588217[_0xc1d0('0x55')],null))[_0xc1d0('0x27')](respondWithResult(_0x566edc,null))[_0xc1d0('0x45')](handleError(_0x566edc,null));};exports['destroy']=function(_0x54fc33,_0x2aa357){return db[_0xc1d0('0x2d')]['find']({'where':{'id':_0x54fc33[_0xc1d0('0x47')]['id']}})['then'](handleEntityNotFound(_0x2aa357,null))[_0xc1d0('0x27')](removeEntity(_0x2aa357,null))[_0xc1d0('0x45')](handleError(_0x2aa357,null));};exports[_0xc1d0('0x56')]=function(_0x4d8418,_0x5bd6f9){var _0x16b4f6=0xa;var _0x575a02=['join',_0xc1d0('0x57'),_0xc1d0('0x58'),_0xc1d0('0x59')];var _0x113989={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc1d0('0x5a'),'MAX':_0xc1d0('0x5b'),'MIN':_0xc1d0('0x5c'),'AVG':_0xc1d0('0x5d'),'GROUP_CONCAT':_0xc1d0('0x5e'),'GROUP_CONCAT ASC':_0xc1d0('0x5f'),'GROUP_CONCAT DESC':_0xc1d0('0x60')};var _0x545259={'SEC_TO_TIME':_0xc1d0('0x61'),'DATE':'DATE(%s)','HOUR':_0xc1d0('0x62'),'ROUND':_0xc1d0('0x63'),'UNIX_TIMESTAMP':_0xc1d0('0x64')};var _0x575be9=function(_0x46494d){return!_['includes']([_0xc1d0('0x65'),_0xc1d0('0x66'),_0xc1d0('0x67'),_0xc1d0('0x68')],_0x46494d);};var _0x3e60fa=function(_0x2961b5){if(!_0x2961b5||!_0x2961b5['rules'][_0xc1d0('0x38')]){return'';}for(var _0x3bf53c='(',_0x124bde=0x0;_0x124bde<_0x2961b5[_0xc1d0('0x69')][_0xc1d0('0x38')];_0x124bde+=0x1){_0x124bde>0x0&&(_0x3bf53c+='\x20'+_0x2961b5['operator']+'\x20');_0x3bf53c+=_0x2961b5[_0xc1d0('0x69')][_0x124bde][_0xc1d0('0x6a')]?_0x3e60fa(_0x2961b5[_0xc1d0('0x69')][_0x124bde][_0xc1d0('0x6a')]):_0x2961b5[_0xc1d0('0x69')][_0x124bde][_0xc1d0('0x6b')]+'\x20'+_0x2961b5[_0xc1d0('0x69')][_0x124bde][_0xc1d0('0x6c')]+(_0x575be9(_0x2961b5['rules'][_0x124bde]['condition'])?'\x20'+_0x2961b5[_0xc1d0('0x69')][_0x124bde][_0xc1d0('0x6d')]:'');}return _0x3bf53c+')';};var _0x3bc785={'where':{'id':_0x4d8418[_0xc1d0('0x47')]['id']}},_0x2677b4,_0x3e2c4f,_0x5a7b8b,_0x2e8f6a,_0x28cd72;_0x3bc785=_['merge']({},_0x3bc785,_0x4d8418[_0xc1d0('0x41')]);return db[_0xc1d0('0x2d')][_0xc1d0('0x49')](_0x3bc785)[_0xc1d0('0x27')](function(_0x23932f){if(_0x23932f){_0x2677b4=_0x23932f;return _0x23932f[_0xc1d0('0x6e')]();}return null;})[_0xc1d0('0x27')](function(_0xc11def){if(_0xc11def){if(!_0xc11def[_0xc1d0('0x38')]){throw new db[(_0xc1d0('0x6f'))][(_0xc1d0('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3e2c4f=_0xc11def;return db[_0xc1d0('0x71')][_0xc1d0('0x72')]({'raw':!![]});}return null;})[_0xc1d0('0x27')](function(_0x12a4de){if(_0x12a4de){_0x5a7b8b=_[_0xc1d0('0x73')](_0x12a4de,'id');var _0x2ee8d0;var _0x46e047=squel[_0xc1d0('0x74')]();_0x46e047[_0xc1d0('0x75')](_0x2677b4[_0xc1d0('0x76')]);for(var _0x335b63=0x0;_0x335b63<_0x3e2c4f[_0xc1d0('0x38')];_0x335b63+=0x1){_0x2ee8d0=_0x3e2c4f[_0x335b63][_0xc1d0('0x77')]?_0x5a7b8b[_0x3e2c4f[_0x335b63][_0xc1d0('0x77')]][_0xc1d0('0x78')]:_0x3e2c4f[_0x335b63][_0xc1d0('0x6b')];_0x2ee8d0=_0x3e2c4f[_0x335b63][_0xc1d0('0x79')]?_['replace'](_0x113989[_0x3e2c4f[_0x335b63][_0xc1d0('0x79')]],'%s',_0x2ee8d0):_0x2ee8d0;_0x2ee8d0=_0x3e2c4f[_0x335b63][_0xc1d0('0x7a')]?_[_0xc1d0('0x7b')](_0x545259[_0x3e2c4f[_0x335b63]['format']],'%s',_0x2ee8d0):_0x2ee8d0;if(_0x3e2c4f[_0x335b63][_0xc1d0('0x7c')]){_0x46e047[_0xc1d0('0x6a')](_0x2ee8d0);}_0x3e2c4f[_0x335b63]['orderBy']&&_0x46e047[_0xc1d0('0x3a')](_0x2ee8d0,_0x3e2c4f[_0x335b63][_0xc1d0('0x7d')]==='DESC'?![]:!![]);_0x46e047[_0xc1d0('0x6b')](_0x2ee8d0,_0x3e2c4f[_0x335b63][_0xc1d0('0x7e')]||_0x2ee8d0);}if(_0x2677b4['joins']){_0x2677b4[_0xc1d0('0x7f')]=JSON[_0xc1d0('0x80')](_0x2677b4['joins']);for(var _0x1c2311=0x0;_0x1c2311<_0x2677b4[_0xc1d0('0x7f')]['length'];_0x1c2311+=0x1){if(_0x2677b4[_0xc1d0('0x7f')][_0x1c2311][_0xc1d0('0x2f')]&&_[_0xc1d0('0x81')](_0x575a02,_0x2677b4[_0xc1d0('0x7f')][_0x1c2311]['type'])&&_0x2677b4[_0xc1d0('0x7f')][_0x1c2311]['parentKey']&&_0x2677b4[_0xc1d0('0x7f')][_0x1c2311][_0xc1d0('0x82')]&&_0x2677b4[_0xc1d0('0x7f')][_0x1c2311][_0xc1d0('0x83')]){_0x46e047[_0x2677b4[_0xc1d0('0x7f')][_0x1c2311][_0xc1d0('0x2f')]](_0x2677b4[_0xc1d0('0x7f')][_0x1c2311][_0xc1d0('0x82')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2677b4[_0xc1d0('0x76')],_0x2677b4[_0xc1d0('0x7f')][_0x1c2311][_0xc1d0('0x84')],_0x2677b4['joins'][_0x1c2311][_0xc1d0('0x82')],_0x2677b4['joins'][_0x1c2311][_0xc1d0('0x83')]));}}}if(_0x2677b4[_0xc1d0('0x85')]){_0x2677b4[_0xc1d0('0x85')]=JSON[_0xc1d0('0x80')](_0x2677b4[_0xc1d0('0x85')]);_0x46e047['where'](_0x3e60fa(_0x2677b4[_0xc1d0('0x85')][_0xc1d0('0x6a')]));}_0x28cd72=_0x46e047[_0xc1d0('0x86')]();_0x46e047[_0xc1d0('0x21')](_0x16b4f6);_0x46e047[_0xc1d0('0x20')](0x0);logger['debug'](_0xc1d0('0x87'),_0x46e047[_0xc1d0('0x88')]());return dbH['sequelize'][_0xc1d0('0x36')](_0x46e047[_0xc1d0('0x88')](),{'type':dbH[_0xc1d0('0x89')][_0xc1d0('0x8a')][_0xc1d0('0x8b')]});}})[_0xc1d0('0x27')](respondWithResult(_0x5bd6f9,null))['catch'](handleError(_0x5bd6f9,null));};function runReport(_0x31ba7e,_0xd8f6f0,_0x31c4ff){var _0x495b6a=_0xd8f6f0[_0xc1d0('0x2b')];var _0x411f1f=0xa;var _0x43d4a9=['join',_0xc1d0('0x57'),_0xc1d0('0x58'),_0xc1d0('0x59')];var _0x15be7d={'SUM':_0xc1d0('0x8c'),'COUNT':_0xc1d0('0x8d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc1d0('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc1d0('0x60')};var _0x5939c7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xc1d0('0x8e'),'HOUR':_0xc1d0('0x62'),'ROUND':_0xc1d0('0x63'),'UNIX_TIMESTAMP':_0xc1d0('0x64')};var _0x31c8dc=function(_0x2f39a2){return!_[_0xc1d0('0x81')]([_0xc1d0('0x65'),_0xc1d0('0x66'),_0xc1d0('0x67'),_0xc1d0('0x68')],_0x2f39a2);};var _0x29dbb5=function(_0x52abf4){if(!_0x52abf4||!_0x52abf4[_0xc1d0('0x69')][_0xc1d0('0x38')]){return'';}for(var _0xe369e9='(',_0x5eadcd=0x0;_0x5eadcd<_0x52abf4['rules'][_0xc1d0('0x38')];_0x5eadcd+=0x1){_0x5eadcd>0x0&&(_0xe369e9+='\x20'+_0x52abf4[_0xc1d0('0x8f')]+'\x20');_0xe369e9+=_0x52abf4['rules'][_0x5eadcd][_0xc1d0('0x6a')]?_0x29dbb5(_0x52abf4['rules'][_0x5eadcd][_0xc1d0('0x6a')]):_0x52abf4[_0xc1d0('0x69')][_0x5eadcd]['field']+'\x20'+_0x52abf4[_0xc1d0('0x69')][_0x5eadcd][_0xc1d0('0x6c')]+(_0x31c8dc(_0x52abf4[_0xc1d0('0x69')][_0x5eadcd]['condition'])?'\x20'+_0x52abf4['rules'][_0x5eadcd][_0xc1d0('0x6d')]:'');}return _0xe369e9+')';};var _0x8deb79={'where':{'id':_0x31ba7e['id']}},_0x4e8c8f,_0x444467,_0x22fc0e,_0x36843c,_0x49f949;_0x8deb79=_[_0xc1d0('0x3e')]({},_0x8deb79,_0x31c4ff);return db['AnalyticDefaultReport']['find'](_0x8deb79)[_0xc1d0('0x27')](function(_0x4b3cf0){if(_0x4b3cf0){_0x4e8c8f=_0x4b3cf0;return _0x4b3cf0['getFields']();}return null;})[_0xc1d0('0x27')](function(_0x3624d8){if(_0x3624d8){if(!_0x3624d8[_0xc1d0('0x38')]){throw new db[(_0xc1d0('0x6f'))][(_0xc1d0('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x444467=_0x3624d8;return db['AnalyticMetric'][_0xc1d0('0x72')]({'raw':!![]});}return null;})[_0xc1d0('0x27')](function(_0x2fcdd0){if(_0x2fcdd0){_0x22fc0e=_[_0xc1d0('0x73')](_0x2fcdd0,'id');var _0x4c05ca;var _0x916636=squel['select']();_0x916636['from'](_0x4e8c8f[_0xc1d0('0x76')]);for(var _0xad7634=0x0;_0xad7634<_0x444467['length'];_0xad7634+=0x1){_0x4c05ca=_0x444467[_0xad7634]['MetricId']?_0x22fc0e[_0x444467[_0xad7634][_0xc1d0('0x77')]][_0xc1d0('0x78')]:_0x444467[_0xad7634][_0xc1d0('0x6b')];_0x4c05ca=_0x444467[_0xad7634][_0xc1d0('0x79')]?_['replace'](_0x15be7d[_0x444467[_0xad7634][_0xc1d0('0x79')]],'%s',_0x4c05ca):_0x4c05ca;_0x4c05ca=_0x444467[_0xad7634][_0xc1d0('0x7a')]?_[_0xc1d0('0x7b')](_0x5939c7[_0x444467[_0xad7634][_0xc1d0('0x7a')]],'%s',_0x4c05ca):_0x4c05ca;if(_0x444467[_0xad7634]['groupBy']){_0x916636[_0xc1d0('0x6a')](_0x4c05ca);}_0x444467[_0xad7634][_0xc1d0('0x7d')]&&_0x916636[_0xc1d0('0x3a')](_0x4c05ca,_0x444467[_0xad7634]['orderBy']===_0xc1d0('0x90')?![]:!![]);_0x916636[_0xc1d0('0x6b')](_0x4c05ca,_0x444467[_0xad7634]['alias']||_0x4c05ca);}if(_0x4e8c8f[_0xc1d0('0x7f')]){_0x4e8c8f['joins']=JSON[_0xc1d0('0x80')](_0x4e8c8f[_0xc1d0('0x7f')]);for(var _0x2dda23=0x0;_0x2dda23<_0x4e8c8f[_0xc1d0('0x7f')][_0xc1d0('0x38')];_0x2dda23+=0x1){if(_0x4e8c8f['joins'][_0x2dda23][_0xc1d0('0x2f')]&&_['includes'](_0x43d4a9,_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23][_0xc1d0('0x2f')])&&_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23][_0xc1d0('0x84')]&&_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23][_0xc1d0('0x82')]&&_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23][_0xc1d0('0x83')]){_0x916636[_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23]['type']](_0x4e8c8f['joins'][_0x2dda23][_0xc1d0('0x82')],null,util['format'](_0xc1d0('0x91'),_0x4e8c8f['table'],_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23][_0xc1d0('0x84')],_0x4e8c8f['joins'][_0x2dda23][_0xc1d0('0x82')],_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23]['foreignKey']));}}}if(_0x4e8c8f['conditions']){_0x4e8c8f[_0xc1d0('0x85')]=JSON[_0xc1d0('0x80')](_0x4e8c8f[_0xc1d0('0x85')]);_0x916636[_0xc1d0('0x3f')](_0x29dbb5(_0x4e8c8f[_0xc1d0('0x85')][_0xc1d0('0x6a')]));}_0x49f949=_0x916636[_0xc1d0('0x86')]();_0x916636['limit'](_0x411f1f);_0x916636['offset'](0x0);return;}})[_0xc1d0('0x27')](function(){if(_0xd8f6f0[_0xc1d0('0x92')]==='web'){return null;}var _0x41e413=_[_0xc1d0('0x3e')](_0xd8f6f0,{'name':_0xd8f6f0[_0xc1d0('0x93')]||_0xd8f6f0['name']||_0x4e8c8f[_0xc1d0('0x2b')],'basename':_0x495b6a,'savename':util[_0xc1d0('0x7a')](_0xc1d0('0x94'),_0xd8f6f0['name']||_0x4e8c8f[_0xc1d0('0x2b')],require(_0xc1d0('0x95'))[_0xc1d0('0x96')](0x4),_0xd8f6f0['output']||_0xc1d0('0x97')),'reportId':_0x4e8c8f['id'],'reportType':_0xc1d0('0x98')});return db[_0xc1d0('0x99')][_0xc1d0('0x52')](_0x41e413,{'raw':!![]});})['then'](function(_0x5b575c){if(_0x4e8c8f['table']===_0xc1d0('0x9a')){_0x49f949['where'](_0x4e8c8f[_0xc1d0('0x76')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xd8f6f0[_0xc1d0('0x9b')],_0xd8f6f0[_0xc1d0('0x9c')]);}else{_0x49f949[_0xc1d0('0x3f')](_0x4e8c8f['table']+_0xc1d0('0x9d'),_0xd8f6f0[_0xc1d0('0x9b')],_0xd8f6f0[_0xc1d0('0x9c')]);}if(_0x5b575c){logger[_0xc1d0('0x9e')](_0xc1d0('0x9f'),_0x49f949[_0xc1d0('0x88')]());require(_0xc1d0('0xa0'))['fork'](path[_0xc1d0('0xa1')](__dirname,_0xc1d0('0xa2'),_0x5b575c[_0xc1d0('0x92')]),[_0x5b575c['id'],_0x49f949[_0xc1d0('0x88')](),path[_0xc1d0('0xa1')](__dirname,_0xc1d0('0xa3'),_0x5b575c['savename']),_0x495b6a]);return _0x5b575c;}else{var _0x225996=squel[_0xc1d0('0x74')]();_0x225996[_0xc1d0('0x75')]('('+_0x49f949[_0xc1d0('0x88')]()+')','countTable');_0x225996[_0xc1d0('0x6b')]('COUNT(*)','count');_0x49f949['limit'](_0xd8f6f0[_0xc1d0('0x21')]||_0x411f1f);_0x49f949[_0xc1d0('0x20')](_0xd8f6f0[_0xc1d0('0x20')]||0x0);return dbH['sequelize']['query'](_0x225996[_0xc1d0('0x88')](),{'type':dbH['sequelize'][_0xc1d0('0x8a')][_0xc1d0('0x8b')]})[_0xc1d0('0x27')](function(_0x48cdf5){if(!_0x48cdf5[_0xc1d0('0x38')]){_0x36843c=0x0;}else{_0x36843c=_0x48cdf5[0x0][_0xc1d0('0x1f')]||0x0;}return dbH[_0xc1d0('0x89')][_0xc1d0('0x36')](_0x49f949[_0xc1d0('0x88')](),{'type':dbH[_0xc1d0('0x89')][_0xc1d0('0x8a')][_0xc1d0('0x8b')]});})[_0xc1d0('0x27')](function(_0x339740){return{'rows':_0x339740||[],'count':_0x36843c};});}});}exports[_0xc1d0('0xa4')]=function(_0x387cf2,_0x36679a){return runReport(_0x387cf2[_0xc1d0('0x47')],_0x387cf2[_0xc1d0('0x36')],_0x387cf2[_0xc1d0('0x41')])[_0xc1d0('0x27')](respondWithResult(_0x36679a,null))[_0xc1d0('0x45')](handleError(_0x36679a,null));};exports[_0xc1d0('0xa5')]=runReport;exports[_0xc1d0('0x36')]=function(_0x21c793,_0x5e920a){var _0x51e33d=0xa;var _0x41d3df=[_0xc1d0('0xa1'),_0xc1d0('0x57'),_0xc1d0('0x58'),_0xc1d0('0x59')];var _0x11da8c={'SUM':_0xc1d0('0x8c'),'COUNT':_0xc1d0('0x8d'),'COUNT DISTINCT':_0xc1d0('0x5a'),'MAX':_0xc1d0('0x5b'),'MIN':_0xc1d0('0x5c'),'AVG':_0xc1d0('0x5d'),'GROUP_CONCAT':_0xc1d0('0x5e'),'GROUP_CONCAT ASC':_0xc1d0('0x5f'),'GROUP_CONCAT DESC':_0xc1d0('0x60')};var _0x35934b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xc1d0('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x20c801=function(_0x179c32){return!_[_0xc1d0('0x81')](['IS\x20NULL',_0xc1d0('0x66'),_0xc1d0('0x67'),_0xc1d0('0x68')],_0x179c32);};var _0x199c9c=function(_0x3b0a0b){if(!_0x3b0a0b||!_0x3b0a0b[_0xc1d0('0x69')][_0xc1d0('0x38')]){return'';}for(var _0x4aedc1='(',_0x5bba4f=0x0;_0x5bba4f<_0x3b0a0b[_0xc1d0('0x69')][_0xc1d0('0x38')];_0x5bba4f+=0x1){_0x5bba4f>0x0&&(_0x4aedc1+='\x20'+_0x3b0a0b[_0xc1d0('0x8f')]+'\x20');_0x4aedc1+=_0x3b0a0b[_0xc1d0('0x69')][_0x5bba4f][_0xc1d0('0x6a')]?_0x199c9c(_0x3b0a0b[_0xc1d0('0x69')][_0x5bba4f][_0xc1d0('0x6a')]):_0x3b0a0b[_0xc1d0('0x69')][_0x5bba4f][_0xc1d0('0x6b')]+'\x20'+_0x3b0a0b[_0xc1d0('0x69')][_0x5bba4f][_0xc1d0('0x6c')]+(_0x20c801(_0x3b0a0b[_0xc1d0('0x69')][_0x5bba4f][_0xc1d0('0x6c')])?'\x20'+_0x3b0a0b[_0xc1d0('0x69')][_0x5bba4f][_0xc1d0('0x6d')]:'');}return _0x4aedc1+')';};var _0x43d08f={'where':{'id':_0x21c793['params']['id']}},_0x54f51f,_0x5d1386,_0x203e87,_0x35bd4c,_0x2c1474;_0x43d08f=_[_0xc1d0('0x3e')]({},_0x43d08f,_0x21c793['options']);return db[_0xc1d0('0x2d')][_0xc1d0('0x49')](_0x43d08f)[_0xc1d0('0x27')](function(_0x37b203){if(_0x37b203){_0x54f51f=_0x37b203;return _0x37b203[_0xc1d0('0x6e')]();}return null;})[_0xc1d0('0x27')](function(_0x51fc26){if(_0x51fc26){if(!_0x51fc26['length']){throw new db[(_0xc1d0('0x6f'))][(_0xc1d0('0x70'))](_0xc1d0('0xa6'),0x193);}_0x5d1386=_0x51fc26;return db[_0xc1d0('0x71')][_0xc1d0('0x72')]({'raw':!![]});}return null;})['then'](function(_0x454e97){if(_0x454e97){_0x203e87=_[_0xc1d0('0x73')](_0x454e97,'id');var _0x11e66f;var _0x26f5dc=squel[_0xc1d0('0x74')]();_0x26f5dc[_0xc1d0('0x75')](_0x54f51f[_0xc1d0('0x76')]);for(var _0x470d6a=0x0;_0x470d6a<_0x5d1386[_0xc1d0('0x38')];_0x470d6a+=0x1){_0x11e66f=_0x5d1386[_0x470d6a][_0xc1d0('0x77')]?_0x203e87[_0x5d1386[_0x470d6a]['MetricId']][_0xc1d0('0x78')]:_0x5d1386[_0x470d6a]['field'];_0x11e66f=_0x5d1386[_0x470d6a]['function']?_[_0xc1d0('0x7b')](_0x11da8c[_0x5d1386[_0x470d6a][_0xc1d0('0x79')]],'%s',_0x11e66f):_0x11e66f;_0x11e66f=_0x5d1386[_0x470d6a][_0xc1d0('0x7a')]?_[_0xc1d0('0x7b')](_0x35934b[_0x5d1386[_0x470d6a][_0xc1d0('0x7a')]],'%s',_0x11e66f):_0x11e66f;if(_0x5d1386[_0x470d6a][_0xc1d0('0x7c')]){_0x26f5dc['group'](_0x11e66f);}_0x5d1386[_0x470d6a][_0xc1d0('0x7d')]&&_0x26f5dc['order'](_0x11e66f,_0x5d1386[_0x470d6a][_0xc1d0('0x7d')]===_0xc1d0('0x90')?![]:!![]);_0x26f5dc[_0xc1d0('0x6b')](_0x11e66f,_0x5d1386[_0x470d6a][_0xc1d0('0x7e')]||_0x11e66f);}if(_0x54f51f['joins']){_0x54f51f[_0xc1d0('0x7f')]=JSON[_0xc1d0('0x80')](_0x54f51f[_0xc1d0('0x7f')]);for(var _0x4f3db0=0x0;_0x4f3db0<_0x54f51f[_0xc1d0('0x7f')]['length'];_0x4f3db0+=0x1){if(_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0]['type']&&_['includes'](_0x41d3df,_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0]['type'])&&_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0][_0xc1d0('0x84')]&&_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0][_0xc1d0('0x82')]&&_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0][_0xc1d0('0x83')]){_0x26f5dc[_0x54f51f['joins'][_0x4f3db0][_0xc1d0('0x2f')]](_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0][_0xc1d0('0x82')],null,util[_0xc1d0('0x7a')]('%s.%s\x20=\x20%s.%s',_0x54f51f[_0xc1d0('0x76')],_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0][_0xc1d0('0x84')],_0x54f51f['joins'][_0x4f3db0]['foreignTable'],_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0][_0xc1d0('0x83')]));}}}if(_0x54f51f[_0xc1d0('0x85')]){_0x54f51f[_0xc1d0('0x85')]=JSON['parse'](_0x54f51f[_0xc1d0('0x85')]);_0x26f5dc[_0xc1d0('0x3f')](_0x199c9c(_0x54f51f[_0xc1d0('0x85')]['group']));}_0x2c1474=_0x26f5dc['clone']();_0x26f5dc[_0xc1d0('0x21')](_0x51e33d);_0x26f5dc['offset'](0x0);logger['debug']('Limited\x20Query:',_0x26f5dc['toString']());return dbH[_0xc1d0('0x89')][_0xc1d0('0x36')](_0x26f5dc[_0xc1d0('0x88')](),{'type':dbH[_0xc1d0('0x89')][_0xc1d0('0x8a')][_0xc1d0('0x8b')]});}})[_0xc1d0('0x27')](function(){return{'sql':_0x2c1474[_0xc1d0('0x88')]()};})['then'](respondWithResult(_0x5e920a,null))[_0xc1d0('0x45')](handleError(_0x5e920a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 5ab273a..206640c 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 _0xc30d=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc30d,0x6e));var _0xdc30=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0xc30d[_0x81f000];return _0x337aa2;};'use strict';var _=require(_0xdc30('0x0'));var util=require('util');var logger=require(_0xdc30('0x1'))(_0xdc30('0x2'));var moment=require(_0xdc30('0x3'));var BPromise=require(_0xdc30('0x4'));var rp=require(_0xdc30('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc30('0x6'));var config=require('../../config/environment');var attributes=require(_0xdc30('0x7'));module[_0xdc30('0x8')]=function(_0x1d2db4,_0x3e480e){return _0x1d2db4[_0xdc30('0x9')](_0xdc30('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81c9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports'];(function(_0x4a1e75,_0x3fd6bc){var _0x33868d=function(_0x48af0){while(--_0x48af0){_0x4a1e75['push'](_0x4a1e75['shift']());}};_0x33868d(++_0x3fd6bc);}(_0x81c9,0xf7));var _0x981c=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x81c9[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x981c('0x0'));var util=require(_0x981c('0x1'));var logger=require(_0x981c('0x2'))(_0x981c('0x3'));var moment=require(_0x981c('0x4'));var BPromise=require(_0x981c('0x5'));var rp=require(_0x981c('0x6'));var fs=require('fs');var path=require(_0x981c('0x7'));var rimraf=require('rimraf');var config=require(_0x981c('0x8'));var attributes=require(_0x981c('0x9'));module[_0x981c('0xa')]=function(_0x21d3ca,_0x1ed49c){return _0x21d3ca['define'](_0x981c('0xb'),attributes,{'tableName':_0x981c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 9e442a2..a444dcc 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 _0x1120=['stringify','error','code','message','catch','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x5ccafa,_0x356fb5){var _0x1d4a0e=function(_0x1095be){while(--_0x1095be){_0x5ccafa['push'](_0x5ccafa['shift']());}};_0x1d4a0e(++_0x356fb5);}(_0x1120,0x140));var _0x0112=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x1120[_0xd39959];return _0x1ff69c;};'use strict';var _=require(_0x0112('0x0'));var util=require(_0x0112('0x1'));var moment=require(_0x0112('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0112('0x3'));var logger=require(_0x0112('0x4'))(_0x0112('0x5'));var config=require(_0x0112('0x6'));var jayson=require(_0x0112('0x7'));var client=jayson[_0x0112('0x8')][_0x0112('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40ad0d,_0x31d67a,_0x444422){return new BPromise(function(_0x2fd18c,_0x1e87af){return client['request'](_0x40ad0d,_0x444422)[_0x0112('0xa')](function(_0x26fd2e){logger[_0x0112('0xb')](_0x0112('0xc'),_0x31d67a,_0x0112('0xd'));logger[_0x0112('0xe')](_0x0112('0xf'),_0x31d67a,'request\x20sent',JSON[_0x0112('0x10')](_0x26fd2e));if(_0x26fd2e[_0x0112('0x11')]){if(_0x26fd2e[_0x0112('0x11')][_0x0112('0x12')]===0x1f4){logger['error'](_0x0112('0xc'),_0x31d67a,_0x26fd2e[_0x0112('0x11')][_0x0112('0x13')]);return _0x1e87af(_0x26fd2e[_0x0112('0x11')]['message']);}logger['error'](_0x0112('0xc'),_0x31d67a,_0x26fd2e['error'][_0x0112('0x13')]);return _0x2fd18c(_0x26fd2e['error'][_0x0112('0x13')]);}else{logger[_0x0112('0xb')](_0x0112('0xc'),_0x31d67a,_0x0112('0xd'));_0x2fd18c(_0x26fd2e['result'][_0x0112('0x13')]);}})[_0x0112('0x14')](function(_0x5ef9fe){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x31d67a,_0x5ef9fe);_0x1e87af(_0x5ef9fe);});});} \ No newline at end of file +var _0xd5b6=['jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x350667,_0x1f1d12){var _0x76abd3=function(_0x596716){while(--_0x596716){_0x350667['push'](_0x350667['shift']());}};_0x76abd3(++_0x1f1d12);}(_0xd5b6,0x73));var _0x6d5b=function(_0x9b3ae2,_0x44179e){_0x9b3ae2=_0x9b3ae2-0x0;var _0x791d45=_0xd5b6[_0x9b3ae2];return _0x791d45;};'use strict';var _=require(_0x6d5b('0x0'));var util=require(_0x6d5b('0x1'));var moment=require(_0x6d5b('0x2'));var BPromise=require(_0x6d5b('0x3'));var rs=require(_0x6d5b('0x4'));var fs=require('fs');var Redis=require(_0x6d5b('0x5'));var db=require(_0x6d5b('0x6'))['db'];var utils=require(_0x6d5b('0x7'));var logger=require('../../config/logger')(_0x6d5b('0x8'));var config=require(_0x6d5b('0x9'));var jayson=require(_0x6d5b('0xa'));var client=jayson['client'][_0x6d5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e722d,_0x1e6d0e,_0x3cdc91){return new BPromise(function(_0x5b57cb,_0x5351ee){return client[_0x6d5b('0xc')](_0x3e722d,_0x3cdc91)[_0x6d5b('0xd')](function(_0x1947e5){logger[_0x6d5b('0xe')](_0x6d5b('0xf'),_0x1e6d0e,_0x6d5b('0x10'));logger[_0x6d5b('0x11')](_0x6d5b('0x12'),_0x1e6d0e,_0x6d5b('0x10'),JSON[_0x6d5b('0x13')](_0x1947e5));if(_0x1947e5[_0x6d5b('0x14')]){if(_0x1947e5[_0x6d5b('0x14')][_0x6d5b('0x15')]===0x1f4){logger[_0x6d5b('0x14')](_0x6d5b('0xf'),_0x1e6d0e,_0x1947e5[_0x6d5b('0x14')][_0x6d5b('0x16')]);return _0x5351ee(_0x1947e5[_0x6d5b('0x14')]['message']);}logger[_0x6d5b('0x14')](_0x6d5b('0xf'),_0x1e6d0e,_0x1947e5[_0x6d5b('0x14')][_0x6d5b('0x16')]);return _0x5b57cb(_0x1947e5[_0x6d5b('0x14')]['message']);}else{logger[_0x6d5b('0xe')](_0x6d5b('0xf'),_0x1e6d0e,'request\x20sent');_0x5b57cb(_0x1947e5[_0x6d5b('0x17')]['message']);}})[_0x6d5b('0x18')](function(_0x4dfd99){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x1e6d0e,_0x4dfd99);_0x5351ee(_0x4dfd99);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e75f3c0..9b18edf 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 _0x12b3=['post','create','put','/:id','update','exports','multer','express','Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id/preview','preview','/:id/run','/:id/query','query'];(function(_0x3a7191,_0x245c3b){var _0x40328d=function(_0x39b2cd){while(--_0x39b2cd){_0x3a7191['push'](_0x3a7191['shift']());}};_0x40328d(++_0x245c3b);}(_0x12b3,0x7e));var _0x312b=function(_0x2bfa87,_0x3e4c3b){_0x2bfa87=_0x2bfa87-0x0;var _0xca164d=_0x12b3[_0x2bfa87];return _0xca164d;};'use strict';var multer=require(_0x312b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x312b('0x1'));var router=express[_0x312b('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x312b('0x3'));var config=require(_0x312b('0x4'));var controller=require(_0x312b('0x5'));router[_0x312b('0x6')]('/',auth[_0x312b('0x7')](),controller[_0x312b('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x312b('0x6')](_0x312b('0x9'),auth[_0x312b('0x7')](),controller[_0x312b('0xa')]);router['get'](_0x312b('0xb'),auth[_0x312b('0x7')](),controller['run']);router[_0x312b('0x6')](_0x312b('0xc'),auth[_0x312b('0x7')](),controller[_0x312b('0xd')]);router[_0x312b('0xe')]('/',auth['isAuthenticated'](),controller[_0x312b('0xf')]);router[_0x312b('0x10')](_0x312b('0x11'),auth[_0x312b('0x7')](),controller[_0x312b('0x12')]);router['delete'](_0x312b('0x11'),auth[_0x312b('0x7')](),controller['destroy']);module[_0x312b('0x13')]=router; \ No newline at end of file +var _0xb488=['destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview','/:id/run','run','query','post','create','put','update','delete'];(function(_0x3edf96,_0x11e492){var _0x128e0e=function(_0x2db51f){while(--_0x2db51f){_0x3edf96['push'](_0x3edf96['shift']());}};_0x128e0e(++_0x11e492);}(_0xb488,0x1d0));var _0x8b48=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb488[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x8b48('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8b48('0x1'));var router=express[_0x8b48('0x2')]();var auth=require(_0x8b48('0x3'));var interaction=require(_0x8b48('0x4'));var config=require('../../config/environment');var controller=require(_0x8b48('0x5'));router['get']('/',auth[_0x8b48('0x6')](),controller[_0x8b48('0x7')]);router['get'](_0x8b48('0x8'),auth[_0x8b48('0x6')](),controller[_0x8b48('0x9')]);router[_0x8b48('0xa')](_0x8b48('0xb'),auth['isAuthenticated'](),controller['preview']);router[_0x8b48('0xa')](_0x8b48('0xc'),auth[_0x8b48('0x6')](),controller[_0x8b48('0xd')]);router[_0x8b48('0xa')]('/:id/query',auth[_0x8b48('0x6')](),controller[_0x8b48('0xe')]);router[_0x8b48('0xf')]('/',auth['isAuthenticated'](),controller[_0x8b48('0x10')]);router[_0x8b48('0x11')](_0x8b48('0x8'),auth['isAuthenticated'](),controller[_0x8b48('0x12')]);router[_0x8b48('0x13')]('/:id',auth[_0x8b48('0x6')](),controller[_0x8b48('0x14')]);module[_0x8b48('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 877b695..d4fa3a3 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 _0x70cc=['xlsx','DATE','Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','pdf'];(function(_0x278a7d,_0x48718c){var _0x207837=function(_0x190739){while(--_0x190739){_0x278a7d['push'](_0x278a7d['shift']());}};_0x207837(++_0x48718c);}(_0x70cc,0x89));var _0xc70c=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x70cc[_0x11c573];return _0x6b72de;};'use strict';var Sequelize=require(_0xc70c('0x0'));var moment=require(_0xc70c('0x1'));module[_0xc70c('0x2')]={'name':{'type':Sequelize[_0xc70c('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xc70c('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xc70c('0x4')]('csv',_0xc70c('0x5'),_0xc70c('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xc70c('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc70c('0x7')]},'endDate':{'type':Sequelize[_0xc70c('0x7')]},'status':{'type':Sequelize[_0xc70c('0x3')],'defaultValue':_0xc70c('0x8')},'type':{'type':Sequelize['ENUM']('manual',_0xc70c('0x9')),'allowNull':![],'defaultValue':_0xc70c('0xa')},'reportId':{'type':Sequelize[_0xc70c('0xb')](0xb)[_0xc70c('0xc')]},'reportType':{'type':Sequelize[_0xc70c('0x3')]}}; \ No newline at end of file +var _0x54b1=['UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x36ffab,_0x45010a){var _0x1afc6c=function(_0x460a7a){while(--_0x460a7a){_0x36ffab['push'](_0x36ffab['shift']());}};_0x1afc6c(++_0x45010a);}(_0x54b1,0x11f));var _0x154b=function(_0x47b4dc,_0xc337ee){_0x47b4dc=_0x47b4dc-0x0;var _0x2d134d=_0x54b1[_0x47b4dc];return _0x2d134d;};'use strict';var Sequelize=require(_0x154b('0x0'));var moment=require('moment');module[_0x154b('0x1')]={'name':{'type':Sequelize[_0x154b('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x154b('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x154b('0x3')](_0x154b('0x4'),_0x154b('0x5'),_0x154b('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x154b('0x7')]},'status':{'type':Sequelize[_0x154b('0x2')],'defaultValue':_0x154b('0x8')},'type':{'type':Sequelize[_0x154b('0x3')](_0x154b('0x9'),_0x154b('0xa')),'allowNull':![],'defaultValue':_0x154b('0x9')},'reportId':{'type':Sequelize[_0x154b('0xb')](0xb)[_0x154b('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 8c15cc6..2899e7d 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 _0x2570=['zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','ExtractedReports','UserProfileResource','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','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','download','basename','savename','existsSync','root','Sequelize','server/files/reports','format','%s.%s','output','toLowerCase','html-pdf','eml-format','rimraf'];(function(_0x2ea7e7,_0x354407){var _0xcdf622=function(_0x4b8821){while(--_0x4b8821){_0x2ea7e7['push'](_0x2ea7e7['shift']());}};_0xcdf622(++_0x354407);}(_0x2570,0x1d3));var _0x0257=function(_0x17a28b,_0x5d1465){_0x17a28b=_0x17a28b-0x0;var _0x9cbb5a=_0x2570[_0x17a28b];return _0x9cbb5a;};'use strict';var pdf=require(_0x0257('0x0'));var emlformat=require(_0x0257('0x1'));var rimraf=require(_0x0257('0x2'));var zipdir=require(_0x0257('0x3'));var jsonpatch=require(_0x0257('0x4'));var rp=require('request-promise');var moment=require(_0x0257('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0257('0x6'));var util=require(_0x0257('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0257('0x8'));var ejs=require(_0x0257('0x9'));var fs=require('fs');var _=require(_0x0257('0xa'));var squel=require('squel');var crypto=require(_0x0257('0xb'));var jsforce=require(_0x0257('0xc'));var deskjs=require(_0x0257('0xd'));var toCsv=require(_0x0257('0x8'));var querystring=require(_0x0257('0xe'));var Papa=require(_0x0257('0xf'));var Redis=require(_0x0257('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0257('0x11'));var hardwareService=require(_0x0257('0x12'));var logger=require(_0x0257('0x13'))(_0x0257('0x14'));var utils=require(_0x0257('0x15'));var config=require(_0x0257('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0257('0x17'))['db'];function respondWithStatusCode(_0x5b4de1,_0x5117de){_0x5117de=_0x5117de||0xcc;return function(_0x25d461){if(_0x25d461){return _0x5b4de1['sendStatus'](_0x5117de);}return _0x5b4de1['status'](_0x5117de)[_0x0257('0x18')]();};}function respondWithResult(_0x4a4613,_0x453453){_0x453453=_0x453453||0xc8;return function(_0x2575b2){if(_0x2575b2){return _0x4a4613[_0x0257('0x19')](_0x453453)[_0x0257('0x1a')](_0x2575b2);}};}function respondWithFilteredResult(_0x19c675,_0x47addc){return function(_0x35d574){if(_0x35d574){var _0x5c2882=_0x35d574[_0x0257('0x1b')],_0x217c71=_0x47addc['offset'],_0x48d86f=_0x47addc[_0x0257('0x1c')]+_0x47addc[_0x0257('0x1d')],_0x393f61;if(_0x48d86f>=_0x5c2882){_0x48d86f=_0x5c2882;_0x393f61=0xc8;}else{_0x393f61=0xce;}_0x19c675[_0x0257('0x19')](_0x393f61);return _0x19c675[_0x0257('0x1e')](_0x0257('0x1f'),_0x217c71+'-'+_0x48d86f+'/'+_0x5c2882)['json'](_0x35d574);}return null;};}function patchUpdates(_0x56ffd1){return function(_0x5525c1){try{jsonpatch['apply'](_0x5525c1,_0x56ffd1,!![]);}catch(_0xcc1b05){return BPromise[_0x0257('0x20')](_0xcc1b05);}return _0x5525c1['save']();};}function saveUpdates(_0x24c127,_0x24b2ee){return function(_0xb02c69){if(_0xb02c69){return _0xb02c69[_0x0257('0x21')](_0x24c127)[_0x0257('0x22')](function(_0x1d4e0f){return _0x1d4e0f;});}return null;};}function removeEntity(_0x5417a7,_0xaf1122){return function(_0x54c981){if(_0x54c981){return _0x54c981[_0x0257('0x23')]()[_0x0257('0x22')](function(){var _0x42fd92=_0x54c981[_0x0257('0x24')]({'plain':!![]});var _0x466293=_0x0257('0x25');return db[_0x0257('0x26')][_0x0257('0x23')]({'where':{'type':_0x466293,'resourceId':_0x42fd92['id']}})['then'](function(){return _0x54c981;});})['then'](function(){_0x5417a7[_0x0257('0x19')](0xcc)[_0x0257('0x18')]();});}};}function handleEntityNotFound(_0x5c0693,_0xa6a6d7){return function(_0x1845e8){if(!_0x1845e8){_0x5c0693['sendStatus'](0x194);}return _0x1845e8;};}function handleError(_0x1e88c9,_0x1436f5){_0x1436f5=_0x1436f5||0x1f4;return function(_0x5d612f){logger[_0x0257('0x27')](_0x5d612f[_0x0257('0x28')]);if(_0x5d612f[_0x0257('0x29')]){delete _0x5d612f['name'];}_0x1e88c9[_0x0257('0x19')](_0x1436f5)[_0x0257('0x2a')](_0x5d612f);};}exports[_0x0257('0x2b')]=function(_0x3f027d,_0x5d2288){var _0x8b76e5={},_0x1cd8e9={},_0x5d23ce={'count':0x0,'rows':[]};var _0x5717e1=_[_0x0257('0x2c')](db[_0x0257('0x2d')][_0x0257('0x2e')],function(_0x3cba71){return{'name':_0x3cba71[_0x0257('0x2f')],'type':_0x3cba71[_0x0257('0x30')][_0x0257('0x31')]};});_0x1cd8e9['model']=_[_0x0257('0x2c')](_0x5717e1,'name');_0x1cd8e9[_0x0257('0x32')]=_[_0x0257('0x33')](_0x3f027d['query']);_0x1cd8e9[_0x0257('0x34')]=_[_0x0257('0x35')](_0x1cd8e9[_0x0257('0x36')],_0x1cd8e9[_0x0257('0x32')]);_0x8b76e5[_0x0257('0x37')]=_[_0x0257('0x35')](_0x1cd8e9[_0x0257('0x36')],qs[_0x0257('0x38')](_0x3f027d[_0x0257('0x32')][_0x0257('0x38')]));_0x8b76e5[_0x0257('0x37')]=_0x8b76e5['attributes'][_0x0257('0x39')]?_0x8b76e5[_0x0257('0x37')]:_0x1cd8e9['model'];if(!_0x3f027d[_0x0257('0x32')][_0x0257('0x3a')](_0x0257('0x3b'))){_0x8b76e5[_0x0257('0x1d')]=qs[_0x0257('0x1d')](_0x3f027d[_0x0257('0x32')][_0x0257('0x1d')]);_0x8b76e5[_0x0257('0x1c')]=qs[_0x0257('0x1c')](_0x3f027d[_0x0257('0x32')][_0x0257('0x1c')]);}_0x8b76e5[_0x0257('0x3c')]=qs['sort'](_0x3f027d[_0x0257('0x32')][_0x0257('0x3d')]);_0x8b76e5[_0x0257('0x3e')]=qs['filters'](_[_0x0257('0x3f')](_0x3f027d[_0x0257('0x32')],_0x1cd8e9[_0x0257('0x34')]),_0x5717e1);if(_0x3f027d['query']['filter']){_0x8b76e5['where']=_['merge'](_0x8b76e5[_0x0257('0x3e')],{'$or':_[_0x0257('0x2c')](_0x5717e1,function(_0x1b62b4){if(_0x1b62b4[_0x0257('0x30')]!==_0x0257('0x40')){var _0x18a7c0={};_0x18a7c0[_0x1b62b4[_0x0257('0x29')]]={'$like':'%'+_0x3f027d['query']['filter']+'%'};return _0x18a7c0;}})});}_0x8b76e5=_[_0x0257('0x41')]({},_0x8b76e5,_0x3f027d[_0x0257('0x42')]);var _0x15f1b3={'where':_0x8b76e5[_0x0257('0x3e')]};return db[_0x0257('0x2d')][_0x0257('0x1b')](_0x15f1b3)[_0x0257('0x22')](function(_0x28fbc8){_0x5d23ce[_0x0257('0x1b')]=_0x28fbc8;if(_0x3f027d[_0x0257('0x32')][_0x0257('0x43')]){_0x8b76e5['include']=[{'all':!![]}];}return db[_0x0257('0x2d')]['findAll'](_0x8b76e5);})['then'](function(_0xbb5274){_0x5d23ce[_0x0257('0x44')]=_0xbb5274;return _0x5d23ce;})[_0x0257('0x22')](respondWithFilteredResult(_0x5d2288,_0x8b76e5))[_0x0257('0x45')](handleError(_0x5d2288,null));};exports[_0x0257('0x46')]=function(_0x23f046,_0x4edc59){var _0x129c60={'raw':!![],'where':{'id':_0x23f046[_0x0257('0x47')]['id']}},_0x4df757={};_0x4df757[_0x0257('0x36')]=_['keys'](db[_0x0257('0x2d')][_0x0257('0x2e')]);_0x4df757[_0x0257('0x32')]=_[_0x0257('0x33')](_0x23f046[_0x0257('0x32')]);_0x4df757[_0x0257('0x34')]=_[_0x0257('0x35')](_0x4df757['model'],_0x4df757[_0x0257('0x32')]);_0x129c60[_0x0257('0x37')]=_[_0x0257('0x35')](_0x4df757[_0x0257('0x36')],qs[_0x0257('0x38')](_0x23f046[_0x0257('0x32')]['fields']));_0x129c60[_0x0257('0x37')]=_0x129c60[_0x0257('0x37')][_0x0257('0x39')]?_0x129c60['attributes']:_0x4df757[_0x0257('0x36')];if(_0x23f046[_0x0257('0x32')][_0x0257('0x43')]){_0x129c60[_0x0257('0x48')]=[{'all':!![]}];}_0x129c60=_[_0x0257('0x41')]({},_0x129c60,_0x23f046[_0x0257('0x42')]);return db[_0x0257('0x2d')]['find'](_0x129c60)[_0x0257('0x22')](handleEntityNotFound(_0x4edc59,null))[_0x0257('0x22')](respondWithResult(_0x4edc59,null))['catch'](handleError(_0x4edc59,null));};exports[_0x0257('0x49')]=function(_0x106cc2,_0x293c62){return db[_0x0257('0x2d')]['create'](_0x106cc2[_0x0257('0x4a')],{})[_0x0257('0x22')](function(_0xc3d856){var _0x5b1360=_0x106cc2[_0x0257('0x4b')][_0x0257('0x24')]({'plain':!![]});if(!_0x5b1360)throw new Error(_0x0257('0x4c'));if(_0x5b1360[_0x0257('0x4d')]===_0x0257('0x4b')){var _0x2e5ca4=_0xc3d856[_0x0257('0x24')]({'plain':!![]});var _0x49b498=_0x0257('0x25');return db[_0x0257('0x4e')]['find']({'where':{'name':_0x49b498,'userProfileId':_0x5b1360[_0x0257('0x4f')]},'raw':!![]})[_0x0257('0x22')](function(_0x4fb306){if(_0x4fb306&&_0x4fb306[_0x0257('0x50')]===0x0){return db[_0x0257('0x26')][_0x0257('0x49')]({'name':_0x2e5ca4[_0x0257('0x29')],'resourceId':_0x2e5ca4['id'],'type':_0x4fb306[_0x0257('0x29')],'sectionId':_0x4fb306['id']},{})[_0x0257('0x22')](function(){return _0xc3d856;});}else{return _0xc3d856;}})['catch'](function(_0x2f4660){logger[_0x0257('0x27')](_0x0257('0x51'),_0x2f4660);throw _0x2f4660;});}return _0xc3d856;})[_0x0257('0x22')](respondWithResult(_0x293c62,0xc9))[_0x0257('0x45')](handleError(_0x293c62,null));};exports[_0x0257('0x21')]=function(_0x52cb49,_0x18f537){if(_0x52cb49['body']['id']){delete _0x52cb49[_0x0257('0x4a')]['id'];}return db[_0x0257('0x2d')][_0x0257('0x52')]({'where':{'id':_0x52cb49[_0x0257('0x47')]['id']}})['then'](handleEntityNotFound(_0x18f537,null))[_0x0257('0x22')](saveUpdates(_0x52cb49[_0x0257('0x4a')],null))[_0x0257('0x22')](respondWithResult(_0x18f537,null))[_0x0257('0x45')](handleError(_0x18f537,null));};exports[_0x0257('0x23')]=function(_0x6452dd,_0xe8af30){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x6452dd['params']['id']}})['then'](handleEntityNotFound(_0xe8af30,null))[_0x0257('0x22')](removeEntity(_0xe8af30,null))['catch'](handleError(_0xe8af30,null));};exports[_0x0257('0x53')]=function(_0xd2386e,_0x607851,_0x276e84){return db[_0x0257('0x2d')]['find']({'where':{'id':_0xd2386e[_0x0257('0x47')]['id']},'attributes':[_0x0257('0x29'),_0x0257('0x54'),_0x0257('0x55'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x607851,null))[_0x0257('0x22')](function(_0x387f47){if(_0x387f47){if(!fs[_0x0257('0x56')](path['join'](config[_0x0257('0x57')],'server/files/reports',_0x387f47[_0x0257('0x55')]))){throw new db[(_0x0257('0x58'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0xd2386e[_0x0257('0x32')]['exists']){return _0x607851['sendStatus'](0xc8);}return _0x607851[_0x0257('0x53')](path['join'](config[_0x0257('0x57')],_0x0257('0x59'),_0x387f47[_0x0257('0x55')]),util[_0x0257('0x5a')](_0x0257('0x5b'),_0x387f47[_0x0257('0x54')]||_0x387f47['name'],_0x387f47[_0x0257('0x5c')][_0x0257('0x5d')]()));}})[_0x0257('0x45')](handleError(_0x607851,null));}; \ No newline at end of file +var _0xaee7=['key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','toLowerCase','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','ExtractedReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticExtractedReport','fieldName'];(function(_0x20056a,_0x177c80){var _0x425b83=function(_0x4ed52b){while(--_0x4ed52b){_0x20056a['push'](_0x20056a['shift']());}};_0x425b83(++_0x177c80);}(_0xaee7,0x95));var _0x7aee=function(_0x262099,_0x5ba72a){_0x262099=_0x262099-0x0;var _0x3850b0=_0xaee7[_0x262099];return _0x3850b0;};'use strict';var pdf=require(_0x7aee('0x0'));var emlformat=require(_0x7aee('0x1'));var rimraf=require(_0x7aee('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7aee('0x3'));var rp=require('request-promise');var moment=require(_0x7aee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7aee('0x5'));var util=require(_0x7aee('0x6'));var path=require('path');var sox=require(_0x7aee('0x7'));var csv=require(_0x7aee('0x8'));var ejs=require(_0x7aee('0x9'));var fs=require('fs');var _=require(_0x7aee('0xa'));var squel=require(_0x7aee('0xb'));var crypto=require(_0x7aee('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7aee('0xd'));var toCsv=require(_0x7aee('0x8'));var querystring=require(_0x7aee('0xe'));var Papa=require(_0x7aee('0xf'));var Redis=require(_0x7aee('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7aee('0x11'));var as=require(_0x7aee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7aee('0x13'));var utils=require(_0x7aee('0x14'));var config=require(_0x7aee('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7aee('0x16'))['db'];function respondWithStatusCode(_0x5f0647,_0x30bf85){_0x30bf85=_0x30bf85||0xcc;return function(_0x9f64a2){if(_0x9f64a2){return _0x5f0647['sendStatus'](_0x30bf85);}return _0x5f0647[_0x7aee('0x17')](_0x30bf85)[_0x7aee('0x18')]();};}function respondWithResult(_0x4e5746,_0x4efa3d){_0x4efa3d=_0x4efa3d||0xc8;return function(_0x5e1e68){if(_0x5e1e68){return _0x4e5746[_0x7aee('0x17')](_0x4efa3d)[_0x7aee('0x19')](_0x5e1e68);}};}function respondWithFilteredResult(_0x27e393,_0x2b4647){return function(_0xd460d9){if(_0xd460d9){var _0x4cf088=_0xd460d9[_0x7aee('0x1a')],_0x36d0f4=_0x2b4647[_0x7aee('0x1b')],_0x3762e8=_0x2b4647[_0x7aee('0x1b')]+_0x2b4647[_0x7aee('0x1c')],_0x4bef65;if(_0x3762e8>=_0x4cf088){_0x3762e8=_0x4cf088;_0x4bef65=0xc8;}else{_0x4bef65=0xce;}_0x27e393['status'](_0x4bef65);return _0x27e393[_0x7aee('0x1d')](_0x7aee('0x1e'),_0x36d0f4+'-'+_0x3762e8+'/'+_0x4cf088)['json'](_0xd460d9);}return null;};}function patchUpdates(_0x2f7a50){return function(_0x3426eb){try{jsonpatch[_0x7aee('0x1f')](_0x3426eb,_0x2f7a50,!![]);}catch(_0xf270dc){return BPromise[_0x7aee('0x20')](_0xf270dc);}return _0x3426eb[_0x7aee('0x21')]();};}function saveUpdates(_0x31457b,_0x55f062){return function(_0x1d9145){if(_0x1d9145){return _0x1d9145[_0x7aee('0x22')](_0x31457b)['then'](function(_0x5dac8a){return _0x5dac8a;});}return null;};}function removeEntity(_0x1a0d3a,_0x3f6b78){return function(_0x36950c){if(_0x36950c){return _0x36950c['destroy']()[_0x7aee('0x23')](function(){var _0x34f97d=_0x36950c['get']({'plain':!![]});var _0x2ff0db=_0x7aee('0x24');return db[_0x7aee('0x25')][_0x7aee('0x26')]({'where':{'type':_0x2ff0db,'resourceId':_0x34f97d['id']}})[_0x7aee('0x23')](function(){return _0x36950c;});})[_0x7aee('0x23')](function(){_0x1a0d3a[_0x7aee('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dbef6,_0x33adea){return function(_0x78d271){if(!_0x78d271){_0x3dbef6[_0x7aee('0x27')](0x194);}return _0x78d271;};}function handleError(_0x325a9f,_0x12bb22){_0x12bb22=_0x12bb22||0x1f4;return function(_0x6d1117){logger[_0x7aee('0x28')](_0x6d1117['stack']);if(_0x6d1117[_0x7aee('0x29')]){delete _0x6d1117[_0x7aee('0x29')];}_0x325a9f[_0x7aee('0x17')](_0x12bb22)[_0x7aee('0x2a')](_0x6d1117);};}exports[_0x7aee('0x2b')]=function(_0x1a5914,_0x3b0060){var _0x3bc86e={},_0x46fca2={},_0x142320={'count':0x0,'rows':[]};var _0x391eaa=_[_0x7aee('0x2c')](db[_0x7aee('0x2d')]['rawAttributes'],function(_0x128dc2){return{'name':_0x128dc2[_0x7aee('0x2e')],'type':_0x128dc2['type'][_0x7aee('0x2f')]};});_0x46fca2[_0x7aee('0x30')]=_[_0x7aee('0x2c')](_0x391eaa,_0x7aee('0x29'));_0x46fca2[_0x7aee('0x31')]=_[_0x7aee('0x32')](_0x1a5914[_0x7aee('0x31')]);_0x46fca2[_0x7aee('0x33')]=_[_0x7aee('0x34')](_0x46fca2[_0x7aee('0x30')],_0x46fca2[_0x7aee('0x31')]);_0x3bc86e[_0x7aee('0x35')]=_[_0x7aee('0x34')](_0x46fca2[_0x7aee('0x30')],qs[_0x7aee('0x36')](_0x1a5914[_0x7aee('0x31')][_0x7aee('0x36')]));_0x3bc86e[_0x7aee('0x35')]=_0x3bc86e[_0x7aee('0x35')]['length']?_0x3bc86e[_0x7aee('0x35')]:_0x46fca2[_0x7aee('0x30')];if(!_0x1a5914[_0x7aee('0x31')][_0x7aee('0x37')](_0x7aee('0x38'))){_0x3bc86e[_0x7aee('0x1c')]=qs[_0x7aee('0x1c')](_0x1a5914['query'][_0x7aee('0x1c')]);_0x3bc86e[_0x7aee('0x1b')]=qs[_0x7aee('0x1b')](_0x1a5914[_0x7aee('0x31')][_0x7aee('0x1b')]);}_0x3bc86e[_0x7aee('0x39')]=qs[_0x7aee('0x3a')](_0x1a5914['query'][_0x7aee('0x3a')]);_0x3bc86e[_0x7aee('0x3b')]=qs['filters'](_['pick'](_0x1a5914[_0x7aee('0x31')],_0x46fca2[_0x7aee('0x33')]),_0x391eaa);if(_0x1a5914[_0x7aee('0x31')][_0x7aee('0x3c')]){_0x3bc86e[_0x7aee('0x3b')]=_[_0x7aee('0x3d')](_0x3bc86e[_0x7aee('0x3b')],{'$or':_[_0x7aee('0x2c')](_0x391eaa,function(_0x53811c){if(_0x53811c[_0x7aee('0x3e')]!==_0x7aee('0x3f')){var _0x8a9994={};_0x8a9994[_0x53811c[_0x7aee('0x29')]]={'$like':'%'+_0x1a5914[_0x7aee('0x31')][_0x7aee('0x3c')]+'%'};return _0x8a9994;}})});}_0x3bc86e=_['merge']({},_0x3bc86e,_0x1a5914[_0x7aee('0x40')]);var _0x338ba7={'where':_0x3bc86e[_0x7aee('0x3b')]};return db['AnalyticExtractedReport']['count'](_0x338ba7)[_0x7aee('0x23')](function(_0x337dba){_0x142320[_0x7aee('0x1a')]=_0x337dba;if(_0x1a5914[_0x7aee('0x31')][_0x7aee('0x41')]){_0x3bc86e['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x7aee('0x42')](_0x3bc86e);})[_0x7aee('0x23')](function(_0x1d8342){_0x142320[_0x7aee('0x43')]=_0x1d8342;return _0x142320;})['then'](respondWithFilteredResult(_0x3b0060,_0x3bc86e))[_0x7aee('0x44')](handleError(_0x3b0060,null));};exports[_0x7aee('0x45')]=function(_0x24ae1e,_0x1aeaf9){var _0x4d5075={'raw':!![],'where':{'id':_0x24ae1e[_0x7aee('0x46')]['id']}},_0x459b3e={};_0x459b3e[_0x7aee('0x30')]=_[_0x7aee('0x32')](db['AnalyticExtractedReport'][_0x7aee('0x47')]);_0x459b3e[_0x7aee('0x31')]=_['keys'](_0x24ae1e['query']);_0x459b3e[_0x7aee('0x33')]=_[_0x7aee('0x34')](_0x459b3e[_0x7aee('0x30')],_0x459b3e['query']);_0x4d5075[_0x7aee('0x35')]=_[_0x7aee('0x34')](_0x459b3e[_0x7aee('0x30')],qs[_0x7aee('0x36')](_0x24ae1e[_0x7aee('0x31')][_0x7aee('0x36')]));_0x4d5075['attributes']=_0x4d5075[_0x7aee('0x35')][_0x7aee('0x48')]?_0x4d5075[_0x7aee('0x35')]:_0x459b3e['model'];if(_0x24ae1e[_0x7aee('0x31')]['includeAll']){_0x4d5075[_0x7aee('0x49')]=[{'all':!![]}];}_0x4d5075=_[_0x7aee('0x3d')]({},_0x4d5075,_0x24ae1e[_0x7aee('0x40')]);return db[_0x7aee('0x2d')]['find'](_0x4d5075)[_0x7aee('0x23')](handleEntityNotFound(_0x1aeaf9,null))['then'](respondWithResult(_0x1aeaf9,null))['catch'](handleError(_0x1aeaf9,null));};exports['create']=function(_0x30ff44,_0x464e89){return db[_0x7aee('0x2d')]['create'](_0x30ff44['body'],{})[_0x7aee('0x23')](function(_0x28a41d){var _0x540cce=_0x30ff44['user'][_0x7aee('0x4a')]({'plain':!![]});if(!_0x540cce)throw new Error(_0x7aee('0x4b'));if(_0x540cce[_0x7aee('0x4c')]===_0x7aee('0x4d')){var _0x144835=_0x28a41d[_0x7aee('0x4a')]({'plain':!![]});var _0x12c680=_0x7aee('0x24');return db[_0x7aee('0x4e')][_0x7aee('0x4f')]({'where':{'name':_0x12c680,'userProfileId':_0x540cce['userProfileId']},'raw':!![]})['then'](function(_0x56d09d){if(_0x56d09d&&_0x56d09d[_0x7aee('0x50')]===0x0){return db['UserProfileResource'][_0x7aee('0x51')]({'name':_0x144835['name'],'resourceId':_0x144835['id'],'type':_0x56d09d[_0x7aee('0x29')],'sectionId':_0x56d09d['id']},{})['then'](function(){return _0x28a41d;});}else{return _0x28a41d;}})['catch'](function(_0x4d148c){logger['error'](_0x7aee('0x52'),_0x4d148c);throw _0x4d148c;});}return _0x28a41d;})[_0x7aee('0x23')](respondWithResult(_0x464e89,0xc9))['catch'](handleError(_0x464e89,null));};exports[_0x7aee('0x22')]=function(_0x4669d2,_0x46d9f1){if(_0x4669d2['body']['id']){delete _0x4669d2[_0x7aee('0x53')]['id'];}return db[_0x7aee('0x2d')][_0x7aee('0x4f')]({'where':{'id':_0x4669d2[_0x7aee('0x46')]['id']}})['then'](handleEntityNotFound(_0x46d9f1,null))[_0x7aee('0x23')](saveUpdates(_0x4669d2['body'],null))['then'](respondWithResult(_0x46d9f1,null))[_0x7aee('0x44')](handleError(_0x46d9f1,null));};exports[_0x7aee('0x26')]=function(_0x36f657,_0x4e40ef){return db['AnalyticExtractedReport'][_0x7aee('0x4f')]({'where':{'id':_0x36f657[_0x7aee('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e40ef,null))[_0x7aee('0x23')](removeEntity(_0x4e40ef,null))[_0x7aee('0x44')](handleError(_0x4e40ef,null));};exports[_0x7aee('0x54')]=function(_0x1b0192,_0x3b68cb,_0x142089){return db[_0x7aee('0x2d')][_0x7aee('0x4f')]({'where':{'id':_0x1b0192['params']['id']},'attributes':[_0x7aee('0x29'),'basename',_0x7aee('0x55'),_0x7aee('0x56')],'raw':!![]})[_0x7aee('0x23')](handleEntityNotFound(_0x3b68cb,null))[_0x7aee('0x23')](function(_0x246c56){if(_0x246c56){if(!fs[_0x7aee('0x57')](path[_0x7aee('0x58')](config[_0x7aee('0x59')],_0x7aee('0x5a'),_0x246c56[_0x7aee('0x55')]))){throw new db['Sequelize'][(_0x7aee('0x5b'))](_0x7aee('0x5c'));}if(_0x1b0192[_0x7aee('0x31')][_0x7aee('0x5d')]){return _0x3b68cb[_0x7aee('0x27')](0xc8);}return _0x3b68cb['download'](path[_0x7aee('0x58')](config['root'],'server/files/reports',_0x246c56['savename']),util[_0x7aee('0x5e')](_0x7aee('0x5f'),_0x246c56[_0x7aee('0x60')]||_0x246c56[_0x7aee('0x29')],_0x246c56[_0x7aee('0x56')][_0x7aee('0x61')]()));}})['catch'](handleError(_0x3b68cb,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d2f3e68..e7aaf7e 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 _0x617f=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','moment','bluebird'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x617f,0xb6));var _0xf617=function(_0x2254c3,_0xe86757){_0x2254c3=_0x2254c3-0x0;var _0x2edc10=_0x617f[_0x2254c3];return _0x2edc10;};'use strict';var _=require(_0xf617('0x0'));var util=require('util');var logger=require(_0xf617('0x1'))(_0xf617('0x2'));var moment=require(_0xf617('0x3'));var BPromise=require(_0xf617('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf617('0x5'));var config=require(_0xf617('0x6'));var attributes=require(_0xf617('0x7'));module[_0xf617('0x8')]=function(_0x5dec22,_0x2c2da4){return _0x5dec22['define'](_0xf617('0x9'),attributes,{'tableName':_0xf617('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x890e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes','define'];(function(_0x33c3f0,_0x32f6de){var _0x240830=function(_0xeeef3c){while(--_0xeeef3c){_0x33c3f0['push'](_0x33c3f0['shift']());}};_0x240830(++_0x32f6de);}(_0x890e,0xe6));var _0xe890=function(_0x54f5dc,_0x154acb){_0x54f5dc=_0x54f5dc-0x0;var _0x174d40=_0x890e[_0x54f5dc];return _0x174d40;};'use strict';var _=require('lodash');var util=require(_0xe890('0x0'));var logger=require(_0xe890('0x1'))(_0xe890('0x2'));var moment=require(_0xe890('0x3'));var BPromise=require(_0xe890('0x4'));var rp=require(_0xe890('0x5'));var fs=require('fs');var path=require(_0xe890('0x6'));var rimraf=require(_0xe890('0x7'));var config=require('../../config/environment');var attributes=require(_0xe890('0x8'));module['exports']=function(_0x3d1aec,_0x2710d0){return _0x3d1aec[_0xe890('0x9')]('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 d02620b..06f953a 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 _0x1e30=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','lodash','moment'];(function(_0x29e50a,_0xf2fbb5){var _0x31ba8e=function(_0x2afb09){while(--_0x2afb09){_0x29e50a['push'](_0x29e50a['shift']());}};_0x31ba8e(++_0xf2fbb5);}(_0x1e30,0x1b3));var _0x01e3=function(_0x3394fc,_0x20ce38){_0x3394fc=_0x3394fc-0x0;var _0x1abe8b=_0x1e30[_0x3394fc];return _0x1abe8b;};'use strict';var _=require(_0x01e3('0x0'));var util=require('util');var moment=require(_0x01e3('0x1'));var BPromise=require(_0x01e3('0x2'));var rs=require(_0x01e3('0x3'));var fs=require('fs');var Redis=require(_0x01e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x01e3('0x5'));var logger=require(_0x01e3('0x6'))(_0x01e3('0x7'));var config=require(_0x01e3('0x8'));var jayson=require(_0x01e3('0x9'));var client=jayson[_0x01e3('0xa')][_0x01e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ff4f3,_0x39f19d,_0x4dfe0e){return new BPromise(function(_0x125a3a,_0x31563a){return client['request'](_0x1ff4f3,_0x4dfe0e)[_0x01e3('0xc')](function(_0x1c5dcd){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x39f19d,_0x01e3('0xd'));logger[_0x01e3('0xe')](_0x01e3('0xf'),_0x39f19d,_0x01e3('0xd'),JSON[_0x01e3('0x10')](_0x1c5dcd));if(_0x1c5dcd['error']){if(_0x1c5dcd[_0x01e3('0x11')][_0x01e3('0x12')]===0x1f4){logger[_0x01e3('0x11')](_0x01e3('0x13'),_0x39f19d,_0x1c5dcd['error'][_0x01e3('0x14')]);return _0x31563a(_0x1c5dcd[_0x01e3('0x11')][_0x01e3('0x14')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x39f19d,_0x1c5dcd['error']['message']);return _0x125a3a(_0x1c5dcd['error']['message']);}else{logger[_0x01e3('0x15')](_0x01e3('0x13'),_0x39f19d,_0x01e3('0xd'));_0x125a3a(_0x1c5dcd[_0x01e3('0x16')][_0x01e3('0x14')]);}})['catch'](function(_0x4721b8){logger[_0x01e3('0x11')](_0x01e3('0x13'),_0x39f19d,_0x4721b8);_0x31563a(_0x4721b8);});});} \ No newline at end of file +var _0xb849=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','AnalyticExtractedReport,\x20%s,\x20%s','debug'];(function(_0x56e51e,_0x3e7905){var _0x421b2a=function(_0x355f52){while(--_0x355f52){_0x56e51e['push'](_0x56e51e['shift']());}};_0x421b2a(++_0x3e7905);}(_0xb849,0x92));var _0x9b84=function(_0x2f0da3,_0xeeca16){_0x2f0da3=_0x2f0da3-0x0;var _0x872fd9=_0xb849[_0x2f0da3];return _0x872fd9;};'use strict';var _=require('lodash');var util=require(_0x9b84('0x0'));var moment=require(_0x9b84('0x1'));var BPromise=require(_0x9b84('0x2'));var rs=require(_0x9b84('0x3'));var fs=require('fs');var Redis=require(_0x9b84('0x4'));var db=require(_0x9b84('0x5'))['db'];var utils=require(_0x9b84('0x6'));var logger=require(_0x9b84('0x7'))(_0x9b84('0x8'));var config=require(_0x9b84('0x9'));var jayson=require(_0x9b84('0xa'));var client=jayson[_0x9b84('0xb')][_0x9b84('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ed871,_0x514f23,_0x222835){return new BPromise(function(_0x2f3cfc,_0x7a7408){return client['request'](_0x2ed871,_0x222835)['then'](function(_0x58753d){logger['info'](_0x9b84('0xd'),_0x514f23,'request\x20sent');logger[_0x9b84('0xe')](_0x9b84('0xf'),_0x514f23,_0x9b84('0x10'),JSON[_0x9b84('0x11')](_0x58753d));if(_0x58753d['error']){if(_0x58753d[_0x9b84('0x12')]['code']===0x1f4){logger[_0x9b84('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x514f23,_0x58753d[_0x9b84('0x12')][_0x9b84('0x13')]);return _0x7a7408(_0x58753d[_0x9b84('0x12')][_0x9b84('0x13')]);}logger[_0x9b84('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x514f23,_0x58753d[_0x9b84('0x12')]['message']);return _0x2f3cfc(_0x58753d['error'][_0x9b84('0x13')]);}else{logger[_0x9b84('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x514f23,'request\x20sent');_0x2f3cfc(_0x58753d[_0x9b84('0x15')][_0x9b84('0x13')]);}})[_0x9b84('0x16')](function(_0x3f8d8d){logger[_0x9b84('0x12')](_0x9b84('0xd'),_0x514f23,_0x3f8d8d);_0x7a7408(_0x3f8d8d);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 9ecc1f3..1404c00 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 _0x0fd5=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0x0fd5,0x1e6));var _0x50fd=function(_0x191e1c,_0x30268a){_0x191e1c=_0x191e1c-0x0;var _0x3bca11=_0x0fd5[_0x191e1c];return _0x3bca11;};'use strict';var multer=require(_0x50fd('0x0'));var util=require(_0x50fd('0x1'));var path=require(_0x50fd('0x2'));var timeout=require(_0x50fd('0x3'));var express=require(_0x50fd('0x4'));var router=express[_0x50fd('0x5')]();var auth=require(_0x50fd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x50fd('0x7'));var controller=require(_0x50fd('0x8'));router[_0x50fd('0x9')]('/',auth[_0x50fd('0xa')](),controller[_0x50fd('0xb')]);router[_0x50fd('0x9')](_0x50fd('0xc'),auth['isAuthenticated'](),controller[_0x50fd('0xd')]);router[_0x50fd('0x9')](_0x50fd('0xe'),auth[_0x50fd('0xa')](),controller[_0x50fd('0xf')]);router[_0x50fd('0x10')]('/',auth[_0x50fd('0xa')](),controller[_0x50fd('0x11')]);router['put']('/:id',auth[_0x50fd('0xa')](),controller[_0x50fd('0x12')]);router[_0x50fd('0x13')](_0x50fd('0xc'),auth[_0x50fd('0xa')](),controller[_0x50fd('0x14')]);module[_0x50fd('0x15')]=router; \ No newline at end of file +var _0x4220=['Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','show','isAuthenticated','download','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x4220,0xd4));var _0x0422=function(_0x203cd6,_0x1dff71){_0x203cd6=_0x203cd6-0x0;var _0x4dd940=_0x4220[_0x203cd6];return _0x4dd940;};'use strict';var multer=require('multer');var util=require(_0x0422('0x0'));var path=require(_0x0422('0x1'));var timeout=require(_0x0422('0x2'));var express=require(_0x0422('0x3'));var router=express[_0x0422('0x4')]();var auth=require(_0x0422('0x5'));var interaction=require(_0x0422('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x0422('0x7')]('/',auth['isAuthenticated'](),controller[_0x0422('0x8')]);router[_0x0422('0x7')](_0x0422('0x9'),auth['isAuthenticated'](),controller[_0x0422('0xa')]);router[_0x0422('0x7')]('/:id/download',auth[_0x0422('0xb')](),controller[_0x0422('0xc')]);router['post']('/',auth[_0x0422('0xb')](),controller[_0x0422('0xd')]);router[_0x0422('0xe')](_0x0422('0x9'),auth[_0x0422('0xb')](),controller[_0x0422('0xf')]);router['delete'](_0x0422('0x9'),auth[_0x0422('0xb')](),controller[_0x0422('0x10')]);module[_0x0422('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index b979f91..e7d43f1 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 _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x2110d1,_0x202746){var _0x2f192b=function(_0x5ef3fe){while(--_0x5ef3fe){_0x2110d1['push'](_0x2110d1['shift']());}};_0x2f192b(++_0x202746);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x4e23a7,_0x18ef13){var _0x3f56dc=function(_0x29df4e){while(--_0x29df4e){_0x4e23a7['push'](_0x4e23a7['shift']());}};_0x3f56dc(++_0x18ef13);}(_0x1261,0x144));var _0x1126=function(_0x3a2225,_0xb6600){_0x3a2225=_0x3a2225-0x0;var _0x5c8040=_0x1261[_0x3a2225];return _0x5c8040;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 2cc22e0..31d6d48 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 _0x270b=['sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','catch','show','params','options','find','create','bulkCreate','body','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb'];(function(_0x74bef3,_0x4013f5){var _0x34298b=function(_0x57c5fa){while(--_0x57c5fa){_0x74bef3['push'](_0x74bef3['shift']());}};_0x34298b(++_0x4013f5);}(_0x270b,0x8f));var _0xb270=function(_0x33e82c,_0x3a5a79){_0x33e82c=_0x33e82c-0x0;var _0x3af0f9=_0x270b[_0x33e82c];return _0x3af0f9;};'use strict';var pdf=require(_0xb270('0x0'));var emlformat=require(_0xb270('0x1'));var rimraf=require(_0xb270('0x2'));var zipdir=require(_0xb270('0x3'));var jsonpatch=require(_0xb270('0x4'));var rp=require(_0xb270('0x5'));var moment=require(_0xb270('0x6'));var BPromise=require(_0xb270('0x7'));var Mustache=require(_0xb270('0x8'));var util=require('util');var path=require(_0xb270('0x9'));var sox=require(_0xb270('0xa'));var csv=require(_0xb270('0xb'));var ejs=require(_0xb270('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb270('0xd'));var jsforce=require(_0xb270('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb270('0xb'));var querystring=require(_0xb270('0xf'));var Papa=require(_0xb270('0x10'));var Redis=require('ioredis');var authService=require(_0xb270('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb270('0x12'));var hardwareService=require(_0xb270('0x13'));var logger=require('../../config/logger')(_0xb270('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb270('0x15'));var db=require(_0xb270('0x16'))['db'];function respondWithStatusCode(_0xe0365c,_0x4932c5){_0x4932c5=_0x4932c5||0xcc;return function(_0x5f4c4f){if(_0x5f4c4f){return _0xe0365c[_0xb270('0x17')](_0x4932c5);}return _0xe0365c[_0xb270('0x18')](_0x4932c5)['end']();};}function respondWithResult(_0x19acdd,_0x197007){_0x197007=_0x197007||0xc8;return function(_0x54f324){if(_0x54f324){return _0x19acdd[_0xb270('0x18')](_0x197007)[_0xb270('0x19')](_0x54f324);}};}function respondWithFilteredResult(_0x3c9a2e,_0x344bd3){return function(_0x323658){if(_0x323658){var _0x72f829=_0x323658['count'],_0x28a146=_0x344bd3[_0xb270('0x1a')],_0x4d2623=_0x344bd3['offset']+_0x344bd3[_0xb270('0x1b')],_0x3441c2;if(_0x4d2623>=_0x72f829){_0x4d2623=_0x72f829;_0x3441c2=0xc8;}else{_0x3441c2=0xce;}_0x3c9a2e[_0xb270('0x18')](_0x3441c2);return _0x3c9a2e[_0xb270('0x1c')](_0xb270('0x1d'),_0x28a146+'-'+_0x4d2623+'/'+_0x72f829)[_0xb270('0x19')](_0x323658);}return null;};}function patchUpdates(_0x4684c2){return function(_0x14a6cc){try{jsonpatch[_0xb270('0x1e')](_0x14a6cc,_0x4684c2,!![]);}catch(_0x4c3a4f){return BPromise[_0xb270('0x1f')](_0x4c3a4f);}return _0x14a6cc[_0xb270('0x20')]();};}function saveUpdates(_0x268f29,_0x2a0d5e){return function(_0x2d9851){if(_0x2d9851){return _0x2d9851[_0xb270('0x21')](_0x268f29)[_0xb270('0x22')](function(_0xad3434){return _0xad3434;});}return null;};}function removeEntity(_0xd3903a,_0x5f1a11){return function(_0x22b3e0){if(_0x22b3e0){return _0x22b3e0[_0xb270('0x23')]()[_0xb270('0x22')](function(){_0xd3903a[_0xb270('0x18')](0xcc)[_0xb270('0x24')]();});}};}function handleEntityNotFound(_0x189182,_0x40b5dc){return function(_0x3bd46c){if(!_0x3bd46c){_0x189182[_0xb270('0x17')](0x194);}return _0x3bd46c;};}function handleError(_0x21fd7b,_0x2bbda0){_0x2bbda0=_0x2bbda0||0x1f4;return function(_0x3bcb29){logger[_0xb270('0x25')](_0x3bcb29[_0xb270('0x26')]);if(_0x3bcb29['name']){delete _0x3bcb29[_0xb270('0x27')];}_0x21fd7b[_0xb270('0x18')](_0x2bbda0)[_0xb270('0x28')](_0x3bcb29);};}exports[_0xb270('0x29')]=function(_0x4e0d2f,_0x3e36e3){var _0x36e2f1={},_0xc91edb={},_0x1d3062={'count':0x0,'rows':[]};var _0x1b6e1f=_[_0xb270('0x2a')](db[_0xb270('0x2b')][_0xb270('0x2c')],function(_0x459521){return{'name':_0x459521[_0xb270('0x2d')],'type':_0x459521[_0xb270('0x2e')]['key']};});_0xc91edb['model']=_[_0xb270('0x2a')](_0x1b6e1f,_0xb270('0x27'));_0xc91edb[_0xb270('0x2f')]=_[_0xb270('0x30')](_0x4e0d2f['query']);_0xc91edb[_0xb270('0x31')]=_[_0xb270('0x32')](_0xc91edb[_0xb270('0x33')],_0xc91edb[_0xb270('0x2f')]);_0x36e2f1[_0xb270('0x34')]=_[_0xb270('0x32')](_0xc91edb['model'],qs['fields'](_0x4e0d2f[_0xb270('0x2f')][_0xb270('0x35')]));_0x36e2f1[_0xb270('0x34')]=_0x36e2f1[_0xb270('0x34')][_0xb270('0x36')]?_0x36e2f1['attributes']:_0xc91edb[_0xb270('0x33')];if(!_0x4e0d2f[_0xb270('0x2f')][_0xb270('0x37')](_0xb270('0x38'))){_0x36e2f1[_0xb270('0x1b')]=qs[_0xb270('0x1b')](_0x4e0d2f[_0xb270('0x2f')][_0xb270('0x1b')]);_0x36e2f1[_0xb270('0x1a')]=qs[_0xb270('0x1a')](_0x4e0d2f['query']['offset']);}_0x36e2f1[_0xb270('0x39')]=qs['sort'](_0x4e0d2f[_0xb270('0x2f')][_0xb270('0x3a')]);_0x36e2f1[_0xb270('0x3b')]=qs[_0xb270('0x31')](_[_0xb270('0x3c')](_0x4e0d2f['query'],_0xc91edb['filters']),_0x1b6e1f);if(_0x4e0d2f[_0xb270('0x2f')][_0xb270('0x3d')]){_0x36e2f1[_0xb270('0x3b')]=_[_0xb270('0x3e')](_0x36e2f1[_0xb270('0x3b')],{'$or':_['map'](_0x1b6e1f,function(_0x4f06a9){if(_0x4f06a9[_0xb270('0x2e')]!==_0xb270('0x3f')){var _0x17b296={};_0x17b296[_0x4f06a9[_0xb270('0x27')]]={'$like':'%'+_0x4e0d2f['query']['filter']+'%'};return _0x17b296;}})});}_0x36e2f1=_['merge']({},_0x36e2f1,_0x4e0d2f['options']);var _0x165671={'where':_0x36e2f1[_0xb270('0x3b')]};return db[_0xb270('0x2b')]['count'](_0x165671)[_0xb270('0x22')](function(_0x2098d4){_0x1d3062[_0xb270('0x40')]=_0x2098d4;if(_0x4e0d2f[_0xb270('0x2f')][_0xb270('0x41')]){_0x36e2f1[_0xb270('0x42')]=[{'all':!![]}];}return db[_0xb270('0x2b')]['findAll'](_0x36e2f1);})[_0xb270('0x22')](function(_0x6977b){_0x1d3062[_0xb270('0x43')]=_0x6977b;return _0x1d3062;})['then'](respondWithFilteredResult(_0x3e36e3,_0x36e2f1))[_0xb270('0x44')](handleError(_0x3e36e3,null));};exports[_0xb270('0x45')]=function(_0x345f4b,_0x4e621a){var _0x37ad92={'raw':![],'where':{'id':_0x345f4b[_0xb270('0x46')]['id']}},_0x4f17ab={};_0x4f17ab[_0xb270('0x33')]=_['keys'](db['AnalyticFieldReport']['rawAttributes']);_0x4f17ab[_0xb270('0x2f')]=_['keys'](_0x345f4b[_0xb270('0x2f')]);_0x4f17ab[_0xb270('0x31')]=_[_0xb270('0x32')](_0x4f17ab[_0xb270('0x33')],_0x4f17ab[_0xb270('0x2f')]);_0x37ad92['attributes']=_[_0xb270('0x32')](_0x4f17ab[_0xb270('0x33')],qs['fields'](_0x345f4b[_0xb270('0x2f')][_0xb270('0x35')]));_0x37ad92[_0xb270('0x34')]=_0x37ad92[_0xb270('0x34')]['length']?_0x37ad92[_0xb270('0x34')]:_0x4f17ab[_0xb270('0x33')];if(_0x345f4b[_0xb270('0x2f')][_0xb270('0x41')]){_0x37ad92['include']=[{'all':!![]}];}_0x37ad92=_[_0xb270('0x3e')]({},_0x37ad92,_0x345f4b[_0xb270('0x47')]);return db[_0xb270('0x2b')][_0xb270('0x48')](_0x37ad92)['then'](handleEntityNotFound(_0x4e621a,null))['then'](respondWithResult(_0x4e621a,null))[_0xb270('0x44')](handleError(_0x4e621a,null));};exports[_0xb270('0x49')]=function(_0x2c45a2,_0x2770e1){return db[_0xb270('0x2b')][_0xb270('0x49')](_0x2c45a2['body'],{})[_0xb270('0x22')](respondWithResult(_0x2770e1,0xc9))[_0xb270('0x44')](handleError(_0x2770e1,null));};exports[_0xb270('0x4a')]=function(_0x16f4e6,_0x603ea9){return db[_0xb270('0x2b')][_0xb270('0x4a')](_0x16f4e6[_0xb270('0x4b')],{'raw':![],'individualHooks':!![]})[_0xb270('0x22')](respondWithResult(_0x603ea9,0xc9))['catch'](handleError(_0x603ea9,null));};exports['update']=function(_0x52f513,_0x1fb9b9){if(_0x52f513[_0xb270('0x4b')]['id']){delete _0x52f513[_0xb270('0x4b')]['id'];}return db['AnalyticFieldReport'][_0xb270('0x48')]({'where':{'id':_0x52f513[_0xb270('0x46')]['id']}})['then'](handleEntityNotFound(_0x1fb9b9,null))[_0xb270('0x22')](saveUpdates(_0x52f513[_0xb270('0x4b')],null))['then'](respondWithResult(_0x1fb9b9,null))[_0xb270('0x44')](handleError(_0x1fb9b9,null));};exports[_0xb270('0x23')]=function(_0xbdb24,_0x565af2){return db[_0xb270('0x2b')][_0xb270('0x48')]({'where':{'id':_0xbdb24[_0xb270('0x46')]['id']}})[_0xb270('0x22')](handleEntityNotFound(_0x565af2,null))[_0xb270('0x22')](removeEntity(_0x565af2,null))[_0xb270('0x44')](handleError(_0x565af2,null));};exports['bulkDestroy']=function(_0xb588e5,_0x20290a){return db[_0xb270('0x2b')][_0xb270('0x23')]({'where':{'id':_0xb588e5['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0xb270('0x22')](respondWithResult(_0x20290a,0xcc))[_0xb270('0x44')](handleError(_0x20290a,null));};exports[_0xb270('0x4c')]=function(_0x53adf9,_0xd274e3,_0x3ed296){return db[_0xb270('0x4d')][_0xb270('0x4e')]({'where':{'id':_0x53adf9['params']['id']}})['then'](handleEntityNotFound(_0xd274e3,null))[_0xb270('0x22')](function(_0x245115){if(_0x245115){return db[_0xb270('0x4f')][_0xb270('0x50')](function(_0xd88c83){return db['AnalyticFieldReport'][_0xb270('0x23')]({'where':{'CustomReportId':_0x53adf9[_0xb270('0x46')]['id']},'transaction':_0xd88c83})[_0xb270('0x22')](function(_0x5c5ca8){var _0x3c8747=_['map'](_0x53adf9[_0xb270('0x4b')],function(_0x2d5783){delete _0x2d5783['id'];_0x2d5783[_0xb270('0x51')]=_0x53adf9[_0xb270('0x46')]['id'];return _0x2d5783;});return db[_0xb270('0x2b')][_0xb270('0x4a')](_0x3c8747,{'transaction':_0xd88c83});});})['then'](function(){return db[_0xb270('0x2b')][_0xb270('0x52')]({'where':{'CustomReportId':_0x53adf9[_0xb270('0x46')]['id']}});});}})[_0xb270('0x22')](respondWithResult(_0xd274e3,null))[_0xb270('0x44')](handleError(_0xd274e3,null));}; \ No newline at end of file +var _0x6078=['save','update','then','destroy','end','stack','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','name','filter','options','include','findAll','catch','params','keys','includeAll','create','body','bulkCreate','find','bulkDestroy','ids','addFields','findOne','sequelize','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','set','Content-Range','apply','reject'];(function(_0x149083,_0x4047b6){var _0x4dc74e=function(_0x1211f9){while(--_0x1211f9){_0x149083['push'](_0x149083['shift']());}};_0x4dc74e(++_0x4047b6);}(_0x6078,0xcb));var _0x8607=function(_0x48572f,_0x579215){_0x48572f=_0x48572f-0x0;var _0x54f2bf=_0x6078[_0x48572f];return _0x54f2bf;};'use strict';var pdf=require(_0x8607('0x0'));var emlformat=require(_0x8607('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8607('0x2'));var jsonpatch=require(_0x8607('0x3'));var rp=require(_0x8607('0x4'));var moment=require(_0x8607('0x5'));var BPromise=require(_0x8607('0x6'));var Mustache=require(_0x8607('0x7'));var util=require(_0x8607('0x8'));var path=require(_0x8607('0x9'));var sox=require('sox');var csv=require(_0x8607('0xa'));var ejs=require(_0x8607('0xb'));var fs=require('fs');var _=require(_0x8607('0xc'));var squel=require(_0x8607('0xd'));var crypto=require(_0x8607('0xe'));var jsforce=require(_0x8607('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8607('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8607('0x10'));var authService=require(_0x8607('0x11'));var qs=require(_0x8607('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8607('0x13'));var logger=require(_0x8607('0x14'))(_0x8607('0x15'));var utils=require(_0x8607('0x16'));var config=require(_0x8607('0x17'));var licenseUtil=require(_0x8607('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e1bc2,_0x1dd065){_0x1dd065=_0x1dd065||0xcc;return function(_0x593688){if(_0x593688){return _0x3e1bc2[_0x8607('0x19')](_0x1dd065);}return _0x3e1bc2['status'](_0x1dd065)['end']();};}function respondWithResult(_0x498c55,_0x4f551a){_0x4f551a=_0x4f551a||0xc8;return function(_0x142a81){if(_0x142a81){return _0x498c55[_0x8607('0x1a')](_0x4f551a)[_0x8607('0x1b')](_0x142a81);}};}function respondWithFilteredResult(_0x4418db,_0x2cbbb7){return function(_0x1f2071){if(_0x1f2071){var _0x59065c=_0x1f2071[_0x8607('0x1c')],_0x32ff2c=_0x2cbbb7[_0x8607('0x1d')],_0x21db83=_0x2cbbb7[_0x8607('0x1d')]+_0x2cbbb7['limit'],_0x21f830;if(_0x21db83>=_0x59065c){_0x21db83=_0x59065c;_0x21f830=0xc8;}else{_0x21f830=0xce;}_0x4418db[_0x8607('0x1a')](_0x21f830);return _0x4418db[_0x8607('0x1e')](_0x8607('0x1f'),_0x32ff2c+'-'+_0x21db83+'/'+_0x59065c)[_0x8607('0x1b')](_0x1f2071);}return null;};}function patchUpdates(_0x4e8bc8){return function(_0x134c8d){try{jsonpatch[_0x8607('0x20')](_0x134c8d,_0x4e8bc8,!![]);}catch(_0x59833e){return BPromise[_0x8607('0x21')](_0x59833e);}return _0x134c8d[_0x8607('0x22')]();};}function saveUpdates(_0x3e718a,_0x2e1518){return function(_0x4e4145){if(_0x4e4145){return _0x4e4145[_0x8607('0x23')](_0x3e718a)[_0x8607('0x24')](function(_0x54ba8e){return _0x54ba8e;});}return null;};}function removeEntity(_0x281e41,_0x1e9251){return function(_0x3a8060){if(_0x3a8060){return _0x3a8060[_0x8607('0x25')]()[_0x8607('0x24')](function(){_0x281e41[_0x8607('0x1a')](0xcc)[_0x8607('0x26')]();});}};}function handleEntityNotFound(_0x2aeb6f,_0x9f0f3){return function(_0x4b463c){if(!_0x4b463c){_0x2aeb6f[_0x8607('0x19')](0x194);}return _0x4b463c;};}function handleError(_0x3b9191,_0xa570eb){_0xa570eb=_0xa570eb||0x1f4;return function(_0x4eb1d3){logger['error'](_0x4eb1d3[_0x8607('0x27')]);if(_0x4eb1d3['name']){delete _0x4eb1d3['name'];}_0x3b9191[_0x8607('0x1a')](_0xa570eb)['send'](_0x4eb1d3);};}exports[_0x8607('0x28')]=function(_0x4c5e06,_0x5c3d82){var _0x3d7541={},_0x13ed77={},_0x81092f={'count':0x0,'rows':[]};var _0x9c37b=_[_0x8607('0x29')](db[_0x8607('0x2a')][_0x8607('0x2b')],function(_0x22ea5a){return{'name':_0x22ea5a[_0x8607('0x2c')],'type':_0x22ea5a[_0x8607('0x2d')][_0x8607('0x2e')]};});_0x13ed77['model']=_[_0x8607('0x29')](_0x9c37b,'name');_0x13ed77[_0x8607('0x2f')]=_['keys'](_0x4c5e06[_0x8607('0x2f')]);_0x13ed77[_0x8607('0x30')]=_[_0x8607('0x31')](_0x13ed77[_0x8607('0x32')],_0x13ed77[_0x8607('0x2f')]);_0x3d7541[_0x8607('0x33')]=_[_0x8607('0x31')](_0x13ed77[_0x8607('0x32')],qs[_0x8607('0x34')](_0x4c5e06[_0x8607('0x2f')][_0x8607('0x34')]));_0x3d7541['attributes']=_0x3d7541['attributes'][_0x8607('0x35')]?_0x3d7541[_0x8607('0x33')]:_0x13ed77[_0x8607('0x32')];if(!_0x4c5e06[_0x8607('0x2f')][_0x8607('0x36')](_0x8607('0x37'))){_0x3d7541[_0x8607('0x38')]=qs[_0x8607('0x38')](_0x4c5e06[_0x8607('0x2f')][_0x8607('0x38')]);_0x3d7541[_0x8607('0x1d')]=qs[_0x8607('0x1d')](_0x4c5e06[_0x8607('0x2f')][_0x8607('0x1d')]);}_0x3d7541['order']=qs[_0x8607('0x39')](_0x4c5e06[_0x8607('0x2f')][_0x8607('0x39')]);_0x3d7541[_0x8607('0x3a')]=qs[_0x8607('0x30')](_['pick'](_0x4c5e06[_0x8607('0x2f')],_0x13ed77[_0x8607('0x30')]),_0x9c37b);if(_0x4c5e06[_0x8607('0x2f')]['filter']){_0x3d7541[_0x8607('0x3a')]=_[_0x8607('0x3b')](_0x3d7541['where'],{'$or':_[_0x8607('0x29')](_0x9c37b,function(_0x33f917){if(_0x33f917[_0x8607('0x2d')]!==_0x8607('0x3c')){var _0x22475f={};_0x22475f[_0x33f917[_0x8607('0x3d')]]={'$like':'%'+_0x4c5e06[_0x8607('0x2f')][_0x8607('0x3e')]+'%'};return _0x22475f;}})});}_0x3d7541=_['merge']({},_0x3d7541,_0x4c5e06[_0x8607('0x3f')]);var _0x981c29={'where':_0x3d7541[_0x8607('0x3a')]};return db[_0x8607('0x2a')][_0x8607('0x1c')](_0x981c29)[_0x8607('0x24')](function(_0x1e0431){_0x81092f['count']=_0x1e0431;if(_0x4c5e06[_0x8607('0x2f')]['includeAll']){_0x3d7541[_0x8607('0x40')]=[{'all':!![]}];}return db[_0x8607('0x2a')][_0x8607('0x41')](_0x3d7541);})[_0x8607('0x24')](function(_0x4dc2c5){_0x81092f['rows']=_0x4dc2c5;return _0x81092f;})[_0x8607('0x24')](respondWithFilteredResult(_0x5c3d82,_0x3d7541))[_0x8607('0x42')](handleError(_0x5c3d82,null));};exports['show']=function(_0x8ba16e,_0x3d568f){var _0x49615d={'raw':![],'where':{'id':_0x8ba16e[_0x8607('0x43')]['id']}},_0x1ec100={};_0x1ec100['model']=_[_0x8607('0x44')](db['AnalyticFieldReport']['rawAttributes']);_0x1ec100['query']=_[_0x8607('0x44')](_0x8ba16e[_0x8607('0x2f')]);_0x1ec100[_0x8607('0x30')]=_['intersection'](_0x1ec100['model'],_0x1ec100[_0x8607('0x2f')]);_0x49615d[_0x8607('0x33')]=_[_0x8607('0x31')](_0x1ec100[_0x8607('0x32')],qs[_0x8607('0x34')](_0x8ba16e[_0x8607('0x2f')][_0x8607('0x34')]));_0x49615d[_0x8607('0x33')]=_0x49615d[_0x8607('0x33')][_0x8607('0x35')]?_0x49615d[_0x8607('0x33')]:_0x1ec100['model'];if(_0x8ba16e[_0x8607('0x2f')][_0x8607('0x45')]){_0x49615d[_0x8607('0x40')]=[{'all':!![]}];}_0x49615d=_[_0x8607('0x3b')]({},_0x49615d,_0x8ba16e[_0x8607('0x3f')]);return db[_0x8607('0x2a')]['find'](_0x49615d)[_0x8607('0x24')](handleEntityNotFound(_0x3d568f,null))[_0x8607('0x24')](respondWithResult(_0x3d568f,null))['catch'](handleError(_0x3d568f,null));};exports[_0x8607('0x46')]=function(_0xd92601,_0x4dc474){return db[_0x8607('0x2a')][_0x8607('0x46')](_0xd92601[_0x8607('0x47')],{})[_0x8607('0x24')](respondWithResult(_0x4dc474,0xc9))[_0x8607('0x42')](handleError(_0x4dc474,null));};exports[_0x8607('0x48')]=function(_0x518ecc,_0x380a1a){return db['AnalyticFieldReport'][_0x8607('0x48')](_0x518ecc[_0x8607('0x47')],{'raw':![],'individualHooks':!![]})[_0x8607('0x24')](respondWithResult(_0x380a1a,0xc9))[_0x8607('0x42')](handleError(_0x380a1a,null));};exports['update']=function(_0x368cfb,_0x40467c){if(_0x368cfb[_0x8607('0x47')]['id']){delete _0x368cfb[_0x8607('0x47')]['id'];}return db['AnalyticFieldReport'][_0x8607('0x49')]({'where':{'id':_0x368cfb['params']['id']}})[_0x8607('0x24')](handleEntityNotFound(_0x40467c,null))['then'](saveUpdates(_0x368cfb[_0x8607('0x47')],null))['then'](respondWithResult(_0x40467c,null))[_0x8607('0x42')](handleError(_0x40467c,null));};exports[_0x8607('0x25')]=function(_0x1425bf,_0x2d2133){return db['AnalyticFieldReport'][_0x8607('0x49')]({'where':{'id':_0x1425bf['params']['id']}})[_0x8607('0x24')](handleEntityNotFound(_0x2d2133,null))['then'](removeEntity(_0x2d2133,null))[_0x8607('0x42')](handleError(_0x2d2133,null));};exports[_0x8607('0x4a')]=function(_0x3778eb,_0x16e24a){return db[_0x8607('0x2a')][_0x8607('0x25')]({'where':{'id':_0x3778eb[_0x8607('0x2f')][_0x8607('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x8607('0x24')](respondWithResult(_0x16e24a,0xcc))[_0x8607('0x42')](handleError(_0x16e24a,null));};exports[_0x8607('0x4c')]=function(_0x58b403,_0x2a5821,_0x4dc071){return db['AnalyticCustomReport'][_0x8607('0x4d')]({'where':{'id':_0x58b403['params']['id']}})[_0x8607('0x24')](handleEntityNotFound(_0x2a5821,null))[_0x8607('0x24')](function(_0x539ba2){if(_0x539ba2){return db[_0x8607('0x4e')]['transaction'](function(_0x563729){return db['AnalyticFieldReport'][_0x8607('0x25')]({'where':{'CustomReportId':_0x58b403['params']['id']},'transaction':_0x563729})[_0x8607('0x24')](function(_0x2aeba3){var _0x107d26=_[_0x8607('0x29')](_0x58b403['body'],function(_0x235817){delete _0x235817['id'];_0x235817['CustomReportId']=_0x58b403['params']['id'];return _0x235817;});return db[_0x8607('0x2a')][_0x8607('0x48')](_0x107d26,{'transaction':_0x563729});});})[_0x8607('0x24')](function(){return db[_0x8607('0x2a')][_0x8607('0x41')]({'where':{'CustomReportId':_0x58b403[_0x8607('0x43')]['id']}});});}})[_0x8607('0x24')](respondWithResult(_0x2a5821,null))[_0x8607('0x42')](handleError(_0x2a5821,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 3fb0002..18bbc6b 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 _0xe266=['AnalyticFieldReport','analytics_report_fields','api','moment','bluebird','rimraf','exports','define'];(function(_0x62b5fb,_0x4fdc3b){var _0x10377e=function(_0xd02ac){while(--_0xd02ac){_0x62b5fb['push'](_0x62b5fb['shift']());}};_0x10377e(++_0x4fdc3b);}(_0xe266,0x102));var _0x6e26=function(_0x15a410,_0x482299){_0x15a410=_0x15a410-0x0;var _0x588874=_0xe266[_0x15a410];return _0x588874;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6e26('0x0'));var moment=require(_0x6e26('0x1'));var BPromise=require(_0x6e26('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6e26('0x3'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x6e26('0x4')]=function(_0x33448f,_0x4171b1){return _0x33448f[_0x6e26('0x5')](_0x6e26('0x6'),attributes,{'tableName':_0x6e26('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e10=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xa4be81,_0x261167){var _0x2320f9=function(_0x2863c4){while(--_0x2863c4){_0xa4be81['push'](_0xa4be81['shift']());}};_0x2320f9(++_0x261167);}(_0x3e10,0x1c8));var _0x03e1=function(_0x4affc1,_0x235d4d){_0x4affc1=_0x4affc1-0x0;var _0x451eb3=_0x3e10[_0x4affc1];return _0x451eb3;};'use strict';var _=require(_0x03e1('0x0'));var util=require(_0x03e1('0x1'));var logger=require(_0x03e1('0x2'))('api');var moment=require(_0x03e1('0x3'));var BPromise=require(_0x03e1('0x4'));var rp=require(_0x03e1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x03e1('0x6'));var attributes=require(_0x03e1('0x7'));module[_0x03e1('0x8')]=function(_0x400737,_0x29f711){return _0x400737[_0x03e1('0x9')](_0x03e1('0xa'),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 b26a56f..e5d116d 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 _0xda5f=['debug','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0x16264c,_0x2243c9){var _0x153521=function(_0x2ec504){while(--_0x2ec504){_0x16264c['push'](_0x16264c['shift']());}};_0x153521(++_0x2243c9);}(_0xda5f,0x1ea));var _0xfda5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfda5('0x0'));var moment=require(_0xfda5('0x1'));var BPromise=require(_0xfda5('0x2'));var rs=require(_0xfda5('0x3'));var fs=require('fs');var Redis=require(_0xfda5('0x4'));var db=require(_0xfda5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfda5('0x6'));var config=require(_0xfda5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfda5('0x8')][_0xfda5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fdcd5,_0x1bbd64,_0x52b865){return new BPromise(function(_0x1cfda6,_0x947aea){return client['request'](_0x3fdcd5,_0x52b865)[_0xfda5('0xa')](function(_0x1cff4f){logger[_0xfda5('0xb')](_0xfda5('0xc'),_0x1bbd64,_0xfda5('0xd'));logger[_0xfda5('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x1bbd64,_0xfda5('0xd'),JSON[_0xfda5('0xf')](_0x1cff4f));if(_0x1cff4f['error']){if(_0x1cff4f['error'][_0xfda5('0x10')]===0x1f4){logger[_0xfda5('0x11')](_0xfda5('0xc'),_0x1bbd64,_0x1cff4f[_0xfda5('0x11')]['message']);return _0x947aea(_0x1cff4f[_0xfda5('0x11')][_0xfda5('0x12')]);}logger[_0xfda5('0x11')](_0xfda5('0xc'),_0x1bbd64,_0x1cff4f[_0xfda5('0x11')][_0xfda5('0x12')]);return _0x1cfda6(_0x1cff4f[_0xfda5('0x11')][_0xfda5('0x12')]);}else{logger[_0xfda5('0xb')](_0xfda5('0xc'),_0x1bbd64,'request\x20sent');_0x1cfda6(_0x1cff4f[_0xfda5('0x13')][_0xfda5('0x12')]);}})[_0xfda5('0x14')](function(_0x3f40a4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x1bbd64,_0x3f40a4);_0x947aea(_0x3f40a4);});});} \ No newline at end of file +var _0x0fd0=['jayson/promise','request','then','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','ioredis','../../config/utils','rpc'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0fd0,0x12d));var _0x00fd=function(_0x1ca5c6,_0x3f23ba){_0x1ca5c6=_0x1ca5c6-0x0;var _0x314371=_0x0fd0[_0x1ca5c6];return _0x314371;};'use strict';var _=require(_0x00fd('0x0'));var util=require(_0x00fd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00fd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x00fd('0x3'));var logger=require('../../config/logger')(_0x00fd('0x4'));var config=require('../../config/environment');var jayson=require(_0x00fd('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fad18,_0x386d0e,_0x5cee5c){return new BPromise(function(_0x50a052,_0x4e9bf9){return client[_0x00fd('0x6')](_0x2fad18,_0x5cee5c)[_0x00fd('0x7')](function(_0x492dfa){logger['info'](_0x00fd('0x8'),_0x386d0e,'request\x20sent');logger[_0x00fd('0x9')](_0x00fd('0xa'),_0x386d0e,'request\x20sent',JSON[_0x00fd('0xb')](_0x492dfa));if(_0x492dfa[_0x00fd('0xc')]){if(_0x492dfa[_0x00fd('0xc')][_0x00fd('0xd')]===0x1f4){logger[_0x00fd('0xc')](_0x00fd('0x8'),_0x386d0e,_0x492dfa['error'][_0x00fd('0xe')]);return _0x4e9bf9(_0x492dfa[_0x00fd('0xc')][_0x00fd('0xe')]);}logger[_0x00fd('0xc')](_0x00fd('0x8'),_0x386d0e,_0x492dfa['error'][_0x00fd('0xe')]);return _0x50a052(_0x492dfa['error']['message']);}else{logger['info'](_0x00fd('0x8'),_0x386d0e,_0x00fd('0xf'));_0x50a052(_0x492dfa[_0x00fd('0x10')][_0x00fd('0xe')]);}})[_0x00fd('0x11')](function(_0x1afd9e){logger[_0x00fd('0xc')](_0x00fd('0x8'),_0x386d0e,_0x1afd9e);_0x4e9bf9(_0x1afd9e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 8bb2b2d..464bb5a 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 _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(_0x68fd87,_0x17f037){var _0x559470=function(_0x1e7b0b){while(--_0x1e7b0b){_0x68fd87['push'](_0x68fd87['shift']());}};_0x559470(++_0x17f037);}(_0x7217,0x19e));var _0x7721=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x7217[_0x54d4fe];return _0x1ab5bb;};'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 +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(_0x4e18bb,_0x2b28df){var _0x5ebf1f=function(_0x2f43cc){while(--_0x2f43cc){_0x4e18bb['push'](_0x4e18bb['shift']());}};_0x5ebf1f(++_0x2b28df);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0x5fc3[_0x4f3c9b];return _0x84e58a;};'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 diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index c87965e..9a05499 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 _0x60d7=['TEXT','sequelize','exports','name'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0x60d7,0x139));var _0x760d=function(_0x518ea4,_0x346875){_0x518ea4=_0x518ea4-0x0;var _0x280fd2=_0x60d7[_0x518ea4];return _0x280fd2;};'use strict';var Sequelize=require(_0x760d('0x0'));module[_0x760d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x760d('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x760d('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x84cd=['exports','STRING','name','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84cd,0x1e0));var _0xd84c=function(_0x199c8f,_0x1db1e8){_0x199c8f=_0x199c8f-0x0;var _0x2c2e4d=_0x84cd[_0x199c8f];return _0x2c2e4d;};'use strict';var Sequelize=require('sequelize');module[_0xd84c('0x0')]={'name':{'type':Sequelize[_0xd84c('0x1')],'allowNull':![],'unique':_0xd84c('0x2')},'table':{'type':Sequelize[_0xd84c('0x1')]},'metric':{'type':Sequelize[_0xd84c('0x3')]},'description':{'type':Sequelize[_0xd84c('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 90283e8..3943a57 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 _0xac67=['status','json','offset','set','Content-Range','apply','reject','update','destroy','then','get','Metrics','UserProfileResource','end','error','name','send','index','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','VIRTUAL','filter','merge','options','count','findAll','catch','show','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','html-pdf','eml-format','rimraf','zip-dir','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x26bafe,_0x13e506){var _0x307879=function(_0x5a1548){while(--_0x5a1548){_0x26bafe['push'](_0x26bafe['shift']());}};_0x307879(++_0x13e506);}(_0xac67,0xd5));var _0x7ac6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xac67[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0x7ac6('0x0'));var emlformat=require(_0x7ac6('0x1'));var rimraf=require(_0x7ac6('0x2'));var zipdir=require(_0x7ac6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7ac6('0x4'));var util=require(_0x7ac6('0x5'));var path=require('path');var sox=require(_0x7ac6('0x6'));var csv=require(_0x7ac6('0x7'));var ejs=require(_0x7ac6('0x8'));var fs=require('fs');var _=require(_0x7ac6('0x9'));var squel=require(_0x7ac6('0xa'));var crypto=require(_0x7ac6('0xb'));var jsforce=require(_0x7ac6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7ac6('0x7'));var querystring=require(_0x7ac6('0xd'));var Papa=require('papaparse');var Redis=require(_0x7ac6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7ac6('0xf'));var as=require(_0x7ac6('0x10'));var hardwareService=require(_0x7ac6('0x11'));var logger=require(_0x7ac6('0x12'))(_0x7ac6('0x13'));var utils=require(_0x7ac6('0x14'));var config=require(_0x7ac6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ac6('0x16'))['db'];function respondWithStatusCode(_0x45395f,_0x18d246){_0x18d246=_0x18d246||0xcc;return function(_0x2e201e){if(_0x2e201e){return _0x45395f[_0x7ac6('0x17')](_0x18d246);}return _0x45395f[_0x7ac6('0x18')](_0x18d246)['end']();};}function respondWithResult(_0xb8e4c8,_0x5f2137){_0x5f2137=_0x5f2137||0xc8;return function(_0xfd1a7a){if(_0xfd1a7a){return _0xb8e4c8[_0x7ac6('0x18')](_0x5f2137)[_0x7ac6('0x19')](_0xfd1a7a);}};}function respondWithFilteredResult(_0x287b44,_0x8944e3){return function(_0x55b167){if(_0x55b167){var _0x417c9e=_0x55b167['count'],_0x6bcc1c=_0x8944e3[_0x7ac6('0x1a')],_0x5848bb=_0x8944e3['offset']+_0x8944e3['limit'],_0xafd0e;if(_0x5848bb>=_0x417c9e){_0x5848bb=_0x417c9e;_0xafd0e=0xc8;}else{_0xafd0e=0xce;}_0x287b44[_0x7ac6('0x18')](_0xafd0e);return _0x287b44[_0x7ac6('0x1b')](_0x7ac6('0x1c'),_0x6bcc1c+'-'+_0x5848bb+'/'+_0x417c9e)['json'](_0x55b167);}return null;};}function patchUpdates(_0x180156){return function(_0x2872fc){try{jsonpatch[_0x7ac6('0x1d')](_0x2872fc,_0x180156,!![]);}catch(_0x57219f){return BPromise[_0x7ac6('0x1e')](_0x57219f);}return _0x2872fc['save']();};}function saveUpdates(_0x57a08c,_0x58be1e){return function(_0x1cd565){if(_0x1cd565){return _0x1cd565[_0x7ac6('0x1f')](_0x57a08c)['then'](function(_0x44cfba){return _0x44cfba;});}return null;};}function removeEntity(_0x424295,_0xac82b3){return function(_0x575808){if(_0x575808){return _0x575808[_0x7ac6('0x20')]()[_0x7ac6('0x21')](function(){var _0x45a93e=_0x575808[_0x7ac6('0x22')]({'plain':!![]});var _0x1f6e89=_0x7ac6('0x23');return db[_0x7ac6('0x24')][_0x7ac6('0x20')]({'where':{'type':_0x1f6e89,'resourceId':_0x45a93e['id']}})['then'](function(){return _0x575808;});})['then'](function(){_0x424295[_0x7ac6('0x18')](0xcc)[_0x7ac6('0x25')]();});}};}function handleEntityNotFound(_0x3fe581,_0x4f579b){return function(_0x1acaf6){if(!_0x1acaf6){_0x3fe581[_0x7ac6('0x17')](0x194);}return _0x1acaf6;};}function handleError(_0x57aa99,_0x2d6407){_0x2d6407=_0x2d6407||0x1f4;return function(_0x55396b){logger[_0x7ac6('0x26')](_0x55396b['stack']);if(_0x55396b['name']){delete _0x55396b[_0x7ac6('0x27')];}_0x57aa99[_0x7ac6('0x18')](_0x2d6407)[_0x7ac6('0x28')](_0x55396b);};}exports[_0x7ac6('0x29')]=function(_0x38044a,_0x4b8e6d){var _0x1b6b95={},_0x297223={},_0xad6b66={'count':0x0,'rows':[]};var _0x1f7b94=_['map'](db[_0x7ac6('0x2a')][_0x7ac6('0x2b')],function(_0x7cdd46){return{'name':_0x7cdd46[_0x7ac6('0x2c')],'type':_0x7cdd46[_0x7ac6('0x2d')][_0x7ac6('0x2e')]};});_0x297223[_0x7ac6('0x2f')]=_['map'](_0x1f7b94,_0x7ac6('0x27'));_0x297223[_0x7ac6('0x30')]=_['keys'](_0x38044a[_0x7ac6('0x30')]);_0x297223['filters']=_['intersection'](_0x297223[_0x7ac6('0x2f')],_0x297223['query']);_0x1b6b95['attributes']=_['intersection'](_0x297223[_0x7ac6('0x2f')],qs[_0x7ac6('0x31')](_0x38044a[_0x7ac6('0x30')]['fields']));_0x1b6b95[_0x7ac6('0x32')]=_0x1b6b95[_0x7ac6('0x32')][_0x7ac6('0x33')]?_0x1b6b95[_0x7ac6('0x32')]:_0x297223['model'];if(!_0x38044a['query'][_0x7ac6('0x34')](_0x7ac6('0x35'))){_0x1b6b95[_0x7ac6('0x36')]=qs[_0x7ac6('0x36')](_0x38044a[_0x7ac6('0x30')]['limit']);_0x1b6b95[_0x7ac6('0x1a')]=qs[_0x7ac6('0x1a')](_0x38044a[_0x7ac6('0x30')]['offset']);}_0x1b6b95[_0x7ac6('0x37')]=qs[_0x7ac6('0x38')](_0x38044a[_0x7ac6('0x30')][_0x7ac6('0x38')]);_0x1b6b95[_0x7ac6('0x39')]=qs[_0x7ac6('0x3a')](_['pick'](_0x38044a[_0x7ac6('0x30')],_0x297223[_0x7ac6('0x3a')]),_0x1f7b94);if(_0x38044a['query']['filter']){_0x1b6b95['where']=_['merge'](_0x1b6b95[_0x7ac6('0x39')],{'$or':_['map'](_0x1f7b94,function(_0x5ed251){if(_0x5ed251[_0x7ac6('0x2d')]!==_0x7ac6('0x3b')){var _0x33cba3={};_0x33cba3[_0x5ed251[_0x7ac6('0x27')]]={'$like':'%'+_0x38044a[_0x7ac6('0x30')][_0x7ac6('0x3c')]+'%'};return _0x33cba3;}})});}_0x1b6b95=_[_0x7ac6('0x3d')]({},_0x1b6b95,_0x38044a[_0x7ac6('0x3e')]);var _0x39dc0f={'where':_0x1b6b95[_0x7ac6('0x39')]};return db[_0x7ac6('0x2a')][_0x7ac6('0x3f')](_0x39dc0f)['then'](function(_0x1c9818){_0xad6b66[_0x7ac6('0x3f')]=_0x1c9818;if(_0x38044a['query']['includeAll']){_0x1b6b95['include']=[{'all':!![]}];}return db[_0x7ac6('0x2a')][_0x7ac6('0x40')](_0x1b6b95);})[_0x7ac6('0x21')](function(_0x3857c7){_0xad6b66['rows']=_0x3857c7;return _0xad6b66;})[_0x7ac6('0x21')](respondWithFilteredResult(_0x4b8e6d,_0x1b6b95))[_0x7ac6('0x41')](handleError(_0x4b8e6d,null));};exports[_0x7ac6('0x42')]=function(_0x25d0a6,_0x226491){var _0x4464ef={'raw':!![],'where':{'id':_0x25d0a6['params']['id']}},_0x1caf50={};_0x1caf50[_0x7ac6('0x2f')]=_[_0x7ac6('0x43')](db[_0x7ac6('0x2a')][_0x7ac6('0x2b')]);_0x1caf50[_0x7ac6('0x30')]=_['keys'](_0x25d0a6['query']);_0x1caf50[_0x7ac6('0x3a')]=_['intersection'](_0x1caf50['model'],_0x1caf50[_0x7ac6('0x30')]);_0x4464ef['attributes']=_['intersection'](_0x1caf50[_0x7ac6('0x2f')],qs['fields'](_0x25d0a6[_0x7ac6('0x30')]['fields']));_0x4464ef[_0x7ac6('0x32')]=_0x4464ef[_0x7ac6('0x32')][_0x7ac6('0x33')]?_0x4464ef[_0x7ac6('0x32')]:_0x1caf50[_0x7ac6('0x2f')];if(_0x25d0a6[_0x7ac6('0x30')]['includeAll']){_0x4464ef[_0x7ac6('0x44')]=[{'all':!![]}];}_0x4464ef=_['merge']({},_0x4464ef,_0x25d0a6['options']);return db[_0x7ac6('0x2a')][_0x7ac6('0x45')](_0x4464ef)['then'](handleEntityNotFound(_0x226491,null))[_0x7ac6('0x21')](respondWithResult(_0x226491,null))['catch'](handleError(_0x226491,null));};exports[_0x7ac6('0x46')]=function(_0x34a202,_0xd4016b){return db[_0x7ac6('0x2a')][_0x7ac6('0x46')](_0x34a202[_0x7ac6('0x47')],{})['then'](function(_0x286e67){var _0x1f1df2=_0x34a202[_0x7ac6('0x48')]['get']({'plain':!![]});if(!_0x1f1df2)throw new Error(_0x7ac6('0x49'));if(_0x1f1df2[_0x7ac6('0x4a')]===_0x7ac6('0x48')){var _0x211cd5=_0x286e67[_0x7ac6('0x22')]({'plain':!![]});var _0x14f54d=_0x7ac6('0x23');return db[_0x7ac6('0x4b')][_0x7ac6('0x45')]({'where':{'name':_0x14f54d,'userProfileId':_0x1f1df2[_0x7ac6('0x4c')]},'raw':!![]})['then'](function(_0xee4c0c){if(_0xee4c0c&&_0xee4c0c[_0x7ac6('0x4d')]===0x0){return db[_0x7ac6('0x24')][_0x7ac6('0x46')]({'name':_0x211cd5['name'],'resourceId':_0x211cd5['id'],'type':_0xee4c0c[_0x7ac6('0x27')],'sectionId':_0xee4c0c['id']},{})[_0x7ac6('0x21')](function(){return _0x286e67;});}else{return _0x286e67;}})[_0x7ac6('0x41')](function(_0xeda8d2){logger[_0x7ac6('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xeda8d2);throw _0xeda8d2;});}return _0x286e67;})[_0x7ac6('0x21')](respondWithResult(_0xd4016b,0xc9))[_0x7ac6('0x41')](handleError(_0xd4016b,null));};exports['update']=function(_0xf2dca6,_0x85ac84){if(_0xf2dca6[_0x7ac6('0x47')]['id']){delete _0xf2dca6['body']['id'];}return db[_0x7ac6('0x2a')][_0x7ac6('0x45')]({'where':{'id':_0xf2dca6[_0x7ac6('0x4e')]['id']}})[_0x7ac6('0x21')](handleEntityNotFound(_0x85ac84,null))[_0x7ac6('0x21')](saveUpdates(_0xf2dca6[_0x7ac6('0x47')],null))['then'](respondWithResult(_0x85ac84,null))[_0x7ac6('0x41')](handleError(_0x85ac84,null));};exports[_0x7ac6('0x20')]=function(_0x1aa299,_0x3a43c1){return db[_0x7ac6('0x2a')][_0x7ac6('0x45')]({'where':{'id':_0x1aa299['params']['id']}})[_0x7ac6('0x21')](handleEntityNotFound(_0x3a43c1,null))[_0x7ac6('0x21')](removeEntity(_0x3a43c1,null))[_0x7ac6('0x41')](handleError(_0x3a43c1,null));}; \ No newline at end of file +var _0x4db7=['key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','count','includeAll','include','findAll','rows','catch','params','keys','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','autoAssociation','error','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','save','update','then','destroy','Metrics','UserProfileResource','stack','name','send','index','AnalyticMetric','fieldName','type'];(function(_0x59230a,_0x5be5f0){var _0x383d36=function(_0x5d39a1){while(--_0x5d39a1){_0x59230a['push'](_0x59230a['shift']());}};_0x383d36(++_0x5be5f0);}(_0x4db7,0x74));var _0x74db=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x4db7[_0x2be8c2];return _0x97f531;};'use strict';var pdf=require(_0x74db('0x0'));var emlformat=require(_0x74db('0x1'));var rimraf=require(_0x74db('0x2'));var zipdir=require(_0x74db('0x3'));var jsonpatch=require(_0x74db('0x4'));var rp=require(_0x74db('0x5'));var moment=require(_0x74db('0x6'));var BPromise=require(_0x74db('0x7'));var Mustache=require(_0x74db('0x8'));var util=require('util');var path=require(_0x74db('0x9'));var sox=require('sox');var csv=require(_0x74db('0xa'));var ejs=require(_0x74db('0xb'));var fs=require('fs');var _=require(_0x74db('0xc'));var squel=require('squel');var crypto=require(_0x74db('0xd'));var jsforce=require(_0x74db('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x74db('0xa'));var querystring=require(_0x74db('0xf'));var Papa=require(_0x74db('0x10'));var Redis=require(_0x74db('0x11'));var authService=require(_0x74db('0x12'));var qs=require(_0x74db('0x13'));var as=require(_0x74db('0x14'));var hardwareService=require(_0x74db('0x15'));var logger=require(_0x74db('0x16'))(_0x74db('0x17'));var utils=require(_0x74db('0x18'));var config=require(_0x74db('0x19'));var licenseUtil=require(_0x74db('0x1a'));var db=require(_0x74db('0x1b'))['db'];function respondWithStatusCode(_0x39950e,_0x2abcb0){_0x2abcb0=_0x2abcb0||0xcc;return function(_0x224035){if(_0x224035){return _0x39950e[_0x74db('0x1c')](_0x2abcb0);}return _0x39950e[_0x74db('0x1d')](_0x2abcb0)[_0x74db('0x1e')]();};}function respondWithResult(_0xa971ea,_0x2551b0){_0x2551b0=_0x2551b0||0xc8;return function(_0xe004b7){if(_0xe004b7){return _0xa971ea[_0x74db('0x1d')](_0x2551b0)[_0x74db('0x1f')](_0xe004b7);}};}function respondWithFilteredResult(_0x124b4f,_0x525d56){return function(_0x4c9bf4){if(_0x4c9bf4){var _0x5a0957=_0x4c9bf4['count'],_0x2da10d=_0x525d56[_0x74db('0x20')],_0x376efc=_0x525d56[_0x74db('0x20')]+_0x525d56['limit'],_0x7a40cf;if(_0x376efc>=_0x5a0957){_0x376efc=_0x5a0957;_0x7a40cf=0xc8;}else{_0x7a40cf=0xce;}_0x124b4f[_0x74db('0x1d')](_0x7a40cf);return _0x124b4f['set'](_0x74db('0x21'),_0x2da10d+'-'+_0x376efc+'/'+_0x5a0957)[_0x74db('0x1f')](_0x4c9bf4);}return null;};}function patchUpdates(_0x4aa5d6){return function(_0x1a5ffd){try{jsonpatch[_0x74db('0x22')](_0x1a5ffd,_0x4aa5d6,!![]);}catch(_0x36b3bb){return BPromise['reject'](_0x36b3bb);}return _0x1a5ffd[_0x74db('0x23')]();};}function saveUpdates(_0x5d13ed,_0x319030){return function(_0x3f00bf){if(_0x3f00bf){return _0x3f00bf[_0x74db('0x24')](_0x5d13ed)[_0x74db('0x25')](function(_0x2aa2aa){return _0x2aa2aa;});}return null;};}function removeEntity(_0x4e52c4,_0x327da7){return function(_0x2d1198){if(_0x2d1198){return _0x2d1198[_0x74db('0x26')]()[_0x74db('0x25')](function(){var _0x214f0e=_0x2d1198['get']({'plain':!![]});var _0x3865ab=_0x74db('0x27');return db[_0x74db('0x28')][_0x74db('0x26')]({'where':{'type':_0x3865ab,'resourceId':_0x214f0e['id']}})['then'](function(){return _0x2d1198;});})[_0x74db('0x25')](function(){_0x4e52c4[_0x74db('0x1d')](0xcc)[_0x74db('0x1e')]();});}};}function handleEntityNotFound(_0x385a93,_0x875586){return function(_0x357d61){if(!_0x357d61){_0x385a93[_0x74db('0x1c')](0x194);}return _0x357d61;};}function handleError(_0x29a6c9,_0x33f8a6){_0x33f8a6=_0x33f8a6||0x1f4;return function(_0x13166a){logger['error'](_0x13166a[_0x74db('0x29')]);if(_0x13166a['name']){delete _0x13166a[_0x74db('0x2a')];}_0x29a6c9[_0x74db('0x1d')](_0x33f8a6)[_0x74db('0x2b')](_0x13166a);};}exports[_0x74db('0x2c')]=function(_0x466dd0,_0x47c805){var _0x57cd5e={},_0x59f2ee={},_0x48ab8c={'count':0x0,'rows':[]};var _0x44948f=_['map'](db[_0x74db('0x2d')]['rawAttributes'],function(_0x33e7d7){return{'name':_0x33e7d7[_0x74db('0x2e')],'type':_0x33e7d7[_0x74db('0x2f')][_0x74db('0x30')]};});_0x59f2ee[_0x74db('0x31')]=_[_0x74db('0x32')](_0x44948f,_0x74db('0x2a'));_0x59f2ee[_0x74db('0x33')]=_['keys'](_0x466dd0[_0x74db('0x33')]);_0x59f2ee[_0x74db('0x34')]=_[_0x74db('0x35')](_0x59f2ee[_0x74db('0x31')],_0x59f2ee[_0x74db('0x33')]);_0x57cd5e[_0x74db('0x36')]=_[_0x74db('0x35')](_0x59f2ee[_0x74db('0x31')],qs[_0x74db('0x37')](_0x466dd0[_0x74db('0x33')][_0x74db('0x37')]));_0x57cd5e[_0x74db('0x36')]=_0x57cd5e[_0x74db('0x36')][_0x74db('0x38')]?_0x57cd5e['attributes']:_0x59f2ee['model'];if(!_0x466dd0[_0x74db('0x33')][_0x74db('0x39')](_0x74db('0x3a'))){_0x57cd5e[_0x74db('0x3b')]=qs[_0x74db('0x3b')](_0x466dd0[_0x74db('0x33')]['limit']);_0x57cd5e[_0x74db('0x20')]=qs[_0x74db('0x20')](_0x466dd0[_0x74db('0x33')]['offset']);}_0x57cd5e[_0x74db('0x3c')]=qs['sort'](_0x466dd0[_0x74db('0x33')][_0x74db('0x3d')]);_0x57cd5e[_0x74db('0x3e')]=qs[_0x74db('0x34')](_['pick'](_0x466dd0[_0x74db('0x33')],_0x59f2ee[_0x74db('0x34')]),_0x44948f);if(_0x466dd0[_0x74db('0x33')]['filter']){_0x57cd5e['where']=_['merge'](_0x57cd5e[_0x74db('0x3e')],{'$or':_[_0x74db('0x32')](_0x44948f,function(_0x38537b){if(_0x38537b[_0x74db('0x2f')]!=='VIRTUAL'){var _0x479047={};_0x479047[_0x38537b[_0x74db('0x2a')]]={'$like':'%'+_0x466dd0[_0x74db('0x33')]['filter']+'%'};return _0x479047;}})});}_0x57cd5e=_[_0x74db('0x3f')]({},_0x57cd5e,_0x466dd0['options']);var _0xec7c2c={'where':_0x57cd5e['where']};return db[_0x74db('0x2d')][_0x74db('0x40')](_0xec7c2c)[_0x74db('0x25')](function(_0x129eb2){_0x48ab8c[_0x74db('0x40')]=_0x129eb2;if(_0x466dd0[_0x74db('0x33')][_0x74db('0x41')]){_0x57cd5e[_0x74db('0x42')]=[{'all':!![]}];}return db[_0x74db('0x2d')][_0x74db('0x43')](_0x57cd5e);})['then'](function(_0xd8cc55){_0x48ab8c[_0x74db('0x44')]=_0xd8cc55;return _0x48ab8c;})[_0x74db('0x25')](respondWithFilteredResult(_0x47c805,_0x57cd5e))[_0x74db('0x45')](handleError(_0x47c805,null));};exports['show']=function(_0x15545f,_0x1ffc9d){var _0x25ac9a={'raw':!![],'where':{'id':_0x15545f[_0x74db('0x46')]['id']}},_0x5ea840={};_0x5ea840[_0x74db('0x31')]=_[_0x74db('0x47')](db[_0x74db('0x2d')]['rawAttributes']);_0x5ea840[_0x74db('0x33')]=_[_0x74db('0x47')](_0x15545f['query']);_0x5ea840[_0x74db('0x34')]=_[_0x74db('0x35')](_0x5ea840['model'],_0x5ea840[_0x74db('0x33')]);_0x25ac9a[_0x74db('0x36')]=_['intersection'](_0x5ea840[_0x74db('0x31')],qs[_0x74db('0x37')](_0x15545f[_0x74db('0x33')][_0x74db('0x37')]));_0x25ac9a[_0x74db('0x36')]=_0x25ac9a['attributes']['length']?_0x25ac9a[_0x74db('0x36')]:_0x5ea840['model'];if(_0x15545f[_0x74db('0x33')][_0x74db('0x41')]){_0x25ac9a[_0x74db('0x42')]=[{'all':!![]}];}_0x25ac9a=_[_0x74db('0x3f')]({},_0x25ac9a,_0x15545f[_0x74db('0x48')]);return db[_0x74db('0x2d')][_0x74db('0x49')](_0x25ac9a)[_0x74db('0x25')](handleEntityNotFound(_0x1ffc9d,null))[_0x74db('0x25')](respondWithResult(_0x1ffc9d,null))[_0x74db('0x45')](handleError(_0x1ffc9d,null));};exports[_0x74db('0x4a')]=function(_0x1fa90a,_0x165d3a){return db[_0x74db('0x2d')][_0x74db('0x4a')](_0x1fa90a['body'],{})[_0x74db('0x25')](function(_0x1f9ecd){var _0x4f8afd=_0x1fa90a['user']['get']({'plain':!![]});if(!_0x4f8afd)throw new Error(_0x74db('0x4b'));if(_0x4f8afd[_0x74db('0x4c')]===_0x74db('0x4d')){var _0x20394e=_0x1f9ecd[_0x74db('0x4e')]({'plain':!![]});var _0x386a1c='Metrics';return db['UserProfileSection'][_0x74db('0x49')]({'where':{'name':_0x386a1c,'userProfileId':_0x4f8afd['userProfileId']},'raw':!![]})[_0x74db('0x25')](function(_0x1b2a70){if(_0x1b2a70&&_0x1b2a70[_0x74db('0x4f')]===0x0){return db[_0x74db('0x28')]['create']({'name':_0x20394e[_0x74db('0x2a')],'resourceId':_0x20394e['id'],'type':_0x1b2a70['name'],'sectionId':_0x1b2a70['id']},{})[_0x74db('0x25')](function(){return _0x1f9ecd;});}else{return _0x1f9ecd;}})[_0x74db('0x45')](function(_0x7d898b){logger[_0x74db('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7d898b);throw _0x7d898b;});}return _0x1f9ecd;})['then'](respondWithResult(_0x165d3a,0xc9))[_0x74db('0x45')](handleError(_0x165d3a,null));};exports[_0x74db('0x24')]=function(_0x174f35,_0x3d5ba8){if(_0x174f35[_0x74db('0x51')]['id']){delete _0x174f35[_0x74db('0x51')]['id'];}return db[_0x74db('0x2d')][_0x74db('0x49')]({'where':{'id':_0x174f35[_0x74db('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d5ba8,null))[_0x74db('0x25')](saveUpdates(_0x174f35['body'],null))[_0x74db('0x25')](respondWithResult(_0x3d5ba8,null))[_0x74db('0x45')](handleError(_0x3d5ba8,null));};exports[_0x74db('0x26')]=function(_0x9b4421,_0x4680d9){return db['AnalyticMetric'][_0x74db('0x49')]({'where':{'id':_0x9b4421[_0x74db('0x46')]['id']}})[_0x74db('0x25')](handleEntityNotFound(_0x4680d9,null))[_0x74db('0x25')](removeEntity(_0x4680d9,null))['catch'](handleError(_0x4680d9,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 501ad89..67b02f2 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 _0x4d9f=['exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','path','../../config/environment','./analyticMetric.attributes'];(function(_0x24d5bd,_0x2d0031){var _0x592a56=function(_0x27de7f){while(--_0x27de7f){_0x24d5bd['push'](_0x24d5bd['shift']());}};_0x592a56(++_0x2d0031);}(_0x4d9f,0x94));var _0xf4d9=function(_0x3c4165,_0x2fe9dd){_0x3c4165=_0x3c4165-0x0;var _0x5006c7=_0x4d9f[_0x3c4165];return _0x5006c7;};'use strict';var _=require(_0xf4d9('0x0'));var util=require(_0xf4d9('0x1'));var logger=require(_0xf4d9('0x2'))(_0xf4d9('0x3'));var moment=require(_0xf4d9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4d9('0x5'));var rimraf=require('rimraf');var config=require(_0xf4d9('0x6'));var attributes=require(_0xf4d9('0x7'));module[_0xf4d9('0x8')]=function(_0x4a69dd,_0x158d08){return _0x4a69dd[_0xf4d9('0x9')](_0xf4d9('0xa'),attributes,{'tableName':_0xf4d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac72=['path','../../config/environment','exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4632c2,_0x385d92){var _0x3d969c=function(_0x5d5222){while(--_0x5d5222){_0x4632c2['push'](_0x4632c2['shift']());}};_0x3d969c(++_0x385d92);}(_0xac72,0x186));var _0x2ac7=function(_0x251b4b,_0x41d712){_0x251b4b=_0x251b4b-0x0;var _0x4c57ea=_0xac72[_0x251b4b];return _0x4c57ea;};'use strict';var _=require(_0x2ac7('0x0'));var util=require(_0x2ac7('0x1'));var logger=require(_0x2ac7('0x2'))(_0x2ac7('0x3'));var moment=require(_0x2ac7('0x4'));var BPromise=require(_0x2ac7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ac7('0x6'));var rimraf=require('rimraf');var config=require(_0x2ac7('0x7'));var attributes=require('./analyticMetric.attributes');module[_0x2ac7('0x8')]=function(_0x231225,_0x538123){return _0x231225[_0x2ac7('0x9')]('AnalyticMetric',attributes,{'tableName':_0x2ac7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 806bea3..3e84bd0 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 _0xa9e6=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','AnalyticMetric,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','bluebird'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0xa9e6,0x1bd));var _0x6a9e=function(_0x467a4f,_0x2fa429){_0x467a4f=_0x467a4f-0x0;var _0x3679ea=_0xa9e6[_0x467a4f];return _0x3679ea;};'use strict';var _=require(_0x6a9e('0x0'));var util=require(_0x6a9e('0x1'));var moment=require('moment');var BPromise=require(_0x6a9e('0x2'));var rs=require(_0x6a9e('0x3'));var fs=require('fs');var Redis=require(_0x6a9e('0x4'));var db=require(_0x6a9e('0x5'))['db'];var utils=require(_0x6a9e('0x6'));var logger=require('../../config/logger')(_0x6a9e('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a9e('0x8'));var client=jayson[_0x6a9e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31e07f,_0x13042e,_0x2149b9){return new BPromise(function(_0xa5faea,_0x5ec3d3){return client['request'](_0x31e07f,_0x2149b9)['then'](function(_0x3479f6){logger['info'](_0x6a9e('0xa'),_0x13042e,_0x6a9e('0xb'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x13042e,_0x6a9e('0xb'),JSON['stringify'](_0x3479f6));if(_0x3479f6[_0x6a9e('0xc')]){if(_0x3479f6[_0x6a9e('0xc')][_0x6a9e('0xd')]===0x1f4){logger[_0x6a9e('0xc')](_0x6a9e('0xa'),_0x13042e,_0x3479f6[_0x6a9e('0xc')][_0x6a9e('0xe')]);return _0x5ec3d3(_0x3479f6[_0x6a9e('0xc')][_0x6a9e('0xe')]);}logger['error'](_0x6a9e('0xa'),_0x13042e,_0x3479f6[_0x6a9e('0xc')][_0x6a9e('0xe')]);return _0xa5faea(_0x3479f6[_0x6a9e('0xc')]['message']);}else{logger['info'](_0x6a9e('0xa'),_0x13042e,_0x6a9e('0xb'));_0xa5faea(_0x3479f6['result']['message']);}})[_0x6a9e('0xf')](function(_0x4ae8e6){logger[_0x6a9e('0xc')](_0x6a9e('0xa'),_0x13042e,_0x4ae8e6);_0x5ec3d3(_0x4ae8e6);});});} \ No newline at end of file +var _0x72eb=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','info','request\x20sent','debug'];(function(_0xd40ade,_0x49bf07){var _0xc7bc65=function(_0x44dd6f){while(--_0x44dd6f){_0xd40ade['push'](_0xd40ade['shift']());}};_0xc7bc65(++_0x49bf07);}(_0x72eb,0x15b));var _0xb72e=function(_0x169f33,_0x26d892){_0x169f33=_0x169f33-0x0;var _0x4f0ce9=_0x72eb[_0x169f33];return _0x4f0ce9;};'use strict';var _=require(_0xb72e('0x0'));var util=require(_0xb72e('0x1'));var moment=require(_0xb72e('0x2'));var BPromise=require(_0xb72e('0x3'));var rs=require(_0xb72e('0x4'));var fs=require('fs');var Redis=require(_0xb72e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb72e('0x6'));var logger=require(_0xb72e('0x7'))(_0xb72e('0x8'));var config=require(_0xb72e('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x285bb9,_0x2744ed,_0x5115ab){return new BPromise(function(_0x428edd,_0xf9e985){return client['request'](_0x285bb9,_0x5115ab)['then'](function(_0x4a7c68){logger[_0xb72e('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x2744ed,_0xb72e('0xb'));logger[_0xb72e('0xc')](_0xb72e('0xd'),_0x2744ed,_0xb72e('0xb'),JSON[_0xb72e('0xe')](_0x4a7c68));if(_0x4a7c68[_0xb72e('0xf')]){if(_0x4a7c68['error'][_0xb72e('0x10')]===0x1f4){logger[_0xb72e('0xf')](_0xb72e('0x11'),_0x2744ed,_0x4a7c68[_0xb72e('0xf')]['message']);return _0xf9e985(_0x4a7c68['error']['message']);}logger[_0xb72e('0xf')](_0xb72e('0x11'),_0x2744ed,_0x4a7c68[_0xb72e('0xf')][_0xb72e('0x12')]);return _0x428edd(_0x4a7c68[_0xb72e('0xf')][_0xb72e('0x12')]);}else{logger[_0xb72e('0xa')](_0xb72e('0x11'),_0x2744ed,_0xb72e('0xb'));_0x428edd(_0x4a7c68['result'][_0xb72e('0x12')]);}})[_0xb72e('0x13')](function(_0x4bca7f){logger[_0xb72e('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x2744ed,_0x4bca7f);_0xf9e985(_0x4bca7f);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 6d5ca6c..8861dfa 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 _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x22ef24,_0x3538e5){var _0x20c3a5=function(_0x498877){while(--_0x498877){_0x22ef24['push'](_0x22ef24['shift']());}};_0x20c3a5(++_0x3538e5);}(_0x524e,0x15e));var _0xe524=function(_0x42d4a7,_0x492dc5){_0x42d4a7=_0x42d4a7-0x0;var _0x1d1ffb=_0x524e[_0x42d4a7];return _0x1d1ffb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file +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(_0x21ba39,_0x413046){var _0x7a1e4f=function(_0x734831){while(--_0x734831){_0x21ba39['push'](_0x21ba39['shift']());}};_0x7a1e4f(++_0x413046);}(_0x2542,0x169));var _0x2254=function(_0x40c2fe,_0x560efc){_0x40c2fe=_0x40c2fe-0x0;var _0x215126=_0x2542[_0x40c2fe];return _0x215126;};'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 diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 74dea06..352a84b 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 _0x4ffc=['sequelize'];(function(_0x25f686,_0x199629){var _0x54ad10=function(_0x1f9083){while(--_0x1f9083){_0x25f686['push'](_0x25f686['shift']());}};_0x54ad10(++_0x199629);}(_0x4ffc,0x99));var _0xc4ff=function(_0x182fcb,_0x2b980a){_0x182fcb=_0x182fcb-0x0;var _0x33238f=_0x4ffc[_0x182fcb];return _0x33238f;};'use strict';var Sequelize=require(_0xc4ff('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x452a=['exports','sequelize'];(function(_0x9d11b3,_0x3c9d3a){var _0x14f25f=function(_0x5627cc){while(--_0x5627cc){_0x9d11b3['push'](_0x9d11b3['shift']());}};_0x14f25f(++_0x3c9d3a);}(_0x452a,0x12d));var _0xa452=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0x452a[_0x333fc8];return _0x432439;};'use strict';var Sequelize=require(_0xa452('0x0'));module[_0xa452('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 196ca09..1849fa1 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 _0xc15c=['offset','set','reject','save','update','then','error','stack','name','send','index','fieldName','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','count','includeAll','AnalyticTreeReport','findAll','rows','catch','show','params','keys','rawAttributes','include','options','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x28b440,_0x1b2b23){var _0x271fdd=function(_0x1cdbaf){while(--_0x1cdbaf){_0x28b440['push'](_0x28b440['shift']());}};_0x271fdd(++_0x1b2b23);}(_0xc15c,0x1f0));var _0xcc15=function(_0x2d360c,_0x264bf7){_0x2d360c=_0x2d360c-0x0;var _0x484589=_0xc15c[_0x2d360c];return _0x484589;};'use strict';var pdf=require(_0xcc15('0x0'));var emlformat=require(_0xcc15('0x1'));var rimraf=require(_0xcc15('0x2'));var zipdir=require(_0xcc15('0x3'));var jsonpatch=require(_0xcc15('0x4'));var rp=require(_0xcc15('0x5'));var moment=require(_0xcc15('0x6'));var BPromise=require(_0xcc15('0x7'));var Mustache=require(_0xcc15('0x8'));var util=require('util');var path=require(_0xcc15('0x9'));var sox=require(_0xcc15('0xa'));var csv=require(_0xcc15('0xb'));var ejs=require(_0xcc15('0xc'));var fs=require('fs');var _=require(_0xcc15('0xd'));var squel=require(_0xcc15('0xe'));var crypto=require('crypto');var jsforce=require(_0xcc15('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcc15('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcc15('0x10'));var qs=require(_0xcc15('0x11'));var as=require(_0xcc15('0x12'));var hardwareService=require(_0xcc15('0x13'));var logger=require(_0xcc15('0x14'))(_0xcc15('0x15'));var utils=require(_0xcc15('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcc15('0x17'));var db=require(_0xcc15('0x18'))['db'];function respondWithStatusCode(_0x1e3855,_0xf2306c){_0xf2306c=_0xf2306c||0xcc;return function(_0x11f103){if(_0x11f103){return _0x1e3855[_0xcc15('0x19')](_0xf2306c);}return _0x1e3855[_0xcc15('0x1a')](_0xf2306c)[_0xcc15('0x1b')]();};}function respondWithResult(_0x283a14,_0x678745){_0x678745=_0x678745||0xc8;return function(_0x3c89e4){if(_0x3c89e4){return _0x283a14['status'](_0x678745)[_0xcc15('0x1c')](_0x3c89e4);}};}function respondWithFilteredResult(_0x2ff4aa,_0x3ae435){return function(_0x25372a){if(_0x25372a){var _0x16c072=_0x25372a['count'],_0x29a761=_0x3ae435['offset'],_0x2f51c0=_0x3ae435[_0xcc15('0x1d')]+_0x3ae435['limit'],_0x822d5;if(_0x2f51c0>=_0x16c072){_0x2f51c0=_0x16c072;_0x822d5=0xc8;}else{_0x822d5=0xce;}_0x2ff4aa[_0xcc15('0x1a')](_0x822d5);return _0x2ff4aa[_0xcc15('0x1e')]('Content-Range',_0x29a761+'-'+_0x2f51c0+'/'+_0x16c072)[_0xcc15('0x1c')](_0x25372a);}return null;};}function patchUpdates(_0x42e366){return function(_0x38ba68){try{jsonpatch['apply'](_0x38ba68,_0x42e366,!![]);}catch(_0x3da106){return BPromise[_0xcc15('0x1f')](_0x3da106);}return _0x38ba68[_0xcc15('0x20')]();};}function saveUpdates(_0x3f371e,_0x5e4e37){return function(_0x46249f){if(_0x46249f){return _0x46249f[_0xcc15('0x21')](_0x3f371e)['then'](function(_0x191493){return _0x191493;});}return null;};}function removeEntity(_0x382aca,_0x2016dc){return function(_0x3420f1){if(_0x3420f1){return _0x3420f1['destroy']()[_0xcc15('0x22')](function(){_0x382aca[_0xcc15('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30b262,_0xfe5ef8){return function(_0x5206dc){if(!_0x5206dc){_0x30b262[_0xcc15('0x19')](0x194);}return _0x5206dc;};}function handleError(_0x5f06ba,_0x3f0567){_0x3f0567=_0x3f0567||0x1f4;return function(_0x96562c){logger[_0xcc15('0x23')](_0x96562c[_0xcc15('0x24')]);if(_0x96562c[_0xcc15('0x25')]){delete _0x96562c[_0xcc15('0x25')];}_0x5f06ba[_0xcc15('0x1a')](_0x3f0567)[_0xcc15('0x26')](_0x96562c);};}exports[_0xcc15('0x27')]=function(_0x411df4,_0x3add2c){var _0x1f8b46={},_0x3aafcd={},_0xe82c7b={'count':0x0,'rows':[]};var _0x24649e=_['map'](db['AnalyticTreeReport']['rawAttributes'],function(_0x4b5b26){return{'name':_0x4b5b26[_0xcc15('0x28')],'type':_0x4b5b26['type'][_0xcc15('0x29')]};});_0x3aafcd[_0xcc15('0x2a')]=_[_0xcc15('0x2b')](_0x24649e,_0xcc15('0x25'));_0x3aafcd[_0xcc15('0x2c')]=_['keys'](_0x411df4[_0xcc15('0x2c')]);_0x3aafcd['filters']=_[_0xcc15('0x2d')](_0x3aafcd[_0xcc15('0x2a')],_0x3aafcd[_0xcc15('0x2c')]);_0x1f8b46['attributes']=_[_0xcc15('0x2d')](_0x3aafcd[_0xcc15('0x2a')],qs[_0xcc15('0x2e')](_0x411df4[_0xcc15('0x2c')][_0xcc15('0x2e')]));_0x1f8b46[_0xcc15('0x2f')]=_0x1f8b46[_0xcc15('0x2f')][_0xcc15('0x30')]?_0x1f8b46[_0xcc15('0x2f')]:_0x3aafcd[_0xcc15('0x2a')];if(!_0x411df4[_0xcc15('0x2c')][_0xcc15('0x31')](_0xcc15('0x32'))){_0x1f8b46['limit']=qs[_0xcc15('0x33')](_0x411df4[_0xcc15('0x2c')]['limit']);_0x1f8b46[_0xcc15('0x1d')]=qs[_0xcc15('0x1d')](_0x411df4[_0xcc15('0x2c')]['offset']);}_0x1f8b46[_0xcc15('0x34')]=qs[_0xcc15('0x35')](_0x411df4[_0xcc15('0x2c')][_0xcc15('0x35')]);_0x1f8b46[_0xcc15('0x36')]=qs[_0xcc15('0x37')](_[_0xcc15('0x38')](_0x411df4[_0xcc15('0x2c')],_0x3aafcd[_0xcc15('0x37')]),_0x24649e);if(_0x411df4[_0xcc15('0x2c')][_0xcc15('0x39')]){_0x1f8b46['where']=_[_0xcc15('0x3a')](_0x1f8b46[_0xcc15('0x36')],{'$or':_[_0xcc15('0x2b')](_0x24649e,function(_0x48cde3){if(_0x48cde3['type']!=='VIRTUAL'){var _0x26380c={};_0x26380c[_0x48cde3['name']]={'$like':'%'+_0x411df4['query']['filter']+'%'};return _0x26380c;}})});}_0x1f8b46=_[_0xcc15('0x3a')]({},_0x1f8b46,_0x411df4['options']);var _0x4cc02f={'where':_0x1f8b46[_0xcc15('0x36')]};return db['AnalyticTreeReport'][_0xcc15('0x3b')](_0x4cc02f)[_0xcc15('0x22')](function(_0x2ad963){_0xe82c7b['count']=_0x2ad963;if(_0x411df4[_0xcc15('0x2c')][_0xcc15('0x3c')]){_0x1f8b46['include']=[{'all':!![]}];}return db[_0xcc15('0x3d')][_0xcc15('0x3e')](_0x1f8b46);})[_0xcc15('0x22')](function(_0x3c2dd6){_0xe82c7b[_0xcc15('0x3f')]=_0x3c2dd6;return _0xe82c7b;})['then'](respondWithFilteredResult(_0x3add2c,_0x1f8b46))[_0xcc15('0x40')](handleError(_0x3add2c,null));};exports[_0xcc15('0x41')]=function(_0x318711,_0x2767b3){var _0x43b1ac={'raw':!![],'where':{'id':_0x318711[_0xcc15('0x42')]['id']}},_0xf7a72e={};_0xf7a72e[_0xcc15('0x2a')]=_[_0xcc15('0x43')](db[_0xcc15('0x3d')][_0xcc15('0x44')]);_0xf7a72e[_0xcc15('0x2c')]=_[_0xcc15('0x43')](_0x318711[_0xcc15('0x2c')]);_0xf7a72e['filters']=_['intersection'](_0xf7a72e[_0xcc15('0x2a')],_0xf7a72e[_0xcc15('0x2c')]);_0x43b1ac[_0xcc15('0x2f')]=_[_0xcc15('0x2d')](_0xf7a72e['model'],qs['fields'](_0x318711[_0xcc15('0x2c')][_0xcc15('0x2e')]));_0x43b1ac[_0xcc15('0x2f')]=_0x43b1ac['attributes']['length']?_0x43b1ac[_0xcc15('0x2f')]:_0xf7a72e[_0xcc15('0x2a')];if(_0x318711[_0xcc15('0x2c')][_0xcc15('0x3c')]){_0x43b1ac[_0xcc15('0x45')]=[{'all':!![]}];}_0x43b1ac=_[_0xcc15('0x3a')]({},_0x43b1ac,_0x318711[_0xcc15('0x46')]);return db[_0xcc15('0x3d')][_0xcc15('0x47')](_0x43b1ac)[_0xcc15('0x22')](handleEntityNotFound(_0x2767b3,null))[_0xcc15('0x22')](respondWithResult(_0x2767b3,null))['catch'](handleError(_0x2767b3,null));};exports['create']=function(_0x160d5e,_0x16f92d){return db[_0xcc15('0x3d')][_0xcc15('0x48')](_0x160d5e[_0xcc15('0x49')],{})['then'](respondWithResult(_0x16f92d,0xc9))['catch'](handleError(_0x16f92d,null));};exports['update']=function(_0x46f161,_0x2c956d){if(_0x46f161[_0xcc15('0x49')]['id']){delete _0x46f161[_0xcc15('0x49')]['id'];}return db[_0xcc15('0x3d')][_0xcc15('0x47')]({'where':{'id':_0x46f161[_0xcc15('0x42')]['id']}})[_0xcc15('0x22')](handleEntityNotFound(_0x2c956d,null))[_0xcc15('0x22')](saveUpdates(_0x46f161[_0xcc15('0x49')],null))[_0xcc15('0x22')](respondWithResult(_0x2c956d,null))[_0xcc15('0x40')](handleError(_0x2c956d,null));};exports[_0xcc15('0x4a')]=function(_0x281f61,_0x47dbd8){return db[_0xcc15('0x3d')][_0xcc15('0x47')]({'where':{'id':_0x281f61[_0xcc15('0x42')]['id']}})[_0xcc15('0x22')](handleEntityNotFound(_0x47dbd8,null))['then'](removeEntity(_0x47dbd8,null))[_0xcc15('0x40')](handleError(_0x47dbd8,null));}; \ No newline at end of file +var _0xf5c5=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','index','AnalyticTreeReport','fieldName','type','key','map','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','intersection','params','find','html-pdf','eml-format','rimraf','zip-dir','mustache','ejs','squel','crypto','desk.js'];(function(_0x5cad4d,_0x7b9470){var _0x3c7cef=function(_0x5b372b){while(--_0x5b372b){_0x5cad4d['push'](_0x5cad4d['shift']());}};_0x3c7cef(++_0x7b9470);}(_0xf5c5,0x132));var _0x5f5c=function(_0x1de474,_0xa0ecb6){_0x1de474=_0x1de474-0x0;var _0x59f631=_0xf5c5[_0x1de474];return _0x59f631;};'use strict';var pdf=require(_0x5f5c('0x0'));var emlformat=require(_0x5f5c('0x1'));var rimraf=require(_0x5f5c('0x2'));var zipdir=require(_0x5f5c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5f5c('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5f5c('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5f5c('0x6'));var crypto=require(_0x5f5c('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x5f5c('0x8'));var toCsv=require(_0x5f5c('0x9'));var querystring=require('querystring');var Papa=require(_0x5f5c('0xa'));var Redis=require(_0x5f5c('0xb'));var authService=require(_0x5f5c('0xc'));var qs=require(_0x5f5c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f5c('0xe'));var logger=require('../../config/logger')(_0x5f5c('0xf'));var utils=require('../../config/utils');var config=require(_0x5f5c('0x10'));var licenseUtil=require(_0x5f5c('0x11'));var db=require(_0x5f5c('0x12'))['db'];function respondWithStatusCode(_0x672af9,_0x5e1840){_0x5e1840=_0x5e1840||0xcc;return function(_0x5589d4){if(_0x5589d4){return _0x672af9[_0x5f5c('0x13')](_0x5e1840);}return _0x672af9[_0x5f5c('0x14')](_0x5e1840)[_0x5f5c('0x15')]();};}function respondWithResult(_0x5ac72c,_0x55838e){_0x55838e=_0x55838e||0xc8;return function(_0x5b4ca4){if(_0x5b4ca4){return _0x5ac72c[_0x5f5c('0x14')](_0x55838e)[_0x5f5c('0x16')](_0x5b4ca4);}};}function respondWithFilteredResult(_0x11dc1e,_0x167bfa){return function(_0x1ee33b){if(_0x1ee33b){var _0x49fd70=_0x1ee33b[_0x5f5c('0x17')],_0x452264=_0x167bfa[_0x5f5c('0x18')],_0x2e4fef=_0x167bfa[_0x5f5c('0x18')]+_0x167bfa[_0x5f5c('0x19')],_0x354e74;if(_0x2e4fef>=_0x49fd70){_0x2e4fef=_0x49fd70;_0x354e74=0xc8;}else{_0x354e74=0xce;}_0x11dc1e[_0x5f5c('0x14')](_0x354e74);return _0x11dc1e['set'](_0x5f5c('0x1a'),_0x452264+'-'+_0x2e4fef+'/'+_0x49fd70)[_0x5f5c('0x16')](_0x1ee33b);}return null;};}function patchUpdates(_0x33cee3){return function(_0x14c666){try{jsonpatch['apply'](_0x14c666,_0x33cee3,!![]);}catch(_0x26cf73){return BPromise[_0x5f5c('0x1b')](_0x26cf73);}return _0x14c666[_0x5f5c('0x1c')]();};}function saveUpdates(_0x2f3a46,_0x240b52){return function(_0x23ec57){if(_0x23ec57){return _0x23ec57[_0x5f5c('0x1d')](_0x2f3a46)[_0x5f5c('0x1e')](function(_0x3d6466){return _0x3d6466;});}return null;};}function removeEntity(_0x5e4b61,_0x3c62d7){return function(_0xbb32eb){if(_0xbb32eb){return _0xbb32eb[_0x5f5c('0x1f')]()[_0x5f5c('0x1e')](function(){_0x5e4b61[_0x5f5c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc0d202,_0x427fc5){return function(_0x256c03){if(!_0x256c03){_0xc0d202[_0x5f5c('0x13')](0x194);}return _0x256c03;};}function handleError(_0x2df899,_0x3bd8f7){_0x3bd8f7=_0x3bd8f7||0x1f4;return function(_0x1446e1){logger[_0x5f5c('0x20')](_0x1446e1[_0x5f5c('0x21')]);if(_0x1446e1['name']){delete _0x1446e1[_0x5f5c('0x22')];}_0x2df899[_0x5f5c('0x14')](_0x3bd8f7)['send'](_0x1446e1);};}exports[_0x5f5c('0x23')]=function(_0x24b73c,_0x26038f){var _0x393a17={},_0x3f321a={},_0x4ba624={'count':0x0,'rows':[]};var _0x1ce1d4=_['map'](db[_0x5f5c('0x24')]['rawAttributes'],function(_0x13241e){return{'name':_0x13241e[_0x5f5c('0x25')],'type':_0x13241e[_0x5f5c('0x26')][_0x5f5c('0x27')]};});_0x3f321a['model']=_[_0x5f5c('0x28')](_0x1ce1d4,_0x5f5c('0x22'));_0x3f321a[_0x5f5c('0x29')]=_[_0x5f5c('0x2a')](_0x24b73c[_0x5f5c('0x29')]);_0x3f321a[_0x5f5c('0x2b')]=_['intersection'](_0x3f321a[_0x5f5c('0x2c')],_0x3f321a['query']);_0x393a17[_0x5f5c('0x2d')]=_['intersection'](_0x3f321a[_0x5f5c('0x2c')],qs[_0x5f5c('0x2e')](_0x24b73c[_0x5f5c('0x29')]['fields']));_0x393a17[_0x5f5c('0x2d')]=_0x393a17['attributes'][_0x5f5c('0x2f')]?_0x393a17[_0x5f5c('0x2d')]:_0x3f321a[_0x5f5c('0x2c')];if(!_0x24b73c[_0x5f5c('0x29')]['hasOwnProperty'](_0x5f5c('0x30'))){_0x393a17['limit']=qs['limit'](_0x24b73c[_0x5f5c('0x29')][_0x5f5c('0x19')]);_0x393a17[_0x5f5c('0x18')]=qs[_0x5f5c('0x18')](_0x24b73c[_0x5f5c('0x29')]['offset']);}_0x393a17[_0x5f5c('0x31')]=qs[_0x5f5c('0x32')](_0x24b73c[_0x5f5c('0x29')][_0x5f5c('0x32')]);_0x393a17[_0x5f5c('0x33')]=qs[_0x5f5c('0x2b')](_['pick'](_0x24b73c[_0x5f5c('0x29')],_0x3f321a[_0x5f5c('0x2b')]),_0x1ce1d4);if(_0x24b73c[_0x5f5c('0x29')][_0x5f5c('0x34')]){_0x393a17['where']=_[_0x5f5c('0x35')](_0x393a17[_0x5f5c('0x33')],{'$or':_[_0x5f5c('0x28')](_0x1ce1d4,function(_0x517ee3){if(_0x517ee3['type']!==_0x5f5c('0x36')){var _0x5aaac5={};_0x5aaac5[_0x517ee3[_0x5f5c('0x22')]]={'$like':'%'+_0x24b73c['query'][_0x5f5c('0x34')]+'%'};return _0x5aaac5;}})});}_0x393a17=_['merge']({},_0x393a17,_0x24b73c[_0x5f5c('0x37')]);var _0x298928={'where':_0x393a17['where']};return db[_0x5f5c('0x24')][_0x5f5c('0x17')](_0x298928)[_0x5f5c('0x1e')](function(_0x463f10){_0x4ba624['count']=_0x463f10;if(_0x24b73c[_0x5f5c('0x29')]['includeAll']){_0x393a17[_0x5f5c('0x38')]=[{'all':!![]}];}return db[_0x5f5c('0x24')][_0x5f5c('0x39')](_0x393a17);})[_0x5f5c('0x1e')](function(_0x3bead8){_0x4ba624['rows']=_0x3bead8;return _0x4ba624;})['then'](respondWithFilteredResult(_0x26038f,_0x393a17))[_0x5f5c('0x3a')](handleError(_0x26038f,null));};exports[_0x5f5c('0x3b')]=function(_0x2f7470,_0x12fd28){var _0x1d2644={'raw':!![],'where':{'id':_0x2f7470['params']['id']}},_0x8d628={};_0x8d628[_0x5f5c('0x2c')]=_[_0x5f5c('0x2a')](db['AnalyticTreeReport']['rawAttributes']);_0x8d628[_0x5f5c('0x29')]=_[_0x5f5c('0x2a')](_0x2f7470[_0x5f5c('0x29')]);_0x8d628['filters']=_[_0x5f5c('0x3c')](_0x8d628['model'],_0x8d628['query']);_0x1d2644[_0x5f5c('0x2d')]=_['intersection'](_0x8d628[_0x5f5c('0x2c')],qs[_0x5f5c('0x2e')](_0x2f7470[_0x5f5c('0x29')]['fields']));_0x1d2644[_0x5f5c('0x2d')]=_0x1d2644['attributes']['length']?_0x1d2644[_0x5f5c('0x2d')]:_0x8d628[_0x5f5c('0x2c')];if(_0x2f7470[_0x5f5c('0x29')]['includeAll']){_0x1d2644['include']=[{'all':!![]}];}_0x1d2644=_[_0x5f5c('0x35')]({},_0x1d2644,_0x2f7470[_0x5f5c('0x37')]);return db[_0x5f5c('0x24')]['find'](_0x1d2644)[_0x5f5c('0x1e')](handleEntityNotFound(_0x12fd28,null))[_0x5f5c('0x1e')](respondWithResult(_0x12fd28,null))[_0x5f5c('0x3a')](handleError(_0x12fd28,null));};exports['create']=function(_0x17494c,_0x274e48){return db[_0x5f5c('0x24')]['create'](_0x17494c['body'],{})['then'](respondWithResult(_0x274e48,0xc9))[_0x5f5c('0x3a')](handleError(_0x274e48,null));};exports[_0x5f5c('0x1d')]=function(_0x3d7051,_0x264452){if(_0x3d7051['body']['id']){delete _0x3d7051['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x3d7051[_0x5f5c('0x3d')]['id']}})['then'](handleEntityNotFound(_0x264452,null))[_0x5f5c('0x1e')](saveUpdates(_0x3d7051['body'],null))[_0x5f5c('0x1e')](respondWithResult(_0x264452,null))[_0x5f5c('0x3a')](handleError(_0x264452,null));};exports[_0x5f5c('0x1f')]=function(_0x52809b,_0x107d9b){return db[_0x5f5c('0x24')][_0x5f5c('0x3e')]({'where':{'id':_0x52809b['params']['id']}})[_0x5f5c('0x1e')](handleEntityNotFound(_0x107d9b,null))[_0x5f5c('0x1e')](removeEntity(_0x107d9b,null))[_0x5f5c('0x3a')](handleError(_0x107d9b,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ff0faf8..a97bd47 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 _0xe5af=['exports','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x146be0,_0x39a85e){var _0x1bcc25=function(_0x4f871f){while(--_0x4f871f){_0x146be0['push'](_0x146be0['shift']());}};_0x1bcc25(++_0x39a85e);}(_0xe5af,0x9c));var _0xfe5a=function(_0x1465d4,_0x2d3d48){_0x1465d4=_0x1465d4-0x0;var _0x118a84=_0xe5af[_0x1465d4];return _0x118a84;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0xfe5a('0x6')]=function(_0x2039cd,_0x4e418f){return _0x2039cd['define'](_0xfe5a('0x7'),attributes,{'tableName':_0xfe5a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ccb=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x6e8e3e,_0x372fb7){var _0x1e8406=function(_0x18418f){while(--_0x18418f){_0x6e8e3e['push'](_0x6e8e3e['shift']());}};_0x1e8406(++_0x372fb7);}(_0x4ccb,0x196));var _0xb4cc=function(_0x488bad,_0x41351f){_0x488bad=_0x488bad-0x0;var _0x4e7302=_0x4ccb[_0x488bad];return _0x4e7302;};'use strict';var _=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var logger=require(_0xb4cc('0x2'))('api');var moment=require(_0xb4cc('0x3'));var BPromise=require(_0xb4cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4cc('0x5'));var rimraf=require(_0xb4cc('0x6'));var config=require(_0xb4cc('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xb4cc('0x8')]=function(_0x2181b2,_0x1e19dd){return _0x2181b2['define'](_0xb4cc('0x9'),attributes,{'tableName':_0xb4cc('0xa'),'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 6c6404b..73c48de 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 _0x345a=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','util','moment'];(function(_0xb5ed60,_0x28dc25){var _0x508c09=function(_0x5aa562){while(--_0x5aa562){_0xb5ed60['push'](_0xb5ed60['shift']());}};_0x508c09(++_0x28dc25);}(_0x345a,0x8a));var _0xa345=function(_0x301327,_0x30ef7d){_0x301327=_0x301327-0x0;var _0x3b89d9=_0x345a[_0x301327];return _0x3b89d9;};'use strict';var _=require('lodash');var util=require(_0xa345('0x0'));var moment=require(_0xa345('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa345('0x2'))['db'];var utils=require(_0xa345('0x3'));var logger=require(_0xa345('0x4'))(_0xa345('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa345('0x6')][_0xa345('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1dcdc6,_0x22079c,_0x2f0d10){return new BPromise(function(_0x25118b,_0x229cf8){return client[_0xa345('0x8')](_0x1dcdc6,_0x2f0d10)[_0xa345('0x9')](function(_0x4d8ed7){logger['info'](_0xa345('0xa'),_0x22079c,_0xa345('0xb'));logger[_0xa345('0xc')](_0xa345('0xd'),_0x22079c,_0xa345('0xb'),JSON[_0xa345('0xe')](_0x4d8ed7));if(_0x4d8ed7['error']){if(_0x4d8ed7['error'][_0xa345('0xf')]===0x1f4){logger[_0xa345('0x10')](_0xa345('0xa'),_0x22079c,_0x4d8ed7[_0xa345('0x10')][_0xa345('0x11')]);return _0x229cf8(_0x4d8ed7[_0xa345('0x10')][_0xa345('0x11')]);}logger[_0xa345('0x10')](_0xa345('0xa'),_0x22079c,_0x4d8ed7['error'][_0xa345('0x11')]);return _0x25118b(_0x4d8ed7[_0xa345('0x10')][_0xa345('0x11')]);}else{logger[_0xa345('0x12')](_0xa345('0xa'),_0x22079c,'request\x20sent');_0x25118b(_0x4d8ed7['result'][_0xa345('0x11')]);}})[_0xa345('0x13')](function(_0x5e4ddc){logger[_0xa345('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x22079c,_0x5e4ddc);_0x229cf8(_0x5e4ddc);});});} \ No newline at end of file +var _0x4128=['message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x18c89b,_0x10b2c4){var _0x46c8bb=function(_0x28d7ca){while(--_0x28d7ca){_0x18c89b['push'](_0x18c89b['shift']());}};_0x46c8bb(++_0x10b2c4);}(_0x4128,0xc8));var _0x8412=function(_0xa65ae3,_0x25b2f1){_0xa65ae3=_0xa65ae3-0x0;var _0x59743d=_0x4128[_0xa65ae3];return _0x59743d;};'use strict';var _=require(_0x8412('0x0'));var util=require(_0x8412('0x1'));var moment=require('moment');var BPromise=require(_0x8412('0x2'));var rs=require(_0x8412('0x3'));var fs=require('fs');var Redis=require(_0x8412('0x4'));var db=require(_0x8412('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8412('0x6'))(_0x8412('0x7'));var config=require(_0x8412('0x8'));var jayson=require(_0x8412('0x9'));var client=jayson[_0x8412('0xa')][_0x8412('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40b7b6,_0x537fbc,_0x2e5403){return new BPromise(function(_0x1efa09,_0x1fc7c6){return client[_0x8412('0xc')](_0x40b7b6,_0x2e5403)[_0x8412('0xd')](function(_0x4f5c71){logger['info'](_0x8412('0xe'),_0x537fbc,_0x8412('0xf'));logger[_0x8412('0x10')](_0x8412('0x11'),_0x537fbc,_0x8412('0xf'),JSON['stringify'](_0x4f5c71));if(_0x4f5c71[_0x8412('0x12')]){if(_0x4f5c71['error'][_0x8412('0x13')]===0x1f4){logger['error'](_0x8412('0xe'),_0x537fbc,_0x4f5c71[_0x8412('0x12')][_0x8412('0x14')]);return _0x1fc7c6(_0x4f5c71[_0x8412('0x12')][_0x8412('0x14')]);}logger[_0x8412('0x12')](_0x8412('0xe'),_0x537fbc,_0x4f5c71['error'][_0x8412('0x14')]);return _0x1efa09(_0x4f5c71[_0x8412('0x12')][_0x8412('0x14')]);}else{logger[_0x8412('0x15')]('AnalyticTreeReport,\x20%s,\x20%s',_0x537fbc,_0x8412('0xf'));_0x1efa09(_0x4f5c71['result'][_0x8412('0x14')]);}})['catch'](function(_0x362686){logger[_0x8412('0x12')](_0x8412('0xe'),_0x537fbc,_0x362686);_0x1fc7c6(_0x362686);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 575aa70..f794f5e 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 _0x5cce=['put','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','./analyticTreeReport.controller','get','/:id','post','isAuthenticated'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0x5cce,0xb8));var _0xe5cc=function(_0x5e44e4,_0x301a98){_0x5e44e4=_0x5e44e4-0x0;var _0x6fc43e=_0x5cce[_0x5e44e4];return _0x6fc43e;};'use strict';var multer=require(_0xe5cc('0x0'));var util=require(_0xe5cc('0x1'));var path=require(_0xe5cc('0x2'));var timeout=require('connect-timeout');var express=require(_0xe5cc('0x3'));var router=express[_0xe5cc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe5cc('0x5'));var config=require('../../config/environment');var controller=require(_0xe5cc('0x6'));router[_0xe5cc('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe5cc('0x7')](_0xe5cc('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xe5cc('0x9')]('/',auth[_0xe5cc('0xa')](),controller['create']);router[_0xe5cc('0xb')](_0xe5cc('0x8'),auth[_0xe5cc('0xa')](),controller[_0xe5cc('0xc')]);router[_0xe5cc('0xd')](_0xe5cc('0x8'),auth['isAuthenticated'](),controller[_0xe5cc('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9f19=['index','get','/:id','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated'];(function(_0x20f34f,_0x32a7dc){var _0x5901a4=function(_0x463917){while(--_0x463917){_0x20f34f['push'](_0x20f34f['shift']());}};_0x5901a4(++_0x32a7dc);}(_0x9f19,0x86));var _0x99f1=function(_0x1cc8fe,_0x34ece5){_0x1cc8fe=_0x1cc8fe-0x0;var _0x461db5=_0x9f19[_0x1cc8fe];return _0x461db5;};'use strict';var multer=require(_0x99f1('0x0'));var util=require(_0x99f1('0x1'));var path=require(_0x99f1('0x2'));var timeout=require(_0x99f1('0x3'));var express=require(_0x99f1('0x4'));var router=express[_0x99f1('0x5')]();var auth=require(_0x99f1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99f1('0x7'));var controller=require(_0x99f1('0x8'));router['get']('/',auth[_0x99f1('0x9')](),controller[_0x99f1('0xa')]);router[_0x99f1('0xb')](_0x99f1('0xc'),auth[_0x99f1('0x9')](),controller['show']);router[_0x99f1('0xd')]('/',auth[_0x99f1('0x9')](),controller['create']);router[_0x99f1('0xe')](_0x99f1('0xc'),auth['isAuthenticated'](),controller[_0x99f1('0xf')]);router['delete']('/:id',auth[_0x99f1('0x9')](),controller[_0x99f1('0x10')]);module[_0x99f1('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1ab3507..bfc40d9 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 _0xc9c1=['STRING','exports'];(function(_0x40f8d6,_0x483d9c){var _0x26fb05=function(_0x2226bd){while(--_0x2226bd){_0x40f8d6['push'](_0x40f8d6['shift']());}};_0x26fb05(++_0x483d9c);}(_0xc9c1,0x133));var _0x1c9c=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xc9c1[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require('sequelize');module[_0x1c9c('0x0')]={'name':{'type':Sequelize[_0x1c9c('0x1')]},'basename':{'type':Sequelize[_0x1c9c('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf60d=['exports','STRING','sequelize'];(function(_0x5dc554,_0x4156ac){var _0x1c767f=function(_0x362b96){while(--_0x362b96){_0x5dc554['push'](_0x5dc554['shift']());}};_0x1c767f(++_0x4156ac);}(_0xf60d,0x158));var _0xdf60=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xf60d[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require(_0xdf60('0x0'));module[_0xdf60('0x1')]={'name':{'type':Sequelize[_0xdf60('0x2')]},'basename':{'type':Sequelize[_0xdf60('0x2')]},'type':{'type':Sequelize[_0xdf60('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1d171f3..8a66181 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 _0xdeea=['fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','get','omit','createdAt','body','find','create','file','basename','filename','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x1c7c1a,_0x4968c2){var _0x574301=function(_0x4b797c){while(--_0x4b797c){_0x1c7c1a['push'](_0x1c7c1a['shift']());}};_0x574301(++_0x4968c2);}(_0xdeea,0x1f4));var _0xadee=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xdeea[_0x199572];return _0x13cfa3;};'use strict';var pdf=require(_0xadee('0x0'));var emlformat=require(_0xadee('0x1'));var rimraf=require(_0xadee('0x2'));var zipdir=require(_0xadee('0x3'));var jsonpatch=require(_0xadee('0x4'));var rp=require(_0xadee('0x5'));var moment=require('moment');var BPromise=require(_0xadee('0x6'));var Mustache=require('mustache');var util=require(_0xadee('0x7'));var path=require(_0xadee('0x8'));var sox=require(_0xadee('0x9'));var csv=require(_0xadee('0xa'));var ejs=require(_0xadee('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xadee('0xc'));var crypto=require(_0xadee('0xd'));var jsforce=require(_0xadee('0xe'));var deskjs=require(_0xadee('0xf'));var toCsv=require('to-csv');var querystring=require(_0xadee('0x10'));var Papa=require('papaparse');var Redis=require(_0xadee('0x11'));var authService=require(_0xadee('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xadee('0x13'));var hardwareService=require(_0xadee('0x14'));var logger=require(_0xadee('0x15'))('api');var utils=require(_0xadee('0x16'));var config=require(_0xadee('0x17'));var licenseUtil=require(_0xadee('0x18'));var db=require(_0xadee('0x19'))['db'];function respondWithStatusCode(_0x1675c3,_0x337cfd){_0x337cfd=_0x337cfd||0xcc;return function(_0x3a9c5e){if(_0x3a9c5e){return _0x1675c3[_0xadee('0x1a')](_0x337cfd);}return _0x1675c3[_0xadee('0x1b')](_0x337cfd)[_0xadee('0x1c')]();};}function respondWithResult(_0x4ce93d,_0x52d76b){_0x52d76b=_0x52d76b||0xc8;return function(_0x5c91ba){if(_0x5c91ba){return _0x4ce93d['status'](_0x52d76b)['json'](_0x5c91ba);}};}function respondWithFilteredResult(_0x71e944,_0x2df3a7){return function(_0x182368){if(_0x182368){var _0x4b35f7=_0x182368['count'],_0x2cda8a=_0x2df3a7[_0xadee('0x1d')],_0x5c67b7=_0x2df3a7['offset']+_0x2df3a7['limit'],_0x35d938;if(_0x5c67b7>=_0x4b35f7){_0x5c67b7=_0x4b35f7;_0x35d938=0xc8;}else{_0x35d938=0xce;}_0x71e944[_0xadee('0x1b')](_0x35d938);return _0x71e944[_0xadee('0x1e')](_0xadee('0x1f'),_0x2cda8a+'-'+_0x5c67b7+'/'+_0x4b35f7)['json'](_0x182368);}return null;};}function patchUpdates(_0x3cfc15){return function(_0x3dc742){try{jsonpatch[_0xadee('0x20')](_0x3dc742,_0x3cfc15,!![]);}catch(_0x18d53a){return BPromise[_0xadee('0x21')](_0x18d53a);}return _0x3dc742[_0xadee('0x22')]();};}function saveUpdates(_0x7911a5,_0x5c682c){return function(_0x1a8c10){if(_0x1a8c10){return _0x1a8c10[_0xadee('0x23')](_0x7911a5)['then'](function(_0x33d7d4){return _0x33d7d4;});}return null;};}function removeEntity(_0x50c250,_0x33c7c5){return function(_0x25ce32){if(_0x25ce32){return _0x25ce32['destroy']()[_0xadee('0x24')](function(){_0x50c250[_0xadee('0x1b')](0xcc)[_0xadee('0x1c')]();});}};}function handleEntityNotFound(_0x28429d,_0x5ac7e8){return function(_0x414aad){if(!_0x414aad){_0x28429d['sendStatus'](0x194);}return _0x414aad;};}function handleError(_0x41cd62,_0x430ae4){_0x430ae4=_0x430ae4||0x1f4;return function(_0x27bb0b){logger[_0xadee('0x25')](_0x27bb0b[_0xadee('0x26')]);if(_0x27bb0b['name']){delete _0x27bb0b[_0xadee('0x27')];}_0x41cd62['status'](_0x430ae4)[_0xadee('0x28')](_0x27bb0b);};}exports['index']=function(_0xda89c3,_0x4d8670){var _0x4f3621={},_0x103681={},_0x2722fa={'count':0x0,'rows':[]};var _0x5a7709=_[_0xadee('0x29')](db[_0xadee('0x2a')][_0xadee('0x2b')],function(_0x479bbe){return{'name':_0x479bbe[_0xadee('0x2c')],'type':_0x479bbe[_0xadee('0x2d')][_0xadee('0x2e')]};});_0x103681['model']=_[_0xadee('0x29')](_0x5a7709,_0xadee('0x27'));_0x103681[_0xadee('0x2f')]=_[_0xadee('0x30')](_0xda89c3['query']);_0x103681[_0xadee('0x31')]=_[_0xadee('0x32')](_0x103681[_0xadee('0x33')],_0x103681[_0xadee('0x2f')]);_0x4f3621[_0xadee('0x34')]=_['intersection'](_0x103681[_0xadee('0x33')],qs[_0xadee('0x35')](_0xda89c3[_0xadee('0x2f')]['fields']));_0x4f3621[_0xadee('0x34')]=_0x4f3621[_0xadee('0x34')][_0xadee('0x36')]?_0x4f3621[_0xadee('0x34')]:_0x103681[_0xadee('0x33')];if(!_0xda89c3[_0xadee('0x2f')][_0xadee('0x37')]('nolimit')){_0x4f3621[_0xadee('0x38')]=qs[_0xadee('0x38')](_0xda89c3[_0xadee('0x2f')]['limit']);_0x4f3621[_0xadee('0x1d')]=qs[_0xadee('0x1d')](_0xda89c3[_0xadee('0x2f')]['offset']);}_0x4f3621['order']=qs[_0xadee('0x39')](_0xda89c3[_0xadee('0x2f')][_0xadee('0x39')]);_0x4f3621[_0xadee('0x3a')]=qs[_0xadee('0x31')](_[_0xadee('0x3b')](_0xda89c3['query'],_0x103681[_0xadee('0x31')]),_0x5a7709);if(_0xda89c3['query']['filter']){_0x4f3621[_0xadee('0x3a')]=_[_0xadee('0x3c')](_0x4f3621[_0xadee('0x3a')],{'$or':_[_0xadee('0x29')](_0x5a7709,function(_0x23bb52){if(_0x23bb52['type']!==_0xadee('0x3d')){var _0x4afe8f={};_0x4afe8f[_0x23bb52[_0xadee('0x27')]]={'$like':'%'+_0xda89c3[_0xadee('0x2f')]['filter']+'%'};return _0x4afe8f;}})});}_0x4f3621=_[_0xadee('0x3c')]({},_0x4f3621,_0xda89c3[_0xadee('0x3e')]);var _0x5bb477={'where':_0x4f3621[_0xadee('0x3a')]};return db['Attachment']['count'](_0x5bb477)[_0xadee('0x24')](function(_0x124735){_0x2722fa['count']=_0x124735;if(_0xda89c3[_0xadee('0x2f')]['includeAll']){_0x4f3621[_0xadee('0x3f')]=[{'all':!![]}];}return db[_0xadee('0x2a')][_0xadee('0x40')](_0x4f3621);})[_0xadee('0x24')](function(_0x9612b0){_0x2722fa[_0xadee('0x41')]=_0x9612b0;return _0x2722fa;})['then'](respondWithFilteredResult(_0x4d8670,_0x4f3621))[_0xadee('0x42')](handleError(_0x4d8670,null));};exports[_0xadee('0x43')]=function(_0x569bed,_0x19efe1){var _0x55d65e={'raw':!![],'where':{'id':_0x569bed[_0xadee('0x44')]['id']}},_0x1860e2={};_0x1860e2['model']=_[_0xadee('0x30')](db[_0xadee('0x2a')][_0xadee('0x2b')]);_0x1860e2['query']=_[_0xadee('0x30')](_0x569bed[_0xadee('0x2f')]);_0x1860e2[_0xadee('0x31')]=_[_0xadee('0x32')](_0x1860e2[_0xadee('0x33')],_0x1860e2[_0xadee('0x2f')]);_0x55d65e[_0xadee('0x34')]=_[_0xadee('0x32')](_0x1860e2[_0xadee('0x33')],qs[_0xadee('0x35')](_0x569bed[_0xadee('0x2f')][_0xadee('0x35')]));_0x55d65e[_0xadee('0x34')]=_0x55d65e[_0xadee('0x34')][_0xadee('0x36')]?_0x55d65e[_0xadee('0x34')]:_0x1860e2['model'];if(_0x569bed[_0xadee('0x2f')][_0xadee('0x45')]){_0x55d65e['include']=[{'all':!![]}];}_0x55d65e=_[_0xadee('0x3c')]({},_0x55d65e,_0x569bed['options']);return db[_0xadee('0x2a')]['find'](_0x55d65e)[_0xadee('0x24')](handleEntityNotFound(_0x19efe1,null))[_0xadee('0x24')](respondWithResult(_0x19efe1,null))['catch'](handleError(_0x19efe1,null));};exports['clone']=function(_0x4bafa3,_0x31097b){var _0x46d444={'where':{'id':_0x4bafa3[_0xadee('0x44')]['id']}},_0x446c6a={};_0x446c6a[_0xadee('0x33')]=_[_0xadee('0x30')](db[_0xadee('0x2a')][_0xadee('0x2b')]);_0x46d444[_0xadee('0x34')]=_[_0xadee('0x32')](_0x446c6a['model'],qs[_0xadee('0x35')](_0x4bafa3[_0xadee('0x2f')][_0xadee('0x35')]));_0x46d444[_0xadee('0x34')]=_0x46d444[_0xadee('0x34')][_0xadee('0x36')]?_0x46d444[_0xadee('0x34')]:_0x446c6a['model'];if(_0x4bafa3[_0xadee('0x2f')][_0xadee('0x45')]){_0x46d444[_0xadee('0x3f')]=[{'all':!![]}];}_0x46d444=_[_0xadee('0x3c')]({},_0x46d444,_0x4bafa3[_0xadee('0x3e')]);return db[_0xadee('0x2a')]['find'](_0x46d444)[_0xadee('0x24')](handleEntityNotFound(_0x31097b,null))[_0xadee('0x24')](function(_0x52e7ae){if(_0x52e7ae){var _0x49f17a=_0x52e7ae[_0xadee('0x46')]({'plain':!![]});_0x49f17a=qs[_0xadee('0x47')](_0x49f17a,['id',_0xadee('0x48'),'updatedAt']);_0x4bafa3['body']=_[_0xadee('0x47')](_0x4bafa3['body'],['id',_0xadee('0x48'),'updatedAt']);return db[_0xadee('0x2a')]['create'](_[_0xadee('0x3c')](_0x49f17a,_0x4bafa3[_0xadee('0x49')]),{'include':_0x4bafa3[_0xadee('0x2f')][_0xadee('0x45')]?[{'all':!![]}]:undefined});}})[_0xadee('0x24')](respondWithResult(_0x31097b,0xc9))[_0xadee('0x42')](handleError(_0x31097b,null));};exports[_0xadee('0x23')]=function(_0x4758c7,_0x3357e5){if(_0x4758c7[_0xadee('0x49')]['id']){delete _0x4758c7[_0xadee('0x49')]['id'];}return db['Attachment'][_0xadee('0x4a')]({'where':{'id':_0x4758c7['params']['id']}})[_0xadee('0x24')](handleEntityNotFound(_0x3357e5,null))['then'](saveUpdates(_0x4758c7[_0xadee('0x49')],null))[_0xadee('0x24')](respondWithResult(_0x3357e5,null))[_0xadee('0x42')](handleError(_0x3357e5,null));};exports['destroy']=function(_0x48ef43,_0x13b11c){return db[_0xadee('0x2a')]['find']({'where':{'id':_0x48ef43[_0xadee('0x44')]['id']}})[_0xadee('0x24')](handleEntityNotFound(_0x13b11c,null))[_0xadee('0x24')](removeEntity(_0x13b11c,null))[_0xadee('0x42')](handleError(_0x13b11c,null));};exports[_0xadee('0x4b')]=function(_0x3210b7,_0x3b46bd,_0x2fa62e){_0x3210b7[_0xadee('0x49')][_0xadee('0x27')]=_0x3210b7[_0xadee('0x4c')]['originalname'];_0x3210b7[_0xadee('0x49')][_0xadee('0x4d')]=_0x3210b7[_0xadee('0x4c')][_0xadee('0x4e')];_0x3210b7[_0xadee('0x49')][_0xadee('0x2d')]=_0x3210b7[_0xadee('0x4c')]['mimetype'];return db[_0xadee('0x2a')][_0xadee('0x4b')](_0x3210b7[_0xadee('0x49')])[_0xadee('0x24')](respondWithResult(_0x3b46bd,0xc9))[_0xadee('0x42')](handleError(_0x3b46bd,null));};exports[_0xadee('0x4f')]=function(_0xe7f4c9,_0x35e669,_0x20f914){return db[_0xadee('0x2a')][_0xadee('0x50')]({'where':{'id':_0xe7f4c9[_0xadee('0x44')]['id']},'raw':!![]})[_0xadee('0x24')](handleEntityNotFound(_0x35e669,null))[_0xadee('0x24')](function(_0x483233){if(_0x483233){return _0x35e669[_0xadee('0x4f')](path[_0xadee('0x51')](config[_0xadee('0x52')],_0xadee('0x53'),_0x483233['basename']));}})[_0xadee('0x42')](handleError(_0x35e669,null));}; \ No newline at end of file +var _0xda02=['filename','file','mimetype','findOne','download','join','root','server/files/attachments/','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','rawAttributes','type','key','name','query','model','intersection','fields','length','attributes','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Attachment','count','includeAll','include','findAll','rows','catch','show','params','keys','find','clone','get','updatedAt','body','createdAt','create','basename'];(function(_0x41ed13,_0x1044be){var _0x1bb4d5=function(_0x15d224){while(--_0x15d224){_0x41ed13['push'](_0x41ed13['shift']());}};_0x1bb4d5(++_0x1044be);}(_0xda02,0x1a2));var _0x2da0=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xda02[_0x263a74];return _0x2aa86c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2da0('0x0'));var zipdir=require(_0x2da0('0x1'));var jsonpatch=require(_0x2da0('0x2'));var rp=require(_0x2da0('0x3'));var moment=require('moment');var BPromise=require(_0x2da0('0x4'));var Mustache=require(_0x2da0('0x5'));var util=require(_0x2da0('0x6'));var path=require(_0x2da0('0x7'));var sox=require(_0x2da0('0x8'));var csv=require(_0x2da0('0x9'));var ejs=require(_0x2da0('0xa'));var fs=require('fs');var _=require(_0x2da0('0xb'));var squel=require(_0x2da0('0xc'));var crypto=require(_0x2da0('0xd'));var jsforce=require(_0x2da0('0xe'));var deskjs=require(_0x2da0('0xf'));var toCsv=require(_0x2da0('0x9'));var querystring=require('querystring');var Papa=require(_0x2da0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2da0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2da0('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x2da0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2da0('0x14'))['db'];function respondWithStatusCode(_0x531c95,_0xbceb2){_0xbceb2=_0xbceb2||0xcc;return function(_0x5059e2){if(_0x5059e2){return _0x531c95['sendStatus'](_0xbceb2);}return _0x531c95[_0x2da0('0x15')](_0xbceb2)['end']();};}function respondWithResult(_0x7ffc3a,_0xe3b410){_0xe3b410=_0xe3b410||0xc8;return function(_0x4603de){if(_0x4603de){return _0x7ffc3a[_0x2da0('0x15')](_0xe3b410)['json'](_0x4603de);}};}function respondWithFilteredResult(_0x10bbd8,_0x1c439f){return function(_0x1b0fa4){if(_0x1b0fa4){var _0x18b09c=_0x1b0fa4['count'],_0x3c7f75=_0x1c439f['offset'],_0x4367d8=_0x1c439f[_0x2da0('0x16')]+_0x1c439f[_0x2da0('0x17')],_0x33e930;if(_0x4367d8>=_0x18b09c){_0x4367d8=_0x18b09c;_0x33e930=0xc8;}else{_0x33e930=0xce;}_0x10bbd8[_0x2da0('0x15')](_0x33e930);return _0x10bbd8['set'](_0x2da0('0x18'),_0x3c7f75+'-'+_0x4367d8+'/'+_0x18b09c)['json'](_0x1b0fa4);}return null;};}function patchUpdates(_0x4f6d17){return function(_0x488b9d){try{jsonpatch[_0x2da0('0x19')](_0x488b9d,_0x4f6d17,!![]);}catch(_0x470345){return BPromise[_0x2da0('0x1a')](_0x470345);}return _0x488b9d[_0x2da0('0x1b')]();};}function saveUpdates(_0x2c8e2b,_0xd67197){return function(_0x5ddf74){if(_0x5ddf74){return _0x5ddf74[_0x2da0('0x1c')](_0x2c8e2b)[_0x2da0('0x1d')](function(_0x12759e){return _0x12759e;});}return null;};}function removeEntity(_0x4c8893,_0xb7eb4d){return function(_0x2e3068){if(_0x2e3068){return _0x2e3068[_0x2da0('0x1e')]()['then'](function(){_0x4c8893[_0x2da0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ad443,_0xf6ca){return function(_0x89ef75){if(!_0x89ef75){_0x3ad443[_0x2da0('0x1f')](0x194);}return _0x89ef75;};}function handleError(_0x160d8c,_0x174505){_0x174505=_0x174505||0x1f4;return function(_0x1c0280){logger['error'](_0x1c0280[_0x2da0('0x20')]);if(_0x1c0280['name']){delete _0x1c0280['name'];}_0x160d8c[_0x2da0('0x15')](_0x174505)[_0x2da0('0x21')](_0x1c0280);};}exports[_0x2da0('0x22')]=function(_0x3f1dd2,_0x329c4b){var _0x25ab74={},_0x1365e2={},_0xd9fb97={'count':0x0,'rows':[]};var _0x53cfdb=_[_0x2da0('0x23')](db['Attachment'][_0x2da0('0x24')],function(_0x5b8c3e){return{'name':_0x5b8c3e['fieldName'],'type':_0x5b8c3e[_0x2da0('0x25')][_0x2da0('0x26')]};});_0x1365e2['model']=_['map'](_0x53cfdb,_0x2da0('0x27'));_0x1365e2['query']=_['keys'](_0x3f1dd2[_0x2da0('0x28')]);_0x1365e2['filters']=_['intersection'](_0x1365e2[_0x2da0('0x29')],_0x1365e2[_0x2da0('0x28')]);_0x25ab74['attributes']=_[_0x2da0('0x2a')](_0x1365e2['model'],qs[_0x2da0('0x2b')](_0x3f1dd2['query'][_0x2da0('0x2b')]));_0x25ab74['attributes']=_0x25ab74['attributes'][_0x2da0('0x2c')]?_0x25ab74[_0x2da0('0x2d')]:_0x1365e2[_0x2da0('0x29')];if(!_0x3f1dd2['query']['hasOwnProperty'](_0x2da0('0x2e'))){_0x25ab74[_0x2da0('0x17')]=qs['limit'](_0x3f1dd2[_0x2da0('0x28')][_0x2da0('0x17')]);_0x25ab74['offset']=qs[_0x2da0('0x16')](_0x3f1dd2[_0x2da0('0x28')][_0x2da0('0x16')]);}_0x25ab74[_0x2da0('0x2f')]=qs['sort'](_0x3f1dd2[_0x2da0('0x28')][_0x2da0('0x30')]);_0x25ab74[_0x2da0('0x31')]=qs[_0x2da0('0x32')](_[_0x2da0('0x33')](_0x3f1dd2['query'],_0x1365e2[_0x2da0('0x32')]),_0x53cfdb);if(_0x3f1dd2['query'][_0x2da0('0x34')]){_0x25ab74['where']=_[_0x2da0('0x35')](_0x25ab74[_0x2da0('0x31')],{'$or':_['map'](_0x53cfdb,function(_0xa5152){if(_0xa5152[_0x2da0('0x25')]!==_0x2da0('0x36')){var _0x5ea2ef={};_0x5ea2ef[_0xa5152[_0x2da0('0x27')]]={'$like':'%'+_0x3f1dd2['query'][_0x2da0('0x34')]+'%'};return _0x5ea2ef;}})});}_0x25ab74=_[_0x2da0('0x35')]({},_0x25ab74,_0x3f1dd2[_0x2da0('0x37')]);var _0x32d28c={'where':_0x25ab74[_0x2da0('0x31')]};return db[_0x2da0('0x38')][_0x2da0('0x39')](_0x32d28c)[_0x2da0('0x1d')](function(_0x3f7735){_0xd9fb97[_0x2da0('0x39')]=_0x3f7735;if(_0x3f1dd2[_0x2da0('0x28')][_0x2da0('0x3a')]){_0x25ab74[_0x2da0('0x3b')]=[{'all':!![]}];}return db[_0x2da0('0x38')][_0x2da0('0x3c')](_0x25ab74);})[_0x2da0('0x1d')](function(_0xb1a6d1){_0xd9fb97[_0x2da0('0x3d')]=_0xb1a6d1;return _0xd9fb97;})[_0x2da0('0x1d')](respondWithFilteredResult(_0x329c4b,_0x25ab74))[_0x2da0('0x3e')](handleError(_0x329c4b,null));};exports[_0x2da0('0x3f')]=function(_0x185835,_0x1f5763){var _0x2a0b76={'raw':!![],'where':{'id':_0x185835[_0x2da0('0x40')]['id']}},_0x22b622={};_0x22b622['model']=_['keys'](db[_0x2da0('0x38')][_0x2da0('0x24')]);_0x22b622[_0x2da0('0x28')]=_[_0x2da0('0x41')](_0x185835[_0x2da0('0x28')]);_0x22b622['filters']=_['intersection'](_0x22b622[_0x2da0('0x29')],_0x22b622[_0x2da0('0x28')]);_0x2a0b76[_0x2da0('0x2d')]=_[_0x2da0('0x2a')](_0x22b622[_0x2da0('0x29')],qs['fields'](_0x185835[_0x2da0('0x28')][_0x2da0('0x2b')]));_0x2a0b76['attributes']=_0x2a0b76[_0x2da0('0x2d')][_0x2da0('0x2c')]?_0x2a0b76[_0x2da0('0x2d')]:_0x22b622['model'];if(_0x185835['query']['includeAll']){_0x2a0b76[_0x2da0('0x3b')]=[{'all':!![]}];}_0x2a0b76=_[_0x2da0('0x35')]({},_0x2a0b76,_0x185835[_0x2da0('0x37')]);return db['Attachment'][_0x2da0('0x42')](_0x2a0b76)['then'](handleEntityNotFound(_0x1f5763,null))['then'](respondWithResult(_0x1f5763,null))['catch'](handleError(_0x1f5763,null));};exports[_0x2da0('0x43')]=function(_0x249797,_0x3c9bc9){var _0x499003={'where':{'id':_0x249797['params']['id']}},_0x725d44={};_0x725d44['model']=_[_0x2da0('0x41')](db[_0x2da0('0x38')][_0x2da0('0x24')]);_0x499003['attributes']=_[_0x2da0('0x2a')](_0x725d44[_0x2da0('0x29')],qs[_0x2da0('0x2b')](_0x249797[_0x2da0('0x28')][_0x2da0('0x2b')]));_0x499003[_0x2da0('0x2d')]=_0x499003['attributes'][_0x2da0('0x2c')]?_0x499003[_0x2da0('0x2d')]:_0x725d44[_0x2da0('0x29')];if(_0x249797[_0x2da0('0x28')]['includeAll']){_0x499003[_0x2da0('0x3b')]=[{'all':!![]}];}_0x499003=_[_0x2da0('0x35')]({},_0x499003,_0x249797[_0x2da0('0x37')]);return db[_0x2da0('0x38')][_0x2da0('0x42')](_0x499003)[_0x2da0('0x1d')](handleEntityNotFound(_0x3c9bc9,null))[_0x2da0('0x1d')](function(_0xa69430){if(_0xa69430){var _0x1aeaba=_0xa69430[_0x2da0('0x44')]({'plain':!![]});_0x1aeaba=qs['omit'](_0x1aeaba,['id','createdAt',_0x2da0('0x45')]);_0x249797['body']=_['omit'](_0x249797[_0x2da0('0x46')],['id',_0x2da0('0x47'),_0x2da0('0x45')]);return db['Attachment']['create'](_[_0x2da0('0x35')](_0x1aeaba,_0x249797['body']),{'include':_0x249797['query'][_0x2da0('0x3a')]?[{'all':!![]}]:undefined});}})[_0x2da0('0x1d')](respondWithResult(_0x3c9bc9,0xc9))[_0x2da0('0x3e')](handleError(_0x3c9bc9,null));};exports[_0x2da0('0x1c')]=function(_0x558d15,_0x4ae283){if(_0x558d15[_0x2da0('0x46')]['id']){delete _0x558d15[_0x2da0('0x46')]['id'];}return db[_0x2da0('0x38')][_0x2da0('0x42')]({'where':{'id':_0x558d15['params']['id']}})['then'](handleEntityNotFound(_0x4ae283,null))[_0x2da0('0x1d')](saveUpdates(_0x558d15[_0x2da0('0x46')],null))[_0x2da0('0x1d')](respondWithResult(_0x4ae283,null))[_0x2da0('0x3e')](handleError(_0x4ae283,null));};exports[_0x2da0('0x1e')]=function(_0x26b732,_0x173127){return db['Attachment']['find']({'where':{'id':_0x26b732[_0x2da0('0x40')]['id']}})[_0x2da0('0x1d')](handleEntityNotFound(_0x173127,null))[_0x2da0('0x1d')](removeEntity(_0x173127,null))[_0x2da0('0x3e')](handleError(_0x173127,null));};exports[_0x2da0('0x48')]=function(_0x534348,_0x4331b2,_0x54d29e){_0x534348[_0x2da0('0x46')][_0x2da0('0x27')]=_0x534348['file']['originalname'];_0x534348[_0x2da0('0x46')][_0x2da0('0x49')]=_0x534348['file'][_0x2da0('0x4a')];_0x534348[_0x2da0('0x46')]['type']=_0x534348[_0x2da0('0x4b')][_0x2da0('0x4c')];return db[_0x2da0('0x38')]['create'](_0x534348[_0x2da0('0x46')])[_0x2da0('0x1d')](respondWithResult(_0x4331b2,0xc9))[_0x2da0('0x3e')](handleError(_0x4331b2,null));};exports['download']=function(_0x500219,_0x67130a,_0x4593c4){return db[_0x2da0('0x38')][_0x2da0('0x4d')]({'where':{'id':_0x500219[_0x2da0('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x67130a,null))[_0x2da0('0x1d')](function(_0x56f928){if(_0x56f928){return _0x67130a[_0x2da0('0x4e')](path[_0x2da0('0x4f')](config[_0x2da0('0x50')],_0x2da0('0x51'),_0x56f928[_0x2da0('0x49')]));}})['catch'](handleError(_0x67130a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 7afef63..7bb732b 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 _0xb7e2=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash'];(function(_0x531bd4,_0x46dbc5){var _0x2d3e04=function(_0x581e35){while(--_0x581e35){_0x531bd4['push'](_0x531bd4['shift']());}};_0x2d3e04(++_0x46dbc5);}(_0xb7e2,0x103));var _0x2b7e=function(_0x587b09,_0x5196c9){_0x587b09=_0x587b09-0x0;var _0x4f8a74=_0xb7e2[_0x587b09];return _0x4f8a74;};'use strict';var _=require(_0x2b7e('0x0'));var util=require('util');var logger=require(_0x2b7e('0x1'))('api');var moment=require(_0x2b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x2b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b7e('0x4'));var config=require(_0x2b7e('0x5'));var attributes=require(_0x2b7e('0x6'));module[_0x2b7e('0x7')]=function(_0x3d06ba,_0x93733a){return _0x3d06ba['define'](_0x2b7e('0x8'),attributes,{'tableName':_0x2b7e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x110f=['lodash','util','bluebird','path','rimraf','../../config/environment','exports','Attachment','attachments'];(function(_0x9db67c,_0x27dfea){var _0x47b305=function(_0xf2834d){while(--_0xf2834d){_0x9db67c['push'](_0x9db67c['shift']());}};_0x47b305(++_0x27dfea);}(_0x110f,0x1e6));var _0xf110=function(_0x476835,_0x51438a){_0x476835=_0x476835-0x0;var _0x192249=_0x110f[_0x476835];return _0x192249;};'use strict';var _=require(_0xf110('0x0'));var util=require(_0xf110('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf110('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf110('0x3'));var rimraf=require(_0xf110('0x4'));var config=require(_0xf110('0x5'));var attributes=require('./attachment.attributes');module[_0xf110('0x6')]=function(_0x3147fd,_0xc27675){return _0x3147fd['define'](_0xf110('0x7'),attributes,{'tableName':_0xf110('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 7671e0c..8e2b9d6 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 _0xf72a=['http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateAttachment','Attachment','body','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x409b26,_0x4a3eff){var _0x3107ae=function(_0x966cda){while(--_0x966cda){_0x409b26['push'](_0x409b26['shift']());}};_0x3107ae(++_0x4a3eff);}(_0xf72a,0x7d));var _0xaf72=function(_0x2b159c,_0x5736f8){_0x2b159c=_0x2b159c-0x0;var _0x183510=_0xf72a[_0x2b159c];return _0x183510;};'use strict';var _=require(_0xaf72('0x0'));var util=require('util');var moment=require(_0xaf72('0x1'));var BPromise=require(_0xaf72('0x2'));var rs=require(_0xaf72('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf72('0x4'))['db'];var utils=require(_0xaf72('0x5'));var logger=require(_0xaf72('0x6'))(_0xaf72('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf72('0x8'));var client=jayson[_0xaf72('0x9')][_0xaf72('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c6594,_0x5f52a3,_0x28e4ef){return new BPromise(function(_0x5e9cd5,_0x1dc14c){return client[_0xaf72('0xb')](_0x4c6594,_0x28e4ef)[_0xaf72('0xc')](function(_0xb0ca4e){logger[_0xaf72('0xd')](_0xaf72('0xe'),_0x5f52a3,_0xaf72('0xf'));logger[_0xaf72('0x10')](_0xaf72('0x11'),_0x5f52a3,_0xaf72('0xf'),JSON['stringify'](_0xb0ca4e));if(_0xb0ca4e[_0xaf72('0x12')]){if(_0xb0ca4e['error'][_0xaf72('0x13')]===0x1f4){logger[_0xaf72('0x12')]('Attachment,\x20%s,\x20%s',_0x5f52a3,_0xb0ca4e[_0xaf72('0x12')][_0xaf72('0x14')]);return _0x1dc14c(_0xb0ca4e[_0xaf72('0x12')]['message']);}logger[_0xaf72('0x12')](_0xaf72('0xe'),_0x5f52a3,_0xb0ca4e[_0xaf72('0x12')][_0xaf72('0x14')]);return _0x5e9cd5(_0xb0ca4e['error'][_0xaf72('0x14')]);}else{logger[_0xaf72('0xd')](_0xaf72('0xe'),_0x5f52a3,'request\x20sent');_0x5e9cd5(_0xb0ca4e['result']['message']);}})[_0xaf72('0x15')](function(_0x1c7f6d){logger[_0xaf72('0x12')](_0xaf72('0xe'),_0x5f52a3,_0x1c7f6d);_0x1dc14c(_0x1c7f6d);});});}exports[_0xaf72('0x16')]=function(_0x243c94){var _0x3b9966=this;return new Promise(function(_0xcdb1cf,_0x59d8ec){return db[_0xaf72('0x17')]['create'](_0x243c94[_0xaf72('0x18')],{'raw':_0x243c94[_0xaf72('0x19')]?_0x243c94['options'][_0xaf72('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xd28573){logger['info']('CreateAttachment',_0x243c94);logger[_0xaf72('0x10')]('CreateAttachment',_0x243c94,JSON['stringify'](_0xd28573));_0xcdb1cf(_0xd28573);})['catch'](function(_0x419a43){logger[_0xaf72('0x12')]('CreateAttachment',_0x419a43[_0xaf72('0x14')],_0x243c94);_0x59d8ec(_0x3b9966[_0xaf72('0x12')](0x1f4,_0x419a43[_0xaf72('0x14')]));});});}; \ No newline at end of file +var _0xeed9=['stringify','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','debug','request\x20sent','code','error','message','Attachment,\x20%s,\x20%s','CreateAttachment','Attachment','create','body','options','then'];(function(_0xe40cbd,_0x7114b1){var _0x362362=function(_0x2d0b1f){while(--_0x2d0b1f){_0xe40cbd['push'](_0xe40cbd['shift']());}};_0x362362(++_0x7114b1);}(_0xeed9,0x15b));var _0x9eed=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0xeed9[_0xce9195];return _0x530fe6;};'use strict';var _=require(_0x9eed('0x0'));var util=require(_0x9eed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9eed('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9eed('0x3'))['db'];var utils=require(_0x9eed('0x4'));var logger=require('../../config/logger')(_0x9eed('0x5'));var config=require(_0x9eed('0x6'));var jayson=require(_0x9eed('0x7'));var client=jayson['client'][_0x9eed('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58c53b,_0x89eb7d,_0xf5e994){return new BPromise(function(_0x3d9656,_0xb22ab8){return client['request'](_0x58c53b,_0xf5e994)['then'](function(_0x15d69b){logger['info']('Attachment,\x20%s,\x20%s',_0x89eb7d,'request\x20sent');logger[_0x9eed('0x9')]('Attachment,\x20%s,\x20%s,\x20%s',_0x89eb7d,_0x9eed('0xa'),JSON['stringify'](_0x15d69b));if(_0x15d69b['error']){if(_0x15d69b['error'][_0x9eed('0xb')]===0x1f4){logger[_0x9eed('0xc')]('Attachment,\x20%s,\x20%s',_0x89eb7d,_0x15d69b['error'][_0x9eed('0xd')]);return _0xb22ab8(_0x15d69b[_0x9eed('0xc')][_0x9eed('0xd')]);}logger[_0x9eed('0xc')](_0x9eed('0xe'),_0x89eb7d,_0x15d69b['error'][_0x9eed('0xd')]);return _0x3d9656(_0x15d69b[_0x9eed('0xc')][_0x9eed('0xd')]);}else{logger['info'](_0x9eed('0xe'),_0x89eb7d,_0x9eed('0xa'));_0x3d9656(_0x15d69b['result'][_0x9eed('0xd')]);}})['catch'](function(_0x2a5428){logger['error']('Attachment,\x20%s,\x20%s',_0x89eb7d,_0x2a5428);_0xb22ab8(_0x2a5428);});});}exports[_0x9eed('0xf')]=function(_0x11a87b){var _0x25d6a4=this;return new Promise(function(_0x59a26f,_0x3a10a0){return db[_0x9eed('0x10')][_0x9eed('0x11')](_0x11a87b[_0x9eed('0x12')],{'raw':_0x11a87b[_0x9eed('0x13')]?_0x11a87b[_0x9eed('0x13')]['raw']===undefined?!![]:![]:!![]})[_0x9eed('0x14')](function(_0x5ad82c){logger['info'](_0x9eed('0xf'),_0x11a87b);logger[_0x9eed('0x9')]('CreateAttachment',_0x11a87b,JSON[_0x9eed('0x15')](_0x5ad82c));_0x59a26f(_0x5ad82c);})[_0x9eed('0x16')](function(_0x522357){logger[_0x9eed('0xc')](_0x9eed('0xf'),_0x522357[_0x9eed('0xd')],_0x11a87b);_0x3a10a0(_0x25d6a4[_0x9eed('0xc')](0x1f4,_0x522357[_0x9eed('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3ecbe96..e2de918 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 _0xc3d4=['%s-%s','originalname','replace','single','create','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','post','/:id/clone','clone','diskStorage','root','server/files/attachments/','format'];(function(_0x140931,_0x2ffeba){var _0x4718ab=function(_0x1f08f7){while(--_0x1f08f7){_0x140931['push'](_0x140931['shift']());}};_0x4718ab(++_0x2ffeba);}(_0xc3d4,0xd3));var _0x4c3d=function(_0x32235e,_0x5eab3a){_0x32235e=_0x32235e-0x0;var _0x55625d=_0xc3d4[_0x32235e];return _0x55625d;};'use strict';var multer=require(_0x4c3d('0x0'));var util=require(_0x4c3d('0x1'));var path=require(_0x4c3d('0x2'));var timeout=require(_0x4c3d('0x3'));var express=require('express');var router=express[_0x4c3d('0x4')]();var auth=require(_0x4c3d('0x5'));var interaction=require(_0x4c3d('0x6'));var config=require(_0x4c3d('0x7'));var controller=require('./attachment.controller');router[_0x4c3d('0x8')]('/',auth[_0x4c3d('0x9')](),controller[_0x4c3d('0xa')]);router[_0x4c3d('0x8')](_0x4c3d('0xb'),auth[_0x4c3d('0x9')](),controller[_0x4c3d('0xc')]);router['get'](_0x4c3d('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x4c3d('0xe')](_0x4c3d('0xf'),auth[_0x4c3d('0x9')](),controller[_0x4c3d('0x10')]);var upload=multer({'storage':multer[_0x4c3d('0x11')]({'destination':function(_0x5b08d4,_0x4d13ad,_0x418e1b){_0x418e1b(null,path['join'](config[_0x4c3d('0x12')],_0x4c3d('0x13')));},'filename':function(_0x59dc55,_0x39d544,_0x4e7bbd){_0x4e7bbd(null,util[_0x4c3d('0x14')](_0x4c3d('0x15'),Date['now'](),_0x39d544[_0x4c3d('0x16')][_0x4c3d('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x4c3d('0x18')]('file'),controller[_0x4c3d('0x19')]);router[_0x4c3d('0x1a')](_0x4c3d('0xb'),auth[_0x4c3d('0x9')](),controller['update']);router[_0x4c3d('0x1b')](_0x4c3d('0xb'),auth[_0x4c3d('0x9')](),controller[_0x4c3d('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xd05a=['root','server/files/attachments/','%s-%s','originalname','post','single','file','put','update','delete','destroy','util','path','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd05a,0x143));var _0xad05=function(_0x108b7e,_0x57329f){_0x108b7e=_0x108b7e-0x0;var _0x15e657=_0xd05a[_0x108b7e];return _0x15e657;};'use strict';var multer=require('multer');var util=require(_0xad05('0x0'));var path=require(_0xad05('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xad05('0x2'));var config=require(_0xad05('0x3'));var controller=require(_0xad05('0x4'));router[_0xad05('0x5')]('/',auth[_0xad05('0x6')](),controller['index']);router['get'](_0xad05('0x7'),auth[_0xad05('0x6')](),controller[_0xad05('0x8')]);router['get'](_0xad05('0x9'),auth[_0xad05('0x6')](),controller[_0xad05('0xa')]);router['post']('/:id/clone',auth[_0xad05('0x6')](),controller['clone']);var upload=multer({'storage':multer[_0xad05('0xb')]({'destination':function(_0x3ec191,_0x104fd4,_0x1fde1b){_0x1fde1b(null,path[_0xad05('0xc')](config[_0xad05('0xd')],_0xad05('0xe')));},'filename':function(_0x200eed,_0x144310,_0x4281b7){_0x4281b7(null,util['format'](_0xad05('0xf'),Date['now'](),_0x144310[_0xad05('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xad05('0x11')]('/',upload[_0xad05('0x12')](_0xad05('0x13')),controller['create']);router[_0xad05('0x14')]('/:id',auth[_0xad05('0x6')](),controller[_0xad05('0x15')]);router[_0xad05('0x16')](_0xad05('0x7'),auth[_0xad05('0x6')](),controller[_0xad05('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 9b8125d..b9af37d 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 _0xe680=['blockDuration','then','find','map','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes','getLicense','lodash','passport','moment','../../config/environment','signToken','../../config/utils','login','authenticate','google','/login','email','secret','callbackURL'];(function(_0x4ae5e3,_0x3901cc){var _0x52828e=function(_0x492831){while(--_0x492831){_0x4ae5e3['push'](_0x4ae5e3['shift']());}};_0x52828e(++_0x3901cc);}(_0xe680,0xb0));var _0x0e68=function(_0x13a1c7,_0x4e0b2e){_0x13a1c7=_0x13a1c7-0x0;var _0x19acc6=_0xe680[_0x13a1c7];return _0x19acc6;};'use strict';var _=require(_0x0e68('0x0'));var passport=require(_0x0e68('0x1'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0x0e68('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x0e68('0x3'));var signToken=require('../../components/auth/service')[_0x0e68('0x4')];var utils=require(_0x0e68('0x5'));exports[_0x0e68('0x6')]=passport[_0x0e68('0x7')](_0x0e68('0x8'),{'failureRedirect':_0x0e68('0x9'),'scope':['profile',_0x0e68('0xa')],'session':![]});exports['callback']=passport[_0x0e68('0x7')](_0x0e68('0x8'),{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x0e68('0x8')]?config[_0x0e68('0x8')]['clientID']:'id','clientSecret':config['google']?config['google']['clientSecret']:_0x0e68('0xb'),'callbackURL':config['google']?config['google'][_0x0e68('0xc')]:''},function(_0x278f53,_0x259326,_0x1e58bd,_0x5c0a94){var _0x1cf98f,_0x1d407a;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0e68('0xd')],'raw':!![]})[_0x0e68('0xe')](function(_0x2ceb66){_0x1cf98f=_0x2ceb66;return db['User'][_0x0e68('0xf')]({'where':{'email':_[_0x0e68('0x10')](_0x1e58bd['emails'],_0x0e68('0x11')),'role':{'$or':[_0x0e68('0x12'),_0x0e68('0x13'),_0x0e68('0x14')]}}});})['then'](function(_0x48e48a){_0x1d407a=_0x48e48a;if(_0x1d407a){if(_0x1d407a[_0x0e68('0x15')]){return _0x5c0a94(_0x0e68('0x16'));}else if(_0x1cf98f[_0x0e68('0xd')]>0x0){if(_0x1d407a[_0x0e68('0x17')]){if(moment(_0x1d407a[_0x0e68('0x18')])['add'](_0x1cf98f[_0x0e68('0xd')],_0x0e68('0x19'))>moment()){return _0x5c0a94(_0x0e68('0x16'));}else{return utils['clearBlockUser'](_0x1d407a,0x0,![],null)[_0x0e68('0xe')](function(){return utils['getLicense'](_0x1d407a);})[_0x0e68('0xe')](function(){return _0x5c0a94(null,_0x1d407a);});}}else{return utils[_0x0e68('0x1a')](_0x1d407a)[_0x0e68('0xe')](function(){return _0x5c0a94(null,_0x1d407a);});}}else{return utils[_0x0e68('0x1a')](_0x1d407a)['then'](function(){return _0x5c0a94(null,_0x1d407a);});}}return _0x5c0a94(_0x0e68('0x16'));})['catch'](function(_0xe6edb6){_0x5c0a94(_0xe6edb6);});})); \ No newline at end of file +var _0x2c90=['secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','User','map','emails','value','admin','user','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','minutes','getLicense','catch','lodash','passport','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','email','callback','use','clientID','clientSecret'];(function(_0xd06d80,_0x5579e7){var _0x4753d3=function(_0x39af5a){while(--_0x39af5a){_0xd06d80['push'](_0xd06d80['shift']());}};_0x4753d3(++_0x5579e7);}(_0x2c90,0x1b6));var _0x02c9=function(_0x407dc6,_0x2d2db9){_0x407dc6=_0x407dc6-0x0;var _0x119332=_0x2c90[_0x407dc6];return _0x119332;};'use strict';var _=require(_0x02c9('0x0'));var passport=require(_0x02c9('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x02c9('0x2')];var moment=require(_0x02c9('0x3'));var db=require(_0x02c9('0x4'))['db'];var config=require(_0x02c9('0x5'));var signToken=require(_0x02c9('0x6'))[_0x02c9('0x7')];var utils=require(_0x02c9('0x8'));exports[_0x02c9('0x9')]=passport[_0x02c9('0xa')](_0x02c9('0xb'),{'failureRedirect':_0x02c9('0xc'),'scope':['profile',_0x02c9('0xd')],'session':![]});exports[_0x02c9('0xe')]=passport['authenticate']('google',{'failureRedirect':'/login','session':![]});passport[_0x02c9('0xf')](new GoogleStrategy({'clientID':config[_0x02c9('0xb')]?config[_0x02c9('0xb')][_0x02c9('0x10')]:'id','clientSecret':config[_0x02c9('0xb')]?config[_0x02c9('0xb')][_0x02c9('0x11')]:_0x02c9('0x12'),'callbackURL':config[_0x02c9('0xb')]?config[_0x02c9('0xb')][_0x02c9('0x13')]:''},function(_0x4a4129,_0x128b8a,_0x331788,_0x4e8e80){var _0x5d1a9b,_0x5c5654;return db[_0x02c9('0x14')][_0x02c9('0x15')]({'where':{'id':0x1},'attributes':[_0x02c9('0x16'),_0x02c9('0x17')],'raw':!![]})['then'](function(_0x55a4f8){_0x5d1a9b=_0x55a4f8;return db[_0x02c9('0x18')]['find']({'where':{'email':_[_0x02c9('0x19')](_0x331788[_0x02c9('0x1a')],_0x02c9('0x1b')),'role':{'$or':[_0x02c9('0x1c'),_0x02c9('0x1d'),_0x02c9('0x1e')]}}});})[_0x02c9('0x1f')](function(_0x58ea41){_0x5c5654=_0x58ea41;if(_0x5c5654){if(_0x5c5654[_0x02c9('0x20')]){return _0x4e8e80(_0x02c9('0x21'));}else if(_0x5d1a9b['blockDuration']>0x0){if(_0x5c5654['blocked']){if(moment(_0x5c5654[_0x02c9('0x22')])['add'](_0x5d1a9b[_0x02c9('0x17')],_0x02c9('0x23'))>moment()){return _0x4e8e80('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils['clearBlockUser'](_0x5c5654,0x0,![],null)['then'](function(){return utils['getLicense'](_0x5c5654);})[_0x02c9('0x1f')](function(){return _0x4e8e80(null,_0x5c5654);});}}else{return utils[_0x02c9('0x24')](_0x5c5654)[_0x02c9('0x1f')](function(){return _0x4e8e80(null,_0x5c5654);});}}else{return utils[_0x02c9('0x24')](_0x5c5654)[_0x02c9('0x1f')](function(){return _0x4e8e80(null,_0x5c5654);});}}return _0x4e8e80(_0x02c9('0x21'));})[_0x02c9('0x25')](function(_0x3965df){_0x4e8e80(_0x3965df);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 506a417..338c62d 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 _0x59c3=['../../components/auth/service','login','get','/callback','callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x23c651,_0x143982){var _0xbe7bdb=function(_0x1979e2){while(--_0x1979e2){_0x23c651['push'](_0x23c651['shift']());}};_0xbe7bdb(++_0x143982);}(_0x59c3,0x133));var _0x359c=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x59c3[_0x521929];return _0x632436;};'use strict';var express=require(_0x359c('0x0'));var passport=require(_0x359c('0x1'));var router=express[_0x359c('0x2')]();var controller=require(_0x359c('0x3'));var userController=require(_0x359c('0x4'));var authService=require(_0x359c('0x5'));router['get']('/',controller[_0x359c('0x6')]);router[_0x359c('0x7')](_0x359c('0x8'),controller[_0x359c('0x9')],authService[_0x359c('0xa')],userController[_0x359c('0x6')],authService['setTokenCookie']);module[_0x359c('0xb')]=router; \ No newline at end of file +var _0x280f=['get','login','callback','isMiddleware','setTokenCookie','exports','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x280f,0xe2));var _0xf280=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x280f[_0x20cc29];return _0x28d513;};'use strict';var express=require(_0xf280('0x0'));var passport=require('passport');var router=express[_0xf280('0x1')]();var controller=require(_0xf280('0x2'));var userController=require(_0xf280('0x3'));var authService=require(_0xf280('0x4'));router[_0xf280('0x5')]('/',controller[_0xf280('0x6')]);router[_0xf280('0x5')]('/callback',controller[_0xf280('0x7')],authService[_0xf280('0x8')],userController[_0xf280('0x6')],authService[_0xf280('0x9')]);module[_0xf280('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index bed29b6..d8af504 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 _0xf494=['generate','User','disabled','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing'];(function(_0x13260f,_0xa44c9d){var _0x273293=function(_0x6924d5){while(--_0x6924d5){_0x13260f['push'](_0x13260f['shift']());}};_0x273293(++_0xa44c9d);}(_0xf494,0x1c6));var _0x4f49=function(_0x390a91,_0x2b63ae){_0x390a91=_0x390a91-0x0;var _0x53a24d=_0xf494[_0x390a91];return _0x53a24d;};'use strict';var util=require(_0x4f49('0x0'));var passport=require(_0x4f49('0x1'));var LocalStrategy=require(_0x4f49('0x2'))['Strategy'];var jayson=require(_0x4f49('0x3'));var _=require(_0x4f49('0x4'));var rs=require(_0x4f49('0x5'));var moment=require(_0x4f49('0x6'));var db=require(_0x4f49('0x7'))['db'];var authService=require(_0x4f49('0x8'));var utils=require(_0x4f49('0x9'));var client=jayson[_0x4f49('0xa')][_0x4f49('0xb')]({'port':0x232b});function localAuthenticate(_0x413530,_0x42b0e8,_0x5eb186,_0x58e9a0){var _0x169c95,_0x327bd5;return db[_0x4f49('0xc')][_0x4f49('0xd')]({'where':{'id':0x1},'attributes':[_0x4f49('0xe'),_0x4f49('0xf')],'raw':!![]})[_0x4f49('0x10')](function(_0x410884){_0x169c95=_0x410884;return _0x413530['findOne']({'attributes':['id',_0x4f49('0x11'),_0x4f49('0x12'),'salt',_0x4f49('0x13'),'disabled','blocked',_0x4f49('0x14'),_0x4f49('0x15')],'where':{'name':_0x42b0e8,'role':{'$or':['admin',_0x4f49('0x16'),_0x4f49('0x17')]}}});})[_0x4f49('0x10')](function(_0x2efe49){if(!_0x2efe49||_0x2efe49&&_0x2efe49[_0x4f49('0x11')]!==_0x42b0e8){throw new Error(_0x4f49('0x18'));}else{_0x327bd5=_0x2efe49;return _0x327bd5;}})[_0x4f49('0x10')](function(){_0x327bd5['authenticate'](_0x5eb186,function(_0x515ace,_0x1f2d0d){var _0x415e83=_0x327bd5['loginAttempts']+0x1;if(_0x515ace){return _0x58e9a0(_0x515ace);}else if(!_0x1f2d0d){if(_0x327bd5['disabled']){return _0x58e9a0(null,![],{'message':_0x4f49('0x18')});}else if(_0x169c95[_0x4f49('0xe')]>0x0){if(_0x327bd5[_0x4f49('0x19')]){if(_0x169c95['blockDuration']>0x0){if(moment(_0x327bd5[_0x4f49('0x14')])[_0x4f49('0x1a')](_0x169c95[_0x4f49('0xf')],'minutes')>moment()){return _0x58e9a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x327bd5,_0x415e83,![],null)['then'](function(){return _0x58e9a0(null,![],{'message':_0x4f49('0x18')});});}}else{return _0x58e9a0(null,![],{'message':_0x4f49('0x18')});}}else{if(_0x415e83>=_0x169c95[_0x4f49('0xe')]){return utils[_0x4f49('0x1b')](_0x327bd5,0x0,!![],moment())['then'](function(){return _0x58e9a0(null,![],{'message':_0x4f49('0x18')});});}else{return utils[_0x4f49('0x1b')](_0x327bd5,_0x415e83,![],null)[_0x4f49('0x10')](function(){return _0x58e9a0(null,![],{'message':_0x4f49('0x18')});});}}}else{return _0x58e9a0(null,![],{'message':_0x4f49('0x18')});}}else{if(_0x327bd5['disabled']){return _0x58e9a0(null,![],{'message':_0x4f49('0x18')});}else if(_0x169c95[_0x4f49('0xe')]>0x0){if(_0x327bd5[_0x4f49('0x19')]){if(_0x169c95['blockDuration']>0x0){if(moment(_0x327bd5[_0x4f49('0x14')])[_0x4f49('0x1a')](_0x169c95[_0x4f49('0xf')],_0x4f49('0x1c'))>moment()){return _0x58e9a0(null,![],{'message':_0x4f49('0x18')});}else{return utils[_0x4f49('0x1b')](_0x327bd5,0x0,![],null)['then'](function(){return utils['getLicense'](_0x327bd5);})[_0x4f49('0x10')](function(){return _0x58e9a0(null,_0x327bd5);});}}else{return _0x58e9a0(null,![],{'message':_0x4f49('0x18')});}}else{return utils['clearBlockUser'](_0x327bd5,0x0,![],null)[_0x4f49('0x10')](function(){return utils[_0x4f49('0x1d')](_0x327bd5);})[_0x4f49('0x10')](function(){return _0x58e9a0(null,_0x327bd5);})['catch'](function(_0xc54070){return _0x58e9a0(null,![],_0xc54070);});}}else{if(_0x327bd5[_0x4f49('0x19')]){return _0x58e9a0(null,![],{'message':_0x4f49('0x18')});}else{return utils[_0x4f49('0x1d')](_0x327bd5)[_0x4f49('0x10')](function(){return _0x58e9a0(null,_0x327bd5);});}}}});})[_0x4f49('0x1e')](function(_0x4915af){return _0x58e9a0(null,![],_0x4915af);});}function sendServiceMail(_0x50c571){return db[_0x4f49('0x1f')][_0x4f49('0x20')]({'where':{'service':!![]},'attributes':['id',_0x4f49('0x11'),'email'],'include':[{'model':db[_0x4f49('0x21')],'as':_0x4f49('0x22')}]})[_0x4f49('0x10')](function(_0x506b20){if(!_0x506b20){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3e207f={'tls':{'rejectUnauthorized':![]}};if(_0x506b20[_0x4f49('0x22')][_0x4f49('0x23')]){_0x3e207f['service']=_0x506b20[_0x4f49('0x22')][_0x4f49('0x23')];}else{_0x3e207f[_0x4f49('0x24')]=_0x506b20[_0x4f49('0x22')][_0x4f49('0x24')];_0x3e207f[_0x4f49('0x25')]=_0x506b20[_0x4f49('0x22')][_0x4f49('0x25')];_0x3e207f[_0x4f49('0x26')]=_0x506b20[_0x4f49('0x22')][_0x4f49('0x26')];}if(_0x506b20[_0x4f49('0x22')][_0x4f49('0x27')]){_0x3e207f[_0x4f49('0x28')]={'user':_0x506b20[_0x4f49('0x22')][_0x4f49('0x16')],'pass':_0x506b20[_0x4f49('0x22')][_0x4f49('0x29')]};}var _0x3e7a08={'account':_0x3e207f,'message':_['merge']({'from':util[_0x4f49('0x2a')](_0x4f49('0x2b'),_0x506b20[_0x4f49('0x11')],_0x506b20[_0x4f49('0x2c')]||_0x506b20[_0x4f49('0x22')][_0x4f49('0x16')])},_0x50c571)};return client[_0x4f49('0x2d')](_0x4f49('0x2e'),_0x3e7a08);})[_0x4f49('0x10')](function(_0x338db8){if(_0x338db8[_0x4f49('0x2f')]){throw new Error(util[_0x4f49('0x2a')](_0x4f49('0x30'),_0x338db8['error'][_0x4f49('0x31')]||JSON[_0x4f49('0x32')](_0x338db8[_0x4f49('0x2f')])));}return!![];});}function handleError(_0x26014f,_0x1c1e9b,_0x3ee818){return _0x26014f[_0x4f49('0x33')](_0x1c1e9b||0x1f4)[_0x4f49('0x34')]({'message':_0x3ee818?_0x3ee818[_0x4f49('0x31')]||_0x3ee818:''});}exports[_0x4f49('0x35')]=function(_0x173b6e,_0x141db,_0x19219c){passport[_0x4f49('0x36')]('local',function(_0x802f20,_0xb0e6c2,_0x543605){var _0x2b7eed=_0x802f20||_0x543605;if(_0x2b7eed){return handleError(_0x141db,0x191,_0x2b7eed);}if(!_0xb0e6c2){return handleError(_0x141db,0x194,{'message':_0x4f49('0x37')});}else{var _0x560938={'payload':{'id':_0xb0e6c2['id'],'role':_0xb0e6c2[_0x4f49('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0x4f49('0x38')](_0x560938)[_0x4f49('0x10')](function(_0x200b1d){_0x141db[_0x4f49('0x39')]({'id':_0xb0e6c2['id'],'token':_0x200b1d,'statusCall':'','isAlreadyLogged':_0xb0e6c2[_0x4f49('0x3a')]});});}})(_0x173b6e,_0x141db,_0x19219c);};exports[_0x4f49('0x3b')]=function(_0x5d464e,_0x5e1461,_0x55960a){if(!_0x5d464e[_0x4f49('0x3c')][_0x4f49('0x2c')]){return handleError(_0x5e1461,0x1f4,{'message':_0x4f49('0x3d')});}var _0x373f90=rs[_0x4f49('0x3e')]();_0x5d464e[_0x4f49('0x3c')][_0x4f49('0x2c')]=_0x5d464e[_0x4f49('0x3c')][_0x4f49('0x2c')]['trim']()['toLowerCase']();var _0x412395;return db[_0x4f49('0xc')][_0x4f49('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x4f49('0xf')],'raw':!![]})['then'](function(_0x4b1fcc){_0x412395=_0x4b1fcc;return db[_0x4f49('0x3f')][_0x4f49('0x20')]({'where':{'email':_0x5d464e[_0x4f49('0x3c')]['email']}});})[_0x4f49('0x10')](function(_0x11b4df){if(!_0x11b4df){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x11b4df[_0x4f49('0x40')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x11b4df[_0x4f49('0x19')]){if(moment(_0x11b4df[_0x4f49('0x14')])[_0x4f49('0x1a')](_0x412395['blockDuration'],_0x4f49('0x1c'))>moment()){throw new Error(_0x4f49('0x41'));}else{_0x11b4df[_0x4f49('0x19')]=![];_0x11b4df[_0x4f49('0x14')]=null;}}_0x11b4df[_0x4f49('0x42')]=_0x373f90;_0x11b4df[_0x4f49('0x43')]=Date[_0x4f49('0x44')]()+0x36ee80;return _0x11b4df[_0x4f49('0x45')]();})[_0x4f49('0x10')](function(){return sendServiceMail({'to':_0x5d464e[_0x4f49('0x3c')]['email'],'subject':_0x4f49('0x46'),'text':_0x4f49('0x47')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x4f49('0x48')+_0x5d464e['headers'][_0x4f49('0x24')]+_0x4f49('0x49')+_0x373f90+'\x0a\x0a'+_0x4f49('0x4a')});})[_0x4f49('0x10')](function(){_0x5e1461['status'](0xc8)[_0x4f49('0x34')]({'message':_0x4f49('0x4b')});})[_0x4f49('0x1e')](function(_0x973099){return handleError(_0x5e1461,0x1f4,_0x973099);});};exports[_0x4f49('0x4c')]=function(_0x72ea05,_0x37fdb7,_0xd282c){return db[_0x4f49('0x3f')][_0x4f49('0x20')]({'where':{'resetPasswordToken':_0x72ea05[_0x4f49('0x4d')][_0x4f49('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x4f49('0x44')]()}}})[_0x4f49('0x10')](function(_0x26464c){if(!_0x26464c){throw new Error(_0x4f49('0x4f'));}return db['Setting']['findOne']({'attributes':['id',_0x4f49('0x50'),_0x4f49('0x51'),_0x4f49('0x52')]})[_0x4f49('0x10')](function(_0x344f8e){if(_0x344f8e[_0x4f49('0x50')])authService[_0x4f49('0x53')](_0x72ea05['body'][_0x4f49('0x12')]);if(!_0x344f8e['enforcePasswordHistory']||!_0x26464c[_0x4f49('0x54')])return _0x26464c;authService[_0x4f49('0x55')](_0x72ea05[_0x4f49('0x3c')][_0x4f49('0x12')],_0x26464c['previousPasswords'],_0x344f8e[_0x4f49('0x52')]);return _0x26464c;})['then'](function(){_0x26464c['password']=_0x72ea05[_0x4f49('0x3c')][_0x4f49('0x12')];_0x26464c[_0x4f49('0x42')]=null;_0x26464c[_0x4f49('0x43')]=null;return _0x26464c['save']();});})['then'](function(){_0x37fdb7[_0x4f49('0x33')](0xc8)[_0x4f49('0x34')]({'message':'Password\x20reset!'});})[_0x4f49('0x1e')](function(_0x5b50bc){return handleError(_0x37fdb7,0x1f4,_0x5b50bc);});};passport['use'](new LocalStrategy({'usernameField':_0x4f49('0x11'),'passwordField':'password'},function(_0xfa7dd6,_0x492aaa,_0xccd455){return localAuthenticate(db[_0x4f49('0x3f')],_0xfa7dd6,_0x492aaa,_0xccd455);})); \ No newline at end of file +var _0x2d72=['../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','name','password','salt','blocked','loginAttempts','admin','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','service','Smtp','host','port','secure','authentication','user','pass','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','body','generate','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment'];(function(_0x58bfd4,_0x2b9431){var _0x3268d3=function(_0x1afb14){while(--_0x1afb14){_0x58bfd4['push'](_0x58bfd4['shift']());}};_0x3268d3(++_0x2b9431);}(_0x2d72,0xa8));var _0x22d7=function(_0x64b57e,_0x50515a){_0x64b57e=_0x64b57e-0x0;var _0x2266e0=_0x2d72[_0x64b57e];return _0x2266e0;};'use strict';var util=require(_0x22d7('0x0'));var passport=require(_0x22d7('0x1'));var LocalStrategy=require(_0x22d7('0x2'))[_0x22d7('0x3')];var jayson=require(_0x22d7('0x4'));var _=require(_0x22d7('0x5'));var rs=require(_0x22d7('0x6'));var moment=require(_0x22d7('0x7'));var db=require(_0x22d7('0x8'))['db'];var authService=require(_0x22d7('0x9'));var utils=require(_0x22d7('0xa'));var client=jayson[_0x22d7('0xb')][_0x22d7('0xc')]({'port':0x232b});function localAuthenticate(_0x100426,_0x52a3e3,_0x23a731,_0x3791d6){var _0x492ca8,_0x3b12cd;return db[_0x22d7('0xd')][_0x22d7('0xe')]({'where':{'id':0x1},'attributes':[_0x22d7('0xf'),'blockDuration'],'raw':!![]})['then'](function(_0x1810b8){_0x492ca8=_0x1810b8;return _0x100426[_0x22d7('0xe')]({'attributes':['id',_0x22d7('0x10'),_0x22d7('0x11'),_0x22d7('0x12'),'role','disabled',_0x22d7('0x13'),'blockedAt',_0x22d7('0x14')],'where':{'name':_0x52a3e3,'role':{'$or':[_0x22d7('0x15'),'user',_0x22d7('0x16')]}}});})[_0x22d7('0x17')](function(_0x204439){if(!_0x204439||_0x204439&&_0x204439[_0x22d7('0x10')]!==_0x52a3e3){throw new Error(_0x22d7('0x18'));}else{_0x3b12cd=_0x204439;return _0x3b12cd;}})[_0x22d7('0x17')](function(){_0x3b12cd[_0x22d7('0x19')](_0x23a731,function(_0x286a87,_0x534223){var _0x352a78=_0x3b12cd[_0x22d7('0x14')]+0x1;if(_0x286a87){return _0x3791d6(_0x286a87);}else if(!_0x534223){if(_0x3b12cd[_0x22d7('0x1a')]){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x492ca8['allowedLoginAttempts']>0x0){if(_0x3b12cd['blocked']){if(_0x492ca8[_0x22d7('0x1b')]>0x0){if(moment(_0x3b12cd[_0x22d7('0x1c')])[_0x22d7('0x1d')](_0x492ca8[_0x22d7('0x1b')],_0x22d7('0x1e'))>moment()){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x22d7('0x1f')](_0x3b12cd,_0x352a78,![],null)[_0x22d7('0x17')](function(){return _0x3791d6(null,![],{'message':_0x22d7('0x18')});});}}else{return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x352a78>=_0x492ca8[_0x22d7('0xf')]){return utils[_0x22d7('0x1f')](_0x3b12cd,0x0,!![],moment())[_0x22d7('0x17')](function(){return _0x3791d6(null,![],{'message':_0x22d7('0x18')});});}else{return utils[_0x22d7('0x1f')](_0x3b12cd,_0x352a78,![],null)['then'](function(){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3791d6(null,![],{'message':_0x22d7('0x18')});}}else{if(_0x3b12cd[_0x22d7('0x1a')]){return _0x3791d6(null,![],{'message':_0x22d7('0x18')});}else if(_0x492ca8[_0x22d7('0xf')]>0x0){if(_0x3b12cd['blocked']){if(_0x492ca8[_0x22d7('0x1b')]>0x0){if(moment(_0x3b12cd[_0x22d7('0x1c')])[_0x22d7('0x1d')](_0x492ca8['blockDuration'],_0x22d7('0x1e'))>moment()){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x22d7('0x1f')](_0x3b12cd,0x0,![],null)[_0x22d7('0x17')](function(){return utils[_0x22d7('0x20')](_0x3b12cd);})['then'](function(){return _0x3791d6(null,_0x3b12cd);});}}else{return _0x3791d6(null,![],{'message':_0x22d7('0x18')});}}else{return utils['clearBlockUser'](_0x3b12cd,0x0,![],null)['then'](function(){return utils[_0x22d7('0x20')](_0x3b12cd);})[_0x22d7('0x17')](function(){return _0x3791d6(null,_0x3b12cd);})[_0x22d7('0x21')](function(_0x27998a){return _0x3791d6(null,![],_0x27998a);});}}else{if(_0x3b12cd[_0x22d7('0x13')]){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x22d7('0x20')](_0x3b12cd)[_0x22d7('0x17')](function(){return _0x3791d6(null,_0x3b12cd);});}}}});})[_0x22d7('0x21')](function(_0xce7f15){return _0x3791d6(null,![],_0xce7f15);});}function sendServiceMail(_0x45dc29){return db['MailAccount'][_0x22d7('0x22')]({'where':{'service':!![]},'attributes':['id',_0x22d7('0x10'),_0x22d7('0x23')],'include':[{'model':db[_0x22d7('0x24')],'as':'Smtp'}]})[_0x22d7('0x17')](function(_0x21c334){if(!_0x21c334){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5a672d={'tls':{'rejectUnauthorized':![]}};if(_0x21c334['Smtp'][_0x22d7('0x25')]){_0x5a672d[_0x22d7('0x25')]=_0x21c334[_0x22d7('0x26')]['service'];}else{_0x5a672d[_0x22d7('0x27')]=_0x21c334['Smtp'][_0x22d7('0x27')];_0x5a672d[_0x22d7('0x28')]=_0x21c334[_0x22d7('0x26')][_0x22d7('0x28')];_0x5a672d[_0x22d7('0x29')]=_0x21c334[_0x22d7('0x26')]['secure'];}if(_0x21c334['Smtp'][_0x22d7('0x2a')]){_0x5a672d['auth']={'user':_0x21c334[_0x22d7('0x26')][_0x22d7('0x2b')],'pass':_0x21c334[_0x22d7('0x26')][_0x22d7('0x2c')]};}var _0x3b8d37={'account':_0x5a672d,'message':_['merge']({'from':util['format'](_0x22d7('0x2d'),_0x21c334['name'],_0x21c334['email']||_0x21c334[_0x22d7('0x26')]['user'])},_0x45dc29)};return client[_0x22d7('0x2e')](_0x22d7('0x2f'),_0x3b8d37);})[_0x22d7('0x17')](function(_0x5976d6){if(_0x5976d6[_0x22d7('0x30')]){throw new Error(util[_0x22d7('0x31')](_0x22d7('0x32'),_0x5976d6[_0x22d7('0x30')][_0x22d7('0x33')]||JSON[_0x22d7('0x34')](_0x5976d6[_0x22d7('0x30')])));}return!![];});}function handleError(_0x158ccd,_0x4f487d,_0x52e1ae){return _0x158ccd[_0x22d7('0x35')](_0x4f487d||0x1f4)[_0x22d7('0x36')]({'message':_0x52e1ae?_0x52e1ae[_0x22d7('0x33')]||_0x52e1ae:''});}exports[_0x22d7('0x37')]=function(_0x4bc6cc,_0x33239e,_0x5191d1){passport['authenticate'](_0x22d7('0x38'),function(_0x296ad3,_0x3b7808,_0x431592){var _0x798f9a=_0x296ad3||_0x431592;if(_0x798f9a){return handleError(_0x33239e,0x191,_0x798f9a);}if(!_0x3b7808){return handleError(_0x33239e,0x194,{'message':_0x22d7('0x39')});}else{var _0x33d434={'payload':{'id':_0x3b7808['id'],'role':_0x3b7808[_0x22d7('0x3a')]},'options':{'expiresIn':0x15180}};return authService[_0x22d7('0x3b')](_0x33d434)[_0x22d7('0x17')](function(_0x3b30b5){_0x33239e[_0x22d7('0x3c')]({'id':_0x3b7808['id'],'token':_0x3b30b5,'statusCall':'','isAlreadyLogged':_0x3b7808[_0x22d7('0x3d')]});});}})(_0x4bc6cc,_0x33239e,_0x5191d1);};exports['forgot']=function(_0x3f2cdb,_0x1033a2,_0x1aa4d8){if(!_0x3f2cdb[_0x22d7('0x3e')][_0x22d7('0x23')]){return handleError(_0x1033a2,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x53b10f=rs[_0x22d7('0x3f')]();_0x3f2cdb[_0x22d7('0x3e')][_0x22d7('0x23')]=_0x3f2cdb[_0x22d7('0x3e')]['email']['trim']()[_0x22d7('0x40')]();var _0x4613b2;return db['Setting'][_0x22d7('0xe')]({'where':{'id':0x1},'attributes':[_0x22d7('0xf'),_0x22d7('0x1b')],'raw':!![]})[_0x22d7('0x17')](function(_0x32f8ef){_0x4613b2=_0x32f8ef;return db['User']['find']({'where':{'email':_0x3f2cdb['body'][_0x22d7('0x23')]}});})[_0x22d7('0x17')](function(_0xbdc416){if(!_0xbdc416){throw new Error(_0x22d7('0x41'));}if(_0xbdc416[_0x22d7('0x1a')]){throw new Error(_0x22d7('0x42'));}if(_0xbdc416[_0x22d7('0x13')]){if(moment(_0xbdc416[_0x22d7('0x1c')])['add'](_0x4613b2[_0x22d7('0x1b')],'minutes')>moment()){throw new Error(_0x22d7('0x43'));}else{_0xbdc416[_0x22d7('0x13')]=![];_0xbdc416[_0x22d7('0x1c')]=null;}}_0xbdc416[_0x22d7('0x44')]=_0x53b10f;_0xbdc416['resetPasswordExpires']=Date['now']()+0x36ee80;return _0xbdc416[_0x22d7('0x45')]();})[_0x22d7('0x17')](function(){return sendServiceMail({'to':_0x3f2cdb[_0x22d7('0x3e')][_0x22d7('0x23')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x22d7('0x46')+'https://'+_0x3f2cdb[_0x22d7('0x47')][_0x22d7('0x27')]+'/reset/'+_0x53b10f+'\x0a\x0a'+_0x22d7('0x48')});})[_0x22d7('0x17')](function(){_0x1033a2[_0x22d7('0x35')](0xc8)[_0x22d7('0x36')]({'message':_0x22d7('0x49')});})['catch'](function(_0x2e9dcf){return handleError(_0x1033a2,0x1f4,_0x2e9dcf);});};exports[_0x22d7('0x4a')]=function(_0x43edb0,_0x447938,_0x35206a){return db[_0x22d7('0x4b')][_0x22d7('0x22')]({'where':{'resetPasswordToken':_0x43edb0[_0x22d7('0x4c')][_0x22d7('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x22d7('0x4e')]()}}})[_0x22d7('0x17')](function(_0x4c4a7d){if(!_0x4c4a7d){throw new Error(_0x22d7('0x4f'));}return db[_0x22d7('0xd')][_0x22d7('0xe')]({'attributes':['id',_0x22d7('0x50'),_0x22d7('0x51'),_0x22d7('0x52')]})[_0x22d7('0x17')](function(_0xf7e694){if(_0xf7e694[_0x22d7('0x50')])authService['validatePasswordPattern'](_0x43edb0[_0x22d7('0x3e')][_0x22d7('0x11')]);if(!_0xf7e694[_0x22d7('0x51')]||!_0x4c4a7d['previousPasswords'])return _0x4c4a7d;authService[_0x22d7('0x53')](_0x43edb0['body'][_0x22d7('0x11')],_0x4c4a7d[_0x22d7('0x54')],_0xf7e694[_0x22d7('0x52')]);return _0x4c4a7d;})['then'](function(){_0x4c4a7d[_0x22d7('0x11')]=_0x43edb0['body'][_0x22d7('0x11')];_0x4c4a7d[_0x22d7('0x44')]=null;_0x4c4a7d[_0x22d7('0x55')]=null;return _0x4c4a7d[_0x22d7('0x45')]();});})['then'](function(){_0x447938[_0x22d7('0x35')](0xc8)[_0x22d7('0x36')]({'message':_0x22d7('0x56')});})['catch'](function(_0x22d330){return handleError(_0x447938,0x1f4,_0x22d330);});};passport[_0x22d7('0x57')](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x221542,_0x1c20ca,_0x3ee60f){return localAuthenticate(db[_0x22d7('0x4b')],_0x221542,_0x1c20ca,_0x3ee60f);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 914aec4..1302bec 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 _0x5867=['express','Router','./authLocal.controller','post','forgot','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5867,0x9c));var _0x7586=function(_0x443533,_0x523dff){_0x443533=_0x443533-0x0;var _0x5b664b=_0x5867[_0x443533];return _0x5b664b;};'use strict';var express=require(_0x7586('0x0'));var router=express[_0x7586('0x1')]();var controller=require(_0x7586('0x2'));router[_0x7586('0x3')]('/',controller['login']);router[_0x7586('0x3')]('/forgot',controller[_0x7586('0x4')]);router['post']('/reset/:token',controller['reset']);module[_0x7586('0x5')]=router; \ No newline at end of file +var _0x2c58=['./authLocal.controller','post','login','/forgot','/reset/:token','reset','exports','express'];(function(_0x240a29,_0x2e281c){var _0x67dac5=function(_0x558f32){while(--_0x558f32){_0x240a29['push'](_0x240a29['shift']());}};_0x67dac5(++_0x2e281c);}(_0x2c58,0x147));var _0x82c5=function(_0x23d3f9,_0xaa163e){_0x23d3f9=_0x23d3f9-0x0;var _0x30c37f=_0x2c58[_0x23d3f9];return _0x30c37f;};'use strict';var express=require(_0x82c5('0x0'));var router=express['Router']();var controller=require(_0x82c5('0x1'));router[_0x82c5('0x2')]('/',controller[_0x82c5('0x3')]);router['post'](_0x82c5('0x4'),controller['forgot']);router[_0x82c5('0x2')](_0x82c5('0x5'),controller[_0x82c5('0x6')]);module[_0x82c5('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 529dffb..bec6a70 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 _0x5994=['INTEGER','exports'];(function(_0x4a74e4,_0x59f363){var _0x5f561a=function(_0x51832f){while(--_0x51832f){_0x4a74e4['push'](_0x4a74e4['shift']());}};_0x5f561a(++_0x59f363);}(_0x5994,0x16d));var _0x4599=function(_0xa3bd04,_0x3db612){_0xa3bd04=_0xa3bd04-0x0;var _0x352934=_0x5994[_0xa3bd04];return _0x352934;};'use strict';var Sequelize=require('sequelize');module[_0x4599('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4599('0x1')],'defaultValue':0xa}}; \ No newline at end of file +var _0xb4e0=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x2231bd,_0x4a7050){var _0x51385f=function(_0x596d1f){while(--_0x596d1f){_0x2231bd['push'](_0x2231bd['shift']());}};_0x51385f(++_0x4a7050);}(_0xb4e0,0xb3));var _0x0b4e=function(_0x1dd344,_0x239356){_0x1dd344=_0x1dd344-0x0;var _0x433de4=_0xb4e0[_0x1dd344];return _0x433de4;};'use strict';var Sequelize=require('sequelize');module[_0x0b4e('0x0')]={'name':{'type':Sequelize[_0x0b4e('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x0b4e('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x0b4e('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0b4e('0x3')],'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 eee8db1..76a20d2 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 _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x1922fd,_0xf50574){var _0xc5238c=function(_0x1eff74){while(--_0x1eff74){_0x1922fd['push'](_0x1922fd['shift']());}};_0xc5238c(++_0xf50574);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file +var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x3c6c9d,_0x3ecf9){var _0x2c8eba=function(_0x4495e1){while(--_0x4495e1){_0x3c6c9d['push'](_0x3c6c9d['shift']());}};_0x2c8eba(++_0x3ecf9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 224c070..4c81f9e 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 _0xa5df=['moment','path','./automation.attributes','tools_automations','lodash','util'];(function(_0x4f663e,_0x25fbbf){var _0x404ce1=function(_0x2c18c4){while(--_0x2c18c4){_0x4f663e['push'](_0x4f663e['shift']());}};_0x404ce1(++_0x25fbbf);}(_0xa5df,0xe8));var _0xfa5d=function(_0x46a9f4,_0x37d9ab){_0x46a9f4=_0x46a9f4-0x0;var _0x2adf14=_0xa5df[_0x46a9f4];return _0x2adf14;};'use strict';var _=require(_0xfa5d('0x0'));var util=require(_0xfa5d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfa5d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa5d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa5d('0x4'));module['exports']=function(_0x5b6605,_0x5c2de1){return _0x5b6605['define']('Automation',attributes,{'tableName':_0xfa5d('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e36=['api','moment','bluebird','rimraf','../../config/environment','./automation.attributes','exports','Automation','util'];(function(_0x1486ee,_0x37885b){var _0x5928a6=function(_0x4f3b75){while(--_0x4f3b75){_0x1486ee['push'](_0x1486ee['shift']());}};_0x5928a6(++_0x37885b);}(_0x1e36,0x131));var _0x61e3=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0x1e36[_0x430459];return _0x3a2439;};'use strict';var _=require('lodash');var util=require(_0x61e3('0x0'));var logger=require('../../config/logger')(_0x61e3('0x1'));var moment=require(_0x61e3('0x2'));var BPromise=require(_0x61e3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x61e3('0x4'));var config=require(_0x61e3('0x5'));var attributes=require(_0x61e3('0x6'));module[_0x61e3('0x7')]=function(_0x149946,_0x5998c9){return _0x149946['define'](_0x61e3('0x8'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index c49e562..1d96283 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 _0xbeff=['catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x6450b7,_0xe54ce8){var _0x37539d=function(_0x2678d0){while(--_0x2678d0){_0x6450b7['push'](_0x6450b7['shift']());}};_0x37539d(++_0xe54ce8);}(_0xbeff,0x14b));var _0xfbef=function(_0x2fbd4d,_0x61ee22){_0x2fbd4d=_0x2fbd4d-0x0;var _0x5008ab=_0xbeff[_0x2fbd4d];return _0x5008ab;};'use strict';var _=require(_0xfbef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfbef('0x1'));var rs=require(_0xfbef('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbef('0x3'))['db'];var utils=require(_0xfbef('0x4'));var logger=require(_0xfbef('0x5'))(_0xfbef('0x6'));var config=require(_0xfbef('0x7'));var jayson=require(_0xfbef('0x8'));var client=jayson[_0xfbef('0x9')][_0xfbef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d9f2b,_0x248276,_0x258ee6){return new BPromise(function(_0x4c4808,_0x1b1fcc){return client[_0xfbef('0xb')](_0x2d9f2b,_0x258ee6)['then'](function(_0x2e9cd9){logger[_0xfbef('0xc')](_0xfbef('0xd'),_0x248276,_0xfbef('0xe'));logger[_0xfbef('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x248276,_0xfbef('0xe'),JSON[_0xfbef('0x10')](_0x2e9cd9));if(_0x2e9cd9[_0xfbef('0x11')]){if(_0x2e9cd9['error'][_0xfbef('0x12')]===0x1f4){logger[_0xfbef('0x11')](_0xfbef('0xd'),_0x248276,_0x2e9cd9[_0xfbef('0x11')][_0xfbef('0x13')]);return _0x1b1fcc(_0x2e9cd9[_0xfbef('0x11')][_0xfbef('0x13')]);}logger[_0xfbef('0x11')](_0xfbef('0xd'),_0x248276,_0x2e9cd9['error']['message']);return _0x4c4808(_0x2e9cd9[_0xfbef('0x11')][_0xfbef('0x13')]);}else{logger[_0xfbef('0xc')](_0xfbef('0xd'),_0x248276,'request\x20sent');_0x4c4808(_0x2e9cd9[_0xfbef('0x14')]['message']);}})[_0xfbef('0x15')](function(_0x59ec33){logger['error'](_0xfbef('0xd'),_0x248276,_0x59ec33);_0x1b1fcc(_0x59ec33);});});} \ No newline at end of file +var _0xd245=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x58f8d6,_0x3de6e9){var _0x249399=function(_0x5a2d88){while(--_0x5a2d88){_0x58f8d6['push'](_0x58f8d6['shift']());}};_0x249399(++_0x3de6e9);}(_0xd245,0x12a));var _0x5d24=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0xd245[_0x502953];return _0x2fa32d;};'use strict';var _=require(_0x5d24('0x0'));var util=require(_0x5d24('0x1'));var moment=require('moment');var BPromise=require(_0x5d24('0x2'));var rs=require(_0x5d24('0x3'));var fs=require('fs');var Redis=require(_0x5d24('0x4'));var db=require(_0x5d24('0x5'))['db'];var utils=require(_0x5d24('0x6'));var logger=require(_0x5d24('0x7'))(_0x5d24('0x8'));var config=require(_0x5d24('0x9'));var jayson=require(_0x5d24('0xa'));var client=jayson[_0x5d24('0xb')][_0x5d24('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5218db,_0x2cdd4a,_0x27d80e){return new BPromise(function(_0x36d11f,_0x26cf34){return client[_0x5d24('0xd')](_0x5218db,_0x27d80e)['then'](function(_0x4fda07){logger[_0x5d24('0xe')]('Automation,\x20%s,\x20%s',_0x2cdd4a,_0x5d24('0xf'));logger[_0x5d24('0x10')](_0x5d24('0x11'),_0x2cdd4a,'request\x20sent',JSON[_0x5d24('0x12')](_0x4fda07));if(_0x4fda07[_0x5d24('0x13')]){if(_0x4fda07[_0x5d24('0x13')][_0x5d24('0x14')]===0x1f4){logger[_0x5d24('0x13')](_0x5d24('0x15'),_0x2cdd4a,_0x4fda07[_0x5d24('0x13')][_0x5d24('0x16')]);return _0x26cf34(_0x4fda07[_0x5d24('0x13')][_0x5d24('0x16')]);}logger['error'](_0x5d24('0x15'),_0x2cdd4a,_0x4fda07[_0x5d24('0x13')][_0x5d24('0x16')]);return _0x36d11f(_0x4fda07[_0x5d24('0x13')][_0x5d24('0x16')]);}else{logger['info'](_0x5d24('0x15'),_0x2cdd4a,'request\x20sent');_0x36d11f(_0x4fda07[_0x5d24('0x17')][_0x5d24('0x16')]);}})[_0x5d24('0x18')](function(_0x2d3a81){logger[_0x5d24('0x13')]('Automation,\x20%s,\x20%s',_0x2cdd4a,_0x2d3a81);_0x26cf34(_0x2d3a81);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 96fe282..f0cc90b 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 _0x8d41=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','index','get','/:id','isAuthenticated','show','/:id/conditions','post','addConditions','/:id/actions','addActions','delete','destroy'];(function(_0x1a978d,_0x11f0e0){var _0x308ade=function(_0x122626){while(--_0x122626){_0x1a978d['push'](_0x1a978d['shift']());}};_0x308ade(++_0x11f0e0);}(_0x8d41,0x12c));var _0x18d4=function(_0x56ef59,_0x2d1bc9){_0x56ef59=_0x56ef59-0x0;var _0x2432a6=_0x8d41[_0x56ef59];return _0x2432a6;};'use strict';var multer=require(_0x18d4('0x0'));var util=require(_0x18d4('0x1'));var path=require(_0x18d4('0x2'));var timeout=require(_0x18d4('0x3'));var express=require(_0x18d4('0x4'));var router=express[_0x18d4('0x5')]();var auth=require(_0x18d4('0x6'));var interaction=require(_0x18d4('0x7'));var config=require(_0x18d4('0x8'));var controller=require(_0x18d4('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x18d4('0xa')]);router[_0x18d4('0xb')](_0x18d4('0xc'),auth[_0x18d4('0xd')](),controller[_0x18d4('0xe')]);router[_0x18d4('0xb')](_0x18d4('0xf'),auth[_0x18d4('0xd')](),controller['getConditions']);router[_0x18d4('0xb')]('/:id/actions',auth[_0x18d4('0xd')](),controller['getActions']);router[_0x18d4('0x10')]('/',auth[_0x18d4('0xd')](),controller['create']);router['post']('/:id/conditions',auth[_0x18d4('0xd')](),controller[_0x18d4('0x11')]);router[_0x18d4('0x10')](_0x18d4('0x12'),auth[_0x18d4('0xd')](),controller[_0x18d4('0x13')]);router['put'](_0x18d4('0xc'),auth[_0x18d4('0xd')](),controller['update']);router[_0x18d4('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x18d4('0x15')]);module[_0x18d4('0x16')]=router; \ No newline at end of file +var _0xcefd=['getActions','create','post','addActions','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions'];(function(_0x1e83ce,_0x49f4e3){var _0x3ae04f=function(_0x487902){while(--_0x487902){_0x1e83ce['push'](_0x1e83ce['shift']());}};_0x3ae04f(++_0x49f4e3);}(_0xcefd,0x1bd));var _0xdcef=function(_0x5b2cff,_0x43db7a){_0x5b2cff=_0x5b2cff-0x0;var _0x1a1288=_0xcefd[_0x5b2cff];return _0x1a1288;};'use strict';var multer=require('multer');var util=require(_0xdcef('0x0'));var path=require(_0xdcef('0x1'));var timeout=require(_0xdcef('0x2'));var express=require(_0xdcef('0x3'));var router=express[_0xdcef('0x4')]();var auth=require(_0xdcef('0x5'));var interaction=require(_0xdcef('0x6'));var config=require('../../config/environment');var controller=require(_0xdcef('0x7'));router[_0xdcef('0x8')]('/',auth[_0xdcef('0x9')](),controller[_0xdcef('0xa')]);router[_0xdcef('0x8')]('/:id',auth[_0xdcef('0x9')](),controller[_0xdcef('0xb')]);router[_0xdcef('0x8')](_0xdcef('0xc'),auth['isAuthenticated'](),controller[_0xdcef('0xd')]);router[_0xdcef('0x8')](_0xdcef('0xe'),auth['isAuthenticated'](),controller[_0xdcef('0xf')]);router['post']('/',auth[_0xdcef('0x9')](),controller[_0xdcef('0x10')]);router[_0xdcef('0x11')](_0xdcef('0xc'),auth[_0xdcef('0x9')](),controller['addConditions']);router[_0xdcef('0x11')](_0xdcef('0xe'),auth['isAuthenticated'](),controller[_0xdcef('0x12')]);router['put'](_0xdcef('0x13'),auth[_0xdcef('0x9')](),controller[_0xdcef('0x14')]);router[_0xdcef('0x15')]('/:id',auth[_0xdcef('0x9')](),controller[_0xdcef('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 6f10961..3a82bf8 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 _0x0023=['#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN'];(function(_0x5d0fd8,_0x5c998d){var _0x1f9cbd=function(_0x28aa5e){while(--_0x28aa5e){_0x5d0fd8['push'](_0x5d0fd8['shift']());}};_0x1f9cbd(++_0x5c998d);}(_0x0023,0xdc));var _0x3002=function(_0x1293fa,_0x446d6b){_0x1293fa=_0x1293fa-0x0;var _0x1dd054=_0x0023[_0x1293fa];return _0x1dd054;};'use strict';var Sequelize=require(_0x3002('0x0'));module['exports']={'name':{'type':Sequelize[_0x3002('0x1')],'unique':_0x3002('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x3002('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x3002('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3002('0x5')},'limitCalls':{'type':Sequelize[_0x3002('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3002('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3002('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3002('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x3002('0x6')](0x3)[_0x3002('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x3002('0x6')](0x3)[_0x3002('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3002('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3002('0x6')](0x5)[_0x3002('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3002('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3002('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3002('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3002('0x6')](0x3)[_0x3002('0x8')],'defaultValue':0x3,'comment':_0x3002('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3002('0x6')](0x5)[_0x3002('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3002('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3002('0x6')](0x3)[_0x3002('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3002('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3002('0x1')],'defaultValue':_0x3002('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x3002('0x10'),_0x3002('0x11'),_0x3002('0x12')),'defaultValue':_0x3002('0x10')},'dialAMDActive':{'type':Sequelize[_0x3002('0x13')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x3002('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3002('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x3002('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3002('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3002('0x6')](0x9)[_0x3002('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3002('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3002('0x6')](0x9)[_0x3002('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3002('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x3002('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3002('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3002('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3002('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x3002('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3002('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3002('0x6')](0x5)[_0x3002('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3002('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3002('0x6')](0x9)[_0x3002('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3002('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3002('0x3')](_0x3002('0x1d'),_0x3002('0x1e')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x3002('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3002('0x6')](0x3)[_0x3002('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x3002('0x6')](0x3)[_0x3002('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3002('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3002('0x6')](0x3)[_0x3002('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3002('0x6')](0x5)[_0x3002('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3002('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x3002('0x6')](0x3)[_0x3002('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3002('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x3002('0x6')](0x5)[_0x3002('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3002('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3002('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3002('0x6')](0x5)[_0x3002('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3002('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0x3002('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x3002('0x6')](0x5)[_0x3002('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3002('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3002('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3002('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3002('0x6')](0x5)[_0x3002('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3002('0x27')}}; \ No newline at end of file +var _0xb0ea=['UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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,*,*,*','ENUM','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ivr','BOOLEAN','Active/Disactive\x20Campaign'];(function(_0x546c79,_0x9ba5c8){var _0x11f140=function(_0x3c0f22){while(--_0x3c0f22){_0x546c79['push'](_0x546c79['shift']());}};_0x11f140(++_0x9ba5c8);}(_0xb0ea,0x1c2));var _0xab0e=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0xb0ea[_0xd22d95];return _0x15d7a3;};'use strict';var Sequelize=require('sequelize');module[_0xab0e('0x0')]={'name':{'type':Sequelize[_0xab0e('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xab0e('0x2')),'allowNull':![],'defaultValue':_0xab0e('0x2')},'description':{'type':Sequelize[_0xab0e('0x1')]},'active':{'type':Sequelize[_0xab0e('0x3')],'defaultValue':0x0,'comment':_0xab0e('0x4')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xab0e('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xab0e('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xab0e('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xab0e('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xab0e('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab0e('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xab0e('0x7')](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab0e('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xab0e('0x7')](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab0e('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xab0e('0x7')](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab0e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xab0e('0x7')](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab0e('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'comment':_0xab0e('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xab0e('0x7')](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab0e('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xab0e('0xf')},'dialTimezone':{'type':Sequelize[_0xab0e('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xab0e('0x1')],'defaultValue':_0xab0e('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xab0e('0x11')]('always','never',_0xab0e('0x12')),'defaultValue':_0xab0e('0x13')},'dialAMDActive':{'type':Sequelize[_0xab0e('0x3')],'defaultValue':0x0,'comment':_0xab0e('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xab0e('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xab0e('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xab0e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xab0e('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xab0e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xab0e('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xab0e('0x7')](0x9)[_0xab0e('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xab0e('0x7')](0x9)[_0xab0e('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xab0e('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xab0e('0x7')](0x9)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xab0e('0x7')](0x5)[_0xab0e('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xab0e('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xab0e('0x7')](0x9)[_0xab0e('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xab0e('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xab0e('0x11')](_0xab0e('0x1b'),_0xab0e('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xab0e('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xab0e('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xab0e('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xab0e('0x7')](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab0e('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xab0e('0x7')](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab0e('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab0e('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xab0e('0x7')](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xab0e('0x7')](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab0e('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xab0e('0x7')](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xab0e('0x7')](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xab0e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab0e('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index ebe3c17..171487c 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 _0xbfec=['phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','toString','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','spread','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','type','model','name','query','filters','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','Campaign','findAll','rows','catch','show','params','keys','intersection','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','clone','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','order','pick','CampaignId','count','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ListId','field','NOW()','ContactId','CmListId','from','cm_contacts','phone\x20IS\x20NOT\x20NULL'];(function(_0x5d381c,_0x445675){var _0x5d0199=function(_0x3344e3){while(--_0x3344e3){_0x5d381c['push'](_0x5d381c['shift']());}};_0x5d0199(++_0x445675);}(_0xbfec,0x1b3));var _0xcbfe=function(_0x5031b4,_0x21aa87){_0x5031b4=_0x5031b4-0x0;var _0x541494=_0xbfec[_0x5031b4];return _0x541494;};'use strict';var pdf=require(_0xcbfe('0x0'));var emlformat=require(_0xcbfe('0x1'));var rimraf=require(_0xcbfe('0x2'));var zipdir=require(_0xcbfe('0x3'));var jsonpatch=require(_0xcbfe('0x4'));var rp=require(_0xcbfe('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcbfe('0x6'));var util=require(_0xcbfe('0x7'));var path=require(_0xcbfe('0x8'));var sox=require(_0xcbfe('0x9'));var csv=require(_0xcbfe('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcbfe('0xb'));var squel=require(_0xcbfe('0xc'));var crypto=require('crypto');var jsforce=require(_0xcbfe('0xd'));var deskjs=require(_0xcbfe('0xe'));var toCsv=require(_0xcbfe('0xa'));var querystring=require(_0xcbfe('0xf'));var Papa=require(_0xcbfe('0x10'));var Redis=require(_0xcbfe('0x11'));var authService=require(_0xcbfe('0x12'));var qs=require(_0xcbfe('0x13'));var as=require(_0xcbfe('0x14'));var hardwareService=require(_0xcbfe('0x15'));var logger=require('../../config/logger')(_0xcbfe('0x16'));var utils=require(_0xcbfe('0x17'));var config=require(_0xcbfe('0x18'));var licenseUtil=require(_0xcbfe('0x19'));var db=require(_0xcbfe('0x1a'))['db'];function respondWithStatusCode(_0x54d1db,_0x1a6ae5){_0x1a6ae5=_0x1a6ae5||0xcc;return function(_0x1c103d){if(_0x1c103d){return _0x54d1db[_0xcbfe('0x1b')](_0x1a6ae5);}return _0x54d1db[_0xcbfe('0x1c')](_0x1a6ae5)[_0xcbfe('0x1d')]();};}function respondWithResult(_0x43d122,_0x35bc25){_0x35bc25=_0x35bc25||0xc8;return function(_0x385440){if(_0x385440){return _0x43d122[_0xcbfe('0x1c')](_0x35bc25)[_0xcbfe('0x1e')](_0x385440);}};}function respondWithFilteredResult(_0xe41b72,_0x57bcdd){return function(_0x4c38c4){if(_0x4c38c4){var _0x6a9c67=_0x4c38c4['count'],_0x29ad27=_0x57bcdd['offset'],_0x575604=_0x57bcdd[_0xcbfe('0x1f')]+_0x57bcdd['limit'],_0x1c5a83;if(_0x575604>=_0x6a9c67){_0x575604=_0x6a9c67;_0x1c5a83=0xc8;}else{_0x1c5a83=0xce;}_0xe41b72[_0xcbfe('0x1c')](_0x1c5a83);return _0xe41b72['set'](_0xcbfe('0x20'),_0x29ad27+'-'+_0x575604+'/'+_0x6a9c67)[_0xcbfe('0x1e')](_0x4c38c4);}return null;};}function patchUpdates(_0x90571a){return function(_0x774cb5){try{jsonpatch[_0xcbfe('0x21')](_0x774cb5,_0x90571a,!![]);}catch(_0x82e95e){return BPromise[_0xcbfe('0x22')](_0x82e95e);}return _0x774cb5[_0xcbfe('0x23')]();};}function saveUpdates(_0x1cd976,_0x40ea64){return function(_0xd8181c){if(_0xd8181c){return _0xd8181c[_0xcbfe('0x24')](_0x1cd976)['then'](function(_0x37227d){return _0x37227d;});}return null;};}function removeEntity(_0xa7e83a,_0xe9d3b0){return function(_0x19c864){if(_0x19c864){return _0x19c864[_0xcbfe('0x25')]()[_0xcbfe('0x26')](function(){var _0x24d95e=_0x19c864[_0xcbfe('0x27')]({'plain':!![]});var _0x3c9f58=_0xcbfe('0x28');return db[_0xcbfe('0x29')][_0xcbfe('0x25')]({'where':{'type':_0x3c9f58,'resourceId':_0x24d95e['id']}})['then'](function(){return _0x19c864;});})[_0xcbfe('0x26')](function(){_0xa7e83a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf0e49d,_0x762af5){return function(_0x4aaa18){if(!_0x4aaa18){_0xf0e49d[_0xcbfe('0x1b')](0x194);}return _0x4aaa18;};}function handleError(_0x186a0b,_0x5c0301){_0x5c0301=_0x5c0301||0x1f4;return function(_0x52aeac){logger[_0xcbfe('0x2a')](_0x52aeac[_0xcbfe('0x2b')]);if(_0x52aeac['name']){delete _0x52aeac['name'];}_0x186a0b['status'](_0x5c0301)[_0xcbfe('0x2c')](_0x52aeac);};}exports[_0xcbfe('0x2d')]=function(_0xb2d4d5,_0x2b53b4){var _0x3bdbaa={},_0x4a9c2b={},_0x353970={'count':0x0,'rows':[]};var _0x5a8b55=_[_0xcbfe('0x2e')](db['Campaign'][_0xcbfe('0x2f')],function(_0x5d1bf4){return{'name':_0x5d1bf4[_0xcbfe('0x30')],'type':_0x5d1bf4[_0xcbfe('0x31')]['key']};});_0x4a9c2b[_0xcbfe('0x32')]=_[_0xcbfe('0x2e')](_0x5a8b55,_0xcbfe('0x33'));_0x4a9c2b['query']=_['keys'](_0xb2d4d5[_0xcbfe('0x34')]);_0x4a9c2b[_0xcbfe('0x35')]=_['intersection'](_0x4a9c2b[_0xcbfe('0x32')],_0x4a9c2b[_0xcbfe('0x34')]);_0x3bdbaa[_0xcbfe('0x36')]=_['intersection'](_0x4a9c2b['model'],qs[_0xcbfe('0x37')](_0xb2d4d5[_0xcbfe('0x34')]['fields']));_0x3bdbaa['attributes']=_0x3bdbaa[_0xcbfe('0x36')]['length']?_0x3bdbaa[_0xcbfe('0x36')]:_0x4a9c2b[_0xcbfe('0x32')];if(!_0xb2d4d5[_0xcbfe('0x34')][_0xcbfe('0x38')](_0xcbfe('0x39'))){_0x3bdbaa[_0xcbfe('0x3a')]=qs['limit'](_0xb2d4d5[_0xcbfe('0x34')][_0xcbfe('0x3a')]);_0x3bdbaa[_0xcbfe('0x1f')]=qs[_0xcbfe('0x1f')](_0xb2d4d5[_0xcbfe('0x34')][_0xcbfe('0x1f')]);}_0x3bdbaa['order']=qs[_0xcbfe('0x3b')](_0xb2d4d5[_0xcbfe('0x34')]['sort']);_0x3bdbaa[_0xcbfe('0x3c')]=qs[_0xcbfe('0x35')](_['pick'](_0xb2d4d5[_0xcbfe('0x34')],_0x4a9c2b[_0xcbfe('0x35')]),_0x5a8b55);if(_0xb2d4d5[_0xcbfe('0x34')][_0xcbfe('0x3d')]){_0x3bdbaa['where']=_[_0xcbfe('0x3e')](_0x3bdbaa['where'],{'$or':_[_0xcbfe('0x2e')](_0x5a8b55,function(_0xe6e05d){if(_0xe6e05d[_0xcbfe('0x31')]!==_0xcbfe('0x3f')){var _0x364e8c={};_0x364e8c[_0xe6e05d[_0xcbfe('0x33')]]={'$like':'%'+_0xb2d4d5['query']['filter']+'%'};return _0x364e8c;}})});}_0x3bdbaa=_[_0xcbfe('0x3e')]({},_0x3bdbaa,_0xb2d4d5[_0xcbfe('0x40')]);var _0x32c1f0={'where':_0x3bdbaa[_0xcbfe('0x3c')]};return db['Campaign']['count'](_0x32c1f0)['then'](function(_0x26c2ee){_0x353970['count']=_0x26c2ee;if(_0xb2d4d5[_0xcbfe('0x34')][_0xcbfe('0x41')]){_0x3bdbaa['include']=[{'all':!![]}];}return db[_0xcbfe('0x42')][_0xcbfe('0x43')](_0x3bdbaa);})[_0xcbfe('0x26')](function(_0x3cbfe0){_0x353970[_0xcbfe('0x44')]=_0x3cbfe0;return _0x353970;})[_0xcbfe('0x26')](respondWithFilteredResult(_0x2b53b4,_0x3bdbaa))[_0xcbfe('0x45')](handleError(_0x2b53b4,null));};exports[_0xcbfe('0x46')]=function(_0x2d0fbc,_0x5807ec){var _0x364fe3={'raw':![],'where':{'id':_0x2d0fbc[_0xcbfe('0x47')]['id']}},_0x1fcc3b={};_0x1fcc3b['model']=_[_0xcbfe('0x48')](db[_0xcbfe('0x42')][_0xcbfe('0x2f')]);_0x1fcc3b[_0xcbfe('0x34')]=_['keys'](_0x2d0fbc[_0xcbfe('0x34')]);_0x1fcc3b[_0xcbfe('0x35')]=_[_0xcbfe('0x49')](_0x1fcc3b['model'],_0x1fcc3b['query']);_0x364fe3['attributes']=_[_0xcbfe('0x49')](_0x1fcc3b[_0xcbfe('0x32')],qs[_0xcbfe('0x37')](_0x2d0fbc[_0xcbfe('0x34')][_0xcbfe('0x37')]));_0x364fe3[_0xcbfe('0x36')]=_0x364fe3[_0xcbfe('0x36')][_0xcbfe('0x4a')]?_0x364fe3[_0xcbfe('0x36')]:_0x1fcc3b[_0xcbfe('0x32')];if(_0x2d0fbc[_0xcbfe('0x34')][_0xcbfe('0x41')]){_0x364fe3[_0xcbfe('0x4b')]=[{'all':!![]}];}_0x364fe3=_[_0xcbfe('0x3e')]({},_0x364fe3,_0x2d0fbc[_0xcbfe('0x40')]);return db[_0xcbfe('0x42')][_0xcbfe('0x4c')](_0x364fe3)[_0xcbfe('0x26')](handleEntityNotFound(_0x5807ec,null))[_0xcbfe('0x26')](respondWithResult(_0x5807ec,null))[_0xcbfe('0x45')](handleError(_0x5807ec,null));};exports[_0xcbfe('0x4d')]=function(_0x5db7cf,_0x56b0b6){return db[_0xcbfe('0x42')][_0xcbfe('0x4d')](_0x5db7cf[_0xcbfe('0x4e')],{})[_0xcbfe('0x26')](function(_0x2d9430){var _0x540239=_0x5db7cf['user'][_0xcbfe('0x27')]({'plain':!![]});if(!_0x540239)throw new Error(_0xcbfe('0x4f'));if(_0x540239[_0xcbfe('0x50')]===_0xcbfe('0x51')){var _0x44d118=_0x2d9430[_0xcbfe('0x27')]({'plain':!![]});var _0x4f8dee=_0xcbfe('0x28');return db['UserProfileSection'][_0xcbfe('0x4c')]({'where':{'name':_0x4f8dee,'userProfileId':_0x540239['userProfileId']},'raw':!![]})[_0xcbfe('0x26')](function(_0x2b1d3f){if(_0x2b1d3f&&_0x2b1d3f[_0xcbfe('0x52')]===0x0){return db['UserProfileResource'][_0xcbfe('0x4d')]({'name':_0x44d118[_0xcbfe('0x33')],'resourceId':_0x44d118['id'],'type':_0x2b1d3f['name'],'sectionId':_0x2b1d3f['id']},{})['then'](function(){return _0x2d9430;});}else{return _0x2d9430;}})[_0xcbfe('0x45')](function(_0x4ea062){logger[_0xcbfe('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ea062);throw _0x4ea062;});}return _0x2d9430;})[_0xcbfe('0x26')](respondWithResult(_0x56b0b6,0xc9))['catch'](handleError(_0x56b0b6,null));};exports[_0xcbfe('0x53')]=function(_0xd0fbb9,_0x120aa0){var _0x318894={'where':{'id':_0xd0fbb9[_0xcbfe('0x47')]['id']}},_0x5ebfca={};_0x5ebfca['model']=_[_0xcbfe('0x48')](db[_0xcbfe('0x42')][_0xcbfe('0x2f')]);_0x318894[_0xcbfe('0x36')]=_['intersection'](_0x5ebfca[_0xcbfe('0x32')],qs[_0xcbfe('0x37')](_0xd0fbb9[_0xcbfe('0x34')]['fields']));_0x318894['attributes']=_0x318894[_0xcbfe('0x36')][_0xcbfe('0x4a')]?_0x318894[_0xcbfe('0x36')]:_0x5ebfca[_0xcbfe('0x32')];if(_0xd0fbb9[_0xcbfe('0x34')][_0xcbfe('0x41')]){_0x318894['include']=[{'all':!![]}];}_0x318894=_[_0xcbfe('0x3e')]({},_0x318894,_0xd0fbb9[_0xcbfe('0x40')]);return db[_0xcbfe('0x42')][_0xcbfe('0x4c')](_0x318894)[_0xcbfe('0x26')](handleEntityNotFound(_0x120aa0,null))['then'](function(_0x196e14){if(_0x196e14){var _0x497e2d=_0x196e14[_0xcbfe('0x27')]({'plain':!![]});_0x497e2d=qs[_0xcbfe('0x54')](_0x497e2d,['id',_0xcbfe('0x55'),_0xcbfe('0x56')]);_0xd0fbb9[_0xcbfe('0x4e')]=_[_0xcbfe('0x54')](_0xd0fbb9[_0xcbfe('0x4e')],['id',_0xcbfe('0x55'),_0xcbfe('0x56')]);return db[_0xcbfe('0x42')]['create'](_['merge'](_0x497e2d,_0xd0fbb9['body']),{'include':_0xd0fbb9[_0xcbfe('0x34')][_0xcbfe('0x41')]?[{'all':!![]}]:undefined})[_0xcbfe('0x26')](function(_0xfd2c42){var _0x30c3e6=_0xd0fbb9[_0xcbfe('0x51')][_0xcbfe('0x27')]({'plain':!![]});if(!_0x30c3e6)throw new Error(_0xcbfe('0x4f'));if(_0x30c3e6[_0xcbfe('0x50')]==='user'){var _0x165bbb=_0xfd2c42['get']({'plain':!![]});var _0x2512bb=_0xcbfe('0x28');return db[_0xcbfe('0x57')][_0xcbfe('0x4c')]({'where':{'name':_0x2512bb,'userProfileId':_0x30c3e6['userProfileId']},'raw':!![]})[_0xcbfe('0x26')](function(_0x4badcb){if(_0x4badcb&&_0x4badcb[_0xcbfe('0x52')]===0x0){return db[_0xcbfe('0x29')][_0xcbfe('0x4d')]({'name':_0x165bbb[_0xcbfe('0x33')],'resourceId':_0x165bbb['id'],'type':_0x4badcb[_0xcbfe('0x33')],'sectionId':_0x4badcb['id']},{})[_0xcbfe('0x26')](function(){return _0xfd2c42;});}else{return _0xfd2c42;}})[_0xcbfe('0x45')](function(_0x236afb){logger[_0xcbfe('0x2a')](_0xcbfe('0x58'),_0x236afb);throw _0x236afb;});}return _0xfd2c42;});}})[_0xcbfe('0x26')](respondWithResult(_0x120aa0,0xc9))[_0xcbfe('0x45')](handleError(_0x120aa0,null));};exports[_0xcbfe('0x24')]=function(_0x2063b6,_0x5910b5){if(_0x2063b6[_0xcbfe('0x4e')]['id']){delete _0x2063b6[_0xcbfe('0x4e')]['id'];}return db[_0xcbfe('0x42')][_0xcbfe('0x4c')]({'where':{'id':_0x2063b6['params']['id']}})[_0xcbfe('0x26')](handleEntityNotFound(_0x5910b5,null))['then'](saveUpdates(_0x2063b6['body'],null))[_0xcbfe('0x26')](respondWithResult(_0x5910b5,null))['catch'](handleError(_0x5910b5,null));};exports[_0xcbfe('0x25')]=function(_0x3ac3e2,_0x53f9f1){return db[_0xcbfe('0x42')][_0xcbfe('0x4c')]({'where':{'id':_0x3ac3e2['params']['id']}})[_0xcbfe('0x26')](handleEntityNotFound(_0x53f9f1,null))['then'](removeEntity(_0x53f9f1,null))[_0xcbfe('0x45')](handleError(_0x53f9f1,null));};exports['getHoppers']=function(_0x78b8fe,_0x4aedef,_0xe6b727){var _0x1e2ee8={'raw':!![],'where':{}};var _0x27aa9e={};var _0x461b56={'count':0x0,'rows':[]};return db[_0xcbfe('0x42')][_0xcbfe('0x59')]({'where':{'id':_0x78b8fe[_0xcbfe('0x47')]['id']}})[_0xcbfe('0x26')](handleEntityNotFound(_0x4aedef,null))[_0xcbfe('0x26')](function(_0x28c185){if(_0x28c185){_0x27aa9e[_0xcbfe('0x32')]=_[_0xcbfe('0x48')](db[_0xcbfe('0x5a')][_0xcbfe('0x2f')]);_0x27aa9e[_0xcbfe('0x34')]=_['keys'](_0x78b8fe[_0xcbfe('0x34')]);_0x27aa9e[_0xcbfe('0x35')]=_['intersection'](_0x27aa9e['model'],_0x27aa9e['query']);_0x1e2ee8[_0xcbfe('0x36')]=_['intersection'](_0x27aa9e[_0xcbfe('0x32')],qs[_0xcbfe('0x37')](_0x78b8fe['query'][_0xcbfe('0x37')]));_0x1e2ee8['attributes']=_0x1e2ee8['attributes'][_0xcbfe('0x4a')]?_0x1e2ee8['attributes']:_0x27aa9e[_0xcbfe('0x32')];if(!_0x78b8fe[_0xcbfe('0x34')]['hasOwnProperty'](_0xcbfe('0x39'))){_0x1e2ee8[_0xcbfe('0x3a')]=qs[_0xcbfe('0x3a')](_0x78b8fe[_0xcbfe('0x34')]['limit']);_0x1e2ee8[_0xcbfe('0x1f')]=qs[_0xcbfe('0x1f')](_0x78b8fe[_0xcbfe('0x34')][_0xcbfe('0x1f')]);}_0x1e2ee8[_0xcbfe('0x5b')]=qs[_0xcbfe('0x3b')](_0x78b8fe['query']['sort']);_0x1e2ee8[_0xcbfe('0x3c')]=qs['filters'](_[_0xcbfe('0x5c')](_0x78b8fe['query'],_0x27aa9e[_0xcbfe('0x35')]));_0x1e2ee8[_0xcbfe('0x3c')][_0xcbfe('0x5d')]=_0x28c185['id'];if(_0x78b8fe[_0xcbfe('0x34')][_0xcbfe('0x3d')]){_0x1e2ee8[_0xcbfe('0x3c')]=_[_0xcbfe('0x3e')](_0x1e2ee8[_0xcbfe('0x3c')],{'$or':_[_0xcbfe('0x2e')](_0x1e2ee8[_0xcbfe('0x36')],function(_0x3ab7fa){var _0x400cce={};_0x400cce[_0x3ab7fa]={'$like':'%'+_0x78b8fe[_0xcbfe('0x34')][_0xcbfe('0x3d')]+'%'};return _0x400cce;})});}_0x1e2ee8=_[_0xcbfe('0x3e')]({},_0x1e2ee8,_0x78b8fe[_0xcbfe('0x40')]);return db[_0xcbfe('0x5a')][_0xcbfe('0x5e')]({'where':_0x1e2ee8[_0xcbfe('0x3c')]})[_0xcbfe('0x26')](function(_0x5dc23a){_0x461b56['count']=_0x5dc23a;if(_0x78b8fe[_0xcbfe('0x34')][_0xcbfe('0x41')]){_0x1e2ee8[_0xcbfe('0x4b')]=[{'all':!![]}];}return db['CmHopper'][_0xcbfe('0x43')](_0x1e2ee8);})[_0xcbfe('0x26')](function(_0x549343){_0x461b56[_0xcbfe('0x44')]=_0x549343;return _0x461b56;});}})['then'](respondWithFilteredResult(_0x4aedef,_0x1e2ee8))[_0xcbfe('0x45')](handleError(_0x4aedef,null));};exports['getHopperHistories']=function(_0x14e4e3,_0x54e472,_0x4d63f5){var _0x1dfc0e={'raw':!![],'where':{}};var _0x240b1f={};var _0x5f0277={'count':0x0,'rows':[]};return db[_0xcbfe('0x42')][_0xcbfe('0x59')]({'where':{'id':_0x14e4e3[_0xcbfe('0x47')]['id']}})[_0xcbfe('0x26')](handleEntityNotFound(_0x54e472,null))['then'](function(_0x5e2b47){if(_0x5e2b47){_0x240b1f[_0xcbfe('0x32')]=_[_0xcbfe('0x48')](db[_0xcbfe('0x5f')]['rawAttributes']);_0x240b1f['query']=_[_0xcbfe('0x48')](_0x14e4e3[_0xcbfe('0x34')]);_0x240b1f[_0xcbfe('0x35')]=_[_0xcbfe('0x49')](_0x240b1f[_0xcbfe('0x32')],_0x240b1f[_0xcbfe('0x34')]);_0x1dfc0e[_0xcbfe('0x36')]=_['intersection'](_0x240b1f[_0xcbfe('0x32')],qs[_0xcbfe('0x37')](_0x14e4e3[_0xcbfe('0x34')][_0xcbfe('0x37')]));_0x1dfc0e[_0xcbfe('0x36')]=_0x1dfc0e[_0xcbfe('0x36')][_0xcbfe('0x4a')]?_0x1dfc0e[_0xcbfe('0x36')]:_0x240b1f['model'];if(!_0x14e4e3[_0xcbfe('0x34')][_0xcbfe('0x38')](_0xcbfe('0x39'))){_0x1dfc0e[_0xcbfe('0x3a')]=qs[_0xcbfe('0x3a')](_0x14e4e3[_0xcbfe('0x34')][_0xcbfe('0x3a')]);_0x1dfc0e[_0xcbfe('0x1f')]=qs['offset'](_0x14e4e3[_0xcbfe('0x34')][_0xcbfe('0x1f')]);}_0x1dfc0e[_0xcbfe('0x5b')]=qs[_0xcbfe('0x3b')](_0x14e4e3['query'][_0xcbfe('0x3b')]);_0x1dfc0e[_0xcbfe('0x3c')]=qs[_0xcbfe('0x35')](_[_0xcbfe('0x5c')](_0x14e4e3[_0xcbfe('0x34')],_0x240b1f[_0xcbfe('0x35')]));_0x1dfc0e[_0xcbfe('0x3c')][_0xcbfe('0x5d')]=_0x5e2b47['id'];if(_0x14e4e3['query']['filter']){_0x1dfc0e[_0xcbfe('0x3c')]=_[_0xcbfe('0x3e')](_0x1dfc0e[_0xcbfe('0x3c')],{'$or':_[_0xcbfe('0x2e')](_0x1dfc0e['attributes'],function(_0x16a706){var _0x39bd5d={};_0x39bd5d[_0x16a706]={'$like':'%'+_0x14e4e3[_0xcbfe('0x34')]['filter']+'%'};return _0x39bd5d;})});}_0x1dfc0e=_[_0xcbfe('0x3e')]({},_0x1dfc0e,_0x14e4e3[_0xcbfe('0x40')]);return db[_0xcbfe('0x5f')]['count']({'where':_0x1dfc0e[_0xcbfe('0x3c')]})[_0xcbfe('0x26')](function(_0x56cd1d){_0x5f0277[_0xcbfe('0x5e')]=_0x56cd1d;if(_0x14e4e3[_0xcbfe('0x34')][_0xcbfe('0x41')]){_0x1dfc0e[_0xcbfe('0x4b')]=[{'all':!![]}];}return db[_0xcbfe('0x5f')][_0xcbfe('0x43')](_0x1dfc0e);})[_0xcbfe('0x26')](function(_0x1ff673){_0x5f0277[_0xcbfe('0x44')]=_0x1ff673;return _0x5f0277;});}})[_0xcbfe('0x26')](respondWithFilteredResult(_0x54e472,_0x1dfc0e))['catch'](handleError(_0x54e472,null));};exports['getHopperFinals']=function(_0x1bd255,_0x7e9ce8,_0x1c3f8a){var _0x123882={'raw':!![],'where':{}};var _0x2ddd52={};var _0x279fe8={'count':0x0,'rows':[]};return db[_0xcbfe('0x42')][_0xcbfe('0x59')]({'where':{'id':_0x1bd255[_0xcbfe('0x47')]['id']}})[_0xcbfe('0x26')](handleEntityNotFound(_0x7e9ce8,null))[_0xcbfe('0x26')](function(_0x2e2f9a){if(_0x2e2f9a){_0x2ddd52['model']=_[_0xcbfe('0x48')](db['CmHopperFinal'][_0xcbfe('0x2f')]);_0x2ddd52[_0xcbfe('0x34')]=_[_0xcbfe('0x48')](_0x1bd255[_0xcbfe('0x34')]);_0x2ddd52[_0xcbfe('0x35')]=_[_0xcbfe('0x49')](_0x2ddd52[_0xcbfe('0x32')],_0x2ddd52['query']);_0x123882['attributes']=_[_0xcbfe('0x49')](_0x2ddd52['model'],qs[_0xcbfe('0x37')](_0x1bd255[_0xcbfe('0x34')][_0xcbfe('0x37')]));_0x123882[_0xcbfe('0x36')]=_0x123882[_0xcbfe('0x36')]['length']?_0x123882[_0xcbfe('0x36')]:_0x2ddd52['model'];if(!_0x1bd255[_0xcbfe('0x34')][_0xcbfe('0x38')](_0xcbfe('0x39'))){_0x123882['limit']=qs['limit'](_0x1bd255[_0xcbfe('0x34')][_0xcbfe('0x3a')]);_0x123882[_0xcbfe('0x1f')]=qs[_0xcbfe('0x1f')](_0x1bd255['query'][_0xcbfe('0x1f')]);}_0x123882[_0xcbfe('0x5b')]=qs[_0xcbfe('0x3b')](_0x1bd255[_0xcbfe('0x34')][_0xcbfe('0x3b')]);_0x123882[_0xcbfe('0x3c')]=qs[_0xcbfe('0x35')](_['pick'](_0x1bd255[_0xcbfe('0x34')],_0x2ddd52['filters']));_0x123882[_0xcbfe('0x3c')]['CampaignId']=_0x2e2f9a['id'];if(_0x1bd255[_0xcbfe('0x34')][_0xcbfe('0x3d')]){_0x123882['where']=_[_0xcbfe('0x3e')](_0x123882['where'],{'$or':_['map'](_0x123882[_0xcbfe('0x36')],function(_0x445354){var _0x32426a={};_0x32426a[_0x445354]={'$like':'%'+_0x1bd255[_0xcbfe('0x34')]['filter']+'%'};return _0x32426a;})});}_0x123882=_[_0xcbfe('0x3e')]({},_0x123882,_0x1bd255['options']);return db[_0xcbfe('0x60')][_0xcbfe('0x5e')]({'where':_0x123882[_0xcbfe('0x3c')]})[_0xcbfe('0x26')](function(_0x2c26ff){_0x279fe8['count']=_0x2c26ff;if(_0x1bd255[_0xcbfe('0x34')][_0xcbfe('0x41')]){_0x123882['include']=[{'all':!![]}];}return db[_0xcbfe('0x60')]['findAll'](_0x123882);})[_0xcbfe('0x26')](function(_0x3544c1){_0x279fe8[_0xcbfe('0x44')]=_0x3544c1;return _0x279fe8;});}})['then'](respondWithFilteredResult(_0x7e9ce8,_0x123882))[_0xcbfe('0x45')](handleError(_0x7e9ce8,null));};exports[_0xcbfe('0x61')]=function(_0x311fb2,_0xe60d84,_0x2e6447){var _0x41730b={'raw':!![],'where':{}};var _0x465280={};var _0x11b324={'count':0x0,'rows':[]};return db[_0xcbfe('0x42')][_0xcbfe('0x59')]({'where':{'id':_0x311fb2[_0xcbfe('0x47')]['id']}})[_0xcbfe('0x26')](handleEntityNotFound(_0xe60d84,null))[_0xcbfe('0x26')](function(_0x244714){if(_0x244714){_0x465280[_0xcbfe('0x32')]=_['keys'](db[_0xcbfe('0x62')][_0xcbfe('0x2f')]);_0x465280[_0xcbfe('0x34')]=_[_0xcbfe('0x48')](_0x311fb2[_0xcbfe('0x34')]);_0x465280['filters']=_[_0xcbfe('0x49')](_0x465280[_0xcbfe('0x32')],_0x465280[_0xcbfe('0x34')]);_0x41730b[_0xcbfe('0x36')]=_[_0xcbfe('0x49')](_0x465280[_0xcbfe('0x32')],qs[_0xcbfe('0x37')](_0x311fb2[_0xcbfe('0x34')][_0xcbfe('0x37')]));_0x41730b[_0xcbfe('0x36')]=_0x41730b[_0xcbfe('0x36')]['length']?_0x41730b[_0xcbfe('0x36')]:_0x465280[_0xcbfe('0x32')];if(!_0x311fb2[_0xcbfe('0x34')][_0xcbfe('0x38')](_0xcbfe('0x39'))){_0x41730b[_0xcbfe('0x3a')]=qs['limit'](_0x311fb2['query'][_0xcbfe('0x3a')]);_0x41730b[_0xcbfe('0x1f')]=qs[_0xcbfe('0x1f')](_0x311fb2[_0xcbfe('0x34')][_0xcbfe('0x1f')]);}_0x41730b['order']=qs[_0xcbfe('0x3b')](_0x311fb2[_0xcbfe('0x34')][_0xcbfe('0x3b')]);_0x41730b[_0xcbfe('0x3c')]=qs['filters'](_[_0xcbfe('0x5c')](_0x311fb2[_0xcbfe('0x34')],_0x465280[_0xcbfe('0x35')]));_0x41730b[_0xcbfe('0x3c')][_0xcbfe('0x5d')]=_0x244714['id'];if(_0x311fb2[_0xcbfe('0x34')][_0xcbfe('0x3d')]){_0x41730b['where']=_[_0xcbfe('0x3e')](_0x41730b[_0xcbfe('0x3c')],{'$or':_['map'](_0x41730b[_0xcbfe('0x36')],function(_0x2492d6){var _0x5c2af4={};_0x5c2af4[_0x2492d6]={'$like':'%'+_0x311fb2[_0xcbfe('0x34')]['filter']+'%'};return _0x5c2af4;})});}_0x41730b=_[_0xcbfe('0x3e')]({},_0x41730b,_0x311fb2[_0xcbfe('0x40')]);return db['CmHopperBlack'][_0xcbfe('0x5e')]({'where':_0x41730b[_0xcbfe('0x3c')]})[_0xcbfe('0x26')](function(_0x3f8348){_0x11b324[_0xcbfe('0x5e')]=_0x3f8348;if(_0x311fb2[_0xcbfe('0x34')]['includeAll']){_0x41730b[_0xcbfe('0x4b')]=[{'all':!![]}];}return db[_0xcbfe('0x62')][_0xcbfe('0x43')](_0x41730b);})[_0xcbfe('0x26')](function(_0x535604){_0x11b324[_0xcbfe('0x44')]=_0x535604;return _0x11b324;});}})[_0xcbfe('0x26')](respondWithFilteredResult(_0xe60d84,_0x41730b))[_0xcbfe('0x45')](handleError(_0xe60d84,null));};exports[_0xcbfe('0x63')]=function(_0x23d393,_0x247722,_0x4ee64a){var _0x4a5204={};var _0x7125cb={};var _0x154d7c;var _0x16bc09;return db['Campaign'][_0xcbfe('0x59')]({'where':{'id':_0x23d393[_0xcbfe('0x47')]['id']}})[_0xcbfe('0x26')](handleEntityNotFound(_0x247722,null))[_0xcbfe('0x26')](function(_0x30d00a){if(_0x30d00a){_0x154d7c=_0x30d00a;_0x7125cb['model']=_[_0xcbfe('0x48')](db['CmList'][_0xcbfe('0x2f')]);_0x7125cb['query']=_['keys'](_0x23d393[_0xcbfe('0x34')]);_0x7125cb[_0xcbfe('0x35')]=_['intersection'](_0x7125cb[_0xcbfe('0x32')],_0x7125cb[_0xcbfe('0x34')]);_0x4a5204['attributes']=_[_0xcbfe('0x49')](_0x7125cb['model'],qs[_0xcbfe('0x37')](_0x23d393[_0xcbfe('0x34')][_0xcbfe('0x37')]));_0x4a5204['attributes']=_0x4a5204[_0xcbfe('0x36')][_0xcbfe('0x4a')]?_0x4a5204['attributes']:_0x7125cb['model'];_0x4a5204[_0xcbfe('0x5b')]=qs[_0xcbfe('0x3b')](_0x23d393[_0xcbfe('0x34')][_0xcbfe('0x3b')]);_0x4a5204[_0xcbfe('0x3c')]=qs['filters'](_[_0xcbfe('0x5c')](_0x23d393['query'],_0x7125cb['filters']));if(_0x23d393[_0xcbfe('0x34')]['filter']){_0x4a5204[_0xcbfe('0x3c')]=_[_0xcbfe('0x3e')](_0x4a5204[_0xcbfe('0x3c')],{'$or':_[_0xcbfe('0x2e')](_0x4a5204['attributes'],function(_0x8d234d){var _0x187830={};_0x187830[_0x8d234d]={'$like':'%'+_0x23d393[_0xcbfe('0x34')][_0xcbfe('0x3d')]+'%'};return _0x187830;})});}_0x4a5204=_[_0xcbfe('0x3e')]({},_0x4a5204,_0x23d393[_0xcbfe('0x40')]);return _0x154d7c[_0xcbfe('0x63')](_0x4a5204);}})[_0xcbfe('0x26')](function(_0x2b4e5b){if(_0x2b4e5b){_0x16bc09=_0x2b4e5b[_0xcbfe('0x4a')];if(!_0x23d393[_0xcbfe('0x34')][_0xcbfe('0x38')](_0xcbfe('0x39'))){_0x4a5204[_0xcbfe('0x3a')]=qs[_0xcbfe('0x3a')](_0x23d393[_0xcbfe('0x34')]['limit']);_0x4a5204[_0xcbfe('0x1f')]=qs[_0xcbfe('0x1f')](_0x23d393[_0xcbfe('0x34')][_0xcbfe('0x1f')]);}return _0x154d7c[_0xcbfe('0x63')](_0x4a5204);}})[_0xcbfe('0x26')](function(_0x2c0fe2){if(_0x2c0fe2){return _0x2c0fe2?{'count':_0x16bc09,'rows':_0x2c0fe2}:null;}})[_0xcbfe('0x26')](respondWithResult(_0x247722,null))['catch'](handleError(_0x247722,null));};exports[_0xcbfe('0x64')]=function(_0x222b37,_0x234ca4,_0x417b2f){var _0x147b48,_0x3ec4a1;return db[_0xcbfe('0x42')][_0xcbfe('0x4c')]({'where':{'id':_0x222b37[_0xcbfe('0x47')]['id']}})[_0xcbfe('0x26')](handleEntityNotFound(_0x234ca4,null))[_0xcbfe('0x26')](function(_0x39eccb){if(_0x39eccb){_0x3ec4a1=_0x39eccb;return _0x39eccb[_0xcbfe('0x64')](_0x222b37[_0xcbfe('0x4e')][_0xcbfe('0x65')],_[_0xcbfe('0x54')](_0x222b37[_0xcbfe('0x4e')],[_0xcbfe('0x65'),'id'])||{});}return null;})['spread'](function(_0x55056a){var _0x217111;_0x147b48=_0x55056a||[];var _0x495275=[];if(_0x55056a){for(var _0x7ea64d=0x0;_0x7ea64d<_0x55056a['length'];_0x7ea64d+=0x1){var _0x6e84da=_0x55056a[_0x7ea64d][_0xcbfe('0x27')]({'plain':!![]});_0x3ec4a1[_0xcbfe('0x66')]=_0x222b37[_0xcbfe('0x4e')][_0xcbfe('0x66')]?_0x222b37[_0xcbfe('0x4e')][_0xcbfe('0x66')]:_0x3ec4a1[_0xcbfe('0x66')];switch(_0x3ec4a1[_0xcbfe('0x66')]){case _0xcbfe('0x67'):_0x217111=squel[_0xcbfe('0x68')]()[_0xcbfe('0x69')]('cm_hopper')[_0xcbfe('0x6a')]([_0xcbfe('0x6b'),_0xcbfe('0x6c'),'ContactId',_0xcbfe('0x6d'),_0xcbfe('0x5d'),_0xcbfe('0x55'),_0xcbfe('0x56')],squel['select']()['field'](_0xcbfe('0x6b'),_0xcbfe('0x6b'))[_0xcbfe('0x6e')](_0xcbfe('0x6f'),_0xcbfe('0x6c'))[_0xcbfe('0x6e')]('id',_0xcbfe('0x70'))[_0xcbfe('0x6e')](_0x6e84da[_0xcbfe('0x71')]['toString'](),_0xcbfe('0x6d'))[_0xcbfe('0x6e')](_0x222b37['params']['id']['toString'](),'CampaignId')[_0xcbfe('0x6e')](_0xcbfe('0x6f'),_0xcbfe('0x55'))['field'](_0xcbfe('0x6f'),_0xcbfe('0x56'))[_0xcbfe('0x72')](_0xcbfe('0x73'))[_0xcbfe('0x3c')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x6e84da[_0xcbfe('0x71')]['toString']())[_0xcbfe('0x3c')](_0xcbfe('0x74'))[_0xcbfe('0x3c')](_0xcbfe('0x75'),squel[_0xcbfe('0x76')]()[_0xcbfe('0x6e')](_0xcbfe('0x77'))[_0xcbfe('0x72')](_0xcbfe('0x78'))[_0xcbfe('0x3c')](_0xcbfe('0x79'),_0x222b37[_0xcbfe('0x47')]['id'][_0xcbfe('0x7a')]()))['where'](_0xcbfe('0x75'),squel[_0xcbfe('0x76')]()[_0xcbfe('0x6e')](_0xcbfe('0x7b'))[_0xcbfe('0x72')](_0xcbfe('0x7c'))[_0xcbfe('0x3c')](_0xcbfe('0x79'),_0x222b37[_0xcbfe('0x47')]['id'][_0xcbfe('0x7a')]())))['toString']();break;case _0xcbfe('0x7d'):_0x217111=squel[_0xcbfe('0x68')]()[_0xcbfe('0x69')]('cm_hopper')[_0xcbfe('0x6a')]([_0xcbfe('0x6b'),_0xcbfe('0x6c'),_0xcbfe('0x70'),_0xcbfe('0x6d'),'CampaignId','createdAt','updatedAt'],squel[_0xcbfe('0x76')]()[_0xcbfe('0x6e')](_0xcbfe('0x6b'),_0xcbfe('0x6b'))[_0xcbfe('0x6e')](_0xcbfe('0x6f'),'scheduledAt')[_0xcbfe('0x6e')]('id',_0xcbfe('0x70'))[_0xcbfe('0x6e')](_0x6e84da[_0xcbfe('0x71')][_0xcbfe('0x7a')](),_0xcbfe('0x6d'))[_0xcbfe('0x6e')](_0x222b37['params']['id']['toString'](),_0xcbfe('0x5d'))[_0xcbfe('0x6e')](_0xcbfe('0x6f'),'createdAt')[_0xcbfe('0x6e')](_0xcbfe('0x6f'),_0xcbfe('0x56'))[_0xcbfe('0x72')](_0xcbfe('0x73'))[_0xcbfe('0x3c')](_0xcbfe('0x7e'))[_0xcbfe('0x3c')]('ListId\x20=\x20?',_0x6e84da[_0xcbfe('0x71')][_0xcbfe('0x7a')]())[_0xcbfe('0x3c')](_0xcbfe('0x74'))[_0xcbfe('0x3c')](_0xcbfe('0x75'),squel[_0xcbfe('0x76')]()[_0xcbfe('0x6e')]('COALESCE(phone,\x27\x27)')[_0xcbfe('0x72')](_0xcbfe('0x7c'))[_0xcbfe('0x3c')]('CampaignId\x20=\x20?',_0x222b37[_0xcbfe('0x47')]['id'][_0xcbfe('0x7a')]())))['toString']();break;default:_0x217111=squel[_0xcbfe('0x68')]()[_0xcbfe('0x69')]('cm_hopper')[_0xcbfe('0x6a')]([_0xcbfe('0x6b'),_0xcbfe('0x6c'),'ContactId',_0xcbfe('0x6d'),_0xcbfe('0x5d'),_0xcbfe('0x55'),_0xcbfe('0x56')],squel[_0xcbfe('0x76')]()[_0xcbfe('0x6e')](_0xcbfe('0x6b'),'phone')['field'](_0xcbfe('0x6f'),_0xcbfe('0x6c'))[_0xcbfe('0x6e')]('id',_0xcbfe('0x70'))['field'](_0x6e84da['CmListId'][_0xcbfe('0x7a')](),_0xcbfe('0x6d'))[_0xcbfe('0x6e')](_0x222b37[_0xcbfe('0x47')]['id']['toString'](),_0xcbfe('0x5d'))[_0xcbfe('0x6e')]('NOW()',_0xcbfe('0x55'))[_0xcbfe('0x6e')](_0xcbfe('0x6f'),_0xcbfe('0x56'))[_0xcbfe('0x72')](_0xcbfe('0x73'))['where']('deletedAt\x20IS\x20NULL')[_0xcbfe('0x3c')](_0xcbfe('0x7f'),_0x6e84da['CmListId']['toString']())[_0xcbfe('0x3c')](_0xcbfe('0x74')))[_0xcbfe('0x7a')]();}_0x495275[_0xcbfe('0x80')](db[_0xcbfe('0x81')][_0xcbfe('0x34')](_0x217111));}return BPromise[_0xcbfe('0x82')](_0x495275);}})[_0xcbfe('0x26')](function(){return _0x147b48;})[_0xcbfe('0x26')](respondWithResult(_0x234ca4,null))[_0xcbfe('0x45')](handleError(_0x234ca4,null));};exports[_0xcbfe('0x83')]=function(_0x2dc642,_0x56343e,_0x4a3925){return db[_0xcbfe('0x42')]['find']({'where':{'id':_0x2dc642[_0xcbfe('0x47')]['id']}})['then'](handleEntityNotFound(_0x56343e,null))[_0xcbfe('0x26')](function(_0x3105c9){if(_0x3105c9){return _0x3105c9['removeLists'](_0x2dc642[_0xcbfe('0x34')][_0xcbfe('0x65')]);}})[_0xcbfe('0x26')](function(_0x44f588){if(_0x44f588){return db[_0xcbfe('0x5a')][_0xcbfe('0x25')]({'where':{'ListId':_0x2dc642['query'][_0xcbfe('0x65')],'CampaignId':_0x2dc642[_0xcbfe('0x47')]['id']}})[_0xcbfe('0x26')](function(){return _0x44f588;});}})['then'](respondWithStatusCode(_0x56343e,null))['catch'](handleError(_0x56343e,null));};exports[_0xcbfe('0x84')]=function(_0x1af607,_0x1257b4,_0x463d32){var _0x50dcd1={};var _0x3b58fe={};var _0xcd5b24;var _0x26ff89;return db[_0xcbfe('0x42')][_0xcbfe('0x59')]({'where':{'id':_0x1af607[_0xcbfe('0x47')]['id']}})['then'](handleEntityNotFound(_0x1257b4,null))['then'](function(_0x40e938){if(_0x40e938){_0xcd5b24=_0x40e938;_0x3b58fe[_0xcbfe('0x32')]=_[_0xcbfe('0x48')](db[_0xcbfe('0x85')][_0xcbfe('0x2f')]);_0x3b58fe[_0xcbfe('0x34')]=_[_0xcbfe('0x48')](_0x1af607[_0xcbfe('0x34')]);_0x3b58fe[_0xcbfe('0x35')]=_[_0xcbfe('0x49')](_0x3b58fe[_0xcbfe('0x32')],_0x3b58fe['query']);_0x50dcd1[_0xcbfe('0x36')]=_[_0xcbfe('0x49')](_0x3b58fe[_0xcbfe('0x32')],qs['fields'](_0x1af607[_0xcbfe('0x34')][_0xcbfe('0x37')]));_0x50dcd1['attributes']=_0x50dcd1[_0xcbfe('0x36')][_0xcbfe('0x4a')]?_0x50dcd1[_0xcbfe('0x36')]:_0x3b58fe[_0xcbfe('0x32')];_0x50dcd1['order']=qs[_0xcbfe('0x3b')](_0x1af607[_0xcbfe('0x34')]['sort']);_0x50dcd1['where']=qs[_0xcbfe('0x35')](_['pick'](_0x1af607[_0xcbfe('0x34')],_0x3b58fe[_0xcbfe('0x35')]));if(_0x1af607['query'][_0xcbfe('0x3d')]){_0x50dcd1[_0xcbfe('0x3c')]=_[_0xcbfe('0x3e')](_0x50dcd1[_0xcbfe('0x3c')],{'$or':_['map'](_0x50dcd1[_0xcbfe('0x36')],function(_0x4fe212){var _0x54f720={};_0x54f720[_0x4fe212]={'$like':'%'+_0x1af607['query'][_0xcbfe('0x3d')]+'%'};return _0x54f720;})});}_0x50dcd1=_[_0xcbfe('0x3e')]({},_0x50dcd1,_0x1af607[_0xcbfe('0x40')]);return _0xcd5b24[_0xcbfe('0x84')](_0x50dcd1);}})[_0xcbfe('0x26')](function(_0x184e88){if(_0x184e88){_0x26ff89=_0x184e88[_0xcbfe('0x4a')];if(!_0x1af607[_0xcbfe('0x34')][_0xcbfe('0x38')]('nolimit')){_0x50dcd1['limit']=qs[_0xcbfe('0x3a')](_0x1af607[_0xcbfe('0x34')]['limit']);_0x50dcd1[_0xcbfe('0x1f')]=qs[_0xcbfe('0x1f')](_0x1af607[_0xcbfe('0x34')][_0xcbfe('0x1f')]);}return _0xcd5b24[_0xcbfe('0x84')](_0x50dcd1);}})['then'](function(_0x1ff48d){if(_0x1ff48d){return _0x1ff48d?{'count':_0x26ff89,'rows':_0x1ff48d}:null;}})[_0xcbfe('0x26')](respondWithResult(_0x1257b4,null))['catch'](handleError(_0x1257b4,null));};exports[_0xcbfe('0x86')]=function(_0x148074,_0xbbc776,_0x1b847c){var _0x6a59ea,_0x471cb3;return db['Campaign'][_0xcbfe('0x4c')]({'where':{'id':_0x148074[_0xcbfe('0x47')]['id']}})[_0xcbfe('0x26')](handleEntityNotFound(_0xbbc776,null))[_0xcbfe('0x26')](function(_0x5cb0cf){if(_0x5cb0cf){_0x471cb3=_0x5cb0cf;return _0x5cb0cf[_0xcbfe('0x86')](_0x148074[_0xcbfe('0x4e')][_0xcbfe('0x65')],_[_0xcbfe('0x54')](_0x148074[_0xcbfe('0x4e')],[_0xcbfe('0x65'),'id'])||{});}return null;})[_0xcbfe('0x87')](function(_0x573712){var _0x58aed0;_0x6a59ea=_0x573712||[];var _0x3a88c7=[];if(_0x573712){for(var _0x12d478=0x0;_0x12d478<_0x573712['length'];_0x12d478+=0x1){var _0x5b8566=_0x573712[_0x12d478][_0xcbfe('0x27')]({'plain':!![]});_0x58aed0=squel[_0xcbfe('0x68')]()[_0xcbfe('0x69')](_0xcbfe('0x88'))[_0xcbfe('0x6a')](['phone',_0xcbfe('0x70'),_0xcbfe('0x6d'),_0xcbfe('0x5d'),_0xcbfe('0x55'),_0xcbfe('0x56')],squel[_0xcbfe('0x76')]()['field'](_0xcbfe('0x6b'),'phone')[_0xcbfe('0x6e')]('id',_0xcbfe('0x70'))[_0xcbfe('0x6e')](_0x5b8566[_0xcbfe('0x71')][_0xcbfe('0x7a')](),_0xcbfe('0x6d'))['field'](_0x148074[_0xcbfe('0x47')]['id'][_0xcbfe('0x7a')](),_0xcbfe('0x5d'))[_0xcbfe('0x6e')](_0xcbfe('0x6f'),'createdAt')['field'](_0xcbfe('0x6f'),_0xcbfe('0x56'))[_0xcbfe('0x72')]('cm_contacts')[_0xcbfe('0x3c')](_0xcbfe('0x7e'))[_0xcbfe('0x3c')](_0xcbfe('0x7f'),_0x5b8566[_0xcbfe('0x71')][_0xcbfe('0x7a')]())[_0xcbfe('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0xcbfe('0x7a')]();_0x3a88c7['push'](db['sequelize'][_0xcbfe('0x34')](_0x58aed0));}return BPromise[_0xcbfe('0x82')](_0x3a88c7);}})[_0xcbfe('0x26')](function(){return _0x6a59ea;})[_0xcbfe('0x26')](respondWithResult(_0xbbc776,null))[_0xcbfe('0x45')](handleError(_0xbbc776,null));};exports['removeBlackLists']=function(_0x29060e,_0x3e448f,_0x124eb2){return db[_0xcbfe('0x42')][_0xcbfe('0x4c')]({'where':{'id':_0x29060e['params']['id']}})[_0xcbfe('0x26')](handleEntityNotFound(_0x3e448f,null))['then'](function(_0x278a50){if(_0x278a50){return _0x278a50[_0xcbfe('0x89')](_0x29060e[_0xcbfe('0x34')][_0xcbfe('0x65')]);}})[_0xcbfe('0x26')](function(_0x11a557){if(_0x11a557){return db[_0xcbfe('0x62')][_0xcbfe('0x25')]({'where':{'ListId':_0x29060e['query'][_0xcbfe('0x65')],'CampaignId':_0x29060e[_0xcbfe('0x47')]['id']}})[_0xcbfe('0x26')](function(){return _0x11a557;});}})[_0xcbfe('0x26')](respondWithStatusCode(_0x3e448f,null))[_0xcbfe('0x45')](handleError(_0x3e448f,null));}; \ No newline at end of file +var _0x8ce1=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','name','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','create','body','user','get','role','IvrCampaigns','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','UserProfileSection','autoAssociation','error','findOne','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','onlyIfOpen','scheduledAt','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x551e71,_0xda3812){var _0x4960c5=function(_0x1dd271){while(--_0x1dd271){_0x551e71['push'](_0x551e71['shift']());}};_0x4960c5(++_0xda3812);}(_0x8ce1,0x183));var _0x18ce=function(_0x3fa51f,_0x3cc15a){_0x3fa51f=_0x3fa51f-0x0;var _0x2dfc0d=_0x8ce1[_0x3fa51f];return _0x2dfc0d;};'use strict';var pdf=require(_0x18ce('0x0'));var emlformat=require(_0x18ce('0x1'));var rimraf=require(_0x18ce('0x2'));var zipdir=require(_0x18ce('0x3'));var jsonpatch=require(_0x18ce('0x4'));var rp=require(_0x18ce('0x5'));var moment=require(_0x18ce('0x6'));var BPromise=require(_0x18ce('0x7'));var Mustache=require(_0x18ce('0x8'));var util=require(_0x18ce('0x9'));var path=require(_0x18ce('0xa'));var sox=require(_0x18ce('0xb'));var csv=require(_0x18ce('0xc'));var ejs=require(_0x18ce('0xd'));var fs=require('fs');var _=require(_0x18ce('0xe'));var squel=require(_0x18ce('0xf'));var crypto=require('crypto');var jsforce=require(_0x18ce('0x10'));var deskjs=require(_0x18ce('0x11'));var toCsv=require(_0x18ce('0xc'));var querystring=require(_0x18ce('0x12'));var Papa=require('papaparse');var Redis=require(_0x18ce('0x13'));var authService=require(_0x18ce('0x14'));var qs=require(_0x18ce('0x15'));var as=require(_0x18ce('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18ce('0x17'));var utils=require(_0x18ce('0x18'));var config=require(_0x18ce('0x19'));var licenseUtil=require(_0x18ce('0x1a'));var db=require(_0x18ce('0x1b'))['db'];function respondWithStatusCode(_0x5e8c23,_0xbd514b){_0xbd514b=_0xbd514b||0xcc;return function(_0x402ba4){if(_0x402ba4){return _0x5e8c23[_0x18ce('0x1c')](_0xbd514b);}return _0x5e8c23[_0x18ce('0x1d')](_0xbd514b)[_0x18ce('0x1e')]();};}function respondWithResult(_0x5daf04,_0x176797){_0x176797=_0x176797||0xc8;return function(_0xdd4626){if(_0xdd4626){return _0x5daf04[_0x18ce('0x1d')](_0x176797)[_0x18ce('0x1f')](_0xdd4626);}};}function respondWithFilteredResult(_0x46e346,_0x36b5da){return function(_0x17460e){if(_0x17460e){var _0x4a934f=_0x17460e[_0x18ce('0x20')],_0x959ce=_0x36b5da[_0x18ce('0x21')],_0x1357ef=_0x36b5da[_0x18ce('0x21')]+_0x36b5da['limit'],_0x204d1a;if(_0x1357ef>=_0x4a934f){_0x1357ef=_0x4a934f;_0x204d1a=0xc8;}else{_0x204d1a=0xce;}_0x46e346[_0x18ce('0x1d')](_0x204d1a);return _0x46e346[_0x18ce('0x22')](_0x18ce('0x23'),_0x959ce+'-'+_0x1357ef+'/'+_0x4a934f)['json'](_0x17460e);}return null;};}function patchUpdates(_0x35e446){return function(_0x2fa3d4){try{jsonpatch[_0x18ce('0x24')](_0x2fa3d4,_0x35e446,!![]);}catch(_0x57a706){return BPromise[_0x18ce('0x25')](_0x57a706);}return _0x2fa3d4[_0x18ce('0x26')]();};}function saveUpdates(_0x5d22cd,_0x29c1ab){return function(_0x1099c9){if(_0x1099c9){return _0x1099c9[_0x18ce('0x27')](_0x5d22cd)[_0x18ce('0x28')](function(_0x31b789){return _0x31b789;});}return null;};}function removeEntity(_0xd41f29,_0x35abf9){return function(_0x545459){if(_0x545459){return _0x545459[_0x18ce('0x29')]()['then'](function(){var _0x482c90=_0x545459['get']({'plain':!![]});var _0x32e910='IvrCampaigns';return db[_0x18ce('0x2a')][_0x18ce('0x29')]({'where':{'type':_0x32e910,'resourceId':_0x482c90['id']}})[_0x18ce('0x28')](function(){return _0x545459;});})['then'](function(){_0xd41f29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x317812,_0x12b1ed){return function(_0x12dbd2){if(!_0x12dbd2){_0x317812[_0x18ce('0x1c')](0x194);}return _0x12dbd2;};}function handleError(_0x62b2bd,_0xc3cd4){_0xc3cd4=_0xc3cd4||0x1f4;return function(_0x5583c6){logger['error'](_0x5583c6['stack']);if(_0x5583c6[_0x18ce('0x2b')]){delete _0x5583c6[_0x18ce('0x2b')];}_0x62b2bd[_0x18ce('0x1d')](_0xc3cd4)['send'](_0x5583c6);};}exports[_0x18ce('0x2c')]=function(_0xf2683f,_0x1988e4){var _0x5ef96c={},_0x56d296={},_0x59e472={'count':0x0,'rows':[]};var _0x3e6d7c=_[_0x18ce('0x2d')](db['Campaign']['rawAttributes'],function(_0x3394a9){return{'name':_0x3394a9[_0x18ce('0x2e')],'type':_0x3394a9[_0x18ce('0x2f')]['key']};});_0x56d296['model']=_[_0x18ce('0x2d')](_0x3e6d7c,_0x18ce('0x2b'));_0x56d296[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0xf2683f[_0x18ce('0x30')]);_0x56d296[_0x18ce('0x32')]=_[_0x18ce('0x33')](_0x56d296[_0x18ce('0x34')],_0x56d296['query']);_0x5ef96c['attributes']=_[_0x18ce('0x33')](_0x56d296[_0x18ce('0x34')],qs['fields'](_0xf2683f[_0x18ce('0x30')]['fields']));_0x5ef96c[_0x18ce('0x35')]=_0x5ef96c['attributes'][_0x18ce('0x36')]?_0x5ef96c[_0x18ce('0x35')]:_0x56d296[_0x18ce('0x34')];if(!_0xf2683f['query']['hasOwnProperty'](_0x18ce('0x37'))){_0x5ef96c[_0x18ce('0x38')]=qs['limit'](_0xf2683f['query'][_0x18ce('0x38')]);_0x5ef96c[_0x18ce('0x21')]=qs[_0x18ce('0x21')](_0xf2683f[_0x18ce('0x30')][_0x18ce('0x21')]);}_0x5ef96c[_0x18ce('0x39')]=qs[_0x18ce('0x3a')](_0xf2683f[_0x18ce('0x30')][_0x18ce('0x3a')]);_0x5ef96c[_0x18ce('0x3b')]=qs[_0x18ce('0x32')](_[_0x18ce('0x3c')](_0xf2683f[_0x18ce('0x30')],_0x56d296['filters']),_0x3e6d7c);if(_0xf2683f[_0x18ce('0x30')][_0x18ce('0x3d')]){_0x5ef96c[_0x18ce('0x3b')]=_[_0x18ce('0x3e')](_0x5ef96c[_0x18ce('0x3b')],{'$or':_[_0x18ce('0x2d')](_0x3e6d7c,function(_0x112954){if(_0x112954[_0x18ce('0x2f')]!==_0x18ce('0x3f')){var _0x109d36={};_0x109d36[_0x112954['name']]={'$like':'%'+_0xf2683f['query'][_0x18ce('0x3d')]+'%'};return _0x109d36;}})});}_0x5ef96c=_[_0x18ce('0x3e')]({},_0x5ef96c,_0xf2683f[_0x18ce('0x40')]);var _0xb991da={'where':_0x5ef96c[_0x18ce('0x3b')]};return db[_0x18ce('0x41')][_0x18ce('0x20')](_0xb991da)['then'](function(_0x584985){_0x59e472[_0x18ce('0x20')]=_0x584985;if(_0xf2683f[_0x18ce('0x30')]['includeAll']){_0x5ef96c[_0x18ce('0x42')]=[{'all':!![]}];}return db[_0x18ce('0x41')][_0x18ce('0x43')](_0x5ef96c);})[_0x18ce('0x28')](function(_0xcd9536){_0x59e472[_0x18ce('0x44')]=_0xcd9536;return _0x59e472;})[_0x18ce('0x28')](respondWithFilteredResult(_0x1988e4,_0x5ef96c))[_0x18ce('0x45')](handleError(_0x1988e4,null));};exports[_0x18ce('0x46')]=function(_0x1d6d5f,_0x3885e6){var _0x20d107={'raw':![],'where':{'id':_0x1d6d5f[_0x18ce('0x47')]['id']}},_0x5968d6={};_0x5968d6[_0x18ce('0x34')]=_[_0x18ce('0x31')](db[_0x18ce('0x41')][_0x18ce('0x48')]);_0x5968d6[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x1d6d5f['query']);_0x5968d6['filters']=_[_0x18ce('0x33')](_0x5968d6[_0x18ce('0x34')],_0x5968d6[_0x18ce('0x30')]);_0x20d107[_0x18ce('0x35')]=_['intersection'](_0x5968d6[_0x18ce('0x34')],qs[_0x18ce('0x49')](_0x1d6d5f[_0x18ce('0x30')]['fields']));_0x20d107['attributes']=_0x20d107[_0x18ce('0x35')][_0x18ce('0x36')]?_0x20d107['attributes']:_0x5968d6[_0x18ce('0x34')];if(_0x1d6d5f[_0x18ce('0x30')][_0x18ce('0x4a')]){_0x20d107[_0x18ce('0x42')]=[{'all':!![]}];}_0x20d107=_[_0x18ce('0x3e')]({},_0x20d107,_0x1d6d5f[_0x18ce('0x40')]);return db[_0x18ce('0x41')]['find'](_0x20d107)[_0x18ce('0x28')](handleEntityNotFound(_0x3885e6,null))[_0x18ce('0x28')](respondWithResult(_0x3885e6,null))[_0x18ce('0x45')](handleError(_0x3885e6,null));};exports[_0x18ce('0x4b')]=function(_0x227fb6,_0xae0547){return db[_0x18ce('0x41')][_0x18ce('0x4b')](_0x227fb6[_0x18ce('0x4c')],{})[_0x18ce('0x28')](function(_0x1211d0){var _0x3f9960=_0x227fb6[_0x18ce('0x4d')][_0x18ce('0x4e')]({'plain':!![]});if(!_0x3f9960)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f9960[_0x18ce('0x4f')]===_0x18ce('0x4d')){var _0x530314=_0x1211d0[_0x18ce('0x4e')]({'plain':!![]});var _0x59e301=_0x18ce('0x50');return db['UserProfileSection'][_0x18ce('0x51')]({'where':{'name':_0x59e301,'userProfileId':_0x3f9960[_0x18ce('0x52')]},'raw':!![]})[_0x18ce('0x28')](function(_0xdfa85e){if(_0xdfa85e&&_0xdfa85e['autoAssociation']===0x0){return db[_0x18ce('0x2a')]['create']({'name':_0x530314['name'],'resourceId':_0x530314['id'],'type':_0xdfa85e[_0x18ce('0x2b')],'sectionId':_0xdfa85e['id']},{})[_0x18ce('0x28')](function(){return _0x1211d0;});}else{return _0x1211d0;}})[_0x18ce('0x45')](function(_0x5f164a){logger['error'](_0x18ce('0x53'),_0x5f164a);throw _0x5f164a;});}return _0x1211d0;})[_0x18ce('0x28')](respondWithResult(_0xae0547,0xc9))[_0x18ce('0x45')](handleError(_0xae0547,null));};exports[_0x18ce('0x54')]=function(_0x493a2c,_0x4dff1b){var _0x23dcf7={'where':{'id':_0x493a2c[_0x18ce('0x47')]['id']}},_0x4b095c={};_0x4b095c[_0x18ce('0x34')]=_[_0x18ce('0x31')](db['Campaign'][_0x18ce('0x48')]);_0x23dcf7[_0x18ce('0x35')]=_[_0x18ce('0x33')](_0x4b095c['model'],qs[_0x18ce('0x49')](_0x493a2c[_0x18ce('0x30')][_0x18ce('0x49')]));_0x23dcf7['attributes']=_0x23dcf7[_0x18ce('0x35')][_0x18ce('0x36')]?_0x23dcf7[_0x18ce('0x35')]:_0x4b095c[_0x18ce('0x34')];if(_0x493a2c['query']['includeAll']){_0x23dcf7[_0x18ce('0x42')]=[{'all':!![]}];}_0x23dcf7=_[_0x18ce('0x3e')]({},_0x23dcf7,_0x493a2c[_0x18ce('0x40')]);return db[_0x18ce('0x41')][_0x18ce('0x51')](_0x23dcf7)[_0x18ce('0x28')](handleEntityNotFound(_0x4dff1b,null))[_0x18ce('0x28')](function(_0x4f3ba4){if(_0x4f3ba4){var _0x14ffaf=_0x4f3ba4[_0x18ce('0x4e')]({'plain':!![]});_0x14ffaf=qs['omit'](_0x14ffaf,['id',_0x18ce('0x55'),'updatedAt']);_0x493a2c['body']=_[_0x18ce('0x56')](_0x493a2c[_0x18ce('0x4c')],['id',_0x18ce('0x55'),_0x18ce('0x57')]);return db[_0x18ce('0x41')][_0x18ce('0x4b')](_['merge'](_0x14ffaf,_0x493a2c[_0x18ce('0x4c')]),{'include':_0x493a2c[_0x18ce('0x30')][_0x18ce('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0xeb4215){var _0x5a080b=_0x493a2c[_0x18ce('0x4d')][_0x18ce('0x4e')]({'plain':!![]});if(!_0x5a080b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a080b['role']===_0x18ce('0x4d')){var _0x28beeb=_0xeb4215['get']({'plain':!![]});var _0x1d8734=_0x18ce('0x50');return db[_0x18ce('0x58')][_0x18ce('0x51')]({'where':{'name':_0x1d8734,'userProfileId':_0x5a080b[_0x18ce('0x52')]},'raw':!![]})['then'](function(_0x2f2fb8){if(_0x2f2fb8&&_0x2f2fb8[_0x18ce('0x59')]===0x0){return db['UserProfileResource']['create']({'name':_0x28beeb[_0x18ce('0x2b')],'resourceId':_0x28beeb['id'],'type':_0x2f2fb8[_0x18ce('0x2b')],'sectionId':_0x2f2fb8['id']},{})[_0x18ce('0x28')](function(){return _0xeb4215;});}else{return _0xeb4215;}})[_0x18ce('0x45')](function(_0x2ff5c7){logger[_0x18ce('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ff5c7);throw _0x2ff5c7;});}return _0xeb4215;});}})['then'](respondWithResult(_0x4dff1b,0xc9))[_0x18ce('0x45')](handleError(_0x4dff1b,null));};exports[_0x18ce('0x27')]=function(_0xaa90d8,_0x4cbf50){if(_0xaa90d8[_0x18ce('0x4c')]['id']){delete _0xaa90d8[_0x18ce('0x4c')]['id'];}return db['Campaign'][_0x18ce('0x51')]({'where':{'id':_0xaa90d8[_0x18ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x4cbf50,null))[_0x18ce('0x28')](saveUpdates(_0xaa90d8['body'],null))['then'](respondWithResult(_0x4cbf50,null))[_0x18ce('0x45')](handleError(_0x4cbf50,null));};exports[_0x18ce('0x29')]=function(_0x2c6802,_0x44d6d7){return db[_0x18ce('0x41')]['find']({'where':{'id':_0x2c6802[_0x18ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x44d6d7,null))[_0x18ce('0x28')](removeEntity(_0x44d6d7,null))['catch'](handleError(_0x44d6d7,null));};exports['getHoppers']=function(_0x35d9c3,_0x59f9d0,_0x1ef9f9){var _0x2bdc69={'raw':!![],'where':{}};var _0x583afc={};var _0x159ddb={'count':0x0,'rows':[]};return db[_0x18ce('0x41')][_0x18ce('0x5b')]({'where':{'id':_0x35d9c3[_0x18ce('0x47')]['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x59f9d0,null))[_0x18ce('0x28')](function(_0xdff27){if(_0xdff27){_0x583afc[_0x18ce('0x34')]=_[_0x18ce('0x31')](db[_0x18ce('0x5c')]['rawAttributes']);_0x583afc[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x35d9c3[_0x18ce('0x30')]);_0x583afc[_0x18ce('0x32')]=_[_0x18ce('0x33')](_0x583afc[_0x18ce('0x34')],_0x583afc[_0x18ce('0x30')]);_0x2bdc69['attributes']=_['intersection'](_0x583afc[_0x18ce('0x34')],qs[_0x18ce('0x49')](_0x35d9c3[_0x18ce('0x30')][_0x18ce('0x49')]));_0x2bdc69['attributes']=_0x2bdc69[_0x18ce('0x35')][_0x18ce('0x36')]?_0x2bdc69[_0x18ce('0x35')]:_0x583afc[_0x18ce('0x34')];if(!_0x35d9c3[_0x18ce('0x30')][_0x18ce('0x5d')](_0x18ce('0x37'))){_0x2bdc69[_0x18ce('0x38')]=qs[_0x18ce('0x38')](_0x35d9c3[_0x18ce('0x30')][_0x18ce('0x38')]);_0x2bdc69[_0x18ce('0x21')]=qs[_0x18ce('0x21')](_0x35d9c3['query']['offset']);}_0x2bdc69[_0x18ce('0x39')]=qs[_0x18ce('0x3a')](_0x35d9c3['query'][_0x18ce('0x3a')]);_0x2bdc69[_0x18ce('0x3b')]=qs[_0x18ce('0x32')](_[_0x18ce('0x3c')](_0x35d9c3[_0x18ce('0x30')],_0x583afc['filters']));_0x2bdc69[_0x18ce('0x3b')][_0x18ce('0x5e')]=_0xdff27['id'];if(_0x35d9c3['query']['filter']){_0x2bdc69[_0x18ce('0x3b')]=_[_0x18ce('0x3e')](_0x2bdc69[_0x18ce('0x3b')],{'$or':_[_0x18ce('0x2d')](_0x2bdc69[_0x18ce('0x35')],function(_0x3691b9){var _0x1e6dee={};_0x1e6dee[_0x3691b9]={'$like':'%'+_0x35d9c3[_0x18ce('0x30')]['filter']+'%'};return _0x1e6dee;})});}_0x2bdc69=_[_0x18ce('0x3e')]({},_0x2bdc69,_0x35d9c3[_0x18ce('0x40')]);return db['CmHopper'][_0x18ce('0x20')]({'where':_0x2bdc69[_0x18ce('0x3b')]})['then'](function(_0xb3f779){_0x159ddb[_0x18ce('0x20')]=_0xb3f779;if(_0x35d9c3[_0x18ce('0x30')]['includeAll']){_0x2bdc69[_0x18ce('0x42')]=[{'all':!![]}];}return db['CmHopper'][_0x18ce('0x43')](_0x2bdc69);})['then'](function(_0x40b904){_0x159ddb[_0x18ce('0x44')]=_0x40b904;return _0x159ddb;});}})[_0x18ce('0x28')](respondWithFilteredResult(_0x59f9d0,_0x2bdc69))[_0x18ce('0x45')](handleError(_0x59f9d0,null));};exports[_0x18ce('0x5f')]=function(_0x124c96,_0x64c013,_0x3ccccb){var _0x2d9e23={'raw':!![],'where':{}};var _0xf5565c={};var _0xa05dcb={'count':0x0,'rows':[]};return db[_0x18ce('0x41')]['findOne']({'where':{'id':_0x124c96[_0x18ce('0x47')]['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x64c013,null))[_0x18ce('0x28')](function(_0x2556b8){if(_0x2556b8){_0xf5565c[_0x18ce('0x34')]=_['keys'](db['CmHopperHistory'][_0x18ce('0x48')]);_0xf5565c[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x124c96[_0x18ce('0x30')]);_0xf5565c[_0x18ce('0x32')]=_[_0x18ce('0x33')](_0xf5565c['model'],_0xf5565c['query']);_0x2d9e23[_0x18ce('0x35')]=_['intersection'](_0xf5565c[_0x18ce('0x34')],qs[_0x18ce('0x49')](_0x124c96['query'][_0x18ce('0x49')]));_0x2d9e23[_0x18ce('0x35')]=_0x2d9e23[_0x18ce('0x35')][_0x18ce('0x36')]?_0x2d9e23[_0x18ce('0x35')]:_0xf5565c['model'];if(!_0x124c96[_0x18ce('0x30')][_0x18ce('0x5d')](_0x18ce('0x37'))){_0x2d9e23[_0x18ce('0x38')]=qs[_0x18ce('0x38')](_0x124c96[_0x18ce('0x30')][_0x18ce('0x38')]);_0x2d9e23['offset']=qs[_0x18ce('0x21')](_0x124c96[_0x18ce('0x30')]['offset']);}_0x2d9e23[_0x18ce('0x39')]=qs[_0x18ce('0x3a')](_0x124c96[_0x18ce('0x30')][_0x18ce('0x3a')]);_0x2d9e23[_0x18ce('0x3b')]=qs[_0x18ce('0x32')](_[_0x18ce('0x3c')](_0x124c96[_0x18ce('0x30')],_0xf5565c[_0x18ce('0x32')]));_0x2d9e23[_0x18ce('0x3b')]['CampaignId']=_0x2556b8['id'];if(_0x124c96[_0x18ce('0x30')]['filter']){_0x2d9e23['where']=_[_0x18ce('0x3e')](_0x2d9e23[_0x18ce('0x3b')],{'$or':_['map'](_0x2d9e23[_0x18ce('0x35')],function(_0xe2cf21){var _0x37bbec={};_0x37bbec[_0xe2cf21]={'$like':'%'+_0x124c96[_0x18ce('0x30')]['filter']+'%'};return _0x37bbec;})});}_0x2d9e23=_[_0x18ce('0x3e')]({},_0x2d9e23,_0x124c96[_0x18ce('0x40')]);return db['CmHopperHistory'][_0x18ce('0x20')]({'where':_0x2d9e23[_0x18ce('0x3b')]})['then'](function(_0x465796){_0xa05dcb[_0x18ce('0x20')]=_0x465796;if(_0x124c96[_0x18ce('0x30')][_0x18ce('0x4a')]){_0x2d9e23[_0x18ce('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x18ce('0x43')](_0x2d9e23);})[_0x18ce('0x28')](function(_0x45ef95){_0xa05dcb['rows']=_0x45ef95;return _0xa05dcb;});}})[_0x18ce('0x28')](respondWithFilteredResult(_0x64c013,_0x2d9e23))[_0x18ce('0x45')](handleError(_0x64c013,null));};exports[_0x18ce('0x60')]=function(_0x188bfa,_0x2b9fce,_0x10b9fd){var _0x2297ea={'raw':!![],'where':{}};var _0x3c1701={};var _0x43d2d1={'count':0x0,'rows':[]};return db['Campaign'][_0x18ce('0x5b')]({'where':{'id':_0x188bfa[_0x18ce('0x47')]['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x2b9fce,null))[_0x18ce('0x28')](function(_0x16677a){if(_0x16677a){_0x3c1701[_0x18ce('0x34')]=_[_0x18ce('0x31')](db[_0x18ce('0x61')][_0x18ce('0x48')]);_0x3c1701[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x188bfa[_0x18ce('0x30')]);_0x3c1701['filters']=_[_0x18ce('0x33')](_0x3c1701[_0x18ce('0x34')],_0x3c1701[_0x18ce('0x30')]);_0x2297ea[_0x18ce('0x35')]=_[_0x18ce('0x33')](_0x3c1701['model'],qs[_0x18ce('0x49')](_0x188bfa[_0x18ce('0x30')][_0x18ce('0x49')]));_0x2297ea[_0x18ce('0x35')]=_0x2297ea[_0x18ce('0x35')][_0x18ce('0x36')]?_0x2297ea[_0x18ce('0x35')]:_0x3c1701[_0x18ce('0x34')];if(!_0x188bfa[_0x18ce('0x30')][_0x18ce('0x5d')](_0x18ce('0x37'))){_0x2297ea[_0x18ce('0x38')]=qs[_0x18ce('0x38')](_0x188bfa[_0x18ce('0x30')][_0x18ce('0x38')]);_0x2297ea[_0x18ce('0x21')]=qs[_0x18ce('0x21')](_0x188bfa[_0x18ce('0x30')]['offset']);}_0x2297ea[_0x18ce('0x39')]=qs[_0x18ce('0x3a')](_0x188bfa[_0x18ce('0x30')][_0x18ce('0x3a')]);_0x2297ea['where']=qs[_0x18ce('0x32')](_[_0x18ce('0x3c')](_0x188bfa[_0x18ce('0x30')],_0x3c1701[_0x18ce('0x32')]));_0x2297ea[_0x18ce('0x3b')][_0x18ce('0x5e')]=_0x16677a['id'];if(_0x188bfa[_0x18ce('0x30')][_0x18ce('0x3d')]){_0x2297ea[_0x18ce('0x3b')]=_['merge'](_0x2297ea['where'],{'$or':_[_0x18ce('0x2d')](_0x2297ea['attributes'],function(_0x752ec6){var _0x3eb07b={};_0x3eb07b[_0x752ec6]={'$like':'%'+_0x188bfa['query'][_0x18ce('0x3d')]+'%'};return _0x3eb07b;})});}_0x2297ea=_[_0x18ce('0x3e')]({},_0x2297ea,_0x188bfa[_0x18ce('0x40')]);return db[_0x18ce('0x61')]['count']({'where':_0x2297ea[_0x18ce('0x3b')]})['then'](function(_0x451286){_0x43d2d1[_0x18ce('0x20')]=_0x451286;if(_0x188bfa[_0x18ce('0x30')][_0x18ce('0x4a')]){_0x2297ea[_0x18ce('0x42')]=[{'all':!![]}];}return db[_0x18ce('0x61')][_0x18ce('0x43')](_0x2297ea);})[_0x18ce('0x28')](function(_0x9907da){_0x43d2d1[_0x18ce('0x44')]=_0x9907da;return _0x43d2d1;});}})[_0x18ce('0x28')](respondWithFilteredResult(_0x2b9fce,_0x2297ea))['catch'](handleError(_0x2b9fce,null));};exports['getHopperBlacks']=function(_0x35c2bd,_0x4b2378,_0x81444e){var _0x33653e={'raw':!![],'where':{}};var _0x4042db={};var _0x502a34={'count':0x0,'rows':[]};return db[_0x18ce('0x41')]['findOne']({'where':{'id':_0x35c2bd['params']['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x4b2378,null))[_0x18ce('0x28')](function(_0x6c0346){if(_0x6c0346){_0x4042db[_0x18ce('0x34')]=_[_0x18ce('0x31')](db['CmHopperBlack']['rawAttributes']);_0x4042db['query']=_[_0x18ce('0x31')](_0x35c2bd['query']);_0x4042db['filters']=_[_0x18ce('0x33')](_0x4042db[_0x18ce('0x34')],_0x4042db[_0x18ce('0x30')]);_0x33653e['attributes']=_[_0x18ce('0x33')](_0x4042db[_0x18ce('0x34')],qs['fields'](_0x35c2bd[_0x18ce('0x30')]['fields']));_0x33653e[_0x18ce('0x35')]=_0x33653e[_0x18ce('0x35')][_0x18ce('0x36')]?_0x33653e[_0x18ce('0x35')]:_0x4042db[_0x18ce('0x34')];if(!_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x5d')](_0x18ce('0x37'))){_0x33653e['limit']=qs[_0x18ce('0x38')](_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x38')]);_0x33653e[_0x18ce('0x21')]=qs[_0x18ce('0x21')](_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x21')]);}_0x33653e['order']=qs[_0x18ce('0x3a')](_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x3a')]);_0x33653e[_0x18ce('0x3b')]=qs['filters'](_[_0x18ce('0x3c')](_0x35c2bd['query'],_0x4042db[_0x18ce('0x32')]));_0x33653e[_0x18ce('0x3b')][_0x18ce('0x5e')]=_0x6c0346['id'];if(_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x3d')]){_0x33653e[_0x18ce('0x3b')]=_[_0x18ce('0x3e')](_0x33653e[_0x18ce('0x3b')],{'$or':_['map'](_0x33653e[_0x18ce('0x35')],function(_0x201fd0){var _0xc8c5c5={};_0xc8c5c5[_0x201fd0]={'$like':'%'+_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x3d')]+'%'};return _0xc8c5c5;})});}_0x33653e=_[_0x18ce('0x3e')]({},_0x33653e,_0x35c2bd[_0x18ce('0x40')]);return db[_0x18ce('0x62')][_0x18ce('0x20')]({'where':_0x33653e[_0x18ce('0x3b')]})[_0x18ce('0x28')](function(_0x3a29bc){_0x502a34[_0x18ce('0x20')]=_0x3a29bc;if(_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x4a')]){_0x33653e[_0x18ce('0x42')]=[{'all':!![]}];}return db[_0x18ce('0x62')][_0x18ce('0x43')](_0x33653e);})[_0x18ce('0x28')](function(_0x168bef){_0x502a34[_0x18ce('0x44')]=_0x168bef;return _0x502a34;});}})[_0x18ce('0x28')](respondWithFilteredResult(_0x4b2378,_0x33653e))[_0x18ce('0x45')](handleError(_0x4b2378,null));};exports[_0x18ce('0x63')]=function(_0xfe9465,_0x3e3d11,_0x2ca914){var _0x481518={};var _0x2f4a64={};var _0x3b3a52;var _0x33a2bb;return db[_0x18ce('0x41')][_0x18ce('0x5b')]({'where':{'id':_0xfe9465[_0x18ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e3d11,null))[_0x18ce('0x28')](function(_0x578391){if(_0x578391){_0x3b3a52=_0x578391;_0x2f4a64[_0x18ce('0x34')]=_[_0x18ce('0x31')](db[_0x18ce('0x64')][_0x18ce('0x48')]);_0x2f4a64[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0xfe9465['query']);_0x2f4a64[_0x18ce('0x32')]=_[_0x18ce('0x33')](_0x2f4a64[_0x18ce('0x34')],_0x2f4a64[_0x18ce('0x30')]);_0x481518['attributes']=_[_0x18ce('0x33')](_0x2f4a64['model'],qs[_0x18ce('0x49')](_0xfe9465[_0x18ce('0x30')][_0x18ce('0x49')]));_0x481518[_0x18ce('0x35')]=_0x481518[_0x18ce('0x35')][_0x18ce('0x36')]?_0x481518[_0x18ce('0x35')]:_0x2f4a64['model'];_0x481518[_0x18ce('0x39')]=qs[_0x18ce('0x3a')](_0xfe9465[_0x18ce('0x30')][_0x18ce('0x3a')]);_0x481518[_0x18ce('0x3b')]=qs['filters'](_[_0x18ce('0x3c')](_0xfe9465[_0x18ce('0x30')],_0x2f4a64[_0x18ce('0x32')]));if(_0xfe9465[_0x18ce('0x30')][_0x18ce('0x3d')]){_0x481518[_0x18ce('0x3b')]=_[_0x18ce('0x3e')](_0x481518[_0x18ce('0x3b')],{'$or':_[_0x18ce('0x2d')](_0x481518['attributes'],function(_0x27a521){var _0x50745b={};_0x50745b[_0x27a521]={'$like':'%'+_0xfe9465['query'][_0x18ce('0x3d')]+'%'};return _0x50745b;})});}_0x481518=_[_0x18ce('0x3e')]({},_0x481518,_0xfe9465[_0x18ce('0x40')]);return _0x3b3a52[_0x18ce('0x63')](_0x481518);}})['then'](function(_0x30b6e0){if(_0x30b6e0){_0x33a2bb=_0x30b6e0[_0x18ce('0x36')];if(!_0xfe9465[_0x18ce('0x30')][_0x18ce('0x5d')](_0x18ce('0x37'))){_0x481518[_0x18ce('0x38')]=qs[_0x18ce('0x38')](_0xfe9465[_0x18ce('0x30')]['limit']);_0x481518[_0x18ce('0x21')]=qs[_0x18ce('0x21')](_0xfe9465[_0x18ce('0x30')][_0x18ce('0x21')]);}return _0x3b3a52['getLists'](_0x481518);}})[_0x18ce('0x28')](function(_0xd312a1){if(_0xd312a1){return _0xd312a1?{'count':_0x33a2bb,'rows':_0xd312a1}:null;}})[_0x18ce('0x28')](respondWithResult(_0x3e3d11,null))[_0x18ce('0x45')](handleError(_0x3e3d11,null));};exports[_0x18ce('0x65')]=function(_0xbac32b,_0xfa0a7,_0x505163){var _0x350654,_0x1ecf8b;return db[_0x18ce('0x41')][_0x18ce('0x51')]({'where':{'id':_0xbac32b[_0x18ce('0x47')]['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0xfa0a7,null))[_0x18ce('0x28')](function(_0xa82cfa){if(_0xa82cfa){_0x1ecf8b=_0xa82cfa;return _0xa82cfa['addLists'](_0xbac32b[_0x18ce('0x4c')][_0x18ce('0x66')],_[_0x18ce('0x56')](_0xbac32b[_0x18ce('0x4c')],[_0x18ce('0x66'),'id'])||{});}return null;})[_0x18ce('0x67')](function(_0xbe8375){var _0x3a4bf9;_0x350654=_0xbe8375||[];var _0x49980b=[];if(_0xbe8375){for(var _0x415bb8=0x0;_0x415bb8<_0xbe8375['length'];_0x415bb8+=0x1){var _0x5a234a=_0xbe8375[_0x415bb8][_0x18ce('0x4e')]({'plain':!![]});_0x1ecf8b[_0x18ce('0x68')]=_0xbac32b[_0x18ce('0x4c')][_0x18ce('0x68')]?_0xbac32b[_0x18ce('0x4c')][_0x18ce('0x68')]:_0x1ecf8b['dialCheckDuplicateType'];switch(_0x1ecf8b[_0x18ce('0x68')]){case _0x18ce('0x69'):_0x3a4bf9=squel[_0x18ce('0x6a')]()[_0x18ce('0x6b')](_0x18ce('0x6c'))[_0x18ce('0x6d')]([_0x18ce('0x6e'),'scheduledAt',_0x18ce('0x6f'),_0x18ce('0x70'),'CampaignId',_0x18ce('0x55'),'updatedAt'],squel['select']()[_0x18ce('0x71')](_0x18ce('0x6e'),'phone')[_0x18ce('0x71')](_0x18ce('0x72'),'scheduledAt')[_0x18ce('0x71')]('id',_0x18ce('0x6f'))[_0x18ce('0x71')](_0x5a234a[_0x18ce('0x73')][_0x18ce('0x74')](),_0x18ce('0x70'))[_0x18ce('0x71')](_0xbac32b[_0x18ce('0x47')]['id'][_0x18ce('0x74')](),_0x18ce('0x5e'))['field']('NOW()','createdAt')['field'](_0x18ce('0x72'),_0x18ce('0x57'))[_0x18ce('0x75')](_0x18ce('0x76'))[_0x18ce('0x3b')](_0x18ce('0x77'))[_0x18ce('0x3b')]('ListId\x20=\x20?',_0x5a234a[_0x18ce('0x73')][_0x18ce('0x74')]())[_0x18ce('0x3b')](_0x18ce('0x78'))['where'](_0x18ce('0x79'),squel['select']()[_0x18ce('0x71')](_0x18ce('0x7a'))['from']('cm_hopper_final')[_0x18ce('0x3b')](_0x18ce('0x7b'),_0xbac32b[_0x18ce('0x47')]['id']['toString']()))[_0x18ce('0x3b')](_0x18ce('0x79'),squel[_0x18ce('0x7c')]()[_0x18ce('0x71')](_0x18ce('0x7d'))[_0x18ce('0x75')]('cm_hopper')[_0x18ce('0x3b')](_0x18ce('0x7b'),_0xbac32b[_0x18ce('0x47')]['id'][_0x18ce('0x74')]())))[_0x18ce('0x74')]();break;case _0x18ce('0x7e'):_0x3a4bf9=squel[_0x18ce('0x6a')]()[_0x18ce('0x6b')](_0x18ce('0x6c'))['fromQuery'](['phone',_0x18ce('0x7f'),'ContactId',_0x18ce('0x70'),'CampaignId',_0x18ce('0x55'),_0x18ce('0x57')],squel[_0x18ce('0x7c')]()[_0x18ce('0x71')](_0x18ce('0x6e'),_0x18ce('0x6e'))[_0x18ce('0x71')](_0x18ce('0x72'),_0x18ce('0x7f'))[_0x18ce('0x71')]('id',_0x18ce('0x6f'))['field'](_0x5a234a[_0x18ce('0x73')]['toString'](),_0x18ce('0x70'))[_0x18ce('0x71')](_0xbac32b['params']['id']['toString'](),_0x18ce('0x5e'))[_0x18ce('0x71')](_0x18ce('0x72'),_0x18ce('0x55'))[_0x18ce('0x71')](_0x18ce('0x72'),_0x18ce('0x57'))[_0x18ce('0x75')](_0x18ce('0x76'))[_0x18ce('0x3b')](_0x18ce('0x77'))[_0x18ce('0x3b')](_0x18ce('0x80'),_0x5a234a[_0x18ce('0x73')][_0x18ce('0x74')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x18ce('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x18ce('0x71')]('COALESCE(phone,\x27\x27)')[_0x18ce('0x75')](_0x18ce('0x6c'))[_0x18ce('0x3b')](_0x18ce('0x7b'),_0xbac32b['params']['id'][_0x18ce('0x74')]())))[_0x18ce('0x74')]();break;default:_0x3a4bf9=squel[_0x18ce('0x6a')]()[_0x18ce('0x6b')]('cm_hopper')['fromQuery']([_0x18ce('0x6e'),_0x18ce('0x7f'),_0x18ce('0x6f'),_0x18ce('0x70'),_0x18ce('0x5e'),_0x18ce('0x55'),_0x18ce('0x57')],squel[_0x18ce('0x7c')]()[_0x18ce('0x71')]('phone','phone')[_0x18ce('0x71')](_0x18ce('0x72'),_0x18ce('0x7f'))[_0x18ce('0x71')]('id','ContactId')['field'](_0x5a234a[_0x18ce('0x73')][_0x18ce('0x74')](),_0x18ce('0x70'))[_0x18ce('0x71')](_0xbac32b['params']['id']['toString'](),_0x18ce('0x5e'))[_0x18ce('0x71')]('NOW()',_0x18ce('0x55'))[_0x18ce('0x71')](_0x18ce('0x72'),_0x18ce('0x57'))[_0x18ce('0x75')]('cm_contacts')[_0x18ce('0x3b')](_0x18ce('0x77'))['where'](_0x18ce('0x80'),_0x5a234a['CmListId']['toString']())['where'](_0x18ce('0x78')))[_0x18ce('0x74')]();}_0x49980b[_0x18ce('0x81')](db[_0x18ce('0x82')][_0x18ce('0x30')](_0x3a4bf9));}return BPromise[_0x18ce('0x83')](_0x49980b);}})[_0x18ce('0x28')](function(){return _0x350654;})[_0x18ce('0x28')](respondWithResult(_0xfa0a7,null))[_0x18ce('0x45')](handleError(_0xfa0a7,null));};exports[_0x18ce('0x84')]=function(_0x22968a,_0x13afd1,_0xcdb634){return db[_0x18ce('0x41')][_0x18ce('0x51')]({'where':{'id':_0x22968a[_0x18ce('0x47')]['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x13afd1,null))[_0x18ce('0x28')](function(_0x5bffe9){if(_0x5bffe9){return _0x5bffe9[_0x18ce('0x84')](_0x22968a[_0x18ce('0x30')]['ids']);}})[_0x18ce('0x28')](function(_0x414d9e){if(_0x414d9e){return db['CmHopper'][_0x18ce('0x29')]({'where':{'ListId':_0x22968a[_0x18ce('0x30')][_0x18ce('0x66')],'CampaignId':_0x22968a[_0x18ce('0x47')]['id']}})[_0x18ce('0x28')](function(){return _0x414d9e;});}})['then'](respondWithStatusCode(_0x13afd1,null))[_0x18ce('0x45')](handleError(_0x13afd1,null));};exports['getBlackLists']=function(_0x3b7c1a,_0xbab991,_0x186ef0){var _0xf522fe={};var _0x3c9f92={};var _0x33cf97;var _0x52905;return db[_0x18ce('0x41')][_0x18ce('0x5b')]({'where':{'id':_0x3b7c1a['params']['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0xbab991,null))[_0x18ce('0x28')](function(_0x27a23c){if(_0x27a23c){_0x33cf97=_0x27a23c;_0x3c9f92[_0x18ce('0x34')]=_[_0x18ce('0x31')](db[_0x18ce('0x64')][_0x18ce('0x48')]);_0x3c9f92[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x3b7c1a['query']);_0x3c9f92['filters']=_[_0x18ce('0x33')](_0x3c9f92[_0x18ce('0x34')],_0x3c9f92[_0x18ce('0x30')]);_0xf522fe[_0x18ce('0x35')]=_[_0x18ce('0x33')](_0x3c9f92[_0x18ce('0x34')],qs[_0x18ce('0x49')](_0x3b7c1a[_0x18ce('0x30')][_0x18ce('0x49')]));_0xf522fe[_0x18ce('0x35')]=_0xf522fe[_0x18ce('0x35')][_0x18ce('0x36')]?_0xf522fe['attributes']:_0x3c9f92['model'];_0xf522fe[_0x18ce('0x39')]=qs[_0x18ce('0x3a')](_0x3b7c1a[_0x18ce('0x30')][_0x18ce('0x3a')]);_0xf522fe[_0x18ce('0x3b')]=qs[_0x18ce('0x32')](_['pick'](_0x3b7c1a[_0x18ce('0x30')],_0x3c9f92[_0x18ce('0x32')]));if(_0x3b7c1a['query'][_0x18ce('0x3d')]){_0xf522fe[_0x18ce('0x3b')]=_['merge'](_0xf522fe['where'],{'$or':_[_0x18ce('0x2d')](_0xf522fe[_0x18ce('0x35')],function(_0x5afd6c){var _0xe0a15f={};_0xe0a15f[_0x5afd6c]={'$like':'%'+_0x3b7c1a[_0x18ce('0x30')][_0x18ce('0x3d')]+'%'};return _0xe0a15f;})});}_0xf522fe=_[_0x18ce('0x3e')]({},_0xf522fe,_0x3b7c1a['options']);return _0x33cf97[_0x18ce('0x85')](_0xf522fe);}})['then'](function(_0x19dda6){if(_0x19dda6){_0x52905=_0x19dda6[_0x18ce('0x36')];if(!_0x3b7c1a['query']['hasOwnProperty'](_0x18ce('0x37'))){_0xf522fe[_0x18ce('0x38')]=qs['limit'](_0x3b7c1a[_0x18ce('0x30')][_0x18ce('0x38')]);_0xf522fe[_0x18ce('0x21')]=qs[_0x18ce('0x21')](_0x3b7c1a['query'][_0x18ce('0x21')]);}return _0x33cf97[_0x18ce('0x85')](_0xf522fe);}})['then'](function(_0x4a3f06){if(_0x4a3f06){return _0x4a3f06?{'count':_0x52905,'rows':_0x4a3f06}:null;}})[_0x18ce('0x28')](respondWithResult(_0xbab991,null))[_0x18ce('0x45')](handleError(_0xbab991,null));};exports['addBlackLists']=function(_0x269244,_0x44105d,_0x59ade5){var _0x8f74d3,_0x50d7d7;return db[_0x18ce('0x41')][_0x18ce('0x51')]({'where':{'id':_0x269244['params']['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x44105d,null))[_0x18ce('0x28')](function(_0x35d46a){if(_0x35d46a){_0x50d7d7=_0x35d46a;return _0x35d46a[_0x18ce('0x86')](_0x269244[_0x18ce('0x4c')][_0x18ce('0x66')],_[_0x18ce('0x56')](_0x269244[_0x18ce('0x4c')],[_0x18ce('0x66'),'id'])||{});}return null;})['spread'](function(_0x49c868){var _0x3c142e;_0x8f74d3=_0x49c868||[];var _0x1ac775=[];if(_0x49c868){for(var _0x162d62=0x0;_0x162d62<_0x49c868[_0x18ce('0x36')];_0x162d62+=0x1){var _0x1992c3=_0x49c868[_0x162d62][_0x18ce('0x4e')]({'plain':!![]});_0x3c142e=squel[_0x18ce('0x6a')]()[_0x18ce('0x6b')](_0x18ce('0x87'))[_0x18ce('0x6d')]([_0x18ce('0x6e'),'ContactId','ListId',_0x18ce('0x5e'),'createdAt','updatedAt'],squel[_0x18ce('0x7c')]()['field'](_0x18ce('0x6e'),_0x18ce('0x6e'))[_0x18ce('0x71')]('id',_0x18ce('0x6f'))[_0x18ce('0x71')](_0x1992c3['CmListId'][_0x18ce('0x74')](),_0x18ce('0x70'))[_0x18ce('0x71')](_0x269244[_0x18ce('0x47')]['id'][_0x18ce('0x74')](),'CampaignId')['field'](_0x18ce('0x72'),'createdAt')[_0x18ce('0x71')](_0x18ce('0x72'),_0x18ce('0x57'))[_0x18ce('0x75')](_0x18ce('0x76'))[_0x18ce('0x3b')](_0x18ce('0x77'))['where'](_0x18ce('0x80'),_0x1992c3[_0x18ce('0x73')][_0x18ce('0x74')]())[_0x18ce('0x3b')](_0x18ce('0x78')))[_0x18ce('0x74')]();_0x1ac775[_0x18ce('0x81')](db[_0x18ce('0x82')]['query'](_0x3c142e));}return BPromise['all'](_0x1ac775);}})[_0x18ce('0x28')](function(){return _0x8f74d3;})[_0x18ce('0x28')](respondWithResult(_0x44105d,null))[_0x18ce('0x45')](handleError(_0x44105d,null));};exports[_0x18ce('0x88')]=function(_0x1fd67b,_0x149ef5,_0x44c61b){return db[_0x18ce('0x41')]['find']({'where':{'id':_0x1fd67b['params']['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x149ef5,null))['then'](function(_0x39e766){if(_0x39e766){return _0x39e766['removeBlackLists'](_0x1fd67b[_0x18ce('0x30')][_0x18ce('0x66')]);}})['then'](function(_0x4dde1a){if(_0x4dde1a){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x1fd67b[_0x18ce('0x30')]['ids'],'CampaignId':_0x1fd67b['params']['id']}})[_0x18ce('0x28')](function(){return _0x4dde1a;});}})[_0x18ce('0x28')](respondWithStatusCode(_0x149ef5,null))['catch'](handleError(_0x149ef5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 7b4535f..82f068b 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 _0x24c8=['rimraf','../../config/environment','./campaign.attributes','exports','campaigns','lodash','api','moment','bluebird','request-promise','path'];(function(_0x13052e,_0x3fb64d){var _0x217a6f=function(_0x51d8c3){while(--_0x51d8c3){_0x13052e['push'](_0x13052e['shift']());}};_0x217a6f(++_0x3fb64d);}(_0x24c8,0x1de));var _0x824c=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0x24c8[_0x311909];return _0x8d3163;};'use strict';var _=require(_0x824c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x824c('0x1'));var moment=require(_0x824c('0x2'));var BPromise=require(_0x824c('0x3'));var rp=require(_0x824c('0x4'));var fs=require('fs');var path=require(_0x824c('0x5'));var rimraf=require(_0x824c('0x6'));var config=require(_0x824c('0x7'));var attributes=require(_0x824c('0x8'));module[_0x824c('0x9')]=function(_0x4ab5b7,_0x141d24){return _0x4ab5b7['define']('Campaign',attributes,{'tableName':_0x824c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44ea=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./campaign.attributes','exports','define','Campaign','campaigns','lodash','../../config/logger'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x44ea,0xa7));var _0xa44e=function(_0x206ea5,_0x1d209e){_0x206ea5=_0x206ea5-0x0;var _0x15d2ed=_0x44ea[_0x206ea5];return _0x15d2ed;};'use strict';var _=require(_0xa44e('0x0'));var util=require('util');var logger=require(_0xa44e('0x1'))(_0xa44e('0x2'));var moment=require(_0xa44e('0x3'));var BPromise=require(_0xa44e('0x4'));var rp=require(_0xa44e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa44e('0x6'));var config=require(_0xa44e('0x7'));var attributes=require(_0xa44e('0x8'));module[_0xa44e('0x9')]=function(_0x238714,_0x5e098b){return _0x238714[_0xa44e('0xa')](_0xa44e('0xb'),attributes,{'tableName':_0xa44e('0xc'),'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 f68d203..c2f3db8 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 _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x55312b,_0x4d8611){var _0x401856=function(_0x2f1600){while(--_0x2f1600){_0x55312b['push'](_0x55312b['shift']());}};_0x401856(++_0x4d8611);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x55c22f,_0x55bea0){var _0x4e037c=function(_0x48d82b){while(--_0x48d82b){_0x55c22f['push'](_0x55c22f['shift']());}};_0x4e037c(++_0x55bea0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 210c140..811c8a7 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 _0x7434=['post','addBlackLists','put','delete','destroy','/:id/lists','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','/:id/clone','clone'];(function(_0x51db59,_0x4b90f7){var _0x1822d6=function(_0x1e3bc3){while(--_0x1e3bc3){_0x51db59['push'](_0x51db59['shift']());}};_0x1822d6(++_0x4b90f7);}(_0x7434,0x15d));var _0x4743=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7434[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x4743('0x0'));var util=require(_0x4743('0x1'));var path=require(_0x4743('0x2'));var timeout=require(_0x4743('0x3'));var express=require(_0x4743('0x4'));var router=express[_0x4743('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4743('0x6'));var config=require(_0x4743('0x7'));var controller=require(_0x4743('0x8'));router[_0x4743('0x9')]('/',auth[_0x4743('0xa')](),controller[_0x4743('0xb')]);router[_0x4743('0x9')](_0x4743('0xc'),auth[_0x4743('0xa')](),controller[_0x4743('0xd')]);router[_0x4743('0x9')](_0x4743('0xe'),auth[_0x4743('0xa')](),controller[_0x4743('0xf')]);router[_0x4743('0x9')](_0x4743('0x10'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x4743('0x9')](_0x4743('0x11'),auth['isAuthenticated'](),controller[_0x4743('0x12')]);router[_0x4743('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x4743('0x13')]);router[_0x4743('0x9')]('/:id/lists',auth[_0x4743('0xa')](),controller[_0x4743('0x14')]);router[_0x4743('0x9')](_0x4743('0x15'),auth[_0x4743('0xa')](),controller[_0x4743('0x16')]);router['post']('/',auth[_0x4743('0xa')](),controller['create']);router['post'](_0x4743('0x17'),auth[_0x4743('0xa')](),controller[_0x4743('0x18')]);router[_0x4743('0x19')]('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router[_0x4743('0x19')](_0x4743('0x15'),auth['isAuthenticated'](),controller[_0x4743('0x1a')]);router[_0x4743('0x1b')](_0x4743('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4743('0x1c')]('/:id',auth[_0x4743('0xa')](),controller[_0x4743('0x1d')]);router['delete'](_0x4743('0x1e'),auth[_0x4743('0xa')](),controller[_0x4743('0x1f')]);router[_0x4743('0x1c')]('/:id/blacklists',auth[_0x4743('0xa')](),controller[_0x4743('0x20')]);module[_0x4743('0x21')]=router; \ No newline at end of file +var _0x5e1d=['clone','addLists','addBlackLists','put','destroy','delete','removeLists','removeBlackLists','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone'];(function(_0x1235b9,_0x42c5d8){var _0x190f27=function(_0x334b5f){while(--_0x334b5f){_0x1235b9['push'](_0x1235b9['shift']());}};_0x190f27(++_0x42c5d8);}(_0x5e1d,0x1e5));var _0xd5e1=function(_0x141749,_0x477b04){_0x141749=_0x141749-0x0;var _0x3e6932=_0x5e1d[_0x141749];return _0x3e6932;};'use strict';var multer=require(_0xd5e1('0x0'));var util=require(_0xd5e1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd5e1('0x2'));var router=express[_0xd5e1('0x3')]();var auth=require(_0xd5e1('0x4'));var interaction=require(_0xd5e1('0x5'));var config=require(_0xd5e1('0x6'));var controller=require(_0xd5e1('0x7'));router[_0xd5e1('0x8')]('/',auth['isAuthenticated'](),controller[_0xd5e1('0x9')]);router['get'](_0xd5e1('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd5e1('0x8')]('/:id/hoppers',auth[_0xd5e1('0xb')](),controller[_0xd5e1('0xc')]);router[_0xd5e1('0x8')](_0xd5e1('0xd'),auth['isAuthenticated'](),controller[_0xd5e1('0xe')]);router['get'](_0xd5e1('0xf'),auth['isAuthenticated'](),controller[_0xd5e1('0x10')]);router[_0xd5e1('0x8')](_0xd5e1('0x11'),auth[_0xd5e1('0xb')](),controller[_0xd5e1('0x12')]);router[_0xd5e1('0x8')](_0xd5e1('0x13'),auth[_0xd5e1('0xb')](),controller[_0xd5e1('0x14')]);router['get'](_0xd5e1('0x15'),auth[_0xd5e1('0xb')](),controller['getBlackLists']);router[_0xd5e1('0x16')]('/',auth['isAuthenticated'](),controller[_0xd5e1('0x17')]);router[_0xd5e1('0x16')](_0xd5e1('0x18'),auth['isAuthenticated'](),controller[_0xd5e1('0x19')]);router[_0xd5e1('0x16')](_0xd5e1('0x13'),auth['isAuthenticated'](),controller[_0xd5e1('0x1a')]);router['post']('/:id/blacklists',auth['isAuthenticated'](),controller[_0xd5e1('0x1b')]);router[_0xd5e1('0x1c')](_0xd5e1('0xa'),auth[_0xd5e1('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd5e1('0x1d')]);router[_0xd5e1('0x1e')](_0xd5e1('0x13'),auth[_0xd5e1('0xb')](),controller[_0xd5e1('0x1f')]);router[_0xd5e1('0x1e')](_0xd5e1('0x15'),auth[_0xd5e1('0xb')](),controller[_0xd5e1('0x20')]);module[_0xd5e1('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 4efcbc3..af5cddc 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 _0x016e=['STRING','key','sequelize','exports','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x016e,0x13d));var _0xe016=function(_0x48f2ca,_0x90fe71){_0x48f2ca=_0x48f2ca-0x0;var _0x42d3ec=_0x016e[_0x48f2ca];return _0x42d3ec;};'use strict';var Sequelize=require(_0xe016('0x0'));module[_0xe016('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xe016('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe016('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xe016('0x4'));}}}; \ No newline at end of file +var _0x2626=['sequelize','exports','STRING','TEXT','getDataValue'];(function(_0xc7a70c,_0x4441b3){var _0x187ed6=function(_0x4a732d){while(--_0x4a732d){_0xc7a70c['push'](_0xc7a70c['shift']());}};_0x187ed6(++_0x4441b3);}(_0x2626,0x1e5));var _0x6262=function(_0x582244,_0x33f08b){_0x582244=_0x582244-0x0;var _0x81f9e4=_0x2626[_0x582244];return _0x81f9e4;};'use strict';var Sequelize=require(_0x6262('0x0'));module[_0x6262('0x1')]={'key':{'type':Sequelize[_0x6262('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x6262('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x6262('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6262('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 0dd3fdd..2f362aa 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 _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x594cf7,_0x47933c){var _0x4b701b=function(_0x3ae3af){while(--_0x3ae3af){_0x594cf7['push'](_0x594cf7['shift']());}};_0x4b701b(++_0x47933c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,null));}; \ No newline at end of file +var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index dd18797..8797571 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 _0x1ee2=['../../config/logger','api','moment','request-promise','path','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x27aea8,_0xaa50d1){var _0x472468=function(_0xeb838f){while(--_0xeb838f){_0x27aea8['push'](_0x27aea8['shift']());}};_0x472468(++_0xaa50d1);}(_0x1ee2,0x11c));var _0x21ee=function(_0x764511,_0x4f6d72){_0x764511=_0x764511-0x0;var _0x4ffafc=_0x1ee2[_0x764511];return _0x4ffafc;};'use strict';var _=require(_0x21ee('0x0'));var util=require(_0x21ee('0x1'));var logger=require(_0x21ee('0x2'))(_0x21ee('0x3'));var moment=require(_0x21ee('0x4'));var BPromise=require('bluebird');var rp=require(_0x21ee('0x5'));var fs=require('fs');var path=require(_0x21ee('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x21ee('0x7'));module[_0x21ee('0x8')]=function(_0x221a30,_0x20a492){return _0x221a30['define'](_0x21ee('0x9'),attributes,{'tableName':_0x21ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x21ee('0xb'),'collate':_0x21ee('0xc')});}; \ No newline at end of file +var _0xe4e8=['moment','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','lodash','util','../../config/logger','api'];(function(_0x5cb62c,_0x1c4972){var _0x241fd0=function(_0x4eadb5){while(--_0x4eadb5){_0x5cb62c['push'](_0x5cb62c['shift']());}};_0x241fd0(++_0x1c4972);}(_0xe4e8,0x104));var _0x8e4e=function(_0x29976e,_0x5d1721){_0x29976e=_0x29976e-0x0;var _0x188bf0=_0xe4e8[_0x29976e];return _0x188bf0;};'use strict';var _=require(_0x8e4e('0x0'));var util=require(_0x8e4e('0x1'));var logger=require(_0x8e4e('0x2'))(_0x8e4e('0x3'));var moment=require(_0x8e4e('0x4'));var BPromise=require('bluebird');var rp=require(_0x8e4e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e4e('0x6'));var config=require(_0x8e4e('0x7'));var attributes=require(_0x8e4e('0x8'));module['exports']=function(_0x134c85,_0x3a9568){return _0x134c85['define'](_0x8e4e('0x9'),attributes,{'tableName':_0x8e4e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 3a600d8..5eecc39 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 _0x18e7=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x124e14,_0x1fba05){var _0x592ff8=function(_0x49a82e){while(--_0x49a82e){_0x124e14['push'](_0x124e14['shift']());}};_0x592ff8(++_0x1fba05);}(_0x18e7,0x93));var _0x718e=function(_0x50bc75,_0x2c7df4){_0x50bc75=_0x50bc75-0x0;var _0x1e3bfa=_0x18e7[_0x50bc75];return _0x1e3bfa;};'use strict';var _=require(_0x718e('0x0'));var util=require(_0x718e('0x1'));var moment=require(_0x718e('0x2'));var BPromise=require(_0x718e('0x3'));var rs=require(_0x718e('0x4'));var fs=require('fs');var Redis=require(_0x718e('0x5'));var db=require(_0x718e('0x6'))['db'];var utils=require(_0x718e('0x7'));var logger=require(_0x718e('0x8'))(_0x718e('0x9'));var config=require(_0x718e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x718e('0xb')][_0x718e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2230b6,_0x4fd447,_0x123e33){return new BPromise(function(_0x34369d,_0x1bdc36){return client['request'](_0x2230b6,_0x123e33)[_0x718e('0xd')](function(_0x5b0115){logger[_0x718e('0xe')](_0x718e('0xf'),_0x4fd447,_0x718e('0x10'));logger[_0x718e('0x11')](_0x718e('0x12'),_0x4fd447,_0x718e('0x10'),JSON[_0x718e('0x13')](_0x5b0115));if(_0x5b0115[_0x718e('0x14')]){if(_0x5b0115['error']['code']===0x1f4){logger[_0x718e('0x14')](_0x718e('0xf'),_0x4fd447,_0x5b0115[_0x718e('0x14')]['message']);return _0x1bdc36(_0x5b0115[_0x718e('0x14')]['message']);}logger[_0x718e('0x14')](_0x718e('0xf'),_0x4fd447,_0x5b0115[_0x718e('0x14')][_0x718e('0x15')]);return _0x34369d(_0x5b0115[_0x718e('0x14')][_0x718e('0x15')]);}else{logger[_0x718e('0xe')](_0x718e('0xf'),_0x4fd447,_0x718e('0x10'));_0x34369d(_0x5b0115[_0x718e('0x16')][_0x718e('0x15')]);}})[_0x718e('0x17')](function(_0x48baa6){logger[_0x718e('0x14')](_0x718e('0xf'),_0x4fd447,_0x48baa6);_0x1bdc36(_0x48baa6);});});} \ No newline at end of file +var _0x01e9=['CannedAnswer,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info'];(function(_0x8d3b4b,_0xd1db47){var _0x509753=function(_0x2e5ef8){while(--_0x2e5ef8){_0x8d3b4b['push'](_0x8d3b4b['shift']());}};_0x509753(++_0xd1db47);}(_0x01e9,0x192));var _0x901e=function(_0x223e4a,_0x321047){_0x223e4a=_0x223e4a-0x0;var _0x1322b2=_0x01e9[_0x223e4a];return _0x1322b2;};'use strict';var _=require(_0x901e('0x0'));var util=require(_0x901e('0x1'));var moment=require('moment');var BPromise=require(_0x901e('0x2'));var rs=require(_0x901e('0x3'));var fs=require('fs');var Redis=require(_0x901e('0x4'));var db=require(_0x901e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x901e('0x6'));var config=require(_0x901e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x901e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x242039,_0x210bec,_0xf51d85){return new BPromise(function(_0x32b8c6,_0x541ad7){return client[_0x901e('0x9')](_0x242039,_0xf51d85)[_0x901e('0xa')](function(_0x4c0e36){logger[_0x901e('0xb')](_0x901e('0xc'),_0x210bec,_0x901e('0xd'));logger['debug']('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x210bec,_0x901e('0xd'),JSON[_0x901e('0xe')](_0x4c0e36));if(_0x4c0e36[_0x901e('0xf')]){if(_0x4c0e36[_0x901e('0xf')]['code']===0x1f4){logger[_0x901e('0xf')](_0x901e('0xc'),_0x210bec,_0x4c0e36[_0x901e('0xf')]['message']);return _0x541ad7(_0x4c0e36[_0x901e('0xf')][_0x901e('0x10')]);}logger[_0x901e('0xf')](_0x901e('0xc'),_0x210bec,_0x4c0e36[_0x901e('0xf')][_0x901e('0x10')]);return _0x32b8c6(_0x4c0e36['error'][_0x901e('0x10')]);}else{logger[_0x901e('0xb')](_0x901e('0xc'),_0x210bec,_0x901e('0xd'));_0x32b8c6(_0x4c0e36['result'][_0x901e('0x10')]);}})[_0x901e('0x11')](function(_0x1fdb5f){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x210bec,_0x1fdb5f);_0x541ad7(_0x1fdb5f);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index b64cd85..2c01073 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 _0x7e5b=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4f4b6e,_0xf7577e){var _0x3f1bdb=function(_0x5456b1){while(--_0x5456b1){_0x4f4b6e['push'](_0x4f4b6e['shift']());}};_0x3f1bdb(++_0xf7577e);}(_0x7e5b,0x1bf));var _0xb7e5=function(_0x5798db,_0xf8180c){_0x5798db=_0x5798db-0x0;var _0x443917=_0x7e5b[_0x5798db];return _0x443917;};'use strict';var multer=require(_0xb7e5('0x0'));var util=require('util');var path=require(_0xb7e5('0x1'));var timeout=require(_0xb7e5('0x2'));var express=require(_0xb7e5('0x3'));var router=express[_0xb7e5('0x4')]();var auth=require(_0xb7e5('0x5'));var interaction=require(_0xb7e5('0x6'));var config=require('../../config/environment');var controller=require(_0xb7e5('0x7'));router[_0xb7e5('0x8')]('/',auth[_0xb7e5('0x9')](),controller[_0xb7e5('0xa')]);router[_0xb7e5('0x8')](_0xb7e5('0xb'),auth[_0xb7e5('0x9')](),controller[_0xb7e5('0xc')]);router[_0xb7e5('0xd')]('/',auth['isAuthenticated'](),controller[_0xb7e5('0xe')]);router[_0xb7e5('0xf')](_0xb7e5('0xb'),auth[_0xb7e5('0x9')](),controller[_0xb7e5('0x10')]);router[_0xb7e5('0x11')](_0xb7e5('0xb'),auth[_0xb7e5('0x9')](),controller[_0xb7e5('0x12')]);module[_0xb7e5('0x13')]=router; \ No newline at end of file +var _0x42eb=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x32ee03,_0x70c6ac){var _0x298bee=function(_0x28c75b){while(--_0x28c75b){_0x32ee03['push'](_0x32ee03['shift']());}};_0x298bee(++_0x70c6ac);}(_0x42eb,0xf5));var _0xb42e=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0x42eb[_0x263f4c];return _0x3a78d3;};'use strict';var multer=require(_0xb42e('0x0'));var util=require(_0xb42e('0x1'));var path=require(_0xb42e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb42e('0x3'));var router=express[_0xb42e('0x4')]();var auth=require(_0xb42e('0x5'));var interaction=require(_0xb42e('0x6'));var config=require(_0xb42e('0x7'));var controller=require('./cannedAnswer.controller');router[_0xb42e('0x8')]('/',auth[_0xb42e('0x9')](),controller['index']);router['get'](_0xb42e('0xa'),auth[_0xb42e('0x9')](),controller[_0xb42e('0xb')]);router[_0xb42e('0xc')]('/',auth[_0xb42e('0x9')](),controller[_0xb42e('0xd')]);router[_0xb42e('0xe')](_0xb42e('0xa'),auth[_0xb42e('0x9')](),controller['update']);router[_0xb42e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb42e('0x10')]);module[_0xb42e('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index afa51f1..aea923d 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 _0x3578=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x3578,0x191));var _0x8357=function(_0xc1ede1,_0x27c567){_0xc1ede1=_0xc1ede1-0x0;var _0x36f293=_0x3578[_0xc1ede1];return _0x36f293;};'use strict';var Sequelize=require(_0x8357('0x0'));module[_0x8357('0x1')]={'calldate':{'type':Sequelize[_0x8357('0x2')],'allowNull':![],'defaultValue':_0x8357('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x8357('0x4')]},'dcontext':{'type':Sequelize[_0x8357('0x4')]},'channel':{'type':Sequelize[_0x8357('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8357('0x4')]},'amaflags':{'type':Sequelize[_0x8357('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8357('0x4')]},'userfield':{'type':Sequelize[_0x8357('0x4')]},'uniqueid':{'type':Sequelize[_0x8357('0x4')]},'linkedid':{'type':Sequelize[_0x8357('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8357('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x28a9=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','DATE'];(function(_0x3f9882,_0x4063bb){var _0x18b725=function(_0x8e5916){while(--_0x8e5916){_0x3f9882['push'](_0x3f9882['shift']());}};_0x18b725(++_0x4063bb);}(_0x28a9,0xc6));var _0x928a=function(_0x4cd7fd,_0x315a81){_0x4cd7fd=_0x4cd7fd-0x0;var _0x11157d=_0x28a9[_0x4cd7fd];return _0x11157d;};'use strict';var Sequelize=require(_0x928a('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x928a('0x1')],'allowNull':![],'defaultValue':_0x928a('0x2')},'clid':{'type':Sequelize[_0x928a('0x3')]},'src':{'type':Sequelize[_0x928a('0x3')]},'dst':{'type':Sequelize[_0x928a('0x3')]},'dcontext':{'type':Sequelize[_0x928a('0x3')]},'channel':{'type':Sequelize[_0x928a('0x3')]},'dstchannel':{'type':Sequelize[_0x928a('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x928a('0x3')]},'duration':{'type':Sequelize[_0x928a('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x928a('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x928a('0x3')]},'userfield':{'type':Sequelize[_0x928a('0x3')]},'uniqueid':{'type':Sequelize[_0x928a('0x3')]},'linkedid':{'type':Sequelize[_0x928a('0x3')]},'sequence':{'type':Sequelize[_0x928a('0x3')]},'peeraccount':{'type':Sequelize[_0x928a('0x3')]},'type':{'type':Sequelize[_0x928a('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 290c2e5..7b8b8c1 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 _0x879b=['catch','params','fields','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','Cdr','includeAll','include','findAll'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x879b,0x9d));var _0xb879=function(_0x16803d,_0x2d35fa){_0x16803d=_0x16803d-0x0;var _0x47bd54=_0x879b[_0x16803d];return _0x47bd54;};'use strict';var pdf=require(_0xb879('0x0'));var emlformat=require(_0xb879('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb879('0x2'));var jsonpatch=require(_0xb879('0x3'));var rp=require(_0xb879('0x4'));var moment=require('moment');var BPromise=require(_0xb879('0x5'));var Mustache=require(_0xb879('0x6'));var util=require('util');var path=require(_0xb879('0x7'));var sox=require(_0xb879('0x8'));var csv=require(_0xb879('0x9'));var ejs=require(_0xb879('0xa'));var fs=require('fs');var _=require(_0xb879('0xb'));var squel=require(_0xb879('0xc'));var crypto=require(_0xb879('0xd'));var jsforce=require(_0xb879('0xe'));var deskjs=require(_0xb879('0xf'));var toCsv=require(_0xb879('0x9'));var querystring=require('querystring');var Papa=require(_0xb879('0x10'));var Redis=require(_0xb879('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb879('0x12'));var as=require(_0xb879('0x13'));var hardwareService=require(_0xb879('0x14'));var logger=require(_0xb879('0x15'))(_0xb879('0x16'));var utils=require(_0xb879('0x17'));var config=require(_0xb879('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb879('0x19'))['db'];function respondWithStatusCode(_0x1a42b9,_0x174939){_0x174939=_0x174939||0xcc;return function(_0x19910e){if(_0x19910e){return _0x1a42b9[_0xb879('0x1a')](_0x174939);}return _0x1a42b9['status'](_0x174939)[_0xb879('0x1b')]();};}function respondWithResult(_0xcf6fb2,_0x4776ac){_0x4776ac=_0x4776ac||0xc8;return function(_0x2ce871){if(_0x2ce871){return _0xcf6fb2['status'](_0x4776ac)[_0xb879('0x1c')](_0x2ce871);}};}function respondWithFilteredResult(_0x2f4bba,_0x2e7ead){return function(_0x801057){if(_0x801057){var _0x5e6aef=_0x801057[_0xb879('0x1d')],_0x431923=_0x2e7ead[_0xb879('0x1e')],_0x420d4e=_0x2e7ead['offset']+_0x2e7ead['limit'],_0x2a8edc;if(_0x420d4e>=_0x5e6aef){_0x420d4e=_0x5e6aef;_0x2a8edc=0xc8;}else{_0x2a8edc=0xce;}_0x2f4bba[_0xb879('0x1f')](_0x2a8edc);return _0x2f4bba[_0xb879('0x20')](_0xb879('0x21'),_0x431923+'-'+_0x420d4e+'/'+_0x5e6aef)[_0xb879('0x1c')](_0x801057);}return null;};}function patchUpdates(_0x1721e6){return function(_0x1764f2){try{jsonpatch[_0xb879('0x22')](_0x1764f2,_0x1721e6,!![]);}catch(_0x41e282){return BPromise[_0xb879('0x23')](_0x41e282);}return _0x1764f2[_0xb879('0x24')]();};}function saveUpdates(_0x2d7e3a,_0x191221){return function(_0xb560d6){if(_0xb560d6){return _0xb560d6[_0xb879('0x25')](_0x2d7e3a)['then'](function(_0x17046e){return _0x17046e;});}return null;};}function removeEntity(_0xa24b14,_0x477c21){return function(_0x4fa44a){if(_0x4fa44a){return _0x4fa44a[_0xb879('0x26')]()[_0xb879('0x27')](function(){_0xa24b14['status'](0xcc)[_0xb879('0x1b')]();});}};}function handleEntityNotFound(_0x575b75,_0x2791f6){return function(_0x232f84){if(!_0x232f84){_0x575b75[_0xb879('0x1a')](0x194);}return _0x232f84;};}function handleError(_0x2b1604,_0x3d0b1f){_0x3d0b1f=_0x3d0b1f||0x1f4;return function(_0x3b8953){logger[_0xb879('0x28')](_0x3b8953[_0xb879('0x29')]);if(_0x3b8953[_0xb879('0x2a')]){delete _0x3b8953[_0xb879('0x2a')];}_0x2b1604['status'](_0x3d0b1f)['send'](_0x3b8953);};}exports[_0xb879('0x2b')]=function(_0x54989e,_0x3e3fd0){var _0x189fa6={},_0xab2f1a={},_0xd4b2bd={'count':0x0,'rows':[]};var _0x3b8d6f=_[_0xb879('0x2c')](db['Cdr']['rawAttributes'],function(_0x49d9ff){return{'name':_0x49d9ff['fieldName'],'type':_0x49d9ff[_0xb879('0x2d')]['key']};});_0xab2f1a['model']=_['map'](_0x3b8d6f,_0xb879('0x2a'));_0xab2f1a[_0xb879('0x2e')]=_[_0xb879('0x2f')](_0x54989e[_0xb879('0x2e')]);_0xab2f1a[_0xb879('0x30')]=_[_0xb879('0x31')](_0xab2f1a[_0xb879('0x32')],_0xab2f1a[_0xb879('0x2e')]);_0x189fa6[_0xb879('0x33')]=_[_0xb879('0x31')](_0xab2f1a[_0xb879('0x32')],qs['fields'](_0x54989e[_0xb879('0x2e')]['fields']));_0x189fa6['attributes']=_0x189fa6[_0xb879('0x33')][_0xb879('0x34')]?_0x189fa6[_0xb879('0x33')]:_0xab2f1a['model'];if(!_0x54989e['query'][_0xb879('0x35')](_0xb879('0x36'))){_0x189fa6[_0xb879('0x37')]=qs[_0xb879('0x37')](_0x54989e[_0xb879('0x2e')]['limit']);_0x189fa6[_0xb879('0x1e')]=qs[_0xb879('0x1e')](_0x54989e[_0xb879('0x2e')]['offset']);}_0x189fa6[_0xb879('0x38')]=qs[_0xb879('0x39')](_0x54989e[_0xb879('0x2e')][_0xb879('0x39')]);_0x189fa6[_0xb879('0x3a')]=qs[_0xb879('0x30')](_[_0xb879('0x3b')](_0x54989e[_0xb879('0x2e')],_0xab2f1a[_0xb879('0x30')]),_0x3b8d6f);if(_0x54989e[_0xb879('0x2e')]['filter']){_0x189fa6['where']=_[_0xb879('0x3c')](_0x189fa6[_0xb879('0x3a')],{'$or':_[_0xb879('0x2c')](_0x3b8d6f,function(_0x57c368){if(_0x57c368[_0xb879('0x2d')]!==_0xb879('0x3d')){var _0x542954={};_0x542954[_0x57c368[_0xb879('0x2a')]]={'$like':'%'+_0x54989e[_0xb879('0x2e')][_0xb879('0x3e')]+'%'};return _0x542954;}})});}_0x189fa6=_[_0xb879('0x3c')]({},_0x189fa6,_0x54989e[_0xb879('0x3f')]);var _0x191c11={'where':_0x189fa6[_0xb879('0x3a')]};return db[_0xb879('0x40')][_0xb879('0x1d')](_0x191c11)[_0xb879('0x27')](function(_0x3ff1b2){_0xd4b2bd[_0xb879('0x1d')]=_0x3ff1b2;if(_0x54989e['query'][_0xb879('0x41')]){_0x189fa6[_0xb879('0x42')]=[{'all':!![]}];}return db[_0xb879('0x40')][_0xb879('0x43')](_0x189fa6);})[_0xb879('0x27')](function(_0x2070ac){_0xd4b2bd['rows']=_0x2070ac;return _0xd4b2bd;})[_0xb879('0x27')](respondWithFilteredResult(_0x3e3fd0,_0x189fa6))[_0xb879('0x44')](handleError(_0x3e3fd0,null));};exports['show']=function(_0x59c5bc,_0x4f1c2e){var _0x28ac8f={'raw':!![],'where':{'id':_0x59c5bc[_0xb879('0x45')]['id']}},_0x56d242={};_0x56d242[_0xb879('0x32')]=_['keys'](db['Cdr']['rawAttributes']);_0x56d242[_0xb879('0x2e')]=_[_0xb879('0x2f')](_0x59c5bc[_0xb879('0x2e')]);_0x56d242[_0xb879('0x30')]=_[_0xb879('0x31')](_0x56d242['model'],_0x56d242['query']);_0x28ac8f['attributes']=_[_0xb879('0x31')](_0x56d242[_0xb879('0x32')],qs[_0xb879('0x46')](_0x59c5bc['query'][_0xb879('0x46')]));_0x28ac8f['attributes']=_0x28ac8f['attributes']['length']?_0x28ac8f[_0xb879('0x33')]:_0x56d242['model'];if(_0x59c5bc[_0xb879('0x2e')][_0xb879('0x41')]){_0x28ac8f[_0xb879('0x42')]=[{'all':!![]}];}_0x28ac8f=_['merge']({},_0x28ac8f,_0x59c5bc[_0xb879('0x3f')]);return db[_0xb879('0x40')][_0xb879('0x47')](_0x28ac8f)['then'](handleEntityNotFound(_0x4f1c2e,null))[_0xb879('0x27')](respondWithResult(_0x4f1c2e,null))[_0xb879('0x44')](handleError(_0x4f1c2e,null));};exports[_0xb879('0x48')]=function(_0x3546b3,_0x25d389){return db[_0xb879('0x40')][_0xb879('0x48')](_0x3546b3[_0xb879('0x49')],{})[_0xb879('0x27')](respondWithResult(_0x25d389,0xc9))[_0xb879('0x44')](handleError(_0x25d389,null));};exports[_0xb879('0x25')]=function(_0x25a693,_0x707854){if(_0x25a693[_0xb879('0x49')]['id']){delete _0x25a693['body']['id'];}return db['Cdr'][_0xb879('0x47')]({'where':{'id':_0x25a693[_0xb879('0x45')]['id']}})[_0xb879('0x27')](handleEntityNotFound(_0x707854,null))[_0xb879('0x27')](saveUpdates(_0x25a693[_0xb879('0x49')],null))['then'](respondWithResult(_0x707854,null))['catch'](handleError(_0x707854,null));};exports[_0xb879('0x26')]=function(_0x34f7db,_0x2ef43f){return db[_0xb879('0x40')]['find']({'where':{'id':_0x34f7db['params']['id']}})[_0xb879('0x27')](handleEntityNotFound(_0x2ef43f,null))[_0xb879('0x27')](removeEntity(_0x2ef43f,null))[_0xb879('0x44')](handleError(_0x2ef43f,null));};exports[_0xb879('0x4a')]=function(_0x2dca5c,_0x52b7c2){return db[_0xb879('0x40')][_0xb879('0x4a')]()[_0xb879('0x27')](respondWithResult(_0x52b7c2,null))[_0xb879('0x44')](handleError(_0x52b7c2,null));}; \ No newline at end of file +var _0xc7ef=['Cdr','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','length','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','json','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map'];(function(_0x512589,_0x3daf18){var _0x18243b=function(_0x4d2910){while(--_0x4d2910){_0x512589['push'](_0x512589['shift']());}};_0x18243b(++_0x3daf18);}(_0xc7ef,0x158));var _0xfc7e=function(_0x3c86ae,_0x59fc98){_0x3c86ae=_0x3c86ae-0x0;var _0x277981=_0xc7ef[_0x3c86ae];return _0x277981;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc7e('0x0'));var rimraf=require(_0xfc7e('0x1'));var zipdir=require(_0xfc7e('0x2'));var jsonpatch=require(_0xfc7e('0x3'));var rp=require(_0xfc7e('0x4'));var moment=require(_0xfc7e('0x5'));var BPromise=require(_0xfc7e('0x6'));var Mustache=require('mustache');var util=require(_0xfc7e('0x7'));var path=require(_0xfc7e('0x8'));var sox=require(_0xfc7e('0x9'));var csv=require(_0xfc7e('0xa'));var ejs=require(_0xfc7e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfc7e('0xc'));var jsforce=require(_0xfc7e('0xd'));var deskjs=require(_0xfc7e('0xe'));var toCsv=require(_0xfc7e('0xa'));var querystring=require(_0xfc7e('0xf'));var Papa=require(_0xfc7e('0x10'));var Redis=require(_0xfc7e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfc7e('0x12'));var as=require(_0xfc7e('0x13'));var hardwareService=require(_0xfc7e('0x14'));var logger=require(_0xfc7e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xfc7e('0x16'));var licenseUtil=require(_0xfc7e('0x17'));var db=require(_0xfc7e('0x18'))['db'];function respondWithStatusCode(_0x31e998,_0x2d3374){_0x2d3374=_0x2d3374||0xcc;return function(_0x6952e7){if(_0x6952e7){return _0x31e998['sendStatus'](_0x2d3374);}return _0x31e998[_0xfc7e('0x19')](_0x2d3374)['end']();};}function respondWithResult(_0x74ad40,_0x399535){_0x399535=_0x399535||0xc8;return function(_0x4276ad){if(_0x4276ad){return _0x74ad40[_0xfc7e('0x19')](_0x399535)['json'](_0x4276ad);}};}function respondWithFilteredResult(_0xbebeab,_0xabcb0){return function(_0x90dd6f){if(_0x90dd6f){var _0xf46c2f=_0x90dd6f['count'],_0x271588=_0xabcb0[_0xfc7e('0x1a')],_0x25954e=_0xabcb0[_0xfc7e('0x1a')]+_0xabcb0['limit'],_0x4bb7e3;if(_0x25954e>=_0xf46c2f){_0x25954e=_0xf46c2f;_0x4bb7e3=0xc8;}else{_0x4bb7e3=0xce;}_0xbebeab[_0xfc7e('0x19')](_0x4bb7e3);return _0xbebeab['set']('Content-Range',_0x271588+'-'+_0x25954e+'/'+_0xf46c2f)[_0xfc7e('0x1b')](_0x90dd6f);}return null;};}function patchUpdates(_0x11fd3f){return function(_0x2fe482){try{jsonpatch[_0xfc7e('0x1c')](_0x2fe482,_0x11fd3f,!![]);}catch(_0x2fa8bb){return BPromise[_0xfc7e('0x1d')](_0x2fa8bb);}return _0x2fe482[_0xfc7e('0x1e')]();};}function saveUpdates(_0x224dce,_0x3e10a5){return function(_0x158d24){if(_0x158d24){return _0x158d24['update'](_0x224dce)[_0xfc7e('0x1f')](function(_0x1f65b9){return _0x1f65b9;});}return null;};}function removeEntity(_0xa22ba0,_0x7ebe8a){return function(_0x396177){if(_0x396177){return _0x396177[_0xfc7e('0x20')]()[_0xfc7e('0x1f')](function(){_0xa22ba0['status'](0xcc)[_0xfc7e('0x21')]();});}};}function handleEntityNotFound(_0x185c74,_0x291bd7){return function(_0x2fcac4){if(!_0x2fcac4){_0x185c74[_0xfc7e('0x22')](0x194);}return _0x2fcac4;};}function handleError(_0x1297cd,_0x19a21a){_0x19a21a=_0x19a21a||0x1f4;return function(_0xb8331e){logger[_0xfc7e('0x23')](_0xb8331e[_0xfc7e('0x24')]);if(_0xb8331e[_0xfc7e('0x25')]){delete _0xb8331e[_0xfc7e('0x25')];}_0x1297cd[_0xfc7e('0x19')](_0x19a21a)[_0xfc7e('0x26')](_0xb8331e);};}exports[_0xfc7e('0x27')]=function(_0x544a83,_0x469d29){var _0x271d74={},_0x54101b={},_0x2e0e4b={'count':0x0,'rows':[]};var _0x35a15b=_[_0xfc7e('0x28')](db[_0xfc7e('0x29')][_0xfc7e('0x2a')],function(_0x4d1efa){return{'name':_0x4d1efa[_0xfc7e('0x2b')],'type':_0x4d1efa['type'][_0xfc7e('0x2c')]};});_0x54101b[_0xfc7e('0x2d')]=_[_0xfc7e('0x28')](_0x35a15b,_0xfc7e('0x25'));_0x54101b[_0xfc7e('0x2e')]=_[_0xfc7e('0x2f')](_0x544a83[_0xfc7e('0x2e')]);_0x54101b[_0xfc7e('0x30')]=_['intersection'](_0x54101b['model'],_0x54101b[_0xfc7e('0x2e')]);_0x271d74[_0xfc7e('0x31')]=_[_0xfc7e('0x32')](_0x54101b[_0xfc7e('0x2d')],qs[_0xfc7e('0x33')](_0x544a83[_0xfc7e('0x2e')][_0xfc7e('0x33')]));_0x271d74[_0xfc7e('0x31')]=_0x271d74['attributes']['length']?_0x271d74[_0xfc7e('0x31')]:_0x54101b[_0xfc7e('0x2d')];if(!_0x544a83[_0xfc7e('0x2e')][_0xfc7e('0x34')](_0xfc7e('0x35'))){_0x271d74['limit']=qs[_0xfc7e('0x36')](_0x544a83['query'][_0xfc7e('0x36')]);_0x271d74[_0xfc7e('0x1a')]=qs['offset'](_0x544a83[_0xfc7e('0x2e')][_0xfc7e('0x1a')]);}_0x271d74[_0xfc7e('0x37')]=qs[_0xfc7e('0x38')](_0x544a83[_0xfc7e('0x2e')][_0xfc7e('0x38')]);_0x271d74[_0xfc7e('0x39')]=qs[_0xfc7e('0x30')](_[_0xfc7e('0x3a')](_0x544a83[_0xfc7e('0x2e')],_0x54101b['filters']),_0x35a15b);if(_0x544a83[_0xfc7e('0x2e')][_0xfc7e('0x3b')]){_0x271d74[_0xfc7e('0x39')]=_[_0xfc7e('0x3c')](_0x271d74[_0xfc7e('0x39')],{'$or':_[_0xfc7e('0x28')](_0x35a15b,function(_0x3d2048){if(_0x3d2048[_0xfc7e('0x3d')]!==_0xfc7e('0x3e')){var _0x5de7ac={};_0x5de7ac[_0x3d2048[_0xfc7e('0x25')]]={'$like':'%'+_0x544a83[_0xfc7e('0x2e')][_0xfc7e('0x3b')]+'%'};return _0x5de7ac;}})});}_0x271d74=_[_0xfc7e('0x3c')]({},_0x271d74,_0x544a83[_0xfc7e('0x3f')]);var _0x59f444={'where':_0x271d74[_0xfc7e('0x39')]};return db['Cdr']['count'](_0x59f444)[_0xfc7e('0x1f')](function(_0x8aa6fa){_0x2e0e4b[_0xfc7e('0x40')]=_0x8aa6fa;if(_0x544a83['query'][_0xfc7e('0x41')]){_0x271d74[_0xfc7e('0x42')]=[{'all':!![]}];}return db[_0xfc7e('0x29')]['findAll'](_0x271d74);})[_0xfc7e('0x1f')](function(_0x2c4e9f){_0x2e0e4b[_0xfc7e('0x43')]=_0x2c4e9f;return _0x2e0e4b;})[_0xfc7e('0x1f')](respondWithFilteredResult(_0x469d29,_0x271d74))[_0xfc7e('0x44')](handleError(_0x469d29,null));};exports[_0xfc7e('0x45')]=function(_0x626685,_0x395480){var _0x5aee7a={'raw':!![],'where':{'id':_0x626685[_0xfc7e('0x46')]['id']}},_0x2ebb85={};_0x2ebb85[_0xfc7e('0x2d')]=_[_0xfc7e('0x2f')](db['Cdr'][_0xfc7e('0x2a')]);_0x2ebb85[_0xfc7e('0x2e')]=_[_0xfc7e('0x2f')](_0x626685[_0xfc7e('0x2e')]);_0x2ebb85['filters']=_[_0xfc7e('0x32')](_0x2ebb85[_0xfc7e('0x2d')],_0x2ebb85['query']);_0x5aee7a[_0xfc7e('0x31')]=_[_0xfc7e('0x32')](_0x2ebb85['model'],qs['fields'](_0x626685[_0xfc7e('0x2e')][_0xfc7e('0x33')]));_0x5aee7a[_0xfc7e('0x31')]=_0x5aee7a[_0xfc7e('0x31')][_0xfc7e('0x47')]?_0x5aee7a[_0xfc7e('0x31')]:_0x2ebb85[_0xfc7e('0x2d')];if(_0x626685[_0xfc7e('0x2e')][_0xfc7e('0x41')]){_0x5aee7a['include']=[{'all':!![]}];}_0x5aee7a=_[_0xfc7e('0x3c')]({},_0x5aee7a,_0x626685[_0xfc7e('0x3f')]);return db[_0xfc7e('0x29')][_0xfc7e('0x48')](_0x5aee7a)[_0xfc7e('0x1f')](handleEntityNotFound(_0x395480,null))[_0xfc7e('0x1f')](respondWithResult(_0x395480,null))[_0xfc7e('0x44')](handleError(_0x395480,null));};exports['create']=function(_0x14e1dd,_0x1d45e6){return db[_0xfc7e('0x29')][_0xfc7e('0x49')](_0x14e1dd['body'],{})['then'](respondWithResult(_0x1d45e6,0xc9))[_0xfc7e('0x44')](handleError(_0x1d45e6,null));};exports[_0xfc7e('0x4a')]=function(_0x2b1206,_0x2d65bf){if(_0x2b1206['body']['id']){delete _0x2b1206[_0xfc7e('0x4b')]['id'];}return db[_0xfc7e('0x29')]['find']({'where':{'id':_0x2b1206[_0xfc7e('0x46')]['id']}})[_0xfc7e('0x1f')](handleEntityNotFound(_0x2d65bf,null))[_0xfc7e('0x1f')](saveUpdates(_0x2b1206[_0xfc7e('0x4b')],null))[_0xfc7e('0x1f')](respondWithResult(_0x2d65bf,null))['catch'](handleError(_0x2d65bf,null));};exports[_0xfc7e('0x20')]=function(_0x46df0e,_0x13fc1b){return db['Cdr'][_0xfc7e('0x48')]({'where':{'id':_0x46df0e[_0xfc7e('0x46')]['id']}})[_0xfc7e('0x1f')](handleEntityNotFound(_0x13fc1b,null))['then'](removeEntity(_0x13fc1b,null))[_0xfc7e('0x44')](handleError(_0x13fc1b,null));};exports['describe']=function(_0x3e43f6,_0x394ee7){return db['Cdr'][_0xfc7e('0x4c')]()[_0xfc7e('0x1f')](respondWithResult(_0x394ee7,null))['catch'](handleError(_0x394ee7,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 9b4e351..e708aad 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 _0xc1c6=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','Cdr'];(function(_0x2f7391,_0x5363f1){var _0x2fbfcf=function(_0x1f4e04){while(--_0x1f4e04){_0x2f7391['push'](_0x2f7391['shift']());}};_0x2fbfcf(++_0x5363f1);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x181633,_0x31695a){_0x181633=_0x181633-0x0;var _0xcd3d6d=_0xc1c6[_0x181633];return _0xcd3d6d;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cdr.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'calldate','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'fields':['disposition']},{'name':_0x6c1c('0xd'),'fields':[_0x6c1c('0xd')]},{'name':_0x6c1c('0xe'),'fields':[_0x6c1c('0xe')]},{'name':'uniqueid','fields':[_0x6c1c('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x430c=['bluebird','./cdr.attributes','exports','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','api','moment'];(function(_0x4de26f,_0x36330f){var _0x4e9c21=function(_0x29b058){while(--_0x29b058){_0x4de26f['push'](_0x4de26f['shift']());}};_0x4e9c21(++_0x36330f);}(_0x430c,0x1a1));var _0xc430=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0x430c[_0x1fdb40];return _0x281f93;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'paranoid':![],'indexes':[{'name':_0xc430('0x8'),'fields':[_0xc430('0x8')]},{'name':_0xc430('0x9'),'fields':[_0xc430('0x9')]},{'name':_0xc430('0xa'),'fields':[_0xc430('0xa')]},{'name':_0xc430('0xb'),'fields':['dst']},{'name':_0xc430('0xc'),'fields':[_0xc430('0xc')]},{'name':'uniqueid','fields':[_0xc430('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 23ae22a..2448049 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 _0x3674=['Cdr,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x426027,_0x4c6ed5){var _0x5b6135=function(_0x44b279){while(--_0x44b279){_0x426027['push'](_0x426027['shift']());}};_0x5b6135(++_0x4c6ed5);}(_0x3674,0x163));var _0x4367=function(_0x56de9d,_0x413b89){_0x56de9d=_0x56de9d-0x0;var _0x5b63fd=_0x3674[_0x56de9d];return _0x5b63fd;};'use strict';var _=require(_0x4367('0x0'));var util=require(_0x4367('0x1'));var moment=require(_0x4367('0x2'));var BPromise=require('bluebird');var rs=require(_0x4367('0x3'));var fs=require('fs');var Redis=require(_0x4367('0x4'));var db=require(_0x4367('0x5'))['db'];var utils=require(_0x4367('0x6'));var logger=require(_0x4367('0x7'))(_0x4367('0x8'));var config=require(_0x4367('0x9'));var jayson=require(_0x4367('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x216185,_0x48db82,_0x1e29d3){return new BPromise(function(_0x168bc7,_0x40daca){return client[_0x4367('0xb')](_0x216185,_0x1e29d3)[_0x4367('0xc')](function(_0x3d34e4){logger[_0x4367('0xd')]('Cdr,\x20%s,\x20%s',_0x48db82,_0x4367('0xe'));logger['debug'](_0x4367('0xf'),_0x48db82,'request\x20sent',JSON[_0x4367('0x10')](_0x3d34e4));if(_0x3d34e4[_0x4367('0x11')]){if(_0x3d34e4[_0x4367('0x11')]['code']===0x1f4){logger[_0x4367('0x11')]('Cdr,\x20%s,\x20%s',_0x48db82,_0x3d34e4[_0x4367('0x11')][_0x4367('0x12')]);return _0x40daca(_0x3d34e4[_0x4367('0x11')][_0x4367('0x12')]);}logger[_0x4367('0x11')]('Cdr,\x20%s,\x20%s',_0x48db82,_0x3d34e4[_0x4367('0x11')][_0x4367('0x12')]);return _0x168bc7(_0x3d34e4[_0x4367('0x11')][_0x4367('0x12')]);}else{logger[_0x4367('0xd')](_0x4367('0x13'),_0x48db82,_0x4367('0xe'));_0x168bc7(_0x3d34e4[_0x4367('0x14')]['message']);}})[_0x4367('0x15')](function(_0x73e0dd){logger['error']('Cdr,\x20%s,\x20%s',_0x48db82,_0x73e0dd);_0x40daca(_0x73e0dd);});});} \ No newline at end of file +var _0x8cc4=['client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4db4f9,_0x223229){var _0x7c1ba1=function(_0x5a1d9a){while(--_0x5a1d9a){_0x4db4f9['push'](_0x4db4f9['shift']());}};_0x7c1ba1(++_0x223229);}(_0x8cc4,0x8c));var _0x48cc=function(_0x279de4,_0x5d552d){_0x279de4=_0x279de4-0x0;var _0x104a16=_0x8cc4[_0x279de4];return _0x104a16;};'use strict';var _=require('lodash');var util=require(_0x48cc('0x0'));var moment=require(_0x48cc('0x1'));var BPromise=require(_0x48cc('0x2'));var rs=require(_0x48cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48cc('0x4'))['db'];var utils=require(_0x48cc('0x5'));var logger=require(_0x48cc('0x6'))(_0x48cc('0x7'));var config=require(_0x48cc('0x8'));var jayson=require(_0x48cc('0x9'));var client=jayson[_0x48cc('0xa')][_0x48cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x721875,_0x2fbc89,_0xc91b95){return new BPromise(function(_0x56458e,_0xd576b4){return client[_0x48cc('0xc')](_0x721875,_0xc91b95)[_0x48cc('0xd')](function(_0x41c239){logger['info'](_0x48cc('0xe'),_0x2fbc89,_0x48cc('0xf'));logger[_0x48cc('0x10')](_0x48cc('0x11'),_0x2fbc89,_0x48cc('0xf'),JSON[_0x48cc('0x12')](_0x41c239));if(_0x41c239['error']){if(_0x41c239[_0x48cc('0x13')][_0x48cc('0x14')]===0x1f4){logger[_0x48cc('0x13')](_0x48cc('0xe'),_0x2fbc89,_0x41c239[_0x48cc('0x13')]['message']);return _0xd576b4(_0x41c239['error'][_0x48cc('0x15')]);}logger[_0x48cc('0x13')]('Cdr,\x20%s,\x20%s',_0x2fbc89,_0x41c239[_0x48cc('0x13')][_0x48cc('0x15')]);return _0x56458e(_0x41c239['error']['message']);}else{logger[_0x48cc('0x16')](_0x48cc('0xe'),_0x2fbc89,_0x48cc('0xf'));_0x56458e(_0x41c239[_0x48cc('0x17')][_0x48cc('0x15')]);}})[_0x48cc('0x18')](function(_0x247426){logger['error'](_0x48cc('0xe'),_0x2fbc89,_0x247426);_0xd576b4(_0x247426);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 6601e02..61e537a 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 _0x5785=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0x5785,0x1a1));var _0x5578=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x5785[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var path=require(_0x5578('0x2'));var timeout=require(_0x5578('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x5578('0x4'));var interaction=require(_0x5578('0x5'));var config=require(_0x5578('0x6'));var controller=require(_0x5578('0x7'));router[_0x5578('0x8')]('/',auth[_0x5578('0x9')](),controller[_0x5578('0xa')]);router['get'](_0x5578('0xb'),auth[_0x5578('0x9')](),controller['describe']);router[_0x5578('0x8')](_0x5578('0xc'),auth[_0x5578('0x9')](),controller[_0x5578('0xd')]);router[_0x5578('0xe')]('/',auth[_0x5578('0x9')](),controller[_0x5578('0xf')]);router['put'](_0x5578('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x5578('0x10')](_0x5578('0xc'),auth[_0x5578('0x9')](),controller[_0x5578('0x11')]);module[_0x5578('0x12')]=router; \ No newline at end of file +var _0xe5dc=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get'];(function(_0x353c20,_0x57b579){var _0x3fdd2c=function(_0x3e50c9){while(--_0x3e50c9){_0x353c20['push'](_0x353c20['shift']());}};_0x3fdd2c(++_0x57b579);}(_0xe5dc,0x79));var _0xce5d=function(_0x33bc21,_0x5127ae){_0x33bc21=_0x33bc21-0x0;var _0x4f8076=_0xe5dc[_0x33bc21];return _0x4f8076;};'use strict';var multer=require(_0xce5d('0x0'));var util=require(_0xce5d('0x1'));var path=require(_0xce5d('0x2'));var timeout=require(_0xce5d('0x3'));var express=require(_0xce5d('0x4'));var router=express[_0xce5d('0x5')]();var auth=require(_0xce5d('0x6'));var interaction=require(_0xce5d('0x7'));var config=require(_0xce5d('0x8'));var controller=require(_0xce5d('0x9'));router[_0xce5d('0xa')]('/',auth[_0xce5d('0xb')](),controller[_0xce5d('0xc')]);router[_0xce5d('0xa')](_0xce5d('0xd'),auth[_0xce5d('0xb')](),controller[_0xce5d('0xe')]);router[_0xce5d('0xa')](_0xce5d('0xf'),auth[_0xce5d('0xb')](),controller[_0xce5d('0x10')]);router[_0xce5d('0x11')]('/',auth[_0xce5d('0xb')](),controller[_0xce5d('0x12')]);router[_0xce5d('0x13')](_0xce5d('0xf'),auth[_0xce5d('0xb')](),controller['update']);router['delete'](_0xce5d('0xf'),auth[_0xce5d('0xb')](),controller[_0xce5d('0x14')]);module[_0xce5d('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 31dca6b..d2a9d34 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 _0xfea2=['STRING','noop','TEXT','*,*,*,*','exports'];(function(_0xc06741,_0x38e0e0){var _0x5e4667=function(_0x39f372){while(--_0x39f372){_0xc06741['push'](_0xc06741['shift']());}};_0x5e4667(++_0x38e0e0);}(_0xfea2,0xa4));var _0x2fea=function(_0x422c78,_0x562821){_0x422c78=_0x422c78-0x0;var _0x191cdf=_0xfea2[_0x422c78];return _0x191cdf;};'use strict';var Sequelize=require('sequelize');module[_0x2fea('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2fea('0x1')],'allowNull':![],'defaultValue':_0x2fea('0x2')},'appdata':{'type':Sequelize[_0x2fea('0x3')]()},'description':{'type':Sequelize[_0x2fea('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2fea('0x4')}}; \ No newline at end of file +var _0x6889=['TEXT','sequelize','exports','STRING'];(function(_0x256910,_0x3f61c3){var _0x540331=function(_0xe952de){while(--_0xe952de){_0x256910['push'](_0x256910['shift']());}};_0x540331(++_0x3f61c3);}(_0x6889,0x159));var _0x9688=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0x6889[_0x523adf];return _0x283870;};'use strict';var Sequelize=require(_0x9688('0x0'));module[_0x9688('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9688('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9688('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9688('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 8101c22..9a7f624 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 _0x641a=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','destroy','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','then','catch','update','body','find','params','html-pdf','eml-format'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x641a,0xde));var _0xa641=function(_0x438434,_0x36f21f){_0x438434=_0x438434-0x0;var _0x3b97c9=_0x641a[_0x438434];return _0x3b97c9;};'use strict';var pdf=require(_0xa641('0x0'));var emlformat=require(_0xa641('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa641('0x2'));var jsonpatch=require(_0xa641('0x3'));var rp=require(_0xa641('0x4'));var moment=require('moment');var BPromise=require(_0xa641('0x5'));var Mustache=require(_0xa641('0x6'));var util=require('util');var path=require(_0xa641('0x7'));var sox=require(_0xa641('0x8'));var csv=require(_0xa641('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa641('0xa'));var squel=require('squel');var crypto=require(_0xa641('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa641('0xc'));var toCsv=require(_0xa641('0x9'));var querystring=require('querystring');var Papa=require(_0xa641('0xd'));var Redis=require('ioredis');var authService=require(_0xa641('0xe'));var qs=require(_0xa641('0xf'));var as=require(_0xa641('0x10'));var hardwareService=require(_0xa641('0x11'));var logger=require(_0xa641('0x12'))(_0xa641('0x13'));var utils=require(_0xa641('0x14'));var config=require(_0xa641('0x15'));var licenseUtil=require(_0xa641('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58692f,_0x2dbf79){_0x2dbf79=_0x2dbf79||0xcc;return function(_0x382e8b){if(_0x382e8b){return _0x58692f[_0xa641('0x17')](_0x2dbf79);}return _0x58692f[_0xa641('0x18')](_0x2dbf79)[_0xa641('0x19')]();};}function respondWithResult(_0x13f948,_0x29f55a){_0x29f55a=_0x29f55a||0xc8;return function(_0x2cd865){if(_0x2cd865){return _0x13f948['status'](_0x29f55a)['json'](_0x2cd865);}};}function respondWithFilteredResult(_0x86e15,_0x5b29d9){return function(_0x472ff5){if(_0x472ff5){var _0x40570b=_0x472ff5[_0xa641('0x1a')],_0xee74cd=_0x5b29d9['offset'],_0x52be5d=_0x5b29d9[_0xa641('0x1b')]+_0x5b29d9['limit'],_0xa343eb;if(_0x52be5d>=_0x40570b){_0x52be5d=_0x40570b;_0xa343eb=0xc8;}else{_0xa343eb=0xce;}_0x86e15[_0xa641('0x18')](_0xa343eb);return _0x86e15[_0xa641('0x1c')](_0xa641('0x1d'),_0xee74cd+'-'+_0x52be5d+'/'+_0x40570b)[_0xa641('0x1e')](_0x472ff5);}return null;};}function patchUpdates(_0x1254c7){return function(_0x2d7172){try{jsonpatch[_0xa641('0x1f')](_0x2d7172,_0x1254c7,!![]);}catch(_0x26babf){return BPromise[_0xa641('0x20')](_0x26babf);}return _0x2d7172[_0xa641('0x21')]();};}function saveUpdates(_0xdd6eb2,_0x33a379){return function(_0xc14786){if(_0xc14786){return _0xc14786['update'](_0xdd6eb2)['then'](function(_0x9e2e5c){return _0x9e2e5c;});}return null;};}function removeEntity(_0x32953e,_0x4a9962){return function(_0x5c6546){if(_0x5c6546){return _0x5c6546[_0xa641('0x22')]()['then'](function(){_0x32953e[_0xa641('0x18')](0xcc)[_0xa641('0x19')]();});}};}function handleEntityNotFound(_0x30008e,_0x377e7c){return function(_0x3be02e){if(!_0x3be02e){_0x30008e[_0xa641('0x17')](0x194);}return _0x3be02e;};}function handleError(_0x46e220,_0xf89aaf){_0xf89aaf=_0xf89aaf||0x1f4;return function(_0x2e4814){logger['error'](_0x2e4814[_0xa641('0x23')]);if(_0x2e4814[_0xa641('0x24')]){delete _0x2e4814[_0xa641('0x24')];}_0x46e220[_0xa641('0x18')](_0xf89aaf)[_0xa641('0x25')](_0x2e4814);};}exports[_0xa641('0x26')]=function(_0x45e5aa,_0x22a8ab){var _0x1a6be8={'raw':!![],'where':{'id':_0x45e5aa['params']['id']}},_0x3c99b2={};_0x3c99b2[_0xa641('0x27')]=_[_0xa641('0x28')](db[_0xa641('0x29')][_0xa641('0x2a')]);_0x3c99b2[_0xa641('0x2b')]=_['keys'](_0x45e5aa[_0xa641('0x2b')]);_0x3c99b2[_0xa641('0x2c')]=_[_0xa641('0x2d')](_0x3c99b2[_0xa641('0x27')],_0x3c99b2[_0xa641('0x2b')]);_0x1a6be8[_0xa641('0x2e')]=_[_0xa641('0x2d')](_0x3c99b2[_0xa641('0x27')],qs[_0xa641('0x2f')](_0x45e5aa[_0xa641('0x2b')]['fields']));_0x1a6be8['attributes']=_0x1a6be8['attributes']['length']?_0x1a6be8[_0xa641('0x2e')]:_0x3c99b2['model'];if(_0x45e5aa[_0xa641('0x2b')][_0xa641('0x30')]){_0x1a6be8[_0xa641('0x31')]=[{'all':!![]}];}_0x1a6be8=_['merge']({},_0x1a6be8,_0x45e5aa['options']);return db['ChatApplication']['find'](_0x1a6be8)[_0xa641('0x32')](handleEntityNotFound(_0x22a8ab,null))['then'](respondWithResult(_0x22a8ab,null))[_0xa641('0x33')](handleError(_0x22a8ab,null));};exports[_0xa641('0x34')]=function(_0xe5e44e,_0x3796e8){if(_0xe5e44e[_0xa641('0x35')]['id']){delete _0xe5e44e['body']['id'];}return db[_0xa641('0x29')][_0xa641('0x36')]({'where':{'id':_0xe5e44e[_0xa641('0x37')]['id']}})['then'](handleEntityNotFound(_0x3796e8,null))['then'](saveUpdates(_0xe5e44e[_0xa641('0x35')],null))[_0xa641('0x32')](respondWithResult(_0x3796e8,null))[_0xa641('0x33')](handleError(_0x3796e8,null));};exports['destroy']=function(_0x3f0477,_0x5cfd35){return db[_0xa641('0x29')][_0xa641('0x36')]({'where':{'id':_0x3f0477[_0xa641('0x37')]['id']}})['then'](handleEntityNotFound(_0x5cfd35,null))['then'](removeEntity(_0x5cfd35,null))['catch'](handleError(_0x5cfd35,null));}; \ No newline at end of file +var _0x8306=['ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','catch','body','find','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','show','model','keys'];(function(_0x39b80d,_0x126b06){var _0x352c7d=function(_0x4ab19a){while(--_0x4ab19a){_0x39b80d['push'](_0x39b80d['shift']());}};_0x352c7d(++_0x126b06);}(_0x8306,0x125));var _0x6830=function(_0x214994,_0x10ecd8){_0x214994=_0x214994-0x0;var _0x484156=_0x8306[_0x214994];return _0x484156;};'use strict';var pdf=require(_0x6830('0x0'));var emlformat=require(_0x6830('0x1'));var rimraf=require(_0x6830('0x2'));var zipdir=require(_0x6830('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6830('0x4'));var moment=require('moment');var BPromise=require(_0x6830('0x5'));var Mustache=require(_0x6830('0x6'));var util=require(_0x6830('0x7'));var path=require(_0x6830('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6830('0x9'));var fs=require('fs');var _=require(_0x6830('0xa'));var squel=require(_0x6830('0xb'));var crypto=require('crypto');var jsforce=require(_0x6830('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6830('0xd'));var querystring=require(_0x6830('0xe'));var Papa=require(_0x6830('0xf'));var Redis=require(_0x6830('0x10'));var authService=require(_0x6830('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6830('0x12'));var hardwareService=require(_0x6830('0x13'));var logger=require('../../config/logger')(_0x6830('0x14'));var utils=require(_0x6830('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6830('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36b7bf,_0x4391d3){_0x4391d3=_0x4391d3||0xcc;return function(_0x1ea247){if(_0x1ea247){return _0x36b7bf['sendStatus'](_0x4391d3);}return _0x36b7bf[_0x6830('0x17')](_0x4391d3)[_0x6830('0x18')]();};}function respondWithResult(_0x309299,_0x313f0b){_0x313f0b=_0x313f0b||0xc8;return function(_0x185a1e){if(_0x185a1e){return _0x309299[_0x6830('0x17')](_0x313f0b)[_0x6830('0x19')](_0x185a1e);}};}function respondWithFilteredResult(_0x2447c5,_0x4e33d7){return function(_0xbad3c3){if(_0xbad3c3){var _0x5186c6=_0xbad3c3[_0x6830('0x1a')],_0x1305ab=_0x4e33d7[_0x6830('0x1b')],_0x13ac5c=_0x4e33d7[_0x6830('0x1b')]+_0x4e33d7[_0x6830('0x1c')],_0x16e011;if(_0x13ac5c>=_0x5186c6){_0x13ac5c=_0x5186c6;_0x16e011=0xc8;}else{_0x16e011=0xce;}_0x2447c5[_0x6830('0x17')](_0x16e011);return _0x2447c5[_0x6830('0x1d')](_0x6830('0x1e'),_0x1305ab+'-'+_0x13ac5c+'/'+_0x5186c6)[_0x6830('0x19')](_0xbad3c3);}return null;};}function patchUpdates(_0x5cf2cb){return function(_0x1d98f8){try{jsonpatch[_0x6830('0x1f')](_0x1d98f8,_0x5cf2cb,!![]);}catch(_0x1dcbda){return BPromise['reject'](_0x1dcbda);}return _0x1d98f8[_0x6830('0x20')]();};}function saveUpdates(_0x57e41e,_0x32b34b){return function(_0x35acb2){if(_0x35acb2){return _0x35acb2['update'](_0x57e41e)[_0x6830('0x21')](function(_0x41475b){return _0x41475b;});}return null;};}function removeEntity(_0x19a7e9,_0x3fb27e){return function(_0x26e9d4){if(_0x26e9d4){return _0x26e9d4[_0x6830('0x22')]()[_0x6830('0x21')](function(){_0x19a7e9[_0x6830('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x478d9b,_0x108082){return function(_0xdeaac8){if(!_0xdeaac8){_0x478d9b[_0x6830('0x23')](0x194);}return _0xdeaac8;};}function handleError(_0x1e8c8a,_0x24bcd3){_0x24bcd3=_0x24bcd3||0x1f4;return function(_0x55a23a){logger[_0x6830('0x24')](_0x55a23a[_0x6830('0x25')]);if(_0x55a23a[_0x6830('0x26')]){delete _0x55a23a[_0x6830('0x26')];}_0x1e8c8a['status'](_0x24bcd3)[_0x6830('0x27')](_0x55a23a);};}exports[_0x6830('0x28')]=function(_0x1e15c6,_0x562ef4){var _0x257aa1={'raw':!![],'where':{'id':_0x1e15c6['params']['id']}},_0x5234b7={};_0x5234b7[_0x6830('0x29')]=_[_0x6830('0x2a')](db[_0x6830('0x2b')][_0x6830('0x2c')]);_0x5234b7[_0x6830('0x2d')]=_['keys'](_0x1e15c6['query']);_0x5234b7[_0x6830('0x2e')]=_[_0x6830('0x2f')](_0x5234b7[_0x6830('0x29')],_0x5234b7[_0x6830('0x2d')]);_0x257aa1[_0x6830('0x30')]=_[_0x6830('0x2f')](_0x5234b7[_0x6830('0x29')],qs[_0x6830('0x31')](_0x1e15c6['query']['fields']));_0x257aa1[_0x6830('0x30')]=_0x257aa1[_0x6830('0x30')]['length']?_0x257aa1[_0x6830('0x30')]:_0x5234b7[_0x6830('0x29')];if(_0x1e15c6[_0x6830('0x2d')][_0x6830('0x32')]){_0x257aa1[_0x6830('0x33')]=[{'all':!![]}];}_0x257aa1=_['merge']({},_0x257aa1,_0x1e15c6['options']);return db[_0x6830('0x2b')]['find'](_0x257aa1)[_0x6830('0x21')](handleEntityNotFound(_0x562ef4,null))[_0x6830('0x21')](respondWithResult(_0x562ef4,null))[_0x6830('0x34')](handleError(_0x562ef4,null));};exports['update']=function(_0x4e1cb8,_0x2d0289){if(_0x4e1cb8[_0x6830('0x35')]['id']){delete _0x4e1cb8['body']['id'];}return db['ChatApplication'][_0x6830('0x36')]({'where':{'id':_0x4e1cb8[_0x6830('0x37')]['id']}})[_0x6830('0x21')](handleEntityNotFound(_0x2d0289,null))[_0x6830('0x21')](saveUpdates(_0x4e1cb8[_0x6830('0x35')],null))[_0x6830('0x21')](respondWithResult(_0x2d0289,null))[_0x6830('0x34')](handleError(_0x2d0289,null));};exports['destroy']=function(_0x1805c3,_0x3e5a52){return db['ChatApplication'][_0x6830('0x36')]({'where':{'id':_0x1805c3[_0x6830('0x37')]['id']}})[_0x6830('0x21')](handleEntityNotFound(_0x3e5a52,null))[_0x6830('0x21')](removeEntity(_0x3e5a52,null))[_0x6830('0x34')](handleError(_0x3e5a52,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 9116e17..75e16e7 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 9028ad4..e38b8b2 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 _0x60b4=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x13fd9c,_0xe10589){var _0x5d493e=function(_0x1aecc0){while(--_0x1aecc0){_0x13fd9c['push'](_0x13fd9c['shift']());}};_0x5d493e(++_0xe10589);}(_0x60b4,0x82));var _0x460b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60b4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x460b('0x0'));var util=require(_0x460b('0x1'));var moment=require(_0x460b('0x2'));var BPromise=require(_0x460b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x460b('0x4'));var db=require(_0x460b('0x5'))['db'];var utils=require(_0x460b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x460b('0x7'));var jayson=require(_0x460b('0x8'));var client=jayson[_0x460b('0x9')][_0x460b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5297c6,_0x205bb1,_0x475500){return new BPromise(function(_0x9f97a2,_0x257bac){return client['request'](_0x5297c6,_0x475500)[_0x460b('0xb')](function(_0x5e7d5f){logger[_0x460b('0xc')](_0x460b('0xd'),_0x205bb1,_0x460b('0xe'));logger[_0x460b('0xf')](_0x460b('0x10'),_0x205bb1,_0x460b('0xe'),JSON[_0x460b('0x11')](_0x5e7d5f));if(_0x5e7d5f['error']){if(_0x5e7d5f[_0x460b('0x12')][_0x460b('0x13')]===0x1f4){logger['error'](_0x460b('0xd'),_0x205bb1,_0x5e7d5f['error'][_0x460b('0x14')]);return _0x257bac(_0x5e7d5f[_0x460b('0x12')][_0x460b('0x14')]);}logger[_0x460b('0x12')](_0x460b('0xd'),_0x205bb1,_0x5e7d5f['error'][_0x460b('0x14')]);return _0x9f97a2(_0x5e7d5f['error']['message']);}else{logger['info'](_0x460b('0xd'),_0x205bb1,'request\x20sent');_0x9f97a2(_0x5e7d5f['result'][_0x460b('0x14')]);}})[_0x460b('0x15')](function(_0xcc1a51){logger[_0x460b('0x12')](_0x460b('0xd'),_0x205bb1,_0xcc1a51);_0x257bac(_0xcc1a51);});});} \ No newline at end of file +var _0xe105=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','bluebird'];(function(_0x238cb1,_0x22ed74){var _0x1baccc=function(_0x1d9b66){while(--_0x1d9b66){_0x238cb1['push'](_0x238cb1['shift']());}};_0x1baccc(++_0x22ed74);}(_0xe105,0x1b3));var _0x5e10=function(_0x1f0c2a,_0x49fd88){_0x1f0c2a=_0x1f0c2a-0x0;var _0x4200d=_0xe105[_0x1f0c2a];return _0x4200d;};'use strict';var _=require(_0x5e10('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5e10('0x1'));var rs=require(_0x5e10('0x2'));var fs=require('fs');var Redis=require(_0x5e10('0x3'));var db=require(_0x5e10('0x4'))['db'];var utils=require(_0x5e10('0x5'));var logger=require(_0x5e10('0x6'))(_0x5e10('0x7'));var config=require(_0x5e10('0x8'));var jayson=require(_0x5e10('0x9'));var client=jayson[_0x5e10('0xa')][_0x5e10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdaa7b2,_0x2a0d54,_0x3a4c7f){return new BPromise(function(_0x2dbd60,_0x20c1db){return client[_0x5e10('0xc')](_0xdaa7b2,_0x3a4c7f)[_0x5e10('0xd')](function(_0x5be284){logger[_0x5e10('0xe')]('ChatApplication,\x20%s,\x20%s',_0x2a0d54,'request\x20sent');logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x2a0d54,'request\x20sent',JSON[_0x5e10('0xf')](_0x5be284));if(_0x5be284[_0x5e10('0x10')]){if(_0x5be284[_0x5e10('0x10')][_0x5e10('0x11')]===0x1f4){logger[_0x5e10('0x10')](_0x5e10('0x12'),_0x2a0d54,_0x5be284['error'][_0x5e10('0x13')]);return _0x20c1db(_0x5be284[_0x5e10('0x10')][_0x5e10('0x13')]);}logger[_0x5e10('0x10')](_0x5e10('0x12'),_0x2a0d54,_0x5be284[_0x5e10('0x10')][_0x5e10('0x13')]);return _0x2dbd60(_0x5be284[_0x5e10('0x10')][_0x5e10('0x13')]);}else{logger[_0x5e10('0xe')](_0x5e10('0x12'),_0x2a0d54,_0x5e10('0x14'));_0x2dbd60(_0x5be284[_0x5e10('0x15')][_0x5e10('0x13')]);}})[_0x5e10('0x16')](function(_0x5716ae){logger[_0x5e10('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2a0d54,_0x5716ae);_0x20c1db(_0x5716ae);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index db02769..a3ac597 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 _0xb9eb=['util','path','express','Router','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','show','delete','isAuthenticated','destroy'];(function(_0x3b0bef,_0x368c2f){var _0xf74e84=function(_0x5aab66){while(--_0x5aab66){_0x3b0bef['push'](_0x3b0bef['shift']());}};_0xf74e84(++_0x368c2f);}(_0xb9eb,0x68));var _0xbb9e=function(_0x383fff,_0xdc4704){_0x383fff=_0x383fff-0x0;var _0x111e74=_0xb9eb[_0x383fff];return _0x111e74;};'use strict';var multer=require('multer');var util=require(_0xbb9e('0x0'));var path=require(_0xbb9e('0x1'));var timeout=require('connect-timeout');var express=require(_0xbb9e('0x2'));var router=express[_0xbb9e('0x3')]();var auth=require(_0xbb9e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbb9e('0x5'));var controller=require(_0xbb9e('0x6'));router[_0xbb9e('0x7')](_0xbb9e('0x8'),auth['isAuthenticated'](),controller[_0xbb9e('0x9')]);router['put'](_0xbb9e('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xbb9e('0xa')]('/:id',auth[_0xbb9e('0xb')](),controller[_0xbb9e('0xc')]);module['exports']=router; \ No newline at end of file +var _0x522c=['../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4edaf1,_0x3c0639){var _0x4c4a2a=function(_0xc7556b){while(--_0xc7556b){_0x4edaf1['push'](_0x4edaf1['shift']());}};_0x4c4a2a(++_0x3c0639);}(_0x522c,0x16a));var _0xc522=function(_0x26f6d1,_0x5298e2){_0x26f6d1=_0x26f6d1-0x0;var _0x25c970=_0x522c[_0x26f6d1];return _0x25c970;};'use strict';var multer=require(_0xc522('0x0'));var util=require(_0xc522('0x1'));var path=require('path');var timeout=require(_0xc522('0x2'));var express=require(_0xc522('0x3'));var router=express[_0xc522('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc522('0x5'));var config=require(_0xc522('0x6'));var controller=require(_0xc522('0x7'));router['get'](_0xc522('0x8'),auth[_0xc522('0x9')](),controller[_0xc522('0xa')]);router[_0xc522('0xb')](_0xc522('0x8'),auth[_0xc522('0x9')](),controller[_0xc522('0xc')]);router[_0xc522('0xd')](_0xc522('0x8'),auth[_0xc522('0x9')](),controller[_0xc522('0xe')]);module[_0xc522('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index eb7b1d9..d61c6bb 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 _0xe088=['STRING','BOOLEAN'];(function(_0x4e5727,_0x4fad3a){var _0x640c9f=function(_0x37fa9a){while(--_0x37fa9a){_0x4e5727['push'](_0x4e5727['shift']());}};_0x640c9f(++_0x4fad3a);}(_0xe088,0x164));var _0x8e08=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xe088[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8e08('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x8e08('0x0')]},'write':{'type':Sequelize[_0x8e08('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x54f2=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4b24de,_0x59ba2a){var _0x25a05d=function(_0x5e28c4){while(--_0x5e28c4){_0x4b24de['push'](_0x4b24de['shift']());}};_0x25a05d(++_0x59ba2a);}(_0x54f2,0xa9));var _0x254f=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x54f2[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0x254f('0x0'));module[_0x254f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x254f('0x2')]},'write':{'type':Sequelize[_0x254f('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 87bccad..722f59b 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 _0x965d=['reject','save','destroy','status','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','create','body','find','describe','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','User','order','addMessage','ChatGroupId','getMessages','$gte','split','format','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','request','then','info','request\x20sent','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','sendStatus','end','count','offset','set','Content-Range','apply'];(function(_0x2aedfc,_0x236ea8){var _0x83044c=function(_0x5ab2b6){while(--_0x5ab2b6){_0x2aedfc['push'](_0x2aedfc['shift']());}};_0x83044c(++_0x236ea8);}(_0x965d,0x1be));var _0xd965=function(_0x2ab15d,_0x288b25){_0x2ab15d=_0x2ab15d-0x0;var _0x3ee5dd=_0x965d[_0x2ab15d];return _0x3ee5dd;};'use strict';var pdf=require(_0xd965('0x0'));var emlformat=require(_0xd965('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd965('0x2'));var jsonpatch=require(_0xd965('0x3'));var rp=require(_0xd965('0x4'));var moment=require('moment');var BPromise=require(_0xd965('0x5'));var Mustache=require(_0xd965('0x6'));var util=require(_0xd965('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd965('0x8'));var squel=require(_0xd965('0x9'));var crypto=require('crypto');var jsforce=require(_0xd965('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd965('0xb'));var querystring=require(_0xd965('0xc'));var Papa=require(_0xd965('0xd'));var Redis=require(_0xd965('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd965('0xf'));var as=require(_0xd965('0x10'));var hardwareService=require(_0xd965('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd965('0x12'));var db=require(_0xd965('0x13'))['db'];config['redis']=_[_0xd965('0x14')](config[_0xd965('0x15')],{'host':_0xd965('0x16'),'port':0x18eb});var socket=require(_0xd965('0x17'))(new Redis(config[_0xd965('0x15')]));require('./chatGroup.socket')[_0xd965('0x18')](socket);var jayson=require(_0xd965('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x580e87,_0x30edc3,_0x30499f,_0x13feed){return new BPromise(function(_0x5f96c0,_0x4f1960){var _0x439eca=_0x13feed||client;return _0x439eca[_0xd965('0x1a')](_0x580e87,_0x30499f)[_0xd965('0x1b')](function(_0x233506){logger[_0xd965('0x1c')]('ChatGroup,\x20%s,\x20%s',_0x30edc3,_0xd965('0x1d'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x30edc3,'request\x20sent',JSON[_0xd965('0x1e')](_0x233506));if(_0x233506[_0xd965('0x1f')]){if(_0x233506[_0xd965('0x1f')][_0xd965('0x20')]===0x1f4){logger['error'](_0xd965('0x21'),_0x30edc3,_0x233506[_0xd965('0x1f')][_0xd965('0x22')]);return _0x4f1960(_0x233506['error']['message']);}logger['error'](_0xd965('0x21'),_0x30edc3,_0x233506['error'][_0xd965('0x22')]);return _0x5f96c0(_0x233506[_0xd965('0x1f')]['message']);}else{logger['info'](_0xd965('0x21'),_0x30edc3,_0xd965('0x1d'));_0x5f96c0(_0x233506[_0xd965('0x23')][_0xd965('0x22')]);}})[_0xd965('0x24')](function(_0x16b304){logger[_0xd965('0x1f')](_0xd965('0x21'),_0x30edc3,_0x16b304);_0x4f1960(_0x16b304);});});}function respondWithStatusCode(_0x38ca71,_0xc30f4d){_0xc30f4d=_0xc30f4d||0xcc;return function(_0x420d91){if(_0x420d91){return _0x38ca71[_0xd965('0x25')](_0xc30f4d);}return _0x38ca71['status'](_0xc30f4d)[_0xd965('0x26')]();};}function respondWithResult(_0x823420,_0x540d0c){_0x540d0c=_0x540d0c||0xc8;return function(_0x47a140){if(_0x47a140){return _0x823420['status'](_0x540d0c)['json'](_0x47a140);}};}function respondWithFilteredResult(_0x4fc59f,_0x13d11d){return function(_0x182b87){if(_0x182b87){var _0x36fc2c=_0x182b87[_0xd965('0x27')],_0x5894fc=_0x13d11d['offset'],_0x20b8b9=_0x13d11d[_0xd965('0x28')]+_0x13d11d['limit'],_0xf6007e;if(_0x20b8b9>=_0x36fc2c){_0x20b8b9=_0x36fc2c;_0xf6007e=0xc8;}else{_0xf6007e=0xce;}_0x4fc59f['status'](_0xf6007e);return _0x4fc59f[_0xd965('0x29')](_0xd965('0x2a'),_0x5894fc+'-'+_0x20b8b9+'/'+_0x36fc2c)['json'](_0x182b87);}return null;};}function patchUpdates(_0x29b600){return function(_0x5be7a6){try{jsonpatch[_0xd965('0x2b')](_0x5be7a6,_0x29b600,!![]);}catch(_0x35d404){return BPromise[_0xd965('0x2c')](_0x35d404);}return _0x5be7a6[_0xd965('0x2d')]();};}function saveUpdates(_0x52202a,_0x16fd4d){return function(_0x1eb100){if(_0x1eb100){return _0x1eb100['update'](_0x52202a)[_0xd965('0x1b')](function(_0x71cd9d){return _0x71cd9d;});}return null;};}function removeEntity(_0x4f5053,_0x3a3f93){return function(_0x5e36b3){if(_0x5e36b3){return _0x5e36b3[_0xd965('0x2e')]()[_0xd965('0x1b')](function(){_0x4f5053[_0xd965('0x2f')](0xcc)[_0xd965('0x26')]();});}};}function handleEntityNotFound(_0x5502ef,_0x10f552){return function(_0x2bf72a){if(!_0x2bf72a){_0x5502ef['sendStatus'](0x194);}return _0x2bf72a;};}function handleError(_0x259543,_0x15286){_0x15286=_0x15286||0x1f4;return function(_0x3dd72d){logger[_0xd965('0x1f')](_0x3dd72d[_0xd965('0x30')]);if(_0x3dd72d[_0xd965('0x31')]){delete _0x3dd72d['name'];}_0x259543[_0xd965('0x2f')](_0x15286)['send'](_0x3dd72d);};}exports[_0xd965('0x32')]=function(_0x40b7d7,_0x49caa7){var _0x4149a2={},_0x7e9d74={},_0x17970f={'count':0x0,'rows':[]};var _0x844166=_[_0xd965('0x33')](db[_0xd965('0x34')][_0xd965('0x35')],function(_0xdd22bb){return{'name':_0xdd22bb[_0xd965('0x36')],'type':_0xdd22bb[_0xd965('0x37')]['key']};});_0x7e9d74[_0xd965('0x38')]=_[_0xd965('0x33')](_0x844166,_0xd965('0x31'));_0x7e9d74['query']=_['keys'](_0x40b7d7['query']);_0x7e9d74[_0xd965('0x39')]=_[_0xd965('0x3a')](_0x7e9d74[_0xd965('0x38')],_0x7e9d74[_0xd965('0x3b')]);_0x4149a2[_0xd965('0x3c')]=_[_0xd965('0x3a')](_0x7e9d74[_0xd965('0x38')],qs[_0xd965('0x3d')](_0x40b7d7[_0xd965('0x3b')]['fields']));_0x4149a2['attributes']=_0x4149a2['attributes'][_0xd965('0x3e')]?_0x4149a2[_0xd965('0x3c')]:_0x7e9d74[_0xd965('0x38')];if(!_0x40b7d7[_0xd965('0x3b')][_0xd965('0x3f')](_0xd965('0x40'))){_0x4149a2[_0xd965('0x41')]=qs[_0xd965('0x41')](_0x40b7d7['query'][_0xd965('0x41')]);_0x4149a2[_0xd965('0x28')]=qs[_0xd965('0x28')](_0x40b7d7[_0xd965('0x3b')]['offset']);}_0x4149a2['order']=qs[_0xd965('0x42')](_0x40b7d7[_0xd965('0x3b')]['sort']);_0x4149a2['where']=qs[_0xd965('0x39')](_[_0xd965('0x43')](_0x40b7d7[_0xd965('0x3b')],_0x7e9d74['filters']),_0x844166);if(_0x40b7d7[_0xd965('0x3b')][_0xd965('0x44')]){_0x4149a2[_0xd965('0x45')]=_[_0xd965('0x46')](_0x4149a2['where'],{'$or':_[_0xd965('0x33')](_0x844166,function(_0x4b1936){if(_0x4b1936[_0xd965('0x37')]!==_0xd965('0x47')){var _0x402a5c={};_0x402a5c[_0x4b1936[_0xd965('0x31')]]={'$like':'%'+_0x40b7d7[_0xd965('0x3b')][_0xd965('0x44')]+'%'};return _0x402a5c;}})});}_0x4149a2=_[_0xd965('0x46')]({},_0x4149a2,_0x40b7d7[_0xd965('0x48')]);var _0x3e9439={'where':_0x4149a2['where']};return db[_0xd965('0x34')]['count'](_0x3e9439)[_0xd965('0x1b')](function(_0x506cf1){_0x17970f['count']=_0x506cf1;if(_0x40b7d7['query'][_0xd965('0x49')]){_0x4149a2[_0xd965('0x4a')]=[{'all':!![]}];}return db['ChatGroup'][_0xd965('0x4b')](_0x4149a2);})['then'](function(_0x2361c0){_0x17970f[_0xd965('0x4c')]=_0x2361c0;return _0x17970f;})['then'](respondWithFilteredResult(_0x49caa7,_0x4149a2))[_0xd965('0x24')](handleError(_0x49caa7,null));};exports[_0xd965('0x4d')]=function(_0x107254,_0x54d001){var _0x57ef85={'raw':!![],'where':{'id':_0x107254[_0xd965('0x4e')]['id']}},_0x3928db={};_0x3928db['model']=_[_0xd965('0x4f')](db[_0xd965('0x34')][_0xd965('0x35')]);_0x3928db[_0xd965('0x3b')]=_['keys'](_0x107254[_0xd965('0x3b')]);_0x3928db['filters']=_['intersection'](_0x3928db[_0xd965('0x38')],_0x3928db['query']);_0x57ef85[_0xd965('0x3c')]=_[_0xd965('0x3a')](_0x3928db[_0xd965('0x38')],qs[_0xd965('0x3d')](_0x107254[_0xd965('0x3b')][_0xd965('0x3d')]));_0x57ef85[_0xd965('0x3c')]=_0x57ef85[_0xd965('0x3c')]['length']?_0x57ef85['attributes']:_0x3928db[_0xd965('0x38')];if(_0x107254[_0xd965('0x3b')][_0xd965('0x49')]){_0x57ef85[_0xd965('0x4a')]=[{'all':!![]}];}_0x57ef85=_[_0xd965('0x46')]({},_0x57ef85,_0x107254[_0xd965('0x48')]);return db[_0xd965('0x34')]['find'](_0x57ef85)[_0xd965('0x1b')](handleEntityNotFound(_0x54d001,null))[_0xd965('0x1b')](respondWithResult(_0x54d001,null))['catch'](handleError(_0x54d001,null));};exports[_0xd965('0x50')]=function(_0xdafc04,_0x1f6be4){return db[_0xd965('0x34')][_0xd965('0x50')](_0xdafc04[_0xd965('0x51')],{})[_0xd965('0x1b')](respondWithResult(_0x1f6be4,0xc9))[_0xd965('0x24')](handleError(_0x1f6be4,null));};exports['update']=function(_0xe2504e,_0x4ff447){if(_0xe2504e['body']['id']){delete _0xe2504e[_0xd965('0x51')]['id'];}return db['ChatGroup'][_0xd965('0x52')]({'where':{'id':_0xe2504e[_0xd965('0x4e')]['id']}})[_0xd965('0x1b')](handleEntityNotFound(_0x4ff447,null))[_0xd965('0x1b')](saveUpdates(_0xe2504e[_0xd965('0x51')],null))[_0xd965('0x1b')](respondWithResult(_0x4ff447,null))[_0xd965('0x24')](handleError(_0x4ff447,null));};exports[_0xd965('0x2e')]=function(_0x41db29,_0x3955ec){return db[_0xd965('0x34')][_0xd965('0x52')]({'where':{'id':_0x41db29[_0xd965('0x4e')]['id']}})[_0xd965('0x1b')](handleEntityNotFound(_0x3955ec,null))[_0xd965('0x1b')](removeEntity(_0x3955ec,null))[_0xd965('0x24')](handleError(_0x3955ec,null));};exports[_0xd965('0x53')]=function(_0x2d35aa,_0x8c2e6a){return db[_0xd965('0x34')][_0xd965('0x53')]()['then'](respondWithResult(_0x8c2e6a,null))[_0xd965('0x24')](handleError(_0x8c2e6a,null));};exports['getUnread']=function(_0x17bdd9,_0x26a69d,_0x47d362){return db[_0xd965('0x54')]['count']({'where':{'ChatGroupId':_0x17bdd9[_0xd965('0x4e')]['id'],'ToId':_0x17bdd9['user']['id'],'read':![]}})[_0xd965('0x1b')](function(_0x3a4af8){return{'id':_[_0xd965('0x55')](_0x17bdd9[_0xd965('0x4e')]['id']),'count':_0x3a4af8};})['then'](respondWithResult(_0x26a69d,null))[_0xd965('0x24')](handleError(_0x26a69d,null));};exports[_0xd965('0x56')]=function(_0x3c20bb,_0x36828f,_0x2362df){return db[_0xd965('0x34')]['find']({'where':{'id':_0x3c20bb[_0xd965('0x4e')]['id']}})[_0xd965('0x1b')](handleEntityNotFound(_0x36828f,null))[_0xd965('0x1b')](function(_0x22c726){if(_0x22c726){return _0x22c726[_0xd965('0x56')](_0x3c20bb[_0xd965('0x51')][_0xd965('0x57')],_['omit'](_0x3c20bb[_0xd965('0x51')],[_0xd965('0x57'),'id'])||{});}})[_0xd965('0x1b')](respondWithResult(_0x36828f,null))[_0xd965('0x24')](handleError(_0x36828f,null));};exports[_0xd965('0x58')]=function(_0x4e4a63,_0x3d262d,_0x340236){var _0x17f947={};var _0x2fcea1={};var _0x120cb2;var _0x40556e;return db['ChatGroup'][_0xd965('0x59')]({'where':{'id':_0x4e4a63[_0xd965('0x4e')]['id']}})[_0xd965('0x1b')](handleEntityNotFound(_0x3d262d,null))['then'](function(_0x25f2ff){if(_0x25f2ff){_0x120cb2=_0x25f2ff;_0x2fcea1[_0xd965('0x38')]=_[_0xd965('0x4f')](db[_0xd965('0x5a')]['rawAttributes']);_0x2fcea1['query']=_[_0xd965('0x4f')](_0x4e4a63[_0xd965('0x3b')]);_0x2fcea1[_0xd965('0x39')]=_['intersection'](_0x2fcea1[_0xd965('0x38')],_0x2fcea1['query']);_0x17f947[_0xd965('0x3c')]=_[_0xd965('0x3a')](_0x2fcea1['model'],qs[_0xd965('0x3d')](_0x4e4a63[_0xd965('0x3b')][_0xd965('0x3d')]));_0x17f947[_0xd965('0x3c')]=_0x17f947[_0xd965('0x3c')][_0xd965('0x3e')]?_0x17f947[_0xd965('0x3c')]:_0x2fcea1[_0xd965('0x38')];_0x17f947[_0xd965('0x5b')]=qs[_0xd965('0x42')](_0x4e4a63[_0xd965('0x3b')][_0xd965('0x42')]);_0x17f947[_0xd965('0x45')]=qs[_0xd965('0x39')](_['pick'](_0x4e4a63['query'],_0x2fcea1[_0xd965('0x39')]));if(_0x4e4a63[_0xd965('0x3b')]['filter']){_0x17f947[_0xd965('0x45')]=_[_0xd965('0x46')](_0x17f947['where'],{'$or':_['map'](_0x17f947['attributes'],function(_0x150483){var _0x332736={};_0x332736[_0x150483]={'$like':'%'+_0x4e4a63[_0xd965('0x3b')]['filter']+'%'};return _0x332736;})});}_0x17f947=_[_0xd965('0x46')]({},_0x17f947,_0x4e4a63['options']);return _0x120cb2[_0xd965('0x58')](_0x17f947);}})[_0xd965('0x1b')](function(_0x4bb954){if(_0x4bb954){_0x40556e=_0x4bb954['length'];if(!_0x4e4a63['query'][_0xd965('0x3f')](_0xd965('0x40'))){_0x17f947[_0xd965('0x41')]=qs['limit'](_0x4e4a63[_0xd965('0x3b')][_0xd965('0x41')]);_0x17f947[_0xd965('0x28')]=qs[_0xd965('0x28')](_0x4e4a63[_0xd965('0x3b')][_0xd965('0x28')]);}return _0x120cb2['getMembers'](_0x17f947);}})['then'](function(_0x36a41c){if(_0x36a41c){return _0x36a41c?{'count':_0x40556e,'rows':_0x36a41c}:null;}})[_0xd965('0x1b')](respondWithResult(_0x3d262d,null))['catch'](handleError(_0x3d262d,null));};exports['removeMembers']=function(_0x51848c,_0x36f137,_0x1f0a75){return db['ChatGroup'][_0xd965('0x52')]({'where':{'id':_0x51848c[_0xd965('0x4e')]['id']}})[_0xd965('0x1b')](handleEntityNotFound(_0x36f137,null))[_0xd965('0x1b')](function(_0x262198){if(_0x262198){return _0x262198['removeMembers'](_0x51848c[_0xd965('0x3b')][_0xd965('0x57')]);}})['then'](respondWithStatusCode(_0x36f137,null))[_0xd965('0x24')](handleError(_0x36f137,null));};exports[_0xd965('0x5c')]=function(_0x255619,_0x1fa3b9,_0x16a120){if(_0x255619['body']['id']){delete _0x255619['body']['id'];}return db[_0xd965('0x34')]['find']({'where':{'id':_0x255619[_0xd965('0x4e')]['id']}})[_0xd965('0x1b')](handleEntityNotFound(_0x1fa3b9,null))[_0xd965('0x1b')](function(_0x58a2fe){if(_0x58a2fe){_0x255619[_0xd965('0x51')][_0xd965('0x5d')]=_0x58a2fe['id'];return db[_0xd965('0x54')][_0xd965('0x50')](_0x255619['body']);}})[_0xd965('0x1b')](respondWithResult(_0x1fa3b9,null))[_0xd965('0x24')](handleError(_0x1fa3b9,null));};exports[_0xd965('0x5e')]=function(_0x36fbcf,_0x538be9,_0x57ea53){var _0x1d14ce={};var _0x57632e={};var _0x14a740;var _0x285113;return db['ChatGroup'][_0xd965('0x59')]({'where':{'id':_0x36fbcf[_0xd965('0x4e')]['id']}})[_0xd965('0x1b')](handleEntityNotFound(_0x538be9,null))['then'](function(_0x178a4f){if(_0x178a4f){_0x14a740=_0x178a4f;_0x57632e[_0xd965('0x38')]=_[_0xd965('0x4f')](db[_0xd965('0x54')][_0xd965('0x35')]);_0x57632e[_0xd965('0x3b')]=_[_0xd965('0x4f')](_0x36fbcf['query']);_0x57632e[_0xd965('0x39')]=_[_0xd965('0x3a')](_0x57632e[_0xd965('0x38')],_0x57632e[_0xd965('0x3b')]);_0x1d14ce['attributes']=_[_0xd965('0x3a')](_0x57632e[_0xd965('0x38')],qs[_0xd965('0x3d')](_0x36fbcf['query'][_0xd965('0x3d')]));_0x1d14ce['attributes']=_0x1d14ce[_0xd965('0x3c')][_0xd965('0x3e')]?_0x1d14ce[_0xd965('0x3c')]:_0x57632e[_0xd965('0x38')];_0x1d14ce['order']=qs[_0xd965('0x42')](_0x36fbcf['query'][_0xd965('0x42')]);_0x1d14ce[_0xd965('0x45')]=qs[_0xd965('0x39')](_[_0xd965('0x43')](_0x36fbcf[_0xd965('0x3b')],_0x57632e[_0xd965('0x39')]));if(_0x36fbcf[_0xd965('0x3b')][_0xd965('0x44')]){_0x1d14ce[_0xd965('0x45')]=_['merge'](_0x1d14ce['where'],{'$or':_['map'](_0x1d14ce['attributes'],function(_0x4bcafd){var _0x491b4a={};_0x491b4a[_0x4bcafd]={'$like':'%'+_0x36fbcf['query']['filter']+'%'};return _0x491b4a;})});}if(_0x36fbcf[_0xd965('0x3b')][_0xd965('0x5f')]){var _0x266d0d=_0x36fbcf[_0xd965('0x3b')]['$gte'][_0xd965('0x60')](',');var _0x5c1aa7={};_0x5c1aa7[_0x266d0d[0x0]]={'$gte':moment(_0x266d0d[0x1])[_0xd965('0x61')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d14ce[_0xd965('0x45')]=_[_0xd965('0x46')](_0x1d14ce[_0xd965('0x45')],_0x5c1aa7);}_0x1d14ce=_[_0xd965('0x46')]({},_0x1d14ce,_0x36fbcf[_0xd965('0x48')]);return _0x14a740[_0xd965('0x5e')](_0x1d14ce);}})[_0xd965('0x1b')](function(_0x160ff7){if(_0x160ff7){_0x285113=_0x160ff7['length'];if(!_0x36fbcf['query'][_0xd965('0x3f')](_0xd965('0x40'))){_0x1d14ce[_0xd965('0x41')]=qs[_0xd965('0x41')](_0x36fbcf[_0xd965('0x3b')][_0xd965('0x41')]);_0x1d14ce[_0xd965('0x28')]=qs[_0xd965('0x28')](_0x36fbcf[_0xd965('0x3b')]['offset']);}return _0x14a740[_0xd965('0x5e')](_0x1d14ce);}})[_0xd965('0x1b')](function(_0x1d9c81){if(_0x1d9c81){return _0x1d9c81?{'count':_0x285113,'rows':_0x1d9c81}:null;}})['then'](respondWithResult(_0x538be9,null))[_0xd965('0x24')](handleError(_0x538be9,null));}; \ No newline at end of file +var _0x707d=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','stack','name','send','index','map','ChatGroup','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','catch','params','keys','rawAttributes','fields','create','body','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','getMembers','findOne','order','pick','removeMembers','ids','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash'];(function(_0x1b8c71,_0x41d8ab){var _0x539905=function(_0x395edd){while(--_0x395edd){_0x1b8c71['push'](_0x1b8c71['shift']());}};_0x539905(++_0x41d8ab);}(_0x707d,0x18b));var _0xd707=function(_0x2e3baf,_0x30c161){_0x2e3baf=_0x2e3baf-0x0;var _0x4d3f23=_0x707d[_0x2e3baf];return _0x4d3f23;};'use strict';var pdf=require(_0xd707('0x0'));var emlformat=require(_0xd707('0x1'));var rimraf=require(_0xd707('0x2'));var zipdir=require(_0xd707('0x3'));var jsonpatch=require(_0xd707('0x4'));var rp=require(_0xd707('0x5'));var moment=require(_0xd707('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd707('0x7'));var util=require(_0xd707('0x8'));var path=require(_0xd707('0x9'));var sox=require(_0xd707('0xa'));var csv=require('to-csv');var ejs=require(_0xd707('0xb'));var fs=require('fs');var _=require(_0xd707('0xc'));var squel=require('squel');var crypto=require(_0xd707('0xd'));var jsforce=require(_0xd707('0xe'));var deskjs=require(_0xd707('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd707('0x10'));var Papa=require(_0xd707('0x11'));var Redis=require('ioredis');var authService=require(_0xd707('0x12'));var qs=require(_0xd707('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd707('0x14'))(_0xd707('0x15'));var utils=require(_0xd707('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd707('0x17'));var db=require(_0xd707('0x18'))['db'];config[_0xd707('0x19')]=_['defaults'](config['redis'],{'host':_0xd707('0x1a'),'port':0x18eb});var socket=require(_0xd707('0x1b'))(new Redis(config['redis']));require(_0xd707('0x1c'))[_0xd707('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd707('0x1e')][_0xd707('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4ef57a,_0x4f5e4e,_0x8d4e1c,_0x49ec72){return new BPromise(function(_0x356836,_0x18211b){var _0x479aea=_0x49ec72||client;return _0x479aea[_0xd707('0x20')](_0x4ef57a,_0x8d4e1c)[_0xd707('0x21')](function(_0x26412c){logger[_0xd707('0x22')](_0xd707('0x23'),_0x4f5e4e,_0xd707('0x24'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x4f5e4e,_0xd707('0x24'),JSON['stringify'](_0x26412c));if(_0x26412c[_0xd707('0x25')]){if(_0x26412c[_0xd707('0x25')][_0xd707('0x26')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x4f5e4e,_0x26412c[_0xd707('0x25')][_0xd707('0x27')]);return _0x18211b(_0x26412c[_0xd707('0x25')][_0xd707('0x27')]);}logger[_0xd707('0x25')](_0xd707('0x23'),_0x4f5e4e,_0x26412c[_0xd707('0x25')]['message']);return _0x356836(_0x26412c[_0xd707('0x25')]['message']);}else{logger[_0xd707('0x22')]('ChatGroup,\x20%s,\x20%s',_0x4f5e4e,_0xd707('0x24'));_0x356836(_0x26412c[_0xd707('0x28')][_0xd707('0x27')]);}})['catch'](function(_0xef6093){logger[_0xd707('0x25')]('ChatGroup,\x20%s,\x20%s',_0x4f5e4e,_0xef6093);_0x18211b(_0xef6093);});});}function respondWithStatusCode(_0x24340b,_0x472981){_0x472981=_0x472981||0xcc;return function(_0xdf8e03){if(_0xdf8e03){return _0x24340b[_0xd707('0x29')](_0x472981);}return _0x24340b[_0xd707('0x2a')](_0x472981)[_0xd707('0x2b')]();};}function respondWithResult(_0x18b314,_0x3330e6){_0x3330e6=_0x3330e6||0xc8;return function(_0x3feb7f){if(_0x3feb7f){return _0x18b314[_0xd707('0x2a')](_0x3330e6)[_0xd707('0x2c')](_0x3feb7f);}};}function respondWithFilteredResult(_0x53d5db,_0x2c0750){return function(_0x340b79){if(_0x340b79){var _0x17145b=_0x340b79[_0xd707('0x2d')],_0x2cf61d=_0x2c0750[_0xd707('0x2e')],_0x47029e=_0x2c0750[_0xd707('0x2e')]+_0x2c0750[_0xd707('0x2f')],_0x5c0310;if(_0x47029e>=_0x17145b){_0x47029e=_0x17145b;_0x5c0310=0xc8;}else{_0x5c0310=0xce;}_0x53d5db[_0xd707('0x2a')](_0x5c0310);return _0x53d5db[_0xd707('0x30')]('Content-Range',_0x2cf61d+'-'+_0x47029e+'/'+_0x17145b)[_0xd707('0x2c')](_0x340b79);}return null;};}function patchUpdates(_0x94486d){return function(_0x75ed05){try{jsonpatch['apply'](_0x75ed05,_0x94486d,!![]);}catch(_0x56e642){return BPromise[_0xd707('0x31')](_0x56e642);}return _0x75ed05[_0xd707('0x32')]();};}function saveUpdates(_0x4bfbb7,_0x345382){return function(_0x11b05b){if(_0x11b05b){return _0x11b05b[_0xd707('0x33')](_0x4bfbb7)[_0xd707('0x21')](function(_0x542b08){return _0x542b08;});}return null;};}function removeEntity(_0x4f1cfd,_0x17d75e){return function(_0x1a6c3c){if(_0x1a6c3c){return _0x1a6c3c['destroy']()[_0xd707('0x21')](function(){_0x4f1cfd[_0xd707('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cb9fd,_0x31be53){return function(_0x4b69d4){if(!_0x4b69d4){_0x4cb9fd[_0xd707('0x29')](0x194);}return _0x4b69d4;};}function handleError(_0x5bfe4e,_0x133c48){_0x133c48=_0x133c48||0x1f4;return function(_0x244c0e){logger['error'](_0x244c0e[_0xd707('0x34')]);if(_0x244c0e[_0xd707('0x35')]){delete _0x244c0e[_0xd707('0x35')];}_0x5bfe4e[_0xd707('0x2a')](_0x133c48)[_0xd707('0x36')](_0x244c0e);};}exports[_0xd707('0x37')]=function(_0x5424f7,_0x1b0ac8){var _0x2c0853={},_0x187f8f={},_0xda9b7b={'count':0x0,'rows':[]};var _0x226d17=_[_0xd707('0x38')](db[_0xd707('0x39')]['rawAttributes'],function(_0x5beb41){return{'name':_0x5beb41['fieldName'],'type':_0x5beb41['type'][_0xd707('0x3a')]};});_0x187f8f[_0xd707('0x3b')]=_[_0xd707('0x38')](_0x226d17,_0xd707('0x35'));_0x187f8f[_0xd707('0x3c')]=_['keys'](_0x5424f7['query']);_0x187f8f[_0xd707('0x3d')]=_[_0xd707('0x3e')](_0x187f8f[_0xd707('0x3b')],_0x187f8f[_0xd707('0x3c')]);_0x2c0853[_0xd707('0x3f')]=_[_0xd707('0x3e')](_0x187f8f[_0xd707('0x3b')],qs['fields'](_0x5424f7[_0xd707('0x3c')]['fields']));_0x2c0853[_0xd707('0x3f')]=_0x2c0853[_0xd707('0x3f')][_0xd707('0x40')]?_0x2c0853[_0xd707('0x3f')]:_0x187f8f['model'];if(!_0x5424f7[_0xd707('0x3c')][_0xd707('0x41')](_0xd707('0x42'))){_0x2c0853[_0xd707('0x2f')]=qs[_0xd707('0x2f')](_0x5424f7[_0xd707('0x3c')][_0xd707('0x2f')]);_0x2c0853[_0xd707('0x2e')]=qs[_0xd707('0x2e')](_0x5424f7[_0xd707('0x3c')][_0xd707('0x2e')]);}_0x2c0853['order']=qs[_0xd707('0x43')](_0x5424f7['query'][_0xd707('0x43')]);_0x2c0853[_0xd707('0x44')]=qs['filters'](_['pick'](_0x5424f7['query'],_0x187f8f[_0xd707('0x3d')]),_0x226d17);if(_0x5424f7[_0xd707('0x3c')][_0xd707('0x45')]){_0x2c0853[_0xd707('0x44')]=_[_0xd707('0x46')](_0x2c0853['where'],{'$or':_['map'](_0x226d17,function(_0x2e9c9b){if(_0x2e9c9b[_0xd707('0x47')]!==_0xd707('0x48')){var _0x15b120={};_0x15b120[_0x2e9c9b['name']]={'$like':'%'+_0x5424f7[_0xd707('0x3c')][_0xd707('0x45')]+'%'};return _0x15b120;}})});}_0x2c0853=_[_0xd707('0x46')]({},_0x2c0853,_0x5424f7[_0xd707('0x49')]);var _0x2d4c52={'where':_0x2c0853[_0xd707('0x44')]};return db[_0xd707('0x39')][_0xd707('0x2d')](_0x2d4c52)[_0xd707('0x21')](function(_0x5a9f4f){_0xda9b7b[_0xd707('0x2d')]=_0x5a9f4f;if(_0x5424f7[_0xd707('0x3c')][_0xd707('0x4a')]){_0x2c0853['include']=[{'all':!![]}];}return db[_0xd707('0x39')]['findAll'](_0x2c0853);})['then'](function(_0x3d51e1){_0xda9b7b['rows']=_0x3d51e1;return _0xda9b7b;})[_0xd707('0x21')](respondWithFilteredResult(_0x1b0ac8,_0x2c0853))[_0xd707('0x4b')](handleError(_0x1b0ac8,null));};exports['show']=function(_0x3f9145,_0x4109a2){var _0x4ca3e7={'raw':!![],'where':{'id':_0x3f9145[_0xd707('0x4c')]['id']}},_0x2f6f8e={};_0x2f6f8e[_0xd707('0x3b')]=_[_0xd707('0x4d')](db[_0xd707('0x39')][_0xd707('0x4e')]);_0x2f6f8e[_0xd707('0x3c')]=_['keys'](_0x3f9145[_0xd707('0x3c')]);_0x2f6f8e[_0xd707('0x3d')]=_[_0xd707('0x3e')](_0x2f6f8e[_0xd707('0x3b')],_0x2f6f8e[_0xd707('0x3c')]);_0x4ca3e7[_0xd707('0x3f')]=_['intersection'](_0x2f6f8e[_0xd707('0x3b')],qs[_0xd707('0x4f')](_0x3f9145[_0xd707('0x3c')]['fields']));_0x4ca3e7[_0xd707('0x3f')]=_0x4ca3e7['attributes'][_0xd707('0x40')]?_0x4ca3e7[_0xd707('0x3f')]:_0x2f6f8e['model'];if(_0x3f9145[_0xd707('0x3c')][_0xd707('0x4a')]){_0x4ca3e7['include']=[{'all':!![]}];}_0x4ca3e7=_[_0xd707('0x46')]({},_0x4ca3e7,_0x3f9145[_0xd707('0x49')]);return db[_0xd707('0x39')]['find'](_0x4ca3e7)[_0xd707('0x21')](handleEntityNotFound(_0x4109a2,null))[_0xd707('0x21')](respondWithResult(_0x4109a2,null))[_0xd707('0x4b')](handleError(_0x4109a2,null));};exports[_0xd707('0x50')]=function(_0x3d1de1,_0x55a964){return db[_0xd707('0x39')][_0xd707('0x50')](_0x3d1de1[_0xd707('0x51')],{})['then'](respondWithResult(_0x55a964,0xc9))[_0xd707('0x4b')](handleError(_0x55a964,null));};exports['update']=function(_0x2ed82a,_0x3f797d){if(_0x2ed82a[_0xd707('0x51')]['id']){delete _0x2ed82a[_0xd707('0x51')]['id'];}return db[_0xd707('0x39')][_0xd707('0x52')]({'where':{'id':_0x2ed82a[_0xd707('0x4c')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x3f797d,null))[_0xd707('0x21')](saveUpdates(_0x2ed82a[_0xd707('0x51')],null))[_0xd707('0x21')](respondWithResult(_0x3f797d,null))[_0xd707('0x4b')](handleError(_0x3f797d,null));};exports['destroy']=function(_0xd7c202,_0x21f3a5){return db['ChatGroup'][_0xd707('0x52')]({'where':{'id':_0xd7c202[_0xd707('0x4c')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x21f3a5,null))['then'](removeEntity(_0x21f3a5,null))['catch'](handleError(_0x21f3a5,null));};exports['describe']=function(_0x35ed2b,_0x5cc402){return db[_0xd707('0x39')][_0xd707('0x53')]()[_0xd707('0x21')](respondWithResult(_0x5cc402,null))[_0xd707('0x4b')](handleError(_0x5cc402,null));};exports[_0xd707('0x54')]=function(_0x5398dd,_0x50713f,_0x2c4bec){return db[_0xd707('0x55')]['count']({'where':{'ChatGroupId':_0x5398dd[_0xd707('0x4c')]['id'],'ToId':_0x5398dd['user']['id'],'read':![]}})[_0xd707('0x21')](function(_0x3e3946){return{'id':_[_0xd707('0x56')](_0x5398dd[_0xd707('0x4c')]['id']),'count':_0x3e3946};})['then'](respondWithResult(_0x50713f,null))[_0xd707('0x4b')](handleError(_0x50713f,null));};exports[_0xd707('0x57')]=function(_0x34c187,_0x1d8d1e,_0x2d8c99){return db[_0xd707('0x39')]['find']({'where':{'id':_0x34c187[_0xd707('0x4c')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x1d8d1e,null))[_0xd707('0x21')](function(_0x50c950){if(_0x50c950){return _0x50c950[_0xd707('0x57')](_0x34c187[_0xd707('0x51')]['ids'],_[_0xd707('0x58')](_0x34c187[_0xd707('0x51')],['ids','id'])||{});}})['then'](respondWithResult(_0x1d8d1e,null))[_0xd707('0x4b')](handleError(_0x1d8d1e,null));};exports[_0xd707('0x59')]=function(_0x5863ff,_0x5ac9f8,_0xf0bcee){var _0x206a93={};var _0x44adb7={};var _0xd32a4e;var _0x102f6a;return db['ChatGroup'][_0xd707('0x5a')]({'where':{'id':_0x5863ff[_0xd707('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ac9f8,null))[_0xd707('0x21')](function(_0x793a27){if(_0x793a27){_0xd32a4e=_0x793a27;_0x44adb7[_0xd707('0x3b')]=_[_0xd707('0x4d')](db['User'][_0xd707('0x4e')]);_0x44adb7[_0xd707('0x3c')]=_[_0xd707('0x4d')](_0x5863ff['query']);_0x44adb7[_0xd707('0x3d')]=_['intersection'](_0x44adb7['model'],_0x44adb7['query']);_0x206a93[_0xd707('0x3f')]=_[_0xd707('0x3e')](_0x44adb7[_0xd707('0x3b')],qs[_0xd707('0x4f')](_0x5863ff['query']['fields']));_0x206a93[_0xd707('0x3f')]=_0x206a93[_0xd707('0x3f')][_0xd707('0x40')]?_0x206a93[_0xd707('0x3f')]:_0x44adb7[_0xd707('0x3b')];_0x206a93[_0xd707('0x5b')]=qs['sort'](_0x5863ff[_0xd707('0x3c')]['sort']);_0x206a93['where']=qs['filters'](_[_0xd707('0x5c')](_0x5863ff['query'],_0x44adb7[_0xd707('0x3d')]));if(_0x5863ff[_0xd707('0x3c')][_0xd707('0x45')]){_0x206a93[_0xd707('0x44')]=_[_0xd707('0x46')](_0x206a93[_0xd707('0x44')],{'$or':_[_0xd707('0x38')](_0x206a93[_0xd707('0x3f')],function(_0x1db12c){var _0xe33e49={};_0xe33e49[_0x1db12c]={'$like':'%'+_0x5863ff[_0xd707('0x3c')][_0xd707('0x45')]+'%'};return _0xe33e49;})});}_0x206a93=_[_0xd707('0x46')]({},_0x206a93,_0x5863ff['options']);return _0xd32a4e[_0xd707('0x59')](_0x206a93);}})[_0xd707('0x21')](function(_0x50c560){if(_0x50c560){_0x102f6a=_0x50c560[_0xd707('0x40')];if(!_0x5863ff[_0xd707('0x3c')][_0xd707('0x41')](_0xd707('0x42'))){_0x206a93['limit']=qs[_0xd707('0x2f')](_0x5863ff[_0xd707('0x3c')][_0xd707('0x2f')]);_0x206a93['offset']=qs['offset'](_0x5863ff['query'][_0xd707('0x2e')]);}return _0xd32a4e[_0xd707('0x59')](_0x206a93);}})[_0xd707('0x21')](function(_0x341173){if(_0x341173){return _0x341173?{'count':_0x102f6a,'rows':_0x341173}:null;}})[_0xd707('0x21')](respondWithResult(_0x5ac9f8,null))[_0xd707('0x4b')](handleError(_0x5ac9f8,null));};exports[_0xd707('0x5d')]=function(_0x13ff8b,_0x1d44e3,_0x1a8868){return db[_0xd707('0x39')][_0xd707('0x52')]({'where':{'id':_0x13ff8b[_0xd707('0x4c')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x1d44e3,null))[_0xd707('0x21')](function(_0x35f13b){if(_0x35f13b){return _0x35f13b['removeMembers'](_0x13ff8b[_0xd707('0x3c')][_0xd707('0x5e')]);}})[_0xd707('0x21')](respondWithStatusCode(_0x1d44e3,null))[_0xd707('0x4b')](handleError(_0x1d44e3,null));};exports[_0xd707('0x5f')]=function(_0x590efa,_0x108e6e,_0x5b527c){if(_0x590efa['body']['id']){delete _0x590efa[_0xd707('0x51')]['id'];}return db[_0xd707('0x39')][_0xd707('0x52')]({'where':{'id':_0x590efa['params']['id']}})['then'](handleEntityNotFound(_0x108e6e,null))['then'](function(_0x3fa0a2){if(_0x3fa0a2){_0x590efa[_0xd707('0x51')][_0xd707('0x60')]=_0x3fa0a2['id'];return db[_0xd707('0x55')][_0xd707('0x50')](_0x590efa[_0xd707('0x51')]);}})['then'](respondWithResult(_0x108e6e,null))['catch'](handleError(_0x108e6e,null));};exports[_0xd707('0x61')]=function(_0x4a369d,_0x1c0f99,_0x4de75c){var _0x3a9b8e={};var _0x4f9ece={};var _0x3535d3;var _0x4f9df4;return db[_0xd707('0x39')][_0xd707('0x5a')]({'where':{'id':_0x4a369d[_0xd707('0x4c')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x1c0f99,null))['then'](function(_0x1f69e4){if(_0x1f69e4){_0x3535d3=_0x1f69e4;_0x4f9ece['model']=_[_0xd707('0x4d')](db[_0xd707('0x55')][_0xd707('0x4e')]);_0x4f9ece[_0xd707('0x3c')]=_[_0xd707('0x4d')](_0x4a369d[_0xd707('0x3c')]);_0x4f9ece['filters']=_[_0xd707('0x3e')](_0x4f9ece[_0xd707('0x3b')],_0x4f9ece[_0xd707('0x3c')]);_0x3a9b8e[_0xd707('0x3f')]=_['intersection'](_0x4f9ece[_0xd707('0x3b')],qs['fields'](_0x4a369d['query'][_0xd707('0x4f')]));_0x3a9b8e['attributes']=_0x3a9b8e[_0xd707('0x3f')][_0xd707('0x40')]?_0x3a9b8e['attributes']:_0x4f9ece[_0xd707('0x3b')];_0x3a9b8e['order']=qs[_0xd707('0x43')](_0x4a369d[_0xd707('0x3c')][_0xd707('0x43')]);_0x3a9b8e[_0xd707('0x44')]=qs[_0xd707('0x3d')](_[_0xd707('0x5c')](_0x4a369d[_0xd707('0x3c')],_0x4f9ece[_0xd707('0x3d')]));if(_0x4a369d['query'][_0xd707('0x45')]){_0x3a9b8e['where']=_[_0xd707('0x46')](_0x3a9b8e[_0xd707('0x44')],{'$or':_[_0xd707('0x38')](_0x3a9b8e['attributes'],function(_0x3255c1){var _0x3e5f51={};_0x3e5f51[_0x3255c1]={'$like':'%'+_0x4a369d[_0xd707('0x3c')][_0xd707('0x45')]+'%'};return _0x3e5f51;})});}if(_0x4a369d[_0xd707('0x3c')]['$gte']){var _0x3caf96=_0x4a369d[_0xd707('0x3c')][_0xd707('0x62')][_0xd707('0x63')](',');var _0x545acf={};_0x545acf[_0x3caf96[0x0]]={'$gte':moment(_0x3caf96[0x1])[_0xd707('0x64')](_0xd707('0x65'))};_0x3a9b8e[_0xd707('0x44')]=_[_0xd707('0x46')](_0x3a9b8e[_0xd707('0x44')],_0x545acf);}_0x3a9b8e=_[_0xd707('0x46')]({},_0x3a9b8e,_0x4a369d['options']);return _0x3535d3[_0xd707('0x61')](_0x3a9b8e);}})[_0xd707('0x21')](function(_0x52b298){if(_0x52b298){_0x4f9df4=_0x52b298[_0xd707('0x40')];if(!_0x4a369d[_0xd707('0x3c')][_0xd707('0x41')](_0xd707('0x42'))){_0x3a9b8e[_0xd707('0x2f')]=qs['limit'](_0x4a369d[_0xd707('0x3c')][_0xd707('0x2f')]);_0x3a9b8e[_0xd707('0x2e')]=qs['offset'](_0x4a369d['query'][_0xd707('0x2e')]);}return _0x3535d3[_0xd707('0x61')](_0x3a9b8e);}})[_0xd707('0x21')](function(_0xfdab1e){if(_0xfdab1e){return _0xfdab1e?{'count':_0x4f9df4,'rows':_0xfdab1e}:null;}})[_0xd707('0x21')](respondWithResult(_0x1c0f99,null))['catch'](handleError(_0x1c0f99,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index cf38718..b017c0b 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 _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x122d9f,_0x2c9e5b){var _0x41a09e=function(_0x3d9564){while(--_0x3d9564){_0x122d9f['push'](_0x122d9f['shift']());}};_0x41a09e(++_0x2c9e5b);}(_0xadb5,0xad));var _0x5adb=function(_0x5c82ab,_0x1f3b1c){_0x5c82ab=_0x5c82ab-0x0;var _0x437f38=_0xadb5[_0x5c82ab];return _0x437f38;};'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 +var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x2788e5,_0x562bf4){var _0x7b12fd=function(_0x462a59){while(--_0x462a59){_0x2788e5['push'](_0x2788e5['shift']());}};_0x7b12fd(++_0x562bf4);}(_0x2ef3,0xba));var _0x32ef=function(_0x4afde0,_0x17627c){_0x4afde0=_0x4afde0-0x0;var _0x2b7aa6=_0x2ef3[_0x4afde0];return _0x2b7aa6;};'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 diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 893a647..f5fc29f 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 _0x3c7b=['../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment'];(function(_0x1546ea,_0xa169a8){var _0x3301a5=function(_0x269af9){while(--_0x269af9){_0x1546ea['push'](_0x1546ea['shift']());}};_0x3301a5(++_0xa169a8);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x897fc8,_0x45d23c){_0x897fc8=_0x897fc8-0x0;var _0xbb6e2=_0x3c7b[_0x897fc8];return _0xbb6e2;};'use strict';var _=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var logger=require(_0xb3c7('0x2'))(_0xb3c7('0x3'));var moment=require(_0xb3c7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3c7('0x5'));var attributes=require(_0xb3c7('0x6'));module['exports']=function(_0x396a46,_0x5b810b){return _0x396a46[_0xb3c7('0x7')](_0xb3c7('0x8'),attributes,{'tableName':_0xb3c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeedf=['exports','define','chat_groups','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xeedf,0x12c));var _0xfeed=function(_0x270e85,_0x3e8000){_0x270e85=_0x270e85-0x0;var _0x47d9a8=_0xeedf[_0x270e85];return _0x47d9a8;};'use strict';var _=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var logger=require(_0xfeed('0x2'))('api');var moment=require(_0xfeed('0x3'));var BPromise=require('bluebird');var rp=require(_0xfeed('0x4'));var fs=require('fs');var path=require(_0xfeed('0x5'));var rimraf=require(_0xfeed('0x6'));var config=require(_0xfeed('0x7'));var attributes=require('./chatGroup.attributes');module[_0xfeed('0x8')]=function(_0x2c211d,_0x5df4fe){return _0x2c211d[_0xfeed('0x9')]('ChatGroup',attributes,{'tableName':_0xfeed('0xa'),'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 5accdea..3bec748 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 _0xeb1d=['../../config/environment','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','message','ChatGroup,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x478e76,_0x9d5803){var _0x1b53b3=function(_0x3de6a8){while(--_0x3de6a8){_0x478e76['push'](_0x478e76['shift']());}};_0x1b53b3(++_0x9d5803);}(_0xeb1d,0x93));var _0xdeb1=function(_0x2c764f,_0x434c2f){_0x2c764f=_0x2c764f-0x0;var _0x4b7936=_0xeb1d[_0x2c764f];return _0x4b7936;};'use strict';var _=require('lodash');var util=require(_0xdeb1('0x0'));var moment=require(_0xdeb1('0x1'));var BPromise=require(_0xdeb1('0x2'));var rs=require(_0xdeb1('0x3'));var fs=require('fs');var Redis=require(_0xdeb1('0x4'));var db=require(_0xdeb1('0x5'))['db'];var utils=require(_0xdeb1('0x6'));var logger=require(_0xdeb1('0x7'))(_0xdeb1('0x8'));var config=require(_0xdeb1('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdeb1('0xa')]({'port':0x232a});config['redis']=_[_0xdeb1('0xb')](config[_0xdeb1('0xc')],{'host':_0xdeb1('0xd'),'port':0x18eb});var socket=require(_0xdeb1('0xe'))(new Redis(config[_0xdeb1('0xc')]));require('./chatGroup.socket')[_0xdeb1('0xf')](socket);function respondWithRpcPromise(_0x3c77d7,_0x19b13f,_0x4b4a66){return new BPromise(function(_0x4c084b,_0x55d69b){return client[_0xdeb1('0x10')](_0x3c77d7,_0x4b4a66)[_0xdeb1('0x11')](function(_0x143c80){logger[_0xdeb1('0x12')]('ChatGroup,\x20%s,\x20%s',_0x19b13f,_0xdeb1('0x13'));logger[_0xdeb1('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x19b13f,'request\x20sent',JSON[_0xdeb1('0x15')](_0x143c80));if(_0x143c80[_0xdeb1('0x16')]){if(_0x143c80[_0xdeb1('0x16')]['code']===0x1f4){logger[_0xdeb1('0x16')]('ChatGroup,\x20%s,\x20%s',_0x19b13f,_0x143c80[_0xdeb1('0x16')][_0xdeb1('0x17')]);return _0x55d69b(_0x143c80[_0xdeb1('0x16')]['message']);}logger[_0xdeb1('0x16')](_0xdeb1('0x18'),_0x19b13f,_0x143c80[_0xdeb1('0x16')][_0xdeb1('0x17')]);return _0x4c084b(_0x143c80['error'][_0xdeb1('0x17')]);}else{logger['info'](_0xdeb1('0x18'),_0x19b13f,_0xdeb1('0x13'));_0x4c084b(_0x143c80[_0xdeb1('0x19')][_0xdeb1('0x17')]);}})['catch'](function(_0x3be8a3){logger[_0xdeb1('0x16')](_0xdeb1('0x18'),_0x19b13f,_0x3be8a3);_0x55d69b(_0x3be8a3);});});} \ No newline at end of file +var _0xfe04=['redis','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xfe04,0x1eb));var _0x4fe0=function(_0x20337c,_0x1cce51){_0x20337c=_0x20337c-0x0;var _0x1bd93e=_0xfe04[_0x20337c];return _0x1bd93e;};'use strict';var _=require(_0x4fe0('0x0'));var util=require('util');var moment=require(_0x4fe0('0x1'));var BPromise=require(_0x4fe0('0x2'));var rs=require(_0x4fe0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fe0('0x4'))['db'];var utils=require(_0x4fe0('0x5'));var logger=require(_0x4fe0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4fe0('0x7'));var client=jayson[_0x4fe0('0x8')]['http']({'port':0x232a});config[_0x4fe0('0x9')]=_['defaults'](config[_0x4fe0('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fe0('0xa'))(new Redis(config[_0x4fe0('0x9')]));require(_0x4fe0('0xb'))['register'](socket);function respondWithRpcPromise(_0x3114e3,_0x5255ca,_0xbbd565){return new BPromise(function(_0x4a60b5,_0x1d533c){return client[_0x4fe0('0xc')](_0x3114e3,_0xbbd565)[_0x4fe0('0xd')](function(_0x2aa745){logger[_0x4fe0('0xe')](_0x4fe0('0xf'),_0x5255ca,_0x4fe0('0x10'));logger[_0x4fe0('0x11')](_0x4fe0('0x12'),_0x5255ca,_0x4fe0('0x10'),JSON[_0x4fe0('0x13')](_0x2aa745));if(_0x2aa745[_0x4fe0('0x14')]){if(_0x2aa745['error'][_0x4fe0('0x15')]===0x1f4){logger[_0x4fe0('0x14')](_0x4fe0('0xf'),_0x5255ca,_0x2aa745['error'][_0x4fe0('0x16')]);return _0x1d533c(_0x2aa745[_0x4fe0('0x14')]['message']);}logger[_0x4fe0('0x14')](_0x4fe0('0xf'),_0x5255ca,_0x2aa745[_0x4fe0('0x14')][_0x4fe0('0x16')]);return _0x4a60b5(_0x2aa745[_0x4fe0('0x14')]['message']);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x5255ca,'request\x20sent');_0x4a60b5(_0x2aa745[_0x4fe0('0x17')][_0x4fe0('0x16')]);}})[_0x4fe0('0x18')](function(_0xe55ba9){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5255ca,_0xe55ba9);_0x1d533c(_0xe55ba9);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index c25b5b9..aa3dbad 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 _0x1187=['removeListener','register','length','chatGroup:','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1187,0x1de));var _0x7118=function(_0x7a8645,_0xeb285e){_0x7a8645=_0x7a8645-0x0;var _0x17aaad=_0x1187[_0x7a8645];return _0x17aaad;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x7118('0x0'),_0x7118('0x1'),'update'];function createListener(_0x20de3a,_0x2ddfb0){return function(_0x5ad204){_0x2ddfb0['emit'](_0x20de3a,_0x5ad204);};}function removeListener(_0x4096f3,_0x7782e4){return function(){ChatGroupEvents[_0x7118('0x2')](_0x4096f3,_0x7782e4);};}exports[_0x7118('0x3')]=function(_0x368fe7){for(var _0x42d7b6=0x0,_0x502b21=events[_0x7118('0x4')];_0x42d7b6<_0x502b21;_0x42d7b6++){var _0x4666cb=events[_0x42d7b6];var _0x3d6a3d=createListener(_0x7118('0x5')+_0x4666cb,_0x368fe7);ChatGroupEvents['on'](_0x4666cb,_0x3d6a3d);}}; \ No newline at end of file +var _0x563f=['removeListener','length','chatGroup:','./chatGroup.events','remove','update','emit'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x563f,0xdc));var _0xf563=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x563f[_0x501510];return _0x1e6ee5;};'use strict';var ChatGroupEvents=require(_0xf563('0x0'));var events=['save',_0xf563('0x1'),_0xf563('0x2')];function createListener(_0x5cfcfc,_0x5a8fca){return function(_0x2b691d){_0x5a8fca[_0xf563('0x3')](_0x5cfcfc,_0x2b691d);};}function removeListener(_0x4b9287,_0x2246fc){return function(){ChatGroupEvents[_0xf563('0x4')](_0x4b9287,_0x2246fc);};}exports['register']=function(_0x203b4c){for(var _0x369fe8=0x0,_0xa14e7c=events[_0xf563('0x5')];_0x369fe8<_0xa14e7c;_0x369fe8++){var _0x126e07=events[_0x369fe8];var _0x381d4a=createListener(_0xf563('0x6')+_0x126e07,_0x203b4c);ChatGroupEvents['on'](_0x126e07,_0x381d4a);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 244fad9..810c3ac 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 _0x6460=['removeMembers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','update','delete'];(function(_0x5bfdf,_0x3c6a38){var _0x572078=function(_0xd35da){while(--_0xd35da){_0x5bfdf['push'](_0x5bfdf['shift']());}};_0x572078(++_0x3c6a38);}(_0x6460,0x9e));var _0x0646=function(_0x35c86f,_0x399bc4){_0x35c86f=_0x35c86f-0x0;var _0x28c841=_0x6460[_0x35c86f];return _0x28c841;};'use strict';var multer=require(_0x0646('0x0'));var util=require('util');var path=require(_0x0646('0x1'));var timeout=require(_0x0646('0x2'));var express=require(_0x0646('0x3'));var router=express[_0x0646('0x4')]();var auth=require(_0x0646('0x5'));var interaction=require(_0x0646('0x6'));var config=require(_0x0646('0x7'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0x0646('0x8')](),controller[_0x0646('0x9')]);router[_0x0646('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x0646('0xb')]);router[_0x0646('0xa')](_0x0646('0xc'),auth[_0x0646('0x8')](),controller['show']);router[_0x0646('0xa')](_0x0646('0xd'),auth[_0x0646('0x8')](),controller[_0x0646('0xe')]);router[_0x0646('0xa')](_0x0646('0xf'),auth[_0x0646('0x8')](),controller[_0x0646('0x10')]);router[_0x0646('0xa')](_0x0646('0x11'),auth[_0x0646('0x8')](),controller[_0x0646('0x12')]);router[_0x0646('0x13')]('/',auth[_0x0646('0x8')](),controller[_0x0646('0x14')]);router[_0x0646('0x13')](_0x0646('0xf'),auth[_0x0646('0x8')](),controller[_0x0646('0x15')]);router[_0x0646('0x13')](_0x0646('0x11'),auth[_0x0646('0x8')](),controller['addMessage']);router['put'](_0x0646('0xc'),auth[_0x0646('0x8')](),controller[_0x0646('0x16')]);router[_0x0646('0x17')](_0x0646('0xc'),auth[_0x0646('0x8')](),controller['destroy']);router[_0x0646('0x17')](_0x0646('0xf'),auth[_0x0646('0x8')](),controller[_0x0646('0x18')]);module[_0x0646('0x19')]=router; \ No newline at end of file +var _0x47d6=['/:id','show','getUnread','/:id/members','getMembers','getMessages','post','create','addMembers','addMessage','update','destroy','delete','removeMembers','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe'];(function(_0x4f2f43,_0x189566){var _0x538cd2=function(_0x565243){while(--_0x565243){_0x4f2f43['push'](_0x4f2f43['shift']());}};_0x538cd2(++_0x189566);}(_0x47d6,0x91));var _0x647d=function(_0x302d97,_0x4f5a37){_0x302d97=_0x302d97-0x0;var _0x4b434b=_0x47d6[_0x302d97];return _0x4b434b;};'use strict';var multer=require(_0x647d('0x0'));var util=require('util');var path=require(_0x647d('0x1'));var timeout=require(_0x647d('0x2'));var express=require('express');var router=express[_0x647d('0x3')]();var auth=require(_0x647d('0x4'));var interaction=require(_0x647d('0x5'));var config=require('../../config/environment');var controller=require(_0x647d('0x6'));router[_0x647d('0x7')]('/',auth[_0x647d('0x8')](),controller[_0x647d('0x9')]);router[_0x647d('0x7')](_0x647d('0xa'),auth[_0x647d('0x8')](),controller['describe']);router[_0x647d('0x7')](_0x647d('0xb'),auth['isAuthenticated'](),controller[_0x647d('0xc')]);router[_0x647d('0x7')]('/:id/unread',auth[_0x647d('0x8')](),controller[_0x647d('0xd')]);router[_0x647d('0x7')](_0x647d('0xe'),auth['isAuthenticated'](),controller[_0x647d('0xf')]);router[_0x647d('0x7')]('/:id/messages',auth[_0x647d('0x8')](),controller[_0x647d('0x10')]);router[_0x647d('0x11')]('/',auth[_0x647d('0x8')](),controller[_0x647d('0x12')]);router['post']('/:id/members',auth['isAuthenticated'](),controller[_0x647d('0x13')]);router['post']('/:id/messages',auth[_0x647d('0x8')](),controller[_0x647d('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x647d('0x15')]);router['delete']('/:id',auth[_0x647d('0x8')](),controller[_0x647d('0x16')]);router[_0x647d('0x17')](_0x647d('0xe'),auth[_0x647d('0x8')](),controller[_0x647d('0x18')]);module[_0x647d('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index bbca7be..2b65f9c 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 _0xf0b0=['STRING','long','sequelize','exports','INTEGER','ENUM','star','TEXT','DATE'];(function(_0x476bbc,_0x377a89){var _0x3c4f92=function(_0x7571ce){while(--_0x7571ce){_0x476bbc['push'](_0x476bbc['shift']());}};_0x3c4f92(++_0x377a89);}(_0xf0b0,0xd1));var _0x0f0b=function(_0x4c45b0,_0xcd784c){_0x4c45b0=_0x4c45b0-0x0;var _0x9b5516=_0xf0b0[_0x4c45b0];return _0x9b5516;};'use strict';var Sequelize=require(_0x0f0b('0x0'));module[_0x0f0b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0f0b('0x2')]},'ratingType':{'type':Sequelize[_0x0f0b('0x3')](_0x0f0b('0x4'),'thumb'),'defaultValue':_0x0f0b('0x4')},'ratingMessage':{'type':Sequelize[_0x0f0b('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0f0b('0x6')]},'disposition':{'type':Sequelize[_0x0f0b('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0f0b('0x7')]},'note':{'type':Sequelize[_0x0f0b('0x7')]},'browserName':{'type':Sequelize[_0x0f0b('0x7')]},'browserVersion':{'type':Sequelize[_0x0f0b('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x0f0b('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x0f0b('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x0f0b('0x5')]},'customerIp':{'type':Sequelize[_0x0f0b('0x7')]},'formData':{'type':Sequelize[_0x0f0b('0x5')](_0x0f0b('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x0f0b('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x0f0b('0x7')]},'customerPort':{'type':Sequelize[_0x0f0b('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x0f0b('0x5')]}}; \ No newline at end of file +var _0x3e22=['INTEGER','ENUM','star','thumb','DATE','STRING','TEXT','out','sequelize'];(function(_0x167657,_0x4102e5){var _0x2ed3c2=function(_0x49455d){while(--_0x49455d){_0x167657['push'](_0x167657['shift']());}};_0x2ed3c2(++_0x4102e5);}(_0x3e22,0x1ca));var _0x23e2=function(_0xe1fcfb,_0x24fcee){_0xe1fcfb=_0xe1fcfb-0x0;var _0x21528f=_0x3e22[_0xe1fcfb];return _0x21528f;};'use strict';var Sequelize=require(_0x23e2('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x23e2('0x1')]},'ratingType':{'type':Sequelize[_0x23e2('0x2')](_0x23e2('0x3'),_0x23e2('0x4')),'defaultValue':_0x23e2('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x23e2('0x5')]},'disposition':{'type':Sequelize[_0x23e2('0x6')]},'secondDisposition':{'type':Sequelize[_0x23e2('0x6')]},'thirdDisposition':{'type':Sequelize[_0x23e2('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x23e2('0x6')]},'browserVersion':{'type':Sequelize[_0x23e2('0x6')]},'osName':{'type':Sequelize[_0x23e2('0x6')]},'osVersion':{'type':Sequelize[_0x23e2('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x23e2('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x23e2('0x7')]},'customerIp':{'type':Sequelize[_0x23e2('0x6')]},'formData':{'type':Sequelize[_0x23e2('0x7')]('long')},'read1stAt':{'type':Sequelize[_0x23e2('0x5')]},'lastMsgAt':{'type':Sequelize[_0x23e2('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x23e2('0x2')]('in',_0x23e2('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x23e2('0x6')]},'customerPort':{'type':Sequelize[_0x23e2('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x23e2('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 1d9fef8..d646f11 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 _0x7b9b=['apply','reject','save','update','destroy','name','Users','map','Tags','TagIds','split','forEach','index','ChatInteraction','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','ui.ChatInteractionId','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','ChatWebsiteId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','agent','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','rows','catch','params','rawAttributes','includeAll','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooApiKey','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','sendMail','email','Mail\x20Transcript','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','include','findAll','options','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','join','attachments','transcript-%d-%s.zip','firstName','lastName','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','%s\x20#%d','Chat','YYYY-MM-DD','Account','N.A.','closedAt','disposition','browserName','osName','customerIp','customerPort','tail','existsSync','pipe','out','renderFile','views','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x57ea66,_0x217020){var _0x29b3ac=function(_0x3474ad){while(--_0x3474ad){_0x57ea66['push'](_0x57ea66['shift']());}};_0x29b3ac(++_0x217020);}(_0x7b9b,0x107));var _0xb7b9=function(_0x4c4363,_0x45e80e){_0x4c4363=_0x4c4363-0x0;var _0xc82c91=_0x7b9b[_0x4c4363];return _0xc82c91;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb7b9('0x0'));var rimraf=require(_0xb7b9('0x1'));var zipdir=require(_0xb7b9('0x2'));var jsonpatch=require(_0xb7b9('0x3'));var rp=require(_0xb7b9('0x4'));var moment=require(_0xb7b9('0x5'));var BPromise=require(_0xb7b9('0x6'));var Mustache=require(_0xb7b9('0x7'));var util=require('util');var path=require(_0xb7b9('0x8'));var sox=require(_0xb7b9('0x9'));var csv=require('to-csv');var ejs=require(_0xb7b9('0xa'));var fs=require('fs');var _=require(_0xb7b9('0xb'));var squel=require(_0xb7b9('0xc'));var crypto=require('crypto');var jsforce=require(_0xb7b9('0xd'));var deskjs=require(_0xb7b9('0xe'));var toCsv=require(_0xb7b9('0xf'));var querystring=require(_0xb7b9('0x10'));var Papa=require(_0xb7b9('0x11'));var Redis=require(_0xb7b9('0x12'));var authService=require(_0xb7b9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb7b9('0x14'));var hardwareService=require(_0xb7b9('0x15'));var logger=require(_0xb7b9('0x16'))(_0xb7b9('0x17'));var utils=require('../../config/utils');var config=require(_0xb7b9('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb7b9('0x19')]=_[_0xb7b9('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb7b9('0x1b'))(new Redis(config[_0xb7b9('0x19')]));require(_0xb7b9('0x1c'))['register'](socket);var jayson=require(_0xb7b9('0x1d'));var client=jayson[_0xb7b9('0x1e')][_0xb7b9('0x1f')]({'port':0x232b});var client9004=jayson['client'][_0xb7b9('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xfa7235,_0xf6e36a,_0x6ee8d6,_0x401892){return new BPromise(function(_0x3fca44,_0x52190a){var _0x8332be=_0x401892||client;return _0x8332be[_0xb7b9('0x20')](_0xfa7235,_0x6ee8d6)[_0xb7b9('0x21')](function(_0x3b1814){logger[_0xb7b9('0x22')](_0xb7b9('0x23'),_0xf6e36a,'request\x20sent');logger['debug'](_0xb7b9('0x24'),_0xf6e36a,_0xb7b9('0x25'),JSON[_0xb7b9('0x26')](_0x3b1814));if(_0x3b1814[_0xb7b9('0x27')]){if(_0x3b1814[_0xb7b9('0x27')]['code']===0x1f4){logger[_0xb7b9('0x27')]('ChatInteraction,\x20%s,\x20%s',_0xf6e36a,_0x3b1814[_0xb7b9('0x27')]['message']);return _0x52190a(_0x3b1814[_0xb7b9('0x27')][_0xb7b9('0x28')]);}logger['error'](_0xb7b9('0x23'),_0xf6e36a,_0x3b1814[_0xb7b9('0x27')][_0xb7b9('0x28')]);return _0x3fca44(_0x3b1814['error']['message']);}else{logger[_0xb7b9('0x22')]('ChatInteraction,\x20%s,\x20%s',_0xf6e36a,_0xb7b9('0x25'));_0x3fca44(_0x3b1814[_0xb7b9('0x29')][_0xb7b9('0x28')]);}})['catch'](function(_0xf43bb4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0xf6e36a,_0xf43bb4);_0x52190a(_0xf43bb4);});});}function respondWithStatusCode(_0x293d4c,_0x211e0a){_0x211e0a=_0x211e0a||0xcc;return function(_0x51c9d6){if(_0x51c9d6){return _0x293d4c[_0xb7b9('0x2a')](_0x211e0a);}return _0x293d4c[_0xb7b9('0x2b')](_0x211e0a)[_0xb7b9('0x2c')]();};}function respondWithResult(_0x435c9d,_0x570a9){_0x570a9=_0x570a9||0xc8;return function(_0x28b137){if(_0x28b137){return _0x435c9d[_0xb7b9('0x2b')](_0x570a9)[_0xb7b9('0x2d')](_0x28b137);}};}function respondWithFilteredResult(_0x446577,_0x23b1ac){return function(_0x44c994){if(_0x44c994){var _0x4c2ea2=_0x44c994[_0xb7b9('0x2e')],_0x4e4f17=_0x23b1ac[_0xb7b9('0x2f')],_0x5f52d4=_0x23b1ac['offset']+_0x23b1ac[_0xb7b9('0x30')],_0x42b92f;if(_0x5f52d4>=_0x4c2ea2){_0x5f52d4=_0x4c2ea2;_0x42b92f=0xc8;}else{_0x42b92f=0xce;}_0x446577[_0xb7b9('0x2b')](_0x42b92f);return _0x446577[_0xb7b9('0x31')]('Content-Range',_0x4e4f17+'-'+_0x5f52d4+'/'+_0x4c2ea2)[_0xb7b9('0x2d')](_0x44c994);}return null;};}function patchUpdates(_0x38c571){return function(_0x327726){try{jsonpatch[_0xb7b9('0x32')](_0x327726,_0x38c571,!![]);}catch(_0x4b82c8){return BPromise[_0xb7b9('0x33')](_0x4b82c8);}return _0x327726[_0xb7b9('0x34')]();};}function saveUpdates(_0x1c08af,_0x1c6402){return function(_0x54ba64){if(_0x54ba64){return _0x54ba64[_0xb7b9('0x35')](_0x1c08af)[_0xb7b9('0x21')](function(_0x3c6576){return _0x3c6576;});}return null;};}function removeEntity(_0x3aa135,_0x4e9d0b){return function(_0x3d8855){if(_0x3d8855){return _0x3d8855[_0xb7b9('0x36')]()[_0xb7b9('0x21')](function(){_0x3aa135[_0xb7b9('0x2b')](0xcc)[_0xb7b9('0x2c')]();});}};}function handleEntityNotFound(_0x187912,_0x601400){return function(_0x3e4792){if(!_0x3e4792){_0x187912[_0xb7b9('0x2a')](0x194);}return _0x3e4792;};}function handleError(_0xd8b139,_0x5b5e09){_0x5b5e09=_0x5b5e09||0x1f4;return function(_0x2c069a){logger[_0xb7b9('0x27')](_0x2c069a['stack']);if(_0x2c069a[_0xb7b9('0x37')]){delete _0x2c069a[_0xb7b9('0x37')];}_0xd8b139[_0xb7b9('0x2b')](_0x5b5e09)['send'](_0x2c069a);};}function getInteractionUsers(_0x2d5103,_0xf69bec){return new BPromise(function(_0x4dd798,_0x2ddab2){try{if(_0xf69bec[_0x2d5103['id']]){_0x2d5103[_0xb7b9('0x38')]=_[_0xb7b9('0x39')](_0xf69bec[_0x2d5103['id']],function(_0x503164){return{'id':_0x503164['id'],'fullname':_0x503164['fullname']};});}}catch(_0x3dde8b){_0x2ddab2(_0x3dde8b);}_0x4dd798(_0x2d5103);});}function getInteractionTags(_0x6ed33c,_0x592d91){return new BPromise(function(_0x2339fa,_0x3bcfac){try{if(_0x6ed33c['TagIds']){_0x6ed33c[_0xb7b9('0x3a')]=[];_0x6ed33c[_0xb7b9('0x3b')][_0xb7b9('0x3c')](',')[_0xb7b9('0x3d')](function(_0x243b56){_0x6ed33c[_0xb7b9('0x3a')]['push'](_0x592d91[_0x243b56]);});}delete _0x6ed33c[_0xb7b9('0x3b')];}catch(_0x287494){_0x3bcfac(_0x287494);}_0x2339fa(_0x6ed33c);});}function updateChatInteraction(_0x4f4a0d,_0xfaa30,_0x1686c1){return new BPromise(function(_0x2817f2,_0x25cbe8){return getInteractionUsers(_0x4f4a0d,_0x1686c1)[_0xb7b9('0x21')](function(_0x4f52aa){return getInteractionTags(_0x4f52aa,_0xfaa30);})[_0xb7b9('0x21')](function(_0x8a04b8){_0x2817f2(_0x8a04b8);})['catch'](function(_0x190259){_0x25cbe8(_0x190259);});});}exports[_0xb7b9('0x3e')]=function(_0x510d23,_0x130bdd){var _0xdd2904={},_0x3aa885={},_0x24b1a6={'count':0x0,'rows':[]};var _0x469262=_['map'](db[_0xb7b9('0x3f')]['rawAttributes'],function(_0x114b14){return{'name':_0x114b14['fieldName'],'type':_0x114b14[_0xb7b9('0x40')][_0xb7b9('0x41')]};});_0x3aa885[_0xb7b9('0x42')]=_[_0xb7b9('0x39')](_0x469262,'name');_0x3aa885['query']=_[_0xb7b9('0x43')](_0x510d23['query']);_0x3aa885[_0xb7b9('0x44')]=_[_0xb7b9('0x45')](_0x3aa885['model'],_0x3aa885['query']);_0xdd2904[_0xb7b9('0x46')]=_[_0xb7b9('0x45')](_0x3aa885[_0xb7b9('0x42')],qs[_0xb7b9('0x47')](_0x510d23[_0xb7b9('0x48')][_0xb7b9('0x47')]));_0xdd2904[_0xb7b9('0x46')]=_0xdd2904[_0xb7b9('0x46')][_0xb7b9('0x49')]?_0xdd2904['attributes']:_0x3aa885[_0xb7b9('0x42')];if(!_0x510d23[_0xb7b9('0x48')][_0xb7b9('0x4a')](_0xb7b9('0x4b'))){_0xdd2904['limit']=qs[_0xb7b9('0x30')](_0x510d23[_0xb7b9('0x48')][_0xb7b9('0x30')]);_0xdd2904[_0xb7b9('0x2f')]=qs['offset'](_0x510d23['query'][_0xb7b9('0x2f')]);}_0xdd2904[_0xb7b9('0x4c')]=qs[_0xb7b9('0x4d')](_0x510d23[_0xb7b9('0x48')][_0xb7b9('0x4d')]);_0xdd2904[_0xb7b9('0x4e')]=qs[_0xb7b9('0x44')](_[_0xb7b9('0x4f')](_0x510d23[_0xb7b9('0x48')],_0x3aa885['filters']),_0x469262);var _0x5353f6=[];var _0x31d128=squel[_0xb7b9('0x50')]()[_0xb7b9('0x51')]('id')[_0xb7b9('0x51')](_0xb7b9('0x37'))['field']('color')[_0xb7b9('0x52')](_0xb7b9('0x53'));var _0x50bbcd=squel[_0xb7b9('0x50')]()['field']('u.id')['field']('u.fullname')[_0xb7b9('0x51')](_0xb7b9('0x54'))[_0xb7b9('0x52')]('user_has_chat_interactions','ui')['left_join']('users','u',_0xb7b9('0x55'));var _0x3e9e3b=squel[_0xb7b9('0x50')]()[_0xb7b9('0x52')](_0xb7b9('0x56'),'i')['left_join'](_0xb7b9('0x57'),'c',_0xb7b9('0x58'))[_0xb7b9('0x59')](_0xb7b9('0x5a'),'o',_0xb7b9('0x5b'))['left_join'](_0xb7b9('0x5c'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0xb7b9('0x59')](_0xb7b9('0x5d'),'me',_0xb7b9('0x5e'))[_0xb7b9('0x59')](_0xb7b9('0x5f'),'it',_0xb7b9('0x60'))[_0xb7b9('0x59')](_0xb7b9('0x53'),'t','t.id\x20=\x20it.TagId');var _0xcbcad7=squel[_0xb7b9('0x61')]();var _0x56abb8=[];var _0x4aec12=squel[_0xb7b9('0x61')]();var _0x1b8eb6;if(_0x510d23[_0xb7b9('0x48')]['search']){_0x1b8eb6=as[_0xb7b9('0x62')](_0x510d23[_0xb7b9('0x48')][_0xb7b9('0x63')]);var _0x344028=_0x1b8eb6['sqlOperator'];for(var _0x4ea755=0x0;_0x4ea755<_0x1b8eb6[_0xb7b9('0x64')][_0xb7b9('0x49')];_0x4ea755++){var _0x441135=_0x1b8eb6[_0xb7b9('0x64')][_0x4ea755];var _0x22d024='i';var _0x3226ba=_[_0xb7b9('0x65')](_0x469262,[_0xb7b9('0x37'),_0x441135[_0xb7b9('0x51')]]);if(!_0x3226ba){switch(_0x441135[_0xb7b9('0x51')]){case _0xb7b9('0x66'):if(_0x441135[_0xb7b9('0x67')]==0x1){_0x3e9e3b[_0xb7b9('0x68')]('`'+_0x441135[_0xb7b9('0x51')]+_0xb7b9('0x69'));}else{_0x3e9e3b[_0xb7b9('0x68')]('`'+_0x441135['field']+_0xb7b9('0x6a'));}break;case'Contact':if(_0x441135[_0xb7b9('0x6b')]===_0xb7b9('0x6c')){if(_0x441135[_0xb7b9('0x67')]['split']('\x20')[_0xb7b9('0x49')]>0x1){_0xcbcad7[_0x344028](_0xb7b9('0x6d'),qs[_0xb7b9('0x6e')](_0x441135[_0xb7b9('0x67')]),null);}else{var _0x581dc7='%'+_0x441135[_0xb7b9('0x67')]+'%';_0xcbcad7[_0x344028](_0xb7b9('0x6f'),_0x581dc7,_0x581dc7,_0x581dc7);}}else{_0x3226ba=_['find'](_0x469262,[_0xb7b9('0x37'),'ContactId']);_0x441135[_0xb7b9('0x51')]=_0xb7b9('0x70');_0x1ed388=as[_0xb7b9('0x71')](_0x22d024,_0x3226ba[_0xb7b9('0x40')],_0x441135);_0xcbcad7[_0x344028](_0x1ed388[_0xb7b9('0x72')],_0x1ed388[_0xb7b9('0x67')][_0xb7b9('0x73')],_0x1ed388['value'][_0xb7b9('0x2c')]);}break;case'Tag':var _0x2ba668=_0x441135[_0xb7b9('0x67')][_0xb7b9('0x3c')](',')[_0xb7b9('0x39')](function(_0x367bb7){return Number(_0x367bb7);});_0x2ba668[_0xb7b9('0x3d')](function(_0x58583c){_0x4aec12['or'](_0xb7b9('0x74'),'%,'+_0x58583c+',%');});_0x56abb8=_[_0xb7b9('0x75')](_0x56abb8,_0x2ba668);break;case'User':if(_0x441135[_0xb7b9('0x6b')]===_0xb7b9('0x6c')){_0xcbcad7[_0x344028](_0xb7b9('0x76'),'%'+_0x441135[_0xb7b9('0x67')]+'%',null);}else{_0x3226ba=_[_0xb7b9('0x65')](_0x469262,[_0xb7b9('0x37'),_0xb7b9('0x77')]);_0x441135[_0xb7b9('0x51')]=_0xb7b9('0x77');_0x1ed388=as[_0xb7b9('0x71')](_0x22d024,_0x3226ba[_0xb7b9('0x40')],_0x441135);_0xcbcad7[_0x344028](_0x1ed388[_0xb7b9('0x72')],_0x1ed388[_0xb7b9('0x67')][_0xb7b9('0x73')],_0x1ed388[_0xb7b9('0x67')][_0xb7b9('0x2c')]);}break;case _0xb7b9('0x78'):_0x1ed388=as['buildExpression']('me',null,_0x441135);_0xcbcad7[_0x344028](_0x1ed388[_0xb7b9('0x72')],_0x1ed388[_0xb7b9('0x67')]['start'],_0x1ed388['value']['end']);break;}}else{var _0x1ed388=as[_0xb7b9('0x71')](_0x22d024,_0x3226ba[_0xb7b9('0x40')],_0x441135);_0xcbcad7[_0x344028](_0x1ed388['text'],_0x1ed388['value'][_0xb7b9('0x73')],_0x1ed388[_0xb7b9('0x67')][_0xb7b9('0x2c')]);}}}else{var _0x30a09c=_(_0x510d23[_0xb7b9('0x48')])[_0xb7b9('0x43')]()['map'](function(_0x48cee9){return _[_0xb7b9('0x79')](_0x469262,[_0xb7b9('0x37'),_0x48cee9])?_0x48cee9:undefined;})[_0xb7b9('0x7a')]()[_0xb7b9('0x67')]();if(!_[_0xb7b9('0x7b')](_0x30a09c)){_0x30a09c[_0xb7b9('0x3d')](function(_0x43d728){if(_0x43d728===_0xb7b9('0x7c')){_0x3e9e3b['where']('i.ChatWebsiteId\x20IN\x20?',[][_0xb7b9('0x7d')](_0x510d23[_0xb7b9('0x48')][_0x43d728]));}else if(_0x43d728===_0xb7b9('0x7e')){var _0xbaf494=JSON['parse'](_0x510d23[_0xb7b9('0x48')][_0x43d728])[_0xb7b9('0x7f')];var _0x220ada=JSON[_0xb7b9('0x80')](_0x510d23[_0xb7b9('0x48')][_0x43d728])[_0xb7b9('0x81')];_0x3e9e3b[_0xb7b9('0x4e')](_0xb7b9('0x82'),_0xbaf494,_0x220ada);}else{if(_0x510d23['query'][_0x43d728]==='null'){_0x3e9e3b[_0xb7b9('0x4e')]('i.'+_0x43d728+_0xb7b9('0x83'));}else{_0x3e9e3b[_0xb7b9('0x4e')]('i.'+_0x43d728+_0xb7b9('0x84'),_0x510d23['query'][_0x43d728]);}}});}if(_0x510d23[_0xb7b9('0x48')][_0xb7b9('0x85')]){if(_0x510d23[_0xb7b9('0x48')][_0xb7b9('0x85')]==0x1){_0x3e9e3b[_0xb7b9('0x68')](_0xb7b9('0x86'));}else{_0x3e9e3b[_0xb7b9('0x68')](_0xb7b9('0x87'));}}if(_0x510d23[_0xb7b9('0x48')][_0xb7b9('0x88')]){_0x56abb8=_[_0xb7b9('0x89')](_0x510d23[_0xb7b9('0x48')][_0xb7b9('0x88')])?_0x510d23[_0xb7b9('0x48')][_0xb7b9('0x88')]:new Array(_0x510d23[_0xb7b9('0x48')]['tag']);_0x56abb8[_0xb7b9('0x3d')](function(_0x23fde7){_0x4aec12['or'](_0xb7b9('0x74'),'%,'+_0x23fde7+',%');});}if(_0x510d23['query'][_0xb7b9('0x8a')]){var _0x44d750=_0x510d23[_0xb7b9('0x48')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x44d750)){_0xcbcad7['or']('i.id\x20LIKE\x20?',_0x44d750+'%');}else{_0xcbcad7['or'](_0xb7b9('0x8b'),qs['getFullTextValue'](_0x44d750))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x44d750+'%');}}}_0x3e9e3b[_0xb7b9('0x4e')](_0xcbcad7);_0x3e9e3b[_0xb7b9('0x8c')](_0xb7b9('0x8d'));var _0x4fbf65={'type':db[_0xb7b9('0x8e')][_0xb7b9('0x8f')][_0xb7b9('0x90')],'raw':!![]};var _0x55c55b=_0x3e9e3b[_0xb7b9('0x91')]();_0x55c55b[_0xb7b9('0x51')](_0xb7b9('0x8d'));_0x55c55b[_0xb7b9('0x51')](_0xb7b9('0x92'),_0xb7b9('0x66'));if(_0xdd2904[_0xb7b9('0x4c')]){_0xdd2904['order'][_0xb7b9('0x3d')](function(_0x4a514a){var _0x196670=_0x4a514a[0x0]===_0xb7b9('0x93')?_0x4a514a[0x0]:'i.'+_0x4a514a[0x0];_0x3e9e3b[_0xb7b9('0x4c')](_0x196670,_0x4a514a[0x1]===_0xb7b9('0x94')?![]:!![]);});}if(!_[_0xb7b9('0x7b')](_0x56abb8)){_0x3e9e3b[_0xb7b9('0x68')](_0x4aec12);_0x55c55b[_0xb7b9('0x4e')]('t.id\x20IN\x20?',_0x56abb8);}BPromise['resolve']()[_0xb7b9('0x21')](function(){if(!_0x1b8eb6){if(_0x510d23[_0xb7b9('0x48')]['ChatWebsiteId'])return;_0x55c55b['where'](_0xb7b9('0x95'));_0x3e9e3b[_0xb7b9('0x4e')](_0xb7b9('0x95'));return;}if(_0x510d23[_0xb7b9('0x96')][_0xb7b9('0x97')]!=='agent')return;return _0x510d23[_0xb7b9('0x96')][_0xb7b9('0x98')]({'attributes':['id'],'raw':!![]})[_0xb7b9('0x21')](function(_0x6c8964){if(_[_0xb7b9('0x7b')](_0x6c8964)){_0x55c55b['where'](_0xb7b9('0x99'));_0x3e9e3b[_0xb7b9('0x4e')](_0xb7b9('0x99'));}else{_0x55c55b[_0xb7b9('0x4e')]('i.ChatWebsiteId\x20IN\x20?',_[_0xb7b9('0x39')](_0x6c8964,'id'));_0x3e9e3b[_0xb7b9('0x4e')](_0xb7b9('0x9a'),_[_0xb7b9('0x39')](_0x6c8964,'id'));}});})[_0xb7b9('0x21')](function(){if(_0x510d23['user'][_0xb7b9('0x97')]===_0xb7b9('0x9b')&&!_0x1b8eb6&&!_0x510d23['query'][_0xb7b9('0x7c')])return[];return db['sequelize'][_0xb7b9('0x48')](_0x55c55b[_0xb7b9('0x9c')](),_0x4fbf65);})[_0xb7b9('0x21')](function(_0x29ca56){_0x24b1a6[_0xb7b9('0x2e')]=_0x29ca56[_0xb7b9('0x49')];if(_0x24b1a6[_0xb7b9('0x2e')]===0x0)return[];return db['sequelize'][_0xb7b9('0x48')](_0x31d128['toString'](),_0x4fbf65)[_0xb7b9('0x21')](function(_0x109a37){_0x5353f6=_[_0xb7b9('0x9d')](_0x109a37,'id');_0x4fbf65=_[_0xb7b9('0x9e')](_0x4fbf65,{'model':db[_0xb7b9('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x510d23[_0xb7b9('0x48')][_0xb7b9('0x47')]){_0xdd2904['attributes'][_0xb7b9('0x3d')](function(_0x5e7ef1){_0x3e9e3b[_0xb7b9('0x51')]('i.'+_0x5e7ef1);});}else{_0x3e9e3b[_0xb7b9('0x51')](_0xb7b9('0x92'),'unreadMessages');_0x3e9e3b['field'](_0xb7b9('0x9f'),'Account.key');_0x3e9e3b['field'](_0xb7b9('0xa0'),_0xb7b9('0xa1'));_0x3e9e3b['field'](_0xb7b9('0xa2'),'contactName');_0x3e9e3b[_0xb7b9('0x51')](_0xb7b9('0xa3'));_0x3e9e3b[_0xb7b9('0x51')](_0xb7b9('0xa4'),'Contact.firstName');_0x3e9e3b[_0xb7b9('0x51')](_0xb7b9('0xa5'),_0xb7b9('0xa6'));_0x3e9e3b[_0xb7b9('0x51')](_0xb7b9('0xa7'),_0xb7b9('0xa8'));_0x3e9e3b[_0xb7b9('0x51')](_0xb7b9('0xa9'),_0xb7b9('0xaa'));_0x3e9e3b['field'](_0xb7b9('0xab'),'Contact.mobile');_0x3e9e3b[_0xb7b9('0x51')](_0xb7b9('0xac'),'Contact.fax');_0x3e9e3b[_0xb7b9('0x51')](_0xb7b9('0xad'),'Owner.fullname');_0x3e9e3b[_0xb7b9('0x51')](_0xb7b9('0xae'),_0xb7b9('0xaf'));_0x3e9e3b[_0xb7b9('0x51')](_0xb7b9('0xb0'),'TagIds');}if(_0xdd2904[_0xb7b9('0x30')])_0x3e9e3b[_0xb7b9('0x30')](_0xdd2904[_0xb7b9('0x30')]);if(_0xdd2904[_0xb7b9('0x2f')])_0x3e9e3b['offset'](_0xdd2904[_0xb7b9('0x2f')]);return db[_0xb7b9('0xb1')][_0xb7b9('0x48')](_0x3e9e3b[_0xb7b9('0x9c')](),_0x4fbf65);})[_0xb7b9('0x21')](function(_0x379a19){_0x50bbcd[_0xb7b9('0x4e')](_0xb7b9('0xb2'),_[_0xb7b9('0x39')](_0x379a19,'id'));return db[_0xb7b9('0xb1')][_0xb7b9('0x48')](_0x50bbcd[_0xb7b9('0x9c')](),_0x4fbf65)[_0xb7b9('0x21')](function(_0x4da065){var _0x563bf1=_[_0xb7b9('0xb3')](_0x4da065,_0xb7b9('0xb4'));var _0x297f32=[];_0x379a19[_0xb7b9('0x3d')](function(_0x2ac748){_0x297f32[_0xb7b9('0xb5')](updateChatInteraction(_0x2ac748,_0x5353f6,_0x563bf1));});return BPromise[_0xb7b9('0xb6')](_0x297f32);});});})[_0xb7b9('0x21')](function(_0x1d4314){_0x24b1a6[_0xb7b9('0xb7')]=_0x1d4314;return _0x24b1a6;})[_0xb7b9('0x21')](respondWithFilteredResult(_0x130bdd,_0xdd2904))[_0xb7b9('0xb8')](handleError(_0x130bdd,null));};exports['show']=function(_0x37608b,_0x32e73d){var _0x915fee={'raw':![],'where':{'id':_0x37608b[_0xb7b9('0xb9')]['id']}},_0x9959a6={};_0x9959a6[_0xb7b9('0x42')]=_[_0xb7b9('0x43')](db['ChatInteraction'][_0xb7b9('0xba')]);_0x9959a6['query']=_[_0xb7b9('0x43')](_0x37608b[_0xb7b9('0x48')]);_0x9959a6[_0xb7b9('0x44')]=_[_0xb7b9('0x45')](_0x9959a6[_0xb7b9('0x42')],_0x9959a6[_0xb7b9('0x48')]);_0x915fee[_0xb7b9('0x46')]=_[_0xb7b9('0x45')](_0x9959a6[_0xb7b9('0x42')],qs['fields'](_0x37608b[_0xb7b9('0x48')][_0xb7b9('0x47')]));_0x915fee[_0xb7b9('0x46')]=_0x915fee[_0xb7b9('0x46')][_0xb7b9('0x49')]?_0x915fee[_0xb7b9('0x46')]:_0x9959a6['model'];if(_0x37608b[_0xb7b9('0x48')][_0xb7b9('0xbb')]){_0x915fee['include']=[{'all':!![]}];}_0x915fee=_[_0xb7b9('0x9e')]({},_0x915fee,_0x37608b['options']);return db['ChatInteraction'][_0xb7b9('0x65')](_0x915fee)[_0xb7b9('0x21')](handleEntityNotFound(_0x32e73d,null))['then'](respondWithResult(_0x32e73d,null))[_0xb7b9('0xb8')](handleError(_0x32e73d,null));};exports[_0xb7b9('0xbc')]=function(_0x5cddff,_0x4f20a1){return db[_0xb7b9('0x3f')][_0xb7b9('0xbc')](_0x5cddff[_0xb7b9('0x78')],{})['then'](respondWithResult(_0x4f20a1,0xc9))['catch'](handleError(_0x4f20a1,null));};exports['update']=function(_0x1b7599,_0x57ea46){if(_0x1b7599[_0xb7b9('0x78')]['id']){delete _0x1b7599['body']['id'];}return db['ChatInteraction'][_0xb7b9('0x65')]({'where':{'id':_0x1b7599[_0xb7b9('0xb9')]['id']}})[_0xb7b9('0x21')](handleEntityNotFound(_0x57ea46,null))['then'](saveUpdates(_0x1b7599['body'],null))[_0xb7b9('0x21')](respondWithResult(_0x57ea46,null))[_0xb7b9('0xb8')](handleError(_0x57ea46,null));};exports[_0xb7b9('0x36')]=function(_0x365f77,_0x278e5e){return db[_0xb7b9('0x3f')][_0xb7b9('0x65')]({'where':{'id':_0x365f77[_0xb7b9('0xb9')]['id']}})['then'](handleEntityNotFound(_0x278e5e,null))[_0xb7b9('0x21')](removeEntity(_0x278e5e,null))['catch'](handleError(_0x278e5e,null));};exports[_0xb7b9('0xbd')]=function(_0x17c1c7,_0x3d1c36){return db[_0xb7b9('0x3f')]['describe']()[_0xb7b9('0x21')](respondWithResult(_0x3d1c36,null))[_0xb7b9('0xb8')](handleError(_0x3d1c36,null));};exports[_0xb7b9('0xbe')]=function(_0x5468ed,_0x584488){var _0x24aded=_0x5468ed[_0xb7b9('0xb9')]['id'];var _0x3c81f9;var _0x1d3a80;var _0x43ebe8;return db[_0xb7b9('0x3f')][_0xb7b9('0xbf')]({'where':{'id':_0x24aded}})['then'](function(_0x1d3bde){_0x3c81f9=_0x1d3bde;return db[_0xb7b9('0xc0')][_0xb7b9('0xbf')]({'where':{'id':_0x1d3bde[_0xb7b9('0x7c')]},'attributes':['id','vidaooApiKey',_0xb7b9('0xc1')],'raw':!![]});})[_0xb7b9('0x21')](function(_0x2be553){if(_0x2be553&&_0x2be553[_0xb7b9('0xc2')]&&_0x2be553[_0xb7b9('0xc1')]){_0x1d3a80=_0x2be553;var _0x50cc93={'rejectUnauthorized':![],'method':'POST','uri':_0xb7b9('0xc3'),'headers':{'X-APIKEY':_0x2be553[_0xb7b9('0xc2')]},'body':{'name':_0xb7b9('0xc4')+_0x24aded},'redirect':_0xb7b9('0xc5'),'json':!![]};return rp(_0x50cc93);}else{throw new db['Sequelize'][(_0xb7b9('0xc6'))](_0xb7b9('0xc7'));}})[_0xb7b9('0x21')](function(_0x1de39f){_0x43ebe8=_0x1de39f;if(_0x43ebe8['id']){var _0x5576fb={'body':_0x43ebe8[_0xb7b9('0xc8')],'ChatWebsiteId':_0x1d3a80['id'],'ChatInteractionId':_0x3c81f9['id'],'direction':'out','UserId':_0x5468ed['user']['id']};return db[_0xb7b9('0xc9')][_0xb7b9('0xbc')](_0x5576fb,{});}else{throw new db[(_0xb7b9('0x8e'))]['ValidationError'](_0xb7b9('0xca'));}})[_0xb7b9('0x21')](function(){return _0x3c81f9['updateAttributes']({'vidaooSessionId':_0x43ebe8['id']});})[_0xb7b9('0x21')](respondWithResult(_0x584488,null))[_0xb7b9('0xb8')](handleError(_0x584488,null));};exports[_0xb7b9('0xcb')]=function(_0x22cc50,_0xfe8ce){if(_0x22cc50[_0xb7b9('0x78')]['id']){delete _0x22cc50[_0xb7b9('0x78')]['id'];}return db[_0xb7b9('0x3f')][_0xb7b9('0x65')]({'where':{'id':_0x22cc50[_0xb7b9('0xb9')]['id']},'include':[{'model':db[_0xb7b9('0xcc')],'as':_0xb7b9('0xcd')}]})[_0xb7b9('0x21')](handleEntityNotFound(_0xfe8ce,null))[_0xb7b9('0x21')](saveUpdates(_0x22cc50['body'],null))[_0xb7b9('0x21')](respondWithResult(_0xfe8ce,null))[_0xb7b9('0xb8')](handleError(_0xfe8ce,null));};exports[_0xb7b9('0xce')]=function(_0x43ae2b,_0x447cf8,_0x4c411a){if(_0x43ae2b[_0xb7b9('0x78')]['id']){delete _0x43ae2b[_0xb7b9('0x78')]['id'];}return db[_0xb7b9('0x3f')]['find']({'where':{'id':_0x43ae2b[_0xb7b9('0xb9')]['id']}})[_0xb7b9('0x21')](function(_0x1fc065){if(!_0x1fc065){logger['error'](_0xb7b9('0xcf'),'abandon',0x194,_0xb7b9('0xd0'));_0x447cf8[_0xb7b9('0x2a')](0x194);}else{if(_0x1fc065[_0xb7b9('0x77')]){throw new db[(_0xb7b9('0x8e'))][(_0xb7b9('0xc6'))]('Interaction\x20already\x20assigned');}}return _0x1fc065;})['then'](function(_0x185ea3){if(_0x185ea3){return _0x185ea3[_0xb7b9('0x35')]({'closed':_0x43ae2b[_0xb7b9('0x78')][_0xb7b9('0xd1')],'disposition':_0x43ae2b[_0xb7b9('0x78')]['disposition']})[_0xb7b9('0x21')](function(_0x9a5f5e){return _0x9a5f5e;});}})['then'](function(_0x5dd6c5){return respondWithRpcPromise(_0xb7b9('0xd2'),'abandon',_0x43ae2b[_0xb7b9('0x78')],client9004);})[_0xb7b9('0x21')](respondWithResult(_0x447cf8,null))['catch'](handleError(_0x447cf8,null));};exports[_0xb7b9('0xd3')]=function(_0x3bcaf0,_0x358ca3,_0x2b253d){_0x3bcaf0['body']['name']=_0x3bcaf0[_0xb7b9('0xd4')][_0xb7b9('0xd5')];_0x3bcaf0[_0xb7b9('0x78')][_0xb7b9('0xd6')]=_0x3bcaf0[_0xb7b9('0xd4')][_0xb7b9('0xd7')];_0x3bcaf0[_0xb7b9('0x78')][_0xb7b9('0x40')]=_0x3bcaf0[_0xb7b9('0xd4')]['mimetype'];return db[_0xb7b9('0xd8')]['create'](_0x3bcaf0[_0xb7b9('0x78')])[_0xb7b9('0x21')](respondWithResult(_0x358ca3,0xc9))['catch'](handleError(_0x358ca3,null));};exports[_0xb7b9('0xd9')]=function(_0x47e00f,_0x38840b,_0x1db73e){return db[_0xb7b9('0x3f')][_0xb7b9('0xbf')]({'where':{'id':_0x47e00f[_0xb7b9('0xb9')]['id']},'raw':!![]})[_0xb7b9('0x21')](handleEntityNotFound(_0x38840b,null))[_0xb7b9('0x21')](function(_0x3eccdf){if(_0x3eccdf){if(_0x3eccdf['closed']){return _0x38840b[_0xb7b9('0x2b')](0x193)[_0xb7b9('0x2d')]({'status':0x193,'message':_0xb7b9('0xda')});}return db[_0xb7b9('0xd8')][_0xb7b9('0xbf')]({'where':{'id':_0x47e00f[_0xb7b9('0x48')][_0xb7b9('0xdb')]},'raw':!![]})['then'](handleEntityNotFound(_0x38840b,null));}})['then'](function(_0x3c2615){if(_0x3c2615){return _0x38840b['download'](path['join'](config[_0xb7b9('0xdc')],_0xb7b9('0xdd'),_0x3c2615[_0xb7b9('0xd6')]));}})[_0xb7b9('0xb8')](handleError(_0x38840b,null));};exports['close']=function(_0x3c6bda,_0x3ea57d){var _0x2ec1ec=null;var _0x576df7=null;var _0x1efa02=null;var _0x455c21=null;if(_0x3c6bda[_0xb7b9('0x78')]['id']){delete _0x3c6bda[_0xb7b9('0x78')]['id'];}if(_0x3c6bda[_0xb7b9('0x78')][_0xb7b9('0xde')]){_0x455c21=path['join'](config[_0xb7b9('0xdc')],_0xb7b9('0xdf'),util[_0xb7b9('0xe0')](_0xb7b9('0xe1'),Date[_0xb7b9('0xe2')]()));_0x3c6bda[_0xb7b9('0x78')][_0xb7b9('0xe3')]=_0x455c21;}return db[_0xb7b9('0x3f')][_0xb7b9('0x65')]({'where':{'id':_0x3c6bda['params']['id']},'include':[{'model':db[_0xb7b9('0xc9')],'as':_0xb7b9('0xe4'),'include':[{'model':db[_0xb7b9('0xe5')],'as':'User'}]}]})[_0xb7b9('0x21')](handleEntityNotFound(_0x3ea57d,null))[_0xb7b9('0x21')](saveUpdates(_0x3c6bda['body'],null))[_0xb7b9('0x21')](function(_0x94c946){if(_0x94c946){_0x2ec1ec=_0x94c946;return db[_0xb7b9('0xc0')]['find']({'where':{'id':_0x2ec1ec[_0xb7b9('0x7c')]}});}})['then'](function(_0x45c949){if(_0x45c949){_0x1efa02=_0x45c949;return db[_0xb7b9('0xcc')]['find']({'where':{'id':_0x2ec1ec[_0xb7b9('0x70')]}});}})[_0xb7b9('0x21')](function(_0x24c0b4){if(_0x24c0b4){_0x576df7=_0x24c0b4;if(_0x455c21){var _0x377bed=null;for(var _0x24f700=0x1;_0x24f700<_0x2ec1ec[_0xb7b9('0xe4')]['length'];++_0x24f700){_0x377bed=_0x2ec1ec[_0xb7b9('0xe4')][_0x24f700];var _0x2e391e=_0x377bed[_0xb7b9('0x77')]?util[_0xb7b9('0xe0')](_0xb7b9('0xe6'),_0x1efa02['agentAlias'],_0x377bed['UserId']):_0xb7b9('0xe7');var _0x35641d=_0x3c6bda[_0xb7b9('0x78')][_0xb7b9('0xe8')]||util[_0xb7b9('0xe0')](_0xb7b9('0xe6'),_0xb7b9('0xe9'),_0x377bed[_0xb7b9('0x70')]);switch(_0x1efa02[_0xb7b9('0xea')]){case _0xb7b9('0xeb'):_0x2e391e=_0x377bed[_0xb7b9('0x77')]?util['format'](_0xb7b9('0xe6'),_0x1efa02[_0xb7b9('0xec')],_0x377bed[_0xb7b9('0x77')]):'System';break;case _0xb7b9('0xed'):_0x2e391e=_0x377bed[_0xb7b9('0x77')]?_0x377bed['User'][_0xb7b9('0xee')]||_0x377bed[_0xb7b9('0xe5')][_0xb7b9('0xef')]:_0xb7b9('0xe7');break;case _0xb7b9('0xf0'):_0x2e391e=_0x377bed[_0xb7b9('0x77')]?_0x377bed['User'][_0xb7b9('0xef')]:_0xb7b9('0xe7');break;default:_0x2e391e=_0x377bed[_0xb7b9('0x77')]?util[_0xb7b9('0xe0')](_0xb7b9('0xe6'),_0x1efa02[_0xb7b9('0xec')],_0x377bed[_0xb7b9('0x77')]):_0xb7b9('0xe7');}var _0x343f87=util['format'](_0xb7b9('0xf1'),moment(_0x377bed[_0xb7b9('0x7e')])[_0xb7b9('0xe0')](_0xb7b9('0xf2')),_0x377bed[_0xb7b9('0xf3')]==='in'?_0x35641d:_0x2e391e,_0x377bed['body']);if(!_0x377bed[_0xb7b9('0xf4')]){fs['appendFileSync'](_0x455c21,_0x343f87);}}return db[_0xb7b9('0xf5')][_0xb7b9('0xbf')]({'where':{'service':!![]},'include':[{'model':db[_0xb7b9('0xf6')],'as':_0xb7b9('0xf7'),'raw':!![]}]});}}})[_0xb7b9('0x21')](function(_0x347286){if(_0x347286&&_0x347286[_0xb7b9('0xf7')]&&_0x3c6bda[_0xb7b9('0x78')]){var _0x5d054c={'tls':{'rejectUnauthorized':![]}};if(_0x347286[_0xb7b9('0xf7')][_0xb7b9('0xf8')]){_0x5d054c[_0xb7b9('0xf8')]=_0x347286['Smtp']['service'];}else{_0x5d054c['host']=_0x347286[_0xb7b9('0xf7')][_0xb7b9('0xf9')];_0x5d054c[_0xb7b9('0xfa')]=_0x347286['Smtp'][_0xb7b9('0xfa')];_0x5d054c[_0xb7b9('0xfb')]=_0x347286['Smtp'][_0xb7b9('0xfb')];}if(_0x347286[_0xb7b9('0xf7')]['authentication']){_0x5d054c[_0xb7b9('0xfc')]={'user':_0x347286[_0xb7b9('0xf7')][_0xb7b9('0x96')],'pass':_0x347286[_0xb7b9('0xf7')][_0xb7b9('0xfd')]};}return respondWithRpcPromise('SendMail',_0xb7b9('0xfe'),{'account':_0x5d054c,'message':{'from':util[_0xb7b9('0xe0')]('\x22%s\x22\x20<%s>',_0x347286[_0xb7b9('0x37')],_0x347286[_0xb7b9('0xff')]||_0x347286['Smtp'][_0xb7b9('0x96')]),'to':_0x3c6bda[_0xb7b9('0x78')]['mailTranscript'],'subject':_0xb7b9('0x100'),'text':util[_0xb7b9('0xe0')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x3c6bda['body']['mailTranscript']),'attachments':[{'path':_0x455c21}]}})[_0xb7b9('0x21')](function(){return _0x2ec1ec;})['catch'](function(_0x5396de){console['error'](_0x5396de);});}else{return _0x2ec1ec;}})[_0xb7b9('0x21')](respondWithStatusCode(_0x3ea57d,0xc8))['catch'](handleError(_0x3ea57d,null));};exports[_0xb7b9('0x101')]=function(_0x489950,_0x419195,_0x33d842){return db['ChatMessage'][_0xb7b9('0x65')]({'where':{'id':_0x489950[_0xb7b9('0xb9')]['id']}})[_0xb7b9('0x21')](handleEntityNotFound(_0x419195,null))[_0xb7b9('0x21')](function(_0x210eac){if(_0x210eac){return _0x210eac[_0xb7b9('0x101')](_0x489950[_0xb7b9('0x78')][_0xb7b9('0x102')],_[_0xb7b9('0x103')](_0x489950[_0xb7b9('0x78')],[_0xb7b9('0x102'),'id'])||{});}})[_0xb7b9('0x21')](respondWithResult(_0x419195,null))[_0xb7b9('0xb8')](handleError(_0x419195,null));};exports[_0xb7b9('0x104')]=function(_0x249921,_0x54db24,_0x25caad){var _0x113046={'raw':![],'where':{}};var _0x297f73={};var _0x3a38d7={'count':0x0,'rows':[]};return db[_0xb7b9('0x3f')][_0xb7b9('0xbf')]({'where':{'id':_0x249921[_0xb7b9('0xb9')]['id']}})[_0xb7b9('0x21')](handleEntityNotFound(_0x54db24,null))[_0xb7b9('0x21')](function(_0x206d08){if(_0x206d08){_0x297f73['model']=_[_0xb7b9('0x43')](db[_0xb7b9('0xc9')][_0xb7b9('0xba')]);_0x297f73[_0xb7b9('0x48')]=_[_0xb7b9('0x43')](_0x249921[_0xb7b9('0x48')]);_0x297f73[_0xb7b9('0x44')]=_[_0xb7b9('0x45')](_0x297f73[_0xb7b9('0x42')],_0x297f73[_0xb7b9('0x48')]);_0x113046[_0xb7b9('0x46')]=_['intersection'](_0x297f73[_0xb7b9('0x42')],qs[_0xb7b9('0x47')](_0x249921[_0xb7b9('0x48')][_0xb7b9('0x47')]));_0x113046[_0xb7b9('0x46')]=_0x113046[_0xb7b9('0x46')][_0xb7b9('0x49')]?_0x113046['attributes']:_0x297f73[_0xb7b9('0x42')];if(!_0x249921[_0xb7b9('0x48')]['hasOwnProperty'](_0xb7b9('0x4b'))){_0x113046['limit']=qs[_0xb7b9('0x30')](_0x249921[_0xb7b9('0x48')][_0xb7b9('0x30')]);_0x113046[_0xb7b9('0x2f')]=qs[_0xb7b9('0x2f')](_0x249921[_0xb7b9('0x48')][_0xb7b9('0x2f')]);}_0x113046['order']=qs[_0xb7b9('0x4d')](_0x249921[_0xb7b9('0x48')][_0xb7b9('0x4d')]);_0x113046[_0xb7b9('0x4e')]=qs[_0xb7b9('0x44')](_[_0xb7b9('0x4f')](_0x249921[_0xb7b9('0x48')],_0x297f73[_0xb7b9('0x44')]));_0x113046[_0xb7b9('0x4e')]['ChatInteractionId']=_0x206d08['id'];if(_0x249921[_0xb7b9('0x48')]['filter']){_0x113046[_0xb7b9('0x4e')]=_['merge'](_0x113046[_0xb7b9('0x4e')],{'$or':_[_0xb7b9('0x39')](_0x113046['attributes'],function(_0x2061a2){var _0x521448={};_0x521448[_0x2061a2]={'$like':'%'+_0x249921[_0xb7b9('0x48')][_0xb7b9('0x8a')]+'%'};return _0x521448;})});}if(_0x249921[_0xb7b9('0x48')]['$gte']){var _0x3be188=_0x249921[_0xb7b9('0x48')][_0xb7b9('0x7f')][_0xb7b9('0x3c')](',');var _0x57999f={};_0x57999f[_0x3be188[0x0]]={'$gte':moment(_0x3be188[0x1])[_0xb7b9('0xe0')](_0xb7b9('0x105'))};_0x113046['where']=_[_0xb7b9('0x9e')](_0x113046[_0xb7b9('0x4e')],_0x57999f);}_0x113046=_[_0xb7b9('0x9e')]({},_0x113046,_0x249921['options']);return db[_0xb7b9('0xc9')][_0xb7b9('0x2e')]({'where':_0x113046[_0xb7b9('0x4e')]})[_0xb7b9('0x21')](function(_0x2549e7){_0x3a38d7['count']=_0x2549e7;if(_0x249921[_0xb7b9('0x48')][_0xb7b9('0xbb')]){_0x113046[_0xb7b9('0x106')]=[{'all':!![]}];}return db[_0xb7b9('0xc9')][_0xb7b9('0x107')](_0x113046);})['then'](function(_0x25720e){_0x3a38d7['rows']=_0x25720e;return _0x3a38d7;});}})[_0xb7b9('0x21')](respondWithFilteredResult(_0x54db24,_0x113046))['catch'](handleError(_0x54db24,null));};exports['getMyMessages']=function(_0x843c1a,_0x461f95,_0x399f96){var _0x2edd50={'where':{}},_0x3891d9={},_0x4ac3ff={'count':0x0,'rows':[]};return db[_0xb7b9('0x3f')][_0xb7b9('0xbf')]({'where':{'id':_0x843c1a['params']['id']}})[_0xb7b9('0x21')](handleEntityNotFound(_0x461f95,null))[_0xb7b9('0x21')](function(_0xe6dc0e){if(_0xe6dc0e){_0x3891d9[_0xb7b9('0x42')]=_[_0xb7b9('0x43')](db[_0xb7b9('0xc9')][_0xb7b9('0xba')]);_0x3891d9[_0xb7b9('0x48')]=_[_0xb7b9('0x43')](_0x843c1a[_0xb7b9('0x48')]);_0x3891d9[_0xb7b9('0x44')]=_[_0xb7b9('0x45')](_0x3891d9['model'],_0x3891d9[_0xb7b9('0x48')]);_0x2edd50['attributes']=_['intersection'](_0x3891d9['model'],qs[_0xb7b9('0x47')](_0x843c1a[_0xb7b9('0x48')][_0xb7b9('0x47')]));_0x2edd50[_0xb7b9('0x46')]=_0x2edd50[_0xb7b9('0x46')]['length']?_0x2edd50[_0xb7b9('0x46')]:_0x3891d9[_0xb7b9('0x42')];if(!_0x843c1a[_0xb7b9('0x48')][_0xb7b9('0x4a')]('nolimit')){_0x2edd50[_0xb7b9('0x30')]=qs[_0xb7b9('0x30')](_0x843c1a[_0xb7b9('0x48')]['limit']);_0x2edd50[_0xb7b9('0x2f')]=qs[_0xb7b9('0x2f')](_0x843c1a[_0xb7b9('0x48')]['offset']);}_0x2edd50[_0xb7b9('0x4c')]=qs['sort'](_0x843c1a[_0xb7b9('0x48')][_0xb7b9('0x4d')]);_0x2edd50[_0xb7b9('0x4e')]=qs[_0xb7b9('0x44')](_['pick'](_0x843c1a[_0xb7b9('0x48')],_0x3891d9[_0xb7b9('0x44')]));_0x2edd50[_0xb7b9('0x4e')][_0xb7b9('0xb4')]=_0xe6dc0e['id'];if(_0x843c1a[_0xb7b9('0x48')][_0xb7b9('0x8a')]){_0x2edd50['where']=_[_0xb7b9('0x9e')](_0x2edd50[_0xb7b9('0x4e')],{'$or':_[_0xb7b9('0x39')](_0x2edd50[_0xb7b9('0x46')],function(_0x49d5b0){var _0x32ca95={};_0x32ca95[_0x49d5b0]={'$like':'%'+_0x843c1a['query'][_0xb7b9('0x8a')]+'%'};return _0x32ca95;})});}_0x2edd50[_0xb7b9('0x4e')][_0xb7b9('0xf4')]=![];if(_0x843c1a[_0xb7b9('0x48')]['id']){_0x2edd50['where']['id']={'$gt':_0x843c1a[_0xb7b9('0x48')]['id']};}_0x2edd50=_[_0xb7b9('0x9e')]({},_0x2edd50,_0x843c1a[_0xb7b9('0x108')]);return db[_0xb7b9('0xc9')]['count']({'where':_0x2edd50[_0xb7b9('0x4e')]})['then'](function(_0x455514){_0x4ac3ff['count']=_0x455514;_0x2edd50[_0xb7b9('0x106')]=[];if(_0x843c1a[_0xb7b9('0x48')]['includeAgent']){_0x2edd50['include'][_0xb7b9('0xb5')]({'model':db['User'],'as':_0xb7b9('0xe5'),'attributes':['id',_0xb7b9('0xef'),'alias']});}if(_0x843c1a[_0xb7b9('0x48')][_0xb7b9('0xbb')]){_0x2edd50[_0xb7b9('0x106')]=[{'all':!![]}];}return db['ChatMessage'][_0xb7b9('0x107')](_0x2edd50);})[_0xb7b9('0x21')](function(_0x1f9d2d){_0x4ac3ff[_0xb7b9('0xb7')]=_0x1f9d2d;return _0x4ac3ff;});}})['then'](respondWithFilteredResult(_0x461f95,_0x2edd50))[_0xb7b9('0xb8')](handleError(_0x461f95,null));};exports[_0xb7b9('0x109')]=function(_0x579ffd,_0x1d9a6c,_0x68208b){return db[_0xb7b9('0x3f')][_0xb7b9('0x65')]({'where':{'id':_0x579ffd['params']['id']}})[_0xb7b9('0x21')](handleEntityNotFound(_0x1d9a6c,null))[_0xb7b9('0x21')](function(_0x1158a3){if(_0x1158a3){return _0x1158a3[_0xb7b9('0x10a')](_0x579ffd[_0xb7b9('0x78')][_0xb7b9('0x102')],_[_0xb7b9('0x103')](_0x579ffd[_0xb7b9('0x78')],[_0xb7b9('0x102'),'id'])||{})[_0xb7b9('0x10b')](function(){return db[_0xb7b9('0x10c')]['findAll']({'attributes':['id',_0xb7b9('0x37'),_0xb7b9('0x10d')],'where':{'id':_0x579ffd['body'][_0xb7b9('0x102')]}});})[_0xb7b9('0x21')](function(_0x2136a2){socket[_0xb7b9('0x10e')](_0xb7b9('0x10f'),{'id':Number(_0x579ffd[_0xb7b9('0xb9')]['id']),'tags':_0x2136a2||[]});return{'id':Number(_0x579ffd[_0xb7b9('0xb9')]['id']),'tags':_0x2136a2||[]};});}})[_0xb7b9('0x21')](respondWithResult(_0x1d9a6c,null))['catch'](handleError(_0x1d9a6c,null));};exports[_0xb7b9('0x110')]=function(_0x1a3f0d,_0x5478af,_0x1eba34){return db[_0xb7b9('0x3f')][_0xb7b9('0x65')]({'where':{'id':_0x1a3f0d[_0xb7b9('0xb9')]['id']}})['then'](handleEntityNotFound(_0x5478af,null))[_0xb7b9('0x21')](function(_0x4ca4ac){if(_0x4ca4ac){return _0x4ca4ac[_0xb7b9('0x110')](_0x1a3f0d[_0xb7b9('0x48')][_0xb7b9('0x102')]);}})['then'](respondWithStatusCode(_0x5478af,null))['catch'](handleError(_0x5478af,null));};exports[_0xb7b9('0x111')]=function(_0x4ac707,_0x260cb2){var _0x2f2b10=moment()[_0xb7b9('0x112')]()[_0xb7b9('0x9c')]();var _0x1430ae=path['join'](config[_0xb7b9('0xdc')],_0xb7b9('0x113'),_0xb7b9('0x114'),_0xb7b9('0x115'));var _0x18c0a6=path[_0xb7b9('0x116')](config[_0xb7b9('0xdc')],_0xb7b9('0x113'),_0xb7b9('0x114'),_0xb7b9('0x117'));var _0x28f308=path[_0xb7b9('0x116')](_0x1430ae,_0x2f2b10);var _0x1fab4f=util[_0xb7b9('0xe0')](_0xb7b9('0x118'),_0x4ac707[_0xb7b9('0xb9')]['id'],_0x2f2b10);var _0x4a4f6f=path[_0xb7b9('0x116')](_0x1430ae,_0x1fab4f);var _0x3f9147=[];_0x3f9147['push']({'model':db[_0xb7b9('0xe5')],'as':_0xb7b9('0xe5'),'attributes':['id',_0xb7b9('0xef')],'raw':!![]});_0x3f9147[_0xb7b9('0xb5')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xb7b9('0x119'),_0xb7b9('0x11a')],'raw':!![]});if(_0x4ac707[_0xb7b9('0x48')]['attachments']){_0x3f9147[_0xb7b9('0xb5')]({'model':db[_0xb7b9('0xd8')],'as':_0xb7b9('0xd8'),'raw':!![]});}var _0x300198=[{'model':db[_0xb7b9('0xc9')],'as':_0xb7b9('0xe4'),'attributes':['id','body',_0xb7b9('0x7e'),'direction',_0xb7b9('0xf4'),'read'],'include':_0x3f9147}];_0x300198[_0xb7b9('0xb5')]({'model':db[_0xb7b9('0xc0')],'as':'Account','attributes':['id',_0xb7b9('0x37')]});_0x300198[_0xb7b9('0xb5')]({'model':db[_0xb7b9('0xe5')],'as':_0xb7b9('0x11b'),'attributes':['id','fullname']});return db['ChatInteraction'][_0xb7b9('0x65')]({'where':{'id':_0x4ac707[_0xb7b9('0xb9')]['id']},'include':_0x300198})[_0xb7b9('0x21')](handleEntityNotFound(_0x260cb2,null))[_0xb7b9('0x21')](function(_0x42d450){if(_0x42d450){var _0x1ee326=_0x42d450[_0xb7b9('0x11c')]({'plain':!![]});fs[_0xb7b9('0x11d')](_0x28f308);var _0x5f2771={'format':'A4','border':_0xb7b9('0x11e'),'header':{'height':_0xb7b9('0x11f'),'contents':{'first':_0xb7b9('0x120')}},'footer':{'height':_0xb7b9('0x121'),'contents':{'default':util[_0xb7b9('0xe0')]('\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[_0xb7b9('0xe0')](_0xb7b9('0x122'),_0xb7b9('0x123'),_0x1ee326['id']),moment()[_0xb7b9('0xe0')](_0xb7b9('0x124'))[_0xb7b9('0x9c')]())}}};var _0x2c427b={'channel':_0xb7b9('0x123'),'account':_0x1ee326[_0xb7b9('0x125')][_0xb7b9('0x37')],'agent':_0x1ee326[_0xb7b9('0x11b')]?_0x1ee326[_0xb7b9('0x11b')]['fullname']:_0xb7b9('0x126'),'createdAt':moment(_0x1ee326[_0xb7b9('0x7e')])[_0xb7b9('0xe0')](_0xb7b9('0x105'))[_0xb7b9('0x9c')](),'closedAt':_0x1ee326[_0xb7b9('0xd1')]?moment(_0x1ee326[_0xb7b9('0x127')])[_0xb7b9('0xe0')](_0xb7b9('0x105'))[_0xb7b9('0x9c')]():'','disposition':_0x1ee326[_0xb7b9('0x128')],'chatInfo':{'browser':_0x1ee326[_0xb7b9('0x129')],'os':_0x1ee326[_0xb7b9('0x12a')],'referer':_0x1ee326['referer'],'customerIp':_0x1ee326[_0xb7b9('0x12b')],'customerPort':_0x1ee326['customerPort']?_0x1ee326[_0xb7b9('0x12c')]:_0xb7b9('0x126')},'messages':_(_0x1ee326['Messages'])[_0xb7b9('0x12d')]()[_0xb7b9('0x8a')]({'secret':![]})['map'](function(_0x304b53){if(_0x304b53[_0xb7b9('0xd8')]){var _0x1c89ce=path['join'](_0x18c0a6,_0x304b53[_0xb7b9('0xd8')][_0xb7b9('0xd6')]);if(fs[_0xb7b9('0x12e')](_0x1c89ce)){fs['createReadStream'](_0x1c89ce)[_0xb7b9('0x12f')](fs['createWriteStream'](path[_0xb7b9('0x116')](_0x28f308,_0x304b53[_0xb7b9('0xd8')]['basename'])));}}return{'date':moment(_0x304b53['createdAt'])[_0xb7b9('0xe0')](_0xb7b9('0x105'))[_0xb7b9('0x9c')](),'sender':_0x304b53[_0xb7b9('0xf3')]===_0xb7b9('0x130')?_0x304b53[_0xb7b9('0xe5')]?_0x304b53[_0xb7b9('0xe5')]['fullname']:_0xb7b9('0xe7'):_0x304b53[_0xb7b9('0xcd')][_0xb7b9('0x119')]+(_0x304b53['Contact'][_0xb7b9('0x11a')]?'\x20'+_0x304b53[_0xb7b9('0xcd')][_0xb7b9('0x11a')]:''),'body':_0x304b53[_0xb7b9('0xd8')]?_0x304b53[_0xb7b9('0xd8')][_0xb7b9('0xd6')]:_0x304b53[_0xb7b9('0x78')],'direction':_0x304b53[_0xb7b9('0xf3')]===_0xb7b9('0x130')?'A':'C','secret':_0x304b53[_0xb7b9('0xf4')],'read':_0x304b53[_0xb7b9('0x85')],'attachment':_0x304b53[_0xb7b9('0xd8')]};})[_0xb7b9('0x67')]()};return ejs[_0xb7b9('0x131')](path[_0xb7b9('0x116')](config[_0xb7b9('0xdc')],'server',_0xb7b9('0x132'),'downloadInteraction.html'),{'interaction':_0x2c427b})[_0xb7b9('0x21')](function(_0x15b06c){return new BPromise(function(_0x24e7db,_0x36e7ad){pdf[_0xb7b9('0xbc')](_0x15b06c,_0x5f2771)[_0xb7b9('0x133')](path[_0xb7b9('0x116')](_0x28f308,_0xb7b9('0x134')+_0x1ee326['id']+'-'+_0x2f2b10+_0xb7b9('0x135')),function(_0x39cf31,_0x2a2d72){if(_0x39cf31)return _0x36e7ad(_0x39cf31);_0x24e7db(_0x2a2d72);});});})['then'](function(){return new BPromise(function(_0x55bd0c,_0x1c8c73){zipdir(_0x28f308,{'saveTo':_0x4a4f6f},function(_0x1382bd,_0x182207){if(_0x1382bd)return _0x1c8c73(_0x1382bd);return _0x55bd0c(_0x182207);});})[_0xb7b9('0x21')](function(){return new BPromise(function(_0x2ac4d6,_0xe92281){rimraf(_0x28f308,function(_0x2868e1){if(_0x2868e1)_0xe92281(_0x2868e1);return _0x2ac4d6();});});})[_0xb7b9('0x21')](function(){return _0x260cb2[_0xb7b9('0x111')](_0x4a4f6f,_0x1fab4f,function(_0x2be1a2){if(_0x2be1a2){console[_0xb7b9('0x136')](_0xb7b9('0x137'),_0x2be1a2);}else{fs[_0xb7b9('0x138')](_0x4a4f6f);}});});});}else{return _0x260cb2['sendStatus'](0xc8);}})[_0xb7b9('0xb8')](handleError(_0x260cb2,null));}; \ No newline at end of file +var _0x2a87=['firstName','lastName','renderFile','views','downloadInteraction.html','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','client','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','end','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','push','ChatInteraction','rawAttributes','fieldName','type','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','filters','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','ContactId','buildExpression','union','User','UserId','text','start','compact','isEmpty','ChatWebsiteId','where','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','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','Sequelize','QueryTypes','clone','i.id','contactName','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','all','show','params','includeAll','include','merge','options','create','body','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','ValidationError','join_url','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','originalname','basename','filename','file','Attachment','attachmentDownload','closed','Unauthorized','attachId','join','root','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','CmContact','%s%d','System','customer','website_alias','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','secret','MailAccount','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','omit','ids','getMessages','nolimit','$gte','findAll','rows','pick','includeAgent','addTags','spread','Tag','color','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','attachments','direction','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','Chat','YYYY-MM-DD','Owner','YYYY-MM-DD\x20HH:mm:ss','disposition','browserName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','out'];(function(_0xda556a,_0x27c0fe){var _0x141697=function(_0x3e621c){while(--_0x3e621c){_0xda556a['push'](_0xda556a['shift']());}};_0x141697(++_0x27c0fe);}(_0x2a87,0x136));var _0x72a8=function(_0x33007f,_0x4b38d2){_0x33007f=_0x33007f-0x0;var _0x10d38c=_0x2a87[_0x33007f];return _0x10d38c;};'use strict';var pdf=require(_0x72a8('0x0'));var emlformat=require(_0x72a8('0x1'));var rimraf=require(_0x72a8('0x2'));var zipdir=require(_0x72a8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x72a8('0x4'));var BPromise=require(_0x72a8('0x5'));var Mustache=require('mustache');var util=require(_0x72a8('0x6'));var path=require(_0x72a8('0x7'));var sox=require(_0x72a8('0x8'));var csv=require('to-csv');var ejs=require(_0x72a8('0x9'));var fs=require('fs');var _=require(_0x72a8('0xa'));var squel=require(_0x72a8('0xb'));var crypto=require('crypto');var jsforce=require(_0x72a8('0xc'));var deskjs=require(_0x72a8('0xd'));var toCsv=require(_0x72a8('0xe'));var querystring=require(_0x72a8('0xf'));var Papa=require(_0x72a8('0x10'));var Redis=require(_0x72a8('0x11'));var authService=require(_0x72a8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x72a8('0x13'));var hardwareService=require(_0x72a8('0x14'));var logger=require(_0x72a8('0x15'))(_0x72a8('0x16'));var utils=require(_0x72a8('0x17'));var config=require(_0x72a8('0x18'));var licenseUtil=require(_0x72a8('0x19'));var db=require(_0x72a8('0x1a'))['db'];config['redis']=_[_0x72a8('0x1b')](config['redis'],{'host':_0x72a8('0x1c'),'port':0x18eb});var socket=require(_0x72a8('0x1d'))(new Redis(config[_0x72a8('0x1e')]));require(_0x72a8('0x1f'))[_0x72a8('0x20')](socket);var jayson=require(_0x72a8('0x21'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0x72a8('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3903dc,_0x52e4d5,_0x2642d0,_0x2cf2eb){return new BPromise(function(_0x55f8bd,_0x44b3c5){var _0x4cc4af=_0x2cf2eb||client;return _0x4cc4af['request'](_0x3903dc,_0x2642d0)[_0x72a8('0x23')](function(_0x3e1b8b){logger['info'](_0x72a8('0x24'),_0x52e4d5,_0x72a8('0x25'));logger['debug'](_0x72a8('0x26'),_0x52e4d5,_0x72a8('0x25'),JSON['stringify'](_0x3e1b8b));if(_0x3e1b8b['error']){if(_0x3e1b8b[_0x72a8('0x27')][_0x72a8('0x28')]===0x1f4){logger['error'](_0x72a8('0x24'),_0x52e4d5,_0x3e1b8b[_0x72a8('0x27')]['message']);return _0x44b3c5(_0x3e1b8b[_0x72a8('0x27')]['message']);}logger[_0x72a8('0x27')](_0x72a8('0x24'),_0x52e4d5,_0x3e1b8b[_0x72a8('0x27')][_0x72a8('0x29')]);return _0x55f8bd(_0x3e1b8b[_0x72a8('0x27')][_0x72a8('0x29')]);}else{logger[_0x72a8('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x52e4d5,_0x72a8('0x25'));_0x55f8bd(_0x3e1b8b['result']['message']);}})[_0x72a8('0x2b')](function(_0x2db648){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x52e4d5,_0x2db648);_0x44b3c5(_0x2db648);});});}function respondWithStatusCode(_0x343f8e,_0x58ea6b){_0x58ea6b=_0x58ea6b||0xcc;return function(_0x43223f){if(_0x43223f){return _0x343f8e[_0x72a8('0x2c')](_0x58ea6b);}return _0x343f8e[_0x72a8('0x2d')](_0x58ea6b)['end']();};}function respondWithResult(_0x31e75e,_0x2c6ce7){_0x2c6ce7=_0x2c6ce7||0xc8;return function(_0x47e4ec){if(_0x47e4ec){return _0x31e75e[_0x72a8('0x2d')](_0x2c6ce7)[_0x72a8('0x2e')](_0x47e4ec);}};}function respondWithFilteredResult(_0x4109a4,_0x125299){return function(_0xb89bee){if(_0xb89bee){var _0x29dc81=_0xb89bee[_0x72a8('0x2f')],_0x599fc4=_0x125299[_0x72a8('0x30')],_0x50cce7=_0x125299[_0x72a8('0x30')]+_0x125299[_0x72a8('0x31')],_0x5e66a6;if(_0x50cce7>=_0x29dc81){_0x50cce7=_0x29dc81;_0x5e66a6=0xc8;}else{_0x5e66a6=0xce;}_0x4109a4[_0x72a8('0x2d')](_0x5e66a6);return _0x4109a4[_0x72a8('0x32')](_0x72a8('0x33'),_0x599fc4+'-'+_0x50cce7+'/'+_0x29dc81)[_0x72a8('0x2e')](_0xb89bee);}return null;};}function patchUpdates(_0x17ae6e){return function(_0x2f38a7){try{jsonpatch['apply'](_0x2f38a7,_0x17ae6e,!![]);}catch(_0x38fced){return BPromise[_0x72a8('0x34')](_0x38fced);}return _0x2f38a7['save']();};}function saveUpdates(_0x23e7f4,_0x103fc4){return function(_0x661f5c){if(_0x661f5c){return _0x661f5c[_0x72a8('0x35')](_0x23e7f4)[_0x72a8('0x23')](function(_0x55f673){return _0x55f673;});}return null;};}function removeEntity(_0xc691c3,_0x210993){return function(_0x512c29){if(_0x512c29){return _0x512c29['destroy']()[_0x72a8('0x23')](function(){_0xc691c3[_0x72a8('0x2d')](0xcc)[_0x72a8('0x36')]();});}};}function handleEntityNotFound(_0x1b67a3,_0x340946){return function(_0x3a61ba){if(!_0x3a61ba){_0x1b67a3['sendStatus'](0x194);}return _0x3a61ba;};}function handleError(_0x42d77d,_0x303cf2){_0x303cf2=_0x303cf2||0x1f4;return function(_0x42e753){logger[_0x72a8('0x27')](_0x42e753[_0x72a8('0x37')]);if(_0x42e753[_0x72a8('0x38')]){delete _0x42e753[_0x72a8('0x38')];}_0x42d77d[_0x72a8('0x2d')](_0x303cf2)[_0x72a8('0x39')](_0x42e753);};}function getInteractionUsers(_0xfcc551,_0x4dfdcc){return new BPromise(function(_0x593d12,_0x41e637){try{if(_0x4dfdcc[_0xfcc551['id']]){_0xfcc551[_0x72a8('0x3a')]=_[_0x72a8('0x3b')](_0x4dfdcc[_0xfcc551['id']],function(_0x1ae475){return{'id':_0x1ae475['id'],'fullname':_0x1ae475[_0x72a8('0x3c')]};});}}catch(_0x53f591){_0x41e637(_0x53f591);}_0x593d12(_0xfcc551);});}function getInteractionTags(_0x3c8fb1,_0x4ded84){return new BPromise(function(_0x74aafe,_0xe87e23){try{if(_0x3c8fb1[_0x72a8('0x3d')]){_0x3c8fb1['Tags']=[];_0x3c8fb1[_0x72a8('0x3d')]['split'](',')[_0x72a8('0x3e')](function(_0x49645d){_0x3c8fb1[_0x72a8('0x3f')][_0x72a8('0x40')](_0x4ded84[_0x49645d]);});}delete _0x3c8fb1[_0x72a8('0x3d')];}catch(_0x256ac1){_0xe87e23(_0x256ac1);}_0x74aafe(_0x3c8fb1);});}function updateChatInteraction(_0x4cd68a,_0x27a9e2,_0x43ea96){return new BPromise(function(_0x29f6e0,_0x3034fa){return getInteractionUsers(_0x4cd68a,_0x43ea96)['then'](function(_0x306a68){return getInteractionTags(_0x306a68,_0x27a9e2);})[_0x72a8('0x23')](function(_0x1c8763){_0x29f6e0(_0x1c8763);})[_0x72a8('0x2b')](function(_0x288658){_0x3034fa(_0x288658);});});}exports['index']=function(_0x6a224f,_0x5da46a){var _0x2e84ba={},_0x5cb237={},_0x33e37c={'count':0x0,'rows':[]};var _0x44dede=_[_0x72a8('0x3b')](db[_0x72a8('0x41')][_0x72a8('0x42')],function(_0x464add){return{'name':_0x464add[_0x72a8('0x43')],'type':_0x464add[_0x72a8('0x44')]['key']};});_0x5cb237['model']=_[_0x72a8('0x3b')](_0x44dede,_0x72a8('0x38'));_0x5cb237[_0x72a8('0x45')]=_[_0x72a8('0x46')](_0x6a224f['query']);_0x5cb237['filters']=_['intersection'](_0x5cb237['model'],_0x5cb237[_0x72a8('0x45')]);_0x2e84ba[_0x72a8('0x47')]=_[_0x72a8('0x48')](_0x5cb237[_0x72a8('0x49')],qs[_0x72a8('0x4a')](_0x6a224f['query'][_0x72a8('0x4a')]));_0x2e84ba['attributes']=_0x2e84ba['attributes'][_0x72a8('0x4b')]?_0x2e84ba[_0x72a8('0x47')]:_0x5cb237[_0x72a8('0x49')];if(!_0x6a224f[_0x72a8('0x45')][_0x72a8('0x4c')]('nolimit')){_0x2e84ba[_0x72a8('0x31')]=qs[_0x72a8('0x31')](_0x6a224f[_0x72a8('0x45')]['limit']);_0x2e84ba[_0x72a8('0x30')]=qs[_0x72a8('0x30')](_0x6a224f[_0x72a8('0x45')][_0x72a8('0x30')]);}_0x2e84ba[_0x72a8('0x4d')]=qs[_0x72a8('0x4e')](_0x6a224f[_0x72a8('0x45')][_0x72a8('0x4e')]);_0x2e84ba['where']=qs['filters'](_['pick'](_0x6a224f[_0x72a8('0x45')],_0x5cb237[_0x72a8('0x4f')]),_0x44dede);var _0x2678a4=[];var _0x417c30=squel[_0x72a8('0x50')]()[_0x72a8('0x51')]('id')['field'](_0x72a8('0x38'))[_0x72a8('0x51')]('color')[_0x72a8('0x52')](_0x72a8('0x53'));var _0x11b041=squel[_0x72a8('0x50')]()[_0x72a8('0x51')](_0x72a8('0x54'))[_0x72a8('0x51')](_0x72a8('0x55'))[_0x72a8('0x51')](_0x72a8('0x56'))[_0x72a8('0x52')](_0x72a8('0x57'),'ui')[_0x72a8('0x58')](_0x72a8('0x59'),'u','u.id\x20=\x20ui.UserId');var _0x43edeb=squel['select']()[_0x72a8('0x52')](_0x72a8('0x5a'),'i')[_0x72a8('0x58')](_0x72a8('0x5b'),'c',_0x72a8('0x5c'))[_0x72a8('0x58')](_0x72a8('0x59'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x72a8('0x5d'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join'](_0x72a8('0x5e'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x72a8('0x58')](_0x72a8('0x5f'),'it',_0x72a8('0x60'))[_0x72a8('0x58')](_0x72a8('0x53'),'t',_0x72a8('0x61'));var _0x2b841f=squel[_0x72a8('0x62')]();var _0x5379f8=[];var _0xb76a9=squel[_0x72a8('0x62')]();var _0x5d16ff;if(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x63')]){_0x5d16ff=as['parseSearch'](_0x6a224f['query'][_0x72a8('0x63')]);var _0x9f8fed=_0x5d16ff[_0x72a8('0x64')];for(var _0x561e1d=0x0;_0x561e1d<_0x5d16ff[_0x72a8('0x65')]['length'];_0x561e1d++){var _0x1d3f29=_0x5d16ff[_0x72a8('0x65')][_0x561e1d];var _0xac4424='i';var _0xe8f48c=_[_0x72a8('0x66')](_0x44dede,['name',_0x1d3f29[_0x72a8('0x51')]]);if(!_0xe8f48c){switch(_0x1d3f29[_0x72a8('0x51')]){case _0x72a8('0x67'):if(_0x1d3f29[_0x72a8('0x68')]==0x1){_0x43edeb[_0x72a8('0x69')]('`'+_0x1d3f29[_0x72a8('0x51')]+_0x72a8('0x6a'));}else{_0x43edeb[_0x72a8('0x69')]('`'+_0x1d3f29[_0x72a8('0x51')]+_0x72a8('0x6b'));}break;case _0x72a8('0x6c'):if(_0x1d3f29[_0x72a8('0x6d')]===_0x72a8('0x6e')){if(_0x1d3f29[_0x72a8('0x68')][_0x72a8('0x6f')]('\x20')[_0x72a8('0x4b')]>0x1){_0x2b841f[_0x9f8fed]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1d3f29['value']),null);}else{var _0x2a12e6='%'+_0x1d3f29[_0x72a8('0x68')]+'%';_0x2b841f[_0x9f8fed]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2a12e6,_0x2a12e6,_0x2a12e6);}}else{_0xe8f48c=_[_0x72a8('0x66')](_0x44dede,[_0x72a8('0x38'),_0x72a8('0x70')]);_0x1d3f29[_0x72a8('0x51')]=_0x72a8('0x70');_0x3fa487=as[_0x72a8('0x71')](_0xac4424,_0xe8f48c[_0x72a8('0x44')],_0x1d3f29);_0x2b841f[_0x9f8fed](_0x3fa487['text'],_0x3fa487[_0x72a8('0x68')]['start'],_0x3fa487['value']['end']);}break;case'Tag':var _0x40f717=_0x1d3f29['value'][_0x72a8('0x6f')](',')[_0x72a8('0x3b')](function(_0x25820d){return Number(_0x25820d);});_0x40f717[_0x72a8('0x3e')](function(_0x531ca4){_0xb76a9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x531ca4+',%');});_0x5379f8=_[_0x72a8('0x72')](_0x5379f8,_0x40f717);break;case _0x72a8('0x73'):if(_0x1d3f29[_0x72a8('0x6d')]===_0x72a8('0x6e')){_0x2b841f[_0x9f8fed]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1d3f29[_0x72a8('0x68')]+'%',null);}else{_0xe8f48c=_['find'](_0x44dede,[_0x72a8('0x38'),_0x72a8('0x74')]);_0x1d3f29[_0x72a8('0x51')]=_0x72a8('0x74');_0x3fa487=as[_0x72a8('0x71')](_0xac4424,_0xe8f48c[_0x72a8('0x44')],_0x1d3f29);_0x2b841f[_0x9f8fed](_0x3fa487[_0x72a8('0x75')],_0x3fa487[_0x72a8('0x68')][_0x72a8('0x76')],_0x3fa487[_0x72a8('0x68')][_0x72a8('0x36')]);}break;case'body':_0x3fa487=as['buildExpression']('me',null,_0x1d3f29);_0x2b841f[_0x9f8fed](_0x3fa487['text'],_0x3fa487[_0x72a8('0x68')][_0x72a8('0x76')],_0x3fa487['value'][_0x72a8('0x36')]);break;}}else{var _0x3fa487=as[_0x72a8('0x71')](_0xac4424,_0xe8f48c['type'],_0x1d3f29);_0x2b841f[_0x9f8fed](_0x3fa487['text'],_0x3fa487[_0x72a8('0x68')][_0x72a8('0x76')],_0x3fa487[_0x72a8('0x68')][_0x72a8('0x36')]);}}}else{var _0x2fbfa0=_(_0x6a224f[_0x72a8('0x45')])[_0x72a8('0x46')]()[_0x72a8('0x3b')](function(_0x39837a){return _['some'](_0x44dede,[_0x72a8('0x38'),_0x39837a])?_0x39837a:undefined;})[_0x72a8('0x77')]()['value']();if(!_[_0x72a8('0x78')](_0x2fbfa0)){_0x2fbfa0['forEach'](function(_0x2506a9){if(_0x2506a9===_0x72a8('0x79')){_0x43edeb[_0x72a8('0x7a')]('i.ChatWebsiteId\x20IN\x20?',[]['concat'](_0x6a224f[_0x72a8('0x45')][_0x2506a9]));}else if(_0x2506a9===_0x72a8('0x7b')){var _0x5b741d=JSON[_0x72a8('0x7c')](_0x6a224f[_0x72a8('0x45')][_0x2506a9])['$gte'];var _0x30c6c1=JSON[_0x72a8('0x7c')](_0x6a224f[_0x72a8('0x45')][_0x2506a9])['$lte'];_0x43edeb['where'](_0x72a8('0x7d'),_0x5b741d,_0x30c6c1);}else{if(_0x6a224f[_0x72a8('0x45')][_0x2506a9]===_0x72a8('0x7e')){_0x43edeb[_0x72a8('0x7a')]('i.'+_0x2506a9+'\x20IS\x20NULL');}else{_0x43edeb[_0x72a8('0x7a')]('i.'+_0x2506a9+'\x20=\x20?',_0x6a224f['query'][_0x2506a9]);}}});}if(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x7f')]){if(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x7f')]==0x1){_0x43edeb[_0x72a8('0x69')](_0x72a8('0x80'));}else{_0x43edeb['having'](_0x72a8('0x81'));}}if(_0x6a224f[_0x72a8('0x45')]['tag']){_0x5379f8=_[_0x72a8('0x82')](_0x6a224f[_0x72a8('0x45')]['tag'])?_0x6a224f[_0x72a8('0x45')][_0x72a8('0x83')]:new Array(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x83')]);_0x5379f8['forEach'](function(_0x28d268){_0xb76a9['or'](_0x72a8('0x84'),'%,'+_0x28d268+',%');});}if(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x85')]){var _0x1a103e=_0x6a224f['query'][_0x72a8('0x85')]['replace']('\x5c','\x5c\x5c')[_0x72a8('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1a103e)){_0x2b841f['or'](_0x72a8('0x87'),_0x1a103e+'%');}else{_0x2b841f['or'](_0x72a8('0x88'),qs[_0x72a8('0x89')](_0x1a103e))['or'](_0x72a8('0x8a'),_0x1a103e+'%');}}}_0x43edeb[_0x72a8('0x7a')](_0x2b841f);_0x43edeb[_0x72a8('0x8b')]('i.id');var _0x51a3a8={'type':db[_0x72a8('0x8c')][_0x72a8('0x8d')]['SELECT'],'raw':!![]};var _0x1f0f07=_0x43edeb[_0x72a8('0x8e')]();_0x1f0f07[_0x72a8('0x51')](_0x72a8('0x8f'));_0x1f0f07[_0x72a8('0x51')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x2e84ba[_0x72a8('0x4d')]){_0x2e84ba['order'][_0x72a8('0x3e')](function(_0x56a44a){var _0x1ebd8a=_0x56a44a[0x0]===_0x72a8('0x90')?_0x56a44a[0x0]:'i.'+_0x56a44a[0x0];_0x43edeb[_0x72a8('0x4d')](_0x1ebd8a,_0x56a44a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x72a8('0x78')](_0x5379f8)){_0x43edeb[_0x72a8('0x69')](_0xb76a9);_0x1f0f07[_0x72a8('0x7a')](_0x72a8('0x91'),_0x5379f8);}BPromise[_0x72a8('0x92')]()[_0x72a8('0x23')](function(){if(!_0x5d16ff){if(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x79')])return;_0x1f0f07[_0x72a8('0x7a')](_0x72a8('0x93'));_0x43edeb[_0x72a8('0x7a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x6a224f['user']['role']!==_0x72a8('0x94'))return;return _0x6a224f[_0x72a8('0x95')][_0x72a8('0x96')]({'attributes':['id'],'raw':!![]})[_0x72a8('0x23')](function(_0x11c551){if(_[_0x72a8('0x78')](_0x11c551)){_0x1f0f07[_0x72a8('0x7a')](_0x72a8('0x97'));_0x43edeb[_0x72a8('0x7a')](_0x72a8('0x97'));}else{_0x1f0f07['where'](_0x72a8('0x98'),_['map'](_0x11c551,'id'));_0x43edeb[_0x72a8('0x7a')](_0x72a8('0x98'),_['map'](_0x11c551,'id'));}});})['then'](function(){if(_0x6a224f['user'][_0x72a8('0x99')]===_0x72a8('0x94')&&!_0x5d16ff&&!_0x6a224f[_0x72a8('0x45')][_0x72a8('0x79')])return[];return db[_0x72a8('0x9a')][_0x72a8('0x45')](_0x1f0f07[_0x72a8('0x9b')](),_0x51a3a8);})['then'](function(_0x81dcfa){_0x33e37c[_0x72a8('0x2f')]=_0x81dcfa[_0x72a8('0x4b')];if(_0x33e37c[_0x72a8('0x2f')]===0x0)return[];return db[_0x72a8('0x9a')][_0x72a8('0x45')](_0x417c30[_0x72a8('0x9b')](),_0x51a3a8)[_0x72a8('0x23')](function(_0x35d6b7){_0x2678a4=_[_0x72a8('0x9c')](_0x35d6b7,'id');_0x51a3a8=_['merge'](_0x51a3a8,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x4a')]){_0x2e84ba[_0x72a8('0x47')][_0x72a8('0x3e')](function(_0x29b539){_0x43edeb[_0x72a8('0x51')]('i.'+_0x29b539);});}else{_0x43edeb[_0x72a8('0x51')](_0x72a8('0x9d'),'unreadMessages');_0x43edeb[_0x72a8('0x51')](_0x72a8('0x9e'),_0x72a8('0x9f'));_0x43edeb['field'](_0x72a8('0xa0'),_0x72a8('0xa1'));_0x43edeb[_0x72a8('0x51')](_0x72a8('0xa2'),_0x72a8('0x90'));_0x43edeb['field']('i.*');_0x43edeb['field'](_0x72a8('0xa3'),'Contact.firstName');_0x43edeb[_0x72a8('0x51')](_0x72a8('0xa4'),_0x72a8('0xa5'));_0x43edeb[_0x72a8('0x51')](_0x72a8('0xa6'),_0x72a8('0xa7'));_0x43edeb['field'](_0x72a8('0xa8'),_0x72a8('0xa9'));_0x43edeb['field'](_0x72a8('0xaa'),_0x72a8('0xab'));_0x43edeb[_0x72a8('0x51')](_0x72a8('0xac'),_0x72a8('0xad'));_0x43edeb[_0x72a8('0x51')](_0x72a8('0xae'),_0x72a8('0xaf'));_0x43edeb[_0x72a8('0x51')](_0x72a8('0xb0'),'Owner.internal');_0x43edeb['field'](_0x72a8('0xb1'),_0x72a8('0x3d'));}if(_0x2e84ba[_0x72a8('0x31')])_0x43edeb[_0x72a8('0x31')](_0x2e84ba[_0x72a8('0x31')]);if(_0x2e84ba[_0x72a8('0x30')])_0x43edeb[_0x72a8('0x30')](_0x2e84ba[_0x72a8('0x30')]);return db[_0x72a8('0x9a')][_0x72a8('0x45')](_0x43edeb['toString'](),_0x51a3a8);})[_0x72a8('0x23')](function(_0x239698){_0x11b041[_0x72a8('0x7a')]('ui.ChatInteractionId\x20IN\x20?',_[_0x72a8('0x3b')](_0x239698,'id'));return db[_0x72a8('0x9a')]['query'](_0x11b041[_0x72a8('0x9b')](),_0x51a3a8)[_0x72a8('0x23')](function(_0x34d2b9){var _0x3fe78f=_[_0x72a8('0xb2')](_0x34d2b9,_0x72a8('0xb3'));var _0x269c9a=[];_0x239698[_0x72a8('0x3e')](function(_0xda50b2){_0x269c9a[_0x72a8('0x40')](updateChatInteraction(_0xda50b2,_0x2678a4,_0x3fe78f));});return BPromise[_0x72a8('0xb4')](_0x269c9a);});});})[_0x72a8('0x23')](function(_0x3bb191){_0x33e37c['rows']=_0x3bb191;return _0x33e37c;})['then'](respondWithFilteredResult(_0x5da46a,_0x2e84ba))['catch'](handleError(_0x5da46a,null));};exports[_0x72a8('0xb5')]=function(_0x25e011,_0x4fc4ba){var _0x1aacf8={'raw':![],'where':{'id':_0x25e011[_0x72a8('0xb6')]['id']}},_0x21795d={};_0x21795d['model']=_[_0x72a8('0x46')](db[_0x72a8('0x41')]['rawAttributes']);_0x21795d[_0x72a8('0x45')]=_[_0x72a8('0x46')](_0x25e011[_0x72a8('0x45')]);_0x21795d[_0x72a8('0x4f')]=_['intersection'](_0x21795d[_0x72a8('0x49')],_0x21795d[_0x72a8('0x45')]);_0x1aacf8['attributes']=_[_0x72a8('0x48')](_0x21795d[_0x72a8('0x49')],qs['fields'](_0x25e011['query'][_0x72a8('0x4a')]));_0x1aacf8[_0x72a8('0x47')]=_0x1aacf8[_0x72a8('0x47')][_0x72a8('0x4b')]?_0x1aacf8[_0x72a8('0x47')]:_0x21795d[_0x72a8('0x49')];if(_0x25e011[_0x72a8('0x45')][_0x72a8('0xb7')]){_0x1aacf8[_0x72a8('0xb8')]=[{'all':!![]}];}_0x1aacf8=_[_0x72a8('0xb9')]({},_0x1aacf8,_0x25e011[_0x72a8('0xba')]);return db[_0x72a8('0x41')][_0x72a8('0x66')](_0x1aacf8)[_0x72a8('0x23')](handleEntityNotFound(_0x4fc4ba,null))['then'](respondWithResult(_0x4fc4ba,null))[_0x72a8('0x2b')](handleError(_0x4fc4ba,null));};exports[_0x72a8('0xbb')]=function(_0x2168aa,_0x227ffa){return db['ChatInteraction']['create'](_0x2168aa[_0x72a8('0xbc')],{})[_0x72a8('0x23')](respondWithResult(_0x227ffa,0xc9))[_0x72a8('0x2b')](handleError(_0x227ffa,null));};exports[_0x72a8('0x35')]=function(_0x40faa2,_0x7c9818){if(_0x40faa2[_0x72a8('0xbc')]['id']){delete _0x40faa2[_0x72a8('0xbc')]['id'];}return db['ChatInteraction'][_0x72a8('0x66')]({'where':{'id':_0x40faa2['params']['id']}})['then'](handleEntityNotFound(_0x7c9818,null))['then'](saveUpdates(_0x40faa2[_0x72a8('0xbc')],null))[_0x72a8('0x23')](respondWithResult(_0x7c9818,null))[_0x72a8('0x2b')](handleError(_0x7c9818,null));};exports[_0x72a8('0xbd')]=function(_0x4ddf50,_0x5b57a9){return db[_0x72a8('0x41')][_0x72a8('0x66')]({'where':{'id':_0x4ddf50[_0x72a8('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5b57a9,null))['then'](removeEntity(_0x5b57a9,null))[_0x72a8('0x2b')](handleError(_0x5b57a9,null));};exports[_0x72a8('0xbe')]=function(_0x146efa,_0x5752b2){return db[_0x72a8('0x41')][_0x72a8('0xbe')]()['then'](respondWithResult(_0x5752b2,null))[_0x72a8('0x2b')](handleError(_0x5752b2,null));};exports[_0x72a8('0xbf')]=function(_0x43181a,_0x4bbf75){var _0x3baf1c=_0x43181a[_0x72a8('0xb6')]['id'];var _0x7500c;var _0x1ee58d;var _0x3345b4;return db[_0x72a8('0x41')][_0x72a8('0xc0')]({'where':{'id':_0x3baf1c}})[_0x72a8('0x23')](function(_0x3dfca0){_0x7500c=_0x3dfca0;return db[_0x72a8('0xc1')]['findOne']({'where':{'id':_0x3dfca0['ChatWebsiteId']},'attributes':['id',_0x72a8('0xc2'),_0x72a8('0xc3')],'raw':!![]});})[_0x72a8('0x23')](function(_0x12b5a2){if(_0x12b5a2&&_0x12b5a2[_0x72a8('0xc2')]&&_0x12b5a2[_0x72a8('0xc3')]){_0x1ee58d=_0x12b5a2;var _0x265b5b={'rejectUnauthorized':![],'method':_0x72a8('0xc4'),'uri':_0x72a8('0xc5'),'headers':{'X-APIKEY':_0x12b5a2[_0x72a8('0xc2')]},'body':{'name':'MotionCWB:'+_0x3baf1c},'redirect':_0x72a8('0xc6'),'json':!![]};return rp(_0x265b5b);}else{throw new db['Sequelize'][(_0x72a8('0xc7'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x72a8('0x23')](function(_0x3d6183){_0x3345b4=_0x3d6183;if(_0x3345b4['id']){var _0x6feaec={'body':_0x3345b4[_0x72a8('0xc8')],'ChatWebsiteId':_0x1ee58d['id'],'ChatInteractionId':_0x7500c['id'],'direction':'out','UserId':_0x43181a[_0x72a8('0x95')]['id']};return db['ChatMessage'][_0x72a8('0xbb')](_0x6feaec,{});}else{throw new db[(_0x72a8('0x8c'))][(_0x72a8('0xc7'))](_0x72a8('0xc9'));}})[_0x72a8('0x23')](function(){return _0x7500c[_0x72a8('0xca')]({'vidaooSessionId':_0x3345b4['id']});})['then'](respondWithResult(_0x4bbf75,null))['catch'](handleError(_0x4bbf75,null));};exports['customUpdate']=function(_0x531f52,_0x3e00b1){if(_0x531f52['body']['id']){delete _0x531f52[_0x72a8('0xbc')]['id'];}return db[_0x72a8('0x41')][_0x72a8('0x66')]({'where':{'id':_0x531f52[_0x72a8('0xb6')]['id']},'include':[{'model':db['CmContact'],'as':_0x72a8('0x6c')}]})[_0x72a8('0x23')](handleEntityNotFound(_0x3e00b1,null))[_0x72a8('0x23')](saveUpdates(_0x531f52['body'],null))['then'](respondWithResult(_0x3e00b1,null))[_0x72a8('0x2b')](handleError(_0x3e00b1,null));};exports[_0x72a8('0xcb')]=function(_0x455977,_0x522ddc,_0x55f259){if(_0x455977[_0x72a8('0xbc')]['id']){delete _0x455977[_0x72a8('0xbc')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x455977[_0x72a8('0xb6')]['id']}})[_0x72a8('0x23')](function(_0x42a731){if(!_0x42a731){logger[_0x72a8('0x27')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x72a8('0xcb'),0x194,_0x72a8('0xcc'));_0x522ddc[_0x72a8('0x2c')](0x194);}else{if(_0x42a731[_0x72a8('0x74')]){throw new db['Sequelize'][(_0x72a8('0xc7'))](_0x72a8('0xcd'));}}return _0x42a731;})[_0x72a8('0x23')](function(_0x988a26){if(_0x988a26){return _0x988a26[_0x72a8('0x35')]({'closed':_0x455977['body']['closed'],'disposition':_0x455977[_0x72a8('0xbc')]['disposition']})[_0x72a8('0x23')](function(_0x3a5d7c){return _0x3a5d7c;});}})[_0x72a8('0x23')](function(_0x3a4f9d){return respondWithRpcPromise('AbandonInteraction','abandon',_0x455977[_0x72a8('0xbc')],client9004);})[_0x72a8('0x23')](respondWithResult(_0x522ddc,null))[_0x72a8('0x2b')](handleError(_0x522ddc,null));};exports[_0x72a8('0xce')]=function(_0x3f00d2,_0x90faa,_0x5b3956){_0x3f00d2[_0x72a8('0xbc')][_0x72a8('0x38')]=_0x3f00d2['file'][_0x72a8('0xcf')];_0x3f00d2['body'][_0x72a8('0xd0')]=_0x3f00d2['file'][_0x72a8('0xd1')];_0x3f00d2[_0x72a8('0xbc')][_0x72a8('0x44')]=_0x3f00d2[_0x72a8('0xd2')]['mimetype'];return db[_0x72a8('0xd3')][_0x72a8('0xbb')](_0x3f00d2[_0x72a8('0xbc')])[_0x72a8('0x23')](respondWithResult(_0x90faa,0xc9))['catch'](handleError(_0x90faa,null));};exports[_0x72a8('0xd4')]=function(_0x5898ff,_0x32dfc7,_0x1ba970){return db[_0x72a8('0x41')][_0x72a8('0xc0')]({'where':{'id':_0x5898ff['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x32dfc7,null))[_0x72a8('0x23')](function(_0x38075b){if(_0x38075b){if(_0x38075b[_0x72a8('0xd5')]){return _0x32dfc7[_0x72a8('0x2d')](0x193)[_0x72a8('0x2e')]({'status':0x193,'message':_0x72a8('0xd6')});}return db[_0x72a8('0xd3')][_0x72a8('0xc0')]({'where':{'id':_0x5898ff[_0x72a8('0x45')][_0x72a8('0xd7')]},'raw':!![]})[_0x72a8('0x23')](handleEntityNotFound(_0x32dfc7,null));}})[_0x72a8('0x23')](function(_0x374827){if(_0x374827){return _0x32dfc7['download'](path[_0x72a8('0xd8')](config[_0x72a8('0xd9')],'server/files/attachments/',_0x374827[_0x72a8('0xd0')]));}})[_0x72a8('0x2b')](handleError(_0x32dfc7,null));};exports['close']=function(_0x4e4200,_0x295d0a){var _0x1167a5=null;var _0x38e34a=null;var _0x455da2=null;var _0x4fe4dc=null;if(_0x4e4200[_0x72a8('0xbc')]['id']){delete _0x4e4200[_0x72a8('0xbc')]['id'];}if(_0x4e4200['body'][_0x72a8('0xda')]){_0x4fe4dc=path[_0x72a8('0xd8')](config[_0x72a8('0xd9')],_0x72a8('0xdb'),util[_0x72a8('0xdc')](_0x72a8('0xdd'),Date[_0x72a8('0xde')]()));_0x4e4200[_0x72a8('0xbc')][_0x72a8('0xdf')]=_0x4fe4dc;}return db['ChatInteraction'][_0x72a8('0x66')]({'where':{'id':_0x4e4200[_0x72a8('0xb6')]['id']},'include':[{'model':db[_0x72a8('0xe0')],'as':_0x72a8('0xe1'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x72a8('0x23')](handleEntityNotFound(_0x295d0a,null))[_0x72a8('0x23')](saveUpdates(_0x4e4200['body'],null))[_0x72a8('0x23')](function(_0x18193b){if(_0x18193b){_0x1167a5=_0x18193b;return db[_0x72a8('0xc1')][_0x72a8('0x66')]({'where':{'id':_0x1167a5['ChatWebsiteId']}});}})[_0x72a8('0x23')](function(_0x3ab27a){if(_0x3ab27a){_0x455da2=_0x3ab27a;return db[_0x72a8('0xe2')][_0x72a8('0x66')]({'where':{'id':_0x1167a5['ContactId']}});}})['then'](function(_0x109666){if(_0x109666){_0x38e34a=_0x109666;if(_0x4fe4dc){var _0x2f31af=null;for(var _0x2f1c23=0x1;_0x2f1c23<_0x1167a5[_0x72a8('0xe1')]['length'];++_0x2f1c23){_0x2f31af=_0x1167a5[_0x72a8('0xe1')][_0x2f1c23];var _0x507f1b=_0x2f31af['UserId']?util[_0x72a8('0xdc')](_0x72a8('0xe3'),_0x455da2['agentAlias'],_0x2f31af[_0x72a8('0x74')]):_0x72a8('0xe4');var _0x4b07e8=_0x4e4200['body'][_0x72a8('0xe5')]||util[_0x72a8('0xdc')](_0x72a8('0xe3'),'Visitor',_0x2f31af[_0x72a8('0x70')]);switch(_0x455da2['agentIdentifier']){case _0x72a8('0xe6'):_0x507f1b=_0x2f31af[_0x72a8('0x74')]?util['format'](_0x72a8('0xe3'),_0x455da2[_0x72a8('0xe7')],_0x2f31af[_0x72a8('0x74')]):_0x72a8('0xe4');break;case _0x72a8('0xe8'):_0x507f1b=_0x2f31af[_0x72a8('0x74')]?_0x2f31af[_0x72a8('0x73')][_0x72a8('0xe9')]||_0x2f31af[_0x72a8('0x73')][_0x72a8('0x3c')]:_0x72a8('0xe4');break;case _0x72a8('0xea'):_0x507f1b=_0x2f31af[_0x72a8('0x74')]?_0x2f31af[_0x72a8('0x73')][_0x72a8('0x3c')]:_0x72a8('0xe4');break;default:_0x507f1b=_0x2f31af[_0x72a8('0x74')]?util[_0x72a8('0xdc')](_0x72a8('0xe3'),_0x455da2[_0x72a8('0xe7')],_0x2f31af['UserId']):_0x72a8('0xe4');}var _0x402720=util[_0x72a8('0xdc')](_0x72a8('0xeb'),moment(_0x2f31af[_0x72a8('0x7b')])[_0x72a8('0xdc')]('MM/DD/YYYY\x20HH:mm:ss'),_0x2f31af['direction']==='in'?_0x4b07e8:_0x507f1b,_0x2f31af[_0x72a8('0xbc')]);if(!_0x2f31af[_0x72a8('0xec')]){fs['appendFileSync'](_0x4fe4dc,_0x402720);}}return db[_0x72a8('0xed')][_0x72a8('0xc0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x72a8('0xee'),'raw':!![]}]});}}})[_0x72a8('0x23')](function(_0x5b7f4e){if(_0x5b7f4e&&_0x5b7f4e['Smtp']&&_0x4e4200[_0x72a8('0xbc')]){var _0x46efb4={'tls':{'rejectUnauthorized':![]}};if(_0x5b7f4e['Smtp'][_0x72a8('0xef')]){_0x46efb4[_0x72a8('0xef')]=_0x5b7f4e[_0x72a8('0xee')]['service'];}else{_0x46efb4['host']=_0x5b7f4e[_0x72a8('0xee')][_0x72a8('0xf0')];_0x46efb4[_0x72a8('0xf1')]=_0x5b7f4e['Smtp'][_0x72a8('0xf1')];_0x46efb4['secure']=_0x5b7f4e[_0x72a8('0xee')][_0x72a8('0xf2')];}if(_0x5b7f4e[_0x72a8('0xee')]['authentication']){_0x46efb4[_0x72a8('0xf3')]={'user':_0x5b7f4e[_0x72a8('0xee')]['user'],'pass':_0x5b7f4e[_0x72a8('0xee')][_0x72a8('0xf4')]};}return respondWithRpcPromise(_0x72a8('0xf5'),_0x72a8('0xf6'),{'account':_0x46efb4,'message':{'from':util[_0x72a8('0xdc')](_0x72a8('0xf7'),_0x5b7f4e[_0x72a8('0x38')],_0x5b7f4e[_0x72a8('0xf8')]||_0x5b7f4e[_0x72a8('0xee')][_0x72a8('0x95')]),'to':_0x4e4200[_0x72a8('0xbc')]['mailTranscript'],'subject':_0x72a8('0xf9'),'text':util[_0x72a8('0xdc')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x4e4200[_0x72a8('0xbc')][_0x72a8('0xda')]),'attachments':[{'path':_0x4fe4dc}]}})['then'](function(){return _0x1167a5;})[_0x72a8('0x2b')](function(_0x4b724b){console[_0x72a8('0x27')](_0x4b724b);});}else{return _0x1167a5;}})[_0x72a8('0x23')](respondWithStatusCode(_0x295d0a,0xc8))['catch'](handleError(_0x295d0a,null));};exports['addMessage']=function(_0x1f9935,_0x3dfa0c,_0xc88fec){return db[_0x72a8('0xe0')][_0x72a8('0x66')]({'where':{'id':_0x1f9935[_0x72a8('0xb6')]['id']}})[_0x72a8('0x23')](handleEntityNotFound(_0x3dfa0c,null))['then'](function(_0x1b230f){if(_0x1b230f){return _0x1b230f['addMessage'](_0x1f9935[_0x72a8('0xbc')]['ids'],_[_0x72a8('0xfa')](_0x1f9935[_0x72a8('0xbc')],[_0x72a8('0xfb'),'id'])||{});}})[_0x72a8('0x23')](respondWithResult(_0x3dfa0c,null))[_0x72a8('0x2b')](handleError(_0x3dfa0c,null));};exports[_0x72a8('0xfc')]=function(_0x2a036d,_0x5e7bba,_0x45adb8){var _0x24b827={'raw':![],'where':{}};var _0x279124={};var _0x321eb5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x72a8('0xc0')]({'where':{'id':_0x2a036d[_0x72a8('0xb6')]['id']}})[_0x72a8('0x23')](handleEntityNotFound(_0x5e7bba,null))[_0x72a8('0x23')](function(_0x2c5fee){if(_0x2c5fee){_0x279124[_0x72a8('0x49')]=_['keys'](db[_0x72a8('0xe0')][_0x72a8('0x42')]);_0x279124[_0x72a8('0x45')]=_[_0x72a8('0x46')](_0x2a036d[_0x72a8('0x45')]);_0x279124[_0x72a8('0x4f')]=_[_0x72a8('0x48')](_0x279124['model'],_0x279124[_0x72a8('0x45')]);_0x24b827['attributes']=_['intersection'](_0x279124['model'],qs[_0x72a8('0x4a')](_0x2a036d[_0x72a8('0x45')][_0x72a8('0x4a')]));_0x24b827[_0x72a8('0x47')]=_0x24b827['attributes']['length']?_0x24b827[_0x72a8('0x47')]:_0x279124[_0x72a8('0x49')];if(!_0x2a036d[_0x72a8('0x45')]['hasOwnProperty'](_0x72a8('0xfd'))){_0x24b827[_0x72a8('0x31')]=qs[_0x72a8('0x31')](_0x2a036d[_0x72a8('0x45')][_0x72a8('0x31')]);_0x24b827[_0x72a8('0x30')]=qs[_0x72a8('0x30')](_0x2a036d[_0x72a8('0x45')][_0x72a8('0x30')]);}_0x24b827['order']=qs[_0x72a8('0x4e')](_0x2a036d[_0x72a8('0x45')][_0x72a8('0x4e')]);_0x24b827[_0x72a8('0x7a')]=qs[_0x72a8('0x4f')](_['pick'](_0x2a036d[_0x72a8('0x45')],_0x279124[_0x72a8('0x4f')]));_0x24b827['where'][_0x72a8('0xb3')]=_0x2c5fee['id'];if(_0x2a036d['query'][_0x72a8('0x85')]){_0x24b827['where']=_[_0x72a8('0xb9')](_0x24b827['where'],{'$or':_[_0x72a8('0x3b')](_0x24b827[_0x72a8('0x47')],function(_0x24c3ae){var _0x494f23={};_0x494f23[_0x24c3ae]={'$like':'%'+_0x2a036d[_0x72a8('0x45')][_0x72a8('0x85')]+'%'};return _0x494f23;})});}if(_0x2a036d['query'][_0x72a8('0xfe')]){var _0x486c3a=_0x2a036d['query'][_0x72a8('0xfe')][_0x72a8('0x6f')](',');var _0x16d6f8={};_0x16d6f8[_0x486c3a[0x0]]={'$gte':moment(_0x486c3a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x24b827[_0x72a8('0x7a')]=_['merge'](_0x24b827[_0x72a8('0x7a')],_0x16d6f8);}_0x24b827=_[_0x72a8('0xb9')]({},_0x24b827,_0x2a036d[_0x72a8('0xba')]);return db[_0x72a8('0xe0')][_0x72a8('0x2f')]({'where':_0x24b827['where']})['then'](function(_0x4be66f){_0x321eb5[_0x72a8('0x2f')]=_0x4be66f;if(_0x2a036d['query'][_0x72a8('0xb7')]){_0x24b827[_0x72a8('0xb8')]=[{'all':!![]}];}return db[_0x72a8('0xe0')][_0x72a8('0xff')](_0x24b827);})[_0x72a8('0x23')](function(_0x262e47){_0x321eb5[_0x72a8('0x100')]=_0x262e47;return _0x321eb5;});}})[_0x72a8('0x23')](respondWithFilteredResult(_0x5e7bba,_0x24b827))[_0x72a8('0x2b')](handleError(_0x5e7bba,null));};exports['getMyMessages']=function(_0x15beb5,_0x37aa41,_0x13afa2){var _0x3bbb8f={'where':{}},_0x6b7243={},_0x239191={'count':0x0,'rows':[]};return db[_0x72a8('0x41')][_0x72a8('0xc0')]({'where':{'id':_0x15beb5[_0x72a8('0xb6')]['id']}})[_0x72a8('0x23')](handleEntityNotFound(_0x37aa41,null))[_0x72a8('0x23')](function(_0x2ea1c5){if(_0x2ea1c5){_0x6b7243['model']=_[_0x72a8('0x46')](db[_0x72a8('0xe0')][_0x72a8('0x42')]);_0x6b7243['query']=_[_0x72a8('0x46')](_0x15beb5['query']);_0x6b7243[_0x72a8('0x4f')]=_['intersection'](_0x6b7243[_0x72a8('0x49')],_0x6b7243[_0x72a8('0x45')]);_0x3bbb8f[_0x72a8('0x47')]=_['intersection'](_0x6b7243[_0x72a8('0x49')],qs['fields'](_0x15beb5[_0x72a8('0x45')][_0x72a8('0x4a')]));_0x3bbb8f[_0x72a8('0x47')]=_0x3bbb8f[_0x72a8('0x47')][_0x72a8('0x4b')]?_0x3bbb8f['attributes']:_0x6b7243[_0x72a8('0x49')];if(!_0x15beb5[_0x72a8('0x45')][_0x72a8('0x4c')](_0x72a8('0xfd'))){_0x3bbb8f[_0x72a8('0x31')]=qs[_0x72a8('0x31')](_0x15beb5[_0x72a8('0x45')][_0x72a8('0x31')]);_0x3bbb8f[_0x72a8('0x30')]=qs[_0x72a8('0x30')](_0x15beb5['query'][_0x72a8('0x30')]);}_0x3bbb8f[_0x72a8('0x4d')]=qs['sort'](_0x15beb5[_0x72a8('0x45')][_0x72a8('0x4e')]);_0x3bbb8f['where']=qs['filters'](_[_0x72a8('0x101')](_0x15beb5['query'],_0x6b7243[_0x72a8('0x4f')]));_0x3bbb8f['where'][_0x72a8('0xb3')]=_0x2ea1c5['id'];if(_0x15beb5[_0x72a8('0x45')][_0x72a8('0x85')]){_0x3bbb8f['where']=_[_0x72a8('0xb9')](_0x3bbb8f[_0x72a8('0x7a')],{'$or':_[_0x72a8('0x3b')](_0x3bbb8f[_0x72a8('0x47')],function(_0x1f3bdf){var _0x53b5be={};_0x53b5be[_0x1f3bdf]={'$like':'%'+_0x15beb5[_0x72a8('0x45')]['filter']+'%'};return _0x53b5be;})});}_0x3bbb8f[_0x72a8('0x7a')]['secret']=![];if(_0x15beb5[_0x72a8('0x45')]['id']){_0x3bbb8f[_0x72a8('0x7a')]['id']={'$gt':_0x15beb5[_0x72a8('0x45')]['id']};}_0x3bbb8f=_['merge']({},_0x3bbb8f,_0x15beb5[_0x72a8('0xba')]);return db['ChatMessage'][_0x72a8('0x2f')]({'where':_0x3bbb8f[_0x72a8('0x7a')]})['then'](function(_0x4bfc31){_0x239191['count']=_0x4bfc31;_0x3bbb8f[_0x72a8('0xb8')]=[];if(_0x15beb5['query'][_0x72a8('0x102')]){_0x3bbb8f[_0x72a8('0xb8')][_0x72a8('0x40')]({'model':db[_0x72a8('0x73')],'as':_0x72a8('0x73'),'attributes':['id',_0x72a8('0x3c'),'alias']});}if(_0x15beb5[_0x72a8('0x45')][_0x72a8('0xb7')]){_0x3bbb8f[_0x72a8('0xb8')]=[{'all':!![]}];}return db[_0x72a8('0xe0')][_0x72a8('0xff')](_0x3bbb8f);})['then'](function(_0x4dacd5){_0x239191[_0x72a8('0x100')]=_0x4dacd5;return _0x239191;});}})[_0x72a8('0x23')](respondWithFilteredResult(_0x37aa41,_0x3bbb8f))[_0x72a8('0x2b')](handleError(_0x37aa41,null));};exports[_0x72a8('0x103')]=function(_0x409d1f,_0x3421af,_0x22d266){return db[_0x72a8('0x41')][_0x72a8('0x66')]({'where':{'id':_0x409d1f[_0x72a8('0xb6')]['id']}})[_0x72a8('0x23')](handleEntityNotFound(_0x3421af,null))['then'](function(_0x3ad554){if(_0x3ad554){return _0x3ad554['setTags'](_0x409d1f[_0x72a8('0xbc')][_0x72a8('0xfb')],_[_0x72a8('0xfa')](_0x409d1f[_0x72a8('0xbc')],[_0x72a8('0xfb'),'id'])||{})[_0x72a8('0x104')](function(){return db[_0x72a8('0x105')][_0x72a8('0xff')]({'attributes':['id',_0x72a8('0x38'),_0x72a8('0x106')],'where':{'id':_0x409d1f[_0x72a8('0xbc')]['ids']}});})['then'](function(_0x366e8f){socket['emit'](_0x72a8('0x107'),{'id':Number(_0x409d1f['params']['id']),'tags':_0x366e8f||[]});return{'id':Number(_0x409d1f['params']['id']),'tags':_0x366e8f||[]};});}})['then'](respondWithResult(_0x3421af,null))[_0x72a8('0x2b')](handleError(_0x3421af,null));};exports[_0x72a8('0x108')]=function(_0x3d1de6,_0x3d3db4,_0x5e1caa){return db[_0x72a8('0x41')][_0x72a8('0x66')]({'where':{'id':_0x3d1de6[_0x72a8('0xb6')]['id']}})[_0x72a8('0x23')](handleEntityNotFound(_0x3d3db4,null))[_0x72a8('0x23')](function(_0x167ce9){if(_0x167ce9){return _0x167ce9['removeTags'](_0x3d1de6[_0x72a8('0x45')][_0x72a8('0xfb')]);}})[_0x72a8('0x23')](respondWithStatusCode(_0x3d3db4,null))[_0x72a8('0x2b')](handleError(_0x3d3db4,null));};exports[_0x72a8('0x109')]=function(_0x103d84,_0x1f1115){var _0x49bcf6=moment()[_0x72a8('0x10a')]()[_0x72a8('0x9b')]();var _0x2175ed=path[_0x72a8('0xd8')](config[_0x72a8('0xd9')],_0x72a8('0x10b'),_0x72a8('0x10c'),_0x72a8('0x10d'));var _0x34a937=path['join'](config['root'],_0x72a8('0x10b'),'files',_0x72a8('0x10e'));var _0x292932=path[_0x72a8('0xd8')](_0x2175ed,_0x49bcf6);var _0x53d3b6=util[_0x72a8('0xdc')]('transcript-%d-%s.zip',_0x103d84[_0x72a8('0xb6')]['id'],_0x49bcf6);var _0x3dc1aa=path[_0x72a8('0xd8')](_0x2175ed,_0x53d3b6);var _0x45fca2=[];_0x45fca2[_0x72a8('0x40')]({'model':db['User'],'as':_0x72a8('0x73'),'attributes':['id',_0x72a8('0x3c')],'raw':!![]});_0x45fca2['push']({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x103d84[_0x72a8('0x45')][_0x72a8('0x10e')]){_0x45fca2[_0x72a8('0x40')]({'model':db['Attachment'],'as':_0x72a8('0xd3'),'raw':!![]});}var _0xbce967=[{'model':db[_0x72a8('0xe0')],'as':_0x72a8('0xe1'),'attributes':['id','body',_0x72a8('0x7b'),_0x72a8('0x10f'),_0x72a8('0xec'),_0x72a8('0x7f')],'include':_0x45fca2}];_0xbce967[_0x72a8('0x40')]({'model':db['ChatWebsite'],'as':_0x72a8('0x110'),'attributes':['id',_0x72a8('0x38')]});_0xbce967[_0x72a8('0x40')]({'model':db['User'],'as':'Owner','attributes':['id',_0x72a8('0x3c')]});return db['ChatInteraction'][_0x72a8('0x66')]({'where':{'id':_0x103d84['params']['id']},'include':_0xbce967})['then'](handleEntityNotFound(_0x1f1115,null))['then'](function(_0x4e99ae){if(_0x4e99ae){var _0x18a8cb=_0x4e99ae['get']({'plain':!![]});fs[_0x72a8('0x111')](_0x292932);var _0x573be={'format':'A4','border':_0x72a8('0x112'),'header':{'height':_0x72a8('0x113'),'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':_0x72a8('0x114'),'contents':{'default':util['format'](_0x72a8('0x115'),util[_0x72a8('0xdc')]('%s\x20#%d',_0x72a8('0x116'),_0x18a8cb['id']),moment()[_0x72a8('0xdc')](_0x72a8('0x117'))['toString']())}}};var _0xe8b833={'channel':'Chat','account':_0x18a8cb['Account'][_0x72a8('0x38')],'agent':_0x18a8cb['Owner']?_0x18a8cb[_0x72a8('0x118')][_0x72a8('0x3c')]:'N.A.','createdAt':moment(_0x18a8cb[_0x72a8('0x7b')])[_0x72a8('0xdc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x72a8('0x9b')](),'closedAt':_0x18a8cb[_0x72a8('0xd5')]?moment(_0x18a8cb['closedAt'])[_0x72a8('0xdc')](_0x72a8('0x119'))[_0x72a8('0x9b')]():'','disposition':_0x18a8cb[_0x72a8('0x11a')],'chatInfo':{'browser':_0x18a8cb[_0x72a8('0x11b')],'os':_0x18a8cb['osName'],'referer':_0x18a8cb[_0x72a8('0x11c')],'customerIp':_0x18a8cb[_0x72a8('0x11d')],'customerPort':_0x18a8cb[_0x72a8('0x11e')]?_0x18a8cb['customerPort']:'N.A.'},'messages':_(_0x18a8cb['Messages'])['tail']()[_0x72a8('0x85')]({'secret':![]})[_0x72a8('0x3b')](function(_0x870c2b){if(_0x870c2b['Attachment']){var _0x3eda97=path['join'](_0x34a937,_0x870c2b[_0x72a8('0xd3')]['basename']);if(fs[_0x72a8('0x11f')](_0x3eda97)){fs[_0x72a8('0x120')](_0x3eda97)[_0x72a8('0x121')](fs[_0x72a8('0x122')](path[_0x72a8('0xd8')](_0x292932,_0x870c2b[_0x72a8('0xd3')][_0x72a8('0xd0')])));}}return{'date':moment(_0x870c2b['createdAt'])[_0x72a8('0xdc')](_0x72a8('0x119'))[_0x72a8('0x9b')](),'sender':_0x870c2b[_0x72a8('0x10f')]===_0x72a8('0x123')?_0x870c2b[_0x72a8('0x73')]?_0x870c2b['User'][_0x72a8('0x3c')]:_0x72a8('0xe4'):_0x870c2b[_0x72a8('0x6c')][_0x72a8('0x124')]+(_0x870c2b[_0x72a8('0x6c')][_0x72a8('0x125')]?'\x20'+_0x870c2b[_0x72a8('0x6c')][_0x72a8('0x125')]:''),'body':_0x870c2b[_0x72a8('0xd3')]?_0x870c2b[_0x72a8('0xd3')]['basename']:_0x870c2b[_0x72a8('0xbc')],'direction':_0x870c2b[_0x72a8('0x10f')]==='out'?'A':'C','secret':_0x870c2b[_0x72a8('0xec')],'read':_0x870c2b[_0x72a8('0x7f')],'attachment':_0x870c2b['Attachment']};})[_0x72a8('0x68')]()};return ejs[_0x72a8('0x126')](path[_0x72a8('0xd8')](config[_0x72a8('0xd9')],_0x72a8('0x10b'),_0x72a8('0x127'),_0x72a8('0x128')),{'interaction':_0xe8b833})[_0x72a8('0x23')](function(_0x50e6bf){return new BPromise(function(_0x4a370a,_0x41a4a9){pdf[_0x72a8('0xbb')](_0x50e6bf,_0x573be)['toFile'](path[_0x72a8('0xd8')](_0x292932,_0x72a8('0x129')+_0x18a8cb['id']+'-'+_0x49bcf6+_0x72a8('0x12a')),function(_0x48ca41,_0x50b216){if(_0x48ca41)return _0x41a4a9(_0x48ca41);_0x4a370a(_0x50b216);});});})[_0x72a8('0x23')](function(){return new BPromise(function(_0x4cd2c0,_0x211ffe){zipdir(_0x292932,{'saveTo':_0x3dc1aa},function(_0x52c202,_0x5ca3c8){if(_0x52c202)return _0x211ffe(_0x52c202);return _0x4cd2c0(_0x5ca3c8);});})[_0x72a8('0x23')](function(){return new BPromise(function(_0x2a5968,_0x2f1deb){rimraf(_0x292932,function(_0x20e0b6){if(_0x20e0b6)_0x2f1deb(_0x20e0b6);return _0x2a5968();});});})[_0x72a8('0x23')](function(){return _0x1f1115['download'](_0x3dc1aa,_0x53d3b6,function(_0x4bfc95){if(_0x4bfc95){console['log'](_0x72a8('0x12b'),_0x4bfc95);}else{fs[_0x72a8('0x12c')](_0x3dc1aa);}});});});}else{return _0x1f1115[_0x72a8('0x2c')](0xc8);}})[_0x72a8('0x2b')](handleError(_0x1f1115,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index ccd7c66..9224332 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 _0xcf14=['save','update','remove','getUsers','then','Users','map','findAll','setDataValue','length','emit','catch','hook','events','ChatInteraction','../../mysqldb','setMaxListeners'];(function(_0x3396a8,_0x30905c){var _0x4f30ed=function(_0x16872){while(--_0x16872){_0x3396a8['push'](_0x3396a8['shift']());}};_0x4f30ed(++_0x30905c);}(_0xcf14,0x10c));var _0x4cf1=function(_0x2e9cfc,_0x179a7a){_0x2e9cfc=_0x2e9cfc-0x0;var _0x426342=_0xcf14[_0x2e9cfc];return _0x426342;};'use strict';var EventEmitter=require(_0x4cf1('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x4cf1('0x1')];var ChatMessage=require(_0x4cf1('0x2'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4cf1('0x3')](0x0);var events={'afterCreate':_0x4cf1('0x4'),'afterUpdate':_0x4cf1('0x5'),'afterDestroy':_0x4cf1('0x6')};function emitEvent(_0x42e62d){return function(_0xe9302a,_0x4d06eb,_0x4bc47){_0xe9302a[_0x4cf1('0x7')]({'attributes':['id'],'raw':!![]})[_0x4cf1('0x8')](function(_0x38ff20){_0xe9302a['setDataValue'](_0x4cf1('0x9'),_0x38ff20[_0x4cf1('0xa')](function(_0x16687f){return{'id':_0x16687f['id']};}));return ChatMessage[_0x4cf1('0xb')]({'where':{'ChatInteractionId':_0xe9302a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4cf1('0x8')](function(_0x2308f1){_0xe9302a[_0x4cf1('0xc')]('unreadMessages',_0x2308f1[_0x4cf1('0xd')]);ChatInteractionEvents[_0x4cf1('0xe')](_0x42e62d+':'+_0xe9302a['id'],_0xe9302a);ChatInteractionEvents[_0x4cf1('0xe')](_0x42e62d,_0xe9302a);_0x4bc47(null);})[_0x4cf1('0xf')](_0x4bc47(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x4cf1('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x1fcc=['unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','map','then'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1fcc,0x125));var _0xc1fc=function(_0x5bfb78,_0x22e3ff){_0x5bfb78=_0x5bfb78-0x0;var _0x4efd00=_0x1fcc[_0x5bfb78];return _0x4efd00;};'use strict';var EventEmitter=require(_0xc1fc('0x0'));var ChatInteraction=require(_0xc1fc('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xc1fc('0x1'))['db'][_0xc1fc('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc1fc('0x3')](0x0);var events={'afterCreate':_0xc1fc('0x4'),'afterUpdate':_0xc1fc('0x5'),'afterDestroy':_0xc1fc('0x6')};function emitEvent(_0xf9bb59){return function(_0x51605f,_0x205d03,_0x2fe1fc){_0x51605f[_0xc1fc('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1b8560){_0x51605f[_0xc1fc('0x8')]('Users',_0x1b8560[_0xc1fc('0x9')](function(_0xf5f298){return{'id':_0xf5f298['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x51605f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc1fc('0xa')](function(_0x57df7c){_0x51605f[_0xc1fc('0x8')](_0xc1fc('0xb'),_0x57df7c['length']);ChatInteractionEvents[_0xc1fc('0xc')](_0xf9bb59+':'+_0x51605f['id'],_0x51605f);ChatInteractionEvents[_0xc1fc('0xc')](_0xf9bb59,_0x51605f);_0x2fe1fc(null);})[_0xc1fc('0xd')](_0x2fe1fc(null));};}for(var e in events){if(events[_0xc1fc('0xe')](e)){var event=events[e];ChatInteraction[_0xc1fc('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index feb2b52..c7fbfa4 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 _0x19d8=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger'];(function(_0x18c4e8,_0x2e49f6){var _0x5294f3=function(_0x32fdd5){while(--_0x32fdd5){_0x18c4e8['push'](_0x18c4e8['shift']());}};_0x5294f3(++_0x2e49f6);}(_0x19d8,0xee));var _0x819d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x19d8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x819d('0x0'));var logger=require(_0x819d('0x1'))(_0x819d('0x2'));var moment=require(_0x819d('0x3'));var BPromise=require(_0x819d('0x4'));var rp=require(_0x819d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x819d('0x6'));var config=require(_0x819d('0x7'));var attributes=require(_0x819d('0x8'));module[_0x819d('0x9')]=function(_0x2a113e,_0x58e5d9){return _0x2a113e[_0x819d('0xa')](_0x819d('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4550d8,_0x5eff4a,_0x3d0e74){if(_0x4550d8['changed']('closed')){_0x4550d8[_0x819d('0xc')]=moment()['format'](_0x819d('0xd'));}_0x3d0e74(null,_0x4550d8);}},'charset':_0x819d('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x46b0=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','ChatInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x46b0,0xa2));var _0x046b=function(_0x1dc131,_0x5b64d9){_0x1dc131=_0x1dc131-0x0;var _0x47722a=_0x46b0[_0x1dc131];return _0x47722a;};'use strict';var _=require('lodash');var util=require(_0x046b('0x0'));var logger=require(_0x046b('0x1'))(_0x046b('0x2'));var moment=require(_0x046b('0x3'));var BPromise=require(_0x046b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x046b('0x5'));var config=require(_0x046b('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x046b('0x7')]=function(_0x567bb9,_0x79b041){return _0x567bb9['define'](_0x046b('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57107a,_0xbaf8bc,_0x183e24){if(_0x57107a[_0x046b('0x9')](_0x046b('0xa'))){_0x57107a[_0x046b('0xb')]=moment()[_0x046b('0xc')](_0x046b('0xd'));}_0x183e24(null,_0x57107a);}},'charset':_0x046b('0xe'),'collate':_0x046b('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 5a52ff0..3cccc62 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 _0x96ea=['addTags','ids','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ChatInteraction','update','body','raw','options','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','find','then'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0x96ea,0x1b1));var _0xa96e=function(_0x322296,_0x57eb19){_0x322296=_0x322296-0x0;var _0x432ea7=_0x96ea[_0x322296];return _0x432ea7;};'use strict';var _=require(_0xa96e('0x0'));var util=require('util');var moment=require(_0xa96e('0x1'));var BPromise=require('bluebird');var rs=require(_0xa96e('0x2'));var fs=require('fs');var Redis=require(_0xa96e('0x3'));var db=require(_0xa96e('0x4'))['db'];var utils=require(_0xa96e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa96e('0x6'));var jayson=require(_0xa96e('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xa96e('0x8')](config[_0xa96e('0x9')],{'host':_0xa96e('0xa'),'port':0x18eb});var socket=require(_0xa96e('0xb'))(new Redis(config[_0xa96e('0x9')]));require('./chatInteraction.socket')[_0xa96e('0xc')](socket);function respondWithRpcPromise(_0x5a4cdd,_0x43748c,_0xcaf86a){return new BPromise(function(_0xed1bf0,_0xaaf03f){return client[_0xa96e('0xd')](_0x5a4cdd,_0xcaf86a)['then'](function(_0x46252e){logger['info'](_0xa96e('0xe'),_0x43748c,_0xa96e('0xf'));logger['debug'](_0xa96e('0x10'),_0x43748c,_0xa96e('0xf'),JSON[_0xa96e('0x11')](_0x46252e));if(_0x46252e[_0xa96e('0x12')]){if(_0x46252e[_0xa96e('0x12')][_0xa96e('0x13')]===0x1f4){logger[_0xa96e('0x12')](_0xa96e('0xe'),_0x43748c,_0x46252e[_0xa96e('0x12')]['message']);return _0xaaf03f(_0x46252e['error'][_0xa96e('0x14')]);}logger['error'](_0xa96e('0xe'),_0x43748c,_0x46252e[_0xa96e('0x12')][_0xa96e('0x14')]);return _0xed1bf0(_0x46252e['error'][_0xa96e('0x14')]);}else{logger[_0xa96e('0x15')](_0xa96e('0xe'),_0x43748c,_0xa96e('0xf'));_0xed1bf0(_0x46252e['result'][_0xa96e('0x14')]);}})[_0xa96e('0x16')](function(_0x52f118){logger[_0xa96e('0x12')](_0xa96e('0xe'),_0x43748c,_0x52f118);_0xaaf03f(_0x52f118);});});}exports['UpdateChatInteraction']=function(_0x53c707){var _0x1dfb91=this;return new Promise(function(_0x556b6f,_0x4e9a06){return db[_0xa96e('0x17')][_0xa96e('0x18')](_0x53c707[_0xa96e('0x19')],{'raw':_0x53c707['options']?_0x53c707['options'][_0xa96e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53c707[_0xa96e('0x1b')]?_0x53c707['options'][_0xa96e('0x1c')]||null:null,'attributes':_0x53c707['options']?_0x53c707[_0xa96e('0x1b')][_0xa96e('0x1d')]||null:null,'limit':_0x53c707[_0xa96e('0x1b')]?_0x53c707['options'][_0xa96e('0x1e')]||null:null})['then'](function(_0x48bd70){logger[_0xa96e('0x15')](_0xa96e('0x1f'),_0x53c707);logger['debug'](_0xa96e('0x1f'),_0x53c707,JSON[_0xa96e('0x11')](_0x48bd70));_0x556b6f(_0x48bd70);})['catch'](function(_0x15b1bb){logger['error']('UpdateChatInteraction',_0x15b1bb[_0xa96e('0x14')],_0x53c707);_0x4e9a06(_0x1dfb91[_0xa96e('0x12')](0x1f4,_0x15b1bb[_0xa96e('0x14')]));});});};exports[_0xa96e('0x20')]=function(_0x3e5079){return new Promise(function(_0x32f76d,_0x250817){return db[_0xa96e('0x17')][_0xa96e('0x21')]({'where':_0x3e5079[_0xa96e('0x1b')]?_0x3e5079['options'][_0xa96e('0x1c')]||null:null})[_0xa96e('0x22')](function(_0x5c7f2b){if(_0x5c7f2b){return _0x5c7f2b[_0xa96e('0x23')](_0x3e5079[_0xa96e('0x19')][_0xa96e('0x24')],_['omit'](_0x3e5079[_0xa96e('0x19')],[_0xa96e('0x24'),'id'])||{});}})[_0xa96e('0x25')](function(_0x6a2fb8){logger[_0xa96e('0x15')]('AddTags',_0x3e5079);logger['debug'](_0xa96e('0x26'),_0x3e5079,JSON[_0xa96e('0x11')](_0x6a2fb8));_0x32f76d(_0x6a2fb8);})[_0xa96e('0x16')](function(_0x447fc9){logger[_0xa96e('0x12')](_0xa96e('0x26'),_0x447fc9[_0xa96e('0x14')],_0x3e5079);_0x250817(_this[_0xa96e('0x12')](0x1f4,_0x447fc9['message']));});});}; \ No newline at end of file +var _0xc796=['localhost','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatInteraction','body','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x4e32b3,_0x1b6243){var _0x394b68=function(_0x5c65d9){while(--_0x5c65d9){_0x4e32b3['push'](_0x4e32b3['shift']());}};_0x394b68(++_0x1b6243);}(_0xc796,0x141));var _0x6c79=function(_0xae282f,_0x2d9368){_0xae282f=_0xae282f-0x0;var _0x5f46d4=_0xc796[_0xae282f];return _0x5f46d4;};'use strict';var _=require(_0x6c79('0x0'));var util=require('util');var moment=require(_0x6c79('0x1'));var BPromise=require(_0x6c79('0x2'));var rs=require(_0x6c79('0x3'));var fs=require('fs');var Redis=require(_0x6c79('0x4'));var db=require(_0x6c79('0x5'))['db'];var utils=require(_0x6c79('0x6'));var logger=require(_0x6c79('0x7'))(_0x6c79('0x8'));var config=require(_0x6c79('0x9'));var jayson=require(_0x6c79('0xa'));var client=jayson[_0x6c79('0xb')][_0x6c79('0xc')]({'port':0x232a});config['redis']=_[_0x6c79('0xd')](config[_0x6c79('0xe')],{'host':_0x6c79('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c79('0xe')]));require(_0x6c79('0x10'))['register'](socket);function respondWithRpcPromise(_0x1f0538,_0x5d9b79,_0xd3a3e){return new BPromise(function(_0xae6e09,_0x19aaf3){return client[_0x6c79('0x11')](_0x1f0538,_0xd3a3e)[_0x6c79('0x12')](function(_0x264457){logger[_0x6c79('0x13')](_0x6c79('0x14'),_0x5d9b79,_0x6c79('0x15'));logger[_0x6c79('0x16')](_0x6c79('0x17'),_0x5d9b79,_0x6c79('0x15'),JSON[_0x6c79('0x18')](_0x264457));if(_0x264457[_0x6c79('0x19')]){if(_0x264457[_0x6c79('0x19')][_0x6c79('0x1a')]===0x1f4){logger[_0x6c79('0x19')](_0x6c79('0x14'),_0x5d9b79,_0x264457[_0x6c79('0x19')][_0x6c79('0x1b')]);return _0x19aaf3(_0x264457[_0x6c79('0x19')][_0x6c79('0x1b')]);}logger[_0x6c79('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x5d9b79,_0x264457['error']['message']);return _0xae6e09(_0x264457[_0x6c79('0x19')][_0x6c79('0x1b')]);}else{logger[_0x6c79('0x13')](_0x6c79('0x14'),_0x5d9b79,_0x6c79('0x15'));_0xae6e09(_0x264457['result']['message']);}})[_0x6c79('0x1c')](function(_0x327fc8){logger[_0x6c79('0x19')](_0x6c79('0x14'),_0x5d9b79,_0x327fc8);_0x19aaf3(_0x327fc8);});});}exports['UpdateChatInteraction']=function(_0x531b0e){var _0x2edfe0=this;return new Promise(function(_0x1dd85f,_0x236921){return db[_0x6c79('0x1d')]['update'](_0x531b0e[_0x6c79('0x1e')],{'raw':_0x531b0e[_0x6c79('0x1f')]?_0x531b0e[_0x6c79('0x1f')][_0x6c79('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x531b0e[_0x6c79('0x1f')]?_0x531b0e['options'][_0x6c79('0x21')]||null:null,'attributes':_0x531b0e['options']?_0x531b0e[_0x6c79('0x1f')][_0x6c79('0x22')]||null:null,'limit':_0x531b0e[_0x6c79('0x1f')]?_0x531b0e[_0x6c79('0x1f')][_0x6c79('0x23')]||null:null})['then'](function(_0x69948a){logger[_0x6c79('0x13')](_0x6c79('0x24'),_0x531b0e);logger['debug'](_0x6c79('0x24'),_0x531b0e,JSON[_0x6c79('0x18')](_0x69948a));_0x1dd85f(_0x69948a);})[_0x6c79('0x1c')](function(_0x336e6b){logger['error'](_0x6c79('0x24'),_0x336e6b[_0x6c79('0x1b')],_0x531b0e);_0x236921(_0x2edfe0['error'](0x1f4,_0x336e6b['message']));});});};exports[_0x6c79('0x25')]=function(_0x4914c2){return new Promise(function(_0x55104d,_0x55194c){return db['ChatInteraction'][_0x6c79('0x26')]({'where':_0x4914c2[_0x6c79('0x1f')]?_0x4914c2['options']['where']||null:null})[_0x6c79('0x12')](function(_0x146595){if(_0x146595){return _0x146595[_0x6c79('0x27')](_0x4914c2[_0x6c79('0x1e')][_0x6c79('0x28')],_['omit'](_0x4914c2['body'],[_0x6c79('0x28'),'id'])||{});}})['spread'](function(_0xa8258d){logger[_0x6c79('0x13')](_0x6c79('0x29'),_0x4914c2);logger['debug'](_0x6c79('0x29'),_0x4914c2,JSON[_0x6c79('0x18')](_0xa8258d));_0x55104d(_0xa8258d);})[_0x6c79('0x1c')](function(_0x3c4800){logger[_0x6c79('0x19')](_0x6c79('0x29'),_0x3c4800['message'],_0x4914c2);_0x55194c(_this[_0x6c79('0x19')](0x1f4,_0x3c4800['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8c2916a..1f708c3 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 _0x0894=['emit','register','length','./chatInteraction.events'];(function(_0x439e5c,_0x4ce495){var _0x52e9da=function(_0xf54c2e){while(--_0xf54c2e){_0x439e5c['push'](_0x439e5c['shift']());}};_0x52e9da(++_0x4ce495);}(_0x0894,0xfb));var _0x4089=function(_0x4c6632,_0x374ff9){_0x4c6632=_0x4c6632-0x0;var _0x2b8101=_0x0894[_0x4c6632];return _0x2b8101;};'use strict';var ChatInteractionEvents=require(_0x4089('0x0'));var events=['save','remove','update'];function createListener(_0x24071e,_0x4d46f8){return function(_0x5c9f65){_0x4d46f8[_0x4089('0x1')](_0x24071e,_0x5c9f65);};}function removeListener(_0x13ff46,_0x3a1c37){return function(){ChatInteractionEvents['removeListener'](_0x13ff46,_0x3a1c37);};}exports[_0x4089('0x2')]=function(_0x3bdb44){for(var _0x1fadcb=0x0,_0x15f407=events[_0x4089('0x3')];_0x1fadcb<_0x15f407;_0x1fadcb++){var _0x57467d=events[_0x1fadcb];var _0x4e6ea9=createListener('chatInteraction:'+_0x57467d,_0x3bdb44);ChatInteractionEvents['on'](_0x57467d,_0x4e6ea9);}}; \ No newline at end of file +var _0xadce=['chatInteraction:','./chatInteraction.events','remove','removeListener','length'];(function(_0x3eeb40,_0x3a11d8){var _0x115527=function(_0x5c993e){while(--_0x5c993e){_0x3eeb40['push'](_0x3eeb40['shift']());}};_0x115527(++_0x3a11d8);}(_0xadce,0x1dc));var _0xeadc=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0xadce[_0x100e36];return _0x1df0c9;};'use strict';var ChatInteractionEvents=require(_0xeadc('0x0'));var events=['save',_0xeadc('0x1'),'update'];function createListener(_0x22594e,_0x3d2164){return function(_0x4c13ac){_0x3d2164['emit'](_0x22594e,_0x4c13ac);};}function removeListener(_0x2a93d3,_0x3cdaaa){return function(){ChatInteractionEvents[_0xeadc('0x2')](_0x2a93d3,_0x3cdaaa);};}exports['register']=function(_0x5db8d2){for(var _0x47afed=0x0,_0x51460f=events[_0xeadc('0x3')];_0x47afed<_0x51460f;_0x47afed++){var _0x368a9a=events[_0x47afed];var _0x4860de=createListener(_0xeadc('0x4')+_0x368a9a,_0x5db8d2);ChatInteractionEvents['on'](_0x368a9a,_0x4860de);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 7777988..888dd8a 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 _0x4578=['addMessage','/:id/tags','tracked','chat','addTags','/:id','chatinteraction:update','update','/:id/abandon','put','close','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','join','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4578,0x9d));var _0x8457=function(_0xef0568,_0x548dfe){_0xef0568=_0xef0568-0x0;var _0x420786=_0x4578[_0xef0568];return _0x420786;};'use strict';var multer=require('multer');var util=require(_0x8457('0x0'));var path=require(_0x8457('0x1'));var timeout=require(_0x8457('0x2'));var express=require(_0x8457('0x3'));var router=express[_0x8457('0x4')]();var auth=require(_0x8457('0x5'));var interaction=require(_0x8457('0x6'));var config=require(_0x8457('0x7'));var controller=require(_0x8457('0x8'));router[_0x8457('0x9')]('/',auth[_0x8457('0xa')](),controller[_0x8457('0xb')]);router[_0x8457('0x9')](_0x8457('0xc'),auth[_0x8457('0xa')](),controller[_0x8457('0xd')]);router[_0x8457('0x9')]('/:id',auth[_0x8457('0xe')](),controller[_0x8457('0xf')]);router[_0x8457('0x9')](_0x8457('0x10'),auth[_0x8457('0xe')](),controller['attachmentDownload']);router[_0x8457('0x9')](_0x8457('0x11'),auth['isAuthenticated'](),controller[_0x8457('0x12')]);router[_0x8457('0x9')](_0x8457('0x13'),auth[_0x8457('0xe')](),controller[_0x8457('0x14')]);router[_0x8457('0x9')](_0x8457('0x15'),auth['isAuthenticated'](),controller['download']);router[_0x8457('0x16')]('/',auth[_0x8457('0xa')](),controller[_0x8457('0x17')]);router['post'](_0x8457('0x18'),auth[_0x8457('0xa')](),controller[_0x8457('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb04d79,_0x2a83e3,_0x2c4e8d){_0x2c4e8d(null,path[_0x8457('0x1a')](config['root'],_0x8457('0x1b')));},'filename':function(_0xe12702,_0x1b8dce,_0x241d40){_0x241d40(null,util[_0x8457('0x1c')](_0x8457('0x1d'),Date[_0x8457('0x1e')](),_0x1b8dce[_0x8457('0x1f')][_0x8457('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8457('0x16')]('/:id/attachment_upload',upload[_0x8457('0x21')](_0x8457('0x22')),controller['attachmentUpload']);router[_0x8457('0x16')](_0x8457('0x11'),auth[_0x8457('0xe')](),controller[_0x8457('0x23')]);router[_0x8457('0x16')](_0x8457('0x24'),auth[_0x8457('0xa')](),interaction[_0x8457('0x25')](_0x8457('0x26'),'chatinteraction:addtags'),controller[_0x8457('0x27')]);router['put'](_0x8457('0x28'),auth[_0x8457('0xa')](),interaction['tracked']('chat',_0x8457('0x29')),controller[_0x8457('0x2a')]);router['put']('/:id/custom_update',controller['customUpdate']);router['put'](_0x8457('0x2b'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0x8457('0x2c')]('/:id/close',controller[_0x8457('0x2d')]);router[_0x8457('0x2e')](_0x8457('0x28'),auth[_0x8457('0xa')](),interaction[_0x8457('0x25')](_0x8457('0x26'),'chatinteraction:destroy'),controller['destroy']);router['delete'](_0x8457('0x24'),auth[_0x8457('0xa')](),controller['removeTags']);module[_0x8457('0x2f')]=router; \ No newline at end of file +var _0x75fd=['/describe','/:id','/:id/attachment_download','attachmentDownload','getMessages','isChatInteractionAuthorized','getMyMessages','/:id/download','download','create','post','diskStorage','root','now','originalname','replace','/:id/attachment_upload','single','file','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x462c93,_0x1e94df){var _0x2332bc=function(_0x4ce224){while(--_0x4ce224){_0x462c93['push'](_0x462c93['shift']());}};_0x2332bc(++_0x1e94df);}(_0x75fd,0x131));var _0xd75f=function(_0x3d71f2,_0x519c4c){_0x3d71f2=_0x3d71f2-0x0;var _0x4b1ea8=_0x75fd[_0x3d71f2];return _0x4b1ea8;};'use strict';var multer=require(_0xd75f('0x0'));var util=require(_0xd75f('0x1'));var path=require(_0xd75f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd75f('0x3'));var router=express[_0xd75f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd75f('0x5'));var config=require(_0xd75f('0x6'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0xd75f('0x7')](),controller[_0xd75f('0x8')]);router[_0xd75f('0x9')](_0xd75f('0xa'),auth[_0xd75f('0x7')](),controller['describe']);router[_0xd75f('0x9')](_0xd75f('0xb'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0xd75f('0x9')](_0xd75f('0xc'),auth['isChatInteractionAuthorized'](),controller[_0xd75f('0xd')]);router['get']('/:id/messages',auth[_0xd75f('0x7')](),controller[_0xd75f('0xe')]);router[_0xd75f('0x9')]('/:id/my_messages',auth[_0xd75f('0xf')](),controller[_0xd75f('0x10')]);router[_0xd75f('0x9')](_0xd75f('0x11'),auth['isAuthenticated'](),controller[_0xd75f('0x12')]);router['post']('/',auth[_0xd75f('0x7')](),controller[_0xd75f('0x13')]);router[_0xd75f('0x14')]('/:id/vidaoo',auth[_0xd75f('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xd75f('0x15')]({'destination':function(_0x3493c0,_0x5468d2,_0x178d76){_0x178d76(null,path['join'](config[_0xd75f('0x16')],'server/files/attachments/'));},'filename':function(_0xa719ee,_0x42334f,_0x3ef27e){_0x3ef27e(null,util['format']('%s-%s',Date[_0xd75f('0x17')](),_0x42334f[_0xd75f('0x18')][_0xd75f('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xd75f('0x1a'),upload[_0xd75f('0x1b')](_0xd75f('0x1c')),controller['attachmentUpload']);router[_0xd75f('0x14')](_0xd75f('0x1d'),auth[_0xd75f('0xf')](),controller[_0xd75f('0x1e')]);router[_0xd75f('0x14')](_0xd75f('0x1f'),auth['isAuthenticated'](),interaction[_0xd75f('0x20')](_0xd75f('0x21'),_0xd75f('0x22')),controller['addTags']);router[_0xd75f('0x23')](_0xd75f('0xb'),auth[_0xd75f('0x7')](),interaction[_0xd75f('0x20')](_0xd75f('0x21'),_0xd75f('0x24')),controller['update']);router[_0xd75f('0x23')]('/:id/custom_update',controller['customUpdate']);router[_0xd75f('0x23')](_0xd75f('0x25'),auth[_0xd75f('0xf')](),controller[_0xd75f('0x26')]);router[_0xd75f('0x23')](_0xd75f('0x27'),controller[_0xd75f('0x28')]);router[_0xd75f('0x29')](_0xd75f('0xb'),auth[_0xd75f('0x7')](),interaction[_0xd75f('0x20')](_0xd75f('0x21'),'chatinteraction:destroy'),controller[_0xd75f('0x2a')]);router[_0xd75f('0x29')](_0xd75f('0x1f'),auth[_0xd75f('0x7')](),controller[_0xd75f('0x2b')]);module[_0xd75f('0x2c')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 901980b..d06bc38 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 _0x1a85=['BOOLEAN','TEXT','medium'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0x1a85,0x178));var _0x51a8=function(_0x45a546,_0x11b6a6){_0x45a546=_0x45a546-0x0;var _0x3e5eac=_0x1a85[_0x45a546];return _0x3e5eac;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x51a8('0x0')](_0x51a8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4975=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4975,0x86));var _0x5497=function(_0x2d3bd1,_0x1de3d3){_0x2d3bd1=_0x2d3bd1-0x0;var _0x539ee6=_0x4975[_0x2d3bd1];return _0x539ee6;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'body':{'type':Sequelize[_0x5497('0x1')](_0x5497('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5497('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5497('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index d37ea5e..203123a 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 _0x3400=['User','agent','admin','user','fullname','role','userpic','lastLoginAt','allowmessenger','showWebBar','sort','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','filter','push','FromId','ToId','read','-createdAt','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','offset','set','Content-Range','json','apply','save','update','destroy','then','end','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','filters','pick','where','VIRTUAL','merge','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','getUsers'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3400,0x8a));var _0x0340=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x3400[_0x53cf8e];return _0x459197;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0340('0x0'));var zipdir=require(_0x0340('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0340('0x2'));var moment=require(_0x0340('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0340('0x4'));var util=require(_0x0340('0x5'));var path=require(_0x0340('0x6'));var sox=require(_0x0340('0x7'));var csv=require(_0x0340('0x8'));var ejs=require(_0x0340('0x9'));var fs=require('fs');var _=require(_0x0340('0xa'));var squel=require(_0x0340('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0340('0xc'));var toCsv=require(_0x0340('0x8'));var querystring=require(_0x0340('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0340('0xe'));var qs=require(_0x0340('0xf'));var as=require(_0x0340('0x10'));var hardwareService=require(_0x0340('0x11'));var logger=require('../../config/logger')(_0x0340('0x12'));var utils=require(_0x0340('0x13'));var config=require(_0x0340('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0340('0x15')]=_[_0x0340('0x16')](config[_0x0340('0x15')],{'host':_0x0340('0x17'),'port':0x18eb});var socket=require(_0x0340('0x18'))(new Redis(config[_0x0340('0x15')]));require(_0x0340('0x19'))[_0x0340('0x1a')](socket);function respondWithStatusCode(_0x2edfb9,_0x5e9fb0){_0x5e9fb0=_0x5e9fb0||0xcc;return function(_0x21d81b){if(_0x21d81b){return _0x2edfb9[_0x0340('0x1b')](_0x5e9fb0);}return _0x2edfb9[_0x0340('0x1c')](_0x5e9fb0)['end']();};}function respondWithResult(_0x3bac7c,_0x19409d){_0x19409d=_0x19409d||0xc8;return function(_0x32304b){if(_0x32304b){return _0x3bac7c[_0x0340('0x1c')](_0x19409d)['json'](_0x32304b);}};}function respondWithFilteredResult(_0x5ba076,_0x3edb81){return function(_0x2e42e6){if(_0x2e42e6){var _0x32bc4b=_0x2e42e6['count'],_0x23a3b9=_0x3edb81['offset'],_0x5901ed=_0x3edb81[_0x0340('0x1d')]+_0x3edb81['limit'],_0x12f422;if(_0x5901ed>=_0x32bc4b){_0x5901ed=_0x32bc4b;_0x12f422=0xc8;}else{_0x12f422=0xce;}_0x5ba076[_0x0340('0x1c')](_0x12f422);return _0x5ba076[_0x0340('0x1e')](_0x0340('0x1f'),_0x23a3b9+'-'+_0x5901ed+'/'+_0x32bc4b)[_0x0340('0x20')](_0x2e42e6);}return null;};}function patchUpdates(_0x7c53e6){return function(_0x38ed9a){try{jsonpatch[_0x0340('0x21')](_0x38ed9a,_0x7c53e6,!![]);}catch(_0x9b2c32){return BPromise['reject'](_0x9b2c32);}return _0x38ed9a[_0x0340('0x22')]();};}function saveUpdates(_0x1e2ceb,_0x20b610){return function(_0xd94a9f){if(_0xd94a9f){return _0xd94a9f[_0x0340('0x23')](_0x1e2ceb)['then'](function(_0x1a8055){return _0x1a8055;});}return null;};}function removeEntity(_0x2240de,_0x5eb5f9){return function(_0x12396e){if(_0x12396e){return _0x12396e[_0x0340('0x24')]()[_0x0340('0x25')](function(){_0x2240de[_0x0340('0x1c')](0xcc)[_0x0340('0x26')]();});}};}function handleEntityNotFound(_0x5169b3,_0x14b957){return function(_0x3778bc){if(!_0x3778bc){_0x5169b3['sendStatus'](0x194);}return _0x3778bc;};}function handleError(_0x16293c,_0x2e41d2){_0x2e41d2=_0x2e41d2||0x1f4;return function(_0x9474a4){logger[_0x0340('0x27')](_0x9474a4[_0x0340('0x28')]);if(_0x9474a4['name']){delete _0x9474a4[_0x0340('0x29')];}_0x16293c[_0x0340('0x1c')](_0x2e41d2)[_0x0340('0x2a')](_0x9474a4);};}exports[_0x0340('0x2b')]=function(_0x15040a,_0x2b32d7){var _0x582e07={},_0x32094b={},_0x87e552={'count':0x0,'rows':[]};var _0x42cc92=_[_0x0340('0x2c')](db[_0x0340('0x2d')][_0x0340('0x2e')],function(_0x175f13){return{'name':_0x175f13['fieldName'],'type':_0x175f13[_0x0340('0x2f')][_0x0340('0x30')]};});_0x32094b[_0x0340('0x31')]=_[_0x0340('0x2c')](_0x42cc92,_0x0340('0x29'));_0x32094b[_0x0340('0x32')]=_[_0x0340('0x33')](_0x15040a[_0x0340('0x32')]);_0x32094b['filters']=_[_0x0340('0x34')](_0x32094b[_0x0340('0x31')],_0x32094b[_0x0340('0x32')]);_0x582e07[_0x0340('0x35')]=_[_0x0340('0x34')](_0x32094b['model'],qs[_0x0340('0x36')](_0x15040a[_0x0340('0x32')][_0x0340('0x36')]));_0x582e07[_0x0340('0x35')]=_0x582e07[_0x0340('0x35')][_0x0340('0x37')]?_0x582e07[_0x0340('0x35')]:_0x32094b['model'];if(!_0x15040a[_0x0340('0x32')][_0x0340('0x38')](_0x0340('0x39'))){_0x582e07[_0x0340('0x3a')]=qs[_0x0340('0x3a')](_0x15040a[_0x0340('0x32')][_0x0340('0x3a')]);_0x582e07[_0x0340('0x1d')]=qs['offset'](_0x15040a['query'][_0x0340('0x1d')]);}_0x582e07[_0x0340('0x3b')]=qs['sort'](_0x15040a['query']['sort']);_0x582e07['where']=qs[_0x0340('0x3c')](_[_0x0340('0x3d')](_0x15040a[_0x0340('0x32')],_0x32094b[_0x0340('0x3c')]),_0x42cc92);if(_0x15040a['query']['filter']){_0x582e07['where']=_['merge'](_0x582e07[_0x0340('0x3e')],{'$or':_[_0x0340('0x2c')](_0x42cc92,function(_0x3d0cc5){if(_0x3d0cc5[_0x0340('0x2f')]!==_0x0340('0x3f')){var _0x4342f1={};_0x4342f1[_0x3d0cc5['name']]={'$like':'%'+_0x15040a['query']['filter']+'%'};return _0x4342f1;}})});}_0x582e07=_[_0x0340('0x40')]({},_0x582e07,_0x15040a['options']);var _0x14b3ea={'where':_0x582e07[_0x0340('0x3e')]};return db[_0x0340('0x2d')][_0x0340('0x41')](_0x14b3ea)[_0x0340('0x25')](function(_0x276674){_0x87e552[_0x0340('0x41')]=_0x276674;if(_0x15040a[_0x0340('0x32')][_0x0340('0x42')]){_0x582e07['include']=[{'all':!![]}];}return db[_0x0340('0x2d')][_0x0340('0x43')](_0x582e07);})['then'](function(_0xd2e3f5){_0x87e552[_0x0340('0x44')]=_0xd2e3f5;return _0x87e552;})[_0x0340('0x25')](respondWithFilteredResult(_0x2b32d7,_0x582e07))[_0x0340('0x45')](handleError(_0x2b32d7,null));};exports[_0x0340('0x46')]=function(_0x41f549,_0x50a8a2){var _0xca3757={'raw':!![],'where':{'id':_0x41f549[_0x0340('0x47')]['id']}},_0x191999={};_0x191999[_0x0340('0x31')]=_[_0x0340('0x33')](db[_0x0340('0x2d')][_0x0340('0x2e')]);_0x191999[_0x0340('0x32')]=_[_0x0340('0x33')](_0x41f549[_0x0340('0x32')]);_0x191999[_0x0340('0x3c')]=_[_0x0340('0x34')](_0x191999['model'],_0x191999['query']);_0xca3757[_0x0340('0x35')]=_[_0x0340('0x34')](_0x191999['model'],qs[_0x0340('0x36')](_0x41f549[_0x0340('0x32')][_0x0340('0x36')]));_0xca3757[_0x0340('0x35')]=_0xca3757[_0x0340('0x35')][_0x0340('0x37')]?_0xca3757[_0x0340('0x35')]:_0x191999[_0x0340('0x31')];if(_0x41f549['query'][_0x0340('0x42')]){_0xca3757[_0x0340('0x48')]=[{'all':!![]}];}_0xca3757=_[_0x0340('0x40')]({},_0xca3757,_0x41f549[_0x0340('0x49')]);return db['ChatInternalMessage'][_0x0340('0x4a')](_0xca3757)[_0x0340('0x25')](handleEntityNotFound(_0x50a8a2,null))[_0x0340('0x25')](respondWithResult(_0x50a8a2,null))['catch'](handleError(_0x50a8a2,null));};exports[_0x0340('0x4b')]=function(_0x46a865,_0x207954){return db[_0x0340('0x2d')][_0x0340('0x4b')](_0x46a865['body'],{})[_0x0340('0x25')](respondWithResult(_0x207954,0xc9))[_0x0340('0x45')](handleError(_0x207954,null));};exports['update']=function(_0x151087,_0x1c3f60){if(_0x151087[_0x0340('0x4c')]['id']){delete _0x151087[_0x0340('0x4c')]['id'];}return db[_0x0340('0x2d')][_0x0340('0x4a')]({'where':{'id':_0x151087[_0x0340('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c3f60,null))[_0x0340('0x25')](saveUpdates(_0x151087[_0x0340('0x4c')],null))['then'](respondWithResult(_0x1c3f60,null))[_0x0340('0x45')](handleError(_0x1c3f60,null));};exports['destroy']=function(_0x22a603,_0x4c4448){return db[_0x0340('0x2d')][_0x0340('0x4a')]({'where':{'id':_0x22a603[_0x0340('0x47')]['id']}})[_0x0340('0x25')](handleEntityNotFound(_0x4c4448,null))[_0x0340('0x25')](removeEntity(_0x4c4448,null))[_0x0340('0x45')](handleError(_0x4c4448,null));};exports[_0x0340('0x4d')]=function(_0x12b97d,_0x55edfb){return db['ChatInternalMessage']['describe']()[_0x0340('0x25')](respondWithResult(_0x55edfb,null))['catch'](handleError(_0x55edfb,null));};function wrapUser(_0x51d107){return function(_0x165b78){var _0x43c833=_0x51d107['get']({'plain':!![]});_0x43c833[_0x0340('0x4e')]=[];if(_0x165b78){_0x43c833[_0x0340('0x4f')]=_0x165b78[_0x0340('0x50')];_0x43c833[_0x0340('0x51')]=_0x165b78;}else{_0x43c833[_0x0340('0x4f')]=moment(0x0)[_0x0340('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x43c833[_0x0340('0x51')]={};}return _0x43c833;};}exports[_0x0340('0x53')]=function(_0x2b297b,_0x88a41e,_0x524a31){var _0x281542=[];return db[_0x0340('0x54')][_0x0340('0x43')]({'where':{'role':[_0x0340('0x55'),_0x0340('0x56'),_0x0340('0x57')]},'attributes':['id',_0x0340('0x58'),_0x0340('0x29'),_0x0340('0x59'),_0x0340('0x5a'),'internal','online',_0x0340('0x5b'),_0x0340('0x5c'),_0x0340('0x5d')],'order':qs[_0x0340('0x5e')](_0x0340('0x5f')),'include':[{'model':db[_0x0340('0x60')],'as':_0x0340('0x61'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x0340('0x25')](function(_0x3a12f4){if(_0x3a12f4){var _0x2528b9=_0x2b297b['user'][_0x0340('0x62')]({'plain':!![]});if(!_0x2528b9)throw new Error(_0x0340('0x63'));if(_0x2528b9['role']===_0x0340('0x57')){return db[_0x0340('0x64')][_0x0340('0x4a')]({'where':{'name':_0x0340('0x65'),'userProfileId':_0x2528b9[_0x0340('0x66')]},'raw':!![]})['then'](function(_0x293d6d){if(_0x293d6d){if(_0x293d6d[_0x0340('0x67')]===0x0){return db['UserProfileResource'][_0x0340('0x43')]({'where':{'sectionId':_0x293d6d['id']},'raw':!![]})[_0x0340('0x25')](function(_0x842ef9){var _0x4e8478=[];if(_[_0x0340('0x68')](_0x842ef9)){_0x4e8478=_[_0x0340('0x69')](_0x3a12f4,function(_0x5c97a8){if(_0x5c97a8[_0x0340('0x59')]!==_0x0340('0x55')){return _0x5c97a8;}});return _0x4e8478;}else{for(var _0x43ff51=0x0;_0x43ff51<_0x3a12f4[_0x0340('0x37')];_0x43ff51++){var _0x43600d=_0x3a12f4[_0x43ff51];if(_0x43600d[_0x0340('0x59')]===_0x0340('0x55')){var _0x2efc26=_[_0x0340('0x4a')](_0x842ef9,function(_0x3bca2c){return _0x3bca2c['resourceId']===_0x43600d['id'];});if(_0x2efc26)_0x4e8478[_0x0340('0x6a')](_0x43600d);}else{_0x4e8478[_0x0340('0x6a')](_0x43600d);}}return _0x4e8478;}});}else{return _0x3a12f4;}}else{var _0x404bdd=_['filter'](_0x3a12f4,function(_0x46e85f){if(_0x46e85f['role']!=='agent'){return _0x46e85f;}});return _0x404bdd;}});}else{return _0x3a12f4;}}})[_0x0340('0x25')](function(_0x297af2){var _0x305ae1=[];if(_0x297af2){_0x281542=_0x297af2;for(var _0x26678f=0x0;_0x26678f<_0x297af2[_0x0340('0x37')];_0x26678f+=0x1){_0x281542[_0x26678f][_0x0340('0x4e')]=[];_0x305ae1[_0x0340('0x6a')](db[_0x0340('0x2d')][_0x0340('0x4a')]({'where':{'FromId':[_0x2b297b[_0x0340('0x57')]['id'],_0x297af2[_0x26678f]['id']],'ToId':[_0x2b297b[_0x0340('0x57')]['id'],_0x297af2[_0x26678f]['id']],'ChatGroupId':null},'attributes':['id',_0x0340('0x50'),_0x0340('0x6b'),_0x0340('0x6c'),_0x0340('0x6d'),_0x0340('0x4c')],'order':qs['sort'](_0x0340('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x0340('0x25')](wrapUser(_0x297af2[_0x26678f])));}return BPromise['all'](_0x305ae1);}return[];})[_0x0340('0x25')](function(_0xdf1f74){return{'rows':_0xdf1f74,'count':_0xdf1f74['length']};})[_0x0340('0x25')](respondWithResult(_0x88a41e,null))[_0x0340('0x45')](handleError(_0x88a41e,null));}; \ No newline at end of file +var _0x0134=['api','../../config/license/util','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','get','messages','createdAt','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','allowmessenger','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','all','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2efe50,_0x24a6cb){var _0x1d7801=function(_0x5e2647){while(--_0x5e2647){_0x2efe50['push'](_0x2efe50['shift']());}};_0x1d7801(++_0x24a6cb);}(_0x0134,0xc3));var _0x4013=function(_0x8de950,_0x2693be){_0x8de950=_0x8de950-0x0;var _0x587a48=_0x0134[_0x8de950];return _0x587a48;};'use strict';var pdf=require(_0x4013('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4013('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4013('0x2'));var rp=require(_0x4013('0x3'));var moment=require('moment');var BPromise=require(_0x4013('0x4'));var Mustache=require(_0x4013('0x5'));var util=require(_0x4013('0x6'));var path=require(_0x4013('0x7'));var sox=require('sox');var csv=require(_0x4013('0x8'));var ejs=require(_0x4013('0x9'));var fs=require('fs');var _=require(_0x4013('0xa'));var squel=require(_0x4013('0xb'));var crypto=require(_0x4013('0xc'));var jsforce=require(_0x4013('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4013('0x8'));var querystring=require(_0x4013('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4013('0xf'));var as=require(_0x4013('0x10'));var hardwareService=require(_0x4013('0x11'));var logger=require(_0x4013('0x12'))(_0x4013('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4013('0x14'));var db=require('../../mysqldb')['db'];config[_0x4013('0x15')]=_[_0x4013('0x16')](config['redis'],{'host':_0x4013('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4013('0x15')]));require(_0x4013('0x18'))[_0x4013('0x19')](socket);function respondWithStatusCode(_0x7c0c70,_0xba4d47){_0xba4d47=_0xba4d47||0xcc;return function(_0x588de4){if(_0x588de4){return _0x7c0c70[_0x4013('0x1a')](_0xba4d47);}return _0x7c0c70['status'](_0xba4d47)['end']();};}function respondWithResult(_0x1975fd,_0x405bed){_0x405bed=_0x405bed||0xc8;return function(_0x5d1e6b){if(_0x5d1e6b){return _0x1975fd[_0x4013('0x1b')](_0x405bed)[_0x4013('0x1c')](_0x5d1e6b);}};}function respondWithFilteredResult(_0x1c05d5,_0x58824e){return function(_0x5999b2){if(_0x5999b2){var _0x343ddc=_0x5999b2[_0x4013('0x1d')],_0x31dc40=_0x58824e[_0x4013('0x1e')],_0x4e2ddb=_0x58824e['offset']+_0x58824e[_0x4013('0x1f')],_0x4e821f;if(_0x4e2ddb>=_0x343ddc){_0x4e2ddb=_0x343ddc;_0x4e821f=0xc8;}else{_0x4e821f=0xce;}_0x1c05d5[_0x4013('0x1b')](_0x4e821f);return _0x1c05d5[_0x4013('0x20')]('Content-Range',_0x31dc40+'-'+_0x4e2ddb+'/'+_0x343ddc)[_0x4013('0x1c')](_0x5999b2);}return null;};}function patchUpdates(_0x160e17){return function(_0x4ec6a0){try{jsonpatch[_0x4013('0x21')](_0x4ec6a0,_0x160e17,!![]);}catch(_0x4952a0){return BPromise[_0x4013('0x22')](_0x4952a0);}return _0x4ec6a0['save']();};}function saveUpdates(_0x5d199e,_0x1ae300){return function(_0x10e7fe){if(_0x10e7fe){return _0x10e7fe[_0x4013('0x23')](_0x5d199e)[_0x4013('0x24')](function(_0x2cc4ef){return _0x2cc4ef;});}return null;};}function removeEntity(_0x158504,_0x115901){return function(_0x22f5a4){if(_0x22f5a4){return _0x22f5a4[_0x4013('0x25')]()[_0x4013('0x24')](function(){_0x158504[_0x4013('0x1b')](0xcc)[_0x4013('0x26')]();});}};}function handleEntityNotFound(_0x3feddb,_0xf9d811){return function(_0x2fab2c){if(!_0x2fab2c){_0x3feddb[_0x4013('0x1a')](0x194);}return _0x2fab2c;};}function handleError(_0x496432,_0x12e6cf){_0x12e6cf=_0x12e6cf||0x1f4;return function(_0x2dedff){logger[_0x4013('0x27')](_0x2dedff[_0x4013('0x28')]);if(_0x2dedff[_0x4013('0x29')]){delete _0x2dedff[_0x4013('0x29')];}_0x496432[_0x4013('0x1b')](_0x12e6cf)[_0x4013('0x2a')](_0x2dedff);};}exports[_0x4013('0x2b')]=function(_0x42e83b,_0xa10a10){var _0x389adf={},_0x4f444f={},_0x584f9c={'count':0x0,'rows':[]};var _0x1dca28=_[_0x4013('0x2c')](db[_0x4013('0x2d')][_0x4013('0x2e')],function(_0x178f17){return{'name':_0x178f17['fieldName'],'type':_0x178f17[_0x4013('0x2f')][_0x4013('0x30')]};});_0x4f444f[_0x4013('0x31')]=_[_0x4013('0x2c')](_0x1dca28,'name');_0x4f444f['query']=_['keys'](_0x42e83b['query']);_0x4f444f[_0x4013('0x32')]=_[_0x4013('0x33')](_0x4f444f['model'],_0x4f444f[_0x4013('0x34')]);_0x389adf[_0x4013('0x35')]=_['intersection'](_0x4f444f[_0x4013('0x31')],qs[_0x4013('0x36')](_0x42e83b[_0x4013('0x34')][_0x4013('0x36')]));_0x389adf[_0x4013('0x35')]=_0x389adf[_0x4013('0x35')][_0x4013('0x37')]?_0x389adf[_0x4013('0x35')]:_0x4f444f[_0x4013('0x31')];if(!_0x42e83b['query'][_0x4013('0x38')]('nolimit')){_0x389adf[_0x4013('0x1f')]=qs['limit'](_0x42e83b[_0x4013('0x34')][_0x4013('0x1f')]);_0x389adf[_0x4013('0x1e')]=qs[_0x4013('0x1e')](_0x42e83b[_0x4013('0x34')]['offset']);}_0x389adf[_0x4013('0x39')]=qs[_0x4013('0x3a')](_0x42e83b['query']['sort']);_0x389adf[_0x4013('0x3b')]=qs[_0x4013('0x32')](_[_0x4013('0x3c')](_0x42e83b[_0x4013('0x34')],_0x4f444f[_0x4013('0x32')]),_0x1dca28);if(_0x42e83b[_0x4013('0x34')][_0x4013('0x3d')]){_0x389adf['where']=_[_0x4013('0x3e')](_0x389adf['where'],{'$or':_[_0x4013('0x2c')](_0x1dca28,function(_0x4f7f59){if(_0x4f7f59[_0x4013('0x2f')]!==_0x4013('0x3f')){var _0x5ad16f={};_0x5ad16f[_0x4f7f59[_0x4013('0x29')]]={'$like':'%'+_0x42e83b[_0x4013('0x34')]['filter']+'%'};return _0x5ad16f;}})});}_0x389adf=_[_0x4013('0x3e')]({},_0x389adf,_0x42e83b[_0x4013('0x40')]);var _0x5294f0={'where':_0x389adf[_0x4013('0x3b')]};return db[_0x4013('0x2d')]['count'](_0x5294f0)[_0x4013('0x24')](function(_0x2335c7){_0x584f9c[_0x4013('0x1d')]=_0x2335c7;if(_0x42e83b['query'][_0x4013('0x41')]){_0x389adf[_0x4013('0x42')]=[{'all':!![]}];}return db[_0x4013('0x2d')][_0x4013('0x43')](_0x389adf);})[_0x4013('0x24')](function(_0x5d25b9){_0x584f9c[_0x4013('0x44')]=_0x5d25b9;return _0x584f9c;})['then'](respondWithFilteredResult(_0xa10a10,_0x389adf))['catch'](handleError(_0xa10a10,null));};exports['show']=function(_0x51fde0,_0x3b787f){var _0x379214={'raw':!![],'where':{'id':_0x51fde0[_0x4013('0x45')]['id']}},_0x1c0e2a={};_0x1c0e2a[_0x4013('0x31')]=_[_0x4013('0x46')](db['ChatInternalMessage'][_0x4013('0x2e')]);_0x1c0e2a['query']=_[_0x4013('0x46')](_0x51fde0['query']);_0x1c0e2a['filters']=_[_0x4013('0x33')](_0x1c0e2a[_0x4013('0x31')],_0x1c0e2a[_0x4013('0x34')]);_0x379214[_0x4013('0x35')]=_[_0x4013('0x33')](_0x1c0e2a[_0x4013('0x31')],qs[_0x4013('0x36')](_0x51fde0['query'][_0x4013('0x36')]));_0x379214[_0x4013('0x35')]=_0x379214[_0x4013('0x35')][_0x4013('0x37')]?_0x379214[_0x4013('0x35')]:_0x1c0e2a[_0x4013('0x31')];if(_0x51fde0['query'][_0x4013('0x41')]){_0x379214[_0x4013('0x42')]=[{'all':!![]}];}_0x379214=_[_0x4013('0x3e')]({},_0x379214,_0x51fde0['options']);return db[_0x4013('0x2d')][_0x4013('0x47')](_0x379214)[_0x4013('0x24')](handleEntityNotFound(_0x3b787f,null))['then'](respondWithResult(_0x3b787f,null))[_0x4013('0x48')](handleError(_0x3b787f,null));};exports[_0x4013('0x49')]=function(_0x2668b8,_0x57c27f){return db[_0x4013('0x2d')][_0x4013('0x49')](_0x2668b8[_0x4013('0x4a')],{})['then'](respondWithResult(_0x57c27f,0xc9))['catch'](handleError(_0x57c27f,null));};exports[_0x4013('0x23')]=function(_0x2fb5fc,_0x51f428){if(_0x2fb5fc[_0x4013('0x4a')]['id']){delete _0x2fb5fc[_0x4013('0x4a')]['id'];}return db['ChatInternalMessage'][_0x4013('0x47')]({'where':{'id':_0x2fb5fc['params']['id']}})[_0x4013('0x24')](handleEntityNotFound(_0x51f428,null))[_0x4013('0x24')](saveUpdates(_0x2fb5fc[_0x4013('0x4a')],null))[_0x4013('0x24')](respondWithResult(_0x51f428,null))[_0x4013('0x48')](handleError(_0x51f428,null));};exports[_0x4013('0x25')]=function(_0xfad765,_0x222696){return db[_0x4013('0x2d')][_0x4013('0x47')]({'where':{'id':_0xfad765[_0x4013('0x45')]['id']}})[_0x4013('0x24')](handleEntityNotFound(_0x222696,null))[_0x4013('0x24')](removeEntity(_0x222696,null))[_0x4013('0x48')](handleError(_0x222696,null));};exports['describe']=function(_0x6f2d3b,_0x3e1f46){return db[_0x4013('0x2d')][_0x4013('0x4b')]()[_0x4013('0x24')](respondWithResult(_0x3e1f46,null))[_0x4013('0x48')](handleError(_0x3e1f46,null));};function wrapUser(_0x451ebb){return function(_0x522fab){var _0x1d9cc2=_0x451ebb[_0x4013('0x4c')]({'plain':!![]});_0x1d9cc2[_0x4013('0x4d')]=[];if(_0x522fab){_0x1d9cc2['lastMessageAt']=_0x522fab[_0x4013('0x4e')];_0x1d9cc2['lastMessage']=_0x522fab;}else{_0x1d9cc2[_0x4013('0x4f')]=moment(0x0)[_0x4013('0x50')](_0x4013('0x51'));_0x1d9cc2[_0x4013('0x52')]={};}return _0x1d9cc2;};}exports[_0x4013('0x53')]=function(_0x2daffc,_0x2e4a7f,_0x44c02d){var _0x593096=[];return db[_0x4013('0x54')][_0x4013('0x43')]({'where':{'role':[_0x4013('0x55'),_0x4013('0x56'),_0x4013('0x57')]},'attributes':['id',_0x4013('0x58'),_0x4013('0x29'),_0x4013('0x59'),_0x4013('0x5a'),_0x4013('0x5b'),_0x4013('0x5c'),'lastLoginAt',_0x4013('0x5d'),'showWebBar'],'order':qs[_0x4013('0x3a')]('-online'),'include':[{'model':db[_0x4013('0x5e')],'as':'VoiceQueues','attributes':['id','name',_0x4013('0x2f')],'through':{'attributes':[]}}]})[_0x4013('0x24')](function(_0x4b7e67){if(_0x4b7e67){var _0x4ace6e=_0x2daffc[_0x4013('0x57')][_0x4013('0x4c')]({'plain':!![]});if(!_0x4ace6e)throw new Error(_0x4013('0x5f'));if(_0x4ace6e[_0x4013('0x59')]===_0x4013('0x57')){return db[_0x4013('0x60')][_0x4013('0x47')]({'where':{'name':'Agents','userProfileId':_0x4ace6e[_0x4013('0x61')]},'raw':!![]})[_0x4013('0x24')](function(_0x50dda4){if(_0x50dda4){if(_0x50dda4[_0x4013('0x62')]===0x0){return db[_0x4013('0x63')][_0x4013('0x43')]({'where':{'sectionId':_0x50dda4['id']},'raw':!![]})[_0x4013('0x24')](function(_0x4aeb19){var _0x4c80f5=[];if(_[_0x4013('0x64')](_0x4aeb19)){_0x4c80f5=_[_0x4013('0x3d')](_0x4b7e67,function(_0x34af91){if(_0x34af91['role']!==_0x4013('0x55')){return _0x34af91;}});return _0x4c80f5;}else{for(var _0x387e92=0x0;_0x387e92<_0x4b7e67[_0x4013('0x37')];_0x387e92++){var _0x5b7763=_0x4b7e67[_0x387e92];if(_0x5b7763[_0x4013('0x59')]==='agent'){var _0x4b2af5=_['find'](_0x4aeb19,function(_0x72bf51){return _0x72bf51[_0x4013('0x65')]===_0x5b7763['id'];});if(_0x4b2af5)_0x4c80f5[_0x4013('0x66')](_0x5b7763);}else{_0x4c80f5[_0x4013('0x66')](_0x5b7763);}}return _0x4c80f5;}});}else{return _0x4b7e67;}}else{var _0x483424=_['filter'](_0x4b7e67,function(_0x4a64e0){if(_0x4a64e0['role']!==_0x4013('0x55')){return _0x4a64e0;}});return _0x483424;}});}else{return _0x4b7e67;}}})['then'](function(_0x480aaa){var _0x44852a=[];if(_0x480aaa){_0x593096=_0x480aaa;for(var _0x24644c=0x0;_0x24644c<_0x480aaa[_0x4013('0x37')];_0x24644c+=0x1){_0x593096[_0x24644c]['messages']=[];_0x44852a['push'](db[_0x4013('0x2d')]['find']({'where':{'FromId':[_0x2daffc[_0x4013('0x57')]['id'],_0x480aaa[_0x24644c]['id']],'ToId':[_0x2daffc[_0x4013('0x57')]['id'],_0x480aaa[_0x24644c]['id']],'ChatGroupId':null},'attributes':['id',_0x4013('0x4e'),_0x4013('0x67'),'ToId',_0x4013('0x68'),_0x4013('0x4a')],'order':qs[_0x4013('0x3a')](_0x4013('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4013('0x24')](wrapUser(_0x480aaa[_0x24644c])));}return BPromise[_0x4013('0x6a')](_0x44852a);}return[];})[_0x4013('0x24')](function(_0x11b941){return{'rows':_0x11b941,'count':_0x11b941[_0x4013('0x37')]};})[_0x4013('0x24')](respondWithResult(_0x2e4a7f,null))[_0x4013('0x48')](handleError(_0x2e4a7f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 68a6728..1a85f5b 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 _0x1fec=['remove','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update'];(function(_0x2519d6,_0x303a5a){var _0x3a96c2=function(_0x1b117e){while(--_0x1b117e){_0x2519d6['push'](_0x2519d6['shift']());}};_0x3a96c2(++_0x303a5a);}(_0x1fec,0x1ea));var _0xc1fe=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x1fec[_0x13ea00];return _0x1f7347;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xc1fe('0x0'))['db'][_0xc1fe('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xc1fe('0x2')](0x0);var events={'afterCreate':_0xc1fe('0x3'),'afterUpdate':_0xc1fe('0x4'),'afterDestroy':_0xc1fe('0x5')};function emitEvent(_0x391d0f){return function(_0x381dfc,_0x4d2952,_0x39f5e5){ChatInternalMessageEvents['emit'](_0x391d0f+':'+_0x381dfc['id'],_0x381dfc);ChatInternalMessageEvents['emit'](_0x391d0f,_0x381dfc);_0x39f5e5(null);};}for(var e in events){if(events[_0xc1fe('0x6')](e)){var event=events[e];ChatInternalMessage[_0xc1fe('0x7')](e,emitEvent(event));}}module[_0xc1fe('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xaeaf=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x41bc2a,_0x5d16b8){var _0xe0e3d9=function(_0x28ebf6){while(--_0x28ebf6){_0x41bc2a['push'](_0x41bc2a['shift']());}};_0xe0e3d9(++_0x5d16b8);}(_0xaeaf,0x14e));var _0xfaea=function(_0x284240,_0x555b56){_0x284240=_0x284240-0x0;var _0x390667=_0xaeaf[_0x284240];return _0x390667;};'use strict';var EventEmitter=require(_0xfaea('0x0'));var ChatInternalMessage=require(_0xfaea('0x1'))['db'][_0xfaea('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xfaea('0x3')](0x0);var events={'afterCreate':_0xfaea('0x4'),'afterUpdate':_0xfaea('0x5'),'afterDestroy':_0xfaea('0x6')};function emitEvent(_0x5f592a){return function(_0xe432fa,_0x2061d3,_0x265544){ChatInternalMessageEvents[_0xfaea('0x7')](_0x5f592a+':'+_0xe432fa['id'],_0xe432fa);ChatInternalMessageEvents['emit'](_0x5f592a,_0xe432fa);_0x265544(null);};}for(var e in events){if(events[_0xfaea('0x8')](e)){var event=events[e];ChatInternalMessage[_0xfaea('0x9')](e,emitEvent(event));}}module[_0xfaea('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 4c708b7..3930119 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 _0xb7e7=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','define'];(function(_0x4635da,_0x5ae653){var _0x2769ed=function(_0x338651){while(--_0x338651){_0x4635da['push'](_0x4635da['shift']());}};_0x2769ed(++_0x5ae653);}(_0xb7e7,0x121));var _0x7b7e=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb7e7[_0x173441];return _0x2423a8;};'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 +var _0xac4a=['bluebird','rimraf','../../config/environment','./chatInternalMessage.attributes','define','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x5c846d,_0x5c02ce){var _0xd064e4=function(_0x5631f3){while(--_0x5631f3){_0x5c846d['push'](_0x5c846d['shift']());}};_0xd064e4(++_0x5c02ce);}(_0xac4a,0x13f));var _0xaac4=function(_0x5f0dfd,_0x42ac17){_0x5f0dfd=_0x5f0dfd-0x0;var _0xe62a37=_0xac4a[_0x5f0dfd];return _0xe62a37;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('ChatInternalMessage',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaac4('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 7c27104..885b3d3 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 _0x76eb=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x76eb,0x106));var _0xb76e=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x76eb[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0xb76e('0x0'));var util=require(_0xb76e('0x1'));var moment=require(_0xb76e('0x2'));var BPromise=require(_0xb76e('0x3'));var rs=require(_0xb76e('0x4'));var fs=require('fs');var Redis=require(_0xb76e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb76e('0x6'));var logger=require(_0xb76e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb76e('0x8'));var client=jayson[_0xb76e('0x9')][_0xb76e('0xa')]({'port':0x232a});config[_0xb76e('0xb')]=_[_0xb76e('0xc')](config[_0xb76e('0xb')],{'host':_0xb76e('0xd'),'port':0x18eb});var socket=require(_0xb76e('0xe'))(new Redis(config['redis']));require(_0xb76e('0xf'))['register'](socket);function respondWithRpcPromise(_0x4c3838,_0xc8f1a4,_0x46f851){return new BPromise(function(_0x291152,_0x45d2a6){return client[_0xb76e('0x10')](_0x4c3838,_0x46f851)[_0xb76e('0x11')](function(_0x19f020){logger[_0xb76e('0x12')](_0xb76e('0x13'),_0xc8f1a4,'request\x20sent');logger[_0xb76e('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xc8f1a4,_0xb76e('0x15'),JSON[_0xb76e('0x16')](_0x19f020));if(_0x19f020[_0xb76e('0x17')]){if(_0x19f020[_0xb76e('0x17')][_0xb76e('0x18')]===0x1f4){logger[_0xb76e('0x17')](_0xb76e('0x13'),_0xc8f1a4,_0x19f020[_0xb76e('0x17')][_0xb76e('0x19')]);return _0x45d2a6(_0x19f020[_0xb76e('0x17')][_0xb76e('0x19')]);}logger[_0xb76e('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0xc8f1a4,_0x19f020['error'][_0xb76e('0x19')]);return _0x291152(_0x19f020[_0xb76e('0x17')][_0xb76e('0x19')]);}else{logger['info'](_0xb76e('0x13'),_0xc8f1a4,'request\x20sent');_0x291152(_0x19f020[_0xb76e('0x1a')][_0xb76e('0x19')]);}})['catch'](function(_0x3fce6a){logger[_0xb76e('0x17')](_0xb76e('0x13'),_0xc8f1a4,_0x3fce6a);_0x45d2a6(_0x3fce6a);});});} \ No newline at end of file +var _0x799f=['defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0x799f,0x1d0));var _0xf799=function(_0x5013f2,_0x3d896b){_0x5013f2=_0x5013f2-0x0;var _0x166b9f=_0x799f[_0x5013f2];return _0x166b9f;};'use strict';var _=require(_0xf799('0x0'));var util=require(_0xf799('0x1'));var moment=require(_0xf799('0x2'));var BPromise=require(_0xf799('0x3'));var rs=require(_0xf799('0x4'));var fs=require('fs');var Redis=require(_0xf799('0x5'));var db=require(_0xf799('0x6'))['db'];var utils=require(_0xf799('0x7'));var logger=require('../../config/logger')(_0xf799('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf799('0x9')][_0xf799('0xa')]({'port':0x232a});config[_0xf799('0xb')]=_[_0xf799('0xc')](config['redis'],{'host':_0xf799('0xd'),'port':0x18eb});var socket=require(_0xf799('0xe'))(new Redis(config[_0xf799('0xb')]));require(_0xf799('0xf'))[_0xf799('0x10')](socket);function respondWithRpcPromise(_0x1e8c37,_0x17d0f5,_0x1019d6){return new BPromise(function(_0x3c7782,_0x651e79){return client['request'](_0x1e8c37,_0x1019d6)['then'](function(_0x3495d7){logger[_0xf799('0x11')](_0xf799('0x12'),_0x17d0f5,_0xf799('0x13'));logger[_0xf799('0x14')](_0xf799('0x15'),_0x17d0f5,_0xf799('0x13'),JSON[_0xf799('0x16')](_0x3495d7));if(_0x3495d7['error']){if(_0x3495d7['error'][_0xf799('0x17')]===0x1f4){logger[_0xf799('0x18')](_0xf799('0x12'),_0x17d0f5,_0x3495d7[_0xf799('0x18')]['message']);return _0x651e79(_0x3495d7[_0xf799('0x18')][_0xf799('0x19')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x17d0f5,_0x3495d7[_0xf799('0x18')][_0xf799('0x19')]);return _0x3c7782(_0x3495d7['error']['message']);}else{logger[_0xf799('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x17d0f5,_0xf799('0x13'));_0x3c7782(_0x3495d7[_0xf799('0x1a')][_0xf799('0x19')]);}})[_0xf799('0x1b')](function(_0x18dc10){logger[_0xf799('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x17d0f5,_0x18dc10);_0x651e79(_0x18dc10);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 63f5b5c..93fb49a 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 _0x702d=['remove','update','emit','register','length','./chatInternalMessage.events','save'];(function(_0x5b9fcd,_0x357916){var _0x1ffdf8=function(_0x1404fa){while(--_0x1404fa){_0x5b9fcd['push'](_0x5b9fcd['shift']());}};_0x1ffdf8(++_0x357916);}(_0x702d,0x147));var _0xd702=function(_0x3c7216,_0x27bedb){_0x3c7216=_0x3c7216-0x0;var _0xc6669a=_0x702d[_0x3c7216];return _0xc6669a;};'use strict';var ChatInternalMessageEvents=require(_0xd702('0x0'));var events=[_0xd702('0x1'),_0xd702('0x2'),_0xd702('0x3')];function createListener(_0x37ed5c,_0x5c2b9e){return function(_0x20c11a){_0x5c2b9e[_0xd702('0x4')](_0x37ed5c,_0x20c11a);};}function removeListener(_0x27b260,_0x1c5a32){return function(){ChatInternalMessageEvents['removeListener'](_0x27b260,_0x1c5a32);};}exports[_0xd702('0x5')]=function(_0x544e94){for(var _0x1aecfc=0x0,_0x3a2c03=events[_0xd702('0x6')];_0x1aecfc<_0x3a2c03;_0x1aecfc++){var _0x5af246=events[_0x1aecfc];var _0x12bb75=createListener('chatInternalMessage:'+_0x5af246,_0x544e94);ChatInternalMessageEvents['on'](_0x5af246,_0x12bb75);}}; \ No newline at end of file +var _0x5640=['./chatInternalMessage.events','remove','update','emit','removeListener','register','chatInternalMessage:'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x5640,0x111));var _0x0564=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5640[_0x17d9e3];return _0x14192d;};'use strict';var ChatInternalMessageEvents=require(_0x0564('0x0'));var events=['save',_0x0564('0x1'),_0x0564('0x2')];function createListener(_0x8ebafe,_0xa50680){return function(_0xc558b4){_0xa50680[_0x0564('0x3')](_0x8ebafe,_0xc558b4);};}function removeListener(_0x1cbb9d,_0x1c229d){return function(){ChatInternalMessageEvents[_0x0564('0x4')](_0x1cbb9d,_0x1c229d);};}exports[_0x0564('0x5')]=function(_0x23566f){for(var _0x1260bf=0x0,_0x3deac1=events['length'];_0x1260bf<_0x3deac1;_0x1260bf++){var _0x52b032=events[_0x1260bf];var _0x9e3a60=createListener(_0x0564('0x6')+_0x52b032,_0x23566f);ChatInternalMessageEvents['on'](_0x52b032,_0x9e3a60);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4e15335..2161cd1 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(_0x468a49,_0x14bf3f){var _0x2ac7b1=function(_0x316e51){while(--_0x316e51){_0x468a49['push'](_0x468a49['shift']());}};_0x2ac7b1(++_0x14bf3f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xb7e7[_0x5037ab];return _0x512adb;};'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 _0xb7e7=['exports','multer','path','express','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','/users','getUsers','/:id','post','create','put','update','delete'];(function(_0x3f8983,_0x2af9cb){var _0x3f594f=function(_0x403ccb){while(--_0x403ccb){_0x3f8983['push'](_0x3f8983['shift']());}};_0x3f594f(++_0x2af9cb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb7e7[_0x3947c9];return _0x2e7871;};'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 diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 8feeda9..598b690 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 _0x4776=['ENUM','out','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x37d5b7,_0x17c74e){var _0x47b785=function(_0x198925){while(--_0x198925){_0x37d5b7['push'](_0x37d5b7['shift']());}};_0x47b785(++_0x17c74e);}(_0x4776,0xb2));var _0x6477=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x4776[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require('sequelize');module[_0x6477('0x0')]={'body':{'type':Sequelize[_0x6477('0x1')](_0x6477('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6477('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6477('0x4')]('in',_0x6477('0x5')),'defaultValue':_0x6477('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6477('0x6')]},'providerResponse':{'type':Sequelize[_0x6477('0x1')]}}; \ No newline at end of file +var _0x65fb=['sequelize','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x65fb,0x138));var _0xb65f=function(_0x5499ab,_0x4c1128){_0x5499ab=_0x5499ab-0x0;var _0x344478=_0x65fb[_0x5499ab];return _0x344478;};'use strict';var Sequelize=require(_0xb65f('0x0'));module['exports']={'body':{'type':Sequelize[_0xb65f('0x1')](_0xb65f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb65f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb65f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xb65f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xb65f('0x5')]},'providerResponse':{'type':Sequelize[_0xb65f('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 5dc070e..1cb1c03 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 _0x1b7c=['null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','parse','formData','stringify','RejectMessage','rejectMessage','interface','event','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','stack','name','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','CmContact','Contact','get','ChatInteraction','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction'];(function(_0x1475be,_0x4ed47c){var _0x306b4e=function(_0x991d85){while(--_0x991d85){_0x1475be['push'](_0x1475be['shift']());}};_0x306b4e(++_0x4ed47c);}(_0x1b7c,0x180));var _0xc1b7=function(_0x374270,_0x47c703){_0x374270=_0x374270-0x0;var _0x59791f=_0x1b7c[_0x374270];return _0x59791f;};'use strict';var pdf=require(_0xc1b7('0x0'));var emlformat=require(_0xc1b7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc1b7('0x2'));var jsonpatch=require(_0xc1b7('0x3'));var rp=require('request-promise');var moment=require(_0xc1b7('0x4'));var BPromise=require(_0xc1b7('0x5'));var Mustache=require(_0xc1b7('0x6'));var util=require(_0xc1b7('0x7'));var path=require(_0xc1b7('0x8'));var sox=require(_0xc1b7('0x9'));var csv=require('to-csv');var ejs=require(_0xc1b7('0xa'));var fs=require('fs');var _=require(_0xc1b7('0xb'));var squel=require(_0xc1b7('0xc'));var crypto=require(_0xc1b7('0xd'));var jsforce=require(_0xc1b7('0xe'));var deskjs=require(_0xc1b7('0xf'));var toCsv=require(_0xc1b7('0x10'));var querystring=require(_0xc1b7('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc1b7('0x12'));var qs=require(_0xc1b7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1b7('0x14'))(_0xc1b7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc1b7('0x16'));var db=require('../../mysqldb')['db'];config[_0xc1b7('0x17')]=_[_0xc1b7('0x18')](config[_0xc1b7('0x17')],{'host':_0xc1b7('0x19'),'port':0x18eb});var socket=require(_0xc1b7('0x1a'))(new Redis(config[_0xc1b7('0x17')]));require(_0xc1b7('0x1b'))[_0xc1b7('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc1b7('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xc1b7('0x1d')][_0xc1b7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x19cdab,_0x19a65b,_0x2ca65a,_0xc9ce79){return new BPromise(function(_0x323de8,_0x34988b){var _0x2ac239=_0xc9ce79||client;return _0x2ac239['request'](_0x19cdab,_0x2ca65a)[_0xc1b7('0x1f')](function(_0x20154c){logger[_0xc1b7('0x20')]('ChatMessage,\x20%s,\x20%s',_0x19a65b,_0xc1b7('0x21'));logger[_0xc1b7('0x22')](_0xc1b7('0x23'),_0x19a65b,_0xc1b7('0x21'),JSON['stringify'](_0x20154c));if(_0x20154c[_0xc1b7('0x24')]){if(_0x20154c[_0xc1b7('0x24')][_0xc1b7('0x25')]===0x1f4){logger[_0xc1b7('0x24')](_0xc1b7('0x26'),_0x19a65b,_0x20154c[_0xc1b7('0x24')]['message']);return _0x34988b(_0x20154c[_0xc1b7('0x24')][_0xc1b7('0x27')]);}logger['error'](_0xc1b7('0x26'),_0x19a65b,_0x20154c[_0xc1b7('0x24')]['message']);return _0x323de8(_0x20154c['error'][_0xc1b7('0x27')]);}else{logger[_0xc1b7('0x20')](_0xc1b7('0x26'),_0x19a65b,'request\x20sent');_0x323de8(_0x20154c['result']['message']);}})['catch'](function(_0x33131e){logger[_0xc1b7('0x24')](_0xc1b7('0x26'),_0x19a65b,_0x33131e);_0x34988b(_0x33131e);});});}function respondWithStatusCode(_0x5416ab,_0x103390){_0x103390=_0x103390||0xcc;return function(_0xf4c81b){if(_0xf4c81b){return _0x5416ab[_0xc1b7('0x28')](_0x103390);}return _0x5416ab[_0xc1b7('0x29')](_0x103390)['end']();};}function respondWithResult(_0x393c11,_0x558638){_0x558638=_0x558638||0xc8;return function(_0x536fdb){if(_0x536fdb){return _0x393c11['status'](_0x558638)['json'](_0x536fdb);}};}function respondWithFilteredResult(_0x22c24b,_0x45f253){return function(_0x261e42){if(_0x261e42){var _0x2fa3fb=_0x261e42[_0xc1b7('0x2a')],_0x5cff0d=_0x45f253['offset'],_0x310cb2=_0x45f253[_0xc1b7('0x2b')]+_0x45f253[_0xc1b7('0x2c')],_0x44f11d;if(_0x310cb2>=_0x2fa3fb){_0x310cb2=_0x2fa3fb;_0x44f11d=0xc8;}else{_0x44f11d=0xce;}_0x22c24b[_0xc1b7('0x29')](_0x44f11d);return _0x22c24b[_0xc1b7('0x2d')](_0xc1b7('0x2e'),_0x5cff0d+'-'+_0x310cb2+'/'+_0x2fa3fb)[_0xc1b7('0x2f')](_0x261e42);}return null;};}function patchUpdates(_0x22ef4b){return function(_0x115888){try{jsonpatch['apply'](_0x115888,_0x22ef4b,!![]);}catch(_0x43a18a){return BPromise[_0xc1b7('0x30')](_0x43a18a);}return _0x115888[_0xc1b7('0x31')]();};}function saveUpdates(_0x17feb9,_0x3339a4){return function(_0x5563f0){if(_0x5563f0){return _0x5563f0[_0xc1b7('0x32')](_0x17feb9)[_0xc1b7('0x1f')](function(_0x2ba403){return _0x2ba403;});}return null;};}function removeEntity(_0xdd7d79,_0x3e74d5){return function(_0x1b4623){if(_0x1b4623){return _0x1b4623['destroy']()[_0xc1b7('0x1f')](function(){_0xdd7d79['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x474f4c,_0x5342a0){return function(_0x1cbbeb){if(!_0x1cbbeb){_0x474f4c[_0xc1b7('0x28')](0x194);}return _0x1cbbeb;};}function handleError(_0x508f7b,_0x46b586){_0x46b586=_0x46b586||0x1f4;return function(_0x2d1796){logger[_0xc1b7('0x24')](_0x2d1796[_0xc1b7('0x33')]);if(_0x2d1796[_0xc1b7('0x34')]){delete _0x2d1796['name'];}_0x508f7b[_0xc1b7('0x29')](_0x46b586)['send'](_0x2d1796);};}exports['index']=function(_0x46e0b0,_0x243a15){var _0x4bd8bb={},_0x1dfd39={},_0x5bba19={'count':0x0,'rows':[]};var _0x289748=_[_0xc1b7('0x35')](db[_0xc1b7('0x36')][_0xc1b7('0x37')],function(_0x43689c){return{'name':_0x43689c[_0xc1b7('0x38')],'type':_0x43689c[_0xc1b7('0x39')][_0xc1b7('0x3a')]};});_0x1dfd39[_0xc1b7('0x3b')]=_[_0xc1b7('0x35')](_0x289748,_0xc1b7('0x34'));_0x1dfd39[_0xc1b7('0x3c')]=_[_0xc1b7('0x3d')](_0x46e0b0[_0xc1b7('0x3c')]);_0x1dfd39[_0xc1b7('0x3e')]=_[_0xc1b7('0x3f')](_0x1dfd39[_0xc1b7('0x3b')],_0x1dfd39['query']);_0x4bd8bb[_0xc1b7('0x40')]=_[_0xc1b7('0x3f')](_0x1dfd39[_0xc1b7('0x3b')],qs['fields'](_0x46e0b0[_0xc1b7('0x3c')][_0xc1b7('0x41')]));_0x4bd8bb[_0xc1b7('0x40')]=_0x4bd8bb[_0xc1b7('0x40')]['length']?_0x4bd8bb['attributes']:_0x1dfd39['model'];if(!_0x46e0b0[_0xc1b7('0x3c')][_0xc1b7('0x42')](_0xc1b7('0x43'))){_0x4bd8bb[_0xc1b7('0x2c')]=qs[_0xc1b7('0x2c')](_0x46e0b0['query'][_0xc1b7('0x2c')]);_0x4bd8bb[_0xc1b7('0x2b')]=qs[_0xc1b7('0x2b')](_0x46e0b0[_0xc1b7('0x3c')][_0xc1b7('0x2b')]);}_0x4bd8bb[_0xc1b7('0x44')]=qs[_0xc1b7('0x45')](_0x46e0b0[_0xc1b7('0x3c')]['sort']);_0x4bd8bb['where']=qs['filters'](_[_0xc1b7('0x46')](_0x46e0b0[_0xc1b7('0x3c')],_0x1dfd39[_0xc1b7('0x3e')]),_0x289748);if(_0x46e0b0[_0xc1b7('0x3c')][_0xc1b7('0x47')]){_0x4bd8bb[_0xc1b7('0x48')]=_[_0xc1b7('0x49')](_0x4bd8bb['where'],{'$or':_['map'](_0x289748,function(_0x4b900d){if(_0x4b900d[_0xc1b7('0x39')]!==_0xc1b7('0x4a')){var _0xd352bc={};_0xd352bc[_0x4b900d['name']]={'$like':'%'+_0x46e0b0['query'][_0xc1b7('0x47')]+'%'};return _0xd352bc;}})});}_0x4bd8bb=_[_0xc1b7('0x49')]({},_0x4bd8bb,_0x46e0b0[_0xc1b7('0x4b')]);var _0x759adb={'where':_0x4bd8bb[_0xc1b7('0x48')]};return db[_0xc1b7('0x36')][_0xc1b7('0x2a')](_0x759adb)['then'](function(_0x3db11e){_0x5bba19[_0xc1b7('0x2a')]=_0x3db11e;if(_0x46e0b0[_0xc1b7('0x3c')][_0xc1b7('0x4c')]){_0x4bd8bb[_0xc1b7('0x4d')]=[{'all':!![]}];}return db[_0xc1b7('0x36')][_0xc1b7('0x4e')](_0x4bd8bb);})[_0xc1b7('0x1f')](function(_0x1e006d){_0x5bba19[_0xc1b7('0x4f')]=_0x1e006d;return _0x5bba19;})[_0xc1b7('0x1f')](respondWithFilteredResult(_0x243a15,_0x4bd8bb))[_0xc1b7('0x50')](handleError(_0x243a15,null));};exports[_0xc1b7('0x51')]=function(_0x3ba5cc,_0x30dac0){var _0x6b92a={'raw':!![],'where':{'id':_0x3ba5cc[_0xc1b7('0x52')]['id']}},_0x506e35={};_0x506e35[_0xc1b7('0x3b')]=_[_0xc1b7('0x3d')](db[_0xc1b7('0x36')][_0xc1b7('0x37')]);_0x506e35[_0xc1b7('0x3c')]=_[_0xc1b7('0x3d')](_0x3ba5cc[_0xc1b7('0x3c')]);_0x506e35['filters']=_[_0xc1b7('0x3f')](_0x506e35['model'],_0x506e35[_0xc1b7('0x3c')]);_0x6b92a[_0xc1b7('0x40')]=_[_0xc1b7('0x3f')](_0x506e35['model'],qs['fields'](_0x3ba5cc[_0xc1b7('0x3c')]['fields']));_0x6b92a['attributes']=_0x6b92a['attributes'][_0xc1b7('0x53')]?_0x6b92a['attributes']:_0x506e35[_0xc1b7('0x3b')];if(_0x3ba5cc[_0xc1b7('0x3c')][_0xc1b7('0x4c')]){_0x6b92a[_0xc1b7('0x4d')]=[{'all':!![]}];}_0x6b92a=_[_0xc1b7('0x49')]({},_0x6b92a,_0x3ba5cc[_0xc1b7('0x4b')]);return db['ChatMessage'][_0xc1b7('0x54')](_0x6b92a)[_0xc1b7('0x1f')](handleEntityNotFound(_0x30dac0,null))[_0xc1b7('0x1f')](respondWithResult(_0x30dac0,null))[_0xc1b7('0x50')](handleError(_0x30dac0,null));};exports[_0xc1b7('0x55')]=function(_0x163f57,_0x406878){return db[_0xc1b7('0x36')][_0xc1b7('0x55')](_0x163f57['body'],{})[_0xc1b7('0x1f')](respondWithResult(_0x406878,0xc9))[_0xc1b7('0x50')](handleError(_0x406878,null));};exports[_0xc1b7('0x32')]=function(_0x444a56,_0x399a99){if(_0x444a56[_0xc1b7('0x56')]['id']){delete _0x444a56[_0xc1b7('0x56')]['id'];}return db[_0xc1b7('0x36')][_0xc1b7('0x54')]({'where':{'id':_0x444a56[_0xc1b7('0x52')]['id']}})[_0xc1b7('0x1f')](handleEntityNotFound(_0x399a99,null))[_0xc1b7('0x1f')](saveUpdates(_0x444a56[_0xc1b7('0x56')],null))[_0xc1b7('0x1f')](respondWithResult(_0x399a99,null))[_0xc1b7('0x50')](handleError(_0x399a99,null));};exports[_0xc1b7('0x57')]=function(_0x7a4ce8,_0x223d57){return db[_0xc1b7('0x36')]['find']({'where':{'id':_0x7a4ce8[_0xc1b7('0x52')]['id']}})[_0xc1b7('0x1f')](handleEntityNotFound(_0x223d57,null))[_0xc1b7('0x1f')](removeEntity(_0x223d57,null))[_0xc1b7('0x50')](handleError(_0x223d57,null));};exports[_0xc1b7('0x58')]=function(_0x4befd6,_0x5bbd20){return db[_0xc1b7('0x36')]['describe']()[_0xc1b7('0x1f')](respondWithResult(_0x5bbd20,null))[_0xc1b7('0x50')](handleError(_0x5bbd20,null));};var interaction_log=require('../../config/logger')(_0xc1b7('0x59'));exports[_0xc1b7('0x5a')]=function(_0x3df93f,_0x2e3950,_0xd3634b){var _0x1402d9={'agent':{},'channel':_0xc1b7('0x5b')};if(_0x3df93f[_0xc1b7('0x56')]['id']){delete _0x3df93f['body']['id'];}_0x3df93f[_0xc1b7('0x56')][_0xc1b7('0x5c')]=!![];_0x3df93f[_0xc1b7('0x56')][_0xc1b7('0x5d')]=moment()[_0xc1b7('0x5e')](_0xc1b7('0x5f'));_0x3df93f['body']['UserId']=_0x3df93f['body']['UserId']||_0x3df93f[_0xc1b7('0x60')]['id'];_0x1402d9[_0xc1b7('0x61')]['id']=_0x3df93f[_0xc1b7('0x56')][_0xc1b7('0x62')];return db[_0xc1b7('0x36')][_0xc1b7('0x54')]({'where':{'id':_0x3df93f[_0xc1b7('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xc1b7('0x63')],'as':_0xc1b7('0x64')}]})['then'](handleEntityNotFound(_0x2e3950,null))[_0xc1b7('0x1f')](saveUpdates(_0x3df93f[_0xc1b7('0x56')],null))[_0xc1b7('0x1f')](function(_0x2d6565){if(_0x2d6565){_0x1402d9['message']=_0x2d6565[_0xc1b7('0x65')]({'plain':!![]});return db[_0xc1b7('0x66')][_0xc1b7('0x54')]({'where':{'id':_0x2d6565[_0xc1b7('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x2e3950,null))[_0xc1b7('0x1f')](function(_0x50d7e5){if(_0x50d7e5){return _0x50d7e5[_0xc1b7('0x32')]({'UserId':_0x3df93f[_0xc1b7('0x56')][_0xc1b7('0x62')],'read1stAt':_['isNil'](_0x50d7e5[_0xc1b7('0x68')])?moment()[_0xc1b7('0x5e')](_0xc1b7('0x5f')):undefined});}return null;})['then'](function(_0x493972){if(_0x493972){_0x1402d9['interaction']=_0x493972['get']({'plain':!![]});interaction_log[_0xc1b7('0x20')](_0xc1b7('0x69'),_0x3df93f[_0xc1b7('0x60')]['id'],_0x3df93f['user']['name'],_0x3df93f['user'][_0xc1b7('0x6a')],_0x1402d9[_0xc1b7('0x6b')]['id'],_0x3df93f[_0xc1b7('0x56')]?JSON['stringify'](_0x3df93f[_0xc1b7('0x56')]):_0xc1b7('0x6c'));return respondWithRpcPromise(_0xc1b7('0x6d'),_0xc1b7('0x6e'),_0x1402d9);}return null;})[_0xc1b7('0x1f')](function(_0x539ade){if(_0x539ade){if(_0x3df93f[_0xc1b7('0x56')][_0xc1b7('0x6f')]){_0x1402d9[_0xc1b7('0x27')]['interface']=util[_0xc1b7('0x5e')](_0xc1b7('0x70'),_0x3df93f['user']['name']);_0x1402d9[_0xc1b7('0x27')][_0xc1b7('0x71')]=_0x1402d9[_0xc1b7('0x71')];_0x1402d9[_0xc1b7('0x27')]['event']=_0xc1b7('0x5a');return respondWithRpcPromise(_0xc1b7('0x72'),_0xc1b7('0x72'),{'event':'acceptmessage','message':_[_0xc1b7('0x49')](_0x1402d9[_0xc1b7('0x27')],JSON[_0xc1b7('0x73')](_0x1402d9['interaction'][_0xc1b7('0x74')]))},client9002)[_0xc1b7('0x1f')](function(){return _0x1402d9;});}return _0x1402d9;}return null;})[_0xc1b7('0x1f')](respondWithResult(_0x2e3950,null))[_0xc1b7('0x50')](handleError(_0x2e3950,null));};var interaction_log=require(_0xc1b7('0x14'))(_0xc1b7('0x59'));exports['reject']=function(_0x314c2a,_0x39a8d5,_0x131632){var _0x30dc2a={'agent':{},'channel':_0xc1b7('0x5b')};if(_0x314c2a[_0xc1b7('0x56')]['id']){delete _0x314c2a['body']['id'];}_0x314c2a['body'][_0xc1b7('0x62')]=_0x314c2a[_0xc1b7('0x56')][_0xc1b7('0x62')]||_0x314c2a[_0xc1b7('0x60')]['id'];_0x30dc2a[_0xc1b7('0x61')]['id']=_0x314c2a[_0xc1b7('0x56')]['UserId'];return db[_0xc1b7('0x36')][_0xc1b7('0x54')]({'where':{'id':_0x314c2a[_0xc1b7('0x52')]['id'],'UserId':null}})[_0xc1b7('0x1f')](handleEntityNotFound(_0x39a8d5,null))['then'](function(_0xc2064f){if(_0xc2064f){_0x30dc2a['message']=_0xc2064f[_0xc1b7('0x65')]({'plain':!![]});return db['ChatInteraction'][_0xc1b7('0x54')]({'where':{'id':_0xc2064f[_0xc1b7('0x67')]}});}return null;})[_0xc1b7('0x1f')](handleEntityNotFound(_0x39a8d5,null))[_0xc1b7('0x1f')](function(_0x2255fd){if(_0x2255fd){_0x30dc2a['interaction']=_0x2255fd[_0xc1b7('0x65')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x314c2a[_0xc1b7('0x60')]['id'],_0x314c2a[_0xc1b7('0x60')][_0xc1b7('0x34')],_0x314c2a[_0xc1b7('0x60')][_0xc1b7('0x6a')],_0x30dc2a[_0xc1b7('0x6b')]['id'],_0x314c2a[_0xc1b7('0x56')]?JSON[_0xc1b7('0x75')](_0x314c2a['body']):_0xc1b7('0x6c'));return respondWithRpcPromise(_0xc1b7('0x76'),_0xc1b7('0x77'),_0x30dc2a);}return null;})['then'](function(_0x527aec){if(_0x527aec){_0x527aec['message'][_0xc1b7('0x78')]=util['format'](_0xc1b7('0x70'),_0x314c2a['user']['name']);_0x527aec[_0xc1b7('0x27')][_0xc1b7('0x71')]=_0x30dc2a[_0xc1b7('0x71')];_0x527aec['message'][_0xc1b7('0x79')]=_0xc1b7('0x30');respondWithRpcPromise(_0xc1b7('0x72'),_0xc1b7('0x72'),{'event':_0xc1b7('0x7a'),'message':_0x527aec[_0xc1b7('0x27')]},client9002);return _0x30dc2a;}return null;})[_0xc1b7('0x1f')](respondWithResult(_0x39a8d5,null))[_0xc1b7('0x50')](handleError(_0x39a8d5,null));}; \ No newline at end of file +var _0x6ae2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','map','ChatMessage','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','chat-interactions','accept','chat','format','UserId','user','ChatInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','interface','channel','event','EventManager','acceptmessage','parse','formData','agent','RejectMessage','rejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf'];(function(_0x88fafe,_0x3a31a2){var _0x257d2d=function(_0x4ee9b0){while(--_0x4ee9b0){_0x88fafe['push'](_0x88fafe['shift']());}};_0x257d2d(++_0x3a31a2);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x36e868,_0x2e2fb4){_0x36e868=_0x36e868-0x0;var _0x46926d=_0x6ae2[_0x36e868];return _0x46926d;};'use strict';var pdf=require(_0x26ae('0x0'));var emlformat=require(_0x26ae('0x1'));var rimraf=require(_0x26ae('0x2'));var zipdir=require(_0x26ae('0x3'));var jsonpatch=require(_0x26ae('0x4'));var rp=require(_0x26ae('0x5'));var moment=require(_0x26ae('0x6'));var BPromise=require(_0x26ae('0x7'));var Mustache=require(_0x26ae('0x8'));var util=require('util');var path=require(_0x26ae('0x9'));var sox=require(_0x26ae('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x26ae('0xb'));var squel=require(_0x26ae('0xc'));var crypto=require(_0x26ae('0xd'));var jsforce=require(_0x26ae('0xe'));var deskjs=require(_0x26ae('0xf'));var toCsv=require(_0x26ae('0x10'));var querystring=require(_0x26ae('0x11'));var Papa=require(_0x26ae('0x12'));var Redis=require(_0x26ae('0x13'));var authService=require(_0x26ae('0x14'));var qs=require(_0x26ae('0x15'));var as=require(_0x26ae('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26ae('0x17'))('api');var utils=require(_0x26ae('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x26ae('0x19'))['db'];config[_0x26ae('0x1a')]=_[_0x26ae('0x1b')](config[_0x26ae('0x1a')],{'host':_0x26ae('0x1c'),'port':0x18eb});var socket=require(_0x26ae('0x1d'))(new Redis(config[_0x26ae('0x1a')]));require(_0x26ae('0x1e'))[_0x26ae('0x1f')](socket);var jayson=require(_0x26ae('0x20'));var client=jayson[_0x26ae('0x21')][_0x26ae('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x26ae('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x32cd9e,_0x497974,_0x444397,_0x3426d8){return new BPromise(function(_0x4f71d8,_0x11a091){var _0x13ad43=_0x3426d8||client;return _0x13ad43[_0x26ae('0x23')](_0x32cd9e,_0x444397)[_0x26ae('0x24')](function(_0x3418c9){logger[_0x26ae('0x25')](_0x26ae('0x26'),_0x497974,_0x26ae('0x27'));logger[_0x26ae('0x28')](_0x26ae('0x29'),_0x497974,_0x26ae('0x27'),JSON[_0x26ae('0x2a')](_0x3418c9));if(_0x3418c9[_0x26ae('0x2b')]){if(_0x3418c9[_0x26ae('0x2b')][_0x26ae('0x2c')]===0x1f4){logger[_0x26ae('0x2b')](_0x26ae('0x26'),_0x497974,_0x3418c9[_0x26ae('0x2b')]['message']);return _0x11a091(_0x3418c9['error'][_0x26ae('0x2d')]);}logger['error'](_0x26ae('0x26'),_0x497974,_0x3418c9['error'][_0x26ae('0x2d')]);return _0x4f71d8(_0x3418c9[_0x26ae('0x2b')][_0x26ae('0x2d')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x497974,_0x26ae('0x27'));_0x4f71d8(_0x3418c9[_0x26ae('0x2e')][_0x26ae('0x2d')]);}})['catch'](function(_0x2caf20){logger[_0x26ae('0x2b')]('ChatMessage,\x20%s,\x20%s',_0x497974,_0x2caf20);_0x11a091(_0x2caf20);});});}function respondWithStatusCode(_0x1a0a32,_0x2658ed){_0x2658ed=_0x2658ed||0xcc;return function(_0x19eacc){if(_0x19eacc){return _0x1a0a32['sendStatus'](_0x2658ed);}return _0x1a0a32[_0x26ae('0x2f')](_0x2658ed)['end']();};}function respondWithResult(_0x28e5a4,_0x1ac4e6){_0x1ac4e6=_0x1ac4e6||0xc8;return function(_0x76c2b3){if(_0x76c2b3){return _0x28e5a4['status'](_0x1ac4e6)[_0x26ae('0x30')](_0x76c2b3);}};}function respondWithFilteredResult(_0x5a8301,_0x4cddc4){return function(_0x2f2e9d){if(_0x2f2e9d){var _0x2fcc89=_0x2f2e9d[_0x26ae('0x31')],_0x5979ec=_0x4cddc4[_0x26ae('0x32')],_0x5308c=_0x4cddc4[_0x26ae('0x32')]+_0x4cddc4['limit'],_0x2ef88f;if(_0x5308c>=_0x2fcc89){_0x5308c=_0x2fcc89;_0x2ef88f=0xc8;}else{_0x2ef88f=0xce;}_0x5a8301[_0x26ae('0x2f')](_0x2ef88f);return _0x5a8301[_0x26ae('0x33')](_0x26ae('0x34'),_0x5979ec+'-'+_0x5308c+'/'+_0x2fcc89)[_0x26ae('0x30')](_0x2f2e9d);}return null;};}function patchUpdates(_0x247219){return function(_0x56588f){try{jsonpatch[_0x26ae('0x35')](_0x56588f,_0x247219,!![]);}catch(_0x3c9267){return BPromise[_0x26ae('0x36')](_0x3c9267);}return _0x56588f[_0x26ae('0x37')]();};}function saveUpdates(_0xa3c097,_0x298df4){return function(_0x270dae){if(_0x270dae){return _0x270dae[_0x26ae('0x38')](_0xa3c097)['then'](function(_0x170dd4){return _0x170dd4;});}return null;};}function removeEntity(_0x543044,_0x4c961d){return function(_0x23c723){if(_0x23c723){return _0x23c723[_0x26ae('0x39')]()[_0x26ae('0x24')](function(){_0x543044['status'](0xcc)[_0x26ae('0x3a')]();});}};}function handleEntityNotFound(_0x3bbdaa,_0x3d2195){return function(_0x1a5ad4){if(!_0x1a5ad4){_0x3bbdaa[_0x26ae('0x3b')](0x194);}return _0x1a5ad4;};}function handleError(_0x20aa74,_0x9ed674){_0x9ed674=_0x9ed674||0x1f4;return function(_0x1afa84){logger[_0x26ae('0x2b')](_0x1afa84[_0x26ae('0x3c')]);if(_0x1afa84[_0x26ae('0x3d')]){delete _0x1afa84[_0x26ae('0x3d')];}_0x20aa74[_0x26ae('0x2f')](_0x9ed674)[_0x26ae('0x3e')](_0x1afa84);};}exports['index']=function(_0x14d0ed,_0x3b9bb4){var _0x2e5d70={},_0x484dec={},_0x20c60a={'count':0x0,'rows':[]};var _0x37855d=_[_0x26ae('0x3f')](db[_0x26ae('0x40')][_0x26ae('0x41')],function(_0x4e3f44){return{'name':_0x4e3f44[_0x26ae('0x42')],'type':_0x4e3f44[_0x26ae('0x43')][_0x26ae('0x44')]};});_0x484dec[_0x26ae('0x45')]=_[_0x26ae('0x3f')](_0x37855d,_0x26ae('0x3d'));_0x484dec['query']=_['keys'](_0x14d0ed['query']);_0x484dec[_0x26ae('0x46')]=_[_0x26ae('0x47')](_0x484dec[_0x26ae('0x45')],_0x484dec[_0x26ae('0x48')]);_0x2e5d70[_0x26ae('0x49')]=_['intersection'](_0x484dec[_0x26ae('0x45')],qs[_0x26ae('0x4a')](_0x14d0ed[_0x26ae('0x48')][_0x26ae('0x4a')]));_0x2e5d70[_0x26ae('0x49')]=_0x2e5d70[_0x26ae('0x49')][_0x26ae('0x4b')]?_0x2e5d70['attributes']:_0x484dec[_0x26ae('0x45')];if(!_0x14d0ed[_0x26ae('0x48')]['hasOwnProperty'](_0x26ae('0x4c'))){_0x2e5d70['limit']=qs[_0x26ae('0x4d')](_0x14d0ed[_0x26ae('0x48')][_0x26ae('0x4d')]);_0x2e5d70['offset']=qs[_0x26ae('0x32')](_0x14d0ed[_0x26ae('0x48')][_0x26ae('0x32')]);}_0x2e5d70[_0x26ae('0x4e')]=qs[_0x26ae('0x4f')](_0x14d0ed[_0x26ae('0x48')]['sort']);_0x2e5d70['where']=qs['filters'](_[_0x26ae('0x50')](_0x14d0ed[_0x26ae('0x48')],_0x484dec[_0x26ae('0x46')]),_0x37855d);if(_0x14d0ed[_0x26ae('0x48')][_0x26ae('0x51')]){_0x2e5d70['where']=_['merge'](_0x2e5d70[_0x26ae('0x52')],{'$or':_[_0x26ae('0x3f')](_0x37855d,function(_0x686879){if(_0x686879['type']!==_0x26ae('0x53')){var _0x50317d={};_0x50317d[_0x686879[_0x26ae('0x3d')]]={'$like':'%'+_0x14d0ed[_0x26ae('0x48')]['filter']+'%'};return _0x50317d;}})});}_0x2e5d70=_['merge']({},_0x2e5d70,_0x14d0ed[_0x26ae('0x54')]);var _0x4f0b67={'where':_0x2e5d70[_0x26ae('0x52')]};return db[_0x26ae('0x40')][_0x26ae('0x31')](_0x4f0b67)[_0x26ae('0x24')](function(_0x2c0d31){_0x20c60a[_0x26ae('0x31')]=_0x2c0d31;if(_0x14d0ed[_0x26ae('0x48')][_0x26ae('0x55')]){_0x2e5d70[_0x26ae('0x56')]=[{'all':!![]}];}return db[_0x26ae('0x40')][_0x26ae('0x57')](_0x2e5d70);})['then'](function(_0x205036){_0x20c60a[_0x26ae('0x58')]=_0x205036;return _0x20c60a;})[_0x26ae('0x24')](respondWithFilteredResult(_0x3b9bb4,_0x2e5d70))[_0x26ae('0x59')](handleError(_0x3b9bb4,null));};exports[_0x26ae('0x5a')]=function(_0x34d5e7,_0x2af049){var _0x38c4c2={'raw':!![],'where':{'id':_0x34d5e7[_0x26ae('0x5b')]['id']}},_0x27a516={};_0x27a516[_0x26ae('0x45')]=_[_0x26ae('0x5c')](db[_0x26ae('0x40')]['rawAttributes']);_0x27a516[_0x26ae('0x48')]=_['keys'](_0x34d5e7[_0x26ae('0x48')]);_0x27a516[_0x26ae('0x46')]=_[_0x26ae('0x47')](_0x27a516[_0x26ae('0x45')],_0x27a516[_0x26ae('0x48')]);_0x38c4c2[_0x26ae('0x49')]=_['intersection'](_0x27a516[_0x26ae('0x45')],qs['fields'](_0x34d5e7[_0x26ae('0x48')]['fields']));_0x38c4c2[_0x26ae('0x49')]=_0x38c4c2[_0x26ae('0x49')]['length']?_0x38c4c2[_0x26ae('0x49')]:_0x27a516[_0x26ae('0x45')];if(_0x34d5e7[_0x26ae('0x48')][_0x26ae('0x55')]){_0x38c4c2[_0x26ae('0x56')]=[{'all':!![]}];}_0x38c4c2=_['merge']({},_0x38c4c2,_0x34d5e7['options']);return db[_0x26ae('0x40')][_0x26ae('0x5d')](_0x38c4c2)['then'](handleEntityNotFound(_0x2af049,null))[_0x26ae('0x24')](respondWithResult(_0x2af049,null))[_0x26ae('0x59')](handleError(_0x2af049,null));};exports[_0x26ae('0x5e')]=function(_0x51b9ec,_0x162ace){return db[_0x26ae('0x40')][_0x26ae('0x5e')](_0x51b9ec[_0x26ae('0x5f')],{})[_0x26ae('0x24')](respondWithResult(_0x162ace,0xc9))[_0x26ae('0x59')](handleError(_0x162ace,null));};exports[_0x26ae('0x38')]=function(_0x2312e4,_0x3ca5a1){if(_0x2312e4[_0x26ae('0x5f')]['id']){delete _0x2312e4[_0x26ae('0x5f')]['id'];}return db[_0x26ae('0x40')][_0x26ae('0x5d')]({'where':{'id':_0x2312e4[_0x26ae('0x5b')]['id']}})[_0x26ae('0x24')](handleEntityNotFound(_0x3ca5a1,null))[_0x26ae('0x24')](saveUpdates(_0x2312e4[_0x26ae('0x5f')],null))[_0x26ae('0x24')](respondWithResult(_0x3ca5a1,null))[_0x26ae('0x59')](handleError(_0x3ca5a1,null));};exports[_0x26ae('0x39')]=function(_0x534b4a,_0x49aa21){return db[_0x26ae('0x40')][_0x26ae('0x5d')]({'where':{'id':_0x534b4a[_0x26ae('0x5b')]['id']}})['then'](handleEntityNotFound(_0x49aa21,null))[_0x26ae('0x24')](removeEntity(_0x49aa21,null))['catch'](handleError(_0x49aa21,null));};exports[_0x26ae('0x60')]=function(_0x29ff49,_0x57f922){return db[_0x26ae('0x40')][_0x26ae('0x60')]()[_0x26ae('0x24')](respondWithResult(_0x57f922,null))[_0x26ae('0x59')](handleError(_0x57f922,null));};var interaction_log=require(_0x26ae('0x17'))(_0x26ae('0x61'));exports[_0x26ae('0x62')]=function(_0x277156,_0xfb8aba,_0x4c183a){var _0x391e07={'agent':{},'channel':_0x26ae('0x63')};if(_0x277156[_0x26ae('0x5f')]['id']){delete _0x277156[_0x26ae('0x5f')]['id'];}_0x277156[_0x26ae('0x5f')]['read']=!![];_0x277156[_0x26ae('0x5f')]['readAt']=moment()[_0x26ae('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x277156[_0x26ae('0x5f')][_0x26ae('0x65')]=_0x277156[_0x26ae('0x5f')][_0x26ae('0x65')]||_0x277156[_0x26ae('0x66')]['id'];_0x391e07['agent']['id']=_0x277156['body'][_0x26ae('0x65')];return db[_0x26ae('0x40')][_0x26ae('0x5d')]({'where':{'id':_0x277156['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0xfb8aba,null))['then'](saveUpdates(_0x277156[_0x26ae('0x5f')],null))['then'](function(_0x3651ac){if(_0x3651ac){_0x391e07[_0x26ae('0x2d')]=_0x3651ac['get']({'plain':!![]});return db[_0x26ae('0x67')][_0x26ae('0x5d')]({'where':{'id':_0x3651ac['ChatInteractionId']}});}return null;})[_0x26ae('0x24')](handleEntityNotFound(_0xfb8aba,null))['then'](function(_0x3f071f){if(_0x3f071f){return _0x3f071f[_0x26ae('0x38')]({'UserId':_0x277156[_0x26ae('0x5f')][_0x26ae('0x65')],'read1stAt':_[_0x26ae('0x68')](_0x3f071f[_0x26ae('0x69')])?moment()[_0x26ae('0x64')](_0x26ae('0x6a')):undefined});}return null;})[_0x26ae('0x24')](function(_0x576eeb){if(_0x576eeb){_0x391e07['interaction']=_0x576eeb[_0x26ae('0x6b')]({'plain':!![]});interaction_log[_0x26ae('0x25')](_0x26ae('0x6c'),_0x277156[_0x26ae('0x66')]['id'],_0x277156[_0x26ae('0x66')][_0x26ae('0x3d')],_0x277156[_0x26ae('0x66')][_0x26ae('0x6d')],_0x391e07[_0x26ae('0x6e')]['id'],_0x277156[_0x26ae('0x5f')]?JSON[_0x26ae('0x2a')](_0x277156['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x26ae('0x6f'),_0x391e07);}return null;})[_0x26ae('0x24')](function(_0x4bec54){if(_0x4bec54){if(_0x277156['body']['manual']){_0x391e07['message'][_0x26ae('0x70')]=util[_0x26ae('0x64')]('SIP/%s',_0x277156['user'][_0x26ae('0x3d')]);_0x391e07[_0x26ae('0x2d')][_0x26ae('0x71')]=_0x391e07[_0x26ae('0x71')];_0x391e07[_0x26ae('0x2d')][_0x26ae('0x72')]=_0x26ae('0x62');return respondWithRpcPromise('EventManager',_0x26ae('0x73'),{'event':_0x26ae('0x74'),'message':_['merge'](_0x391e07[_0x26ae('0x2d')],JSON[_0x26ae('0x75')](_0x391e07[_0x26ae('0x6e')][_0x26ae('0x76')]))},client9002)[_0x26ae('0x24')](function(){return _0x391e07;});}return _0x391e07;}return null;})['then'](respondWithResult(_0xfb8aba,null))[_0x26ae('0x59')](handleError(_0xfb8aba,null));};var interaction_log=require(_0x26ae('0x17'))(_0x26ae('0x61'));exports['reject']=function(_0x1c013b,_0x4fbf27,_0x2fde0b){var _0x2be899={'agent':{},'channel':_0x26ae('0x63')};if(_0x1c013b[_0x26ae('0x5f')]['id']){delete _0x1c013b[_0x26ae('0x5f')]['id'];}_0x1c013b[_0x26ae('0x5f')][_0x26ae('0x65')]=_0x1c013b[_0x26ae('0x5f')][_0x26ae('0x65')]||_0x1c013b['user']['id'];_0x2be899[_0x26ae('0x77')]['id']=_0x1c013b[_0x26ae('0x5f')][_0x26ae('0x65')];return db[_0x26ae('0x40')][_0x26ae('0x5d')]({'where':{'id':_0x1c013b[_0x26ae('0x5b')]['id'],'UserId':null}})[_0x26ae('0x24')](handleEntityNotFound(_0x4fbf27,null))[_0x26ae('0x24')](function(_0xbf1c87){if(_0xbf1c87){_0x2be899[_0x26ae('0x2d')]=_0xbf1c87['get']({'plain':!![]});return db[_0x26ae('0x67')][_0x26ae('0x5d')]({'where':{'id':_0xbf1c87['ChatInteractionId']}});}return null;})[_0x26ae('0x24')](handleEntityNotFound(_0x4fbf27,null))[_0x26ae('0x24')](function(_0x5b9797){if(_0x5b9797){_0x2be899['interaction']=_0x5b9797[_0x26ae('0x6b')]({'plain':!![]});interaction_log[_0x26ae('0x25')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1c013b[_0x26ae('0x66')]['id'],_0x1c013b['user'][_0x26ae('0x3d')],_0x1c013b[_0x26ae('0x66')][_0x26ae('0x6d')],_0x2be899[_0x26ae('0x6e')]['id'],_0x1c013b['body']?JSON[_0x26ae('0x2a')](_0x1c013b['body']):'null');return respondWithRpcPromise(_0x26ae('0x78'),_0x26ae('0x79'),_0x2be899);}return null;})[_0x26ae('0x24')](function(_0x252e9d){if(_0x252e9d){_0x252e9d[_0x26ae('0x2d')]['interface']=util[_0x26ae('0x64')](_0x26ae('0x7a'),_0x1c013b[_0x26ae('0x66')][_0x26ae('0x3d')]);_0x252e9d[_0x26ae('0x2d')][_0x26ae('0x71')]=_0x2be899[_0x26ae('0x71')];_0x252e9d[_0x26ae('0x2d')][_0x26ae('0x72')]=_0x26ae('0x36');respondWithRpcPromise(_0x26ae('0x73'),'EventManager',{'event':_0x26ae('0x7b'),'message':_0x252e9d[_0x26ae('0x2d')]},client9002);return _0x2be899;}return null;})[_0x26ae('0x24')](respondWithResult(_0x4fbf27,null))['catch'](handleError(_0x4fbf27,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1a9aa64..28c89f9 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 _0x1366=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0x48475b,_0x4d3077){var _0x3b241a=function(_0x5c4a49){while(--_0x5c4a49){_0x48475b['push'](_0x48475b['shift']());}};_0x3b241a(++_0x4d3077);}(_0x1366,0x192));var _0x6136=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1366[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x6136('0x0'));var ChatMessage=require(_0x6136('0x1'))['db'][_0x6136('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6136('0x3')](0x0);var events={'afterCreate':_0x6136('0x4'),'afterUpdate':_0x6136('0x5'),'afterDestroy':'remove'};function emitEvent(_0x43f049){return function(_0x40eb84,_0x4cdd0d,_0x344e1d){ChatMessageEvents[_0x6136('0x6')](_0x43f049+':'+_0x40eb84['id'],_0x40eb84);ChatMessageEvents[_0x6136('0x6')](_0x43f049,_0x40eb84);_0x344e1d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x6136('0x7')](e,emitEvent(event));}}module[_0x6136('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x36e7=['save','emit','hook','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x32357c,_0x527372){var _0x4e5f39=function(_0x15fe36){while(--_0x15fe36){_0x32357c['push'](_0x32357c['shift']());}};_0x4e5f39(++_0x527372);}(_0x36e7,0x9d));var _0x736e=function(_0x2a659d,_0x3d07f4){_0x2a659d=_0x2a659d-0x0;var _0x11685b=_0x36e7[_0x2a659d];return _0x11685b;};'use strict';var EventEmitter=require(_0x736e('0x0'));var ChatMessage=require(_0x736e('0x1'))['db'][_0x736e('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x736e('0x3')](0x0);var events={'afterCreate':_0x736e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x706426){return function(_0x49da7f,_0x3dd3e1,_0x4342e9){ChatMessageEvents[_0x736e('0x5')](_0x706426+':'+_0x49da7f['id'],_0x49da7f);ChatMessageEvents[_0x736e('0x5')](_0x706426,_0x49da7f);_0x4342e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x736e('0x6')](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 e72b35b..390c9e2 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 _0xb92a=['bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x4aacfd,_0x5dfc29){var _0x1e5817=function(_0x1a09dd){while(--_0x1a09dd){_0x4aacfd['push'](_0x4aacfd['shift']());}};_0x1e5817(++_0x5dfc29);}(_0xb92a,0xeb));var _0xab92=function(_0x3e44ed,_0x7b42d){_0x3e44ed=_0x3e44ed-0x0;var _0x1a19a2=_0xb92a[_0x3e44ed];return _0x1a19a2;};'use strict';var _=require(_0xab92('0x0'));var util=require(_0xab92('0x1'));var logger=require(_0xab92('0x2'))(_0xab92('0x3'));var moment=require(_0xab92('0x4'));var BPromise=require(_0xab92('0x5'));var rp=require(_0xab92('0x6'));var fs=require('fs');var path=require(_0xab92('0x7'));var rimraf=require(_0xab92('0x8'));var config=require('../../config/environment');var attributes=require(_0xab92('0x9'));module[_0xab92('0xa')]=function(_0x16f4b4,_0x48c983){return _0x16f4b4['define'](_0xab92('0xb'),attributes,{'tableName':_0xab92('0xc'),'paranoid':![],'indexes':[{'name':_0xab92('0xd'),'fields':[_0xab92('0xe')],'type':_0xab92('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x260afd,_0x5f05db,_0x3cce8a){var _0x1c41aa=_0x16f4b4['models'];var _0xb532f0=_0x260afd[_0xab92('0x10')]({'plain':!![]});if(_0xb532f0[_0xab92('0x11')][_0xab92('0x12')]()==='in'||_0xb532f0[_0xab92('0x11')][_0xab92('0x12')]()===_0xab92('0x13')&&!_0xb532f0[_0xab92('0x14')]&&!_[_0xab92('0x15')](_0xb532f0['UserId'])){_0x1c41aa[_0xab92('0x16')]['findOne']({'where':{'id':_0xb532f0[_0xab92('0x17')]}})[_0xab92('0x18')](function(_0x13bd7c){if(_0x13bd7c){_0x13bd7c['update']({'lastMsgAt':_0xb532f0[_0xab92('0x19')],'lastMsgDirection':_0xb532f0[_0xab92('0x11')]['toLowerCase']()});}})[_0xab92('0x1a')](function(_0x279e51){console[_0xab92('0x1b')](_0x279e51);});}_0x3cce8a();}},'charset':_0xab92('0x1c'),'collate':_0xab92('0x1d')});}; \ No newline at end of file +var _0xdeac=['toLowerCase','secret','isNil','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction'];(function(_0x8082ef,_0x369378){var _0x1c83b8=function(_0x17d95f){while(--_0x17d95f){_0x8082ef['push'](_0x8082ef['shift']());}};_0x1c83b8(++_0x369378);}(_0xdeac,0x97));var _0xcdea=function(_0x5d2eb5,_0x4d2cbd){_0x5d2eb5=_0x5d2eb5-0x0;var _0x5dfd99=_0xdeac[_0x5d2eb5];return _0x5dfd99;};'use strict';var _=require('lodash');var util=require(_0xcdea('0x0'));var logger=require(_0xcdea('0x1'))('api');var moment=require(_0xcdea('0x2'));var BPromise=require(_0xcdea('0x3'));var rp=require(_0xcdea('0x4'));var fs=require('fs');var path=require(_0xcdea('0x5'));var rimraf=require(_0xcdea('0x6'));var config=require('../../config/environment');var attributes=require(_0xcdea('0x7'));module[_0xcdea('0x8')]=function(_0x355930,_0x31baa2){return _0x355930['define'](_0xcdea('0x9'),attributes,{'tableName':_0xcdea('0xa'),'paranoid':![],'indexes':[{'name':_0xcdea('0xb'),'fields':[_0xcdea('0xc')],'type':_0xcdea('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x399df2,_0x5f16f3,_0x56b599){var _0x55f7dc=_0x355930[_0xcdea('0xe')];var _0x2e4c5f=_0x399df2[_0xcdea('0xf')]({'plain':!![]});if(_0x2e4c5f[_0xcdea('0x10')][_0xcdea('0x11')]()==='in'||_0x2e4c5f['direction'][_0xcdea('0x11')]()==='out'&&!_0x2e4c5f[_0xcdea('0x12')]&&!_[_0xcdea('0x13')](_0x2e4c5f['UserId'])){_0x55f7dc[_0xcdea('0x14')]['findOne']({'where':{'id':_0x2e4c5f[_0xcdea('0x15')]}})[_0xcdea('0x16')](function(_0x4b95e6){if(_0x4b95e6){_0x4b95e6[_0xcdea('0x17')]({'lastMsgAt':_0x2e4c5f[_0xcdea('0x18')],'lastMsgDirection':_0x2e4c5f['direction'][_0xcdea('0x11')]()});}})[_0xcdea('0x19')](function(_0x5459c7){console[_0xcdea('0x1a')](_0x5459c7);});}_0x56b599();}},'charset':_0xcdea('0x1b'),'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 f8d1077..dc8cc2e 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 _0xc78e=['redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ChatMessage','create','options','raw','debug','CreateChatMessage','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x275641,_0x24ec44){var _0x438e0f=function(_0x57336d){while(--_0x57336d){_0x275641['push'](_0x275641['shift']());}};_0x438e0f(++_0x24ec44);}(_0xc78e,0x140));var _0xec78=function(_0x1a6422,_0x18db7a){_0x1a6422=_0x1a6422-0x0;var _0x3a9818=_0xc78e[_0x1a6422];return _0x3a9818;};'use strict';var _=require(_0xec78('0x0'));var util=require(_0xec78('0x1'));var moment=require('moment');var BPromise=require(_0xec78('0x2'));var rs=require(_0xec78('0x3'));var fs=require('fs');var Redis=require(_0xec78('0x4'));var db=require(_0xec78('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xec78('0x6'));var config=require(_0xec78('0x7'));var jayson=require(_0xec78('0x8'));var client=jayson['client'][_0xec78('0x9')]({'port':0x232a});config[_0xec78('0xa')]=_[_0xec78('0xb')](config['redis'],{'host':_0xec78('0xc'),'port':0x18eb});var socket=require(_0xec78('0xd'))(new Redis(config[_0xec78('0xa')]));require(_0xec78('0xe'))[_0xec78('0xf')](socket);function respondWithRpcPromise(_0x133cdd,_0x1c4cc1,_0x42a542){return new BPromise(function(_0x40c2d8,_0x112f93){return client[_0xec78('0x10')](_0x133cdd,_0x42a542)[_0xec78('0x11')](function(_0x2b150c){logger['info'](_0xec78('0x12'),_0x1c4cc1,_0xec78('0x13'));logger['debug'](_0xec78('0x14'),_0x1c4cc1,_0xec78('0x13'),JSON[_0xec78('0x15')](_0x2b150c));if(_0x2b150c[_0xec78('0x16')]){if(_0x2b150c[_0xec78('0x16')][_0xec78('0x17')]===0x1f4){logger[_0xec78('0x16')](_0xec78('0x12'),_0x1c4cc1,_0x2b150c[_0xec78('0x16')][_0xec78('0x18')]);return _0x112f93(_0x2b150c[_0xec78('0x16')]['message']);}logger[_0xec78('0x16')](_0xec78('0x12'),_0x1c4cc1,_0x2b150c[_0xec78('0x16')][_0xec78('0x18')]);return _0x40c2d8(_0x2b150c[_0xec78('0x16')][_0xec78('0x18')]);}else{logger[_0xec78('0x19')](_0xec78('0x12'),_0x1c4cc1,_0xec78('0x13'));_0x40c2d8(_0x2b150c['result'][_0xec78('0x18')]);}})['catch'](function(_0x5e217d){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1c4cc1,_0x5e217d);_0x112f93(_0x5e217d);});});}exports['CreateChatMessage']=function(_0x1ef1fd){var _0x306163=this;return new Promise(function(_0x53ee3d,_0x41e6d1){return db[_0xec78('0x1a')][_0xec78('0x1b')](_0x1ef1fd['body'],{'raw':_0x1ef1fd[_0xec78('0x1c')]?_0x1ef1fd[_0xec78('0x1c')][_0xec78('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0xa262aa){logger[_0xec78('0x19')]('CreateChatMessage',_0x1ef1fd);logger[_0xec78('0x1e')](_0xec78('0x1f'),_0x1ef1fd,JSON[_0xec78('0x15')](_0xa262aa));_0x53ee3d(_0xa262aa);})[_0xec78('0x20')](function(_0x15e8ec){logger[_0xec78('0x16')](_0xec78('0x1f'),_0x15e8ec[_0xec78('0x18')],_0x1ef1fd);_0x41e6d1(_0x306163[_0xec78('0x16')](0x1f4,_0x15e8ec[_0xec78('0x18')]));});});}; \ No newline at end of file +var _0x05ee=['http','redis','localhost','./chatMessage.socket','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x05ee,0x1e6));var _0xe05e=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0x05ee[_0x51e79c];return _0x2467be;};'use strict';var _=require(_0xe05e('0x0'));var util=require(_0xe05e('0x1'));var moment=require(_0xe05e('0x2'));var BPromise=require(_0xe05e('0x3'));var rs=require(_0xe05e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe05e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe05e('0x6'))('rpc');var config=require(_0xe05e('0x7'));var jayson=require(_0xe05e('0x8'));var client=jayson[_0xe05e('0x9')][_0xe05e('0xa')]({'port':0x232a});config[_0xe05e('0xb')]=_['defaults'](config[_0xe05e('0xb')],{'host':_0xe05e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe05e('0xb')]));require(_0xe05e('0xd'))['register'](socket);function respondWithRpcPromise(_0x2dd19c,_0x2eb6f7,_0x2b8b4b){return new BPromise(function(_0x282d8a,_0xd060ed){return client[_0xe05e('0xe')](_0x2dd19c,_0x2b8b4b)['then'](function(_0x5c0677){logger['info'](_0xe05e('0xf'),_0x2eb6f7,_0xe05e('0x10'));logger[_0xe05e('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2eb6f7,_0xe05e('0x10'),JSON[_0xe05e('0x12')](_0x5c0677));if(_0x5c0677['error']){if(_0x5c0677[_0xe05e('0x13')]['code']===0x1f4){logger[_0xe05e('0x13')]('ChatMessage,\x20%s,\x20%s',_0x2eb6f7,_0x5c0677['error'][_0xe05e('0x14')]);return _0xd060ed(_0x5c0677[_0xe05e('0x13')][_0xe05e('0x14')]);}logger[_0xe05e('0x13')]('ChatMessage,\x20%s,\x20%s',_0x2eb6f7,_0x5c0677[_0xe05e('0x13')][_0xe05e('0x14')]);return _0x282d8a(_0x5c0677['error']['message']);}else{logger[_0xe05e('0x15')](_0xe05e('0xf'),_0x2eb6f7,'request\x20sent');_0x282d8a(_0x5c0677[_0xe05e('0x16')][_0xe05e('0x14')]);}})[_0xe05e('0x17')](function(_0x2ef6b0){logger[_0xe05e('0x13')](_0xe05e('0xf'),_0x2eb6f7,_0x2ef6b0);_0xd060ed(_0x2ef6b0);});});}exports[_0xe05e('0x18')]=function(_0x49be91){var _0x5dba8c=this;return new Promise(function(_0x5aae60,_0x5efde7){return db[_0xe05e('0x19')][_0xe05e('0x1a')](_0x49be91[_0xe05e('0x1b')],{'raw':_0x49be91[_0xe05e('0x1c')]?_0x49be91['options'][_0xe05e('0x1d')]===undefined?!![]:![]:!![]})[_0xe05e('0x1e')](function(_0x30cb11){logger[_0xe05e('0x15')](_0xe05e('0x18'),_0x49be91);logger['debug']('CreateChatMessage',_0x49be91,JSON[_0xe05e('0x12')](_0x30cb11));_0x5aae60(_0x30cb11);})[_0xe05e('0x17')](function(_0x59affc){logger['error']('CreateChatMessage',_0x59affc[_0xe05e('0x14')],_0x49be91);_0x5efde7(_0x5dba8c[_0xe05e('0x13')](0x1f4,_0x59affc[_0xe05e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6f4ea29..0c0bdff 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 _0x47c5=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x47c5,0x165));var _0x547c=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x47c5[_0x30faee];return _0x3a90ab;};'use strict';var ChatMessageEvents=require(_0x547c('0x0'));var events=[_0x547c('0x1'),_0x547c('0x2'),_0x547c('0x3')];function createListener(_0x5fe74c,_0x3260c8){return function(_0x500b86){_0x3260c8[_0x547c('0x4')](_0x5fe74c,_0x500b86);};}function removeListener(_0x16f4db,_0x5b48c9){return function(){ChatMessageEvents[_0x547c('0x5')](_0x16f4db,_0x5b48c9);};}exports[_0x547c('0x6')]=function(_0x51ab7f){for(var _0x2e5b57=0x0,_0x439f25=events[_0x547c('0x7')];_0x2e5b57<_0x439f25;_0x2e5b57++){var _0x10a334=events[_0x2e5b57];var _0x12fb7d=createListener(_0x547c('0x8')+_0x10a334,_0x51ab7f);ChatMessageEvents['on'](_0x10a334,_0x12fb7d);}}; \ No newline at end of file +var _0x7880=['register','length','save','remove','update','removeListener'];(function(_0x2972af,_0x1b1b6b){var _0x31e129=function(_0x13628e){while(--_0x13628e){_0x2972af['push'](_0x2972af['shift']());}};_0x31e129(++_0x1b1b6b);}(_0x7880,0x1f4));var _0x0788=function(_0x5be8ab,_0x4000a6){_0x5be8ab=_0x5be8ab-0x0;var _0x35914d=_0x7880[_0x5be8ab];return _0x35914d;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x0788('0x0'),_0x0788('0x1'),_0x0788('0x2')];function createListener(_0x1b196a,_0x47dc20){return function(_0x446ded){_0x47dc20['emit'](_0x1b196a,_0x446ded);};}function removeListener(_0x3925a6,_0x1e0814){return function(){ChatMessageEvents[_0x0788('0x3')](_0x3925a6,_0x1e0814);};}exports[_0x0788('0x4')]=function(_0x262f5c){for(var _0x775629=0x0,_0x3f9cb8=events[_0x0788('0x5')];_0x775629<_0x3f9cb8;_0x775629++){var _0x3c29f3=events[_0x775629];var _0x422f8b=createListener('chatMessage:'+_0x3c29f3,_0x262f5c);ChatMessageEvents['on'](_0x3c29f3,_0x422f8b);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index d44ff2a..b876a66 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 _0xe5f7=['chatmessage:create','create','update','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat'];(function(_0x2643b9,_0x1206bb){var _0x2fac07=function(_0x3f2046){while(--_0x3f2046){_0x2643b9['push'](_0x2643b9['shift']());}};_0x2fac07(++_0x1206bb);}(_0xe5f7,0xac));var _0x7e5f=function(_0x545875,_0x74bdf4){_0x545875=_0x545875-0x0;var _0x3ff648=_0xe5f7[_0x545875];return _0x3ff648;};'use strict';var multer=require(_0x7e5f('0x0'));var util=require(_0x7e5f('0x1'));var path=require(_0x7e5f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x7e5f('0x3'));var interaction=require(_0x7e5f('0x4'));var config=require(_0x7e5f('0x5'));var controller=require(_0x7e5f('0x6'));router[_0x7e5f('0x7')]('/',auth[_0x7e5f('0x8')](),controller[_0x7e5f('0x9')]);router[_0x7e5f('0x7')](_0x7e5f('0xa'),auth[_0x7e5f('0x8')](),controller[_0x7e5f('0xb')]);router[_0x7e5f('0x7')](_0x7e5f('0xc'),auth['isAuthenticated'](),controller[_0x7e5f('0xd')]);router[_0x7e5f('0xe')]('/',auth[_0x7e5f('0x8')](),interaction[_0x7e5f('0xf')](_0x7e5f('0x10'),_0x7e5f('0x11')),controller[_0x7e5f('0x12')]);router['put'](_0x7e5f('0xc'),controller[_0x7e5f('0x13')]);router[_0x7e5f('0x14')](_0x7e5f('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0x7e5f('0x14')](_0x7e5f('0x16'),auth[_0x7e5f('0x8')](),controller[_0x7e5f('0x17')]);router[_0x7e5f('0x18')](_0x7e5f('0xc'),auth[_0x7e5f('0x8')](),controller[_0x7e5f('0x19')]);module[_0x7e5f('0x1a')]=router; \ No newline at end of file +var _0x4ab2=['index','get','describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatMessage.controller','isAuthenticated'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x4ab2,0xbf));var _0x24ab=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4ab2[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x24ab('0x0'));var util=require(_0x24ab('0x1'));var path=require(_0x24ab('0x2'));var timeout=require(_0x24ab('0x3'));var express=require(_0x24ab('0x4'));var router=express[_0x24ab('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x24ab('0x6'));var config=require('../../config/environment');var controller=require(_0x24ab('0x7'));router['get']('/',auth[_0x24ab('0x8')](),controller[_0x24ab('0x9')]);router[_0x24ab('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x24ab('0xb')]);router[_0x24ab('0xa')](_0x24ab('0xc'),auth[_0x24ab('0x8')](),controller[_0x24ab('0xd')]);router[_0x24ab('0xe')]('/',auth[_0x24ab('0x8')](),interaction['tracked'](_0x24ab('0xf'),_0x24ab('0x10')),controller[_0x24ab('0x11')]);router[_0x24ab('0x12')]('/:id',controller[_0x24ab('0x13')]);router['put'](_0x24ab('0x14'),auth[_0x24ab('0x8')](),controller['accept']);router[_0x24ab('0x12')](_0x24ab('0x15'),auth[_0x24ab('0x8')](),controller[_0x24ab('0x16')]);router['delete'](_0x24ab('0xc'),auth['isAuthenticated'](),controller[_0x24ab('0x17')]);module[_0x24ab('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 0ff21a5..51e4f9f 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 _0xe2d2=['TEXT','medium','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe2d2,0xd2));var _0x2e2d=function(_0xf9f45e,_0x42fa3b){_0xf9f45e=_0xf9f45e-0x0;var _0x4ffaf9=_0xe2d2[_0xf9f45e];return _0x4ffaf9;};'use strict';var Sequelize=require(_0x2e2d('0x0'));module[_0x2e2d('0x1')]={'body':{'type':Sequelize[_0x2e2d('0x2')](_0x2e2d('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x7490=['TEXT','sequelize','exports'];(function(_0x1daace,_0x5b64ab){var _0x2dfecb=function(_0x3dfaf7){while(--_0x3dfaf7){_0x1daace['push'](_0x1daace['shift']());}};_0x2dfecb(++_0x5b64ab);}(_0x7490,0x1e1));var _0x0749=function(_0x1905da,_0x225a71){_0x1905da=_0x1905da-0x0;var _0xba82cb=_0x7490[_0x1905da];return _0xba82cb;};'use strict';var Sequelize=require(_0x0749('0x0'));module[_0x0749('0x1')]={'body':{'type':Sequelize[_0x0749('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 22b8670..dc39487 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 _0x98e5=['params','options','create','body','update','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','then','includeAll','include','findAll','rows','catch','show'];(function(_0x7c3553,_0x5b93dd){var _0x165ee6=function(_0x5ef4a0){while(--_0x5ef4a0){_0x7c3553['push'](_0x7c3553['shift']());}};_0x165ee6(++_0x5b93dd);}(_0x98e5,0xa1));var _0x598e=function(_0x3b9569,_0x8021bc){_0x3b9569=_0x3b9569-0x0;var _0x19892d=_0x98e5[_0x3b9569];return _0x19892d;};'use strict';var pdf=require(_0x598e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x598e('0x1'));var zipdir=require(_0x598e('0x2'));var jsonpatch=require(_0x598e('0x3'));var rp=require(_0x598e('0x4'));var moment=require(_0x598e('0x5'));var BPromise=require(_0x598e('0x6'));var Mustache=require(_0x598e('0x7'));var util=require(_0x598e('0x8'));var path=require('path');var sox=require(_0x598e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x598e('0xa'));var crypto=require('crypto');var jsforce=require(_0x598e('0xb'));var deskjs=require(_0x598e('0xc'));var toCsv=require(_0x598e('0xd'));var querystring=require(_0x598e('0xe'));var Papa=require(_0x598e('0xf'));var Redis=require('ioredis');var authService=require(_0x598e('0x10'));var qs=require(_0x598e('0x11'));var as=require(_0x598e('0x12'));var hardwareService=require(_0x598e('0x13'));var logger=require(_0x598e('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x598e('0x15'));var licenseUtil=require(_0x598e('0x16'));var db=require(_0x598e('0x17'))['db'];function respondWithStatusCode(_0x274607,_0x17941a){_0x17941a=_0x17941a||0xcc;return function(_0x316772){if(_0x316772){return _0x274607[_0x598e('0x18')](_0x17941a);}return _0x274607[_0x598e('0x19')](_0x17941a)[_0x598e('0x1a')]();};}function respondWithResult(_0x5a567a,_0x25d009){_0x25d009=_0x25d009||0xc8;return function(_0x10d050){if(_0x10d050){return _0x5a567a['status'](_0x25d009)[_0x598e('0x1b')](_0x10d050);}};}function respondWithFilteredResult(_0x3f2b2f,_0x97238f){return function(_0x585f1b){if(_0x585f1b){var _0x3c5a97=_0x585f1b[_0x598e('0x1c')],_0x517030=_0x97238f[_0x598e('0x1d')],_0x300253=_0x97238f[_0x598e('0x1d')]+_0x97238f[_0x598e('0x1e')],_0x5ebf25;if(_0x300253>=_0x3c5a97){_0x300253=_0x3c5a97;_0x5ebf25=0xc8;}else{_0x5ebf25=0xce;}_0x3f2b2f['status'](_0x5ebf25);return _0x3f2b2f[_0x598e('0x1f')](_0x598e('0x20'),_0x517030+'-'+_0x300253+'/'+_0x3c5a97)['json'](_0x585f1b);}return null;};}function patchUpdates(_0x4785ee){return function(_0x1e4645){try{jsonpatch[_0x598e('0x21')](_0x1e4645,_0x4785ee,!![]);}catch(_0x3cd1c1){return BPromise[_0x598e('0x22')](_0x3cd1c1);}return _0x1e4645[_0x598e('0x23')]();};}function saveUpdates(_0x5dfb53,_0x2281fd){return function(_0x151ef2){if(_0x151ef2){return _0x151ef2['update'](_0x5dfb53)['then'](function(_0x3ff37a){return _0x3ff37a;});}return null;};}function removeEntity(_0x2c3aa6,_0x5617c9){return function(_0x5401a8){if(_0x5401a8){return _0x5401a8[_0x598e('0x24')]()['then'](function(){_0x2c3aa6[_0x598e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47e293,_0x34b909){return function(_0x53f024){if(!_0x53f024){_0x47e293[_0x598e('0x18')](0x194);}return _0x53f024;};}function handleError(_0x2a2e34,_0xa54ec0){_0xa54ec0=_0xa54ec0||0x1f4;return function(_0x41096b){logger[_0x598e('0x25')](_0x41096b[_0x598e('0x26')]);if(_0x41096b[_0x598e('0x27')]){delete _0x41096b[_0x598e('0x27')];}_0x2a2e34[_0x598e('0x19')](_0xa54ec0)[_0x598e('0x28')](_0x41096b);};}exports[_0x598e('0x29')]=function(_0x1b50b3,_0x4a2e87){var _0x272834={},_0x3a27e9={},_0x5fc731={'count':0x0,'rows':[]};var _0x3038a8=_[_0x598e('0x2a')](db[_0x598e('0x2b')][_0x598e('0x2c')],function(_0x440116){return{'name':_0x440116[_0x598e('0x2d')],'type':_0x440116[_0x598e('0x2e')]['key']};});_0x3a27e9[_0x598e('0x2f')]=_[_0x598e('0x2a')](_0x3038a8,_0x598e('0x27'));_0x3a27e9['query']=_[_0x598e('0x30')](_0x1b50b3[_0x598e('0x31')]);_0x3a27e9[_0x598e('0x32')]=_[_0x598e('0x33')](_0x3a27e9['model'],_0x3a27e9[_0x598e('0x31')]);_0x272834['attributes']=_[_0x598e('0x33')](_0x3a27e9['model'],qs[_0x598e('0x34')](_0x1b50b3[_0x598e('0x31')][_0x598e('0x34')]));_0x272834['attributes']=_0x272834['attributes'][_0x598e('0x35')]?_0x272834[_0x598e('0x36')]:_0x3a27e9[_0x598e('0x2f')];if(!_0x1b50b3[_0x598e('0x31')][_0x598e('0x37')](_0x598e('0x38'))){_0x272834['limit']=qs[_0x598e('0x1e')](_0x1b50b3[_0x598e('0x31')]['limit']);_0x272834['offset']=qs['offset'](_0x1b50b3['query'][_0x598e('0x1d')]);}_0x272834[_0x598e('0x39')]=qs[_0x598e('0x3a')](_0x1b50b3[_0x598e('0x31')]['sort']);_0x272834[_0x598e('0x3b')]=qs['filters'](_[_0x598e('0x3c')](_0x1b50b3[_0x598e('0x31')],_0x3a27e9['filters']),_0x3038a8);if(_0x1b50b3[_0x598e('0x31')][_0x598e('0x3d')]){_0x272834[_0x598e('0x3b')]=_[_0x598e('0x3e')](_0x272834[_0x598e('0x3b')],{'$or':_[_0x598e('0x2a')](_0x3038a8,function(_0x93fad4){if(_0x93fad4[_0x598e('0x2e')]!=='VIRTUAL'){var _0x4bf779={};_0x4bf779[_0x93fad4['name']]={'$like':'%'+_0x1b50b3[_0x598e('0x31')]['filter']+'%'};return _0x4bf779;}})});}_0x272834=_[_0x598e('0x3e')]({},_0x272834,_0x1b50b3['options']);var _0x48ca12={'where':_0x272834[_0x598e('0x3b')]};return db[_0x598e('0x2b')]['count'](_0x48ca12)[_0x598e('0x3f')](function(_0x2952fb){_0x5fc731['count']=_0x2952fb;if(_0x1b50b3[_0x598e('0x31')][_0x598e('0x40')]){_0x272834[_0x598e('0x41')]=[{'all':!![]}];}return db[_0x598e('0x2b')][_0x598e('0x42')](_0x272834);})[_0x598e('0x3f')](function(_0x393344){_0x5fc731[_0x598e('0x43')]=_0x393344;return _0x5fc731;})[_0x598e('0x3f')](respondWithFilteredResult(_0x4a2e87,_0x272834))[_0x598e('0x44')](handleError(_0x4a2e87,null));};exports[_0x598e('0x45')]=function(_0x3d7994,_0x224a9a){var _0x56937a={'raw':!![],'where':{'id':_0x3d7994[_0x598e('0x46')]['id']}},_0x679ceb={};_0x679ceb[_0x598e('0x2f')]=_['keys'](db[_0x598e('0x2b')][_0x598e('0x2c')]);_0x679ceb[_0x598e('0x31')]=_[_0x598e('0x30')](_0x3d7994[_0x598e('0x31')]);_0x679ceb[_0x598e('0x32')]=_[_0x598e('0x33')](_0x679ceb['model'],_0x679ceb[_0x598e('0x31')]);_0x56937a[_0x598e('0x36')]=_['intersection'](_0x679ceb['model'],qs[_0x598e('0x34')](_0x3d7994[_0x598e('0x31')][_0x598e('0x34')]));_0x56937a[_0x598e('0x36')]=_0x56937a['attributes'][_0x598e('0x35')]?_0x56937a['attributes']:_0x679ceb[_0x598e('0x2f')];if(_0x3d7994[_0x598e('0x31')][_0x598e('0x40')]){_0x56937a[_0x598e('0x41')]=[{'all':!![]}];}_0x56937a=_['merge']({},_0x56937a,_0x3d7994[_0x598e('0x47')]);return db[_0x598e('0x2b')]['find'](_0x56937a)[_0x598e('0x3f')](handleEntityNotFound(_0x224a9a,null))[_0x598e('0x3f')](respondWithResult(_0x224a9a,null))[_0x598e('0x44')](handleError(_0x224a9a,null));};exports[_0x598e('0x48')]=function(_0x2b6e66,_0x44e8ba){return db['ChatOfflineMessage'][_0x598e('0x48')](_0x2b6e66[_0x598e('0x49')],{})[_0x598e('0x3f')](respondWithResult(_0x44e8ba,0xc9))[_0x598e('0x44')](handleError(_0x44e8ba,null));};exports[_0x598e('0x4a')]=function(_0x5139f3,_0x12cb52){if(_0x5139f3[_0x598e('0x49')]['id']){delete _0x5139f3[_0x598e('0x49')]['id'];}return db['ChatOfflineMessage'][_0x598e('0x4b')]({'where':{'id':_0x5139f3['params']['id']}})['then'](handleEntityNotFound(_0x12cb52,null))['then'](saveUpdates(_0x5139f3[_0x598e('0x49')],null))[_0x598e('0x3f')](respondWithResult(_0x12cb52,null))['catch'](handleError(_0x12cb52,null));};exports[_0x598e('0x24')]=function(_0x2aa983,_0x1b088c){return db[_0x598e('0x2b')][_0x598e('0x4b')]({'where':{'id':_0x2aa983[_0x598e('0x46')]['id']}})[_0x598e('0x3f')](handleEntityNotFound(_0x1b088c,null))[_0x598e('0x3f')](removeEntity(_0x1b088c,null))[_0x598e('0x44')](handleError(_0x1b088c,null));};exports['describe']=function(_0x701028,_0x2dcdb9){return db[_0x598e('0x2b')][_0x598e('0x4c')]()[_0x598e('0x3f')](respondWithResult(_0x2dcdb9,null))[_0x598e('0x44')](handleError(_0x2dcdb9,null));}; \ No newline at end of file +var _0xd7d1=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','set','apply','reject','save','update','destroy','then','name','send','index','ChatOfflineMessage','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','body','describe','html-pdf','eml-format','rimraf'];(function(_0x3d58fa,_0x27620b){var _0x13da0f=function(_0x3f2301){while(--_0x3f2301){_0x3d58fa['push'](_0x3d58fa['shift']());}};_0x13da0f(++_0x27620b);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x42f37d,_0x47b63a){_0x42f37d=_0x42f37d-0x0;var _0x3f1cd4=_0xd7d1[_0x42f37d];return _0x3f1cd4;};'use strict';var pdf=require(_0x1d7d('0x0'));var emlformat=require(_0x1d7d('0x1'));var rimraf=require(_0x1d7d('0x2'));var zipdir=require(_0x1d7d('0x3'));var jsonpatch=require(_0x1d7d('0x4'));var rp=require(_0x1d7d('0x5'));var moment=require(_0x1d7d('0x6'));var BPromise=require(_0x1d7d('0x7'));var Mustache=require(_0x1d7d('0x8'));var util=require(_0x1d7d('0x9'));var path=require(_0x1d7d('0xa'));var sox=require(_0x1d7d('0xb'));var csv=require(_0x1d7d('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xc'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b83f,_0x5ae1c9){_0x5ae1c9=_0x5ae1c9||0xcc;return function(_0x577e07){if(_0x577e07){return _0x11b83f[_0x1d7d('0x1c')](_0x5ae1c9);}return _0x11b83f[_0x1d7d('0x1d')](_0x5ae1c9)['end']();};}function respondWithResult(_0x55dba7,_0x1d3822){_0x1d3822=_0x1d3822||0xc8;return function(_0x334e78){if(_0x334e78){return _0x55dba7[_0x1d7d('0x1d')](_0x1d3822)[_0x1d7d('0x1e')](_0x334e78);}};}function respondWithFilteredResult(_0xeb05b3,_0x53423f){return function(_0x28adf3){if(_0x28adf3){var _0x1de6cc=_0x28adf3[_0x1d7d('0x1f')],_0x51cbca=_0x53423f[_0x1d7d('0x20')],_0xb90a8c=_0x53423f[_0x1d7d('0x20')]+_0x53423f['limit'],_0x162c3a;if(_0xb90a8c>=_0x1de6cc){_0xb90a8c=_0x1de6cc;_0x162c3a=0xc8;}else{_0x162c3a=0xce;}_0xeb05b3[_0x1d7d('0x1d')](_0x162c3a);return _0xeb05b3[_0x1d7d('0x21')]('Content-Range',_0x51cbca+'-'+_0xb90a8c+'/'+_0x1de6cc)['json'](_0x28adf3);}return null;};}function patchUpdates(_0x2406dd){return function(_0x1a5101){try{jsonpatch[_0x1d7d('0x22')](_0x1a5101,_0x2406dd,!![]);}catch(_0x396802){return BPromise[_0x1d7d('0x23')](_0x396802);}return _0x1a5101[_0x1d7d('0x24')]();};}function saveUpdates(_0x54d401,_0x225f85){return function(_0x40c27f){if(_0x40c27f){return _0x40c27f[_0x1d7d('0x25')](_0x54d401)['then'](function(_0x29caf4){return _0x29caf4;});}return null;};}function removeEntity(_0x12c54b,_0x4a1cdc){return function(_0x5950bd){if(_0x5950bd){return _0x5950bd[_0x1d7d('0x26')]()[_0x1d7d('0x27')](function(){_0x12c54b[_0x1d7d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x377653,_0x106376){return function(_0x2d4c0c){if(!_0x2d4c0c){_0x377653[_0x1d7d('0x1c')](0x194);}return _0x2d4c0c;};}function handleError(_0x4fa346,_0x233463){_0x233463=_0x233463||0x1f4;return function(_0x151198){logger['error'](_0x151198['stack']);if(_0x151198[_0x1d7d('0x28')]){delete _0x151198['name'];}_0x4fa346[_0x1d7d('0x1d')](_0x233463)[_0x1d7d('0x29')](_0x151198);};}exports[_0x1d7d('0x2a')]=function(_0x22c40d,_0x465938){var _0x59f827={},_0x1c2616={},_0x98c1ad={'count':0x0,'rows':[]};var _0x352d5a=_['map'](db[_0x1d7d('0x2b')][_0x1d7d('0x2c')],function(_0x23ad85){return{'name':_0x23ad85['fieldName'],'type':_0x23ad85['type']['key']};});_0x1c2616[_0x1d7d('0x2d')]=_[_0x1d7d('0x2e')](_0x352d5a,'name');_0x1c2616[_0x1d7d('0x2f')]=_[_0x1d7d('0x30')](_0x22c40d[_0x1d7d('0x2f')]);_0x1c2616[_0x1d7d('0x31')]=_[_0x1d7d('0x32')](_0x1c2616[_0x1d7d('0x2d')],_0x1c2616[_0x1d7d('0x2f')]);_0x59f827[_0x1d7d('0x33')]=_[_0x1d7d('0x32')](_0x1c2616[_0x1d7d('0x2d')],qs['fields'](_0x22c40d['query'][_0x1d7d('0x34')]));_0x59f827[_0x1d7d('0x33')]=_0x59f827[_0x1d7d('0x33')][_0x1d7d('0x35')]?_0x59f827[_0x1d7d('0x33')]:_0x1c2616[_0x1d7d('0x2d')];if(!_0x22c40d[_0x1d7d('0x2f')][_0x1d7d('0x36')](_0x1d7d('0x37'))){_0x59f827['limit']=qs[_0x1d7d('0x38')](_0x22c40d[_0x1d7d('0x2f')][_0x1d7d('0x38')]);_0x59f827[_0x1d7d('0x20')]=qs['offset'](_0x22c40d['query'][_0x1d7d('0x20')]);}_0x59f827[_0x1d7d('0x39')]=qs['sort'](_0x22c40d[_0x1d7d('0x2f')][_0x1d7d('0x3a')]);_0x59f827['where']=qs['filters'](_[_0x1d7d('0x3b')](_0x22c40d[_0x1d7d('0x2f')],_0x1c2616[_0x1d7d('0x31')]),_0x352d5a);if(_0x22c40d[_0x1d7d('0x2f')][_0x1d7d('0x3c')]){_0x59f827[_0x1d7d('0x3d')]=_[_0x1d7d('0x3e')](_0x59f827[_0x1d7d('0x3d')],{'$or':_[_0x1d7d('0x2e')](_0x352d5a,function(_0x318b9a){if(_0x318b9a['type']!=='VIRTUAL'){var _0x57db7a={};_0x57db7a[_0x318b9a['name']]={'$like':'%'+_0x22c40d[_0x1d7d('0x2f')]['filter']+'%'};return _0x57db7a;}})});}_0x59f827=_[_0x1d7d('0x3e')]({},_0x59f827,_0x22c40d[_0x1d7d('0x3f')]);var _0x3d7c65={'where':_0x59f827['where']};return db[_0x1d7d('0x2b')][_0x1d7d('0x1f')](_0x3d7c65)[_0x1d7d('0x27')](function(_0x5b7e01){_0x98c1ad[_0x1d7d('0x1f')]=_0x5b7e01;if(_0x22c40d[_0x1d7d('0x2f')][_0x1d7d('0x40')]){_0x59f827[_0x1d7d('0x41')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x1d7d('0x42')](_0x59f827);})[_0x1d7d('0x27')](function(_0x4239fa){_0x98c1ad[_0x1d7d('0x43')]=_0x4239fa;return _0x98c1ad;})['then'](respondWithFilteredResult(_0x465938,_0x59f827))[_0x1d7d('0x44')](handleError(_0x465938,null));};exports['show']=function(_0xc38ee,_0x31b850){var _0x671580={'raw':!![],'where':{'id':_0xc38ee[_0x1d7d('0x45')]['id']}},_0x1106d1={};_0x1106d1['model']=_['keys'](db[_0x1d7d('0x2b')][_0x1d7d('0x2c')]);_0x1106d1[_0x1d7d('0x2f')]=_['keys'](_0xc38ee['query']);_0x1106d1[_0x1d7d('0x31')]=_['intersection'](_0x1106d1[_0x1d7d('0x2d')],_0x1106d1[_0x1d7d('0x2f')]);_0x671580[_0x1d7d('0x33')]=_[_0x1d7d('0x32')](_0x1106d1[_0x1d7d('0x2d')],qs[_0x1d7d('0x34')](_0xc38ee[_0x1d7d('0x2f')]['fields']));_0x671580[_0x1d7d('0x33')]=_0x671580[_0x1d7d('0x33')]['length']?_0x671580[_0x1d7d('0x33')]:_0x1106d1[_0x1d7d('0x2d')];if(_0xc38ee[_0x1d7d('0x2f')][_0x1d7d('0x40')]){_0x671580[_0x1d7d('0x41')]=[{'all':!![]}];}_0x671580=_[_0x1d7d('0x3e')]({},_0x671580,_0xc38ee[_0x1d7d('0x3f')]);return db[_0x1d7d('0x2b')][_0x1d7d('0x46')](_0x671580)[_0x1d7d('0x27')](handleEntityNotFound(_0x31b850,null))[_0x1d7d('0x27')](respondWithResult(_0x31b850,null))[_0x1d7d('0x44')](handleError(_0x31b850,null));};exports['create']=function(_0x14e80d,_0x5904e0){return db[_0x1d7d('0x2b')]['create'](_0x14e80d[_0x1d7d('0x47')],{})[_0x1d7d('0x27')](respondWithResult(_0x5904e0,0xc9))[_0x1d7d('0x44')](handleError(_0x5904e0,null));};exports[_0x1d7d('0x25')]=function(_0x5d0ccd,_0x2dbb61){if(_0x5d0ccd['body']['id']){delete _0x5d0ccd['body']['id'];}return db[_0x1d7d('0x2b')]['find']({'where':{'id':_0x5d0ccd['params']['id']}})[_0x1d7d('0x27')](handleEntityNotFound(_0x2dbb61,null))[_0x1d7d('0x27')](saveUpdates(_0x5d0ccd['body'],null))[_0x1d7d('0x27')](respondWithResult(_0x2dbb61,null))[_0x1d7d('0x44')](handleError(_0x2dbb61,null));};exports['destroy']=function(_0x1f3a63,_0x2b9faa){return db[_0x1d7d('0x2b')][_0x1d7d('0x46')]({'where':{'id':_0x1f3a63['params']['id']}})['then'](handleEntityNotFound(_0x2b9faa,null))[_0x1d7d('0x27')](removeEntity(_0x2b9faa,null))[_0x1d7d('0x44')](handleError(_0x2b9faa,null));};exports[_0x1d7d('0x48')]=function(_0x3938d0,_0x3cc5b7){return db['ChatOfflineMessage'][_0x1d7d('0x48')]()[_0x1d7d('0x27')](respondWithResult(_0x3cc5b7,null))[_0x1d7d('0x44')](handleError(_0x3cc5b7,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 61ed17e..2d2a24e 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 _0x24ca=['path','../../config/environment','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise'];(function(_0x3255c9,_0x385436){var _0xf3e2ee=function(_0x13cb87){while(--_0x13cb87){_0x3255c9['push'](_0x3255c9['shift']());}};_0xf3e2ee(++_0x385436);}(_0x24ca,0x8c));var _0xa24c=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x24ca[_0x450689];return _0x46ffb0;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa24c('0x1'));var moment=require('moment');var BPromise=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var fs=require('fs');var path=require(_0xa24c('0x4'));var rimraf=require('rimraf');var config=require(_0xa24c('0x5'));var attributes=require(_0xa24c('0x6'));module[_0xa24c('0x7')]=function(_0x5a37ae,_0x5377ed){return _0x5a37ae['define'](_0xa24c('0x8'),attributes,{'tableName':_0xa24c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa24c('0xa'),'collate':_0xa24c('0xb')});}; \ No newline at end of file +var _0x9a19=['exports','define','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x9a19,0x114));var _0x99a1=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0x9a19[_0x218972];return _0x1bb1a8;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x99a1('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index d729fcb..156475b 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 _0xb1fc=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0xb1fc,0x64));var _0xcb1f=function(_0x2f797c,_0x297dc2){_0x2f797c=_0x2f797c-0x0;var _0x299dda=_0xb1fc[_0x2f797c];return _0x299dda;};'use strict';var _=require('lodash');var util=require(_0xcb1f('0x0'));var moment=require(_0xcb1f('0x1'));var BPromise=require(_0xcb1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb1f('0x3'));var db=require(_0xcb1f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb1f('0x5'))(_0xcb1f('0x6'));var config=require(_0xcb1f('0x7'));var jayson=require(_0xcb1f('0x8'));var client=jayson['client'][_0xcb1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf4eee9,_0x28f544,_0x163919){return new BPromise(function(_0x52de78,_0x1ff9d3){return client['request'](_0xf4eee9,_0x163919)[_0xcb1f('0xa')](function(_0x154fd8){logger[_0xcb1f('0xb')](_0xcb1f('0xc'),_0x28f544,_0xcb1f('0xd'));logger['debug'](_0xcb1f('0xe'),_0x28f544,_0xcb1f('0xd'),JSON[_0xcb1f('0xf')](_0x154fd8));if(_0x154fd8[_0xcb1f('0x10')]){if(_0x154fd8['error'][_0xcb1f('0x11')]===0x1f4){logger[_0xcb1f('0x10')](_0xcb1f('0xc'),_0x28f544,_0x154fd8[_0xcb1f('0x10')][_0xcb1f('0x12')]);return _0x1ff9d3(_0x154fd8[_0xcb1f('0x10')][_0xcb1f('0x12')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x28f544,_0x154fd8['error'][_0xcb1f('0x12')]);return _0x52de78(_0x154fd8[_0xcb1f('0x10')][_0xcb1f('0x12')]);}else{logger[_0xcb1f('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x28f544,_0xcb1f('0xd'));_0x52de78(_0x154fd8[_0xcb1f('0x13')][_0xcb1f('0x12')]);}})['catch'](function(_0x437dbf){logger[_0xcb1f('0x10')](_0xcb1f('0xc'),_0x28f544,_0x437dbf);_0x1ff9d3(_0x437dbf);});});} \ No newline at end of file +var _0x160a=['request','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x167f0e,_0x2e6be2){var _0x5c7c20=function(_0x2e3a72){while(--_0x2e3a72){_0x167f0e['push'](_0x167f0e['shift']());}};_0x5c7c20(++_0x2e6be2);}(_0x160a,0x9d));var _0xa160=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0x160a[_0x54de5d];return _0x1b349e;};'use strict';var _=require(_0xa160('0x0'));var util=require(_0xa160('0x1'));var moment=require(_0xa160('0x2'));var BPromise=require(_0xa160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa160('0x4'));var db=require(_0xa160('0x5'))['db'];var utils=require(_0xa160('0x6'));var logger=require(_0xa160('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa160('0x8'));var client=jayson[_0xa160('0x9')][_0xa160('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x483fcf,_0x59e808,_0xfd9b46){return new BPromise(function(_0x58783f,_0x1bb356){return client[_0xa160('0xb')](_0x483fcf,_0xfd9b46)['then'](function(_0x514f91){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x59e808,_0xa160('0xc'));logger[_0xa160('0xd')](_0xa160('0xe'),_0x59e808,_0xa160('0xc'),JSON[_0xa160('0xf')](_0x514f91));if(_0x514f91[_0xa160('0x10')]){if(_0x514f91[_0xa160('0x10')]['code']===0x1f4){logger[_0xa160('0x10')](_0xa160('0x11'),_0x59e808,_0x514f91[_0xa160('0x10')][_0xa160('0x12')]);return _0x1bb356(_0x514f91[_0xa160('0x10')][_0xa160('0x12')]);}logger[_0xa160('0x10')](_0xa160('0x11'),_0x59e808,_0x514f91[_0xa160('0x10')][_0xa160('0x12')]);return _0x58783f(_0x514f91[_0xa160('0x10')]['message']);}else{logger[_0xa160('0x13')](_0xa160('0x11'),_0x59e808,_0xa160('0xc'));_0x58783f(_0x514f91['result']['message']);}})[_0xa160('0x14')](function(_0x499e02){logger[_0xa160('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x59e808,_0x499e02);_0x1bb356(_0x499e02);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5e5ae6d..3fafaad 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 _0x0a15=['update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0x0a15,0x142));var _0x50a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a15[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x50a1('0x0'));var path=require(_0x50a1('0x1'));var timeout=require(_0x50a1('0x2'));var express=require(_0x50a1('0x3'));var router=express[_0x50a1('0x4')]();var auth=require(_0x50a1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x50a1('0x6'));var controller=require(_0x50a1('0x7'));router['get']('/',auth[_0x50a1('0x8')](),controller[_0x50a1('0x9')]);router[_0x50a1('0xa')](_0x50a1('0xb'),auth[_0x50a1('0x8')](),controller[_0x50a1('0xc')]);router[_0x50a1('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x50a1('0xd')]);router[_0x50a1('0xe')]('/',auth[_0x50a1('0x8')](),controller[_0x50a1('0xf')]);router[_0x50a1('0x10')](_0x50a1('0x11'),auth[_0x50a1('0x8')](),controller[_0x50a1('0x12')]);router['delete'](_0x50a1('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x50a1('0x13')]=router; \ No newline at end of file +var _0x72a4=['show','post','create','put','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','/:id','isAuthenticated'];(function(_0x4195da,_0x581b75){var _0x213303=function(_0x41c3aa){while(--_0x41c3aa){_0x4195da['push'](_0x4195da['shift']());}};_0x213303(++_0x581b75);}(_0x72a4,0x1e2));var _0x472a=function(_0x193bef,_0x229b65){_0x193bef=_0x193bef-0x0;var _0x4c725e=_0x72a4[_0x193bef];return _0x4c725e;};'use strict';var multer=require('multer');var util=require(_0x472a('0x0'));var path=require(_0x472a('0x1'));var timeout=require(_0x472a('0x2'));var express=require(_0x472a('0x3'));var router=express[_0x472a('0x4')]();var auth=require(_0x472a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x472a('0x6'));var controller=require(_0x472a('0x7'));router[_0x472a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x472a('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x472a('0x9'),auth[_0x472a('0xa')](),controller[_0x472a('0xb')]);router[_0x472a('0xc')]('/',auth['isAuthenticated'](),controller[_0x472a('0xd')]);router[_0x472a('0xe')]('/:id',auth[_0x472a('0xa')](),controller['update']);router['delete'](_0x472a('0x9'),auth[_0x472a('0xa')](),controller[_0x472a('0xf')]);module[_0x472a('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 6ed0df0..4a1c85a 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 _0xa914=['ENUM','mouseOver','timeout','STRING','INTEGER','sequelize'];(function(_0x48317f,_0x12895a){var _0x4d1cce=function(_0x3942da){while(--_0x3942da){_0x48317f['push'](_0x48317f['shift']());}};_0x4d1cce(++_0x12895a);}(_0xa914,0x16d));var _0x4a91=function(_0x1c67b3,_0x3fb1ca){_0x1c67b3=_0x1c67b3-0x0;var _0x54ecd2=_0xa914[_0x1c67b3];return _0x54ecd2;};'use strict';var Sequelize=require(_0x4a91('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4a91('0x1')](_0x4a91('0x2'),_0x4a91('0x3')),'defaultValue':_0x4a91('0x2')},'selector':{'type':Sequelize[_0x4a91('0x4')]},'timeout':{'type':Sequelize[_0x4a91('0x5')]}}; \ No newline at end of file +var _0xe5e8=['STRING','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x4915c2,_0x42d37b){var _0x5e26df=function(_0x175bd3){while(--_0x175bd3){_0x4915c2['push'](_0x4915c2['shift']());}};_0x5e26df(++_0x42d37b);}(_0xe5e8,0x64));var _0x8e5e=function(_0x368cae,_0x1815f4){_0x368cae=_0x368cae-0x0;var _0x10557e=_0xe5e8[_0x368cae];return _0x10557e;};'use strict';var Sequelize=require(_0x8e5e('0x0'));module[_0x8e5e('0x1')]={'name':{'type':Sequelize[_0x8e5e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8e5e('0x3'),_0x8e5e('0x4')),'defaultValue':_0x8e5e('0x3')},'selector':{'type':Sequelize[_0x8e5e('0x2')]},'timeout':{'type':Sequelize[_0x8e5e('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index bd7c500..2df9f16 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 _0x4433=['update','then','destroy','error','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','ChatProactiveAction','create','body','catch','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x4bd3de,_0x3c6489){var _0x1b1815=function(_0x5d4cb4){while(--_0x5d4cb4){_0x4bd3de['push'](_0x4bd3de['shift']());}};_0x1b1815(++_0x3c6489);}(_0x4433,0x95));var _0x3443=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4433[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3443('0x0'));var rimraf=require(_0x3443('0x1'));var zipdir=require(_0x3443('0x2'));var jsonpatch=require(_0x3443('0x3'));var rp=require('request-promise');var moment=require(_0x3443('0x4'));var BPromise=require(_0x3443('0x5'));var Mustache=require(_0x3443('0x6'));var util=require(_0x3443('0x7'));var path=require(_0x3443('0x8'));var sox=require(_0x3443('0x9'));var csv=require(_0x3443('0xa'));var ejs=require(_0x3443('0xb'));var fs=require('fs');var _=require(_0x3443('0xc'));var squel=require(_0x3443('0xd'));var crypto=require('crypto');var jsforce=require(_0x3443('0xe'));var deskjs=require(_0x3443('0xf'));var toCsv=require(_0x3443('0xa'));var querystring=require('querystring');var Papa=require(_0x3443('0x10'));var Redis=require(_0x3443('0x11'));var authService=require(_0x3443('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3443('0x13'));var hardwareService=require(_0x3443('0x14'));var logger=require(_0x3443('0x15'))(_0x3443('0x16'));var utils=require(_0x3443('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3443('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x196281,_0x16e477){_0x16e477=_0x16e477||0xcc;return function(_0x2bc555){if(_0x2bc555){return _0x196281[_0x3443('0x19')](_0x16e477);}return _0x196281['status'](_0x16e477)[_0x3443('0x1a')]();};}function respondWithResult(_0x4702d9,_0x2261fc){_0x2261fc=_0x2261fc||0xc8;return function(_0x328050){if(_0x328050){return _0x4702d9[_0x3443('0x1b')](_0x2261fc)[_0x3443('0x1c')](_0x328050);}};}function respondWithFilteredResult(_0x5e0481,_0x2dccb3){return function(_0x5c25ae){if(_0x5c25ae){var _0x59354c=_0x5c25ae[_0x3443('0x1d')],_0x33e8db=_0x2dccb3[_0x3443('0x1e')],_0x488150=_0x2dccb3[_0x3443('0x1e')]+_0x2dccb3[_0x3443('0x1f')],_0x2fd742;if(_0x488150>=_0x59354c){_0x488150=_0x59354c;_0x2fd742=0xc8;}else{_0x2fd742=0xce;}_0x5e0481[_0x3443('0x1b')](_0x2fd742);return _0x5e0481[_0x3443('0x20')](_0x3443('0x21'),_0x33e8db+'-'+_0x488150+'/'+_0x59354c)[_0x3443('0x1c')](_0x5c25ae);}return null;};}function patchUpdates(_0x5f0e4d){return function(_0x5e7776){try{jsonpatch[_0x3443('0x22')](_0x5e7776,_0x5f0e4d,!![]);}catch(_0x247775){return BPromise[_0x3443('0x23')](_0x247775);}return _0x5e7776[_0x3443('0x24')]();};}function saveUpdates(_0x3f5943,_0x1710f9){return function(_0x503be4){if(_0x503be4){return _0x503be4[_0x3443('0x25')](_0x3f5943)[_0x3443('0x26')](function(_0x3a0b11){return _0x3a0b11;});}return null;};}function removeEntity(_0x4a79dd,_0x14d628){return function(_0x34cc37){if(_0x34cc37){return _0x34cc37[_0x3443('0x27')]()[_0x3443('0x26')](function(){_0x4a79dd[_0x3443('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c80fd,_0x50f050){return function(_0x5c3f8a){if(!_0x5c3f8a){_0x1c80fd[_0x3443('0x19')](0x194);}return _0x5c3f8a;};}function handleError(_0x42d0fe,_0x306284){_0x306284=_0x306284||0x1f4;return function(_0xcd7dbf){logger[_0x3443('0x28')](_0xcd7dbf['stack']);if(_0xcd7dbf['name']){delete _0xcd7dbf[_0x3443('0x29')];}_0x42d0fe[_0x3443('0x1b')](_0x306284)[_0x3443('0x2a')](_0xcd7dbf);};}exports[_0x3443('0x2b')]=function(_0x3d58a8,_0x3cbe7f){var _0x3e6414={'raw':!![],'where':{'id':_0x3d58a8['params']['id']}},_0xf550d2={};_0xf550d2[_0x3443('0x2c')]=_[_0x3443('0x2d')](db['ChatProactiveAction'][_0x3443('0x2e')]);_0xf550d2['query']=_['keys'](_0x3d58a8[_0x3443('0x2f')]);_0xf550d2[_0x3443('0x30')]=_[_0x3443('0x31')](_0xf550d2[_0x3443('0x2c')],_0xf550d2[_0x3443('0x2f')]);_0x3e6414[_0x3443('0x32')]=_[_0x3443('0x31')](_0xf550d2[_0x3443('0x2c')],qs[_0x3443('0x33')](_0x3d58a8[_0x3443('0x2f')]['fields']));_0x3e6414['attributes']=_0x3e6414['attributes'][_0x3443('0x34')]?_0x3e6414[_0x3443('0x32')]:_0xf550d2[_0x3443('0x2c')];if(_0x3d58a8[_0x3443('0x2f')][_0x3443('0x35')]){_0x3e6414[_0x3443('0x36')]=[{'all':!![]}];}_0x3e6414=_['merge']({},_0x3e6414,_0x3d58a8[_0x3443('0x37')]);return db[_0x3443('0x38')]['find'](_0x3e6414)[_0x3443('0x26')](handleEntityNotFound(_0x3cbe7f,null))[_0x3443('0x26')](respondWithResult(_0x3cbe7f,null))['catch'](handleError(_0x3cbe7f,null));};exports[_0x3443('0x39')]=function(_0x29f92e,_0x183cc2){return db['ChatProactiveAction']['create'](_0x29f92e[_0x3443('0x3a')],{})[_0x3443('0x26')](respondWithResult(_0x183cc2,0xc9))[_0x3443('0x3b')](handleError(_0x183cc2,null));};exports[_0x3443('0x25')]=function(_0x3d380b,_0x40ff89){if(_0x3d380b[_0x3443('0x3a')]['id']){delete _0x3d380b['body']['id'];}return db[_0x3443('0x38')][_0x3443('0x3c')]({'where':{'id':_0x3d380b['params']['id']}})[_0x3443('0x26')](handleEntityNotFound(_0x40ff89,null))[_0x3443('0x26')](saveUpdates(_0x3d380b[_0x3443('0x3a')],null))[_0x3443('0x26')](respondWithResult(_0x40ff89,null))[_0x3443('0x3b')](handleError(_0x40ff89,null));};exports['destroy']=function(_0x32676e,_0x4bf4f8){return db['ChatProactiveAction']['find']({'where':{'id':_0x32676e[_0x3443('0x3d')]['id']}})[_0x3443('0x26')](handleEntityNotFound(_0x4bf4f8,null))[_0x3443('0x26')](removeEntity(_0x4bf4f8,null))[_0x3443('0x3b')](handleError(_0x4bf4f8,null));}; \ No newline at end of file +var _0x1afe=['zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','params','model','keys','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','options','ChatProactiveAction','find','catch','create','body','html-pdf','eml-format','rimraf'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x1afe,0x11a));var _0xe1af=function(_0x328740,_0x26e1b2){_0x328740=_0x328740-0x0;var _0x30e10c=_0x1afe[_0x328740];return _0x30e10c;};'use strict';var pdf=require(_0xe1af('0x0'));var emlformat=require(_0xe1af('0x1'));var rimraf=require(_0xe1af('0x2'));var zipdir=require(_0xe1af('0x3'));var jsonpatch=require(_0xe1af('0x4'));var rp=require(_0xe1af('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe1af('0x6'));var util=require(_0xe1af('0x7'));var path=require(_0xe1af('0x8'));var sox=require(_0xe1af('0x9'));var csv=require(_0xe1af('0xa'));var ejs=require(_0xe1af('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe1af('0xc'));var crypto=require(_0xe1af('0xd'));var jsforce=require(_0xe1af('0xe'));var deskjs=require(_0xe1af('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe1af('0x10'));var Papa=require(_0xe1af('0x11'));var Redis=require('ioredis');var authService=require(_0xe1af('0x12'));var qs=require(_0xe1af('0x13'));var as=require(_0xe1af('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1af('0x15'))(_0xe1af('0x16'));var utils=require(_0xe1af('0x17'));var config=require(_0xe1af('0x18'));var licenseUtil=require(_0xe1af('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11cb64,_0x192b1a){_0x192b1a=_0x192b1a||0xcc;return function(_0x31ff40){if(_0x31ff40){return _0x11cb64['sendStatus'](_0x192b1a);}return _0x11cb64[_0xe1af('0x1a')](_0x192b1a)[_0xe1af('0x1b')]();};}function respondWithResult(_0x5b51be,_0x37cabf){_0x37cabf=_0x37cabf||0xc8;return function(_0x6efed5){if(_0x6efed5){return _0x5b51be[_0xe1af('0x1a')](_0x37cabf)['json'](_0x6efed5);}};}function respondWithFilteredResult(_0x2dac70,_0x204847){return function(_0x4ed476){if(_0x4ed476){var _0x5d54d3=_0x4ed476[_0xe1af('0x1c')],_0x285702=_0x204847[_0xe1af('0x1d')],_0x1c5eb8=_0x204847[_0xe1af('0x1d')]+_0x204847[_0xe1af('0x1e')],_0x2b5ba1;if(_0x1c5eb8>=_0x5d54d3){_0x1c5eb8=_0x5d54d3;_0x2b5ba1=0xc8;}else{_0x2b5ba1=0xce;}_0x2dac70[_0xe1af('0x1a')](_0x2b5ba1);return _0x2dac70[_0xe1af('0x1f')](_0xe1af('0x20'),_0x285702+'-'+_0x1c5eb8+'/'+_0x5d54d3)['json'](_0x4ed476);}return null;};}function patchUpdates(_0x1dc37b){return function(_0x3c8099){try{jsonpatch['apply'](_0x3c8099,_0x1dc37b,!![]);}catch(_0x422daa){return BPromise[_0xe1af('0x21')](_0x422daa);}return _0x3c8099[_0xe1af('0x22')]();};}function saveUpdates(_0x4a263b,_0x5c1d0b){return function(_0x5b8dac){if(_0x5b8dac){return _0x5b8dac[_0xe1af('0x23')](_0x4a263b)[_0xe1af('0x24')](function(_0xe73e1c){return _0xe73e1c;});}return null;};}function removeEntity(_0x97b380,_0x163f77){return function(_0x7791f0){if(_0x7791f0){return _0x7791f0[_0xe1af('0x25')]()[_0xe1af('0x24')](function(){_0x97b380[_0xe1af('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x469435,_0x263aad){return function(_0x4b8244){if(!_0x4b8244){_0x469435['sendStatus'](0x194);}return _0x4b8244;};}function handleError(_0x5b3b9f,_0x5ec3bf){_0x5ec3bf=_0x5ec3bf||0x1f4;return function(_0x4c295d){logger[_0xe1af('0x26')](_0x4c295d['stack']);if(_0x4c295d[_0xe1af('0x27')]){delete _0x4c295d[_0xe1af('0x27')];}_0x5b3b9f[_0xe1af('0x1a')](_0x5ec3bf)['send'](_0x4c295d);};}exports['show']=function(_0x31a969,_0x541dc7){var _0x39c0bc={'raw':!![],'where':{'id':_0x31a969[_0xe1af('0x28')]['id']}},_0x9b4de7={};_0x9b4de7[_0xe1af('0x29')]=_[_0xe1af('0x2a')](db['ChatProactiveAction'][_0xe1af('0x2b')]);_0x9b4de7[_0xe1af('0x2c')]=_['keys'](_0x31a969[_0xe1af('0x2c')]);_0x9b4de7['filters']=_[_0xe1af('0x2d')](_0x9b4de7[_0xe1af('0x29')],_0x9b4de7[_0xe1af('0x2c')]);_0x39c0bc['attributes']=_['intersection'](_0x9b4de7[_0xe1af('0x29')],qs['fields'](_0x31a969[_0xe1af('0x2c')][_0xe1af('0x2e')]));_0x39c0bc[_0xe1af('0x2f')]=_0x39c0bc['attributes'][_0xe1af('0x30')]?_0x39c0bc[_0xe1af('0x2f')]:_0x9b4de7[_0xe1af('0x29')];if(_0x31a969['query'][_0xe1af('0x31')]){_0x39c0bc[_0xe1af('0x32')]=[{'all':!![]}];}_0x39c0bc=_['merge']({},_0x39c0bc,_0x31a969[_0xe1af('0x33')]);return db[_0xe1af('0x34')][_0xe1af('0x35')](_0x39c0bc)[_0xe1af('0x24')](handleEntityNotFound(_0x541dc7,null))['then'](respondWithResult(_0x541dc7,null))[_0xe1af('0x36')](handleError(_0x541dc7,null));};exports[_0xe1af('0x37')]=function(_0x3ef638,_0x3f6d29){return db[_0xe1af('0x34')]['create'](_0x3ef638[_0xe1af('0x38')],{})['then'](respondWithResult(_0x3f6d29,0xc9))[_0xe1af('0x36')](handleError(_0x3f6d29,null));};exports[_0xe1af('0x23')]=function(_0x2a3121,_0x152d78){if(_0x2a3121[_0xe1af('0x38')]['id']){delete _0x2a3121[_0xe1af('0x38')]['id'];}return db['ChatProactiveAction'][_0xe1af('0x35')]({'where':{'id':_0x2a3121[_0xe1af('0x28')]['id']}})[_0xe1af('0x24')](handleEntityNotFound(_0x152d78,null))[_0xe1af('0x24')](saveUpdates(_0x2a3121[_0xe1af('0x38')],null))[_0xe1af('0x24')](respondWithResult(_0x152d78,null))[_0xe1af('0x36')](handleError(_0x152d78,null));};exports[_0xe1af('0x25')]=function(_0x41c8f3,_0x5e46e4){return db[_0xe1af('0x34')][_0xe1af('0x35')]({'where':{'id':_0x41c8f3[_0xe1af('0x28')]['id']}})[_0xe1af('0x24')](handleEntityNotFound(_0x5e46e4,null))[_0xe1af('0x24')](removeEntity(_0x5e46e4,null))[_0xe1af('0x36')](handleError(_0x5e46e4,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 4195fa4..6c63774 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 _0x8612=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','lodash','util'];(function(_0x2b5a17,_0x595834){var _0x2beeff=function(_0x3469c8){while(--_0x3469c8){_0x2b5a17['push'](_0x2b5a17['shift']());}};_0x2beeff(++_0x595834);}(_0x8612,0x130));var _0x2861=function(_0x46da88,_0x5317c3){_0x46da88=_0x46da88-0x0;var _0x4f9704=_0x8612[_0x46da88];return _0x4f9704;};'use strict';var _=require(_0x2861('0x0'));var util=require(_0x2861('0x1'));var logger=require('../../config/logger')(_0x2861('0x2'));var moment=require(_0x2861('0x3'));var BPromise=require(_0x2861('0x4'));var rp=require(_0x2861('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2861('0x6'));var config=require(_0x2861('0x7'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x4d1b26,_0x42b6b9){return _0x4d1b26[_0x2861('0x8')]('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd26=['exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd26,0xe0));var _0x6dd2=function(_0x29cd05,_0x38abdc){_0x29cd05=_0x29cd05-0x0;var _0x3181ae=_0xdd26[_0x29cd05];return _0x3181ae;};'use strict';var _=require(_0x6dd2('0x0'));var util=require(_0x6dd2('0x1'));var logger=require(_0x6dd2('0x2'))('api');var moment=require(_0x6dd2('0x3'));var BPromise=require(_0x6dd2('0x4'));var rp=require(_0x6dd2('0x5'));var fs=require('fs');var path=require(_0x6dd2('0x6'));var rimraf=require(_0x6dd2('0x7'));var config=require(_0x6dd2('0x8'));var attributes=require(_0x6dd2('0x9'));module[_0x6dd2('0xa')]=function(_0x302315,_0x3a0098){return _0x302315['define'](_0x6dd2('0xb'),attributes,{'tableName':_0x6dd2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index cc632d3..8bb2472 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 _0x1844=['info','request\x20sent','debug','stringify','code','error','message','ChatProactiveAction,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x1844,0xf1));var _0x4184=function(_0x5dedde,_0x25cefd){_0x5dedde=_0x5dedde-0x0;var _0x375549=_0x1844[_0x5dedde];return _0x375549;};'use strict';var _=require(_0x4184('0x0'));var util=require('util');var moment=require(_0x4184('0x1'));var BPromise=require(_0x4184('0x2'));var rs=require(_0x4184('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4184('0x4'));var logger=require(_0x4184('0x5'))('rpc');var config=require(_0x4184('0x6'));var jayson=require(_0x4184('0x7'));var client=jayson[_0x4184('0x8')][_0x4184('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31b732,_0x375fb3,_0x231727){return new BPromise(function(_0x4be469,_0x1d4ac2){return client[_0x4184('0xa')](_0x31b732,_0x231727)['then'](function(_0x2b0e7f){logger[_0x4184('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x375fb3,_0x4184('0xc'));logger[_0x4184('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x375fb3,'request\x20sent',JSON[_0x4184('0xe')](_0x2b0e7f));if(_0x2b0e7f['error']){if(_0x2b0e7f['error'][_0x4184('0xf')]===0x1f4){logger[_0x4184('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x375fb3,_0x2b0e7f[_0x4184('0x10')]['message']);return _0x1d4ac2(_0x2b0e7f[_0x4184('0x10')][_0x4184('0x11')]);}logger[_0x4184('0x10')](_0x4184('0x12'),_0x375fb3,_0x2b0e7f['error'][_0x4184('0x11')]);return _0x4be469(_0x2b0e7f[_0x4184('0x10')][_0x4184('0x11')]);}else{logger[_0x4184('0xb')](_0x4184('0x12'),_0x375fb3,'request\x20sent');_0x4be469(_0x2b0e7f[_0x4184('0x13')]['message']);}})[_0x4184('0x14')](function(_0x49a27a){logger[_0x4184('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x375fb3,_0x49a27a);_0x1d4ac2(_0x49a27a);});});} \ No newline at end of file +var _0x76a2=['result','lodash','util','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x76a2,0x65));var _0x276a=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x76a2[_0x5c4585];return _0x21dede;};'use strict';var _=require(_0x276a('0x0'));var util=require(_0x276a('0x1'));var moment=require(_0x276a('0x2'));var BPromise=require(_0x276a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x276a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x276a('0x5'));var jayson=require(_0x276a('0x6'));var client=jayson[_0x276a('0x7')][_0x276a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16e52d,_0x40f550,_0x49a1c1){return new BPromise(function(_0x4ac7b2,_0x4d0180){return client[_0x276a('0x9')](_0x16e52d,_0x49a1c1)[_0x276a('0xa')](function(_0x51eaa0){logger[_0x276a('0xb')](_0x276a('0xc'),_0x40f550,_0x276a('0xd'));logger[_0x276a('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x40f550,_0x276a('0xd'),JSON[_0x276a('0xf')](_0x51eaa0));if(_0x51eaa0[_0x276a('0x10')]){if(_0x51eaa0[_0x276a('0x10')][_0x276a('0x11')]===0x1f4){logger[_0x276a('0x10')](_0x276a('0xc'),_0x40f550,_0x51eaa0[_0x276a('0x10')][_0x276a('0x12')]);return _0x4d0180(_0x51eaa0[_0x276a('0x10')][_0x276a('0x12')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x40f550,_0x51eaa0[_0x276a('0x10')][_0x276a('0x12')]);return _0x4ac7b2(_0x51eaa0[_0x276a('0x10')][_0x276a('0x12')]);}else{logger['info'](_0x276a('0xc'),_0x40f550,_0x276a('0xd'));_0x4ac7b2(_0x51eaa0[_0x276a('0x13')][_0x276a('0x12')]);}})['catch'](function(_0x51d2ea){logger['error'](_0x276a('0xc'),_0x40f550,_0x51d2ea);_0x4d0180(_0x51d2ea);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 619507e..a37500e 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 _0xd1bd=['../../config/environment','/:id','show','post','isAuthenticated','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0xd2cbbd,_0x42d6ac){var _0x5d6125=function(_0x5d715f){while(--_0x5d715f){_0xd2cbbd['push'](_0xd2cbbd['shift']());}};_0x5d6125(++_0x42d6ac);}(_0xd1bd,0x8a));var _0xdd1b=function(_0x4a36c9,_0x16a7e9){_0x4a36c9=_0x4a36c9-0x0;var _0x53c122=_0xd1bd[_0x4a36c9];return _0x53c122;};'use strict';var multer=require(_0xdd1b('0x0'));var util=require('util');var path=require(_0xdd1b('0x1'));var timeout=require(_0xdd1b('0x2'));var express=require('express');var router=express[_0xdd1b('0x3')]();var auth=require(_0xdd1b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdd1b('0x5'));var controller=require('./chatProactiveAction.controller');router['get'](_0xdd1b('0x6'),auth['isAuthenticated'](),controller[_0xdd1b('0x7')]);router[_0xdd1b('0x8')]('/',auth[_0xdd1b('0x9')](),controller['create']);router['put'](_0xdd1b('0x6'),auth[_0xdd1b('0x9')](),controller['update']);router[_0xdd1b('0xa')]('/:id',auth[_0xdd1b('0x9')](),controller[_0xdd1b('0xb')]);module[_0xdd1b('0xc')]=router; \ No newline at end of file +var _0x262d=['update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','isAuthenticated'];(function(_0x137e7d,_0x5d6c6d){var _0x4fcc8c=function(_0x29d829){while(--_0x29d829){_0x137e7d['push'](_0x137e7d['shift']());}};_0x4fcc8c(++_0x5d6c6d);}(_0x262d,0x14c));var _0xd262=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x262d[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0xd262('0x0'));var util=require(_0xd262('0x1'));var path=require(_0xd262('0x2'));var timeout=require(_0xd262('0x3'));var express=require(_0xd262('0x4'));var router=express['Router']();var auth=require(_0xd262('0x5'));var interaction=require(_0xd262('0x6'));var config=require(_0xd262('0x7'));var controller=require(_0xd262('0x8'));router[_0xd262('0x9')](_0xd262('0xa'),auth['isAuthenticated'](),controller[_0xd262('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xd262('0xc')](),controller[_0xd262('0xd')]);router['delete'](_0xd262('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xd262('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 81835e9..0375161 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 _0x13d5=['rrmemory','beepall','sequelize','STRING','name','INTEGER'];(function(_0x3558b5,_0x27e106){var _0x18e65a=function(_0x6bf0e8){while(--_0x6bf0e8){_0x3558b5['push'](_0x3558b5['shift']());}};_0x18e65a(++_0x27e106);}(_0x13d5,0x11c));var _0x513d=function(_0x36cfdf,_0x4a8bc9){_0x36cfdf=_0x36cfdf-0x0;var _0x39f4a1=_0x13d5[_0x36cfdf];return _0x39f4a1;};'use strict';var Sequelize=require(_0x513d('0x0'));module['exports']={'name':{'type':Sequelize[_0x513d('0x1')],'unique':_0x513d('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x513d('0x1')]},'timeout':{'type':Sequelize[_0x513d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x513d('0x4'),_0x513d('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xb1fa=['sequelize','exports','STRING','name','rrmemory','roundrobin'];(function(_0x3851fe,_0x50e4dc){var _0x198ecd=function(_0x4070c5){while(--_0x4070c5){_0x3851fe['push'](_0x3851fe['shift']());}};_0x198ecd(++_0x50e4dc);}(_0xb1fa,0xae));var _0xab1f=function(_0x597be3,_0x181b87){_0x597be3=_0x597be3-0x0;var _0x36b627=_0xb1fa[_0x597be3];return _0x36b627;};'use strict';var Sequelize=require(_0xab1f('0x0'));module[_0xab1f('0x1')]={'name':{'type':Sequelize[_0xab1f('0x2')],'unique':_0xab1f('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xab1f('0x4'),'beepall',_0xab1f('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index f2c2cb4..161b0c4 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 _0x85fc=['register','jayson/promise','client','http','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','offset','Content-Range','json','save','update','then','destroy','get','ChatQueues','UserProfileResource','sendStatus','stack','name','index','ChatQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','limit','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','nolimit','addTeams','ids','User','online','voicePause','interface','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','Agents','clone','sequelize','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','emit','addAgents','omit','isArray','userChatQueue:remove','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket'];(function(_0x1137d0,_0xe2d6b6){var _0x36cb62=function(_0x1a6b59){while(--_0x1a6b59){_0x1137d0['push'](_0x1137d0['shift']());}};_0x36cb62(++_0xe2d6b6);}(_0x85fc,0x7b));var _0xc85f=function(_0x6befa7,_0x258347){_0x6befa7=_0x6befa7-0x0;var _0x5e9d53=_0x85fc[_0x6befa7];return _0x5e9d53;};'use strict';var pdf=require(_0xc85f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc85f('0x1'));var jsonpatch=require(_0xc85f('0x2'));var rp=require(_0xc85f('0x3'));var moment=require(_0xc85f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc85f('0x5'));var util=require(_0xc85f('0x6'));var path=require('path');var sox=require(_0xc85f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc85f('0x8'));var crypto=require('crypto');var jsforce=require(_0xc85f('0x9'));var deskjs=require(_0xc85f('0xa'));var toCsv=require(_0xc85f('0xb'));var querystring=require(_0xc85f('0xc'));var Papa=require(_0xc85f('0xd'));var Redis=require(_0xc85f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc85f('0xf'));var as=require(_0xc85f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc85f('0x11'));var utils=require('../../config/utils');var config=require(_0xc85f('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc85f('0x13')]=_[_0xc85f('0x14')](config[_0xc85f('0x13')],{'host':_0xc85f('0x15'),'port':0x18eb});var socket=require(_0xc85f('0x16'))(new Redis(config[_0xc85f('0x13')]));require(_0xc85f('0x17'))[_0xc85f('0x18')](socket);var jayson=require(_0xc85f('0x19'));var client=jayson[_0xc85f('0x1a')][_0xc85f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x560a29,_0x4d0964,_0x419e6b,_0x305246){return new BPromise(function(_0x2d1bec,_0x2986c4){var _0x3dace3=_0x305246||client;return _0x3dace3[_0xc85f('0x1c')](_0x560a29,_0x419e6b)['then'](function(_0x4bad59){logger[_0xc85f('0x1d')](_0xc85f('0x1e'),_0x4d0964,_0xc85f('0x1f'));logger[_0xc85f('0x20')](_0xc85f('0x21'),_0x4d0964,_0xc85f('0x1f'),JSON[_0xc85f('0x22')](_0x4bad59));if(_0x4bad59['error']){if(_0x4bad59[_0xc85f('0x23')]['code']===0x1f4){logger['error'](_0xc85f('0x1e'),_0x4d0964,_0x4bad59[_0xc85f('0x23')]['message']);return _0x2986c4(_0x4bad59[_0xc85f('0x23')]['message']);}logger[_0xc85f('0x23')](_0xc85f('0x1e'),_0x4d0964,_0x4bad59['error'][_0xc85f('0x24')]);return _0x2d1bec(_0x4bad59[_0xc85f('0x23')][_0xc85f('0x24')]);}else{logger[_0xc85f('0x1d')](_0xc85f('0x1e'),_0x4d0964,_0xc85f('0x1f'));_0x2d1bec(_0x4bad59[_0xc85f('0x25')]['message']);}})[_0xc85f('0x26')](function(_0x4f8619){logger[_0xc85f('0x23')](_0xc85f('0x1e'),_0x4d0964,_0x4f8619);_0x2986c4(_0x4f8619);});});}function respondWithStatusCode(_0x240e92,_0x379160){_0x379160=_0x379160||0xcc;return function(_0x528fd0){if(_0x528fd0){return _0x240e92['sendStatus'](_0x379160);}return _0x240e92[_0xc85f('0x27')](_0x379160)[_0xc85f('0x28')]();};}function respondWithResult(_0x464225,_0x2ddbb7){_0x2ddbb7=_0x2ddbb7||0xc8;return function(_0x40dd82){if(_0x40dd82){return _0x464225[_0xc85f('0x27')](_0x2ddbb7)['json'](_0x40dd82);}};}function respondWithFilteredResult(_0x169978,_0x172750){return function(_0x476da5){if(_0x476da5){var _0x23894c=_0x476da5['count'],_0x1af152=_0x172750[_0xc85f('0x29')],_0x3ec423=_0x172750[_0xc85f('0x29')]+_0x172750['limit'],_0x50699c;if(_0x3ec423>=_0x23894c){_0x3ec423=_0x23894c;_0x50699c=0xc8;}else{_0x50699c=0xce;}_0x169978[_0xc85f('0x27')](_0x50699c);return _0x169978['set'](_0xc85f('0x2a'),_0x1af152+'-'+_0x3ec423+'/'+_0x23894c)[_0xc85f('0x2b')](_0x476da5);}return null;};}function patchUpdates(_0x1e21dc){return function(_0x49225c){try{jsonpatch['apply'](_0x49225c,_0x1e21dc,!![]);}catch(_0x684d3e){return BPromise['reject'](_0x684d3e);}return _0x49225c[_0xc85f('0x2c')]();};}function saveUpdates(_0x3218ce,_0x200181){return function(_0x2424f2){if(_0x2424f2){return _0x2424f2[_0xc85f('0x2d')](_0x3218ce)[_0xc85f('0x2e')](function(_0x145368){return _0x145368;});}return null;};}function removeEntity(_0x43b497,_0x404ae2){return function(_0x347e23){if(_0x347e23){return _0x347e23[_0xc85f('0x2f')]()[_0xc85f('0x2e')](function(){var _0x52f88a=_0x347e23[_0xc85f('0x30')]({'plain':!![]});var _0x511bda=_0xc85f('0x31');return db[_0xc85f('0x32')][_0xc85f('0x2f')]({'where':{'type':_0x511bda,'resourceId':_0x52f88a['id']}})[_0xc85f('0x2e')](function(){return _0x347e23;});})[_0xc85f('0x2e')](function(){_0x43b497[_0xc85f('0x27')](0xcc)[_0xc85f('0x28')]();});}};}function handleEntityNotFound(_0xba26c8,_0x952723){return function(_0x5bec25){if(!_0x5bec25){_0xba26c8[_0xc85f('0x33')](0x194);}return _0x5bec25;};}function handleError(_0x218c15,_0x389886){_0x389886=_0x389886||0x1f4;return function(_0x45b0ee){logger[_0xc85f('0x23')](_0x45b0ee[_0xc85f('0x34')]);if(_0x45b0ee[_0xc85f('0x35')]){delete _0x45b0ee[_0xc85f('0x35')];}_0x218c15['status'](_0x389886)['send'](_0x45b0ee);};}exports[_0xc85f('0x36')]=function(_0x3fb74c,_0x3e2049){var _0x5898fa={},_0x45b1b8={},_0x28e079={'count':0x0,'rows':[]};var _0x1b2bea=_['map'](db[_0xc85f('0x37')][_0xc85f('0x38')],function(_0x213f07){return{'name':_0x213f07[_0xc85f('0x39')],'type':_0x213f07[_0xc85f('0x3a')][_0xc85f('0x3b')]};});_0x45b1b8['model']=_[_0xc85f('0x3c')](_0x1b2bea,_0xc85f('0x35'));_0x45b1b8[_0xc85f('0x3d')]=_[_0xc85f('0x3e')](_0x3fb74c[_0xc85f('0x3d')]);_0x45b1b8[_0xc85f('0x3f')]=_[_0xc85f('0x40')](_0x45b1b8['model'],_0x45b1b8['query']);_0x5898fa[_0xc85f('0x41')]=_[_0xc85f('0x40')](_0x45b1b8['model'],qs[_0xc85f('0x42')](_0x3fb74c[_0xc85f('0x3d')][_0xc85f('0x42')]));_0x5898fa[_0xc85f('0x41')]=_0x5898fa[_0xc85f('0x41')][_0xc85f('0x43')]?_0x5898fa[_0xc85f('0x41')]:_0x45b1b8[_0xc85f('0x44')];if(!_0x3fb74c['query'][_0xc85f('0x45')]('nolimit')){_0x5898fa[_0xc85f('0x46')]=qs['limit'](_0x3fb74c[_0xc85f('0x3d')][_0xc85f('0x46')]);_0x5898fa['offset']=qs[_0xc85f('0x29')](_0x3fb74c[_0xc85f('0x3d')][_0xc85f('0x29')]);}_0x5898fa[_0xc85f('0x47')]=qs[_0xc85f('0x48')](_0x3fb74c['query'][_0xc85f('0x48')]);_0x5898fa[_0xc85f('0x49')]=qs['filters'](_[_0xc85f('0x4a')](_0x3fb74c[_0xc85f('0x3d')],_0x45b1b8['filters']),_0x1b2bea);if(_0x3fb74c['query']['filter']){_0x5898fa[_0xc85f('0x49')]=_[_0xc85f('0x4b')](_0x5898fa[_0xc85f('0x49')],{'$or':_['map'](_0x1b2bea,function(_0x2cd020){if(_0x2cd020[_0xc85f('0x3a')]!=='VIRTUAL'){var _0x58a910={};_0x58a910[_0x2cd020[_0xc85f('0x35')]]={'$like':'%'+_0x3fb74c[_0xc85f('0x3d')][_0xc85f('0x4c')]+'%'};return _0x58a910;}})});}_0x5898fa=_[_0xc85f('0x4b')]({},_0x5898fa,_0x3fb74c[_0xc85f('0x4d')]);var _0x184f33={'where':_0x5898fa[_0xc85f('0x49')]};return db[_0xc85f('0x37')][_0xc85f('0x4e')](_0x184f33)[_0xc85f('0x2e')](function(_0x3a879f){_0x28e079[_0xc85f('0x4e')]=_0x3a879f;if(_0x3fb74c['query'][_0xc85f('0x4f')]){_0x5898fa[_0xc85f('0x50')]=[{'all':!![]}];}return db['ChatQueue'][_0xc85f('0x51')](_0x5898fa);})[_0xc85f('0x2e')](function(_0x3552cc){_0x28e079[_0xc85f('0x52')]=_0x3552cc;return _0x28e079;})[_0xc85f('0x2e')](respondWithFilteredResult(_0x3e2049,_0x5898fa))['catch'](handleError(_0x3e2049,null));};exports[_0xc85f('0x53')]=function(_0x35416c,_0x579ca5){var _0x4d078d={'raw':!![],'where':{'id':_0x35416c[_0xc85f('0x54')]['id']}},_0x34ce96={};_0x34ce96[_0xc85f('0x44')]=_[_0xc85f('0x3e')](db[_0xc85f('0x37')]['rawAttributes']);_0x34ce96[_0xc85f('0x3d')]=_[_0xc85f('0x3e')](_0x35416c[_0xc85f('0x3d')]);_0x34ce96[_0xc85f('0x3f')]=_[_0xc85f('0x40')](_0x34ce96[_0xc85f('0x44')],_0x34ce96['query']);_0x4d078d['attributes']=_[_0xc85f('0x40')](_0x34ce96[_0xc85f('0x44')],qs['fields'](_0x35416c[_0xc85f('0x3d')][_0xc85f('0x42')]));_0x4d078d['attributes']=_0x4d078d[_0xc85f('0x41')][_0xc85f('0x43')]?_0x4d078d['attributes']:_0x34ce96[_0xc85f('0x44')];if(_0x35416c[_0xc85f('0x3d')][_0xc85f('0x4f')]){_0x4d078d['include']=[{'all':!![]}];}_0x4d078d=_[_0xc85f('0x4b')]({},_0x4d078d,_0x35416c['options']);return db['ChatQueue'][_0xc85f('0x55')](_0x4d078d)[_0xc85f('0x2e')](handleEntityNotFound(_0x579ca5,null))[_0xc85f('0x2e')](respondWithResult(_0x579ca5,null))[_0xc85f('0x26')](handleError(_0x579ca5,null));};exports[_0xc85f('0x56')]=function(_0x4a7b93,_0x22e787){return db[_0xc85f('0x37')][_0xc85f('0x56')](_0x4a7b93[_0xc85f('0x57')],{})['then'](function(_0xebdc1c){var _0x208753=_0x4a7b93[_0xc85f('0x58')][_0xc85f('0x30')]({'plain':!![]});if(!_0x208753)throw new Error(_0xc85f('0x59'));if(_0x208753[_0xc85f('0x5a')]===_0xc85f('0x58')){var _0x420e42=_0xebdc1c['get']({'plain':!![]});var _0xe42212='ChatQueues';return db['UserProfileSection']['find']({'where':{'name':_0xe42212,'userProfileId':_0x208753[_0xc85f('0x5b')]},'raw':!![]})[_0xc85f('0x2e')](function(_0x58bdf2){if(_0x58bdf2&&_0x58bdf2[_0xc85f('0x5c')]===0x0){return db[_0xc85f('0x32')][_0xc85f('0x56')]({'name':_0x420e42[_0xc85f('0x35')],'resourceId':_0x420e42['id'],'type':_0x58bdf2[_0xc85f('0x35')],'sectionId':_0x58bdf2['id']},{})[_0xc85f('0x2e')](function(){return _0xebdc1c;});}else{return _0xebdc1c;}})[_0xc85f('0x26')](function(_0x3244ad){logger[_0xc85f('0x23')](_0xc85f('0x5d'),_0x3244ad);throw _0x3244ad;});}return _0xebdc1c;})[_0xc85f('0x2e')](respondWithResult(_0x22e787,0xc9))[_0xc85f('0x26')](handleError(_0x22e787,null));};exports[_0xc85f('0x2d')]=function(_0x360d2d,_0x14c9b6){if(_0x360d2d[_0xc85f('0x57')]['id']){delete _0x360d2d['body']['id'];}return db[_0xc85f('0x37')][_0xc85f('0x55')]({'where':{'id':_0x360d2d['params']['id']}})[_0xc85f('0x2e')](handleEntityNotFound(_0x14c9b6,null))[_0xc85f('0x2e')](saveUpdates(_0x360d2d['body'],null))[_0xc85f('0x2e')](respondWithResult(_0x14c9b6,null))[_0xc85f('0x26')](handleError(_0x14c9b6,null));};exports[_0xc85f('0x2f')]=function(_0xd107b2,_0x3e9bcd){return db[_0xc85f('0x37')][_0xc85f('0x55')]({'where':{'id':_0xd107b2[_0xc85f('0x54')]['id']}})[_0xc85f('0x2e')](handleEntityNotFound(_0x3e9bcd,null))[_0xc85f('0x2e')](removeEntity(_0x3e9bcd,null))[_0xc85f('0x26')](handleError(_0x3e9bcd,null));};exports[_0xc85f('0x5e')]=function(_0x50c0f5,_0x50faaf){return db['ChatQueue'][_0xc85f('0x5e')]()[_0xc85f('0x2e')](respondWithResult(_0x50faaf,null))[_0xc85f('0x26')](handleError(_0x50faaf,null));};exports['getMembers']=function(_0x2d8cdd,_0x4df548,_0x1509d6){var _0x3e203c={'raw':!![],'where':{}},_0x199f5d={},_0x2e3fa2;return db[_0xc85f('0x37')][_0xc85f('0x5f')]({'where':{'id':_0x2d8cdd[_0xc85f('0x54')]['id']}})[_0xc85f('0x2e')](handleEntityNotFound(_0x4df548,null))['then'](function(_0x24d76c){if(_0x24d76c){_0x2e3fa2=_0x24d76c[_0xc85f('0x30')]({'plain':!![]});_0x199f5d[_0xc85f('0x44')]=_[_0xc85f('0x3e')](db[_0xc85f('0x60')][_0xc85f('0x38')]);_0x199f5d[_0xc85f('0x3d')]=_[_0xc85f('0x3e')](_0x2d8cdd[_0xc85f('0x3d')]);_0x199f5d[_0xc85f('0x3f')]=_[_0xc85f('0x40')](_0x199f5d[_0xc85f('0x44')],_0x199f5d[_0xc85f('0x3d')]);_0x3e203c[_0xc85f('0x41')]=_[_0xc85f('0x40')](_0x199f5d[_0xc85f('0x44')],qs[_0xc85f('0x42')](_0x2d8cdd[_0xc85f('0x3d')][_0xc85f('0x42')]));_0x3e203c[_0xc85f('0x41')]=_0x3e203c['attributes'][_0xc85f('0x43')]?_0x3e203c['attributes']:_0x199f5d[_0xc85f('0x44')];if(!_0x2d8cdd[_0xc85f('0x3d')][_0xc85f('0x45')]('nolimit')){_0x3e203c[_0xc85f('0x46')]=qs['limit'](_0x2d8cdd[_0xc85f('0x3d')][_0xc85f('0x46')]);_0x3e203c[_0xc85f('0x29')]=qs[_0xc85f('0x29')](_0x2d8cdd[_0xc85f('0x3d')][_0xc85f('0x29')]);}_0x3e203c[_0xc85f('0x47')]=qs[_0xc85f('0x48')](_0x2d8cdd['query']['sort']);_0x3e203c[_0xc85f('0x49')]=qs[_0xc85f('0x3f')](_[_0xc85f('0x4a')](_0x2d8cdd['query'],_0x199f5d[_0xc85f('0x3f')]));_0x3e203c['where']['ChatQueueId']=_0x24d76c['id'];if(_0x2d8cdd[_0xc85f('0x3d')][_0xc85f('0x4c')]){_0x3e203c[_0xc85f('0x49')]=_[_0xc85f('0x4b')](_0x3e203c[_0xc85f('0x49')],{'$or':_[_0xc85f('0x3c')](_0x3e203c[_0xc85f('0x41')],function(_0xf4ac7e){var _0x3d2aca={};_0x3d2aca[_0xf4ac7e]={'$like':'%'+_0x2d8cdd['query']['filter']+'%'};return _0x3d2aca;})});}_0x3e203c=_[_0xc85f('0x4b')]({},_0x3e203c,_0x2d8cdd['options']);return db[_0xc85f('0x60')]['findAll'](_0x3e203c);}})[_0xc85f('0x2e')](function(_0x3620de){if(_0x3620de){return db['User'][_0xc85f('0x61')]({'where':{'id':_[_0xc85f('0x3c')](_0x3620de,_0xc85f('0x62')),'role':_0xc85f('0x63')},'attributes':['id',_0xc85f('0x35'),_0xc85f('0x64'),_0xc85f('0x65'),'createdAt']});}})[_0xc85f('0x2e')](function(_0x33aa0b){if(_0x33aa0b){return{'count':_0x33aa0b[_0xc85f('0x4e')],'rows':_[_0xc85f('0x3c')](_0x33aa0b[_0xc85f('0x52')],function(_0x46228f){return{'membername':_0x46228f['name'],'UserId':_0x46228f['id'],'queue_name':_0x2e3fa2[_0xc85f('0x35')],'ChatQueueId':_0x2e3fa2['id'],'interface':util[_0xc85f('0x66')](_0xc85f('0x67'),'SIP',_0x46228f[_0xc85f('0x35')]),'penalty':0x0,'paused':_0x46228f['chatPause'],'createdAt':_0x46228f[_0xc85f('0x68')],'updatedAt':_0x46228f[_0xc85f('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4df548,_0x3e203c))[_0xc85f('0x26')](handleError(_0x4df548,null));};exports[_0xc85f('0x69')]=function(_0xc5859b,_0x36ef27,_0x4f9c93){var _0x1df4c0={};var _0x252e49={};var _0x119e22;var _0x1f495a;return db[_0xc85f('0x37')][_0xc85f('0x5f')]({'where':{'id':_0xc5859b['params']['id']}})[_0xc85f('0x2e')](handleEntityNotFound(_0x36ef27,null))[_0xc85f('0x2e')](function(_0x47222d){if(_0x47222d){_0x119e22=_0x47222d;_0x252e49[_0xc85f('0x44')]=_[_0xc85f('0x3e')](db[_0xc85f('0x6a')][_0xc85f('0x38')]);_0x252e49[_0xc85f('0x3d')]=_['keys'](_0xc5859b[_0xc85f('0x3d')]);_0x252e49[_0xc85f('0x3f')]=_[_0xc85f('0x40')](_0x252e49[_0xc85f('0x44')],_0x252e49[_0xc85f('0x3d')]);_0x1df4c0['attributes']=_[_0xc85f('0x40')](_0x252e49[_0xc85f('0x44')],qs['fields'](_0xc5859b[_0xc85f('0x3d')][_0xc85f('0x42')]));_0x1df4c0['attributes']=_0x1df4c0[_0xc85f('0x41')][_0xc85f('0x43')]?_0x1df4c0['attributes']:_0x252e49[_0xc85f('0x44')];_0x1df4c0[_0xc85f('0x47')]=qs[_0xc85f('0x48')](_0xc5859b[_0xc85f('0x3d')][_0xc85f('0x48')]);_0x1df4c0[_0xc85f('0x49')]=qs['filters'](_[_0xc85f('0x4a')](_0xc5859b[_0xc85f('0x3d')],_0x252e49[_0xc85f('0x3f')]));if(_0xc5859b[_0xc85f('0x3d')]['filter']){_0x1df4c0['where']=_['merge'](_0x1df4c0[_0xc85f('0x49')],{'$or':_['map'](_0x1df4c0[_0xc85f('0x41')],function(_0x457d43){var _0x1281de={};_0x1281de[_0x457d43]={'$like':'%'+_0xc5859b['query'][_0xc85f('0x4c')]+'%'};return _0x1281de;})});}_0x1df4c0=_['merge']({},_0x1df4c0,_0xc5859b[_0xc85f('0x4d')]);return _0x119e22['getTeams'](_0x1df4c0);}})[_0xc85f('0x2e')](function(_0x4ddb95){if(_0x4ddb95){_0x1f495a=_0x4ddb95[_0xc85f('0x43')];if(!_0xc5859b[_0xc85f('0x3d')][_0xc85f('0x45')](_0xc85f('0x6b'))){_0x1df4c0[_0xc85f('0x46')]=qs[_0xc85f('0x46')](_0xc5859b[_0xc85f('0x3d')][_0xc85f('0x46')]);_0x1df4c0['offset']=qs['offset'](_0xc5859b['query'][_0xc85f('0x29')]);}return _0x119e22[_0xc85f('0x69')](_0x1df4c0);}})[_0xc85f('0x2e')](function(_0x4f00db){if(_0x4f00db){return _0x4f00db?{'count':_0x1f495a,'rows':_0x4f00db}:null;}})[_0xc85f('0x2e')](respondWithResult(_0x36ef27,null))[_0xc85f('0x26')](handleError(_0x36ef27,null));};exports[_0xc85f('0x6c')]=function(_0x4aad33,_0x44b3fd,_0x2a9e89){var _0x1ffbe4=_0x4aad33['body'][_0xc85f('0x6d')];return db[_0xc85f('0x6a')][_0xc85f('0x51')]({'where':{'id':_0x1ffbe4},'attributes':['id'],'include':[{'model':db[_0xc85f('0x6e')],'as':'Agents','attributes':['id',_0xc85f('0x35'),_0xc85f('0x6f'),_0xc85f('0x70'),_0xc85f('0x71')],'raw':!![]}]})[_0xc85f('0x2e')](function(_0x2d3435){if(_0x2d3435){var _0x5681a0=_['flatMap'](_0x2d3435,function(_0x4794f5){var _0x1d59b1=_0x4794f5['get']({'plain':!![]});return _0x1d59b1['Agents'];});return db[_0xc85f('0x37')][_0xc85f('0x55')]({'where':{'id':_0x4aad33['params']['id']}})[_0xc85f('0x2e')](function(_0x2292f0){return db['sequelize'][_0xc85f('0x72')](function(_0x51c12a){return _0x2292f0[_0xc85f('0x6c')](_0x1ffbe4,{'transaction':_0x51c12a})['then'](function(){return BPromise[_0xc85f('0x73')](_0x5681a0,function(_0x1bd4ac){return db['UserChatQueue'][_0xc85f('0x74')]({'where':{'UserId':_0x1bd4ac['id'],'ChatQueueId':_0x4aad33[_0xc85f('0x54')]['id']},'transaction':_0x51c12a});});})[_0xc85f('0x2e')](function(){_0x5681a0[_0xc85f('0x75')](function(_0x14c8ff){socket['emit'](_0xc85f('0x76'),{'UserId':_0x14c8ff['id'],'ChatQueueId':_0x2292f0['id']});});});});});}})[_0xc85f('0x2e')](respondWithStatusCode(_0x44b3fd,null))[_0xc85f('0x26')](handleError(_0x44b3fd,null));};exports[_0xc85f('0x77')]=function(_0x1e1128,_0x1e590c,_0x178515){return db[_0xc85f('0x6a')][_0xc85f('0x51')]({'where':{'id':_0x1e1128[_0xc85f('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc85f('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc85f('0x2e')](handleEntityNotFound(_0x1e590c,null))[_0xc85f('0x2e')](function(_0x10b8cf){var _0x3deb8f=_[_0xc85f('0x3c')](_0x10b8cf,'id');var _0x50d93b=[];var _0x15c56c=[];var _0x3ca75c=squel['select']();_0x3ca75c[_0xc85f('0x78')](_0xc85f('0x79'))[_0xc85f('0x7a')](_0xc85f('0x7b'),'tq')[_0xc85f('0x7c')](_0xc85f('0x7d'),'ut',_0xc85f('0x7e'))[_0xc85f('0x49')](_0xc85f('0x7f'),_0x1e1128['params']['id']);for(var _0x30c7f8=0x0;_0x30c7f8<_0x10b8cf[_0xc85f('0x43')];_0x30c7f8+=0x1){let _0x21f4b0=_0x10b8cf[_0x30c7f8];for(var _0x1f2b39=0x0;_0x1f2b39<_0x21f4b0[_0xc85f('0x80')][_0xc85f('0x43')];_0x1f2b39+=0x1){let _0x426489=_0x21f4b0[_0xc85f('0x80')][_0x1f2b39];var _0x390273=_0x3ca75c[_0xc85f('0x81')]();_0x390273['where']('ut.UserId\x20=\x20?',_0x426489['id']);_0x15c56c['push'](db[_0xc85f('0x82')][_0xc85f('0x3d')](_0x390273[_0xc85f('0x83')](),{'type':db['sequelize'][_0xc85f('0x84')][_0xc85f('0x85')]})['then'](function(_0x506209){if(_0x506209[_0xc85f('0x43')]===0x1){return _0x426489['id'];}else{var _0x57846a=_[_0xc85f('0x86')](_['map'](_0x506209,'TeamId'),function(_0x1aac03){return _[_0xc85f('0x87')](_0x3deb8f,_0x1aac03);});if(_0x57846a){return _0x426489['id'];}}}));}}return BPromise[_0xc85f('0x88')](_0x15c56c)['then'](function(_0xdf510a){_0x50d93b=_(_0x50d93b)['union'](_0xdf510a)[_0xc85f('0x89')]()[_0xc85f('0x8a')]();return db[_0xc85f('0x37')][_0xc85f('0x55')]({'where':{'id':_0x1e1128[_0xc85f('0x54')]['id']}})[_0xc85f('0x2e')](function(_0x3f583a){return db['sequelize'][_0xc85f('0x72')](function(_0x140899){return _0x3f583a['removeTeams'](_0x1e1128[_0xc85f('0x3d')][_0xc85f('0x6d')],{'transaction':_0x140899})[_0xc85f('0x2e')](function(){if(!_[_0xc85f('0x8b')](_0x50d93b)){return _0x3f583a[_0xc85f('0x8c')](_0x50d93b,{'transaction':_0x140899});}})[_0xc85f('0x2e')](function(){_0x50d93b[_0xc85f('0x75')](function(_0x1f483b){socket[_0xc85f('0x8d')]('userChatQueue:remove',{'UserId':_0x1f483b,'ChatQueueId':_0x3f583a['id']});});});});});});})[_0xc85f('0x2e')](respondWithStatusCode(_0x1e590c,null))['catch'](handleError(_0x1e590c,null));};exports[_0xc85f('0x8e')]=function(_0x556101,_0x2e08d1,_0x315b7f){return db[_0xc85f('0x37')]['find']({'where':{'id':_0x556101['params']['id']}})[_0xc85f('0x2e')](handleEntityNotFound(_0x2e08d1,null))[_0xc85f('0x2e')](function(_0x29cfa2){if(_0x29cfa2){return _0x29cfa2['addAgents'](_0x556101[_0xc85f('0x57')][_0xc85f('0x6d')],_[_0xc85f('0x8f')](_0x556101[_0xc85f('0x57')],[_0xc85f('0x6d'),'id'])||{})['spread'](function(_0x918faf){for(var _0x1665ed=0x0;_0x1665ed<_0x556101[_0xc85f('0x57')][_0xc85f('0x6d')][_0xc85f('0x43')];_0x1665ed+=0x1){socket['emit'](_0xc85f('0x76'),{'UserId':_0x556101[_0xc85f('0x57')]['ids'][_0x1665ed],'ChatQueueId':_0x556101[_0xc85f('0x54')]['id']});}return _0x918faf;});}})[_0xc85f('0x2e')](respondWithResult(_0x2e08d1,null))['catch'](handleError(_0x2e08d1,null));};exports[_0xc85f('0x8c')]=function(_0x560784,_0x6ddfc8,_0x2080a2){return db[_0xc85f('0x37')][_0xc85f('0x55')]({'where':{'id':_0x560784['params']['id']}})[_0xc85f('0x2e')](handleEntityNotFound(_0x6ddfc8,null))[_0xc85f('0x2e')](function(_0x4aa9e3){if(_0x4aa9e3){return _0x4aa9e3[_0xc85f('0x8c')](_0x560784[_0xc85f('0x3d')]['ids'])[_0xc85f('0x2e')](function(){if(_[_0xc85f('0x90')](_0x560784[_0xc85f('0x3d')][_0xc85f('0x6d')])){for(var _0x120088=0x0;_0x120088<_0x560784[_0xc85f('0x3d')][_0xc85f('0x6d')]['length'];_0x120088+=0x1){socket[_0xc85f('0x8d')](_0xc85f('0x91'),{'UserId':Number(_0x560784[_0xc85f('0x3d')][_0xc85f('0x6d')][_0x120088]),'ChatQueueId':Number(_0x560784[_0xc85f('0x54')]['id'])});}}else{socket[_0xc85f('0x8d')](_0xc85f('0x91'),{'UserId':Number(_0x560784[_0xc85f('0x3d')][_0xc85f('0x6d')]),'ChatQueueId':Number(_0x560784['params']['id'])});}});}})[_0xc85f('0x2e')](respondWithStatusCode(_0x6ddfc8,null))['catch'](handleError(_0x6ddfc8,null));};exports[_0xc85f('0x92')]=function(_0x32a42e,_0x2f7a0b,_0x3081f2){var _0x2b9b60={};var _0x5541be={};var _0x452fad;var _0x5146ee;return db[_0xc85f('0x37')]['findOne']({'where':{'id':_0x32a42e[_0xc85f('0x54')]['id']}})[_0xc85f('0x2e')](handleEntityNotFound(_0x2f7a0b,null))['then'](function(_0x21edf9){if(_0x21edf9){_0x452fad=_0x21edf9;_0x5541be['model']=_[_0xc85f('0x3e')](db[_0xc85f('0x6e')][_0xc85f('0x38')]);_0x5541be[_0xc85f('0x3d')]=_[_0xc85f('0x3e')](_0x32a42e[_0xc85f('0x3d')]);_0x5541be[_0xc85f('0x3f')]=_[_0xc85f('0x40')](_0x5541be[_0xc85f('0x44')],_0x5541be[_0xc85f('0x3d')]);_0x2b9b60[_0xc85f('0x41')]=_[_0xc85f('0x40')](_0x5541be[_0xc85f('0x44')],qs[_0xc85f('0x42')](_0x32a42e[_0xc85f('0x3d')][_0xc85f('0x42')]));_0x2b9b60['attributes']=_0x2b9b60[_0xc85f('0x41')][_0xc85f('0x43')]?_0x2b9b60[_0xc85f('0x41')]:_0x5541be['model'];_0x2b9b60[_0xc85f('0x47')]=qs['sort'](_0x32a42e['query'][_0xc85f('0x48')]);_0x2b9b60[_0xc85f('0x49')]=qs['filters'](_['pick'](_0x32a42e['query'],_0x5541be[_0xc85f('0x3f')]));if(_0x32a42e[_0xc85f('0x3d')]['filter']){_0x2b9b60[_0xc85f('0x49')]=_[_0xc85f('0x4b')](_0x2b9b60[_0xc85f('0x49')],{'$or':_[_0xc85f('0x3c')](_0x2b9b60[_0xc85f('0x41')],function(_0x54fa78){var _0x5a69fb={};_0x5a69fb[_0x54fa78]={'$like':'%'+_0x32a42e['query']['filter']+'%'};return _0x5a69fb;})});}_0x2b9b60=_[_0xc85f('0x4b')]({},_0x2b9b60,_0x32a42e[_0xc85f('0x4d')]);return _0x452fad[_0xc85f('0x92')](_0x2b9b60);}})[_0xc85f('0x2e')](function(_0x3f533d){if(_0x3f533d){_0x5146ee=_0x3f533d['length'];if(!_0x32a42e[_0xc85f('0x3d')][_0xc85f('0x45')]('nolimit')){_0x2b9b60['limit']=qs[_0xc85f('0x46')](_0x32a42e[_0xc85f('0x3d')][_0xc85f('0x46')]);_0x2b9b60['offset']=qs[_0xc85f('0x29')](_0x32a42e[_0xc85f('0x3d')][_0xc85f('0x29')]);}return _0x452fad['getAgents'](_0x2b9b60);}})['then'](function(_0x4361a1){if(_0x4361a1){return _0x4361a1?{'count':_0x5146ee,'rows':_0x4361a1}:null;}})[_0xc85f('0x2e')](respondWithResult(_0x2f7a0b,null))[_0xc85f('0x26')](handleError(_0x2f7a0b,null));}; \ No newline at end of file +var _0x8fbf=['ChatQueues','sendStatus','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','find','describe','findOne','User','agent','chatPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','online','voicePause','interface','flatMap','Agents','each','UserChatQueue','findOrCreate','forEach','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','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/license/util','../../mysqldb','defaults','redis','localhost','./chatQueue.socket','jayson/promise','client','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x299027,_0xb6e99e){var _0x3d55c7=function(_0x5506dd){while(--_0x5506dd){_0x299027['push'](_0x299027['shift']());}};_0x3d55c7(++_0xb6e99e);}(_0x8fbf,0x18b));var _0xf8fb=function(_0x15170c,_0x1d419c){_0x15170c=_0x15170c-0x0;var _0x32ea40=_0x8fbf[_0x15170c];return _0x32ea40;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf8fb('0x0'));var rimraf=require(_0xf8fb('0x1'));var zipdir=require(_0xf8fb('0x2'));var jsonpatch=require(_0xf8fb('0x3'));var rp=require(_0xf8fb('0x4'));var moment=require('moment');var BPromise=require(_0xf8fb('0x5'));var Mustache=require(_0xf8fb('0x6'));var util=require(_0xf8fb('0x7'));var path=require(_0xf8fb('0x8'));var sox=require(_0xf8fb('0x9'));var csv=require(_0xf8fb('0xa'));var ejs=require(_0xf8fb('0xb'));var fs=require('fs');var _=require(_0xf8fb('0xc'));var squel=require(_0xf8fb('0xd'));var crypto=require(_0xf8fb('0xe'));var jsforce=require(_0xf8fb('0xf'));var deskjs=require(_0xf8fb('0x10'));var toCsv=require(_0xf8fb('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf8fb('0x11'));var authService=require(_0xf8fb('0x12'));var qs=require(_0xf8fb('0x13'));var as=require(_0xf8fb('0x14'));var hardwareService=require(_0xf8fb('0x15'));var logger=require(_0xf8fb('0x16'))(_0xf8fb('0x17'));var utils=require(_0xf8fb('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf8fb('0x19'));var db=require(_0xf8fb('0x1a'))['db'];config['redis']=_[_0xf8fb('0x1b')](config[_0xf8fb('0x1c')],{'host':_0xf8fb('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf8fb('0x1c')]));require(_0xf8fb('0x1e'))['register'](socket);var jayson=require(_0xf8fb('0x1f'));var client=jayson[_0xf8fb('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ecef8,_0x204eaa,_0x4334b4,_0x2b6159){return new BPromise(function(_0x40469e,_0x4406f2){var _0x1fd24a=_0x2b6159||client;return _0x1fd24a[_0xf8fb('0x21')](_0x4ecef8,_0x4334b4)['then'](function(_0x490e35){logger[_0xf8fb('0x22')](_0xf8fb('0x23'),_0x204eaa,'request\x20sent');logger[_0xf8fb('0x24')](_0xf8fb('0x25'),_0x204eaa,_0xf8fb('0x26'),JSON[_0xf8fb('0x27')](_0x490e35));if(_0x490e35[_0xf8fb('0x28')]){if(_0x490e35['error']['code']===0x1f4){logger[_0xf8fb('0x28')](_0xf8fb('0x23'),_0x204eaa,_0x490e35[_0xf8fb('0x28')]['message']);return _0x4406f2(_0x490e35[_0xf8fb('0x28')]['message']);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x204eaa,_0x490e35[_0xf8fb('0x28')]['message']);return _0x40469e(_0x490e35['error'][_0xf8fb('0x29')]);}else{logger[_0xf8fb('0x22')](_0xf8fb('0x23'),_0x204eaa,'request\x20sent');_0x40469e(_0x490e35['result'][_0xf8fb('0x29')]);}})['catch'](function(_0x2dce91){logger[_0xf8fb('0x28')](_0xf8fb('0x23'),_0x204eaa,_0x2dce91);_0x4406f2(_0x2dce91);});});}function respondWithStatusCode(_0x15b7d3,_0x23bb50){_0x23bb50=_0x23bb50||0xcc;return function(_0x10a59c){if(_0x10a59c){return _0x15b7d3['sendStatus'](_0x23bb50);}return _0x15b7d3[_0xf8fb('0x2a')](_0x23bb50)['end']();};}function respondWithResult(_0x4dd04a,_0x2639f6){_0x2639f6=_0x2639f6||0xc8;return function(_0x548a69){if(_0x548a69){return _0x4dd04a['status'](_0x2639f6)[_0xf8fb('0x2b')](_0x548a69);}};}function respondWithFilteredResult(_0x25fa7d,_0x423d2d){return function(_0x42d4c7){if(_0x42d4c7){var _0x47b500=_0x42d4c7[_0xf8fb('0x2c')],_0xffd350=_0x423d2d[_0xf8fb('0x2d')],_0x4890fb=_0x423d2d[_0xf8fb('0x2d')]+_0x423d2d[_0xf8fb('0x2e')],_0x720551;if(_0x4890fb>=_0x47b500){_0x4890fb=_0x47b500;_0x720551=0xc8;}else{_0x720551=0xce;}_0x25fa7d['status'](_0x720551);return _0x25fa7d['set'](_0xf8fb('0x2f'),_0xffd350+'-'+_0x4890fb+'/'+_0x47b500)[_0xf8fb('0x2b')](_0x42d4c7);}return null;};}function patchUpdates(_0x57dd06){return function(_0x2ad550){try{jsonpatch[_0xf8fb('0x30')](_0x2ad550,_0x57dd06,!![]);}catch(_0x46364f){return BPromise[_0xf8fb('0x31')](_0x46364f);}return _0x2ad550[_0xf8fb('0x32')]();};}function saveUpdates(_0x5297e4,_0xf3ab5c){return function(_0x3c617c){if(_0x3c617c){return _0x3c617c[_0xf8fb('0x33')](_0x5297e4)[_0xf8fb('0x34')](function(_0x5ea602){return _0x5ea602;});}return null;};}function removeEntity(_0xbd89c8,_0x462ad9){return function(_0x5de32a){if(_0x5de32a){return _0x5de32a[_0xf8fb('0x35')]()['then'](function(){var _0x5c3095=_0x5de32a[_0xf8fb('0x36')]({'plain':!![]});var _0xfab7c2=_0xf8fb('0x37');return db['UserProfileResource'][_0xf8fb('0x35')]({'where':{'type':_0xfab7c2,'resourceId':_0x5c3095['id']}})[_0xf8fb('0x34')](function(){return _0x5de32a;});})[_0xf8fb('0x34')](function(){_0xbd89c8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x135526,_0x1caa27){return function(_0x171aaf){if(!_0x171aaf){_0x135526[_0xf8fb('0x38')](0x194);}return _0x171aaf;};}function handleError(_0x215810,_0x2d58be){_0x2d58be=_0x2d58be||0x1f4;return function(_0x2cced6){logger[_0xf8fb('0x28')](_0x2cced6['stack']);if(_0x2cced6['name']){delete _0x2cced6[_0xf8fb('0x39')];}_0x215810['status'](_0x2d58be)['send'](_0x2cced6);};}exports[_0xf8fb('0x3a')]=function(_0x436454,_0xce66fc){var _0x263f62={},_0x5818b5={},_0x46152d={'count':0x0,'rows':[]};var _0x80f1d1=_[_0xf8fb('0x3b')](db[_0xf8fb('0x3c')][_0xf8fb('0x3d')],function(_0x3c3a3d){return{'name':_0x3c3a3d[_0xf8fb('0x3e')],'type':_0x3c3a3d[_0xf8fb('0x3f')][_0xf8fb('0x40')]};});_0x5818b5[_0xf8fb('0x41')]=_[_0xf8fb('0x3b')](_0x80f1d1,'name');_0x5818b5[_0xf8fb('0x42')]=_[_0xf8fb('0x43')](_0x436454[_0xf8fb('0x42')]);_0x5818b5['filters']=_['intersection'](_0x5818b5['model'],_0x5818b5[_0xf8fb('0x42')]);_0x263f62[_0xf8fb('0x44')]=_[_0xf8fb('0x45')](_0x5818b5[_0xf8fb('0x41')],qs['fields'](_0x436454['query'][_0xf8fb('0x46')]));_0x263f62[_0xf8fb('0x44')]=_0x263f62[_0xf8fb('0x44')][_0xf8fb('0x47')]?_0x263f62[_0xf8fb('0x44')]:_0x5818b5[_0xf8fb('0x41')];if(!_0x436454[_0xf8fb('0x42')][_0xf8fb('0x48')](_0xf8fb('0x49'))){_0x263f62[_0xf8fb('0x2e')]=qs['limit'](_0x436454['query'][_0xf8fb('0x2e')]);_0x263f62[_0xf8fb('0x2d')]=qs[_0xf8fb('0x2d')](_0x436454[_0xf8fb('0x42')][_0xf8fb('0x2d')]);}_0x263f62[_0xf8fb('0x4a')]=qs[_0xf8fb('0x4b')](_0x436454[_0xf8fb('0x42')][_0xf8fb('0x4b')]);_0x263f62[_0xf8fb('0x4c')]=qs[_0xf8fb('0x4d')](_[_0xf8fb('0x4e')](_0x436454['query'],_0x5818b5[_0xf8fb('0x4d')]),_0x80f1d1);if(_0x436454[_0xf8fb('0x42')][_0xf8fb('0x4f')]){_0x263f62[_0xf8fb('0x4c')]=_['merge'](_0x263f62['where'],{'$or':_['map'](_0x80f1d1,function(_0x302465){if(_0x302465[_0xf8fb('0x3f')]!==_0xf8fb('0x50')){var _0x5946ec={};_0x5946ec[_0x302465[_0xf8fb('0x39')]]={'$like':'%'+_0x436454[_0xf8fb('0x42')][_0xf8fb('0x4f')]+'%'};return _0x5946ec;}})});}_0x263f62=_[_0xf8fb('0x51')]({},_0x263f62,_0x436454['options']);var _0x9d5c00={'where':_0x263f62[_0xf8fb('0x4c')]};return db[_0xf8fb('0x3c')][_0xf8fb('0x2c')](_0x9d5c00)[_0xf8fb('0x34')](function(_0x5c836b){_0x46152d[_0xf8fb('0x2c')]=_0x5c836b;if(_0x436454[_0xf8fb('0x42')]['includeAll']){_0x263f62[_0xf8fb('0x52')]=[{'all':!![]}];}return db[_0xf8fb('0x3c')][_0xf8fb('0x53')](_0x263f62);})[_0xf8fb('0x34')](function(_0x18d2a4){_0x46152d['rows']=_0x18d2a4;return _0x46152d;})[_0xf8fb('0x34')](respondWithFilteredResult(_0xce66fc,_0x263f62))[_0xf8fb('0x54')](handleError(_0xce66fc,null));};exports[_0xf8fb('0x55')]=function(_0x33f327,_0x1a5347){var _0x517bdf={'raw':!![],'where':{'id':_0x33f327[_0xf8fb('0x56')]['id']}},_0x4f73f2={};_0x4f73f2[_0xf8fb('0x41')]=_[_0xf8fb('0x43')](db[_0xf8fb('0x3c')][_0xf8fb('0x3d')]);_0x4f73f2[_0xf8fb('0x42')]=_['keys'](_0x33f327[_0xf8fb('0x42')]);_0x4f73f2[_0xf8fb('0x4d')]=_[_0xf8fb('0x45')](_0x4f73f2[_0xf8fb('0x41')],_0x4f73f2['query']);_0x517bdf[_0xf8fb('0x44')]=_[_0xf8fb('0x45')](_0x4f73f2[_0xf8fb('0x41')],qs[_0xf8fb('0x46')](_0x33f327['query'][_0xf8fb('0x46')]));_0x517bdf[_0xf8fb('0x44')]=_0x517bdf[_0xf8fb('0x44')][_0xf8fb('0x47')]?_0x517bdf[_0xf8fb('0x44')]:_0x4f73f2[_0xf8fb('0x41')];if(_0x33f327[_0xf8fb('0x42')][_0xf8fb('0x57')]){_0x517bdf[_0xf8fb('0x52')]=[{'all':!![]}];}_0x517bdf=_[_0xf8fb('0x51')]({},_0x517bdf,_0x33f327[_0xf8fb('0x58')]);return db[_0xf8fb('0x3c')]['find'](_0x517bdf)[_0xf8fb('0x34')](handleEntityNotFound(_0x1a5347,null))[_0xf8fb('0x34')](respondWithResult(_0x1a5347,null))[_0xf8fb('0x54')](handleError(_0x1a5347,null));};exports[_0xf8fb('0x59')]=function(_0x4e3fbd,_0x9a2a1e){return db[_0xf8fb('0x3c')][_0xf8fb('0x59')](_0x4e3fbd[_0xf8fb('0x5a')],{})[_0xf8fb('0x34')](function(_0x1f068a){var _0x5171ff=_0x4e3fbd[_0xf8fb('0x5b')][_0xf8fb('0x36')]({'plain':!![]});if(!_0x5171ff)throw new Error(_0xf8fb('0x5c'));if(_0x5171ff[_0xf8fb('0x5d')]===_0xf8fb('0x5b')){var _0x19ee6f=_0x1f068a[_0xf8fb('0x36')]({'plain':!![]});var _0x325e6e=_0xf8fb('0x37');return db[_0xf8fb('0x5e')]['find']({'where':{'name':_0x325e6e,'userProfileId':_0x5171ff[_0xf8fb('0x5f')]},'raw':!![]})[_0xf8fb('0x34')](function(_0x537281){if(_0x537281&&_0x537281['autoAssociation']===0x0){return db['UserProfileResource'][_0xf8fb('0x59')]({'name':_0x19ee6f[_0xf8fb('0x39')],'resourceId':_0x19ee6f['id'],'type':_0x537281['name'],'sectionId':_0x537281['id']},{})[_0xf8fb('0x34')](function(){return _0x1f068a;});}else{return _0x1f068a;}})[_0xf8fb('0x54')](function(_0xdd8da1){logger[_0xf8fb('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdd8da1);throw _0xdd8da1;});}return _0x1f068a;})[_0xf8fb('0x34')](respondWithResult(_0x9a2a1e,0xc9))[_0xf8fb('0x54')](handleError(_0x9a2a1e,null));};exports['update']=function(_0x5b16b1,_0x467f3a){if(_0x5b16b1[_0xf8fb('0x5a')]['id']){delete _0x5b16b1['body']['id'];}return db[_0xf8fb('0x3c')][_0xf8fb('0x60')]({'where':{'id':_0x5b16b1[_0xf8fb('0x56')]['id']}})[_0xf8fb('0x34')](handleEntityNotFound(_0x467f3a,null))[_0xf8fb('0x34')](saveUpdates(_0x5b16b1[_0xf8fb('0x5a')],null))[_0xf8fb('0x34')](respondWithResult(_0x467f3a,null))[_0xf8fb('0x54')](handleError(_0x467f3a,null));};exports['destroy']=function(_0x4f265d,_0x45c00){return db['ChatQueue'][_0xf8fb('0x60')]({'where':{'id':_0x4f265d[_0xf8fb('0x56')]['id']}})[_0xf8fb('0x34')](handleEntityNotFound(_0x45c00,null))[_0xf8fb('0x34')](removeEntity(_0x45c00,null))[_0xf8fb('0x54')](handleError(_0x45c00,null));};exports[_0xf8fb('0x61')]=function(_0x428f86,_0x58d829){return db[_0xf8fb('0x3c')]['describe']()[_0xf8fb('0x34')](respondWithResult(_0x58d829,null))[_0xf8fb('0x54')](handleError(_0x58d829,null));};exports['getMembers']=function(_0x1daeac,_0x4c5725,_0x112beb){var _0x2453cc={'raw':!![],'where':{}},_0x342acb={},_0xb3fa15;return db['ChatQueue'][_0xf8fb('0x62')]({'where':{'id':_0x1daeac['params']['id']}})['then'](handleEntityNotFound(_0x4c5725,null))[_0xf8fb('0x34')](function(_0x18e5ea){if(_0x18e5ea){_0xb3fa15=_0x18e5ea[_0xf8fb('0x36')]({'plain':!![]});_0x342acb['model']=_[_0xf8fb('0x43')](db['UserChatQueue'][_0xf8fb('0x3d')]);_0x342acb[_0xf8fb('0x42')]=_[_0xf8fb('0x43')](_0x1daeac[_0xf8fb('0x42')]);_0x342acb[_0xf8fb('0x4d')]=_['intersection'](_0x342acb['model'],_0x342acb[_0xf8fb('0x42')]);_0x2453cc[_0xf8fb('0x44')]=_['intersection'](_0x342acb[_0xf8fb('0x41')],qs[_0xf8fb('0x46')](_0x1daeac[_0xf8fb('0x42')][_0xf8fb('0x46')]));_0x2453cc[_0xf8fb('0x44')]=_0x2453cc[_0xf8fb('0x44')][_0xf8fb('0x47')]?_0x2453cc[_0xf8fb('0x44')]:_0x342acb['model'];if(!_0x1daeac['query']['hasOwnProperty'](_0xf8fb('0x49'))){_0x2453cc['limit']=qs[_0xf8fb('0x2e')](_0x1daeac[_0xf8fb('0x42')][_0xf8fb('0x2e')]);_0x2453cc[_0xf8fb('0x2d')]=qs[_0xf8fb('0x2d')](_0x1daeac[_0xf8fb('0x42')][_0xf8fb('0x2d')]);}_0x2453cc[_0xf8fb('0x4a')]=qs[_0xf8fb('0x4b')](_0x1daeac['query'][_0xf8fb('0x4b')]);_0x2453cc[_0xf8fb('0x4c')]=qs[_0xf8fb('0x4d')](_[_0xf8fb('0x4e')](_0x1daeac['query'],_0x342acb[_0xf8fb('0x4d')]));_0x2453cc[_0xf8fb('0x4c')]['ChatQueueId']=_0x18e5ea['id'];if(_0x1daeac['query'][_0xf8fb('0x4f')]){_0x2453cc[_0xf8fb('0x4c')]=_[_0xf8fb('0x51')](_0x2453cc['where'],{'$or':_[_0xf8fb('0x3b')](_0x2453cc[_0xf8fb('0x44')],function(_0x5df0f4){var _0x375ee6={};_0x375ee6[_0x5df0f4]={'$like':'%'+_0x1daeac[_0xf8fb('0x42')][_0xf8fb('0x4f')]+'%'};return _0x375ee6;})});}_0x2453cc=_['merge']({},_0x2453cc,_0x1daeac[_0xf8fb('0x58')]);return db['UserChatQueue'][_0xf8fb('0x53')](_0x2453cc);}})[_0xf8fb('0x34')](function(_0x300bd2){if(_0x300bd2){return db[_0xf8fb('0x63')]['findAndCountAll']({'where':{'id':_['map'](_0x300bd2,'UserId'),'role':_0xf8fb('0x64')},'attributes':['id','name',_0xf8fb('0x65'),_0xf8fb('0x66'),'createdAt']});}})[_0xf8fb('0x34')](function(_0x1d68f7){if(_0x1d68f7){return{'count':_0x1d68f7[_0xf8fb('0x2c')],'rows':_['map'](_0x1d68f7[_0xf8fb('0x67')],function(_0x21ca1e){return{'membername':_0x21ca1e[_0xf8fb('0x39')],'UserId':_0x21ca1e['id'],'queue_name':_0xb3fa15[_0xf8fb('0x39')],'ChatQueueId':_0xb3fa15['id'],'interface':util[_0xf8fb('0x68')](_0xf8fb('0x69'),_0xf8fb('0x6a'),_0x21ca1e[_0xf8fb('0x39')]),'penalty':0x0,'paused':_0x21ca1e[_0xf8fb('0x65')],'createdAt':_0x21ca1e[_0xf8fb('0x6b')],'updatedAt':_0x21ca1e[_0xf8fb('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf8fb('0x34')](respondWithFilteredResult(_0x4c5725,_0x2453cc))[_0xf8fb('0x54')](handleError(_0x4c5725,null));};exports[_0xf8fb('0x6c')]=function(_0x1db51a,_0xa7d337,_0x286574){var _0x3f69c0={};var _0x32f2ec={};var _0x266a04;var _0xad9d79;return db[_0xf8fb('0x3c')][_0xf8fb('0x62')]({'where':{'id':_0x1db51a[_0xf8fb('0x56')]['id']}})['then'](handleEntityNotFound(_0xa7d337,null))[_0xf8fb('0x34')](function(_0x129f32){if(_0x129f32){_0x266a04=_0x129f32;_0x32f2ec['model']=_[_0xf8fb('0x43')](db['Team'][_0xf8fb('0x3d')]);_0x32f2ec[_0xf8fb('0x42')]=_[_0xf8fb('0x43')](_0x1db51a[_0xf8fb('0x42')]);_0x32f2ec[_0xf8fb('0x4d')]=_[_0xf8fb('0x45')](_0x32f2ec[_0xf8fb('0x41')],_0x32f2ec[_0xf8fb('0x42')]);_0x3f69c0[_0xf8fb('0x44')]=_[_0xf8fb('0x45')](_0x32f2ec[_0xf8fb('0x41')],qs[_0xf8fb('0x46')](_0x1db51a[_0xf8fb('0x42')]['fields']));_0x3f69c0['attributes']=_0x3f69c0['attributes'][_0xf8fb('0x47')]?_0x3f69c0['attributes']:_0x32f2ec[_0xf8fb('0x41')];_0x3f69c0[_0xf8fb('0x4a')]=qs[_0xf8fb('0x4b')](_0x1db51a[_0xf8fb('0x42')][_0xf8fb('0x4b')]);_0x3f69c0[_0xf8fb('0x4c')]=qs['filters'](_[_0xf8fb('0x4e')](_0x1db51a[_0xf8fb('0x42')],_0x32f2ec[_0xf8fb('0x4d')]));if(_0x1db51a[_0xf8fb('0x42')][_0xf8fb('0x4f')]){_0x3f69c0[_0xf8fb('0x4c')]=_[_0xf8fb('0x51')](_0x3f69c0[_0xf8fb('0x4c')],{'$or':_[_0xf8fb('0x3b')](_0x3f69c0[_0xf8fb('0x44')],function(_0x3da56e){var _0xff1af={};_0xff1af[_0x3da56e]={'$like':'%'+_0x1db51a[_0xf8fb('0x42')]['filter']+'%'};return _0xff1af;})});}_0x3f69c0=_['merge']({},_0x3f69c0,_0x1db51a[_0xf8fb('0x58')]);return _0x266a04[_0xf8fb('0x6c')](_0x3f69c0);}})[_0xf8fb('0x34')](function(_0x5cd65f){if(_0x5cd65f){_0xad9d79=_0x5cd65f['length'];if(!_0x1db51a[_0xf8fb('0x42')]['hasOwnProperty'](_0xf8fb('0x49'))){_0x3f69c0[_0xf8fb('0x2e')]=qs[_0xf8fb('0x2e')](_0x1db51a[_0xf8fb('0x42')]['limit']);_0x3f69c0[_0xf8fb('0x2d')]=qs[_0xf8fb('0x2d')](_0x1db51a['query'][_0xf8fb('0x2d')]);}return _0x266a04['getTeams'](_0x3f69c0);}})[_0xf8fb('0x34')](function(_0x41d0af){if(_0x41d0af){return _0x41d0af?{'count':_0xad9d79,'rows':_0x41d0af}:null;}})[_0xf8fb('0x34')](respondWithResult(_0xa7d337,null))['catch'](handleError(_0xa7d337,null));};exports['addTeams']=function(_0x2c3d19,_0x7ea70b,_0x6d45ac){var _0x2a8b4f=_0x2c3d19[_0xf8fb('0x5a')]['ids'];return db[_0xf8fb('0x6d')][_0xf8fb('0x53')]({'where':{'id':_0x2a8b4f},'attributes':['id'],'include':[{'model':db[_0xf8fb('0x63')],'as':'Agents','attributes':['id',_0xf8fb('0x39'),_0xf8fb('0x6e'),_0xf8fb('0x6f'),_0xf8fb('0x70')],'raw':!![]}]})[_0xf8fb('0x34')](function(_0x526825){if(_0x526825){var _0x4193c7=_[_0xf8fb('0x71')](_0x526825,function(_0x1fee10){var _0x363a13=_0x1fee10[_0xf8fb('0x36')]({'plain':!![]});return _0x363a13[_0xf8fb('0x72')];});return db[_0xf8fb('0x3c')][_0xf8fb('0x60')]({'where':{'id':_0x2c3d19[_0xf8fb('0x56')]['id']}})[_0xf8fb('0x34')](function(_0x23d411){return db['sequelize']['transaction'](function(_0x523bc5){return _0x23d411['addTeams'](_0x2a8b4f,{'transaction':_0x523bc5})[_0xf8fb('0x34')](function(){return BPromise[_0xf8fb('0x73')](_0x4193c7,function(_0x27e150){return db[_0xf8fb('0x74')][_0xf8fb('0x75')]({'where':{'UserId':_0x27e150['id'],'ChatQueueId':_0x2c3d19[_0xf8fb('0x56')]['id']},'transaction':_0x523bc5});});})[_0xf8fb('0x34')](function(){_0x4193c7[_0xf8fb('0x76')](function(_0x2ac4c6){socket['emit'](_0xf8fb('0x77'),{'UserId':_0x2ac4c6['id'],'ChatQueueId':_0x23d411['id']});});});});});}})['then'](respondWithStatusCode(_0x7ea70b,null))['catch'](handleError(_0x7ea70b,null));};exports[_0xf8fb('0x78')]=function(_0x47064b,_0x4143db,_0x5c773a){return db['Team'][_0xf8fb('0x53')]({'where':{'id':_0x47064b[_0xf8fb('0x42')][_0xf8fb('0x79')]},'attributes':['id'],'include':[{'model':db[_0xf8fb('0x63')],'as':_0xf8fb('0x72'),'attributes':['id'],'raw':!![]}]})[_0xf8fb('0x34')](handleEntityNotFound(_0x4143db,null))['then'](function(_0x44df4d){var _0x4dcd93=_['map'](_0x44df4d,'id');var _0x208c8e=[];var _0x16d2d3=[];var _0x5562d6=squel[_0xf8fb('0x7a')]();_0x5562d6[_0xf8fb('0x7b')](_0xf8fb('0x7c'))['from'](_0xf8fb('0x7d'),'tq')[_0xf8fb('0x7e')](_0xf8fb('0x7f'),'ut',_0xf8fb('0x80'))['where'](_0xf8fb('0x81'),_0x47064b[_0xf8fb('0x56')]['id']);for(var _0x148aad=0x0;_0x148aad<_0x44df4d[_0xf8fb('0x47')];_0x148aad+=0x1){let _0xc82ff3=_0x44df4d[_0x148aad];for(var _0x20e0fe=0x0;_0x20e0fe<_0xc82ff3[_0xf8fb('0x72')]['length'];_0x20e0fe+=0x1){let _0x443c35=_0xc82ff3[_0xf8fb('0x72')][_0x20e0fe];var _0x2b79bf=_0x5562d6['clone']();_0x2b79bf[_0xf8fb('0x4c')](_0xf8fb('0x82'),_0x443c35['id']);_0x16d2d3[_0xf8fb('0x83')](db[_0xf8fb('0x84')][_0xf8fb('0x42')](_0x2b79bf[_0xf8fb('0x85')](),{'type':db[_0xf8fb('0x84')][_0xf8fb('0x86')][_0xf8fb('0x87')]})[_0xf8fb('0x34')](function(_0x90837d){if(_0x90837d[_0xf8fb('0x47')]===0x1){return _0x443c35['id'];}else{var _0x14c103=_[_0xf8fb('0x88')](_[_0xf8fb('0x3b')](_0x90837d,_0xf8fb('0x89')),function(_0x3a5fe9){return _[_0xf8fb('0x8a')](_0x4dcd93,_0x3a5fe9);});if(_0x14c103){return _0x443c35['id'];}}}));}}return BPromise[_0xf8fb('0x8b')](_0x16d2d3)[_0xf8fb('0x34')](function(_0x20ae3e){_0x208c8e=_(_0x208c8e)[_0xf8fb('0x8c')](_0x20ae3e)['compact']()[_0xf8fb('0x8d')]();return db[_0xf8fb('0x3c')][_0xf8fb('0x60')]({'where':{'id':_0x47064b[_0xf8fb('0x56')]['id']}})[_0xf8fb('0x34')](function(_0x3f5681){return db['sequelize']['transaction'](function(_0x2c5705){return _0x3f5681['removeTeams'](_0x47064b[_0xf8fb('0x42')][_0xf8fb('0x79')],{'transaction':_0x2c5705})[_0xf8fb('0x34')](function(){if(!_[_0xf8fb('0x8e')](_0x208c8e)){return _0x3f5681[_0xf8fb('0x8f')](_0x208c8e,{'transaction':_0x2c5705});}})[_0xf8fb('0x34')](function(){_0x208c8e[_0xf8fb('0x76')](function(_0x2baabd){socket[_0xf8fb('0x90')](_0xf8fb('0x91'),{'UserId':_0x2baabd,'ChatQueueId':_0x3f5681['id']});});});});});});})['then'](respondWithStatusCode(_0x4143db,null))[_0xf8fb('0x54')](handleError(_0x4143db,null));};exports[_0xf8fb('0x92')]=function(_0x5a0b3,_0x31e0fc,_0x3f4d5c){return db[_0xf8fb('0x3c')][_0xf8fb('0x60')]({'where':{'id':_0x5a0b3[_0xf8fb('0x56')]['id']}})[_0xf8fb('0x34')](handleEntityNotFound(_0x31e0fc,null))[_0xf8fb('0x34')](function(_0x3dcf1f){if(_0x3dcf1f){return _0x3dcf1f[_0xf8fb('0x92')](_0x5a0b3[_0xf8fb('0x5a')][_0xf8fb('0x79')],_['omit'](_0x5a0b3['body'],[_0xf8fb('0x79'),'id'])||{})[_0xf8fb('0x93')](function(_0x4a29de){for(var _0x2347f4=0x0;_0x2347f4<_0x5a0b3[_0xf8fb('0x5a')][_0xf8fb('0x79')][_0xf8fb('0x47')];_0x2347f4+=0x1){socket[_0xf8fb('0x90')](_0xf8fb('0x77'),{'UserId':_0x5a0b3[_0xf8fb('0x5a')][_0xf8fb('0x79')][_0x2347f4],'ChatQueueId':_0x5a0b3[_0xf8fb('0x56')]['id']});}return _0x4a29de;});}})[_0xf8fb('0x34')](respondWithResult(_0x31e0fc,null))[_0xf8fb('0x54')](handleError(_0x31e0fc,null));};exports[_0xf8fb('0x8f')]=function(_0x496b10,_0xd1033b,_0x425709){return db[_0xf8fb('0x3c')][_0xf8fb('0x60')]({'where':{'id':_0x496b10[_0xf8fb('0x56')]['id']}})[_0xf8fb('0x34')](handleEntityNotFound(_0xd1033b,null))[_0xf8fb('0x34')](function(_0x3e7694){if(_0x3e7694){return _0x3e7694[_0xf8fb('0x8f')](_0x496b10[_0xf8fb('0x42')][_0xf8fb('0x79')])['then'](function(){if(_[_0xf8fb('0x94')](_0x496b10['query'][_0xf8fb('0x79')])){for(var _0x27ecb1=0x0;_0x27ecb1<_0x496b10['query'][_0xf8fb('0x79')]['length'];_0x27ecb1+=0x1){socket[_0xf8fb('0x90')](_0xf8fb('0x91'),{'UserId':Number(_0x496b10[_0xf8fb('0x42')][_0xf8fb('0x79')][_0x27ecb1]),'ChatQueueId':Number(_0x496b10[_0xf8fb('0x56')]['id'])});}}else{socket[_0xf8fb('0x90')](_0xf8fb('0x91'),{'UserId':Number(_0x496b10[_0xf8fb('0x42')][_0xf8fb('0x79')]),'ChatQueueId':Number(_0x496b10['params']['id'])});}});}})[_0xf8fb('0x34')](respondWithStatusCode(_0xd1033b,null))['catch'](handleError(_0xd1033b,null));};exports[_0xf8fb('0x95')]=function(_0x59a0c3,_0x4a74a1,_0x503897){var _0x40b6a1={};var _0x4682cb={};var _0x2cc46f;var _0x440612;return db[_0xf8fb('0x3c')]['findOne']({'where':{'id':_0x59a0c3[_0xf8fb('0x56')]['id']}})['then'](handleEntityNotFound(_0x4a74a1,null))[_0xf8fb('0x34')](function(_0x2ca88e){if(_0x2ca88e){_0x2cc46f=_0x2ca88e;_0x4682cb[_0xf8fb('0x41')]=_[_0xf8fb('0x43')](db[_0xf8fb('0x63')][_0xf8fb('0x3d')]);_0x4682cb[_0xf8fb('0x42')]=_['keys'](_0x59a0c3[_0xf8fb('0x42')]);_0x4682cb[_0xf8fb('0x4d')]=_[_0xf8fb('0x45')](_0x4682cb[_0xf8fb('0x41')],_0x4682cb['query']);_0x40b6a1[_0xf8fb('0x44')]=_[_0xf8fb('0x45')](_0x4682cb['model'],qs[_0xf8fb('0x46')](_0x59a0c3[_0xf8fb('0x42')]['fields']));_0x40b6a1[_0xf8fb('0x44')]=_0x40b6a1[_0xf8fb('0x44')]['length']?_0x40b6a1['attributes']:_0x4682cb[_0xf8fb('0x41')];_0x40b6a1['order']=qs[_0xf8fb('0x4b')](_0x59a0c3['query'][_0xf8fb('0x4b')]);_0x40b6a1['where']=qs[_0xf8fb('0x4d')](_[_0xf8fb('0x4e')](_0x59a0c3[_0xf8fb('0x42')],_0x4682cb[_0xf8fb('0x4d')]));if(_0x59a0c3[_0xf8fb('0x42')]['filter']){_0x40b6a1[_0xf8fb('0x4c')]=_['merge'](_0x40b6a1[_0xf8fb('0x4c')],{'$or':_[_0xf8fb('0x3b')](_0x40b6a1[_0xf8fb('0x44')],function(_0x57044a){var _0x5ab225={};_0x5ab225[_0x57044a]={'$like':'%'+_0x59a0c3[_0xf8fb('0x42')][_0xf8fb('0x4f')]+'%'};return _0x5ab225;})});}_0x40b6a1=_[_0xf8fb('0x51')]({},_0x40b6a1,_0x59a0c3[_0xf8fb('0x58')]);return _0x2cc46f[_0xf8fb('0x95')](_0x40b6a1);}})[_0xf8fb('0x34')](function(_0x367608){if(_0x367608){_0x440612=_0x367608[_0xf8fb('0x47')];if(!_0x59a0c3['query'][_0xf8fb('0x48')](_0xf8fb('0x49'))){_0x40b6a1[_0xf8fb('0x2e')]=qs[_0xf8fb('0x2e')](_0x59a0c3[_0xf8fb('0x42')][_0xf8fb('0x2e')]);_0x40b6a1[_0xf8fb('0x2d')]=qs[_0xf8fb('0x2d')](_0x59a0c3[_0xf8fb('0x42')][_0xf8fb('0x2d')]);}return _0x2cc46f[_0xf8fb('0x95')](_0x40b6a1);}})['then'](function(_0x315546){if(_0x315546){return _0x315546?{'count':_0x440612,'rows':_0x315546}:null;}})[_0xf8fb('0x34')](respondWithResult(_0x4a74a1,null))[_0xf8fb('0x54')](handleError(_0x4a74a1,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 8ae6700..25297c7 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x10a1a5,_0x4bcca9){var _0x3d32e9=function(_0x2f14cb){while(--_0x2f14cb){_0x10a1a5['push'](_0x10a1a5['shift']());}};_0x3d32e9(++_0x4bcca9);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ad279,_0x42d157){_0x1ad279=_0x1ad279-0x0;var _0x272861=_0xb10b[_0x1ad279];return _0x272861;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x48df38,_0x19622b){var _0x49c19d=function(_0x44921a){while(--_0x44921a){_0x48df38['push'](_0x48df38['shift']());}};_0x49c19d(++_0x19622b);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d34f0,_0x4a5dc0){_0x3d34f0=_0x3d34f0-0x0;var _0x135ecd=_0xb10b[_0x3d34f0];return _0x135ecd;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 79288b8..febef24 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 _0x87e4=['ChatQueue','chat_queues','lodash','util','api','moment','bluebird','request-promise','path','exports'];(function(_0x143a28,_0x17c0a2){var _0x41cea3=function(_0x5ca7a3){while(--_0x5ca7a3){_0x143a28['push'](_0x143a28['shift']());}};_0x41cea3(++_0x17c0a2);}(_0x87e4,0x156));var _0x487e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x87e4[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x487e('0x0'));var util=require(_0x487e('0x1'));var logger=require('../../config/logger')(_0x487e('0x2'));var moment=require(_0x487e('0x3'));var BPromise=require(_0x487e('0x4'));var rp=require(_0x487e('0x5'));var fs=require('fs');var path=require(_0x487e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x487e('0x7')]=function(_0xe1961,_0x6e7c31){return _0xe1961['define'](_0x487e('0x8'),attributes,{'tableName':_0x487e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1885=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','util','../../config/logger','api'];(function(_0x469393,_0x247969){var _0x5f720d=function(_0x40aeb3){while(--_0x40aeb3){_0x469393['push'](_0x469393['shift']());}};_0x5f720d(++_0x247969);}(_0x1885,0xb8));var _0x5188=function(_0x216601,_0x581843){_0x216601=_0x216601-0x0;var _0x17a913=_0x1885[_0x216601];return _0x17a913;};'use strict';var _=require('lodash');var util=require(_0x5188('0x0'));var logger=require(_0x5188('0x1'))(_0x5188('0x2'));var moment=require('moment');var BPromise=require(_0x5188('0x3'));var rp=require(_0x5188('0x4'));var fs=require('fs');var path=require(_0x5188('0x5'));var rimraf=require(_0x5188('0x6'));var config=require(_0x5188('0x7'));var attributes=require(_0x5188('0x8'));module[_0x5188('0x9')]=function(_0x46491d,_0x3aa2b1){return _0x46491d[_0x5188('0xa')]('ChatQueue',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 dc15e82..b4dd175 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 _0xc664=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetChatQueue','options','raw','where','attributes','limit','include','map','model','debug','stringify','ChatQueue','ShowChatQueue','lodash','util','bluebird','randomstring'];(function(_0x24fd2b,_0x276ad2){var _0x114745=function(_0x5be9c2){while(--_0x5be9c2){_0x24fd2b['push'](_0x24fd2b['shift']());}};_0x114745(++_0x276ad2);}(_0xc664,0x90));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c66('0x0'));var util=require(_0x4c66('0x1'));var moment=require('moment');var BPromise=require(_0x4c66('0x2'));var rs=require(_0x4c66('0x3'));var fs=require('fs');var Redis=require(_0x4c66('0x4'));var db=require(_0x4c66('0x5'))['db'];var utils=require(_0x4c66('0x6'));var logger=require('../../config/logger')(_0x4c66('0x7'));var config=require(_0x4c66('0x8'));var jayson=require(_0x4c66('0x9'));var client=jayson[_0x4c66('0xa')]['http']({'port':0x232a});config[_0x4c66('0xb')]=_[_0x4c66('0xc')](config[_0x4c66('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c66('0xb')]));require(_0x4c66('0xd'))[_0x4c66('0xe')](socket);function respondWithRpcPromise(_0x222e66,_0x48953a,_0x1770c3){return new BPromise(function(_0xb62775,_0x38ef47){return client[_0x4c66('0xf')](_0x222e66,_0x1770c3)[_0x4c66('0x10')](function(_0x14b159){logger[_0x4c66('0x11')](_0x4c66('0x12'),_0x48953a,_0x4c66('0x13'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x48953a,'request\x20sent',JSON['stringify'](_0x14b159));if(_0x14b159[_0x4c66('0x14')]){if(_0x14b159[_0x4c66('0x14')][_0x4c66('0x15')]===0x1f4){logger[_0x4c66('0x14')](_0x4c66('0x12'),_0x48953a,_0x14b159[_0x4c66('0x14')][_0x4c66('0x16')]);return _0x38ef47(_0x14b159[_0x4c66('0x14')][_0x4c66('0x16')]);}logger[_0x4c66('0x14')](_0x4c66('0x12'),_0x48953a,_0x14b159[_0x4c66('0x14')][_0x4c66('0x16')]);return _0xb62775(_0x14b159[_0x4c66('0x14')][_0x4c66('0x16')]);}else{logger['info'](_0x4c66('0x12'),_0x48953a,_0x4c66('0x13'));_0xb62775(_0x14b159[_0x4c66('0x17')]['message']);}})['catch'](function(_0x4e5c53){logger['error'](_0x4c66('0x12'),_0x48953a,_0x4e5c53);_0x38ef47(_0x4e5c53);});});}exports[_0x4c66('0x18')]=function(_0x48a3c6){var _0x16bb5d=this;return new Promise(function(_0x585b55,_0x160601){return db['ChatQueue']['findAll']({'raw':_0x48a3c6['options']?_0x48a3c6[_0x4c66('0x19')][_0x4c66('0x1a')]===undefined?!![]:![]:!![],'where':_0x48a3c6[_0x4c66('0x19')]?_0x48a3c6[_0x4c66('0x19')][_0x4c66('0x1b')]||null:null,'attributes':_0x48a3c6[_0x4c66('0x19')]?_0x48a3c6[_0x4c66('0x19')][_0x4c66('0x1c')]||null:null,'limit':_0x48a3c6[_0x4c66('0x19')]?_0x48a3c6[_0x4c66('0x19')][_0x4c66('0x1d')]||null:null,'include':_0x48a3c6[_0x4c66('0x19')]?_0x48a3c6['options'][_0x4c66('0x1e')]?_[_0x4c66('0x1f')](_0x48a3c6[_0x4c66('0x19')]['include'],function(_0x49885b){return{'model':db[_0x49885b['model']],'as':_0x49885b['as'],'attributes':_0x49885b[_0x4c66('0x1c')],'include':_0x49885b[_0x4c66('0x1e')]?_[_0x4c66('0x1f')](_0x49885b['include'],function(_0x2cfc9f){return{'model':db[_0x2cfc9f[_0x4c66('0x20')]],'as':_0x2cfc9f['as'],'attributes':_0x2cfc9f['attributes'],'include':_0x2cfc9f[_0x4c66('0x1e')]?_[_0x4c66('0x1f')](_0x2cfc9f[_0x4c66('0x1e')],function(_0x2f9d56){return{'model':db[_0x2f9d56[_0x4c66('0x20')]],'as':_0x2f9d56['as'],'attributes':_0x2f9d56[_0x4c66('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4c66('0x10')](function(_0x1577da){logger[_0x4c66('0x11')]('GetChatQueue',_0x48a3c6);logger[_0x4c66('0x21')](_0x4c66('0x18'),_0x48a3c6,JSON[_0x4c66('0x22')](_0x1577da));_0x585b55(_0x1577da);})['catch'](function(_0x17db64){logger[_0x4c66('0x14')](_0x4c66('0x18'),_0x17db64[_0x4c66('0x16')],_0x48a3c6);_0x160601(_0x16bb5d[_0x4c66('0x14')](0x1f4,_0x17db64['message']));});});};exports['ShowChatQueue']=function(_0x19c50e){var _0xb41fc2=this;return new Promise(function(_0x16fbdc,_0x572cff){return db[_0x4c66('0x23')]['find']({'raw':_0x19c50e[_0x4c66('0x19')]?_0x19c50e['options'][_0x4c66('0x1a')]===undefined?!![]:![]:!![],'where':_0x19c50e[_0x4c66('0x19')]?_0x19c50e[_0x4c66('0x19')][_0x4c66('0x1b')]||null:null,'attributes':_0x19c50e[_0x4c66('0x19')]?_0x19c50e[_0x4c66('0x19')][_0x4c66('0x1c')]||null:null,'include':_0x19c50e[_0x4c66('0x19')]?_0x19c50e[_0x4c66('0x19')][_0x4c66('0x1e')]?_[_0x4c66('0x1f')](_0x19c50e[_0x4c66('0x19')]['include'],function(_0x5499bd){return{'model':db[_0x5499bd[_0x4c66('0x20')]],'as':_0x5499bd['as'],'attributes':_0x5499bd['attributes'],'include':_0x5499bd[_0x4c66('0x1e')]?_[_0x4c66('0x1f')](_0x5499bd[_0x4c66('0x1e')],function(_0x15879a){return{'model':db[_0x15879a['model']],'as':_0x15879a['as'],'attributes':_0x15879a[_0x4c66('0x1c')],'include':_0x15879a[_0x4c66('0x1e')]?_[_0x4c66('0x1f')](_0x15879a[_0x4c66('0x1e')],function(_0x1a0526){return{'model':db[_0x1a0526[_0x4c66('0x20')]],'as':_0x1a0526['as'],'attributes':_0x1a0526['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x593a58){logger[_0x4c66('0x11')]('ShowChatQueue',_0x19c50e);logger[_0x4c66('0x21')]('ShowChatQueue',_0x19c50e,JSON[_0x4c66('0x22')](_0x593a58));_0x16fbdc(_0x593a58);})['catch'](function(_0x2cb7af){logger[_0x4c66('0x14')](_0x4c66('0x24'),_0x2cb7af['message'],_0x19c50e);_0x572cff(_0xb41fc2[_0x4c66('0x14')](0x1f4,_0x2cb7af[_0x4c66('0x16')]));});});}; \ No newline at end of file +var _0xcefd=['ChatQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','limit','map','include','model','ShowChatQueue','find','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','info'];(function(_0x2974c9,_0x4a1a06){var _0x1a1b26=function(_0x4d4d98){while(--_0x4d4d98){_0x2974c9['push'](_0x2974c9['shift']());}};_0x1a1b26(++_0x4a1a06);}(_0xcefd,0x126));var _0xdcef=function(_0x1aefea,_0x39e5fa){_0x1aefea=_0x1aefea-0x0;var _0x33a7a1=_0xcefd[_0x1aefea];return _0x33a7a1;};'use strict';var _=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var moment=require(_0xdcef('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcef('0x3'));var fs=require('fs');var Redis=require(_0xdcef('0x4'));var db=require(_0xdcef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcef('0x6'))(_0xdcef('0x7'));var config=require(_0xdcef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdcef('0x9')][_0xdcef('0xa')]({'port':0x232a});config[_0xdcef('0xb')]=_[_0xdcef('0xc')](config['redis'],{'host':_0xdcef('0xd'),'port':0x18eb});var socket=require(_0xdcef('0xe'))(new Redis(config[_0xdcef('0xb')]));require(_0xdcef('0xf'))['register'](socket);function respondWithRpcPromise(_0x1946c9,_0x451606,_0x28ac35){return new BPromise(function(_0x37c1c3,_0x3fd234){return client[_0xdcef('0x10')](_0x1946c9,_0x28ac35)['then'](function(_0x4a2973){logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x451606,'request\x20sent');logger[_0xdcef('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x451606,'request\x20sent',JSON[_0xdcef('0x14')](_0x4a2973));if(_0x4a2973[_0xdcef('0x15')]){if(_0x4a2973[_0xdcef('0x15')][_0xdcef('0x16')]===0x1f4){logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x4a2973[_0xdcef('0x15')][_0xdcef('0x17')]);return _0x3fd234(_0x4a2973[_0xdcef('0x15')][_0xdcef('0x17')]);}logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x4a2973['error'][_0xdcef('0x17')]);return _0x37c1c3(_0x4a2973['error'][_0xdcef('0x17')]);}else{logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x451606,_0xdcef('0x18'));_0x37c1c3(_0x4a2973['result']['message']);}})[_0xdcef('0x19')](function(_0x19283a){logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x19283a);_0x3fd234(_0x19283a);});});}exports[_0xdcef('0x1a')]=function(_0x465fed){var _0x43d0f1=this;return new Promise(function(_0x510d1e,_0x417de7){return db[_0xdcef('0x1b')]['findAll']({'raw':_0x465fed[_0xdcef('0x1c')]?_0x465fed[_0xdcef('0x1c')][_0xdcef('0x1d')]===undefined?!![]:![]:!![],'where':_0x465fed[_0xdcef('0x1c')]?_0x465fed[_0xdcef('0x1c')][_0xdcef('0x1e')]||null:null,'attributes':_0x465fed[_0xdcef('0x1c')]?_0x465fed[_0xdcef('0x1c')][_0xdcef('0x1f')]||null:null,'limit':_0x465fed[_0xdcef('0x1c')]?_0x465fed[_0xdcef('0x1c')][_0xdcef('0x20')]||null:null,'include':_0x465fed[_0xdcef('0x1c')]?_0x465fed[_0xdcef('0x1c')]['include']?_[_0xdcef('0x21')](_0x465fed[_0xdcef('0x1c')][_0xdcef('0x22')],function(_0x50fdcb){return{'model':db[_0x50fdcb[_0xdcef('0x23')]],'as':_0x50fdcb['as'],'attributes':_0x50fdcb[_0xdcef('0x1f')],'include':_0x50fdcb[_0xdcef('0x22')]?_[_0xdcef('0x21')](_0x50fdcb[_0xdcef('0x22')],function(_0x7fce54){return{'model':db[_0x7fce54['model']],'as':_0x7fce54['as'],'attributes':_0x7fce54['attributes'],'include':_0x7fce54['include']?_[_0xdcef('0x21')](_0x7fce54[_0xdcef('0x22')],function(_0x21f960){return{'model':db[_0x21f960[_0xdcef('0x23')]],'as':_0x21f960['as'],'attributes':_0x21f960[_0xdcef('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc6bbb3){logger['info'](_0xdcef('0x1a'),_0x465fed);logger[_0xdcef('0x13')](_0xdcef('0x1a'),_0x465fed,JSON['stringify'](_0xc6bbb3));_0x510d1e(_0xc6bbb3);})[_0xdcef('0x19')](function(_0x2114e8){logger['error']('GetChatQueue',_0x2114e8[_0xdcef('0x17')],_0x465fed);_0x417de7(_0x43d0f1[_0xdcef('0x15')](0x1f4,_0x2114e8[_0xdcef('0x17')]));});});};exports[_0xdcef('0x24')]=function(_0x3c1e51){var _0xe253ee=this;return new Promise(function(_0x4d9ef4,_0xa099cf){return db['ChatQueue'][_0xdcef('0x25')]({'raw':_0x3c1e51['options']?_0x3c1e51['options'][_0xdcef('0x1d')]===undefined?!![]:![]:!![],'where':_0x3c1e51[_0xdcef('0x1c')]?_0x3c1e51[_0xdcef('0x1c')][_0xdcef('0x1e')]||null:null,'attributes':_0x3c1e51['options']?_0x3c1e51['options']['attributes']||null:null,'include':_0x3c1e51[_0xdcef('0x1c')]?_0x3c1e51[_0xdcef('0x1c')]['include']?_['map'](_0x3c1e51[_0xdcef('0x1c')]['include'],function(_0x18def8){return{'model':db[_0x18def8[_0xdcef('0x23')]],'as':_0x18def8['as'],'attributes':_0x18def8[_0xdcef('0x1f')],'include':_0x18def8[_0xdcef('0x22')]?_['map'](_0x18def8[_0xdcef('0x22')],function(_0x3f64f4){return{'model':db[_0x3f64f4[_0xdcef('0x23')]],'as':_0x3f64f4['as'],'attributes':_0x3f64f4[_0xdcef('0x1f')],'include':_0x3f64f4[_0xdcef('0x22')]?_['map'](_0x3f64f4['include'],function(_0x41b760){return{'model':db[_0x41b760[_0xdcef('0x23')]],'as':_0x41b760['as'],'attributes':_0x41b760[_0xdcef('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdcef('0x26')](function(_0x13d5a5){logger[_0xdcef('0x11')](_0xdcef('0x24'),_0x3c1e51);logger[_0xdcef('0x13')](_0xdcef('0x24'),_0x3c1e51,JSON['stringify'](_0x13d5a5));_0x4d9ef4(_0x13d5a5);})[_0xdcef('0x19')](function(_0x246d63){logger[_0xdcef('0x15')]('ShowChatQueue',_0x246d63[_0xdcef('0x17')],_0x3c1e51);_0xa099cf(_0xe253ee[_0xdcef('0x15')](0x1f4,_0x246d63['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 0b688ef..ef074b2 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 _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x34a354,_0x2ad990){var _0x445105=function(_0x22f811){while(--_0x22f811){_0x34a354['push'](_0x34a354['shift']());}};_0x445105(++_0x2ad990);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5a9fb9,_0xb126c4){_0x5a9fb9=_0x5a9fb9-0x0;var _0x110430=_0x0b0e[_0x5a9fb9];return _0x110430;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x3acef0,_0x3c7d19){var _0x5c497e=function(_0xe26552){while(--_0xe26552){_0x3acef0['push'](_0x3acef0['shift']());}};_0x5c497e(++_0x3c7d19);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 9191a36..250668e 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 _0x321e=['/:id','show','/:id/members','getMembers','getTeams','/:id/users','create','post','/:id/teams','addAgents','put','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x499c1b,_0x33c78c){var _0x1be409=function(_0x50ef88){while(--_0x50ef88){_0x499c1b['push'](_0x499c1b['shift']());}};_0x1be409(++_0x33c78c);}(_0x321e,0x96));var _0xe321=function(_0x2bda77,_0x1980f5){_0x2bda77=_0x2bda77-0x0;var _0x5d5601=_0x321e[_0x2bda77];return _0x5d5601;};'use strict';var multer=require(_0xe321('0x0'));var util=require(_0xe321('0x1'));var path=require(_0xe321('0x2'));var timeout=require(_0xe321('0x3'));var express=require(_0xe321('0x4'));var router=express[_0xe321('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe321('0x6'));var controller=require('./chatQueue.controller');router['get']('/',auth[_0xe321('0x7')](),controller[_0xe321('0x8')]);router[_0xe321('0x9')](_0xe321('0xa'),auth['isAuthenticated'](),controller[_0xe321('0xb')]);router[_0xe321('0x9')](_0xe321('0xc'),auth[_0xe321('0x7')](),controller[_0xe321('0xd')]);router[_0xe321('0x9')](_0xe321('0xe'),auth['isAuthenticated'](),controller[_0xe321('0xf')]);router['get']('/:id/teams',auth[_0xe321('0x7')](),controller[_0xe321('0x10')]);router[_0xe321('0x9')](_0xe321('0x11'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xe321('0x12')]);router[_0xe321('0x13')](_0xe321('0x14'),auth[_0xe321('0x7')](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xe321('0x15')]);router[_0xe321('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xe321('0x17')](_0xe321('0x14'),auth[_0xe321('0x7')](),controller[_0xe321('0x18')]);router[_0xe321('0x17')]('/:id/users',auth[_0xe321('0x7')](),controller[_0xe321('0x19')]);module[_0xe321('0x1a')]=router; \ No newline at end of file +var _0x6179=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','/:id','removeTeams','delete','exports','multer','util','path','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','describe','/:id/members'];(function(_0x599c94,_0x464f0e){var _0x34e215=function(_0x36295a){while(--_0x36295a){_0x599c94['push'](_0x599c94['shift']());}};_0x34e215(++_0x464f0e);}(_0x6179,0x80));var _0x9617=function(_0x27f2b9,_0x144e11){_0x27f2b9=_0x27f2b9-0x0;var _0x440385=_0x6179[_0x27f2b9];return _0x440385;};'use strict';var multer=require(_0x9617('0x0'));var util=require(_0x9617('0x1'));var path=require(_0x9617('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9617('0x3')]();var auth=require(_0x9617('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9617('0x5'));router[_0x9617('0x6')]('/',auth[_0x9617('0x7')](),controller['index']);router['get']('/describe',auth[_0x9617('0x7')](),controller[_0x9617('0x8')]);router[_0x9617('0x6')]('/:id',auth[_0x9617('0x7')](),controller['show']);router[_0x9617('0x6')](_0x9617('0x9'),auth[_0x9617('0x7')](),controller[_0x9617('0xa')]);router[_0x9617('0x6')](_0x9617('0xb'),auth[_0x9617('0x7')](),controller[_0x9617('0xc')]);router[_0x9617('0x6')](_0x9617('0xd'),auth[_0x9617('0x7')](),controller[_0x9617('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9617('0xf')]);router[_0x9617('0x10')](_0x9617('0xb'),auth[_0x9617('0x7')](),controller['addTeams']);router[_0x9617('0x10')](_0x9617('0xd'),auth[_0x9617('0x7')](),controller[_0x9617('0x11')]);router[_0x9617('0x12')](_0x9617('0x13'),auth[_0x9617('0x7')](),controller['update']);router['delete'](_0x9617('0x13'),auth[_0x9617('0x7')](),controller['destroy']);router['delete'](_0x9617('0xb'),auth[_0x9617('0x7')](),controller[_0x9617('0x14')]);router[_0x9617('0x15')](_0x9617('0xd'),auth[_0x9617('0x7')](),controller['removeAgents']);module[_0x9617('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index cf679ed..deef160 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 _0xf73f=['STRING','DATE','moment','sequelize'];(function(_0x135e73,_0x53d25e){var _0x207d86=function(_0x4803a5){while(--_0x4803a5){_0x135e73['push'](_0x135e73['shift']());}};_0x207d86(++_0x53d25e);}(_0xf73f,0x1ca));var _0xff73=function(_0x3e8029,_0x4fd637){_0x3e8029=_0x3e8029-0x0;var _0x13deb6=_0xf73f[_0x3e8029];return _0x13deb6;};'use strict';var moment=require(_0xff73('0x0'));var Sequelize=require(_0xff73('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xff73('0x2')]},'joinAt':{'type':Sequelize[_0xff73('0x3')]},'leaveAt':{'type':Sequelize[_0xff73('0x3')]},'acceptAt':{'type':Sequelize[_0xff73('0x3')]},'exitAt':{'type':Sequelize[_0xff73('0x3')]},'reason':{'type':Sequelize[_0xff73('0x2')]}}; \ No newline at end of file +var _0xcb04=['STRING','DATE','moment','sequelize','exports'];(function(_0x31f9c7,_0x1d5f54){var _0x46c5b3=function(_0x3180e3){while(--_0x3180e3){_0x31f9c7['push'](_0x31f9c7['shift']());}};_0x46c5b3(++_0x1d5f54);}(_0xcb04,0x84));var _0x4cb0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcb04[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x4cb0('0x0'));var Sequelize=require(_0x4cb0('0x1'));module[_0x4cb0('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4cb0('0x3')]},'joinAt':{'type':Sequelize[_0x4cb0('0x4')]},'leaveAt':{'type':Sequelize[_0x4cb0('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4cb0('0x4')]},'reason':{'type':Sequelize[_0x4cb0('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f456fd4..715300d 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 _0x3f74=['apply','update','then','destroy','sendStatus','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','limit','set','Content-Range','json'];(function(_0x5cc3b4,_0x2974b7){var _0x160868=function(_0xe89671){while(--_0xe89671){_0x5cc3b4['push'](_0x5cc3b4['shift']());}};_0x160868(++_0x2974b7);}(_0x3f74,0x145));var _0x43f7=function(_0x341048,_0x4ff857){_0x341048=_0x341048-0x0;var _0x3750d0=_0x3f74[_0x341048];return _0x3750d0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x43f7('0x0'));var zipdir=require(_0x43f7('0x1'));var jsonpatch=require(_0x43f7('0x2'));var rp=require('request-promise');var moment=require(_0x43f7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x43f7('0x4'));var util=require(_0x43f7('0x5'));var path=require(_0x43f7('0x6'));var sox=require('sox');var csv=require(_0x43f7('0x7'));var ejs=require(_0x43f7('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43f7('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x43f7('0xa'));var toCsv=require(_0x43f7('0x7'));var querystring=require(_0x43f7('0xb'));var Papa=require(_0x43f7('0xc'));var Redis=require(_0x43f7('0xd'));var authService=require(_0x43f7('0xe'));var qs=require(_0x43f7('0xf'));var as=require(_0x43f7('0x10'));var hardwareService=require(_0x43f7('0x11'));var logger=require(_0x43f7('0x12'))(_0x43f7('0x13'));var utils=require(_0x43f7('0x14'));var config=require(_0x43f7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x43f7('0x16'))['db'];function respondWithStatusCode(_0xa2f458,_0x1a2710){_0x1a2710=_0x1a2710||0xcc;return function(_0x3c0965){if(_0x3c0965){return _0xa2f458['sendStatus'](_0x1a2710);}return _0xa2f458[_0x43f7('0x17')](_0x1a2710)[_0x43f7('0x18')]();};}function respondWithResult(_0x51de26,_0x44b7ba){_0x44b7ba=_0x44b7ba||0xc8;return function(_0x28d6ae){if(_0x28d6ae){return _0x51de26[_0x43f7('0x17')](_0x44b7ba)['json'](_0x28d6ae);}};}function respondWithFilteredResult(_0x1bcd9e,_0x4eddf4){return function(_0x270741){if(_0x270741){var _0x14cb30=_0x270741[_0x43f7('0x19')],_0x5d594d=_0x4eddf4['offset'],_0x12f9c2=_0x4eddf4['offset']+_0x4eddf4[_0x43f7('0x1a')],_0x3c1ddb;if(_0x12f9c2>=_0x14cb30){_0x12f9c2=_0x14cb30;_0x3c1ddb=0xc8;}else{_0x3c1ddb=0xce;}_0x1bcd9e[_0x43f7('0x17')](_0x3c1ddb);return _0x1bcd9e[_0x43f7('0x1b')](_0x43f7('0x1c'),_0x5d594d+'-'+_0x12f9c2+'/'+_0x14cb30)[_0x43f7('0x1d')](_0x270741);}return null;};}function patchUpdates(_0x4b9dcb){return function(_0x5871d2){try{jsonpatch[_0x43f7('0x1e')](_0x5871d2,_0x4b9dcb,!![]);}catch(_0x126071){return BPromise['reject'](_0x126071);}return _0x5871d2['save']();};}function saveUpdates(_0x5d2c11,_0x5ac43b){return function(_0x48324c){if(_0x48324c){return _0x48324c[_0x43f7('0x1f')](_0x5d2c11)[_0x43f7('0x20')](function(_0x1d1960){return _0x1d1960;});}return null;};}function removeEntity(_0x59f8e0,_0x1f591a){return function(_0x311a9a){if(_0x311a9a){return _0x311a9a[_0x43f7('0x21')]()[_0x43f7('0x20')](function(){_0x59f8e0[_0x43f7('0x17')](0xcc)[_0x43f7('0x18')]();});}};}function handleEntityNotFound(_0x10c105,_0x46e74c){return function(_0x261371){if(!_0x261371){_0x10c105[_0x43f7('0x22')](0x194);}return _0x261371;};}function handleError(_0x17a613,_0x5ba086){_0x5ba086=_0x5ba086||0x1f4;return function(_0x2e033e){logger[_0x43f7('0x23')](_0x2e033e[_0x43f7('0x24')]);if(_0x2e033e[_0x43f7('0x25')]){delete _0x2e033e[_0x43f7('0x25')];}_0x17a613[_0x43f7('0x17')](_0x5ba086)['send'](_0x2e033e);};}exports[_0x43f7('0x26')]=function(_0x3a30c3,_0x29b014){var _0x1869f9={},_0x289bd6={},_0x210598={'count':0x0,'rows':[]};var _0x25167d=_[_0x43f7('0x27')](db[_0x43f7('0x28')][_0x43f7('0x29')],function(_0x3b797b){return{'name':_0x3b797b[_0x43f7('0x2a')],'type':_0x3b797b[_0x43f7('0x2b')][_0x43f7('0x2c')]};});_0x289bd6[_0x43f7('0x2d')]=_[_0x43f7('0x27')](_0x25167d,'name');_0x289bd6[_0x43f7('0x2e')]=_[_0x43f7('0x2f')](_0x3a30c3['query']);_0x289bd6[_0x43f7('0x30')]=_[_0x43f7('0x31')](_0x289bd6[_0x43f7('0x2d')],_0x289bd6[_0x43f7('0x2e')]);_0x1869f9[_0x43f7('0x32')]=_[_0x43f7('0x31')](_0x289bd6[_0x43f7('0x2d')],qs[_0x43f7('0x33')](_0x3a30c3[_0x43f7('0x2e')]['fields']));_0x1869f9[_0x43f7('0x32')]=_0x1869f9[_0x43f7('0x32')][_0x43f7('0x34')]?_0x1869f9[_0x43f7('0x32')]:_0x289bd6[_0x43f7('0x2d')];if(!_0x3a30c3['query'][_0x43f7('0x35')](_0x43f7('0x36'))){_0x1869f9[_0x43f7('0x1a')]=qs[_0x43f7('0x1a')](_0x3a30c3[_0x43f7('0x2e')]['limit']);_0x1869f9[_0x43f7('0x37')]=qs[_0x43f7('0x37')](_0x3a30c3[_0x43f7('0x2e')][_0x43f7('0x37')]);}_0x1869f9['order']=qs[_0x43f7('0x38')](_0x3a30c3[_0x43f7('0x2e')][_0x43f7('0x38')]);_0x1869f9['where']=qs[_0x43f7('0x30')](_['pick'](_0x3a30c3[_0x43f7('0x2e')],_0x289bd6['filters']),_0x25167d);if(_0x3a30c3[_0x43f7('0x2e')]['filter']){_0x1869f9[_0x43f7('0x39')]=_[_0x43f7('0x3a')](_0x1869f9[_0x43f7('0x39')],{'$or':_[_0x43f7('0x27')](_0x25167d,function(_0x5582d9){if(_0x5582d9[_0x43f7('0x2b')]!==_0x43f7('0x3b')){var _0x2f7aa2={};_0x2f7aa2[_0x5582d9[_0x43f7('0x25')]]={'$like':'%'+_0x3a30c3['query'][_0x43f7('0x3c')]+'%'};return _0x2f7aa2;}})});}_0x1869f9=_['merge']({},_0x1869f9,_0x3a30c3[_0x43f7('0x3d')]);var _0x43ebc4={'where':_0x1869f9[_0x43f7('0x39')]};return db[_0x43f7('0x28')][_0x43f7('0x19')](_0x43ebc4)[_0x43f7('0x20')](function(_0xf40b15){_0x210598[_0x43f7('0x19')]=_0xf40b15;if(_0x3a30c3['query'][_0x43f7('0x3e')]){_0x1869f9['include']=[{'all':!![]}];}return db[_0x43f7('0x28')]['findAll'](_0x1869f9);})[_0x43f7('0x20')](function(_0x131b02){_0x210598[_0x43f7('0x3f')]=_0x131b02;return _0x210598;})[_0x43f7('0x20')](respondWithFilteredResult(_0x29b014,_0x1869f9))[_0x43f7('0x40')](handleError(_0x29b014,null));};exports[_0x43f7('0x41')]=function(_0x2c3a8a,_0x51004b){var _0x891f1d={'raw':!![],'where':{'id':_0x2c3a8a[_0x43f7('0x42')]['id']}},_0x269e2b={};_0x269e2b[_0x43f7('0x2d')]=_[_0x43f7('0x2f')](db[_0x43f7('0x28')][_0x43f7('0x29')]);_0x269e2b[_0x43f7('0x2e')]=_[_0x43f7('0x2f')](_0x2c3a8a[_0x43f7('0x2e')]);_0x269e2b[_0x43f7('0x30')]=_['intersection'](_0x269e2b[_0x43f7('0x2d')],_0x269e2b['query']);_0x891f1d[_0x43f7('0x32')]=_[_0x43f7('0x31')](_0x269e2b['model'],qs['fields'](_0x2c3a8a[_0x43f7('0x2e')][_0x43f7('0x33')]));_0x891f1d['attributes']=_0x891f1d['attributes'][_0x43f7('0x34')]?_0x891f1d['attributes']:_0x269e2b[_0x43f7('0x2d')];if(_0x2c3a8a[_0x43f7('0x2e')][_0x43f7('0x3e')]){_0x891f1d['include']=[{'all':!![]}];}_0x891f1d=_['merge']({},_0x891f1d,_0x2c3a8a[_0x43f7('0x3d')]);return db[_0x43f7('0x28')]['find'](_0x891f1d)[_0x43f7('0x20')](handleEntityNotFound(_0x51004b,null))['then'](respondWithResult(_0x51004b,null))[_0x43f7('0x40')](handleError(_0x51004b,null));};exports[_0x43f7('0x43')]=function(_0x5f2a26,_0x322a64){return db['ChatQueueReport'][_0x43f7('0x43')](_0x5f2a26['body'],{})[_0x43f7('0x20')](respondWithResult(_0x322a64,0xc9))[_0x43f7('0x40')](handleError(_0x322a64,null));};exports[_0x43f7('0x1f')]=function(_0x1b0bf2,_0x6a2209){if(_0x1b0bf2[_0x43f7('0x44')]['id']){delete _0x1b0bf2[_0x43f7('0x44')]['id'];}return db[_0x43f7('0x28')][_0x43f7('0x45')]({'where':{'id':_0x1b0bf2['params']['id']}})[_0x43f7('0x20')](handleEntityNotFound(_0x6a2209,null))['then'](saveUpdates(_0x1b0bf2[_0x43f7('0x44')],null))[_0x43f7('0x20')](respondWithResult(_0x6a2209,null))['catch'](handleError(_0x6a2209,null));};exports[_0x43f7('0x21')]=function(_0x4be51b,_0x5d3694){return db[_0x43f7('0x28')]['find']({'where':{'id':_0x4be51b[_0x43f7('0x42')]['id']}})['then'](handleEntityNotFound(_0x5d3694,null))[_0x43f7('0x20')](removeEntity(_0x5d3694,null))[_0x43f7('0x40')](handleError(_0x5d3694,null));};exports[_0x43f7('0x46')]=function(_0x3ff4c6,_0xe4f870){return db[_0x43f7('0x28')][_0x43f7('0x46')]()[_0x43f7('0x20')](respondWithResult(_0xe4f870,null))['catch'](handleError(_0xe4f870,null));}; \ No newline at end of file +var _0x74f9=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','ChatQueueReport','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x5c4777,_0x3022fe){var _0x3e9643=function(_0x2c9594){while(--_0x2c9594){_0x5c4777['push'](_0x5c4777['shift']());}};_0x3e9643(++_0x3022fe);}(_0x74f9,0x190));var _0x974f=function(_0x2d5572,_0x19eba6){_0x2d5572=_0x2d5572-0x0;var _0x1bb95c=_0x74f9[_0x2d5572];return _0x1bb95c;};'use strict';var pdf=require(_0x974f('0x0'));var emlformat=require(_0x974f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x974f('0x2'));var jsonpatch=require(_0x974f('0x3'));var rp=require(_0x974f('0x4'));var moment=require('moment');var BPromise=require(_0x974f('0x5'));var Mustache=require(_0x974f('0x6'));var util=require('util');var path=require(_0x974f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x974f('0x8'));var fs=require('fs');var _=require(_0x974f('0x9'));var squel=require(_0x974f('0xa'));var crypto=require(_0x974f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x974f('0xc'));var toCsv=require(_0x974f('0xd'));var querystring=require(_0x974f('0xe'));var Papa=require(_0x974f('0xf'));var Redis=require(_0x974f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x974f('0x11'));var as=require(_0x974f('0x12'));var hardwareService=require(_0x974f('0x13'));var logger=require('../../config/logger')(_0x974f('0x14'));var utils=require(_0x974f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x974f('0x16'));var db=require(_0x974f('0x17'))['db'];function respondWithStatusCode(_0xd9953a,_0x2bbd64){_0x2bbd64=_0x2bbd64||0xcc;return function(_0x47989){if(_0x47989){return _0xd9953a['sendStatus'](_0x2bbd64);}return _0xd9953a[_0x974f('0x18')](_0x2bbd64)['end']();};}function respondWithResult(_0x7456ba,_0x39b745){_0x39b745=_0x39b745||0xc8;return function(_0x3aa60c){if(_0x3aa60c){return _0x7456ba[_0x974f('0x18')](_0x39b745)[_0x974f('0x19')](_0x3aa60c);}};}function respondWithFilteredResult(_0xf6cc92,_0x43db22){return function(_0x5c616a){if(_0x5c616a){var _0x34d82b=_0x5c616a[_0x974f('0x1a')],_0x1073ec=_0x43db22[_0x974f('0x1b')],_0x3348fc=_0x43db22[_0x974f('0x1b')]+_0x43db22[_0x974f('0x1c')],_0x5d8cee;if(_0x3348fc>=_0x34d82b){_0x3348fc=_0x34d82b;_0x5d8cee=0xc8;}else{_0x5d8cee=0xce;}_0xf6cc92[_0x974f('0x18')](_0x5d8cee);return _0xf6cc92[_0x974f('0x1d')](_0x974f('0x1e'),_0x1073ec+'-'+_0x3348fc+'/'+_0x34d82b)['json'](_0x5c616a);}return null;};}function patchUpdates(_0x596895){return function(_0x46ac0f){try{jsonpatch[_0x974f('0x1f')](_0x46ac0f,_0x596895,!![]);}catch(_0x1615be){return BPromise[_0x974f('0x20')](_0x1615be);}return _0x46ac0f[_0x974f('0x21')]();};}function saveUpdates(_0x1400bc,_0x417e43){return function(_0x41eecf){if(_0x41eecf){return _0x41eecf[_0x974f('0x22')](_0x1400bc)[_0x974f('0x23')](function(_0x5e393f){return _0x5e393f;});}return null;};}function removeEntity(_0x29f5d4,_0x43b846){return function(_0x6b18d8){if(_0x6b18d8){return _0x6b18d8[_0x974f('0x24')]()['then'](function(){_0x29f5d4[_0x974f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1584f0,_0x3bc8eb){return function(_0x55a4ce){if(!_0x55a4ce){_0x1584f0[_0x974f('0x25')](0x194);}return _0x55a4ce;};}function handleError(_0x546ded,_0xe6f6a9){_0xe6f6a9=_0xe6f6a9||0x1f4;return function(_0xcc4ed1){logger[_0x974f('0x26')](_0xcc4ed1[_0x974f('0x27')]);if(_0xcc4ed1[_0x974f('0x28')]){delete _0xcc4ed1['name'];}_0x546ded[_0x974f('0x18')](_0xe6f6a9)[_0x974f('0x29')](_0xcc4ed1);};}exports['index']=function(_0x43316c,_0x3974d8){var _0x582c41={},_0x49b8c4={},_0x4ee28d={'count':0x0,'rows':[]};var _0x4550fb=_[_0x974f('0x2a')](db['ChatQueueReport'][_0x974f('0x2b')],function(_0x92fa02){return{'name':_0x92fa02['fieldName'],'type':_0x92fa02[_0x974f('0x2c')][_0x974f('0x2d')]};});_0x49b8c4[_0x974f('0x2e')]=_[_0x974f('0x2a')](_0x4550fb,_0x974f('0x28'));_0x49b8c4[_0x974f('0x2f')]=_['keys'](_0x43316c[_0x974f('0x2f')]);_0x49b8c4[_0x974f('0x30')]=_[_0x974f('0x31')](_0x49b8c4[_0x974f('0x2e')],_0x49b8c4[_0x974f('0x2f')]);_0x582c41[_0x974f('0x32')]=_[_0x974f('0x31')](_0x49b8c4['model'],qs[_0x974f('0x33')](_0x43316c[_0x974f('0x2f')]['fields']));_0x582c41[_0x974f('0x32')]=_0x582c41[_0x974f('0x32')][_0x974f('0x34')]?_0x582c41['attributes']:_0x49b8c4[_0x974f('0x2e')];if(!_0x43316c[_0x974f('0x2f')]['hasOwnProperty']('nolimit')){_0x582c41['limit']=qs['limit'](_0x43316c[_0x974f('0x2f')][_0x974f('0x1c')]);_0x582c41[_0x974f('0x1b')]=qs[_0x974f('0x1b')](_0x43316c[_0x974f('0x2f')]['offset']);}_0x582c41['order']=qs['sort'](_0x43316c['query'][_0x974f('0x35')]);_0x582c41[_0x974f('0x36')]=qs[_0x974f('0x30')](_[_0x974f('0x37')](_0x43316c[_0x974f('0x2f')],_0x49b8c4[_0x974f('0x30')]),_0x4550fb);if(_0x43316c[_0x974f('0x2f')][_0x974f('0x38')]){_0x582c41[_0x974f('0x36')]=_[_0x974f('0x39')](_0x582c41[_0x974f('0x36')],{'$or':_['map'](_0x4550fb,function(_0xf606ea){if(_0xf606ea[_0x974f('0x2c')]!=='VIRTUAL'){var _0x4f9a1b={};_0x4f9a1b[_0xf606ea[_0x974f('0x28')]]={'$like':'%'+_0x43316c[_0x974f('0x2f')][_0x974f('0x38')]+'%'};return _0x4f9a1b;}})});}_0x582c41=_[_0x974f('0x39')]({},_0x582c41,_0x43316c[_0x974f('0x3a')]);var _0x52655e={'where':_0x582c41[_0x974f('0x36')]};return db[_0x974f('0x3b')][_0x974f('0x1a')](_0x52655e)['then'](function(_0xd17a7e){_0x4ee28d['count']=_0xd17a7e;if(_0x43316c[_0x974f('0x2f')]['includeAll']){_0x582c41[_0x974f('0x3c')]=[{'all':!![]}];}return db[_0x974f('0x3b')][_0x974f('0x3d')](_0x582c41);})['then'](function(_0x5dd1df){_0x4ee28d[_0x974f('0x3e')]=_0x5dd1df;return _0x4ee28d;})[_0x974f('0x23')](respondWithFilteredResult(_0x3974d8,_0x582c41))[_0x974f('0x3f')](handleError(_0x3974d8,null));};exports[_0x974f('0x40')]=function(_0x2d2cae,_0x12f8db){var _0x5a5f88={'raw':!![],'where':{'id':_0x2d2cae[_0x974f('0x41')]['id']}},_0x3943fa={};_0x3943fa[_0x974f('0x2e')]=_[_0x974f('0x42')](db['ChatQueueReport']['rawAttributes']);_0x3943fa[_0x974f('0x2f')]=_[_0x974f('0x42')](_0x2d2cae[_0x974f('0x2f')]);_0x3943fa[_0x974f('0x30')]=_['intersection'](_0x3943fa['model'],_0x3943fa['query']);_0x5a5f88[_0x974f('0x32')]=_[_0x974f('0x31')](_0x3943fa['model'],qs[_0x974f('0x33')](_0x2d2cae[_0x974f('0x2f')]['fields']));_0x5a5f88[_0x974f('0x32')]=_0x5a5f88['attributes'][_0x974f('0x34')]?_0x5a5f88[_0x974f('0x32')]:_0x3943fa[_0x974f('0x2e')];if(_0x2d2cae[_0x974f('0x2f')][_0x974f('0x43')]){_0x5a5f88[_0x974f('0x3c')]=[{'all':!![]}];}_0x5a5f88=_[_0x974f('0x39')]({},_0x5a5f88,_0x2d2cae[_0x974f('0x3a')]);return db[_0x974f('0x3b')][_0x974f('0x44')](_0x5a5f88)[_0x974f('0x23')](handleEntityNotFound(_0x12f8db,null))[_0x974f('0x23')](respondWithResult(_0x12f8db,null))['catch'](handleError(_0x12f8db,null));};exports['create']=function(_0x50411b,_0x39484c){return db[_0x974f('0x3b')][_0x974f('0x45')](_0x50411b[_0x974f('0x46')],{})[_0x974f('0x23')](respondWithResult(_0x39484c,0xc9))[_0x974f('0x3f')](handleError(_0x39484c,null));};exports[_0x974f('0x22')]=function(_0x264cfb,_0x4e5302){if(_0x264cfb[_0x974f('0x46')]['id']){delete _0x264cfb['body']['id'];}return db[_0x974f('0x3b')][_0x974f('0x44')]({'where':{'id':_0x264cfb[_0x974f('0x41')]['id']}})['then'](handleEntityNotFound(_0x4e5302,null))[_0x974f('0x23')](saveUpdates(_0x264cfb[_0x974f('0x46')],null))[_0x974f('0x23')](respondWithResult(_0x4e5302,null))[_0x974f('0x3f')](handleError(_0x4e5302,null));};exports[_0x974f('0x24')]=function(_0x149a32,_0x8e87af){return db['ChatQueueReport'][_0x974f('0x44')]({'where':{'id':_0x149a32['params']['id']}})[_0x974f('0x23')](handleEntityNotFound(_0x8e87af,null))['then'](removeEntity(_0x8e87af,null))[_0x974f('0x3f')](handleError(_0x8e87af,null));};exports[_0x974f('0x47')]=function(_0xaec048,_0x44dca7){return db[_0x974f('0x3b')][_0x974f('0x47')]()['then'](respondWithResult(_0x44dca7,null))[_0x974f('0x3f')](handleError(_0x44dca7,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 682b071..ca2ac8d 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 _0x1f92=['../../config/logger','api','moment','request-promise','path','rimraf','ChatQueueReport','report_chat_queue','uniqueid','util'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0x1f92,0x1d5));var _0x21f9=function(_0x89d2c0,_0x256072){_0x89d2c0=_0x89d2c0-0x0;var _0x25459b=_0x1f92[_0x89d2c0];return _0x25459b;};'use strict';var _=require('lodash');var util=require(_0x21f9('0x0'));var logger=require(_0x21f9('0x1'))(_0x21f9('0x2'));var moment=require(_0x21f9('0x3'));var BPromise=require('bluebird');var rp=require(_0x21f9('0x4'));var fs=require('fs');var path=require(_0x21f9('0x5'));var rimraf=require(_0x21f9('0x6'));var config=require('../../config/environment');var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x2ca018,_0x162fba){return _0x2ca018['define'](_0x21f9('0x7'),attributes,{'tableName':_0x21f9('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x21f9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x54e1=['request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','define','report_chat_queue','uniqueid','util','api'];(function(_0x4a7b64,_0x16733c){var _0x500da6=function(_0x3454da){while(--_0x3454da){_0x4a7b64['push'](_0x4a7b64['shift']());}};_0x500da6(++_0x16733c);}(_0x54e1,0xd0));var _0x154e=function(_0x9f44e9,_0x5e0780){_0x9f44e9=_0x9f44e9-0x0;var _0x3fadc7=_0x54e1[_0x9f44e9];return _0x3fadc7;};'use strict';var _=require('lodash');var util=require(_0x154e('0x0'));var logger=require('../../config/logger')(_0x154e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x154e('0x2'));var fs=require('fs');var path=require(_0x154e('0x3'));var rimraf=require(_0x154e('0x4'));var config=require(_0x154e('0x5'));var attributes=require(_0x154e('0x6'));module['exports']=function(_0x973c5b,_0x1eeece){return _0x973c5b[_0x154e('0x7')]('ChatQueueReport',attributes,{'tableName':_0x154e('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x154e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index f38aedb..0b0c0a0 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 _0x2556=['info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateChatQueueReport','create','body','options','raw','stringify','UpdateChatQueueReport','ChatQueueReport','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xf3af0c,_0x858948){var _0x3148bc=function(_0x2a72fe){while(--_0x2a72fe){_0xf3af0c['push'](_0xf3af0c['shift']());}};_0x3148bc(++_0x858948);}(_0x2556,0xb8));var _0x6255=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x2556[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x6255('0x0'));var util=require(_0x6255('0x1'));var moment=require(_0x6255('0x2'));var BPromise=require('bluebird');var rs=require(_0x6255('0x3'));var fs=require('fs');var Redis=require(_0x6255('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6255('0x5'));var logger=require(_0x6255('0x6'))(_0x6255('0x7'));var config=require(_0x6255('0x8'));var jayson=require(_0x6255('0x9'));var client=jayson[_0x6255('0xa')][_0x6255('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5670b6,_0x12e4b2,_0x492ee6){return new BPromise(function(_0x31cf24,_0x2a449e){return client[_0x6255('0xc')](_0x5670b6,_0x492ee6)[_0x6255('0xd')](function(_0x2f22e8){logger[_0x6255('0xe')](_0x6255('0xf'),_0x12e4b2,_0x6255('0x10'));logger[_0x6255('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x12e4b2,_0x6255('0x10'),JSON['stringify'](_0x2f22e8));if(_0x2f22e8[_0x6255('0x12')]){if(_0x2f22e8[_0x6255('0x12')][_0x6255('0x13')]===0x1f4){logger[_0x6255('0x12')](_0x6255('0xf'),_0x12e4b2,_0x2f22e8[_0x6255('0x12')][_0x6255('0x14')]);return _0x2a449e(_0x2f22e8[_0x6255('0x12')][_0x6255('0x14')]);}logger['error'](_0x6255('0xf'),_0x12e4b2,_0x2f22e8['error'][_0x6255('0x14')]);return _0x31cf24(_0x2f22e8[_0x6255('0x12')][_0x6255('0x14')]);}else{logger[_0x6255('0xe')](_0x6255('0xf'),_0x12e4b2,_0x6255('0x10'));_0x31cf24(_0x2f22e8[_0x6255('0x15')][_0x6255('0x14')]);}})[_0x6255('0x16')](function(_0x3eaa0e){logger[_0x6255('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x12e4b2,_0x3eaa0e);_0x2a449e(_0x3eaa0e);});});}exports[_0x6255('0x17')]=function(_0x349692){var _0x41f84a=this;return new Promise(function(_0x525ce8,_0x2cc1c4){return db['ChatQueueReport'][_0x6255('0x18')](_0x349692[_0x6255('0x19')],{'raw':_0x349692[_0x6255('0x1a')]?_0x349692[_0x6255('0x1a')][_0x6255('0x1b')]===undefined?!![]:![]:!![]})[_0x6255('0xd')](function(_0x44db8f){logger['info']('CreateChatQueueReport',_0x349692);logger[_0x6255('0x11')](_0x6255('0x17'),_0x349692,JSON[_0x6255('0x1c')](_0x44db8f));_0x525ce8(_0x44db8f);})[_0x6255('0x16')](function(_0x1c244e){logger[_0x6255('0x12')](_0x6255('0x17'),_0x1c244e[_0x6255('0x14')],_0x349692);_0x2cc1c4(_0x41f84a['error'](0x1f4,_0x1c244e[_0x6255('0x14')]));});});};exports[_0x6255('0x1d')]=function(_0x505ad1){var _0x5686b0=this;return new Promise(function(_0x40771f,_0x240375){return db[_0x6255('0x1e')]['update'](_0x505ad1['body'],{'raw':_0x505ad1[_0x6255('0x1a')]?_0x505ad1['options'][_0x6255('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x505ad1[_0x6255('0x1a')]?_0x505ad1[_0x6255('0x1a')][_0x6255('0x1f')]||null:null,'attributes':_0x505ad1['options']?_0x505ad1[_0x6255('0x1a')][_0x6255('0x20')]||null:null,'limit':_0x505ad1[_0x6255('0x1a')]?_0x505ad1[_0x6255('0x1a')]['limit']||null:null})['then'](function(_0x4d9cbe){logger[_0x6255('0xe')](_0x6255('0x1d'),_0x505ad1);logger[_0x6255('0x11')](_0x6255('0x1d'),_0x505ad1,JSON[_0x6255('0x1c')](_0x4d9cbe));_0x40771f(_0x4d9cbe);})[_0x6255('0x16')](function(_0x55adeb){logger[_0x6255('0x12')]('UpdateChatQueueReport',_0x55adeb[_0x6255('0x14')],_0x505ad1);_0x240375(_0x5686b0['error'](0x1f4,_0x55adeb[_0x6255('0x14')]));});});}; \ No newline at end of file +var _0x3bf9=['request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','create','options','info','debug','stringify','UpdateChatQueueReport','body','raw','where','attributes','limit','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request'];(function(_0x97654e,_0x4a899a){var _0x51a984=function(_0x20fc40){while(--_0x20fc40){_0x97654e['push'](_0x97654e['shift']());}};_0x51a984(++_0x4a899a);}(_0x3bf9,0x16a));var _0x93bf=function(_0x1c37a5,_0x59ee51){_0x1c37a5=_0x1c37a5-0x0;var _0x389d03=_0x3bf9[_0x1c37a5];return _0x389d03;};'use strict';var _=require(_0x93bf('0x0'));var util=require(_0x93bf('0x1'));var moment=require(_0x93bf('0x2'));var BPromise=require('bluebird');var rs=require(_0x93bf('0x3'));var fs=require('fs');var Redis=require(_0x93bf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x93bf('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x93bf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x93bf('0x7')][_0x93bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f49f0,_0xa74ee0,_0x587eb3){return new BPromise(function(_0x1b72d7,_0x1c2bf8){return client[_0x93bf('0x9')](_0x4f49f0,_0x587eb3)['then'](function(_0x2b85a5){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0xa74ee0,_0x93bf('0xa'));logger['debug'](_0x93bf('0xb'),_0xa74ee0,_0x93bf('0xa'),JSON['stringify'](_0x2b85a5));if(_0x2b85a5[_0x93bf('0xc')]){if(_0x2b85a5[_0x93bf('0xc')][_0x93bf('0xd')]===0x1f4){logger[_0x93bf('0xc')](_0x93bf('0xe'),_0xa74ee0,_0x2b85a5[_0x93bf('0xc')][_0x93bf('0xf')]);return _0x1c2bf8(_0x2b85a5[_0x93bf('0xc')][_0x93bf('0xf')]);}logger[_0x93bf('0xc')](_0x93bf('0xe'),_0xa74ee0,_0x2b85a5[_0x93bf('0xc')][_0x93bf('0xf')]);return _0x1b72d7(_0x2b85a5[_0x93bf('0xc')][_0x93bf('0xf')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0xa74ee0,_0x93bf('0xa'));_0x1b72d7(_0x2b85a5[_0x93bf('0x10')]['message']);}})[_0x93bf('0x11')](function(_0x299a1b){logger[_0x93bf('0xc')](_0x93bf('0xe'),_0xa74ee0,_0x299a1b);_0x1c2bf8(_0x299a1b);});});}exports[_0x93bf('0x12')]=function(_0x55bd15){var _0x5511cd=this;return new Promise(function(_0x2f1b06,_0x380cf0){return db['ChatQueueReport'][_0x93bf('0x13')](_0x55bd15['body'],{'raw':_0x55bd15[_0x93bf('0x14')]?_0x55bd15[_0x93bf('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4e20b3){logger[_0x93bf('0x15')](_0x93bf('0x12'),_0x55bd15);logger[_0x93bf('0x16')](_0x93bf('0x12'),_0x55bd15,JSON[_0x93bf('0x17')](_0x4e20b3));_0x2f1b06(_0x4e20b3);})[_0x93bf('0x11')](function(_0x25913f){logger[_0x93bf('0xc')](_0x93bf('0x12'),_0x25913f[_0x93bf('0xf')],_0x55bd15);_0x380cf0(_0x5511cd[_0x93bf('0xc')](0x1f4,_0x25913f[_0x93bf('0xf')]));});});};exports[_0x93bf('0x18')]=function(_0x5ad7a9){var _0xd0ab97=this;return new Promise(function(_0x5bee06,_0x489ccf){return db['ChatQueueReport']['update'](_0x5ad7a9[_0x93bf('0x19')],{'raw':_0x5ad7a9[_0x93bf('0x14')]?_0x5ad7a9[_0x93bf('0x14')][_0x93bf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ad7a9[_0x93bf('0x14')]?_0x5ad7a9[_0x93bf('0x14')][_0x93bf('0x1b')]||null:null,'attributes':_0x5ad7a9[_0x93bf('0x14')]?_0x5ad7a9[_0x93bf('0x14')][_0x93bf('0x1c')]||null:null,'limit':_0x5ad7a9[_0x93bf('0x14')]?_0x5ad7a9['options'][_0x93bf('0x1d')]||null:null})[_0x93bf('0x1e')](function(_0x3e56fa){logger[_0x93bf('0x15')](_0x93bf('0x18'),_0x5ad7a9);logger['debug']('UpdateChatQueueReport',_0x5ad7a9,JSON['stringify'](_0x3e56fa));_0x5bee06(_0x3e56fa);})[_0x93bf('0x11')](function(_0x5a823a){logger[_0x93bf('0xc')](_0x93bf('0x18'),_0x5a823a[_0x93bf('0xf')],_0x5ad7a9);_0x489ccf(_0xd0ab97['error'](0x1f4,_0x5a823a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 6a79943..00b2252 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 _0x9aac=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','show','create','put','/:id','update','delete','exports','multer'];(function(_0x20ceec,_0x5d61e6){var _0x567ceb=function(_0x4a712e){while(--_0x4a712e){_0x20ceec['push'](_0x20ceec['shift']());}};_0x567ceb(++_0x5d61e6);}(_0x9aac,0xef));var _0xc9aa=function(_0x241da7,_0x3a0b4a){_0x241da7=_0x241da7-0x0;var _0x5ed3d2=_0x9aac[_0x241da7];return _0x5ed3d2;};'use strict';var multer=require(_0xc9aa('0x0'));var util=require(_0xc9aa('0x1'));var path=require(_0xc9aa('0x2'));var timeout=require('connect-timeout');var express=require(_0xc9aa('0x3'));var router=express[_0xc9aa('0x4')]();var auth=require(_0xc9aa('0x5'));var interaction=require(_0xc9aa('0x6'));var config=require(_0xc9aa('0x7'));var controller=require(_0xc9aa('0x8'));router[_0xc9aa('0x9')]('/',auth[_0xc9aa('0xa')](),controller[_0xc9aa('0xb')]);router['get'](_0xc9aa('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xc9aa('0x9')]('/:id',auth[_0xc9aa('0xa')](),controller[_0xc9aa('0xd')]);router['post']('/',auth[_0xc9aa('0xa')](),controller[_0xc9aa('0xe')]);router[_0xc9aa('0xf')](_0xc9aa('0x10'),auth[_0xc9aa('0xa')](),controller[_0xc9aa('0x11')]);router[_0xc9aa('0x12')]('/:id',auth[_0xc9aa('0xa')](),controller['destroy']);module[_0xc9aa('0x13')]=router; \ No newline at end of file +var _0x772b=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','post'];(function(_0x48255e,_0x29659b){var _0x197284=function(_0x14c5a2){while(--_0x14c5a2){_0x48255e['push'](_0x48255e['shift']());}};_0x197284(++_0x29659b);}(_0x772b,0x1ab));var _0xb772=function(_0x36b5d5,_0x3f25a3){_0x36b5d5=_0x36b5d5-0x0;var _0x44ab04=_0x772b[_0x36b5d5];return _0x44ab04;};'use strict';var multer=require(_0xb772('0x0'));var util=require(_0xb772('0x1'));var path=require(_0xb772('0x2'));var timeout=require(_0xb772('0x3'));var express=require(_0xb772('0x4'));var router=express[_0xb772('0x5')]();var auth=require(_0xb772('0x6'));var interaction=require(_0xb772('0x7'));var config=require(_0xb772('0x8'));var controller=require('./chatQueueReport.controller');router[_0xb772('0x9')]('/',auth[_0xb772('0xa')](),controller[_0xb772('0xb')]);router[_0xb772('0x9')](_0xb772('0xc'),auth[_0xb772('0xa')](),controller['describe']);router[_0xb772('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb772('0xd')]('/',auth['isAuthenticated'](),controller[_0xb772('0xe')]);router[_0xb772('0xf')](_0xb772('0x10'),auth[_0xb772('0xa')](),controller[_0xb772('0x11')]);router[_0xb772('0x12')](_0xb772('0x10'),auth[_0xb772('0xa')](),controller[_0xb772('0x13')]);module[_0xb772('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 5bdd743..f168efd 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 _0x7615=['DATE','NOW','moment','STRING','ENUM','queue'];(function(_0x5387ec,_0xa92010){var _0x467ed2=function(_0x161f30){while(--_0x161f30){_0x5387ec['push'](_0x5387ec['shift']());}};_0x467ed2(++_0xa92010);}(_0x7615,0x1be));var _0x5761=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x7615[_0x359bbe];return _0x1b3353;};'use strict';var moment=require(_0x5761('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x5761('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5761('0x2')]('account','agent',_0x5761('0x3')),'allowNull':![],'defaultValue':_0x5761('0x3')},'transferredAt':{'type':Sequelize[_0x5761('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x5761('0x5')]}}; \ No newline at end of file +var _0x1a3a=['STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1a3a,0xf7));var _0xa1a3=function(_0x5d3891,_0x57fdac){_0x5d3891=_0x5d3891-0x0;var _0x3da005=_0x1a3a[_0x5d3891];return _0x3da005;};'use strict';var moment=require(_0xa1a3('0x0'));var Sequelize=require(_0xa1a3('0x1'));module[_0xa1a3('0x2')]={'uniqueid':{'type':Sequelize[_0xa1a3('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa1a3('0x4')](_0xa1a3('0x5'),_0xa1a3('0x6'),'queue'),'allowNull':![],'defaultValue':_0xa1a3('0x7')},'transferredAt':{'type':Sequelize[_0xa1a3('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xa1a3('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index b380107..26854d2 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 _0x012c=['update','destroy','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','query','attributes','intersection','length','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','catch','show','keys','fields','include','options','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject'];(function(_0x54418c,_0x1c765b){var _0x52a3bd=function(_0x333661){while(--_0x333661){_0x54418c['push'](_0x54418c['shift']());}};_0x52a3bd(++_0x1c765b);}(_0x012c,0x1ea));var _0xc012=function(_0x5e343c,_0x5d5c6a){_0x5e343c=_0x5e343c-0x0;var _0x497243=_0x012c[_0x5e343c];return _0x497243;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc012('0x0'));var zipdir=require(_0xc012('0x1'));var jsonpatch=require(_0xc012('0x2'));var rp=require(_0xc012('0x3'));var moment=require('moment');var BPromise=require(_0xc012('0x4'));var Mustache=require('mustache');var util=require(_0xc012('0x5'));var path=require(_0xc012('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc012('0x7'));var fs=require('fs');var _=require(_0xc012('0x8'));var squel=require(_0xc012('0x9'));var crypto=require(_0xc012('0xa'));var jsforce=require(_0xc012('0xb'));var deskjs=require(_0xc012('0xc'));var toCsv=require(_0xc012('0xd'));var querystring=require(_0xc012('0xe'));var Papa=require(_0xc012('0xf'));var Redis=require(_0xc012('0x10'));var authService=require(_0xc012('0x11'));var qs=require(_0xc012('0x12'));var as=require(_0xc012('0x13'));var hardwareService=require(_0xc012('0x14'));var logger=require(_0xc012('0x15'))(_0xc012('0x16'));var utils=require(_0xc012('0x17'));var config=require(_0xc012('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc012('0x19'))['db'];function respondWithStatusCode(_0x36c960,_0x41cb97){_0x41cb97=_0x41cb97||0xcc;return function(_0x751eb8){if(_0x751eb8){return _0x36c960[_0xc012('0x1a')](_0x41cb97);}return _0x36c960[_0xc012('0x1b')](_0x41cb97)[_0xc012('0x1c')]();};}function respondWithResult(_0x45e87d,_0x134bc9){_0x134bc9=_0x134bc9||0xc8;return function(_0x46c1f1){if(_0x46c1f1){return _0x45e87d[_0xc012('0x1b')](_0x134bc9)[_0xc012('0x1d')](_0x46c1f1);}};}function respondWithFilteredResult(_0x546ce7,_0x579d4a){return function(_0x271740){if(_0x271740){var _0x11a082=_0x271740[_0xc012('0x1e')],_0x18903b=_0x579d4a[_0xc012('0x1f')],_0x3e9916=_0x579d4a[_0xc012('0x1f')]+_0x579d4a[_0xc012('0x20')],_0x4359b5;if(_0x3e9916>=_0x11a082){_0x3e9916=_0x11a082;_0x4359b5=0xc8;}else{_0x4359b5=0xce;}_0x546ce7[_0xc012('0x1b')](_0x4359b5);return _0x546ce7['set'](_0xc012('0x21'),_0x18903b+'-'+_0x3e9916+'/'+_0x11a082)[_0xc012('0x1d')](_0x271740);}return null;};}function patchUpdates(_0x2bec91){return function(_0x37f4df){try{jsonpatch['apply'](_0x37f4df,_0x2bec91,!![]);}catch(_0x475932){return BPromise[_0xc012('0x22')](_0x475932);}return _0x37f4df['save']();};}function saveUpdates(_0x48c482,_0xedea49){return function(_0x197083){if(_0x197083){return _0x197083[_0xc012('0x23')](_0x48c482)['then'](function(_0x294d20){return _0x294d20;});}return null;};}function removeEntity(_0x39a6d2,_0xba041a){return function(_0x392b0e){if(_0x392b0e){return _0x392b0e[_0xc012('0x24')]()[_0xc012('0x25')](function(){_0x39a6d2['status'](0xcc)[_0xc012('0x1c')]();});}};}function handleEntityNotFound(_0x49f9c4,_0x3101a4){return function(_0x27634a){if(!_0x27634a){_0x49f9c4[_0xc012('0x1a')](0x194);}return _0x27634a;};}function handleError(_0x57d01e,_0x19d312){_0x19d312=_0x19d312||0x1f4;return function(_0x311a3c){logger[_0xc012('0x26')](_0x311a3c[_0xc012('0x27')]);if(_0x311a3c[_0xc012('0x28')]){delete _0x311a3c['name'];}_0x57d01e[_0xc012('0x1b')](_0x19d312)[_0xc012('0x29')](_0x311a3c);};}exports[_0xc012('0x2a')]=function(_0x4cd8d6,_0x1287aa){var _0x453b63={},_0x527d37={},_0xe0ec57={'count':0x0,'rows':[]};var _0x1c7ff=_[_0xc012('0x2b')](db[_0xc012('0x2c')][_0xc012('0x2d')],function(_0x4243fa){return{'name':_0x4243fa[_0xc012('0x2e')],'type':_0x4243fa[_0xc012('0x2f')]['key']};});_0x527d37['model']=_['map'](_0x1c7ff,_0xc012('0x28'));_0x527d37[_0xc012('0x30')]=_['keys'](_0x4cd8d6['query']);_0x527d37['filters']=_['intersection'](_0x527d37['model'],_0x527d37[_0xc012('0x30')]);_0x453b63[_0xc012('0x31')]=_[_0xc012('0x32')](_0x527d37['model'],qs['fields'](_0x4cd8d6['query']['fields']));_0x453b63['attributes']=_0x453b63[_0xc012('0x31')][_0xc012('0x33')]?_0x453b63[_0xc012('0x31')]:_0x527d37[_0xc012('0x34')];if(!_0x4cd8d6[_0xc012('0x30')][_0xc012('0x35')](_0xc012('0x36'))){_0x453b63[_0xc012('0x20')]=qs[_0xc012('0x20')](_0x4cd8d6[_0xc012('0x30')]['limit']);_0x453b63[_0xc012('0x1f')]=qs['offset'](_0x4cd8d6['query']['offset']);}_0x453b63[_0xc012('0x37')]=qs[_0xc012('0x38')](_0x4cd8d6[_0xc012('0x30')][_0xc012('0x38')]);_0x453b63[_0xc012('0x39')]=qs[_0xc012('0x3a')](_['pick'](_0x4cd8d6['query'],_0x527d37[_0xc012('0x3a')]),_0x1c7ff);if(_0x4cd8d6[_0xc012('0x30')][_0xc012('0x3b')]){_0x453b63[_0xc012('0x39')]=_[_0xc012('0x3c')](_0x453b63[_0xc012('0x39')],{'$or':_[_0xc012('0x2b')](_0x1c7ff,function(_0x41213b){if(_0x41213b[_0xc012('0x2f')]!==_0xc012('0x3d')){var _0x3b8bbe={};_0x3b8bbe[_0x41213b[_0xc012('0x28')]]={'$like':'%'+_0x4cd8d6['query'][_0xc012('0x3b')]+'%'};return _0x3b8bbe;}})});}_0x453b63=_[_0xc012('0x3c')]({},_0x453b63,_0x4cd8d6['options']);var _0x1897e7={'where':_0x453b63[_0xc012('0x39')]};return db[_0xc012('0x2c')][_0xc012('0x1e')](_0x1897e7)['then'](function(_0x2de964){_0xe0ec57[_0xc012('0x1e')]=_0x2de964;if(_0x4cd8d6[_0xc012('0x30')][_0xc012('0x3e')]){_0x453b63['include']=[{'all':!![]}];}return db[_0xc012('0x2c')][_0xc012('0x3f')](_0x453b63);})[_0xc012('0x25')](function(_0x1035fc){_0xe0ec57['rows']=_0x1035fc;return _0xe0ec57;})[_0xc012('0x25')](respondWithFilteredResult(_0x1287aa,_0x453b63))[_0xc012('0x40')](handleError(_0x1287aa,null));};exports[_0xc012('0x41')]=function(_0xc1cb7f,_0x5d4ab8){var _0x492ee7={'raw':!![],'where':{'id':_0xc1cb7f['params']['id']}},_0x29c067={};_0x29c067['model']=_[_0xc012('0x42')](db[_0xc012('0x2c')][_0xc012('0x2d')]);_0x29c067['query']=_[_0xc012('0x42')](_0xc1cb7f[_0xc012('0x30')]);_0x29c067['filters']=_[_0xc012('0x32')](_0x29c067[_0xc012('0x34')],_0x29c067['query']);_0x492ee7[_0xc012('0x31')]=_[_0xc012('0x32')](_0x29c067[_0xc012('0x34')],qs['fields'](_0xc1cb7f[_0xc012('0x30')][_0xc012('0x43')]));_0x492ee7[_0xc012('0x31')]=_0x492ee7[_0xc012('0x31')][_0xc012('0x33')]?_0x492ee7[_0xc012('0x31')]:_0x29c067['model'];if(_0xc1cb7f[_0xc012('0x30')][_0xc012('0x3e')]){_0x492ee7[_0xc012('0x44')]=[{'all':!![]}];}_0x492ee7=_[_0xc012('0x3c')]({},_0x492ee7,_0xc1cb7f[_0xc012('0x45')]);return db[_0xc012('0x2c')][_0xc012('0x46')](_0x492ee7)[_0xc012('0x25')](handleEntityNotFound(_0x5d4ab8,null))[_0xc012('0x25')](respondWithResult(_0x5d4ab8,null))[_0xc012('0x40')](handleError(_0x5d4ab8,null));};exports[_0xc012('0x47')]=function(_0x417d28,_0x897b38){return db[_0xc012('0x2c')][_0xc012('0x47')](_0x417d28[_0xc012('0x48')],{})[_0xc012('0x25')](respondWithResult(_0x897b38,0xc9))[_0xc012('0x40')](handleError(_0x897b38,null));};exports[_0xc012('0x23')]=function(_0x2499fd,_0x29153f){if(_0x2499fd[_0xc012('0x48')]['id']){delete _0x2499fd['body']['id'];}return db[_0xc012('0x2c')][_0xc012('0x46')]({'where':{'id':_0x2499fd[_0xc012('0x49')]['id']}})[_0xc012('0x25')](handleEntityNotFound(_0x29153f,null))[_0xc012('0x25')](saveUpdates(_0x2499fd['body'],null))[_0xc012('0x25')](respondWithResult(_0x29153f,null))[_0xc012('0x40')](handleError(_0x29153f,null));};exports[_0xc012('0x24')]=function(_0x3e9b4c,_0x1de858){return db[_0xc012('0x2c')][_0xc012('0x46')]({'where':{'id':_0x3e9b4c[_0xc012('0x49')]['id']}})['then'](handleEntityNotFound(_0x1de858,null))['then'](removeEntity(_0x1de858,null))[_0xc012('0x40')](handleError(_0x1de858,null));};exports[_0xc012('0x4a')]=function(_0x11240b,_0x2ded04){return db[_0xc012('0x2c')][_0xc012('0x4a')]()[_0xc012('0x25')](respondWithResult(_0x2ded04,null))[_0xc012('0x40')](handleError(_0x2ded04,null));}; \ No newline at end of file +var _0x9ac8=['catch','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','index','ChatTransferReport','rawAttributes','key','map','query','filters','model','attributes','fields','length','nolimit','order','sort','where','filter','type','options','includeAll','include','findAll','rows'];(function(_0x2460c6,_0x404331){var _0x45969b=function(_0xf78fae){while(--_0xf78fae){_0x2460c6['push'](_0x2460c6['shift']());}};_0x45969b(++_0x404331);}(_0x9ac8,0x1b7));var _0x89ac=function(_0x45e3a6,_0x4168d6){_0x45e3a6=_0x45e3a6-0x0;var _0x38a04a=_0x9ac8[_0x45e3a6];return _0x38a04a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x89ac('0x0'));var rimraf=require(_0x89ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89ac('0x2'));var rp=require('request-promise');var moment=require(_0x89ac('0x3'));var BPromise=require(_0x89ac('0x4'));var Mustache=require(_0x89ac('0x5'));var util=require('util');var path=require(_0x89ac('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x89ac('0x7'));var fs=require('fs');var _=require(_0x89ac('0x8'));var squel=require(_0x89ac('0x9'));var crypto=require(_0x89ac('0xa'));var jsforce=require(_0x89ac('0xb'));var deskjs=require(_0x89ac('0xc'));var toCsv=require(_0x89ac('0xd'));var querystring=require(_0x89ac('0xe'));var Papa=require(_0x89ac('0xf'));var Redis=require(_0x89ac('0x10'));var authService=require(_0x89ac('0x11'));var qs=require(_0x89ac('0x12'));var as=require(_0x89ac('0x13'));var hardwareService=require(_0x89ac('0x14'));var logger=require(_0x89ac('0x15'))(_0x89ac('0x16'));var utils=require(_0x89ac('0x17'));var config=require(_0x89ac('0x18'));var licenseUtil=require(_0x89ac('0x19'));var db=require(_0x89ac('0x1a'))['db'];function respondWithStatusCode(_0x3d9a6a,_0x30eced){_0x30eced=_0x30eced||0xcc;return function(_0x4fa79a){if(_0x4fa79a){return _0x3d9a6a[_0x89ac('0x1b')](_0x30eced);}return _0x3d9a6a[_0x89ac('0x1c')](_0x30eced)[_0x89ac('0x1d')]();};}function respondWithResult(_0x5d1354,_0x13a2cb){_0x13a2cb=_0x13a2cb||0xc8;return function(_0x189c4f){if(_0x189c4f){return _0x5d1354[_0x89ac('0x1c')](_0x13a2cb)[_0x89ac('0x1e')](_0x189c4f);}};}function respondWithFilteredResult(_0x40b17e,_0x5c84c7){return function(_0x21418c){if(_0x21418c){var _0x55e449=_0x21418c[_0x89ac('0x1f')],_0x5de032=_0x5c84c7[_0x89ac('0x20')],_0x134bf6=_0x5c84c7[_0x89ac('0x20')]+_0x5c84c7[_0x89ac('0x21')],_0x27abf7;if(_0x134bf6>=_0x55e449){_0x134bf6=_0x55e449;_0x27abf7=0xc8;}else{_0x27abf7=0xce;}_0x40b17e[_0x89ac('0x1c')](_0x27abf7);return _0x40b17e['set'](_0x89ac('0x22'),_0x5de032+'-'+_0x134bf6+'/'+_0x55e449)[_0x89ac('0x1e')](_0x21418c);}return null;};}function patchUpdates(_0x24e515){return function(_0x113647){try{jsonpatch['apply'](_0x113647,_0x24e515,!![]);}catch(_0x3bdedb){return BPromise[_0x89ac('0x23')](_0x3bdedb);}return _0x113647[_0x89ac('0x24')]();};}function saveUpdates(_0x51bd55,_0x5c4c09){return function(_0x343a5c){if(_0x343a5c){return _0x343a5c[_0x89ac('0x25')](_0x51bd55)[_0x89ac('0x26')](function(_0x5267a8){return _0x5267a8;});}return null;};}function removeEntity(_0x2f28e3,_0x30c831){return function(_0x60be9d){if(_0x60be9d){return _0x60be9d[_0x89ac('0x27')]()[_0x89ac('0x26')](function(){_0x2f28e3[_0x89ac('0x1c')](0xcc)[_0x89ac('0x1d')]();});}};}function handleEntityNotFound(_0x33280d,_0x3683e5){return function(_0x277b7f){if(!_0x277b7f){_0x33280d[_0x89ac('0x1b')](0x194);}return _0x277b7f;};}function handleError(_0x3e0e64,_0x398fe5){_0x398fe5=_0x398fe5||0x1f4;return function(_0x5d95e1){logger[_0x89ac('0x28')](_0x5d95e1[_0x89ac('0x29')]);if(_0x5d95e1[_0x89ac('0x2a')]){delete _0x5d95e1[_0x89ac('0x2a')];}_0x3e0e64[_0x89ac('0x1c')](_0x398fe5)['send'](_0x5d95e1);};}exports[_0x89ac('0x2b')]=function(_0x2f88bd,_0x17353c){var _0x27d9eb={},_0x49cc75={},_0x9bdf78={'count':0x0,'rows':[]};var _0x39dd93=_['map'](db[_0x89ac('0x2c')][_0x89ac('0x2d')],function(_0x3d2e83){return{'name':_0x3d2e83['fieldName'],'type':_0x3d2e83['type'][_0x89ac('0x2e')]};});_0x49cc75['model']=_[_0x89ac('0x2f')](_0x39dd93,_0x89ac('0x2a'));_0x49cc75[_0x89ac('0x30')]=_['keys'](_0x2f88bd['query']);_0x49cc75[_0x89ac('0x31')]=_['intersection'](_0x49cc75[_0x89ac('0x32')],_0x49cc75['query']);_0x27d9eb[_0x89ac('0x33')]=_['intersection'](_0x49cc75[_0x89ac('0x32')],qs[_0x89ac('0x34')](_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x34')]));_0x27d9eb[_0x89ac('0x33')]=_0x27d9eb[_0x89ac('0x33')][_0x89ac('0x35')]?_0x27d9eb[_0x89ac('0x33')]:_0x49cc75[_0x89ac('0x32')];if(!_0x2f88bd[_0x89ac('0x30')]['hasOwnProperty'](_0x89ac('0x36'))){_0x27d9eb[_0x89ac('0x21')]=qs[_0x89ac('0x21')](_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x21')]);_0x27d9eb[_0x89ac('0x20')]=qs['offset'](_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x20')]);}_0x27d9eb[_0x89ac('0x37')]=qs[_0x89ac('0x38')](_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x38')]);_0x27d9eb[_0x89ac('0x39')]=qs[_0x89ac('0x31')](_['pick'](_0x2f88bd[_0x89ac('0x30')],_0x49cc75['filters']),_0x39dd93);if(_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x3a')]){_0x27d9eb[_0x89ac('0x39')]=_['merge'](_0x27d9eb[_0x89ac('0x39')],{'$or':_[_0x89ac('0x2f')](_0x39dd93,function(_0x2f594b){if(_0x2f594b[_0x89ac('0x3b')]!=='VIRTUAL'){var _0x42924b={};_0x42924b[_0x2f594b[_0x89ac('0x2a')]]={'$like':'%'+_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x3a')]+'%'};return _0x42924b;}})});}_0x27d9eb=_['merge']({},_0x27d9eb,_0x2f88bd[_0x89ac('0x3c')]);var _0x47b9ac={'where':_0x27d9eb[_0x89ac('0x39')]};return db[_0x89ac('0x2c')][_0x89ac('0x1f')](_0x47b9ac)['then'](function(_0x4cd5c9){_0x9bdf78[_0x89ac('0x1f')]=_0x4cd5c9;if(_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x3d')]){_0x27d9eb[_0x89ac('0x3e')]=[{'all':!![]}];}return db[_0x89ac('0x2c')][_0x89ac('0x3f')](_0x27d9eb);})['then'](function(_0x469637){_0x9bdf78[_0x89ac('0x40')]=_0x469637;return _0x9bdf78;})[_0x89ac('0x26')](respondWithFilteredResult(_0x17353c,_0x27d9eb))[_0x89ac('0x41')](handleError(_0x17353c,null));};exports['show']=function(_0x4dc848,_0x30b235){var _0x156b3d={'raw':!![],'where':{'id':_0x4dc848[_0x89ac('0x42')]['id']}},_0x5aac6d={};_0x5aac6d[_0x89ac('0x32')]=_[_0x89ac('0x43')](db[_0x89ac('0x2c')][_0x89ac('0x2d')]);_0x5aac6d[_0x89ac('0x30')]=_[_0x89ac('0x43')](_0x4dc848[_0x89ac('0x30')]);_0x5aac6d[_0x89ac('0x31')]=_['intersection'](_0x5aac6d[_0x89ac('0x32')],_0x5aac6d[_0x89ac('0x30')]);_0x156b3d[_0x89ac('0x33')]=_['intersection'](_0x5aac6d[_0x89ac('0x32')],qs[_0x89ac('0x34')](_0x4dc848['query'][_0x89ac('0x34')]));_0x156b3d[_0x89ac('0x33')]=_0x156b3d[_0x89ac('0x33')][_0x89ac('0x35')]?_0x156b3d[_0x89ac('0x33')]:_0x5aac6d[_0x89ac('0x32')];if(_0x4dc848[_0x89ac('0x30')]['includeAll']){_0x156b3d['include']=[{'all':!![]}];}_0x156b3d=_['merge']({},_0x156b3d,_0x4dc848[_0x89ac('0x3c')]);return db[_0x89ac('0x2c')][_0x89ac('0x44')](_0x156b3d)[_0x89ac('0x26')](handleEntityNotFound(_0x30b235,null))['then'](respondWithResult(_0x30b235,null))[_0x89ac('0x41')](handleError(_0x30b235,null));};exports[_0x89ac('0x45')]=function(_0x20ed39,_0x211a87){return db[_0x89ac('0x2c')][_0x89ac('0x45')](_0x20ed39[_0x89ac('0x46')],{})['then'](respondWithResult(_0x211a87,0xc9))[_0x89ac('0x41')](handleError(_0x211a87,null));};exports['update']=function(_0x4d80a8,_0x1b038c){if(_0x4d80a8[_0x89ac('0x46')]['id']){delete _0x4d80a8['body']['id'];}return db[_0x89ac('0x2c')][_0x89ac('0x44')]({'where':{'id':_0x4d80a8[_0x89ac('0x42')]['id']}})[_0x89ac('0x26')](handleEntityNotFound(_0x1b038c,null))[_0x89ac('0x26')](saveUpdates(_0x4d80a8[_0x89ac('0x46')],null))[_0x89ac('0x26')](respondWithResult(_0x1b038c,null))[_0x89ac('0x41')](handleError(_0x1b038c,null));};exports[_0x89ac('0x27')]=function(_0x300993,_0x1fc640){return db[_0x89ac('0x2c')][_0x89ac('0x44')]({'where':{'id':_0x300993[_0x89ac('0x42')]['id']}})[_0x89ac('0x26')](handleEntityNotFound(_0x1fc640,null))[_0x89ac('0x26')](removeEntity(_0x1fc640,null))[_0x89ac('0x41')](handleError(_0x1fc640,null));};exports[_0x89ac('0x47')]=function(_0x2705dd,_0x5d1c9e){return db[_0x89ac('0x2c')][_0x89ac('0x47')]()[_0x89ac('0x26')](respondWithResult(_0x5d1c9e,null))[_0x89ac('0x41')](handleError(_0x5d1c9e,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 7dd4c5a..1b1f1aa 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 _0x4323=['define','ChatTransferReport','report_chat_transfer','uniqueid','util','api','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0x4323,0x1cc));var _0x3432=function(_0x73a1c5,_0x50ce98){_0x73a1c5=_0x73a1c5-0x0;var _0x403ed4=_0x4323[_0x73a1c5];return _0x403ed4;};'use strict';var _=require('lodash');var util=require(_0x3432('0x0'));var logger=require('../../config/logger')(_0x3432('0x1'));var moment=require('moment');var BPromise=require(_0x3432('0x2'));var rp=require(_0x3432('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3432('0x4'));var config=require(_0x3432('0x5'));var attributes=require(_0x3432('0x6'));module[_0x3432('0x7')]=function(_0x2875c5,_0x19af6a){return _0x2875c5[_0x3432('0x8')](_0x3432('0x9'),attributes,{'tableName':_0x3432('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3432('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x23cc=['lodash','util','../../config/logger','bluebird','path','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid'];(function(_0x5d340a,_0x2441da){var _0x435564=function(_0x16f6d4){while(--_0x16f6d4){_0x5d340a['push'](_0x5d340a['shift']());}};_0x435564(++_0x2441da);}(_0x23cc,0x15e));var _0xc23c=function(_0xd1cd6f,_0x52e6e1){_0xd1cd6f=_0xd1cd6f-0x0;var _0x45f75a=_0x23cc[_0xd1cd6f];return _0x45f75a;};'use strict';var _=require(_0xc23c('0x0'));var util=require(_0xc23c('0x1'));var logger=require(_0xc23c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc23c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc23c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc23c('0x5'));module[_0xc23c('0x6')]=function(_0x40b26e,_0x51cea8){return _0x40b26e[_0xc23c('0x7')](_0xc23c('0x8'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xc23c('0x9'),'fields':[_0xc23c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 0318523..18caa71 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 _0x25bf=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4cb8d8,_0x3d1fc0){var _0x5e2ec2=function(_0x714b57){while(--_0x714b57){_0x4cb8d8['push'](_0x4cb8d8['shift']());}};_0x5e2ec2(++_0x3d1fc0);}(_0x25bf,0xce));var _0xf25b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x25bf[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf25b('0x0'));var util=require(_0xf25b('0x1'));var moment=require(_0xf25b('0x2'));var BPromise=require(_0xf25b('0x3'));var rs=require(_0xf25b('0x4'));var fs=require('fs');var Redis=require(_0xf25b('0x5'));var db=require(_0xf25b('0x6'))['db'];var utils=require(_0xf25b('0x7'));var logger=require('../../config/logger')(_0xf25b('0x8'));var config=require(_0xf25b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf25b('0xa')][_0xf25b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f5fec,_0x1bb65b,_0x3f3d3d){return new BPromise(function(_0x1f0450,_0x34b86a){return client[_0xf25b('0xc')](_0x2f5fec,_0x3f3d3d)[_0xf25b('0xd')](function(_0x395bc4){logger['info'](_0xf25b('0xe'),_0x1bb65b,_0xf25b('0xf'));logger[_0xf25b('0x10')](_0xf25b('0x11'),_0x1bb65b,_0xf25b('0xf'),JSON[_0xf25b('0x12')](_0x395bc4));if(_0x395bc4[_0xf25b('0x13')]){if(_0x395bc4[_0xf25b('0x13')][_0xf25b('0x14')]===0x1f4){logger[_0xf25b('0x13')](_0xf25b('0xe'),_0x1bb65b,_0x395bc4[_0xf25b('0x13')]['message']);return _0x34b86a(_0x395bc4[_0xf25b('0x13')]['message']);}logger[_0xf25b('0x13')](_0xf25b('0xe'),_0x1bb65b,_0x395bc4['error'][_0xf25b('0x15')]);return _0x1f0450(_0x395bc4[_0xf25b('0x13')]['message']);}else{logger[_0xf25b('0x16')]('ChatTransferReport,\x20%s,\x20%s',_0x1bb65b,'request\x20sent');_0x1f0450(_0x395bc4[_0xf25b('0x17')]['message']);}})[_0xf25b('0x18')](function(_0x572a23){logger['error'](_0xf25b('0xe'),_0x1bb65b,_0x572a23);_0x34b86a(_0x572a23);});});} \ No newline at end of file +var _0x9715=['stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x9715,0xf6));var _0x5971=function(_0x97def9,_0x320c56){_0x97def9=_0x97def9-0x0;var _0x53c5ad=_0x9715[_0x97def9];return _0x53c5ad;};'use strict';var _=require(_0x5971('0x0'));var util=require(_0x5971('0x1'));var moment=require('moment');var BPromise=require(_0x5971('0x2'));var rs=require(_0x5971('0x3'));var fs=require('fs');var Redis=require(_0x5971('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5971('0x5'))(_0x5971('0x6'));var config=require(_0x5971('0x7'));var jayson=require(_0x5971('0x8'));var client=jayson['client'][_0x5971('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d350c,_0x25b21b,_0x18f885){return new BPromise(function(_0x38c112,_0x18e3f3){return client['request'](_0x2d350c,_0x18f885)['then'](function(_0x35a49c){logger[_0x5971('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x25b21b,_0x5971('0xb'));logger[_0x5971('0xc')](_0x5971('0xd'),_0x25b21b,'request\x20sent',JSON[_0x5971('0xe')](_0x35a49c));if(_0x35a49c[_0x5971('0xf')]){if(_0x35a49c[_0x5971('0xf')][_0x5971('0x10')]===0x1f4){logger['error'](_0x5971('0x11'),_0x25b21b,_0x35a49c['error'][_0x5971('0x12')]);return _0x18e3f3(_0x35a49c[_0x5971('0xf')][_0x5971('0x12')]);}logger[_0x5971('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x25b21b,_0x35a49c['error'][_0x5971('0x12')]);return _0x38c112(_0x35a49c['error'][_0x5971('0x12')]);}else{logger[_0x5971('0xa')](_0x5971('0x11'),_0x25b21b,_0x5971('0xb'));_0x38c112(_0x35a49c[_0x5971('0x13')][_0x5971('0x12')]);}})['catch'](function(_0x3baeef){logger[_0x5971('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x25b21b,_0x3baeef);_0x18e3f3(_0x3baeef);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index dc587dc..a71c33b 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 _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x388b14,_0x3ea559){var _0x523e9e=function(_0x5931c3){while(--_0x5931c3){_0x388b14['push'](_0x388b14['shift']());}};_0x523e9e(++_0x3ea559);}(_0x2032,0xd9));var _0x2203=function(_0x56dd25,_0x34e376){_0x56dd25=_0x56dd25-0x0;var _0x41dfee=_0x2032[_0x56dd25];return _0x41dfee;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3b8774,_0x301a46){var _0x5bcfcc=function(_0x5d9d2f){while(--_0x5d9d2f){_0x3b8774['push'](_0x3b8774['shift']());}};_0x5bcfcc(++_0x301a46);}(_0xb10b,0x12a));var _0xbb10=function(_0x50a51e,_0x56e813){_0x50a51e=_0x50a51e-0x0;var _0x8a736e=_0xb10b[_0x50a51e];return _0x8a736e;};'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('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index e3b563b..a56eddd 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 _0x024a=['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}}','website_alias','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message','Skip','Feedback','star','input','name','text','getDataValue','parse','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate'];(function(_0x1b620f,_0x4ff738){var _0x3ea99b=function(_0x3e03d){while(--_0x3e03d){_0x1b620f['push'](_0x1b620f['shift']());}};_0x3ea99b(++_0x4ff738);}(_0x024a,0x1b3));var _0xa024=function(_0x5e927d,_0x30391b){_0x5e927d=_0x5e927d-0x0;var _0x322acd=_0x024a[_0x5e927d];return _0x322acd;};'use strict';var Sequelize=require(_0xa024('0x0'));var rs=require('randomstring');module[_0xa024('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xa024('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xa024('0x3')},'key':{'type':Sequelize[_0xa024('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xa024('0x4')},'customerAlias':{'type':Sequelize[_0xa024('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa024('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa024('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa024('0x2')],'allowNull':![],'defaultValue':_0xa024('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa024('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa024('0x2')]},'animation':{'type':Sequelize[_0xa024('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xa024('0x9')](_0xa024('0xa'),_0xa024('0xb')),'defaultValue':_0xa024('0xa')},'header_online':{'type':Sequelize[_0xa024('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xa024('0xc')},'offline_chat_button':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xa024('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa024('0xf')]},'closingQuestion':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xa024('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xa024('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa024('0x12')},'closingMessage':{'type':Sequelize[_0xa024('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0xd')},'skipMessageButton':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0x14')},'ratingType':{'type':Sequelize[_0xa024('0x9')](_0xa024('0x15'),'thumb'),'defaultValue':_0xa024('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa024('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa024('0x16'),'variable':null,'config':{'placeholder':_0xa024('0x17'),'type':_0xa024('0x18'),'required':!![]},'props':{'title':_0xa024('0x17'),'helpText':''}},{'type':_0xa024('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xa024('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa024('0x19')]('onlineForm')?JSON[_0xa024('0x1a')](this[_0xa024('0x19')](_0xa024('0x1b'))):{};},'set':function(_0x4b6bab){return this[_0xa024('0x1c')]('onlineForm',JSON[_0xa024('0x1d')](_0x4b6bab));}},'offlineForm':{'type':Sequelize[_0xa024('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa024('0x16'),'props':{'title':_0xa024('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xa024('0x3'),'type':'email'},'variable':null},{'type':_0xa024('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':_0xa024('0x1f'),'helpText':_0xa024('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xa024('0x19')](_0xa024('0x21'))?JSON[_0xa024('0x1a')](this['getDataValue'](_0xa024('0x21'))):{};},'set':function(_0x52202a){return this['setDataValue']('offlineForm',JSON['stringify'](_0x52202a));}},'token':{'type':Sequelize[_0xa024('0x2')],'defaultValue':function(){return rs[_0xa024('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xa024('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa024('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0x25')},'offlineMessageBody':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0x27')},'skipUnmanaged':{'type':Sequelize[_0xa024('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa024('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa024('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa024('0xf')],'defaultValue':function(){return _0xa024('0x28');}},'notificationSound':{'type':Sequelize[_0xa024('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xa024('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xa024('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xa024('0x2')],'defaultValue':_0xa024('0x2a')},'defaultTitle':{'type':Sequelize[_0xa024('0x2')]},'customerAvatar':{'type':Sequelize[_0xa024('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa024('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa024('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa024('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa024('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xa024('0x2b')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xa024('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![],'comment':_0xa024('0x2d'),'set':function(_0x77f262){if(!_0x77f262)this[_0xa024('0x1c')]('mandatoryDispositionPauseId',null);this[_0xa024('0x1c')](_0xa024('0x2e'),_0x77f262);}},'vidaooEscalation':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]},'openNewInteraction':{'type':Sequelize[_0xa024('0x8')],'defaultValue':![],'allowNull':!![]}}; \ No newline at end of file +var _0xe222=['rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','thumb','input','name','text','getDataValue','parse','onlineForm','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN'];(function(_0x2344e2,_0x23dc54){var _0x3bc43e=function(_0x38ad01){while(--_0x38ad01){_0x2344e2['push'](_0x2344e2['shift']());}};_0x3bc43e(++_0x23dc54);}(_0xe222,0x18e));var _0x2e22=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0xe222[_0x2a4fe2];return _0x225c4a;};'use strict';var Sequelize=require(_0x2e22('0x0'));var rs=require('randomstring');module[_0x2e22('0x1')]={'name':{'type':Sequelize[_0x2e22('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x2e22('0x2')],'allowNull':![],'unique':_0x2e22('0x3')},'description':{'type':Sequelize[_0x2e22('0x2')]},'mapKey':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x4')},'mapKeyOffline':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x4')},'key':{'type':Sequelize[_0x2e22('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x5')},'customerAlias':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2e22('0x2')],'allowNull':![],'defaultValue':_0x2e22('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2e22('0x2')],'allowNull':![],'defaultValue':_0x2e22('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2e22('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2e22('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2e22('0x2')]},'animation':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x2e22('0xa'),_0x2e22('0xb')),'defaultValue':_0x2e22('0xa')},'header_online':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x2e22('0xd')},'offline_chat_button':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0xe')},'header_offline':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x2e22('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2e22('0x11')]},'closingQuestion':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x14')},'noteTitle':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x15')},'closingMessage':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x16')},'closingMessageButton':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x17')},'conditionAgreement':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x18')},'ratingType':{'type':Sequelize[_0x2e22('0x19')]('star',_0x2e22('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x2e22('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2e22('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x2e22('0x1b'),'variable':null,'config':{'placeholder':_0x2e22('0x1c'),'type':_0x2e22('0x1d'),'required':!![]},'props':{'title':_0x2e22('0x1c'),'helpText':''}},{'type':_0x2e22('0x1b'),'props':{'title':_0x2e22('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x2e22('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2e22('0x1e')]('onlineForm')?JSON[_0x2e22('0x1f')](this[_0x2e22('0x1e')](_0x2e22('0x20'))):{};},'set':function(_0x27f94b){return this[_0x2e22('0x21')](_0x2e22('0x20'),JSON['stringify'](_0x27f94b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x2e22('0x22')]({'items':[{'type':_0x2e22('0x1b'),'props':{'title':_0x2e22('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x2e22('0x4'),'type':_0x2e22('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x2e22('0x23')},'props':{'title':_0x2e22('0x23'),'helpText':_0x2e22('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x2e22('0x1e')](_0x2e22('0x25'))?JSON[_0x2e22('0x1f')](this['getDataValue']('offlineForm')):{};},'set':function(_0x598bbf){return this[_0x2e22('0x21')](_0x2e22('0x25'),JSON[_0x2e22('0x22')](_0x598bbf));}},'token':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':function(){return rs[_0x2e22('0x26')]();}},'autoclose':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2e22('0x2')]},'forwardOffline':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2e22('0x2')]},'waitingTitle':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x2e22('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x2a')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x2e22('0x17')},'sendUnmanaged':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2e22('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x2e22('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x2c')},'verticalAlignment':{'type':Sequelize[_0x2e22('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x2d')},'defaultTitle':{'type':Sequelize[_0x2e22('0x2')]},'customerAvatar':{'type':Sequelize[_0x2e22('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2e22('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2e22('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2e22('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2e22('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x2e22('0x2e')},'systemAvatar':{'type':Sequelize[_0x2e22('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2e22('0x8')],'comment':_0x2e22('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![],'comment':_0x2e22('0x30'),'set':function(_0x48d4bb){if(!_0x48d4bb)this[_0x2e22('0x21')](_0x2e22('0x31'),null);this[_0x2e22('0x21')](_0x2e22('0x32'),_0x48d4bb);}},'vidaooEscalation':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':![]},'openNewInteraction':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index c2267c3..e1fd530 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 _0x7ed1=['ChatWebsiteId','getDispositions','Disposition','include','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','order','ids','addLogo','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','existsSync','server/files/images/logos/','join','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','asc','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','version','format','browser','unknown','%s\x20%s','device','%s\x20%s\x20%s','vendor','stringify','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','from\x20is\x20mandatory','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOffline','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','forwardOfflineAddress','offlineMessageSubject','openNewInteraction','Chat','MailAccountId','NotifyMailAccount','notifyMail','addInteraction','omit','nolimit','Contact','User','fullname','internal','Tags','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','info','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','some','readFileSync','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','replace','color','textColor','addApplications','bulkCreate','findAndCountAll','priority','hasOwnProperty','getApplications','addProactiveActions','chatProactiveAction','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','http','client','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','then','destroy','ChatWebsites','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','ChatWebsite','fieldName','type','map','query','keys','filters','model','intersection','fields','attributes','limit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','params','rawAttributes','length','includeAll','find','create','body','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe'];(function(_0x1c06b8,_0x4de8b0){var _0x1ce168=function(_0x15223a){while(--_0x15223a){_0x1c06b8['push'](_0x1c06b8['shift']());}};_0x1ce168(++_0x4de8b0);}(_0x7ed1,0xc5));var _0x17ed=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7ed1[_0x8c43de];return _0xa6591b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x17ed('0x0'));var rimraf=require(_0x17ed('0x1'));var zipdir=require(_0x17ed('0x2'));var jsonpatch=require(_0x17ed('0x3'));var rp=require(_0x17ed('0x4'));var moment=require(_0x17ed('0x5'));var BPromise=require(_0x17ed('0x6'));var Mustache=require(_0x17ed('0x7'));var util=require(_0x17ed('0x8'));var path=require(_0x17ed('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x17ed('0xa'));var squel=require('squel');var crypto=require(_0x17ed('0xb'));var jsforce=require(_0x17ed('0xc'));var deskjs=require(_0x17ed('0xd'));var toCsv=require(_0x17ed('0xe'));var querystring=require(_0x17ed('0xf'));var Papa=require(_0x17ed('0x10'));var Redis=require(_0x17ed('0x11'));var authService=require(_0x17ed('0x12'));var qs=require(_0x17ed('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17ed('0x14'));var logger=require(_0x17ed('0x15'))(_0x17ed('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x17ed('0x17'));var db=require(_0x17ed('0x18'))['db'];config[_0x17ed('0x19')]=_[_0x17ed('0x1a')](config[_0x17ed('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x17ed('0x19')]));require('./chatWebsite.socket')[_0x17ed('0x1b')](socket);var jayson=require(_0x17ed('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x17ed('0x1d')]({'port':0x232a});var client9003=jayson[_0x17ed('0x1e')][_0x17ed('0x1d')]({'port':0x232b});var client9001=jayson[_0x17ed('0x1e')]['http']({'port':0x2329});function respondWithRpcPromise(_0xc149c8,_0x477580,_0x50dd8c,_0x2c3b4e){return new BPromise(function(_0x1fedab,_0x320ba7){var _0x5f1508=_0x2c3b4e||client;return _0x5f1508['request'](_0xc149c8,_0x50dd8c)['then'](function(_0xe46fdb){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x477580,_0x17ed('0x1f'));logger[_0x17ed('0x20')](_0x17ed('0x21'),_0x477580,'request\x20sent',JSON['stringify'](_0xe46fdb));if(_0xe46fdb['error']){if(_0xe46fdb[_0x17ed('0x22')][_0x17ed('0x23')]===0x1f4){logger[_0x17ed('0x22')](_0x17ed('0x24'),_0x477580,_0xe46fdb[_0x17ed('0x22')][_0x17ed('0x25')]);return _0x320ba7(_0xe46fdb[_0x17ed('0x22')]['message']);}logger[_0x17ed('0x22')](_0x17ed('0x24'),_0x477580,_0xe46fdb[_0x17ed('0x22')][_0x17ed('0x25')]);return _0x1fedab(_0xe46fdb[_0x17ed('0x22')][_0x17ed('0x25')]);}else{logger['info'](_0x17ed('0x24'),_0x477580,_0x17ed('0x1f'));_0x1fedab(_0xe46fdb[_0x17ed('0x26')][_0x17ed('0x25')]);}})[_0x17ed('0x27')](function(_0x5251d9){logger[_0x17ed('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x477580,_0x5251d9);_0x320ba7(_0x5251d9);});});}function respondWithStatusCode(_0x551a62,_0xcb5dce){_0xcb5dce=_0xcb5dce||0xcc;return function(_0x434230){if(_0x434230){return _0x551a62[_0x17ed('0x28')](_0xcb5dce);}return _0x551a62[_0x17ed('0x29')](_0xcb5dce)[_0x17ed('0x2a')]();};}function respondWithResult(_0x2786ce,_0x436e22){_0x436e22=_0x436e22||0xc8;return function(_0x179e96){if(_0x179e96){return _0x2786ce['status'](_0x436e22)[_0x17ed('0x2b')](_0x179e96);}};}function respondWithFilteredResult(_0x33e7ca,_0x16b2d8){return function(_0x516564){if(_0x516564){var _0x1ef502=_0x516564[_0x17ed('0x2c')],_0x16a0cf=_0x16b2d8[_0x17ed('0x2d')],_0x439c1a=_0x16b2d8[_0x17ed('0x2d')]+_0x16b2d8['limit'],_0x2d9f45;if(_0x439c1a>=_0x1ef502){_0x439c1a=_0x1ef502;_0x2d9f45=0xc8;}else{_0x2d9f45=0xce;}_0x33e7ca[_0x17ed('0x29')](_0x2d9f45);return _0x33e7ca['set'](_0x17ed('0x2e'),_0x16a0cf+'-'+_0x439c1a+'/'+_0x1ef502)['json'](_0x516564);}return null;};}function patchUpdates(_0x128ce7){return function(_0x151500){try{jsonpatch[_0x17ed('0x2f')](_0x151500,_0x128ce7,!![]);}catch(_0x3eab4d){return BPromise[_0x17ed('0x30')](_0x3eab4d);}return _0x151500['save']();};}function saveUpdates(_0x172e5a,_0x52180a){return function(_0x2315f9){if(_0x2315f9){return _0x2315f9[_0x17ed('0x31')](_0x172e5a)[_0x17ed('0x32')](function(_0x4e68e5){return _0x4e68e5;});}return null;};}function removeEntity(_0x5e5f99,_0x1f357c){return function(_0x1488ca){if(_0x1488ca){return _0x1488ca[_0x17ed('0x33')]()[_0x17ed('0x32')](function(){var _0x500cee=_0x1488ca['get']({'plain':!![]});var _0x26a299=_0x17ed('0x34');return db[_0x17ed('0x35')][_0x17ed('0x33')]({'where':{'type':_0x26a299,'resourceId':_0x500cee['id']}})['then'](function(){return _0x1488ca;});})[_0x17ed('0x32')](function(){_0x5e5f99[_0x17ed('0x29')](0xcc)[_0x17ed('0x2a')]();});}};}function handleEntityNotFound(_0xc2cd97,_0x5ee178){return function(_0x5db9e4){if(!_0x5db9e4){_0xc2cd97[_0x17ed('0x28')](0x194);}return _0x5db9e4;};}function handleError(_0x3e7ccc,_0x341839){_0x341839=_0x341839||0x1f4;return function(_0x5537db){logger[_0x17ed('0x22')](_0x5537db[_0x17ed('0x36')]);if(_0x5537db[_0x17ed('0x37')]){delete _0x5537db[_0x17ed('0x37')];}_0x3e7ccc[_0x17ed('0x29')](_0x341839)['send'](_0x5537db);};}exports['index']=function(_0x431d50,_0x1ce91e){var _0x1237ed={'include':[{'model':db[_0x17ed('0x38')],'as':_0x17ed('0x39')}]},_0x27a3d0={},_0xc41bd6={'count':0x0,'rows':[]};var _0x3d5333=_['map'](db[_0x17ed('0x3a')]['rawAttributes'],function(_0x503421){return{'name':_0x503421[_0x17ed('0x3b')],'type':_0x503421[_0x17ed('0x3c')]['key']};});_0x27a3d0['model']=_[_0x17ed('0x3d')](_0x3d5333,'name');_0x27a3d0[_0x17ed('0x3e')]=_[_0x17ed('0x3f')](_0x431d50[_0x17ed('0x3e')]);_0x27a3d0[_0x17ed('0x40')]=_['intersection'](_0x27a3d0[_0x17ed('0x41')],_0x27a3d0[_0x17ed('0x3e')]);_0x1237ed['attributes']=_[_0x17ed('0x42')](_0x27a3d0[_0x17ed('0x41')],qs[_0x17ed('0x43')](_0x431d50[_0x17ed('0x3e')][_0x17ed('0x43')]));_0x1237ed[_0x17ed('0x44')]=_0x1237ed[_0x17ed('0x44')]['length']?_0x1237ed[_0x17ed('0x44')]:_0x27a3d0[_0x17ed('0x41')];if(!_0x431d50[_0x17ed('0x3e')]['hasOwnProperty']('nolimit')){_0x1237ed[_0x17ed('0x45')]=qs[_0x17ed('0x45')](_0x431d50[_0x17ed('0x3e')]['limit']);_0x1237ed[_0x17ed('0x2d')]=qs[_0x17ed('0x2d')](_0x431d50[_0x17ed('0x3e')][_0x17ed('0x2d')]);}_0x1237ed['order']=qs['sort'](_0x431d50[_0x17ed('0x3e')][_0x17ed('0x46')]);_0x1237ed[_0x17ed('0x47')]=qs[_0x17ed('0x40')](_[_0x17ed('0x48')](_0x431d50['query'],_0x27a3d0['filters']),_0x3d5333);if(_0x431d50[_0x17ed('0x3e')][_0x17ed('0x49')]){_0x1237ed[_0x17ed('0x47')]=_[_0x17ed('0x4a')](_0x1237ed[_0x17ed('0x47')],{'$or':_[_0x17ed('0x3d')](_0x3d5333,function(_0x26c1d8){if(_0x26c1d8[_0x17ed('0x3c')]!==_0x17ed('0x4b')){var _0x4a042e={};_0x4a042e[_0x26c1d8['name']]={'$like':'%'+_0x431d50[_0x17ed('0x3e')][_0x17ed('0x49')]+'%'};return _0x4a042e;}})});}_0x1237ed=_[_0x17ed('0x4a')]({},_0x1237ed,_0x431d50[_0x17ed('0x4c')]);var _0xafc020={'where':_0x1237ed[_0x17ed('0x47')]};return db[_0x17ed('0x3a')][_0x17ed('0x2c')](_0xafc020)[_0x17ed('0x32')](function(_0x58c9d2){_0xc41bd6['count']=_0x58c9d2;if(_0x431d50[_0x17ed('0x3e')]['includeAll']){_0x1237ed['include']=[{'all':!![]}];}return db[_0x17ed('0x3a')][_0x17ed('0x4d')](_0x1237ed);})['then'](function(_0xe860a1){_0xc41bd6['rows']=_0xe860a1;return _0xc41bd6;})['then'](respondWithFilteredResult(_0x1ce91e,_0x1237ed))[_0x17ed('0x27')](handleError(_0x1ce91e,null));};exports['show']=function(_0x427bba,_0xa11abe){var _0x3952bc={'raw':![],'where':{'id':_0x427bba[_0x17ed('0x4e')]['id']},'include':[{'model':db[_0x17ed('0x38')],'as':_0x17ed('0x39')}]},_0x4256ac={};_0x4256ac[_0x17ed('0x41')]=_['keys'](db[_0x17ed('0x3a')][_0x17ed('0x4f')]);_0x4256ac[_0x17ed('0x3e')]=_['keys'](_0x427bba[_0x17ed('0x3e')]);_0x4256ac['filters']=_['intersection'](_0x4256ac[_0x17ed('0x41')],_0x4256ac[_0x17ed('0x3e')]);_0x3952bc['attributes']=_['intersection'](_0x4256ac['model'],qs[_0x17ed('0x43')](_0x427bba['query'][_0x17ed('0x43')]));_0x3952bc[_0x17ed('0x44')]=_0x3952bc[_0x17ed('0x44')][_0x17ed('0x50')]?_0x3952bc[_0x17ed('0x44')]:_0x4256ac[_0x17ed('0x41')];if(_0x427bba[_0x17ed('0x3e')][_0x17ed('0x51')]){_0x3952bc['include']=[{'all':!![]}];}_0x3952bc=_[_0x17ed('0x4a')]({},_0x3952bc,_0x427bba[_0x17ed('0x4c')]);return db['ChatWebsite'][_0x17ed('0x52')](_0x3952bc)[_0x17ed('0x32')](handleEntityNotFound(_0xa11abe,null))[_0x17ed('0x32')](respondWithResult(_0xa11abe,null))[_0x17ed('0x27')](handleError(_0xa11abe,null));};exports['create']=function(_0x35359e,_0x25a5d9){return db[_0x17ed('0x3a')][_0x17ed('0x53')](_0x35359e[_0x17ed('0x54')],{})[_0x17ed('0x32')](function(_0x3828ec){var _0x10d7c1=_0x35359e[_0x17ed('0x55')][_0x17ed('0x56')]({'plain':!![]});if(!_0x10d7c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10d7c1['role']==='user'){var _0x2c7ea6=_0x3828ec['get']({'plain':!![]});var _0x2589d2=_0x17ed('0x34');return db['UserProfileSection'][_0x17ed('0x52')]({'where':{'name':_0x2589d2,'userProfileId':_0x10d7c1['userProfileId']},'raw':!![]})[_0x17ed('0x32')](function(_0x1fb173){if(_0x1fb173&&_0x1fb173[_0x17ed('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x2c7ea6[_0x17ed('0x37')],'resourceId':_0x2c7ea6['id'],'type':_0x1fb173[_0x17ed('0x37')],'sectionId':_0x1fb173['id']},{})[_0x17ed('0x32')](function(){return _0x3828ec;});}else{return _0x3828ec;}})[_0x17ed('0x27')](function(_0x342954){logger[_0x17ed('0x22')](_0x17ed('0x58'),_0x342954);throw _0x342954;});}return _0x3828ec;})[_0x17ed('0x32')](respondWithResult(_0x25a5d9,0xc9))[_0x17ed('0x27')](handleError(_0x25a5d9,null));};exports[_0x17ed('0x31')]=function(_0x1365a6,_0x50fe58){if(_0x1365a6[_0x17ed('0x54')]['id']){delete _0x1365a6['body']['id'];}return db['ChatWebsite'][_0x17ed('0x52')]({'where':{'id':_0x1365a6[_0x17ed('0x4e')]['id']},'include':[{'model':db[_0x17ed('0x38')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x50fe58,null))[_0x17ed('0x32')](saveUpdates(_0x1365a6['body'],null))['then'](respondWithResult(_0x50fe58,null))[_0x17ed('0x27')](handleError(_0x50fe58,null));};exports[_0x17ed('0x33')]=function(_0x197d2d,_0x1d3f40){return db[_0x17ed('0x3a')][_0x17ed('0x52')]({'where':{'id':_0x197d2d['params']['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x1d3f40,null))['then'](removeEntity(_0x1d3f40,null))[_0x17ed('0x27')](handleError(_0x1d3f40,null));};exports[_0x17ed('0x59')]=function(_0x2baad8,_0x451465){return db[_0x17ed('0x3a')][_0x17ed('0x59')]()['then'](respondWithResult(_0x451465,null))[_0x17ed('0x27')](handleError(_0x451465,null));};exports['addDisposition']=function(_0x383bb8,_0x50f619,_0x245348){if(_0x383bb8[_0x17ed('0x54')]['id']){delete _0x383bb8[_0x17ed('0x54')]['id'];}return db[_0x17ed('0x3a')][_0x17ed('0x52')]({'where':{'id':_0x383bb8[_0x17ed('0x4e')]['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x50f619,null))[_0x17ed('0x32')](function(_0x209322){if(_0x209322){_0x383bb8['body'][_0x17ed('0x5a')]=_0x209322['id'];return db['Disposition'][_0x17ed('0x53')](_0x383bb8['body']);}})['then'](respondWithResult(_0x50f619,null))[_0x17ed('0x27')](handleError(_0x50f619,null));};exports[_0x17ed('0x5b')]=function(_0x38febc,_0x51d0ee,_0x1de729){var _0x337434={'raw':![],'where':{}};var _0xdfa797={};var _0x448568={'count':0x0,'rows':[]};return db[_0x17ed('0x3a')]['findOne']({'where':{'id':_0x38febc[_0x17ed('0x4e')]['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x51d0ee,null))[_0x17ed('0x32')](function(_0x2e800f){if(_0x2e800f){_0xdfa797[_0x17ed('0x41')]=_[_0x17ed('0x3f')](db[_0x17ed('0x5c')][_0x17ed('0x4f')]);_0xdfa797[_0x17ed('0x3e')]=_[_0x17ed('0x3f')](_0x38febc[_0x17ed('0x3e')]);_0xdfa797[_0x17ed('0x40')]=_['intersection'](_0xdfa797[_0x17ed('0x41')],_0xdfa797[_0x17ed('0x3e')]);_0x337434['attributes']=_['intersection'](_0xdfa797[_0x17ed('0x41')],qs[_0x17ed('0x43')](_0x38febc['query'][_0x17ed('0x43')]));_0x337434[_0x17ed('0x44')]=_0x337434[_0x17ed('0x44')][_0x17ed('0x50')]?_0x337434['attributes']:_0xdfa797[_0x17ed('0x41')];if(!_0x38febc[_0x17ed('0x3e')]['hasOwnProperty']('nolimit')){_0x337434[_0x17ed('0x45')]=qs[_0x17ed('0x45')](_0x38febc[_0x17ed('0x3e')]['limit']);_0x337434[_0x17ed('0x2d')]=qs[_0x17ed('0x2d')](_0x38febc[_0x17ed('0x3e')][_0x17ed('0x2d')]);}_0x337434['order']=qs[_0x17ed('0x46')](_0x38febc[_0x17ed('0x3e')][_0x17ed('0x46')]);_0x337434[_0x17ed('0x47')]=qs[_0x17ed('0x40')](_['pick'](_0x38febc[_0x17ed('0x3e')],_0xdfa797['filters']));_0x337434[_0x17ed('0x47')][_0x17ed('0x5a')]=_0x2e800f['id'];if(_0x38febc['query'][_0x17ed('0x49')]){_0x337434[_0x17ed('0x47')]=_[_0x17ed('0x4a')](_0x337434[_0x17ed('0x47')],{'$or':_[_0x17ed('0x3d')](_0x337434['attributes'],function(_0x502590){var _0x1527f3={};_0x1527f3[_0x502590]={'$like':'%'+_0x38febc['query'][_0x17ed('0x49')]+'%'};return _0x1527f3;})});}_0x337434=_['merge']({},_0x337434,_0x38febc['options']);return db[_0x17ed('0x5c')][_0x17ed('0x2c')]({'where':_0x337434[_0x17ed('0x47')]})['then'](function(_0x40105e){_0x448568[_0x17ed('0x2c')]=_0x40105e;if(_0x38febc[_0x17ed('0x3e')][_0x17ed('0x51')]){_0x337434[_0x17ed('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0x17ed('0x4d')](_0x337434);})[_0x17ed('0x32')](function(_0x2d975d){_0x448568[_0x17ed('0x5e')]=_0x2d975d;return _0x448568;});}})[_0x17ed('0x32')](respondWithFilteredResult(_0x51d0ee,_0x337434))[_0x17ed('0x27')](handleError(_0x51d0ee,null));};exports[_0x17ed('0x5f')]=function(_0xfc7e45,_0x15096d,_0x4640f7){return db['ChatWebsite']['find']({'where':{'id':_0xfc7e45[_0x17ed('0x4e')]['id']}})['then'](handleEntityNotFound(_0x15096d,null))[_0x17ed('0x32')](function(_0x346402){if(_0x346402){return _0x346402[_0x17ed('0x5f')](_0xfc7e45[_0x17ed('0x3e')]['ids']);}})[_0x17ed('0x32')](respondWithStatusCode(_0x15096d,null))[_0x17ed('0x27')](handleError(_0x15096d,null));};exports[_0x17ed('0x60')]=function(_0x32f520,_0x4f1156,_0xc49d50){if(_0x32f520[_0x17ed('0x54')]['id']){delete _0x32f520[_0x17ed('0x54')]['id'];}return db[_0x17ed('0x3a')][_0x17ed('0x52')]({'where':{'id':_0x32f520['params']['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x4f1156,null))[_0x17ed('0x32')](function(_0xe593b7){if(_0xe593b7){_0x32f520[_0x17ed('0x54')][_0x17ed('0x5a')]=_0xe593b7['id'];return db[_0x17ed('0x61')][_0x17ed('0x53')](_0x32f520['body']);}})[_0x17ed('0x32')](respondWithResult(_0x4f1156,null))[_0x17ed('0x27')](handleError(_0x4f1156,null));};exports[_0x17ed('0x62')]=function(_0x462b31,_0x3af1ff,_0x11b189){var _0x4340e1={'raw':![],'where':{}};var _0x36e6d8={};var _0x3554cc={'count':0x0,'rows':[]};return db[_0x17ed('0x3a')][_0x17ed('0x63')]({'where':{'id':_0x462b31[_0x17ed('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3af1ff,null))[_0x17ed('0x32')](function(_0x1c6d16){if(_0x1c6d16){_0x36e6d8[_0x17ed('0x41')]=_['keys'](db['CannedAnswer'][_0x17ed('0x4f')]);_0x36e6d8[_0x17ed('0x3e')]=_['keys'](_0x462b31[_0x17ed('0x3e')]);_0x36e6d8[_0x17ed('0x40')]=_['intersection'](_0x36e6d8[_0x17ed('0x41')],_0x36e6d8[_0x17ed('0x3e')]);_0x4340e1[_0x17ed('0x44')]=_[_0x17ed('0x42')](_0x36e6d8[_0x17ed('0x41')],qs['fields'](_0x462b31[_0x17ed('0x3e')][_0x17ed('0x43')]));_0x4340e1[_0x17ed('0x44')]=_0x4340e1[_0x17ed('0x44')][_0x17ed('0x50')]?_0x4340e1['attributes']:_0x36e6d8['model'];if(!_0x462b31['query']['hasOwnProperty']('nolimit')){_0x4340e1['limit']=qs['limit'](_0x462b31['query'][_0x17ed('0x45')]);_0x4340e1[_0x17ed('0x2d')]=qs[_0x17ed('0x2d')](_0x462b31[_0x17ed('0x3e')][_0x17ed('0x2d')]);}_0x4340e1[_0x17ed('0x64')]=qs[_0x17ed('0x46')](_0x462b31[_0x17ed('0x3e')]['sort']);_0x4340e1[_0x17ed('0x47')]=qs[_0x17ed('0x40')](_[_0x17ed('0x48')](_0x462b31[_0x17ed('0x3e')],_0x36e6d8['filters']));_0x4340e1[_0x17ed('0x47')]['ChatWebsiteId']=_0x1c6d16['id'];if(_0x462b31[_0x17ed('0x3e')]['filter']){_0x4340e1[_0x17ed('0x47')]=_[_0x17ed('0x4a')](_0x4340e1[_0x17ed('0x47')],{'$or':_[_0x17ed('0x3d')](_0x4340e1[_0x17ed('0x44')],function(_0x27333f){var _0x212d56={};_0x212d56[_0x27333f]={'$like':'%'+_0x462b31[_0x17ed('0x3e')]['filter']+'%'};return _0x212d56;})});}_0x4340e1=_[_0x17ed('0x4a')]({},_0x4340e1,_0x462b31['options']);return db['CannedAnswer'][_0x17ed('0x2c')]({'where':_0x4340e1['where']})[_0x17ed('0x32')](function(_0x4d48c6){_0x3554cc[_0x17ed('0x2c')]=_0x4d48c6;if(_0x462b31[_0x17ed('0x3e')][_0x17ed('0x51')]){_0x4340e1['include']=[{'all':!![]}];}return db[_0x17ed('0x61')][_0x17ed('0x4d')](_0x4340e1);})[_0x17ed('0x32')](function(_0x13406b){_0x3554cc['rows']=_0x13406b;return _0x3554cc;});}})[_0x17ed('0x32')](respondWithFilteredResult(_0x3af1ff,_0x4340e1))[_0x17ed('0x27')](handleError(_0x3af1ff,null));};exports['removeAnswers']=function(_0x8a9323,_0x51a939,_0x5bed6f){return db['ChatWebsite'][_0x17ed('0x52')]({'where':{'id':_0x8a9323[_0x17ed('0x4e')]['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x51a939,null))['then'](function(_0x2892c3){if(_0x2892c3){return _0x2892c3['removeAnswers'](_0x8a9323['query'][_0x17ed('0x65')]);}})[_0x17ed('0x32')](respondWithStatusCode(_0x51a939,null))[_0x17ed('0x27')](handleError(_0x51a939,null));};exports[_0x17ed('0x66')]=function(_0x2a0c1f,_0x1ae97c,_0xe5b180){_0x2a0c1f[_0x17ed('0x54')]['sitepic']=_0x2a0c1f[_0x17ed('0x67')][_0x17ed('0x68')];return db[_0x17ed('0x3a')][_0x17ed('0x52')]({'where':{'id':_0x2a0c1f[_0x17ed('0x4e')]['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x1ae97c,null))[_0x17ed('0x32')](saveUpdates(_0x2a0c1f['body'],null))[_0x17ed('0x32')](respondWithResult(_0x1ae97c,null))[_0x17ed('0x27')](handleError(_0x1ae97c,null));};exports[_0x17ed('0x69')]=function(_0x44df7e,_0x1a902e,_0x21f83c){_0x44df7e[_0x17ed('0x54')][_0x17ed('0x6a')]=_0x44df7e['file'][_0x17ed('0x68')];return db[_0x17ed('0x3a')][_0x17ed('0x52')]({'where':{'id':_0x44df7e[_0x17ed('0x4e')]['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x1a902e,null))['then'](saveUpdates(_0x44df7e[_0x17ed('0x54')],null))[_0x17ed('0x32')](respondWithResult(_0x1a902e,null))[_0x17ed('0x27')](handleError(_0x1a902e,null));};exports['addCustomerAvatar']=function(_0x52b950,_0x2d396f,_0x37d447){_0x52b950[_0x17ed('0x54')][_0x17ed('0x6b')]=_0x52b950[_0x17ed('0x67')]['filename'];return db[_0x17ed('0x3a')][_0x17ed('0x52')]({'where':{'id':_0x52b950['params']['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x2d396f,null))[_0x17ed('0x32')](saveUpdates(_0x52b950[_0x17ed('0x54')],null))[_0x17ed('0x32')](respondWithResult(_0x2d396f,null))[_0x17ed('0x27')](handleError(_0x2d396f,null));};exports[_0x17ed('0x6c')]=function(_0x40a9de,_0x102b10,_0x356bef){_0x40a9de[_0x17ed('0x54')]['systemAvatar']=_0x40a9de[_0x17ed('0x67')][_0x17ed('0x68')];return db['ChatWebsite']['find']({'where':{'id':_0x40a9de['params']['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x102b10,null))['then'](saveUpdates(_0x40a9de[_0x17ed('0x54')],null))[_0x17ed('0x32')](respondWithResult(_0x102b10,null))[_0x17ed('0x27')](handleError(_0x102b10,null));};exports[_0x17ed('0x6d')]=function(_0x26c001,_0x5ae2e2,_0x511d5a){var _0x1075b2=path['join'](config[_0x17ed('0x6e')],_0x17ed('0x6f'));var _0x959323={'where':{'id':_0x26c001[_0x17ed('0x4e')]['id']},'attributes':['id',_0x17ed('0x70')],'raw':!![]};var _0xab2746=![];return require(_0x17ed('0x17'))[_0x17ed('0x71')]()[_0x17ed('0x32')](function(_0x5b580e){if(_0x5b580e){_0xab2746=_0x5b580e[_0x17ed('0x72')];}})['then'](function(){return db['ChatWebsite'][_0x17ed('0x52')](_0x959323);})[_0x17ed('0x32')](handleEntityNotFound(_0x5ae2e2,null))[_0x17ed('0x32')](function(_0x285d67){if(_0x285d67){if(!_[_0x17ed('0x73')](_0x285d67[_0x17ed('0x70')])){if(fs[_0x17ed('0x74')](path['join'](config[_0x17ed('0x6e')],_0x17ed('0x75'),_0x285d67['sitepic']))&&_0xab2746){_0x1075b2=path[_0x17ed('0x76')](config['root'],'server/files/images/logos/',_0x285d67[_0x17ed('0x70')]);}}return _0x5ae2e2[_0x17ed('0x77')](_0x1075b2);}})[_0x17ed('0x27')](handleError(_0x5ae2e2,null));};exports['getAvatar']=function(_0x12d927,_0x183184,_0x360d3f){var _0x5d1ac1=path['join'](config['root'],_0x17ed('0x78'));var _0x4347a3={'where':{'id':_0x12d927['params']['id']},'attributes':['id',_0x17ed('0x6a')],'raw':!![]};return db[_0x17ed('0x3a')][_0x17ed('0x52')](_0x4347a3)[_0x17ed('0x32')](handleEntityNotFound(_0x183184,null))[_0x17ed('0x32')](function(_0x2e4acb){if(_0x2e4acb){if(!_[_0x17ed('0x73')](_0x2e4acb[_0x17ed('0x6a')])){if(fs[_0x17ed('0x74')](path['join'](config[_0x17ed('0x6e')],_0x17ed('0x79'),_0x2e4acb['agentAvatar']))){_0x5d1ac1=path['join'](config[_0x17ed('0x6e')],_0x17ed('0x79'),_0x2e4acb[_0x17ed('0x6a')]);}}return _0x183184['download'](_0x5d1ac1);}})['catch'](handleError(_0x183184,null));};exports[_0x17ed('0x7a')]=function(_0x24c115,_0x3ab396,_0x1cfdd8){var _0x3ca47e=path['join'](config[_0x17ed('0x6e')],_0x17ed('0x7b'));var _0x5042ef={'where':{'id':_0x24c115[_0x17ed('0x4e')]['id']},'attributes':['id','customerAvatar',_0x17ed('0x7c')],'raw':!![]};return db['ChatWebsite'][_0x17ed('0x52')](_0x5042ef)[_0x17ed('0x32')](handleEntityNotFound(_0x3ab396,null))['then'](function(_0x5a7b1e){if(_0x5a7b1e){if(!_[_0x17ed('0x73')](_0x5a7b1e[_0x17ed('0x6b')])){if(fs[_0x17ed('0x74')](path[_0x17ed('0x76')](config[_0x17ed('0x6e')],_0x17ed('0x79'),_0x5a7b1e[_0x17ed('0x6b')]))&&_0x5a7b1e[_0x17ed('0x7c')]){_0x3ca47e=path[_0x17ed('0x76')](config[_0x17ed('0x6e')],_0x17ed('0x79'),_0x5a7b1e[_0x17ed('0x6b')]);}}return _0x3ab396[_0x17ed('0x77')](_0x3ca47e);}})[_0x17ed('0x27')](handleError(_0x3ab396,null));};exports[_0x17ed('0x7d')]=function(_0x7312d,_0x53f641,_0x154f1f){var _0x23ac0d=path[_0x17ed('0x76')](config['root'],_0x17ed('0x7e'));var _0x240f99={'where':{'id':_0x7312d[_0x17ed('0x4e')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x17ed('0x3a')][_0x17ed('0x52')](_0x240f99)[_0x17ed('0x32')](handleEntityNotFound(_0x53f641,null))[_0x17ed('0x32')](function(_0x5d86f7){if(_0x5d86f7){if(!_[_0x17ed('0x73')](_0x5d86f7[_0x17ed('0x7f')])){if(fs[_0x17ed('0x74')](path[_0x17ed('0x76')](config[_0x17ed('0x6e')],_0x17ed('0x79'),_0x5d86f7[_0x17ed('0x7f')]))){_0x23ac0d=path[_0x17ed('0x76')](config[_0x17ed('0x6e')],'server/files/images/avatars/',_0x5d86f7[_0x17ed('0x7f')]);}}return _0x53f641[_0x17ed('0x77')](_0x23ac0d);}})[_0x17ed('0x27')](handleError(_0x53f641,null));};exports[_0x17ed('0x80')]=function(_0x555220,_0x4bdf53,_0x210d14){var _0x137bcd=require(_0x17ed('0x81'));var _0x61539f=new _0x137bcd();var _0x3ca0d6=_0x61539f[_0x17ed('0x82')](_0x555220['headers']['user-agent'])[_0x17ed('0x83')]();var _0x367c31={'body':_0x555220[_0x17ed('0x54')],'channel':'chat'};var _0x479cf6=[];var _0x113004=[];var _0x5ad74a={};var _0x190077=![];return db[_0x17ed('0x84')][_0x17ed('0x59')]()['then'](function(_0x343ec5){if(!_0x343ec5){throw new db[(_0x17ed('0x85'))][(_0x17ed('0x86'))](_0x17ed('0x87'));}_0x479cf6=_[_0x17ed('0x88')](_[_0x17ed('0x3f')](_0x343ec5),[_0x17ed('0x89'),_0x17ed('0x8a')]);_0x113004=_[_0x17ed('0x88')](_[_0x17ed('0x3f')](_0x343ec5),[_0x17ed('0x89'),_0x17ed('0x8a'),_0x17ed('0x8b'),_0x17ed('0x8c')]);if(_0x555220[_0x17ed('0x54')]['id']){delete _0x555220[_0x17ed('0x54')]['id'];}if(_['isNil'](_0x555220['body']['from'])){throw new db[(_0x17ed('0x85'))][(_0x17ed('0x86'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x555220[_0x17ed('0x54')][_0x17ed('0x54')])||_0x555220[_0x17ed('0x54')][_0x17ed('0x54')]===''){throw new db[(_0x17ed('0x85'))][(_0x17ed('0x86'))](_0x17ed('0x8d'));}if(_[_0x17ed('0x73')](_0x555220[_0x17ed('0x54')][_0x17ed('0x8e')])){throw new db['Sequelize']['ValidationError'](_0x17ed('0x8f')+_0x113004);}if(!_[_0x17ed('0x90')](_0x113004,_0x555220[_0x17ed('0x54')]['mapKey'])){throw new db[(_0x17ed('0x85'))][(_0x17ed('0x86'))](_0x17ed('0x91')+_0x113004);}_0x5ad74a[_0x555220['body'][_0x17ed('0x8e')]]=_0x555220['body'][_0x17ed('0x92')];})['then'](function(){return db[_0x17ed('0x3a')][_0x17ed('0x52')]({'where':{'id':_0x555220[_0x17ed('0x4e')]['id']},'include':[{'model':db[_0x17ed('0x93')],'as':_0x17ed('0x94'),'include':[{'model':db['CmContact'],'as':_0x17ed('0x95'),'where':_0x5ad74a,'limit':0x1,'order':[['updatedAt',_0x17ed('0x96')]]}]},{'model':db[_0x17ed('0x97')],'as':_0x17ed('0x98')}]});})[_0x17ed('0x32')](handleEntityNotFound(_0x4bdf53,null))[_0x17ed('0x32')](function(_0x468114){if(_0x468114&&_0x468114[_0x17ed('0x94')]){_0x367c31[_0x17ed('0x99')]=_0x468114;_0x367c31[_0x17ed('0x9a')]=_0x468114[_0x17ed('0x98')];_0x367c31['list']=_0x468114[_0x17ed('0x94')];_0x367c31['applications']=_['orderBy'](_0x367c31[_0x17ed('0x9a')],['priority'],[_0x17ed('0x9b')]);if(_0x367c31['account'][_0x17ed('0x98')]){delete _0x367c31['account'][_0x17ed('0x98')];}if(_0x367c31[_0x17ed('0x99')][_0x17ed('0x94')]&&_0x367c31['account'][_0x17ed('0x94')][_0x17ed('0x95')][_0x17ed('0x50')]){return _0x367c31[_0x17ed('0x99')][_0x17ed('0x94')][_0x17ed('0x95')][0x0];}var _0x2785c7=_['defaults'](_0x555220['body'],{'firstName':_0x555220[_0x17ed('0x54')][_0x17ed('0x92')],'ListId':_0x468114[_0x17ed('0x8c')]});_0x2785c7[_0x555220[_0x17ed('0x54')][_0x17ed('0x8e')]]=_0x555220['body']['from'];return db[_0x17ed('0x84')][_0x17ed('0x53')](_0x2785c7,{'fields':_0x479cf6,'raw':!![]});}})[_0x17ed('0x32')](handleEntityNotFound(_0x4bdf53,null))['then'](function(_0x197aba){_0x367c31['contact']=_0x197aba;var _0x570915=_0x555220['body']['customerIp'];if(_0x555220[_0x17ed('0x9c')][_0x17ed('0x9d')]){_0x570915=_0x555220[_0x17ed('0x9c')][_0x17ed('0x9d')];}else if(_0x555220[_0x17ed('0x9c')][_0x17ed('0x9e')]){_0x570915=_[_0x17ed('0x9f')](_0x555220[_0x17ed('0x9c')][_0x17ed('0x9e')][_0x17ed('0xa0')](','));}if(_0x197aba){var _0x1c5b39={'ContactId':_0x197aba['id'],'ChatWebsiteId':_0x555220[_0x17ed('0x4e')]['id'],'from':(_0x197aba[_0x17ed('0xa1')]||'')+'\x20'+(_0x197aba[_0x17ed('0xa2')]||''),'customerIp':_0x570915,'customerPort':_0x555220[_0x17ed('0x9c')]['x-real-port']?_0x555220[_0x17ed('0x9c')][_0x17ed('0xa3')]:null,'referer':_0x555220['body'][_0x17ed('0xa4')],'browserName':_0x3ca0d6['browser'][_0x17ed('0x37')]&&_0x3ca0d6['browser'][_0x17ed('0xa5')]?util[_0x17ed('0xa6')]('%s\x20%s',_0x3ca0d6[_0x17ed('0xa7')][_0x17ed('0x37')],_0x3ca0d6[_0x17ed('0xa7')][_0x17ed('0xa5')]):'unknown','browserVersion':_0x3ca0d6[_0x17ed('0xa7')]['version']||_0x17ed('0xa8'),'osName':util[_0x17ed('0xa6')](_0x17ed('0xa9'),_0x3ca0d6['os'][_0x17ed('0x37')],_0x3ca0d6['os'][_0x17ed('0xa5')]),'osVersion':_0x3ca0d6['os']['version'],'deviceModel':_0x3ca0d6[_0x17ed('0xaa')][_0x17ed('0x41')]&&_0x3ca0d6[_0x17ed('0xaa')]['vendor']?util[_0x17ed('0xa6')](_0x17ed('0xab'),_0x3ca0d6[_0x17ed('0xaa')][_0x17ed('0x41')],_0x3ca0d6[_0x17ed('0xaa')][_0x17ed('0xac')],_0x3ca0d6[_0x17ed('0xaa')][_0x17ed('0x3c')]):null,'deviceVendor':_0x3ca0d6[_0x17ed('0xaa')][_0x17ed('0xac')],'deviceType':_0x3ca0d6['device'][_0x17ed('0x3c')],'formData':JSON[_0x17ed('0xad')](_0x555220[_0x17ed('0x54')])};var _0xb6253={'ChatWebsiteId':_0x555220[_0x17ed('0x4e')]['id'],'closed':![]};if(_0x555220[_0x17ed('0x54')][_0x17ed('0xae')]){_0xb6253[_0x17ed('0xae')]=_0x555220[_0x17ed('0x54')][_0x17ed('0xae')];return db['ChatInteraction'][_0x17ed('0x52')]({'where':_0xb6253})[_0x17ed('0x32')](function(_0x594087){if(_0x594087){return[_0x594087,![]];}_0x1c5b39[_0x17ed('0xae')]=_0x555220[_0x17ed('0x54')][_0x17ed('0xae')];_0x1c5b39[_0x17ed('0xaf')]=_0x555220[_0x17ed('0x54')][_0x17ed('0xaf')];return db[_0x17ed('0xb0')][_0x17ed('0x53')](_0x1c5b39)[_0x17ed('0x32')](function(_0x41e0f0){return[_0x41e0f0,!![]];});});}_0xb6253[_0x17ed('0xb1')]=_0x197aba['id'];if(_0x555220[_0x17ed('0x54')]['interaction']&&_0x555220['body'][_0x17ed('0xb2')]['id']){_0xb6253['id']=_0x555220[_0x17ed('0x54')][_0x17ed('0xb2')]['id'];return db[_0x17ed('0xb0')][_0x17ed('0x52')]({'where':_0xb6253})[_0x17ed('0x32')](function(_0x1bbf22){if(_0x1bbf22){return[_0x1bbf22,![]];}return db[_0x17ed('0xb0')]['create'](_0x1c5b39)[_0x17ed('0x32')](function(_0x45add9){return[_0x45add9,!![]];});});}return db[_0x17ed('0xb0')]['create'](_0x1c5b39)['then'](function(_0x13d407){return[_0x13d407,!![]];});}})[_0x17ed('0xb3')](function(_0x2533cb,_0x301740){if(_0x2533cb){_0x190077=_0x301740;if(!_0x301740){var _0x17d6ce={'from':(_0x367c31[_0x17ed('0xb4')][_0x17ed('0xa1')]||'')+'\x20'+(_0x367c31[_0x17ed('0xb4')][_0x17ed('0xa2')]||'')};if(_0x555220[_0x17ed('0x54')]['threadId']&&_0x555220[_0x17ed('0x54')][_0x17ed('0xb5')]&&_0x555220[_0x17ed('0x54')][_0x17ed('0xae')]!=_0x555220[_0x17ed('0x54')][_0x17ed('0xb5')]){_0x17d6ce['threadId']=_0x555220[_0x17ed('0x54')]['messageId'];}return _0x2533cb[_0x17ed('0x31')](_0x17d6ce);}else{return _0x2533cb;}}})[_0x17ed('0x32')](function(_0xb87dd2){_0x367c31['interaction']=_0xb87dd2[_0x17ed('0x56')]({'plain':!![]});_0x367c31['interaction'][_0x17ed('0xb6')]=_0x190077;if(_0x367c31[_0x17ed('0xb2')][_0x17ed('0xb6')]){if(_0x367c31[_0x17ed('0x99')][_0x17ed('0xb7')]){_0x367c31['applications'][_0x17ed('0xb8')]({'id':0x0,'priority':_0x367c31['applications'][_0x17ed('0x50')]+0x1,'app':_0x17ed('0xb9'),'appdata':_0x17ed('0xba'),'interval':_0x17ed('0xbb')});}}return db[_0x17ed('0xbc')]['create']({'body':_0x555220[_0x17ed('0x54')][_0x17ed('0x54')],'ChatWebsiteId':_0x555220[_0x17ed('0x4e')]['id'],'ChatInteractionId':_0xb87dd2['id'],'direction':'in','ContactId':_0x367c31['contact']['id'],'AttachmentId':_0x555220[_0x17ed('0x54')]['AttachmentId']});})[_0x17ed('0x32')](function(_0x8107b5){_0x367c31['message']=_0x8107b5;if(_0x367c31['interaction'][_0x17ed('0xbd')]){return db['User'][_0x17ed('0x52')]({'attributes':['id',_0x17ed('0x37')],'where':{'id':_0x367c31[_0x17ed('0xb2')][_0x17ed('0xbd')]}})[_0x17ed('0x32')](function(_0x2d04ad){if(_0x2d04ad){_0x367c31[_0x17ed('0x9a')][_0x17ed('0xbe')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2d04ad['name']+','+(_0x367c31['account'][_0x17ed('0xbf')]||0xa),'interval':_0x17ed('0xbb')});_0x367c31[_0x17ed('0xc0')]=!![];}return respondWithRpcPromise(_0x17ed('0xc1'),_0x17ed('0xc2'),_0x367c31);});}return respondWithRpcPromise('Start',_0x17ed('0xc2'),_0x367c31);})['then'](function(_0x36c26d){respondWithRpcPromise('EventManager',_0x17ed('0xc3'),{'event':_0x17ed('0x80'),'message':_0x36c26d},client9002);return _0x36c26d;})[_0x17ed('0x32')](respondWithResult(_0x4bdf53,null))['catch'](handleError(_0x4bdf53,null));};exports['offline']=function(_0x7e2157,_0x2bdac1,_0x22763a){var _0x409b99,_0x5e63e8,_0x3d8748;var _0x1ddaa0=[];var _0x2898da=[];var _0x67d8f={};return db[_0x17ed('0x84')][_0x17ed('0x59')]()[_0x17ed('0x32')](function(_0x32aae4){if(!_0x32aae4){throw new db[(_0x17ed('0x85'))]['ValidationError'](_0x17ed('0x87'));}_0x2898da=_[_0x17ed('0x88')](_[_0x17ed('0x3f')](_0x32aae4),[_0x17ed('0x89'),_0x17ed('0x8a')]);_0x1ddaa0=_['difference'](_[_0x17ed('0x3f')](_0x32aae4),[_0x17ed('0x89'),'updatedAt','CompanyId','ListId']);if(_0x7e2157[_0x17ed('0x54')]['id']){delete _0x7e2157['body']['id'];}if(_[_0x17ed('0x73')](_0x7e2157[_0x17ed('0x54')][_0x17ed('0x92')])){throw _0x2bdac1[_0x17ed('0x29')](0x1f4)['send'](new db[(_0x17ed('0x85'))][(_0x17ed('0x86'))](_0x17ed('0xc4')));}if(_[_0x17ed('0x73')](_0x7e2157[_0x17ed('0x54')][_0x17ed('0x54')])||_0x7e2157[_0x17ed('0x54')][_0x17ed('0x54')]===''){throw _0x2bdac1[_0x17ed('0x29')](0x1f4)[_0x17ed('0xc5')](new db[(_0x17ed('0x85'))][(_0x17ed('0x86'))](_0x17ed('0x8d')));}if(_['isNil'](_0x7e2157[_0x17ed('0x54')]['mapKeyOffline'])){throw _0x2bdac1['status'](0x1f4)['send'](new db[(_0x17ed('0x85'))][(_0x17ed('0x86'))](_0x17ed('0xc6')+_0x1ddaa0));}if(!_[_0x17ed('0x90')](_0x1ddaa0,_0x7e2157[_0x17ed('0x54')][_0x17ed('0xc7')])){throw _0x2bdac1[_0x17ed('0x29')](0x1f4)[_0x17ed('0xc5')](new db[(_0x17ed('0x85'))][(_0x17ed('0x86'))](_0x17ed('0xc8')+_0x1ddaa0));}_0x67d8f[_0x7e2157[_0x17ed('0x54')][_0x17ed('0xc7')]]=_0x7e2157[_0x17ed('0x54')]['from'];})[_0x17ed('0x32')](function(){return db[_0x17ed('0x3a')][_0x17ed('0x52')]({'where':{'id':_0x7e2157[_0x17ed('0x4e')]['id']},'include':[{'model':db[_0x17ed('0x93')],'as':_0x17ed('0x94')},{'model':db[_0x17ed('0xc9')],'as':_0x17ed('0xc9')}]});})[_0x17ed('0x32')](handleEntityNotFound(_0x2bdac1,null))[_0x17ed('0x32')](function(_0x302ce2){if(_0x302ce2&&_0x302ce2[_0x17ed('0x94')]){_0x5e63e8=_0x302ce2;var _0x37c996=_['defaults'](_0x7e2157['body'],{'firstName':_0x7e2157['body'][_0x17ed('0x92')],'phone':_0x7e2157[_0x17ed('0x54')]['from'],'ListId':_0x302ce2[_0x17ed('0x8c')]});_0x37c996[_0x7e2157[_0x17ed('0x54')][_0x17ed('0xc7')]]=_0x7e2157[_0x17ed('0x54')][_0x17ed('0x92')];return db[_0x17ed('0x84')][_0x17ed('0xca')]({'where':_0x67d8f,'defaults':_0x37c996});}})[_0x17ed('0xb3')](function(_0x523e1a){if(_0x523e1a){_0x3d8748=_0x523e1a;var _0x23d369=fs['readFileSync'](path['join'](config[_0x17ed('0x6e')],_0x17ed('0xcb')),_0x17ed('0xcc'));var _0x27df32=ejs[_0x17ed('0xcd')](_0x23d369,{'body':_[_0x17ed('0xce')](_0x7e2157[_0x17ed('0x54')][_0x17ed('0x54')]),'bodyTitle':_0x5e63e8[_0x17ed('0xcf')]});return db[_0x17ed('0xd0')][_0x17ed('0x53')]({'body':_0x27df32,'ContactId':_0x523e1a['id'],'ChatWebsiteId':_0x5e63e8['id']});}})[_0x17ed('0x32')](function(_0x3f08aa){if(_0x3f08aa){_0x409b99=_0x3f08aa;return db[_0x17ed('0xc9')][_0x17ed('0x63')]({'where':{'service':!![]},'include':[{'model':db[_0x17ed('0xd1')],'as':_0x17ed('0xd2'),'raw':!![]}]});}})[_0x17ed('0x32')](function(_0x4d9d9b){if(_0x4d9d9b&&_0x4d9d9b[_0x17ed('0xd2')]&&_0x5e63e8[_0x17ed('0xd3')]&&_0x5e63e8['forwardOfflineAddress']){var _0x543e78={'tls':{'rejectUnauthorized':![]}};if(_0x4d9d9b[_0x17ed('0xd2')][_0x17ed('0xd4')]){_0x543e78[_0x17ed('0xd4')]=_0x4d9d9b[_0x17ed('0xd2')][_0x17ed('0xd4')];}else{_0x543e78['host']=_0x4d9d9b[_0x17ed('0xd2')][_0x17ed('0xd5')];_0x543e78[_0x17ed('0xd6')]=_0x4d9d9b['Smtp'][_0x17ed('0xd6')];_0x543e78['secure']=_0x4d9d9b[_0x17ed('0xd2')][_0x17ed('0xd7')];}if(_0x4d9d9b[_0x17ed('0xd2')][_0x17ed('0xd8')]){_0x543e78[_0x17ed('0xd9')]={'user':_0x4d9d9b['Smtp'][_0x17ed('0x55')],'pass':_0x4d9d9b['Smtp'][_0x17ed('0xda')]};}return respondWithRpcPromise(_0x17ed('0xdb'),_0x17ed('0xdc'),{'account':_0x543e78,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4d9d9b[_0x17ed('0x37')],_0x4d9d9b[_0x17ed('0xdd')]||_0x4d9d9b[_0x17ed('0xd2')][_0x17ed('0x55')]),'to':_0x5e63e8[_0x17ed('0xde')],'subject':_0x5e63e8[_0x17ed('0xdf')],'text':_0x409b99[_0x17ed('0x54')]}},client9003)[_0x17ed('0x32')](function(){return _0x409b99;})['catch'](function(_0x406c42){console['error'](_0x406c42);});}})[_0x17ed('0x32')](function(){if(_0x5e63e8&&_0x5e63e8[_0x17ed('0xe0')]&&_0x5e63e8['MailAccountId']){var _0x26a08b={'from':_0x3d8748[_0x17ed('0xdd')],'firstName':_0x3d8748[_0x17ed('0xa1')],'lastName':_0x3d8748[_0x17ed('0xa2')],'mapKey':_0x17ed('0xdd'),'message':{'from':_0x3d8748[_0x17ed('0xdd')],'to':_0x5e63e8[_0x17ed('0xc9')][_0x17ed('0xdd')],'cc':'','subject':_0x5e63e8[_0x17ed('0xdf')],'messageId':'','sentAt':new Date(),'attach':![],'attachments':[],'originChannel':_0x17ed('0xe1'),'ChatWebsiteId':_0x5e63e8['id'],'ChatOfflineMessageId':_0x409b99['id'],'originTo':_0x5e63e8[_0x17ed('0xc9')][_0x17ed('0xdd')]},'body':_0x409b99[_0x17ed('0x54')]};var _0x4ba95c={'account':{'id':_0x5e63e8[_0x17ed('0xe2')]},'body':_0x26a08b,'log':_0x17ed('0xe3')};return respondWithRpcPromise(_0x17ed('0xe3'),_0x17ed('0xe4'),_0x4ba95c,client9001)[_0x17ed('0x32')](function(){return _0x409b99;})[_0x17ed('0x27')](function(_0x5a8294){console[_0x17ed('0x22')](_0x5a8294);});}return;})[_0x17ed('0x32')](function(){if(_0x409b99){return _0x409b99;}})[_0x17ed('0x32')](respondWithResult(_0x2bdac1,null))['catch'](handleError(_0x2bdac1,null));};exports[_0x17ed('0xe5')]=function(_0x2a67f3,_0x54e1e8,_0x5006ea){return db['ChatInteraction'][_0x17ed('0x52')]({'where':{'id':_0x2a67f3[_0x17ed('0x4e')]['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x54e1e8,null))[_0x17ed('0x32')](function(_0x40c3ad){if(_0x40c3ad){return _0x40c3ad[_0x17ed('0xe5')](_0x2a67f3[_0x17ed('0x54')][_0x17ed('0x65')],_[_0x17ed('0xe6')](_0x2a67f3[_0x17ed('0x54')],[_0x17ed('0x65'),'id'])||{});}})[_0x17ed('0x32')](respondWithResult(_0x54e1e8,null))['catch'](handleError(_0x54e1e8,null));};exports['getInteractions']=function(_0x47c3c7,_0x4a525c,_0x4c84cc){var _0x3dc0aa={'raw':![],'where':{}};var _0x7ec2c2={};var _0x1bbd21={'count':0x0,'rows':[]};return db[_0x17ed('0x3a')]['findOne']({'where':{'id':_0x47c3c7[_0x17ed('0x4e')]['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x4a525c,null))[_0x17ed('0x32')](function(_0x48c67e){if(_0x48c67e){_0x7ec2c2[_0x17ed('0x41')]=_[_0x17ed('0x3f')](db[_0x17ed('0xb0')][_0x17ed('0x4f')]);_0x7ec2c2[_0x17ed('0x3e')]=_['keys'](_0x47c3c7[_0x17ed('0x3e')]);_0x7ec2c2['filters']=_[_0x17ed('0x42')](_0x7ec2c2[_0x17ed('0x41')],_0x7ec2c2[_0x17ed('0x3e')]);_0x3dc0aa[_0x17ed('0x44')]=_['intersection'](_0x7ec2c2[_0x17ed('0x41')],qs[_0x17ed('0x43')](_0x47c3c7['query'][_0x17ed('0x43')]));_0x3dc0aa[_0x17ed('0x44')]=_0x3dc0aa[_0x17ed('0x44')]['length']?_0x3dc0aa['attributes']:_0x7ec2c2[_0x17ed('0x41')];if(!_0x47c3c7[_0x17ed('0x3e')]['hasOwnProperty'](_0x17ed('0xe7'))){_0x3dc0aa[_0x17ed('0x45')]=qs[_0x17ed('0x45')](_0x47c3c7[_0x17ed('0x3e')][_0x17ed('0x45')]);_0x3dc0aa[_0x17ed('0x2d')]=qs[_0x17ed('0x2d')](_0x47c3c7[_0x17ed('0x3e')][_0x17ed('0x2d')]);}_0x3dc0aa[_0x17ed('0x64')]=qs['sort'](_0x47c3c7[_0x17ed('0x3e')][_0x17ed('0x46')]);_0x3dc0aa[_0x17ed('0x47')]=qs[_0x17ed('0x40')](_[_0x17ed('0x48')](_0x47c3c7[_0x17ed('0x3e')],_0x7ec2c2[_0x17ed('0x40')]));_0x3dc0aa[_0x17ed('0x47')][_0x17ed('0x5a')]=_0x48c67e['id'];if(_0x47c3c7[_0x17ed('0x3e')][_0x17ed('0x49')]){_0x3dc0aa[_0x17ed('0x47')]=_[_0x17ed('0x4a')](_0x3dc0aa[_0x17ed('0x47')],{'$or':_[_0x17ed('0x3d')](_0x3dc0aa['attributes'],function(_0x1b83fa){var _0x496168={};_0x496168[_0x1b83fa]={'$like':'%'+_0x47c3c7[_0x17ed('0x3e')]['filter']+'%'};return _0x496168;})});}_0x3dc0aa=_[_0x17ed('0x4a')]({},_0x3dc0aa,_0x47c3c7['options']);return db[_0x17ed('0xb0')][_0x17ed('0x2c')]({'where':_0x3dc0aa['where']})[_0x17ed('0x32')](function(_0x5cbdcd){_0x1bbd21[_0x17ed('0x2c')]=_0x5cbdcd;if(_0x47c3c7[_0x17ed('0x3e')][_0x17ed('0x51')]){_0x3dc0aa[_0x17ed('0x5d')]=[{'model':db['CmContact'],'as':_0x17ed('0xe8'),'required':![]},{'model':db[_0x17ed('0xe9')],'as':'Owner','attributes':['name',_0x17ed('0xea'),_0x17ed('0xeb')],'required':![]},{'model':db['Tag'],'as':_0x17ed('0xec'),'attributes':['id',_0x17ed('0x37'),'color'],'where':_0x47c3c7[_0x17ed('0x3e')][_0x17ed('0xed')]?{'id':_0x47c3c7[_0x17ed('0x3e')][_0x17ed('0xed')]}:undefined,'required':_0x47c3c7[_0x17ed('0x3e')]['tag']?!![]:![]}];}return db[_0x17ed('0xb0')][_0x17ed('0x4d')](_0x3dc0aa);})['then'](function(_0xfd4f62){_0x1bbd21[_0x17ed('0x5e')]=_0xfd4f62;return _0x1bbd21;});}})[_0x17ed('0x32')](respondWithFilteredResult(_0x4a525c,_0x3dc0aa))[_0x17ed('0x27')](handleError(_0x4a525c,null));};function iftimePromise(_0x58f8c3,_0x455847){return respondWithRpcPromise('Command',_0x17ed('0xee'),{'command':_0x455847[_0x17ed('0xef')]?util[_0x17ed('0xa6')](_0x17ed('0xf0'),_0x58f8c3[_0x17ed('0xf1')],_0x455847['timezone']):util[_0x17ed('0xa6')](_0x17ed('0xf2'),_0x58f8c3[_0x17ed('0xf1')])},client9002)[_0x17ed('0x32')](function(_0x1e5654){var _0x50e10d=_0x1e5654&&_0x1e5654[_0x17ed('0xf3')](_0x17ed('0xf4'))>=0x0?!![]:![];logger[_0x17ed('0xf5')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x455847['id'],_0x58f8c3['id'],_0x58f8c3[_0x17ed('0xf1')],_0x50e10d?'ONLINE':_0x17ed('0xf6'),_0x455847[_0x17ed('0xef')]?_0x455847['timezone']:_0x17ed('0xf7'));return _0x50e10d;})[_0x17ed('0x27')](function(_0x1c211a){logger['error'](_0x17ed('0xf8'),_0x455847['id'],_0x58f8c3['id'],_0x58f8c3[_0x17ed('0xf1')],util[_0x17ed('0xf9')](_0x1c211a,{'showHidden':![],'depth':null}),_0x455847[_0x17ed('0xef')]?_0x455847['timezone']:'No\x20timezone');return![];});}exports[_0x17ed('0xee')]=function(_0x32da69,_0x793eec,_0x30b417){var _0x2730b6=0x0;var _0x20f25e=0x0;var _0x39f93a=![];var _0x4f0842;var _0x180517;return db[_0x17ed('0x3a')][_0x17ed('0x52')]({'where':{'id':_0x32da69[_0x17ed('0x4e')]['id']},'include':[{'model':db[_0x17ed('0xfa')],'as':_0x17ed('0xfa'),'include':[{'model':db['Interval'],'as':_0x17ed('0xfb'),'attributes':['id',_0x17ed('0xf1')],'raw':!![]}]}]})[_0x17ed('0x32')](handleEntityNotFound(_0x793eec,null))[_0x17ed('0x32')](function(_0x16df90){if(_0x16df90){_0x4f0842=_0x16df90;return _0x16df90[_0x17ed('0xfc')]({'raw':!![]});}})[_0x17ed('0x32')](function(_0x4d73bd){if(_0x4f0842){if(_0x4d73bd){_0x180517=_0x4d73bd;}}return require(_0x17ed('0x17'))[_0x17ed('0x71')]();})[_0x17ed('0x32')](function(_0xc5b15f){if(_0xc5b15f){_0x20f25e=_0xc5b15f[_0x17ed('0xfd')];_0x39f93a=_0xc5b15f['custom'];}})[_0x17ed('0x32')](function(){return db[_0x17ed('0xb0')][_0x17ed('0x2c')]({'where':{'closed':![]}});})[_0x17ed('0x32')](function(_0x3d4216){_0x2730b6=_0x3d4216;if(_0x20f25e&&_0x3d4216>_0x20f25e){return db[_0x17ed('0xfe')][_0x17ed('0x63')]({'where':{'id':0x1}})[_0x17ed('0x32')](function(_0x79422){if(_0x79422){_0x79422[_0x17ed('0xff')](_0x17ed('0x100'));}});}})[_0x17ed('0x32')](function(){if(_0x4f0842[_0x17ed('0xfa')]&&_0x4f0842['Interval'][_0x17ed('0xfb')]){var _0x17a9d2=[];for(var _0x42236a=0x0;_0x42236a<_0x4f0842[_0x17ed('0xfa')]['Intervals'][_0x17ed('0x50')];_0x42236a++){var _0x20528e=_0x4f0842[_0x17ed('0xfa')][_0x17ed('0xfb')][_0x42236a]['get']({'plain':!![]});_0x17a9d2[_0x17ed('0xb8')](iftimePromise(_0x20528e,_0x4f0842));}return BPromise['all'](_0x17a9d2)[_0x17ed('0x32')](function(_0x108ed5){return _[_0x17ed('0x101')](_0x108ed5);});}else{return!![];}})[_0x17ed('0x32')](function(_0x4395de){var _0x41a6b8=fs[_0x17ed('0x102')](path[_0x17ed('0x76')](config[_0x17ed('0x6e')],_0x17ed('0x103')),_0x17ed('0xcc'));var _0x442d09={'remote':_0x4f0842[_0x17ed('0x104')],'query':querystring['stringify'](_[_0x17ed('0x4a')](_0x4f0842[_0x17ed('0x56')]({'plain':!![]}),{'customerIp':_0x32da69['headers'][_0x17ed('0x9e')]||_0x32da69['headers'][_0x17ed('0x105')]||_0x32da69[_0x17ed('0x106')][_0x17ed('0x107')]||_0x32da69['ip'],'referer':_0x32da69[_0x17ed('0x9c')][_0x17ed('0xa4')],'openedInteractions':_0x2730b6,'maxInteractions':_0x20f25e,'virtual':_0x39f93a[_0x17ed('0xfd')],'online':_0x4395de,'custom':_0x39f93a}))[_0x17ed('0x108')](/'/g,'\x5c\x27')};_0x793eec[_0x17ed('0xc5')](ejs[_0x17ed('0xcd')](Mustache['render'](_0x41a6b8,_0x442d09),{'proactiveActions':_0x180517,'alignment':_0x4f0842['alignment'],'verticalAlignment':_0x4f0842['verticalAlignment'],'div_color':_0x4f0842[_0x17ed('0x109')],'text_color':_0x4f0842[_0x17ed('0x10a')]}));})[_0x17ed('0x27')](handleError(_0x793eec,null));};exports[_0x17ed('0x10b')]=function(_0x427dbb,_0x3cb885,_0x5ea0d2){return db[_0x17ed('0x3a')][_0x17ed('0x63')]({'where':{'id':_0x427dbb['params']['id']}})['then'](handleEntityNotFound(_0x3cb885,null))[_0x17ed('0x32')](function(_0x58a8a8){if(_0x58a8a8){return db['sequelize']['transaction'](function(_0x5e357e){return db['ChatApplication'][_0x17ed('0x33')]({'where':{'ChatWebsiteId':_0x427dbb['params']['id']},'transaction':_0x5e357e})[_0x17ed('0x32')](function(_0x3ae408){var _0x32c1df=_['map'](_0x427dbb[_0x17ed('0x54')],function(_0x2e0d93){_0x2e0d93[_0x17ed('0x5a')]=_0x427dbb[_0x17ed('0x4e')]['id'];return _0x2e0d93;});return db['ChatApplication'][_0x17ed('0x10c')](_0x32c1df,{'transaction':_0x5e357e});});})[_0x17ed('0x32')](function(){return db['ChatApplication'][_0x17ed('0x10d')]({'where':{'ChatWebsiteId':_0x427dbb['params']['id']},'order':_0x17ed('0x10e')});});}})[_0x17ed('0x32')](respondWithResult(_0x3cb885,null))[_0x17ed('0x27')](handleError(_0x3cb885,null));};exports['getApplications']=function(_0x198288,_0x361fe4,_0x1f4004){var _0x4c5ff4={};var _0x48c1ce={};var _0xfbdb6a;var _0x48da8c;return db[_0x17ed('0x3a')][_0x17ed('0x63')]({'where':{'id':_0x198288[_0x17ed('0x4e')]['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x361fe4,null))[_0x17ed('0x32')](function(_0xc3a72){if(_0xc3a72){_0xfbdb6a=_0xc3a72;_0x48c1ce['model']=_[_0x17ed('0x3f')](db[_0x17ed('0x97')][_0x17ed('0x4f')]);_0x48c1ce[_0x17ed('0x3e')]=_[_0x17ed('0x3f')](_0x198288[_0x17ed('0x3e')]);_0x48c1ce[_0x17ed('0x40')]=_['intersection'](_0x48c1ce['model'],_0x48c1ce[_0x17ed('0x3e')]);_0x4c5ff4['attributes']=_[_0x17ed('0x42')](_0x48c1ce[_0x17ed('0x41')],qs[_0x17ed('0x43')](_0x198288[_0x17ed('0x3e')][_0x17ed('0x43')]));_0x4c5ff4[_0x17ed('0x44')]=_0x4c5ff4[_0x17ed('0x44')][_0x17ed('0x50')]?_0x4c5ff4[_0x17ed('0x44')]:_0x48c1ce[_0x17ed('0x41')];_0x4c5ff4[_0x17ed('0x64')]=qs['sort'](_0x198288[_0x17ed('0x3e')]['sort']);_0x4c5ff4['where']=qs[_0x17ed('0x40')](_['pick'](_0x198288['query'],_0x48c1ce[_0x17ed('0x40')]));if(_0x198288[_0x17ed('0x3e')][_0x17ed('0x49')]){_0x4c5ff4[_0x17ed('0x47')]=_['merge'](_0x4c5ff4[_0x17ed('0x47')],{'$or':_[_0x17ed('0x3d')](_0x4c5ff4[_0x17ed('0x44')],function(_0x3f4226){var _0x4fbd83={};_0x4fbd83[_0x3f4226]={'$like':'%'+_0x198288[_0x17ed('0x3e')][_0x17ed('0x49')]+'%'};return _0x4fbd83;})});}_0x4c5ff4=_['merge']({},_0x4c5ff4,_0x198288[_0x17ed('0x4c')]);return _0xfbdb6a['getApplications'](_0x4c5ff4);}})[_0x17ed('0x32')](function(_0x2471e4){if(_0x2471e4){_0x48da8c=_0x2471e4['length'];if(!_0x198288[_0x17ed('0x3e')][_0x17ed('0x10f')]('nolimit')){_0x4c5ff4[_0x17ed('0x45')]=qs[_0x17ed('0x45')](_0x198288[_0x17ed('0x3e')][_0x17ed('0x45')]);_0x4c5ff4['offset']=qs[_0x17ed('0x2d')](_0x198288[_0x17ed('0x3e')][_0x17ed('0x2d')]);}return _0xfbdb6a[_0x17ed('0x110')](_0x4c5ff4);}})['then'](function(_0x3104e8){if(_0x3104e8){return _0x3104e8?{'count':_0x48da8c,'rows':_0x3104e8}:null;}})[_0x17ed('0x32')](respondWithResult(_0x361fe4,null))[_0x17ed('0x27')](handleError(_0x361fe4,null));};exports[_0x17ed('0x111')]=function(_0x30cfac,_0x4512aa,_0xc56edd){return db[_0x17ed('0x112')][_0x17ed('0x52')]({'where':{'id':_0x30cfac['params']['id']}})['then'](handleEntityNotFound(_0x4512aa,null))[_0x17ed('0x32')](function(_0x44cacb){if(_0x44cacb){return _0x44cacb[_0x17ed('0x111')](_0x30cfac['body'][_0x17ed('0x65')],_['omit'](_0x30cfac[_0x17ed('0x54')],['ids','id'])||{});}})[_0x17ed('0x32')](respondWithResult(_0x4512aa,null))[_0x17ed('0x27')](handleError(_0x4512aa,null));};exports[_0x17ed('0xfc')]=function(_0x3839ba,_0x246186,_0x51f8f2){var _0xfc8b65={};var _0xcca911={};var _0x4b8e6d;var _0x1aadbe;return db[_0x17ed('0x3a')][_0x17ed('0x63')]({'where':{'id':_0x3839ba['params']['id']}})['then'](handleEntityNotFound(_0x246186,null))['then'](function(_0x2a58cc){if(_0x2a58cc){_0x4b8e6d=_0x2a58cc;_0xcca911[_0x17ed('0x41')]=_['keys'](db['ChatProactiveAction'][_0x17ed('0x4f')]);_0xcca911[_0x17ed('0x3e')]=_[_0x17ed('0x3f')](_0x3839ba['query']);_0xcca911['filters']=_[_0x17ed('0x42')](_0xcca911[_0x17ed('0x41')],_0xcca911[_0x17ed('0x3e')]);_0xfc8b65['attributes']=_[_0x17ed('0x42')](_0xcca911[_0x17ed('0x41')],qs[_0x17ed('0x43')](_0x3839ba[_0x17ed('0x3e')][_0x17ed('0x43')]));_0xfc8b65[_0x17ed('0x44')]=_0xfc8b65[_0x17ed('0x44')]['length']?_0xfc8b65[_0x17ed('0x44')]:_0xcca911[_0x17ed('0x41')];_0xfc8b65['order']=qs['sort'](_0x3839ba[_0x17ed('0x3e')][_0x17ed('0x46')]);_0xfc8b65[_0x17ed('0x47')]=qs[_0x17ed('0x40')](_['pick'](_0x3839ba[_0x17ed('0x3e')],_0xcca911[_0x17ed('0x40')]));if(_0x3839ba[_0x17ed('0x3e')]['filter']){_0xfc8b65[_0x17ed('0x47')]=_['merge'](_0xfc8b65['where'],{'$or':_[_0x17ed('0x3d')](_0xfc8b65['attributes'],function(_0x338c33){var _0xa61bbd={};_0xa61bbd[_0x338c33]={'$like':'%'+_0x3839ba['query'][_0x17ed('0x49')]+'%'};return _0xa61bbd;})});}_0xfc8b65=_['merge']({},_0xfc8b65,_0x3839ba[_0x17ed('0x4c')]);return _0x4b8e6d[_0x17ed('0xfc')](_0xfc8b65);}})['then'](function(_0x5353aa){if(_0x5353aa){_0x1aadbe=_0x5353aa[_0x17ed('0x50')];if(!_0x3839ba[_0x17ed('0x3e')]['hasOwnProperty']('nolimit')){_0xfc8b65[_0x17ed('0x45')]=qs[_0x17ed('0x45')](_0x3839ba[_0x17ed('0x3e')][_0x17ed('0x45')]);_0xfc8b65['offset']=qs[_0x17ed('0x2d')](_0x3839ba[_0x17ed('0x3e')][_0x17ed('0x2d')]);}return _0x4b8e6d[_0x17ed('0xfc')](_0xfc8b65);}})[_0x17ed('0x32')](function(_0x398a01){if(_0x398a01){return _0x398a01?{'count':_0x1aadbe,'rows':_0x398a01}:null;}})[_0x17ed('0x32')](respondWithResult(_0x246186,null))[_0x17ed('0x27')](handleError(_0x246186,null));};exports['getFields']=function(_0x5f3db6,_0x313fa9,_0x52b96b){var _0x2372e7=_0x5f3db6[_0x17ed('0x3e')][_0x17ed('0x113')]==='false'?_0x17ed('0x114'):_0x17ed('0x115');return db['ChatWebsite'][_0x17ed('0x52')]({'attributes':['id',_0x2372e7],'where':{'id':_0x5f3db6[_0x17ed('0x4e')]['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x313fa9,null))['then'](function(_0xe9b229){if(_0xe9b229){var _0x316c21=_0xe9b229[_0x2372e7];var _0x25d7f4=_0x316c21&&_0x316c21[_0x17ed('0x116')]?_0x316c21[_0x17ed('0x116')]:[];_0x313fa9[_0x17ed('0xc5')]({'fromKey':_[_0x17ed('0x73')](_0x316c21['fromKey'])?undefined:_0x316c21[_0x17ed('0x117')],'count':_0x25d7f4[_0x17ed('0x50')],'rows':_0x25d7f4});}})['catch'](handleError(_0x313fa9,null));};exports[_0x17ed('0x118')]=function(_0x1ed8c5,_0x28bf6a,_0xcfafac){var _0xcc446f={'raw':![],'where':{}};var _0x5a989b={};var _0x39d7bb={'count':0x0,'rows':[]};return db[_0x17ed('0x3a')][_0x17ed('0x63')]({'where':{'id':_0x1ed8c5[_0x17ed('0x4e')]['id']}})['then'](handleEntityNotFound(_0x28bf6a,null))[_0x17ed('0x32')](function(_0xf54522){if(_0xf54522){_0x5a989b[_0x17ed('0x41')]=_[_0x17ed('0x3f')](db[_0x17ed('0xd0')][_0x17ed('0x4f')]);_0x5a989b[_0x17ed('0x3e')]=_[_0x17ed('0x3f')](_0x1ed8c5[_0x17ed('0x3e')]);_0x5a989b['filters']=_[_0x17ed('0x42')](_0x5a989b['model'],_0x5a989b[_0x17ed('0x3e')]);_0xcc446f[_0x17ed('0x44')]=_[_0x17ed('0x42')](_0x5a989b[_0x17ed('0x41')],qs[_0x17ed('0x43')](_0x1ed8c5[_0x17ed('0x3e')][_0x17ed('0x43')]));_0xcc446f['attributes']=_0xcc446f[_0x17ed('0x44')][_0x17ed('0x50')]?_0xcc446f['attributes']:_0x5a989b['model'];if(!_0x1ed8c5[_0x17ed('0x3e')][_0x17ed('0x10f')](_0x17ed('0xe7'))){_0xcc446f[_0x17ed('0x45')]=qs['limit'](_0x1ed8c5['query'][_0x17ed('0x45')]);_0xcc446f['offset']=qs['offset'](_0x1ed8c5['query'][_0x17ed('0x2d')]);}_0xcc446f['order']=qs[_0x17ed('0x46')](_0x1ed8c5[_0x17ed('0x3e')]['sort']);_0xcc446f['where']=qs[_0x17ed('0x40')](_[_0x17ed('0x48')](_0x1ed8c5[_0x17ed('0x3e')],_0x5a989b[_0x17ed('0x40')]));_0xcc446f[_0x17ed('0x47')][_0x17ed('0x5a')]=_0xf54522['id'];if(_0x1ed8c5[_0x17ed('0x3e')]['filter']){_0xcc446f[_0x17ed('0x47')]=_['merge'](_0xcc446f[_0x17ed('0x47')],{'$or':_[_0x17ed('0x3d')](_0xcc446f[_0x17ed('0x44')],function(_0x248043){var _0x1e9e31={};_0x1e9e31[_0x248043]={'$like':'%'+_0x1ed8c5[_0x17ed('0x3e')][_0x17ed('0x49')]+'%'};return _0x1e9e31;})});}_0xcc446f=_[_0x17ed('0x4a')]({},_0xcc446f,_0x1ed8c5[_0x17ed('0x4c')]);return db[_0x17ed('0xd0')]['count']({'where':_0xcc446f[_0x17ed('0x47')]})['then'](function(_0x1592db){_0x39d7bb['count']=_0x1592db;if(_0x1ed8c5[_0x17ed('0x3e')][_0x17ed('0x51')]){_0xcc446f[_0x17ed('0x5d')]=[{'all':!![]}];}else{_0xcc446f['include']=[{'model':db[_0x17ed('0x84')],'as':_0x17ed('0xe8'),'required':![]}];}return db[_0x17ed('0xd0')][_0x17ed('0x4d')](_0xcc446f);})[_0x17ed('0x32')](function(_0x16914f){_0x39d7bb[_0x17ed('0x5e')]=_0x16914f;return _0x39d7bb;});}})[_0x17ed('0x32')](respondWithFilteredResult(_0x28bf6a,_0xcc446f))[_0x17ed('0x27')](handleError(_0x28bf6a,null));};exports['addAgents']=function(_0x2c3f93,_0x599e53,_0x183812){return db['ChatWebsite'][_0x17ed('0x52')]({'where':{'id':_0x2c3f93['params']['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x599e53,null))[_0x17ed('0x32')](function(_0x551425){if(_0x551425){return _0x551425[_0x17ed('0x119')](_0x2c3f93[_0x17ed('0x54')][_0x17ed('0x65')],_[_0x17ed('0xe6')](_0x2c3f93[_0x17ed('0x54')],['ids','id'])||{})[_0x17ed('0xb3')](function(_0x2656c5){for(var _0x3fcb65=0x0;_0x3fcb65<_0x2c3f93[_0x17ed('0x54')][_0x17ed('0x65')][_0x17ed('0x50')];_0x3fcb65+=0x1){socket[_0x17ed('0x11a')](_0x17ed('0x11b'),{'UserId':_0x2c3f93[_0x17ed('0x54')][_0x17ed('0x65')][_0x3fcb65],'ChatWebsiteId':_0x2c3f93[_0x17ed('0x4e')]['id']});}return _0x2656c5;});}})[_0x17ed('0x32')](respondWithResult(_0x599e53,null))[_0x17ed('0x27')](handleError(_0x599e53,null));};exports[_0x17ed('0x11c')]=function(_0x151d88,_0x1a8b91,_0x1d2c00){return db[_0x17ed('0x3a')][_0x17ed('0x52')]({'where':{'id':_0x151d88['params']['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x1a8b91,null))[_0x17ed('0x32')](function(_0x398e9f){if(_0x398e9f){return _0x398e9f['removeAgents'](_0x151d88[_0x17ed('0x3e')][_0x17ed('0x65')])[_0x17ed('0x32')](function(){if(_['isArray'](_0x151d88[_0x17ed('0x3e')][_0x17ed('0x65')])){for(var _0xc7ae2=0x0;_0xc7ae2<_0x151d88[_0x17ed('0x3e')][_0x17ed('0x65')][_0x17ed('0x50')];_0xc7ae2+=0x1){socket[_0x17ed('0x11a')]('userChatWebsite:remove',{'UserId':Number(_0x151d88['query'][_0x17ed('0x65')][_0xc7ae2]),'ChatWebsiteId':Number(_0x151d88[_0x17ed('0x4e')]['id'])});}}else{socket[_0x17ed('0x11a')](_0x17ed('0x11d'),{'UserId':Number(_0x151d88[_0x17ed('0x3e')][_0x17ed('0x65')]),'ChatWebsiteId':Number(_0x151d88['params']['id'])});}});}})[_0x17ed('0x32')](respondWithStatusCode(_0x1a8b91,null))['catch'](handleError(_0x1a8b91,null));};exports[_0x17ed('0x11e')]=function(_0xc13d2c,_0x44611f,_0x20b1e3){var _0x1128c1={};var _0x177f22={};var _0x1932fe;var _0x2c802b;return db[_0x17ed('0x3a')][_0x17ed('0x63')]({'where':{'id':_0xc13d2c['params']['id']}})[_0x17ed('0x32')](handleEntityNotFound(_0x44611f,null))['then'](function(_0x4623b3){if(_0x4623b3){_0x1932fe=_0x4623b3;_0x177f22['model']=_[_0x17ed('0x3f')](db['User'][_0x17ed('0x4f')]);_0x177f22[_0x17ed('0x3e')]=_['keys'](_0xc13d2c[_0x17ed('0x3e')]);_0x177f22['filters']=_[_0x17ed('0x42')](_0x177f22[_0x17ed('0x41')],_0x177f22[_0x17ed('0x3e')]);_0x1128c1['attributes']=_[_0x17ed('0x42')](_0x177f22['model'],qs[_0x17ed('0x43')](_0xc13d2c[_0x17ed('0x3e')][_0x17ed('0x43')]));_0x1128c1[_0x17ed('0x44')]=_0x1128c1[_0x17ed('0x44')][_0x17ed('0x50')]?_0x1128c1[_0x17ed('0x44')]:_0x177f22[_0x17ed('0x41')];_0x1128c1[_0x17ed('0x64')]=qs[_0x17ed('0x46')](_0xc13d2c[_0x17ed('0x3e')][_0x17ed('0x46')]);_0x1128c1[_0x17ed('0x47')]=qs[_0x17ed('0x40')](_[_0x17ed('0x48')](_0xc13d2c[_0x17ed('0x3e')],_0x177f22[_0x17ed('0x40')]));if(_0xc13d2c[_0x17ed('0x3e')]['filter']){_0x1128c1[_0x17ed('0x47')]=_['merge'](_0x1128c1[_0x17ed('0x47')],{'$or':_[_0x17ed('0x3d')](_0x1128c1[_0x17ed('0x44')],function(_0x265b05){var _0x31cc08={};_0x31cc08[_0x265b05]={'$like':'%'+_0xc13d2c[_0x17ed('0x3e')][_0x17ed('0x49')]+'%'};return _0x31cc08;})});}_0x1128c1=_[_0x17ed('0x4a')]({},_0x1128c1,_0xc13d2c[_0x17ed('0x4c')]);return _0x1932fe[_0x17ed('0x11e')](_0x1128c1);}})[_0x17ed('0x32')](function(_0x597147){if(_0x597147){_0x2c802b=_0x597147[_0x17ed('0x50')];if(!_0xc13d2c['query'][_0x17ed('0x10f')]('nolimit')){_0x1128c1[_0x17ed('0x45')]=qs['limit'](_0xc13d2c[_0x17ed('0x3e')][_0x17ed('0x45')]);_0x1128c1[_0x17ed('0x2d')]=qs['offset'](_0xc13d2c[_0x17ed('0x3e')][_0x17ed('0x2d')]);}return _0x1932fe[_0x17ed('0x11e')](_0x1128c1);}})[_0x17ed('0x32')](function(_0x17d891){if(_0x17d891){return _0x17d891?{'count':_0x2c802b,'rows':_0x17d891}:null;}})[_0x17ed('0x32')](respondWithResult(_0x44611f,null))[_0x17ed('0x27')](handleError(_0x44611f,null));}; \ No newline at end of file +var _0x2c22=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','findAll','removeAnswers','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','join','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','server/files/images/avatars/system_avatar.png','headers','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','ChatApplication','Applications','applications','asc','account','contact','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','%s\x20%s','unknown','version','device','vendor','format','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','push','*,*,*,*','ChatMessage','AttachmentId','User','UserId','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','notify','offline','from\x20is\x20mandatory','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','offlineMessageSubject','openNewInteraction','MailAccountId','email','Chat','NotifyMailAccount','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','virtual','increment','chatLicenseExceeded','all','x-real-ip','remoteAddress','referer','replace','alignment','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','rimraf'];(function(_0x2215d0,_0x31abd5){var _0x3a0419=function(_0x5793dd){while(--_0x5793dd){_0x2215d0['push'](_0x2215d0['shift']());}};_0x3a0419(++_0x31abd5);}(_0x2c22,0x11b));var _0x22c2=function(_0x5f31fb,_0x5858e1){_0x5f31fb=_0x5f31fb-0x0;var _0x443e34=_0x2c22[_0x5f31fb];return _0x443e34;};'use strict';var pdf=require(_0x22c2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x22c2('0x1'));var zipdir=require(_0x22c2('0x2'));var jsonpatch=require(_0x22c2('0x3'));var rp=require(_0x22c2('0x4'));var moment=require(_0x22c2('0x5'));var BPromise=require(_0x22c2('0x6'));var Mustache=require(_0x22c2('0x7'));var util=require('util');var path=require(_0x22c2('0x8'));var sox=require(_0x22c2('0x9'));var csv=require(_0x22c2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x22c2('0xb'));var squel=require(_0x22c2('0xc'));var crypto=require(_0x22c2('0xd'));var jsforce=require(_0x22c2('0xe'));var deskjs=require(_0x22c2('0xf'));var toCsv=require(_0x22c2('0xa'));var querystring=require(_0x22c2('0x10'));var Papa=require('papaparse');var Redis=require(_0x22c2('0x11'));var authService=require(_0x22c2('0x12'));var qs=require(_0x22c2('0x13'));var as=require(_0x22c2('0x14'));var hardwareService=require(_0x22c2('0x15'));var logger=require(_0x22c2('0x16'))(_0x22c2('0x17'));var utils=require(_0x22c2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x22c2('0x19'));var db=require(_0x22c2('0x1a'))['db'];config[_0x22c2('0x1b')]=_[_0x22c2('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x22c2('0x1d'))(new Redis(config[_0x22c2('0x1b')]));require('./chatWebsite.socket')['register'](socket);var jayson=require(_0x22c2('0x1e'));var client=jayson[_0x22c2('0x1f')][_0x22c2('0x20')]({'port':0x232c});var client9002=jayson[_0x22c2('0x1f')][_0x22c2('0x20')]({'port':0x232a});var client9003=jayson[_0x22c2('0x1f')]['http']({'port':0x232b});var client9001=jayson[_0x22c2('0x1f')][_0x22c2('0x20')]({'port':0x2329});function respondWithRpcPromise(_0x3e80d0,_0x50f96e,_0x4b3b42,_0x39d23e){return new BPromise(function(_0x1f9093,_0x5830c5){var _0x2765b7=_0x39d23e||client;return _0x2765b7[_0x22c2('0x21')](_0x3e80d0,_0x4b3b42)['then'](function(_0x13bfca){logger[_0x22c2('0x22')](_0x22c2('0x23'),_0x50f96e,_0x22c2('0x24'));logger['debug'](_0x22c2('0x25'),_0x50f96e,'request\x20sent',JSON[_0x22c2('0x26')](_0x13bfca));if(_0x13bfca[_0x22c2('0x27')]){if(_0x13bfca[_0x22c2('0x27')]['code']===0x1f4){logger[_0x22c2('0x27')](_0x22c2('0x23'),_0x50f96e,_0x13bfca[_0x22c2('0x27')][_0x22c2('0x28')]);return _0x5830c5(_0x13bfca[_0x22c2('0x27')][_0x22c2('0x28')]);}logger[_0x22c2('0x27')](_0x22c2('0x23'),_0x50f96e,_0x13bfca[_0x22c2('0x27')][_0x22c2('0x28')]);return _0x1f9093(_0x13bfca[_0x22c2('0x27')][_0x22c2('0x28')]);}else{logger['info'](_0x22c2('0x23'),_0x50f96e,_0x22c2('0x24'));_0x1f9093(_0x13bfca[_0x22c2('0x29')][_0x22c2('0x28')]);}})[_0x22c2('0x2a')](function(_0x28af36){logger['error'](_0x22c2('0x23'),_0x50f96e,_0x28af36);_0x5830c5(_0x28af36);});});}function respondWithStatusCode(_0x332269,_0x446b89){_0x446b89=_0x446b89||0xcc;return function(_0x519f72){if(_0x519f72){return _0x332269[_0x22c2('0x2b')](_0x446b89);}return _0x332269[_0x22c2('0x2c')](_0x446b89)[_0x22c2('0x2d')]();};}function respondWithResult(_0x5b8a45,_0x4582aa){_0x4582aa=_0x4582aa||0xc8;return function(_0x2b0f2c){if(_0x2b0f2c){return _0x5b8a45[_0x22c2('0x2c')](_0x4582aa)[_0x22c2('0x2e')](_0x2b0f2c);}};}function respondWithFilteredResult(_0x224acf,_0x1b80f0){return function(_0x359633){if(_0x359633){var _0xda214=_0x359633[_0x22c2('0x2f')],_0x231918=_0x1b80f0[_0x22c2('0x30')],_0x44c40a=_0x1b80f0[_0x22c2('0x30')]+_0x1b80f0[_0x22c2('0x31')],_0x1627b6;if(_0x44c40a>=_0xda214){_0x44c40a=_0xda214;_0x1627b6=0xc8;}else{_0x1627b6=0xce;}_0x224acf[_0x22c2('0x2c')](_0x1627b6);return _0x224acf[_0x22c2('0x32')](_0x22c2('0x33'),_0x231918+'-'+_0x44c40a+'/'+_0xda214)[_0x22c2('0x2e')](_0x359633);}return null;};}function patchUpdates(_0x50825f){return function(_0x427f43){try{jsonpatch[_0x22c2('0x34')](_0x427f43,_0x50825f,!![]);}catch(_0x5af52f){return BPromise[_0x22c2('0x35')](_0x5af52f);}return _0x427f43[_0x22c2('0x36')]();};}function saveUpdates(_0x28782f,_0x55083c){return function(_0x2a5141){if(_0x2a5141){return _0x2a5141[_0x22c2('0x37')](_0x28782f)[_0x22c2('0x38')](function(_0x491e73){return _0x491e73;});}return null;};}function removeEntity(_0x4fcbc4,_0x230db3){return function(_0x1dc59d){if(_0x1dc59d){return _0x1dc59d[_0x22c2('0x39')]()[_0x22c2('0x38')](function(){var _0x58eaeb=_0x1dc59d[_0x22c2('0x3a')]({'plain':!![]});var _0x5158ca='ChatWebsites';return db[_0x22c2('0x3b')][_0x22c2('0x39')]({'where':{'type':_0x5158ca,'resourceId':_0x58eaeb['id']}})[_0x22c2('0x38')](function(){return _0x1dc59d;});})[_0x22c2('0x38')](function(){_0x4fcbc4[_0x22c2('0x2c')](0xcc)[_0x22c2('0x2d')]();});}};}function handleEntityNotFound(_0xc6b3fb,_0x45f32d){return function(_0x3e8fde){if(!_0x3e8fde){_0xc6b3fb['sendStatus'](0x194);}return _0x3e8fde;};}function handleError(_0x237275,_0x1eab30){_0x1eab30=_0x1eab30||0x1f4;return function(_0xe21254){logger[_0x22c2('0x27')](_0xe21254[_0x22c2('0x3c')]);if(_0xe21254[_0x22c2('0x3d')]){delete _0xe21254[_0x22c2('0x3d')];}_0x237275[_0x22c2('0x2c')](_0x1eab30)[_0x22c2('0x3e')](_0xe21254);};}exports[_0x22c2('0x3f')]=function(_0x2bd39a,_0x2b92f9){var _0xe6005d={'include':[{'model':db[_0x22c2('0x40')],'as':_0x22c2('0x41')}]},_0x5e2d85={},_0x409bd3={'count':0x0,'rows':[]};var _0x48af90=_[_0x22c2('0x42')](db[_0x22c2('0x43')][_0x22c2('0x44')],function(_0x5e2779){return{'name':_0x5e2779[_0x22c2('0x45')],'type':_0x5e2779[_0x22c2('0x46')]['key']};});_0x5e2d85[_0x22c2('0x47')]=_['map'](_0x48af90,'name');_0x5e2d85[_0x22c2('0x48')]=_[_0x22c2('0x49')](_0x2bd39a[_0x22c2('0x48')]);_0x5e2d85[_0x22c2('0x4a')]=_[_0x22c2('0x4b')](_0x5e2d85[_0x22c2('0x47')],_0x5e2d85[_0x22c2('0x48')]);_0xe6005d[_0x22c2('0x4c')]=_['intersection'](_0x5e2d85['model'],qs['fields'](_0x2bd39a[_0x22c2('0x48')][_0x22c2('0x4d')]));_0xe6005d[_0x22c2('0x4c')]=_0xe6005d[_0x22c2('0x4c')][_0x22c2('0x4e')]?_0xe6005d[_0x22c2('0x4c')]:_0x5e2d85[_0x22c2('0x47')];if(!_0x2bd39a[_0x22c2('0x48')][_0x22c2('0x4f')](_0x22c2('0x50'))){_0xe6005d['limit']=qs[_0x22c2('0x31')](_0x2bd39a[_0x22c2('0x48')][_0x22c2('0x31')]);_0xe6005d[_0x22c2('0x30')]=qs[_0x22c2('0x30')](_0x2bd39a[_0x22c2('0x48')][_0x22c2('0x30')]);}_0xe6005d[_0x22c2('0x51')]=qs['sort'](_0x2bd39a['query'][_0x22c2('0x52')]);_0xe6005d[_0x22c2('0x53')]=qs[_0x22c2('0x4a')](_[_0x22c2('0x54')](_0x2bd39a[_0x22c2('0x48')],_0x5e2d85[_0x22c2('0x4a')]),_0x48af90);if(_0x2bd39a['query'][_0x22c2('0x55')]){_0xe6005d[_0x22c2('0x53')]=_[_0x22c2('0x56')](_0xe6005d[_0x22c2('0x53')],{'$or':_[_0x22c2('0x42')](_0x48af90,function(_0xcb55c3){if(_0xcb55c3[_0x22c2('0x46')]!=='VIRTUAL'){var _0x39dcbe={};_0x39dcbe[_0xcb55c3['name']]={'$like':'%'+_0x2bd39a[_0x22c2('0x48')][_0x22c2('0x55')]+'%'};return _0x39dcbe;}})});}_0xe6005d=_[_0x22c2('0x56')]({},_0xe6005d,_0x2bd39a[_0x22c2('0x57')]);var _0x4d7d83={'where':_0xe6005d['where']};return db['ChatWebsite'][_0x22c2('0x2f')](_0x4d7d83)[_0x22c2('0x38')](function(_0x4e508d){_0x409bd3[_0x22c2('0x2f')]=_0x4e508d;if(_0x2bd39a[_0x22c2('0x48')][_0x22c2('0x58')]){_0xe6005d[_0x22c2('0x59')]=[{'all':!![]}];}return db[_0x22c2('0x43')]['findAll'](_0xe6005d);})[_0x22c2('0x38')](function(_0x7cd7b6){_0x409bd3[_0x22c2('0x5a')]=_0x7cd7b6;return _0x409bd3;})[_0x22c2('0x38')](respondWithFilteredResult(_0x2b92f9,_0xe6005d))[_0x22c2('0x2a')](handleError(_0x2b92f9,null));};exports['show']=function(_0x43980c,_0x409562){var _0x39f290={'raw':![],'where':{'id':_0x43980c[_0x22c2('0x5b')]['id']},'include':[{'model':db[_0x22c2('0x40')],'as':_0x22c2('0x41')}]},_0x58f440={};_0x58f440[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0x43')][_0x22c2('0x44')]);_0x58f440[_0x22c2('0x48')]=_[_0x22c2('0x49')](_0x43980c['query']);_0x58f440[_0x22c2('0x4a')]=_[_0x22c2('0x4b')](_0x58f440[_0x22c2('0x47')],_0x58f440[_0x22c2('0x48')]);_0x39f290['attributes']=_[_0x22c2('0x4b')](_0x58f440[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0x43980c[_0x22c2('0x48')][_0x22c2('0x4d')]));_0x39f290['attributes']=_0x39f290[_0x22c2('0x4c')]['length']?_0x39f290[_0x22c2('0x4c')]:_0x58f440[_0x22c2('0x47')];if(_0x43980c['query'][_0x22c2('0x58')]){_0x39f290['include']=[{'all':!![]}];}_0x39f290=_[_0x22c2('0x56')]({},_0x39f290,_0x43980c[_0x22c2('0x57')]);return db[_0x22c2('0x43')][_0x22c2('0x5c')](_0x39f290)[_0x22c2('0x38')](handleEntityNotFound(_0x409562,null))[_0x22c2('0x38')](respondWithResult(_0x409562,null))[_0x22c2('0x2a')](handleError(_0x409562,null));};exports[_0x22c2('0x5d')]=function(_0x2b62e1,_0x568983){return db['ChatWebsite'][_0x22c2('0x5d')](_0x2b62e1[_0x22c2('0x5e')],{})[_0x22c2('0x38')](function(_0x177155){var _0x4a7261=_0x2b62e1[_0x22c2('0x5f')][_0x22c2('0x3a')]({'plain':!![]});if(!_0x4a7261)throw new Error(_0x22c2('0x60'));if(_0x4a7261[_0x22c2('0x61')]===_0x22c2('0x5f')){var _0x324449=_0x177155[_0x22c2('0x3a')]({'plain':!![]});var _0x392994=_0x22c2('0x62');return db[_0x22c2('0x63')]['find']({'where':{'name':_0x392994,'userProfileId':_0x4a7261['userProfileId']},'raw':!![]})[_0x22c2('0x38')](function(_0x418589){if(_0x418589&&_0x418589['autoAssociation']===0x0){return db[_0x22c2('0x3b')][_0x22c2('0x5d')]({'name':_0x324449['name'],'resourceId':_0x324449['id'],'type':_0x418589['name'],'sectionId':_0x418589['id']},{})[_0x22c2('0x38')](function(){return _0x177155;});}else{return _0x177155;}})[_0x22c2('0x2a')](function(_0x3f115f){logger[_0x22c2('0x27')](_0x22c2('0x64'),_0x3f115f);throw _0x3f115f;});}return _0x177155;})[_0x22c2('0x38')](respondWithResult(_0x568983,0xc9))[_0x22c2('0x2a')](handleError(_0x568983,null));};exports['update']=function(_0x53bd77,_0x3580ed){if(_0x53bd77['body']['id']){delete _0x53bd77['body']['id'];}return db[_0x22c2('0x43')]['find']({'where':{'id':_0x53bd77['params']['id']},'include':[{'model':db[_0x22c2('0x40')],'as':_0x22c2('0x41')}]})['then'](handleEntityNotFound(_0x3580ed,null))[_0x22c2('0x38')](saveUpdates(_0x53bd77['body'],null))[_0x22c2('0x38')](respondWithResult(_0x3580ed,null))[_0x22c2('0x2a')](handleError(_0x3580ed,null));};exports['destroy']=function(_0x57b321,_0x16bfa1){return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x57b321['params']['id']}})['then'](handleEntityNotFound(_0x16bfa1,null))[_0x22c2('0x38')](removeEntity(_0x16bfa1,null))['catch'](handleError(_0x16bfa1,null));};exports[_0x22c2('0x65')]=function(_0x1a91a7,_0x6ee5c4){return db[_0x22c2('0x43')][_0x22c2('0x65')]()[_0x22c2('0x38')](respondWithResult(_0x6ee5c4,null))[_0x22c2('0x2a')](handleError(_0x6ee5c4,null));};exports[_0x22c2('0x66')]=function(_0x465f47,_0x174509,_0x4edbd0){if(_0x465f47[_0x22c2('0x5e')]['id']){delete _0x465f47[_0x22c2('0x5e')]['id'];}return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x465f47[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x174509,null))[_0x22c2('0x38')](function(_0x4d6182){if(_0x4d6182){_0x465f47[_0x22c2('0x5e')][_0x22c2('0x67')]=_0x4d6182['id'];return db[_0x22c2('0x68')]['create'](_0x465f47[_0x22c2('0x5e')]);}})[_0x22c2('0x38')](respondWithResult(_0x174509,null))['catch'](handleError(_0x174509,null));};exports['getDispositions']=function(_0x222f59,_0x52592b,_0xd7f029){var _0x1e4076={'raw':![],'where':{}};var _0x5b5a0d={};var _0x3db567={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x22c2('0x69')]({'where':{'id':_0x222f59[_0x22c2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x52592b,null))[_0x22c2('0x38')](function(_0xa85c6a){if(_0xa85c6a){_0x5b5a0d[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0x68')][_0x22c2('0x44')]);_0x5b5a0d[_0x22c2('0x48')]=_[_0x22c2('0x49')](_0x222f59[_0x22c2('0x48')]);_0x5b5a0d[_0x22c2('0x4a')]=_['intersection'](_0x5b5a0d['model'],_0x5b5a0d[_0x22c2('0x48')]);_0x1e4076[_0x22c2('0x4c')]=_[_0x22c2('0x4b')](_0x5b5a0d[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0x222f59['query'][_0x22c2('0x4d')]));_0x1e4076[_0x22c2('0x4c')]=_0x1e4076[_0x22c2('0x4c')]['length']?_0x1e4076[_0x22c2('0x4c')]:_0x5b5a0d[_0x22c2('0x47')];if(!_0x222f59[_0x22c2('0x48')][_0x22c2('0x4f')](_0x22c2('0x50'))){_0x1e4076[_0x22c2('0x31')]=qs[_0x22c2('0x31')](_0x222f59[_0x22c2('0x48')][_0x22c2('0x31')]);_0x1e4076[_0x22c2('0x30')]=qs[_0x22c2('0x30')](_0x222f59[_0x22c2('0x48')]['offset']);}_0x1e4076[_0x22c2('0x51')]=qs[_0x22c2('0x52')](_0x222f59[_0x22c2('0x48')][_0x22c2('0x52')]);_0x1e4076['where']=qs[_0x22c2('0x4a')](_[_0x22c2('0x54')](_0x222f59[_0x22c2('0x48')],_0x5b5a0d[_0x22c2('0x4a')]));_0x1e4076[_0x22c2('0x53')][_0x22c2('0x67')]=_0xa85c6a['id'];if(_0x222f59[_0x22c2('0x48')]['filter']){_0x1e4076[_0x22c2('0x53')]=_['merge'](_0x1e4076[_0x22c2('0x53')],{'$or':_['map'](_0x1e4076[_0x22c2('0x4c')],function(_0x1b3e52){var _0x59478f={};_0x59478f[_0x1b3e52]={'$like':'%'+_0x222f59[_0x22c2('0x48')][_0x22c2('0x55')]+'%'};return _0x59478f;})});}_0x1e4076=_[_0x22c2('0x56')]({},_0x1e4076,_0x222f59['options']);return db[_0x22c2('0x68')][_0x22c2('0x2f')]({'where':_0x1e4076[_0x22c2('0x53')]})[_0x22c2('0x38')](function(_0x21c2d3){_0x3db567[_0x22c2('0x2f')]=_0x21c2d3;if(_0x222f59[_0x22c2('0x48')][_0x22c2('0x58')]){_0x1e4076[_0x22c2('0x59')]=[{'all':!![]}];}return db[_0x22c2('0x68')]['findAll'](_0x1e4076);})[_0x22c2('0x38')](function(_0x15a6b6){_0x3db567[_0x22c2('0x5a')]=_0x15a6b6;return _0x3db567;});}})[_0x22c2('0x38')](respondWithFilteredResult(_0x52592b,_0x1e4076))[_0x22c2('0x2a')](handleError(_0x52592b,null));};exports[_0x22c2('0x6a')]=function(_0x58223d,_0x49eb65,_0x3c77f5){return db['ChatWebsite'][_0x22c2('0x5c')]({'where':{'id':_0x58223d[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x49eb65,null))[_0x22c2('0x38')](function(_0x44930e){if(_0x44930e){return _0x44930e['removeDispositions'](_0x58223d[_0x22c2('0x48')][_0x22c2('0x6b')]);}})[_0x22c2('0x38')](respondWithStatusCode(_0x49eb65,null))[_0x22c2('0x2a')](handleError(_0x49eb65,null));};exports[_0x22c2('0x6c')]=function(_0x329bde,_0x9b6622,_0x863a42){if(_0x329bde['body']['id']){delete _0x329bde[_0x22c2('0x5e')]['id'];}return db[_0x22c2('0x43')]['find']({'where':{'id':_0x329bde[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x9b6622,null))[_0x22c2('0x38')](function(_0x4dcbcf){if(_0x4dcbcf){_0x329bde[_0x22c2('0x5e')][_0x22c2('0x67')]=_0x4dcbcf['id'];return db[_0x22c2('0x6d')][_0x22c2('0x5d')](_0x329bde[_0x22c2('0x5e')]);}})['then'](respondWithResult(_0x9b6622,null))[_0x22c2('0x2a')](handleError(_0x9b6622,null));};exports['getAnswers']=function(_0xfbdfda,_0x2f3323,_0x4cd4db){var _0x456e46={'raw':![],'where':{}};var _0x3eb34f={};var _0x757ea4={'count':0x0,'rows':[]};return db[_0x22c2('0x43')][_0x22c2('0x69')]({'where':{'id':_0xfbdfda[_0x22c2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2f3323,null))[_0x22c2('0x38')](function(_0x3383e5){if(_0x3383e5){_0x3eb34f['model']=_['keys'](db[_0x22c2('0x6d')]['rawAttributes']);_0x3eb34f[_0x22c2('0x48')]=_[_0x22c2('0x49')](_0xfbdfda[_0x22c2('0x48')]);_0x3eb34f[_0x22c2('0x4a')]=_[_0x22c2('0x4b')](_0x3eb34f[_0x22c2('0x47')],_0x3eb34f['query']);_0x456e46[_0x22c2('0x4c')]=_[_0x22c2('0x4b')](_0x3eb34f[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0xfbdfda[_0x22c2('0x48')][_0x22c2('0x4d')]));_0x456e46[_0x22c2('0x4c')]=_0x456e46[_0x22c2('0x4c')][_0x22c2('0x4e')]?_0x456e46['attributes']:_0x3eb34f[_0x22c2('0x47')];if(!_0xfbdfda['query'][_0x22c2('0x4f')](_0x22c2('0x50'))){_0x456e46[_0x22c2('0x31')]=qs['limit'](_0xfbdfda[_0x22c2('0x48')][_0x22c2('0x31')]);_0x456e46[_0x22c2('0x30')]=qs[_0x22c2('0x30')](_0xfbdfda[_0x22c2('0x48')][_0x22c2('0x30')]);}_0x456e46[_0x22c2('0x51')]=qs[_0x22c2('0x52')](_0xfbdfda[_0x22c2('0x48')][_0x22c2('0x52')]);_0x456e46['where']=qs[_0x22c2('0x4a')](_[_0x22c2('0x54')](_0xfbdfda[_0x22c2('0x48')],_0x3eb34f['filters']));_0x456e46[_0x22c2('0x53')][_0x22c2('0x67')]=_0x3383e5['id'];if(_0xfbdfda['query'][_0x22c2('0x55')]){_0x456e46['where']=_[_0x22c2('0x56')](_0x456e46[_0x22c2('0x53')],{'$or':_[_0x22c2('0x42')](_0x456e46[_0x22c2('0x4c')],function(_0x3731b1){var _0x6e82a7={};_0x6e82a7[_0x3731b1]={'$like':'%'+_0xfbdfda['query'][_0x22c2('0x55')]+'%'};return _0x6e82a7;})});}_0x456e46=_[_0x22c2('0x56')]({},_0x456e46,_0xfbdfda[_0x22c2('0x57')]);return db[_0x22c2('0x6d')][_0x22c2('0x2f')]({'where':_0x456e46[_0x22c2('0x53')]})[_0x22c2('0x38')](function(_0x293f40){_0x757ea4[_0x22c2('0x2f')]=_0x293f40;if(_0xfbdfda[_0x22c2('0x48')][_0x22c2('0x58')]){_0x456e46[_0x22c2('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x22c2('0x6e')](_0x456e46);})[_0x22c2('0x38')](function(_0x4bc4a4){_0x757ea4[_0x22c2('0x5a')]=_0x4bc4a4;return _0x757ea4;});}})['then'](respondWithFilteredResult(_0x2f3323,_0x456e46))[_0x22c2('0x2a')](handleError(_0x2f3323,null));};exports[_0x22c2('0x6f')]=function(_0x15182c,_0x47b300,_0xf1e6ea){return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x15182c['params']['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x47b300,null))[_0x22c2('0x38')](function(_0x20da68){if(_0x20da68){return _0x20da68[_0x22c2('0x6f')](_0x15182c['query'][_0x22c2('0x6b')]);}})[_0x22c2('0x38')](respondWithStatusCode(_0x47b300,null))[_0x22c2('0x2a')](handleError(_0x47b300,null));};exports['addLogo']=function(_0xcff1e1,_0x3b50e5,_0x322d01){_0xcff1e1[_0x22c2('0x5e')][_0x22c2('0x70')]=_0xcff1e1['file'][_0x22c2('0x71')];return db[_0x22c2('0x43')]['find']({'where':{'id':_0xcff1e1['params']['id']}})['then'](handleEntityNotFound(_0x3b50e5,null))[_0x22c2('0x38')](saveUpdates(_0xcff1e1[_0x22c2('0x5e')],null))[_0x22c2('0x38')](respondWithResult(_0x3b50e5,null))[_0x22c2('0x2a')](handleError(_0x3b50e5,null));};exports[_0x22c2('0x72')]=function(_0x549a37,_0x8c4a98,_0x3ac7d5){_0x549a37[_0x22c2('0x5e')][_0x22c2('0x73')]=_0x549a37[_0x22c2('0x74')][_0x22c2('0x71')];return db['ChatWebsite'][_0x22c2('0x5c')]({'where':{'id':_0x549a37[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x8c4a98,null))['then'](saveUpdates(_0x549a37[_0x22c2('0x5e')],null))[_0x22c2('0x38')](respondWithResult(_0x8c4a98,null))['catch'](handleError(_0x8c4a98,null));};exports[_0x22c2('0x75')]=function(_0x2d2d6f,_0x390889,_0x5d24ab){_0x2d2d6f[_0x22c2('0x5e')]['customerAvatar']=_0x2d2d6f['file'][_0x22c2('0x71')];return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x2d2d6f['params']['id']}})['then'](handleEntityNotFound(_0x390889,null))[_0x22c2('0x38')](saveUpdates(_0x2d2d6f[_0x22c2('0x5e')],null))[_0x22c2('0x38')](respondWithResult(_0x390889,null))[_0x22c2('0x2a')](handleError(_0x390889,null));};exports['addSystemAvatar']=function(_0x477aae,_0x2b04be,_0x5e32cc){_0x477aae[_0x22c2('0x5e')][_0x22c2('0x76')]=_0x477aae['file'][_0x22c2('0x71')];return db['ChatWebsite'][_0x22c2('0x5c')]({'where':{'id':_0x477aae['params']['id']}})['then'](handleEntityNotFound(_0x2b04be,null))[_0x22c2('0x38')](saveUpdates(_0x477aae['body'],null))[_0x22c2('0x38')](respondWithResult(_0x2b04be,null))[_0x22c2('0x2a')](handleError(_0x2b04be,null));};exports['getLogo']=function(_0x520a8f,_0x494822,_0x1b9227){var _0x19bac6=path['join'](config[_0x22c2('0x77')],_0x22c2('0x78'));var _0x3447ef={'where':{'id':_0x520a8f[_0x22c2('0x5b')]['id']},'attributes':['id',_0x22c2('0x70')],'raw':!![]};var _0x5465d6=![];return require(_0x22c2('0x19'))[_0x22c2('0x79')]()[_0x22c2('0x38')](function(_0x941e8d){if(_0x941e8d){_0x5465d6=_0x941e8d[_0x22c2('0x7a')];}})[_0x22c2('0x38')](function(){return db['ChatWebsite'][_0x22c2('0x5c')](_0x3447ef);})[_0x22c2('0x38')](handleEntityNotFound(_0x494822,null))[_0x22c2('0x38')](function(_0x3384ab){if(_0x3384ab){if(!_[_0x22c2('0x7b')](_0x3384ab[_0x22c2('0x70')])){if(fs['existsSync'](path[_0x22c2('0x7c')](config[_0x22c2('0x77')],_0x22c2('0x7d'),_0x3384ab[_0x22c2('0x70')]))&&_0x5465d6){_0x19bac6=path['join'](config['root'],_0x22c2('0x7d'),_0x3384ab[_0x22c2('0x70')]);}}return _0x494822[_0x22c2('0x7e')](_0x19bac6);}})[_0x22c2('0x2a')](handleError(_0x494822,null));};exports[_0x22c2('0x7f')]=function(_0x258044,_0x5a44e4,_0x374c5f){var _0x5f3938=path[_0x22c2('0x7c')](config['root'],_0x22c2('0x80'));var _0x2ddacc={'where':{'id':_0x258044[_0x22c2('0x5b')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x22c2('0x43')][_0x22c2('0x5c')](_0x2ddacc)['then'](handleEntityNotFound(_0x5a44e4,null))[_0x22c2('0x38')](function(_0x4412bd){if(_0x4412bd){if(!_[_0x22c2('0x7b')](_0x4412bd[_0x22c2('0x73')])){if(fs[_0x22c2('0x81')](path[_0x22c2('0x7c')](config[_0x22c2('0x77')],_0x22c2('0x82'),_0x4412bd[_0x22c2('0x73')]))){_0x5f3938=path[_0x22c2('0x7c')](config[_0x22c2('0x77')],'server/files/images/avatars/',_0x4412bd[_0x22c2('0x73')]);}}return _0x5a44e4[_0x22c2('0x7e')](_0x5f3938);}})[_0x22c2('0x2a')](handleError(_0x5a44e4,null));};exports[_0x22c2('0x83')]=function(_0x2024e7,_0x56e16b,_0x330d22){var _0x2bf9c0=path[_0x22c2('0x7c')](config[_0x22c2('0x77')],_0x22c2('0x84'));var _0x525371={'where':{'id':_0x2024e7[_0x22c2('0x5b')]['id']},'attributes':['id',_0x22c2('0x85'),_0x22c2('0x86')],'raw':!![]};return db['ChatWebsite']['find'](_0x525371)['then'](handleEntityNotFound(_0x56e16b,null))[_0x22c2('0x38')](function(_0xf357b6){if(_0xf357b6){if(!_[_0x22c2('0x7b')](_0xf357b6[_0x22c2('0x85')])){if(fs[_0x22c2('0x81')](path[_0x22c2('0x7c')](config['root'],_0x22c2('0x82'),_0xf357b6[_0x22c2('0x85')]))&&_0xf357b6['showCustomerAvatar']){_0x2bf9c0=path[_0x22c2('0x7c')](config[_0x22c2('0x77')],_0x22c2('0x82'),_0xf357b6[_0x22c2('0x85')]);}}return _0x56e16b[_0x22c2('0x7e')](_0x2bf9c0);}})[_0x22c2('0x2a')](handleError(_0x56e16b,null));};exports['getSystemAvatar']=function(_0x1d8fec,_0xef9a81,_0x29b81d){var _0x118e70=path[_0x22c2('0x7c')](config[_0x22c2('0x77')],_0x22c2('0x87'));var _0x57d5c6={'where':{'id':_0x1d8fec[_0x22c2('0x5b')]['id']},'attributes':['id',_0x22c2('0x76')],'raw':!![]};return db[_0x22c2('0x43')][_0x22c2('0x5c')](_0x57d5c6)[_0x22c2('0x38')](handleEntityNotFound(_0xef9a81,null))['then'](function(_0xcff25a){if(_0xcff25a){if(!_[_0x22c2('0x7b')](_0xcff25a[_0x22c2('0x76')])){if(fs[_0x22c2('0x81')](path[_0x22c2('0x7c')](config[_0x22c2('0x77')],_0x22c2('0x82'),_0xcff25a['systemAvatar']))){_0x118e70=path[_0x22c2('0x7c')](config['root'],_0x22c2('0x82'),_0xcff25a[_0x22c2('0x76')]);}}return _0xef9a81[_0x22c2('0x7e')](_0x118e70);}})[_0x22c2('0x2a')](handleError(_0xef9a81,null));};exports['notify']=function(_0x45a8c0,_0x456ce3,_0x29f9b7){var _0x5c8569=require('user-agent-parser');var _0x3e0ad8=new _0x5c8569();var _0x3bfcf6=_0x3e0ad8['setUA'](_0x45a8c0[_0x22c2('0x88')][_0x22c2('0x89')])['getResult']();var _0x327a65={'body':_0x45a8c0['body'],'channel':_0x22c2('0x8a')};var _0x54a918=[];var _0x30d7eb=[];var _0x266b36={};var _0xfb17c2=![];return db[_0x22c2('0x8b')][_0x22c2('0x65')]()[_0x22c2('0x38')](function(_0x4ba223){if(!_0x4ba223){throw new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0x8e'));}_0x54a918=_[_0x22c2('0x8f')](_[_0x22c2('0x49')](_0x4ba223),['createdAt','updatedAt']);_0x30d7eb=_['difference'](_[_0x22c2('0x49')](_0x4ba223),[_0x22c2('0x90'),_0x22c2('0x91'),_0x22c2('0x92'),_0x22c2('0x93')]);if(_0x45a8c0[_0x22c2('0x5e')]['id']){delete _0x45a8c0[_0x22c2('0x5e')]['id'];}if(_['isNil'](_0x45a8c0[_0x22c2('0x5e')]['from'])){throw new db['Sequelize'][(_0x22c2('0x8d'))]('from\x20is\x20mandatory');}if(_[_0x22c2('0x7b')](_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0x5e')])||_0x45a8c0['body'][_0x22c2('0x5e')]===''){throw new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0x94'));}if(_['isNil'](_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0x95')])){throw new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0x96')+_0x30d7eb);}if(!_[_0x22c2('0x97')](_0x30d7eb,_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0x95')])){throw new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0x98')+_0x30d7eb);}_0x266b36[_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0x95')]]=_0x45a8c0['body'][_0x22c2('0x99')];})['then'](function(){return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x45a8c0['params']['id']},'include':[{'model':db[_0x22c2('0x9a')],'as':_0x22c2('0x9b'),'include':[{'model':db[_0x22c2('0x8b')],'as':_0x22c2('0x9c'),'where':_0x266b36,'limit':0x1,'order':[[_0x22c2('0x91'),_0x22c2('0x9d')]]}]},{'model':db[_0x22c2('0x9e')],'as':_0x22c2('0x9f')}]});})[_0x22c2('0x38')](handleEntityNotFound(_0x456ce3,null))['then'](function(_0x2318a6){if(_0x2318a6&&_0x2318a6['List']){_0x327a65['account']=_0x2318a6;_0x327a65['applications']=_0x2318a6[_0x22c2('0x9f')];_0x327a65['list']=_0x2318a6[_0x22c2('0x9b')];_0x327a65['applications']=_['orderBy'](_0x327a65[_0x22c2('0xa0')],['priority'],[_0x22c2('0xa1')]);if(_0x327a65[_0x22c2('0xa2')][_0x22c2('0x9f')]){delete _0x327a65[_0x22c2('0xa2')][_0x22c2('0x9f')];}if(_0x327a65[_0x22c2('0xa2')][_0x22c2('0x9b')]&&_0x327a65['account'][_0x22c2('0x9b')][_0x22c2('0x9c')][_0x22c2('0x4e')]){return _0x327a65[_0x22c2('0xa2')][_0x22c2('0x9b')][_0x22c2('0x9c')][0x0];}var _0x3b4f9e=_[_0x22c2('0x1c')](_0x45a8c0['body'],{'firstName':_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0x99')],'ListId':_0x2318a6[_0x22c2('0x93')]});_0x3b4f9e[_0x45a8c0['body'][_0x22c2('0x95')]]=_0x45a8c0[_0x22c2('0x5e')]['from'];return db[_0x22c2('0x8b')][_0x22c2('0x5d')](_0x3b4f9e,{'fields':_0x54a918,'raw':!![]});}})[_0x22c2('0x38')](handleEntityNotFound(_0x456ce3,null))[_0x22c2('0x38')](function(_0x28685f){_0x327a65[_0x22c2('0xa3')]=_0x28685f;var _0x297389=_0x45a8c0[_0x22c2('0x5e')]['customerIp'];if(_0x45a8c0['headers']['cf-connecting-ip']){_0x297389=_0x45a8c0[_0x22c2('0x88')][_0x22c2('0xa4')];}else if(_0x45a8c0[_0x22c2('0x88')][_0x22c2('0xa5')]){_0x297389=_['first'](_0x45a8c0[_0x22c2('0x88')]['x-forwarded-for'][_0x22c2('0xa6')](','));}if(_0x28685f){var _0x435428={'ContactId':_0x28685f['id'],'ChatWebsiteId':_0x45a8c0['params']['id'],'from':(_0x28685f[_0x22c2('0xa7')]||'')+'\x20'+(_0x28685f[_0x22c2('0xa8')]||''),'customerIp':_0x297389,'customerPort':_0x45a8c0[_0x22c2('0x88')][_0x22c2('0xa9')]?_0x45a8c0[_0x22c2('0x88')][_0x22c2('0xa9')]:null,'referer':_0x45a8c0[_0x22c2('0x5e')]['referer'],'browserName':_0x3bfcf6[_0x22c2('0xaa')][_0x22c2('0x3d')]&&_0x3bfcf6[_0x22c2('0xaa')]['version']?util['format'](_0x22c2('0xab'),_0x3bfcf6[_0x22c2('0xaa')]['name'],_0x3bfcf6[_0x22c2('0xaa')]['version']):_0x22c2('0xac'),'browserVersion':_0x3bfcf6['browser'][_0x22c2('0xad')]||'unknown','osName':util['format']('%s\x20%s',_0x3bfcf6['os'][_0x22c2('0x3d')],_0x3bfcf6['os']['version']),'osVersion':_0x3bfcf6['os'][_0x22c2('0xad')],'deviceModel':_0x3bfcf6[_0x22c2('0xae')]['model']&&_0x3bfcf6['device'][_0x22c2('0xaf')]?util[_0x22c2('0xb0')](_0x22c2('0xb1'),_0x3bfcf6['device'][_0x22c2('0x47')],_0x3bfcf6[_0x22c2('0xae')][_0x22c2('0xaf')],_0x3bfcf6[_0x22c2('0xae')]['type']):null,'deviceVendor':_0x3bfcf6[_0x22c2('0xae')][_0x22c2('0xaf')],'deviceType':_0x3bfcf6[_0x22c2('0xae')][_0x22c2('0x46')],'formData':JSON[_0x22c2('0x26')](_0x45a8c0[_0x22c2('0x5e')])};var _0x5e6897={'ChatWebsiteId':_0x45a8c0['params']['id'],'closed':![]};if(_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb2')]){_0x5e6897[_0x22c2('0xb2')]=_0x45a8c0['body'][_0x22c2('0xb2')];return db['ChatInteraction'][_0x22c2('0x5c')]({'where':_0x5e6897})[_0x22c2('0x38')](function(_0x4a816c){if(_0x4a816c){return[_0x4a816c,![]];}_0x435428[_0x22c2('0xb2')]=_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb2')];_0x435428[_0x22c2('0xb3')]=_0x45a8c0['body'][_0x22c2('0xb3')];return db[_0x22c2('0xb4')][_0x22c2('0x5d')](_0x435428)[_0x22c2('0x38')](function(_0x3f3347){return[_0x3f3347,!![]];});});}_0x5e6897[_0x22c2('0xb5')]=_0x28685f['id'];if(_0x45a8c0['body']['interaction']&&_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb6')]['id']){_0x5e6897['id']=_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb6')]['id'];return db[_0x22c2('0xb4')][_0x22c2('0x5c')]({'where':_0x5e6897})[_0x22c2('0x38')](function(_0xe0aa4a){if(_0xe0aa4a){return[_0xe0aa4a,![]];}return db['ChatInteraction']['create'](_0x435428)['then'](function(_0x5bb079){return[_0x5bb079,!![]];});});}return db['ChatInteraction']['create'](_0x435428)[_0x22c2('0x38')](function(_0x46daa3){return[_0x46daa3,!![]];});}})[_0x22c2('0xb7')](function(_0x310f7c,_0x30663b){if(_0x310f7c){_0xfb17c2=_0x30663b;if(!_0x30663b){var _0x551189={'from':(_0x327a65[_0x22c2('0xa3')][_0x22c2('0xa7')]||'')+'\x20'+(_0x327a65[_0x22c2('0xa3')]['lastName']||'')};if(_0x45a8c0['body'][_0x22c2('0xb2')]&&_0x45a8c0[_0x22c2('0x5e')]['messageId']&&_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb2')]!=_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb8')]){_0x551189[_0x22c2('0xb2')]=_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb8')];}return _0x310f7c[_0x22c2('0x37')](_0x551189);}else{return _0x310f7c;}}})[_0x22c2('0x38')](function(_0x14b024){_0x327a65[_0x22c2('0xb6')]=_0x14b024['get']({'plain':!![]});_0x327a65[_0x22c2('0xb6')][_0x22c2('0xb9')]=_0xfb17c2;if(_0x327a65[_0x22c2('0xb6')][_0x22c2('0xb9')]){if(_0x327a65[_0x22c2('0xa2')]['autoclose']){_0x327a65[_0x22c2('0xa0')][_0x22c2('0xba')]({'id':0x0,'priority':_0x327a65['applications'][_0x22c2('0x4e')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x22c2('0xbb')});}}return db[_0x22c2('0xbc')][_0x22c2('0x5d')]({'body':_0x45a8c0[_0x22c2('0x5e')]['body'],'ChatWebsiteId':_0x45a8c0['params']['id'],'ChatInteractionId':_0x14b024['id'],'direction':'in','ContactId':_0x327a65[_0x22c2('0xa3')]['id'],'AttachmentId':_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xbd')]});})[_0x22c2('0x38')](function(_0x164533){_0x327a65[_0x22c2('0x28')]=_0x164533;if(_0x327a65[_0x22c2('0xb6')]['UserId']){return db[_0x22c2('0xbe')][_0x22c2('0x5c')]({'attributes':['id',_0x22c2('0x3d')],'where':{'id':_0x327a65[_0x22c2('0xb6')][_0x22c2('0xbf')]}})[_0x22c2('0x38')](function(_0x42655d){if(_0x42655d){_0x327a65[_0x22c2('0xa0')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x42655d[_0x22c2('0x3d')]+','+(_0x327a65[_0x22c2('0xa2')][_0x22c2('0xc0')]||0xa),'interval':_0x22c2('0xbb')});_0x327a65[_0x22c2('0xc1')]=!![];}return respondWithRpcPromise('Start',_0x22c2('0xc2'),_0x327a65);});}return respondWithRpcPromise(_0x22c2('0xc3'),_0x22c2('0xc2'),_0x327a65);})[_0x22c2('0x38')](function(_0x32b1b0){respondWithRpcPromise(_0x22c2('0xc4'),'EventManager',{'event':_0x22c2('0xc5'),'message':_0x32b1b0},client9002);return _0x32b1b0;})[_0x22c2('0x38')](respondWithResult(_0x456ce3,null))[_0x22c2('0x2a')](handleError(_0x456ce3,null));};exports[_0x22c2('0xc6')]=function(_0x42d662,_0x5ae98c,_0x2dd21e){var _0x4d7937,_0x2d941e,_0x5d384b;var _0x45609=[];var _0x270a17=[];var _0x4ff0b7={};return db[_0x22c2('0x8b')]['describe']()[_0x22c2('0x38')](function(_0x2bf348){if(!_0x2bf348){throw new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0x8e'));}_0x270a17=_['difference'](_[_0x22c2('0x49')](_0x2bf348),['createdAt',_0x22c2('0x91')]);_0x45609=_[_0x22c2('0x8f')](_[_0x22c2('0x49')](_0x2bf348),[_0x22c2('0x90'),_0x22c2('0x91'),_0x22c2('0x92'),_0x22c2('0x93')]);if(_0x42d662[_0x22c2('0x5e')]['id']){delete _0x42d662[_0x22c2('0x5e')]['id'];}if(_[_0x22c2('0x7b')](_0x42d662['body']['from'])){throw _0x5ae98c['status'](0x1f4)[_0x22c2('0x3e')](new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0xc7')));}if(_[_0x22c2('0x7b')](_0x42d662[_0x22c2('0x5e')][_0x22c2('0x5e')])||_0x42d662[_0x22c2('0x5e')][_0x22c2('0x5e')]===''){throw _0x5ae98c['status'](0x1f4)[_0x22c2('0x3e')](new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0x94')));}if(_['isNil'](_0x42d662[_0x22c2('0x5e')]['mapKeyOffline'])){throw _0x5ae98c[_0x22c2('0x2c')](0x1f4)['send'](new db['Sequelize'][(_0x22c2('0x8d'))](_0x22c2('0xc8')+_0x45609));}if(!_['includes'](_0x45609,_0x42d662[_0x22c2('0x5e')][_0x22c2('0xc9')])){throw _0x5ae98c[_0x22c2('0x2c')](0x1f4)[_0x22c2('0x3e')](new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0xca')+_0x45609));}_0x4ff0b7[_0x42d662[_0x22c2('0x5e')]['mapKeyOffline']]=_0x42d662['body'][_0x22c2('0x99')];})[_0x22c2('0x38')](function(){return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x42d662[_0x22c2('0x5b')]['id']},'include':[{'model':db[_0x22c2('0x9a')],'as':_0x22c2('0x9b')},{'model':db[_0x22c2('0xcb')],'as':_0x22c2('0xcb')}]});})[_0x22c2('0x38')](handleEntityNotFound(_0x5ae98c,null))[_0x22c2('0x38')](function(_0xe28210){if(_0xe28210&&_0xe28210[_0x22c2('0x9b')]){_0x2d941e=_0xe28210;var _0x4a1213=_[_0x22c2('0x1c')](_0x42d662[_0x22c2('0x5e')],{'firstName':_0x42d662['body']['from'],'phone':_0x42d662[_0x22c2('0x5e')][_0x22c2('0x99')],'ListId':_0xe28210[_0x22c2('0x93')]});_0x4a1213[_0x42d662['body'][_0x22c2('0xc9')]]=_0x42d662[_0x22c2('0x5e')][_0x22c2('0x99')];return db[_0x22c2('0x8b')][_0x22c2('0xcc')]({'where':_0x4ff0b7,'defaults':_0x4a1213});}})['spread'](function(_0x5445db){if(_0x5445db){_0x5d384b=_0x5445db;var _0x5e67af=fs[_0x22c2('0xcd')](path[_0x22c2('0x7c')](config['root'],_0x22c2('0xce')),_0x22c2('0xcf'));var _0x30ca82=ejs[_0x22c2('0xd0')](_0x5e67af,{'body':_['toPairs'](_0x42d662[_0x22c2('0x5e')][_0x22c2('0x5e')]),'bodyTitle':_0x2d941e[_0x22c2('0xd1')]});return db['ChatOfflineMessage'][_0x22c2('0x5d')]({'body':_0x30ca82,'ContactId':_0x5445db['id'],'ChatWebsiteId':_0x2d941e['id']});}})['then'](function(_0x410b6d){if(_0x410b6d){_0x4d7937=_0x410b6d;return db[_0x22c2('0xcb')][_0x22c2('0x69')]({'where':{'service':!![]},'include':[{'model':db[_0x22c2('0xd2')],'as':_0x22c2('0xd3'),'raw':!![]}]});}})[_0x22c2('0x38')](function(_0x1d39d9){if(_0x1d39d9&&_0x1d39d9[_0x22c2('0xd3')]&&_0x2d941e['forwardOffline']&&_0x2d941e[_0x22c2('0xd4')]){var _0x3370e9={'tls':{'rejectUnauthorized':![]}};if(_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0xd5')]){_0x3370e9[_0x22c2('0xd5')]=_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0xd5')];}else{_0x3370e9['host']=_0x1d39d9['Smtp'][_0x22c2('0xd6')];_0x3370e9[_0x22c2('0xd7')]=_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0xd7')];_0x3370e9[_0x22c2('0xd8')]=_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0xd8')];}if(_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0xd9')]){_0x3370e9[_0x22c2('0xda')]={'user':_0x1d39d9[_0x22c2('0xd3')]['user'],'pass':_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0xdb')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x3370e9,'message':{'from':util['format'](_0x22c2('0xdc'),_0x1d39d9[_0x22c2('0x3d')],_0x1d39d9['email']||_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0x5f')]),'to':_0x2d941e[_0x22c2('0xd4')],'subject':_0x2d941e[_0x22c2('0xdd')],'text':_0x4d7937[_0x22c2('0x5e')]}},client9003)[_0x22c2('0x38')](function(){return _0x4d7937;})[_0x22c2('0x2a')](function(_0x10fdd7){console['error'](_0x10fdd7);});}})[_0x22c2('0x38')](function(){if(_0x2d941e&&_0x2d941e[_0x22c2('0xde')]&&_0x2d941e[_0x22c2('0xdf')]){var _0x1987c9={'from':_0x5d384b[_0x22c2('0xe0')],'firstName':_0x5d384b['firstName'],'lastName':_0x5d384b[_0x22c2('0xa8')],'mapKey':_0x22c2('0xe0'),'message':{'from':_0x5d384b[_0x22c2('0xe0')],'to':_0x2d941e['MailAccount'][_0x22c2('0xe0')],'cc':'','subject':_0x2d941e['offlineMessageSubject'],'messageId':'','sentAt':new Date(),'attach':![],'attachments':[],'originChannel':_0x22c2('0xe1'),'ChatWebsiteId':_0x2d941e['id'],'ChatOfflineMessageId':_0x4d7937['id'],'originTo':_0x2d941e[_0x22c2('0xcb')][_0x22c2('0xe0')]},'body':_0x4d7937['body']};var _0x48a6dd={'account':{'id':_0x2d941e[_0x22c2('0xdf')]},'body':_0x1987c9,'log':_0x22c2('0xe2')};return respondWithRpcPromise(_0x22c2('0xe2'),'notifyMail',_0x48a6dd,client9001)[_0x22c2('0x38')](function(){return _0x4d7937;})[_0x22c2('0x2a')](function(_0x3c22f9){console[_0x22c2('0x27')](_0x3c22f9);});}return;})[_0x22c2('0x38')](function(){if(_0x4d7937){return _0x4d7937;}})[_0x22c2('0x38')](respondWithResult(_0x5ae98c,null))[_0x22c2('0x2a')](handleError(_0x5ae98c,null));};exports[_0x22c2('0xe3')]=function(_0x2c78c1,_0x3e0f9e,_0x99a895){return db[_0x22c2('0xb4')][_0x22c2('0x5c')]({'where':{'id':_0x2c78c1['params']['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x3e0f9e,null))[_0x22c2('0x38')](function(_0x8bdda){if(_0x8bdda){return _0x8bdda[_0x22c2('0xe3')](_0x2c78c1[_0x22c2('0x5e')][_0x22c2('0x6b')],_[_0x22c2('0xe4')](_0x2c78c1[_0x22c2('0x5e')],['ids','id'])||{});}})['then'](respondWithResult(_0x3e0f9e,null))['catch'](handleError(_0x3e0f9e,null));};exports[_0x22c2('0xe5')]=function(_0x4e20a4,_0xae121,_0x6cd174){var _0x14a2d1={'raw':![],'where':{}};var _0x47a6c5={};var _0x18b456={'count':0x0,'rows':[]};return db[_0x22c2('0x43')]['findOne']({'where':{'id':_0x4e20a4['params']['id']}})['then'](handleEntityNotFound(_0xae121,null))[_0x22c2('0x38')](function(_0x3d132b){if(_0x3d132b){_0x47a6c5[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0xb4')][_0x22c2('0x44')]);_0x47a6c5['query']=_[_0x22c2('0x49')](_0x4e20a4[_0x22c2('0x48')]);_0x47a6c5['filters']=_[_0x22c2('0x4b')](_0x47a6c5[_0x22c2('0x47')],_0x47a6c5[_0x22c2('0x48')]);_0x14a2d1[_0x22c2('0x4c')]=_[_0x22c2('0x4b')](_0x47a6c5[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0x4e20a4[_0x22c2('0x48')]['fields']));_0x14a2d1[_0x22c2('0x4c')]=_0x14a2d1[_0x22c2('0x4c')]['length']?_0x14a2d1[_0x22c2('0x4c')]:_0x47a6c5[_0x22c2('0x47')];if(!_0x4e20a4['query'][_0x22c2('0x4f')]('nolimit')){_0x14a2d1['limit']=qs[_0x22c2('0x31')](_0x4e20a4['query'][_0x22c2('0x31')]);_0x14a2d1[_0x22c2('0x30')]=qs['offset'](_0x4e20a4[_0x22c2('0x48')]['offset']);}_0x14a2d1[_0x22c2('0x51')]=qs[_0x22c2('0x52')](_0x4e20a4[_0x22c2('0x48')]['sort']);_0x14a2d1[_0x22c2('0x53')]=qs['filters'](_[_0x22c2('0x54')](_0x4e20a4['query'],_0x47a6c5['filters']));_0x14a2d1[_0x22c2('0x53')]['ChatWebsiteId']=_0x3d132b['id'];if(_0x4e20a4[_0x22c2('0x48')][_0x22c2('0x55')]){_0x14a2d1[_0x22c2('0x53')]=_[_0x22c2('0x56')](_0x14a2d1['where'],{'$or':_[_0x22c2('0x42')](_0x14a2d1[_0x22c2('0x4c')],function(_0x4ac7c8){var _0x32b86e={};_0x32b86e[_0x4ac7c8]={'$like':'%'+_0x4e20a4[_0x22c2('0x48')][_0x22c2('0x55')]+'%'};return _0x32b86e;})});}_0x14a2d1=_[_0x22c2('0x56')]({},_0x14a2d1,_0x4e20a4[_0x22c2('0x57')]);return db['ChatInteraction'][_0x22c2('0x2f')]({'where':_0x14a2d1['where']})[_0x22c2('0x38')](function(_0x3958cc){_0x18b456[_0x22c2('0x2f')]=_0x3958cc;if(_0x4e20a4[_0x22c2('0x48')][_0x22c2('0x58')]){_0x14a2d1[_0x22c2('0x59')]=[{'model':db[_0x22c2('0x8b')],'as':_0x22c2('0xe6'),'required':![]},{'model':db[_0x22c2('0xbe')],'as':_0x22c2('0xe7'),'attributes':[_0x22c2('0x3d'),'fullname',_0x22c2('0xe8')],'required':![]},{'model':db[_0x22c2('0xe9')],'as':_0x22c2('0xea'),'attributes':['id',_0x22c2('0x3d'),_0x22c2('0xeb')],'where':_0x4e20a4[_0x22c2('0x48')][_0x22c2('0xec')]?{'id':_0x4e20a4[_0x22c2('0x48')]['tag']}:undefined,'required':_0x4e20a4['query']['tag']?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x14a2d1);})['then'](function(_0x136cb4){_0x18b456[_0x22c2('0x5a')]=_0x136cb4;return _0x18b456;});}})[_0x22c2('0x38')](respondWithFilteredResult(_0xae121,_0x14a2d1))[_0x22c2('0x2a')](handleError(_0xae121,null));};function iftimePromise(_0x29fb19,_0x4a327d){return respondWithRpcPromise(_0x22c2('0xed'),_0x22c2('0xee'),{'command':_0x4a327d[_0x22c2('0xef')]?util[_0x22c2('0xb0')]('iftime\x20%s,%s',_0x29fb19[_0x22c2('0xf0')],_0x4a327d[_0x22c2('0xef')]):util[_0x22c2('0xb0')]('iftime\x20%s',_0x29fb19[_0x22c2('0xf0')])},client9002)[_0x22c2('0x38')](function(_0x142f39){var _0x3737fd=_0x142f39&&_0x142f39[_0x22c2('0xf1')](_0x22c2('0xf2'))>=0x0?!![]:![];logger[_0x22c2('0x22')](_0x22c2('0xf3'),_0x4a327d['id'],_0x29fb19['id'],_0x29fb19[_0x22c2('0xf0')],_0x3737fd?_0x22c2('0xf4'):_0x22c2('0xf5'),_0x4a327d[_0x22c2('0xef')]?_0x4a327d[_0x22c2('0xef')]:_0x22c2('0xf6'));return _0x3737fd;})[_0x22c2('0x2a')](function(_0x2076b3){logger[_0x22c2('0x27')](_0x22c2('0xf3'),_0x4a327d['id'],_0x29fb19['id'],_0x29fb19['interval'],util[_0x22c2('0xf7')](_0x2076b3,{'showHidden':![],'depth':null}),_0x4a327d[_0x22c2('0xef')]?_0x4a327d[_0x22c2('0xef')]:'No\x20timezone');return![];});}exports[_0x22c2('0xee')]=function(_0x5b7857,_0x5c4112,_0x3e7218){var _0x49cdf2=0x0;var _0x21f2c9=0x0;var _0x926b04=![];var _0x34a488;var _0x53cf39;return db[_0x22c2('0x43')]['find']({'where':{'id':_0x5b7857[_0x22c2('0x5b')]['id']},'include':[{'model':db[_0x22c2('0xf8')],'as':'Interval','include':[{'model':db[_0x22c2('0xf8')],'as':_0x22c2('0xf9'),'attributes':['id',_0x22c2('0xf0')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5c4112,null))[_0x22c2('0x38')](function(_0x1718cf){if(_0x1718cf){_0x34a488=_0x1718cf;return _0x1718cf['getProactiveActions']({'raw':!![]});}})[_0x22c2('0x38')](function(_0x2ecf3e){if(_0x34a488){if(_0x2ecf3e){_0x53cf39=_0x2ecf3e;}}return require(_0x22c2('0x19'))[_0x22c2('0x79')]();})[_0x22c2('0x38')](function(_0x20c6d0){if(_0x20c6d0){_0x21f2c9=_0x20c6d0[_0x22c2('0xfa')];_0x926b04=_0x20c6d0[_0x22c2('0x7a')];}})[_0x22c2('0x38')](function(){return db[_0x22c2('0xb4')][_0x22c2('0x2f')]({'where':{'closed':![]}});})[_0x22c2('0x38')](function(_0x27a2a6){_0x49cdf2=_0x27a2a6;if(_0x21f2c9&&_0x27a2a6>_0x21f2c9){return db['License'][_0x22c2('0x69')]({'where':{'id':0x1}})[_0x22c2('0x38')](function(_0x4a7970){if(_0x4a7970){_0x4a7970[_0x22c2('0xfb')](_0x22c2('0xfc'));}});}})[_0x22c2('0x38')](function(){if(_0x34a488[_0x22c2('0xf8')]&&_0x34a488[_0x22c2('0xf8')][_0x22c2('0xf9')]){var _0x1cc6f8=[];for(var _0x197fe7=0x0;_0x197fe7<_0x34a488['Interval'][_0x22c2('0xf9')][_0x22c2('0x4e')];_0x197fe7++){var _0x199b80=_0x34a488[_0x22c2('0xf8')][_0x22c2('0xf9')][_0x197fe7][_0x22c2('0x3a')]({'plain':!![]});_0x1cc6f8[_0x22c2('0xba')](iftimePromise(_0x199b80,_0x34a488));}return BPromise[_0x22c2('0xfd')](_0x1cc6f8)[_0x22c2('0x38')](function(_0x29b3e5){return _['some'](_0x29b3e5);});}else{return!![];}})['then'](function(_0x57047f){var _0x293f0f=fs['readFileSync'](path[_0x22c2('0x7c')](config['root'],'server/files/chat/iframe.js'),_0x22c2('0xcf'));var _0x26eb76={'remote':_0x34a488['remote'],'query':querystring[_0x22c2('0x26')](_[_0x22c2('0x56')](_0x34a488[_0x22c2('0x3a')]({'plain':!![]}),{'customerIp':_0x5b7857['headers'][_0x22c2('0xa5')]||_0x5b7857['headers'][_0x22c2('0xfe')]||_0x5b7857['connection'][_0x22c2('0xff')]||_0x5b7857['ip'],'referer':_0x5b7857[_0x22c2('0x88')][_0x22c2('0x100')],'openedInteractions':_0x49cdf2,'maxInteractions':_0x21f2c9,'virtual':_0x926b04[_0x22c2('0xfa')],'online':_0x57047f,'custom':_0x926b04}))[_0x22c2('0x101')](/'/g,'\x5c\x27')};_0x5c4112[_0x22c2('0x3e')](ejs[_0x22c2('0xd0')](Mustache[_0x22c2('0xd0')](_0x293f0f,_0x26eb76),{'proactiveActions':_0x53cf39,'alignment':_0x34a488[_0x22c2('0x102')],'verticalAlignment':_0x34a488['verticalAlignment'],'div_color':_0x34a488[_0x22c2('0xeb')],'text_color':_0x34a488['textColor']}));})[_0x22c2('0x2a')](handleError(_0x5c4112,null));};exports[_0x22c2('0x103')]=function(_0x1665ed,_0x55ba93,_0x2cbbc0){return db[_0x22c2('0x43')][_0x22c2('0x69')]({'where':{'id':_0x1665ed['params']['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x55ba93,null))[_0x22c2('0x38')](function(_0x2b647b){if(_0x2b647b){return db[_0x22c2('0x104')][_0x22c2('0x105')](function(_0x45af77){return db[_0x22c2('0x9e')][_0x22c2('0x39')]({'where':{'ChatWebsiteId':_0x1665ed['params']['id']},'transaction':_0x45af77})[_0x22c2('0x38')](function(_0x9f816e){var _0x5e8239=_[_0x22c2('0x42')](_0x1665ed['body'],function(_0x4af954){_0x4af954[_0x22c2('0x67')]=_0x1665ed[_0x22c2('0x5b')]['id'];return _0x4af954;});return db[_0x22c2('0x9e')][_0x22c2('0x106')](_0x5e8239,{'transaction':_0x45af77});});})[_0x22c2('0x38')](function(){return db[_0x22c2('0x9e')][_0x22c2('0x107')]({'where':{'ChatWebsiteId':_0x1665ed[_0x22c2('0x5b')]['id']},'order':_0x22c2('0x108')});});}})[_0x22c2('0x38')](respondWithResult(_0x55ba93,null))[_0x22c2('0x2a')](handleError(_0x55ba93,null));};exports['getApplications']=function(_0x5857e0,_0x3143ab,_0x68a643){var _0x4e98ca={};var _0x3d65d6={};var _0x1440fd;var _0x1f6535;return db[_0x22c2('0x43')][_0x22c2('0x69')]({'where':{'id':_0x5857e0[_0x22c2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3143ab,null))[_0x22c2('0x38')](function(_0x38aa7b){if(_0x38aa7b){_0x1440fd=_0x38aa7b;_0x3d65d6[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0x9e')][_0x22c2('0x44')]);_0x3d65d6[_0x22c2('0x48')]=_['keys'](_0x5857e0[_0x22c2('0x48')]);_0x3d65d6[_0x22c2('0x4a')]=_[_0x22c2('0x4b')](_0x3d65d6[_0x22c2('0x47')],_0x3d65d6[_0x22c2('0x48')]);_0x4e98ca[_0x22c2('0x4c')]=_[_0x22c2('0x4b')](_0x3d65d6[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0x5857e0[_0x22c2('0x48')][_0x22c2('0x4d')]));_0x4e98ca[_0x22c2('0x4c')]=_0x4e98ca[_0x22c2('0x4c')][_0x22c2('0x4e')]?_0x4e98ca[_0x22c2('0x4c')]:_0x3d65d6[_0x22c2('0x47')];_0x4e98ca['order']=qs[_0x22c2('0x52')](_0x5857e0[_0x22c2('0x48')][_0x22c2('0x52')]);_0x4e98ca[_0x22c2('0x53')]=qs[_0x22c2('0x4a')](_[_0x22c2('0x54')](_0x5857e0['query'],_0x3d65d6['filters']));if(_0x5857e0[_0x22c2('0x48')][_0x22c2('0x55')]){_0x4e98ca['where']=_[_0x22c2('0x56')](_0x4e98ca[_0x22c2('0x53')],{'$or':_['map'](_0x4e98ca[_0x22c2('0x4c')],function(_0x39b58a){var _0x2be230={};_0x2be230[_0x39b58a]={'$like':'%'+_0x5857e0[_0x22c2('0x48')][_0x22c2('0x55')]+'%'};return _0x2be230;})});}_0x4e98ca=_['merge']({},_0x4e98ca,_0x5857e0[_0x22c2('0x57')]);return _0x1440fd[_0x22c2('0x109')](_0x4e98ca);}})[_0x22c2('0x38')](function(_0xf598a0){if(_0xf598a0){_0x1f6535=_0xf598a0[_0x22c2('0x4e')];if(!_0x5857e0[_0x22c2('0x48')][_0x22c2('0x4f')](_0x22c2('0x50'))){_0x4e98ca[_0x22c2('0x31')]=qs[_0x22c2('0x31')](_0x5857e0[_0x22c2('0x48')]['limit']);_0x4e98ca[_0x22c2('0x30')]=qs[_0x22c2('0x30')](_0x5857e0['query'][_0x22c2('0x30')]);}return _0x1440fd['getApplications'](_0x4e98ca);}})['then'](function(_0x1e922d){if(_0x1e922d){return _0x1e922d?{'count':_0x1f6535,'rows':_0x1e922d}:null;}})[_0x22c2('0x38')](respondWithResult(_0x3143ab,null))[_0x22c2('0x2a')](handleError(_0x3143ab,null));};exports[_0x22c2('0x10a')]=function(_0x3a9c28,_0x127ea9,_0x4b121c){return db[_0x22c2('0x10b')]['find']({'where':{'id':_0x3a9c28[_0x22c2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x127ea9,null))[_0x22c2('0x38')](function(_0x4de5f6){if(_0x4de5f6){return _0x4de5f6[_0x22c2('0x10a')](_0x3a9c28[_0x22c2('0x5e')][_0x22c2('0x6b')],_[_0x22c2('0xe4')](_0x3a9c28['body'],[_0x22c2('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x127ea9,null))[_0x22c2('0x2a')](handleError(_0x127ea9,null));};exports[_0x22c2('0x10c')]=function(_0x5de2d5,_0x282d03,_0x2f77f0){var _0x5b11ce={};var _0xffe093={};var _0x36f7a6;var _0x3664a0;return db[_0x22c2('0x43')][_0x22c2('0x69')]({'where':{'id':_0x5de2d5['params']['id']}})['then'](handleEntityNotFound(_0x282d03,null))[_0x22c2('0x38')](function(_0x4e1374){if(_0x4e1374){_0x36f7a6=_0x4e1374;_0xffe093[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0x10d')][_0x22c2('0x44')]);_0xffe093[_0x22c2('0x48')]=_['keys'](_0x5de2d5[_0x22c2('0x48')]);_0xffe093['filters']=_[_0x22c2('0x4b')](_0xffe093['model'],_0xffe093[_0x22c2('0x48')]);_0x5b11ce[_0x22c2('0x4c')]=_[_0x22c2('0x4b')](_0xffe093[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0x5de2d5[_0x22c2('0x48')][_0x22c2('0x4d')]));_0x5b11ce[_0x22c2('0x4c')]=_0x5b11ce[_0x22c2('0x4c')][_0x22c2('0x4e')]?_0x5b11ce[_0x22c2('0x4c')]:_0xffe093['model'];_0x5b11ce[_0x22c2('0x51')]=qs[_0x22c2('0x52')](_0x5de2d5[_0x22c2('0x48')][_0x22c2('0x52')]);_0x5b11ce[_0x22c2('0x53')]=qs[_0x22c2('0x4a')](_[_0x22c2('0x54')](_0x5de2d5[_0x22c2('0x48')],_0xffe093[_0x22c2('0x4a')]));if(_0x5de2d5[_0x22c2('0x48')][_0x22c2('0x55')]){_0x5b11ce[_0x22c2('0x53')]=_[_0x22c2('0x56')](_0x5b11ce[_0x22c2('0x53')],{'$or':_[_0x22c2('0x42')](_0x5b11ce['attributes'],function(_0x45466d){var _0x4a682c={};_0x4a682c[_0x45466d]={'$like':'%'+_0x5de2d5[_0x22c2('0x48')]['filter']+'%'};return _0x4a682c;})});}_0x5b11ce=_[_0x22c2('0x56')]({},_0x5b11ce,_0x5de2d5[_0x22c2('0x57')]);return _0x36f7a6['getProactiveActions'](_0x5b11ce);}})[_0x22c2('0x38')](function(_0x24da51){if(_0x24da51){_0x3664a0=_0x24da51['length'];if(!_0x5de2d5[_0x22c2('0x48')][_0x22c2('0x4f')](_0x22c2('0x50'))){_0x5b11ce[_0x22c2('0x31')]=qs[_0x22c2('0x31')](_0x5de2d5['query'][_0x22c2('0x31')]);_0x5b11ce['offset']=qs['offset'](_0x5de2d5['query']['offset']);}return _0x36f7a6[_0x22c2('0x10c')](_0x5b11ce);}})[_0x22c2('0x38')](function(_0x1a7aa5){if(_0x1a7aa5){return _0x1a7aa5?{'count':_0x3664a0,'rows':_0x1a7aa5}:null;}})[_0x22c2('0x38')](respondWithResult(_0x282d03,null))[_0x22c2('0x2a')](handleError(_0x282d03,null));};exports[_0x22c2('0x10e')]=function(_0x15cd2f,_0x229fe6,_0xd918e5){var _0x1d58fd=_0x15cd2f[_0x22c2('0x48')][_0x22c2('0x10f')]===_0x22c2('0x110')?_0x22c2('0x111'):_0x22c2('0x112');return db['ChatWebsite'][_0x22c2('0x5c')]({'attributes':['id',_0x1d58fd],'where':{'id':_0x15cd2f[_0x22c2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x229fe6,null))[_0x22c2('0x38')](function(_0x5b7c39){if(_0x5b7c39){var _0x1a5938=_0x5b7c39[_0x1d58fd];var _0x1b4f77=_0x1a5938&&_0x1a5938[_0x22c2('0x113')]?_0x1a5938[_0x22c2('0x113')]:[];_0x229fe6[_0x22c2('0x3e')]({'fromKey':_[_0x22c2('0x7b')](_0x1a5938[_0x22c2('0x114')])?undefined:_0x1a5938[_0x22c2('0x114')],'count':_0x1b4f77['length'],'rows':_0x1b4f77});}})[_0x22c2('0x2a')](handleError(_0x229fe6,null));};exports[_0x22c2('0x115')]=function(_0x5690fa,_0x330505,_0x3c3bf2){var _0x3a91b3={'raw':![],'where':{}};var _0x27279b={};var _0x59f493={'count':0x0,'rows':[]};return db[_0x22c2('0x43')][_0x22c2('0x69')]({'where':{'id':_0x5690fa[_0x22c2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x330505,null))['then'](function(_0x4ab795){if(_0x4ab795){_0x27279b[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0x116')][_0x22c2('0x44')]);_0x27279b[_0x22c2('0x48')]=_[_0x22c2('0x49')](_0x5690fa[_0x22c2('0x48')]);_0x27279b[_0x22c2('0x4a')]=_[_0x22c2('0x4b')](_0x27279b[_0x22c2('0x47')],_0x27279b[_0x22c2('0x48')]);_0x3a91b3['attributes']=_[_0x22c2('0x4b')](_0x27279b['model'],qs[_0x22c2('0x4d')](_0x5690fa[_0x22c2('0x48')][_0x22c2('0x4d')]));_0x3a91b3[_0x22c2('0x4c')]=_0x3a91b3[_0x22c2('0x4c')][_0x22c2('0x4e')]?_0x3a91b3[_0x22c2('0x4c')]:_0x27279b[_0x22c2('0x47')];if(!_0x5690fa[_0x22c2('0x48')][_0x22c2('0x4f')](_0x22c2('0x50'))){_0x3a91b3[_0x22c2('0x31')]=qs[_0x22c2('0x31')](_0x5690fa[_0x22c2('0x48')][_0x22c2('0x31')]);_0x3a91b3['offset']=qs['offset'](_0x5690fa[_0x22c2('0x48')][_0x22c2('0x30')]);}_0x3a91b3[_0x22c2('0x51')]=qs[_0x22c2('0x52')](_0x5690fa['query'][_0x22c2('0x52')]);_0x3a91b3['where']=qs[_0x22c2('0x4a')](_['pick'](_0x5690fa[_0x22c2('0x48')],_0x27279b[_0x22c2('0x4a')]));_0x3a91b3[_0x22c2('0x53')][_0x22c2('0x67')]=_0x4ab795['id'];if(_0x5690fa[_0x22c2('0x48')][_0x22c2('0x55')]){_0x3a91b3[_0x22c2('0x53')]=_[_0x22c2('0x56')](_0x3a91b3[_0x22c2('0x53')],{'$or':_[_0x22c2('0x42')](_0x3a91b3[_0x22c2('0x4c')],function(_0x7801b3){var _0x46d353={};_0x46d353[_0x7801b3]={'$like':'%'+_0x5690fa['query'][_0x22c2('0x55')]+'%'};return _0x46d353;})});}_0x3a91b3=_['merge']({},_0x3a91b3,_0x5690fa[_0x22c2('0x57')]);return db['ChatOfflineMessage'][_0x22c2('0x2f')]({'where':_0x3a91b3[_0x22c2('0x53')]})[_0x22c2('0x38')](function(_0x177807){_0x59f493[_0x22c2('0x2f')]=_0x177807;if(_0x5690fa['query'][_0x22c2('0x58')]){_0x3a91b3['include']=[{'all':!![]}];}else{_0x3a91b3[_0x22c2('0x59')]=[{'model':db[_0x22c2('0x8b')],'as':_0x22c2('0xe6'),'required':![]}];}return db[_0x22c2('0x116')]['findAll'](_0x3a91b3);})[_0x22c2('0x38')](function(_0x3ec43f){_0x59f493['rows']=_0x3ec43f;return _0x59f493;});}})[_0x22c2('0x38')](respondWithFilteredResult(_0x330505,_0x3a91b3))[_0x22c2('0x2a')](handleError(_0x330505,null));};exports[_0x22c2('0x117')]=function(_0x517694,_0x1049e2,_0x4eb694){return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x517694[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x1049e2,null))[_0x22c2('0x38')](function(_0x2c1f93){if(_0x2c1f93){return _0x2c1f93[_0x22c2('0x117')](_0x517694[_0x22c2('0x5e')][_0x22c2('0x6b')],_[_0x22c2('0xe4')](_0x517694[_0x22c2('0x5e')],[_0x22c2('0x6b'),'id'])||{})['spread'](function(_0x4de7cc){for(var _0x149114=0x0;_0x149114<_0x517694['body'][_0x22c2('0x6b')][_0x22c2('0x4e')];_0x149114+=0x1){socket[_0x22c2('0x118')]('userChatWebsite:save',{'UserId':_0x517694['body'][_0x22c2('0x6b')][_0x149114],'ChatWebsiteId':_0x517694[_0x22c2('0x5b')]['id']});}return _0x4de7cc;});}})[_0x22c2('0x38')](respondWithResult(_0x1049e2,null))[_0x22c2('0x2a')](handleError(_0x1049e2,null));};exports[_0x22c2('0x119')]=function(_0x396779,_0x4f3f77,_0x2c1421){return db['ChatWebsite'][_0x22c2('0x5c')]({'where':{'id':_0x396779[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x4f3f77,null))['then'](function(_0x266e4a){if(_0x266e4a){return _0x266e4a[_0x22c2('0x119')](_0x396779['query'][_0x22c2('0x6b')])['then'](function(){if(_[_0x22c2('0x11a')](_0x396779[_0x22c2('0x48')][_0x22c2('0x6b')])){for(var _0x4cddc1=0x0;_0x4cddc1<_0x396779[_0x22c2('0x48')][_0x22c2('0x6b')][_0x22c2('0x4e')];_0x4cddc1+=0x1){socket[_0x22c2('0x118')](_0x22c2('0x11b'),{'UserId':Number(_0x396779[_0x22c2('0x48')][_0x22c2('0x6b')][_0x4cddc1]),'ChatWebsiteId':Number(_0x396779[_0x22c2('0x5b')]['id'])});}}else{socket[_0x22c2('0x118')](_0x22c2('0x11b'),{'UserId':Number(_0x396779[_0x22c2('0x48')][_0x22c2('0x6b')]),'ChatWebsiteId':Number(_0x396779['params']['id'])});}});}})[_0x22c2('0x38')](respondWithStatusCode(_0x4f3f77,null))[_0x22c2('0x2a')](handleError(_0x4f3f77,null));};exports[_0x22c2('0x11c')]=function(_0x2cc5ca,_0x188ea1,_0x486660){var _0x2008d3={};var _0x154a53={};var _0x4832cf;var _0x351464;return db[_0x22c2('0x43')][_0x22c2('0x69')]({'where':{'id':_0x2cc5ca[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x188ea1,null))[_0x22c2('0x38')](function(_0x16b52e){if(_0x16b52e){_0x4832cf=_0x16b52e;_0x154a53[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0xbe')][_0x22c2('0x44')]);_0x154a53[_0x22c2('0x48')]=_[_0x22c2('0x49')](_0x2cc5ca[_0x22c2('0x48')]);_0x154a53[_0x22c2('0x4a')]=_[_0x22c2('0x4b')](_0x154a53[_0x22c2('0x47')],_0x154a53[_0x22c2('0x48')]);_0x2008d3['attributes']=_[_0x22c2('0x4b')](_0x154a53[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0x2cc5ca[_0x22c2('0x48')][_0x22c2('0x4d')]));_0x2008d3['attributes']=_0x2008d3[_0x22c2('0x4c')]['length']?_0x2008d3[_0x22c2('0x4c')]:_0x154a53[_0x22c2('0x47')];_0x2008d3['order']=qs[_0x22c2('0x52')](_0x2cc5ca['query'][_0x22c2('0x52')]);_0x2008d3[_0x22c2('0x53')]=qs[_0x22c2('0x4a')](_[_0x22c2('0x54')](_0x2cc5ca[_0x22c2('0x48')],_0x154a53[_0x22c2('0x4a')]));if(_0x2cc5ca[_0x22c2('0x48')][_0x22c2('0x55')]){_0x2008d3[_0x22c2('0x53')]=_['merge'](_0x2008d3[_0x22c2('0x53')],{'$or':_['map'](_0x2008d3[_0x22c2('0x4c')],function(_0x1c993e){var _0x3d10b1={};_0x3d10b1[_0x1c993e]={'$like':'%'+_0x2cc5ca[_0x22c2('0x48')][_0x22c2('0x55')]+'%'};return _0x3d10b1;})});}_0x2008d3=_[_0x22c2('0x56')]({},_0x2008d3,_0x2cc5ca[_0x22c2('0x57')]);return _0x4832cf[_0x22c2('0x11c')](_0x2008d3);}})[_0x22c2('0x38')](function(_0x10ffbf){if(_0x10ffbf){_0x351464=_0x10ffbf[_0x22c2('0x4e')];if(!_0x2cc5ca[_0x22c2('0x48')][_0x22c2('0x4f')](_0x22c2('0x50'))){_0x2008d3[_0x22c2('0x31')]=qs[_0x22c2('0x31')](_0x2cc5ca[_0x22c2('0x48')][_0x22c2('0x31')]);_0x2008d3[_0x22c2('0x30')]=qs[_0x22c2('0x30')](_0x2cc5ca[_0x22c2('0x48')]['offset']);}return _0x4832cf[_0x22c2('0x11c')](_0x2008d3);}})['then'](function(_0x39dd0e){if(_0x39dd0e){return _0x39dd0e?{'count':_0x351464,'rows':_0x39dd0e}:null;}})[_0x22c2('0x38')](respondWithResult(_0x188ea1,null))['catch'](handleError(_0x188ea1,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 3e2486b..868e62d 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 _0x94c4=['hasOwnProperty','exports','events','../../mysqldb','save','remove','emit'];(function(_0x23375d,_0x20fec4){var _0x42551a=function(_0x5584a3){while(--_0x5584a3){_0x23375d['push'](_0x23375d['shift']());}};_0x42551a(++_0x20fec4);}(_0x94c4,0x11a));var _0x494c=function(_0x493ef6,_0x31f63d){_0x493ef6=_0x493ef6-0x0;var _0x2c56d4=_0x94c4[_0x493ef6];return _0x2c56d4;};'use strict';var EventEmitter=require(_0x494c('0x0'));var ChatWebsite=require(_0x494c('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x494c('0x2'),'afterUpdate':'update','afterDestroy':_0x494c('0x3')};function emitEvent(_0x1a1f6a){return function(_0x124f7d,_0x48522f,_0x5c95e6){ChatWebsiteEvents['emit'](_0x1a1f6a+':'+_0x124f7d['id'],_0x124f7d);ChatWebsiteEvents[_0x494c('0x4')](_0x1a1f6a,_0x124f7d);_0x5c95e6(null);};}for(var e in events){if(events[_0x494c('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x494c('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x2caf=['exports','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x86ba06,_0x2e50d9){var _0xafb44a=function(_0x1dd5cd){while(--_0x1dd5cd){_0x86ba06['push'](_0x86ba06['shift']());}};_0xafb44a(++_0x2e50d9);}(_0x2caf,0x6a));var _0xf2ca=function(_0x53d709,_0x1906f6){_0x53d709=_0x53d709-0x0;var _0xc1f741=_0x2caf[_0x53d709];return _0xc1f741;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf2ca('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf2ca('0x1'),'afterDestroy':_0xf2ca('0x2')};function emitEvent(_0x43b96c){return function(_0x375e8b,_0x137501,_0x27fb1b){ChatWebsiteEvents[_0xf2ca('0x3')](_0x43b96c+':'+_0x375e8b['id'],_0x375e8b);ChatWebsiteEvents['emit'](_0x43b96c,_0x375e8b);_0x27fb1b(null);};}for(var e in events){if(events[_0xf2ca('0x4')](e)){var event=events[e];ChatWebsite[_0xf2ca('0x5')](e,emitEvent(event));}}module[_0xf2ca('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index c78a4ad..b7d1c16 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 _0x6308=['bluebird','request-promise','path','rimraf','../../config/environment','define','ChatWebsite','chat_websites','lodash','../../config/logger'];(function(_0x4881f4,_0x378e1e){var _0x63112d=function(_0x1eff29){while(--_0x1eff29){_0x4881f4['push'](_0x4881f4['shift']());}};_0x63112d(++_0x378e1e);}(_0x6308,0x1f2));var _0x8630=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x6308[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0x8630('0x0'));var util=require('util');var logger=require(_0x8630('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8630('0x2'));var rp=require(_0x8630('0x3'));var fs=require('fs');var path=require(_0x8630('0x4'));var rimraf=require(_0x8630('0x5'));var config=require(_0x8630('0x6'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x1d62c8,_0x571543){return _0x1d62c8[_0x8630('0x7')](_0x8630('0x8'),attributes,{'tableName':_0x8630('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0bc=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','../../config/logger','moment','bluebird'];(function(_0x3b18d1,_0x18efa0){var _0x401044=function(_0xa9a5ed){while(--_0xa9a5ed){_0x3b18d1['push'](_0x3b18d1['shift']());}};_0x401044(++_0x18efa0);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var logger=require(_0xca0b('0x1'))('api');var moment=require(_0xca0b('0x2'));var BPromise=require(_0xca0b('0x3'));var rp=require(_0xca0b('0x4'));var fs=require('fs');var path=require(_0xca0b('0x5'));var rimraf=require(_0xca0b('0x6'));var config=require(_0xca0b('0x7'));var attributes=require(_0xca0b('0x8'));module[_0xca0b('0x9')]=function(_0x3cb084,_0x1aac00){return _0x3cb084[_0xca0b('0xa')](_0xca0b('0xb'),attributes,{'tableName':_0xca0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 76c2b46..7c7fcdd 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 _0x8952=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','then','info','request\x20sent','debug','stringify','code','error','message','ChatWebsite,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0x8952,0x17e));var _0x2895=function(_0x1ab3eb,_0x40a9ec){_0x1ab3eb=_0x1ab3eb-0x0;var _0x3afb23=_0x8952[_0x1ab3eb];return _0x3afb23;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2895('0xb')],{'host':_0x2895('0xc'),'port':0x18eb});var socket=require(_0x2895('0xd'))(new Redis(config[_0x2895('0xb')]));require(_0x2895('0xe'))['register'](socket);function respondWithRpcPromise(_0x14fb67,_0x5f2632,_0x428772){return new BPromise(function(_0x5af454,_0x5e66fc){return client['request'](_0x14fb67,_0x428772)[_0x2895('0xf')](function(_0x1829a2){logger[_0x2895('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x5f2632,_0x2895('0x11'));logger[_0x2895('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5f2632,_0x2895('0x11'),JSON[_0x2895('0x13')](_0x1829a2));if(_0x1829a2['error']){if(_0x1829a2['error'][_0x2895('0x14')]===0x1f4){logger[_0x2895('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x5f2632,_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);return _0x5e66fc(_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);}logger[_0x2895('0x15')](_0x2895('0x17'),_0x5f2632,_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);return _0x5af454(_0x1829a2[_0x2895('0x15')][_0x2895('0x16')]);}else{logger[_0x2895('0x10')](_0x2895('0x17'),_0x5f2632,_0x2895('0x11'));_0x5af454(_0x1829a2[_0x2895('0x18')][_0x2895('0x16')]);}})[_0x2895('0x19')](function(_0x2fe8fe){logger[_0x2895('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x5f2632,_0x2fe8fe);_0x5e66fc(_0x2fe8fe);});});} \ No newline at end of file +var _0xd943=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x35f9e4,_0x519505){var _0x5985a7=function(_0x5581cb){while(--_0x5581cb){_0x35f9e4['push'](_0x35f9e4['shift']());}};_0x5985a7(++_0x519505);}(_0xd943,0x15d));var _0x3d94=function(_0x5aa14a,_0x1f3a3e){_0x5aa14a=_0x5aa14a-0x0;var _0x1324eb=_0xd943[_0x5aa14a];return _0x1324eb;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 9e8b370..1a73586 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(_0x3e6647,_0x2c0d09){var _0x46bddd=function(_0xad96c0){while(--_0xad96c0){_0x3e6647['push'](_0x3e6647['shift']());}};_0x46bddd(++_0x2c0d09);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5cfd6f,_0x15a184){_0x5cfd6f=_0x5cfd6f-0x0;var _0x1e8f8b=_0x5f2f[_0x5cfd6f];return _0x1e8f8b;};'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(_0x2379ee,_0x3ac35a){var _0x485e76=function(_0x8ef4b){while(--_0x8ef4b){_0x2379ee['push'](_0x2379ee['shift']());}};_0x485e76(++_0x3ac35a);}(_0x7a54,0x106));var _0x47a5=function(_0x4d3ad6,_0x331a2d){_0x4d3ad6=_0x4d3ad6-0x0;var _0x138205=_0x7a54[_0x4d3ad6];return _0x138205;};'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 858c43c..7e5350f 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 _0xbaf0=['/:id/offline_messages','/:id/users','getAgents','post','create','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','addLogo','diskStorage','file','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','notify','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),controller['getLogo']);router['get'](_0x0baf('0x14'),controller[_0x0baf('0x15')]);router[_0x0baf('0x8')](_0x0baf('0x16'),controller['getCustomerAvatar']);router[_0x0baf('0x8')]('/:id/system_avatar',controller[_0x0baf('0x17')]);router[_0x0baf('0x8')](_0x0baf('0x18'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x8')]('/:id/snippet',controller['getSnippet']);router[_0x0baf('0x8')](_0x0baf('0x1a'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);router[_0x0baf('0x8')](_0x0baf('0x1c'),auth['isAuthenticated'](),controller[_0x0baf('0x1d')]);router[_0x0baf('0x8')](_0x0baf('0x1e'),controller[_0x0baf('0x1f')]);router[_0x0baf('0x8')](_0x0baf('0x20'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x0baf('0x8')](_0x0baf('0x21'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x22')]);router[_0x0baf('0x23')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x24')]);router[_0x0baf('0x23')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller['addDisposition']);router[_0x0baf('0x23')]('/:id/canned_answers',auth[_0x0baf('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ef0aa,_0x48a0e9,_0x4be1b9){_0x4be1b9(null,path[_0x0baf('0x25')](config[_0x0baf('0x26')],_0x0baf('0x27')));},'filename':function(_0x19d9fd,_0x3a1ba1,_0x56b299){_0x56b299(null,util[_0x0baf('0x28')](_0x0baf('0x29'),Date[_0x0baf('0x2a')](),_0x3a1ba1[_0x0baf('0x2b')]));}})});router[_0x0baf('0x23')](_0x0baf('0x13'),upload[_0x0baf('0x2c')]('file'),controller[_0x0baf('0x2d')]);var upload=multer({'storage':multer[_0x0baf('0x2e')]({'destination':function(_0xcaf13d,_0x265915,_0x55c715){_0x55c715(null,path[_0x0baf('0x25')](config[_0x0baf('0x26')],'server/files/images/avatars/'));},'filename':function(_0x44ec31,_0x32e4fb,_0x478ce8){_0x478ce8(null,util[_0x0baf('0x28')](_0x0baf('0x29'),Date[_0x0baf('0x2a')](),_0x32e4fb[_0x0baf('0x2b')]));}})});router['post'](_0x0baf('0x14'),upload[_0x0baf('0x2c')](_0x0baf('0x2f')),controller[_0x0baf('0x30')]);var upload=multer({'storage':multer[_0x0baf('0x2e')]({'destination':function(_0x275ea1,_0x2fc983,_0x2f0a45){_0x2f0a45(null,path[_0x0baf('0x25')](config[_0x0baf('0x26')],_0x0baf('0x31')));},'filename':function(_0x165d14,_0x45294a,_0x3a3353){_0x3a3353(null,util['format'](_0x0baf('0x29'),Date['now'](),_0x45294a[_0x0baf('0x2b')]));}})});router[_0x0baf('0x23')](_0x0baf('0x16'),upload[_0x0baf('0x2c')]('file'),controller[_0x0baf('0x32')]);var upload=multer({'storage':multer[_0x0baf('0x2e')]({'destination':function(_0x5088a5,_0x23d890,_0x2447c2){_0x2447c2(null,path[_0x0baf('0x25')](config[_0x0baf('0x26')],_0x0baf('0x31')));},'filename':function(_0x1b0991,_0xe03d82,_0x675461){_0x675461(null,util['format'](_0x0baf('0x29'),Date[_0x0baf('0x2a')](),_0xe03d82['originalname']));}})});router[_0x0baf('0x23')]('/:id/system_avatar',upload['single'](_0x0baf('0x2f')),controller[_0x0baf('0x33')]);router['post']('/:id/notify',controller[_0x0baf('0x34')]);router[_0x0baf('0x23')](_0x0baf('0x35'),controller[_0x0baf('0x36')]);router[_0x0baf('0x23')](_0x0baf('0x18'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x37')]);router[_0x0baf('0x23')](_0x0baf('0x1a'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x38')]);router[_0x0baf('0x23')](_0x0baf('0x1c'),auth['isAuthenticated'](),controller[_0x0baf('0x39')]);router[_0x0baf('0x23')]('/:id/users',auth[_0x0baf('0x9')](),controller[_0x0baf('0x3a')]);router[_0x0baf('0x3b')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x3c')]);router['delete'](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['destroy']);router[_0x0baf('0x3d')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x3e')]);router['delete'](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x3f')]);router[_0x0baf('0x3d')](_0x0baf('0x21'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x40')]);module[_0x0baf('0x41')]=router; \ No newline at end of file +var _0x0b0e=['/:id/notify','notify','/:id/offline','addInteraction','addApplications','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','server/files/images/logos/','format','now','originalname','single','file','root','server/files/images/avatars/','%s-%s','addAvatar','addCustomerAvatar','addSystemAvatar'];(function(_0x20b7f0,_0x25a0ae){var _0x1432fe=function(_0x1406bd){while(--_0x1406bd){_0x20b7f0['push'](_0x20b7f0['shift']());}};_0x1432fe(++_0x25a0ae);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0x0b0e[_0x4991d6];return _0x50faf7;};'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['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getDispositions']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),controller['getLogo']);router[_0xe0b0('0x8')](_0xe0b0('0x12'),controller[_0xe0b0('0x13')]);router[_0xe0b0('0x8')](_0xe0b0('0x14'),controller['getCustomerAvatar']);router[_0xe0b0('0x8')](_0xe0b0('0x15'),controller[_0xe0b0('0x16')]);router[_0xe0b0('0x8')](_0xe0b0('0x17'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router['get'](_0xe0b0('0x19'),controller[_0xe0b0('0x1a')]);router['get'](_0xe0b0('0x1b'),auth['isAuthenticated'](),controller[_0xe0b0('0x1c')]);router[_0xe0b0('0x8')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xe0b0('0x1d')]);router['get']('/:id/fields',controller['getFields']);router[_0xe0b0('0x8')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xe0b0('0x1e')]);router['get'](_0xe0b0('0x1f'),auth['isAuthenticated'](),controller[_0xe0b0('0x20')]);router[_0xe0b0('0x21')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x22')]);router[_0xe0b0('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe0b0('0x23')]);router['post'](_0xe0b0('0xf'),auth[_0xe0b0('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xe0b0('0x24')]({'destination':function(_0x503883,_0x2208d0,_0x49a727){_0x49a727(null,path[_0xe0b0('0x25')](config['root'],_0xe0b0('0x26')));},'filename':function(_0x4de537,_0x4700cc,_0x4aafbe){_0x4aafbe(null,util[_0xe0b0('0x27')]('%s-%s',Date[_0xe0b0('0x28')](),_0x4700cc[_0xe0b0('0x29')]));}})});router[_0xe0b0('0x21')](_0xe0b0('0x11'),upload[_0xe0b0('0x2a')](_0xe0b0('0x2b')),controller['addLogo']);var upload=multer({'storage':multer[_0xe0b0('0x24')]({'destination':function(_0x1b8aa8,_0x5b7a64,_0x15e13b){_0x15e13b(null,path[_0xe0b0('0x25')](config[_0xe0b0('0x2c')],_0xe0b0('0x2d')));},'filename':function(_0x3cdbd5,_0x254cad,_0x136bd4){_0x136bd4(null,util['format'](_0xe0b0('0x2e'),Date[_0xe0b0('0x28')](),_0x254cad['originalname']));}})});router['post'](_0xe0b0('0x12'),upload[_0xe0b0('0x2a')](_0xe0b0('0x2b')),controller[_0xe0b0('0x2f')]);var upload=multer({'storage':multer[_0xe0b0('0x24')]({'destination':function(_0x5866e5,_0x32acfe,_0x3231fc){_0x3231fc(null,path[_0xe0b0('0x25')](config[_0xe0b0('0x2c')],_0xe0b0('0x2d')));},'filename':function(_0x4fe835,_0x3ebf2a,_0x208945){_0x208945(null,util[_0xe0b0('0x27')](_0xe0b0('0x2e'),Date[_0xe0b0('0x28')](),_0x3ebf2a[_0xe0b0('0x29')]));}})});router[_0xe0b0('0x21')](_0xe0b0('0x14'),upload[_0xe0b0('0x2a')](_0xe0b0('0x2b')),controller[_0xe0b0('0x30')]);var upload=multer({'storage':multer[_0xe0b0('0x24')]({'destination':function(_0x1d35bc,_0x2a1c44,_0xca25d){_0xca25d(null,path['join'](config[_0xe0b0('0x2c')],_0xe0b0('0x2d')));},'filename':function(_0xace58a,_0x1eb3f9,_0x1a2d24){_0x1a2d24(null,util[_0xe0b0('0x27')](_0xe0b0('0x2e'),Date['now'](),_0x1eb3f9['originalname']));}})});router['post']('/:id/system_avatar',upload[_0xe0b0('0x2a')](_0xe0b0('0x2b')),controller[_0xe0b0('0x31')]);router['post'](_0xe0b0('0x32'),controller[_0xe0b0('0x33')]);router[_0xe0b0('0x21')](_0xe0b0('0x34'),controller['offline']);router[_0xe0b0('0x21')](_0xe0b0('0x17'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x35')]);router[_0xe0b0('0x21')](_0xe0b0('0x1b'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x36')]);router[_0xe0b0('0x21')]('/:id/proactive_actions',auth[_0xe0b0('0x9')](),controller['addProactiveActions']);router[_0xe0b0('0x21')](_0xe0b0('0x1f'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x37')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x38')]);router[_0xe0b0('0x39')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x3a')]);router[_0xe0b0('0x39')]('/:id/dispositions',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x3b')]);router['delete']('/:id/canned_answers',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x3c')]);router['delete'](_0xe0b0('0x1f'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x3d')]);module[_0xe0b0('0x3e')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index ece5512..3ced7ab 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 _0x1a61=['AmazonAWS','Google','sequelize','STRING'];(function(_0x4d43bf,_0x1d0cdc){var _0x14afee=function(_0x222cc3){while(--_0x222cc3){_0x4d43bf['push'](_0x4d43bf['shift']());}};_0x14afee(++_0x1d0cdc);}(_0x1a61,0x1e6));var _0x11a6=function(_0x55a3a2,_0x200a5c){_0x55a3a2=_0x55a3a2-0x0;var _0x4cfc91=_0x1a61[_0x55a3a2];return _0x4cfc91;};'use strict';var Sequelize=require(_0x11a6('0x0'));module['exports']={'name':{'type':Sequelize[_0x11a6('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x11a6('0x2'),_0x11a6('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x11a6('0x1')]},'data2':{'type':Sequelize[_0x11a6('0x1')]}}; \ No newline at end of file +var _0x3d49=['AmazonAWS','exports','STRING','ENUM'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3d49,0x151));var _0x93d4=function(_0x565d0a,_0x4927cc){_0x565d0a=_0x565d0a-0x0;var _0x24c211=_0x3d49[_0x565d0a];return _0x24c211;};'use strict';var Sequelize=require('sequelize');module[_0x93d4('0x0')]={'name':{'type':Sequelize[_0x93d4('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x93d4('0x2')](_0x93d4('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x93d4('0x1')]},'data2':{'type':Sequelize[_0x93d4('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 42a091f..d517561 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 _0x543b=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','rows','catch','show','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','index','CloudProvider','rawAttributes','key','model','map','query','keys'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x543b,0x14c));var _0xb543=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x543b[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xb543('0x0'));var emlformat=require(_0xb543('0x1'));var rimraf=require(_0xb543('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb543('0x3'));var rp=require(_0xb543('0x4'));var moment=require(_0xb543('0x5'));var BPromise=require(_0xb543('0x6'));var Mustache=require(_0xb543('0x7'));var util=require(_0xb543('0x8'));var path=require(_0xb543('0x9'));var sox=require(_0xb543('0xa'));var csv=require(_0xb543('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb543('0xc'));var squel=require(_0xb543('0xd'));var crypto=require(_0xb543('0xe'));var jsforce=require(_0xb543('0xf'));var deskjs=require(_0xb543('0x10'));var toCsv=require(_0xb543('0xb'));var querystring=require(_0xb543('0x11'));var Papa=require('papaparse');var Redis=require(_0xb543('0x12'));var authService=require(_0xb543('0x13'));var qs=require(_0xb543('0x14'));var as=require(_0xb543('0x15'));var hardwareService=require(_0xb543('0x16'));var logger=require(_0xb543('0x17'))('api');var utils=require(_0xb543('0x18'));var config=require(_0xb543('0x19'));var licenseUtil=require(_0xb543('0x1a'));var db=require(_0xb543('0x1b'))['db'];function respondWithStatusCode(_0x388e6e,_0x2b0792){_0x2b0792=_0x2b0792||0xcc;return function(_0x30671c){if(_0x30671c){return _0x388e6e['sendStatus'](_0x2b0792);}return _0x388e6e[_0xb543('0x1c')](_0x2b0792)[_0xb543('0x1d')]();};}function respondWithResult(_0x5030de,_0x5aa0a5){_0x5aa0a5=_0x5aa0a5||0xc8;return function(_0x4c4d6a){if(_0x4c4d6a){return _0x5030de[_0xb543('0x1c')](_0x5aa0a5)[_0xb543('0x1e')](_0x4c4d6a);}};}function respondWithFilteredResult(_0x25b9c0,_0x225ae9){return function(_0x180dce){if(_0x180dce){var _0x3bbf32=_0x180dce[_0xb543('0x1f')],_0x392134=_0x225ae9[_0xb543('0x20')],_0x1ba0f1=_0x225ae9[_0xb543('0x20')]+_0x225ae9[_0xb543('0x21')],_0xd75b62;if(_0x1ba0f1>=_0x3bbf32){_0x1ba0f1=_0x3bbf32;_0xd75b62=0xc8;}else{_0xd75b62=0xce;}_0x25b9c0['status'](_0xd75b62);return _0x25b9c0[_0xb543('0x22')](_0xb543('0x23'),_0x392134+'-'+_0x1ba0f1+'/'+_0x3bbf32)[_0xb543('0x1e')](_0x180dce);}return null;};}function patchUpdates(_0x17d388){return function(_0x237b2d){try{jsonpatch[_0xb543('0x24')](_0x237b2d,_0x17d388,!![]);}catch(_0x5b62f3){return BPromise[_0xb543('0x25')](_0x5b62f3);}return _0x237b2d[_0xb543('0x26')]();};}function saveUpdates(_0x59474e,_0x23c3f5){return function(_0x1d3f6c){if(_0x1d3f6c){return _0x1d3f6c[_0xb543('0x27')](_0x59474e)['then'](function(_0xc05eea){return _0xc05eea;});}return null;};}function removeEntity(_0x3308ad,_0x30286a){return function(_0x3e4a6b){if(_0x3e4a6b){return _0x3e4a6b[_0xb543('0x28')]()[_0xb543('0x29')](function(){_0x3308ad[_0xb543('0x1c')](0xcc)[_0xb543('0x1d')]();});}};}function handleEntityNotFound(_0x206509,_0x19fa23){return function(_0x2d33fb){if(!_0x2d33fb){_0x206509[_0xb543('0x2a')](0x194);}return _0x2d33fb;};}function handleError(_0x36f67a,_0x3db1af){_0x3db1af=_0x3db1af||0x1f4;return function(_0x1a0bbb){logger['error'](_0x1a0bbb[_0xb543('0x2b')]);if(_0x1a0bbb['name']){delete _0x1a0bbb[_0xb543('0x2c')];}_0x36f67a[_0xb543('0x1c')](_0x3db1af)['send'](_0x1a0bbb);};}exports[_0xb543('0x2d')]=function(_0x3a603d,_0x3ad721){var _0x30b74f={},_0x5030a0={},_0x2713d7={'count':0x0,'rows':[]};var _0x519fe6=_['map'](db[_0xb543('0x2e')][_0xb543('0x2f')],function(_0x3706b7){return{'name':_0x3706b7['fieldName'],'type':_0x3706b7['type'][_0xb543('0x30')]};});_0x5030a0[_0xb543('0x31')]=_[_0xb543('0x32')](_0x519fe6,_0xb543('0x2c'));_0x5030a0[_0xb543('0x33')]=_[_0xb543('0x34')](_0x3a603d['query']);_0x5030a0[_0xb543('0x35')]=_[_0xb543('0x36')](_0x5030a0[_0xb543('0x31')],_0x5030a0[_0xb543('0x33')]);_0x30b74f[_0xb543('0x37')]=_['intersection'](_0x5030a0[_0xb543('0x31')],qs[_0xb543('0x38')](_0x3a603d['query'][_0xb543('0x38')]));_0x30b74f[_0xb543('0x37')]=_0x30b74f[_0xb543('0x37')][_0xb543('0x39')]?_0x30b74f['attributes']:_0x5030a0[_0xb543('0x31')];if(!_0x3a603d['query'][_0xb543('0x3a')](_0xb543('0x3b'))){_0x30b74f[_0xb543('0x21')]=qs['limit'](_0x3a603d[_0xb543('0x33')][_0xb543('0x21')]);_0x30b74f[_0xb543('0x20')]=qs[_0xb543('0x20')](_0x3a603d['query']['offset']);}_0x30b74f[_0xb543('0x3c')]=qs[_0xb543('0x3d')](_0x3a603d[_0xb543('0x33')][_0xb543('0x3d')]);_0x30b74f[_0xb543('0x3e')]=qs[_0xb543('0x35')](_[_0xb543('0x3f')](_0x3a603d[_0xb543('0x33')],_0x5030a0[_0xb543('0x35')]),_0x519fe6);if(_0x3a603d[_0xb543('0x33')][_0xb543('0x40')]){_0x30b74f[_0xb543('0x3e')]=_[_0xb543('0x41')](_0x30b74f[_0xb543('0x3e')],{'$or':_[_0xb543('0x32')](_0x519fe6,function(_0x1e7bb9){if(_0x1e7bb9[_0xb543('0x42')]!=='VIRTUAL'){var _0xb1db9b={};_0xb1db9b[_0x1e7bb9[_0xb543('0x2c')]]={'$like':'%'+_0x3a603d[_0xb543('0x33')][_0xb543('0x40')]+'%'};return _0xb1db9b;}})});}_0x30b74f=_[_0xb543('0x41')]({},_0x30b74f,_0x3a603d[_0xb543('0x43')]);var _0x50c84c={'where':_0x30b74f[_0xb543('0x3e')]};return db[_0xb543('0x2e')][_0xb543('0x1f')](_0x50c84c)['then'](function(_0x1ce591){_0x2713d7[_0xb543('0x1f')]=_0x1ce591;if(_0x3a603d['query']['includeAll']){_0x30b74f[_0xb543('0x44')]=[{'all':!![]}];}return db[_0xb543('0x2e')]['findAll'](_0x30b74f);})['then'](function(_0x229541){_0x2713d7[_0xb543('0x45')]=_0x229541;return _0x2713d7;})[_0xb543('0x29')](respondWithFilteredResult(_0x3ad721,_0x30b74f))[_0xb543('0x46')](handleError(_0x3ad721,null));};exports[_0xb543('0x47')]=function(_0xee5e91,_0x5383b3){var _0x3e500b={'raw':!![],'where':{'id':_0xee5e91[_0xb543('0x48')]['id']}},_0x4f85a5={};_0x4f85a5[_0xb543('0x31')]=_[_0xb543('0x34')](db[_0xb543('0x2e')][_0xb543('0x2f')]);_0x4f85a5[_0xb543('0x33')]=_[_0xb543('0x34')](_0xee5e91[_0xb543('0x33')]);_0x4f85a5[_0xb543('0x35')]=_[_0xb543('0x36')](_0x4f85a5[_0xb543('0x31')],_0x4f85a5[_0xb543('0x33')]);_0x3e500b[_0xb543('0x37')]=_[_0xb543('0x36')](_0x4f85a5[_0xb543('0x31')],qs[_0xb543('0x38')](_0xee5e91[_0xb543('0x33')][_0xb543('0x38')]));_0x3e500b[_0xb543('0x37')]=_0x3e500b[_0xb543('0x37')]['length']?_0x3e500b[_0xb543('0x37')]:_0x4f85a5['model'];if(_0xee5e91[_0xb543('0x33')][_0xb543('0x49')]){_0x3e500b[_0xb543('0x44')]=[{'all':!![]}];}_0x3e500b=_['merge']({},_0x3e500b,_0xee5e91['options']);return db['CloudProvider'][_0xb543('0x4a')](_0x3e500b)[_0xb543('0x29')](handleEntityNotFound(_0x5383b3,null))['then'](respondWithResult(_0x5383b3,null))[_0xb543('0x46')](handleError(_0x5383b3,null));};exports[_0xb543('0x4b')]=function(_0x523370,_0x9dc213){return db['CloudProvider'][_0xb543('0x4b')](_0x523370[_0xb543('0x4c')],{})['then'](respondWithResult(_0x9dc213,0xc9))[_0xb543('0x46')](handleError(_0x9dc213,null));};exports[_0xb543('0x27')]=function(_0x1d8fc4,_0x1797db){if(_0x1d8fc4[_0xb543('0x4c')]['id']){delete _0x1d8fc4[_0xb543('0x4c')]['id'];}return db[_0xb543('0x2e')][_0xb543('0x4a')]({'where':{'id':_0x1d8fc4['params']['id']}})['then'](handleEntityNotFound(_0x1797db,null))[_0xb543('0x29')](saveUpdates(_0x1d8fc4[_0xb543('0x4c')],null))[_0xb543('0x29')](respondWithResult(_0x1797db,null))[_0xb543('0x46')](handleError(_0x1797db,null));};exports['destroy']=function(_0x61c0d0,_0x1e9067){return db[_0xb543('0x2e')]['find']({'where':{'id':_0x61c0d0['params']['id']}})[_0xb543('0x29')](handleEntityNotFound(_0x1e9067,null))[_0xb543('0x29')](removeEntity(_0x1e9067,null))['catch'](handleError(_0x1e9067,null));}; \ No newline at end of file +var _0xcc55=['type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','destroy','error','name','index','map','CloudProvider','rawAttributes'];(function(_0x9bb8a6,_0x3a6235){var _0x2d3076=function(_0x25a71b){while(--_0x25a71b){_0x9bb8a6['push'](_0x9bb8a6['shift']());}};_0x2d3076(++_0x3a6235);}(_0xcc55,0x173));var _0x5cc5=function(_0x10821a,_0x35fd5f){_0x10821a=_0x10821a-0x0;var _0x1a9105=_0xcc55[_0x10821a];return _0x1a9105;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5cc5('0x0'));var rimraf=require(_0x5cc5('0x1'));var zipdir=require(_0x5cc5('0x2'));var jsonpatch=require(_0x5cc5('0x3'));var rp=require('request-promise');var moment=require(_0x5cc5('0x4'));var BPromise=require(_0x5cc5('0x5'));var Mustache=require('mustache');var util=require(_0x5cc5('0x6'));var path=require(_0x5cc5('0x7'));var sox=require(_0x5cc5('0x8'));var csv=require(_0x5cc5('0x9'));var ejs=require(_0x5cc5('0xa'));var fs=require('fs');var _=require(_0x5cc5('0xb'));var squel=require(_0x5cc5('0xc'));var crypto=require(_0x5cc5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5cc5('0xe'));var toCsv=require(_0x5cc5('0x9'));var querystring=require('querystring');var Papa=require(_0x5cc5('0xf'));var Redis=require('ioredis');var authService=require(_0x5cc5('0x10'));var qs=require(_0x5cc5('0x11'));var as=require(_0x5cc5('0x12'));var hardwareService=require(_0x5cc5('0x13'));var logger=require(_0x5cc5('0x14'))('api');var utils=require(_0x5cc5('0x15'));var config=require(_0x5cc5('0x16'));var licenseUtil=require(_0x5cc5('0x17'));var db=require(_0x5cc5('0x18'))['db'];function respondWithStatusCode(_0x3a0303,_0x1c2e7f){_0x1c2e7f=_0x1c2e7f||0xcc;return function(_0x3d877d){if(_0x3d877d){return _0x3a0303[_0x5cc5('0x19')](_0x1c2e7f);}return _0x3a0303[_0x5cc5('0x1a')](_0x1c2e7f)[_0x5cc5('0x1b')]();};}function respondWithResult(_0x14c1c8,_0x154970){_0x154970=_0x154970||0xc8;return function(_0x1b5a44){if(_0x1b5a44){return _0x14c1c8[_0x5cc5('0x1a')](_0x154970)[_0x5cc5('0x1c')](_0x1b5a44);}};}function respondWithFilteredResult(_0x28b540,_0x5933ae){return function(_0x104bcc){if(_0x104bcc){var _0x454b6f=_0x104bcc[_0x5cc5('0x1d')],_0x28b517=_0x5933ae[_0x5cc5('0x1e')],_0x585c9c=_0x5933ae[_0x5cc5('0x1e')]+_0x5933ae[_0x5cc5('0x1f')],_0x26cd2d;if(_0x585c9c>=_0x454b6f){_0x585c9c=_0x454b6f;_0x26cd2d=0xc8;}else{_0x26cd2d=0xce;}_0x28b540[_0x5cc5('0x1a')](_0x26cd2d);return _0x28b540[_0x5cc5('0x20')]('Content-Range',_0x28b517+'-'+_0x585c9c+'/'+_0x454b6f)['json'](_0x104bcc);}return null;};}function patchUpdates(_0x41af00){return function(_0x3c55c5){try{jsonpatch['apply'](_0x3c55c5,_0x41af00,!![]);}catch(_0x1517b3){return BPromise[_0x5cc5('0x21')](_0x1517b3);}return _0x3c55c5['save']();};}function saveUpdates(_0x533a87,_0x39bd3b){return function(_0x3e7cca){if(_0x3e7cca){return _0x3e7cca[_0x5cc5('0x22')](_0x533a87)[_0x5cc5('0x23')](function(_0x38fe19){return _0x38fe19;});}return null;};}function removeEntity(_0x1adeb2,_0x21b8bc){return function(_0x45df89){if(_0x45df89){return _0x45df89[_0x5cc5('0x24')]()[_0x5cc5('0x23')](function(){_0x1adeb2[_0x5cc5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1323f3,_0x3fd1d8){return function(_0x1e63d2){if(!_0x1e63d2){_0x1323f3[_0x5cc5('0x19')](0x194);}return _0x1e63d2;};}function handleError(_0x1b4f01,_0x3cfc47){_0x3cfc47=_0x3cfc47||0x1f4;return function(_0x1d55f4){logger[_0x5cc5('0x25')](_0x1d55f4['stack']);if(_0x1d55f4['name']){delete _0x1d55f4[_0x5cc5('0x26')];}_0x1b4f01[_0x5cc5('0x1a')](_0x3cfc47)['send'](_0x1d55f4);};}exports[_0x5cc5('0x27')]=function(_0x4707de,_0x351481){var _0x31b1b6={},_0x22a86b={},_0x5ae1c4={'count':0x0,'rows':[]};var _0x41c4f1=_[_0x5cc5('0x28')](db[_0x5cc5('0x29')][_0x5cc5('0x2a')],function(_0x5ab823){return{'name':_0x5ab823['fieldName'],'type':_0x5ab823[_0x5cc5('0x2b')][_0x5cc5('0x2c')]};});_0x22a86b[_0x5cc5('0x2d')]=_['map'](_0x41c4f1,_0x5cc5('0x26'));_0x22a86b[_0x5cc5('0x2e')]=_[_0x5cc5('0x2f')](_0x4707de['query']);_0x22a86b[_0x5cc5('0x30')]=_[_0x5cc5('0x31')](_0x22a86b['model'],_0x22a86b[_0x5cc5('0x2e')]);_0x31b1b6[_0x5cc5('0x32')]=_['intersection'](_0x22a86b[_0x5cc5('0x2d')],qs['fields'](_0x4707de['query'][_0x5cc5('0x33')]));_0x31b1b6[_0x5cc5('0x32')]=_0x31b1b6['attributes']['length']?_0x31b1b6[_0x5cc5('0x32')]:_0x22a86b[_0x5cc5('0x2d')];if(!_0x4707de[_0x5cc5('0x2e')][_0x5cc5('0x34')](_0x5cc5('0x35'))){_0x31b1b6['limit']=qs[_0x5cc5('0x1f')](_0x4707de['query'][_0x5cc5('0x1f')]);_0x31b1b6[_0x5cc5('0x1e')]=qs[_0x5cc5('0x1e')](_0x4707de[_0x5cc5('0x2e')][_0x5cc5('0x1e')]);}_0x31b1b6[_0x5cc5('0x36')]=qs[_0x5cc5('0x37')](_0x4707de[_0x5cc5('0x2e')][_0x5cc5('0x37')]);_0x31b1b6['where']=qs[_0x5cc5('0x30')](_['pick'](_0x4707de[_0x5cc5('0x2e')],_0x22a86b[_0x5cc5('0x30')]),_0x41c4f1);if(_0x4707de[_0x5cc5('0x2e')][_0x5cc5('0x38')]){_0x31b1b6[_0x5cc5('0x39')]=_['merge'](_0x31b1b6['where'],{'$or':_[_0x5cc5('0x28')](_0x41c4f1,function(_0x508365){if(_0x508365[_0x5cc5('0x2b')]!==_0x5cc5('0x3a')){var _0x35da6c={};_0x35da6c[_0x508365[_0x5cc5('0x26')]]={'$like':'%'+_0x4707de[_0x5cc5('0x2e')][_0x5cc5('0x38')]+'%'};return _0x35da6c;}})});}_0x31b1b6=_[_0x5cc5('0x3b')]({},_0x31b1b6,_0x4707de[_0x5cc5('0x3c')]);var _0x55cf85={'where':_0x31b1b6[_0x5cc5('0x39')]};return db[_0x5cc5('0x29')][_0x5cc5('0x1d')](_0x55cf85)[_0x5cc5('0x23')](function(_0xcad360){_0x5ae1c4[_0x5cc5('0x1d')]=_0xcad360;if(_0x4707de[_0x5cc5('0x2e')][_0x5cc5('0x3d')]){_0x31b1b6['include']=[{'all':!![]}];}return db[_0x5cc5('0x29')]['findAll'](_0x31b1b6);})[_0x5cc5('0x23')](function(_0x239e2d){_0x5ae1c4[_0x5cc5('0x3e')]=_0x239e2d;return _0x5ae1c4;})[_0x5cc5('0x23')](respondWithFilteredResult(_0x351481,_0x31b1b6))[_0x5cc5('0x3f')](handleError(_0x351481,null));};exports[_0x5cc5('0x40')]=function(_0x23ccbf,_0x16e594){var _0x1801d1={'raw':!![],'where':{'id':_0x23ccbf[_0x5cc5('0x41')]['id']}},_0x213b96={};_0x213b96[_0x5cc5('0x2d')]=_[_0x5cc5('0x2f')](db[_0x5cc5('0x29')]['rawAttributes']);_0x213b96[_0x5cc5('0x2e')]=_[_0x5cc5('0x2f')](_0x23ccbf['query']);_0x213b96[_0x5cc5('0x30')]=_[_0x5cc5('0x31')](_0x213b96[_0x5cc5('0x2d')],_0x213b96[_0x5cc5('0x2e')]);_0x1801d1[_0x5cc5('0x32')]=_[_0x5cc5('0x31')](_0x213b96[_0x5cc5('0x2d')],qs[_0x5cc5('0x33')](_0x23ccbf[_0x5cc5('0x2e')][_0x5cc5('0x33')]));_0x1801d1[_0x5cc5('0x32')]=_0x1801d1['attributes']['length']?_0x1801d1[_0x5cc5('0x32')]:_0x213b96[_0x5cc5('0x2d')];if(_0x23ccbf['query'][_0x5cc5('0x3d')]){_0x1801d1[_0x5cc5('0x42')]=[{'all':!![]}];}_0x1801d1=_['merge']({},_0x1801d1,_0x23ccbf['options']);return db[_0x5cc5('0x29')][_0x5cc5('0x43')](_0x1801d1)[_0x5cc5('0x23')](handleEntityNotFound(_0x16e594,null))[_0x5cc5('0x23')](respondWithResult(_0x16e594,null))[_0x5cc5('0x3f')](handleError(_0x16e594,null));};exports['create']=function(_0x3b9f0f,_0x2c93f1){return db['CloudProvider']['create'](_0x3b9f0f[_0x5cc5('0x44')],{})['then'](respondWithResult(_0x2c93f1,0xc9))[_0x5cc5('0x3f')](handleError(_0x2c93f1,null));};exports[_0x5cc5('0x22')]=function(_0x38402a,_0x410872){if(_0x38402a[_0x5cc5('0x44')]['id']){delete _0x38402a['body']['id'];}return db[_0x5cc5('0x29')][_0x5cc5('0x43')]({'where':{'id':_0x38402a[_0x5cc5('0x41')]['id']}})['then'](handleEntityNotFound(_0x410872,null))['then'](saveUpdates(_0x38402a[_0x5cc5('0x44')],null))['then'](respondWithResult(_0x410872,null))[_0x5cc5('0x3f')](handleError(_0x410872,null));};exports[_0x5cc5('0x24')]=function(_0x148e28,_0x49b287){return db['CloudProvider']['find']({'where':{'id':_0x148e28[_0x5cc5('0x41')]['id']}})['then'](handleEntityNotFound(_0x49b287,null))[_0x5cc5('0x23')](removeEntity(_0x49b287,null))['catch'](handleError(_0x49b287,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 24fd393..f9d9654 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 _0x5b28=['api','moment','bluebird','path','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','../../config/logger'];(function(_0x3a5a9b,_0xd60e4d){var _0x3d7943=function(_0x4eadc7){while(--_0x4eadc7){_0x3a5a9b['push'](_0x3a5a9b['shift']());}};_0x3d7943(++_0xd60e4d);}(_0x5b28,0x1e2));var _0x85b2=function(_0x2f8486,_0x42bf43){_0x2f8486=_0x2f8486-0x0;var _0x25e53d=_0x5b28[_0x2f8486];return _0x25e53d;};'use strict';var _=require('lodash');var util=require(_0x85b2('0x0'));var logger=require(_0x85b2('0x1'))(_0x85b2('0x2'));var moment=require(_0x85b2('0x3'));var BPromise=require(_0x85b2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x85b2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x85b2('0x6'));module[_0x85b2('0x7')]=function(_0x191ff5,_0x558c6f){return _0x191ff5[_0x85b2('0x8')](_0x85b2('0x9'),attributes,{'tableName':_0x85b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacb6=['util','moment','bluebird','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash'];(function(_0x16d369,_0xbbaa52){var _0x53c1ca=function(_0x49908d){while(--_0x49908d){_0x16d369['push'](_0x16d369['shift']());}};_0x53c1ca(++_0xbbaa52);}(_0xacb6,0xaa));var _0x6acb=function(_0xea147e,_0x364f3c){_0xea147e=_0xea147e-0x0;var _0x568031=_0xacb6[_0xea147e];return _0x568031;};'use strict';var _=require(_0x6acb('0x0'));var util=require(_0x6acb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6acb('0x2'));var BPromise=require(_0x6acb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6acb('0x4'));var attributes=require(_0x6acb('0x5'));module[_0x6acb('0x6')]=function(_0x56d5a0,_0x6f5260){return _0x56d5a0['define'](_0x6acb('0x7'),attributes,{'tableName':_0x6acb('0x8'),'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 96836f4..33c6f04 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 _0xa80b=['CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x173b68,_0x5d9619){var _0x48991f=function(_0x261ee9){while(--_0x261ee9){_0x173b68['push'](_0x173b68['shift']());}};_0x48991f(++_0x5d9619);}(_0xa80b,0x9e));var _0xba80=function(_0x458140,_0x20964a){_0x458140=_0x458140-0x0;var _0x5e4ba1=_0xa80b[_0x458140];return _0x5e4ba1;};'use strict';var _=require('lodash');var util=require(_0xba80('0x0'));var moment=require(_0xba80('0x1'));var BPromise=require(_0xba80('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba80('0x3'));var db=require(_0xba80('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xba80('0x5'))('rpc');var config=require(_0xba80('0x6'));var jayson=require(_0xba80('0x7'));var client=jayson[_0xba80('0x8')][_0xba80('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f4d03,_0x136637,_0xd47ea2){return new BPromise(function(_0x18b6a2,_0x59456d){return client[_0xba80('0xa')](_0x4f4d03,_0xd47ea2)[_0xba80('0xb')](function(_0x251dda){logger[_0xba80('0xc')](_0xba80('0xd'),_0x136637,'request\x20sent');logger['debug'](_0xba80('0xe'),_0x136637,_0xba80('0xf'),JSON['stringify'](_0x251dda));if(_0x251dda[_0xba80('0x10')]){if(_0x251dda[_0xba80('0x10')]['code']===0x1f4){logger[_0xba80('0x10')](_0xba80('0xd'),_0x136637,_0x251dda[_0xba80('0x10')][_0xba80('0x11')]);return _0x59456d(_0x251dda[_0xba80('0x10')][_0xba80('0x11')]);}logger['error'](_0xba80('0xd'),_0x136637,_0x251dda['error'][_0xba80('0x11')]);return _0x18b6a2(_0x251dda[_0xba80('0x10')][_0xba80('0x11')]);}else{logger['info'](_0xba80('0xd'),_0x136637,_0xba80('0xf'));_0x18b6a2(_0x251dda[_0xba80('0x12')][_0xba80('0x11')]);}})['catch'](function(_0x5485cd){logger[_0xba80('0x10')]('CloudProvider,\x20%s,\x20%s',_0x136637,_0x5485cd);_0x59456d(_0x5485cd);});});} \ No newline at end of file +var _0x4bd3=['http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xf74a50,_0x293979){var _0x3b8b71=function(_0x4147f3){while(--_0x4147f3){_0xf74a50['push'](_0xf74a50['shift']());}};_0x3b8b71(++_0x293979);}(_0x4bd3,0xee));var _0x34bd=function(_0x6f8058,_0x591872){_0x6f8058=_0x6f8058-0x0;var _0xc1e401=_0x4bd3[_0x6f8058];return _0xc1e401;};'use strict';var _=require(_0x34bd('0x0'));var util=require(_0x34bd('0x1'));var moment=require(_0x34bd('0x2'));var BPromise=require('bluebird');var rs=require(_0x34bd('0x3'));var fs=require('fs');var Redis=require(_0x34bd('0x4'));var db=require(_0x34bd('0x5'))['db'];var utils=require(_0x34bd('0x6'));var logger=require(_0x34bd('0x7'))(_0x34bd('0x8'));var config=require(_0x34bd('0x9'));var jayson=require(_0x34bd('0xa'));var client=jayson[_0x34bd('0xb')][_0x34bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b8a4b,_0x8ce95f,_0xa552ba){return new BPromise(function(_0x23c7e1,_0x3f1ad8){return client['request'](_0x3b8a4b,_0xa552ba)[_0x34bd('0xd')](function(_0x240817){logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x8ce95f,_0x34bd('0x10'));logger[_0x34bd('0x11')](_0x34bd('0x12'),_0x8ce95f,'request\x20sent',JSON[_0x34bd('0x13')](_0x240817));if(_0x240817[_0x34bd('0x14')]){if(_0x240817['error'][_0x34bd('0x15')]===0x1f4){logger[_0x34bd('0x14')](_0x34bd('0xf'),_0x8ce95f,_0x240817[_0x34bd('0x14')][_0x34bd('0x16')]);return _0x3f1ad8(_0x240817['error'][_0x34bd('0x16')]);}logger[_0x34bd('0x14')]('CloudProvider,\x20%s,\x20%s',_0x8ce95f,_0x240817[_0x34bd('0x14')][_0x34bd('0x16')]);return _0x23c7e1(_0x240817['error']['message']);}else{logger['info'](_0x34bd('0xf'),_0x8ce95f,'request\x20sent');_0x23c7e1(_0x240817[_0x34bd('0x17')][_0x34bd('0x16')]);}})[_0x34bd('0x18')](function(_0x5ac9b6){logger[_0x34bd('0x14')]('CloudProvider,\x20%s,\x20%s',_0x8ce95f,_0x5ac9b6);_0x3f1ad8(_0x5ac9b6);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 29b6b15..06b4577 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 _0x5ca8=['show','post','create','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','index','/:id','isAuthenticated'];(function(_0x2c5ff3,_0xf7e6b2){var _0x131838=function(_0x2cf1c6){while(--_0x2cf1c6){_0x2c5ff3['push'](_0x2c5ff3['shift']());}};_0x131838(++_0xf7e6b2);}(_0x5ca8,0x71));var _0x85ca=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5ca8[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x85ca('0x0'));var util=require(_0x85ca('0x1'));var path=require(_0x85ca('0x2'));var timeout=require(_0x85ca('0x3'));var express=require(_0x85ca('0x4'));var router=express[_0x85ca('0x5')]();var auth=require(_0x85ca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x85ca('0x7'));var controller=require(_0x85ca('0x8'));router[_0x85ca('0x9')]('/',auth['isAuthenticated'](),controller[_0x85ca('0xa')]);router['get'](_0x85ca('0xb'),auth[_0x85ca('0xc')](),controller[_0x85ca('0xd')]);router[_0x85ca('0xe')]('/',auth['isAuthenticated'](),controller[_0x85ca('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x85ca('0x10')]);router['delete'](_0x85ca('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x85ca('0x11')]=router; \ No newline at end of file +var _0x372d=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x372d,0x145));var _0xd372=function(_0x6968b9,_0x28e182){_0x6968b9=_0x6968b9-0x0;var _0x40dd4c=_0x372d[_0x6968b9];return _0x40dd4c;};'use strict';var multer=require(_0xd372('0x0'));var util=require(_0xd372('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd372('0x2'));var router=express[_0xd372('0x3')]();var auth=require(_0xd372('0x4'));var interaction=require(_0xd372('0x5'));var config=require(_0xd372('0x6'));var controller=require('./cloudProvider.controller');router[_0xd372('0x7')]('/',auth[_0xd372('0x8')](),controller[_0xd372('0x9')]);router[_0xd372('0x7')](_0xd372('0xa'),auth['isAuthenticated'](),controller[_0xd372('0xb')]);router[_0xd372('0xc')]('/',auth[_0xd372('0x8')](),controller['create']);router[_0xd372('0xd')](_0xd372('0xa'),auth['isAuthenticated'](),controller[_0xd372('0xe')]);router[_0xd372('0xf')]('/:id',auth[_0xd372('0x8')](),controller[_0xd372('0x10')]);module[_0xd372('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index d1614a8..43127ba 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 _0x200b=['exports','STRING','name'];(function(_0x434849,_0x27a13a){var _0x265681=function(_0x45b575){while(--_0x45b575){_0x434849['push'](_0x434849['shift']());}};_0x265681(++_0x27a13a);}(_0x200b,0x1c5));var _0xb200=function(_0x3076de,_0x3cd521){_0x3076de=_0x3076de-0x0;var _0x3510ce=_0x200b[_0x3076de];return _0x3510ce;};'use strict';var Sequelize=require('sequelize');module[_0xb200('0x0')]={'name':{'type':Sequelize[_0xb200('0x1')],'unique':_0xb200('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb200('0x1')]},'companyId':{'type':Sequelize[_0xb200('0x1')]},'website':{'type':Sequelize[_0xb200('0x1')]},'phone':{'type':Sequelize[_0xb200('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb200('0x1')]},'street':{'type':Sequelize[_0xb200('0x1')]},'postalCode':{'type':Sequelize[_0xb200('0x1')]},'city':{'type':Sequelize[_0xb200('0x1')]},'country':{'type':Sequelize[_0xb200('0x1')]},'email':{'type':Sequelize[_0xb200('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xb200('0x1')]},'sCity':{'type':Sequelize[_0xb200('0x1')]},'sCountry':{'type':Sequelize[_0xb200('0x1')]},'description':{'type':Sequelize[_0xb200('0x1')]}}; \ No newline at end of file +var _0xc663=['STRING','sequelize','exports'];(function(_0x405508,_0xf386a){var _0x4af83c=function(_0x52ba5c){while(--_0x52ba5c){_0x405508['push'](_0x405508['shift']());}};_0x4af83c(++_0xf386a);}(_0xc663,0x139));var _0x3c66=function(_0x4a973e,_0x29034b){_0x4a973e=_0x4a973e-0x0;var _0x36b56e=_0xc663[_0x4a973e];return _0x36b56e;};'use strict';var Sequelize=require(_0x3c66('0x0'));module[_0x3c66('0x1')]={'name':{'type':Sequelize[_0x3c66('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3c66('0x2')]},'companyId':{'type':Sequelize[_0x3c66('0x2')]},'website':{'type':Sequelize[_0x3c66('0x2')]},'phone':{'type':Sequelize[_0x3c66('0x2')]},'fax':{'type':Sequelize[_0x3c66('0x2')]},'type':{'type':Sequelize[_0x3c66('0x2')]},'street':{'type':Sequelize[_0x3c66('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3c66('0x2')]},'country':{'type':Sequelize[_0x3c66('0x2')]},'email':{'type':Sequelize[_0x3c66('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x3c66('0x2')]},'sStreet':{'type':Sequelize[_0x3c66('0x2')]},'sPostalCode':{'type':Sequelize[_0x3c66('0x2')]},'sCity':{'type':Sequelize[_0x3c66('0x2')]},'sCountry':{'type':Sequelize[_0x3c66('0x2')]},'description':{'type':Sequelize[_0x3c66('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index dd50d78..bf2620f 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 _0x1a31=['set','apply','save','update','then','destroy','Companies','end','error','stack','name','send','index','CmCompany','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','options','where','count','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','ids','omit','getContacts','findOne','CmContact','rawAttributes','map','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x1a31,0x96));var _0x11a3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x1a31[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require(_0x11a3('0x0'));var emlformat=require(_0x11a3('0x1'));var rimraf=require(_0x11a3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11a3('0x3'));var rp=require(_0x11a3('0x4'));var moment=require(_0x11a3('0x5'));var BPromise=require(_0x11a3('0x6'));var Mustache=require(_0x11a3('0x7'));var util=require('util');var path=require('path');var sox=require(_0x11a3('0x8'));var csv=require(_0x11a3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x11a3('0xa'));var squel=require(_0x11a3('0xb'));var crypto=require(_0x11a3('0xc'));var jsforce=require(_0x11a3('0xd'));var deskjs=require(_0x11a3('0xe'));var toCsv=require(_0x11a3('0x9'));var querystring=require(_0x11a3('0xf'));var Papa=require(_0x11a3('0x10'));var Redis=require(_0x11a3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x11a3('0x12'));var as=require(_0x11a3('0x13'));var hardwareService=require(_0x11a3('0x14'));var logger=require(_0x11a3('0x15'))(_0x11a3('0x16'));var utils=require(_0x11a3('0x17'));var config=require(_0x11a3('0x18'));var licenseUtil=require(_0x11a3('0x19'));var db=require(_0x11a3('0x1a'))['db'];function respondWithStatusCode(_0x345af1,_0x448dd3){_0x448dd3=_0x448dd3||0xcc;return function(_0x5d0278){if(_0x5d0278){return _0x345af1[_0x11a3('0x1b')](_0x448dd3);}return _0x345af1[_0x11a3('0x1c')](_0x448dd3)['end']();};}function respondWithResult(_0x1232ea,_0x35ac63){_0x35ac63=_0x35ac63||0xc8;return function(_0xbe7c11){if(_0xbe7c11){return _0x1232ea[_0x11a3('0x1c')](_0x35ac63)[_0x11a3('0x1d')](_0xbe7c11);}};}function respondWithFilteredResult(_0x5b1f39,_0x1fcf4f){return function(_0x339472){if(_0x339472){var _0x1c4c74=_0x339472['count'],_0x5ac40f=_0x1fcf4f[_0x11a3('0x1e')],_0xc78ef0=_0x1fcf4f['offset']+_0x1fcf4f[_0x11a3('0x1f')],_0x1ff4a4;if(_0xc78ef0>=_0x1c4c74){_0xc78ef0=_0x1c4c74;_0x1ff4a4=0xc8;}else{_0x1ff4a4=0xce;}_0x5b1f39['status'](_0x1ff4a4);return _0x5b1f39[_0x11a3('0x20')]('Content-Range',_0x5ac40f+'-'+_0xc78ef0+'/'+_0x1c4c74)[_0x11a3('0x1d')](_0x339472);}return null;};}function patchUpdates(_0x1b23dc){return function(_0x1783bf){try{jsonpatch[_0x11a3('0x21')](_0x1783bf,_0x1b23dc,!![]);}catch(_0x101ef1){return BPromise['reject'](_0x101ef1);}return _0x1783bf[_0x11a3('0x22')]();};}function saveUpdates(_0x26ce51,_0x461a20){return function(_0x2d27a5){if(_0x2d27a5){return _0x2d27a5[_0x11a3('0x23')](_0x26ce51)[_0x11a3('0x24')](function(_0x2eee21){return _0x2eee21;});}return null;};}function removeEntity(_0x11817b,_0x48945a){return function(_0x2bc55e){if(_0x2bc55e){return _0x2bc55e[_0x11a3('0x25')]()[_0x11a3('0x24')](function(){var _0x3de83e=_0x2bc55e['get']({'plain':!![]});var _0x1d67eb=_0x11a3('0x26');return db['UserProfileResource'][_0x11a3('0x25')]({'where':{'type':_0x1d67eb,'resourceId':_0x3de83e['id']}})[_0x11a3('0x24')](function(){return _0x2bc55e;});})[_0x11a3('0x24')](function(){_0x11817b[_0x11a3('0x1c')](0xcc)[_0x11a3('0x27')]();});}};}function handleEntityNotFound(_0xdf69f6,_0x76d2ed){return function(_0x2bd655){if(!_0x2bd655){_0xdf69f6['sendStatus'](0x194);}return _0x2bd655;};}function handleError(_0x585d5e,_0x5632e3){_0x5632e3=_0x5632e3||0x1f4;return function(_0x348a56){logger[_0x11a3('0x28')](_0x348a56[_0x11a3('0x29')]);if(_0x348a56['name']){delete _0x348a56[_0x11a3('0x2a')];}_0x585d5e[_0x11a3('0x1c')](_0x5632e3)[_0x11a3('0x2b')](_0x348a56);};}exports[_0x11a3('0x2c')]=function(_0xa21b5c,_0x1b4bda){var _0x45b4bb={},_0x3091e6={},_0x1ad184={'count':0x0,'rows':[]};return db[_0x11a3('0x2d')]['describe']()[_0x11a3('0x24')](function(_0x545482){_0x3091e6['model']=_['keys'](_0x545482);_0x3091e6[_0x11a3('0x2e')]=_['keys'](_0xa21b5c[_0x11a3('0x2e')]);_0x3091e6['filters']=_[_0x11a3('0x2f')](_0x3091e6[_0x11a3('0x30')],_0x3091e6[_0x11a3('0x2e')]);_0x45b4bb['attributes']=_['intersection'](_0x3091e6[_0x11a3('0x30')],qs[_0x11a3('0x31')](_0xa21b5c['query'][_0x11a3('0x31')]));_0x45b4bb['attributes']=_0x45b4bb[_0x11a3('0x32')][_0x11a3('0x33')]?_0x45b4bb['attributes']:_0x3091e6[_0x11a3('0x30')];if(!_0xa21b5c[_0x11a3('0x2e')][_0x11a3('0x34')](_0x11a3('0x35'))){_0x45b4bb[_0x11a3('0x1f')]=qs[_0x11a3('0x1f')](_0xa21b5c[_0x11a3('0x2e')][_0x11a3('0x1f')]);_0x45b4bb[_0x11a3('0x1e')]=qs[_0x11a3('0x1e')](_0xa21b5c[_0x11a3('0x2e')]['offset']);}_0x45b4bb[_0x11a3('0x36')]=qs['sort'](_0xa21b5c[_0x11a3('0x2e')][_0x11a3('0x37')]);_0x45b4bb['where']=qs['filters'](_[_0x11a3('0x38')](_0xa21b5c[_0x11a3('0x2e')],_0x3091e6[_0x11a3('0x39')]),_0x545482);if(_0xa21b5c['query'][_0x11a3('0x3a')]){_0x45b4bb['where']=_['merge'](_0x45b4bb['where'],{'$or':_['map'](_0x45b4bb[_0x11a3('0x32')],function(_0x3bd481){var _0xc11418={};_0xc11418[_0x3bd481]={'$like':'%'+_0xa21b5c[_0x11a3('0x2e')]['filter']+'%'};return _0xc11418;})});}_0x45b4bb=_['merge']({},_0x45b4bb,_0xa21b5c[_0x11a3('0x3b')]);var _0x3614cb={'where':_0x45b4bb[_0x11a3('0x3c')]};return db[_0x11a3('0x2d')][_0x11a3('0x3d')](_0x3614cb)['then'](function(_0x55647c){_0x1ad184[_0x11a3('0x3d')]=_0x55647c;if(_0xa21b5c[_0x11a3('0x2e')][_0x11a3('0x3e')]){_0x45b4bb[_0x11a3('0x3f')]=[{'all':!![]}];}return db[_0x11a3('0x2d')][_0x11a3('0x40')](_0x45b4bb);})[_0x11a3('0x24')](function(_0x5288e7){_0x1ad184[_0x11a3('0x41')]=_0x5288e7;return _0x1ad184;})[_0x11a3('0x24')](respondWithFilteredResult(_0x1b4bda,_0x45b4bb))[_0x11a3('0x42')](handleError(_0x1b4bda,null));})['catch'](handleError(_0x1b4bda,null));};exports[_0x11a3('0x43')]=function(_0x120414,_0x20ac21){var _0x61f59e={'raw':![],'where':{'id':_0x120414[_0x11a3('0x44')]['id']}},_0x238465={};_0x238465[_0x11a3('0x30')]=_[_0x11a3('0x45')](db[_0x11a3('0x2d')]['rawAttributes']);_0x238465[_0x11a3('0x2e')]=_[_0x11a3('0x45')](_0x120414[_0x11a3('0x2e')]);_0x238465['filters']=_['intersection'](_0x238465[_0x11a3('0x30')],_0x238465['query']);_0x61f59e['attributes']=_[_0x11a3('0x2f')](_0x238465[_0x11a3('0x30')],qs[_0x11a3('0x31')](_0x120414['query'][_0x11a3('0x31')]));_0x61f59e['attributes']=_0x61f59e[_0x11a3('0x32')]['length']?_0x61f59e[_0x11a3('0x32')]:_0x238465['model'];if(_0x120414[_0x11a3('0x2e')][_0x11a3('0x3e')]){_0x61f59e['include']=[{'all':!![]}];}_0x61f59e=_[_0x11a3('0x46')]({},_0x61f59e,_0x120414[_0x11a3('0x3b')]);return db[_0x11a3('0x2d')][_0x11a3('0x47')](_0x61f59e)[_0x11a3('0x24')](handleEntityNotFound(_0x20ac21,null))[_0x11a3('0x24')](respondWithResult(_0x20ac21,null))['catch'](handleError(_0x20ac21,null));};exports[_0x11a3('0x48')]=function(_0x74ba1e,_0x1f606c){return db[_0x11a3('0x2d')]['create'](_0x74ba1e[_0x11a3('0x49')],{})[_0x11a3('0x24')](function(_0x560f72){var _0x404ded=_0x74ba1e[_0x11a3('0x4a')][_0x11a3('0x4b')]({'plain':!![]});if(!_0x404ded)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x404ded[_0x11a3('0x4c')]===_0x11a3('0x4a')){var _0x3d1a95=_0x560f72[_0x11a3('0x4b')]({'plain':!![]});var _0x537c46=_0x11a3('0x26');return db[_0x11a3('0x4d')][_0x11a3('0x47')]({'where':{'name':_0x537c46,'userProfileId':_0x404ded[_0x11a3('0x4e')]},'raw':!![]})[_0x11a3('0x24')](function(_0x5575f2){if(_0x5575f2&&_0x5575f2[_0x11a3('0x4f')]===0x0){return db[_0x11a3('0x50')]['create']({'name':_0x3d1a95['name'],'resourceId':_0x3d1a95['id'],'type':_0x5575f2[_0x11a3('0x2a')],'sectionId':_0x5575f2['id']},{})['then'](function(){return _0x560f72;});}else{return _0x560f72;}})[_0x11a3('0x42')](function(_0x2ad78c){logger['error'](_0x11a3('0x51'),_0x2ad78c);throw _0x2ad78c;});}return _0x560f72;})[_0x11a3('0x24')](respondWithResult(_0x1f606c,0xc9))[_0x11a3('0x42')](handleError(_0x1f606c,null));};exports[_0x11a3('0x23')]=function(_0x361978,_0x22511f){if(_0x361978['body']['id']){delete _0x361978[_0x11a3('0x49')]['id'];}return db[_0x11a3('0x2d')][_0x11a3('0x47')]({'where':{'id':_0x361978['params']['id']}})[_0x11a3('0x24')](handleEntityNotFound(_0x22511f,null))[_0x11a3('0x24')](saveUpdates(_0x361978[_0x11a3('0x49')],null))['then'](respondWithResult(_0x22511f,null))[_0x11a3('0x42')](handleError(_0x22511f,null));};exports[_0x11a3('0x25')]=function(_0x135ccf,_0x40c624){return db[_0x11a3('0x2d')][_0x11a3('0x47')]({'where':{'id':_0x135ccf[_0x11a3('0x44')]['id']}})['then'](handleEntityNotFound(_0x40c624,null))[_0x11a3('0x24')](removeEntity(_0x40c624,null))['catch'](handleError(_0x40c624,null));};exports[_0x11a3('0x52')]=function(_0x258d47,_0x3cf2b6){return db[_0x11a3('0x2d')][_0x11a3('0x52')]()[_0x11a3('0x24')](respondWithResult(_0x3cf2b6,null))['catch'](handleError(_0x3cf2b6,null));};exports[_0x11a3('0x53')]=function(_0xdd805b,_0x15dec5,_0x3a6e5e){return db['CmContact'][_0x11a3('0x47')]({'where':{'id':_0xdd805b[_0x11a3('0x44')]['id']}})[_0x11a3('0x24')](handleEntityNotFound(_0x15dec5,null))[_0x11a3('0x24')](function(_0x2a00b0){if(_0x2a00b0){return _0x2a00b0['addContacts'](_0xdd805b[_0x11a3('0x49')][_0x11a3('0x54')],_[_0x11a3('0x55')](_0xdd805b['body'],['ids','id'])||{});}})[_0x11a3('0x24')](respondWithResult(_0x15dec5,null))[_0x11a3('0x42')](handleError(_0x15dec5,null));};exports[_0x11a3('0x56')]=function(_0x1e65fe,_0x216a63,_0x316799){var _0xc193d1={};var _0x1aecd2={};var _0x4faa5b;var _0x3d14df;return db[_0x11a3('0x2d')][_0x11a3('0x57')]({'where':{'id':_0x1e65fe[_0x11a3('0x44')]['id']}})[_0x11a3('0x24')](handleEntityNotFound(_0x216a63,null))[_0x11a3('0x24')](function(_0x2fab12){if(_0x2fab12){_0x4faa5b=_0x2fab12;_0x1aecd2[_0x11a3('0x30')]=_[_0x11a3('0x45')](db[_0x11a3('0x58')][_0x11a3('0x59')]);_0x1aecd2[_0x11a3('0x2e')]=_[_0x11a3('0x45')](_0x1e65fe['query']);_0x1aecd2[_0x11a3('0x39')]=_[_0x11a3('0x2f')](_0x1aecd2[_0x11a3('0x30')],_0x1aecd2['query']);_0xc193d1[_0x11a3('0x32')]=_[_0x11a3('0x2f')](_0x1aecd2['model'],qs[_0x11a3('0x31')](_0x1e65fe[_0x11a3('0x2e')][_0x11a3('0x31')]));_0xc193d1[_0x11a3('0x32')]=_0xc193d1[_0x11a3('0x32')]['length']?_0xc193d1[_0x11a3('0x32')]:_0x1aecd2[_0x11a3('0x30')];_0xc193d1['order']=qs['sort'](_0x1e65fe[_0x11a3('0x2e')][_0x11a3('0x37')]);_0xc193d1[_0x11a3('0x3c')]=qs[_0x11a3('0x39')](_['pick'](_0x1e65fe[_0x11a3('0x2e')],_0x1aecd2[_0x11a3('0x39')]));if(_0x1e65fe['query'][_0x11a3('0x3a')]){_0xc193d1[_0x11a3('0x3c')]=_['merge'](_0xc193d1[_0x11a3('0x3c')],{'$or':_[_0x11a3('0x5a')](_0xc193d1[_0x11a3('0x32')],function(_0x223a06){var _0x41ba12={};_0x41ba12[_0x223a06]={'$like':'%'+_0x1e65fe['query'][_0x11a3('0x3a')]+'%'};return _0x41ba12;})});}_0xc193d1=_[_0x11a3('0x46')]({},_0xc193d1,_0x1e65fe['options']);return _0x4faa5b[_0x11a3('0x56')](_0xc193d1);}})[_0x11a3('0x24')](function(_0x18e09b){if(_0x18e09b){_0x3d14df=_0x18e09b[_0x11a3('0x33')];if(!_0x1e65fe[_0x11a3('0x2e')]['hasOwnProperty']('nolimit')){_0xc193d1[_0x11a3('0x1f')]=qs['limit'](_0x1e65fe[_0x11a3('0x2e')][_0x11a3('0x1f')]);_0xc193d1[_0x11a3('0x1e')]=qs[_0x11a3('0x1e')](_0x1e65fe[_0x11a3('0x2e')][_0x11a3('0x1e')]);}return _0x4faa5b['getContacts'](_0xc193d1);}})[_0x11a3('0x24')](function(_0x31d717){if(_0x31d717){return _0x31d717?{'count':_0x3d14df,'rows':_0x31d717}:null;}})['then'](respondWithResult(_0x216a63,null))[_0x11a3('0x42')](handleError(_0x216a63,null));}; \ No newline at end of file +var _0x400a=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','error','name','send','index','describe','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','CmCompany','includeAll','findAll','catch','show','params','rawAttributes','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','ids','getContacts','findOne','CmContact','map','options','hasOwnProperty','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x400a,0x18b));var _0xa400=function(_0x2711fb,_0x525b00){_0x2711fb=_0x2711fb-0x0;var _0x2312dd=_0x400a[_0x2711fb];return _0x2312dd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa400('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa400('0x1'));var jsonpatch=require(_0xa400('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa400('0x3'));var util=require(_0xa400('0x4'));var path=require(_0xa400('0x5'));var sox=require(_0xa400('0x6'));var csv=require(_0xa400('0x7'));var ejs=require(_0xa400('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa400('0x9'));var crypto=require(_0xa400('0xa'));var jsforce=require(_0xa400('0xb'));var deskjs=require(_0xa400('0xc'));var toCsv=require(_0xa400('0x7'));var querystring=require(_0xa400('0xd'));var Papa=require(_0xa400('0xe'));var Redis=require(_0xa400('0xf'));var authService=require(_0xa400('0x10'));var qs=require(_0xa400('0x11'));var as=require(_0xa400('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa400('0x13'))(_0xa400('0x14'));var utils=require(_0xa400('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa400('0x16'));var db=require(_0xa400('0x17'))['db'];function respondWithStatusCode(_0x1301f5,_0x1a2edf){_0x1a2edf=_0x1a2edf||0xcc;return function(_0x29a5ea){if(_0x29a5ea){return _0x1301f5[_0xa400('0x18')](_0x1a2edf);}return _0x1301f5[_0xa400('0x19')](_0x1a2edf)[_0xa400('0x1a')]();};}function respondWithResult(_0x40a358,_0x46a949){_0x46a949=_0x46a949||0xc8;return function(_0x1ef7c1){if(_0x1ef7c1){return _0x40a358[_0xa400('0x19')](_0x46a949)[_0xa400('0x1b')](_0x1ef7c1);}};}function respondWithFilteredResult(_0x3f6f86,_0x297458){return function(_0x3c8740){if(_0x3c8740){var _0x172828=_0x3c8740[_0xa400('0x1c')],_0x1b0fa1=_0x297458[_0xa400('0x1d')],_0x361da3=_0x297458[_0xa400('0x1d')]+_0x297458[_0xa400('0x1e')],_0x19e2af;if(_0x361da3>=_0x172828){_0x361da3=_0x172828;_0x19e2af=0xc8;}else{_0x19e2af=0xce;}_0x3f6f86[_0xa400('0x19')](_0x19e2af);return _0x3f6f86[_0xa400('0x1f')](_0xa400('0x20'),_0x1b0fa1+'-'+_0x361da3+'/'+_0x172828)[_0xa400('0x1b')](_0x3c8740);}return null;};}function patchUpdates(_0x5d6df5){return function(_0x59d808){try{jsonpatch[_0xa400('0x21')](_0x59d808,_0x5d6df5,!![]);}catch(_0xbcece9){return BPromise[_0xa400('0x22')](_0xbcece9);}return _0x59d808[_0xa400('0x23')]();};}function saveUpdates(_0x58be72,_0x53a36d){return function(_0x2b6a6d){if(_0x2b6a6d){return _0x2b6a6d[_0xa400('0x24')](_0x58be72)[_0xa400('0x25')](function(_0x3ad169){return _0x3ad169;});}return null;};}function removeEntity(_0x43e981,_0x5be389){return function(_0x42154d){if(_0x42154d){return _0x42154d[_0xa400('0x26')]()['then'](function(){var _0x2a2993=_0x42154d[_0xa400('0x27')]({'plain':!![]});var _0x4a0569=_0xa400('0x28');return db['UserProfileResource'][_0xa400('0x26')]({'where':{'type':_0x4a0569,'resourceId':_0x2a2993['id']}})[_0xa400('0x25')](function(){return _0x42154d;});})[_0xa400('0x25')](function(){_0x43e981[_0xa400('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51b7ac,_0x259b42){return function(_0x43324c){if(!_0x43324c){_0x51b7ac['sendStatus'](0x194);}return _0x43324c;};}function handleError(_0x90f22c,_0x418dd2){_0x418dd2=_0x418dd2||0x1f4;return function(_0x1d3f57){logger[_0xa400('0x29')](_0x1d3f57['stack']);if(_0x1d3f57[_0xa400('0x2a')]){delete _0x1d3f57['name'];}_0x90f22c['status'](_0x418dd2)[_0xa400('0x2b')](_0x1d3f57);};}exports[_0xa400('0x2c')]=function(_0x1bf9ff,_0x22cee5){var _0xb22f9={},_0x472a55={},_0x185cdc={'count':0x0,'rows':[]};return db['CmCompany'][_0xa400('0x2d')]()['then'](function(_0x1b8bf8){_0x472a55[_0xa400('0x2e')]=_['keys'](_0x1b8bf8);_0x472a55[_0xa400('0x2f')]=_[_0xa400('0x30')](_0x1bf9ff[_0xa400('0x2f')]);_0x472a55[_0xa400('0x31')]=_['intersection'](_0x472a55[_0xa400('0x2e')],_0x472a55[_0xa400('0x2f')]);_0xb22f9['attributes']=_[_0xa400('0x32')](_0x472a55['model'],qs[_0xa400('0x33')](_0x1bf9ff['query'][_0xa400('0x33')]));_0xb22f9[_0xa400('0x34')]=_0xb22f9[_0xa400('0x34')][_0xa400('0x35')]?_0xb22f9[_0xa400('0x34')]:_0x472a55['model'];if(!_0x1bf9ff[_0xa400('0x2f')]['hasOwnProperty'](_0xa400('0x36'))){_0xb22f9['limit']=qs[_0xa400('0x1e')](_0x1bf9ff[_0xa400('0x2f')][_0xa400('0x1e')]);_0xb22f9[_0xa400('0x1d')]=qs['offset'](_0x1bf9ff['query'][_0xa400('0x1d')]);}_0xb22f9[_0xa400('0x37')]=qs['sort'](_0x1bf9ff[_0xa400('0x2f')][_0xa400('0x38')]);_0xb22f9[_0xa400('0x39')]=qs['filters'](_[_0xa400('0x3a')](_0x1bf9ff[_0xa400('0x2f')],_0x472a55[_0xa400('0x31')]),_0x1b8bf8);if(_0x1bf9ff[_0xa400('0x2f')]['filter']){_0xb22f9[_0xa400('0x39')]=_['merge'](_0xb22f9[_0xa400('0x39')],{'$or':_['map'](_0xb22f9[_0xa400('0x34')],function(_0xc89893){var _0xeb9987={};_0xeb9987[_0xc89893]={'$like':'%'+_0x1bf9ff[_0xa400('0x2f')][_0xa400('0x3b')]+'%'};return _0xeb9987;})});}_0xb22f9=_['merge']({},_0xb22f9,_0x1bf9ff['options']);var _0x8ceae2={'where':_0xb22f9[_0xa400('0x39')]};return db[_0xa400('0x3c')][_0xa400('0x1c')](_0x8ceae2)[_0xa400('0x25')](function(_0x28704c){_0x185cdc[_0xa400('0x1c')]=_0x28704c;if(_0x1bf9ff[_0xa400('0x2f')][_0xa400('0x3d')]){_0xb22f9['include']=[{'all':!![]}];}return db[_0xa400('0x3c')][_0xa400('0x3e')](_0xb22f9);})[_0xa400('0x25')](function(_0x5e53a2){_0x185cdc['rows']=_0x5e53a2;return _0x185cdc;})[_0xa400('0x25')](respondWithFilteredResult(_0x22cee5,_0xb22f9))[_0xa400('0x3f')](handleError(_0x22cee5,null));})['catch'](handleError(_0x22cee5,null));};exports[_0xa400('0x40')]=function(_0x104326,_0x1eb3a6){var _0x48c412={'raw':![],'where':{'id':_0x104326[_0xa400('0x41')]['id']}},_0xc4508={};_0xc4508[_0xa400('0x2e')]=_['keys'](db['CmCompany'][_0xa400('0x42')]);_0xc4508[_0xa400('0x2f')]=_['keys'](_0x104326[_0xa400('0x2f')]);_0xc4508['filters']=_[_0xa400('0x32')](_0xc4508[_0xa400('0x2e')],_0xc4508[_0xa400('0x2f')]);_0x48c412[_0xa400('0x34')]=_['intersection'](_0xc4508['model'],qs[_0xa400('0x33')](_0x104326['query']['fields']));_0x48c412[_0xa400('0x34')]=_0x48c412['attributes'][_0xa400('0x35')]?_0x48c412[_0xa400('0x34')]:_0xc4508[_0xa400('0x2e')];if(_0x104326[_0xa400('0x2f')][_0xa400('0x3d')]){_0x48c412['include']=[{'all':!![]}];}_0x48c412=_[_0xa400('0x43')]({},_0x48c412,_0x104326['options']);return db[_0xa400('0x3c')][_0xa400('0x44')](_0x48c412)['then'](handleEntityNotFound(_0x1eb3a6,null))[_0xa400('0x25')](respondWithResult(_0x1eb3a6,null))[_0xa400('0x3f')](handleError(_0x1eb3a6,null));};exports[_0xa400('0x45')]=function(_0x2cd72b,_0x2ecc36){return db[_0xa400('0x3c')][_0xa400('0x45')](_0x2cd72b['body'],{})[_0xa400('0x25')](function(_0x2da653){var _0x2f3b86=_0x2cd72b[_0xa400('0x46')][_0xa400('0x27')]({'plain':!![]});if(!_0x2f3b86)throw new Error(_0xa400('0x47'));if(_0x2f3b86['role']===_0xa400('0x46')){var _0x4038df=_0x2da653[_0xa400('0x27')]({'plain':!![]});var _0x164f04=_0xa400('0x28');return db['UserProfileSection'][_0xa400('0x44')]({'where':{'name':_0x164f04,'userProfileId':_0x2f3b86['userProfileId']},'raw':!![]})[_0xa400('0x25')](function(_0x34b74a){if(_0x34b74a&&_0x34b74a['autoAssociation']===0x0){return db[_0xa400('0x48')][_0xa400('0x45')]({'name':_0x4038df[_0xa400('0x2a')],'resourceId':_0x4038df['id'],'type':_0x34b74a['name'],'sectionId':_0x34b74a['id']},{})['then'](function(){return _0x2da653;});}else{return _0x2da653;}})[_0xa400('0x3f')](function(_0x3a6caa){logger[_0xa400('0x29')](_0xa400('0x49'),_0x3a6caa);throw _0x3a6caa;});}return _0x2da653;})[_0xa400('0x25')](respondWithResult(_0x2ecc36,0xc9))['catch'](handleError(_0x2ecc36,null));};exports[_0xa400('0x24')]=function(_0x553a9b,_0x48f8f2){if(_0x553a9b['body']['id']){delete _0x553a9b[_0xa400('0x4a')]['id'];}return db[_0xa400('0x3c')][_0xa400('0x44')]({'where':{'id':_0x553a9b['params']['id']}})[_0xa400('0x25')](handleEntityNotFound(_0x48f8f2,null))[_0xa400('0x25')](saveUpdates(_0x553a9b['body'],null))[_0xa400('0x25')](respondWithResult(_0x48f8f2,null))[_0xa400('0x3f')](handleError(_0x48f8f2,null));};exports['destroy']=function(_0x4501f3,_0xd35bb6){return db[_0xa400('0x3c')]['find']({'where':{'id':_0x4501f3[_0xa400('0x41')]['id']}})[_0xa400('0x25')](handleEntityNotFound(_0xd35bb6,null))[_0xa400('0x25')](removeEntity(_0xd35bb6,null))[_0xa400('0x3f')](handleError(_0xd35bb6,null));};exports[_0xa400('0x2d')]=function(_0x3c7c60,_0x18beb5){return db['CmCompany'][_0xa400('0x2d')]()['then'](respondWithResult(_0x18beb5,null))[_0xa400('0x3f')](handleError(_0x18beb5,null));};exports[_0xa400('0x4b')]=function(_0x3605a5,_0x2b65ee,_0x224754){return db['CmContact']['find']({'where':{'id':_0x3605a5['params']['id']}})[_0xa400('0x25')](handleEntityNotFound(_0x2b65ee,null))[_0xa400('0x25')](function(_0x576bf0){if(_0x576bf0){return _0x576bf0['addContacts'](_0x3605a5[_0xa400('0x4a')][_0xa400('0x4c')],_['omit'](_0x3605a5[_0xa400('0x4a')],['ids','id'])||{});}})['then'](respondWithResult(_0x2b65ee,null))['catch'](handleError(_0x2b65ee,null));};exports[_0xa400('0x4d')]=function(_0x49fe63,_0x4b8b1c,_0x70ed02){var _0x2e19f6={};var _0x4feaf7={};var _0x28c647;var _0x1a0c25;return db[_0xa400('0x3c')][_0xa400('0x4e')]({'where':{'id':_0x49fe63[_0xa400('0x41')]['id']}})[_0xa400('0x25')](handleEntityNotFound(_0x4b8b1c,null))[_0xa400('0x25')](function(_0x454961){if(_0x454961){_0x28c647=_0x454961;_0x4feaf7['model']=_['keys'](db[_0xa400('0x4f')][_0xa400('0x42')]);_0x4feaf7[_0xa400('0x2f')]=_[_0xa400('0x30')](_0x49fe63[_0xa400('0x2f')]);_0x4feaf7[_0xa400('0x31')]=_['intersection'](_0x4feaf7[_0xa400('0x2e')],_0x4feaf7[_0xa400('0x2f')]);_0x2e19f6[_0xa400('0x34')]=_[_0xa400('0x32')](_0x4feaf7['model'],qs[_0xa400('0x33')](_0x49fe63[_0xa400('0x2f')][_0xa400('0x33')]));_0x2e19f6[_0xa400('0x34')]=_0x2e19f6[_0xa400('0x34')][_0xa400('0x35')]?_0x2e19f6[_0xa400('0x34')]:_0x4feaf7[_0xa400('0x2e')];_0x2e19f6[_0xa400('0x37')]=qs['sort'](_0x49fe63[_0xa400('0x2f')][_0xa400('0x38')]);_0x2e19f6[_0xa400('0x39')]=qs[_0xa400('0x31')](_[_0xa400('0x3a')](_0x49fe63[_0xa400('0x2f')],_0x4feaf7[_0xa400('0x31')]));if(_0x49fe63['query'][_0xa400('0x3b')]){_0x2e19f6[_0xa400('0x39')]=_['merge'](_0x2e19f6[_0xa400('0x39')],{'$or':_[_0xa400('0x50')](_0x2e19f6[_0xa400('0x34')],function(_0x26c579){var _0x79121d={};_0x79121d[_0x26c579]={'$like':'%'+_0x49fe63[_0xa400('0x2f')][_0xa400('0x3b')]+'%'};return _0x79121d;})});}_0x2e19f6=_[_0xa400('0x43')]({},_0x2e19f6,_0x49fe63[_0xa400('0x51')]);return _0x28c647[_0xa400('0x4d')](_0x2e19f6);}})[_0xa400('0x25')](function(_0x4b5962){if(_0x4b5962){_0x1a0c25=_0x4b5962[_0xa400('0x35')];if(!_0x49fe63[_0xa400('0x2f')][_0xa400('0x52')](_0xa400('0x36'))){_0x2e19f6['limit']=qs[_0xa400('0x1e')](_0x49fe63[_0xa400('0x2f')][_0xa400('0x1e')]);_0x2e19f6[_0xa400('0x1d')]=qs[_0xa400('0x1d')](_0x49fe63[_0xa400('0x2f')][_0xa400('0x1d')]);}return _0x28c647[_0xa400('0x4d')](_0x2e19f6);}})[_0xa400('0x25')](function(_0xf1f8e8){if(_0xf1f8e8){return _0xf1f8e8?{'count':_0x1a0c25,'rows':_0xf1f8e8}:null;}})[_0xa400('0x25')](respondWithResult(_0x4b8b1c,null))[_0xa400('0x3f')](handleError(_0x4b8b1c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 8d5eed8..1889d04 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 _0xf021=['define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x249e69,_0x4638fa){var _0x27f147=function(_0x56f3ec){while(--_0x56f3ec){_0x249e69['push'](_0x249e69['shift']());}};_0x27f147(++_0x4638fa);}(_0xf021,0x18f));var _0x1f02=function(_0x4bfc12,_0x142724){_0x4bfc12=_0x4bfc12-0x0;var _0x33b8ee=_0xf021[_0x4bfc12];return _0x33b8ee;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var logger=require(_0x1f02('0x2'))(_0x1f02('0x3'));var moment=require(_0x1f02('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f02('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f02('0x6'));var config=require(_0x1f02('0x7'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x84a8f0,_0x56b275){return _0x84a8f0[_0x1f02('0x8')](_0x1f02('0x9'),attributes,{'tableName':_0x1f02('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80d9=['api','moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','cm_companies','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80d9,0x15c));var _0x980d=function(_0x1dd5b7,_0x4046d5){_0x1dd5b7=_0x1dd5b7-0x0;var _0x1bb9a6=_0x80d9[_0x1dd5b7];return _0x1bb9a6;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var logger=require(_0x980d('0x1'))(_0x980d('0x2'));var moment=require(_0x980d('0x3'));var BPromise=require('bluebird');var rp=require(_0x980d('0x4'));var fs=require('fs');var path=require(_0x980d('0x5'));var rimraf=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var attributes=require(_0x980d('0x8'));module['exports']=function(_0x4c3533,_0x2fd4b9){return _0x4c3533['define']('CmCompany',attributes,{'tableName':_0x980d('0x9'),'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 0901703..92326ab 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 _0xc310=['error','message','result','catch','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4211bb,_0x424082){var _0x36d8e8=function(_0x8665dc){while(--_0x8665dc){_0x4211bb['push'](_0x4211bb['shift']());}};_0x36d8e8(++_0x424082);}(_0xc310,0x82));var _0x0c31=function(_0xe44faa,_0x6d5a24){_0xe44faa=_0xe44faa-0x0;var _0x244434=_0xc310[_0xe44faa];return _0x244434;};'use strict';var _=require(_0x0c31('0x0'));var util=require(_0x0c31('0x1'));var moment=require(_0x0c31('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0c31('0x3'));var logger=require(_0x0c31('0x4'))(_0x0c31('0x5'));var config=require(_0x0c31('0x6'));var jayson=require(_0x0c31('0x7'));var client=jayson[_0x0c31('0x8')][_0x0c31('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2de35d,_0xa6767,_0x352ca1){return new BPromise(function(_0x5a62b3,_0x35583e){return client[_0x0c31('0xa')](_0x2de35d,_0x352ca1)[_0x0c31('0xb')](function(_0x34a424){logger[_0x0c31('0xc')](_0x0c31('0xd'),_0xa6767,_0x0c31('0xe'));logger['debug'](_0x0c31('0xf'),_0xa6767,_0x0c31('0xe'),JSON[_0x0c31('0x10')](_0x34a424));if(_0x34a424[_0x0c31('0x11')]){if(_0x34a424[_0x0c31('0x11')]['code']===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0xa6767,_0x34a424[_0x0c31('0x11')][_0x0c31('0x12')]);return _0x35583e(_0x34a424[_0x0c31('0x11')][_0x0c31('0x12')]);}logger[_0x0c31('0x11')](_0x0c31('0xd'),_0xa6767,_0x34a424[_0x0c31('0x11')][_0x0c31('0x12')]);return _0x5a62b3(_0x34a424[_0x0c31('0x11')][_0x0c31('0x12')]);}else{logger[_0x0c31('0xc')](_0x0c31('0xd'),_0xa6767,_0x0c31('0xe'));_0x5a62b3(_0x34a424[_0x0c31('0x13')][_0x0c31('0x12')]);}})[_0x0c31('0x14')](function(_0xdea5bf){logger[_0x0c31('0x11')](_0x0c31('0xd'),_0xa6767,_0xdea5bf);_0x35583e(_0xdea5bf);});});} \ No newline at end of file +var _0x8f1c=['CmCompany,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xc7f12b,_0x2069ae){var _0x5bccf1=function(_0xca8a5f){while(--_0xca8a5f){_0xc7f12b['push'](_0xc7f12b['shift']());}};_0x5bccf1(++_0x2069ae);}(_0x8f1c,0x10d));var _0xc8f1=function(_0x525cf8,_0x180f72){_0x525cf8=_0x525cf8-0x0;var _0x2c6c30=_0x8f1c[_0x525cf8];return _0x2c6c30;};'use strict';var _=require('lodash');var util=require(_0xc8f1('0x0'));var moment=require('moment');var BPromise=require(_0xc8f1('0x1'));var rs=require(_0xc8f1('0x2'));var fs=require('fs');var Redis=require(_0xc8f1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f1('0x4'));var logger=require(_0xc8f1('0x5'))(_0xc8f1('0x6'));var config=require(_0xc8f1('0x7'));var jayson=require(_0xc8f1('0x8'));var client=jayson[_0xc8f1('0x9')][_0xc8f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bffcc,_0x2e175e,_0x30d845){return new BPromise(function(_0x30e982,_0x52bdcf){return client['request'](_0x5bffcc,_0x30d845)[_0xc8f1('0xb')](function(_0x11acc3){logger['info']('CmCompany,\x20%s,\x20%s',_0x2e175e,'request\x20sent');logger[_0xc8f1('0xc')](_0xc8f1('0xd'),_0x2e175e,_0xc8f1('0xe'),JSON[_0xc8f1('0xf')](_0x11acc3));if(_0x11acc3[_0xc8f1('0x10')]){if(_0x11acc3['error']['code']===0x1f4){logger[_0xc8f1('0x10')](_0xc8f1('0x11'),_0x2e175e,_0x11acc3[_0xc8f1('0x10')]['message']);return _0x52bdcf(_0x11acc3[_0xc8f1('0x10')][_0xc8f1('0x12')]);}logger[_0xc8f1('0x10')](_0xc8f1('0x11'),_0x2e175e,_0x11acc3[_0xc8f1('0x10')]['message']);return _0x30e982(_0x11acc3[_0xc8f1('0x10')][_0xc8f1('0x12')]);}else{logger[_0xc8f1('0x13')](_0xc8f1('0x11'),_0x2e175e,_0xc8f1('0xe'));_0x30e982(_0x11acc3[_0xc8f1('0x14')][_0xc8f1('0x12')]);}})[_0xc8f1('0x15')](function(_0xe442df){logger[_0xc8f1('0x10')](_0xc8f1('0x11'),_0x2e175e,_0xe442df);_0x52bdcf(_0xe442df);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5ac0e29..20610ee 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 _0xef0f=['isAuthenticated','index','/describe','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2ed79c,_0x295245){var _0x4ac61e=function(_0xa1bec8){while(--_0xa1bec8){_0x2ed79c['push'](_0x2ed79c['shift']());}};_0x4ac61e(++_0x295245);}(_0xef0f,0x168));var _0xfef0=function(_0x43c363,_0x16c2e1){_0x43c363=_0x43c363-0x0;var _0xf102f2=_0xef0f[_0x43c363];return _0xf102f2;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var auth=require(_0xfef0('0x4'));var interaction=require(_0xfef0('0x5'));var config=require(_0xfef0('0x6'));var controller=require('./cmCompany.controller');router[_0xfef0('0x7')]('/',auth[_0xfef0('0x8')](),controller[_0xfef0('0x9')]);router[_0xfef0('0x7')](_0xfef0('0xa'),auth[_0xfef0('0x8')](),controller['describe']);router[_0xfef0('0x7')]('/:id',auth[_0xfef0('0x8')](),controller[_0xfef0('0xb')]);router[_0xfef0('0x7')](_0xfef0('0xc'),auth[_0xfef0('0x8')](),controller[_0xfef0('0xd')]);router[_0xfef0('0xe')]('/',auth[_0xfef0('0x8')](),controller[_0xfef0('0xf')]);router[_0xfef0('0xe')](_0xfef0('0xc'),auth[_0xfef0('0x8')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')]('/:id',auth[_0xfef0('0x8')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0x14'),auth[_0xfef0('0x8')](),controller[_0xfef0('0x15')]);module[_0xfef0('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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_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 0cbe648..40c9821 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 _0x86b0=['NOW','exports','STRING','INTEGER','UNSIGNED'];(function(_0x17cdc4,_0x4bb4b2){var _0x13b096=function(_0xb6e9e0){while(--_0xb6e9e0){_0x17cdc4['push'](_0x17cdc4['shift']());}};_0x13b096(++_0x4bb4b2);}(_0x86b0,0x1e1));var _0x086b=function(_0x351e84,_0x5d8eb3){_0x351e84=_0x351e84-0x0;var _0x29119b=_0x86b0[_0x351e84];return _0x29119b;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x086b('0x0')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x086b('0x1')]},'street':{'type':Sequelize[_0x086b('0x1')]},'postalCode':{'type':Sequelize[_0x086b('0x1')]},'city':{'type':Sequelize[_0x086b('0x1')]},'country':{'type':Sequelize[_0x086b('0x1')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x086b('0x1')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x086b('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x086b('0x1')]},'facebook':{'type':Sequelize[_0x086b('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x086b('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x086b('0x1')]},'viber':{'type':Sequelize[_0x086b('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x086b('0x1')]},'telegram':{'type':Sequelize[_0x086b('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x086b('0x2')](0x2)[_0x086b('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x086b('0x4')]}}; \ No newline at end of file +var _0xb358=['STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x4d883d,_0x4586df){var _0x5df5fd=function(_0x576986){while(--_0x576986){_0x4d883d['push'](_0x4d883d['shift']());}};_0x5df5fd(++_0x4586df);}(_0xb358,0x19e));var _0x8b35=function(_0x1e19ba,_0x473839){_0x1e19ba=_0x1e19ba-0x0;var _0x3f0e5e=_0xb358[_0x1e19ba];return _0x3f0e5e;};'use strict';var _=require(_0x8b35('0x0'));var Sequelize=require(_0x8b35('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x8b35('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x8b35('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x8b35('0x2')]},'city':{'type':Sequelize[_0x8b35('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x8b35('0x2')]},'description':{'type':Sequelize[_0x8b35('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x8b35('0x2')]},'fax':{'type':Sequelize[_0x8b35('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x8b35('0x2')]},'facebook':{'type':Sequelize[_0x8b35('0x2')]},'fb_data':{'type':Sequelize[_0x8b35('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x8b35('0x2')]},'teams':{'type':Sequelize[_0x8b35('0x2')]},'viber':{'type':Sequelize[_0x8b35('0x2')]},'line':{'type':Sequelize[_0x8b35('0x2')]},'wechat':{'type':Sequelize[_0x8b35('0x2')]},'telegram':{'type':Sequelize[_0x8b35('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x8b35('0x4')](0x2)[_0x8b35('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8b35('0x6')],'defaultValue':Sequelize[_0x8b35('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 720d04a..f143aaa 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 _0x3df4=['offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','left_join','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','sqlOperator','conditions','find','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','value','datetime','castTo','buildExpression','text','start','map','hasOwnProperty','isNil','Contact','isEmpty','forEach','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','SELECT','clone','c.id','DESC','having','t.id\x20IN\x20?','resolve','role','agent','some','User','user','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','ListId','sequelize','toString','count','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','params','columnName','displayName','findAll','alias','custom','body','get','mergeWith','isArray','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','bulkCreate','each','duplicates','$or','findOrCreate','error','show','$and','omit','pickBy','format','cf_%d','cm_contacts','id\x20=\x20?','toParam','values','phone','rawAttributes','options','getTags','setTags','ids','getHoppers','ContactId','includeAll','include','getHopperHistories','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','createReadStream','import','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','stringify','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','getJourney','mail','chat','sms','fax','whatsapp','voice','-createdAt','channel','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','endtime','note','userDisposition','userSecondDisposition','userThirdDisposition','fullname','createdAt','findAndCountAll','startCase','Account','closed','disposition','UserId','browserName','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','openchannel','externalUrl','threadId','Owner','flatten','sortBy','reverse','slice','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','end','status','json'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x3df4,0x102));var _0x43df=function(_0x4fd710,_0x11fc99){_0x4fd710=_0x4fd710-0x0;var _0x3c2c07=_0x3df4[_0x4fd710];return _0x3c2c07;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x43df('0x0'));var zipdir=require(_0x43df('0x1'));var jsonpatch=require(_0x43df('0x2'));var rp=require(_0x43df('0x3'));var moment=require(_0x43df('0x4'));var BPromise=require(_0x43df('0x5'));var Mustache=require(_0x43df('0x6'));var util=require('util');var path=require('path');var sox=require(_0x43df('0x7'));var csv=require(_0x43df('0x8'));var ejs=require(_0x43df('0x9'));var fs=require('fs');var _=require(_0x43df('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43df('0xb'));var deskjs=require(_0x43df('0xc'));var toCsv=require(_0x43df('0x8'));var querystring=require(_0x43df('0xd'));var Papa=require('papaparse');var Redis=require(_0x43df('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x43df('0xf'));var as=require(_0x43df('0x10'));var hardwareService=require(_0x43df('0x11'));var logger=require(_0x43df('0x12'))(_0x43df('0x13'));var utils=require(_0x43df('0x14'));var config=require(_0x43df('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x43df('0x16'))['db'];config[_0x43df('0x17')]=_['defaults'](config[_0x43df('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x43df('0x18'))(new Redis(config[_0x43df('0x17')]));require('./cmContact.socket')[_0x43df('0x19')](socket);function respondWithStatusCode(_0x549159,_0x4a8734){_0x4a8734=_0x4a8734||0xcc;return function(_0x3c4ea1){if(_0x3c4ea1){return _0x549159[_0x43df('0x1a')](_0x4a8734);}return _0x549159['status'](_0x4a8734)[_0x43df('0x1b')]();};}function respondWithResult(_0x592c70,_0x3bed20){_0x3bed20=_0x3bed20||0xc8;return function(_0x54965f){if(_0x54965f){return _0x592c70[_0x43df('0x1c')](_0x3bed20)[_0x43df('0x1d')](_0x54965f);}};}function respondWithFilteredResult(_0x2126fd,_0x1b7066){return function(_0x571404){if(_0x571404){var _0x376373=_0x571404['count'],_0x334fae=_0x1b7066[_0x43df('0x1e')],_0x241066=_0x1b7066[_0x43df('0x1e')]+_0x1b7066[_0x43df('0x1f')],_0x45f137;if(_0x241066>=_0x376373){_0x241066=_0x376373;_0x45f137=0xc8;}else{_0x45f137=0xce;}_0x2126fd['status'](_0x45f137);return _0x2126fd['set'](_0x43df('0x20'),_0x334fae+'-'+_0x241066+'/'+_0x376373)[_0x43df('0x1d')](_0x571404);}return null;};}function patchUpdates(_0x5a521f){return function(_0x3b51b2){try{jsonpatch[_0x43df('0x21')](_0x3b51b2,_0x5a521f,!![]);}catch(_0x43085e){return BPromise['reject'](_0x43085e);}return _0x3b51b2[_0x43df('0x22')]();};}function saveUpdates(_0x493e2c,_0x13b93a){return function(_0x5ec284){if(_0x5ec284){return _0x5ec284[_0x43df('0x23')](_0x493e2c)[_0x43df('0x24')](function(_0xbb793b){return _0xbb793b;});}return null;};}function removeEntity(_0x4d05c9,_0x228afb){return function(_0x591a8d){if(_0x591a8d){return _0x591a8d[_0x43df('0x25')]()[_0x43df('0x24')](function(){_0x4d05c9[_0x43df('0x1c')](0xcc)[_0x43df('0x1b')]();});}};}function handleEntityNotFound(_0x84521,_0x188937){return function(_0x1a09be){if(!_0x1a09be){_0x84521[_0x43df('0x1a')](0x194);}return _0x1a09be;};}function handleError(_0xb2578b,_0x3f264f){_0x3f264f=_0x3f264f||0x1f4;return function(_0x2aa723){logger['error'](_0x2aa723[_0x43df('0x26')]);if(_0x2aa723[_0x43df('0x27')]){delete _0x2aa723[_0x43df('0x27')];}_0xb2578b[_0x43df('0x1c')](_0x3f264f)[_0x43df('0x28')](_0x2aa723);};}exports[_0x43df('0x29')]=function(_0x461ec2,_0xcc74c7){var _0x1eed39={},_0x597cde={},_0x493c08={'count':0x0,'rows':[]};return db[_0x43df('0x2a')][_0x43df('0x2b')]()[_0x43df('0x24')](function(_0x4665c7){var _0x2c6b4d=[];for(var _0x4b83a9=0x0;_0x4b83a90x1){_0x2e6d78['or'](_0x43df('0x69'),qs[_0x43df('0x6a')](_0x2e9c03),null);}else{if(qs[_0x43df('0x6b')](_0x2e9c03)){_0x2e6d78['or'](_0x43df('0x6c'),_0x2e9c03+'%');_0x2e6d78['or'](_0x43df('0x6d'),_0x2e9c03+'%');_0x2e6d78['or'](_0x43df('0x6e'),_0x2e9c03+'%');_0x2e6d78['or'](_0x43df('0x6f'),_0x2e9c03+'%');}else if(qs[_0x43df('0x70')](_0x2e9c03)){_0x2e6d78['or'](_0x43df('0x71'),_0x2e9c03+'%');}else{_0x2e6d78['or'](_0x43df('0x72'),'%'+_0x2e9c03+'%');_0x2e6d78['or'](_0x43df('0x73'),'%'+_0x2e9c03+'%');_0x2e6d78['or']('c.email\x20LIKE\x20?','%'+_0x2e9c03+'%');}}}}_0x25a9f7['where'](_0x2e6d78);_0x25a9f7[_0x43df('0x74')]('c.id');var _0x273b27={'type':db['Sequelize']['QueryTypes'][_0x43df('0x75')],'raw':!![]};var _0x3c9acc=_0x25a9f7[_0x43df('0x76')]()[_0x43df('0x43')](_0x43df('0x77'));if(_0x1eed39[_0x43df('0x3e')]){_0x1eed39[_0x43df('0x3e')][_0x43df('0x63')](function(_0x4930b6){_0x25a9f7[_0x43df('0x3e')]('c.'+_0x4930b6[0x0],_0x4930b6[0x1]===_0x43df('0x78')?![]:!![]);});}if(!_['isEmpty'](_0x3848ee)){_0x25a9f7[_0x43df('0x79')](_0x3c229c);_0x3c9acc[_0x43df('0x40')](_0x43df('0x7a'),_0x3848ee);}BPromise[_0x43df('0x7b')]()[_0x43df('0x24')](function(){if(!_0x2e36c9)return;if(_0x461ec2['user'][_0x43df('0x7c')]!==_0x43df('0x7d'))return;if(!_[_0x43df('0x7e')](_0x2e36c9[_0x43df('0x50')],[_0x43df('0x43'),_0x43df('0x7f')])){return _0x461ec2[_0x43df('0x80')][_0x43df('0x81')]({'attributes':['id'],'raw':!![]})[_0x43df('0x24')](function(_0x2792fb){if(_[_0x43df('0x62')](_0x2792fb)){_0x3c9acc[_0x43df('0x40')](_0x43df('0x82'));_0x25a9f7[_0x43df('0x40')](_0x43df('0x82'));}else{_0x3c9acc[_0x43df('0x40')](_0x43df('0x83'),_[_0x43df('0x5e')](_0x2792fb,'id'));_0x25a9f7[_0x43df('0x40')](_0x43df('0x83'),_[_0x43df('0x5e')](_0x2792fb,'id'));}});}})['then'](function(){if(_0x461ec2[_0x43df('0x80')][_0x43df('0x7c')]===_0x43df('0x7d')&&!_0x2e36c9&&!_0x461ec2['query'][_0x43df('0x84')])return[];return db[_0x43df('0x85')][_0x43df('0x38')](_0x3c9acc[_0x43df('0x86')](),_0x273b27);})['then'](function(_0x961fd9){_0x493c08[_0x43df('0x87')]=_0x961fd9[_0x43df('0x2d')];if(_0x493c08['count']===0x0)return[];return db['sequelize'][_0x43df('0x38')](_0xd16ae1['toString'](),_0x273b27)['then'](function(_0x32bef7){_0x250b08=_['keyBy'](_0x32bef7,'id');_0x273b27=_[_0x43df('0x88')](_0x273b27,{'model':db[_0x43df('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x461ec2[_0x43df('0x38')]['fields']){_0x1eed39[_0x43df('0x3b')][_0x43df('0x63')](function(_0x326a59){_0x25a9f7[_0x43df('0x43')]('c.'+_0x326a59);});}else{_0x25a9f7[_0x43df('0x43')](_0x43df('0x77'));_0x25a9f7[_0x43df('0x43')](_0x43df('0x89'));_0x25a9f7['field'](_0x43df('0x8a'));_0x25a9f7[_0x43df('0x43')](_0x43df('0x8b'));_0x25a9f7[_0x43df('0x43')](_0x43df('0x8c'));_0x25a9f7[_0x43df('0x43')](_0x43df('0x8d'));_0x25a9f7[_0x43df('0x43')](_0x43df('0x8e'));_0x25a9f7[_0x43df('0x43')](_0x43df('0x8f'));_0x25a9f7['field']('c.createdAt');_0x25a9f7['field'](_0x43df('0x90'));_0x25a9f7[_0x43df('0x43')](_0x43df('0x91'));_0x25a9f7[_0x43df('0x43')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x43df('0x92'));}if(_0x1eed39[_0x43df('0x1f')])_0x25a9f7['limit'](_0x1eed39[_0x43df('0x1f')]);if(_0x1eed39['offset'])_0x25a9f7['offset'](_0x1eed39[_0x43df('0x1e')]);return db[_0x43df('0x85')][_0x43df('0x38')](_0x25a9f7[_0x43df('0x86')](),_0x273b27);});})[_0x43df('0x24')](function(_0x3a4b72){_0x3a4b72[_0x43df('0x63')](function(_0x2430c6){if(_0x2430c6[_0x43df('0x92')]){_0x2430c6[_0x43df('0x93')]=[];_0x2430c6[_0x43df('0x92')][_0x43df('0x53')](',')[_0x43df('0x63')](function(_0x7b67cd){_0x2430c6[_0x43df('0x93')][_0x43df('0x30')](_0x250b08[_0x7b67cd]);});}delete _0x2430c6['TagIds'];});_0x493c08[_0x43df('0x94')]=_0x3a4b72;return _0x493c08;})[_0x43df('0x24')](respondWithFilteredResult(_0xcc74c7,_0x1eed39));})[_0x43df('0x95')](handleError(_0xcc74c7,null));};exports[_0x43df('0x25')]=function(_0x2a9a39,_0x375bbe){return db[_0x43df('0x2a')][_0x43df('0x51')]({'where':{'id':_0x2a9a39[_0x43df('0x96')]['id']}})[_0x43df('0x24')](handleEntityNotFound(_0x375bbe,null))[_0x43df('0x24')](removeEntity(_0x375bbe,null))[_0x43df('0x95')](handleError(_0x375bbe,null));};exports[_0x43df('0x2b')]=function(_0x1a6853,_0x4cf13e){return db[_0x43df('0x2a')][_0x43df('0x2b')]()[_0x43df('0x24')](function(_0x417fe5){delete _0x417fe5['tags'];for(var _0x1f67e6=0x0;_0x1f67e6=_0x4a84ee){_0x40f0d3=_0x4a84ee;_0x52fa43=0xc8;}else{_0x52fa43=0xce;}_0x5bea2e[_0x791a('0x1f')](_0x52fa43);return _0x5bea2e['set'](_0x791a('0x20'),_0x588d00+'-'+_0x40f0d3+'/'+_0x4a84ee)[_0x791a('0x1c')](_0x52941d);}return null;};}function patchUpdates(_0x234514){return function(_0x280f1e){try{jsonpatch['apply'](_0x280f1e,_0x234514,!![]);}catch(_0x448085){return BPromise[_0x791a('0x21')](_0x448085);}return _0x280f1e[_0x791a('0x22')]();};}function saveUpdates(_0x9e17b5,_0x3200dd){return function(_0x1091af){if(_0x1091af){return _0x1091af[_0x791a('0x23')](_0x9e17b5)[_0x791a('0x24')](function(_0x323c6a){return _0x323c6a;});}return null;};}function removeEntity(_0xe8e452,_0x137992){return function(_0x5e03a3){if(_0x5e03a3){return _0x5e03a3[_0x791a('0x25')]()[_0x791a('0x24')](function(){_0xe8e452[_0x791a('0x1f')](0xcc)[_0x791a('0x1b')]();});}};}function handleEntityNotFound(_0x4d748a,_0x456480){return function(_0x2db3f7){if(!_0x2db3f7){_0x4d748a['sendStatus'](0x194);}return _0x2db3f7;};}function handleError(_0xdfa84f,_0x1785f5){_0x1785f5=_0x1785f5||0x1f4;return function(_0x16dbaf){logger['error'](_0x16dbaf[_0x791a('0x26')]);if(_0x16dbaf[_0x791a('0x27')]){delete _0x16dbaf[_0x791a('0x27')];}_0xdfa84f[_0x791a('0x1f')](_0x1785f5)[_0x791a('0x28')](_0x16dbaf);};}exports[_0x791a('0x29')]=function(_0x628816,_0x889534){var _0x58bbc0={},_0xbc3436={},_0x9e9332={'count':0x0,'rows':[]};return db[_0x791a('0x2a')]['describe']()[_0x791a('0x24')](function(_0x5df656){var _0xc59f5e=[];for(var _0x2e4ec8=0x0;_0x2e4ec80x1){_0x24633a['or'](_0x791a('0x66'),qs[_0x791a('0x67')](_0x2d671f),null);}else{if(qs[_0x791a('0x68')](_0x2d671f)){_0x24633a['or'](_0x791a('0x69'),_0x2d671f+'%');_0x24633a['or'](_0x791a('0x6a'),_0x2d671f+'%');_0x24633a['or'](_0x791a('0x6b'),_0x2d671f+'%');_0x24633a['or'](_0x791a('0x6c'),_0x2d671f+'%');}else if(qs[_0x791a('0x6d')](_0x2d671f)){_0x24633a['or'](_0x791a('0x6e'),_0x2d671f+'%');}else{_0x24633a['or'](_0x791a('0x6f'),'%'+_0x2d671f+'%');_0x24633a['or'](_0x791a('0x70'),'%'+_0x2d671f+'%');_0x24633a['or'](_0x791a('0x6e'),'%'+_0x2d671f+'%');}}}}_0x50d442[_0x791a('0x3e')](_0x24633a);_0x50d442[_0x791a('0x71')](_0x791a('0x72'));var _0xe7fbf0={'type':db[_0x791a('0x73')][_0x791a('0x74')][_0x791a('0x75')],'raw':!![]};var _0x3cf4c7=_0x50d442['clone']()[_0x791a('0x41')](_0x791a('0x72'));if(_0x58bbc0[_0x791a('0x3c')]){_0x58bbc0[_0x791a('0x3c')][_0x791a('0x52')](function(_0x5ad4e0){_0x50d442[_0x791a('0x3c')]('c.'+_0x5ad4e0[0x0],_0x5ad4e0[0x1]===_0x791a('0x76')?![]:!![]);});}if(!_[_0x791a('0x77')](_0x860d36)){_0x50d442[_0x791a('0x78')](_0x51ea1c);_0x3cf4c7['where'](_0x791a('0x79'),_0x860d36);}BPromise['resolve']()['then'](function(){if(!_0x430ee9)return;if(_0x628816['user']['role']!==_0x791a('0x7a'))return;if(!_[_0x791a('0x7b')](_0x430ee9[_0x791a('0x4e')],[_0x791a('0x41'),_0x791a('0x55')])){return _0x628816[_0x791a('0x7c')][_0x791a('0x7d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x522cb8){if(_[_0x791a('0x77')](_0x522cb8)){_0x3cf4c7[_0x791a('0x3e')]('c.ListId\x20IS\x20NULL');_0x50d442['where'](_0x791a('0x7e'));}else{_0x3cf4c7[_0x791a('0x3e')]('c.ListId\x20IN\x20?',_[_0x791a('0x51')](_0x522cb8,'id'));_0x50d442[_0x791a('0x3e')](_0x791a('0x5f'),_[_0x791a('0x51')](_0x522cb8,'id'));}});}})['then'](function(){if(_0x628816['user'][_0x791a('0x7f')]===_0x791a('0x7a')&&!_0x430ee9&&!_0x628816['query'][_0x791a('0x5e')])return[];return db[_0x791a('0x80')][_0x791a('0x37')](_0x3cf4c7[_0x791a('0x81')](),_0xe7fbf0);})['then'](function(_0x24efc2){_0x9e9332[_0x791a('0x82')]=_0x24efc2[_0x791a('0x2c')];if(_0x9e9332[_0x791a('0x82')]===0x0)return[];return db[_0x791a('0x80')][_0x791a('0x37')](_0x5bad7d[_0x791a('0x81')](),_0xe7fbf0)[_0x791a('0x24')](function(_0x5567d3){_0x5678a3=_['keyBy'](_0x5567d3,'id');_0xe7fbf0=_['merge'](_0xe7fbf0,{'model':db[_0x791a('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x628816[_0x791a('0x37')][_0x791a('0x39')]){_0x58bbc0[_0x791a('0x38')][_0x791a('0x52')](function(_0x1026be){_0x50d442[_0x791a('0x41')]('c.'+_0x1026be);});}else{_0x50d442[_0x791a('0x41')](_0x791a('0x72'));_0x50d442[_0x791a('0x41')]('c.firstName');_0x50d442[_0x791a('0x41')](_0x791a('0x83'));_0x50d442['field'](_0x791a('0x84'));_0x50d442[_0x791a('0x41')]('c.mobile');_0x50d442['field'](_0x791a('0x85'));_0x50d442[_0x791a('0x41')]('c.email');_0x50d442['field'](_0x791a('0x86'));_0x50d442[_0x791a('0x41')](_0x791a('0x87'));_0x50d442['field'](_0x791a('0x88'));_0x50d442['field'](_0x791a('0x89'));_0x50d442[_0x791a('0x41')](_0x791a('0x8a'),_0x791a('0x8b'));}if(_0x58bbc0[_0x791a('0x1e')])_0x50d442[_0x791a('0x1e')](_0x58bbc0['limit']);if(_0x58bbc0[_0x791a('0x1d')])_0x50d442[_0x791a('0x1d')](_0x58bbc0[_0x791a('0x1d')]);return db[_0x791a('0x80')][_0x791a('0x37')](_0x50d442[_0x791a('0x81')](),_0xe7fbf0);});})[_0x791a('0x24')](function(_0x2d2097){_0x2d2097[_0x791a('0x52')](function(_0x203fc5){if(_0x203fc5[_0x791a('0x8b')]){_0x203fc5[_0x791a('0x8c')]=[];_0x203fc5[_0x791a('0x8b')][_0x791a('0x50')](',')[_0x791a('0x52')](function(_0x1f5ec6){_0x203fc5[_0x791a('0x8c')][_0x791a('0x2e')](_0x5678a3[_0x1f5ec6]);});}delete _0x203fc5['TagIds'];});_0x9e9332[_0x791a('0x8d')]=_0x2d2097;return _0x9e9332;})[_0x791a('0x24')](respondWithFilteredResult(_0x889534,_0x58bbc0));})[_0x791a('0x8e')](handleError(_0x889534,null));};exports[_0x791a('0x25')]=function(_0x70fcdd,_0x5ab894){return db[_0x791a('0x2a')]['find']({'where':{'id':_0x70fcdd[_0x791a('0x8f')]['id']}})['then'](handleEntityNotFound(_0x5ab894,null))[_0x791a('0x24')](removeEntity(_0x5ab894,null))[_0x791a('0x8e')](handleError(_0x5ab894,null));};exports['describe']=function(_0x449a6d,_0x235bff){return db[_0x791a('0x2a')]['describe']()[_0x791a('0x24')](function(_0x57b1b8){delete _0x57b1b8[_0x791a('0x90')];for(var _0x5d8660=0x0;_0x5d8660{}\s\\|]/g,'-');_0x22c23d(null,util['format'](_0x2aaa('0x22'),path[_0x2aaa('0x23')](_0x3e7649['originalname'],path['extname'](_0x3e7649[_0x2aaa('0x20')])),Date['now'](),path[_0x2aaa('0x24')](_0x3e7649[_0x2aaa('0x20')])));}})});router['post'](_0x2aaa('0x25'),upload[_0x2aaa('0x26')]('file'),controller[_0x2aaa('0x27')]);var upload=multer({'storage':multer[_0x2aaa('0x1d')]({'destination':function(_0x41253c,_0x5371cd,_0x1f626b){_0x1f626b(null,path[_0x2aaa('0x28')](config['root'],'server/files/tmp'));},'filename':function(_0x3af929,_0xc9169,_0x2f9772){_0xc9169[_0x2aaa('0x20')]=_0xc9169[_0x2aaa('0x20')][_0x2aaa('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2f9772(null,util[_0x2aaa('0x29')](_0x2aaa('0x22'),path[_0x2aaa('0x23')](_0xc9169[_0x2aaa('0x20')],path[_0x2aaa('0x24')](_0xc9169[_0x2aaa('0x20')])),Date['now'](),path[_0x2aaa('0x24')](_0xc9169['originalname'])));}})});router[_0x2aaa('0x18')](_0x2aaa('0x2a'),upload[_0x2aaa('0x26')](_0x2aaa('0x2b')),controller[_0x2aaa('0x2c')]);router[_0x2aaa('0x18')](_0x2aaa('0x2d'),auth[_0x2aaa('0x9')](),controller[_0x2aaa('0x2e')]);router[_0x2aaa('0x2f')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x2aaa('0x9')](),controller[_0x2aaa('0x30')]);module[_0x2aaa('0x31')]=router; \ No newline at end of file +var _0xcd31=['setTags','diskStorage','root','server/files/tmp','originalname','replace','format','%s-%s%s','extname','file','uploadCsv','join','basename','now','/upload','upload','/upload/:id','import','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','describe','/:id','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','getJscriptySessions','/:id/journey','getJourney','post','/merge','bulkCreate'];(function(_0x1521ff,_0x14e239){var _0x14480a=function(_0x451aae){while(--_0x451aae){_0x1521ff['push'](_0x1521ff['shift']());}};_0x14480a(++_0x14e239);}(_0xcd31,0x15d));var _0x1cd3=function(_0x150f8f,_0x2857b1){_0x150f8f=_0x150f8f-0x0;var _0x17a73c=_0xcd31[_0x150f8f];return _0x17a73c;};'use strict';var multer=require('multer');var util=require(_0x1cd3('0x0'));var path=require(_0x1cd3('0x1'));var timeout=require(_0x1cd3('0x2'));var express=require('express');var router=express[_0x1cd3('0x3')]();var auth=require(_0x1cd3('0x4'));var interaction=require(_0x1cd3('0x5'));var config=require(_0x1cd3('0x6'));var controller=require(_0x1cd3('0x7'));router[_0x1cd3('0x8')]('/',auth['isAuthenticated'](),controller[_0x1cd3('0x9')]);router[_0x1cd3('0x8')](_0x1cd3('0xa'),auth['isAuthenticated'](),controller[_0x1cd3('0xb')]);router[_0x1cd3('0x8')](_0x1cd3('0xc'),auth['isAuthenticated'](),controller[_0x1cd3('0xd')]);router[_0x1cd3('0x8')](_0x1cd3('0xe'),auth[_0x1cd3('0xf')](),controller[_0x1cd3('0x10')]);router[_0x1cd3('0x8')](_0x1cd3('0x11'),auth['isAuthenticated'](),controller[_0x1cd3('0x12')]);router[_0x1cd3('0x8')](_0x1cd3('0x13'),auth[_0x1cd3('0xf')](),controller['getHopperHistories']);router[_0x1cd3('0x8')]('/:id/hopper_finals',auth[_0x1cd3('0xf')](),controller[_0x1cd3('0x14')]);router[_0x1cd3('0x8')]('/:id/jscripty_sessions',auth['isAuthenticated'](),controller[_0x1cd3('0x15')]);router[_0x1cd3('0x8')](_0x1cd3('0x16'),auth['isAuthenticated'](),controller[_0x1cd3('0x17')]);router[_0x1cd3('0x18')](_0x1cd3('0x19'),auth[_0x1cd3('0xf')](),controller['merge']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/create_many',auth[_0x1cd3('0xf')](),controller[_0x1cd3('0x1a')]);router[_0x1cd3('0x18')](_0x1cd3('0xe'),auth[_0x1cd3('0xf')](),controller[_0x1cd3('0x1b')]);var upload=multer({'storage':multer[_0x1cd3('0x1c')]({'destination':function(_0x2d4f05,_0x3473c4,_0x960df7){_0x960df7(null,path['join'](config[_0x1cd3('0x1d')],_0x1cd3('0x1e')));},'filename':function(_0x58f10e,_0x26b59a,_0x1ec1b4){_0x26b59a['originalname']=_0x26b59a[_0x1cd3('0x1f')][_0x1cd3('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1ec1b4(null,util[_0x1cd3('0x21')](_0x1cd3('0x22'),path['basename'](_0x26b59a['originalname'],path[_0x1cd3('0x23')](_0x26b59a[_0x1cd3('0x1f')])),Date['now'](),path['extname'](_0x26b59a[_0x1cd3('0x1f')])));}})});router[_0x1cd3('0x18')]('/csv',upload['single'](_0x1cd3('0x24')),controller[_0x1cd3('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5635f9,_0x1c86f6,_0xc311a9){_0xc311a9(null,path[_0x1cd3('0x26')](config['root'],'server/files/tmp'));},'filename':function(_0x334ce2,_0x58b563,_0x173f0d){_0x58b563[_0x1cd3('0x1f')]=_0x58b563[_0x1cd3('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x173f0d(null,util[_0x1cd3('0x21')]('%s-%s%s',path[_0x1cd3('0x27')](_0x58b563[_0x1cd3('0x1f')],path[_0x1cd3('0x23')](_0x58b563['originalname'])),Date[_0x1cd3('0x28')](),path[_0x1cd3('0x23')](_0x58b563[_0x1cd3('0x1f')])));}})});router[_0x1cd3('0x18')](_0x1cd3('0x29'),upload['single'](_0x1cd3('0x24')),controller[_0x1cd3('0x2a')]);router[_0x1cd3('0x18')](_0x1cd3('0x2b'),auth[_0x1cd3('0xf')](),controller[_0x1cd3('0x2c')]);router['put'](_0x1cd3('0xc'),auth[_0x1cd3('0xf')](),controller['update']);router['delete'](_0x1cd3('0xc'),auth[_0x1cd3('0xf')](),controller[_0x1cd3('0x2d')]);module[_0x1cd3('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index bf3fae8..f308a11 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 _0x432b=['TEXT','long','type','select','parse','values','isArray','setDataValue','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','getDataValue','alias','name','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb432('0x0'));var _=require('lodash');module[_0xb432('0x1')]={'name':{'type':Sequelize[_0xb432('0x2')],'get':function(_0x7170b6){return this[_0xb432('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x93e722){this['setDataValue'](_0xb432('0x4'),_0x93e722?_0x93e722:this['getDataValue'](_0xb432('0x5')));}},'type':{'type':Sequelize[_0xb432('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xb432('0x7')](_0xb432('0x8')),'get':function(){if(this[_0xb432('0x3')](_0xb432('0x9'))===_0xb432('0xa')){return JSON[_0xb432('0xb')](this['getDataValue'](_0xb432('0xc')));}else{return this[_0xb432('0x3')](_0xb432('0xc'));}},'set':function(_0x4288c3){if(Array[_0xb432('0xd')](_0x4288c3)){this[_0xb432('0xe')]('values',JSON['stringify'](_0x4288c3));}else{this[_0xb432('0xe')](_0xb432('0xc'),_0x4288c3);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xb432('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xb432('0x10')](_0xb432('0x11'))}}; \ No newline at end of file +var _0xac9d=['TEXT','long','select','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name'];(function(_0x167eab,_0x43e1e2){var _0x2fc4d1=function(_0x2bae07){while(--_0x2bae07){_0x167eab['push'](_0x167eab['shift']());}};_0x2fc4d1(++_0x43e1e2);}(_0xac9d,0x14d));var _0xdac9=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0xac9d[_0xbc1a4b];return _0x108b87;};'use strict';var Sequelize=require(_0xdac9('0x0'));var _=require(_0xdac9('0x1'));module[_0xdac9('0x2')]={'name':{'type':Sequelize[_0xdac9('0x3')],'get':function(_0x12390c){return this[_0xdac9('0x4')](_0xdac9('0x5'));}},'alias':{'type':Sequelize[_0xdac9('0x6')],'allowNull':![],'set':function(_0x51a5d7){this[_0xdac9('0x7')]('alias',_0x51a5d7?_0x51a5d7:this[_0xdac9('0x4')](_0xdac9('0x8')));}},'type':{'type':Sequelize[_0xdac9('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xdac9('0x9')](_0xdac9('0xa')),'get':function(){if(this[_0xdac9('0x4')]('type')===_0xdac9('0xb')){return JSON['parse'](this[_0xdac9('0x4')](_0xdac9('0xc')));}else{return this[_0xdac9('0x4')](_0xdac9('0xc'));}},'set':function(_0x23ec14){if(Array[_0xdac9('0xd')](_0x23ec14)){this[_0xdac9('0x7')](_0xdac9('0xc'),JSON[_0xdac9('0xe')](_0x23ec14));}else{this['setDataValue'](_0xdac9('0xc'),_0x23ec14);}}},'required':{'type':Sequelize[_0xdac9('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xdac9('0x10')](_0xdac9('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index f519838..9205f6a 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 _0x6898=['Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','intersection','fields','query','attributes','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','rows','show','params','keys','length','includeAll','find','catch','body','destroy','create','transaction','text','TEXT','number','Sequelize','INTEGER','switch','defaultValue','sequelize','cm_contacts','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6898,0x18e));var _0x8689=function(_0x3b55ee,_0xdfa582){_0x3b55ee=_0x3b55ee-0x0;var _0x548ac2=_0x6898[_0x3b55ee];return _0x548ac2;};'use strict';var pdf=require(_0x8689('0x0'));var emlformat=require(_0x8689('0x1'));var rimraf=require(_0x8689('0x2'));var zipdir=require(_0x8689('0x3'));var jsonpatch=require(_0x8689('0x4'));var rp=require('request-promise');var moment=require(_0x8689('0x5'));var BPromise=require(_0x8689('0x6'));var Mustache=require(_0x8689('0x7'));var util=require(_0x8689('0x8'));var path=require(_0x8689('0x9'));var sox=require(_0x8689('0xa'));var csv=require(_0x8689('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8689('0xc'));var crypto=require(_0x8689('0xd'));var jsforce=require(_0x8689('0xe'));var deskjs=require(_0x8689('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8689('0x10'));var Papa=require(_0x8689('0x11'));var Redis=require(_0x8689('0x12'));var authService=require(_0x8689('0x13'));var qs=require(_0x8689('0x14'));var as=require(_0x8689('0x15'));var hardwareService=require(_0x8689('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8689('0x17'));var db=require(_0x8689('0x18'))['db'];function respondWithStatusCode(_0x590c5c,_0x4ae15f){_0x4ae15f=_0x4ae15f||0xcc;return function(_0x37faee){if(_0x37faee){return _0x590c5c[_0x8689('0x19')](_0x4ae15f);}return _0x590c5c[_0x8689('0x1a')](_0x4ae15f)[_0x8689('0x1b')]();};}function respondWithResult(_0x15ea1e,_0x106128){_0x106128=_0x106128||0xc8;return function(_0x3aa162){if(_0x3aa162){return _0x15ea1e[_0x8689('0x1a')](_0x106128)[_0x8689('0x1c')](_0x3aa162);}};}function respondWithFilteredResult(_0x10999b,_0x43bb43){return function(_0x96478){if(_0x96478){var _0x288593=_0x96478[_0x8689('0x1d')],_0x5b7f4e=_0x43bb43[_0x8689('0x1e')],_0x5797a8=_0x43bb43[_0x8689('0x1e')]+_0x43bb43[_0x8689('0x1f')],_0x4439e3;if(_0x5797a8>=_0x288593){_0x5797a8=_0x288593;_0x4439e3=0xc8;}else{_0x4439e3=0xce;}_0x10999b[_0x8689('0x1a')](_0x4439e3);return _0x10999b['set'](_0x8689('0x20'),_0x5b7f4e+'-'+_0x5797a8+'/'+_0x288593)[_0x8689('0x1c')](_0x96478);}return null;};}function patchUpdates(_0x2324f3){return function(_0x5ee5c2){try{jsonpatch[_0x8689('0x21')](_0x5ee5c2,_0x2324f3,!![]);}catch(_0x35a3ea){return BPromise[_0x8689('0x22')](_0x35a3ea);}return _0x5ee5c2[_0x8689('0x23')]();};}function saveUpdates(_0x17e7ab,_0x38965c){return function(_0x17d0a9){if(_0x17d0a9){return _0x17d0a9[_0x8689('0x24')](_0x17e7ab)[_0x8689('0x25')](function(_0x3c0396){return _0x3c0396;});}return null;};}function removeEntity(_0x779284,_0x3e1d96){return function(_0x40228f){if(_0x40228f){return _0x40228f['destroy']()[_0x8689('0x25')](function(){_0x779284[_0x8689('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b5994,_0x400eee){return function(_0x1f0971){if(!_0x1f0971){_0x4b5994['sendStatus'](0x194);}return _0x1f0971;};}function handleError(_0x809296,_0x28538c){_0x28538c=_0x28538c||0x1f4;return function(_0x4cd82c){logger[_0x8689('0x26')](_0x4cd82c[_0x8689('0x27')]);if(_0x4cd82c[_0x8689('0x28')]){delete _0x4cd82c['name'];}_0x809296[_0x8689('0x1a')](_0x28538c)[_0x8689('0x29')](_0x4cd82c);};}exports[_0x8689('0x2a')]=function(_0x5a06fa,_0x3e9f2a){var _0x2fd9a9={},_0x53249a={},_0x551806={'count':0x0,'rows':[]};var _0xd721fd=_[_0x8689('0x2b')](db[_0x8689('0x2c')][_0x8689('0x2d')],function(_0x582662){return{'name':_0x582662[_0x8689('0x2e')],'type':_0x582662[_0x8689('0x2f')]['key']};});_0x53249a[_0x8689('0x30')]=_[_0x8689('0x31')](_[_0x8689('0x2b')](_0xd721fd,_0x8689('0x28')),[_0x8689('0x28')]);_0x53249a['query']=_['keys'](_0x5a06fa['query']);_0x53249a['filters']=_['intersection'](_0x53249a[_0x8689('0x30')],_0x53249a['query']);_0x2fd9a9['attributes']=_[_0x8689('0x32')](_0x53249a[_0x8689('0x30')],qs[_0x8689('0x33')](_0x5a06fa[_0x8689('0x34')][_0x8689('0x33')]));_0x2fd9a9[_0x8689('0x35')]=_0x2fd9a9[_0x8689('0x35')]['length']?_0x2fd9a9[_0x8689('0x35')]:_0x53249a[_0x8689('0x30')];if(!_0x5a06fa[_0x8689('0x34')][_0x8689('0x36')]('nolimit')){_0x2fd9a9[_0x8689('0x1f')]=qs['limit'](_0x5a06fa[_0x8689('0x34')][_0x8689('0x1f')]);_0x2fd9a9[_0x8689('0x1e')]=qs['offset'](_0x5a06fa['query']['offset']);}_0x2fd9a9['order']=qs[_0x8689('0x37')](_0x5a06fa[_0x8689('0x34')][_0x8689('0x37')]);_0x2fd9a9[_0x8689('0x38')]=qs[_0x8689('0x39')](_[_0x8689('0x3a')](_0x5a06fa[_0x8689('0x34')],_0x53249a[_0x8689('0x39')]),_0xd721fd);if(_0x5a06fa[_0x8689('0x34')][_0x8689('0x3b')]){_0x2fd9a9[_0x8689('0x38')]=_['merge'](_0x2fd9a9[_0x8689('0x38')],{'$or':_[_0x8689('0x2b')](_0xd721fd,function(_0x23bfd3){if(_0x23bfd3['type']!==_0x8689('0x3c')){var _0x22ddf4={};_0x22ddf4[_0x23bfd3[_0x8689('0x28')]]={'$like':'%'+_0x5a06fa[_0x8689('0x34')]['filter']+'%'};return _0x22ddf4;}})});}_0x2fd9a9=_[_0x8689('0x3d')]({},_0x2fd9a9,_0x5a06fa[_0x8689('0x3e')]);var _0x4fc917={'where':_0x2fd9a9[_0x8689('0x38')]};return db[_0x8689('0x2c')]['count'](_0x4fc917)[_0x8689('0x25')](function(_0x3ee960){_0x551806['count']=_0x3ee960;if(_0x5a06fa[_0x8689('0x34')]['includeAll']){_0x2fd9a9[_0x8689('0x3f')]=[{'all':!![]}];}return db[_0x8689('0x2c')]['findAll'](_0x2fd9a9);})[_0x8689('0x25')](function(_0x34bfef){_0x551806[_0x8689('0x40')]=_0x34bfef;return _0x551806;})[_0x8689('0x25')](respondWithFilteredResult(_0x3e9f2a,_0x2fd9a9))['catch'](handleError(_0x3e9f2a,null));};exports[_0x8689('0x41')]=function(_0x45791e,_0x384e01){var _0x2dc080={'raw':!![],'where':{'id':_0x45791e[_0x8689('0x42')]['id']}},_0x3c0bbd={};_0x3c0bbd[_0x8689('0x30')]=_[_0x8689('0x43')](db[_0x8689('0x2c')][_0x8689('0x2d')]);_0x3c0bbd[_0x8689('0x34')]=_[_0x8689('0x43')](_0x45791e[_0x8689('0x34')]);_0x3c0bbd[_0x8689('0x39')]=_[_0x8689('0x32')](_0x3c0bbd[_0x8689('0x30')],_0x3c0bbd[_0x8689('0x34')]);_0x2dc080[_0x8689('0x35')]=_[_0x8689('0x32')](_0x3c0bbd['model'],qs['fields'](_0x45791e['query'][_0x8689('0x33')]));_0x2dc080[_0x8689('0x35')]=_0x2dc080[_0x8689('0x35')][_0x8689('0x44')]?_0x2dc080['attributes']:_0x3c0bbd[_0x8689('0x30')];if(_0x45791e[_0x8689('0x34')][_0x8689('0x45')]){_0x2dc080[_0x8689('0x3f')]=[{'all':!![]}];}_0x2dc080=_[_0x8689('0x3d')]({},_0x2dc080,_0x45791e['options']);return db['CmCustomField'][_0x8689('0x46')](_0x2dc080)[_0x8689('0x25')](handleEntityNotFound(_0x384e01,null))[_0x8689('0x25')](respondWithResult(_0x384e01,null))[_0x8689('0x47')](handleError(_0x384e01,null));};exports['update']=function(_0x28be23,_0x54cf84){if(_0x28be23[_0x8689('0x48')]['id']){delete _0x28be23[_0x8689('0x48')]['id'];}return db['CmCustomField'][_0x8689('0x46')]({'where':{'id':_0x28be23['params']['id']}})[_0x8689('0x25')](handleEntityNotFound(_0x54cf84,null))['then'](saveUpdates(_0x28be23['body'],null))[_0x8689('0x25')](respondWithResult(_0x54cf84,null))[_0x8689('0x47')](handleError(_0x54cf84,null));};exports[_0x8689('0x49')]=function(_0x26677e,_0x425d18){return db[_0x8689('0x2c')]['find']({'where':{'id':_0x26677e[_0x8689('0x42')]['id']}})['then'](handleEntityNotFound(_0x425d18,null))[_0x8689('0x25')](removeEntity(_0x425d18,null))[_0x8689('0x47')](handleError(_0x425d18,null));};exports[_0x8689('0x4a')]=function(_0x378aaf,_0x211794){var _0xf1a81a;return db['sequelize'][_0x8689('0x4b')](function(_0x50b665){return db[_0x8689('0x2c')]['create'](_0x378aaf[_0x8689('0x48')],{'transaction':_0x50b665})[_0x8689('0x25')](function(_0x4d6d94){_0xf1a81a=_0x4d6d94;var _0x392853={'type':db['Sequelize']['TEXT'],'transaction':_0x50b665};switch(_0x378aaf[_0x8689('0x48')][_0x8689('0x2f')]){case _0x8689('0x4c'):_0x392853['type']=db['Sequelize'][_0x8689('0x4d')];break;case _0x8689('0x4e'):_0x392853[_0x8689('0x2f')]=db[_0x8689('0x4f')][_0x8689('0x50')];break;case _0x8689('0x51'):_0x392853[_0x8689('0x2f')]=db[_0x8689('0x4f')]['BOOLEAN'];_0x392853[_0x8689('0x52')]=![];break;default:}return db[_0x8689('0x53')]['queryInterface']['addColumn'](_0x8689('0x54'),util['format'](_0x8689('0x55'),_0xf1a81a['id']),_0x392853);})[_0x8689('0x25')](function(){return _0xf1a81a;});})[_0x8689('0x25')](respondWithResult(_0x211794,0xc9))[_0x8689('0x47')](handleError(_0x211794,null));}; \ No newline at end of file +var _0xeb00=['../../config/environment','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','body','sequelize','transaction','create','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xeb00,0x198));var _0x0eb0=function(_0xd538ab,_0x29f604){_0xd538ab=_0xd538ab-0x0;var _0x2b6944=_0xeb00[_0xd538ab];return _0x2b6944;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0eb0('0x0'));var rimraf=require(_0x0eb0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0eb0('0x2'));var rp=require('request-promise');var moment=require(_0x0eb0('0x3'));var BPromise=require(_0x0eb0('0x4'));var Mustache=require(_0x0eb0('0x5'));var util=require(_0x0eb0('0x6'));var path=require(_0x0eb0('0x7'));var sox=require('sox');var csv=require(_0x0eb0('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0eb0('0x9'));var squel=require(_0x0eb0('0xa'));var crypto=require('crypto');var jsforce=require(_0x0eb0('0xb'));var deskjs=require(_0x0eb0('0xc'));var toCsv=require(_0x0eb0('0x8'));var querystring=require(_0x0eb0('0xd'));var Papa=require(_0x0eb0('0xe'));var Redis=require('ioredis');var authService=require(_0x0eb0('0xf'));var qs=require(_0x0eb0('0x10'));var as=require(_0x0eb0('0x11'));var hardwareService=require(_0x0eb0('0x12'));var logger=require(_0x0eb0('0x13'))(_0x0eb0('0x14'));var utils=require(_0x0eb0('0x15'));var config=require(_0x0eb0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0eb0('0x17'))['db'];function respondWithStatusCode(_0x1230f8,_0x44e01c){_0x44e01c=_0x44e01c||0xcc;return function(_0xfd3fa){if(_0xfd3fa){return _0x1230f8['sendStatus'](_0x44e01c);}return _0x1230f8['status'](_0x44e01c)[_0x0eb0('0x18')]();};}function respondWithResult(_0x456893,_0x54885c){_0x54885c=_0x54885c||0xc8;return function(_0x482573){if(_0x482573){return _0x456893['status'](_0x54885c)[_0x0eb0('0x19')](_0x482573);}};}function respondWithFilteredResult(_0x21b393,_0x11463b){return function(_0x3aad24){if(_0x3aad24){var _0x1473bf=_0x3aad24[_0x0eb0('0x1a')],_0x5e9f40=_0x11463b['offset'],_0x167eb7=_0x11463b[_0x0eb0('0x1b')]+_0x11463b[_0x0eb0('0x1c')],_0x58d3ed;if(_0x167eb7>=_0x1473bf){_0x167eb7=_0x1473bf;_0x58d3ed=0xc8;}else{_0x58d3ed=0xce;}_0x21b393[_0x0eb0('0x1d')](_0x58d3ed);return _0x21b393[_0x0eb0('0x1e')](_0x0eb0('0x1f'),_0x5e9f40+'-'+_0x167eb7+'/'+_0x1473bf)[_0x0eb0('0x19')](_0x3aad24);}return null;};}function patchUpdates(_0x390a80){return function(_0x1c0ed7){try{jsonpatch['apply'](_0x1c0ed7,_0x390a80,!![]);}catch(_0x49c6bc){return BPromise['reject'](_0x49c6bc);}return _0x1c0ed7[_0x0eb0('0x20')]();};}function saveUpdates(_0x409a04,_0xd31ecd){return function(_0x3e50fd){if(_0x3e50fd){return _0x3e50fd[_0x0eb0('0x21')](_0x409a04)['then'](function(_0x58459b){return _0x58459b;});}return null;};}function removeEntity(_0x160350,_0x29e1d0){return function(_0x5bb617){if(_0x5bb617){return _0x5bb617[_0x0eb0('0x22')]()[_0x0eb0('0x23')](function(){_0x160350[_0x0eb0('0x1d')](0xcc)[_0x0eb0('0x18')]();});}};}function handleEntityNotFound(_0x441162,_0x38b834){return function(_0x131aea){if(!_0x131aea){_0x441162[_0x0eb0('0x24')](0x194);}return _0x131aea;};}function handleError(_0x7ac14a,_0x42a8f0){_0x42a8f0=_0x42a8f0||0x1f4;return function(_0x321e92){logger[_0x0eb0('0x25')](_0x321e92[_0x0eb0('0x26')]);if(_0x321e92[_0x0eb0('0x27')]){delete _0x321e92['name'];}_0x7ac14a['status'](_0x42a8f0)[_0x0eb0('0x28')](_0x321e92);};}exports[_0x0eb0('0x29')]=function(_0x461680,_0x5bd6a7){var _0x4b5f6a={},_0x336684={},_0x582697={'count':0x0,'rows':[]};var _0x1fdca9=_[_0x0eb0('0x2a')](db[_0x0eb0('0x2b')][_0x0eb0('0x2c')],function(_0x13981a){return{'name':_0x13981a['fieldName'],'type':_0x13981a[_0x0eb0('0x2d')][_0x0eb0('0x2e')]};});_0x336684[_0x0eb0('0x2f')]=_['differenceBy'](_[_0x0eb0('0x2a')](_0x1fdca9,_0x0eb0('0x27')),[_0x0eb0('0x27')]);_0x336684[_0x0eb0('0x30')]=_[_0x0eb0('0x31')](_0x461680['query']);_0x336684[_0x0eb0('0x32')]=_[_0x0eb0('0x33')](_0x336684['model'],_0x336684[_0x0eb0('0x30')]);_0x4b5f6a['attributes']=_[_0x0eb0('0x33')](_0x336684['model'],qs[_0x0eb0('0x34')](_0x461680[_0x0eb0('0x30')]['fields']));_0x4b5f6a['attributes']=_0x4b5f6a[_0x0eb0('0x35')][_0x0eb0('0x36')]?_0x4b5f6a[_0x0eb0('0x35')]:_0x336684[_0x0eb0('0x2f')];if(!_0x461680['query'][_0x0eb0('0x37')](_0x0eb0('0x38'))){_0x4b5f6a[_0x0eb0('0x1c')]=qs['limit'](_0x461680[_0x0eb0('0x30')]['limit']);_0x4b5f6a['offset']=qs[_0x0eb0('0x1b')](_0x461680['query'][_0x0eb0('0x1b')]);}_0x4b5f6a[_0x0eb0('0x39')]=qs[_0x0eb0('0x3a')](_0x461680[_0x0eb0('0x30')][_0x0eb0('0x3a')]);_0x4b5f6a['where']=qs[_0x0eb0('0x32')](_['pick'](_0x461680[_0x0eb0('0x30')],_0x336684['filters']),_0x1fdca9);if(_0x461680[_0x0eb0('0x30')]['filter']){_0x4b5f6a[_0x0eb0('0x3b')]=_[_0x0eb0('0x3c')](_0x4b5f6a['where'],{'$or':_['map'](_0x1fdca9,function(_0x4895b1){if(_0x4895b1[_0x0eb0('0x2d')]!==_0x0eb0('0x3d')){var _0x4aa2bd={};_0x4aa2bd[_0x4895b1['name']]={'$like':'%'+_0x461680[_0x0eb0('0x30')][_0x0eb0('0x3e')]+'%'};return _0x4aa2bd;}})});}_0x4b5f6a=_['merge']({},_0x4b5f6a,_0x461680[_0x0eb0('0x3f')]);var _0x12b381={'where':_0x4b5f6a['where']};return db[_0x0eb0('0x2b')][_0x0eb0('0x1a')](_0x12b381)[_0x0eb0('0x23')](function(_0x1faeb7){_0x582697[_0x0eb0('0x1a')]=_0x1faeb7;if(_0x461680[_0x0eb0('0x30')][_0x0eb0('0x40')]){_0x4b5f6a['include']=[{'all':!![]}];}return db['CmCustomField'][_0x0eb0('0x41')](_0x4b5f6a);})[_0x0eb0('0x23')](function(_0x4ee0c3){_0x582697[_0x0eb0('0x42')]=_0x4ee0c3;return _0x582697;})[_0x0eb0('0x23')](respondWithFilteredResult(_0x5bd6a7,_0x4b5f6a))[_0x0eb0('0x43')](handleError(_0x5bd6a7,null));};exports[_0x0eb0('0x44')]=function(_0xa428a3,_0x4600f8){var _0x116f09={'raw':!![],'where':{'id':_0xa428a3[_0x0eb0('0x45')]['id']}},_0x392dda={};_0x392dda[_0x0eb0('0x2f')]=_[_0x0eb0('0x31')](db['CmCustomField'][_0x0eb0('0x2c')]);_0x392dda['query']=_[_0x0eb0('0x31')](_0xa428a3[_0x0eb0('0x30')]);_0x392dda[_0x0eb0('0x32')]=_[_0x0eb0('0x33')](_0x392dda[_0x0eb0('0x2f')],_0x392dda[_0x0eb0('0x30')]);_0x116f09[_0x0eb0('0x35')]=_[_0x0eb0('0x33')](_0x392dda[_0x0eb0('0x2f')],qs[_0x0eb0('0x34')](_0xa428a3['query']['fields']));_0x116f09[_0x0eb0('0x35')]=_0x116f09[_0x0eb0('0x35')][_0x0eb0('0x36')]?_0x116f09[_0x0eb0('0x35')]:_0x392dda[_0x0eb0('0x2f')];if(_0xa428a3[_0x0eb0('0x30')][_0x0eb0('0x40')]){_0x116f09[_0x0eb0('0x46')]=[{'all':!![]}];}_0x116f09=_[_0x0eb0('0x3c')]({},_0x116f09,_0xa428a3[_0x0eb0('0x3f')]);return db[_0x0eb0('0x2b')][_0x0eb0('0x47')](_0x116f09)[_0x0eb0('0x23')](handleEntityNotFound(_0x4600f8,null))['then'](respondWithResult(_0x4600f8,null))['catch'](handleError(_0x4600f8,null));};exports[_0x0eb0('0x21')]=function(_0x5ddc3e,_0x50579a){if(_0x5ddc3e['body']['id']){delete _0x5ddc3e[_0x0eb0('0x48')]['id'];}return db[_0x0eb0('0x2b')][_0x0eb0('0x47')]({'where':{'id':_0x5ddc3e[_0x0eb0('0x45')]['id']}})['then'](handleEntityNotFound(_0x50579a,null))[_0x0eb0('0x23')](saveUpdates(_0x5ddc3e['body'],null))['then'](respondWithResult(_0x50579a,null))[_0x0eb0('0x43')](handleError(_0x50579a,null));};exports[_0x0eb0('0x22')]=function(_0x34d212,_0xdcfcd3){return db['CmCustomField'][_0x0eb0('0x47')]({'where':{'id':_0x34d212[_0x0eb0('0x45')]['id']}})['then'](handleEntityNotFound(_0xdcfcd3,null))[_0x0eb0('0x23')](removeEntity(_0xdcfcd3,null))[_0x0eb0('0x43')](handleError(_0xdcfcd3,null));};exports['create']=function(_0x326093,_0x287141){var _0x4c65b4;return db[_0x0eb0('0x49')][_0x0eb0('0x4a')](function(_0x325231){return db[_0x0eb0('0x2b')][_0x0eb0('0x4b')](_0x326093[_0x0eb0('0x48')],{'transaction':_0x325231})[_0x0eb0('0x23')](function(_0x565a1e){_0x4c65b4=_0x565a1e;var _0x520822={'type':db[_0x0eb0('0x4c')]['TEXT'],'transaction':_0x325231};switch(_0x326093['body'][_0x0eb0('0x2d')]){case'text':_0x520822['type']=db[_0x0eb0('0x4c')]['TEXT'];break;case _0x0eb0('0x4d'):_0x520822[_0x0eb0('0x2d')]=db['Sequelize'][_0x0eb0('0x4e')];break;case _0x0eb0('0x4f'):_0x520822[_0x0eb0('0x2d')]=db[_0x0eb0('0x4c')][_0x0eb0('0x50')];_0x520822[_0x0eb0('0x51')]=![];break;default:}return db[_0x0eb0('0x49')][_0x0eb0('0x52')][_0x0eb0('0x53')]('cm_contacts',util[_0x0eb0('0x54')](_0x0eb0('0x55'),_0x4c65b4['id']),_0x520822);})[_0x0eb0('0x23')](function(){return _0x4c65b4;});})['then'](respondWithResult(_0x287141,0xc9))[_0x0eb0('0x43')](handleError(_0x287141,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 3cb03fb..2b458e6 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 _0x41a6=['../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x33e7f7,_0x1b8488){var _0x113435=function(_0xd01449){while(--_0xd01449){_0x33e7f7['push'](_0x33e7f7['shift']());}};_0x113435(++_0x1b8488);}(_0x41a6,0x1c8));var _0x641a=function(_0x17df94,_0x6f7037){_0x17df94=_0x17df94-0x0;var _0x2ecd50=_0x41a6[_0x17df94];return _0x2ecd50;};'use strict';var _=require(_0x641a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x641a('0x1'));var moment=require('moment');var BPromise=require(_0x641a('0x2'));var rp=require(_0x641a('0x3'));var fs=require('fs');var path=require(_0x641a('0x4'));var rimraf=require(_0x641a('0x5'));var config=require(_0x641a('0x6'));var attributes=require('./cmCustomField.attributes');module[_0x641a('0x7')]=function(_0x1d37d1,_0x281e5c){return _0x1d37d1[_0x641a('0x8')](_0x641a('0x9'),attributes,{'tableName':_0x641a('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3067=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2ac7c2,_0x4d51b2){var _0x37834e=function(_0xa91fb8){while(--_0xa91fb8){_0x2ac7c2['push'](_0x2ac7c2['shift']());}};_0x37834e(++_0x4d51b2);}(_0x3067,0x7e));var _0x7306=function(_0x174fce,_0x7f5aa6){_0x174fce=_0x174fce-0x0;var _0x37a41c=_0x3067[_0x174fce];return _0x37a41c;};'use strict';var _=require(_0x7306('0x0'));var util=require(_0x7306('0x1'));var logger=require(_0x7306('0x2'))(_0x7306('0x3'));var moment=require(_0x7306('0x4'));var BPromise=require(_0x7306('0x5'));var rp=require(_0x7306('0x6'));var fs=require('fs');var path=require(_0x7306('0x7'));var rimraf=require(_0x7306('0x8'));var config=require(_0x7306('0x9'));var attributes=require(_0x7306('0xa'));module[_0x7306('0xb')]=function(_0x16f4ec,_0x3ecef7){return _0x16f4ec[_0x7306('0xc')](_0x7306('0xd'),attributes,{'tableName':_0x7306('0xe'),'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 7e6243d..6f9ff92 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 _0x524a=['request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x524a,0xf5));var _0xa524=function(_0x401af6,_0x3d57a0){_0x401af6=_0x401af6-0x0;var _0x3c6d44=_0x524a[_0x401af6];return _0x3c6d44;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var moment=require(_0xa524('0x2'));var BPromise=require(_0xa524('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa524('0x4'));var db=require(_0xa524('0x5'))['db'];var utils=require(_0xa524('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa524('0x7'));var jayson=require(_0xa524('0x8'));var client=jayson[_0xa524('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x460738,_0x56bd0e,_0x3a2dd6){return new BPromise(function(_0x11aa98,_0x56849e){return client[_0xa524('0xa')](_0x460738,_0x3a2dd6)[_0xa524('0xb')](function(_0x228ffe){logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,'request\x20sent');logger[_0xa524('0xe')](_0xa524('0xf'),_0x56bd0e,'request\x20sent',JSON['stringify'](_0x228ffe));if(_0x228ffe[_0xa524('0x10')]){if(_0x228ffe[_0xa524('0x10')][_0xa524('0x11')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')]['message']);return _0x56849e(_0x228ffe[_0xa524('0x10')]['message']);}logger[_0xa524('0x10')]('CmCustomField,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')][_0xa524('0x12')]);return _0x11aa98(_0x228ffe['error'][_0xa524('0x12')]);}else{logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,_0xa524('0x13'));_0x11aa98(_0x228ffe[_0xa524('0x14')][_0xa524('0x12')]);}})[_0xa524('0x15')](function(_0x4fc42f){logger[_0xa524('0x10')](_0xa524('0xd'),_0x56bd0e,_0x4fc42f);_0x56849e(_0x4fc42f);});});} \ No newline at end of file +var _0x80d9=['http','request','then','info','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3e8bd9,_0x2cf342){var _0x47e80e=function(_0x142ef3){while(--_0x142ef3){_0x3e8bd9['push'](_0x3e8bd9['shift']());}};_0x47e80e(++_0x2cf342);}(_0x80d9,0x15c));var _0x980d=function(_0xcce94e,_0x57e9f3){_0xcce94e=_0xcce94e-0x0;var _0x1da23a=_0x80d9[_0xcce94e];return _0x1da23a;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var moment=require(_0x980d('0x1'));var BPromise=require(_0x980d('0x2'));var rs=require(_0x980d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x980d('0x4'))['db'];var utils=require(_0x980d('0x5'));var logger=require(_0x980d('0x6'))(_0x980d('0x7'));var config=require(_0x980d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x980d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50854e,_0x5d9eb0,_0x7e96f7){return new BPromise(function(_0x758fc3,_0x2b8e2c){return client[_0x980d('0xa')](_0x50854e,_0x7e96f7)[_0x980d('0xb')](function(_0xef5778){logger[_0x980d('0xc')]('CmCustomField,\x20%s,\x20%s',_0x5d9eb0,'request\x20sent');logger['debug'](_0x980d('0xd'),_0x5d9eb0,_0x980d('0xe'),JSON['stringify'](_0xef5778));if(_0xef5778[_0x980d('0xf')]){if(_0xef5778['error'][_0x980d('0x10')]===0x1f4){logger['error'](_0x980d('0x11'),_0x5d9eb0,_0xef5778[_0x980d('0xf')][_0x980d('0x12')]);return _0x2b8e2c(_0xef5778[_0x980d('0xf')][_0x980d('0x12')]);}logger[_0x980d('0xf')](_0x980d('0x11'),_0x5d9eb0,_0xef5778[_0x980d('0xf')]['message']);return _0x758fc3(_0xef5778[_0x980d('0xf')][_0x980d('0x12')]);}else{logger[_0x980d('0xc')](_0x980d('0x11'),_0x5d9eb0,_0x980d('0xe'));_0x758fc3(_0xef5778[_0x980d('0x13')]['message']);}})[_0x980d('0x14')](function(_0x393ae2){logger['error'](_0x980d('0x11'),_0x5d9eb0,_0x393ae2);_0x2b8e2c(_0x393ae2);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index f74dc83..30650f4 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 _0xe4c0=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0xcd12b2,_0x4a1331){var _0x1bda72=function(_0xd71782){while(--_0xd71782){_0xcd12b2['push'](_0xcd12b2['shift']());}};_0x1bda72(++_0x4a1331);}(_0xe4c0,0x10c));var _0x0e4c=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xe4c0[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0x0e4c('0x0'));var util=require(_0x0e4c('0x1'));var path=require(_0x0e4c('0x2'));var timeout=require(_0x0e4c('0x3'));var express=require(_0x0e4c('0x4'));var router=express['Router']();var auth=require(_0x0e4c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e4c('0x6'));var controller=require('./cmCustomField.controller');router[_0x0e4c('0x7')]('/',auth[_0x0e4c('0x8')](),controller[_0x0e4c('0x9')]);router[_0x0e4c('0x7')](_0x0e4c('0xa'),auth[_0x0e4c('0x8')](),controller[_0x0e4c('0xb')]);router[_0x0e4c('0xc')]('/',auth[_0x0e4c('0x8')](),controller[_0x0e4c('0xd')]);router[_0x0e4c('0xe')](_0x0e4c('0xa'),auth[_0x0e4c('0x8')](),controller[_0x0e4c('0xf')]);router[_0x0e4c('0x10')](_0x0e4c('0xa'),auth['isAuthenticated'](),controller[_0x0e4c('0x11')]);module[_0x0e4c('0x12')]=router; \ No newline at end of file +var _0x6645=['util','path','connect-timeout','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer'];(function(_0x525886,_0x5af525){var _0x3a0ea9=function(_0x99946d){while(--_0x99946d){_0x525886['push'](_0x525886['shift']());}};_0x3a0ea9(++_0x5af525);}(_0x6645,0xcb));var _0x5664=function(_0x264693,_0xfc65fb){_0x264693=_0x264693-0x0;var _0x27b74b=_0x6645[_0x264693];return _0x27b74b;};'use strict';var multer=require(_0x5664('0x0'));var util=require(_0x5664('0x1'));var path=require(_0x5664('0x2'));var timeout=require(_0x5664('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x5664('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5664('0x5'));var controller=require(_0x5664('0x6'));router[_0x5664('0x7')]('/',auth[_0x5664('0x8')](),controller[_0x5664('0x9')]);router[_0x5664('0x7')](_0x5664('0xa'),auth[_0x5664('0x8')](),controller[_0x5664('0xb')]);router[_0x5664('0xc')]('/',auth[_0x5664('0x8')](),controller['create']);router['put'](_0x5664('0xa'),auth[_0x5664('0x8')](),controller[_0x5664('0xd')]);router[_0x5664('0xe')](_0x5664('0xa'),auth['isAuthenticated'](),controller[_0x5664('0xf')]);module[_0x5664('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index c83383a..3691e9e 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 _0x29d4=['INTEGER','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN','DATE','format'];(function(_0x59e85e,_0x4e399b){var _0x34e955=function(_0xebbfce){while(--_0xebbfce){_0x59e85e['push'](_0x59e85e['shift']());}};_0x34e955(++_0x4e399b);}(_0x29d4,0x1a1));var _0x429d=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x29d4[_0x5b561d];return _0x431060;};'use strict';var moment=require(_0x429d('0x0'));var Sequelize=require('sequelize');module[_0x429d('0x1')]={'phone':{'type':Sequelize[_0x429d('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x429d('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x429d('0x4')],'defaultValue':moment()[_0x429d('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x429d('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x429d('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x429d('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x429d('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x429d('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x429d('0x4')]},'priority':{'type':Sequelize[_0x429d('0x6')](0x2)[_0x429d('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x429d('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x429d('0x6')],'unique':_0x429d('0x8')},'UserId':{'type':Sequelize[_0x429d('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x429d('0x8')},'CampaignId':{'type':Sequelize[_0x429d('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x429d('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x429d('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x429d('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbf5=['sequelize','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue'];(function(_0x46de01,_0x41a5c6){var _0x12a8cb=function(_0x5d50ad){while(--_0x5d50ad){_0x46de01['push'](_0x46de01['shift']());}};_0x12a8cb(++_0x41a5c6);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5d5427,_0x1459da){_0x5d5427=_0x5d5427-0x0;var _0x99fef6=_0xdbf5[_0x5d5427];return _0x99fef6;};'use strict';var moment=require('moment');var Sequelize=require(_0x5dbf('0x0'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5dbf('0x2')],'defaultValue':moment()[_0x5dbf('0x3')](_0x5dbf('0x4'))},'countbusyretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5dbf('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5dbf('0x2')]},'priority':{'type':Sequelize[_0x5dbf('0x5')](0x2)[_0x5dbf('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x5dbf('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x5dbf('0x8')},'UserId':{'type':Sequelize[_0x5dbf('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x5dbf('0x5')],'unique':_0x5dbf('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index a303d50..ea866a2 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 _0xcabe=['includeAll','find','catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','dialOrderByScheduledAt','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','dialActive','getOpenContacts','preview','isNumber','entity\x20not\x20found','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','error','name','send','map','CmHopper','fieldName','type','key','model','query','filters','intersection','concat','$and','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','rows','show','params','rawAttributes','keys'];(function(_0x4005a1,_0x2a969d){var _0x456454=function(_0x2b689d){while(--_0x2b689d){_0x4005a1['push'](_0x4005a1['shift']());}};_0x456454(++_0x2a969d);}(_0xcabe,0x1ef));var _0xecab=function(_0x17cf0e,_0x1d0ca3){_0x17cf0e=_0x17cf0e-0x0;var _0x164f9d=_0xcabe[_0x17cf0e];return _0x164f9d;};'use strict';var pdf=require(_0xecab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xecab('0x1'));var zipdir=require(_0xecab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecab('0x3'));var moment=require(_0xecab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xecab('0x5'));var util=require(_0xecab('0x6'));var path=require(_0xecab('0x7'));var sox=require('sox');var csv=require(_0xecab('0x8'));var ejs=require(_0xecab('0x9'));var fs=require('fs');var _=require(_0xecab('0xa'));var squel=require(_0xecab('0xb'));var crypto=require(_0xecab('0xc'));var jsforce=require(_0xecab('0xd'));var deskjs=require(_0xecab('0xe'));var toCsv=require(_0xecab('0x8'));var querystring=require(_0xecab('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xecab('0x10'));var qs=require(_0xecab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecab('0x12'));var logger=require(_0xecab('0x13'))(_0xecab('0x14'));var utils=require(_0xecab('0x15'));var config=require(_0xecab('0x16'));var licenseUtil=require(_0xecab('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d161e,_0x24cf0c){_0x24cf0c=_0x24cf0c||0xcc;return function(_0x1d04c1){if(_0x1d04c1){return _0x3d161e[_0xecab('0x18')](_0x24cf0c);}return _0x3d161e[_0xecab('0x19')](_0x24cf0c)[_0xecab('0x1a')]();};}function respondWithResult(_0x56a6db,_0x1a9aab){_0x1a9aab=_0x1a9aab||0xc8;return function(_0x56a614){if(_0x56a614){return _0x56a6db['status'](_0x1a9aab)[_0xecab('0x1b')](_0x56a614);}};}function respondWithFilteredResult(_0x3af1a6,_0x356c4e){return function(_0x1c019f){if(_0x1c019f){var _0x5bdb81=_0x1c019f[_0xecab('0x1c')],_0x35feb8=_0x356c4e[_0xecab('0x1d')],_0x1c5871=_0x356c4e['offset']+_0x356c4e[_0xecab('0x1e')],_0x260a09;if(_0x1c5871>=_0x5bdb81){_0x1c5871=_0x5bdb81;_0x260a09=0xc8;}else{_0x260a09=0xce;}_0x3af1a6[_0xecab('0x19')](_0x260a09);return _0x3af1a6['set'](_0xecab('0x1f'),_0x35feb8+'-'+_0x1c5871+'/'+_0x5bdb81)[_0xecab('0x1b')](_0x1c019f);}return null;};}function patchUpdates(_0x157606){return function(_0xa22814){try{jsonpatch[_0xecab('0x20')](_0xa22814,_0x157606,!![]);}catch(_0xbafd2){return BPromise['reject'](_0xbafd2);}return _0xa22814[_0xecab('0x21')]();};}function saveUpdates(_0x2ec6fb,_0x1fdd1d){return function(_0x50eb82){if(_0x50eb82){return _0x50eb82[_0xecab('0x22')](_0x2ec6fb)['then'](function(_0x187620){return _0x187620;});}return null;};}function removeEntity(_0x5e31aa,_0x184dbc){return function(_0x94d9c2){if(_0x94d9c2){return _0x94d9c2[_0xecab('0x23')]()[_0xecab('0x24')](function(){_0x5e31aa[_0xecab('0x19')](0xcc)[_0xecab('0x1a')]();});}};}function handleEntityNotFound(_0x44ba86,_0x2991a3){return function(_0x3c701e){if(!_0x3c701e){_0x44ba86[_0xecab('0x18')](0x194);}return _0x3c701e;};}function handleError(_0x30191f,_0x270946){_0x270946=_0x270946||0x1f4;return function(_0x492a09){logger[_0xecab('0x25')](_0x492a09['stack']);if(_0x492a09[_0xecab('0x26')]){delete _0x492a09[_0xecab('0x26')];}_0x30191f['status'](_0x270946)[_0xecab('0x27')](_0x492a09);};}exports['index']=function(_0x56c98e,_0x2d6a57){var _0xe97566={},_0x974659={},_0x3f1666={'count':0x0,'rows':[]};var _0x34ded8=_[_0xecab('0x28')](db[_0xecab('0x29')]['rawAttributes'],function(_0x59b07b){return{'name':_0x59b07b[_0xecab('0x2a')],'type':_0x59b07b[_0xecab('0x2b')][_0xecab('0x2c')]};});_0x974659[_0xecab('0x2d')]=_[_0xecab('0x28')](_0x34ded8,_0xecab('0x26'));_0x974659['query']=_['keys'](_0x56c98e[_0xecab('0x2e')]);_0x974659[_0xecab('0x2f')]=_[_0xecab('0x30')](_0x974659[_0xecab('0x2d')],_0x974659[_0xecab('0x2e')]);_0x974659[_0xecab('0x2f')]=_[_0xecab('0x31')](_0x974659[_0xecab('0x2f')],[_0xecab('0x32'),'$or','$gt','$gte','$lt','$lte',_0xecab('0x33'),_0xecab('0x34'),_0xecab('0x35'),_0xecab('0x36'),_0xecab('0x37'),_0xecab('0x38'),_0xecab('0x39'),_0xecab('0x3a'),_0xecab('0x3b'),_0xecab('0x3c'),'$notILike',_0xecab('0x3a'),'$overlap','$contains',_0xecab('0x3d'),'$any']);_0xe97566[_0xecab('0x3e')]=_[_0xecab('0x30')](_0x974659['model'],qs[_0xecab('0x3f')](_0x56c98e[_0xecab('0x2e')][_0xecab('0x3f')]));_0xe97566[_0xecab('0x3e')]=_0xe97566['attributes'][_0xecab('0x40')]?_0xe97566[_0xecab('0x3e')]:_0x974659[_0xecab('0x2d')];if(!_0x56c98e['query'][_0xecab('0x41')](_0xecab('0x42'))){_0xe97566['limit']=qs[_0xecab('0x1e')](_0x56c98e[_0xecab('0x2e')][_0xecab('0x1e')]);_0xe97566['offset']=qs['offset'](_0x56c98e['query'][_0xecab('0x1d')]);}_0xe97566[_0xecab('0x43')]=qs[_0xecab('0x44')](_0x56c98e[_0xecab('0x2e')][_0xecab('0x44')]);_0xe97566[_0xecab('0x45')]=qs[_0xecab('0x2f')](_[_0xecab('0x46')](_0x56c98e['query'],_0x974659[_0xecab('0x2f')]),_0x34ded8);if(_0x56c98e['query']['filter']){_0xe97566['where']=_['merge'](_0xe97566[_0xecab('0x45')],{'$or':_[_0xecab('0x28')](_0x34ded8,function(_0x5e32bf){if(_0x5e32bf[_0xecab('0x2b')]!==_0xecab('0x47')){var _0x46eb8d={};_0x46eb8d[_0x5e32bf[_0xecab('0x26')]]={'$like':'%'+_0x56c98e[_0xecab('0x2e')][_0xecab('0x48')]+'%'};return _0x46eb8d;}})});}_0xe97566=_[_0xecab('0x49')]({},_0xe97566,_0x56c98e[_0xecab('0x4a')]);var _0x54cfcf={'where':_0xe97566[_0xecab('0x45')]};return db[_0xecab('0x29')][_0xecab('0x1c')](_0x54cfcf)[_0xecab('0x24')](function(_0x3df1dd){_0x3f1666[_0xecab('0x1c')]=_0x3df1dd;if(_0x56c98e['query']['includeAll']){_0xe97566[_0xecab('0x4b')]=[{'all':!![]}];}return db[_0xecab('0x29')]['findAll'](_0xe97566);})['then'](function(_0x3f1f99){_0x3f1666[_0xecab('0x4c')]=_0x3f1f99;return _0x3f1666;})[_0xecab('0x24')](respondWithFilteredResult(_0x2d6a57,_0xe97566))['catch'](handleError(_0x2d6a57,null));};exports[_0xecab('0x4d')]=function(_0x769b7e,_0x3989ca){var _0x514179={'raw':!![],'where':{'id':_0x769b7e[_0xecab('0x4e')]['id']}},_0x42dddb={};_0x42dddb[_0xecab('0x2d')]=_['keys'](db[_0xecab('0x29')][_0xecab('0x4f')]);_0x42dddb[_0xecab('0x2e')]=_[_0xecab('0x50')](_0x769b7e[_0xecab('0x2e')]);_0x42dddb[_0xecab('0x2f')]=_[_0xecab('0x30')](_0x42dddb[_0xecab('0x2d')],_0x42dddb['query']);_0x514179[_0xecab('0x3e')]=_[_0xecab('0x30')](_0x42dddb[_0xecab('0x2d')],qs[_0xecab('0x3f')](_0x769b7e['query']['fields']));_0x514179['attributes']=_0x514179[_0xecab('0x3e')][_0xecab('0x40')]?_0x514179[_0xecab('0x3e')]:_0x42dddb[_0xecab('0x2d')];if(_0x769b7e[_0xecab('0x2e')][_0xecab('0x51')]){_0x514179['include']=[{'all':!![]}];}_0x514179=_[_0xecab('0x49')]({},_0x514179,_0x769b7e[_0xecab('0x4a')]);return db[_0xecab('0x29')][_0xecab('0x52')](_0x514179)[_0xecab('0x24')](handleEntityNotFound(_0x3989ca,null))[_0xecab('0x24')](respondWithResult(_0x3989ca,null))[_0xecab('0x53')](handleError(_0x3989ca,null));};exports[_0xecab('0x54')]=function(_0x538059,_0x425a4e){return db[_0xecab('0x29')][_0xecab('0x54')](_0x538059[_0xecab('0x55')],{})['then'](respondWithResult(_0x425a4e,0xc9))[_0xecab('0x53')](handleError(_0x425a4e,null));};exports[_0xecab('0x22')]=function(_0x439b9a,_0x3d048e){if(_0x439b9a['body']['id']){delete _0x439b9a[_0xecab('0x55')]['id'];}return db[_0xecab('0x29')][_0xecab('0x52')]({'where':{'id':_0x439b9a[_0xecab('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d048e,null))[_0xecab('0x24')](saveUpdates(_0x439b9a[_0xecab('0x55')],null))[_0xecab('0x24')](respondWithResult(_0x3d048e,null))['catch'](handleError(_0x3d048e,null));};exports['describe']=function(_0x27b81f,_0x5e7d6f){return db['CmHopper'][_0xecab('0x56')]()[_0xecab('0x24')](respondWithResult(_0x5e7d6f,null))[_0xecab('0x53')](handleError(_0x5e7d6f,null));};exports[_0xecab('0x23')]=function(_0x3dce74,_0x2799a0){var _0x3aaee9;return db['CmHopper'][_0xecab('0x52')]({'where':{'id':_0x3dce74[_0xecab('0x4e')]['id']}})[_0xecab('0x24')](handleEntityNotFound(_0x2799a0,null))['then'](function(_0x8f4d7c){if(_0x8f4d7c){return _0x8f4d7c[_0xecab('0x23')]()[_0xecab('0x24')](function(_0x28d250){return _0x28d250;});}})[_0xecab('0x24')](function(_0x37d027){_0x3aaee9=_0x37d027;if(_0x37d027){if(_0x37d027[_0xecab('0x57')]||_0x37d027[_0xecab('0x58')]){return db[_0x37d027[_0xecab('0x57')]?_0xecab('0x59'):'Campaign'][_0xecab('0x52')]({'where':{'id':_0x37d027[_0xecab('0x57')]?_0x37d027[_0xecab('0x57')]:_0x37d027['CampaignId']},'attributes':['id',_0xecab('0x26')],'raw':!![]});}}})[_0xecab('0x24')](function(_0x3a9b7f){var _0x331552={};if(_0x3a9b7f){_[_0xecab('0x49')](_0x331552,_[_0xecab('0x5a')](_0x3aaee9[_0xecab('0x5b')],[_0xecab('0x5c'),_0xecab('0x5d'),'id']));_0x331552[_0xecab('0x5e')]=0x15;_0x331552[_0xecab('0x5f')]=_0xecab('0x60');_0x331552['campaign']=_0x3a9b7f[_0xecab('0x26')];_0x331552[_0xecab('0x61')]=_0x3dce74[_0xecab('0x62')]['name'];_0x331552[_0xecab('0x63')]=_0x3dce74['user']['id'];_0x331552[_0xecab('0x60')]=!![];_0x331552[_0xecab('0x64')]=moment()[_0xecab('0x65')](_0xecab('0x66'));_0x331552[_0xecab('0x67')]=_0x3aaee9[_0xecab('0x68')];_0x331552[_0xecab('0x69')]=_0x3aaee9[_0xecab('0x57')]?_0xecab('0x6a'):_0xecab('0x6b');return db[_0xecab('0x6c')][_0xecab('0x52')]({'where':{'id':_0x331552[_0xecab('0x6d')]},'attributes':[_0xecab('0x6e'),_0xecab('0x6f')]})[_0xecab('0x24')](function(_0x2ed907){if(!_[_0xecab('0x70')](_0x2799a0)&&!_[_0xecab('0x70')](_0x2ed907['firstName'])){_0x331552['calleridname']=_0x2ed907[_0xecab('0x6e')];if(!_[_0xecab('0x70')](_0x2ed907[_0xecab('0x6f')])){_0x331552[_0xecab('0x71')]+='\x20'+_0x2ed907['lastName'];}}})['finally'](function(){return db[_0xecab('0x72')][_0xecab('0x54')](_0x331552);});}})[_0xecab('0x24')](function(){return _0x2799a0['status'](0xcc)['end']();})[_0xecab('0x53')](handleError(_0x2799a0,null));};exports[_0xecab('0x73')]=function(_0x43ff98,_0x486c31,_0x168450){var _0x76923c=[];return db[_0xecab('0x6c')][_0xecab('0x56')]()[_0xecab('0x24')](function(_0x584379){_0x76923c=_[_0xecab('0x50')](_0x584379);return _0x43ff98[_0xecab('0x62')][_0xecab('0x74')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xecab('0x75')],'raw':!![]});})['then'](function(_0x33cabe){if(_0x33cabe&&_0x33cabe[_0xecab('0x40')]){return db['sequelize'][_0xecab('0x76')](function(_0x220ebf){var _0x47c115={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xecab('0x65')](_0xecab('0x66'))},'VoiceQueueId':{'$in':_[_0xecab('0x28')](_0x33cabe,'id')},'$or':[{'UserId':null},{'UserId':_0x43ff98[_0xecab('0x62')]['id']}]};var _0x48e791=[];if(_0x43ff98[_0xecab('0x55')][_0xecab('0x77')]&&_0x43ff98[_0xecab('0x55')]['direction']===_0xecab('0x78')){if(!_[_0xecab('0x79')](_0x43ff98[_0xecab('0x55')][_0xecab('0x7a')])){_0x47c115['id']={'$in':_0x43ff98[_0xecab('0x55')][_0xecab('0x7a')]};}_0x48e791=[[_0xecab('0x7b'),_0xecab('0x7c')],[_0xecab('0x7d'),_0x33cabe[0x0][_0xecab('0x75')]===_0xecab('0x7c')?_0xecab('0x7e'):_0xecab('0x7c')],db[_0xecab('0x7f')][_0xecab('0x80')](_0xecab('0x81')),['id',_0xecab('0x7e')]];}else{if(!_[_0xecab('0x79')](_0x43ff98[_0xecab('0x55')][_0xecab('0x7a')])){_0x47c115['id']={'$notIn':_0x43ff98[_0xecab('0x55')][_0xecab('0x7a')]};}_0x48e791=[['priority',_0xecab('0x7e')],[_0xecab('0x7d'),_0x33cabe[0x0][_0xecab('0x75')]],db['sequelize'][_0xecab('0x80')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xecab('0x7c')]];}return db['CmHopper'][_0xecab('0x82')]({'attributes':['id',_0xecab('0x83')],'where':_0x47c115,'order':_0x48e791,'transaction':_0x220ebf,'lock':_0x220ebf[_0xecab('0x84')][_0xecab('0x85')],'include':[{'model':db[_0xecab('0x6c')],'as':_0xecab('0x86'),'attributes':_0x76923c,'include':[{'model':db[_0xecab('0x87')],'as':_0xecab('0x88'),'attributes':['id',_0xecab('0x26')]}]},{'model':db[_0xecab('0x89')],'as':_0xecab('0x8a'),'attributes':['id',_0xecab('0x26')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xecab('0x26'),_0xecab('0x8b')]}]})[_0xecab('0x24')](function(_0xd95f26){if(_0xd95f26){return _0xd95f26[_0xecab('0x22')]({'UserId':_0x43ff98[_0xecab('0x62')]['id']},{'transaction':_0x220ebf});}});});}})[_0xecab('0x24')](handleEntityNotFound(_0x486c31,null))[_0xecab('0x24')](respondWithResult(_0x486c31,null))['catch'](handleError(_0x486c31,null));};exports[_0xecab('0x8c')]=function(_0x1b8e6f,_0x29d0c5,_0x207edd){return _0x1b8e6f[_0xecab('0x62')][_0xecab('0x74')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xecab('0x8d')},'attributes':['id'],'raw':!![]})['then'](function(_0x3cd938){if(_0x3cd938&&_0x3cd938[_0xecab('0x40')]){return db[_0xecab('0x29')][_0xecab('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xecab('0x65')](_0xecab('0x66'))},'VoiceQueueId':{'$in':_['map'](_0x3cd938,'id')},'$or':[{'UserId':null},{'UserId':_0x1b8e6f['user']['id']}]}});}return 0x0;})[_0xecab('0x24')](function(_0x22eddd){if(!_[_0xecab('0x70')](_0x22eddd)&&_[_0xecab('0x8e')](_0x22eddd)){return _0x29d0c5[_0xecab('0x19')](0xc8)[_0xecab('0x1b')]({'contacts':_0x22eddd});}else{logger[_0xecab('0x25')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xecab('0x8c'),0x194,_0xecab('0x8f'));_0x29d0c5[_0xecab('0x18')](0x194);}})[_0xecab('0x53')](handleError(_0x29d0c5,null));}; \ No newline at end of file +var _0xa788=['sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','query','keys','filters','intersection','model','concat','$and','$or','$gte','$lte','$ne','$eq','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','direction','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','CmCompany','Company','CmList','List','VoiceQueue','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','save','then'];(function(_0x4715d0,_0x3369ef){var _0x4c2687=function(_0x305a63){while(--_0x305a63){_0x4715d0['push'](_0x4715d0['shift']());}};_0x4c2687(++_0x3369ef);}(_0xa788,0x70));var _0x8a78=function(_0x22a8d9,_0x3dc837){_0x22a8d9=_0x22a8d9-0x0;var _0x1a8a22=_0xa788[_0x22a8d9];return _0x1a8a22;};'use strict';var pdf=require(_0x8a78('0x0'));var emlformat=require(_0x8a78('0x1'));var rimraf=require(_0x8a78('0x2'));var zipdir=require(_0x8a78('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a78('0x4'));var moment=require(_0x8a78('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8a78('0x6'));var util=require(_0x8a78('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8a78('0x8'));var fs=require('fs');var _=require(_0x8a78('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8a78('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8a78('0xb'));var Papa=require(_0x8a78('0xc'));var Redis=require('ioredis');var authService=require(_0x8a78('0xd'));var qs=require(_0x8a78('0xe'));var as=require(_0x8a78('0xf'));var hardwareService=require(_0x8a78('0x10'));var logger=require(_0x8a78('0x11'))(_0x8a78('0x12'));var utils=require(_0x8a78('0x13'));var config=require(_0x8a78('0x14'));var licenseUtil=require(_0x8a78('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x299461,_0x294b34){_0x294b34=_0x294b34||0xcc;return function(_0x31b77e){if(_0x31b77e){return _0x299461['sendStatus'](_0x294b34);}return _0x299461[_0x8a78('0x16')](_0x294b34)[_0x8a78('0x17')]();};}function respondWithResult(_0x18c057,_0x4b073b){_0x4b073b=_0x4b073b||0xc8;return function(_0x423787){if(_0x423787){return _0x18c057['status'](_0x4b073b)[_0x8a78('0x18')](_0x423787);}};}function respondWithFilteredResult(_0x53001e,_0x429b2c){return function(_0x586d47){if(_0x586d47){var _0x57212b=_0x586d47[_0x8a78('0x19')],_0x580cf9=_0x429b2c[_0x8a78('0x1a')],_0x118d34=_0x429b2c[_0x8a78('0x1a')]+_0x429b2c[_0x8a78('0x1b')],_0x27822b;if(_0x118d34>=_0x57212b){_0x118d34=_0x57212b;_0x27822b=0xc8;}else{_0x27822b=0xce;}_0x53001e[_0x8a78('0x16')](_0x27822b);return _0x53001e[_0x8a78('0x1c')](_0x8a78('0x1d'),_0x580cf9+'-'+_0x118d34+'/'+_0x57212b)[_0x8a78('0x18')](_0x586d47);}return null;};}function patchUpdates(_0xf8b886){return function(_0x3de1ac){try{jsonpatch[_0x8a78('0x1e')](_0x3de1ac,_0xf8b886,!![]);}catch(_0x31e946){return BPromise['reject'](_0x31e946);}return _0x3de1ac[_0x8a78('0x1f')]();};}function saveUpdates(_0x557e98,_0xa6f4b8){return function(_0x1dd032){if(_0x1dd032){return _0x1dd032['update'](_0x557e98)[_0x8a78('0x20')](function(_0x28e5da){return _0x28e5da;});}return null;};}function removeEntity(_0x2ceb56,_0x43b3b8){return function(_0x2d7d03){if(_0x2d7d03){return _0x2d7d03['destroy']()[_0x8a78('0x20')](function(){_0x2ceb56['status'](0xcc)[_0x8a78('0x17')]();});}};}function handleEntityNotFound(_0x43305f,_0x118357){return function(_0x381795){if(!_0x381795){_0x43305f[_0x8a78('0x21')](0x194);}return _0x381795;};}function handleError(_0x326add,_0x4a89a1){_0x4a89a1=_0x4a89a1||0x1f4;return function(_0x5c2115){logger[_0x8a78('0x22')](_0x5c2115[_0x8a78('0x23')]);if(_0x5c2115[_0x8a78('0x24')]){delete _0x5c2115['name'];}_0x326add[_0x8a78('0x16')](_0x4a89a1)[_0x8a78('0x25')](_0x5c2115);};}exports[_0x8a78('0x26')]=function(_0x494d78,_0x33b157){var _0x38b27d={},_0x14be2b={},_0x503b4e={'count':0x0,'rows':[]};var _0x4872fd=_[_0x8a78('0x27')](db[_0x8a78('0x28')][_0x8a78('0x29')],function(_0x19c208){return{'name':_0x19c208['fieldName'],'type':_0x19c208[_0x8a78('0x2a')][_0x8a78('0x2b')]};});_0x14be2b['model']=_[_0x8a78('0x27')](_0x4872fd,_0x8a78('0x24'));_0x14be2b[_0x8a78('0x2c')]=_[_0x8a78('0x2d')](_0x494d78[_0x8a78('0x2c')]);_0x14be2b[_0x8a78('0x2e')]=_[_0x8a78('0x2f')](_0x14be2b[_0x8a78('0x30')],_0x14be2b[_0x8a78('0x2c')]);_0x14be2b[_0x8a78('0x2e')]=_[_0x8a78('0x31')](_0x14be2b['filters'],[_0x8a78('0x32'),_0x8a78('0x33'),'$gt',_0x8a78('0x34'),'$lt',_0x8a78('0x35'),_0x8a78('0x36'),_0x8a78('0x37'),'$not','$between',_0x8a78('0x38'),'$in',_0x8a78('0x39'),_0x8a78('0x3a'),_0x8a78('0x3b'),_0x8a78('0x3c'),_0x8a78('0x3d'),'$like',_0x8a78('0x3e'),_0x8a78('0x3f'),_0x8a78('0x40'),_0x8a78('0x41')]);_0x38b27d[_0x8a78('0x42')]=_['intersection'](_0x14be2b[_0x8a78('0x30')],qs[_0x8a78('0x43')](_0x494d78[_0x8a78('0x2c')]['fields']));_0x38b27d[_0x8a78('0x42')]=_0x38b27d[_0x8a78('0x42')][_0x8a78('0x44')]?_0x38b27d['attributes']:_0x14be2b['model'];if(!_0x494d78['query']['hasOwnProperty'](_0x8a78('0x45'))){_0x38b27d[_0x8a78('0x1b')]=qs[_0x8a78('0x1b')](_0x494d78[_0x8a78('0x2c')][_0x8a78('0x1b')]);_0x38b27d[_0x8a78('0x1a')]=qs[_0x8a78('0x1a')](_0x494d78['query'][_0x8a78('0x1a')]);}_0x38b27d[_0x8a78('0x46')]=qs['sort'](_0x494d78[_0x8a78('0x2c')][_0x8a78('0x47')]);_0x38b27d[_0x8a78('0x48')]=qs[_0x8a78('0x2e')](_[_0x8a78('0x49')](_0x494d78[_0x8a78('0x2c')],_0x14be2b[_0x8a78('0x2e')]),_0x4872fd);if(_0x494d78[_0x8a78('0x2c')][_0x8a78('0x4a')]){_0x38b27d[_0x8a78('0x48')]=_[_0x8a78('0x4b')](_0x38b27d[_0x8a78('0x48')],{'$or':_[_0x8a78('0x27')](_0x4872fd,function(_0xda9a6d){if(_0xda9a6d[_0x8a78('0x2a')]!==_0x8a78('0x4c')){var _0x217fb1={};_0x217fb1[_0xda9a6d[_0x8a78('0x24')]]={'$like':'%'+_0x494d78[_0x8a78('0x2c')][_0x8a78('0x4a')]+'%'};return _0x217fb1;}})});}_0x38b27d=_[_0x8a78('0x4b')]({},_0x38b27d,_0x494d78['options']);var _0x5b894c={'where':_0x38b27d[_0x8a78('0x48')]};return db[_0x8a78('0x28')][_0x8a78('0x19')](_0x5b894c)[_0x8a78('0x20')](function(_0x3f5993){_0x503b4e[_0x8a78('0x19')]=_0x3f5993;if(_0x494d78['query'][_0x8a78('0x4d')]){_0x38b27d[_0x8a78('0x4e')]=[{'all':!![]}];}return db[_0x8a78('0x28')][_0x8a78('0x4f')](_0x38b27d);})[_0x8a78('0x20')](function(_0x25f7bc){_0x503b4e[_0x8a78('0x50')]=_0x25f7bc;return _0x503b4e;})[_0x8a78('0x20')](respondWithFilteredResult(_0x33b157,_0x38b27d))[_0x8a78('0x51')](handleError(_0x33b157,null));};exports[_0x8a78('0x52')]=function(_0x40d922,_0x11d4e3){var _0xfa5882={'raw':!![],'where':{'id':_0x40d922[_0x8a78('0x53')]['id']}},_0x2f4974={};_0x2f4974[_0x8a78('0x30')]=_[_0x8a78('0x2d')](db[_0x8a78('0x28')][_0x8a78('0x29')]);_0x2f4974[_0x8a78('0x2c')]=_['keys'](_0x40d922[_0x8a78('0x2c')]);_0x2f4974[_0x8a78('0x2e')]=_[_0x8a78('0x2f')](_0x2f4974['model'],_0x2f4974[_0x8a78('0x2c')]);_0xfa5882[_0x8a78('0x42')]=_[_0x8a78('0x2f')](_0x2f4974[_0x8a78('0x30')],qs[_0x8a78('0x43')](_0x40d922[_0x8a78('0x2c')][_0x8a78('0x43')]));_0xfa5882['attributes']=_0xfa5882[_0x8a78('0x42')]['length']?_0xfa5882[_0x8a78('0x42')]:_0x2f4974['model'];if(_0x40d922['query']['includeAll']){_0xfa5882[_0x8a78('0x4e')]=[{'all':!![]}];}_0xfa5882=_[_0x8a78('0x4b')]({},_0xfa5882,_0x40d922[_0x8a78('0x54')]);return db[_0x8a78('0x28')][_0x8a78('0x55')](_0xfa5882)[_0x8a78('0x20')](handleEntityNotFound(_0x11d4e3,null))['then'](respondWithResult(_0x11d4e3,null))['catch'](handleError(_0x11d4e3,null));};exports[_0x8a78('0x56')]=function(_0x497a36,_0x5c9369){return db[_0x8a78('0x28')][_0x8a78('0x56')](_0x497a36[_0x8a78('0x57')],{})[_0x8a78('0x20')](respondWithResult(_0x5c9369,0xc9))[_0x8a78('0x51')](handleError(_0x5c9369,null));};exports[_0x8a78('0x58')]=function(_0x4890ad,_0x3c445c){if(_0x4890ad[_0x8a78('0x57')]['id']){delete _0x4890ad[_0x8a78('0x57')]['id'];}return db[_0x8a78('0x28')][_0x8a78('0x55')]({'where':{'id':_0x4890ad[_0x8a78('0x53')]['id']}})[_0x8a78('0x20')](handleEntityNotFound(_0x3c445c,null))[_0x8a78('0x20')](saveUpdates(_0x4890ad[_0x8a78('0x57')],null))['then'](respondWithResult(_0x3c445c,null))[_0x8a78('0x51')](handleError(_0x3c445c,null));};exports[_0x8a78('0x59')]=function(_0x137f86,_0x5b45ec){return db['CmHopper'][_0x8a78('0x59')]()['then'](respondWithResult(_0x5b45ec,null))[_0x8a78('0x51')](handleError(_0x5b45ec,null));};exports[_0x8a78('0x5a')]=function(_0x55abf7,_0x111029){var _0x188f6b;return db['CmHopper'][_0x8a78('0x55')]({'where':{'id':_0x55abf7[_0x8a78('0x53')]['id']}})[_0x8a78('0x20')](handleEntityNotFound(_0x111029,null))[_0x8a78('0x20')](function(_0x177a42){if(_0x177a42){return _0x177a42[_0x8a78('0x5a')]()[_0x8a78('0x20')](function(_0x254349){return _0x254349;});}})[_0x8a78('0x20')](function(_0x2e3aff){_0x188f6b=_0x2e3aff;if(_0x2e3aff){if(_0x2e3aff[_0x8a78('0x5b')]||_0x2e3aff[_0x8a78('0x5c')]){return db[_0x2e3aff[_0x8a78('0x5b')]?'VoiceQueue':_0x8a78('0x5d')][_0x8a78('0x55')]({'where':{'id':_0x2e3aff[_0x8a78('0x5b')]?_0x2e3aff[_0x8a78('0x5b')]:_0x2e3aff[_0x8a78('0x5c')]},'attributes':['id',_0x8a78('0x24')],'raw':!![]});}}})[_0x8a78('0x20')](function(_0x30f749){var _0x444c34={};if(_0x30f749){_[_0x8a78('0x4b')](_0x444c34,_[_0x8a78('0x5e')](_0x188f6b[_0x8a78('0x5f')],[_0x8a78('0x60'),_0x8a78('0x61'),'id']));_0x444c34[_0x8a78('0x62')]=0x15;_0x444c34[_0x8a78('0x63')]='deleted';_0x444c34[_0x8a78('0x64')]=_0x30f749[_0x8a78('0x24')];_0x444c34['membername']=_0x55abf7[_0x8a78('0x65')][_0x8a78('0x24')];_0x444c34[_0x8a78('0x66')]=_0x55abf7['user']['id'];_0x444c34[_0x8a78('0x67')]=!![];_0x444c34[_0x8a78('0x68')]=moment()[_0x8a78('0x69')](_0x8a78('0x6a'));_0x444c34['calleridnum']=_0x188f6b[_0x8a78('0x6b')];_0x444c34[_0x8a78('0x6c')]=_0x188f6b[_0x8a78('0x5b')]?_0x8a78('0x6d'):_0x8a78('0x6e');return db[_0x8a78('0x6f')][_0x8a78('0x55')]({'where':{'id':_0x444c34[_0x8a78('0x70')]},'attributes':['firstName',_0x8a78('0x71')]})[_0x8a78('0x20')](function(_0x524785){if(!_['isNil'](_0x111029)&&!_[_0x8a78('0x72')](_0x524785[_0x8a78('0x73')])){_0x444c34[_0x8a78('0x74')]=_0x524785[_0x8a78('0x73')];if(!_[_0x8a78('0x72')](_0x524785[_0x8a78('0x71')])){_0x444c34[_0x8a78('0x74')]+='\x20'+_0x524785[_0x8a78('0x71')];}}})[_0x8a78('0x75')](function(){return db['CmHopperFinal']['create'](_0x444c34);});}})['then'](function(){return _0x111029[_0x8a78('0x16')](0xcc)[_0x8a78('0x17')]();})['catch'](handleError(_0x111029,null));};exports[_0x8a78('0x76')]=function(_0x1488ce,_0xdca73,_0x204c3e){var _0x4f0d22=[];return db[_0x8a78('0x6f')]['describe']()[_0x8a78('0x20')](function(_0x3e8c6f){_0x4f0d22=_[_0x8a78('0x2d')](_0x3e8c6f);return _0x1488ce['user'][_0x8a78('0x77')]({'where':{'type':_0x8a78('0x78'),'dialActive':!![],'dialMethod':_0x8a78('0x79')},'attributes':['id',_0x8a78('0x7a')],'raw':!![]});})[_0x8a78('0x20')](function(_0x2e3627){if(_0x2e3627&&_0x2e3627[_0x8a78('0x44')]){return db[_0x8a78('0x7b')]['transaction'](function(_0x334f9c){var _0x126ef2={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x8a78('0x6a'))},'VoiceQueueId':{'$in':_[_0x8a78('0x27')](_0x2e3627,'id')},'$or':[{'UserId':null},{'UserId':_0x1488ce[_0x8a78('0x65')]['id']}]};var _0x4850ac=[];if(_0x1488ce[_0x8a78('0x57')]['direction']&&_0x1488ce[_0x8a78('0x57')][_0x8a78('0x7c')]==='prev'){if(!_['isEmpty'](_0x1488ce['body'][_0x8a78('0x7d')])){_0x126ef2['id']={'$in':_0x1488ce['body']['hopperIds']};}_0x4850ac=[['priority',_0x8a78('0x7e')],[_0x8a78('0x7f'),_0x2e3627[0x0][_0x8a78('0x7a')]===_0x8a78('0x7e')?_0x8a78('0x80'):_0x8a78('0x7e')],db[_0x8a78('0x7b')][_0x8a78('0x81')](_0x8a78('0x82')),['id',_0x8a78('0x80')]];}else{if(!_['isEmpty'](_0x1488ce[_0x8a78('0x57')][_0x8a78('0x7d')])){_0x126ef2['id']={'$notIn':_0x1488ce[_0x8a78('0x57')][_0x8a78('0x7d')]};}_0x4850ac=[[_0x8a78('0x83'),_0x8a78('0x80')],[_0x8a78('0x7f'),_0x2e3627[0x0][_0x8a78('0x7a')]],db[_0x8a78('0x7b')][_0x8a78('0x81')](_0x8a78('0x84')),['id',_0x8a78('0x7e')]];}return db[_0x8a78('0x28')][_0x8a78('0x85')]({'attributes':['id',_0x8a78('0x86')],'where':_0x126ef2,'order':_0x4850ac,'transaction':_0x334f9c,'lock':_0x334f9c['LOCK']['UPDATE'],'include':[{'model':db[_0x8a78('0x6f')],'as':'Contact','attributes':_0x4f0d22,'include':[{'model':db[_0x8a78('0x87')],'as':_0x8a78('0x88'),'attributes':['id',_0x8a78('0x24')]}]},{'model':db[_0x8a78('0x89')],'as':_0x8a78('0x8a'),'attributes':['id',_0x8a78('0x24')]},{'model':db[_0x8a78('0x8b')],'as':_0x8a78('0x8c'),'attributes':['id',_0x8a78('0x24'),'dialActive']}]})[_0x8a78('0x20')](function(_0x40fe95){if(_0x40fe95){return _0x40fe95[_0x8a78('0x58')]({'UserId':_0x1488ce[_0x8a78('0x65')]['id']},{'transaction':_0x334f9c});}});});}})['then'](handleEntityNotFound(_0xdca73,null))[_0x8a78('0x20')](respondWithResult(_0xdca73,null))[_0x8a78('0x51')](handleError(_0xdca73,null));};exports[_0x8a78('0x8d')]=function(_0xa711a9,_0x94899e,_0x1f85fb){return _0xa711a9[_0x8a78('0x65')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x8a78('0x20')](function(_0x5f5496){if(_0x5f5496&&_0x5f5496[_0x8a78('0x44')]){return db[_0x8a78('0x28')][_0x8a78('0x19')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x8a78('0x6a'))},'VoiceQueueId':{'$in':_['map'](_0x5f5496,'id')},'$or':[{'UserId':null},{'UserId':_0xa711a9[_0x8a78('0x65')]['id']}]}});}return 0x0;})['then'](function(_0x2f07ba){if(!_[_0x8a78('0x72')](_0x2f07ba)&&_[_0x8a78('0x8e')](_0x2f07ba)){return _0x94899e[_0x8a78('0x16')](0xc8)[_0x8a78('0x18')]({'contacts':_0x2f07ba});}else{logger['error'](_0x8a78('0x8f'),_0x8a78('0x8d'),0x194,_0x8a78('0x90'));_0x94899e[_0x8a78('0x21')](0x194);}})['catch'](handleError(_0x94899e,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 37072e6..8091d2e 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 _0xea1d=['path','rimraf','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','request-promise'];(function(_0x9702da,_0x2cab30){var _0xd91ef9=function(_0x2cad67){while(--_0x2cad67){_0x9702da['push'](_0x9702da['shift']());}};_0xd91ef9(++_0x2cab30);}(_0xea1d,0x159));var _0xdea1=function(_0x1289f4,_0x584c5c){_0x1289f4=_0x1289f4-0x0;var _0xf0087f=_0xea1d[_0x1289f4];return _0xf0087f;};'use strict';var _=require(_0xdea1('0x0'));var util=require('util');var logger=require(_0xdea1('0x1'))(_0xdea1('0x2'));var moment=require(_0xdea1('0x3'));var BPromise=require('bluebird');var rp=require(_0xdea1('0x4'));var fs=require('fs');var path=require(_0xdea1('0x5'));var rimraf=require(_0xdea1('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0xdea1('0x7')]=function(_0x135ebc,_0xc7ba66){return _0x135ebc[_0xdea1('0x8')](_0xdea1('0x9'),attributes,{'tableName':_0xdea1('0xa'),'paranoid':![],'indexes':[{'name':_0xdea1('0xb'),'fields':[_0xdea1('0xb')]},{'name':_0xdea1('0xc'),'fields':[_0xdea1('0xc')]},{'name':_0xdea1('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d99=['exports','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x4443e7,_0x3504b0){var _0xaeead2=function(_0x192e14){while(--_0x192e14){_0x4443e7['push'](_0x4443e7['shift']());}};_0xaeead2(++_0x3504b0);}(_0x5d99,0x1f4));var _0x95d9=function(_0x868b7c,_0xfa438b){_0x868b7c=_0x868b7c-0x0;var _0x21683c=_0x5d99[_0x868b7c];return _0x21683c;};'use strict';var _=require(_0x95d9('0x0'));var util=require(_0x95d9('0x1'));var logger=require(_0x95d9('0x2'))(_0x95d9('0x3'));var moment=require(_0x95d9('0x4'));var BPromise=require('bluebird');var rp=require(_0x95d9('0x5'));var fs=require('fs');var path=require(_0x95d9('0x6'));var rimraf=require(_0x95d9('0x7'));var config=require(_0x95d9('0x8'));var attributes=require(_0x95d9('0x9'));module[_0x95d9('0xa')]=function(_0x3c489b,_0x5eb321){return _0x3c489b['define'](_0x95d9('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x95d9('0xc'),'fields':[_0x95d9('0xc')]},{'name':_0x95d9('0xd'),'fields':[_0x95d9('0xd')]},{'name':_0x95d9('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 64be852..d23511e 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 _0xd572=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','CmHopper,\x20%s,\x20%s','message','catch','options','raw','where','attributes','limit','include','map','model','GetCmHopper','ShowCmHopper','CreateCmHopper','CmHopper','create','body','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','findAll','order','UPDATE','keys','User','Agent','voicePause','length','includes','UserId','push','all','MoveContactManagedDialer','transaction','CmHopperFinal','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','describe','LOCK','GetCmHopperPreview','Contact','lodash','util','moment'];(function(_0x393ead,_0x4934fa){var _0x35e4ec=function(_0xaaccb6){while(--_0xaaccb6){_0x393ead['push'](_0x393ead['shift']());}};_0x35e4ec(++_0x4934fa);}(_0xd572,0x115));var _0x2d57=function(_0x2be6ec,_0x1d5318){_0x2be6ec=_0x2be6ec-0x0;var _0x4a8e86=_0xd572[_0x2be6ec];return _0x4a8e86;};'use strict';var _=require(_0x2d57('0x0'));var util=require(_0x2d57('0x1'));var moment=require(_0x2d57('0x2'));var BPromise=require(_0x2d57('0x3'));var rs=require(_0x2d57('0x4'));var fs=require('fs');var Redis=require(_0x2d57('0x5'));var db=require(_0x2d57('0x6'))['db'];var utils=require(_0x2d57('0x7'));var logger=require(_0x2d57('0x8'))(_0x2d57('0x9'));var config=require(_0x2d57('0xa'));var jayson=require(_0x2d57('0xb'));var client=jayson['client'][_0x2d57('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d330f,_0x4b0515,_0x271538){return new BPromise(function(_0x13a2c8,_0x1b89bd){return client['request'](_0x2d330f,_0x271538)[_0x2d57('0xd')](function(_0x24140f){logger[_0x2d57('0xe')]('CmHopper,\x20%s,\x20%s',_0x4b0515,_0x2d57('0xf'));logger[_0x2d57('0x10')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x4b0515,_0x2d57('0xf'),JSON[_0x2d57('0x11')](_0x24140f));if(_0x24140f[_0x2d57('0x12')]){if(_0x24140f[_0x2d57('0x12')]['code']===0x1f4){logger['error'](_0x2d57('0x13'),_0x4b0515,_0x24140f[_0x2d57('0x12')][_0x2d57('0x14')]);return _0x1b89bd(_0x24140f[_0x2d57('0x12')][_0x2d57('0x14')]);}logger[_0x2d57('0x12')]('CmHopper,\x20%s,\x20%s',_0x4b0515,_0x24140f[_0x2d57('0x12')][_0x2d57('0x14')]);return _0x13a2c8(_0x24140f['error'][_0x2d57('0x14')]);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x4b0515,_0x2d57('0xf'));_0x13a2c8(_0x24140f['result']['message']);}})[_0x2d57('0x15')](function(_0x406dd6){logger[_0x2d57('0x12')](_0x2d57('0x13'),_0x4b0515,_0x406dd6);_0x1b89bd(_0x406dd6);});});}exports['GetCmHopper']=function(_0x140545){var _0x4d7f5d=this;return new Promise(function(_0x5c22f6,_0x25486e){return db['CmHopper']['findAll']({'raw':_0x140545[_0x2d57('0x16')]?_0x140545[_0x2d57('0x16')][_0x2d57('0x17')]===undefined?!![]:![]:!![],'where':_0x140545[_0x2d57('0x16')]?_0x140545[_0x2d57('0x16')][_0x2d57('0x18')]||null:null,'attributes':_0x140545[_0x2d57('0x16')]?_0x140545[_0x2d57('0x16')][_0x2d57('0x19')]||null:null,'limit':_0x140545[_0x2d57('0x16')]?_0x140545['options'][_0x2d57('0x1a')]||null:null,'include':_0x140545[_0x2d57('0x16')]?_0x140545['options'][_0x2d57('0x1b')]?_[_0x2d57('0x1c')](_0x140545['options'][_0x2d57('0x1b')],function(_0x4884d3){return{'model':db[_0x4884d3[_0x2d57('0x1d')]],'as':_0x4884d3['as'],'attributes':_0x4884d3[_0x2d57('0x19')],'include':_0x4884d3[_0x2d57('0x1b')]?_[_0x2d57('0x1c')](_0x4884d3[_0x2d57('0x1b')],function(_0x359dca){return{'model':db[_0x359dca[_0x2d57('0x1d')]],'as':_0x359dca['as'],'attributes':_0x359dca[_0x2d57('0x19')],'include':_0x359dca[_0x2d57('0x1b')]?_[_0x2d57('0x1c')](_0x359dca['include'],function(_0x193b1f){return{'model':db[_0x193b1f[_0x2d57('0x1d')]],'as':_0x193b1f['as'],'attributes':_0x193b1f[_0x2d57('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2d57('0xd')](function(_0x5885ae){logger[_0x2d57('0xe')](_0x2d57('0x1e'),_0x140545);logger[_0x2d57('0x10')](_0x2d57('0x1e'),_0x140545,JSON[_0x2d57('0x11')](_0x5885ae));_0x5c22f6(_0x5885ae);})[_0x2d57('0x15')](function(_0x245510){logger[_0x2d57('0x12')]('GetCmHopper',_0x245510[_0x2d57('0x14')],_0x140545);_0x25486e(_0x4d7f5d[_0x2d57('0x12')](0x1f4,_0x245510[_0x2d57('0x14')]));});});};exports['ShowCmHopper']=function(_0x176496){var _0xbbad30=this;return new Promise(function(_0x468b6f,_0x4683e8){return db['CmHopper']['find']({'raw':_0x176496[_0x2d57('0x16')]?_0x176496[_0x2d57('0x16')][_0x2d57('0x17')]===undefined?!![]:![]:!![],'where':_0x176496[_0x2d57('0x16')]?_0x176496[_0x2d57('0x16')]['where']||null:null,'attributes':_0x176496[_0x2d57('0x16')]?_0x176496['options']['attributes']||null:null,'include':_0x176496[_0x2d57('0x16')]?_0x176496['options']['include']?_[_0x2d57('0x1c')](_0x176496[_0x2d57('0x16')][_0x2d57('0x1b')],function(_0xffe285){return{'model':db[_0xffe285['model']],'as':_0xffe285['as'],'attributes':_0xffe285[_0x2d57('0x19')],'include':_0xffe285['include']?_['map'](_0xffe285[_0x2d57('0x1b')],function(_0x2568c8){return{'model':db[_0x2568c8[_0x2d57('0x1d')]],'as':_0x2568c8['as'],'attributes':_0x2568c8['attributes'],'include':_0x2568c8[_0x2d57('0x1b')]?_[_0x2d57('0x1c')](_0x2568c8[_0x2d57('0x1b')],function(_0x23f78b){return{'model':db[_0x23f78b[_0x2d57('0x1d')]],'as':_0x23f78b['as'],'attributes':_0x23f78b[_0x2d57('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x333925){logger['info']('ShowCmHopper',_0x176496);logger['debug'](_0x2d57('0x1f'),_0x176496,JSON[_0x2d57('0x11')](_0x333925));_0x468b6f(_0x333925);})[_0x2d57('0x15')](function(_0x4d16a7){logger[_0x2d57('0x12')](_0x2d57('0x1f'),_0x4d16a7['message'],_0x176496);_0x4683e8(_0xbbad30['error'](0x1f4,_0x4d16a7['message']));});});};exports[_0x2d57('0x20')]=function(_0x36da69){var _0x205234=this;return new Promise(function(_0xe10bb5,_0x3234ba){return db[_0x2d57('0x21')][_0x2d57('0x22')](_0x36da69[_0x2d57('0x23')],{'raw':_0x36da69[_0x2d57('0x16')]?_0x36da69[_0x2d57('0x16')][_0x2d57('0x17')]===undefined?!![]:![]:!![]})[_0x2d57('0xd')](function(_0xc4df0f){logger[_0x2d57('0xe')](_0x2d57('0x20'),_0x36da69);logger[_0x2d57('0x10')](_0x2d57('0x20'),_0x36da69,JSON[_0x2d57('0x11')](_0xc4df0f));_0xe10bb5(_0xc4df0f);})[_0x2d57('0x15')](function(_0x447adf){logger[_0x2d57('0x12')](_0x2d57('0x20'),_0x447adf[_0x2d57('0x14')],_0x36da69);_0x3234ba(_0x205234[_0x2d57('0x12')](0x1f4,_0x447adf[_0x2d57('0x14')]));});});};exports['UpdateCmHopper']=function(_0x4f7401){var _0x458fe0=this;return new Promise(function(_0x354bad,_0x4bd4fb){return db[_0x2d57('0x21')][_0x2d57('0x24')](_0x4f7401['body'],{'raw':_0x4f7401[_0x2d57('0x16')]?_0x4f7401['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f7401['options']?_0x4f7401[_0x2d57('0x16')][_0x2d57('0x18')]||null:null,'attributes':_0x4f7401['options']?_0x4f7401[_0x2d57('0x16')][_0x2d57('0x19')]||null:null,'limit':_0x4f7401[_0x2d57('0x16')]?_0x4f7401[_0x2d57('0x16')][_0x2d57('0x1a')]||null:null})[_0x2d57('0xd')](function(_0x46be99){logger[_0x2d57('0xe')](_0x2d57('0x25'),_0x4f7401);logger['debug'](_0x2d57('0x25'),_0x4f7401,JSON[_0x2d57('0x11')](_0x46be99));_0x354bad(_0x46be99);})[_0x2d57('0x15')](function(_0xab64ef){logger['error'](_0x2d57('0x25'),_0xab64ef['message'],_0x4f7401);_0x4bd4fb(_0x458fe0[_0x2d57('0x12')](0x1f4,_0xab64ef[_0x2d57('0x14')]));});});};exports[_0x2d57('0x26')]=function(_0x116d6a){var _0x2bff19=this;return new Promise(function(_0x4b7c7e,_0x4394b9){return db[_0x2d57('0x21')][_0x2d57('0x27')]({'where':_0x116d6a[_0x2d57('0x16')]?_0x116d6a[_0x2d57('0x16')][_0x2d57('0x18')]||null:null})['then'](function(_0x5bc0d9){logger[_0x2d57('0xe')](_0x2d57('0x26'),_0x116d6a);logger[_0x2d57('0x10')](_0x2d57('0x26'),_0x116d6a,JSON[_0x2d57('0x11')](_0x5bc0d9));_0x4b7c7e(_0x5bc0d9);})[_0x2d57('0x15')](function(_0x58267d){logger['error'](_0x2d57('0x26'),_0x58267d['message'],_0x116d6a);_0x4394b9(_0x2bff19[_0x2d57('0x12')](0x1f4,_0x58267d['message']));});});};exports[_0x2d57('0x28')]=function(_0x153e91){var _0x35acf1=this;return new Promise(function(_0x3e1029,_0x4c047c){return db[_0x2d57('0x29')]['describe']()[_0x2d57('0xd')](function(_0x57100e){return db[_0x2d57('0x2a')]['transaction'](function(_0x403a4){return db['CmHopper'][_0x2d57('0x2b')]({'where':_0x153e91['options']?_0x153e91[_0x2d57('0x16')][_0x2d57('0x18')]||null:null,'attributes':_0x153e91[_0x2d57('0x16')]?_0x153e91[_0x2d57('0x16')][_0x2d57('0x19')]||null:null,'limit':_0x153e91[_0x2d57('0x16')]?_0x153e91['options'][_0x2d57('0x1a')]||null:null,'order':_0x153e91[_0x2d57('0x16')]?_0x153e91[_0x2d57('0x16')][_0x2d57('0x2c')]||null:null,'transaction':_0x403a4,'lock':_0x403a4['LOCK'][_0x2d57('0x2d')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x2d57('0x2e')](_0x57100e)},{'model':db[_0x2d57('0x2f')],'as':_0x2d57('0x30'),'attributes':['id','name',_0x2d57('0x31')]}]})['then'](function(_0x4ef4ad){var _0x1b0188=[];var _0x234071=[];for(var _0x37fa35=0x0;_0x37fa35<_0x4ef4ad[_0x2d57('0x32')];_0x37fa35+=0x1){if(!_0x234071[_0x2d57('0x33')](_0x4ef4ad[_0x37fa35]['UserId'])){_0x234071['push'](_0x4ef4ad[_0x37fa35][_0x2d57('0x34')]);_0x1b0188[_0x2d57('0x35')](_0x4ef4ad[_0x37fa35]['update'](_0x153e91[_0x2d57('0x23')],{'transaction':_0x403a4}));}}return BPromise[_0x2d57('0x36')](_0x1b0188);});})['then'](function(_0x18b5a9){logger[_0x2d57('0xe')](_0x2d57('0x28'),_0x153e91);logger[_0x2d57('0x10')](_0x2d57('0x28'),_0x153e91,JSON[_0x2d57('0x11')](_0x18b5a9));_0x3e1029(_0x18b5a9);})[_0x2d57('0x15')](function(_0x22ee3c){logger[_0x2d57('0x12')](_0x2d57('0x28'),_0x22ee3c[_0x2d57('0x14')],_0x153e91);_0x4c047c(_0x35acf1[_0x2d57('0x12')](0x1f4,_0x22ee3c[_0x2d57('0x14')]));});});});};exports[_0x2d57('0x37')]=function(_0x2c2612){var _0x2694f4=this;return new Promise(function(_0x2b1c86,_0x5deef3){return db[_0x2d57('0x2a')][_0x2d57('0x38')](function(_0x2404f9){return db[_0x2d57('0x39')][_0x2d57('0x22')](_0x2c2612[_0x2d57('0x23')],{'raw':_0x2c2612[_0x2d57('0x16')]?_0x2c2612[_0x2d57('0x16')][_0x2d57('0x17')]===undefined?!![]:![]:!![],'transaction':_0x2404f9})[_0x2d57('0xd')](function(){return db[_0x2d57('0x21')][_0x2d57('0x27')]({'where':_0x2c2612[_0x2d57('0x16')]?_0x2c2612[_0x2d57('0x16')][_0x2d57('0x18')]||null:null,'transaction':_0x2404f9});});})[_0x2d57('0xd')](function(_0x352167){logger[_0x2d57('0xe')](_0x2d57('0x37'),_0x2c2612);logger[_0x2d57('0x10')](_0x2d57('0x37'),_0x2c2612,JSON[_0x2d57('0x11')](_0x352167));_0x2b1c86(_0x352167);})['catch'](function(_0x492638){logger['error'](_0x2d57('0x37'),_0x492638[_0x2d57('0x14')],_0x2c2612);_0x5deef3(_0x2694f4[_0x2d57('0x12')](0x1f4,_0x492638[_0x2d57('0x14')]));});});};exports['CountReScheduled']=function(_0x2af64f){var _0x509f3a=this;return new Promise(function(_0xfd210a,_0x3c9518){return db[_0x2d57('0x21')][_0x2d57('0x2b')]({'raw':_0x2af64f['options']?_0x2af64f[_0x2d57('0x16')][_0x2d57('0x17')]===undefined?!![]:![]:!![],'where':_0x2af64f[_0x2d57('0x16')]?_0x2af64f[_0x2d57('0x16')][_0x2d57('0x18')]||null:null,'attributes':[[db[_0x2d57('0x2a')]['fn'](_0x2d57('0x3a'),db['sequelize']['fn']('IF',db['sequelize'][_0x2d57('0x3b')]('`scheduledat`\x20>=\x20'+util[_0x2d57('0x3c')](_0x2d57('0x3d'),moment()[_0x2d57('0x3c')](_0x2d57('0x3e')))+_0x2d57('0x3f')))),'contactsRescheduled']]})[_0x2d57('0xd')](function(_0x56b4e5){logger[_0x2d57('0xe')]('CountReScheduled',_0x2af64f);logger[_0x2d57('0x10')](_0x2d57('0x40'),_0x2af64f,JSON[_0x2d57('0x11')](_0x56b4e5));_0xfd210a(_0x56b4e5);})[_0x2d57('0x15')](function(_0x48347b){logger['error']('CountReScheduled',_0x48347b[_0x2d57('0x14')],_0x2af64f);_0x3c9518(_0x509f3a[_0x2d57('0x12')](0x1f4,_0x48347b[_0x2d57('0x14')]));});});};exports[_0x2d57('0x41')]=function(_0x22c244){var _0x38abb4=this;return new Promise(function(_0x32c0d9,_0x27b1de){return db[_0x2d57('0x29')][_0x2d57('0x42')]()[_0x2d57('0xd')](function(_0x6b981e){return db[_0x2d57('0x2a')][_0x2d57('0x38')](function(_0xd10920){return db[_0x2d57('0x21')][_0x2d57('0x2b')]({'where':_0x22c244[_0x2d57('0x16')]?_0x22c244['options'][_0x2d57('0x18')]||null:null,'attributes':_0x22c244[_0x2d57('0x16')]?_0x22c244[_0x2d57('0x16')][_0x2d57('0x19')]||null:null,'limit':0x1,'order':_0x22c244['options']?_0x22c244[_0x2d57('0x16')][_0x2d57('0x2c')]||null:null,'group':db[_0x2d57('0x21')]['UserId'],'transaction':_0xd10920,'lock':_0xd10920[_0x2d57('0x43')][_0x2d57('0x2d')],'include':_0x22c244[_0x2d57('0x16')]?_0x22c244['options']['include']?_[_0x2d57('0x1c')](_0x22c244[_0x2d57('0x16')][_0x2d57('0x1b')],function(_0x402ad2){return{'model':db[_0x402ad2[_0x2d57('0x1d')]],'as':_0x402ad2['as'],'attributes':_0x402ad2['attributes'],'include':_0x402ad2[_0x2d57('0x1b')]?_[_0x2d57('0x1c')](_0x402ad2[_0x2d57('0x1b')],function(_0x1ae2e9){return{'model':db[_0x1ae2e9[_0x2d57('0x1d')]],'as':_0x1ae2e9['as'],'attributes':_0x1ae2e9['attributes'],'include':_0x1ae2e9[_0x2d57('0x1b')]?_['map'](_0x1ae2e9['include'],function(_0x575506){return{'model':db[_0x575506[_0x2d57('0x1d')]],'as':_0x575506['as'],'attributes':_0x575506['attributes']};}):[]};}):[]};}):[]:[]})[_0x2d57('0xd')](function(_0x1d5c5c){var _0x25b3c0=[];for(var _0x1c6a9b=0x0;_0x1c6a9b<_0x1d5c5c[_0x2d57('0x32')];_0x1c6a9b+=0x1){_0x25b3c0['push'](_0x1d5c5c[_0x1c6a9b][_0x2d57('0x24')](_0x22c244[_0x2d57('0x23')],{'transaction':_0xd10920}));}return BPromise[_0x2d57('0x36')](_0x25b3c0);});})[_0x2d57('0xd')](function(_0x100730){logger[_0x2d57('0xe')](_0x2d57('0x41'),_0x22c244);logger[_0x2d57('0x10')](_0x2d57('0x41'),_0x22c244,JSON[_0x2d57('0x11')](_0x100730));_0x32c0d9(_0x100730);})[_0x2d57('0x15')](function(_0x48f76e){logger[_0x2d57('0x12')](_0x2d57('0x41'),_0x48f76e[_0x2d57('0x14')],_0x22c244);_0x27b1de(_0x38abb4['error'](0x1f4,_0x48f76e[_0x2d57('0x14')]));});});});};exports[_0x2d57('0x44')]=function(_0xcdd224){var _0x39ac80=this;return new Promise(function(_0x1d14fc,_0x15af99){db['CmContact'][_0x2d57('0x42')]()['then'](function(_0x58459c){return db[_0x2d57('0x21')][_0x2d57('0x2b')]({'raw':_0xcdd224[_0x2d57('0x16')]?_0xcdd224[_0x2d57('0x16')][_0x2d57('0x17')]===undefined?!![]:![]:!![],'where':_0xcdd224[_0x2d57('0x16')]?_0xcdd224[_0x2d57('0x16')][_0x2d57('0x18')]||null:null,'attributes':_0xcdd224[_0x2d57('0x16')]?_0xcdd224[_0x2d57('0x16')]['attributes']||null:null,'limit':_0xcdd224['options']?_0xcdd224[_0x2d57('0x16')]['limit']||null:null,'include':_0xcdd224['options']?_0xcdd224[_0x2d57('0x16')]['include']?_[_0x2d57('0x1c')](_0xcdd224['options'][_0x2d57('0x1b')],function(_0x8276bc){return{'model':db[_0x8276bc['model']],'as':_0x8276bc['as'],'attributes':_0x8276bc['as']===_0x2d57('0x45')?_[_0x2d57('0x2e')](_0x58459c):_0x8276bc[_0x2d57('0x19')],'include':_0x8276bc[_0x2d57('0x1b')]?_[_0x2d57('0x1c')](_0x8276bc[_0x2d57('0x1b')],function(_0x8136a2){return{'model':db[_0x8136a2[_0x2d57('0x1d')]],'as':_0x8136a2['as'],'attributes':_0x8136a2[_0x2d57('0x19')],'include':_0x8136a2[_0x2d57('0x1b')]?_['map'](_0x8136a2['include'],function(_0x3f0b94){return{'model':db[_0x3f0b94['model']],'as':_0x3f0b94['as'],'attributes':_0x3f0b94[_0x2d57('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2d57('0xd')](function(_0x208fd4){logger[_0x2d57('0xe')](_0x2d57('0x1e'),_0xcdd224);logger[_0x2d57('0x10')](_0x2d57('0x1e'),_0xcdd224,JSON[_0x2d57('0x11')](_0x208fd4));_0x1d14fc(_0x208fd4);})[_0x2d57('0x15')](function(_0x513a32){logger['error'](_0x2d57('0x1e'),_0x513a32[_0x2d57('0x14')],_0xcdd224);_0x15af99(_0x39ac80[_0x2d57('0x12')](0x1f4,_0x513a32[_0x2d57('0x14')]));});});});}; \ No newline at end of file +var _0x5cbb=['error','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','map','include','model','ShowCmHopper','find','CreateCmHopper','body','limit','UpdateCmHopper','DestroyCmHopper','CmContact','describe','sequelize','order','LOCK','UPDATE','Contact','keys','Agent','voicePause','length','includes','UserId','push','update','all','GetContactDialer','CmHopperFinal','create','destroy','MoveContactManagedDialer','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','transaction','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x3bb884,_0x111976){var _0x414715=function(_0x1cb354){while(--_0x1cb354){_0x3bb884['push'](_0x3bb884['shift']());}};_0x414715(++_0x111976);}(_0x5cbb,0xc4));var _0xb5cb=function(_0x3f8e2f,_0x149266){_0x3f8e2f=_0x3f8e2f-0x0;var _0x44c46a=_0x5cbb[_0x3f8e2f];return _0x44c46a;};'use strict';var _=require(_0xb5cb('0x0'));var util=require(_0xb5cb('0x1'));var moment=require(_0xb5cb('0x2'));var BPromise=require(_0xb5cb('0x3'));var rs=require(_0xb5cb('0x4'));var fs=require('fs');var Redis=require(_0xb5cb('0x5'));var db=require(_0xb5cb('0x6'))['db'];var utils=require(_0xb5cb('0x7'));var logger=require('../../config/logger')(_0xb5cb('0x8'));var config=require(_0xb5cb('0x9'));var jayson=require(_0xb5cb('0xa'));var client=jayson[_0xb5cb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x418848,_0x43e327,_0x59a570){return new BPromise(function(_0x39924a,_0x38d711){return client['request'](_0x418848,_0x59a570)[_0xb5cb('0xc')](function(_0x5778e7){logger[_0xb5cb('0xd')](_0xb5cb('0xe'),_0x43e327,'request\x20sent');logger[_0xb5cb('0xf')](_0xb5cb('0x10'),_0x43e327,_0xb5cb('0x11'),JSON[_0xb5cb('0x12')](_0x5778e7));if(_0x5778e7['error']){if(_0x5778e7['error'][_0xb5cb('0x13')]===0x1f4){logger[_0xb5cb('0x14')](_0xb5cb('0xe'),_0x43e327,_0x5778e7['error'][_0xb5cb('0x15')]);return _0x38d711(_0x5778e7[_0xb5cb('0x14')][_0xb5cb('0x15')]);}logger[_0xb5cb('0x14')]('CmHopper,\x20%s,\x20%s',_0x43e327,_0x5778e7[_0xb5cb('0x14')][_0xb5cb('0x15')]);return _0x39924a(_0x5778e7[_0xb5cb('0x14')]['message']);}else{logger['info'](_0xb5cb('0xe'),_0x43e327,_0xb5cb('0x11'));_0x39924a(_0x5778e7[_0xb5cb('0x16')][_0xb5cb('0x15')]);}})[_0xb5cb('0x17')](function(_0x21ec58){logger[_0xb5cb('0x14')]('CmHopper,\x20%s,\x20%s',_0x43e327,_0x21ec58);_0x38d711(_0x21ec58);});});}exports[_0xb5cb('0x18')]=function(_0x56f056){var _0x5356ac=this;return new Promise(function(_0x506dd7,_0x17c7ac){return db[_0xb5cb('0x19')][_0xb5cb('0x1a')]({'raw':_0x56f056[_0xb5cb('0x1b')]?_0x56f056[_0xb5cb('0x1b')][_0xb5cb('0x1c')]===undefined?!![]:![]:!![],'where':_0x56f056[_0xb5cb('0x1b')]?_0x56f056['options'][_0xb5cb('0x1d')]||null:null,'attributes':_0x56f056[_0xb5cb('0x1b')]?_0x56f056[_0xb5cb('0x1b')][_0xb5cb('0x1e')]||null:null,'limit':_0x56f056[_0xb5cb('0x1b')]?_0x56f056['options']['limit']||null:null,'include':_0x56f056[_0xb5cb('0x1b')]?_0x56f056[_0xb5cb('0x1b')]['include']?_[_0xb5cb('0x1f')](_0x56f056['options'][_0xb5cb('0x20')],function(_0x41a92c){return{'model':db[_0x41a92c[_0xb5cb('0x21')]],'as':_0x41a92c['as'],'attributes':_0x41a92c['attributes'],'include':_0x41a92c[_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x41a92c[_0xb5cb('0x20')],function(_0x1b1c9c){return{'model':db[_0x1b1c9c[_0xb5cb('0x21')]],'as':_0x1b1c9c['as'],'attributes':_0x1b1c9c[_0xb5cb('0x1e')],'include':_0x1b1c9c[_0xb5cb('0x20')]?_['map'](_0x1b1c9c[_0xb5cb('0x20')],function(_0x467b06){return{'model':db[_0x467b06[_0xb5cb('0x21')]],'as':_0x467b06['as'],'attributes':_0x467b06[_0xb5cb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5cb('0xc')](function(_0x19700e){logger[_0xb5cb('0xd')](_0xb5cb('0x18'),_0x56f056);logger[_0xb5cb('0xf')](_0xb5cb('0x18'),_0x56f056,JSON[_0xb5cb('0x12')](_0x19700e));_0x506dd7(_0x19700e);})[_0xb5cb('0x17')](function(_0x484600){logger[_0xb5cb('0x14')](_0xb5cb('0x18'),_0x484600[_0xb5cb('0x15')],_0x56f056);_0x17c7ac(_0x5356ac[_0xb5cb('0x14')](0x1f4,_0x484600[_0xb5cb('0x15')]));});});};exports[_0xb5cb('0x22')]=function(_0xd19db5){var _0x49f206=this;return new Promise(function(_0x4b1834,_0x128885){return db['CmHopper'][_0xb5cb('0x23')]({'raw':_0xd19db5[_0xb5cb('0x1b')]?_0xd19db5[_0xb5cb('0x1b')][_0xb5cb('0x1c')]===undefined?!![]:![]:!![],'where':_0xd19db5[_0xb5cb('0x1b')]?_0xd19db5[_0xb5cb('0x1b')][_0xb5cb('0x1d')]||null:null,'attributes':_0xd19db5['options']?_0xd19db5[_0xb5cb('0x1b')][_0xb5cb('0x1e')]||null:null,'include':_0xd19db5[_0xb5cb('0x1b')]?_0xd19db5['options'][_0xb5cb('0x20')]?_['map'](_0xd19db5['options'][_0xb5cb('0x20')],function(_0x1950c3){return{'model':db[_0x1950c3[_0xb5cb('0x21')]],'as':_0x1950c3['as'],'attributes':_0x1950c3[_0xb5cb('0x1e')],'include':_0x1950c3[_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x1950c3[_0xb5cb('0x20')],function(_0xc416e0){return{'model':db[_0xc416e0[_0xb5cb('0x21')]],'as':_0xc416e0['as'],'attributes':_0xc416e0[_0xb5cb('0x1e')],'include':_0xc416e0[_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0xc416e0[_0xb5cb('0x20')],function(_0x18a3bc){return{'model':db[_0x18a3bc[_0xb5cb('0x21')]],'as':_0x18a3bc['as'],'attributes':_0x18a3bc[_0xb5cb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5cb('0xc')](function(_0x35c7ed){logger[_0xb5cb('0xd')]('ShowCmHopper',_0xd19db5);logger[_0xb5cb('0xf')](_0xb5cb('0x22'),_0xd19db5,JSON[_0xb5cb('0x12')](_0x35c7ed));_0x4b1834(_0x35c7ed);})[_0xb5cb('0x17')](function(_0x3700a2){logger[_0xb5cb('0x14')](_0xb5cb('0x22'),_0x3700a2[_0xb5cb('0x15')],_0xd19db5);_0x128885(_0x49f206[_0xb5cb('0x14')](0x1f4,_0x3700a2['message']));});});};exports[_0xb5cb('0x24')]=function(_0x37fcc4){var _0x1d2e6e=this;return new Promise(function(_0x19f408,_0x1a8cc8){return db[_0xb5cb('0x19')]['create'](_0x37fcc4['body'],{'raw':_0x37fcc4[_0xb5cb('0x1b')]?_0x37fcc4[_0xb5cb('0x1b')][_0xb5cb('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x560440){logger['info'](_0xb5cb('0x24'),_0x37fcc4);logger[_0xb5cb('0xf')](_0xb5cb('0x24'),_0x37fcc4,JSON[_0xb5cb('0x12')](_0x560440));_0x19f408(_0x560440);})['catch'](function(_0x28b1ff){logger[_0xb5cb('0x14')](_0xb5cb('0x24'),_0x28b1ff[_0xb5cb('0x15')],_0x37fcc4);_0x1a8cc8(_0x1d2e6e[_0xb5cb('0x14')](0x1f4,_0x28b1ff[_0xb5cb('0x15')]));});});};exports['UpdateCmHopper']=function(_0x503b0a){var _0x5b3bd6=this;return new Promise(function(_0x325b55,_0x26d5be){return db[_0xb5cb('0x19')]['update'](_0x503b0a[_0xb5cb('0x25')],{'raw':_0x503b0a[_0xb5cb('0x1b')]?_0x503b0a[_0xb5cb('0x1b')][_0xb5cb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x503b0a[_0xb5cb('0x1b')]?_0x503b0a['options'][_0xb5cb('0x1d')]||null:null,'attributes':_0x503b0a[_0xb5cb('0x1b')]?_0x503b0a['options'][_0xb5cb('0x1e')]||null:null,'limit':_0x503b0a[_0xb5cb('0x1b')]?_0x503b0a[_0xb5cb('0x1b')][_0xb5cb('0x26')]||null:null})[_0xb5cb('0xc')](function(_0x52c724){logger[_0xb5cb('0xd')](_0xb5cb('0x27'),_0x503b0a);logger[_0xb5cb('0xf')]('UpdateCmHopper',_0x503b0a,JSON[_0xb5cb('0x12')](_0x52c724));_0x325b55(_0x52c724);})[_0xb5cb('0x17')](function(_0x38c096){logger[_0xb5cb('0x14')](_0xb5cb('0x27'),_0x38c096[_0xb5cb('0x15')],_0x503b0a);_0x26d5be(_0x5b3bd6[_0xb5cb('0x14')](0x1f4,_0x38c096[_0xb5cb('0x15')]));});});};exports[_0xb5cb('0x28')]=function(_0x4292d5){var _0x37b222=this;return new Promise(function(_0x32bcdd,_0xb1f65d){return db[_0xb5cb('0x19')]['destroy']({'where':_0x4292d5[_0xb5cb('0x1b')]?_0x4292d5[_0xb5cb('0x1b')][_0xb5cb('0x1d')]||null:null})[_0xb5cb('0xc')](function(_0x88d4df){logger[_0xb5cb('0xd')]('DestroyCmHopper',_0x4292d5);logger[_0xb5cb('0xf')](_0xb5cb('0x28'),_0x4292d5,JSON[_0xb5cb('0x12')](_0x88d4df));_0x32bcdd(_0x88d4df);})[_0xb5cb('0x17')](function(_0x44c9cf){logger['error']('DestroyCmHopper',_0x44c9cf[_0xb5cb('0x15')],_0x4292d5);_0xb1f65d(_0x37b222[_0xb5cb('0x14')](0x1f4,_0x44c9cf[_0xb5cb('0x15')]));});});};exports['GetContactDialer']=function(_0x14eb11){var _0x2d8339=this;return new Promise(function(_0x351d13,_0x118163){return db[_0xb5cb('0x29')][_0xb5cb('0x2a')]()[_0xb5cb('0xc')](function(_0x32b706){return db[_0xb5cb('0x2b')]['transaction'](function(_0x1a01ec){return db['CmHopper'][_0xb5cb('0x1a')]({'where':_0x14eb11['options']?_0x14eb11[_0xb5cb('0x1b')]['where']||null:null,'attributes':_0x14eb11[_0xb5cb('0x1b')]?_0x14eb11['options'][_0xb5cb('0x1e')]||null:null,'limit':_0x14eb11[_0xb5cb('0x1b')]?_0x14eb11['options'][_0xb5cb('0x26')]||null:null,'order':_0x14eb11['options']?_0x14eb11['options'][_0xb5cb('0x2c')]||null:null,'transaction':_0x1a01ec,'lock':_0x1a01ec[_0xb5cb('0x2d')][_0xb5cb('0x2e')],'include':[{'model':db[_0xb5cb('0x29')],'as':_0xb5cb('0x2f'),'attributes':_[_0xb5cb('0x30')](_0x32b706)},{'model':db['User'],'as':_0xb5cb('0x31'),'attributes':['id','name',_0xb5cb('0x32')]}]})[_0xb5cb('0xc')](function(_0x2629f0){var _0xce7b30=[];var _0x1dbe21=[];for(var _0x1f9acf=0x0;_0x1f9acf<_0x2629f0[_0xb5cb('0x33')];_0x1f9acf+=0x1){if(!_0x1dbe21[_0xb5cb('0x34')](_0x2629f0[_0x1f9acf][_0xb5cb('0x35')])){_0x1dbe21[_0xb5cb('0x36')](_0x2629f0[_0x1f9acf][_0xb5cb('0x35')]);_0xce7b30['push'](_0x2629f0[_0x1f9acf][_0xb5cb('0x37')](_0x14eb11[_0xb5cb('0x25')],{'transaction':_0x1a01ec}));}}return BPromise[_0xb5cb('0x38')](_0xce7b30);});})[_0xb5cb('0xc')](function(_0x1e7b95){logger[_0xb5cb('0xd')]('GetContactDialer',_0x14eb11);logger['debug'](_0xb5cb('0x39'),_0x14eb11,JSON[_0xb5cb('0x12')](_0x1e7b95));_0x351d13(_0x1e7b95);})['catch'](function(_0x498773){logger[_0xb5cb('0x14')](_0xb5cb('0x39'),_0x498773[_0xb5cb('0x15')],_0x14eb11);_0x118163(_0x2d8339['error'](0x1f4,_0x498773[_0xb5cb('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x4f85ef){var _0x6a823e=this;return new Promise(function(_0x15062c,_0x2bf415){return db[_0xb5cb('0x2b')]['transaction'](function(_0x1f02d7){return db[_0xb5cb('0x3a')][_0xb5cb('0x3b')](_0x4f85ef[_0xb5cb('0x25')],{'raw':_0x4f85ef[_0xb5cb('0x1b')]?_0x4f85ef[_0xb5cb('0x1b')]['raw']===undefined?!![]:![]:!![],'transaction':_0x1f02d7})[_0xb5cb('0xc')](function(){return db[_0xb5cb('0x19')][_0xb5cb('0x3c')]({'where':_0x4f85ef[_0xb5cb('0x1b')]?_0x4f85ef['options'][_0xb5cb('0x1d')]||null:null,'transaction':_0x1f02d7});});})['then'](function(_0x152759){logger[_0xb5cb('0xd')]('MoveContactManagedDialer',_0x4f85ef);logger['debug']('MoveContactManagedDialer',_0x4f85ef,JSON[_0xb5cb('0x12')](_0x152759));_0x15062c(_0x152759);})[_0xb5cb('0x17')](function(_0x150348){logger[_0xb5cb('0x14')](_0xb5cb('0x3d'),_0x150348['message'],_0x4f85ef);_0x2bf415(_0x6a823e[_0xb5cb('0x14')](0x1f4,_0x150348[_0xb5cb('0x15')]));});});};exports[_0xb5cb('0x3e')]=function(_0x2e632d){var _0x23c4f1=this;return new Promise(function(_0x38f79d,_0x57f252){return db['CmHopper'][_0xb5cb('0x1a')]({'raw':_0x2e632d['options']?_0x2e632d[_0xb5cb('0x1b')][_0xb5cb('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e632d[_0xb5cb('0x1b')]?_0x2e632d[_0xb5cb('0x1b')][_0xb5cb('0x1d')]||null:null,'attributes':[[db[_0xb5cb('0x2b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb5cb('0x2b')][_0xb5cb('0x3f')](_0xb5cb('0x40')+util[_0xb5cb('0x41')](_0xb5cb('0x42'),moment()[_0xb5cb('0x41')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xb5cb('0x43')))),_0xb5cb('0x44')]]})[_0xb5cb('0xc')](function(_0x29cd88){logger[_0xb5cb('0xd')](_0xb5cb('0x3e'),_0x2e632d);logger[_0xb5cb('0xf')](_0xb5cb('0x3e'),_0x2e632d,JSON[_0xb5cb('0x12')](_0x29cd88));_0x38f79d(_0x29cd88);})[_0xb5cb('0x17')](function(_0x206728){logger[_0xb5cb('0x14')](_0xb5cb('0x3e'),_0x206728[_0xb5cb('0x15')],_0x2e632d);_0x57f252(_0x23c4f1['error'](0x1f4,_0x206728['message']));});});};exports[_0xb5cb('0x45')]=function(_0x156cd6){var _0x3d44a7=this;return new Promise(function(_0x2e440a,_0x776213){return db[_0xb5cb('0x29')][_0xb5cb('0x2a')]()[_0xb5cb('0xc')](function(_0x3003b2){return db[_0xb5cb('0x2b')][_0xb5cb('0x46')](function(_0x3a2299){return db['CmHopper'][_0xb5cb('0x1a')]({'where':_0x156cd6[_0xb5cb('0x1b')]?_0x156cd6['options'][_0xb5cb('0x1d')]||null:null,'attributes':_0x156cd6[_0xb5cb('0x1b')]?_0x156cd6['options'][_0xb5cb('0x1e')]||null:null,'limit':0x1,'order':_0x156cd6[_0xb5cb('0x1b')]?_0x156cd6[_0xb5cb('0x1b')]['order']||null:null,'group':db['CmHopper'][_0xb5cb('0x35')],'transaction':_0x3a2299,'lock':_0x3a2299['LOCK'][_0xb5cb('0x2e')],'include':_0x156cd6[_0xb5cb('0x1b')]?_0x156cd6[_0xb5cb('0x1b')][_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x156cd6[_0xb5cb('0x1b')][_0xb5cb('0x20')],function(_0x3a2872){return{'model':db[_0x3a2872['model']],'as':_0x3a2872['as'],'attributes':_0x3a2872[_0xb5cb('0x1e')],'include':_0x3a2872[_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x3a2872[_0xb5cb('0x20')],function(_0x459183){return{'model':db[_0x459183[_0xb5cb('0x21')]],'as':_0x459183['as'],'attributes':_0x459183[_0xb5cb('0x1e')],'include':_0x459183['include']?_[_0xb5cb('0x1f')](_0x459183[_0xb5cb('0x20')],function(_0x36f002){return{'model':db[_0x36f002['model']],'as':_0x36f002['as'],'attributes':_0x36f002[_0xb5cb('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29e6e3){var _0x1db312=[];for(var _0x38696c=0x0;_0x38696c<_0x29e6e3[_0xb5cb('0x33')];_0x38696c+=0x1){_0x1db312[_0xb5cb('0x36')](_0x29e6e3[_0x38696c][_0xb5cb('0x37')](_0x156cd6[_0xb5cb('0x25')],{'transaction':_0x3a2299}));}return BPromise[_0xb5cb('0x38')](_0x1db312);});})[_0xb5cb('0xc')](function(_0x23d106){logger[_0xb5cb('0xd')](_0xb5cb('0x45'),_0x156cd6);logger['debug'](_0xb5cb('0x45'),_0x156cd6,JSON[_0xb5cb('0x12')](_0x23d106));_0x2e440a(_0x23d106);})[_0xb5cb('0x17')](function(_0x55c7f2){logger['error']('GetContactRecallMe',_0x55c7f2[_0xb5cb('0x15')],_0x156cd6);_0x776213(_0x3d44a7[_0xb5cb('0x14')](0x1f4,_0x55c7f2['message']));});});});};exports[_0xb5cb('0x47')]=function(_0x41364e){var _0xe9c0e7=this;return new Promise(function(_0x1eb834,_0x124428){db[_0xb5cb('0x29')][_0xb5cb('0x2a')]()[_0xb5cb('0xc')](function(_0x50cdf8){return db[_0xb5cb('0x19')][_0xb5cb('0x1a')]({'raw':_0x41364e[_0xb5cb('0x1b')]?_0x41364e[_0xb5cb('0x1b')][_0xb5cb('0x1c')]===undefined?!![]:![]:!![],'where':_0x41364e['options']?_0x41364e[_0xb5cb('0x1b')][_0xb5cb('0x1d')]||null:null,'attributes':_0x41364e[_0xb5cb('0x1b')]?_0x41364e['options'][_0xb5cb('0x1e')]||null:null,'limit':_0x41364e[_0xb5cb('0x1b')]?_0x41364e[_0xb5cb('0x1b')]['limit']||null:null,'include':_0x41364e[_0xb5cb('0x1b')]?_0x41364e[_0xb5cb('0x1b')][_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x41364e[_0xb5cb('0x1b')][_0xb5cb('0x20')],function(_0x166541){return{'model':db[_0x166541['model']],'as':_0x166541['as'],'attributes':_0x166541['as']===_0xb5cb('0x2f')?_[_0xb5cb('0x30')](_0x50cdf8):_0x166541[_0xb5cb('0x1e')],'include':_0x166541[_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x166541['include'],function(_0x5d83c6){return{'model':db[_0x5d83c6[_0xb5cb('0x21')]],'as':_0x5d83c6['as'],'attributes':_0x5d83c6['attributes'],'include':_0x5d83c6[_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x5d83c6[_0xb5cb('0x20')],function(_0x331dc6){return{'model':db[_0x331dc6[_0xb5cb('0x21')]],'as':_0x331dc6['as'],'attributes':_0x331dc6[_0xb5cb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5cb('0xc')](function(_0x3fb051){logger[_0xb5cb('0xd')]('GetCmHopper',_0x41364e);logger[_0xb5cb('0xf')](_0xb5cb('0x18'),_0x41364e,JSON['stringify'](_0x3fb051));_0x1eb834(_0x3fb051);})[_0xb5cb('0x17')](function(_0x58880a){logger['error'](_0xb5cb('0x18'),_0x58880a[_0xb5cb('0x15')],_0x41364e);_0x124428(_0xe9c0e7[_0xb5cb('0x14')](0x1f4,_0x58880a[_0xb5cb('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index a48618d..529b216 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 _0x3266=['create','/preview','getPreview','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/opencontacts','isAuthenticated','getOpenContacts','/:id','show','post'];(function(_0x3f6bb2,_0x47cd92){var _0x4057e1=function(_0x202c8f){while(--_0x202c8f){_0x3f6bb2['push'](_0x3f6bb2['shift']());}};_0x4057e1(++_0x47cd92);}(_0x3266,0x6a));var _0x6326=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x3266[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var auth=require(_0x6326('0x6'));var interaction=require(_0x6326('0x7'));var config=require(_0x6326('0x8'));var controller=require('./cmHopper.controller');router[_0x6326('0x9')]('/',auth['isAuthenticated'](),controller[_0x6326('0xa')]);router[_0x6326('0x9')](_0x6326('0xb'),auth['isAuthenticated'](),controller[_0x6326('0xc')]);router['get'](_0x6326('0xd'),auth[_0x6326('0xe')](),controller[_0x6326('0xf')]);router[_0x6326('0x9')](_0x6326('0x10'),auth['isAuthenticated'](),controller[_0x6326('0x11')]);router[_0x6326('0x12')]('/',auth[_0x6326('0xe')](),controller[_0x6326('0x13')]);router[_0x6326('0x12')](_0x6326('0x14'),auth[_0x6326('0xe')](),controller[_0x6326('0x15')]);router[_0x6326('0x16')](_0x6326('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x6326('0x17')](_0x6326('0x10'),auth['isAuthenticated'](),controller[_0x6326('0x18')]);module['exports']=router; \ No newline at end of file +var _0x79a3=['multer','path','connect-timeout','Router','./cmHopper.controller','get','isAuthenticated','index','/opencontacts','getOpenContacts','/:id','/preview','getPreview','put','delete','destroy'];(function(_0x38b27e,_0x845bfc){var _0x4d9258=function(_0x21daed){while(--_0x21daed){_0x38b27e['push'](_0x38b27e['shift']());}};_0x4d9258(++_0x845bfc);}(_0x79a3,0x80));var _0x379a=function(_0x2c1583,_0x206c27){_0x2c1583=_0x2c1583-0x0;var _0x2f5beb=_0x79a3[_0x2c1583];return _0x2f5beb;};'use strict';var multer=require(_0x379a('0x0'));var util=require('util');var path=require(_0x379a('0x1'));var timeout=require(_0x379a('0x2'));var express=require('express');var router=express[_0x379a('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x379a('0x4'));router[_0x379a('0x5')]('/',auth[_0x379a('0x6')](),controller[_0x379a('0x7')]);router[_0x379a('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x379a('0x5')](_0x379a('0x8'),auth[_0x379a('0x6')](),controller[_0x379a('0x9')]);router[_0x379a('0x5')](_0x379a('0xa'),auth[_0x379a('0x6')](),controller['show']);router['post']('/',auth[_0x379a('0x6')](),controller['create']);router['post'](_0x379a('0xb'),auth[_0x379a('0x6')](),controller[_0x379a('0xc')]);router[_0x379a('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x379a('0xe')](_0x379a('0xa'),auth[_0x379a('0x6')](),controller[_0x379a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index daab462..f51f990 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 _0x3172=['exports','STRING','INTEGER','contactListQueue','sequelize'];(function(_0x7cb905,_0x5c2772){var _0x411552=function(_0xa6c946){while(--_0xa6c946){_0x7cb905['push'](_0x7cb905['shift']());}};_0x411552(++_0x5c2772);}(_0x3172,0xa4));var _0x2317=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x3172[_0x5b6cf1];return _0x46278c;};'use strict';var moment=require('moment');var Sequelize=require(_0x2317('0x0'));module[_0x2317('0x1')]={'phone':{'type':Sequelize[_0x2317('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2317('0x3')],'unique':_0x2317('0x4')},'ListId':{'type':Sequelize[_0x2317('0x3')],'unique':_0x2317('0x4')},'VoiceQueueId':{'type':Sequelize[_0x2317('0x3')],'unique':_0x2317('0x4')}}; \ No newline at end of file +var _0x47e9=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x39e3b7,_0x14e80d){var _0xf02968=function(_0x55e353){while(--_0x55e353){_0x39e3b7['push'](_0x39e3b7['shift']());}};_0xf02968(++_0x14e80d);}(_0x47e9,0x12d));var _0x947e=function(_0x20abd1,_0x185022){_0x20abd1=_0x20abd1-0x0;var _0x43e325=_0x47e9[_0x20abd1];return _0x43e325;};'use strict';var moment=require(_0x947e('0x0'));var Sequelize=require(_0x947e('0x1'));module[_0x947e('0x2')]={'phone':{'type':Sequelize[_0x947e('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x947e('0x4')],'unique':_0x947e('0x5')},'ListId':{'type':Sequelize[_0x947e('0x4')],'unique':_0x947e('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x947e('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 8e8ca59..1849e19 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 _0xd4b8=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','apply','reject','update','then','end','stack','name','CmHopperBlack','type','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','find','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x2537b6,_0x409324){var _0x328972=function(_0x2bf5ce){while(--_0x2bf5ce){_0x2537b6['push'](_0x2537b6['shift']());}};_0x328972(++_0x409324);}(_0xd4b8,0x1a8));var _0x8d4b=function(_0x1cec9f,_0x2ad95b){_0x1cec9f=_0x1cec9f-0x0;var _0x41286d=_0xd4b8[_0x1cec9f];return _0x41286d;};'use strict';var pdf=require(_0x8d4b('0x0'));var emlformat=require(_0x8d4b('0x1'));var rimraf=require(_0x8d4b('0x2'));var zipdir=require(_0x8d4b('0x3'));var jsonpatch=require(_0x8d4b('0x4'));var rp=require(_0x8d4b('0x5'));var moment=require(_0x8d4b('0x6'));var BPromise=require(_0x8d4b('0x7'));var Mustache=require(_0x8d4b('0x8'));var util=require('util');var path=require(_0x8d4b('0x9'));var sox=require(_0x8d4b('0xa'));var csv=require(_0x8d4b('0xb'));var ejs=require(_0x8d4b('0xc'));var fs=require('fs');var _=require(_0x8d4b('0xd'));var squel=require(_0x8d4b('0xe'));var crypto=require(_0x8d4b('0xf'));var jsforce=require(_0x8d4b('0x10'));var deskjs=require(_0x8d4b('0x11'));var toCsv=require('to-csv');var querystring=require(_0x8d4b('0x12'));var Papa=require('papaparse');var Redis=require(_0x8d4b('0x13'));var authService=require(_0x8d4b('0x14'));var qs=require(_0x8d4b('0x15'));var as=require(_0x8d4b('0x16'));var hardwareService=require(_0x8d4b('0x17'));var logger=require(_0x8d4b('0x18'))(_0x8d4b('0x19'));var utils=require(_0x8d4b('0x1a'));var config=require(_0x8d4b('0x1b'));var licenseUtil=require(_0x8d4b('0x1c'));var db=require(_0x8d4b('0x1d'))['db'];function respondWithStatusCode(_0x5bcae3,_0x498afb){_0x498afb=_0x498afb||0xcc;return function(_0x11e281){if(_0x11e281){return _0x5bcae3[_0x8d4b('0x1e')](_0x498afb);}return _0x5bcae3[_0x8d4b('0x1f')](_0x498afb)['end']();};}function respondWithResult(_0x4da28f,_0x4fe145){_0x4fe145=_0x4fe145||0xc8;return function(_0x43e8b2){if(_0x43e8b2){return _0x4da28f['status'](_0x4fe145)['json'](_0x43e8b2);}};}function respondWithFilteredResult(_0x4e11e9,_0x47647d){return function(_0x58df8a){if(_0x58df8a){var _0x494079=_0x58df8a[_0x8d4b('0x20')],_0x351edc=_0x47647d[_0x8d4b('0x21')],_0x22c172=_0x47647d[_0x8d4b('0x21')]+_0x47647d[_0x8d4b('0x22')],_0x24b932;if(_0x22c172>=_0x494079){_0x22c172=_0x494079;_0x24b932=0xc8;}else{_0x24b932=0xce;}_0x4e11e9[_0x8d4b('0x1f')](_0x24b932);return _0x4e11e9['set']('Content-Range',_0x351edc+'-'+_0x22c172+'/'+_0x494079)['json'](_0x58df8a);}return null;};}function patchUpdates(_0x27738b){return function(_0x2825e3){try{jsonpatch[_0x8d4b('0x23')](_0x2825e3,_0x27738b,!![]);}catch(_0x2b726e){return BPromise[_0x8d4b('0x24')](_0x2b726e);}return _0x2825e3['save']();};}function saveUpdates(_0x2aedac,_0x190a81){return function(_0x430dd4){if(_0x430dd4){return _0x430dd4[_0x8d4b('0x25')](_0x2aedac)[_0x8d4b('0x26')](function(_0x5c4137){return _0x5c4137;});}return null;};}function removeEntity(_0x2c8a70,_0x1b3a3c){return function(_0x2d970b){if(_0x2d970b){return _0x2d970b['destroy']()['then'](function(){_0x2c8a70[_0x8d4b('0x1f')](0xcc)[_0x8d4b('0x27')]();});}};}function handleEntityNotFound(_0x472cbe,_0x137cff){return function(_0x3efc3b){if(!_0x3efc3b){_0x472cbe['sendStatus'](0x194);}return _0x3efc3b;};}function handleError(_0x49a0f8,_0x44ebf2){_0x44ebf2=_0x44ebf2||0x1f4;return function(_0x57f509){logger['error'](_0x57f509[_0x8d4b('0x28')]);if(_0x57f509[_0x8d4b('0x29')]){delete _0x57f509[_0x8d4b('0x29')];}_0x49a0f8[_0x8d4b('0x1f')](_0x44ebf2)['send'](_0x57f509);};}exports['index']=function(_0x272eae,_0x6e597e){var _0x1eccd1={},_0x4a96fa={},_0x599593={'count':0x0,'rows':[]};var _0x33da18=_['map'](db[_0x8d4b('0x2a')]['rawAttributes'],function(_0x4408ea){return{'name':_0x4408ea['fieldName'],'type':_0x4408ea[_0x8d4b('0x2b')]['key']};});_0x4a96fa[_0x8d4b('0x2c')]=_[_0x8d4b('0x2d')](_0x33da18,_0x8d4b('0x29'));_0x4a96fa[_0x8d4b('0x2e')]=_[_0x8d4b('0x2f')](_0x272eae[_0x8d4b('0x2e')]);_0x4a96fa['filters']=_['intersection'](_0x4a96fa[_0x8d4b('0x2c')],_0x4a96fa[_0x8d4b('0x2e')]);_0x1eccd1[_0x8d4b('0x30')]=_[_0x8d4b('0x31')](_0x4a96fa['model'],qs['fields'](_0x272eae[_0x8d4b('0x2e')][_0x8d4b('0x32')]));_0x1eccd1['attributes']=_0x1eccd1['attributes'][_0x8d4b('0x33')]?_0x1eccd1[_0x8d4b('0x30')]:_0x4a96fa['model'];if(!_0x272eae[_0x8d4b('0x2e')][_0x8d4b('0x34')](_0x8d4b('0x35'))){_0x1eccd1[_0x8d4b('0x22')]=qs['limit'](_0x272eae['query']['limit']);_0x1eccd1['offset']=qs[_0x8d4b('0x21')](_0x272eae[_0x8d4b('0x2e')]['offset']);}_0x1eccd1[_0x8d4b('0x36')]=qs['sort'](_0x272eae['query'][_0x8d4b('0x37')]);_0x1eccd1[_0x8d4b('0x38')]=qs[_0x8d4b('0x39')](_[_0x8d4b('0x3a')](_0x272eae[_0x8d4b('0x2e')],_0x4a96fa['filters']),_0x33da18);if(_0x272eae[_0x8d4b('0x2e')][_0x8d4b('0x3b')]){_0x1eccd1[_0x8d4b('0x38')]=_['merge'](_0x1eccd1['where'],{'$or':_['map'](_0x33da18,function(_0x1d87f1){if(_0x1d87f1[_0x8d4b('0x2b')]!==_0x8d4b('0x3c')){var _0x55b3a0={};_0x55b3a0[_0x1d87f1['name']]={'$like':'%'+_0x272eae[_0x8d4b('0x2e')][_0x8d4b('0x3b')]+'%'};return _0x55b3a0;}})});}_0x1eccd1=_[_0x8d4b('0x3d')]({},_0x1eccd1,_0x272eae[_0x8d4b('0x3e')]);var _0x5aff75={'where':_0x1eccd1['where']};return db[_0x8d4b('0x2a')][_0x8d4b('0x20')](_0x5aff75)[_0x8d4b('0x26')](function(_0x2cc920){_0x599593['count']=_0x2cc920;if(_0x272eae[_0x8d4b('0x2e')][_0x8d4b('0x3f')]){_0x1eccd1[_0x8d4b('0x40')]=[{'all':!![]}];}return db[_0x8d4b('0x2a')][_0x8d4b('0x41')](_0x1eccd1);})[_0x8d4b('0x26')](function(_0xaa725e){_0x599593[_0x8d4b('0x42')]=_0xaa725e;return _0x599593;})[_0x8d4b('0x26')](respondWithFilteredResult(_0x6e597e,_0x1eccd1))[_0x8d4b('0x43')](handleError(_0x6e597e,null));};exports['show']=function(_0x288845,_0x437bec){var _0x365df2={'raw':!![],'where':{'id':_0x288845['params']['id']}},_0x5a774d={};_0x5a774d[_0x8d4b('0x2c')]=_[_0x8d4b('0x2f')](db[_0x8d4b('0x2a')]['rawAttributes']);_0x5a774d[_0x8d4b('0x2e')]=_[_0x8d4b('0x2f')](_0x288845[_0x8d4b('0x2e')]);_0x5a774d[_0x8d4b('0x39')]=_[_0x8d4b('0x31')](_0x5a774d['model'],_0x5a774d[_0x8d4b('0x2e')]);_0x365df2[_0x8d4b('0x30')]=_[_0x8d4b('0x31')](_0x5a774d['model'],qs['fields'](_0x288845[_0x8d4b('0x2e')]['fields']));_0x365df2[_0x8d4b('0x30')]=_0x365df2['attributes'][_0x8d4b('0x33')]?_0x365df2['attributes']:_0x5a774d[_0x8d4b('0x2c')];if(_0x288845[_0x8d4b('0x2e')][_0x8d4b('0x3f')]){_0x365df2[_0x8d4b('0x40')]=[{'all':!![]}];}_0x365df2=_[_0x8d4b('0x3d')]({},_0x365df2,_0x288845['options']);return db[_0x8d4b('0x2a')][_0x8d4b('0x44')](_0x365df2)[_0x8d4b('0x26')](handleEntityNotFound(_0x437bec,null))[_0x8d4b('0x26')](respondWithResult(_0x437bec,null))[_0x8d4b('0x43')](handleError(_0x437bec,null));};exports['update']=function(_0x47afee,_0x332110){if(_0x47afee['body']['id']){delete _0x47afee[_0x8d4b('0x45')]['id'];}return db[_0x8d4b('0x2a')][_0x8d4b('0x44')]({'where':{'id':_0x47afee[_0x8d4b('0x46')]['id']}})[_0x8d4b('0x26')](handleEntityNotFound(_0x332110,null))['then'](saveUpdates(_0x47afee[_0x8d4b('0x45')],null))[_0x8d4b('0x26')](respondWithResult(_0x332110,null))['catch'](handleError(_0x332110,null));};exports[_0x8d4b('0x47')]=function(_0x3efd77,_0x117c42){return db[_0x8d4b('0x2a')][_0x8d4b('0x44')]({'where':{'id':_0x3efd77[_0x8d4b('0x46')]['id']}})[_0x8d4b('0x26')](handleEntityNotFound(_0x117c42,null))[_0x8d4b('0x26')](removeEntity(_0x117c42,null))['catch'](handleError(_0x117c42,null));};exports[_0x8d4b('0x48')]=function(_0x125048,_0x1010f4){return db[_0x8d4b('0x2a')]['describe']()[_0x8d4b('0x26')](respondWithResult(_0x1010f4,null))[_0x8d4b('0x43')](handleError(_0x1010f4,null));}; \ No newline at end of file +var _0xe341=['sort','where','filter','merge','CmHopperBlack','includeAll','include','findAll','catch','params','options','find','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','status','Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe341,0x1ca));var _0x1e34=function(_0xe0420f,_0x17a314){_0xe0420f=_0xe0420f-0x0;var _0x3907d5=_0xe341[_0xe0420f];return _0x3907d5;};'use strict';var pdf=require(_0x1e34('0x0'));var emlformat=require(_0x1e34('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e34('0x2'));var jsonpatch=require(_0x1e34('0x3'));var rp=require(_0x1e34('0x4'));var moment=require(_0x1e34('0x5'));var BPromise=require(_0x1e34('0x6'));var Mustache=require('mustache');var util=require(_0x1e34('0x7'));var path=require(_0x1e34('0x8'));var sox=require('sox');var csv=require(_0x1e34('0x9'));var ejs=require(_0x1e34('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1e34('0xb'));var crypto=require(_0x1e34('0xc'));var jsforce=require(_0x1e34('0xd'));var deskjs=require(_0x1e34('0xe'));var toCsv=require(_0x1e34('0x9'));var querystring=require(_0x1e34('0xf'));var Papa=require(_0x1e34('0x10'));var Redis=require(_0x1e34('0x11'));var authService=require(_0x1e34('0x12'));var qs=require(_0x1e34('0x13'));var as=require(_0x1e34('0x14'));var hardwareService=require(_0x1e34('0x15'));var logger=require(_0x1e34('0x16'))(_0x1e34('0x17'));var utils=require('../../config/utils');var config=require(_0x1e34('0x18'));var licenseUtil=require(_0x1e34('0x19'));var db=require(_0x1e34('0x1a'))['db'];function respondWithStatusCode(_0x38cead,_0x27ff97){_0x27ff97=_0x27ff97||0xcc;return function(_0x249a81){if(_0x249a81){return _0x38cead[_0x1e34('0x1b')](_0x27ff97);}return _0x38cead['status'](_0x27ff97)[_0x1e34('0x1c')]();};}function respondWithResult(_0x1ffd31,_0x126ec9){_0x126ec9=_0x126ec9||0xc8;return function(_0x16b5a0){if(_0x16b5a0){return _0x1ffd31['status'](_0x126ec9)['json'](_0x16b5a0);}};}function respondWithFilteredResult(_0x30c9c2,_0x1fc7a5){return function(_0x97bb89){if(_0x97bb89){var _0x13ff58=_0x97bb89[_0x1e34('0x1d')],_0x2b9490=_0x1fc7a5[_0x1e34('0x1e')],_0x3a5efa=_0x1fc7a5['offset']+_0x1fc7a5[_0x1e34('0x1f')],_0x49a5ba;if(_0x3a5efa>=_0x13ff58){_0x3a5efa=_0x13ff58;_0x49a5ba=0xc8;}else{_0x49a5ba=0xce;}_0x30c9c2[_0x1e34('0x20')](_0x49a5ba);return _0x30c9c2['set'](_0x1e34('0x21'),_0x2b9490+'-'+_0x3a5efa+'/'+_0x13ff58)[_0x1e34('0x22')](_0x97bb89);}return null;};}function patchUpdates(_0x4f3e10){return function(_0x45d7de){try{jsonpatch[_0x1e34('0x23')](_0x45d7de,_0x4f3e10,!![]);}catch(_0x5b75e1){return BPromise['reject'](_0x5b75e1);}return _0x45d7de[_0x1e34('0x24')]();};}function saveUpdates(_0x5b94c8,_0xa1b841){return function(_0x2a309c){if(_0x2a309c){return _0x2a309c[_0x1e34('0x25')](_0x5b94c8)[_0x1e34('0x26')](function(_0x101c1c){return _0x101c1c;});}return null;};}function removeEntity(_0x8ed6b7,_0x428537){return function(_0x347b24){if(_0x347b24){return _0x347b24[_0x1e34('0x27')]()[_0x1e34('0x26')](function(){_0x8ed6b7[_0x1e34('0x20')](0xcc)[_0x1e34('0x1c')]();});}};}function handleEntityNotFound(_0x35aa41,_0xc33d44){return function(_0x37a2d1){if(!_0x37a2d1){_0x35aa41['sendStatus'](0x194);}return _0x37a2d1;};}function handleError(_0x503506,_0x325eab){_0x325eab=_0x325eab||0x1f4;return function(_0x5746ed){logger[_0x1e34('0x28')](_0x5746ed[_0x1e34('0x29')]);if(_0x5746ed[_0x1e34('0x2a')]){delete _0x5746ed[_0x1e34('0x2a')];}_0x503506['status'](_0x325eab)['send'](_0x5746ed);};}exports[_0x1e34('0x2b')]=function(_0x20907a,_0x51ba69){var _0x36f6ad={},_0x32a5e9={},_0x41561e={'count':0x0,'rows':[]};var _0xeb62ac=_[_0x1e34('0x2c')](db['CmHopperBlack'][_0x1e34('0x2d')],function(_0x102f65){return{'name':_0x102f65[_0x1e34('0x2e')],'type':_0x102f65[_0x1e34('0x2f')][_0x1e34('0x30')]};});_0x32a5e9[_0x1e34('0x31')]=_[_0x1e34('0x2c')](_0xeb62ac,_0x1e34('0x2a'));_0x32a5e9[_0x1e34('0x32')]=_[_0x1e34('0x33')](_0x20907a[_0x1e34('0x32')]);_0x32a5e9[_0x1e34('0x34')]=_[_0x1e34('0x35')](_0x32a5e9[_0x1e34('0x31')],_0x32a5e9[_0x1e34('0x32')]);_0x36f6ad[_0x1e34('0x36')]=_['intersection'](_0x32a5e9[_0x1e34('0x31')],qs[_0x1e34('0x37')](_0x20907a['query'][_0x1e34('0x37')]));_0x36f6ad[_0x1e34('0x36')]=_0x36f6ad[_0x1e34('0x36')][_0x1e34('0x38')]?_0x36f6ad['attributes']:_0x32a5e9[_0x1e34('0x31')];if(!_0x20907a[_0x1e34('0x32')][_0x1e34('0x39')](_0x1e34('0x3a'))){_0x36f6ad[_0x1e34('0x1f')]=qs[_0x1e34('0x1f')](_0x20907a[_0x1e34('0x32')][_0x1e34('0x1f')]);_0x36f6ad[_0x1e34('0x1e')]=qs['offset'](_0x20907a['query']['offset']);}_0x36f6ad[_0x1e34('0x3b')]=qs[_0x1e34('0x3c')](_0x20907a[_0x1e34('0x32')][_0x1e34('0x3c')]);_0x36f6ad[_0x1e34('0x3d')]=qs['filters'](_['pick'](_0x20907a['query'],_0x32a5e9[_0x1e34('0x34')]),_0xeb62ac);if(_0x20907a[_0x1e34('0x32')][_0x1e34('0x3e')]){_0x36f6ad[_0x1e34('0x3d')]=_[_0x1e34('0x3f')](_0x36f6ad[_0x1e34('0x3d')],{'$or':_['map'](_0xeb62ac,function(_0x350938){if(_0x350938[_0x1e34('0x2f')]!=='VIRTUAL'){var _0x461907={};_0x461907[_0x350938['name']]={'$like':'%'+_0x20907a[_0x1e34('0x32')][_0x1e34('0x3e')]+'%'};return _0x461907;}})});}_0x36f6ad=_[_0x1e34('0x3f')]({},_0x36f6ad,_0x20907a['options']);var _0x255266={'where':_0x36f6ad[_0x1e34('0x3d')]};return db[_0x1e34('0x40')][_0x1e34('0x1d')](_0x255266)[_0x1e34('0x26')](function(_0x246546){_0x41561e[_0x1e34('0x1d')]=_0x246546;if(_0x20907a['query'][_0x1e34('0x41')]){_0x36f6ad[_0x1e34('0x42')]=[{'all':!![]}];}return db[_0x1e34('0x40')][_0x1e34('0x43')](_0x36f6ad);})[_0x1e34('0x26')](function(_0x578f1e){_0x41561e['rows']=_0x578f1e;return _0x41561e;})['then'](respondWithFilteredResult(_0x51ba69,_0x36f6ad))[_0x1e34('0x44')](handleError(_0x51ba69,null));};exports['show']=function(_0x425d4c,_0x51e55c){var _0x2698bc={'raw':!![],'where':{'id':_0x425d4c[_0x1e34('0x45')]['id']}},_0x166151={};_0x166151[_0x1e34('0x31')]=_[_0x1e34('0x33')](db[_0x1e34('0x40')][_0x1e34('0x2d')]);_0x166151['query']=_[_0x1e34('0x33')](_0x425d4c[_0x1e34('0x32')]);_0x166151[_0x1e34('0x34')]=_['intersection'](_0x166151['model'],_0x166151[_0x1e34('0x32')]);_0x2698bc[_0x1e34('0x36')]=_[_0x1e34('0x35')](_0x166151[_0x1e34('0x31')],qs[_0x1e34('0x37')](_0x425d4c[_0x1e34('0x32')]['fields']));_0x2698bc['attributes']=_0x2698bc['attributes']['length']?_0x2698bc['attributes']:_0x166151[_0x1e34('0x31')];if(_0x425d4c[_0x1e34('0x32')][_0x1e34('0x41')]){_0x2698bc[_0x1e34('0x42')]=[{'all':!![]}];}_0x2698bc=_['merge']({},_0x2698bc,_0x425d4c[_0x1e34('0x46')]);return db[_0x1e34('0x40')][_0x1e34('0x47')](_0x2698bc)[_0x1e34('0x26')](handleEntityNotFound(_0x51e55c,null))[_0x1e34('0x26')](respondWithResult(_0x51e55c,null))[_0x1e34('0x44')](handleError(_0x51e55c,null));};exports[_0x1e34('0x25')]=function(_0x469840,_0xd79bf8){if(_0x469840[_0x1e34('0x48')]['id']){delete _0x469840[_0x1e34('0x48')]['id'];}return db['CmHopperBlack'][_0x1e34('0x47')]({'where':{'id':_0x469840[_0x1e34('0x45')]['id']}})[_0x1e34('0x26')](handleEntityNotFound(_0xd79bf8,null))[_0x1e34('0x26')](saveUpdates(_0x469840[_0x1e34('0x48')],null))[_0x1e34('0x26')](respondWithResult(_0xd79bf8,null))[_0x1e34('0x44')](handleError(_0xd79bf8,null));};exports[_0x1e34('0x27')]=function(_0x4e3260,_0x9d2930){return db['CmHopperBlack']['find']({'where':{'id':_0x4e3260[_0x1e34('0x45')]['id']}})[_0x1e34('0x26')](handleEntityNotFound(_0x9d2930,null))[_0x1e34('0x26')](removeEntity(_0x9d2930,null))[_0x1e34('0x44')](handleError(_0x9d2930,null));};exports[_0x1e34('0x49')]=function(_0x40c363,_0x26aaa6){return db[_0x1e34('0x40')]['describe']()[_0x1e34('0x26')](respondWithResult(_0x26aaa6,null))[_0x1e34('0x44')](handleError(_0x26aaa6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 5bd7631..e4ffc55 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 _0x3fc6=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util'];(function(_0x50aae9,_0x44c423){var _0x4a4a6f=function(_0x4956a3){while(--_0x4956a3){_0x50aae9['push'](_0x50aae9['shift']());}};_0x4a4a6f(++_0x44c423);}(_0x3fc6,0xdb));var _0x63fc=function(_0x44a5be,_0x479779){_0x44a5be=_0x44a5be-0x0;var _0x46954d=_0x3fc6[_0x44a5be];return _0x46954d;};'use strict';var _=require(_0x63fc('0x0'));var util=require(_0x63fc('0x1'));var logger=require('../../config/logger')(_0x63fc('0x2'));var moment=require(_0x63fc('0x3'));var BPromise=require('bluebird');var rp=require(_0x63fc('0x4'));var fs=require('fs');var path=require(_0x63fc('0x5'));var rimraf=require(_0x63fc('0x6'));var config=require(_0x63fc('0x7'));var attributes=require(_0x63fc('0x8'));module[_0x63fc('0x9')]=function(_0x2c2959,_0x41ff80){return _0x2c2959[_0x63fc('0xa')](_0x63fc('0xb'),attributes,{'tableName':_0x63fc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cd6=['path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5dcb56,_0x3c31d7){var _0x45dcc9=function(_0x3313d1){while(--_0x3313d1){_0x5dcb56['push'](_0x5dcb56['shift']());}};_0x45dcc9(++_0x3c31d7);}(_0x4cd6,0xa3));var _0x64cd=function(_0x4ef88f,_0x5a3ccf){_0x4ef88f=_0x4ef88f-0x0;var _0x2547cc=_0x4cd6[_0x4ef88f];return _0x2547cc;};'use strict';var _=require(_0x64cd('0x0'));var util=require('util');var logger=require(_0x64cd('0x1'))(_0x64cd('0x2'));var moment=require(_0x64cd('0x3'));var BPromise=require(_0x64cd('0x4'));var rp=require(_0x64cd('0x5'));var fs=require('fs');var path=require(_0x64cd('0x6'));var rimraf=require(_0x64cd('0x7'));var config=require('../../config/environment');var attributes=require(_0x64cd('0x8'));module[_0x64cd('0x9')]=function(_0x37ca02,_0x33e106){return _0x37ca02[_0x64cd('0xa')](_0x64cd('0xb'),attributes,{'tableName':_0x64cd('0xc'),'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 23bff35..84f467e 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 _0xae93=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','debug','request\x20sent','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','info','result','catch','GetCmHopperBlack','findAll','raw','options','where','attributes','include','model','map','UpdateCmHopperBlack','CmHopperBlack','update','limit','DestroyCmHopperBlack','destroy','then','moment','bluebird'];(function(_0x33e3bb,_0x6f9a6b){var _0x3e6120=function(_0x4ecd41){while(--_0x4ecd41){_0x33e3bb['push'](_0x33e3bb['shift']());}};_0x3e6120(++_0x6f9a6b);}(_0xae93,0x1c5));var _0x3ae9=function(_0x573da7,_0x46687c){_0x573da7=_0x573da7-0x0;var _0x58e1e2=_0xae93[_0x573da7];return _0x58e1e2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ae9('0x0'));var BPromise=require(_0x3ae9('0x1'));var rs=require(_0x3ae9('0x2'));var fs=require('fs');var Redis=require(_0x3ae9('0x3'));var db=require(_0x3ae9('0x4'))['db'];var utils=require(_0x3ae9('0x5'));var logger=require('../../config/logger')(_0x3ae9('0x6'));var config=require(_0x3ae9('0x7'));var jayson=require(_0x3ae9('0x8'));var client=jayson[_0x3ae9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x83b240,_0x5b0c20,_0x4b1c89){return new BPromise(function(_0x3f8d54,_0xbb70a6){return client['request'](_0x83b240,_0x4b1c89)['then'](function(_0x302eb2){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x5b0c20,'request\x20sent');logger[_0x3ae9('0xa')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5b0c20,_0x3ae9('0xb'),JSON[_0x3ae9('0xc')](_0x302eb2));if(_0x302eb2[_0x3ae9('0xd')]){if(_0x302eb2['error']['code']===0x1f4){logger[_0x3ae9('0xd')](_0x3ae9('0xe'),_0x5b0c20,_0x302eb2[_0x3ae9('0xd')][_0x3ae9('0xf')]);return _0xbb70a6(_0x302eb2['error'][_0x3ae9('0xf')]);}logger[_0x3ae9('0xd')](_0x3ae9('0xe'),_0x5b0c20,_0x302eb2[_0x3ae9('0xd')][_0x3ae9('0xf')]);return _0x3f8d54(_0x302eb2[_0x3ae9('0xd')][_0x3ae9('0xf')]);}else{logger[_0x3ae9('0x10')](_0x3ae9('0xe'),_0x5b0c20,_0x3ae9('0xb'));_0x3f8d54(_0x302eb2[_0x3ae9('0x11')][_0x3ae9('0xf')]);}})[_0x3ae9('0x12')](function(_0x4c04d9){logger['error'](_0x3ae9('0xe'),_0x5b0c20,_0x4c04d9);_0xbb70a6(_0x4c04d9);});});}exports[_0x3ae9('0x13')]=function(_0x5639fa){var _0x5c3c18=this;return new Promise(function(_0x38b7c4,_0x3c4410){return db['CmHopperBlack'][_0x3ae9('0x14')]({'raw':_0x5639fa['options']?_0x5639fa['options'][_0x3ae9('0x15')]===undefined?!![]:![]:!![],'where':_0x5639fa[_0x3ae9('0x16')]?_0x5639fa[_0x3ae9('0x16')][_0x3ae9('0x17')]||null:null,'attributes':_0x5639fa[_0x3ae9('0x16')]?_0x5639fa[_0x3ae9('0x16')][_0x3ae9('0x18')]||null:null,'limit':_0x5639fa['options']?_0x5639fa[_0x3ae9('0x16')]['limit']||null:null,'include':_0x5639fa[_0x3ae9('0x16')]?_0x5639fa[_0x3ae9('0x16')]['include']?_['map'](_0x5639fa[_0x3ae9('0x16')][_0x3ae9('0x19')],function(_0x3d4d31){return{'model':db[_0x3d4d31['model']],'as':_0x3d4d31['as'],'attributes':_0x3d4d31[_0x3ae9('0x18')],'include':_0x3d4d31[_0x3ae9('0x19')]?_['map'](_0x3d4d31[_0x3ae9('0x19')],function(_0x8d2144){return{'model':db[_0x8d2144[_0x3ae9('0x1a')]],'as':_0x8d2144['as'],'attributes':_0x8d2144[_0x3ae9('0x18')],'include':_0x8d2144[_0x3ae9('0x19')]?_[_0x3ae9('0x1b')](_0x8d2144['include'],function(_0x53eadc){return{'model':db[_0x53eadc['model']],'as':_0x53eadc['as'],'attributes':_0x53eadc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b31d1){logger['info']('GetCmHopperBlack',_0x5639fa);logger[_0x3ae9('0xa')](_0x3ae9('0x13'),_0x5639fa,JSON['stringify'](_0x2b31d1));_0x38b7c4(_0x2b31d1);})['catch'](function(_0x123c1f){logger['error']('GetCmHopperBlack',_0x123c1f[_0x3ae9('0xf')],_0x5639fa);_0x3c4410(_0x5c3c18[_0x3ae9('0xd')](0x1f4,_0x123c1f[_0x3ae9('0xf')]));});});};exports[_0x3ae9('0x1c')]=function(_0x4221c4){var _0x2c160b=this;return new Promise(function(_0x17d572,_0x8b0a55){return db[_0x3ae9('0x1d')][_0x3ae9('0x1e')](_0x4221c4['body'],{'raw':_0x4221c4[_0x3ae9('0x16')]?_0x4221c4['options'][_0x3ae9('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4221c4['options']?_0x4221c4['options']['where']||null:null,'attributes':_0x4221c4[_0x3ae9('0x16')]?_0x4221c4[_0x3ae9('0x16')]['attributes']||null:null,'limit':_0x4221c4[_0x3ae9('0x16')]?_0x4221c4[_0x3ae9('0x16')][_0x3ae9('0x1f')]||null:null})['then'](function(_0x412ed9){logger['info'](_0x3ae9('0x1c'),_0x4221c4);logger[_0x3ae9('0xa')](_0x3ae9('0x1c'),_0x4221c4,JSON[_0x3ae9('0xc')](_0x412ed9));_0x17d572(_0x412ed9);})['catch'](function(_0x5d968f){logger[_0x3ae9('0xd')](_0x3ae9('0x1c'),_0x5d968f['message'],_0x4221c4);_0x8b0a55(_0x2c160b[_0x3ae9('0xd')](0x1f4,_0x5d968f[_0x3ae9('0xf')]));});});};exports[_0x3ae9('0x20')]=function(_0x1b9206){var _0x297a63=this;return new Promise(function(_0x71ffe9,_0x6c12fc){return db['CmHopperBlack'][_0x3ae9('0x21')]({'where':_0x1b9206[_0x3ae9('0x16')]?_0x1b9206[_0x3ae9('0x16')][_0x3ae9('0x17')]||null:null})[_0x3ae9('0x22')](function(_0x385fdd){logger[_0x3ae9('0x10')](_0x3ae9('0x20'),_0x1b9206);logger[_0x3ae9('0xa')]('DestroyCmHopperBlack',_0x1b9206,JSON[_0x3ae9('0xc')](_0x385fdd));_0x71ffe9(_0x385fdd);})[_0x3ae9('0x12')](function(_0x1cb6e5){logger[_0x3ae9('0xd')](_0x3ae9('0x20'),_0x1cb6e5[_0x3ae9('0xf')],_0x1b9206);_0x6c12fc(_0x297a63[_0x3ae9('0xd')](0x1f4,_0x1cb6e5[_0x3ae9('0xf')]));});});}; \ No newline at end of file +var _0x93b2=['CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','then','GetCmHopperBlack','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x93b2,0x146));var _0x293b=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x93b2[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x293b('0x0'));var util=require(_0x293b('0x1'));var moment=require(_0x293b('0x2'));var BPromise=require(_0x293b('0x3'));var rs=require(_0x293b('0x4'));var fs=require('fs');var Redis=require(_0x293b('0x5'));var db=require(_0x293b('0x6'))['db'];var utils=require(_0x293b('0x7'));var logger=require(_0x293b('0x8'))('rpc');var config=require(_0x293b('0x9'));var jayson=require(_0x293b('0xa'));var client=jayson['client'][_0x293b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbb07bc,_0x2ec759,_0x1bc318){return new BPromise(function(_0x527076,_0x3688a0){return client['request'](_0xbb07bc,_0x1bc318)['then'](function(_0x596a8b){logger[_0x293b('0xc')](_0x293b('0xd'),_0x2ec759,_0x293b('0xe'));logger[_0x293b('0xf')](_0x293b('0x10'),_0x2ec759,'request\x20sent',JSON[_0x293b('0x11')](_0x596a8b));if(_0x596a8b[_0x293b('0x12')]){if(_0x596a8b[_0x293b('0x12')][_0x293b('0x13')]===0x1f4){logger[_0x293b('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x2ec759,_0x596a8b[_0x293b('0x12')][_0x293b('0x14')]);return _0x3688a0(_0x596a8b[_0x293b('0x12')][_0x293b('0x14')]);}logger[_0x293b('0x12')](_0x293b('0xd'),_0x2ec759,_0x596a8b[_0x293b('0x12')]['message']);return _0x527076(_0x596a8b[_0x293b('0x12')][_0x293b('0x14')]);}else{logger[_0x293b('0xc')](_0x293b('0xd'),_0x2ec759,_0x293b('0xe'));_0x527076(_0x596a8b[_0x293b('0x15')][_0x293b('0x14')]);}})[_0x293b('0x16')](function(_0x272987){logger[_0x293b('0x12')](_0x293b('0xd'),_0x2ec759,_0x272987);_0x3688a0(_0x272987);});});}exports['GetCmHopperBlack']=function(_0x54bf27){var _0x118477=this;return new Promise(function(_0x6e7bb3,_0x20a7fa){return db[_0x293b('0x17')][_0x293b('0x18')]({'raw':_0x54bf27['options']?_0x54bf27[_0x293b('0x19')][_0x293b('0x1a')]===undefined?!![]:![]:!![],'where':_0x54bf27['options']?_0x54bf27[_0x293b('0x19')][_0x293b('0x1b')]||null:null,'attributes':_0x54bf27[_0x293b('0x19')]?_0x54bf27[_0x293b('0x19')][_0x293b('0x1c')]||null:null,'limit':_0x54bf27[_0x293b('0x19')]?_0x54bf27[_0x293b('0x19')]['limit']||null:null,'include':_0x54bf27[_0x293b('0x19')]?_0x54bf27['options'][_0x293b('0x1d')]?_[_0x293b('0x1e')](_0x54bf27['options'][_0x293b('0x1d')],function(_0x3519cb){return{'model':db[_0x3519cb['model']],'as':_0x3519cb['as'],'attributes':_0x3519cb[_0x293b('0x1c')],'include':_0x3519cb['include']?_[_0x293b('0x1e')](_0x3519cb[_0x293b('0x1d')],function(_0x24bd07){return{'model':db[_0x24bd07[_0x293b('0x1f')]],'as':_0x24bd07['as'],'attributes':_0x24bd07['attributes'],'include':_0x24bd07[_0x293b('0x1d')]?_['map'](_0x24bd07[_0x293b('0x1d')],function(_0x5f4673){return{'model':db[_0x5f4673[_0x293b('0x1f')]],'as':_0x5f4673['as'],'attributes':_0x5f4673[_0x293b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x293b('0x20')](function(_0x2abaa2){logger[_0x293b('0xc')](_0x293b('0x21'),_0x54bf27);logger[_0x293b('0xf')](_0x293b('0x21'),_0x54bf27,JSON[_0x293b('0x11')](_0x2abaa2));_0x6e7bb3(_0x2abaa2);})[_0x293b('0x16')](function(_0xf6070a){logger[_0x293b('0x12')](_0x293b('0x21'),_0xf6070a['message'],_0x54bf27);_0x20a7fa(_0x118477[_0x293b('0x12')](0x1f4,_0xf6070a['message']));});});};exports['UpdateCmHopperBlack']=function(_0x55e224){var _0x4f591f=this;return new Promise(function(_0x3b8c05,_0x52e11a){return db['CmHopperBlack']['update'](_0x55e224[_0x293b('0x22')],{'raw':_0x55e224[_0x293b('0x19')]?_0x55e224[_0x293b('0x19')][_0x293b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55e224['options']?_0x55e224[_0x293b('0x19')][_0x293b('0x1b')]||null:null,'attributes':_0x55e224[_0x293b('0x19')]?_0x55e224[_0x293b('0x19')]['attributes']||null:null,'limit':_0x55e224[_0x293b('0x19')]?_0x55e224[_0x293b('0x19')]['limit']||null:null})['then'](function(_0xedcf47){logger[_0x293b('0xc')]('UpdateCmHopperBlack',_0x55e224);logger['debug'](_0x293b('0x23'),_0x55e224,JSON[_0x293b('0x11')](_0xedcf47));_0x3b8c05(_0xedcf47);})[_0x293b('0x16')](function(_0x4ffa34){logger[_0x293b('0x12')](_0x293b('0x23'),_0x4ffa34[_0x293b('0x14')],_0x55e224);_0x52e11a(_0x4f591f[_0x293b('0x12')](0x1f4,_0x4ffa34[_0x293b('0x14')]));});});};exports[_0x293b('0x24')]=function(_0x258322){var _0x40f183=this;return new Promise(function(_0x19368d,_0x295607){return db[_0x293b('0x17')][_0x293b('0x25')]({'where':_0x258322['options']?_0x258322['options'][_0x293b('0x1b')]||null:null})[_0x293b('0x20')](function(_0x2d868){logger[_0x293b('0xc')](_0x293b('0x24'),_0x258322);logger[_0x293b('0xf')](_0x293b('0x24'),_0x258322,JSON[_0x293b('0x11')](_0x2d868));_0x19368d(_0x2d868);})[_0x293b('0x16')](function(_0x4f36ab){logger[_0x293b('0x12')](_0x293b('0x24'),_0x4f36ab[_0x293b('0x14')],_0x258322);_0x295607(_0x40f183[_0x293b('0x12')](0x1f4,_0x4f36ab[_0x293b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index ba79106..af03fd6 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 _0x6f0d=['update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','show','put','/:id'];(function(_0x410eb6,_0xee5a4d){var _0x3a3406=function(_0x5cf4ec){while(--_0x5cf4ec){_0x410eb6['push'](_0x410eb6['shift']());}};_0x3a3406(++_0xee5a4d);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x28d114,_0x6393a5){_0x28d114=_0x28d114-0x0;var _0x208f65=_0x6f0d[_0x28d114];return _0x208f65;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var auth=require(_0xd6f0('0x4'));var interaction=require(_0xd6f0('0x5'));var config=require(_0xd6f0('0x6'));var controller=require(_0xd6f0('0x7'));router[_0xd6f0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd6f0('0x9')]);router['get'](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xe')](_0xd6f0('0xf'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0x10')]);router['delete'](_0xd6f0('0xf'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0x11')]);module[_0xd6f0('0x12')]=router; \ No newline at end of file +var _0x2d17=['update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','show','put'];(function(_0x580ef7,_0x35becd){var _0x669b8=function(_0x44aba6){while(--_0x44aba6){_0x580ef7['push'](_0x580ef7['shift']());}};_0x669b8(++_0x35becd);}(_0x2d17,0x17e));var _0x72d1=function(_0x5a13ab,_0x207e64){_0x5a13ab=_0x5a13ab-0x0;var _0x35bb0a=_0x2d17[_0x5a13ab];return _0x35bb0a;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var auth=require(_0x72d1('0x4'));var interaction=require(_0x72d1('0x5'));var config=require('../../config/environment');var controller=require(_0x72d1('0x6'));router['get']('/',auth[_0x72d1('0x7')](),controller['index']);router[_0x72d1('0x8')](_0x72d1('0x9'),auth['isAuthenticated'](),controller[_0x72d1('0xa')]);router[_0x72d1('0x8')](_0x72d1('0xb'),auth['isAuthenticated'](),controller[_0x72d1('0xc')]);router[_0x72d1('0xd')](_0x72d1('0xb'),auth['isAuthenticated'](),controller[_0x72d1('0xe')]);router[_0x72d1('0xf')](_0x72d1('0xb'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x10')]);module[_0x72d1('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d798855..0ab46f8 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 _0x6bbb=['STRING','DATE','getDataValue','followuptime','diff','seconds','setDataValue','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x24b4e9,_0x17dac0){var _0x119ac0=function(_0x274dc7){while(--_0x274dc7){_0x24b4e9['push'](_0x24b4e9['shift']());}};_0x119ac0(++_0x17dac0);}(_0x6bbb,0x18f));var _0xb6bb=function(_0x5a4b42,_0x2b9c18){_0x5a4b42=_0x5a4b42-0x0;var _0x5e81d6=_0x6bbb[_0x5a4b42];return _0x5e81d6;};'use strict';var Sequelize=require(_0xb6bb('0x0'));var moment=require(_0xb6bb('0x1'));module[_0xb6bb('0x2')]={'state':{'type':Sequelize[_0xb6bb('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xb6bb('0x4')]},'scheduledat':{'type':Sequelize[_0xb6bb('0x5')]},'countbusyretry':{'type':Sequelize[_0xb6bb('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb6bb('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb6bb('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb6bb('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xb6bb('0x4')]},'calleridnum':{'type':Sequelize[_0xb6bb('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb6bb('0x5')]},'responsetime':{'type':Sequelize[_0xb6bb('0x5')]},'answertime':{'type':Sequelize[_0xb6bb('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb6bb('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb6bb('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb6bb('0x4')]},'campaign':{'type':Sequelize[_0xb6bb('0x4')]},'campaigntype':{'type':Sequelize[_0xb6bb('0x4')]},'membername':{'type':Sequelize[_0xb6bb('0x4')]},'reason':{'type':Sequelize[_0xb6bb('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb6bb('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xb6bb('0x5')],'set':function(_0x3f2998){var _0x4fd23f=this[_0xb6bb('0x6')]('endtime');if(_0x4fd23f&&_0x3f2998){this['setDataValue'](_0xb6bb('0x7'),moment(_0x3f2998)[_0xb6bb('0x8')](moment(_0x4fd23f),_0xb6bb('0x9')));}return this[_0xb6bb('0xa')](_0xb6bb('0xb'),_0x3f2998);}},'amd':{'type':Sequelize[_0xb6bb('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb6bb('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb6bb('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xb6bb('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb6bb('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xb6bb('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb6bb('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3827=['BOOLEAN','sequelize','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','dispositionat'];(function(_0x745136,_0x54641a){var _0x299399=function(_0x24ea2e){while(--_0x24ea2e){_0x745136['push'](_0x745136['shift']());}};_0x299399(++_0x54641a);}(_0x3827,0x1c4));var _0x7382=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x3827[_0x9cd4c3];return _0x4c9025;};'use strict';var Sequelize=require(_0x7382('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x7382('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7382('0x2')]},'scheduledat':{'type':Sequelize[_0x7382('0x3')]},'countbusyretry':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x7382('0x2')]},'originatecalleridname':{'type':Sequelize[_0x7382('0x2')]},'calleridnum':{'type':Sequelize[_0x7382('0x2')]},'calleridname':{'type':Sequelize[_0x7382('0x2')]},'starttime':{'type':Sequelize[_0x7382('0x3')]},'responsetime':{'type':Sequelize[_0x7382('0x3')]},'answertime':{'type':Sequelize[_0x7382('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7382('0x3')]},'ringtime':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7382('0x2')]},'campaign':{'type':Sequelize[_0x7382('0x2')]},'campaigntype':{'type':Sequelize[_0x7382('0x2')]},'membername':{'type':Sequelize[_0x7382('0x2')]},'reason':{'type':Sequelize[_0x7382('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7382('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x271d4b){var _0x16f53d=this[_0x7382('0x4')](_0x7382('0x5'));if(_0x16f53d&&_0x271d4b){this[_0x7382('0x6')](_0x7382('0x7'),moment(_0x271d4b)['diff'](moment(_0x16f53d),_0x7382('0x8')));}return this['setDataValue'](_0x7382('0x9'),_0x271d4b);}},'amd':{'type':Sequelize[_0x7382('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7382('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7382('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x7382('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x7382('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7382('0x3')]},'deleted':{'type':Sequelize[_0x7382('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7382('0x3')]},'recallme':{'type':Sequelize[_0x7382('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7382('0x1')],'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 a1a2ed8..9c40a32 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 _0xd404=['attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','include','CmHopperFinal','rows','catch','show','params','rawAttributes','length','options','find','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','findAll','noAnswerContacts','busyContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','VoiceQueueId','updatedAt','select','ANY_VALUE(calleridnum)','phone','NOW()','field','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','CampaignId','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','limit','Content-Range','reject','then','destroy','sendStatus','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd404,0x15b));var _0x4d40=function(_0x3203b9,_0x50dca7){_0x3203b9=_0x3203b9-0x0;var _0x466568=_0xd404[_0x3203b9];return _0x466568;};'use strict';var pdf=require(_0x4d40('0x0'));var emlformat=require(_0x4d40('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4d40('0x2'));var jsonpatch=require(_0x4d40('0x3'));var rp=require('request-promise');var moment=require(_0x4d40('0x4'));var BPromise=require(_0x4d40('0x5'));var Mustache=require(_0x4d40('0x6'));var util=require(_0x4d40('0x7'));var path=require(_0x4d40('0x8'));var sox=require(_0x4d40('0x9'));var csv=require(_0x4d40('0xa'));var ejs=require(_0x4d40('0xb'));var fs=require('fs');var _=require(_0x4d40('0xc'));var squel=require('squel');var crypto=require(_0x4d40('0xd'));var jsforce=require(_0x4d40('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d40('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d40('0xf'));var authService=require(_0x4d40('0x10'));var qs=require(_0x4d40('0x11'));var as=require(_0x4d40('0x12'));var hardwareService=require(_0x4d40('0x13'));var logger=require(_0x4d40('0x14'))(_0x4d40('0x15'));var utils=require(_0x4d40('0x16'));var config=require(_0x4d40('0x17'));var licenseUtil=require(_0x4d40('0x18'));var db=require(_0x4d40('0x19'))['db'];function respondWithStatusCode(_0x3c3b7e,_0x28e5bf){_0x28e5bf=_0x28e5bf||0xcc;return function(_0x42a621){if(_0x42a621){return _0x3c3b7e['sendStatus'](_0x28e5bf);}return _0x3c3b7e[_0x4d40('0x1a')](_0x28e5bf)[_0x4d40('0x1b')]();};}function respondWithResult(_0x3b071b,_0x2083bd){_0x2083bd=_0x2083bd||0xc8;return function(_0x477a91){if(_0x477a91){return _0x3b071b['status'](_0x2083bd)[_0x4d40('0x1c')](_0x477a91);}};}function respondWithFilteredResult(_0x4077ce,_0x20bc1b){return function(_0xcee25a){if(_0xcee25a){var _0x453857=_0xcee25a[_0x4d40('0x1d')],_0x361a41=_0x20bc1b['offset'],_0x10518e=_0x20bc1b['offset']+_0x20bc1b[_0x4d40('0x1e')],_0x43c902;if(_0x10518e>=_0x453857){_0x10518e=_0x453857;_0x43c902=0xc8;}else{_0x43c902=0xce;}_0x4077ce[_0x4d40('0x1a')](_0x43c902);return _0x4077ce['set'](_0x4d40('0x1f'),_0x361a41+'-'+_0x10518e+'/'+_0x453857)[_0x4d40('0x1c')](_0xcee25a);}return null;};}function patchUpdates(_0x4eec1d){return function(_0x36d031){try{jsonpatch['apply'](_0x36d031,_0x4eec1d,!![]);}catch(_0xf15019){return BPromise[_0x4d40('0x20')](_0xf15019);}return _0x36d031['save']();};}function saveUpdates(_0x57c997,_0x375ce0){return function(_0x569190){if(_0x569190){return _0x569190['update'](_0x57c997)[_0x4d40('0x21')](function(_0x3684eb){return _0x3684eb;});}return null;};}function removeEntity(_0x30f058,_0x5d4c24){return function(_0x356fd6){if(_0x356fd6){return _0x356fd6[_0x4d40('0x22')]()[_0x4d40('0x21')](function(){_0x30f058['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2df33a,_0x90b652){return function(_0x1285f6){if(!_0x1285f6){_0x2df33a[_0x4d40('0x23')](0x194);}return _0x1285f6;};}function handleError(_0x4677c9,_0x4f61fd){_0x4f61fd=_0x4f61fd||0x1f4;return function(_0xbcd540){logger[_0x4d40('0x24')](_0xbcd540['stack']);if(_0xbcd540['name']){delete _0xbcd540[_0x4d40('0x25')];}_0x4677c9[_0x4d40('0x1a')](_0x4f61fd)[_0x4d40('0x26')](_0xbcd540);};}exports[_0x4d40('0x27')]=function(_0x4a8ad6,_0x325f6f){var _0x105635={},_0x35dd32={},_0x2892ac={'count':0x0,'rows':[]};var _0x20f1f4=_[_0x4d40('0x28')](db['CmHopperFinal']['rawAttributes'],function(_0x52f706){return{'name':_0x52f706[_0x4d40('0x29')],'type':_0x52f706[_0x4d40('0x2a')][_0x4d40('0x2b')]};});_0x35dd32[_0x4d40('0x2c')]=_['map'](_0x20f1f4,_0x4d40('0x25'));_0x35dd32[_0x4d40('0x2d')]=_[_0x4d40('0x2e')](_0x4a8ad6['query']);_0x35dd32[_0x4d40('0x2f')]=_[_0x4d40('0x30')](_0x35dd32[_0x4d40('0x2c')],_0x35dd32[_0x4d40('0x2d')]);_0x105635[_0x4d40('0x31')]=_['intersection'](_0x35dd32[_0x4d40('0x2c')],qs['fields'](_0x4a8ad6[_0x4d40('0x2d')][_0x4d40('0x32')]));_0x105635[_0x4d40('0x31')]=_0x105635[_0x4d40('0x31')]['length']?_0x105635['attributes']:_0x35dd32[_0x4d40('0x2c')];if(!_0x4a8ad6[_0x4d40('0x2d')][_0x4d40('0x33')](_0x4d40('0x34'))){_0x105635['limit']=qs[_0x4d40('0x1e')](_0x4a8ad6['query'][_0x4d40('0x1e')]);_0x105635[_0x4d40('0x35')]=qs[_0x4d40('0x35')](_0x4a8ad6[_0x4d40('0x2d')][_0x4d40('0x35')]);}_0x105635[_0x4d40('0x36')]=qs[_0x4d40('0x37')](_0x4a8ad6[_0x4d40('0x2d')][_0x4d40('0x37')]);_0x105635[_0x4d40('0x38')]=qs['filters'](_[_0x4d40('0x39')](_0x4a8ad6[_0x4d40('0x2d')],_0x35dd32['filters']),_0x20f1f4);if(_0x4a8ad6['query']['filter']){_0x105635[_0x4d40('0x38')]=_[_0x4d40('0x3a')](_0x105635['where'],{'$or':_[_0x4d40('0x28')](_0x20f1f4,function(_0x1fefa3){if(_0x1fefa3[_0x4d40('0x2a')]!==_0x4d40('0x3b')){var _0x25bf3b={};_0x25bf3b[_0x1fefa3['name']]={'$like':'%'+_0x4a8ad6[_0x4d40('0x2d')][_0x4d40('0x3c')]+'%'};return _0x25bf3b;}})});}_0x105635=_['merge']({},_0x105635,_0x4a8ad6['options']);var _0x3a4924={'where':_0x105635[_0x4d40('0x38')]};return db['CmHopperFinal'][_0x4d40('0x1d')](_0x3a4924)[_0x4d40('0x21')](function(_0x4ab819){_0x2892ac[_0x4d40('0x1d')]=_0x4ab819;if(_0x4a8ad6[_0x4d40('0x2d')]['includeAll']){_0x105635[_0x4d40('0x3d')]=[{'all':!![]}];}return db[_0x4d40('0x3e')]['findAll'](_0x105635);})[_0x4d40('0x21')](function(_0x55cdf4){_0x2892ac[_0x4d40('0x3f')]=_0x55cdf4;return _0x2892ac;})[_0x4d40('0x21')](respondWithFilteredResult(_0x325f6f,_0x105635))[_0x4d40('0x40')](handleError(_0x325f6f,null));};exports[_0x4d40('0x41')]=function(_0x253baa,_0x2ef0ca){var _0x91f44d={'raw':!![],'where':{'id':_0x253baa[_0x4d40('0x42')]['id']}},_0x340740={};_0x340740['model']=_[_0x4d40('0x2e')](db[_0x4d40('0x3e')][_0x4d40('0x43')]);_0x340740[_0x4d40('0x2d')]=_[_0x4d40('0x2e')](_0x253baa['query']);_0x340740[_0x4d40('0x2f')]=_['intersection'](_0x340740[_0x4d40('0x2c')],_0x340740[_0x4d40('0x2d')]);_0x91f44d[_0x4d40('0x31')]=_[_0x4d40('0x30')](_0x340740['model'],qs[_0x4d40('0x32')](_0x253baa[_0x4d40('0x2d')]['fields']));_0x91f44d[_0x4d40('0x31')]=_0x91f44d['attributes'][_0x4d40('0x44')]?_0x91f44d[_0x4d40('0x31')]:_0x340740[_0x4d40('0x2c')];if(_0x253baa[_0x4d40('0x2d')]['includeAll']){_0x91f44d[_0x4d40('0x3d')]=[{'all':!![]}];}_0x91f44d=_['merge']({},_0x91f44d,_0x253baa[_0x4d40('0x45')]);return db[_0x4d40('0x3e')][_0x4d40('0x46')](_0x91f44d)[_0x4d40('0x21')](handleEntityNotFound(_0x2ef0ca,null))['then'](respondWithResult(_0x2ef0ca,null))[_0x4d40('0x40')](handleError(_0x2ef0ca,null));};exports[_0x4d40('0x47')]=function(_0x460831,_0x363fcc){return db['CmHopperFinal'][_0x4d40('0x47')]()[_0x4d40('0x21')](respondWithResult(_0x363fcc,null))['catch'](handleError(_0x363fcc,null));};exports[_0x4d40('0x48')]=function(_0x493d8e,_0x3d4283){if(_0x493d8e[_0x4d40('0x49')][_0x4d40('0x4a')]){delete _0x493d8e[_0x4d40('0x49')][_0x4d40('0x4a')];}return db[_0x4d40('0x3e')][_0x4d40('0x46')]({'where':{'uniqueid':_0x493d8e[_0x4d40('0x42')]['id']}})[_0x4d40('0x21')](handleEntityNotFound(_0x3d4283,null))['then'](saveUpdates(_0x493d8e[_0x4d40('0x49')],null))[_0x4d40('0x21')](respondWithResult(_0x3d4283,null))[_0x4d40('0x40')](handleError(_0x3d4283,null));};exports[_0x4d40('0x4b')]=function(_0x21cc2c,_0x5bc033,_0x1ead99){return db[_0x4d40('0x3e')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x21cc2c[_0x4d40('0x42')]['id']},'attributes':[[db['sequelize']['fn'](_0x4d40('0x4c'),db[_0x4d40('0x4d')]['fn']('IF',db[_0x4d40('0x4d')]['literal'](_0x4d40('0x4e')))),_0x4d40('0x4f')],[db[_0x4d40('0x4d')]['fn'](_0x4d40('0x4c'),db[_0x4d40('0x4d')]['fn']('IF',db['sequelize'][_0x4d40('0x50')](_0x4d40('0x51')))),'noAnswerContacts'],[db[_0x4d40('0x4d')]['fn']('COUNT',db[_0x4d40('0x4d')]['fn']('IF',db['sequelize'][_0x4d40('0x50')](_0x4d40('0x52')))),'busyContacts'],[db[_0x4d40('0x4d')]['fn'](_0x4d40('0x4c'),db[_0x4d40('0x4d')]['fn']('IF',db[_0x4d40('0x4d')][_0x4d40('0x50')](_0x4d40('0x53')))),_0x4d40('0x54')],[db[_0x4d40('0x4d')]['fn'](_0x4d40('0x4c'),db[_0x4d40('0x4d')]['fn']('IF',db[_0x4d40('0x4d')][_0x4d40('0x50')](_0x4d40('0x55')))),_0x4d40('0x56')],[db[_0x4d40('0x4d')]['fn'](_0x4d40('0x4c'),db[_0x4d40('0x4d')]['fn']('IF',db[_0x4d40('0x4d')][_0x4d40('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4d40('0x57')],[db[_0x4d40('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4d40('0x4d')][_0x4d40('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x4d40('0x4d')]['fn']('COUNT',db[_0x4d40('0x4d')]['fn']('IF',db['sequelize'][_0x4d40('0x50')](_0x4d40('0x58')))),_0x4d40('0x59')]]})[_0x4d40('0x21')](handleEntityNotFound(_0x5bc033,null))[_0x4d40('0x21')](respondWithResult(_0x5bc033,null))['catch'](handleError(_0x5bc033,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4e5b26,_0x259f9d,_0x323373){return db[_0x4d40('0x3e')][_0x4d40('0x5a')]({'raw':![],'where':{'CampaignId':_0x4e5b26[_0x4d40('0x42')]['id']},'attributes':[[db['sequelize']['fn'](_0x4d40('0x4c'),db['sequelize']['fn']('IF',db[_0x4d40('0x4d')][_0x4d40('0x50')](_0x4d40('0x4e')))),_0x4d40('0x4f')],[db[_0x4d40('0x4d')]['fn'](_0x4d40('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x4d40('0x50')](_0x4d40('0x51')))),_0x4d40('0x5b')],[db[_0x4d40('0x4d')]['fn'](_0x4d40('0x4c'),db[_0x4d40('0x4d')]['fn']('IF',db[_0x4d40('0x4d')][_0x4d40('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x4d40('0x5c')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4d40('0x4d')][_0x4d40('0x50')](_0x4d40('0x53')))),_0x4d40('0x54')],[db['sequelize']['fn'](_0x4d40('0x4c'),db[_0x4d40('0x4d')]['fn']('IF',db[_0x4d40('0x4d')][_0x4d40('0x50')](_0x4d40('0x55')))),'dropContacts'],[db['sequelize']['fn'](_0x4d40('0x4c'),db['sequelize']['fn']('IF',db[_0x4d40('0x4d')][_0x4d40('0x50')](_0x4d40('0x5d')))),'abandonedContacts'],[db['sequelize']['fn'](_0x4d40('0x4c'),db['sequelize']['fn']('IF',db[_0x4d40('0x4d')][_0x4d40('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4d40('0x5e')],[db[_0x4d40('0x4d')]['fn'](_0x4d40('0x4c'),db[_0x4d40('0x4d')]['fn']('IF',db[_0x4d40('0x4d')][_0x4d40('0x50')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})['then'](handleEntityNotFound(_0x259f9d,null))[_0x4d40('0x21')](respondWithResult(_0x259f9d,null))[_0x4d40('0x40')](handleError(_0x259f9d,null));};exports[_0x4d40('0x5f')]=function(_0x542d06,_0xcf9e5b,_0x22b423){return db['VoiceQueue']['find']({'where':{'id':_0x542d06[_0x4d40('0x42')]['id']}})[_0x4d40('0x21')](handleEntityNotFound(_0xcf9e5b,null))['then'](function(_0x1758f2){var _0x471863;if(_0x1758f2){_0x471863=squel[_0x4d40('0x60')]()[_0x4d40('0x61')](_0x4d40('0x62'))[_0x4d40('0x63')](['phone',_0x4d40('0x64'),'ContactId',_0x4d40('0x65'),_0x4d40('0x66'),'createdAt',_0x4d40('0x67')],squel[_0x4d40('0x68')]()['field'](_0x4d40('0x69'),_0x4d40('0x6a'))['field'](_0x4d40('0x6b'),_0x4d40('0x64'))[_0x4d40('0x6c')](_0x4d40('0x6d'),_0x4d40('0x6e'))['field'](_0x4d40('0x6f'),_0x4d40('0x65'))[_0x4d40('0x6c')](_0x4d40('0x70'),_0x4d40('0x66'))[_0x4d40('0x6c')]('NOW()',_0x4d40('0x71'))['field'](_0x4d40('0x6b'),_0x4d40('0x67'))[_0x4d40('0x72')](_0x4d40('0x73'))[_0x4d40('0x38')]('VoiceQueueId\x20=\x20?',_0x542d06[_0x4d40('0x42')]['id'][_0x4d40('0x74')]())[_0x4d40('0x38')](_0x4d40('0x75'),_0x542d06['body'][_0x4d40('0x76')][_0x4d40('0x74')]())[_0x4d40('0x38')](_0x4d40('0x77'))['where'](_0x4d40('0x78'),squel['select']()[_0x4d40('0x6c')](_0x4d40('0x6a'))[_0x4d40('0x72')](_0x4d40('0x62'))['where']('VoiceQueueId\x20=\x20?',_0x542d06[_0x4d40('0x42')]['id'][_0x4d40('0x74')]()))['where'](_0x4d40('0x78'),squel[_0x4d40('0x68')]()[_0x4d40('0x6c')](_0x4d40('0x79'))[_0x4d40('0x72')]('cm_hopper_final')[_0x4d40('0x38')](_0x4d40('0x7a'),_0x542d06[_0x4d40('0x42')]['id'][_0x4d40('0x74')]())[_0x4d40('0x38')](_0x4d40('0x7b')))[_0x4d40('0x7c')](_0x4d40('0x6e')))[_0x4d40('0x74')]();return db[_0x4d40('0x4d')][_0x4d40('0x2d')](_0x471863);}return[];})['then'](respondWithResult(_0xcf9e5b,null))[_0x4d40('0x40')](handleError(_0xcf9e5b,null));};exports[_0x4d40('0x7d')]=function(_0x599727,_0xbb9020,_0xbec312){return db['Campaign']['find']({'where':{'id':_0x599727[_0x4d40('0x42')]['id']}})[_0x4d40('0x21')](handleEntityNotFound(_0xbb9020,null))['then'](function(_0x233f77){var _0x36603c;if(_0x233f77){_0x36603c=squel['insert']()[_0x4d40('0x61')](_0x4d40('0x62'))['fromQuery'](['phone','scheduledAt','ContactId',_0x4d40('0x65'),'CampaignId','createdAt',_0x4d40('0x67')],squel[_0x4d40('0x68')]()[_0x4d40('0x6c')](_0x4d40('0x69'),_0x4d40('0x6a'))[_0x4d40('0x6c')](_0x4d40('0x6b'),'scheduledAt')[_0x4d40('0x6c')](_0x4d40('0x6d'),_0x4d40('0x6e'))[_0x4d40('0x6c')](_0x4d40('0x6f'),_0x4d40('0x65'))[_0x4d40('0x6c')](_0x4d40('0x7e'),'CampaignId')['field'](_0x4d40('0x6b'),_0x4d40('0x71'))[_0x4d40('0x6c')](_0x4d40('0x6b'),_0x4d40('0x67'))[_0x4d40('0x72')]('cm_hopper_final')[_0x4d40('0x38')](_0x4d40('0x7f'),_0x599727['params']['id'][_0x4d40('0x74')]())['where']('state\x20=\x20?',_0x599727['body'][_0x4d40('0x76')][_0x4d40('0x74')]())[_0x4d40('0x38')](_0x4d40('0x77'))['where'](_0x4d40('0x78'),squel['select']()[_0x4d40('0x6c')](_0x4d40('0x6a'))[_0x4d40('0x72')](_0x4d40('0x62'))[_0x4d40('0x38')](_0x4d40('0x7f'),_0x599727['params']['id'][_0x4d40('0x74')]()))[_0x4d40('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x4d40('0x6c')](_0x4d40('0x79'))[_0x4d40('0x72')](_0x4d40('0x73'))[_0x4d40('0x38')]('CampaignId\x20=\x20?',_0x599727[_0x4d40('0x42')]['id'][_0x4d40('0x74')]())[_0x4d40('0x38')]('state\x20=\x204'))[_0x4d40('0x7c')]('ContactId'))[_0x4d40('0x74')]();return db[_0x4d40('0x4d')][_0x4d40('0x2d')](_0x36603c);}return[];})['then'](respondWithResult(_0xbb9020,null))[_0x4d40('0x40')](handleError(_0xbb9020,null));};exports[_0x4d40('0x80')]=function(_0x5d989c,_0x27fe0f,_0xd059a0){return db[_0x4d40('0x81')][_0x4d40('0x82')]({'where':{'VoiceQueueId':_0x5d989c['body'][_0x4d40('0x66')],'CampaignId':_0x5d989c['body'][_0x4d40('0x83')],'ContactId':_0x5d989c[_0x4d40('0x49')]['ContactId']}})[_0x4d40('0x21')](handleEntityNotFound(_0x27fe0f,null))['then'](function(_0x4b22cd){if(_0x4b22cd){return _0x4b22cd;}return null;})[_0x4d40('0x21')](respondWithResult(_0x27fe0f,null))['catch'](handleError(_0x27fe0f,null));}; \ No newline at end of file +var _0x9335=['countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','find','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','phone','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','group','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','json','reject','save','update','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','limit','where','filters','filter','merge','type','VIRTUAL','options','then','includeAll','include','catch','show','fields','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0x9335,0xab));var _0x5933=function(_0x230c7b,_0x482487){_0x230c7b=_0x230c7b-0x0;var _0x41eabb=_0x9335[_0x230c7b];return _0x41eabb;};'use strict';var pdf=require(_0x5933('0x0'));var emlformat=require(_0x5933('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5933('0x2'));var jsonpatch=require(_0x5933('0x3'));var rp=require(_0x5933('0x4'));var moment=require(_0x5933('0x5'));var BPromise=require(_0x5933('0x6'));var Mustache=require(_0x5933('0x7'));var util=require(_0x5933('0x8'));var path=require('path');var sox=require(_0x5933('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5933('0xa'));var squel=require(_0x5933('0xb'));var crypto=require(_0x5933('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5933('0xd'));var toCsv=require(_0x5933('0xe'));var querystring=require(_0x5933('0xf'));var Papa=require(_0x5933('0x10'));var Redis=require(_0x5933('0x11'));var authService=require(_0x5933('0x12'));var qs=require(_0x5933('0x13'));var as=require(_0x5933('0x14'));var hardwareService=require(_0x5933('0x15'));var logger=require(_0x5933('0x16'))(_0x5933('0x17'));var utils=require(_0x5933('0x18'));var config=require(_0x5933('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5933('0x1a'))['db'];function respondWithStatusCode(_0x5af679,_0x8b6bad){_0x8b6bad=_0x8b6bad||0xcc;return function(_0x1b4428){if(_0x1b4428){return _0x5af679[_0x5933('0x1b')](_0x8b6bad);}return _0x5af679['status'](_0x8b6bad)[_0x5933('0x1c')]();};}function respondWithResult(_0x542448,_0x1ab3d0){_0x1ab3d0=_0x1ab3d0||0xc8;return function(_0x4fc51d){if(_0x4fc51d){return _0x542448[_0x5933('0x1d')](_0x1ab3d0)['json'](_0x4fc51d);}};}function respondWithFilteredResult(_0xf6321f,_0x5e91da){return function(_0x404555){if(_0x404555){var _0x34c035=_0x404555[_0x5933('0x1e')],_0x236c9a=_0x5e91da[_0x5933('0x1f')],_0x556270=_0x5e91da[_0x5933('0x1f')]+_0x5e91da['limit'],_0x48dc5b;if(_0x556270>=_0x34c035){_0x556270=_0x34c035;_0x48dc5b=0xc8;}else{_0x48dc5b=0xce;}_0xf6321f['status'](_0x48dc5b);return _0xf6321f[_0x5933('0x20')]('Content-Range',_0x236c9a+'-'+_0x556270+'/'+_0x34c035)[_0x5933('0x21')](_0x404555);}return null;};}function patchUpdates(_0x41946a){return function(_0x21b1d7){try{jsonpatch['apply'](_0x21b1d7,_0x41946a,!![]);}catch(_0x41acb9){return BPromise[_0x5933('0x22')](_0x41acb9);}return _0x21b1d7[_0x5933('0x23')]();};}function saveUpdates(_0x4d661c,_0x59a2cd){return function(_0x49c67f){if(_0x49c67f){return _0x49c67f[_0x5933('0x24')](_0x4d661c)['then'](function(_0x1343b4){return _0x1343b4;});}return null;};}function removeEntity(_0x4a5252,_0x2d0fb7){return function(_0x50026f){if(_0x50026f){return _0x50026f['destroy']()['then'](function(){_0x4a5252['status'](0xcc)[_0x5933('0x1c')]();});}};}function handleEntityNotFound(_0x5639c7,_0x1a2f5d){return function(_0x544f23){if(!_0x544f23){_0x5639c7['sendStatus'](0x194);}return _0x544f23;};}function handleError(_0x457894,_0x3c605b){_0x3c605b=_0x3c605b||0x1f4;return function(_0x297b15){logger['error'](_0x297b15[_0x5933('0x25')]);if(_0x297b15[_0x5933('0x26')]){delete _0x297b15[_0x5933('0x26')];}_0x457894['status'](_0x3c605b)[_0x5933('0x27')](_0x297b15);};}exports[_0x5933('0x28')]=function(_0x49c49c,_0x107d87){var _0x148020={},_0x5bbeea={},_0x253ff1={'count':0x0,'rows':[]};var _0x4bc02e=_[_0x5933('0x29')](db[_0x5933('0x2a')][_0x5933('0x2b')],function(_0x4adb80){return{'name':_0x4adb80[_0x5933('0x2c')],'type':_0x4adb80['type'][_0x5933('0x2d')]};});_0x5bbeea[_0x5933('0x2e')]=_['map'](_0x4bc02e,'name');_0x5bbeea['query']=_[_0x5933('0x2f')](_0x49c49c[_0x5933('0x30')]);_0x5bbeea['filters']=_[_0x5933('0x31')](_0x5bbeea[_0x5933('0x2e')],_0x5bbeea[_0x5933('0x30')]);_0x148020[_0x5933('0x32')]=_['intersection'](_0x5bbeea[_0x5933('0x2e')],qs['fields'](_0x49c49c[_0x5933('0x30')]['fields']));_0x148020[_0x5933('0x32')]=_0x148020[_0x5933('0x32')][_0x5933('0x33')]?_0x148020[_0x5933('0x32')]:_0x5bbeea['model'];if(!_0x49c49c[_0x5933('0x30')][_0x5933('0x34')]('nolimit')){_0x148020['limit']=qs[_0x5933('0x35')](_0x49c49c['query']['limit']);_0x148020[_0x5933('0x1f')]=qs[_0x5933('0x1f')](_0x49c49c[_0x5933('0x30')][_0x5933('0x1f')]);}_0x148020['order']=qs['sort'](_0x49c49c['query']['sort']);_0x148020[_0x5933('0x36')]=qs['filters'](_['pick'](_0x49c49c['query'],_0x5bbeea[_0x5933('0x37')]),_0x4bc02e);if(_0x49c49c[_0x5933('0x30')][_0x5933('0x38')]){_0x148020[_0x5933('0x36')]=_[_0x5933('0x39')](_0x148020[_0x5933('0x36')],{'$or':_[_0x5933('0x29')](_0x4bc02e,function(_0xbd088d){if(_0xbd088d[_0x5933('0x3a')]!==_0x5933('0x3b')){var _0x5374d9={};_0x5374d9[_0xbd088d[_0x5933('0x26')]]={'$like':'%'+_0x49c49c[_0x5933('0x30')][_0x5933('0x38')]+'%'};return _0x5374d9;}})});}_0x148020=_[_0x5933('0x39')]({},_0x148020,_0x49c49c[_0x5933('0x3c')]);var _0x2c1484={'where':_0x148020[_0x5933('0x36')]};return db[_0x5933('0x2a')][_0x5933('0x1e')](_0x2c1484)[_0x5933('0x3d')](function(_0x51e82b){_0x253ff1['count']=_0x51e82b;if(_0x49c49c[_0x5933('0x30')][_0x5933('0x3e')]){_0x148020[_0x5933('0x3f')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x148020);})[_0x5933('0x3d')](function(_0x162865){_0x253ff1['rows']=_0x162865;return _0x253ff1;})[_0x5933('0x3d')](respondWithFilteredResult(_0x107d87,_0x148020))[_0x5933('0x40')](handleError(_0x107d87,null));};exports[_0x5933('0x41')]=function(_0x107f4f,_0x192576){var _0x1f1d56={'raw':!![],'where':{'id':_0x107f4f['params']['id']}},_0x5721fb={};_0x5721fb[_0x5933('0x2e')]=_[_0x5933('0x2f')](db[_0x5933('0x2a')][_0x5933('0x2b')]);_0x5721fb[_0x5933('0x30')]=_[_0x5933('0x2f')](_0x107f4f['query']);_0x5721fb[_0x5933('0x37')]=_[_0x5933('0x31')](_0x5721fb[_0x5933('0x2e')],_0x5721fb['query']);_0x1f1d56[_0x5933('0x32')]=_[_0x5933('0x31')](_0x5721fb[_0x5933('0x2e')],qs[_0x5933('0x42')](_0x107f4f[_0x5933('0x30')][_0x5933('0x42')]));_0x1f1d56[_0x5933('0x32')]=_0x1f1d56[_0x5933('0x32')][_0x5933('0x33')]?_0x1f1d56[_0x5933('0x32')]:_0x5721fb['model'];if(_0x107f4f[_0x5933('0x30')]['includeAll']){_0x1f1d56['include']=[{'all':!![]}];}_0x1f1d56=_['merge']({},_0x1f1d56,_0x107f4f[_0x5933('0x3c')]);return db['CmHopperFinal']['find'](_0x1f1d56)[_0x5933('0x3d')](handleEntityNotFound(_0x192576,null))[_0x5933('0x3d')](respondWithResult(_0x192576,null))['catch'](handleError(_0x192576,null));};exports[_0x5933('0x43')]=function(_0x54a77f,_0x2559e9){return db[_0x5933('0x2a')]['describe']()['then'](respondWithResult(_0x2559e9,null))[_0x5933('0x40')](handleError(_0x2559e9,null));};exports[_0x5933('0x24')]=function(_0x38e713,_0x10148d){if(_0x38e713[_0x5933('0x44')]['uniqueid']){delete _0x38e713[_0x5933('0x44')][_0x5933('0x45')];}return db[_0x5933('0x2a')]['find']({'where':{'uniqueid':_0x38e713[_0x5933('0x46')]['id']}})[_0x5933('0x3d')](handleEntityNotFound(_0x10148d,null))[_0x5933('0x3d')](saveUpdates(_0x38e713[_0x5933('0x44')],null))['then'](respondWithResult(_0x10148d,null))[_0x5933('0x40')](handleError(_0x10148d,null));};exports[_0x5933('0x47')]=function(_0x19fc7c,_0x36633b,_0x56a748){return db[_0x5933('0x2a')][_0x5933('0x48')]({'raw':![],'where':{'VoiceQueueId':_0x19fc7c[_0x5933('0x46')]['id']},'attributes':[[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')](_0x5933('0x4c')))),_0x5933('0x4d')],[db['sequelize']['fn'](_0x5933('0x4a'),db['sequelize']['fn']('IF',db[_0x5933('0x49')]['literal'](_0x5933('0x4e')))),'noAnswerContacts'],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db['sequelize']['fn']('IF',db[_0x5933('0x49')]['literal'](_0x5933('0x4f')))),_0x5933('0x50')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')]['literal'](_0x5933('0x51')))),_0x5933('0x52')],[db[_0x5933('0x49')]['fn']('COUNT',db[_0x5933('0x49')]['fn']('IF',db['sequelize'][_0x5933('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5933('0x53')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5933('0x54')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db['sequelize'][_0x5933('0x4b')](_0x5933('0x55')))),_0x5933('0x56')]]})[_0x5933('0x3d')](handleEntityNotFound(_0x36633b,null))[_0x5933('0x3d')](respondWithResult(_0x36633b,null))[_0x5933('0x40')](handleError(_0x36633b,null));};exports[_0x5933('0x57')]=function(_0x377d24,_0x67a14a,_0xb53ee6){return db[_0x5933('0x2a')][_0x5933('0x48')]({'raw':![],'where':{'CampaignId':_0x377d24[_0x5933('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')](_0x5933('0x4c')))),_0x5933('0x4d')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')](_0x5933('0x4e')))),_0x5933('0x58')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5933('0x4f')))),_0x5933('0x50')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')](_0x5933('0x51')))),_0x5933('0x52')],[db['sequelize']['fn']('COUNT',db[_0x5933('0x49')]['fn']('IF',db['sequelize'][_0x5933('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x5933('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')](_0x5933('0x59')))),_0x5933('0x54')],[db[_0x5933('0x49')]['fn']('COUNT',db[_0x5933('0x49')]['fn']('IF',db['sequelize'][_0x5933('0x4b')](_0x5933('0x5a')))),_0x5933('0x5b')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')](_0x5933('0x55')))),_0x5933('0x56')]]})[_0x5933('0x3d')](handleEntityNotFound(_0x67a14a,null))[_0x5933('0x3d')](respondWithResult(_0x67a14a,null))['catch'](handleError(_0x67a14a,null));};exports[_0x5933('0x5c')]=function(_0x1a2f2b,_0x332aaa,_0x5f02cd){return db['VoiceQueue'][_0x5933('0x5d')]({'where':{'id':_0x1a2f2b[_0x5933('0x46')]['id']}})[_0x5933('0x3d')](handleEntityNotFound(_0x332aaa,null))[_0x5933('0x3d')](function(_0x14532e){var _0x3abf1e;if(_0x14532e){_0x3abf1e=squel[_0x5933('0x5e')]()['into'](_0x5933('0x5f'))[_0x5933('0x60')](['phone',_0x5933('0x61'),_0x5933('0x62'),_0x5933('0x63'),_0x5933('0x64'),_0x5933('0x65'),_0x5933('0x66')],squel[_0x5933('0x67')]()[_0x5933('0x68')](_0x5933('0x69'),'phone')['field']('NOW()','scheduledAt')[_0x5933('0x68')](_0x5933('0x6a'),'ContactId')['field'](_0x5933('0x6b'),'ListId')[_0x5933('0x68')](_0x5933('0x6c'),_0x5933('0x64'))['field'](_0x5933('0x6d'),'createdAt')[_0x5933('0x68')](_0x5933('0x6d'),'updatedAt')[_0x5933('0x6e')](_0x5933('0x6f'))[_0x5933('0x36')](_0x5933('0x70'),_0x1a2f2b['params']['id'][_0x5933('0x71')]())[_0x5933('0x36')]('state\x20=\x20?',_0x1a2f2b[_0x5933('0x44')][_0x5933('0x72')]['toString']())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x5933('0x36')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5933('0x67')]()['field'](_0x5933('0x73'))[_0x5933('0x6e')](_0x5933('0x5f'))[_0x5933('0x36')]('VoiceQueueId\x20=\x20?',_0x1a2f2b[_0x5933('0x46')]['id'][_0x5933('0x71')]()))[_0x5933('0x36')](_0x5933('0x74'),squel[_0x5933('0x67')]()[_0x5933('0x68')]('calleridnum')[_0x5933('0x6e')]('cm_hopper_final')[_0x5933('0x36')](_0x5933('0x70'),_0x1a2f2b[_0x5933('0x46')]['id'][_0x5933('0x71')]())[_0x5933('0x36')](_0x5933('0x75')))['group'](_0x5933('0x62')))[_0x5933('0x71')]();return db[_0x5933('0x49')][_0x5933('0x30')](_0x3abf1e);}return[];})[_0x5933('0x3d')](respondWithResult(_0x332aaa,null))[_0x5933('0x40')](handleError(_0x332aaa,null));};exports[_0x5933('0x76')]=function(_0x1a8df9,_0x119ee8,_0x242b61){return db[_0x5933('0x77')][_0x5933('0x5d')]({'where':{'id':_0x1a8df9[_0x5933('0x46')]['id']}})[_0x5933('0x3d')](handleEntityNotFound(_0x119ee8,null))[_0x5933('0x3d')](function(_0x2419d7){var _0x22d503;if(_0x2419d7){_0x22d503=squel[_0x5933('0x5e')]()[_0x5933('0x78')]('cm_hopper')['fromQuery']([_0x5933('0x73'),_0x5933('0x61'),_0x5933('0x62'),_0x5933('0x63'),_0x5933('0x79'),_0x5933('0x65'),_0x5933('0x66')],squel[_0x5933('0x67')]()['field']('ANY_VALUE(calleridnum)','phone')['field'](_0x5933('0x6d'),_0x5933('0x61'))[_0x5933('0x68')](_0x5933('0x6a'),_0x5933('0x62'))[_0x5933('0x68')](_0x5933('0x6b'),_0x5933('0x63'))[_0x5933('0x68')](_0x5933('0x7a'),_0x5933('0x79'))[_0x5933('0x68')]('NOW()','createdAt')['field'](_0x5933('0x6d'),_0x5933('0x66'))[_0x5933('0x6e')](_0x5933('0x6f'))['where'](_0x5933('0x7b'),_0x1a8df9[_0x5933('0x46')]['id'][_0x5933('0x71')]())[_0x5933('0x36')](_0x5933('0x7c'),_0x1a8df9[_0x5933('0x44')][_0x5933('0x72')][_0x5933('0x71')]())[_0x5933('0x36')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x5933('0x36')](_0x5933('0x74'),squel[_0x5933('0x67')]()[_0x5933('0x68')](_0x5933('0x73'))[_0x5933('0x6e')]('cm_hopper')[_0x5933('0x36')]('CampaignId\x20=\x20?',_0x1a8df9[_0x5933('0x46')]['id'][_0x5933('0x71')]()))['where'](_0x5933('0x74'),squel[_0x5933('0x67')]()[_0x5933('0x68')]('calleridnum')['from'](_0x5933('0x6f'))[_0x5933('0x36')](_0x5933('0x7b'),_0x1a8df9['params']['id'][_0x5933('0x71')]())['where']('state\x20=\x204'))[_0x5933('0x7d')](_0x5933('0x62')))[_0x5933('0x71')]();return db[_0x5933('0x49')][_0x5933('0x30')](_0x22d503);}return[];})[_0x5933('0x3d')](respondWithResult(_0x119ee8,null))['catch'](handleError(_0x119ee8,null));};exports[_0x5933('0x7e')]=function(_0x3f00cd,_0xc4ea87,_0x168ef7){return db[_0x5933('0x7f')][_0x5933('0x80')]({'where':{'VoiceQueueId':_0x3f00cd[_0x5933('0x44')][_0x5933('0x64')],'CampaignId':_0x3f00cd['body'][_0x5933('0x79')],'ContactId':_0x3f00cd['body'][_0x5933('0x62')]}})[_0x5933('0x3d')](handleEntityNotFound(_0xc4ea87,null))[_0x5933('0x3d')](function(_0xf7c625){if(_0xf7c625){return _0xf7c625;}return null;})[_0x5933('0x3d')](respondWithResult(_0xc4ea87,null))[_0x5933('0x40')](handleError(_0xc4ea87,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 8fbfcbb..dc7025a 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 _0x689f=['exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x689f,0x17e));var _0xf689=function(_0x548f92,_0x6940df){_0x548f92=_0x548f92-0x0;var _0x4a7089=_0x689f[_0x548f92];return _0x4a7089;};'use strict';var _=require(_0xf689('0x0'));var util=require('util');var logger=require(_0xf689('0x1'))(_0xf689('0x2'));var moment=require(_0xf689('0x3'));var BPromise=require('bluebird');var rp=require(_0xf689('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf689('0x5'));var config=require(_0xf689('0x6'));var attributes=require(_0xf689('0x7'));module[_0xf689('0x8')]=function(_0x529d81,_0x49ac73){return _0x529d81[_0xf689('0x9')]('CmHopperFinal',attributes,{'tableName':_0xf689('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xf689('0xb')]},{'name':_0xf689('0xc'),'fields':[_0xf689('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1df2=['calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','define'];(function(_0x4569b0,_0x36617d){var _0x5d4b75=function(_0x5f1a94){while(--_0x5f1a94){_0x4569b0['push'](_0x4569b0['shift']());}};_0x5d4b75(++_0x36617d);}(_0x1df2,0x77));var _0x21df=function(_0x797987,_0x456665){_0x797987=_0x797987-0x0;var _0x4bf3bf=_0x1df2[_0x797987];return _0x4bf3bf;};'use strict';var _=require(_0x21df('0x0'));var util=require(_0x21df('0x1'));var logger=require(_0x21df('0x2'))(_0x21df('0x3'));var moment=require(_0x21df('0x4'));var BPromise=require(_0x21df('0x5'));var rp=require(_0x21df('0x6'));var fs=require('fs');var path=require(_0x21df('0x7'));var rimraf=require('rimraf');var config=require(_0x21df('0x8'));var attributes=require(_0x21df('0x9'));module['exports']=function(_0x150c87,_0x132ce5){return _0x150c87[_0x21df('0xa')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x21df('0xb'),'fields':[_0x21df('0xb')]},{'name':_0x21df('0xc'),'fields':[_0x21df('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8bd0aea..cd02820 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 _0x4e1d=['../../config/environment','jayson/promise','client','http','request','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CmHopperFinal','create','body','options','raw','then','CreateCmHopperFinal','lodash','util','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4e1d,0x86));var _0xd4e1=function(_0x230122,_0x314475){_0x230122=_0x230122-0x0;var _0x130b7c=_0x4e1d[_0x230122];return _0x130b7c;};'use strict';var _=require(_0xd4e1('0x0'));var util=require(_0xd4e1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd4e1('0x2'));var fs=require('fs');var Redis=require(_0xd4e1('0x3'));var db=require(_0xd4e1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd4e1('0x5'));var config=require(_0xd4e1('0x6'));var jayson=require(_0xd4e1('0x7'));var client=jayson[_0xd4e1('0x8')][_0xd4e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f79f8,_0x3ae7a3,_0xe0e2a8){return new BPromise(function(_0x5c695f,_0xd3230f){return client[_0xd4e1('0xa')](_0x1f79f8,_0xe0e2a8)['then'](function(_0x414c76){logger['info'](_0xd4e1('0xb'),_0x3ae7a3,_0xd4e1('0xc'));logger[_0xd4e1('0xd')](_0xd4e1('0xe'),_0x3ae7a3,'request\x20sent',JSON[_0xd4e1('0xf')](_0x414c76));if(_0x414c76['error']){if(_0x414c76[_0xd4e1('0x10')][_0xd4e1('0x11')]===0x1f4){logger[_0xd4e1('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x3ae7a3,_0x414c76[_0xd4e1('0x10')][_0xd4e1('0x12')]);return _0xd3230f(_0x414c76[_0xd4e1('0x10')]['message']);}logger['error'](_0xd4e1('0xb'),_0x3ae7a3,_0x414c76[_0xd4e1('0x10')][_0xd4e1('0x12')]);return _0x5c695f(_0x414c76[_0xd4e1('0x10')]['message']);}else{logger[_0xd4e1('0x13')]('CmHopperFinal,\x20%s,\x20%s',_0x3ae7a3,_0xd4e1('0xc'));_0x5c695f(_0x414c76[_0xd4e1('0x14')][_0xd4e1('0x12')]);}})['catch'](function(_0x3ba2b3){logger[_0xd4e1('0x10')](_0xd4e1('0xb'),_0x3ae7a3,_0x3ba2b3);_0xd3230f(_0x3ba2b3);});});}exports['CreateCmHopperFinal']=function(_0x299db8){var _0x50e204=this;return new Promise(function(_0x19eb0a,_0x1fa4a5){return db[_0xd4e1('0x15')][_0xd4e1('0x16')](_0x299db8[_0xd4e1('0x17')],{'raw':_0x299db8[_0xd4e1('0x18')]?_0x299db8[_0xd4e1('0x18')][_0xd4e1('0x19')]===undefined?!![]:![]:!![]})[_0xd4e1('0x1a')](function(_0x3615da){logger[_0xd4e1('0x13')](_0xd4e1('0x1b'),_0x299db8);logger[_0xd4e1('0xd')](_0xd4e1('0x1b'),_0x299db8,JSON[_0xd4e1('0xf')](_0x3615da));_0x19eb0a(_0x3615da);})['catch'](function(_0xdf0502){logger[_0xd4e1('0x10')](_0xd4e1('0x1b'),_0xdf0502[_0xd4e1('0x12')],_0x299db8);_0x1fa4a5(_0x50e204[_0xd4e1('0x10')](0x1f4,_0xdf0502['message']));});});}; \ No newline at end of file +var _0x5f5b=['result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x22d6e9,_0xb9e9cd){var _0x43d279=function(_0x42f569){while(--_0x42f569){_0x22d6e9['push'](_0x22d6e9['shift']());}};_0x43d279(++_0xb9e9cd);}(_0x5f5b,0x10c));var _0xb5f5=function(_0x3a05be,_0x4f912d){_0x3a05be=_0x3a05be-0x0;var _0x22f440=_0x5f5b[_0x3a05be];return _0x22f440;};'use strict';var _=require(_0xb5f5('0x0'));var util=require(_0xb5f5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb5f5('0x2'));var fs=require('fs');var Redis=require(_0xb5f5('0x3'));var db=require(_0xb5f5('0x4'))['db'];var utils=require(_0xb5f5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb5f5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb5f5('0x7')][_0xb5f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x592b11,_0x46bd7e,_0x5b8183){return new BPromise(function(_0x124dc9,_0x4b1caa){return client[_0xb5f5('0x9')](_0x592b11,_0x5b8183)['then'](function(_0x86919b){logger[_0xb5f5('0xa')](_0xb5f5('0xb'),_0x46bd7e,_0xb5f5('0xc'));logger[_0xb5f5('0xd')](_0xb5f5('0xe'),_0x46bd7e,_0xb5f5('0xc'),JSON['stringify'](_0x86919b));if(_0x86919b[_0xb5f5('0xf')]){if(_0x86919b[_0xb5f5('0xf')][_0xb5f5('0x10')]===0x1f4){logger[_0xb5f5('0xf')](_0xb5f5('0xb'),_0x46bd7e,_0x86919b[_0xb5f5('0xf')][_0xb5f5('0x11')]);return _0x4b1caa(_0x86919b['error'][_0xb5f5('0x11')]);}logger[_0xb5f5('0xf')](_0xb5f5('0xb'),_0x46bd7e,_0x86919b['error']['message']);return _0x124dc9(_0x86919b[_0xb5f5('0xf')]['message']);}else{logger[_0xb5f5('0xa')](_0xb5f5('0xb'),_0x46bd7e,_0xb5f5('0xc'));_0x124dc9(_0x86919b[_0xb5f5('0x12')][_0xb5f5('0x11')]);}})[_0xb5f5('0x13')](function(_0xdaa4d9){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x46bd7e,_0xdaa4d9);_0x4b1caa(_0xdaa4d9);});});}exports[_0xb5f5('0x14')]=function(_0x1e0d48){var _0x4c75ba=this;return new Promise(function(_0xebe293,_0x5d9d6d){return db[_0xb5f5('0x15')][_0xb5f5('0x16')](_0x1e0d48[_0xb5f5('0x17')],{'raw':_0x1e0d48[_0xb5f5('0x18')]?_0x1e0d48['options'][_0xb5f5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x41058b){logger[_0xb5f5('0xa')](_0xb5f5('0x14'),_0x1e0d48);logger[_0xb5f5('0xd')](_0xb5f5('0x14'),_0x1e0d48,JSON['stringify'](_0x41058b));_0xebe293(_0x41058b);})[_0xb5f5('0x13')](function(_0x5a0fe6){logger['error'](_0xb5f5('0x14'),_0x5a0fe6['message'],_0x1e0d48);_0x5d9d6d(_0x4c75ba[_0xb5f5('0xf')](0x1f4,_0x5a0fe6[_0xb5f5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index bf423d6..75e47d4 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 _0x8806=['update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','put'];(function(_0x16a692,_0x34d32b){var _0x3648b8=function(_0x2b1a74){while(--_0x2b1a74){_0x16a692['push'](_0x16a692['shift']());}};_0x3648b8(++_0x34d32b);}(_0x8806,0x92));var _0x6880=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x8806[_0x7e2eb0];return _0xd92de4;};'use strict';var multer=require(_0x6880('0x0'));var util=require(_0x6880('0x1'));var path=require('path');var timeout=require(_0x6880('0x2'));var express=require(_0x6880('0x3'));var router=express[_0x6880('0x4')]();var auth=require(_0x6880('0x5'));var interaction=require(_0x6880('0x6'));var config=require(_0x6880('0x7'));var controller=require(_0x6880('0x8'));router[_0x6880('0x9')]('/',auth[_0x6880('0xa')](),controller['index']);router['get']('/describe',auth[_0x6880('0xa')](),controller[_0x6880('0xb')]);router['get']('/:id',auth[_0x6880('0xa')](),controller[_0x6880('0xc')]);router[_0x6880('0x9')](_0x6880('0xd'),auth[_0x6880('0xa')](),controller[_0x6880('0xe')]);router[_0x6880('0x9')](_0x6880('0xf'),auth[_0x6880('0xa')](),controller[_0x6880('0x10')]);router[_0x6880('0x11')](_0x6880('0x12'),auth[_0x6880('0xa')](),controller[_0x6880('0x13')]);router[_0x6880('0x11')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x6880('0x14'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x6880('0x15')]('/:id',auth[_0x6880('0xa')](),controller[_0x6880('0x16')]);module[_0x6880('0x17')]=router; \ No newline at end of file +var _0x4cde=['/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id'];(function(_0x590838,_0x1bc41f){var _0x3c006b=function(_0x5889fc){while(--_0x5889fc){_0x590838['push'](_0x590838['shift']());}};_0x3c006b(++_0x1bc41f);}(_0x4cde,0x15c));var _0xe4cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4cde[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe4cd('0x0'));var util=require('util');var path=require(_0xe4cd('0x1'));var timeout=require(_0xe4cd('0x2'));var express=require(_0xe4cd('0x3'));var router=express[_0xe4cd('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe4cd('0x5'));var config=require(_0xe4cd('0x6'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0xe4cd('0x7')](),controller[_0xe4cd('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe4cd('0x9')]);router[_0xe4cd('0xa')](_0xe4cd('0xb'),auth[_0xe4cd('0x7')](),controller['show']);router[_0xe4cd('0xa')](_0xe4cd('0xc'),auth[_0xe4cd('0x7')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xe4cd('0xd'),auth[_0xe4cd('0x7')](),controller[_0xe4cd('0xe')]);router['post'](_0xe4cd('0xf'),auth[_0xe4cd('0x7')](),controller[_0xe4cd('0x10')]);router[_0xe4cd('0x11')](_0xe4cd('0x12'),auth[_0xe4cd('0x7')](),controller[_0xe4cd('0x13')]);router[_0xe4cd('0x11')]('/checkContactHopper',auth[_0xe4cd('0x7')](),controller[_0xe4cd('0x14')]);router[_0xe4cd('0x15')](_0xe4cd('0xb'),auth['isAuthenticated'](),controller[_0xe4cd('0x16')]);module[_0xe4cd('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 96addd6..0525daf 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 _0x62f1=['BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x260280,_0x10185c){var _0x1cd29b=function(_0x57cf52){while(--_0x57cf52){_0x260280['push'](_0x260280['shift']());}};_0x1cd29b(++_0x10185c);}(_0x62f1,0x141));var _0x162f=function(_0x3ce76a,_0x465d60){_0x3ce76a=_0x3ce76a-0x0;var _0x3b3bef=_0x62f1[_0x3ce76a];return _0x3b3bef;};'use strict';var Sequelize=require(_0x162f('0x0'));module['exports']={'state':{'type':Sequelize[_0x162f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x162f('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x162f('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x162f('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x162f('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x162f('0x2')]},'calleridname':{'type':Sequelize[_0x162f('0x2')]},'starttime':{'type':Sequelize[_0x162f('0x3')]},'responsetime':{'type':Sequelize[_0x162f('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x162f('0x3')]},'endtime':{'type':Sequelize[_0x162f('0x3')]},'ringtime':{'type':Sequelize[_0x162f('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x162f('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x162f('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x162f('0x2')]},'campaign':{'type':Sequelize[_0x162f('0x2')]},'campaigntype':{'type':Sequelize[_0x162f('0x2')]},'membername':{'type':Sequelize[_0x162f('0x2')]},'reason':{'type':Sequelize[_0x162f('0x2')]},'amd':{'type':Sequelize[_0x162f('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x162f('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x162f('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x162f('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x162f('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x162f('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x162f('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x162f('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6058=['DATE','STRING','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x364450,_0xd81db8){var _0x3d9c5e=function(_0x447374){while(--_0x447374){_0x364450['push'](_0x364450['shift']());}};_0x3d9c5e(++_0xd81db8);}(_0x6058,0x123));var _0x8605=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0x6058[_0x24b477];return _0x4041a6;};'use strict';var Sequelize=require(_0x8605('0x0'));module[_0x8605('0x1')]={'state':{'type':Sequelize[_0x8605('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8605('0x3')]},'countbusyretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8605('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x8605('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8605('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8605('0x3')]},'responsetime':{'type':Sequelize[_0x8605('0x3')]},'answertime':{'type':Sequelize[_0x8605('0x3')]},'droptime':{'type':Sequelize[_0x8605('0x3')]},'endtime':{'type':Sequelize[_0x8605('0x3')]},'ringtime':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x8605('0x4')]},'campaigntype':{'type':Sequelize[_0x8605('0x4')]},'membername':{'type':Sequelize[_0x8605('0x4')]},'reason':{'type':Sequelize[_0x8605('0x4')]},'amd':{'type':Sequelize[_0x8605('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8605('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8605('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8605('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8605('0x3')]},'edited':{'type':Sequelize[_0x8605('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8605('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 1a2ffd8..3613183 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 _0xdf56=['Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','map','CmHopperHistory','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','count','then','includeAll','include','findAll','rows','catch','params','rawAttributes','length','options','find','body','describe','uniqueid','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','end','status','offset','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf56,0x74));var _0x6df5=function(_0x11bd88,_0x1909d2){_0x11bd88=_0x11bd88-0x0;var _0x2efe6b=_0xdf56[_0x11bd88];return _0x2efe6b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6df5('0x0'));var rp=require(_0x6df5('0x1'));var moment=require(_0x6df5('0x2'));var BPromise=require(_0x6df5('0x3'));var Mustache=require(_0x6df5('0x4'));var util=require(_0x6df5('0x5'));var path=require('path');var sox=require(_0x6df5('0x6'));var csv=require(_0x6df5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6df5('0x8'));var squel=require('squel');var crypto=require(_0x6df5('0x9'));var jsforce=require(_0x6df5('0xa'));var deskjs=require(_0x6df5('0xb'));var toCsv=require(_0x6df5('0x7'));var querystring=require('querystring');var Papa=require(_0x6df5('0xc'));var Redis=require('ioredis');var authService=require(_0x6df5('0xd'));var qs=require(_0x6df5('0xe'));var as=require(_0x6df5('0xf'));var hardwareService=require(_0x6df5('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6df5('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22d162,_0x2951c0){_0x2951c0=_0x2951c0||0xcc;return function(_0x1d3fd8){if(_0x1d3fd8){return _0x22d162['sendStatus'](_0x2951c0);}return _0x22d162['status'](_0x2951c0)[_0x6df5('0x12')]();};}function respondWithResult(_0x4797cf,_0x5dfe44){_0x5dfe44=_0x5dfe44||0xc8;return function(_0x4a2f35){if(_0x4a2f35){return _0x4797cf[_0x6df5('0x13')](_0x5dfe44)['json'](_0x4a2f35);}};}function respondWithFilteredResult(_0x139f75,_0x4f590d){return function(_0x2f6cdb){if(_0x2f6cdb){var _0x22c0ec=_0x2f6cdb['count'],_0x413c22=_0x4f590d[_0x6df5('0x14')],_0x4c0575=_0x4f590d[_0x6df5('0x14')]+_0x4f590d['limit'],_0x3d543b;if(_0x4c0575>=_0x22c0ec){_0x4c0575=_0x22c0ec;_0x3d543b=0xc8;}else{_0x3d543b=0xce;}_0x139f75[_0x6df5('0x13')](_0x3d543b);return _0x139f75[_0x6df5('0x15')](_0x6df5('0x16'),_0x413c22+'-'+_0x4c0575+'/'+_0x22c0ec)['json'](_0x2f6cdb);}return null;};}function patchUpdates(_0x3a7d57){return function(_0x43f993){try{jsonpatch[_0x6df5('0x17')](_0x43f993,_0x3a7d57,!![]);}catch(_0x2eb824){return BPromise[_0x6df5('0x18')](_0x2eb824);}return _0x43f993[_0x6df5('0x19')]();};}function saveUpdates(_0x774768,_0x4dfe11){return function(_0x51c3da){if(_0x51c3da){return _0x51c3da[_0x6df5('0x1a')](_0x774768)['then'](function(_0x56e640){return _0x56e640;});}return null;};}function removeEntity(_0x7fd72,_0x7f91ec){return function(_0x4cac66){if(_0x4cac66){return _0x4cac66[_0x6df5('0x1b')]()['then'](function(){_0x7fd72[_0x6df5('0x13')](0xcc)[_0x6df5('0x12')]();});}};}function handleEntityNotFound(_0xf4cfb7,_0x1ab99d){return function(_0x4e2cb3){if(!_0x4e2cb3){_0xf4cfb7[_0x6df5('0x1c')](0x194);}return _0x4e2cb3;};}function handleError(_0x294e6b,_0x464d7f){_0x464d7f=_0x464d7f||0x1f4;return function(_0x541602){logger[_0x6df5('0x1d')](_0x541602[_0x6df5('0x1e')]);if(_0x541602[_0x6df5('0x1f')]){delete _0x541602[_0x6df5('0x1f')];}_0x294e6b[_0x6df5('0x13')](_0x464d7f)[_0x6df5('0x20')](_0x541602);};}exports['index']=function(_0x239952,_0x759848){var _0x197149={},_0x4370bf={},_0x25234f={'count':0x0,'rows':[]};var _0x1db810=_[_0x6df5('0x21')](db[_0x6df5('0x22')]['rawAttributes'],function(_0x43ea7f){return{'name':_0x43ea7f[_0x6df5('0x23')],'type':_0x43ea7f[_0x6df5('0x24')][_0x6df5('0x25')]};});_0x4370bf['model']=_[_0x6df5('0x21')](_0x1db810,_0x6df5('0x1f'));_0x4370bf[_0x6df5('0x26')]=_[_0x6df5('0x27')](_0x239952[_0x6df5('0x26')]);_0x4370bf[_0x6df5('0x28')]=_[_0x6df5('0x29')](_0x4370bf[_0x6df5('0x2a')],_0x4370bf[_0x6df5('0x26')]);_0x197149[_0x6df5('0x2b')]=_[_0x6df5('0x29')](_0x4370bf[_0x6df5('0x2a')],qs[_0x6df5('0x2c')](_0x239952['query'][_0x6df5('0x2c')]));_0x197149['attributes']=_0x197149[_0x6df5('0x2b')]['length']?_0x197149[_0x6df5('0x2b')]:_0x4370bf['model'];if(!_0x239952[_0x6df5('0x26')][_0x6df5('0x2d')](_0x6df5('0x2e'))){_0x197149[_0x6df5('0x2f')]=qs[_0x6df5('0x2f')](_0x239952[_0x6df5('0x26')][_0x6df5('0x2f')]);_0x197149[_0x6df5('0x14')]=qs[_0x6df5('0x14')](_0x239952['query'][_0x6df5('0x14')]);}_0x197149[_0x6df5('0x30')]=qs[_0x6df5('0x31')](_0x239952['query']['sort']);_0x197149[_0x6df5('0x32')]=qs[_0x6df5('0x28')](_['pick'](_0x239952[_0x6df5('0x26')],_0x4370bf['filters']),_0x1db810);if(_0x239952['query'][_0x6df5('0x33')]){_0x197149[_0x6df5('0x32')]=_[_0x6df5('0x34')](_0x197149[_0x6df5('0x32')],{'$or':_[_0x6df5('0x21')](_0x1db810,function(_0x35bb78){if(_0x35bb78[_0x6df5('0x24')]!==_0x6df5('0x35')){var _0x2c70a1={};_0x2c70a1[_0x35bb78[_0x6df5('0x1f')]]={'$like':'%'+_0x239952['query']['filter']+'%'};return _0x2c70a1;}})});}_0x197149=_[_0x6df5('0x34')]({},_0x197149,_0x239952['options']);var _0xe5d2a2={'where':_0x197149[_0x6df5('0x32')]};return db[_0x6df5('0x22')][_0x6df5('0x36')](_0xe5d2a2)[_0x6df5('0x37')](function(_0x1c9892){_0x25234f[_0x6df5('0x36')]=_0x1c9892;if(_0x239952[_0x6df5('0x26')][_0x6df5('0x38')]){_0x197149[_0x6df5('0x39')]=[{'all':!![]}];}return db[_0x6df5('0x22')][_0x6df5('0x3a')](_0x197149);})['then'](function(_0x41b1a6){_0x25234f[_0x6df5('0x3b')]=_0x41b1a6;return _0x25234f;})[_0x6df5('0x37')](respondWithFilteredResult(_0x759848,_0x197149))[_0x6df5('0x3c')](handleError(_0x759848,null));};exports['show']=function(_0x447919,_0x3f9f35){var _0x3a47c7={'raw':!![],'where':{'id':_0x447919[_0x6df5('0x3d')]['id']}},_0xcac1b0={};_0xcac1b0['model']=_[_0x6df5('0x27')](db[_0x6df5('0x22')][_0x6df5('0x3e')]);_0xcac1b0[_0x6df5('0x26')]=_['keys'](_0x447919['query']);_0xcac1b0[_0x6df5('0x28')]=_[_0x6df5('0x29')](_0xcac1b0[_0x6df5('0x2a')],_0xcac1b0['query']);_0x3a47c7['attributes']=_[_0x6df5('0x29')](_0xcac1b0[_0x6df5('0x2a')],qs[_0x6df5('0x2c')](_0x447919[_0x6df5('0x26')][_0x6df5('0x2c')]));_0x3a47c7['attributes']=_0x3a47c7[_0x6df5('0x2b')][_0x6df5('0x3f')]?_0x3a47c7[_0x6df5('0x2b')]:_0xcac1b0[_0x6df5('0x2a')];if(_0x447919['query'][_0x6df5('0x38')]){_0x3a47c7[_0x6df5('0x39')]=[{'all':!![]}];}_0x3a47c7=_[_0x6df5('0x34')]({},_0x3a47c7,_0x447919[_0x6df5('0x40')]);return db['CmHopperHistory'][_0x6df5('0x41')](_0x3a47c7)[_0x6df5('0x37')](handleEntityNotFound(_0x3f9f35,null))[_0x6df5('0x37')](respondWithResult(_0x3f9f35,null))[_0x6df5('0x3c')](handleError(_0x3f9f35,null));};exports['create']=function(_0x38dc56,_0x34eadf){return db[_0x6df5('0x22')]['create'](_0x38dc56[_0x6df5('0x42')],{})[_0x6df5('0x37')](respondWithResult(_0x34eadf,0xc9))[_0x6df5('0x3c')](handleError(_0x34eadf,null));};exports[_0x6df5('0x43')]=function(_0x9b88f,_0x31862e){return db[_0x6df5('0x22')]['describe']()['then'](respondWithResult(_0x31862e,null))[_0x6df5('0x3c')](handleError(_0x31862e,null));};exports[_0x6df5('0x1a')]=function(_0x353376,_0x3e9304){if(_0x353376[_0x6df5('0x42')][_0x6df5('0x44')]){delete _0x353376['body'][_0x6df5('0x44')];}return db[_0x6df5('0x22')][_0x6df5('0x41')]({'where':{'uniqueid':_0x353376[_0x6df5('0x3d')]['id']}})[_0x6df5('0x37')](handleEntityNotFound(_0x3e9304,null))['then'](saveUpdates(_0x353376['body'],null))[_0x6df5('0x37')](respondWithResult(_0x3e9304,null))[_0x6df5('0x3c')](handleError(_0x3e9304,null));}; \ No newline at end of file +var _0xe323=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','destroy','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','merge','VIRTUAL','count','then','findAll','rows','catch','show','params','include','find','create','describe','uniqueid','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0xe323,0xd2));var _0x3e32=function(_0x55c40e,_0x44cad8){_0x55c40e=_0x55c40e-0x0;var _0x75171b=_0xe323[_0x55c40e];return _0x75171b;};'use strict';var pdf=require(_0x3e32('0x0'));var emlformat=require(_0x3e32('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3e32('0x2'));var jsonpatch=require(_0x3e32('0x3'));var rp=require(_0x3e32('0x4'));var moment=require(_0x3e32('0x5'));var BPromise=require(_0x3e32('0x6'));var Mustache=require(_0x3e32('0x7'));var util=require(_0x3e32('0x8'));var path=require(_0x3e32('0x9'));var sox=require(_0x3e32('0xa'));var csv=require(_0x3e32('0xb'));var ejs=require(_0x3e32('0xc'));var fs=require('fs');var _=require(_0x3e32('0xd'));var squel=require(_0x3e32('0xe'));var crypto=require(_0x3e32('0xf'));var jsforce=require(_0x3e32('0x10'));var deskjs=require(_0x3e32('0x11'));var toCsv=require(_0x3e32('0xb'));var querystring=require(_0x3e32('0x12'));var Papa=require(_0x3e32('0x13'));var Redis=require(_0x3e32('0x14'));var authService=require(_0x3e32('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e32('0x16'));var logger=require(_0x3e32('0x17'))(_0x3e32('0x18'));var utils=require('../../config/utils');var config=require(_0x3e32('0x19'));var licenseUtil=require(_0x3e32('0x1a'));var db=require(_0x3e32('0x1b'))['db'];function respondWithStatusCode(_0x12e87e,_0x364a83){_0x364a83=_0x364a83||0xcc;return function(_0x17b2f9){if(_0x17b2f9){return _0x12e87e[_0x3e32('0x1c')](_0x364a83);}return _0x12e87e[_0x3e32('0x1d')](_0x364a83)[_0x3e32('0x1e')]();};}function respondWithResult(_0x565b3e,_0x1916fa){_0x1916fa=_0x1916fa||0xc8;return function(_0x201f78){if(_0x201f78){return _0x565b3e[_0x3e32('0x1d')](_0x1916fa)[_0x3e32('0x1f')](_0x201f78);}};}function respondWithFilteredResult(_0x138fc0,_0x3651b0){return function(_0x4a695f){if(_0x4a695f){var _0x4c985b=_0x4a695f['count'],_0x3ec854=_0x3651b0[_0x3e32('0x20')],_0x3069e3=_0x3651b0[_0x3e32('0x20')]+_0x3651b0['limit'],_0xe3582e;if(_0x3069e3>=_0x4c985b){_0x3069e3=_0x4c985b;_0xe3582e=0xc8;}else{_0xe3582e=0xce;}_0x138fc0[_0x3e32('0x1d')](_0xe3582e);return _0x138fc0[_0x3e32('0x21')](_0x3e32('0x22'),_0x3ec854+'-'+_0x3069e3+'/'+_0x4c985b)[_0x3e32('0x1f')](_0x4a695f);}return null;};}function patchUpdates(_0x5b7bd4){return function(_0x3f29ea){try{jsonpatch[_0x3e32('0x23')](_0x3f29ea,_0x5b7bd4,!![]);}catch(_0x99ec4){return BPromise[_0x3e32('0x24')](_0x99ec4);}return _0x3f29ea['save']();};}function saveUpdates(_0x14354b,_0x51ff47){return function(_0x7fd378){if(_0x7fd378){return _0x7fd378[_0x3e32('0x25')](_0x14354b)['then'](function(_0x3e1e7c){return _0x3e1e7c;});}return null;};}function removeEntity(_0x3ab655,_0x4a0621){return function(_0x2c90f1){if(_0x2c90f1){return _0x2c90f1[_0x3e32('0x26')]()['then'](function(){_0x3ab655['status'](0xcc)[_0x3e32('0x1e')]();});}};}function handleEntityNotFound(_0x2ea3c5,_0x168a64){return function(_0x1a377b){if(!_0x1a377b){_0x2ea3c5[_0x3e32('0x1c')](0x194);}return _0x1a377b;};}function handleError(_0x589da7,_0x5e5eec){_0x5e5eec=_0x5e5eec||0x1f4;return function(_0x2ac658){logger['error'](_0x2ac658[_0x3e32('0x27')]);if(_0x2ac658['name']){delete _0x2ac658[_0x3e32('0x28')];}_0x589da7[_0x3e32('0x1d')](_0x5e5eec)['send'](_0x2ac658);};}exports[_0x3e32('0x29')]=function(_0x1f14bd,_0x4ee117){var _0x31424a={},_0x401562={},_0x18c0ca={'count':0x0,'rows':[]};var _0x5b7698=_[_0x3e32('0x2a')](db[_0x3e32('0x2b')][_0x3e32('0x2c')],function(_0x90c987){return{'name':_0x90c987[_0x3e32('0x2d')],'type':_0x90c987[_0x3e32('0x2e')][_0x3e32('0x2f')]};});_0x401562[_0x3e32('0x30')]=_[_0x3e32('0x2a')](_0x5b7698,_0x3e32('0x28'));_0x401562[_0x3e32('0x31')]=_[_0x3e32('0x32')](_0x1f14bd[_0x3e32('0x31')]);_0x401562[_0x3e32('0x33')]=_[_0x3e32('0x34')](_0x401562[_0x3e32('0x30')],_0x401562[_0x3e32('0x31')]);_0x31424a[_0x3e32('0x35')]=_[_0x3e32('0x34')](_0x401562[_0x3e32('0x30')],qs[_0x3e32('0x36')](_0x1f14bd['query'][_0x3e32('0x36')]));_0x31424a['attributes']=_0x31424a['attributes'][_0x3e32('0x37')]?_0x31424a[_0x3e32('0x35')]:_0x401562['model'];if(!_0x1f14bd[_0x3e32('0x31')]['hasOwnProperty'](_0x3e32('0x38'))){_0x31424a[_0x3e32('0x39')]=qs['limit'](_0x1f14bd[_0x3e32('0x31')][_0x3e32('0x39')]);_0x31424a['offset']=qs[_0x3e32('0x20')](_0x1f14bd[_0x3e32('0x31')][_0x3e32('0x20')]);}_0x31424a[_0x3e32('0x3a')]=qs[_0x3e32('0x3b')](_0x1f14bd[_0x3e32('0x31')][_0x3e32('0x3b')]);_0x31424a[_0x3e32('0x3c')]=qs[_0x3e32('0x33')](_['pick'](_0x1f14bd[_0x3e32('0x31')],_0x401562['filters']),_0x5b7698);if(_0x1f14bd[_0x3e32('0x31')]['filter']){_0x31424a[_0x3e32('0x3c')]=_[_0x3e32('0x3d')](_0x31424a[_0x3e32('0x3c')],{'$or':_[_0x3e32('0x2a')](_0x5b7698,function(_0xf96d54){if(_0xf96d54[_0x3e32('0x2e')]!==_0x3e32('0x3e')){var _0x29507b={};_0x29507b[_0xf96d54['name']]={'$like':'%'+_0x1f14bd[_0x3e32('0x31')]['filter']+'%'};return _0x29507b;}})});}_0x31424a=_[_0x3e32('0x3d')]({},_0x31424a,_0x1f14bd['options']);var _0xbd42de={'where':_0x31424a['where']};return db['CmHopperHistory'][_0x3e32('0x3f')](_0xbd42de)[_0x3e32('0x40')](function(_0x5d753f){_0x18c0ca[_0x3e32('0x3f')]=_0x5d753f;if(_0x1f14bd[_0x3e32('0x31')]['includeAll']){_0x31424a['include']=[{'all':!![]}];}return db[_0x3e32('0x2b')][_0x3e32('0x41')](_0x31424a);})[_0x3e32('0x40')](function(_0x1855a3){_0x18c0ca[_0x3e32('0x42')]=_0x1855a3;return _0x18c0ca;})['then'](respondWithFilteredResult(_0x4ee117,_0x31424a))[_0x3e32('0x43')](handleError(_0x4ee117,null));};exports[_0x3e32('0x44')]=function(_0x499571,_0x4022cc){var _0x1f7692={'raw':!![],'where':{'id':_0x499571[_0x3e32('0x45')]['id']}},_0x1a5b2e={};_0x1a5b2e[_0x3e32('0x30')]=_['keys'](db['CmHopperHistory'][_0x3e32('0x2c')]);_0x1a5b2e[_0x3e32('0x31')]=_[_0x3e32('0x32')](_0x499571[_0x3e32('0x31')]);_0x1a5b2e['filters']=_['intersection'](_0x1a5b2e[_0x3e32('0x30')],_0x1a5b2e[_0x3e32('0x31')]);_0x1f7692[_0x3e32('0x35')]=_[_0x3e32('0x34')](_0x1a5b2e[_0x3e32('0x30')],qs[_0x3e32('0x36')](_0x499571[_0x3e32('0x31')][_0x3e32('0x36')]));_0x1f7692[_0x3e32('0x35')]=_0x1f7692['attributes'][_0x3e32('0x37')]?_0x1f7692[_0x3e32('0x35')]:_0x1a5b2e[_0x3e32('0x30')];if(_0x499571[_0x3e32('0x31')]['includeAll']){_0x1f7692[_0x3e32('0x46')]=[{'all':!![]}];}_0x1f7692=_['merge']({},_0x1f7692,_0x499571['options']);return db[_0x3e32('0x2b')][_0x3e32('0x47')](_0x1f7692)[_0x3e32('0x40')](handleEntityNotFound(_0x4022cc,null))[_0x3e32('0x40')](respondWithResult(_0x4022cc,null))[_0x3e32('0x43')](handleError(_0x4022cc,null));};exports[_0x3e32('0x48')]=function(_0x223384,_0x4da9ee){return db['CmHopperHistory'][_0x3e32('0x48')](_0x223384['body'],{})[_0x3e32('0x40')](respondWithResult(_0x4da9ee,0xc9))[_0x3e32('0x43')](handleError(_0x4da9ee,null));};exports[_0x3e32('0x49')]=function(_0x2e5dd1,_0x79e513){return db[_0x3e32('0x2b')][_0x3e32('0x49')]()['then'](respondWithResult(_0x79e513,null))['catch'](handleError(_0x79e513,null));};exports[_0x3e32('0x25')]=function(_0x48e558,_0x51e39a){if(_0x48e558['body'][_0x3e32('0x4a')]){delete _0x48e558['body'][_0x3e32('0x4a')];}return db[_0x3e32('0x2b')][_0x3e32('0x47')]({'where':{'uniqueid':_0x48e558['params']['id']}})[_0x3e32('0x40')](handleEntityNotFound(_0x51e39a,null))[_0x3e32('0x40')](saveUpdates(_0x48e558[_0x3e32('0x4b')],null))[_0x3e32('0x40')](respondWithResult(_0x51e39a,null))[_0x3e32('0x43')](handleError(_0x51e39a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index ef09e51..d435305 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 _0x67eb=['./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x5a12ff,_0x2e18db){var _0x285f8d=function(_0x431de4){while(--_0x431de4){_0x5a12ff['push'](_0x5a12ff['shift']());}};_0x285f8d(++_0x2e18db);}(_0x67eb,0xd2));var _0xb67e=function(_0x2b0fd2,_0x4c7a70){_0x2b0fd2=_0x2b0fd2-0x0;var _0x3015e5=_0x67eb[_0x2b0fd2];return _0x3015e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb67e('0x0'))(_0xb67e('0x1'));var moment=require('moment');var BPromise=require(_0xb67e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb67e('0x3'));var rimraf=require(_0xb67e('0x4'));var config=require(_0xb67e('0x5'));var attributes=require(_0xb67e('0x6'));module[_0xb67e('0x7')]=function(_0x2a605f,_0x47c98f){return _0x2a605f['define'](_0xb67e('0x8'),attributes,{'tableName':_0xb67e('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xb67e('0xa')]},{'name':'uniqueid','fields':[_0xb67e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb106=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb106,0x198));var _0x6b10=function(_0x49a982,_0x129a07){_0x49a982=_0x49a982-0x0;var _0x2a0bc9=_0xb106[_0x49a982];return _0x2a0bc9;};'use strict';var _=require(_0x6b10('0x0'));var util=require(_0x6b10('0x1'));var logger=require(_0x6b10('0x2'))(_0x6b10('0x3'));var moment=require(_0x6b10('0x4'));var BPromise=require('bluebird');var rp=require(_0x6b10('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b10('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0x6b10('0x7')]=function(_0x2e127c,_0x29964d){return _0x2e127c[_0x6b10('0x8')](_0x6b10('0x9'),attributes,{'tableName':_0x6b10('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x6b10('0xb')]},{'name':_0x6b10('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 31ce89c..2c68deb 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 _0x91f3=['CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','stringify','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch'];(function(_0x3666dc,_0x18701a){var _0x31c942=function(_0x315164){while(--_0x315164){_0x3666dc['push'](_0x3666dc['shift']());}};_0x31c942(++_0x18701a);}(_0x91f3,0x71));var _0x391f=function(_0x5cf63f,_0x3ce54f){_0x5cf63f=_0x5cf63f-0x0;var _0x33c478=_0x91f3[_0x5cf63f];return _0x33c478;};'use strict';var _=require(_0x391f('0x0'));var util=require(_0x391f('0x1'));var moment=require('moment');var BPromise=require(_0x391f('0x2'));var rs=require(_0x391f('0x3'));var fs=require('fs');var Redis=require(_0x391f('0x4'));var db=require(_0x391f('0x5'))['db'];var utils=require(_0x391f('0x6'));var logger=require(_0x391f('0x7'))('rpc');var config=require(_0x391f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x391f('0x9')][_0x391f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ab324,_0x103efc,_0x106ad4){return new BPromise(function(_0x3905bb,_0x1957c5){return client[_0x391f('0xb')](_0x1ab324,_0x106ad4)['then'](function(_0x369004){logger[_0x391f('0xc')](_0x391f('0xd'),_0x103efc,'request\x20sent');logger[_0x391f('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x103efc,_0x391f('0xf'),JSON['stringify'](_0x369004));if(_0x369004[_0x391f('0x10')]){if(_0x369004[_0x391f('0x10')][_0x391f('0x11')]===0x1f4){logger[_0x391f('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x103efc,_0x369004[_0x391f('0x10')][_0x391f('0x12')]);return _0x1957c5(_0x369004[_0x391f('0x10')][_0x391f('0x12')]);}logger[_0x391f('0x10')](_0x391f('0xd'),_0x103efc,_0x369004[_0x391f('0x10')][_0x391f('0x12')]);return _0x3905bb(_0x369004[_0x391f('0x10')][_0x391f('0x12')]);}else{logger[_0x391f('0xc')](_0x391f('0xd'),_0x103efc,'request\x20sent');_0x3905bb(_0x369004[_0x391f('0x13')][_0x391f('0x12')]);}})[_0x391f('0x14')](function(_0x51a1d8){logger[_0x391f('0x10')](_0x391f('0xd'),_0x103efc,_0x51a1d8);_0x1957c5(_0x51a1d8);});});}exports[_0x391f('0x15')]=function(_0x224190){var _0x3683fc=this;return new Promise(function(_0x3ae1a1,_0x391283){return db[_0x391f('0x16')][_0x391f('0x17')](_0x224190[_0x391f('0x18')],{'raw':_0x224190[_0x391f('0x19')]?_0x224190[_0x391f('0x19')][_0x391f('0x1a')]===undefined?!![]:![]:!![]})[_0x391f('0x1b')](function(_0x1b8884){logger[_0x391f('0xc')](_0x391f('0x15'),_0x224190);logger[_0x391f('0xe')](_0x391f('0x15'),_0x224190,JSON[_0x391f('0x1c')](_0x1b8884));_0x3ae1a1(_0x1b8884);})[_0x391f('0x14')](function(_0x17b782){logger[_0x391f('0x10')](_0x391f('0x15'),_0x17b782['message'],_0x224190);_0x391283(_0x3683fc[_0x391f('0x10')](0x1f4,_0x17b782['message']));});});};exports['AvgHandleTime']=function(_0x19c6e0){var _0xa218c2=this;return new Promise(function(_0x55631a,_0x1facf4){return db[_0x391f('0x16')][_0x391f('0x1d')]({'raw':_0x19c6e0[_0x391f('0x19')]?_0x19c6e0[_0x391f('0x19')][_0x391f('0x1a')]===undefined?!![]:![]:!![],'where':_0x19c6e0[_0x391f('0x19')]?_0x19c6e0['options'][_0x391f('0x1e')]||null:null,'attributes':[[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db[_0x391f('0x1f')][_0x391f('0x21')]('id')),_0x391f('0x22')],[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db['sequelize']['fn']('IF',db[_0x391f('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x391f('0x23')],[db['sequelize']['fn'](_0x391f('0x20'),db['sequelize']['fn']('IF',db[_0x391f('0x1f')][_0x391f('0x24')](_0x391f('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db['sequelize']['fn']('IF',db[_0x391f('0x1f')][_0x391f('0x24')](_0x391f('0x26')))),_0x391f('0x27')],[db[_0x391f('0x1f')]['fn'](_0x391f('0x28'),db['sequelize']['fn']('IF',db[_0x391f('0x1f')][_0x391f('0x24')](_0x391f('0x29')))),_0x391f('0x2a')],[db[_0x391f('0x1f')]['fn'](_0x391f('0x28'),db[_0x391f('0x1f')]['fn']('IF',db[_0x391f('0x1f')][_0x391f('0x24')](_0x391f('0x2b')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x372041){logger[_0x391f('0xc')](_0x391f('0x2c'),_0x19c6e0);logger[_0x391f('0xe')](_0x391f('0x2c'),_0x19c6e0,JSON[_0x391f('0x1c')](_0x372041));_0x55631a(_0x372041);})[_0x391f('0x14')](function(_0x5cb93d){logger['error']('AvgHandleTime',_0x5cb93d['message'],_0x19c6e0);_0x1facf4(_0xa218c2['error'](0x1f4,_0x5cb93d[_0x391f('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4f2dba){var _0x2dce0f=this;return new Promise(function(_0x5749b1,_0x4ea2d0){return db[_0x391f('0x16')][_0x391f('0x1d')]({'raw':_0x4f2dba[_0x391f('0x19')]?_0x4f2dba[_0x391f('0x19')][_0x391f('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f2dba[_0x391f('0x19')]?_0x4f2dba[_0x391f('0x19')][_0x391f('0x1e')]||null:null,'attributes':[[_0x391f('0x2d'),_0x391f('0x2e')],[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db[_0x391f('0x1f')]['fn']('IF',db[_0x391f('0x1f')][_0x391f('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0x391f('0x2f')],[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db[_0x391f('0x1f')]['fn']('IF',db['sequelize'][_0x391f('0x24')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db[_0x391f('0x1f')]['fn']('IF',db[_0x391f('0x1f')][_0x391f('0x24')](_0x391f('0x30')))),_0x391f('0x31')],[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db[_0x391f('0x1f')]['fn']('IF',db['sequelize'][_0x391f('0x24')](_0x391f('0x32')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x391f('0x20'),db[_0x391f('0x1f')]['fn']('IF',db[_0x391f('0x1f')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db[_0x391f('0x1f')]['fn']('IF',db['sequelize'][_0x391f('0x24')](_0x391f('0x33')))),'outboundDropCallsDayTimeout'],[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db[_0x391f('0x1f')]['fn']('IF',db['sequelize'][_0x391f('0x24')](_0x391f('0x34')))),_0x391f('0x35')],[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db['sequelize']['fn']('IF',db[_0x391f('0x1f')][_0x391f('0x24')](_0x391f('0x36')))),'outboundUnknownCallsDay'],[db[_0x391f('0x1f')]['fn']('COUNT',db[_0x391f('0x1f')]['fn']('IF',db['sequelize'][_0x391f('0x24')](_0x391f('0x37')))),_0x391f('0x38')],[db['sequelize']['fn'](_0x391f('0x20'),db[_0x391f('0x1f')]['fn']('IF',db[_0x391f('0x1f')][_0x391f('0x24')](_0x391f('0x39')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x391f('0x1f')]['fn']('IF',db[_0x391f('0x1f')][_0x391f('0x24')](_0x391f('0x3a')))),_0x391f('0x3b')],[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db['sequelize']['fn']('IF',db[_0x391f('0x1f')][_0x391f('0x24')](_0x391f('0x3c')))),_0x391f('0x3d')],[db['sequelize']['fn'](_0x391f('0x20'),db['sequelize']['fn']('IF',db[_0x391f('0x1f')][_0x391f('0x24')](_0x391f('0x3e')))),_0x391f('0x3b')],[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db[_0x391f('0x1f')]['fn']('IF',db[_0x391f('0x1f')][_0x391f('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x391f('0x3f')]],'group':[_0x391f('0x2d')]})['then'](function(_0x1fa1ff){logger[_0x391f('0xc')](_0x391f('0x40'),_0x4f2dba);logger[_0x391f('0xe')](_0x391f('0x40'),_0x4f2dba,JSON[_0x391f('0x1c')](_0x1fa1ff));_0x5749b1(_0x1fa1ff);})[_0x391f('0x14')](function(_0x2de4db){logger['error'](_0x391f('0x40'),_0x2de4db[_0x391f('0x12')],_0x4f2dba);_0x4ea2d0(_0x2dce0f[_0x391f('0x10')](0x1f4,_0x2de4db[_0x391f('0x12')]));});});};exports[_0x391f('0x41')]=function(_0x1e0958){var _0x28c5ab=this;return new Promise(function(_0x42a9f0,_0x455f8a){return db['CmHopperHistory'][_0x391f('0x1d')]({'raw':_0x1e0958[_0x391f('0x19')]?_0x1e0958[_0x391f('0x19')][_0x391f('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e0958[_0x391f('0x19')]?_0x1e0958[_0x391f('0x19')][_0x391f('0x1e')]||null:null,'attributes':[[_0x391f('0x2d'),_0x391f('0x2e')],[db[_0x391f('0x1f')]['fn'](_0x391f('0x20'),db[_0x391f('0x1f')][_0x391f('0x21')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db[_0x391f('0x1f')]['fn']('IF',db[_0x391f('0x1f')]['literal'](_0x391f('0x30')))),_0x391f('0x42')]],'group':[_0x391f('0x2d')]})[_0x391f('0x1b')](function(_0x474e08){logger['info'](_0x391f('0x41'),_0x1e0958);logger[_0x391f('0xe')](_0x391f('0x41'),_0x1e0958,JSON[_0x391f('0x1c')](_0x474e08));_0x42a9f0(_0x474e08);})[_0x391f('0x14')](function(_0x3735af){logger[_0x391f('0x10')](_0x391f('0x41'),_0x3735af[_0x391f('0x12')],_0x1e0958);_0x455f8a(_0x28c5ab[_0x391f('0x10')](0x1f4,_0x3735af[_0x391f('0x12')]));});});}; \ No newline at end of file +var _0x2d1a=['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','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','body','options','raw','then','CreateCmHopperHistory','stringify','CmHopperHistory','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null'];(function(_0xe6b689,_0x3557fd){var _0x3c21df=function(_0x12f616){while(--_0x12f616){_0xe6b689['push'](_0xe6b689['shift']());}};_0x3c21df(++_0x3557fd);}(_0x2d1a,0x178));var _0xa2d1=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x2d1a[_0x20cb20];return _0x2fcf4b;};'use strict';var _=require('lodash');var util=require(_0xa2d1('0x0'));var moment=require(_0xa2d1('0x1'));var BPromise=require(_0xa2d1('0x2'));var rs=require(_0xa2d1('0x3'));var fs=require('fs');var Redis=require(_0xa2d1('0x4'));var db=require(_0xa2d1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa2d1('0x6'))(_0xa2d1('0x7'));var config=require(_0xa2d1('0x8'));var jayson=require(_0xa2d1('0x9'));var client=jayson[_0xa2d1('0xa')][_0xa2d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe76512,_0xb931ac,_0x524c3e){return new BPromise(function(_0x18250d,_0xc86d46){return client[_0xa2d1('0xc')](_0xe76512,_0x524c3e)['then'](function(_0x4232cb){logger[_0xa2d1('0xd')](_0xa2d1('0xe'),_0xb931ac,_0xa2d1('0xf'));logger[_0xa2d1('0x10')](_0xa2d1('0x11'),_0xb931ac,_0xa2d1('0xf'),JSON['stringify'](_0x4232cb));if(_0x4232cb[_0xa2d1('0x12')]){if(_0x4232cb[_0xa2d1('0x12')][_0xa2d1('0x13')]===0x1f4){logger[_0xa2d1('0x12')](_0xa2d1('0xe'),_0xb931ac,_0x4232cb[_0xa2d1('0x12')][_0xa2d1('0x14')]);return _0xc86d46(_0x4232cb['error'][_0xa2d1('0x14')]);}logger[_0xa2d1('0x12')](_0xa2d1('0xe'),_0xb931ac,_0x4232cb[_0xa2d1('0x12')][_0xa2d1('0x14')]);return _0x18250d(_0x4232cb['error'][_0xa2d1('0x14')]);}else{logger[_0xa2d1('0xd')](_0xa2d1('0xe'),_0xb931ac,_0xa2d1('0xf'));_0x18250d(_0x4232cb[_0xa2d1('0x15')]['message']);}})[_0xa2d1('0x16')](function(_0x2d0cd4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xb931ac,_0x2d0cd4);_0xc86d46(_0x2d0cd4);});});}exports['CreateCmHopperHistory']=function(_0x213646){var _0x4008fb=this;return new Promise(function(_0x334ce1,_0x4a9ba7){return db['CmHopperHistory'][_0xa2d1('0x17')](_0x213646[_0xa2d1('0x18')],{'raw':_0x213646[_0xa2d1('0x19')]?_0x213646[_0xa2d1('0x19')][_0xa2d1('0x1a')]===undefined?!![]:![]:!![]})[_0xa2d1('0x1b')](function(_0x14b34d){logger[_0xa2d1('0xd')](_0xa2d1('0x1c'),_0x213646);logger['debug'](_0xa2d1('0x1c'),_0x213646,JSON[_0xa2d1('0x1d')](_0x14b34d));_0x334ce1(_0x14b34d);})['catch'](function(_0x4b69c5){logger[_0xa2d1('0x12')](_0xa2d1('0x1c'),_0x4b69c5[_0xa2d1('0x14')],_0x213646);_0x4a9ba7(_0x4008fb[_0xa2d1('0x12')](0x1f4,_0x4b69c5[_0xa2d1('0x14')]));});});};exports['AvgHandleTime']=function(_0x136961){var _0x1a9029=this;return new Promise(function(_0x522c3e,_0x57b187){return db[_0xa2d1('0x1e')]['findAll']({'raw':_0x136961[_0xa2d1('0x19')]?_0x136961[_0xa2d1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x136961['options']?_0x136961[_0xa2d1('0x19')][_0xa2d1('0x1f')]||null:null,'attributes':[[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')][_0xa2d1('0x22')]('id')),_0xa2d1('0x23')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0xa2d1('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0xa2d1('0x25')],[db['sequelize']['fn'](_0xa2d1('0x21'),db['sequelize']['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')](_0xa2d1('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn']('COUNT',db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')]('`state`\x20=\x2011,\x201,\x20null'))),_0xa2d1('0x27')],[db[_0xa2d1('0x20')]['fn']('AVG',db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')](_0xa2d1('0x28')))),_0xa2d1('0x29')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x2a'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xa2d1('0x2b')))),_0xa2d1('0x2c')]]})[_0xa2d1('0x1b')](function(_0x5d5b68){logger[_0xa2d1('0xd')](_0xa2d1('0x2d'),_0x136961);logger[_0xa2d1('0x10')]('AvgHandleTime',_0x136961,JSON[_0xa2d1('0x1d')](_0x5d5b68));_0x522c3e(_0x5d5b68);})[_0xa2d1('0x16')](function(_0x418a8f){logger[_0xa2d1('0x12')](_0xa2d1('0x2d'),_0x418a8f['message'],_0x136961);_0x57b187(_0x1a9029[_0xa2d1('0x12')](0x1f4,_0x418a8f[_0xa2d1('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x32b14c){var _0x399da3=this;return new Promise(function(_0x32b8c8,_0x1e2bd9){return db[_0xa2d1('0x1e')][_0xa2d1('0x2e')]({'raw':_0x32b14c['options']?_0x32b14c[_0xa2d1('0x19')][_0xa2d1('0x1a')]===undefined?!![]:![]:!![],'where':_0x32b14c[_0xa2d1('0x19')]?_0x32b14c[_0xa2d1('0x19')][_0xa2d1('0x1f')]||null:null,'attributes':[[_0xa2d1('0x2f'),_0xa2d1('0x30')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')]['literal'](_0xa2d1('0x31')))),_0xa2d1('0x32')],[db['sequelize']['fn']('COUNT',db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')](_0xa2d1('0x33')))),_0xa2d1('0x34')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db['sequelize']['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')](_0xa2d1('0x35')))),'outboundAnswerCallsDay'],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')](_0xa2d1('0x36')))),_0xa2d1('0x37')],[db[_0xa2d1('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa2d1('0x24')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xa2d1('0x38')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')](_0xa2d1('0x39')))),_0xa2d1('0x3a')],[db['sequelize']['fn']('COUNT',db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db['sequelize']['literal'](_0xa2d1('0x3b')))),_0xa2d1('0x3c')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db['sequelize'][_0xa2d1('0x24')](_0xa2d1('0x3d')))),_0xa2d1('0x3e')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db['sequelize'][_0xa2d1('0x24')](_0xa2d1('0x3f')))),_0xa2d1('0x40')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db['sequelize']['fn']('IF',db[_0xa2d1('0x20')]['literal'](_0xa2d1('0x41')))),'outboundAnswerAgiCallsDay'],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')]['literal'](_0xa2d1('0x42')))),'outboundRejectCallsDay'],[db[_0xa2d1('0x20')]['fn']('COUNT',db[_0xa2d1('0x20')]['fn']('IF',db['sequelize'][_0xa2d1('0x24')](_0xa2d1('0x43')))),_0xa2d1('0x44')]],'group':['campaign']})[_0xa2d1('0x1b')](function(_0x5d672f){logger[_0xa2d1('0xd')](_0xa2d1('0x45'),_0x32b14c);logger[_0xa2d1('0x10')](_0xa2d1('0x45'),_0x32b14c,JSON[_0xa2d1('0x1d')](_0x5d672f));_0x32b8c8(_0x5d672f);})[_0xa2d1('0x16')](function(_0x5a8386){logger[_0xa2d1('0x12')](_0xa2d1('0x45'),_0x5a8386[_0xa2d1('0x14')],_0x32b14c);_0x1e2bd9(_0x399da3[_0xa2d1('0x12')](0x1f4,_0x5a8386[_0xa2d1('0x14')]));});});};exports[_0xa2d1('0x46')]=function(_0x441a2e){var _0x4f26f7=this;return new Promise(function(_0x3cb0ed,_0x5378d2){return db[_0xa2d1('0x1e')]['findAll']({'raw':_0x441a2e['options']?_0x441a2e[_0xa2d1('0x19')][_0xa2d1('0x1a')]===undefined?!![]:![]:!![],'where':_0x441a2e[_0xa2d1('0x19')]?_0x441a2e[_0xa2d1('0x19')]['where']||null:null,'attributes':[[_0xa2d1('0x2f'),'name'],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')][_0xa2d1('0x22')]('id')),_0xa2d1('0x47')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db['sequelize'][_0xa2d1('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0xa2d1('0x48')]],'group':['campaign']})[_0xa2d1('0x1b')](function(_0x4599d8){logger['info'](_0xa2d1('0x46'),_0x441a2e);logger[_0xa2d1('0x10')](_0xa2d1('0x46'),_0x441a2e,JSON[_0xa2d1('0x1d')](_0x4599d8));_0x3cb0ed(_0x4599d8);})[_0xa2d1('0x16')](function(_0x327658){logger['error'](_0xa2d1('0x46'),_0x327658[_0xa2d1('0x14')],_0x441a2e);_0x5378d2(_0x4f26f7[_0xa2d1('0x12')](0x1f4,_0x327658[_0xa2d1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 21b473a..71ed661 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 _0xbc37=['../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','describe','show','post','/:id','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x474457,_0x476fe6){var _0x5b8e7b=function(_0x5cf704){while(--_0x5cf704){_0x474457['push'](_0x474457['shift']());}};_0x5b8e7b(++_0x476fe6);}(_0xbc37,0x11a));var _0x7bc3=function(_0x1ba0c1,_0x42d7b7){_0x1ba0c1=_0x1ba0c1-0x0;var _0x59d3d5=_0xbc37[_0x1ba0c1];return _0x59d3d5;};'use strict';var multer=require(_0x7bc3('0x0'));var util=require(_0x7bc3('0x1'));var path=require('path');var timeout=require(_0x7bc3('0x2'));var express=require(_0x7bc3('0x3'));var router=express[_0x7bc3('0x4')]();var auth=require(_0x7bc3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7bc3('0x6'));var controller=require(_0x7bc3('0x7'));router[_0x7bc3('0x8')]('/',auth[_0x7bc3('0x9')](),controller['index']);router[_0x7bc3('0x8')]('/describe',auth[_0x7bc3('0x9')](),controller[_0x7bc3('0xa')]);router[_0x7bc3('0x8')]('/:id',auth[_0x7bc3('0x9')](),controller[_0x7bc3('0xb')]);router[_0x7bc3('0xc')]('/',auth[_0x7bc3('0x9')](),controller['create']);router['put'](_0x7bc3('0xd'),auth[_0x7bc3('0x9')](),controller[_0x7bc3('0xe')]);module[_0x7bc3('0xf')]=router; \ No newline at end of file +var _0xfea2=['index','describe','/:id','show','post','isAuthenticated','put','update','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0xfea2,0x117));var _0x2fea=function(_0x2ac2de,_0x109a1e){_0x2ac2de=_0x2ac2de-0x0;var _0xf453a1=_0xfea2[_0x2ac2de];return _0xf453a1;};'use strict';var multer=require('multer');var util=require(_0x2fea('0x0'));var path=require(_0x2fea('0x1'));var timeout=require(_0x2fea('0x2'));var express=require('express');var router=express[_0x2fea('0x3')]();var auth=require(_0x2fea('0x4'));var interaction=require(_0x2fea('0x5'));var config=require(_0x2fea('0x6'));var controller=require(_0x2fea('0x7'));router[_0x2fea('0x8')]('/',auth['isAuthenticated'](),controller[_0x2fea('0x9')]);router[_0x2fea('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x2fea('0xa')]);router[_0x2fea('0x8')](_0x2fea('0xb'),auth['isAuthenticated'](),controller[_0x2fea('0xc')]);router[_0x2fea('0xd')]('/',auth[_0x2fea('0xe')](),controller['create']);router[_0x2fea('0xf')](_0x2fea('0xb'),auth[_0x2fea('0xe')](),controller[_0x2fea('0x10')]);module[_0x2fea('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 2f90558..4653c98 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 _0xde12=['sequelize','STRING','name'];(function(_0x559e51,_0x2836f7){var _0x3d228c=function(_0x1f2a44){while(--_0x1f2a44){_0x559e51['push'](_0x559e51['shift']());}};_0x3d228c(++_0x2836f7);}(_0xde12,0x6f));var _0x2de1=function(_0x1da1b1,_0x375ad8){_0x1da1b1=_0x1da1b1-0x0;var _0x5d7c99=_0xde12[_0x1da1b1];return _0x5d7c99;};'use strict';var Sequelize=require(_0x2de1('0x0'));module['exports']={'name':{'type':Sequelize[_0x2de1('0x1')],'unique':_0x2de1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x2de1('0x1')]}}; \ No newline at end of file +var _0xe806=['name','sequelize','STRING'];(function(_0x220552,_0x292ad4){var _0xa04a85=function(_0x3336e1){while(--_0x3336e1){_0x220552['push'](_0x220552['shift']());}};_0xa04a85(++_0x292ad4);}(_0xe806,0x8b));var _0x6e80=function(_0x3cf59d,_0xc155ed){_0x3cf59d=_0x3cf59d-0x0;var _0x3bb59a=_0xe806[_0x3cf59d];return _0x3bb59a;};'use strict';var Sequelize=require(_0x6e80('0x0'));module['exports']={'name':{'type':Sequelize[_0x6e80('0x1')],'unique':_0x6e80('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index c8bc3dd..9244546 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 _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x1063a3,_0x3c6998){var _0x38e285=function(_0x322b06){while(--_0x322b06){_0x1063a3['push'](_0x1063a3['shift']());}};_0x38e285(++_0x3c6998);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);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(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file +var _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x19c7e8,_0x1b1f1d){var _0x36c64f=function(_0x1deccf){while(--_0x1deccf){_0x19c7e8['push'](_0x19c7e8['shift']());}};_0x36c64f(++_0x1b1f1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);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(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4552b89..dba7ca1 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 _0x0a9b=['../../mysqldb','CmList','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x18b927,_0x43737a){var _0x408df2=function(_0x4ed096){while(--_0x4ed096){_0x18b927['push'](_0x18b927['shift']());}};_0x408df2(++_0x43737a);}(_0x0a9b,0x9f));var _0xb0a9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0a9b[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xb0a9('0x0'));var CmList=require(_0xb0a9('0x1'))['db'][_0xb0a9('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb0a9('0x3')](0x0);var events={'afterCreate':_0xb0a9('0x4'),'afterUpdate':_0xb0a9('0x5'),'afterDestroy':_0xb0a9('0x6')};function emitEvent(_0x26583c){return function(_0x3a75fd,_0x8b8069,_0x3114dc){CmListEvents[_0xb0a9('0x7')](_0x26583c+':'+_0x3a75fd['id'],_0x3a75fd);CmListEvents[_0xb0a9('0x7')](_0x26583c,_0x3a75fd);_0x3114dc(null);};}for(var e in events){if(events[_0xb0a9('0x8')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xb0a9('0x9')]=CmListEvents; \ No newline at end of file +var _0xf49c=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf49c,0x98));var _0xcf49=function(_0x3687b7,_0x1e2618){_0x3687b7=_0x3687b7-0x0;var _0x1a0bc7=_0xf49c[_0x3687b7];return _0x1a0bc7;};'use strict';var EventEmitter=require('events');var CmList=require(_0xcf49('0x0'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xcf49('0x1')](0x0);var events={'afterCreate':_0xcf49('0x2'),'afterUpdate':_0xcf49('0x3'),'afterDestroy':_0xcf49('0x4')};function emitEvent(_0x1038f1){return function(_0x18338f,_0x230978,_0x1dc4f3){CmListEvents[_0xcf49('0x5')](_0x1038f1+':'+_0x18338f['id'],_0x18338f);CmListEvents[_0xcf49('0x5')](_0x1038f1,_0x18338f);_0x1dc4f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xcf49('0x6')](e,emitEvent(event));}}module[_0xcf49('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 79964b7..c396625 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 _0xfd84=['lodash','moment','bluebird','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList'];(function(_0x130d83,_0x43b29e){var _0x467b9c=function(_0x5f0176){while(--_0x5f0176){_0x130d83['push'](_0x130d83['shift']());}};_0x467b9c(++_0x43b29e);}(_0xfd84,0x1a4));var _0x4fd8=function(_0x5ba19c,_0xd1f215){_0x5ba19c=_0x5ba19c-0x0;var _0x4a58e7=_0xfd84[_0x5ba19c];return _0x4a58e7;};'use strict';var _=require(_0x4fd8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4fd8('0x1'));var BPromise=require(_0x4fd8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fd8('0x3'));var rimraf=require(_0x4fd8('0x4'));var config=require(_0x4fd8('0x5'));var attributes=require(_0x4fd8('0x6'));module[_0x4fd8('0x7')]=function(_0x1cc1e2,_0x16d1a3){return _0x1cc1e2[_0x4fd8('0x8')](_0x4fd8('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf83d=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xf83d,0x140));var _0xdf83=function(_0xcaa660,_0x116e0a){_0xcaa660=_0xcaa660-0x0;var _0x346c79=_0xf83d[_0xcaa660];return _0x346c79;};'use strict';var _=require(_0xdf83('0x0'));var util=require(_0xdf83('0x1'));var logger=require(_0xdf83('0x2'))(_0xdf83('0x3'));var moment=require(_0xdf83('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf83('0x5'));var fs=require('fs');var path=require(_0xdf83('0x6'));var rimraf=require(_0xdf83('0x7'));var config=require(_0xdf83('0x8'));var attributes=require(_0xdf83('0x9'));module[_0xdf83('0xa')]=function(_0x10604c,_0x128aa1){return _0x10604c[_0xdf83('0xb')](_0xdf83('0xc'),attributes,{'tableName':_0xdf83('0xd'),'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 2fa8a6f..dd2eef4 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 _0x4ad9=['randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','request','then','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmList,\x20%s,\x20%s','message','info','util'];(function(_0xa78bdf,_0x114e50){var _0x7af532=function(_0x3e1bae){while(--_0x3e1bae){_0xa78bdf['push'](_0xa78bdf['shift']());}};_0x7af532(++_0x114e50);}(_0x4ad9,0xfb));var _0x94ad=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4ad9[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x94ad('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x94ad('0x1'));var fs=require('fs');var Redis=require(_0x94ad('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x94ad('0x3'));var logger=require('../../config/logger')(_0x94ad('0x4'));var config=require('../../config/environment');var jayson=require(_0x94ad('0x5'));var client=jayson['client'][_0x94ad('0x6')]({'port':0x232a});config[_0x94ad('0x7')]=_['defaults'](config[_0x94ad('0x7')],{'host':_0x94ad('0x8'),'port':0x18eb});var socket=require(_0x94ad('0x9'))(new Redis(config[_0x94ad('0x7')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x4b45b1,_0x29c81e,_0x1ea145){return new BPromise(function(_0x5cc13a,_0x507df8){return client[_0x94ad('0xa')](_0x4b45b1,_0x1ea145)[_0x94ad('0xb')](function(_0x203498){logger['info']('CmList,\x20%s,\x20%s',_0x29c81e,'request\x20sent');logger[_0x94ad('0xc')](_0x94ad('0xd'),_0x29c81e,_0x94ad('0xe'),JSON[_0x94ad('0xf')](_0x203498));if(_0x203498['error']){if(_0x203498[_0x94ad('0x10')][_0x94ad('0x11')]===0x1f4){logger[_0x94ad('0x10')](_0x94ad('0x12'),_0x29c81e,_0x203498[_0x94ad('0x10')][_0x94ad('0x13')]);return _0x507df8(_0x203498[_0x94ad('0x10')]['message']);}logger[_0x94ad('0x10')]('CmList,\x20%s,\x20%s',_0x29c81e,_0x203498['error'][_0x94ad('0x13')]);return _0x5cc13a(_0x203498[_0x94ad('0x10')][_0x94ad('0x13')]);}else{logger[_0x94ad('0x14')](_0x94ad('0x12'),_0x29c81e,_0x94ad('0xe'));_0x5cc13a(_0x203498['result']['message']);}})['catch'](function(_0x4459d0){logger[_0x94ad('0x10')](_0x94ad('0x12'),_0x29c81e,_0x4459d0);_0x507df8(_0x4459d0);});});} \ No newline at end of file +var _0xdc1f=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x3e1ccd,_0x3d3880){var _0x3e02ed=function(_0x45edb0){while(--_0x45edb0){_0x3e1ccd['push'](_0x3e1ccd['shift']());}};_0x3e02ed(++_0x3d3880);}(_0xdc1f,0x8a));var _0xfdc1=function(_0x59e348,_0x5c5f00){_0x59e348=_0x59e348-0x0;var _0x2478b8=_0xdc1f[_0x59e348];return _0x2478b8;};'use strict';var _=require(_0xfdc1('0x0'));var util=require(_0xfdc1('0x1'));var moment=require(_0xfdc1('0x2'));var BPromise=require(_0xfdc1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdc1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdc1('0x5'));var logger=require(_0xfdc1('0x6'))(_0xfdc1('0x7'));var config=require(_0xfdc1('0x8'));var jayson=require(_0xfdc1('0x9'));var client=jayson[_0xfdc1('0xa')][_0xfdc1('0xb')]({'port':0x232a});config[_0xfdc1('0xc')]=_[_0xfdc1('0xd')](config[_0xfdc1('0xc')],{'host':_0xfdc1('0xe'),'port':0x18eb});var socket=require(_0xfdc1('0xf'))(new Redis(config['redis']));require(_0xfdc1('0x10'))['register'](socket);function respondWithRpcPromise(_0x9303fd,_0x1a64d4,_0x3881e1){return new BPromise(function(_0x29b5a5,_0x4d60ce){return client['request'](_0x9303fd,_0x3881e1)[_0xfdc1('0x11')](function(_0x3078a1){logger['info'](_0xfdc1('0x12'),_0x1a64d4,'request\x20sent');logger[_0xfdc1('0x13')](_0xfdc1('0x14'),_0x1a64d4,'request\x20sent',JSON[_0xfdc1('0x15')](_0x3078a1));if(_0x3078a1[_0xfdc1('0x16')]){if(_0x3078a1[_0xfdc1('0x16')][_0xfdc1('0x17')]===0x1f4){logger['error'](_0xfdc1('0x12'),_0x1a64d4,_0x3078a1[_0xfdc1('0x16')][_0xfdc1('0x18')]);return _0x4d60ce(_0x3078a1[_0xfdc1('0x16')]['message']);}logger[_0xfdc1('0x16')](_0xfdc1('0x12'),_0x1a64d4,_0x3078a1['error'][_0xfdc1('0x18')]);return _0x29b5a5(_0x3078a1[_0xfdc1('0x16')][_0xfdc1('0x18')]);}else{logger[_0xfdc1('0x19')](_0xfdc1('0x12'),_0x1a64d4,_0xfdc1('0x1a'));_0x29b5a5(_0x3078a1[_0xfdc1('0x1b')]['message']);}})[_0xfdc1('0x1c')](function(_0x5f1176){logger['error'](_0xfdc1('0x12'),_0x1a64d4,_0x5f1176);_0x4d60ce(_0x5f1176);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 0540bae..767ccd4 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 _0xf29c=['removeListener','register','length','save','remove','update','emit'];(function(_0x44c37d,_0x19119f){var _0x29e087=function(_0x327fca){while(--_0x327fca){_0x44c37d['push'](_0x44c37d['shift']());}};_0x29e087(++_0x19119f);}(_0xf29c,0xc7));var _0xcf29=function(_0x2b8edf,_0x31aa7d){_0x2b8edf=_0x2b8edf-0x0;var _0x3a1377=_0xf29c[_0x2b8edf];return _0x3a1377;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xcf29('0x0'),_0xcf29('0x1'),_0xcf29('0x2')];function createListener(_0x326d3c,_0xe09619){return function(_0xe7c034){_0xe09619[_0xcf29('0x3')](_0x326d3c,_0xe7c034);};}function removeListener(_0x148004,_0x1f2b5d){return function(){CmListEvents[_0xcf29('0x4')](_0x148004,_0x1f2b5d);};}exports[_0xcf29('0x5')]=function(_0x89a1c8){for(var _0x347493=0x0,_0x157dfe=events[_0xcf29('0x6')];_0x347493<_0x157dfe;_0x347493++){var _0x435ced=events[_0x347493];var _0x4e6469=createListener('cmList:'+_0x435ced,_0x89a1c8);CmListEvents['on'](_0x435ced,_0x4e6469);}}; \ No newline at end of file +var _0x8efc=['removeListener','length','cmList:','remove','emit'];(function(_0x24b6e0,_0x5caecf){var _0x25b48a=function(_0xbc0374){while(--_0xbc0374){_0x24b6e0['push'](_0x24b6e0['shift']());}};_0x25b48a(++_0x5caecf);}(_0x8efc,0x8f));var _0xc8ef=function(_0x5e944a,_0x2847b4){_0x5e944a=_0x5e944a-0x0;var _0x38f07b=_0x8efc[_0x5e944a];return _0x38f07b;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xc8ef('0x0'),'update'];function createListener(_0x35d82e,_0x48fc28){return function(_0x16d145){_0x48fc28[_0xc8ef('0x1')](_0x35d82e,_0x16d145);};}function removeListener(_0x4dbf24,_0x4ee0cc){return function(){CmListEvents[_0xc8ef('0x2')](_0x4dbf24,_0x4ee0cc);};}exports['register']=function(_0x1d65c1){for(var _0x1b4901=0x0,_0x1648ac=events[_0xc8ef('0x3')];_0x1b4901<_0x1648ac;_0x1b4901++){var _0x819e70=events[_0x1b4901];var _0x522d75=createListener(_0xc8ef('0x4')+_0x819e70,_0x1d65c1);CmListEvents['on'](_0x819e70,_0x522d75);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 1f1140a..9980fa8 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 _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index e904044..d276ce5 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(_0x511bff,_0x336061){var _0x50a963=function(_0x1933a6){while(--_0x1933a6){_0x511bff['push'](_0x511bff['shift']());}};_0x50a963(++_0x336061);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0xc18351,_0x3561ef){var _0x580528=function(_0xe9363a){while(--_0xe9363a){_0xc18351['push'](_0xc18351['shift']());}};_0x580528(++_0x3561ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index ca95793..fb25364 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 _0x5067=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','status','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','body','Condition','params','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x59b98f,_0x3f143e){var _0x51f042=function(_0x3019d8){while(--_0x3019d8){_0x59b98f['push'](_0x59b98f['shift']());}};_0x51f042(++_0x3f143e);}(_0x5067,0xae));var _0x7506=function(_0x5bea75,_0xad6684){_0x5bea75=_0x5bea75-0x0;var _0x3e6bc1=_0x5067[_0x5bea75];return _0x3e6bc1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7506('0x0'));var rimraf=require(_0x7506('0x1'));var zipdir=require(_0x7506('0x2'));var jsonpatch=require(_0x7506('0x3'));var rp=require('request-promise');var moment=require(_0x7506('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7506('0x5'));var util=require(_0x7506('0x6'));var path=require(_0x7506('0x7'));var sox=require(_0x7506('0x8'));var csv=require('to-csv');var ejs=require(_0x7506('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7506('0xa'));var crypto=require(_0x7506('0xb'));var jsforce=require(_0x7506('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7506('0xd'));var querystring=require(_0x7506('0xe'));var Papa=require(_0x7506('0xf'));var Redis=require(_0x7506('0x10'));var authService=require(_0x7506('0x11'));var qs=require(_0x7506('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7506('0x13'));var logger=require(_0x7506('0x14'))(_0x7506('0x15'));var utils=require(_0x7506('0x16'));var config=require(_0x7506('0x17'));var licenseUtil=require(_0x7506('0x18'));var db=require(_0x7506('0x19'))['db'];function respondWithStatusCode(_0x4a9e2d,_0x500bcb){_0x500bcb=_0x500bcb||0xcc;return function(_0x10c642){if(_0x10c642){return _0x4a9e2d[_0x7506('0x1a')](_0x500bcb);}return _0x4a9e2d['status'](_0x500bcb)[_0x7506('0x1b')]();};}function respondWithResult(_0x2af1e2,_0x2af215){_0x2af215=_0x2af215||0xc8;return function(_0xb46f85){if(_0xb46f85){return _0x2af1e2['status'](_0x2af215)['json'](_0xb46f85);}};}function respondWithFilteredResult(_0x463041,_0x16ad6b){return function(_0x20a7f7){if(_0x20a7f7){var _0x51949f=_0x20a7f7[_0x7506('0x1c')],_0x1f7ff9=_0x16ad6b[_0x7506('0x1d')],_0x2c2ce8=_0x16ad6b[_0x7506('0x1d')]+_0x16ad6b[_0x7506('0x1e')],_0x4d585d;if(_0x2c2ce8>=_0x51949f){_0x2c2ce8=_0x51949f;_0x4d585d=0xc8;}else{_0x4d585d=0xce;}_0x463041[_0x7506('0x1f')](_0x4d585d);return _0x463041[_0x7506('0x20')](_0x7506('0x21'),_0x1f7ff9+'-'+_0x2c2ce8+'/'+_0x51949f)[_0x7506('0x22')](_0x20a7f7);}return null;};}function patchUpdates(_0x1a7a9d){return function(_0x129708){try{jsonpatch['apply'](_0x129708,_0x1a7a9d,!![]);}catch(_0x6068b3){return BPromise[_0x7506('0x23')](_0x6068b3);}return _0x129708[_0x7506('0x24')]();};}function saveUpdates(_0x1b3065,_0x443bfa){return function(_0xc5cfb4){if(_0xc5cfb4){return _0xc5cfb4[_0x7506('0x25')](_0x1b3065)['then'](function(_0x3750bb){return _0x3750bb;});}return null;};}function removeEntity(_0x5efd77,_0x42b4fe){return function(_0x235983){if(_0x235983){return _0x235983[_0x7506('0x26')]()[_0x7506('0x27')](function(){_0x5efd77[_0x7506('0x1f')](0xcc)[_0x7506('0x1b')]();});}};}function handleEntityNotFound(_0x4f1b48,_0x1b7e5b){return function(_0x5c2fc1){if(!_0x5c2fc1){_0x4f1b48['sendStatus'](0x194);}return _0x5c2fc1;};}function handleError(_0x237639,_0x300070){_0x300070=_0x300070||0x1f4;return function(_0x1397b2){logger[_0x7506('0x28')](_0x1397b2[_0x7506('0x29')]);if(_0x1397b2[_0x7506('0x2a')]){delete _0x1397b2[_0x7506('0x2a')];}_0x237639[_0x7506('0x1f')](_0x300070)['send'](_0x1397b2);};}exports[_0x7506('0x25')]=function(_0x260c73,_0x3531a0){if(_0x260c73[_0x7506('0x2b')]['id']){delete _0x260c73[_0x7506('0x2b')]['id'];}return db[_0x7506('0x2c')]['find']({'where':{'id':_0x260c73[_0x7506('0x2d')]['id']}})[_0x7506('0x27')](handleEntityNotFound(_0x3531a0,null))[_0x7506('0x27')](saveUpdates(_0x260c73[_0x7506('0x2b')],null))[_0x7506('0x27')](respondWithResult(_0x3531a0,null))[_0x7506('0x2e')](handleError(_0x3531a0,null));};exports[_0x7506('0x26')]=function(_0x50dbc1,_0x579d8b){return db[_0x7506('0x2c')][_0x7506('0x2f')]({'where':{'id':_0x50dbc1['params']['id']}})[_0x7506('0x27')](handleEntityNotFound(_0x579d8b,null))[_0x7506('0x27')](removeEntity(_0x579d8b,null))['catch'](handleError(_0x579d8b,null));}; \ No newline at end of file +var _0x2757=['util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','end','name','send','body','Condition','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache'];(function(_0x26667e,_0x4c2d96){var _0x53aa2f=function(_0x580b17){while(--_0x580b17){_0x26667e['push'](_0x26667e['shift']());}};_0x53aa2f(++_0x4c2d96);}(_0x2757,0x107));var _0x7275=function(_0x342c6f,_0x57040b){_0x342c6f=_0x342c6f-0x0;var _0x1e5f31=_0x2757[_0x342c6f];return _0x1e5f31;};'use strict';var pdf=require(_0x7275('0x0'));var emlformat=require(_0x7275('0x1'));var rimraf=require(_0x7275('0x2'));var zipdir=require(_0x7275('0x3'));var jsonpatch=require(_0x7275('0x4'));var rp=require('request-promise');var moment=require(_0x7275('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7275('0x6'));var util=require(_0x7275('0x7'));var path=require(_0x7275('0x8'));var sox=require(_0x7275('0x9'));var csv=require(_0x7275('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7275('0xb'));var squel=require(_0x7275('0xc'));var crypto=require(_0x7275('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7275('0xe'));var toCsv=require(_0x7275('0xa'));var querystring=require('querystring');var Papa=require(_0x7275('0xf'));var Redis=require('ioredis');var authService=require(_0x7275('0x10'));var qs=require(_0x7275('0x11'));var as=require(_0x7275('0x12'));var hardwareService=require(_0x7275('0x13'));var logger=require(_0x7275('0x14'))(_0x7275('0x15'));var utils=require(_0x7275('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7275('0x17'));var db=require(_0x7275('0x18'))['db'];function respondWithStatusCode(_0x48cd40,_0x3308ad){_0x3308ad=_0x3308ad||0xcc;return function(_0x482f5d){if(_0x482f5d){return _0x48cd40[_0x7275('0x19')](_0x3308ad);}return _0x48cd40[_0x7275('0x1a')](_0x3308ad)['end']();};}function respondWithResult(_0x56e01e,_0x4f6f6d){_0x4f6f6d=_0x4f6f6d||0xc8;return function(_0x18373e){if(_0x18373e){return _0x56e01e['status'](_0x4f6f6d)[_0x7275('0x1b')](_0x18373e);}};}function respondWithFilteredResult(_0x2c5c46,_0x23167d){return function(_0xc02490){if(_0xc02490){var _0x10f6b4=_0xc02490[_0x7275('0x1c')],_0x569acd=_0x23167d[_0x7275('0x1d')],_0x416854=_0x23167d[_0x7275('0x1d')]+_0x23167d[_0x7275('0x1e')],_0x3ced9b;if(_0x416854>=_0x10f6b4){_0x416854=_0x10f6b4;_0x3ced9b=0xc8;}else{_0x3ced9b=0xce;}_0x2c5c46[_0x7275('0x1a')](_0x3ced9b);return _0x2c5c46['set'](_0x7275('0x1f'),_0x569acd+'-'+_0x416854+'/'+_0x10f6b4)[_0x7275('0x1b')](_0xc02490);}return null;};}function patchUpdates(_0x2b9137){return function(_0x295775){try{jsonpatch[_0x7275('0x20')](_0x295775,_0x2b9137,!![]);}catch(_0x3cc639){return BPromise[_0x7275('0x21')](_0x3cc639);}return _0x295775[_0x7275('0x22')]();};}function saveUpdates(_0x133791,_0x315be3){return function(_0x5674bd){if(_0x5674bd){return _0x5674bd['update'](_0x133791)[_0x7275('0x23')](function(_0x357c74){return _0x357c74;});}return null;};}function removeEntity(_0x4b4825,_0x408e4d){return function(_0x391185){if(_0x391185){return _0x391185[_0x7275('0x24')]()[_0x7275('0x23')](function(){_0x4b4825[_0x7275('0x1a')](0xcc)[_0x7275('0x25')]();});}};}function handleEntityNotFound(_0x50ee7b,_0x2cf12d){return function(_0x5b2370){if(!_0x5b2370){_0x50ee7b[_0x7275('0x19')](0x194);}return _0x5b2370;};}function handleError(_0x1d16ff,_0x181f66){_0x181f66=_0x181f66||0x1f4;return function(_0xb849f3){logger['error'](_0xb849f3['stack']);if(_0xb849f3[_0x7275('0x26')]){delete _0xb849f3[_0x7275('0x26')];}_0x1d16ff['status'](_0x181f66)[_0x7275('0x27')](_0xb849f3);};}exports['update']=function(_0x2fcdb2,_0x1c4d19){if(_0x2fcdb2[_0x7275('0x28')]['id']){delete _0x2fcdb2[_0x7275('0x28')]['id'];}return db[_0x7275('0x29')][_0x7275('0x2a')]({'where':{'id':_0x2fcdb2[_0x7275('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1c4d19,null))[_0x7275('0x23')](saveUpdates(_0x2fcdb2[_0x7275('0x28')],null))[_0x7275('0x23')](respondWithResult(_0x1c4d19,null))['catch'](handleError(_0x1c4d19,null));};exports[_0x7275('0x24')]=function(_0x1dc071,_0x2b64f8){return db['Condition'][_0x7275('0x2a')]({'where':{'id':_0x1dc071[_0x7275('0x2b')]['id']}})[_0x7275('0x23')](handleEntityNotFound(_0x2b64f8,null))['then'](removeEntity(_0x2b64f8,null))[_0x7275('0x2c')](handleError(_0x2b64f8,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 73ef319..716b9b3 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 _0x8738=['exports','define','Condition','lodash','util','api','moment','path','rimraf','./condition.attributes'];(function(_0x571250,_0x338436){var _0x43ec45=function(_0x216c61){while(--_0x216c61){_0x571250['push'](_0x571250['shift']());}};_0x43ec45(++_0x338436);}(_0x8738,0x1b1));var _0x8873=function(_0x414e8b,_0x58fdd1){_0x414e8b=_0x414e8b-0x0;var _0x37d1d4=_0x8738[_0x414e8b];return _0x37d1d4;};'use strict';var _=require(_0x8873('0x0'));var util=require(_0x8873('0x1'));var logger=require('../../config/logger')(_0x8873('0x2'));var moment=require(_0x8873('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8873('0x4'));var rimraf=require(_0x8873('0x5'));var config=require('../../config/environment');var attributes=require(_0x8873('0x6'));module[_0x8873('0x7')]=function(_0x49ac17,_0x5aadf7){return _0x49ac17[_0x8873('0x8')](_0x8873('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b76=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','define','Condition','tools_conditions','lodash','util'];(function(_0x5c3581,_0x4f3df2){var _0xb85a10=function(_0x3474f9){while(--_0x3474f9){_0x5c3581['push'](_0x5c3581['shift']());}};_0xb85a10(++_0x4f3df2);}(_0x2b76,0x14e));var _0x62b7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2b76[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x62b7('0x0'));var util=require(_0x62b7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x62b7('0x2'));var BPromise=require(_0x62b7('0x3'));var rp=require(_0x62b7('0x4'));var fs=require('fs');var path=require(_0x62b7('0x5'));var rimraf=require(_0x62b7('0x6'));var config=require(_0x62b7('0x7'));var attributes=require(_0x62b7('0x8'));module['exports']=function(_0x52abea,_0xa19cb7){return _0x52abea[_0x62b7('0x9')](_0x62b7('0xa'),attributes,{'tableName':_0x62b7('0xb'),'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 9460af8..debf827 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 _0x6dc7=['stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4c8833,_0x14e755){var _0x30df54=function(_0x197811){while(--_0x197811){_0x4c8833['push'](_0x4c8833['shift']());}};_0x30df54(++_0x14e755);}(_0x6dc7,0xad));var _0x76dc=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0x6dc7[_0x4c98b9];return _0x3a257a;};'use strict';var _=require(_0x76dc('0x0'));var util=require('util');var moment=require(_0x76dc('0x1'));var BPromise=require(_0x76dc('0x2'));var rs=require(_0x76dc('0x3'));var fs=require('fs');var Redis=require(_0x76dc('0x4'));var db=require(_0x76dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x76dc('0x6'))(_0x76dc('0x7'));var config=require(_0x76dc('0x8'));var jayson=require(_0x76dc('0x9'));var client=jayson['client'][_0x76dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38d604,_0x331822,_0x20c5b4){return new BPromise(function(_0x4ccd0d,_0x22d685){return client[_0x76dc('0xb')](_0x38d604,_0x20c5b4)['then'](function(_0x919444){logger[_0x76dc('0xc')](_0x76dc('0xd'),_0x331822,_0x76dc('0xe'));logger[_0x76dc('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x331822,_0x76dc('0xe'),JSON[_0x76dc('0x10')](_0x919444));if(_0x919444[_0x76dc('0x11')]){if(_0x919444[_0x76dc('0x11')][_0x76dc('0x12')]===0x1f4){logger[_0x76dc('0x11')](_0x76dc('0xd'),_0x331822,_0x919444['error']['message']);return _0x22d685(_0x919444['error'][_0x76dc('0x13')]);}logger[_0x76dc('0x11')]('Condition,\x20%s,\x20%s',_0x331822,_0x919444[_0x76dc('0x11')][_0x76dc('0x13')]);return _0x4ccd0d(_0x919444['error'][_0x76dc('0x13')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x331822,_0x76dc('0xe'));_0x4ccd0d(_0x919444['result'][_0x76dc('0x13')]);}})[_0x76dc('0x14')](function(_0x25203f){logger['error'](_0x76dc('0xd'),_0x331822,_0x25203f);_0x22d685(_0x25203f);});});} \ No newline at end of file +var _0x3d02=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','Condition,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x35f762,_0xc1ce5a){var _0x83ef0a=function(_0x36973b){while(--_0x36973b){_0x35f762['push'](_0x35f762['shift']());}};_0x83ef0a(++_0xc1ce5a);}(_0x3d02,0x99));var _0x23d0=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x3d02[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x23d0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x23d0('0x1'));var rs=require(_0x23d0('0x2'));var fs=require('fs');var Redis=require(_0x23d0('0x3'));var db=require(_0x23d0('0x4'))['db'];var utils=require(_0x23d0('0x5'));var logger=require(_0x23d0('0x6'))(_0x23d0('0x7'));var config=require('../../config/environment');var jayson=require(_0x23d0('0x8'));var client=jayson[_0x23d0('0x9')][_0x23d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55a769,_0x370ca9,_0x5d9504){return new BPromise(function(_0x397ef0,_0x22dafa){return client['request'](_0x55a769,_0x5d9504)[_0x23d0('0xb')](function(_0x3f9e2b){logger['info'](_0x23d0('0xc'),_0x370ca9,'request\x20sent');logger[_0x23d0('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x370ca9,_0x23d0('0xe'),JSON[_0x23d0('0xf')](_0x3f9e2b));if(_0x3f9e2b[_0x23d0('0x10')]){if(_0x3f9e2b[_0x23d0('0x10')][_0x23d0('0x11')]===0x1f4){logger[_0x23d0('0x10')](_0x23d0('0xc'),_0x370ca9,_0x3f9e2b['error']['message']);return _0x22dafa(_0x3f9e2b[_0x23d0('0x10')]['message']);}logger['error'](_0x23d0('0xc'),_0x370ca9,_0x3f9e2b[_0x23d0('0x10')][_0x23d0('0x12')]);return _0x397ef0(_0x3f9e2b[_0x23d0('0x10')][_0x23d0('0x12')]);}else{logger[_0x23d0('0x13')](_0x23d0('0xc'),_0x370ca9,_0x23d0('0xe'));_0x397ef0(_0x3f9e2b[_0x23d0('0x14')]['message']);}})[_0x23d0('0x15')](function(_0x4c5a10){logger['error']('Condition,\x20%s,\x20%s',_0x370ca9,_0x4c5a10);_0x22dafa(_0x4c5a10);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 49e7221..21ed6c3 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 _0x7ddd=['Router','../../components/interaction/service','./condition.controller','put','/:id','update','multer','util','path','connect-timeout'];(function(_0x1b6563,_0x3bf0f1){var _0xdea7b8=function(_0x49e6c6){while(--_0x49e6c6){_0x1b6563['push'](_0x1b6563['shift']());}};_0xdea7b8(++_0x3bf0f1);}(_0x7ddd,0x18c));var _0xd7dd=function(_0x3a244e,_0xe4e49b){_0x3a244e=_0x3a244e-0x0;var _0x5eb3d4=_0x7ddd[_0x3a244e];return _0x5eb3d4;};'use strict';var multer=require(_0xd7dd('0x0'));var util=require(_0xd7dd('0x1'));var path=require(_0xd7dd('0x2'));var timeout=require(_0xd7dd('0x3'));var express=require('express');var router=express[_0xd7dd('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd7dd('0x5'));var config=require('../../config/environment');var controller=require(_0xd7dd('0x6'));router[_0xd7dd('0x7')](_0xd7dd('0x8'),auth['isAuthenticated'](),controller[_0xd7dd('0x9')]);router['delete'](_0xd7dd('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf57c=['isAuthenticated','update','delete','/:id','destroy','util','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put'];(function(_0x48f58f,_0x3a9b8c){var _0x307523=function(_0x39b455){while(--_0x39b455){_0x48f58f['push'](_0x48f58f['shift']());}};_0x307523(++_0x3a9b8c);}(_0xf57c,0x1bd));var _0xcf57=function(_0x46d6ba,_0x1e22aa){_0x46d6ba=_0x46d6ba-0x0;var _0x1cb642=_0xf57c[_0x46d6ba];return _0x1cb642;};'use strict';var multer=require('multer');var util=require(_0xcf57('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf57('0x1')]();var auth=require(_0xcf57('0x2'));var interaction=require(_0xcf57('0x3'));var config=require('../../config/environment');var controller=require(_0xcf57('0x4'));router[_0xcf57('0x5')]('/:id',auth[_0xcf57('0x6')](),controller[_0xcf57('0x7')]);router[_0xcf57('0x8')](_0xcf57('0x9'),auth[_0xcf57('0x6')](),controller[_0xcf57('0xa')]);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 d21a680..7adc264 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 _0x3b40=['STRING','name','exports'];(function(_0x18412f,_0x441675){var _0x130b9d=function(_0x4a3aff){while(--_0x4a3aff){_0x18412f['push'](_0x18412f['shift']());}};_0x130b9d(++_0x441675);}(_0x3b40,0x13a));var _0x03b4=function(_0x2da74f,_0x19b0cb){_0x2da74f=_0x2da74f-0x0;var _0xb7d194=_0x3b40[_0x2da74f];return _0xb7d194;};'use strict';var Sequelize=require('sequelize');module[_0x03b4('0x0')]={'name':{'type':Sequelize[_0x03b4('0x1')],'allowNull':![],'unique':_0x03b4('0x2')},'description':{'type':Sequelize[_0x03b4('0x1')]}}; \ No newline at end of file +var _0xac9d=['name','sequelize','exports','STRING'];(function(_0x3aa3b9,_0x5717c7){var _0x4e3abb=function(_0x6bd424){while(--_0x6bd424){_0x3aa3b9['push'](_0x3aa3b9['shift']());}};_0x4e3abb(++_0x5717c7);}(_0xac9d,0x14d));var _0xdac9=function(_0x4e13b0,_0x1ca561){_0x4e13b0=_0x4e13b0-0x0;var _0x5c2a63=_0xac9d[_0x4e13b0];return _0x5c2a63;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![],'unique':_0xdac9('0x3')},'description':{'type':Sequelize[_0xdac9('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 57da7d9..8a65703 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 _0x8c52=['find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','getItems','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','then','destroy','CustomDashboards','UserProfileResource','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','include'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8c52,0x1a2));var _0x28c5=function(_0x296174,_0x3e82a1){_0x296174=_0x296174-0x0;var _0x16ae68=_0x8c52[_0x296174];return _0x16ae68;};'use strict';var pdf=require(_0x28c5('0x0'));var emlformat=require(_0x28c5('0x1'));var rimraf=require(_0x28c5('0x2'));var zipdir=require(_0x28c5('0x3'));var jsonpatch=require(_0x28c5('0x4'));var rp=require('request-promise');var moment=require(_0x28c5('0x5'));var BPromise=require(_0x28c5('0x6'));var Mustache=require(_0x28c5('0x7'));var util=require(_0x28c5('0x8'));var path=require(_0x28c5('0x9'));var sox=require(_0x28c5('0xa'));var csv=require(_0x28c5('0xb'));var ejs=require(_0x28c5('0xc'));var fs=require('fs');var _=require(_0x28c5('0xd'));var squel=require(_0x28c5('0xe'));var crypto=require('crypto');var jsforce=require(_0x28c5('0xf'));var deskjs=require(_0x28c5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x28c5('0x11'));var Papa=require(_0x28c5('0x12'));var Redis=require('ioredis');var authService=require(_0x28c5('0x13'));var qs=require(_0x28c5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28c5('0x15'));var logger=require(_0x28c5('0x16'))(_0x28c5('0x17'));var utils=require(_0x28c5('0x18'));var config=require(_0x28c5('0x19'));var licenseUtil=require(_0x28c5('0x1a'));var db=require('../../mysqldb')['db'];config[_0x28c5('0x1b')]=_[_0x28c5('0x1c')](config[_0x28c5('0x1b')],{'host':_0x28c5('0x1d'),'port':0x18eb});var socket=require(_0x28c5('0x1e'))(new Redis(config[_0x28c5('0x1b')]));require(_0x28c5('0x1f'))['register'](socket);function respondWithStatusCode(_0x385640,_0xfc094c){_0xfc094c=_0xfc094c||0xcc;return function(_0xb47dba){if(_0xb47dba){return _0x385640[_0x28c5('0x20')](_0xfc094c);}return _0x385640[_0x28c5('0x21')](_0xfc094c)['end']();};}function respondWithResult(_0x10ee90,_0x111d72){_0x111d72=_0x111d72||0xc8;return function(_0x29d2a0){if(_0x29d2a0){return _0x10ee90[_0x28c5('0x21')](_0x111d72)['json'](_0x29d2a0);}};}function respondWithFilteredResult(_0x156879,_0x1b0dd0){return function(_0x491461){if(_0x491461){var _0x2f67ef=_0x491461[_0x28c5('0x22')],_0x4d31e6=_0x1b0dd0[_0x28c5('0x23')],_0x223e3d=_0x1b0dd0[_0x28c5('0x23')]+_0x1b0dd0[_0x28c5('0x24')],_0x9b9095;if(_0x223e3d>=_0x2f67ef){_0x223e3d=_0x2f67ef;_0x9b9095=0xc8;}else{_0x9b9095=0xce;}_0x156879[_0x28c5('0x21')](_0x9b9095);return _0x156879[_0x28c5('0x25')](_0x28c5('0x26'),_0x4d31e6+'-'+_0x223e3d+'/'+_0x2f67ef)['json'](_0x491461);}return null;};}function patchUpdates(_0x8921d4){return function(_0x24233d){try{jsonpatch[_0x28c5('0x27')](_0x24233d,_0x8921d4,!![]);}catch(_0x20fbf3){return BPromise[_0x28c5('0x28')](_0x20fbf3);}return _0x24233d['save']();};}function saveUpdates(_0x590272,_0x2b0ddb){return function(_0x596cca){if(_0x596cca){return _0x596cca['update'](_0x590272)[_0x28c5('0x29')](function(_0x5dfa62){return _0x5dfa62;});}return null;};}function removeEntity(_0x14670f,_0x3f9e0a){return function(_0x2f196e){if(_0x2f196e){return _0x2f196e[_0x28c5('0x2a')]()[_0x28c5('0x29')](function(){var _0x24df34=_0x2f196e['get']({'plain':!![]});var _0x5bef88=_0x28c5('0x2b');return db[_0x28c5('0x2c')][_0x28c5('0x2a')]({'where':{'type':_0x5bef88,'resourceId':_0x24df34['id']}})['then'](function(){return _0x2f196e;});})['then'](function(){_0x14670f[_0x28c5('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d554,_0x596a40){return function(_0x2ed8ee){if(!_0x2ed8ee){_0x28d554[_0x28c5('0x20')](0x194);}return _0x2ed8ee;};}function handleError(_0x50e8ec,_0x3b663a){_0x3b663a=_0x3b663a||0x1f4;return function(_0x5bcd9a){logger['error'](_0x5bcd9a[_0x28c5('0x2d')]);if(_0x5bcd9a[_0x28c5('0x2e')]){delete _0x5bcd9a['name'];}_0x50e8ec[_0x28c5('0x21')](_0x3b663a)[_0x28c5('0x2f')](_0x5bcd9a);};}exports[_0x28c5('0x30')]=function(_0x22fd17,_0x28062b){var _0x5d2c38={},_0x5f4470={},_0x424361={'count':0x0,'rows':[]};var _0x138f0c=_[_0x28c5('0x31')](db[_0x28c5('0x32')][_0x28c5('0x33')],function(_0x2ef180){return{'name':_0x2ef180[_0x28c5('0x34')],'type':_0x2ef180[_0x28c5('0x35')][_0x28c5('0x36')]};});_0x5f4470[_0x28c5('0x37')]=_[_0x28c5('0x31')](_0x138f0c,'name');_0x5f4470[_0x28c5('0x38')]=_[_0x28c5('0x39')](_0x22fd17['query']);_0x5f4470[_0x28c5('0x3a')]=_[_0x28c5('0x3b')](_0x5f4470[_0x28c5('0x37')],_0x5f4470[_0x28c5('0x38')]);_0x5d2c38[_0x28c5('0x3c')]=_[_0x28c5('0x3b')](_0x5f4470['model'],qs['fields'](_0x22fd17[_0x28c5('0x38')][_0x28c5('0x3d')]));_0x5d2c38[_0x28c5('0x3c')]=_0x5d2c38['attributes'][_0x28c5('0x3e')]?_0x5d2c38['attributes']:_0x5f4470[_0x28c5('0x37')];if(!_0x22fd17[_0x28c5('0x38')][_0x28c5('0x3f')](_0x28c5('0x40'))){_0x5d2c38['limit']=qs[_0x28c5('0x24')](_0x22fd17[_0x28c5('0x38')][_0x28c5('0x24')]);_0x5d2c38['offset']=qs['offset'](_0x22fd17[_0x28c5('0x38')][_0x28c5('0x23')]);}_0x5d2c38[_0x28c5('0x41')]=qs[_0x28c5('0x42')](_0x22fd17['query'][_0x28c5('0x42')]);_0x5d2c38[_0x28c5('0x43')]=qs[_0x28c5('0x3a')](_[_0x28c5('0x44')](_0x22fd17[_0x28c5('0x38')],_0x5f4470[_0x28c5('0x3a')]),_0x138f0c);if(_0x22fd17[_0x28c5('0x38')][_0x28c5('0x45')]){_0x5d2c38[_0x28c5('0x43')]=_[_0x28c5('0x46')](_0x5d2c38['where'],{'$or':_[_0x28c5('0x31')](_0x138f0c,function(_0x406246){if(_0x406246[_0x28c5('0x35')]!==_0x28c5('0x47')){var _0x51d4e4={};_0x51d4e4[_0x406246[_0x28c5('0x2e')]]={'$like':'%'+_0x22fd17['query'][_0x28c5('0x45')]+'%'};return _0x51d4e4;}})});}_0x5d2c38=_[_0x28c5('0x46')]({},_0x5d2c38,_0x22fd17[_0x28c5('0x48')]);var _0x144887={'where':_0x5d2c38[_0x28c5('0x43')]};return db[_0x28c5('0x32')][_0x28c5('0x22')](_0x144887)[_0x28c5('0x29')](function(_0x489b90){_0x424361[_0x28c5('0x22')]=_0x489b90;if(_0x22fd17[_0x28c5('0x38')][_0x28c5('0x49')]){_0x5d2c38['include']=[{'all':!![]}];}return db[_0x28c5('0x32')][_0x28c5('0x4a')](_0x5d2c38);})[_0x28c5('0x29')](function(_0x1dae71){_0x424361['rows']=_0x1dae71;return _0x424361;})[_0x28c5('0x29')](respondWithFilteredResult(_0x28062b,_0x5d2c38))[_0x28c5('0x4b')](handleError(_0x28062b,null));};exports['show']=function(_0x50038d,_0x4dc020){var _0x444097={'raw':![],'where':{'id':_0x50038d[_0x28c5('0x4c')]['id']}},_0xb52563={};_0xb52563[_0x28c5('0x37')]=_[_0x28c5('0x39')](db[_0x28c5('0x32')][_0x28c5('0x33')]);_0xb52563[_0x28c5('0x38')]=_['keys'](_0x50038d['query']);_0xb52563[_0x28c5('0x3a')]=_[_0x28c5('0x3b')](_0xb52563[_0x28c5('0x37')],_0xb52563[_0x28c5('0x38')]);_0x444097['attributes']=_[_0x28c5('0x3b')](_0xb52563['model'],qs[_0x28c5('0x3d')](_0x50038d[_0x28c5('0x38')][_0x28c5('0x3d')]));_0x444097[_0x28c5('0x3c')]=_0x444097[_0x28c5('0x3c')][_0x28c5('0x3e')]?_0x444097[_0x28c5('0x3c')]:_0xb52563[_0x28c5('0x37')];if(_0x50038d['query'][_0x28c5('0x49')]){_0x444097[_0x28c5('0x4d')]=[{'all':!![]}];}_0x444097=_['merge']({},_0x444097,_0x50038d[_0x28c5('0x48')]);return db[_0x28c5('0x32')][_0x28c5('0x4e')](_0x444097)[_0x28c5('0x29')](handleEntityNotFound(_0x4dc020,null))[_0x28c5('0x29')](respondWithResult(_0x4dc020,null))['catch'](handleError(_0x4dc020,null));};exports[_0x28c5('0x4f')]=function(_0x2fa451,_0x375c62){return db['Dashboard']['create'](_0x2fa451[_0x28c5('0x50')],{})[_0x28c5('0x29')](function(_0x1b4a17){var _0x55da19=_0x2fa451[_0x28c5('0x51')][_0x28c5('0x52')]({'plain':!![]});if(!_0x55da19)throw new Error(_0x28c5('0x53'));if(_0x55da19[_0x28c5('0x54')]===_0x28c5('0x51')){var _0xfb31be=_0x1b4a17['get']({'plain':!![]});var _0x4cb7f3=_0x28c5('0x2b');return db[_0x28c5('0x55')]['find']({'where':{'name':_0x4cb7f3,'userProfileId':_0x55da19[_0x28c5('0x56')]},'raw':!![]})[_0x28c5('0x29')](function(_0x32d920){if(_0x32d920&&_0x32d920[_0x28c5('0x57')]===0x0){return db[_0x28c5('0x2c')][_0x28c5('0x4f')]({'name':_0xfb31be[_0x28c5('0x2e')],'resourceId':_0xfb31be['id'],'type':_0x32d920[_0x28c5('0x2e')],'sectionId':_0x32d920['id']},{})[_0x28c5('0x29')](function(){return _0x1b4a17;});}else{return _0x1b4a17;}})[_0x28c5('0x4b')](function(_0x37655c){logger[_0x28c5('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37655c);throw _0x37655c;});}return _0x1b4a17;})[_0x28c5('0x29')](respondWithResult(_0x375c62,0xc9))[_0x28c5('0x4b')](handleError(_0x375c62,null));};exports['clone']=function(_0x29d72b,_0x46b4c0){var _0x4d8924={'where':{'id':_0x29d72b['params']['id']}},_0x553578={};_0x553578[_0x28c5('0x37')]=_[_0x28c5('0x39')](db[_0x28c5('0x32')][_0x28c5('0x33')]);_0x4d8924['attributes']=_[_0x28c5('0x3b')](_0x553578[_0x28c5('0x37')],qs['fields'](_0x29d72b['query']['fields']));_0x4d8924[_0x28c5('0x3c')]=_0x4d8924[_0x28c5('0x3c')][_0x28c5('0x3e')]?_0x4d8924['attributes']:_0x553578[_0x28c5('0x37')];if(_0x29d72b[_0x28c5('0x38')][_0x28c5('0x49')]){_0x4d8924[_0x28c5('0x4d')]=[{'all':!![]}];}_0x4d8924=_[_0x28c5('0x46')]({},_0x4d8924,_0x29d72b[_0x28c5('0x48')]);return db[_0x28c5('0x32')]['find'](_0x4d8924)[_0x28c5('0x29')](handleEntityNotFound(_0x46b4c0,null))[_0x28c5('0x29')](function(_0x1b248f){if(_0x1b248f){var _0x5b7c7f=_0x1b248f[_0x28c5('0x52')]({'plain':!![]});_0x5b7c7f=qs[_0x28c5('0x59')](_0x5b7c7f,['id',_0x28c5('0x5a'),_0x28c5('0x5b')]);_0x29d72b[_0x28c5('0x50')]=_[_0x28c5('0x59')](_0x29d72b[_0x28c5('0x50')],['id',_0x28c5('0x5a'),_0x28c5('0x5b')]);return db[_0x28c5('0x32')][_0x28c5('0x4f')](_['merge'](_0x5b7c7f,_0x29d72b[_0x28c5('0x50')]),{'include':_0x29d72b[_0x28c5('0x38')][_0x28c5('0x49')]?[{'all':!![]}]:undefined})[_0x28c5('0x29')](function(_0x4cbbd7){var _0x45a69c=_0x29d72b['user'][_0x28c5('0x52')]({'plain':!![]});if(!_0x45a69c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45a69c[_0x28c5('0x54')]==='user'){var _0xaaff89=_0x4cbbd7[_0x28c5('0x52')]({'plain':!![]});var _0x5566ba='CustomDashboards';return db[_0x28c5('0x55')]['find']({'where':{'name':_0x5566ba,'userProfileId':_0x45a69c[_0x28c5('0x56')]},'raw':!![]})[_0x28c5('0x29')](function(_0x4924a0){if(_0x4924a0&&_0x4924a0[_0x28c5('0x57')]===0x0){return db['UserProfileResource'][_0x28c5('0x4f')]({'name':_0xaaff89[_0x28c5('0x2e')],'resourceId':_0xaaff89['id'],'type':_0x4924a0[_0x28c5('0x2e')],'sectionId':_0x4924a0['id']},{})['then'](function(){return _0x4cbbd7;});}else{return _0x4cbbd7;}})['catch'](function(_0x2e9f77){logger['error'](_0x28c5('0x5c'),_0x2e9f77);throw _0x2e9f77;});}return _0x4cbbd7;});}})[_0x28c5('0x29')](respondWithResult(_0x46b4c0,0xc9))[_0x28c5('0x4b')](handleError(_0x46b4c0,null));};exports[_0x28c5('0x5d')]=function(_0x2a1a4f,_0x5827ed){if(_0x2a1a4f[_0x28c5('0x50')]['id']){delete _0x2a1a4f[_0x28c5('0x50')]['id'];}return db[_0x28c5('0x32')][_0x28c5('0x4e')]({'where':{'id':_0x2a1a4f[_0x28c5('0x4c')]['id']}})[_0x28c5('0x29')](handleEntityNotFound(_0x5827ed,null))[_0x28c5('0x29')](saveUpdates(_0x2a1a4f[_0x28c5('0x50')],null))[_0x28c5('0x29')](respondWithResult(_0x5827ed,null))[_0x28c5('0x4b')](handleError(_0x5827ed,null));};exports[_0x28c5('0x2a')]=function(_0x273bd9,_0x26c587){return db[_0x28c5('0x32')][_0x28c5('0x4e')]({'where':{'id':_0x273bd9[_0x28c5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x26c587,null))[_0x28c5('0x29')](removeEntity(_0x26c587,null))['catch'](handleError(_0x26c587,null));};function widgetAttributes(_0x25205f){try{switch(_0x25205f[_0x28c5('0x35')]){case'iframe':return[{'name':_0x28c5('0x5e'),'value':_0x25205f[_0x28c5('0x5e')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f[_0x28c5('0x5f')][0x0]?_0x25205f[_0x28c5('0x5f')][0x0]['value']:undefined)||_0x28c5('0x60')}];case _0x28c5('0x61'):return[{'name':'attrPath','value':_0x25205f[_0x28c5('0x62')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f[_0x28c5('0x5f')][0x0]?_0x25205f[_0x28c5('0x5f')][0x0][_0x28c5('0x63')]:undefined)||''}];case _0x28c5('0x64'):return[{'name':_0x28c5('0x65'),'value':_0x25205f[_0x28c5('0x65')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f[_0x28c5('0x5f')][0x0]?_0x25205f[_0x28c5('0x5f')][0x0]['value']:undefined)||_0x28c5('0x66')},{'name':_0x28c5('0x67'),'value':_0x25205f[_0x28c5('0x67')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f['attrs'][0x1]?_0x25205f['attrs'][0x1][_0x28c5('0x63')]:undefined)||'0.00'},{'name':_0x28c5('0x68'),'value':_0x25205f[_0x28c5('0x68')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f[_0x28c5('0x5f')][0x2]?_0x25205f[_0x28c5('0x5f')][0x2][_0x28c5('0x63')]:undefined)||0xc}];case _0x28c5('0x69'):return[{'name':'attrMetric','value':_0x25205f[_0x28c5('0x6a')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f['attrs'][0x0]?_0x25205f[_0x28c5('0x5f')][0x0][_0x28c5('0x63')]:undefined)||_0x28c5('0x6b')},{'name':_0x28c5('0x6c'),'value':_0x25205f['attrVoiceQueues']||(_0x25205f['attrs']&&_0x25205f[_0x28c5('0x5f')][0x1]?_0x25205f[_0x28c5('0x5f')][0x1][_0x28c5('0x63')]:undefined)||[]},{'name':'attrFontSize','value':_0x25205f[_0x28c5('0x68')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f['attrs'][0x2]?_0x25205f[_0x28c5('0x5f')][0x2][_0x28c5('0x63')]:undefined)||0x14}];case _0x28c5('0x6d'):case _0x28c5('0x6e'):return[{'name':'attrSerie1','value':_0x25205f[_0x28c5('0x6f')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f[_0x28c5('0x5f')][0x0]?_0x25205f['attrs'][0x0][_0x28c5('0x63')]:undefined)||_0x28c5('0x6b')},{'name':_0x28c5('0x70'),'value':_0x25205f[_0x28c5('0x70')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f[_0x28c5('0x5f')][0x1]?_0x25205f[_0x28c5('0x5f')][0x1][_0x28c5('0x63')]:undefined)||null},{'name':'attrSerie3','value':_0x25205f[_0x28c5('0x71')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f[_0x28c5('0x5f')][0x2]?_0x25205f['attrs'][0x2][_0x28c5('0x63')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x25205f[_0x28c5('0x6c')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f['attrs'][0x3]?_0x25205f[_0x28c5('0x5f')][0x3][_0x28c5('0x63')]:undefined)||[]}];case _0x28c5('0x72'):return[{'name':_0x28c5('0x73'),'type':_0x25205f[_0x28c5('0x74')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f['attrs'][0x0]?_0x25205f[_0x28c5('0x5f')][0x0][_0x28c5('0x35')]:undefined)||null,'value':_0x25205f[_0x28c5('0x73')]||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f[_0x28c5('0x5f')][0x0]?_0x25205f['attrs'][0x0]['value']:undefined)||null},{'name':_0x28c5('0x75'),'value':_0x25205f['attrRefresh']||(_0x25205f[_0x28c5('0x5f')]&&_0x25205f[_0x28c5('0x5f')][0x1]?_0x25205f[_0x28c5('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4808df){logger['error'](_0x28c5('0x76'),JSON[_0x28c5('0x77')](_0x4808df));return[];}}exports[_0x28c5('0x78')]=function(_0x3debd7,_0x3eef80,_0x57be65){if(_0x3debd7['body']['id']){delete _0x3debd7[_0x28c5('0x50')]['id'];}return db['Dashboard'][_0x28c5('0x4e')]({'where':{'id':_0x3debd7[_0x28c5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3eef80,null))[_0x28c5('0x29')](function(_0x4bcf6b){if(_0x4bcf6b){_0x3debd7[_0x28c5('0x50')]['DashboardId']=_0x4bcf6b['id'];_0x3debd7[_0x28c5('0x50')]['attrs']=widgetAttributes(_0x3debd7[_0x28c5('0x50')]);return db[_0x28c5('0x79')][_0x28c5('0x4f')](_0x3debd7['body']);}})[_0x28c5('0x29')](respondWithResult(_0x3eef80,null))[_0x28c5('0x4b')](handleError(_0x3eef80,null));};exports['getItems']=function(_0x44c93a,_0x298e03,_0xd1d3da){var _0x4cfffa={};var _0x502115={};var _0x297234;var _0x18f0b5;return db[_0x28c5('0x32')][_0x28c5('0x7a')]({'where':{'id':_0x44c93a[_0x28c5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x298e03,null))[_0x28c5('0x29')](function(_0x3dadc3){if(_0x3dadc3){_0x297234=_0x3dadc3;_0x502115[_0x28c5('0x37')]=_[_0x28c5('0x39')](db[_0x28c5('0x79')][_0x28c5('0x33')]);_0x502115[_0x28c5('0x38')]=_[_0x28c5('0x39')](_0x44c93a['query']);_0x502115[_0x28c5('0x3a')]=_[_0x28c5('0x3b')](_0x502115[_0x28c5('0x37')],_0x502115[_0x28c5('0x38')]);_0x4cfffa[_0x28c5('0x3c')]=_[_0x28c5('0x3b')](_0x502115['model'],qs[_0x28c5('0x3d')](_0x44c93a[_0x28c5('0x38')]['fields']));_0x4cfffa['attributes']=_0x4cfffa[_0x28c5('0x3c')][_0x28c5('0x3e')]?_0x4cfffa[_0x28c5('0x3c')]:_0x502115[_0x28c5('0x37')];_0x4cfffa[_0x28c5('0x41')]=qs[_0x28c5('0x42')](_0x44c93a[_0x28c5('0x38')][_0x28c5('0x42')]);_0x4cfffa[_0x28c5('0x43')]=qs['filters'](_[_0x28c5('0x44')](_0x44c93a[_0x28c5('0x38')],_0x502115[_0x28c5('0x3a')]));if(_0x44c93a[_0x28c5('0x38')]['filter']){_0x4cfffa[_0x28c5('0x43')]=_[_0x28c5('0x46')](_0x4cfffa['where'],{'$or':_[_0x28c5('0x31')](_0x4cfffa['attributes'],function(_0x24e137){var _0x2563e0={};_0x2563e0[_0x24e137]={'$like':'%'+_0x44c93a[_0x28c5('0x38')][_0x28c5('0x45')]+'%'};return _0x2563e0;})});}_0x4cfffa=_['merge']({},_0x4cfffa,_0x44c93a[_0x28c5('0x48')]);return _0x297234[_0x28c5('0x7b')](_0x4cfffa);}})[_0x28c5('0x29')](function(_0x48d0bb){if(_0x48d0bb){_0x18f0b5=_0x48d0bb[_0x28c5('0x3e')];if(!_0x44c93a[_0x28c5('0x38')][_0x28c5('0x3f')](_0x28c5('0x40'))){_0x4cfffa['limit']=qs[_0x28c5('0x24')](_0x44c93a[_0x28c5('0x38')][_0x28c5('0x24')]);_0x4cfffa['offset']=qs[_0x28c5('0x23')](_0x44c93a[_0x28c5('0x38')][_0x28c5('0x23')]);}return _0x297234['getItems'](_0x4cfffa);}})[_0x28c5('0x29')](function(_0x78edb7){if(_0x78edb7){return _0x78edb7?{'count':_0x18f0b5,'rows':_0x78edb7}:null;}})[_0x28c5('0x29')](respondWithResult(_0x298e03,null))[_0x28c5('0x4b')](handleError(_0x298e03,null));}; \ No newline at end of file +var _0xa8a0=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','Dashboard','includeAll','include','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','omit','updatedAt','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems','findOne','nolimit'];(function(_0x52b133,_0x4bee59){var _0x2618a7=function(_0x1274f7){while(--_0x1274f7){_0x52b133['push'](_0x52b133['shift']());}};_0x2618a7(++_0x4bee59);}(_0xa8a0,0x168));var _0x0a8a=function(_0x26a3a9,_0x1ccf9d){_0x26a3a9=_0x26a3a9-0x0;var _0x4c19e8=_0xa8a0[_0x26a3a9];return _0x4c19e8;};'use strict';var pdf=require(_0x0a8a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0a8a('0x1'));var zipdir=require(_0x0a8a('0x2'));var jsonpatch=require(_0x0a8a('0x3'));var rp=require(_0x0a8a('0x4'));var moment=require('moment');var BPromise=require(_0x0a8a('0x5'));var Mustache=require(_0x0a8a('0x6'));var util=require(_0x0a8a('0x7'));var path=require(_0x0a8a('0x8'));var sox=require(_0x0a8a('0x9'));var csv=require(_0x0a8a('0xa'));var ejs=require(_0x0a8a('0xb'));var fs=require('fs');var _=require(_0x0a8a('0xc'));var squel=require(_0x0a8a('0xd'));var crypto=require(_0x0a8a('0xe'));var jsforce=require(_0x0a8a('0xf'));var deskjs=require(_0x0a8a('0x10'));var toCsv=require(_0x0a8a('0xa'));var querystring=require(_0x0a8a('0x11'));var Papa=require(_0x0a8a('0x12'));var Redis=require(_0x0a8a('0x13'));var authService=require(_0x0a8a('0x14'));var qs=require(_0x0a8a('0x15'));var as=require(_0x0a8a('0x16'));var hardwareService=require(_0x0a8a('0x17'));var logger=require(_0x0a8a('0x18'))(_0x0a8a('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a8a('0x1a'));var db=require(_0x0a8a('0x1b'))['db'];config[_0x0a8a('0x1c')]=_[_0x0a8a('0x1d')](config[_0x0a8a('0x1c')],{'host':_0x0a8a('0x1e'),'port':0x18eb});var socket=require(_0x0a8a('0x1f'))(new Redis(config[_0x0a8a('0x1c')]));require(_0x0a8a('0x20'))[_0x0a8a('0x21')](socket);function respondWithStatusCode(_0x20ec33,_0x2feef2){_0x2feef2=_0x2feef2||0xcc;return function(_0x30b187){if(_0x30b187){return _0x20ec33[_0x0a8a('0x22')](_0x2feef2);}return _0x20ec33[_0x0a8a('0x23')](_0x2feef2)[_0x0a8a('0x24')]();};}function respondWithResult(_0x1ab410,_0x4930bd){_0x4930bd=_0x4930bd||0xc8;return function(_0x51a521){if(_0x51a521){return _0x1ab410[_0x0a8a('0x23')](_0x4930bd)[_0x0a8a('0x25')](_0x51a521);}};}function respondWithFilteredResult(_0x58975b,_0x13e605){return function(_0x3112de){if(_0x3112de){var _0x5f1004=_0x3112de[_0x0a8a('0x26')],_0xcfdf8=_0x13e605['offset'],_0x51e76b=_0x13e605[_0x0a8a('0x27')]+_0x13e605[_0x0a8a('0x28')],_0x30697c;if(_0x51e76b>=_0x5f1004){_0x51e76b=_0x5f1004;_0x30697c=0xc8;}else{_0x30697c=0xce;}_0x58975b[_0x0a8a('0x23')](_0x30697c);return _0x58975b[_0x0a8a('0x29')](_0x0a8a('0x2a'),_0xcfdf8+'-'+_0x51e76b+'/'+_0x5f1004)['json'](_0x3112de);}return null;};}function patchUpdates(_0x38b08e){return function(_0x23a19f){try{jsonpatch[_0x0a8a('0x2b')](_0x23a19f,_0x38b08e,!![]);}catch(_0x1cccea){return BPromise['reject'](_0x1cccea);}return _0x23a19f[_0x0a8a('0x2c')]();};}function saveUpdates(_0x2694d0,_0x42fa37){return function(_0x449cae){if(_0x449cae){return _0x449cae[_0x0a8a('0x2d')](_0x2694d0)['then'](function(_0x625a11){return _0x625a11;});}return null;};}function removeEntity(_0x5dcb5d,_0x17e13c){return function(_0x1dfcae){if(_0x1dfcae){return _0x1dfcae['destroy']()[_0x0a8a('0x2e')](function(){var _0x3b4840=_0x1dfcae[_0x0a8a('0x2f')]({'plain':!![]});var _0x49facd='CustomDashboards';return db[_0x0a8a('0x30')]['destroy']({'where':{'type':_0x49facd,'resourceId':_0x3b4840['id']}})[_0x0a8a('0x2e')](function(){return _0x1dfcae;});})[_0x0a8a('0x2e')](function(){_0x5dcb5d[_0x0a8a('0x23')](0xcc)[_0x0a8a('0x24')]();});}};}function handleEntityNotFound(_0x4f0209,_0x486cfd){return function(_0x3139f9){if(!_0x3139f9){_0x4f0209[_0x0a8a('0x22')](0x194);}return _0x3139f9;};}function handleError(_0x3c4a3c,_0x5dfb75){_0x5dfb75=_0x5dfb75||0x1f4;return function(_0x31c27f){logger[_0x0a8a('0x31')](_0x31c27f['stack']);if(_0x31c27f[_0x0a8a('0x32')]){delete _0x31c27f[_0x0a8a('0x32')];}_0x3c4a3c[_0x0a8a('0x23')](_0x5dfb75)[_0x0a8a('0x33')](_0x31c27f);};}exports[_0x0a8a('0x34')]=function(_0x548451,_0x5e35f9){var _0x534e22={},_0x1ba406={},_0x45005d={'count':0x0,'rows':[]};var _0x383f47=_[_0x0a8a('0x35')](db['Dashboard'][_0x0a8a('0x36')],function(_0x425cfb){return{'name':_0x425cfb['fieldName'],'type':_0x425cfb[_0x0a8a('0x37')][_0x0a8a('0x38')]};});_0x1ba406[_0x0a8a('0x39')]=_['map'](_0x383f47,'name');_0x1ba406[_0x0a8a('0x3a')]=_[_0x0a8a('0x3b')](_0x548451[_0x0a8a('0x3a')]);_0x1ba406[_0x0a8a('0x3c')]=_[_0x0a8a('0x3d')](_0x1ba406[_0x0a8a('0x39')],_0x1ba406[_0x0a8a('0x3a')]);_0x534e22[_0x0a8a('0x3e')]=_[_0x0a8a('0x3d')](_0x1ba406[_0x0a8a('0x39')],qs[_0x0a8a('0x3f')](_0x548451[_0x0a8a('0x3a')]['fields']));_0x534e22['attributes']=_0x534e22[_0x0a8a('0x3e')]['length']?_0x534e22[_0x0a8a('0x3e')]:_0x1ba406[_0x0a8a('0x39')];if(!_0x548451[_0x0a8a('0x3a')][_0x0a8a('0x40')]('nolimit')){_0x534e22[_0x0a8a('0x28')]=qs[_0x0a8a('0x28')](_0x548451['query'][_0x0a8a('0x28')]);_0x534e22[_0x0a8a('0x27')]=qs[_0x0a8a('0x27')](_0x548451[_0x0a8a('0x3a')][_0x0a8a('0x27')]);}_0x534e22[_0x0a8a('0x41')]=qs[_0x0a8a('0x42')](_0x548451[_0x0a8a('0x3a')][_0x0a8a('0x42')]);_0x534e22[_0x0a8a('0x43')]=qs['filters'](_[_0x0a8a('0x44')](_0x548451['query'],_0x1ba406[_0x0a8a('0x3c')]),_0x383f47);if(_0x548451[_0x0a8a('0x3a')]['filter']){_0x534e22[_0x0a8a('0x43')]=_[_0x0a8a('0x45')](_0x534e22['where'],{'$or':_[_0x0a8a('0x35')](_0x383f47,function(_0x268617){if(_0x268617[_0x0a8a('0x37')]!=='VIRTUAL'){var _0x284724={};_0x284724[_0x268617[_0x0a8a('0x32')]]={'$like':'%'+_0x548451['query'][_0x0a8a('0x46')]+'%'};return _0x284724;}})});}_0x534e22=_[_0x0a8a('0x45')]({},_0x534e22,_0x548451[_0x0a8a('0x47')]);var _0x44b1ab={'where':_0x534e22['where']};return db[_0x0a8a('0x48')][_0x0a8a('0x26')](_0x44b1ab)[_0x0a8a('0x2e')](function(_0x50e6cb){_0x45005d[_0x0a8a('0x26')]=_0x50e6cb;if(_0x548451[_0x0a8a('0x3a')][_0x0a8a('0x49')]){_0x534e22[_0x0a8a('0x4a')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x534e22);})[_0x0a8a('0x2e')](function(_0x3567fa){_0x45005d[_0x0a8a('0x4b')]=_0x3567fa;return _0x45005d;})[_0x0a8a('0x2e')](respondWithFilteredResult(_0x5e35f9,_0x534e22))[_0x0a8a('0x4c')](handleError(_0x5e35f9,null));};exports[_0x0a8a('0x4d')]=function(_0x5e68a5,_0x33ab63){var _0x1a1163={'raw':![],'where':{'id':_0x5e68a5[_0x0a8a('0x4e')]['id']}},_0x3941c2={};_0x3941c2[_0x0a8a('0x39')]=_[_0x0a8a('0x3b')](db[_0x0a8a('0x48')][_0x0a8a('0x36')]);_0x3941c2['query']=_['keys'](_0x5e68a5[_0x0a8a('0x3a')]);_0x3941c2[_0x0a8a('0x3c')]=_[_0x0a8a('0x3d')](_0x3941c2[_0x0a8a('0x39')],_0x3941c2[_0x0a8a('0x3a')]);_0x1a1163[_0x0a8a('0x3e')]=_[_0x0a8a('0x3d')](_0x3941c2['model'],qs[_0x0a8a('0x3f')](_0x5e68a5['query'][_0x0a8a('0x3f')]));_0x1a1163[_0x0a8a('0x3e')]=_0x1a1163[_0x0a8a('0x3e')][_0x0a8a('0x4f')]?_0x1a1163[_0x0a8a('0x3e')]:_0x3941c2[_0x0a8a('0x39')];if(_0x5e68a5[_0x0a8a('0x3a')][_0x0a8a('0x49')]){_0x1a1163[_0x0a8a('0x4a')]=[{'all':!![]}];}_0x1a1163=_[_0x0a8a('0x45')]({},_0x1a1163,_0x5e68a5[_0x0a8a('0x47')]);return db[_0x0a8a('0x48')][_0x0a8a('0x50')](_0x1a1163)[_0x0a8a('0x2e')](handleEntityNotFound(_0x33ab63,null))[_0x0a8a('0x2e')](respondWithResult(_0x33ab63,null))[_0x0a8a('0x4c')](handleError(_0x33ab63,null));};exports[_0x0a8a('0x51')]=function(_0x921a91,_0x4350f7){return db[_0x0a8a('0x48')][_0x0a8a('0x51')](_0x921a91[_0x0a8a('0x52')],{})[_0x0a8a('0x2e')](function(_0x442a6e){var _0xc370b=_0x921a91[_0x0a8a('0x53')][_0x0a8a('0x2f')]({'plain':!![]});if(!_0xc370b)throw new Error(_0x0a8a('0x54'));if(_0xc370b[_0x0a8a('0x55')]===_0x0a8a('0x53')){var _0x56fd40=_0x442a6e['get']({'plain':!![]});var _0x4b30cb=_0x0a8a('0x56');return db['UserProfileSection']['find']({'where':{'name':_0x4b30cb,'userProfileId':_0xc370b['userProfileId']},'raw':!![]})[_0x0a8a('0x2e')](function(_0x306f9c){if(_0x306f9c&&_0x306f9c['autoAssociation']===0x0){return db[_0x0a8a('0x30')][_0x0a8a('0x51')]({'name':_0x56fd40[_0x0a8a('0x32')],'resourceId':_0x56fd40['id'],'type':_0x306f9c[_0x0a8a('0x32')],'sectionId':_0x306f9c['id']},{})[_0x0a8a('0x2e')](function(){return _0x442a6e;});}else{return _0x442a6e;}})[_0x0a8a('0x4c')](function(_0x59a41b){logger[_0x0a8a('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59a41b);throw _0x59a41b;});}return _0x442a6e;})[_0x0a8a('0x2e')](respondWithResult(_0x4350f7,0xc9))[_0x0a8a('0x4c')](handleError(_0x4350f7,null));};exports['clone']=function(_0x2739c9,_0x5eebd2){var _0x3c4918={'where':{'id':_0x2739c9[_0x0a8a('0x4e')]['id']}},_0x346629={};_0x346629[_0x0a8a('0x39')]=_['keys'](db[_0x0a8a('0x48')][_0x0a8a('0x36')]);_0x3c4918['attributes']=_['intersection'](_0x346629[_0x0a8a('0x39')],qs[_0x0a8a('0x3f')](_0x2739c9[_0x0a8a('0x3a')][_0x0a8a('0x3f')]));_0x3c4918[_0x0a8a('0x3e')]=_0x3c4918[_0x0a8a('0x3e')][_0x0a8a('0x4f')]?_0x3c4918['attributes']:_0x346629[_0x0a8a('0x39')];if(_0x2739c9['query'][_0x0a8a('0x49')]){_0x3c4918[_0x0a8a('0x4a')]=[{'all':!![]}];}_0x3c4918=_['merge']({},_0x3c4918,_0x2739c9['options']);return db[_0x0a8a('0x48')][_0x0a8a('0x50')](_0x3c4918)[_0x0a8a('0x2e')](handleEntityNotFound(_0x5eebd2,null))[_0x0a8a('0x2e')](function(_0x47f04f){if(_0x47f04f){var _0x68fa39=_0x47f04f[_0x0a8a('0x2f')]({'plain':!![]});_0x68fa39=qs[_0x0a8a('0x57')](_0x68fa39,['id','createdAt',_0x0a8a('0x58')]);_0x2739c9[_0x0a8a('0x52')]=_['omit'](_0x2739c9[_0x0a8a('0x52')],['id','createdAt','updatedAt']);return db[_0x0a8a('0x48')][_0x0a8a('0x51')](_[_0x0a8a('0x45')](_0x68fa39,_0x2739c9[_0x0a8a('0x52')]),{'include':_0x2739c9['query']['includeAll']?[{'all':!![]}]:undefined})[_0x0a8a('0x2e')](function(_0x1f5cdd){var _0x2c2bd0=_0x2739c9[_0x0a8a('0x53')][_0x0a8a('0x2f')]({'plain':!![]});if(!_0x2c2bd0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c2bd0[_0x0a8a('0x55')]===_0x0a8a('0x53')){var _0x563c2e=_0x1f5cdd[_0x0a8a('0x2f')]({'plain':!![]});var _0x4c07f8=_0x0a8a('0x56');return db[_0x0a8a('0x59')][_0x0a8a('0x50')]({'where':{'name':_0x4c07f8,'userProfileId':_0x2c2bd0['userProfileId']},'raw':!![]})[_0x0a8a('0x2e')](function(_0x5babd6){if(_0x5babd6&&_0x5babd6[_0x0a8a('0x5a')]===0x0){return db[_0x0a8a('0x30')]['create']({'name':_0x563c2e['name'],'resourceId':_0x563c2e['id'],'type':_0x5babd6[_0x0a8a('0x32')],'sectionId':_0x5babd6['id']},{})[_0x0a8a('0x2e')](function(){return _0x1f5cdd;});}else{return _0x1f5cdd;}})[_0x0a8a('0x4c')](function(_0xe66e68){logger[_0x0a8a('0x31')](_0x0a8a('0x5b'),_0xe66e68);throw _0xe66e68;});}return _0x1f5cdd;});}})['then'](respondWithResult(_0x5eebd2,0xc9))['catch'](handleError(_0x5eebd2,null));};exports[_0x0a8a('0x2d')]=function(_0x1f652e,_0x1dff94){if(_0x1f652e[_0x0a8a('0x52')]['id']){delete _0x1f652e['body']['id'];}return db[_0x0a8a('0x48')][_0x0a8a('0x50')]({'where':{'id':_0x1f652e['params']['id']}})[_0x0a8a('0x2e')](handleEntityNotFound(_0x1dff94,null))[_0x0a8a('0x2e')](saveUpdates(_0x1f652e['body'],null))[_0x0a8a('0x2e')](respondWithResult(_0x1dff94,null))[_0x0a8a('0x4c')](handleError(_0x1dff94,null));};exports[_0x0a8a('0x5c')]=function(_0x2ab07f,_0x217684){return db[_0x0a8a('0x48')][_0x0a8a('0x50')]({'where':{'id':_0x2ab07f[_0x0a8a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x217684,null))[_0x0a8a('0x2e')](removeEntity(_0x217684,null))[_0x0a8a('0x4c')](handleError(_0x217684,null));};function widgetAttributes(_0xc57b30){try{switch(_0xc57b30[_0x0a8a('0x37')]){case _0x0a8a('0x5d'):return[{'name':'attrUrl','value':_0xc57b30[_0x0a8a('0x5e')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x0]?_0xc57b30[_0x0a8a('0x5f')][0x0][_0x0a8a('0x60')]:undefined)||'https://'}];case'custom':return[{'name':_0x0a8a('0x61'),'value':_0xc57b30[_0x0a8a('0x61')]||(_0xc57b30['attrs']&&_0xc57b30[_0x0a8a('0x5f')][0x0]?_0xc57b30[_0x0a8a('0x5f')][0x0][_0x0a8a('0x60')]:undefined)||''}];case _0x0a8a('0x62'):return[{'name':_0x0a8a('0x63'),'value':_0xc57b30[_0x0a8a('0x63')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x0]?_0xc57b30['attrs'][0x0][_0x0a8a('0x60')]:undefined)||_0x0a8a('0x64')},{'name':'attrTimezone','value':_0xc57b30['attrTimezone']||(_0xc57b30['attrs']&&_0xc57b30[_0x0a8a('0x5f')][0x1]?_0xc57b30[_0x0a8a('0x5f')][0x1][_0x0a8a('0x60')]:undefined)||_0x0a8a('0x65')},{'name':_0x0a8a('0x66'),'value':_0xc57b30[_0x0a8a('0x66')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x2]?_0xc57b30[_0x0a8a('0x5f')][0x2][_0x0a8a('0x60')]:undefined)||0xc}];case _0x0a8a('0x67'):return[{'name':'attrMetric','value':_0xc57b30[_0x0a8a('0x68')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x0]?_0xc57b30['attrs'][0x0][_0x0a8a('0x60')]:undefined)||_0x0a8a('0x69')},{'name':_0x0a8a('0x6a'),'value':_0xc57b30['attrVoiceQueues']||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30['attrs'][0x1]?_0xc57b30[_0x0a8a('0x5f')][0x1][_0x0a8a('0x60')]:undefined)||[]},{'name':_0x0a8a('0x66'),'value':_0xc57b30[_0x0a8a('0x66')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x2]?_0xc57b30['attrs'][0x2][_0x0a8a('0x60')]:undefined)||0x14}];case _0x0a8a('0x6b'):case _0x0a8a('0x6c'):return[{'name':_0x0a8a('0x6d'),'value':_0xc57b30['attrSerie1']||(_0xc57b30['attrs']&&_0xc57b30[_0x0a8a('0x5f')][0x0]?_0xc57b30[_0x0a8a('0x5f')][0x0][_0x0a8a('0x60')]:undefined)||_0x0a8a('0x69')},{'name':'attrSerie2','value':_0xc57b30['attrSerie2']||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x1]?_0xc57b30[_0x0a8a('0x5f')][0x1][_0x0a8a('0x60')]:undefined)||null},{'name':_0x0a8a('0x6e'),'value':_0xc57b30[_0x0a8a('0x6e')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x2]?_0xc57b30[_0x0a8a('0x5f')][0x2]['value']:undefined)||null},{'name':_0x0a8a('0x6a'),'value':_0xc57b30['attrVoiceQueues']||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x3]?_0xc57b30[_0x0a8a('0x5f')][0x3][_0x0a8a('0x60')]:undefined)||[]}];case _0x0a8a('0x6f'):return[{'name':_0x0a8a('0x70'),'type':_0xc57b30['reportType']||(_0xc57b30['attrs']&&_0xc57b30['attrs'][0x0]?_0xc57b30[_0x0a8a('0x5f')][0x0]['type']:undefined)||null,'value':_0xc57b30[_0x0a8a('0x70')]||(_0xc57b30['attrs']&&_0xc57b30[_0x0a8a('0x5f')][0x0]?_0xc57b30[_0x0a8a('0x5f')][0x0][_0x0a8a('0x60')]:undefined)||null},{'name':'attrRefresh','value':_0xc57b30[_0x0a8a('0x71')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30['attrs'][0x1]?_0xc57b30[_0x0a8a('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4b5827){logger[_0x0a8a('0x31')](_0x0a8a('0x72'),JSON['stringify'](_0x4b5827));return[];}}exports['addItem']=function(_0x46b04a,_0x2d1c35,_0xf26d0){if(_0x46b04a[_0x0a8a('0x52')]['id']){delete _0x46b04a['body']['id'];}return db[_0x0a8a('0x48')][_0x0a8a('0x50')]({'where':{'id':_0x46b04a[_0x0a8a('0x4e')]['id']}})[_0x0a8a('0x2e')](handleEntityNotFound(_0x2d1c35,null))['then'](function(_0x598fda){if(_0x598fda){_0x46b04a[_0x0a8a('0x52')][_0x0a8a('0x73')]=_0x598fda['id'];_0x46b04a['body']['attrs']=widgetAttributes(_0x46b04a[_0x0a8a('0x52')]);return db[_0x0a8a('0x74')][_0x0a8a('0x51')](_0x46b04a[_0x0a8a('0x52')]);}})['then'](respondWithResult(_0x2d1c35,null))[_0x0a8a('0x4c')](handleError(_0x2d1c35,null));};exports[_0x0a8a('0x75')]=function(_0x3031aa,_0x5cabf8,_0x13aacf){var _0x2a3079={};var _0x695d63={};var _0xa1da8;var _0x4bcc36;return db[_0x0a8a('0x48')][_0x0a8a('0x76')]({'where':{'id':_0x3031aa['params']['id']}})[_0x0a8a('0x2e')](handleEntityNotFound(_0x5cabf8,null))[_0x0a8a('0x2e')](function(_0x55327){if(_0x55327){_0xa1da8=_0x55327;_0x695d63[_0x0a8a('0x39')]=_['keys'](db[_0x0a8a('0x74')][_0x0a8a('0x36')]);_0x695d63[_0x0a8a('0x3a')]=_[_0x0a8a('0x3b')](_0x3031aa[_0x0a8a('0x3a')]);_0x695d63[_0x0a8a('0x3c')]=_[_0x0a8a('0x3d')](_0x695d63[_0x0a8a('0x39')],_0x695d63[_0x0a8a('0x3a')]);_0x2a3079[_0x0a8a('0x3e')]=_['intersection'](_0x695d63[_0x0a8a('0x39')],qs['fields'](_0x3031aa[_0x0a8a('0x3a')][_0x0a8a('0x3f')]));_0x2a3079[_0x0a8a('0x3e')]=_0x2a3079[_0x0a8a('0x3e')]['length']?_0x2a3079[_0x0a8a('0x3e')]:_0x695d63['model'];_0x2a3079[_0x0a8a('0x41')]=qs['sort'](_0x3031aa['query'][_0x0a8a('0x42')]);_0x2a3079[_0x0a8a('0x43')]=qs[_0x0a8a('0x3c')](_[_0x0a8a('0x44')](_0x3031aa[_0x0a8a('0x3a')],_0x695d63[_0x0a8a('0x3c')]));if(_0x3031aa[_0x0a8a('0x3a')][_0x0a8a('0x46')]){_0x2a3079['where']=_[_0x0a8a('0x45')](_0x2a3079[_0x0a8a('0x43')],{'$or':_[_0x0a8a('0x35')](_0x2a3079[_0x0a8a('0x3e')],function(_0x8f34df){var _0x5d8644={};_0x5d8644[_0x8f34df]={'$like':'%'+_0x3031aa['query'][_0x0a8a('0x46')]+'%'};return _0x5d8644;})});}_0x2a3079=_[_0x0a8a('0x45')]({},_0x2a3079,_0x3031aa[_0x0a8a('0x47')]);return _0xa1da8[_0x0a8a('0x75')](_0x2a3079);}})[_0x0a8a('0x2e')](function(_0x1db04e){if(_0x1db04e){_0x4bcc36=_0x1db04e[_0x0a8a('0x4f')];if(!_0x3031aa[_0x0a8a('0x3a')]['hasOwnProperty'](_0x0a8a('0x77'))){_0x2a3079[_0x0a8a('0x28')]=qs[_0x0a8a('0x28')](_0x3031aa[_0x0a8a('0x3a')][_0x0a8a('0x28')]);_0x2a3079[_0x0a8a('0x27')]=qs[_0x0a8a('0x27')](_0x3031aa['query'][_0x0a8a('0x27')]);}return _0xa1da8[_0x0a8a('0x75')](_0x2a3079);}})['then'](function(_0x30920d){if(_0x30920d){return _0x30920d?{'count':_0x4bcc36,'rows':_0x30920d}:null;}})[_0x0a8a('0x2e')](respondWithResult(_0x5cabf8,null))[_0x0a8a('0x4c')](handleError(_0x5cabf8,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index dfc3566..ac5973f 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 _0x69df=['remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x20933f,_0x1724e2){var _0x1310ce=function(_0x4295b7){while(--_0x4295b7){_0x20933f['push'](_0x20933f['shift']());}};_0x1310ce(++_0x1724e2);}(_0x69df,0x1e3));var _0xf69d=function(_0x2dc44a,_0x1ac2a4){_0x2dc44a=_0x2dc44a-0x0;var _0x9910fc=_0x69df[_0x2dc44a];return _0x9910fc;};'use strict';var EventEmitter=require(_0xf69d('0x0'));var Dashboard=require(_0xf69d('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf69d('0x2')](0x0);var events={'afterCreate':_0xf69d('0x3'),'afterUpdate':_0xf69d('0x4'),'afterDestroy':_0xf69d('0x5')};function emitEvent(_0x17b8be){return function(_0x490813,_0xc3345f,_0x4ab37e){DashboardEvents[_0xf69d('0x6')](_0x17b8be+':'+_0x490813['id'],_0x490813);DashboardEvents[_0xf69d('0x6')](_0x17b8be,_0x490813);_0x4ab37e(null);};}for(var e in events){if(events[_0xf69d('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xbbdb=['hook','events','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4180c6,_0x642cf3){var _0xe0e5aa=function(_0x37f4e8){while(--_0x37f4e8){_0x4180c6['push'](_0x4180c6['shift']());}};_0xe0e5aa(++_0x642cf3);}(_0xbbdb,0x118));var _0xbbbd=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0xbbdb[_0x1dc24d];return _0x5d7fb2;};'use strict';var EventEmitter=require(_0xbbbd('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xbbbd('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xbbbd('0x2')](0x0);var events={'afterCreate':_0xbbbd('0x3'),'afterUpdate':_0xbbbd('0x4'),'afterDestroy':_0xbbbd('0x5')};function emitEvent(_0x35c7e3){return function(_0x135627,_0x1b4a95,_0x3c51c6){DashboardEvents[_0xbbbd('0x6')](_0x35c7e3+':'+_0x135627['id'],_0x135627);DashboardEvents['emit'](_0x35c7e3,_0x135627);_0x3c51c6(null);};}for(var e in events){if(events[_0xbbbd('0x7')](e)){var event=events[e];Dashboard[_0xbbbd('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 22d8572..c056180 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 _0x7125=['./dashboard.attributes','exports','define','Dashboard','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7125,0x19c));var _0x5712=function(_0x18c53b,_0x1eaad8){_0x18c53b=_0x18c53b-0x0;var _0x381d04=_0x7125[_0x18c53b];return _0x381d04;};'use strict';var _=require('lodash');var util=require(_0x5712('0x0'));var logger=require(_0x5712('0x1'))(_0x5712('0x2'));var moment=require('moment');var BPromise=require(_0x5712('0x3'));var rp=require(_0x5712('0x4'));var fs=require('fs');var path=require(_0x5712('0x5'));var rimraf=require(_0x5712('0x6'));var config=require(_0x5712('0x7'));var attributes=require(_0x5712('0x8'));module[_0x5712('0x9')]=function(_0x449230,_0xf69db5){return _0x449230[_0x5712('0xa')](_0x5712('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1aaa=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash'];(function(_0x4277b0,_0x1fc0ae){var _0x342cd6=function(_0x2f00fe){while(--_0x2f00fe){_0x4277b0['push'](_0x4277b0['shift']());}};_0x342cd6(++_0x1fc0ae);}(_0x1aaa,0x144));var _0xa1aa=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x1aaa[_0x19159a];return _0xa677f4;};'use strict';var _=require(_0xa1aa('0x0'));var util=require(_0xa1aa('0x1'));var logger=require(_0xa1aa('0x2'))(_0xa1aa('0x3'));var moment=require('moment');var BPromise=require(_0xa1aa('0x4'));var rp=require(_0xa1aa('0x5'));var fs=require('fs');var path=require(_0xa1aa('0x6'));var rimraf=require(_0xa1aa('0x7'));var config=require(_0xa1aa('0x8'));var attributes=require(_0xa1aa('0x9'));module[_0xa1aa('0xa')]=function(_0x482dad,_0x25deb3){return _0x482dad[_0xa1aa('0xb')](_0xa1aa('0xc'),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 43fdc09..e754eb2 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 _0x08ab=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x57d843,_0x2a95e0){var _0x42ba2d=function(_0x46cb71){while(--_0x46cb71){_0x57d843['push'](_0x57d843['shift']());}};_0x42ba2d(++_0x2a95e0);}(_0x08ab,0x173));var _0xb08a=function(_0xd51cd6,_0x3714db){_0xd51cd6=_0xd51cd6-0x0;var _0x36c011=_0x08ab[_0xd51cd6];return _0x36c011;};'use strict';var _=require(_0xb08a('0x0'));var util=require(_0xb08a('0x1'));var moment=require(_0xb08a('0x2'));var BPromise=require('bluebird');var rs=require(_0xb08a('0x3'));var fs=require('fs');var Redis=require(_0xb08a('0x4'));var db=require(_0xb08a('0x5'))['db'];var utils=require(_0xb08a('0x6'));var logger=require(_0xb08a('0x7'))(_0xb08a('0x8'));var config=require(_0xb08a('0x9'));var jayson=require(_0xb08a('0xa'));var client=jayson[_0xb08a('0xb')][_0xb08a('0xc')]({'port':0x232a});config[_0xb08a('0xd')]=_[_0xb08a('0xe')](config[_0xb08a('0xd')],{'host':_0xb08a('0xf'),'port':0x18eb});var socket=require(_0xb08a('0x10'))(new Redis(config[_0xb08a('0xd')]));require(_0xb08a('0x11'))[_0xb08a('0x12')](socket);function respondWithRpcPromise(_0x5e7d92,_0x5c7d09,_0x5b3191){return new BPromise(function(_0x5e8e19,_0x2ea0dd){return client[_0xb08a('0x13')](_0x5e7d92,_0x5b3191)['then'](function(_0x272f23){logger[_0xb08a('0x14')](_0xb08a('0x15'),_0x5c7d09,_0xb08a('0x16'));logger['debug'](_0xb08a('0x17'),_0x5c7d09,_0xb08a('0x16'),JSON[_0xb08a('0x18')](_0x272f23));if(_0x272f23[_0xb08a('0x19')]){if(_0x272f23[_0xb08a('0x19')][_0xb08a('0x1a')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x5c7d09,_0x272f23['error'][_0xb08a('0x1b')]);return _0x2ea0dd(_0x272f23[_0xb08a('0x19')][_0xb08a('0x1b')]);}logger['error'](_0xb08a('0x15'),_0x5c7d09,_0x272f23[_0xb08a('0x19')][_0xb08a('0x1b')]);return _0x5e8e19(_0x272f23['error']['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x5c7d09,_0xb08a('0x16'));_0x5e8e19(_0x272f23[_0xb08a('0x1c')]['message']);}})['catch'](function(_0x2e9808){logger[_0xb08a('0x19')](_0xb08a('0x15'),_0x5c7d09,_0x2e9808);_0x2ea0dd(_0x2e9808);});});} \ No newline at end of file +var _0xac26=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0xac26,0x1ee));var _0x6ac2=function(_0x3dcbfd,_0x12c1e5){_0x3dcbfd=_0x3dcbfd-0x0;var _0x1ce1d1=_0xac26[_0x3dcbfd];return _0x1ce1d1;};'use strict';var _=require(_0x6ac2('0x0'));var util=require(_0x6ac2('0x1'));var moment=require(_0x6ac2('0x2'));var BPromise=require(_0x6ac2('0x3'));var rs=require(_0x6ac2('0x4'));var fs=require('fs');var Redis=require(_0x6ac2('0x5'));var db=require(_0x6ac2('0x6'))['db'];var utils=require(_0x6ac2('0x7'));var logger=require(_0x6ac2('0x8'))(_0x6ac2('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ac2('0xa')][_0x6ac2('0xb')]({'port':0x232a});config[_0x6ac2('0xc')]=_[_0x6ac2('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6ac2('0xe'))(new Redis(config[_0x6ac2('0xc')]));require(_0x6ac2('0xf'))[_0x6ac2('0x10')](socket);function respondWithRpcPromise(_0x17ff73,_0x3d3f4f,_0x2407c4){return new BPromise(function(_0x50f790,_0x1aaace){return client[_0x6ac2('0x11')](_0x17ff73,_0x2407c4)[_0x6ac2('0x12')](function(_0x10e05b){logger[_0x6ac2('0x13')](_0x6ac2('0x14'),_0x3d3f4f,_0x6ac2('0x15'));logger['debug'](_0x6ac2('0x16'),_0x3d3f4f,'request\x20sent',JSON[_0x6ac2('0x17')](_0x10e05b));if(_0x10e05b['error']){if(_0x10e05b['error'][_0x6ac2('0x18')]===0x1f4){logger[_0x6ac2('0x19')](_0x6ac2('0x14'),_0x3d3f4f,_0x10e05b['error'][_0x6ac2('0x1a')]);return _0x1aaace(_0x10e05b[_0x6ac2('0x19')][_0x6ac2('0x1a')]);}logger['error'](_0x6ac2('0x14'),_0x3d3f4f,_0x10e05b[_0x6ac2('0x19')][_0x6ac2('0x1a')]);return _0x50f790(_0x10e05b[_0x6ac2('0x19')][_0x6ac2('0x1a')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x3d3f4f,_0x6ac2('0x15'));_0x50f790(_0x10e05b[_0x6ac2('0x1b')]['message']);}})[_0x6ac2('0x1c')](function(_0x2441f9){logger[_0x6ac2('0x19')]('Dashboard,\x20%s,\x20%s',_0x3d3f4f,_0x2441f9);_0x1aaace(_0x2441f9);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 9fc4a2e..ae7e9cd 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 _0x7d0c=['remove','emit','removeListener','register','length','./dashboard.events','save'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x7d0c,0x139));var _0xc7d0=function(_0x25ada2,_0x36f41b){_0x25ada2=_0x25ada2-0x0;var _0x3ffa3a=_0x7d0c[_0x25ada2];return _0x3ffa3a;};'use strict';var DashboardEvents=require(_0xc7d0('0x0'));var events=[_0xc7d0('0x1'),_0xc7d0('0x2'),'update'];function createListener(_0x5c4cfe,_0xe98264){return function(_0x2a83cc){_0xe98264[_0xc7d0('0x3')](_0x5c4cfe,_0x2a83cc);};}function removeListener(_0x5c68cc,_0x483818){return function(){DashboardEvents[_0xc7d0('0x4')](_0x5c68cc,_0x483818);};}exports[_0xc7d0('0x5')]=function(_0x4ae8e9){for(var _0x5833cf=0x0,_0x4a9fed=events[_0xc7d0('0x6')];_0x5833cf<_0x4a9fed;_0x5833cf++){var _0x45286b=events[_0x5833cf];var _0x207ea3=createListener('dashboard:'+_0x45286b,_0x4ae8e9);DashboardEvents['on'](_0x45286b,_0x207ea3);}}; \ No newline at end of file +var _0x735d=['save','remove','emit','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x82d9e9,_0x381055){var _0x30d4a2=function(_0x176fa7){while(--_0x176fa7){_0x82d9e9['push'](_0x82d9e9['shift']());}};_0x30d4a2(++_0x381055);}(_0x735d,0x13f));var _0xd735=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0x735d[_0x5dfc2a];return _0x3f1a71;};'use strict';var DashboardEvents=require(_0xd735('0x0'));var events=[_0xd735('0x1'),_0xd735('0x2'),'update'];function createListener(_0x430c7e,_0x1d6d02){return function(_0x34d14b){_0x1d6d02[_0xd735('0x3')](_0x430c7e,_0x34d14b);};}function removeListener(_0x4935bd,_0x25ed99){return function(){DashboardEvents[_0xd735('0x4')](_0x4935bd,_0x25ed99);};}exports[_0xd735('0x5')]=function(_0x331e24){for(var _0xf4574=0x0,_0x4e1ff0=events[_0xd735('0x6')];_0xf4574<_0x4e1ff0;_0xf4574++){var _0x1abbfa=events[_0xf4574];var _0x263c52=createListener(_0xd735('0x7')+_0x1abbfa,_0x331e24);DashboardEvents['on'](_0x1abbfa,_0x263c52);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5f4e908..cc0f355 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 _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x104391,_0x35d26c){var _0x471793=function(_0x423830){while(--_0x423830){_0x104391['push'](_0x104391['shift']());}};_0x471793(++_0x35d26c);}(_0x70e0,0x17b));var _0x070e=function(_0x3339f6,_0xc1b0c7){_0x3339f6=_0x3339f6-0x0;var _0x2b0312=_0x70e0[_0x3339f6];return _0x2b0312;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);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(_0x3f020f,_0xdc7e7){var _0x520707=function(_0x36039a){while(--_0x36039a){_0x3f020f['push'](_0x3f020f['shift']());}};_0x520707(++_0xdc7e7);}(_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 3d4cfa6..3aa87cd 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 _0x19e2=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x409407,_0x348490){var _0x34e613=function(_0x4ceae2){while(--_0x4ceae2){_0x409407['push'](_0x409407['shift']());}};_0x34e613(++_0x348490);}(_0x19e2,0x14d));var _0x219e=function(_0x5835b0,_0x2ec36d){_0x5835b0=_0x5835b0-0x0;var _0x26cd5c=_0x19e2[_0x5835b0];return _0x26cd5c;};'use strict';var Sequelize=require(_0x219e('0x0'));var squel=require(_0x219e('0x1'));var _=require(_0x219e('0x2'));module[_0x219e('0x3')]={'title':{'type':Sequelize[_0x219e('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x219e('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x219e('0x5')](this[_0x219e('0x6')](_0x219e('0x7')));}catch(_0x50faa3){return[];}},'set':function(_0x175f1){try{this[_0x219e('0x8')](_0x219e('0x7'),JSON[_0x219e('0x9')](_0x175f1));}catch(_0x4a60cf){this[_0x219e('0x8')](_0x219e('0x7'),JSON[_0x219e('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x219e('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x219e('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x219e('0xa')]},'background':{'type':Sequelize[_0x219e('0x4')],'allowNull':![],'defaultValue':_0x219e('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x219e('0x4')],'allowNull':![],'defaultValue':_0x219e('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x219e('0x4')]},'titleFontSize':{'type':Sequelize[_0x219e('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xc62c=['long','parse','getDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3','squel','lodash','exports','STRING'];(function(_0x123b63,_0x590b9e){var _0xf2c644=function(_0x30070f){while(--_0x30070f){_0x123b63['push'](_0x123b63['shift']());}};_0xf2c644(++_0x590b9e);}(_0xc62c,0x1e8));var _0xcc62=function(_0x3d857b,_0x11cb3e){_0x3d857b=_0x3d857b-0x0;var _0x371589=_0xc62c[_0x3d857b];return _0x371589;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xcc62('0x0'));var _=require(_0xcc62('0x1'));module[_0xcc62('0x2')]={'title':{'type':Sequelize[_0xcc62('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xcc62('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xcc62('0x4')),'get':function(){try{return JSON[_0xcc62('0x5')](this[_0xcc62('0x6')](_0xcc62('0x7')));}catch(_0x1650bb){return[];}},'set':function(_0x5b6f44){try{this['setDataValue'](_0xcc62('0x7'),JSON[_0xcc62('0x8')](_0x5b6f44));}catch(_0x10e2ca){this['setDataValue'](_0xcc62('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xcc62('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xcc62('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xcc62('0x9')]},'background':{'type':Sequelize[_0xcc62('0x3')],'allowNull':![],'defaultValue':_0xcc62('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xcc62('0x3')],'allowNull':![],'defaultValue':_0xcc62('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index acd59c4..c6a2f89 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 _0x00fb=['sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./dashboardItem.socket','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','status','error','stack','name','send','show','params','model','keys','DashboardItem','query','intersection','attributes','fields','length','includeAll','merge','options','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','html-pdf','zip-dir','request-promise','util','path'];(function(_0x183a3c,_0xa4cc47){var _0x5c41d8=function(_0x4e2f18){while(--_0x4e2f18){_0x183a3c['push'](_0x183a3c['shift']());}};_0x5c41d8(++_0xa4cc47);}(_0x00fb,0x15b));var _0xb00f=function(_0x101380,_0x1d7c22){_0x101380=_0x101380-0x0;var _0x39e846=_0x00fb[_0x101380];return _0x39e846;};'use strict';var pdf=require(_0xb00f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb00f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb00f('0x3'));var path=require(_0xb00f('0x4'));var sox=require(_0xb00f('0x5'));var csv=require(_0xb00f('0x6'));var ejs=require(_0xb00f('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb00f('0x8'));var jsforce=require(_0xb00f('0x9'));var deskjs=require(_0xb00f('0xa'));var toCsv=require(_0xb00f('0x6'));var querystring=require(_0xb00f('0xb'));var Papa=require(_0xb00f('0xc'));var Redis=require(_0xb00f('0xd'));var authService=require(_0xb00f('0xe'));var qs=require(_0xb00f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb00f('0x10'));var logger=require(_0xb00f('0x11'))('api');var utils=require(_0xb00f('0x12'));var config=require(_0xb00f('0x13'));var licenseUtil=require(_0xb00f('0x14'));var db=require(_0xb00f('0x15'))['db'];config[_0xb00f('0x16')]=_[_0xb00f('0x17')](config[_0xb00f('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb00f('0x18'))['register'](socket);function respondWithStatusCode(_0x381d9f,_0x3a3fb7){_0x3a3fb7=_0x3a3fb7||0xcc;return function(_0x2ec077){if(_0x2ec077){return _0x381d9f[_0xb00f('0x19')](_0x3a3fb7);}return _0x381d9f['status'](_0x3a3fb7)[_0xb00f('0x1a')]();};}function respondWithResult(_0x3cb996,_0x23feec){_0x23feec=_0x23feec||0xc8;return function(_0x39f583){if(_0x39f583){return _0x3cb996['status'](_0x23feec)[_0xb00f('0x1b')](_0x39f583);}};}function respondWithFilteredResult(_0x3bac94,_0x5adc89){return function(_0x3bba36){if(_0x3bba36){var _0x2ec1f7=_0x3bba36[_0xb00f('0x1c')],_0x17874c=_0x5adc89[_0xb00f('0x1d')],_0x2b3f48=_0x5adc89[_0xb00f('0x1d')]+_0x5adc89[_0xb00f('0x1e')],_0x2d5560;if(_0x2b3f48>=_0x2ec1f7){_0x2b3f48=_0x2ec1f7;_0x2d5560=0xc8;}else{_0x2d5560=0xce;}_0x3bac94['status'](_0x2d5560);return _0x3bac94[_0xb00f('0x1f')](_0xb00f('0x20'),_0x17874c+'-'+_0x2b3f48+'/'+_0x2ec1f7)['json'](_0x3bba36);}return null;};}function patchUpdates(_0x82a980){return function(_0x3b9ae7){try{jsonpatch[_0xb00f('0x21')](_0x3b9ae7,_0x82a980,!![]);}catch(_0x19cdf6){return BPromise[_0xb00f('0x22')](_0x19cdf6);}return _0x3b9ae7[_0xb00f('0x23')]();};}function saveUpdates(_0x305203,_0x2b9977){return function(_0x1e2bf1){if(_0x1e2bf1){return _0x1e2bf1['update'](_0x305203)[_0xb00f('0x24')](function(_0x38bffb){return _0x38bffb;});}return null;};}function removeEntity(_0xa1cea0,_0x517c05){return function(_0x22d8ce){if(_0x22d8ce){return _0x22d8ce[_0xb00f('0x25')]()['then'](function(){_0xa1cea0[_0xb00f('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dfd56,_0x3f53b6){return function(_0xdd5c91){if(!_0xdd5c91){_0x4dfd56[_0xb00f('0x19')](0x194);}return _0xdd5c91;};}function handleError(_0x298cf9,_0x4ae197){_0x4ae197=_0x4ae197||0x1f4;return function(_0xf14606){logger[_0xb00f('0x27')](_0xf14606[_0xb00f('0x28')]);if(_0xf14606['name']){delete _0xf14606[_0xb00f('0x29')];}_0x298cf9['status'](_0x4ae197)[_0xb00f('0x2a')](_0xf14606);};}exports[_0xb00f('0x2b')]=function(_0x599fc7,_0x24d43b){var _0x15e711={'raw':![],'where':{'id':_0x599fc7[_0xb00f('0x2c')]['id']}},_0x5475fd={};_0x5475fd[_0xb00f('0x2d')]=_[_0xb00f('0x2e')](db[_0xb00f('0x2f')]['rawAttributes']);_0x5475fd[_0xb00f('0x30')]=_[_0xb00f('0x2e')](_0x599fc7['query']);_0x5475fd['filters']=_[_0xb00f('0x31')](_0x5475fd['model'],_0x5475fd['query']);_0x15e711[_0xb00f('0x32')]=_['intersection'](_0x5475fd['model'],qs[_0xb00f('0x33')](_0x599fc7[_0xb00f('0x30')][_0xb00f('0x33')]));_0x15e711[_0xb00f('0x32')]=_0x15e711[_0xb00f('0x32')][_0xb00f('0x34')]?_0x15e711['attributes']:_0x5475fd[_0xb00f('0x2d')];if(_0x599fc7[_0xb00f('0x30')][_0xb00f('0x35')]){_0x15e711['include']=[{'all':!![]}];}_0x15e711=_[_0xb00f('0x36')]({},_0x15e711,_0x599fc7[_0xb00f('0x37')]);return db[_0xb00f('0x2f')][_0xb00f('0x38')](_0x15e711)[_0xb00f('0x24')](handleEntityNotFound(_0x24d43b,null))['then'](respondWithResult(_0x24d43b,null))[_0xb00f('0x39')](handleError(_0x24d43b,null));};exports[_0xb00f('0x25')]=function(_0x4510f2,_0x3c1b22){return db[_0xb00f('0x2f')]['find']({'where':{'id':_0x4510f2['params']['id']}})[_0xb00f('0x24')](handleEntityNotFound(_0x3c1b22,null))['then'](removeEntity(_0x3c1b22,null))[_0xb00f('0x39')](handleError(_0x3c1b22,null));};function widgetAttributes(_0xafa751){try{switch(_0xafa751[_0xb00f('0x3a')]){case _0xb00f('0x3b'):return[{'name':_0xb00f('0x3c'),'value':_0xafa751[_0xb00f('0x3c')]||(_0xafa751[_0xb00f('0x3d')]&&_0xafa751[_0xb00f('0x3d')][0x0]?_0xafa751['attrs'][0x0][_0xb00f('0x3e')]:undefined)||'https://'}];case _0xb00f('0x3f'):return[{'name':'attrPath','value':_0xafa751[_0xb00f('0x40')]||(_0xafa751['attrs']&&_0xafa751[_0xb00f('0x3d')][0x0]?_0xafa751[_0xb00f('0x3d')][0x0][_0xb00f('0x3e')]:undefined)||''}];case _0xb00f('0x41'):return[{'name':_0xb00f('0x42'),'value':_0xafa751[_0xb00f('0x42')]||(_0xafa751[_0xb00f('0x3d')]&&_0xafa751[_0xb00f('0x3d')][0x0]?_0xafa751[_0xb00f('0x3d')][0x0][_0xb00f('0x3e')]:undefined)||_0xb00f('0x43')},{'name':_0xb00f('0x44'),'value':_0xafa751['attrTimezone']||(_0xafa751[_0xb00f('0x3d')]&&_0xafa751['attrs'][0x1]?_0xafa751[_0xb00f('0x3d')][0x1]['value']:undefined)||_0xb00f('0x45')},{'name':_0xb00f('0x46'),'value':_0xafa751[_0xb00f('0x46')]||(_0xafa751['attrs']&&_0xafa751['attrs'][0x2]?_0xafa751[_0xb00f('0x3d')][0x2][_0xb00f('0x3e')]:undefined)||0xc}];case _0xb00f('0x47'):return[{'name':_0xb00f('0x48'),'value':_0xafa751['attrMetric']||(_0xafa751['attrs']&&_0xafa751[_0xb00f('0x3d')][0x0]?_0xafa751['attrs'][0x0][_0xb00f('0x3e')]:undefined)||'total'},{'name':_0xb00f('0x49'),'value':_0xafa751['attrVoiceQueues']||(_0xafa751['attrs']&&_0xafa751['attrs'][0x1]?_0xafa751[_0xb00f('0x3d')][0x1][_0xb00f('0x3e')]:undefined)||[]},{'name':_0xb00f('0x46'),'value':_0xafa751['attrFontSize']||(_0xafa751[_0xb00f('0x3d')]&&_0xafa751[_0xb00f('0x3d')][0x2]?_0xafa751[_0xb00f('0x3d')][0x2][_0xb00f('0x3e')]:undefined)||0x14}];case'multibar-chart':case _0xb00f('0x4a'):return[{'name':_0xb00f('0x4b'),'value':_0xafa751[_0xb00f('0x4b')]||(_0xafa751[_0xb00f('0x3d')]&&_0xafa751[_0xb00f('0x3d')][0x0]?_0xafa751[_0xb00f('0x3d')][0x0][_0xb00f('0x3e')]:undefined)||_0xb00f('0x4c')},{'name':_0xb00f('0x4d'),'value':_0xafa751['attrSerie2']||(_0xafa751[_0xb00f('0x3d')]&&_0xafa751[_0xb00f('0x3d')][0x1]?_0xafa751[_0xb00f('0x3d')][0x1][_0xb00f('0x3e')]:undefined)||null},{'name':_0xb00f('0x4e'),'value':_0xafa751[_0xb00f('0x4e')]||(_0xafa751[_0xb00f('0x3d')]&&_0xafa751[_0xb00f('0x3d')][0x2]?_0xafa751[_0xb00f('0x3d')][0x2][_0xb00f('0x3e')]:undefined)||null},{'name':_0xb00f('0x49'),'value':_0xafa751['attrVoiceQueues']||(_0xafa751[_0xb00f('0x3d')]&&_0xafa751[_0xb00f('0x3d')][0x3]?_0xafa751[_0xb00f('0x3d')][0x3]['value']:undefined)||[]}];case _0xb00f('0x4f'):return[{'name':_0xb00f('0x50'),'type':_0xafa751[_0xb00f('0x51')]||(_0xafa751[_0xb00f('0x3d')]&&_0xafa751[_0xb00f('0x3d')][0x0]?_0xafa751['attrs'][0x0][_0xb00f('0x3a')]:undefined)||null,'value':_0xafa751[_0xb00f('0x50')]||(_0xafa751[_0xb00f('0x3d')]&&_0xafa751[_0xb00f('0x3d')][0x0]?_0xafa751['attrs'][0x0][_0xb00f('0x3e')]:undefined)||null},{'name':_0xb00f('0x52'),'value':_0xafa751[_0xb00f('0x52')]||(_0xafa751[_0xb00f('0x3d')]&&_0xafa751[_0xb00f('0x3d')][0x1]?_0xafa751[_0xb00f('0x3d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x306e61){logger['error'](_0xb00f('0x53'),JSON[_0xb00f('0x54')](_0x306e61));return[];}}exports[_0xb00f('0x55')]=function(_0x5ea825,_0x48b111){if(_0x5ea825[_0xb00f('0x56')]){_0x5ea825['body']['attrs']=widgetAttributes(_0x5ea825['body']);}return db[_0xb00f('0x2f')]['create'](_0x5ea825['body'],{})[_0xb00f('0x24')](respondWithResult(_0x48b111,0xc9))[_0xb00f('0x39')](handleError(_0x48b111,null));};exports[_0xb00f('0x57')]=function(_0x3f7460,_0x6aa20d){if(_0x3f7460['body']['id']){delete _0x3f7460[_0xb00f('0x56')]['id'];}_0x3f7460[_0xb00f('0x56')][_0xb00f('0x3d')]=widgetAttributes(_0x3f7460[_0xb00f('0x56')]);return db[_0xb00f('0x2f')][_0xb00f('0x38')]({'where':{'id':_0x3f7460[_0xb00f('0x2c')]['id']}})[_0xb00f('0x24')](handleEntityNotFound(_0x6aa20d,null))[_0xb00f('0x24')](saveUpdates(_0x3f7460[_0xb00f('0x56')],null))['then'](respondWithResult(_0x6aa20d,null))[_0xb00f('0x39')](handleError(_0x6aa20d,null));}; \ No newline at end of file +var _0xc440=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','limit','set','apply','reject','save','then','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','destroy','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','crypto','querystring','papaparse','../../components/parsers/qs'];(function(_0x1ef727,_0x228cc5){var _0x3c4426=function(_0x3a1cec){while(--_0x3a1cec){_0x1ef727['push'](_0x1ef727['shift']());}};_0x3c4426(++_0x228cc5);}(_0xc440,0xf1));var _0x0c44=function(_0x320243,_0x55038d){_0x320243=_0x320243-0x0;var _0x1c9c6a=_0xc440[_0x320243];return _0x1c9c6a;};'use strict';var pdf=require(_0x0c44('0x0'));var emlformat=require(_0x0c44('0x1'));var rimraf=require(_0x0c44('0x2'));var zipdir=require(_0x0c44('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c44('0x4'));var moment=require(_0x0c44('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0c44('0x6'));var path=require(_0x0c44('0x7'));var sox=require(_0x0c44('0x8'));var csv=require(_0x0c44('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0c44('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0c44('0x9'));var querystring=require(_0x0c44('0xb'));var Papa=require(_0x0c44('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0c44('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c44('0xe'));var logger=require('../../config/logger')(_0x0c44('0xf'));var utils=require(_0x0c44('0x10'));var config=require(_0x0c44('0x11'));var licenseUtil=require(_0x0c44('0x12'));var db=require(_0x0c44('0x13'))['db'];config[_0x0c44('0x14')]=_[_0x0c44('0x15')](config[_0x0c44('0x14')],{'host':_0x0c44('0x16'),'port':0x18eb});var socket=require(_0x0c44('0x17'))(new Redis(config[_0x0c44('0x14')]));require(_0x0c44('0x18'))[_0x0c44('0x19')](socket);function respondWithStatusCode(_0x3a88fd,_0x48b4a9){_0x48b4a9=_0x48b4a9||0xcc;return function(_0x40aaa5){if(_0x40aaa5){return _0x3a88fd[_0x0c44('0x1a')](_0x48b4a9);}return _0x3a88fd[_0x0c44('0x1b')](_0x48b4a9)[_0x0c44('0x1c')]();};}function respondWithResult(_0x45d8ba,_0x251434){_0x251434=_0x251434||0xc8;return function(_0x512e6b){if(_0x512e6b){return _0x45d8ba[_0x0c44('0x1b')](_0x251434)[_0x0c44('0x1d')](_0x512e6b);}};}function respondWithFilteredResult(_0x3d9aad,_0x4fee28){return function(_0x528c0b){if(_0x528c0b){var _0x8f8bc1=_0x528c0b[_0x0c44('0x1e')],_0x501ced=_0x4fee28['offset'],_0x3f34c8=_0x4fee28['offset']+_0x4fee28[_0x0c44('0x1f')],_0x4a9158;if(_0x3f34c8>=_0x8f8bc1){_0x3f34c8=_0x8f8bc1;_0x4a9158=0xc8;}else{_0x4a9158=0xce;}_0x3d9aad[_0x0c44('0x1b')](_0x4a9158);return _0x3d9aad[_0x0c44('0x20')]('Content-Range',_0x501ced+'-'+_0x3f34c8+'/'+_0x8f8bc1)['json'](_0x528c0b);}return null;};}function patchUpdates(_0x54525f){return function(_0x17e51a){try{jsonpatch[_0x0c44('0x21')](_0x17e51a,_0x54525f,!![]);}catch(_0x14f400){return BPromise[_0x0c44('0x22')](_0x14f400);}return _0x17e51a[_0x0c44('0x23')]();};}function saveUpdates(_0x160cf9,_0x55f964){return function(_0x50d500){if(_0x50d500){return _0x50d500['update'](_0x160cf9)[_0x0c44('0x24')](function(_0x1448e8){return _0x1448e8;});}return null;};}function removeEntity(_0xc652b0,_0x30d121){return function(_0x44e939){if(_0x44e939){return _0x44e939['destroy']()[_0x0c44('0x24')](function(){_0xc652b0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dbf9f,_0x52770f){return function(_0x4698c0){if(!_0x4698c0){_0x1dbf9f[_0x0c44('0x1a')](0x194);}return _0x4698c0;};}function handleError(_0x1a2235,_0x1428f6){_0x1428f6=_0x1428f6||0x1f4;return function(_0x5891bb){logger['error'](_0x5891bb[_0x0c44('0x25')]);if(_0x5891bb[_0x0c44('0x26')]){delete _0x5891bb[_0x0c44('0x26')];}_0x1a2235[_0x0c44('0x1b')](_0x1428f6)[_0x0c44('0x27')](_0x5891bb);};}exports[_0x0c44('0x28')]=function(_0x3afc44,_0x239d04){var _0x5984fc={'raw':![],'where':{'id':_0x3afc44[_0x0c44('0x29')]['id']}},_0x4c8d0d={};_0x4c8d0d[_0x0c44('0x2a')]=_['keys'](db[_0x0c44('0x2b')][_0x0c44('0x2c')]);_0x4c8d0d[_0x0c44('0x2d')]=_[_0x0c44('0x2e')](_0x3afc44[_0x0c44('0x2d')]);_0x4c8d0d[_0x0c44('0x2f')]=_[_0x0c44('0x30')](_0x4c8d0d[_0x0c44('0x2a')],_0x4c8d0d[_0x0c44('0x2d')]);_0x5984fc[_0x0c44('0x31')]=_['intersection'](_0x4c8d0d['model'],qs[_0x0c44('0x32')](_0x3afc44[_0x0c44('0x2d')]['fields']));_0x5984fc['attributes']=_0x5984fc[_0x0c44('0x31')][_0x0c44('0x33')]?_0x5984fc[_0x0c44('0x31')]:_0x4c8d0d[_0x0c44('0x2a')];if(_0x3afc44[_0x0c44('0x2d')][_0x0c44('0x34')]){_0x5984fc[_0x0c44('0x35')]=[{'all':!![]}];}_0x5984fc=_[_0x0c44('0x36')]({},_0x5984fc,_0x3afc44[_0x0c44('0x37')]);return db[_0x0c44('0x2b')][_0x0c44('0x38')](_0x5984fc)['then'](handleEntityNotFound(_0x239d04,null))['then'](respondWithResult(_0x239d04,null))['catch'](handleError(_0x239d04,null));};exports[_0x0c44('0x39')]=function(_0x101737,_0x21470a){return db['DashboardItem']['find']({'where':{'id':_0x101737['params']['id']}})['then'](handleEntityNotFound(_0x21470a,null))['then'](removeEntity(_0x21470a,null))[_0x0c44('0x3a')](handleError(_0x21470a,null));};function widgetAttributes(_0x320591){try{switch(_0x320591[_0x0c44('0x3b')]){case _0x0c44('0x3c'):return[{'name':_0x0c44('0x3d'),'value':_0x320591[_0x0c44('0x3d')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x0]?_0x320591[_0x0c44('0x3e')][0x0][_0x0c44('0x3f')]:undefined)||_0x0c44('0x40')}];case _0x0c44('0x41'):return[{'name':_0x0c44('0x42'),'value':_0x320591[_0x0c44('0x42')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x0]?_0x320591[_0x0c44('0x3e')][0x0][_0x0c44('0x3f')]:undefined)||''}];case _0x0c44('0x43'):return[{'name':_0x0c44('0x44'),'value':_0x320591[_0x0c44('0x44')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x0]?_0x320591[_0x0c44('0x3e')][0x0][_0x0c44('0x3f')]:undefined)||_0x0c44('0x45')},{'name':_0x0c44('0x46'),'value':_0x320591[_0x0c44('0x46')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x1]?_0x320591[_0x0c44('0x3e')][0x1][_0x0c44('0x3f')]:undefined)||'0.00'},{'name':_0x0c44('0x47'),'value':_0x320591[_0x0c44('0x47')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x2]?_0x320591[_0x0c44('0x3e')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x0c44('0x48'),'value':_0x320591[_0x0c44('0x48')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x0]?_0x320591[_0x0c44('0x3e')][0x0][_0x0c44('0x3f')]:undefined)||'total'},{'name':_0x0c44('0x49'),'value':_0x320591['attrVoiceQueues']||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x1]?_0x320591[_0x0c44('0x3e')][0x1][_0x0c44('0x3f')]:undefined)||[]},{'name':_0x0c44('0x47'),'value':_0x320591[_0x0c44('0x47')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x2]?_0x320591['attrs'][0x2][_0x0c44('0x3f')]:undefined)||0x14}];case _0x0c44('0x4a'):case'pie-chart':return[{'name':_0x0c44('0x4b'),'value':_0x320591[_0x0c44('0x4b')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x0]?_0x320591[_0x0c44('0x3e')][0x0][_0x0c44('0x3f')]:undefined)||'total'},{'name':_0x0c44('0x4c'),'value':_0x320591[_0x0c44('0x4c')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591['attrs'][0x1]?_0x320591[_0x0c44('0x3e')][0x1][_0x0c44('0x3f')]:undefined)||null},{'name':_0x0c44('0x4d'),'value':_0x320591[_0x0c44('0x4d')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x2]?_0x320591['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x320591['attrVoiceQueues']||(_0x320591['attrs']&&_0x320591[_0x0c44('0x3e')][0x3]?_0x320591[_0x0c44('0x3e')][0x3][_0x0c44('0x3f')]:undefined)||[]}];case _0x0c44('0x4e'):return[{'name':_0x0c44('0x4f'),'type':_0x320591['reportType']||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x0]?_0x320591[_0x0c44('0x3e')][0x0][_0x0c44('0x3b')]:undefined)||null,'value':_0x320591[_0x0c44('0x4f')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591['attrs'][0x0]?_0x320591['attrs'][0x0]['value']:undefined)||null},{'name':_0x0c44('0x50'),'value':_0x320591['attrRefresh']||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x1]?_0x320591[_0x0c44('0x3e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x57b991){logger[_0x0c44('0x51')]('widgetAttributes:\x20%s',JSON['stringify'](_0x57b991));return[];}}exports[_0x0c44('0x52')]=function(_0x33d45d,_0x35d742){if(_0x33d45d[_0x0c44('0x53')]){_0x33d45d[_0x0c44('0x53')]['attrs']=widgetAttributes(_0x33d45d[_0x0c44('0x53')]);}return db[_0x0c44('0x2b')][_0x0c44('0x52')](_0x33d45d['body'],{})[_0x0c44('0x24')](respondWithResult(_0x35d742,0xc9))[_0x0c44('0x3a')](handleError(_0x35d742,null));};exports[_0x0c44('0x54')]=function(_0x4e7fbf,_0x3227ca){if(_0x4e7fbf['body']['id']){delete _0x4e7fbf['body']['id'];}_0x4e7fbf[_0x0c44('0x53')][_0x0c44('0x3e')]=widgetAttributes(_0x4e7fbf[_0x0c44('0x53')]);return db[_0x0c44('0x2b')][_0x0c44('0x38')]({'where':{'id':_0x4e7fbf['params']['id']}})[_0x0c44('0x24')](handleEntityNotFound(_0x3227ca,null))[_0x0c44('0x24')](saveUpdates(_0x4e7fbf[_0x0c44('0x53')],null))[_0x0c44('0x24')](respondWithResult(_0x3227ca,null))[_0x0c44('0x3a')](handleError(_0x3227ca,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f654713..9e9923c 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 _0x8827=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x20d9c5,_0x3bd277){var _0x26f657=function(_0x95fc64){while(--_0x95fc64){_0x20d9c5['push'](_0x20d9c5['shift']());}};_0x26f657(++_0x3bd277);}(_0x8827,0x68));var _0x7882=function(_0xc64008,_0x4c7661){_0xc64008=_0xc64008-0x0;var _0x386c9b=_0x8827[_0xc64008];return _0x386c9b;};'use strict';var EventEmitter=require(_0x7882('0x0'));var DashboardItem=require(_0x7882('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7882('0x2')](0x0);var events={'afterCreate':_0x7882('0x3'),'afterUpdate':_0x7882('0x4'),'afterDestroy':_0x7882('0x5')};function emitEvent(_0x26151e){return function(_0x16f5e5,_0x5aedb6,_0x173599){DashboardItemEvents['emit'](_0x26151e+':'+_0x16f5e5['id'],_0x16f5e5);DashboardItemEvents[_0x7882('0x6')](_0x26151e,_0x16f5e5);_0x173599(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x7882('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x7768=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x7dfe3b,_0x5a9772){var _0x4b4a9b=function(_0x1f1ba6){while(--_0x1f1ba6){_0x7dfe3b['push'](_0x7dfe3b['shift']());}};_0x4b4a9b(++_0x5a9772);}(_0x7768,0x1ea));var _0x8776=function(_0x1e0990,_0x3f60ac){_0x1e0990=_0x1e0990-0x0;var _0x125b95=_0x7768[_0x1e0990];return _0x125b95;};'use strict';var EventEmitter=require(_0x8776('0x0'));var DashboardItem=require(_0x8776('0x1'))['db'][_0x8776('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8776('0x3')](0x0);var events={'afterCreate':_0x8776('0x4'),'afterUpdate':_0x8776('0x5'),'afterDestroy':_0x8776('0x6')};function emitEvent(_0x44eb4c){return function(_0x5b7042,_0x154dd0,_0x26b93a){DashboardItemEvents[_0x8776('0x7')](_0x44eb4c+':'+_0x5b7042['id'],_0x5b7042);DashboardItemEvents[_0x8776('0x7')](_0x44eb4c,_0x5b7042);_0x26b93a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x8776('0x8')](e,emitEvent(event));}}module[_0x8776('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 6870617..5bf0eaf 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 _0x8e92=['../../config/environment','exports','define','dashboard_items','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x935165,_0x53e8fa){var _0xf91bf6=function(_0x57c3e2){while(--_0x57c3e2){_0x935165['push'](_0x935165['shift']());}};_0xf91bf6(++_0x53e8fa);}(_0x8e92,0x158));var _0x28e9=function(_0x305979,_0x1ada90){_0x305979=_0x305979-0x0;var _0x5b268f=_0x8e92[_0x305979];return _0x5b268f;};'use strict';var _=require(_0x28e9('0x0'));var util=require(_0x28e9('0x1'));var logger=require(_0x28e9('0x2'))('api');var moment=require(_0x28e9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x28e9('0x4'));var rimraf=require(_0x28e9('0x5'));var config=require(_0x28e9('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x28e9('0x7')]=function(_0x352e0b,_0x31296a){return _0x352e0b[_0x28e9('0x8')]('DashboardItem',attributes,{'tableName':_0x28e9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bfd=['util','../../config/logger','api','moment','bluebird','path','define','DashboardItem','dashboard_items','lodash'];(function(_0x190fc6,_0x134f6a){var _0x4d4d3a=function(_0x140e66){while(--_0x140e66){_0x190fc6['push'](_0x190fc6['shift']());}};_0x4d4d3a(++_0x134f6a);}(_0x0bfd,0x153));var _0xd0bf=function(_0xb17dc3,_0x356492){_0xb17dc3=_0xb17dc3-0x0;var _0x3054fa=_0x0bfd[_0xb17dc3];return _0x3054fa;};'use strict';var _=require(_0xd0bf('0x0'));var util=require(_0xd0bf('0x1'));var logger=require(_0xd0bf('0x2'))(_0xd0bf('0x3'));var moment=require(_0xd0bf('0x4'));var BPromise=require(_0xd0bf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0bf('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x5b62df,_0x156b98){return _0x5b62df[_0xd0bf('0x7')](_0xd0bf('0x8'),attributes,{'tableName':_0xd0bf('0x9'),'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 b448149..333e95c 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 _0x6484=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','redis','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x180afe,_0x1fc781){var _0x1ae63d=function(_0x3a3b15){while(--_0x3a3b15){_0x180afe['push'](_0x180afe['shift']());}};_0x1ae63d(++_0x1fc781);}(_0x6484,0x1dc));var _0x4648=function(_0x5d4b45,_0x296b35){_0x5d4b45=_0x5d4b45-0x0;var _0x5dd938=_0x6484[_0x5d4b45];return _0x5dd938;};'use strict';var _=require(_0x4648('0x0'));var util=require('util');var moment=require(_0x4648('0x1'));var BPromise=require(_0x4648('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4648('0x3'));var db=require(_0x4648('0x4'))['db'];var utils=require(_0x4648('0x5'));var logger=require(_0x4648('0x6'))(_0x4648('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4648('0x8')]['http']({'port':0x232a});config['redis']=_[_0x4648('0x9')](config[_0x4648('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4648('0xa')]));require('./dashboardItem.socket')[_0x4648('0xb')](socket);function respondWithRpcPromise(_0x101904,_0xd54234,_0x304310){return new BPromise(function(_0x2ffcb2,_0xced049){return client[_0x4648('0xc')](_0x101904,_0x304310)[_0x4648('0xd')](function(_0x4bc816){logger['info'](_0x4648('0xe'),_0xd54234,_0x4648('0xf'));logger['debug'](_0x4648('0x10'),_0xd54234,_0x4648('0xf'),JSON[_0x4648('0x11')](_0x4bc816));if(_0x4bc816[_0x4648('0x12')]){if(_0x4bc816[_0x4648('0x12')][_0x4648('0x13')]===0x1f4){logger[_0x4648('0x12')](_0x4648('0xe'),_0xd54234,_0x4bc816['error'][_0x4648('0x14')]);return _0xced049(_0x4bc816[_0x4648('0x12')][_0x4648('0x14')]);}logger['error'](_0x4648('0xe'),_0xd54234,_0x4bc816[_0x4648('0x12')][_0x4648('0x14')]);return _0x2ffcb2(_0x4bc816[_0x4648('0x12')]['message']);}else{logger[_0x4648('0x15')](_0x4648('0xe'),_0xd54234,_0x4648('0xf'));_0x2ffcb2(_0x4bc816[_0x4648('0x16')][_0x4648('0x14')]);}})[_0x4648('0x17')](function(_0x474e3c){logger['error'](_0x4648('0xe'),_0xd54234,_0x474e3c);_0xced049(_0x474e3c);});});} \ No newline at end of file +var _0x571a=['redis','defaults','localhost','socket.io-emitter','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x571a,0xdb));var _0xa571=function(_0x4394d1,_0x1f5644){_0x4394d1=_0x4394d1-0x0;var _0x4b8b72=_0x571a[_0x4394d1];return _0x4b8b72;};'use strict';var _=require(_0xa571('0x0'));var util=require(_0xa571('0x1'));var moment=require(_0xa571('0x2'));var BPromise=require(_0xa571('0x3'));var rs=require(_0xa571('0x4'));var fs=require('fs');var Redis=require(_0xa571('0x5'));var db=require(_0xa571('0x6'))['db'];var utils=require(_0xa571('0x7'));var logger=require(_0xa571('0x8'))('rpc');var config=require(_0xa571('0x9'));var jayson=require(_0xa571('0xa'));var client=jayson[_0xa571('0xb')][_0xa571('0xc')]({'port':0x232a});config[_0xa571('0xd')]=_[_0xa571('0xe')](config[_0xa571('0xd')],{'host':_0xa571('0xf'),'port':0x18eb});var socket=require(_0xa571('0x10'))(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x259d3f,_0x13d8d1,_0x27324d){return new BPromise(function(_0x280151,_0x5449b3){return client[_0xa571('0x11')](_0x259d3f,_0x27324d)[_0xa571('0x12')](function(_0x51d94f){logger[_0xa571('0x13')](_0xa571('0x14'),_0x13d8d1,_0xa571('0x15'));logger[_0xa571('0x16')](_0xa571('0x17'),_0x13d8d1,'request\x20sent',JSON[_0xa571('0x18')](_0x51d94f));if(_0x51d94f[_0xa571('0x19')]){if(_0x51d94f[_0xa571('0x19')]['code']===0x1f4){logger['error'](_0xa571('0x14'),_0x13d8d1,_0x51d94f[_0xa571('0x19')]['message']);return _0x5449b3(_0x51d94f['error'][_0xa571('0x1a')]);}logger[_0xa571('0x19')](_0xa571('0x14'),_0x13d8d1,_0x51d94f['error'][_0xa571('0x1a')]);return _0x280151(_0x51d94f['error'][_0xa571('0x1a')]);}else{logger[_0xa571('0x13')](_0xa571('0x14'),_0x13d8d1,'request\x20sent');_0x280151(_0x51d94f[_0xa571('0x1b')][_0xa571('0x1a')]);}})[_0xa571('0x1c')](function(_0x26ba20){logger[_0xa571('0x19')](_0xa571('0x14'),_0x13d8d1,_0x26ba20);_0x5449b3(_0x26ba20);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 913964e..d9db2d4 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 _0x96cd=['dashboardItem:','./dashboardItem.events','remove','update','register','length'];(function(_0x2ec667,_0x5e8943){var _0x37c9b5=function(_0x15b02d){while(--_0x15b02d){_0x2ec667['push'](_0x2ec667['shift']());}};_0x37c9b5(++_0x5e8943);}(_0x96cd,0xd9));var _0xd96c=function(_0x1538ab,_0x5320b4){_0x1538ab=_0x1538ab-0x0;var _0xd7838b=_0x96cd[_0x1538ab];return _0xd7838b;};'use strict';var DashboardItemEvents=require(_0xd96c('0x0'));var events=['save',_0xd96c('0x1'),_0xd96c('0x2')];function createListener(_0x2495e5,_0x49074c){return function(_0x32779f){_0x49074c['emit'](_0x2495e5,_0x32779f);};}function removeListener(_0x114bd6,_0x418237){return function(){DashboardItemEvents['removeListener'](_0x114bd6,_0x418237);};}exports[_0xd96c('0x3')]=function(_0x134f4f){for(var _0x4ce64e=0x0,_0x2117d7=events[_0xd96c('0x4')];_0x4ce64e<_0x2117d7;_0x4ce64e++){var _0x52bf91=events[_0x4ce64e];var _0x220e01=createListener(_0xd96c('0x5')+_0x52bf91,_0x134f4f);DashboardItemEvents['on'](_0x52bf91,_0x220e01);}}; \ No newline at end of file +var _0x7b0c=['length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x302e65,_0xe9995c){var _0x5c154e=function(_0x1948fd){while(--_0x1948fd){_0x302e65['push'](_0x302e65['shift']());}};_0x5c154e(++_0xe9995c);}(_0x7b0c,0x158));var _0xc7b0=function(_0x4a5dec,_0x54b6e3){_0x4a5dec=_0x4a5dec-0x0;var _0xfc96aa=_0x7b0c[_0x4a5dec];return _0xfc96aa;};'use strict';var DashboardItemEvents=require(_0xc7b0('0x0'));var events=[_0xc7b0('0x1'),_0xc7b0('0x2'),_0xc7b0('0x3')];function createListener(_0x109e70,_0x1e108b){return function(_0x562329){_0x1e108b[_0xc7b0('0x4')](_0x109e70,_0x562329);};}function removeListener(_0x315ebb,_0x56c5b3){return function(){DashboardItemEvents[_0xc7b0('0x5')](_0x315ebb,_0x56c5b3);};}exports[_0xc7b0('0x6')]=function(_0x287eb2){for(var _0x3f0157=0x0,_0x44b242=events[_0xc7b0('0x7')];_0x3f0157<_0x44b242;_0x3f0157++){var _0x4bc876=events[_0x3f0157];var _0x25c093=createListener(_0xc7b0('0x8')+_0x4bc876,_0x287eb2);DashboardItemEvents['on'](_0x4bc876,_0x25c093);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index b6271ae..9282674 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 _0xe2fe=['put','update','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post'];(function(_0x48cfd4,_0x1ea206){var _0x31b1d1=function(_0xfd4f04){while(--_0xfd4f04){_0x48cfd4['push'](_0x48cfd4['shift']());}};_0x31b1d1(++_0x1ea206);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var auth=require(_0xee2f('0x3'));var interaction=require(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var controller=require(_0xee2f('0x6'));router['get'](_0xee2f('0x7'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x9')]('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0xa')]('/:id',auth[_0xee2f('0x8')](),controller[_0xee2f('0xb')]);router['delete'](_0xee2f('0x7'),auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=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(_0x8ec8eb,_0x409190){var _0x3eb5b8=function(_0x2604bf){while(--_0x2604bf){_0x8ec8eb['push'](_0x8ec8eb['shift']());}};_0x3eb5b8(++_0x409190);}(_0xdc97,0x13b));var _0x7dc9=function(_0x693fd7,_0x1be63f){_0x693fd7=_0x693fd7-0x0;var _0x2760f9=_0xdc97[_0x693fd7];return _0x2760f9;};'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 03b851e..888c9d7 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 _0x6722=['first','second','third','sequelize','STRING','ENUM'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x6722,0xa5));var _0x2672=function(_0x7d5858,_0x51bff3){_0x7d5858=_0x7d5858-0x0;var _0x3c8041=_0x6722[_0x7d5858];return _0x3c8041;};'use strict';var Sequelize=require(_0x2672('0x0'));module['exports']={'name':{'type':Sequelize[_0x2672('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x2672('0x2')](_0x2672('0x3'),_0x2672('0x4'),_0x2672('0x5')),'allowNull':![],'defaultValue':_0x2672('0x3')},'description':{'type':Sequelize[_0x2672('0x1')]}}; \ No newline at end of file +var _0xbc1f=['third','sequelize','exports','STRING','first','second'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xbc1f,0x1e1));var _0xfbc1=function(_0x4103af,_0x33d1aa){_0x4103af=_0x4103af-0x0;var _0x12cedd=_0xbc1f[_0x4103af];return _0x12cedd;};'use strict';var Sequelize=require(_0xfbc1('0x0'));module[_0xfbc1('0x1')]={'name':{'type':Sequelize[_0xfbc1('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xfbc1('0x3'),_0xfbc1('0x4'),_0xfbc1('0x5')),'allowNull':![],'defaultValue':_0xfbc1('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 6b6081b..394531a 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 _0xcc3c=['findAll','rows','catch','params','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','reject','then','destroy','get','Dispositions','error','stack','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x21225c,_0x5c365e){var _0x229515=function(_0x4b9156){while(--_0x4b9156){_0x21225c['push'](_0x21225c['shift']());}};_0x229515(++_0x5c365e);}(_0xcc3c,0x199));var _0xccc3=function(_0x52af7e,_0x4ff4d4){_0x52af7e=_0x52af7e-0x0;var _0x505c75=_0xcc3c[_0x52af7e];return _0x505c75;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xccc3('0x0'));var rimraf=require(_0xccc3('0x1'));var zipdir=require(_0xccc3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xccc3('0x3'));var util=require(_0xccc3('0x4'));var path=require('path');var sox=require(_0xccc3('0x5'));var csv=require('to-csv');var ejs=require(_0xccc3('0x6'));var fs=require('fs');var _=require(_0xccc3('0x7'));var squel=require(_0xccc3('0x8'));var crypto=require(_0xccc3('0x9'));var jsforce=require(_0xccc3('0xa'));var deskjs=require(_0xccc3('0xb'));var toCsv=require('to-csv');var querystring=require(_0xccc3('0xc'));var Papa=require('papaparse');var Redis=require(_0xccc3('0xd'));var authService=require(_0xccc3('0xe'));var qs=require(_0xccc3('0xf'));var as=require(_0xccc3('0x10'));var hardwareService=require(_0xccc3('0x11'));var logger=require(_0xccc3('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xccc3('0x13'));var licenseUtil=require(_0xccc3('0x14'));var db=require(_0xccc3('0x15'))['db'];function respondWithStatusCode(_0x25b796,_0x372e49){_0x372e49=_0x372e49||0xcc;return function(_0x1591c0){if(_0x1591c0){return _0x25b796[_0xccc3('0x16')](_0x372e49);}return _0x25b796[_0xccc3('0x17')](_0x372e49)[_0xccc3('0x18')]();};}function respondWithResult(_0x4630f1,_0x44fa83){_0x44fa83=_0x44fa83||0xc8;return function(_0x2b1942){if(_0x2b1942){return _0x4630f1['status'](_0x44fa83)['json'](_0x2b1942);}};}function respondWithFilteredResult(_0xd983c6,_0x42d498){return function(_0x2aa9e2){if(_0x2aa9e2){var _0x419017=_0x2aa9e2[_0xccc3('0x19')],_0x4f73a0=_0x42d498[_0xccc3('0x1a')],_0x590b6e=_0x42d498[_0xccc3('0x1a')]+_0x42d498['limit'],_0xa5543d;if(_0x590b6e>=_0x419017){_0x590b6e=_0x419017;_0xa5543d=0xc8;}else{_0xa5543d=0xce;}_0xd983c6[_0xccc3('0x17')](_0xa5543d);return _0xd983c6[_0xccc3('0x1b')](_0xccc3('0x1c'),_0x4f73a0+'-'+_0x590b6e+'/'+_0x419017)[_0xccc3('0x1d')](_0x2aa9e2);}return null;};}function patchUpdates(_0xe53f58){return function(_0x437728){try{jsonpatch['apply'](_0x437728,_0xe53f58,!![]);}catch(_0x577ecb){return BPromise[_0xccc3('0x1e')](_0x577ecb);}return _0x437728['save']();};}function saveUpdates(_0x12e301,_0x18869d){return function(_0x2331dc){if(_0x2331dc){return _0x2331dc['update'](_0x12e301)[_0xccc3('0x1f')](function(_0x4546af){return _0x4546af;});}return null;};}function removeEntity(_0x47f737,_0x7998dc){return function(_0x19394f){if(_0x19394f){return _0x19394f[_0xccc3('0x20')]()[_0xccc3('0x1f')](function(){var _0x2a9868=_0x19394f[_0xccc3('0x21')]({'plain':!![]});var _0x4ab096=_0xccc3('0x22');return db['UserProfileResource'][_0xccc3('0x20')]({'where':{'type':_0x4ab096,'resourceId':_0x2a9868['id']}})['then'](function(){return _0x19394f;});})[_0xccc3('0x1f')](function(){_0x47f737['status'](0xcc)[_0xccc3('0x18')]();});}};}function handleEntityNotFound(_0x43c795,_0x45ad65){return function(_0xad2c48){if(!_0xad2c48){_0x43c795[_0xccc3('0x16')](0x194);}return _0xad2c48;};}function handleError(_0x370da6,_0x489792){_0x489792=_0x489792||0x1f4;return function(_0x266794){logger[_0xccc3('0x23')](_0x266794[_0xccc3('0x24')]);if(_0x266794[_0xccc3('0x25')]){delete _0x266794['name'];}_0x370da6[_0xccc3('0x17')](_0x489792)[_0xccc3('0x26')](_0x266794);};}exports['index']=function(_0x4a8abe,_0x1b9a97){var _0x4d4ae8={},_0x3f891d={},_0xabee2a={'count':0x0,'rows':[]};var _0x26b142=_[_0xccc3('0x27')](db[_0xccc3('0x28')][_0xccc3('0x29')],function(_0xc99cb5){return{'name':_0xc99cb5[_0xccc3('0x2a')],'type':_0xc99cb5[_0xccc3('0x2b')][_0xccc3('0x2c')]};});_0x3f891d[_0xccc3('0x2d')]=_[_0xccc3('0x27')](_0x26b142,_0xccc3('0x25'));_0x3f891d[_0xccc3('0x2e')]=_[_0xccc3('0x2f')](_0x4a8abe[_0xccc3('0x2e')]);_0x3f891d[_0xccc3('0x30')]=_[_0xccc3('0x31')](_0x3f891d[_0xccc3('0x2d')],_0x3f891d[_0xccc3('0x2e')]);_0x4d4ae8[_0xccc3('0x32')]=_['intersection'](_0x3f891d[_0xccc3('0x2d')],qs[_0xccc3('0x33')](_0x4a8abe[_0xccc3('0x2e')][_0xccc3('0x33')]));_0x4d4ae8[_0xccc3('0x32')]=_0x4d4ae8[_0xccc3('0x32')]['length']?_0x4d4ae8[_0xccc3('0x32')]:_0x3f891d[_0xccc3('0x2d')];if(!_0x4a8abe['query'][_0xccc3('0x34')](_0xccc3('0x35'))){_0x4d4ae8[_0xccc3('0x36')]=qs[_0xccc3('0x36')](_0x4a8abe['query'][_0xccc3('0x36')]);_0x4d4ae8[_0xccc3('0x1a')]=qs[_0xccc3('0x1a')](_0x4a8abe[_0xccc3('0x2e')][_0xccc3('0x1a')]);}_0x4d4ae8[_0xccc3('0x37')]=qs[_0xccc3('0x38')](_0x4a8abe['query'][_0xccc3('0x38')]);_0x4d4ae8[_0xccc3('0x39')]=qs[_0xccc3('0x30')](_[_0xccc3('0x3a')](_0x4a8abe[_0xccc3('0x2e')],_0x3f891d['filters']),_0x26b142);if(_0x4a8abe['query'][_0xccc3('0x3b')]){_0x4d4ae8['where']=_[_0xccc3('0x3c')](_0x4d4ae8['where'],{'$or':_[_0xccc3('0x27')](_0x26b142,function(_0x4b3413){if(_0x4b3413[_0xccc3('0x2b')]!==_0xccc3('0x3d')){var _0x227075={};_0x227075[_0x4b3413[_0xccc3('0x25')]]={'$like':'%'+_0x4a8abe[_0xccc3('0x2e')][_0xccc3('0x3b')]+'%'};return _0x227075;}})});}_0x4d4ae8=_[_0xccc3('0x3c')]({},_0x4d4ae8,_0x4a8abe[_0xccc3('0x3e')]);var _0x564e95={'where':_0x4d4ae8[_0xccc3('0x39')]};return db[_0xccc3('0x28')][_0xccc3('0x19')](_0x564e95)['then'](function(_0x5a82bc){_0xabee2a[_0xccc3('0x19')]=_0x5a82bc;if(_0x4a8abe[_0xccc3('0x2e')][_0xccc3('0x3f')]){_0x4d4ae8[_0xccc3('0x40')]=[{'all':!![]}];}return db[_0xccc3('0x28')][_0xccc3('0x41')](_0x4d4ae8);})[_0xccc3('0x1f')](function(_0xd83293){_0xabee2a[_0xccc3('0x42')]=_0xd83293;return _0xabee2a;})[_0xccc3('0x1f')](respondWithFilteredResult(_0x1b9a97,_0x4d4ae8))[_0xccc3('0x43')](handleError(_0x1b9a97,null));};exports['show']=function(_0x254fb5,_0x28be3e){var _0x37727c={'raw':!![],'where':{'id':_0x254fb5[_0xccc3('0x44')]['id']}},_0x4d2578={};_0x4d2578[_0xccc3('0x2d')]=_['keys'](db['Disposition'][_0xccc3('0x29')]);_0x4d2578[_0xccc3('0x2e')]=_[_0xccc3('0x2f')](_0x254fb5[_0xccc3('0x2e')]);_0x4d2578['filters']=_[_0xccc3('0x31')](_0x4d2578[_0xccc3('0x2d')],_0x4d2578[_0xccc3('0x2e')]);_0x37727c[_0xccc3('0x32')]=_[_0xccc3('0x31')](_0x4d2578[_0xccc3('0x2d')],qs[_0xccc3('0x33')](_0x254fb5[_0xccc3('0x2e')][_0xccc3('0x33')]));_0x37727c[_0xccc3('0x32')]=_0x37727c['attributes']['length']?_0x37727c['attributes']:_0x4d2578['model'];if(_0x254fb5[_0xccc3('0x2e')]['includeAll']){_0x37727c['include']=[{'all':!![]}];}_0x37727c=_[_0xccc3('0x3c')]({},_0x37727c,_0x254fb5[_0xccc3('0x3e')]);return db[_0xccc3('0x28')][_0xccc3('0x45')](_0x37727c)[_0xccc3('0x1f')](handleEntityNotFound(_0x28be3e,null))[_0xccc3('0x1f')](respondWithResult(_0x28be3e,null))[_0xccc3('0x43')](handleError(_0x28be3e,null));};exports[_0xccc3('0x46')]=function(_0x14f9bb,_0xfd065e){return db[_0xccc3('0x28')]['create'](_0x14f9bb[_0xccc3('0x47')],{})['then'](function(_0x3f5d99){var _0x208a9c=_0x14f9bb[_0xccc3('0x48')][_0xccc3('0x21')]({'plain':!![]});if(!_0x208a9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x208a9c[_0xccc3('0x49')]===_0xccc3('0x48')){var _0x49abf8=_0x3f5d99[_0xccc3('0x21')]({'plain':!![]});var _0xebba27=_0xccc3('0x22');return db['UserProfileSection'][_0xccc3('0x45')]({'where':{'name':_0xebba27,'userProfileId':_0x208a9c[_0xccc3('0x4a')]},'raw':!![]})[_0xccc3('0x1f')](function(_0xca59f2){if(_0xca59f2&&_0xca59f2[_0xccc3('0x4b')]===0x0){return db[_0xccc3('0x4c')][_0xccc3('0x46')]({'name':_0x49abf8[_0xccc3('0x25')],'resourceId':_0x49abf8['id'],'type':_0xca59f2[_0xccc3('0x25')],'sectionId':_0xca59f2['id']},{})[_0xccc3('0x1f')](function(){return _0x3f5d99;});}else{return _0x3f5d99;}})[_0xccc3('0x43')](function(_0xd62226){logger[_0xccc3('0x23')](_0xccc3('0x4d'),_0xd62226);throw _0xd62226;});}return _0x3f5d99;})['then'](respondWithResult(_0xfd065e,0xc9))['catch'](handleError(_0xfd065e,null));};exports[_0xccc3('0x4e')]=function(_0x433e08,_0x5af894){if(_0x433e08[_0xccc3('0x47')]['id']){delete _0x433e08['body']['id'];}return db[_0xccc3('0x28')][_0xccc3('0x45')]({'where':{'id':_0x433e08[_0xccc3('0x44')]['id']}})[_0xccc3('0x1f')](handleEntityNotFound(_0x5af894,null))[_0xccc3('0x1f')](saveUpdates(_0x433e08[_0xccc3('0x47')],null))[_0xccc3('0x1f')](respondWithResult(_0x5af894,null))[_0xccc3('0x43')](handleError(_0x5af894,null));};exports['destroy']=function(_0x56e0b0,_0x489993){return db[_0xccc3('0x28')][_0xccc3('0x45')]({'where':{'id':_0x56e0b0[_0xccc3('0x44')]['id']}})[_0xccc3('0x1f')](handleEntityNotFound(_0x489993,null))[_0xccc3('0x1f')](removeEntity(_0x489993,null))[_0xccc3('0x43')](handleError(_0x489993,null));}; \ No newline at end of file +var _0x7f37=['ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','destroy','then','get','Dispositions','UserProfileResource','error','stack','name','index','map','Disposition','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x2bdf5d,_0x4ff6fb){var _0x2125b8=function(_0x441707){while(--_0x441707){_0x2bdf5d['push'](_0x2bdf5d['shift']());}};_0x2125b8(++_0x4ff6fb);}(_0x7f37,0x190));var _0x77f3=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7f37[_0x8c43de];return _0xa6591b;};'use strict';var pdf=require(_0x77f3('0x0'));var emlformat=require(_0x77f3('0x1'));var rimraf=require(_0x77f3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x77f3('0x3'));var rp=require('request-promise');var moment=require(_0x77f3('0x4'));var BPromise=require(_0x77f3('0x5'));var Mustache=require(_0x77f3('0x6'));var util=require(_0x77f3('0x7'));var path=require(_0x77f3('0x8'));var sox=require(_0x77f3('0x9'));var csv=require('to-csv');var ejs=require(_0x77f3('0xa'));var fs=require('fs');var _=require(_0x77f3('0xb'));var squel=require(_0x77f3('0xc'));var crypto=require(_0x77f3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x77f3('0xe'));var toCsv=require(_0x77f3('0xf'));var querystring=require(_0x77f3('0x10'));var Papa=require('papaparse');var Redis=require(_0x77f3('0x11'));var authService=require(_0x77f3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x77f3('0x13'));var hardwareService=require(_0x77f3('0x14'));var logger=require(_0x77f3('0x15'))(_0x77f3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x77f3('0x17'));var db=require(_0x77f3('0x18'))['db'];function respondWithStatusCode(_0x220810,_0x398ab5){_0x398ab5=_0x398ab5||0xcc;return function(_0x21336c){if(_0x21336c){return _0x220810[_0x77f3('0x19')](_0x398ab5);}return _0x220810[_0x77f3('0x1a')](_0x398ab5)[_0x77f3('0x1b')]();};}function respondWithResult(_0x36f4c1,_0x252311){_0x252311=_0x252311||0xc8;return function(_0x11b028){if(_0x11b028){return _0x36f4c1[_0x77f3('0x1a')](_0x252311)[_0x77f3('0x1c')](_0x11b028);}};}function respondWithFilteredResult(_0x45388b,_0x5e4141){return function(_0x1515ab){if(_0x1515ab){var _0xf3ae34=_0x1515ab[_0x77f3('0x1d')],_0x4656a9=_0x5e4141[_0x77f3('0x1e')],_0x5b6550=_0x5e4141['offset']+_0x5e4141['limit'],_0x58b250;if(_0x5b6550>=_0xf3ae34){_0x5b6550=_0xf3ae34;_0x58b250=0xc8;}else{_0x58b250=0xce;}_0x45388b['status'](_0x58b250);return _0x45388b[_0x77f3('0x1f')](_0x77f3('0x20'),_0x4656a9+'-'+_0x5b6550+'/'+_0xf3ae34)[_0x77f3('0x1c')](_0x1515ab);}return null;};}function patchUpdates(_0x4a648a){return function(_0x16e6ab){try{jsonpatch['apply'](_0x16e6ab,_0x4a648a,!![]);}catch(_0x92011d){return BPromise['reject'](_0x92011d);}return _0x16e6ab[_0x77f3('0x21')]();};}function saveUpdates(_0x246a25,_0x469198){return function(_0x2b1fd5){if(_0x2b1fd5){return _0x2b1fd5[_0x77f3('0x22')](_0x246a25)['then'](function(_0x51707b){return _0x51707b;});}return null;};}function removeEntity(_0x4649dc,_0x4b1425){return function(_0x5de491){if(_0x5de491){return _0x5de491[_0x77f3('0x23')]()[_0x77f3('0x24')](function(){var _0x3e4609=_0x5de491[_0x77f3('0x25')]({'plain':!![]});var _0x4455e7=_0x77f3('0x26');return db[_0x77f3('0x27')][_0x77f3('0x23')]({'where':{'type':_0x4455e7,'resourceId':_0x3e4609['id']}})[_0x77f3('0x24')](function(){return _0x5de491;});})['then'](function(){_0x4649dc['status'](0xcc)[_0x77f3('0x1b')]();});}};}function handleEntityNotFound(_0x287f6a,_0x162b99){return function(_0x31deea){if(!_0x31deea){_0x287f6a[_0x77f3('0x19')](0x194);}return _0x31deea;};}function handleError(_0x5f1a53,_0x314ed0){_0x314ed0=_0x314ed0||0x1f4;return function(_0x19b6ea){logger[_0x77f3('0x28')](_0x19b6ea[_0x77f3('0x29')]);if(_0x19b6ea[_0x77f3('0x2a')]){delete _0x19b6ea[_0x77f3('0x2a')];}_0x5f1a53[_0x77f3('0x1a')](_0x314ed0)['send'](_0x19b6ea);};}exports[_0x77f3('0x2b')]=function(_0x4b4210,_0x54d6dc){var _0x2c3444={},_0x5d5f81={},_0x444faa={'count':0x0,'rows':[]};var _0xfdaf7d=_[_0x77f3('0x2c')](db[_0x77f3('0x2d')]['rawAttributes'],function(_0x1c0067){return{'name':_0x1c0067[_0x77f3('0x2e')],'type':_0x1c0067[_0x77f3('0x2f')][_0x77f3('0x30')]};});_0x5d5f81[_0x77f3('0x31')]=_['map'](_0xfdaf7d,_0x77f3('0x2a'));_0x5d5f81[_0x77f3('0x32')]=_[_0x77f3('0x33')](_0x4b4210['query']);_0x5d5f81[_0x77f3('0x34')]=_[_0x77f3('0x35')](_0x5d5f81['model'],_0x5d5f81[_0x77f3('0x32')]);_0x2c3444['attributes']=_[_0x77f3('0x35')](_0x5d5f81['model'],qs['fields'](_0x4b4210[_0x77f3('0x32')][_0x77f3('0x36')]));_0x2c3444[_0x77f3('0x37')]=_0x2c3444[_0x77f3('0x37')][_0x77f3('0x38')]?_0x2c3444[_0x77f3('0x37')]:_0x5d5f81[_0x77f3('0x31')];if(!_0x4b4210[_0x77f3('0x32')][_0x77f3('0x39')](_0x77f3('0x3a'))){_0x2c3444[_0x77f3('0x3b')]=qs[_0x77f3('0x3b')](_0x4b4210[_0x77f3('0x32')][_0x77f3('0x3b')]);_0x2c3444[_0x77f3('0x1e')]=qs[_0x77f3('0x1e')](_0x4b4210[_0x77f3('0x32')][_0x77f3('0x1e')]);}_0x2c3444[_0x77f3('0x3c')]=qs[_0x77f3('0x3d')](_0x4b4210[_0x77f3('0x32')]['sort']);_0x2c3444[_0x77f3('0x3e')]=qs['filters'](_['pick'](_0x4b4210[_0x77f3('0x32')],_0x5d5f81[_0x77f3('0x34')]),_0xfdaf7d);if(_0x4b4210[_0x77f3('0x32')][_0x77f3('0x3f')]){_0x2c3444[_0x77f3('0x3e')]=_['merge'](_0x2c3444[_0x77f3('0x3e')],{'$or':_['map'](_0xfdaf7d,function(_0x3112ea){if(_0x3112ea[_0x77f3('0x2f')]!==_0x77f3('0x40')){var _0xa93896={};_0xa93896[_0x3112ea[_0x77f3('0x2a')]]={'$like':'%'+_0x4b4210[_0x77f3('0x32')][_0x77f3('0x3f')]+'%'};return _0xa93896;}})});}_0x2c3444=_[_0x77f3('0x41')]({},_0x2c3444,_0x4b4210['options']);var _0x49aeb5={'where':_0x2c3444[_0x77f3('0x3e')]};return db[_0x77f3('0x2d')][_0x77f3('0x1d')](_0x49aeb5)[_0x77f3('0x24')](function(_0x968cb8){_0x444faa['count']=_0x968cb8;if(_0x4b4210[_0x77f3('0x32')][_0x77f3('0x42')]){_0x2c3444[_0x77f3('0x43')]=[{'all':!![]}];}return db[_0x77f3('0x2d')][_0x77f3('0x44')](_0x2c3444);})[_0x77f3('0x24')](function(_0x55c81b){_0x444faa['rows']=_0x55c81b;return _0x444faa;})[_0x77f3('0x24')](respondWithFilteredResult(_0x54d6dc,_0x2c3444))[_0x77f3('0x45')](handleError(_0x54d6dc,null));};exports[_0x77f3('0x46')]=function(_0x114431,_0x592122){var _0x1e4fa9={'raw':!![],'where':{'id':_0x114431[_0x77f3('0x47')]['id']}},_0x4c56f6={};_0x4c56f6[_0x77f3('0x31')]=_[_0x77f3('0x33')](db[_0x77f3('0x2d')]['rawAttributes']);_0x4c56f6['query']=_[_0x77f3('0x33')](_0x114431[_0x77f3('0x32')]);_0x4c56f6[_0x77f3('0x34')]=_[_0x77f3('0x35')](_0x4c56f6['model'],_0x4c56f6[_0x77f3('0x32')]);_0x1e4fa9[_0x77f3('0x37')]=_[_0x77f3('0x35')](_0x4c56f6['model'],qs[_0x77f3('0x36')](_0x114431[_0x77f3('0x32')]['fields']));_0x1e4fa9[_0x77f3('0x37')]=_0x1e4fa9[_0x77f3('0x37')][_0x77f3('0x38')]?_0x1e4fa9[_0x77f3('0x37')]:_0x4c56f6[_0x77f3('0x31')];if(_0x114431[_0x77f3('0x32')][_0x77f3('0x42')]){_0x1e4fa9[_0x77f3('0x43')]=[{'all':!![]}];}_0x1e4fa9=_[_0x77f3('0x41')]({},_0x1e4fa9,_0x114431[_0x77f3('0x48')]);return db['Disposition'][_0x77f3('0x49')](_0x1e4fa9)[_0x77f3('0x24')](handleEntityNotFound(_0x592122,null))[_0x77f3('0x24')](respondWithResult(_0x592122,null))[_0x77f3('0x45')](handleError(_0x592122,null));};exports[_0x77f3('0x4a')]=function(_0x42f88c,_0x1d0367){return db['Disposition']['create'](_0x42f88c['body'],{})[_0x77f3('0x24')](function(_0x134b8d){var _0x1d0ce0=_0x42f88c['user'][_0x77f3('0x25')]({'plain':!![]});if(!_0x1d0ce0)throw new Error(_0x77f3('0x4b'));if(_0x1d0ce0[_0x77f3('0x4c')]===_0x77f3('0x4d')){var _0x5da907=_0x134b8d[_0x77f3('0x25')]({'plain':!![]});var _0x215ca6=_0x77f3('0x26');return db['UserProfileSection'][_0x77f3('0x49')]({'where':{'name':_0x215ca6,'userProfileId':_0x1d0ce0[_0x77f3('0x4e')]},'raw':!![]})[_0x77f3('0x24')](function(_0x2e9b5c){if(_0x2e9b5c&&_0x2e9b5c[_0x77f3('0x4f')]===0x0){return db['UserProfileResource'][_0x77f3('0x4a')]({'name':_0x5da907[_0x77f3('0x2a')],'resourceId':_0x5da907['id'],'type':_0x2e9b5c[_0x77f3('0x2a')],'sectionId':_0x2e9b5c['id']},{})[_0x77f3('0x24')](function(){return _0x134b8d;});}else{return _0x134b8d;}})[_0x77f3('0x45')](function(_0x1659e4){logger[_0x77f3('0x28')](_0x77f3('0x50'),_0x1659e4);throw _0x1659e4;});}return _0x134b8d;})[_0x77f3('0x24')](respondWithResult(_0x1d0367,0xc9))['catch'](handleError(_0x1d0367,null));};exports[_0x77f3('0x22')]=function(_0x3e2c1d,_0x108764){if(_0x3e2c1d[_0x77f3('0x51')]['id']){delete _0x3e2c1d[_0x77f3('0x51')]['id'];}return db[_0x77f3('0x2d')][_0x77f3('0x49')]({'where':{'id':_0x3e2c1d['params']['id']}})[_0x77f3('0x24')](handleEntityNotFound(_0x108764,null))['then'](saveUpdates(_0x3e2c1d['body'],null))[_0x77f3('0x24')](respondWithResult(_0x108764,null))[_0x77f3('0x45')](handleError(_0x108764,null));};exports[_0x77f3('0x23')]=function(_0x52f3fa,_0x444bea){return db[_0x77f3('0x2d')][_0x77f3('0x49')]({'where':{'id':_0x52f3fa[_0x77f3('0x47')]['id']}})[_0x77f3('0x24')](handleEntityNotFound(_0x444bea,null))[_0x77f3('0x24')](removeEntity(_0x444bea,null))[_0x77f3('0x45')](handleError(_0x444bea,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a91be2e..b0e7679 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 _0x8d0a=['name_chat','name','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','ListId'];(function(_0x73b8b2,_0x12eed4){var _0x28a7c4=function(_0x426951){while(--_0x426951){_0x73b8b2['push'](_0x73b8b2['shift']());}};_0x28a7c4(++_0x12eed4);}(_0x8d0a,0x65));var _0xa8d0=function(_0x3c0139,_0x1e9065){_0x3c0139=_0x3c0139-0x0;var _0x3b063c=_0x8d0a[_0x3c0139];return _0x3b063c;};'use strict';var _=require(_0xa8d0('0x0'));var util=require('util');var logger=require(_0xa8d0('0x1'))(_0xa8d0('0x2'));var moment=require(_0xa8d0('0x3'));var BPromise=require(_0xa8d0('0x4'));var rp=require(_0xa8d0('0x5'));var fs=require('fs');var path=require(_0xa8d0('0x6'));var rimraf=require(_0xa8d0('0x7'));var config=require(_0xa8d0('0x8'));var attributes=require(_0xa8d0('0x9'));module['exports']=function(_0x1cac4f,_0x212aaf){return _0x1cac4f[_0xa8d0('0xa')](_0xa8d0('0xb'),attributes,{'tableName':_0xa8d0('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0xa8d0('0xd')]},{'unique':!![],'name':_0xa8d0('0xe'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0xa8d0('0xf'),'MailAccountId']},{'unique':!![],'name':_0xa8d0('0x10'),'fields':[_0xa8d0('0xf'),_0xa8d0('0x11')]},{'unique':!![],'name':_0xa8d0('0x12'),'fields':[_0xa8d0('0xf'),_0xa8d0('0x13')]},{'unique':!![],'name':_0xa8d0('0x14'),'fields':[_0xa8d0('0xf'),_0xa8d0('0x15')]},{'unique':!![],'name':_0xa8d0('0x16'),'fields':[_0xa8d0('0xf'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xed1f=['ListId','name_chat','name','name_mail','name_sms','FaxAccountId','name_whatsapp','WhatsappAccountId','lodash','util','moment','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice'];(function(_0x51fea2,_0x206d41){var _0x53dc54=function(_0xd33a84){while(--_0xd33a84){_0x51fea2['push'](_0x51fea2['shift']());}};_0x53dc54(++_0x206d41);}(_0xed1f,0x170));var _0xfed1=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xed1f[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfed1('0x2'));var BPromise=require('bluebird');var rp=require(_0xfed1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfed1('0x4'));var config=require(_0xfed1('0x5'));var attributes=require(_0xfed1('0x6'));module[_0xfed1('0x7')]=function(_0x465671,_0x1f2391){return _0x465671[_0xfed1('0x8')](_0xfed1('0x9'),attributes,{'tableName':_0xfed1('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xfed1('0xb'),'fields':['name',_0xfed1('0xc')]},{'unique':!![],'name':_0xfed1('0xd'),'fields':[_0xfed1('0xe'),'ChatWebsiteId']},{'unique':!![],'name':_0xfed1('0xf'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0xfed1('0x10'),'fields':[_0xfed1('0xe'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0xfed1('0xe'),_0xfed1('0x11')]},{'unique':!![],'name':'name_openchannel','fields':[_0xfed1('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':_0xfed1('0x12'),'fields':[_0xfed1('0xe'),_0xfed1('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index c2554e7..eb2b7f3 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 _0xdd39=['lodash','util','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xdd39,0x165));var _0x9dd3=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xdd39[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x9dd3('0x0'));var util=require(_0x9dd3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dd3('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9dd3('0x3'))(_0x9dd3('0x4'));var config=require('../../config/environment');var jayson=require(_0x9dd3('0x5'));var client=jayson[_0x9dd3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55e7bf,_0x76a79e,_0xce6f8a){return new BPromise(function(_0x1aa4c1,_0x4b9a7f){return client[_0x9dd3('0x7')](_0x55e7bf,_0xce6f8a)[_0x9dd3('0x8')](function(_0x5ab723){logger[_0x9dd3('0x9')](_0x9dd3('0xa'),_0x76a79e,_0x9dd3('0xb'));logger[_0x9dd3('0xc')]('Disposition,\x20%s,\x20%s,\x20%s',_0x76a79e,_0x9dd3('0xb'),JSON['stringify'](_0x5ab723));if(_0x5ab723[_0x9dd3('0xd')]){if(_0x5ab723['error'][_0x9dd3('0xe')]===0x1f4){logger[_0x9dd3('0xd')](_0x9dd3('0xa'),_0x76a79e,_0x5ab723[_0x9dd3('0xd')][_0x9dd3('0xf')]);return _0x4b9a7f(_0x5ab723[_0x9dd3('0xd')][_0x9dd3('0xf')]);}logger['error']('Disposition,\x20%s,\x20%s',_0x76a79e,_0x5ab723[_0x9dd3('0xd')]['message']);return _0x1aa4c1(_0x5ab723[_0x9dd3('0xd')][_0x9dd3('0xf')]);}else{logger['info'](_0x9dd3('0xa'),_0x76a79e,_0x9dd3('0xb'));_0x1aa4c1(_0x5ab723['result'][_0x9dd3('0xf')]);}})[_0x9dd3('0x10')](function(_0x3653ca){logger[_0x9dd3('0xd')]('Disposition,\x20%s,\x20%s',_0x76a79e,_0x3653ca);_0x4b9a7f(_0x3653ca);});});} \ No newline at end of file +var _0x8ce2=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','randomstring','ioredis'];(function(_0x274ecf,_0xc38609){var _0x301d07=function(_0x24e4d4){while(--_0x24e4d4){_0x274ecf['push'](_0x274ecf['shift']());}};_0x301d07(++_0xc38609);}(_0x8ce2,0x129));var _0x28ce=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x8ce2[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0x28ce('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x28ce('0x1'));var fs=require('fs');var Redis=require(_0x28ce('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x28ce('0x3'));var logger=require(_0x28ce('0x4'))(_0x28ce('0x5'));var config=require(_0x28ce('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x28ce('0x7')][_0x28ce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x209d00,_0xec9127,_0x3e48fc){return new BPromise(function(_0x2d7a4,_0xb064d8){return client[_0x28ce('0x9')](_0x209d00,_0x3e48fc)[_0x28ce('0xa')](function(_0x16a590){logger[_0x28ce('0xb')](_0x28ce('0xc'),_0xec9127,_0x28ce('0xd'));logger[_0x28ce('0xe')](_0x28ce('0xf'),_0xec9127,'request\x20sent',JSON[_0x28ce('0x10')](_0x16a590));if(_0x16a590[_0x28ce('0x11')]){if(_0x16a590[_0x28ce('0x11')]['code']===0x1f4){logger[_0x28ce('0x11')]('Disposition,\x20%s,\x20%s',_0xec9127,_0x16a590[_0x28ce('0x11')][_0x28ce('0x12')]);return _0xb064d8(_0x16a590[_0x28ce('0x11')]['message']);}logger['error'](_0x28ce('0xc'),_0xec9127,_0x16a590['error'][_0x28ce('0x12')]);return _0x2d7a4(_0x16a590[_0x28ce('0x11')][_0x28ce('0x12')]);}else{logger[_0x28ce('0xb')](_0x28ce('0xc'),_0xec9127,_0x28ce('0xd'));_0x2d7a4(_0x16a590[_0x28ce('0x13')]['message']);}})['catch'](function(_0x5b724b){logger['error'](_0x28ce('0xc'),_0xec9127,_0x5b724b);_0xb064d8(_0x5b724b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index f7d8b04..5f307ea 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 _0x6c99=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x240bca,_0x11757f){var _0x31c05a=function(_0x76f2f6){while(--_0x76f2f6){_0x240bca['push'](_0x240bca['shift']());}};_0x31c05a(++_0x11757f);}(_0x6c99,0x118));var _0x96c9=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0x6c99[_0x390a19];return _0x5d8230;};'use strict';var multer=require(_0x96c9('0x0'));var util=require(_0x96c9('0x1'));var path=require(_0x96c9('0x2'));var timeout=require(_0x96c9('0x3'));var express=require(_0x96c9('0x4'));var router=express[_0x96c9('0x5')]();var auth=require(_0x96c9('0x6'));var interaction=require(_0x96c9('0x7'));var config=require(_0x96c9('0x8'));var controller=require(_0x96c9('0x9'));router['get']('/',auth[_0x96c9('0xa')](),controller[_0x96c9('0xb')]);router[_0x96c9('0xc')](_0x96c9('0xd'),auth['isAuthenticated'](),controller[_0x96c9('0xe')]);router['post']('/',auth[_0x96c9('0xa')](),controller['create']);router['put'](_0x96c9('0xd'),auth[_0x96c9('0xa')](),controller[_0x96c9('0xf')]);router[_0x96c9('0x10')](_0x96c9('0xd'),auth[_0x96c9('0xa')](),controller[_0x96c9('0x11')]);module[_0x96c9('0x12')]=router; \ No newline at end of file +var _0x2401=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','util','path','express'];(function(_0x5eaba3,_0x25533f){var _0x31019e=function(_0x17e01e){while(--_0x17e01e){_0x5eaba3['push'](_0x5eaba3['shift']());}};_0x31019e(++_0x25533f);}(_0x2401,0x119));var _0x1240=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2401[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1240('0x0'));var util=require(_0x1240('0x1'));var path=require(_0x1240('0x2'));var timeout=require('connect-timeout');var express=require(_0x1240('0x3'));var router=express[_0x1240('0x4')]();var auth=require(_0x1240('0x5'));var interaction=require(_0x1240('0x6'));var config=require(_0x1240('0x7'));var controller=require('./disposition.controller');router[_0x1240('0x8')]('/',auth[_0x1240('0x9')](),controller[_0x1240('0xa')]);router['get']('/:id',auth[_0x1240('0x9')](),controller[_0x1240('0xb')]);router[_0x1240('0xc')]('/',auth[_0x1240('0x9')](),controller[_0x1240('0xd')]);router[_0x1240('0xe')](_0x1240('0xf'),auth[_0x1240('0x9')](),controller[_0x1240('0x10')]);router[_0x1240('0x11')](_0x1240('0xf'),auth[_0x1240('0x9')](),controller['destroy']);module[_0x1240('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index e80531f..c8e5f92 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 _0xbe22=['SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','7200','9600','14400','4800','12000','v17,v27,v29'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbe22,0x135));var _0x2be2=function(_0x77697,_0x29b045){_0x77697=_0x77697-0x0;var _0x5bdee8=_0xbe22[_0x77697];return _0x5bdee8;};'use strict';var Sequelize=require(_0x2be2('0x0'));module[_0x2be2('0x1')]={'name':{'type':Sequelize[_0x2be2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2be2('0x2')]},'ecm':{'type':Sequelize[_0x2be2('0x3')](_0x2be2('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x2be2('0x2')],'defaultValue':_0x2be2('0x5')},'localstationid':{'type':Sequelize[_0x2be2('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x2be2('0x3')](_0x2be2('0x6'),'4800',_0x2be2('0x7'),_0x2be2('0x8'),'12000',_0x2be2('0x9')),'defaultValue':_0x2be2('0xa')},'maxrate':{'type':Sequelize[_0x2be2('0x3')]('2400',_0x2be2('0xa'),_0x2be2('0x7'),_0x2be2('0x8'),_0x2be2('0xb'),_0x2be2('0x9')),'defaultValue':_0x2be2('0x9')},'modem':{'type':Sequelize[_0x2be2('0x2')],'defaultValue':_0x2be2('0xc')},'gateway':{'type':Sequelize[_0x2be2('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x2be2('0x3')](_0x2be2('0xd'),'IAX',_0x2be2('0xe'),_0x2be2('0xf')),'defaultValue':_0x2be2('0xd')},'key':{'type':Sequelize[_0x2be2('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2be2('0x10')],'defaultValue':function(){return _0x2be2('0x11');}},'notificationSound':{'type':Sequelize[_0x2be2('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2be2('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2be2('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2be2('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x2be2('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x2be2('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x516cbb){if(!_0x516cbb)this[_0x2be2('0x15')]('mandatoryDispositionPauseId',null);this[_0x2be2('0x15')](_0x2be2('0x16'),_0x516cbb);}}}; \ No newline at end of file +var _0x2d12=['INTEGER','SIP','IAX','KHOMP','TEXT','BOOLEAN','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','9600','12000','2400','7200','14400','v17,v27,v29'];(function(_0x475fd5,_0x261e69){var _0x414446=function(_0x3cb7c4){while(--_0x3cb7c4){_0x475fd5['push'](_0x475fd5['shift']());}};_0x414446(++_0x261e69);}(_0x2d12,0xe5));var _0x22d1=function(_0x5ae9d9,_0x45f388){_0x5ae9d9=_0x5ae9d9-0x0;var _0x1df272=_0x2d12[_0x5ae9d9];return _0x1df272;};'use strict';var Sequelize=require('sequelize');module[_0x22d1('0x0')]={'name':{'type':Sequelize[_0x22d1('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x22d1('0x2')](_0x22d1('0x3'),'no'),'defaultValue':_0x22d1('0x3')},'headerinfo':{'type':Sequelize[_0x22d1('0x1')],'defaultValue':_0x22d1('0x4')},'localstationid':{'type':Sequelize[_0x22d1('0x1')],'unique':_0x22d1('0x5')},'minrate':{'type':Sequelize[_0x22d1('0x2')]('2400',_0x22d1('0x6'),'7200',_0x22d1('0x7'),_0x22d1('0x8'),'14400'),'defaultValue':_0x22d1('0x6')},'maxrate':{'type':Sequelize[_0x22d1('0x2')](_0x22d1('0x9'),'4800',_0x22d1('0xa'),_0x22d1('0x7'),_0x22d1('0x8'),'14400'),'defaultValue':_0x22d1('0xb')},'modem':{'type':Sequelize[_0x22d1('0x1')],'defaultValue':_0x22d1('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x22d1('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x22d1('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x22d1('0x2')](_0x22d1('0xe'),_0x22d1('0xf'),'DADHI',_0x22d1('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x22d1('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x22d1('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x22d1('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x22d1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x22d1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x22d1('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x22d1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x22d1('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x22d1('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4e91e8){if(!_0x4e91e8)this[_0x22d1('0x13')](_0x22d1('0x14'),null);this[_0x22d1('0x13')](_0x22d1('0x15'),_0x4e91e8);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 2f26a51..605ca9f 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 _0x56e7=['intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','merge','includeAll','rows','catch','params','keys','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','length','pick','filter','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','include','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','maxrate','minrate','modem','t38timeout','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','createdAt','updatedAt','TrunkId','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','filename','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./faxAccount.socket','client','http','request','then','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','query','filters'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x56e7,0x7b));var _0x756e=function(_0x5af781,_0x3a01e2){_0x5af781=_0x5af781-0x0;var _0xe80527=_0x56e7[_0x5af781];return _0xe80527;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x756e('0x0'));var rimraf=require(_0x756e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x756e('0x2'));var rp=require(_0x756e('0x3'));var moment=require(_0x756e('0x4'));var BPromise=require(_0x756e('0x5'));var Mustache=require(_0x756e('0x6'));var util=require(_0x756e('0x7'));var path=require(_0x756e('0x8'));var sox=require('sox');var csv=require(_0x756e('0x9'));var ejs=require(_0x756e('0xa'));var fs=require('fs');var _=require(_0x756e('0xb'));var squel=require(_0x756e('0xc'));var crypto=require('crypto');var jsforce=require(_0x756e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x756e('0x9'));var querystring=require(_0x756e('0xe'));var Papa=require(_0x756e('0xf'));var Redis=require(_0x756e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x756e('0x11'));var hardwareService=require(_0x756e('0x12'));var logger=require(_0x756e('0x13'))('api');var utils=require(_0x756e('0x14'));var config=require(_0x756e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x756e('0x16')]=_['defaults'](config[_0x756e('0x16')],{'host':_0x756e('0x17'),'port':0x18eb});var socket=require(_0x756e('0x18'))(new Redis(config[_0x756e('0x16')]));require(_0x756e('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x756e('0x1a')][_0x756e('0x1b')]({'port':0x232c});var client9002=jayson[_0x756e('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x530e36,_0x1f7161,_0x33dd9c,_0x1cf73d){return new BPromise(function(_0x296b14,_0x42114e){var _0x285290=_0x1cf73d||client;return _0x285290[_0x756e('0x1c')](_0x530e36,_0x33dd9c)[_0x756e('0x1d')](function(_0xb17214){logger['info'](_0x756e('0x1e'),_0x1f7161,'request\x20sent');logger['debug'](_0x756e('0x1f'),_0x1f7161,_0x756e('0x20'),JSON[_0x756e('0x21')](_0xb17214));if(_0xb17214[_0x756e('0x22')]){if(_0xb17214[_0x756e('0x22')][_0x756e('0x23')]===0x1f4){logger[_0x756e('0x22')](_0x756e('0x1e'),_0x1f7161,_0xb17214[_0x756e('0x22')][_0x756e('0x24')]);return _0x42114e(_0xb17214[_0x756e('0x22')][_0x756e('0x24')]);}logger[_0x756e('0x22')](_0x756e('0x1e'),_0x1f7161,_0xb17214[_0x756e('0x22')][_0x756e('0x24')]);return _0x296b14(_0xb17214['error'][_0x756e('0x24')]);}else{logger['info'](_0x756e('0x1e'),_0x1f7161,_0x756e('0x20'));_0x296b14(_0xb17214[_0x756e('0x25')][_0x756e('0x24')]);}})['catch'](function(_0x3ef5ef){logger[_0x756e('0x22')](_0x756e('0x1e'),_0x1f7161,_0x3ef5ef);_0x42114e(_0x3ef5ef);});});}function respondWithStatusCode(_0x48638d,_0x32815d){_0x32815d=_0x32815d||0xcc;return function(_0x44f8f9){if(_0x44f8f9){return _0x48638d[_0x756e('0x26')](_0x32815d);}return _0x48638d['status'](_0x32815d)[_0x756e('0x27')]();};}function respondWithResult(_0x9db13b,_0x5b4bf0){_0x5b4bf0=_0x5b4bf0||0xc8;return function(_0x39befb){if(_0x39befb){return _0x9db13b[_0x756e('0x28')](_0x5b4bf0)[_0x756e('0x29')](_0x39befb);}};}function respondWithFilteredResult(_0x5a1cf0,_0x3c332e){return function(_0x308153){if(_0x308153){var _0x5c6949=_0x308153[_0x756e('0x2a')],_0x20543c=_0x3c332e[_0x756e('0x2b')],_0x2a7fdb=_0x3c332e[_0x756e('0x2b')]+_0x3c332e[_0x756e('0x2c')],_0x5be7b5;if(_0x2a7fdb>=_0x5c6949){_0x2a7fdb=_0x5c6949;_0x5be7b5=0xc8;}else{_0x5be7b5=0xce;}_0x5a1cf0[_0x756e('0x28')](_0x5be7b5);return _0x5a1cf0['set'](_0x756e('0x2d'),_0x20543c+'-'+_0x2a7fdb+'/'+_0x5c6949)['json'](_0x308153);}return null;};}function patchUpdates(_0x47b17c){return function(_0x1a09db){try{jsonpatch['apply'](_0x1a09db,_0x47b17c,!![]);}catch(_0x2e00ec){return BPromise[_0x756e('0x2e')](_0x2e00ec);}return _0x1a09db[_0x756e('0x2f')]();};}function saveUpdates(_0xccf702,_0x4529aa){return function(_0x17d9d1){if(_0x17d9d1){return _0x17d9d1[_0x756e('0x30')](_0xccf702)[_0x756e('0x1d')](function(_0x25457a){return _0x25457a;});}return null;};}function removeEntity(_0x2853b0,_0x25b3ce){return function(_0x228167){if(_0x228167){return _0x228167['destroy']()['then'](function(){var _0x1d116=_0x228167[_0x756e('0x31')]({'plain':!![]});var _0x23b6b4=_0x756e('0x32');return db[_0x756e('0x33')][_0x756e('0x34')]({'where':{'type':_0x23b6b4,'resourceId':_0x1d116['id']}})[_0x756e('0x1d')](function(){return _0x228167;});})['then'](function(){_0x2853b0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c7e70,_0xa63bf){return function(_0x1866a5){if(!_0x1866a5){_0x3c7e70['sendStatus'](0x194);}return _0x1866a5;};}function handleError(_0x32958b,_0x2d8a29){_0x2d8a29=_0x2d8a29||0x1f4;return function(_0x5d1575){logger[_0x756e('0x22')](_0x5d1575[_0x756e('0x35')]);if(_0x5d1575[_0x756e('0x36')]){delete _0x5d1575[_0x756e('0x36')];}_0x32958b[_0x756e('0x28')](_0x2d8a29)[_0x756e('0x37')](_0x5d1575);};}exports[_0x756e('0x38')]=function(_0x974313,_0x4a649b){var _0x279b25={'include':[{'model':db[_0x756e('0x39')],'as':_0x756e('0x3a')}]},_0x3f4564={},_0x20f979={'count':0x0,'rows':[]};var _0x3a66fe=_[_0x756e('0x3b')](db[_0x756e('0x3c')][_0x756e('0x3d')],function(_0x64b70d){return{'name':_0x64b70d['fieldName'],'type':_0x64b70d[_0x756e('0x3e')][_0x756e('0x3f')]};});_0x3f4564['model']=_[_0x756e('0x3b')](_0x3a66fe,_0x756e('0x36'));_0x3f4564[_0x756e('0x40')]=_['keys'](_0x974313[_0x756e('0x40')]);_0x3f4564[_0x756e('0x41')]=_[_0x756e('0x42')](_0x3f4564['model'],_0x3f4564[_0x756e('0x40')]);_0x279b25[_0x756e('0x43')]=_[_0x756e('0x42')](_0x3f4564[_0x756e('0x44')],qs[_0x756e('0x45')](_0x974313[_0x756e('0x40')]['fields']));_0x279b25[_0x756e('0x43')]=_0x279b25[_0x756e('0x43')]['length']?_0x279b25[_0x756e('0x43')]:_0x3f4564[_0x756e('0x44')];if(!_0x974313[_0x756e('0x40')][_0x756e('0x46')](_0x756e('0x47'))){_0x279b25[_0x756e('0x2c')]=qs[_0x756e('0x2c')](_0x974313[_0x756e('0x40')][_0x756e('0x2c')]);_0x279b25['offset']=qs[_0x756e('0x2b')](_0x974313['query'][_0x756e('0x2b')]);}_0x279b25[_0x756e('0x48')]=qs[_0x756e('0x49')](_0x974313['query'][_0x756e('0x49')]);_0x279b25[_0x756e('0x4a')]=qs[_0x756e('0x41')](_['pick'](_0x974313['query'],_0x3f4564[_0x756e('0x41')]),_0x3a66fe);if(_0x974313[_0x756e('0x40')]['filter']){_0x279b25['where']=_[_0x756e('0x4b')](_0x279b25[_0x756e('0x4a')],{'$or':_[_0x756e('0x3b')](_0x3a66fe,function(_0x57a91b){if(_0x57a91b[_0x756e('0x3e')]!=='VIRTUAL'){var _0x24905d={};_0x24905d[_0x57a91b[_0x756e('0x36')]]={'$like':'%'+_0x974313[_0x756e('0x40')]['filter']+'%'};return _0x24905d;}})});}_0x279b25=_[_0x756e('0x4b')]({},_0x279b25,_0x974313['options']);var _0x5064a3={'where':_0x279b25[_0x756e('0x4a')]};return db['FaxAccount'][_0x756e('0x2a')](_0x5064a3)[_0x756e('0x1d')](function(_0xd6ee1b){_0x20f979[_0x756e('0x2a')]=_0xd6ee1b;if(_0x974313[_0x756e('0x40')][_0x756e('0x4c')]){_0x279b25['include']=[{'all':!![]}];}return db[_0x756e('0x3c')]['findAll'](_0x279b25);})[_0x756e('0x1d')](function(_0x555d22){_0x20f979[_0x756e('0x4d')]=_0x555d22;return _0x20f979;})['then'](respondWithFilteredResult(_0x4a649b,_0x279b25))[_0x756e('0x4e')](handleError(_0x4a649b,null));};exports['show']=function(_0x58bda3,_0x37ddd0){var _0x27a201={'raw':![],'where':{'id':_0x58bda3[_0x756e('0x4f')]['id']},'include':[{'model':db[_0x756e('0x39')],'as':'mandatoryDispositionPause'}]},_0x52c976={};_0x52c976['model']=_[_0x756e('0x50')](db[_0x756e('0x3c')][_0x756e('0x3d')]);_0x52c976[_0x756e('0x40')]=_[_0x756e('0x50')](_0x58bda3[_0x756e('0x40')]);_0x52c976[_0x756e('0x41')]=_[_0x756e('0x42')](_0x52c976[_0x756e('0x44')],_0x52c976['query']);_0x27a201[_0x756e('0x43')]=_[_0x756e('0x42')](_0x52c976[_0x756e('0x44')],qs[_0x756e('0x45')](_0x58bda3[_0x756e('0x40')][_0x756e('0x45')]));_0x27a201[_0x756e('0x43')]=_0x27a201[_0x756e('0x43')]['length']?_0x27a201[_0x756e('0x43')]:_0x52c976[_0x756e('0x44')];if(_0x58bda3['query'][_0x756e('0x4c')]){_0x27a201['include']=[{'all':!![]}];}_0x27a201=_[_0x756e('0x4b')]({},_0x27a201,_0x58bda3[_0x756e('0x51')]);return db[_0x756e('0x3c')]['find'](_0x27a201)[_0x756e('0x1d')](handleEntityNotFound(_0x37ddd0,null))[_0x756e('0x1d')](respondWithResult(_0x37ddd0,null))[_0x756e('0x4e')](handleError(_0x37ddd0,null));};exports['create']=function(_0x4537fe,_0x54fea0){return db[_0x756e('0x3c')][_0x756e('0x52')](_0x4537fe[_0x756e('0x53')],{})[_0x756e('0x1d')](function(_0x3c9248){var _0x413061=_0x4537fe[_0x756e('0x54')][_0x756e('0x31')]({'plain':!![]});if(!_0x413061)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x413061[_0x756e('0x55')]===_0x756e('0x54')){var _0x8f8930=_0x3c9248[_0x756e('0x31')]({'plain':!![]});var _0x3c3cc3=_0x756e('0x32');return db[_0x756e('0x56')][_0x756e('0x57')]({'where':{'name':_0x3c3cc3,'userProfileId':_0x413061[_0x756e('0x58')]},'raw':!![]})[_0x756e('0x1d')](function(_0x237a29){if(_0x237a29&&_0x237a29[_0x756e('0x59')]===0x0){return db[_0x756e('0x33')][_0x756e('0x52')]({'name':_0x8f8930['name'],'resourceId':_0x8f8930['id'],'type':_0x237a29[_0x756e('0x36')],'sectionId':_0x237a29['id']},{})[_0x756e('0x1d')](function(){return _0x3c9248;});}else{return _0x3c9248;}})[_0x756e('0x4e')](function(_0x22b8f3){logger[_0x756e('0x22')](_0x756e('0x5a'),_0x22b8f3);throw _0x22b8f3;});}return _0x3c9248;})['then'](respondWithResult(_0x54fea0,0xc9))[_0x756e('0x4e')](handleError(_0x54fea0,null));};exports[_0x756e('0x30')]=function(_0x490722,_0x3c5976){if(_0x490722['body']['id']){delete _0x490722['body']['id'];}return db[_0x756e('0x3c')][_0x756e('0x57')]({'where':{'id':_0x490722[_0x756e('0x4f')]['id']},'include':[{'model':db[_0x756e('0x39')],'as':'mandatoryDispositionPause'}]})[_0x756e('0x1d')](handleEntityNotFound(_0x3c5976,null))[_0x756e('0x1d')](saveUpdates(_0x490722[_0x756e('0x53')],null))[_0x756e('0x1d')](respondWithResult(_0x3c5976,null))['catch'](handleError(_0x3c5976,null));};exports['destroy']=function(_0x207228,_0x2eefd8){return db[_0x756e('0x3c')][_0x756e('0x57')]({'where':{'id':_0x207228[_0x756e('0x4f')]['id']}})[_0x756e('0x1d')](handleEntityNotFound(_0x2eefd8,null))[_0x756e('0x1d')](removeEntity(_0x2eefd8,null))[_0x756e('0x4e')](handleError(_0x2eefd8,null));};exports['describe']=function(_0x5bd7f3,_0x465886){return db[_0x756e('0x3c')][_0x756e('0x5b')]()[_0x756e('0x1d')](respondWithResult(_0x465886,null))[_0x756e('0x4e')](handleError(_0x465886,null));};exports[_0x756e('0x5c')]=function(_0x1ce418,_0x580b66,_0x469da7){if(_0x1ce418['body']['id']){delete _0x1ce418[_0x756e('0x53')]['id'];}return db['FaxAccount'][_0x756e('0x57')]({'where':{'id':_0x1ce418[_0x756e('0x4f')]['id']}})[_0x756e('0x1d')](handleEntityNotFound(_0x580b66,null))['then'](function(_0x228718){if(_0x228718){_0x1ce418[_0x756e('0x53')][_0x756e('0x5d')]=_0x228718['id'];return db[_0x756e('0x5e')][_0x756e('0x52')](_0x1ce418[_0x756e('0x53')]);}})[_0x756e('0x1d')](respondWithResult(_0x580b66,null))['catch'](handleError(_0x580b66,null));};exports['getDispositions']=function(_0x14f39b,_0x1a2f9f,_0x3445ef){var _0x463397={'raw':![],'where':{}};var _0x2c4dc5={};var _0x2a5cf7={'count':0x0,'rows':[]};return db['FaxAccount'][_0x756e('0x5f')]({'where':{'id':_0x14f39b[_0x756e('0x4f')]['id']}})[_0x756e('0x1d')](handleEntityNotFound(_0x1a2f9f,null))[_0x756e('0x1d')](function(_0x338f50){if(_0x338f50){_0x2c4dc5[_0x756e('0x44')]=_[_0x756e('0x50')](db[_0x756e('0x5e')]['rawAttributes']);_0x2c4dc5[_0x756e('0x40')]=_[_0x756e('0x50')](_0x14f39b[_0x756e('0x40')]);_0x2c4dc5[_0x756e('0x41')]=_[_0x756e('0x42')](_0x2c4dc5['model'],_0x2c4dc5['query']);_0x463397[_0x756e('0x43')]=_['intersection'](_0x2c4dc5[_0x756e('0x44')],qs['fields'](_0x14f39b[_0x756e('0x40')]['fields']));_0x463397[_0x756e('0x43')]=_0x463397[_0x756e('0x43')][_0x756e('0x60')]?_0x463397['attributes']:_0x2c4dc5[_0x756e('0x44')];if(!_0x14f39b['query'][_0x756e('0x46')](_0x756e('0x47'))){_0x463397[_0x756e('0x2c')]=qs[_0x756e('0x2c')](_0x14f39b[_0x756e('0x40')][_0x756e('0x2c')]);_0x463397[_0x756e('0x2b')]=qs['offset'](_0x14f39b[_0x756e('0x40')][_0x756e('0x2b')]);}_0x463397['order']=qs[_0x756e('0x49')](_0x14f39b['query']['sort']);_0x463397[_0x756e('0x4a')]=qs['filters'](_[_0x756e('0x61')](_0x14f39b['query'],_0x2c4dc5[_0x756e('0x41')]));_0x463397['where'][_0x756e('0x5d')]=_0x338f50['id'];if(_0x14f39b[_0x756e('0x40')][_0x756e('0x62')]){_0x463397[_0x756e('0x4a')]=_[_0x756e('0x4b')](_0x463397[_0x756e('0x4a')],{'$or':_[_0x756e('0x3b')](_0x463397[_0x756e('0x43')],function(_0x3b1908){var _0x717019={};_0x717019[_0x3b1908]={'$like':'%'+_0x14f39b[_0x756e('0x40')][_0x756e('0x62')]+'%'};return _0x717019;})});}_0x463397=_[_0x756e('0x4b')]({},_0x463397,_0x14f39b['options']);return db['Disposition'][_0x756e('0x2a')]({'where':_0x463397[_0x756e('0x4a')]})[_0x756e('0x1d')](function(_0xdb48b){_0x2a5cf7[_0x756e('0x2a')]=_0xdb48b;if(_0x14f39b[_0x756e('0x40')][_0x756e('0x4c')]){_0x463397['include']=[{'all':!![]}];}return db[_0x756e('0x5e')][_0x756e('0x63')](_0x463397);})[_0x756e('0x1d')](function(_0x421a80){_0x2a5cf7[_0x756e('0x4d')]=_0x421a80;return _0x2a5cf7;});}})['then'](respondWithFilteredResult(_0x1a2f9f,_0x463397))[_0x756e('0x4e')](handleError(_0x1a2f9f,null));};exports['removeDispositions']=function(_0x5a95ee,_0x45dfd2,_0x48b8e8){return db[_0x756e('0x3c')][_0x756e('0x57')]({'where':{'id':_0x5a95ee['params']['id']}})[_0x756e('0x1d')](handleEntityNotFound(_0x45dfd2,null))[_0x756e('0x1d')](function(_0x3e4955){if(_0x3e4955){return _0x3e4955[_0x756e('0x64')](_0x5a95ee[_0x756e('0x40')]['ids']);}})[_0x756e('0x1d')](respondWithStatusCode(_0x45dfd2,null))[_0x756e('0x4e')](handleError(_0x45dfd2,null));};exports[_0x756e('0x65')]=function(_0xe1006b,_0x310f6f,_0x5c4d0d){if(_0xe1006b['body']['id']){delete _0xe1006b['body']['id'];}return db[_0x756e('0x3c')]['find']({'where':{'id':_0xe1006b[_0x756e('0x4f')]['id']}})[_0x756e('0x1d')](handleEntityNotFound(_0x310f6f,null))[_0x756e('0x1d')](function(_0x4e31a8){if(_0x4e31a8){_0xe1006b[_0x756e('0x53')]['FaxAccountId']=_0x4e31a8['id'];return db[_0x756e('0x66')]['create'](_0xe1006b[_0x756e('0x53')]);}})[_0x756e('0x1d')](respondWithResult(_0x310f6f,null))[_0x756e('0x4e')](handleError(_0x310f6f,null));};exports[_0x756e('0x67')]=function(_0xf5b62e,_0x12c6ce,_0x3f5631){var _0x3e72d6={'raw':![],'where':{}};var _0x3b1b92={};var _0x51dc21={'count':0x0,'rows':[]};return db[_0x756e('0x3c')][_0x756e('0x5f')]({'where':{'id':_0xf5b62e[_0x756e('0x4f')]['id']}})[_0x756e('0x1d')](handleEntityNotFound(_0x12c6ce,null))[_0x756e('0x1d')](function(_0x9d070a){if(_0x9d070a){_0x3b1b92[_0x756e('0x44')]=_[_0x756e('0x50')](db[_0x756e('0x66')][_0x756e('0x3d')]);_0x3b1b92[_0x756e('0x40')]=_[_0x756e('0x50')](_0xf5b62e['query']);_0x3b1b92[_0x756e('0x41')]=_[_0x756e('0x42')](_0x3b1b92[_0x756e('0x44')],_0x3b1b92[_0x756e('0x40')]);_0x3e72d6[_0x756e('0x43')]=_[_0x756e('0x42')](_0x3b1b92[_0x756e('0x44')],qs[_0x756e('0x45')](_0xf5b62e[_0x756e('0x40')][_0x756e('0x45')]));_0x3e72d6[_0x756e('0x43')]=_0x3e72d6[_0x756e('0x43')][_0x756e('0x60')]?_0x3e72d6[_0x756e('0x43')]:_0x3b1b92['model'];if(!_0xf5b62e[_0x756e('0x40')][_0x756e('0x46')](_0x756e('0x47'))){_0x3e72d6[_0x756e('0x2c')]=qs[_0x756e('0x2c')](_0xf5b62e[_0x756e('0x40')][_0x756e('0x2c')]);_0x3e72d6[_0x756e('0x2b')]=qs[_0x756e('0x2b')](_0xf5b62e['query'][_0x756e('0x2b')]);}_0x3e72d6['order']=qs[_0x756e('0x49')](_0xf5b62e['query'][_0x756e('0x49')]);_0x3e72d6['where']=qs[_0x756e('0x41')](_['pick'](_0xf5b62e[_0x756e('0x40')],_0x3b1b92[_0x756e('0x41')]));_0x3e72d6[_0x756e('0x4a')][_0x756e('0x5d')]=_0x9d070a['id'];if(_0xf5b62e[_0x756e('0x40')]['filter']){_0x3e72d6[_0x756e('0x4a')]=_[_0x756e('0x4b')](_0x3e72d6[_0x756e('0x4a')],{'$or':_[_0x756e('0x3b')](_0x3e72d6[_0x756e('0x43')],function(_0x4bf624){var _0x21d4a1={};_0x21d4a1[_0x4bf624]={'$like':'%'+_0xf5b62e[_0x756e('0x40')]['filter']+'%'};return _0x21d4a1;})});}_0x3e72d6=_['merge']({},_0x3e72d6,_0xf5b62e['options']);return db['CannedAnswer'][_0x756e('0x2a')]({'where':_0x3e72d6[_0x756e('0x4a')]})[_0x756e('0x1d')](function(_0x2acc58){_0x51dc21['count']=_0x2acc58;if(_0xf5b62e['query'][_0x756e('0x4c')]){_0x3e72d6[_0x756e('0x68')]=[{'all':!![]}];}return db[_0x756e('0x66')]['findAll'](_0x3e72d6);})[_0x756e('0x1d')](function(_0x467ccb){_0x51dc21[_0x756e('0x4d')]=_0x467ccb;return _0x51dc21;});}})[_0x756e('0x1d')](respondWithFilteredResult(_0x12c6ce,_0x3e72d6))[_0x756e('0x4e')](handleError(_0x12c6ce,null));};exports[_0x756e('0x69')]=function(_0x1299ee,_0x45a97e,_0x25f48f){return db['FaxAccount']['find']({'where':{'id':_0x1299ee[_0x756e('0x4f')]['id']}})[_0x756e('0x1d')](handleEntityNotFound(_0x45a97e,null))[_0x756e('0x1d')](function(_0x2aa46d){if(_0x2aa46d){return _0x2aa46d[_0x756e('0x69')](_0x1299ee[_0x756e('0x40')][_0x756e('0x6a')]);}})[_0x756e('0x1d')](respondWithStatusCode(_0x45a97e,null))[_0x756e('0x4e')](handleError(_0x45a97e,null));};exports[_0x756e('0x6b')]=function(_0x38752d,_0x99036c,_0x1f5173){return db[_0x756e('0x6c')][_0x756e('0x57')]({'where':{'id':_0x38752d[_0x756e('0x4f')]['id']}})[_0x756e('0x1d')](handleEntityNotFound(_0x99036c,null))[_0x756e('0x1d')](function(_0x57b023){if(_0x57b023){return _0x57b023['addInteraction'](_0x38752d[_0x756e('0x53')]['ids'],_[_0x756e('0x6d')](_0x38752d['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x99036c,null))[_0x756e('0x4e')](handleError(_0x99036c,null));};exports[_0x756e('0x6e')]=function(_0x17377c,_0x248cca,_0x5abb41){var _0x870304={'raw':![],'where':{}};var _0x5348af={};var _0x512b17={'count':0x0,'rows':[]};return db[_0x756e('0x3c')][_0x756e('0x5f')]({'where':{'id':_0x17377c[_0x756e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x248cca,null))[_0x756e('0x1d')](function(_0x2a7002){if(_0x2a7002){_0x5348af[_0x756e('0x44')]=_[_0x756e('0x50')](db[_0x756e('0x6c')][_0x756e('0x3d')]);_0x5348af[_0x756e('0x40')]=_[_0x756e('0x50')](_0x17377c['query']);_0x5348af[_0x756e('0x41')]=_[_0x756e('0x42')](_0x5348af['model'],_0x5348af[_0x756e('0x40')]);_0x870304[_0x756e('0x43')]=_[_0x756e('0x42')](_0x5348af['model'],qs[_0x756e('0x45')](_0x17377c[_0x756e('0x40')][_0x756e('0x45')]));_0x870304[_0x756e('0x43')]=_0x870304[_0x756e('0x43')][_0x756e('0x60')]?_0x870304[_0x756e('0x43')]:_0x5348af[_0x756e('0x44')];if(!_0x17377c[_0x756e('0x40')]['hasOwnProperty'](_0x756e('0x47'))){_0x870304[_0x756e('0x2c')]=qs[_0x756e('0x2c')](_0x17377c['query'][_0x756e('0x2c')]);_0x870304[_0x756e('0x2b')]=qs[_0x756e('0x2b')](_0x17377c['query'][_0x756e('0x2b')]);}_0x870304[_0x756e('0x48')]=qs[_0x756e('0x49')](_0x17377c[_0x756e('0x40')][_0x756e('0x49')]);_0x870304[_0x756e('0x4a')]=qs[_0x756e('0x41')](_[_0x756e('0x61')](_0x17377c[_0x756e('0x40')],_0x5348af[_0x756e('0x41')]));_0x870304[_0x756e('0x4a')][_0x756e('0x5d')]=_0x2a7002['id'];if(_0x17377c[_0x756e('0x40')]['filter']){_0x870304['where']=_['merge'](_0x870304[_0x756e('0x4a')],{'$or':_['map'](_0x870304[_0x756e('0x43')],function(_0x384abe){var _0x1f3dd4={};_0x1f3dd4[_0x384abe]={'$like':'%'+_0x17377c[_0x756e('0x40')][_0x756e('0x62')]+'%'};return _0x1f3dd4;})});}_0x870304=_['merge']({},_0x870304,_0x17377c[_0x756e('0x51')]);return db[_0x756e('0x6c')]['count']({'where':_0x870304[_0x756e('0x4a')]})['then'](function(_0x2ea394){_0x512b17['count']=_0x2ea394;if(_0x17377c[_0x756e('0x40')]['includeAll']){_0x870304[_0x756e('0x68')]=[{'model':db['CmContact'],'as':_0x756e('0x6f'),'required':![]},{'model':db[_0x756e('0x70')],'as':_0x756e('0x71'),'attributes':[_0x756e('0x36'),_0x756e('0x72'),_0x756e('0x73')],'required':![]},{'model':db[_0x756e('0x74')],'as':_0x756e('0x75'),'attributes':['id',_0x756e('0x36'),'color'],'where':_0x17377c[_0x756e('0x40')][_0x756e('0x76')]?{'id':_0x17377c['query'][_0x756e('0x76')]}:undefined,'required':_0x17377c['query'][_0x756e('0x76')]?!![]:![]}];}return db[_0x756e('0x6c')][_0x756e('0x63')](_0x870304);})[_0x756e('0x1d')](function(_0x15c8f4){_0x512b17['rows']=_0x15c8f4;return _0x512b17;});}})[_0x756e('0x1d')](respondWithFilteredResult(_0x248cca,_0x870304))[_0x756e('0x4e')](handleError(_0x248cca,null));};exports[_0x756e('0x77')]=function(_0xf2211e,_0x18352d,_0x502836){return db[_0x756e('0x3c')][_0x756e('0x5f')]({'where':{'id':_0xf2211e['params']['id']}})[_0x756e('0x1d')](handleEntityNotFound(_0x18352d,null))[_0x756e('0x1d')](function(_0x1d064b){if(_0x1d064b){return db[_0x756e('0x78')][_0x756e('0x79')](function(_0x2e9bb1){return db[_0x756e('0x7a')][_0x756e('0x34')]({'where':{'FaxAccountId':_0xf2211e[_0x756e('0x4f')]['id']},'transaction':_0x2e9bb1})[_0x756e('0x1d')](function(_0x5c17cd){var _0x43a5b0=_[_0x756e('0x3b')](_0xf2211e[_0x756e('0x53')],function(_0x397a2b){_0x397a2b[_0x756e('0x5d')]=_0xf2211e['params']['id'];return _0x397a2b;});return db[_0x756e('0x7a')][_0x756e('0x7b')](_0x43a5b0,{'transaction':_0x2e9bb1});});})[_0x756e('0x1d')](function(){return db[_0x756e('0x7a')][_0x756e('0x7c')]({'where':{'FaxAccountId':_0xf2211e[_0x756e('0x4f')]['id']},'order':_0x756e('0x7d')});});}})['then'](respondWithResult(_0x18352d,null))['catch'](handleError(_0x18352d,null));};exports[_0x756e('0x7e')]=function(_0x489c38,_0x613a23,_0x6bb3b9){var _0x2e70b0={};var _0x153ca2={};var _0x48d13c;var _0x5f3989;return db[_0x756e('0x3c')][_0x756e('0x5f')]({'where':{'id':_0x489c38[_0x756e('0x4f')]['id']}})[_0x756e('0x1d')](handleEntityNotFound(_0x613a23,null))[_0x756e('0x1d')](function(_0x4a2f7a){if(_0x4a2f7a){_0x48d13c=_0x4a2f7a;_0x153ca2[_0x756e('0x44')]=_[_0x756e('0x50')](db[_0x756e('0x7a')][_0x756e('0x3d')]);_0x153ca2[_0x756e('0x40')]=_[_0x756e('0x50')](_0x489c38[_0x756e('0x40')]);_0x153ca2[_0x756e('0x41')]=_[_0x756e('0x42')](_0x153ca2[_0x756e('0x44')],_0x153ca2[_0x756e('0x40')]);_0x2e70b0['attributes']=_['intersection'](_0x153ca2['model'],qs[_0x756e('0x45')](_0x489c38[_0x756e('0x40')]['fields']));_0x2e70b0[_0x756e('0x43')]=_0x2e70b0[_0x756e('0x43')][_0x756e('0x60')]?_0x2e70b0['attributes']:_0x153ca2[_0x756e('0x44')];_0x2e70b0[_0x756e('0x48')]=qs[_0x756e('0x49')](_0x489c38[_0x756e('0x40')]['sort']);_0x2e70b0['where']=qs[_0x756e('0x41')](_[_0x756e('0x61')](_0x489c38['query'],_0x153ca2[_0x756e('0x41')]));if(_0x489c38[_0x756e('0x40')]['filter']){_0x2e70b0[_0x756e('0x4a')]=_['merge'](_0x2e70b0[_0x756e('0x4a')],{'$or':_[_0x756e('0x3b')](_0x2e70b0['attributes'],function(_0x43942c){var _0x30ab9c={};_0x30ab9c[_0x43942c]={'$like':'%'+_0x489c38[_0x756e('0x40')]['filter']+'%'};return _0x30ab9c;})});}_0x2e70b0=_[_0x756e('0x4b')]({},_0x2e70b0,_0x489c38[_0x756e('0x51')]);return _0x48d13c[_0x756e('0x7e')](_0x2e70b0);}})[_0x756e('0x1d')](function(_0x15ea07){if(_0x15ea07){_0x5f3989=_0x15ea07[_0x756e('0x60')];if(!_0x489c38['query'][_0x756e('0x46')](_0x756e('0x47'))){_0x2e70b0['limit']=qs[_0x756e('0x2c')](_0x489c38[_0x756e('0x40')][_0x756e('0x2c')]);_0x2e70b0['offset']=qs[_0x756e('0x2b')](_0x489c38[_0x756e('0x40')]['offset']);}return _0x48d13c['getApplications'](_0x2e70b0);}})[_0x756e('0x1d')](function(_0x28cd9f){if(_0x28cd9f){return _0x28cd9f?{'count':_0x5f3989,'rows':_0x28cd9f}:null;}})[_0x756e('0x1d')](respondWithResult(_0x613a23,null))[_0x756e('0x4e')](handleError(_0x613a23,null));};function Extension(_0x5736cf,_0x51470a,_0x11f20f,_0x146f69){this[_0x756e('0x7f')]=_0x756e('0x80');this[_0x756e('0x81')]=_0x5736cf[_0x756e('0x82')];this['app']=_0x146f69;this['type']='system';this['description']=_0x756e('0x83');this[_0x756e('0x5d')]=_0x5736cf['id'];this[_0x756e('0x7d')]=_0x51470a;this[_0x756e('0x84')]=_0x11f20f;}function createExtensionsReciveFax(_0x8f0ed2){var _0x5547ef=0x1;var _0x1cff4f=[];_0x1cff4f[_0x756e('0x85')](new Extension(_0x8f0ed2,_0x5547ef,'',_0x756e('0x86')));_0x5547ef+=0x1;_0x1cff4f['push'](new Extension(_0x8f0ed2,_0x5547ef,_0x756e('0x87'),_0x756e('0x88')));_0x5547ef+=0x1;for(var _0x3c05fc in _0x8f0ed2){if(_0x8f0ed2[_0x756e('0x46')](_0x3c05fc)&&(_0x3c05fc==='ecm'||_0x3c05fc===_0x756e('0x82')||_0x3c05fc===_0x756e('0x89')||_0x3c05fc==='faxdetect'||_0x3c05fc==='headerinfo'||_0x3c05fc===_0x756e('0x8a')||_0x3c05fc===_0x756e('0x8b')||_0x3c05fc===_0x756e('0x8c')||_0x3c05fc===_0x756e('0x8d'))){_0x1cff4f[_0x756e('0x85')](new Extension(_0x8f0ed2,_0x5547ef,'FAXOPT('+_0x3c05fc+')='+_0x8f0ed2[_0x3c05fc],_0x756e('0x88')));_0x5547ef+=0x1;}}_0x1cff4f['push'](new Extension(_0x8f0ed2,_0x5547ef,'6',_0x756e('0x8e')));_0x5547ef+=0x1;_0x1cff4f[_0x756e('0x85')](new Extension(_0x8f0ed2,_0x5547ef,_0x756e('0x8f'),_0x756e('0x90')));_0x5547ef=0x0;return _0x1cff4f;}exports[_0x756e('0x91')]=function(_0x36ebd2,_0x22da0d,_0x37b11e){var _0x2b9207;return db[_0x756e('0x78')][_0x756e('0x79')](function(_0x2d4723){return db[_0x756e('0x3c')][_0x756e('0x52')](_0x36ebd2[_0x756e('0x53')],{'transaction':_0x2d4723})[_0x756e('0x1d')](function(_0x1fe9cf){_0x2b9207=_0x1fe9cf[_0x756e('0x31')]({'plain':!![]});return db[_0x756e('0x92')]['bulkCreate'](createExtensionsReciveFax(_0x2b9207),{'transaction':_0x2d4723});});})['then'](function(){return _0x2b9207;})[_0x756e('0x1d')](respondWithResult(_0x22da0d,null))[_0x756e('0x4e')](handleError(_0x22da0d,null));};exports[_0x756e('0x93')]=function(_0x45ca6c,_0x43430a,_0x3676e7){var _0x49bf7b;return db[_0x756e('0x78')][_0x756e('0x79')](function(_0x3e6b9e){return db[_0x756e('0x3c')][_0x756e('0x30')](_0x45ca6c[_0x756e('0x53')],{'where':{'id':_0x45ca6c[_0x756e('0x53')]['id']},'transaction':_0x3e6b9e})['then'](function(_0x239d93){return db[_0x756e('0x92')]['destroy']({'where':{'FaxAccountId':_0x45ca6c[_0x756e('0x53')]['id']},'transaction':_0x3e6b9e})['then'](function(_0x2e5349){return db[_0x756e('0x92')][_0x756e('0x7b')](createExtensionsReciveFax(_[_0x756e('0x6d')](_0x45ca6c['body'],[_0x756e('0x94'),_0x756e('0x3f'),_0x756e('0x95'),_0x756e('0x96'),_0x756e('0x97'),_0x756e('0x98')])),{'transaction':_0x3e6b9e});});});})['then'](function(){return db[_0x756e('0x3c')]['findById'](_0x45ca6c[_0x756e('0x53')]['id']);})['then'](respondWithResult(_0x43430a,null))['catch'](handleError(_0x43430a,null));};exports['getMessages']=function(_0xde703d,_0x43292d,_0x1d27bc){var _0x784711={'raw':!![],'where':{}};var _0x19db77={};var _0x4cbefb={'count':0x0,'rows':[]};return db[_0x756e('0x3c')][_0x756e('0x5f')]({'where':{'id':_0xde703d['params']['id']}})['then'](handleEntityNotFound(_0x43292d,null))[_0x756e('0x1d')](function(_0x589074){if(_0x589074){_0x19db77[_0x756e('0x44')]=_[_0x756e('0x50')](db[_0x756e('0x99')][_0x756e('0x3d')]);_0x19db77['query']=_[_0x756e('0x50')](_0xde703d[_0x756e('0x40')]);_0x19db77['filters']=_[_0x756e('0x42')](_0x19db77['model'],_0x19db77[_0x756e('0x40')]);_0x784711[_0x756e('0x43')]=_['intersection'](_0x19db77[_0x756e('0x44')],qs[_0x756e('0x45')](_0xde703d[_0x756e('0x40')][_0x756e('0x45')]));_0x784711['attributes']=_0x784711[_0x756e('0x43')][_0x756e('0x60')]?_0x784711[_0x756e('0x43')]:_0x19db77['model'];if(!_0xde703d[_0x756e('0x40')]['hasOwnProperty'](_0x756e('0x47'))){_0x784711[_0x756e('0x2c')]=qs[_0x756e('0x2c')](_0xde703d['query'][_0x756e('0x2c')]);_0x784711['offset']=qs[_0x756e('0x2b')](_0xde703d[_0x756e('0x40')][_0x756e('0x2b')]);}_0x784711[_0x756e('0x48')]=qs[_0x756e('0x49')](_0xde703d[_0x756e('0x40')]['sort']);_0x784711[_0x756e('0x4a')]=qs[_0x756e('0x41')](_[_0x756e('0x61')](_0xde703d[_0x756e('0x40')],_0x19db77[_0x756e('0x41')]));_0x784711['where'][_0x756e('0x5d')]=_0x589074['id'];if(_0xde703d[_0x756e('0x40')][_0x756e('0x62')]){_0x784711[_0x756e('0x4a')]=_[_0x756e('0x4b')](_0x784711[_0x756e('0x4a')],{'$or':_[_0x756e('0x3b')](_0x784711[_0x756e('0x43')],function(_0x46da35){var _0x2ecab9={};_0x2ecab9[_0x46da35]={'$like':'%'+_0xde703d[_0x756e('0x40')][_0x756e('0x62')]+'%'};return _0x2ecab9;})});}if(_0xde703d[_0x756e('0x40')][_0x756e('0x9a')]){var _0x583551=_0xde703d[_0x756e('0x40')]['$gte'][_0x756e('0x9b')](',');var _0x4d2d8d={};_0x4d2d8d[_0x583551[0x0]]={'$gte':moment(_0x583551[0x1])[_0x756e('0x9c')](_0x756e('0x9d'))};_0x784711['where']=_[_0x756e('0x4b')](_0x784711[_0x756e('0x4a')],_0x4d2d8d);}_0x784711=_[_0x756e('0x4b')]({},_0x784711,_0xde703d['options']);return db['FaxMessage'][_0x756e('0x2a')]({'where':_0x784711[_0x756e('0x4a')]})[_0x756e('0x1d')](function(_0x3864c5){_0x4cbefb['count']=_0x3864c5;if(_0xde703d[_0x756e('0x40')][_0x756e('0x4c')]){_0x784711[_0x756e('0x68')]=[{'all':!![]}];}return db[_0x756e('0x99')]['findAll'](_0x784711);})[_0x756e('0x1d')](function(_0x3af23c){_0x4cbefb[_0x756e('0x4d')]=_0x3af23c;return _0x4cbefb;});}})[_0x756e('0x1d')](respondWithFilteredResult(_0x43292d,_0x784711))[_0x756e('0x4e')](handleError(_0x43292d,null));};exports['send']=function(_0x58fdcb,_0x123bdd,_0x33c4bb){var _0x195ae7,_0x42be0b={},_0x51dc34;if(_0x58fdcb[_0x756e('0x53')]['to']){_0x51dc34=_0x58fdcb[_0x756e('0x53')]['to'][0x0];}return db[_0x756e('0x3c')][_0x756e('0x57')]({'where':{'id':_0x58fdcb['params']['id']},'include':[{'model':db['CmList'],'as':_0x756e('0x9e'),'include':[{'model':db[_0x756e('0x9f')],'as':_0x756e('0xa0'),'where':{'fax':_0x51dc34},'limit':0x1,'order':[[_0x756e('0x96'),_0x756e('0xa1')]]}]}]})[_0x756e('0x1d')](handleEntityNotFound(_0x123bdd,null))['then'](function(_0x9d188){_0x195ae7=_0x9d188;if(_0x58fdcb[_0x756e('0x53')][_0x756e('0xa2')]&&_0x58fdcb[_0x756e('0x53')][_0x756e('0xa2')]['length']){for(var _0x374337=0x0;_0x374337<_0x58fdcb[_0x756e('0x53')][_0x756e('0xa2')]['length'];_0x374337+=0x1){_0x58fdcb[_0x756e('0x53')]['attachments'][_0x374337]={'filename':_0x58fdcb[_0x756e('0x53')][_0x756e('0xa2')][_0x374337][_0x756e('0x36')],'id':_0x58fdcb[_0x756e('0x53')][_0x756e('0xa2')][_0x374337]['id'],'path':path[_0x756e('0xa3')](config[_0x756e('0xa4')],_0x756e('0xa5'),_0x58fdcb['body'][_0x756e('0xa2')][_0x374337][_0x756e('0xa6')])};}}return respondWithRpcPromise(_0x756e('0xa7'),_0x756e('0xa7'),{'FaxAccountId':_[_0x756e('0xa8')](_0x58fdcb[_0x756e('0x4f')]['id'])?undefined:_0x58fdcb[_0x756e('0x4f')]['id'],'path':_[_0x756e('0xa8')](_0x58fdcb[_0x756e('0x53')][_0x756e('0xa2')][0x0][_0x756e('0x8')])?undefined:_0x58fdcb[_0x756e('0x53')]['attachments'][0x0][_0x756e('0x8')],'fax':_[_0x756e('0xa8')](_0x58fdcb[_0x756e('0x53')]['to'][0x0])?undefined:_0x58fdcb[_0x756e('0x53')]['to'][0x0]},client9002);})['then'](function(){if(_0x195ae7){if(_['isNil'](_0x58fdcb[_0x756e('0x53')][_0x756e('0xa9')])){_0x58fdcb[_0x756e('0x53')][_0x756e('0xa9')]=util[_0x756e('0x9c')]('\x22%s\x22\x20<%s>',_0x195ae7[_0x756e('0x36')],_0x195ae7[_0x756e('0xaa')]);}if(_0x195ae7[_0x756e('0x9e')]){if(_0x195ae7['List'][_0x756e('0xa0')][_0x756e('0x60')]){return _0x195ae7[_0x756e('0x9e')][_0x756e('0xa0')][0x0];}else{return db[_0x756e('0x9f')][_0x756e('0x52')](_[_0x756e('0xab')](_0x58fdcb['body'],{'firstName':_0x58fdcb['body']['to'][0x0],'phone':_0x58fdcb[_0x756e('0x53')]['to'][0x0],'fax':_0x58fdcb[_0x756e('0x53')]['to'][0x0],'ListId':_0x195ae7[_0x756e('0x98')]}));}}else{throw new Error(_0x756e('0xac'));}}else{throw new Error(_0x756e('0xad'));}})[_0x756e('0x1d')](function(_0x46885c){if(_0x46885c){return db[_0x756e('0x6c')][_0x756e('0x57')]({'where':{'ContactId':_0x46885c['id'],'closed':![],'FaxAccountId':_0x195ae7['id']}})[_0x756e('0x1d')](function(_0x3eb8a2){if(_0x3eb8a2){return[_0x3eb8a2,![]];}return db[_0x756e('0x6c')][_0x756e('0x52')]({'UserId':_0x58fdcb[_0x756e('0x54')]['id'],'ContactId':_0x46885c['id'],'FaxAccountId':_0x195ae7['id'],'fax':_0x58fdcb['body']['to'][0x0],'firstMsgDirection':_0x756e('0xae'),'Messages':[_[_0x756e('0x4b')](_0x58fdcb[_0x756e('0x53')],{'read':![],'body':_0x58fdcb['body']['attachments'][0x0]['filename'],'FaxAccountId':_0x195ae7['id'],'UserId':_0x58fdcb[_0x756e('0x54')]['id'],'ContactId':_0x46885c['id'],'AttachmentId':_0x58fdcb['body'][_0x756e('0xa2')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x756e('0xaf')}]})['then'](function(_0xebf851){return[_0xebf851,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x3b8547,_0x571bda){if(_0x571bda){return _0x3b8547;}return db['FaxMessage'][_0x756e('0x52')]({'direction':_0x756e('0xae'),'read':![],'body':_0x58fdcb['body'][_0x756e('0xa2')][0x0][_0x756e('0xb0')],'FaxAccountId':_0x195ae7['id'],'FaxInteractionId':_0x3b8547['id'],'UserId':_0x58fdcb[_0x756e('0x54')]['id'],'ContactId':_0x3b8547['ContactId'],'AttachmentId':_0x58fdcb[_0x756e('0x53')][_0x756e('0xa2')][0x0]['id']})['then'](function(_0x54da4f){_0x3b8547[_0x756e('0xb1')][_0x756e('0xaf')]=[];_0x3b8547['dataValues'][_0x756e('0xaf')][_0x756e('0x85')](_0x54da4f[_0x756e('0xb1')]);return _0x3b8547;});})['then'](function(_0x4d30b1){respondWithRpcPromise(_0x756e('0xb2'),_0x756e('0xb2'),{'FaxAccountId':_[_0x756e('0xa8')](_0x58fdcb['params']['id'])?undefined:_0x58fdcb['params']['id'],'path':_[_0x756e('0xa8')](_0x58fdcb['body'][_0x756e('0xa2')][0x0][_0x756e('0x8')])?undefined:_0x58fdcb['body']['attachments'][0x0][_0x756e('0x8')],'fax':_['isNil'](_0x58fdcb['body']['to'][0x0])?undefined:_0x58fdcb[_0x756e('0x53')]['to'][0x0],'AttachmentId':_0x58fdcb['body'][_0x756e('0xa2')][0x0]['id']},client9002)['then'](function(_0x3919ca){logger[_0x756e('0xb3')]('SendFaxRpc,\x20%s',_0x3919ca);})['catch'](function(_0x19814c){logger[_0x756e('0xb3')](_0x756e('0xb4'),_0x19814c);});return _0x4d30b1;})[_0x756e('0x1d')](respondWithResult(_0x123bdd,null))['catch'](handleError(_0x123bdd,null));};exports[_0x756e('0xb5')]=function(_0x22e13b,_0x51e618,_0x51bd59){return db[_0x756e('0x3c')][_0x756e('0x57')]({'where':{'id':_0x22e13b[_0x756e('0x4f')]['id']}})[_0x756e('0x1d')](handleEntityNotFound(_0x51e618,null))[_0x756e('0x1d')](function(_0x2b2004){if(_0x2b2004){return _0x2b2004[_0x756e('0xb5')](_0x22e13b[_0x756e('0x53')][_0x756e('0x6a')],_[_0x756e('0x6d')](_0x22e13b[_0x756e('0x53')],[_0x756e('0x6a'),'id'])||{})[_0x756e('0xb6')](function(_0x621c43){for(var _0x2b947c=0x0;_0x2b947c<_0x22e13b[_0x756e('0x53')][_0x756e('0x6a')]['length'];_0x2b947c+=0x1){socket[_0x756e('0xb7')](_0x756e('0xb8'),{'UserId':_0x22e13b[_0x756e('0x53')][_0x756e('0x6a')][_0x2b947c],'FaxAccountId':_0x22e13b[_0x756e('0x4f')]['id']});}return _0x621c43;});}})['then'](respondWithResult(_0x51e618,null))[_0x756e('0x4e')](handleError(_0x51e618,null));};exports[_0x756e('0xb9')]=function(_0x578f0a,_0x5c383e,_0x2d2955){return db['FaxAccount'][_0x756e('0x57')]({'where':{'id':_0x578f0a[_0x756e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5c383e,null))[_0x756e('0x1d')](function(_0x3c4e63){if(_0x3c4e63){return _0x3c4e63[_0x756e('0xb9')](_0x578f0a[_0x756e('0x40')][_0x756e('0x6a')])['then'](function(){if(_[_0x756e('0xba')](_0x578f0a['query'][_0x756e('0x6a')])){for(var _0x27a733=0x0;_0x27a733<_0x578f0a[_0x756e('0x40')][_0x756e('0x6a')]['length'];_0x27a733+=0x1){socket[_0x756e('0xb7')](_0x756e('0xbb'),{'UserId':Number(_0x578f0a[_0x756e('0x40')][_0x756e('0x6a')][_0x27a733]),'FaxAccountId':Number(_0x578f0a['params']['id'])});}}else{socket[_0x756e('0xb7')]('userFaxAccount:remove',{'UserId':Number(_0x578f0a[_0x756e('0x40')]['ids']),'FaxAccountId':Number(_0x578f0a[_0x756e('0x4f')]['id'])});}});}})[_0x756e('0x1d')](respondWithStatusCode(_0x5c383e,null))['catch'](handleError(_0x5c383e,null));};exports['getAgents']=function(_0x25cddd,_0x5b1c1f,_0x138620){var _0x2137fd={};var _0x440746={};var _0x6bbeb8;var _0x22d81a;return db['FaxAccount']['findOne']({'where':{'id':_0x25cddd[_0x756e('0x4f')]['id']}})[_0x756e('0x1d')](handleEntityNotFound(_0x5b1c1f,null))[_0x756e('0x1d')](function(_0x4b8a04){if(_0x4b8a04){_0x6bbeb8=_0x4b8a04;_0x440746[_0x756e('0x44')]=_[_0x756e('0x50')](db[_0x756e('0x70')][_0x756e('0x3d')]);_0x440746['query']=_[_0x756e('0x50')](_0x25cddd[_0x756e('0x40')]);_0x440746[_0x756e('0x41')]=_['intersection'](_0x440746[_0x756e('0x44')],_0x440746[_0x756e('0x40')]);_0x2137fd['attributes']=_[_0x756e('0x42')](_0x440746['model'],qs['fields'](_0x25cddd['query']['fields']));_0x2137fd[_0x756e('0x43')]=_0x2137fd[_0x756e('0x43')][_0x756e('0x60')]?_0x2137fd[_0x756e('0x43')]:_0x440746[_0x756e('0x44')];_0x2137fd[_0x756e('0x48')]=qs[_0x756e('0x49')](_0x25cddd[_0x756e('0x40')][_0x756e('0x49')]);_0x2137fd[_0x756e('0x4a')]=qs[_0x756e('0x41')](_[_0x756e('0x61')](_0x25cddd[_0x756e('0x40')],_0x440746['filters']));if(_0x25cddd[_0x756e('0x40')][_0x756e('0x62')]){_0x2137fd[_0x756e('0x4a')]=_[_0x756e('0x4b')](_0x2137fd[_0x756e('0x4a')],{'$or':_['map'](_0x2137fd[_0x756e('0x43')],function(_0x5535a3){var _0x6befa5={};_0x6befa5[_0x5535a3]={'$like':'%'+_0x25cddd['query'][_0x756e('0x62')]+'%'};return _0x6befa5;})});}_0x2137fd=_[_0x756e('0x4b')]({},_0x2137fd,_0x25cddd[_0x756e('0x51')]);return _0x6bbeb8['getAgents'](_0x2137fd);}})['then'](function(_0x4042af){if(_0x4042af){_0x22d81a=_0x4042af[_0x756e('0x60')];if(!_0x25cddd[_0x756e('0x40')][_0x756e('0x46')](_0x756e('0x47'))){_0x2137fd[_0x756e('0x2c')]=qs[_0x756e('0x2c')](_0x25cddd['query']['limit']);_0x2137fd[_0x756e('0x2b')]=qs[_0x756e('0x2b')](_0x25cddd[_0x756e('0x40')][_0x756e('0x2b')]);}return _0x6bbeb8[_0x756e('0xbc')](_0x2137fd);}})[_0x756e('0x1d')](function(_0x2acc48){if(_0x2acc48){return _0x2acc48?{'count':_0x22d81a,'rows':_0x2acc48}:null;}})[_0x756e('0x1d')](respondWithResult(_0x5b1c1f,null))[_0x756e('0x4e')](handleError(_0x5b1c1f,null));}; \ No newline at end of file +var _0x17ba=['../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','end','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','show','Pause','fields','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','faxdetect','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','updatedAt','DESC','attachments','join','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','defaults','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','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/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x2a2cc8,_0xa53460){var _0x591e4f=function(_0x19042a){while(--_0x19042a){_0x2a2cc8['push'](_0x2a2cc8['shift']());}};_0x591e4f(++_0xa53460);}(_0x17ba,0xab));var _0xa17b=function(_0x3dfbe4,_0x3607ab){_0x3dfbe4=_0x3dfbe4-0x0;var _0x3108c5=_0x17ba[_0x3dfbe4];return _0x3108c5;};'use strict';var pdf=require(_0xa17b('0x0'));var emlformat=require(_0xa17b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa17b('0x2'));var jsonpatch=require(_0xa17b('0x3'));var rp=require(_0xa17b('0x4'));var moment=require(_0xa17b('0x5'));var BPromise=require(_0xa17b('0x6'));var Mustache=require(_0xa17b('0x7'));var util=require(_0xa17b('0x8'));var path=require(_0xa17b('0x9'));var sox=require(_0xa17b('0xa'));var csv=require(_0xa17b('0xb'));var ejs=require(_0xa17b('0xc'));var fs=require('fs');var _=require(_0xa17b('0xd'));var squel=require(_0xa17b('0xe'));var crypto=require(_0xa17b('0xf'));var jsforce=require(_0xa17b('0x10'));var deskjs=require(_0xa17b('0x11'));var toCsv=require(_0xa17b('0xb'));var querystring=require(_0xa17b('0x12'));var Papa=require(_0xa17b('0x13'));var Redis=require('ioredis');var authService=require(_0xa17b('0x14'));var qs=require(_0xa17b('0x15'));var as=require(_0xa17b('0x16'));var hardwareService=require(_0xa17b('0x17'));var logger=require(_0xa17b('0x18'))(_0xa17b('0x19'));var utils=require(_0xa17b('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xa17b('0x1b'));var db=require(_0xa17b('0x1c'))['db'];config[_0xa17b('0x1d')]=_['defaults'](config[_0xa17b('0x1d')],{'host':_0xa17b('0x1e'),'port':0x18eb});var socket=require(_0xa17b('0x1f'))(new Redis(config[_0xa17b('0x1d')]));require('./faxAccount.socket')[_0xa17b('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa17b('0x21')][_0xa17b('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xa17b('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3c63e3,_0x1c0578,_0x1f8141,_0x4870fb){return new BPromise(function(_0x98a295,_0x5e21c2){var _0x4d5592=_0x4870fb||client;return _0x4d5592['request'](_0x3c63e3,_0x1f8141)[_0xa17b('0x23')](function(_0x197237){logger['info'](_0xa17b('0x24'),_0x1c0578,_0xa17b('0x25'));logger[_0xa17b('0x26')](_0xa17b('0x27'),_0x1c0578,_0xa17b('0x25'),JSON[_0xa17b('0x28')](_0x197237));if(_0x197237[_0xa17b('0x29')]){if(_0x197237['error'][_0xa17b('0x2a')]===0x1f4){logger[_0xa17b('0x29')](_0xa17b('0x24'),_0x1c0578,_0x197237['error'][_0xa17b('0x2b')]);return _0x5e21c2(_0x197237[_0xa17b('0x29')][_0xa17b('0x2b')]);}logger[_0xa17b('0x29')](_0xa17b('0x24'),_0x1c0578,_0x197237[_0xa17b('0x29')]['message']);return _0x98a295(_0x197237[_0xa17b('0x29')]['message']);}else{logger[_0xa17b('0x2c')](_0xa17b('0x24'),_0x1c0578,'request\x20sent');_0x98a295(_0x197237['result'][_0xa17b('0x2b')]);}})[_0xa17b('0x2d')](function(_0x4216ca){logger[_0xa17b('0x29')](_0xa17b('0x24'),_0x1c0578,_0x4216ca);_0x5e21c2(_0x4216ca);});});}function respondWithStatusCode(_0x3a64f5,_0x4cd38e){_0x4cd38e=_0x4cd38e||0xcc;return function(_0x47aff8){if(_0x47aff8){return _0x3a64f5['sendStatus'](_0x4cd38e);}return _0x3a64f5['status'](_0x4cd38e)[_0xa17b('0x2e')]();};}function respondWithResult(_0x5ef356,_0x295e67){_0x295e67=_0x295e67||0xc8;return function(_0x4ff3f8){if(_0x4ff3f8){return _0x5ef356[_0xa17b('0x2f')](_0x295e67)[_0xa17b('0x30')](_0x4ff3f8);}};}function respondWithFilteredResult(_0x32cad9,_0x28e6b8){return function(_0x346cc2){if(_0x346cc2){var _0x3ccdb8=_0x346cc2[_0xa17b('0x31')],_0x2fbbe8=_0x28e6b8[_0xa17b('0x32')],_0x366b47=_0x28e6b8['offset']+_0x28e6b8['limit'],_0x43b1f5;if(_0x366b47>=_0x3ccdb8){_0x366b47=_0x3ccdb8;_0x43b1f5=0xc8;}else{_0x43b1f5=0xce;}_0x32cad9['status'](_0x43b1f5);return _0x32cad9[_0xa17b('0x33')](_0xa17b('0x34'),_0x2fbbe8+'-'+_0x366b47+'/'+_0x3ccdb8)[_0xa17b('0x30')](_0x346cc2);}return null;};}function patchUpdates(_0x2888b8){return function(_0x16dd1f){try{jsonpatch[_0xa17b('0x35')](_0x16dd1f,_0x2888b8,!![]);}catch(_0x312ac3){return BPromise[_0xa17b('0x36')](_0x312ac3);}return _0x16dd1f['save']();};}function saveUpdates(_0x1e33bf,_0x4da126){return function(_0x34f901){if(_0x34f901){return _0x34f901[_0xa17b('0x37')](_0x1e33bf)[_0xa17b('0x23')](function(_0x3bde6d){return _0x3bde6d;});}return null;};}function removeEntity(_0x4ec38d,_0x243876){return function(_0x596d48){if(_0x596d48){return _0x596d48[_0xa17b('0x38')]()[_0xa17b('0x23')](function(){var _0x323e0e=_0x596d48[_0xa17b('0x39')]({'plain':!![]});var _0x146fc3='FaxAccounts';return db[_0xa17b('0x3a')]['destroy']({'where':{'type':_0x146fc3,'resourceId':_0x323e0e['id']}})[_0xa17b('0x23')](function(){return _0x596d48;});})['then'](function(){_0x4ec38d[_0xa17b('0x2f')](0xcc)[_0xa17b('0x2e')]();});}};}function handleEntityNotFound(_0x4d5b1a,_0x36d952){return function(_0x31b399){if(!_0x31b399){_0x4d5b1a['sendStatus'](0x194);}return _0x31b399;};}function handleError(_0x2fb380,_0x107584){_0x107584=_0x107584||0x1f4;return function(_0x3d4cf3){logger[_0xa17b('0x29')](_0x3d4cf3[_0xa17b('0x3b')]);if(_0x3d4cf3['name']){delete _0x3d4cf3[_0xa17b('0x3c')];}_0x2fb380['status'](_0x107584)[_0xa17b('0x3d')](_0x3d4cf3);};}exports['index']=function(_0x118ad9,_0x4d31f2){var _0x1e457e={'include':[{'model':db['Pause'],'as':_0xa17b('0x3e')}]},_0x5b8ef6={},_0x110183={'count':0x0,'rows':[]};var _0x44be7d=_[_0xa17b('0x3f')](db[_0xa17b('0x40')][_0xa17b('0x41')],function(_0xdd429f){return{'name':_0xdd429f[_0xa17b('0x42')],'type':_0xdd429f[_0xa17b('0x43')]['key']};});_0x5b8ef6[_0xa17b('0x44')]=_[_0xa17b('0x3f')](_0x44be7d,'name');_0x5b8ef6[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0x118ad9[_0xa17b('0x45')]);_0x5b8ef6[_0xa17b('0x47')]=_[_0xa17b('0x48')](_0x5b8ef6[_0xa17b('0x44')],_0x5b8ef6['query']);_0x1e457e[_0xa17b('0x49')]=_[_0xa17b('0x48')](_0x5b8ef6[_0xa17b('0x44')],qs['fields'](_0x118ad9['query']['fields']));_0x1e457e[_0xa17b('0x49')]=_0x1e457e[_0xa17b('0x49')][_0xa17b('0x4a')]?_0x1e457e[_0xa17b('0x49')]:_0x5b8ef6[_0xa17b('0x44')];if(!_0x118ad9[_0xa17b('0x45')][_0xa17b('0x4b')](_0xa17b('0x4c'))){_0x1e457e[_0xa17b('0x4d')]=qs[_0xa17b('0x4d')](_0x118ad9[_0xa17b('0x45')][_0xa17b('0x4d')]);_0x1e457e['offset']=qs[_0xa17b('0x32')](_0x118ad9[_0xa17b('0x45')][_0xa17b('0x32')]);}_0x1e457e[_0xa17b('0x4e')]=qs[_0xa17b('0x4f')](_0x118ad9[_0xa17b('0x45')]['sort']);_0x1e457e[_0xa17b('0x50')]=qs[_0xa17b('0x47')](_[_0xa17b('0x51')](_0x118ad9[_0xa17b('0x45')],_0x5b8ef6[_0xa17b('0x47')]),_0x44be7d);if(_0x118ad9['query'][_0xa17b('0x52')]){_0x1e457e[_0xa17b('0x50')]=_[_0xa17b('0x53')](_0x1e457e[_0xa17b('0x50')],{'$or':_['map'](_0x44be7d,function(_0x37a020){if(_0x37a020[_0xa17b('0x43')]!==_0xa17b('0x54')){var _0x2906fd={};_0x2906fd[_0x37a020[_0xa17b('0x3c')]]={'$like':'%'+_0x118ad9[_0xa17b('0x45')][_0xa17b('0x52')]+'%'};return _0x2906fd;}})});}_0x1e457e=_['merge']({},_0x1e457e,_0x118ad9[_0xa17b('0x55')]);var _0x27b6cf={'where':_0x1e457e['where']};return db[_0xa17b('0x40')][_0xa17b('0x31')](_0x27b6cf)[_0xa17b('0x23')](function(_0x5d381a){_0x110183[_0xa17b('0x31')]=_0x5d381a;if(_0x118ad9[_0xa17b('0x45')]['includeAll']){_0x1e457e[_0xa17b('0x56')]=[{'all':!![]}];}return db[_0xa17b('0x40')]['findAll'](_0x1e457e);})[_0xa17b('0x23')](function(_0x347436){_0x110183['rows']=_0x347436;return _0x110183;})[_0xa17b('0x23')](respondWithFilteredResult(_0x4d31f2,_0x1e457e))[_0xa17b('0x2d')](handleError(_0x4d31f2,null));};exports[_0xa17b('0x57')]=function(_0x55aa4b,_0x2f4a2c){var _0x133823={'raw':![],'where':{'id':_0x55aa4b['params']['id']},'include':[{'model':db[_0xa17b('0x58')],'as':_0xa17b('0x3e')}]},_0x32e7ce={};_0x32e7ce[_0xa17b('0x44')]=_[_0xa17b('0x46')](db[_0xa17b('0x40')][_0xa17b('0x41')]);_0x32e7ce[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0x55aa4b[_0xa17b('0x45')]);_0x32e7ce[_0xa17b('0x47')]=_[_0xa17b('0x48')](_0x32e7ce[_0xa17b('0x44')],_0x32e7ce[_0xa17b('0x45')]);_0x133823['attributes']=_[_0xa17b('0x48')](_0x32e7ce[_0xa17b('0x44')],qs[_0xa17b('0x59')](_0x55aa4b[_0xa17b('0x45')][_0xa17b('0x59')]));_0x133823[_0xa17b('0x49')]=_0x133823[_0xa17b('0x49')][_0xa17b('0x4a')]?_0x133823[_0xa17b('0x49')]:_0x32e7ce['model'];if(_0x55aa4b['query'][_0xa17b('0x5a')]){_0x133823[_0xa17b('0x56')]=[{'all':!![]}];}_0x133823=_['merge']({},_0x133823,_0x55aa4b['options']);return db['FaxAccount'][_0xa17b('0x5b')](_0x133823)[_0xa17b('0x23')](handleEntityNotFound(_0x2f4a2c,null))[_0xa17b('0x23')](respondWithResult(_0x2f4a2c,null))[_0xa17b('0x2d')](handleError(_0x2f4a2c,null));};exports[_0xa17b('0x5c')]=function(_0x15a897,_0x5f2400){return db['FaxAccount']['create'](_0x15a897['body'],{})['then'](function(_0x2a62e4){var _0x172479=_0x15a897[_0xa17b('0x5d')][_0xa17b('0x39')]({'plain':!![]});if(!_0x172479)throw new Error(_0xa17b('0x5e'));if(_0x172479[_0xa17b('0x5f')]===_0xa17b('0x5d')){var _0x55b98a=_0x2a62e4[_0xa17b('0x39')]({'plain':!![]});var _0x2417d9=_0xa17b('0x60');return db[_0xa17b('0x61')][_0xa17b('0x5b')]({'where':{'name':_0x2417d9,'userProfileId':_0x172479[_0xa17b('0x62')]},'raw':!![]})[_0xa17b('0x23')](function(_0x307727){if(_0x307727&&_0x307727[_0xa17b('0x63')]===0x0){return db[_0xa17b('0x3a')][_0xa17b('0x5c')]({'name':_0x55b98a[_0xa17b('0x3c')],'resourceId':_0x55b98a['id'],'type':_0x307727['name'],'sectionId':_0x307727['id']},{})[_0xa17b('0x23')](function(){return _0x2a62e4;});}else{return _0x2a62e4;}})['catch'](function(_0x3de0d8){logger[_0xa17b('0x29')](_0xa17b('0x64'),_0x3de0d8);throw _0x3de0d8;});}return _0x2a62e4;})[_0xa17b('0x23')](respondWithResult(_0x5f2400,0xc9))['catch'](handleError(_0x5f2400,null));};exports[_0xa17b('0x37')]=function(_0x57a1d9,_0x146a37){if(_0x57a1d9['body']['id']){delete _0x57a1d9['body']['id'];}return db[_0xa17b('0x40')][_0xa17b('0x5b')]({'where':{'id':_0x57a1d9['params']['id']},'include':[{'model':db[_0xa17b('0x58')],'as':_0xa17b('0x3e')}]})['then'](handleEntityNotFound(_0x146a37,null))['then'](saveUpdates(_0x57a1d9[_0xa17b('0x65')],null))[_0xa17b('0x23')](respondWithResult(_0x146a37,null))['catch'](handleError(_0x146a37,null));};exports[_0xa17b('0x38')]=function(_0x16d6e3,_0x495384){return db[_0xa17b('0x40')][_0xa17b('0x5b')]({'where':{'id':_0x16d6e3[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x495384,null))[_0xa17b('0x23')](removeEntity(_0x495384,null))['catch'](handleError(_0x495384,null));};exports[_0xa17b('0x67')]=function(_0x3d4e6a,_0x1367c5){return db[_0xa17b('0x40')][_0xa17b('0x67')]()[_0xa17b('0x23')](respondWithResult(_0x1367c5,null))[_0xa17b('0x2d')](handleError(_0x1367c5,null));};exports[_0xa17b('0x68')]=function(_0x3fb393,_0x3b6676,_0x4e263d){if(_0x3fb393[_0xa17b('0x65')]['id']){delete _0x3fb393[_0xa17b('0x65')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x3fb393[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x3b6676,null))[_0xa17b('0x23')](function(_0x1b5f10){if(_0x1b5f10){_0x3fb393[_0xa17b('0x65')]['FaxAccountId']=_0x1b5f10['id'];return db[_0xa17b('0x69')][_0xa17b('0x5c')](_0x3fb393[_0xa17b('0x65')]);}})[_0xa17b('0x23')](respondWithResult(_0x3b6676,null))['catch'](handleError(_0x3b6676,null));};exports[_0xa17b('0x6a')]=function(_0x4b7980,_0x652d41,_0x95ee49){var _0x3c9ea6={'raw':![],'where':{}};var _0x3b1ccf={};var _0x3ab285={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa17b('0x6b')]({'where':{'id':_0x4b7980[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x652d41,null))[_0xa17b('0x23')](function(_0x3bec94){if(_0x3bec94){_0x3b1ccf['model']=_[_0xa17b('0x46')](db[_0xa17b('0x69')]['rawAttributes']);_0x3b1ccf[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0x4b7980['query']);_0x3b1ccf['filters']=_[_0xa17b('0x48')](_0x3b1ccf[_0xa17b('0x44')],_0x3b1ccf[_0xa17b('0x45')]);_0x3c9ea6['attributes']=_['intersection'](_0x3b1ccf['model'],qs[_0xa17b('0x59')](_0x4b7980['query'][_0xa17b('0x59')]));_0x3c9ea6[_0xa17b('0x49')]=_0x3c9ea6[_0xa17b('0x49')][_0xa17b('0x4a')]?_0x3c9ea6['attributes']:_0x3b1ccf['model'];if(!_0x4b7980['query'][_0xa17b('0x4b')](_0xa17b('0x4c'))){_0x3c9ea6[_0xa17b('0x4d')]=qs[_0xa17b('0x4d')](_0x4b7980[_0xa17b('0x45')][_0xa17b('0x4d')]);_0x3c9ea6[_0xa17b('0x32')]=qs[_0xa17b('0x32')](_0x4b7980[_0xa17b('0x45')]['offset']);}_0x3c9ea6[_0xa17b('0x4e')]=qs['sort'](_0x4b7980[_0xa17b('0x45')]['sort']);_0x3c9ea6[_0xa17b('0x50')]=qs[_0xa17b('0x47')](_[_0xa17b('0x51')](_0x4b7980['query'],_0x3b1ccf[_0xa17b('0x47')]));_0x3c9ea6['where'][_0xa17b('0x6c')]=_0x3bec94['id'];if(_0x4b7980[_0xa17b('0x45')][_0xa17b('0x52')]){_0x3c9ea6['where']=_[_0xa17b('0x53')](_0x3c9ea6[_0xa17b('0x50')],{'$or':_[_0xa17b('0x3f')](_0x3c9ea6[_0xa17b('0x49')],function(_0x330476){var _0x576e36={};_0x576e36[_0x330476]={'$like':'%'+_0x4b7980[_0xa17b('0x45')][_0xa17b('0x52')]+'%'};return _0x576e36;})});}_0x3c9ea6=_[_0xa17b('0x53')]({},_0x3c9ea6,_0x4b7980[_0xa17b('0x55')]);return db[_0xa17b('0x69')]['count']({'where':_0x3c9ea6[_0xa17b('0x50')]})[_0xa17b('0x23')](function(_0x1c5d9c){_0x3ab285['count']=_0x1c5d9c;if(_0x4b7980[_0xa17b('0x45')][_0xa17b('0x5a')]){_0x3c9ea6[_0xa17b('0x56')]=[{'all':!![]}];}return db[_0xa17b('0x69')][_0xa17b('0x6d')](_0x3c9ea6);})[_0xa17b('0x23')](function(_0x11fe9f){_0x3ab285[_0xa17b('0x6e')]=_0x11fe9f;return _0x3ab285;});}})[_0xa17b('0x23')](respondWithFilteredResult(_0x652d41,_0x3c9ea6))[_0xa17b('0x2d')](handleError(_0x652d41,null));};exports['removeDispositions']=function(_0x144583,_0x5b5bd3,_0x5b7037){return db[_0xa17b('0x40')][_0xa17b('0x5b')]({'where':{'id':_0x144583[_0xa17b('0x66')]['id']}})['then'](handleEntityNotFound(_0x5b5bd3,null))[_0xa17b('0x23')](function(_0x41aa4b){if(_0x41aa4b){return _0x41aa4b[_0xa17b('0x6f')](_0x144583[_0xa17b('0x45')][_0xa17b('0x70')]);}})[_0xa17b('0x23')](respondWithStatusCode(_0x5b5bd3,null))[_0xa17b('0x2d')](handleError(_0x5b5bd3,null));};exports[_0xa17b('0x71')]=function(_0x4e6a1a,_0x4a6813,_0x353c2d){if(_0x4e6a1a['body']['id']){delete _0x4e6a1a[_0xa17b('0x65')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x4e6a1a[_0xa17b('0x66')]['id']}})['then'](handleEntityNotFound(_0x4a6813,null))[_0xa17b('0x23')](function(_0x442e16){if(_0x442e16){_0x4e6a1a[_0xa17b('0x65')][_0xa17b('0x6c')]=_0x442e16['id'];return db[_0xa17b('0x72')][_0xa17b('0x5c')](_0x4e6a1a[_0xa17b('0x65')]);}})[_0xa17b('0x23')](respondWithResult(_0x4a6813,null))[_0xa17b('0x2d')](handleError(_0x4a6813,null));};exports[_0xa17b('0x73')]=function(_0x30d570,_0xeb1b4e,_0x1f3c29){var _0x259433={'raw':![],'where':{}};var _0x3789a5={};var _0x46d65a={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x30d570['params']['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0xeb1b4e,null))['then'](function(_0x25850f){if(_0x25850f){_0x3789a5[_0xa17b('0x44')]=_['keys'](db[_0xa17b('0x72')]['rawAttributes']);_0x3789a5[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0x30d570[_0xa17b('0x45')]);_0x3789a5[_0xa17b('0x47')]=_[_0xa17b('0x48')](_0x3789a5['model'],_0x3789a5['query']);_0x259433[_0xa17b('0x49')]=_[_0xa17b('0x48')](_0x3789a5[_0xa17b('0x44')],qs[_0xa17b('0x59')](_0x30d570[_0xa17b('0x45')][_0xa17b('0x59')]));_0x259433[_0xa17b('0x49')]=_0x259433[_0xa17b('0x49')][_0xa17b('0x4a')]?_0x259433[_0xa17b('0x49')]:_0x3789a5['model'];if(!_0x30d570[_0xa17b('0x45')][_0xa17b('0x4b')](_0xa17b('0x4c'))){_0x259433['limit']=qs[_0xa17b('0x4d')](_0x30d570[_0xa17b('0x45')]['limit']);_0x259433[_0xa17b('0x32')]=qs[_0xa17b('0x32')](_0x30d570[_0xa17b('0x45')][_0xa17b('0x32')]);}_0x259433[_0xa17b('0x4e')]=qs[_0xa17b('0x4f')](_0x30d570['query'][_0xa17b('0x4f')]);_0x259433[_0xa17b('0x50')]=qs['filters'](_[_0xa17b('0x51')](_0x30d570[_0xa17b('0x45')],_0x3789a5[_0xa17b('0x47')]));_0x259433[_0xa17b('0x50')][_0xa17b('0x6c')]=_0x25850f['id'];if(_0x30d570[_0xa17b('0x45')][_0xa17b('0x52')]){_0x259433['where']=_[_0xa17b('0x53')](_0x259433[_0xa17b('0x50')],{'$or':_[_0xa17b('0x3f')](_0x259433['attributes'],function(_0x54604d){var _0x40bb16={};_0x40bb16[_0x54604d]={'$like':'%'+_0x30d570['query']['filter']+'%'};return _0x40bb16;})});}_0x259433=_['merge']({},_0x259433,_0x30d570[_0xa17b('0x55')]);return db[_0xa17b('0x72')][_0xa17b('0x31')]({'where':_0x259433[_0xa17b('0x50')]})[_0xa17b('0x23')](function(_0x5e4197){_0x46d65a[_0xa17b('0x31')]=_0x5e4197;if(_0x30d570[_0xa17b('0x45')][_0xa17b('0x5a')]){_0x259433[_0xa17b('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa17b('0x6d')](_0x259433);})['then'](function(_0x582edd){_0x46d65a['rows']=_0x582edd;return _0x46d65a;});}})[_0xa17b('0x23')](respondWithFilteredResult(_0xeb1b4e,_0x259433))['catch'](handleError(_0xeb1b4e,null));};exports[_0xa17b('0x74')]=function(_0x29a578,_0x5aad28,_0x109794){return db[_0xa17b('0x40')]['find']({'where':{'id':_0x29a578[_0xa17b('0x66')]['id']}})['then'](handleEntityNotFound(_0x5aad28,null))[_0xa17b('0x23')](function(_0x42c4fa){if(_0x42c4fa){return _0x42c4fa[_0xa17b('0x74')](_0x29a578[_0xa17b('0x45')]['ids']);}})[_0xa17b('0x23')](respondWithStatusCode(_0x5aad28,null))[_0xa17b('0x2d')](handleError(_0x5aad28,null));};exports[_0xa17b('0x75')]=function(_0x123c9c,_0x4f4c0d,_0x16f573){return db[_0xa17b('0x76')]['find']({'where':{'id':_0x123c9c[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x4f4c0d,null))[_0xa17b('0x23')](function(_0x102082){if(_0x102082){return _0x102082['addInteraction'](_0x123c9c[_0xa17b('0x65')]['ids'],_[_0xa17b('0x77')](_0x123c9c[_0xa17b('0x65')],[_0xa17b('0x70'),'id'])||{});}})['then'](respondWithResult(_0x4f4c0d,null))[_0xa17b('0x2d')](handleError(_0x4f4c0d,null));};exports[_0xa17b('0x78')]=function(_0x7689a9,_0xb8bfbe,_0x31896f){var _0x3b6920={'raw':![],'where':{}};var _0x2c3e60={};var _0x354cf4={'count':0x0,'rows':[]};return db[_0xa17b('0x40')]['findOne']({'where':{'id':_0x7689a9[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0xb8bfbe,null))[_0xa17b('0x23')](function(_0xee38c2){if(_0xee38c2){_0x2c3e60['model']=_['keys'](db['FaxInteraction'][_0xa17b('0x41')]);_0x2c3e60['query']=_[_0xa17b('0x46')](_0x7689a9[_0xa17b('0x45')]);_0x2c3e60['filters']=_[_0xa17b('0x48')](_0x2c3e60[_0xa17b('0x44')],_0x2c3e60[_0xa17b('0x45')]);_0x3b6920['attributes']=_[_0xa17b('0x48')](_0x2c3e60['model'],qs['fields'](_0x7689a9[_0xa17b('0x45')][_0xa17b('0x59')]));_0x3b6920[_0xa17b('0x49')]=_0x3b6920['attributes'][_0xa17b('0x4a')]?_0x3b6920[_0xa17b('0x49')]:_0x2c3e60[_0xa17b('0x44')];if(!_0x7689a9[_0xa17b('0x45')][_0xa17b('0x4b')](_0xa17b('0x4c'))){_0x3b6920[_0xa17b('0x4d')]=qs[_0xa17b('0x4d')](_0x7689a9['query']['limit']);_0x3b6920['offset']=qs['offset'](_0x7689a9['query'][_0xa17b('0x32')]);}_0x3b6920[_0xa17b('0x4e')]=qs['sort'](_0x7689a9[_0xa17b('0x45')][_0xa17b('0x4f')]);_0x3b6920[_0xa17b('0x50')]=qs[_0xa17b('0x47')](_[_0xa17b('0x51')](_0x7689a9[_0xa17b('0x45')],_0x2c3e60[_0xa17b('0x47')]));_0x3b6920[_0xa17b('0x50')][_0xa17b('0x6c')]=_0xee38c2['id'];if(_0x7689a9['query']['filter']){_0x3b6920[_0xa17b('0x50')]=_[_0xa17b('0x53')](_0x3b6920[_0xa17b('0x50')],{'$or':_[_0xa17b('0x3f')](_0x3b6920[_0xa17b('0x49')],function(_0x32b4ba){var _0x3698b8={};_0x3698b8[_0x32b4ba]={'$like':'%'+_0x7689a9[_0xa17b('0x45')][_0xa17b('0x52')]+'%'};return _0x3698b8;})});}_0x3b6920=_[_0xa17b('0x53')]({},_0x3b6920,_0x7689a9[_0xa17b('0x55')]);return db['FaxInteraction']['count']({'where':_0x3b6920['where']})[_0xa17b('0x23')](function(_0x4175f8){_0x354cf4[_0xa17b('0x31')]=_0x4175f8;if(_0x7689a9[_0xa17b('0x45')]['includeAll']){_0x3b6920[_0xa17b('0x56')]=[{'model':db[_0xa17b('0x79')],'as':'Contact','required':![]},{'model':db[_0xa17b('0x7a')],'as':_0xa17b('0x7b'),'attributes':[_0xa17b('0x3c'),_0xa17b('0x7c'),_0xa17b('0x7d')],'required':![]},{'model':db[_0xa17b('0x7e')],'as':_0xa17b('0x7f'),'attributes':['id',_0xa17b('0x3c'),_0xa17b('0x80')],'where':_0x7689a9[_0xa17b('0x45')][_0xa17b('0x81')]?{'id':_0x7689a9[_0xa17b('0x45')][_0xa17b('0x81')]}:undefined,'required':_0x7689a9['query']['tag']?!![]:![]}];}return db[_0xa17b('0x76')][_0xa17b('0x6d')](_0x3b6920);})[_0xa17b('0x23')](function(_0x19f49b){_0x354cf4[_0xa17b('0x6e')]=_0x19f49b;return _0x354cf4;});}})[_0xa17b('0x23')](respondWithFilteredResult(_0xb8bfbe,_0x3b6920))[_0xa17b('0x2d')](handleError(_0xb8bfbe,null));};exports[_0xa17b('0x82')]=function(_0x9a07c9,_0x470a05,_0x5f0c6f){return db[_0xa17b('0x40')][_0xa17b('0x6b')]({'where':{'id':_0x9a07c9['params']['id']}})['then'](handleEntityNotFound(_0x470a05,null))[_0xa17b('0x23')](function(_0x160d7e){if(_0x160d7e){return db['sequelize'][_0xa17b('0x83')](function(_0x5cb8c0){return db[_0xa17b('0x84')][_0xa17b('0x38')]({'where':{'FaxAccountId':_0x9a07c9[_0xa17b('0x66')]['id']},'transaction':_0x5cb8c0})['then'](function(_0x2a7202){var _0xf42ee5=_[_0xa17b('0x3f')](_0x9a07c9[_0xa17b('0x65')],function(_0x54df54){_0x54df54[_0xa17b('0x6c')]=_0x9a07c9[_0xa17b('0x66')]['id'];return _0x54df54;});return db[_0xa17b('0x84')][_0xa17b('0x85')](_0xf42ee5,{'transaction':_0x5cb8c0});});})[_0xa17b('0x23')](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x9a07c9[_0xa17b('0x66')]['id']},'order':_0xa17b('0x86')});});}})[_0xa17b('0x23')](respondWithResult(_0x470a05,null))['catch'](handleError(_0x470a05,null));};exports[_0xa17b('0x87')]=function(_0x498c25,_0x59bd8d,_0xc4ec32){var _0x43dc1d={};var _0x424d19={};var _0x188f98;var _0x3c78b6;return db['FaxAccount'][_0xa17b('0x6b')]({'where':{'id':_0x498c25['params']['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x59bd8d,null))[_0xa17b('0x23')](function(_0x5c5b9d){if(_0x5c5b9d){_0x188f98=_0x5c5b9d;_0x424d19['model']=_[_0xa17b('0x46')](db[_0xa17b('0x84')]['rawAttributes']);_0x424d19[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0x498c25[_0xa17b('0x45')]);_0x424d19['filters']=_[_0xa17b('0x48')](_0x424d19[_0xa17b('0x44')],_0x424d19[_0xa17b('0x45')]);_0x43dc1d[_0xa17b('0x49')]=_['intersection'](_0x424d19[_0xa17b('0x44')],qs['fields'](_0x498c25[_0xa17b('0x45')][_0xa17b('0x59')]));_0x43dc1d[_0xa17b('0x49')]=_0x43dc1d[_0xa17b('0x49')][_0xa17b('0x4a')]?_0x43dc1d[_0xa17b('0x49')]:_0x424d19['model'];_0x43dc1d[_0xa17b('0x4e')]=qs[_0xa17b('0x4f')](_0x498c25[_0xa17b('0x45')][_0xa17b('0x4f')]);_0x43dc1d[_0xa17b('0x50')]=qs[_0xa17b('0x47')](_[_0xa17b('0x51')](_0x498c25[_0xa17b('0x45')],_0x424d19['filters']));if(_0x498c25[_0xa17b('0x45')][_0xa17b('0x52')]){_0x43dc1d[_0xa17b('0x50')]=_[_0xa17b('0x53')](_0x43dc1d[_0xa17b('0x50')],{'$or':_[_0xa17b('0x3f')](_0x43dc1d[_0xa17b('0x49')],function(_0x40b306){var _0x595e87={};_0x595e87[_0x40b306]={'$like':'%'+_0x498c25[_0xa17b('0x45')][_0xa17b('0x52')]+'%'};return _0x595e87;})});}_0x43dc1d=_[_0xa17b('0x53')]({},_0x43dc1d,_0x498c25['options']);return _0x188f98[_0xa17b('0x87')](_0x43dc1d);}})[_0xa17b('0x23')](function(_0xef59ce){if(_0xef59ce){_0x3c78b6=_0xef59ce['length'];if(!_0x498c25[_0xa17b('0x45')][_0xa17b('0x4b')](_0xa17b('0x4c'))){_0x43dc1d[_0xa17b('0x4d')]=qs[_0xa17b('0x4d')](_0x498c25[_0xa17b('0x45')]['limit']);_0x43dc1d[_0xa17b('0x32')]=qs['offset'](_0x498c25[_0xa17b('0x45')]['offset']);}return _0x188f98[_0xa17b('0x87')](_0x43dc1d);}})[_0xa17b('0x23')](function(_0x1ae041){if(_0x1ae041){return _0x1ae041?{'count':_0x3c78b6,'rows':_0x1ae041}:null;}})[_0xa17b('0x23')](respondWithResult(_0x59bd8d,null))[_0xa17b('0x2d')](handleError(_0x59bd8d,null));};function Extension(_0x2eafeb,_0x5bf29e,_0x2e848f,_0x54ec9f){this[_0xa17b('0x88')]=_0xa17b('0x89');this[_0xa17b('0x8a')]=_0x2eafeb[_0xa17b('0x8b')];this[_0xa17b('0x8c')]=_0x54ec9f;this[_0xa17b('0x43')]=_0xa17b('0x8d');this[_0xa17b('0x8e')]=_0xa17b('0x8f');this[_0xa17b('0x6c')]=_0x2eafeb['id'];this[_0xa17b('0x86')]=_0x5bf29e;this[_0xa17b('0x90')]=_0x2e848f;}function createExtensionsReciveFax(_0x4b78b4){var _0x3db576=0x1;var _0x352d20=[];_0x352d20[_0xa17b('0x91')](new Extension(_0x4b78b4,_0x3db576,'',_0xa17b('0x92')));_0x3db576+=0x1;_0x352d20[_0xa17b('0x91')](new Extension(_0x4b78b4,_0x3db576,'CDR(type)=inbound-fax',_0xa17b('0x93')));_0x3db576+=0x1;for(var _0x41f253 in _0x4b78b4){if(_0x4b78b4[_0xa17b('0x4b')](_0x41f253)&&(_0x41f253===_0xa17b('0x94')||_0x41f253===_0xa17b('0x8b')||_0x41f253===_0xa17b('0x95')||_0x41f253===_0xa17b('0x96')||_0x41f253==='headerinfo'||_0x41f253==='maxrate'||_0x41f253==='minrate'||_0x41f253==='modem'||_0x41f253===_0xa17b('0x97'))){_0x352d20['push'](new Extension(_0x4b78b4,_0x3db576,_0xa17b('0x98')+_0x41f253+')='+_0x4b78b4[_0x41f253],_0xa17b('0x93')));_0x3db576+=0x1;}}_0x352d20[_0xa17b('0x91')](new Extension(_0x4b78b4,_0x3db576,'6',_0xa17b('0x99')));_0x3db576+=0x1;_0x352d20[_0xa17b('0x91')](new Extension(_0x4b78b4,_0x3db576,_0xa17b('0x9a'),_0xa17b('0x9b')));_0x3db576=0x0;return _0x352d20;}exports[_0xa17b('0x9c')]=function(_0x427191,_0x5f14b3,_0x191a6d){var _0x47084c;return db[_0xa17b('0x9d')][_0xa17b('0x83')](function(_0x3dcdc2){return db[_0xa17b('0x40')]['create'](_0x427191[_0xa17b('0x65')],{'transaction':_0x3dcdc2})['then'](function(_0x12b061){_0x47084c=_0x12b061[_0xa17b('0x39')]({'plain':!![]});return db[_0xa17b('0x9e')][_0xa17b('0x85')](createExtensionsReciveFax(_0x47084c),{'transaction':_0x3dcdc2});});})[_0xa17b('0x23')](function(){return _0x47084c;})['then'](respondWithResult(_0x5f14b3,null))[_0xa17b('0x2d')](handleError(_0x5f14b3,null));};exports[_0xa17b('0x9f')]=function(_0x3e4ab1,_0x3ab43f,_0x39772c){var _0x36a083;return db[_0xa17b('0x9d')][_0xa17b('0x83')](function(_0x1a6e82){return db['FaxAccount'][_0xa17b('0x37')](_0x3e4ab1['body'],{'where':{'id':_0x3e4ab1[_0xa17b('0x65')]['id']},'transaction':_0x1a6e82})[_0xa17b('0x23')](function(_0xca8c2b){return db['VoiceExtension'][_0xa17b('0x38')]({'where':{'FaxAccountId':_0x3e4ab1[_0xa17b('0x65')]['id']},'transaction':_0x1a6e82})[_0xa17b('0x23')](function(_0x2b824c){return db[_0xa17b('0x9e')][_0xa17b('0x85')](createExtensionsReciveFax(_[_0xa17b('0x77')](_0x3e4ab1[_0xa17b('0x65')],[_0xa17b('0xa0'),'key',_0xa17b('0xa1'),'updatedAt',_0xa17b('0xa2'),_0xa17b('0xa3')])),{'transaction':_0x1a6e82});});});})[_0xa17b('0x23')](function(){return db[_0xa17b('0x40')][_0xa17b('0xa4')](_0x3e4ab1[_0xa17b('0x65')]['id']);})[_0xa17b('0x23')](respondWithResult(_0x3ab43f,null))[_0xa17b('0x2d')](handleError(_0x3ab43f,null));};exports[_0xa17b('0xa5')]=function(_0x1556de,_0x5812a2,_0x2bca15){var _0x5b187e={'raw':!![],'where':{}};var _0x4c1bfe={};var _0x20ae0f={'count':0x0,'rows':[]};return db[_0xa17b('0x40')][_0xa17b('0x6b')]({'where':{'id':_0x1556de[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x5812a2,null))[_0xa17b('0x23')](function(_0x50007d){if(_0x50007d){_0x4c1bfe['model']=_['keys'](db[_0xa17b('0xa6')]['rawAttributes']);_0x4c1bfe[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0x1556de[_0xa17b('0x45')]);_0x4c1bfe[_0xa17b('0x47')]=_[_0xa17b('0x48')](_0x4c1bfe[_0xa17b('0x44')],_0x4c1bfe[_0xa17b('0x45')]);_0x5b187e[_0xa17b('0x49')]=_['intersection'](_0x4c1bfe['model'],qs[_0xa17b('0x59')](_0x1556de['query'][_0xa17b('0x59')]));_0x5b187e[_0xa17b('0x49')]=_0x5b187e[_0xa17b('0x49')][_0xa17b('0x4a')]?_0x5b187e[_0xa17b('0x49')]:_0x4c1bfe[_0xa17b('0x44')];if(!_0x1556de['query'][_0xa17b('0x4b')](_0xa17b('0x4c'))){_0x5b187e['limit']=qs['limit'](_0x1556de[_0xa17b('0x45')][_0xa17b('0x4d')]);_0x5b187e[_0xa17b('0x32')]=qs[_0xa17b('0x32')](_0x1556de[_0xa17b('0x45')][_0xa17b('0x32')]);}_0x5b187e[_0xa17b('0x4e')]=qs['sort'](_0x1556de[_0xa17b('0x45')]['sort']);_0x5b187e['where']=qs[_0xa17b('0x47')](_[_0xa17b('0x51')](_0x1556de[_0xa17b('0x45')],_0x4c1bfe[_0xa17b('0x47')]));_0x5b187e[_0xa17b('0x50')][_0xa17b('0x6c')]=_0x50007d['id'];if(_0x1556de['query'][_0xa17b('0x52')]){_0x5b187e[_0xa17b('0x50')]=_[_0xa17b('0x53')](_0x5b187e[_0xa17b('0x50')],{'$or':_['map'](_0x5b187e['attributes'],function(_0x495c97){var _0x8e56cb={};_0x8e56cb[_0x495c97]={'$like':'%'+_0x1556de['query']['filter']+'%'};return _0x8e56cb;})});}if(_0x1556de[_0xa17b('0x45')]['$gte']){var _0x56a5a7=_0x1556de[_0xa17b('0x45')][_0xa17b('0xa7')][_0xa17b('0xa8')](',');var _0x13ff0f={};_0x13ff0f[_0x56a5a7[0x0]]={'$gte':moment(_0x56a5a7[0x1])[_0xa17b('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5b187e[_0xa17b('0x50')]=_[_0xa17b('0x53')](_0x5b187e[_0xa17b('0x50')],_0x13ff0f);}_0x5b187e=_[_0xa17b('0x53')]({},_0x5b187e,_0x1556de[_0xa17b('0x55')]);return db[_0xa17b('0xa6')][_0xa17b('0x31')]({'where':_0x5b187e[_0xa17b('0x50')]})[_0xa17b('0x23')](function(_0x2d8cd3){_0x20ae0f[_0xa17b('0x31')]=_0x2d8cd3;if(_0x1556de[_0xa17b('0x45')]['includeAll']){_0x5b187e[_0xa17b('0x56')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x5b187e);})[_0xa17b('0x23')](function(_0x311eff){_0x20ae0f[_0xa17b('0x6e')]=_0x311eff;return _0x20ae0f;});}})[_0xa17b('0x23')](respondWithFilteredResult(_0x5812a2,_0x5b187e))[_0xa17b('0x2d')](handleError(_0x5812a2,null));};exports[_0xa17b('0x3d')]=function(_0x17e44c,_0x1010ba,_0x2fd8ef){var _0x4f2289,_0x5a859f={},_0x31e87e;if(_0x17e44c[_0xa17b('0x65')]['to']){_0x31e87e=_0x17e44c['body']['to'][0x0];}return db[_0xa17b('0x40')][_0xa17b('0x5b')]({'where':{'id':_0x17e44c[_0xa17b('0x66')]['id']},'include':[{'model':db[_0xa17b('0xaa')],'as':_0xa17b('0xab'),'include':[{'model':db[_0xa17b('0x79')],'as':_0xa17b('0xac'),'where':{'fax':_0x31e87e},'limit':0x1,'order':[[_0xa17b('0xad'),_0xa17b('0xae')]]}]}]})[_0xa17b('0x23')](handleEntityNotFound(_0x1010ba,null))['then'](function(_0x672e34){_0x4f2289=_0x672e34;if(_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')]&&_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')]['length']){for(var _0x20152f=0x0;_0x20152f<_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][_0xa17b('0x4a')];_0x20152f+=0x1){_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][_0x20152f]={'filename':_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][_0x20152f][_0xa17b('0x3c')],'id':_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][_0x20152f]['id'],'path':path[_0xa17b('0xb0')](config['root'],'server/files/attachments',_0x17e44c[_0xa17b('0x65')]['attachments'][_0x20152f][_0xa17b('0xb1')])};}}return respondWithRpcPromise(_0xa17b('0xb2'),_0xa17b('0xb2'),{'FaxAccountId':_['isNil'](_0x17e44c[_0xa17b('0x66')]['id'])?undefined:_0x17e44c['params']['id'],'path':_[_0xa17b('0xb3')](_0x17e44c[_0xa17b('0x65')]['attachments'][0x0][_0xa17b('0x9')])?undefined:_0x17e44c['body'][_0xa17b('0xaf')][0x0][_0xa17b('0x9')],'fax':_[_0xa17b('0xb3')](_0x17e44c['body']['to'][0x0])?undefined:_0x17e44c['body']['to'][0x0]},client9002);})[_0xa17b('0x23')](function(){if(_0x4f2289){if(_[_0xa17b('0xb3')](_0x17e44c[_0xa17b('0x65')][_0xa17b('0xb4')])){_0x17e44c[_0xa17b('0x65')]['from']=util[_0xa17b('0xa9')](_0xa17b('0xb5'),_0x4f2289[_0xa17b('0x3c')],_0x4f2289['fax']);}if(_0x4f2289['List']){if(_0x4f2289[_0xa17b('0xab')][_0xa17b('0xac')][_0xa17b('0x4a')]){return _0x4f2289[_0xa17b('0xab')][_0xa17b('0xac')][0x0];}else{return db['CmContact'][_0xa17b('0x5c')](_[_0xa17b('0xb6')](_0x17e44c[_0xa17b('0x65')],{'firstName':_0x17e44c[_0xa17b('0x65')]['to'][0x0],'phone':_0x17e44c[_0xa17b('0x65')]['to'][0x0],'fax':_0x17e44c[_0xa17b('0x65')]['to'][0x0],'ListId':_0x4f2289['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xa17b('0xb7'));}})['then'](function(_0x103fc8){if(_0x103fc8){return db[_0xa17b('0x76')]['find']({'where':{'ContactId':_0x103fc8['id'],'closed':![],'FaxAccountId':_0x4f2289['id']}})[_0xa17b('0x23')](function(_0x4e74f3){if(_0x4e74f3){return[_0x4e74f3,![]];}return db[_0xa17b('0x76')][_0xa17b('0x5c')]({'UserId':_0x17e44c[_0xa17b('0x5d')]['id'],'ContactId':_0x103fc8['id'],'FaxAccountId':_0x4f2289['id'],'fax':_0x17e44c[_0xa17b('0x65')]['to'][0x0],'firstMsgDirection':_0xa17b('0xb8'),'Messages':[_[_0xa17b('0x53')](_0x17e44c[_0xa17b('0x65')],{'read':![],'body':_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][0x0][_0xa17b('0xb9')],'FaxAccountId':_0x4f2289['id'],'UserId':_0x17e44c[_0xa17b('0x5d')]['id'],'ContactId':_0x103fc8['id'],'AttachmentId':_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xa17b('0xba')}]})[_0xa17b('0x23')](function(_0x18e068){return[_0x18e068,!![]];});});}else{throw new Error(_0xa17b('0xbb'));}})[_0xa17b('0xbc')](function(_0x5a3786,_0x264928){if(_0x264928){return _0x5a3786;}return db['FaxMessage'][_0xa17b('0x5c')]({'direction':_0xa17b('0xb8'),'read':![],'body':_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][0x0][_0xa17b('0xb9')],'FaxAccountId':_0x4f2289['id'],'FaxInteractionId':_0x5a3786['id'],'UserId':_0x17e44c[_0xa17b('0x5d')]['id'],'ContactId':_0x5a3786[_0xa17b('0xbd')],'AttachmentId':_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][0x0]['id']})[_0xa17b('0x23')](function(_0x1fed32){_0x5a3786[_0xa17b('0xbe')][_0xa17b('0xba')]=[];_0x5a3786[_0xa17b('0xbe')][_0xa17b('0xba')][_0xa17b('0x91')](_0x1fed32[_0xa17b('0xbe')]);return _0x5a3786;});})[_0xa17b('0x23')](function(_0x4e6391){respondWithRpcPromise(_0xa17b('0xbf'),'SendFax',{'FaxAccountId':_['isNil'](_0x17e44c[_0xa17b('0x66')]['id'])?undefined:_0x17e44c['params']['id'],'path':_[_0xa17b('0xb3')](_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][0x0][_0xa17b('0x9')])?undefined:_0x17e44c['body']['attachments'][0x0]['path'],'fax':_[_0xa17b('0xb3')](_0x17e44c[_0xa17b('0x65')]['to'][0x0])?undefined:_0x17e44c[_0xa17b('0x65')]['to'][0x0],'AttachmentId':_0x17e44c[_0xa17b('0x65')]['attachments'][0x0]['id']},client9002)[_0xa17b('0x23')](function(_0x3976b1){logger[_0xa17b('0x2c')]('SendFaxRpc,\x20%s',_0x3976b1);})[_0xa17b('0x2d')](function(_0x2a2c4a){logger['info'](_0xa17b('0xc0'),_0x2a2c4a);});return _0x4e6391;})[_0xa17b('0x23')](respondWithResult(_0x1010ba,null))[_0xa17b('0x2d')](handleError(_0x1010ba,null));};exports['addAgents']=function(_0x4e89da,_0x488af2,_0x15c139){return db['FaxAccount']['find']({'where':{'id':_0x4e89da[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x488af2,null))[_0xa17b('0x23')](function(_0xa049c5){if(_0xa049c5){return _0xa049c5[_0xa17b('0xc1')](_0x4e89da['body'][_0xa17b('0x70')],_[_0xa17b('0x77')](_0x4e89da[_0xa17b('0x65')],['ids','id'])||{})['spread'](function(_0x2e8b1b){for(var _0x3f180d=0x0;_0x3f180d<_0x4e89da[_0xa17b('0x65')][_0xa17b('0x70')][_0xa17b('0x4a')];_0x3f180d+=0x1){socket[_0xa17b('0xc2')]('userFaxAccount:save',{'UserId':_0x4e89da[_0xa17b('0x65')]['ids'][_0x3f180d],'FaxAccountId':_0x4e89da['params']['id']});}return _0x2e8b1b;});}})[_0xa17b('0x23')](respondWithResult(_0x488af2,null))['catch'](handleError(_0x488af2,null));};exports[_0xa17b('0xc3')]=function(_0x51a4b1,_0x2383d3,_0x33c4d7){return db[_0xa17b('0x40')][_0xa17b('0x5b')]({'where':{'id':_0x51a4b1[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x2383d3,null))[_0xa17b('0x23')](function(_0x38f48e){if(_0x38f48e){return _0x38f48e[_0xa17b('0xc3')](_0x51a4b1['query'][_0xa17b('0x70')])['then'](function(){if(_[_0xa17b('0xc4')](_0x51a4b1['query']['ids'])){for(var _0x2bec31=0x0;_0x2bec31<_0x51a4b1[_0xa17b('0x45')][_0xa17b('0x70')][_0xa17b('0x4a')];_0x2bec31+=0x1){socket[_0xa17b('0xc2')](_0xa17b('0xc5'),{'UserId':Number(_0x51a4b1[_0xa17b('0x45')][_0xa17b('0x70')][_0x2bec31]),'FaxAccountId':Number(_0x51a4b1[_0xa17b('0x66')]['id'])});}}else{socket[_0xa17b('0xc2')](_0xa17b('0xc5'),{'UserId':Number(_0x51a4b1[_0xa17b('0x45')][_0xa17b('0x70')]),'FaxAccountId':Number(_0x51a4b1[_0xa17b('0x66')]['id'])});}});}})['then'](respondWithStatusCode(_0x2383d3,null))['catch'](handleError(_0x2383d3,null));};exports[_0xa17b('0xc6')]=function(_0xf40098,_0x2137c2,_0x38c204){var _0x8cc1b2={};var _0x119ed2={};var _0x1c7956;var _0x4430ee;return db['FaxAccount'][_0xa17b('0x6b')]({'where':{'id':_0xf40098['params']['id']}})['then'](handleEntityNotFound(_0x2137c2,null))[_0xa17b('0x23')](function(_0x4c272f){if(_0x4c272f){_0x1c7956=_0x4c272f;_0x119ed2[_0xa17b('0x44')]=_[_0xa17b('0x46')](db[_0xa17b('0x7a')][_0xa17b('0x41')]);_0x119ed2[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0xf40098[_0xa17b('0x45')]);_0x119ed2[_0xa17b('0x47')]=_[_0xa17b('0x48')](_0x119ed2[_0xa17b('0x44')],_0x119ed2['query']);_0x8cc1b2[_0xa17b('0x49')]=_[_0xa17b('0x48')](_0x119ed2['model'],qs['fields'](_0xf40098[_0xa17b('0x45')][_0xa17b('0x59')]));_0x8cc1b2[_0xa17b('0x49')]=_0x8cc1b2[_0xa17b('0x49')]['length']?_0x8cc1b2['attributes']:_0x119ed2[_0xa17b('0x44')];_0x8cc1b2[_0xa17b('0x4e')]=qs['sort'](_0xf40098[_0xa17b('0x45')][_0xa17b('0x4f')]);_0x8cc1b2['where']=qs[_0xa17b('0x47')](_[_0xa17b('0x51')](_0xf40098['query'],_0x119ed2[_0xa17b('0x47')]));if(_0xf40098[_0xa17b('0x45')][_0xa17b('0x52')]){_0x8cc1b2[_0xa17b('0x50')]=_['merge'](_0x8cc1b2[_0xa17b('0x50')],{'$or':_['map'](_0x8cc1b2['attributes'],function(_0x5159a0){var _0x4c33fa={};_0x4c33fa[_0x5159a0]={'$like':'%'+_0xf40098['query'][_0xa17b('0x52')]+'%'};return _0x4c33fa;})});}_0x8cc1b2=_[_0xa17b('0x53')]({},_0x8cc1b2,_0xf40098['options']);return _0x1c7956[_0xa17b('0xc6')](_0x8cc1b2);}})[_0xa17b('0x23')](function(_0x570bb6){if(_0x570bb6){_0x4430ee=_0x570bb6[_0xa17b('0x4a')];if(!_0xf40098[_0xa17b('0x45')][_0xa17b('0x4b')]('nolimit')){_0x8cc1b2[_0xa17b('0x4d')]=qs[_0xa17b('0x4d')](_0xf40098[_0xa17b('0x45')][_0xa17b('0x4d')]);_0x8cc1b2['offset']=qs[_0xa17b('0x32')](_0xf40098[_0xa17b('0x45')][_0xa17b('0x32')]);}return _0x1c7956[_0xa17b('0xc6')](_0x8cc1b2);}})[_0xa17b('0x23')](function(_0x81996a){if(_0x81996a){return _0x81996a?{'count':_0x4430ee,'rows':_0x81996a}:null;}})[_0xa17b('0x23')](respondWithResult(_0x2137c2,null))[_0xa17b('0x2d')](handleError(_0x2137c2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 6dc6ecb..ad8d77f 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 _0x5810=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x381fa6,_0x5532d9){var _0x488bb5=function(_0x271fc9){while(--_0x271fc9){_0x381fa6['push'](_0x381fa6['shift']());}};_0x488bb5(++_0x5532d9);}(_0x5810,0x12e));var _0x0581=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5810[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x0581('0x0'));var FaxAccount=require(_0x0581('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0581('0x2')](0x0);var events={'afterCreate':_0x0581('0x3'),'afterUpdate':'update','afterDestroy':_0x0581('0x4')};function emitEvent(_0x9ca349){return function(_0x56187f,_0x97ccb4,_0x22d887){FaxAccountEvents[_0x0581('0x5')](_0x9ca349+':'+_0x56187f['id'],_0x56187f);FaxAccountEvents[_0x0581('0x5')](_0x9ca349,_0x56187f);_0x22d887(null);};}for(var e in events){if(events[_0x0581('0x6')](e)){var event=events[e];FaxAccount[_0x0581('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xc50a=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x50a8b5,_0x4ec57f){var _0x55a34d=function(_0x133adb){while(--_0x133adb){_0x50a8b5['push'](_0x50a8b5['shift']());}};_0x55a34d(++_0x4ec57f);}(_0xc50a,0x1ce));var _0xac50=function(_0x59396d,_0xb75b8a){_0x59396d=_0x59396d-0x0;var _0x44466c=_0xc50a[_0x59396d];return _0x44466c;};'use strict';var EventEmitter=require(_0xac50('0x0'));var FaxAccount=require(_0xac50('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xac50('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xac50('0x3'),'afterDestroy':_0xac50('0x4')};function emitEvent(_0x9e0f9){return function(_0x491506,_0x1a560e,_0x1c0838){FaxAccountEvents[_0xac50('0x5')](_0x9e0f9+':'+_0x491506['id'],_0x491506);FaxAccountEvents[_0xac50('0x5')](_0x9e0f9,_0x491506);_0x1c0838(null);};}for(var e in events){if(events[_0xac50('0x6')](e)){var event=events[e];FaxAccount[_0xac50('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index ff7b93b..bda67d3 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 _0x5416=['request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','lodash','util','api','bluebird'];(function(_0x27a757,_0x1626f8){var _0x55ffbb=function(_0x1fa88c){while(--_0x1fa88c){_0x27a757['push'](_0x27a757['shift']());}};_0x55ffbb(++_0x1626f8);}(_0x5416,0xec));var _0x6541=function(_0x477921,_0x4e45dd){_0x477921=_0x477921-0x0;var _0x4d075d=_0x5416[_0x477921];return _0x4d075d;};'use strict';var _=require(_0x6541('0x0'));var util=require(_0x6541('0x1'));var logger=require('../../config/logger')(_0x6541('0x2'));var moment=require('moment');var BPromise=require(_0x6541('0x3'));var rp=require(_0x6541('0x4'));var fs=require('fs');var path=require(_0x6541('0x5'));var rimraf=require('rimraf');var config=require(_0x6541('0x6'));var attributes=require(_0x6541('0x7'));module[_0x6541('0x8')]=function(_0x50b602,_0x452450){return _0x50b602[_0x6541('0x9')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf863=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts'];(function(_0x1a4a06,_0x36a5c2){var _0x49ec08=function(_0x497f24){while(--_0x497f24){_0x1a4a06['push'](_0x1a4a06['shift']());}};_0x49ec08(++_0x36a5c2);}(_0xf863,0xe0));var _0x3f86=function(_0x687203,_0x36c373){_0x687203=_0x687203-0x0;var _0x348d96=_0xf863[_0x687203];return _0x348d96;};'use strict';var _=require(_0x3f86('0x0'));var util=require(_0x3f86('0x1'));var logger=require(_0x3f86('0x2'))(_0x3f86('0x3'));var moment=require(_0x3f86('0x4'));var BPromise=require(_0x3f86('0x5'));var rp=require(_0x3f86('0x6'));var fs=require('fs');var path=require(_0x3f86('0x7'));var rimraf=require('rimraf');var config=require(_0x3f86('0x8'));var attributes=require(_0x3f86('0x9'));module[_0x3f86('0xa')]=function(_0x40ecf4,_0x29fc5d){return _0x40ecf4[_0x3f86('0xb')](_0x3f86('0xc'),attributes,{'tableName':_0x3f86('0xd'),'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 12488aa..c826683 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 _0xdc61=['length','create','FaxInteraction','Contact\x20not\x20found','get','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','socket.io-emitter','./faxAccount.socket','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','map','include','model','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','body','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','List','Contacts','DESC','FaxApplication','Applications','applications','list','orderBy','priority','asc'];(function(_0x54a2a0,_0x32f973){var _0x447696=function(_0x5d6fd5){while(--_0x5d6fd5){_0x54a2a0['push'](_0x54a2a0['shift']());}};_0x447696(++_0x32f973);}(_0xdc61,0x11e));var _0x1dc6=function(_0x11b5ee,_0x29da88){_0x11b5ee=_0x11b5ee-0x0;var _0x2e2d6b=_0xdc61[_0x11b5ee];return _0x2e2d6b;};'use strict';var _=require('lodash');var util=require(_0x1dc6('0x0'));var moment=require(_0x1dc6('0x1'));var BPromise=require('bluebird');var rs=require(_0x1dc6('0x2'));var fs=require('fs');var Redis=require(_0x1dc6('0x3'));var db=require(_0x1dc6('0x4'))['db'];var utils=require(_0x1dc6('0x5'));var logger=require(_0x1dc6('0x6'))(_0x1dc6('0x7'));var config=require('../../config/environment');var jayson=require(_0x1dc6('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x1dc6('0x9')]=_[_0x1dc6('0xa')](config[_0x1dc6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1dc6('0xb'))(new Redis(config[_0x1dc6('0x9')]));require(_0x1dc6('0xc'))['register'](socket);function respondWithRpcPromise(_0x3257bc,_0x2c552b,_0x2ceeb6){return new BPromise(function(_0x3c570e,_0x1361e4){return client['request'](_0x3257bc,_0x2ceeb6)[_0x1dc6('0xd')](function(_0x5ecdf8){logger[_0x1dc6('0xe')]('FaxAccount,\x20%s,\x20%s',_0x2c552b,'request\x20sent');logger[_0x1dc6('0xf')](_0x1dc6('0x10'),_0x2c552b,_0x1dc6('0x11'),JSON[_0x1dc6('0x12')](_0x5ecdf8));if(_0x5ecdf8['error']){if(_0x5ecdf8[_0x1dc6('0x13')][_0x1dc6('0x14')]===0x1f4){logger['error'](_0x1dc6('0x15'),_0x2c552b,_0x5ecdf8[_0x1dc6('0x13')][_0x1dc6('0x16')]);return _0x1361e4(_0x5ecdf8['error']['message']);}logger[_0x1dc6('0x13')](_0x1dc6('0x15'),_0x2c552b,_0x5ecdf8[_0x1dc6('0x13')][_0x1dc6('0x16')]);return _0x3c570e(_0x5ecdf8[_0x1dc6('0x13')][_0x1dc6('0x16')]);}else{logger['info'](_0x1dc6('0x15'),_0x2c552b,'request\x20sent');_0x3c570e(_0x5ecdf8[_0x1dc6('0x17')][_0x1dc6('0x16')]);}})[_0x1dc6('0x18')](function(_0x59efcd){logger['error'](_0x1dc6('0x15'),_0x2c552b,_0x59efcd);_0x1361e4(_0x59efcd);});});}exports[_0x1dc6('0x19')]=function(_0x567122){var _0x45b3f0=this;return new Promise(function(_0x3d42e5,_0x1a4e65){return db[_0x1dc6('0x1a')][_0x1dc6('0x1b')]({'raw':_0x567122[_0x1dc6('0x1c')]?_0x567122[_0x1dc6('0x1c')][_0x1dc6('0x1d')]===undefined?!![]:![]:!![],'where':_0x567122[_0x1dc6('0x1c')]?_0x567122[_0x1dc6('0x1c')]['where']||null:null,'attributes':_0x567122[_0x1dc6('0x1c')]?_0x567122[_0x1dc6('0x1c')][_0x1dc6('0x1e')]||null:null,'limit':_0x567122[_0x1dc6('0x1c')]?_0x567122[_0x1dc6('0x1c')][_0x1dc6('0x1f')]||null:null,'include':_0x567122[_0x1dc6('0x1c')]?_0x567122[_0x1dc6('0x1c')]['include']?_[_0x1dc6('0x20')](_0x567122[_0x1dc6('0x1c')][_0x1dc6('0x21')],function(_0x237cc4){return{'model':db[_0x237cc4[_0x1dc6('0x22')]],'as':_0x237cc4['as'],'attributes':_0x237cc4[_0x1dc6('0x1e')],'include':_0x237cc4['include']?_[_0x1dc6('0x20')](_0x237cc4[_0x1dc6('0x21')],function(_0x1be25b){return{'model':db[_0x1be25b[_0x1dc6('0x22')]],'as':_0x1be25b['as'],'attributes':_0x1be25b['attributes'],'include':_0x1be25b['include']?_[_0x1dc6('0x20')](_0x1be25b[_0x1dc6('0x21')],function(_0xe2fa3){return{'model':db[_0xe2fa3['model']],'as':_0xe2fa3['as'],'attributes':_0xe2fa3[_0x1dc6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1dc6('0xd')](function(_0x41bd67){logger[_0x1dc6('0xe')](_0x1dc6('0x19'),_0x567122);logger[_0x1dc6('0xf')]('GetFaxAccount',_0x567122,JSON[_0x1dc6('0x12')](_0x41bd67));_0x3d42e5(_0x41bd67);})[_0x1dc6('0x18')](function(_0x12128c){logger[_0x1dc6('0x13')](_0x1dc6('0x19'),_0x12128c['message'],_0x567122);_0x1a4e65(_0x45b3f0[_0x1dc6('0x13')](0x1f4,_0x12128c['message']));});});};exports[_0x1dc6('0x23')]=function(_0x18089c,_0x4e6bd2,_0x38a262){var _0x18bf19=this;return new Promise(function(_0x15fd0b,_0x2910b6){var _0x5d0e20={'body':_0x18089c['body'],'channel':_0x1dc6('0x24')};var _0xdb354b=[];var _0x5cee26=[];var _0xa5171b={};return db[_0x1dc6('0x25')][_0x1dc6('0x26')]()[_0x1dc6('0xd')](function(_0x178e22){if(!_0x178e22){throw new db[(_0x1dc6('0x27'))][(_0x1dc6('0x28'))]('no\x20available\x20attributes');}_0xdb354b=_[_0x1dc6('0x29')](_[_0x1dc6('0x2a')](_0x178e22),[_0x1dc6('0x2b'),_0x1dc6('0x2c')]);_0x5cee26=_['difference'](_[_0x1dc6('0x2a')](_0x178e22),[_0x1dc6('0x2b'),_0x1dc6('0x2c'),_0x1dc6('0x2d'),'ListId']);if(_0x18089c[_0x1dc6('0x2e')]['id']){delete _0x18089c[_0x1dc6('0x2e')]['id'];}if(_['isNil'](_0x18089c[_0x1dc6('0x2e')][_0x1dc6('0x2f')])){throw new db['Sequelize'][(_0x1dc6('0x28'))](_0x1dc6('0x30'));}if(_[_0x1dc6('0x31')](_0x18089c[_0x1dc6('0x2e')][_0x1dc6('0x2e')])||_0x18089c['body'][_0x1dc6('0x2e')]===''){throw new db[(_0x1dc6('0x27'))][(_0x1dc6('0x28'))](_0x1dc6('0x32'));}if(_[_0x1dc6('0x31')](_0x18089c[_0x1dc6('0x2e')][_0x1dc6('0x33')])){throw new db[(_0x1dc6('0x27'))][(_0x1dc6('0x28'))](_0x1dc6('0x34')+_0x5cee26);}if(!_[_0x1dc6('0x35')](_0x5cee26,_0x18089c[_0x1dc6('0x2e')][_0x1dc6('0x33')])){throw new db[(_0x1dc6('0x27'))][(_0x1dc6('0x28'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5cee26);}_0xa5171b[_0x18089c[_0x1dc6('0x2e')][_0x1dc6('0x33')]]=_0x18089c[_0x1dc6('0x2e')][_0x1dc6('0x2f')];})[_0x1dc6('0xd')](function(){return db[_0x1dc6('0x1a')][_0x1dc6('0x36')]({'where':{'id':_0x18089c[_0x1dc6('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x1dc6('0x38'),'include':[{'model':db[_0x1dc6('0x25')],'as':_0x1dc6('0x39'),'where':_0xa5171b,'limit':0x1,'order':[[_0x1dc6('0x2c'),_0x1dc6('0x3a')]]}]},{'model':db[_0x1dc6('0x3b')],'as':_0x1dc6('0x3c')}]});})[_0x1dc6('0xd')](function(_0x2cf852){if(_0x2cf852&&_0x2cf852[_0x1dc6('0x38')]){var _0x4301a2=_0x2cf852['get']({'plain':!![]});_0x5d0e20[_0x1dc6('0x37')]=_0x4301a2;_0x5d0e20[_0x1dc6('0x3d')]=_0x4301a2[_0x1dc6('0x3c')];_0x5d0e20[_0x1dc6('0x3e')]=_0x4301a2[_0x1dc6('0x38')];_0x5d0e20[_0x1dc6('0x3d')]=_[_0x1dc6('0x3f')](_0x5d0e20[_0x1dc6('0x3d')],[_0x1dc6('0x40')],[_0x1dc6('0x41')]);if(_0x5d0e20[_0x1dc6('0x37')][_0x1dc6('0x3c')]){delete _0x5d0e20[_0x1dc6('0x37')]['Applications'];}if(_0x5d0e20[_0x1dc6('0x37')][_0x1dc6('0x38')]&&_0x5d0e20[_0x1dc6('0x37')][_0x1dc6('0x38')]['Contacts'][_0x1dc6('0x42')]){return _0x5d0e20['account'][_0x1dc6('0x38')]['Contacts'][0x0];}var _0x3c0e3b=_['defaults'](_0x18089c[_0x1dc6('0x2e')],{'firstName':_0x18089c[_0x1dc6('0x2e')][_0x1dc6('0x2f')],'ListId':_0x4301a2['ListId']});_0x3c0e3b[_0x18089c[_0x1dc6('0x2e')][_0x1dc6('0x33')]]=_0x18089c[_0x1dc6('0x2e')][_0x1dc6('0x2f')];return db['CmContact'][_0x1dc6('0x43')](_0x3c0e3b,{'fields':_0xdb354b,'raw':!![]});}})[_0x1dc6('0xd')](function(_0x282e9d){_0x5d0e20['contact']=_0x282e9d;if(_0x282e9d){var _0x20c3ab={'ContactId':_0x282e9d['id'],'FaxAccountId':_0x18089c[_0x1dc6('0x37')]['id'],'fax':_0x282e9d[_0x1dc6('0x24')]};return db[_0x1dc6('0x44')][_0x1dc6('0x36')]({'where':{'ContactId':_0x282e9d['id'],'closed':![],'FaxAccountId':_0x18089c[_0x1dc6('0x37')]['id']}})[_0x1dc6('0xd')](function(_0x5054b3){if(_0x5054b3){return[_0x5054b3,![]];}return db['FaxInteraction']['create'](_0x20c3ab)['then'](function(_0x29d708){return[_0x29d708,!![]];});});}else{throw new Error(_0x1dc6('0x45'));}})['spread'](function(_0x5df5cd,_0x21e2b3){var _0xfc6995=_0x5df5cd[_0x1dc6('0x46')]({'plain':!![]});if(_0x21e2b3){if(_0x5d0e20[_0x1dc6('0x37')][_0x1dc6('0x47')]){_0x5d0e20[_0x1dc6('0x3d')][_0x1dc6('0x48')]({'id':0x0,'priority':_0x5d0e20['applications']['length']+0x1,'app':_0x1dc6('0x49'),'appdata':_0x1dc6('0x4a'),'interval':_0x1dc6('0x4b')});}_0xfc6995['created']=!![];}else{_0xfc6995[_0x1dc6('0x4c')]=![];}_0x5d0e20[_0x1dc6('0x4d')]=_0xfc6995;return db[_0x1dc6('0x4e')]['create']({'body':_0x18089c[_0x1dc6('0x2e')][_0x1dc6('0x2e')],'FaxAccountId':_0x18089c['account']['id'],'FaxInteractionId':_0x5df5cd['id'],'direction':'in','ContactId':_0x5df5cd[_0x1dc6('0x4f')],'AttachmentId':_0x18089c['body'][_0x1dc6('0x50')]});})[_0x1dc6('0xd')](function(_0x272d04){_0x5d0e20[_0x1dc6('0x16')]=_0x272d04;if(_0x5d0e20[_0x1dc6('0x4d')][_0x1dc6('0x51')]){return db['User']['find']({'attributes':['id',_0x1dc6('0x52')],'where':{'id':_0x5d0e20['interaction']['UserId']}})[_0x1dc6('0xd')](function(_0x4df906){if(_0x4df906){_0x5d0e20[_0x1dc6('0x3d')][_0x1dc6('0x53')]({'id':0x0,'priority':0x0,'app':_0x1dc6('0x54'),'appdata':_0x4df906[_0x1dc6('0x52')]+','+(_0x5d0e20['account'][_0x1dc6('0x55')]||0xa),'interval':_0x1dc6('0x4b')});}return respondWithRpcPromise(_0x1dc6('0x56'),_0x1dc6('0x57'),_0x5d0e20);});}return respondWithRpcPromise(_0x1dc6('0x56'),_0x1dc6('0x57'),_0x5d0e20);})[_0x1dc6('0xd')](function(_0x27e561){_0x15fd0b(_0x27e561);})['catch'](function(_0x284eac){_0x2910b6(_0x18bf19[_0x1dc6('0x13')](0x1f4,_0x284eac[_0x1dc6('0x16')]));});});}; \ No newline at end of file +var _0xe0ad=['User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./faxAccount.socket','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','catch','GetFaxAccount','findAll','options','raw','limit','include','map','model','attributes','stringify','NotifyFaxAccount','describe','ValidationError','difference','createdAt','updatedAt','keys','CompanyId','ListId','body','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','List','Contacts','DESC','FaxApplication','get','account','applications','Applications','list','orderBy','length','CmContact','fax','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0xe0ad,0x10b));var _0xde0a=function(_0x359a69,_0x1acd37){_0x359a69=_0x359a69-0x0;var _0x1547d8=_0xe0ad[_0x359a69];return _0x1547d8;};'use strict';var _=require(_0xde0a('0x0'));var util=require(_0xde0a('0x1'));var moment=require('moment');var BPromise=require(_0xde0a('0x2'));var rs=require(_0xde0a('0x3'));var fs=require('fs');var Redis=require(_0xde0a('0x4'));var db=require(_0xde0a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xde0a('0x6'));var config=require(_0xde0a('0x7'));var jayson=require(_0xde0a('0x8'));var client=jayson[_0xde0a('0x9')][_0xde0a('0xa')]({'port':0x232c});config[_0xde0a('0xb')]=_[_0xde0a('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde0a('0xb')]));require(_0xde0a('0xd'))['register'](socket);function respondWithRpcPromise(_0x1b8a51,_0x16df01,_0x4f88b4){return new BPromise(function(_0x892380,_0x1d61a4){return client['request'](_0x1b8a51,_0x4f88b4)[_0xde0a('0xe')](function(_0x1afb1e){logger['info'](_0xde0a('0xf'),_0x16df01,'request\x20sent');logger[_0xde0a('0x10')](_0xde0a('0x11'),_0x16df01,'request\x20sent',JSON['stringify'](_0x1afb1e));if(_0x1afb1e['error']){if(_0x1afb1e['error']['code']===0x1f4){logger['error'](_0xde0a('0xf'),_0x16df01,_0x1afb1e[_0xde0a('0x12')][_0xde0a('0x13')]);return _0x1d61a4(_0x1afb1e[_0xde0a('0x12')][_0xde0a('0x13')]);}logger[_0xde0a('0x12')](_0xde0a('0xf'),_0x16df01,_0x1afb1e[_0xde0a('0x12')][_0xde0a('0x13')]);return _0x892380(_0x1afb1e[_0xde0a('0x12')][_0xde0a('0x13')]);}else{logger[_0xde0a('0x14')]('FaxAccount,\x20%s,\x20%s',_0x16df01,_0xde0a('0x15'));_0x892380(_0x1afb1e[_0xde0a('0x16')][_0xde0a('0x13')]);}})[_0xde0a('0x17')](function(_0x4759c3){logger['error'](_0xde0a('0xf'),_0x16df01,_0x4759c3);_0x1d61a4(_0x4759c3);});});}exports[_0xde0a('0x18')]=function(_0x39781d){var _0x21d789=this;return new Promise(function(_0x1c5cc7,_0x2013e2){return db['FaxAccount'][_0xde0a('0x19')]({'raw':_0x39781d[_0xde0a('0x1a')]?_0x39781d['options'][_0xde0a('0x1b')]===undefined?!![]:![]:!![],'where':_0x39781d['options']?_0x39781d[_0xde0a('0x1a')]['where']||null:null,'attributes':_0x39781d[_0xde0a('0x1a')]?_0x39781d[_0xde0a('0x1a')]['attributes']||null:null,'limit':_0x39781d[_0xde0a('0x1a')]?_0x39781d[_0xde0a('0x1a')][_0xde0a('0x1c')]||null:null,'include':_0x39781d[_0xde0a('0x1a')]?_0x39781d[_0xde0a('0x1a')][_0xde0a('0x1d')]?_[_0xde0a('0x1e')](_0x39781d[_0xde0a('0x1a')][_0xde0a('0x1d')],function(_0x3b66fc){return{'model':db[_0x3b66fc[_0xde0a('0x1f')]],'as':_0x3b66fc['as'],'attributes':_0x3b66fc[_0xde0a('0x20')],'include':_0x3b66fc['include']?_['map'](_0x3b66fc[_0xde0a('0x1d')],function(_0xa3be12){return{'model':db[_0xa3be12['model']],'as':_0xa3be12['as'],'attributes':_0xa3be12['attributes'],'include':_0xa3be12['include']?_[_0xde0a('0x1e')](_0xa3be12[_0xde0a('0x1d')],function(_0x56f7b4){return{'model':db[_0x56f7b4['model']],'as':_0x56f7b4['as'],'attributes':_0x56f7b4['attributes']};}):[]};}):[]};}):[]:[]})[_0xde0a('0xe')](function(_0x2fb5e7){logger['info'](_0xde0a('0x18'),_0x39781d);logger[_0xde0a('0x10')]('GetFaxAccount',_0x39781d,JSON[_0xde0a('0x21')](_0x2fb5e7));_0x1c5cc7(_0x2fb5e7);})[_0xde0a('0x17')](function(_0x39cf12){logger[_0xde0a('0x12')](_0xde0a('0x18'),_0x39cf12[_0xde0a('0x13')],_0x39781d);_0x2013e2(_0x21d789[_0xde0a('0x12')](0x1f4,_0x39cf12['message']));});});};exports[_0xde0a('0x22')]=function(_0x39b552,_0x26f3c5,_0x5416b4){var _0x14c6a2=this;return new Promise(function(_0x2edece,_0x5ae627){var _0x1f5b45={'body':_0x39b552['body'],'channel':'fax'};var _0x3e573d=[];var _0xa2dabf=[];var _0x994f49={};return db['CmContact'][_0xde0a('0x23')]()['then'](function(_0x1db304){if(!_0x1db304){throw new db['Sequelize'][(_0xde0a('0x24'))]('no\x20available\x20attributes');}_0x3e573d=_[_0xde0a('0x25')](_['keys'](_0x1db304),[_0xde0a('0x26'),_0xde0a('0x27')]);_0xa2dabf=_['difference'](_[_0xde0a('0x28')](_0x1db304),[_0xde0a('0x26'),_0xde0a('0x27'),_0xde0a('0x29'),_0xde0a('0x2a')]);if(_0x39b552[_0xde0a('0x2b')]['id']){delete _0x39b552[_0xde0a('0x2b')]['id'];}if(_[_0xde0a('0x2c')](_0x39b552[_0xde0a('0x2b')][_0xde0a('0x2d')])){throw new db[(_0xde0a('0x2e'))]['ValidationError'](_0xde0a('0x2f'));}if(_[_0xde0a('0x2c')](_0x39b552['body'][_0xde0a('0x2b')])||_0x39b552[_0xde0a('0x2b')][_0xde0a('0x2b')]===''){throw new db[(_0xde0a('0x2e'))][(_0xde0a('0x24'))](_0xde0a('0x30'));}if(_[_0xde0a('0x2c')](_0x39b552[_0xde0a('0x2b')]['mapKey'])){throw new db[(_0xde0a('0x2e'))]['ValidationError'](_0xde0a('0x31')+_0xa2dabf);}if(!_[_0xde0a('0x32')](_0xa2dabf,_0x39b552[_0xde0a('0x2b')][_0xde0a('0x33')])){throw new db['Sequelize'][(_0xde0a('0x24'))](_0xde0a('0x34')+_0xa2dabf);}_0x994f49[_0x39b552[_0xde0a('0x2b')][_0xde0a('0x33')]]=_0x39b552['body'][_0xde0a('0x2d')];})[_0xde0a('0xe')](function(){return db[_0xde0a('0x35')]['find']({'where':{'id':_0x39b552['account']['id']},'include':[{'model':db['CmList'],'as':_0xde0a('0x36'),'include':[{'model':db['CmContact'],'as':_0xde0a('0x37'),'where':_0x994f49,'limit':0x1,'order':[['updatedAt',_0xde0a('0x38')]]}]},{'model':db[_0xde0a('0x39')],'as':'Applications'}]});})[_0xde0a('0xe')](function(_0x256d45){if(_0x256d45&&_0x256d45[_0xde0a('0x36')]){var _0x366a08=_0x256d45[_0xde0a('0x3a')]({'plain':!![]});_0x1f5b45[_0xde0a('0x3b')]=_0x366a08;_0x1f5b45[_0xde0a('0x3c')]=_0x366a08[_0xde0a('0x3d')];_0x1f5b45[_0xde0a('0x3e')]=_0x366a08[_0xde0a('0x36')];_0x1f5b45[_0xde0a('0x3c')]=_[_0xde0a('0x3f')](_0x1f5b45[_0xde0a('0x3c')],['priority'],['asc']);if(_0x1f5b45[_0xde0a('0x3b')][_0xde0a('0x3d')]){delete _0x1f5b45[_0xde0a('0x3b')][_0xde0a('0x3d')];}if(_0x1f5b45[_0xde0a('0x3b')][_0xde0a('0x36')]&&_0x1f5b45[_0xde0a('0x3b')][_0xde0a('0x36')][_0xde0a('0x37')][_0xde0a('0x40')]){return _0x1f5b45['account'][_0xde0a('0x36')][_0xde0a('0x37')][0x0];}var _0x477dbc=_[_0xde0a('0xc')](_0x39b552['body'],{'firstName':_0x39b552['body'][_0xde0a('0x2d')],'ListId':_0x366a08[_0xde0a('0x2a')]});_0x477dbc[_0x39b552['body'][_0xde0a('0x33')]]=_0x39b552[_0xde0a('0x2b')][_0xde0a('0x2d')];return db[_0xde0a('0x41')]['create'](_0x477dbc,{'fields':_0x3e573d,'raw':!![]});}})[_0xde0a('0xe')](function(_0x2b370b){_0x1f5b45['contact']=_0x2b370b;if(_0x2b370b){var _0x46e837={'ContactId':_0x2b370b['id'],'FaxAccountId':_0x39b552[_0xde0a('0x3b')]['id'],'fax':_0x2b370b[_0xde0a('0x42')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x2b370b['id'],'closed':![],'FaxAccountId':_0x39b552[_0xde0a('0x3b')]['id']}})[_0xde0a('0xe')](function(_0x1e107d){if(_0x1e107d){return[_0x1e107d,![]];}return db[_0xde0a('0x43')][_0xde0a('0x44')](_0x46e837)[_0xde0a('0xe')](function(_0x40134c){return[_0x40134c,!![]];});});}else{throw new Error(_0xde0a('0x45'));}})[_0xde0a('0x46')](function(_0x5cd8ee,_0x153954){var _0xc7c02f=_0x5cd8ee[_0xde0a('0x3a')]({'plain':!![]});if(_0x153954){if(_0x1f5b45['account'][_0xde0a('0x47')]){_0x1f5b45['applications'][_0xde0a('0x48')]({'id':0x0,'priority':_0x1f5b45['applications'][_0xde0a('0x40')]+0x1,'app':_0xde0a('0x49'),'appdata':_0xde0a('0x4a'),'interval':_0xde0a('0x4b')});}_0xc7c02f[_0xde0a('0x4c')]=!![];}else{_0xc7c02f[_0xde0a('0x4c')]=![];}_0x1f5b45[_0xde0a('0x4d')]=_0xc7c02f;return db['FaxMessage'][_0xde0a('0x44')]({'body':_0x39b552['body']['body'],'FaxAccountId':_0x39b552['account']['id'],'FaxInteractionId':_0x5cd8ee['id'],'direction':'in','ContactId':_0x5cd8ee[_0xde0a('0x4e')],'AttachmentId':_0x39b552[_0xde0a('0x2b')][_0xde0a('0x4f')]});})['then'](function(_0x596c3b){_0x1f5b45['message']=_0x596c3b;if(_0x1f5b45[_0xde0a('0x4d')][_0xde0a('0x50')]){return db[_0xde0a('0x51')]['find']({'attributes':['id',_0xde0a('0x52')],'where':{'id':_0x1f5b45[_0xde0a('0x4d')][_0xde0a('0x50')]}})[_0xde0a('0xe')](function(_0x563052){if(_0x563052){_0x1f5b45[_0xde0a('0x3c')]['unshift']({'id':0x0,'priority':0x0,'app':_0xde0a('0x53'),'appdata':_0x563052[_0xde0a('0x52')]+','+(_0x1f5b45[_0xde0a('0x3b')][_0xde0a('0x54')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xde0a('0x55'),_0xde0a('0x56'),_0x1f5b45);});}return respondWithRpcPromise('Start',_0xde0a('0x56'),_0x1f5b45);})[_0xde0a('0xe')](function(_0x415642){_0x2edece(_0x415642);})[_0xde0a('0x17')](function(_0x3f9596){_0x5ae627(_0x14c6a2[_0xde0a('0x12')](0x1f4,_0x3f9596['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 1b50f5c..044456f 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 _0xbff5=['register','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbff5,0x1bc));var _0x5bff=function(_0x2dc311,_0x3e18d2){_0x2dc311=_0x2dc311-0x0;var _0x19e23e=_0xbff5[_0x2dc311];return _0x19e23e;};'use strict';var FaxAccountEvents=require(_0x5bff('0x0'));var events=[_0x5bff('0x1'),_0x5bff('0x2'),_0x5bff('0x3')];function createListener(_0x41c38b,_0x43a41b){return function(_0x3bd90c){_0x43a41b['emit'](_0x41c38b,_0x3bd90c);};}function removeListener(_0x3868ae,_0x486083){return function(){FaxAccountEvents['removeListener'](_0x3868ae,_0x486083);};}exports[_0x5bff('0x4')]=function(_0x1d8650){for(var _0x151add=0x0,_0xa54c57=events[_0x5bff('0x5')];_0x151add<_0xa54c57;_0x151add++){var _0xd4b9dc=events[_0x151add];var _0x1acb49=createListener(_0x5bff('0x6')+_0xd4b9dc,_0x1d8650);FaxAccountEvents['on'](_0xd4b9dc,_0x1acb49);}}; \ No newline at end of file +var _0xc2c7=['register','faxAccount:','save','remove','update','emit'];(function(_0x48ba50,_0x4f4082){var _0x56a915=function(_0x5e32c4){while(--_0x5e32c4){_0x48ba50['push'](_0x48ba50['shift']());}};_0x56a915(++_0x4f4082);}(_0xc2c7,0x134));var _0x7c2c=function(_0x2af7c0,_0x14f017){_0x2af7c0=_0x2af7c0-0x0;var _0x313950=_0xc2c7[_0x2af7c0];return _0x313950;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x7c2c('0x0'),_0x7c2c('0x1'),_0x7c2c('0x2')];function createListener(_0x330870,_0x380d13){return function(_0x237e4d){_0x380d13[_0x7c2c('0x3')](_0x330870,_0x237e4d);};}function removeListener(_0x116f8a,_0x4bbc14){return function(){FaxAccountEvents['removeListener'](_0x116f8a,_0x4bbc14);};}exports[_0x7c2c('0x4')]=function(_0x42ecc9){for(var _0x23c038=0x0,_0x54f027=events['length'];_0x23c038<_0x54f027;_0x23c038++){var _0x5a1027=events[_0x23c038];var _0x2274cd=createListener(_0x7c2c('0x5')+_0x5a1027,_0x42ecc9);FaxAccountEvents['on'](_0x5a1027,_0x2274cd);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 2dac9da..42f584c 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 _0x1b2d=['post','/:id/dispositions','addDisposition','addAnswer','addApplications','/updateaccountapplications','/:id/send','send','addAgents','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents'];(function(_0x2208cc,_0x2c490a){var _0x248c64=function(_0x505b5a){while(--_0x505b5a){_0x2208cc['push'](_0x2208cc['shift']());}};_0x248c64(++_0x2c490a);}(_0x1b2d,0xa0));var _0xd1b2=function(_0x40a521,_0x539c05){_0x40a521=_0x40a521-0x0;var _0x4576cd=_0x1b2d[_0x40a521];return _0x4576cd;};'use strict';var multer=require(_0xd1b2('0x0'));var util=require(_0xd1b2('0x1'));var path=require(_0xd1b2('0x2'));var timeout=require(_0xd1b2('0x3'));var express=require(_0xd1b2('0x4'));var router=express[_0xd1b2('0x5')]();var auth=require(_0xd1b2('0x6'));var interaction=require(_0xd1b2('0x7'));var config=require(_0xd1b2('0x8'));var controller=require(_0xd1b2('0x9'));router[_0xd1b2('0xa')]('/',auth[_0xd1b2('0xb')](),controller['index']);router[_0xd1b2('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xd1b2('0xc')]);router['get'](_0xd1b2('0xd'),auth[_0xd1b2('0xb')](),controller['show']);router[_0xd1b2('0xa')]('/:id/dispositions',auth[_0xd1b2('0xb')](),controller[_0xd1b2('0xe')]);router[_0xd1b2('0xa')](_0xd1b2('0xf'),auth[_0xd1b2('0xb')](),controller[_0xd1b2('0x10')]);router[_0xd1b2('0xa')](_0xd1b2('0x11'),auth['isAuthenticated'](),controller[_0xd1b2('0x12')]);router['get'](_0xd1b2('0x13'),auth['isAuthenticated'](),controller[_0xd1b2('0x14')]);router[_0xd1b2('0xa')](_0xd1b2('0x15'),auth['isAuthenticated'](),controller[_0xd1b2('0x16')]);router[_0xd1b2('0xa')](_0xd1b2('0x17'),auth[_0xd1b2('0xb')](),controller[_0xd1b2('0x18')]);router[_0xd1b2('0x19')]('/',auth[_0xd1b2('0xb')](),controller['create']);router['post'](_0xd1b2('0x1a'),auth[_0xd1b2('0xb')](),controller[_0xd1b2('0x1b')]);router[_0xd1b2('0x19')](_0xd1b2('0xf'),auth[_0xd1b2('0xb')](),controller[_0xd1b2('0x1c')]);router[_0xd1b2('0x19')](_0xd1b2('0x11'),auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0xd1b2('0x13'),auth['isAuthenticated'](),controller[_0xd1b2('0x1d')]);router['post']('/addaccountapplications',auth[_0xd1b2('0xb')](),controller['addAccountApplications']);router[_0xd1b2('0x19')](_0xd1b2('0x1e'),auth['isAuthenticated'](),controller['updateAccountApplications']);router['post'](_0xd1b2('0x1f'),auth[_0xd1b2('0xb')](),controller[_0xd1b2('0x20')]);router[_0xd1b2('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0xd1b2('0x21')]);router['put']('/:id',auth[_0xd1b2('0xb')](),controller['update']);router['delete'](_0xd1b2('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xd1b2('0x22')](_0xd1b2('0x1a'),auth[_0xd1b2('0xb')](),controller[_0xd1b2('0x23')]);router['delete'](_0xd1b2('0xf'),auth['isAuthenticated'](),controller[_0xd1b2('0x24')]);router['delete'](_0xd1b2('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x032f=['describe','show','/:id/canned_answers','getAnswers','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/interactions','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','update','/:id','destroy','removeDispositions','delete','exports','path','connect-timeout','Router','./faxAccount.controller','get','isAuthenticated','index','/describe'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x032f,0x18f));var _0xf032=function(_0x5b6ba6,_0x5c5700){_0x5b6ba6=_0x5b6ba6-0x0;var _0x555b90=_0x032f[_0x5b6ba6];return _0x555b90;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf032('0x0'));var timeout=require(_0xf032('0x1'));var express=require('express');var router=express[_0xf032('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf032('0x3'));router[_0xf032('0x4')]('/',auth[_0xf032('0x5')](),controller[_0xf032('0x6')]);router['get'](_0xf032('0x7'),auth[_0xf032('0x5')](),controller[_0xf032('0x8')]);router[_0xf032('0x4')]('/:id',auth[_0xf032('0x5')](),controller[_0xf032('0x9')]);router[_0xf032('0x4')]('/:id/dispositions',auth[_0xf032('0x5')](),controller['getDispositions']);router[_0xf032('0x4')](_0xf032('0xa'),auth[_0xf032('0x5')](),controller[_0xf032('0xb')]);router['get']('/:id/interactions',auth[_0xf032('0x5')](),controller['getInteractions']);router[_0xf032('0x4')](_0xf032('0xc'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xf032('0xd'),auth[_0xf032('0x5')](),controller[_0xf032('0xe')]);router['get'](_0xf032('0xf'),auth['isAuthenticated'](),controller[_0xf032('0x10')]);router[_0xf032('0x11')]('/',auth[_0xf032('0x5')](),controller[_0xf032('0x12')]);router[_0xf032('0x11')](_0xf032('0x13'),auth[_0xf032('0x5')](),controller[_0xf032('0x14')]);router[_0xf032('0x11')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf032('0x15')]);router['post'](_0xf032('0x16'),auth[_0xf032('0x5')](),controller[_0xf032('0x17')]);router[_0xf032('0x11')](_0xf032('0xc'),auth[_0xf032('0x5')](),controller['addApplications']);router[_0xf032('0x11')](_0xf032('0x18'),auth[_0xf032('0x5')](),controller[_0xf032('0x19')]);router[_0xf032('0x11')](_0xf032('0x1a'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0xf032('0x11')](_0xf032('0x1b'),auth[_0xf032('0x5')](),controller[_0xf032('0x1c')]);router['post'](_0xf032('0xf'),auth[_0xf032('0x5')](),controller[_0xf032('0x1d')]);router[_0xf032('0x1e')]('/:id',auth[_0xf032('0x5')](),controller[_0xf032('0x1f')]);router['delete'](_0xf032('0x20'),auth[_0xf032('0x5')](),controller[_0xf032('0x21')]);router['delete'](_0xf032('0x13'),auth[_0xf032('0x5')](),controller[_0xf032('0x22')]);router['delete'](_0xf032('0xa'),auth[_0xf032('0x5')](),controller['removeAnswers']);router[_0xf032('0x23')]('/:id/users',auth[_0xf032('0x5')](),controller['removeAgents']);module[_0xf032('0x24')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 741b476..7e2d357 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 _0xcc8f=['*,*,*,*','sequelize','STRING','noop'];(function(_0x2b04fe,_0x502311){var _0x175364=function(_0x5f2f14){while(--_0x5f2f14){_0x2b04fe['push'](_0x2b04fe['shift']());}};_0x175364(++_0x502311);}(_0xcc8f,0x10d));var _0xfcc8=function(_0x11469e,_0x1c28ba){_0x11469e=_0x11469e-0x0;var _0x2e2487=_0xcc8f[_0x11469e];return _0x2e2487;};'use strict';var Sequelize=require(_0xfcc8('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xfcc8('0x1')],'allowNull':![],'defaultValue':_0xfcc8('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfcc8('0x1')]},'interval':{'type':Sequelize[_0xfcc8('0x1')],'defaultValue':_0xfcc8('0x3')}}; \ No newline at end of file +var _0xbd0e=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x19085d,_0x5d8bc0){var _0xdb3f69=function(_0x3009c8){while(--_0x3009c8){_0x19085d['push'](_0x19085d['shift']());}};_0xdb3f69(++_0x5d8bc0);}(_0xbd0e,0x187));var _0xebd0=function(_0x15c23e,_0x162305){_0x15c23e=_0x15c23e-0x0;var _0x4ed7d1=_0xbd0e[_0x15c23e];return _0x4ed7d1;};'use strict';var Sequelize=require('sequelize');module[_0xebd0('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xebd0('0x1')],'allowNull':![],'defaultValue':_0xebd0('0x2')},'appdata':{'type':Sequelize[_0xebd0('0x3')]()},'description':{'type':Sequelize[_0xebd0('0x1')]},'interval':{'type':Sequelize[_0xebd0('0x1')],'defaultValue':_0xebd0('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 3192a6f..1cd73f7 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 _0x9e7e=['limit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxApplication','includeAll','include','rows','catch','show','params','rawAttributes','length','find','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit'];(function(_0x383ab9,_0x106fda){var _0x4617b7=function(_0xce6f){while(--_0xce6f){_0x383ab9['push'](_0x383ab9['shift']());}};_0x4617b7(++_0x106fda);}(_0x9e7e,0xb0));var _0xe9e7=function(_0x474d72,_0x29a688){_0x474d72=_0x474d72-0x0;var _0x2b7b59=_0x9e7e[_0x474d72];return _0x2b7b59;};'use strict';var pdf=require(_0xe9e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe9e7('0x1'));var zipdir=require(_0xe9e7('0x2'));var jsonpatch=require(_0xe9e7('0x3'));var rp=require(_0xe9e7('0x4'));var moment=require(_0xe9e7('0x5'));var BPromise=require(_0xe9e7('0x6'));var Mustache=require(_0xe9e7('0x7'));var util=require(_0xe9e7('0x8'));var path=require(_0xe9e7('0x9'));var sox=require(_0xe9e7('0xa'));var csv=require(_0xe9e7('0xb'));var ejs=require(_0xe9e7('0xc'));var fs=require('fs');var _=require(_0xe9e7('0xd'));var squel=require(_0xe9e7('0xe'));var crypto=require(_0xe9e7('0xf'));var jsforce=require(_0xe9e7('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe9e7('0xb'));var querystring=require(_0xe9e7('0x11'));var Papa=require('papaparse');var Redis=require(_0xe9e7('0x12'));var authService=require(_0xe9e7('0x13'));var qs=require(_0xe9e7('0x14'));var as=require(_0xe9e7('0x15'));var hardwareService=require(_0xe9e7('0x16'));var logger=require(_0xe9e7('0x17'))(_0xe9e7('0x18'));var utils=require(_0xe9e7('0x19'));var config=require(_0xe9e7('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9e7('0x1b'))['db'];function respondWithStatusCode(_0x31fb42,_0x5970d4){_0x5970d4=_0x5970d4||0xcc;return function(_0x542628){if(_0x542628){return _0x31fb42[_0xe9e7('0x1c')](_0x5970d4);}return _0x31fb42[_0xe9e7('0x1d')](_0x5970d4)[_0xe9e7('0x1e')]();};}function respondWithResult(_0x36eed5,_0x132fc5){_0x132fc5=_0x132fc5||0xc8;return function(_0x79bc0f){if(_0x79bc0f){return _0x36eed5[_0xe9e7('0x1d')](_0x132fc5)['json'](_0x79bc0f);}};}function respondWithFilteredResult(_0x4182fa,_0x3ca725){return function(_0x2bd8f9){if(_0x2bd8f9){var _0x5a1fb2=_0x2bd8f9[_0xe9e7('0x1f')],_0xf82e22=_0x3ca725[_0xe9e7('0x20')],_0x13105c=_0x3ca725[_0xe9e7('0x20')]+_0x3ca725['limit'],_0x411b2b;if(_0x13105c>=_0x5a1fb2){_0x13105c=_0x5a1fb2;_0x411b2b=0xc8;}else{_0x411b2b=0xce;}_0x4182fa['status'](_0x411b2b);return _0x4182fa[_0xe9e7('0x21')](_0xe9e7('0x22'),_0xf82e22+'-'+_0x13105c+'/'+_0x5a1fb2)[_0xe9e7('0x23')](_0x2bd8f9);}return null;};}function patchUpdates(_0x22e290){return function(_0x178a17){try{jsonpatch[_0xe9e7('0x24')](_0x178a17,_0x22e290,!![]);}catch(_0x1ed163){return BPromise['reject'](_0x1ed163);}return _0x178a17[_0xe9e7('0x25')]();};}function saveUpdates(_0x2c33b5,_0x5590cf){return function(_0x23bf88){if(_0x23bf88){return _0x23bf88[_0xe9e7('0x26')](_0x2c33b5)[_0xe9e7('0x27')](function(_0x42fc89){return _0x42fc89;});}return null;};}function removeEntity(_0x245db7,_0x347884){return function(_0x216d4f){if(_0x216d4f){return _0x216d4f[_0xe9e7('0x28')]()['then'](function(){_0x245db7[_0xe9e7('0x1d')](0xcc)[_0xe9e7('0x1e')]();});}};}function handleEntityNotFound(_0x34fc15,_0x67259d){return function(_0x71baa4){if(!_0x71baa4){_0x34fc15[_0xe9e7('0x1c')](0x194);}return _0x71baa4;};}function handleError(_0x5b5b64,_0x291901){_0x291901=_0x291901||0x1f4;return function(_0x33d317){logger[_0xe9e7('0x29')](_0x33d317[_0xe9e7('0x2a')]);if(_0x33d317[_0xe9e7('0x2b')]){delete _0x33d317[_0xe9e7('0x2b')];}_0x5b5b64['status'](_0x291901)[_0xe9e7('0x2c')](_0x33d317);};}exports['index']=function(_0x10fb16,_0x46102a){var _0x2435b8={},_0x26c577={},_0x21b820={'count':0x0,'rows':[]};var _0x1be3b4=_['map'](db['FaxApplication']['rawAttributes'],function(_0x3d65b4){return{'name':_0x3d65b4[_0xe9e7('0x2d')],'type':_0x3d65b4[_0xe9e7('0x2e')][_0xe9e7('0x2f')]};});_0x26c577[_0xe9e7('0x30')]=_[_0xe9e7('0x31')](_0x1be3b4,_0xe9e7('0x2b'));_0x26c577['query']=_[_0xe9e7('0x32')](_0x10fb16['query']);_0x26c577[_0xe9e7('0x33')]=_[_0xe9e7('0x34')](_0x26c577['model'],_0x26c577['query']);_0x2435b8[_0xe9e7('0x35')]=_[_0xe9e7('0x34')](_0x26c577['model'],qs[_0xe9e7('0x36')](_0x10fb16[_0xe9e7('0x37')][_0xe9e7('0x36')]));_0x2435b8[_0xe9e7('0x35')]=_0x2435b8[_0xe9e7('0x35')]['length']?_0x2435b8[_0xe9e7('0x35')]:_0x26c577['model'];if(!_0x10fb16[_0xe9e7('0x37')][_0xe9e7('0x38')](_0xe9e7('0x39'))){_0x2435b8[_0xe9e7('0x3a')]=qs['limit'](_0x10fb16[_0xe9e7('0x37')][_0xe9e7('0x3a')]);_0x2435b8[_0xe9e7('0x20')]=qs[_0xe9e7('0x20')](_0x10fb16[_0xe9e7('0x37')][_0xe9e7('0x20')]);}_0x2435b8[_0xe9e7('0x3b')]=qs[_0xe9e7('0x3c')](_0x10fb16[_0xe9e7('0x37')][_0xe9e7('0x3c')]);_0x2435b8[_0xe9e7('0x3d')]=qs[_0xe9e7('0x33')](_[_0xe9e7('0x3e')](_0x10fb16[_0xe9e7('0x37')],_0x26c577['filters']),_0x1be3b4);if(_0x10fb16['query'][_0xe9e7('0x3f')]){_0x2435b8[_0xe9e7('0x3d')]=_[_0xe9e7('0x40')](_0x2435b8[_0xe9e7('0x3d')],{'$or':_[_0xe9e7('0x31')](_0x1be3b4,function(_0x228591){if(_0x228591[_0xe9e7('0x2e')]!==_0xe9e7('0x41')){var _0x8529c4={};_0x8529c4[_0x228591[_0xe9e7('0x2b')]]={'$like':'%'+_0x10fb16[_0xe9e7('0x37')]['filter']+'%'};return _0x8529c4;}})});}_0x2435b8=_['merge']({},_0x2435b8,_0x10fb16[_0xe9e7('0x42')]);var _0x48ac31={'where':_0x2435b8['where']};return db[_0xe9e7('0x43')][_0xe9e7('0x1f')](_0x48ac31)['then'](function(_0x1007e5){_0x21b820['count']=_0x1007e5;if(_0x10fb16[_0xe9e7('0x37')][_0xe9e7('0x44')]){_0x2435b8[_0xe9e7('0x45')]=[{'all':!![]}];}return db[_0xe9e7('0x43')]['findAll'](_0x2435b8);})[_0xe9e7('0x27')](function(_0x3eb590){_0x21b820[_0xe9e7('0x46')]=_0x3eb590;return _0x21b820;})[_0xe9e7('0x27')](respondWithFilteredResult(_0x46102a,_0x2435b8))[_0xe9e7('0x47')](handleError(_0x46102a,null));};exports[_0xe9e7('0x48')]=function(_0x4369b3,_0x571e5f){var _0x52caf2={'raw':!![],'where':{'id':_0x4369b3[_0xe9e7('0x49')]['id']}},_0x57a188={};_0x57a188[_0xe9e7('0x30')]=_[_0xe9e7('0x32')](db['FaxApplication'][_0xe9e7('0x4a')]);_0x57a188[_0xe9e7('0x37')]=_[_0xe9e7('0x32')](_0x4369b3[_0xe9e7('0x37')]);_0x57a188[_0xe9e7('0x33')]=_[_0xe9e7('0x34')](_0x57a188[_0xe9e7('0x30')],_0x57a188[_0xe9e7('0x37')]);_0x52caf2[_0xe9e7('0x35')]=_[_0xe9e7('0x34')](_0x57a188[_0xe9e7('0x30')],qs[_0xe9e7('0x36')](_0x4369b3[_0xe9e7('0x37')]['fields']));_0x52caf2['attributes']=_0x52caf2['attributes'][_0xe9e7('0x4b')]?_0x52caf2['attributes']:_0x57a188[_0xe9e7('0x30')];if(_0x4369b3['query'][_0xe9e7('0x44')]){_0x52caf2[_0xe9e7('0x45')]=[{'all':!![]}];}_0x52caf2=_[_0xe9e7('0x40')]({},_0x52caf2,_0x4369b3['options']);return db['FaxApplication'][_0xe9e7('0x4c')](_0x52caf2)[_0xe9e7('0x27')](handleEntityNotFound(_0x571e5f,null))['then'](respondWithResult(_0x571e5f,null))[_0xe9e7('0x47')](handleError(_0x571e5f,null));};exports['create']=function(_0x386116,_0x1c6dc2){return db['FaxApplication']['create'](_0x386116[_0xe9e7('0x4d')],{})[_0xe9e7('0x27')](respondWithResult(_0x1c6dc2,0xc9))[_0xe9e7('0x47')](handleError(_0x1c6dc2,null));};exports['update']=function(_0x5282da,_0x516a5e){if(_0x5282da[_0xe9e7('0x4d')]['id']){delete _0x5282da['body']['id'];}return db[_0xe9e7('0x43')][_0xe9e7('0x4c')]({'where':{'id':_0x5282da[_0xe9e7('0x49')]['id']}})['then'](handleEntityNotFound(_0x516a5e,null))[_0xe9e7('0x27')](saveUpdates(_0x5282da[_0xe9e7('0x4d')],null))['then'](respondWithResult(_0x516a5e,null))[_0xe9e7('0x47')](handleError(_0x516a5e,null));};exports['destroy']=function(_0x3619f1,_0xf149c){return db['FaxApplication'][_0xe9e7('0x4c')]({'where':{'id':_0x3619f1['params']['id']}})['then'](handleEntityNotFound(_0xf149c,null))[_0xe9e7('0x27')](removeEntity(_0xf149c,null))[_0xe9e7('0x47')](handleError(_0xf149c,null));}; \ No newline at end of file +var _0xf513=['moment','mustache','util','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','FaxApplication','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3e14ba,_0x1a3e9d){var _0x1ac0be=function(_0x58c79d){while(--_0x58c79d){_0x3e14ba['push'](_0x3e14ba['shift']());}};_0x1ac0be(++_0x1a3e9d);}(_0xf513,0x89));var _0x3f51=function(_0x468c6c,_0x24710){_0x468c6c=_0x468c6c-0x0;var _0x45a1ce=_0xf513[_0x468c6c];return _0x45a1ce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f51('0x0'));var rimraf=require(_0x3f51('0x1'));var zipdir=require(_0x3f51('0x2'));var jsonpatch=require(_0x3f51('0x3'));var rp=require(_0x3f51('0x4'));var moment=require(_0x3f51('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3f51('0x6'));var util=require(_0x3f51('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f51('0x8'));var squel=require(_0x3f51('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3f51('0xa'));var toCsv=require(_0x3f51('0xb'));var querystring=require(_0x3f51('0xc'));var Papa=require(_0x3f51('0xd'));var Redis=require(_0x3f51('0xe'));var authService=require(_0x3f51('0xf'));var qs=require(_0x3f51('0x10'));var as=require(_0x3f51('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f51('0x12'))(_0x3f51('0x13'));var utils=require(_0x3f51('0x14'));var config=require(_0x3f51('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1672d3,_0x30a43d){_0x30a43d=_0x30a43d||0xcc;return function(_0x26be30){if(_0x26be30){return _0x1672d3[_0x3f51('0x16')](_0x30a43d);}return _0x1672d3[_0x3f51('0x17')](_0x30a43d)[_0x3f51('0x18')]();};}function respondWithResult(_0x30243a,_0x36ca45){_0x36ca45=_0x36ca45||0xc8;return function(_0x5b3c20){if(_0x5b3c20){return _0x30243a[_0x3f51('0x17')](_0x36ca45)['json'](_0x5b3c20);}};}function respondWithFilteredResult(_0x10c319,_0x85d598){return function(_0x30ee1f){if(_0x30ee1f){var _0x589ac4=_0x30ee1f[_0x3f51('0x19')],_0x247f32=_0x85d598[_0x3f51('0x1a')],_0x66bfbc=_0x85d598[_0x3f51('0x1a')]+_0x85d598[_0x3f51('0x1b')],_0x46180a;if(_0x66bfbc>=_0x589ac4){_0x66bfbc=_0x589ac4;_0x46180a=0xc8;}else{_0x46180a=0xce;}_0x10c319['status'](_0x46180a);return _0x10c319[_0x3f51('0x1c')](_0x3f51('0x1d'),_0x247f32+'-'+_0x66bfbc+'/'+_0x589ac4)[_0x3f51('0x1e')](_0x30ee1f);}return null;};}function patchUpdates(_0x22544e){return function(_0x406915){try{jsonpatch[_0x3f51('0x1f')](_0x406915,_0x22544e,!![]);}catch(_0x52c2ab){return BPromise[_0x3f51('0x20')](_0x52c2ab);}return _0x406915[_0x3f51('0x21')]();};}function saveUpdates(_0x1a4514,_0x2b0279){return function(_0x523e7c){if(_0x523e7c){return _0x523e7c[_0x3f51('0x22')](_0x1a4514)[_0x3f51('0x23')](function(_0x4d722b){return _0x4d722b;});}return null;};}function removeEntity(_0x1b6088,_0x487bad){return function(_0x587f28){if(_0x587f28){return _0x587f28[_0x3f51('0x24')]()[_0x3f51('0x23')](function(){_0x1b6088[_0x3f51('0x17')](0xcc)[_0x3f51('0x18')]();});}};}function handleEntityNotFound(_0x52dc70,_0x166c91){return function(_0x62a5c4){if(!_0x62a5c4){_0x52dc70[_0x3f51('0x16')](0x194);}return _0x62a5c4;};}function handleError(_0x516968,_0x31c1a0){_0x31c1a0=_0x31c1a0||0x1f4;return function(_0x145797){logger[_0x3f51('0x25')](_0x145797['stack']);if(_0x145797[_0x3f51('0x26')]){delete _0x145797[_0x3f51('0x26')];}_0x516968[_0x3f51('0x17')](_0x31c1a0)['send'](_0x145797);};}exports[_0x3f51('0x27')]=function(_0xcc17b2,_0x7f18f7){var _0x598937={},_0x272c56={},_0x4e4a85={'count':0x0,'rows':[]};var _0x435131=_[_0x3f51('0x28')](db[_0x3f51('0x29')][_0x3f51('0x2a')],function(_0x4442d0){return{'name':_0x4442d0[_0x3f51('0x2b')],'type':_0x4442d0['type']['key']};});_0x272c56[_0x3f51('0x2c')]=_[_0x3f51('0x28')](_0x435131,_0x3f51('0x26'));_0x272c56[_0x3f51('0x2d')]=_[_0x3f51('0x2e')](_0xcc17b2[_0x3f51('0x2d')]);_0x272c56['filters']=_[_0x3f51('0x2f')](_0x272c56['model'],_0x272c56[_0x3f51('0x2d')]);_0x598937[_0x3f51('0x30')]=_[_0x3f51('0x2f')](_0x272c56[_0x3f51('0x2c')],qs[_0x3f51('0x31')](_0xcc17b2[_0x3f51('0x2d')][_0x3f51('0x31')]));_0x598937[_0x3f51('0x30')]=_0x598937[_0x3f51('0x30')]['length']?_0x598937[_0x3f51('0x30')]:_0x272c56[_0x3f51('0x2c')];if(!_0xcc17b2['query'][_0x3f51('0x32')](_0x3f51('0x33'))){_0x598937[_0x3f51('0x1b')]=qs['limit'](_0xcc17b2[_0x3f51('0x2d')][_0x3f51('0x1b')]);_0x598937[_0x3f51('0x1a')]=qs['offset'](_0xcc17b2['query'][_0x3f51('0x1a')]);}_0x598937['order']=qs[_0x3f51('0x34')](_0xcc17b2['query'][_0x3f51('0x34')]);_0x598937[_0x3f51('0x35')]=qs[_0x3f51('0x36')](_[_0x3f51('0x37')](_0xcc17b2[_0x3f51('0x2d')],_0x272c56[_0x3f51('0x36')]),_0x435131);if(_0xcc17b2[_0x3f51('0x2d')][_0x3f51('0x38')]){_0x598937[_0x3f51('0x35')]=_['merge'](_0x598937[_0x3f51('0x35')],{'$or':_[_0x3f51('0x28')](_0x435131,function(_0x44e7c0){if(_0x44e7c0[_0x3f51('0x39')]!==_0x3f51('0x3a')){var _0x28d118={};_0x28d118[_0x44e7c0[_0x3f51('0x26')]]={'$like':'%'+_0xcc17b2[_0x3f51('0x2d')][_0x3f51('0x38')]+'%'};return _0x28d118;}})});}_0x598937=_['merge']({},_0x598937,_0xcc17b2[_0x3f51('0x3b')]);var _0x474dd9={'where':_0x598937[_0x3f51('0x35')]};return db[_0x3f51('0x29')][_0x3f51('0x19')](_0x474dd9)[_0x3f51('0x23')](function(_0x3f3e89){_0x4e4a85['count']=_0x3f3e89;if(_0xcc17b2[_0x3f51('0x2d')][_0x3f51('0x3c')]){_0x598937[_0x3f51('0x3d')]=[{'all':!![]}];}return db[_0x3f51('0x29')][_0x3f51('0x3e')](_0x598937);})[_0x3f51('0x23')](function(_0x4b771c){_0x4e4a85[_0x3f51('0x3f')]=_0x4b771c;return _0x4e4a85;})[_0x3f51('0x23')](respondWithFilteredResult(_0x7f18f7,_0x598937))['catch'](handleError(_0x7f18f7,null));};exports[_0x3f51('0x40')]=function(_0x34828f,_0x554f7f){var _0x216a7={'raw':!![],'where':{'id':_0x34828f[_0x3f51('0x41')]['id']}},_0x10ebc6={};_0x10ebc6[_0x3f51('0x2c')]=_[_0x3f51('0x2e')](db['FaxApplication'][_0x3f51('0x2a')]);_0x10ebc6['query']=_[_0x3f51('0x2e')](_0x34828f['query']);_0x10ebc6[_0x3f51('0x36')]=_[_0x3f51('0x2f')](_0x10ebc6['model'],_0x10ebc6[_0x3f51('0x2d')]);_0x216a7[_0x3f51('0x30')]=_[_0x3f51('0x2f')](_0x10ebc6[_0x3f51('0x2c')],qs['fields'](_0x34828f['query'][_0x3f51('0x31')]));_0x216a7[_0x3f51('0x30')]=_0x216a7['attributes']['length']?_0x216a7['attributes']:_0x10ebc6[_0x3f51('0x2c')];if(_0x34828f[_0x3f51('0x2d')][_0x3f51('0x3c')]){_0x216a7[_0x3f51('0x3d')]=[{'all':!![]}];}_0x216a7=_[_0x3f51('0x42')]({},_0x216a7,_0x34828f[_0x3f51('0x3b')]);return db['FaxApplication'][_0x3f51('0x43')](_0x216a7)['then'](handleEntityNotFound(_0x554f7f,null))[_0x3f51('0x23')](respondWithResult(_0x554f7f,null))['catch'](handleError(_0x554f7f,null));};exports['create']=function(_0x43622f,_0x36e09a){return db['FaxApplication'][_0x3f51('0x44')](_0x43622f[_0x3f51('0x45')],{})[_0x3f51('0x23')](respondWithResult(_0x36e09a,0xc9))[_0x3f51('0x46')](handleError(_0x36e09a,null));};exports[_0x3f51('0x22')]=function(_0x5061d2,_0x430054){if(_0x5061d2[_0x3f51('0x45')]['id']){delete _0x5061d2['body']['id'];}return db[_0x3f51('0x29')][_0x3f51('0x43')]({'where':{'id':_0x5061d2['params']['id']}})[_0x3f51('0x23')](handleEntityNotFound(_0x430054,null))[_0x3f51('0x23')](saveUpdates(_0x5061d2['body'],null))[_0x3f51('0x23')](respondWithResult(_0x430054,null))[_0x3f51('0x46')](handleError(_0x430054,null));};exports[_0x3f51('0x24')]=function(_0x4349b1,_0x3f7b3b){return db['FaxApplication'][_0x3f51('0x43')]({'where':{'id':_0x4349b1[_0x3f51('0x41')]['id']}})[_0x3f51('0x23')](handleEntityNotFound(_0x3f7b3b,null))['then'](removeEntity(_0x3f7b3b,null))[_0x3f51('0x46')](handleError(_0x3f7b3b,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index f215679..7d2f2a3 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 _0xc79e=['FaxApplication','fax_applications','utf8mb4_unicode_ci','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc79e,0x111));var _0xec79=function(_0x5887ec,_0x504c12){_0x5887ec=_0x5887ec-0x0;var _0x23b637=_0xc79e[_0x5887ec];return _0x23b637;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xec79('0x0'))('api');var moment=require('moment');var BPromise=require(_0xec79('0x1'));var rp=require(_0xec79('0x2'));var fs=require('fs');var path=require(_0xec79('0x3'));var rimraf=require(_0xec79('0x4'));var config=require(_0xec79('0x5'));var attributes=require('./faxApplication.attributes');module[_0xec79('0x6')]=function(_0x4faf69,_0x40649a){return _0x4faf69['define'](_0xec79('0x7'),attributes,{'tableName':_0xec79('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xec79('0x9')});}; \ No newline at end of file +var _0xb65d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1097ab,_0x37fce2){var _0x416667=function(_0x3ff972){while(--_0x3ff972){_0x1097ab['push'](_0x1097ab['shift']());}};_0x416667(++_0x37fce2);}(_0xb65d,0xef));var _0xdb65=function(_0x296554,_0x546b51){_0x296554=_0x296554-0x0;var _0x83774b=_0xb65d[_0x296554];return _0x83774b;};'use strict';var _=require(_0xdb65('0x0'));var util=require(_0xdb65('0x1'));var logger=require(_0xdb65('0x2'))(_0xdb65('0x3'));var moment=require(_0xdb65('0x4'));var BPromise=require(_0xdb65('0x5'));var rp=require(_0xdb65('0x6'));var fs=require('fs');var path=require(_0xdb65('0x7'));var rimraf=require(_0xdb65('0x8'));var config=require('../../config/environment');var attributes=require(_0xdb65('0x9'));module[_0xdb65('0xa')]=function(_0x48d663,_0x9891c8){return _0x48d663[_0xdb65('0xb')](_0xdb65('0xc'),attributes,{'tableName':_0xdb65('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdb65('0xe'),'collate':_0xdb65('0xf')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4c298b3..30d6665 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 _0x5602=['FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2406b4,_0x2f9771){var _0x7f3752=function(_0x583971){while(--_0x583971){_0x2406b4['push'](_0x2406b4['shift']());}};_0x7f3752(++_0x2f9771);}(_0x5602,0xe6));var _0x2560=function(_0x466e48,_0x2051d6){_0x466e48=_0x466e48-0x0;var _0x3b4af5=_0x5602[_0x466e48];return _0x3b4af5;};'use strict';var _=require('lodash');var util=require(_0x2560('0x0'));var moment=require('moment');var BPromise=require(_0x2560('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2560('0x2'));var db=require(_0x2560('0x3'))['db'];var utils=require(_0x2560('0x4'));var logger=require('../../config/logger')(_0x2560('0x5'));var config=require(_0x2560('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2560('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53eb64,_0x1ec4ba,_0x3775cf){return new BPromise(function(_0x10dadc,_0x41bd44){return client['request'](_0x53eb64,_0x3775cf)[_0x2560('0x8')](function(_0x6fde8e){logger[_0x2560('0x9')](_0x2560('0xa'),_0x1ec4ba,_0x2560('0xb'));logger[_0x2560('0xc')](_0x2560('0xd'),_0x1ec4ba,_0x2560('0xb'),JSON[_0x2560('0xe')](_0x6fde8e));if(_0x6fde8e['error']){if(_0x6fde8e[_0x2560('0xf')][_0x2560('0x10')]===0x1f4){logger['error'](_0x2560('0xa'),_0x1ec4ba,_0x6fde8e[_0x2560('0xf')][_0x2560('0x11')]);return _0x41bd44(_0x6fde8e[_0x2560('0xf')][_0x2560('0x11')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x1ec4ba,_0x6fde8e[_0x2560('0xf')][_0x2560('0x11')]);return _0x10dadc(_0x6fde8e[_0x2560('0xf')][_0x2560('0x11')]);}else{logger[_0x2560('0x9')]('FaxApplication,\x20%s,\x20%s',_0x1ec4ba,_0x2560('0xb'));_0x10dadc(_0x6fde8e[_0x2560('0x12')][_0x2560('0x11')]);}})[_0x2560('0x13')](function(_0x2e574b){logger[_0x2560('0xf')]('FaxApplication,\x20%s,\x20%s',_0x1ec4ba,_0x2e574b);_0x41bd44(_0x2e574b);});});}exports[_0x2560('0x14')]=function(_0x2a28f7){var _0x3630ba=this;return new Promise(function(_0x5ef45e,_0x422f83){return db[_0x2560('0x15')]['update'](_0x2a28f7[_0x2560('0x16')],{'raw':_0x2a28f7['options']?_0x2a28f7[_0x2560('0x17')][_0x2560('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a28f7[_0x2560('0x17')]?_0x2a28f7['options'][_0x2560('0x19')]||null:null,'attributes':_0x2a28f7[_0x2560('0x17')]?_0x2a28f7['options'][_0x2560('0x1a')]||null:null,'limit':_0x2a28f7[_0x2560('0x17')]?_0x2a28f7[_0x2560('0x17')]['limit']||null:null})['then'](function(_0x1a3049){logger[_0x2560('0x9')]('UpdateFaxApplication',_0x2a28f7);logger[_0x2560('0xc')](_0x2560('0x14'),_0x2a28f7,JSON['stringify'](_0x1a3049));_0x5ef45e(_0x1a3049);})[_0x2560('0x13')](function(_0x282794){logger[_0x2560('0xf')](_0x2560('0x14'),_0x282794[_0x2560('0x11')],_0x2a28f7);_0x422f83(_0x3630ba['error'](0x1f4,_0x282794['message']));});});}; \ No newline at end of file +var _0xf374=['options','raw','attributes','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxApplication,\x20%s,\x20%s','UpdateFaxApplication','body'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0xf374,0x199));var _0x4f37=function(_0x3cbf59,_0x4617dc){_0x3cbf59=_0x3cbf59-0x0;var _0x25f158=_0xf374[_0x3cbf59];return _0x25f158;};'use strict';var _=require(_0x4f37('0x0'));var util=require(_0x4f37('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f37('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f37('0x3'))['db'];var utils=require(_0x4f37('0x4'));var logger=require(_0x4f37('0x5'))(_0x4f37('0x6'));var config=require(_0x4f37('0x7'));var jayson=require(_0x4f37('0x8'));var client=jayson[_0x4f37('0x9')][_0x4f37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5df54f,_0x784ae0,_0x51bd34){return new BPromise(function(_0x4d1101,_0x294b33){return client[_0x4f37('0xb')](_0x5df54f,_0x51bd34)[_0x4f37('0xc')](function(_0x4a8fad){logger[_0x4f37('0xd')]('FaxApplication,\x20%s,\x20%s',_0x784ae0,'request\x20sent');logger[_0x4f37('0xe')](_0x4f37('0xf'),_0x784ae0,_0x4f37('0x10'),JSON[_0x4f37('0x11')](_0x4a8fad));if(_0x4a8fad[_0x4f37('0x12')]){if(_0x4a8fad[_0x4f37('0x12')][_0x4f37('0x13')]===0x1f4){logger[_0x4f37('0x12')]('FaxApplication,\x20%s,\x20%s',_0x784ae0,_0x4a8fad[_0x4f37('0x12')][_0x4f37('0x14')]);return _0x294b33(_0x4a8fad[_0x4f37('0x12')]['message']);}logger[_0x4f37('0x12')]('FaxApplication,\x20%s,\x20%s',_0x784ae0,_0x4a8fad[_0x4f37('0x12')][_0x4f37('0x14')]);return _0x4d1101(_0x4a8fad['error']['message']);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x784ae0,_0x4f37('0x10'));_0x4d1101(_0x4a8fad[_0x4f37('0x15')]['message']);}})[_0x4f37('0x16')](function(_0x43000b){logger['error'](_0x4f37('0x17'),_0x784ae0,_0x43000b);_0x294b33(_0x43000b);});});}exports[_0x4f37('0x18')]=function(_0x132326){var _0x2cb16f=this;return new Promise(function(_0x1a3abf,_0x4e68d3){return db['FaxApplication']['update'](_0x132326[_0x4f37('0x19')],{'raw':_0x132326[_0x4f37('0x1a')]?_0x132326['options'][_0x4f37('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x132326[_0x4f37('0x1a')]?_0x132326[_0x4f37('0x1a')]['where']||null:null,'attributes':_0x132326[_0x4f37('0x1a')]?_0x132326[_0x4f37('0x1a')][_0x4f37('0x1c')]||null:null,'limit':_0x132326[_0x4f37('0x1a')]?_0x132326['options']['limit']||null:null})['then'](function(_0x48e599){logger[_0x4f37('0xd')](_0x4f37('0x18'),_0x132326);logger['debug'](_0x4f37('0x18'),_0x132326,JSON['stringify'](_0x48e599));_0x1a3abf(_0x48e599);})[_0x4f37('0x16')](function(_0x3a3663){logger['error']('UpdateFaxApplication',_0x3a3663[_0x4f37('0x14')],_0x132326);_0x4e68d3(_0x2cb16f[_0x4f37('0x12')](0x1f4,_0x3a3663[_0x4f37('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 0823bd9..790f307 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 _0x7fbe=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x145241,_0x56bf84){var _0x43d7d5=function(_0x35acfa){while(--_0x35acfa){_0x145241['push'](_0x145241['shift']());}};_0x43d7d5(++_0x56bf84);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x52ba3d,_0x3ce09c){_0x52ba3d=_0x52ba3d-0x0;var _0x968ee9=_0x7fbe[_0x52ba3d];return _0x968ee9;};'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['show']);router[_0xe7fb('0xc')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x11')]);module[_0xe7fb('0x12')]=router; \ No newline at end of file +var _0x98a8=['express','Router','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x4851da,_0x1d6697){var _0x2b5b1a=function(_0x336620){while(--_0x336620){_0x4851da['push'](_0x4851da['shift']());}};_0x2b5b1a(++_0x1d6697);}(_0x98a8,0x12c));var _0x898a=function(_0x14d48b,_0x2b97c1){_0x14d48b=_0x14d48b-0x0;var _0x412f6b=_0x98a8[_0x14d48b];return _0x412f6b;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['post']('/',auth[_0x898a('0xa')](),controller[_0x898a('0xe')]);router[_0x898a('0xf')](_0x898a('0xc'),auth[_0x898a('0xa')](),controller[_0x898a('0x10')]);router[_0x898a('0x11')](_0x898a('0xc'),auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 530decd..df09f0b 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 _0xa348=['STRING','DATE','ENUM','out','sequelize','BOOLEAN'];(function(_0xfec4f2,_0x27b2aa){var _0x4ee052=function(_0x195ba5){while(--_0x195ba5){_0xfec4f2['push'](_0xfec4f2['shift']());}};_0x4ee052(++_0x27b2aa);}(_0xa348,0xb2));var _0x8a34=function(_0x454518,_0xcecea){_0x454518=_0x454518-0x0;var _0x5615f6=_0xa348[_0x454518];return _0x5615f6;};'use strict';var Sequelize=require(_0x8a34('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8a34('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8a34('0x2')]},'note':{'type':Sequelize[_0x8a34('0x2')]},'read1stAt':{'type':Sequelize[_0x8a34('0x3')]},'fax':{'type':Sequelize[_0x8a34('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x8a34('0x4')]('in',_0x8a34('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8a34('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8a34('0x4')]('in',_0x8a34('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x56e7=['DATE','ENUM','out','exports','BOOLEAN','STRING'];(function(_0x6ab30c,_0x2c713b){var _0x36e953=function(_0x1aea9a){while(--_0x1aea9a){_0x6ab30c['push'](_0x6ab30c['shift']());}};_0x36e953(++_0x2c713b);}(_0x56e7,0x7b));var _0x756e=function(_0xf2faa3,_0x4a77a7){_0xf2faa3=_0xf2faa3-0x0;var _0x34b2fe=_0x56e7[_0xf2faa3];return _0x34b2fe;};'use strict';var Sequelize=require('sequelize');module[_0x756e('0x0')]={'closed':{'type':Sequelize[_0x756e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x756e('0x2')]},'secondDisposition':{'type':Sequelize[_0x756e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x756e('0x2')]},'note':{'type':Sequelize[_0x756e('0x2')]},'read1stAt':{'type':Sequelize[_0x756e('0x3')]},'fax':{'type':Sequelize[_0x756e('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x756e('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x756e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x756e('0x4')]('in',_0x756e('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 78732d5..5c879a2 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 _0x6e58=['name','Users','map','fullname','TagIds','Tags','forEach','push','index','FaxInteraction','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','field','color','from','tools_tags','u.id','ui.FaxInteractionId','left_join','u.id\x20=\x20ui.UserId','select','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','having','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','isEmpty','FaxAccountId','where','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','rows','show','includeAll','include','merge','options','catch','create','body','describe','addMessage','FaxMessage','params','ids','getMessages','findOne','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','emit','faxInteractionTags:save','removeTags','unix','root','server','files','tmp','join','attachments','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err','unlinkSync','html-pdf','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','end','error'];(function(_0x2b2ac8,_0x22f79a){var _0x5cd081=function(_0x31155d){while(--_0x31155d){_0x2b2ac8['push'](_0x2b2ac8['shift']());}};_0x5cd081(++_0x22f79a);}(_0x6e58,0x182));var _0x86e5=function(_0x5d4a21,_0x3c715d){_0x5d4a21=_0x5d4a21-0x0;var _0x4336a4=_0x6e58[_0x5d4a21];return _0x4336a4;};'use strict';var pdf=require(_0x86e5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x86e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86e5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86e5('0x3'));var Mustache=require(_0x86e5('0x4'));var util=require(_0x86e5('0x5'));var path=require(_0x86e5('0x6'));var sox=require(_0x86e5('0x7'));var csv=require(_0x86e5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x86e5('0x9'));var crypto=require('crypto');var jsforce=require(_0x86e5('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x86e5('0xb'));var Papa=require('papaparse');var Redis=require(_0x86e5('0xc'));var authService=require(_0x86e5('0xd'));var qs=require(_0x86e5('0xe'));var as=require(_0x86e5('0xf'));var hardwareService=require(_0x86e5('0x10'));var logger=require(_0x86e5('0x11'))('api');var utils=require(_0x86e5('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x86e5('0x13'))['db'];config[_0x86e5('0x14')]=_[_0x86e5('0x15')](config[_0x86e5('0x14')],{'host':_0x86e5('0x16'),'port':0x18eb});var socket=require(_0x86e5('0x17'))(new Redis(config[_0x86e5('0x14')]));require(_0x86e5('0x18'))[_0x86e5('0x19')](socket);function respondWithStatusCode(_0x4daafd,_0x5729ab){_0x5729ab=_0x5729ab||0xcc;return function(_0x56128b){if(_0x56128b){return _0x4daafd[_0x86e5('0x1a')](_0x5729ab);}return _0x4daafd[_0x86e5('0x1b')](_0x5729ab)['end']();};}function respondWithResult(_0x3bec18,_0xdf5800){_0xdf5800=_0xdf5800||0xc8;return function(_0x1e5157){if(_0x1e5157){return _0x3bec18[_0x86e5('0x1b')](_0xdf5800)[_0x86e5('0x1c')](_0x1e5157);}};}function respondWithFilteredResult(_0x1a8b05,_0x5caa20){return function(_0x5a5ff4){if(_0x5a5ff4){var _0x5dc731=_0x5a5ff4[_0x86e5('0x1d')],_0x247c56=_0x5caa20[_0x86e5('0x1e')],_0x552b03=_0x5caa20[_0x86e5('0x1e')]+_0x5caa20[_0x86e5('0x1f')],_0x400c1a;if(_0x552b03>=_0x5dc731){_0x552b03=_0x5dc731;_0x400c1a=0xc8;}else{_0x400c1a=0xce;}_0x1a8b05[_0x86e5('0x1b')](_0x400c1a);return _0x1a8b05[_0x86e5('0x20')]('Content-Range',_0x247c56+'-'+_0x552b03+'/'+_0x5dc731)['json'](_0x5a5ff4);}return null;};}function patchUpdates(_0xff73fc){return function(_0x1badca){try{jsonpatch[_0x86e5('0x21')](_0x1badca,_0xff73fc,!![]);}catch(_0x3186d6){return BPromise['reject'](_0x3186d6);}return _0x1badca[_0x86e5('0x22')]();};}function saveUpdates(_0x52e1a9,_0x5b94d5){return function(_0x468d0d){if(_0x468d0d){return _0x468d0d[_0x86e5('0x23')](_0x52e1a9)[_0x86e5('0x24')](function(_0x31733f){return _0x31733f;});}return null;};}function removeEntity(_0x4dccf2,_0x345b21){return function(_0x1e842a){if(_0x1e842a){return _0x1e842a[_0x86e5('0x25')]()[_0x86e5('0x24')](function(){_0x4dccf2[_0x86e5('0x1b')](0xcc)[_0x86e5('0x26')]();});}};}function handleEntityNotFound(_0xba54bc,_0x2a0865){return function(_0x36b41d){if(!_0x36b41d){_0xba54bc[_0x86e5('0x1a')](0x194);}return _0x36b41d;};}function handleError(_0x279c94,_0x352380){_0x352380=_0x352380||0x1f4;return function(_0x249e41){logger[_0x86e5('0x27')](_0x249e41['stack']);if(_0x249e41[_0x86e5('0x28')]){delete _0x249e41['name'];}_0x279c94[_0x86e5('0x1b')](_0x352380)['send'](_0x249e41);};}function getInteractionUsers(_0x100baf,_0x158d9e){return new BPromise(function(_0x14886c,_0x4a55d2){try{if(_0x158d9e[_0x100baf['id']]){_0x100baf[_0x86e5('0x29')]=_[_0x86e5('0x2a')](_0x158d9e[_0x100baf['id']],function(_0x4c329a){return{'id':_0x4c329a['id'],'fullname':_0x4c329a[_0x86e5('0x2b')]};});}}catch(_0x15e72c){_0x4a55d2(_0x15e72c);}_0x14886c(_0x100baf);});}function getInteractionTags(_0x3f5abd,_0x3f3fee){return new BPromise(function(_0x52f32d,_0x128e6d){try{if(_0x3f5abd[_0x86e5('0x2c')]){_0x3f5abd[_0x86e5('0x2d')]=[];_0x3f5abd[_0x86e5('0x2c')]['split'](',')[_0x86e5('0x2e')](function(_0xd40d7c){_0x3f5abd[_0x86e5('0x2d')][_0x86e5('0x2f')](_0x3f3fee[_0xd40d7c]);});}delete _0x3f5abd[_0x86e5('0x2c')];}catch(_0x596872){_0x128e6d(_0x596872);}_0x52f32d(_0x3f5abd);});}function updateFaxInteraction(_0x540aaf,_0x420195,_0x2e3186){return new BPromise(function(_0x3a2eae,_0xf9d7c9){return getInteractionUsers(_0x540aaf,_0x2e3186)['then'](function(_0x406606){return getInteractionTags(_0x406606,_0x420195);})['then'](function(_0xe82235){_0x3a2eae(_0xe82235);})['catch'](function(_0x4363d7){_0xf9d7c9(_0x4363d7);});});}exports[_0x86e5('0x30')]=function(_0x43a264,_0x43f702){var _0xa345c5={},_0x5318d9={},_0x2b3902={'count':0x0,'rows':[]};var _0x56d188=_['map'](db[_0x86e5('0x31')][_0x86e5('0x32')],function(_0x316508){return{'name':_0x316508['fieldName'],'type':_0x316508[_0x86e5('0x33')][_0x86e5('0x34')]};});_0x5318d9[_0x86e5('0x35')]=_['map'](_0x56d188,'name');_0x5318d9[_0x86e5('0x36')]=_[_0x86e5('0x37')](_0x43a264['query']);_0x5318d9[_0x86e5('0x38')]=_['intersection'](_0x5318d9[_0x86e5('0x35')],_0x5318d9[_0x86e5('0x36')]);_0xa345c5[_0x86e5('0x39')]=_[_0x86e5('0x3a')](_0x5318d9[_0x86e5('0x35')],qs[_0x86e5('0x3b')](_0x43a264[_0x86e5('0x36')][_0x86e5('0x3b')]));_0xa345c5[_0x86e5('0x39')]=_0xa345c5['attributes'][_0x86e5('0x3c')]?_0xa345c5[_0x86e5('0x39')]:_0x5318d9[_0x86e5('0x35')];if(!_0x43a264[_0x86e5('0x36')][_0x86e5('0x3d')](_0x86e5('0x3e'))){_0xa345c5[_0x86e5('0x1f')]=qs[_0x86e5('0x1f')](_0x43a264['query']['limit']);_0xa345c5['offset']=qs[_0x86e5('0x1e')](_0x43a264[_0x86e5('0x36')]['offset']);}_0xa345c5[_0x86e5('0x3f')]=qs['sort'](_0x43a264[_0x86e5('0x36')][_0x86e5('0x40')]);_0xa345c5['where']=qs[_0x86e5('0x38')](_[_0x86e5('0x41')](_0x43a264[_0x86e5('0x36')],_0x5318d9[_0x86e5('0x38')]),_0x56d188);var _0x150ca2=[];var _0x18e8b9=squel['select']()[_0x86e5('0x42')]('id')[_0x86e5('0x42')](_0x86e5('0x28'))[_0x86e5('0x42')](_0x86e5('0x43'))[_0x86e5('0x44')](_0x86e5('0x45'));var _0x2dd668=squel['select']()[_0x86e5('0x42')](_0x86e5('0x46'))[_0x86e5('0x42')]('u.fullname')['field'](_0x86e5('0x47'))[_0x86e5('0x44')]('user_has_fax_interactions','ui')[_0x86e5('0x48')]('users','u',_0x86e5('0x49'));var _0x390341=squel[_0x86e5('0x4a')]()['from']('fax_interactions','i')[_0x86e5('0x48')](_0x86e5('0x4b'),'c',_0x86e5('0x4c'))[_0x86e5('0x48')](_0x86e5('0x4d'),'o',_0x86e5('0x4e'))['left_join'](_0x86e5('0x4f'),'a',_0x86e5('0x50'))[_0x86e5('0x48')](_0x86e5('0x51'),'me',_0x86e5('0x52'))[_0x86e5('0x48')](_0x86e5('0x53'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x86e5('0x48')](_0x86e5('0x45'),'t',_0x86e5('0x54'));var _0x3d6267=squel[_0x86e5('0x55')]();var _0x13d848=[];var _0x42b34a=squel[_0x86e5('0x55')]();var _0x5a5313;if(_0x43a264[_0x86e5('0x36')]['search']){_0x5a5313=as[_0x86e5('0x56')](_0x43a264['query'][_0x86e5('0x57')]);var _0x4dd78e=_0x5a5313[_0x86e5('0x58')];for(var _0x404a54=0x0;_0x404a54<_0x5a5313[_0x86e5('0x59')][_0x86e5('0x3c')];_0x404a54++){var _0x562d82=_0x5a5313[_0x86e5('0x59')][_0x404a54];var _0x3fa52d='i';var _0x509c61=_['find'](_0x56d188,[_0x86e5('0x28'),_0x562d82[_0x86e5('0x42')]]);if(!_0x509c61){switch(_0x562d82['field']){case'unreadMessages':if(_0x562d82['value']==0x1){_0x390341['having']('`'+_0x562d82['field']+'`\x20=\x200');}else{_0x390341[_0x86e5('0x5a')]('`'+_0x562d82[_0x86e5('0x42')]+'`\x20>\x200');}break;case _0x86e5('0x5b'):if(_0x562d82[_0x86e5('0x5c')]==='$substring'){if(_0x562d82['value'][_0x86e5('0x5d')]('\x20')[_0x86e5('0x3c')]>0x1){_0x3d6267[_0x4dd78e](_0x86e5('0x5e'),qs['getFullTextValue'](_0x562d82[_0x86e5('0x5f')]),null);}else{var _0x306d9f='%'+_0x562d82[_0x86e5('0x5f')]+'%';_0x3d6267[_0x4dd78e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x306d9f,_0x306d9f,_0x306d9f);}}else{_0x509c61=_[_0x86e5('0x60')](_0x56d188,[_0x86e5('0x28'),_0x86e5('0x61')]);_0x562d82['field']=_0x86e5('0x61');_0x582198=as[_0x86e5('0x62')](_0x3fa52d,_0x509c61[_0x86e5('0x33')],_0x562d82);_0x3d6267[_0x4dd78e](_0x582198[_0x86e5('0x63')],_0x582198['value'][_0x86e5('0x64')],_0x582198[_0x86e5('0x5f')]['end']);}break;case _0x86e5('0x65'):var _0x13d3c1=_0x562d82[_0x86e5('0x5f')]['split'](',')['map'](function(_0x43e567){return Number(_0x43e567);});_0x13d3c1[_0x86e5('0x2e')](function(_0x425ab3){_0x42b34a['or'](_0x86e5('0x66'),'%,'+_0x425ab3+',%');});_0x13d848=_[_0x86e5('0x67')](_0x13d848,_0x13d3c1);break;case _0x86e5('0x68'):if(_0x562d82[_0x86e5('0x5c')]==='$substring'){_0x3d6267[_0x4dd78e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x562d82[_0x86e5('0x5f')]+'%',null);}else{_0x509c61=_['find'](_0x56d188,['name',_0x86e5('0x69')]);_0x562d82[_0x86e5('0x42')]='UserId';_0x582198=as[_0x86e5('0x62')](_0x3fa52d,_0x509c61[_0x86e5('0x33')],_0x562d82);_0x3d6267[_0x4dd78e](_0x582198[_0x86e5('0x63')],_0x582198[_0x86e5('0x5f')][_0x86e5('0x64')],_0x582198[_0x86e5('0x5f')][_0x86e5('0x26')]);}break;case'body':_0x582198=as['buildExpression']('me',null,_0x562d82);_0x3d6267[_0x4dd78e](_0x582198['text'],_0x582198['value'][_0x86e5('0x64')],_0x582198[_0x86e5('0x5f')][_0x86e5('0x26')]);break;}}else{var _0x582198=as[_0x86e5('0x62')](_0x3fa52d,_0x509c61[_0x86e5('0x33')],_0x562d82);_0x3d6267[_0x4dd78e](_0x582198[_0x86e5('0x63')],_0x582198[_0x86e5('0x5f')][_0x86e5('0x64')],_0x582198[_0x86e5('0x5f')]['end']);}}}else{var _0x1402ad=_(_0x43a264[_0x86e5('0x36')])[_0x86e5('0x37')]()[_0x86e5('0x2a')](function(_0x5ad7c4){return _['some'](_0x56d188,[_0x86e5('0x28'),_0x5ad7c4])?_0x5ad7c4:undefined;})['compact']()[_0x86e5('0x5f')]();if(!_[_0x86e5('0x6a')](_0x1402ad)){_0x1402ad['forEach'](function(_0x3af767){if(_0x3af767===_0x86e5('0x6b')){_0x390341[_0x86e5('0x6c')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x43a264[_0x86e5('0x36')][_0x3af767]));}else if(_0x3af767===_0x86e5('0x6d')){var _0x11cc4f=JSON[_0x86e5('0x6e')](_0x43a264[_0x86e5('0x36')][_0x3af767])[_0x86e5('0x6f')];var _0x291765=JSON[_0x86e5('0x6e')](_0x43a264[_0x86e5('0x36')][_0x3af767])[_0x86e5('0x70')];_0x390341[_0x86e5('0x6c')](_0x86e5('0x71'),_0x11cc4f,_0x291765);}else{if(_0x43a264['query'][_0x3af767]===_0x86e5('0x72')){_0x390341[_0x86e5('0x6c')]('i.'+_0x3af767+_0x86e5('0x73'));}else{_0x390341[_0x86e5('0x6c')]('i.'+_0x3af767+_0x86e5('0x74'),_0x43a264[_0x86e5('0x36')][_0x3af767]);}}});}if(_0x43a264[_0x86e5('0x36')]['read']){if(_0x43a264['query'][_0x86e5('0x75')]==0x1){_0x390341['having']('`unreadMessages`\x20=\x200');}else{_0x390341[_0x86e5('0x5a')](_0x86e5('0x76'));}}if(_0x43a264[_0x86e5('0x36')][_0x86e5('0x77')]){_0x13d848=_[_0x86e5('0x78')](_0x43a264[_0x86e5('0x36')]['tag'])?_0x43a264['query']['tag']:new Array(_0x43a264['query'][_0x86e5('0x77')]);_0x13d848['forEach'](function(_0xf8eba){_0x42b34a['or'](_0x86e5('0x66'),'%,'+_0xf8eba+',%');});}if(_0x43a264[_0x86e5('0x36')][_0x86e5('0x79')]){var _0x514212=_0x43a264[_0x86e5('0x36')][_0x86e5('0x79')][_0x86e5('0x7a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x86e5('0x7b')](_0x514212)){_0x3d6267['or'](_0x86e5('0x7c'),_0x514212+'%')['or'](_0x86e5('0x7d'),_0x514212+'%');}_0x3d6267['or'](_0x86e5('0x7e'),_0x514212+'%');}}_0x390341[_0x86e5('0x6c')](_0x3d6267);_0x390341[_0x86e5('0x7f')](_0x86e5('0x80'));var _0x15b0e6={'type':db[_0x86e5('0x81')][_0x86e5('0x82')][_0x86e5('0x83')],'raw':!![]};var _0x304c2c=_0x390341[_0x86e5('0x84')]();_0x304c2c['field'](_0x86e5('0x80'));_0x304c2c[_0x86e5('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x86e5('0x85'));if(_0xa345c5['order']){_0xa345c5[_0x86e5('0x3f')][_0x86e5('0x2e')](function(_0x5de074){var _0x47668e=_0x5de074[0x0]===_0x86e5('0x86')?_0x5de074[0x0]:'i.'+_0x5de074[0x0];_0x390341['order'](_0x47668e,_0x5de074[0x1]===_0x86e5('0x87')?![]:!![]);});}if(!_['isEmpty'](_0x13d848)){_0x390341['having'](_0x42b34a);_0x304c2c['where'](_0x86e5('0x88'),_0x13d848);}BPromise[_0x86e5('0x89')]()[_0x86e5('0x24')](function(){if(!_0x5a5313){if(_0x43a264[_0x86e5('0x36')][_0x86e5('0x6b')])return;_0x304c2c['where'](_0x86e5('0x8a'));_0x390341['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x43a264[_0x86e5('0x8b')][_0x86e5('0x8c')]!==_0x86e5('0x8d'))return;return _0x43a264[_0x86e5('0x8b')][_0x86e5('0x8e')]({'attributes':['id'],'raw':!![]})[_0x86e5('0x24')](function(_0x38e1df){if(_['isEmpty'](_0x38e1df)){_0x304c2c[_0x86e5('0x6c')]('i.FaxAccountId\x20IS\x20NULL');_0x390341['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x304c2c[_0x86e5('0x6c')](_0x86e5('0x8f'),_[_0x86e5('0x2a')](_0x38e1df,'id'));_0x390341[_0x86e5('0x6c')](_0x86e5('0x8f'),_[_0x86e5('0x2a')](_0x38e1df,'id'));}});})[_0x86e5('0x24')](function(){if(_0x43a264[_0x86e5('0x8b')][_0x86e5('0x8c')]===_0x86e5('0x8d')&&!_0x5a5313&&!_0x43a264[_0x86e5('0x36')]['FaxAccountId'])return[];return db[_0x86e5('0x90')][_0x86e5('0x36')](_0x304c2c[_0x86e5('0x91')](),_0x15b0e6);})['then'](function(_0x4a3a92){_0x2b3902[_0x86e5('0x1d')]=_0x4a3a92[_0x86e5('0x3c')];if(_0x2b3902[_0x86e5('0x1d')]===0x0)return[];return db[_0x86e5('0x90')][_0x86e5('0x36')](_0x18e8b9['toString'](),_0x15b0e6)[_0x86e5('0x24')](function(_0xb86e3f){_0x150ca2=_[_0x86e5('0x92')](_0xb86e3f,'id');_0x15b0e6=_['merge'](_0x15b0e6,{'model':db[_0x86e5('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x43a264[_0x86e5('0x36')][_0x86e5('0x3b')]){_0xa345c5[_0x86e5('0x39')][_0x86e5('0x2e')](function(_0x3770f7){_0x390341[_0x86e5('0x42')]('i.'+_0x3770f7);});}else{_0x390341[_0x86e5('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x390341[_0x86e5('0x42')]('a.key',_0x86e5('0x93'));_0x390341[_0x86e5('0x42')](_0x86e5('0x94'),_0x86e5('0x95'));_0x390341[_0x86e5('0x42')](_0x86e5('0x96'),_0x86e5('0x86'));_0x390341['field'](_0x86e5('0x97'));_0x390341[_0x86e5('0x42')]('c.firstName',_0x86e5('0x98'));_0x390341[_0x86e5('0x42')](_0x86e5('0x99'),_0x86e5('0x9a'));_0x390341[_0x86e5('0x42')](_0x86e5('0x9b'),_0x86e5('0x9c'));_0x390341[_0x86e5('0x42')](_0x86e5('0x9d'),_0x86e5('0x9e'));_0x390341[_0x86e5('0x42')](_0x86e5('0x9f'),'Contact.mobile');_0x390341['field'](_0x86e5('0xa0'),_0x86e5('0xa1'));_0x390341['field'](_0x86e5('0xa2'),'Owner.fullname');_0x390341[_0x86e5('0x42')](_0x86e5('0xa3'),'Owner.internal');_0x390341[_0x86e5('0x42')](_0x86e5('0xa4'),_0x86e5('0x2c'));}if(_0xa345c5[_0x86e5('0x1f')])_0x390341[_0x86e5('0x1f')](_0xa345c5['limit']);if(_0xa345c5[_0x86e5('0x1e')])_0x390341[_0x86e5('0x1e')](_0xa345c5[_0x86e5('0x1e')]);return db[_0x86e5('0x90')]['query'](_0x390341['toString'](),_0x15b0e6);})[_0x86e5('0x24')](function(_0x2121ce){_0x2dd668[_0x86e5('0x6c')](_0x86e5('0xa5'),_[_0x86e5('0x2a')](_0x2121ce,'id'));return db['sequelize'][_0x86e5('0x36')](_0x2dd668[_0x86e5('0x91')](),_0x15b0e6)[_0x86e5('0x24')](function(_0x25d502){var _0x4f71d7=_[_0x86e5('0xa6')](_0x25d502,'FaxInteractionId');var _0x3ed892=[];_0x2121ce[_0x86e5('0x2e')](function(_0x46aafb){_0x3ed892[_0x86e5('0x2f')](updateFaxInteraction(_0x46aafb,_0x150ca2,_0x4f71d7));});return BPromise['all'](_0x3ed892);});});})[_0x86e5('0x24')](function(_0x5bee11){_0x2b3902[_0x86e5('0xa7')]=_0x5bee11;return _0x2b3902;})[_0x86e5('0x24')](respondWithFilteredResult(_0x43f702,_0xa345c5))['catch'](handleError(_0x43f702,null));};exports[_0x86e5('0xa8')]=function(_0x542481,_0x570caa){var _0x1c1b86={'raw':![],'where':{'id':_0x542481['params']['id']}},_0x1504b2={};_0x1504b2[_0x86e5('0x35')]=_[_0x86e5('0x37')](db[_0x86e5('0x31')][_0x86e5('0x32')]);_0x1504b2[_0x86e5('0x36')]=_[_0x86e5('0x37')](_0x542481[_0x86e5('0x36')]);_0x1504b2['filters']=_['intersection'](_0x1504b2[_0x86e5('0x35')],_0x1504b2['query']);_0x1c1b86[_0x86e5('0x39')]=_[_0x86e5('0x3a')](_0x1504b2[_0x86e5('0x35')],qs['fields'](_0x542481[_0x86e5('0x36')][_0x86e5('0x3b')]));_0x1c1b86[_0x86e5('0x39')]=_0x1c1b86[_0x86e5('0x39')][_0x86e5('0x3c')]?_0x1c1b86[_0x86e5('0x39')]:_0x1504b2[_0x86e5('0x35')];if(_0x542481[_0x86e5('0x36')][_0x86e5('0xa9')]){_0x1c1b86[_0x86e5('0xaa')]=[{'all':!![]}];}_0x1c1b86=_[_0x86e5('0xab')]({},_0x1c1b86,_0x542481[_0x86e5('0xac')]);return db[_0x86e5('0x31')][_0x86e5('0x60')](_0x1c1b86)[_0x86e5('0x24')](handleEntityNotFound(_0x570caa,null))[_0x86e5('0x24')](respondWithResult(_0x570caa,null))[_0x86e5('0xad')](handleError(_0x570caa,null));};exports[_0x86e5('0xae')]=function(_0x40cca4,_0x44674e){return db[_0x86e5('0x31')][_0x86e5('0xae')](_0x40cca4[_0x86e5('0xaf')],{})[_0x86e5('0x24')](respondWithResult(_0x44674e,0xc9))[_0x86e5('0xad')](handleError(_0x44674e,null));};exports[_0x86e5('0x23')]=function(_0x15eb83,_0x1da1b3){if(_0x15eb83['body']['id']){delete _0x15eb83['body']['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x15eb83['params']['id']}})[_0x86e5('0x24')](handleEntityNotFound(_0x1da1b3,null))[_0x86e5('0x24')](saveUpdates(_0x15eb83[_0x86e5('0xaf')],null))[_0x86e5('0x24')](respondWithResult(_0x1da1b3,null))[_0x86e5('0xad')](handleError(_0x1da1b3,null));};exports[_0x86e5('0x25')]=function(_0x182278,_0x5b76df){return db[_0x86e5('0x31')]['find']({'where':{'id':_0x182278['params']['id']}})[_0x86e5('0x24')](handleEntityNotFound(_0x5b76df,null))[_0x86e5('0x24')](removeEntity(_0x5b76df,null))['catch'](handleError(_0x5b76df,null));};exports['describe']=function(_0x4ad589,_0x45c169){return db[_0x86e5('0x31')][_0x86e5('0xb0')]()[_0x86e5('0x24')](respondWithResult(_0x45c169,null))[_0x86e5('0xad')](handleError(_0x45c169,null));};exports[_0x86e5('0xb1')]=function(_0x12ec52,_0x267068,_0x57ec8a){return db[_0x86e5('0xb2')][_0x86e5('0x60')]({'where':{'id':_0x12ec52[_0x86e5('0xb3')]['id']}})[_0x86e5('0x24')](handleEntityNotFound(_0x267068,null))[_0x86e5('0x24')](function(_0x5959e6){if(_0x5959e6){return _0x5959e6['addMessage'](_0x12ec52[_0x86e5('0xaf')][_0x86e5('0xb4')],_['omit'](_0x12ec52[_0x86e5('0xaf')],['ids','id'])||{});}})[_0x86e5('0x24')](respondWithResult(_0x267068,null))[_0x86e5('0xad')](handleError(_0x267068,null));};exports[_0x86e5('0xb5')]=function(_0x15ab3e,_0x138916,_0x5ef63f){var _0x1cea17={'raw':![],'where':{}};var _0x211686={};var _0x3801e7={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x86e5('0xb6')]({'where':{'id':_0x15ab3e[_0x86e5('0xb3')]['id']}})['then'](handleEntityNotFound(_0x138916,null))[_0x86e5('0x24')](function(_0x3a1191){if(_0x3a1191){_0x211686[_0x86e5('0x35')]=_[_0x86e5('0x37')](db[_0x86e5('0xb2')][_0x86e5('0x32')]);_0x211686[_0x86e5('0x36')]=_[_0x86e5('0x37')](_0x15ab3e[_0x86e5('0x36')]);_0x211686[_0x86e5('0x38')]=_[_0x86e5('0x3a')](_0x211686['model'],_0x211686[_0x86e5('0x36')]);_0x1cea17[_0x86e5('0x39')]=_['intersection'](_0x211686[_0x86e5('0x35')],qs[_0x86e5('0x3b')](_0x15ab3e[_0x86e5('0x36')][_0x86e5('0x3b')]));_0x1cea17[_0x86e5('0x39')]=_0x1cea17[_0x86e5('0x39')][_0x86e5('0x3c')]?_0x1cea17[_0x86e5('0x39')]:_0x211686[_0x86e5('0x35')];if(!_0x15ab3e[_0x86e5('0x36')][_0x86e5('0x3d')]('nolimit')){_0x1cea17[_0x86e5('0x1f')]=qs[_0x86e5('0x1f')](_0x15ab3e[_0x86e5('0x36')]['limit']);_0x1cea17[_0x86e5('0x1e')]=qs['offset'](_0x15ab3e[_0x86e5('0x36')]['offset']);}_0x1cea17[_0x86e5('0x3f')]=qs[_0x86e5('0x40')](_0x15ab3e[_0x86e5('0x36')][_0x86e5('0x40')]);_0x1cea17['where']=qs[_0x86e5('0x38')](_[_0x86e5('0x41')](_0x15ab3e['query'],_0x211686[_0x86e5('0x38')]));_0x1cea17['where'][_0x86e5('0xb7')]=_0x3a1191['id'];if(_0x15ab3e['query'][_0x86e5('0x79')]){_0x1cea17[_0x86e5('0x6c')]=_[_0x86e5('0xab')](_0x1cea17[_0x86e5('0x6c')],{'$or':_['map'](_0x1cea17['attributes'],function(_0x3fdd32){var _0x24974d={};_0x24974d[_0x3fdd32]={'$like':'%'+_0x15ab3e[_0x86e5('0x36')][_0x86e5('0x79')]+'%'};return _0x24974d;})});}if(_0x15ab3e['query'][_0x86e5('0x6f')]){var _0x1b3170=_0x15ab3e[_0x86e5('0x36')]['$gte']['split'](',');var _0xe9be5e={};_0xe9be5e[_0x1b3170[0x0]]={'$gte':moment(_0x1b3170[0x1])[_0x86e5('0xb8')](_0x86e5('0xb9'))};_0x1cea17['where']=_['merge'](_0x1cea17[_0x86e5('0x6c')],_0xe9be5e);}_0x1cea17=_[_0x86e5('0xab')]({},_0x1cea17,_0x15ab3e[_0x86e5('0xac')]);return db[_0x86e5('0xb2')][_0x86e5('0x1d')]({'where':_0x1cea17[_0x86e5('0x6c')]})[_0x86e5('0x24')](function(_0x1dc56f){_0x3801e7[_0x86e5('0x1d')]=_0x1dc56f;if(_0x15ab3e['query'][_0x86e5('0xa9')]){_0x1cea17['include']=[{'all':!![]}];}return db[_0x86e5('0xb2')][_0x86e5('0xba')](_0x1cea17);})['then'](function(_0x126836){_0x3801e7['rows']=_0x126836;return _0x3801e7;});}})[_0x86e5('0x24')](respondWithFilteredResult(_0x138916,_0x1cea17))['catch'](handleError(_0x138916,null));};exports[_0x86e5('0xbb')]=function(_0x419705,_0x38613c,_0x45a263){return db['FaxInteraction'][_0x86e5('0x60')]({'where':{'id':_0x419705[_0x86e5('0xb3')]['id']}})[_0x86e5('0x24')](handleEntityNotFound(_0x38613c,null))[_0x86e5('0x24')](function(_0x284dc6){if(_0x284dc6){return _0x284dc6[_0x86e5('0xbc')](_0x419705[_0x86e5('0xaf')][_0x86e5('0xb4')],_[_0x86e5('0xbd')](_0x419705[_0x86e5('0xaf')],[_0x86e5('0xb4'),'id'])||{})[_0x86e5('0xbe')](function(){return db[_0x86e5('0x65')][_0x86e5('0xba')]({'attributes':['id',_0x86e5('0x28'),_0x86e5('0x43')],'where':{'id':_0x419705['body'][_0x86e5('0xb4')]}});})[_0x86e5('0x24')](function(_0x50b7cf){socket[_0x86e5('0xbf')](_0x86e5('0xc0'),{'id':Number(_0x419705['params']['id']),'tags':_0x50b7cf||[]});return{'id':Number(_0x419705[_0x86e5('0xb3')]['id']),'tags':_0x50b7cf||[]};});}})[_0x86e5('0x24')](respondWithResult(_0x38613c,null))['catch'](handleError(_0x38613c,null));};exports[_0x86e5('0xc1')]=function(_0xf290bf,_0x481079,_0xe57486){return db[_0x86e5('0x31')][_0x86e5('0x60')]({'where':{'id':_0xf290bf['params']['id']}})[_0x86e5('0x24')](handleEntityNotFound(_0x481079,null))[_0x86e5('0x24')](function(_0x63dfc6){if(_0x63dfc6){return _0x63dfc6[_0x86e5('0xc1')](_0xf290bf['query'][_0x86e5('0xb4')]);}})[_0x86e5('0x24')](respondWithStatusCode(_0x481079,null))[_0x86e5('0xad')](handleError(_0x481079,null));};exports['download']=function(_0x59245c,_0x3bb6fb){var _0x2a651b=moment()[_0x86e5('0xc2')]()[_0x86e5('0x91')]();var _0x483423=path['join'](config[_0x86e5('0xc3')],_0x86e5('0xc4'),_0x86e5('0xc5'),_0x86e5('0xc6'));var _0x583dc3=path[_0x86e5('0xc7')](config[_0x86e5('0xc3')],_0x86e5('0xc4'),_0x86e5('0xc5'),_0x86e5('0xc8'));var _0x26bd0d=path[_0x86e5('0xc7')](_0x483423,_0x2a651b);var _0x1b6c24=util['format']('transcript-%d-%s.zip',_0x59245c[_0x86e5('0xb3')]['id'],_0x2a651b);var _0x4e86e2=path[_0x86e5('0xc7')](_0x483423,_0x1b6c24);var _0x3e722d=[];_0x3e722d[_0x86e5('0x2f')]({'model':db[_0x86e5('0xc9')],'as':_0x86e5('0xc9'),'raw':!![]});var _0x27ec45=[{'model':db[_0x86e5('0xb2')],'as':_0x86e5('0xca'),'attributes':['id',_0x86e5('0xaf'),'createdAt'],'include':_0x3e722d}];return db[_0x86e5('0x31')][_0x86e5('0x60')]({'where':{'id':_0x59245c[_0x86e5('0xb3')]['id']},'include':_0x27ec45})[_0x86e5('0x24')](handleEntityNotFound(_0x3bb6fb,null))[_0x86e5('0x24')](function(_0x551014){if(_0x551014&&_0x551014[_0x86e5('0xca')]){var _0x2f2bad=_0x551014['get']({'plain':!![]});fs[_0x86e5('0xcb')](_0x26bd0d);for(var _0x556042=0x0;_0x556042<_0x2f2bad[_0x86e5('0xca')]['length'];_0x556042++){var _0x35844b=_0x2f2bad[_0x86e5('0xca')][_0x556042]['Attachment'];if(_0x35844b){var _0x140011=path['join'](_0x583dc3,_0x35844b[_0x86e5('0xcc')]);if(fs[_0x86e5('0xcd')](_0x140011)){fs[_0x86e5('0xce')](_0x140011)[_0x86e5('0xcf')](fs[_0x86e5('0xd0')](path[_0x86e5('0xc7')](_0x26bd0d,_0x35844b[_0x86e5('0xcc')])));}}}return BPromise['resolve']()[_0x86e5('0x24')](function(){return new BPromise(function(_0x4ce606,_0x23a1e7){zipdir(_0x26bd0d,{'saveTo':_0x4e86e2},function(_0x3d7949,_0x8ec1ca){if(_0x3d7949)return _0x23a1e7(_0x3d7949);return _0x4ce606(_0x8ec1ca);});})[_0x86e5('0x24')](function(){return new BPromise(function(_0x5889e4,_0x1abb64){rimraf(_0x26bd0d,function(_0x30b278){if(_0x30b278)_0x1abb64(_0x30b278);return _0x5889e4();});});})['then'](function(){return _0x3bb6fb[_0x86e5('0xd1')](_0x4e86e2,_0x1b6c24,function(_0x281d90){if(_0x281d90){console[_0x86e5('0xd2')](_0x86e5('0xd3'),_0x281d90);}else{fs[_0x86e5('0xd4')](_0x4e86e2);}});});});}else{return _0x3bb6fb[_0x86e5('0x1a')](0xc8);}})[_0x86e5('0xad')](handleError(_0x3bb6fb,null));}; \ No newline at end of file +var _0x06b6=['\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','sequelize','toString','count','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','rawAttributes','intersection','includeAll','create','describe','addMessage','FaxMessage','ids','getMessages','findOne','sort','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','omit','faxInteractionTags:save','removeTags','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','index','FaxInteraction','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','find','UserId','start','body','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0x06b6,0x12f));var _0x606b=function(_0x6ea62c,_0x27bd26){_0x6ea62c=_0x6ea62c-0x0;var _0x48ec5d=_0x06b6[_0x6ea62c];return _0x48ec5d;};'use strict';var pdf=require(_0x606b('0x0'));var emlformat=require(_0x606b('0x1'));var rimraf=require(_0x606b('0x2'));var zipdir=require(_0x606b('0x3'));var jsonpatch=require(_0x606b('0x4'));var rp=require(_0x606b('0x5'));var moment=require(_0x606b('0x6'));var BPromise=require(_0x606b('0x7'));var Mustache=require(_0x606b('0x8'));var util=require(_0x606b('0x9'));var path=require(_0x606b('0xa'));var sox=require(_0x606b('0xb'));var csv=require(_0x606b('0xc'));var ejs=require(_0x606b('0xd'));var fs=require('fs');var _=require(_0x606b('0xe'));var squel=require(_0x606b('0xf'));var crypto=require(_0x606b('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x606b('0x11'));var toCsv=require(_0x606b('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x606b('0x12'));var qs=require(_0x606b('0x13'));var as=require(_0x606b('0x14'));var hardwareService=require(_0x606b('0x15'));var logger=require(_0x606b('0x16'))(_0x606b('0x17'));var utils=require(_0x606b('0x18'));var config=require(_0x606b('0x19'));var licenseUtil=require(_0x606b('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x606b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x606b('0x1c'))(new Redis(config[_0x606b('0x1b')]));require(_0x606b('0x1d'))[_0x606b('0x1e')](socket);function respondWithStatusCode(_0x5ae54d,_0xc1ba8e){_0xc1ba8e=_0xc1ba8e||0xcc;return function(_0x5af9c7){if(_0x5af9c7){return _0x5ae54d[_0x606b('0x1f')](_0xc1ba8e);}return _0x5ae54d[_0x606b('0x20')](_0xc1ba8e)[_0x606b('0x21')]();};}function respondWithResult(_0x4f77a7,_0x3f9865){_0x3f9865=_0x3f9865||0xc8;return function(_0x59a447){if(_0x59a447){return _0x4f77a7['status'](_0x3f9865)[_0x606b('0x22')](_0x59a447);}};}function respondWithFilteredResult(_0xf7a218,_0x57fad8){return function(_0x19b9cd){if(_0x19b9cd){var _0x2587e8=_0x19b9cd['count'],_0x1181a6=_0x57fad8[_0x606b('0x23')],_0x3bdd33=_0x57fad8[_0x606b('0x23')]+_0x57fad8[_0x606b('0x24')],_0x549975;if(_0x3bdd33>=_0x2587e8){_0x3bdd33=_0x2587e8;_0x549975=0xc8;}else{_0x549975=0xce;}_0xf7a218[_0x606b('0x20')](_0x549975);return _0xf7a218[_0x606b('0x25')](_0x606b('0x26'),_0x1181a6+'-'+_0x3bdd33+'/'+_0x2587e8)[_0x606b('0x22')](_0x19b9cd);}return null;};}function patchUpdates(_0x5d42a3){return function(_0x4a6642){try{jsonpatch['apply'](_0x4a6642,_0x5d42a3,!![]);}catch(_0x469686){return BPromise[_0x606b('0x27')](_0x469686);}return _0x4a6642[_0x606b('0x28')]();};}function saveUpdates(_0x22dd9e,_0x4c8737){return function(_0x566f01){if(_0x566f01){return _0x566f01[_0x606b('0x29')](_0x22dd9e)['then'](function(_0x158c26){return _0x158c26;});}return null;};}function removeEntity(_0x3f756f,_0xf87c68){return function(_0x566adb){if(_0x566adb){return _0x566adb[_0x606b('0x2a')]()[_0x606b('0x2b')](function(){_0x3f756f[_0x606b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd1914,_0x203384){return function(_0x377158){if(!_0x377158){_0xd1914[_0x606b('0x1f')](0x194);}return _0x377158;};}function handleError(_0x32c717,_0x1f68b0){_0x1f68b0=_0x1f68b0||0x1f4;return function(_0x54d5bb){logger['error'](_0x54d5bb[_0x606b('0x2c')]);if(_0x54d5bb[_0x606b('0x2d')]){delete _0x54d5bb[_0x606b('0x2d')];}_0x32c717[_0x606b('0x20')](_0x1f68b0)[_0x606b('0x2e')](_0x54d5bb);};}function getInteractionUsers(_0x43d352,_0x5183b4){return new BPromise(function(_0x28b46a,_0x5e7da6){try{if(_0x5183b4[_0x43d352['id']]){_0x43d352[_0x606b('0x2f')]=_[_0x606b('0x30')](_0x5183b4[_0x43d352['id']],function(_0xb8ca04){return{'id':_0xb8ca04['id'],'fullname':_0xb8ca04[_0x606b('0x31')]};});}}catch(_0x3cc796){_0x5e7da6(_0x3cc796);}_0x28b46a(_0x43d352);});}function getInteractionTags(_0x542757,_0x3da16e){return new BPromise(function(_0x5ab64a,_0x1c222c){try{if(_0x542757[_0x606b('0x32')]){_0x542757[_0x606b('0x33')]=[];_0x542757[_0x606b('0x32')]['split'](',')[_0x606b('0x34')](function(_0x2db0d7){_0x542757[_0x606b('0x33')][_0x606b('0x35')](_0x3da16e[_0x2db0d7]);});}delete _0x542757[_0x606b('0x32')];}catch(_0x49c4dc){_0x1c222c(_0x49c4dc);}_0x5ab64a(_0x542757);});}function updateFaxInteraction(_0x3d77ec,_0x379d6d,_0x5a5048){return new BPromise(function(_0x3c03b9,_0x170e2a){return getInteractionUsers(_0x3d77ec,_0x5a5048)[_0x606b('0x2b')](function(_0x1d059a){return getInteractionTags(_0x1d059a,_0x379d6d);})[_0x606b('0x2b')](function(_0x681c64){_0x3c03b9(_0x681c64);})[_0x606b('0x36')](function(_0x238a55){_0x170e2a(_0x238a55);});});}exports[_0x606b('0x37')]=function(_0x588c6f,_0x470a90){var _0x684d77={},_0x2f9f4f={},_0x735e0={'count':0x0,'rows':[]};var _0x2ec130=_[_0x606b('0x30')](db[_0x606b('0x38')]['rawAttributes'],function(_0x550a21){return{'name':_0x550a21[_0x606b('0x39')],'type':_0x550a21[_0x606b('0x3a')][_0x606b('0x3b')]};});_0x2f9f4f[_0x606b('0x3c')]=_[_0x606b('0x30')](_0x2ec130,_0x606b('0x2d'));_0x2f9f4f['query']=_[_0x606b('0x3d')](_0x588c6f[_0x606b('0x3e')]);_0x2f9f4f[_0x606b('0x3f')]=_['intersection'](_0x2f9f4f[_0x606b('0x3c')],_0x2f9f4f['query']);_0x684d77['attributes']=_['intersection'](_0x2f9f4f[_0x606b('0x3c')],qs[_0x606b('0x40')](_0x588c6f['query'][_0x606b('0x40')]));_0x684d77['attributes']=_0x684d77[_0x606b('0x41')][_0x606b('0x42')]?_0x684d77[_0x606b('0x41')]:_0x2f9f4f[_0x606b('0x3c')];if(!_0x588c6f[_0x606b('0x3e')][_0x606b('0x43')](_0x606b('0x44'))){_0x684d77[_0x606b('0x24')]=qs[_0x606b('0x24')](_0x588c6f[_0x606b('0x3e')][_0x606b('0x24')]);_0x684d77[_0x606b('0x23')]=qs[_0x606b('0x23')](_0x588c6f[_0x606b('0x3e')][_0x606b('0x23')]);}_0x684d77[_0x606b('0x45')]=qs['sort'](_0x588c6f[_0x606b('0x3e')]['sort']);_0x684d77[_0x606b('0x46')]=qs[_0x606b('0x3f')](_[_0x606b('0x47')](_0x588c6f['query'],_0x2f9f4f[_0x606b('0x3f')]),_0x2ec130);var _0xd74506=[];var _0x584579=squel[_0x606b('0x48')]()[_0x606b('0x49')]('id')[_0x606b('0x49')](_0x606b('0x2d'))['field'](_0x606b('0x4a'))[_0x606b('0x4b')](_0x606b('0x4c'));var _0x2844cc=squel[_0x606b('0x48')]()[_0x606b('0x49')](_0x606b('0x4d'))[_0x606b('0x49')](_0x606b('0x4e'))['field'](_0x606b('0x4f'))['from'](_0x606b('0x50'),'ui')[_0x606b('0x51')](_0x606b('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x207d32=squel[_0x606b('0x48')]()['from'](_0x606b('0x53'),'i')[_0x606b('0x51')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x606b('0x51')](_0x606b('0x52'),'o',_0x606b('0x54'))[_0x606b('0x51')](_0x606b('0x55'),'a',_0x606b('0x56'))[_0x606b('0x51')](_0x606b('0x57'),'me',_0x606b('0x58'))[_0x606b('0x51')](_0x606b('0x59'),'it',_0x606b('0x5a'))[_0x606b('0x51')](_0x606b('0x4c'),'t','t.id\x20=\x20it.TagId');var _0x2acf3a=squel[_0x606b('0x5b')]();var _0x1057f5=[];var _0x2cdfd4=squel[_0x606b('0x5b')]();var _0x3190d4;if(_0x588c6f[_0x606b('0x3e')][_0x606b('0x5c')]){_0x3190d4=as['parseSearch'](_0x588c6f['query'][_0x606b('0x5c')]);var _0x368faa=_0x3190d4[_0x606b('0x5d')];for(var _0x4591b8=0x0;_0x4591b8<_0x3190d4[_0x606b('0x5e')][_0x606b('0x42')];_0x4591b8++){var _0x5eb39e=_0x3190d4[_0x606b('0x5e')][_0x4591b8];var _0x176b26='i';var _0x5b79b9=_['find'](_0x2ec130,[_0x606b('0x2d'),_0x5eb39e[_0x606b('0x49')]]);if(!_0x5b79b9){switch(_0x5eb39e[_0x606b('0x49')]){case _0x606b('0x5f'):if(_0x5eb39e[_0x606b('0x60')]==0x1){_0x207d32['having']('`'+_0x5eb39e[_0x606b('0x49')]+'`\x20=\x200');}else{_0x207d32[_0x606b('0x61')]('`'+_0x5eb39e[_0x606b('0x49')]+_0x606b('0x62'));}break;case'Contact':if(_0x5eb39e[_0x606b('0x63')]==='$substring'){if(_0x5eb39e['value']['split']('\x20')[_0x606b('0x42')]>0x1){_0x2acf3a[_0x368faa](_0x606b('0x64'),qs['getFullTextValue'](_0x5eb39e[_0x606b('0x60')]),null);}else{var _0x589ab9='%'+_0x5eb39e[_0x606b('0x60')]+'%';_0x2acf3a[_0x368faa]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x589ab9,_0x589ab9,_0x589ab9);}}else{_0x5b79b9=_['find'](_0x2ec130,[_0x606b('0x2d'),_0x606b('0x65')]);_0x5eb39e[_0x606b('0x49')]=_0x606b('0x65');_0x3895b1=as[_0x606b('0x66')](_0x176b26,_0x5b79b9[_0x606b('0x3a')],_0x5eb39e);_0x2acf3a[_0x368faa](_0x3895b1[_0x606b('0x67')],_0x3895b1[_0x606b('0x60')]['start'],_0x3895b1[_0x606b('0x60')][_0x606b('0x21')]);}break;case _0x606b('0x68'):var _0x56b53d=_0x5eb39e[_0x606b('0x60')][_0x606b('0x69')](',')['map'](function(_0x56f601){return Number(_0x56f601);});_0x56b53d[_0x606b('0x34')](function(_0x28f82f){_0x2cdfd4['or'](_0x606b('0x6a'),'%,'+_0x28f82f+',%');});_0x1057f5=_[_0x606b('0x6b')](_0x1057f5,_0x56b53d);break;case _0x606b('0x6c'):if(_0x5eb39e[_0x606b('0x63')]==='$substring'){_0x2acf3a[_0x368faa]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5eb39e['value']+'%',null);}else{_0x5b79b9=_[_0x606b('0x6d')](_0x2ec130,['name',_0x606b('0x6e')]);_0x5eb39e[_0x606b('0x49')]='UserId';_0x3895b1=as['buildExpression'](_0x176b26,_0x5b79b9[_0x606b('0x3a')],_0x5eb39e);_0x2acf3a[_0x368faa](_0x3895b1[_0x606b('0x67')],_0x3895b1[_0x606b('0x60')][_0x606b('0x6f')],_0x3895b1[_0x606b('0x60')][_0x606b('0x21')]);}break;case _0x606b('0x70'):_0x3895b1=as[_0x606b('0x66')]('me',null,_0x5eb39e);_0x2acf3a[_0x368faa](_0x3895b1[_0x606b('0x67')],_0x3895b1[_0x606b('0x60')]['start'],_0x3895b1[_0x606b('0x60')][_0x606b('0x21')]);break;}}else{var _0x3895b1=as[_0x606b('0x66')](_0x176b26,_0x5b79b9[_0x606b('0x3a')],_0x5eb39e);_0x2acf3a[_0x368faa](_0x3895b1[_0x606b('0x67')],_0x3895b1[_0x606b('0x60')][_0x606b('0x6f')],_0x3895b1[_0x606b('0x60')][_0x606b('0x21')]);}}}else{var _0x12ed90=_(_0x588c6f[_0x606b('0x3e')])['keys']()[_0x606b('0x30')](function(_0x5b6bd1){return _[_0x606b('0x71')](_0x2ec130,[_0x606b('0x2d'),_0x5b6bd1])?_0x5b6bd1:undefined;})[_0x606b('0x72')]()[_0x606b('0x60')]();if(!_[_0x606b('0x73')](_0x12ed90)){_0x12ed90[_0x606b('0x34')](function(_0x4490cc){if(_0x4490cc==='FaxAccountId'){_0x207d32['where'](_0x606b('0x74'),[][_0x606b('0x75')](_0x588c6f[_0x606b('0x3e')][_0x4490cc]));}else if(_0x4490cc===_0x606b('0x76')){var _0x5387d7=JSON[_0x606b('0x77')](_0x588c6f[_0x606b('0x3e')][_0x4490cc])[_0x606b('0x78')];var _0x4d5f06=JSON['parse'](_0x588c6f[_0x606b('0x3e')][_0x4490cc])[_0x606b('0x79')];_0x207d32[_0x606b('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5387d7,_0x4d5f06);}else{if(_0x588c6f[_0x606b('0x3e')][_0x4490cc]===_0x606b('0x7a')){_0x207d32['where']('i.'+_0x4490cc+_0x606b('0x7b'));}else{_0x207d32['where']('i.'+_0x4490cc+_0x606b('0x7c'),_0x588c6f[_0x606b('0x3e')][_0x4490cc]);}}});}if(_0x588c6f[_0x606b('0x3e')][_0x606b('0x7d')]){if(_0x588c6f[_0x606b('0x3e')]['read']==0x1){_0x207d32[_0x606b('0x61')](_0x606b('0x7e'));}else{_0x207d32[_0x606b('0x61')](_0x606b('0x7f'));}}if(_0x588c6f[_0x606b('0x3e')][_0x606b('0x80')]){_0x1057f5=_['isArray'](_0x588c6f[_0x606b('0x3e')][_0x606b('0x80')])?_0x588c6f[_0x606b('0x3e')][_0x606b('0x80')]:new Array(_0x588c6f[_0x606b('0x3e')][_0x606b('0x80')]);_0x1057f5[_0x606b('0x34')](function(_0x47564c){_0x2cdfd4['or'](_0x606b('0x6a'),'%,'+_0x47564c+',%');});}if(_0x588c6f['query'][_0x606b('0x81')]){var _0x91cd76=_0x588c6f['query'][_0x606b('0x81')]['replace']('\x5c','\x5c\x5c')[_0x606b('0x82')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x91cd76)){_0x2acf3a['or'](_0x606b('0x83'),_0x91cd76+'%')['or'](_0x606b('0x84'),_0x91cd76+'%');}_0x2acf3a['or'](_0x606b('0x85'),_0x91cd76+'%');}}_0x207d32[_0x606b('0x46')](_0x2acf3a);_0x207d32['group'](_0x606b('0x86'));var _0x4334da={'type':db[_0x606b('0x87')][_0x606b('0x88')][_0x606b('0x89')],'raw':!![]};var _0x5326c2=_0x207d32[_0x606b('0x8a')]();_0x5326c2[_0x606b('0x49')](_0x606b('0x86'));_0x5326c2[_0x606b('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x606b('0x5f'));if(_0x684d77[_0x606b('0x45')]){_0x684d77['order'][_0x606b('0x34')](function(_0x40774d){var _0xf0ae3a=_0x40774d[0x0]===_0x606b('0x8b')?_0x40774d[0x0]:'i.'+_0x40774d[0x0];_0x207d32[_0x606b('0x45')](_0xf0ae3a,_0x40774d[0x1]===_0x606b('0x8c')?![]:!![]);});}if(!_[_0x606b('0x73')](_0x1057f5)){_0x207d32[_0x606b('0x61')](_0x2cdfd4);_0x5326c2[_0x606b('0x46')]('t.id\x20IN\x20?',_0x1057f5);}BPromise[_0x606b('0x8d')]()[_0x606b('0x2b')](function(){if(!_0x3190d4){if(_0x588c6f[_0x606b('0x3e')][_0x606b('0x8e')])return;_0x5326c2[_0x606b('0x46')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x207d32['where'](_0x606b('0x8f'));return;}if(_0x588c6f[_0x606b('0x90')][_0x606b('0x91')]!==_0x606b('0x92'))return;return _0x588c6f[_0x606b('0x90')][_0x606b('0x93')]({'attributes':['id'],'raw':!![]})[_0x606b('0x2b')](function(_0x5dbd57){if(_[_0x606b('0x73')](_0x5dbd57)){_0x5326c2[_0x606b('0x46')]('i.FaxAccountId\x20IS\x20NULL');_0x207d32['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x5326c2[_0x606b('0x46')](_0x606b('0x74'),_[_0x606b('0x30')](_0x5dbd57,'id'));_0x207d32['where'](_0x606b('0x74'),_[_0x606b('0x30')](_0x5dbd57,'id'));}});})[_0x606b('0x2b')](function(){if(_0x588c6f[_0x606b('0x90')][_0x606b('0x91')]==='agent'&&!_0x3190d4&&!_0x588c6f[_0x606b('0x3e')]['FaxAccountId'])return[];return db[_0x606b('0x94')][_0x606b('0x3e')](_0x5326c2[_0x606b('0x95')](),_0x4334da);})[_0x606b('0x2b')](function(_0x7684da){_0x735e0[_0x606b('0x96')]=_0x7684da['length'];if(_0x735e0['count']===0x0)return[];return db[_0x606b('0x94')][_0x606b('0x3e')](_0x584579[_0x606b('0x95')](),_0x4334da)[_0x606b('0x2b')](function(_0x4a412b){_0xd74506=_['keyBy'](_0x4a412b,'id');_0x4334da=_[_0x606b('0x97')](_0x4334da,{'model':db[_0x606b('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x588c6f[_0x606b('0x3e')]['fields']){_0x684d77[_0x606b('0x41')]['forEach'](function(_0x25086b){_0x207d32[_0x606b('0x49')]('i.'+_0x25086b);});}else{_0x207d32[_0x606b('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x207d32[_0x606b('0x49')](_0x606b('0x98'),_0x606b('0x99'));_0x207d32[_0x606b('0x49')](_0x606b('0x9a'),_0x606b('0x9b'));_0x207d32[_0x606b('0x49')](_0x606b('0x9c'),_0x606b('0x8b'));_0x207d32[_0x606b('0x49')]('i.*');_0x207d32[_0x606b('0x49')]('c.firstName','Contact.firstName');_0x207d32[_0x606b('0x49')](_0x606b('0x9d'),_0x606b('0x9e'));_0x207d32[_0x606b('0x49')](_0x606b('0x9f'),'Contact.email');_0x207d32['field'](_0x606b('0xa0'),_0x606b('0xa1'));_0x207d32[_0x606b('0x49')](_0x606b('0xa2'),'Contact.mobile');_0x207d32[_0x606b('0x49')](_0x606b('0xa3'),_0x606b('0xa4'));_0x207d32[_0x606b('0x49')](_0x606b('0xa5'),'Owner.fullname');_0x207d32[_0x606b('0x49')](_0x606b('0xa6'),_0x606b('0xa7'));_0x207d32[_0x606b('0x49')](_0x606b('0xa8'),_0x606b('0x32'));}if(_0x684d77[_0x606b('0x24')])_0x207d32['limit'](_0x684d77[_0x606b('0x24')]);if(_0x684d77[_0x606b('0x23')])_0x207d32[_0x606b('0x23')](_0x684d77[_0x606b('0x23')]);return db['sequelize'][_0x606b('0x3e')](_0x207d32['toString'](),_0x4334da);})[_0x606b('0x2b')](function(_0x52f24f){_0x2844cc['where'](_0x606b('0xa9'),_['map'](_0x52f24f,'id'));return db['sequelize']['query'](_0x2844cc[_0x606b('0x95')](),_0x4334da)[_0x606b('0x2b')](function(_0x581155){var _0x1d8eb5=_[_0x606b('0xaa')](_0x581155,_0x606b('0xab'));var _0x4d6bd6=[];_0x52f24f[_0x606b('0x34')](function(_0x3b117f){_0x4d6bd6['push'](updateFaxInteraction(_0x3b117f,_0xd74506,_0x1d8eb5));});return BPromise[_0x606b('0xac')](_0x4d6bd6);});});})[_0x606b('0x2b')](function(_0x5f2460){_0x735e0[_0x606b('0xad')]=_0x5f2460;return _0x735e0;})['then'](respondWithFilteredResult(_0x470a90,_0x684d77))[_0x606b('0x36')](handleError(_0x470a90,null));};exports[_0x606b('0xae')]=function(_0xb24665,_0x2dc0df){var _0x18bbf6={'raw':![],'where':{'id':_0xb24665[_0x606b('0xaf')]['id']}},_0x21f123={};_0x21f123['model']=_['keys'](db[_0x606b('0x38')][_0x606b('0xb0')]);_0x21f123[_0x606b('0x3e')]=_['keys'](_0xb24665[_0x606b('0x3e')]);_0x21f123[_0x606b('0x3f')]=_[_0x606b('0xb1')](_0x21f123[_0x606b('0x3c')],_0x21f123[_0x606b('0x3e')]);_0x18bbf6[_0x606b('0x41')]=_[_0x606b('0xb1')](_0x21f123['model'],qs['fields'](_0xb24665['query']['fields']));_0x18bbf6[_0x606b('0x41')]=_0x18bbf6[_0x606b('0x41')][_0x606b('0x42')]?_0x18bbf6[_0x606b('0x41')]:_0x21f123[_0x606b('0x3c')];if(_0xb24665[_0x606b('0x3e')][_0x606b('0xb2')]){_0x18bbf6['include']=[{'all':!![]}];}_0x18bbf6=_[_0x606b('0x97')]({},_0x18bbf6,_0xb24665['options']);return db[_0x606b('0x38')][_0x606b('0x6d')](_0x18bbf6)[_0x606b('0x2b')](handleEntityNotFound(_0x2dc0df,null))[_0x606b('0x2b')](respondWithResult(_0x2dc0df,null))[_0x606b('0x36')](handleError(_0x2dc0df,null));};exports['create']=function(_0x39e55e,_0x2ec5e7){return db[_0x606b('0x38')][_0x606b('0xb3')](_0x39e55e[_0x606b('0x70')],{})[_0x606b('0x2b')](respondWithResult(_0x2ec5e7,0xc9))[_0x606b('0x36')](handleError(_0x2ec5e7,null));};exports[_0x606b('0x29')]=function(_0x1a9911,_0x4b1fd2){if(_0x1a9911[_0x606b('0x70')]['id']){delete _0x1a9911['body']['id'];}return db[_0x606b('0x38')][_0x606b('0x6d')]({'where':{'id':_0x1a9911[_0x606b('0xaf')]['id']}})['then'](handleEntityNotFound(_0x4b1fd2,null))[_0x606b('0x2b')](saveUpdates(_0x1a9911[_0x606b('0x70')],null))['then'](respondWithResult(_0x4b1fd2,null))[_0x606b('0x36')](handleError(_0x4b1fd2,null));};exports['destroy']=function(_0x324252,_0x31bc44){return db[_0x606b('0x38')][_0x606b('0x6d')]({'where':{'id':_0x324252[_0x606b('0xaf')]['id']}})['then'](handleEntityNotFound(_0x31bc44,null))[_0x606b('0x2b')](removeEntity(_0x31bc44,null))['catch'](handleError(_0x31bc44,null));};exports[_0x606b('0xb4')]=function(_0x43cffb,_0x3e7b6e){return db[_0x606b('0x38')][_0x606b('0xb4')]()['then'](respondWithResult(_0x3e7b6e,null))[_0x606b('0x36')](handleError(_0x3e7b6e,null));};exports[_0x606b('0xb5')]=function(_0x16ec24,_0x2efe30,_0x482c09){return db[_0x606b('0xb6')]['find']({'where':{'id':_0x16ec24['params']['id']}})['then'](handleEntityNotFound(_0x2efe30,null))[_0x606b('0x2b')](function(_0x5d15de){if(_0x5d15de){return _0x5d15de[_0x606b('0xb5')](_0x16ec24[_0x606b('0x70')][_0x606b('0xb7')],_['omit'](_0x16ec24[_0x606b('0x70')],['ids','id'])||{});}})['then'](respondWithResult(_0x2efe30,null))[_0x606b('0x36')](handleError(_0x2efe30,null));};exports[_0x606b('0xb8')]=function(_0xea1609,_0x1214c5,_0x5f0ebe){var _0x4495e5={'raw':![],'where':{}};var _0x5afd39={};var _0x497691={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x606b('0xb9')]({'where':{'id':_0xea1609[_0x606b('0xaf')]['id']}})[_0x606b('0x2b')](handleEntityNotFound(_0x1214c5,null))[_0x606b('0x2b')](function(_0x2f2d9b){if(_0x2f2d9b){_0x5afd39['model']=_[_0x606b('0x3d')](db[_0x606b('0xb6')][_0x606b('0xb0')]);_0x5afd39['query']=_[_0x606b('0x3d')](_0xea1609[_0x606b('0x3e')]);_0x5afd39[_0x606b('0x3f')]=_[_0x606b('0xb1')](_0x5afd39['model'],_0x5afd39['query']);_0x4495e5[_0x606b('0x41')]=_[_0x606b('0xb1')](_0x5afd39[_0x606b('0x3c')],qs['fields'](_0xea1609[_0x606b('0x3e')][_0x606b('0x40')]));_0x4495e5[_0x606b('0x41')]=_0x4495e5[_0x606b('0x41')][_0x606b('0x42')]?_0x4495e5[_0x606b('0x41')]:_0x5afd39['model'];if(!_0xea1609[_0x606b('0x3e')][_0x606b('0x43')]('nolimit')){_0x4495e5[_0x606b('0x24')]=qs[_0x606b('0x24')](_0xea1609[_0x606b('0x3e')]['limit']);_0x4495e5[_0x606b('0x23')]=qs[_0x606b('0x23')](_0xea1609[_0x606b('0x3e')]['offset']);}_0x4495e5[_0x606b('0x45')]=qs['sort'](_0xea1609['query'][_0x606b('0xba')]);_0x4495e5[_0x606b('0x46')]=qs[_0x606b('0x3f')](_['pick'](_0xea1609['query'],_0x5afd39['filters']));_0x4495e5[_0x606b('0x46')][_0x606b('0xab')]=_0x2f2d9b['id'];if(_0xea1609[_0x606b('0x3e')]['filter']){_0x4495e5[_0x606b('0x46')]=_['merge'](_0x4495e5[_0x606b('0x46')],{'$or':_[_0x606b('0x30')](_0x4495e5['attributes'],function(_0x1fcc40){var _0x227eb2={};_0x227eb2[_0x1fcc40]={'$like':'%'+_0xea1609[_0x606b('0x3e')][_0x606b('0x81')]+'%'};return _0x227eb2;})});}if(_0xea1609['query'][_0x606b('0x78')]){var _0x463c20=_0xea1609[_0x606b('0x3e')]['$gte'][_0x606b('0x69')](',');var _0x4e096b={};_0x4e096b[_0x463c20[0x0]]={'$gte':moment(_0x463c20[0x1])[_0x606b('0xbb')](_0x606b('0xbc'))};_0x4495e5['where']=_[_0x606b('0x97')](_0x4495e5[_0x606b('0x46')],_0x4e096b);}_0x4495e5=_[_0x606b('0x97')]({},_0x4495e5,_0xea1609[_0x606b('0xbd')]);return db[_0x606b('0xb6')][_0x606b('0x96')]({'where':_0x4495e5[_0x606b('0x46')]})[_0x606b('0x2b')](function(_0x593e0e){_0x497691[_0x606b('0x96')]=_0x593e0e;if(_0xea1609['query'][_0x606b('0xb2')]){_0x4495e5['include']=[{'all':!![]}];}return db[_0x606b('0xb6')][_0x606b('0xbe')](_0x4495e5);})[_0x606b('0x2b')](function(_0xf9b321){_0x497691[_0x606b('0xad')]=_0xf9b321;return _0x497691;});}})[_0x606b('0x2b')](respondWithFilteredResult(_0x1214c5,_0x4495e5))['catch'](handleError(_0x1214c5,null));};exports[_0x606b('0xbf')]=function(_0x47cd4b,_0x2ed2dc,_0x4e0e60){return db[_0x606b('0x38')][_0x606b('0x6d')]({'where':{'id':_0x47cd4b[_0x606b('0xaf')]['id']}})[_0x606b('0x2b')](handleEntityNotFound(_0x2ed2dc,null))[_0x606b('0x2b')](function(_0x5d4564){if(_0x5d4564){return _0x5d4564[_0x606b('0xc0')](_0x47cd4b['body']['ids'],_[_0x606b('0xc1')](_0x47cd4b[_0x606b('0x70')],['ids','id'])||{})['spread'](function(){return db[_0x606b('0x68')]['findAll']({'attributes':['id',_0x606b('0x2d'),_0x606b('0x4a')],'where':{'id':_0x47cd4b[_0x606b('0x70')][_0x606b('0xb7')]}});})[_0x606b('0x2b')](function(_0x3ff09b){socket['emit'](_0x606b('0xc2'),{'id':Number(_0x47cd4b[_0x606b('0xaf')]['id']),'tags':_0x3ff09b||[]});return{'id':Number(_0x47cd4b[_0x606b('0xaf')]['id']),'tags':_0x3ff09b||[]};});}})[_0x606b('0x2b')](respondWithResult(_0x2ed2dc,null))[_0x606b('0x36')](handleError(_0x2ed2dc,null));};exports[_0x606b('0xc3')]=function(_0x9e333c,_0x90b5c4,_0x14fe09){return db[_0x606b('0x38')][_0x606b('0x6d')]({'where':{'id':_0x9e333c[_0x606b('0xaf')]['id']}})[_0x606b('0x2b')](handleEntityNotFound(_0x90b5c4,null))[_0x606b('0x2b')](function(_0x26cbb8){if(_0x26cbb8){return _0x26cbb8[_0x606b('0xc3')](_0x9e333c[_0x606b('0x3e')][_0x606b('0xb7')]);}})[_0x606b('0x2b')](respondWithStatusCode(_0x90b5c4,null))[_0x606b('0x36')](handleError(_0x90b5c4,null));};exports['download']=function(_0x14fb4c,_0x4eaff1){var _0x2d165d=moment()['unix']()[_0x606b('0x95')]();var _0x458d63=path[_0x606b('0xc4')](config[_0x606b('0xc5')],_0x606b('0xc6'),_0x606b('0xc7'),_0x606b('0xc8'));var _0x2a961c=path['join'](config[_0x606b('0xc5')],'server',_0x606b('0xc7'),'attachments');var _0x379ced=path['join'](_0x458d63,_0x2d165d);var _0x4ad5dc=util[_0x606b('0xbb')](_0x606b('0xc9'),_0x14fb4c['params']['id'],_0x2d165d);var _0x4d0818=path[_0x606b('0xc4')](_0x458d63,_0x4ad5dc);var _0x18efea=[];_0x18efea[_0x606b('0x35')]({'model':db[_0x606b('0xca')],'as':_0x606b('0xca'),'raw':!![]});var _0x27fd04=[{'model':db['FaxMessage'],'as':_0x606b('0xcb'),'attributes':['id','body',_0x606b('0x76')],'include':_0x18efea}];return db[_0x606b('0x38')][_0x606b('0x6d')]({'where':{'id':_0x14fb4c[_0x606b('0xaf')]['id']},'include':_0x27fd04})[_0x606b('0x2b')](handleEntityNotFound(_0x4eaff1,null))[_0x606b('0x2b')](function(_0x4c1ef8){if(_0x4c1ef8&&_0x4c1ef8[_0x606b('0xcb')]){var _0x391c83=_0x4c1ef8['get']({'plain':!![]});fs[_0x606b('0xcc')](_0x379ced);for(var _0x32a1ae=0x0;_0x32a1ae<_0x391c83['Messages'][_0x606b('0x42')];_0x32a1ae++){var _0x36af56=_0x391c83[_0x606b('0xcb')][_0x32a1ae][_0x606b('0xca')];if(_0x36af56){var _0x2a95d6=path[_0x606b('0xc4')](_0x2a961c,_0x36af56[_0x606b('0xcd')]);if(fs[_0x606b('0xce')](_0x2a95d6)){fs[_0x606b('0xcf')](_0x2a95d6)[_0x606b('0xd0')](fs['createWriteStream'](path['join'](_0x379ced,_0x36af56['basename'])));}}}return BPromise[_0x606b('0x8d')]()[_0x606b('0x2b')](function(){return new BPromise(function(_0x47b8c8,_0x1f3dd5){zipdir(_0x379ced,{'saveTo':_0x4d0818},function(_0x3d2aff,_0x11d79e){if(_0x3d2aff)return _0x1f3dd5(_0x3d2aff);return _0x47b8c8(_0x11d79e);});})[_0x606b('0x2b')](function(){return new BPromise(function(_0x767afe,_0x54835d){rimraf(_0x379ced,function(_0xa65d){if(_0xa65d)_0x54835d(_0xa65d);return _0x767afe();});});})[_0x606b('0x2b')](function(){return _0x4eaff1[_0x606b('0xd1')](_0x4d0818,_0x4ad5dc,function(_0x3e04a6){if(_0x3e04a6){console[_0x606b('0xd2')](_0x606b('0xd3'),_0x3e04a6);}else{fs[_0x606b('0xd4')](_0x4d0818);}});});});}else{return _0x4eaff1['sendStatus'](0xc8);}})['catch'](handleError(_0x4eaff1,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 11624eb..4b22638 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 _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0xe42b45,_0xfdb256){var _0x12ae2a=function(_0x8273ee){while(--_0x8273ee){_0xe42b45['push'](_0xe42b45['shift']());}};_0x12ae2a(++_0xfdb256);}(_0x1261,0x144));var _0x1126=function(_0x33e982,_0x1d15b1){_0x33e982=_0x33e982-0x0;var _0x2d3668=_0x1261[_0x33e982];return _0x2d3668;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x40b8ce,_0x5d16d9){var _0x399970=function(_0xd02861){while(--_0xd02861){_0x40b8ce['push'](_0x40b8ce['shift']());}};_0x399970(++_0x5d16d9);}(_0xadb5,0xad));var _0x5adb=function(_0x3c5f3c,_0x35884e){_0x3c5f3c=_0x3c5f3c-0x0;var _0x50fc52=_0xadb5[_0x3c5f3c];return _0x50fc52;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x5adb('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return FaxMessage[_0x5adb('0xa')]({'where':{'FaxInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);FaxInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);FaxInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index e9531ca..e4be3c7 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 _0xc008=['bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x326407,_0x2c9181){var _0x1b69f1=function(_0x4f8fa3){while(--_0x4f8fa3){_0x326407['push'](_0x326407['shift']());}};_0x1b69f1(++_0x2c9181);}(_0xc008,0x18b));var _0x8c00=function(_0x570f5d,_0x48cda3){_0x570f5d=_0x570f5d-0x0;var _0x1c93ee=_0xc008[_0x570f5d];return _0x1c93ee;};'use strict';var _=require(_0x8c00('0x0'));var util=require(_0x8c00('0x1'));var logger=require(_0x8c00('0x2'))(_0x8c00('0x3'));var moment=require(_0x8c00('0x4'));var BPromise=require(_0x8c00('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c00('0x6'));var rimraf=require(_0x8c00('0x7'));var config=require(_0x8c00('0x8'));var attributes=require(_0x8c00('0x9'));module[_0x8c00('0xa')]=function(_0x2c201a,_0x134f54){return _0x2c201a[_0x8c00('0xb')](_0x8c00('0xc'),attributes,{'tableName':_0x8c00('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4aa303,_0x3abd71,_0x1e3aec){if(_0x4aa303['changed']('closed')){_0x4aa303['closedAt']=moment()[_0x8c00('0xe')](_0x8c00('0xf'));}_0x1e3aec(null,_0x4aa303);}}});}; \ No newline at end of file +var _0xca79=['FaxInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x47d606,_0x4fa6b6){var _0x1520be=function(_0x4b92fc){while(--_0x4b92fc){_0x47d606['push'](_0x47d606['shift']());}};_0x1520be(++_0x4fa6b6);}(_0xca79,0xfb));var _0x9ca7=function(_0x1fa571,_0x147b60){_0x1fa571=_0x1fa571-0x0;var _0x5374ba=_0xca79[_0x1fa571];return _0x5374ba;};'use strict';var _=require('lodash');var util=require(_0x9ca7('0x0'));var logger=require('../../config/logger')(_0x9ca7('0x1'));var moment=require('moment');var BPromise=require(_0x9ca7('0x2'));var rp=require(_0x9ca7('0x3'));var fs=require('fs');var path=require(_0x9ca7('0x4'));var rimraf=require(_0x9ca7('0x5'));var config=require(_0x9ca7('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x9ca7('0x7')]=function(_0x2759d0,_0x1ca110){return _0x2759d0[_0x9ca7('0x8')](_0x9ca7('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d514b,_0x337b26,_0x381414){if(_0x2d514b[_0x9ca7('0xa')]('closed')){_0x2d514b['closedAt']=moment()[_0x9ca7('0xb')](_0x9ca7('0xc'));}_0x381414(null,_0x2d514b);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 4f5f9dc..f3c1552 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 _0xaa8c=['omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','attributes','limit','AddTagsToFaxInteraction','find','where','addTags','body','ids'];(function(_0x5bdf8e,_0x45d970){var _0x3e0750=function(_0x41298b){while(--_0x41298b){_0x5bdf8e['push'](_0x5bdf8e['shift']());}};_0x3e0750(++_0x45d970);}(_0xaa8c,0xea));var _0xcaa8=function(_0x4baa18,_0xc613b2){_0x4baa18=_0x4baa18-0x0;var _0x3912cc=_0xaa8c[_0x4baa18];return _0x3912cc;};'use strict';var _=require(_0xcaa8('0x0'));var util=require(_0xcaa8('0x1'));var moment=require(_0xcaa8('0x2'));var BPromise=require(_0xcaa8('0x3'));var rs=require(_0xcaa8('0x4'));var fs=require('fs');var Redis=require(_0xcaa8('0x5'));var db=require(_0xcaa8('0x6'))['db'];var utils=require(_0xcaa8('0x7'));var logger=require(_0xcaa8('0x8'))(_0xcaa8('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcaa8('0xa')][_0xcaa8('0xb')]({'port':0x232a});config[_0xcaa8('0xc')]=_[_0xcaa8('0xd')](config[_0xcaa8('0xc')],{'host':_0xcaa8('0xe'),'port':0x18eb});var socket=require(_0xcaa8('0xf'))(new Redis(config[_0xcaa8('0xc')]));require(_0xcaa8('0x10'))[_0xcaa8('0x11')](socket);function respondWithRpcPromise(_0x7db0d4,_0x477d49,_0x319839){return new BPromise(function(_0x57fd74,_0x3b380f){return client[_0xcaa8('0x12')](_0x7db0d4,_0x319839)[_0xcaa8('0x13')](function(_0x3156ea){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x477d49,_0xcaa8('0x14'));logger['debug'](_0xcaa8('0x15'),_0x477d49,_0xcaa8('0x14'),JSON[_0xcaa8('0x16')](_0x3156ea));if(_0x3156ea['error']){if(_0x3156ea[_0xcaa8('0x17')][_0xcaa8('0x18')]===0x1f4){logger[_0xcaa8('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x477d49,_0x3156ea[_0xcaa8('0x17')][_0xcaa8('0x19')]);return _0x3b380f(_0x3156ea['error']['message']);}logger[_0xcaa8('0x17')](_0xcaa8('0x1a'),_0x477d49,_0x3156ea[_0xcaa8('0x17')][_0xcaa8('0x19')]);return _0x57fd74(_0x3156ea['error'][_0xcaa8('0x19')]);}else{logger[_0xcaa8('0x1b')](_0xcaa8('0x1a'),_0x477d49,_0xcaa8('0x14'));_0x57fd74(_0x3156ea[_0xcaa8('0x1c')][_0xcaa8('0x19')]);}})[_0xcaa8('0x1d')](function(_0x413fe7){logger[_0xcaa8('0x17')](_0xcaa8('0x1a'),_0x477d49,_0x413fe7);_0x3b380f(_0x413fe7);});});}exports[_0xcaa8('0x1e')]=function(_0x4134a7){var _0x5a4872=this;return new Promise(function(_0x192da7,_0x55cd45){return db[_0xcaa8('0x1f')][_0xcaa8('0x20')](_0x4134a7['body'],{'raw':_0x4134a7['options']?_0x4134a7[_0xcaa8('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4134a7[_0xcaa8('0x21')]?_0x4134a7[_0xcaa8('0x21')]['where']||null:null,'attributes':_0x4134a7['options']?_0x4134a7['options'][_0xcaa8('0x22')]||null:null,'limit':_0x4134a7['options']?_0x4134a7[_0xcaa8('0x21')][_0xcaa8('0x23')]||null:null})[_0xcaa8('0x13')](function(_0xc0340d){logger[_0xcaa8('0x1b')](_0xcaa8('0x1e'),_0x4134a7);logger['debug'](_0xcaa8('0x1e'),_0x4134a7,JSON[_0xcaa8('0x16')](_0xc0340d));_0x192da7(_0xc0340d);})[_0xcaa8('0x1d')](function(_0x4f0c9d){logger['error'](_0xcaa8('0x1e'),_0x4f0c9d[_0xcaa8('0x19')],_0x4134a7);_0x55cd45(_0x5a4872[_0xcaa8('0x17')](0x1f4,_0x4f0c9d['message']));});});};exports[_0xcaa8('0x24')]=function(_0x1f5e3e){return new Promise(function(_0xacace4,_0xc6d5e6){return db[_0xcaa8('0x1f')][_0xcaa8('0x25')]({'where':_0x1f5e3e[_0xcaa8('0x21')]?_0x1f5e3e[_0xcaa8('0x21')][_0xcaa8('0x26')]||null:null})[_0xcaa8('0x13')](function(_0xee97d2){if(_0xee97d2){return _0xee97d2[_0xcaa8('0x27')](_0x1f5e3e[_0xcaa8('0x28')][_0xcaa8('0x29')],_[_0xcaa8('0x2a')](_0x1f5e3e[_0xcaa8('0x28')],[_0xcaa8('0x29'),'id'])||{});}})[_0xcaa8('0x2b')](function(_0x5ba818){logger[_0xcaa8('0x1b')](_0xcaa8('0x2c'),_0x1f5e3e);logger[_0xcaa8('0x2d')](_0xcaa8('0x2c'),_0x1f5e3e,JSON[_0xcaa8('0x16')](_0x5ba818));_0xacace4(_0x5ba818);})[_0xcaa8('0x1d')](function(_0x50da56){logger[_0xcaa8('0x17')](_0xcaa8('0x2c'),_0x50da56[_0xcaa8('0x19')],_0x1f5e3e);_0xc6d5e6(_this['error'](0x1f4,_0x50da56[_0xcaa8('0x19')]));});});}; \ No newline at end of file +var _0xd36e=['limit','debug','AddTagsToFaxInteraction','find','where','addTags','ids','omit','body','spread','AddTags','util','moment','bluebird','randomstring','rpc','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','attributes'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd36e,0x14b));var _0xed36=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd36e[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xed36('0x0'));var moment=require(_0xed36('0x1'));var BPromise=require(_0xed36('0x2'));var rs=require(_0xed36('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xed36('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed36('0x5')][_0xed36('0x6')]({'port':0x232a});config[_0xed36('0x7')]=_[_0xed36('0x8')](config[_0xed36('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xed36('0x9'))(new Redis(config[_0xed36('0x7')]));require(_0xed36('0xa'))['register'](socket);function respondWithRpcPromise(_0x43f04d,_0x17408b,_0x2f509e){return new BPromise(function(_0x5bc435,_0xeb9ad9){return client[_0xed36('0xb')](_0x43f04d,_0x2f509e)[_0xed36('0xc')](function(_0x570c05){logger[_0xed36('0xd')](_0xed36('0xe'),_0x17408b,_0xed36('0xf'));logger['debug'](_0xed36('0x10'),_0x17408b,_0xed36('0xf'),JSON[_0xed36('0x11')](_0x570c05));if(_0x570c05[_0xed36('0x12')]){if(_0x570c05['error'][_0xed36('0x13')]===0x1f4){logger[_0xed36('0x12')](_0xed36('0xe'),_0x17408b,_0x570c05['error'][_0xed36('0x14')]);return _0xeb9ad9(_0x570c05[_0xed36('0x12')][_0xed36('0x14')]);}logger['error'](_0xed36('0xe'),_0x17408b,_0x570c05[_0xed36('0x12')][_0xed36('0x14')]);return _0x5bc435(_0x570c05[_0xed36('0x12')][_0xed36('0x14')]);}else{logger['info'](_0xed36('0xe'),_0x17408b,'request\x20sent');_0x5bc435(_0x570c05[_0xed36('0x15')][_0xed36('0x14')]);}})[_0xed36('0x16')](function(_0x1db9fb){logger['error'](_0xed36('0xe'),_0x17408b,_0x1db9fb);_0xeb9ad9(_0x1db9fb);});});}exports[_0xed36('0x17')]=function(_0x7657f6){var _0x3ba55f=this;return new Promise(function(_0x3dfbd3,_0x3ad10b){return db[_0xed36('0x18')][_0xed36('0x19')](_0x7657f6['body'],{'raw':_0x7657f6[_0xed36('0x1a')]?_0x7657f6['options'][_0xed36('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7657f6[_0xed36('0x1a')]?_0x7657f6[_0xed36('0x1a')]['where']||null:null,'attributes':_0x7657f6[_0xed36('0x1a')]?_0x7657f6[_0xed36('0x1a')][_0xed36('0x1c')]||null:null,'limit':_0x7657f6[_0xed36('0x1a')]?_0x7657f6[_0xed36('0x1a')][_0xed36('0x1d')]||null:null})[_0xed36('0xc')](function(_0x6958af){logger[_0xed36('0xd')](_0xed36('0x17'),_0x7657f6);logger[_0xed36('0x1e')](_0xed36('0x17'),_0x7657f6,JSON[_0xed36('0x11')](_0x6958af));_0x3dfbd3(_0x6958af);})[_0xed36('0x16')](function(_0xd1486f){logger[_0xed36('0x12')](_0xed36('0x17'),_0xd1486f[_0xed36('0x14')],_0x7657f6);_0x3ad10b(_0x3ba55f['error'](0x1f4,_0xd1486f['message']));});});};exports[_0xed36('0x1f')]=function(_0x336928){return new Promise(function(_0x5e8e70,_0x45e720){return db[_0xed36('0x18')][_0xed36('0x20')]({'where':_0x336928['options']?_0x336928[_0xed36('0x1a')][_0xed36('0x21')]||null:null})[_0xed36('0xc')](function(_0x4814dc){if(_0x4814dc){return _0x4814dc[_0xed36('0x22')](_0x336928['body'][_0xed36('0x23')],_[_0xed36('0x24')](_0x336928[_0xed36('0x25')],[_0xed36('0x23'),'id'])||{});}})[_0xed36('0x26')](function(_0x2944fb){logger[_0xed36('0xd')](_0xed36('0x27'),_0x336928);logger[_0xed36('0x1e')](_0xed36('0x27'),_0x336928,JSON[_0xed36('0x11')](_0x2944fb));_0x5e8e70(_0x2944fb);})[_0xed36('0x16')](function(_0x58790e){logger[_0xed36('0x12')](_0xed36('0x27'),_0x58790e[_0xed36('0x14')],_0x336928);_0x45e720(_this[_0xed36('0x12')](0x1f4,_0x58790e['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 8d5dfe5..3b13c89 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 _0xc46d=['emit','register','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x310ee0,_0x1c5d46){var _0x2aae43=function(_0x15dabd){while(--_0x15dabd){_0x310ee0['push'](_0x310ee0['shift']());}};_0x2aae43(++_0x1c5d46);}(_0xc46d,0x7c));var _0xdc46=function(_0x226b9c,_0x30edc1){_0x226b9c=_0x226b9c-0x0;var _0x46b29c=_0xc46d[_0x226b9c];return _0x46b29c;};'use strict';var FaxInteractionEvents=require(_0xdc46('0x0'));var events=[_0xdc46('0x1'),_0xdc46('0x2'),_0xdc46('0x3')];function createListener(_0x5ad063,_0x5c4c5d){return function(_0xa9524){_0x5c4c5d[_0xdc46('0x4')](_0x5ad063,_0xa9524);};}function removeListener(_0x417822,_0x468d61){return function(){FaxInteractionEvents['removeListener'](_0x417822,_0x468d61);};}exports[_0xdc46('0x5')]=function(_0x40d430){for(var _0x22789a=0x0,_0x3fdeb9=events[_0xdc46('0x6')];_0x22789a<_0x3fdeb9;_0x22789a++){var _0x12cadf=events[_0x22789a];var _0x57d3bd=createListener(_0xdc46('0x7')+_0x12cadf,_0x40d430);FaxInteractionEvents['on'](_0x12cadf,_0x57d3bd);}}; \ No newline at end of file +var _0xdd2f=['update','removeListener','register','length','faxInteraction:','remove'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xdd2f,0xa7));var _0xfdd2=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xdd2f[_0x15bc81];return _0x59440e;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0xfdd2('0x0'),_0xfdd2('0x1')];function createListener(_0x923124,_0x3f52e2){return function(_0x24cefb){_0x3f52e2['emit'](_0x923124,_0x24cefb);};}function removeListener(_0x2296ae,_0x2c69f7){return function(){FaxInteractionEvents[_0xfdd2('0x2')](_0x2296ae,_0x2c69f7);};}exports[_0xfdd2('0x3')]=function(_0x233576){for(var _0x509148=0x0,_0x33eea2=events[_0xfdd2('0x4')];_0x509148<_0x33eea2;_0x509148++){var _0x2187d6=events[_0x509148];var _0x358a3c=createListener(_0xfdd2('0x5')+_0x2187d6,_0x233576);FaxInteractionEvents['on'](_0x2187d6,_0x358a3c);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9e4900d..5930949 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 _0x750a=['addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','/:id','faxinteraction:update','update','faxinteraction:destroy','delete','removeTags','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','download','create'];(function(_0x470440,_0x40b053){var _0x1462ac=function(_0x1bf4bf){while(--_0x1bf4bf){_0x470440['push'](_0x470440['shift']());}};_0x1462ac(++_0x40b053);}(_0x750a,0x140));var _0xa750=function(_0x5f21a1,_0x4609b4){_0x5f21a1=_0x5f21a1-0x0;var _0x453588=_0x750a[_0x5f21a1];return _0x453588;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var auth=require(_0xa750('0x3'));var interaction=require(_0xa750('0x4'));var config=require(_0xa750('0x5'));var controller=require(_0xa750('0x6'));router[_0xa750('0x7')]('/',auth[_0xa750('0x8')](),controller[_0xa750('0x9')]);router[_0xa750('0x7')](_0xa750('0xa'),auth[_0xa750('0x8')](),controller[_0xa750('0xb')]);router['get']('/:id',auth[_0xa750('0x8')](),controller['show']);router[_0xa750('0x7')](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xa750('0xe')]);router['post']('/',auth[_0xa750('0x8')](),controller[_0xa750('0xf')]);router['post'](_0xa750('0xc'),auth[_0xa750('0x8')](),controller[_0xa750('0x10')]);router['post'](_0xa750('0x11'),auth[_0xa750('0x8')](),interaction[_0xa750('0x12')](_0xa750('0x13'),_0xa750('0x14')),controller[_0xa750('0x15')]);router['put'](_0xa750('0x16'),auth[_0xa750('0x8')](),interaction[_0xa750('0x12')]('fax',_0xa750('0x17')),controller[_0xa750('0x18')]);router['delete']('/:id',auth[_0xa750('0x8')](),interaction['tracked'](_0xa750('0x13'),_0xa750('0x19')),controller['destroy']);router[_0xa750('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa750('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xe706=['destroy','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','faxinteraction:addtags','fax','update','delete','tracked','faxinteraction:destroy'];(function(_0x4500c5,_0x3326b8){var _0x302094=function(_0x484d1c){while(--_0x484d1c){_0x4500c5['push'](_0x4500c5['shift']());}};_0x302094(++_0x3326b8);}(_0xe706,0xa3));var _0x6e70=function(_0x50f382,_0x32473c){_0x50f382=_0x50f382-0x0;var _0x16afda=_0xe706[_0x50f382];return _0x16afda;};'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('0x9')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller['download']);router['post']('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router[_0x6e70('0x14')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x14')](_0x6e70('0x16'),auth['isAuthenticated'](),interaction['tracked']('fax',_0x6e70('0x17')),controller['addTags']);router['put'](_0x6e70('0xe'),auth[_0x6e70('0xa')](),interaction['tracked'](_0x6e70('0x18'),'faxinteraction:update'),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x6e70('0x1b')]('fax',_0x6e70('0x1c')),controller[_0x6e70('0x1d')]);router['delete']('/:id/tags',auth[_0x6e70('0xa')](),controller[_0x6e70('0x1e')]);module[_0x6e70('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index f33a2fd..c43d8b3 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 _0x199f=['out','DATE','TEXT','BOOLEAN','ENUM'];(function(_0x455d7a,_0x180f36){var _0xb494b=function(_0x1da346){while(--_0x1da346){_0x455d7a['push'](_0x455d7a['shift']());}};_0xb494b(++_0x180f36);}(_0x199f,0x1b5));var _0xf199=function(_0x3abe6a,_0xdd7b1a){_0x3abe6a=_0x3abe6a-0x0;var _0x2fc39e=_0x199f[_0x3abe6a];return _0x2fc39e;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xf199('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf199('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf199('0x2')]('in',_0xf199('0x3')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xf199('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0xf199('0x4')]}}; \ No newline at end of file +var _0x2b99=['sequelize','TEXT','out','DATE'];(function(_0x3a5648,_0x58054e){var _0x34126d=function(_0x3a6476){while(--_0x3a6476){_0x3a5648['push'](_0x3a5648['shift']());}};_0x34126d(++_0x58054e);}(_0x2b99,0x12c));var _0x92b9=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x2b99[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0x92b9('0x0'));module['exports']={'body':{'type':Sequelize[_0x92b9('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x92b9('0x2')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x92b9('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x92b9('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 827eb0d..f45c8c4 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 _0xbaf0=['AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','create','findOne','ContactId','Attachment','AttachmentId','SendFax','FaxAccountId','isNil','join','root','server','files','attachments','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','redis','defaults','localhost','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','stack','name','send','map','FaxMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','find','body','destroy','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','UserId','Contact','get','FaxInteraction','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null'];(function(_0xb0d9d1,_0x43008a){var _0x270bd4=function(_0x16724b){while(--_0x16724b){_0xb0d9d1['push'](_0xb0d9d1['shift']());}};_0x270bd4(++_0x43008a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0baf('0x0'));var rimraf=require(_0x0baf('0x1'));var zipdir=require(_0x0baf('0x2'));var jsonpatch=require(_0x0baf('0x3'));var rp=require(_0x0baf('0x4'));var moment=require(_0x0baf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0baf('0x6'));var util=require(_0x0baf('0x7'));var path=require(_0x0baf('0x8'));var sox=require(_0x0baf('0x9'));var csv=require(_0x0baf('0xa'));var ejs=require(_0x0baf('0xb'));var fs=require('fs');var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0baf('0x1b')]=_[_0x0baf('0x1c')](config[_0x0baf('0x1b')],{'host':_0x0baf('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0baf('0x1b')]));require('./faxMessage.socket')[_0x0baf('0x1e')](socket);var jayson=require(_0x0baf('0x1f'));var client=jayson[_0x0baf('0x20')][_0x0baf('0x21')]({'port':0x232c});var client9002=jayson[_0x0baf('0x20')][_0x0baf('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4f80a8,_0x4cd79d,_0x2312c7,_0x38395b){return new BPromise(function(_0x283408,_0x3d83a3){var _0x2cf7da=_0x38395b||client;return _0x2cf7da[_0x0baf('0x22')](_0x4f80a8,_0x2312c7)['then'](function(_0x63c820){logger[_0x0baf('0x23')](_0x0baf('0x24'),_0x4cd79d,_0x0baf('0x25'));logger[_0x0baf('0x26')](_0x0baf('0x27'),_0x4cd79d,'request\x20sent',JSON['stringify'](_0x63c820));if(_0x63c820[_0x0baf('0x28')]){if(_0x63c820[_0x0baf('0x28')][_0x0baf('0x29')]===0x1f4){logger[_0x0baf('0x28')](_0x0baf('0x24'),_0x4cd79d,_0x63c820[_0x0baf('0x28')][_0x0baf('0x2a')]);return _0x3d83a3(_0x63c820[_0x0baf('0x28')][_0x0baf('0x2a')]);}logger[_0x0baf('0x28')]('FaxMessage,\x20%s,\x20%s',_0x4cd79d,_0x63c820[_0x0baf('0x28')]['message']);return _0x283408(_0x63c820[_0x0baf('0x28')]['message']);}else{logger['info'](_0x0baf('0x24'),_0x4cd79d,'request\x20sent');_0x283408(_0x63c820['result'][_0x0baf('0x2a')]);}})[_0x0baf('0x2b')](function(_0x34e264){logger[_0x0baf('0x28')](_0x0baf('0x24'),_0x4cd79d,_0x34e264);_0x3d83a3(_0x34e264);});});}function respondWithStatusCode(_0x56b299,_0x448617){_0x448617=_0x448617||0xcc;return function(_0x4681c5){if(_0x4681c5){return _0x56b299[_0x0baf('0x2c')](_0x448617);}return _0x56b299[_0x0baf('0x2d')](_0x448617)[_0x0baf('0x2e')]();};}function respondWithResult(_0x3b9b31,_0x453525){_0x453525=_0x453525||0xc8;return function(_0x549fd0){if(_0x549fd0){return _0x3b9b31[_0x0baf('0x2d')](_0x453525)[_0x0baf('0x2f')](_0x549fd0);}};}function respondWithFilteredResult(_0xcaf13d,_0x265915){return function(_0x55c715){if(_0x55c715){var _0x29dbdf=_0x55c715[_0x0baf('0x30')],_0x34a58a=_0x265915[_0x0baf('0x31')],_0x5d9d7f=_0x265915[_0x0baf('0x31')]+_0x265915[_0x0baf('0x32')],_0x44ec31;if(_0x5d9d7f>=_0x29dbdf){_0x5d9d7f=_0x29dbdf;_0x44ec31=0xc8;}else{_0x44ec31=0xce;}_0xcaf13d[_0x0baf('0x2d')](_0x44ec31);return _0xcaf13d[_0x0baf('0x33')]('Content-Range',_0x34a58a+'-'+_0x5d9d7f+'/'+_0x29dbdf)[_0x0baf('0x2f')](_0x55c715);}return null;};}function patchUpdates(_0x156ed7){return function(_0x37be4e){try{jsonpatch[_0x0baf('0x34')](_0x37be4e,_0x156ed7,!![]);}catch(_0x24ecee){return BPromise[_0x0baf('0x35')](_0x24ecee);}return _0x37be4e[_0x0baf('0x36')]();};}function saveUpdates(_0x2f0a45,_0x59431b){return function(_0x3ded64){if(_0x3ded64){return _0x3ded64[_0x0baf('0x37')](_0x2f0a45)[_0x0baf('0x38')](function(_0x45294a){return _0x45294a;});}return null;};}function removeEntity(_0x3a3353,_0x57a6bb){return function(_0x2fd426){if(_0x2fd426){return _0x2fd426['destroy']()[_0x0baf('0x38')](function(){_0x3a3353[_0x0baf('0x2d')](0xcc)[_0x0baf('0x2e')]();});}};}function handleEntityNotFound(_0x3d65f2,_0x5300a5){return function(_0x1a2b03){if(!_0x1a2b03){_0x3d65f2[_0x0baf('0x2c')](0x194);}return _0x1a2b03;};}function handleError(_0x5088a5,_0x23d890){_0x23d890=_0x23d890||0x1f4;return function(_0x2447c2){logger[_0x0baf('0x28')](_0x2447c2[_0x0baf('0x39')]);if(_0x2447c2[_0x0baf('0x3a')]){delete _0x2447c2[_0x0baf('0x3a')];}_0x5088a5[_0x0baf('0x2d')](_0x23d890)[_0x0baf('0x3b')](_0x2447c2);};}exports['index']=function(_0x7e765b,_0x2ab8fa){var _0x5b991f={},_0x32c022={},_0x57783c={'count':0x0,'rows':[]};var _0x5c545f=_[_0x0baf('0x3c')](db[_0x0baf('0x3d')]['rawAttributes'],function(_0x49e792){return{'name':_0x49e792[_0x0baf('0x3e')],'type':_0x49e792[_0x0baf('0x3f')][_0x0baf('0x40')]};});_0x32c022[_0x0baf('0x41')]=_[_0x0baf('0x3c')](_0x5c545f,_0x0baf('0x3a'));_0x32c022[_0x0baf('0x42')]=_[_0x0baf('0x43')](_0x7e765b[_0x0baf('0x42')]);_0x32c022[_0x0baf('0x44')]=_[_0x0baf('0x45')](_0x32c022[_0x0baf('0x41')],_0x32c022[_0x0baf('0x42')]);_0x5b991f[_0x0baf('0x46')]=_['intersection'](_0x32c022[_0x0baf('0x41')],qs[_0x0baf('0x47')](_0x7e765b['query'][_0x0baf('0x47')]));_0x5b991f[_0x0baf('0x46')]=_0x5b991f[_0x0baf('0x46')][_0x0baf('0x48')]?_0x5b991f[_0x0baf('0x46')]:_0x32c022[_0x0baf('0x41')];if(!_0x7e765b['query'][_0x0baf('0x49')](_0x0baf('0x4a'))){_0x5b991f['limit']=qs[_0x0baf('0x32')](_0x7e765b[_0x0baf('0x42')][_0x0baf('0x32')]);_0x5b991f[_0x0baf('0x31')]=qs['offset'](_0x7e765b[_0x0baf('0x42')][_0x0baf('0x31')]);}_0x5b991f[_0x0baf('0x4b')]=qs[_0x0baf('0x4c')](_0x7e765b[_0x0baf('0x42')][_0x0baf('0x4c')]);_0x5b991f[_0x0baf('0x4d')]=qs[_0x0baf('0x44')](_[_0x0baf('0x4e')](_0x7e765b[_0x0baf('0x42')],_0x32c022['filters']),_0x5c545f);if(_0x7e765b[_0x0baf('0x42')][_0x0baf('0x4f')]){_0x5b991f[_0x0baf('0x4d')]=_[_0x0baf('0x50')](_0x5b991f[_0x0baf('0x4d')],{'$or':_['map'](_0x5c545f,function(_0x1e7364){if(_0x1e7364[_0x0baf('0x3f')]!==_0x0baf('0x51')){var _0x237a31={};_0x237a31[_0x1e7364[_0x0baf('0x3a')]]={'$like':'%'+_0x7e765b['query'][_0x0baf('0x4f')]+'%'};return _0x237a31;}})});}_0x5b991f=_[_0x0baf('0x50')]({},_0x5b991f,_0x7e765b[_0x0baf('0x52')]);var _0x1522b0={'where':_0x5b991f[_0x0baf('0x4d')]};return db[_0x0baf('0x3d')][_0x0baf('0x30')](_0x1522b0)['then'](function(_0x399be0){_0x57783c[_0x0baf('0x30')]=_0x399be0;if(_0x7e765b[_0x0baf('0x42')]['includeAll']){_0x5b991f[_0x0baf('0x53')]=[{'all':!![]}];}return db[_0x0baf('0x3d')][_0x0baf('0x54')](_0x5b991f);})[_0x0baf('0x38')](function(_0x204d77){_0x57783c[_0x0baf('0x55')]=_0x204d77;return _0x57783c;})[_0x0baf('0x38')](respondWithFilteredResult(_0x2ab8fa,_0x5b991f))['catch'](handleError(_0x2ab8fa,null));};exports[_0x0baf('0x56')]=function(_0x428c9b,_0x214a1d){var _0x2676eb={'raw':!![],'where':{'id':_0x428c9b[_0x0baf('0x57')]['id']}},_0x293bd5={};_0x293bd5[_0x0baf('0x41')]=_[_0x0baf('0x43')](db[_0x0baf('0x3d')][_0x0baf('0x58')]);_0x293bd5[_0x0baf('0x42')]=_['keys'](_0x428c9b['query']);_0x293bd5[_0x0baf('0x44')]=_[_0x0baf('0x45')](_0x293bd5[_0x0baf('0x41')],_0x293bd5[_0x0baf('0x42')]);_0x2676eb[_0x0baf('0x46')]=_[_0x0baf('0x45')](_0x293bd5[_0x0baf('0x41')],qs['fields'](_0x428c9b[_0x0baf('0x42')][_0x0baf('0x47')]));_0x2676eb[_0x0baf('0x46')]=_0x2676eb[_0x0baf('0x46')][_0x0baf('0x48')]?_0x2676eb[_0x0baf('0x46')]:_0x293bd5['model'];if(_0x428c9b[_0x0baf('0x42')]['includeAll']){_0x2676eb[_0x0baf('0x53')]=[{'all':!![]}];}_0x2676eb=_['merge']({},_0x2676eb,_0x428c9b[_0x0baf('0x52')]);return db['FaxMessage'][_0x0baf('0x59')](_0x2676eb)['then'](handleEntityNotFound(_0x214a1d,null))[_0x0baf('0x38')](respondWithResult(_0x214a1d,null))[_0x0baf('0x2b')](handleError(_0x214a1d,null));};exports[_0x0baf('0x37')]=function(_0x4520d1,_0x42a68b){if(_0x4520d1['body']['id']){delete _0x4520d1[_0x0baf('0x5a')]['id'];}return db[_0x0baf('0x3d')][_0x0baf('0x59')]({'where':{'id':_0x4520d1[_0x0baf('0x57')]['id']}})[_0x0baf('0x38')](handleEntityNotFound(_0x42a68b,null))[_0x0baf('0x38')](saveUpdates(_0x4520d1['body'],null))[_0x0baf('0x38')](respondWithResult(_0x42a68b,null))[_0x0baf('0x2b')](handleError(_0x42a68b,null));};exports[_0x0baf('0x5b')]=function(_0xabafaa,_0xbc7cc2){return db[_0x0baf('0x3d')][_0x0baf('0x59')]({'where':{'id':_0xabafaa['params']['id']}})['then'](handleEntityNotFound(_0xbc7cc2,null))[_0x0baf('0x38')](removeEntity(_0xbc7cc2,null))[_0x0baf('0x2b')](handleError(_0xbc7cc2,null));};exports[_0x0baf('0x5c')]=function(_0x337d94,_0x3128aa){return db[_0x0baf('0x3d')][_0x0baf('0x5c')]()[_0x0baf('0x38')](respondWithResult(_0x3128aa,null))[_0x0baf('0x2b')](handleError(_0x3128aa,null));};var interaction_log=require('../../config/logger')(_0x0baf('0x5d'));exports[_0x0baf('0x5e')]=function(_0x3c2d03,_0x1245de,_0x2024e2){var _0xebfc0c={'agent':{},'channel':_0x0baf('0x5f')};if(_0x3c2d03['body']['id']){delete _0x3c2d03[_0x0baf('0x5a')]['id'];}_0x3c2d03[_0x0baf('0x5a')][_0x0baf('0x60')]=!![];_0x3c2d03[_0x0baf('0x5a')][_0x0baf('0x61')]=moment()[_0x0baf('0x62')](_0x0baf('0x63'));_0x3c2d03[_0x0baf('0x5a')]['UserId']=_0x3c2d03[_0x0baf('0x5a')]['UserId']||_0x3c2d03[_0x0baf('0x64')]['id'];_0xebfc0c['agent']['id']=_0x3c2d03['body'][_0x0baf('0x65')];return db['FaxMessage'][_0x0baf('0x59')]({'where':{'id':_0x3c2d03[_0x0baf('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x0baf('0x66')}]})[_0x0baf('0x38')](handleEntityNotFound(_0x1245de,null))[_0x0baf('0x38')](saveUpdates(_0x3c2d03['body'],null))['then'](function(_0x2438df){if(_0x2438df){_0xebfc0c[_0x0baf('0x2a')]=_0x2438df[_0x0baf('0x67')]({'plain':!![]});return db[_0x0baf('0x68')][_0x0baf('0x59')]({'where':{'id':_0x2438df['FaxInteractionId']}});}return null;})[_0x0baf('0x38')](handleEntityNotFound(_0x1245de,null))['then'](function(_0x5d5751){if(_0x5d5751){return _0x5d5751['update']({'UserId':_0x3c2d03[_0x0baf('0x5a')]['UserId'],'read1stAt':_['isNil'](_0x5d5751[_0x0baf('0x69')])?moment()[_0x0baf('0x62')](_0x0baf('0x63')):undefined});}return null;})[_0x0baf('0x38')](function(_0x245967){if(_0x245967){_0xebfc0c[_0x0baf('0x6a')]=_0x245967['get']({'plain':!![]});interaction_log[_0x0baf('0x23')](_0x0baf('0x6b'),_0x3c2d03[_0x0baf('0x64')]['id'],_0x3c2d03[_0x0baf('0x64')][_0x0baf('0x3a')],_0x3c2d03[_0x0baf('0x64')]['role'],_0xebfc0c[_0x0baf('0x6a')]['id'],_0x3c2d03[_0x0baf('0x5a')]?JSON[_0x0baf('0x6c')](_0x3c2d03['body']):_0x0baf('0x6d'));return respondWithRpcPromise(_0x0baf('0x6e'),_0x0baf('0x6f'),_0xebfc0c);}return null;})[_0x0baf('0x38')](function(_0x125906){if(_0x125906){if(_0x3c2d03[_0x0baf('0x5a')][_0x0baf('0x70')]){_0xebfc0c['message']['interface']=util['format'](_0x0baf('0x71'),_0x3c2d03[_0x0baf('0x64')][_0x0baf('0x3a')]);_0xebfc0c[_0x0baf('0x2a')][_0x0baf('0x72')]=_0xebfc0c[_0x0baf('0x72')];_0xebfc0c['message']['event']=_0x0baf('0x5e');return respondWithRpcPromise('EventManager',_0x0baf('0x73'),{'event':_0x0baf('0x74'),'message':_0xebfc0c['message']},client9002)[_0x0baf('0x38')](function(){return _0xebfc0c;});}return _0xebfc0c;}return null;})[_0x0baf('0x38')](respondWithResult(_0x1245de,null))[_0x0baf('0x2b')](handleError(_0x1245de,null));};var interaction_log=require(_0x0baf('0x17'))(_0x0baf('0x5d'));exports[_0x0baf('0x35')]=function(_0x1b6b73,_0x2e3b1d,_0xfcc697){var _0x5ea0f3={'agent':{},'channel':'fax'};if(_0x1b6b73['body']['id']){delete _0x1b6b73['body']['id'];}_0x1b6b73['body'][_0x0baf('0x65')]=_0x1b6b73[_0x0baf('0x5a')][_0x0baf('0x65')]||_0x1b6b73[_0x0baf('0x64')]['id'];_0x5ea0f3['agent']['id']=_0x1b6b73[_0x0baf('0x5a')][_0x0baf('0x65')];return db['FaxMessage']['find']({'where':{'id':_0x1b6b73[_0x0baf('0x57')]['id'],'UserId':null}})[_0x0baf('0x38')](handleEntityNotFound(_0x2e3b1d,null))[_0x0baf('0x38')](function(_0x442e5f){if(_0x442e5f){_0x5ea0f3[_0x0baf('0x2a')]=_0x442e5f[_0x0baf('0x67')]({'plain':!![]});return db[_0x0baf('0x68')][_0x0baf('0x59')]({'where':{'id':_0x442e5f['FaxInteractionId']}});}return null;})[_0x0baf('0x38')](handleEntityNotFound(_0x2e3b1d,null))[_0x0baf('0x38')](function(_0x560c0f){if(_0x560c0f){_0x5ea0f3[_0x0baf('0x6a')]=_0x560c0f[_0x0baf('0x67')]({'plain':!![]});interaction_log['info'](_0x0baf('0x75'),_0x1b6b73[_0x0baf('0x64')]['id'],_0x1b6b73[_0x0baf('0x64')][_0x0baf('0x3a')],_0x1b6b73[_0x0baf('0x64')]['role'],_0x5ea0f3['interaction']['id'],_0x1b6b73[_0x0baf('0x5a')]?JSON[_0x0baf('0x6c')](_0x1b6b73['body']):_0x0baf('0x6d'));return respondWithRpcPromise(_0x0baf('0x76'),_0x0baf('0x77'),_0x5ea0f3);}return null;})['then'](function(_0x475be2){if(_0x475be2){_0x475be2[_0x0baf('0x2a')][_0x0baf('0x78')]=util['format'](_0x0baf('0x71'),_0x1b6b73['user'][_0x0baf('0x3a')]);_0x475be2[_0x0baf('0x2a')][_0x0baf('0x72')]=_0x5ea0f3[_0x0baf('0x72')];_0x475be2[_0x0baf('0x2a')]['event']=_0x0baf('0x35');respondWithRpcPromise(_0x0baf('0x73'),'EventManager',{'event':_0x0baf('0x79'),'message':_0x475be2[_0x0baf('0x2a')]},client9002);return _0x5ea0f3;}return null;})[_0x0baf('0x38')](respondWithResult(_0x2e3b1d,null))[_0x0baf('0x2b')](handleError(_0x2e3b1d,null));};exports[_0x0baf('0x7a')]=function(_0x250df2,_0xa4fd1b){var _0x1cda78;return db[_0x0baf('0x3d')][_0x0baf('0x7a')](_0x250df2[_0x0baf('0x5a')],{})[_0x0baf('0x38')](function(_0x5985f9){_0x1cda78=_0x5985f9;return db['CmContact'][_0x0baf('0x7b')]({'where':{'id':_0x1cda78[_0x0baf('0x7c')]}});})[_0x0baf('0x38')](function(_0x52f267){if(_['isNil'](_0x52f267)){return;}else{_0x1cda78[_0x0baf('0x5f')]=_0x52f267[_0x0baf('0x5f')];return db[_0x0baf('0x7d')][_0x0baf('0x7b')]({'where':{'id':_0x1cda78[_0x0baf('0x7e')]}});}})[_0x0baf('0x38')](function(_0x191d35){return respondWithRpcPromise(_0x0baf('0x7f'),_0x0baf('0x7f'),{'FaxAccountId':_['isNil'](_0x250df2[_0x0baf('0x5a')])?undefined:_0x250df2[_0x0baf('0x5a')][_0x0baf('0x80')],'path':_[_0x0baf('0x81')](_0x191d35)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x191d35['basename']),'fax':_[_0x0baf('0x81')](_0x1cda78[_0x0baf('0x5f')])?undefined:_0x1cda78['fax'],'AttachmentId':_0x1cda78['AttachmentId']},client9002);})[_0x0baf('0x38')](respondWithResult(_0xa4fd1b,0xc9))[_0x0baf('0x2b')](handleError(_0xa4fd1b,null));};exports['download']=function(_0x1bb609,_0x9d4668){var _0x20c617=path[_0x0baf('0x82')](config[_0x0baf('0x83')],_0x0baf('0x84'),_0x0baf('0x85'),_0x0baf('0x86'));return db[_0x0baf('0x3d')][_0x0baf('0x59')]({'where':{'id':_0x1bb609[_0x0baf('0x57')]['id']},'include':[{'model':db[_0x0baf('0x7d')],'as':'Attachment'}]})[_0x0baf('0x38')](handleEntityNotFound(_0x9d4668,null))[_0x0baf('0x38')](function(_0x1e1adb){if(_0x1e1adb){return _0x9d4668[_0x0baf('0x87')](path[_0x0baf('0x82')](_0x20c617,_0x1e1adb[_0x0baf('0x7d')]['basename']));}})[_0x0baf('0x2b')](handleError(_0x9d4668,null));}; \ No newline at end of file +var _0xb62e=['message','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','body','describe','fax-interactions','accept','fax','format','UserId','user','agent','CmContact','Contact','get','FaxInteraction','FaxInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectmessage','create','findOne','Attachment','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','server','files','attachments','join','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','../../config/license/util','redis','defaults','localhost','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0xb62e,0x1de));var _0xeb62=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb62e[_0x3b380d];return _0x54502b;};'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 licenseUtil=require(_0xeb62('0x19'));var db=require('../../mysqldb')['db'];config[_0xeb62('0x1a')]=_[_0xeb62('0x1b')](config[_0xeb62('0x1a')],{'host':_0xeb62('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb62('0x1a')]));require(_0xeb62('0x1d'))[_0xeb62('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xeb62('0x1f')][_0xeb62('0x20')]({'port':0x232c});var client9002=jayson[_0xeb62('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f6a1f,_0x15b3e8,_0x184106,_0x353e2c){return new BPromise(function(_0x3fb280,_0x370474){var _0x1fb460=_0x353e2c||client;return _0x1fb460[_0xeb62('0x21')](_0x1f6a1f,_0x184106)[_0xeb62('0x22')](function(_0x27fd84){logger[_0xeb62('0x23')](_0xeb62('0x24'),_0x15b3e8,_0xeb62('0x25'));logger['debug'](_0xeb62('0x26'),_0x15b3e8,_0xeb62('0x25'),JSON[_0xeb62('0x27')](_0x27fd84));if(_0x27fd84[_0xeb62('0x28')]){if(_0x27fd84[_0xeb62('0x28')][_0xeb62('0x29')]===0x1f4){logger[_0xeb62('0x28')]('FaxMessage,\x20%s,\x20%s',_0x15b3e8,_0x27fd84['error'][_0xeb62('0x2a')]);return _0x370474(_0x27fd84[_0xeb62('0x28')][_0xeb62('0x2a')]);}logger[_0xeb62('0x28')](_0xeb62('0x24'),_0x15b3e8,_0x27fd84['error']['message']);return _0x3fb280(_0x27fd84[_0xeb62('0x28')][_0xeb62('0x2a')]);}else{logger[_0xeb62('0x23')](_0xeb62('0x24'),_0x15b3e8,'request\x20sent');_0x3fb280(_0x27fd84['result'][_0xeb62('0x2a')]);}})['catch'](function(_0x448327){logger['error'](_0xeb62('0x24'),_0x15b3e8,_0x448327);_0x370474(_0x448327);});});}function respondWithStatusCode(_0x516a72,_0x3ac28c){_0x3ac28c=_0x3ac28c||0xcc;return function(_0x6bfbbc){if(_0x6bfbbc){return _0x516a72[_0xeb62('0x2b')](_0x3ac28c);}return _0x516a72['status'](_0x3ac28c)[_0xeb62('0x2c')]();};}function respondWithResult(_0x3ae031,_0x5222f4){_0x5222f4=_0x5222f4||0xc8;return function(_0xe8872c){if(_0xe8872c){return _0x3ae031[_0xeb62('0x2d')](_0x5222f4)[_0xeb62('0x2e')](_0xe8872c);}};}function respondWithFilteredResult(_0x511202,_0x192517){return function(_0x1616ee){if(_0x1616ee){var _0x57169a=_0x1616ee[_0xeb62('0x2f')],_0x157474=_0x192517[_0xeb62('0x30')],_0x2b51b2=_0x192517['offset']+_0x192517['limit'],_0x2c967c;if(_0x2b51b2>=_0x57169a){_0x2b51b2=_0x57169a;_0x2c967c=0xc8;}else{_0x2c967c=0xce;}_0x511202[_0xeb62('0x2d')](_0x2c967c);return _0x511202[_0xeb62('0x31')](_0xeb62('0x32'),_0x157474+'-'+_0x2b51b2+'/'+_0x57169a)[_0xeb62('0x2e')](_0x1616ee);}return null;};}function patchUpdates(_0x42b197){return function(_0x2ad3ec){try{jsonpatch[_0xeb62('0x33')](_0x2ad3ec,_0x42b197,!![]);}catch(_0x4be25d){return BPromise[_0xeb62('0x34')](_0x4be25d);}return _0x2ad3ec['save']();};}function saveUpdates(_0x555db1,_0x4030e1){return function(_0x286455){if(_0x286455){return _0x286455['update'](_0x555db1)[_0xeb62('0x22')](function(_0x4bcfce){return _0x4bcfce;});}return null;};}function removeEntity(_0x1c2195,_0xc0d2e4){return function(_0x530587){if(_0x530587){return _0x530587[_0xeb62('0x35')]()[_0xeb62('0x22')](function(){_0x1c2195['status'](0xcc)[_0xeb62('0x2c')]();});}};}function handleEntityNotFound(_0x2a8087,_0x38b116){return function(_0x2203cb){if(!_0x2203cb){_0x2a8087['sendStatus'](0x194);}return _0x2203cb;};}function handleError(_0x4863fe,_0x43685b){_0x43685b=_0x43685b||0x1f4;return function(_0x4cf6b0){logger['error'](_0x4cf6b0[_0xeb62('0x36')]);if(_0x4cf6b0[_0xeb62('0x37')]){delete _0x4cf6b0['name'];}_0x4863fe[_0xeb62('0x2d')](_0x43685b)[_0xeb62('0x38')](_0x4cf6b0);};}exports[_0xeb62('0x39')]=function(_0x1f839a,_0x21f604){var _0x15387a={},_0x40106b={},_0x4b22c8={'count':0x0,'rows':[]};var _0x54ea4b=_[_0xeb62('0x3a')](db[_0xeb62('0x3b')][_0xeb62('0x3c')],function(_0xa66e8f){return{'name':_0xa66e8f['fieldName'],'type':_0xa66e8f[_0xeb62('0x3d')]['key']};});_0x40106b[_0xeb62('0x3e')]=_[_0xeb62('0x3a')](_0x54ea4b,_0xeb62('0x37'));_0x40106b[_0xeb62('0x3f')]=_[_0xeb62('0x40')](_0x1f839a[_0xeb62('0x3f')]);_0x40106b[_0xeb62('0x41')]=_[_0xeb62('0x42')](_0x40106b['model'],_0x40106b[_0xeb62('0x3f')]);_0x15387a[_0xeb62('0x43')]=_[_0xeb62('0x42')](_0x40106b[_0xeb62('0x3e')],qs['fields'](_0x1f839a['query'][_0xeb62('0x44')]));_0x15387a[_0xeb62('0x43')]=_0x15387a['attributes'][_0xeb62('0x45')]?_0x15387a[_0xeb62('0x43')]:_0x40106b['model'];if(!_0x1f839a[_0xeb62('0x3f')]['hasOwnProperty'](_0xeb62('0x46'))){_0x15387a['limit']=qs[_0xeb62('0x47')](_0x1f839a['query'][_0xeb62('0x47')]);_0x15387a[_0xeb62('0x30')]=qs[_0xeb62('0x30')](_0x1f839a['query']['offset']);}_0x15387a[_0xeb62('0x48')]=qs[_0xeb62('0x49')](_0x1f839a[_0xeb62('0x3f')][_0xeb62('0x49')]);_0x15387a[_0xeb62('0x4a')]=qs['filters'](_[_0xeb62('0x4b')](_0x1f839a['query'],_0x40106b[_0xeb62('0x41')]),_0x54ea4b);if(_0x1f839a['query'][_0xeb62('0x4c')]){_0x15387a['where']=_[_0xeb62('0x4d')](_0x15387a['where'],{'$or':_[_0xeb62('0x3a')](_0x54ea4b,function(_0x4624e7){if(_0x4624e7[_0xeb62('0x3d')]!==_0xeb62('0x4e')){var _0x293e6f={};_0x293e6f[_0x4624e7[_0xeb62('0x37')]]={'$like':'%'+_0x1f839a['query'][_0xeb62('0x4c')]+'%'};return _0x293e6f;}})});}_0x15387a=_[_0xeb62('0x4d')]({},_0x15387a,_0x1f839a['options']);var _0x4a43ad={'where':_0x15387a['where']};return db['FaxMessage'][_0xeb62('0x2f')](_0x4a43ad)[_0xeb62('0x22')](function(_0x53a06b){_0x4b22c8[_0xeb62('0x2f')]=_0x53a06b;if(_0x1f839a[_0xeb62('0x3f')][_0xeb62('0x4f')]){_0x15387a[_0xeb62('0x50')]=[{'all':!![]}];}return db[_0xeb62('0x3b')]['findAll'](_0x15387a);})[_0xeb62('0x22')](function(_0x5f47cf){_0x4b22c8[_0xeb62('0x51')]=_0x5f47cf;return _0x4b22c8;})[_0xeb62('0x22')](respondWithFilteredResult(_0x21f604,_0x15387a))[_0xeb62('0x52')](handleError(_0x21f604,null));};exports[_0xeb62('0x53')]=function(_0x1f2d87,_0x2736d4){var _0x321e55={'raw':!![],'where':{'id':_0x1f2d87[_0xeb62('0x54')]['id']}},_0x184c01={};_0x184c01[_0xeb62('0x3e')]=_[_0xeb62('0x40')](db[_0xeb62('0x3b')]['rawAttributes']);_0x184c01[_0xeb62('0x3f')]=_['keys'](_0x1f2d87['query']);_0x184c01[_0xeb62('0x41')]=_[_0xeb62('0x42')](_0x184c01['model'],_0x184c01[_0xeb62('0x3f')]);_0x321e55[_0xeb62('0x43')]=_['intersection'](_0x184c01[_0xeb62('0x3e')],qs[_0xeb62('0x44')](_0x1f2d87[_0xeb62('0x3f')][_0xeb62('0x44')]));_0x321e55[_0xeb62('0x43')]=_0x321e55[_0xeb62('0x43')][_0xeb62('0x45')]?_0x321e55[_0xeb62('0x43')]:_0x184c01['model'];if(_0x1f2d87[_0xeb62('0x3f')]['includeAll']){_0x321e55[_0xeb62('0x50')]=[{'all':!![]}];}_0x321e55=_[_0xeb62('0x4d')]({},_0x321e55,_0x1f2d87[_0xeb62('0x55')]);return db[_0xeb62('0x3b')][_0xeb62('0x56')](_0x321e55)[_0xeb62('0x22')](handleEntityNotFound(_0x2736d4,null))[_0xeb62('0x22')](respondWithResult(_0x2736d4,null))[_0xeb62('0x52')](handleError(_0x2736d4,null));};exports['update']=function(_0x4d31a1,_0x50ed53){if(_0x4d31a1['body']['id']){delete _0x4d31a1[_0xeb62('0x57')]['id'];}return db['FaxMessage'][_0xeb62('0x56')]({'where':{'id':_0x4d31a1['params']['id']}})[_0xeb62('0x22')](handleEntityNotFound(_0x50ed53,null))[_0xeb62('0x22')](saveUpdates(_0x4d31a1[_0xeb62('0x57')],null))['then'](respondWithResult(_0x50ed53,null))[_0xeb62('0x52')](handleError(_0x50ed53,null));};exports[_0xeb62('0x35')]=function(_0x518dd4,_0x35982a){return db[_0xeb62('0x3b')][_0xeb62('0x56')]({'where':{'id':_0x518dd4[_0xeb62('0x54')]['id']}})['then'](handleEntityNotFound(_0x35982a,null))[_0xeb62('0x22')](removeEntity(_0x35982a,null))[_0xeb62('0x52')](handleError(_0x35982a,null));};exports['describe']=function(_0x2eba52,_0x5d1415){return db[_0xeb62('0x3b')][_0xeb62('0x58')]()[_0xeb62('0x22')](respondWithResult(_0x5d1415,null))[_0xeb62('0x52')](handleError(_0x5d1415,null));};var interaction_log=require(_0xeb62('0x15'))(_0xeb62('0x59'));exports[_0xeb62('0x5a')]=function(_0x1db841,_0x130153,_0x15c93f){var _0x200b43={'agent':{},'channel':_0xeb62('0x5b')};if(_0x1db841[_0xeb62('0x57')]['id']){delete _0x1db841[_0xeb62('0x57')]['id'];}_0x1db841['body']['read']=!![];_0x1db841['body']['readAt']=moment()[_0xeb62('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x1db841[_0xeb62('0x57')][_0xeb62('0x5d')]=_0x1db841[_0xeb62('0x57')][_0xeb62('0x5d')]||_0x1db841[_0xeb62('0x5e')]['id'];_0x200b43[_0xeb62('0x5f')]['id']=_0x1db841[_0xeb62('0x57')][_0xeb62('0x5d')];return db[_0xeb62('0x3b')][_0xeb62('0x56')]({'where':{'id':_0x1db841['params']['id'],'UserId':null},'include':[{'model':db[_0xeb62('0x60')],'as':_0xeb62('0x61')}]})[_0xeb62('0x22')](handleEntityNotFound(_0x130153,null))[_0xeb62('0x22')](saveUpdates(_0x1db841['body'],null))[_0xeb62('0x22')](function(_0x2e5456){if(_0x2e5456){_0x200b43[_0xeb62('0x2a')]=_0x2e5456[_0xeb62('0x62')]({'plain':!![]});return db[_0xeb62('0x63')][_0xeb62('0x56')]({'where':{'id':_0x2e5456[_0xeb62('0x64')]}});}return null;})[_0xeb62('0x22')](handleEntityNotFound(_0x130153,null))[_0xeb62('0x22')](function(_0x2b788e){if(_0x2b788e){return _0x2b788e[_0xeb62('0x65')]({'UserId':_0x1db841['body'][_0xeb62('0x5d')],'read1stAt':_[_0xeb62('0x66')](_0x2b788e[_0xeb62('0x67')])?moment()[_0xeb62('0x5c')](_0xeb62('0x68')):undefined});}return null;})[_0xeb62('0x22')](function(_0x388b31){if(_0x388b31){_0x200b43[_0xeb62('0x69')]=_0x388b31[_0xeb62('0x62')]({'plain':!![]});interaction_log[_0xeb62('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1db841[_0xeb62('0x5e')]['id'],_0x1db841[_0xeb62('0x5e')][_0xeb62('0x37')],_0x1db841[_0xeb62('0x5e')]['role'],_0x200b43[_0xeb62('0x69')]['id'],_0x1db841[_0xeb62('0x57')]?JSON[_0xeb62('0x27')](_0x1db841[_0xeb62('0x57')]):_0xeb62('0x6a'));return respondWithRpcPromise(_0xeb62('0x6b'),'acceptMessage',_0x200b43);}return null;})[_0xeb62('0x22')](function(_0x1b56cf){if(_0x1b56cf){if(_0x1db841[_0xeb62('0x57')][_0xeb62('0x6c')]){_0x200b43[_0xeb62('0x2a')][_0xeb62('0x6d')]=util[_0xeb62('0x5c')](_0xeb62('0x6e'),_0x1db841[_0xeb62('0x5e')][_0xeb62('0x37')]);_0x200b43[_0xeb62('0x2a')][_0xeb62('0x6f')]=_0x200b43[_0xeb62('0x6f')];_0x200b43[_0xeb62('0x2a')][_0xeb62('0x70')]=_0xeb62('0x5a');return respondWithRpcPromise('EventManager',_0xeb62('0x71'),{'event':'acceptmessage','message':_0x200b43[_0xeb62('0x2a')]},client9002)[_0xeb62('0x22')](function(){return _0x200b43;});}return _0x200b43;}return null;})['then'](respondWithResult(_0x130153,null))[_0xeb62('0x52')](handleError(_0x130153,null));};var interaction_log=require(_0xeb62('0x15'))(_0xeb62('0x59'));exports[_0xeb62('0x34')]=function(_0x206e77,_0x7a12cd,_0x385cc5){var _0x449582={'agent':{},'channel':_0xeb62('0x5b')};if(_0x206e77[_0xeb62('0x57')]['id']){delete _0x206e77[_0xeb62('0x57')]['id'];}_0x206e77[_0xeb62('0x57')][_0xeb62('0x5d')]=_0x206e77['body'][_0xeb62('0x5d')]||_0x206e77[_0xeb62('0x5e')]['id'];_0x449582['agent']['id']=_0x206e77[_0xeb62('0x57')]['UserId'];return db[_0xeb62('0x3b')][_0xeb62('0x56')]({'where':{'id':_0x206e77[_0xeb62('0x54')]['id'],'UserId':null}})[_0xeb62('0x22')](handleEntityNotFound(_0x7a12cd,null))[_0xeb62('0x22')](function(_0x33fbda){if(_0x33fbda){_0x449582['message']=_0x33fbda[_0xeb62('0x62')]({'plain':!![]});return db['FaxInteraction'][_0xeb62('0x56')]({'where':{'id':_0x33fbda[_0xeb62('0x64')]}});}return null;})[_0xeb62('0x22')](handleEntityNotFound(_0x7a12cd,null))[_0xeb62('0x22')](function(_0x1dcd96){if(_0x1dcd96){_0x449582['interaction']=_0x1dcd96[_0xeb62('0x62')]({'plain':!![]});interaction_log[_0xeb62('0x23')](_0xeb62('0x72'),_0x206e77['user']['id'],_0x206e77[_0xeb62('0x5e')][_0xeb62('0x37')],_0x206e77[_0xeb62('0x5e')][_0xeb62('0x73')],_0x449582[_0xeb62('0x69')]['id'],_0x206e77[_0xeb62('0x57')]?JSON['stringify'](_0x206e77['body']):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x449582);}return null;})[_0xeb62('0x22')](function(_0x231362){if(_0x231362){_0x231362[_0xeb62('0x2a')][_0xeb62('0x6d')]=util[_0xeb62('0x5c')](_0xeb62('0x6e'),_0x206e77[_0xeb62('0x5e')][_0xeb62('0x37')]);_0x231362[_0xeb62('0x2a')][_0xeb62('0x6f')]=_0x449582[_0xeb62('0x6f')];_0x231362[_0xeb62('0x2a')]['event']=_0xeb62('0x34');respondWithRpcPromise(_0xeb62('0x71'),_0xeb62('0x71'),{'event':_0xeb62('0x74'),'message':_0x231362[_0xeb62('0x2a')]},client9002);return _0x449582;}return null;})[_0xeb62('0x22')](respondWithResult(_0x7a12cd,null))[_0xeb62('0x52')](handleError(_0x7a12cd,null));};exports[_0xeb62('0x75')]=function(_0x1bb222,_0x33b16b){var _0x124847;return db[_0xeb62('0x3b')][_0xeb62('0x75')](_0x1bb222[_0xeb62('0x57')],{})[_0xeb62('0x22')](function(_0x1cbfab){_0x124847=_0x1cbfab;return db[_0xeb62('0x60')][_0xeb62('0x76')]({'where':{'id':_0x124847['ContactId']}});})[_0xeb62('0x22')](function(_0x544b2e){if(_[_0xeb62('0x66')](_0x544b2e)){return;}else{_0x124847[_0xeb62('0x5b')]=_0x544b2e['fax'];return db[_0xeb62('0x77')]['findOne']({'where':{'id':_0x124847['AttachmentId']}});}})[_0xeb62('0x22')](function(_0x218139){return respondWithRpcPromise(_0xeb62('0x78'),_0xeb62('0x78'),{'FaxAccountId':_['isNil'](_0x1bb222[_0xeb62('0x57')])?undefined:_0x1bb222[_0xeb62('0x57')]['FaxAccountId'],'path':_[_0xeb62('0x66')](_0x218139)?undefined:util[_0xeb62('0x5c')](_0xeb62('0x79'),_0x218139[_0xeb62('0x7a')]),'fax':_[_0xeb62('0x66')](_0x124847[_0xeb62('0x5b')])?undefined:_0x124847[_0xeb62('0x5b')],'AttachmentId':_0x124847[_0xeb62('0x7b')]},client9002);})['then'](respondWithResult(_0x33b16b,0xc9))[_0xeb62('0x52')](handleError(_0x33b16b,null));};exports[_0xeb62('0x7c')]=function(_0x5b1bfc,_0x3c6de8){var _0x5c83b8=path['join'](config[_0xeb62('0x7d')],_0xeb62('0x7e'),_0xeb62('0x7f'),_0xeb62('0x80'));return db[_0xeb62('0x3b')]['find']({'where':{'id':_0x5b1bfc[_0xeb62('0x54')]['id']},'include':[{'model':db[_0xeb62('0x77')],'as':_0xeb62('0x77')}]})[_0xeb62('0x22')](handleEntityNotFound(_0x3c6de8,null))[_0xeb62('0x22')](function(_0x948c7f){if(_0x948c7f){return _0x3c6de8[_0xeb62('0x7c')](path[_0xeb62('0x81')](_0x5c83b8,_0x948c7f['Attachment']['basename']));}})[_0xeb62('0x52')](handleError(_0x3c6de8,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 1586c9c..182d182 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x37d089,_0x646a0b){var _0x5b4c9f=function(_0x26f288){while(--_0x26f288){_0x37d089['push'](_0x37d089['shift']());}};_0x5b4c9f(++_0x646a0b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe14b,0x93));var _0xbe14=function(_0x34f9d2,_0x56d403){_0x34f9d2=_0x34f9d2-0x0;var _0x2afe73=_0xe14b[_0x34f9d2];return _0x2afe73;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index ee9d5f2..475b85c 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 _0x2980=['FaxMessage','body','FULLTEXT','models','direction','toLowerCase','isNil','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3befc7,_0x1bf24d){var _0x1662d8=function(_0x238edf){while(--_0x238edf){_0x3befc7['push'](_0x3befc7['shift']());}};_0x1662d8(++_0x1bf24d);}(_0x2980,0x123));var _0x0298=function(_0xad1182,_0x5d74ee){_0xad1182=_0xad1182-0x0;var _0x339c26=_0x2980[_0xad1182];return _0x339c26;};'use strict';var _=require(_0x0298('0x0'));var util=require('util');var logger=require(_0x0298('0x1'))('api');var moment=require(_0x0298('0x2'));var BPromise=require('bluebird');var rp=require(_0x0298('0x3'));var fs=require('fs');var path=require(_0x0298('0x4'));var rimraf=require(_0x0298('0x5'));var config=require(_0x0298('0x6'));var attributes=require('./faxMessage.attributes');module[_0x0298('0x7')]=function(_0x1a19f3,_0x4d8f8b){return _0x1a19f3[_0x0298('0x8')](_0x0298('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x0298('0xa')],'type':_0x0298('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47a792,_0x483f10,_0x31ab62){var _0x145834=_0x1a19f3[_0x0298('0xc')];var _0x56cc81=_0x47a792['get']({'plain':!![]});if(_0x56cc81[_0x0298('0xd')][_0x0298('0xe')]()==='in'||_0x56cc81[_0x0298('0xd')][_0x0298('0xe')]()==='out'&&!_0x56cc81['secret']&&!_[_0x0298('0xf')](_0x56cc81['UserId'])){_0x145834[_0x0298('0x10')][_0x0298('0x11')]({'where':{'id':_0x56cc81[_0x0298('0x12')]}})[_0x0298('0x13')](function(_0x192d4d){if(_0x192d4d){_0x192d4d['update']({'lastMsgAt':_0x56cc81[_0x0298('0x14')],'lastMsgDirection':_0x56cc81['direction'][_0x0298('0xe')]()});}})[_0x0298('0x15')](function(_0x120491){console[_0x0298('0x16')](_0x120491);});}_0x31ab62();}},'charset':_0x0298('0x17'),'collate':_0x0298('0x18')});}; \ No newline at end of file +var _0xdcfd=['secret','isNil','FaxInteraction','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x48f683,_0xec583){var _0x13acce=function(_0x26bf13){while(--_0x26bf13){_0x48f683['push'](_0x48f683['shift']());}};_0x13acce(++_0xec583);}(_0xdcfd,0x1c4));var _0xddcf=function(_0x2e249d,_0x41b7e7){_0x2e249d=_0x2e249d-0x0;var _0x1faa37=_0xdcfd[_0x2e249d];return _0x1faa37;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xddcf('0x0'))('api');var moment=require(_0xddcf('0x1'));var BPromise=require('bluebird');var rp=require(_0xddcf('0x2'));var fs=require('fs');var path=require(_0xddcf('0x3'));var rimraf=require(_0xddcf('0x4'));var config=require(_0xddcf('0x5'));var attributes=require(_0xddcf('0x6'));module['exports']=function(_0x34419e,_0x253669){return _0x34419e[_0xddcf('0x7')](_0xddcf('0x8'),attributes,{'tableName':_0xddcf('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xddcf('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5234a8,_0x4e6145,_0x30a820){var _0x2387b0=_0x34419e[_0xddcf('0xb')];var _0x2f1a28=_0x5234a8[_0xddcf('0xc')]({'plain':!![]});if(_0x2f1a28[_0xddcf('0xd')][_0xddcf('0xe')]()==='in'||_0x2f1a28[_0xddcf('0xd')]['toLowerCase']()===_0xddcf('0xf')&&!_0x2f1a28[_0xddcf('0x10')]&&!_[_0xddcf('0x11')](_0x2f1a28['UserId'])){_0x2387b0[_0xddcf('0x12')]['findOne']({'where':{'id':_0x2f1a28['FaxInteractionId']}})[_0xddcf('0x13')](function(_0x126079){if(_0x126079){_0x126079[_0xddcf('0x14')]({'lastMsgAt':_0x2f1a28[_0xddcf('0x15')],'lastMsgDirection':_0x2f1a28[_0xddcf('0xd')]['toLowerCase']()});}})[_0xddcf('0x16')](function(_0x1d661c){console[_0xddcf('0x17')](_0x1d661c);});}_0x30a820();}},'charset':_0xddcf('0x18'),'collate':_0xddcf('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index dae4316..38e9361 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 _0xcc73=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','CreateFaxMessage','FaxMessage','create','body','raw','UpdateFaxMessage','update','options','where','attributes','limit','catch'];(function(_0x476998,_0x5dc512){var _0x37abe5=function(_0x278773){while(--_0x278773){_0x476998['push'](_0x476998['shift']());}};_0x37abe5(++_0x5dc512);}(_0xcc73,0x9c));var _0x3cc7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xcc73[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x3cc7('0x0'));var util=require(_0x3cc7('0x1'));var moment=require(_0x3cc7('0x2'));var BPromise=require(_0x3cc7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cc7('0x4'));var db=require(_0x3cc7('0x5'))['db'];var utils=require(_0x3cc7('0x6'));var logger=require(_0x3cc7('0x7'))(_0x3cc7('0x8'));var config=require(_0x3cc7('0x9'));var jayson=require(_0x3cc7('0xa'));var client=jayson['client'][_0x3cc7('0xb')]({'port':0x232a});config[_0x3cc7('0xc')]=_['defaults'](config[_0x3cc7('0xc')],{'host':_0x3cc7('0xd'),'port':0x18eb});var socket=require(_0x3cc7('0xe'))(new Redis(config[_0x3cc7('0xc')]));require(_0x3cc7('0xf'))[_0x3cc7('0x10')](socket);function respondWithRpcPromise(_0x2a5d3,_0x346966,_0x1e61b3){return new BPromise(function(_0x5223fd,_0x3e6833){return client[_0x3cc7('0x11')](_0x2a5d3,_0x1e61b3)[_0x3cc7('0x12')](function(_0x3758f6){logger[_0x3cc7('0x13')](_0x3cc7('0x14'),_0x346966,_0x3cc7('0x15'));logger[_0x3cc7('0x16')](_0x3cc7('0x17'),_0x346966,_0x3cc7('0x15'),JSON['stringify'](_0x3758f6));if(_0x3758f6[_0x3cc7('0x18')]){if(_0x3758f6[_0x3cc7('0x18')][_0x3cc7('0x19')]===0x1f4){logger[_0x3cc7('0x18')](_0x3cc7('0x14'),_0x346966,_0x3758f6[_0x3cc7('0x18')][_0x3cc7('0x1a')]);return _0x3e6833(_0x3758f6[_0x3cc7('0x18')][_0x3cc7('0x1a')]);}logger[_0x3cc7('0x18')](_0x3cc7('0x14'),_0x346966,_0x3758f6[_0x3cc7('0x18')][_0x3cc7('0x1a')]);return _0x5223fd(_0x3758f6[_0x3cc7('0x18')][_0x3cc7('0x1a')]);}else{logger[_0x3cc7('0x13')](_0x3cc7('0x14'),_0x346966,_0x3cc7('0x15'));_0x5223fd(_0x3758f6['result'][_0x3cc7('0x1a')]);}})['catch'](function(_0x1a3d12){logger[_0x3cc7('0x18')]('FaxMessage,\x20%s,\x20%s',_0x346966,_0x1a3d12);_0x3e6833(_0x1a3d12);});});}exports[_0x3cc7('0x1b')]=function(_0x4548bc){var _0x381f8f=this;return new Promise(function(_0x38774f,_0x107dcb){return db[_0x3cc7('0x1c')][_0x3cc7('0x1d')](_0x4548bc[_0x3cc7('0x1e')],{'raw':_0x4548bc['options']?_0x4548bc['options'][_0x3cc7('0x1f')]===undefined?!![]:![]:!![]})[_0x3cc7('0x12')](function(_0x576600){logger[_0x3cc7('0x13')]('CreateFaxMessage',_0x4548bc);logger[_0x3cc7('0x16')](_0x3cc7('0x1b'),_0x4548bc,JSON['stringify'](_0x576600));_0x38774f(_0x576600);})['catch'](function(_0x5a1ffa){logger[_0x3cc7('0x18')](_0x3cc7('0x1b'),_0x5a1ffa[_0x3cc7('0x1a')],_0x4548bc);_0x107dcb(_0x381f8f[_0x3cc7('0x18')](0x1f4,_0x5a1ffa[_0x3cc7('0x1a')]));});});};exports[_0x3cc7('0x20')]=function(_0x123574){var _0x4bf02e=this;return new Promise(function(_0x45101f,_0x34250e){return db['FaxMessage'][_0x3cc7('0x21')](_0x123574[_0x3cc7('0x1e')],{'raw':_0x123574[_0x3cc7('0x22')]?_0x123574[_0x3cc7('0x22')][_0x3cc7('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x123574[_0x3cc7('0x22')]?_0x123574[_0x3cc7('0x22')][_0x3cc7('0x23')]||null:null,'attributes':_0x123574[_0x3cc7('0x22')]?_0x123574['options'][_0x3cc7('0x24')]||null:null,'limit':_0x123574[_0x3cc7('0x22')]?_0x123574['options'][_0x3cc7('0x25')]||null:null})[_0x3cc7('0x12')](function(_0xfd6003){logger[_0x3cc7('0x13')]('UpdateFaxMessage',_0x123574);logger[_0x3cc7('0x16')](_0x3cc7('0x20'),_0x123574,JSON['stringify'](_0xfd6003));_0x45101f(_0xfd6003);})[_0x3cc7('0x26')](function(_0x4710c2){logger[_0x3cc7('0x18')](_0x3cc7('0x20'),_0x4710c2[_0x3cc7('0x1a')],_0x123574);_0x34250e(_0x4bf02e[_0x3cc7('0x18')](0x1f4,_0x4710c2[_0x3cc7('0x1a')]));});});}; \ No newline at end of file +var _0x4b93=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','create','body','options','catch','UpdateFaxMessage','update','attributes','limit','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x351f31,_0x16b676){var _0x4f5776=function(_0xc30d2f){while(--_0xc30d2f){_0x351f31['push'](_0x351f31['shift']());}};_0x4f5776(++_0x16b676);}(_0x4b93,0x192));var _0x34b9=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4b93[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x34b9('0x0'));var util=require('util');var moment=require(_0x34b9('0x1'));var BPromise=require(_0x34b9('0x2'));var rs=require(_0x34b9('0x3'));var fs=require('fs');var Redis=require(_0x34b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34b9('0x5'));var logger=require(_0x34b9('0x6'))(_0x34b9('0x7'));var config=require(_0x34b9('0x8'));var jayson=require(_0x34b9('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x34b9('0xa')]=_['defaults'](config[_0x34b9('0xa')],{'host':_0x34b9('0xb'),'port':0x18eb});var socket=require(_0x34b9('0xc'))(new Redis(config[_0x34b9('0xa')]));require(_0x34b9('0xd'))[_0x34b9('0xe')](socket);function respondWithRpcPromise(_0x4e190d,_0x34bde5,_0x4f2b44){return new BPromise(function(_0x15e719,_0x2501f2){return client[_0x34b9('0xf')](_0x4e190d,_0x4f2b44)[_0x34b9('0x10')](function(_0x40fa0e){logger[_0x34b9('0x11')](_0x34b9('0x12'),_0x34bde5,_0x34b9('0x13'));logger[_0x34b9('0x14')](_0x34b9('0x15'),_0x34bde5,_0x34b9('0x13'),JSON[_0x34b9('0x16')](_0x40fa0e));if(_0x40fa0e['error']){if(_0x40fa0e[_0x34b9('0x17')][_0x34b9('0x18')]===0x1f4){logger[_0x34b9('0x17')](_0x34b9('0x12'),_0x34bde5,_0x40fa0e[_0x34b9('0x17')]['message']);return _0x2501f2(_0x40fa0e[_0x34b9('0x17')][_0x34b9('0x19')]);}logger['error'](_0x34b9('0x12'),_0x34bde5,_0x40fa0e[_0x34b9('0x17')][_0x34b9('0x19')]);return _0x15e719(_0x40fa0e['error'][_0x34b9('0x19')]);}else{logger[_0x34b9('0x11')](_0x34b9('0x12'),_0x34bde5,_0x34b9('0x13'));_0x15e719(_0x40fa0e[_0x34b9('0x1a')][_0x34b9('0x19')]);}})['catch'](function(_0x20125e){logger[_0x34b9('0x17')](_0x34b9('0x12'),_0x34bde5,_0x20125e);_0x2501f2(_0x20125e);});});}exports[_0x34b9('0x1b')]=function(_0x3a45d7){var _0x225d79=this;return new Promise(function(_0x263fe2,_0x4c8576){return db[_0x34b9('0x1c')][_0x34b9('0x1d')](_0x3a45d7[_0x34b9('0x1e')],{'raw':_0x3a45d7[_0x34b9('0x1f')]?_0x3a45d7[_0x34b9('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x484445){logger[_0x34b9('0x11')](_0x34b9('0x1b'),_0x3a45d7);logger[_0x34b9('0x14')](_0x34b9('0x1b'),_0x3a45d7,JSON[_0x34b9('0x16')](_0x484445));_0x263fe2(_0x484445);})[_0x34b9('0x20')](function(_0x505584){logger[_0x34b9('0x17')]('CreateFaxMessage',_0x505584[_0x34b9('0x19')],_0x3a45d7);_0x4c8576(_0x225d79[_0x34b9('0x17')](0x1f4,_0x505584[_0x34b9('0x19')]));});});};exports[_0x34b9('0x21')]=function(_0x322d5b){var _0x428fea=this;return new Promise(function(_0x19a044,_0x45296f){return db[_0x34b9('0x1c')][_0x34b9('0x22')](_0x322d5b[_0x34b9('0x1e')],{'raw':_0x322d5b['options']?_0x322d5b[_0x34b9('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x322d5b['options']?_0x322d5b['options']['where']||null:null,'attributes':_0x322d5b[_0x34b9('0x1f')]?_0x322d5b[_0x34b9('0x1f')][_0x34b9('0x23')]||null:null,'limit':_0x322d5b[_0x34b9('0x1f')]?_0x322d5b[_0x34b9('0x1f')][_0x34b9('0x24')]||null:null})[_0x34b9('0x10')](function(_0x3ed0e2){logger[_0x34b9('0x11')](_0x34b9('0x21'),_0x322d5b);logger[_0x34b9('0x14')]('UpdateFaxMessage',_0x322d5b,JSON[_0x34b9('0x16')](_0x3ed0e2));_0x19a044(_0x3ed0e2);})[_0x34b9('0x20')](function(_0x44f617){logger[_0x34b9('0x17')](_0x34b9('0x21'),_0x44f617['message'],_0x322d5b);_0x45296f(_0x428fea[_0x34b9('0x17')](0x1f4,_0x44f617[_0x34b9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 5e48bce..d3feb4f 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 b5d73b9..7eb706f 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 _0x0f6d=['/:id/download','post','tracked','fax','faxmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show'];(function(_0x12407b,_0x252969){var _0x6860fc=function(_0x43997a){while(--_0x43997a){_0x12407b['push'](_0x12407b['shift']());}};_0x6860fc(++_0x252969);}(_0x0f6d,0xe5));var _0xd0f6=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x0f6d[_0x1573ea];return _0x51c0e2;};'use strict';var multer=require(_0xd0f6('0x0'));var util=require(_0xd0f6('0x1'));var path=require(_0xd0f6('0x2'));var timeout=require(_0xd0f6('0x3'));var express=require(_0xd0f6('0x4'));var router=express['Router']();var auth=require(_0xd0f6('0x5'));var interaction=require(_0xd0f6('0x6'));var config=require(_0xd0f6('0x7'));var controller=require('./faxMessage.controller');router[_0xd0f6('0x8')]('/',auth['isAuthenticated'](),controller[_0xd0f6('0x9')]);router[_0xd0f6('0x8')](_0xd0f6('0xa'),auth[_0xd0f6('0xb')](),controller['describe']);router[_0xd0f6('0x8')](_0xd0f6('0xc'),auth[_0xd0f6('0xb')](),controller[_0xd0f6('0xd')]);router[_0xd0f6('0x8')](_0xd0f6('0xe'),auth[_0xd0f6('0xb')](),controller['download']);router[_0xd0f6('0xf')]('/',auth[_0xd0f6('0xb')](),interaction[_0xd0f6('0x10')](_0xd0f6('0x11'),_0xd0f6('0x12')),controller[_0xd0f6('0x13')]);router[_0xd0f6('0x14')](_0xd0f6('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd0f6('0x14')](_0xd0f6('0x15'),auth[_0xd0f6('0xb')](),controller[_0xd0f6('0x16')]);router['put'](_0xd0f6('0x17'),auth[_0xd0f6('0xb')](),controller[_0xd0f6('0x18')]);router[_0xd0f6('0x19')]('/:id',auth[_0xd0f6('0xb')](),controller[_0xd0f6('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xb6da=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','download','faxmessage:create','create','put','update'];(function(_0x557364,_0x1d1d24){var _0x5acf3d=function(_0x203e86){while(--_0x203e86){_0x557364['push'](_0x557364['shift']());}};_0x5acf3d(++_0x1d1d24);}(_0xb6da,0x8e));var _0xab6d=function(_0x1df000,_0x432396){_0x1df000=_0x1df000-0x0;var _0x4d9485=_0xb6da[_0x1df000];return _0x4d9485;};'use strict';var multer=require(_0xab6d('0x0'));var util=require('util');var path=require(_0xab6d('0x1'));var timeout=require(_0xab6d('0x2'));var express=require(_0xab6d('0x3'));var router=express[_0xab6d('0x4')]();var auth=require(_0xab6d('0x5'));var interaction=require(_0xab6d('0x6'));var config=require(_0xab6d('0x7'));var controller=require('./faxMessage.controller');router['get']('/',auth[_0xab6d('0x8')](),controller[_0xab6d('0x9')]);router[_0xab6d('0xa')](_0xab6d('0xb'),auth[_0xab6d('0x8')](),controller[_0xab6d('0xc')]);router['get'](_0xab6d('0xd'),auth['isAuthenticated'](),controller[_0xab6d('0xe')]);router['get']('/:id/download',auth[_0xab6d('0x8')](),controller[_0xab6d('0xf')]);router['post']('/',auth[_0xab6d('0x8')](),interaction['tracked']('fax',_0xab6d('0x10')),controller[_0xab6d('0x11')]);router[_0xab6d('0x12')](_0xab6d('0xd'),auth[_0xab6d('0x8')](),controller[_0xab6d('0x13')]);router[_0xab6d('0x12')](_0xab6d('0x14'),auth['isAuthenticated'](),controller[_0xab6d('0x15')]);router[_0xab6d('0x12')](_0xab6d('0x16'),auth[_0xab6d('0x8')](),controller[_0xab6d('0x17')]);router[_0xab6d('0x18')]('/:id',auth[_0xab6d('0x8')](),controller[_0xab6d('0x19')]);module[_0xab6d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 7689142..9eb12f3 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 _0x30b7=['beepall','roundrobin','sequelize','exports','INTEGER','ENUM'];(function(_0x30e750,_0x74daf){var _0x1f32dd=function(_0x23ddf8){while(--_0x23ddf8){_0x30e750['push'](_0x30e750['shift']());}};_0x1f32dd(++_0x74daf);}(_0x30b7,0x164));var _0x730b=function(_0x2b9e2a,_0x49459b){_0x2b9e2a=_0x2b9e2a-0x0;var _0xb21a93=_0x30b7[_0x2b9e2a];return _0xb21a93;};'use strict';var Sequelize=require(_0x730b('0x0'));module[_0x730b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x730b('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x730b('0x3')]('rrmemory',_0x730b('0x4'),_0x730b('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x730b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfc87=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0xf858e,_0x51b0f1){var _0x5344d8=function(_0x5219d6){while(--_0x5219d6){_0xf858e['push'](_0xf858e['shift']());}};_0x5344d8(++_0x51b0f1);}(_0xfc87,0x1ce));var _0x7fc8=function(_0x5b4dca,_0x40dc56){_0x5b4dca=_0x5b4dca-0x0;var _0x5b38bf=_0xfc87[_0x5b4dca];return _0x5b38bf;};'use strict';var Sequelize=require(_0x7fc8('0x0'));module[_0x7fc8('0x1')]={'name':{'type':Sequelize[_0x7fc8('0x2')],'unique':_0x7fc8('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7fc8('0x2')]},'timeout':{'type':Sequelize[_0x7fc8('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7fc8('0x5')]('rrmemory',_0x7fc8('0x6'),_0x7fc8('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x7fc8('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 1dd6506..f11d76c 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 _0xfd3a=['User','online','voicePause','interface','flatMap','Agents','each','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeAgents','addAgents','ids','spread','userFaxQueue:save','userFaxQueue:remove','getAgents','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','then','get','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxQueue','rows','catch','show','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserFaxQueue','order','FaxQueueId','findAll','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams'];(function(_0x5dec16,_0x537783){var _0x52392f=function(_0x2c611e){while(--_0x2c611e){_0x5dec16['push'](_0x5dec16['shift']());}};_0x52392f(++_0x537783);}(_0xfd3a,0xb1));var _0xafd3=function(_0x15758a,_0x740ead){_0x15758a=_0x15758a-0x0;var _0x194a6c=_0xfd3a[_0x15758a];return _0x194a6c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xafd3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xafd3('0x1'));var moment=require(_0xafd3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xafd3('0x3'));var util=require(_0xafd3('0x4'));var path=require(_0xafd3('0x5'));var sox=require('sox');var csv=require(_0xafd3('0x6'));var ejs=require(_0xafd3('0x7'));var fs=require('fs');var _=require(_0xafd3('0x8'));var squel=require(_0xafd3('0x9'));var crypto=require('crypto');var jsforce=require(_0xafd3('0xa'));var deskjs=require(_0xafd3('0xb'));var toCsv=require(_0xafd3('0x6'));var querystring=require('querystring');var Papa=require(_0xafd3('0xc'));var Redis=require(_0xafd3('0xd'));var authService=require(_0xafd3('0xe'));var qs=require(_0xafd3('0xf'));var as=require(_0xafd3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xafd3('0x11'))(_0xafd3('0x12'));var utils=require(_0xafd3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xafd3('0x14'));var db=require('../../mysqldb')['db'];config[_0xafd3('0x15')]=_[_0xafd3('0x16')](config[_0xafd3('0x15')],{'host':_0xafd3('0x17'),'port':0x18eb});var socket=require(_0xafd3('0x18'))(new Redis(config['redis']));require(_0xafd3('0x19'))['register'](socket);function respondWithStatusCode(_0x5872d1,_0x568e13){_0x568e13=_0x568e13||0xcc;return function(_0x5ede91){if(_0x5ede91){return _0x5872d1[_0xafd3('0x1a')](_0x568e13);}return _0x5872d1[_0xafd3('0x1b')](_0x568e13)[_0xafd3('0x1c')]();};}function respondWithResult(_0x30b33c,_0x32a27b){_0x32a27b=_0x32a27b||0xc8;return function(_0x4ecee8){if(_0x4ecee8){return _0x30b33c[_0xafd3('0x1b')](_0x32a27b)[_0xafd3('0x1d')](_0x4ecee8);}};}function respondWithFilteredResult(_0x1d1c33,_0x1f16fa){return function(_0x125dc8){if(_0x125dc8){var _0x5195c9=_0x125dc8[_0xafd3('0x1e')],_0x28d2e0=_0x1f16fa['offset'],_0x49b5fc=_0x1f16fa[_0xafd3('0x1f')]+_0x1f16fa[_0xafd3('0x20')],_0x496a03;if(_0x49b5fc>=_0x5195c9){_0x49b5fc=_0x5195c9;_0x496a03=0xc8;}else{_0x496a03=0xce;}_0x1d1c33['status'](_0x496a03);return _0x1d1c33['set'](_0xafd3('0x21'),_0x28d2e0+'-'+_0x49b5fc+'/'+_0x5195c9)[_0xafd3('0x1d')](_0x125dc8);}return null;};}function patchUpdates(_0x230d11){return function(_0x670ac8){try{jsonpatch['apply'](_0x670ac8,_0x230d11,!![]);}catch(_0x524f7e){return BPromise['reject'](_0x524f7e);}return _0x670ac8[_0xafd3('0x22')]();};}function saveUpdates(_0x5a3157,_0x1363d5){return function(_0x754ea9){if(_0x754ea9){return _0x754ea9[_0xafd3('0x23')](_0x5a3157)[_0xafd3('0x24')](function(_0x57c09d){return _0x57c09d;});}return null;};}function removeEntity(_0x103852,_0x5e2c9b){return function(_0x469a87){if(_0x469a87){return _0x469a87['destroy']()[_0xafd3('0x24')](function(){var _0x18d0e0=_0x469a87[_0xafd3('0x25')]({'plain':!![]});var _0x479d5c=_0xafd3('0x26');return db[_0xafd3('0x27')][_0xafd3('0x28')]({'where':{'type':_0x479d5c,'resourceId':_0x18d0e0['id']}})[_0xafd3('0x24')](function(){return _0x469a87;});})[_0xafd3('0x24')](function(){_0x103852[_0xafd3('0x1b')](0xcc)[_0xafd3('0x1c')]();});}};}function handleEntityNotFound(_0x27cd75,_0x19b6ac){return function(_0x33810f){if(!_0x33810f){_0x27cd75['sendStatus'](0x194);}return _0x33810f;};}function handleError(_0x33f582,_0x50f73d){_0x50f73d=_0x50f73d||0x1f4;return function(_0x44313f){logger[_0xafd3('0x29')](_0x44313f[_0xafd3('0x2a')]);if(_0x44313f[_0xafd3('0x2b')]){delete _0x44313f[_0xafd3('0x2b')];}_0x33f582['status'](_0x50f73d)[_0xafd3('0x2c')](_0x44313f);};}exports[_0xafd3('0x2d')]=function(_0x102b29,_0x5bf915){var _0x687cf0={},_0x227e9b={},_0x17eea2={'count':0x0,'rows':[]};var _0x1643d8=_[_0xafd3('0x2e')](db['FaxQueue'][_0xafd3('0x2f')],function(_0x4374a1){return{'name':_0x4374a1['fieldName'],'type':_0x4374a1[_0xafd3('0x30')][_0xafd3('0x31')]};});_0x227e9b[_0xafd3('0x32')]=_[_0xafd3('0x2e')](_0x1643d8,_0xafd3('0x2b'));_0x227e9b[_0xafd3('0x33')]=_[_0xafd3('0x34')](_0x102b29['query']);_0x227e9b['filters']=_[_0xafd3('0x35')](_0x227e9b[_0xafd3('0x32')],_0x227e9b[_0xafd3('0x33')]);_0x687cf0[_0xafd3('0x36')]=_[_0xafd3('0x35')](_0x227e9b['model'],qs[_0xafd3('0x37')](_0x102b29['query'][_0xafd3('0x37')]));_0x687cf0[_0xafd3('0x36')]=_0x687cf0['attributes'][_0xafd3('0x38')]?_0x687cf0['attributes']:_0x227e9b[_0xafd3('0x32')];if(!_0x102b29['query'][_0xafd3('0x39')](_0xafd3('0x3a'))){_0x687cf0[_0xafd3('0x20')]=qs[_0xafd3('0x20')](_0x102b29['query'][_0xafd3('0x20')]);_0x687cf0[_0xafd3('0x1f')]=qs['offset'](_0x102b29['query'][_0xafd3('0x1f')]);}_0x687cf0['order']=qs[_0xafd3('0x3b')](_0x102b29[_0xafd3('0x33')][_0xafd3('0x3b')]);_0x687cf0[_0xafd3('0x3c')]=qs[_0xafd3('0x3d')](_[_0xafd3('0x3e')](_0x102b29[_0xafd3('0x33')],_0x227e9b[_0xafd3('0x3d')]),_0x1643d8);if(_0x102b29['query'][_0xafd3('0x3f')]){_0x687cf0[_0xafd3('0x3c')]=_[_0xafd3('0x40')](_0x687cf0['where'],{'$or':_['map'](_0x1643d8,function(_0x35f4cb){if(_0x35f4cb[_0xafd3('0x30')]!==_0xafd3('0x41')){var _0x29b09c={};_0x29b09c[_0x35f4cb[_0xafd3('0x2b')]]={'$like':'%'+_0x102b29[_0xafd3('0x33')][_0xafd3('0x3f')]+'%'};return _0x29b09c;}})});}_0x687cf0=_[_0xafd3('0x40')]({},_0x687cf0,_0x102b29[_0xafd3('0x42')]);var _0x228a77={'where':_0x687cf0[_0xafd3('0x3c')]};return db[_0xafd3('0x43')][_0xafd3('0x1e')](_0x228a77)['then'](function(_0x3cebd4){_0x17eea2['count']=_0x3cebd4;if(_0x102b29[_0xafd3('0x33')]['includeAll']){_0x687cf0['include']=[{'all':!![]}];}return db[_0xafd3('0x43')]['findAll'](_0x687cf0);})['then'](function(_0x37a466){_0x17eea2[_0xafd3('0x44')]=_0x37a466;return _0x17eea2;})[_0xafd3('0x24')](respondWithFilteredResult(_0x5bf915,_0x687cf0))[_0xafd3('0x45')](handleError(_0x5bf915,null));};exports[_0xafd3('0x46')]=function(_0x265869,_0x56247c){var _0x1d23b3={'raw':!![],'where':{'id':_0x265869['params']['id']}},_0x7e3bc8={};_0x7e3bc8['model']=_[_0xafd3('0x34')](db[_0xafd3('0x43')][_0xafd3('0x2f')]);_0x7e3bc8[_0xafd3('0x33')]=_[_0xafd3('0x34')](_0x265869['query']);_0x7e3bc8[_0xafd3('0x3d')]=_[_0xafd3('0x35')](_0x7e3bc8[_0xafd3('0x32')],_0x7e3bc8[_0xafd3('0x33')]);_0x1d23b3['attributes']=_[_0xafd3('0x35')](_0x7e3bc8[_0xafd3('0x32')],qs['fields'](_0x265869['query'][_0xafd3('0x37')]));_0x1d23b3['attributes']=_0x1d23b3[_0xafd3('0x36')]['length']?_0x1d23b3['attributes']:_0x7e3bc8[_0xafd3('0x32')];if(_0x265869[_0xafd3('0x33')][_0xafd3('0x47')]){_0x1d23b3[_0xafd3('0x48')]=[{'all':!![]}];}_0x1d23b3=_[_0xafd3('0x40')]({},_0x1d23b3,_0x265869[_0xafd3('0x42')]);return db['FaxQueue'][_0xafd3('0x49')](_0x1d23b3)[_0xafd3('0x24')](handleEntityNotFound(_0x56247c,null))[_0xafd3('0x24')](respondWithResult(_0x56247c,null))[_0xafd3('0x45')](handleError(_0x56247c,null));};exports[_0xafd3('0x4a')]=function(_0x59c2e2,_0x4f5a47){return db[_0xafd3('0x43')][_0xafd3('0x4a')](_0x59c2e2[_0xafd3('0x4b')],{})[_0xafd3('0x24')](function(_0x460dfe){var _0x268023=_0x59c2e2[_0xafd3('0x4c')][_0xafd3('0x25')]({'plain':!![]});if(!_0x268023)throw new Error(_0xafd3('0x4d'));if(_0x268023[_0xafd3('0x4e')]===_0xafd3('0x4c')){var _0x5be884=_0x460dfe[_0xafd3('0x25')]({'plain':!![]});var _0x537a0c=_0xafd3('0x26');return db[_0xafd3('0x4f')][_0xafd3('0x49')]({'where':{'name':_0x537a0c,'userProfileId':_0x268023[_0xafd3('0x50')]},'raw':!![]})[_0xafd3('0x24')](function(_0x267eea){if(_0x267eea&&_0x267eea[_0xafd3('0x51')]===0x0){return db['UserProfileResource'][_0xafd3('0x4a')]({'name':_0x5be884[_0xafd3('0x2b')],'resourceId':_0x5be884['id'],'type':_0x267eea[_0xafd3('0x2b')],'sectionId':_0x267eea['id']},{})[_0xafd3('0x24')](function(){return _0x460dfe;});}else{return _0x460dfe;}})[_0xafd3('0x45')](function(_0x5a7b53){logger[_0xafd3('0x29')](_0xafd3('0x52'),_0x5a7b53);throw _0x5a7b53;});}return _0x460dfe;})[_0xafd3('0x24')](respondWithResult(_0x4f5a47,0xc9))[_0xafd3('0x45')](handleError(_0x4f5a47,null));};exports[_0xafd3('0x23')]=function(_0x44a8d3,_0x1cfd90){if(_0x44a8d3['body']['id']){delete _0x44a8d3[_0xafd3('0x4b')]['id'];}return db['FaxQueue'][_0xafd3('0x49')]({'where':{'id':_0x44a8d3[_0xafd3('0x53')]['id']}})['then'](handleEntityNotFound(_0x1cfd90,null))[_0xafd3('0x24')](saveUpdates(_0x44a8d3['body'],null))[_0xafd3('0x24')](respondWithResult(_0x1cfd90,null))[_0xafd3('0x45')](handleError(_0x1cfd90,null));};exports[_0xafd3('0x28')]=function(_0x1291b3,_0xff21d6){return db[_0xafd3('0x43')][_0xafd3('0x49')]({'where':{'id':_0x1291b3[_0xafd3('0x53')]['id']}})[_0xafd3('0x24')](handleEntityNotFound(_0xff21d6,null))[_0xafd3('0x24')](removeEntity(_0xff21d6,null))['catch'](handleError(_0xff21d6,null));};exports[_0xafd3('0x54')]=function(_0x1c4557,_0x88780c){return db[_0xafd3('0x43')][_0xafd3('0x54')]()[_0xafd3('0x24')](respondWithResult(_0x88780c,null))['catch'](handleError(_0x88780c,null));};exports[_0xafd3('0x55')]=function(_0x49e89f,_0x1ed837,_0x5b86e5){var _0xa9eec7={'raw':!![],'where':{}},_0x18a928={},_0x27cdcb;return db[_0xafd3('0x43')][_0xafd3('0x56')]({'where':{'id':_0x49e89f[_0xafd3('0x53')]['id']}})['then'](handleEntityNotFound(_0x1ed837,null))['then'](function(_0x5a28ef){if(_0x5a28ef){_0x27cdcb=_0x5a28ef[_0xafd3('0x25')]({'plain':!![]});_0x18a928[_0xafd3('0x32')]=_[_0xafd3('0x34')](db[_0xafd3('0x57')][_0xafd3('0x2f')]);_0x18a928[_0xafd3('0x33')]=_[_0xafd3('0x34')](_0x49e89f['query']);_0x18a928[_0xafd3('0x3d')]=_['intersection'](_0x18a928[_0xafd3('0x32')],_0x18a928[_0xafd3('0x33')]);_0xa9eec7[_0xafd3('0x36')]=_[_0xafd3('0x35')](_0x18a928['model'],qs[_0xafd3('0x37')](_0x49e89f[_0xafd3('0x33')][_0xafd3('0x37')]));_0xa9eec7[_0xafd3('0x36')]=_0xa9eec7['attributes'][_0xafd3('0x38')]?_0xa9eec7[_0xafd3('0x36')]:_0x18a928[_0xafd3('0x32')];if(!_0x49e89f[_0xafd3('0x33')]['hasOwnProperty'](_0xafd3('0x3a'))){_0xa9eec7[_0xafd3('0x20')]=qs['limit'](_0x49e89f[_0xafd3('0x33')][_0xafd3('0x20')]);_0xa9eec7['offset']=qs['offset'](_0x49e89f[_0xafd3('0x33')][_0xafd3('0x1f')]);}_0xa9eec7[_0xafd3('0x58')]=qs[_0xafd3('0x3b')](_0x49e89f['query'][_0xafd3('0x3b')]);_0xa9eec7['where']=qs[_0xafd3('0x3d')](_[_0xafd3('0x3e')](_0x49e89f['query'],_0x18a928[_0xafd3('0x3d')]));_0xa9eec7['where'][_0xafd3('0x59')]=_0x5a28ef['id'];if(_0x49e89f[_0xafd3('0x33')][_0xafd3('0x3f')]){_0xa9eec7['where']=_[_0xafd3('0x40')](_0xa9eec7['where'],{'$or':_[_0xafd3('0x2e')](_0xa9eec7[_0xafd3('0x36')],function(_0x3cf0d7){var _0x11550b={};_0x11550b[_0x3cf0d7]={'$like':'%'+_0x49e89f[_0xafd3('0x33')][_0xafd3('0x3f')]+'%'};return _0x11550b;})});}_0xa9eec7=_[_0xafd3('0x40')]({},_0xa9eec7,_0x49e89f[_0xafd3('0x42')]);return db[_0xafd3('0x57')][_0xafd3('0x5a')](_0xa9eec7);}})[_0xafd3('0x24')](function(_0x1174df){if(_0x1174df){return db['User'][_0xafd3('0x5b')]({'where':{'id':_[_0xafd3('0x2e')](_0x1174df,_0xafd3('0x5c')),'role':_0xafd3('0x5d')},'attributes':['id',_0xafd3('0x2b'),_0xafd3('0x5e'),_0xafd3('0x5f'),_0xafd3('0x60')]});}})[_0xafd3('0x24')](function(_0x7811a){if(_0x7811a){return{'count':_0x7811a['count'],'rows':_[_0xafd3('0x2e')](_0x7811a['rows'],function(_0x5f119a){return{'membername':_0x5f119a['name'],'UserId':_0x5f119a['id'],'queue_name':_0x27cdcb['name'],'FaxQueueId':_0x27cdcb['id'],'interface':util[_0xafd3('0x61')](_0xafd3('0x62'),_0xafd3('0x63'),_0x5f119a[_0xafd3('0x2b')]),'penalty':0x0,'paused':_0x5f119a[_0xafd3('0x5e')],'createdAt':_0x5f119a[_0xafd3('0x60')],'updatedAt':_0x5f119a[_0xafd3('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xafd3('0x24')](respondWithFilteredResult(_0x1ed837,_0xa9eec7))[_0xafd3('0x45')](handleError(_0x1ed837,null));};exports[_0xafd3('0x64')]=function(_0x419825,_0x208894,_0x150e9e){var _0x3c5657={};var _0x4b3227={};var _0x381bed;var _0x230787;return db[_0xafd3('0x43')][_0xafd3('0x56')]({'where':{'id':_0x419825['params']['id']}})[_0xafd3('0x24')](handleEntityNotFound(_0x208894,null))['then'](function(_0x358ea5){if(_0x358ea5){_0x381bed=_0x358ea5;_0x4b3227[_0xafd3('0x32')]=_[_0xafd3('0x34')](db[_0xafd3('0x65')][_0xafd3('0x2f')]);_0x4b3227[_0xafd3('0x33')]=_[_0xafd3('0x34')](_0x419825[_0xafd3('0x33')]);_0x4b3227[_0xafd3('0x3d')]=_[_0xafd3('0x35')](_0x4b3227['model'],_0x4b3227['query']);_0x3c5657[_0xafd3('0x36')]=_[_0xafd3('0x35')](_0x4b3227[_0xafd3('0x32')],qs[_0xafd3('0x37')](_0x419825['query']['fields']));_0x3c5657[_0xafd3('0x36')]=_0x3c5657[_0xafd3('0x36')][_0xafd3('0x38')]?_0x3c5657[_0xafd3('0x36')]:_0x4b3227['model'];_0x3c5657[_0xafd3('0x58')]=qs['sort'](_0x419825['query'][_0xafd3('0x3b')]);_0x3c5657[_0xafd3('0x3c')]=qs[_0xafd3('0x3d')](_[_0xafd3('0x3e')](_0x419825[_0xafd3('0x33')],_0x4b3227[_0xafd3('0x3d')]));if(_0x419825[_0xafd3('0x33')][_0xafd3('0x3f')]){_0x3c5657['where']=_[_0xafd3('0x40')](_0x3c5657[_0xafd3('0x3c')],{'$or':_[_0xafd3('0x2e')](_0x3c5657[_0xafd3('0x36')],function(_0x4ffeb6){var _0x1d34f0={};_0x1d34f0[_0x4ffeb6]={'$like':'%'+_0x419825[_0xafd3('0x33')][_0xafd3('0x3f')]+'%'};return _0x1d34f0;})});}_0x3c5657=_[_0xafd3('0x40')]({},_0x3c5657,_0x419825[_0xafd3('0x42')]);return _0x381bed[_0xafd3('0x64')](_0x3c5657);}})[_0xafd3('0x24')](function(_0x596de9){if(_0x596de9){_0x230787=_0x596de9[_0xafd3('0x38')];if(!_0x419825[_0xafd3('0x33')][_0xafd3('0x39')](_0xafd3('0x3a'))){_0x3c5657[_0xafd3('0x20')]=qs[_0xafd3('0x20')](_0x419825['query']['limit']);_0x3c5657[_0xafd3('0x1f')]=qs['offset'](_0x419825['query'][_0xafd3('0x1f')]);}return _0x381bed[_0xafd3('0x64')](_0x3c5657);}})[_0xafd3('0x24')](function(_0x333e41){if(_0x333e41){return _0x333e41?{'count':_0x230787,'rows':_0x333e41}:null;}})[_0xafd3('0x24')](respondWithResult(_0x208894,null))[_0xafd3('0x45')](handleError(_0x208894,null));};exports[_0xafd3('0x66')]=function(_0x181162,_0x6e05b0,_0x49f044){var _0x420e84=_0x181162[_0xafd3('0x4b')]['ids'];return db[_0xafd3('0x65')][_0xafd3('0x5a')]({'where':{'id':_0x420e84},'attributes':['id'],'include':[{'model':db[_0xafd3('0x67')],'as':'Agents','attributes':['id',_0xafd3('0x2b'),_0xafd3('0x68'),_0xafd3('0x69'),_0xafd3('0x6a')],'raw':!![]}]})[_0xafd3('0x24')](function(_0x9c2e67){if(_0x9c2e67){var _0x3ec7a4=_[_0xafd3('0x6b')](_0x9c2e67,function(_0x22a55d){var _0x268174=_0x22a55d['get']({'plain':!![]});return _0x268174[_0xafd3('0x6c')];});return db[_0xafd3('0x43')][_0xafd3('0x49')]({'where':{'id':_0x181162[_0xafd3('0x53')]['id']}})[_0xafd3('0x24')](function(_0x3e3031){return db['sequelize']['transaction'](function(_0x3cdb39){return _0x3e3031[_0xafd3('0x66')](_0x420e84,{'transaction':_0x3cdb39})['then'](function(){return BPromise[_0xafd3('0x6d')](_0x3ec7a4,function(_0x7d9655){return db[_0xafd3('0x57')]['findOrCreate']({'where':{'UserId':_0x7d9655['id'],'FaxQueueId':_0x181162[_0xafd3('0x53')]['id']},'transaction':_0x3cdb39});});})['then'](function(){_0x3ec7a4['forEach'](function(_0x4db317){socket[_0xafd3('0x6e')]('userFaxQueue:save',{'UserId':_0x4db317['id'],'FaxQueueId':_0x3e3031['id']});});});});});}})['then'](respondWithStatusCode(_0x6e05b0,null))[_0xafd3('0x45')](handleError(_0x6e05b0,null));};exports[_0xafd3('0x6f')]=function(_0x30720b,_0x4db89d,_0x4b71a8){return db[_0xafd3('0x65')][_0xafd3('0x5a')]({'where':{'id':_0x30720b[_0xafd3('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0xafd3('0x67')],'as':_0xafd3('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4db89d,null))[_0xafd3('0x24')](function(_0x671e6e){var _0x416979=_[_0xafd3('0x2e')](_0x671e6e,'id');var _0x2a6e2b=[];var _0x2d43cb=[];var _0xda192=squel[_0xafd3('0x70')]();_0xda192[_0xafd3('0x71')](_0xafd3('0x72'))[_0xafd3('0x73')](_0xafd3('0x74'),'tq')[_0xafd3('0x75')](_0xafd3('0x76'),'ut',_0xafd3('0x77'))[_0xafd3('0x3c')]('FaxQueueId\x20=\x20?',_0x30720b[_0xafd3('0x53')]['id']);for(var _0x42bf93=0x0;_0x42bf93<_0x671e6e[_0xafd3('0x38')];_0x42bf93+=0x1){let _0x4eaaf3=_0x671e6e[_0x42bf93];for(var _0x391089=0x0;_0x391089<_0x4eaaf3[_0xafd3('0x6c')][_0xafd3('0x38')];_0x391089+=0x1){let _0x5113a2=_0x4eaaf3[_0xafd3('0x6c')][_0x391089];var _0x4aa055=_0xda192[_0xafd3('0x78')]();_0x4aa055[_0xafd3('0x3c')](_0xafd3('0x79'),_0x5113a2['id']);_0x2d43cb[_0xafd3('0x7a')](db[_0xafd3('0x7b')][_0xafd3('0x33')](_0x4aa055[_0xafd3('0x7c')](),{'type':db['sequelize'][_0xafd3('0x7d')][_0xafd3('0x7e')]})[_0xafd3('0x24')](function(_0x38aab6){if(_0x38aab6['length']===0x1){return _0x5113a2['id'];}else{var _0x1ac7e0=_[_0xafd3('0x7f')](_[_0xafd3('0x2e')](_0x38aab6,_0xafd3('0x80')),function(_0x300ac0){return _['includes'](_0x416979,_0x300ac0);});if(_0x1ac7e0){return _0x5113a2['id'];}}}));}}return BPromise[_0xafd3('0x81')](_0x2d43cb)[_0xafd3('0x24')](function(_0x3f162f){_0x2a6e2b=_(_0x2a6e2b)[_0xafd3('0x82')](_0x3f162f)[_0xafd3('0x83')]()[_0xafd3('0x84')]();return db['FaxQueue']['find']({'where':{'id':_0x30720b[_0xafd3('0x53')]['id']}})[_0xafd3('0x24')](function(_0x1f28ed){return db['sequelize']['transaction'](function(_0x47940c){return _0x1f28ed[_0xafd3('0x6f')](_0x30720b[_0xafd3('0x33')]['ids'],{'transaction':_0x47940c})[_0xafd3('0x24')](function(){if(!_['isEmpty'](_0x2a6e2b)){return _0x1f28ed[_0xafd3('0x85')](_0x2a6e2b,{'transaction':_0x47940c});}})[_0xafd3('0x24')](function(){_0x2a6e2b['forEach'](function(_0x124ce7){socket['emit']('userFaxQueue:remove',{'UserId':_0x124ce7,'FaxQueueId':_0x1f28ed['id']});});});});});});})[_0xafd3('0x24')](respondWithStatusCode(_0x4db89d,null))['catch'](handleError(_0x4db89d,null));};exports[_0xafd3('0x86')]=function(_0x145cf8,_0x22afa1,_0x51397e){return db[_0xafd3('0x43')][_0xafd3('0x49')]({'where':{'id':_0x145cf8['params']['id']}})['then'](handleEntityNotFound(_0x22afa1,null))[_0xafd3('0x24')](function(_0x1f2383){if(_0x1f2383){return _0x1f2383[_0xafd3('0x86')](_0x145cf8[_0xafd3('0x4b')][_0xafd3('0x87')],_['omit'](_0x145cf8[_0xafd3('0x4b')],[_0xafd3('0x87'),'id'])||{})[_0xafd3('0x88')](function(_0x162a04){for(var _0x5dc021=0x0;_0x5dc021<_0x145cf8[_0xafd3('0x4b')][_0xafd3('0x87')]['length'];_0x5dc021+=0x1){socket[_0xafd3('0x6e')](_0xafd3('0x89'),{'UserId':_0x145cf8[_0xafd3('0x4b')]['ids'][_0x5dc021],'FaxQueueId':_0x145cf8[_0xafd3('0x53')]['id']});}return _0x162a04;});}})['then'](respondWithResult(_0x22afa1,null))['catch'](handleError(_0x22afa1,null));};exports[_0xafd3('0x85')]=function(_0x4998c1,_0xa6ca75,_0x30dd93){return db['FaxQueue'][_0xafd3('0x49')]({'where':{'id':_0x4998c1['params']['id']}})[_0xafd3('0x24')](handleEntityNotFound(_0xa6ca75,null))[_0xafd3('0x24')](function(_0x5af1d1){if(_0x5af1d1){return _0x5af1d1[_0xafd3('0x85')](_0x4998c1[_0xafd3('0x33')][_0xafd3('0x87')])['then'](function(){if(_['isArray'](_0x4998c1[_0xafd3('0x33')][_0xafd3('0x87')])){for(var _0x43392=0x0;_0x43392<_0x4998c1[_0xafd3('0x33')][_0xafd3('0x87')][_0xafd3('0x38')];_0x43392+=0x1){socket[_0xafd3('0x6e')]('userFaxQueue:remove',{'UserId':Number(_0x4998c1[_0xafd3('0x33')][_0xafd3('0x87')][_0x43392]),'FaxQueueId':Number(_0x4998c1[_0xafd3('0x53')]['id'])});}}else{socket[_0xafd3('0x6e')](_0xafd3('0x8a'),{'UserId':Number(_0x4998c1[_0xafd3('0x33')][_0xafd3('0x87')]),'FaxQueueId':Number(_0x4998c1['params']['id'])});}});}})['then'](respondWithStatusCode(_0xa6ca75,null))[_0xafd3('0x45')](handleError(_0xa6ca75,null));};exports[_0xafd3('0x8b')]=function(_0x4977a3,_0x345a2b,_0x12f22b){var _0x1cdcc6={};var _0x8a79d0={};var _0x3414c2;var _0x25eaee;return db[_0xafd3('0x43')][_0xafd3('0x56')]({'where':{'id':_0x4977a3['params']['id']}})['then'](handleEntityNotFound(_0x345a2b,null))['then'](function(_0x13dadd){if(_0x13dadd){_0x3414c2=_0x13dadd;_0x8a79d0[_0xafd3('0x32')]=_[_0xafd3('0x34')](db[_0xafd3('0x67')][_0xafd3('0x2f')]);_0x8a79d0[_0xafd3('0x33')]=_[_0xafd3('0x34')](_0x4977a3[_0xafd3('0x33')]);_0x8a79d0[_0xafd3('0x3d')]=_[_0xafd3('0x35')](_0x8a79d0[_0xafd3('0x32')],_0x8a79d0['query']);_0x1cdcc6['attributes']=_['intersection'](_0x8a79d0[_0xafd3('0x32')],qs['fields'](_0x4977a3[_0xafd3('0x33')][_0xafd3('0x37')]));_0x1cdcc6['attributes']=_0x1cdcc6[_0xafd3('0x36')][_0xafd3('0x38')]?_0x1cdcc6[_0xafd3('0x36')]:_0x8a79d0[_0xafd3('0x32')];_0x1cdcc6[_0xafd3('0x58')]=qs[_0xafd3('0x3b')](_0x4977a3[_0xafd3('0x33')][_0xafd3('0x3b')]);_0x1cdcc6['where']=qs[_0xafd3('0x3d')](_[_0xafd3('0x3e')](_0x4977a3[_0xafd3('0x33')],_0x8a79d0[_0xafd3('0x3d')]));if(_0x4977a3[_0xafd3('0x33')][_0xafd3('0x3f')]){_0x1cdcc6[_0xafd3('0x3c')]=_[_0xafd3('0x40')](_0x1cdcc6[_0xafd3('0x3c')],{'$or':_[_0xafd3('0x2e')](_0x1cdcc6['attributes'],function(_0x347c73){var _0x230359={};_0x230359[_0x347c73]={'$like':'%'+_0x4977a3[_0xafd3('0x33')][_0xafd3('0x3f')]+'%'};return _0x230359;})});}_0x1cdcc6=_[_0xafd3('0x40')]({},_0x1cdcc6,_0x4977a3[_0xafd3('0x42')]);return _0x3414c2[_0xafd3('0x8b')](_0x1cdcc6);}})[_0xafd3('0x24')](function(_0x46cbe0){if(_0x46cbe0){_0x25eaee=_0x46cbe0[_0xafd3('0x38')];if(!_0x4977a3[_0xafd3('0x33')][_0xafd3('0x39')](_0xafd3('0x3a'))){_0x1cdcc6['limit']=qs[_0xafd3('0x20')](_0x4977a3[_0xafd3('0x33')][_0xafd3('0x20')]);_0x1cdcc6['offset']=qs[_0xafd3('0x1f')](_0x4977a3[_0xafd3('0x33')][_0xafd3('0x1f')]);}return _0x3414c2[_0xafd3('0x8b')](_0x1cdcc6);}})[_0xafd3('0x24')](function(_0x3860b4){if(_0x3860b4){return _0x3860b4?{'count':_0x25eaee,'rows':_0x3860b4}:null;}})['then'](respondWithResult(_0x345a2b,null))['catch'](handleError(_0x345a2b,null));}; \ No newline at end of file +var _0x65f4=['removeAgents','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./faxQueue.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','count','includeAll','include','FaxQueue','findAll','rows','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','userProfileId','UserProfileResource','describe','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','faxPause','updatedAt','createdAt','format','%s/%s','SIP','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','userFaxQueue:remove','addAgents','omit','spread','emit'];(function(_0xe390f5,_0x4f0c7e){var _0x4f5244=function(_0x2456ed){while(--_0x2456ed){_0xe390f5['push'](_0xe390f5['shift']());}};_0x4f5244(++_0x4f0c7e);}(_0x65f4,0x19a));var _0x465f=function(_0x30e045,_0x47c751){_0x30e045=_0x30e045-0x0;var _0x284ac2=_0x65f4[_0x30e045];return _0x284ac2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x465f('0x0'));var zipdir=require(_0x465f('0x1'));var jsonpatch=require(_0x465f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x465f('0x3'));var Mustache=require(_0x465f('0x4'));var util=require(_0x465f('0x5'));var path=require('path');var sox=require(_0x465f('0x6'));var csv=require(_0x465f('0x7'));var ejs=require(_0x465f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x465f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x465f('0xa'));var toCsv=require(_0x465f('0x7'));var querystring=require(_0x465f('0xb'));var Papa=require(_0x465f('0xc'));var Redis=require(_0x465f('0xd'));var authService=require(_0x465f('0xe'));var qs=require(_0x465f('0xf'));var as=require(_0x465f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x465f('0x11'))(_0x465f('0x12'));var utils=require(_0x465f('0x13'));var config=require(_0x465f('0x14'));var licenseUtil=require(_0x465f('0x15'));var db=require(_0x465f('0x16'))['db'];config[_0x465f('0x17')]=_[_0x465f('0x18')](config[_0x465f('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x465f('0x17')]));require(_0x465f('0x19'))[_0x465f('0x1a')](socket);function respondWithStatusCode(_0x3a6c49,_0x532e49){_0x532e49=_0x532e49||0xcc;return function(_0x265569){if(_0x265569){return _0x3a6c49[_0x465f('0x1b')](_0x532e49);}return _0x3a6c49['status'](_0x532e49)['end']();};}function respondWithResult(_0x20beae,_0x211ee2){_0x211ee2=_0x211ee2||0xc8;return function(_0x3c5ad9){if(_0x3c5ad9){return _0x20beae[_0x465f('0x1c')](_0x211ee2)[_0x465f('0x1d')](_0x3c5ad9);}};}function respondWithFilteredResult(_0x5e9726,_0x2daf5b){return function(_0x99845e){if(_0x99845e){var _0x331e45=_0x99845e['count'],_0x5d469c=_0x2daf5b[_0x465f('0x1e')],_0x119227=_0x2daf5b['offset']+_0x2daf5b[_0x465f('0x1f')],_0x1b6530;if(_0x119227>=_0x331e45){_0x119227=_0x331e45;_0x1b6530=0xc8;}else{_0x1b6530=0xce;}_0x5e9726[_0x465f('0x1c')](_0x1b6530);return _0x5e9726[_0x465f('0x20')](_0x465f('0x21'),_0x5d469c+'-'+_0x119227+'/'+_0x331e45)[_0x465f('0x1d')](_0x99845e);}return null;};}function patchUpdates(_0x15d843){return function(_0x2cd76d){try{jsonpatch[_0x465f('0x22')](_0x2cd76d,_0x15d843,!![]);}catch(_0x13650f){return BPromise[_0x465f('0x23')](_0x13650f);}return _0x2cd76d[_0x465f('0x24')]();};}function saveUpdates(_0x4aa4a8,_0x41e279){return function(_0x1d4575){if(_0x1d4575){return _0x1d4575[_0x465f('0x25')](_0x4aa4a8)[_0x465f('0x26')](function(_0x1d6677){return _0x1d6677;});}return null;};}function removeEntity(_0x2566e3,_0x944e42){return function(_0xc0a7f6){if(_0xc0a7f6){return _0xc0a7f6[_0x465f('0x27')]()[_0x465f('0x26')](function(){var _0x59ace5=_0xc0a7f6[_0x465f('0x28')]({'plain':!![]});var _0x329007='FaxQueues';return db['UserProfileResource'][_0x465f('0x27')]({'where':{'type':_0x329007,'resourceId':_0x59ace5['id']}})[_0x465f('0x26')](function(){return _0xc0a7f6;});})[_0x465f('0x26')](function(){_0x2566e3[_0x465f('0x1c')](0xcc)[_0x465f('0x29')]();});}};}function handleEntityNotFound(_0x191ada,_0x1e1ad6){return function(_0x9d9ca9){if(!_0x9d9ca9){_0x191ada[_0x465f('0x1b')](0x194);}return _0x9d9ca9;};}function handleError(_0x190506,_0x5299c4){_0x5299c4=_0x5299c4||0x1f4;return function(_0x222240){logger[_0x465f('0x2a')](_0x222240['stack']);if(_0x222240[_0x465f('0x2b')]){delete _0x222240['name'];}_0x190506[_0x465f('0x1c')](_0x5299c4)['send'](_0x222240);};}exports[_0x465f('0x2c')]=function(_0x205327,_0x1817d0){var _0x25d2d7={},_0x4c63db={},_0x462462={'count':0x0,'rows':[]};var _0x43afe0=_[_0x465f('0x2d')](db['FaxQueue'][_0x465f('0x2e')],function(_0x44884b){return{'name':_0x44884b[_0x465f('0x2f')],'type':_0x44884b['type'][_0x465f('0x30')]};});_0x4c63db[_0x465f('0x31')]=_[_0x465f('0x2d')](_0x43afe0,_0x465f('0x2b'));_0x4c63db[_0x465f('0x32')]=_['keys'](_0x205327['query']);_0x4c63db[_0x465f('0x33')]=_[_0x465f('0x34')](_0x4c63db[_0x465f('0x31')],_0x4c63db['query']);_0x25d2d7[_0x465f('0x35')]=_['intersection'](_0x4c63db[_0x465f('0x31')],qs[_0x465f('0x36')](_0x205327[_0x465f('0x32')][_0x465f('0x36')]));_0x25d2d7[_0x465f('0x35')]=_0x25d2d7[_0x465f('0x35')]['length']?_0x25d2d7['attributes']:_0x4c63db[_0x465f('0x31')];if(!_0x205327[_0x465f('0x32')][_0x465f('0x37')](_0x465f('0x38'))){_0x25d2d7[_0x465f('0x1f')]=qs['limit'](_0x205327[_0x465f('0x32')][_0x465f('0x1f')]);_0x25d2d7[_0x465f('0x1e')]=qs[_0x465f('0x1e')](_0x205327['query']['offset']);}_0x25d2d7[_0x465f('0x39')]=qs['sort'](_0x205327[_0x465f('0x32')][_0x465f('0x3a')]);_0x25d2d7[_0x465f('0x3b')]=qs[_0x465f('0x33')](_[_0x465f('0x3c')](_0x205327['query'],_0x4c63db[_0x465f('0x33')]),_0x43afe0);if(_0x205327[_0x465f('0x32')][_0x465f('0x3d')]){_0x25d2d7[_0x465f('0x3b')]=_['merge'](_0x25d2d7[_0x465f('0x3b')],{'$or':_[_0x465f('0x2d')](_0x43afe0,function(_0x4b7289){if(_0x4b7289[_0x465f('0x3e')]!=='VIRTUAL'){var _0xc0f949={};_0xc0f949[_0x4b7289['name']]={'$like':'%'+_0x205327['query'][_0x465f('0x3d')]+'%'};return _0xc0f949;}})});}_0x25d2d7=_[_0x465f('0x3f')]({},_0x25d2d7,_0x205327[_0x465f('0x40')]);var _0x134408={'where':_0x25d2d7[_0x465f('0x3b')]};return db['FaxQueue'][_0x465f('0x41')](_0x134408)[_0x465f('0x26')](function(_0x362f6e){_0x462462[_0x465f('0x41')]=_0x362f6e;if(_0x205327[_0x465f('0x32')][_0x465f('0x42')]){_0x25d2d7[_0x465f('0x43')]=[{'all':!![]}];}return db[_0x465f('0x44')][_0x465f('0x45')](_0x25d2d7);})['then'](function(_0x278d16){_0x462462[_0x465f('0x46')]=_0x278d16;return _0x462462;})[_0x465f('0x26')](respondWithFilteredResult(_0x1817d0,_0x25d2d7))[_0x465f('0x47')](handleError(_0x1817d0,null));};exports[_0x465f('0x48')]=function(_0x3541c8,_0x3cde3b){var _0x11d46c={'raw':!![],'where':{'id':_0x3541c8[_0x465f('0x49')]['id']}},_0x18cb1a={};_0x18cb1a[_0x465f('0x31')]=_[_0x465f('0x4a')](db[_0x465f('0x44')][_0x465f('0x2e')]);_0x18cb1a[_0x465f('0x32')]=_[_0x465f('0x4a')](_0x3541c8[_0x465f('0x32')]);_0x18cb1a[_0x465f('0x33')]=_[_0x465f('0x34')](_0x18cb1a[_0x465f('0x31')],_0x18cb1a[_0x465f('0x32')]);_0x11d46c[_0x465f('0x35')]=_[_0x465f('0x34')](_0x18cb1a[_0x465f('0x31')],qs[_0x465f('0x36')](_0x3541c8[_0x465f('0x32')]['fields']));_0x11d46c[_0x465f('0x35')]=_0x11d46c[_0x465f('0x35')][_0x465f('0x4b')]?_0x11d46c[_0x465f('0x35')]:_0x18cb1a[_0x465f('0x31')];if(_0x3541c8[_0x465f('0x32')][_0x465f('0x42')]){_0x11d46c[_0x465f('0x43')]=[{'all':!![]}];}_0x11d46c=_[_0x465f('0x3f')]({},_0x11d46c,_0x3541c8[_0x465f('0x40')]);return db[_0x465f('0x44')][_0x465f('0x4c')](_0x11d46c)['then'](handleEntityNotFound(_0x3cde3b,null))[_0x465f('0x26')](respondWithResult(_0x3cde3b,null))[_0x465f('0x47')](handleError(_0x3cde3b,null));};exports[_0x465f('0x4d')]=function(_0x3d7c25,_0x42d3aa){return db[_0x465f('0x44')][_0x465f('0x4d')](_0x3d7c25[_0x465f('0x4e')],{})[_0x465f('0x26')](function(_0x1fb8c8){var _0xe4a23=_0x3d7c25[_0x465f('0x4f')][_0x465f('0x28')]({'plain':!![]});if(!_0xe4a23)throw new Error(_0x465f('0x50'));if(_0xe4a23[_0x465f('0x51')]===_0x465f('0x4f')){var _0x594d11=_0x1fb8c8['get']({'plain':!![]});var _0x381272=_0x465f('0x52');return db['UserProfileSection']['find']({'where':{'name':_0x381272,'userProfileId':_0xe4a23[_0x465f('0x53')]},'raw':!![]})[_0x465f('0x26')](function(_0x3c06ac){if(_0x3c06ac&&_0x3c06ac['autoAssociation']===0x0){return db[_0x465f('0x54')][_0x465f('0x4d')]({'name':_0x594d11[_0x465f('0x2b')],'resourceId':_0x594d11['id'],'type':_0x3c06ac[_0x465f('0x2b')],'sectionId':_0x3c06ac['id']},{})[_0x465f('0x26')](function(){return _0x1fb8c8;});}else{return _0x1fb8c8;}})[_0x465f('0x47')](function(_0x2c6a90){logger[_0x465f('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c6a90);throw _0x2c6a90;});}return _0x1fb8c8;})[_0x465f('0x26')](respondWithResult(_0x42d3aa,0xc9))[_0x465f('0x47')](handleError(_0x42d3aa,null));};exports[_0x465f('0x25')]=function(_0x425894,_0x551adf){if(_0x425894['body']['id']){delete _0x425894['body']['id'];}return db[_0x465f('0x44')][_0x465f('0x4c')]({'where':{'id':_0x425894[_0x465f('0x49')]['id']}})[_0x465f('0x26')](handleEntityNotFound(_0x551adf,null))['then'](saveUpdates(_0x425894[_0x465f('0x4e')],null))[_0x465f('0x26')](respondWithResult(_0x551adf,null))['catch'](handleError(_0x551adf,null));};exports[_0x465f('0x27')]=function(_0x15e947,_0x3f8400){return db['FaxQueue'][_0x465f('0x4c')]({'where':{'id':_0x15e947[_0x465f('0x49')]['id']}})[_0x465f('0x26')](handleEntityNotFound(_0x3f8400,null))[_0x465f('0x26')](removeEntity(_0x3f8400,null))[_0x465f('0x47')](handleError(_0x3f8400,null));};exports['describe']=function(_0x388eba,_0x51cfb5){return db[_0x465f('0x44')][_0x465f('0x55')]()[_0x465f('0x26')](respondWithResult(_0x51cfb5,null))[_0x465f('0x47')](handleError(_0x51cfb5,null));};exports['getMembers']=function(_0x3c21c7,_0x3f5e1e,_0x57b211){var _0x199cbd={'raw':!![],'where':{}},_0xa314ef={},_0x263a9e;return db[_0x465f('0x44')][_0x465f('0x56')]({'where':{'id':_0x3c21c7[_0x465f('0x49')]['id']}})[_0x465f('0x26')](handleEntityNotFound(_0x3f5e1e,null))[_0x465f('0x26')](function(_0x56c83e){if(_0x56c83e){_0x263a9e=_0x56c83e['get']({'plain':!![]});_0xa314ef[_0x465f('0x31')]=_[_0x465f('0x4a')](db[_0x465f('0x57')][_0x465f('0x2e')]);_0xa314ef[_0x465f('0x32')]=_[_0x465f('0x4a')](_0x3c21c7[_0x465f('0x32')]);_0xa314ef[_0x465f('0x33')]=_[_0x465f('0x34')](_0xa314ef[_0x465f('0x31')],_0xa314ef[_0x465f('0x32')]);_0x199cbd[_0x465f('0x35')]=_[_0x465f('0x34')](_0xa314ef[_0x465f('0x31')],qs[_0x465f('0x36')](_0x3c21c7[_0x465f('0x32')][_0x465f('0x36')]));_0x199cbd[_0x465f('0x35')]=_0x199cbd[_0x465f('0x35')][_0x465f('0x4b')]?_0x199cbd[_0x465f('0x35')]:_0xa314ef['model'];if(!_0x3c21c7['query'][_0x465f('0x37')](_0x465f('0x38'))){_0x199cbd[_0x465f('0x1f')]=qs[_0x465f('0x1f')](_0x3c21c7['query'][_0x465f('0x1f')]);_0x199cbd['offset']=qs['offset'](_0x3c21c7[_0x465f('0x32')][_0x465f('0x1e')]);}_0x199cbd[_0x465f('0x39')]=qs[_0x465f('0x3a')](_0x3c21c7[_0x465f('0x32')][_0x465f('0x3a')]);_0x199cbd[_0x465f('0x3b')]=qs[_0x465f('0x33')](_[_0x465f('0x3c')](_0x3c21c7['query'],_0xa314ef['filters']));_0x199cbd[_0x465f('0x3b')][_0x465f('0x58')]=_0x56c83e['id'];if(_0x3c21c7[_0x465f('0x32')][_0x465f('0x3d')]){_0x199cbd[_0x465f('0x3b')]=_[_0x465f('0x3f')](_0x199cbd[_0x465f('0x3b')],{'$or':_[_0x465f('0x2d')](_0x199cbd[_0x465f('0x35')],function(_0x1f8568){var _0x45e761={};_0x45e761[_0x1f8568]={'$like':'%'+_0x3c21c7[_0x465f('0x32')][_0x465f('0x3d')]+'%'};return _0x45e761;})});}_0x199cbd=_['merge']({},_0x199cbd,_0x3c21c7[_0x465f('0x40')]);return db[_0x465f('0x57')][_0x465f('0x45')](_0x199cbd);}})[_0x465f('0x26')](function(_0x12de31){if(_0x12de31){return db[_0x465f('0x59')][_0x465f('0x5a')]({'where':{'id':_['map'](_0x12de31,'UserId'),'role':'agent'},'attributes':['id',_0x465f('0x2b'),_0x465f('0x5b'),_0x465f('0x5c'),_0x465f('0x5d')]});}})[_0x465f('0x26')](function(_0x5d51c2){if(_0x5d51c2){return{'count':_0x5d51c2[_0x465f('0x41')],'rows':_['map'](_0x5d51c2[_0x465f('0x46')],function(_0x5be8f4){return{'membername':_0x5be8f4[_0x465f('0x2b')],'UserId':_0x5be8f4['id'],'queue_name':_0x263a9e[_0x465f('0x2b')],'FaxQueueId':_0x263a9e['id'],'interface':util[_0x465f('0x5e')](_0x465f('0x5f'),_0x465f('0x60'),_0x5be8f4[_0x465f('0x2b')]),'penalty':0x0,'paused':_0x5be8f4[_0x465f('0x5b')],'createdAt':_0x5be8f4[_0x465f('0x5d')],'updatedAt':_0x5be8f4[_0x465f('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3f5e1e,_0x199cbd))[_0x465f('0x47')](handleError(_0x3f5e1e,null));};exports['getTeams']=function(_0x24f6a9,_0x12ebbf,_0x378c41){var _0x114e94={};var _0x585d01={};var _0x1fa4d3;var _0x8e992a;return db['FaxQueue'][_0x465f('0x56')]({'where':{'id':_0x24f6a9[_0x465f('0x49')]['id']}})['then'](handleEntityNotFound(_0x12ebbf,null))[_0x465f('0x26')](function(_0x1e7714){if(_0x1e7714){_0x1fa4d3=_0x1e7714;_0x585d01[_0x465f('0x31')]=_[_0x465f('0x4a')](db['Team'][_0x465f('0x2e')]);_0x585d01[_0x465f('0x32')]=_[_0x465f('0x4a')](_0x24f6a9[_0x465f('0x32')]);_0x585d01['filters']=_[_0x465f('0x34')](_0x585d01[_0x465f('0x31')],_0x585d01[_0x465f('0x32')]);_0x114e94[_0x465f('0x35')]=_[_0x465f('0x34')](_0x585d01[_0x465f('0x31')],qs[_0x465f('0x36')](_0x24f6a9[_0x465f('0x32')][_0x465f('0x36')]));_0x114e94['attributes']=_0x114e94[_0x465f('0x35')][_0x465f('0x4b')]?_0x114e94['attributes']:_0x585d01[_0x465f('0x31')];_0x114e94[_0x465f('0x39')]=qs[_0x465f('0x3a')](_0x24f6a9[_0x465f('0x32')][_0x465f('0x3a')]);_0x114e94[_0x465f('0x3b')]=qs[_0x465f('0x33')](_[_0x465f('0x3c')](_0x24f6a9[_0x465f('0x32')],_0x585d01[_0x465f('0x33')]));if(_0x24f6a9[_0x465f('0x32')][_0x465f('0x3d')]){_0x114e94['where']=_[_0x465f('0x3f')](_0x114e94[_0x465f('0x3b')],{'$or':_[_0x465f('0x2d')](_0x114e94[_0x465f('0x35')],function(_0x306a06){var _0x1ea7a0={};_0x1ea7a0[_0x306a06]={'$like':'%'+_0x24f6a9[_0x465f('0x32')][_0x465f('0x3d')]+'%'};return _0x1ea7a0;})});}_0x114e94=_[_0x465f('0x3f')]({},_0x114e94,_0x24f6a9['options']);return _0x1fa4d3['getTeams'](_0x114e94);}})[_0x465f('0x26')](function(_0x1cdb9){if(_0x1cdb9){_0x8e992a=_0x1cdb9[_0x465f('0x4b')];if(!_0x24f6a9['query']['hasOwnProperty'](_0x465f('0x38'))){_0x114e94[_0x465f('0x1f')]=qs['limit'](_0x24f6a9[_0x465f('0x32')][_0x465f('0x1f')]);_0x114e94['offset']=qs['offset'](_0x24f6a9[_0x465f('0x32')]['offset']);}return _0x1fa4d3['getTeams'](_0x114e94);}})[_0x465f('0x26')](function(_0x2cd8d6){if(_0x2cd8d6){return _0x2cd8d6?{'count':_0x8e992a,'rows':_0x2cd8d6}:null;}})[_0x465f('0x26')](respondWithResult(_0x12ebbf,null))[_0x465f('0x47')](handleError(_0x12ebbf,null));};exports[_0x465f('0x61')]=function(_0x963beb,_0x32cfee,_0x2bc079){var _0x342520=_0x963beb[_0x465f('0x4e')]['ids'];return db['Team'][_0x465f('0x45')]({'where':{'id':_0x342520},'attributes':['id'],'include':[{'model':db[_0x465f('0x59')],'as':_0x465f('0x62'),'attributes':['id',_0x465f('0x2b'),_0x465f('0x63'),_0x465f('0x64'),_0x465f('0x65')],'raw':!![]}]})['then'](function(_0x58061d){if(_0x58061d){var _0x16f75c=_[_0x465f('0x66')](_0x58061d,function(_0x3f4766){var _0x1fc967=_0x3f4766['get']({'plain':!![]});return _0x1fc967[_0x465f('0x62')];});return db['FaxQueue']['find']({'where':{'id':_0x963beb['params']['id']}})['then'](function(_0x53e07b){return db['sequelize'][_0x465f('0x67')](function(_0xf17956){return _0x53e07b[_0x465f('0x61')](_0x342520,{'transaction':_0xf17956})[_0x465f('0x26')](function(){return BPromise[_0x465f('0x68')](_0x16f75c,function(_0x4f53e4){return db[_0x465f('0x57')][_0x465f('0x69')]({'where':{'UserId':_0x4f53e4['id'],'FaxQueueId':_0x963beb[_0x465f('0x49')]['id']},'transaction':_0xf17956});});})['then'](function(){_0x16f75c[_0x465f('0x6a')](function(_0x2f1799){socket['emit'](_0x465f('0x6b'),{'UserId':_0x2f1799['id'],'FaxQueueId':_0x53e07b['id']});});});});});}})['then'](respondWithStatusCode(_0x32cfee,null))[_0x465f('0x47')](handleError(_0x32cfee,null));};exports[_0x465f('0x6c')]=function(_0x47a8fa,_0x527c27,_0x436ae0){return db['Team'][_0x465f('0x45')]({'where':{'id':_0x47a8fa[_0x465f('0x32')][_0x465f('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x465f('0x59')],'as':_0x465f('0x62'),'attributes':['id'],'raw':!![]}]})[_0x465f('0x26')](handleEntityNotFound(_0x527c27,null))[_0x465f('0x26')](function(_0x548f2d){var _0x18218f=_['map'](_0x548f2d,'id');var _0x159620=[];var _0x50375c=[];var _0x36ca05=squel[_0x465f('0x6e')]();_0x36ca05[_0x465f('0x6f')](_0x465f('0x70'))[_0x465f('0x71')](_0x465f('0x72'),'tq')['join'](_0x465f('0x73'),'ut',_0x465f('0x74'))[_0x465f('0x3b')](_0x465f('0x75'),_0x47a8fa[_0x465f('0x49')]['id']);for(var _0x186e05=0x0;_0x186e05<_0x548f2d[_0x465f('0x4b')];_0x186e05+=0x1){let _0xa0a9e4=_0x548f2d[_0x186e05];for(var _0x27701c=0x0;_0x27701c<_0xa0a9e4[_0x465f('0x62')][_0x465f('0x4b')];_0x27701c+=0x1){let _0x4b71b5=_0xa0a9e4['Agents'][_0x27701c];var _0x34369c=_0x36ca05['clone']();_0x34369c[_0x465f('0x3b')]('ut.UserId\x20=\x20?',_0x4b71b5['id']);_0x50375c[_0x465f('0x76')](db['sequelize'][_0x465f('0x32')](_0x34369c[_0x465f('0x77')](),{'type':db[_0x465f('0x78')][_0x465f('0x79')][_0x465f('0x7a')]})[_0x465f('0x26')](function(_0x5ef799){if(_0x5ef799['length']===0x1){return _0x4b71b5['id'];}else{var _0x3d6ea2=_[_0x465f('0x7b')](_['map'](_0x5ef799,_0x465f('0x7c')),function(_0xf714cf){return _[_0x465f('0x7d')](_0x18218f,_0xf714cf);});if(_0x3d6ea2){return _0x4b71b5['id'];}}}));}}return BPromise[_0x465f('0x7e')](_0x50375c)[_0x465f('0x26')](function(_0x188a5d){_0x159620=_(_0x159620)[_0x465f('0x7f')](_0x188a5d)['compact']()['value']();return db[_0x465f('0x44')]['find']({'where':{'id':_0x47a8fa[_0x465f('0x49')]['id']}})[_0x465f('0x26')](function(_0x1de813){return db[_0x465f('0x78')][_0x465f('0x67')](function(_0x1eed86){return _0x1de813[_0x465f('0x6c')](_0x47a8fa[_0x465f('0x32')]['ids'],{'transaction':_0x1eed86})[_0x465f('0x26')](function(){if(!_[_0x465f('0x80')](_0x159620)){return _0x1de813['removeAgents'](_0x159620,{'transaction':_0x1eed86});}})[_0x465f('0x26')](function(){_0x159620['forEach'](function(_0x314848){socket['emit'](_0x465f('0x81'),{'UserId':_0x314848,'FaxQueueId':_0x1de813['id']});});});});});});})[_0x465f('0x26')](respondWithStatusCode(_0x527c27,null))[_0x465f('0x47')](handleError(_0x527c27,null));};exports[_0x465f('0x82')]=function(_0x1bcdd2,_0x44e3e1,_0x133142){return db[_0x465f('0x44')][_0x465f('0x4c')]({'where':{'id':_0x1bcdd2[_0x465f('0x49')]['id']}})[_0x465f('0x26')](handleEntityNotFound(_0x44e3e1,null))[_0x465f('0x26')](function(_0x599954){if(_0x599954){return _0x599954[_0x465f('0x82')](_0x1bcdd2['body']['ids'],_[_0x465f('0x83')](_0x1bcdd2[_0x465f('0x4e')],[_0x465f('0x6d'),'id'])||{})[_0x465f('0x84')](function(_0x433086){for(var _0x271dd9=0x0;_0x271dd9<_0x1bcdd2[_0x465f('0x4e')][_0x465f('0x6d')][_0x465f('0x4b')];_0x271dd9+=0x1){socket[_0x465f('0x85')](_0x465f('0x6b'),{'UserId':_0x1bcdd2[_0x465f('0x4e')][_0x465f('0x6d')][_0x271dd9],'FaxQueueId':_0x1bcdd2[_0x465f('0x49')]['id']});}return _0x433086;});}})[_0x465f('0x26')](respondWithResult(_0x44e3e1,null))[_0x465f('0x47')](handleError(_0x44e3e1,null));};exports[_0x465f('0x86')]=function(_0x2aca85,_0x49f52d,_0x162e28){return db[_0x465f('0x44')][_0x465f('0x4c')]({'where':{'id':_0x2aca85['params']['id']}})[_0x465f('0x26')](handleEntityNotFound(_0x49f52d,null))['then'](function(_0x13718f){if(_0x13718f){return _0x13718f[_0x465f('0x86')](_0x2aca85[_0x465f('0x32')][_0x465f('0x6d')])['then'](function(){if(_['isArray'](_0x2aca85[_0x465f('0x32')]['ids'])){for(var _0x4df965=0x0;_0x4df965<_0x2aca85[_0x465f('0x32')][_0x465f('0x6d')][_0x465f('0x4b')];_0x4df965+=0x1){socket[_0x465f('0x85')]('userFaxQueue:remove',{'UserId':Number(_0x2aca85['query'][_0x465f('0x6d')][_0x4df965]),'FaxQueueId':Number(_0x2aca85[_0x465f('0x49')]['id'])});}}else{socket['emit'](_0x465f('0x81'),{'UserId':Number(_0x2aca85['query'][_0x465f('0x6d')]),'FaxQueueId':Number(_0x2aca85[_0x465f('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x49f52d,null))[_0x465f('0x47')](handleError(_0x49f52d,null));};exports[_0x465f('0x87')]=function(_0x5ad3d4,_0x4daf0c,_0x59b9ab){var _0x3061e1={};var _0x3b45ac={};var _0x1a7e72;var _0x1a17ac;return db[_0x465f('0x44')][_0x465f('0x56')]({'where':{'id':_0x5ad3d4[_0x465f('0x49')]['id']}})[_0x465f('0x26')](handleEntityNotFound(_0x4daf0c,null))[_0x465f('0x26')](function(_0x329420){if(_0x329420){_0x1a7e72=_0x329420;_0x3b45ac[_0x465f('0x31')]=_[_0x465f('0x4a')](db[_0x465f('0x59')][_0x465f('0x2e')]);_0x3b45ac[_0x465f('0x32')]=_[_0x465f('0x4a')](_0x5ad3d4[_0x465f('0x32')]);_0x3b45ac[_0x465f('0x33')]=_[_0x465f('0x34')](_0x3b45ac['model'],_0x3b45ac[_0x465f('0x32')]);_0x3061e1[_0x465f('0x35')]=_['intersection'](_0x3b45ac[_0x465f('0x31')],qs[_0x465f('0x36')](_0x5ad3d4[_0x465f('0x32')][_0x465f('0x36')]));_0x3061e1[_0x465f('0x35')]=_0x3061e1['attributes']['length']?_0x3061e1[_0x465f('0x35')]:_0x3b45ac[_0x465f('0x31')];_0x3061e1[_0x465f('0x39')]=qs[_0x465f('0x3a')](_0x5ad3d4[_0x465f('0x32')][_0x465f('0x3a')]);_0x3061e1[_0x465f('0x3b')]=qs['filters'](_[_0x465f('0x3c')](_0x5ad3d4['query'],_0x3b45ac['filters']));if(_0x5ad3d4[_0x465f('0x32')][_0x465f('0x3d')]){_0x3061e1[_0x465f('0x3b')]=_[_0x465f('0x3f')](_0x3061e1[_0x465f('0x3b')],{'$or':_['map'](_0x3061e1[_0x465f('0x35')],function(_0x258b25){var _0x39d889={};_0x39d889[_0x258b25]={'$like':'%'+_0x5ad3d4['query'][_0x465f('0x3d')]+'%'};return _0x39d889;})});}_0x3061e1=_[_0x465f('0x3f')]({},_0x3061e1,_0x5ad3d4['options']);return _0x1a7e72[_0x465f('0x87')](_0x3061e1);}})['then'](function(_0x34537e){if(_0x34537e){_0x1a17ac=_0x34537e[_0x465f('0x4b')];if(!_0x5ad3d4['query'][_0x465f('0x37')]('nolimit')){_0x3061e1[_0x465f('0x1f')]=qs[_0x465f('0x1f')](_0x5ad3d4[_0x465f('0x32')][_0x465f('0x1f')]);_0x3061e1[_0x465f('0x1e')]=qs[_0x465f('0x1e')](_0x5ad3d4[_0x465f('0x32')][_0x465f('0x1e')]);}return _0x1a7e72[_0x465f('0x87')](_0x3061e1);}})[_0x465f('0x26')](function(_0x284a74){if(_0x284a74){return _0x284a74?{'count':_0x1a17ac,'rows':_0x284a74}:null;}})[_0x465f('0x26')](respondWithResult(_0x4daf0c,null))[_0x465f('0x47')](handleError(_0x4daf0c,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5ba4537..a049e43 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 _0x1959=['hasOwnProperty','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit'];(function(_0x534f56,_0x591374){var _0x2ace06=function(_0x4ea66f){while(--_0x4ea66f){_0x534f56['push'](_0x534f56['shift']());}};_0x2ace06(++_0x591374);}(_0x1959,0x99));var _0x9195=function(_0x5a4b42,_0x2b9c18){_0x5a4b42=_0x5a4b42-0x0;var _0x5e81d6=_0x1959[_0x5a4b42];return _0x5e81d6;};'use strict';var EventEmitter=require(_0x9195('0x0'));var FaxQueue=require(_0x9195('0x1'))['db'][_0x9195('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9195('0x3')](0x0);var events={'afterCreate':_0x9195('0x4'),'afterUpdate':_0x9195('0x5'),'afterDestroy':'remove'};function emitEvent(_0x433f45){return function(_0x17b424,_0x2b0987,_0x37fb35){FaxQueueEvents[_0x9195('0x6')](_0x433f45+':'+_0x17b424['id'],_0x17b424);FaxQueueEvents[_0x9195('0x6')](_0x433f45,_0x17b424);_0x37fb35(null);};}for(var e in events){if(events[_0x9195('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x8faf=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x12253b,_0x1e6065){var _0xf87a27=function(_0x52e2fe){while(--_0x52e2fe){_0x12253b['push'](_0x12253b['shift']());}};_0xf87a27(++_0x1e6065);}(_0x8faf,0x1e3));var _0xf8fa=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x8faf[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require(_0xf8fa('0x0'));var FaxQueue=require(_0xf8fa('0x1'))['db'][_0xf8fa('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf8fa('0x3')](0x0);var events={'afterCreate':_0xf8fa('0x4'),'afterUpdate':_0xf8fa('0x5'),'afterDestroy':_0xf8fa('0x6')};function emitEvent(_0x5a83fa){return function(_0x3db434,_0x597fe5,_0x164d95){FaxQueueEvents[_0xf8fa('0x7')](_0x5a83fa+':'+_0x3db434['id'],_0x3db434);FaxQueueEvents[_0xf8fa('0x7')](_0x5a83fa,_0x3db434);_0x164d95(null);};}for(var e in events){if(events[_0xf8fa('0x8')](e)){var event=events[e];FaxQueue[_0xf8fa('0x9')](e,emitEvent(event));}}module[_0xf8fa('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 14634a7..1897b82 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 _0x1689=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues'];(function(_0x13c841,_0x59a44e){var _0x446cc2=function(_0x3d6c11){while(--_0x3d6c11){_0x13c841['push'](_0x13c841['shift']());}};_0x446cc2(++_0x59a44e);}(_0x1689,0x1ad));var _0x9168=function(_0x29bcf6,_0x2aaa40){_0x29bcf6=_0x29bcf6-0x0;var _0x274221=_0x1689[_0x29bcf6];return _0x274221;};'use strict';var _=require(_0x9168('0x0'));var util=require('util');var logger=require(_0x9168('0x1'))(_0x9168('0x2'));var moment=require(_0x9168('0x3'));var BPromise=require(_0x9168('0x4'));var rp=require(_0x9168('0x5'));var fs=require('fs');var path=require(_0x9168('0x6'));var rimraf=require(_0x9168('0x7'));var config=require(_0x9168('0x8'));var attributes=require(_0x9168('0x9'));module['exports']=function(_0x3cd843,_0x222c0f){return _0x3cd843[_0x9168('0xa')](_0x9168('0xb'),attributes,{'tableName':_0x9168('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bb8=['moment','bluebird','path','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util'];(function(_0x5485d5,_0x54beea){var _0x239028=function(_0x22e2c2){while(--_0x22e2c2){_0x5485d5['push'](_0x5485d5['shift']());}};_0x239028(++_0x54beea);}(_0x0bb8,0x153));var _0x80bb=function(_0x250d31,_0x2c2f2b){_0x250d31=_0x250d31-0x0;var _0x5239c7=_0x0bb8[_0x250d31];return _0x5239c7;};'use strict';var _=require(_0x80bb('0x0'));var util=require(_0x80bb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x80bb('0x2'));var BPromise=require(_0x80bb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80bb('0x4'));var rimraf=require('rimraf');var config=require(_0x80bb('0x5'));var attributes=require(_0x80bb('0x6'));module[_0x80bb('0x7')]=function(_0x5c0254,_0x2acee6){return _0x5c0254[_0x80bb('0x8')](_0x80bb('0x9'),attributes,{'tableName':_0x80bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 50d7948..bc089f7 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 _0xa998=['options','raw','where','attributes','limit','map','include','model','debug','ShowFaxQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','then','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','FaxQueue,\x20%s,\x20%s','request\x20sent','result','catch','GetFaxQueue','FaxQueue'];(function(_0x39c275,_0x133cd5){var _0x1d7a01=function(_0x5e6bf3){while(--_0x5e6bf3){_0x39c275['push'](_0x39c275['shift']());}};_0x1d7a01(++_0x133cd5);}(_0xa998,0x1d3));var _0x8a99=function(_0x3317f9,_0x2b3cca){_0x3317f9=_0x3317f9-0x0;var _0x524456=_0xa998[_0x3317f9];return _0x524456;};'use strict';var _=require(_0x8a99('0x0'));var util=require('util');var moment=require(_0x8a99('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a99('0x2'));var fs=require('fs');var Redis=require(_0x8a99('0x3'));var db=require(_0x8a99('0x4'))['db'];var utils=require(_0x8a99('0x5'));var logger=require('../../config/logger')(_0x8a99('0x6'));var config=require(_0x8a99('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8a99('0x8')][_0x8a99('0x9')]({'port':0x232a});config[_0x8a99('0xa')]=_[_0x8a99('0xb')](config[_0x8a99('0xa')],{'host':_0x8a99('0xc'),'port':0x18eb});var socket=require(_0x8a99('0xd'))(new Redis(config[_0x8a99('0xa')]));require(_0x8a99('0xe'))['register'](socket);function respondWithRpcPromise(_0x464721,_0x3bd170,_0x1db222){return new BPromise(function(_0x5b6dd8,_0x1c6adc){return client['request'](_0x464721,_0x1db222)[_0x8a99('0xf')](function(_0x4594d6){logger['info']('FaxQueue,\x20%s,\x20%s',_0x3bd170,'request\x20sent');logger['debug'](_0x8a99('0x10'),_0x3bd170,'request\x20sent',JSON[_0x8a99('0x11')](_0x4594d6));if(_0x4594d6[_0x8a99('0x12')]){if(_0x4594d6[_0x8a99('0x12')]['code']===0x1f4){logger[_0x8a99('0x12')]('FaxQueue,\x20%s,\x20%s',_0x3bd170,_0x4594d6[_0x8a99('0x12')][_0x8a99('0x13')]);return _0x1c6adc(_0x4594d6[_0x8a99('0x12')][_0x8a99('0x13')]);}logger[_0x8a99('0x12')]('FaxQueue,\x20%s,\x20%s',_0x3bd170,_0x4594d6[_0x8a99('0x12')][_0x8a99('0x13')]);return _0x5b6dd8(_0x4594d6[_0x8a99('0x12')]['message']);}else{logger[_0x8a99('0x14')](_0x8a99('0x15'),_0x3bd170,_0x8a99('0x16'));_0x5b6dd8(_0x4594d6[_0x8a99('0x17')][_0x8a99('0x13')]);}})[_0x8a99('0x18')](function(_0x2f5ac9){logger['error'](_0x8a99('0x15'),_0x3bd170,_0x2f5ac9);_0x1c6adc(_0x2f5ac9);});});}exports[_0x8a99('0x19')]=function(_0x150c15){var _0x2fe0ae=this;return new Promise(function(_0xeec036,_0x3a344b){return db[_0x8a99('0x1a')]['findAll']({'raw':_0x150c15[_0x8a99('0x1b')]?_0x150c15['options'][_0x8a99('0x1c')]===undefined?!![]:![]:!![],'where':_0x150c15[_0x8a99('0x1b')]?_0x150c15[_0x8a99('0x1b')][_0x8a99('0x1d')]||null:null,'attributes':_0x150c15[_0x8a99('0x1b')]?_0x150c15[_0x8a99('0x1b')][_0x8a99('0x1e')]||null:null,'limit':_0x150c15[_0x8a99('0x1b')]?_0x150c15['options'][_0x8a99('0x1f')]||null:null,'include':_0x150c15[_0x8a99('0x1b')]?_0x150c15['options']['include']?_[_0x8a99('0x20')](_0x150c15[_0x8a99('0x1b')][_0x8a99('0x21')],function(_0x32f8fa){return{'model':db[_0x32f8fa[_0x8a99('0x22')]],'as':_0x32f8fa['as'],'attributes':_0x32f8fa[_0x8a99('0x1e')],'include':_0x32f8fa['include']?_[_0x8a99('0x20')](_0x32f8fa[_0x8a99('0x21')],function(_0x320c5d){return{'model':db[_0x320c5d[_0x8a99('0x22')]],'as':_0x320c5d['as'],'attributes':_0x320c5d[_0x8a99('0x1e')],'include':_0x320c5d['include']?_[_0x8a99('0x20')](_0x320c5d[_0x8a99('0x21')],function(_0x69a4c5){return{'model':db[_0x69a4c5['model']],'as':_0x69a4c5['as'],'attributes':_0x69a4c5[_0x8a99('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe86ce1){logger[_0x8a99('0x14')](_0x8a99('0x19'),_0x150c15);logger[_0x8a99('0x23')](_0x8a99('0x19'),_0x150c15,JSON[_0x8a99('0x11')](_0xe86ce1));_0xeec036(_0xe86ce1);})[_0x8a99('0x18')](function(_0xd7033b){logger[_0x8a99('0x12')]('GetFaxQueue',_0xd7033b[_0x8a99('0x13')],_0x150c15);_0x3a344b(_0x2fe0ae[_0x8a99('0x12')](0x1f4,_0xd7033b[_0x8a99('0x13')]));});});};exports[_0x8a99('0x24')]=function(_0x15915f){var _0x47b49e=this;return new Promise(function(_0x39615f,_0x302c11){return db[_0x8a99('0x1a')][_0x8a99('0x25')]({'raw':_0x15915f['options']?_0x15915f[_0x8a99('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x15915f[_0x8a99('0x1b')]?_0x15915f[_0x8a99('0x1b')]['where']||null:null,'attributes':_0x15915f[_0x8a99('0x1b')]?_0x15915f[_0x8a99('0x1b')][_0x8a99('0x1e')]||null:null,'include':_0x15915f['options']?_0x15915f['options'][_0x8a99('0x21')]?_[_0x8a99('0x20')](_0x15915f[_0x8a99('0x1b')][_0x8a99('0x21')],function(_0x2f7232){return{'model':db[_0x2f7232[_0x8a99('0x22')]],'as':_0x2f7232['as'],'attributes':_0x2f7232[_0x8a99('0x1e')],'include':_0x2f7232[_0x8a99('0x21')]?_[_0x8a99('0x20')](_0x2f7232[_0x8a99('0x21')],function(_0x29407a){return{'model':db[_0x29407a[_0x8a99('0x22')]],'as':_0x29407a['as'],'attributes':_0x29407a[_0x8a99('0x1e')],'include':_0x29407a[_0x8a99('0x21')]?_[_0x8a99('0x20')](_0x29407a[_0x8a99('0x21')],function(_0x2968a2){return{'model':db[_0x2968a2[_0x8a99('0x22')]],'as':_0x2968a2['as'],'attributes':_0x2968a2[_0x8a99('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8a99('0xf')](function(_0x40ba25){logger[_0x8a99('0x14')]('ShowFaxQueue',_0x15915f);logger[_0x8a99('0x23')]('ShowFaxQueue',_0x15915f,JSON[_0x8a99('0x11')](_0x40ba25));_0x39615f(_0x40ba25);})[_0x8a99('0x18')](function(_0x11aefd){logger[_0x8a99('0x12')]('ShowFaxQueue',_0x11aefd[_0x8a99('0x13')],_0x15915f);_0x302c11(_0x47b49e[_0x8a99('0x12')](0x1f4,_0x11aefd[_0x8a99('0x13')]));});});}; \ No newline at end of file +var _0x8086=['localhost','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','info','ShowFaxQueue','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','redis'];(function(_0xdfd552,_0x5f39a0){var _0x598335=function(_0x1dc924){while(--_0x1dc924){_0xdfd552['push'](_0xdfd552['shift']());}};_0x598335(++_0x5f39a0);}(_0x8086,0x68));var _0x6808=function(_0xb1ca05,_0xfa7f33){_0xb1ca05=_0xb1ca05-0x0;var _0xc1043d=_0x8086[_0xb1ca05];return _0xc1043d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6808('0x0'));var BPromise=require('bluebird');var rs=require(_0x6808('0x1'));var fs=require('fs');var Redis=require(_0x6808('0x2'));var db=require(_0x6808('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6808('0x4'))(_0x6808('0x5'));var config=require('../../config/environment');var jayson=require(_0x6808('0x6'));var client=jayson['client'][_0x6808('0x7')]({'port':0x232a});config['redis']=_[_0x6808('0x8')](config[_0x6808('0x9')],{'host':_0x6808('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6808('0xb'))[_0x6808('0xc')](socket);function respondWithRpcPromise(_0xf73dc9,_0x28ff5a,_0x435e4){return new BPromise(function(_0x341e7c,_0x2f1258){return client[_0x6808('0xd')](_0xf73dc9,_0x435e4)[_0x6808('0xe')](function(_0x5ca956){logger['info'](_0x6808('0xf'),_0x28ff5a,_0x6808('0x10'));logger[_0x6808('0x11')](_0x6808('0x12'),_0x28ff5a,'request\x20sent',JSON[_0x6808('0x13')](_0x5ca956));if(_0x5ca956[_0x6808('0x14')]){if(_0x5ca956[_0x6808('0x14')][_0x6808('0x15')]===0x1f4){logger[_0x6808('0x14')](_0x6808('0xf'),_0x28ff5a,_0x5ca956['error'][_0x6808('0x16')]);return _0x2f1258(_0x5ca956[_0x6808('0x14')][_0x6808('0x16')]);}logger[_0x6808('0x14')](_0x6808('0xf'),_0x28ff5a,_0x5ca956[_0x6808('0x14')][_0x6808('0x16')]);return _0x341e7c(_0x5ca956[_0x6808('0x14')]['message']);}else{logger['info'](_0x6808('0xf'),_0x28ff5a,'request\x20sent');_0x341e7c(_0x5ca956['result'][_0x6808('0x16')]);}})[_0x6808('0x17')](function(_0x1f4efd){logger[_0x6808('0x14')](_0x6808('0xf'),_0x28ff5a,_0x1f4efd);_0x2f1258(_0x1f4efd);});});}exports[_0x6808('0x18')]=function(_0x5e0eb4){var _0x1efd96=this;return new Promise(function(_0x41bb7c,_0x4d8fcd){return db[_0x6808('0x19')][_0x6808('0x1a')]({'raw':_0x5e0eb4[_0x6808('0x1b')]?_0x5e0eb4[_0x6808('0x1b')][_0x6808('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e0eb4[_0x6808('0x1b')]?_0x5e0eb4[_0x6808('0x1b')][_0x6808('0x1d')]||null:null,'attributes':_0x5e0eb4[_0x6808('0x1b')]?_0x5e0eb4[_0x6808('0x1b')][_0x6808('0x1e')]||null:null,'limit':_0x5e0eb4[_0x6808('0x1b')]?_0x5e0eb4[_0x6808('0x1b')][_0x6808('0x1f')]||null:null,'include':_0x5e0eb4[_0x6808('0x1b')]?_0x5e0eb4[_0x6808('0x1b')][_0x6808('0x20')]?_[_0x6808('0x21')](_0x5e0eb4[_0x6808('0x1b')][_0x6808('0x20')],function(_0x1494ec){return{'model':db[_0x1494ec[_0x6808('0x22')]],'as':_0x1494ec['as'],'attributes':_0x1494ec[_0x6808('0x1e')],'include':_0x1494ec['include']?_[_0x6808('0x21')](_0x1494ec[_0x6808('0x20')],function(_0x26236f){return{'model':db[_0x26236f[_0x6808('0x22')]],'as':_0x26236f['as'],'attributes':_0x26236f[_0x6808('0x1e')],'include':_0x26236f[_0x6808('0x20')]?_[_0x6808('0x21')](_0x26236f[_0x6808('0x20')],function(_0x5ade54){return{'model':db[_0x5ade54['model']],'as':_0x5ade54['as'],'attributes':_0x5ade54[_0x6808('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6808('0xe')](function(_0x446e18){logger['info'](_0x6808('0x18'),_0x5e0eb4);logger[_0x6808('0x11')](_0x6808('0x18'),_0x5e0eb4,JSON['stringify'](_0x446e18));_0x41bb7c(_0x446e18);})[_0x6808('0x17')](function(_0x344552){logger['error'](_0x6808('0x18'),_0x344552['message'],_0x5e0eb4);_0x4d8fcd(_0x1efd96[_0x6808('0x14')](0x1f4,_0x344552[_0x6808('0x16')]));});});};exports['ShowFaxQueue']=function(_0x46ebcc){var _0xb9bca9=this;return new Promise(function(_0x20a8de,_0xca5a4b){return db[_0x6808('0x19')][_0x6808('0x23')]({'raw':_0x46ebcc[_0x6808('0x1b')]?_0x46ebcc[_0x6808('0x1b')][_0x6808('0x1c')]===undefined?!![]:![]:!![],'where':_0x46ebcc[_0x6808('0x1b')]?_0x46ebcc[_0x6808('0x1b')][_0x6808('0x1d')]||null:null,'attributes':_0x46ebcc[_0x6808('0x1b')]?_0x46ebcc[_0x6808('0x1b')]['attributes']||null:null,'include':_0x46ebcc[_0x6808('0x1b')]?_0x46ebcc['options']['include']?_['map'](_0x46ebcc[_0x6808('0x1b')][_0x6808('0x20')],function(_0x4cbf97){return{'model':db[_0x4cbf97[_0x6808('0x22')]],'as':_0x4cbf97['as'],'attributes':_0x4cbf97['attributes'],'include':_0x4cbf97[_0x6808('0x20')]?_[_0x6808('0x21')](_0x4cbf97[_0x6808('0x20')],function(_0x3acda7){return{'model':db[_0x3acda7[_0x6808('0x22')]],'as':_0x3acda7['as'],'attributes':_0x3acda7[_0x6808('0x1e')],'include':_0x3acda7[_0x6808('0x20')]?_[_0x6808('0x21')](_0x3acda7[_0x6808('0x20')],function(_0x5b1251){return{'model':db[_0x5b1251[_0x6808('0x22')]],'as':_0x5b1251['as'],'attributes':_0x5b1251['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdded){logger[_0x6808('0x24')]('ShowFaxQueue',_0x46ebcc);logger[_0x6808('0x11')](_0x6808('0x25'),_0x46ebcc,JSON[_0x6808('0x13')](_0x2fdded));_0x20a8de(_0x2fdded);})[_0x6808('0x17')](function(_0x1886cd){logger[_0x6808('0x14')](_0x6808('0x25'),_0x1886cd[_0x6808('0x16')],_0x46ebcc);_0xca5a4b(_0xb9bca9[_0x6808('0x14')](0x1f4,_0x1886cd[_0x6808('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 05a3a9d..0f1dabb 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 _0xa014=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x25d940,_0x14ca99){var _0xea346f=function(_0x1f3753){while(--_0x1f3753){_0x25d940['push'](_0x25d940['shift']());}};_0xea346f(++_0x14ca99);}(_0xa014,0x199));var _0x4a01=function(_0x48bce4,_0x21f2f2){_0x48bce4=_0x48bce4-0x0;var _0x293273=_0xa014[_0x48bce4];return _0x293273;};'use strict';var FaxQueueEvents=require(_0x4a01('0x0'));var events=[_0x4a01('0x1'),_0x4a01('0x2'),_0x4a01('0x3')];function createListener(_0xd797ea,_0x41cdc5){return function(_0x1cdc4b){_0x41cdc5[_0x4a01('0x4')](_0xd797ea,_0x1cdc4b);};}function removeListener(_0x2519dc,_0x78aae){return function(){FaxQueueEvents[_0x4a01('0x5')](_0x2519dc,_0x78aae);};}exports[_0x4a01('0x6')]=function(_0xc05bcd){for(var _0x102868=0x0,_0x9847c7=events[_0x4a01('0x7')];_0x102868<_0x9847c7;_0x102868++){var _0x539950=events[_0x102868];var _0x1e7845=createListener(_0x4a01('0x8')+_0x539950,_0xc05bcd);FaxQueueEvents['on'](_0x539950,_0x1e7845);}}; \ No newline at end of file +var _0x28de=['length','faxQueue:','./faxQueue.events','update','emit','removeListener'];(function(_0x488a30,_0x196dd2){var _0x299108=function(_0x34b5d1){while(--_0x34b5d1){_0x488a30['push'](_0x488a30['shift']());}};_0x299108(++_0x196dd2);}(_0x28de,0x170));var _0xe28d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28de[_0x321bb2];return _0x9c12ed;};'use strict';var FaxQueueEvents=require(_0xe28d('0x0'));var events=['save','remove',_0xe28d('0x1')];function createListener(_0x18dde8,_0x919cf3){return function(_0x24fb27){_0x919cf3[_0xe28d('0x2')](_0x18dde8,_0x24fb27);};}function removeListener(_0x2cea7c,_0x3ee495){return function(){FaxQueueEvents[_0xe28d('0x3')](_0x2cea7c,_0x3ee495);};}exports['register']=function(_0x131604){for(var _0x12a2cb=0x0,_0x539dbb=events[_0xe28d('0x4')];_0x12a2cb<_0x539dbb;_0x12a2cb++){var _0x4fb0a8=events[_0x12a2cb];var _0x11d73f=createListener(_0xe28d('0x5')+_0x4fb0a8,_0x131604);FaxQueueEvents['on'](_0x4fb0a8,_0x11d73f);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ec65859..d708d9c 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(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xb10b,0x12a));var _0xbb10=function(_0x15d59a,_0x4b13c2){_0x15d59a=_0x15d59a-0x0;var _0x575cd5=_0xb10b[_0x15d59a];return _0x575cd5;};'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 _0xd8b0=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','get','/describe','describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','exports','multer'];(function(_0xae11d3,_0x13b6a0){var _0x47acc1=function(_0x101536){while(--_0x101536){_0xae11d3['push'](_0xae11d3['shift']());}};_0x47acc1(++_0x13b6a0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var 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',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['get'](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x13')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);router[_0x0d8b('0x13')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0x17'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x18')]);router[_0x0d8b('0x19')](_0x0d8b('0x17'),auth['isAuthenticated'](),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x19')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x1b')]);router[_0x0d8b('0x19')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller['removeAgents']);module[_0x0d8b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 13a3b85..c641816 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 _0xa9b8=['moment','sequelize','exports','STRING','DATE'];(function(_0x1f4c05,_0x50bb78){var _0x5a2232=function(_0x1ffd51){while(--_0x1ffd51){_0x1f4c05['push'](_0x1f4c05['shift']());}};_0x5a2232(++_0x50bb78);}(_0xa9b8,0x10e));var _0x8a9b=function(_0x337223,_0x438f90){_0x337223=_0x337223-0x0;var _0x3c09f7=_0xa9b8[_0x337223];return _0x3c09f7;};'use strict';var moment=require(_0x8a9b('0x0'));var Sequelize=require(_0x8a9b('0x1'));module[_0x8a9b('0x2')]={'uniqueid':{'type':Sequelize[_0x8a9b('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8a9b('0x4')]},'leaveAt':{'type':Sequelize[_0x8a9b('0x4')]},'acceptAt':{'type':Sequelize[_0x8a9b('0x4')]},'exitAt':{'type':Sequelize[_0x8a9b('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0c88=['DATE','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0c88,0x121));var _0x80c8=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0x0c88[_0x43a6cd];return _0x5acb36;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x80c8('0x0')]={'uniqueid':{'type':Sequelize[_0x80c8('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x80c8('0x1')]},'joinAt':{'type':Sequelize[_0x80c8('0x2')]},'leaveAt':{'type':Sequelize[_0x80c8('0x2')]},'acceptAt':{'type':Sequelize[_0x80c8('0x2')]},'exitAt':{'type':Sequelize[_0x80c8('0x2')]},'reason':{'type':Sequelize[_0x80c8('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 7550f2e..eee17c0 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 _0xdc1a=['catch','params','rawAttributes','find','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','apply','reject','then','end','error','name','map','FaxQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows'];(function(_0x456c5f,_0x39b8be){var _0x70feaa=function(_0xb018bc){while(--_0xb018bc){_0x456c5f['push'](_0x456c5f['shift']());}};_0x70feaa(++_0x39b8be);}(_0xdc1a,0x1c7));var _0xadc1=function(_0x2c0dc5,_0x5e5221){_0x2c0dc5=_0x2c0dc5-0x0;var _0x27cb43=_0xdc1a[_0x2c0dc5];return _0x27cb43;};'use strict';var pdf=require(_0xadc1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xadc1('0x1'));var zipdir=require(_0xadc1('0x2'));var jsonpatch=require(_0xadc1('0x3'));var rp=require(_0xadc1('0x4'));var moment=require('moment');var BPromise=require(_0xadc1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xadc1('0x6'));var sox=require(_0xadc1('0x7'));var csv=require(_0xadc1('0x8'));var ejs=require(_0xadc1('0x9'));var fs=require('fs');var _=require(_0xadc1('0xa'));var squel=require('squel');var crypto=require(_0xadc1('0xb'));var jsforce=require(_0xadc1('0xc'));var deskjs=require(_0xadc1('0xd'));var toCsv=require(_0xadc1('0x8'));var querystring=require(_0xadc1('0xe'));var Papa=require(_0xadc1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xadc1('0x10'));var as=require(_0xadc1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xadc1('0x12'))('api');var utils=require(_0xadc1('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xadc1('0x14'))['db'];function respondWithStatusCode(_0x27801b,_0x17db8a){_0x17db8a=_0x17db8a||0xcc;return function(_0x50ef73){if(_0x50ef73){return _0x27801b[_0xadc1('0x15')](_0x17db8a);}return _0x27801b[_0xadc1('0x16')](_0x17db8a)['end']();};}function respondWithResult(_0x5f2ae9,_0x4a6e66){_0x4a6e66=_0x4a6e66||0xc8;return function(_0xd518a4){if(_0xd518a4){return _0x5f2ae9[_0xadc1('0x16')](_0x4a6e66)['json'](_0xd518a4);}};}function respondWithFilteredResult(_0x11dda6,_0x3f3dee){return function(_0x5b9a7f){if(_0x5b9a7f){var _0x26e8c3=_0x5b9a7f[_0xadc1('0x17')],_0x40c51b=_0x3f3dee['offset'],_0x31bc64=_0x3f3dee[_0xadc1('0x18')]+_0x3f3dee[_0xadc1('0x19')],_0x283b47;if(_0x31bc64>=_0x26e8c3){_0x31bc64=_0x26e8c3;_0x283b47=0xc8;}else{_0x283b47=0xce;}_0x11dda6[_0xadc1('0x16')](_0x283b47);return _0x11dda6['set'](_0xadc1('0x1a'),_0x40c51b+'-'+_0x31bc64+'/'+_0x26e8c3)['json'](_0x5b9a7f);}return null;};}function patchUpdates(_0x481b1f){return function(_0x55b989){try{jsonpatch[_0xadc1('0x1b')](_0x55b989,_0x481b1f,!![]);}catch(_0xd48ccc){return BPromise[_0xadc1('0x1c')](_0xd48ccc);}return _0x55b989['save']();};}function saveUpdates(_0x46a695,_0xe7aaf1){return function(_0x4c96e7){if(_0x4c96e7){return _0x4c96e7['update'](_0x46a695)[_0xadc1('0x1d')](function(_0x42fdaa){return _0x42fdaa;});}return null;};}function removeEntity(_0x58941d,_0x1358e5){return function(_0x3f39cc){if(_0x3f39cc){return _0x3f39cc['destroy']()[_0xadc1('0x1d')](function(){_0x58941d[_0xadc1('0x16')](0xcc)[_0xadc1('0x1e')]();});}};}function handleEntityNotFound(_0x49a36f,_0x64081f){return function(_0x3ead61){if(!_0x3ead61){_0x49a36f[_0xadc1('0x15')](0x194);}return _0x3ead61;};}function handleError(_0x42d048,_0x573660){_0x573660=_0x573660||0x1f4;return function(_0x350f90){logger[_0xadc1('0x1f')](_0x350f90['stack']);if(_0x350f90[_0xadc1('0x20')]){delete _0x350f90[_0xadc1('0x20')];}_0x42d048[_0xadc1('0x16')](_0x573660)['send'](_0x350f90);};}exports['index']=function(_0x5c53ec,_0x3909a1){var _0x112b53={},_0xb969c8={},_0x3bb982={'count':0x0,'rows':[]};var _0x8e6311=_[_0xadc1('0x21')](db[_0xadc1('0x22')]['rawAttributes'],function(_0x5cba2f){return{'name':_0x5cba2f[_0xadc1('0x23')],'type':_0x5cba2f[_0xadc1('0x24')][_0xadc1('0x25')]};});_0xb969c8[_0xadc1('0x26')]=_[_0xadc1('0x21')](_0x8e6311,_0xadc1('0x20'));_0xb969c8[_0xadc1('0x27')]=_[_0xadc1('0x28')](_0x5c53ec[_0xadc1('0x27')]);_0xb969c8[_0xadc1('0x29')]=_[_0xadc1('0x2a')](_0xb969c8['model'],_0xb969c8[_0xadc1('0x27')]);_0x112b53['attributes']=_['intersection'](_0xb969c8[_0xadc1('0x26')],qs[_0xadc1('0x2b')](_0x5c53ec[_0xadc1('0x27')][_0xadc1('0x2b')]));_0x112b53[_0xadc1('0x2c')]=_0x112b53[_0xadc1('0x2c')][_0xadc1('0x2d')]?_0x112b53[_0xadc1('0x2c')]:_0xb969c8[_0xadc1('0x26')];if(!_0x5c53ec['query']['hasOwnProperty'](_0xadc1('0x2e'))){_0x112b53['limit']=qs[_0xadc1('0x19')](_0x5c53ec['query'][_0xadc1('0x19')]);_0x112b53[_0xadc1('0x18')]=qs[_0xadc1('0x18')](_0x5c53ec[_0xadc1('0x27')][_0xadc1('0x18')]);}_0x112b53[_0xadc1('0x2f')]=qs[_0xadc1('0x30')](_0x5c53ec[_0xadc1('0x27')]['sort']);_0x112b53['where']=qs[_0xadc1('0x29')](_['pick'](_0x5c53ec[_0xadc1('0x27')],_0xb969c8['filters']),_0x8e6311);if(_0x5c53ec[_0xadc1('0x27')]['filter']){_0x112b53[_0xadc1('0x31')]=_[_0xadc1('0x32')](_0x112b53[_0xadc1('0x31')],{'$or':_['map'](_0x8e6311,function(_0x5d6d0d){if(_0x5d6d0d[_0xadc1('0x24')]!==_0xadc1('0x33')){var _0x1bab26={};_0x1bab26[_0x5d6d0d[_0xadc1('0x20')]]={'$like':'%'+_0x5c53ec[_0xadc1('0x27')][_0xadc1('0x34')]+'%'};return _0x1bab26;}})});}_0x112b53=_[_0xadc1('0x32')]({},_0x112b53,_0x5c53ec[_0xadc1('0x35')]);var _0x469fe1={'where':_0x112b53[_0xadc1('0x31')]};return db[_0xadc1('0x22')][_0xadc1('0x17')](_0x469fe1)[_0xadc1('0x1d')](function(_0x1a6dd0){_0x3bb982[_0xadc1('0x17')]=_0x1a6dd0;if(_0x5c53ec[_0xadc1('0x27')][_0xadc1('0x36')]){_0x112b53[_0xadc1('0x37')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x112b53);})[_0xadc1('0x1d')](function(_0x454ab7){_0x3bb982[_0xadc1('0x38')]=_0x454ab7;return _0x3bb982;})[_0xadc1('0x1d')](respondWithFilteredResult(_0x3909a1,_0x112b53))[_0xadc1('0x39')](handleError(_0x3909a1,null));};exports['show']=function(_0x5a130d,_0x41c853){var _0x57f972={'raw':!![],'where':{'id':_0x5a130d[_0xadc1('0x3a')]['id']}},_0x49ad5a={};_0x49ad5a[_0xadc1('0x26')]=_[_0xadc1('0x28')](db['FaxQueueReport'][_0xadc1('0x3b')]);_0x49ad5a['query']=_['keys'](_0x5a130d[_0xadc1('0x27')]);_0x49ad5a['filters']=_['intersection'](_0x49ad5a[_0xadc1('0x26')],_0x49ad5a[_0xadc1('0x27')]);_0x57f972['attributes']=_[_0xadc1('0x2a')](_0x49ad5a['model'],qs[_0xadc1('0x2b')](_0x5a130d[_0xadc1('0x27')][_0xadc1('0x2b')]));_0x57f972[_0xadc1('0x2c')]=_0x57f972[_0xadc1('0x2c')]['length']?_0x57f972[_0xadc1('0x2c')]:_0x49ad5a[_0xadc1('0x26')];if(_0x5a130d[_0xadc1('0x27')][_0xadc1('0x36')]){_0x57f972[_0xadc1('0x37')]=[{'all':!![]}];}_0x57f972=_['merge']({},_0x57f972,_0x5a130d[_0xadc1('0x35')]);return db['FaxQueueReport'][_0xadc1('0x3c')](_0x57f972)[_0xadc1('0x1d')](handleEntityNotFound(_0x41c853,null))[_0xadc1('0x1d')](respondWithResult(_0x41c853,null))['catch'](handleError(_0x41c853,null));};exports['create']=function(_0x6202cb,_0x7bb78e){return db[_0xadc1('0x22')]['create'](_0x6202cb['body'],{})[_0xadc1('0x1d')](respondWithResult(_0x7bb78e,0xc9))['catch'](handleError(_0x7bb78e,null));};exports['update']=function(_0x27e0ed,_0x3b88a7){if(_0x27e0ed[_0xadc1('0x3d')]['id']){delete _0x27e0ed['body']['id'];}return db[_0xadc1('0x22')]['find']({'where':{'id':_0x27e0ed[_0xadc1('0x3a')]['id']}})[_0xadc1('0x1d')](handleEntityNotFound(_0x3b88a7,null))[_0xadc1('0x1d')](saveUpdates(_0x27e0ed['body'],null))['then'](respondWithResult(_0x3b88a7,null))[_0xadc1('0x39')](handleError(_0x3b88a7,null));};exports[_0xadc1('0x3e')]=function(_0x3ef7c1,_0x3be1d0){return db[_0xadc1('0x22')]['find']({'where':{'id':_0x3ef7c1[_0xadc1('0x3a')]['id']}})[_0xadc1('0x1d')](handleEntityNotFound(_0x3be1d0,null))[_0xadc1('0x1d')](removeEntity(_0x3be1d0,null))[_0xadc1('0x39')](handleError(_0x3be1d0,null));};exports['describe']=function(_0x1d131a,_0x114186){return db[_0xadc1('0x22')][_0xadc1('0x3f')]()[_0xadc1('0x1d')](respondWithResult(_0x114186,null))[_0xadc1('0x39')](handleError(_0x114186,null));}; \ No newline at end of file +var _0x89d4=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','FaxQueueReport','count','includeAll','findAll','catch','show','keys','include','options','find','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','then','sendStatus','error','stack','name','send','index','map'];(function(_0x42e3fe,_0x1d631b){var _0x185d33=function(_0x492544){while(--_0x492544){_0x42e3fe['push'](_0x42e3fe['shift']());}};_0x185d33(++_0x1d631b);}(_0x89d4,0x107));var _0x489d=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x89d4[_0x5be795];return _0x4e8a3b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x489d('0x0'));var rimraf=require(_0x489d('0x1'));var zipdir=require(_0x489d('0x2'));var jsonpatch=require(_0x489d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x489d('0x4'));var util=require(_0x489d('0x5'));var path=require(_0x489d('0x6'));var sox=require(_0x489d('0x7'));var csv=require(_0x489d('0x8'));var ejs=require(_0x489d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x489d('0xa'));var jsforce=require(_0x489d('0xb'));var deskjs=require(_0x489d('0xc'));var toCsv=require(_0x489d('0x8'));var querystring=require(_0x489d('0xd'));var Papa=require(_0x489d('0xe'));var Redis=require(_0x489d('0xf'));var authService=require(_0x489d('0x10'));var qs=require(_0x489d('0x11'));var as=require(_0x489d('0x12'));var hardwareService=require(_0x489d('0x13'));var logger=require(_0x489d('0x14'))('api');var utils=require(_0x489d('0x15'));var config=require(_0x489d('0x16'));var licenseUtil=require(_0x489d('0x17'));var db=require(_0x489d('0x18'))['db'];function respondWithStatusCode(_0x526248,_0x227d42){_0x227d42=_0x227d42||0xcc;return function(_0x3a72d7){if(_0x3a72d7){return _0x526248['sendStatus'](_0x227d42);}return _0x526248[_0x489d('0x19')](_0x227d42)[_0x489d('0x1a')]();};}function respondWithResult(_0x38189a,_0x153586){_0x153586=_0x153586||0xc8;return function(_0x515203){if(_0x515203){return _0x38189a[_0x489d('0x19')](_0x153586)['json'](_0x515203);}};}function respondWithFilteredResult(_0x57979b,_0x54bb8a){return function(_0xb3878c){if(_0xb3878c){var _0x5dd242=_0xb3878c['count'],_0x10a3c5=_0x54bb8a[_0x489d('0x1b')],_0x4b0754=_0x54bb8a[_0x489d('0x1b')]+_0x54bb8a[_0x489d('0x1c')],_0x341677;if(_0x4b0754>=_0x5dd242){_0x4b0754=_0x5dd242;_0x341677=0xc8;}else{_0x341677=0xce;}_0x57979b['status'](_0x341677);return _0x57979b[_0x489d('0x1d')](_0x489d('0x1e'),_0x10a3c5+'-'+_0x4b0754+'/'+_0x5dd242)[_0x489d('0x1f')](_0xb3878c);}return null;};}function patchUpdates(_0x4892c1){return function(_0x20f288){try{jsonpatch[_0x489d('0x20')](_0x20f288,_0x4892c1,!![]);}catch(_0x1d52e0){return BPromise['reject'](_0x1d52e0);}return _0x20f288['save']();};}function saveUpdates(_0x399dca,_0x24ff05){return function(_0x8c2fa2){if(_0x8c2fa2){return _0x8c2fa2['update'](_0x399dca)[_0x489d('0x21')](function(_0x504324){return _0x504324;});}return null;};}function removeEntity(_0x4c0223,_0x5f198d){return function(_0x18a014){if(_0x18a014){return _0x18a014['destroy']()[_0x489d('0x21')](function(){_0x4c0223['status'](0xcc)[_0x489d('0x1a')]();});}};}function handleEntityNotFound(_0x6c3361,_0x1dfc78){return function(_0x1610ba){if(!_0x1610ba){_0x6c3361[_0x489d('0x22')](0x194);}return _0x1610ba;};}function handleError(_0x258f25,_0x48742f){_0x48742f=_0x48742f||0x1f4;return function(_0x2a267f){logger[_0x489d('0x23')](_0x2a267f[_0x489d('0x24')]);if(_0x2a267f[_0x489d('0x25')]){delete _0x2a267f[_0x489d('0x25')];}_0x258f25[_0x489d('0x19')](_0x48742f)[_0x489d('0x26')](_0x2a267f);};}exports[_0x489d('0x27')]=function(_0x5e6398,_0x464142){var _0x4825f7={},_0xd9f275={},_0x36dfb9={'count':0x0,'rows':[]};var _0x56e6d7=_[_0x489d('0x28')](db['FaxQueueReport'][_0x489d('0x29')],function(_0xe37bb2){return{'name':_0xe37bb2[_0x489d('0x2a')],'type':_0xe37bb2[_0x489d('0x2b')][_0x489d('0x2c')]};});_0xd9f275[_0x489d('0x2d')]=_[_0x489d('0x28')](_0x56e6d7,_0x489d('0x25'));_0xd9f275[_0x489d('0x2e')]=_['keys'](_0x5e6398[_0x489d('0x2e')]);_0xd9f275[_0x489d('0x2f')]=_[_0x489d('0x30')](_0xd9f275[_0x489d('0x2d')],_0xd9f275[_0x489d('0x2e')]);_0x4825f7[_0x489d('0x31')]=_[_0x489d('0x30')](_0xd9f275[_0x489d('0x2d')],qs[_0x489d('0x32')](_0x5e6398['query'][_0x489d('0x32')]));_0x4825f7[_0x489d('0x31')]=_0x4825f7[_0x489d('0x31')][_0x489d('0x33')]?_0x4825f7[_0x489d('0x31')]:_0xd9f275[_0x489d('0x2d')];if(!_0x5e6398[_0x489d('0x2e')][_0x489d('0x34')](_0x489d('0x35'))){_0x4825f7['limit']=qs['limit'](_0x5e6398[_0x489d('0x2e')][_0x489d('0x1c')]);_0x4825f7[_0x489d('0x1b')]=qs[_0x489d('0x1b')](_0x5e6398[_0x489d('0x2e')]['offset']);}_0x4825f7[_0x489d('0x36')]=qs[_0x489d('0x37')](_0x5e6398[_0x489d('0x2e')][_0x489d('0x37')]);_0x4825f7[_0x489d('0x38')]=qs[_0x489d('0x2f')](_['pick'](_0x5e6398[_0x489d('0x2e')],_0xd9f275['filters']),_0x56e6d7);if(_0x5e6398[_0x489d('0x2e')][_0x489d('0x39')]){_0x4825f7[_0x489d('0x38')]=_[_0x489d('0x3a')](_0x4825f7[_0x489d('0x38')],{'$or':_[_0x489d('0x28')](_0x56e6d7,function(_0x336892){if(_0x336892['type']!==_0x489d('0x3b')){var _0x2bd0a5={};_0x2bd0a5[_0x336892[_0x489d('0x25')]]={'$like':'%'+_0x5e6398['query']['filter']+'%'};return _0x2bd0a5;}})});}_0x4825f7=_[_0x489d('0x3a')]({},_0x4825f7,_0x5e6398['options']);var _0x171bb7={'where':_0x4825f7['where']};return db[_0x489d('0x3c')][_0x489d('0x3d')](_0x171bb7)[_0x489d('0x21')](function(_0x1c852d){_0x36dfb9[_0x489d('0x3d')]=_0x1c852d;if(_0x5e6398[_0x489d('0x2e')][_0x489d('0x3e')]){_0x4825f7['include']=[{'all':!![]}];}return db[_0x489d('0x3c')][_0x489d('0x3f')](_0x4825f7);})['then'](function(_0x2c2c1a){_0x36dfb9['rows']=_0x2c2c1a;return _0x36dfb9;})['then'](respondWithFilteredResult(_0x464142,_0x4825f7))[_0x489d('0x40')](handleError(_0x464142,null));};exports[_0x489d('0x41')]=function(_0x5c47db,_0x9ee3b8){var _0x237cdd={'raw':!![],'where':{'id':_0x5c47db['params']['id']}},_0x465ffa={};_0x465ffa[_0x489d('0x2d')]=_[_0x489d('0x42')](db[_0x489d('0x3c')]['rawAttributes']);_0x465ffa[_0x489d('0x2e')]=_['keys'](_0x5c47db['query']);_0x465ffa[_0x489d('0x2f')]=_[_0x489d('0x30')](_0x465ffa['model'],_0x465ffa[_0x489d('0x2e')]);_0x237cdd['attributes']=_[_0x489d('0x30')](_0x465ffa[_0x489d('0x2d')],qs[_0x489d('0x32')](_0x5c47db['query'][_0x489d('0x32')]));_0x237cdd[_0x489d('0x31')]=_0x237cdd['attributes'][_0x489d('0x33')]?_0x237cdd[_0x489d('0x31')]:_0x465ffa['model'];if(_0x5c47db['query'][_0x489d('0x3e')]){_0x237cdd[_0x489d('0x43')]=[{'all':!![]}];}_0x237cdd=_[_0x489d('0x3a')]({},_0x237cdd,_0x5c47db[_0x489d('0x44')]);return db[_0x489d('0x3c')][_0x489d('0x45')](_0x237cdd)[_0x489d('0x21')](handleEntityNotFound(_0x9ee3b8,null))[_0x489d('0x21')](respondWithResult(_0x9ee3b8,null))[_0x489d('0x40')](handleError(_0x9ee3b8,null));};exports[_0x489d('0x46')]=function(_0x6f8dc2,_0x24e9a6){return db[_0x489d('0x3c')]['create'](_0x6f8dc2[_0x489d('0x47')],{})[_0x489d('0x21')](respondWithResult(_0x24e9a6,0xc9))[_0x489d('0x40')](handleError(_0x24e9a6,null));};exports[_0x489d('0x48')]=function(_0x1458f2,_0x26a9fa){if(_0x1458f2[_0x489d('0x47')]['id']){delete _0x1458f2[_0x489d('0x47')]['id'];}return db[_0x489d('0x3c')][_0x489d('0x45')]({'where':{'id':_0x1458f2[_0x489d('0x49')]['id']}})['then'](handleEntityNotFound(_0x26a9fa,null))[_0x489d('0x21')](saveUpdates(_0x1458f2[_0x489d('0x47')],null))[_0x489d('0x21')](respondWithResult(_0x26a9fa,null))[_0x489d('0x40')](handleError(_0x26a9fa,null));};exports[_0x489d('0x4a')]=function(_0x1dfc76,_0x170b38){return db[_0x489d('0x3c')][_0x489d('0x45')]({'where':{'id':_0x1dfc76[_0x489d('0x49')]['id']}})[_0x489d('0x21')](handleEntityNotFound(_0x170b38,null))[_0x489d('0x21')](removeEntity(_0x170b38,null))[_0x489d('0x40')](handleError(_0x170b38,null));};exports[_0x489d('0x4b')]=function(_0x1c47a8,_0x1a3df6){return db[_0x489d('0x3c')][_0x489d('0x4b')]()[_0x489d('0x21')](respondWithResult(_0x1a3df6,null))[_0x489d('0x40')](handleError(_0x1a3df6,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 219961c..cc1ad27 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 _0x8783=['uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue'];(function(_0x4a2361,_0x4f1eb9){var _0x3b1076=function(_0x456d46){while(--_0x456d46){_0x4a2361['push'](_0x4a2361['shift']());}};_0x3b1076(++_0x4f1eb9);}(_0x8783,0xde));var _0x3878=function(_0x59b301,_0x3ad2af){_0x59b301=_0x59b301-0x0;var _0x44e301=_0x8783[_0x59b301];return _0x44e301;};'use strict';var _=require(_0x3878('0x0'));var util=require('util');var logger=require(_0x3878('0x1'))(_0x3878('0x2'));var moment=require(_0x3878('0x3'));var BPromise=require('bluebird');var rp=require(_0x3878('0x4'));var fs=require('fs');var path=require(_0x3878('0x5'));var rimraf=require(_0x3878('0x6'));var config=require(_0x3878('0x7'));var attributes=require(_0x3878('0x8'));module[_0x3878('0x9')]=function(_0x53b9dd,_0x264784){return _0x53b9dd['define'](_0x3878('0xa'),attributes,{'tableName':_0x3878('0xb'),'paranoid':![],'indexes':[{'name':_0x3878('0xc'),'fields':[_0x3878('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d30=['report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport'];(function(_0x45a945,_0x2e8b66){var _0x403af5=function(_0x3a1c80){while(--_0x3a1c80){_0x45a945['push'](_0x45a945['shift']());}};_0x403af5(++_0x2e8b66);}(_0x8d30,0x89));var _0x08d3=function(_0x1fd4d7,_0x2feafd){_0x1fd4d7=_0x1fd4d7-0x0;var _0x7efe8a=_0x8d30[_0x1fd4d7];return _0x7efe8a;};'use strict';var _=require(_0x08d3('0x0'));var util=require(_0x08d3('0x1'));var logger=require(_0x08d3('0x2'))(_0x08d3('0x3'));var moment=require(_0x08d3('0x4'));var BPromise=require('bluebird');var rp=require(_0x08d3('0x5'));var fs=require('fs');var path=require(_0x08d3('0x6'));var rimraf=require(_0x08d3('0x7'));var config=require(_0x08d3('0x8'));var attributes=require(_0x08d3('0x9'));module[_0x08d3('0xa')]=function(_0x53d52a,_0xea8e0e){return _0x53d52a[_0x08d3('0xb')](_0x08d3('0xc'),attributes,{'tableName':_0x08d3('0xd'),'paranoid':![],'indexes':[{'name':_0x08d3('0xe'),'fields':[_0x08d3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8aecf69..3c98fcb 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 _0x8a83=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','info','result','catch','create','body','options','raw','UpdateFaxQueueReport','FaxQueueReport','update','attributes','limit','lodash'];(function(_0x5709e5,_0x26cc18){var _0x15f656=function(_0x9e1e92){while(--_0x9e1e92){_0x5709e5['push'](_0x5709e5['shift']());}};_0x15f656(++_0x26cc18);}(_0x8a83,0x167));var _0x38a8=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x8a83[_0x413727];return _0x5f46d7;};'use strict';var _=require(_0x38a8('0x0'));var util=require(_0x38a8('0x1'));var moment=require(_0x38a8('0x2'));var BPromise=require('bluebird');var rs=require(_0x38a8('0x3'));var fs=require('fs');var Redis=require(_0x38a8('0x4'));var db=require(_0x38a8('0x5'))['db'];var utils=require(_0x38a8('0x6'));var logger=require(_0x38a8('0x7'))(_0x38a8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f369e,_0x3318a6,_0x25e5bf){return new BPromise(function(_0x3f11dc,_0x301559){return client['request'](_0x3f369e,_0x25e5bf)[_0x38a8('0x9')](function(_0x42a74e){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x3318a6,_0x38a8('0xa'));logger[_0x38a8('0xb')](_0x38a8('0xc'),_0x3318a6,'request\x20sent',JSON[_0x38a8('0xd')](_0x42a74e));if(_0x42a74e[_0x38a8('0xe')]){if(_0x42a74e[_0x38a8('0xe')][_0x38a8('0xf')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x3318a6,_0x42a74e[_0x38a8('0xe')][_0x38a8('0x10')]);return _0x301559(_0x42a74e[_0x38a8('0xe')][_0x38a8('0x10')]);}logger[_0x38a8('0xe')](_0x38a8('0x11'),_0x3318a6,_0x42a74e['error'][_0x38a8('0x10')]);return _0x3f11dc(_0x42a74e[_0x38a8('0xe')][_0x38a8('0x10')]);}else{logger[_0x38a8('0x12')](_0x38a8('0x11'),_0x3318a6,_0x38a8('0xa'));_0x3f11dc(_0x42a74e[_0x38a8('0x13')][_0x38a8('0x10')]);}})[_0x38a8('0x14')](function(_0x4dbcd1){logger['error'](_0x38a8('0x11'),_0x3318a6,_0x4dbcd1);_0x301559(_0x4dbcd1);});});}exports['CreateFaxQueueReport']=function(_0x54f5f4){var _0x25c557=this;return new Promise(function(_0xc9ee97,_0x227679){return db['FaxQueueReport'][_0x38a8('0x15')](_0x54f5f4[_0x38a8('0x16')],{'raw':_0x54f5f4[_0x38a8('0x17')]?_0x54f5f4['options'][_0x38a8('0x18')]===undefined?!![]:![]:!![]})[_0x38a8('0x9')](function(_0x4703d3){logger['info']('CreateFaxQueueReport',_0x54f5f4);logger[_0x38a8('0xb')]('CreateFaxQueueReport',_0x54f5f4,JSON['stringify'](_0x4703d3));_0xc9ee97(_0x4703d3);})[_0x38a8('0x14')](function(_0x2e2904){logger[_0x38a8('0xe')]('CreateFaxQueueReport',_0x2e2904[_0x38a8('0x10')],_0x54f5f4);_0x227679(_0x25c557[_0x38a8('0xe')](0x1f4,_0x2e2904['message']));});});};exports[_0x38a8('0x19')]=function(_0x57c9d0){var _0x3cbd5f=this;return new Promise(function(_0x4da0ef,_0x567461){return db[_0x38a8('0x1a')][_0x38a8('0x1b')](_0x57c9d0[_0x38a8('0x16')],{'raw':_0x57c9d0[_0x38a8('0x17')]?_0x57c9d0[_0x38a8('0x17')][_0x38a8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57c9d0[_0x38a8('0x17')]?_0x57c9d0['options']['where']||null:null,'attributes':_0x57c9d0['options']?_0x57c9d0['options'][_0x38a8('0x1c')]||null:null,'limit':_0x57c9d0[_0x38a8('0x17')]?_0x57c9d0[_0x38a8('0x17')][_0x38a8('0x1d')]||null:null})[_0x38a8('0x9')](function(_0x305ef2){logger[_0x38a8('0x12')](_0x38a8('0x19'),_0x57c9d0);logger[_0x38a8('0xb')]('UpdateFaxQueueReport',_0x57c9d0,JSON[_0x38a8('0xd')](_0x305ef2));_0x4da0ef(_0x305ef2);})[_0x38a8('0x14')](function(_0x56fc0e){logger[_0x38a8('0xe')](_0x38a8('0x19'),_0x56fc0e[_0x38a8('0x10')],_0x57c9d0);_0x567461(_0x3cbd5f[_0x38a8('0xe')](0x1f4,_0x56fc0e['message']));});});}; \ No newline at end of file +var _0x4b52=['then','UpdateFaxQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','update','raw','where','attributes','limit'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x4b52,0xf0));var _0x24b5=function(_0x225716,_0x545874){_0x225716=_0x225716-0x0;var _0x32c960=_0x4b52[_0x225716];return _0x32c960;};'use strict';var _=require(_0x24b5('0x0'));var util=require(_0x24b5('0x1'));var moment=require(_0x24b5('0x2'));var BPromise=require('bluebird');var rs=require(_0x24b5('0x3'));var fs=require('fs');var Redis=require(_0x24b5('0x4'));var db=require(_0x24b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x24b5('0x6'))(_0x24b5('0x7'));var config=require('../../config/environment');var jayson=require(_0x24b5('0x8'));var client=jayson[_0x24b5('0x9')][_0x24b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2af0a7,_0x3498b0,_0x1ab17a){return new BPromise(function(_0x526ee3,_0x7d3693){return client[_0x24b5('0xb')](_0x2af0a7,_0x1ab17a)['then'](function(_0x1469b0){logger[_0x24b5('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x3498b0,_0x24b5('0xd'));logger[_0x24b5('0xe')](_0x24b5('0xf'),_0x3498b0,_0x24b5('0xd'),JSON[_0x24b5('0x10')](_0x1469b0));if(_0x1469b0[_0x24b5('0x11')]){if(_0x1469b0[_0x24b5('0x11')][_0x24b5('0x12')]===0x1f4){logger[_0x24b5('0x11')](_0x24b5('0x13'),_0x3498b0,_0x1469b0[_0x24b5('0x11')]['message']);return _0x7d3693(_0x1469b0[_0x24b5('0x11')][_0x24b5('0x14')]);}logger[_0x24b5('0x11')](_0x24b5('0x13'),_0x3498b0,_0x1469b0[_0x24b5('0x11')][_0x24b5('0x14')]);return _0x526ee3(_0x1469b0[_0x24b5('0x11')][_0x24b5('0x14')]);}else{logger[_0x24b5('0xc')](_0x24b5('0x13'),_0x3498b0,'request\x20sent');_0x526ee3(_0x1469b0[_0x24b5('0x15')][_0x24b5('0x14')]);}})[_0x24b5('0x16')](function(_0x555bbb){logger[_0x24b5('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x3498b0,_0x555bbb);_0x7d3693(_0x555bbb);});});}exports[_0x24b5('0x17')]=function(_0x1f8634){var _0x392ece=this;return new Promise(function(_0x2c62fe,_0x1c1356){return db[_0x24b5('0x18')]['create'](_0x1f8634[_0x24b5('0x19')],{'raw':_0x1f8634[_0x24b5('0x1a')]?_0x1f8634[_0x24b5('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2b2b2c){logger[_0x24b5('0xc')](_0x24b5('0x17'),_0x1f8634);logger['debug'](_0x24b5('0x17'),_0x1f8634,JSON[_0x24b5('0x10')](_0x2b2b2c));_0x2c62fe(_0x2b2b2c);})['catch'](function(_0x1204c2){logger[_0x24b5('0x11')](_0x24b5('0x17'),_0x1204c2[_0x24b5('0x14')],_0x1f8634);_0x1c1356(_0x392ece[_0x24b5('0x11')](0x1f4,_0x1204c2[_0x24b5('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x383b0a){var _0xfcd0f3=this;return new Promise(function(_0x28a92d,_0x168cba){return db['FaxQueueReport'][_0x24b5('0x1b')](_0x383b0a[_0x24b5('0x19')],{'raw':_0x383b0a[_0x24b5('0x1a')]?_0x383b0a[_0x24b5('0x1a')][_0x24b5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x383b0a[_0x24b5('0x1a')]?_0x383b0a['options'][_0x24b5('0x1d')]||null:null,'attributes':_0x383b0a['options']?_0x383b0a[_0x24b5('0x1a')][_0x24b5('0x1e')]||null:null,'limit':_0x383b0a[_0x24b5('0x1a')]?_0x383b0a[_0x24b5('0x1a')][_0x24b5('0x1f')]||null:null})[_0x24b5('0x20')](function(_0x4652d3){logger[_0x24b5('0xc')]('UpdateFaxQueueReport',_0x383b0a);logger[_0x24b5('0xe')](_0x24b5('0x21'),_0x383b0a,JSON['stringify'](_0x4652d3));_0x28a92d(_0x4652d3);})[_0x24b5('0x16')](function(_0x1c124e){logger['error'](_0x24b5('0x21'),_0x1c124e[_0x24b5('0x14')],_0x383b0a);_0x168cba(_0xfcd0f3['error'](0x1f4,_0x1c124e[_0x24b5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ac6c53e..2ab3266 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 _0xa7c3=['index','/describe','describe','/:id','show','post','create','put','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4ee881,_0x10ddc8){var _0x305f48=function(_0x5303d5){while(--_0x5303d5){_0x4ee881['push'](_0x4ee881['shift']());}};_0x305f48(++_0x10ddc8);}(_0xa7c3,0x90));var _0x3a7c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa7c3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x3a7c('0x0'));var util=require('util');var path=require(_0x3a7c('0x1'));var timeout=require(_0x3a7c('0x2'));var express=require(_0x3a7c('0x3'));var router=express[_0x3a7c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3a7c('0x5'));var config=require(_0x3a7c('0x6'));var controller=require('./faxQueueReport.controller');router[_0x3a7c('0x7')]('/',auth[_0x3a7c('0x8')](),controller[_0x3a7c('0x9')]);router[_0x3a7c('0x7')](_0x3a7c('0xa'),auth[_0x3a7c('0x8')](),controller[_0x3a7c('0xb')]);router[_0x3a7c('0x7')](_0x3a7c('0xc'),auth[_0x3a7c('0x8')](),controller[_0x3a7c('0xd')]);router[_0x3a7c('0xe')]('/',auth[_0x3a7c('0x8')](),controller[_0x3a7c('0xf')]);router[_0x3a7c('0x10')](_0x3a7c('0xc'),auth[_0x3a7c('0x8')](),controller['update']);router['delete'](_0x3a7c('0xc'),auth[_0x3a7c('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0885=['express','Router','../../components/auth/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','multer','path','connect-timeout'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x0885,0x69));var _0x5088=function(_0x177e72,_0x28bf32){_0x177e72=_0x177e72-0x0;var _0x392698=_0x0885[_0x177e72];return _0x392698;};'use strict';var multer=require(_0x5088('0x0'));var util=require('util');var path=require(_0x5088('0x1'));var timeout=require(_0x5088('0x2'));var express=require(_0x5088('0x3'));var router=express[_0x5088('0x4')]();var auth=require(_0x5088('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5088('0x6'));router[_0x5088('0x7')]('/',auth[_0x5088('0x8')](),controller[_0x5088('0x9')]);router[_0x5088('0x7')](_0x5088('0xa'),auth[_0x5088('0x8')](),controller[_0x5088('0xb')]);router['get'](_0x5088('0xc'),auth[_0x5088('0x8')](),controller[_0x5088('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5088('0xe')]);router[_0x5088('0xf')](_0x5088('0xc'),auth[_0x5088('0x8')](),controller['update']);router[_0x5088('0x10')](_0x5088('0xc'),auth[_0x5088('0x8')](),controller[_0x5088('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index cbc156f..d2423bd 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 _0x21eb=['ENUM','account','queue','NOW','moment'];(function(_0x34197a,_0x2292bd){var _0x49e3f9=function(_0x13bc9c){while(--_0x13bc9c){_0x34197a['push'](_0x34197a['shift']());}};_0x49e3f9(++_0x2292bd);}(_0x21eb,0x19e));var _0xb21e=function(_0x3f9073,_0x11e3f8){_0x3f9073=_0x3f9073-0x0;var _0x198c96=_0x21eb[_0x3f9073];return _0x198c96;};'use strict';var moment=require(_0xb21e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb21e('0x1')](_0xb21e('0x2'),'agent',_0xb21e('0x3')),'allowNull':![],'defaultValue':_0xb21e('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xb21e('0x4')]}}; \ No newline at end of file +var _0xff30=['NOW','moment','sequelize','exports','ENUM','account','agent','queue'];(function(_0x146dd7,_0x4d877d){var _0x2af0bb=function(_0x2327bc){while(--_0x2327bc){_0x146dd7['push'](_0x146dd7['shift']());}};_0x2af0bb(++_0x4d877d);}(_0xff30,0x1a1));var _0x0ff3=function(_0x450e9d,_0x46538a){_0x450e9d=_0x450e9d-0x0;var _0x6672cf=_0xff30[_0x450e9d];return _0x6672cf;};'use strict';var moment=require(_0x0ff3('0x0'));var Sequelize=require(_0x0ff3('0x1'));module[_0x0ff3('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0ff3('0x3')](_0x0ff3('0x4'),_0x0ff3('0x5'),_0x0ff3('0x6')),'allowNull':![],'defaultValue':_0x0ff3('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x0ff3('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 8e17d37..eb16450 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 _0x21cd=['name','send','index','map','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxTransferReport','includeAll','include','findAll','show','length','catch','create','update','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','save','then','destroy','error'];(function(_0x1cf8e8,_0x3885f2){var _0x345158=function(_0x5b0f30){while(--_0x5b0f30){_0x1cf8e8['push'](_0x1cf8e8['shift']());}};_0x345158(++_0x3885f2);}(_0x21cd,0x6a));var _0xd21c=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x21cd[_0x35da42];return _0x370035;};'use strict';var pdf=require(_0xd21c('0x0'));var emlformat=require(_0xd21c('0x1'));var rimraf=require(_0xd21c('0x2'));var zipdir=require(_0xd21c('0x3'));var jsonpatch=require(_0xd21c('0x4'));var rp=require(_0xd21c('0x5'));var moment=require(_0xd21c('0x6'));var BPromise=require(_0xd21c('0x7'));var Mustache=require(_0xd21c('0x8'));var util=require('util');var path=require('path');var sox=require(_0xd21c('0x9'));var csv=require(_0xd21c('0xa'));var ejs=require(_0xd21c('0xb'));var fs=require('fs');var _=require(_0xd21c('0xc'));var squel=require(_0xd21c('0xd'));var crypto=require('crypto');var jsforce=require(_0xd21c('0xe'));var deskjs=require(_0xd21c('0xf'));var toCsv=require(_0xd21c('0xa'));var querystring=require(_0xd21c('0x10'));var Papa=require(_0xd21c('0x11'));var Redis=require('ioredis');var authService=require(_0xd21c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd21c('0x13'));var hardwareService=require(_0xd21c('0x14'));var logger=require(_0xd21c('0x15'))(_0xd21c('0x16'));var utils=require(_0xd21c('0x17'));var config=require(_0xd21c('0x18'));var licenseUtil=require(_0xd21c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x357c01,_0x620b37){_0x620b37=_0x620b37||0xcc;return function(_0x2da30c){if(_0x2da30c){return _0x357c01[_0xd21c('0x1a')](_0x620b37);}return _0x357c01[_0xd21c('0x1b')](_0x620b37)[_0xd21c('0x1c')]();};}function respondWithResult(_0x14d82e,_0x2a9362){_0x2a9362=_0x2a9362||0xc8;return function(_0x206aff){if(_0x206aff){return _0x14d82e[_0xd21c('0x1b')](_0x2a9362)[_0xd21c('0x1d')](_0x206aff);}};}function respondWithFilteredResult(_0xaecd8f,_0x5dcc9e){return function(_0x9f8774){if(_0x9f8774){var _0x2066bb=_0x9f8774['count'],_0x26c0fc=_0x5dcc9e[_0xd21c('0x1e')],_0x25c4ce=_0x5dcc9e[_0xd21c('0x1e')]+_0x5dcc9e[_0xd21c('0x1f')],_0x141da1;if(_0x25c4ce>=_0x2066bb){_0x25c4ce=_0x2066bb;_0x141da1=0xc8;}else{_0x141da1=0xce;}_0xaecd8f['status'](_0x141da1);return _0xaecd8f[_0xd21c('0x20')](_0xd21c('0x21'),_0x26c0fc+'-'+_0x25c4ce+'/'+_0x2066bb)['json'](_0x9f8774);}return null;};}function patchUpdates(_0x35a362){return function(_0xa96896){try{jsonpatch['apply'](_0xa96896,_0x35a362,!![]);}catch(_0x4e352a){return BPromise['reject'](_0x4e352a);}return _0xa96896[_0xd21c('0x22')]();};}function saveUpdates(_0x21a175,_0x1f00db){return function(_0xbb74a){if(_0xbb74a){return _0xbb74a['update'](_0x21a175)[_0xd21c('0x23')](function(_0x500c65){return _0x500c65;});}return null;};}function removeEntity(_0x5cad51,_0x26e381){return function(_0x75bd03){if(_0x75bd03){return _0x75bd03[_0xd21c('0x24')]()[_0xd21c('0x23')](function(){_0x5cad51[_0xd21c('0x1b')](0xcc)[_0xd21c('0x1c')]();});}};}function handleEntityNotFound(_0xa04dd3,_0x399a0a){return function(_0x1009ae){if(!_0x1009ae){_0xa04dd3[_0xd21c('0x1a')](0x194);}return _0x1009ae;};}function handleError(_0x34bfc3,_0x41127c){_0x41127c=_0x41127c||0x1f4;return function(_0x537ca9){logger[_0xd21c('0x25')](_0x537ca9['stack']);if(_0x537ca9[_0xd21c('0x26')]){delete _0x537ca9['name'];}_0x34bfc3[_0xd21c('0x1b')](_0x41127c)[_0xd21c('0x27')](_0x537ca9);};}exports[_0xd21c('0x28')]=function(_0x46f344,_0x47748d){var _0x3fd1da={},_0x91acb9={},_0x132ed2={'count':0x0,'rows':[]};var _0x17c9ca=_[_0xd21c('0x29')](db['FaxTransferReport'][_0xd21c('0x2a')],function(_0x2c09b3){return{'name':_0x2c09b3['fieldName'],'type':_0x2c09b3[_0xd21c('0x2b')]['key']};});_0x91acb9['model']=_['map'](_0x17c9ca,_0xd21c('0x26'));_0x91acb9[_0xd21c('0x2c')]=_[_0xd21c('0x2d')](_0x46f344[_0xd21c('0x2c')]);_0x91acb9[_0xd21c('0x2e')]=_[_0xd21c('0x2f')](_0x91acb9['model'],_0x91acb9[_0xd21c('0x2c')]);_0x3fd1da[_0xd21c('0x30')]=_[_0xd21c('0x2f')](_0x91acb9[_0xd21c('0x31')],qs[_0xd21c('0x32')](_0x46f344['query'][_0xd21c('0x32')]));_0x3fd1da[_0xd21c('0x30')]=_0x3fd1da['attributes']['length']?_0x3fd1da[_0xd21c('0x30')]:_0x91acb9['model'];if(!_0x46f344[_0xd21c('0x2c')][_0xd21c('0x33')]('nolimit')){_0x3fd1da[_0xd21c('0x1f')]=qs['limit'](_0x46f344[_0xd21c('0x2c')]['limit']);_0x3fd1da[_0xd21c('0x1e')]=qs[_0xd21c('0x1e')](_0x46f344[_0xd21c('0x2c')][_0xd21c('0x1e')]);}_0x3fd1da[_0xd21c('0x34')]=qs[_0xd21c('0x35')](_0x46f344[_0xd21c('0x2c')][_0xd21c('0x35')]);_0x3fd1da[_0xd21c('0x36')]=qs[_0xd21c('0x2e')](_[_0xd21c('0x37')](_0x46f344['query'],_0x91acb9[_0xd21c('0x2e')]),_0x17c9ca);if(_0x46f344[_0xd21c('0x2c')][_0xd21c('0x38')]){_0x3fd1da[_0xd21c('0x36')]=_[_0xd21c('0x39')](_0x3fd1da[_0xd21c('0x36')],{'$or':_[_0xd21c('0x29')](_0x17c9ca,function(_0x3dd46b){if(_0x3dd46b[_0xd21c('0x2b')]!==_0xd21c('0x3a')){var _0x552b85={};_0x552b85[_0x3dd46b[_0xd21c('0x26')]]={'$like':'%'+_0x46f344[_0xd21c('0x2c')][_0xd21c('0x38')]+'%'};return _0x552b85;}})});}_0x3fd1da=_[_0xd21c('0x39')]({},_0x3fd1da,_0x46f344[_0xd21c('0x3b')]);var _0x4b8ee8={'where':_0x3fd1da[_0xd21c('0x36')]};return db[_0xd21c('0x3c')]['count'](_0x4b8ee8)[_0xd21c('0x23')](function(_0x1825f2){_0x132ed2['count']=_0x1825f2;if(_0x46f344[_0xd21c('0x2c')][_0xd21c('0x3d')]){_0x3fd1da[_0xd21c('0x3e')]=[{'all':!![]}];}return db[_0xd21c('0x3c')][_0xd21c('0x3f')](_0x3fd1da);})[_0xd21c('0x23')](function(_0x284830){_0x132ed2['rows']=_0x284830;return _0x132ed2;})['then'](respondWithFilteredResult(_0x47748d,_0x3fd1da))['catch'](handleError(_0x47748d,null));};exports[_0xd21c('0x40')]=function(_0x4718c3,_0x26432f){var _0x51ba9b={'raw':!![],'where':{'id':_0x4718c3['params']['id']}},_0x77a65d={};_0x77a65d[_0xd21c('0x31')]=_[_0xd21c('0x2d')](db[_0xd21c('0x3c')][_0xd21c('0x2a')]);_0x77a65d[_0xd21c('0x2c')]=_[_0xd21c('0x2d')](_0x4718c3[_0xd21c('0x2c')]);_0x77a65d[_0xd21c('0x2e')]=_['intersection'](_0x77a65d[_0xd21c('0x31')],_0x77a65d[_0xd21c('0x2c')]);_0x51ba9b[_0xd21c('0x30')]=_['intersection'](_0x77a65d[_0xd21c('0x31')],qs[_0xd21c('0x32')](_0x4718c3[_0xd21c('0x2c')][_0xd21c('0x32')]));_0x51ba9b['attributes']=_0x51ba9b[_0xd21c('0x30')][_0xd21c('0x41')]?_0x51ba9b['attributes']:_0x77a65d[_0xd21c('0x31')];if(_0x4718c3[_0xd21c('0x2c')][_0xd21c('0x3d')]){_0x51ba9b['include']=[{'all':!![]}];}_0x51ba9b=_[_0xd21c('0x39')]({},_0x51ba9b,_0x4718c3['options']);return db[_0xd21c('0x3c')]['find'](_0x51ba9b)['then'](handleEntityNotFound(_0x26432f,null))[_0xd21c('0x23')](respondWithResult(_0x26432f,null))[_0xd21c('0x42')](handleError(_0x26432f,null));};exports[_0xd21c('0x43')]=function(_0x2c4cfd,_0x9c64b8){return db[_0xd21c('0x3c')][_0xd21c('0x43')](_0x2c4cfd['body'],{})['then'](respondWithResult(_0x9c64b8,0xc9))[_0xd21c('0x42')](handleError(_0x9c64b8,null));};exports[_0xd21c('0x44')]=function(_0x1a075c,_0x376ec7){if(_0x1a075c[_0xd21c('0x45')]['id']){delete _0x1a075c['body']['id'];}return db['FaxTransferReport'][_0xd21c('0x46')]({'where':{'id':_0x1a075c[_0xd21c('0x47')]['id']}})['then'](handleEntityNotFound(_0x376ec7,null))[_0xd21c('0x23')](saveUpdates(_0x1a075c['body'],null))['then'](respondWithResult(_0x376ec7,null))[_0xd21c('0x42')](handleError(_0x376ec7,null));};exports['destroy']=function(_0x5e2821,_0x2d5686){return db[_0xd21c('0x3c')][_0xd21c('0x46')]({'where':{'id':_0x5e2821[_0xd21c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d5686,null))['then'](removeEntity(_0x2d5686,null))[_0xd21c('0x42')](handleError(_0x2d5686,null));};exports['describe']=function(_0x3277eb,_0x2b1a73){return db[_0xd21c('0x3c')]['describe']()[_0xd21c('0x23')](respondWithResult(_0x2b1a73,null))[_0xd21c('0x42')](handleError(_0x2b1a73,null));}; \ No newline at end of file +var _0x5419=['create','body','describe','html-pdf','eml-format','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','count','offset','limit','json','reject','save','update','then','destroy','sendStatus','stack','name','index','map','FaxTransferReport','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5419,0x175));var _0x9541=function(_0xd6aad,_0x3fd78e){_0xd6aad=_0xd6aad-0x0;var _0x1109e6=_0x5419[_0xd6aad];return _0x1109e6;};'use strict';var pdf=require(_0x9541('0x0'));var emlformat=require(_0x9541('0x1'));var rimraf=require(_0x9541('0x2'));var zipdir=require(_0x9541('0x3'));var jsonpatch=require(_0x9541('0x4'));var rp=require(_0x9541('0x5'));var moment=require(_0x9541('0x6'));var BPromise=require(_0x9541('0x7'));var Mustache=require(_0x9541('0x8'));var util=require(_0x9541('0x9'));var path=require('path');var sox=require(_0x9541('0xa'));var csv=require(_0x9541('0xb'));var ejs=require(_0x9541('0xc'));var fs=require('fs');var _=require(_0x9541('0xd'));var squel=require(_0x9541('0xe'));var crypto=require(_0x9541('0xf'));var jsforce=require(_0x9541('0x10'));var deskjs=require(_0x9541('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9541('0x12'));var Papa=require('papaparse');var Redis=require(_0x9541('0x13'));var authService=require(_0x9541('0x14'));var qs=require(_0x9541('0x15'));var as=require(_0x9541('0x16'));var hardwareService=require(_0x9541('0x17'));var logger=require(_0x9541('0x18'))(_0x9541('0x19'));var utils=require('../../config/utils');var config=require(_0x9541('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x75669e,_0x4f97a9){_0x4f97a9=_0x4f97a9||0xcc;return function(_0x40cc60){if(_0x40cc60){return _0x75669e['sendStatus'](_0x4f97a9);}return _0x75669e[_0x9541('0x1b')](_0x4f97a9)[_0x9541('0x1c')]();};}function respondWithResult(_0x1ffa34,_0x38ab15){_0x38ab15=_0x38ab15||0xc8;return function(_0x28316e){if(_0x28316e){return _0x1ffa34[_0x9541('0x1b')](_0x38ab15)['json'](_0x28316e);}};}function respondWithFilteredResult(_0x37a48e,_0x548cdc){return function(_0x64b64a){if(_0x64b64a){var _0x569b6d=_0x64b64a[_0x9541('0x1d')],_0x421985=_0x548cdc[_0x9541('0x1e')],_0x5ad2f5=_0x548cdc[_0x9541('0x1e')]+_0x548cdc[_0x9541('0x1f')],_0x92ca2f;if(_0x5ad2f5>=_0x569b6d){_0x5ad2f5=_0x569b6d;_0x92ca2f=0xc8;}else{_0x92ca2f=0xce;}_0x37a48e[_0x9541('0x1b')](_0x92ca2f);return _0x37a48e['set']('Content-Range',_0x421985+'-'+_0x5ad2f5+'/'+_0x569b6d)[_0x9541('0x20')](_0x64b64a);}return null;};}function patchUpdates(_0x24eaac){return function(_0x594ba4){try{jsonpatch['apply'](_0x594ba4,_0x24eaac,!![]);}catch(_0x2aafdb){return BPromise[_0x9541('0x21')](_0x2aafdb);}return _0x594ba4[_0x9541('0x22')]();};}function saveUpdates(_0xc6683a,_0xfbcffc){return function(_0x1a9f55){if(_0x1a9f55){return _0x1a9f55[_0x9541('0x23')](_0xc6683a)[_0x9541('0x24')](function(_0x30f965){return _0x30f965;});}return null;};}function removeEntity(_0x1f2d91,_0x43bb4c){return function(_0x54a827){if(_0x54a827){return _0x54a827[_0x9541('0x25')]()[_0x9541('0x24')](function(){_0x1f2d91[_0x9541('0x1b')](0xcc)[_0x9541('0x1c')]();});}};}function handleEntityNotFound(_0x101374,_0x2f6b0a){return function(_0x1b5adb){if(!_0x1b5adb){_0x101374[_0x9541('0x26')](0x194);}return _0x1b5adb;};}function handleError(_0x152361,_0x53100a){_0x53100a=_0x53100a||0x1f4;return function(_0x35ec2c){logger['error'](_0x35ec2c[_0x9541('0x27')]);if(_0x35ec2c[_0x9541('0x28')]){delete _0x35ec2c[_0x9541('0x28')];}_0x152361[_0x9541('0x1b')](_0x53100a)['send'](_0x35ec2c);};}exports[_0x9541('0x29')]=function(_0x46ea7e,_0x4f5602){var _0x3750f6={},_0x51b328={},_0x125d52={'count':0x0,'rows':[]};var _0x56645d=_[_0x9541('0x2a')](db[_0x9541('0x2b')]['rawAttributes'],function(_0xf82d59){return{'name':_0xf82d59[_0x9541('0x2c')],'type':_0xf82d59['type'][_0x9541('0x2d')]};});_0x51b328[_0x9541('0x2e')]=_['map'](_0x56645d,_0x9541('0x28'));_0x51b328['query']=_[_0x9541('0x2f')](_0x46ea7e[_0x9541('0x30')]);_0x51b328[_0x9541('0x31')]=_[_0x9541('0x32')](_0x51b328[_0x9541('0x2e')],_0x51b328[_0x9541('0x30')]);_0x3750f6[_0x9541('0x33')]=_['intersection'](_0x51b328[_0x9541('0x2e')],qs[_0x9541('0x34')](_0x46ea7e[_0x9541('0x30')][_0x9541('0x34')]));_0x3750f6[_0x9541('0x33')]=_0x3750f6[_0x9541('0x33')][_0x9541('0x35')]?_0x3750f6[_0x9541('0x33')]:_0x51b328[_0x9541('0x2e')];if(!_0x46ea7e[_0x9541('0x30')][_0x9541('0x36')](_0x9541('0x37'))){_0x3750f6[_0x9541('0x1f')]=qs[_0x9541('0x1f')](_0x46ea7e[_0x9541('0x30')][_0x9541('0x1f')]);_0x3750f6[_0x9541('0x1e')]=qs[_0x9541('0x1e')](_0x46ea7e[_0x9541('0x30')][_0x9541('0x1e')]);}_0x3750f6['order']=qs[_0x9541('0x38')](_0x46ea7e['query']['sort']);_0x3750f6['where']=qs['filters'](_[_0x9541('0x39')](_0x46ea7e[_0x9541('0x30')],_0x51b328[_0x9541('0x31')]),_0x56645d);if(_0x46ea7e['query'][_0x9541('0x3a')]){_0x3750f6[_0x9541('0x3b')]=_['merge'](_0x3750f6[_0x9541('0x3b')],{'$or':_[_0x9541('0x2a')](_0x56645d,function(_0xfdca53){if(_0xfdca53[_0x9541('0x3c')]!==_0x9541('0x3d')){var _0x2da830={};_0x2da830[_0xfdca53[_0x9541('0x28')]]={'$like':'%'+_0x46ea7e[_0x9541('0x30')][_0x9541('0x3a')]+'%'};return _0x2da830;}})});}_0x3750f6=_[_0x9541('0x3e')]({},_0x3750f6,_0x46ea7e['options']);var _0x4d48c0={'where':_0x3750f6[_0x9541('0x3b')]};return db[_0x9541('0x2b')][_0x9541('0x1d')](_0x4d48c0)[_0x9541('0x24')](function(_0x15eeee){_0x125d52[_0x9541('0x1d')]=_0x15eeee;if(_0x46ea7e[_0x9541('0x30')][_0x9541('0x3f')]){_0x3750f6[_0x9541('0x40')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x9541('0x41')](_0x3750f6);})['then'](function(_0x9af222){_0x125d52[_0x9541('0x42')]=_0x9af222;return _0x125d52;})[_0x9541('0x24')](respondWithFilteredResult(_0x4f5602,_0x3750f6))[_0x9541('0x43')](handleError(_0x4f5602,null));};exports['show']=function(_0x3c6868,_0x2b4b85){var _0x431865={'raw':!![],'where':{'id':_0x3c6868[_0x9541('0x44')]['id']}},_0x1f8d40={};_0x1f8d40[_0x9541('0x2e')]=_[_0x9541('0x2f')](db[_0x9541('0x2b')][_0x9541('0x45')]);_0x1f8d40['query']=_['keys'](_0x3c6868[_0x9541('0x30')]);_0x1f8d40[_0x9541('0x31')]=_[_0x9541('0x32')](_0x1f8d40['model'],_0x1f8d40[_0x9541('0x30')]);_0x431865['attributes']=_[_0x9541('0x32')](_0x1f8d40['model'],qs[_0x9541('0x34')](_0x3c6868[_0x9541('0x30')][_0x9541('0x34')]));_0x431865[_0x9541('0x33')]=_0x431865['attributes'][_0x9541('0x35')]?_0x431865[_0x9541('0x33')]:_0x1f8d40[_0x9541('0x2e')];if(_0x3c6868['query'][_0x9541('0x3f')]){_0x431865[_0x9541('0x40')]=[{'all':!![]}];}_0x431865=_[_0x9541('0x3e')]({},_0x431865,_0x3c6868[_0x9541('0x46')]);return db['FaxTransferReport']['find'](_0x431865)['then'](handleEntityNotFound(_0x2b4b85,null))['then'](respondWithResult(_0x2b4b85,null))[_0x9541('0x43')](handleError(_0x2b4b85,null));};exports[_0x9541('0x47')]=function(_0x3681b9,_0x38d9fa){return db[_0x9541('0x2b')]['create'](_0x3681b9[_0x9541('0x48')],{})[_0x9541('0x24')](respondWithResult(_0x38d9fa,0xc9))[_0x9541('0x43')](handleError(_0x38d9fa,null));};exports['update']=function(_0x4f892f,_0xa8051c){if(_0x4f892f[_0x9541('0x48')]['id']){delete _0x4f892f[_0x9541('0x48')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x4f892f[_0x9541('0x44')]['id']}})[_0x9541('0x24')](handleEntityNotFound(_0xa8051c,null))[_0x9541('0x24')](saveUpdates(_0x4f892f[_0x9541('0x48')],null))[_0x9541('0x24')](respondWithResult(_0xa8051c,null))[_0x9541('0x43')](handleError(_0xa8051c,null));};exports[_0x9541('0x25')]=function(_0x4e5266,_0x278a07){return db[_0x9541('0x2b')]['find']({'where':{'id':_0x4e5266['params']['id']}})[_0x9541('0x24')](handleEntityNotFound(_0x278a07,null))[_0x9541('0x24')](removeEntity(_0x278a07,null))[_0x9541('0x43')](handleError(_0x278a07,null));};exports[_0x9541('0x49')]=function(_0x2569b5,_0x164724){return db[_0x9541('0x2b')]['describe']()['then'](respondWithResult(_0x164724,null))[_0x9541('0x43')](handleError(_0x164724,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 08197ff..5f5ecd2 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 _0x8856=['define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x276d1c,_0x1f10bf){var _0x370eae=function(_0x550291){while(--_0x550291){_0x276d1c['push'](_0x276d1c['shift']());}};_0x370eae(++_0x1f10bf);}(_0x8856,0xac));var _0x6885=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8856[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6885('0x0'));var util=require('util');var logger=require(_0x6885('0x1'))(_0x6885('0x2'));var moment=require(_0x6885('0x3'));var BPromise=require(_0x6885('0x4'));var rp=require(_0x6885('0x5'));var fs=require('fs');var path=require(_0x6885('0x6'));var rimraf=require(_0x6885('0x7'));var config=require(_0x6885('0x8'));var attributes=require(_0x6885('0x9'));module['exports']=function(_0x34b490,_0x3a65c8){return _0x34b490[_0x6885('0xa')](_0x6885('0xb'),attributes,{'tableName':_0x6885('0xc'),'paranoid':![],'indexes':[{'name':_0x6885('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd742=['rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','../../config/logger','bluebird','request-promise','path'];(function(_0x4ebf38,_0x574b87){var _0x38ff67=function(_0x381283){while(--_0x381283){_0x4ebf38['push'](_0x4ebf38['shift']());}};_0x38ff67(++_0x574b87);}(_0xd742,0x80));var _0x2d74=function(_0x38b24b,_0x5cd9be){_0x38b24b=_0x38b24b-0x0;var _0x4b1707=_0xd742[_0x38b24b];return _0x4b1707;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d74('0x0'))('api');var moment=require('moment');var BPromise=require(_0x2d74('0x1'));var rp=require(_0x2d74('0x2'));var fs=require('fs');var path=require(_0x2d74('0x3'));var rimraf=require(_0x2d74('0x4'));var config=require(_0x2d74('0x5'));var attributes=require('./faxTransferReport.attributes');module[_0x2d74('0x6')]=function(_0x319ce4,_0x2ca047){return _0x319ce4[_0x2d74('0x7')](_0x2d74('0x8'),attributes,{'tableName':_0x2d74('0x9'),'paranoid':![],'indexes':[{'name':_0x2d74('0xa'),'fields':[_0x2d74('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index e5e1ca2..7dc1d88 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 _0xcbbe=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x35a6f8,_0x2a19d0){var _0x11d2da=function(_0x83f33e){while(--_0x83f33e){_0x35a6f8['push'](_0x35a6f8['shift']());}};_0x11d2da(++_0x2a19d0);}(_0xcbbe,0xda));var _0xecbb=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xcbbe[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xecbb('0x0'));var util=require(_0xecbb('0x1'));var moment=require(_0xecbb('0x2'));var BPromise=require('bluebird');var rs=require(_0xecbb('0x3'));var fs=require('fs');var Redis=require(_0xecbb('0x4'));var db=require(_0xecbb('0x5'))['db'];var utils=require(_0xecbb('0x6'));var logger=require(_0xecbb('0x7'))(_0xecbb('0x8'));var config=require(_0xecbb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xecbb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bc271,_0x49626d,_0x4e7146){return new BPromise(function(_0x59ca17,_0x3c6a27){return client['request'](_0x5bc271,_0x4e7146)['then'](function(_0x175576){logger[_0xecbb('0xb')](_0xecbb('0xc'),_0x49626d,_0xecbb('0xd'));logger[_0xecbb('0xe')](_0xecbb('0xf'),_0x49626d,_0xecbb('0xd'),JSON[_0xecbb('0x10')](_0x175576));if(_0x175576[_0xecbb('0x11')]){if(_0x175576[_0xecbb('0x11')][_0xecbb('0x12')]===0x1f4){logger[_0xecbb('0x11')](_0xecbb('0xc'),_0x49626d,_0x175576['error']['message']);return _0x3c6a27(_0x175576[_0xecbb('0x11')]['message']);}logger[_0xecbb('0x11')](_0xecbb('0xc'),_0x49626d,_0x175576[_0xecbb('0x11')][_0xecbb('0x13')]);return _0x59ca17(_0x175576[_0xecbb('0x11')]['message']);}else{logger[_0xecbb('0xb')](_0xecbb('0xc'),_0x49626d,_0xecbb('0xd'));_0x59ca17(_0x175576[_0xecbb('0x14')]['message']);}})[_0xecbb('0x15')](function(_0x33b5b2){logger['error'](_0xecbb('0xc'),_0x49626d,_0x33b5b2);_0x3c6a27(_0x33b5b2);});});} \ No newline at end of file +var _0xdde6=['error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x19eb43,_0x10c355){var _0x57598c=function(_0x1d32c6){while(--_0x1d32c6){_0x19eb43['push'](_0x19eb43['shift']());}};_0x57598c(++_0x10c355);}(_0xdde6,0xab));var _0x6dde=function(_0x29fc9a,_0x4d0670){_0x29fc9a=_0x29fc9a-0x0;var _0x34d338=_0xdde6[_0x29fc9a];return _0x34d338;};'use strict';var _=require(_0x6dde('0x0'));var util=require(_0x6dde('0x1'));var moment=require(_0x6dde('0x2'));var BPromise=require(_0x6dde('0x3'));var rs=require(_0x6dde('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dde('0x5'))['db'];var utils=require(_0x6dde('0x6'));var logger=require(_0x6dde('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6dde('0x8'));var client=jayson['client'][_0x6dde('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1987a,_0x5937e0,_0x3a2588){return new BPromise(function(_0x3c86eb,_0xcd27f8){return client[_0x6dde('0xa')](_0x1987a,_0x3a2588)[_0x6dde('0xb')](function(_0x2377c8){logger[_0x6dde('0xc')](_0x6dde('0xd'),_0x5937e0,_0x6dde('0xe'));logger[_0x6dde('0xf')](_0x6dde('0x10'),_0x5937e0,'request\x20sent',JSON[_0x6dde('0x11')](_0x2377c8));if(_0x2377c8[_0x6dde('0x12')]){if(_0x2377c8['error'][_0x6dde('0x13')]===0x1f4){logger[_0x6dde('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x5937e0,_0x2377c8[_0x6dde('0x12')][_0x6dde('0x14')]);return _0xcd27f8(_0x2377c8[_0x6dde('0x12')][_0x6dde('0x14')]);}logger['error'](_0x6dde('0xd'),_0x5937e0,_0x2377c8[_0x6dde('0x12')]['message']);return _0x3c86eb(_0x2377c8[_0x6dde('0x12')]['message']);}else{logger['info'](_0x6dde('0xd'),_0x5937e0,'request\x20sent');_0x3c86eb(_0x2377c8['result'][_0x6dde('0x14')]);}})['catch'](function(_0xda5b5b){logger[_0x6dde('0x12')](_0x6dde('0xd'),_0x5937e0,_0xda5b5b);_0xcd27f8(_0xda5b5b);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2a099be..a6ce45a 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 _0x4bff=['exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','describe','get','/:id','show','create','update','destroy'];(function(_0x59a4be,_0x1ba00a){var _0x1d4a28=function(_0x2106a8){while(--_0x2106a8){_0x59a4be['push'](_0x59a4be['shift']());}};_0x1d4a28(++_0x1ba00a);}(_0x4bff,0x111));var _0xf4bf=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x4bff[_0x79cd47];return _0x3b9484;};'use strict';var multer=require(_0xf4bf('0x0'));var util=require(_0xf4bf('0x1'));var path=require(_0xf4bf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf4bf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf4bf('0x4'));var config=require(_0xf4bf('0x5'));var controller=require(_0xf4bf('0x6'));router['get']('/',auth[_0xf4bf('0x7')](),controller[_0xf4bf('0x8')]);router['get']('/describe',auth[_0xf4bf('0x7')](),controller[_0xf4bf('0x9')]);router[_0xf4bf('0xa')](_0xf4bf('0xb'),auth[_0xf4bf('0x7')](),controller[_0xf4bf('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf4bf('0xd')]);router['put'](_0xf4bf('0xb'),auth[_0xf4bf('0x7')](),controller[_0xf4bf('0xe')]);router['delete'](_0xf4bf('0xb'),auth[_0xf4bf('0x7')](),controller[_0xf4bf('0xf')]);module[_0xf4bf('0x10')]=router; \ No newline at end of file +var _0xa289=['../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','describe','/:id','isAuthenticated','create','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0xa289,0x8a));var _0x9a28=function(_0x192217,_0x307c1d){_0x192217=_0x192217-0x0;var _0x21d529=_0xa289[_0x192217];return _0x21d529;};'use strict';var multer=require(_0x9a28('0x0'));var util=require(_0x9a28('0x1'));var path=require(_0x9a28('0x2'));var timeout=require(_0x9a28('0x3'));var express=require('express');var router=express[_0x9a28('0x4')]();var auth=require(_0x9a28('0x5'));var interaction=require(_0x9a28('0x6'));var config=require(_0x9a28('0x7'));var controller=require(_0x9a28('0x8'));router[_0x9a28('0x9')]('/',auth['isAuthenticated'](),controller[_0x9a28('0xa')]);router[_0x9a28('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9a28('0xb')]);router[_0x9a28('0x9')](_0x9a28('0xc'),auth[_0x9a28('0xd')](),controller['show']);router['post']('/',auth[_0x9a28('0xd')](),controller[_0x9a28('0xe')]);router['put'](_0x9a28('0xc'),auth[_0x9a28('0xd')](),controller[_0x9a28('0xf')]);router[_0x9a28('0x10')](_0x9a28('0xc'),auth[_0x9a28('0xd')](),controller[_0x9a28('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 5a5f1d8..c7ad776 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 _0xb2e4=['addConfiguration','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x470e3d,_0x4f2792){var _0x428559=function(_0xdde070){while(--_0xdde070){_0x470e3d['push'](_0x470e3d['shift']());}};_0x428559(++_0x4f2792);}(_0xb2e4,0x180));var _0x4b2e=function(_0x232ec0,_0x45fdd0){_0x232ec0=_0x232ec0-0x0;var _0x356705=_0xb2e4[_0x232ec0];return _0x356705;};'use strict';var multer=require(_0x4b2e('0x0'));var util=require('util');var path=require(_0x4b2e('0x1'));var timeout=require(_0x4b2e('0x2'));var express=require(_0x4b2e('0x3'));var router=express[_0x4b2e('0x4')]();var auth=require(_0x4b2e('0x5'));var interaction=require(_0x4b2e('0x6'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x4b2e('0x7')]('/',auth[_0x4b2e('0x8')](),controller['index']);router[_0x4b2e('0x7')](_0x4b2e('0x9'),auth[_0x4b2e('0x8')](),controller[_0x4b2e('0xa')]);router[_0x4b2e('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4b2e('0xb')]);router[_0x4b2e('0x7')](_0x4b2e('0xc'),auth[_0x4b2e('0x8')](),controller[_0x4b2e('0xd')]);router[_0x4b2e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4b2e('0xe')]('/:id/configurations',auth[_0x4b2e('0x8')](),controller[_0x4b2e('0xf')]);router[_0x4b2e('0x10')](_0x4b2e('0x9'),auth[_0x4b2e('0x8')](),controller[_0x4b2e('0x11')]);router['delete'](_0x4b2e('0x9'),auth[_0x4b2e('0x8')](),controller['destroy']);module[_0x4b2e('0x12')]=router; \ No newline at end of file +var _0x934b=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy'];(function(_0x31a7a0,_0x1118b0){var _0x5674ed=function(_0x427271){while(--_0x427271){_0x31a7a0['push'](_0x31a7a0['shift']());}};_0x5674ed(++_0x1118b0);}(_0x934b,0x140));var _0xb934=function(_0x23e3b0,_0x5f2901){_0x23e3b0=_0x23e3b0-0x0;var _0x13c675=_0x934b[_0x23e3b0];return _0x13c675;};'use strict';var multer=require(_0xb934('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb934('0x1'));var express=require(_0xb934('0x2'));var router=express[_0xb934('0x3')]();var auth=require(_0xb934('0x4'));var interaction=require(_0xb934('0x5'));var config=require('../../config/environment');var controller=require(_0xb934('0x6'));router[_0xb934('0x7')]('/',auth[_0xb934('0x8')](),controller['index']);router[_0xb934('0x7')](_0xb934('0x9'),auth[_0xb934('0x8')](),controller[_0xb934('0xa')]);router[_0xb934('0x7')](_0xb934('0xb'),auth['isAuthenticated'](),controller[_0xb934('0xc')]);router[_0xb934('0x7')]('/:id/fields',auth[_0xb934('0x8')](),controller[_0xb934('0xd')]);router[_0xb934('0xe')]('/',auth[_0xb934('0x8')](),controller[_0xb934('0xf')]);router[_0xb934('0xe')]('/:id/configurations',auth[_0xb934('0x8')](),controller[_0xb934('0x10')]);router[_0xb934('0x11')]('/:id',auth[_0xb934('0x8')](),controller['update']);router[_0xb934('0x12')](_0xb934('0x9'),auth[_0xb934('0x8')](),controller[_0xb934('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 45bea50..ceaa11f 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 _0x7e05=['ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x544f39,_0x50c1aa){var _0x2bff0a=function(_0x287e5e){while(--_0x287e5e){_0x544f39['push'](_0x544f39['shift']());}};_0x2bff0a(++_0x50c1aa);}(_0x7e05,0x69));var _0x57e0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7e05[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x57e0('0x0'));module[_0x57e0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x57e0('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x57e0('0x2')]},'authType':{'type':Sequelize[_0x57e0('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0x57e0('0x2')]},'consumerKey':{'type':Sequelize[_0x57e0('0x2')]},'consumerSecret':{'type':Sequelize[_0x57e0('0x2')]},'token':{'type':Sequelize[_0x57e0('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x57e0('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x57e0('0x4'),_0x57e0('0x5')),'defaultValue':_0x57e0('0x4')}}; \ No newline at end of file +var _0xb299=['integrationTab','sequelize','STRING','ENUM','basic'];(function(_0x20621e,_0x520d54){var _0x843dde=function(_0x393703){while(--_0x393703){_0x20621e['push'](_0x20621e['shift']());}};_0x843dde(++_0x520d54);}(_0xb299,0x19b));var _0x9b29=function(_0x39f96b,_0xa6fd4d){_0x39f96b=_0x39f96b-0x0;var _0x24aa95=_0xb299[_0x39f96b];return _0x24aa95;};'use strict';var Sequelize=require(_0x9b29('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b29('0x1')]},'description':{'type':Sequelize[_0x9b29('0x1')]},'username':{'type':Sequelize[_0x9b29('0x1')]},'remoteUri':{'type':Sequelize[_0x9b29('0x1')]},'authType':{'type':Sequelize[_0x9b29('0x2')](_0x9b29('0x3')),'defaultValue':_0x9b29('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x9b29('0x1')]},'consumerSecret':{'type':Sequelize[_0x9b29('0x1')]},'token':{'type':Sequelize[_0x9b29('0x1')]},'tokenSecret':{'type':Sequelize[_0x9b29('0x1')]},'serverUrl':{'type':Sequelize[_0x9b29('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9b29('0x2')](_0x9b29('0x4'),'newTab'),'defaultValue':_0x9b29('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index e00c54a..f0fd401 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 _0xfaf9=['remoteUri','authType','username','password','consumerKey','token','tokenSecret','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','sendStatus','end','status','limit','set','Content-Range','json','reject','save','update','stack','name','send','map','fieldName','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','VIRTUAL','filter','options','DeskAccount','count','findAll','rows','show','params','keys','includeAll','include','find','create','body','destroy','getConfigurations','DeskConfiguration','rawAttributes','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0xfaf9,0x98));var _0x9faf=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xfaf9[_0x8de54f];return _0x14cba4;};'use strict';var pdf=require(_0x9faf('0x0'));var emlformat=require(_0x9faf('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9faf('0x2'));var rp=require(_0x9faf('0x3'));var moment=require(_0x9faf('0x4'));var BPromise=require(_0x9faf('0x5'));var Mustache=require(_0x9faf('0x6'));var util=require('util');var path=require(_0x9faf('0x7'));var sox=require(_0x9faf('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9faf('0x9'));var squel=require(_0x9faf('0xa'));var crypto=require(_0x9faf('0xb'));var jsforce=require(_0x9faf('0xc'));var deskjs=require(_0x9faf('0xd'));var toCsv=require(_0x9faf('0xe'));var querystring=require('querystring');var Papa=require(_0x9faf('0xf'));var Redis=require(_0x9faf('0x10'));var authService=require(_0x9faf('0x11'));var qs=require(_0x9faf('0x12'));var as=require(_0x9faf('0x13'));var hardwareService=require(_0x9faf('0x14'));var logger=require(_0x9faf('0x15'))(_0x9faf('0x16'));var utils=require(_0x9faf('0x17'));var config=require(_0x9faf('0x18'));var licenseUtil=require(_0x9faf('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9faf('0x1a'));var jayson=require(_0x9faf('0x1b'));var client=jayson[_0x9faf('0x1c')][_0x9faf('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3f090f,_0x35f604,_0x5cc14f,_0x1cfb53){return new BPromise(function(_0x1c6bb7,_0x2b8e00){var _0x2ba7aa=_0x1cfb53||client;return _0x2ba7aa[_0x9faf('0x1e')](_0x3f090f,_0x5cc14f)[_0x9faf('0x1f')](function(_0x273424){logger[_0x9faf('0x20')](_0x9faf('0x21'),_0x35f604,'request\x20sent');logger['debug'](_0x9faf('0x22'),_0x35f604,_0x9faf('0x23'),JSON[_0x9faf('0x24')](_0x273424));if(_0x273424['error']){if(_0x273424['error'][_0x9faf('0x25')]===0x1f4){logger[_0x9faf('0x26')]('DeskAccount,\x20%s,\x20%s',_0x35f604,_0x273424['error']['message']);return _0x2b8e00(_0x273424[_0x9faf('0x26')][_0x9faf('0x27')]);}logger['error'](_0x9faf('0x21'),_0x35f604,_0x273424[_0x9faf('0x26')][_0x9faf('0x27')]);return _0x1c6bb7(_0x273424[_0x9faf('0x26')][_0x9faf('0x27')]);}else{logger[_0x9faf('0x20')](_0x9faf('0x21'),_0x35f604,'request\x20sent');_0x1c6bb7(_0x273424['result']['message']);}})[_0x9faf('0x28')](function(_0x188ea0){logger[_0x9faf('0x26')](_0x9faf('0x21'),_0x35f604,_0x188ea0);_0x2b8e00(_0x188ea0);});});}function respondWithStatusCode(_0x545227,_0x7b6522){_0x7b6522=_0x7b6522||0xcc;return function(_0x32cc81){if(_0x32cc81){return _0x545227[_0x9faf('0x29')](_0x7b6522);}return _0x545227['status'](_0x7b6522)[_0x9faf('0x2a')]();};}function respondWithResult(_0x2d95da,_0xc1e71c){_0xc1e71c=_0xc1e71c||0xc8;return function(_0x1d32ed){if(_0x1d32ed){return _0x2d95da[_0x9faf('0x2b')](_0xc1e71c)['json'](_0x1d32ed);}};}function respondWithFilteredResult(_0x3ce146,_0x3c1c12){return function(_0x37986f){if(_0x37986f){var _0x421659=_0x37986f['count'],_0x1de570=_0x3c1c12['offset'],_0x5d75c5=_0x3c1c12['offset']+_0x3c1c12[_0x9faf('0x2c')],_0x1a89d2;if(_0x5d75c5>=_0x421659){_0x5d75c5=_0x421659;_0x1a89d2=0xc8;}else{_0x1a89d2=0xce;}_0x3ce146['status'](_0x1a89d2);return _0x3ce146[_0x9faf('0x2d')](_0x9faf('0x2e'),_0x1de570+'-'+_0x5d75c5+'/'+_0x421659)[_0x9faf('0x2f')](_0x37986f);}return null;};}function patchUpdates(_0x3e1163){return function(_0x3a6fb4){try{jsonpatch['apply'](_0x3a6fb4,_0x3e1163,!![]);}catch(_0x251a5e){return BPromise[_0x9faf('0x30')](_0x251a5e);}return _0x3a6fb4[_0x9faf('0x31')]();};}function saveUpdates(_0x367f61,_0x56942f){return function(_0xed2077){if(_0xed2077){return _0xed2077[_0x9faf('0x32')](_0x367f61)[_0x9faf('0x1f')](function(_0x5a6b81){return _0x5a6b81;});}return null;};}function removeEntity(_0x3da0cb,_0x191475){return function(_0x21d8dc){if(_0x21d8dc){return _0x21d8dc['destroy']()[_0x9faf('0x1f')](function(){_0x3da0cb[_0x9faf('0x2b')](0xcc)[_0x9faf('0x2a')]();});}};}function handleEntityNotFound(_0x45c0e7,_0x569152){return function(_0x2c2f98){if(!_0x2c2f98){_0x45c0e7[_0x9faf('0x29')](0x194);}return _0x2c2f98;};}function handleError(_0x547ba7,_0x3d7397){_0x3d7397=_0x3d7397||0x1f4;return function(_0x19457b){logger[_0x9faf('0x26')](_0x19457b[_0x9faf('0x33')]);if(_0x19457b[_0x9faf('0x34')]){delete _0x19457b[_0x9faf('0x34')];}_0x547ba7[_0x9faf('0x2b')](_0x3d7397)[_0x9faf('0x35')](_0x19457b);};}exports['index']=function(_0x4cc75c,_0xd2269){var _0x3cdd6e={},_0x397d47={},_0x2985ea={'count':0x0,'rows':[]};var _0x1f9e24=_[_0x9faf('0x36')](db['DeskAccount']['rawAttributes'],function(_0xda0e7b){return{'name':_0xda0e7b[_0x9faf('0x37')],'type':_0xda0e7b[_0x9faf('0x38')]['key']};});_0x397d47['model']=_[_0x9faf('0x36')](_0x1f9e24,'name');_0x397d47[_0x9faf('0x39')]=_['keys'](_0x4cc75c[_0x9faf('0x39')]);_0x397d47[_0x9faf('0x3a')]=_[_0x9faf('0x3b')](_0x397d47['model'],_0x397d47[_0x9faf('0x39')]);_0x3cdd6e[_0x9faf('0x3c')]=_['intersection'](_0x397d47[_0x9faf('0x3d')],qs[_0x9faf('0x3e')](_0x4cc75c[_0x9faf('0x39')][_0x9faf('0x3e')]));_0x3cdd6e[_0x9faf('0x3c')]=_0x3cdd6e['attributes'][_0x9faf('0x3f')]?_0x3cdd6e['attributes']:_0x397d47[_0x9faf('0x3d')];if(!_0x4cc75c[_0x9faf('0x39')][_0x9faf('0x40')](_0x9faf('0x41'))){_0x3cdd6e[_0x9faf('0x2c')]=qs[_0x9faf('0x2c')](_0x4cc75c['query'][_0x9faf('0x2c')]);_0x3cdd6e[_0x9faf('0x42')]=qs[_0x9faf('0x42')](_0x4cc75c[_0x9faf('0x39')][_0x9faf('0x42')]);}_0x3cdd6e[_0x9faf('0x43')]=qs[_0x9faf('0x44')](_0x4cc75c[_0x9faf('0x39')][_0x9faf('0x44')]);_0x3cdd6e['where']=qs[_0x9faf('0x3a')](_[_0x9faf('0x45')](_0x4cc75c[_0x9faf('0x39')],_0x397d47[_0x9faf('0x3a')]),_0x1f9e24);if(_0x4cc75c[_0x9faf('0x39')]['filter']){_0x3cdd6e[_0x9faf('0x46')]=_[_0x9faf('0x47')](_0x3cdd6e[_0x9faf('0x46')],{'$or':_[_0x9faf('0x36')](_0x1f9e24,function(_0x469729){if(_0x469729['type']!==_0x9faf('0x48')){var _0x195763={};_0x195763[_0x469729[_0x9faf('0x34')]]={'$like':'%'+_0x4cc75c[_0x9faf('0x39')][_0x9faf('0x49')]+'%'};return _0x195763;}})});}_0x3cdd6e=_[_0x9faf('0x47')]({},_0x3cdd6e,_0x4cc75c[_0x9faf('0x4a')]);var _0x569524={'where':_0x3cdd6e[_0x9faf('0x46')]};return db[_0x9faf('0x4b')]['count'](_0x569524)[_0x9faf('0x1f')](function(_0x500d81){_0x2985ea[_0x9faf('0x4c')]=_0x500d81;if(_0x4cc75c['query']['includeAll']){_0x3cdd6e['include']=[{'all':!![]}];}return db[_0x9faf('0x4b')][_0x9faf('0x4d')](_0x3cdd6e);})['then'](function(_0x2d3448){_0x2985ea[_0x9faf('0x4e')]=_0x2d3448;return _0x2985ea;})[_0x9faf('0x1f')](respondWithFilteredResult(_0xd2269,_0x3cdd6e))['catch'](handleError(_0xd2269,null));};exports[_0x9faf('0x4f')]=function(_0x3befc4,_0x118c81){var _0x3b301c={'raw':![],'where':{'id':_0x3befc4[_0x9faf('0x50')]['id']}},_0x3a4be0={};_0x3a4be0[_0x9faf('0x3d')]=_['keys'](db[_0x9faf('0x4b')]['rawAttributes']);_0x3a4be0[_0x9faf('0x39')]=_[_0x9faf('0x51')](_0x3befc4[_0x9faf('0x39')]);_0x3a4be0[_0x9faf('0x3a')]=_['intersection'](_0x3a4be0[_0x9faf('0x3d')],_0x3a4be0[_0x9faf('0x39')]);_0x3b301c[_0x9faf('0x3c')]=_[_0x9faf('0x3b')](_0x3a4be0[_0x9faf('0x3d')],qs['fields'](_0x3befc4[_0x9faf('0x39')][_0x9faf('0x3e')]));_0x3b301c['attributes']=_0x3b301c[_0x9faf('0x3c')]['length']?_0x3b301c['attributes']:_0x3a4be0[_0x9faf('0x3d')];if(_0x3befc4[_0x9faf('0x39')][_0x9faf('0x52')]){_0x3b301c[_0x9faf('0x53')]=[{'all':!![]}];}_0x3b301c=_[_0x9faf('0x47')]({},_0x3b301c,_0x3befc4['options']);return db[_0x9faf('0x4b')][_0x9faf('0x54')](_0x3b301c)[_0x9faf('0x1f')](handleEntityNotFound(_0x118c81,null))[_0x9faf('0x1f')](respondWithResult(_0x118c81,null))[_0x9faf('0x28')](handleError(_0x118c81,null));};exports[_0x9faf('0x55')]=function(_0x2cc12a,_0xad16af){return db[_0x9faf('0x4b')][_0x9faf('0x55')](_0x2cc12a[_0x9faf('0x56')],{})['then'](respondWithResult(_0xad16af,0xc9))[_0x9faf('0x28')](handleError(_0xad16af,null));};exports['update']=function(_0x3f1e70,_0x5354e3){if(_0x3f1e70[_0x9faf('0x56')]['id']){delete _0x3f1e70['body']['id'];}return db[_0x9faf('0x4b')][_0x9faf('0x54')]({'where':{'id':_0x3f1e70[_0x9faf('0x50')]['id']}})[_0x9faf('0x1f')](handleEntityNotFound(_0x5354e3,null))[_0x9faf('0x1f')](saveUpdates(_0x3f1e70[_0x9faf('0x56')],null))[_0x9faf('0x1f')](respondWithResult(_0x5354e3,null))[_0x9faf('0x28')](handleError(_0x5354e3,null));};exports[_0x9faf('0x57')]=function(_0x333fb0,_0xc64628){return db[_0x9faf('0x4b')]['find']({'where':{'id':_0x333fb0[_0x9faf('0x50')]['id']}})[_0x9faf('0x1f')](handleEntityNotFound(_0xc64628,null))['then'](removeEntity(_0xc64628,null))['catch'](handleError(_0xc64628,null));};exports[_0x9faf('0x58')]=function(_0x8120ba,_0x5881ac,_0x118005){var _0x4c0ed9={};var _0x39c4a0={};var _0x4cf9d9;var _0xb844f7;return db[_0x9faf('0x4b')]['findOne']({'where':{'id':_0x8120ba[_0x9faf('0x50')]['id']}})[_0x9faf('0x1f')](handleEntityNotFound(_0x5881ac,null))[_0x9faf('0x1f')](function(_0x174b28){if(_0x174b28){_0x4cf9d9=_0x174b28;_0x39c4a0[_0x9faf('0x3d')]=_[_0x9faf('0x51')](db[_0x9faf('0x59')][_0x9faf('0x5a')]);_0x39c4a0[_0x9faf('0x39')]=_[_0x9faf('0x51')](_0x8120ba[_0x9faf('0x39')]);_0x39c4a0[_0x9faf('0x3a')]=_[_0x9faf('0x3b')](_0x39c4a0[_0x9faf('0x3d')],_0x39c4a0[_0x9faf('0x39')]);_0x4c0ed9[_0x9faf('0x3c')]=_[_0x9faf('0x3b')](_0x39c4a0[_0x9faf('0x3d')],qs[_0x9faf('0x3e')](_0x8120ba[_0x9faf('0x39')]['fields']));_0x4c0ed9['attributes']=_0x4c0ed9[_0x9faf('0x3c')]['length']?_0x4c0ed9[_0x9faf('0x3c')]:_0x39c4a0['model'];_0x4c0ed9[_0x9faf('0x43')]=qs[_0x9faf('0x44')](_0x8120ba[_0x9faf('0x39')][_0x9faf('0x44')]);_0x4c0ed9[_0x9faf('0x46')]=qs[_0x9faf('0x3a')](_[_0x9faf('0x45')](_0x8120ba[_0x9faf('0x39')],_0x39c4a0['filters']));if(_0x8120ba[_0x9faf('0x39')][_0x9faf('0x49')]){_0x4c0ed9[_0x9faf('0x46')]=_['merge'](_0x4c0ed9[_0x9faf('0x46')],{'$or':_[_0x9faf('0x36')](_0x4c0ed9['attributes'],function(_0x3f3ae7){var _0x562061={};_0x562061[_0x3f3ae7]={'$like':'%'+_0x8120ba[_0x9faf('0x39')][_0x9faf('0x49')]+'%'};return _0x562061;})});}_0x4c0ed9=_[_0x9faf('0x47')]({},_0x4c0ed9,_0x8120ba[_0x9faf('0x4a')]);return _0x4cf9d9[_0x9faf('0x58')](_0x4c0ed9);}})[_0x9faf('0x1f')](function(_0x17c736){if(_0x17c736){_0xb844f7=_0x17c736[_0x9faf('0x3f')];if(!_0x8120ba[_0x9faf('0x39')][_0x9faf('0x40')](_0x9faf('0x41'))){_0x4c0ed9[_0x9faf('0x2c')]=qs[_0x9faf('0x2c')](_0x8120ba[_0x9faf('0x39')][_0x9faf('0x2c')]);_0x4c0ed9[_0x9faf('0x42')]=qs[_0x9faf('0x42')](_0x8120ba[_0x9faf('0x39')][_0x9faf('0x42')]);}return _0x4cf9d9['getConfigurations'](_0x4c0ed9);}})['then'](function(_0x344536){if(_0x344536){return _0x344536?{'count':_0xb844f7,'rows':_0x344536}:null;}})[_0x9faf('0x1f')](respondWithResult(_0x5881ac,null))[_0x9faf('0x28')](handleError(_0x5881ac,null));};exports['addConfiguration']=function(_0x580a19,_0x378de0,_0x56600e){if(_0x580a19[_0x9faf('0x56')]['id']){delete _0x580a19['body']['id'];}return db[_0x9faf('0x4b')][_0x9faf('0x5b')]({'where':{'id':_0x580a19['params']['id']}})['then'](handleEntityNotFound(_0x378de0,null))['then'](function(_0x2c8d1f){if(_0x2c8d1f){_0x580a19[_0x9faf('0x56')]['AccountId']=_0x2c8d1f['id'];_0x580a19[_0x9faf('0x56')][_0x9faf('0x5c')]=integrations[_0x9faf('0x5d')](_0x580a19[_0x9faf('0x56')][_0x9faf('0x5e')],_0x580a19[_0x9faf('0x56')]['type']);_0x580a19[_0x9faf('0x56')][_0x9faf('0x5f')]=integrations[_0x9faf('0x60')](_0x580a19[_0x9faf('0x56')]['channel'],_0x580a19[_0x9faf('0x56')][_0x9faf('0x38')]);return db[_0x9faf('0x59')][_0x9faf('0x55')](_0x580a19[_0x9faf('0x56')],{'include':[{'model':db[_0x9faf('0x61')],'as':_0x9faf('0x5c')},{'model':db['DeskField'],'as':_0x9faf('0x5f')}]});}return null;})[_0x9faf('0x1f')](respondWithResult(_0x378de0,null))[_0x9faf('0x28')](handleError(_0x378de0,null));};exports[_0x9faf('0x62')]=function(_0xeef9e0,_0x57cea3,_0x5b8889){var _0x4a3aa3=[{'name':_0x9faf('0x63'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5ad5ec='';return db[_0x9faf('0x4b')][_0x9faf('0x5b')]({'where':{'id':_0xeef9e0[_0x9faf('0x50')]['id']},'attributes':['id',_0x9faf('0x64'),_0x9faf('0x65'),_0x9faf('0x66'),_0x9faf('0x67'),_0x9faf('0x68'),'consumerSecret',_0x9faf('0x69'),_0x9faf('0x6a')]})[_0x9faf('0x1f')](handleEntityNotFound(_0x57cea3,null))[_0x9faf('0x1f')](function(_0x5e512c){if(_0x5e512c){_0x5ad5ec=_0x5e512c[_0x9faf('0x64')];var _0x2fb536=_0x5ad5ec['slice'](-0x1);if(_0x2fb536==='/'){_0x5ad5ec=_0x5ad5ec['substring'](0x0,_0x5ad5ec[_0x9faf('0x6b')](_0x2fb536));}var _0x3a0321={'method':_0x9faf('0x6c'),'uri':util[_0x9faf('0x6d')](_0x9faf('0x6e'),_0x5ad5ec),'headers':{'Content-Type':_0x9faf('0x6f'),'Accept':'application/json'},'json':!![]};if(_0x5e512c[_0x9faf('0x65')]===_0x9faf('0x70')){_0x3a0321['headers'][_0x9faf('0x71')]=util[_0x9faf('0x6d')](_0x9faf('0x72'),new Buffer(util[_0x9faf('0x6d')](_0x9faf('0x73'),_0x5e512c[_0x9faf('0x66')],_0x5e512c[_0x9faf('0x67')]))[_0x9faf('0x74')](_0x9faf('0x75')));}return rp(_0x3a0321)[_0x9faf('0x1f')](function(_0x459f9a){return _0x4a3aa3[_0x9faf('0x76')](_['map'](_0x459f9a[_0x9faf('0x77')][_0x9faf('0x78')],function(_0xac95ff){return{'id':_0xac95ff[_0x9faf('0x34')],'name':_0xac95ff[_0x9faf('0x34')],'type':_0xac95ff[_0x9faf('0x38')],'active':_0xac95ff[_0x9faf('0x79')],'label':_0xac95ff['label'],'custom':!![]};}));});}})[_0x9faf('0x1f')](function(_0x224a3e){return{'count':_0x224a3e[_0x9faf('0x3f')],'rows':_0x224a3e};})[_0x9faf('0x1f')](respondWithResult(_0x57cea3,null))[_0x9faf('0x28')](function(_0x250dd2){var _0x5a971c=_0xeef9e0[_0x9faf('0x39')]['test']?0x1f4:_0x250dd2[_0x9faf('0x7a')]||0x1f4;logger[_0x9faf('0x26')](_0x9faf('0x7b'),_0x9faf('0x62'),_0x5a971c,JSON['stringify'](_0x250dd2));delete _0x250dd2[_0x9faf('0x34')];if(_0x5a971c===0x191){_0x5a971c=0x190;}_0x57cea3[_0x9faf('0x2b')](_0x5a971c)['send'](_0xeef9e0[_0x9faf('0x39')][_0x9faf('0x7c')]?{'message':_0x9faf('0x7d'),'statusCode':_0x250dd2[_0x9faf('0x7a')]}:_0x250dd2);});}; \ No newline at end of file +var _0xa591=['rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','fields','length','find','create','body','getConfigurations','findOne','params','order','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','DeskAccount'];(function(_0x59a1c9,_0x436f29){var _0x3cf1de=function(_0x1729f2){while(--_0x1729f2){_0x59a1c9['push'](_0x59a1c9['shift']());}};_0x3cf1de(++_0x436f29);}(_0xa591,0x141));var _0x1a59=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xa591[_0x2e4e19];return _0x9ba20b;};'use strict';var pdf=require(_0x1a59('0x0'));var emlformat=require(_0x1a59('0x1'));var rimraf=require(_0x1a59('0x2'));var zipdir=require(_0x1a59('0x3'));var jsonpatch=require(_0x1a59('0x4'));var rp=require(_0x1a59('0x5'));var moment=require(_0x1a59('0x6'));var BPromise=require(_0x1a59('0x7'));var Mustache=require(_0x1a59('0x8'));var util=require(_0x1a59('0x9'));var path=require(_0x1a59('0xa'));var sox=require('sox');var csv=require(_0x1a59('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1a59('0xc'));var jsforce=require(_0x1a59('0xd'));var deskjs=require(_0x1a59('0xe'));var toCsv=require(_0x1a59('0xb'));var querystring=require(_0x1a59('0xf'));var Papa=require(_0x1a59('0x10'));var Redis=require('ioredis');var authService=require(_0x1a59('0x11'));var qs=require(_0x1a59('0x12'));var as=require(_0x1a59('0x13'));var hardwareService=require(_0x1a59('0x14'));var logger=require(_0x1a59('0x15'))(_0x1a59('0x16'));var utils=require(_0x1a59('0x17'));var config=require(_0x1a59('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1a59('0x19'))['db'];var integrations=require(_0x1a59('0x1a'));var jayson=require(_0x1a59('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a60de,_0x42d727,_0x275f05,_0x135e7d){return new BPromise(function(_0x280912,_0x477d8b){var _0x109a76=_0x135e7d||client;return _0x109a76[_0x1a59('0x1c')](_0x2a60de,_0x275f05)[_0x1a59('0x1d')](function(_0x2383a1){logger[_0x1a59('0x1e')](_0x1a59('0x1f'),_0x42d727,_0x1a59('0x20'));logger['debug'](_0x1a59('0x21'),_0x42d727,'request\x20sent',JSON['stringify'](_0x2383a1));if(_0x2383a1[_0x1a59('0x22')]){if(_0x2383a1[_0x1a59('0x22')]['code']===0x1f4){logger[_0x1a59('0x22')]('DeskAccount,\x20%s,\x20%s',_0x42d727,_0x2383a1[_0x1a59('0x22')][_0x1a59('0x23')]);return _0x477d8b(_0x2383a1[_0x1a59('0x22')][_0x1a59('0x23')]);}logger[_0x1a59('0x22')](_0x1a59('0x1f'),_0x42d727,_0x2383a1[_0x1a59('0x22')][_0x1a59('0x23')]);return _0x280912(_0x2383a1[_0x1a59('0x22')]['message']);}else{logger['info'](_0x1a59('0x1f'),_0x42d727,_0x1a59('0x20'));_0x280912(_0x2383a1[_0x1a59('0x24')][_0x1a59('0x23')]);}})[_0x1a59('0x25')](function(_0x4970bf){logger[_0x1a59('0x22')](_0x1a59('0x1f'),_0x42d727,_0x4970bf);_0x477d8b(_0x4970bf);});});}function respondWithStatusCode(_0x50fbc3,_0x5255bc){_0x5255bc=_0x5255bc||0xcc;return function(_0x5d6652){if(_0x5d6652){return _0x50fbc3[_0x1a59('0x26')](_0x5255bc);}return _0x50fbc3[_0x1a59('0x27')](_0x5255bc)['end']();};}function respondWithResult(_0x15c1eb,_0x393493){_0x393493=_0x393493||0xc8;return function(_0x447b21){if(_0x447b21){return _0x15c1eb[_0x1a59('0x27')](_0x393493)[_0x1a59('0x28')](_0x447b21);}};}function respondWithFilteredResult(_0x267b5b,_0x4f34ad){return function(_0x33cd2d){if(_0x33cd2d){var _0x143113=_0x33cd2d[_0x1a59('0x29')],_0x4ac0b5=_0x4f34ad['offset'],_0x1abcbe=_0x4f34ad[_0x1a59('0x2a')]+_0x4f34ad['limit'],_0x22e375;if(_0x1abcbe>=_0x143113){_0x1abcbe=_0x143113;_0x22e375=0xc8;}else{_0x22e375=0xce;}_0x267b5b[_0x1a59('0x27')](_0x22e375);return _0x267b5b[_0x1a59('0x2b')](_0x1a59('0x2c'),_0x4ac0b5+'-'+_0x1abcbe+'/'+_0x143113)[_0x1a59('0x28')](_0x33cd2d);}return null;};}function patchUpdates(_0x149132){return function(_0xc6af59){try{jsonpatch[_0x1a59('0x2d')](_0xc6af59,_0x149132,!![]);}catch(_0x33b61b){return BPromise[_0x1a59('0x2e')](_0x33b61b);}return _0xc6af59[_0x1a59('0x2f')]();};}function saveUpdates(_0x2ec0c1,_0x4699b0){return function(_0x2941b2){if(_0x2941b2){return _0x2941b2[_0x1a59('0x30')](_0x2ec0c1)['then'](function(_0x48f5c3){return _0x48f5c3;});}return null;};}function removeEntity(_0x1cba68,_0x19768f){return function(_0x30a469){if(_0x30a469){return _0x30a469[_0x1a59('0x31')]()[_0x1a59('0x1d')](function(){_0x1cba68[_0x1a59('0x27')](0xcc)[_0x1a59('0x32')]();});}};}function handleEntityNotFound(_0x35c926,_0x272100){return function(_0x8d2472){if(!_0x8d2472){_0x35c926[_0x1a59('0x26')](0x194);}return _0x8d2472;};}function handleError(_0x41bc35,_0x2d8de5){_0x2d8de5=_0x2d8de5||0x1f4;return function(_0xb03b34){logger['error'](_0xb03b34[_0x1a59('0x33')]);if(_0xb03b34[_0x1a59('0x34')]){delete _0xb03b34[_0x1a59('0x34')];}_0x41bc35[_0x1a59('0x27')](_0x2d8de5)[_0x1a59('0x35')](_0xb03b34);};}exports[_0x1a59('0x36')]=function(_0x4275af,_0x3b1293){var _0x486d2c={},_0x1d9e94={},_0x2ec435={'count':0x0,'rows':[]};var _0x363f18=_[_0x1a59('0x37')](db[_0x1a59('0x38')][_0x1a59('0x39')],function(_0x1cccae){return{'name':_0x1cccae[_0x1a59('0x3a')],'type':_0x1cccae[_0x1a59('0x3b')][_0x1a59('0x3c')]};});_0x1d9e94[_0x1a59('0x3d')]=_['map'](_0x363f18,_0x1a59('0x34'));_0x1d9e94['query']=_[_0x1a59('0x3e')](_0x4275af[_0x1a59('0x3f')]);_0x1d9e94[_0x1a59('0x40')]=_[_0x1a59('0x41')](_0x1d9e94['model'],_0x1d9e94[_0x1a59('0x3f')]);_0x486d2c[_0x1a59('0x42')]=_[_0x1a59('0x41')](_0x1d9e94[_0x1a59('0x3d')],qs['fields'](_0x4275af[_0x1a59('0x3f')]['fields']));_0x486d2c['attributes']=_0x486d2c['attributes']['length']?_0x486d2c[_0x1a59('0x42')]:_0x1d9e94['model'];if(!_0x4275af['query'][_0x1a59('0x43')](_0x1a59('0x44'))){_0x486d2c[_0x1a59('0x45')]=qs['limit'](_0x4275af[_0x1a59('0x3f')]['limit']);_0x486d2c[_0x1a59('0x2a')]=qs['offset'](_0x4275af['query'][_0x1a59('0x2a')]);}_0x486d2c['order']=qs[_0x1a59('0x46')](_0x4275af['query'][_0x1a59('0x46')]);_0x486d2c[_0x1a59('0x47')]=qs['filters'](_['pick'](_0x4275af[_0x1a59('0x3f')],_0x1d9e94[_0x1a59('0x40')]),_0x363f18);if(_0x4275af[_0x1a59('0x3f')]['filter']){_0x486d2c[_0x1a59('0x47')]=_[_0x1a59('0x48')](_0x486d2c[_0x1a59('0x47')],{'$or':_[_0x1a59('0x37')](_0x363f18,function(_0x725732){if(_0x725732[_0x1a59('0x3b')]!==_0x1a59('0x49')){var _0x2aa6b0={};_0x2aa6b0[_0x725732['name']]={'$like':'%'+_0x4275af[_0x1a59('0x3f')][_0x1a59('0x4a')]+'%'};return _0x2aa6b0;}})});}_0x486d2c=_[_0x1a59('0x48')]({},_0x486d2c,_0x4275af[_0x1a59('0x4b')]);var _0x2624b6={'where':_0x486d2c[_0x1a59('0x47')]};return db[_0x1a59('0x38')][_0x1a59('0x29')](_0x2624b6)[_0x1a59('0x1d')](function(_0x8cf2e){_0x2ec435['count']=_0x8cf2e;if(_0x4275af[_0x1a59('0x3f')][_0x1a59('0x4c')]){_0x486d2c[_0x1a59('0x4d')]=[{'all':!![]}];}return db[_0x1a59('0x38')][_0x1a59('0x4e')](_0x486d2c);})[_0x1a59('0x1d')](function(_0x1536eb){_0x2ec435[_0x1a59('0x4f')]=_0x1536eb;return _0x2ec435;})[_0x1a59('0x1d')](respondWithFilteredResult(_0x3b1293,_0x486d2c))[_0x1a59('0x25')](handleError(_0x3b1293,null));};exports[_0x1a59('0x50')]=function(_0x2e15fd,_0x519132){var _0x157cf7={'raw':![],'where':{'id':_0x2e15fd['params']['id']}},_0x2b1961={};_0x2b1961[_0x1a59('0x3d')]=_[_0x1a59('0x3e')](db[_0x1a59('0x38')][_0x1a59('0x39')]);_0x2b1961[_0x1a59('0x3f')]=_[_0x1a59('0x3e')](_0x2e15fd[_0x1a59('0x3f')]);_0x2b1961[_0x1a59('0x40')]=_['intersection'](_0x2b1961[_0x1a59('0x3d')],_0x2b1961[_0x1a59('0x3f')]);_0x157cf7[_0x1a59('0x42')]=_['intersection'](_0x2b1961['model'],qs[_0x1a59('0x51')](_0x2e15fd[_0x1a59('0x3f')][_0x1a59('0x51')]));_0x157cf7[_0x1a59('0x42')]=_0x157cf7[_0x1a59('0x42')][_0x1a59('0x52')]?_0x157cf7[_0x1a59('0x42')]:_0x2b1961[_0x1a59('0x3d')];if(_0x2e15fd[_0x1a59('0x3f')][_0x1a59('0x4c')]){_0x157cf7[_0x1a59('0x4d')]=[{'all':!![]}];}_0x157cf7=_[_0x1a59('0x48')]({},_0x157cf7,_0x2e15fd[_0x1a59('0x4b')]);return db['DeskAccount'][_0x1a59('0x53')](_0x157cf7)[_0x1a59('0x1d')](handleEntityNotFound(_0x519132,null))['then'](respondWithResult(_0x519132,null))[_0x1a59('0x25')](handleError(_0x519132,null));};exports['create']=function(_0x3b79b4,_0x1cf969){return db[_0x1a59('0x38')][_0x1a59('0x54')](_0x3b79b4['body'],{})[_0x1a59('0x1d')](respondWithResult(_0x1cf969,0xc9))['catch'](handleError(_0x1cf969,null));};exports[_0x1a59('0x30')]=function(_0x1fe6b6,_0x5e775d){if(_0x1fe6b6['body']['id']){delete _0x1fe6b6[_0x1a59('0x55')]['id'];}return db[_0x1a59('0x38')]['find']({'where':{'id':_0x1fe6b6['params']['id']}})[_0x1a59('0x1d')](handleEntityNotFound(_0x5e775d,null))['then'](saveUpdates(_0x1fe6b6[_0x1a59('0x55')],null))[_0x1a59('0x1d')](respondWithResult(_0x5e775d,null))['catch'](handleError(_0x5e775d,null));};exports[_0x1a59('0x31')]=function(_0x64787c,_0x7f45c1){return db[_0x1a59('0x38')][_0x1a59('0x53')]({'where':{'id':_0x64787c['params']['id']}})['then'](handleEntityNotFound(_0x7f45c1,null))['then'](removeEntity(_0x7f45c1,null))[_0x1a59('0x25')](handleError(_0x7f45c1,null));};exports[_0x1a59('0x56')]=function(_0x18bccb,_0x4aeeb5,_0x231c61){var _0x369b76={};var _0x5001c0={};var _0x976901;var _0x2d917f;return db[_0x1a59('0x38')][_0x1a59('0x57')]({'where':{'id':_0x18bccb[_0x1a59('0x58')]['id']}})['then'](handleEntityNotFound(_0x4aeeb5,null))[_0x1a59('0x1d')](function(_0x5ed719){if(_0x5ed719){_0x976901=_0x5ed719;_0x5001c0[_0x1a59('0x3d')]=_['keys'](db['DeskConfiguration'][_0x1a59('0x39')]);_0x5001c0[_0x1a59('0x3f')]=_['keys'](_0x18bccb[_0x1a59('0x3f')]);_0x5001c0[_0x1a59('0x40')]=_[_0x1a59('0x41')](_0x5001c0['model'],_0x5001c0[_0x1a59('0x3f')]);_0x369b76[_0x1a59('0x42')]=_[_0x1a59('0x41')](_0x5001c0[_0x1a59('0x3d')],qs['fields'](_0x18bccb[_0x1a59('0x3f')]['fields']));_0x369b76['attributes']=_0x369b76[_0x1a59('0x42')][_0x1a59('0x52')]?_0x369b76[_0x1a59('0x42')]:_0x5001c0[_0x1a59('0x3d')];_0x369b76[_0x1a59('0x59')]=qs[_0x1a59('0x46')](_0x18bccb[_0x1a59('0x3f')][_0x1a59('0x46')]);_0x369b76[_0x1a59('0x47')]=qs[_0x1a59('0x40')](_[_0x1a59('0x5a')](_0x18bccb[_0x1a59('0x3f')],_0x5001c0[_0x1a59('0x40')]));if(_0x18bccb[_0x1a59('0x3f')][_0x1a59('0x4a')]){_0x369b76['where']=_[_0x1a59('0x48')](_0x369b76['where'],{'$or':_[_0x1a59('0x37')](_0x369b76['attributes'],function(_0xf5c3f){var _0x3681ef={};_0x3681ef[_0xf5c3f]={'$like':'%'+_0x18bccb['query']['filter']+'%'};return _0x3681ef;})});}_0x369b76=_[_0x1a59('0x48')]({},_0x369b76,_0x18bccb['options']);return _0x976901[_0x1a59('0x56')](_0x369b76);}})[_0x1a59('0x1d')](function(_0x5253dc){if(_0x5253dc){_0x2d917f=_0x5253dc['length'];if(!_0x18bccb['query'][_0x1a59('0x43')](_0x1a59('0x44'))){_0x369b76['limit']=qs[_0x1a59('0x45')](_0x18bccb['query'][_0x1a59('0x45')]);_0x369b76[_0x1a59('0x2a')]=qs['offset'](_0x18bccb[_0x1a59('0x3f')]['offset']);}return _0x976901['getConfigurations'](_0x369b76);}})['then'](function(_0xcdc26c){if(_0xcdc26c){return _0xcdc26c?{'count':_0x2d917f,'rows':_0xcdc26c}:null;}})['then'](respondWithResult(_0x4aeeb5,null))[_0x1a59('0x25')](handleError(_0x4aeeb5,null));};exports['addConfiguration']=function(_0x509c50,_0x5c2a06,_0x29b401){if(_0x509c50[_0x1a59('0x55')]['id']){delete _0x509c50[_0x1a59('0x55')]['id'];}return db[_0x1a59('0x38')][_0x1a59('0x57')]({'where':{'id':_0x509c50['params']['id']}})[_0x1a59('0x1d')](handleEntityNotFound(_0x5c2a06,null))['then'](function(_0x443eaa){if(_0x443eaa){_0x509c50[_0x1a59('0x55')][_0x1a59('0x5b')]=_0x443eaa['id'];_0x509c50[_0x1a59('0x55')][_0x1a59('0x5c')]=integrations[_0x1a59('0x5d')](_0x509c50[_0x1a59('0x55')][_0x1a59('0x5e')],_0x509c50[_0x1a59('0x55')]['type']);_0x509c50[_0x1a59('0x55')][_0x1a59('0x5f')]=integrations[_0x1a59('0x60')](_0x509c50[_0x1a59('0x55')][_0x1a59('0x5e')],_0x509c50[_0x1a59('0x55')][_0x1a59('0x3b')]);return db['DeskConfiguration'][_0x1a59('0x54')](_0x509c50[_0x1a59('0x55')],{'include':[{'model':db[_0x1a59('0x61')],'as':_0x1a59('0x5c')},{'model':db['DeskField'],'as':_0x1a59('0x5f')}]});}return null;})[_0x1a59('0x1d')](respondWithResult(_0x5c2a06,null))['catch'](handleError(_0x5c2a06,null));};exports['getFields']=function(_0x486884,_0xef81ae,_0x516026){var _0x1a678b=[{'name':_0x1a59('0x62'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x112d9e='';return db[_0x1a59('0x38')]['findOne']({'where':{'id':_0x486884[_0x1a59('0x58')]['id']},'attributes':['id',_0x1a59('0x63'),_0x1a59('0x64'),_0x1a59('0x65'),_0x1a59('0x66'),_0x1a59('0x67'),_0x1a59('0x68'),'token','tokenSecret']})['then'](handleEntityNotFound(_0xef81ae,null))[_0x1a59('0x1d')](function(_0x518ad2){if(_0x518ad2){_0x112d9e=_0x518ad2[_0x1a59('0x63')];var _0x14101b=_0x112d9e['slice'](-0x1);if(_0x14101b==='/'){_0x112d9e=_0x112d9e[_0x1a59('0x69')](0x0,_0x112d9e[_0x1a59('0x6a')](_0x14101b));}var _0x56e528={'method':'GET','uri':util[_0x1a59('0x6b')](_0x1a59('0x6c'),_0x112d9e),'headers':{'Content-Type':_0x1a59('0x6d'),'Accept':_0x1a59('0x6d')},'json':!![]};if(_0x518ad2['authType']===_0x1a59('0x6e')){_0x56e528[_0x1a59('0x6f')][_0x1a59('0x70')]=util[_0x1a59('0x6b')]('Basic\x20%s',new Buffer(util['format'](_0x1a59('0x71'),_0x518ad2['username'],_0x518ad2[_0x1a59('0x66')]))[_0x1a59('0x72')](_0x1a59('0x73')));}return rp(_0x56e528)[_0x1a59('0x1d')](function(_0x59820b){return _0x1a678b['concat'](_[_0x1a59('0x37')](_0x59820b[_0x1a59('0x74')][_0x1a59('0x75')],function(_0x5cdf8c){return{'id':_0x5cdf8c[_0x1a59('0x34')],'name':_0x5cdf8c[_0x1a59('0x34')],'type':_0x5cdf8c['type'],'active':_0x5cdf8c[_0x1a59('0x76')],'label':_0x5cdf8c[_0x1a59('0x77')],'custom':!![]};}));});}})[_0x1a59('0x1d')](function(_0x17b975){return{'count':_0x17b975[_0x1a59('0x52')],'rows':_0x17b975};})[_0x1a59('0x1d')](respondWithResult(_0xef81ae,null))[_0x1a59('0x25')](function(_0xadea7d){var _0x32ffdb=_0x486884[_0x1a59('0x3f')][_0x1a59('0x78')]?0x1f4:_0xadea7d[_0x1a59('0x79')]||0x1f4;logger[_0x1a59('0x22')](_0x1a59('0x7a'),_0x1a59('0x7b'),_0x32ffdb,JSON[_0x1a59('0x7c')](_0xadea7d));delete _0xadea7d[_0x1a59('0x34')];if(_0x32ffdb===0x191){_0x32ffdb=0x190;}_0xef81ae[_0x1a59('0x27')](_0x32ffdb)['send'](_0x486884[_0x1a59('0x3f')]['test']?{'message':_0x1a59('0x7d'),'statusCode':_0xadea7d[_0x1a59('0x79')]}:_0xadea7d);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5e4bc9a..5834ebc 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 _0x1d29=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4ae504,_0x2af662){var _0x3bf531=function(_0x137403){while(--_0x137403){_0x4ae504['push'](_0x4ae504['shift']());}};_0x3bf531(++_0x2af662);}(_0x1d29,0x131));var _0x91d2=function(_0x8c7ccf,_0xe3f870){_0x8c7ccf=_0x8c7ccf-0x0;var _0x54f922=_0x1d29[_0x8c7ccf];return _0x54f922;};'use strict';var _=require(_0x91d2('0x0'));var util=require(_0x91d2('0x1'));var logger=require('../../config/logger')(_0x91d2('0x2'));var moment=require(_0x91d2('0x3'));var BPromise=require(_0x91d2('0x4'));var rp=require(_0x91d2('0x5'));var fs=require('fs');var path=require(_0x91d2('0x6'));var rimraf=require('rimraf');var config=require(_0x91d2('0x7'));var attributes=require(_0x91d2('0x8'));var integrations=require(_0x91d2('0x9'));module['exports']=function(_0x5bfa92,_0x1aeffe){return _0x5bfa92[_0x91d2('0xa')](_0x91d2('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc097=['int_desk_accounts','util','../../config/logger','moment','request-promise','path','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc097,0x166));var _0x7c09=function(_0x3f8179,_0x26a221){_0x3f8179=_0x3f8179-0x0;var _0x2023b4=_0xc097[_0x3f8179];return _0x2023b4;};'use strict';var _=require('lodash');var util=require(_0x7c09('0x0'));var logger=require(_0x7c09('0x1'))('api');var moment=require(_0x7c09('0x2'));var BPromise=require('bluebird');var rp=require(_0x7c09('0x3'));var fs=require('fs');var path=require(_0x7c09('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x59bf17,_0x1066e2){return _0x59bf17[_0x7c09('0x5')]('DeskAccount',attributes,{'tableName':_0x7c09('0x6'),'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 4f42e0c..8e68fe8 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 _0x9ad2=['message','catch','GetDeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','DeskAccount','find','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','DeskAccount,\x20%s,\x20%s','result'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9ad2,0xa7));var _0x29ad=function(_0x45fd01,_0x4f6038){_0x45fd01=_0x45fd01-0x0;var _0x1ef044=_0x9ad2[_0x45fd01];return _0x1ef044;};'use strict';var _=require(_0x29ad('0x0'));var util=require(_0x29ad('0x1'));var moment=require(_0x29ad('0x2'));var BPromise=require(_0x29ad('0x3'));var rs=require(_0x29ad('0x4'));var fs=require('fs');var Redis=require(_0x29ad('0x5'));var db=require(_0x29ad('0x6'))['db'];var utils=require(_0x29ad('0x7'));var logger=require(_0x29ad('0x8'))(_0x29ad('0x9'));var config=require(_0x29ad('0xa'));var jayson=require(_0x29ad('0xb'));var client=jayson['client'][_0x29ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x568570,_0x2e39a3,_0x11831a){return new BPromise(function(_0x52e072,_0x286369){return client[_0x29ad('0xd')](_0x568570,_0x11831a)[_0x29ad('0xe')](function(_0x16db1a){logger[_0x29ad('0xf')]('DeskAccount,\x20%s,\x20%s',_0x2e39a3,_0x29ad('0x10'));logger[_0x29ad('0x11')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2e39a3,'request\x20sent',JSON[_0x29ad('0x12')](_0x16db1a));if(_0x16db1a['error']){if(_0x16db1a[_0x29ad('0x13')][_0x29ad('0x14')]===0x1f4){logger['error'](_0x29ad('0x15'),_0x2e39a3,_0x16db1a['error']['message']);return _0x286369(_0x16db1a[_0x29ad('0x13')]['message']);}logger['error'](_0x29ad('0x15'),_0x2e39a3,_0x16db1a[_0x29ad('0x13')]['message']);return _0x52e072(_0x16db1a[_0x29ad('0x13')]['message']);}else{logger[_0x29ad('0xf')](_0x29ad('0x15'),_0x2e39a3,_0x29ad('0x10'));_0x52e072(_0x16db1a[_0x29ad('0x16')][_0x29ad('0x17')]);}})[_0x29ad('0x18')](function(_0x42eed1){logger[_0x29ad('0x13')](_0x29ad('0x15'),_0x2e39a3,_0x42eed1);_0x286369(_0x42eed1);});});}exports[_0x29ad('0x19')]=function(_0x26b39a){var _0x405a05=this;return new Promise(function(_0x5308d1,_0x404769){return db['DeskAccount'][_0x29ad('0x1a')]({'raw':_0x26b39a[_0x29ad('0x1b')]?_0x26b39a['options'][_0x29ad('0x1c')]===undefined?!![]:![]:!![],'where':_0x26b39a[_0x29ad('0x1b')]?_0x26b39a[_0x29ad('0x1b')][_0x29ad('0x1d')]||null:null,'attributes':_0x26b39a[_0x29ad('0x1b')]?_0x26b39a[_0x29ad('0x1b')][_0x29ad('0x1e')]||null:null,'limit':_0x26b39a['options']?_0x26b39a[_0x29ad('0x1b')][_0x29ad('0x1f')]||null:null,'include':_0x26b39a['options']?_0x26b39a[_0x29ad('0x1b')]['include']?_[_0x29ad('0x20')](_0x26b39a[_0x29ad('0x1b')][_0x29ad('0x21')],function(_0x753f6f){return{'model':db[_0x753f6f['model']],'as':_0x753f6f['as'],'attributes':_0x753f6f['attributes'],'include':_0x753f6f[_0x29ad('0x21')]?_[_0x29ad('0x20')](_0x753f6f['include'],function(_0x11c207){return{'model':db[_0x11c207[_0x29ad('0x22')]],'as':_0x11c207['as'],'attributes':_0x11c207['attributes'],'include':_0x11c207[_0x29ad('0x21')]?_[_0x29ad('0x20')](_0x11c207[_0x29ad('0x21')],function(_0x10d6ef){return{'model':db[_0x10d6ef['model']],'as':_0x10d6ef['as'],'attributes':_0x10d6ef[_0x29ad('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x29ad('0xe')](function(_0x5942f1){logger[_0x29ad('0xf')](_0x29ad('0x19'),_0x26b39a);logger[_0x29ad('0x11')](_0x29ad('0x19'),_0x26b39a,JSON['stringify'](_0x5942f1));_0x5308d1(_0x5942f1);})[_0x29ad('0x18')](function(_0x1e7a7b){logger[_0x29ad('0x13')](_0x29ad('0x19'),_0x1e7a7b[_0x29ad('0x17')],_0x26b39a);_0x404769(_0x405a05['error'](0x1f4,_0x1e7a7b['message']));});});};exports['ShowDeskAccount']=function(_0x17d5e9){var _0x10658b=this;return new Promise(function(_0x4d612e,_0x31fbed){return db[_0x29ad('0x23')][_0x29ad('0x24')]({'raw':_0x17d5e9[_0x29ad('0x1b')]?_0x17d5e9[_0x29ad('0x1b')][_0x29ad('0x1c')]===undefined?!![]:![]:!![],'where':_0x17d5e9[_0x29ad('0x1b')]?_0x17d5e9['options'][_0x29ad('0x1d')]||null:null,'attributes':_0x17d5e9[_0x29ad('0x1b')]?_0x17d5e9[_0x29ad('0x1b')][_0x29ad('0x1e')]||null:null,'include':_0x17d5e9[_0x29ad('0x1b')]?_0x17d5e9[_0x29ad('0x1b')]['include']?_[_0x29ad('0x20')](_0x17d5e9[_0x29ad('0x1b')][_0x29ad('0x21')],function(_0x33746e){return{'model':db[_0x33746e[_0x29ad('0x22')]],'as':_0x33746e['as'],'attributes':_0x33746e['attributes'],'include':_0x33746e[_0x29ad('0x21')]?_[_0x29ad('0x20')](_0x33746e[_0x29ad('0x21')],function(_0x1e0f85){return{'model':db[_0x1e0f85[_0x29ad('0x22')]],'as':_0x1e0f85['as'],'attributes':_0x1e0f85[_0x29ad('0x1e')],'include':_0x1e0f85[_0x29ad('0x21')]?_[_0x29ad('0x20')](_0x1e0f85[_0x29ad('0x21')],function(_0x1d4422){return{'model':db[_0x1d4422[_0x29ad('0x22')]],'as':_0x1d4422['as'],'attributes':_0x1d4422['attributes']};}):[]};}):[]};}):[]:[]})[_0x29ad('0xe')](function(_0x4a2743){logger[_0x29ad('0xf')]('ShowDeskAccount',_0x17d5e9);logger[_0x29ad('0x11')]('ShowDeskAccount',_0x17d5e9,JSON[_0x29ad('0x12')](_0x4a2743));_0x4d612e(_0x4a2743);})[_0x29ad('0x18')](function(_0x4fb65c){logger[_0x29ad('0x13')](_0x29ad('0x25'),_0x4fb65c[_0x29ad('0x17')],_0x17d5e9);_0x31fbed(_0x10658b[_0x29ad('0x13')](0x1f4,_0x4fb65c[_0x29ad('0x17')]));});});}; \ No newline at end of file +var _0xf4b3=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','options','where','attributes','limit','include','map','model','debug','ShowDeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x201526,_0x4bcf5c){var _0x3dcb9f=function(_0x5a793f){while(--_0x5a793f){_0x201526['push'](_0x201526['shift']());}};_0x3dcb9f(++_0x4bcf5c);}(_0xf4b3,0x1b6));var _0x3f4b=function(_0x1301e8,_0x146769){_0x1301e8=_0x1301e8-0x0;var _0x17a97e=_0xf4b3[_0x1301e8];return _0x17a97e;};'use strict';var _=require(_0x3f4b('0x0'));var util=require(_0x3f4b('0x1'));var moment=require(_0x3f4b('0x2'));var BPromise=require(_0x3f4b('0x3'));var rs=require(_0x3f4b('0x4'));var fs=require('fs');var Redis=require(_0x3f4b('0x5'));var db=require(_0x3f4b('0x6'))['db'];var utils=require(_0x3f4b('0x7'));var logger=require(_0x3f4b('0x8'))('rpc');var config=require(_0x3f4b('0x9'));var jayson=require(_0x3f4b('0xa'));var client=jayson[_0x3f4b('0xb')][_0x3f4b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x369658,_0x16eac5,_0x520dd4){return new BPromise(function(_0x367379,_0x1bffed){return client['request'](_0x369658,_0x520dd4)[_0x3f4b('0xd')](function(_0x57e9fa){logger[_0x3f4b('0xe')](_0x3f4b('0xf'),_0x16eac5,_0x3f4b('0x10'));logger['debug'](_0x3f4b('0x11'),_0x16eac5,_0x3f4b('0x10'),JSON[_0x3f4b('0x12')](_0x57e9fa));if(_0x57e9fa[_0x3f4b('0x13')]){if(_0x57e9fa[_0x3f4b('0x13')][_0x3f4b('0x14')]===0x1f4){logger['error'](_0x3f4b('0xf'),_0x16eac5,_0x57e9fa[_0x3f4b('0x13')]['message']);return _0x1bffed(_0x57e9fa[_0x3f4b('0x13')][_0x3f4b('0x15')]);}logger[_0x3f4b('0x13')](_0x3f4b('0xf'),_0x16eac5,_0x57e9fa[_0x3f4b('0x13')]['message']);return _0x367379(_0x57e9fa[_0x3f4b('0x13')][_0x3f4b('0x15')]);}else{logger[_0x3f4b('0xe')](_0x3f4b('0xf'),_0x16eac5,_0x3f4b('0x10'));_0x367379(_0x57e9fa['result'][_0x3f4b('0x15')]);}})[_0x3f4b('0x16')](function(_0x55d288){logger[_0x3f4b('0x13')](_0x3f4b('0xf'),_0x16eac5,_0x55d288);_0x1bffed(_0x55d288);});});}exports[_0x3f4b('0x17')]=function(_0x5b62d7){var _0x36bc42=this;return new Promise(function(_0x5b7f1f,_0x1a19e3){return db['DeskAccount']['findAll']({'raw':_0x5b62d7[_0x3f4b('0x18')]?_0x5b62d7[_0x3f4b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5b62d7[_0x3f4b('0x18')]?_0x5b62d7[_0x3f4b('0x18')][_0x3f4b('0x19')]||null:null,'attributes':_0x5b62d7['options']?_0x5b62d7[_0x3f4b('0x18')][_0x3f4b('0x1a')]||null:null,'limit':_0x5b62d7[_0x3f4b('0x18')]?_0x5b62d7['options'][_0x3f4b('0x1b')]||null:null,'include':_0x5b62d7[_0x3f4b('0x18')]?_0x5b62d7[_0x3f4b('0x18')][_0x3f4b('0x1c')]?_[_0x3f4b('0x1d')](_0x5b62d7[_0x3f4b('0x18')][_0x3f4b('0x1c')],function(_0x15e6af){return{'model':db[_0x15e6af[_0x3f4b('0x1e')]],'as':_0x15e6af['as'],'attributes':_0x15e6af[_0x3f4b('0x1a')],'include':_0x15e6af[_0x3f4b('0x1c')]?_['map'](_0x15e6af[_0x3f4b('0x1c')],function(_0xba99b6){return{'model':db[_0xba99b6['model']],'as':_0xba99b6['as'],'attributes':_0xba99b6[_0x3f4b('0x1a')],'include':_0xba99b6[_0x3f4b('0x1c')]?_['map'](_0xba99b6[_0x3f4b('0x1c')],function(_0x2ceb55){return{'model':db[_0x2ceb55[_0x3f4b('0x1e')]],'as':_0x2ceb55['as'],'attributes':_0x2ceb55[_0x3f4b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5592ed){logger[_0x3f4b('0xe')]('GetDeskAccount',_0x5b62d7);logger[_0x3f4b('0x1f')](_0x3f4b('0x17'),_0x5b62d7,JSON['stringify'](_0x5592ed));_0x5b7f1f(_0x5592ed);})[_0x3f4b('0x16')](function(_0x4ae526){logger['error'](_0x3f4b('0x17'),_0x4ae526['message'],_0x5b62d7);_0x1a19e3(_0x36bc42[_0x3f4b('0x13')](0x1f4,_0x4ae526[_0x3f4b('0x15')]));});});};exports[_0x3f4b('0x20')]=function(_0x2c794d){var _0x209b70=this;return new Promise(function(_0x10b654,_0x355f7e){return db['DeskAccount'][_0x3f4b('0x21')]({'raw':_0x2c794d['options']?_0x2c794d[_0x3f4b('0x18')][_0x3f4b('0x22')]===undefined?!![]:![]:!![],'where':_0x2c794d['options']?_0x2c794d[_0x3f4b('0x18')][_0x3f4b('0x19')]||null:null,'attributes':_0x2c794d['options']?_0x2c794d['options']['attributes']||null:null,'include':_0x2c794d[_0x3f4b('0x18')]?_0x2c794d[_0x3f4b('0x18')][_0x3f4b('0x1c')]?_[_0x3f4b('0x1d')](_0x2c794d[_0x3f4b('0x18')][_0x3f4b('0x1c')],function(_0x129133){return{'model':db[_0x129133[_0x3f4b('0x1e')]],'as':_0x129133['as'],'attributes':_0x129133[_0x3f4b('0x1a')],'include':_0x129133[_0x3f4b('0x1c')]?_[_0x3f4b('0x1d')](_0x129133['include'],function(_0x32f66d){return{'model':db[_0x32f66d['model']],'as':_0x32f66d['as'],'attributes':_0x32f66d[_0x3f4b('0x1a')],'include':_0x32f66d[_0x3f4b('0x1c')]?_[_0x3f4b('0x1d')](_0x32f66d['include'],function(_0x462490){return{'model':db[_0x462490[_0x3f4b('0x1e')]],'as':_0x462490['as'],'attributes':_0x462490[_0x3f4b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3f4b('0xd')](function(_0x28323a){logger[_0x3f4b('0xe')]('ShowDeskAccount',_0x2c794d);logger[_0x3f4b('0x1f')]('ShowDeskAccount',_0x2c794d,JSON[_0x3f4b('0x12')](_0x28323a));_0x10b654(_0x28323a);})['catch'](function(_0x4d01df){logger['error'](_0x3f4b('0x20'),_0x4d01df[_0x3f4b('0x15')],_0x2c794d);_0x355f7e(_0x209b70[_0x3f4b('0x13')](0x1f4,_0x4d01df[_0x3f4b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5e7156d..9bd7bbf 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 _0xc7bd=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','util','path','express','../../components/auth/service'];(function(_0x61d51f,_0x238460){var _0x113af4=function(_0x457cfe){while(--_0x457cfe){_0x61d51f['push'](_0x61d51f['shift']());}};_0x113af4(++_0x238460);}(_0xc7bd,0x86));var _0xdc7b=function(_0x5c2cc3,_0xe8d28c){_0x5c2cc3=_0x5c2cc3-0x0;var _0x205d13=_0xc7bd[_0x5c2cc3];return _0x205d13;};'use strict';var multer=require('multer');var util=require(_0xdc7b('0x0'));var path=require(_0xdc7b('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc7b('0x2'));var router=express['Router']();var auth=require(_0xdc7b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdc7b('0x4'));var controller=require(_0xdc7b('0x5'));router[_0xdc7b('0x6')]('/',auth[_0xdc7b('0x7')](),controller[_0xdc7b('0x8')]);router[_0xdc7b('0x6')](_0xdc7b('0x9'),auth['isAuthenticated'](),controller[_0xdc7b('0xa')]);router[_0xdc7b('0x6')](_0xdc7b('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0xdc7b('0x6')](_0xdc7b('0xc'),auth[_0xdc7b('0x7')](),controller[_0xdc7b('0xd')]);router[_0xdc7b('0x6')](_0xdc7b('0xe'),auth['isAuthenticated'](),controller[_0xdc7b('0xf')]);router[_0xdc7b('0x6')](_0xdc7b('0x10'),auth[_0xdc7b('0x7')](),controller[_0xdc7b('0x11')]);router[_0xdc7b('0x12')]('/',auth['isAuthenticated'](),controller[_0xdc7b('0x13')]);router[_0xdc7b('0x12')]('/:id/tags',auth[_0xdc7b('0x7')](),controller['setTags']);router[_0xdc7b('0x14')](_0xdc7b('0x9'),auth[_0xdc7b('0x7')](),controller[_0xdc7b('0x15')]);router['delete'](_0xdc7b('0x9'),auth[_0xdc7b('0x7')](),controller['destroy']);module[_0xdc7b('0x16')]=router; \ No newline at end of file +var _0x90b1=['get','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x90b1,0x1bb));var _0x190b=function(_0x3b37d0,_0x5e3d41){_0x3b37d0=_0x3b37d0-0x0;var _0x4987b6=_0x90b1[_0x3b37d0];return _0x4987b6;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var auth=require(_0x190b('0x4'));var interaction=require(_0x190b('0x5'));var config=require(_0x190b('0x6'));var controller=require('./intDeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x190b('0x7')](_0x190b('0x8'),auth[_0x190b('0x9')](),controller[_0x190b('0xa')]);router[_0x190b('0x7')](_0x190b('0xb'),auth[_0x190b('0x9')](),controller['getFields']);router[_0x190b('0x7')](_0x190b('0xc'),auth[_0x190b('0x9')](),controller[_0x190b('0xd')]);router[_0x190b('0x7')](_0x190b('0xe'),auth[_0x190b('0x9')](),controller[_0x190b('0xf')]);router['get'](_0x190b('0x10'),auth[_0x190b('0x9')](),controller['getTags']);router[_0x190b('0x11')]('/',auth[_0x190b('0x9')](),controller[_0x190b('0x12')]);router[_0x190b('0x11')](_0x190b('0x10'),auth[_0x190b('0x9')](),controller[_0x190b('0x13')]);router[_0x190b('0x14')](_0x190b('0x8'),auth[_0x190b('0x9')](),controller[_0x190b('0x15')]);router[_0x190b('0x16')](_0x190b('0x8'),auth[_0x190b('0x9')](),controller[_0x190b('0x17')]);module[_0x190b('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 fe0596a..69aa578 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 _0x3ca7=['STRING','sequelize','exports'];(function(_0x1ca931,_0x291699){var _0x177a49=function(_0x34a698){while(--_0x34a698){_0x1ca931['push'](_0x1ca931['shift']());}};_0x177a49(++_0x291699);}(_0x3ca7,0x175));var _0x73ca=function(_0x5d3903,_0x3d6c3e){_0x5d3903=_0x5d3903-0x0;var _0x4b8bc9=_0x3ca7[_0x5d3903];return _0x4b8bc9;};'use strict';var Sequelize=require(_0x73ca('0x0'));module[_0x73ca('0x1')]={'name':{'type':Sequelize[_0x73ca('0x2')]},'description':{'type':Sequelize[_0x73ca('0x2')]}}; \ No newline at end of file +var _0x28c2=['exports','STRING','sequelize'];(function(_0x113982,_0x597be2){var _0x13ff92=function(_0x344be9){while(--_0x344be9){_0x113982['push'](_0x113982['shift']());}};_0x13ff92(++_0x597be2);}(_0x28c2,0x1cd));var _0x228c=function(_0x56dd9e,_0x54d1c5){_0x56dd9e=_0x56dd9e-0x0;var _0x16d79b=_0x28c2[_0x56dd9e];return _0x16d79b;};'use strict';var Sequelize=require(_0x228c('0x0'));module[_0x228c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x228c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index fa0ce8b..2f97a01 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 _0x1295=['rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','params','DeskConfiguration','find','create','body','getFields','DeskField','pick','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','set','apply','reject','update','destroy','stack','name','send','index','map'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1295,0x191));var _0x5129=function(_0x5af240,_0x2462df){_0x5af240=_0x5af240-0x0;var _0x19ceaa=_0x1295[_0x5af240];return _0x19ceaa;};'use strict';var pdf=require(_0x5129('0x0'));var emlformat=require(_0x5129('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5129('0x2'));var jsonpatch=require(_0x5129('0x3'));var rp=require(_0x5129('0x4'));var moment=require(_0x5129('0x5'));var BPromise=require(_0x5129('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5129('0x7'));var sox=require(_0x5129('0x8'));var csv=require(_0x5129('0x9'));var ejs=require(_0x5129('0xa'));var fs=require('fs');var _=require(_0x5129('0xb'));var squel=require(_0x5129('0xc'));var crypto=require(_0x5129('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5129('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5129('0xf'));var Papa=require(_0x5129('0x10'));var Redis=require('ioredis');var authService=require(_0x5129('0x11'));var qs=require(_0x5129('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5129('0x13'));var logger=require(_0x5129('0x14'))('api');var utils=require(_0x5129('0x15'));var config=require(_0x5129('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5129('0x17'))['db'];var jayson=require(_0x5129('0x18'));var client=jayson[_0x5129('0x19')][_0x5129('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x14a408,_0x25f2b6,_0x31f591,_0x4ce24d){return new BPromise(function(_0x5f2327,_0x817274){var _0x30d28f=_0x4ce24d||client;return _0x30d28f[_0x5129('0x1b')](_0x14a408,_0x31f591)[_0x5129('0x1c')](function(_0x2b475e){logger[_0x5129('0x1d')]('DeskConfiguration,\x20%s,\x20%s',_0x25f2b6,_0x5129('0x1e'));logger[_0x5129('0x1f')](_0x5129('0x20'),_0x25f2b6,_0x5129('0x1e'),JSON[_0x5129('0x21')](_0x2b475e));if(_0x2b475e[_0x5129('0x22')]){if(_0x2b475e['error'][_0x5129('0x23')]===0x1f4){logger[_0x5129('0x22')](_0x5129('0x24'),_0x25f2b6,_0x2b475e[_0x5129('0x22')][_0x5129('0x25')]);return _0x817274(_0x2b475e[_0x5129('0x22')][_0x5129('0x25')]);}logger[_0x5129('0x22')](_0x5129('0x24'),_0x25f2b6,_0x2b475e['error'][_0x5129('0x25')]);return _0x5f2327(_0x2b475e[_0x5129('0x22')]['message']);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x25f2b6,_0x5129('0x1e'));_0x5f2327(_0x2b475e['result'][_0x5129('0x25')]);}})[_0x5129('0x26')](function(_0x340690){logger[_0x5129('0x22')](_0x5129('0x24'),_0x25f2b6,_0x340690);_0x817274(_0x340690);});});}function respondWithStatusCode(_0x42ff9f,_0x125d35){_0x125d35=_0x125d35||0xcc;return function(_0x9d0b7){if(_0x9d0b7){return _0x42ff9f[_0x5129('0x27')](_0x125d35);}return _0x42ff9f[_0x5129('0x28')](_0x125d35)[_0x5129('0x29')]();};}function respondWithResult(_0x28770c,_0xab7222){_0xab7222=_0xab7222||0xc8;return function(_0x19d5b0){if(_0x19d5b0){return _0x28770c[_0x5129('0x28')](_0xab7222)[_0x5129('0x2a')](_0x19d5b0);}};}function respondWithFilteredResult(_0x50b9d9,_0x7889c){return function(_0x1f948a){if(_0x1f948a){var _0x187dcd=_0x1f948a['count'],_0x5ecf9b=_0x7889c[_0x5129('0x2b')],_0x2a166d=_0x7889c[_0x5129('0x2b')]+_0x7889c['limit'],_0x2aaa21;if(_0x2a166d>=_0x187dcd){_0x2a166d=_0x187dcd;_0x2aaa21=0xc8;}else{_0x2aaa21=0xce;}_0x50b9d9[_0x5129('0x28')](_0x2aaa21);return _0x50b9d9[_0x5129('0x2c')]('Content-Range',_0x5ecf9b+'-'+_0x2a166d+'/'+_0x187dcd)[_0x5129('0x2a')](_0x1f948a);}return null;};}function patchUpdates(_0x4dcc1d){return function(_0x53ee2d){try{jsonpatch[_0x5129('0x2d')](_0x53ee2d,_0x4dcc1d,!![]);}catch(_0x537bea){return BPromise[_0x5129('0x2e')](_0x537bea);}return _0x53ee2d['save']();};}function saveUpdates(_0x39cf22,_0x327884){return function(_0x4daab2){if(_0x4daab2){return _0x4daab2[_0x5129('0x2f')](_0x39cf22)[_0x5129('0x1c')](function(_0xa6b71e){return _0xa6b71e;});}return null;};}function removeEntity(_0x521736,_0x45c7aa){return function(_0x5363c3){if(_0x5363c3){return _0x5363c3[_0x5129('0x30')]()[_0x5129('0x1c')](function(){_0x521736[_0x5129('0x28')](0xcc)[_0x5129('0x29')]();});}};}function handleEntityNotFound(_0x2645cf,_0xf11daf){return function(_0x44a722){if(!_0x44a722){_0x2645cf['sendStatus'](0x194);}return _0x44a722;};}function handleError(_0x4cb130,_0x2d80e3){_0x2d80e3=_0x2d80e3||0x1f4;return function(_0xe67c31){logger['error'](_0xe67c31[_0x5129('0x31')]);if(_0xe67c31[_0x5129('0x32')]){delete _0xe67c31[_0x5129('0x32')];}_0x4cb130[_0x5129('0x28')](_0x2d80e3)[_0x5129('0x33')](_0xe67c31);};}exports[_0x5129('0x34')]=function(_0x2e158f,_0x38740c){var _0x12f4de={},_0x3dd36b={},_0x42dd16={'count':0x0,'rows':[]};var _0x2de615=_[_0x5129('0x35')](db['DeskConfiguration'][_0x5129('0x36')],function(_0x2f51d1){return{'name':_0x2f51d1['fieldName'],'type':_0x2f51d1['type']['key']};});_0x3dd36b['model']=_[_0x5129('0x35')](_0x2de615,_0x5129('0x32'));_0x3dd36b[_0x5129('0x37')]=_[_0x5129('0x38')](_0x2e158f['query']);_0x3dd36b[_0x5129('0x39')]=_[_0x5129('0x3a')](_0x3dd36b[_0x5129('0x3b')],_0x3dd36b[_0x5129('0x37')]);_0x12f4de[_0x5129('0x3c')]=_[_0x5129('0x3a')](_0x3dd36b[_0x5129('0x3b')],qs[_0x5129('0x3d')](_0x2e158f[_0x5129('0x37')][_0x5129('0x3d')]));_0x12f4de['attributes']=_0x12f4de[_0x5129('0x3c')][_0x5129('0x3e')]?_0x12f4de[_0x5129('0x3c')]:_0x3dd36b[_0x5129('0x3b')];if(!_0x2e158f[_0x5129('0x37')][_0x5129('0x3f')](_0x5129('0x40'))){_0x12f4de[_0x5129('0x41')]=qs[_0x5129('0x41')](_0x2e158f['query']['limit']);_0x12f4de['offset']=qs[_0x5129('0x2b')](_0x2e158f[_0x5129('0x37')]['offset']);}_0x12f4de[_0x5129('0x42')]=qs[_0x5129('0x43')](_0x2e158f[_0x5129('0x37')][_0x5129('0x43')]);_0x12f4de[_0x5129('0x44')]=qs['filters'](_['pick'](_0x2e158f[_0x5129('0x37')],_0x3dd36b[_0x5129('0x39')]),_0x2de615);if(_0x2e158f['query'][_0x5129('0x45')]){_0x12f4de[_0x5129('0x44')]=_[_0x5129('0x46')](_0x12f4de[_0x5129('0x44')],{'$or':_[_0x5129('0x35')](_0x2de615,function(_0x40a403){if(_0x40a403['type']!==_0x5129('0x47')){var _0x196387={};_0x196387[_0x40a403[_0x5129('0x32')]]={'$like':'%'+_0x2e158f[_0x5129('0x37')][_0x5129('0x45')]+'%'};return _0x196387;}})});}_0x12f4de=_[_0x5129('0x46')]({},_0x12f4de,_0x2e158f[_0x5129('0x48')]);var _0x3cb77a={'where':_0x12f4de[_0x5129('0x44')]};return db['DeskConfiguration'][_0x5129('0x49')](_0x3cb77a)['then'](function(_0x42d420){_0x42dd16[_0x5129('0x49')]=_0x42d420;if(_0x2e158f[_0x5129('0x37')][_0x5129('0x4a')]){_0x12f4de[_0x5129('0x4b')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x12f4de);})[_0x5129('0x1c')](function(_0xdc47a2){_0x42dd16['rows']=_0xdc47a2;return _0x42dd16;})[_0x5129('0x1c')](respondWithFilteredResult(_0x38740c,_0x12f4de))[_0x5129('0x26')](handleError(_0x38740c,null));};exports['show']=function(_0xc21403,_0x2e251a){var _0x46db96={'raw':![],'where':{'id':_0xc21403[_0x5129('0x4c')]['id']}},_0x29df4d={};_0x29df4d[_0x5129('0x3b')]=_[_0x5129('0x38')](db[_0x5129('0x4d')][_0x5129('0x36')]);_0x29df4d[_0x5129('0x37')]=_[_0x5129('0x38')](_0xc21403[_0x5129('0x37')]);_0x29df4d[_0x5129('0x39')]=_[_0x5129('0x3a')](_0x29df4d[_0x5129('0x3b')],_0x29df4d['query']);_0x46db96[_0x5129('0x3c')]=_[_0x5129('0x3a')](_0x29df4d['model'],qs[_0x5129('0x3d')](_0xc21403[_0x5129('0x37')][_0x5129('0x3d')]));_0x46db96['attributes']=_0x46db96['attributes'][_0x5129('0x3e')]?_0x46db96[_0x5129('0x3c')]:_0x29df4d[_0x5129('0x3b')];if(_0xc21403[_0x5129('0x37')]['includeAll']){_0x46db96['include']=[{'all':!![]}];}_0x46db96=_[_0x5129('0x46')]({},_0x46db96,_0xc21403['options']);return db[_0x5129('0x4d')][_0x5129('0x4e')](_0x46db96)[_0x5129('0x1c')](handleEntityNotFound(_0x2e251a,null))['then'](respondWithResult(_0x2e251a,null))['catch'](handleError(_0x2e251a,null));};exports[_0x5129('0x4f')]=function(_0x4ff7db,_0x17be7b){return db['DeskConfiguration'][_0x5129('0x4f')](_0x4ff7db[_0x5129('0x50')],{})[_0x5129('0x1c')](respondWithResult(_0x17be7b,0xc9))[_0x5129('0x26')](handleError(_0x17be7b,null));};exports['update']=function(_0x2630b3,_0x375f67){if(_0x2630b3[_0x5129('0x50')]['id']){delete _0x2630b3['body']['id'];}return db[_0x5129('0x4d')]['find']({'where':{'id':_0x2630b3[_0x5129('0x4c')]['id']}})['then'](handleEntityNotFound(_0x375f67,null))['then'](saveUpdates(_0x2630b3[_0x5129('0x50')],null))[_0x5129('0x1c')](respondWithResult(_0x375f67,null))['catch'](handleError(_0x375f67,null));};exports[_0x5129('0x30')]=function(_0x467e0f,_0x2ef663){return db[_0x5129('0x4d')]['find']({'where':{'id':_0x467e0f['params']['id']}})[_0x5129('0x1c')](handleEntityNotFound(_0x2ef663,null))[_0x5129('0x1c')](removeEntity(_0x2ef663,null))[_0x5129('0x26')](handleError(_0x2ef663,null));};exports[_0x5129('0x51')]=function(_0x33071e,_0x4cf88b,_0x19a5d5){var _0x36d206={};var _0x2f74b7={};var _0x2bd21f;var _0x14bbc6;return db[_0x5129('0x4d')]['findOne']({'where':{'id':_0x33071e[_0x5129('0x4c')]['id']}})[_0x5129('0x1c')](handleEntityNotFound(_0x4cf88b,null))[_0x5129('0x1c')](function(_0x2db1d3){if(_0x2db1d3){_0x2bd21f=_0x2db1d3;_0x2f74b7['model']=_['keys'](db[_0x5129('0x52')][_0x5129('0x36')]);_0x2f74b7['query']=_[_0x5129('0x38')](_0x33071e[_0x5129('0x37')]);_0x2f74b7[_0x5129('0x39')]=_[_0x5129('0x3a')](_0x2f74b7['model'],_0x2f74b7[_0x5129('0x37')]);_0x36d206['attributes']=_[_0x5129('0x3a')](_0x2f74b7[_0x5129('0x3b')],qs[_0x5129('0x3d')](_0x33071e[_0x5129('0x37')][_0x5129('0x3d')]));_0x36d206[_0x5129('0x3c')]=_0x36d206['attributes']['length']?_0x36d206[_0x5129('0x3c')]:_0x2f74b7['model'];_0x36d206[_0x5129('0x42')]=qs[_0x5129('0x43')](_0x33071e['query'][_0x5129('0x43')]);_0x36d206['where']=qs['filters'](_[_0x5129('0x53')](_0x33071e[_0x5129('0x37')],_0x2f74b7[_0x5129('0x39')]));if(_0x33071e[_0x5129('0x37')]['filter']){_0x36d206[_0x5129('0x44')]=_['merge'](_0x36d206[_0x5129('0x44')],{'$or':_[_0x5129('0x35')](_0x36d206[_0x5129('0x3c')],function(_0x5a822b){var _0x52456a={};_0x52456a[_0x5a822b]={'$like':'%'+_0x33071e[_0x5129('0x37')][_0x5129('0x45')]+'%'};return _0x52456a;})});}_0x36d206=_['merge']({},_0x36d206,_0x33071e[_0x5129('0x48')]);return _0x2bd21f[_0x5129('0x51')](_0x36d206);}})[_0x5129('0x1c')](function(_0x16c9c7){if(_0x16c9c7){_0x14bbc6=_0x16c9c7['length'];if(!_0x33071e[_0x5129('0x37')][_0x5129('0x3f')]('nolimit')){_0x36d206[_0x5129('0x41')]=qs[_0x5129('0x41')](_0x33071e['query'][_0x5129('0x41')]);_0x36d206[_0x5129('0x2b')]=qs[_0x5129('0x2b')](_0x33071e[_0x5129('0x37')][_0x5129('0x2b')]);}return _0x2bd21f[_0x5129('0x51')](_0x36d206);}})[_0x5129('0x1c')](function(_0x1c03de){if(_0x1c03de){return _0x1c03de?{'count':_0x14bbc6,'rows':_0x1c03de}:null;}})[_0x5129('0x1c')](respondWithResult(_0x4cf88b,null))[_0x5129('0x26')](handleError(_0x4cf88b,null));};exports[_0x5129('0x54')]=function(_0x336f66,_0x3aac76,_0x50a9c1){var _0x5cf48e={};var _0xfade96={};var _0x4c3596;var _0x53cbf8;return db[_0x5129('0x4d')]['findOne']({'where':{'id':_0x336f66[_0x5129('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3aac76,null))[_0x5129('0x1c')](function(_0x78cae6){if(_0x78cae6){_0x4c3596=_0x78cae6;_0xfade96['model']=_[_0x5129('0x38')](db[_0x5129('0x52')][_0x5129('0x36')]);_0xfade96[_0x5129('0x37')]=_['keys'](_0x336f66[_0x5129('0x37')]);_0xfade96['filters']=_[_0x5129('0x3a')](_0xfade96[_0x5129('0x3b')],_0xfade96[_0x5129('0x37')]);_0x5cf48e[_0x5129('0x3c')]=_['intersection'](_0xfade96[_0x5129('0x3b')],qs[_0x5129('0x3d')](_0x336f66[_0x5129('0x37')][_0x5129('0x3d')]));_0x5cf48e[_0x5129('0x3c')]=_0x5cf48e[_0x5129('0x3c')]['length']?_0x5cf48e['attributes']:_0xfade96[_0x5129('0x3b')];_0x5cf48e[_0x5129('0x42')]=qs[_0x5129('0x43')](_0x336f66[_0x5129('0x37')][_0x5129('0x43')]);_0x5cf48e[_0x5129('0x44')]=qs[_0x5129('0x39')](_[_0x5129('0x53')](_0x336f66[_0x5129('0x37')],_0xfade96[_0x5129('0x39')]));if(_0x336f66[_0x5129('0x37')][_0x5129('0x45')]){_0x5cf48e[_0x5129('0x44')]=_[_0x5129('0x46')](_0x5cf48e[_0x5129('0x44')],{'$or':_['map'](_0x5cf48e['attributes'],function(_0xe24de8){var _0x3a5d83={};_0x3a5d83[_0xe24de8]={'$like':'%'+_0x336f66['query'][_0x5129('0x45')]+'%'};return _0x3a5d83;})});}_0x5cf48e=_[_0x5129('0x46')]({},_0x5cf48e,_0x336f66[_0x5129('0x48')]);return _0x4c3596[_0x5129('0x54')](_0x5cf48e);}})['then'](function(_0x4d3cc2){if(_0x4d3cc2){_0x53cbf8=_0x4d3cc2[_0x5129('0x3e')];if(!_0x336f66[_0x5129('0x37')]['hasOwnProperty']('nolimit')){_0x5cf48e['limit']=qs[_0x5129('0x41')](_0x336f66[_0x5129('0x37')][_0x5129('0x41')]);_0x5cf48e[_0x5129('0x2b')]=qs[_0x5129('0x2b')](_0x336f66[_0x5129('0x37')]['offset']);}return _0x4c3596[_0x5129('0x54')](_0x5cf48e);}})[_0x5129('0x1c')](function(_0x5aa857){if(_0x5aa857){return _0x5aa857?{'count':_0x53cbf8,'rows':_0x5aa857}:null;}})[_0x5129('0x1c')](respondWithResult(_0x3aac76,null))[_0x5129('0x26')](handleError(_0x3aac76,null));};exports[_0x5129('0x55')]=function(_0x138174,_0x5aa494,_0x541715){var _0x125682={};var _0x12b473={};var _0x43d7b4;var _0x5b5f8b;return db[_0x5129('0x4d')][_0x5129('0x56')]({'where':{'id':_0x138174[_0x5129('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5aa494,null))['then'](function(_0x350daa){if(_0x350daa){_0x43d7b4=_0x350daa;_0x12b473['model']=_[_0x5129('0x38')](db[_0x5129('0x52')][_0x5129('0x36')]);_0x12b473['query']=_[_0x5129('0x38')](_0x138174[_0x5129('0x37')]);_0x12b473[_0x5129('0x39')]=_[_0x5129('0x3a')](_0x12b473[_0x5129('0x3b')],_0x12b473['query']);_0x125682[_0x5129('0x3c')]=_[_0x5129('0x3a')](_0x12b473[_0x5129('0x3b')],qs[_0x5129('0x3d')](_0x138174[_0x5129('0x37')][_0x5129('0x3d')]));_0x125682[_0x5129('0x3c')]=_0x125682[_0x5129('0x3c')][_0x5129('0x3e')]?_0x125682[_0x5129('0x3c')]:_0x12b473[_0x5129('0x3b')];_0x125682[_0x5129('0x42')]=qs[_0x5129('0x43')](_0x138174[_0x5129('0x37')][_0x5129('0x43')]);_0x125682[_0x5129('0x44')]=qs['filters'](_[_0x5129('0x53')](_0x138174[_0x5129('0x37')],_0x12b473[_0x5129('0x39')]));if(_0x138174['query']['filter']){_0x125682[_0x5129('0x44')]=_['merge'](_0x125682[_0x5129('0x44')],{'$or':_[_0x5129('0x35')](_0x125682['attributes'],function(_0x20814d){var _0x3fccc3={};_0x3fccc3[_0x20814d]={'$like':'%'+_0x138174[_0x5129('0x37')]['filter']+'%'};return _0x3fccc3;})});}_0x125682=_['merge']({},_0x125682,_0x138174['options']);return _0x43d7b4[_0x5129('0x55')](_0x125682);}})['then'](function(_0x116d1d){if(_0x116d1d){_0x5b5f8b=_0x116d1d[_0x5129('0x3e')];if(!_0x138174[_0x5129('0x37')]['hasOwnProperty'](_0x5129('0x40'))){_0x125682['limit']=qs[_0x5129('0x41')](_0x138174[_0x5129('0x37')][_0x5129('0x41')]);_0x125682[_0x5129('0x2b')]=qs['offset'](_0x138174[_0x5129('0x37')]['offset']);}return _0x43d7b4[_0x5129('0x55')](_0x125682);}})['then'](function(_0x51fa55){if(_0x51fa55){return _0x51fa55?{'count':_0x5b5f8b,'rows':_0x51fa55}:null;}})[_0x5129('0x1c')](respondWithResult(_0x5aa494,null))['catch'](handleError(_0x5aa494,null));};exports[_0x5129('0x57')]=function(_0x41e903,_0x8fdde2,_0x443471){var _0x335976={};var _0xb2c859={};var _0x1638dc;var _0x3f3185;return db[_0x5129('0x4d')][_0x5129('0x56')]({'where':{'id':_0x41e903[_0x5129('0x4c')]['id']}})[_0x5129('0x1c')](handleEntityNotFound(_0x8fdde2,null))[_0x5129('0x1c')](function(_0x584616){if(_0x584616){_0x1638dc=_0x584616;_0xb2c859['model']=_['keys'](db[_0x5129('0x58')][_0x5129('0x36')]);_0xb2c859[_0x5129('0x37')]=_[_0x5129('0x38')](_0x41e903[_0x5129('0x37')]);_0xb2c859[_0x5129('0x39')]=_[_0x5129('0x3a')](_0xb2c859[_0x5129('0x3b')],_0xb2c859[_0x5129('0x37')]);_0x335976[_0x5129('0x3c')]=_['intersection'](_0xb2c859[_0x5129('0x3b')],qs[_0x5129('0x3d')](_0x41e903[_0x5129('0x37')][_0x5129('0x3d')]));_0x335976['attributes']=_0x335976[_0x5129('0x3c')]['length']?_0x335976[_0x5129('0x3c')]:_0xb2c859[_0x5129('0x3b')];_0x335976['order']=qs[_0x5129('0x43')](_0x41e903[_0x5129('0x37')][_0x5129('0x43')]);_0x335976['where']=qs[_0x5129('0x39')](_[_0x5129('0x53')](_0x41e903[_0x5129('0x37')],_0xb2c859['filters']));if(_0x41e903[_0x5129('0x37')][_0x5129('0x45')]){_0x335976[_0x5129('0x44')]=_[_0x5129('0x46')](_0x335976[_0x5129('0x44')],{'$or':_[_0x5129('0x35')](_0x335976[_0x5129('0x3c')],function(_0x3a09fd){var _0xd4bccf={};_0xd4bccf[_0x3a09fd]={'$like':'%'+_0x41e903['query'][_0x5129('0x45')]+'%'};return _0xd4bccf;})});}_0x335976=_[_0x5129('0x46')]({},_0x335976,_0x41e903[_0x5129('0x48')]);return _0x1638dc[_0x5129('0x57')](_0x335976);}})[_0x5129('0x1c')](function(_0x5b7b91){if(_0x5b7b91){_0x3f3185=_0x5b7b91[_0x5129('0x3e')];if(!_0x41e903[_0x5129('0x37')][_0x5129('0x3f')]('nolimit')){_0x335976[_0x5129('0x41')]=qs['limit'](_0x41e903[_0x5129('0x37')][_0x5129('0x41')]);_0x335976['offset']=qs[_0x5129('0x2b')](_0x41e903['query'][_0x5129('0x2b')]);}return _0x1638dc[_0x5129('0x57')](_0x335976);}})[_0x5129('0x1c')](function(_0x4425b7){if(_0x4425b7){return _0x4425b7?{'count':_0x3f3185,'rows':_0x4425b7}:null;}})[_0x5129('0x1c')](respondWithResult(_0x8fdde2,null))['catch'](handleError(_0x8fdde2,null));};exports['setTags']=function(_0x142268,_0x458a51,_0xeb92f2){if(_0x142268[_0x5129('0x50')]['id']){delete _0x142268[_0x5129('0x50')]['id'];}return db[_0x5129('0x4d')][_0x5129('0x56')]({'where':{'id':_0x142268['params']['id']}})['then'](handleEntityNotFound(_0x458a51,null))[_0x5129('0x1c')](function(_0xbd2497){if(_0xbd2497){return _0xbd2497[_0x5129('0x59')](_0x142268['body'][_0x5129('0x5a')]||[]);}return null;})[_0x5129('0x1c')](respondWithResult(_0x458a51,null))[_0x5129('0x26')](handleError(_0x458a51,null));}; \ No newline at end of file +var _0x7177=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','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','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','update','sendStatus','name','send','index','DeskConfiguration','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','rawAttributes','find','create','body','params','getFields','findOne','DeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x7177,0x110));var _0x7717=function(_0x36103d,_0x3453b9){_0x36103d=_0x36103d-0x0;var _0x4edadd=_0x7177[_0x36103d];return _0x4edadd;};'use strict';var pdf=require(_0x7717('0x0'));var emlformat=require(_0x7717('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7717('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7717('0x3'));var BPromise=require(_0x7717('0x4'));var Mustache=require(_0x7717('0x5'));var util=require(_0x7717('0x6'));var path=require(_0x7717('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7717('0x8'));var fs=require('fs');var _=require(_0x7717('0x9'));var squel=require(_0x7717('0xa'));var crypto=require(_0x7717('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7717('0xc'));var toCsv=require(_0x7717('0xd'));var querystring=require(_0x7717('0xe'));var Papa=require(_0x7717('0xf'));var Redis=require(_0x7717('0x10'));var authService=require(_0x7717('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7717('0x12'));var hardwareService=require(_0x7717('0x13'));var logger=require(_0x7717('0x14'))(_0x7717('0x15'));var utils=require(_0x7717('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7717('0x17'))['db'];var jayson=require(_0x7717('0x18'));var client=jayson[_0x7717('0x19')][_0x7717('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x26907d,_0x4f7729,_0x49d5c5,_0x112970){return new BPromise(function(_0x1d1d67,_0x2f8caf){var _0x3e2b89=_0x112970||client;return _0x3e2b89[_0x7717('0x1b')](_0x26907d,_0x49d5c5)[_0x7717('0x1c')](function(_0x294dbe){logger[_0x7717('0x1d')](_0x7717('0x1e'),_0x4f7729,_0x7717('0x1f'));logger[_0x7717('0x20')](_0x7717('0x21'),_0x4f7729,_0x7717('0x1f'),JSON[_0x7717('0x22')](_0x294dbe));if(_0x294dbe['error']){if(_0x294dbe[_0x7717('0x23')][_0x7717('0x24')]===0x1f4){logger[_0x7717('0x23')](_0x7717('0x1e'),_0x4f7729,_0x294dbe[_0x7717('0x23')][_0x7717('0x25')]);return _0x2f8caf(_0x294dbe[_0x7717('0x23')][_0x7717('0x25')]);}logger[_0x7717('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x4f7729,_0x294dbe['error'][_0x7717('0x25')]);return _0x1d1d67(_0x294dbe[_0x7717('0x23')][_0x7717('0x25')]);}else{logger[_0x7717('0x1d')](_0x7717('0x1e'),_0x4f7729,_0x7717('0x1f'));_0x1d1d67(_0x294dbe[_0x7717('0x26')][_0x7717('0x25')]);}})[_0x7717('0x27')](function(_0x32dd68){logger[_0x7717('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x4f7729,_0x32dd68);_0x2f8caf(_0x32dd68);});});}function respondWithStatusCode(_0x3dfe2b,_0x523ca6){_0x523ca6=_0x523ca6||0xcc;return function(_0x1bca47){if(_0x1bca47){return _0x3dfe2b['sendStatus'](_0x523ca6);}return _0x3dfe2b[_0x7717('0x28')](_0x523ca6)[_0x7717('0x29')]();};}function respondWithResult(_0x16861c,_0x4d9362){_0x4d9362=_0x4d9362||0xc8;return function(_0x4177be){if(_0x4177be){return _0x16861c[_0x7717('0x28')](_0x4d9362)[_0x7717('0x2a')](_0x4177be);}};}function respondWithFilteredResult(_0x163fff,_0x139936){return function(_0x55a0bb){if(_0x55a0bb){var _0x41515e=_0x55a0bb[_0x7717('0x2b')],_0x1e8350=_0x139936[_0x7717('0x2c')],_0x3e8c71=_0x139936['offset']+_0x139936[_0x7717('0x2d')],_0x48d995;if(_0x3e8c71>=_0x41515e){_0x3e8c71=_0x41515e;_0x48d995=0xc8;}else{_0x48d995=0xce;}_0x163fff['status'](_0x48d995);return _0x163fff['set'](_0x7717('0x2e'),_0x1e8350+'-'+_0x3e8c71+'/'+_0x41515e)[_0x7717('0x2a')](_0x55a0bb);}return null;};}function patchUpdates(_0x4cfdeb){return function(_0x284c57){try{jsonpatch[_0x7717('0x2f')](_0x284c57,_0x4cfdeb,!![]);}catch(_0x10f014){return BPromise[_0x7717('0x30')](_0x10f014);}return _0x284c57['save']();};}function saveUpdates(_0x5c774b,_0x4a66d5){return function(_0x44c3de){if(_0x44c3de){return _0x44c3de[_0x7717('0x31')](_0x5c774b)['then'](function(_0x364647){return _0x364647;});}return null;};}function removeEntity(_0x4f8fb2,_0x2729d6){return function(_0x4a4948){if(_0x4a4948){return _0x4a4948['destroy']()['then'](function(){_0x4f8fb2['status'](0xcc)[_0x7717('0x29')]();});}};}function handleEntityNotFound(_0x399d3e,_0x31fda4){return function(_0x1b2e6f){if(!_0x1b2e6f){_0x399d3e[_0x7717('0x32')](0x194);}return _0x1b2e6f;};}function handleError(_0x144c75,_0x51ba6f){_0x51ba6f=_0x51ba6f||0x1f4;return function(_0x9fa110){logger[_0x7717('0x23')](_0x9fa110['stack']);if(_0x9fa110['name']){delete _0x9fa110[_0x7717('0x33')];}_0x144c75[_0x7717('0x28')](_0x51ba6f)[_0x7717('0x34')](_0x9fa110);};}exports[_0x7717('0x35')]=function(_0x53c2e3,_0x5d7e8f){var _0xb1bd75={},_0x9545ed={},_0x3e50fc={'count':0x0,'rows':[]};var _0x41c8c5=_['map'](db[_0x7717('0x36')]['rawAttributes'],function(_0x300544){return{'name':_0x300544[_0x7717('0x37')],'type':_0x300544[_0x7717('0x38')][_0x7717('0x39')]};});_0x9545ed['model']=_[_0x7717('0x3a')](_0x41c8c5,'name');_0x9545ed[_0x7717('0x3b')]=_[_0x7717('0x3c')](_0x53c2e3[_0x7717('0x3b')]);_0x9545ed[_0x7717('0x3d')]=_[_0x7717('0x3e')](_0x9545ed['model'],_0x9545ed[_0x7717('0x3b')]);_0xb1bd75[_0x7717('0x3f')]=_[_0x7717('0x3e')](_0x9545ed[_0x7717('0x40')],qs[_0x7717('0x41')](_0x53c2e3[_0x7717('0x3b')][_0x7717('0x41')]));_0xb1bd75[_0x7717('0x3f')]=_0xb1bd75['attributes'][_0x7717('0x42')]?_0xb1bd75[_0x7717('0x3f')]:_0x9545ed[_0x7717('0x40')];if(!_0x53c2e3[_0x7717('0x3b')][_0x7717('0x43')](_0x7717('0x44'))){_0xb1bd75[_0x7717('0x2d')]=qs[_0x7717('0x2d')](_0x53c2e3['query']['limit']);_0xb1bd75[_0x7717('0x2c')]=qs['offset'](_0x53c2e3[_0x7717('0x3b')][_0x7717('0x2c')]);}_0xb1bd75[_0x7717('0x45')]=qs[_0x7717('0x46')](_0x53c2e3['query'][_0x7717('0x46')]);_0xb1bd75[_0x7717('0x47')]=qs[_0x7717('0x3d')](_['pick'](_0x53c2e3[_0x7717('0x3b')],_0x9545ed[_0x7717('0x3d')]),_0x41c8c5);if(_0x53c2e3[_0x7717('0x3b')][_0x7717('0x48')]){_0xb1bd75[_0x7717('0x47')]=_[_0x7717('0x49')](_0xb1bd75['where'],{'$or':_[_0x7717('0x3a')](_0x41c8c5,function(_0x28ac34){if(_0x28ac34['type']!==_0x7717('0x4a')){var _0x46556d={};_0x46556d[_0x28ac34['name']]={'$like':'%'+_0x53c2e3[_0x7717('0x3b')][_0x7717('0x48')]+'%'};return _0x46556d;}})});}_0xb1bd75=_[_0x7717('0x49')]({},_0xb1bd75,_0x53c2e3[_0x7717('0x4b')]);var _0xdab222={'where':_0xb1bd75[_0x7717('0x47')]};return db[_0x7717('0x36')][_0x7717('0x2b')](_0xdab222)[_0x7717('0x1c')](function(_0x57f49c){_0x3e50fc[_0x7717('0x2b')]=_0x57f49c;if(_0x53c2e3[_0x7717('0x3b')][_0x7717('0x4c')]){_0xb1bd75[_0x7717('0x4d')]=[{'all':!![]}];}return db[_0x7717('0x36')][_0x7717('0x4e')](_0xb1bd75);})[_0x7717('0x1c')](function(_0x4b4acb){_0x3e50fc['rows']=_0x4b4acb;return _0x3e50fc;})[_0x7717('0x1c')](respondWithFilteredResult(_0x5d7e8f,_0xb1bd75))[_0x7717('0x27')](handleError(_0x5d7e8f,null));};exports[_0x7717('0x4f')]=function(_0x1a5ca3,_0x2a5f50){var _0x4f28d4={'raw':![],'where':{'id':_0x1a5ca3['params']['id']}},_0x52ceac={};_0x52ceac['model']=_[_0x7717('0x3c')](db[_0x7717('0x36')][_0x7717('0x50')]);_0x52ceac['query']=_[_0x7717('0x3c')](_0x1a5ca3[_0x7717('0x3b')]);_0x52ceac[_0x7717('0x3d')]=_[_0x7717('0x3e')](_0x52ceac['model'],_0x52ceac[_0x7717('0x3b')]);_0x4f28d4[_0x7717('0x3f')]=_[_0x7717('0x3e')](_0x52ceac[_0x7717('0x40')],qs[_0x7717('0x41')](_0x1a5ca3[_0x7717('0x3b')]['fields']));_0x4f28d4[_0x7717('0x3f')]=_0x4f28d4[_0x7717('0x3f')][_0x7717('0x42')]?_0x4f28d4['attributes']:_0x52ceac['model'];if(_0x1a5ca3[_0x7717('0x3b')][_0x7717('0x4c')]){_0x4f28d4[_0x7717('0x4d')]=[{'all':!![]}];}_0x4f28d4=_[_0x7717('0x49')]({},_0x4f28d4,_0x1a5ca3[_0x7717('0x4b')]);return db[_0x7717('0x36')][_0x7717('0x51')](_0x4f28d4)[_0x7717('0x1c')](handleEntityNotFound(_0x2a5f50,null))['then'](respondWithResult(_0x2a5f50,null))['catch'](handleError(_0x2a5f50,null));};exports[_0x7717('0x52')]=function(_0x5490fb,_0x5996c2){return db['DeskConfiguration'][_0x7717('0x52')](_0x5490fb['body'],{})[_0x7717('0x1c')](respondWithResult(_0x5996c2,0xc9))[_0x7717('0x27')](handleError(_0x5996c2,null));};exports[_0x7717('0x31')]=function(_0x970396,_0x324d76){if(_0x970396['body']['id']){delete _0x970396[_0x7717('0x53')]['id'];}return db[_0x7717('0x36')][_0x7717('0x51')]({'where':{'id':_0x970396[_0x7717('0x54')]['id']}})[_0x7717('0x1c')](handleEntityNotFound(_0x324d76,null))[_0x7717('0x1c')](saveUpdates(_0x970396[_0x7717('0x53')],null))[_0x7717('0x1c')](respondWithResult(_0x324d76,null))['catch'](handleError(_0x324d76,null));};exports['destroy']=function(_0x4b0b90,_0x48b456){return db[_0x7717('0x36')][_0x7717('0x51')]({'where':{'id':_0x4b0b90[_0x7717('0x54')]['id']}})[_0x7717('0x1c')](handleEntityNotFound(_0x48b456,null))[_0x7717('0x1c')](removeEntity(_0x48b456,null))['catch'](handleError(_0x48b456,null));};exports[_0x7717('0x55')]=function(_0x4011cd,_0x1e8efa,_0x3f54f3){var _0x38bfe={};var _0x3cf21a={};var _0x39d152;var _0x3f0263;return db['DeskConfiguration'][_0x7717('0x56')]({'where':{'id':_0x4011cd['params']['id']}})[_0x7717('0x1c')](handleEntityNotFound(_0x1e8efa,null))[_0x7717('0x1c')](function(_0x1eb607){if(_0x1eb607){_0x39d152=_0x1eb607;_0x3cf21a[_0x7717('0x40')]=_['keys'](db[_0x7717('0x57')][_0x7717('0x50')]);_0x3cf21a[_0x7717('0x3b')]=_[_0x7717('0x3c')](_0x4011cd[_0x7717('0x3b')]);_0x3cf21a[_0x7717('0x3d')]=_[_0x7717('0x3e')](_0x3cf21a['model'],_0x3cf21a['query']);_0x38bfe[_0x7717('0x3f')]=_[_0x7717('0x3e')](_0x3cf21a[_0x7717('0x40')],qs[_0x7717('0x41')](_0x4011cd[_0x7717('0x3b')]['fields']));_0x38bfe[_0x7717('0x3f')]=_0x38bfe[_0x7717('0x3f')][_0x7717('0x42')]?_0x38bfe['attributes']:_0x3cf21a[_0x7717('0x40')];_0x38bfe[_0x7717('0x45')]=qs['sort'](_0x4011cd[_0x7717('0x3b')][_0x7717('0x46')]);_0x38bfe['where']=qs[_0x7717('0x3d')](_[_0x7717('0x58')](_0x4011cd[_0x7717('0x3b')],_0x3cf21a[_0x7717('0x3d')]));if(_0x4011cd[_0x7717('0x3b')]['filter']){_0x38bfe['where']=_['merge'](_0x38bfe[_0x7717('0x47')],{'$or':_[_0x7717('0x3a')](_0x38bfe[_0x7717('0x3f')],function(_0x31a59b){var _0x258616={};_0x258616[_0x31a59b]={'$like':'%'+_0x4011cd['query'][_0x7717('0x48')]+'%'};return _0x258616;})});}_0x38bfe=_['merge']({},_0x38bfe,_0x4011cd[_0x7717('0x4b')]);return _0x39d152[_0x7717('0x55')](_0x38bfe);}})[_0x7717('0x1c')](function(_0x404818){if(_0x404818){_0x3f0263=_0x404818['length'];if(!_0x4011cd[_0x7717('0x3b')][_0x7717('0x43')](_0x7717('0x44'))){_0x38bfe['limit']=qs[_0x7717('0x2d')](_0x4011cd['query'][_0x7717('0x2d')]);_0x38bfe[_0x7717('0x2c')]=qs[_0x7717('0x2c')](_0x4011cd[_0x7717('0x3b')][_0x7717('0x2c')]);}return _0x39d152[_0x7717('0x55')](_0x38bfe);}})[_0x7717('0x1c')](function(_0x350d9f){if(_0x350d9f){return _0x350d9f?{'count':_0x3f0263,'rows':_0x350d9f}:null;}})[_0x7717('0x1c')](respondWithResult(_0x1e8efa,null))['catch'](handleError(_0x1e8efa,null));};exports[_0x7717('0x59')]=function(_0x3cf94d,_0x277c20,_0x12d44a){var _0x16fd9d={};var _0x1b7fb6={};var _0x10b0b3;var _0xcd1bd4;return db[_0x7717('0x36')]['findOne']({'where':{'id':_0x3cf94d[_0x7717('0x54')]['id']}})['then'](handleEntityNotFound(_0x277c20,null))[_0x7717('0x1c')](function(_0x1b257b){if(_0x1b257b){_0x10b0b3=_0x1b257b;_0x1b7fb6['model']=_[_0x7717('0x3c')](db[_0x7717('0x57')]['rawAttributes']);_0x1b7fb6[_0x7717('0x3b')]=_[_0x7717('0x3c')](_0x3cf94d[_0x7717('0x3b')]);_0x1b7fb6[_0x7717('0x3d')]=_[_0x7717('0x3e')](_0x1b7fb6['model'],_0x1b7fb6[_0x7717('0x3b')]);_0x16fd9d[_0x7717('0x3f')]=_['intersection'](_0x1b7fb6[_0x7717('0x40')],qs[_0x7717('0x41')](_0x3cf94d['query'][_0x7717('0x41')]));_0x16fd9d[_0x7717('0x3f')]=_0x16fd9d[_0x7717('0x3f')][_0x7717('0x42')]?_0x16fd9d[_0x7717('0x3f')]:_0x1b7fb6[_0x7717('0x40')];_0x16fd9d[_0x7717('0x45')]=qs[_0x7717('0x46')](_0x3cf94d['query']['sort']);_0x16fd9d[_0x7717('0x47')]=qs[_0x7717('0x3d')](_['pick'](_0x3cf94d[_0x7717('0x3b')],_0x1b7fb6[_0x7717('0x3d')]));if(_0x3cf94d['query'][_0x7717('0x48')]){_0x16fd9d[_0x7717('0x47')]=_[_0x7717('0x49')](_0x16fd9d[_0x7717('0x47')],{'$or':_[_0x7717('0x3a')](_0x16fd9d[_0x7717('0x3f')],function(_0x1812fb){var _0x4b0209={};_0x4b0209[_0x1812fb]={'$like':'%'+_0x3cf94d[_0x7717('0x3b')][_0x7717('0x48')]+'%'};return _0x4b0209;})});}_0x16fd9d=_['merge']({},_0x16fd9d,_0x3cf94d[_0x7717('0x4b')]);return _0x10b0b3[_0x7717('0x59')](_0x16fd9d);}})[_0x7717('0x1c')](function(_0xc5ff07){if(_0xc5ff07){_0xcd1bd4=_0xc5ff07[_0x7717('0x42')];if(!_0x3cf94d['query']['hasOwnProperty'](_0x7717('0x44'))){_0x16fd9d[_0x7717('0x2d')]=qs[_0x7717('0x2d')](_0x3cf94d[_0x7717('0x3b')][_0x7717('0x2d')]);_0x16fd9d[_0x7717('0x2c')]=qs[_0x7717('0x2c')](_0x3cf94d[_0x7717('0x3b')][_0x7717('0x2c')]);}return _0x10b0b3[_0x7717('0x59')](_0x16fd9d);}})['then'](function(_0x4b5558){if(_0x4b5558){return _0x4b5558?{'count':_0xcd1bd4,'rows':_0x4b5558}:null;}})[_0x7717('0x1c')](respondWithResult(_0x277c20,null))[_0x7717('0x27')](handleError(_0x277c20,null));};exports[_0x7717('0x5a')]=function(_0x11fa2f,_0x178943,_0x3a3722){var _0x3dec08={};var _0x2e7a57={};var _0x4362cf;var _0x38e3d5;return db[_0x7717('0x36')][_0x7717('0x56')]({'where':{'id':_0x11fa2f[_0x7717('0x54')]['id']}})[_0x7717('0x1c')](handleEntityNotFound(_0x178943,null))[_0x7717('0x1c')](function(_0x469322){if(_0x469322){_0x4362cf=_0x469322;_0x2e7a57['model']=_[_0x7717('0x3c')](db['DeskField'][_0x7717('0x50')]);_0x2e7a57['query']=_[_0x7717('0x3c')](_0x11fa2f[_0x7717('0x3b')]);_0x2e7a57[_0x7717('0x3d')]=_[_0x7717('0x3e')](_0x2e7a57[_0x7717('0x40')],_0x2e7a57[_0x7717('0x3b')]);_0x3dec08[_0x7717('0x3f')]=_['intersection'](_0x2e7a57[_0x7717('0x40')],qs[_0x7717('0x41')](_0x11fa2f[_0x7717('0x3b')][_0x7717('0x41')]));_0x3dec08[_0x7717('0x3f')]=_0x3dec08[_0x7717('0x3f')][_0x7717('0x42')]?_0x3dec08[_0x7717('0x3f')]:_0x2e7a57[_0x7717('0x40')];_0x3dec08['order']=qs[_0x7717('0x46')](_0x11fa2f['query']['sort']);_0x3dec08['where']=qs[_0x7717('0x3d')](_[_0x7717('0x58')](_0x11fa2f[_0x7717('0x3b')],_0x2e7a57['filters']));if(_0x11fa2f[_0x7717('0x3b')][_0x7717('0x48')]){_0x3dec08[_0x7717('0x47')]=_[_0x7717('0x49')](_0x3dec08[_0x7717('0x47')],{'$or':_[_0x7717('0x3a')](_0x3dec08[_0x7717('0x3f')],function(_0x2d041c){var _0x232525={};_0x232525[_0x2d041c]={'$like':'%'+_0x11fa2f[_0x7717('0x3b')][_0x7717('0x48')]+'%'};return _0x232525;})});}_0x3dec08=_['merge']({},_0x3dec08,_0x11fa2f[_0x7717('0x4b')]);return _0x4362cf['getDescriptions'](_0x3dec08);}})[_0x7717('0x1c')](function(_0x37fddc){if(_0x37fddc){_0x38e3d5=_0x37fddc[_0x7717('0x42')];if(!_0x11fa2f[_0x7717('0x3b')][_0x7717('0x43')](_0x7717('0x44'))){_0x3dec08['limit']=qs[_0x7717('0x2d')](_0x11fa2f['query'][_0x7717('0x2d')]);_0x3dec08['offset']=qs['offset'](_0x11fa2f['query'][_0x7717('0x2c')]);}return _0x4362cf[_0x7717('0x5a')](_0x3dec08);}})[_0x7717('0x1c')](function(_0x401850){if(_0x401850){return _0x401850?{'count':_0x38e3d5,'rows':_0x401850}:null;}})[_0x7717('0x1c')](respondWithResult(_0x178943,null))[_0x7717('0x27')](handleError(_0x178943,null));};exports[_0x7717('0x5b')]=function(_0x18b331,_0x3b2015,_0x3b3000){var _0x4898da={};var _0x20929b={};var _0x4d13de;var _0xabb919;return db['DeskConfiguration'][_0x7717('0x56')]({'where':{'id':_0x18b331[_0x7717('0x54')]['id']}})[_0x7717('0x1c')](handleEntityNotFound(_0x3b2015,null))['then'](function(_0x200760){if(_0x200760){_0x4d13de=_0x200760;_0x20929b[_0x7717('0x40')]=_[_0x7717('0x3c')](db[_0x7717('0x5c')][_0x7717('0x50')]);_0x20929b['query']=_['keys'](_0x18b331[_0x7717('0x3b')]);_0x20929b['filters']=_['intersection'](_0x20929b[_0x7717('0x40')],_0x20929b['query']);_0x4898da['attributes']=_[_0x7717('0x3e')](_0x20929b[_0x7717('0x40')],qs[_0x7717('0x41')](_0x18b331[_0x7717('0x3b')][_0x7717('0x41')]));_0x4898da['attributes']=_0x4898da['attributes']['length']?_0x4898da['attributes']:_0x20929b[_0x7717('0x40')];_0x4898da[_0x7717('0x45')]=qs[_0x7717('0x46')](_0x18b331[_0x7717('0x3b')][_0x7717('0x46')]);_0x4898da[_0x7717('0x47')]=qs['filters'](_['pick'](_0x18b331[_0x7717('0x3b')],_0x20929b[_0x7717('0x3d')]));if(_0x18b331[_0x7717('0x3b')][_0x7717('0x48')]){_0x4898da[_0x7717('0x47')]=_[_0x7717('0x49')](_0x4898da[_0x7717('0x47')],{'$or':_[_0x7717('0x3a')](_0x4898da['attributes'],function(_0x2f1788){var _0x9733b9={};_0x9733b9[_0x2f1788]={'$like':'%'+_0x18b331[_0x7717('0x3b')][_0x7717('0x48')]+'%'};return _0x9733b9;})});}_0x4898da=_[_0x7717('0x49')]({},_0x4898da,_0x18b331[_0x7717('0x4b')]);return _0x4d13de[_0x7717('0x5b')](_0x4898da);}})[_0x7717('0x1c')](function(_0x13bd74){if(_0x13bd74){_0xabb919=_0x13bd74['length'];if(!_0x18b331[_0x7717('0x3b')][_0x7717('0x43')](_0x7717('0x44'))){_0x4898da[_0x7717('0x2d')]=qs[_0x7717('0x2d')](_0x18b331['query']['limit']);_0x4898da[_0x7717('0x2c')]=qs[_0x7717('0x2c')](_0x18b331['query'][_0x7717('0x2c')]);}return _0x4d13de[_0x7717('0x5b')](_0x4898da);}})['then'](function(_0x583094){if(_0x583094){return _0x583094?{'count':_0xabb919,'rows':_0x583094}:null;}})['then'](respondWithResult(_0x3b2015,null))[_0x7717('0x27')](handleError(_0x3b2015,null));};exports[_0x7717('0x5d')]=function(_0x5b8055,_0x451091,_0x21ead4){if(_0x5b8055['body']['id']){delete _0x5b8055['body']['id'];}return db[_0x7717('0x36')][_0x7717('0x56')]({'where':{'id':_0x5b8055[_0x7717('0x54')]['id']}})['then'](handleEntityNotFound(_0x451091,null))['then'](function(_0x36dbb1){if(_0x36dbb1){return _0x36dbb1[_0x7717('0x5d')](_0x5b8055[_0x7717('0x53')][_0x7717('0x5e')]||[]);}return null;})[_0x7717('0x1c')](respondWithResult(_0x451091,null))[_0x7717('0x27')](handleError(_0x451091,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index e1bd2a6..e68eaf4 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 _0x731f=['bluebird','path','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','api','moment'];(function(_0x35fb57,_0x42ec80){var _0xa4d876=function(_0x396eb6){while(--_0x396eb6){_0x35fb57['push'](_0x35fb57['shift']());}};_0xa4d876(++_0x42ec80);}(_0x731f,0x1ae));var _0xf731=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x731f[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf731('0x0'));var moment=require(_0xf731('0x1'));var BPromise=require(_0xf731('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf731('0x3'));var rimraf=require('rimraf');var config=require(_0xf731('0x4'));var attributes=require(_0xf731('0x5'));module['exports']=function(_0xe7d9e5,_0x1033e7){return _0xe7d9e5[_0xf731('0x6')](_0xf731('0x7'),attributes,{'tableName':_0xf731('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92e7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92e7,0x188));var _0x792e=function(_0x4261c0,_0xac76d5){_0x4261c0=_0x4261c0-0x0;var _0x138b52=_0x92e7[_0x4261c0];return _0x138b52;};'use strict';var _=require('lodash');var util=require(_0x792e('0x0'));var logger=require(_0x792e('0x1'))(_0x792e('0x2'));var moment=require(_0x792e('0x3'));var BPromise=require(_0x792e('0x4'));var rp=require(_0x792e('0x5'));var fs=require('fs');var path=require(_0x792e('0x6'));var rimraf=require(_0x792e('0x7'));var config=require(_0x792e('0x8'));var attributes=require(_0x792e('0x9'));module[_0x792e('0xa')]=function(_0x56390e,_0x215bfa){return _0x56390e[_0x792e('0xb')](_0x792e('0xc'),attributes,{'tableName':_0x792e('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 3dfc825..437a7bc 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 _0x6f0d=['DeskConfiguration,\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','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x5f712,_0x1e26c1){var _0x62f147=function(_0x48434f){while(--_0x48434f){_0x5f712['push'](_0x5f712['shift']());}};_0x62f147(++_0x1e26c1);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x2593dd,_0x2443f0){_0x2593dd=_0x2593dd-0x0;var _0x4f9cd4=_0x6f0d[_0x2593dd];return _0x4f9cd4;};'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')]('DeskConfiguration,\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 _0x4ef1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x543df9,_0x1fc049){var _0x2dac9d=function(_0x3ede26){while(--_0x3ede26){_0x543df9['push'](_0x543df9['shift']());}};_0x2dac9d(++_0x1fc049);}(_0x4ef1,0xeb));var _0x14ef=function(_0x5764d9,_0x2bb4c6){_0x5764d9=_0x5764d9-0x0;var _0x1edfcf=_0x4ef1[_0x5764d9];return _0x1edfcf;};'use strict';var _=require(_0x14ef('0x0'));var util=require(_0x14ef('0x1'));var moment=require('moment');var BPromise=require(_0x14ef('0x2'));var rs=require(_0x14ef('0x3'));var fs=require('fs');var Redis=require(_0x14ef('0x4'));var db=require(_0x14ef('0x5'))['db'];var utils=require(_0x14ef('0x6'));var logger=require(_0x14ef('0x7'))(_0x14ef('0x8'));var config=require(_0x14ef('0x9'));var jayson=require(_0x14ef('0xa'));var client=jayson[_0x14ef('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x261fa2,_0x2dc335,_0x5b75ad){return new BPromise(function(_0x4175e7,_0x2ab217){return client[_0x14ef('0xc')](_0x261fa2,_0x5b75ad)[_0x14ef('0xd')](function(_0x17acc1){logger['info'](_0x14ef('0xe'),_0x2dc335,'request\x20sent');logger[_0x14ef('0xf')](_0x14ef('0x10'),_0x2dc335,_0x14ef('0x11'),JSON[_0x14ef('0x12')](_0x17acc1));if(_0x17acc1['error']){if(_0x17acc1['error'][_0x14ef('0x13')]===0x1f4){logger[_0x14ef('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0x2dc335,_0x17acc1[_0x14ef('0x14')][_0x14ef('0x15')]);return _0x2ab217(_0x17acc1[_0x14ef('0x14')]['message']);}logger[_0x14ef('0x14')](_0x14ef('0xe'),_0x2dc335,_0x17acc1[_0x14ef('0x14')][_0x14ef('0x15')]);return _0x4175e7(_0x17acc1['error'][_0x14ef('0x15')]);}else{logger[_0x14ef('0x16')](_0x14ef('0xe'),_0x2dc335,_0x14ef('0x11'));_0x4175e7(_0x17acc1['result'][_0x14ef('0x15')]);}})[_0x14ef('0x17')](function(_0x24556b){logger[_0x14ef('0x14')](_0x14ef('0xe'),_0x2dc335,_0x24556b);_0x2ab217(_0x24556b);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index c6cd4d3..e78a63d 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 _0x6d10=['/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','isAuthenticated','show','post','put','update'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x6d10,0x1e8));var _0x06d1=function(_0x11af37,_0xe303b){_0x11af37=_0x11af37-0x0;var _0x1f8605=_0x6d10[_0x11af37];return _0x1f8605;};'use strict';var multer=require(_0x06d1('0x0'));var util=require(_0x06d1('0x1'));var path=require(_0x06d1('0x2'));var timeout=require(_0x06d1('0x3'));var express=require(_0x06d1('0x4'));var router=express[_0x06d1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x06d1('0x6'));var config=require(_0x06d1('0x7'));var controller=require(_0x06d1('0x8'));router[_0x06d1('0x9')]('/',auth['isAuthenticated'](),controller[_0x06d1('0xa')]);router['get']('/:id',auth[_0x06d1('0xb')](),controller[_0x06d1('0xc')]);router[_0x06d1('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x06d1('0xe')]('/:id',auth[_0x06d1('0xb')](),controller[_0x06d1('0xf')]);router['delete'](_0x06d1('0x10'),auth['isAuthenticated'](),controller[_0x06d1('0x11')]);module['exports']=router; \ No newline at end of file +var _0x46c1=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index'];(function(_0x50e929,_0x290da5){var _0x126e47=function(_0x5a8a89){while(--_0x5a8a89){_0x50e929['push'](_0x50e929['shift']());}};_0x126e47(++_0x290da5);}(_0x46c1,0xa1));var _0x146c=function(_0x49835f,_0x193226){_0x49835f=_0x49835f-0x0;var _0x3afc8f=_0x46c1[_0x49835f];return _0x3afc8f;};'use strict';var multer=require(_0x146c('0x0'));var util=require(_0x146c('0x1'));var path=require(_0x146c('0x2'));var timeout=require(_0x146c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x146c('0x4'));var interaction=require(_0x146c('0x5'));var config=require(_0x146c('0x6'));var controller=require(_0x146c('0x7'));router['get']('/',auth[_0x146c('0x8')](),controller[_0x146c('0x9')]);router['get'](_0x146c('0xa'),auth[_0x146c('0x8')](),controller[_0x146c('0xb')]);router[_0x146c('0xc')]('/',auth[_0x146c('0x8')](),controller[_0x146c('0xd')]);router[_0x146c('0xe')]('/:id',auth[_0x146c('0x8')](),controller[_0x146c('0xf')]);router[_0x146c('0x10')](_0x146c('0xa'),auth[_0x146c('0x8')](),controller[_0x146c('0x11')]);module[_0x146c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index e2adef9..b60fcf1 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 _0xb7a1=['string','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7a1,0x1be));var _0x1b7a=function(_0x1271b1,_0x1b7730){_0x1271b1=_0x1271b1-0x0;var _0x3d9c70=_0xb7a1[_0x1271b1];return _0x3d9c70;};'use strict';var Sequelize=require(_0x1b7a('0x0'));module[_0x1b7a('0x1')]={'type':{'type':Sequelize[_0x1b7a('0x2')]('string','variable','customVariable','keyValue',_0x1b7a('0x3')),'defaultValue':_0x1b7a('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1b7a('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x1b7a('0x4'),_0x1b7a('0x6'),_0x1b7a('0x7'))},'keyContent':{'type':Sequelize[_0x1b7a('0x5')]},'idField':{'type':Sequelize[_0x1b7a('0x5')]},'nameField':{'type':Sequelize[_0x1b7a('0x5')]},'customField':{'type':Sequelize[_0x1b7a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1b7a('0x5')]}}; \ No newline at end of file +var _0x05e9=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x322159,_0x53dc75){var _0x34623a=function(_0x36f208){while(--_0x36f208){_0x322159['push'](_0x322159['shift']());}};_0x34623a(++_0x53dc75);}(_0x05e9,0x66));var _0x905e=function(_0x51993c,_0x4296c8){_0x51993c=_0x51993c-0x0;var _0x2ddc57=_0x05e9[_0x51993c];return _0x2ddc57;};'use strict';var Sequelize=require(_0x905e('0x0'));module[_0x905e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x905e('0x2'),_0x905e('0x3'),_0x905e('0x4'),_0x905e('0x5'),_0x905e('0x6')),'defaultValue':_0x905e('0x2')},'content':{'type':Sequelize[_0x905e('0x7')]},'key':{'type':Sequelize[_0x905e('0x7')]},'keyType':{'type':Sequelize[_0x905e('0x8')](_0x905e('0x2'),'variable',_0x905e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x905e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x905e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x905e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 18151a1..804de29 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 _0xa884=['../../config/license/util','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','DeskField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','merge','options','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0xa884,0x1ab));var _0x4a88=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0xa884[_0x673722];return _0x21249c;};'use strict';var pdf=require(_0x4a88('0x0'));var emlformat=require(_0x4a88('0x1'));var rimraf=require(_0x4a88('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a88('0x3'));var rp=require(_0x4a88('0x4'));var moment=require(_0x4a88('0x5'));var BPromise=require(_0x4a88('0x6'));var Mustache=require(_0x4a88('0x7'));var util=require(_0x4a88('0x8'));var path=require(_0x4a88('0x9'));var sox=require(_0x4a88('0xa'));var csv=require(_0x4a88('0xb'));var ejs=require(_0x4a88('0xc'));var fs=require('fs');var _=require(_0x4a88('0xd'));var squel=require(_0x4a88('0xe'));var crypto=require(_0x4a88('0xf'));var jsforce=require(_0x4a88('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4a88('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4a88('0x11'));var authService=require(_0x4a88('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a88('0x13'));var logger=require(_0x4a88('0x14'))(_0x4a88('0x15'));var utils=require(_0x4a88('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4a88('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2641c7,_0x506fee){_0x506fee=_0x506fee||0xcc;return function(_0x519394){if(_0x519394){return _0x2641c7['sendStatus'](_0x506fee);}return _0x2641c7[_0x4a88('0x18')](_0x506fee)[_0x4a88('0x19')]();};}function respondWithResult(_0x56658e,_0xda3cbf){_0xda3cbf=_0xda3cbf||0xc8;return function(_0x134f67){if(_0x134f67){return _0x56658e[_0x4a88('0x18')](_0xda3cbf)['json'](_0x134f67);}};}function respondWithFilteredResult(_0x5ac90e,_0x2c323a){return function(_0x483ad1){if(_0x483ad1){var _0x2e5d2a=_0x483ad1[_0x4a88('0x1a')],_0x4e2e0c=_0x2c323a[_0x4a88('0x1b')],_0xdbeeba=_0x2c323a['offset']+_0x2c323a[_0x4a88('0x1c')],_0xbdf0d1;if(_0xdbeeba>=_0x2e5d2a){_0xdbeeba=_0x2e5d2a;_0xbdf0d1=0xc8;}else{_0xbdf0d1=0xce;}_0x5ac90e['status'](_0xbdf0d1);return _0x5ac90e[_0x4a88('0x1d')](_0x4a88('0x1e'),_0x4e2e0c+'-'+_0xdbeeba+'/'+_0x2e5d2a)[_0x4a88('0x1f')](_0x483ad1);}return null;};}function patchUpdates(_0x307da2){return function(_0x20dbd8){try{jsonpatch[_0x4a88('0x20')](_0x20dbd8,_0x307da2,!![]);}catch(_0x266b46){return BPromise[_0x4a88('0x21')](_0x266b46);}return _0x20dbd8[_0x4a88('0x22')]();};}function saveUpdates(_0x420bd7,_0x189489){return function(_0x537ade){if(_0x537ade){return _0x537ade[_0x4a88('0x23')](_0x420bd7)[_0x4a88('0x24')](function(_0x33bf26){return _0x33bf26;});}return null;};}function removeEntity(_0x81ba90,_0x53f6fe){return function(_0x19804b){if(_0x19804b){return _0x19804b[_0x4a88('0x25')]()[_0x4a88('0x24')](function(){_0x81ba90[_0x4a88('0x18')](0xcc)[_0x4a88('0x19')]();});}};}function handleEntityNotFound(_0x25e06d,_0x32a78f){return function(_0x3077b7){if(!_0x3077b7){_0x25e06d[_0x4a88('0x26')](0x194);}return _0x3077b7;};}function handleError(_0x16a845,_0x512ae1){_0x512ae1=_0x512ae1||0x1f4;return function(_0x3a42dd){logger[_0x4a88('0x27')](_0x3a42dd[_0x4a88('0x28')]);if(_0x3a42dd[_0x4a88('0x29')]){delete _0x3a42dd[_0x4a88('0x29')];}_0x16a845[_0x4a88('0x18')](_0x512ae1)['send'](_0x3a42dd);};}exports['index']=function(_0x3622b0,_0x4069c2){var _0x26fadd={},_0x16d2c7={},_0x4b37d9={'count':0x0,'rows':[]};var _0x188dc5=_[_0x4a88('0x2a')](db[_0x4a88('0x2b')][_0x4a88('0x2c')],function(_0x212fb2){return{'name':_0x212fb2['fieldName'],'type':_0x212fb2[_0x4a88('0x2d')][_0x4a88('0x2e')]};});_0x16d2c7[_0x4a88('0x2f')]=_[_0x4a88('0x2a')](_0x188dc5,_0x4a88('0x29'));_0x16d2c7[_0x4a88('0x30')]=_[_0x4a88('0x31')](_0x3622b0[_0x4a88('0x30')]);_0x16d2c7[_0x4a88('0x32')]=_[_0x4a88('0x33')](_0x16d2c7[_0x4a88('0x2f')],_0x16d2c7[_0x4a88('0x30')]);_0x26fadd[_0x4a88('0x34')]=_['intersection'](_0x16d2c7[_0x4a88('0x2f')],qs['fields'](_0x3622b0[_0x4a88('0x30')][_0x4a88('0x35')]));_0x26fadd['attributes']=_0x26fadd['attributes'][_0x4a88('0x36')]?_0x26fadd[_0x4a88('0x34')]:_0x16d2c7[_0x4a88('0x2f')];if(!_0x3622b0['query'][_0x4a88('0x37')](_0x4a88('0x38'))){_0x26fadd[_0x4a88('0x1c')]=qs[_0x4a88('0x1c')](_0x3622b0[_0x4a88('0x30')][_0x4a88('0x1c')]);_0x26fadd[_0x4a88('0x1b')]=qs[_0x4a88('0x1b')](_0x3622b0[_0x4a88('0x30')][_0x4a88('0x1b')]);}_0x26fadd[_0x4a88('0x39')]=qs[_0x4a88('0x3a')](_0x3622b0[_0x4a88('0x30')][_0x4a88('0x3a')]);_0x26fadd[_0x4a88('0x3b')]=qs['filters'](_[_0x4a88('0x3c')](_0x3622b0[_0x4a88('0x30')],_0x16d2c7[_0x4a88('0x32')]),_0x188dc5);if(_0x3622b0['query'][_0x4a88('0x3d')]){_0x26fadd[_0x4a88('0x3b')]=_['merge'](_0x26fadd['where'],{'$or':_[_0x4a88('0x2a')](_0x188dc5,function(_0x151740){if(_0x151740[_0x4a88('0x2d')]!==_0x4a88('0x3e')){var _0xe495d={};_0xe495d[_0x151740[_0x4a88('0x29')]]={'$like':'%'+_0x3622b0['query']['filter']+'%'};return _0xe495d;}})});}_0x26fadd=_['merge']({},_0x26fadd,_0x3622b0['options']);var _0x12d56d={'where':_0x26fadd[_0x4a88('0x3b')]};return db[_0x4a88('0x2b')][_0x4a88('0x1a')](_0x12d56d)['then'](function(_0x6442e3){_0x4b37d9['count']=_0x6442e3;if(_0x3622b0[_0x4a88('0x30')]['includeAll']){_0x26fadd[_0x4a88('0x3f')]=[{'all':!![]}];}return db[_0x4a88('0x2b')][_0x4a88('0x40')](_0x26fadd);})[_0x4a88('0x24')](function(_0x51ada7){_0x4b37d9[_0x4a88('0x41')]=_0x51ada7;return _0x4b37d9;})[_0x4a88('0x24')](respondWithFilteredResult(_0x4069c2,_0x26fadd))[_0x4a88('0x42')](handleError(_0x4069c2,null));};exports[_0x4a88('0x43')]=function(_0x533614,_0x539741){var _0x278b64={'raw':!![],'where':{'id':_0x533614[_0x4a88('0x44')]['id']}},_0x2d2103={};_0x2d2103[_0x4a88('0x2f')]=_['keys'](db[_0x4a88('0x2b')][_0x4a88('0x2c')]);_0x2d2103['query']=_[_0x4a88('0x31')](_0x533614[_0x4a88('0x30')]);_0x2d2103['filters']=_[_0x4a88('0x33')](_0x2d2103['model'],_0x2d2103[_0x4a88('0x30')]);_0x278b64[_0x4a88('0x34')]=_['intersection'](_0x2d2103[_0x4a88('0x2f')],qs[_0x4a88('0x35')](_0x533614[_0x4a88('0x30')][_0x4a88('0x35')]));_0x278b64[_0x4a88('0x34')]=_0x278b64[_0x4a88('0x34')][_0x4a88('0x36')]?_0x278b64[_0x4a88('0x34')]:_0x2d2103[_0x4a88('0x2f')];if(_0x533614[_0x4a88('0x30')][_0x4a88('0x45')]){_0x278b64[_0x4a88('0x3f')]=[{'all':!![]}];}_0x278b64=_[_0x4a88('0x46')]({},_0x278b64,_0x533614[_0x4a88('0x47')]);return db['DeskField']['find'](_0x278b64)[_0x4a88('0x24')](handleEntityNotFound(_0x539741,null))['then'](respondWithResult(_0x539741,null))[_0x4a88('0x42')](handleError(_0x539741,null));};exports[_0x4a88('0x48')]=function(_0x11d621,_0x2fe6b8){return db[_0x4a88('0x2b')]['create'](_0x11d621['body'],{})[_0x4a88('0x24')](respondWithResult(_0x2fe6b8,0xc9))[_0x4a88('0x42')](handleError(_0x2fe6b8,null));};exports[_0x4a88('0x23')]=function(_0x397a58,_0x3fecbd){if(_0x397a58[_0x4a88('0x49')]['id']){delete _0x397a58[_0x4a88('0x49')]['id'];}return db['DeskField'][_0x4a88('0x4a')]({'where':{'id':_0x397a58[_0x4a88('0x44')]['id']}})[_0x4a88('0x24')](handleEntityNotFound(_0x3fecbd,null))['then'](saveUpdates(_0x397a58[_0x4a88('0x49')],null))[_0x4a88('0x24')](respondWithResult(_0x3fecbd,null))[_0x4a88('0x42')](handleError(_0x3fecbd,null));};exports[_0x4a88('0x25')]=function(_0x24d1bf,_0x4d33ea){return db['DeskField'][_0x4a88('0x4a')]({'where':{'id':_0x24d1bf[_0x4a88('0x44')]['id']}})[_0x4a88('0x24')](handleEntityNotFound(_0x4d33ea,null))[_0x4a88('0x24')](removeEntity(_0x4d33ea,null))[_0x4a88('0x42')](handleError(_0x4d33ea,null));}; \ No newline at end of file +var _0x0ea9=['model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','DeskField','rawAttributes','type','key'];(function(_0x440f3a,_0x639689){var _0x457152=function(_0x25dbb6){while(--_0x25dbb6){_0x440f3a['push'](_0x440f3a['shift']());}};_0x457152(++_0x639689);}(_0x0ea9,0xa3));var _0x90ea=function(_0x1db8fb,_0x33dd0c){_0x1db8fb=_0x1db8fb-0x0;var _0x30090a=_0x0ea9[_0x1db8fb];return _0x30090a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x90ea('0x0'));var zipdir=require(_0x90ea('0x1'));var jsonpatch=require(_0x90ea('0x2'));var rp=require(_0x90ea('0x3'));var moment=require(_0x90ea('0x4'));var BPromise=require(_0x90ea('0x5'));var Mustache=require(_0x90ea('0x6'));var util=require('util');var path=require(_0x90ea('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x90ea('0x8'));var fs=require('fs');var _=require(_0x90ea('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90ea('0xa'));var toCsv=require(_0x90ea('0xb'));var querystring=require(_0x90ea('0xc'));var Papa=require(_0x90ea('0xd'));var Redis=require('ioredis');var authService=require(_0x90ea('0xe'));var qs=require(_0x90ea('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90ea('0x10'));var logger=require(_0x90ea('0x11'))(_0x90ea('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x90ea('0x13'));var db=require(_0x90ea('0x14'))['db'];function respondWithStatusCode(_0x4bd017,_0x505bf5){_0x505bf5=_0x505bf5||0xcc;return function(_0x3843f8){if(_0x3843f8){return _0x4bd017[_0x90ea('0x15')](_0x505bf5);}return _0x4bd017[_0x90ea('0x16')](_0x505bf5)[_0x90ea('0x17')]();};}function respondWithResult(_0x44521b,_0x45ebc){_0x45ebc=_0x45ebc||0xc8;return function(_0x3068ff){if(_0x3068ff){return _0x44521b[_0x90ea('0x16')](_0x45ebc)[_0x90ea('0x18')](_0x3068ff);}};}function respondWithFilteredResult(_0x1fb846,_0x16381a){return function(_0x1e22bf){if(_0x1e22bf){var _0x4025d5=_0x1e22bf[_0x90ea('0x19')],_0x4c5f09=_0x16381a[_0x90ea('0x1a')],_0x5bc7cc=_0x16381a[_0x90ea('0x1a')]+_0x16381a[_0x90ea('0x1b')],_0x3cec73;if(_0x5bc7cc>=_0x4025d5){_0x5bc7cc=_0x4025d5;_0x3cec73=0xc8;}else{_0x3cec73=0xce;}_0x1fb846[_0x90ea('0x16')](_0x3cec73);return _0x1fb846[_0x90ea('0x1c')](_0x90ea('0x1d'),_0x4c5f09+'-'+_0x5bc7cc+'/'+_0x4025d5)['json'](_0x1e22bf);}return null;};}function patchUpdates(_0x2d8466){return function(_0x3b8d44){try{jsonpatch[_0x90ea('0x1e')](_0x3b8d44,_0x2d8466,!![]);}catch(_0x579e24){return BPromise[_0x90ea('0x1f')](_0x579e24);}return _0x3b8d44[_0x90ea('0x20')]();};}function saveUpdates(_0x1aeed2,_0x373592){return function(_0xfbab4){if(_0xfbab4){return _0xfbab4[_0x90ea('0x21')](_0x1aeed2)[_0x90ea('0x22')](function(_0x19d7d1){return _0x19d7d1;});}return null;};}function removeEntity(_0x45b923,_0x37ae9b){return function(_0x3efb70){if(_0x3efb70){return _0x3efb70[_0x90ea('0x23')]()[_0x90ea('0x22')](function(){_0x45b923['status'](0xcc)[_0x90ea('0x17')]();});}};}function handleEntityNotFound(_0x6bb6bc,_0x4a32dd){return function(_0x38a2d8){if(!_0x38a2d8){_0x6bb6bc['sendStatus'](0x194);}return _0x38a2d8;};}function handleError(_0x27250b,_0x5967e8){_0x5967e8=_0x5967e8||0x1f4;return function(_0x21568f){logger['error'](_0x21568f[_0x90ea('0x24')]);if(_0x21568f[_0x90ea('0x25')]){delete _0x21568f['name'];}_0x27250b[_0x90ea('0x16')](_0x5967e8)[_0x90ea('0x26')](_0x21568f);};}exports[_0x90ea('0x27')]=function(_0x16ed85,_0x1c74ef){var _0x16fcfe={},_0x1f4903={},_0x192d53={'count':0x0,'rows':[]};var _0x5b3557=_['map'](db[_0x90ea('0x28')][_0x90ea('0x29')],function(_0x1a24c2){return{'name':_0x1a24c2['fieldName'],'type':_0x1a24c2[_0x90ea('0x2a')][_0x90ea('0x2b')]};});_0x1f4903[_0x90ea('0x2c')]=_[_0x90ea('0x2d')](_0x5b3557,_0x90ea('0x25'));_0x1f4903['query']=_[_0x90ea('0x2e')](_0x16ed85[_0x90ea('0x2f')]);_0x1f4903[_0x90ea('0x30')]=_['intersection'](_0x1f4903[_0x90ea('0x2c')],_0x1f4903[_0x90ea('0x2f')]);_0x16fcfe[_0x90ea('0x31')]=_[_0x90ea('0x32')](_0x1f4903[_0x90ea('0x2c')],qs['fields'](_0x16ed85[_0x90ea('0x2f')][_0x90ea('0x33')]));_0x16fcfe['attributes']=_0x16fcfe['attributes'][_0x90ea('0x34')]?_0x16fcfe[_0x90ea('0x31')]:_0x1f4903['model'];if(!_0x16ed85[_0x90ea('0x2f')]['hasOwnProperty'](_0x90ea('0x35'))){_0x16fcfe['limit']=qs[_0x90ea('0x1b')](_0x16ed85[_0x90ea('0x2f')][_0x90ea('0x1b')]);_0x16fcfe[_0x90ea('0x1a')]=qs[_0x90ea('0x1a')](_0x16ed85['query']['offset']);}_0x16fcfe[_0x90ea('0x36')]=qs[_0x90ea('0x37')](_0x16ed85[_0x90ea('0x2f')][_0x90ea('0x37')]);_0x16fcfe['where']=qs['filters'](_['pick'](_0x16ed85[_0x90ea('0x2f')],_0x1f4903['filters']),_0x5b3557);if(_0x16ed85[_0x90ea('0x2f')][_0x90ea('0x38')]){_0x16fcfe[_0x90ea('0x39')]=_[_0x90ea('0x3a')](_0x16fcfe['where'],{'$or':_[_0x90ea('0x2d')](_0x5b3557,function(_0x1c1584){if(_0x1c1584[_0x90ea('0x2a')]!=='VIRTUAL'){var _0x5ac5d4={};_0x5ac5d4[_0x1c1584['name']]={'$like':'%'+_0x16ed85[_0x90ea('0x2f')]['filter']+'%'};return _0x5ac5d4;}})});}_0x16fcfe=_[_0x90ea('0x3a')]({},_0x16fcfe,_0x16ed85[_0x90ea('0x3b')]);var _0x898914={'where':_0x16fcfe['where']};return db['DeskField'][_0x90ea('0x19')](_0x898914)['then'](function(_0x114b11){_0x192d53[_0x90ea('0x19')]=_0x114b11;if(_0x16ed85[_0x90ea('0x2f')][_0x90ea('0x3c')]){_0x16fcfe[_0x90ea('0x3d')]=[{'all':!![]}];}return db['DeskField'][_0x90ea('0x3e')](_0x16fcfe);})[_0x90ea('0x22')](function(_0x520a05){_0x192d53[_0x90ea('0x3f')]=_0x520a05;return _0x192d53;})[_0x90ea('0x22')](respondWithFilteredResult(_0x1c74ef,_0x16fcfe))[_0x90ea('0x40')](handleError(_0x1c74ef,null));};exports['show']=function(_0x416d34,_0x57413f){var _0x1e8846={'raw':!![],'where':{'id':_0x416d34[_0x90ea('0x41')]['id']}},_0x1e8628={};_0x1e8628[_0x90ea('0x2c')]=_['keys'](db[_0x90ea('0x28')][_0x90ea('0x29')]);_0x1e8628['query']=_[_0x90ea('0x2e')](_0x416d34[_0x90ea('0x2f')]);_0x1e8628[_0x90ea('0x30')]=_[_0x90ea('0x32')](_0x1e8628[_0x90ea('0x2c')],_0x1e8628[_0x90ea('0x2f')]);_0x1e8846[_0x90ea('0x31')]=_[_0x90ea('0x32')](_0x1e8628[_0x90ea('0x2c')],qs[_0x90ea('0x33')](_0x416d34[_0x90ea('0x2f')][_0x90ea('0x33')]));_0x1e8846[_0x90ea('0x31')]=_0x1e8846[_0x90ea('0x31')][_0x90ea('0x34')]?_0x1e8846[_0x90ea('0x31')]:_0x1e8628[_0x90ea('0x2c')];if(_0x416d34['query'][_0x90ea('0x3c')]){_0x1e8846[_0x90ea('0x3d')]=[{'all':!![]}];}_0x1e8846=_[_0x90ea('0x3a')]({},_0x1e8846,_0x416d34['options']);return db[_0x90ea('0x28')][_0x90ea('0x42')](_0x1e8846)['then'](handleEntityNotFound(_0x57413f,null))[_0x90ea('0x22')](respondWithResult(_0x57413f,null))[_0x90ea('0x40')](handleError(_0x57413f,null));};exports[_0x90ea('0x43')]=function(_0x3f2a1a,_0x2eff88){return db[_0x90ea('0x28')][_0x90ea('0x43')](_0x3f2a1a[_0x90ea('0x44')],{})[_0x90ea('0x22')](respondWithResult(_0x2eff88,0xc9))[_0x90ea('0x40')](handleError(_0x2eff88,null));};exports['update']=function(_0xfa5822,_0x2b1992){if(_0xfa5822[_0x90ea('0x44')]['id']){delete _0xfa5822[_0x90ea('0x44')]['id'];}return db[_0x90ea('0x28')]['find']({'where':{'id':_0xfa5822[_0x90ea('0x41')]['id']}})['then'](handleEntityNotFound(_0x2b1992,null))[_0x90ea('0x22')](saveUpdates(_0xfa5822['body'],null))[_0x90ea('0x22')](respondWithResult(_0x2b1992,null))[_0x90ea('0x40')](handleError(_0x2b1992,null));};exports['destroy']=function(_0x53860f,_0x21a7df){return db[_0x90ea('0x28')][_0x90ea('0x42')]({'where':{'id':_0x53860f[_0x90ea('0x41')]['id']}})[_0x90ea('0x22')](handleEntityNotFound(_0x21a7df,null))[_0x90ea('0x22')](removeEntity(_0x21a7df,null))[_0x90ea('0x40')](handleError(_0x21a7df,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 83e5800..7d34ca1 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 _0x5525=['DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x5df80f,_0x35d518){var _0xe4abce=function(_0x131150){while(--_0x131150){_0x5df80f['push'](_0x5df80f['shift']());}};_0xe4abce(++_0x35d518);}(_0x5525,0x145));var _0x5552=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5525[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x5552('0x0'));var util=require('util');var logger=require(_0x5552('0x1'))(_0x5552('0x2'));var moment=require('moment');var BPromise=require(_0x5552('0x3'));var rp=require(_0x5552('0x4'));var fs=require('fs');var path=require(_0x5552('0x5'));var rimraf=require(_0x5552('0x6'));var config=require(_0x5552('0x7'));var attributes=require(_0x5552('0x8'));module[_0x5552('0x9')]=function(_0x44a0c4,_0x32ebf7){return _0x44a0c4[_0x5552('0xa')](_0x5552('0xb'),attributes,{'tableName':_0x5552('0xc'),'paranoid':![],'indexes':[{'name':_0x5552('0xd'),'fields':[_0x5552('0xe'),_0x5552('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28d3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','exports','define','desk_unique_index','FieldId'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x28d3,0xe0));var _0x328d=function(_0x431af9,_0x3d81d1){_0x431af9=_0x431af9-0x0;var _0x54e95a=_0x28d3[_0x431af9];return _0x54e95a;};'use strict';var _=require(_0x328d('0x0'));var util=require(_0x328d('0x1'));var logger=require(_0x328d('0x2'))(_0x328d('0x3'));var moment=require(_0x328d('0x4'));var BPromise=require(_0x328d('0x5'));var rp=require(_0x328d('0x6'));var fs=require('fs');var path=require(_0x328d('0x7'));var rimraf=require('rimraf');var config=require(_0x328d('0x8'));var attributes=require(_0x328d('0x9'));module[_0x328d('0xa')]=function(_0x22cbcd,_0xe8c557){return _0x22cbcd[_0x328d('0xb')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x328d('0xc'),'fields':['idField',_0x328d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index e528d84..3aa9ce4 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 _0xf6e4=['DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','jayson/promise','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4dcc66,_0x39dc46){var _0x5644d7=function(_0x556368){while(--_0x556368){_0x4dcc66['push'](_0x4dcc66['shift']());}};_0x5644d7(++_0x39dc46);}(_0xf6e4,0x15d));var _0x4f6e=function(_0x2e48dd,_0x58d9e2){_0x2e48dd=_0x2e48dd-0x0;var _0x352d16=_0xf6e4[_0x2e48dd];return _0x352d16;};'use strict';var _=require(_0x4f6e('0x0'));var util=require('util');var moment=require(_0x4f6e('0x1'));var BPromise=require(_0x4f6e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f6e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f6e('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4f6e('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbd17a2,_0xd36bcc,_0xc82fc1){return new BPromise(function(_0x37184e,_0x112ffe){return client[_0x4f6e('0x6')](_0xbd17a2,_0xc82fc1)[_0x4f6e('0x7')](function(_0x3770e1){logger[_0x4f6e('0x8')](_0x4f6e('0x9'),_0xd36bcc,_0x4f6e('0xa'));logger[_0x4f6e('0xb')](_0x4f6e('0xc'),_0xd36bcc,_0x4f6e('0xa'),JSON[_0x4f6e('0xd')](_0x3770e1));if(_0x3770e1[_0x4f6e('0xe')]){if(_0x3770e1['error'][_0x4f6e('0xf')]===0x1f4){logger[_0x4f6e('0xe')](_0x4f6e('0x9'),_0xd36bcc,_0x3770e1[_0x4f6e('0xe')]['message']);return _0x112ffe(_0x3770e1['error'][_0x4f6e('0x10')]);}logger[_0x4f6e('0xe')](_0x4f6e('0x9'),_0xd36bcc,_0x3770e1[_0x4f6e('0xe')][_0x4f6e('0x10')]);return _0x37184e(_0x3770e1[_0x4f6e('0xe')]['message']);}else{logger['info'](_0x4f6e('0x9'),_0xd36bcc,_0x4f6e('0xa'));_0x37184e(_0x3770e1[_0x4f6e('0x11')]['message']);}})[_0x4f6e('0x12')](function(_0x3af2a7){logger[_0x4f6e('0xe')](_0x4f6e('0x9'),_0xd36bcc,_0x3af2a7);_0x112ffe(_0x3af2a7);});});} \ No newline at end of file +var _0x0173=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xdd16ac,_0x4bf108){var _0x570fa2=function(_0x1f1288){while(--_0x1f1288){_0xdd16ac['push'](_0xdd16ac['shift']());}};_0x570fa2(++_0x4bf108);}(_0x0173,0x71));var _0x3017=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0173[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3017('0x0'));var util=require(_0x3017('0x1'));var moment=require(_0x3017('0x2'));var BPromise=require(_0x3017('0x3'));var rs=require(_0x3017('0x4'));var fs=require('fs');var Redis=require(_0x3017('0x5'));var db=require(_0x3017('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3017('0x7'));var config=require(_0x3017('0x8'));var jayson=require(_0x3017('0x9'));var client=jayson[_0x3017('0xa')][_0x3017('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54567c,_0x144151,_0x2c3629){return new BPromise(function(_0x36397d,_0x5c02b6){return client['request'](_0x54567c,_0x2c3629)[_0x3017('0xc')](function(_0x190c74){logger[_0x3017('0xd')](_0x3017('0xe'),_0x144151,_0x3017('0xf'));logger[_0x3017('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x144151,_0x3017('0xf'),JSON[_0x3017('0x11')](_0x190c74));if(_0x190c74[_0x3017('0x12')]){if(_0x190c74[_0x3017('0x12')][_0x3017('0x13')]===0x1f4){logger[_0x3017('0x12')](_0x3017('0xe'),_0x144151,_0x190c74[_0x3017('0x12')][_0x3017('0x14')]);return _0x5c02b6(_0x190c74[_0x3017('0x12')][_0x3017('0x14')]);}logger[_0x3017('0x12')](_0x3017('0xe'),_0x144151,_0x190c74[_0x3017('0x12')]['message']);return _0x36397d(_0x190c74[_0x3017('0x12')][_0x3017('0x14')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x144151,_0x3017('0xf'));_0x36397d(_0x190c74[_0x3017('0x15')][_0x3017('0x14')]);}})['catch'](function(_0x10c971){logger[_0x3017('0x12')]('DeskField,\x20%s,\x20%s',_0x144151,_0x10c971);_0x5c02b6(_0x10c971);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 465efae..42f47d5 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 _0xb10b=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x2e5517,_0x24dc07){var _0x4e9d8f=function(_0xcfec90){while(--_0xcfec90){_0x2e5517['push'](_0x2e5517['shift']());}};_0x4e9d8f(++_0x24dc07);}(_0xb10b,0x12a));var _0xbb10=function(_0x5af5a8,_0x10ce33){_0x5af5a8=_0x5af5a8-0x0;var _0x414545=_0xb10b[_0x5af5a8];return _0x414545;};'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['getFields']);router['post']('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router[_0xbb10('0x10')]('/:id/configurations',auth[_0xbb10('0x9')](),controller['addConfiguration']);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 _0xda2d=['connect-timeout','express','Router','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','update','delete','destroy','exports','util','path'];(function(_0x36bfda,_0x1670d8){var _0x7b866c=function(_0x15db0b){while(--_0x15db0b){_0x36bfda['push'](_0x36bfda['shift']());}};_0x7b866c(++_0x1670d8);}(_0xda2d,0x102));var _0xdda2=function(_0x1fe7ef,_0x159c73){_0x1fe7ef=_0x1fe7ef-0x0;var _0x886d0c=_0xda2d[_0x1fe7ef];return _0x886d0c;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdda2('0x5'));router[_0xdda2('0x6')]('/',auth[_0xdda2('0x7')](),controller[_0xdda2('0x8')]);router[_0xdda2('0x6')](_0xdda2('0x9'),auth[_0xdda2('0x7')](),controller[_0xdda2('0xa')]);router[_0xdda2('0x6')](_0xdda2('0xb'),auth['isAuthenticated'](),controller[_0xdda2('0xc')]);router[_0xdda2('0x6')]('/:id/fields',auth[_0xdda2('0x7')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/',auth[_0xdda2('0x7')](),controller[_0xdda2('0xf')]);router[_0xdda2('0xe')](_0xdda2('0xb'),auth[_0xdda2('0x7')](),controller['addConfiguration']);router['put']('/:id',auth[_0xdda2('0x7')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0x9'),auth[_0xdda2('0x7')](),controller[_0xdda2('0x12')]);module[_0xdda2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index a1d846c..6b236b4 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 _0x90da=['exports','STRING','sequelize'];(function(_0x4ff67a,_0x1853d0){var _0x32fd55=function(_0x583f61){while(--_0x583f61){_0x4ff67a['push'](_0x4ff67a['shift']());}};_0x32fd55(++_0x1853d0);}(_0x90da,0xb0));var _0xa90d=function(_0x17d261,_0x25d1e5){_0x17d261=_0x17d261-0x0;var _0x357290=_0x90da[_0x17d261];return _0x357290;};'use strict';var Sequelize=require(_0xa90d('0x0'));module[_0xa90d('0x1')]={'name':{'type':Sequelize[_0xa90d('0x2')]},'username':{'type':Sequelize[_0xa90d('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa90d('0x2')]},'tenantId':{'type':Sequelize[_0xa90d('0x2')]},'clientId':{'type':Sequelize[_0xa90d('0x2')]},'clientSecret':{'type':Sequelize[_0xa90d('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x034f=['exports','STRING'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0x034f,0x13a));var _0xf034=function(_0x78a5a9,_0x5bea56){_0x78a5a9=_0x78a5a9-0x0;var _0x1e6131=_0x034f[_0x78a5a9];return _0x1e6131;};'use strict';var Sequelize=require('sequelize');module[_0xf034('0x0')]={'name':{'type':Sequelize[_0xf034('0x1')]},'username':{'type':Sequelize[_0xf034('0x1')]},'password':{'type':Sequelize[_0xf034('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xf034('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xf034('0x1')]},'serverUrl':{'type':Sequelize[_0xf034('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf034('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 35cbb0c..34e1ff6 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 _0xacf4=['isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','send','test',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','destroy','sendStatus','stack','name','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','create','update','body','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidyominame','actualserviceunits','contractdetailidname','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata'];(function(_0x9391c2,_0x75a5d3){var _0x1739bf=function(_0x34d909){while(--_0x34d909){_0x9391c2['push'](_0x9391c2['shift']());}};_0x1739bf(++_0x75a5d3);}(_0xacf4,0xe7));var _0x4acf=function(_0x51b68b,_0x27a568){_0x51b68b=_0x51b68b-0x0;var _0x6b50cb=_0xacf4[_0x51b68b];return _0x6b50cb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4acf('0x0'));var zipdir=require(_0x4acf('0x1'));var jsonpatch=require(_0x4acf('0x2'));var rp=require(_0x4acf('0x3'));var moment=require(_0x4acf('0x4'));var BPromise=require(_0x4acf('0x5'));var Mustache=require(_0x4acf('0x6'));var util=require('util');var path=require(_0x4acf('0x7'));var sox=require(_0x4acf('0x8'));var csv=require('to-csv');var ejs=require(_0x4acf('0x9'));var fs=require('fs');var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4acf('0x15'));var jayson=require(_0x4acf('0x16'));var client=jayson[_0x4acf('0x17')][_0x4acf('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x18629e,_0x1a9949,_0x7ab3ea,_0x15386a){return new BPromise(function(_0x2025ca,_0x312bb5){var _0x2741d3=_0x15386a||client;return _0x2741d3['request'](_0x18629e,_0x7ab3ea)[_0x4acf('0x19')](function(_0x57d8e0){logger[_0x4acf('0x1a')](_0x4acf('0x1b'),_0x1a9949,_0x4acf('0x1c'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1a9949,_0x4acf('0x1c'),JSON[_0x4acf('0x1d')](_0x57d8e0));if(_0x57d8e0[_0x4acf('0x1e')]){if(_0x57d8e0['error'][_0x4acf('0x1f')]===0x1f4){logger[_0x4acf('0x1e')](_0x4acf('0x1b'),_0x1a9949,_0x57d8e0[_0x4acf('0x1e')][_0x4acf('0x20')]);return _0x312bb5(_0x57d8e0[_0x4acf('0x1e')][_0x4acf('0x20')]);}logger[_0x4acf('0x1e')](_0x4acf('0x1b'),_0x1a9949,_0x57d8e0[_0x4acf('0x1e')][_0x4acf('0x20')]);return _0x2025ca(_0x57d8e0['error'][_0x4acf('0x20')]);}else{logger[_0x4acf('0x1a')]('Dynamics365Account,\x20%s,\x20%s',_0x1a9949,_0x4acf('0x1c'));_0x2025ca(_0x57d8e0[_0x4acf('0x21')]['message']);}})[_0x4acf('0x22')](function(_0x34d154){logger[_0x4acf('0x1e')](_0x4acf('0x1b'),_0x1a9949,_0x34d154);_0x312bb5(_0x34d154);});});}function respondWithStatusCode(_0x53885f,_0x1a2286){_0x1a2286=_0x1a2286||0xcc;return function(_0x12e717){if(_0x12e717){return _0x53885f['sendStatus'](_0x1a2286);}return _0x53885f[_0x4acf('0x23')](_0x1a2286)[_0x4acf('0x24')]();};}function respondWithResult(_0x52a84a,_0x126522){_0x126522=_0x126522||0xc8;return function(_0x7ebb){if(_0x7ebb){return _0x52a84a[_0x4acf('0x23')](_0x126522)[_0x4acf('0x25')](_0x7ebb);}};}function respondWithFilteredResult(_0x571a30,_0x50236d){return function(_0x17a756){if(_0x17a756){var _0x3f548a=_0x17a756[_0x4acf('0x26')],_0x355799=_0x50236d[_0x4acf('0x27')],_0x42c90c=_0x50236d[_0x4acf('0x27')]+_0x50236d[_0x4acf('0x28')],_0x14086c;if(_0x42c90c>=_0x3f548a){_0x42c90c=_0x3f548a;_0x14086c=0xc8;}else{_0x14086c=0xce;}_0x571a30[_0x4acf('0x23')](_0x14086c);return _0x571a30['set'](_0x4acf('0x29'),_0x355799+'-'+_0x42c90c+'/'+_0x3f548a)[_0x4acf('0x25')](_0x17a756);}return null;};}function patchUpdates(_0xd027c7){return function(_0x2a5db3){try{jsonpatch[_0x4acf('0x2a')](_0x2a5db3,_0xd027c7,!![]);}catch(_0x28570f){return BPromise[_0x4acf('0x2b')](_0x28570f);}return _0x2a5db3['save']();};}function saveUpdates(_0x337b3c,_0x1d221b){return function(_0x16a74e){if(_0x16a74e){return _0x16a74e['update'](_0x337b3c)[_0x4acf('0x19')](function(_0x18d0bf){return _0x18d0bf;});}return null;};}function removeEntity(_0x1fc815,_0x28ce8a){return function(_0x53a4f3){if(_0x53a4f3){return _0x53a4f3[_0x4acf('0x2c')]()[_0x4acf('0x19')](function(){_0x1fc815[_0x4acf('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31fbce,_0x34e2ee){return function(_0x4084fe){if(!_0x4084fe){_0x31fbce[_0x4acf('0x2d')](0x194);}return _0x4084fe;};}function handleError(_0xd221b7,_0x152d1c){_0x152d1c=_0x152d1c||0x1f4;return function(_0x490880){logger[_0x4acf('0x1e')](_0x490880[_0x4acf('0x2e')]);if(_0x490880['name']){delete _0x490880[_0x4acf('0x2f')];}_0xd221b7['status'](_0x152d1c)['send'](_0x490880);};}exports['index']=function(_0x4bd85c,_0x4ce916){var _0x562fdc={},_0x4a8b5a={},_0x3364dd={'count':0x0,'rows':[]};var _0x1b45f6=_['map'](db[_0x4acf('0x30')][_0x4acf('0x31')],function(_0x39e56b){return{'name':_0x39e56b[_0x4acf('0x32')],'type':_0x39e56b[_0x4acf('0x33')][_0x4acf('0x34')]};});_0x4a8b5a[_0x4acf('0x35')]=_[_0x4acf('0x36')](_0x1b45f6,_0x4acf('0x2f'));_0x4a8b5a[_0x4acf('0x37')]=_['keys'](_0x4bd85c['query']);_0x4a8b5a[_0x4acf('0x38')]=_[_0x4acf('0x39')](_0x4a8b5a['model'],_0x4a8b5a[_0x4acf('0x37')]);_0x562fdc[_0x4acf('0x3a')]=_[_0x4acf('0x39')](_0x4a8b5a[_0x4acf('0x35')],qs['fields'](_0x4bd85c['query'][_0x4acf('0x3b')]));_0x562fdc[_0x4acf('0x3a')]=_0x562fdc[_0x4acf('0x3a')][_0x4acf('0x3c')]?_0x562fdc['attributes']:_0x4a8b5a[_0x4acf('0x35')];if(!_0x4bd85c[_0x4acf('0x37')]['hasOwnProperty']('nolimit')){_0x562fdc['limit']=qs['limit'](_0x4bd85c[_0x4acf('0x37')][_0x4acf('0x28')]);_0x562fdc[_0x4acf('0x27')]=qs['offset'](_0x4bd85c[_0x4acf('0x37')][_0x4acf('0x27')]);}_0x562fdc[_0x4acf('0x3d')]=qs[_0x4acf('0x3e')](_0x4bd85c[_0x4acf('0x37')][_0x4acf('0x3e')]);_0x562fdc[_0x4acf('0x3f')]=qs[_0x4acf('0x38')](_[_0x4acf('0x40')](_0x4bd85c[_0x4acf('0x37')],_0x4a8b5a[_0x4acf('0x38')]),_0x1b45f6);if(_0x4bd85c['query'][_0x4acf('0x41')]){_0x562fdc[_0x4acf('0x3f')]=_[_0x4acf('0x42')](_0x562fdc[_0x4acf('0x3f')],{'$or':_[_0x4acf('0x36')](_0x1b45f6,function(_0x58bc5d){if(_0x58bc5d['type']!==_0x4acf('0x43')){var _0x2fc411={};_0x2fc411[_0x58bc5d[_0x4acf('0x2f')]]={'$like':'%'+_0x4bd85c[_0x4acf('0x37')][_0x4acf('0x41')]+'%'};return _0x2fc411;}})});}_0x562fdc=_[_0x4acf('0x42')]({},_0x562fdc,_0x4bd85c['options']);var _0x2e7128={'where':_0x562fdc['where']};return db[_0x4acf('0x30')][_0x4acf('0x26')](_0x2e7128)['then'](function(_0x53ec11){_0x3364dd[_0x4acf('0x26')]=_0x53ec11;if(_0x4bd85c[_0x4acf('0x37')][_0x4acf('0x44')]){_0x562fdc[_0x4acf('0x45')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x4acf('0x46')](_0x562fdc);})[_0x4acf('0x19')](function(_0x2378c6){_0x3364dd[_0x4acf('0x47')]=_0x2378c6;return _0x3364dd;})[_0x4acf('0x19')](respondWithFilteredResult(_0x4ce916,_0x562fdc))[_0x4acf('0x22')](handleError(_0x4ce916,null));};exports[_0x4acf('0x48')]=function(_0x2d946c,_0x51e931){var _0x519817={'raw':![],'where':{'id':_0x2d946c[_0x4acf('0x49')]['id']}},_0x1f5c5f={};_0x1f5c5f[_0x4acf('0x35')]=_[_0x4acf('0x4a')](db[_0x4acf('0x30')][_0x4acf('0x31')]);_0x1f5c5f[_0x4acf('0x37')]=_[_0x4acf('0x4a')](_0x2d946c[_0x4acf('0x37')]);_0x1f5c5f[_0x4acf('0x38')]=_[_0x4acf('0x39')](_0x1f5c5f[_0x4acf('0x35')],_0x1f5c5f['query']);_0x519817[_0x4acf('0x3a')]=_[_0x4acf('0x39')](_0x1f5c5f[_0x4acf('0x35')],qs[_0x4acf('0x3b')](_0x2d946c[_0x4acf('0x37')][_0x4acf('0x3b')]));_0x519817[_0x4acf('0x3a')]=_0x519817[_0x4acf('0x3a')][_0x4acf('0x3c')]?_0x519817[_0x4acf('0x3a')]:_0x1f5c5f[_0x4acf('0x35')];if(_0x2d946c[_0x4acf('0x37')][_0x4acf('0x44')]){_0x519817[_0x4acf('0x45')]=[{'all':!![]}];}_0x519817=_[_0x4acf('0x42')]({},_0x519817,_0x2d946c[_0x4acf('0x4b')]);return db['Dynamics365Account'][_0x4acf('0x4c')](_0x519817)[_0x4acf('0x19')](handleEntityNotFound(_0x51e931,null))[_0x4acf('0x19')](respondWithResult(_0x51e931,null))['catch'](handleError(_0x51e931,null));};exports[_0x4acf('0x4d')]=function(_0x3e8953,_0xd87769){return db[_0x4acf('0x30')]['create'](_0x3e8953['body'],{})['then'](respondWithResult(_0xd87769,0xc9))[_0x4acf('0x22')](handleError(_0xd87769,null));};exports[_0x4acf('0x4e')]=function(_0x449b7a,_0x4fa993){if(_0x449b7a[_0x4acf('0x4f')]['id']){delete _0x449b7a[_0x4acf('0x4f')]['id'];}return db['Dynamics365Account'][_0x4acf('0x4c')]({'where':{'id':_0x449b7a[_0x4acf('0x49')]['id']}})[_0x4acf('0x19')](handleEntityNotFound(_0x4fa993,null))[_0x4acf('0x19')](saveUpdates(_0x449b7a['body'],null))[_0x4acf('0x19')](respondWithResult(_0x4fa993,null))[_0x4acf('0x22')](handleError(_0x4fa993,null));};exports[_0x4acf('0x2c')]=function(_0xa2c430,_0x4d48f3){return db[_0x4acf('0x30')]['find']({'where':{'id':_0xa2c430[_0x4acf('0x49')]['id']}})['then'](handleEntityNotFound(_0x4d48f3,null))[_0x4acf('0x19')](removeEntity(_0x4d48f3,null))[_0x4acf('0x22')](handleError(_0x4d48f3,null));};exports[_0x4acf('0x50')]=function(_0x42aa65,_0x547128,_0x4df6a2){var _0x4cb554={};var _0x14b634={};var _0x5a2ac6;var _0x4c8d4b;return db[_0x4acf('0x30')][_0x4acf('0x51')]({'where':{'id':_0x42aa65['params']['id']}})[_0x4acf('0x19')](handleEntityNotFound(_0x547128,null))[_0x4acf('0x19')](function(_0x4bebb2){if(_0x4bebb2){_0x5a2ac6=_0x4bebb2;_0x14b634[_0x4acf('0x35')]=_[_0x4acf('0x4a')](db[_0x4acf('0x52')]['rawAttributes']);_0x14b634[_0x4acf('0x37')]=_[_0x4acf('0x4a')](_0x42aa65[_0x4acf('0x37')]);_0x14b634[_0x4acf('0x38')]=_['intersection'](_0x14b634[_0x4acf('0x35')],_0x14b634[_0x4acf('0x37')]);_0x4cb554[_0x4acf('0x3a')]=_['intersection'](_0x14b634[_0x4acf('0x35')],qs[_0x4acf('0x3b')](_0x42aa65[_0x4acf('0x37')][_0x4acf('0x3b')]));_0x4cb554[_0x4acf('0x3a')]=_0x4cb554[_0x4acf('0x3a')][_0x4acf('0x3c')]?_0x4cb554[_0x4acf('0x3a')]:_0x14b634[_0x4acf('0x35')];_0x4cb554[_0x4acf('0x3d')]=qs[_0x4acf('0x3e')](_0x42aa65[_0x4acf('0x37')][_0x4acf('0x3e')]);_0x4cb554[_0x4acf('0x3f')]=qs[_0x4acf('0x38')](_['pick'](_0x42aa65[_0x4acf('0x37')],_0x14b634[_0x4acf('0x38')]));if(_0x42aa65[_0x4acf('0x37')][_0x4acf('0x41')]){_0x4cb554[_0x4acf('0x3f')]=_[_0x4acf('0x42')](_0x4cb554[_0x4acf('0x3f')],{'$or':_[_0x4acf('0x36')](_0x4cb554['attributes'],function(_0x540dd5){var _0x8977ad={};_0x8977ad[_0x540dd5]={'$like':'%'+_0x42aa65['query'][_0x4acf('0x41')]+'%'};return _0x8977ad;})});}_0x4cb554=_['merge']({},_0x4cb554,_0x42aa65['options']);return _0x5a2ac6['getConfigurations'](_0x4cb554);}})[_0x4acf('0x19')](function(_0x3aff2e){if(_0x3aff2e){_0x4c8d4b=_0x3aff2e[_0x4acf('0x3c')];if(!_0x42aa65[_0x4acf('0x37')][_0x4acf('0x53')](_0x4acf('0x54'))){_0x4cb554['limit']=qs['limit'](_0x42aa65['query'][_0x4acf('0x28')]);_0x4cb554[_0x4acf('0x27')]=qs[_0x4acf('0x27')](_0x42aa65['query'][_0x4acf('0x27')]);}return _0x5a2ac6[_0x4acf('0x50')](_0x4cb554);}})[_0x4acf('0x19')](function(_0x114198){if(_0x114198){return _0x114198?{'count':_0x4c8d4b,'rows':_0x114198}:null;}})[_0x4acf('0x19')](respondWithResult(_0x547128,null))[_0x4acf('0x22')](handleError(_0x547128,null));};exports['addConfiguration']=function(_0x278b96,_0x52e6d2,_0x166d31){if(_0x278b96[_0x4acf('0x4f')]['id']){delete _0x278b96[_0x4acf('0x4f')]['id'];}return db[_0x4acf('0x30')][_0x4acf('0x51')]({'where':{'id':_0x278b96[_0x4acf('0x49')]['id']}})[_0x4acf('0x19')](handleEntityNotFound(_0x52e6d2,null))[_0x4acf('0x19')](function(_0x1dfe70){if(_0x1dfe70){_0x278b96[_0x4acf('0x4f')][_0x4acf('0x55')]=_0x1dfe70['id'];_0x278b96[_0x4acf('0x4f')]['Subjects']=integrations[_0x4acf('0x56')](_0x278b96[_0x4acf('0x4f')][_0x4acf('0x57')],_0x278b96[_0x4acf('0x4f')][_0x4acf('0x33')]);_0x278b96[_0x4acf('0x4f')][_0x4acf('0x58')]=integrations[_0x4acf('0x59')](_0x278b96[_0x4acf('0x4f')][_0x4acf('0x57')],_0x278b96['body'][_0x4acf('0x33')]);return db[_0x4acf('0x52')]['create'](_0x278b96[_0x4acf('0x4f')],{'include':[{'model':db[_0x4acf('0x5a')],'as':'Subjects'},{'model':db[_0x4acf('0x5a')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x52e6d2,null))[_0x4acf('0x22')](handleError(_0x52e6d2,null));};exports['getFields']=function(_0x22729c,_0xe57598,_0x13f042){var _0x2034e4=_0x22729c['query'][_0x4acf('0x5b')];var _0x15fb66=_0x2034e4==='incident'?'Incident':'PhoneCall';var _0x1dd32a='';var _0x5e33ce='';var _0x3adb06='';var _0x34ad58='';var _0x4f3cf1='';var _0x4d7c9d='';var _0x249d40='';var _0x30dfed='';var _0x591d0b=[_0x4acf('0x5c'),_0x4acf('0x5d'),'customerid',_0x4acf('0x5e'),_0x4acf('0x5f'),_0x4acf('0x60'),_0x4acf('0x61'),_0x4acf('0x62'),_0x4acf('0x63'),'phonecall_activity_parties'];var _0x208157=['accountidname',_0x4acf('0x64'),_0x4acf('0x65'),'billedserviceunits','contactidname','contactidyominame',_0x4acf('0x66'),'contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame',_0x4acf('0x67'),'createdbyyominame',_0x4acf('0x68'),_0x4acf('0x69'),_0x4acf('0x6a'),_0x4acf('0x6b'),_0x4acf('0x6c'),'customeridyominame','emailaddress',_0x4acf('0x6d'),_0x4acf('0x6e'),_0x4acf('0x6f'),_0x4acf('0x70'),_0x4acf('0x71'),'firstresponsebykpiidname',_0x4acf('0x72'),_0x4acf('0x73'),_0x4acf('0x74'),_0x4acf('0x75'),_0x4acf('0x76'),_0x4acf('0x77'),_0x4acf('0x78'),'modifiedbyexternalpartyyominame',_0x4acf('0x79'),'modifiedbyyominame',_0x4acf('0x7a'),_0x4acf('0x7b'),_0x4acf('0x7c'),_0x4acf('0x7d'),_0x4acf('0x7e'),'numberofchildincidents',_0x4acf('0x7f'),'overriddencreatedon',_0x4acf('0x80'),_0x4acf('0x81'),'owneridyominame',_0x4acf('0x82'),_0x4acf('0x83'),_0x4acf('0x84'),_0x4acf('0x85'),_0x4acf('0x86'),'productserialnumber',_0x4acf('0x87'),'resolvebykpiidname','responseby',_0x4acf('0x88'),_0x4acf('0x89'),_0x4acf('0x8a'),_0x4acf('0x8b'),'slaname','socialprofileidname',_0x4acf('0x8c'),_0x4acf('0x8d'),_0x4acf('0x8e'),_0x4acf('0x8f'),_0x4acf('0x90'),_0x4acf('0x91'),_0x4acf('0x92'),_0x4acf('0x93'),'versionnumber'];var _0x5a968c=_0x591d0b[_0x4acf('0x94')](_0x208157);return db[_0x4acf('0x30')][_0x4acf('0x51')]({'where':{'id':_0x22729c[_0x4acf('0x49')]['id']},'attributes':['id',_0x4acf('0x95'),_0x4acf('0x96'),_0x4acf('0x97'),_0x4acf('0x98'),_0x4acf('0x99'),'clientSecret']})[_0x4acf('0x19')](handleEntityNotFound(_0xe57598,null))[_0x4acf('0x19')](function(_0x179935){if(_0x179935){_0x30dfed=_0x179935[_0x4acf('0x97')];var _0x37ecd2=_0x30dfed[_0x4acf('0x9a')](-0x1);if(_0x37ecd2==='/'){_0x30dfed=_0x30dfed[_0x4acf('0x9b')](0x0,_0x30dfed[_0x4acf('0x9c')](_0x37ecd2));}_0x249d40=util[_0x4acf('0x9d')](_0x4acf('0x9e'),_0x30dfed);var _0x21448c={'method':_0x4acf('0x9f'),'uri':_0x4acf('0xa0')+_0x179935['tenantId']+_0x4acf('0xa1'),'form':{'client_id':_0x179935['clientId'],'resource':_0x30dfed,'username':_0x179935[_0x4acf('0x95')],'password':_0x179935[_0x4acf('0x96')],'grant_type':'password','client_secret':_0x179935[_0x4acf('0xa2')]},'json':!![]};return rp(_0x21448c);}})[_0x4acf('0x19')](function(_0x577f98){_0x4d7c9d=_0x577f98['access_token'];var _0x175c91={'method':_0x4acf('0xa3'),'uri':encodeURI(_0x249d40+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x15fb66+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4d7c9d,'If-None-Match':null,'OData-Version':_0x4acf('0xa4')},'json':!![]};return rp(_0x175c91);})[_0x4acf('0x19')](function(_0x26fed7){var _0x201bc9=_0x26fed7['value'][0x0];var _0x1774ac=_0x201bc9[_0x4acf('0xa5')];var _0x366696={'method':_0x4acf('0xa3'),'uri':_0x249d40+_0x4acf('0xa6')+_0x1774ac+_0x4acf('0xa7'),'headers':{'Authorization':_0x4acf('0xa8')+_0x4d7c9d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x366696);})[_0x4acf('0x19')](function(_0x176b0d){_0x1dd32a=_0x176b0d;_0x5e33ce=_0x1dd32a[_0x4acf('0xa9')];_0x5e33ce=_['remove'](_0x5e33ce,function(_0x40cccb){return!_0x5a968c[_0x4acf('0xaa')](_0x40cccb[_0x4acf('0xab')]);});var _0x1ab81f=[];var _0x37ffab=[];_0x5e33ce[_0x4acf('0xac')](function(_0x470712){if(_0x470712[_0x4acf('0xad')]){var _0x4a3238=_0x470712['@odata.type']['substring'](_0x470712['@odata.type']['lastIndexOf']('.')+0x1);if(_0x4a3238===_0x4acf('0xae')){_0x1ab81f['push'](getSelectList(_0x249d40,_0x2034e4,_0x37ffab,_0x1dd32a[_0x4acf('0xa5')],_0x470712[_0x4acf('0xa5')],_0x4d7c9d));}}});return Promise['all'](_0x1ab81f);})[_0x4acf('0x19')](function(_0x14ef45){_0x3adb06=_0x14ef45[0x0];var _0x1e08cf=[];var _0x35ddbc=[];_0x5e33ce[_0x4acf('0xac')](function(_0x140713){if(!_[_0x4acf('0xaf')](_0x140713[_0x4acf('0xad')])){var _0x422b8e=_0x140713[_0x4acf('0xad')][_0x4acf('0x9b')](_0x140713[_0x4acf('0xad')][_0x4acf('0x9c')]('.')+0x1);if(_0x422b8e===_0x4acf('0xb0')){_0x1e08cf[_0x4acf('0xb1')](getBooleanList(_0x249d40,_0x2034e4,_0x35ddbc,_0x1dd32a[_0x4acf('0xa5')],_0x140713[_0x4acf('0xa5')],_0x4d7c9d));}}});return Promise['all'](_0x1e08cf);})['then'](function(_0x16ac70){_0x34ad58=_0x16ac70[0x0];var _0x1a7a89=[];var _0x37fc90=[];_0x5e33ce[_0x4acf('0xac')](function(_0x43f2d4){if(_0x43f2d4[_0x4acf('0xad')]){var _0x412b95=_0x43f2d4[_0x4acf('0xad')][_0x4acf('0x9b')](_0x43f2d4[_0x4acf('0xad')][_0x4acf('0x9c')]('.')+0x1);if(_0x412b95===_0x4acf('0xb2')||_0x412b95==='DoubleAttributeMetadata'||_0x412b95==='BigIntAttributeMetadata'||_0x412b95===_0x4acf('0xb3')||_0x412b95===_0x4acf('0xb4')||_0x412b95===_0x4acf('0xb5')||_0x412b95===_0x4acf('0xb6')||_0x412b95===_0x4acf('0xb7')||_0x412b95===_0x4acf('0xb8')||_0x412b95==='DecimalAttributeMetadata'){_0x1a7a89[_0x4acf('0xb1')](getInputList(_0x249d40,_0x2034e4,_0x412b95,_0x37fc90,_0x1dd32a[_0x4acf('0xa5')],_0x43f2d4[_0x4acf('0xa5')],_0x4d7c9d));}}});return Promise['all'](_0x1a7a89);})[_0x4acf('0x19')](function(_0x459bf1){_0x4f3cf1=_0x459bf1[0x0];var _0x40b518=_0x3adb06[_0x4acf('0x94')](_0x34ad58)[_0x4acf('0x94')](_0x4f3cf1);var _0x20cdb4={'count':_0x40b518[_0x4acf('0x3c')],'rows':_0x40b518};return _0x20cdb4;})[_0x4acf('0x19')](respondWithResult(_0xe57598,null))[_0x4acf('0x22')](function(_0x4eb713){var _0x371ab5=_0x22729c['query']['test']?0x1f4:_0x4eb713[_0x4acf('0xb9')]||0x1f4;logger[_0x4acf('0x1e')](_0x4eb713[_0x4acf('0x2e')]);delete _0x4eb713[_0x4acf('0x2f')];if(_0x371ab5===0x191){_0x371ab5=0x190;}_0xe57598[_0x4acf('0x23')](_0x371ab5)[_0x4acf('0xba')](_0x22729c[_0x4acf('0x37')][_0x4acf('0xbb')]?{'message':'Wrong\x20credentials','statusCode':_0x4eb713[_0x4acf('0xb9')]}:_0x4eb713);});};function getSelectList(_0x4458bb,_0x6ae77b,_0x27edd9,_0x2b7d90,_0x7c4c82,_0x499214){var _0x474653={'method':_0x4acf('0xa3'),'uri':_0x4458bb+_0x4acf('0xa6')+_0x2b7d90+_0x4acf('0xbc')+_0x7c4c82+_0x4acf('0xbd')+_0x4acf('0xbe'),'headers':{'Authorization':_0x4acf('0xa8')+_0x499214,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x474653)[_0x4acf('0x19')](function(_0x38ef48){var _0x49848a=[];var _0x38b796=_0x38ef48[_0x4acf('0xbf')][_0x4acf('0xc0')];_0x38b796[_0x4acf('0xac')](function(_0x547039){_0x49848a[_0x4acf('0xb1')]({'name':_0x547039[_0x4acf('0xc1')][_0x4acf('0xc2')][_0x4acf('0xc1')],'value':String(_0x547039[_0x4acf('0xc3')])});});var _0x22613d={'id':_0x6ae77b+'_'+_0x38ef48[_0x4acf('0xab')],'name':_0x38ef48[_0x4acf('0xc4')][_0x4acf('0xc2')][_0x4acf('0xc1')],'custom':![],'options':_0x49848a};_0x27edd9[_0x4acf('0xb1')](_0x22613d);return _0x27edd9;});}function getBooleanList(_0xc0c770,_0x279cc0,_0x229f40,_0x25ce78,_0xc8436,_0x4ad66d){var _0x1ebdd6={'method':_0x4acf('0xa3'),'uri':_0xc0c770+_0x4acf('0xa6')+_0x25ce78+_0x4acf('0xbc')+_0xc8436+_0x4acf('0xc5'),'headers':{'Authorization':_0x4acf('0xa8')+_0x4ad66d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ebdd6)[_0x4acf('0x19')](function(_0x5e1be6){var _0x5ea884=[];_0x5ea884[_0x4acf('0xb1')]({'name':_0x5e1be6[_0x4acf('0xbf')][_0x4acf('0xc6')][_0x4acf('0xc1')][_0x4acf('0xc2')][_0x4acf('0xc1')],'value':_0x4acf('0xc7')},{'name':_0x5e1be6[_0x4acf('0xbf')][_0x4acf('0xc8')]['Label'][_0x4acf('0xc2')][_0x4acf('0xc1')],'value':_0x4acf('0xc9')});var _0x2aea00={'id':_0x279cc0+'_'+_0x5e1be6[_0x4acf('0xab')],'name':_0x5e1be6[_0x4acf('0xc4')][_0x4acf('0xc2')][_0x4acf('0xc1')],'custom':![],'options':_0x5ea884};_0x229f40[_0x4acf('0xb1')](_0x2aea00);return _0x229f40;});}function getInputList(_0x18c345,_0x35a108,_0x57cbf1,_0xbb57af,_0x29249d,_0x4fc33a,_0x2e2933){var _0xe2dfac={'method':_0x4acf('0xa3'),'uri':_0x18c345+_0x4acf('0xa6')+_0x29249d+_0x4acf('0xbc')+_0x4fc33a+_0x4acf('0xca')+_0x57cbf1+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x4acf('0xa8')+_0x2e2933,'If-None-Match':null,'OData-Version':_0x4acf('0xa4')},'json':!![]};return rp(_0xe2dfac)['then'](function(_0x4c7835){var _0x26d915={'id':_0x35a108+'_'+_0x4c7835[_0x4acf('0xab')],'name':_0x4c7835['DisplayName'][_0x4acf('0xc2')]?_0x4c7835['DisplayName'][_0x4acf('0xc2')][_0x4acf('0xc1')]:_0x4c7835[_0x4acf('0xab')],'custom':![],'options':[]};_0xbb57af[_0x4acf('0xb1')](_0x26d915);return _0xbb57af;});} \ No newline at end of file +var _0x5496=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Dynamics365Field','Descriptions','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','concat','send','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Dynamics365Account,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x489404,_0x3c8325){var _0x5d7d76=function(_0x60b3e9){while(--_0x60b3e9){_0x489404['push'](_0x489404['shift']());}};_0x5d7d76(++_0x3c8325);}(_0x5496,0x175));var _0x6549=function(_0x5548a1,_0x308628){_0x5548a1=_0x5548a1-0x0;var _0x227237=_0x5496[_0x5548a1];return _0x227237;};'use strict';var pdf=require(_0x6549('0x0'));var emlformat=require(_0x6549('0x1'));var rimraf=require(_0x6549('0x2'));var zipdir=require(_0x6549('0x3'));var jsonpatch=require(_0x6549('0x4'));var rp=require('request-promise');var moment=require(_0x6549('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6549('0x6'));var util=require(_0x6549('0x7'));var path=require(_0x6549('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6549('0x9'));var fs=require('fs');var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x6549('0x19')][_0x6549('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x57a149,_0x200ff1,_0x150fc8,_0x195d25){return new BPromise(function(_0x12b068,_0xc0e859){var _0x86ae9d=_0x195d25||client;return _0x86ae9d['request'](_0x57a149,_0x150fc8)['then'](function(_0x384f75){logger[_0x6549('0x1b')]('Dynamics365Account,\x20%s,\x20%s',_0x200ff1,_0x6549('0x1c'));logger[_0x6549('0x1d')](_0x6549('0x1e'),_0x200ff1,_0x6549('0x1c'),JSON[_0x6549('0x1f')](_0x384f75));if(_0x384f75['error']){if(_0x384f75['error'][_0x6549('0x20')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x200ff1,_0x384f75[_0x6549('0x21')][_0x6549('0x22')]);return _0xc0e859(_0x384f75[_0x6549('0x21')][_0x6549('0x22')]);}logger[_0x6549('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x200ff1,_0x384f75[_0x6549('0x21')]['message']);return _0x12b068(_0x384f75[_0x6549('0x21')][_0x6549('0x22')]);}else{logger[_0x6549('0x1b')](_0x6549('0x23'),_0x200ff1,_0x6549('0x1c'));_0x12b068(_0x384f75[_0x6549('0x24')][_0x6549('0x22')]);}})[_0x6549('0x25')](function(_0x2be467){logger[_0x6549('0x21')](_0x6549('0x23'),_0x200ff1,_0x2be467);_0xc0e859(_0x2be467);});});}function respondWithStatusCode(_0x1fbfa4,_0x23c0ba){_0x23c0ba=_0x23c0ba||0xcc;return function(_0x5eeacd){if(_0x5eeacd){return _0x1fbfa4[_0x6549('0x26')](_0x23c0ba);}return _0x1fbfa4[_0x6549('0x27')](_0x23c0ba)['end']();};}function respondWithResult(_0x126967,_0x29f89e){_0x29f89e=_0x29f89e||0xc8;return function(_0x3768cb){if(_0x3768cb){return _0x126967['status'](_0x29f89e)[_0x6549('0x28')](_0x3768cb);}};}function respondWithFilteredResult(_0xfb51a1,_0x14de1f){return function(_0x2900cd){if(_0x2900cd){var _0x442862=_0x2900cd['count'],_0x3edf02=_0x14de1f[_0x6549('0x29')],_0x2f58f7=_0x14de1f[_0x6549('0x29')]+_0x14de1f[_0x6549('0x2a')],_0xa6c718;if(_0x2f58f7>=_0x442862){_0x2f58f7=_0x442862;_0xa6c718=0xc8;}else{_0xa6c718=0xce;}_0xfb51a1['status'](_0xa6c718);return _0xfb51a1[_0x6549('0x2b')]('Content-Range',_0x3edf02+'-'+_0x2f58f7+'/'+_0x442862)['json'](_0x2900cd);}return null;};}function patchUpdates(_0x5aa3a6){return function(_0x36454b){try{jsonpatch[_0x6549('0x2c')](_0x36454b,_0x5aa3a6,!![]);}catch(_0x4f3069){return BPromise[_0x6549('0x2d')](_0x4f3069);}return _0x36454b[_0x6549('0x2e')]();};}function saveUpdates(_0x2e481f,_0x102a21){return function(_0x2aec2c){if(_0x2aec2c){return _0x2aec2c[_0x6549('0x2f')](_0x2e481f)[_0x6549('0x30')](function(_0x504c42){return _0x504c42;});}return null;};}function removeEntity(_0x1b453c,_0x3ebea6){return function(_0x2d52fe){if(_0x2d52fe){return _0x2d52fe[_0x6549('0x31')]()[_0x6549('0x30')](function(){_0x1b453c[_0x6549('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b9840,_0x5bb783){return function(_0x302694){if(!_0x302694){_0x6b9840['sendStatus'](0x194);}return _0x302694;};}function handleError(_0x3bc70f,_0x16a7ba){_0x16a7ba=_0x16a7ba||0x1f4;return function(_0x3d9e9e){logger['error'](_0x3d9e9e[_0x6549('0x32')]);if(_0x3d9e9e[_0x6549('0x33')]){delete _0x3d9e9e[_0x6549('0x33')];}_0x3bc70f[_0x6549('0x27')](_0x16a7ba)['send'](_0x3d9e9e);};}exports['index']=function(_0x4fb441,_0x9d88fa){var _0xccba54={},_0x4a1d09={},_0x43220f={'count':0x0,'rows':[]};var _0x35a3db=_[_0x6549('0x34')](db[_0x6549('0x35')][_0x6549('0x36')],function(_0x4d3050){return{'name':_0x4d3050['fieldName'],'type':_0x4d3050[_0x6549('0x37')][_0x6549('0x38')]};});_0x4a1d09[_0x6549('0x39')]=_[_0x6549('0x34')](_0x35a3db,_0x6549('0x33'));_0x4a1d09[_0x6549('0x3a')]=_[_0x6549('0x3b')](_0x4fb441[_0x6549('0x3a')]);_0x4a1d09[_0x6549('0x3c')]=_[_0x6549('0x3d')](_0x4a1d09['model'],_0x4a1d09[_0x6549('0x3a')]);_0xccba54[_0x6549('0x3e')]=_[_0x6549('0x3d')](_0x4a1d09[_0x6549('0x39')],qs[_0x6549('0x3f')](_0x4fb441['query']['fields']));_0xccba54['attributes']=_0xccba54[_0x6549('0x3e')][_0x6549('0x40')]?_0xccba54[_0x6549('0x3e')]:_0x4a1d09[_0x6549('0x39')];if(!_0x4fb441['query']['hasOwnProperty'](_0x6549('0x41'))){_0xccba54[_0x6549('0x2a')]=qs[_0x6549('0x2a')](_0x4fb441['query'][_0x6549('0x2a')]);_0xccba54['offset']=qs[_0x6549('0x29')](_0x4fb441[_0x6549('0x3a')][_0x6549('0x29')]);}_0xccba54[_0x6549('0x42')]=qs[_0x6549('0x43')](_0x4fb441[_0x6549('0x3a')][_0x6549('0x43')]);_0xccba54['where']=qs[_0x6549('0x3c')](_[_0x6549('0x44')](_0x4fb441[_0x6549('0x3a')],_0x4a1d09[_0x6549('0x3c')]),_0x35a3db);if(_0x4fb441[_0x6549('0x3a')][_0x6549('0x45')]){_0xccba54[_0x6549('0x46')]=_[_0x6549('0x47')](_0xccba54[_0x6549('0x46')],{'$or':_[_0x6549('0x34')](_0x35a3db,function(_0x2b7b6a){if(_0x2b7b6a[_0x6549('0x37')]!==_0x6549('0x48')){var _0x283cfe={};_0x283cfe[_0x2b7b6a[_0x6549('0x33')]]={'$like':'%'+_0x4fb441[_0x6549('0x3a')]['filter']+'%'};return _0x283cfe;}})});}_0xccba54=_[_0x6549('0x47')]({},_0xccba54,_0x4fb441[_0x6549('0x49')]);var _0x5b1789={'where':_0xccba54[_0x6549('0x46')]};return db['Dynamics365Account'][_0x6549('0x4a')](_0x5b1789)['then'](function(_0x14c90a){_0x43220f[_0x6549('0x4a')]=_0x14c90a;if(_0x4fb441['query'][_0x6549('0x4b')]){_0xccba54[_0x6549('0x4c')]=[{'all':!![]}];}return db[_0x6549('0x35')][_0x6549('0x4d')](_0xccba54);})[_0x6549('0x30')](function(_0x595679){_0x43220f['rows']=_0x595679;return _0x43220f;})[_0x6549('0x30')](respondWithFilteredResult(_0x9d88fa,_0xccba54))[_0x6549('0x25')](handleError(_0x9d88fa,null));};exports[_0x6549('0x4e')]=function(_0x1712f3,_0x1e562b){var _0x49a4d7={'raw':![],'where':{'id':_0x1712f3[_0x6549('0x4f')]['id']}},_0x22370d={};_0x22370d[_0x6549('0x39')]=_[_0x6549('0x3b')](db[_0x6549('0x35')][_0x6549('0x36')]);_0x22370d[_0x6549('0x3a')]=_[_0x6549('0x3b')](_0x1712f3['query']);_0x22370d[_0x6549('0x3c')]=_['intersection'](_0x22370d[_0x6549('0x39')],_0x22370d[_0x6549('0x3a')]);_0x49a4d7[_0x6549('0x3e')]=_['intersection'](_0x22370d[_0x6549('0x39')],qs[_0x6549('0x3f')](_0x1712f3[_0x6549('0x3a')]['fields']));_0x49a4d7[_0x6549('0x3e')]=_0x49a4d7[_0x6549('0x3e')][_0x6549('0x40')]?_0x49a4d7[_0x6549('0x3e')]:_0x22370d[_0x6549('0x39')];if(_0x1712f3[_0x6549('0x3a')]['includeAll']){_0x49a4d7[_0x6549('0x4c')]=[{'all':!![]}];}_0x49a4d7=_['merge']({},_0x49a4d7,_0x1712f3[_0x6549('0x49')]);return db[_0x6549('0x35')][_0x6549('0x50')](_0x49a4d7)[_0x6549('0x30')](handleEntityNotFound(_0x1e562b,null))[_0x6549('0x30')](respondWithResult(_0x1e562b,null))[_0x6549('0x25')](handleError(_0x1e562b,null));};exports[_0x6549('0x51')]=function(_0x2e59ad,_0x1ff699){return db[_0x6549('0x35')][_0x6549('0x51')](_0x2e59ad[_0x6549('0x52')],{})['then'](respondWithResult(_0x1ff699,0xc9))[_0x6549('0x25')](handleError(_0x1ff699,null));};exports[_0x6549('0x2f')]=function(_0x325c0a,_0x1eaa0f){if(_0x325c0a[_0x6549('0x52')]['id']){delete _0x325c0a[_0x6549('0x52')]['id'];}return db[_0x6549('0x35')][_0x6549('0x50')]({'where':{'id':_0x325c0a['params']['id']}})[_0x6549('0x30')](handleEntityNotFound(_0x1eaa0f,null))[_0x6549('0x30')](saveUpdates(_0x325c0a[_0x6549('0x52')],null))[_0x6549('0x30')](respondWithResult(_0x1eaa0f,null))[_0x6549('0x25')](handleError(_0x1eaa0f,null));};exports[_0x6549('0x31')]=function(_0x2eb30c,_0x1898eb){return db['Dynamics365Account'][_0x6549('0x50')]({'where':{'id':_0x2eb30c[_0x6549('0x4f')]['id']}})[_0x6549('0x30')](handleEntityNotFound(_0x1898eb,null))[_0x6549('0x30')](removeEntity(_0x1898eb,null))[_0x6549('0x25')](handleError(_0x1898eb,null));};exports[_0x6549('0x53')]=function(_0x570c81,_0x2ca517,_0xe0a696){var _0x4bf996={};var _0x38bce4={};var _0x36a162;var _0x2efad1;return db['Dynamics365Account'][_0x6549('0x54')]({'where':{'id':_0x570c81[_0x6549('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2ca517,null))[_0x6549('0x30')](function(_0x509f69){if(_0x509f69){_0x36a162=_0x509f69;_0x38bce4[_0x6549('0x39')]=_['keys'](db[_0x6549('0x55')][_0x6549('0x36')]);_0x38bce4[_0x6549('0x3a')]=_[_0x6549('0x3b')](_0x570c81[_0x6549('0x3a')]);_0x38bce4[_0x6549('0x3c')]=_[_0x6549('0x3d')](_0x38bce4[_0x6549('0x39')],_0x38bce4[_0x6549('0x3a')]);_0x4bf996[_0x6549('0x3e')]=_[_0x6549('0x3d')](_0x38bce4[_0x6549('0x39')],qs[_0x6549('0x3f')](_0x570c81[_0x6549('0x3a')]['fields']));_0x4bf996[_0x6549('0x3e')]=_0x4bf996[_0x6549('0x3e')]['length']?_0x4bf996[_0x6549('0x3e')]:_0x38bce4[_0x6549('0x39')];_0x4bf996[_0x6549('0x42')]=qs[_0x6549('0x43')](_0x570c81['query'][_0x6549('0x43')]);_0x4bf996[_0x6549('0x46')]=qs[_0x6549('0x3c')](_[_0x6549('0x44')](_0x570c81['query'],_0x38bce4[_0x6549('0x3c')]));if(_0x570c81['query'][_0x6549('0x45')]){_0x4bf996[_0x6549('0x46')]=_[_0x6549('0x47')](_0x4bf996[_0x6549('0x46')],{'$or':_[_0x6549('0x34')](_0x4bf996[_0x6549('0x3e')],function(_0x426c09){var _0x131e58={};_0x131e58[_0x426c09]={'$like':'%'+_0x570c81[_0x6549('0x3a')][_0x6549('0x45')]+'%'};return _0x131e58;})});}_0x4bf996=_['merge']({},_0x4bf996,_0x570c81[_0x6549('0x49')]);return _0x36a162[_0x6549('0x53')](_0x4bf996);}})[_0x6549('0x30')](function(_0x2b4f16){if(_0x2b4f16){_0x2efad1=_0x2b4f16[_0x6549('0x40')];if(!_0x570c81[_0x6549('0x3a')]['hasOwnProperty']('nolimit')){_0x4bf996[_0x6549('0x2a')]=qs[_0x6549('0x2a')](_0x570c81[_0x6549('0x3a')]['limit']);_0x4bf996[_0x6549('0x29')]=qs[_0x6549('0x29')](_0x570c81['query'][_0x6549('0x29')]);}return _0x36a162[_0x6549('0x53')](_0x4bf996);}})[_0x6549('0x30')](function(_0x29604b){if(_0x29604b){return _0x29604b?{'count':_0x2efad1,'rows':_0x29604b}:null;}})[_0x6549('0x30')](respondWithResult(_0x2ca517,null))[_0x6549('0x25')](handleError(_0x2ca517,null));};exports[_0x6549('0x56')]=function(_0x402c26,_0x503935,_0x43c667){if(_0x402c26['body']['id']){delete _0x402c26[_0x6549('0x52')]['id'];}return db[_0x6549('0x35')]['findOne']({'where':{'id':_0x402c26[_0x6549('0x4f')]['id']}})[_0x6549('0x30')](handleEntityNotFound(_0x503935,null))[_0x6549('0x30')](function(_0x5f3873){if(_0x5f3873){_0x402c26[_0x6549('0x52')][_0x6549('0x57')]=_0x5f3873['id'];_0x402c26[_0x6549('0x52')][_0x6549('0x58')]=integrations[_0x6549('0x59')](_0x402c26[_0x6549('0x52')]['channel'],_0x402c26[_0x6549('0x52')][_0x6549('0x37')]);_0x402c26[_0x6549('0x52')]['Descriptions']=integrations['getDescriptions'](_0x402c26['body'][_0x6549('0x5a')],_0x402c26[_0x6549('0x52')][_0x6549('0x37')]);return db['Dynamics365Configuration']['create'](_0x402c26[_0x6549('0x52')],{'include':[{'model':db['Dynamics365Field'],'as':_0x6549('0x58')},{'model':db[_0x6549('0x5b')],'as':_0x6549('0x5c')}]});}return null;})[_0x6549('0x30')](respondWithResult(_0x503935,null))[_0x6549('0x25')](handleError(_0x503935,null));};exports[_0x6549('0x5d')]=function(_0x33c6ab,_0x5dcc26,_0x2f8c3a){var _0x38b330=_0x33c6ab[_0x6549('0x3a')]['ticketType'];var _0x22f06e=_0x38b330===_0x6549('0x5e')?_0x6549('0x5f'):_0x6549('0x60');var _0x3e8252='';var _0xf6b6da='';var _0x17258b='';var _0x47b135='';var _0x10eff1='';var _0x53483c='';var _0x328ff5='';var _0x476b0d='';var _0x20a273=[_0x6549('0x61'),_0x6549('0x62'),_0x6549('0x63'),_0x6549('0x64'),_0x6549('0x65'),'subject',_0x6549('0x66'),_0x6549('0x67'),_0x6549('0x68'),_0x6549('0x69')];var _0x1fa3a4=[_0x6549('0x6a'),_0x6549('0x6b'),_0x6549('0x6c'),_0x6549('0x6d'),_0x6549('0x6e'),'contactidyominame',_0x6549('0x6f'),_0x6549('0x70'),_0x6549('0x71'),_0x6549('0x72'),_0x6549('0x73'),_0x6549('0x74'),_0x6549('0x75'),_0x6549('0x76'),_0x6549('0x77'),_0x6549('0x78'),_0x6549('0x79'),_0x6549('0x7a'),_0x6549('0x7b'),_0x6549('0x7c'),_0x6549('0x7d'),_0x6549('0x7e'),_0x6549('0x7f'),_0x6549('0x80'),'firstresponsebykpiidname',_0x6549('0x81'),_0x6549('0x82'),_0x6549('0x83'),_0x6549('0x84'),_0x6549('0x85'),_0x6549('0x86'),_0x6549('0x87'),_0x6549('0x88'),_0x6549('0x89'),_0x6549('0x8a'),_0x6549('0x8b'),_0x6549('0x8c'),_0x6549('0x8d'),_0x6549('0x8e'),_0x6549('0x8f'),_0x6549('0x90'),_0x6549('0x91'),'overriddencreatedon',_0x6549('0x92'),_0x6549('0x93'),_0x6549('0x94'),_0x6549('0x95'),_0x6549('0x96'),_0x6549('0x97'),_0x6549('0x98'),'productidname',_0x6549('0x99'),'resolveby','resolvebykpiidname',_0x6549('0x9a'),'responsiblecontactidname',_0x6549('0x9b'),_0x6549('0x9c'),_0x6549('0x9d'),_0x6549('0x9e'),_0x6549('0x9f'),'statecode',_0x6549('0xa0'),'subjectidname',_0x6549('0xa1'),_0x6549('0xa2'),_0x6549('0xa3'),'traversedpath',_0x6549('0xa4'),_0x6549('0xa5')];var _0x5976ca=_0x20a273['concat'](_0x1fa3a4);return db[_0x6549('0x35')][_0x6549('0x54')]({'where':{'id':_0x33c6ab[_0x6549('0x4f')]['id']},'attributes':['id',_0x6549('0xa6'),_0x6549('0xa7'),_0x6549('0xa8'),_0x6549('0xa9'),_0x6549('0xaa'),_0x6549('0xab')]})[_0x6549('0x30')](handleEntityNotFound(_0x5dcc26,null))[_0x6549('0x30')](function(_0x24fbe8){if(_0x24fbe8){_0x476b0d=_0x24fbe8[_0x6549('0xa8')];var _0x4746bb=_0x476b0d[_0x6549('0xac')](-0x1);if(_0x4746bb==='/'){_0x476b0d=_0x476b0d[_0x6549('0xad')](0x0,_0x476b0d[_0x6549('0xae')](_0x4746bb));}_0x328ff5=util[_0x6549('0xaf')](_0x6549('0xb0'),_0x476b0d);var _0x5285ea={'method':'POST','uri':_0x6549('0xb1')+_0x24fbe8[_0x6549('0xa9')]+_0x6549('0xb2'),'form':{'client_id':_0x24fbe8[_0x6549('0xaa')],'resource':_0x476b0d,'username':_0x24fbe8[_0x6549('0xa6')],'password':_0x24fbe8[_0x6549('0xa7')],'grant_type':_0x6549('0xa7'),'client_secret':_0x24fbe8[_0x6549('0xab')]},'json':!![]};return rp(_0x5285ea);}})[_0x6549('0x30')](function(_0x263803){_0x53483c=_0x263803['access_token'];var _0x582217={'method':'GET','uri':encodeURI(_0x328ff5+_0x6549('0xb3')+_0x22f06e+'\x27'),'headers':{'Authorization':_0x6549('0xb4')+_0x53483c,'If-None-Match':null,'OData-Version':_0x6549('0xb5')},'json':!![]};return rp(_0x582217);})[_0x6549('0x30')](function(_0x7a1c77){var _0x570f56=_0x7a1c77[_0x6549('0xb6')][0x0];var _0x295fe1=_0x570f56[_0x6549('0xb7')];var _0x12382d={'method':_0x6549('0xb8'),'uri':_0x328ff5+_0x6549('0xb9')+_0x295fe1+_0x6549('0xba'),'headers':{'Authorization':_0x6549('0xb4')+_0x53483c,'If-None-Match':null,'OData-Version':_0x6549('0xb5')},'json':!![]};return rp(_0x12382d);})[_0x6549('0x30')](function(_0x31e41a){_0x3e8252=_0x31e41a;_0xf6b6da=_0x3e8252['Attributes'];_0xf6b6da=_[_0x6549('0xbb')](_0xf6b6da,function(_0x43708a){return!_0x5976ca[_0x6549('0xbc')](_0x43708a[_0x6549('0xbd')]);});var _0x585cad=[];var _0x158c92=[];_0xf6b6da[_0x6549('0xbe')](function(_0x1dbcc4){if(_0x1dbcc4[_0x6549('0xbf')]){var _0x1d27b4=_0x1dbcc4[_0x6549('0xbf')][_0x6549('0xad')](_0x1dbcc4[_0x6549('0xbf')][_0x6549('0xae')]('.')+0x1);if(_0x1d27b4==='PicklistAttributeMetadata'){_0x585cad[_0x6549('0xc0')](getSelectList(_0x328ff5,_0x38b330,_0x158c92,_0x3e8252[_0x6549('0xb7')],_0x1dbcc4[_0x6549('0xb7')],_0x53483c));}}});return Promise[_0x6549('0xc1')](_0x585cad);})['then'](function(_0x5a86d1){_0x17258b=_0x5a86d1[0x0];var _0x50b47f=[];var _0x144ff9=[];_0xf6b6da['forEach'](function(_0x576915){if(!_[_0x6549('0xc2')](_0x576915['@odata.type'])){var _0x2f607a=_0x576915[_0x6549('0xbf')][_0x6549('0xad')](_0x576915[_0x6549('0xbf')]['lastIndexOf']('.')+0x1);if(_0x2f607a===_0x6549('0xc3')){_0x50b47f[_0x6549('0xc0')](getBooleanList(_0x328ff5,_0x38b330,_0x144ff9,_0x3e8252[_0x6549('0xb7')],_0x576915[_0x6549('0xb7')],_0x53483c));}}});return Promise[_0x6549('0xc1')](_0x50b47f);})[_0x6549('0x30')](function(_0x1e6407){_0x47b135=_0x1e6407[0x0];var _0x29b0a3=[];var _0x295222=[];_0xf6b6da['forEach'](function(_0x31676d){if(_0x31676d[_0x6549('0xbf')]){var _0xc354a7=_0x31676d[_0x6549('0xbf')]['substring'](_0x31676d['@odata.type'][_0x6549('0xae')]('.')+0x1);if(_0xc354a7===_0x6549('0xc4')||_0xc354a7===_0x6549('0xc5')||_0xc354a7==='BigIntAttributeMetadata'||_0xc354a7===_0x6549('0xc6')||_0xc354a7===_0x6549('0xc7')||_0xc354a7==='DateTimeAttributeMetadata'||_0xc354a7===_0x6549('0xc8')||_0xc354a7==='EntityNameAttributeMetadata'||_0xc354a7===_0x6549('0xc9')||_0xc354a7==='DecimalAttributeMetadata'){_0x29b0a3[_0x6549('0xc0')](getInputList(_0x328ff5,_0x38b330,_0xc354a7,_0x295222,_0x3e8252['MetadataId'],_0x31676d[_0x6549('0xb7')],_0x53483c));}}});return Promise['all'](_0x29b0a3);})[_0x6549('0x30')](function(_0x3ee610){_0x10eff1=_0x3ee610[0x0];var _0x4150f4=_0x17258b[_0x6549('0xca')](_0x47b135)[_0x6549('0xca')](_0x10eff1);var _0x4cf1dd={'count':_0x4150f4[_0x6549('0x40')],'rows':_0x4150f4};return _0x4cf1dd;})['then'](respondWithResult(_0x5dcc26,null))[_0x6549('0x25')](function(_0x3592dc){var _0x3cab5c=_0x33c6ab[_0x6549('0x3a')]['test']?0x1f4:_0x3592dc['statusCode']||0x1f4;logger['error'](_0x3592dc[_0x6549('0x32')]);delete _0x3592dc[_0x6549('0x33')];if(_0x3cab5c===0x191){_0x3cab5c=0x190;}_0x5dcc26['status'](_0x3cab5c)[_0x6549('0xcb')](_0x33c6ab[_0x6549('0x3a')]['test']?{'message':_0x6549('0xcc'),'statusCode':_0x3592dc[_0x6549('0xcd')]}:_0x3592dc);});};function getSelectList(_0x2cc709,_0x30dc57,_0x4f068d,_0x556394,_0x51fd41,_0x6ed426){var _0x2eaa28={'method':_0x6549('0xb8'),'uri':_0x2cc709+_0x6549('0xb9')+_0x556394+_0x6549('0xce')+_0x51fd41+_0x6549('0xcf')+_0x6549('0xd0'),'headers':{'Authorization':_0x6549('0xb4')+_0x6ed426,'If-None-Match':null,'OData-Version':_0x6549('0xb5')},'json':!![]};return rp(_0x2eaa28)['then'](function(_0x1055a2){var _0x2ef9ba=[];var _0x323d3f=_0x1055a2[_0x6549('0xd1')][_0x6549('0xd2')];_0x323d3f[_0x6549('0xbe')](function(_0x33cbbf){_0x2ef9ba[_0x6549('0xc0')]({'name':_0x33cbbf[_0x6549('0xd3')][_0x6549('0xd4')]['Label'],'value':String(_0x33cbbf[_0x6549('0xd5')])});});var _0x3c24a7={'id':_0x30dc57+'_'+_0x1055a2['LogicalName'],'name':_0x1055a2[_0x6549('0xd6')][_0x6549('0xd4')][_0x6549('0xd3')],'custom':![],'options':_0x2ef9ba};_0x4f068d[_0x6549('0xc0')](_0x3c24a7);return _0x4f068d;});}function getBooleanList(_0x2f7998,_0x356c8c,_0x5b1d36,_0x24e598,_0xe2903f,_0x2598b7){var _0x23e516={'method':_0x6549('0xb8'),'uri':_0x2f7998+_0x6549('0xb9')+_0x24e598+_0x6549('0xce')+_0xe2903f+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x2598b7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x23e516)['then'](function(_0x1b8ead){var _0x1bbb8e=[];_0x1bbb8e['push']({'name':_0x1b8ead[_0x6549('0xd1')]['TrueOption'][_0x6549('0xd3')][_0x6549('0xd4')][_0x6549('0xd3')],'value':_0x6549('0xd7')},{'name':_0x1b8ead[_0x6549('0xd1')]['FalseOption'][_0x6549('0xd3')][_0x6549('0xd4')]['Label'],'value':_0x6549('0xd8')});var _0x3817ac={'id':_0x356c8c+'_'+_0x1b8ead['LogicalName'],'name':_0x1b8ead[_0x6549('0xd6')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x1bbb8e};_0x5b1d36[_0x6549('0xc0')](_0x3817ac);return _0x5b1d36;});}function getInputList(_0x30ff73,_0x5cc1b3,_0x53c5e2,_0x4f28a4,_0x3e0e65,_0x186c43,_0xff0074){var _0x99d8f0={'method':_0x6549('0xb8'),'uri':_0x30ff73+_0x6549('0xb9')+_0x3e0e65+_0x6549('0xce')+_0x186c43+_0x6549('0xd9')+_0x53c5e2+_0x6549('0xda'),'headers':{'Authorization':'Bearer\x20'+_0xff0074,'If-None-Match':null,'OData-Version':_0x6549('0xb5')},'json':!![]};return rp(_0x99d8f0)[_0x6549('0x30')](function(_0x582fa6){var _0x280b4c={'id':_0x5cc1b3+'_'+_0x582fa6[_0x6549('0xbd')],'name':_0x582fa6[_0x6549('0xd6')]['UserLocalizedLabel']?_0x582fa6[_0x6549('0xd6')][_0x6549('0xd4')][_0x6549('0xd3')]:_0x582fa6[_0x6549('0xbd')],'custom':![],'options':[]};_0x4f28a4[_0x6549('0xc0')](_0x280b4c);return _0x4f28a4;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 0607ea9..fa96582 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 _0xc39d=['bluebird','request-promise','path','../../components/integrations/configuration','exports','define','Dynamics365Account','lodash','util','../../config/logger','api','moment'];(function(_0x3f3e61,_0x5425c2){var _0x3e3081=function(_0x4210d2){while(--_0x4210d2){_0x3f3e61['push'](_0x3f3e61['shift']());}};_0x3e3081(++_0x5425c2);}(_0xc39d,0xbb));var _0xdc39=function(_0x45b1d8,_0x28c14d){_0x45b1d8=_0x45b1d8-0x0;var _0x1d6111=_0xc39d[_0x45b1d8];return _0x1d6111;};'use strict';var _=require(_0xdc39('0x0'));var util=require(_0xdc39('0x1'));var logger=require(_0xdc39('0x2'))(_0xdc39('0x3'));var moment=require(_0xdc39('0x4'));var BPromise=require(_0xdc39('0x5'));var rp=require(_0xdc39('0x6'));var fs=require('fs');var path=require(_0xdc39('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xdc39('0x8'));module[_0xdc39('0x9')]=function(_0x4944af,_0x374f9b){return _0x4944af[_0xdc39('0xa')](_0xdc39('0xb'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2ec=['exports','define','Dynamics365Account','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x3d2429,_0x1fe070){var _0x251882=function(_0x3bddfc){while(--_0x3bddfc){_0x3d2429['push'](_0x3d2429['shift']());}};_0x251882(++_0x1fe070);}(_0xc2ec,0x177));var _0xcc2e=function(_0x7452a5,_0xbddb1f){_0x7452a5=_0x7452a5-0x0;var _0x12f5ac=_0xc2ec[_0x7452a5];return _0x12f5ac;};'use strict';var _=require(_0xcc2e('0x0'));var util=require('util');var logger=require(_0xcc2e('0x1'))(_0xcc2e('0x2'));var moment=require('moment');var BPromise=require(_0xcc2e('0x3'));var rp=require(_0xcc2e('0x4'));var fs=require('fs');var path=require(_0xcc2e('0x5'));var rimraf=require(_0xcc2e('0x6'));var config=require(_0xcc2e('0x7'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xcc2e('0x8'));module[_0xcc2e('0x9')]=function(_0x190696,_0xb51dce){return _0x190696[_0xcc2e('0xa')](_0xcc2e('0xb'),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 1b84ccf..b1447be 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 _0x4e83=['result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','map','include','model','find','raw','ShowDynamics365Account','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5c1d6a,_0xf50343){var _0xdf2420=function(_0x117685){while(--_0x117685){_0x5c1d6a['push'](_0x5c1d6a['shift']());}};_0xdf2420(++_0xf50343);}(_0x4e83,0x1ae));var _0x34e8=function(_0x52af0b,_0x580c97){_0x52af0b=_0x52af0b-0x0;var _0x40ed35=_0x4e83[_0x52af0b];return _0x40ed35;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require(_0x34e8('0x4'));var db=require(_0x34e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34e8('0x6'));var client=jayson[_0x34e8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30a3c4,_0x4567bd,_0x28677c){return new BPromise(function(_0x5b5ddc,_0x44d3bf){return client[_0x34e8('0x8')](_0x30a3c4,_0x28677c)[_0x34e8('0x9')](function(_0x5cb792){logger[_0x34e8('0xa')](_0x34e8('0xb'),_0x4567bd,_0x34e8('0xc'));logger[_0x34e8('0xd')](_0x34e8('0xe'),_0x4567bd,_0x34e8('0xc'),JSON[_0x34e8('0xf')](_0x5cb792));if(_0x5cb792[_0x34e8('0x10')]){if(_0x5cb792[_0x34e8('0x10')]['code']===0x1f4){logger[_0x34e8('0x10')](_0x34e8('0xb'),_0x4567bd,_0x5cb792['error'][_0x34e8('0x11')]);return _0x44d3bf(_0x5cb792[_0x34e8('0x10')][_0x34e8('0x11')]);}logger[_0x34e8('0x10')](_0x34e8('0xb'),_0x4567bd,_0x5cb792[_0x34e8('0x10')][_0x34e8('0x11')]);return _0x5b5ddc(_0x5cb792[_0x34e8('0x10')][_0x34e8('0x11')]);}else{logger['info'](_0x34e8('0xb'),_0x4567bd,_0x34e8('0xc'));_0x5b5ddc(_0x5cb792[_0x34e8('0x12')][_0x34e8('0x11')]);}})[_0x34e8('0x13')](function(_0x4a4d17){logger[_0x34e8('0x10')](_0x34e8('0xb'),_0x4567bd,_0x4a4d17);_0x44d3bf(_0x4a4d17);});});}exports[_0x34e8('0x14')]=function(_0x708dd4){var _0x381484=this;return new Promise(function(_0x11543c,_0x1f3d4d){return db[_0x34e8('0x15')][_0x34e8('0x16')]({'raw':_0x708dd4[_0x34e8('0x17')]?_0x708dd4[_0x34e8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x708dd4[_0x34e8('0x17')]?_0x708dd4[_0x34e8('0x17')][_0x34e8('0x18')]||null:null,'attributes':_0x708dd4[_0x34e8('0x17')]?_0x708dd4[_0x34e8('0x17')][_0x34e8('0x19')]||null:null,'limit':_0x708dd4[_0x34e8('0x17')]?_0x708dd4[_0x34e8('0x17')]['limit']||null:null,'include':_0x708dd4[_0x34e8('0x17')]?_0x708dd4[_0x34e8('0x17')]['include']?_[_0x34e8('0x1a')](_0x708dd4['options'][_0x34e8('0x1b')],function(_0x381d0e){return{'model':db[_0x381d0e[_0x34e8('0x1c')]],'as':_0x381d0e['as'],'attributes':_0x381d0e['attributes'],'include':_0x381d0e['include']?_[_0x34e8('0x1a')](_0x381d0e[_0x34e8('0x1b')],function(_0xb8c9f){return{'model':db[_0xb8c9f[_0x34e8('0x1c')]],'as':_0xb8c9f['as'],'attributes':_0xb8c9f[_0x34e8('0x19')],'include':_0xb8c9f[_0x34e8('0x1b')]?_[_0x34e8('0x1a')](_0xb8c9f['include'],function(_0x29be75){return{'model':db[_0x29be75[_0x34e8('0x1c')]],'as':_0x29be75['as'],'attributes':_0x29be75[_0x34e8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34e8('0x9')](function(_0xe77c9e){logger[_0x34e8('0xa')](_0x34e8('0x14'),_0x708dd4);logger[_0x34e8('0xd')](_0x34e8('0x14'),_0x708dd4,JSON[_0x34e8('0xf')](_0xe77c9e));_0x11543c(_0xe77c9e);})[_0x34e8('0x13')](function(_0x6f4428){logger[_0x34e8('0x10')](_0x34e8('0x14'),_0x6f4428[_0x34e8('0x11')],_0x708dd4);_0x1f3d4d(_0x381484[_0x34e8('0x10')](0x1f4,_0x6f4428[_0x34e8('0x11')]));});});};exports['ShowDynamics365Account']=function(_0x3e7e42){var _0x1a3146=this;return new Promise(function(_0x5b951f,_0x461c32){return db[_0x34e8('0x15')][_0x34e8('0x1d')]({'raw':_0x3e7e42[_0x34e8('0x17')]?_0x3e7e42[_0x34e8('0x17')][_0x34e8('0x1e')]===undefined?!![]:![]:!![],'where':_0x3e7e42[_0x34e8('0x17')]?_0x3e7e42[_0x34e8('0x17')][_0x34e8('0x18')]||null:null,'attributes':_0x3e7e42[_0x34e8('0x17')]?_0x3e7e42[_0x34e8('0x17')][_0x34e8('0x19')]||null:null,'include':_0x3e7e42[_0x34e8('0x17')]?_0x3e7e42[_0x34e8('0x17')][_0x34e8('0x1b')]?_[_0x34e8('0x1a')](_0x3e7e42[_0x34e8('0x17')]['include'],function(_0x3b5395){return{'model':db[_0x3b5395[_0x34e8('0x1c')]],'as':_0x3b5395['as'],'attributes':_0x3b5395['attributes'],'include':_0x3b5395[_0x34e8('0x1b')]?_[_0x34e8('0x1a')](_0x3b5395[_0x34e8('0x1b')],function(_0xde0d37){return{'model':db[_0xde0d37[_0x34e8('0x1c')]],'as':_0xde0d37['as'],'attributes':_0xde0d37[_0x34e8('0x19')],'include':_0xde0d37[_0x34e8('0x1b')]?_['map'](_0xde0d37['include'],function(_0xe9071c){return{'model':db[_0xe9071c[_0x34e8('0x1c')]],'as':_0xe9071c['as'],'attributes':_0xe9071c[_0x34e8('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32f216){logger[_0x34e8('0xa')](_0x34e8('0x1f'),_0x3e7e42);logger[_0x34e8('0xd')](_0x34e8('0x1f'),_0x3e7e42,JSON[_0x34e8('0xf')](_0x32f216));_0x5b951f(_0x32f216);})[_0x34e8('0x13')](function(_0x2e4fce){logger['error'](_0x34e8('0x1f'),_0x2e4fce[_0x34e8('0x11')],_0x3e7e42);_0x461c32(_0x1a3146[_0x34e8('0x10')](0x1f4,_0x2e4fce['message']));});});}; \ No newline at end of file +var _0x9505=['message','result','catch','GetDynamics365Account','options','raw','where','limit','map','include','model','attributes','debug','stringify','ShowDynamics365Account','Dynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x30506e,_0x129be8){var _0x5d388c=function(_0x4c7802){while(--_0x4c7802){_0x30506e['push'](_0x30506e['shift']());}};_0x5d388c(++_0x129be8);}(_0x9505,0x1e5));var _0x5950=function(_0x5cc5b0,_0xe5177f){_0x5cc5b0=_0x5cc5b0-0x0;var _0x35c527=_0x9505[_0x5cc5b0];return _0x35c527;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var moment=require('moment');var BPromise=require(_0x5950('0x2'));var rs=require(_0x5950('0x3'));var fs=require('fs');var Redis=require(_0x5950('0x4'));var db=require(_0x5950('0x5'))['db'];var utils=require(_0x5950('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5950('0x7'));var jayson=require(_0x5950('0x8'));var client=jayson[_0x5950('0x9')][_0x5950('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aa518,_0x4b9478,_0x425d17){return new BPromise(function(_0x362f04,_0x3986aa){return client[_0x5950('0xb')](_0x4aa518,_0x425d17)[_0x5950('0xc')](function(_0x1df039){logger[_0x5950('0xd')](_0x5950('0xe'),_0x4b9478,_0x5950('0xf'));logger['debug'](_0x5950('0x10'),_0x4b9478,_0x5950('0xf'),JSON['stringify'](_0x1df039));if(_0x1df039['error']){if(_0x1df039[_0x5950('0x11')][_0x5950('0x12')]===0x1f4){logger[_0x5950('0x11')](_0x5950('0xe'),_0x4b9478,_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);return _0x3986aa(_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);}logger[_0x5950('0x11')](_0x5950('0xe'),_0x4b9478,_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);return _0x362f04(_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);}else{logger[_0x5950('0xd')](_0x5950('0xe'),_0x4b9478,_0x5950('0xf'));_0x362f04(_0x1df039[_0x5950('0x14')][_0x5950('0x13')]);}})[_0x5950('0x15')](function(_0xface83){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4b9478,_0xface83);_0x3986aa(_0xface83);});});}exports[_0x5950('0x16')]=function(_0x40f50c){var _0x3a7821=this;return new Promise(function(_0x5a9530,_0x3e0032){return db['Dynamics365Account']['findAll']({'raw':_0x40f50c[_0x5950('0x17')]?_0x40f50c[_0x5950('0x17')][_0x5950('0x18')]===undefined?!![]:![]:!![],'where':_0x40f50c['options']?_0x40f50c[_0x5950('0x17')][_0x5950('0x19')]||null:null,'attributes':_0x40f50c['options']?_0x40f50c['options']['attributes']||null:null,'limit':_0x40f50c['options']?_0x40f50c[_0x5950('0x17')][_0x5950('0x1a')]||null:null,'include':_0x40f50c[_0x5950('0x17')]?_0x40f50c[_0x5950('0x17')]['include']?_[_0x5950('0x1b')](_0x40f50c[_0x5950('0x17')][_0x5950('0x1c')],function(_0x1bd0ad){return{'model':db[_0x1bd0ad[_0x5950('0x1d')]],'as':_0x1bd0ad['as'],'attributes':_0x1bd0ad[_0x5950('0x1e')],'include':_0x1bd0ad[_0x5950('0x1c')]?_['map'](_0x1bd0ad['include'],function(_0x1b2265){return{'model':db[_0x1b2265[_0x5950('0x1d')]],'as':_0x1b2265['as'],'attributes':_0x1b2265[_0x5950('0x1e')],'include':_0x1b2265[_0x5950('0x1c')]?_[_0x5950('0x1b')](_0x1b2265['include'],function(_0x4a7b22){return{'model':db[_0x4a7b22['model']],'as':_0x4a7b22['as'],'attributes':_0x4a7b22[_0x5950('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5950('0xc')](function(_0xfc543b){logger[_0x5950('0xd')](_0x5950('0x16'),_0x40f50c);logger[_0x5950('0x1f')](_0x5950('0x16'),_0x40f50c,JSON[_0x5950('0x20')](_0xfc543b));_0x5a9530(_0xfc543b);})[_0x5950('0x15')](function(_0x3a3cc0){logger[_0x5950('0x11')](_0x5950('0x16'),_0x3a3cc0[_0x5950('0x13')],_0x40f50c);_0x3e0032(_0x3a7821[_0x5950('0x11')](0x1f4,_0x3a3cc0[_0x5950('0x13')]));});});};exports[_0x5950('0x21')]=function(_0x10f4d4){var _0x18a8ca=this;return new Promise(function(_0x33aa23,_0x625135){return db[_0x5950('0x22')][_0x5950('0x23')]({'raw':_0x10f4d4[_0x5950('0x17')]?_0x10f4d4[_0x5950('0x17')][_0x5950('0x18')]===undefined?!![]:![]:!![],'where':_0x10f4d4[_0x5950('0x17')]?_0x10f4d4[_0x5950('0x17')][_0x5950('0x19')]||null:null,'attributes':_0x10f4d4['options']?_0x10f4d4[_0x5950('0x17')][_0x5950('0x1e')]||null:null,'include':_0x10f4d4[_0x5950('0x17')]?_0x10f4d4[_0x5950('0x17')][_0x5950('0x1c')]?_['map'](_0x10f4d4['options'][_0x5950('0x1c')],function(_0x3c44fa){return{'model':db[_0x3c44fa['model']],'as':_0x3c44fa['as'],'attributes':_0x3c44fa[_0x5950('0x1e')],'include':_0x3c44fa['include']?_[_0x5950('0x1b')](_0x3c44fa[_0x5950('0x1c')],function(_0x376d9f){return{'model':db[_0x376d9f['model']],'as':_0x376d9f['as'],'attributes':_0x376d9f[_0x5950('0x1e')],'include':_0x376d9f['include']?_[_0x5950('0x1b')](_0x376d9f[_0x5950('0x1c')],function(_0x858e48){return{'model':db[_0x858e48[_0x5950('0x1d')]],'as':_0x858e48['as'],'attributes':_0x858e48['attributes']};}):[]};}):[]};}):[]:[]})[_0x5950('0xc')](function(_0x2d8766){logger[_0x5950('0xd')]('ShowDynamics365Account',_0x10f4d4);logger[_0x5950('0x1f')](_0x5950('0x21'),_0x10f4d4,JSON['stringify'](_0x2d8766));_0x33aa23(_0x2d8766);})['catch'](function(_0x57c990){logger[_0x5950('0x11')](_0x5950('0x21'),_0x57c990[_0x5950('0x13')],_0x10f4d4);_0x625135(_0x18a8ca[_0x5950('0x11')](0x1f4,_0x57c990[_0x5950('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index d906ae0..6ad1ca7 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 _0xb445=['isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','create','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id'];(function(_0x2fe689,_0x5794e5){var _0x35ea44=function(_0x51b9d6){while(--_0x51b9d6){_0x2fe689['push'](_0x2fe689['shift']());}};_0x35ea44(++_0x5794e5);}(_0xb445,0x139));var _0x5b44=function(_0x5e91da,_0x13f1ea){_0x5e91da=_0x5e91da-0x0;var _0x584c38=_0xb445[_0x5e91da];return _0x584c38;};'use strict';var multer=require('multer');var util=require(_0x5b44('0x0'));var path=require(_0x5b44('0x1'));var timeout=require('connect-timeout');var express=require(_0x5b44('0x2'));var router=express[_0x5b44('0x3')]();var auth=require(_0x5b44('0x4'));var interaction=require(_0x5b44('0x5'));var config=require(_0x5b44('0x6'));var controller=require(_0x5b44('0x7'));router[_0x5b44('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5b44('0x8')](_0x5b44('0x9'),auth[_0x5b44('0xa')](),controller[_0x5b44('0xb')]);router[_0x5b44('0x8')](_0x5b44('0xc'),auth[_0x5b44('0xa')](),controller[_0x5b44('0xd')]);router[_0x5b44('0x8')](_0x5b44('0xe'),auth['isAuthenticated'](),controller[_0x5b44('0xf')]);router['get']('/:id/descriptions',auth[_0x5b44('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x5b44('0xa')](),controller[_0x5b44('0x10')]);router['put']('/:id',auth[_0x5b44('0xa')](),controller['update']);router[_0x5b44('0x11')](_0x5b44('0x9'),auth[_0x5b44('0xa')](),controller['destroy']);module[_0x5b44('0x12')]=router; \ No newline at end of file +var _0xc552=['put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create'];(function(_0x44cca6,_0x5e9271){var _0x175d04=function(_0x26d9e4){while(--_0x26d9e4){_0x44cca6['push'](_0x44cca6['shift']());}};_0x175d04(++_0x5e9271);}(_0xc552,0x15f));var _0x2c55=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0xc552[_0x2272b5];return _0x110156;};'use strict';var multer=require('multer');var util=require(_0x2c55('0x0'));var path=require(_0x2c55('0x1'));var timeout=require(_0x2c55('0x2'));var express=require(_0x2c55('0x3'));var router=express['Router']();var auth=require(_0x2c55('0x4'));var interaction=require(_0x2c55('0x5'));var config=require(_0x2c55('0x6'));var controller=require(_0x2c55('0x7'));router['get']('/',auth[_0x2c55('0x8')](),controller[_0x2c55('0x9')]);router[_0x2c55('0xa')]('/:id',auth[_0x2c55('0x8')](),controller['show']);router[_0x2c55('0xa')](_0x2c55('0xb'),auth[_0x2c55('0x8')](),controller[_0x2c55('0xc')]);router[_0x2c55('0xa')](_0x2c55('0xd'),auth[_0x2c55('0x8')](),controller['getSubjects']);router[_0x2c55('0xa')](_0x2c55('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x2c55('0xf')]('/',auth['isAuthenticated'](),controller[_0x2c55('0x10')]);router[_0x2c55('0x11')](_0x2c55('0x12'),auth[_0x2c55('0x8')](),controller[_0x2c55('0x13')]);router[_0x2c55('0x14')](_0x2c55('0x12'),auth[_0x2c55('0x8')](),controller[_0x2c55('0x15')]);module[_0x2c55('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 994ae9e..e401118 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 _0x8cfd=['ENUM','incident','sequelize','exports','STRING'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x8cfd,0x10b));var _0xd8cf=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0x8cfd[_0xc40b9f];return _0x535b9c;};'use strict';var Sequelize=require(_0xd8cf('0x0'));module[_0xd8cf('0x1')]={'name':{'type':Sequelize[_0xd8cf('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xd8cf('0x3')]('incident','phonecall'),'defaultValue':_0xd8cf('0x4')}}; \ No newline at end of file +var _0xb108=['sequelize','exports','STRING','ENUM','incident'];(function(_0x334966,_0x3c9e39){var _0x457e8d=function(_0x46acb1){while(--_0x46acb1){_0x334966['push'](_0x334966['shift']());}};_0x457e8d(++_0x3c9e39);}(_0xb108,0x9b));var _0x8b10=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb108[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x8b10('0x0'));module[_0x8b10('0x1')]={'name':{'type':Sequelize[_0x8b10('0x2')]},'description':{'type':Sequelize[_0x8b10('0x2')]},'ticketType':{'type':Sequelize[_0x8b10('0x3')](_0x8b10('0x4'),'phonecall'),'defaultValue':_0x8b10('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 84b08a1..935ad65 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 _0x3d3b=['Dynamics365Configuration','includeAll','include','findAll','rows','show','params','fields','length','find','create','body','getFields','findOne','order','getSubjects','Dynamics365Field','getDescriptions','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','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options'];(function(_0x4ef9fa,_0x1f801d){var _0x503a6a=function(_0x189ea1){while(--_0x189ea1){_0x4ef9fa['push'](_0x4ef9fa['shift']());}};_0x503a6a(++_0x1f801d);}(_0x3d3b,0x1f2));var _0xb3d3=function(_0x280438,_0x1a2b94){_0x280438=_0x280438-0x0;var _0x26c9d6=_0x3d3b[_0x280438];return _0x26c9d6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb3d3('0x0'));var rimraf=require(_0xb3d3('0x1'));var zipdir=require(_0xb3d3('0x2'));var jsonpatch=require(_0xb3d3('0x3'));var rp=require(_0xb3d3('0x4'));var moment=require('moment');var BPromise=require(_0xb3d3('0x5'));var Mustache=require(_0xb3d3('0x6'));var util=require(_0xb3d3('0x7'));var path=require(_0xb3d3('0x8'));var sox=require(_0xb3d3('0x9'));var csv=require(_0xb3d3('0xa'));var ejs=require(_0xb3d3('0xb'));var fs=require('fs');var _=require(_0xb3d3('0xc'));var squel=require(_0xb3d3('0xd'));var crypto=require(_0xb3d3('0xe'));var jsforce=require(_0xb3d3('0xf'));var deskjs=require(_0xb3d3('0x10'));var toCsv=require(_0xb3d3('0xa'));var querystring=require('querystring');var Papa=require(_0xb3d3('0x11'));var Redis=require(_0xb3d3('0x12'));var authService=require(_0xb3d3('0x13'));var qs=require(_0xb3d3('0x14'));var as=require(_0xb3d3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb3d3('0x16'));var utils=require(_0xb3d3('0x17'));var config=require(_0xb3d3('0x18'));var licenseUtil=require(_0xb3d3('0x19'));var db=require(_0xb3d3('0x1a'))['db'];var jayson=require(_0xb3d3('0x1b'));var client=jayson[_0xb3d3('0x1c')][_0xb3d3('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x54076b,_0x516b9f,_0xe1596d,_0x440473){return new BPromise(function(_0x334c54,_0xcd0e93){var _0x31714c=_0x440473||client;return _0x31714c[_0xb3d3('0x1e')](_0x54076b,_0xe1596d)[_0xb3d3('0x1f')](function(_0x41d8c7){logger['info'](_0xb3d3('0x20'),_0x516b9f,_0xb3d3('0x21'));logger[_0xb3d3('0x22')](_0xb3d3('0x23'),_0x516b9f,_0xb3d3('0x21'),JSON['stringify'](_0x41d8c7));if(_0x41d8c7[_0xb3d3('0x24')]){if(_0x41d8c7[_0xb3d3('0x24')]['code']===0x1f4){logger[_0xb3d3('0x24')](_0xb3d3('0x20'),_0x516b9f,_0x41d8c7['error'][_0xb3d3('0x25')]);return _0xcd0e93(_0x41d8c7['error'][_0xb3d3('0x25')]);}logger['error'](_0xb3d3('0x20'),_0x516b9f,_0x41d8c7['error'][_0xb3d3('0x25')]);return _0x334c54(_0x41d8c7[_0xb3d3('0x24')][_0xb3d3('0x25')]);}else{logger[_0xb3d3('0x26')](_0xb3d3('0x20'),_0x516b9f,_0xb3d3('0x21'));_0x334c54(_0x41d8c7[_0xb3d3('0x27')]['message']);}})[_0xb3d3('0x28')](function(_0x8cf595){logger[_0xb3d3('0x24')](_0xb3d3('0x20'),_0x516b9f,_0x8cf595);_0xcd0e93(_0x8cf595);});});}function respondWithStatusCode(_0x4a9a93,_0x20add5){_0x20add5=_0x20add5||0xcc;return function(_0x5f1ff4){if(_0x5f1ff4){return _0x4a9a93[_0xb3d3('0x29')](_0x20add5);}return _0x4a9a93['status'](_0x20add5)['end']();};}function respondWithResult(_0x41d12c,_0x2248c9){_0x2248c9=_0x2248c9||0xc8;return function(_0x3aa21a){if(_0x3aa21a){return _0x41d12c[_0xb3d3('0x2a')](_0x2248c9)[_0xb3d3('0x2b')](_0x3aa21a);}};}function respondWithFilteredResult(_0x4545a7,_0x3a2d7b){return function(_0x148ff4){if(_0x148ff4){var _0x46bc57=_0x148ff4[_0xb3d3('0x2c')],_0x10327a=_0x3a2d7b[_0xb3d3('0x2d')],_0xf9d4de=_0x3a2d7b[_0xb3d3('0x2d')]+_0x3a2d7b[_0xb3d3('0x2e')],_0xb7855b;if(_0xf9d4de>=_0x46bc57){_0xf9d4de=_0x46bc57;_0xb7855b=0xc8;}else{_0xb7855b=0xce;}_0x4545a7[_0xb3d3('0x2a')](_0xb7855b);return _0x4545a7[_0xb3d3('0x2f')](_0xb3d3('0x30'),_0x10327a+'-'+_0xf9d4de+'/'+_0x46bc57)[_0xb3d3('0x2b')](_0x148ff4);}return null;};}function patchUpdates(_0x43e4a6){return function(_0x524846){try{jsonpatch[_0xb3d3('0x31')](_0x524846,_0x43e4a6,!![]);}catch(_0x4c221e){return BPromise[_0xb3d3('0x32')](_0x4c221e);}return _0x524846[_0xb3d3('0x33')]();};}function saveUpdates(_0x267f1a,_0xc950aa){return function(_0x262c8a){if(_0x262c8a){return _0x262c8a[_0xb3d3('0x34')](_0x267f1a)[_0xb3d3('0x1f')](function(_0x83b383){return _0x83b383;});}return null;};}function removeEntity(_0x105468,_0xe0ec6b){return function(_0x597f4e){if(_0x597f4e){return _0x597f4e[_0xb3d3('0x35')]()[_0xb3d3('0x1f')](function(){_0x105468[_0xb3d3('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fbaec,_0x172d3e){return function(_0x2751d0){if(!_0x2751d0){_0x3fbaec['sendStatus'](0x194);}return _0x2751d0;};}function handleError(_0x4244c8,_0x525636){_0x525636=_0x525636||0x1f4;return function(_0x27660c){logger[_0xb3d3('0x24')](_0x27660c[_0xb3d3('0x36')]);if(_0x27660c['name']){delete _0x27660c[_0xb3d3('0x37')];}_0x4244c8[_0xb3d3('0x2a')](_0x525636)[_0xb3d3('0x38')](_0x27660c);};}exports[_0xb3d3('0x39')]=function(_0x4eb60e,_0x13ee19){var _0x4d08e5={},_0x442410={},_0x5c916e={'count':0x0,'rows':[]};var _0x46b23b=_['map'](db['Dynamics365Configuration'][_0xb3d3('0x3a')],function(_0x22ec50){return{'name':_0x22ec50[_0xb3d3('0x3b')],'type':_0x22ec50[_0xb3d3('0x3c')][_0xb3d3('0x3d')]};});_0x442410[_0xb3d3('0x3e')]=_['map'](_0x46b23b,'name');_0x442410[_0xb3d3('0x3f')]=_[_0xb3d3('0x40')](_0x4eb60e['query']);_0x442410['filters']=_[_0xb3d3('0x41')](_0x442410['model'],_0x442410[_0xb3d3('0x3f')]);_0x4d08e5[_0xb3d3('0x42')]=_[_0xb3d3('0x41')](_0x442410['model'],qs['fields'](_0x4eb60e['query']['fields']));_0x4d08e5['attributes']=_0x4d08e5['attributes']['length']?_0x4d08e5['attributes']:_0x442410[_0xb3d3('0x3e')];if(!_0x4eb60e[_0xb3d3('0x3f')][_0xb3d3('0x43')](_0xb3d3('0x44'))){_0x4d08e5[_0xb3d3('0x2e')]=qs[_0xb3d3('0x2e')](_0x4eb60e['query']['limit']);_0x4d08e5['offset']=qs[_0xb3d3('0x2d')](_0x4eb60e[_0xb3d3('0x3f')][_0xb3d3('0x2d')]);}_0x4d08e5['order']=qs[_0xb3d3('0x45')](_0x4eb60e[_0xb3d3('0x3f')][_0xb3d3('0x45')]);_0x4d08e5[_0xb3d3('0x46')]=qs[_0xb3d3('0x47')](_[_0xb3d3('0x48')](_0x4eb60e['query'],_0x442410[_0xb3d3('0x47')]),_0x46b23b);if(_0x4eb60e['query'][_0xb3d3('0x49')]){_0x4d08e5[_0xb3d3('0x46')]=_[_0xb3d3('0x4a')](_0x4d08e5[_0xb3d3('0x46')],{'$or':_[_0xb3d3('0x4b')](_0x46b23b,function(_0xbf4df4){if(_0xbf4df4[_0xb3d3('0x3c')]!==_0xb3d3('0x4c')){var _0x4a15d2={};_0x4a15d2[_0xbf4df4['name']]={'$like':'%'+_0x4eb60e[_0xb3d3('0x3f')][_0xb3d3('0x49')]+'%'};return _0x4a15d2;}})});}_0x4d08e5=_[_0xb3d3('0x4a')]({},_0x4d08e5,_0x4eb60e[_0xb3d3('0x4d')]);var _0x413470={'where':_0x4d08e5[_0xb3d3('0x46')]};return db[_0xb3d3('0x4e')][_0xb3d3('0x2c')](_0x413470)[_0xb3d3('0x1f')](function(_0x19ee62){_0x5c916e[_0xb3d3('0x2c')]=_0x19ee62;if(_0x4eb60e[_0xb3d3('0x3f')][_0xb3d3('0x4f')]){_0x4d08e5[_0xb3d3('0x50')]=[{'all':!![]}];}return db[_0xb3d3('0x4e')][_0xb3d3('0x51')](_0x4d08e5);})[_0xb3d3('0x1f')](function(_0x46edea){_0x5c916e[_0xb3d3('0x52')]=_0x46edea;return _0x5c916e;})[_0xb3d3('0x1f')](respondWithFilteredResult(_0x13ee19,_0x4d08e5))['catch'](handleError(_0x13ee19,null));};exports[_0xb3d3('0x53')]=function(_0x1f2314,_0x524e3b){var _0x4a2c31={'raw':![],'where':{'id':_0x1f2314[_0xb3d3('0x54')]['id']}},_0x33bfec={};_0x33bfec[_0xb3d3('0x3e')]=_[_0xb3d3('0x40')](db[_0xb3d3('0x4e')]['rawAttributes']);_0x33bfec['query']=_[_0xb3d3('0x40')](_0x1f2314[_0xb3d3('0x3f')]);_0x33bfec[_0xb3d3('0x47')]=_[_0xb3d3('0x41')](_0x33bfec[_0xb3d3('0x3e')],_0x33bfec[_0xb3d3('0x3f')]);_0x4a2c31[_0xb3d3('0x42')]=_[_0xb3d3('0x41')](_0x33bfec[_0xb3d3('0x3e')],qs[_0xb3d3('0x55')](_0x1f2314[_0xb3d3('0x3f')][_0xb3d3('0x55')]));_0x4a2c31[_0xb3d3('0x42')]=_0x4a2c31[_0xb3d3('0x42')][_0xb3d3('0x56')]?_0x4a2c31[_0xb3d3('0x42')]:_0x33bfec[_0xb3d3('0x3e')];if(_0x1f2314[_0xb3d3('0x3f')][_0xb3d3('0x4f')]){_0x4a2c31[_0xb3d3('0x50')]=[{'all':!![]}];}_0x4a2c31=_[_0xb3d3('0x4a')]({},_0x4a2c31,_0x1f2314[_0xb3d3('0x4d')]);return db[_0xb3d3('0x4e')][_0xb3d3('0x57')](_0x4a2c31)[_0xb3d3('0x1f')](handleEntityNotFound(_0x524e3b,null))[_0xb3d3('0x1f')](respondWithResult(_0x524e3b,null))[_0xb3d3('0x28')](handleError(_0x524e3b,null));};exports['create']=function(_0x3dd833,_0x3efc94){return db[_0xb3d3('0x4e')][_0xb3d3('0x58')](_0x3dd833[_0xb3d3('0x59')],{})[_0xb3d3('0x1f')](respondWithResult(_0x3efc94,0xc9))[_0xb3d3('0x28')](handleError(_0x3efc94,null));};exports[_0xb3d3('0x34')]=function(_0x4ed4d9,_0x42f1fc){if(_0x4ed4d9[_0xb3d3('0x59')]['id']){delete _0x4ed4d9[_0xb3d3('0x59')]['id'];}return db[_0xb3d3('0x4e')][_0xb3d3('0x57')]({'where':{'id':_0x4ed4d9[_0xb3d3('0x54')]['id']}})['then'](handleEntityNotFound(_0x42f1fc,null))[_0xb3d3('0x1f')](saveUpdates(_0x4ed4d9[_0xb3d3('0x59')],null))[_0xb3d3('0x1f')](respondWithResult(_0x42f1fc,null))[_0xb3d3('0x28')](handleError(_0x42f1fc,null));};exports['destroy']=function(_0xd9a1ad,_0x21cfb6){return db['Dynamics365Configuration'][_0xb3d3('0x57')]({'where':{'id':_0xd9a1ad[_0xb3d3('0x54')]['id']}})[_0xb3d3('0x1f')](handleEntityNotFound(_0x21cfb6,null))['then'](removeEntity(_0x21cfb6,null))[_0xb3d3('0x28')](handleError(_0x21cfb6,null));};exports[_0xb3d3('0x5a')]=function(_0x5278c3,_0x2c4a18,_0x2e20e2){var _0x91ca4a={};var _0x6d0a13={};var _0x5d068d;var _0x4af61d;return db[_0xb3d3('0x4e')][_0xb3d3('0x5b')]({'where':{'id':_0x5278c3[_0xb3d3('0x54')]['id']}})[_0xb3d3('0x1f')](handleEntityNotFound(_0x2c4a18,null))[_0xb3d3('0x1f')](function(_0x1ea530){if(_0x1ea530){_0x5d068d=_0x1ea530;_0x6d0a13[_0xb3d3('0x3e')]=_[_0xb3d3('0x40')](db['Dynamics365Field'][_0xb3d3('0x3a')]);_0x6d0a13[_0xb3d3('0x3f')]=_[_0xb3d3('0x40')](_0x5278c3[_0xb3d3('0x3f')]);_0x6d0a13[_0xb3d3('0x47')]=_[_0xb3d3('0x41')](_0x6d0a13[_0xb3d3('0x3e')],_0x6d0a13['query']);_0x91ca4a[_0xb3d3('0x42')]=_['intersection'](_0x6d0a13['model'],qs['fields'](_0x5278c3[_0xb3d3('0x3f')]['fields']));_0x91ca4a[_0xb3d3('0x42')]=_0x91ca4a[_0xb3d3('0x42')][_0xb3d3('0x56')]?_0x91ca4a[_0xb3d3('0x42')]:_0x6d0a13[_0xb3d3('0x3e')];_0x91ca4a[_0xb3d3('0x5c')]=qs['sort'](_0x5278c3[_0xb3d3('0x3f')][_0xb3d3('0x45')]);_0x91ca4a['where']=qs['filters'](_[_0xb3d3('0x48')](_0x5278c3['query'],_0x6d0a13[_0xb3d3('0x47')]));if(_0x5278c3['query']['filter']){_0x91ca4a['where']=_['merge'](_0x91ca4a['where'],{'$or':_[_0xb3d3('0x4b')](_0x91ca4a[_0xb3d3('0x42')],function(_0x4c14cd){var _0x43d006={};_0x43d006[_0x4c14cd]={'$like':'%'+_0x5278c3['query'][_0xb3d3('0x49')]+'%'};return _0x43d006;})});}_0x91ca4a=_['merge']({},_0x91ca4a,_0x5278c3['options']);return _0x5d068d['getFields'](_0x91ca4a);}})[_0xb3d3('0x1f')](function(_0xa7d513){if(_0xa7d513){_0x4af61d=_0xa7d513[_0xb3d3('0x56')];if(!_0x5278c3[_0xb3d3('0x3f')][_0xb3d3('0x43')](_0xb3d3('0x44'))){_0x91ca4a['limit']=qs['limit'](_0x5278c3[_0xb3d3('0x3f')][_0xb3d3('0x2e')]);_0x91ca4a[_0xb3d3('0x2d')]=qs[_0xb3d3('0x2d')](_0x5278c3[_0xb3d3('0x3f')][_0xb3d3('0x2d')]);}return _0x5d068d['getFields'](_0x91ca4a);}})[_0xb3d3('0x1f')](function(_0xcd11c8){if(_0xcd11c8){return _0xcd11c8?{'count':_0x4af61d,'rows':_0xcd11c8}:null;}})[_0xb3d3('0x1f')](respondWithResult(_0x2c4a18,null))[_0xb3d3('0x28')](handleError(_0x2c4a18,null));};exports[_0xb3d3('0x5d')]=function(_0xc8ec59,_0x15a361,_0x5c0965){var _0x5b86c9={};var _0x42d3e9={};var _0x14535d;var _0x3be26d;return db[_0xb3d3('0x4e')][_0xb3d3('0x5b')]({'where':{'id':_0xc8ec59[_0xb3d3('0x54')]['id']}})['then'](handleEntityNotFound(_0x15a361,null))['then'](function(_0x3ff04e){if(_0x3ff04e){_0x14535d=_0x3ff04e;_0x42d3e9[_0xb3d3('0x3e')]=_[_0xb3d3('0x40')](db[_0xb3d3('0x5e')][_0xb3d3('0x3a')]);_0x42d3e9[_0xb3d3('0x3f')]=_[_0xb3d3('0x40')](_0xc8ec59['query']);_0x42d3e9[_0xb3d3('0x47')]=_[_0xb3d3('0x41')](_0x42d3e9[_0xb3d3('0x3e')],_0x42d3e9[_0xb3d3('0x3f')]);_0x5b86c9['attributes']=_[_0xb3d3('0x41')](_0x42d3e9[_0xb3d3('0x3e')],qs[_0xb3d3('0x55')](_0xc8ec59[_0xb3d3('0x3f')][_0xb3d3('0x55')]));_0x5b86c9['attributes']=_0x5b86c9['attributes'][_0xb3d3('0x56')]?_0x5b86c9[_0xb3d3('0x42')]:_0x42d3e9[_0xb3d3('0x3e')];_0x5b86c9[_0xb3d3('0x5c')]=qs[_0xb3d3('0x45')](_0xc8ec59[_0xb3d3('0x3f')][_0xb3d3('0x45')]);_0x5b86c9[_0xb3d3('0x46')]=qs[_0xb3d3('0x47')](_[_0xb3d3('0x48')](_0xc8ec59[_0xb3d3('0x3f')],_0x42d3e9[_0xb3d3('0x47')]));if(_0xc8ec59[_0xb3d3('0x3f')]['filter']){_0x5b86c9[_0xb3d3('0x46')]=_[_0xb3d3('0x4a')](_0x5b86c9[_0xb3d3('0x46')],{'$or':_[_0xb3d3('0x4b')](_0x5b86c9[_0xb3d3('0x42')],function(_0x5207f9){var _0x57bfd9={};_0x57bfd9[_0x5207f9]={'$like':'%'+_0xc8ec59[_0xb3d3('0x3f')][_0xb3d3('0x49')]+'%'};return _0x57bfd9;})});}_0x5b86c9=_[_0xb3d3('0x4a')]({},_0x5b86c9,_0xc8ec59[_0xb3d3('0x4d')]);return _0x14535d['getSubjects'](_0x5b86c9);}})['then'](function(_0x189f06){if(_0x189f06){_0x3be26d=_0x189f06[_0xb3d3('0x56')];if(!_0xc8ec59['query'][_0xb3d3('0x43')](_0xb3d3('0x44'))){_0x5b86c9[_0xb3d3('0x2e')]=qs[_0xb3d3('0x2e')](_0xc8ec59[_0xb3d3('0x3f')][_0xb3d3('0x2e')]);_0x5b86c9[_0xb3d3('0x2d')]=qs[_0xb3d3('0x2d')](_0xc8ec59['query']['offset']);}return _0x14535d[_0xb3d3('0x5d')](_0x5b86c9);}})[_0xb3d3('0x1f')](function(_0x12a5ad){if(_0x12a5ad){return _0x12a5ad?{'count':_0x3be26d,'rows':_0x12a5ad}:null;}})['then'](respondWithResult(_0x15a361,null))[_0xb3d3('0x28')](handleError(_0x15a361,null));};exports[_0xb3d3('0x5f')]=function(_0x4e469a,_0x1e6454,_0x41ba9d){var _0x24e3c0={};var _0x44dc02={};var _0xf31f6;var _0x4d9a0d;return db[_0xb3d3('0x4e')][_0xb3d3('0x5b')]({'where':{'id':_0x4e469a['params']['id']}})[_0xb3d3('0x1f')](handleEntityNotFound(_0x1e6454,null))[_0xb3d3('0x1f')](function(_0x5250d5){if(_0x5250d5){_0xf31f6=_0x5250d5;_0x44dc02[_0xb3d3('0x3e')]=_[_0xb3d3('0x40')](db[_0xb3d3('0x5e')][_0xb3d3('0x3a')]);_0x44dc02[_0xb3d3('0x3f')]=_['keys'](_0x4e469a['query']);_0x44dc02[_0xb3d3('0x47')]=_[_0xb3d3('0x41')](_0x44dc02['model'],_0x44dc02['query']);_0x24e3c0['attributes']=_[_0xb3d3('0x41')](_0x44dc02[_0xb3d3('0x3e')],qs[_0xb3d3('0x55')](_0x4e469a[_0xb3d3('0x3f')][_0xb3d3('0x55')]));_0x24e3c0[_0xb3d3('0x42')]=_0x24e3c0[_0xb3d3('0x42')][_0xb3d3('0x56')]?_0x24e3c0[_0xb3d3('0x42')]:_0x44dc02['model'];_0x24e3c0[_0xb3d3('0x5c')]=qs[_0xb3d3('0x45')](_0x4e469a[_0xb3d3('0x3f')]['sort']);_0x24e3c0[_0xb3d3('0x46')]=qs[_0xb3d3('0x47')](_['pick'](_0x4e469a[_0xb3d3('0x3f')],_0x44dc02[_0xb3d3('0x47')]));if(_0x4e469a[_0xb3d3('0x3f')][_0xb3d3('0x49')]){_0x24e3c0[_0xb3d3('0x46')]=_['merge'](_0x24e3c0[_0xb3d3('0x46')],{'$or':_[_0xb3d3('0x4b')](_0x24e3c0['attributes'],function(_0x44f7fc){var _0x3c418f={};_0x3c418f[_0x44f7fc]={'$like':'%'+_0x4e469a[_0xb3d3('0x3f')]['filter']+'%'};return _0x3c418f;})});}_0x24e3c0=_[_0xb3d3('0x4a')]({},_0x24e3c0,_0x4e469a[_0xb3d3('0x4d')]);return _0xf31f6[_0xb3d3('0x5f')](_0x24e3c0);}})[_0xb3d3('0x1f')](function(_0x28b570){if(_0x28b570){_0x4d9a0d=_0x28b570[_0xb3d3('0x56')];if(!_0x4e469a[_0xb3d3('0x3f')][_0xb3d3('0x43')](_0xb3d3('0x44'))){_0x24e3c0[_0xb3d3('0x2e')]=qs[_0xb3d3('0x2e')](_0x4e469a[_0xb3d3('0x3f')][_0xb3d3('0x2e')]);_0x24e3c0[_0xb3d3('0x2d')]=qs[_0xb3d3('0x2d')](_0x4e469a['query'][_0xb3d3('0x2d')]);}return _0xf31f6[_0xb3d3('0x5f')](_0x24e3c0);}})[_0xb3d3('0x1f')](function(_0x4cd9a7){if(_0x4cd9a7){return _0x4cd9a7?{'count':_0x4d9a0d,'rows':_0x4cd9a7}:null;}})[_0xb3d3('0x1f')](respondWithResult(_0x1e6454,null))[_0xb3d3('0x28')](handleError(_0x1e6454,null));}; \ No newline at end of file +var _0x79cc=['stack','name','send','index','map','Dynamics365Configuration','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','params','keys','find','create','body','Dynamics365Field','filter','getFields','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','end','json','count','offset','limit','status','set','Content-Range','reject','save','update','then','sendStatus'];(function(_0xb67a8d,_0x5efcf6){var _0x333afb=function(_0x15772e){while(--_0x15772e){_0xb67a8d['push'](_0xb67a8d['shift']());}};_0x333afb(++_0x5efcf6);}(_0x79cc,0xd3));var _0xc79c=function(_0x4a6877,_0x64fb62){_0x4a6877=_0x4a6877-0x0;var _0x22d9a9=_0x79cc[_0x4a6877];return _0x22d9a9;};'use strict';var pdf=require(_0xc79c('0x0'));var emlformat=require(_0xc79c('0x1'));var rimraf=require(_0xc79c('0x2'));var zipdir=require(_0xc79c('0x3'));var jsonpatch=require(_0xc79c('0x4'));var rp=require(_0xc79c('0x5'));var moment=require(_0xc79c('0x6'));var BPromise=require(_0xc79c('0x7'));var Mustache=require(_0xc79c('0x8'));var util=require(_0xc79c('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xc79c('0xa'));var ejs=require(_0xc79c('0xb'));var fs=require('fs');var _=require(_0xc79c('0xc'));var squel=require(_0xc79c('0xd'));var crypto=require(_0xc79c('0xe'));var jsforce=require(_0xc79c('0xf'));var deskjs=require(_0xc79c('0x10'));var toCsv=require(_0xc79c('0xa'));var querystring=require(_0xc79c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc79c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc79c('0x13'));var logger=require(_0xc79c('0x14'))(_0xc79c('0x15'));var utils=require('../../config/utils');var config=require(_0xc79c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc79c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc79c('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20fb99,_0x47a20e,_0xe6bc26,_0x166fcc){return new BPromise(function(_0x350951,_0x3b9c54){var _0x2c429a=_0x166fcc||client;return _0x2c429a['request'](_0x20fb99,_0xe6bc26)['then'](function(_0x4b21b3){logger[_0xc79c('0x19')]('Dynamics365Configuration,\x20%s,\x20%s',_0x47a20e,'request\x20sent');logger[_0xc79c('0x1a')](_0xc79c('0x1b'),_0x47a20e,'request\x20sent',JSON[_0xc79c('0x1c')](_0x4b21b3));if(_0x4b21b3[_0xc79c('0x1d')]){if(_0x4b21b3[_0xc79c('0x1d')]['code']===0x1f4){logger[_0xc79c('0x1d')](_0xc79c('0x1e'),_0x47a20e,_0x4b21b3[_0xc79c('0x1d')][_0xc79c('0x1f')]);return _0x3b9c54(_0x4b21b3[_0xc79c('0x1d')][_0xc79c('0x1f')]);}logger[_0xc79c('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s',_0x47a20e,_0x4b21b3[_0xc79c('0x1d')][_0xc79c('0x1f')]);return _0x350951(_0x4b21b3[_0xc79c('0x1d')][_0xc79c('0x1f')]);}else{logger[_0xc79c('0x19')](_0xc79c('0x1e'),_0x47a20e,'request\x20sent');_0x350951(_0x4b21b3[_0xc79c('0x20')][_0xc79c('0x1f')]);}})[_0xc79c('0x21')](function(_0x5f1d2b){logger[_0xc79c('0x1d')](_0xc79c('0x1e'),_0x47a20e,_0x5f1d2b);_0x3b9c54(_0x5f1d2b);});});}function respondWithStatusCode(_0x1efbd1,_0xc5f898){_0xc5f898=_0xc5f898||0xcc;return function(_0x5a81b0){if(_0x5a81b0){return _0x1efbd1['sendStatus'](_0xc5f898);}return _0x1efbd1['status'](_0xc5f898)[_0xc79c('0x22')]();};}function respondWithResult(_0x250d67,_0x593dbd){_0x593dbd=_0x593dbd||0xc8;return function(_0x28eb25){if(_0x28eb25){return _0x250d67['status'](_0x593dbd)[_0xc79c('0x23')](_0x28eb25);}};}function respondWithFilteredResult(_0x1d3fb7,_0x16b480){return function(_0x18fef9){if(_0x18fef9){var _0x12ddf3=_0x18fef9[_0xc79c('0x24')],_0x49fe3f=_0x16b480[_0xc79c('0x25')],_0x10067b=_0x16b480[_0xc79c('0x25')]+_0x16b480[_0xc79c('0x26')],_0x1f88d2;if(_0x10067b>=_0x12ddf3){_0x10067b=_0x12ddf3;_0x1f88d2=0xc8;}else{_0x1f88d2=0xce;}_0x1d3fb7[_0xc79c('0x27')](_0x1f88d2);return _0x1d3fb7[_0xc79c('0x28')](_0xc79c('0x29'),_0x49fe3f+'-'+_0x10067b+'/'+_0x12ddf3)[_0xc79c('0x23')](_0x18fef9);}return null;};}function patchUpdates(_0x314267){return function(_0x348f8a){try{jsonpatch['apply'](_0x348f8a,_0x314267,!![]);}catch(_0x4f0c72){return BPromise[_0xc79c('0x2a')](_0x4f0c72);}return _0x348f8a[_0xc79c('0x2b')]();};}function saveUpdates(_0x49ffcb,_0x386359){return function(_0x1285ef){if(_0x1285ef){return _0x1285ef[_0xc79c('0x2c')](_0x49ffcb)[_0xc79c('0x2d')](function(_0x455817){return _0x455817;});}return null;};}function removeEntity(_0x225879,_0x22a97d){return function(_0x13da7){if(_0x13da7){return _0x13da7['destroy']()[_0xc79c('0x2d')](function(){_0x225879[_0xc79c('0x27')](0xcc)[_0xc79c('0x22')]();});}};}function handleEntityNotFound(_0x5433bc,_0x2d5754){return function(_0x3fad6d){if(!_0x3fad6d){_0x5433bc[_0xc79c('0x2e')](0x194);}return _0x3fad6d;};}function handleError(_0x347683,_0x196a74){_0x196a74=_0x196a74||0x1f4;return function(_0x43abf4){logger[_0xc79c('0x1d')](_0x43abf4[_0xc79c('0x2f')]);if(_0x43abf4[_0xc79c('0x30')]){delete _0x43abf4['name'];}_0x347683['status'](_0x196a74)[_0xc79c('0x31')](_0x43abf4);};}exports[_0xc79c('0x32')]=function(_0x2d4b50,_0xde54fa){var _0x149063={},_0xf1a618={},_0x29d73f={'count':0x0,'rows':[]};var _0x3d99d8=_[_0xc79c('0x33')](db[_0xc79c('0x34')][_0xc79c('0x35')],function(_0x317622){return{'name':_0x317622['fieldName'],'type':_0x317622['type'][_0xc79c('0x36')]};});_0xf1a618[_0xc79c('0x37')]=_[_0xc79c('0x33')](_0x3d99d8,_0xc79c('0x30'));_0xf1a618[_0xc79c('0x38')]=_['keys'](_0x2d4b50[_0xc79c('0x38')]);_0xf1a618[_0xc79c('0x39')]=_['intersection'](_0xf1a618['model'],_0xf1a618['query']);_0x149063[_0xc79c('0x3a')]=_[_0xc79c('0x3b')](_0xf1a618[_0xc79c('0x37')],qs[_0xc79c('0x3c')](_0x2d4b50[_0xc79c('0x38')][_0xc79c('0x3c')]));_0x149063[_0xc79c('0x3a')]=_0x149063[_0xc79c('0x3a')][_0xc79c('0x3d')]?_0x149063[_0xc79c('0x3a')]:_0xf1a618['model'];if(!_0x2d4b50[_0xc79c('0x38')][_0xc79c('0x3e')](_0xc79c('0x3f'))){_0x149063[_0xc79c('0x26')]=qs[_0xc79c('0x26')](_0x2d4b50['query'][_0xc79c('0x26')]);_0x149063[_0xc79c('0x25')]=qs['offset'](_0x2d4b50[_0xc79c('0x38')][_0xc79c('0x25')]);}_0x149063[_0xc79c('0x40')]=qs[_0xc79c('0x41')](_0x2d4b50['query'][_0xc79c('0x41')]);_0x149063[_0xc79c('0x42')]=qs[_0xc79c('0x39')](_[_0xc79c('0x43')](_0x2d4b50[_0xc79c('0x38')],_0xf1a618[_0xc79c('0x39')]),_0x3d99d8);if(_0x2d4b50[_0xc79c('0x38')]['filter']){_0x149063[_0xc79c('0x42')]=_['merge'](_0x149063['where'],{'$or':_[_0xc79c('0x33')](_0x3d99d8,function(_0xf4b314){if(_0xf4b314[_0xc79c('0x44')]!==_0xc79c('0x45')){var _0x275952={};_0x275952[_0xf4b314[_0xc79c('0x30')]]={'$like':'%'+_0x2d4b50[_0xc79c('0x38')]['filter']+'%'};return _0x275952;}})});}_0x149063=_[_0xc79c('0x46')]({},_0x149063,_0x2d4b50[_0xc79c('0x47')]);var _0x5b2654={'where':_0x149063[_0xc79c('0x42')]};return db[_0xc79c('0x34')][_0xc79c('0x24')](_0x5b2654)['then'](function(_0x40d1f1){_0x29d73f[_0xc79c('0x24')]=_0x40d1f1;if(_0x2d4b50[_0xc79c('0x38')][_0xc79c('0x48')]){_0x149063[_0xc79c('0x49')]=[{'all':!![]}];}return db[_0xc79c('0x34')][_0xc79c('0x4a')](_0x149063);})[_0xc79c('0x2d')](function(_0x554f7c){_0x29d73f['rows']=_0x554f7c;return _0x29d73f;})[_0xc79c('0x2d')](respondWithFilteredResult(_0xde54fa,_0x149063))[_0xc79c('0x21')](handleError(_0xde54fa,null));};exports['show']=function(_0xaf79ee,_0x52a315){var _0x16d06c={'raw':![],'where':{'id':_0xaf79ee[_0xc79c('0x4b')]['id']}},_0x4bf9f6={};_0x4bf9f6[_0xc79c('0x37')]=_[_0xc79c('0x4c')](db['Dynamics365Configuration'][_0xc79c('0x35')]);_0x4bf9f6['query']=_[_0xc79c('0x4c')](_0xaf79ee[_0xc79c('0x38')]);_0x4bf9f6[_0xc79c('0x39')]=_[_0xc79c('0x3b')](_0x4bf9f6[_0xc79c('0x37')],_0x4bf9f6[_0xc79c('0x38')]);_0x16d06c[_0xc79c('0x3a')]=_[_0xc79c('0x3b')](_0x4bf9f6[_0xc79c('0x37')],qs[_0xc79c('0x3c')](_0xaf79ee[_0xc79c('0x38')]['fields']));_0x16d06c[_0xc79c('0x3a')]=_0x16d06c[_0xc79c('0x3a')]['length']?_0x16d06c[_0xc79c('0x3a')]:_0x4bf9f6[_0xc79c('0x37')];if(_0xaf79ee[_0xc79c('0x38')][_0xc79c('0x48')]){_0x16d06c[_0xc79c('0x49')]=[{'all':!![]}];}_0x16d06c=_[_0xc79c('0x46')]({},_0x16d06c,_0xaf79ee[_0xc79c('0x47')]);return db[_0xc79c('0x34')][_0xc79c('0x4d')](_0x16d06c)[_0xc79c('0x2d')](handleEntityNotFound(_0x52a315,null))['then'](respondWithResult(_0x52a315,null))[_0xc79c('0x21')](handleError(_0x52a315,null));};exports[_0xc79c('0x4e')]=function(_0x20b943,_0x4c0157){return db['Dynamics365Configuration'][_0xc79c('0x4e')](_0x20b943['body'],{})['then'](respondWithResult(_0x4c0157,0xc9))[_0xc79c('0x21')](handleError(_0x4c0157,null));};exports[_0xc79c('0x2c')]=function(_0x5e3a76,_0x309119){if(_0x5e3a76[_0xc79c('0x4f')]['id']){delete _0x5e3a76['body']['id'];}return db[_0xc79c('0x34')]['find']({'where':{'id':_0x5e3a76[_0xc79c('0x4b')]['id']}})[_0xc79c('0x2d')](handleEntityNotFound(_0x309119,null))[_0xc79c('0x2d')](saveUpdates(_0x5e3a76[_0xc79c('0x4f')],null))[_0xc79c('0x2d')](respondWithResult(_0x309119,null))['catch'](handleError(_0x309119,null));};exports['destroy']=function(_0x72b313,_0x147335){return db[_0xc79c('0x34')][_0xc79c('0x4d')]({'where':{'id':_0x72b313[_0xc79c('0x4b')]['id']}})[_0xc79c('0x2d')](handleEntityNotFound(_0x147335,null))[_0xc79c('0x2d')](removeEntity(_0x147335,null))['catch'](handleError(_0x147335,null));};exports['getFields']=function(_0x3b528d,_0x3e184f,_0x45ebe1){var _0x2b5724={};var _0x3fdd8e={};var _0x46bca6;var _0x4dfc1a;return db[_0xc79c('0x34')]['findOne']({'where':{'id':_0x3b528d['params']['id']}})['then'](handleEntityNotFound(_0x3e184f,null))['then'](function(_0x1d3210){if(_0x1d3210){_0x46bca6=_0x1d3210;_0x3fdd8e[_0xc79c('0x37')]=_[_0xc79c('0x4c')](db[_0xc79c('0x50')]['rawAttributes']);_0x3fdd8e[_0xc79c('0x38')]=_['keys'](_0x3b528d[_0xc79c('0x38')]);_0x3fdd8e[_0xc79c('0x39')]=_[_0xc79c('0x3b')](_0x3fdd8e[_0xc79c('0x37')],_0x3fdd8e[_0xc79c('0x38')]);_0x2b5724[_0xc79c('0x3a')]=_['intersection'](_0x3fdd8e[_0xc79c('0x37')],qs[_0xc79c('0x3c')](_0x3b528d[_0xc79c('0x38')][_0xc79c('0x3c')]));_0x2b5724[_0xc79c('0x3a')]=_0x2b5724[_0xc79c('0x3a')][_0xc79c('0x3d')]?_0x2b5724[_0xc79c('0x3a')]:_0x3fdd8e['model'];_0x2b5724['order']=qs[_0xc79c('0x41')](_0x3b528d[_0xc79c('0x38')][_0xc79c('0x41')]);_0x2b5724[_0xc79c('0x42')]=qs['filters'](_['pick'](_0x3b528d[_0xc79c('0x38')],_0x3fdd8e['filters']));if(_0x3b528d['query'][_0xc79c('0x51')]){_0x2b5724[_0xc79c('0x42')]=_['merge'](_0x2b5724[_0xc79c('0x42')],{'$or':_[_0xc79c('0x33')](_0x2b5724[_0xc79c('0x3a')],function(_0x57f2d1){var _0x3e2ead={};_0x3e2ead[_0x57f2d1]={'$like':'%'+_0x3b528d[_0xc79c('0x38')]['filter']+'%'};return _0x3e2ead;})});}_0x2b5724=_[_0xc79c('0x46')]({},_0x2b5724,_0x3b528d[_0xc79c('0x47')]);return _0x46bca6['getFields'](_0x2b5724);}})[_0xc79c('0x2d')](function(_0x257079){if(_0x257079){_0x4dfc1a=_0x257079['length'];if(!_0x3b528d['query'][_0xc79c('0x3e')](_0xc79c('0x3f'))){_0x2b5724[_0xc79c('0x26')]=qs[_0xc79c('0x26')](_0x3b528d[_0xc79c('0x38')][_0xc79c('0x26')]);_0x2b5724[_0xc79c('0x25')]=qs[_0xc79c('0x25')](_0x3b528d[_0xc79c('0x38')][_0xc79c('0x25')]);}return _0x46bca6[_0xc79c('0x52')](_0x2b5724);}})[_0xc79c('0x2d')](function(_0x2b8c64){if(_0x2b8c64){return _0x2b8c64?{'count':_0x4dfc1a,'rows':_0x2b8c64}:null;}})[_0xc79c('0x2d')](respondWithResult(_0x3e184f,null))[_0xc79c('0x21')](handleError(_0x3e184f,null));};exports[_0xc79c('0x53')]=function(_0x14c2c9,_0x4698ef,_0x24ab36){var _0x40032d={};var _0x5be414={};var _0x590cd0;var _0x90bd03;return db[_0xc79c('0x34')][_0xc79c('0x54')]({'where':{'id':_0x14c2c9[_0xc79c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4698ef,null))[_0xc79c('0x2d')](function(_0x26f79b){if(_0x26f79b){_0x590cd0=_0x26f79b;_0x5be414[_0xc79c('0x37')]=_[_0xc79c('0x4c')](db[_0xc79c('0x50')][_0xc79c('0x35')]);_0x5be414[_0xc79c('0x38')]=_[_0xc79c('0x4c')](_0x14c2c9[_0xc79c('0x38')]);_0x5be414[_0xc79c('0x39')]=_[_0xc79c('0x3b')](_0x5be414[_0xc79c('0x37')],_0x5be414['query']);_0x40032d[_0xc79c('0x3a')]=_[_0xc79c('0x3b')](_0x5be414[_0xc79c('0x37')],qs[_0xc79c('0x3c')](_0x14c2c9['query']['fields']));_0x40032d[_0xc79c('0x3a')]=_0x40032d[_0xc79c('0x3a')][_0xc79c('0x3d')]?_0x40032d[_0xc79c('0x3a')]:_0x5be414[_0xc79c('0x37')];_0x40032d['order']=qs[_0xc79c('0x41')](_0x14c2c9[_0xc79c('0x38')]['sort']);_0x40032d['where']=qs[_0xc79c('0x39')](_['pick'](_0x14c2c9[_0xc79c('0x38')],_0x5be414['filters']));if(_0x14c2c9[_0xc79c('0x38')]['filter']){_0x40032d['where']=_['merge'](_0x40032d[_0xc79c('0x42')],{'$or':_['map'](_0x40032d['attributes'],function(_0x5d2df4){var _0x1fc9a3={};_0x1fc9a3[_0x5d2df4]={'$like':'%'+_0x14c2c9['query']['filter']+'%'};return _0x1fc9a3;})});}_0x40032d=_[_0xc79c('0x46')]({},_0x40032d,_0x14c2c9[_0xc79c('0x47')]);return _0x590cd0[_0xc79c('0x53')](_0x40032d);}})[_0xc79c('0x2d')](function(_0x117b5d){if(_0x117b5d){_0x90bd03=_0x117b5d[_0xc79c('0x3d')];if(!_0x14c2c9[_0xc79c('0x38')][_0xc79c('0x3e')](_0xc79c('0x3f'))){_0x40032d[_0xc79c('0x26')]=qs[_0xc79c('0x26')](_0x14c2c9[_0xc79c('0x38')][_0xc79c('0x26')]);_0x40032d[_0xc79c('0x25')]=qs[_0xc79c('0x25')](_0x14c2c9[_0xc79c('0x38')][_0xc79c('0x25')]);}return _0x590cd0[_0xc79c('0x53')](_0x40032d);}})[_0xc79c('0x2d')](function(_0x471753){if(_0x471753){return _0x471753?{'count':_0x90bd03,'rows':_0x471753}:null;}})[_0xc79c('0x2d')](respondWithResult(_0x4698ef,null))[_0xc79c('0x21')](handleError(_0x4698ef,null));};exports[_0xc79c('0x55')]=function(_0x122eaa,_0x3ed140,_0x3adcaf){var _0x5b4e21={};var _0x4d42fb={};var _0x16d5ac;var _0x45228d;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x122eaa[_0xc79c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3ed140,null))[_0xc79c('0x2d')](function(_0x51613e){if(_0x51613e){_0x16d5ac=_0x51613e;_0x4d42fb[_0xc79c('0x37')]=_[_0xc79c('0x4c')](db[_0xc79c('0x50')][_0xc79c('0x35')]);_0x4d42fb[_0xc79c('0x38')]=_[_0xc79c('0x4c')](_0x122eaa[_0xc79c('0x38')]);_0x4d42fb[_0xc79c('0x39')]=_[_0xc79c('0x3b')](_0x4d42fb[_0xc79c('0x37')],_0x4d42fb[_0xc79c('0x38')]);_0x5b4e21[_0xc79c('0x3a')]=_[_0xc79c('0x3b')](_0x4d42fb[_0xc79c('0x37')],qs[_0xc79c('0x3c')](_0x122eaa['query'][_0xc79c('0x3c')]));_0x5b4e21[_0xc79c('0x3a')]=_0x5b4e21['attributes'][_0xc79c('0x3d')]?_0x5b4e21[_0xc79c('0x3a')]:_0x4d42fb[_0xc79c('0x37')];_0x5b4e21[_0xc79c('0x40')]=qs[_0xc79c('0x41')](_0x122eaa[_0xc79c('0x38')][_0xc79c('0x41')]);_0x5b4e21[_0xc79c('0x42')]=qs[_0xc79c('0x39')](_[_0xc79c('0x43')](_0x122eaa[_0xc79c('0x38')],_0x4d42fb[_0xc79c('0x39')]));if(_0x122eaa[_0xc79c('0x38')]['filter']){_0x5b4e21[_0xc79c('0x42')]=_['merge'](_0x5b4e21[_0xc79c('0x42')],{'$or':_['map'](_0x5b4e21['attributes'],function(_0x4eee51){var _0x1b3ca6={};_0x1b3ca6[_0x4eee51]={'$like':'%'+_0x122eaa[_0xc79c('0x38')][_0xc79c('0x51')]+'%'};return _0x1b3ca6;})});}_0x5b4e21=_[_0xc79c('0x46')]({},_0x5b4e21,_0x122eaa[_0xc79c('0x47')]);return _0x16d5ac[_0xc79c('0x55')](_0x5b4e21);}})['then'](function(_0x48964a){if(_0x48964a){_0x45228d=_0x48964a[_0xc79c('0x3d')];if(!_0x122eaa['query'][_0xc79c('0x3e')](_0xc79c('0x3f'))){_0x5b4e21[_0xc79c('0x26')]=qs[_0xc79c('0x26')](_0x122eaa[_0xc79c('0x38')]['limit']);_0x5b4e21['offset']=qs[_0xc79c('0x25')](_0x122eaa[_0xc79c('0x38')][_0xc79c('0x25')]);}return _0x16d5ac[_0xc79c('0x55')](_0x5b4e21);}})[_0xc79c('0x2d')](function(_0x3832ad){if(_0x3832ad){return _0x3832ad?{'count':_0x45228d,'rows':_0x3832ad}:null;}})[_0xc79c('0x2d')](respondWithResult(_0x3ed140,null))[_0xc79c('0x21')](handleError(_0x3ed140,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 81e03bc..0e57ec0 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 _0xf87e=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','int_dynamics365_configurations','lodash','util','../../config/logger'];(function(_0x476a26,_0x43e6e9){var _0xac50d1=function(_0x30e888){while(--_0x30e888){_0x476a26['push'](_0x476a26['shift']());}};_0xac50d1(++_0x43e6e9);}(_0xf87e,0x1ad));var _0xef87=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xf87e[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xef87('0x0'));var util=require(_0xef87('0x1'));var logger=require(_0xef87('0x2'))(_0xef87('0x3'));var moment=require(_0xef87('0x4'));var BPromise=require(_0xef87('0x5'));var rp=require(_0xef87('0x6'));var fs=require('fs');var path=require(_0xef87('0x7'));var rimraf=require('rimraf');var config=require(_0xef87('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xef87('0x9')]=function(_0x96b318,_0x3843f7){return _0x96b318[_0xef87('0xa')]('Dynamics365Configuration',attributes,{'tableName':_0xef87('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbf7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','lodash','util','moment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcbf7,0x8c));var _0x7cbf=function(_0x5074e3,_0x2d41d5){_0x5074e3=_0x5074e3-0x0;var _0x2d0772=_0xcbf7[_0x5074e3];return _0x2d0772;};'use strict';var _=require(_0x7cbf('0x0'));var util=require(_0x7cbf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7cbf('0x2'));var BPromise=require(_0x7cbf('0x3'));var rp=require(_0x7cbf('0x4'));var fs=require('fs');var path=require(_0x7cbf('0x5'));var rimraf=require(_0x7cbf('0x6'));var config=require(_0x7cbf('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x7cbf('0x8')]=function(_0x3302b7,_0xdc82ca){return _0x3302b7[_0x7cbf('0x9')](_0x7cbf('0xa'),attributes,{'tableName':'int_dynamics365_configurations','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 14f6040..4c4b280 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 _0xc27c=['info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then'];(function(_0x4307ff,_0x1b69da){var _0x1fbac3=function(_0x2c0ca3){while(--_0x2c0ca3){_0x4307ff['push'](_0x4307ff['shift']());}};_0x1fbac3(++_0x1b69da);}(_0xc27c,0x8e));var _0xcc27=function(_0x2ae977,_0x56ba3f){_0x2ae977=_0x2ae977-0x0;var _0x2c01c3=_0xc27c[_0x2ae977];return _0x2c01c3;};'use strict';var _=require(_0xcc27('0x0'));var util=require(_0xcc27('0x1'));var moment=require(_0xcc27('0x2'));var BPromise=require(_0xcc27('0x3'));var rs=require(_0xcc27('0x4'));var fs=require('fs');var Redis=require(_0xcc27('0x5'));var db=require(_0xcc27('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcc27('0x7'));var config=require(_0xcc27('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcc27('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf4332,_0x23b181,_0x3cc1a1){return new BPromise(function(_0xb93867,_0x1b6871){return client[_0xcc27('0xa')](_0xf4332,_0x3cc1a1)[_0xcc27('0xb')](function(_0x46e22c){logger[_0xcc27('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x23b181,_0xcc27('0xd'));logger[_0xcc27('0xe')](_0xcc27('0xf'),_0x23b181,'request\x20sent',JSON[_0xcc27('0x10')](_0x46e22c));if(_0x46e22c['error']){if(_0x46e22c[_0xcc27('0x11')]['code']===0x1f4){logger[_0xcc27('0x11')](_0xcc27('0x12'),_0x23b181,_0x46e22c[_0xcc27('0x11')]['message']);return _0x1b6871(_0x46e22c['error']['message']);}logger[_0xcc27('0x11')](_0xcc27('0x12'),_0x23b181,_0x46e22c['error'][_0xcc27('0x13')]);return _0xb93867(_0x46e22c['error'][_0xcc27('0x13')]);}else{logger[_0xcc27('0xc')](_0xcc27('0x12'),_0x23b181,'request\x20sent');_0xb93867(_0x46e22c[_0xcc27('0x14')][_0xcc27('0x13')]);}})[_0xcc27('0x15')](function(_0x21cb0e){logger[_0xcc27('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x23b181,_0x21cb0e);_0x1b6871(_0x21cb0e);});});} \ No newline at end of file +var _0x108b=['rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x108b,0x105));var _0xb108=function(_0x4a9fb7,_0x4cbfd7){_0x4a9fb7=_0x4a9fb7-0x0;var _0x40b90e=_0x108b[_0x4a9fb7];return _0x40b90e;};'use strict';var _=require(_0xb108('0x0'));var util=require(_0xb108('0x1'));var moment=require('moment');var BPromise=require(_0xb108('0x2'));var rs=require(_0xb108('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb108('0x4'))(_0xb108('0x5'));var config=require(_0xb108('0x6'));var jayson=require(_0xb108('0x7'));var client=jayson['client'][_0xb108('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xffe586,_0x1b2967,_0x45777c){return new BPromise(function(_0x749221,_0x230fbb){return client[_0xb108('0x9')](_0xffe586,_0x45777c)['then'](function(_0x124900){logger[_0xb108('0xa')](_0xb108('0xb'),_0x1b2967,_0xb108('0xc'));logger['debug'](_0xb108('0xd'),_0x1b2967,'request\x20sent',JSON[_0xb108('0xe')](_0x124900));if(_0x124900[_0xb108('0xf')]){if(_0x124900[_0xb108('0xf')]['code']===0x1f4){logger[_0xb108('0xf')](_0xb108('0xb'),_0x1b2967,_0x124900[_0xb108('0xf')][_0xb108('0x10')]);return _0x230fbb(_0x124900[_0xb108('0xf')][_0xb108('0x10')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1b2967,_0x124900['error'][_0xb108('0x10')]);return _0x749221(_0x124900[_0xb108('0xf')][_0xb108('0x10')]);}else{logger[_0xb108('0xa')](_0xb108('0xb'),_0x1b2967,_0xb108('0xc'));_0x749221(_0x124900[_0xb108('0x11')][_0xb108('0x10')]);}})[_0xb108('0x12')](function(_0x237b03){logger[_0xb108('0xf')](_0xb108('0xb'),_0x1b2967,_0x237b03);_0x230fbb(_0x237b03);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 9176f80..8117e43 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 _0x3835=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','put','delete','destroy','exports','multer','path'];(function(_0x25a8c4,_0x52de76){var _0x56fe88=function(_0x45da57){while(--_0x45da57){_0x25a8c4['push'](_0x25a8c4['shift']());}};_0x56fe88(++_0x52de76);}(_0x3835,0x64));var _0x5383=function(_0x5c5eb8,_0x53e878){_0x5c5eb8=_0x5c5eb8-0x0;var _0x3bf307=_0x3835[_0x5c5eb8];return _0x3bf307;};'use strict';var multer=require(_0x5383('0x0'));var util=require('util');var path=require(_0x5383('0x1'));var timeout=require('connect-timeout');var express=require(_0x5383('0x2'));var router=express[_0x5383('0x3')]();var auth=require(_0x5383('0x4'));var interaction=require(_0x5383('0x5'));var config=require(_0x5383('0x6'));var controller=require(_0x5383('0x7'));router[_0x5383('0x8')]('/',auth[_0x5383('0x9')](),controller[_0x5383('0xa')]);router[_0x5383('0x8')](_0x5383('0xb'),auth[_0x5383('0x9')](),controller['show']);router[_0x5383('0xc')]('/',auth[_0x5383('0x9')](),controller['create']);router[_0x5383('0xd')](_0x5383('0xb'),auth[_0x5383('0x9')](),controller['update']);router[_0x5383('0xe')](_0x5383('0xb'),auth[_0x5383('0x9')](),controller[_0x5383('0xf')]);module[_0x5383('0x10')]=router; \ No newline at end of file +var _0x1fa6=['/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index'];(function(_0x5b9876,_0x293130){var _0x58538b=function(_0x54912d){while(--_0x54912d){_0x5b9876['push'](_0x5b9876['shift']());}};_0x58538b(++_0x293130);}(_0x1fa6,0x10b));var _0x61fa=function(_0x47fb8b,_0x39ed31){_0x47fb8b=_0x47fb8b-0x0;var _0x12d064=_0x1fa6[_0x47fb8b];return _0x12d064;};'use strict';var multer=require(_0x61fa('0x0'));var util=require(_0x61fa('0x1'));var path=require(_0x61fa('0x2'));var timeout=require(_0x61fa('0x3'));var express=require(_0x61fa('0x4'));var router=express[_0x61fa('0x5')]();var auth=require(_0x61fa('0x6'));var interaction=require(_0x61fa('0x7'));var config=require(_0x61fa('0x8'));var controller=require(_0x61fa('0x9'));router[_0x61fa('0xa')]('/',auth[_0x61fa('0xb')](),controller[_0x61fa('0xc')]);router[_0x61fa('0xa')](_0x61fa('0xd'),auth[_0x61fa('0xb')](),controller[_0x61fa('0xe')]);router[_0x61fa('0xf')]('/',auth[_0x61fa('0xb')](),controller['create']);router[_0x61fa('0x10')](_0x61fa('0xd'),auth[_0x61fa('0xb')](),controller['update']);router[_0x61fa('0x11')]('/:id',auth[_0x61fa('0xb')](),controller[_0x61fa('0x12')]);module[_0x61fa('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 563f435..4ae9282 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 _0x6b8f=['STRING','ENUM','variable','customVariable','exports','string','keyValue','picklist'];(function(_0x41cdec,_0x13a785){var _0x2deb2d=function(_0x32d635){while(--_0x32d635){_0x41cdec['push'](_0x41cdec['shift']());}};_0x2deb2d(++_0x13a785);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x4f4366,_0x43f58b){_0x4f4366=_0x4f4366-0x0;var _0x363abc=_0x6b8f[_0x4f4366];return _0x363abc;};'use strict';var Sequelize=require('sequelize');module[_0xf6b8('0x0')]={'type':{'type':Sequelize['ENUM'](_0xf6b8('0x1'),'variable','customVariable',_0xf6b8('0x2'),_0xf6b8('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf6b8('0x4')]},'key':{'type':Sequelize[_0xf6b8('0x4')]},'keyType':{'type':Sequelize[_0xf6b8('0x5')]('string',_0xf6b8('0x6'),_0xf6b8('0x7'))},'keyContent':{'type':Sequelize[_0xf6b8('0x4')]},'idField':{'type':Sequelize[_0xf6b8('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf6b8('0x4')]}}; \ No newline at end of file +var _0x7217=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x1bb75c,_0x26e25f){var _0x2acc7b=function(_0x9ec32b){while(--_0x9ec32b){_0x1bb75c['push'](_0x1bb75c['shift']());}};_0x2acc7b(++_0x26e25f);}(_0x7217,0x19e));var _0x7721=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x7217[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'type':{'type':Sequelize[_0x7721('0x1')](_0x7721('0x2'),_0x7721('0x3'),_0x7721('0x4'),_0x7721('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x7721('0x6')]},'key':{'type':Sequelize[_0x7721('0x6')]},'keyType':{'type':Sequelize[_0x7721('0x1')](_0x7721('0x2'),_0x7721('0x3'),_0x7721('0x4'))},'keyContent':{'type':Sequelize[_0x7721('0x6')]},'idField':{'type':Sequelize[_0x7721('0x6')]},'nameField':{'type':Sequelize[_0x7721('0x6')]},'customField':{'type':Sequelize[_0x7721('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7721('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 7514191..76b3040 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 _0x2482=['reject','update','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','model','keys','query','filters','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','then','rows','show','params','intersection','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','apply'];(function(_0x31655b,_0x53e148){var _0x5d56f4=function(_0x425d08){while(--_0x425d08){_0x31655b['push'](_0x31655b['shift']());}};_0x5d56f4(++_0x53e148);}(_0x2482,0x194));var _0x2248=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x2482[_0x316c42];return _0x2b38f7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2248('0x0'));var rimraf=require(_0x2248('0x1'));var zipdir=require(_0x2248('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2248('0x3'));var moment=require(_0x2248('0x4'));var BPromise=require(_0x2248('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2248('0x6'));var sox=require(_0x2248('0x7'));var csv=require(_0x2248('0x8'));var ejs=require(_0x2248('0x9'));var fs=require('fs');var _=require(_0x2248('0xa'));var squel=require('squel');var crypto=require(_0x2248('0xb'));var jsforce=require(_0x2248('0xc'));var deskjs=require(_0x2248('0xd'));var toCsv=require(_0x2248('0x8'));var querystring=require(_0x2248('0xe'));var Papa=require(_0x2248('0xf'));var Redis=require(_0x2248('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2248('0x11'));var as=require(_0x2248('0x12'));var hardwareService=require(_0x2248('0x13'));var logger=require(_0x2248('0x14'))(_0x2248('0x15'));var utils=require(_0x2248('0x16'));var config=require(_0x2248('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2248('0x18'))['db'];function respondWithStatusCode(_0x330978,_0x3ef6fc){_0x3ef6fc=_0x3ef6fc||0xcc;return function(_0x2f83b4){if(_0x2f83b4){return _0x330978[_0x2248('0x19')](_0x3ef6fc);}return _0x330978[_0x2248('0x1a')](_0x3ef6fc)[_0x2248('0x1b')]();};}function respondWithResult(_0x11baa5,_0x1ae2f3){_0x1ae2f3=_0x1ae2f3||0xc8;return function(_0x3c58b3){if(_0x3c58b3){return _0x11baa5[_0x2248('0x1a')](_0x1ae2f3)[_0x2248('0x1c')](_0x3c58b3);}};}function respondWithFilteredResult(_0x4b5022,_0x20ca73){return function(_0x3ed84d){if(_0x3ed84d){var _0x426483=_0x3ed84d[_0x2248('0x1d')],_0x55b6ac=_0x20ca73[_0x2248('0x1e')],_0x3907e2=_0x20ca73[_0x2248('0x1e')]+_0x20ca73[_0x2248('0x1f')],_0x18311b;if(_0x3907e2>=_0x426483){_0x3907e2=_0x426483;_0x18311b=0xc8;}else{_0x18311b=0xce;}_0x4b5022[_0x2248('0x1a')](_0x18311b);return _0x4b5022[_0x2248('0x20')]('Content-Range',_0x55b6ac+'-'+_0x3907e2+'/'+_0x426483)[_0x2248('0x1c')](_0x3ed84d);}return null;};}function patchUpdates(_0x136fba){return function(_0x11e8c4){try{jsonpatch[_0x2248('0x21')](_0x11e8c4,_0x136fba,!![]);}catch(_0x5098e4){return BPromise[_0x2248('0x22')](_0x5098e4);}return _0x11e8c4['save']();};}function saveUpdates(_0x48c848,_0x35d210){return function(_0x3cca5a){if(_0x3cca5a){return _0x3cca5a[_0x2248('0x23')](_0x48c848)['then'](function(_0x53f7c8){return _0x53f7c8;});}return null;};}function removeEntity(_0x1a5ea4,_0x31beda){return function(_0x37a2b9){if(_0x37a2b9){return _0x37a2b9['destroy']()['then'](function(){_0x1a5ea4[_0x2248('0x1a')](0xcc)[_0x2248('0x1b')]();});}};}function handleEntityNotFound(_0x34fdb7,_0xceb473){return function(_0x5a8e63){if(!_0x5a8e63){_0x34fdb7[_0x2248('0x19')](0x194);}return _0x5a8e63;};}function handleError(_0x36f9da,_0x3cbdc1){_0x3cbdc1=_0x3cbdc1||0x1f4;return function(_0x1cbb6f){logger['error'](_0x1cbb6f[_0x2248('0x24')]);if(_0x1cbb6f[_0x2248('0x25')]){delete _0x1cbb6f['name'];}_0x36f9da['status'](_0x3cbdc1)[_0x2248('0x26')](_0x1cbb6f);};}exports['index']=function(_0x4d6f16,_0x14dc76){var _0x48b90={},_0x18d180={},_0x2fd2db={'count':0x0,'rows':[]};var _0x5d4a51=_[_0x2248('0x27')](db[_0x2248('0x28')][_0x2248('0x29')],function(_0x1c4310){return{'name':_0x1c4310[_0x2248('0x2a')],'type':_0x1c4310['type']['key']};});_0x18d180[_0x2248('0x2b')]=_['map'](_0x5d4a51,_0x2248('0x25'));_0x18d180['query']=_[_0x2248('0x2c')](_0x4d6f16[_0x2248('0x2d')]);_0x18d180[_0x2248('0x2e')]=_['intersection'](_0x18d180[_0x2248('0x2b')],_0x18d180[_0x2248('0x2d')]);_0x48b90['attributes']=_['intersection'](_0x18d180['model'],qs[_0x2248('0x2f')](_0x4d6f16[_0x2248('0x2d')][_0x2248('0x2f')]));_0x48b90[_0x2248('0x30')]=_0x48b90[_0x2248('0x30')][_0x2248('0x31')]?_0x48b90[_0x2248('0x30')]:_0x18d180[_0x2248('0x2b')];if(!_0x4d6f16[_0x2248('0x2d')]['hasOwnProperty'](_0x2248('0x32'))){_0x48b90[_0x2248('0x1f')]=qs['limit'](_0x4d6f16[_0x2248('0x2d')][_0x2248('0x1f')]);_0x48b90[_0x2248('0x1e')]=qs[_0x2248('0x1e')](_0x4d6f16[_0x2248('0x2d')]['offset']);}_0x48b90[_0x2248('0x33')]=qs[_0x2248('0x34')](_0x4d6f16[_0x2248('0x2d')][_0x2248('0x34')]);_0x48b90[_0x2248('0x35')]=qs[_0x2248('0x2e')](_[_0x2248('0x36')](_0x4d6f16[_0x2248('0x2d')],_0x18d180[_0x2248('0x2e')]),_0x5d4a51);if(_0x4d6f16[_0x2248('0x2d')][_0x2248('0x37')]){_0x48b90[_0x2248('0x35')]=_[_0x2248('0x38')](_0x48b90['where'],{'$or':_['map'](_0x5d4a51,function(_0x246be2){if(_0x246be2[_0x2248('0x39')]!==_0x2248('0x3a')){var _0x6229a9={};_0x6229a9[_0x246be2[_0x2248('0x25')]]={'$like':'%'+_0x4d6f16[_0x2248('0x2d')]['filter']+'%'};return _0x6229a9;}})});}_0x48b90=_[_0x2248('0x38')]({},_0x48b90,_0x4d6f16['options']);var _0x1e35ae={'where':_0x48b90[_0x2248('0x35')]};return db[_0x2248('0x28')][_0x2248('0x1d')](_0x1e35ae)['then'](function(_0x9393a1){_0x2fd2db[_0x2248('0x1d')]=_0x9393a1;if(_0x4d6f16[_0x2248('0x2d')][_0x2248('0x3b')]){_0x48b90[_0x2248('0x3c')]=[{'all':!![]}];}return db[_0x2248('0x28')][_0x2248('0x3d')](_0x48b90);})[_0x2248('0x3e')](function(_0x57dffc){_0x2fd2db[_0x2248('0x3f')]=_0x57dffc;return _0x2fd2db;})[_0x2248('0x3e')](respondWithFilteredResult(_0x14dc76,_0x48b90))['catch'](handleError(_0x14dc76,null));};exports[_0x2248('0x40')]=function(_0x257b31,_0x590835){var _0x14e9a2={'raw':!![],'where':{'id':_0x257b31[_0x2248('0x41')]['id']}},_0x5ca4ee={};_0x5ca4ee[_0x2248('0x2b')]=_[_0x2248('0x2c')](db[_0x2248('0x28')][_0x2248('0x29')]);_0x5ca4ee[_0x2248('0x2d')]=_[_0x2248('0x2c')](_0x257b31['query']);_0x5ca4ee[_0x2248('0x2e')]=_[_0x2248('0x42')](_0x5ca4ee['model'],_0x5ca4ee[_0x2248('0x2d')]);_0x14e9a2[_0x2248('0x30')]=_[_0x2248('0x42')](_0x5ca4ee[_0x2248('0x2b')],qs['fields'](_0x257b31[_0x2248('0x2d')][_0x2248('0x2f')]));_0x14e9a2[_0x2248('0x30')]=_0x14e9a2[_0x2248('0x30')][_0x2248('0x31')]?_0x14e9a2[_0x2248('0x30')]:_0x5ca4ee[_0x2248('0x2b')];if(_0x257b31[_0x2248('0x2d')]['includeAll']){_0x14e9a2[_0x2248('0x3c')]=[{'all':!![]}];}_0x14e9a2=_[_0x2248('0x38')]({},_0x14e9a2,_0x257b31[_0x2248('0x43')]);return db['Dynamics365Field'][_0x2248('0x44')](_0x14e9a2)[_0x2248('0x3e')](handleEntityNotFound(_0x590835,null))[_0x2248('0x3e')](respondWithResult(_0x590835,null))[_0x2248('0x45')](handleError(_0x590835,null));};exports[_0x2248('0x46')]=function(_0x2aa627,_0x25efa2){return db[_0x2248('0x28')][_0x2248('0x46')](_0x2aa627['body'],{})[_0x2248('0x3e')](respondWithResult(_0x25efa2,0xc9))[_0x2248('0x45')](handleError(_0x25efa2,null));};exports[_0x2248('0x23')]=function(_0x3e3473,_0x57b199){if(_0x3e3473[_0x2248('0x47')]['id']){delete _0x3e3473[_0x2248('0x47')]['id'];}return db[_0x2248('0x28')][_0x2248('0x44')]({'where':{'id':_0x3e3473[_0x2248('0x41')]['id']}})[_0x2248('0x3e')](handleEntityNotFound(_0x57b199,null))[_0x2248('0x3e')](saveUpdates(_0x3e3473['body'],null))[_0x2248('0x3e')](respondWithResult(_0x57b199,null))[_0x2248('0x45')](handleError(_0x57b199,null));};exports[_0x2248('0x48')]=function(_0x359c0a,_0x3a35bb){return db['Dynamics365Field'][_0x2248('0x44')]({'where':{'id':_0x359c0a['params']['id']}})[_0x2248('0x3e')](handleEntityNotFound(_0x3a35bb,null))[_0x2248('0x3e')](removeEntity(_0x3a35bb,null))[_0x2248('0x45')](handleError(_0x3a35bb,null));}; \ No newline at end of file +var _0x0acc=['lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','index','Dynamics365Field','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','name','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','find','create','body','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs'];(function(_0x2e81c5,_0xf014b0){var _0x45993e=function(_0x48cdf0){while(--_0x48cdf0){_0x2e81c5['push'](_0x2e81c5['shift']());}};_0x45993e(++_0xf014b0);}(_0x0acc,0x1d3));var _0xc0ac=function(_0xcdc1e2,_0xe7a35b){_0xcdc1e2=_0xcdc1e2-0x0;var _0x21e4da=_0x0acc[_0xcdc1e2];return _0x21e4da;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc0ac('0x0'));var zipdir=require(_0xc0ac('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0ac('0x2'));var moment=require(_0xc0ac('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc0ac('0x4'));var util=require('util');var path=require(_0xc0ac('0x5'));var sox=require(_0xc0ac('0x6'));var csv=require(_0xc0ac('0x7'));var ejs=require(_0xc0ac('0x8'));var fs=require('fs');var _=require(_0xc0ac('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc0ac('0xa'));var deskjs=require(_0xc0ac('0xb'));var toCsv=require(_0xc0ac('0x7'));var querystring=require('querystring');var Papa=require(_0xc0ac('0xc'));var Redis=require('ioredis');var authService=require(_0xc0ac('0xd'));var qs=require(_0xc0ac('0xe'));var as=require(_0xc0ac('0xf'));var hardwareService=require(_0xc0ac('0x10'));var logger=require(_0xc0ac('0x11'))(_0xc0ac('0x12'));var utils=require(_0xc0ac('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x508ab7,_0xbef875){_0xbef875=_0xbef875||0xcc;return function(_0x3c80c0){if(_0x3c80c0){return _0x508ab7['sendStatus'](_0xbef875);}return _0x508ab7[_0xc0ac('0x14')](_0xbef875)['end']();};}function respondWithResult(_0x548c2f,_0x57ba9e){_0x57ba9e=_0x57ba9e||0xc8;return function(_0x13cb7d){if(_0x13cb7d){return _0x548c2f['status'](_0x57ba9e)[_0xc0ac('0x15')](_0x13cb7d);}};}function respondWithFilteredResult(_0x7bd1fd,_0x13581f){return function(_0x38d809){if(_0x38d809){var _0x24b894=_0x38d809[_0xc0ac('0x16')],_0x465033=_0x13581f[_0xc0ac('0x17')],_0x28cedc=_0x13581f[_0xc0ac('0x17')]+_0x13581f[_0xc0ac('0x18')],_0x2ab1e7;if(_0x28cedc>=_0x24b894){_0x28cedc=_0x24b894;_0x2ab1e7=0xc8;}else{_0x2ab1e7=0xce;}_0x7bd1fd['status'](_0x2ab1e7);return _0x7bd1fd[_0xc0ac('0x19')](_0xc0ac('0x1a'),_0x465033+'-'+_0x28cedc+'/'+_0x24b894)[_0xc0ac('0x15')](_0x38d809);}return null;};}function patchUpdates(_0xab3c6a){return function(_0x5b8f8e){try{jsonpatch[_0xc0ac('0x1b')](_0x5b8f8e,_0xab3c6a,!![]);}catch(_0x47fbbf){return BPromise[_0xc0ac('0x1c')](_0x47fbbf);}return _0x5b8f8e[_0xc0ac('0x1d')]();};}function saveUpdates(_0x8efc26,_0x295647){return function(_0x50eba7){if(_0x50eba7){return _0x50eba7[_0xc0ac('0x1e')](_0x8efc26)[_0xc0ac('0x1f')](function(_0x591c61){return _0x591c61;});}return null;};}function removeEntity(_0x4be5fc,_0x2b6612){return function(_0x16e1f2){if(_0x16e1f2){return _0x16e1f2[_0xc0ac('0x20')]()['then'](function(){_0x4be5fc['status'](0xcc)[_0xc0ac('0x21')]();});}};}function handleEntityNotFound(_0xf5b7b8,_0x14fa55){return function(_0x548e4c){if(!_0x548e4c){_0xf5b7b8[_0xc0ac('0x22')](0x194);}return _0x548e4c;};}function handleError(_0x3caa4a,_0x2a239c){_0x2a239c=_0x2a239c||0x1f4;return function(_0x65b23){logger[_0xc0ac('0x23')](_0x65b23[_0xc0ac('0x24')]);if(_0x65b23['name']){delete _0x65b23['name'];}_0x3caa4a[_0xc0ac('0x14')](_0x2a239c)['send'](_0x65b23);};}exports[_0xc0ac('0x25')]=function(_0xf74afd,_0x1a44d5){var _0x38a9bd={},_0x29154b={},_0x4928c7={'count':0x0,'rows':[]};var _0x5e9bf7=_['map'](db[_0xc0ac('0x26')]['rawAttributes'],function(_0x2d3610){return{'name':_0x2d3610['fieldName'],'type':_0x2d3610['type']['key']};});_0x29154b[_0xc0ac('0x27')]=_[_0xc0ac('0x28')](_0x5e9bf7,'name');_0x29154b[_0xc0ac('0x29')]=_[_0xc0ac('0x2a')](_0xf74afd['query']);_0x29154b[_0xc0ac('0x2b')]=_['intersection'](_0x29154b[_0xc0ac('0x27')],_0x29154b[_0xc0ac('0x29')]);_0x38a9bd[_0xc0ac('0x2c')]=_[_0xc0ac('0x2d')](_0x29154b[_0xc0ac('0x27')],qs['fields'](_0xf74afd['query']['fields']));_0x38a9bd['attributes']=_0x38a9bd[_0xc0ac('0x2c')][_0xc0ac('0x2e')]?_0x38a9bd[_0xc0ac('0x2c')]:_0x29154b[_0xc0ac('0x27')];if(!_0xf74afd[_0xc0ac('0x29')][_0xc0ac('0x2f')]('nolimit')){_0x38a9bd[_0xc0ac('0x18')]=qs[_0xc0ac('0x18')](_0xf74afd[_0xc0ac('0x29')][_0xc0ac('0x18')]);_0x38a9bd[_0xc0ac('0x17')]=qs['offset'](_0xf74afd[_0xc0ac('0x29')][_0xc0ac('0x17')]);}_0x38a9bd[_0xc0ac('0x30')]=qs['sort'](_0xf74afd[_0xc0ac('0x29')]['sort']);_0x38a9bd[_0xc0ac('0x31')]=qs[_0xc0ac('0x2b')](_[_0xc0ac('0x32')](_0xf74afd['query'],_0x29154b[_0xc0ac('0x2b')]),_0x5e9bf7);if(_0xf74afd['query'][_0xc0ac('0x33')]){_0x38a9bd[_0xc0ac('0x31')]=_[_0xc0ac('0x34')](_0x38a9bd[_0xc0ac('0x31')],{'$or':_[_0xc0ac('0x28')](_0x5e9bf7,function(_0x35cffb){if(_0x35cffb[_0xc0ac('0x35')]!==_0xc0ac('0x36')){var _0x2a92c2={};_0x2a92c2[_0x35cffb[_0xc0ac('0x37')]]={'$like':'%'+_0xf74afd[_0xc0ac('0x29')][_0xc0ac('0x33')]+'%'};return _0x2a92c2;}})});}_0x38a9bd=_['merge']({},_0x38a9bd,_0xf74afd[_0xc0ac('0x38')]);var _0x42e34d={'where':_0x38a9bd[_0xc0ac('0x31')]};return db[_0xc0ac('0x26')]['count'](_0x42e34d)[_0xc0ac('0x1f')](function(_0x3a7438){_0x4928c7['count']=_0x3a7438;if(_0xf74afd['query'][_0xc0ac('0x39')]){_0x38a9bd[_0xc0ac('0x3a')]=[{'all':!![]}];}return db[_0xc0ac('0x26')]['findAll'](_0x38a9bd);})['then'](function(_0x43e7ec){_0x4928c7[_0xc0ac('0x3b')]=_0x43e7ec;return _0x4928c7;})[_0xc0ac('0x1f')](respondWithFilteredResult(_0x1a44d5,_0x38a9bd))[_0xc0ac('0x3c')](handleError(_0x1a44d5,null));};exports[_0xc0ac('0x3d')]=function(_0x35cfd5,_0x55624c){var _0x18370c={'raw':!![],'where':{'id':_0x35cfd5[_0xc0ac('0x3e')]['id']}},_0x4cbb3a={};_0x4cbb3a[_0xc0ac('0x27')]=_[_0xc0ac('0x2a')](db[_0xc0ac('0x26')][_0xc0ac('0x3f')]);_0x4cbb3a[_0xc0ac('0x29')]=_[_0xc0ac('0x2a')](_0x35cfd5['query']);_0x4cbb3a[_0xc0ac('0x2b')]=_[_0xc0ac('0x2d')](_0x4cbb3a[_0xc0ac('0x27')],_0x4cbb3a['query']);_0x18370c[_0xc0ac('0x2c')]=_[_0xc0ac('0x2d')](_0x4cbb3a[_0xc0ac('0x27')],qs[_0xc0ac('0x40')](_0x35cfd5[_0xc0ac('0x29')]['fields']));_0x18370c[_0xc0ac('0x2c')]=_0x18370c['attributes'][_0xc0ac('0x2e')]?_0x18370c[_0xc0ac('0x2c')]:_0x4cbb3a[_0xc0ac('0x27')];if(_0x35cfd5['query'][_0xc0ac('0x39')]){_0x18370c[_0xc0ac('0x3a')]=[{'all':!![]}];}_0x18370c=_['merge']({},_0x18370c,_0x35cfd5['options']);return db[_0xc0ac('0x26')][_0xc0ac('0x41')](_0x18370c)[_0xc0ac('0x1f')](handleEntityNotFound(_0x55624c,null))['then'](respondWithResult(_0x55624c,null))[_0xc0ac('0x3c')](handleError(_0x55624c,null));};exports[_0xc0ac('0x42')]=function(_0x2b8d03,_0x28c8e4){return db['Dynamics365Field'][_0xc0ac('0x42')](_0x2b8d03[_0xc0ac('0x43')],{})['then'](respondWithResult(_0x28c8e4,0xc9))[_0xc0ac('0x3c')](handleError(_0x28c8e4,null));};exports[_0xc0ac('0x1e')]=function(_0x32e8a3,_0x1c9e9f){if(_0x32e8a3[_0xc0ac('0x43')]['id']){delete _0x32e8a3['body']['id'];}return db['Dynamics365Field'][_0xc0ac('0x41')]({'where':{'id':_0x32e8a3[_0xc0ac('0x3e')]['id']}})[_0xc0ac('0x1f')](handleEntityNotFound(_0x1c9e9f,null))['then'](saveUpdates(_0x32e8a3['body'],null))[_0xc0ac('0x1f')](respondWithResult(_0x1c9e9f,null))[_0xc0ac('0x3c')](handleError(_0x1c9e9f,null));};exports[_0xc0ac('0x20')]=function(_0x28bd23,_0x4dd9d6){return db[_0xc0ac('0x26')][_0xc0ac('0x41')]({'where':{'id':_0x28bd23['params']['id']}})['then'](handleEntityNotFound(_0x4dd9d6,null))['then'](removeEntity(_0x4dd9d6,null))[_0xc0ac('0x3c')](handleError(_0x4dd9d6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 159ca4c..b215d72 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 _0xdc3a=['./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xdc3a,0xf8));var _0xadc3=function(_0x4d2ce5,_0x470455){_0x4d2ce5=_0x4d2ce5-0x0;var _0x3a07f3=_0xdc3a[_0x4d2ce5];return _0x3a07f3;};'use strict';var _=require(_0xadc3('0x0'));var util=require(_0xadc3('0x1'));var logger=require(_0xadc3('0x2'))(_0xadc3('0x3'));var moment=require('moment');var BPromise=require(_0xadc3('0x4'));var rp=require(_0xadc3('0x5'));var fs=require('fs');var path=require(_0xadc3('0x6'));var rimraf=require('rimraf');var config=require(_0xadc3('0x7'));var attributes=require(_0xadc3('0x8'));module[_0xadc3('0x9')]=function(_0x57da2f,_0x2f7db7){return _0x57da2f[_0xadc3('0xa')](_0xadc3('0xb'),attributes,{'tableName':_0xadc3('0xc'),'paranoid':![],'indexes':[{'name':_0xadc3('0xd'),'fields':[_0xadc3('0xe'),_0xadc3('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7b0=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x25fea8,_0x3d17f8){var _0x21c883=function(_0xaec32f){while(--_0xaec32f){_0x25fea8['push'](_0x25fea8['shift']());}};_0x21c883(++_0x3d17f8);}(_0xa7b0,0xc8));var _0x0a7b=function(_0x57a53b,_0x11494e){_0x57a53b=_0x57a53b-0x0;var _0x29e81c=_0xa7b0[_0x57a53b];return _0x29e81c;};'use strict';var _=require(_0x0a7b('0x0'));var util=require('util');var logger=require(_0x0a7b('0x1'))(_0x0a7b('0x2'));var moment=require(_0x0a7b('0x3'));var BPromise=require(_0x0a7b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a7b('0x5'));var rimraf=require('rimraf');var config=require(_0x0a7b('0x6'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x173ad2,_0x55c23c){return _0x173ad2['define']('Dynamics365Field',attributes,{'tableName':_0x0a7b('0x7'),'paranoid':![],'indexes':[{'name':_0x0a7b('0x8'),'fields':[_0x0a7b('0x9'),_0x0a7b('0xa')],'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 936f5e7..cd69ef2 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 _0x307e=['request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x4b1bb0,_0x7dc32b){var _0x549407=function(_0xa08deb){while(--_0xa08deb){_0x4b1bb0['push'](_0x4b1bb0['shift']());}};_0x549407(++_0x7dc32b);}(_0x307e,0xc9));var _0xe307=function(_0x3151ab,_0x7134df){_0x3151ab=_0x3151ab-0x0;var _0xf81535=_0x307e[_0x3151ab];return _0xf81535;};'use strict';var _=require(_0xe307('0x0'));var util=require(_0xe307('0x1'));var moment=require(_0xe307('0x2'));var BPromise=require(_0xe307('0x3'));var rs=require(_0xe307('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe307('0x5'))['db'];var utils=require(_0xe307('0x6'));var logger=require('../../config/logger')(_0xe307('0x7'));var config=require('../../config/environment');var jayson=require(_0xe307('0x8'));var client=jayson[_0xe307('0x9')][_0xe307('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59e5b7,_0x528e79,_0x3645ea){return new BPromise(function(_0x40b840,_0x5598d4){return client[_0xe307('0xb')](_0x59e5b7,_0x3645ea)[_0xe307('0xc')](function(_0x26d257){logger[_0xe307('0xd')](_0xe307('0xe'),_0x528e79,_0xe307('0xf'));logger[_0xe307('0x10')](_0xe307('0x11'),_0x528e79,_0xe307('0xf'),JSON[_0xe307('0x12')](_0x26d257));if(_0x26d257[_0xe307('0x13')]){if(_0x26d257[_0xe307('0x13')][_0xe307('0x14')]===0x1f4){logger[_0xe307('0x13')](_0xe307('0xe'),_0x528e79,_0x26d257[_0xe307('0x13')]['message']);return _0x5598d4(_0x26d257[_0xe307('0x13')][_0xe307('0x15')]);}logger['error'](_0xe307('0xe'),_0x528e79,_0x26d257[_0xe307('0x13')][_0xe307('0x15')]);return _0x40b840(_0x26d257[_0xe307('0x13')][_0xe307('0x15')]);}else{logger[_0xe307('0xd')](_0xe307('0xe'),_0x528e79,'request\x20sent');_0x40b840(_0x26d257[_0xe307('0x16')][_0xe307('0x15')]);}})[_0xe307('0x17')](function(_0x2a48e9){logger[_0xe307('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x528e79,_0x2a48e9);_0x5598d4(_0x2a48e9);});});} \ No newline at end of file +var _0x4148=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4148,0xc6));var _0x8414=function(_0x45b900,_0x2d7019){_0x45b900=_0x45b900-0x0;var _0x40233d=_0x4148[_0x45b900];return _0x40233d;};'use strict';var _=require(_0x8414('0x0'));var util=require(_0x8414('0x1'));var moment=require(_0x8414('0x2'));var BPromise=require(_0x8414('0x3'));var rs=require(_0x8414('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8414('0x5'))['db'];var utils=require(_0x8414('0x6'));var logger=require(_0x8414('0x7'))(_0x8414('0x8'));var config=require('../../config/environment');var jayson=require(_0x8414('0x9'));var client=jayson['client'][_0x8414('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x507e0b,_0x51ab01,_0x131b88){return new BPromise(function(_0x2444b7,_0x1623c3){return client[_0x8414('0xb')](_0x507e0b,_0x131b88)[_0x8414('0xc')](function(_0xd625a7){logger[_0x8414('0xd')](_0x8414('0xe'),_0x51ab01,_0x8414('0xf'));logger[_0x8414('0x10')](_0x8414('0x11'),_0x51ab01,'request\x20sent',JSON[_0x8414('0x12')](_0xd625a7));if(_0xd625a7['error']){if(_0xd625a7[_0x8414('0x13')][_0x8414('0x14')]===0x1f4){logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0xd625a7['error'][_0x8414('0x15')]);return _0x1623c3(_0xd625a7['error'][_0x8414('0x15')]);}logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0xd625a7['error'][_0x8414('0x15')]);return _0x2444b7(_0xd625a7[_0x8414('0x13')][_0x8414('0x15')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x51ab01,_0x8414('0xf'));_0x2444b7(_0xd625a7[_0x8414('0x16')][_0x8414('0x15')]);}})[_0x8414('0x17')](function(_0x5b92aa){logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0x5b92aa);_0x1623c3(_0x5b92aa);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 857dc23..afb5cc0 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 _0xc1c7=['show','getConfigurations','getFields','create','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0xc1c7,0xbd));var _0x7c1c=function(_0x4ac00d,_0x508d5c){_0x4ac00d=_0x4ac00d-0x0;var _0x2c9b4c=_0xc1c7[_0x4ac00d];return _0x2c9b4c;};'use strict';var multer=require('multer');var util=require(_0x7c1c('0x0'));var path=require(_0x7c1c('0x1'));var timeout=require(_0x7c1c('0x2'));var express=require(_0x7c1c('0x3'));var router=express[_0x7c1c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7c1c('0x5'));var config=require(_0x7c1c('0x6'));var controller=require(_0x7c1c('0x7'));router[_0x7c1c('0x8')]('/',auth[_0x7c1c('0x9')](),controller['index']);router[_0x7c1c('0x8')](_0x7c1c('0xa'),auth[_0x7c1c('0x9')](),controller[_0x7c1c('0xb')]);router[_0x7c1c('0x8')]('/:id/configurations',auth[_0x7c1c('0x9')](),controller[_0x7c1c('0xc')]);router[_0x7c1c('0x8')]('/:id/fields',auth[_0x7c1c('0x9')](),controller[_0x7c1c('0xd')]);router['post']('/',auth[_0x7c1c('0x9')](),controller[_0x7c1c('0xe')]);router['post']('/:id/configurations',auth[_0x7c1c('0x9')](),controller[_0x7c1c('0xf')]);router[_0x7c1c('0x10')](_0x7c1c('0xa'),auth[_0x7c1c('0x9')](),controller[_0x7c1c('0x11')]);router['delete']('/:id',auth[_0x7c1c('0x9')](),controller[_0x7c1c('0x12')]);module[_0x7c1c('0x13')]=router; \ No newline at end of file +var _0x13c2=['/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13c2,0xd1));var _0x213c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x13c2[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x213c('0x0'));var timeout=require(_0x213c('0x1'));var express=require('express');var router=express[_0x213c('0x2')]();var auth=require(_0x213c('0x3'));var interaction=require(_0x213c('0x4'));var config=require(_0x213c('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0x213c('0x6')]('/',auth[_0x213c('0x7')](),controller[_0x213c('0x8')]);router[_0x213c('0x6')]('/:id',auth[_0x213c('0x7')](),controller[_0x213c('0x9')]);router['get'](_0x213c('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x213c('0x6')](_0x213c('0xb'),auth[_0x213c('0x7')](),controller[_0x213c('0xc')]);router[_0x213c('0xd')]('/',auth[_0x213c('0x7')](),controller['create']);router['post'](_0x213c('0xa'),auth[_0x213c('0x7')](),controller[_0x213c('0xe')]);router[_0x213c('0xf')](_0x213c('0x10'),auth[_0x213c('0x7')](),controller[_0x213c('0x11')]);router[_0x213c('0x12')](_0x213c('0x10'),auth[_0x213c('0x7')](),controller['destroy']);module[_0x213c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 71576f4..e4f9b15 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 _0x7b01=['exports','STRING','remoteUri'];(function(_0x2d1ac0,_0x1cfd02){var _0x563213=function(_0x5d3f55){while(--_0x5d3f55){_0x2d1ac0['push'](_0x2d1ac0['shift']());}};_0x563213(++_0x1cfd02);}(_0x7b01,0x192));var _0x17b0=function(_0x2ef437,_0x48fff9){_0x2ef437=_0x2ef437-0x0;var _0x34a2d0=_0x7b01[_0x2ef437];return _0x34a2d0;};'use strict';var Sequelize=require('sequelize');module[_0x17b0('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x17b0('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x17b0('0x2')},'serverUrl':{'type':Sequelize[_0x17b0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x159d=['username','sequelize','STRING'];(function(_0x560f8e,_0x2c5cc4){var _0xbc3ed3=function(_0x9d5906){while(--_0x9d5906){_0x560f8e['push'](_0x560f8e['shift']());}};_0xbc3ed3(++_0x2c5cc4);}(_0x159d,0x1e1));var _0xd159=function(_0x2f0943,_0x4cfd45){_0x2f0943=_0x2f0943-0x0;var _0x4966f4=_0x159d[_0x2f0943];return _0x4966f4;};'use strict';var Sequelize=require(_0xd159('0x0'));module['exports']={'name':{'type':Sequelize[_0xd159('0x1')]},'description':{'type':Sequelize[_0xd159('0x1')]},'username':{'type':Sequelize[_0xd159('0x1')],'unique':_0xd159('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd159('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 6c46ead..f162ac6 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 _0xdab2=['order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','substring','lastIndexOf','GET','format','%s/%s','%s:X','apiKey','base64','requester','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x435e85,_0x3edb92){var _0x48c575=function(_0x5ec266){while(--_0x5ec266){_0x435e85['push'](_0x435e85['shift']());}};_0x48c575(++_0x3edb92);}(_0xdab2,0xbb));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2dab('0x0'));var emlformat=require(_0x2dab('0x1'));var rimraf=require(_0x2dab('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2dab('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2dab('0x4'));var Mustache=require(_0x2dab('0x5'));var util=require(_0x2dab('0x6'));var path=require(_0x2dab('0x7'));var sox=require('sox');var csv=require(_0x2dab('0x8'));var ejs=require(_0x2dab('0x9'));var fs=require('fs');var _=require(_0x2dab('0xa'));var squel=require('squel');var crypto=require(_0x2dab('0xb'));var jsforce=require(_0x2dab('0xc'));var deskjs=require(_0x2dab('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2dab('0xe'));var Papa=require(_0x2dab('0xf'));var Redis=require(_0x2dab('0x10'));var authService=require(_0x2dab('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2dab('0x12'));var logger=require(_0x2dab('0x13'))(_0x2dab('0x14'));var utils=require(_0x2dab('0x15'));var config=require(_0x2dab('0x16'));var licenseUtil=require(_0x2dab('0x17'));var db=require(_0x2dab('0x18'))['db'];var integrations=require(_0x2dab('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x2dab('0x1a')][_0x2dab('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3f6af7,_0x4812d4,_0x511df3,_0x3a5070){return new BPromise(function(_0x147826,_0xed4fd0){var _0x17b026=_0x3a5070||client;return _0x17b026[_0x2dab('0x1c')](_0x3f6af7,_0x511df3)[_0x2dab('0x1d')](function(_0x383461){logger[_0x2dab('0x1e')]('FreshdeskAccount,\x20%s,\x20%s',_0x4812d4,_0x2dab('0x1f'));logger[_0x2dab('0x20')](_0x2dab('0x21'),_0x4812d4,'request\x20sent',JSON[_0x2dab('0x22')](_0x383461));if(_0x383461[_0x2dab('0x23')]){if(_0x383461[_0x2dab('0x23')][_0x2dab('0x24')]===0x1f4){logger[_0x2dab('0x23')](_0x2dab('0x25'),_0x4812d4,_0x383461[_0x2dab('0x23')]['message']);return _0xed4fd0(_0x383461[_0x2dab('0x23')][_0x2dab('0x26')]);}logger[_0x2dab('0x23')](_0x2dab('0x25'),_0x4812d4,_0x383461[_0x2dab('0x23')][_0x2dab('0x26')]);return _0x147826(_0x383461['error']['message']);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x4812d4,_0x2dab('0x1f'));_0x147826(_0x383461['result'][_0x2dab('0x26')]);}})[_0x2dab('0x27')](function(_0x3d665e){logger[_0x2dab('0x23')](_0x2dab('0x25'),_0x4812d4,_0x3d665e);_0xed4fd0(_0x3d665e);});});}function respondWithStatusCode(_0x22affd,_0x3eeed2){_0x3eeed2=_0x3eeed2||0xcc;return function(_0x84b101){if(_0x84b101){return _0x22affd[_0x2dab('0x28')](_0x3eeed2);}return _0x22affd[_0x2dab('0x29')](_0x3eeed2)[_0x2dab('0x2a')]();};}function respondWithResult(_0x4a90bb,_0x5c844d){_0x5c844d=_0x5c844d||0xc8;return function(_0x1646a3){if(_0x1646a3){return _0x4a90bb[_0x2dab('0x29')](_0x5c844d)[_0x2dab('0x2b')](_0x1646a3);}};}function respondWithFilteredResult(_0x45d8d9,_0x411923){return function(_0x329f3c){if(_0x329f3c){var _0x34f1e2=_0x329f3c[_0x2dab('0x2c')],_0x1f9897=_0x411923[_0x2dab('0x2d')],_0x56a22f=_0x411923['offset']+_0x411923[_0x2dab('0x2e')],_0x54402c;if(_0x56a22f>=_0x34f1e2){_0x56a22f=_0x34f1e2;_0x54402c=0xc8;}else{_0x54402c=0xce;}_0x45d8d9[_0x2dab('0x29')](_0x54402c);return _0x45d8d9[_0x2dab('0x2f')]('Content-Range',_0x1f9897+'-'+_0x56a22f+'/'+_0x34f1e2)['json'](_0x329f3c);}return null;};}function patchUpdates(_0x4a81e0){return function(_0x57e85d){try{jsonpatch[_0x2dab('0x30')](_0x57e85d,_0x4a81e0,!![]);}catch(_0x5d38e5){return BPromise[_0x2dab('0x31')](_0x5d38e5);}return _0x57e85d[_0x2dab('0x32')]();};}function saveUpdates(_0x10df50,_0x100c6b){return function(_0x571cc5){if(_0x571cc5){return _0x571cc5[_0x2dab('0x33')](_0x10df50)[_0x2dab('0x1d')](function(_0x5a1506){return _0x5a1506;});}return null;};}function removeEntity(_0x3db369,_0x590e95){return function(_0x40f6e6){if(_0x40f6e6){return _0x40f6e6[_0x2dab('0x34')]()[_0x2dab('0x1d')](function(){_0x3db369[_0x2dab('0x29')](0xcc)[_0x2dab('0x2a')]();});}};}function handleEntityNotFound(_0x422384,_0x1391e3){return function(_0x5bd879){if(!_0x5bd879){_0x422384[_0x2dab('0x28')](0x194);}return _0x5bd879;};}function handleError(_0xab4536,_0x512ab1){_0x512ab1=_0x512ab1||0x1f4;return function(_0x8f2af9){logger[_0x2dab('0x23')](_0x8f2af9[_0x2dab('0x35')]);if(_0x8f2af9['name']){delete _0x8f2af9[_0x2dab('0x36')];}_0xab4536[_0x2dab('0x29')](_0x512ab1)[_0x2dab('0x37')](_0x8f2af9);};}exports[_0x2dab('0x38')]=function(_0x2bb854,_0x56090e){var _0x35d1d4={},_0x2b73e8={},_0x47c485={'count':0x0,'rows':[]};var _0x182395=_[_0x2dab('0x39')](db[_0x2dab('0x3a')]['rawAttributes'],function(_0x147cc1){return{'name':_0x147cc1[_0x2dab('0x3b')],'type':_0x147cc1[_0x2dab('0x3c')][_0x2dab('0x3d')]};});_0x2b73e8[_0x2dab('0x3e')]=_[_0x2dab('0x39')](_0x182395,_0x2dab('0x36'));_0x2b73e8[_0x2dab('0x3f')]=_[_0x2dab('0x40')](_0x2bb854[_0x2dab('0x3f')]);_0x2b73e8[_0x2dab('0x41')]=_[_0x2dab('0x42')](_0x2b73e8[_0x2dab('0x3e')],_0x2b73e8[_0x2dab('0x3f')]);_0x35d1d4[_0x2dab('0x43')]=_['intersection'](_0x2b73e8[_0x2dab('0x3e')],qs[_0x2dab('0x44')](_0x2bb854[_0x2dab('0x3f')][_0x2dab('0x44')]));_0x35d1d4['attributes']=_0x35d1d4[_0x2dab('0x43')]['length']?_0x35d1d4[_0x2dab('0x43')]:_0x2b73e8[_0x2dab('0x3e')];if(!_0x2bb854[_0x2dab('0x3f')][_0x2dab('0x45')](_0x2dab('0x46'))){_0x35d1d4[_0x2dab('0x2e')]=qs[_0x2dab('0x2e')](_0x2bb854['query'][_0x2dab('0x2e')]);_0x35d1d4['offset']=qs[_0x2dab('0x2d')](_0x2bb854[_0x2dab('0x3f')]['offset']);}_0x35d1d4[_0x2dab('0x47')]=qs[_0x2dab('0x48')](_0x2bb854[_0x2dab('0x3f')][_0x2dab('0x48')]);_0x35d1d4[_0x2dab('0x49')]=qs[_0x2dab('0x41')](_['pick'](_0x2bb854[_0x2dab('0x3f')],_0x2b73e8[_0x2dab('0x41')]),_0x182395);if(_0x2bb854[_0x2dab('0x3f')][_0x2dab('0x4a')]){_0x35d1d4[_0x2dab('0x49')]=_[_0x2dab('0x4b')](_0x35d1d4[_0x2dab('0x49')],{'$or':_[_0x2dab('0x39')](_0x182395,function(_0x185b94){if(_0x185b94['type']!==_0x2dab('0x4c')){var _0x3d4bb0={};_0x3d4bb0[_0x185b94[_0x2dab('0x36')]]={'$like':'%'+_0x2bb854[_0x2dab('0x3f')]['filter']+'%'};return _0x3d4bb0;}})});}_0x35d1d4=_[_0x2dab('0x4b')]({},_0x35d1d4,_0x2bb854[_0x2dab('0x4d')]);var _0x563621={'where':_0x35d1d4[_0x2dab('0x49')]};return db[_0x2dab('0x3a')][_0x2dab('0x2c')](_0x563621)[_0x2dab('0x1d')](function(_0x2e1abe){_0x47c485[_0x2dab('0x2c')]=_0x2e1abe;if(_0x2bb854['query'][_0x2dab('0x4e')]){_0x35d1d4[_0x2dab('0x4f')]=[{'all':!![]}];}return db[_0x2dab('0x3a')][_0x2dab('0x50')](_0x35d1d4);})[_0x2dab('0x1d')](function(_0xd95a99){_0x47c485[_0x2dab('0x51')]=_0xd95a99;return _0x47c485;})[_0x2dab('0x1d')](respondWithFilteredResult(_0x56090e,_0x35d1d4))[_0x2dab('0x27')](handleError(_0x56090e,null));};exports[_0x2dab('0x52')]=function(_0x29beb4,_0x75bef4){var _0x1da3b9={'raw':![],'where':{'id':_0x29beb4[_0x2dab('0x53')]['id']}},_0x3cec73={};_0x3cec73[_0x2dab('0x3e')]=_[_0x2dab('0x40')](db[_0x2dab('0x3a')][_0x2dab('0x54')]);_0x3cec73[_0x2dab('0x3f')]=_[_0x2dab('0x40')](_0x29beb4[_0x2dab('0x3f')]);_0x3cec73[_0x2dab('0x41')]=_[_0x2dab('0x42')](_0x3cec73[_0x2dab('0x3e')],_0x3cec73[_0x2dab('0x3f')]);_0x1da3b9[_0x2dab('0x43')]=_[_0x2dab('0x42')](_0x3cec73[_0x2dab('0x3e')],qs[_0x2dab('0x44')](_0x29beb4['query'][_0x2dab('0x44')]));_0x1da3b9[_0x2dab('0x43')]=_0x1da3b9[_0x2dab('0x43')][_0x2dab('0x55')]?_0x1da3b9['attributes']:_0x3cec73['model'];if(_0x29beb4['query'][_0x2dab('0x4e')]){_0x1da3b9[_0x2dab('0x4f')]=[{'all':!![]}];}_0x1da3b9=_['merge']({},_0x1da3b9,_0x29beb4[_0x2dab('0x4d')]);return db['FreshdeskAccount'][_0x2dab('0x56')](_0x1da3b9)[_0x2dab('0x1d')](handleEntityNotFound(_0x75bef4,null))[_0x2dab('0x1d')](respondWithResult(_0x75bef4,null))[_0x2dab('0x27')](handleError(_0x75bef4,null));};exports[_0x2dab('0x57')]=function(_0x539784,_0x298d59){return db['FreshdeskAccount'][_0x2dab('0x57')](_0x539784[_0x2dab('0x58')],{})[_0x2dab('0x1d')](respondWithResult(_0x298d59,0xc9))[_0x2dab('0x27')](handleError(_0x298d59,null));};exports['update']=function(_0x96a560,_0x384539){if(_0x96a560[_0x2dab('0x58')]['id']){delete _0x96a560[_0x2dab('0x58')]['id'];}return db[_0x2dab('0x3a')]['find']({'where':{'id':_0x96a560[_0x2dab('0x53')]['id']}})[_0x2dab('0x1d')](handleEntityNotFound(_0x384539,null))['then'](saveUpdates(_0x96a560['body'],null))['then'](respondWithResult(_0x384539,null))[_0x2dab('0x27')](handleError(_0x384539,null));};exports[_0x2dab('0x34')]=function(_0x1d5570,_0x5da556){return db[_0x2dab('0x3a')][_0x2dab('0x56')]({'where':{'id':_0x1d5570[_0x2dab('0x53')]['id']}})[_0x2dab('0x1d')](handleEntityNotFound(_0x5da556,null))['then'](removeEntity(_0x5da556,null))['catch'](handleError(_0x5da556,null));};exports[_0x2dab('0x59')]=function(_0x242d2a,_0xfda7aa,_0x59b88a){var _0x9c9739={};var _0x30806c={};var _0x12deca;var _0x1d9b29;return db[_0x2dab('0x3a')][_0x2dab('0x5a')]({'where':{'id':_0x242d2a['params']['id']}})[_0x2dab('0x1d')](handleEntityNotFound(_0xfda7aa,null))[_0x2dab('0x1d')](function(_0x599554){if(_0x599554){_0x12deca=_0x599554;_0x30806c[_0x2dab('0x3e')]=_[_0x2dab('0x40')](db[_0x2dab('0x5b')][_0x2dab('0x54')]);_0x30806c['query']=_[_0x2dab('0x40')](_0x242d2a['query']);_0x30806c[_0x2dab('0x41')]=_[_0x2dab('0x42')](_0x30806c[_0x2dab('0x3e')],_0x30806c['query']);_0x9c9739[_0x2dab('0x43')]=_[_0x2dab('0x42')](_0x30806c['model'],qs[_0x2dab('0x44')](_0x242d2a['query'][_0x2dab('0x44')]));_0x9c9739[_0x2dab('0x43')]=_0x9c9739[_0x2dab('0x43')][_0x2dab('0x55')]?_0x9c9739[_0x2dab('0x43')]:_0x30806c[_0x2dab('0x3e')];_0x9c9739['order']=qs[_0x2dab('0x48')](_0x242d2a['query']['sort']);_0x9c9739[_0x2dab('0x49')]=qs['filters'](_[_0x2dab('0x5c')](_0x242d2a[_0x2dab('0x3f')],_0x30806c['filters']));if(_0x242d2a[_0x2dab('0x3f')][_0x2dab('0x4a')]){_0x9c9739[_0x2dab('0x49')]=_[_0x2dab('0x4b')](_0x9c9739['where'],{'$or':_[_0x2dab('0x39')](_0x9c9739[_0x2dab('0x43')],function(_0x3b212d){var _0x189952={};_0x189952[_0x3b212d]={'$like':'%'+_0x242d2a[_0x2dab('0x3f')][_0x2dab('0x4a')]+'%'};return _0x189952;})});}_0x9c9739=_[_0x2dab('0x4b')]({},_0x9c9739,_0x242d2a['options']);return _0x12deca[_0x2dab('0x59')](_0x9c9739);}})[_0x2dab('0x1d')](function(_0x40a2db){if(_0x40a2db){_0x1d9b29=_0x40a2db[_0x2dab('0x55')];if(!_0x242d2a[_0x2dab('0x3f')]['hasOwnProperty'](_0x2dab('0x46'))){_0x9c9739[_0x2dab('0x2e')]=qs['limit'](_0x242d2a[_0x2dab('0x3f')][_0x2dab('0x2e')]);_0x9c9739[_0x2dab('0x2d')]=qs[_0x2dab('0x2d')](_0x242d2a[_0x2dab('0x3f')][_0x2dab('0x2d')]);}return _0x12deca[_0x2dab('0x59')](_0x9c9739);}})[_0x2dab('0x1d')](function(_0x1b6dc7){if(_0x1b6dc7){return _0x1b6dc7?{'count':_0x1d9b29,'rows':_0x1b6dc7}:null;}})[_0x2dab('0x1d')](respondWithResult(_0xfda7aa,null))[_0x2dab('0x27')](handleError(_0xfda7aa,null));};exports['addConfiguration']=function(_0x2c02db,_0x2282e4,_0x4f9c5e){if(_0x2c02db[_0x2dab('0x58')]['id']){delete _0x2c02db[_0x2dab('0x58')]['id'];}return db[_0x2dab('0x3a')][_0x2dab('0x5a')]({'where':{'id':_0x2c02db[_0x2dab('0x53')]['id']}})[_0x2dab('0x1d')](handleEntityNotFound(_0x2282e4,null))['then'](function(_0x1d612d){if(_0x1d612d){_0x2c02db[_0x2dab('0x58')][_0x2dab('0x5d')]=_0x1d612d['id'];_0x2c02db[_0x2dab('0x58')][_0x2dab('0x5e')]=integrations[_0x2dab('0x5f')](_0x2c02db[_0x2dab('0x58')][_0x2dab('0x60')],_0x2c02db['body'][_0x2dab('0x3c')]);_0x2c02db[_0x2dab('0x58')][_0x2dab('0x61')]=integrations[_0x2dab('0x62')](_0x2c02db[_0x2dab('0x58')]['channel'],_0x2c02db['body'][_0x2dab('0x3c')]);return db[_0x2dab('0x5b')]['create'](_0x2c02db[_0x2dab('0x58')],{'include':[{'model':db['FreshdeskField'],'as':_0x2dab('0x5e')},{'model':db[_0x2dab('0x63')],'as':_0x2dab('0x61')}]});}return null;})['then'](respondWithResult(_0x2282e4,null))[_0x2dab('0x27')](handleError(_0x2282e4,null));};exports['getFields']=function(_0x408d44,_0xb22a5f,_0x40b32c){var _0x82604c='';return db['FreshdeskAccount'][_0x2dab('0x5a')]({'where':{'id':_0x408d44['params']['id']},'attributes':['id',_0x2dab('0x64'),'apiKey']})[_0x2dab('0x1d')](handleEntityNotFound(_0xb22a5f,null))[_0x2dab('0x1d')](function(_0x3265b9){if(_0x3265b9){_0x82604c=_0x3265b9[_0x2dab('0x64')];var _0x565680=_0x82604c['slice'](-0x1);if(_0x565680==='/'){_0x82604c=_0x82604c[_0x2dab('0x65')](0x0,_0x82604c[_0x2dab('0x66')](_0x565680));}return rp({'method':_0x2dab('0x67'),'uri':util[_0x2dab('0x68')](_0x2dab('0x69'),_0x82604c,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x2dab('0x68')]('Basic\x20%s',new Buffer(util[_0x2dab('0x68')](_0x2dab('0x6a'),_0x3265b9[_0x2dab('0x6b')]))['toString'](_0x2dab('0x6c')))},'json':!![]});}})[_0x2dab('0x1d')](function(_0x40b19b){if(_0x40b19b){var _0x2180d9=[_0x2dab('0x6d'),'subject',_0x2dab('0x6e'),_0x2dab('0x6f'),_0x2dab('0x29'),_0x2dab('0x70'),_0x2dab('0x71'),_0x2dab('0x72'),_0x2dab('0x73'),_0x2dab('0x71'),_0x2dab('0x74')];_[_0x2dab('0x75')](_0x40b19b,function(_0x2e078e){return _0x2180d9[_0x2dab('0x76')](_0x2e078e[_0x2dab('0x36')])||!_0x2e078e[_0x2dab('0x77')]&&_0x2e078e[_0x2dab('0x3c')]!==_0x2dab('0x78')&&_0x2e078e[_0x2dab('0x3c')]!==_0x2dab('0x79');});return{'count':_0x40b19b['length'],'rows':_[_0x2dab('0x39')](_0x40b19b,function(_0x50456a){return{'id':_0x50456a['name'],'name':_0x50456a[_0x2dab('0x7a')],'custom':!_0x50456a[_0x2dab('0x77')],'options':_0x50456a[_0x2dab('0x7b')]?_['map'](_0x50456a['choices'],function(_0xc4b243){return{'name':_['capitalize'](_0xc4b243),'value':_0xc4b243};}):[]};})};}})['then'](respondWithResult(_0xb22a5f,null))[_0x2dab('0x27')](function(_0x289abf){var _0x945af1=_0x408d44[_0x2dab('0x3f')][_0x2dab('0x7c')]?0x1f4:_0x289abf[_0x2dab('0x7d')]||0x1f4;logger[_0x2dab('0x23')](_0x2dab('0x7e'),_0x2dab('0x7f'),_0x945af1,JSON['stringify'](_0x289abf));delete _0x289abf[_0x2dab('0x36')];if(_0x945af1===0x191){_0x945af1=0x190;}_0xb22a5f['status'](_0x945af1)[_0x2dab('0x37')](_0x408d44['query'][_0x2dab('0x7c')]?{'message':_0x2dab('0x80'),'statusCode':_0x289abf[_0x2dab('0x7d')]}:_0x289abf);});}; \ No newline at end of file +var _0xd1de=['priority','group','source','ticket_type','company','remove','includes','default','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','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/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','json','apply','save','then','end','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','length','includeAll','create','body','find','getConfigurations','hasOwnProperty','AccountId','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','Subjects','Descriptions','getFields','findOne','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','description'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0xd1de,0x110));var _0xed1d=function(_0x4a17ab,_0x13e2c0){_0x4a17ab=_0x4a17ab-0x0;var _0x15330b=_0xd1de[_0x4a17ab];return _0x15330b;};'use strict';var pdf=require(_0xed1d('0x0'));var emlformat=require(_0xed1d('0x1'));var rimraf=require(_0xed1d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xed1d('0x3'));var BPromise=require(_0xed1d('0x4'));var Mustache=require(_0xed1d('0x5'));var util=require(_0xed1d('0x6'));var path=require('path');var sox=require(_0xed1d('0x7'));var csv=require(_0xed1d('0x8'));var ejs=require(_0xed1d('0x9'));var fs=require('fs');var _=require(_0xed1d('0xa'));var squel=require(_0xed1d('0xb'));var crypto=require(_0xed1d('0xc'));var jsforce=require(_0xed1d('0xd'));var deskjs=require(_0xed1d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xed1d('0xf'));var Papa=require(_0xed1d('0x10'));var Redis=require(_0xed1d('0x11'));var authService=require(_0xed1d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xed1d('0x13'));var hardwareService=require(_0xed1d('0x14'));var logger=require(_0xed1d('0x15'))('api');var utils=require(_0xed1d('0x16'));var config=require(_0xed1d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xed1d('0x18'))['db'];var integrations=require(_0xed1d('0x19'));var jayson=require('jayson/promise');var client=jayson['client'][_0xed1d('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x218df8,_0x2b60e1,_0x2efc59,_0x8b5d29){return new BPromise(function(_0x3c451d,_0x5e407e){var _0x47b936=_0x8b5d29||client;return _0x47b936[_0xed1d('0x1b')](_0x218df8,_0x2efc59)['then'](function(_0x431242){logger[_0xed1d('0x1c')](_0xed1d('0x1d'),_0x2b60e1,_0xed1d('0x1e'));logger[_0xed1d('0x1f')](_0xed1d('0x20'),_0x2b60e1,_0xed1d('0x1e'),JSON['stringify'](_0x431242));if(_0x431242['error']){if(_0x431242[_0xed1d('0x21')][_0xed1d('0x22')]===0x1f4){logger[_0xed1d('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x2b60e1,_0x431242[_0xed1d('0x21')][_0xed1d('0x23')]);return _0x5e407e(_0x431242['error'][_0xed1d('0x23')]);}logger[_0xed1d('0x21')](_0xed1d('0x1d'),_0x2b60e1,_0x431242[_0xed1d('0x21')][_0xed1d('0x23')]);return _0x3c451d(_0x431242[_0xed1d('0x21')][_0xed1d('0x23')]);}else{logger[_0xed1d('0x1c')]('FreshdeskAccount,\x20%s,\x20%s',_0x2b60e1,_0xed1d('0x1e'));_0x3c451d(_0x431242[_0xed1d('0x24')][_0xed1d('0x23')]);}})[_0xed1d('0x25')](function(_0x3b5867){logger[_0xed1d('0x21')](_0xed1d('0x1d'),_0x2b60e1,_0x3b5867);_0x5e407e(_0x3b5867);});});}function respondWithStatusCode(_0x2401a6,_0x2c9a1c){_0x2c9a1c=_0x2c9a1c||0xcc;return function(_0x4266bb){if(_0x4266bb){return _0x2401a6[_0xed1d('0x26')](_0x2c9a1c);}return _0x2401a6[_0xed1d('0x27')](_0x2c9a1c)['end']();};}function respondWithResult(_0x5c9107,_0x11d617){_0x11d617=_0x11d617||0xc8;return function(_0x4b9683){if(_0x4b9683){return _0x5c9107['status'](_0x11d617)['json'](_0x4b9683);}};}function respondWithFilteredResult(_0x420a6c,_0x1aff0a){return function(_0x457a9e){if(_0x457a9e){var _0x53c155=_0x457a9e[_0xed1d('0x28')],_0x3cd514=_0x1aff0a[_0xed1d('0x29')],_0x5a524f=_0x1aff0a[_0xed1d('0x29')]+_0x1aff0a[_0xed1d('0x2a')],_0x10239d;if(_0x5a524f>=_0x53c155){_0x5a524f=_0x53c155;_0x10239d=0xc8;}else{_0x10239d=0xce;}_0x420a6c[_0xed1d('0x27')](_0x10239d);return _0x420a6c[_0xed1d('0x2b')]('Content-Range',_0x3cd514+'-'+_0x5a524f+'/'+_0x53c155)[_0xed1d('0x2c')](_0x457a9e);}return null;};}function patchUpdates(_0x26bd38){return function(_0x6d84cc){try{jsonpatch[_0xed1d('0x2d')](_0x6d84cc,_0x26bd38,!![]);}catch(_0x484a08){return BPromise['reject'](_0x484a08);}return _0x6d84cc[_0xed1d('0x2e')]();};}function saveUpdates(_0x58a568,_0x565e72){return function(_0x789417){if(_0x789417){return _0x789417['update'](_0x58a568)['then'](function(_0x13f85d){return _0x13f85d;});}return null;};}function removeEntity(_0x592c86,_0x28dc11){return function(_0x46615b){if(_0x46615b){return _0x46615b['destroy']()[_0xed1d('0x2f')](function(){_0x592c86[_0xed1d('0x27')](0xcc)[_0xed1d('0x30')]();});}};}function handleEntityNotFound(_0x151132,_0x1af590){return function(_0x97f096){if(!_0x97f096){_0x151132[_0xed1d('0x26')](0x194);}return _0x97f096;};}function handleError(_0x4e5343,_0x21e8e9){_0x21e8e9=_0x21e8e9||0x1f4;return function(_0xdd5fc){logger[_0xed1d('0x21')](_0xdd5fc[_0xed1d('0x31')]);if(_0xdd5fc[_0xed1d('0x32')]){delete _0xdd5fc[_0xed1d('0x32')];}_0x4e5343[_0xed1d('0x27')](_0x21e8e9)[_0xed1d('0x33')](_0xdd5fc);};}exports[_0xed1d('0x34')]=function(_0x3d52eb,_0x23e69f){var _0x14c37a={},_0x104976={},_0x44cf2c={'count':0x0,'rows':[]};var _0x4c1eff=_[_0xed1d('0x35')](db[_0xed1d('0x36')][_0xed1d('0x37')],function(_0xdbf529){return{'name':_0xdbf529[_0xed1d('0x38')],'type':_0xdbf529[_0xed1d('0x39')][_0xed1d('0x3a')]};});_0x104976[_0xed1d('0x3b')]=_['map'](_0x4c1eff,'name');_0x104976[_0xed1d('0x3c')]=_[_0xed1d('0x3d')](_0x3d52eb[_0xed1d('0x3c')]);_0x104976[_0xed1d('0x3e')]=_[_0xed1d('0x3f')](_0x104976['model'],_0x104976[_0xed1d('0x3c')]);_0x14c37a[_0xed1d('0x40')]=_[_0xed1d('0x3f')](_0x104976['model'],qs[_0xed1d('0x41')](_0x3d52eb[_0xed1d('0x3c')][_0xed1d('0x41')]));_0x14c37a[_0xed1d('0x40')]=_0x14c37a[_0xed1d('0x40')]['length']?_0x14c37a['attributes']:_0x104976[_0xed1d('0x3b')];if(!_0x3d52eb['query']['hasOwnProperty'](_0xed1d('0x42'))){_0x14c37a[_0xed1d('0x2a')]=qs[_0xed1d('0x2a')](_0x3d52eb[_0xed1d('0x3c')]['limit']);_0x14c37a[_0xed1d('0x29')]=qs[_0xed1d('0x29')](_0x3d52eb[_0xed1d('0x3c')][_0xed1d('0x29')]);}_0x14c37a[_0xed1d('0x43')]=qs[_0xed1d('0x44')](_0x3d52eb[_0xed1d('0x3c')][_0xed1d('0x44')]);_0x14c37a[_0xed1d('0x45')]=qs['filters'](_[_0xed1d('0x46')](_0x3d52eb[_0xed1d('0x3c')],_0x104976[_0xed1d('0x3e')]),_0x4c1eff);if(_0x3d52eb[_0xed1d('0x3c')]['filter']){_0x14c37a[_0xed1d('0x45')]=_[_0xed1d('0x47')](_0x14c37a['where'],{'$or':_[_0xed1d('0x35')](_0x4c1eff,function(_0xca2609){if(_0xca2609[_0xed1d('0x39')]!==_0xed1d('0x48')){var _0x260db2={};_0x260db2[_0xca2609[_0xed1d('0x32')]]={'$like':'%'+_0x3d52eb[_0xed1d('0x3c')][_0xed1d('0x49')]+'%'};return _0x260db2;}})});}_0x14c37a=_['merge']({},_0x14c37a,_0x3d52eb[_0xed1d('0x4a')]);var _0x39c6c2={'where':_0x14c37a[_0xed1d('0x45')]};return db[_0xed1d('0x36')][_0xed1d('0x28')](_0x39c6c2)[_0xed1d('0x2f')](function(_0x3e2b78){_0x44cf2c[_0xed1d('0x28')]=_0x3e2b78;if(_0x3d52eb[_0xed1d('0x3c')]['includeAll']){_0x14c37a[_0xed1d('0x4b')]=[{'all':!![]}];}return db[_0xed1d('0x36')][_0xed1d('0x4c')](_0x14c37a);})[_0xed1d('0x2f')](function(_0x17f0dd){_0x44cf2c[_0xed1d('0x4d')]=_0x17f0dd;return _0x44cf2c;})[_0xed1d('0x2f')](respondWithFilteredResult(_0x23e69f,_0x14c37a))[_0xed1d('0x25')](handleError(_0x23e69f,null));};exports[_0xed1d('0x4e')]=function(_0x4069b4,_0x1f2355){var _0x5b4c70={'raw':![],'where':{'id':_0x4069b4[_0xed1d('0x4f')]['id']}},_0xc5f7={};_0xc5f7[_0xed1d('0x3b')]=_[_0xed1d('0x3d')](db[_0xed1d('0x36')][_0xed1d('0x37')]);_0xc5f7['query']=_[_0xed1d('0x3d')](_0x4069b4[_0xed1d('0x3c')]);_0xc5f7[_0xed1d('0x3e')]=_[_0xed1d('0x3f')](_0xc5f7[_0xed1d('0x3b')],_0xc5f7[_0xed1d('0x3c')]);_0x5b4c70['attributes']=_['intersection'](_0xc5f7[_0xed1d('0x3b')],qs['fields'](_0x4069b4['query'][_0xed1d('0x41')]));_0x5b4c70[_0xed1d('0x40')]=_0x5b4c70['attributes'][_0xed1d('0x50')]?_0x5b4c70[_0xed1d('0x40')]:_0xc5f7[_0xed1d('0x3b')];if(_0x4069b4[_0xed1d('0x3c')][_0xed1d('0x51')]){_0x5b4c70[_0xed1d('0x4b')]=[{'all':!![]}];}_0x5b4c70=_[_0xed1d('0x47')]({},_0x5b4c70,_0x4069b4[_0xed1d('0x4a')]);return db['FreshdeskAccount']['find'](_0x5b4c70)[_0xed1d('0x2f')](handleEntityNotFound(_0x1f2355,null))[_0xed1d('0x2f')](respondWithResult(_0x1f2355,null))[_0xed1d('0x25')](handleError(_0x1f2355,null));};exports[_0xed1d('0x52')]=function(_0x513515,_0x4b77e1){return db['FreshdeskAccount'][_0xed1d('0x52')](_0x513515[_0xed1d('0x53')],{})[_0xed1d('0x2f')](respondWithResult(_0x4b77e1,0xc9))[_0xed1d('0x25')](handleError(_0x4b77e1,null));};exports['update']=function(_0x19b75a,_0x513bb0){if(_0x19b75a[_0xed1d('0x53')]['id']){delete _0x19b75a[_0xed1d('0x53')]['id'];}return db[_0xed1d('0x36')][_0xed1d('0x54')]({'where':{'id':_0x19b75a[_0xed1d('0x4f')]['id']}})[_0xed1d('0x2f')](handleEntityNotFound(_0x513bb0,null))[_0xed1d('0x2f')](saveUpdates(_0x19b75a[_0xed1d('0x53')],null))[_0xed1d('0x2f')](respondWithResult(_0x513bb0,null))[_0xed1d('0x25')](handleError(_0x513bb0,null));};exports['destroy']=function(_0xa9ba0c,_0x473e23){return db[_0xed1d('0x36')][_0xed1d('0x54')]({'where':{'id':_0xa9ba0c[_0xed1d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x473e23,null))['then'](removeEntity(_0x473e23,null))['catch'](handleError(_0x473e23,null));};exports['getConfigurations']=function(_0x3353bf,_0xd9055b,_0xa8c466){var _0x10651c={};var _0x22f0a3={};var _0x5c2eb9;var _0x10573c;return db[_0xed1d('0x36')]['findOne']({'where':{'id':_0x3353bf[_0xed1d('0x4f')]['id']}})[_0xed1d('0x2f')](handleEntityNotFound(_0xd9055b,null))['then'](function(_0x401fb7){if(_0x401fb7){_0x5c2eb9=_0x401fb7;_0x22f0a3[_0xed1d('0x3b')]=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x22f0a3[_0xed1d('0x3c')]=_[_0xed1d('0x3d')](_0x3353bf[_0xed1d('0x3c')]);_0x22f0a3[_0xed1d('0x3e')]=_[_0xed1d('0x3f')](_0x22f0a3[_0xed1d('0x3b')],_0x22f0a3['query']);_0x10651c[_0xed1d('0x40')]=_[_0xed1d('0x3f')](_0x22f0a3['model'],qs[_0xed1d('0x41')](_0x3353bf[_0xed1d('0x3c')]['fields']));_0x10651c['attributes']=_0x10651c['attributes'][_0xed1d('0x50')]?_0x10651c['attributes']:_0x22f0a3[_0xed1d('0x3b')];_0x10651c[_0xed1d('0x43')]=qs[_0xed1d('0x44')](_0x3353bf[_0xed1d('0x3c')][_0xed1d('0x44')]);_0x10651c['where']=qs[_0xed1d('0x3e')](_[_0xed1d('0x46')](_0x3353bf['query'],_0x22f0a3['filters']));if(_0x3353bf['query']['filter']){_0x10651c['where']=_['merge'](_0x10651c['where'],{'$or':_[_0xed1d('0x35')](_0x10651c[_0xed1d('0x40')],function(_0x5026a9){var _0x50da9b={};_0x50da9b[_0x5026a9]={'$like':'%'+_0x3353bf[_0xed1d('0x3c')][_0xed1d('0x49')]+'%'};return _0x50da9b;})});}_0x10651c=_[_0xed1d('0x47')]({},_0x10651c,_0x3353bf[_0xed1d('0x4a')]);return _0x5c2eb9[_0xed1d('0x55')](_0x10651c);}})[_0xed1d('0x2f')](function(_0x592e6e){if(_0x592e6e){_0x10573c=_0x592e6e[_0xed1d('0x50')];if(!_0x3353bf['query'][_0xed1d('0x56')](_0xed1d('0x42'))){_0x10651c[_0xed1d('0x2a')]=qs['limit'](_0x3353bf[_0xed1d('0x3c')][_0xed1d('0x2a')]);_0x10651c[_0xed1d('0x29')]=qs[_0xed1d('0x29')](_0x3353bf[_0xed1d('0x3c')][_0xed1d('0x29')]);}return _0x5c2eb9[_0xed1d('0x55')](_0x10651c);}})['then'](function(_0x2b1ebe){if(_0x2b1ebe){return _0x2b1ebe?{'count':_0x10573c,'rows':_0x2b1ebe}:null;}})[_0xed1d('0x2f')](respondWithResult(_0xd9055b,null))[_0xed1d('0x25')](handleError(_0xd9055b,null));};exports['addConfiguration']=function(_0x49a14d,_0x213048,_0x454cff){if(_0x49a14d['body']['id']){delete _0x49a14d[_0xed1d('0x53')]['id'];}return db[_0xed1d('0x36')]['findOne']({'where':{'id':_0x49a14d[_0xed1d('0x4f')]['id']}})[_0xed1d('0x2f')](handleEntityNotFound(_0x213048,null))[_0xed1d('0x2f')](function(_0x5109fe){if(_0x5109fe){_0x49a14d[_0xed1d('0x53')][_0xed1d('0x57')]=_0x5109fe['id'];_0x49a14d[_0xed1d('0x53')]['Subjects']=integrations[_0xed1d('0x58')](_0x49a14d[_0xed1d('0x53')][_0xed1d('0x59')],_0x49a14d[_0xed1d('0x53')][_0xed1d('0x39')]);_0x49a14d['body']['Descriptions']=integrations[_0xed1d('0x5a')](_0x49a14d[_0xed1d('0x53')][_0xed1d('0x59')],_0x49a14d[_0xed1d('0x53')][_0xed1d('0x39')]);return db[_0xed1d('0x5b')][_0xed1d('0x52')](_0x49a14d[_0xed1d('0x53')],{'include':[{'model':db[_0xed1d('0x5c')],'as':_0xed1d('0x5d')},{'model':db[_0xed1d('0x5c')],'as':_0xed1d('0x5e')}]});}return null;})[_0xed1d('0x2f')](respondWithResult(_0x213048,null))[_0xed1d('0x25')](handleError(_0x213048,null));};exports[_0xed1d('0x5f')]=function(_0x152e0d,_0x31c068,_0x437c19){var _0x90e3ac='';return db['FreshdeskAccount'][_0xed1d('0x60')]({'where':{'id':_0x152e0d[_0xed1d('0x4f')]['id']},'attributes':['id','remoteUri',_0xed1d('0x61')]})[_0xed1d('0x2f')](handleEntityNotFound(_0x31c068,null))[_0xed1d('0x2f')](function(_0x26fabf){if(_0x26fabf){_0x90e3ac=_0x26fabf[_0xed1d('0x62')];var _0x44b942=_0x90e3ac[_0xed1d('0x63')](-0x1);if(_0x44b942==='/'){_0x90e3ac=_0x90e3ac[_0xed1d('0x64')](0x0,_0x90e3ac[_0xed1d('0x65')](_0x44b942));}return rp({'method':_0xed1d('0x66'),'uri':util[_0xed1d('0x67')](_0xed1d('0x68'),_0x90e3ac,_0xed1d('0x69')),'headers':{'Authorization':util[_0xed1d('0x67')](_0xed1d('0x6a'),new Buffer(util[_0xed1d('0x67')](_0xed1d('0x6b'),_0x26fabf[_0xed1d('0x61')]))[_0xed1d('0x6c')]('base64'))},'json':!![]});}})[_0xed1d('0x2f')](function(_0x3790af){if(_0x3790af){var _0x54a262=[_0xed1d('0x6d'),_0xed1d('0x6e'),'agent',_0xed1d('0x6f'),_0xed1d('0x27'),_0xed1d('0x70'),_0xed1d('0x71'),_0xed1d('0x72'),_0xed1d('0x73'),_0xed1d('0x71'),_0xed1d('0x74')];_[_0xed1d('0x75')](_0x3790af,function(_0x437dbb){return _0x54a262[_0xed1d('0x76')](_0x437dbb[_0xed1d('0x32')])||!_0x437dbb[_0xed1d('0x77')]&&_0x437dbb[_0xed1d('0x39')]!=='custom_text'&&_0x437dbb[_0xed1d('0x39')]!==_0xed1d('0x78');});return{'count':_0x3790af['length'],'rows':_['map'](_0x3790af,function(_0x34aa55){return{'id':_0x34aa55['name'],'name':_0x34aa55[_0xed1d('0x79')],'custom':!_0x34aa55[_0xed1d('0x77')],'options':_0x34aa55[_0xed1d('0x7a')]?_[_0xed1d('0x35')](_0x34aa55[_0xed1d('0x7a')],function(_0x272f0a){return{'name':_[_0xed1d('0x7b')](_0x272f0a),'value':_0x272f0a};}):[]};})};}})['then'](respondWithResult(_0x31c068,null))['catch'](function(_0x2ae71c){var _0x48518c=_0x152e0d['query']['test']?0x1f4:_0x2ae71c[_0xed1d('0x7c')]||0x1f4;logger['error'](_0xed1d('0x7d'),_0xed1d('0x5f'),_0x48518c,JSON[_0xed1d('0x7e')](_0x2ae71c));delete _0x2ae71c[_0xed1d('0x32')];if(_0x48518c===0x191){_0x48518c=0x190;}_0x31c068[_0xed1d('0x27')](_0x48518c)[_0xed1d('0x33')](_0x152e0d[_0xed1d('0x3c')][_0xed1d('0x7f')]?{'message':'Wrong\x20credentials','statusCode':_0x2ae71c[_0xed1d('0x7c')]}:_0x2ae71c);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 38a0eab..347aad5 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 _0xbe66=['rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x3c10d4,_0x220f78){var _0x265e21=function(_0x1b5d65){while(--_0x1b5d65){_0x3c10d4['push'](_0x3c10d4['shift']());}};_0x265e21(++_0x220f78);}(_0xbe66,0x66));var _0x6be6=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xbe66[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0x6be6('0x0'));var util=require(_0x6be6('0x1'));var logger=require(_0x6be6('0x2'))(_0x6be6('0x3'));var moment=require('moment');var BPromise=require(_0x6be6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6be6('0x5'));var rimraf=require(_0x6be6('0x6'));var config=require(_0x6be6('0x7'));var attributes=require(_0x6be6('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x6be6('0x9')]=function(_0x319a12,_0x4606fe){return _0x319a12['define'](_0x6be6('0xa'),attributes,{'tableName':_0x6be6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb21=['bluebird','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0xdb21,0x73));var _0x1db2=function(_0x7aad15,_0x5e7f){_0x7aad15=_0x7aad15-0x0;var _0x420c7e=_0xdb21[_0x7aad15];return _0x420c7e;};'use strict';var _=require(_0x1db2('0x0'));var util=require(_0x1db2('0x1'));var logger=require(_0x1db2('0x2'))(_0x1db2('0x3'));var moment=require(_0x1db2('0x4'));var BPromise=require(_0x1db2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1db2('0x6'));var config=require('../../config/environment');var attributes=require(_0x1db2('0x7'));var integrations=require(_0x1db2('0x8'));module[_0x1db2('0x9')]=function(_0x108e4c,_0x13df63){return _0x108e4c['define'](_0x1db2('0xa'),attributes,{'tableName':_0x1db2('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 e8d90a5..7af62aa 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 _0x066e=['jayson/promise','client','http','info','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','raw','options','where','attributes','limit','include','map','model','then','ShowFreshdeskAccount','find','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0x066e,0x87));var _0xe066=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x066e[_0x363ef8];return _0x148822;};'use strict';var _=require(_0xe066('0x0'));var util=require('util');var moment=require(_0xe066('0x1'));var BPromise=require('bluebird');var rs=require(_0xe066('0x2'));var fs=require('fs');var Redis=require(_0xe066('0x3'));var db=require(_0xe066('0x4'))['db'];var utils=require(_0xe066('0x5'));var logger=require(_0xe066('0x6'))(_0xe066('0x7'));var config=require(_0xe066('0x8'));var jayson=require(_0xe066('0x9'));var client=jayson[_0xe066('0xa')][_0xe066('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2159ff,_0x38fa3b,_0x88bef3){return new BPromise(function(_0x5808dd,_0xb17096){return client['request'](_0x2159ff,_0x88bef3)['then'](function(_0x165e52){logger[_0xe066('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x38fa3b,'request\x20sent');logger['debug'](_0xe066('0xd'),_0x38fa3b,'request\x20sent',JSON[_0xe066('0xe')](_0x165e52));if(_0x165e52[_0xe066('0xf')]){if(_0x165e52[_0xe066('0xf')]['code']===0x1f4){logger[_0xe066('0xf')](_0xe066('0x10'),_0x38fa3b,_0x165e52[_0xe066('0xf')][_0xe066('0x11')]);return _0xb17096(_0x165e52['error'][_0xe066('0x11')]);}logger[_0xe066('0xf')](_0xe066('0x10'),_0x38fa3b,_0x165e52[_0xe066('0xf')][_0xe066('0x11')]);return _0x5808dd(_0x165e52[_0xe066('0xf')][_0xe066('0x11')]);}else{logger[_0xe066('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x38fa3b,_0xe066('0x12'));_0x5808dd(_0x165e52[_0xe066('0x13')][_0xe066('0x11')]);}})[_0xe066('0x14')](function(_0x1a9b30){logger[_0xe066('0xf')](_0xe066('0x10'),_0x38fa3b,_0x1a9b30);_0xb17096(_0x1a9b30);});});}exports[_0xe066('0x15')]=function(_0x30790f){var _0x74d599=this;return new Promise(function(_0x1f52af,_0x4d45e4){return db[_0xe066('0x16')][_0xe066('0x17')]({'raw':_0x30790f['options']?_0x30790f['options'][_0xe066('0x18')]===undefined?!![]:![]:!![],'where':_0x30790f[_0xe066('0x19')]?_0x30790f[_0xe066('0x19')][_0xe066('0x1a')]||null:null,'attributes':_0x30790f[_0xe066('0x19')]?_0x30790f[_0xe066('0x19')][_0xe066('0x1b')]||null:null,'limit':_0x30790f[_0xe066('0x19')]?_0x30790f[_0xe066('0x19')][_0xe066('0x1c')]||null:null,'include':_0x30790f[_0xe066('0x19')]?_0x30790f[_0xe066('0x19')][_0xe066('0x1d')]?_[_0xe066('0x1e')](_0x30790f[_0xe066('0x19')][_0xe066('0x1d')],function(_0x45d7d3){return{'model':db[_0x45d7d3[_0xe066('0x1f')]],'as':_0x45d7d3['as'],'attributes':_0x45d7d3['attributes'],'include':_0x45d7d3[_0xe066('0x1d')]?_[_0xe066('0x1e')](_0x45d7d3[_0xe066('0x1d')],function(_0x40a114){return{'model':db[_0x40a114[_0xe066('0x1f')]],'as':_0x40a114['as'],'attributes':_0x40a114[_0xe066('0x1b')],'include':_0x40a114[_0xe066('0x1d')]?_[_0xe066('0x1e')](_0x40a114['include'],function(_0x247eae){return{'model':db[_0x247eae[_0xe066('0x1f')]],'as':_0x247eae['as'],'attributes':_0x247eae[_0xe066('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe066('0x20')](function(_0x419814){logger[_0xe066('0xc')]('GetFreshdeskAccount',_0x30790f);logger['debug']('GetFreshdeskAccount',_0x30790f,JSON[_0xe066('0xe')](_0x419814));_0x1f52af(_0x419814);})[_0xe066('0x14')](function(_0x191543){logger[_0xe066('0xf')](_0xe066('0x15'),_0x191543[_0xe066('0x11')],_0x30790f);_0x4d45e4(_0x74d599[_0xe066('0xf')](0x1f4,_0x191543['message']));});});};exports[_0xe066('0x21')]=function(_0x652e42){var _0x46c3f8=this;return new Promise(function(_0x1fd89f,_0x2d6196){return db[_0xe066('0x16')][_0xe066('0x22')]({'raw':_0x652e42[_0xe066('0x19')]?_0x652e42[_0xe066('0x19')][_0xe066('0x18')]===undefined?!![]:![]:!![],'where':_0x652e42[_0xe066('0x19')]?_0x652e42[_0xe066('0x19')][_0xe066('0x1a')]||null:null,'attributes':_0x652e42[_0xe066('0x19')]?_0x652e42[_0xe066('0x19')][_0xe066('0x1b')]||null:null,'include':_0x652e42['options']?_0x652e42[_0xe066('0x19')][_0xe066('0x1d')]?_['map'](_0x652e42[_0xe066('0x19')]['include'],function(_0x39b987){return{'model':db[_0x39b987[_0xe066('0x1f')]],'as':_0x39b987['as'],'attributes':_0x39b987['attributes'],'include':_0x39b987[_0xe066('0x1d')]?_[_0xe066('0x1e')](_0x39b987[_0xe066('0x1d')],function(_0x2a85ae){return{'model':db[_0x2a85ae[_0xe066('0x1f')]],'as':_0x2a85ae['as'],'attributes':_0x2a85ae[_0xe066('0x1b')],'include':_0x2a85ae[_0xe066('0x1d')]?_['map'](_0x2a85ae[_0xe066('0x1d')],function(_0x3557b6){return{'model':db[_0x3557b6[_0xe066('0x1f')]],'as':_0x3557b6['as'],'attributes':_0x3557b6[_0xe066('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe066('0x20')](function(_0x3e7dd5){logger[_0xe066('0xc')](_0xe066('0x21'),_0x652e42);logger[_0xe066('0x23')](_0xe066('0x21'),_0x652e42,JSON[_0xe066('0xe')](_0x3e7dd5));_0x1fd89f(_0x3e7dd5);})[_0xe066('0x14')](function(_0x3ecd37){logger[_0xe066('0xf')]('ShowFreshdeskAccount',_0x3ecd37[_0xe066('0x11')],_0x652e42);_0x2d6196(_0x46c3f8[_0xe066('0xf')](0x1f4,_0x3ecd37[_0xe066('0x11')]));});});}; \ No newline at end of file +var _0xb072=['jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x34dae2,_0x41c0bd){var _0x40190e=function(_0x547439){while(--_0x547439){_0x34dae2['push'](_0x34dae2['shift']());}};_0x40190e(++_0x41c0bd);}(_0xb072,0x1c1));var _0x2b07=function(_0x4a06fb,_0x664507){_0x4a06fb=_0x4a06fb-0x0;var _0x2616e9=_0xb072[_0x4a06fb];return _0x2616e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2b07('0x0'));var rs=require(_0x2b07('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b07('0x2'))['db'];var utils=require(_0x2b07('0x3'));var logger=require(_0x2b07('0x4'))(_0x2b07('0x5'));var config=require('../../config/environment');var jayson=require(_0x2b07('0x6'));var client=jayson[_0x2b07('0x7')][_0x2b07('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1151ce,_0x313657,_0x28520b){return new BPromise(function(_0x54e813,_0x273a47){return client[_0x2b07('0x9')](_0x1151ce,_0x28520b)[_0x2b07('0xa')](function(_0x919a09){logger[_0x2b07('0xb')](_0x2b07('0xc'),_0x313657,_0x2b07('0xd'));logger[_0x2b07('0xe')](_0x2b07('0xf'),_0x313657,'request\x20sent',JSON[_0x2b07('0x10')](_0x919a09));if(_0x919a09[_0x2b07('0x11')]){if(_0x919a09[_0x2b07('0x11')][_0x2b07('0x12')]===0x1f4){logger['error'](_0x2b07('0xc'),_0x313657,_0x919a09[_0x2b07('0x11')][_0x2b07('0x13')]);return _0x273a47(_0x919a09['error'][_0x2b07('0x13')]);}logger['error'](_0x2b07('0xc'),_0x313657,_0x919a09[_0x2b07('0x11')][_0x2b07('0x13')]);return _0x54e813(_0x919a09['error'][_0x2b07('0x13')]);}else{logger[_0x2b07('0xb')](_0x2b07('0xc'),_0x313657,'request\x20sent');_0x54e813(_0x919a09[_0x2b07('0x14')][_0x2b07('0x13')]);}})[_0x2b07('0x15')](function(_0x4a425f){logger['error'](_0x2b07('0xc'),_0x313657,_0x4a425f);_0x273a47(_0x4a425f);});});}exports['GetFreshdeskAccount']=function(_0x345b98){var _0x4474e7=this;return new Promise(function(_0x45a1f4,_0x139f55){return db[_0x2b07('0x16')][_0x2b07('0x17')]({'raw':_0x345b98[_0x2b07('0x18')]?_0x345b98['options'][_0x2b07('0x19')]===undefined?!![]:![]:!![],'where':_0x345b98[_0x2b07('0x18')]?_0x345b98[_0x2b07('0x18')][_0x2b07('0x1a')]||null:null,'attributes':_0x345b98[_0x2b07('0x18')]?_0x345b98[_0x2b07('0x18')][_0x2b07('0x1b')]||null:null,'limit':_0x345b98[_0x2b07('0x18')]?_0x345b98[_0x2b07('0x18')][_0x2b07('0x1c')]||null:null,'include':_0x345b98[_0x2b07('0x18')]?_0x345b98['options'][_0x2b07('0x1d')]?_[_0x2b07('0x1e')](_0x345b98[_0x2b07('0x18')]['include'],function(_0x187fb5){return{'model':db[_0x187fb5[_0x2b07('0x1f')]],'as':_0x187fb5['as'],'attributes':_0x187fb5[_0x2b07('0x1b')],'include':_0x187fb5['include']?_[_0x2b07('0x1e')](_0x187fb5['include'],function(_0x936a69){return{'model':db[_0x936a69[_0x2b07('0x1f')]],'as':_0x936a69['as'],'attributes':_0x936a69[_0x2b07('0x1b')],'include':_0x936a69[_0x2b07('0x1d')]?_[_0x2b07('0x1e')](_0x936a69[_0x2b07('0x1d')],function(_0x2b0693){return{'model':db[_0x2b0693[_0x2b07('0x1f')]],'as':_0x2b0693['as'],'attributes':_0x2b0693[_0x2b07('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2b07('0xa')](function(_0x42fb66){logger[_0x2b07('0xb')]('GetFreshdeskAccount',_0x345b98);logger[_0x2b07('0xe')](_0x2b07('0x20'),_0x345b98,JSON[_0x2b07('0x10')](_0x42fb66));_0x45a1f4(_0x42fb66);})['catch'](function(_0x2afcde){logger[_0x2b07('0x11')]('GetFreshdeskAccount',_0x2afcde['message'],_0x345b98);_0x139f55(_0x4474e7[_0x2b07('0x11')](0x1f4,_0x2afcde[_0x2b07('0x13')]));});});};exports[_0x2b07('0x21')]=function(_0x24ea86){var _0x4add18=this;return new Promise(function(_0x1e281a,_0x4b7193){return db['FreshdeskAccount'][_0x2b07('0x22')]({'raw':_0x24ea86['options']?_0x24ea86['options'][_0x2b07('0x19')]===undefined?!![]:![]:!![],'where':_0x24ea86[_0x2b07('0x18')]?_0x24ea86[_0x2b07('0x18')][_0x2b07('0x1a')]||null:null,'attributes':_0x24ea86[_0x2b07('0x18')]?_0x24ea86['options'][_0x2b07('0x1b')]||null:null,'include':_0x24ea86[_0x2b07('0x18')]?_0x24ea86[_0x2b07('0x18')]['include']?_[_0x2b07('0x1e')](_0x24ea86['options'][_0x2b07('0x1d')],function(_0x1872af){return{'model':db[_0x1872af['model']],'as':_0x1872af['as'],'attributes':_0x1872af[_0x2b07('0x1b')],'include':_0x1872af['include']?_[_0x2b07('0x1e')](_0x1872af[_0x2b07('0x1d')],function(_0x202371){return{'model':db[_0x202371[_0x2b07('0x1f')]],'as':_0x202371['as'],'attributes':_0x202371[_0x2b07('0x1b')],'include':_0x202371['include']?_[_0x2b07('0x1e')](_0x202371['include'],function(_0x34d10b){return{'model':db[_0x34d10b['model']],'as':_0x34d10b['as'],'attributes':_0x34d10b[_0x2b07('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2b07('0xa')](function(_0x21d3d0){logger[_0x2b07('0xb')](_0x2b07('0x21'),_0x24ea86);logger[_0x2b07('0xe')](_0x2b07('0x21'),_0x24ea86,JSON[_0x2b07('0x10')](_0x21d3d0));_0x1e281a(_0x21d3d0);})[_0x2b07('0x15')](function(_0x40f10a){logger[_0x2b07('0x11')](_0x2b07('0x21'),_0x40f10a[_0x2b07('0x13')],_0x24ea86);_0x4b7193(_0x4add18[_0x2b07('0x11')](0x1f4,_0x40f10a[_0x2b07('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 7c7f272..ee2e9f2 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 _0x100e=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','setTags','put','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x51ec5c,_0x3506ef){var _0x5b04b8=function(_0x2e741f){while(--_0x2e741f){_0x51ec5c['push'](_0x51ec5c['shift']());}};_0x5b04b8(++_0x3506ef);}(_0x100e,0x11d));var _0xe100=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0x100e[_0x1e3c02];return _0x4d26d7;};'use strict';var multer=require(_0xe100('0x0'));var util=require(_0xe100('0x1'));var path=require(_0xe100('0x2'));var timeout=require(_0xe100('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xe100('0x4'));var interaction=require(_0xe100('0x5'));var config=require(_0xe100('0x6'));var controller=require(_0xe100('0x7'));router[_0xe100('0x8')]('/',auth[_0xe100('0x9')](),controller[_0xe100('0xa')]);router[_0xe100('0x8')](_0xe100('0xb'),auth['isAuthenticated'](),controller[_0xe100('0xc')]);router[_0xe100('0x8')](_0xe100('0xd'),auth[_0xe100('0x9')](),controller[_0xe100('0xe')]);router['get'](_0xe100('0xf'),auth[_0xe100('0x9')](),controller[_0xe100('0x10')]);router[_0xe100('0x8')](_0xe100('0x11'),auth[_0xe100('0x9')](),controller[_0xe100('0x12')]);router[_0xe100('0x8')](_0xe100('0x13'),auth[_0xe100('0x9')](),controller['getTags']);router['post']('/',auth[_0xe100('0x9')](),controller[_0xe100('0x14')]);router[_0xe100('0x15')]('/:id/tags',auth[_0xe100('0x9')](),controller[_0xe100('0x16')]);router[_0xe100('0x17')](_0xe100('0xb'),auth[_0xe100('0x9')](),controller['update']);router[_0xe100('0x18')](_0xe100('0xb'),auth[_0xe100('0x9')](),controller[_0xe100('0x19')]);module[_0xe100('0x1a')]=router; \ No newline at end of file +var _0x5507=['getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5507,0x93));var _0x7550=function(_0x4930c0,_0x124eee){_0x4930c0=_0x4930c0-0x0;var _0x18137c=_0x5507[_0x4930c0];return _0x18137c;};'use strict';var multer=require(_0x7550('0x0'));var util=require(_0x7550('0x1'));var path=require(_0x7550('0x2'));var timeout=require(_0x7550('0x3'));var express=require(_0x7550('0x4'));var router=express[_0x7550('0x5')]();var auth=require(_0x7550('0x6'));var interaction=require(_0x7550('0x7'));var config=require(_0x7550('0x8'));var controller=require(_0x7550('0x9'));router[_0x7550('0xa')]('/',auth[_0x7550('0xb')](),controller['index']);router[_0x7550('0xa')](_0x7550('0xc'),auth[_0x7550('0xb')](),controller[_0x7550('0xd')]);router[_0x7550('0xa')](_0x7550('0xe'),auth[_0x7550('0xb')](),controller[_0x7550('0xf')]);router[_0x7550('0xa')]('/:id/subjects',auth[_0x7550('0xb')](),controller[_0x7550('0x10')]);router[_0x7550('0xa')](_0x7550('0x11'),auth[_0x7550('0xb')](),controller[_0x7550('0x12')]);router['get'](_0x7550('0x13'),auth[_0x7550('0xb')](),controller['getTags']);router[_0x7550('0x14')]('/',auth['isAuthenticated'](),controller[_0x7550('0x15')]);router[_0x7550('0x14')]('/:id/tags',auth[_0x7550('0xb')](),controller[_0x7550('0x16')]);router[_0x7550('0x17')](_0x7550('0xc'),auth[_0x7550('0xb')](),controller['update']);router[_0x7550('0x18')](_0x7550('0xc'),auth[_0x7550('0xb')](),controller[_0x7550('0x19')]);module[_0x7550('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ccbb76c..20b5a41 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 _0x33a6=['STRING','sequelize'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x33a6,0xc7));var _0x633a=function(_0x1bf05d,_0x29cfe1){_0x1bf05d=_0x1bf05d-0x0;var _0x295223=_0x33a6[_0x1bf05d];return _0x295223;};'use strict';var Sequelize=require(_0x633a('0x0'));module['exports']={'name':{'type':Sequelize[_0x633a('0x1')]},'description':{'type':Sequelize[_0x633a('0x1')]}}; \ No newline at end of file +var _0x6f6e=['exports','STRING'];(function(_0x31b151,_0x42fc2a){var _0x325470=function(_0x2127b2){while(--_0x2127b2){_0x31b151['push'](_0x31b151['shift']());}};_0x325470(++_0x42fc2a);}(_0x6f6e,0x11a));var _0xe6f6=function(_0x148e49,_0x1b5a5b){_0x148e49=_0x148e49-0x0;var _0x19223a=_0x6f6e[_0x148e49];return _0x19223a;};'use strict';var Sequelize=require('sequelize');module[_0xe6f6('0x0')]={'name':{'type':Sequelize[_0xe6f6('0x1')]},'description':{'type':Sequelize[_0xe6f6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 07108c0..2330908 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 _0x40fe=['Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','FreshdeskConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','rawAttributes','fields','include','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','order','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','info','request\x20sent','debug','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','set'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x40fe,0x1b5));var _0xe40f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x40fe[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0xe40f('0x0'));var emlformat=require(_0xe40f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe40f('0x2'));var jsonpatch=require(_0xe40f('0x3'));var rp=require(_0xe40f('0x4'));var moment=require(_0xe40f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe40f('0x6'));var path=require(_0xe40f('0x7'));var sox=require('sox');var csv=require(_0xe40f('0x8'));var ejs=require(_0xe40f('0x9'));var fs=require('fs');var _=require(_0xe40f('0xa'));var squel=require(_0xe40f('0xb'));var crypto=require(_0xe40f('0xc'));var jsforce=require(_0xe40f('0xd'));var deskjs=require(_0xe40f('0xe'));var toCsv=require(_0xe40f('0x8'));var querystring=require(_0xe40f('0xf'));var Papa=require(_0xe40f('0x10'));var Redis=require(_0xe40f('0x11'));var authService=require(_0xe40f('0x12'));var qs=require(_0xe40f('0x13'));var as=require(_0xe40f('0x14'));var hardwareService=require(_0xe40f('0x15'));var logger=require(_0xe40f('0x16'))(_0xe40f('0x17'));var utils=require(_0xe40f('0x18'));var config=require(_0xe40f('0x19'));var licenseUtil=require(_0xe40f('0x1a'));var db=require(_0xe40f('0x1b'))['db'];var jayson=require(_0xe40f('0x1c'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9e897c,_0x395cb0,_0x49537e,_0xf2d436){return new BPromise(function(_0x3f7e02,_0x1fdce9){var _0x30fb41=_0xf2d436||client;return _0x30fb41['request'](_0x9e897c,_0x49537e)['then'](function(_0x42d562){logger[_0xe40f('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x395cb0,_0xe40f('0x1e'));logger[_0xe40f('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x395cb0,_0xe40f('0x1e'),JSON['stringify'](_0x42d562));if(_0x42d562['error']){if(_0x42d562[_0xe40f('0x20')][_0xe40f('0x21')]===0x1f4){logger['error'](_0xe40f('0x22'),_0x395cb0,_0x42d562[_0xe40f('0x20')]['message']);return _0x1fdce9(_0x42d562['error'][_0xe40f('0x23')]);}logger[_0xe40f('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x395cb0,_0x42d562[_0xe40f('0x20')]['message']);return _0x3f7e02(_0x42d562[_0xe40f('0x20')][_0xe40f('0x23')]);}else{logger[_0xe40f('0x1d')](_0xe40f('0x22'),_0x395cb0,_0xe40f('0x1e'));_0x3f7e02(_0x42d562['result'][_0xe40f('0x23')]);}})[_0xe40f('0x24')](function(_0x4a6034){logger[_0xe40f('0x20')](_0xe40f('0x22'),_0x395cb0,_0x4a6034);_0x1fdce9(_0x4a6034);});});}function respondWithStatusCode(_0x2cd2ac,_0x2ef7b4){_0x2ef7b4=_0x2ef7b4||0xcc;return function(_0x568aaf){if(_0x568aaf){return _0x2cd2ac[_0xe40f('0x25')](_0x2ef7b4);}return _0x2cd2ac[_0xe40f('0x26')](_0x2ef7b4)['end']();};}function respondWithResult(_0x1d6755,_0x3b1929){_0x3b1929=_0x3b1929||0xc8;return function(_0x29f711){if(_0x29f711){return _0x1d6755[_0xe40f('0x26')](_0x3b1929)[_0xe40f('0x27')](_0x29f711);}};}function respondWithFilteredResult(_0x167f93,_0x3216ac){return function(_0x42ad65){if(_0x42ad65){var _0x3f83fd=_0x42ad65['count'],_0x313e52=_0x3216ac[_0xe40f('0x28')],_0x17fcdc=_0x3216ac['offset']+_0x3216ac[_0xe40f('0x29')],_0x3f8f28;if(_0x17fcdc>=_0x3f83fd){_0x17fcdc=_0x3f83fd;_0x3f8f28=0xc8;}else{_0x3f8f28=0xce;}_0x167f93[_0xe40f('0x26')](_0x3f8f28);return _0x167f93[_0xe40f('0x2a')](_0xe40f('0x2b'),_0x313e52+'-'+_0x17fcdc+'/'+_0x3f83fd)['json'](_0x42ad65);}return null;};}function patchUpdates(_0x87c3c4){return function(_0x229bba){try{jsonpatch[_0xe40f('0x2c')](_0x229bba,_0x87c3c4,!![]);}catch(_0x3ae7aa){return BPromise[_0xe40f('0x2d')](_0x3ae7aa);}return _0x229bba[_0xe40f('0x2e')]();};}function saveUpdates(_0x586ee9,_0x40ffcd){return function(_0x33297f){if(_0x33297f){return _0x33297f[_0xe40f('0x2f')](_0x586ee9)['then'](function(_0x3a6732){return _0x3a6732;});}return null;};}function removeEntity(_0x3c9b1d,_0x4a3b76){return function(_0xcd573e){if(_0xcd573e){return _0xcd573e[_0xe40f('0x30')]()[_0xe40f('0x31')](function(){_0x3c9b1d[_0xe40f('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x260959,_0x4ab0ad){return function(_0x3a9cb1){if(!_0x3a9cb1){_0x260959[_0xe40f('0x25')](0x194);}return _0x3a9cb1;};}function handleError(_0x8a9193,_0x5ec77a){_0x5ec77a=_0x5ec77a||0x1f4;return function(_0xd7c63d){logger[_0xe40f('0x20')](_0xd7c63d['stack']);if(_0xd7c63d[_0xe40f('0x32')]){delete _0xd7c63d[_0xe40f('0x32')];}_0x8a9193[_0xe40f('0x26')](_0x5ec77a)[_0xe40f('0x33')](_0xd7c63d);};}exports[_0xe40f('0x34')]=function(_0x5f50e6,_0x2c374e){var _0x342f68={},_0x33ed47={},_0xfcb3c2={'count':0x0,'rows':[]};var _0x5e4acf=_[_0xe40f('0x35')](db[_0xe40f('0x36')]['rawAttributes'],function(_0x5d9c32){return{'name':_0x5d9c32[_0xe40f('0x37')],'type':_0x5d9c32[_0xe40f('0x38')][_0xe40f('0x39')]};});_0x33ed47['model']=_[_0xe40f('0x35')](_0x5e4acf,_0xe40f('0x32'));_0x33ed47[_0xe40f('0x3a')]=_[_0xe40f('0x3b')](_0x5f50e6[_0xe40f('0x3a')]);_0x33ed47[_0xe40f('0x3c')]=_[_0xe40f('0x3d')](_0x33ed47[_0xe40f('0x3e')],_0x33ed47[_0xe40f('0x3a')]);_0x342f68[_0xe40f('0x3f')]=_[_0xe40f('0x3d')](_0x33ed47[_0xe40f('0x3e')],qs['fields'](_0x5f50e6[_0xe40f('0x3a')]['fields']));_0x342f68[_0xe40f('0x3f')]=_0x342f68[_0xe40f('0x3f')][_0xe40f('0x40')]?_0x342f68['attributes']:_0x33ed47[_0xe40f('0x3e')];if(!_0x5f50e6[_0xe40f('0x3a')][_0xe40f('0x41')](_0xe40f('0x42'))){_0x342f68[_0xe40f('0x29')]=qs[_0xe40f('0x29')](_0x5f50e6[_0xe40f('0x3a')][_0xe40f('0x29')]);_0x342f68[_0xe40f('0x28')]=qs[_0xe40f('0x28')](_0x5f50e6['query'][_0xe40f('0x28')]);}_0x342f68['order']=qs['sort'](_0x5f50e6['query'][_0xe40f('0x43')]);_0x342f68[_0xe40f('0x44')]=qs['filters'](_[_0xe40f('0x45')](_0x5f50e6[_0xe40f('0x3a')],_0x33ed47[_0xe40f('0x3c')]),_0x5e4acf);if(_0x5f50e6[_0xe40f('0x3a')][_0xe40f('0x46')]){_0x342f68[_0xe40f('0x44')]=_[_0xe40f('0x47')](_0x342f68[_0xe40f('0x44')],{'$or':_[_0xe40f('0x35')](_0x5e4acf,function(_0x32186d){if(_0x32186d[_0xe40f('0x38')]!==_0xe40f('0x48')){var _0x40baca={};_0x40baca[_0x32186d['name']]={'$like':'%'+_0x5f50e6[_0xe40f('0x3a')][_0xe40f('0x46')]+'%'};return _0x40baca;}})});}_0x342f68=_[_0xe40f('0x47')]({},_0x342f68,_0x5f50e6[_0xe40f('0x49')]);var _0xc8eb7d={'where':_0x342f68[_0xe40f('0x44')]};return db['FreshdeskConfiguration']['count'](_0xc8eb7d)['then'](function(_0x49e40e){_0xfcb3c2[_0xe40f('0x4a')]=_0x49e40e;if(_0x5f50e6['query'][_0xe40f('0x4b')]){_0x342f68['include']=[{'all':!![]}];}return db[_0xe40f('0x36')][_0xe40f('0x4c')](_0x342f68);})[_0xe40f('0x31')](function(_0x384fa8){_0xfcb3c2[_0xe40f('0x4d')]=_0x384fa8;return _0xfcb3c2;})[_0xe40f('0x31')](respondWithFilteredResult(_0x2c374e,_0x342f68))[_0xe40f('0x24')](handleError(_0x2c374e,null));};exports[_0xe40f('0x4e')]=function(_0x3992a5,_0x513e65){var _0x47af34={'raw':![],'where':{'id':_0x3992a5[_0xe40f('0x4f')]['id']}},_0x11689a={};_0x11689a[_0xe40f('0x3e')]=_[_0xe40f('0x3b')](db[_0xe40f('0x36')][_0xe40f('0x50')]);_0x11689a[_0xe40f('0x3a')]=_['keys'](_0x3992a5[_0xe40f('0x3a')]);_0x11689a[_0xe40f('0x3c')]=_['intersection'](_0x11689a['model'],_0x11689a['query']);_0x47af34[_0xe40f('0x3f')]=_[_0xe40f('0x3d')](_0x11689a['model'],qs['fields'](_0x3992a5[_0xe40f('0x3a')][_0xe40f('0x51')]));_0x47af34[_0xe40f('0x3f')]=_0x47af34['attributes'][_0xe40f('0x40')]?_0x47af34['attributes']:_0x11689a[_0xe40f('0x3e')];if(_0x3992a5[_0xe40f('0x3a')][_0xe40f('0x4b')]){_0x47af34[_0xe40f('0x52')]=[{'all':!![]}];}_0x47af34=_['merge']({},_0x47af34,_0x3992a5[_0xe40f('0x49')]);return db['FreshdeskConfiguration'][_0xe40f('0x53')](_0x47af34)[_0xe40f('0x31')](handleEntityNotFound(_0x513e65,null))[_0xe40f('0x31')](respondWithResult(_0x513e65,null))['catch'](handleError(_0x513e65,null));};exports[_0xe40f('0x54')]=function(_0x40c4f5,_0x1e0721){return db['FreshdeskConfiguration'][_0xe40f('0x54')](_0x40c4f5[_0xe40f('0x55')],{})[_0xe40f('0x31')](respondWithResult(_0x1e0721,0xc9))[_0xe40f('0x24')](handleError(_0x1e0721,null));};exports[_0xe40f('0x2f')]=function(_0x3519ba,_0x57deed){if(_0x3519ba[_0xe40f('0x55')]['id']){delete _0x3519ba[_0xe40f('0x55')]['id'];}return db[_0xe40f('0x36')]['find']({'where':{'id':_0x3519ba[_0xe40f('0x4f')]['id']}})[_0xe40f('0x31')](handleEntityNotFound(_0x57deed,null))[_0xe40f('0x31')](saveUpdates(_0x3519ba[_0xe40f('0x55')],null))[_0xe40f('0x31')](respondWithResult(_0x57deed,null))[_0xe40f('0x24')](handleError(_0x57deed,null));};exports['destroy']=function(_0x4a0f5f,_0x40031c){return db[_0xe40f('0x36')][_0xe40f('0x53')]({'where':{'id':_0x4a0f5f[_0xe40f('0x4f')]['id']}})[_0xe40f('0x31')](handleEntityNotFound(_0x40031c,null))[_0xe40f('0x31')](removeEntity(_0x40031c,null))[_0xe40f('0x24')](handleError(_0x40031c,null));};exports[_0xe40f('0x56')]=function(_0x3daf5c,_0x344108,_0x1de094){var _0xce26ab={};var _0x47936c={};var _0x2ff97e;var _0x2317fd;return db[_0xe40f('0x36')][_0xe40f('0x57')]({'where':{'id':_0x3daf5c[_0xe40f('0x4f')]['id']}})[_0xe40f('0x31')](handleEntityNotFound(_0x344108,null))[_0xe40f('0x31')](function(_0x1913bf){if(_0x1913bf){_0x2ff97e=_0x1913bf;_0x47936c[_0xe40f('0x3e')]=_[_0xe40f('0x3b')](db[_0xe40f('0x58')][_0xe40f('0x50')]);_0x47936c[_0xe40f('0x3a')]=_[_0xe40f('0x3b')](_0x3daf5c[_0xe40f('0x3a')]);_0x47936c['filters']=_['intersection'](_0x47936c[_0xe40f('0x3e')],_0x47936c[_0xe40f('0x3a')]);_0xce26ab[_0xe40f('0x3f')]=_['intersection'](_0x47936c[_0xe40f('0x3e')],qs[_0xe40f('0x51')](_0x3daf5c['query']['fields']));_0xce26ab['attributes']=_0xce26ab[_0xe40f('0x3f')][_0xe40f('0x40')]?_0xce26ab[_0xe40f('0x3f')]:_0x47936c['model'];_0xce26ab['order']=qs[_0xe40f('0x43')](_0x3daf5c[_0xe40f('0x3a')][_0xe40f('0x43')]);_0xce26ab[_0xe40f('0x44')]=qs[_0xe40f('0x3c')](_[_0xe40f('0x45')](_0x3daf5c[_0xe40f('0x3a')],_0x47936c[_0xe40f('0x3c')]));if(_0x3daf5c[_0xe40f('0x3a')]['filter']){_0xce26ab['where']=_[_0xe40f('0x47')](_0xce26ab[_0xe40f('0x44')],{'$or':_['map'](_0xce26ab[_0xe40f('0x3f')],function(_0x56495d){var _0x3249d3={};_0x3249d3[_0x56495d]={'$like':'%'+_0x3daf5c[_0xe40f('0x3a')]['filter']+'%'};return _0x3249d3;})});}_0xce26ab=_[_0xe40f('0x47')]({},_0xce26ab,_0x3daf5c[_0xe40f('0x49')]);return _0x2ff97e[_0xe40f('0x56')](_0xce26ab);}})[_0xe40f('0x31')](function(_0x2eadb1){if(_0x2eadb1){_0x2317fd=_0x2eadb1[_0xe40f('0x40')];if(!_0x3daf5c[_0xe40f('0x3a')][_0xe40f('0x41')](_0xe40f('0x42'))){_0xce26ab[_0xe40f('0x29')]=qs['limit'](_0x3daf5c[_0xe40f('0x3a')]['limit']);_0xce26ab[_0xe40f('0x28')]=qs[_0xe40f('0x28')](_0x3daf5c['query'][_0xe40f('0x28')]);}return _0x2ff97e[_0xe40f('0x56')](_0xce26ab);}})[_0xe40f('0x31')](function(_0x22f382){if(_0x22f382){return _0x22f382?{'count':_0x2317fd,'rows':_0x22f382}:null;}})[_0xe40f('0x31')](respondWithResult(_0x344108,null))[_0xe40f('0x24')](handleError(_0x344108,null));};exports[_0xe40f('0x59')]=function(_0x8493ae,_0x52d761,_0x3ece2f){var _0x3f500e={};var _0x217425={};var _0x20b7fd;var _0x2628f2;return db[_0xe40f('0x36')][_0xe40f('0x57')]({'where':{'id':_0x8493ae[_0xe40f('0x4f')]['id']}})[_0xe40f('0x31')](handleEntityNotFound(_0x52d761,null))[_0xe40f('0x31')](function(_0x4a2935){if(_0x4a2935){_0x20b7fd=_0x4a2935;_0x217425[_0xe40f('0x3e')]=_['keys'](db['FreshdeskField'][_0xe40f('0x50')]);_0x217425[_0xe40f('0x3a')]=_['keys'](_0x8493ae[_0xe40f('0x3a')]);_0x217425[_0xe40f('0x3c')]=_[_0xe40f('0x3d')](_0x217425['model'],_0x217425[_0xe40f('0x3a')]);_0x3f500e['attributes']=_[_0xe40f('0x3d')](_0x217425[_0xe40f('0x3e')],qs[_0xe40f('0x51')](_0x8493ae[_0xe40f('0x3a')]['fields']));_0x3f500e[_0xe40f('0x3f')]=_0x3f500e[_0xe40f('0x3f')][_0xe40f('0x40')]?_0x3f500e[_0xe40f('0x3f')]:_0x217425[_0xe40f('0x3e')];_0x3f500e['order']=qs[_0xe40f('0x43')](_0x8493ae[_0xe40f('0x3a')][_0xe40f('0x43')]);_0x3f500e[_0xe40f('0x44')]=qs['filters'](_['pick'](_0x8493ae[_0xe40f('0x3a')],_0x217425['filters']));if(_0x8493ae[_0xe40f('0x3a')][_0xe40f('0x46')]){_0x3f500e[_0xe40f('0x44')]=_['merge'](_0x3f500e[_0xe40f('0x44')],{'$or':_[_0xe40f('0x35')](_0x3f500e[_0xe40f('0x3f')],function(_0x310375){var _0xd5ee04={};_0xd5ee04[_0x310375]={'$like':'%'+_0x8493ae[_0xe40f('0x3a')][_0xe40f('0x46')]+'%'};return _0xd5ee04;})});}_0x3f500e=_[_0xe40f('0x47')]({},_0x3f500e,_0x8493ae[_0xe40f('0x49')]);return _0x20b7fd[_0xe40f('0x59')](_0x3f500e);}})[_0xe40f('0x31')](function(_0x435130){if(_0x435130){_0x2628f2=_0x435130[_0xe40f('0x40')];if(!_0x8493ae[_0xe40f('0x3a')][_0xe40f('0x41')](_0xe40f('0x42'))){_0x3f500e['limit']=qs[_0xe40f('0x29')](_0x8493ae[_0xe40f('0x3a')]['limit']);_0x3f500e[_0xe40f('0x28')]=qs[_0xe40f('0x28')](_0x8493ae[_0xe40f('0x3a')][_0xe40f('0x28')]);}return _0x20b7fd[_0xe40f('0x59')](_0x3f500e);}})[_0xe40f('0x31')](function(_0x9f4b58){if(_0x9f4b58){return _0x9f4b58?{'count':_0x2628f2,'rows':_0x9f4b58}:null;}})[_0xe40f('0x31')](respondWithResult(_0x52d761,null))[_0xe40f('0x24')](handleError(_0x52d761,null));};exports[_0xe40f('0x5a')]=function(_0x2e6efc,_0x554e6d,_0x259c71){var _0x336535={};var _0x339e2e={};var _0x2cee40;var _0x4aa79d;return db[_0xe40f('0x36')][_0xe40f('0x57')]({'where':{'id':_0x2e6efc['params']['id']}})[_0xe40f('0x31')](handleEntityNotFound(_0x554e6d,null))[_0xe40f('0x31')](function(_0xe6c23e){if(_0xe6c23e){_0x2cee40=_0xe6c23e;_0x339e2e[_0xe40f('0x3e')]=_[_0xe40f('0x3b')](db[_0xe40f('0x58')][_0xe40f('0x50')]);_0x339e2e[_0xe40f('0x3a')]=_[_0xe40f('0x3b')](_0x2e6efc[_0xe40f('0x3a')]);_0x339e2e['filters']=_[_0xe40f('0x3d')](_0x339e2e[_0xe40f('0x3e')],_0x339e2e[_0xe40f('0x3a')]);_0x336535['attributes']=_[_0xe40f('0x3d')](_0x339e2e[_0xe40f('0x3e')],qs[_0xe40f('0x51')](_0x2e6efc[_0xe40f('0x3a')][_0xe40f('0x51')]));_0x336535[_0xe40f('0x3f')]=_0x336535[_0xe40f('0x3f')][_0xe40f('0x40')]?_0x336535['attributes']:_0x339e2e[_0xe40f('0x3e')];_0x336535[_0xe40f('0x5b')]=qs[_0xe40f('0x43')](_0x2e6efc[_0xe40f('0x3a')][_0xe40f('0x43')]);_0x336535['where']=qs[_0xe40f('0x3c')](_[_0xe40f('0x45')](_0x2e6efc[_0xe40f('0x3a')],_0x339e2e[_0xe40f('0x3c')]));if(_0x2e6efc['query'][_0xe40f('0x46')]){_0x336535['where']=_[_0xe40f('0x47')](_0x336535[_0xe40f('0x44')],{'$or':_['map'](_0x336535[_0xe40f('0x3f')],function(_0x39dba6){var _0x3966dd={};_0x3966dd[_0x39dba6]={'$like':'%'+_0x2e6efc[_0xe40f('0x3a')][_0xe40f('0x46')]+'%'};return _0x3966dd;})});}_0x336535=_[_0xe40f('0x47')]({},_0x336535,_0x2e6efc[_0xe40f('0x49')]);return _0x2cee40[_0xe40f('0x5a')](_0x336535);}})[_0xe40f('0x31')](function(_0x1f6fcb){if(_0x1f6fcb){_0x4aa79d=_0x1f6fcb[_0xe40f('0x40')];if(!_0x2e6efc[_0xe40f('0x3a')][_0xe40f('0x41')](_0xe40f('0x42'))){_0x336535[_0xe40f('0x29')]=qs[_0xe40f('0x29')](_0x2e6efc['query']['limit']);_0x336535['offset']=qs[_0xe40f('0x28')](_0x2e6efc['query'][_0xe40f('0x28')]);}return _0x2cee40[_0xe40f('0x5a')](_0x336535);}})[_0xe40f('0x31')](function(_0x3b8f8c){if(_0x3b8f8c){return _0x3b8f8c?{'count':_0x4aa79d,'rows':_0x3b8f8c}:null;}})[_0xe40f('0x31')](respondWithResult(_0x554e6d,null))['catch'](handleError(_0x554e6d,null));};exports[_0xe40f('0x5c')]=function(_0x10e98f,_0x5873b5,_0x3ac5c4){var _0x505ab6={};var _0x2e6830={};var _0x1da98a;var _0x1137ce;return db[_0xe40f('0x36')][_0xe40f('0x57')]({'where':{'id':_0x10e98f[_0xe40f('0x4f')]['id']}})[_0xe40f('0x31')](handleEntityNotFound(_0x5873b5,null))[_0xe40f('0x31')](function(_0x4c5b68){if(_0x4c5b68){_0x1da98a=_0x4c5b68;_0x2e6830[_0xe40f('0x3e')]=_[_0xe40f('0x3b')](db[_0xe40f('0x5d')][_0xe40f('0x50')]);_0x2e6830[_0xe40f('0x3a')]=_['keys'](_0x10e98f[_0xe40f('0x3a')]);_0x2e6830[_0xe40f('0x3c')]=_['intersection'](_0x2e6830[_0xe40f('0x3e')],_0x2e6830[_0xe40f('0x3a')]);_0x505ab6[_0xe40f('0x3f')]=_[_0xe40f('0x3d')](_0x2e6830[_0xe40f('0x3e')],qs['fields'](_0x10e98f[_0xe40f('0x3a')][_0xe40f('0x51')]));_0x505ab6['attributes']=_0x505ab6[_0xe40f('0x3f')][_0xe40f('0x40')]?_0x505ab6[_0xe40f('0x3f')]:_0x2e6830[_0xe40f('0x3e')];_0x505ab6['order']=qs['sort'](_0x10e98f[_0xe40f('0x3a')][_0xe40f('0x43')]);_0x505ab6[_0xe40f('0x44')]=qs[_0xe40f('0x3c')](_[_0xe40f('0x45')](_0x10e98f[_0xe40f('0x3a')],_0x2e6830[_0xe40f('0x3c')]));if(_0x10e98f[_0xe40f('0x3a')]['filter']){_0x505ab6[_0xe40f('0x44')]=_[_0xe40f('0x47')](_0x505ab6[_0xe40f('0x44')],{'$or':_[_0xe40f('0x35')](_0x505ab6[_0xe40f('0x3f')],function(_0x20b5d3){var _0x180341={};_0x180341[_0x20b5d3]={'$like':'%'+_0x10e98f[_0xe40f('0x3a')][_0xe40f('0x46')]+'%'};return _0x180341;})});}_0x505ab6=_[_0xe40f('0x47')]({},_0x505ab6,_0x10e98f['options']);return _0x1da98a[_0xe40f('0x5c')](_0x505ab6);}})[_0xe40f('0x31')](function(_0x58c1b7){if(_0x58c1b7){_0x1137ce=_0x58c1b7[_0xe40f('0x40')];if(!_0x10e98f['query'][_0xe40f('0x41')](_0xe40f('0x42'))){_0x505ab6[_0xe40f('0x29')]=qs[_0xe40f('0x29')](_0x10e98f[_0xe40f('0x3a')][_0xe40f('0x29')]);_0x505ab6[_0xe40f('0x28')]=qs['offset'](_0x10e98f[_0xe40f('0x3a')]['offset']);}return _0x1da98a[_0xe40f('0x5c')](_0x505ab6);}})[_0xe40f('0x31')](function(_0x263ece){if(_0x263ece){return _0x263ece?{'count':_0x1137ce,'rows':_0x263ece}:null;}})[_0xe40f('0x31')](respondWithResult(_0x5873b5,null))['catch'](handleError(_0x5873b5,null));};exports[_0xe40f('0x5e')]=function(_0x4092c9,_0x2c156c,_0x3d7eb5){if(_0x4092c9[_0xe40f('0x55')]['id']){delete _0x4092c9[_0xe40f('0x55')]['id'];}return db[_0xe40f('0x36')][_0xe40f('0x57')]({'where':{'id':_0x4092c9['params']['id']}})['then'](handleEntityNotFound(_0x2c156c,null))['then'](function(_0x1d1f0d){if(_0x1d1f0d){return _0x1d1f0d[_0xe40f('0x5e')](_0x4092c9['body'][_0xe40f('0x5f')]||[]);}return null;})[_0xe40f('0x31')](respondWithResult(_0x2c156c,null))['catch'](handleError(_0x2c156c,null));}; \ No newline at end of file +var _0x98e0=['Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','set','apply','save','update','then','destroy','end','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','count','includeAll','include','rows','show','params','find','create','body','getFields','FreshdeskField','pick','options','findOne','getSubjects','getDescriptions','getTags'];(function(_0x5da388,_0x453481){var _0x418fee=function(_0x57ffc1){while(--_0x57ffc1){_0x5da388['push'](_0x5da388['shift']());}};_0x418fee(++_0x453481);}(_0x98e0,0x117));var _0x098e=function(_0x45d3d8,_0x32be22){_0x45d3d8=_0x45d3d8-0x0;var _0xb9b21c=_0x98e0[_0x45d3d8];return _0xb9b21c;};'use strict';var pdf=require(_0x098e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x098e('0x1'));var zipdir=require(_0x098e('0x2'));var jsonpatch=require(_0x098e('0x3'));var rp=require(_0x098e('0x4'));var moment=require('moment');var BPromise=require(_0x098e('0x5'));var Mustache=require(_0x098e('0x6'));var util=require(_0x098e('0x7'));var path=require(_0x098e('0x8'));var sox=require(_0x098e('0x9'));var csv=require('to-csv');var ejs=require(_0x098e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x098e('0xb'));var crypto=require(_0x098e('0xc'));var jsforce=require(_0x098e('0xd'));var deskjs=require(_0x098e('0xe'));var toCsv=require(_0x098e('0xf'));var querystring=require(_0x098e('0x10'));var Papa=require(_0x098e('0x11'));var Redis=require('ioredis');var authService=require(_0x098e('0x12'));var qs=require(_0x098e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x098e('0x14'))('api');var utils=require(_0x098e('0x15'));var config=require(_0x098e('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x098e('0x17'));var client=jayson[_0x098e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x225d95,_0x4f3c59,_0x1cea7f,_0x18e592){return new BPromise(function(_0x5e4747,_0x1450a5){var _0x8c1a9b=_0x18e592||client;return _0x8c1a9b[_0x098e('0x19')](_0x225d95,_0x1cea7f)['then'](function(_0x2f7604){logger[_0x098e('0x1a')](_0x098e('0x1b'),_0x4f3c59,_0x098e('0x1c'));logger[_0x098e('0x1d')](_0x098e('0x1e'),_0x4f3c59,_0x098e('0x1c'),JSON[_0x098e('0x1f')](_0x2f7604));if(_0x2f7604[_0x098e('0x20')]){if(_0x2f7604[_0x098e('0x20')]['code']===0x1f4){logger[_0x098e('0x20')](_0x098e('0x1b'),_0x4f3c59,_0x2f7604[_0x098e('0x20')][_0x098e('0x21')]);return _0x1450a5(_0x2f7604['error'][_0x098e('0x21')]);}logger[_0x098e('0x20')](_0x098e('0x1b'),_0x4f3c59,_0x2f7604['error'][_0x098e('0x21')]);return _0x5e4747(_0x2f7604[_0x098e('0x20')]['message']);}else{logger['info'](_0x098e('0x1b'),_0x4f3c59,_0x098e('0x1c'));_0x5e4747(_0x2f7604[_0x098e('0x22')][_0x098e('0x21')]);}})[_0x098e('0x23')](function(_0x41b422){logger['error'](_0x098e('0x1b'),_0x4f3c59,_0x41b422);_0x1450a5(_0x41b422);});});}function respondWithStatusCode(_0x1a8b40,_0x5c00c5){_0x5c00c5=_0x5c00c5||0xcc;return function(_0x5205ac){if(_0x5205ac){return _0x1a8b40[_0x098e('0x24')](_0x5c00c5);}return _0x1a8b40[_0x098e('0x25')](_0x5c00c5)['end']();};}function respondWithResult(_0x237f1c,_0x24ca7f){_0x24ca7f=_0x24ca7f||0xc8;return function(_0x3f1233){if(_0x3f1233){return _0x237f1c['status'](_0x24ca7f)[_0x098e('0x26')](_0x3f1233);}};}function respondWithFilteredResult(_0x47bee2,_0x30abb6){return function(_0x4efedb){if(_0x4efedb){var _0x1c05e4=_0x4efedb['count'],_0x19061f=_0x30abb6[_0x098e('0x27')],_0x34de98=_0x30abb6[_0x098e('0x27')]+_0x30abb6[_0x098e('0x28')],_0x7c32a;if(_0x34de98>=_0x1c05e4){_0x34de98=_0x1c05e4;_0x7c32a=0xc8;}else{_0x7c32a=0xce;}_0x47bee2[_0x098e('0x25')](_0x7c32a);return _0x47bee2[_0x098e('0x29')]('Content-Range',_0x19061f+'-'+_0x34de98+'/'+_0x1c05e4)['json'](_0x4efedb);}return null;};}function patchUpdates(_0x4e8528){return function(_0x13e8af){try{jsonpatch[_0x098e('0x2a')](_0x13e8af,_0x4e8528,!![]);}catch(_0x4cf97a){return BPromise['reject'](_0x4cf97a);}return _0x13e8af[_0x098e('0x2b')]();};}function saveUpdates(_0x392378,_0xffcb4d){return function(_0x2d56aa){if(_0x2d56aa){return _0x2d56aa[_0x098e('0x2c')](_0x392378)[_0x098e('0x2d')](function(_0x4d48c2){return _0x4d48c2;});}return null;};}function removeEntity(_0x3695fc,_0xd69973){return function(_0x1b935c){if(_0x1b935c){return _0x1b935c[_0x098e('0x2e')]()[_0x098e('0x2d')](function(){_0x3695fc[_0x098e('0x25')](0xcc)[_0x098e('0x2f')]();});}};}function handleEntityNotFound(_0x496abe,_0x480d72){return function(_0x3c578d){if(!_0x3c578d){_0x496abe[_0x098e('0x24')](0x194);}return _0x3c578d;};}function handleError(_0x55db87,_0x1b0a6a){_0x1b0a6a=_0x1b0a6a||0x1f4;return function(_0x39fa69){logger[_0x098e('0x20')](_0x39fa69[_0x098e('0x30')]);if(_0x39fa69['name']){delete _0x39fa69[_0x098e('0x31')];}_0x55db87[_0x098e('0x25')](_0x1b0a6a)[_0x098e('0x32')](_0x39fa69);};}exports['index']=function(_0x55299b,_0x5979fe){var _0x809b23={},_0x2a18f2={},_0x518f01={'count':0x0,'rows':[]};var _0x3132e2=_[_0x098e('0x33')](db[_0x098e('0x34')][_0x098e('0x35')],function(_0x46fe09){return{'name':_0x46fe09[_0x098e('0x36')],'type':_0x46fe09[_0x098e('0x37')][_0x098e('0x38')]};});_0x2a18f2[_0x098e('0x39')]=_['map'](_0x3132e2,'name');_0x2a18f2[_0x098e('0x3a')]=_[_0x098e('0x3b')](_0x55299b['query']);_0x2a18f2[_0x098e('0x3c')]=_[_0x098e('0x3d')](_0x2a18f2['model'],_0x2a18f2[_0x098e('0x3a')]);_0x809b23[_0x098e('0x3e')]=_[_0x098e('0x3d')](_0x2a18f2['model'],qs[_0x098e('0x3f')](_0x55299b[_0x098e('0x3a')][_0x098e('0x3f')]));_0x809b23[_0x098e('0x3e')]=_0x809b23[_0x098e('0x3e')][_0x098e('0x40')]?_0x809b23[_0x098e('0x3e')]:_0x2a18f2[_0x098e('0x39')];if(!_0x55299b[_0x098e('0x3a')][_0x098e('0x41')](_0x098e('0x42'))){_0x809b23[_0x098e('0x28')]=qs['limit'](_0x55299b[_0x098e('0x3a')][_0x098e('0x28')]);_0x809b23[_0x098e('0x27')]=qs[_0x098e('0x27')](_0x55299b[_0x098e('0x3a')][_0x098e('0x27')]);}_0x809b23[_0x098e('0x43')]=qs[_0x098e('0x44')](_0x55299b[_0x098e('0x3a')][_0x098e('0x44')]);_0x809b23[_0x098e('0x45')]=qs[_0x098e('0x3c')](_['pick'](_0x55299b[_0x098e('0x3a')],_0x2a18f2[_0x098e('0x3c')]),_0x3132e2);if(_0x55299b['query'][_0x098e('0x46')]){_0x809b23[_0x098e('0x45')]=_[_0x098e('0x47')](_0x809b23['where'],{'$or':_[_0x098e('0x33')](_0x3132e2,function(_0xb54da){if(_0xb54da[_0x098e('0x37')]!=='VIRTUAL'){var _0x597332={};_0x597332[_0xb54da['name']]={'$like':'%'+_0x55299b[_0x098e('0x3a')][_0x098e('0x46')]+'%'};return _0x597332;}})});}_0x809b23=_[_0x098e('0x47')]({},_0x809b23,_0x55299b['options']);var _0x5a31f1={'where':_0x809b23[_0x098e('0x45')]};return db[_0x098e('0x34')][_0x098e('0x48')](_0x5a31f1)[_0x098e('0x2d')](function(_0x1e4a4f){_0x518f01['count']=_0x1e4a4f;if(_0x55299b['query'][_0x098e('0x49')]){_0x809b23[_0x098e('0x4a')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x809b23);})['then'](function(_0x3229e1){_0x518f01[_0x098e('0x4b')]=_0x3229e1;return _0x518f01;})[_0x098e('0x2d')](respondWithFilteredResult(_0x5979fe,_0x809b23))[_0x098e('0x23')](handleError(_0x5979fe,null));};exports[_0x098e('0x4c')]=function(_0xe014dc,_0x4153cf){var _0x895ae8={'raw':![],'where':{'id':_0xe014dc[_0x098e('0x4d')]['id']}},_0x11e764={};_0x11e764['model']=_[_0x098e('0x3b')](db[_0x098e('0x34')]['rawAttributes']);_0x11e764[_0x098e('0x3a')]=_['keys'](_0xe014dc[_0x098e('0x3a')]);_0x11e764[_0x098e('0x3c')]=_['intersection'](_0x11e764[_0x098e('0x39')],_0x11e764[_0x098e('0x3a')]);_0x895ae8['attributes']=_[_0x098e('0x3d')](_0x11e764[_0x098e('0x39')],qs['fields'](_0xe014dc['query']['fields']));_0x895ae8[_0x098e('0x3e')]=_0x895ae8[_0x098e('0x3e')][_0x098e('0x40')]?_0x895ae8[_0x098e('0x3e')]:_0x11e764[_0x098e('0x39')];if(_0xe014dc[_0x098e('0x3a')][_0x098e('0x49')]){_0x895ae8['include']=[{'all':!![]}];}_0x895ae8=_[_0x098e('0x47')]({},_0x895ae8,_0xe014dc['options']);return db[_0x098e('0x34')][_0x098e('0x4e')](_0x895ae8)['then'](handleEntityNotFound(_0x4153cf,null))['then'](respondWithResult(_0x4153cf,null))[_0x098e('0x23')](handleError(_0x4153cf,null));};exports[_0x098e('0x4f')]=function(_0x2e4127,_0x545365){return db[_0x098e('0x34')][_0x098e('0x4f')](_0x2e4127['body'],{})[_0x098e('0x2d')](respondWithResult(_0x545365,0xc9))[_0x098e('0x23')](handleError(_0x545365,null));};exports['update']=function(_0x15041d,_0x4abcbc){if(_0x15041d['body']['id']){delete _0x15041d['body']['id'];}return db[_0x098e('0x34')][_0x098e('0x4e')]({'where':{'id':_0x15041d[_0x098e('0x4d')]['id']}})[_0x098e('0x2d')](handleEntityNotFound(_0x4abcbc,null))[_0x098e('0x2d')](saveUpdates(_0x15041d[_0x098e('0x50')],null))[_0x098e('0x2d')](respondWithResult(_0x4abcbc,null))[_0x098e('0x23')](handleError(_0x4abcbc,null));};exports['destroy']=function(_0x1ee3bc,_0x3fc616){return db[_0x098e('0x34')][_0x098e('0x4e')]({'where':{'id':_0x1ee3bc[_0x098e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3fc616,null))[_0x098e('0x2d')](removeEntity(_0x3fc616,null))[_0x098e('0x23')](handleError(_0x3fc616,null));};exports[_0x098e('0x51')]=function(_0x124441,_0x456b96,_0x5c6344){var _0x248f57={};var _0x3adb92={};var _0x1bb9a7;var _0x40305d;return db[_0x098e('0x34')]['findOne']({'where':{'id':_0x124441[_0x098e('0x4d')]['id']}})[_0x098e('0x2d')](handleEntityNotFound(_0x456b96,null))[_0x098e('0x2d')](function(_0x1d3f24){if(_0x1d3f24){_0x1bb9a7=_0x1d3f24;_0x3adb92[_0x098e('0x39')]=_[_0x098e('0x3b')](db[_0x098e('0x52')][_0x098e('0x35')]);_0x3adb92[_0x098e('0x3a')]=_[_0x098e('0x3b')](_0x124441[_0x098e('0x3a')]);_0x3adb92['filters']=_[_0x098e('0x3d')](_0x3adb92[_0x098e('0x39')],_0x3adb92[_0x098e('0x3a')]);_0x248f57[_0x098e('0x3e')]=_['intersection'](_0x3adb92[_0x098e('0x39')],qs['fields'](_0x124441[_0x098e('0x3a')][_0x098e('0x3f')]));_0x248f57[_0x098e('0x3e')]=_0x248f57[_0x098e('0x3e')][_0x098e('0x40')]?_0x248f57[_0x098e('0x3e')]:_0x3adb92[_0x098e('0x39')];_0x248f57[_0x098e('0x43')]=qs['sort'](_0x124441['query'][_0x098e('0x44')]);_0x248f57[_0x098e('0x45')]=qs[_0x098e('0x3c')](_[_0x098e('0x53')](_0x124441[_0x098e('0x3a')],_0x3adb92['filters']));if(_0x124441['query'][_0x098e('0x46')]){_0x248f57[_0x098e('0x45')]=_[_0x098e('0x47')](_0x248f57['where'],{'$or':_[_0x098e('0x33')](_0x248f57[_0x098e('0x3e')],function(_0x3fb647){var _0x21e1e5={};_0x21e1e5[_0x3fb647]={'$like':'%'+_0x124441['query'][_0x098e('0x46')]+'%'};return _0x21e1e5;})});}_0x248f57=_[_0x098e('0x47')]({},_0x248f57,_0x124441[_0x098e('0x54')]);return _0x1bb9a7[_0x098e('0x51')](_0x248f57);}})[_0x098e('0x2d')](function(_0xb550cb){if(_0xb550cb){_0x40305d=_0xb550cb[_0x098e('0x40')];if(!_0x124441['query'][_0x098e('0x41')](_0x098e('0x42'))){_0x248f57[_0x098e('0x28')]=qs['limit'](_0x124441[_0x098e('0x3a')]['limit']);_0x248f57['offset']=qs['offset'](_0x124441[_0x098e('0x3a')][_0x098e('0x27')]);}return _0x1bb9a7['getFields'](_0x248f57);}})[_0x098e('0x2d')](function(_0x525c1a){if(_0x525c1a){return _0x525c1a?{'count':_0x40305d,'rows':_0x525c1a}:null;}})[_0x098e('0x2d')](respondWithResult(_0x456b96,null))['catch'](handleError(_0x456b96,null));};exports['getSubjects']=function(_0x15fe91,_0x5d7bf8,_0x3c103e){var _0x5c8a82={};var _0x57b4f1={};var _0x30ef0d;var _0x31493a;return db['FreshdeskConfiguration'][_0x098e('0x55')]({'where':{'id':_0x15fe91['params']['id']}})[_0x098e('0x2d')](handleEntityNotFound(_0x5d7bf8,null))[_0x098e('0x2d')](function(_0x17fddb){if(_0x17fddb){_0x30ef0d=_0x17fddb;_0x57b4f1[_0x098e('0x39')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x57b4f1[_0x098e('0x3a')]=_[_0x098e('0x3b')](_0x15fe91[_0x098e('0x3a')]);_0x57b4f1[_0x098e('0x3c')]=_[_0x098e('0x3d')](_0x57b4f1[_0x098e('0x39')],_0x57b4f1[_0x098e('0x3a')]);_0x5c8a82[_0x098e('0x3e')]=_[_0x098e('0x3d')](_0x57b4f1[_0x098e('0x39')],qs[_0x098e('0x3f')](_0x15fe91['query'][_0x098e('0x3f')]));_0x5c8a82['attributes']=_0x5c8a82[_0x098e('0x3e')][_0x098e('0x40')]?_0x5c8a82[_0x098e('0x3e')]:_0x57b4f1[_0x098e('0x39')];_0x5c8a82['order']=qs[_0x098e('0x44')](_0x15fe91[_0x098e('0x3a')][_0x098e('0x44')]);_0x5c8a82[_0x098e('0x45')]=qs['filters'](_[_0x098e('0x53')](_0x15fe91[_0x098e('0x3a')],_0x57b4f1[_0x098e('0x3c')]));if(_0x15fe91[_0x098e('0x3a')][_0x098e('0x46')]){_0x5c8a82['where']=_[_0x098e('0x47')](_0x5c8a82[_0x098e('0x45')],{'$or':_[_0x098e('0x33')](_0x5c8a82['attributes'],function(_0x53adb5){var _0x10bd36={};_0x10bd36[_0x53adb5]={'$like':'%'+_0x15fe91[_0x098e('0x3a')][_0x098e('0x46')]+'%'};return _0x10bd36;})});}_0x5c8a82=_['merge']({},_0x5c8a82,_0x15fe91[_0x098e('0x54')]);return _0x30ef0d[_0x098e('0x56')](_0x5c8a82);}})[_0x098e('0x2d')](function(_0x31b456){if(_0x31b456){_0x31493a=_0x31b456['length'];if(!_0x15fe91[_0x098e('0x3a')][_0x098e('0x41')](_0x098e('0x42'))){_0x5c8a82[_0x098e('0x28')]=qs[_0x098e('0x28')](_0x15fe91[_0x098e('0x3a')][_0x098e('0x28')]);_0x5c8a82[_0x098e('0x27')]=qs[_0x098e('0x27')](_0x15fe91[_0x098e('0x3a')][_0x098e('0x27')]);}return _0x30ef0d[_0x098e('0x56')](_0x5c8a82);}})[_0x098e('0x2d')](function(_0x57ce71){if(_0x57ce71){return _0x57ce71?{'count':_0x31493a,'rows':_0x57ce71}:null;}})[_0x098e('0x2d')](respondWithResult(_0x5d7bf8,null))[_0x098e('0x23')](handleError(_0x5d7bf8,null));};exports[_0x098e('0x57')]=function(_0x177381,_0x25adf5,_0x5b18bb){var _0x4af3b3={};var _0x86fa96={};var _0x4dd025;var _0x4a6693;return db[_0x098e('0x34')]['findOne']({'where':{'id':_0x177381['params']['id']}})['then'](handleEntityNotFound(_0x25adf5,null))[_0x098e('0x2d')](function(_0x4a3a25){if(_0x4a3a25){_0x4dd025=_0x4a3a25;_0x86fa96[_0x098e('0x39')]=_[_0x098e('0x3b')](db['FreshdeskField']['rawAttributes']);_0x86fa96[_0x098e('0x3a')]=_['keys'](_0x177381[_0x098e('0x3a')]);_0x86fa96[_0x098e('0x3c')]=_[_0x098e('0x3d')](_0x86fa96['model'],_0x86fa96['query']);_0x4af3b3[_0x098e('0x3e')]=_[_0x098e('0x3d')](_0x86fa96[_0x098e('0x39')],qs['fields'](_0x177381[_0x098e('0x3a')][_0x098e('0x3f')]));_0x4af3b3[_0x098e('0x3e')]=_0x4af3b3[_0x098e('0x3e')][_0x098e('0x40')]?_0x4af3b3[_0x098e('0x3e')]:_0x86fa96[_0x098e('0x39')];_0x4af3b3['order']=qs['sort'](_0x177381[_0x098e('0x3a')][_0x098e('0x44')]);_0x4af3b3[_0x098e('0x45')]=qs['filters'](_['pick'](_0x177381[_0x098e('0x3a')],_0x86fa96['filters']));if(_0x177381[_0x098e('0x3a')][_0x098e('0x46')]){_0x4af3b3[_0x098e('0x45')]=_[_0x098e('0x47')](_0x4af3b3[_0x098e('0x45')],{'$or':_[_0x098e('0x33')](_0x4af3b3[_0x098e('0x3e')],function(_0x4c89e8){var _0x3f11f4={};_0x3f11f4[_0x4c89e8]={'$like':'%'+_0x177381['query'][_0x098e('0x46')]+'%'};return _0x3f11f4;})});}_0x4af3b3=_[_0x098e('0x47')]({},_0x4af3b3,_0x177381['options']);return _0x4dd025[_0x098e('0x57')](_0x4af3b3);}})[_0x098e('0x2d')](function(_0x117884){if(_0x117884){_0x4a6693=_0x117884['length'];if(!_0x177381['query'][_0x098e('0x41')]('nolimit')){_0x4af3b3[_0x098e('0x28')]=qs[_0x098e('0x28')](_0x177381[_0x098e('0x3a')][_0x098e('0x28')]);_0x4af3b3[_0x098e('0x27')]=qs[_0x098e('0x27')](_0x177381[_0x098e('0x3a')][_0x098e('0x27')]);}return _0x4dd025[_0x098e('0x57')](_0x4af3b3);}})['then'](function(_0x34504f){if(_0x34504f){return _0x34504f?{'count':_0x4a6693,'rows':_0x34504f}:null;}})[_0x098e('0x2d')](respondWithResult(_0x25adf5,null))[_0x098e('0x23')](handleError(_0x25adf5,null));};exports[_0x098e('0x58')]=function(_0x3477e1,_0x5bcfcf,_0xc2382e){var _0x3c9f76={};var _0x2a0cc7={};var _0x60ff2d;var _0x16501e;return db[_0x098e('0x34')][_0x098e('0x55')]({'where':{'id':_0x3477e1['params']['id']}})[_0x098e('0x2d')](handleEntityNotFound(_0x5bcfcf,null))['then'](function(_0x31a4b1){if(_0x31a4b1){_0x60ff2d=_0x31a4b1;_0x2a0cc7[_0x098e('0x39')]=_[_0x098e('0x3b')](db[_0x098e('0x59')][_0x098e('0x35')]);_0x2a0cc7[_0x098e('0x3a')]=_[_0x098e('0x3b')](_0x3477e1['query']);_0x2a0cc7[_0x098e('0x3c')]=_[_0x098e('0x3d')](_0x2a0cc7[_0x098e('0x39')],_0x2a0cc7['query']);_0x3c9f76[_0x098e('0x3e')]=_[_0x098e('0x3d')](_0x2a0cc7[_0x098e('0x39')],qs[_0x098e('0x3f')](_0x3477e1[_0x098e('0x3a')][_0x098e('0x3f')]));_0x3c9f76[_0x098e('0x3e')]=_0x3c9f76[_0x098e('0x3e')][_0x098e('0x40')]?_0x3c9f76['attributes']:_0x2a0cc7[_0x098e('0x39')];_0x3c9f76[_0x098e('0x43')]=qs['sort'](_0x3477e1[_0x098e('0x3a')][_0x098e('0x44')]);_0x3c9f76[_0x098e('0x45')]=qs['filters'](_[_0x098e('0x53')](_0x3477e1[_0x098e('0x3a')],_0x2a0cc7['filters']));if(_0x3477e1[_0x098e('0x3a')][_0x098e('0x46')]){_0x3c9f76[_0x098e('0x45')]=_[_0x098e('0x47')](_0x3c9f76['where'],{'$or':_['map'](_0x3c9f76[_0x098e('0x3e')],function(_0x199835){var _0xb8782e={};_0xb8782e[_0x199835]={'$like':'%'+_0x3477e1[_0x098e('0x3a')][_0x098e('0x46')]+'%'};return _0xb8782e;})});}_0x3c9f76=_[_0x098e('0x47')]({},_0x3c9f76,_0x3477e1['options']);return _0x60ff2d[_0x098e('0x58')](_0x3c9f76);}})['then'](function(_0x3156f2){if(_0x3156f2){_0x16501e=_0x3156f2[_0x098e('0x40')];if(!_0x3477e1['query']['hasOwnProperty']('nolimit')){_0x3c9f76[_0x098e('0x28')]=qs['limit'](_0x3477e1[_0x098e('0x3a')][_0x098e('0x28')]);_0x3c9f76[_0x098e('0x27')]=qs[_0x098e('0x27')](_0x3477e1[_0x098e('0x3a')][_0x098e('0x27')]);}return _0x60ff2d[_0x098e('0x58')](_0x3c9f76);}})[_0x098e('0x2d')](function(_0x3724f7){if(_0x3724f7){return _0x3724f7?{'count':_0x16501e,'rows':_0x3724f7}:null;}})[_0x098e('0x2d')](respondWithResult(_0x5bcfcf,null))[_0x098e('0x23')](handleError(_0x5bcfcf,null));};exports[_0x098e('0x5a')]=function(_0x5d488c,_0x1cd419,_0x41c30d){if(_0x5d488c['body']['id']){delete _0x5d488c[_0x098e('0x50')]['id'];}return db[_0x098e('0x34')][_0x098e('0x55')]({'where':{'id':_0x5d488c[_0x098e('0x4d')]['id']}})[_0x098e('0x2d')](handleEntityNotFound(_0x1cd419,null))['then'](function(_0x337e89){if(_0x337e89){return _0x337e89[_0x098e('0x5a')](_0x5d488c['body'][_0x098e('0x5b')]||[]);}return null;})[_0x098e('0x2d')](respondWithResult(_0x1cd419,null))[_0x098e('0x23')](handleError(_0x1cd419,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3b34887..a9984ff 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 _0x7491=['int_freshdesk_configurations','util','../../config/logger','api','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','FreshdeskConfiguration'];(function(_0x3968f2,_0x2fd04b){var _0x4a607e=function(_0x501bbb){while(--_0x501bbb){_0x3968f2['push'](_0x3968f2['shift']());}};_0x4a607e(++_0x2fd04b);}(_0x7491,0x99));var _0x1749=function(_0x5e8e3b,_0x1b7fd0){_0x5e8e3b=_0x5e8e3b-0x0;var _0x218ee8=_0x7491[_0x5e8e3b];return _0x218ee8;};'use strict';var _=require('lodash');var util=require(_0x1749('0x0'));var logger=require(_0x1749('0x1'))(_0x1749('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(_0x1749('0x3'));var config=require(_0x1749('0x4'));var attributes=require(_0x1749('0x5'));module['exports']=function(_0x388848,_0x346935){return _0x388848['define'](_0x1749('0x6'),attributes,{'tableName':_0x1749('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95ad=['request-promise','rimraf','../../config/environment','exports','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x5a7dd0,_0x309acb){var _0x111378=function(_0x5bbb07){while(--_0x5bbb07){_0x5a7dd0['push'](_0x5a7dd0['shift']());}};_0x111378(++_0x309acb);}(_0x95ad,0x195));var _0xd95a=function(_0x583cbd,_0x4fcaa6){_0x583cbd=_0x583cbd-0x0;var _0x178819=_0x95ad[_0x583cbd];return _0x178819;};'use strict';var _=require(_0xd95a('0x0'));var util=require(_0xd95a('0x1'));var logger=require(_0xd95a('0x2'))(_0xd95a('0x3'));var moment=require(_0xd95a('0x4'));var BPromise=require('bluebird');var rp=require(_0xd95a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd95a('0x6'));var config=require(_0xd95a('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xd95a('0x8')]=function(_0x36845a,_0x415637){return _0x36845a['define']('FreshdeskConfiguration',attributes,{'tableName':_0xd95a('0x9'),'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 f9a0cfd..d2d9832 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 _0xaaf8=['rpc','jayson/promise','client','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x412698,_0x43e3ff){var _0x1e7224=function(_0x5bb633){while(--_0x5bb633){_0x412698['push'](_0x412698['shift']());}};_0x1e7224(++_0x43e3ff);}(_0xaaf8,0x19d));var _0x8aaf=function(_0xddd82e,_0xd79a77){_0xddd82e=_0xddd82e-0x0;var _0x468240=_0xaaf8[_0xddd82e];return _0x468240;};'use strict';var _=require(_0x8aaf('0x0'));var util=require(_0x8aaf('0x1'));var moment=require(_0x8aaf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aaf('0x3'));var db=require(_0x8aaf('0x4'))['db'];var utils=require(_0x8aaf('0x5'));var logger=require(_0x8aaf('0x6'))(_0x8aaf('0x7'));var config=require('../../config/environment');var jayson=require(_0x8aaf('0x8'));var client=jayson[_0x8aaf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a353e,_0x2fd2f2,_0xede507){return new BPromise(function(_0x49e151,_0x592e83){return client['request'](_0x3a353e,_0xede507)['then'](function(_0x39e1d9){logger[_0x8aaf('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2fd2f2,_0x8aaf('0xb'));logger[_0x8aaf('0xc')](_0x8aaf('0xd'),_0x2fd2f2,_0x8aaf('0xb'),JSON[_0x8aaf('0xe')](_0x39e1d9));if(_0x39e1d9[_0x8aaf('0xf')]){if(_0x39e1d9['error'][_0x8aaf('0x10')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2fd2f2,_0x39e1d9[_0x8aaf('0xf')][_0x8aaf('0x11')]);return _0x592e83(_0x39e1d9[_0x8aaf('0xf')][_0x8aaf('0x11')]);}logger[_0x8aaf('0xf')](_0x8aaf('0x12'),_0x2fd2f2,_0x39e1d9[_0x8aaf('0xf')][_0x8aaf('0x11')]);return _0x49e151(_0x39e1d9[_0x8aaf('0xf')][_0x8aaf('0x11')]);}else{logger[_0x8aaf('0xa')](_0x8aaf('0x12'),_0x2fd2f2,'request\x20sent');_0x49e151(_0x39e1d9[_0x8aaf('0x13')][_0x8aaf('0x11')]);}})[_0x8aaf('0x14')](function(_0x4a1cc9){logger[_0x8aaf('0xf')](_0x8aaf('0x12'),_0x2fd2f2,_0x4a1cc9);_0x592e83(_0x4a1cc9);});});} \ No newline at end of file +var _0xc205=['stringify','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc205,0x1a7));var _0x5c20=function(_0x57e47a,_0x5257f8){_0x57e47a=_0x57e47a-0x0;var _0x56a66f=_0xc205[_0x57e47a];return _0x56a66f;};'use strict';var _=require(_0x5c20('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5c20('0x1'));var rs=require(_0x5c20('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c20('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5c20('0x4'));var config=require(_0x5c20('0x5'));var jayson=require(_0x5c20('0x6'));var client=jayson[_0x5c20('0x7')][_0x5c20('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5585f0,_0x242bf7,_0x222b1d){return new BPromise(function(_0x28e7b9,_0x1e203a){return client['request'](_0x5585f0,_0x222b1d)[_0x5c20('0x9')](function(_0x1a1977){logger[_0x5c20('0xa')](_0x5c20('0xb'),_0x242bf7,'request\x20sent');logger['debug'](_0x5c20('0xc'),_0x242bf7,_0x5c20('0xd'),JSON[_0x5c20('0xe')](_0x1a1977));if(_0x1a1977[_0x5c20('0xf')]){if(_0x1a1977['error'][_0x5c20('0x10')]===0x1f4){logger[_0x5c20('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x242bf7,_0x1a1977[_0x5c20('0xf')][_0x5c20('0x11')]);return _0x1e203a(_0x1a1977['error'][_0x5c20('0x11')]);}logger[_0x5c20('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x242bf7,_0x1a1977[_0x5c20('0xf')][_0x5c20('0x11')]);return _0x28e7b9(_0x1a1977[_0x5c20('0xf')][_0x5c20('0x11')]);}else{logger[_0x5c20('0xa')](_0x5c20('0xb'),_0x242bf7,_0x5c20('0xd'));_0x28e7b9(_0x1a1977['result']['message']);}})[_0x5c20('0x12')](function(_0x45f1fd){logger['error'](_0x5c20('0xb'),_0x242bf7,_0x45f1fd);_0x1e203a(_0x45f1fd);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 1334fb2..67f8fc0 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 _0x994a=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','/:id','delete'];(function(_0x1bfe2b,_0x34856e){var _0x1477d4=function(_0x1d558c){while(--_0x1d558c){_0x1bfe2b['push'](_0x1bfe2b['shift']());}};_0x1477d4(++_0x34856e);}(_0x994a,0x1de));var _0xa994=function(_0x589869,_0x409ef4){_0x589869=_0x589869-0x0;var _0xe10030=_0x994a[_0x589869];return _0xe10030;};'use strict';var multer=require(_0xa994('0x0'));var util=require(_0xa994('0x1'));var path=require('path');var timeout=require(_0xa994('0x2'));var express=require(_0xa994('0x3'));var router=express['Router']();var auth=require(_0xa994('0x4'));var interaction=require(_0xa994('0x5'));var config=require(_0xa994('0x6'));var controller=require('./intFreshdeskField.controller');router[_0xa994('0x7')]('/',auth['isAuthenticated'](),controller[_0xa994('0x8')]);router['get']('/:id',auth[_0xa994('0x9')](),controller[_0xa994('0xa')]);router[_0xa994('0xb')]('/',auth['isAuthenticated'](),controller[_0xa994('0xc')]);router['put'](_0xa994('0xd'),auth[_0xa994('0x9')](),controller['update']);router[_0xa994('0xe')](_0xa994('0xd'),auth['isAuthenticated'](),controller[_0xa994('0xf')]);module[_0xa994('0x10')]=router; \ No newline at end of file +var _0x0b2b=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','update','delete','destroy'];(function(_0x7abef8,_0x5ecac8){var _0x187f9d=function(_0x16e615){while(--_0x16e615){_0x7abef8['push'](_0x7abef8['shift']());}};_0x187f9d(++_0x5ecac8);}(_0x0b2b,0x10b));var _0xb0b2=function(_0x55871d,_0x40ff74){_0x55871d=_0x55871d-0x0;var _0x59aed8=_0x0b2b[_0x55871d];return _0x59aed8;};'use strict';var multer=require(_0xb0b2('0x0'));var util=require(_0xb0b2('0x1'));var path=require(_0xb0b2('0x2'));var timeout=require(_0xb0b2('0x3'));var express=require(_0xb0b2('0x4'));var router=express[_0xb0b2('0x5')]();var auth=require(_0xb0b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb0b2('0x7'));var controller=require(_0xb0b2('0x8'));router[_0xb0b2('0x9')]('/',auth['isAuthenticated'](),controller[_0xb0b2('0xa')]);router['get'](_0xb0b2('0xb'),auth[_0xb0b2('0xc')](),controller[_0xb0b2('0xd')]);router[_0xb0b2('0xe')]('/',auth[_0xb0b2('0xc')](),controller['create']);router['put']('/:id',auth[_0xb0b2('0xc')](),controller[_0xb0b2('0xf')]);router[_0xb0b2('0x10')](_0xb0b2('0xb'),auth[_0xb0b2('0xc')](),controller[_0xb0b2('0x11')]);module[_0xb0b2('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 0aef6ea..d5ff5d8 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 _0x5089=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5089,0x1bb));var _0x9508=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0x5089[_0x5dc03e];return _0x466a07;};'use strict';var Sequelize=require(_0x9508('0x0'));module[_0x9508('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9508('0x2'),_0x9508('0x3'),_0x9508('0x4'),_0x9508('0x5'),_0x9508('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9508('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9508('0x8')](_0x9508('0x2'),_0x9508('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9508('0x7')]},'idField':{'type':Sequelize[_0x9508('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9508('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9508('0x7')]}}; \ No newline at end of file +var _0xc818=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc818,0x1e3));var _0x8c81=function(_0x48ebdb,_0x5b0054){_0x48ebdb=_0x48ebdb-0x0;var _0x5c1eaf=_0xc818[_0x48ebdb];return _0x5c1eaf;};'use strict';var Sequelize=require(_0x8c81('0x0'));module[_0x8c81('0x1')]={'type':{'type':Sequelize[_0x8c81('0x2')](_0x8c81('0x3'),'variable',_0x8c81('0x4'),_0x8c81('0x5'),_0x8c81('0x6')),'defaultValue':_0x8c81('0x3')},'content':{'type':Sequelize[_0x8c81('0x7')]},'key':{'type':Sequelize[_0x8c81('0x7')]},'keyType':{'type':Sequelize[_0x8c81('0x2')]('string',_0x8c81('0x8'),_0x8c81('0x4'))},'keyContent':{'type':Sequelize[_0x8c81('0x7')]},'idField':{'type':Sequelize[_0x8c81('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8c81('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8c81('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index eba10d3..b27eb7a 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 _0x342d=['rawAttributes','find','create','body','destroy','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','error','stack','send','index','map','FreshdeskField','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','catch','show','params'];(function(_0x254e00,_0x5a8aa6){var _0x57704b=function(_0x41ca41){while(--_0x41ca41){_0x254e00['push'](_0x254e00['shift']());}};_0x57704b(++_0x5a8aa6);}(_0x342d,0x197));var _0xd342=function(_0x5c2cab,_0x7c37d2){_0x5c2cab=_0x5c2cab-0x0;var _0x57dbdb=_0x342d[_0x5c2cab];return _0x57dbdb;};'use strict';var pdf=require(_0xd342('0x0'));var emlformat=require(_0xd342('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd342('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd342('0x3'));var BPromise=require(_0xd342('0x4'));var Mustache=require(_0xd342('0x5'));var util=require(_0xd342('0x6'));var path=require(_0xd342('0x7'));var sox=require('sox');var csv=require(_0xd342('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd342('0x9'));var jsforce=require(_0xd342('0xa'));var deskjs=require(_0xd342('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd342('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd342('0xd'));var as=require(_0xd342('0xe'));var hardwareService=require(_0xd342('0xf'));var logger=require(_0xd342('0x10'))(_0xd342('0x11'));var utils=require('../../config/utils');var config=require(_0xd342('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xd342('0x13'))['db'];function respondWithStatusCode(_0x252fef,_0x313dd8){_0x313dd8=_0x313dd8||0xcc;return function(_0xf613f4){if(_0xf613f4){return _0x252fef[_0xd342('0x14')](_0x313dd8);}return _0x252fef[_0xd342('0x15')](_0x313dd8)[_0xd342('0x16')]();};}function respondWithResult(_0x69447c,_0xe00f96){_0xe00f96=_0xe00f96||0xc8;return function(_0x593a6e){if(_0x593a6e){return _0x69447c[_0xd342('0x15')](_0xe00f96)[_0xd342('0x17')](_0x593a6e);}};}function respondWithFilteredResult(_0x459dbb,_0x19eaa5){return function(_0x518181){if(_0x518181){var _0x4e4e86=_0x518181[_0xd342('0x18')],_0x2a5d77=_0x19eaa5[_0xd342('0x19')],_0x156de2=_0x19eaa5[_0xd342('0x19')]+_0x19eaa5[_0xd342('0x1a')],_0x2edf7b;if(_0x156de2>=_0x4e4e86){_0x156de2=_0x4e4e86;_0x2edf7b=0xc8;}else{_0x2edf7b=0xce;}_0x459dbb[_0xd342('0x15')](_0x2edf7b);return _0x459dbb[_0xd342('0x1b')]('Content-Range',_0x2a5d77+'-'+_0x156de2+'/'+_0x4e4e86)[_0xd342('0x17')](_0x518181);}return null;};}function patchUpdates(_0x26c6fa){return function(_0x1b98a0){try{jsonpatch[_0xd342('0x1c')](_0x1b98a0,_0x26c6fa,!![]);}catch(_0x5ac673){return BPromise['reject'](_0x5ac673);}return _0x1b98a0[_0xd342('0x1d')]();};}function saveUpdates(_0xc160ab,_0x21dbf6){return function(_0xdd1118){if(_0xdd1118){return _0xdd1118[_0xd342('0x1e')](_0xc160ab)[_0xd342('0x1f')](function(_0x1e5473){return _0x1e5473;});}return null;};}function removeEntity(_0x13c335,_0x4f2443){return function(_0x1f2a1c){if(_0x1f2a1c){return _0x1f2a1c['destroy']()['then'](function(){_0x13c335['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x99ba20,_0x50092c){return function(_0x20c332){if(!_0x20c332){_0x99ba20[_0xd342('0x14')](0x194);}return _0x20c332;};}function handleError(_0x37e18d,_0x31abe9){_0x31abe9=_0x31abe9||0x1f4;return function(_0x5abff1){logger[_0xd342('0x20')](_0x5abff1[_0xd342('0x21')]);if(_0x5abff1['name']){delete _0x5abff1['name'];}_0x37e18d[_0xd342('0x15')](_0x31abe9)[_0xd342('0x22')](_0x5abff1);};}exports[_0xd342('0x23')]=function(_0x18cf66,_0x193a15){var _0x2321f7={},_0x3f3de4={},_0x1c749c={'count':0x0,'rows':[]};var _0x3f5475=_[_0xd342('0x24')](db[_0xd342('0x25')]['rawAttributes'],function(_0x37d4fa){return{'name':_0x37d4fa[_0xd342('0x26')],'type':_0x37d4fa[_0xd342('0x27')][_0xd342('0x28')]};});_0x3f3de4['model']=_[_0xd342('0x24')](_0x3f5475,'name');_0x3f3de4[_0xd342('0x29')]=_[_0xd342('0x2a')](_0x18cf66[_0xd342('0x29')]);_0x3f3de4[_0xd342('0x2b')]=_[_0xd342('0x2c')](_0x3f3de4[_0xd342('0x2d')],_0x3f3de4[_0xd342('0x29')]);_0x2321f7['attributes']=_['intersection'](_0x3f3de4[_0xd342('0x2d')],qs[_0xd342('0x2e')](_0x18cf66['query'][_0xd342('0x2e')]));_0x2321f7[_0xd342('0x2f')]=_0x2321f7[_0xd342('0x2f')][_0xd342('0x30')]?_0x2321f7[_0xd342('0x2f')]:_0x3f3de4[_0xd342('0x2d')];if(!_0x18cf66[_0xd342('0x29')][_0xd342('0x31')](_0xd342('0x32'))){_0x2321f7[_0xd342('0x1a')]=qs[_0xd342('0x1a')](_0x18cf66[_0xd342('0x29')][_0xd342('0x1a')]);_0x2321f7[_0xd342('0x19')]=qs[_0xd342('0x19')](_0x18cf66['query'][_0xd342('0x19')]);}_0x2321f7[_0xd342('0x33')]=qs[_0xd342('0x34')](_0x18cf66['query'][_0xd342('0x34')]);_0x2321f7[_0xd342('0x35')]=qs[_0xd342('0x2b')](_['pick'](_0x18cf66[_0xd342('0x29')],_0x3f3de4[_0xd342('0x2b')]),_0x3f5475);if(_0x18cf66[_0xd342('0x29')][_0xd342('0x36')]){_0x2321f7['where']=_[_0xd342('0x37')](_0x2321f7[_0xd342('0x35')],{'$or':_['map'](_0x3f5475,function(_0x252384){if(_0x252384[_0xd342('0x27')]!=='VIRTUAL'){var _0x467489={};_0x467489[_0x252384['name']]={'$like':'%'+_0x18cf66[_0xd342('0x29')][_0xd342('0x36')]+'%'};return _0x467489;}})});}_0x2321f7=_[_0xd342('0x37')]({},_0x2321f7,_0x18cf66['options']);var _0x271fa4={'where':_0x2321f7[_0xd342('0x35')]};return db[_0xd342('0x25')][_0xd342('0x18')](_0x271fa4)['then'](function(_0x92826b){_0x1c749c[_0xd342('0x18')]=_0x92826b;if(_0x18cf66['query'][_0xd342('0x38')]){_0x2321f7[_0xd342('0x39')]=[{'all':!![]}];}return db[_0xd342('0x25')][_0xd342('0x3a')](_0x2321f7);})[_0xd342('0x1f')](function(_0x58a833){_0x1c749c['rows']=_0x58a833;return _0x1c749c;})[_0xd342('0x1f')](respondWithFilteredResult(_0x193a15,_0x2321f7))[_0xd342('0x3b')](handleError(_0x193a15,null));};exports[_0xd342('0x3c')]=function(_0x50bfd5,_0x2b75d6){var _0x375408={'raw':!![],'where':{'id':_0x50bfd5[_0xd342('0x3d')]['id']}},_0x4910f6={};_0x4910f6[_0xd342('0x2d')]=_[_0xd342('0x2a')](db[_0xd342('0x25')][_0xd342('0x3e')]);_0x4910f6[_0xd342('0x29')]=_[_0xd342('0x2a')](_0x50bfd5[_0xd342('0x29')]);_0x4910f6[_0xd342('0x2b')]=_[_0xd342('0x2c')](_0x4910f6[_0xd342('0x2d')],_0x4910f6['query']);_0x375408['attributes']=_['intersection'](_0x4910f6['model'],qs[_0xd342('0x2e')](_0x50bfd5[_0xd342('0x29')][_0xd342('0x2e')]));_0x375408[_0xd342('0x2f')]=_0x375408[_0xd342('0x2f')]['length']?_0x375408[_0xd342('0x2f')]:_0x4910f6['model'];if(_0x50bfd5['query']['includeAll']){_0x375408[_0xd342('0x39')]=[{'all':!![]}];}_0x375408=_[_0xd342('0x37')]({},_0x375408,_0x50bfd5['options']);return db['FreshdeskField'][_0xd342('0x3f')](_0x375408)['then'](handleEntityNotFound(_0x2b75d6,null))['then'](respondWithResult(_0x2b75d6,null))[_0xd342('0x3b')](handleError(_0x2b75d6,null));};exports[_0xd342('0x40')]=function(_0x39e4e0,_0x5097ba){return db[_0xd342('0x25')]['create'](_0x39e4e0[_0xd342('0x41')],{})[_0xd342('0x1f')](respondWithResult(_0x5097ba,0xc9))[_0xd342('0x3b')](handleError(_0x5097ba,null));};exports['update']=function(_0x46a1c5,_0x192762){if(_0x46a1c5[_0xd342('0x41')]['id']){delete _0x46a1c5[_0xd342('0x41')]['id'];}return db[_0xd342('0x25')][_0xd342('0x3f')]({'where':{'id':_0x46a1c5[_0xd342('0x3d')]['id']}})[_0xd342('0x1f')](handleEntityNotFound(_0x192762,null))[_0xd342('0x1f')](saveUpdates(_0x46a1c5[_0xd342('0x41')],null))['then'](respondWithResult(_0x192762,null))[_0xd342('0x3b')](handleError(_0x192762,null));};exports[_0xd342('0x42')]=function(_0x119871,_0x25abab){return db['FreshdeskField'][_0xd342('0x3f')]({'where':{'id':_0x119871[_0xd342('0x3d')]['id']}})['then'](handleEntityNotFound(_0x25abab,null))['then'](removeEntity(_0x25abab,null))[_0xd342('0x3b')](handleError(_0x25abab,null));}; \ No newline at end of file +var _0x090e=['then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','include','rows','catch','show','params','keys','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x4758b0,_0x50386f){var _0x2b00d9=function(_0x341e4b){while(--_0x341e4b){_0x4758b0['push'](_0x4758b0['shift']());}};_0x2b00d9(++_0x50386f);}(_0x090e,0x104));var _0xe090=function(_0xab2afb,_0x546bfb){_0xab2afb=_0xab2afb-0x0;var _0x25262b=_0x090e[_0xab2afb];return _0x25262b;};'use strict';var pdf=require(_0xe090('0x0'));var emlformat=require(_0xe090('0x1'));var rimraf=require(_0xe090('0x2'));var zipdir=require(_0xe090('0x3'));var jsonpatch=require(_0xe090('0x4'));var rp=require(_0xe090('0x5'));var moment=require(_0xe090('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe090('0x7'));var path=require('path');var sox=require(_0xe090('0x8'));var csv=require('to-csv');var ejs=require(_0xe090('0x9'));var fs=require('fs');var _=require(_0xe090('0xa'));var squel=require(_0xe090('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe090('0xc'));var querystring=require('querystring');var Papa=require(_0xe090('0xd'));var Redis=require(_0xe090('0xe'));var authService=require(_0xe090('0xf'));var qs=require(_0xe090('0x10'));var as=require(_0xe090('0x11'));var hardwareService=require(_0xe090('0x12'));var logger=require(_0xe090('0x13'))(_0xe090('0x14'));var utils=require(_0xe090('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe090('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeda9d7,_0x49e35d){_0x49e35d=_0x49e35d||0xcc;return function(_0x2a952b){if(_0x2a952b){return _0xeda9d7[_0xe090('0x17')](_0x49e35d);}return _0xeda9d7['status'](_0x49e35d)[_0xe090('0x18')]();};}function respondWithResult(_0x985247,_0xdcd4ee){_0xdcd4ee=_0xdcd4ee||0xc8;return function(_0x3f8bb3){if(_0x3f8bb3){return _0x985247[_0xe090('0x19')](_0xdcd4ee)[_0xe090('0x1a')](_0x3f8bb3);}};}function respondWithFilteredResult(_0x1d388d,_0x280c0a){return function(_0xf8788){if(_0xf8788){var _0x4700b6=_0xf8788[_0xe090('0x1b')],_0x3020ee=_0x280c0a[_0xe090('0x1c')],_0x7a5680=_0x280c0a[_0xe090('0x1c')]+_0x280c0a[_0xe090('0x1d')],_0x1ae0d4;if(_0x7a5680>=_0x4700b6){_0x7a5680=_0x4700b6;_0x1ae0d4=0xc8;}else{_0x1ae0d4=0xce;}_0x1d388d[_0xe090('0x19')](_0x1ae0d4);return _0x1d388d[_0xe090('0x1e')](_0xe090('0x1f'),_0x3020ee+'-'+_0x7a5680+'/'+_0x4700b6)['json'](_0xf8788);}return null;};}function patchUpdates(_0x21143c){return function(_0x397775){try{jsonpatch[_0xe090('0x20')](_0x397775,_0x21143c,!![]);}catch(_0x5f7127){return BPromise[_0xe090('0x21')](_0x5f7127);}return _0x397775[_0xe090('0x22')]();};}function saveUpdates(_0x4118d1,_0xffd04a){return function(_0x464a3b){if(_0x464a3b){return _0x464a3b[_0xe090('0x23')](_0x4118d1)[_0xe090('0x24')](function(_0x69c3ca){return _0x69c3ca;});}return null;};}function removeEntity(_0xc2abc1,_0x46b075){return function(_0x298d45){if(_0x298d45){return _0x298d45[_0xe090('0x25')]()['then'](function(){_0xc2abc1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26e39e,_0x38fd43){return function(_0x3e96e4){if(!_0x3e96e4){_0x26e39e[_0xe090('0x17')](0x194);}return _0x3e96e4;};}function handleError(_0x578c11,_0x260a91){_0x260a91=_0x260a91||0x1f4;return function(_0x7182eb){logger[_0xe090('0x26')](_0x7182eb[_0xe090('0x27')]);if(_0x7182eb['name']){delete _0x7182eb[_0xe090('0x28')];}_0x578c11['status'](_0x260a91)[_0xe090('0x29')](_0x7182eb);};}exports[_0xe090('0x2a')]=function(_0x3f9124,_0x34462b){var _0x157359={},_0x344d70={},_0x225ea7={'count':0x0,'rows':[]};var _0x428423=_[_0xe090('0x2b')](db[_0xe090('0x2c')][_0xe090('0x2d')],function(_0x3a35f3){return{'name':_0x3a35f3[_0xe090('0x2e')],'type':_0x3a35f3[_0xe090('0x2f')][_0xe090('0x30')]};});_0x344d70['model']=_[_0xe090('0x2b')](_0x428423,'name');_0x344d70[_0xe090('0x31')]=_['keys'](_0x3f9124[_0xe090('0x31')]);_0x344d70[_0xe090('0x32')]=_[_0xe090('0x33')](_0x344d70[_0xe090('0x34')],_0x344d70['query']);_0x157359['attributes']=_[_0xe090('0x33')](_0x344d70['model'],qs[_0xe090('0x35')](_0x3f9124[_0xe090('0x31')][_0xe090('0x35')]));_0x157359[_0xe090('0x36')]=_0x157359[_0xe090('0x36')][_0xe090('0x37')]?_0x157359[_0xe090('0x36')]:_0x344d70[_0xe090('0x34')];if(!_0x3f9124['query'][_0xe090('0x38')](_0xe090('0x39'))){_0x157359['limit']=qs[_0xe090('0x1d')](_0x3f9124['query']['limit']);_0x157359[_0xe090('0x1c')]=qs['offset'](_0x3f9124['query'][_0xe090('0x1c')]);}_0x157359[_0xe090('0x3a')]=qs['sort'](_0x3f9124[_0xe090('0x31')][_0xe090('0x3b')]);_0x157359['where']=qs[_0xe090('0x32')](_['pick'](_0x3f9124[_0xe090('0x31')],_0x344d70[_0xe090('0x32')]),_0x428423);if(_0x3f9124[_0xe090('0x31')][_0xe090('0x3c')]){_0x157359[_0xe090('0x3d')]=_['merge'](_0x157359[_0xe090('0x3d')],{'$or':_[_0xe090('0x2b')](_0x428423,function(_0x320e92){if(_0x320e92[_0xe090('0x2f')]!=='VIRTUAL'){var _0x3e6426={};_0x3e6426[_0x320e92[_0xe090('0x28')]]={'$like':'%'+_0x3f9124[_0xe090('0x31')][_0xe090('0x3c')]+'%'};return _0x3e6426;}})});}_0x157359=_[_0xe090('0x3e')]({},_0x157359,_0x3f9124[_0xe090('0x3f')]);var _0x58af02={'where':_0x157359[_0xe090('0x3d')]};return db['FreshdeskField'][_0xe090('0x1b')](_0x58af02)[_0xe090('0x24')](function(_0x2d2c95){_0x225ea7['count']=_0x2d2c95;if(_0x3f9124['query']['includeAll']){_0x157359[_0xe090('0x40')]=[{'all':!![]}];}return db[_0xe090('0x2c')]['findAll'](_0x157359);})['then'](function(_0xe4b07c){_0x225ea7[_0xe090('0x41')]=_0xe4b07c;return _0x225ea7;})['then'](respondWithFilteredResult(_0x34462b,_0x157359))[_0xe090('0x42')](handleError(_0x34462b,null));};exports[_0xe090('0x43')]=function(_0x2a8769,_0x72058a){var _0x47e531={'raw':!![],'where':{'id':_0x2a8769[_0xe090('0x44')]['id']}},_0x51ca72={};_0x51ca72[_0xe090('0x34')]=_[_0xe090('0x45')](db[_0xe090('0x2c')][_0xe090('0x2d')]);_0x51ca72[_0xe090('0x31')]=_[_0xe090('0x45')](_0x2a8769[_0xe090('0x31')]);_0x51ca72[_0xe090('0x32')]=_['intersection'](_0x51ca72[_0xe090('0x34')],_0x51ca72[_0xe090('0x31')]);_0x47e531[_0xe090('0x36')]=_[_0xe090('0x33')](_0x51ca72[_0xe090('0x34')],qs[_0xe090('0x35')](_0x2a8769[_0xe090('0x31')]['fields']));_0x47e531[_0xe090('0x36')]=_0x47e531[_0xe090('0x36')][_0xe090('0x37')]?_0x47e531[_0xe090('0x36')]:_0x51ca72[_0xe090('0x34')];if(_0x2a8769['query'][_0xe090('0x46')]){_0x47e531[_0xe090('0x40')]=[{'all':!![]}];}_0x47e531=_[_0xe090('0x3e')]({},_0x47e531,_0x2a8769[_0xe090('0x3f')]);return db['FreshdeskField'][_0xe090('0x47')](_0x47e531)[_0xe090('0x24')](handleEntityNotFound(_0x72058a,null))[_0xe090('0x24')](respondWithResult(_0x72058a,null))[_0xe090('0x42')](handleError(_0x72058a,null));};exports[_0xe090('0x48')]=function(_0x1f9d3c,_0x5b0547){return db[_0xe090('0x2c')][_0xe090('0x48')](_0x1f9d3c[_0xe090('0x49')],{})[_0xe090('0x24')](respondWithResult(_0x5b0547,0xc9))['catch'](handleError(_0x5b0547,null));};exports[_0xe090('0x23')]=function(_0x535515,_0x373749){if(_0x535515[_0xe090('0x49')]['id']){delete _0x535515[_0xe090('0x49')]['id'];}return db[_0xe090('0x2c')]['find']({'where':{'id':_0x535515[_0xe090('0x44')]['id']}})['then'](handleEntityNotFound(_0x373749,null))[_0xe090('0x24')](saveUpdates(_0x535515[_0xe090('0x49')],null))[_0xe090('0x24')](respondWithResult(_0x373749,null))[_0xe090('0x42')](handleError(_0x373749,null));};exports[_0xe090('0x25')]=function(_0x53e27b,_0x4ab25a){return db['FreshdeskField'][_0xe090('0x47')]({'where':{'id':_0x53e27b['params']['id']}})[_0xe090('0x24')](handleEntityNotFound(_0x4ab25a,null))['then'](removeEntity(_0x4ab25a,null))[_0xe090('0x42')](handleError(_0x4ab25a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 71c1ecb..830547b 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 _0x635e=['idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0xf210cd,_0x3f4f86){var _0x571220=function(_0x57e5a2){while(--_0x57e5a2){_0xf210cd['push'](_0xf210cd['shift']());}};_0x571220(++_0x3f4f86);}(_0x635e,0x1b5));var _0xe635=function(_0x3c39df,_0x270cab){_0x3c39df=_0x3c39df-0x0;var _0x5861b2=_0x635e[_0x3c39df];return _0x5861b2;};'use strict';var _=require(_0xe635('0x0'));var util=require(_0xe635('0x1'));var logger=require(_0xe635('0x2'))(_0xe635('0x3'));var moment=require('moment');var BPromise=require(_0xe635('0x4'));var rp=require(_0xe635('0x5'));var fs=require('fs');var path=require(_0xe635('0x6'));var rimraf=require('rimraf');var config=require(_0xe635('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0xe635('0x8')]=function(_0x30b9c0,_0x31dc12){return _0x30b9c0[_0xe635('0x9')](_0xe635('0xa'),attributes,{'tableName':_0xe635('0xb'),'paranoid':![],'indexes':[{'name':_0xe635('0xc'),'fields':[_0xe635('0xd'),_0xe635('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8247=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8247,0x1dc));var _0x7824=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0x8247[_0x2e3dfc];return _0x4b1245;};'use strict';var _=require(_0x7824('0x0'));var util=require(_0x7824('0x1'));var logger=require(_0x7824('0x2'))(_0x7824('0x3'));var moment=require(_0x7824('0x4'));var BPromise=require(_0x7824('0x5'));var rp=require(_0x7824('0x6'));var fs=require('fs');var path=require(_0x7824('0x7'));var rimraf=require(_0x7824('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x7824('0x9')]=function(_0x408255,_0x4f3a58){return _0x408255[_0x7824('0xa')]('FreshdeskField',attributes,{'tableName':_0x7824('0xb'),'paranoid':![],'indexes':[{'name':_0x7824('0xc'),'fields':[_0x7824('0xd'),'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 8530d6d..a2ed3a9 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(_0x465b4a,_0x502ef7){var _0x1fcfc9=function(_0x476a80){while(--_0x476a80){_0x465b4a['push'](_0x465b4a['shift']());}};_0x1fcfc9(++_0x502ef7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e3bed,_0x28cdc0){_0x3e3bed=_0x3e3bed-0x0;var _0x30595b=_0xb10b[_0x3e3bed];return _0x30595b;};'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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x297b59,_0x27b53a){_0x297b59=_0x297b59-0x0;var _0x570a68=_0x7a54[_0x297b59];return _0x570a68;};'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 f8a66ec..412eb9d 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 _0xea8e=['./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','create','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xea8e,0x7c));var _0xeea8=function(_0x4259e9,_0x3be572){_0x4259e9=_0x4259e9-0x0;var _0x348e6d=_0xea8e[_0x4259e9];return _0x348e6d;};'use strict';var multer=require(_0xeea8('0x0'));var util=require(_0xeea8('0x1'));var path=require(_0xeea8('0x2'));var timeout=require(_0xeea8('0x3'));var express=require(_0xeea8('0x4'));var router=express[_0xeea8('0x5')]();var auth=require(_0xeea8('0x6'));var interaction=require(_0xeea8('0x7'));var config=require('../../config/environment');var controller=require(_0xeea8('0x8'));router[_0xeea8('0x9')]('/',auth['isAuthenticated'](),controller[_0xeea8('0xa')]);router[_0xeea8('0x9')](_0xeea8('0xb'),auth[_0xeea8('0xc')](),controller[_0xeea8('0xd')]);router[_0xeea8('0x9')](_0xeea8('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xeea8('0x9')](_0xeea8('0xf'),auth[_0xeea8('0xc')](),controller[_0xeea8('0x10')]);router['post']('/',auth[_0xeea8('0xc')](),controller[_0xeea8('0x11')]);router[_0xeea8('0x12')]('/:id/configurations',auth[_0xeea8('0xc')](),controller['addConfiguration']);router[_0xeea8('0x13')](_0xeea8('0xb'),auth[_0xeea8('0xc')](),controller[_0xeea8('0x14')]);router['delete']('/:id',auth[_0xeea8('0xc')](),controller[_0xeea8('0x15')]);module['exports']=router; \ No newline at end of file +var _0x326d=['update','destroy','exports','util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put'];(function(_0xbf59b0,_0x2a7597){var _0x3342b1=function(_0xfb798d){while(--_0xfb798d){_0xbf59b0['push'](_0xbf59b0['shift']());}};_0x3342b1(++_0x2a7597);}(_0x326d,0xa3));var _0xd326=function(_0x141df3,_0x38c7c8){_0x141df3=_0x141df3-0x0;var _0x43947e=_0x326d[_0x141df3];return _0x43947e;};'use strict';var multer=require('multer');var util=require(_0xd326('0x0'));var path=require('path');var timeout=require(_0xd326('0x1'));var express=require(_0xd326('0x2'));var router=express[_0xd326('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd326('0x4'));var controller=require('./intFreshsalesAccount.controller');router[_0xd326('0x5')]('/',auth[_0xd326('0x6')](),controller[_0xd326('0x7')]);router[_0xd326('0x5')](_0xd326('0x8'),auth[_0xd326('0x6')](),controller[_0xd326('0x9')]);router[_0xd326('0x5')](_0xd326('0xa'),auth[_0xd326('0x6')](),controller[_0xd326('0xb')]);router[_0xd326('0x5')](_0xd326('0xc'),auth[_0xd326('0x6')](),controller[_0xd326('0xd')]);router[_0xd326('0xe')]('/',auth[_0xd326('0x6')](),controller[_0xd326('0xf')]);router[_0xd326('0xe')](_0xd326('0xa'),auth[_0xd326('0x6')](),controller['addConfiguration']);router[_0xd326('0x10')](_0xd326('0x8'),auth[_0xd326('0x6')](),controller[_0xd326('0x11')]);router['delete'](_0xd326('0x8'),auth[_0xd326('0x6')](),controller[_0xd326('0x12')]);module[_0xd326('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 3dc8c77..ef44c25 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 _0x2661=['exports','STRING','username','remoteUri','sequelize'];(function(_0x4c1195,_0x2022ec){var _0xcabe5f=function(_0x9d0ac){while(--_0x9d0ac){_0x4c1195['push'](_0x4c1195['shift']());}};_0xcabe5f(++_0x2022ec);}(_0x2661,0x1f3));var _0x1266=function(_0x2c4936,_0x40b1cd){_0x2c4936=_0x2c4936-0x0;var _0x54be7a=_0x2661[_0x2c4936];return _0x54be7a;};'use strict';var Sequelize=require(_0x1266('0x0'));module[_0x1266('0x1')]={'name':{'type':Sequelize[_0x1266('0x2')]},'description':{'type':Sequelize[_0x1266('0x2')]},'username':{'type':Sequelize[_0x1266('0x2')],'unique':_0x1266('0x3')},'apiKey':{'type':Sequelize[_0x1266('0x2')]},'remoteUri':{'type':Sequelize[_0x1266('0x2')],'unique':_0x1266('0x4')},'serverUrl':{'type':Sequelize[_0x1266('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfa60=['username','remoteUri','sequelize','exports','STRING'];(function(_0x2e9afa,_0x59d433){var _0x3fc2f1=function(_0x242217){while(--_0x242217){_0x2e9afa['push'](_0x2e9afa['shift']());}};_0x3fc2f1(++_0x59d433);}(_0xfa60,0x9d));var _0x0fa6=function(_0x216e07,_0x39338c){_0x216e07=_0x216e07-0x0;var _0x41c376=_0xfa60[_0x216e07];return _0x41c376;};'use strict';var Sequelize=require(_0x0fa6('0x0'));module[_0x0fa6('0x1')]={'name':{'type':Sequelize[_0x0fa6('0x2')]},'description':{'type':Sequelize[_0x0fa6('0x2')]},'username':{'type':Sequelize[_0x0fa6('0x2')],'unique':_0x0fa6('0x3')},'apiKey':{'type':Sequelize[_0x0fa6('0x2')]},'remoteUri':{'type':Sequelize[_0x0fa6('0x2')],'unique':_0x0fa6('0x4')},'serverUrl':{'type':Sequelize[_0x0fa6('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 4ef81f9..3c192a5 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 _0x6f0d=['findOne','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','json','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','FreshsalesAccount','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','show','params','keys','length','find','create','body','getConfigurations'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1b25b0,_0x40708b){_0x1b25b0=_0x1b25b0-0x0;var _0x58a373=_0x6f0d[_0x1b25b0];return _0x58a373;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd6f0('0x0'));var rimraf=require(_0xd6f0('0x1'));var zipdir=require(_0xd6f0('0x2'));var jsonpatch=require(_0xd6f0('0x3'));var rp=require('request-promise');var moment=require(_0xd6f0('0x4'));var BPromise=require(_0xd6f0('0x5'));var Mustache=require(_0xd6f0('0x6'));var util=require(_0xd6f0('0x7'));var path=require(_0xd6f0('0x8'));var sox=require('sox');var csv=require(_0xd6f0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];var integrations=require(_0xd6f0('0x19'));var jayson=require(_0xd6f0('0x1a'));var client=jayson[_0xd6f0('0x1b')][_0xd6f0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2bf5b8,_0x250999,_0x246dad,_0x4ab979){return new BPromise(function(_0x2b3f32,_0x354846){var _0x4c1559=_0x4ab979||client;return _0x4c1559[_0xd6f0('0x1d')](_0x2bf5b8,_0x246dad)['then'](function(_0x3f4851){logger[_0xd6f0('0x1e')](_0xd6f0('0x1f'),_0x250999,_0xd6f0('0x20'));logger[_0xd6f0('0x21')](_0xd6f0('0x22'),_0x250999,_0xd6f0('0x20'),JSON[_0xd6f0('0x23')](_0x3f4851));if(_0x3f4851[_0xd6f0('0x24')]){if(_0x3f4851[_0xd6f0('0x24')][_0xd6f0('0x25')]===0x1f4){logger[_0xd6f0('0x24')](_0xd6f0('0x1f'),_0x250999,_0x3f4851[_0xd6f0('0x24')][_0xd6f0('0x26')]);return _0x354846(_0x3f4851[_0xd6f0('0x24')]['message']);}logger['error'](_0xd6f0('0x1f'),_0x250999,_0x3f4851[_0xd6f0('0x24')][_0xd6f0('0x26')]);return _0x2b3f32(_0x3f4851['error'][_0xd6f0('0x26')]);}else{logger[_0xd6f0('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x250999,_0xd6f0('0x20'));_0x2b3f32(_0x3f4851['result'][_0xd6f0('0x26')]);}})[_0xd6f0('0x27')](function(_0x5dbe1c){logger[_0xd6f0('0x24')](_0xd6f0('0x1f'),_0x250999,_0x5dbe1c);_0x354846(_0x5dbe1c);});});}function respondWithStatusCode(_0x5ea2dd,_0x3dbdc3){_0x3dbdc3=_0x3dbdc3||0xcc;return function(_0x402070){if(_0x402070){return _0x5ea2dd[_0xd6f0('0x28')](_0x3dbdc3);}return _0x5ea2dd['status'](_0x3dbdc3)[_0xd6f0('0x29')]();};}function respondWithResult(_0x3dc166,_0x5ecb16){_0x5ecb16=_0x5ecb16||0xc8;return function(_0xcea0ae){if(_0xcea0ae){return _0x3dc166['status'](_0x5ecb16)[_0xd6f0('0x2a')](_0xcea0ae);}};}function respondWithFilteredResult(_0x3fb5c3,_0x1630dc){return function(_0x3c1bff){if(_0x3c1bff){var _0x4101bd=_0x3c1bff['count'],_0x715aab=_0x1630dc[_0xd6f0('0x2b')],_0x12d6ec=_0x1630dc[_0xd6f0('0x2b')]+_0x1630dc['limit'],_0x26799c;if(_0x12d6ec>=_0x4101bd){_0x12d6ec=_0x4101bd;_0x26799c=0xc8;}else{_0x26799c=0xce;}_0x3fb5c3[_0xd6f0('0x2c')](_0x26799c);return _0x3fb5c3[_0xd6f0('0x2d')](_0xd6f0('0x2e'),_0x715aab+'-'+_0x12d6ec+'/'+_0x4101bd)[_0xd6f0('0x2a')](_0x3c1bff);}return null;};}function patchUpdates(_0x1a3967){return function(_0x39e96a){try{jsonpatch[_0xd6f0('0x2f')](_0x39e96a,_0x1a3967,!![]);}catch(_0x3151f8){return BPromise[_0xd6f0('0x30')](_0x3151f8);}return _0x39e96a[_0xd6f0('0x31')]();};}function saveUpdates(_0x1dff9b,_0x3e913a){return function(_0x348529){if(_0x348529){return _0x348529[_0xd6f0('0x32')](_0x1dff9b)[_0xd6f0('0x33')](function(_0x2d7c90){return _0x2d7c90;});}return null;};}function removeEntity(_0x31c493,_0x376890){return function(_0x1086d6){if(_0x1086d6){return _0x1086d6[_0xd6f0('0x34')]()[_0xd6f0('0x33')](function(){_0x31c493[_0xd6f0('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11124c,_0x4ed523){return function(_0x58d2c5){if(!_0x58d2c5){_0x11124c[_0xd6f0('0x28')](0x194);}return _0x58d2c5;};}function handleError(_0x52e894,_0x12a6fa){_0x12a6fa=_0x12a6fa||0x1f4;return function(_0x27ad7e){logger[_0xd6f0('0x24')](_0x27ad7e['stack']);if(_0x27ad7e[_0xd6f0('0x35')]){delete _0x27ad7e['name'];}_0x52e894[_0xd6f0('0x2c')](_0x12a6fa)[_0xd6f0('0x36')](_0x27ad7e);};}exports[_0xd6f0('0x37')]=function(_0x1eecf0,_0x518751){var _0x5c3132={},_0x47b33d={},_0x3b6463={'count':0x0,'rows':[]};var _0xe2958d=_['map'](db[_0xd6f0('0x38')]['rawAttributes'],function(_0x507f66){return{'name':_0x507f66[_0xd6f0('0x39')],'type':_0x507f66[_0xd6f0('0x3a')][_0xd6f0('0x3b')]};});_0x47b33d[_0xd6f0('0x3c')]=_[_0xd6f0('0x3d')](_0xe2958d,_0xd6f0('0x35'));_0x47b33d['query']=_['keys'](_0x1eecf0[_0xd6f0('0x3e')]);_0x47b33d[_0xd6f0('0x3f')]=_[_0xd6f0('0x40')](_0x47b33d['model'],_0x47b33d['query']);_0x5c3132[_0xd6f0('0x41')]=_[_0xd6f0('0x40')](_0x47b33d[_0xd6f0('0x3c')],qs[_0xd6f0('0x42')](_0x1eecf0[_0xd6f0('0x3e')][_0xd6f0('0x42')]));_0x5c3132[_0xd6f0('0x41')]=_0x5c3132[_0xd6f0('0x41')]['length']?_0x5c3132[_0xd6f0('0x41')]:_0x47b33d[_0xd6f0('0x3c')];if(!_0x1eecf0[_0xd6f0('0x3e')][_0xd6f0('0x43')]('nolimit')){_0x5c3132[_0xd6f0('0x44')]=qs[_0xd6f0('0x44')](_0x1eecf0[_0xd6f0('0x3e')][_0xd6f0('0x44')]);_0x5c3132[_0xd6f0('0x2b')]=qs['offset'](_0x1eecf0[_0xd6f0('0x3e')][_0xd6f0('0x2b')]);}_0x5c3132[_0xd6f0('0x45')]=qs['sort'](_0x1eecf0[_0xd6f0('0x3e')][_0xd6f0('0x46')]);_0x5c3132['where']=qs['filters'](_[_0xd6f0('0x47')](_0x1eecf0[_0xd6f0('0x3e')],_0x47b33d[_0xd6f0('0x3f')]),_0xe2958d);if(_0x1eecf0['query'][_0xd6f0('0x48')]){_0x5c3132[_0xd6f0('0x49')]=_['merge'](_0x5c3132[_0xd6f0('0x49')],{'$or':_[_0xd6f0('0x3d')](_0xe2958d,function(_0x2930c5){if(_0x2930c5[_0xd6f0('0x3a')]!=='VIRTUAL'){var _0x664096={};_0x664096[_0x2930c5[_0xd6f0('0x35')]]={'$like':'%'+_0x1eecf0[_0xd6f0('0x3e')][_0xd6f0('0x48')]+'%'};return _0x664096;}})});}_0x5c3132=_[_0xd6f0('0x4a')]({},_0x5c3132,_0x1eecf0[_0xd6f0('0x4b')]);var _0x60f250={'where':_0x5c3132[_0xd6f0('0x49')]};return db['FreshsalesAccount'][_0xd6f0('0x4c')](_0x60f250)[_0xd6f0('0x33')](function(_0x55e93b){_0x3b6463[_0xd6f0('0x4c')]=_0x55e93b;if(_0x1eecf0[_0xd6f0('0x3e')][_0xd6f0('0x4d')]){_0x5c3132[_0xd6f0('0x4e')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xd6f0('0x4f')](_0x5c3132);})[_0xd6f0('0x33')](function(_0x494542){_0x3b6463['rows']=_0x494542;return _0x3b6463;})[_0xd6f0('0x33')](respondWithFilteredResult(_0x518751,_0x5c3132))['catch'](handleError(_0x518751,null));};exports[_0xd6f0('0x50')]=function(_0x61b354,_0x259827){var _0x52913b={'raw':![],'where':{'id':_0x61b354[_0xd6f0('0x51')]['id']}},_0x1ddce2={};_0x1ddce2[_0xd6f0('0x3c')]=_[_0xd6f0('0x52')](db[_0xd6f0('0x38')]['rawAttributes']);_0x1ddce2[_0xd6f0('0x3e')]=_['keys'](_0x61b354[_0xd6f0('0x3e')]);_0x1ddce2[_0xd6f0('0x3f')]=_[_0xd6f0('0x40')](_0x1ddce2[_0xd6f0('0x3c')],_0x1ddce2['query']);_0x52913b['attributes']=_[_0xd6f0('0x40')](_0x1ddce2[_0xd6f0('0x3c')],qs['fields'](_0x61b354[_0xd6f0('0x3e')]['fields']));_0x52913b[_0xd6f0('0x41')]=_0x52913b[_0xd6f0('0x41')][_0xd6f0('0x53')]?_0x52913b[_0xd6f0('0x41')]:_0x1ddce2[_0xd6f0('0x3c')];if(_0x61b354['query'][_0xd6f0('0x4d')]){_0x52913b[_0xd6f0('0x4e')]=[{'all':!![]}];}_0x52913b=_[_0xd6f0('0x4a')]({},_0x52913b,_0x61b354[_0xd6f0('0x4b')]);return db[_0xd6f0('0x38')][_0xd6f0('0x54')](_0x52913b)[_0xd6f0('0x33')](handleEntityNotFound(_0x259827,null))[_0xd6f0('0x33')](respondWithResult(_0x259827,null))['catch'](handleError(_0x259827,null));};exports[_0xd6f0('0x55')]=function(_0x3eb4dc,_0x469e92){return db[_0xd6f0('0x38')][_0xd6f0('0x55')](_0x3eb4dc[_0xd6f0('0x56')],{})[_0xd6f0('0x33')](respondWithResult(_0x469e92,0xc9))[_0xd6f0('0x27')](handleError(_0x469e92,null));};exports[_0xd6f0('0x32')]=function(_0x5216d8,_0x250805){if(_0x5216d8['body']['id']){delete _0x5216d8['body']['id'];}return db[_0xd6f0('0x38')]['find']({'where':{'id':_0x5216d8['params']['id']}})[_0xd6f0('0x33')](handleEntityNotFound(_0x250805,null))[_0xd6f0('0x33')](saveUpdates(_0x5216d8[_0xd6f0('0x56')],null))['then'](respondWithResult(_0x250805,null))[_0xd6f0('0x27')](handleError(_0x250805,null));};exports[_0xd6f0('0x34')]=function(_0xf297d2,_0x57daaa){return db[_0xd6f0('0x38')][_0xd6f0('0x54')]({'where':{'id':_0xf297d2['params']['id']}})[_0xd6f0('0x33')](handleEntityNotFound(_0x57daaa,null))[_0xd6f0('0x33')](removeEntity(_0x57daaa,null))['catch'](handleError(_0x57daaa,null));};exports[_0xd6f0('0x57')]=function(_0x25eb90,_0x22e511,_0x1d9972){var _0x3e6533={};var _0x48bfb3={};var _0x291e7b;var _0x43254c;return db['FreshsalesAccount'][_0xd6f0('0x58')]({'where':{'id':_0x25eb90[_0xd6f0('0x51')]['id']}})[_0xd6f0('0x33')](handleEntityNotFound(_0x22e511,null))['then'](function(_0x229f19){if(_0x229f19){_0x291e7b=_0x229f19;_0x48bfb3['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x48bfb3[_0xd6f0('0x3e')]=_[_0xd6f0('0x52')](_0x25eb90[_0xd6f0('0x3e')]);_0x48bfb3[_0xd6f0('0x3f')]=_['intersection'](_0x48bfb3[_0xd6f0('0x3c')],_0x48bfb3['query']);_0x3e6533[_0xd6f0('0x41')]=_[_0xd6f0('0x40')](_0x48bfb3[_0xd6f0('0x3c')],qs['fields'](_0x25eb90[_0xd6f0('0x3e')][_0xd6f0('0x42')]));_0x3e6533[_0xd6f0('0x41')]=_0x3e6533[_0xd6f0('0x41')]['length']?_0x3e6533[_0xd6f0('0x41')]:_0x48bfb3[_0xd6f0('0x3c')];_0x3e6533[_0xd6f0('0x45')]=qs['sort'](_0x25eb90[_0xd6f0('0x3e')][_0xd6f0('0x46')]);_0x3e6533[_0xd6f0('0x49')]=qs[_0xd6f0('0x3f')](_['pick'](_0x25eb90[_0xd6f0('0x3e')],_0x48bfb3[_0xd6f0('0x3f')]));if(_0x25eb90[_0xd6f0('0x3e')][_0xd6f0('0x48')]){_0x3e6533['where']=_['merge'](_0x3e6533['where'],{'$or':_['map'](_0x3e6533[_0xd6f0('0x41')],function(_0x46a3b3){var _0xa1ff68={};_0xa1ff68[_0x46a3b3]={'$like':'%'+_0x25eb90[_0xd6f0('0x3e')][_0xd6f0('0x48')]+'%'};return _0xa1ff68;})});}_0x3e6533=_[_0xd6f0('0x4a')]({},_0x3e6533,_0x25eb90[_0xd6f0('0x4b')]);return _0x291e7b[_0xd6f0('0x57')](_0x3e6533);}})[_0xd6f0('0x33')](function(_0x5ad146){if(_0x5ad146){_0x43254c=_0x5ad146['length'];if(!_0x25eb90[_0xd6f0('0x3e')]['hasOwnProperty'](_0xd6f0('0x59'))){_0x3e6533[_0xd6f0('0x44')]=qs[_0xd6f0('0x44')](_0x25eb90[_0xd6f0('0x3e')][_0xd6f0('0x44')]);_0x3e6533[_0xd6f0('0x2b')]=qs[_0xd6f0('0x2b')](_0x25eb90['query'][_0xd6f0('0x2b')]);}return _0x291e7b[_0xd6f0('0x57')](_0x3e6533);}})[_0xd6f0('0x33')](function(_0x5b687f){if(_0x5b687f){return _0x5b687f?{'count':_0x43254c,'rows':_0x5b687f}:null;}})[_0xd6f0('0x33')](respondWithResult(_0x22e511,null))[_0xd6f0('0x27')](handleError(_0x22e511,null));};exports['addConfiguration']=function(_0xad50ac,_0x80f21c,_0x1bf313){if(_0xad50ac[_0xd6f0('0x56')]['id']){delete _0xad50ac[_0xd6f0('0x56')]['id'];}return db[_0xd6f0('0x38')][_0xd6f0('0x58')]({'where':{'id':_0xad50ac[_0xd6f0('0x51')]['id']}})[_0xd6f0('0x33')](handleEntityNotFound(_0x80f21c,null))['then'](function(_0x2e657b){if(_0x2e657b){_0xad50ac[_0xd6f0('0x56')][_0xd6f0('0x5a')]=_0x2e657b['id'];_0xad50ac[_0xd6f0('0x56')]['Subjects']=integrations[_0xd6f0('0x5b')](_0xad50ac[_0xd6f0('0x56')][_0xd6f0('0x5c')],_0xad50ac[_0xd6f0('0x56')][_0xd6f0('0x3a')]);_0xad50ac[_0xd6f0('0x56')][_0xd6f0('0x5d')]=integrations[_0xd6f0('0x5e')](_0xad50ac[_0xd6f0('0x56')][_0xd6f0('0x5c')],_0xad50ac['body'][_0xd6f0('0x3a')]);return db[_0xd6f0('0x5f')][_0xd6f0('0x55')](_0xad50ac['body'],{'include':[{'model':db[_0xd6f0('0x60')],'as':_0xd6f0('0x61')},{'model':db[_0xd6f0('0x60')],'as':_0xd6f0('0x5d')}]});}return null;})[_0xd6f0('0x33')](respondWithResult(_0x80f21c,null))[_0xd6f0('0x27')](handleError(_0x80f21c,null));};exports[_0xd6f0('0x62')]=function(_0x14fa20,_0x412731,_0x39b833){var _0x27ad68='';var _0x5b3155='';return db['FreshsalesAccount'][_0xd6f0('0x58')]({'where':{'id':_0x14fa20[_0xd6f0('0x51')]['id']},'attributes':['id',_0xd6f0('0x63'),_0xd6f0('0x64'),_0xd6f0('0x65')]})['then'](handleEntityNotFound(_0x412731,null))[_0xd6f0('0x33')](function(_0x2d38e6){if(_0x2d38e6){_0x5b3155=_0x2d38e6['username'];_0x27ad68=_0x2d38e6[_0xd6f0('0x64')];var _0x5afb1c=_0x2d38e6[_0xd6f0('0x64')][_0xd6f0('0x66')](-0x1);if(_0x5afb1c==='/'){_0x27ad68=_0x27ad68[_0xd6f0('0x67')](0x0,_0x27ad68[_0xd6f0('0x68')](_0x5afb1c));}return rp({'method':_0xd6f0('0x69'),'uri':util['format']('%s%s',_0x27ad68,_0xd6f0('0x6a')),'headers':{'Authorization':_0xd6f0('0x6b')+_0x2d38e6['apiKey']},'json':!![]});}})[_0xd6f0('0x33')](function(_0x5819e2){if(_0x5819e2){var _0x52bf7f=_0x5819e2[_0xd6f0('0x6c')];var _0x56b272=![];var _0x5dc1c7=null;for(_0x5dc1c7=0x0;_0x5dc1c7<_0x52bf7f['length'];_0x5dc1c7++){if(_0x52bf7f[_0x5dc1c7]['email']===_0x5b3155){_0x56b272=!![];}}if(_0x56b272){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd6f0('0x6d')});}}})[_0xd6f0('0x33')](respondWithResult(_0x412731,null))[_0xd6f0('0x27')](function(_0xcfed18){var _0x40a954=_0x14fa20[_0xd6f0('0x3e')][_0xd6f0('0x6e')]?0x1f4:_0xcfed18[_0xd6f0('0x6f')]||0x1f4;logger[_0xd6f0('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xd6f0('0x62'),_0x40a954,JSON['stringify'](_0xcfed18));delete _0xcfed18['name'];if(_0x40a954===0x191){_0x40a954=0x190;}_0x412731[_0xd6f0('0x2c')](_0x40a954)[_0xd6f0('0x36')](_0x14fa20[_0xd6f0('0x3e')]['test']?{'message':_0xd6f0('0x70'),'statusCode':_0xcfed18[_0xd6f0('0x6f')]}:_0xcfed18);});}; \ No newline at end of file +var _0xfe57=['end','status','json','count','offset','set','Content-Range','reject','update','destroy','stack','name','send','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','map','VIRTUAL','merge','options','includeAll','findAll','rows','params','include','create','body','find','getConfigurations','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshsalesConfiguration','FreshsalesField','Subjects','findOne','apiKey','username','remoteUri','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus'];(function(_0x1d3f54,_0x7f2085){var _0x285290=function(_0x243895){while(--_0x243895){_0x1d3f54['push'](_0x1d3f54['shift']());}};_0x285290(++_0x7f2085);}(_0xfe57,0x195));var _0x7fe5=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0xfe57[_0x548d7d];return _0xb1c878;};'use strict';var pdf=require(_0x7fe5('0x0'));var emlformat=require(_0x7fe5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7fe5('0x2'));var rp=require(_0x7fe5('0x3'));var moment=require(_0x7fe5('0x4'));var BPromise=require(_0x7fe5('0x5'));var Mustache=require(_0x7fe5('0x6'));var util=require(_0x7fe5('0x7'));var path=require(_0x7fe5('0x8'));var sox=require(_0x7fe5('0x9'));var csv=require(_0x7fe5('0xa'));var ejs=require(_0x7fe5('0xb'));var fs=require('fs');var _=require(_0x7fe5('0xc'));var squel=require(_0x7fe5('0xd'));var crypto=require(_0x7fe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fe5('0x10'));var Papa=require(_0x7fe5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fe5('0x12'));var as=require(_0x7fe5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fe5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fe5('0x15'));var licenseUtil=require(_0x7fe5('0x16'));var db=require(_0x7fe5('0x17'))['db'];var integrations=require(_0x7fe5('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x7fe5('0x19')][_0x7fe5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x579fd3,_0x59285b,_0x54cfb2,_0x1f84b5){return new BPromise(function(_0x2d297b,_0x4e8ea0){var _0x1ce051=_0x1f84b5||client;return _0x1ce051['request'](_0x579fd3,_0x54cfb2)[_0x7fe5('0x1b')](function(_0x221ab2){logger[_0x7fe5('0x1c')](_0x7fe5('0x1d'),_0x59285b,_0x7fe5('0x1e'));logger[_0x7fe5('0x1f')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x59285b,_0x7fe5('0x1e'),JSON[_0x7fe5('0x20')](_0x221ab2));if(_0x221ab2[_0x7fe5('0x21')]){if(_0x221ab2[_0x7fe5('0x21')][_0x7fe5('0x22')]===0x1f4){logger[_0x7fe5('0x21')](_0x7fe5('0x1d'),_0x59285b,_0x221ab2[_0x7fe5('0x21')][_0x7fe5('0x23')]);return _0x4e8ea0(_0x221ab2[_0x7fe5('0x21')]['message']);}logger['error'](_0x7fe5('0x1d'),_0x59285b,_0x221ab2[_0x7fe5('0x21')][_0x7fe5('0x23')]);return _0x2d297b(_0x221ab2[_0x7fe5('0x21')][_0x7fe5('0x23')]);}else{logger[_0x7fe5('0x1c')](_0x7fe5('0x1d'),_0x59285b,_0x7fe5('0x1e'));_0x2d297b(_0x221ab2[_0x7fe5('0x24')][_0x7fe5('0x23')]);}})[_0x7fe5('0x25')](function(_0x204f09){logger['error'](_0x7fe5('0x1d'),_0x59285b,_0x204f09);_0x4e8ea0(_0x204f09);});});}function respondWithStatusCode(_0x2f39e0,_0x43e547){_0x43e547=_0x43e547||0xcc;return function(_0x508826){if(_0x508826){return _0x2f39e0[_0x7fe5('0x26')](_0x43e547);}return _0x2f39e0['status'](_0x43e547)[_0x7fe5('0x27')]();};}function respondWithResult(_0x53f522,_0x5c3b37){_0x5c3b37=_0x5c3b37||0xc8;return function(_0x190355){if(_0x190355){return _0x53f522[_0x7fe5('0x28')](_0x5c3b37)[_0x7fe5('0x29')](_0x190355);}};}function respondWithFilteredResult(_0x399c55,_0x4393c3){return function(_0x5bfe23){if(_0x5bfe23){var _0x5f2d25=_0x5bfe23[_0x7fe5('0x2a')],_0x417a56=_0x4393c3['offset'],_0x450759=_0x4393c3[_0x7fe5('0x2b')]+_0x4393c3['limit'],_0x27b66d;if(_0x450759>=_0x5f2d25){_0x450759=_0x5f2d25;_0x27b66d=0xc8;}else{_0x27b66d=0xce;}_0x399c55[_0x7fe5('0x28')](_0x27b66d);return _0x399c55[_0x7fe5('0x2c')](_0x7fe5('0x2d'),_0x417a56+'-'+_0x450759+'/'+_0x5f2d25)[_0x7fe5('0x29')](_0x5bfe23);}return null;};}function patchUpdates(_0x1f8572){return function(_0x45b32b){try{jsonpatch['apply'](_0x45b32b,_0x1f8572,!![]);}catch(_0xe521c6){return BPromise[_0x7fe5('0x2e')](_0xe521c6);}return _0x45b32b['save']();};}function saveUpdates(_0xfc1189,_0x246b70){return function(_0x360f6f){if(_0x360f6f){return _0x360f6f[_0x7fe5('0x2f')](_0xfc1189)[_0x7fe5('0x1b')](function(_0x53ef16){return _0x53ef16;});}return null;};}function removeEntity(_0x55577c,_0x13623e){return function(_0x25a4c3){if(_0x25a4c3){return _0x25a4c3[_0x7fe5('0x30')]()[_0x7fe5('0x1b')](function(){_0x55577c['status'](0xcc)[_0x7fe5('0x27')]();});}};}function handleEntityNotFound(_0x368e4a,_0x396f8d){return function(_0x4227b7){if(!_0x4227b7){_0x368e4a[_0x7fe5('0x26')](0x194);}return _0x4227b7;};}function handleError(_0x30decb,_0x4ecbba){_0x4ecbba=_0x4ecbba||0x1f4;return function(_0x1f87d7){logger[_0x7fe5('0x21')](_0x1f87d7[_0x7fe5('0x31')]);if(_0x1f87d7[_0x7fe5('0x32')]){delete _0x1f87d7['name'];}_0x30decb['status'](_0x4ecbba)[_0x7fe5('0x33')](_0x1f87d7);};}exports['index']=function(_0x19ab99,_0x513680){var _0x462839={},_0x59d694={},_0x491308={'count':0x0,'rows':[]};var _0x539573=_['map'](db[_0x7fe5('0x34')][_0x7fe5('0x35')],function(_0x4bbf54){return{'name':_0x4bbf54[_0x7fe5('0x36')],'type':_0x4bbf54[_0x7fe5('0x37')]['key']};});_0x59d694[_0x7fe5('0x38')]=_['map'](_0x539573,'name');_0x59d694[_0x7fe5('0x39')]=_[_0x7fe5('0x3a')](_0x19ab99[_0x7fe5('0x39')]);_0x59d694[_0x7fe5('0x3b')]=_[_0x7fe5('0x3c')](_0x59d694['model'],_0x59d694[_0x7fe5('0x39')]);_0x462839[_0x7fe5('0x3d')]=_['intersection'](_0x59d694[_0x7fe5('0x38')],qs[_0x7fe5('0x3e')](_0x19ab99[_0x7fe5('0x39')][_0x7fe5('0x3e')]));_0x462839[_0x7fe5('0x3d')]=_0x462839[_0x7fe5('0x3d')][_0x7fe5('0x3f')]?_0x462839['attributes']:_0x59d694['model'];if(!_0x19ab99[_0x7fe5('0x39')]['hasOwnProperty'](_0x7fe5('0x40'))){_0x462839[_0x7fe5('0x41')]=qs['limit'](_0x19ab99[_0x7fe5('0x39')][_0x7fe5('0x41')]);_0x462839[_0x7fe5('0x2b')]=qs[_0x7fe5('0x2b')](_0x19ab99[_0x7fe5('0x39')][_0x7fe5('0x2b')]);}_0x462839[_0x7fe5('0x42')]=qs['sort'](_0x19ab99['query'][_0x7fe5('0x43')]);_0x462839['where']=qs[_0x7fe5('0x3b')](_[_0x7fe5('0x44')](_0x19ab99[_0x7fe5('0x39')],_0x59d694[_0x7fe5('0x3b')]),_0x539573);if(_0x19ab99['query'][_0x7fe5('0x45')]){_0x462839['where']=_['merge'](_0x462839[_0x7fe5('0x46')],{'$or':_[_0x7fe5('0x47')](_0x539573,function(_0x4f4c38){if(_0x4f4c38[_0x7fe5('0x37')]!==_0x7fe5('0x48')){var _0x46826f={};_0x46826f[_0x4f4c38[_0x7fe5('0x32')]]={'$like':'%'+_0x19ab99[_0x7fe5('0x39')]['filter']+'%'};return _0x46826f;}})});}_0x462839=_[_0x7fe5('0x49')]({},_0x462839,_0x19ab99[_0x7fe5('0x4a')]);var _0x5c749b={'where':_0x462839[_0x7fe5('0x46')]};return db[_0x7fe5('0x34')][_0x7fe5('0x2a')](_0x5c749b)[_0x7fe5('0x1b')](function(_0x4f71df){_0x491308[_0x7fe5('0x2a')]=_0x4f71df;if(_0x19ab99[_0x7fe5('0x39')][_0x7fe5('0x4b')]){_0x462839['include']=[{'all':!![]}];}return db[_0x7fe5('0x34')][_0x7fe5('0x4c')](_0x462839);})[_0x7fe5('0x1b')](function(_0x4bf44a){_0x491308[_0x7fe5('0x4d')]=_0x4bf44a;return _0x491308;})[_0x7fe5('0x1b')](respondWithFilteredResult(_0x513680,_0x462839))[_0x7fe5('0x25')](handleError(_0x513680,null));};exports['show']=function(_0x19c4a6,_0x211933){var _0x1ac93a={'raw':![],'where':{'id':_0x19c4a6[_0x7fe5('0x4e')]['id']}},_0x4610b6={};_0x4610b6[_0x7fe5('0x38')]=_[_0x7fe5('0x3a')](db[_0x7fe5('0x34')][_0x7fe5('0x35')]);_0x4610b6[_0x7fe5('0x39')]=_[_0x7fe5('0x3a')](_0x19c4a6['query']);_0x4610b6['filters']=_['intersection'](_0x4610b6['model'],_0x4610b6[_0x7fe5('0x39')]);_0x1ac93a['attributes']=_[_0x7fe5('0x3c')](_0x4610b6[_0x7fe5('0x38')],qs[_0x7fe5('0x3e')](_0x19c4a6[_0x7fe5('0x39')][_0x7fe5('0x3e')]));_0x1ac93a['attributes']=_0x1ac93a[_0x7fe5('0x3d')][_0x7fe5('0x3f')]?_0x1ac93a[_0x7fe5('0x3d')]:_0x4610b6[_0x7fe5('0x38')];if(_0x19c4a6[_0x7fe5('0x39')][_0x7fe5('0x4b')]){_0x1ac93a[_0x7fe5('0x4f')]=[{'all':!![]}];}_0x1ac93a=_[_0x7fe5('0x49')]({},_0x1ac93a,_0x19c4a6[_0x7fe5('0x4a')]);return db[_0x7fe5('0x34')]['find'](_0x1ac93a)[_0x7fe5('0x1b')](handleEntityNotFound(_0x211933,null))[_0x7fe5('0x1b')](respondWithResult(_0x211933,null))[_0x7fe5('0x25')](handleError(_0x211933,null));};exports[_0x7fe5('0x50')]=function(_0x18b041,_0x3d425a){return db['FreshsalesAccount'][_0x7fe5('0x50')](_0x18b041[_0x7fe5('0x51')],{})[_0x7fe5('0x1b')](respondWithResult(_0x3d425a,0xc9))[_0x7fe5('0x25')](handleError(_0x3d425a,null));};exports[_0x7fe5('0x2f')]=function(_0x2bdece,_0xb44f47){if(_0x2bdece['body']['id']){delete _0x2bdece[_0x7fe5('0x51')]['id'];}return db[_0x7fe5('0x34')][_0x7fe5('0x52')]({'where':{'id':_0x2bdece[_0x7fe5('0x4e')]['id']}})[_0x7fe5('0x1b')](handleEntityNotFound(_0xb44f47,null))['then'](saveUpdates(_0x2bdece[_0x7fe5('0x51')],null))[_0x7fe5('0x1b')](respondWithResult(_0xb44f47,null))[_0x7fe5('0x25')](handleError(_0xb44f47,null));};exports[_0x7fe5('0x30')]=function(_0x4d3035,_0x20317e){return db[_0x7fe5('0x34')][_0x7fe5('0x52')]({'where':{'id':_0x4d3035[_0x7fe5('0x4e')]['id']}})[_0x7fe5('0x1b')](handleEntityNotFound(_0x20317e,null))[_0x7fe5('0x1b')](removeEntity(_0x20317e,null))[_0x7fe5('0x25')](handleError(_0x20317e,null));};exports[_0x7fe5('0x53')]=function(_0x25a965,_0x3b66a9,_0xe5b5cf){var _0x59bd7c={};var _0x44015c={};var _0x1ce47c;var _0x356d8e;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x25a965[_0x7fe5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3b66a9,null))[_0x7fe5('0x1b')](function(_0x46e8f5){if(_0x46e8f5){_0x1ce47c=_0x46e8f5;_0x44015c['model']=_[_0x7fe5('0x3a')](db['FreshsalesConfiguration'][_0x7fe5('0x35')]);_0x44015c[_0x7fe5('0x39')]=_[_0x7fe5('0x3a')](_0x25a965[_0x7fe5('0x39')]);_0x44015c[_0x7fe5('0x3b')]=_[_0x7fe5('0x3c')](_0x44015c['model'],_0x44015c['query']);_0x59bd7c[_0x7fe5('0x3d')]=_[_0x7fe5('0x3c')](_0x44015c[_0x7fe5('0x38')],qs[_0x7fe5('0x3e')](_0x25a965[_0x7fe5('0x39')]['fields']));_0x59bd7c[_0x7fe5('0x3d')]=_0x59bd7c[_0x7fe5('0x3d')][_0x7fe5('0x3f')]?_0x59bd7c[_0x7fe5('0x3d')]:_0x44015c[_0x7fe5('0x38')];_0x59bd7c['order']=qs[_0x7fe5('0x43')](_0x25a965[_0x7fe5('0x39')][_0x7fe5('0x43')]);_0x59bd7c[_0x7fe5('0x46')]=qs[_0x7fe5('0x3b')](_[_0x7fe5('0x44')](_0x25a965[_0x7fe5('0x39')],_0x44015c['filters']));if(_0x25a965[_0x7fe5('0x39')][_0x7fe5('0x45')]){_0x59bd7c[_0x7fe5('0x46')]=_[_0x7fe5('0x49')](_0x59bd7c[_0x7fe5('0x46')],{'$or':_[_0x7fe5('0x47')](_0x59bd7c[_0x7fe5('0x3d')],function(_0x52e990){var _0x4e2104={};_0x4e2104[_0x52e990]={'$like':'%'+_0x25a965[_0x7fe5('0x39')]['filter']+'%'};return _0x4e2104;})});}_0x59bd7c=_[_0x7fe5('0x49')]({},_0x59bd7c,_0x25a965['options']);return _0x1ce47c[_0x7fe5('0x53')](_0x59bd7c);}})[_0x7fe5('0x1b')](function(_0xce6647){if(_0xce6647){_0x356d8e=_0xce6647[_0x7fe5('0x3f')];if(!_0x25a965[_0x7fe5('0x39')][_0x7fe5('0x54')](_0x7fe5('0x40'))){_0x59bd7c[_0x7fe5('0x41')]=qs['limit'](_0x25a965[_0x7fe5('0x39')]['limit']);_0x59bd7c[_0x7fe5('0x2b')]=qs[_0x7fe5('0x2b')](_0x25a965[_0x7fe5('0x39')]['offset']);}return _0x1ce47c[_0x7fe5('0x53')](_0x59bd7c);}})[_0x7fe5('0x1b')](function(_0x339581){if(_0x339581){return _0x339581?{'count':_0x356d8e,'rows':_0x339581}:null;}})[_0x7fe5('0x1b')](respondWithResult(_0x3b66a9,null))[_0x7fe5('0x25')](handleError(_0x3b66a9,null));};exports[_0x7fe5('0x55')]=function(_0x5b8b03,_0x2bf9ed,_0x46d509){if(_0x5b8b03['body']['id']){delete _0x5b8b03[_0x7fe5('0x51')]['id'];}return db[_0x7fe5('0x34')]['findOne']({'where':{'id':_0x5b8b03[_0x7fe5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2bf9ed,null))[_0x7fe5('0x1b')](function(_0x3577be){if(_0x3577be){_0x5b8b03[_0x7fe5('0x51')][_0x7fe5('0x56')]=_0x3577be['id'];_0x5b8b03[_0x7fe5('0x51')]['Subjects']=integrations[_0x7fe5('0x57')](_0x5b8b03['body'][_0x7fe5('0x58')],_0x5b8b03[_0x7fe5('0x51')][_0x7fe5('0x37')]);_0x5b8b03[_0x7fe5('0x51')]['Descriptions']=integrations[_0x7fe5('0x59')](_0x5b8b03['body'][_0x7fe5('0x58')],_0x5b8b03[_0x7fe5('0x51')]['type']);return db[_0x7fe5('0x5a')][_0x7fe5('0x50')](_0x5b8b03['body'],{'include':[{'model':db[_0x7fe5('0x5b')],'as':_0x7fe5('0x5c')},{'model':db[_0x7fe5('0x5b')],'as':'Descriptions'}]});}return null;})[_0x7fe5('0x1b')](respondWithResult(_0x2bf9ed,null))[_0x7fe5('0x25')](handleError(_0x2bf9ed,null));};exports['getFields']=function(_0xc5ad82,_0x3d2779,_0x5e9adc){var _0x3f1459='';var _0x5da5b6='';return db['FreshsalesAccount'][_0x7fe5('0x5d')]({'where':{'id':_0xc5ad82[_0x7fe5('0x4e')]['id']},'attributes':['id','username','remoteUri',_0x7fe5('0x5e')]})['then'](handleEntityNotFound(_0x3d2779,null))[_0x7fe5('0x1b')](function(_0x55d3b5){if(_0x55d3b5){_0x5da5b6=_0x55d3b5[_0x7fe5('0x5f')];_0x3f1459=_0x55d3b5[_0x7fe5('0x60')];var _0xba6830=_0x55d3b5[_0x7fe5('0x60')][_0x7fe5('0x61')](-0x1);if(_0xba6830==='/'){_0x3f1459=_0x3f1459['substring'](0x0,_0x3f1459[_0x7fe5('0x62')](_0xba6830));}return rp({'method':_0x7fe5('0x63'),'uri':util[_0x7fe5('0x64')](_0x7fe5('0x65'),_0x3f1459,_0x7fe5('0x66')),'headers':{'Authorization':_0x7fe5('0x67')+_0x55d3b5[_0x7fe5('0x5e')]},'json':!![]});}})[_0x7fe5('0x1b')](function(_0x26b4c9){if(_0x26b4c9){var _0x438a71=_0x26b4c9['users'];var _0x24b5f7=![];var _0x19f87b=null;for(_0x19f87b=0x0;_0x19f87b<_0x438a71[_0x7fe5('0x3f')];_0x19f87b++){if(_0x438a71[_0x19f87b][_0x7fe5('0x68')]===_0x5da5b6){_0x24b5f7=!![];}}if(_0x24b5f7){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7fe5('0x69')});}}})['then'](respondWithResult(_0x3d2779,null))[_0x7fe5('0x25')](function(_0x23f2c9){var _0x453cd7=_0xc5ad82[_0x7fe5('0x39')][_0x7fe5('0x6a')]?0x1f4:_0x23f2c9[_0x7fe5('0x6b')]||0x1f4;logger[_0x7fe5('0x21')](_0x7fe5('0x6c'),_0x7fe5('0x6d'),_0x453cd7,JSON[_0x7fe5('0x20')](_0x23f2c9));delete _0x23f2c9[_0x7fe5('0x32')];if(_0x453cd7===0x191){_0x453cd7=0x190;}_0x3d2779['status'](_0x453cd7)[_0x7fe5('0x33')](_0xc5ad82[_0x7fe5('0x39')][_0x7fe5('0x6a')]?{'message':_0x7fe5('0x6e'),'statusCode':_0x23f2c9[_0x7fe5('0x6b')]}:_0x23f2c9);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index dae03b4..6cdb623 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 _0xa742=['moment','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','api'];(function(_0x5852d5,_0x5abb54){var _0x16e674=function(_0xb03635){while(--_0xb03635){_0x5852d5['push'](_0x5852d5['shift']());}};_0x16e674(++_0x5abb54);}(_0xa742,0xc7));var _0x2a74=function(_0x341757,_0x23d3ca){_0x341757=_0x341757-0x0;var _0x56a5e3=_0xa742[_0x341757];return _0x56a5e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2a74('0x0'));var moment=require(_0x2a74('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a74('0x2'));var rimraf=require('rimraf');var config=require(_0x2a74('0x3'));var attributes=require(_0x2a74('0x4'));var integrations=require(_0x2a74('0x5'));module[_0x2a74('0x6')]=function(_0x2e8449,_0x17d10f){return _0x2e8449[_0x2a74('0x7')](_0x2a74('0x8'),attributes,{'tableName':_0x2a74('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb749=['../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x161106,_0x37ef28){var _0x2fa2ac=function(_0xee9ef9){while(--_0xee9ef9){_0x161106['push'](_0x161106['shift']());}};_0x2fa2ac(++_0x37ef28);}(_0xb749,0xac));var _0x9b74=function(_0x3adf53,_0x22f84d){_0x3adf53=_0x3adf53-0x0;var _0x3cd7c8=_0xb749[_0x3adf53];return _0x3cd7c8;};'use strict';var _=require(_0x9b74('0x0'));var util=require('util');var logger=require(_0x9b74('0x1'))(_0x9b74('0x2'));var moment=require('moment');var BPromise=require(_0x9b74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b74('0x4'));var rimraf=require(_0x9b74('0x5'));var config=require(_0x9b74('0x6'));var attributes=require(_0x9b74('0x7'));var integrations=require(_0x9b74('0x8'));module[_0x9b74('0x9')]=function(_0x4923c3,_0x24da1a){return _0x4923c3['define'](_0x9b74('0xa'),attributes,{'tableName':_0x9b74('0xb'),'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 71afb12..8bf02f2 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 _0x4c99=['findAll','options','attributes','limit','include','map','model','ShowFreshsalesAccount','find','raw','where','catch','lodash','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFreshsalesAccount','FreshsalesAccount'];(function(_0x1fa887,_0x27dda8){var _0x1ca2c1=function(_0x1f4e5d){while(--_0x1f4e5d){_0x1fa887['push'](_0x1fa887['shift']());}};_0x1ca2c1(++_0x27dda8);}(_0x4c99,0x1ec));var _0x94c9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4c99[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x94c9('0x0'));var util=require('util');var moment=require(_0x94c9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94c9('0x2'))['db'];var utils=require(_0x94c9('0x3'));var logger=require('../../config/logger')(_0x94c9('0x4'));var config=require(_0x94c9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x94c9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ebd2b,_0x49b85b,_0x23d961){return new BPromise(function(_0x4403ba,_0x3a1743){return client[_0x94c9('0x7')](_0x4ebd2b,_0x23d961)[_0x94c9('0x8')](function(_0x1c0983){logger[_0x94c9('0x9')](_0x94c9('0xa'),_0x49b85b,_0x94c9('0xb'));logger[_0x94c9('0xc')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x49b85b,_0x94c9('0xb'),JSON[_0x94c9('0xd')](_0x1c0983));if(_0x1c0983[_0x94c9('0xe')]){if(_0x1c0983['error'][_0x94c9('0xf')]===0x1f4){logger[_0x94c9('0xe')](_0x94c9('0xa'),_0x49b85b,_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);return _0x3a1743(_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);}logger[_0x94c9('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x49b85b,_0x1c0983['error']['message']);return _0x4403ba(_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);}else{logger['info'](_0x94c9('0xa'),_0x49b85b,_0x94c9('0xb'));_0x4403ba(_0x1c0983[_0x94c9('0x11')]['message']);}})['catch'](function(_0x447937){logger[_0x94c9('0xe')](_0x94c9('0xa'),_0x49b85b,_0x447937);_0x3a1743(_0x447937);});});}exports[_0x94c9('0x12')]=function(_0x5ab49f){var _0xb3d5d6=this;return new Promise(function(_0x2bca02,_0x3a38cc){return db[_0x94c9('0x13')][_0x94c9('0x14')]({'raw':_0x5ab49f[_0x94c9('0x15')]?_0x5ab49f[_0x94c9('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5ab49f[_0x94c9('0x15')]?_0x5ab49f[_0x94c9('0x15')]['where']||null:null,'attributes':_0x5ab49f[_0x94c9('0x15')]?_0x5ab49f[_0x94c9('0x15')][_0x94c9('0x16')]||null:null,'limit':_0x5ab49f[_0x94c9('0x15')]?_0x5ab49f[_0x94c9('0x15')][_0x94c9('0x17')]||null:null,'include':_0x5ab49f[_0x94c9('0x15')]?_0x5ab49f[_0x94c9('0x15')][_0x94c9('0x18')]?_[_0x94c9('0x19')](_0x5ab49f['options'][_0x94c9('0x18')],function(_0x50ee41){return{'model':db[_0x50ee41[_0x94c9('0x1a')]],'as':_0x50ee41['as'],'attributes':_0x50ee41['attributes'],'include':_0x50ee41[_0x94c9('0x18')]?_[_0x94c9('0x19')](_0x50ee41[_0x94c9('0x18')],function(_0xf73058){return{'model':db[_0xf73058[_0x94c9('0x1a')]],'as':_0xf73058['as'],'attributes':_0xf73058[_0x94c9('0x16')],'include':_0xf73058['include']?_[_0x94c9('0x19')](_0xf73058[_0x94c9('0x18')],function(_0x15718d){return{'model':db[_0x15718d['model']],'as':_0x15718d['as'],'attributes':_0x15718d[_0x94c9('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x586b40){logger[_0x94c9('0x9')](_0x94c9('0x12'),_0x5ab49f);logger[_0x94c9('0xc')](_0x94c9('0x12'),_0x5ab49f,JSON[_0x94c9('0xd')](_0x586b40));_0x2bca02(_0x586b40);})['catch'](function(_0x3ab136){logger[_0x94c9('0xe')](_0x94c9('0x12'),_0x3ab136['message'],_0x5ab49f);_0x3a38cc(_0xb3d5d6[_0x94c9('0xe')](0x1f4,_0x3ab136[_0x94c9('0x10')]));});});};exports[_0x94c9('0x1b')]=function(_0x942832){var _0x569977=this;return new Promise(function(_0x9e09c4,_0x15efd6){return db['FreshsalesAccount'][_0x94c9('0x1c')]({'raw':_0x942832[_0x94c9('0x15')]?_0x942832[_0x94c9('0x15')][_0x94c9('0x1d')]===undefined?!![]:![]:!![],'where':_0x942832[_0x94c9('0x15')]?_0x942832[_0x94c9('0x15')][_0x94c9('0x1e')]||null:null,'attributes':_0x942832['options']?_0x942832[_0x94c9('0x15')][_0x94c9('0x16')]||null:null,'include':_0x942832[_0x94c9('0x15')]?_0x942832[_0x94c9('0x15')]['include']?_[_0x94c9('0x19')](_0x942832[_0x94c9('0x15')]['include'],function(_0x122a62){return{'model':db[_0x122a62[_0x94c9('0x1a')]],'as':_0x122a62['as'],'attributes':_0x122a62[_0x94c9('0x16')],'include':_0x122a62['include']?_[_0x94c9('0x19')](_0x122a62[_0x94c9('0x18')],function(_0x54a5ce){return{'model':db[_0x54a5ce[_0x94c9('0x1a')]],'as':_0x54a5ce['as'],'attributes':_0x54a5ce['attributes'],'include':_0x54a5ce['include']?_[_0x94c9('0x19')](_0x54a5ce['include'],function(_0x353e0f){return{'model':db[_0x353e0f[_0x94c9('0x1a')]],'as':_0x353e0f['as'],'attributes':_0x353e0f[_0x94c9('0x16')]};}):[]};}):[]};}):[]:[]})[_0x94c9('0x8')](function(_0x2a2db3){logger[_0x94c9('0x9')]('ShowFreshsalesAccount',_0x942832);logger[_0x94c9('0xc')](_0x94c9('0x1b'),_0x942832,JSON[_0x94c9('0xd')](_0x2a2db3));_0x9e09c4(_0x2a2db3);})[_0x94c9('0x1f')](function(_0x56e8e9){logger[_0x94c9('0xe')](_0x94c9('0x1b'),_0x56e8e9[_0x94c9('0x10')],_0x942832);_0x15efd6(_0x569977[_0x94c9('0xe')](0x1f4,_0x56e8e9['message']));});});}; \ No newline at end of file +var _0xbb61=['client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','map','find','model','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x46be2c,_0x3a2e90){var _0x55f457=function(_0x1199f5){while(--_0x1199f5){_0x46be2c['push'](_0x46be2c['shift']());}};_0x55f457(++_0x3a2e90);}(_0xbb61,0x131));var _0x1bb6=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xbb61[_0xd09668];return _0x68726;};'use strict';var _=require(_0x1bb6('0x0'));var util=require('util');var moment=require(_0x1bb6('0x1'));var BPromise=require(_0x1bb6('0x2'));var rs=require(_0x1bb6('0x3'));var fs=require('fs');var Redis=require(_0x1bb6('0x4'));var db=require(_0x1bb6('0x5'))['db'];var utils=require(_0x1bb6('0x6'));var logger=require(_0x1bb6('0x7'))('rpc');var config=require(_0x1bb6('0x8'));var jayson=require(_0x1bb6('0x9'));var client=jayson[_0x1bb6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x362383,_0x4629d0,_0x24d6b9){return new BPromise(function(_0x59a152,_0x13e2da){return client[_0x1bb6('0xb')](_0x362383,_0x24d6b9)[_0x1bb6('0xc')](function(_0xe56199){logger[_0x1bb6('0xd')](_0x1bb6('0xe'),_0x4629d0,'request\x20sent');logger[_0x1bb6('0xf')](_0x1bb6('0x10'),_0x4629d0,'request\x20sent',JSON[_0x1bb6('0x11')](_0xe56199));if(_0xe56199['error']){if(_0xe56199['error']['code']===0x1f4){logger['error'](_0x1bb6('0xe'),_0x4629d0,_0xe56199[_0x1bb6('0x12')]['message']);return _0x13e2da(_0xe56199['error'][_0x1bb6('0x13')]);}logger[_0x1bb6('0x12')](_0x1bb6('0xe'),_0x4629d0,_0xe56199[_0x1bb6('0x12')][_0x1bb6('0x13')]);return _0x59a152(_0xe56199[_0x1bb6('0x12')][_0x1bb6('0x13')]);}else{logger[_0x1bb6('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x4629d0,_0x1bb6('0x14'));_0x59a152(_0xe56199[_0x1bb6('0x15')][_0x1bb6('0x13')]);}})[_0x1bb6('0x16')](function(_0x583711){logger['error'](_0x1bb6('0xe'),_0x4629d0,_0x583711);_0x13e2da(_0x583711);});});}exports[_0x1bb6('0x17')]=function(_0x9e046a){var _0x5015bf=this;return new Promise(function(_0x2233a3,_0x50efc8){return db[_0x1bb6('0x18')]['findAll']({'raw':_0x9e046a[_0x1bb6('0x19')]?_0x9e046a[_0x1bb6('0x19')][_0x1bb6('0x1a')]===undefined?!![]:![]:!![],'where':_0x9e046a[_0x1bb6('0x19')]?_0x9e046a[_0x1bb6('0x19')][_0x1bb6('0x1b')]||null:null,'attributes':_0x9e046a[_0x1bb6('0x19')]?_0x9e046a[_0x1bb6('0x19')][_0x1bb6('0x1c')]||null:null,'limit':_0x9e046a['options']?_0x9e046a[_0x1bb6('0x19')][_0x1bb6('0x1d')]||null:null,'include':_0x9e046a['options']?_0x9e046a[_0x1bb6('0x19')][_0x1bb6('0x1e')]?_[_0x1bb6('0x1f')](_0x9e046a[_0x1bb6('0x19')]['include'],function(_0x4b5be5){return{'model':db[_0x4b5be5['model']],'as':_0x4b5be5['as'],'attributes':_0x4b5be5['attributes'],'include':_0x4b5be5['include']?_[_0x1bb6('0x1f')](_0x4b5be5[_0x1bb6('0x1e')],function(_0x104bf5){return{'model':db[_0x104bf5['model']],'as':_0x104bf5['as'],'attributes':_0x104bf5[_0x1bb6('0x1c')],'include':_0x104bf5[_0x1bb6('0x1e')]?_[_0x1bb6('0x1f')](_0x104bf5[_0x1bb6('0x1e')],function(_0x276be9){return{'model':db[_0x276be9['model']],'as':_0x276be9['as'],'attributes':_0x276be9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x736c70){logger['info']('GetFreshsalesAccount',_0x9e046a);logger[_0x1bb6('0xf')]('GetFreshsalesAccount',_0x9e046a,JSON['stringify'](_0x736c70));_0x2233a3(_0x736c70);})[_0x1bb6('0x16')](function(_0xf42d9){logger[_0x1bb6('0x12')](_0x1bb6('0x17'),_0xf42d9['message'],_0x9e046a);_0x50efc8(_0x5015bf[_0x1bb6('0x12')](0x1f4,_0xf42d9[_0x1bb6('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x38a385){var _0x17bdf8=this;return new Promise(function(_0x47fc5d,_0x5edd9e){return db[_0x1bb6('0x18')][_0x1bb6('0x20')]({'raw':_0x38a385[_0x1bb6('0x19')]?_0x38a385[_0x1bb6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x38a385[_0x1bb6('0x19')]?_0x38a385[_0x1bb6('0x19')]['where']||null:null,'attributes':_0x38a385[_0x1bb6('0x19')]?_0x38a385[_0x1bb6('0x19')][_0x1bb6('0x1c')]||null:null,'include':_0x38a385['options']?_0x38a385[_0x1bb6('0x19')][_0x1bb6('0x1e')]?_[_0x1bb6('0x1f')](_0x38a385['options']['include'],function(_0x18eb00){return{'model':db[_0x18eb00[_0x1bb6('0x21')]],'as':_0x18eb00['as'],'attributes':_0x18eb00['attributes'],'include':_0x18eb00[_0x1bb6('0x1e')]?_['map'](_0x18eb00[_0x1bb6('0x1e')],function(_0x32f4f1){return{'model':db[_0x32f4f1[_0x1bb6('0x21')]],'as':_0x32f4f1['as'],'attributes':_0x32f4f1[_0x1bb6('0x1c')],'include':_0x32f4f1[_0x1bb6('0x1e')]?_[_0x1bb6('0x1f')](_0x32f4f1[_0x1bb6('0x1e')],function(_0x5ed22d){return{'model':db[_0x5ed22d[_0x1bb6('0x21')]],'as':_0x5ed22d['as'],'attributes':_0x5ed22d[_0x1bb6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18c989){logger[_0x1bb6('0xd')](_0x1bb6('0x22'),_0x38a385);logger[_0x1bb6('0xf')](_0x1bb6('0x22'),_0x38a385,JSON[_0x1bb6('0x11')](_0x18c989));_0x47fc5d(_0x18c989);})[_0x1bb6('0x16')](function(_0xd30f83){logger['error'](_0x1bb6('0x22'),_0xd30f83[_0x1bb6('0x13')],_0x38a385);_0x5edd9e(_0x17bdf8['error'](0x1f4,_0xd30f83[_0x1bb6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 1516a34..e063083 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 _0x8262=['update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/subjects','getDescriptions','/:id/fields','getFields'];(function(_0x5cf2d8,_0x5a0668){var _0x5c2582=function(_0x294de6){while(--_0x294de6){_0x5cf2d8['push'](_0x5cf2d8['shift']());}};_0x5c2582(++_0x5a0668);}(_0x8262,0x111));var _0x2826=function(_0x595861,_0x14c992){_0x595861=_0x595861-0x0;var _0x3ecbf1=_0x8262[_0x595861];return _0x3ecbf1;};'use strict';var multer=require(_0x2826('0x0'));var util=require('util');var path=require(_0x2826('0x1'));var timeout=require(_0x2826('0x2'));var express=require(_0x2826('0x3'));var router=express[_0x2826('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2826('0x5'));var config=require(_0x2826('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x2826('0x7')]('/',auth[_0x2826('0x8')](),controller['index']);router[_0x2826('0x7')](_0x2826('0x9'),auth[_0x2826('0x8')](),controller[_0x2826('0xa')]);router[_0x2826('0x7')](_0x2826('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2826('0x7')]('/:id/descriptions',auth[_0x2826('0x8')](),controller[_0x2826('0xc')]);router['get'](_0x2826('0xd'),auth[_0x2826('0x8')](),controller[_0x2826('0xe')]);router['post']('/',auth[_0x2826('0x8')](),controller['create']);router['put']('/:id',auth[_0x2826('0x8')](),controller[_0x2826('0xf')]);router[_0x2826('0x10')](_0x2826('0x9'),auth[_0x2826('0x8')](),controller[_0x2826('0x11')]);module['exports']=router; \ No newline at end of file +var _0x46ee=['update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','get','/:id','isAuthenticated','show','/:id/subjects','getDescriptions','/:id/fields','getFields','post','create','put'];(function(_0x44ceee,_0x2a5e28){var _0x1a065c=function(_0x24ec16){while(--_0x24ec16){_0x44ceee['push'](_0x44ceee['shift']());}};_0x1a065c(++_0x2a5e28);}(_0x46ee,0x10c));var _0xe46e=function(_0x12c061,_0x412c23){_0x12c061=_0x12c061-0x0;var _0x8984f6=_0x46ee[_0x12c061];return _0x8984f6;};'use strict';var multer=require(_0xe46e('0x0'));var util=require(_0xe46e('0x1'));var path=require('path');var timeout=require(_0xe46e('0x2'));var express=require(_0xe46e('0x3'));var router=express[_0xe46e('0x4')]();var auth=require(_0xe46e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0xe46e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe46e('0x7'),auth[_0xe46e('0x8')](),controller[_0xe46e('0x9')]);router[_0xe46e('0x6')](_0xe46e('0xa'),auth[_0xe46e('0x8')](),controller['getSubjects']);router[_0xe46e('0x6')]('/:id/descriptions',auth[_0xe46e('0x8')](),controller[_0xe46e('0xb')]);router['get'](_0xe46e('0xc'),auth[_0xe46e('0x8')](),controller[_0xe46e('0xd')]);router[_0xe46e('0xe')]('/',auth['isAuthenticated'](),controller[_0xe46e('0xf')]);router[_0xe46e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe46e('0x11')]);router[_0xe46e('0x12')](_0xe46e('0x7'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 0b6ece5..0bddb16 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 _0x05cf=['exports','STRING','sequelize'];(function(_0x4a214c,_0xd45047){var _0x1a72c8=function(_0xcb1ee2){while(--_0xcb1ee2){_0x4a214c['push'](_0x4a214c['shift']());}};_0x1a72c8(++_0xd45047);}(_0x05cf,0xfb));var _0xf05c=function(_0x3c16ba,_0x5a9e5b){_0x3c16ba=_0x3c16ba-0x0;var _0x2be7f2=_0x05cf[_0x3c16ba];return _0x2be7f2;};'use strict';var Sequelize=require(_0xf05c('0x0'));module[_0xf05c('0x1')]={'name':{'type':Sequelize[_0xf05c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4f1e=['sequelize','exports','STRING'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x4f1e,0x150));var _0xe4f1=function(_0x591bc9,_0x11d251){_0x591bc9=_0x591bc9-0x0;var _0x5c6376=_0x4f1e[_0x591bc9];return _0x5c6376;};'use strict';var Sequelize=require(_0xe4f1('0x0'));module[_0xe4f1('0x1')]={'name':{'type':Sequelize[_0xe4f1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 8b66ea7..f30cda9 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 _0x7217=['then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','FreshsalesConfiguration','includeAll','include','show','keys','length','find','catch','create','body','params','getSubjects','nolimit','findOne','getDescriptions','getFields','FreshsalesField','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update'];(function(_0x25eb66,_0x38a523){var _0x26f1c2=function(_0x3568bf){while(--_0x3568bf){_0x25eb66['push'](_0x25eb66['shift']());}};_0x26f1c2(++_0x38a523);}(_0x7217,0x19e));var _0x7721=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7217[_0x47a7d0];return _0xb9bd08;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7721('0x1c')][_0x7721('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x57ff6d,_0x109900,_0x30da54,_0x3f01c5){return new BPromise(function(_0x2e9752,_0x5069da){var _0x3cbce8=_0x3f01c5||client;return _0x3cbce8[_0x7721('0x1e')](_0x57ff6d,_0x30da54)['then'](function(_0x4e199a){logger['info'](_0x7721('0x1f'),_0x109900,_0x7721('0x20'));logger[_0x7721('0x21')](_0x7721('0x22'),_0x109900,'request\x20sent',JSON[_0x7721('0x23')](_0x4e199a));if(_0x4e199a['error']){if(_0x4e199a[_0x7721('0x24')]['code']===0x1f4){logger[_0x7721('0x24')](_0x7721('0x1f'),_0x109900,_0x4e199a[_0x7721('0x24')][_0x7721('0x25')]);return _0x5069da(_0x4e199a[_0x7721('0x24')][_0x7721('0x25')]);}logger[_0x7721('0x24')](_0x7721('0x1f'),_0x109900,_0x4e199a[_0x7721('0x24')][_0x7721('0x25')]);return _0x2e9752(_0x4e199a['error'][_0x7721('0x25')]);}else{logger[_0x7721('0x26')](_0x7721('0x1f'),_0x109900,_0x7721('0x20'));_0x2e9752(_0x4e199a['result'][_0x7721('0x25')]);}})['catch'](function(_0xb9e9dd){logger[_0x7721('0x24')](_0x7721('0x1f'),_0x109900,_0xb9e9dd);_0x5069da(_0xb9e9dd);});});}function respondWithStatusCode(_0x1caad8,_0x121cc4){_0x121cc4=_0x121cc4||0xcc;return function(_0x395b15){if(_0x395b15){return _0x1caad8[_0x7721('0x27')](_0x121cc4);}return _0x1caad8['status'](_0x121cc4)[_0x7721('0x28')]();};}function respondWithResult(_0x1abedb,_0x125564){_0x125564=_0x125564||0xc8;return function(_0x1f67c7){if(_0x1f67c7){return _0x1abedb[_0x7721('0x29')](_0x125564)[_0x7721('0x2a')](_0x1f67c7);}};}function respondWithFilteredResult(_0x424e05,_0xf753f1){return function(_0x40f367){if(_0x40f367){var _0x52316e=_0x40f367[_0x7721('0x2b')],_0x258ddf=_0xf753f1[_0x7721('0x2c')],_0x5b0551=_0xf753f1[_0x7721('0x2c')]+_0xf753f1[_0x7721('0x2d')],_0x499b87;if(_0x5b0551>=_0x52316e){_0x5b0551=_0x52316e;_0x499b87=0xc8;}else{_0x499b87=0xce;}_0x424e05[_0x7721('0x29')](_0x499b87);return _0x424e05[_0x7721('0x2e')](_0x7721('0x2f'),_0x258ddf+'-'+_0x5b0551+'/'+_0x52316e)[_0x7721('0x2a')](_0x40f367);}return null;};}function patchUpdates(_0x5c54f0){return function(_0x471651){try{jsonpatch[_0x7721('0x30')](_0x471651,_0x5c54f0,!![]);}catch(_0x497f9f){return BPromise['reject'](_0x497f9f);}return _0x471651[_0x7721('0x31')]();};}function saveUpdates(_0x220bbf,_0x48f329){return function(_0x46f772){if(_0x46f772){return _0x46f772[_0x7721('0x32')](_0x220bbf)[_0x7721('0x33')](function(_0x58d54b){return _0x58d54b;});}return null;};}function removeEntity(_0x3d9a32,_0x1ff31b){return function(_0x1492d4){if(_0x1492d4){return _0x1492d4[_0x7721('0x34')]()[_0x7721('0x33')](function(){_0x3d9a32['status'](0xcc)[_0x7721('0x28')]();});}};}function handleEntityNotFound(_0x3e4e56,_0xb2386d){return function(_0x5c5b33){if(!_0x5c5b33){_0x3e4e56[_0x7721('0x27')](0x194);}return _0x5c5b33;};}function handleError(_0x213a2e,_0x498654){_0x498654=_0x498654||0x1f4;return function(_0x217592){logger['error'](_0x217592[_0x7721('0x35')]);if(_0x217592[_0x7721('0x36')]){delete _0x217592[_0x7721('0x36')];}_0x213a2e[_0x7721('0x29')](_0x498654)[_0x7721('0x37')](_0x217592);};}exports[_0x7721('0x38')]=function(_0x2f1fe0,_0x15545a){var _0x25bdd9={},_0x3a2eb7={},_0x385454={'count':0x0,'rows':[]};var _0x5c806d=_[_0x7721('0x39')](db['FreshsalesConfiguration'][_0x7721('0x3a')],function(_0x35614c){return{'name':_0x35614c[_0x7721('0x3b')],'type':_0x35614c[_0x7721('0x3c')][_0x7721('0x3d')]};});_0x3a2eb7[_0x7721('0x3e')]=_['map'](_0x5c806d,'name');_0x3a2eb7['query']=_['keys'](_0x2f1fe0[_0x7721('0x3f')]);_0x3a2eb7[_0x7721('0x40')]=_[_0x7721('0x41')](_0x3a2eb7[_0x7721('0x3e')],_0x3a2eb7['query']);_0x25bdd9[_0x7721('0x42')]=_['intersection'](_0x3a2eb7[_0x7721('0x3e')],qs[_0x7721('0x43')](_0x2f1fe0['query'][_0x7721('0x43')]));_0x25bdd9[_0x7721('0x42')]=_0x25bdd9['attributes']['length']?_0x25bdd9[_0x7721('0x42')]:_0x3a2eb7[_0x7721('0x3e')];if(!_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x44')]('nolimit')){_0x25bdd9[_0x7721('0x2d')]=qs[_0x7721('0x2d')](_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x2d')]);_0x25bdd9[_0x7721('0x2c')]=qs['offset'](_0x2f1fe0[_0x7721('0x3f')]['offset']);}_0x25bdd9[_0x7721('0x45')]=qs['sort'](_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x46')]);_0x25bdd9[_0x7721('0x47')]=qs['filters'](_[_0x7721('0x48')](_0x2f1fe0[_0x7721('0x3f')],_0x3a2eb7[_0x7721('0x40')]),_0x5c806d);if(_0x2f1fe0['query'][_0x7721('0x49')]){_0x25bdd9[_0x7721('0x47')]=_[_0x7721('0x4a')](_0x25bdd9[_0x7721('0x47')],{'$or':_[_0x7721('0x39')](_0x5c806d,function(_0x57d09b){if(_0x57d09b[_0x7721('0x3c')]!=='VIRTUAL'){var _0x479698={};_0x479698[_0x57d09b[_0x7721('0x36')]]={'$like':'%'+_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x49')]+'%'};return _0x479698;}})});}_0x25bdd9=_[_0x7721('0x4a')]({},_0x25bdd9,_0x2f1fe0[_0x7721('0x4b')]);var _0x15181b={'where':_0x25bdd9[_0x7721('0x47')]};return db[_0x7721('0x4c')][_0x7721('0x2b')](_0x15181b)[_0x7721('0x33')](function(_0x5460cd){_0x385454['count']=_0x5460cd;if(_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x4d')]){_0x25bdd9[_0x7721('0x4e')]=[{'all':!![]}];}return db[_0x7721('0x4c')]['findAll'](_0x25bdd9);})[_0x7721('0x33')](function(_0x2d5a88){_0x385454['rows']=_0x2d5a88;return _0x385454;})[_0x7721('0x33')](respondWithFilteredResult(_0x15545a,_0x25bdd9))['catch'](handleError(_0x15545a,null));};exports[_0x7721('0x4f')]=function(_0x5c6922,_0x334f23){var _0x196be4={'raw':![],'where':{'id':_0x5c6922['params']['id']}},_0xf17c40={};_0xf17c40[_0x7721('0x3e')]=_[_0x7721('0x50')](db['FreshsalesConfiguration'][_0x7721('0x3a')]);_0xf17c40[_0x7721('0x3f')]=_[_0x7721('0x50')](_0x5c6922['query']);_0xf17c40[_0x7721('0x40')]=_['intersection'](_0xf17c40[_0x7721('0x3e')],_0xf17c40[_0x7721('0x3f')]);_0x196be4[_0x7721('0x42')]=_[_0x7721('0x41')](_0xf17c40[_0x7721('0x3e')],qs[_0x7721('0x43')](_0x5c6922[_0x7721('0x3f')][_0x7721('0x43')]));_0x196be4[_0x7721('0x42')]=_0x196be4[_0x7721('0x42')][_0x7721('0x51')]?_0x196be4[_0x7721('0x42')]:_0xf17c40[_0x7721('0x3e')];if(_0x5c6922[_0x7721('0x3f')][_0x7721('0x4d')]){_0x196be4['include']=[{'all':!![]}];}_0x196be4=_[_0x7721('0x4a')]({},_0x196be4,_0x5c6922[_0x7721('0x4b')]);return db[_0x7721('0x4c')][_0x7721('0x52')](_0x196be4)[_0x7721('0x33')](handleEntityNotFound(_0x334f23,null))[_0x7721('0x33')](respondWithResult(_0x334f23,null))[_0x7721('0x53')](handleError(_0x334f23,null));};exports['create']=function(_0x234bee,_0x17036e){return db[_0x7721('0x4c')][_0x7721('0x54')](_0x234bee[_0x7721('0x55')],{})[_0x7721('0x33')](respondWithResult(_0x17036e,0xc9))[_0x7721('0x53')](handleError(_0x17036e,null));};exports[_0x7721('0x32')]=function(_0x11b300,_0x3b968d){if(_0x11b300[_0x7721('0x55')]['id']){delete _0x11b300['body']['id'];}return db[_0x7721('0x4c')][_0x7721('0x52')]({'where':{'id':_0x11b300[_0x7721('0x56')]['id']}})[_0x7721('0x33')](handleEntityNotFound(_0x3b968d,null))[_0x7721('0x33')](saveUpdates(_0x11b300[_0x7721('0x55')],null))[_0x7721('0x33')](respondWithResult(_0x3b968d,null))[_0x7721('0x53')](handleError(_0x3b968d,null));};exports[_0x7721('0x34')]=function(_0x287452,_0x39962f){return db[_0x7721('0x4c')][_0x7721('0x52')]({'where':{'id':_0x287452[_0x7721('0x56')]['id']}})[_0x7721('0x33')](handleEntityNotFound(_0x39962f,null))['then'](removeEntity(_0x39962f,null))['catch'](handleError(_0x39962f,null));};exports['getSubjects']=function(_0x885a3a,_0x4f2fe6,_0x4a46db){var _0x57348c={};var _0x5d7036={};var _0x47925a;var _0x219181;return db[_0x7721('0x4c')]['findOne']({'where':{'id':_0x885a3a[_0x7721('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f2fe6,null))['then'](function(_0x484b8e){if(_0x484b8e){_0x47925a=_0x484b8e;_0x5d7036[_0x7721('0x3e')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x5d7036[_0x7721('0x3f')]=_[_0x7721('0x50')](_0x885a3a[_0x7721('0x3f')]);_0x5d7036['filters']=_[_0x7721('0x41')](_0x5d7036[_0x7721('0x3e')],_0x5d7036[_0x7721('0x3f')]);_0x57348c[_0x7721('0x42')]=_[_0x7721('0x41')](_0x5d7036[_0x7721('0x3e')],qs[_0x7721('0x43')](_0x885a3a[_0x7721('0x3f')][_0x7721('0x43')]));_0x57348c[_0x7721('0x42')]=_0x57348c[_0x7721('0x42')][_0x7721('0x51')]?_0x57348c[_0x7721('0x42')]:_0x5d7036[_0x7721('0x3e')];_0x57348c[_0x7721('0x45')]=qs['sort'](_0x885a3a[_0x7721('0x3f')][_0x7721('0x46')]);_0x57348c[_0x7721('0x47')]=qs[_0x7721('0x40')](_['pick'](_0x885a3a[_0x7721('0x3f')],_0x5d7036[_0x7721('0x40')]));if(_0x885a3a['query'][_0x7721('0x49')]){_0x57348c['where']=_[_0x7721('0x4a')](_0x57348c[_0x7721('0x47')],{'$or':_[_0x7721('0x39')](_0x57348c[_0x7721('0x42')],function(_0x3d2b7d){var _0x158aae={};_0x158aae[_0x3d2b7d]={'$like':'%'+_0x885a3a[_0x7721('0x3f')][_0x7721('0x49')]+'%'};return _0x158aae;})});}_0x57348c=_[_0x7721('0x4a')]({},_0x57348c,_0x885a3a['options']);return _0x47925a[_0x7721('0x57')](_0x57348c);}})[_0x7721('0x33')](function(_0x112033){if(_0x112033){_0x219181=_0x112033[_0x7721('0x51')];if(!_0x885a3a[_0x7721('0x3f')][_0x7721('0x44')](_0x7721('0x58'))){_0x57348c['limit']=qs[_0x7721('0x2d')](_0x885a3a[_0x7721('0x3f')]['limit']);_0x57348c[_0x7721('0x2c')]=qs['offset'](_0x885a3a[_0x7721('0x3f')][_0x7721('0x2c')]);}return _0x47925a[_0x7721('0x57')](_0x57348c);}})[_0x7721('0x33')](function(_0x1e2436){if(_0x1e2436){return _0x1e2436?{'count':_0x219181,'rows':_0x1e2436}:null;}})[_0x7721('0x33')](respondWithResult(_0x4f2fe6,null))[_0x7721('0x53')](handleError(_0x4f2fe6,null));};exports['getDescriptions']=function(_0xbcedbd,_0x1d252a,_0x280b1d){var _0x5f08cc={};var _0x5cef5a={};var _0x515fb9;var _0x5d3561;return db['FreshsalesConfiguration'][_0x7721('0x59')]({'where':{'id':_0xbcedbd[_0x7721('0x56')]['id']}})['then'](handleEntityNotFound(_0x1d252a,null))[_0x7721('0x33')](function(_0x42f6e9){if(_0x42f6e9){_0x515fb9=_0x42f6e9;_0x5cef5a[_0x7721('0x3e')]=_[_0x7721('0x50')](db['FreshsalesField'][_0x7721('0x3a')]);_0x5cef5a[_0x7721('0x3f')]=_[_0x7721('0x50')](_0xbcedbd[_0x7721('0x3f')]);_0x5cef5a[_0x7721('0x40')]=_['intersection'](_0x5cef5a[_0x7721('0x3e')],_0x5cef5a[_0x7721('0x3f')]);_0x5f08cc[_0x7721('0x42')]=_['intersection'](_0x5cef5a['model'],qs[_0x7721('0x43')](_0xbcedbd[_0x7721('0x3f')][_0x7721('0x43')]));_0x5f08cc[_0x7721('0x42')]=_0x5f08cc[_0x7721('0x42')]['length']?_0x5f08cc['attributes']:_0x5cef5a[_0x7721('0x3e')];_0x5f08cc[_0x7721('0x45')]=qs[_0x7721('0x46')](_0xbcedbd[_0x7721('0x3f')][_0x7721('0x46')]);_0x5f08cc[_0x7721('0x47')]=qs[_0x7721('0x40')](_['pick'](_0xbcedbd[_0x7721('0x3f')],_0x5cef5a[_0x7721('0x40')]));if(_0xbcedbd[_0x7721('0x3f')]['filter']){_0x5f08cc[_0x7721('0x47')]=_[_0x7721('0x4a')](_0x5f08cc[_0x7721('0x47')],{'$or':_[_0x7721('0x39')](_0x5f08cc['attributes'],function(_0x4d4d6a){var _0x37f8f8={};_0x37f8f8[_0x4d4d6a]={'$like':'%'+_0xbcedbd[_0x7721('0x3f')][_0x7721('0x49')]+'%'};return _0x37f8f8;})});}_0x5f08cc=_[_0x7721('0x4a')]({},_0x5f08cc,_0xbcedbd[_0x7721('0x4b')]);return _0x515fb9[_0x7721('0x5a')](_0x5f08cc);}})['then'](function(_0x3855d5){if(_0x3855d5){_0x5d3561=_0x3855d5[_0x7721('0x51')];if(!_0xbcedbd[_0x7721('0x3f')]['hasOwnProperty'](_0x7721('0x58'))){_0x5f08cc[_0x7721('0x2d')]=qs[_0x7721('0x2d')](_0xbcedbd[_0x7721('0x3f')][_0x7721('0x2d')]);_0x5f08cc['offset']=qs[_0x7721('0x2c')](_0xbcedbd['query'][_0x7721('0x2c')]);}return _0x515fb9[_0x7721('0x5a')](_0x5f08cc);}})[_0x7721('0x33')](function(_0x7f0598){if(_0x7f0598){return _0x7f0598?{'count':_0x5d3561,'rows':_0x7f0598}:null;}})[_0x7721('0x33')](respondWithResult(_0x1d252a,null))[_0x7721('0x53')](handleError(_0x1d252a,null));};exports[_0x7721('0x5b')]=function(_0x123049,_0x2ec5f8,_0x3b78f5){var _0x2c74d8={};var _0x55d209={};var _0x19fad6;var _0x19f451;return db[_0x7721('0x4c')]['findOne']({'where':{'id':_0x123049[_0x7721('0x56')]['id']}})[_0x7721('0x33')](handleEntityNotFound(_0x2ec5f8,null))[_0x7721('0x33')](function(_0xc9761e){if(_0xc9761e){_0x19fad6=_0xc9761e;_0x55d209[_0x7721('0x3e')]=_['keys'](db[_0x7721('0x5c')][_0x7721('0x3a')]);_0x55d209[_0x7721('0x3f')]=_[_0x7721('0x50')](_0x123049[_0x7721('0x3f')]);_0x55d209[_0x7721('0x40')]=_['intersection'](_0x55d209[_0x7721('0x3e')],_0x55d209[_0x7721('0x3f')]);_0x2c74d8['attributes']=_[_0x7721('0x41')](_0x55d209['model'],qs[_0x7721('0x43')](_0x123049[_0x7721('0x3f')]['fields']));_0x2c74d8[_0x7721('0x42')]=_0x2c74d8['attributes']['length']?_0x2c74d8['attributes']:_0x55d209[_0x7721('0x3e')];_0x2c74d8[_0x7721('0x45')]=qs[_0x7721('0x46')](_0x123049['query']['sort']);_0x2c74d8['where']=qs[_0x7721('0x40')](_[_0x7721('0x48')](_0x123049[_0x7721('0x3f')],_0x55d209[_0x7721('0x40')]));if(_0x123049[_0x7721('0x3f')][_0x7721('0x49')]){_0x2c74d8['where']=_[_0x7721('0x4a')](_0x2c74d8[_0x7721('0x47')],{'$or':_[_0x7721('0x39')](_0x2c74d8[_0x7721('0x42')],function(_0x977255){var _0x1a0232={};_0x1a0232[_0x977255]={'$like':'%'+_0x123049[_0x7721('0x3f')][_0x7721('0x49')]+'%'};return _0x1a0232;})});}_0x2c74d8=_[_0x7721('0x4a')]({},_0x2c74d8,_0x123049[_0x7721('0x4b')]);return _0x19fad6[_0x7721('0x5b')](_0x2c74d8);}})[_0x7721('0x33')](function(_0x58429d){if(_0x58429d){_0x19f451=_0x58429d['length'];if(!_0x123049[_0x7721('0x3f')][_0x7721('0x44')]('nolimit')){_0x2c74d8[_0x7721('0x2d')]=qs['limit'](_0x123049['query'][_0x7721('0x2d')]);_0x2c74d8['offset']=qs['offset'](_0x123049[_0x7721('0x3f')][_0x7721('0x2c')]);}return _0x19fad6[_0x7721('0x5b')](_0x2c74d8);}})[_0x7721('0x33')](function(_0x6b611){if(_0x6b611){return _0x6b611?{'count':_0x19f451,'rows':_0x6b611}:null;}})['then'](respondWithResult(_0x2ec5f8,null))[_0x7721('0x53')](handleError(_0x2ec5f8,null));}; \ No newline at end of file +var _0x53ec=['rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','order','sort','filters','pick','where','type','VIRTUAL','filter','FreshsalesConfiguration','count','includeAll','include','rows','catch','show','length','options','find','create','body','params','getSubjects','FreshsalesField','merge','hasOwnProperty','nolimit','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','end','status','json','offset','limit','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map'];(function(_0x389238,_0x26a94d){var _0xf2ee3c=function(_0x1b2a28){while(--_0x1b2a28){_0x389238['push'](_0x389238['shift']());}};_0xf2ee3c(++_0x26a94d);}(_0x53ec,0x192));var _0xc53e=function(_0x572165,_0x6a45cc){_0x572165=_0x572165-0x0;var _0x8c8709=_0x53ec[_0x572165];return _0x8c8709;};'use strict';var pdf=require(_0xc53e('0x0'));var emlformat=require(_0xc53e('0x1'));var rimraf=require(_0xc53e('0x2'));var zipdir=require(_0xc53e('0x3'));var jsonpatch=require(_0xc53e('0x4'));var rp=require(_0xc53e('0x5'));var moment=require('moment');var BPromise=require(_0xc53e('0x6'));var Mustache=require('mustache');var util=require(_0xc53e('0x7'));var path=require(_0xc53e('0x8'));var sox=require('sox');var csv=require(_0xc53e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0xe'));var Papa=require(_0xc53e('0xf'));var Redis=require(_0xc53e('0x10'));var authService=require(_0xc53e('0x11'));var qs=require(_0xc53e('0x12'));var as=require(_0xc53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x15'));var db=require(_0xc53e('0x16'))['db'];var jayson=require(_0xc53e('0x17'));var client=jayson[_0xc53e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e74c9,_0x1c06cd,_0x19a772,_0x7cd798){return new BPromise(function(_0x3d2e17,_0x358ef3){var _0x382e87=_0x7cd798||client;return _0x382e87[_0xc53e('0x19')](_0x4e74c9,_0x19a772)[_0xc53e('0x1a')](function(_0x455e4d){logger[_0xc53e('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0xc53e('0x1c'));logger[_0xc53e('0x1d')](_0xc53e('0x1e'),_0x1c06cd,_0xc53e('0x1c'),JSON[_0xc53e('0x1f')](_0x455e4d));if(_0x455e4d[_0xc53e('0x20')]){if(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x21')]===0x1f4){logger[_0xc53e('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0x455e4d['error'][_0xc53e('0x22')]);return _0x358ef3(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);return _0x3d2e17(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}else{logger[_0xc53e('0x1b')](_0xc53e('0x23'),_0x1c06cd,_0xc53e('0x1c'));_0x3d2e17(_0x455e4d[_0xc53e('0x24')]['message']);}})['catch'](function(_0x531ede){logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x531ede);_0x358ef3(_0x531ede);});});}function respondWithStatusCode(_0x7591c1,_0x4015c8){_0x4015c8=_0x4015c8||0xcc;return function(_0x180811){if(_0x180811){return _0x7591c1['sendStatus'](_0x4015c8);}return _0x7591c1['status'](_0x4015c8)[_0xc53e('0x25')]();};}function respondWithResult(_0x496167,_0x1ae55e){_0x1ae55e=_0x1ae55e||0xc8;return function(_0x3a5ce8){if(_0x3a5ce8){return _0x496167[_0xc53e('0x26')](_0x1ae55e)[_0xc53e('0x27')](_0x3a5ce8);}};}function respondWithFilteredResult(_0x63c5dc,_0x4df8cf){return function(_0x398e7a){if(_0x398e7a){var _0x4b9f6a=_0x398e7a['count'],_0x4d9a68=_0x4df8cf[_0xc53e('0x28')],_0x5c65d3=_0x4df8cf['offset']+_0x4df8cf[_0xc53e('0x29')],_0x3c5056;if(_0x5c65d3>=_0x4b9f6a){_0x5c65d3=_0x4b9f6a;_0x3c5056=0xc8;}else{_0x3c5056=0xce;}_0x63c5dc['status'](_0x3c5056);return _0x63c5dc['set'](_0xc53e('0x2a'),_0x4d9a68+'-'+_0x5c65d3+'/'+_0x4b9f6a)[_0xc53e('0x27')](_0x398e7a);}return null;};}function patchUpdates(_0x42dec1){return function(_0x2fa20b){try{jsonpatch[_0xc53e('0x2b')](_0x2fa20b,_0x42dec1,!![]);}catch(_0xf97d78){return BPromise[_0xc53e('0x2c')](_0xf97d78);}return _0x2fa20b[_0xc53e('0x2d')]();};}function saveUpdates(_0x4ace0b,_0x437893){return function(_0x311835){if(_0x311835){return _0x311835[_0xc53e('0x2e')](_0x4ace0b)['then'](function(_0x4057f9){return _0x4057f9;});}return null;};}function removeEntity(_0x495756,_0x4572e){return function(_0x2467f4){if(_0x2467f4){return _0x2467f4['destroy']()['then'](function(){_0x495756[_0xc53e('0x26')](0xcc)[_0xc53e('0x25')]();});}};}function handleEntityNotFound(_0x3f4547,_0x30d037){return function(_0x1b95c2){if(!_0x1b95c2){_0x3f4547[_0xc53e('0x2f')](0x194);}return _0x1b95c2;};}function handleError(_0x40a8db,_0x168d25){_0x168d25=_0x168d25||0x1f4;return function(_0x4ffddc){logger[_0xc53e('0x20')](_0x4ffddc[_0xc53e('0x30')]);if(_0x4ffddc[_0xc53e('0x31')]){delete _0x4ffddc[_0xc53e('0x31')];}_0x40a8db[_0xc53e('0x26')](_0x168d25)[_0xc53e('0x32')](_0x4ffddc);};}exports[_0xc53e('0x33')]=function(_0x16942c,_0x215abe){var _0x595efb={},_0x3e395c={},_0x48d7d0={'count':0x0,'rows':[]};var _0x1059f3=_[_0xc53e('0x34')](db['FreshsalesConfiguration'][_0xc53e('0x35')],function(_0x154f8b){return{'name':_0x154f8b[_0xc53e('0x36')],'type':_0x154f8b['type'][_0xc53e('0x37')]};});_0x3e395c[_0xc53e('0x38')]=_[_0xc53e('0x34')](_0x1059f3,_0xc53e('0x31'));_0x3e395c[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x16942c[_0xc53e('0x39')]);_0x3e395c['filters']=_[_0xc53e('0x3b')](_0x3e395c[_0xc53e('0x38')],_0x3e395c[_0xc53e('0x39')]);_0x595efb['attributes']=_[_0xc53e('0x3b')](_0x3e395c['model'],qs[_0xc53e('0x3c')](_0x16942c[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x595efb[_0xc53e('0x3d')]=_0x595efb[_0xc53e('0x3d')]['length']?_0x595efb[_0xc53e('0x3d')]:_0x3e395c[_0xc53e('0x38')];if(!_0x16942c['query']['hasOwnProperty']('nolimit')){_0x595efb['limit']=qs[_0xc53e('0x29')](_0x16942c[_0xc53e('0x39')]['limit']);_0x595efb[_0xc53e('0x28')]=qs['offset'](_0x16942c['query']['offset']);}_0x595efb[_0xc53e('0x3e')]=qs['sort'](_0x16942c['query'][_0xc53e('0x3f')]);_0x595efb['where']=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x16942c['query'],_0x3e395c[_0xc53e('0x40')]),_0x1059f3);if(_0x16942c[_0xc53e('0x39')]['filter']){_0x595efb[_0xc53e('0x42')]=_['merge'](_0x595efb['where'],{'$or':_['map'](_0x1059f3,function(_0x4efee5){if(_0x4efee5[_0xc53e('0x43')]!==_0xc53e('0x44')){var _0x3b2834={};_0x3b2834[_0x4efee5['name']]={'$like':'%'+_0x16942c[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x3b2834;}})});}_0x595efb=_['merge']({},_0x595efb,_0x16942c['options']);var _0x3ea11a={'where':_0x595efb[_0xc53e('0x42')]};return db[_0xc53e('0x46')]['count'](_0x3ea11a)[_0xc53e('0x1a')](function(_0x1fb82c){_0x48d7d0[_0xc53e('0x47')]=_0x1fb82c;if(_0x16942c[_0xc53e('0x39')][_0xc53e('0x48')]){_0x595efb[_0xc53e('0x49')]=[{'all':!![]}];}return db[_0xc53e('0x46')]['findAll'](_0x595efb);})[_0xc53e('0x1a')](function(_0x39c467){_0x48d7d0[_0xc53e('0x4a')]=_0x39c467;return _0x48d7d0;})['then'](respondWithFilteredResult(_0x215abe,_0x595efb))[_0xc53e('0x4b')](handleError(_0x215abe,null));};exports[_0xc53e('0x4c')]=function(_0x4458c8,_0x15e744){var _0xa7d256={'raw':![],'where':{'id':_0x4458c8['params']['id']}},_0x17cea5={};_0x17cea5[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db[_0xc53e('0x46')]['rawAttributes']);_0x17cea5[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x4458c8[_0xc53e('0x39')]);_0x17cea5[_0xc53e('0x40')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],_0x17cea5[_0xc53e('0x39')]);_0xa7d256[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],qs['fields'](_0x4458c8[_0xc53e('0x39')][_0xc53e('0x3c')]));_0xa7d256[_0xc53e('0x3d')]=_0xa7d256[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0xa7d256['attributes']:_0x17cea5['model'];if(_0x4458c8[_0xc53e('0x39')]['includeAll']){_0xa7d256[_0xc53e('0x49')]=[{'all':!![]}];}_0xa7d256=_['merge']({},_0xa7d256,_0x4458c8[_0xc53e('0x4e')]);return db[_0xc53e('0x46')][_0xc53e('0x4f')](_0xa7d256)['then'](handleEntityNotFound(_0x15e744,null))[_0xc53e('0x1a')](respondWithResult(_0x15e744,null))[_0xc53e('0x4b')](handleError(_0x15e744,null));};exports[_0xc53e('0x50')]=function(_0x4843ce,_0x2f7df2){return db['FreshsalesConfiguration'][_0xc53e('0x50')](_0x4843ce[_0xc53e('0x51')],{})['then'](respondWithResult(_0x2f7df2,0xc9))[_0xc53e('0x4b')](handleError(_0x2f7df2,null));};exports[_0xc53e('0x2e')]=function(_0x5bba72,_0x44f7cc){if(_0x5bba72[_0xc53e('0x51')]['id']){delete _0x5bba72[_0xc53e('0x51')]['id'];}return db[_0xc53e('0x46')][_0xc53e('0x4f')]({'where':{'id':_0x5bba72[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x44f7cc,null))[_0xc53e('0x1a')](saveUpdates(_0x5bba72[_0xc53e('0x51')],null))[_0xc53e('0x1a')](respondWithResult(_0x44f7cc,null))[_0xc53e('0x4b')](handleError(_0x44f7cc,null));};exports['destroy']=function(_0x8364f6,_0x4a2543){return db[_0xc53e('0x46')]['find']({'where':{'id':_0x8364f6[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x4a2543,null))['then'](removeEntity(_0x4a2543,null))[_0xc53e('0x4b')](handleError(_0x4a2543,null));};exports[_0xc53e('0x53')]=function(_0x9c0112,_0x432a91,_0x53083b){var _0x41c46c={};var _0x335427={};var _0x4ae0d4;var _0x5ea1da;return db[_0xc53e('0x46')]['findOne']({'where':{'id':_0x9c0112['params']['id']}})['then'](handleEntityNotFound(_0x432a91,null))[_0xc53e('0x1a')](function(_0x5f5dad){if(_0x5f5dad){_0x4ae0d4=_0x5f5dad;_0x335427[_0xc53e('0x38')]=_['keys'](db[_0xc53e('0x54')][_0xc53e('0x35')]);_0x335427[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x9c0112[_0xc53e('0x39')]);_0x335427['filters']=_['intersection'](_0x335427[_0xc53e('0x38')],_0x335427[_0xc53e('0x39')]);_0x41c46c[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x335427[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x41c46c[_0xc53e('0x3d')]=_0x41c46c[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x41c46c[_0xc53e('0x3d')]:_0x335427[_0xc53e('0x38')];_0x41c46c['order']=qs[_0xc53e('0x3f')](_0x9c0112['query'][_0xc53e('0x3f')]);_0x41c46c[_0xc53e('0x42')]=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x9c0112[_0xc53e('0x39')],_0x335427[_0xc53e('0x40')]));if(_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]){_0x41c46c['where']=_['merge'](_0x41c46c['where'],{'$or':_[_0xc53e('0x34')](_0x41c46c[_0xc53e('0x3d')],function(_0x37ac78){var _0x25e4b6={};_0x25e4b6[_0x37ac78]={'$like':'%'+_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x25e4b6;})});}_0x41c46c=_[_0xc53e('0x55')]({},_0x41c46c,_0x9c0112['options']);return _0x4ae0d4['getSubjects'](_0x41c46c);}})['then'](function(_0x40c8ba){if(_0x40c8ba){_0x5ea1da=_0x40c8ba[_0xc53e('0x4d')];if(!_0x9c0112['query'][_0xc53e('0x56')](_0xc53e('0x57'))){_0x41c46c[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x29')]);_0x41c46c['offset']=qs['offset'](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0x4ae0d4[_0xc53e('0x53')](_0x41c46c);}})[_0xc53e('0x1a')](function(_0x29ee08){if(_0x29ee08){return _0x29ee08?{'count':_0x5ea1da,'rows':_0x29ee08}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x432a91,null))['catch'](handleError(_0x432a91,null));};exports[_0xc53e('0x58')]=function(_0x15f6cb,_0x1c15a3,_0x3f3dc2){var _0x4d2609={};var _0xdd851e={};var _0xef9095;var _0x26e3ba;return db[_0xc53e('0x46')][_0xc53e('0x59')]({'where':{'id':_0x15f6cb[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x1c15a3,null))[_0xc53e('0x1a')](function(_0x134018){if(_0x134018){_0xef9095=_0x134018;_0xdd851e[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db['FreshsalesField']['rawAttributes']);_0xdd851e[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x15f6cb[_0xc53e('0x39')]);_0xdd851e[_0xc53e('0x40')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],_0xdd851e['query']);_0x4d2609[_0xc53e('0x3d')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],qs['fields'](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x4d2609['attributes']=_0x4d2609[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x4d2609['attributes']:_0xdd851e['model'];_0x4d2609[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x15f6cb['query']['sort']);_0x4d2609[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x15f6cb['query'],_0xdd851e[_0xc53e('0x40')]));if(_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x45')]){_0x4d2609[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x4d2609[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x4d2609[_0xc53e('0x3d')],function(_0x258be8){var _0x2cd553={};_0x2cd553[_0x258be8]={'$like':'%'+_0x15f6cb['query'][_0xc53e('0x45')]+'%'};return _0x2cd553;})});}_0x4d2609=_['merge']({},_0x4d2609,_0x15f6cb[_0xc53e('0x4e')]);return _0xef9095[_0xc53e('0x58')](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x2c027c){if(_0x2c027c){_0x26e3ba=_0x2c027c[_0xc53e('0x4d')];if(!_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x4d2609[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x15f6cb['query'][_0xc53e('0x29')]);_0x4d2609['offset']=qs[_0xc53e('0x28')](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0xef9095['getDescriptions'](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x340db2){if(_0x340db2){return _0x340db2?{'count':_0x26e3ba,'rows':_0x340db2}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x1c15a3,null))[_0xc53e('0x4b')](handleError(_0x1c15a3,null));};exports[_0xc53e('0x5a')]=function(_0x508671,_0x2601ba,_0x48e337){var _0x56c66f={};var _0x42b53b={};var _0xe1a82c;var _0x25469e;return db['FreshsalesConfiguration'][_0xc53e('0x59')]({'where':{'id':_0x508671[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x2601ba,null))[_0xc53e('0x1a')](function(_0x4699b7){if(_0x4699b7){_0xe1a82c=_0x4699b7;_0x42b53b['model']=_['keys'](db[_0xc53e('0x54')]['rawAttributes']);_0x42b53b[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x508671[_0xc53e('0x39')]);_0x42b53b['filters']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],_0x42b53b[_0xc53e('0x39')]);_0x56c66f['attributes']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x56c66f['attributes']=_0x56c66f[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x56c66f[_0xc53e('0x3d')]:_0x42b53b[_0xc53e('0x38')];_0x56c66f[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3f')]);_0x56c66f[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x508671[_0xc53e('0x39')],_0x42b53b[_0xc53e('0x40')]));if(_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]){_0x56c66f[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x56c66f[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x56c66f['attributes'],function(_0x3a54ef){var _0x190509={};_0x190509[_0x3a54ef]={'$like':'%'+_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x190509;})});}_0x56c66f=_['merge']({},_0x56c66f,_0x508671[_0xc53e('0x4e')]);return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x92c9bc){if(_0x92c9bc){_0x25469e=_0x92c9bc['length'];if(!_0x508671[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x56c66f[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x508671[_0xc53e('0x39')][_0xc53e('0x29')]);_0x56c66f['offset']=qs[_0xc53e('0x28')](_0x508671['query'][_0xc53e('0x28')]);}return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x4c6ddc){if(_0x4c6ddc){return _0x4c6ddc?{'count':_0x25469e,'rows':_0x4c6ddc}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x2601ba,null))[_0xc53e('0x4b')](handleError(_0x2601ba,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index e3b3925..723a8b6 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 _0x296f=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','int_freshsales_configurations'];(function(_0xc4e766,_0x2c6707){var _0x2f9abe=function(_0x2cdaf3){while(--_0x2cdaf3){_0xc4e766['push'](_0xc4e766['shift']());}};_0x2f9abe(++_0x2c6707);}(_0x296f,0xf0));var _0xf296=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x296f[_0x57fa33];return _0x12e724;};'use strict';var _=require(_0xf296('0x0'));var util=require(_0xf296('0x1'));var logger=require(_0xf296('0x2'))(_0xf296('0x3'));var moment=require(_0xf296('0x4'));var BPromise=require(_0xf296('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf296('0x6'));var config=require(_0xf296('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x4c9620,_0x41a1b3){return _0x4c9620[_0xf296('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0xf296('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8db0=['FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','moment','bluebird','path','exports'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x8db0,0x65));var _0x08db=function(_0x158a58,_0x28e8e7){_0x158a58=_0x158a58-0x0;var _0x4935d9=_0x8db0[_0x158a58];return _0x4935d9;};'use strict';var _=require(_0x08db('0x0'));var util=require(_0x08db('0x1'));var logger=require('../../config/logger')(_0x08db('0x2'));var moment=require(_0x08db('0x3'));var BPromise=require(_0x08db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x08db('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x08db('0x6')]=function(_0x55af6b,_0x14b0e6){return _0x55af6b['define'](_0x08db('0x7'),attributes,{'tableName':_0x08db('0x8'),'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 25d9ec3..733560f 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 _0x7382=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','randomstring'];(function(_0x335f60,_0x41c377){var _0x4f2e9a=function(_0x5821dd){while(--_0x5821dd){_0x335f60['push'](_0x335f60['shift']());}};_0x4f2e9a(++_0x41c377);}(_0x7382,0x1f2));var _0x2738=function(_0x36f8d9,_0x381e8c){_0x36f8d9=_0x36f8d9-0x0;var _0x261804=_0x7382[_0x36f8d9];return _0x261804;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2738('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2738('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x2738('0x3'))(_0x2738('0x4'));var config=require('../../config/environment');var jayson=require(_0x2738('0x5'));var client=jayson[_0x2738('0x6')][_0x2738('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1437b0,_0x4f0d91,_0x99e22e){return new BPromise(function(_0x20a64f,_0x351335){return client[_0x2738('0x8')](_0x1437b0,_0x99e22e)[_0x2738('0x9')](function(_0x4d8c36){logger[_0x2738('0xa')](_0x2738('0xb'),_0x4f0d91,_0x2738('0xc'));logger[_0x2738('0xd')](_0x2738('0xe'),_0x4f0d91,'request\x20sent',JSON['stringify'](_0x4d8c36));if(_0x4d8c36['error']){if(_0x4d8c36[_0x2738('0xf')][_0x2738('0x10')]===0x1f4){logger[_0x2738('0xf')](_0x2738('0xb'),_0x4f0d91,_0x4d8c36[_0x2738('0xf')][_0x2738('0x11')]);return _0x351335(_0x4d8c36[_0x2738('0xf')][_0x2738('0x11')]);}logger[_0x2738('0xf')](_0x2738('0xb'),_0x4f0d91,_0x4d8c36[_0x2738('0xf')][_0x2738('0x11')]);return _0x20a64f(_0x4d8c36['error'][_0x2738('0x11')]);}else{logger[_0x2738('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4f0d91,'request\x20sent');_0x20a64f(_0x4d8c36[_0x2738('0x12')][_0x2738('0x11')]);}})[_0x2738('0x13')](function(_0x588a68){logger[_0x2738('0xf')](_0x2738('0xb'),_0x4f0d91,_0x588a68);_0x351335(_0x588a68);});});} \ 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(_0x26c5de,_0xc19855){var _0x10fb04=function(_0x4f99e0){while(--_0x4f99e0){_0x26c5de['push'](_0x26c5de['shift']());}};_0x10fb04(++_0xc19855);}(_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 076bfe4..2138d78 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 _0x5165=['multer','util','path','connect-timeout','express','../../components/auth/service','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','delete','destroy','exports'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0x5165,0x90));var _0x5516=function(_0x54e9e6,_0x5a0cf9){_0x54e9e6=_0x54e9e6-0x0;var _0x540fd6=_0x5165[_0x54e9e6];return _0x540fd6;};'use strict';var multer=require(_0x5516('0x0'));var util=require(_0x5516('0x1'));var path=require(_0x5516('0x2'));var timeout=require(_0x5516('0x3'));var express=require(_0x5516('0x4'));var router=express['Router']();var auth=require(_0x5516('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5516('0x6'));router[_0x5516('0x7')]('/',auth[_0x5516('0x8')](),controller[_0x5516('0x9')]);router[_0x5516('0x7')]('/:id',auth[_0x5516('0x8')](),controller[_0x5516('0xa')]);router[_0x5516('0xb')]('/',auth[_0x5516('0x8')](),controller[_0x5516('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5516('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5516('0xe')]);module[_0x5516('0xf')]=router; \ No newline at end of file +var _0xf713=['exports','path','Router','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x217e5b,_0x53776f){var _0x38f156=function(_0x24a68e){while(--_0x24a68e){_0x217e5b['push'](_0x217e5b['shift']());}};_0x38f156(++_0x53776f);}(_0xf713,0x1b1));var _0x3f71=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0xf713[_0x228641];return _0x5d5d78;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3f71('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3f71('0x1')]();var auth=require(_0x3f71('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x3f71('0x3'));var controller=require(_0x3f71('0x4'));router[_0x3f71('0x5')]('/',auth[_0x3f71('0x6')](),controller[_0x3f71('0x7')]);router['get'](_0x3f71('0x8'),auth[_0x3f71('0x6')](),controller['show']);router[_0x3f71('0x9')]('/',auth[_0x3f71('0x6')](),controller[_0x3f71('0xa')]);router[_0x3f71('0xb')](_0x3f71('0x8'),auth[_0x3f71('0x6')](),controller[_0x3f71('0xc')]);router[_0x3f71('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3f71('0xe')]);module[_0x3f71('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 67a8b87..38d353d 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 _0xabce=['ENUM','string','variable','picklist','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x4519b6,_0x8a5504){var _0x2dd602=function(_0x1ca4f9){while(--_0x1ca4f9){_0x4519b6['push'](_0x4519b6['shift']());}};_0x2dd602(++_0x8a5504);}(_0xabce,0x103));var _0xeabc=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xabce[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'type':{'type':Sequelize[_0xeabc('0x2')](_0xeabc('0x3'),_0xeabc('0x4'),'customVariable','keyValue',_0xeabc('0x5')),'defaultValue':_0xeabc('0x3')},'content':{'type':Sequelize[_0xeabc('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xeabc('0x3'),'variable',_0xeabc('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xeabc('0x6')]},'nameField':{'type':Sequelize[_0xeabc('0x6')]},'customField':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x24ca=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','customVariable','keyValue'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0x24ca,0x8c));var _0xa24c=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x24ca[_0x1e6db3];return _0x1de886;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa24c('0x1'),'variable',_0xa24c('0x2'),_0xa24c('0x3'),_0xa24c('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa24c('0x5')]},'key':{'type':Sequelize[_0xa24c('0x5')]},'keyType':{'type':Sequelize[_0xa24c('0x6')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xa24c('0x5')]},'idField':{'type':Sequelize[_0xa24c('0x5')]},'nameField':{'type':Sequelize[_0xa24c('0x5')]},'customField':{'type':Sequelize[_0xa24c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa24c('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index f3061ec..5d139b9 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 _0x4002=['../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','index','fieldName','type','key','model','map','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','FreshsalesField','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1c8133,_0x5caaed){var _0x1ac8ff=function(_0x18793a){while(--_0x18793a){_0x1c8133['push'](_0x1c8133['shift']());}};_0x1ac8ff(++_0x5caaed);}(_0x4002,0x15a));var _0x2400=function(_0x3efc42,_0x261cf3){_0x3efc42=_0x3efc42-0x0;var _0x3308a4=_0x4002[_0x3efc42];return _0x3308a4;};'use strict';var pdf=require(_0x2400('0x0'));var emlformat=require(_0x2400('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2400('0x2'));var moment=require(_0x2400('0x3'));var BPromise=require(_0x2400('0x4'));var Mustache=require(_0x2400('0x5'));var util=require(_0x2400('0x6'));var path=require(_0x2400('0x7'));var sox=require(_0x2400('0x8'));var csv=require(_0x2400('0x9'));var ejs=require(_0x2400('0xa'));var fs=require('fs');var _=require(_0x2400('0xb'));var squel=require(_0x2400('0xc'));var crypto=require(_0x2400('0xd'));var jsforce=require(_0x2400('0xe'));var deskjs=require(_0x2400('0xf'));var toCsv=require(_0x2400('0x9'));var querystring=require(_0x2400('0x10'));var Papa=require(_0x2400('0x11'));var Redis=require(_0x2400('0x12'));var authService=require(_0x2400('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2400('0x14'));var logger=require('../../config/logger')(_0x2400('0x15'));var utils=require('../../config/utils');var config=require(_0x2400('0x16'));var licenseUtil=require(_0x2400('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fc96a,_0x47405f){_0x47405f=_0x47405f||0xcc;return function(_0x5e1f94){if(_0x5e1f94){return _0x1fc96a[_0x2400('0x18')](_0x47405f);}return _0x1fc96a[_0x2400('0x19')](_0x47405f)['end']();};}function respondWithResult(_0x237600,_0x101907){_0x101907=_0x101907||0xc8;return function(_0x409e10){if(_0x409e10){return _0x237600[_0x2400('0x19')](_0x101907)[_0x2400('0x1a')](_0x409e10);}};}function respondWithFilteredResult(_0x1e68e5,_0x31cc20){return function(_0x5319cd){if(_0x5319cd){var _0x23ee8e=_0x5319cd[_0x2400('0x1b')],_0x334ae5=_0x31cc20[_0x2400('0x1c')],_0x3bae6a=_0x31cc20[_0x2400('0x1c')]+_0x31cc20[_0x2400('0x1d')],_0x47bbfd;if(_0x3bae6a>=_0x23ee8e){_0x3bae6a=_0x23ee8e;_0x47bbfd=0xc8;}else{_0x47bbfd=0xce;}_0x1e68e5['status'](_0x47bbfd);return _0x1e68e5[_0x2400('0x1e')](_0x2400('0x1f'),_0x334ae5+'-'+_0x3bae6a+'/'+_0x23ee8e)[_0x2400('0x1a')](_0x5319cd);}return null;};}function patchUpdates(_0x31daa4){return function(_0x327c31){try{jsonpatch['apply'](_0x327c31,_0x31daa4,!![]);}catch(_0x4ed1fd){return BPromise[_0x2400('0x20')](_0x4ed1fd);}return _0x327c31['save']();};}function saveUpdates(_0x3b902d,_0x320730){return function(_0x4249e6){if(_0x4249e6){return _0x4249e6[_0x2400('0x21')](_0x3b902d)[_0x2400('0x22')](function(_0x4ca8af){return _0x4ca8af;});}return null;};}function removeEntity(_0x30f06e,_0xdc7459){return function(_0x534d76){if(_0x534d76){return _0x534d76[_0x2400('0x23')]()[_0x2400('0x22')](function(){_0x30f06e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27294f,_0x4ce5be){return function(_0xcf3821){if(!_0xcf3821){_0x27294f[_0x2400('0x18')](0x194);}return _0xcf3821;};}function handleError(_0x520d65,_0x2da2b4){_0x2da2b4=_0x2da2b4||0x1f4;return function(_0x26d877){logger[_0x2400('0x24')](_0x26d877[_0x2400('0x25')]);if(_0x26d877['name']){delete _0x26d877['name'];}_0x520d65[_0x2400('0x19')](_0x2da2b4)['send'](_0x26d877);};}exports[_0x2400('0x26')]=function(_0x41e16e,_0xde9168){var _0x576aac={},_0x3cda22={},_0x426526={'count':0x0,'rows':[]};var _0x2713d2=_['map'](db['FreshsalesField']['rawAttributes'],function(_0x50333d){return{'name':_0x50333d[_0x2400('0x27')],'type':_0x50333d[_0x2400('0x28')][_0x2400('0x29')]};});_0x3cda22[_0x2400('0x2a')]=_[_0x2400('0x2b')](_0x2713d2,_0x2400('0x2c'));_0x3cda22[_0x2400('0x2d')]=_[_0x2400('0x2e')](_0x41e16e[_0x2400('0x2d')]);_0x3cda22[_0x2400('0x2f')]=_['intersection'](_0x3cda22[_0x2400('0x2a')],_0x3cda22['query']);_0x576aac[_0x2400('0x30')]=_['intersection'](_0x3cda22['model'],qs[_0x2400('0x31')](_0x41e16e[_0x2400('0x2d')]['fields']));_0x576aac[_0x2400('0x30')]=_0x576aac[_0x2400('0x30')][_0x2400('0x32')]?_0x576aac['attributes']:_0x3cda22[_0x2400('0x2a')];if(!_0x41e16e['query'][_0x2400('0x33')](_0x2400('0x34'))){_0x576aac[_0x2400('0x1d')]=qs[_0x2400('0x1d')](_0x41e16e[_0x2400('0x2d')][_0x2400('0x1d')]);_0x576aac[_0x2400('0x1c')]=qs['offset'](_0x41e16e[_0x2400('0x2d')][_0x2400('0x1c')]);}_0x576aac[_0x2400('0x35')]=qs[_0x2400('0x36')](_0x41e16e[_0x2400('0x2d')][_0x2400('0x36')]);_0x576aac[_0x2400('0x37')]=qs['filters'](_[_0x2400('0x38')](_0x41e16e[_0x2400('0x2d')],_0x3cda22[_0x2400('0x2f')]),_0x2713d2);if(_0x41e16e['query'][_0x2400('0x39')]){_0x576aac[_0x2400('0x37')]=_['merge'](_0x576aac['where'],{'$or':_[_0x2400('0x2b')](_0x2713d2,function(_0x305f22){if(_0x305f22['type']!==_0x2400('0x3a')){var _0x403f3c={};_0x403f3c[_0x305f22[_0x2400('0x2c')]]={'$like':'%'+_0x41e16e[_0x2400('0x2d')][_0x2400('0x39')]+'%'};return _0x403f3c;}})});}_0x576aac=_['merge']({},_0x576aac,_0x41e16e[_0x2400('0x3b')]);var _0xe998c7={'where':_0x576aac[_0x2400('0x37')]};return db[_0x2400('0x3c')][_0x2400('0x1b')](_0xe998c7)[_0x2400('0x22')](function(_0x575c56){_0x426526['count']=_0x575c56;if(_0x41e16e[_0x2400('0x2d')][_0x2400('0x3d')]){_0x576aac['include']=[{'all':!![]}];}return db[_0x2400('0x3c')][_0x2400('0x3e')](_0x576aac);})[_0x2400('0x22')](function(_0x5d54c8){_0x426526[_0x2400('0x3f')]=_0x5d54c8;return _0x426526;})[_0x2400('0x22')](respondWithFilteredResult(_0xde9168,_0x576aac))[_0x2400('0x40')](handleError(_0xde9168,null));};exports[_0x2400('0x41')]=function(_0xbdb0ba,_0x172d0a){var _0x1635ff={'raw':!![],'where':{'id':_0xbdb0ba[_0x2400('0x42')]['id']}},_0x599f6c={};_0x599f6c[_0x2400('0x2a')]=_[_0x2400('0x2e')](db[_0x2400('0x3c')][_0x2400('0x43')]);_0x599f6c[_0x2400('0x2d')]=_[_0x2400('0x2e')](_0xbdb0ba['query']);_0x599f6c[_0x2400('0x2f')]=_['intersection'](_0x599f6c['model'],_0x599f6c[_0x2400('0x2d')]);_0x1635ff[_0x2400('0x30')]=_[_0x2400('0x44')](_0x599f6c['model'],qs['fields'](_0xbdb0ba['query'][_0x2400('0x31')]));_0x1635ff[_0x2400('0x30')]=_0x1635ff['attributes'][_0x2400('0x32')]?_0x1635ff[_0x2400('0x30')]:_0x599f6c[_0x2400('0x2a')];if(_0xbdb0ba[_0x2400('0x2d')]['includeAll']){_0x1635ff[_0x2400('0x45')]=[{'all':!![]}];}_0x1635ff=_['merge']({},_0x1635ff,_0xbdb0ba[_0x2400('0x3b')]);return db[_0x2400('0x3c')][_0x2400('0x46')](_0x1635ff)['then'](handleEntityNotFound(_0x172d0a,null))[_0x2400('0x22')](respondWithResult(_0x172d0a,null))[_0x2400('0x40')](handleError(_0x172d0a,null));};exports[_0x2400('0x47')]=function(_0x2cc113,_0x4d17a9){return db['FreshsalesField'][_0x2400('0x47')](_0x2cc113[_0x2400('0x48')],{})[_0x2400('0x22')](respondWithResult(_0x4d17a9,0xc9))[_0x2400('0x40')](handleError(_0x4d17a9,null));};exports['update']=function(_0x58b7a0,_0x23ac7c){if(_0x58b7a0[_0x2400('0x48')]['id']){delete _0x58b7a0['body']['id'];}return db['FreshsalesField'][_0x2400('0x46')]({'where':{'id':_0x58b7a0[_0x2400('0x42')]['id']}})[_0x2400('0x22')](handleEntityNotFound(_0x23ac7c,null))[_0x2400('0x22')](saveUpdates(_0x58b7a0[_0x2400('0x48')],null))['then'](respondWithResult(_0x23ac7c,null))[_0x2400('0x40')](handleError(_0x23ac7c,null));};exports[_0x2400('0x23')]=function(_0x31dd15,_0x55c14a){return db[_0x2400('0x3c')][_0x2400('0x46')]({'where':{'id':_0x31dd15[_0x2400('0x42')]['id']}})['then'](handleEntityNotFound(_0x55c14a,null))[_0x2400('0x22')](removeEntity(_0x55c14a,null))[_0x2400('0x40')](handleError(_0x55c14a,null));}; \ No newline at end of file +var _0x3c2d=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','fields','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','util','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x3c2d,0x1e9));var _0xd3c2=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x3c2d[_0x4e676e];return _0x336a3c;};'use strict';var pdf=require(_0xd3c2('0x0'));var emlformat=require(_0xd3c2('0x1'));var rimraf=require(_0xd3c2('0x2'));var zipdir=require(_0xd3c2('0x3'));var jsonpatch=require(_0xd3c2('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd3c2('0x5'));var path=require('path');var sox=require(_0xd3c2('0x6'));var csv=require('to-csv');var ejs=require(_0xd3c2('0x7'));var fs=require('fs');var _=require(_0xd3c2('0x8'));var squel=require(_0xd3c2('0x9'));var crypto=require('crypto');var jsforce=require(_0xd3c2('0xa'));var deskjs=require(_0xd3c2('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd3c2('0xc'));var Papa=require(_0xd3c2('0xd'));var Redis=require(_0xd3c2('0xe'));var authService=require(_0xd3c2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd3c2('0x10'));var hardwareService=require(_0xd3c2('0x11'));var logger=require(_0xd3c2('0x12'))(_0xd3c2('0x13'));var utils=require(_0xd3c2('0x14'));var config=require(_0xd3c2('0x15'));var licenseUtil=require(_0xd3c2('0x16'));var db=require(_0xd3c2('0x17'))['db'];function respondWithStatusCode(_0x4ad8e2,_0x2ccdbf){_0x2ccdbf=_0x2ccdbf||0xcc;return function(_0x39781c){if(_0x39781c){return _0x4ad8e2[_0xd3c2('0x18')](_0x2ccdbf);}return _0x4ad8e2[_0xd3c2('0x19')](_0x2ccdbf)[_0xd3c2('0x1a')]();};}function respondWithResult(_0x52b2f0,_0x54ced2){_0x54ced2=_0x54ced2||0xc8;return function(_0x1956f6){if(_0x1956f6){return _0x52b2f0[_0xd3c2('0x19')](_0x54ced2)[_0xd3c2('0x1b')](_0x1956f6);}};}function respondWithFilteredResult(_0x4f0c79,_0x39fab0){return function(_0x39954c){if(_0x39954c){var _0x1dbfec=_0x39954c[_0xd3c2('0x1c')],_0x314b82=_0x39fab0[_0xd3c2('0x1d')],_0x4c0821=_0x39fab0[_0xd3c2('0x1d')]+_0x39fab0[_0xd3c2('0x1e')],_0x16dd1b;if(_0x4c0821>=_0x1dbfec){_0x4c0821=_0x1dbfec;_0x16dd1b=0xc8;}else{_0x16dd1b=0xce;}_0x4f0c79[_0xd3c2('0x19')](_0x16dd1b);return _0x4f0c79[_0xd3c2('0x1f')](_0xd3c2('0x20'),_0x314b82+'-'+_0x4c0821+'/'+_0x1dbfec)[_0xd3c2('0x1b')](_0x39954c);}return null;};}function patchUpdates(_0x505180){return function(_0x20cbfa){try{jsonpatch[_0xd3c2('0x21')](_0x20cbfa,_0x505180,!![]);}catch(_0x43b3c7){return BPromise[_0xd3c2('0x22')](_0x43b3c7);}return _0x20cbfa['save']();};}function saveUpdates(_0x1ba5bf,_0x201e53){return function(_0x1134a0){if(_0x1134a0){return _0x1134a0[_0xd3c2('0x23')](_0x1ba5bf)[_0xd3c2('0x24')](function(_0x8ea82e){return _0x8ea82e;});}return null;};}function removeEntity(_0x1196b5,_0x16875e){return function(_0x2b7f60){if(_0x2b7f60){return _0x2b7f60[_0xd3c2('0x25')]()[_0xd3c2('0x24')](function(){_0x1196b5[_0xd3c2('0x19')](0xcc)[_0xd3c2('0x1a')]();});}};}function handleEntityNotFound(_0x19ddf7,_0x1d7909){return function(_0x5aca5c){if(!_0x5aca5c){_0x19ddf7[_0xd3c2('0x18')](0x194);}return _0x5aca5c;};}function handleError(_0x4fd29e,_0x5ae51d){_0x5ae51d=_0x5ae51d||0x1f4;return function(_0xfc64c8){logger[_0xd3c2('0x26')](_0xfc64c8['stack']);if(_0xfc64c8[_0xd3c2('0x27')]){delete _0xfc64c8[_0xd3c2('0x27')];}_0x4fd29e[_0xd3c2('0x19')](_0x5ae51d)[_0xd3c2('0x28')](_0xfc64c8);};}exports[_0xd3c2('0x29')]=function(_0x4026fa,_0x4985cc){var _0x2674c9={},_0x47d72a={},_0x1c0c42={'count':0x0,'rows':[]};var _0x1bbf43=_[_0xd3c2('0x2a')](db[_0xd3c2('0x2b')][_0xd3c2('0x2c')],function(_0x24e40b){return{'name':_0x24e40b[_0xd3c2('0x2d')],'type':_0x24e40b[_0xd3c2('0x2e')]['key']};});_0x47d72a['model']=_[_0xd3c2('0x2a')](_0x1bbf43,_0xd3c2('0x27'));_0x47d72a[_0xd3c2('0x2f')]=_[_0xd3c2('0x30')](_0x4026fa[_0xd3c2('0x2f')]);_0x47d72a['filters']=_[_0xd3c2('0x31')](_0x47d72a[_0xd3c2('0x32')],_0x47d72a[_0xd3c2('0x2f')]);_0x2674c9[_0xd3c2('0x33')]=_['intersection'](_0x47d72a[_0xd3c2('0x32')],qs['fields'](_0x4026fa[_0xd3c2('0x2f')]['fields']));_0x2674c9[_0xd3c2('0x33')]=_0x2674c9[_0xd3c2('0x33')]['length']?_0x2674c9[_0xd3c2('0x33')]:_0x47d72a['model'];if(!_0x4026fa[_0xd3c2('0x2f')][_0xd3c2('0x34')](_0xd3c2('0x35'))){_0x2674c9['limit']=qs[_0xd3c2('0x1e')](_0x4026fa[_0xd3c2('0x2f')]['limit']);_0x2674c9['offset']=qs[_0xd3c2('0x1d')](_0x4026fa['query'][_0xd3c2('0x1d')]);}_0x2674c9[_0xd3c2('0x36')]=qs['sort'](_0x4026fa['query'][_0xd3c2('0x37')]);_0x2674c9['where']=qs[_0xd3c2('0x38')](_[_0xd3c2('0x39')](_0x4026fa[_0xd3c2('0x2f')],_0x47d72a[_0xd3c2('0x38')]),_0x1bbf43);if(_0x4026fa[_0xd3c2('0x2f')][_0xd3c2('0x3a')]){_0x2674c9[_0xd3c2('0x3b')]=_[_0xd3c2('0x3c')](_0x2674c9[_0xd3c2('0x3b')],{'$or':_[_0xd3c2('0x2a')](_0x1bbf43,function(_0x5f2b8d){if(_0x5f2b8d[_0xd3c2('0x2e')]!==_0xd3c2('0x3d')){var _0x10da22={};_0x10da22[_0x5f2b8d['name']]={'$like':'%'+_0x4026fa['query'][_0xd3c2('0x3a')]+'%'};return _0x10da22;}})});}_0x2674c9=_['merge']({},_0x2674c9,_0x4026fa[_0xd3c2('0x3e')]);var _0x19c69c={'where':_0x2674c9[_0xd3c2('0x3b')]};return db[_0xd3c2('0x2b')][_0xd3c2('0x1c')](_0x19c69c)[_0xd3c2('0x24')](function(_0x15911f){_0x1c0c42[_0xd3c2('0x1c')]=_0x15911f;if(_0x4026fa[_0xd3c2('0x2f')][_0xd3c2('0x3f')]){_0x2674c9[_0xd3c2('0x40')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x2674c9);})[_0xd3c2('0x24')](function(_0x412244){_0x1c0c42[_0xd3c2('0x41')]=_0x412244;return _0x1c0c42;})['then'](respondWithFilteredResult(_0x4985cc,_0x2674c9))[_0xd3c2('0x42')](handleError(_0x4985cc,null));};exports[_0xd3c2('0x43')]=function(_0x463e03,_0x160fdf){var _0x4b9ef5={'raw':!![],'where':{'id':_0x463e03['params']['id']}},_0x53303f={};_0x53303f[_0xd3c2('0x32')]=_['keys'](db[_0xd3c2('0x2b')]['rawAttributes']);_0x53303f[_0xd3c2('0x2f')]=_[_0xd3c2('0x30')](_0x463e03[_0xd3c2('0x2f')]);_0x53303f[_0xd3c2('0x38')]=_[_0xd3c2('0x31')](_0x53303f[_0xd3c2('0x32')],_0x53303f[_0xd3c2('0x2f')]);_0x4b9ef5[_0xd3c2('0x33')]=_[_0xd3c2('0x31')](_0x53303f['model'],qs[_0xd3c2('0x44')](_0x463e03[_0xd3c2('0x2f')][_0xd3c2('0x44')]));_0x4b9ef5[_0xd3c2('0x33')]=_0x4b9ef5[_0xd3c2('0x33')]['length']?_0x4b9ef5['attributes']:_0x53303f[_0xd3c2('0x32')];if(_0x463e03[_0xd3c2('0x2f')]['includeAll']){_0x4b9ef5[_0xd3c2('0x40')]=[{'all':!![]}];}_0x4b9ef5=_[_0xd3c2('0x3c')]({},_0x4b9ef5,_0x463e03[_0xd3c2('0x3e')]);return db['FreshsalesField'][_0xd3c2('0x45')](_0x4b9ef5)[_0xd3c2('0x24')](handleEntityNotFound(_0x160fdf,null))[_0xd3c2('0x24')](respondWithResult(_0x160fdf,null))[_0xd3c2('0x42')](handleError(_0x160fdf,null));};exports[_0xd3c2('0x46')]=function(_0x4a7494,_0x7e6198){return db[_0xd3c2('0x2b')]['create'](_0x4a7494[_0xd3c2('0x47')],{})[_0xd3c2('0x24')](respondWithResult(_0x7e6198,0xc9))[_0xd3c2('0x42')](handleError(_0x7e6198,null));};exports['update']=function(_0x34adbb,_0x254442){if(_0x34adbb[_0xd3c2('0x47')]['id']){delete _0x34adbb[_0xd3c2('0x47')]['id'];}return db[_0xd3c2('0x2b')][_0xd3c2('0x45')]({'where':{'id':_0x34adbb[_0xd3c2('0x48')]['id']}})[_0xd3c2('0x24')](handleEntityNotFound(_0x254442,null))[_0xd3c2('0x24')](saveUpdates(_0x34adbb[_0xd3c2('0x47')],null))[_0xd3c2('0x24')](respondWithResult(_0x254442,null))[_0xd3c2('0x42')](handleError(_0x254442,null));};exports['destroy']=function(_0x2d670c,_0xabfaf0){return db['FreshsalesField']['find']({'where':{'id':_0x2d670c[_0xd3c2('0x48')]['id']}})['then'](handleEntityNotFound(_0xabfaf0,null))[_0xd3c2('0x24')](removeEntity(_0xabfaf0,null))[_0xd3c2('0x42')](handleError(_0xabfaf0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 4845cd9..ba91fcd 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 _0xb793=['moment','bluebird','rimraf','../../config/environment','exports','define','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb793,0xbc));var _0x3b79=function(_0x39387a,_0x1a4c20){_0x39387a=_0x39387a-0x0;var _0x44f1de=_0xb793[_0x39387a];return _0x44f1de;};'use strict';var _=require(_0x3b79('0x0'));var util=require(_0x3b79('0x1'));var logger=require(_0x3b79('0x2'))(_0x3b79('0x3'));var moment=require(_0x3b79('0x4'));var BPromise=require(_0x3b79('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3b79('0x6'));var config=require(_0x3b79('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0x3b79('0x8')]=function(_0x4f83b8,_0x36aeef){return _0x4f83b8[_0x3b79('0x9')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x3b79('0xa'),'fields':['idField',_0x3b79('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b14=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2b14,0x1db));var _0x42b1=function(_0x16bc58,_0x3ec58c){_0x16bc58=_0x16bc58-0x0;var _0x2bcfda=_0x2b14[_0x16bc58];return _0x2bcfda;};'use strict';var _=require(_0x42b1('0x0'));var util=require(_0x42b1('0x1'));var logger=require('../../config/logger')(_0x42b1('0x2'));var moment=require(_0x42b1('0x3'));var BPromise=require(_0x42b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x42b1('0x5'));var config=require(_0x42b1('0x6'));var attributes=require(_0x42b1('0x7'));module[_0x42b1('0x8')]=function(_0x1ba87a,_0x51524a){return _0x1ba87a[_0x42b1('0x9')](_0x42b1('0xa'),attributes,{'tableName':_0x42b1('0xb'),'paranoid':![],'indexes':[{'name':_0x42b1('0xc'),'fields':[_0x42b1('0xd'),_0x42b1('0xe')],'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 74ca27d..9b7d4d7 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 _0xd5c8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0xd5c8,0x166));var _0x8d5c=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0xd5c8[_0x4907de];return _0x482054;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8d5c('0x0'));var BPromise=require(_0x8d5c('0x1'));var rs=require(_0x8d5c('0x2'));var fs=require('fs');var Redis=require(_0x8d5c('0x3'));var db=require(_0x8d5c('0x4'))['db'];var utils=require(_0x8d5c('0x5'));var logger=require(_0x8d5c('0x6'))(_0x8d5c('0x7'));var config=require(_0x8d5c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8d5c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x593344,_0x323fce,_0x43dd48){return new BPromise(function(_0x1ed3e9,_0x3f3071){return client['request'](_0x593344,_0x43dd48)['then'](function(_0x18f9b6){logger['info'](_0x8d5c('0xa'),_0x323fce,_0x8d5c('0xb'));logger[_0x8d5c('0xc')](_0x8d5c('0xd'),_0x323fce,_0x8d5c('0xb'),JSON[_0x8d5c('0xe')](_0x18f9b6));if(_0x18f9b6[_0x8d5c('0xf')]){if(_0x18f9b6[_0x8d5c('0xf')][_0x8d5c('0x10')]===0x1f4){logger[_0x8d5c('0xf')](_0x8d5c('0xa'),_0x323fce,_0x18f9b6[_0x8d5c('0xf')]['message']);return _0x3f3071(_0x18f9b6[_0x8d5c('0xf')][_0x8d5c('0x11')]);}logger[_0x8d5c('0xf')](_0x8d5c('0xa'),_0x323fce,_0x18f9b6[_0x8d5c('0xf')][_0x8d5c('0x11')]);return _0x1ed3e9(_0x18f9b6[_0x8d5c('0xf')][_0x8d5c('0x11')]);}else{logger['info'](_0x8d5c('0xa'),_0x323fce,_0x8d5c('0xb'));_0x1ed3e9(_0x18f9b6['result']['message']);}})[_0x8d5c('0x12')](function(_0x4a1dab){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x323fce,_0x4a1dab);_0x3f3071(_0x4a1dab);});});} \ No newline at end of file +var _0x69bf=['lodash','util','moment','ioredis','../../config/utils','rpc','jayson/promise','http','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x33f2c3,_0x1380cf){var _0x33d96b=function(_0x3ca855){while(--_0x3ca855){_0x33f2c3['push'](_0x33f2c3['shift']());}};_0x33d96b(++_0x1380cf);}(_0x69bf,0x1cb));var _0xf69b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x69bf[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf69b('0x0'));var util=require(_0xf69b('0x1'));var moment=require(_0xf69b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf69b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf69b('0x4'));var logger=require('../../config/logger')(_0xf69b('0x5'));var config=require('../../config/environment');var jayson=require(_0xf69b('0x6'));var client=jayson['client'][_0xf69b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x382046,_0x44f23d,_0x4e7d96){return new BPromise(function(_0x5b3914,_0x4570d1){return client['request'](_0x382046,_0x4e7d96)[_0xf69b('0x8')](function(_0x1f90e6){logger['info'](_0xf69b('0x9'),_0x44f23d,_0xf69b('0xa'));logger[_0xf69b('0xb')](_0xf69b('0xc'),_0x44f23d,'request\x20sent',JSON[_0xf69b('0xd')](_0x1f90e6));if(_0x1f90e6['error']){if(_0x1f90e6[_0xf69b('0xe')]['code']===0x1f4){logger[_0xf69b('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x44f23d,_0x1f90e6[_0xf69b('0xe')][_0xf69b('0xf')]);return _0x4570d1(_0x1f90e6[_0xf69b('0xe')]['message']);}logger[_0xf69b('0xe')](_0xf69b('0x9'),_0x44f23d,_0x1f90e6[_0xf69b('0xe')][_0xf69b('0xf')]);return _0x5b3914(_0x1f90e6[_0xf69b('0xe')]['message']);}else{logger['info'](_0xf69b('0x9'),_0x44f23d,_0xf69b('0xa'));_0x5b3914(_0x1f90e6['result'][_0xf69b('0xf')]);}})[_0xf69b('0x10')](function(_0x3a1430){logger['error'](_0xf69b('0x9'),_0x44f23d,_0x3a1430);_0x4570d1(_0x3a1430);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 3d4ef9b..313f9c7 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 _0xceb2=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update'];(function(_0x475a2b,_0x986995){var _0xd1b89=function(_0x5e9b69){while(--_0x5e9b69){_0x475a2b['push'](_0x475a2b['shift']());}};_0xd1b89(++_0x986995);}(_0xceb2,0x119));var _0x2ceb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceb2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2ceb('0x0'));var util=require(_0x2ceb('0x1'));var path=require(_0x2ceb('0x2'));var timeout=require(_0x2ceb('0x3'));var express=require(_0x2ceb('0x4'));var router=express[_0x2ceb('0x5')]();var auth=require(_0x2ceb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceAccount.controller');router['get']('/',auth[_0x2ceb('0x7')](),controller[_0x2ceb('0x8')]);router[_0x2ceb('0x9')](_0x2ceb('0xa'),auth[_0x2ceb('0x7')](),controller['show']);router[_0x2ceb('0x9')](_0x2ceb('0xb'),auth[_0x2ceb('0x7')](),controller[_0x2ceb('0xc')]);router[_0x2ceb('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2ceb('0xd')]);router[_0x2ceb('0xe')]('/',auth[_0x2ceb('0x7')](),controller[_0x2ceb('0xf')]);router[_0x2ceb('0xe')](_0x2ceb('0xb'),auth['isAuthenticated'](),controller[_0x2ceb('0x10')]);router[_0x2ceb('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2ceb('0x12')]);router['delete'](_0x2ceb('0xa'),auth[_0x2ceb('0x7')](),controller[_0x2ceb('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3249=['delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','get','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update'];(function(_0x329437,_0x1de73a){var _0x3789d9=function(_0x37832e){while(--_0x37832e){_0x329437['push'](_0x329437['shift']());}};_0x3789d9(++_0x1de73a);}(_0x3249,0x17e));var _0x9324=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x3249[_0x565ed7];return _0x183ad7;};'use strict';var multer=require('multer');var util=require(_0x9324('0x0'));var path=require(_0x9324('0x1'));var timeout=require(_0x9324('0x2'));var express=require(_0x9324('0x3'));var router=express[_0x9324('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9324('0x5'));var config=require(_0x9324('0x6'));var controller=require('./intSalesforceAccount.controller');router['get']('/',auth[_0x9324('0x7')](),controller[_0x9324('0x8')]);router['get'](_0x9324('0x9'),auth[_0x9324('0x7')](),controller['show']);router[_0x9324('0xa')](_0x9324('0xb'),auth['isAuthenticated'](),controller[_0x9324('0xc')]);router['get']('/:id/fields',auth[_0x9324('0x7')](),controller[_0x9324('0xd')]);router[_0x9324('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9324('0xb'),auth['isAuthenticated'](),controller[_0x9324('0xf')]);router[_0x9324('0x10')](_0x9324('0x9'),auth['isAuthenticated'](),controller[_0x9324('0x11')]);router[_0x9324('0x12')](_0x9324('0x9'),auth[_0x9324('0x7')](),controller['destroy']);module[_0x9324('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index b8429b7..3c0050e 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 _0xa927=['STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0xa927,0x1d9));var _0x7a92=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa927[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x7a92('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7a92('0x1')],'unique':_0x7a92('0x2')},'remoteUri':{'type':Sequelize[_0x7a92('0x1')]},'password':{'type':Sequelize[_0x7a92('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x7a92('0x1')]},'serverUrl':{'type':Sequelize[_0x7a92('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7a92('0x3')](_0x7a92('0x4'),_0x7a92('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xeed7=['username','integrationTab','newTab','STRING'];(function(_0x23a4bc,_0x32deba){var _0x2a450e=function(_0x7ac12b){while(--_0x7ac12b){_0x23a4bc['push'](_0x23a4bc['shift']());}};_0x2a450e(++_0x32deba);}(_0xeed7,0xdf));var _0x7eed=function(_0x254a59,_0x135207){_0x254a59=_0x254a59-0x0;var _0x58eb5a=_0xeed7[_0x254a59];return _0x58eb5a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7eed('0x0')]},'description':{'type':Sequelize[_0x7eed('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0x7eed('0x1')},'remoteUri':{'type':Sequelize[_0x7eed('0x0')]},'password':{'type':Sequelize[_0x7eed('0x0')]},'clientId':{'type':Sequelize[_0x7eed('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x7eed('0x0')]},'serverUrl':{'type':Sequelize[_0x7eed('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7eed('0x2'),_0x7eed('0x3')),'defaultValue':_0x7eed('0x2')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index f8cb195..b8c8bbd 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 _0x4200=['../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','find','create','body','params','findOne','filters','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceConfiguration','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','string','picklist','boolean','textarea','phone','includes','custom','picklistValues','label','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x178f9c,_0x9dc87a){var _0x413f4a=function(_0xfe1042){while(--_0xfe1042){_0x178f9c['push'](_0x178f9c['shift']());}};_0x413f4a(++_0x9dc87a);}(_0x4200,0x188));var _0x0420=function(_0x7298b4,_0x2272db){_0x7298b4=_0x7298b4-0x0;var _0x579fd2=_0x4200[_0x7298b4];return _0x579fd2;};'use strict';var pdf=require(_0x0420('0x0'));var emlformat=require(_0x0420('0x1'));var rimraf=require(_0x0420('0x2'));var zipdir=require(_0x0420('0x3'));var jsonpatch=require(_0x0420('0x4'));var rp=require(_0x0420('0x5'));var moment=require(_0x0420('0x6'));var BPromise=require(_0x0420('0x7'));var Mustache=require(_0x0420('0x8'));var util=require('util');var path=require(_0x0420('0x9'));var sox=require(_0x0420('0xa'));var csv=require(_0x0420('0xb'));var ejs=require(_0x0420('0xc'));var fs=require('fs');var _=require(_0x0420('0xd'));var squel=require('squel');var crypto=require(_0x0420('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0420('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0420('0x10'));var Papa=require(_0x0420('0x11'));var Redis=require(_0x0420('0x12'));var authService=require(_0x0420('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0420('0x14'));var hardwareService=require(_0x0420('0x15'));var logger=require(_0x0420('0x16'))(_0x0420('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0420('0x18'));var db=require(_0x0420('0x19'))['db'];var integrations=require(_0x0420('0x1a'));var jayson=require(_0x0420('0x1b'));var client=jayson[_0x0420('0x1c')][_0x0420('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3eff93,_0x1e44d9,_0x3ad635,_0x5ddfb3){return new BPromise(function(_0x444a20,_0x2d1373){var _0xa076c9=_0x5ddfb3||client;return _0xa076c9[_0x0420('0x1e')](_0x3eff93,_0x3ad635)['then'](function(_0x3a3ce4){logger[_0x0420('0x1f')](_0x0420('0x20'),_0x1e44d9,_0x0420('0x21'));logger[_0x0420('0x22')](_0x0420('0x23'),_0x1e44d9,'request\x20sent',JSON[_0x0420('0x24')](_0x3a3ce4));if(_0x3a3ce4[_0x0420('0x25')]){if(_0x3a3ce4[_0x0420('0x25')][_0x0420('0x26')]===0x1f4){logger[_0x0420('0x25')]('SalesforceAccount,\x20%s,\x20%s',_0x1e44d9,_0x3a3ce4[_0x0420('0x25')][_0x0420('0x27')]);return _0x2d1373(_0x3a3ce4[_0x0420('0x25')]['message']);}logger[_0x0420('0x25')](_0x0420('0x20'),_0x1e44d9,_0x3a3ce4[_0x0420('0x25')][_0x0420('0x27')]);return _0x444a20(_0x3a3ce4[_0x0420('0x25')]['message']);}else{logger[_0x0420('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x1e44d9,'request\x20sent');_0x444a20(_0x3a3ce4['result'][_0x0420('0x27')]);}})[_0x0420('0x28')](function(_0x658ac8){logger[_0x0420('0x25')](_0x0420('0x20'),_0x1e44d9,_0x658ac8);_0x2d1373(_0x658ac8);});});}function respondWithStatusCode(_0x33d2f8,_0x5f423b){_0x5f423b=_0x5f423b||0xcc;return function(_0x542282){if(_0x542282){return _0x33d2f8[_0x0420('0x29')](_0x5f423b);}return _0x33d2f8[_0x0420('0x2a')](_0x5f423b)['end']();};}function respondWithResult(_0x5553c5,_0x59e354){_0x59e354=_0x59e354||0xc8;return function(_0x5af109){if(_0x5af109){return _0x5553c5[_0x0420('0x2a')](_0x59e354)[_0x0420('0x2b')](_0x5af109);}};}function respondWithFilteredResult(_0x17c737,_0x3905f7){return function(_0x36b55d){if(_0x36b55d){var _0x4e4fec=_0x36b55d[_0x0420('0x2c')],_0x52bc28=_0x3905f7[_0x0420('0x2d')],_0x373b2e=_0x3905f7[_0x0420('0x2d')]+_0x3905f7[_0x0420('0x2e')],_0x163512;if(_0x373b2e>=_0x4e4fec){_0x373b2e=_0x4e4fec;_0x163512=0xc8;}else{_0x163512=0xce;}_0x17c737[_0x0420('0x2a')](_0x163512);return _0x17c737[_0x0420('0x2f')](_0x0420('0x30'),_0x52bc28+'-'+_0x373b2e+'/'+_0x4e4fec)[_0x0420('0x2b')](_0x36b55d);}return null;};}function patchUpdates(_0x3866f1){return function(_0x179d6f){try{jsonpatch[_0x0420('0x31')](_0x179d6f,_0x3866f1,!![]);}catch(_0x3501c6){return BPromise[_0x0420('0x32')](_0x3501c6);}return _0x179d6f[_0x0420('0x33')]();};}function saveUpdates(_0x39c200,_0x4ffd3e){return function(_0x571607){if(_0x571607){return _0x571607[_0x0420('0x34')](_0x39c200)[_0x0420('0x35')](function(_0x1d537e){return _0x1d537e;});}return null;};}function removeEntity(_0xdc8093,_0x385278){return function(_0x4927a2){if(_0x4927a2){return _0x4927a2[_0x0420('0x36')]()[_0x0420('0x35')](function(){_0xdc8093['status'](0xcc)[_0x0420('0x37')]();});}};}function handleEntityNotFound(_0x43992c,_0x57fbbb){return function(_0x46b030){if(!_0x46b030){_0x43992c[_0x0420('0x29')](0x194);}return _0x46b030;};}function handleError(_0x51928c,_0x111e44){_0x111e44=_0x111e44||0x1f4;return function(_0x548531){logger['error'](_0x548531[_0x0420('0x38')]);if(_0x548531[_0x0420('0x39')]){delete _0x548531[_0x0420('0x39')];}_0x51928c[_0x0420('0x2a')](_0x111e44)[_0x0420('0x3a')](_0x548531);};}exports[_0x0420('0x3b')]=function(_0x508947,_0x239049){var _0x35f99e={},_0x3140f5={},_0x51ec21={'count':0x0,'rows':[]};var _0x44a653=_[_0x0420('0x3c')](db[_0x0420('0x3d')][_0x0420('0x3e')],function(_0x5c992a){return{'name':_0x5c992a[_0x0420('0x3f')],'type':_0x5c992a['type'][_0x0420('0x40')]};});_0x3140f5[_0x0420('0x41')]=_[_0x0420('0x3c')](_0x44a653,_0x0420('0x39'));_0x3140f5[_0x0420('0x42')]=_[_0x0420('0x43')](_0x508947[_0x0420('0x42')]);_0x3140f5['filters']=_['intersection'](_0x3140f5[_0x0420('0x41')],_0x3140f5[_0x0420('0x42')]);_0x35f99e[_0x0420('0x44')]=_[_0x0420('0x45')](_0x3140f5[_0x0420('0x41')],qs[_0x0420('0x46')](_0x508947['query']['fields']));_0x35f99e[_0x0420('0x44')]=_0x35f99e[_0x0420('0x44')][_0x0420('0x47')]?_0x35f99e[_0x0420('0x44')]:_0x3140f5[_0x0420('0x41')];if(!_0x508947['query'][_0x0420('0x48')]('nolimit')){_0x35f99e['limit']=qs[_0x0420('0x2e')](_0x508947[_0x0420('0x42')][_0x0420('0x2e')]);_0x35f99e[_0x0420('0x2d')]=qs[_0x0420('0x2d')](_0x508947['query'][_0x0420('0x2d')]);}_0x35f99e[_0x0420('0x49')]=qs[_0x0420('0x4a')](_0x508947[_0x0420('0x42')][_0x0420('0x4a')]);_0x35f99e[_0x0420('0x4b')]=qs['filters'](_['pick'](_0x508947[_0x0420('0x42')],_0x3140f5['filters']),_0x44a653);if(_0x508947[_0x0420('0x42')][_0x0420('0x4c')]){_0x35f99e[_0x0420('0x4b')]=_['merge'](_0x35f99e[_0x0420('0x4b')],{'$or':_[_0x0420('0x3c')](_0x44a653,function(_0x19dff9){if(_0x19dff9[_0x0420('0x4d')]!==_0x0420('0x4e')){var _0x41fa58={};_0x41fa58[_0x19dff9['name']]={'$like':'%'+_0x508947[_0x0420('0x42')][_0x0420('0x4c')]+'%'};return _0x41fa58;}})});}_0x35f99e=_[_0x0420('0x4f')]({},_0x35f99e,_0x508947[_0x0420('0x50')]);var _0x5a44ce={'where':_0x35f99e[_0x0420('0x4b')]};return db[_0x0420('0x3d')][_0x0420('0x2c')](_0x5a44ce)[_0x0420('0x35')](function(_0x3580a9){_0x51ec21[_0x0420('0x2c')]=_0x3580a9;if(_0x508947[_0x0420('0x42')][_0x0420('0x51')]){_0x35f99e[_0x0420('0x52')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x0420('0x53')](_0x35f99e);})['then'](function(_0x425e50){_0x51ec21['rows']=_0x425e50;return _0x51ec21;})[_0x0420('0x35')](respondWithFilteredResult(_0x239049,_0x35f99e))[_0x0420('0x28')](handleError(_0x239049,null));};exports[_0x0420('0x54')]=function(_0x1e93d4,_0xcb674a){var _0x57eede={'raw':![],'where':{'id':_0x1e93d4['params']['id']}},_0x3096f1={};_0x3096f1[_0x0420('0x41')]=_['keys'](db[_0x0420('0x3d')][_0x0420('0x3e')]);_0x3096f1['query']=_['keys'](_0x1e93d4[_0x0420('0x42')]);_0x3096f1['filters']=_[_0x0420('0x45')](_0x3096f1[_0x0420('0x41')],_0x3096f1['query']);_0x57eede[_0x0420('0x44')]=_[_0x0420('0x45')](_0x3096f1[_0x0420('0x41')],qs['fields'](_0x1e93d4['query'][_0x0420('0x46')]));_0x57eede[_0x0420('0x44')]=_0x57eede[_0x0420('0x44')][_0x0420('0x47')]?_0x57eede['attributes']:_0x3096f1[_0x0420('0x41')];if(_0x1e93d4['query'][_0x0420('0x51')]){_0x57eede['include']=[{'all':!![]}];}_0x57eede=_[_0x0420('0x4f')]({},_0x57eede,_0x1e93d4['options']);return db[_0x0420('0x3d')][_0x0420('0x55')](_0x57eede)[_0x0420('0x35')](handleEntityNotFound(_0xcb674a,null))[_0x0420('0x35')](respondWithResult(_0xcb674a,null))['catch'](handleError(_0xcb674a,null));};exports['create']=function(_0x3c1f4f,_0x315c7b){return db[_0x0420('0x3d')][_0x0420('0x56')](_0x3c1f4f[_0x0420('0x57')],{})['then'](respondWithResult(_0x315c7b,0xc9))['catch'](handleError(_0x315c7b,null));};exports[_0x0420('0x34')]=function(_0x586022,_0x34eb54){if(_0x586022[_0x0420('0x57')]['id']){delete _0x586022[_0x0420('0x57')]['id'];}return db['SalesforceAccount'][_0x0420('0x55')]({'where':{'id':_0x586022['params']['id']}})[_0x0420('0x35')](handleEntityNotFound(_0x34eb54,null))[_0x0420('0x35')](saveUpdates(_0x586022[_0x0420('0x57')],null))[_0x0420('0x35')](respondWithResult(_0x34eb54,null))[_0x0420('0x28')](handleError(_0x34eb54,null));};exports[_0x0420('0x36')]=function(_0x2f377d,_0x56ff68){return db[_0x0420('0x3d')]['find']({'where':{'id':_0x2f377d[_0x0420('0x58')]['id']}})[_0x0420('0x35')](handleEntityNotFound(_0x56ff68,null))[_0x0420('0x35')](removeEntity(_0x56ff68,null))[_0x0420('0x28')](handleError(_0x56ff68,null));};exports['getConfigurations']=function(_0x43c64d,_0x4c45fc,_0xdcf68c){var _0x504605={};var _0x6a6cbc={};var _0x4058cc;var _0x242a72;return db[_0x0420('0x3d')][_0x0420('0x59')]({'where':{'id':_0x43c64d[_0x0420('0x58')]['id']}})[_0x0420('0x35')](handleEntityNotFound(_0x4c45fc,null))[_0x0420('0x35')](function(_0x297ad5){if(_0x297ad5){_0x4058cc=_0x297ad5;_0x6a6cbc[_0x0420('0x41')]=_[_0x0420('0x43')](db['SalesforceConfiguration'][_0x0420('0x3e')]);_0x6a6cbc[_0x0420('0x42')]=_[_0x0420('0x43')](_0x43c64d[_0x0420('0x42')]);_0x6a6cbc[_0x0420('0x5a')]=_['intersection'](_0x6a6cbc[_0x0420('0x41')],_0x6a6cbc['query']);_0x504605['attributes']=_['intersection'](_0x6a6cbc[_0x0420('0x41')],qs[_0x0420('0x46')](_0x43c64d[_0x0420('0x42')][_0x0420('0x46')]));_0x504605[_0x0420('0x44')]=_0x504605[_0x0420('0x44')]['length']?_0x504605[_0x0420('0x44')]:_0x6a6cbc[_0x0420('0x41')];_0x504605['order']=qs['sort'](_0x43c64d['query']['sort']);_0x504605['where']=qs[_0x0420('0x5a')](_['pick'](_0x43c64d[_0x0420('0x42')],_0x6a6cbc[_0x0420('0x5a')]));if(_0x43c64d[_0x0420('0x42')][_0x0420('0x4c')]){_0x504605[_0x0420('0x4b')]=_[_0x0420('0x4f')](_0x504605['where'],{'$or':_[_0x0420('0x3c')](_0x504605['attributes'],function(_0x164db9){var _0x5848ed={};_0x5848ed[_0x164db9]={'$like':'%'+_0x43c64d[_0x0420('0x42')][_0x0420('0x4c')]+'%'};return _0x5848ed;})});}_0x504605=_['merge']({},_0x504605,_0x43c64d['options']);return _0x4058cc[_0x0420('0x5b')](_0x504605);}})[_0x0420('0x35')](function(_0x3729ff){if(_0x3729ff){_0x242a72=_0x3729ff['length'];if(!_0x43c64d['query'][_0x0420('0x48')](_0x0420('0x5c'))){_0x504605[_0x0420('0x2e')]=qs[_0x0420('0x2e')](_0x43c64d[_0x0420('0x42')][_0x0420('0x2e')]);_0x504605[_0x0420('0x2d')]=qs[_0x0420('0x2d')](_0x43c64d['query'][_0x0420('0x2d')]);}return _0x4058cc['getConfigurations'](_0x504605);}})['then'](function(_0x4175b8){if(_0x4175b8){return _0x4175b8?{'count':_0x242a72,'rows':_0x4175b8}:null;}})[_0x0420('0x35')](respondWithResult(_0x4c45fc,null))[_0x0420('0x28')](handleError(_0x4c45fc,null));};exports[_0x0420('0x5d')]=function(_0x5e55a5,_0x33eabb,_0x305362){if(_0x5e55a5[_0x0420('0x57')]['id']){delete _0x5e55a5['body']['id'];}return db[_0x0420('0x3d')][_0x0420('0x59')]({'where':{'id':_0x5e55a5['params']['id']}})['then'](handleEntityNotFound(_0x33eabb,null))[_0x0420('0x35')](function(_0x2241f7){if(_0x2241f7){_0x5e55a5[_0x0420('0x57')]['AccountId']=_0x2241f7['id'];_0x5e55a5['body'][_0x0420('0x5e')]=integrations[_0x0420('0x5f')](_0x5e55a5['body']['channel'],_0x5e55a5[_0x0420('0x57')][_0x0420('0x4d')]);_0x5e55a5[_0x0420('0x57')][_0x0420('0x60')]=integrations[_0x0420('0x61')](_0x5e55a5[_0x0420('0x57')][_0x0420('0x62')],_0x5e55a5[_0x0420('0x57')]['type']);return db[_0x0420('0x63')][_0x0420('0x56')](_0x5e55a5['body'],{'include':[{'model':db[_0x0420('0x64')],'as':'Subjects'},{'model':db[_0x0420('0x64')],'as':_0x0420('0x60')}]});}return null;})[_0x0420('0x35')](respondWithResult(_0x33eabb,null))[_0x0420('0x28')](handleError(_0x33eabb,null));};exports['getFields']=function(_0x1ea9ce,_0x4b9743,_0x51378b){var _0x397400;var _0xa1a145='';var _0x282c93=_0x0420('0x65');return db[_0x0420('0x3d')]['findOne']({'where':{'id':_0x1ea9ce[_0x0420('0x58')]['id']},'attributes':['id',_0x0420('0x66'),_0x0420('0x67'),_0x0420('0x68'),_0x0420('0x69'),_0x0420('0x6a'),_0x0420('0x6b')]})[_0x0420('0x35')](handleEntityNotFound(_0x4b9743,null))[_0x0420('0x35')](function(_0x4cc5d3){if(_0x4cc5d3){_0xa1a145=_0x4cc5d3[_0x0420('0x66')];var _0x2d359f=_0xa1a145[_0x0420('0x6c')](-0x1);if(_0x2d359f==='/'){_0xa1a145=_0xa1a145[_0x0420('0x6d')](0x0,_0xa1a145[_0x0420('0x6e')](_0x2d359f));}_0x397400=new jsforce[(_0x0420('0x6f'))]({'oauth2':{'loginUrl':_0xa1a145,'clientId':_0x4cc5d3[_0x0420('0x67')],'clientSecret':_0x4cc5d3[_0x0420('0x68')]}});return _0x397400[_0x0420('0x70')](_0x4cc5d3[_0x0420('0x69')],_0x4cc5d3['password'][_0x0420('0x71')](_0x4cc5d3[_0x0420('0x6b')]));}})[_0x0420('0x35')](function(_0x407671){if(_0x407671){if(!_[_0x0420('0x72')](_0x1ea9ce[_0x0420('0x42')]['ticketType'])){_0x282c93=_0x1ea9ce['query']['ticketType'];}return _0x397400[_0x0420('0x73')](_0x282c93)[_0x0420('0x74')]();}})['then'](function(_0x180633){var _0x2783d7=['OwnerId',_0x0420('0x75'),_0x0420('0x76'),_0x0420('0x77'),'Subject','Description'];var _0xf969ec=[_0x0420('0x78'),'int',_0x0420('0x79'),_0x0420('0x7a'),'email',_0x0420('0x7b'),_0x0420('0x7c')];if(_0x180633){_['remove'](_0x180633[_0x0420('0x46')],function(_0x513c8c){return _0x2783d7[_0x0420('0x7d')](_0x513c8c[_0x0420('0x39')])||!_0xf969ec[_0x0420('0x7d')](_0x513c8c[_0x0420('0x4d')]);});return{'count':_0x180633['fields'][_0x0420('0x47')],'rows':_[_0x0420('0x3c')](_0x180633['fields'],function(_0x1d8b9b){return{'id':_0x1d8b9b[_0x0420('0x39')],'name':_0x1d8b9b['label'],'custom':_0x1d8b9b[_0x0420('0x7e')],'options':_0x1d8b9b[_0x0420('0x7f')][_0x0420('0x47')]>0x0?_[_0x0420('0x3c')](_0x1d8b9b[_0x0420('0x7f')],function(_0x581320){return{'name':_0x581320[_0x0420('0x80')],'value':_0x581320[_0x0420('0x81')]};}):_0x1d8b9b[_0x0420('0x4d')]==_0x0420('0x7a')?[{'name':_0x0420('0x82'),'value':'true'},{'name':_0x0420('0x83'),'value':_0x0420('0x84')}]:[]};})};}})[_0x0420('0x35')](respondWithResult(_0x4b9743,null))[_0x0420('0x28')](function(_0x5545d5){var _0x27b19d=_0x1ea9ce[_0x0420('0x42')][_0x0420('0x85')]?0x1f4:_0x5545d5[_0x0420('0x86')]||0x1f4;logger[_0x0420('0x25')](_0x0420('0x87'),_0x0420('0x88'),_0x27b19d,JSON[_0x0420('0x24')](_0x5545d5));delete _0x5545d5['name'];if(_0x27b19d===0x191){_0x27b19d=0x190;}_0x4b9743[_0x0420('0x2a')](_0x27b19d)[_0x0420('0x3a')](_0x1ea9ce['query']['test']?{'message':_0x0420('0x89'),'statusCode':_0x5545d5[_0x0420('0x86')]}:_0x5545d5);});}; \ No newline at end of file +var _0xfac9=['length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','count','includeAll','include','rows','find','create','body','params','destroy','getConfigurations','findOne','SalesforceConfiguration','filter','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','password','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','int','boolean','email','phone','includes','label','custom','picklistValues','value','True','true','False','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','SalesforceAccount','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields'];(function(_0x1b4f25,_0x387b6c){var _0x3491f2=function(_0xbc1629){while(--_0xbc1629){_0x1b4f25['push'](_0x1b4f25['shift']());}};_0x3491f2(++_0x387b6c);}(_0xfac9,0x1d0));var _0x9fac=function(_0x20eb70,_0x2415fc){_0x20eb70=_0x20eb70-0x0;var _0x98ba1b=_0xfac9[_0x20eb70];return _0x98ba1b;};'use strict';var pdf=require(_0x9fac('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9fac('0x1'));var zipdir=require(_0x9fac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9fac('0x3'));var moment=require(_0x9fac('0x4'));var BPromise=require(_0x9fac('0x5'));var Mustache=require(_0x9fac('0x6'));var util=require(_0x9fac('0x7'));var path=require(_0x9fac('0x8'));var sox=require(_0x9fac('0x9'));var csv=require(_0x9fac('0xa'));var ejs=require(_0x9fac('0xb'));var fs=require('fs');var _=require(_0x9fac('0xc'));var squel=require(_0x9fac('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9fac('0xa'));var querystring=require(_0x9fac('0xe'));var Papa=require(_0x9fac('0xf'));var Redis=require(_0x9fac('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9fac('0x11'));var as=require(_0x9fac('0x12'));var hardwareService=require(_0x9fac('0x13'));var logger=require(_0x9fac('0x14'))(_0x9fac('0x15'));var utils=require('../../config/utils');var config=require(_0x9fac('0x16'));var licenseUtil=require(_0x9fac('0x17'));var db=require(_0x9fac('0x18'))['db'];var integrations=require(_0x9fac('0x19'));var jayson=require(_0x9fac('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x63aee6,_0x1126f9,_0x3c533f,_0x4f194e){return new BPromise(function(_0x56eb73,_0x36b58b){var _0x528242=_0x4f194e||client;return _0x528242['request'](_0x63aee6,_0x3c533f)[_0x9fac('0x1b')](function(_0x44d24e){logger[_0x9fac('0x1c')](_0x9fac('0x1d'),_0x1126f9,'request\x20sent');logger[_0x9fac('0x1e')](_0x9fac('0x1f'),_0x1126f9,'request\x20sent',JSON[_0x9fac('0x20')](_0x44d24e));if(_0x44d24e[_0x9fac('0x21')]){if(_0x44d24e[_0x9fac('0x21')][_0x9fac('0x22')]===0x1f4){logger[_0x9fac('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0x1126f9,_0x44d24e[_0x9fac('0x21')][_0x9fac('0x23')]);return _0x36b58b(_0x44d24e[_0x9fac('0x21')][_0x9fac('0x23')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x1126f9,_0x44d24e[_0x9fac('0x21')][_0x9fac('0x23')]);return _0x56eb73(_0x44d24e[_0x9fac('0x21')][_0x9fac('0x23')]);}else{logger[_0x9fac('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0x1126f9,_0x9fac('0x24'));_0x56eb73(_0x44d24e[_0x9fac('0x25')][_0x9fac('0x23')]);}})[_0x9fac('0x26')](function(_0x57d235){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x1126f9,_0x57d235);_0x36b58b(_0x57d235);});});}function respondWithStatusCode(_0x59d61f,_0x3cec7c){_0x3cec7c=_0x3cec7c||0xcc;return function(_0x20245c){if(_0x20245c){return _0x59d61f[_0x9fac('0x27')](_0x3cec7c);}return _0x59d61f[_0x9fac('0x28')](_0x3cec7c)[_0x9fac('0x29')]();};}function respondWithResult(_0xfbf32e,_0x86f345){_0x86f345=_0x86f345||0xc8;return function(_0xe5443d){if(_0xe5443d){return _0xfbf32e[_0x9fac('0x28')](_0x86f345)[_0x9fac('0x2a')](_0xe5443d);}};}function respondWithFilteredResult(_0x2d98a2,_0x4a0630){return function(_0xcfed02){if(_0xcfed02){var _0x470fe9=_0xcfed02['count'],_0x3f04ab=_0x4a0630[_0x9fac('0x2b')],_0x2c1385=_0x4a0630[_0x9fac('0x2b')]+_0x4a0630[_0x9fac('0x2c')],_0x42cec4;if(_0x2c1385>=_0x470fe9){_0x2c1385=_0x470fe9;_0x42cec4=0xc8;}else{_0x42cec4=0xce;}_0x2d98a2[_0x9fac('0x28')](_0x42cec4);return _0x2d98a2['set'](_0x9fac('0x2d'),_0x3f04ab+'-'+_0x2c1385+'/'+_0x470fe9)[_0x9fac('0x2a')](_0xcfed02);}return null;};}function patchUpdates(_0x3259d3){return function(_0x41156b){try{jsonpatch[_0x9fac('0x2e')](_0x41156b,_0x3259d3,!![]);}catch(_0x371f21){return BPromise[_0x9fac('0x2f')](_0x371f21);}return _0x41156b[_0x9fac('0x30')]();};}function saveUpdates(_0x7f25c7,_0x166625){return function(_0xf423dd){if(_0xf423dd){return _0xf423dd[_0x9fac('0x31')](_0x7f25c7)[_0x9fac('0x1b')](function(_0x51bb6d){return _0x51bb6d;});}return null;};}function removeEntity(_0x3eb912,_0xbd7272){return function(_0x4a7a54){if(_0x4a7a54){return _0x4a7a54['destroy']()[_0x9fac('0x1b')](function(){_0x3eb912['status'](0xcc)[_0x9fac('0x29')]();});}};}function handleEntityNotFound(_0x594f7a,_0x509487){return function(_0x902d49){if(!_0x902d49){_0x594f7a[_0x9fac('0x27')](0x194);}return _0x902d49;};}function handleError(_0x19d56e,_0xc3b2ca){_0xc3b2ca=_0xc3b2ca||0x1f4;return function(_0x34aa00){logger[_0x9fac('0x21')](_0x34aa00[_0x9fac('0x32')]);if(_0x34aa00[_0x9fac('0x33')]){delete _0x34aa00['name'];}_0x19d56e[_0x9fac('0x28')](_0xc3b2ca)[_0x9fac('0x34')](_0x34aa00);};}exports['index']=function(_0x9b393f,_0x819428){var _0x35ff9b={},_0x3a255e={},_0x3ef8dd={'count':0x0,'rows':[]};var _0xf22c37=_['map'](db[_0x9fac('0x35')]['rawAttributes'],function(_0x54b626){return{'name':_0x54b626[_0x9fac('0x36')],'type':_0x54b626[_0x9fac('0x37')]['key']};});_0x3a255e[_0x9fac('0x38')]=_[_0x9fac('0x39')](_0xf22c37,_0x9fac('0x33'));_0x3a255e['query']=_[_0x9fac('0x3a')](_0x9b393f['query']);_0x3a255e[_0x9fac('0x3b')]=_[_0x9fac('0x3c')](_0x3a255e[_0x9fac('0x38')],_0x3a255e[_0x9fac('0x3d')]);_0x35ff9b[_0x9fac('0x3e')]=_['intersection'](_0x3a255e['model'],qs[_0x9fac('0x3f')](_0x9b393f[_0x9fac('0x3d')]['fields']));_0x35ff9b[_0x9fac('0x3e')]=_0x35ff9b[_0x9fac('0x3e')][_0x9fac('0x40')]?_0x35ff9b['attributes']:_0x3a255e[_0x9fac('0x38')];if(!_0x9b393f[_0x9fac('0x3d')][_0x9fac('0x41')](_0x9fac('0x42'))){_0x35ff9b[_0x9fac('0x2c')]=qs[_0x9fac('0x2c')](_0x9b393f[_0x9fac('0x3d')][_0x9fac('0x2c')]);_0x35ff9b[_0x9fac('0x2b')]=qs[_0x9fac('0x2b')](_0x9b393f[_0x9fac('0x3d')][_0x9fac('0x2b')]);}_0x35ff9b[_0x9fac('0x43')]=qs[_0x9fac('0x44')](_0x9b393f[_0x9fac('0x3d')][_0x9fac('0x44')]);_0x35ff9b[_0x9fac('0x45')]=qs['filters'](_[_0x9fac('0x46')](_0x9b393f['query'],_0x3a255e[_0x9fac('0x3b')]),_0xf22c37);if(_0x9b393f['query']['filter']){_0x35ff9b[_0x9fac('0x45')]=_['merge'](_0x35ff9b['where'],{'$or':_[_0x9fac('0x39')](_0xf22c37,function(_0x1596a6){if(_0x1596a6['type']!==_0x9fac('0x47')){var _0x3f5763={};_0x3f5763[_0x1596a6[_0x9fac('0x33')]]={'$like':'%'+_0x9b393f[_0x9fac('0x3d')]['filter']+'%'};return _0x3f5763;}})});}_0x35ff9b=_[_0x9fac('0x48')]({},_0x35ff9b,_0x9b393f[_0x9fac('0x49')]);var _0x5acbc5={'where':_0x35ff9b['where']};return db[_0x9fac('0x35')][_0x9fac('0x4a')](_0x5acbc5)['then'](function(_0x1da75f){_0x3ef8dd['count']=_0x1da75f;if(_0x9b393f['query'][_0x9fac('0x4b')]){_0x35ff9b[_0x9fac('0x4c')]=[{'all':!![]}];}return db[_0x9fac('0x35')]['findAll'](_0x35ff9b);})[_0x9fac('0x1b')](function(_0x1de1c2){_0x3ef8dd[_0x9fac('0x4d')]=_0x1de1c2;return _0x3ef8dd;})[_0x9fac('0x1b')](respondWithFilteredResult(_0x819428,_0x35ff9b))[_0x9fac('0x26')](handleError(_0x819428,null));};exports['show']=function(_0x39a60e,_0x3e33de){var _0x15bd0={'raw':![],'where':{'id':_0x39a60e['params']['id']}},_0x45048f={};_0x45048f[_0x9fac('0x38')]=_[_0x9fac('0x3a')](db[_0x9fac('0x35')]['rawAttributes']);_0x45048f[_0x9fac('0x3d')]=_[_0x9fac('0x3a')](_0x39a60e[_0x9fac('0x3d')]);_0x45048f['filters']=_[_0x9fac('0x3c')](_0x45048f[_0x9fac('0x38')],_0x45048f[_0x9fac('0x3d')]);_0x15bd0['attributes']=_['intersection'](_0x45048f[_0x9fac('0x38')],qs[_0x9fac('0x3f')](_0x39a60e[_0x9fac('0x3d')][_0x9fac('0x3f')]));_0x15bd0['attributes']=_0x15bd0[_0x9fac('0x3e')][_0x9fac('0x40')]?_0x15bd0[_0x9fac('0x3e')]:_0x45048f['model'];if(_0x39a60e[_0x9fac('0x3d')][_0x9fac('0x4b')]){_0x15bd0[_0x9fac('0x4c')]=[{'all':!![]}];}_0x15bd0=_[_0x9fac('0x48')]({},_0x15bd0,_0x39a60e[_0x9fac('0x49')]);return db['SalesforceAccount'][_0x9fac('0x4e')](_0x15bd0)[_0x9fac('0x1b')](handleEntityNotFound(_0x3e33de,null))[_0x9fac('0x1b')](respondWithResult(_0x3e33de,null))[_0x9fac('0x26')](handleError(_0x3e33de,null));};exports[_0x9fac('0x4f')]=function(_0x468771,_0x1e1987){return db['SalesforceAccount'][_0x9fac('0x4f')](_0x468771[_0x9fac('0x50')],{})[_0x9fac('0x1b')](respondWithResult(_0x1e1987,0xc9))[_0x9fac('0x26')](handleError(_0x1e1987,null));};exports[_0x9fac('0x31')]=function(_0x3eb642,_0x55f58c){if(_0x3eb642[_0x9fac('0x50')]['id']){delete _0x3eb642[_0x9fac('0x50')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x3eb642[_0x9fac('0x51')]['id']}})[_0x9fac('0x1b')](handleEntityNotFound(_0x55f58c,null))[_0x9fac('0x1b')](saveUpdates(_0x3eb642[_0x9fac('0x50')],null))['then'](respondWithResult(_0x55f58c,null))['catch'](handleError(_0x55f58c,null));};exports[_0x9fac('0x52')]=function(_0x10ba0f,_0x3dbb25){return db[_0x9fac('0x35')][_0x9fac('0x4e')]({'where':{'id':_0x10ba0f[_0x9fac('0x51')]['id']}})[_0x9fac('0x1b')](handleEntityNotFound(_0x3dbb25,null))[_0x9fac('0x1b')](removeEntity(_0x3dbb25,null))['catch'](handleError(_0x3dbb25,null));};exports[_0x9fac('0x53')]=function(_0x3a6710,_0x35389f,_0x33ee5e){var _0xc26fdd={};var _0x6af521={};var _0x101dfc;var _0xd2197a;return db[_0x9fac('0x35')][_0x9fac('0x54')]({'where':{'id':_0x3a6710['params']['id']}})[_0x9fac('0x1b')](handleEntityNotFound(_0x35389f,null))[_0x9fac('0x1b')](function(_0xcb499f){if(_0xcb499f){_0x101dfc=_0xcb499f;_0x6af521[_0x9fac('0x38')]=_[_0x9fac('0x3a')](db[_0x9fac('0x55')]['rawAttributes']);_0x6af521[_0x9fac('0x3d')]=_['keys'](_0x3a6710[_0x9fac('0x3d')]);_0x6af521[_0x9fac('0x3b')]=_[_0x9fac('0x3c')](_0x6af521['model'],_0x6af521['query']);_0xc26fdd[_0x9fac('0x3e')]=_[_0x9fac('0x3c')](_0x6af521[_0x9fac('0x38')],qs[_0x9fac('0x3f')](_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x3f')]));_0xc26fdd['attributes']=_0xc26fdd[_0x9fac('0x3e')][_0x9fac('0x40')]?_0xc26fdd[_0x9fac('0x3e')]:_0x6af521[_0x9fac('0x38')];_0xc26fdd[_0x9fac('0x43')]=qs[_0x9fac('0x44')](_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x44')]);_0xc26fdd[_0x9fac('0x45')]=qs[_0x9fac('0x3b')](_[_0x9fac('0x46')](_0x3a6710[_0x9fac('0x3d')],_0x6af521['filters']));if(_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x56')]){_0xc26fdd[_0x9fac('0x45')]=_[_0x9fac('0x48')](_0xc26fdd[_0x9fac('0x45')],{'$or':_[_0x9fac('0x39')](_0xc26fdd['attributes'],function(_0x27b745){var _0x474043={};_0x474043[_0x27b745]={'$like':'%'+_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x56')]+'%'};return _0x474043;})});}_0xc26fdd=_[_0x9fac('0x48')]({},_0xc26fdd,_0x3a6710[_0x9fac('0x49')]);return _0x101dfc['getConfigurations'](_0xc26fdd);}})[_0x9fac('0x1b')](function(_0x2eb45b){if(_0x2eb45b){_0xd2197a=_0x2eb45b[_0x9fac('0x40')];if(!_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x41')](_0x9fac('0x42'))){_0xc26fdd[_0x9fac('0x2c')]=qs[_0x9fac('0x2c')](_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x2c')]);_0xc26fdd[_0x9fac('0x2b')]=qs['offset'](_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x2b')]);}return _0x101dfc[_0x9fac('0x53')](_0xc26fdd);}})[_0x9fac('0x1b')](function(_0x5cb523){if(_0x5cb523){return _0x5cb523?{'count':_0xd2197a,'rows':_0x5cb523}:null;}})['then'](respondWithResult(_0x35389f,null))['catch'](handleError(_0x35389f,null));};exports[_0x9fac('0x57')]=function(_0x37e380,_0x126af8,_0x5a9773){if(_0x37e380[_0x9fac('0x50')]['id']){delete _0x37e380['body']['id'];}return db['SalesforceAccount'][_0x9fac('0x54')]({'where':{'id':_0x37e380[_0x9fac('0x51')]['id']}})[_0x9fac('0x1b')](handleEntityNotFound(_0x126af8,null))[_0x9fac('0x1b')](function(_0x36e0c3){if(_0x36e0c3){_0x37e380[_0x9fac('0x50')][_0x9fac('0x58')]=_0x36e0c3['id'];_0x37e380[_0x9fac('0x50')]['Subjects']=integrations[_0x9fac('0x59')](_0x37e380[_0x9fac('0x50')][_0x9fac('0x5a')],_0x37e380[_0x9fac('0x50')]['type']);_0x37e380['body'][_0x9fac('0x5b')]=integrations[_0x9fac('0x5c')](_0x37e380[_0x9fac('0x50')]['channel'],_0x37e380[_0x9fac('0x50')][_0x9fac('0x37')]);return db['SalesforceConfiguration'][_0x9fac('0x4f')](_0x37e380[_0x9fac('0x50')],{'include':[{'model':db[_0x9fac('0x5d')],'as':'Subjects'},{'model':db[_0x9fac('0x5d')],'as':_0x9fac('0x5b')}]});}return null;})[_0x9fac('0x1b')](respondWithResult(_0x126af8,null))['catch'](handleError(_0x126af8,null));};exports[_0x9fac('0x5e')]=function(_0x1935bb,_0x40bf1c,_0x33ad0d){var _0x134847;var _0x1486ca='';var _0x569b46=_0x9fac('0x5f');return db['SalesforceAccount'][_0x9fac('0x54')]({'where':{'id':_0x1935bb[_0x9fac('0x51')]['id']},'attributes':['id',_0x9fac('0x60'),_0x9fac('0x61'),_0x9fac('0x62'),_0x9fac('0x63'),'password',_0x9fac('0x64')]})[_0x9fac('0x1b')](handleEntityNotFound(_0x40bf1c,null))[_0x9fac('0x1b')](function(_0x2de3f5){if(_0x2de3f5){_0x1486ca=_0x2de3f5[_0x9fac('0x60')];var _0x43bd55=_0x1486ca[_0x9fac('0x65')](-0x1);if(_0x43bd55==='/'){_0x1486ca=_0x1486ca[_0x9fac('0x66')](0x0,_0x1486ca[_0x9fac('0x67')](_0x43bd55));}_0x134847=new jsforce[(_0x9fac('0x68'))]({'oauth2':{'loginUrl':_0x1486ca,'clientId':_0x2de3f5[_0x9fac('0x61')],'clientSecret':_0x2de3f5[_0x9fac('0x62')]}});return _0x134847['login'](_0x2de3f5['username'],_0x2de3f5[_0x9fac('0x69')][_0x9fac('0x6a')](_0x2de3f5[_0x9fac('0x64')]));}})[_0x9fac('0x1b')](function(_0x179391){if(_0x179391){if(!_[_0x9fac('0x6b')](_0x1935bb[_0x9fac('0x3d')][_0x9fac('0x6c')])){_0x569b46=_0x1935bb[_0x9fac('0x3d')][_0x9fac('0x6c')];}return _0x134847[_0x9fac('0x6d')](_0x569b46)[_0x9fac('0x6e')]();}})[_0x9fac('0x1b')](function(_0x59e9c1){var _0x50355f=[_0x9fac('0x6f'),_0x9fac('0x70'),_0x9fac('0x71'),_0x9fac('0x72'),_0x9fac('0x73'),'Description'];var _0x3d0e87=['string',_0x9fac('0x74'),'picklist',_0x9fac('0x75'),_0x9fac('0x76'),'textarea',_0x9fac('0x77')];if(_0x59e9c1){_['remove'](_0x59e9c1[_0x9fac('0x3f')],function(_0x391a8e){return _0x50355f[_0x9fac('0x78')](_0x391a8e[_0x9fac('0x33')])||!_0x3d0e87[_0x9fac('0x78')](_0x391a8e[_0x9fac('0x37')]);});return{'count':_0x59e9c1['fields'][_0x9fac('0x40')],'rows':_[_0x9fac('0x39')](_0x59e9c1[_0x9fac('0x3f')],function(_0x2ac515){return{'id':_0x2ac515[_0x9fac('0x33')],'name':_0x2ac515[_0x9fac('0x79')],'custom':_0x2ac515[_0x9fac('0x7a')],'options':_0x2ac515[_0x9fac('0x7b')][_0x9fac('0x40')]>0x0?_['map'](_0x2ac515[_0x9fac('0x7b')],function(_0x52fa79){return{'name':_0x52fa79[_0x9fac('0x79')],'value':_0x52fa79[_0x9fac('0x7c')]};}):_0x2ac515[_0x9fac('0x37')]==_0x9fac('0x75')?[{'name':_0x9fac('0x7d'),'value':_0x9fac('0x7e')},{'name':_0x9fac('0x7f'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x40bf1c,null))[_0x9fac('0x26')](function(_0x44a252){var _0x28b95d=_0x1935bb[_0x9fac('0x3d')][_0x9fac('0x80')]?0x1f4:_0x44a252['statusCode']||0x1f4;logger[_0x9fac('0x21')](_0x9fac('0x81'),_0x9fac('0x5e'),_0x28b95d,JSON['stringify'](_0x44a252));delete _0x44a252[_0x9fac('0x33')];if(_0x28b95d===0x191){_0x28b95d=0x190;}_0x40bf1c['status'](_0x28b95d)[_0x9fac('0x34')](_0x1935bb[_0x9fac('0x3d')][_0x9fac('0x80')]?{'message':_0x9fac('0x82'),'statusCode':_0x44a252[_0x9fac('0x83')]}:_0x44a252);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 8b54c3a..a86923c 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 _0xce6b=['rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','request-promise','path'];(function(_0x44a29b,_0x44bf40){var _0x1fcdec=function(_0x1a6bd1){while(--_0x1a6bd1){_0x44a29b['push'](_0x44a29b['shift']());}};_0x1fcdec(++_0x44bf40);}(_0xce6b,0x17b));var _0xbce6=function(_0x320a81,_0x2460dd){_0x320a81=_0x320a81-0x0;var _0x1bc4c9=_0xce6b[_0x320a81];return _0x1bc4c9;};'use strict';var _=require(_0xbce6('0x0'));var util=require(_0xbce6('0x1'));var logger=require('../../config/logger')(_0xbce6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbce6('0x3'));var fs=require('fs');var path=require(_0xbce6('0x4'));var rimraf=require(_0xbce6('0x5'));var config=require('../../config/environment');var attributes=require(_0xbce6('0x6'));var integrations=require(_0xbce6('0x7'));module[_0xbce6('0x8')]=function(_0x544bd1,_0x13caa5){return _0x544bd1[_0xbce6('0x9')](_0xbce6('0xa'),attributes,{'tableName':_0xbce6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x422b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x3f6cc3,_0x21c641){var _0x25a876=function(_0x15ddfe){while(--_0x15ddfe){_0x3f6cc3['push'](_0x3f6cc3['shift']());}};_0x25a876(++_0x21c641);}(_0x422b,0x1b9));var _0xb422=function(_0x186d80,_0x283224){_0x186d80=_0x186d80-0x0;var _0xcc2d55=_0x422b[_0x186d80];return _0xcc2d55;};'use strict';var _=require(_0xb422('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb422('0x1'));var moment=require(_0xb422('0x2'));var BPromise=require(_0xb422('0x3'));var rp=require(_0xb422('0x4'));var fs=require('fs');var path=require(_0xb422('0x5'));var rimraf=require(_0xb422('0x6'));var config=require(_0xb422('0x7'));var attributes=require(_0xb422('0x8'));var integrations=require(_0xb422('0x9'));module['exports']=function(_0x5a76b1,_0x22912a){return _0x5a76b1[_0xb422('0xa')](_0xb422('0xb'),attributes,{'tableName':_0xb422('0xc'),'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 d80a38a..e182450 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 _0x9aea=['attributes','limit','include','map','model','GetSalesforceAccount','stringify','catch','ShowSalesforceAccount','find','raw','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','SalesforceAccount','findAll','options','where'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x9aea,0xdd));var _0xa9ae=function(_0x4fff7b,_0x562f75){_0x4fff7b=_0x4fff7b-0x0;var _0x496571=_0x9aea[_0x4fff7b];return _0x496571;};'use strict';var _=require(_0xa9ae('0x0'));var util=require('util');var moment=require(_0xa9ae('0x1'));var BPromise=require('bluebird');var rs=require(_0xa9ae('0x2'));var fs=require('fs');var Redis=require(_0xa9ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9ae('0x4'));var logger=require(_0xa9ae('0x5'))(_0xa9ae('0x6'));var config=require(_0xa9ae('0x7'));var jayson=require(_0xa9ae('0x8'));var client=jayson['client'][_0xa9ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22734b,_0x1e57c4,_0x53e52c){return new BPromise(function(_0x1f2e4b,_0x3917f0){return client[_0xa9ae('0xa')](_0x22734b,_0x53e52c)[_0xa9ae('0xb')](function(_0x1882dc){logger[_0xa9ae('0xc')](_0xa9ae('0xd'),_0x1e57c4,_0xa9ae('0xe'));logger[_0xa9ae('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1e57c4,_0xa9ae('0xe'),JSON['stringify'](_0x1882dc));if(_0x1882dc[_0xa9ae('0x10')]){if(_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x11')]===0x1f4){logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x12')]);return _0x3917f0(_0x1882dc[_0xa9ae('0x10')]['message']);}logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x12')]);return _0x1f2e4b(_0x1882dc['error'][_0xa9ae('0x12')]);}else{logger[_0xa9ae('0xc')](_0xa9ae('0xd'),_0x1e57c4,_0xa9ae('0xe'));_0x1f2e4b(_0x1882dc[_0xa9ae('0x13')][_0xa9ae('0x12')]);}})['catch'](function(_0x3e4810){logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x3e4810);_0x3917f0(_0x3e4810);});});}exports['GetSalesforceAccount']=function(_0x4dbb30){var _0xb078d2=this;return new Promise(function(_0x581345,_0x59e7dd){return db[_0xa9ae('0x14')][_0xa9ae('0x15')]({'raw':_0x4dbb30[_0xa9ae('0x16')]?_0x4dbb30[_0xa9ae('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4dbb30[_0xa9ae('0x16')]?_0x4dbb30[_0xa9ae('0x16')][_0xa9ae('0x17')]||null:null,'attributes':_0x4dbb30[_0xa9ae('0x16')]?_0x4dbb30[_0xa9ae('0x16')][_0xa9ae('0x18')]||null:null,'limit':_0x4dbb30[_0xa9ae('0x16')]?_0x4dbb30['options'][_0xa9ae('0x19')]||null:null,'include':_0x4dbb30['options']?_0x4dbb30['options']['include']?_['map'](_0x4dbb30[_0xa9ae('0x16')]['include'],function(_0x13fb05){return{'model':db[_0x13fb05['model']],'as':_0x13fb05['as'],'attributes':_0x13fb05[_0xa9ae('0x18')],'include':_0x13fb05[_0xa9ae('0x1a')]?_[_0xa9ae('0x1b')](_0x13fb05[_0xa9ae('0x1a')],function(_0x12b061){return{'model':db[_0x12b061[_0xa9ae('0x1c')]],'as':_0x12b061['as'],'attributes':_0x12b061[_0xa9ae('0x18')],'include':_0x12b061['include']?_[_0xa9ae('0x1b')](_0x12b061[_0xa9ae('0x1a')],function(_0x2aac9e){return{'model':db[_0x2aac9e[_0xa9ae('0x1c')]],'as':_0x2aac9e['as'],'attributes':_0x2aac9e[_0xa9ae('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa9ae('0xb')](function(_0xb12fa8){logger['info']('GetSalesforceAccount',_0x4dbb30);logger[_0xa9ae('0xf')](_0xa9ae('0x1d'),_0x4dbb30,JSON[_0xa9ae('0x1e')](_0xb12fa8));_0x581345(_0xb12fa8);})[_0xa9ae('0x1f')](function(_0x74cd94){logger['error']('GetSalesforceAccount',_0x74cd94[_0xa9ae('0x12')],_0x4dbb30);_0x59e7dd(_0xb078d2[_0xa9ae('0x10')](0x1f4,_0x74cd94[_0xa9ae('0x12')]));});});};exports[_0xa9ae('0x20')]=function(_0x314969){var _0x36bc28=this;return new Promise(function(_0x5d0c84,_0x5415f1){return db[_0xa9ae('0x14')][_0xa9ae('0x21')]({'raw':_0x314969[_0xa9ae('0x16')]?_0x314969[_0xa9ae('0x16')][_0xa9ae('0x22')]===undefined?!![]:![]:!![],'where':_0x314969[_0xa9ae('0x16')]?_0x314969[_0xa9ae('0x16')][_0xa9ae('0x17')]||null:null,'attributes':_0x314969['options']?_0x314969[_0xa9ae('0x16')]['attributes']||null:null,'include':_0x314969[_0xa9ae('0x16')]?_0x314969[_0xa9ae('0x16')][_0xa9ae('0x1a')]?_['map'](_0x314969[_0xa9ae('0x16')][_0xa9ae('0x1a')],function(_0x383511){return{'model':db[_0x383511[_0xa9ae('0x1c')]],'as':_0x383511['as'],'attributes':_0x383511[_0xa9ae('0x18')],'include':_0x383511['include']?_[_0xa9ae('0x1b')](_0x383511[_0xa9ae('0x1a')],function(_0x44053a){return{'model':db[_0x44053a['model']],'as':_0x44053a['as'],'attributes':_0x44053a['attributes'],'include':_0x44053a[_0xa9ae('0x1a')]?_[_0xa9ae('0x1b')](_0x44053a[_0xa9ae('0x1a')],function(_0x1a01a4){return{'model':db[_0x1a01a4['model']],'as':_0x1a01a4['as'],'attributes':_0x1a01a4[_0xa9ae('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa9ae('0xb')](function(_0x231192){logger[_0xa9ae('0xc')](_0xa9ae('0x20'),_0x314969);logger['debug'](_0xa9ae('0x20'),_0x314969,JSON['stringify'](_0x231192));_0x5d0c84(_0x231192);})[_0xa9ae('0x1f')](function(_0x38f360){logger[_0xa9ae('0x10')]('ShowSalesforceAccount',_0x38f360[_0xa9ae('0x12')],_0x314969);_0x5415f1(_0x36bc28[_0xa9ae('0x10')](0x1f4,_0x38f360[_0xa9ae('0x12')]));});});}; \ No newline at end of file +var _0xa902=['include','map','model','ShowSalesforceAccount','SalesforceAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSalesforceAccount','findAll','options','raw','where','attributes'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0xa902,0x8d));var _0x2a90=function(_0x394e53,_0x367000){_0x394e53=_0x394e53-0x0;var _0x40d855=_0xa902[_0x394e53];return _0x40d855;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});}exports[_0x2a90('0x17')]=function(_0x5c3e4b){var _0x162f0b=this;return new Promise(function(_0x1d9a28,_0x4190ff){return db['SalesforceAccount'][_0x2a90('0x18')]({'raw':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1b')]||null:null,'attributes':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1c')]||null:null,'limit':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')]['limit']||null:null,'include':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x5c3e4b['options'][_0x2a90('0x1d')],function(_0xd033d){return{'model':db[_0xd033d['model']],'as':_0xd033d['as'],'attributes':_0xd033d[_0x2a90('0x1c')],'include':_0xd033d[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0xd033d[_0x2a90('0x1d')],function(_0x2a212c){return{'model':db[_0x2a212c[_0x2a90('0x1f')]],'as':_0x2a212c['as'],'attributes':_0x2a212c[_0x2a90('0x1c')],'include':_0x2a212c[_0x2a90('0x1d')]?_['map'](_0x2a212c[_0x2a90('0x1d')],function(_0x17f978){return{'model':db[_0x17f978[_0x2a90('0x1f')]],'as':_0x17f978['as'],'attributes':_0x17f978[_0x2a90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2a90('0xc')](function(_0x5208d8){logger['info'](_0x2a90('0x17'),_0x5c3e4b);logger['debug']('GetSalesforceAccount',_0x5c3e4b,JSON['stringify'](_0x5208d8));_0x1d9a28(_0x5208d8);})[_0x2a90('0x16')](function(_0x3c78f5){logger['error']('GetSalesforceAccount',_0x3c78f5[_0x2a90('0x14')],_0x5c3e4b);_0x4190ff(_0x162f0b['error'](0x1f4,_0x3c78f5[_0x2a90('0x14')]));});});};exports[_0x2a90('0x20')]=function(_0x3b580f){var _0x27b6b6=this;return new Promise(function(_0xf18d11,_0x11586c){return db[_0x2a90('0x21')]['find']({'raw':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b580f['options']?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1b')]||null:null,'attributes':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')]['attributes']||null:null,'include':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1d')],function(_0x4d4149){return{'model':db[_0x4d4149[_0x2a90('0x1f')]],'as':_0x4d4149['as'],'attributes':_0x4d4149[_0x2a90('0x1c')],'include':_0x4d4149[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x4d4149['include'],function(_0x1bab1d){return{'model':db[_0x1bab1d[_0x2a90('0x1f')]],'as':_0x1bab1d['as'],'attributes':_0x1bab1d['attributes'],'include':_0x1bab1d[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x1bab1d['include'],function(_0x5073a4){return{'model':db[_0x5073a4[_0x2a90('0x1f')]],'as':_0x5073a4['as'],'attributes':_0x5073a4[_0x2a90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2a90('0xc')](function(_0x4cd36c){logger[_0x2a90('0xd')]('ShowSalesforceAccount',_0x3b580f);logger[_0x2a90('0xf')]('ShowSalesforceAccount',_0x3b580f,JSON[_0x2a90('0x12')](_0x4cd36c));_0xf18d11(_0x4cd36c);})['catch'](function(_0x5322dc){logger[_0x2a90('0x13')]('ShowSalesforceAccount',_0x5322dc[_0x2a90('0x14')],_0x3b580f);_0x11586c(_0x27b6b6[_0x2a90('0x13')](0x1f4,_0x5322dc[_0x2a90('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 4176778..b31ddc5 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 _0xf9a5=['get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','/:id','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller'];(function(_0x7b3e3d,_0x1bac82){var _0x50b085=function(_0x468867){while(--_0x468867){_0x7b3e3d['push'](_0x7b3e3d['shift']());}};_0x50b085(++_0x1bac82);}(_0xf9a5,0x8b));var _0x5f9a=function(_0x44ea1b,_0x36bbd3){_0x44ea1b=_0x44ea1b-0x0;var _0x239690=_0xf9a5[_0x44ea1b];return _0x239690;};'use strict';var multer=require(_0x5f9a('0x0'));var util=require('util');var path=require(_0x5f9a('0x1'));var timeout=require('connect-timeout');var express=require(_0x5f9a('0x2'));var router=express[_0x5f9a('0x3')]();var auth=require(_0x5f9a('0x4'));var interaction=require(_0x5f9a('0x5'));var config=require(_0x5f9a('0x6'));var controller=require(_0x5f9a('0x7'));router[_0x5f9a('0x8')]('/',auth[_0x5f9a('0x9')](),controller[_0x5f9a('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5f9a('0xb')]);router[_0x5f9a('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x5f9a('0xc')]);router[_0x5f9a('0x8')](_0x5f9a('0xd'),auth[_0x5f9a('0x9')](),controller[_0x5f9a('0xe')]);router['get'](_0x5f9a('0xf'),auth[_0x5f9a('0x9')](),controller['getDescriptions']);router[_0x5f9a('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5f9a('0x11'),auth[_0x5f9a('0x9')](),controller[_0x5f9a('0x12')]);router[_0x5f9a('0x13')]('/:id',auth[_0x5f9a('0x9')](),controller[_0x5f9a('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0a64=['../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','/:id','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a64,0x152));var _0x40a6=function(_0x494022,_0xdc326c){_0x494022=_0x494022-0x0;var _0xfb72f0=_0x0a64[_0x494022];return _0xfb72f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x40a6('0x0'));var timeout=require(_0x40a6('0x1'));var express=require('express');var router=express[_0x40a6('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x40a6('0x3'));var config=require(_0x40a6('0x4'));var controller=require(_0x40a6('0x5'));router[_0x40a6('0x6')]('/',auth[_0x40a6('0x7')](),controller['index']);router[_0x40a6('0x6')](_0x40a6('0x8'),auth[_0x40a6('0x7')](),controller['show']);router['get']('/:id/fields',auth[_0x40a6('0x7')](),controller[_0x40a6('0x9')]);router[_0x40a6('0x6')]('/:id/subjects',auth[_0x40a6('0x7')](),controller[_0x40a6('0xa')]);router['get'](_0x40a6('0xb'),auth[_0x40a6('0x7')](),controller[_0x40a6('0xc')]);router['post']('/',auth[_0x40a6('0x7')](),controller[_0x40a6('0xd')]);router[_0x40a6('0xe')](_0x40a6('0x8'),auth[_0x40a6('0x7')](),controller[_0x40a6('0xf')]);router[_0x40a6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x40a6('0x11')]);module[_0x40a6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 2ac181b..6b00fee 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 _0x58d5=['contact','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','lead'];(function(_0x368646,_0xb9ed0b){var _0x381a6d=function(_0x292332){while(--_0x292332){_0x368646['push'](_0x368646['shift']());}};_0x381a6d(++_0xb9ed0b);}(_0x58d5,0x133));var _0x558d=function(_0x40c6ff,_0x41c595){_0x40c6ff=_0x40c6ff-0x0;var _0x45fcfc=_0x58d5[_0x40c6ff];return _0x45fcfc;};'use strict';var Sequelize=require(_0x558d('0x0'));module[_0x558d('0x1')]={'name':{'type':Sequelize[_0x558d('0x2')]},'description':{'type':Sequelize[_0x558d('0x2')]},'ticketType':{'type':Sequelize[_0x558d('0x3')](_0x558d('0x4'),_0x558d('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x558d('0x3')](_0x558d('0x6'),'contact',_0x558d('0x7')),'defaultValue':_0x558d('0x6')},'moduleCreate':{'type':Sequelize[_0x558d('0x3')]('nothing',_0x558d('0x8'),_0x558d('0x7')),'defaultValue':_0x558d('0x7')}}; \ No newline at end of file +var _0x1394=['lead','nothing','sequelize','exports','STRING','ENUM','Case','Task','contact_lead','contact'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1394,0x1d8));var _0x4139=function(_0x1101dc,_0x2ef97d){_0x1101dc=_0x1101dc-0x0;var _0x2bdfe1=_0x1394[_0x1101dc];return _0x2bdfe1;};'use strict';var Sequelize=require(_0x4139('0x0'));module[_0x4139('0x1')]={'name':{'type':Sequelize[_0x4139('0x2')]},'description':{'type':Sequelize[_0x4139('0x2')]},'ticketType':{'type':Sequelize[_0x4139('0x3')]('Task',_0x4139('0x4')),'defaultValue':_0x4139('0x5')},'moduleSearch':{'type':Sequelize[_0x4139('0x3')](_0x4139('0x6'),_0x4139('0x7'),_0x4139('0x8')),'defaultValue':_0x4139('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0x4139('0x9'),_0x4139('0x7'),_0x4139('0x8')),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index f5d00fe..b54988c 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 _0x3b5d=['offset','set','Content-Range','json','apply','reject','end','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','merge','find','create','body','update','destroy','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','sendStatus','status'];(function(_0x2ad220,_0x15e885){var _0x2ba68e=function(_0x4e74e0){while(--_0x4e74e0){_0x2ad220['push'](_0x2ad220['shift']());}};_0x2ba68e(++_0x15e885);}(_0x3b5d,0x91));var _0xd3b5=function(_0x3801fd,_0x3a05f3){_0x3801fd=_0x3801fd-0x0;var _0xf3ad3b=_0x3b5d[_0x3801fd];return _0xf3ad3b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd3b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3b5('0x1'));var jsonpatch=require(_0xd3b5('0x2'));var rp=require(_0xd3b5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd3b5('0x4'));var util=require(_0xd3b5('0x5'));var path=require(_0xd3b5('0x6'));var sox=require(_0xd3b5('0x7'));var csv=require('to-csv');var ejs=require(_0xd3b5('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd3b5('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd3b5('0xa'));var toCsv=require('to-csv');var querystring=require(_0xd3b5('0xb'));var Papa=require(_0xd3b5('0xc'));var Redis=require(_0xd3b5('0xd'));var authService=require(_0xd3b5('0xe'));var qs=require(_0xd3b5('0xf'));var as=require(_0xd3b5('0x10'));var hardwareService=require(_0xd3b5('0x11'));var logger=require(_0xd3b5('0x12'))(_0xd3b5('0x13'));var utils=require(_0xd3b5('0x14'));var config=require(_0xd3b5('0x15'));var licenseUtil=require(_0xd3b5('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd3b5('0x17'));var client=jayson[_0xd3b5('0x18')][_0xd3b5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x10574a,_0x4dff0b,_0x149c48,_0x3a5194){return new BPromise(function(_0xba6bb7,_0x470168){var _0x16621a=_0x3a5194||client;return _0x16621a[_0xd3b5('0x1a')](_0x10574a,_0x149c48)[_0xd3b5('0x1b')](function(_0x14d1ca){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x4dff0b,_0xd3b5('0x1c'));logger[_0xd3b5('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x4dff0b,_0xd3b5('0x1c'),JSON[_0xd3b5('0x1e')](_0x14d1ca));if(_0x14d1ca[_0xd3b5('0x1f')]){if(_0x14d1ca['error'][_0xd3b5('0x20')]===0x1f4){logger['error'](_0xd3b5('0x21'),_0x4dff0b,_0x14d1ca[_0xd3b5('0x1f')][_0xd3b5('0x22')]);return _0x470168(_0x14d1ca['error']['message']);}logger[_0xd3b5('0x1f')](_0xd3b5('0x21'),_0x4dff0b,_0x14d1ca[_0xd3b5('0x1f')][_0xd3b5('0x22')]);return _0xba6bb7(_0x14d1ca[_0xd3b5('0x1f')]['message']);}else{logger[_0xd3b5('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4dff0b,_0xd3b5('0x1c'));_0xba6bb7(_0x14d1ca[_0xd3b5('0x24')][_0xd3b5('0x22')]);}})['catch'](function(_0x539d32){logger[_0xd3b5('0x1f')](_0xd3b5('0x21'),_0x4dff0b,_0x539d32);_0x470168(_0x539d32);});});}function respondWithStatusCode(_0x4ab5c1,_0x116fdd){_0x116fdd=_0x116fdd||0xcc;return function(_0x1e96f1){if(_0x1e96f1){return _0x4ab5c1[_0xd3b5('0x25')](_0x116fdd);}return _0x4ab5c1['status'](_0x116fdd)['end']();};}function respondWithResult(_0x35beb3,_0x5cee93){_0x5cee93=_0x5cee93||0xc8;return function(_0x505a1d){if(_0x505a1d){return _0x35beb3[_0xd3b5('0x26')](_0x5cee93)['json'](_0x505a1d);}};}function respondWithFilteredResult(_0x56dd1d,_0x15ec54){return function(_0x5439e4){if(_0x5439e4){var _0x51c656=_0x5439e4['count'],_0x94ed8b=_0x15ec54['offset'],_0x5f42ef=_0x15ec54[_0xd3b5('0x27')]+_0x15ec54['limit'],_0x2632c2;if(_0x5f42ef>=_0x51c656){_0x5f42ef=_0x51c656;_0x2632c2=0xc8;}else{_0x2632c2=0xce;}_0x56dd1d[_0xd3b5('0x26')](_0x2632c2);return _0x56dd1d[_0xd3b5('0x28')](_0xd3b5('0x29'),_0x94ed8b+'-'+_0x5f42ef+'/'+_0x51c656)[_0xd3b5('0x2a')](_0x5439e4);}return null;};}function patchUpdates(_0x4cc9c2){return function(_0x3a4f4d){try{jsonpatch[_0xd3b5('0x2b')](_0x3a4f4d,_0x4cc9c2,!![]);}catch(_0x2b429a){return BPromise[_0xd3b5('0x2c')](_0x2b429a);}return _0x3a4f4d['save']();};}function saveUpdates(_0x2ef3f5,_0xb7d497){return function(_0x327f38){if(_0x327f38){return _0x327f38['update'](_0x2ef3f5)['then'](function(_0x4d0bd6){return _0x4d0bd6;});}return null;};}function removeEntity(_0x38202d,_0x79bd4){return function(_0xe46592){if(_0xe46592){return _0xe46592['destroy']()[_0xd3b5('0x1b')](function(){_0x38202d[_0xd3b5('0x26')](0xcc)[_0xd3b5('0x2d')]();});}};}function handleEntityNotFound(_0x1065fc,_0x3e5ad9){return function(_0x55a5cc){if(!_0x55a5cc){_0x1065fc['sendStatus'](0x194);}return _0x55a5cc;};}function handleError(_0x5d5fc1,_0x3a536c){_0x3a536c=_0x3a536c||0x1f4;return function(_0x5958a1){logger[_0xd3b5('0x1f')](_0x5958a1[_0xd3b5('0x2e')]);if(_0x5958a1['name']){delete _0x5958a1[_0xd3b5('0x2f')];}_0x5d5fc1[_0xd3b5('0x26')](_0x3a536c)[_0xd3b5('0x30')](_0x5958a1);};}exports[_0xd3b5('0x31')]=function(_0x40944e,_0x244944){var _0x353575={},_0x548e5a={},_0x28a9e3={'count':0x0,'rows':[]};var _0x5c8786=_[_0xd3b5('0x32')](db[_0xd3b5('0x33')]['rawAttributes'],function(_0x531c31){return{'name':_0x531c31[_0xd3b5('0x34')],'type':_0x531c31[_0xd3b5('0x35')]['key']};});_0x548e5a[_0xd3b5('0x36')]=_[_0xd3b5('0x32')](_0x5c8786,_0xd3b5('0x2f'));_0x548e5a[_0xd3b5('0x37')]=_['keys'](_0x40944e[_0xd3b5('0x37')]);_0x548e5a[_0xd3b5('0x38')]=_[_0xd3b5('0x39')](_0x548e5a[_0xd3b5('0x36')],_0x548e5a[_0xd3b5('0x37')]);_0x353575['attributes']=_[_0xd3b5('0x39')](_0x548e5a['model'],qs[_0xd3b5('0x3a')](_0x40944e['query'][_0xd3b5('0x3a')]));_0x353575['attributes']=_0x353575[_0xd3b5('0x3b')][_0xd3b5('0x3c')]?_0x353575[_0xd3b5('0x3b')]:_0x548e5a['model'];if(!_0x40944e[_0xd3b5('0x37')][_0xd3b5('0x3d')]('nolimit')){_0x353575[_0xd3b5('0x3e')]=qs[_0xd3b5('0x3e')](_0x40944e['query']['limit']);_0x353575[_0xd3b5('0x27')]=qs[_0xd3b5('0x27')](_0x40944e['query'][_0xd3b5('0x27')]);}_0x353575[_0xd3b5('0x3f')]=qs[_0xd3b5('0x40')](_0x40944e[_0xd3b5('0x37')][_0xd3b5('0x40')]);_0x353575[_0xd3b5('0x41')]=qs[_0xd3b5('0x38')](_[_0xd3b5('0x42')](_0x40944e[_0xd3b5('0x37')],_0x548e5a[_0xd3b5('0x38')]),_0x5c8786);if(_0x40944e[_0xd3b5('0x37')]['filter']){_0x353575[_0xd3b5('0x41')]=_['merge'](_0x353575[_0xd3b5('0x41')],{'$or':_[_0xd3b5('0x32')](_0x5c8786,function(_0x2d4c33){if(_0x2d4c33[_0xd3b5('0x35')]!==_0xd3b5('0x43')){var _0x4c39d0={};_0x4c39d0[_0x2d4c33[_0xd3b5('0x2f')]]={'$like':'%'+_0x40944e[_0xd3b5('0x37')][_0xd3b5('0x44')]+'%'};return _0x4c39d0;}})});}_0x353575=_['merge']({},_0x353575,_0x40944e[_0xd3b5('0x45')]);var _0x5b6ac9={'where':_0x353575[_0xd3b5('0x41')]};return db[_0xd3b5('0x33')][_0xd3b5('0x46')](_0x5b6ac9)[_0xd3b5('0x1b')](function(_0x3b220d){_0x28a9e3['count']=_0x3b220d;if(_0x40944e[_0xd3b5('0x37')]['includeAll']){_0x353575[_0xd3b5('0x47')]=[{'all':!![]}];}return db[_0xd3b5('0x33')][_0xd3b5('0x48')](_0x353575);})[_0xd3b5('0x1b')](function(_0x344534){_0x28a9e3[_0xd3b5('0x49')]=_0x344534;return _0x28a9e3;})[_0xd3b5('0x1b')](respondWithFilteredResult(_0x244944,_0x353575))[_0xd3b5('0x4a')](handleError(_0x244944,null));};exports[_0xd3b5('0x4b')]=function(_0xdb9b7f,_0x1d79e0){var _0x34c17e={'raw':![],'where':{'id':_0xdb9b7f[_0xd3b5('0x4c')]['id']}},_0x759c58={};_0x759c58[_0xd3b5('0x36')]=_[_0xd3b5('0x4d')](db[_0xd3b5('0x33')][_0xd3b5('0x4e')]);_0x759c58[_0xd3b5('0x37')]=_[_0xd3b5('0x4d')](_0xdb9b7f[_0xd3b5('0x37')]);_0x759c58['filters']=_['intersection'](_0x759c58[_0xd3b5('0x36')],_0x759c58[_0xd3b5('0x37')]);_0x34c17e[_0xd3b5('0x3b')]=_[_0xd3b5('0x39')](_0x759c58[_0xd3b5('0x36')],qs[_0xd3b5('0x3a')](_0xdb9b7f[_0xd3b5('0x37')][_0xd3b5('0x3a')]));_0x34c17e[_0xd3b5('0x3b')]=_0x34c17e[_0xd3b5('0x3b')][_0xd3b5('0x3c')]?_0x34c17e[_0xd3b5('0x3b')]:_0x759c58[_0xd3b5('0x36')];if(_0xdb9b7f['query'][_0xd3b5('0x4f')]){_0x34c17e['include']=[{'all':!![]}];}_0x34c17e=_[_0xd3b5('0x50')]({},_0x34c17e,_0xdb9b7f[_0xd3b5('0x45')]);return db[_0xd3b5('0x33')][_0xd3b5('0x51')](_0x34c17e)[_0xd3b5('0x1b')](handleEntityNotFound(_0x1d79e0,null))['then'](respondWithResult(_0x1d79e0,null))[_0xd3b5('0x4a')](handleError(_0x1d79e0,null));};exports['create']=function(_0x2b1fb4,_0xd781be){return db['SalesforceConfiguration'][_0xd3b5('0x52')](_0x2b1fb4[_0xd3b5('0x53')],{})[_0xd3b5('0x1b')](respondWithResult(_0xd781be,0xc9))[_0xd3b5('0x4a')](handleError(_0xd781be,null));};exports[_0xd3b5('0x54')]=function(_0x216947,_0x472dde){if(_0x216947['body']['id']){delete _0x216947[_0xd3b5('0x53')]['id'];}return db[_0xd3b5('0x33')][_0xd3b5('0x51')]({'where':{'id':_0x216947[_0xd3b5('0x4c')]['id']}})[_0xd3b5('0x1b')](handleEntityNotFound(_0x472dde,null))[_0xd3b5('0x1b')](saveUpdates(_0x216947[_0xd3b5('0x53')],null))['then'](respondWithResult(_0x472dde,null))['catch'](handleError(_0x472dde,null));};exports[_0xd3b5('0x55')]=function(_0x510b40,_0x3a0f77){return db[_0xd3b5('0x33')][_0xd3b5('0x51')]({'where':{'id':_0x510b40[_0xd3b5('0x4c')]['id']}})[_0xd3b5('0x1b')](handleEntityNotFound(_0x3a0f77,null))[_0xd3b5('0x1b')](removeEntity(_0x3a0f77,null))[_0xd3b5('0x4a')](handleError(_0x3a0f77,null));};exports[_0xd3b5('0x56')]=function(_0x2af5c6,_0x4e87be,_0x55807f){var _0x19bbb7={};var _0x14f2b3={};var _0x5350e6;var _0x381043;return db[_0xd3b5('0x33')][_0xd3b5('0x57')]({'where':{'id':_0x2af5c6[_0xd3b5('0x4c')]['id']}})[_0xd3b5('0x1b')](handleEntityNotFound(_0x4e87be,null))[_0xd3b5('0x1b')](function(_0x18ac66){if(_0x18ac66){_0x5350e6=_0x18ac66;_0x14f2b3[_0xd3b5('0x36')]=_[_0xd3b5('0x4d')](db[_0xd3b5('0x58')][_0xd3b5('0x4e')]);_0x14f2b3[_0xd3b5('0x37')]=_[_0xd3b5('0x4d')](_0x2af5c6[_0xd3b5('0x37')]);_0x14f2b3['filters']=_[_0xd3b5('0x39')](_0x14f2b3['model'],_0x14f2b3['query']);_0x19bbb7[_0xd3b5('0x3b')]=_[_0xd3b5('0x39')](_0x14f2b3[_0xd3b5('0x36')],qs[_0xd3b5('0x3a')](_0x2af5c6[_0xd3b5('0x37')][_0xd3b5('0x3a')]));_0x19bbb7[_0xd3b5('0x3b')]=_0x19bbb7[_0xd3b5('0x3b')][_0xd3b5('0x3c')]?_0x19bbb7[_0xd3b5('0x3b')]:_0x14f2b3[_0xd3b5('0x36')];_0x19bbb7[_0xd3b5('0x3f')]=qs['sort'](_0x2af5c6[_0xd3b5('0x37')][_0xd3b5('0x40')]);_0x19bbb7['where']=qs['filters'](_[_0xd3b5('0x42')](_0x2af5c6['query'],_0x14f2b3[_0xd3b5('0x38')]));if(_0x2af5c6[_0xd3b5('0x37')][_0xd3b5('0x44')]){_0x19bbb7['where']=_['merge'](_0x19bbb7[_0xd3b5('0x41')],{'$or':_['map'](_0x19bbb7[_0xd3b5('0x3b')],function(_0x59757e){var _0xbbfa42={};_0xbbfa42[_0x59757e]={'$like':'%'+_0x2af5c6[_0xd3b5('0x37')][_0xd3b5('0x44')]+'%'};return _0xbbfa42;})});}_0x19bbb7=_[_0xd3b5('0x50')]({},_0x19bbb7,_0x2af5c6[_0xd3b5('0x45')]);return _0x5350e6[_0xd3b5('0x56')](_0x19bbb7);}})[_0xd3b5('0x1b')](function(_0x4aa434){if(_0x4aa434){_0x381043=_0x4aa434[_0xd3b5('0x3c')];if(!_0x2af5c6[_0xd3b5('0x37')][_0xd3b5('0x3d')](_0xd3b5('0x59'))){_0x19bbb7[_0xd3b5('0x3e')]=qs['limit'](_0x2af5c6[_0xd3b5('0x37')]['limit']);_0x19bbb7[_0xd3b5('0x27')]=qs[_0xd3b5('0x27')](_0x2af5c6['query'][_0xd3b5('0x27')]);}return _0x5350e6[_0xd3b5('0x56')](_0x19bbb7);}})[_0xd3b5('0x1b')](function(_0x2c3a02){if(_0x2c3a02){return _0x2c3a02?{'count':_0x381043,'rows':_0x2c3a02}:null;}})[_0xd3b5('0x1b')](respondWithResult(_0x4e87be,null))[_0xd3b5('0x4a')](handleError(_0x4e87be,null));};exports['getSubjects']=function(_0x3453e4,_0x535308,_0x1ce2f4){var _0x204655={};var _0x59d54a={};var _0x28789f;var _0x2294b6;return db[_0xd3b5('0x33')][_0xd3b5('0x57')]({'where':{'id':_0x3453e4[_0xd3b5('0x4c')]['id']}})[_0xd3b5('0x1b')](handleEntityNotFound(_0x535308,null))['then'](function(_0x2307d4){if(_0x2307d4){_0x28789f=_0x2307d4;_0x59d54a['model']=_[_0xd3b5('0x4d')](db[_0xd3b5('0x58')][_0xd3b5('0x4e')]);_0x59d54a[_0xd3b5('0x37')]=_['keys'](_0x3453e4['query']);_0x59d54a[_0xd3b5('0x38')]=_[_0xd3b5('0x39')](_0x59d54a['model'],_0x59d54a[_0xd3b5('0x37')]);_0x204655['attributes']=_[_0xd3b5('0x39')](_0x59d54a['model'],qs['fields'](_0x3453e4[_0xd3b5('0x37')][_0xd3b5('0x3a')]));_0x204655[_0xd3b5('0x3b')]=_0x204655[_0xd3b5('0x3b')][_0xd3b5('0x3c')]?_0x204655[_0xd3b5('0x3b')]:_0x59d54a[_0xd3b5('0x36')];_0x204655['order']=qs[_0xd3b5('0x40')](_0x3453e4[_0xd3b5('0x37')][_0xd3b5('0x40')]);_0x204655['where']=qs[_0xd3b5('0x38')](_[_0xd3b5('0x42')](_0x3453e4[_0xd3b5('0x37')],_0x59d54a[_0xd3b5('0x38')]));if(_0x3453e4[_0xd3b5('0x37')][_0xd3b5('0x44')]){_0x204655[_0xd3b5('0x41')]=_['merge'](_0x204655[_0xd3b5('0x41')],{'$or':_['map'](_0x204655[_0xd3b5('0x3b')],function(_0x367d04){var _0x4b5346={};_0x4b5346[_0x367d04]={'$like':'%'+_0x3453e4[_0xd3b5('0x37')][_0xd3b5('0x44')]+'%'};return _0x4b5346;})});}_0x204655=_[_0xd3b5('0x50')]({},_0x204655,_0x3453e4['options']);return _0x28789f['getSubjects'](_0x204655);}})[_0xd3b5('0x1b')](function(_0x3b5e29){if(_0x3b5e29){_0x2294b6=_0x3b5e29[_0xd3b5('0x3c')];if(!_0x3453e4[_0xd3b5('0x37')][_0xd3b5('0x3d')](_0xd3b5('0x59'))){_0x204655[_0xd3b5('0x3e')]=qs['limit'](_0x3453e4[_0xd3b5('0x37')]['limit']);_0x204655[_0xd3b5('0x27')]=qs[_0xd3b5('0x27')](_0x3453e4[_0xd3b5('0x37')][_0xd3b5('0x27')]);}return _0x28789f[_0xd3b5('0x5a')](_0x204655);}})[_0xd3b5('0x1b')](function(_0x2f7ff4){if(_0x2f7ff4){return _0x2f7ff4?{'count':_0x2294b6,'rows':_0x2f7ff4}:null;}})[_0xd3b5('0x1b')](respondWithResult(_0x535308,null))['catch'](handleError(_0x535308,null));};exports['getDescriptions']=function(_0x41fc99,_0x3f5b16,_0x20ecc3){var _0x3640fe={};var _0x255691={};var _0x1cb0ed;var _0x35d421;return db[_0xd3b5('0x33')][_0xd3b5('0x57')]({'where':{'id':_0x41fc99[_0xd3b5('0x4c')]['id']}})[_0xd3b5('0x1b')](handleEntityNotFound(_0x3f5b16,null))['then'](function(_0x3ab2b2){if(_0x3ab2b2){_0x1cb0ed=_0x3ab2b2;_0x255691[_0xd3b5('0x36')]=_['keys'](db['SalesforceField'][_0xd3b5('0x4e')]);_0x255691['query']=_[_0xd3b5('0x4d')](_0x41fc99[_0xd3b5('0x37')]);_0x255691['filters']=_[_0xd3b5('0x39')](_0x255691['model'],_0x255691[_0xd3b5('0x37')]);_0x3640fe['attributes']=_['intersection'](_0x255691[_0xd3b5('0x36')],qs['fields'](_0x41fc99[_0xd3b5('0x37')][_0xd3b5('0x3a')]));_0x3640fe[_0xd3b5('0x3b')]=_0x3640fe[_0xd3b5('0x3b')][_0xd3b5('0x3c')]?_0x3640fe[_0xd3b5('0x3b')]:_0x255691[_0xd3b5('0x36')];_0x3640fe[_0xd3b5('0x3f')]=qs[_0xd3b5('0x40')](_0x41fc99['query'][_0xd3b5('0x40')]);_0x3640fe[_0xd3b5('0x41')]=qs[_0xd3b5('0x38')](_[_0xd3b5('0x42')](_0x41fc99[_0xd3b5('0x37')],_0x255691[_0xd3b5('0x38')]));if(_0x41fc99['query'][_0xd3b5('0x44')]){_0x3640fe[_0xd3b5('0x41')]=_['merge'](_0x3640fe[_0xd3b5('0x41')],{'$or':_[_0xd3b5('0x32')](_0x3640fe[_0xd3b5('0x3b')],function(_0x9d2338){var _0x5d1f61={};_0x5d1f61[_0x9d2338]={'$like':'%'+_0x41fc99[_0xd3b5('0x37')]['filter']+'%'};return _0x5d1f61;})});}_0x3640fe=_[_0xd3b5('0x50')]({},_0x3640fe,_0x41fc99[_0xd3b5('0x45')]);return _0x1cb0ed[_0xd3b5('0x5b')](_0x3640fe);}})[_0xd3b5('0x1b')](function(_0x446df5){if(_0x446df5){_0x35d421=_0x446df5['length'];if(!_0x41fc99['query'][_0xd3b5('0x3d')](_0xd3b5('0x59'))){_0x3640fe[_0xd3b5('0x3e')]=qs[_0xd3b5('0x3e')](_0x41fc99[_0xd3b5('0x37')][_0xd3b5('0x3e')]);_0x3640fe[_0xd3b5('0x27')]=qs[_0xd3b5('0x27')](_0x41fc99[_0xd3b5('0x37')][_0xd3b5('0x27')]);}return _0x1cb0ed[_0xd3b5('0x5b')](_0x3640fe);}})[_0xd3b5('0x1b')](function(_0x18d634){if(_0x18d634){return _0x18d634?{'count':_0x35d421,'rows':_0x18d634}:null;}})[_0xd3b5('0x1b')](respondWithResult(_0x3f5b16,null))[_0xd3b5('0x4a')](handleError(_0x3f5b16,null));}; \ No newline at end of file +var _0x18a1=['result','catch','sendStatus','status','end','json','count','offset','set','reject','update','destroy','name','send','SalesforceConfiguration','rawAttributes','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','show','params','intersection','includeAll','create','body','find','getFields','findOne','getSubjects','SalesforceField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1d1259,_0x448179){var _0x454e5d=function(_0x50d166){while(--_0x50d166){_0x1d1259['push'](_0x1d1259['shift']());}};_0x454e5d(++_0x448179);}(_0x18a1,0xe1));var _0x118a=function(_0x531b92,_0xed903d){_0x531b92=_0x531b92-0x0;var _0x2d29d6=_0x18a1[_0x531b92];return _0x2d29d6;};'use strict';var pdf=require(_0x118a('0x0'));var emlformat=require(_0x118a('0x1'));var rimraf=require(_0x118a('0x2'));var zipdir=require(_0x118a('0x3'));var jsonpatch=require(_0x118a('0x4'));var rp=require(_0x118a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x118a('0x6'));var util=require(_0x118a('0x7'));var path=require(_0x118a('0x8'));var sox=require(_0x118a('0x9'));var csv=require(_0x118a('0xa'));var ejs=require(_0x118a('0xb'));var fs=require('fs');var _=require(_0x118a('0xc'));var squel=require(_0x118a('0xd'));var crypto=require(_0x118a('0xe'));var jsforce=require(_0x118a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x118a('0xa'));var querystring=require(_0x118a('0x10'));var Papa=require(_0x118a('0x11'));var Redis=require(_0x118a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x118a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x118a('0x14'));var utils=require(_0x118a('0x15'));var config=require(_0x118a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x118a('0x17'))['db'];var jayson=require(_0x118a('0x18'));var client=jayson[_0x118a('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5376b5,_0x264fb0,_0xbea1bd,_0xc7c64f){return new BPromise(function(_0x496057,_0x29d6f8){var _0x228820=_0xc7c64f||client;return _0x228820['request'](_0x5376b5,_0xbea1bd)[_0x118a('0x1a')](function(_0x9ff605){logger['info'](_0x118a('0x1b'),_0x264fb0,_0x118a('0x1c'));logger[_0x118a('0x1d')](_0x118a('0x1e'),_0x264fb0,'request\x20sent',JSON[_0x118a('0x1f')](_0x9ff605));if(_0x9ff605[_0x118a('0x20')]){if(_0x9ff605[_0x118a('0x20')][_0x118a('0x21')]===0x1f4){logger[_0x118a('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x264fb0,_0x9ff605[_0x118a('0x20')][_0x118a('0x22')]);return _0x29d6f8(_0x9ff605[_0x118a('0x20')][_0x118a('0x22')]);}logger[_0x118a('0x20')](_0x118a('0x1b'),_0x264fb0,_0x9ff605[_0x118a('0x20')][_0x118a('0x22')]);return _0x496057(_0x9ff605['error'][_0x118a('0x22')]);}else{logger[_0x118a('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x264fb0,'request\x20sent');_0x496057(_0x9ff605[_0x118a('0x24')]['message']);}})[_0x118a('0x25')](function(_0x5da72c){logger[_0x118a('0x20')](_0x118a('0x1b'),_0x264fb0,_0x5da72c);_0x29d6f8(_0x5da72c);});});}function respondWithStatusCode(_0x33d164,_0x5ef383){_0x5ef383=_0x5ef383||0xcc;return function(_0x235e88){if(_0x235e88){return _0x33d164[_0x118a('0x26')](_0x5ef383);}return _0x33d164[_0x118a('0x27')](_0x5ef383)[_0x118a('0x28')]();};}function respondWithResult(_0x4ae1d4,_0x14dd7d){_0x14dd7d=_0x14dd7d||0xc8;return function(_0xeb2949){if(_0xeb2949){return _0x4ae1d4[_0x118a('0x27')](_0x14dd7d)[_0x118a('0x29')](_0xeb2949);}};}function respondWithFilteredResult(_0x2208af,_0x44eae3){return function(_0x523675){if(_0x523675){var _0x11c981=_0x523675[_0x118a('0x2a')],_0x520978=_0x44eae3[_0x118a('0x2b')],_0x3e3113=_0x44eae3[_0x118a('0x2b')]+_0x44eae3['limit'],_0x184b71;if(_0x3e3113>=_0x11c981){_0x3e3113=_0x11c981;_0x184b71=0xc8;}else{_0x184b71=0xce;}_0x2208af[_0x118a('0x27')](_0x184b71);return _0x2208af[_0x118a('0x2c')]('Content-Range',_0x520978+'-'+_0x3e3113+'/'+_0x11c981)[_0x118a('0x29')](_0x523675);}return null;};}function patchUpdates(_0x3de249){return function(_0x2b9cd7){try{jsonpatch['apply'](_0x2b9cd7,_0x3de249,!![]);}catch(_0x506569){return BPromise[_0x118a('0x2d')](_0x506569);}return _0x2b9cd7['save']();};}function saveUpdates(_0x2ef24d,_0x5dd19e){return function(_0x7236da){if(_0x7236da){return _0x7236da[_0x118a('0x2e')](_0x2ef24d)[_0x118a('0x1a')](function(_0x543344){return _0x543344;});}return null;};}function removeEntity(_0x4f16d6,_0x4c4249){return function(_0x5dc10d){if(_0x5dc10d){return _0x5dc10d[_0x118a('0x2f')]()[_0x118a('0x1a')](function(){_0x4f16d6[_0x118a('0x27')](0xcc)[_0x118a('0x28')]();});}};}function handleEntityNotFound(_0x59c48d,_0x22fb11){return function(_0x2902f9){if(!_0x2902f9){_0x59c48d['sendStatus'](0x194);}return _0x2902f9;};}function handleError(_0x254b02,_0xea5cd5){_0xea5cd5=_0xea5cd5||0x1f4;return function(_0xf3e82d){logger[_0x118a('0x20')](_0xf3e82d['stack']);if(_0xf3e82d[_0x118a('0x30')]){delete _0xf3e82d[_0x118a('0x30')];}_0x254b02[_0x118a('0x27')](_0xea5cd5)[_0x118a('0x31')](_0xf3e82d);};}exports['index']=function(_0xdf2f85,_0x509397){var _0x55c913={},_0x947939={},_0x400af2={'count':0x0,'rows':[]};var _0x53b424=_['map'](db[_0x118a('0x32')][_0x118a('0x33')],function(_0x51222b){return{'name':_0x51222b['fieldName'],'type':_0x51222b[_0x118a('0x34')][_0x118a('0x35')]};});_0x947939[_0x118a('0x36')]=_[_0x118a('0x37')](_0x53b424,_0x118a('0x30'));_0x947939['query']=_[_0x118a('0x38')](_0xdf2f85[_0x118a('0x39')]);_0x947939[_0x118a('0x3a')]=_['intersection'](_0x947939['model'],_0x947939[_0x118a('0x39')]);_0x55c913[_0x118a('0x3b')]=_['intersection'](_0x947939['model'],qs[_0x118a('0x3c')](_0xdf2f85[_0x118a('0x39')]['fields']));_0x55c913[_0x118a('0x3b')]=_0x55c913[_0x118a('0x3b')][_0x118a('0x3d')]?_0x55c913[_0x118a('0x3b')]:_0x947939[_0x118a('0x36')];if(!_0xdf2f85[_0x118a('0x39')][_0x118a('0x3e')](_0x118a('0x3f'))){_0x55c913[_0x118a('0x40')]=qs['limit'](_0xdf2f85[_0x118a('0x39')]['limit']);_0x55c913[_0x118a('0x2b')]=qs[_0x118a('0x2b')](_0xdf2f85['query'][_0x118a('0x2b')]);}_0x55c913[_0x118a('0x41')]=qs[_0x118a('0x42')](_0xdf2f85['query'][_0x118a('0x42')]);_0x55c913['where']=qs['filters'](_[_0x118a('0x43')](_0xdf2f85['query'],_0x947939[_0x118a('0x3a')]),_0x53b424);if(_0xdf2f85[_0x118a('0x39')]['filter']){_0x55c913[_0x118a('0x44')]=_[_0x118a('0x45')](_0x55c913['where'],{'$or':_['map'](_0x53b424,function(_0x50e2a6){if(_0x50e2a6[_0x118a('0x34')]!==_0x118a('0x46')){var _0x2be6f1={};_0x2be6f1[_0x50e2a6['name']]={'$like':'%'+_0xdf2f85[_0x118a('0x39')][_0x118a('0x47')]+'%'};return _0x2be6f1;}})});}_0x55c913=_[_0x118a('0x45')]({},_0x55c913,_0xdf2f85[_0x118a('0x48')]);var _0x5f08e4={'where':_0x55c913[_0x118a('0x44')]};return db[_0x118a('0x32')][_0x118a('0x2a')](_0x5f08e4)[_0x118a('0x1a')](function(_0x678151){_0x400af2[_0x118a('0x2a')]=_0x678151;if(_0xdf2f85['query']['includeAll']){_0x55c913['include']=[{'all':!![]}];}return db[_0x118a('0x32')][_0x118a('0x49')](_0x55c913);})['then'](function(_0x372bb0){_0x400af2[_0x118a('0x4a')]=_0x372bb0;return _0x400af2;})[_0x118a('0x1a')](respondWithFilteredResult(_0x509397,_0x55c913))['catch'](handleError(_0x509397,null));};exports[_0x118a('0x4b')]=function(_0x32d994,_0x10e4d3){var _0x2cada8={'raw':![],'where':{'id':_0x32d994[_0x118a('0x4c')]['id']}},_0x2cc41c={};_0x2cc41c[_0x118a('0x36')]=_[_0x118a('0x38')](db[_0x118a('0x32')][_0x118a('0x33')]);_0x2cc41c[_0x118a('0x39')]=_['keys'](_0x32d994[_0x118a('0x39')]);_0x2cc41c[_0x118a('0x3a')]=_[_0x118a('0x4d')](_0x2cc41c[_0x118a('0x36')],_0x2cc41c[_0x118a('0x39')]);_0x2cada8[_0x118a('0x3b')]=_[_0x118a('0x4d')](_0x2cc41c['model'],qs[_0x118a('0x3c')](_0x32d994[_0x118a('0x39')][_0x118a('0x3c')]));_0x2cada8[_0x118a('0x3b')]=_0x2cada8[_0x118a('0x3b')]['length']?_0x2cada8[_0x118a('0x3b')]:_0x2cc41c[_0x118a('0x36')];if(_0x32d994[_0x118a('0x39')][_0x118a('0x4e')]){_0x2cada8['include']=[{'all':!![]}];}_0x2cada8=_[_0x118a('0x45')]({},_0x2cada8,_0x32d994[_0x118a('0x48')]);return db[_0x118a('0x32')]['find'](_0x2cada8)[_0x118a('0x1a')](handleEntityNotFound(_0x10e4d3,null))[_0x118a('0x1a')](respondWithResult(_0x10e4d3,null))[_0x118a('0x25')](handleError(_0x10e4d3,null));};exports['create']=function(_0x44b75a,_0x85e9f5){return db['SalesforceConfiguration'][_0x118a('0x4f')](_0x44b75a[_0x118a('0x50')],{})[_0x118a('0x1a')](respondWithResult(_0x85e9f5,0xc9))[_0x118a('0x25')](handleError(_0x85e9f5,null));};exports[_0x118a('0x2e')]=function(_0x101401,_0x420d69){if(_0x101401[_0x118a('0x50')]['id']){delete _0x101401[_0x118a('0x50')]['id'];}return db[_0x118a('0x32')][_0x118a('0x51')]({'where':{'id':_0x101401['params']['id']}})['then'](handleEntityNotFound(_0x420d69,null))[_0x118a('0x1a')](saveUpdates(_0x101401[_0x118a('0x50')],null))[_0x118a('0x1a')](respondWithResult(_0x420d69,null))[_0x118a('0x25')](handleError(_0x420d69,null));};exports[_0x118a('0x2f')]=function(_0x55bc7a,_0x42babb){return db[_0x118a('0x32')][_0x118a('0x51')]({'where':{'id':_0x55bc7a[_0x118a('0x4c')]['id']}})[_0x118a('0x1a')](handleEntityNotFound(_0x42babb,null))[_0x118a('0x1a')](removeEntity(_0x42babb,null))[_0x118a('0x25')](handleError(_0x42babb,null));};exports[_0x118a('0x52')]=function(_0x2a7f18,_0xeab7ca,_0x40b611){var _0x41f3c8={};var _0x2acc17={};var _0x34922c;var _0xb3b085;return db['SalesforceConfiguration'][_0x118a('0x53')]({'where':{'id':_0x2a7f18['params']['id']}})[_0x118a('0x1a')](handleEntityNotFound(_0xeab7ca,null))[_0x118a('0x1a')](function(_0x410b75){if(_0x410b75){_0x34922c=_0x410b75;_0x2acc17[_0x118a('0x36')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x2acc17[_0x118a('0x39')]=_[_0x118a('0x38')](_0x2a7f18[_0x118a('0x39')]);_0x2acc17[_0x118a('0x3a')]=_['intersection'](_0x2acc17[_0x118a('0x36')],_0x2acc17[_0x118a('0x39')]);_0x41f3c8['attributes']=_[_0x118a('0x4d')](_0x2acc17[_0x118a('0x36')],qs[_0x118a('0x3c')](_0x2a7f18[_0x118a('0x39')][_0x118a('0x3c')]));_0x41f3c8[_0x118a('0x3b')]=_0x41f3c8['attributes'][_0x118a('0x3d')]?_0x41f3c8['attributes']:_0x2acc17[_0x118a('0x36')];_0x41f3c8['order']=qs['sort'](_0x2a7f18[_0x118a('0x39')][_0x118a('0x42')]);_0x41f3c8[_0x118a('0x44')]=qs[_0x118a('0x3a')](_['pick'](_0x2a7f18[_0x118a('0x39')],_0x2acc17[_0x118a('0x3a')]));if(_0x2a7f18[_0x118a('0x39')][_0x118a('0x47')]){_0x41f3c8[_0x118a('0x44')]=_[_0x118a('0x45')](_0x41f3c8[_0x118a('0x44')],{'$or':_[_0x118a('0x37')](_0x41f3c8['attributes'],function(_0x5790ee){var _0x4f04cc={};_0x4f04cc[_0x5790ee]={'$like':'%'+_0x2a7f18[_0x118a('0x39')][_0x118a('0x47')]+'%'};return _0x4f04cc;})});}_0x41f3c8=_[_0x118a('0x45')]({},_0x41f3c8,_0x2a7f18[_0x118a('0x48')]);return _0x34922c[_0x118a('0x52')](_0x41f3c8);}})[_0x118a('0x1a')](function(_0x18b5b4){if(_0x18b5b4){_0xb3b085=_0x18b5b4[_0x118a('0x3d')];if(!_0x2a7f18[_0x118a('0x39')]['hasOwnProperty'](_0x118a('0x3f'))){_0x41f3c8['limit']=qs[_0x118a('0x40')](_0x2a7f18[_0x118a('0x39')][_0x118a('0x40')]);_0x41f3c8[_0x118a('0x2b')]=qs[_0x118a('0x2b')](_0x2a7f18[_0x118a('0x39')][_0x118a('0x2b')]);}return _0x34922c[_0x118a('0x52')](_0x41f3c8);}})[_0x118a('0x1a')](function(_0x563dcc){if(_0x563dcc){return _0x563dcc?{'count':_0xb3b085,'rows':_0x563dcc}:null;}})[_0x118a('0x1a')](respondWithResult(_0xeab7ca,null))[_0x118a('0x25')](handleError(_0xeab7ca,null));};exports[_0x118a('0x54')]=function(_0x128535,_0x5dc6b6,_0xe39666){var _0x404311={};var _0x58a5c4={};var _0x50081e;var _0x2f59cf;return db[_0x118a('0x32')][_0x118a('0x53')]({'where':{'id':_0x128535[_0x118a('0x4c')]['id']}})[_0x118a('0x1a')](handleEntityNotFound(_0x5dc6b6,null))[_0x118a('0x1a')](function(_0x51c592){if(_0x51c592){_0x50081e=_0x51c592;_0x58a5c4[_0x118a('0x36')]=_[_0x118a('0x38')](db[_0x118a('0x55')][_0x118a('0x33')]);_0x58a5c4['query']=_['keys'](_0x128535[_0x118a('0x39')]);_0x58a5c4[_0x118a('0x3a')]=_[_0x118a('0x4d')](_0x58a5c4[_0x118a('0x36')],_0x58a5c4['query']);_0x404311[_0x118a('0x3b')]=_[_0x118a('0x4d')](_0x58a5c4[_0x118a('0x36')],qs[_0x118a('0x3c')](_0x128535['query']['fields']));_0x404311[_0x118a('0x3b')]=_0x404311['attributes'][_0x118a('0x3d')]?_0x404311[_0x118a('0x3b')]:_0x58a5c4[_0x118a('0x36')];_0x404311['order']=qs[_0x118a('0x42')](_0x128535['query'][_0x118a('0x42')]);_0x404311['where']=qs[_0x118a('0x3a')](_['pick'](_0x128535[_0x118a('0x39')],_0x58a5c4['filters']));if(_0x128535['query'][_0x118a('0x47')]){_0x404311['where']=_[_0x118a('0x45')](_0x404311[_0x118a('0x44')],{'$or':_[_0x118a('0x37')](_0x404311[_0x118a('0x3b')],function(_0x310bfe){var _0x25590a={};_0x25590a[_0x310bfe]={'$like':'%'+_0x128535[_0x118a('0x39')][_0x118a('0x47')]+'%'};return _0x25590a;})});}_0x404311=_[_0x118a('0x45')]({},_0x404311,_0x128535['options']);return _0x50081e[_0x118a('0x54')](_0x404311);}})[_0x118a('0x1a')](function(_0x2133bf){if(_0x2133bf){_0x2f59cf=_0x2133bf[_0x118a('0x3d')];if(!_0x128535[_0x118a('0x39')][_0x118a('0x3e')](_0x118a('0x3f'))){_0x404311[_0x118a('0x40')]=qs[_0x118a('0x40')](_0x128535[_0x118a('0x39')][_0x118a('0x40')]);_0x404311[_0x118a('0x2b')]=qs['offset'](_0x128535['query'][_0x118a('0x2b')]);}return _0x50081e[_0x118a('0x54')](_0x404311);}})[_0x118a('0x1a')](function(_0x2b8bef){if(_0x2b8bef){return _0x2b8bef?{'count':_0x2f59cf,'rows':_0x2b8bef}:null;}})['then'](respondWithResult(_0x5dc6b6,null))['catch'](handleError(_0x5dc6b6,null));};exports['getDescriptions']=function(_0x2d0f15,_0x3221c4,_0xfd0f04){var _0x574a3a={};var _0x3721d4={};var _0x4d3640;var _0x4aebd3;return db['SalesforceConfiguration'][_0x118a('0x53')]({'where':{'id':_0x2d0f15[_0x118a('0x4c')]['id']}})[_0x118a('0x1a')](handleEntityNotFound(_0x3221c4,null))[_0x118a('0x1a')](function(_0x22284d){if(_0x22284d){_0x4d3640=_0x22284d;_0x3721d4[_0x118a('0x36')]=_[_0x118a('0x38')](db[_0x118a('0x55')][_0x118a('0x33')]);_0x3721d4[_0x118a('0x39')]=_[_0x118a('0x38')](_0x2d0f15[_0x118a('0x39')]);_0x3721d4[_0x118a('0x3a')]=_[_0x118a('0x4d')](_0x3721d4[_0x118a('0x36')],_0x3721d4[_0x118a('0x39')]);_0x574a3a[_0x118a('0x3b')]=_[_0x118a('0x4d')](_0x3721d4[_0x118a('0x36')],qs['fields'](_0x2d0f15[_0x118a('0x39')][_0x118a('0x3c')]));_0x574a3a[_0x118a('0x3b')]=_0x574a3a[_0x118a('0x3b')][_0x118a('0x3d')]?_0x574a3a[_0x118a('0x3b')]:_0x3721d4['model'];_0x574a3a[_0x118a('0x41')]=qs[_0x118a('0x42')](_0x2d0f15[_0x118a('0x39')][_0x118a('0x42')]);_0x574a3a[_0x118a('0x44')]=qs[_0x118a('0x3a')](_[_0x118a('0x43')](_0x2d0f15['query'],_0x3721d4[_0x118a('0x3a')]));if(_0x2d0f15[_0x118a('0x39')]['filter']){_0x574a3a[_0x118a('0x44')]=_[_0x118a('0x45')](_0x574a3a[_0x118a('0x44')],{'$or':_[_0x118a('0x37')](_0x574a3a[_0x118a('0x3b')],function(_0x5917ff){var _0x1e714d={};_0x1e714d[_0x5917ff]={'$like':'%'+_0x2d0f15[_0x118a('0x39')]['filter']+'%'};return _0x1e714d;})});}_0x574a3a=_[_0x118a('0x45')]({},_0x574a3a,_0x2d0f15[_0x118a('0x48')]);return _0x4d3640[_0x118a('0x56')](_0x574a3a);}})[_0x118a('0x1a')](function(_0x1ca6b2){if(_0x1ca6b2){_0x4aebd3=_0x1ca6b2[_0x118a('0x3d')];if(!_0x2d0f15[_0x118a('0x39')]['hasOwnProperty']('nolimit')){_0x574a3a[_0x118a('0x40')]=qs[_0x118a('0x40')](_0x2d0f15[_0x118a('0x39')][_0x118a('0x40')]);_0x574a3a['offset']=qs[_0x118a('0x2b')](_0x2d0f15[_0x118a('0x39')][_0x118a('0x2b')]);}return _0x4d3640[_0x118a('0x56')](_0x574a3a);}})[_0x118a('0x1a')](function(_0x408aba){if(_0x408aba){return _0x408aba?{'count':_0x4aebd3,'rows':_0x408aba}:null;}})['then'](respondWithResult(_0x3221c4,null))[_0x118a('0x25')](handleError(_0x3221c4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7d43a6c..23afffc 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 _0x08d5=['define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','request-promise','rimraf','./intSalesforceConfiguration.attributes','exports'];(function(_0xee4798,_0x242d90){var _0x298560=function(_0x1d535a){while(--_0x1d535a){_0xee4798['push'](_0xee4798['shift']());}};_0x298560(++_0x242d90);}(_0x08d5,0x100));var _0x508d=function(_0x58b7f8,_0x56bb2a){_0x58b7f8=_0x58b7f8-0x0;var _0x15898a=_0x08d5[_0x58b7f8];return _0x15898a;};'use strict';var _=require(_0x508d('0x0'));var util=require(_0x508d('0x1'));var logger=require(_0x508d('0x2'))(_0x508d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x508d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x508d('0x5'));var config=require('../../config/environment');var attributes=require(_0x508d('0x6'));module[_0x508d('0x7')]=function(_0x40d6f6,_0x1ba90e){return _0x40d6f6[_0x508d('0x8')](_0x508d('0x9'),attributes,{'tableName':_0x508d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48b1=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x4e4317,_0x5162c2){var _0x33f2f0=function(_0x357356){while(--_0x357356){_0x4e4317['push'](_0x4e4317['shift']());}};_0x33f2f0(++_0x5162c2);}(_0x48b1,0x1cd));var _0x148b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x148b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x148b('0x1'));var moment=require(_0x148b('0x2'));var BPromise=require('bluebird');var rp=require(_0x148b('0x3'));var fs=require('fs');var path=require(_0x148b('0x4'));var rimraf=require(_0x148b('0x5'));var config=require(_0x148b('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x148b('0x7')]=function(_0x1de09c,_0x1352b1){return _0x1de09c[_0x148b('0x8')](_0x148b('0x9'),attributes,{'tableName':_0x148b('0xa'),'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 7cf8671..7296db4 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 _0x93a7=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2b8f84,_0x349ee2){var _0x2927ca=function(_0x1700be){while(--_0x1700be){_0x2b8f84['push'](_0x2b8f84['shift']());}};_0x2927ca(++_0x349ee2);}(_0x93a7,0x189));var _0x793a=function(_0x562eda,_0x3916f6){_0x562eda=_0x562eda-0x0;var _0x56aedd=_0x93a7[_0x562eda];return _0x56aedd;};'use strict';var _=require(_0x793a('0x0'));var util=require(_0x793a('0x1'));var moment=require(_0x793a('0x2'));var BPromise=require(_0x793a('0x3'));var rs=require(_0x793a('0x4'));var fs=require('fs');var Redis=require(_0x793a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x793a('0x6'));var logger=require(_0x793a('0x7'))(_0x793a('0x8'));var config=require(_0x793a('0x9'));var jayson=require(_0x793a('0xa'));var client=jayson[_0x793a('0xb')][_0x793a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c8f0d,_0x2a4f88,_0x46e911){return new BPromise(function(_0x51c09d,_0x3889b2){return client[_0x793a('0xd')](_0x2c8f0d,_0x46e911)[_0x793a('0xe')](function(_0x43b53b){logger['info'](_0x793a('0xf'),_0x2a4f88,_0x793a('0x10'));logger[_0x793a('0x11')](_0x793a('0x12'),_0x2a4f88,_0x793a('0x10'),JSON[_0x793a('0x13')](_0x43b53b));if(_0x43b53b[_0x793a('0x14')]){if(_0x43b53b['error'][_0x793a('0x15')]===0x1f4){logger[_0x793a('0x14')](_0x793a('0xf'),_0x2a4f88,_0x43b53b[_0x793a('0x14')][_0x793a('0x16')]);return _0x3889b2(_0x43b53b['error'][_0x793a('0x16')]);}logger['error'](_0x793a('0xf'),_0x2a4f88,_0x43b53b[_0x793a('0x14')]['message']);return _0x51c09d(_0x43b53b[_0x793a('0x14')][_0x793a('0x16')]);}else{logger[_0x793a('0x17')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2a4f88,_0x793a('0x10'));_0x51c09d(_0x43b53b[_0x793a('0x18')]['message']);}})[_0x793a('0x19')](function(_0x35664b){logger[_0x793a('0x14')](_0x793a('0xf'),_0x2a4f88,_0x35664b);_0x3889b2(_0x35664b);});});} \ No newline at end of file +var _0x88fb=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x3d387a,_0x81c3ff){var _0xe3eebd=function(_0x3d90bf){while(--_0x3d90bf){_0x3d387a['push'](_0x3d387a['shift']());}};_0xe3eebd(++_0x81c3ff);}(_0x88fb,0xa4));var _0xb88f=function(_0x189f5e,_0x168d32){_0x189f5e=_0x189f5e-0x0;var _0x2a0809=_0x88fb[_0x189f5e];return _0x2a0809;};'use strict';var _=require(_0xb88f('0x0'));var util=require(_0xb88f('0x1'));var moment=require(_0xb88f('0x2'));var BPromise=require(_0xb88f('0x3'));var rs=require(_0xb88f('0x4'));var fs=require('fs');var Redis=require(_0xb88f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb88f('0x6'));var logger=require(_0xb88f('0x7'))('rpc');var config=require(_0xb88f('0x8'));var jayson=require(_0xb88f('0x9'));var client=jayson['client'][_0xb88f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ed8c2,_0xc72e7d,_0x5a607d){return new BPromise(function(_0x222952,_0x72664){return client[_0xb88f('0xb')](_0x3ed8c2,_0x5a607d)['then'](function(_0x2bee6f){logger[_0xb88f('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0xc72e7d,_0xb88f('0xd'));logger[_0xb88f('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0xc72e7d,'request\x20sent',JSON[_0xb88f('0xf')](_0x2bee6f));if(_0x2bee6f[_0xb88f('0x10')]){if(_0x2bee6f['error'][_0xb88f('0x11')]===0x1f4){logger['error'](_0xb88f('0x12'),_0xc72e7d,_0x2bee6f['error'][_0xb88f('0x13')]);return _0x72664(_0x2bee6f['error'][_0xb88f('0x13')]);}logger[_0xb88f('0x10')](_0xb88f('0x12'),_0xc72e7d,_0x2bee6f['error'][_0xb88f('0x13')]);return _0x222952(_0x2bee6f['error']['message']);}else{logger[_0xb88f('0xc')](_0xb88f('0x12'),_0xc72e7d,'request\x20sent');_0x222952(_0x2bee6f['result'][_0xb88f('0x13')]);}})[_0xb88f('0x14')](function(_0x4c9ca8){logger[_0xb88f('0x10')](_0xb88f('0x12'),_0xc72e7d,_0x4c9ca8);_0x72664(_0x4c9ca8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index ed70a2f..a5a7ad3 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 _0x6b42=['index','get','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','./intSalesforceField.controller','isAuthenticated'];(function(_0x16e269,_0x325304){var _0x51a619=function(_0x1cce98){while(--_0x1cce98){_0x16e269['push'](_0x16e269['shift']());}};_0x51a619(++_0x325304);}(_0x6b42,0x1ca));var _0x26b4=function(_0x4a0021,_0x2dcf7f){_0x4a0021=_0x4a0021-0x0;var _0x588536=_0x6b42[_0x4a0021];return _0x588536;};'use strict';var multer=require('multer');var util=require(_0x26b4('0x0'));var path=require('path');var timeout=require(_0x26b4('0x1'));var express=require(_0x26b4('0x2'));var router=express[_0x26b4('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x26b4('0x4'));router['get']('/',auth[_0x26b4('0x5')](),controller[_0x26b4('0x6')]);router[_0x26b4('0x7')](_0x26b4('0x8'),auth['isAuthenticated'](),controller[_0x26b4('0x9')]);router['post']('/',auth[_0x26b4('0x5')](),controller[_0x26b4('0xa')]);router[_0x26b4('0xb')](_0x26b4('0x8'),auth[_0x26b4('0x5')](),controller[_0x26b4('0xc')]);router[_0x26b4('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x26b4('0xe')]);module[_0x26b4('0xf')]=router; \ No newline at end of file +var _0xa80c=['delete','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','index','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x282a1f,_0x49a6ef){var _0x296ea7=function(_0x4bac68){while(--_0x4bac68){_0x282a1f['push'](_0x282a1f['shift']());}};_0x296ea7(++_0x49a6ef);}(_0xa80c,0x151));var _0xca80=function(_0x479b6b,_0x267866){_0x479b6b=_0x479b6b-0x0;var _0x3ce2e1=_0xa80c[_0x479b6b];return _0x3ce2e1;};'use strict';var multer=require('multer');var util=require(_0xca80('0x0'));var path=require(_0xca80('0x1'));var timeout=require(_0xca80('0x2'));var express=require('express');var router=express[_0xca80('0x3')]();var auth=require(_0xca80('0x4'));var interaction=require(_0xca80('0x5'));var config=require('../../config/environment');var controller=require(_0xca80('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xca80('0x7')]);router[_0xca80('0x8')](_0xca80('0x9'),auth[_0xca80('0xa')](),controller[_0xca80('0xb')]);router[_0xca80('0xc')]('/',auth['isAuthenticated'](),controller[_0xca80('0xd')]);router[_0xca80('0xe')]('/:id',auth[_0xca80('0xa')](),controller['update']);router[_0xca80('0xf')]('/:id',auth[_0xca80('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index d7f6bd3..732a5db 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 _0xedd9=['customVariable','keyValue','picklist','STRING','exports','ENUM','string','variable'];(function(_0x24deaa,_0xe780f7){var _0x7eb552=function(_0x18756a){while(--_0x18756a){_0x24deaa['push'](_0x24deaa['shift']());}};_0x7eb552(++_0xe780f7);}(_0xedd9,0xfc));var _0x9edd=function(_0x22037b,_0x429d16){_0x22037b=_0x22037b-0x0;var _0x417117=_0xedd9[_0x22037b];return _0x417117;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'type':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2'),_0x9edd('0x3'),_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'defaultValue':_0x9edd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9edd('0x7')]},'keyType':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2'),_0x9edd('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9edd('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xcb91=['string','variable','customVariable','picklist','STRING','ENUM'];(function(_0x10d019,_0x5adb64){var _0x20a29a=function(_0x4cf95a){while(--_0x4cf95a){_0x10d019['push'](_0x10d019['shift']());}};_0x20a29a(++_0x5adb64);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0xcb91[_0x492af5];return _0x59f529;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1cb9('0x0')](_0x1cb9('0x1'),_0x1cb9('0x2'),_0x1cb9('0x3'),'keyValue',_0x1cb9('0x4')),'defaultValue':_0x1cb9('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1cb9('0x5')]},'keyType':{'type':Sequelize[_0x1cb9('0x0')]('string',_0x1cb9('0x2'),_0x1cb9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1cb9('0x5')]},'variableName':{'type':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index a5d292c..cd016e1 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 _0x881e=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','reject','update','then','destroy','error','stack','name','send','index','map','SalesforceField','type','key','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','model','rawAttributes','filters','intersection','options','create','body','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x1bc4a7,_0x318650){var _0x470158=function(_0xfec72){while(--_0xfec72){_0x1bc4a7['push'](_0x1bc4a7['shift']());}};_0x470158(++_0x318650);}(_0x881e,0x1dc));var _0xe881=function(_0x236209,_0x51b840){_0x236209=_0x236209-0x0;var _0x2afd5b=_0x881e[_0x236209];return _0x2afd5b;};'use strict';var pdf=require(_0xe881('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe881('0x1'));var zipdir=require(_0xe881('0x2'));var jsonpatch=require(_0xe881('0x3'));var rp=require(_0xe881('0x4'));var moment=require(_0xe881('0x5'));var BPromise=require(_0xe881('0x6'));var Mustache=require(_0xe881('0x7'));var util=require(_0xe881('0x8'));var path=require(_0xe881('0x9'));var sox=require(_0xe881('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe881('0xb'));var squel=require(_0xe881('0xc'));var crypto=require(_0xe881('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe881('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe881('0xf'));var Redis=require('ioredis');var authService=require(_0xe881('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe881('0x11'));var hardwareService=require(_0xe881('0x12'));var logger=require(_0xe881('0x13'))('api');var utils=require(_0xe881('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe881('0x15'));var db=require(_0xe881('0x16'))['db'];function respondWithStatusCode(_0x16aa72,_0x440f80){_0x440f80=_0x440f80||0xcc;return function(_0x227d86){if(_0x227d86){return _0x16aa72[_0xe881('0x17')](_0x440f80);}return _0x16aa72[_0xe881('0x18')](_0x440f80)[_0xe881('0x19')]();};}function respondWithResult(_0xa7ba23,_0x433a4b){_0x433a4b=_0x433a4b||0xc8;return function(_0x4c471b){if(_0x4c471b){return _0xa7ba23['status'](_0x433a4b)[_0xe881('0x1a')](_0x4c471b);}};}function respondWithFilteredResult(_0x423027,_0x48ec22){return function(_0x398137){if(_0x398137){var _0x4d3078=_0x398137['count'],_0x10dbc7=_0x48ec22[_0xe881('0x1b')],_0xdf5032=_0x48ec22[_0xe881('0x1b')]+_0x48ec22[_0xe881('0x1c')],_0x969003;if(_0xdf5032>=_0x4d3078){_0xdf5032=_0x4d3078;_0x969003=0xc8;}else{_0x969003=0xce;}_0x423027[_0xe881('0x18')](_0x969003);return _0x423027['set']('Content-Range',_0x10dbc7+'-'+_0xdf5032+'/'+_0x4d3078)['json'](_0x398137);}return null;};}function patchUpdates(_0x50c6c2){return function(_0x5d8a4e){try{jsonpatch['apply'](_0x5d8a4e,_0x50c6c2,!![]);}catch(_0x3a8b06){return BPromise[_0xe881('0x1d')](_0x3a8b06);}return _0x5d8a4e['save']();};}function saveUpdates(_0x18df18,_0x28f368){return function(_0x56b7b8){if(_0x56b7b8){return _0x56b7b8[_0xe881('0x1e')](_0x18df18)[_0xe881('0x1f')](function(_0x18c1a0){return _0x18c1a0;});}return null;};}function removeEntity(_0x316af7,_0x247eef){return function(_0x53af9d){if(_0x53af9d){return _0x53af9d[_0xe881('0x20')]()[_0xe881('0x1f')](function(){_0x316af7[_0xe881('0x18')](0xcc)[_0xe881('0x19')]();});}};}function handleEntityNotFound(_0x5d8094,_0x59e41b){return function(_0xd058db){if(!_0xd058db){_0x5d8094[_0xe881('0x17')](0x194);}return _0xd058db;};}function handleError(_0x27d607,_0x5b46fa){_0x5b46fa=_0x5b46fa||0x1f4;return function(_0x49eab3){logger[_0xe881('0x21')](_0x49eab3[_0xe881('0x22')]);if(_0x49eab3[_0xe881('0x23')]){delete _0x49eab3[_0xe881('0x23')];}_0x27d607[_0xe881('0x18')](_0x5b46fa)[_0xe881('0x24')](_0x49eab3);};}exports[_0xe881('0x25')]=function(_0x351a68,_0x2dcf80){var _0x3caa1e={},_0x51963d={},_0x2b37c9={'count':0x0,'rows':[]};var _0x2e449e=_[_0xe881('0x26')](db[_0xe881('0x27')]['rawAttributes'],function(_0x4ea994){return{'name':_0x4ea994['fieldName'],'type':_0x4ea994[_0xe881('0x28')][_0xe881('0x29')]};});_0x51963d['model']=_['map'](_0x2e449e,_0xe881('0x23'));_0x51963d[_0xe881('0x2a')]=_[_0xe881('0x2b')](_0x351a68[_0xe881('0x2a')]);_0x51963d['filters']=_['intersection'](_0x51963d['model'],_0x51963d[_0xe881('0x2a')]);_0x3caa1e[_0xe881('0x2c')]=_['intersection'](_0x51963d['model'],qs[_0xe881('0x2d')](_0x351a68['query']['fields']));_0x3caa1e['attributes']=_0x3caa1e[_0xe881('0x2c')][_0xe881('0x2e')]?_0x3caa1e[_0xe881('0x2c')]:_0x51963d['model'];if(!_0x351a68[_0xe881('0x2a')][_0xe881('0x2f')](_0xe881('0x30'))){_0x3caa1e[_0xe881('0x1c')]=qs[_0xe881('0x1c')](_0x351a68[_0xe881('0x2a')][_0xe881('0x1c')]);_0x3caa1e[_0xe881('0x1b')]=qs['offset'](_0x351a68[_0xe881('0x2a')][_0xe881('0x1b')]);}_0x3caa1e[_0xe881('0x31')]=qs[_0xe881('0x32')](_0x351a68[_0xe881('0x2a')][_0xe881('0x32')]);_0x3caa1e[_0xe881('0x33')]=qs['filters'](_[_0xe881('0x34')](_0x351a68[_0xe881('0x2a')],_0x51963d['filters']),_0x2e449e);if(_0x351a68[_0xe881('0x2a')]['filter']){_0x3caa1e[_0xe881('0x33')]=_[_0xe881('0x35')](_0x3caa1e[_0xe881('0x33')],{'$or':_[_0xe881('0x26')](_0x2e449e,function(_0xa283ed){if(_0xa283ed[_0xe881('0x28')]!==_0xe881('0x36')){var _0x40ad0e={};_0x40ad0e[_0xa283ed[_0xe881('0x23')]]={'$like':'%'+_0x351a68['query'][_0xe881('0x37')]+'%'};return _0x40ad0e;}})});}_0x3caa1e=_[_0xe881('0x35')]({},_0x3caa1e,_0x351a68['options']);var _0x21dd13={'where':_0x3caa1e[_0xe881('0x33')]};return db['SalesforceField']['count'](_0x21dd13)['then'](function(_0x2c40e6){_0x2b37c9['count']=_0x2c40e6;if(_0x351a68['query'][_0xe881('0x38')]){_0x3caa1e[_0xe881('0x39')]=[{'all':!![]}];}return db[_0xe881('0x27')][_0xe881('0x3a')](_0x3caa1e);})['then'](function(_0x33d9ab){_0x2b37c9[_0xe881('0x3b')]=_0x33d9ab;return _0x2b37c9;})['then'](respondWithFilteredResult(_0x2dcf80,_0x3caa1e))[_0xe881('0x3c')](handleError(_0x2dcf80,null));};exports[_0xe881('0x3d')]=function(_0x52ba80,_0x55d103){var _0x13468d={'raw':!![],'where':{'id':_0x52ba80['params']['id']}},_0x306424={};_0x306424[_0xe881('0x3e')]=_[_0xe881('0x2b')](db[_0xe881('0x27')][_0xe881('0x3f')]);_0x306424[_0xe881('0x2a')]=_[_0xe881('0x2b')](_0x52ba80['query']);_0x306424[_0xe881('0x40')]=_[_0xe881('0x41')](_0x306424[_0xe881('0x3e')],_0x306424['query']);_0x13468d[_0xe881('0x2c')]=_[_0xe881('0x41')](_0x306424[_0xe881('0x3e')],qs[_0xe881('0x2d')](_0x52ba80[_0xe881('0x2a')][_0xe881('0x2d')]));_0x13468d[_0xe881('0x2c')]=_0x13468d[_0xe881('0x2c')][_0xe881('0x2e')]?_0x13468d[_0xe881('0x2c')]:_0x306424[_0xe881('0x3e')];if(_0x52ba80['query'][_0xe881('0x38')]){_0x13468d['include']=[{'all':!![]}];}_0x13468d=_[_0xe881('0x35')]({},_0x13468d,_0x52ba80[_0xe881('0x42')]);return db[_0xe881('0x27')]['find'](_0x13468d)[_0xe881('0x1f')](handleEntityNotFound(_0x55d103,null))['then'](respondWithResult(_0x55d103,null))[_0xe881('0x3c')](handleError(_0x55d103,null));};exports[_0xe881('0x43')]=function(_0x4fbb79,_0x4accb1){return db[_0xe881('0x27')][_0xe881('0x43')](_0x4fbb79[_0xe881('0x44')],{})[_0xe881('0x1f')](respondWithResult(_0x4accb1,0xc9))[_0xe881('0x3c')](handleError(_0x4accb1,null));};exports['update']=function(_0x1ca09e,_0x862b15){if(_0x1ca09e[_0xe881('0x44')]['id']){delete _0x1ca09e[_0xe881('0x44')]['id'];}return db[_0xe881('0x27')][_0xe881('0x45')]({'where':{'id':_0x1ca09e[_0xe881('0x46')]['id']}})['then'](handleEntityNotFound(_0x862b15,null))[_0xe881('0x1f')](saveUpdates(_0x1ca09e[_0xe881('0x44')],null))[_0xe881('0x1f')](respondWithResult(_0x862b15,null))[_0xe881('0x3c')](handleError(_0x862b15,null));};exports['destroy']=function(_0x2d7ac1,_0x2c356d){return db['SalesforceField'][_0xe881('0x45')]({'where':{'id':_0x2d7ac1['params']['id']}})[_0xe881('0x1f')](handleEntityNotFound(_0x2c356d,null))[_0xe881('0x1f')](removeEntity(_0x2c356d,null))[_0xe881('0x3c')](handleError(_0x2c356d,null));}; \ No newline at end of file +var _0xc90c=['status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','SalesforceField','includeAll','findAll','rows','catch','show','params','length','include','options','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x13efa5,_0x2ceea9){var _0x3656ed=function(_0x8633d3){while(--_0x8633d3){_0x13efa5['push'](_0x13efa5['shift']());}};_0x3656ed(++_0x2ceea9);}(_0xc90c,0x78));var _0xcc90=function(_0x5cc525,_0x3e081c){_0x5cc525=_0x5cc525-0x0;var _0x2dcede=_0xc90c[_0x5cc525];return _0x2dcede;};'use strict';var pdf=require(_0xcc90('0x0'));var emlformat=require(_0xcc90('0x1'));var rimraf=require(_0xcc90('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc90('0x3'));var rp=require('request-promise');var moment=require(_0xcc90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcc90('0x5'));var util=require(_0xcc90('0x6'));var path=require(_0xcc90('0x7'));var sox=require(_0xcc90('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xcc90('0x9'));var squel=require(_0xcc90('0xa'));var crypto=require(_0xcc90('0xb'));var jsforce=require(_0xcc90('0xc'));var deskjs=require(_0xcc90('0xd'));var toCsv=require(_0xcc90('0xe'));var querystring=require(_0xcc90('0xf'));var Papa=require(_0xcc90('0x10'));var Redis=require(_0xcc90('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcc90('0x12'));var as=require(_0xcc90('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc90('0x14'))(_0xcc90('0x15'));var utils=require(_0xcc90('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcc90('0x17'));var db=require(_0xcc90('0x18'))['db'];function respondWithStatusCode(_0x515992,_0x487c42){_0x487c42=_0x487c42||0xcc;return function(_0x12d394){if(_0x12d394){return _0x515992[_0xcc90('0x19')](_0x487c42);}return _0x515992[_0xcc90('0x1a')](_0x487c42)[_0xcc90('0x1b')]();};}function respondWithResult(_0x1b3e6a,_0x188427){_0x188427=_0x188427||0xc8;return function(_0x2e8c4d){if(_0x2e8c4d){return _0x1b3e6a['status'](_0x188427)[_0xcc90('0x1c')](_0x2e8c4d);}};}function respondWithFilteredResult(_0x493fb4,_0x2f5557){return function(_0x4f8b7a){if(_0x4f8b7a){var _0x3b9b05=_0x4f8b7a[_0xcc90('0x1d')],_0xd64473=_0x2f5557[_0xcc90('0x1e')],_0x49c0b2=_0x2f5557['offset']+_0x2f5557[_0xcc90('0x1f')],_0x408a47;if(_0x49c0b2>=_0x3b9b05){_0x49c0b2=_0x3b9b05;_0x408a47=0xc8;}else{_0x408a47=0xce;}_0x493fb4[_0xcc90('0x1a')](_0x408a47);return _0x493fb4['set'](_0xcc90('0x20'),_0xd64473+'-'+_0x49c0b2+'/'+_0x3b9b05)['json'](_0x4f8b7a);}return null;};}function patchUpdates(_0x4bbc61){return function(_0x1ab640){try{jsonpatch['apply'](_0x1ab640,_0x4bbc61,!![]);}catch(_0x2717e9){return BPromise[_0xcc90('0x21')](_0x2717e9);}return _0x1ab640[_0xcc90('0x22')]();};}function saveUpdates(_0x5b1aee,_0x1becca){return function(_0x63aeef){if(_0x63aeef){return _0x63aeef[_0xcc90('0x23')](_0x5b1aee)[_0xcc90('0x24')](function(_0x46d2c2){return _0x46d2c2;});}return null;};}function removeEntity(_0x4cf25b,_0x5cd68a){return function(_0xf6e233){if(_0xf6e233){return _0xf6e233[_0xcc90('0x25')]()[_0xcc90('0x24')](function(){_0x4cf25b['status'](0xcc)[_0xcc90('0x1b')]();});}};}function handleEntityNotFound(_0x3e5dc1,_0x4f2d62){return function(_0x394c21){if(!_0x394c21){_0x3e5dc1[_0xcc90('0x19')](0x194);}return _0x394c21;};}function handleError(_0x4538f2,_0x2fc870){_0x2fc870=_0x2fc870||0x1f4;return function(_0x187924){logger[_0xcc90('0x26')](_0x187924[_0xcc90('0x27')]);if(_0x187924[_0xcc90('0x28')]){delete _0x187924['name'];}_0x4538f2[_0xcc90('0x1a')](_0x2fc870)[_0xcc90('0x29')](_0x187924);};}exports['index']=function(_0xfc72a2,_0x391412){var _0x14d731={},_0x244ffb={},_0x45ff9c={'count':0x0,'rows':[]};var _0x4d4711=_[_0xcc90('0x2a')](db['SalesforceField'][_0xcc90('0x2b')],function(_0x5a3625){return{'name':_0x5a3625[_0xcc90('0x2c')],'type':_0x5a3625[_0xcc90('0x2d')][_0xcc90('0x2e')]};});_0x244ffb['model']=_[_0xcc90('0x2a')](_0x4d4711,_0xcc90('0x28'));_0x244ffb[_0xcc90('0x2f')]=_[_0xcc90('0x30')](_0xfc72a2[_0xcc90('0x2f')]);_0x244ffb['filters']=_['intersection'](_0x244ffb[_0xcc90('0x31')],_0x244ffb[_0xcc90('0x2f')]);_0x14d731[_0xcc90('0x32')]=_[_0xcc90('0x33')](_0x244ffb[_0xcc90('0x31')],qs['fields'](_0xfc72a2[_0xcc90('0x2f')][_0xcc90('0x34')]));_0x14d731['attributes']=_0x14d731[_0xcc90('0x32')]['length']?_0x14d731[_0xcc90('0x32')]:_0x244ffb[_0xcc90('0x31')];if(!_0xfc72a2[_0xcc90('0x2f')][_0xcc90('0x35')]('nolimit')){_0x14d731['limit']=qs[_0xcc90('0x1f')](_0xfc72a2['query'][_0xcc90('0x1f')]);_0x14d731[_0xcc90('0x1e')]=qs[_0xcc90('0x1e')](_0xfc72a2['query']['offset']);}_0x14d731['order']=qs[_0xcc90('0x36')](_0xfc72a2['query'][_0xcc90('0x36')]);_0x14d731[_0xcc90('0x37')]=qs[_0xcc90('0x38')](_[_0xcc90('0x39')](_0xfc72a2['query'],_0x244ffb['filters']),_0x4d4711);if(_0xfc72a2[_0xcc90('0x2f')]['filter']){_0x14d731[_0xcc90('0x37')]=_[_0xcc90('0x3a')](_0x14d731[_0xcc90('0x37')],{'$or':_['map'](_0x4d4711,function(_0x1585fa){if(_0x1585fa[_0xcc90('0x2d')]!==_0xcc90('0x3b')){var _0x39bc22={};_0x39bc22[_0x1585fa[_0xcc90('0x28')]]={'$like':'%'+_0xfc72a2[_0xcc90('0x2f')]['filter']+'%'};return _0x39bc22;}})});}_0x14d731=_[_0xcc90('0x3a')]({},_0x14d731,_0xfc72a2['options']);var _0xd86a3c={'where':_0x14d731[_0xcc90('0x37')]};return db[_0xcc90('0x3c')][_0xcc90('0x1d')](_0xd86a3c)[_0xcc90('0x24')](function(_0x2466bb){_0x45ff9c[_0xcc90('0x1d')]=_0x2466bb;if(_0xfc72a2[_0xcc90('0x2f')][_0xcc90('0x3d')]){_0x14d731['include']=[{'all':!![]}];}return db[_0xcc90('0x3c')][_0xcc90('0x3e')](_0x14d731);})[_0xcc90('0x24')](function(_0xd66061){_0x45ff9c[_0xcc90('0x3f')]=_0xd66061;return _0x45ff9c;})[_0xcc90('0x24')](respondWithFilteredResult(_0x391412,_0x14d731))[_0xcc90('0x40')](handleError(_0x391412,null));};exports[_0xcc90('0x41')]=function(_0x47ab8e,_0x81902){var _0x2c789d={'raw':!![],'where':{'id':_0x47ab8e[_0xcc90('0x42')]['id']}},_0x12ebd6={};_0x12ebd6['model']=_[_0xcc90('0x30')](db[_0xcc90('0x3c')]['rawAttributes']);_0x12ebd6['query']=_[_0xcc90('0x30')](_0x47ab8e['query']);_0x12ebd6[_0xcc90('0x38')]=_[_0xcc90('0x33')](_0x12ebd6[_0xcc90('0x31')],_0x12ebd6[_0xcc90('0x2f')]);_0x2c789d[_0xcc90('0x32')]=_[_0xcc90('0x33')](_0x12ebd6[_0xcc90('0x31')],qs[_0xcc90('0x34')](_0x47ab8e[_0xcc90('0x2f')][_0xcc90('0x34')]));_0x2c789d['attributes']=_0x2c789d[_0xcc90('0x32')][_0xcc90('0x43')]?_0x2c789d[_0xcc90('0x32')]:_0x12ebd6[_0xcc90('0x31')];if(_0x47ab8e[_0xcc90('0x2f')][_0xcc90('0x3d')]){_0x2c789d[_0xcc90('0x44')]=[{'all':!![]}];}_0x2c789d=_['merge']({},_0x2c789d,_0x47ab8e[_0xcc90('0x45')]);return db[_0xcc90('0x3c')]['find'](_0x2c789d)[_0xcc90('0x24')](handleEntityNotFound(_0x81902,null))[_0xcc90('0x24')](respondWithResult(_0x81902,null))[_0xcc90('0x40')](handleError(_0x81902,null));};exports[_0xcc90('0x46')]=function(_0x38a863,_0x58ffa8){return db[_0xcc90('0x3c')][_0xcc90('0x46')](_0x38a863['body'],{})[_0xcc90('0x24')](respondWithResult(_0x58ffa8,0xc9))[_0xcc90('0x40')](handleError(_0x58ffa8,null));};exports[_0xcc90('0x23')]=function(_0x3a73cb,_0x974775){if(_0x3a73cb[_0xcc90('0x47')]['id']){delete _0x3a73cb['body']['id'];}return db['SalesforceField'][_0xcc90('0x48')]({'where':{'id':_0x3a73cb[_0xcc90('0x42')]['id']}})[_0xcc90('0x24')](handleEntityNotFound(_0x974775,null))[_0xcc90('0x24')](saveUpdates(_0x3a73cb[_0xcc90('0x47')],null))[_0xcc90('0x24')](respondWithResult(_0x974775,null))['catch'](handleError(_0x974775,null));};exports[_0xcc90('0x25')]=function(_0x46ef3e,_0x95c3bd){return db[_0xcc90('0x3c')][_0xcc90('0x48')]({'where':{'id':_0x46ef3e[_0xcc90('0x42')]['id']}})[_0xcc90('0x24')](handleEntityNotFound(_0x95c3bd,null))[_0xcc90('0x24')](removeEntity(_0x95c3bd,null))[_0xcc90('0x40')](handleError(_0x95c3bd,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index f7833af..32b42eb 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 _0xb2e3=['rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3e52d4,_0x1309ad){var _0x35d434=function(_0x3e4a30){while(--_0x3e4a30){_0x3e52d4['push'](_0x3e52d4['shift']());}};_0x35d434(++_0x1309ad);}(_0xb2e3,0xf9));var _0x3b2e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xb2e3[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x3b2e('0x0'));var util=require(_0x3b2e('0x1'));var logger=require(_0x3b2e('0x2'))(_0x3b2e('0x3'));var moment=require(_0x3b2e('0x4'));var BPromise=require(_0x3b2e('0x5'));var rp=require(_0x3b2e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b2e('0x7'));var config=require(_0x3b2e('0x8'));var attributes=require(_0x3b2e('0x9'));module[_0x3b2e('0xa')]=function(_0x1c0672,_0x44a2f2){return _0x1c0672['define'](_0x3b2e('0xb'),attributes,{'tableName':_0x3b2e('0xc'),'paranoid':![],'indexes':[{'name':_0x3b2e('0xd'),'fields':[_0x3b2e('0xe'),_0x3b2e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4832=['salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','int_salesforce_fields'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x4832,0x183));var _0x2483=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x4832[_0x95942];return _0x6d7f81;};'use strict';var _=require(_0x2483('0x0'));var util=require('util');var logger=require(_0x2483('0x1'))(_0x2483('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2483('0x3'));var fs=require('fs');var path=require(_0x2483('0x4'));var rimraf=require(_0x2483('0x5'));var config=require(_0x2483('0x6'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x178e0a,_0x3685e0){return _0x178e0a[_0x2483('0x7')]('SalesforceField',attributes,{'tableName':_0x2483('0x8'),'paranoid':![],'indexes':[{'name':_0x2483('0x9'),'fields':[_0x2483('0xa'),_0x2483('0xb')],'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 d83a0f8..dfd3051 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 _0x70e0=['code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x6af681,_0x40772b){var _0x3d2eee=function(_0x57a6e7){while(--_0x57a6e7){_0x6af681['push'](_0x6af681['shift']());}};_0x3d2eee(++_0x40772b);}(_0x70e0,0x17b));var _0x070e=function(_0x2a98c4,_0x3b5c89){_0x2a98c4=_0x2a98c4-0x0;var _0x5e03c8=_0x70e0[_0x2a98c4];return _0x5e03c8;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('SalesforceField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('SalesforceField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x4483=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x812319,_0x2e3508){var _0xeeb857=function(_0x1af992){while(--_0x1af992){_0x812319['push'](_0x812319['shift']());}};_0xeeb857(++_0x2e3508);}(_0x4483,0x1a3));var _0x3448=function(_0xf98854,_0x8abe4c){_0xf98854=_0xf98854-0x0;var _0x456f98=_0x4483[_0xf98854];return _0x456f98;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var BPromise=require('bluebird');var rs=require(_0x3448('0x3'));var fs=require('fs');var Redis=require(_0x3448('0x4'));var db=require(_0x3448('0x5'))['db'];var utils=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('rpc');var config=require(_0x3448('0x8'));var jayson=require(_0x3448('0x9'));var client=jayson[_0x3448('0xa')][_0x3448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb7e5,_0x2caa81,_0x3cc81d){return new BPromise(function(_0x34b926,_0x5923ee){return client['request'](_0x1bb7e5,_0x3cc81d)[_0x3448('0xc')](function(_0x25c152){logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,_0x3448('0xf'));logger[_0x3448('0x10')](_0x3448('0x11'),_0x2caa81,_0x3448('0xf'),JSON[_0x3448('0x12')](_0x25c152));if(_0x25c152[_0x3448('0x13')]){if(_0x25c152[_0x3448('0x13')]['code']===0x1f4){logger['error'](_0x3448('0xe'),_0x2caa81,_0x25c152[_0x3448('0x13')]['message']);return _0x5923ee(_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);}logger[_0x3448('0x13')]('SalesforceField,\x20%s,\x20%s',_0x2caa81,_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);return _0x34b926(_0x25c152['error'][_0x3448('0x14')]);}else{logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,'request\x20sent');_0x34b926(_0x25c152[_0x3448('0x15')][_0x3448('0x14')]);}})[_0x3448('0x16')](function(_0x30f8dd){logger[_0x3448('0x13')](_0x3448('0xe'),_0x2caa81,_0x30f8dd);_0x5923ee(_0x30f8dd);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ebb21e7..b77485a 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 _0xa209=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration'];(function(_0x188741,_0x243906){var _0x5e9290=function(_0x90f20a){while(--_0x90f20a){_0x188741['push'](_0x188741['shift']());}};_0x5e9290(++_0x243906);}(_0xa209,0xb6));var _0x9a20=function(_0x342c97,_0x204437){_0x342c97=_0x342c97-0x0;var _0x1bdde4=_0xa209[_0x342c97];return _0x1bdde4;};'use strict';var multer=require(_0x9a20('0x0'));var util=require(_0x9a20('0x1'));var path=require(_0x9a20('0x2'));var timeout=require(_0x9a20('0x3'));var express=require('express');var router=express[_0x9a20('0x4')]();var auth=require(_0x9a20('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a20('0x6'));router[_0x9a20('0x7')]('/',auth[_0x9a20('0x8')](),controller[_0x9a20('0x9')]);router[_0x9a20('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9a20('0xa')]);router['get'](_0x9a20('0xb'),auth[_0x9a20('0x8')](),controller[_0x9a20('0xc')]);router[_0x9a20('0x7')](_0x9a20('0xd'),auth[_0x9a20('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9a20('0xe')](_0x9a20('0xb'),auth['isAuthenticated'](),controller[_0x9a20('0xf')]);router[_0x9a20('0x10')](_0x9a20('0x11'),auth[_0x9a20('0x8')](),controller[_0x9a20('0x12')]);router[_0x9a20('0x13')](_0x9a20('0x11'),auth['isAuthenticated'](),controller[_0x9a20('0x14')]);module[_0x9a20('0x15')]=router; \ No newline at end of file +var _0x8a2a=['getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x59a549,_0x2fe2bb){var _0x12adbe=function(_0x2ccd1e){while(--_0x2ccd1e){_0x59a549['push'](_0x59a549['shift']());}};_0x12adbe(++_0x2fe2bb);}(_0x8a2a,0x11f));var _0xa8a2=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8a2a[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0xa8a2('0x0'));var path=require(_0xa8a2('0x1'));var timeout=require(_0xa8a2('0x2'));var express=require(_0xa8a2('0x3'));var router=express[_0xa8a2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa8a2('0x5'));var config=require(_0xa8a2('0x6'));var controller=require(_0xa8a2('0x7'));router[_0xa8a2('0x8')]('/',auth[_0xa8a2('0x9')](),controller[_0xa8a2('0xa')]);router[_0xa8a2('0x8')](_0xa8a2('0xb'),auth['isAuthenticated'](),controller[_0xa8a2('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xa8a2('0xd')]);router[_0xa8a2('0x8')](_0xa8a2('0xe'),auth['isAuthenticated'](),controller[_0xa8a2('0xf')]);router[_0xa8a2('0x10')]('/',auth[_0xa8a2('0x9')](),controller[_0xa8a2('0x11')]);router[_0xa8a2('0x10')](_0xa8a2('0x12'),auth['isAuthenticated'](),controller[_0xa8a2('0x13')]);router[_0xa8a2('0x14')](_0xa8a2('0xb'),auth['isAuthenticated'](),controller[_0xa8a2('0x15')]);router[_0xa8a2('0x16')](_0xa8a2('0xb'),auth[_0xa8a2('0x9')](),controller[_0xa8a2('0x17')]);module[_0xa8a2('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index e118d31..c8db9be 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 _0x5aa6=['STRING','username','remoteUri','sequelize','exports'];(function(_0x5a1f10,_0x38f482){var _0x4d2d11=function(_0x3a5cd3){while(--_0x3a5cd3){_0x5a1f10['push'](_0x5a1f10['shift']());}};_0x4d2d11(++_0x38f482);}(_0x5aa6,0x1b1));var _0x65aa=function(_0x19f541,_0x84c083){_0x19f541=_0x19f541-0x0;var _0x1af7b8=_0x5aa6[_0x19f541];return _0x1af7b8;};'use strict';var Sequelize=require(_0x65aa('0x0'));module[_0x65aa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x65aa('0x2')]},'username':{'type':Sequelize[_0x65aa('0x2')],'unique':_0x65aa('0x3')},'password':{'type':Sequelize[_0x65aa('0x2')]},'email':{'type':Sequelize[_0x65aa('0x2')]},'remoteUri':{'type':Sequelize[_0x65aa('0x2')],'unique':_0x65aa('0x4')},'serverUrl':{'type':Sequelize[_0x65aa('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb0f0=['exports','STRING','username','sequelize'];(function(_0x436854,_0x156c23){var _0x48cdaa=function(_0x37e80f){while(--_0x37e80f){_0x436854['push'](_0x436854['shift']());}};_0x48cdaa(++_0x156c23);}(_0xb0f0,0xbf));var _0x0b0f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb0f0[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x0b0f('0x0'));module[_0x0b0f('0x1')]={'name':{'type':Sequelize[_0x0b0f('0x2')]},'description':{'type':Sequelize[_0x0b0f('0x2')]},'username':{'type':Sequelize[_0x0b0f('0x2')],'unique':_0x0b0f('0x3')},'password':{'type':Sequelize[_0x0b0f('0x2')]},'email':{'type':Sequelize[_0x0b0f('0x2')]},'remoteUri':{'type':Sequelize[_0x0b0f('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0b0f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 1ab6101..661402f 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 _0xd660=['ServicenowAccount','includeAll','include','rows','show','params','length','find','create','body','destroy','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','channel','Descriptions','getDescriptions','Subjects','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','incident_state','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','sys_updated_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','priority','sys_domain_path','rfc','expected_start','opened_at','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','notify','sys_class_name','closed_by','sys_id','contact_type','urgency','reassignment_count','activity_due','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','username','email','serverUrl','remoteUri','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','log','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False','false','inactive','value','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','request\x20sent','debug','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0xd660,0x1eb));var _0x0d66=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0xd660[_0x27beea];return _0x122645;};'use strict';var pdf=require(_0x0d66('0x0'));var emlformat=require(_0x0d66('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0d66('0x2'));var rp=require(_0x0d66('0x3'));var moment=require(_0x0d66('0x4'));var BPromise=require(_0x0d66('0x5'));var Mustache=require(_0x0d66('0x6'));var util=require(_0x0d66('0x7'));var path=require(_0x0d66('0x8'));var sox=require(_0x0d66('0x9'));var csv=require(_0x0d66('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0d66('0xb'));var squel=require('squel');var crypto=require(_0x0d66('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0d66('0xd'));var toCsv=require(_0x0d66('0xa'));var querystring=require(_0x0d66('0xe'));var Papa=require(_0x0d66('0xf'));var Redis=require(_0x0d66('0x10'));var authService=require(_0x0d66('0x11'));var qs=require(_0x0d66('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d66('0x13'));var logger=require(_0x0d66('0x14'))(_0x0d66('0x15'));var utils=require('../../config/utils');var config=require(_0x0d66('0x16'));var licenseUtil=require(_0x0d66('0x17'));var db=require(_0x0d66('0x18'))['db'];var integrations=require(_0x0d66('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x0d66('0x1a')][_0x0d66('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x160355,_0x369c31,_0x23341b,_0x3c250c){return new BPromise(function(_0x11b5c3,_0x9bd85d){var _0x20f40e=_0x3c250c||client;return _0x20f40e[_0x0d66('0x1c')](_0x160355,_0x23341b)[_0x0d66('0x1d')](function(_0x42a77a){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x369c31,_0x0d66('0x1e'));logger[_0x0d66('0x1f')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x369c31,_0x0d66('0x1e'),JSON[_0x0d66('0x20')](_0x42a77a));if(_0x42a77a[_0x0d66('0x21')]){if(_0x42a77a['error'][_0x0d66('0x22')]===0x1f4){logger['error'](_0x0d66('0x23'),_0x369c31,_0x42a77a['error']['message']);return _0x9bd85d(_0x42a77a['error'][_0x0d66('0x24')]);}logger[_0x0d66('0x21')](_0x0d66('0x23'),_0x369c31,_0x42a77a[_0x0d66('0x21')][_0x0d66('0x24')]);return _0x11b5c3(_0x42a77a['error'][_0x0d66('0x24')]);}else{logger[_0x0d66('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x369c31,_0x0d66('0x1e'));_0x11b5c3(_0x42a77a[_0x0d66('0x26')][_0x0d66('0x24')]);}})[_0x0d66('0x27')](function(_0x42e7b7){logger[_0x0d66('0x21')]('ServicenowAccount,\x20%s,\x20%s',_0x369c31,_0x42e7b7);_0x9bd85d(_0x42e7b7);});});}function respondWithStatusCode(_0x11fda0,_0x5adc7d){_0x5adc7d=_0x5adc7d||0xcc;return function(_0x3b3392){if(_0x3b3392){return _0x11fda0['sendStatus'](_0x5adc7d);}return _0x11fda0['status'](_0x5adc7d)[_0x0d66('0x28')]();};}function respondWithResult(_0x37d728,_0x1073ff){_0x1073ff=_0x1073ff||0xc8;return function(_0x3a9bf9){if(_0x3a9bf9){return _0x37d728[_0x0d66('0x29')](_0x1073ff)[_0x0d66('0x2a')](_0x3a9bf9);}};}function respondWithFilteredResult(_0x310190,_0xf6d038){return function(_0x1dc321){if(_0x1dc321){var _0x5ac33a=_0x1dc321[_0x0d66('0x2b')],_0x1d50b8=_0xf6d038['offset'],_0x411b70=_0xf6d038[_0x0d66('0x2c')]+_0xf6d038[_0x0d66('0x2d')],_0x4ae7b2;if(_0x411b70>=_0x5ac33a){_0x411b70=_0x5ac33a;_0x4ae7b2=0xc8;}else{_0x4ae7b2=0xce;}_0x310190[_0x0d66('0x29')](_0x4ae7b2);return _0x310190[_0x0d66('0x2e')](_0x0d66('0x2f'),_0x1d50b8+'-'+_0x411b70+'/'+_0x5ac33a)[_0x0d66('0x2a')](_0x1dc321);}return null;};}function patchUpdates(_0x1e012d){return function(_0x28195b){try{jsonpatch[_0x0d66('0x30')](_0x28195b,_0x1e012d,!![]);}catch(_0x42cbbd){return BPromise[_0x0d66('0x31')](_0x42cbbd);}return _0x28195b[_0x0d66('0x32')]();};}function saveUpdates(_0x2be876,_0x2b3e4c){return function(_0x3b27ab){if(_0x3b27ab){return _0x3b27ab[_0x0d66('0x33')](_0x2be876)[_0x0d66('0x1d')](function(_0xf91274){return _0xf91274;});}return null;};}function removeEntity(_0x4c6d5d,_0x43c661){return function(_0x4cee61){if(_0x4cee61){return _0x4cee61['destroy']()[_0x0d66('0x1d')](function(){_0x4c6d5d[_0x0d66('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18768e,_0xcfa3ec){return function(_0x550ad7){if(!_0x550ad7){_0x18768e[_0x0d66('0x34')](0x194);}return _0x550ad7;};}function handleError(_0x133eb3,_0x41ccfc){_0x41ccfc=_0x41ccfc||0x1f4;return function(_0x4104f2){logger[_0x0d66('0x21')](_0x4104f2[_0x0d66('0x35')]);if(_0x4104f2[_0x0d66('0x36')]){delete _0x4104f2[_0x0d66('0x36')];}_0x133eb3[_0x0d66('0x29')](_0x41ccfc)[_0x0d66('0x37')](_0x4104f2);};}exports[_0x0d66('0x38')]=function(_0x3205c5,_0x541e18){var _0x25a264={},_0x34240f={},_0x9618d9={'count':0x0,'rows':[]};var _0x57933f=_[_0x0d66('0x39')](db['ServicenowAccount'][_0x0d66('0x3a')],function(_0x35b43f){return{'name':_0x35b43f[_0x0d66('0x3b')],'type':_0x35b43f[_0x0d66('0x3c')][_0x0d66('0x3d')]};});_0x34240f[_0x0d66('0x3e')]=_['map'](_0x57933f,_0x0d66('0x36'));_0x34240f[_0x0d66('0x3f')]=_[_0x0d66('0x40')](_0x3205c5[_0x0d66('0x3f')]);_0x34240f[_0x0d66('0x41')]=_[_0x0d66('0x42')](_0x34240f['model'],_0x34240f['query']);_0x25a264[_0x0d66('0x43')]=_[_0x0d66('0x42')](_0x34240f[_0x0d66('0x3e')],qs[_0x0d66('0x44')](_0x3205c5[_0x0d66('0x3f')][_0x0d66('0x44')]));_0x25a264[_0x0d66('0x43')]=_0x25a264[_0x0d66('0x43')]['length']?_0x25a264[_0x0d66('0x43')]:_0x34240f[_0x0d66('0x3e')];if(!_0x3205c5['query'][_0x0d66('0x45')](_0x0d66('0x46'))){_0x25a264['limit']=qs[_0x0d66('0x2d')](_0x3205c5[_0x0d66('0x3f')][_0x0d66('0x2d')]);_0x25a264['offset']=qs[_0x0d66('0x2c')](_0x3205c5[_0x0d66('0x3f')][_0x0d66('0x2c')]);}_0x25a264[_0x0d66('0x47')]=qs[_0x0d66('0x48')](_0x3205c5[_0x0d66('0x3f')][_0x0d66('0x48')]);_0x25a264[_0x0d66('0x49')]=qs[_0x0d66('0x41')](_[_0x0d66('0x4a')](_0x3205c5[_0x0d66('0x3f')],_0x34240f['filters']),_0x57933f);if(_0x3205c5['query'][_0x0d66('0x4b')]){_0x25a264['where']=_[_0x0d66('0x4c')](_0x25a264['where'],{'$or':_[_0x0d66('0x39')](_0x57933f,function(_0x5dca85){if(_0x5dca85[_0x0d66('0x3c')]!==_0x0d66('0x4d')){var _0x59b83a={};_0x59b83a[_0x5dca85[_0x0d66('0x36')]]={'$like':'%'+_0x3205c5[_0x0d66('0x3f')][_0x0d66('0x4b')]+'%'};return _0x59b83a;}})});}_0x25a264=_[_0x0d66('0x4c')]({},_0x25a264,_0x3205c5[_0x0d66('0x4e')]);var _0x3a5cc7={'where':_0x25a264['where']};return db[_0x0d66('0x4f')]['count'](_0x3a5cc7)[_0x0d66('0x1d')](function(_0x5e3a8b){_0x9618d9[_0x0d66('0x2b')]=_0x5e3a8b;if(_0x3205c5[_0x0d66('0x3f')][_0x0d66('0x50')]){_0x25a264[_0x0d66('0x51')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x25a264);})[_0x0d66('0x1d')](function(_0x19391a){_0x9618d9[_0x0d66('0x52')]=_0x19391a;return _0x9618d9;})[_0x0d66('0x1d')](respondWithFilteredResult(_0x541e18,_0x25a264))[_0x0d66('0x27')](handleError(_0x541e18,null));};exports[_0x0d66('0x53')]=function(_0x5059e9,_0x3fba01){var _0x2e5b57={'raw':![],'where':{'id':_0x5059e9[_0x0d66('0x54')]['id']}},_0x15a67c={};_0x15a67c[_0x0d66('0x3e')]=_[_0x0d66('0x40')](db[_0x0d66('0x4f')][_0x0d66('0x3a')]);_0x15a67c[_0x0d66('0x3f')]=_[_0x0d66('0x40')](_0x5059e9[_0x0d66('0x3f')]);_0x15a67c[_0x0d66('0x41')]=_[_0x0d66('0x42')](_0x15a67c[_0x0d66('0x3e')],_0x15a67c[_0x0d66('0x3f')]);_0x2e5b57[_0x0d66('0x43')]=_[_0x0d66('0x42')](_0x15a67c[_0x0d66('0x3e')],qs[_0x0d66('0x44')](_0x5059e9[_0x0d66('0x3f')][_0x0d66('0x44')]));_0x2e5b57[_0x0d66('0x43')]=_0x2e5b57[_0x0d66('0x43')][_0x0d66('0x55')]?_0x2e5b57[_0x0d66('0x43')]:_0x15a67c['model'];if(_0x5059e9[_0x0d66('0x3f')][_0x0d66('0x50')]){_0x2e5b57[_0x0d66('0x51')]=[{'all':!![]}];}_0x2e5b57=_[_0x0d66('0x4c')]({},_0x2e5b57,_0x5059e9['options']);return db[_0x0d66('0x4f')][_0x0d66('0x56')](_0x2e5b57)['then'](handleEntityNotFound(_0x3fba01,null))['then'](respondWithResult(_0x3fba01,null))['catch'](handleError(_0x3fba01,null));};exports[_0x0d66('0x57')]=function(_0x3fede8,_0x7b2a14){return db['ServicenowAccount']['create'](_0x3fede8[_0x0d66('0x58')],{})[_0x0d66('0x1d')](respondWithResult(_0x7b2a14,0xc9))['catch'](handleError(_0x7b2a14,null));};exports[_0x0d66('0x33')]=function(_0x4624ac,_0x1a8f23){if(_0x4624ac['body']['id']){delete _0x4624ac['body']['id'];}return db[_0x0d66('0x4f')][_0x0d66('0x56')]({'where':{'id':_0x4624ac[_0x0d66('0x54')]['id']}})['then'](handleEntityNotFound(_0x1a8f23,null))[_0x0d66('0x1d')](saveUpdates(_0x4624ac[_0x0d66('0x58')],null))[_0x0d66('0x1d')](respondWithResult(_0x1a8f23,null))[_0x0d66('0x27')](handleError(_0x1a8f23,null));};exports[_0x0d66('0x59')]=function(_0xfefd3,_0x6a4e39){return db[_0x0d66('0x4f')][_0x0d66('0x56')]({'where':{'id':_0xfefd3[_0x0d66('0x54')]['id']}})[_0x0d66('0x1d')](handleEntityNotFound(_0x6a4e39,null))[_0x0d66('0x1d')](removeEntity(_0x6a4e39,null))[_0x0d66('0x27')](handleError(_0x6a4e39,null));};exports['getConfigurations']=function(_0x49d4e6,_0x2c02de,_0x431057){var _0xacbe48={};var _0x906797={};var _0x51a0a2;var _0x5bf75e;return db['ServicenowAccount'][_0x0d66('0x5a')]({'where':{'id':_0x49d4e6[_0x0d66('0x54')]['id']}})['then'](handleEntityNotFound(_0x2c02de,null))['then'](function(_0x27ff4b){if(_0x27ff4b){_0x51a0a2=_0x27ff4b;_0x906797[_0x0d66('0x3e')]=_[_0x0d66('0x40')](db[_0x0d66('0x5b')][_0x0d66('0x3a')]);_0x906797[_0x0d66('0x3f')]=_['keys'](_0x49d4e6[_0x0d66('0x3f')]);_0x906797[_0x0d66('0x41')]=_[_0x0d66('0x42')](_0x906797[_0x0d66('0x3e')],_0x906797[_0x0d66('0x3f')]);_0xacbe48[_0x0d66('0x43')]=_['intersection'](_0x906797[_0x0d66('0x3e')],qs[_0x0d66('0x44')](_0x49d4e6[_0x0d66('0x3f')][_0x0d66('0x44')]));_0xacbe48['attributes']=_0xacbe48[_0x0d66('0x43')]['length']?_0xacbe48[_0x0d66('0x43')]:_0x906797[_0x0d66('0x3e')];_0xacbe48[_0x0d66('0x47')]=qs[_0x0d66('0x48')](_0x49d4e6[_0x0d66('0x3f')][_0x0d66('0x48')]);_0xacbe48['where']=qs[_0x0d66('0x41')](_[_0x0d66('0x4a')](_0x49d4e6['query'],_0x906797[_0x0d66('0x41')]));if(_0x49d4e6[_0x0d66('0x3f')][_0x0d66('0x4b')]){_0xacbe48['where']=_[_0x0d66('0x4c')](_0xacbe48[_0x0d66('0x49')],{'$or':_[_0x0d66('0x39')](_0xacbe48[_0x0d66('0x43')],function(_0x4c4d5b){var _0x2c3047={};_0x2c3047[_0x4c4d5b]={'$like':'%'+_0x49d4e6[_0x0d66('0x3f')][_0x0d66('0x4b')]+'%'};return _0x2c3047;})});}_0xacbe48=_[_0x0d66('0x4c')]({},_0xacbe48,_0x49d4e6['options']);return _0x51a0a2[_0x0d66('0x5c')](_0xacbe48);}})[_0x0d66('0x1d')](function(_0x489555){if(_0x489555){_0x5bf75e=_0x489555[_0x0d66('0x55')];if(!_0x49d4e6[_0x0d66('0x3f')][_0x0d66('0x45')]('nolimit')){_0xacbe48[_0x0d66('0x2d')]=qs[_0x0d66('0x2d')](_0x49d4e6[_0x0d66('0x3f')][_0x0d66('0x2d')]);_0xacbe48[_0x0d66('0x2c')]=qs[_0x0d66('0x2c')](_0x49d4e6['query']['offset']);}return _0x51a0a2['getConfigurations'](_0xacbe48);}})[_0x0d66('0x1d')](function(_0x49c25f){if(_0x49c25f){return _0x49c25f?{'count':_0x5bf75e,'rows':_0x49c25f}:null;}})[_0x0d66('0x1d')](respondWithResult(_0x2c02de,null))[_0x0d66('0x27')](handleError(_0x2c02de,null));};exports[_0x0d66('0x5d')]=function(_0xb3aff2,_0x36b449,_0x59d9b1){if(_0xb3aff2[_0x0d66('0x58')]['id']){delete _0xb3aff2['body']['id'];}return db[_0x0d66('0x4f')][_0x0d66('0x5a')]({'where':{'id':_0xb3aff2[_0x0d66('0x54')]['id']}})[_0x0d66('0x1d')](handleEntityNotFound(_0x36b449,null))[_0x0d66('0x1d')](function(_0x1d5be4){if(_0x1d5be4){_0xb3aff2[_0x0d66('0x58')][_0x0d66('0x5e')]=_0x1d5be4['id'];_0xb3aff2[_0x0d66('0x58')]['Subjects']=integrations['getSubjects'](_0xb3aff2['body'][_0x0d66('0x5f')],_0xb3aff2['body'][_0x0d66('0x3c')]);_0xb3aff2[_0x0d66('0x58')][_0x0d66('0x60')]=integrations[_0x0d66('0x61')](_0xb3aff2[_0x0d66('0x58')][_0x0d66('0x5f')],_0xb3aff2[_0x0d66('0x58')]['type']);return db[_0x0d66('0x5b')][_0x0d66('0x57')](_0xb3aff2[_0x0d66('0x58')],{'include':[{'model':db['ServicenowField'],'as':_0x0d66('0x62')},{'model':db[_0x0d66('0x63')],'as':_0x0d66('0x60')}]});}return null;})[_0x0d66('0x1d')](respondWithResult(_0x36b449,null))[_0x0d66('0x27')](handleError(_0x36b449,null));};exports[_0x0d66('0x64')]=function(_0x3f3b26,_0x147abf,_0x1edfb0){var _0x5352a8=[_0x0d66('0x65'),_0x0d66('0x66'),_0x0d66('0x67'),_0x0d66('0x68'),'close_code','notify',_0x0d66('0x69'),'severity',_0x0d66('0x6a')];var _0x46f4f6=[_0x0d66('0x6b'),_0x0d66('0x65'),_0x0d66('0x6c'),_0x0d66('0x6d'),_0x0d66('0x6e'),'sys_updated_on',_0x0d66('0x6f'),_0x0d66('0x66'),_0x0d66('0x70'),_0x0d66('0x71'),'resolved_by',_0x0d66('0x72'),'opened_by',_0x0d66('0x73'),_0x0d66('0x74'),_0x0d66('0x75'),'state',_0x0d66('0x76'),_0x0d66('0x67'),_0x0d66('0x47'),_0x0d66('0x77'),'closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service',_0x0d66('0x78'),_0x0d66('0x79'),_0x0d66('0x7a'),'time_worked',_0x0d66('0x7b'),_0x0d66('0x7c'),'business_duration','group_list',_0x0d66('0x7d'),_0x0d66('0x7e'),_0x0d66('0x7f'),_0x0d66('0x80'),_0x0d66('0x81'),'subcategory','work_notes',_0x0d66('0x82'),_0x0d66('0x83'),_0x0d66('0x84'),_0x0d66('0x85'),_0x0d66('0x86'),_0x0d66('0x87'),_0x0d66('0x88'),'additional_assignee_list',_0x0d66('0x89'),_0x0d66('0x8a'),_0x0d66('0x8b'),_0x0d66('0x8c'),'close_notes',_0x0d66('0x8d'),'follow_up','parent_incident',_0x0d66('0x8e'),_0x0d66('0x8f'),'reopened_by','incident_state',_0x0d66('0x90'),'problem_id','company',_0x0d66('0x91'),_0x0d66('0x92'),'assigned_to','severity',_0x0d66('0x93'),_0x0d66('0x94'),'approval',_0x0d66('0x95'),_0x0d66('0x96'),_0x0d66('0x97'),_0x0d66('0x98'),_0x0d66('0x99'),_0x0d66('0x9a'),'upon_approval',_0x0d66('0x9b'),'location',_0x0d66('0x6a')];var _0x1eba33='';var _0x1fdcae='';var _0x5b75a8=[];var _0x3c7c01='';var _0x34be31='';var _0x4ae798=[];var _0x35188c='';var _0x456928='';var _0x3ffe56={};var _0x14fed8='';return db[_0x0d66('0x4f')]['findOne']({'where':{'id':_0x3f3b26[_0x0d66('0x54')]['id']},'attributes':['id',_0x0d66('0x9c'),'password',_0x0d66('0x9d'),'remoteUri',_0x0d66('0x9e')]})[_0x0d66('0x1d')](handleEntityNotFound(_0x147abf,null))[_0x0d66('0x1d')](function(_0x5810ae){if(_0x5810ae){_0x14fed8=_0x5810ae[_0x0d66('0x9f')];var _0x39614f=_0x14fed8['slice'](-0x1);if(_0x39614f==='/'){_0x14fed8=_0x14fed8[_0x0d66('0xa0')](0x0,_0x14fed8[_0x0d66('0xa1')](_0x39614f));}_0x456928=util[_0x0d66('0xa2')](_0x0d66('0xa3'),_0x14fed8);_0x35188c=util[_0x0d66('0xa2')](_0x0d66('0xa4'),_0x14fed8);_0x3ffe56={'user':_0x5810ae[_0x0d66('0x9c')],'pass':_0x5810ae[_0x0d66('0xa5')]};var _0x2a0df5={'method':_0x0d66('0xa6'),'uri':_0x456928+_0x0d66('0xa7'),'auth':_0x3ffe56,'json':!![]};return rp(_0x2a0df5);}})[_0x0d66('0x1d')](function(_0x4efd35){if(_0x4efd35[_0x0d66('0x26')][_0x0d66('0x55')]>0x0){_0x1eba33=_0x4efd35[_0x0d66('0x26')];}console[_0x0d66('0xa8')]('incident\x20table\x20objects',_0x1eba33);_0x4ae798=[];_0x1fdcae=Object[_0x0d66('0xa9')]([],_0x1eba33);_['remove'](_0x1fdcae,function(_0x205c89){return!_0x5352a8[_0x0d66('0xaa')](_0x205c89['name']);});_0x1fdcae[_0x0d66('0xab')](function(_0x26a840){var _0x1ce145=createFieldObject(_0x35188c,_0x3ffe56,_0x26a840[_0x0d66('0xac')],_0x26a840[_0x0d66('0x36')],_0x26a840[_0x0d66('0xad')],![]);_0x4ae798[_0x0d66('0xae')](_0x1ce145);});return Promise[_0x0d66('0xaf')](_0x4ae798);})[_0x0d66('0x1d')](function(_0x4bdd61){_0x5b75a8=_0x4bdd61;_0x3c7c01=Object[_0x0d66('0xa9')]([],_0x1eba33);console['log'](_0x0d66('0xb0'),_0x1eba33);_[_0x0d66('0xb1')](_0x3c7c01,function(_0x303b7a){return _0x46f4f6[_0x0d66('0xaa')](_0x303b7a[_0x0d66('0x36')]);});console[_0x0d66('0xa8')](_0x0d66('0xb2'),_0x3c7c01);_0x4ae798=[];_0x3c7c01[_0x0d66('0xab')](function(_0x2924b6){var _0x4fcf3d=createFieldObject(_0x35188c,_0x3ffe56,_0x2924b6['internalType'],_0x2924b6['name'],_0x2924b6[_0x0d66('0xad')],!![]);_0x4ae798['push'](_0x4fcf3d);});return Promise['all'](_0x4ae798);})[_0x0d66('0x1d')](function(_0x1c3480){_0x34be31=_0x1c3480;var _0x538f70=_0x5b75a8[_0x0d66('0xb3')](_0x34be31);return{'count':_0x538f70[_0x0d66('0x55')],'rows':_0x538f70};})['then'](respondWithResult(_0x147abf,null))[_0x0d66('0x27')](function(_0x3667ab){console[_0x0d66('0xa8')](_0x0d66('0xb4')+_0x3667ab);var _0x3d3b2e=_0x3f3b26[_0x0d66('0x3f')][_0x0d66('0xb5')]?0x1f4:_0x3667ab[_0x0d66('0xb6')]||0x1f4;logger[_0x0d66('0x21')](_0x3667ab[_0x0d66('0x35')]);delete _0x3667ab['name'];if(_0x3d3b2e===0x191){_0x3d3b2e=0x190;}_0x147abf[_0x0d66('0x29')](_0x3d3b2e)[_0x0d66('0x37')](_0x3f3b26[_0x0d66('0x3f')][_0x0d66('0xb5')]?{'message':'Wrong\x20credentials','statusCode':_0x3667ab[_0x0d66('0xb6')]}:_0x3667ab);});};function createFieldObject(_0x491bee,_0xe83ae4,_0x2abe97,_0x598b29,_0x2caf22,_0x3a24f7){return new Promise(function(_0x260fed,_0x6cc001){var _0x14a541={'id':_0x598b29,'name':_0x2caf22,'custom':_0x3a24f7};if(_0x2abe97===_0x0d66('0xb7')){_0x14a541[_0x0d66('0x4e')]=[{'name':_0x0d66('0xb8'),'value':_0x0d66('0xb9')},{'name':_0x0d66('0xba'),'value':_0x0d66('0xbb')}];_0x260fed(_0x14a541);}else{var _0x21cbf1={'method':_0x0d66('0xa6'),'uri':_0x491bee+'sys_choice?sysparm_query=name=incident^element='+_0x598b29,'auth':_0xe83ae4,'json':!![]};return rp(_0x21cbf1)[_0x0d66('0x1d')](function(_0x484a66){var _0x2dc36d=[];if(_0x484a66[_0x0d66('0x26')][_0x0d66('0x55')]>0x0){_0x484a66['result'][_0x0d66('0xab')](function(_0x28adef){if(_0x28adef[_0x0d66('0xbc')]===_0x0d66('0xbb')){var _0x509747={'name':_0x28adef[_0x0d66('0xad')],'value':_0x28adef[_0x0d66('0xbd')]};_0x2dc36d[_0x0d66('0xae')](_0x509747);}});}_0x14a541[_0x0d66('0x4e')]=_0x2dc36d;if(_0x14a541[_0x0d66('0x4e')][_0x0d66('0x55')]>0x0){_0x260fed(_0x14a541);}else{if(_0x3a24f7==![]){_0x260fed();}else{_0x260fed(_0x14a541);}}});}});} \ No newline at end of file +var _0xa7d8=['sys_domain_path','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','username','password','email','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','statusCode','send','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','apply','reject','save','destroy','end','name','index','map','ServicenowAccount','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','keys','rawAttributes','fields','find','create','body','update','ServicenowConfiguration','pick','getConfigurations','nolimit','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','subcategory','notify','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','hold_reason','approval_history','number','resolved_by','opened_by','sys_created_on','sys_domain','calendar_stc','closed_at','impact','active','work_notes_list','business_service','priority'];(function(_0x49972d,_0x73b509){var _0x4d1b26=function(_0x45e1c3){while(--_0x45e1c3){_0x49972d['push'](_0x49972d['shift']());}};_0x4d1b26(++_0x73b509);}(_0xa7d8,0x1cb));var _0x8a7d=function(_0x57c666,_0x1e05d9){_0x57c666=_0x57c666-0x0;var _0x23ab11=_0xa7d8[_0x57c666];return _0x23ab11;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8a7d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8a7d('0x1'));var rp=require(_0x8a7d('0x2'));var moment=require('moment');var BPromise=require(_0x8a7d('0x3'));var Mustache=require(_0x8a7d('0x4'));var util=require('util');var path=require('path');var sox=require(_0x8a7d('0x5'));var csv=require(_0x8a7d('0x6'));var ejs=require(_0x8a7d('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8a7d('0x8'));var crypto=require(_0x8a7d('0x9'));var jsforce=require(_0x8a7d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8a7d('0x6'));var querystring=require(_0x8a7d('0xb'));var Papa=require('papaparse');var Redis=require(_0x8a7d('0xc'));var authService=require(_0x8a7d('0xd'));var qs=require(_0x8a7d('0xe'));var as=require(_0x8a7d('0xf'));var hardwareService=require(_0x8a7d('0x10'));var logger=require('../../config/logger')(_0x8a7d('0x11'));var utils=require(_0x8a7d('0x12'));var config=require(_0x8a7d('0x13'));var licenseUtil=require(_0x8a7d('0x14'));var db=require(_0x8a7d('0x15'))['db'];var integrations=require(_0x8a7d('0x16'));var jayson=require(_0x8a7d('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3282b8,_0x50a7aa,_0x2f8baa,_0x584c6f){return new BPromise(function(_0x3abb7e,_0x34ed91){var _0x3278b4=_0x584c6f||client;return _0x3278b4[_0x8a7d('0x18')](_0x3282b8,_0x2f8baa)[_0x8a7d('0x19')](function(_0x6391bb){logger[_0x8a7d('0x1a')](_0x8a7d('0x1b'),_0x50a7aa,'request\x20sent');logger[_0x8a7d('0x1c')](_0x8a7d('0x1d'),_0x50a7aa,_0x8a7d('0x1e'),JSON[_0x8a7d('0x1f')](_0x6391bb));if(_0x6391bb[_0x8a7d('0x20')]){if(_0x6391bb[_0x8a7d('0x20')][_0x8a7d('0x21')]===0x1f4){logger[_0x8a7d('0x20')](_0x8a7d('0x1b'),_0x50a7aa,_0x6391bb[_0x8a7d('0x20')][_0x8a7d('0x22')]);return _0x34ed91(_0x6391bb[_0x8a7d('0x20')][_0x8a7d('0x22')]);}logger[_0x8a7d('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0x50a7aa,_0x6391bb[_0x8a7d('0x20')][_0x8a7d('0x22')]);return _0x3abb7e(_0x6391bb['error'][_0x8a7d('0x22')]);}else{logger[_0x8a7d('0x1a')](_0x8a7d('0x1b'),_0x50a7aa,'request\x20sent');_0x3abb7e(_0x6391bb[_0x8a7d('0x23')][_0x8a7d('0x22')]);}})[_0x8a7d('0x24')](function(_0x20b737){logger[_0x8a7d('0x20')](_0x8a7d('0x1b'),_0x50a7aa,_0x20b737);_0x34ed91(_0x20b737);});});}function respondWithStatusCode(_0x194d57,_0x4c2cbc){_0x4c2cbc=_0x4c2cbc||0xcc;return function(_0xf69b82){if(_0xf69b82){return _0x194d57[_0x8a7d('0x25')](_0x4c2cbc);}return _0x194d57[_0x8a7d('0x26')](_0x4c2cbc)['end']();};}function respondWithResult(_0x5ed16a,_0x334a41){_0x334a41=_0x334a41||0xc8;return function(_0x35c79a){if(_0x35c79a){return _0x5ed16a[_0x8a7d('0x26')](_0x334a41)[_0x8a7d('0x27')](_0x35c79a);}};}function respondWithFilteredResult(_0x588892,_0x1b7f5e){return function(_0x153e62){if(_0x153e62){var _0x16ff4c=_0x153e62[_0x8a7d('0x28')],_0x1f700d=_0x1b7f5e[_0x8a7d('0x29')],_0x49b384=_0x1b7f5e[_0x8a7d('0x29')]+_0x1b7f5e[_0x8a7d('0x2a')],_0x5ad183;if(_0x49b384>=_0x16ff4c){_0x49b384=_0x16ff4c;_0x5ad183=0xc8;}else{_0x5ad183=0xce;}_0x588892[_0x8a7d('0x26')](_0x5ad183);return _0x588892['set']('Content-Range',_0x1f700d+'-'+_0x49b384+'/'+_0x16ff4c)[_0x8a7d('0x27')](_0x153e62);}return null;};}function patchUpdates(_0xc7fbb5){return function(_0x2cc6e6){try{jsonpatch[_0x8a7d('0x2b')](_0x2cc6e6,_0xc7fbb5,!![]);}catch(_0x522d16){return BPromise[_0x8a7d('0x2c')](_0x522d16);}return _0x2cc6e6[_0x8a7d('0x2d')]();};}function saveUpdates(_0x386002,_0x4791f6){return function(_0x32f606){if(_0x32f606){return _0x32f606['update'](_0x386002)[_0x8a7d('0x19')](function(_0x2fa6c5){return _0x2fa6c5;});}return null;};}function removeEntity(_0x1a7b75,_0x278f2a){return function(_0x5cfb0d){if(_0x5cfb0d){return _0x5cfb0d[_0x8a7d('0x2e')]()['then'](function(){_0x1a7b75[_0x8a7d('0x26')](0xcc)[_0x8a7d('0x2f')]();});}};}function handleEntityNotFound(_0x4038b1,_0x3671ff){return function(_0x34d0e8){if(!_0x34d0e8){_0x4038b1[_0x8a7d('0x25')](0x194);}return _0x34d0e8;};}function handleError(_0x57a563,_0x4b15d8){_0x4b15d8=_0x4b15d8||0x1f4;return function(_0x5b2b3d){logger[_0x8a7d('0x20')](_0x5b2b3d['stack']);if(_0x5b2b3d[_0x8a7d('0x30')]){delete _0x5b2b3d[_0x8a7d('0x30')];}_0x57a563[_0x8a7d('0x26')](_0x4b15d8)['send'](_0x5b2b3d);};}exports[_0x8a7d('0x31')]=function(_0xfa6aaf,_0x15e61e){var _0xb14358={},_0xe9f8fa={},_0x2bd47f={'count':0x0,'rows':[]};var _0x2ff23c=_[_0x8a7d('0x32')](db[_0x8a7d('0x33')]['rawAttributes'],function(_0x46d3ba){return{'name':_0x46d3ba[_0x8a7d('0x34')],'type':_0x46d3ba[_0x8a7d('0x35')][_0x8a7d('0x36')]};});_0xe9f8fa[_0x8a7d('0x37')]=_['map'](_0x2ff23c,_0x8a7d('0x30'));_0xe9f8fa['query']=_['keys'](_0xfa6aaf[_0x8a7d('0x38')]);_0xe9f8fa[_0x8a7d('0x39')]=_[_0x8a7d('0x3a')](_0xe9f8fa['model'],_0xe9f8fa['query']);_0xb14358[_0x8a7d('0x3b')]=_[_0x8a7d('0x3a')](_0xe9f8fa[_0x8a7d('0x37')],qs['fields'](_0xfa6aaf[_0x8a7d('0x38')]['fields']));_0xb14358['attributes']=_0xb14358['attributes'][_0x8a7d('0x3c')]?_0xb14358[_0x8a7d('0x3b')]:_0xe9f8fa[_0x8a7d('0x37')];if(!_0xfa6aaf['query'][_0x8a7d('0x3d')]('nolimit')){_0xb14358[_0x8a7d('0x2a')]=qs[_0x8a7d('0x2a')](_0xfa6aaf[_0x8a7d('0x38')]['limit']);_0xb14358[_0x8a7d('0x29')]=qs[_0x8a7d('0x29')](_0xfa6aaf[_0x8a7d('0x38')][_0x8a7d('0x29')]);}_0xb14358[_0x8a7d('0x3e')]=qs[_0x8a7d('0x3f')](_0xfa6aaf[_0x8a7d('0x38')][_0x8a7d('0x3f')]);_0xb14358[_0x8a7d('0x40')]=qs[_0x8a7d('0x39')](_['pick'](_0xfa6aaf[_0x8a7d('0x38')],_0xe9f8fa['filters']),_0x2ff23c);if(_0xfa6aaf[_0x8a7d('0x38')][_0x8a7d('0x41')]){_0xb14358[_0x8a7d('0x40')]=_[_0x8a7d('0x42')](_0xb14358['where'],{'$or':_[_0x8a7d('0x32')](_0x2ff23c,function(_0x485056){if(_0x485056[_0x8a7d('0x35')]!==_0x8a7d('0x43')){var _0x27e727={};_0x27e727[_0x485056[_0x8a7d('0x30')]]={'$like':'%'+_0xfa6aaf[_0x8a7d('0x38')]['filter']+'%'};return _0x27e727;}})});}_0xb14358=_[_0x8a7d('0x42')]({},_0xb14358,_0xfa6aaf[_0x8a7d('0x44')]);var _0x4989e2={'where':_0xb14358[_0x8a7d('0x40')]};return db['ServicenowAccount'][_0x8a7d('0x28')](_0x4989e2)[_0x8a7d('0x19')](function(_0x31e11f){_0x2bd47f[_0x8a7d('0x28')]=_0x31e11f;if(_0xfa6aaf[_0x8a7d('0x38')][_0x8a7d('0x45')]){_0xb14358[_0x8a7d('0x46')]=[{'all':!![]}];}return db[_0x8a7d('0x33')]['findAll'](_0xb14358);})[_0x8a7d('0x19')](function(_0x47ac31){_0x2bd47f['rows']=_0x47ac31;return _0x2bd47f;})['then'](respondWithFilteredResult(_0x15e61e,_0xb14358))['catch'](handleError(_0x15e61e,null));};exports[_0x8a7d('0x47')]=function(_0x1b86b3,_0x1c58fd){var _0x4cb573={'raw':![],'where':{'id':_0x1b86b3[_0x8a7d('0x48')]['id']}},_0x25718e={};_0x25718e[_0x8a7d('0x37')]=_[_0x8a7d('0x49')](db[_0x8a7d('0x33')][_0x8a7d('0x4a')]);_0x25718e[_0x8a7d('0x38')]=_[_0x8a7d('0x49')](_0x1b86b3[_0x8a7d('0x38')]);_0x25718e[_0x8a7d('0x39')]=_['intersection'](_0x25718e['model'],_0x25718e['query']);_0x4cb573[_0x8a7d('0x3b')]=_[_0x8a7d('0x3a')](_0x25718e['model'],qs[_0x8a7d('0x4b')](_0x1b86b3[_0x8a7d('0x38')][_0x8a7d('0x4b')]));_0x4cb573[_0x8a7d('0x3b')]=_0x4cb573['attributes']['length']?_0x4cb573[_0x8a7d('0x3b')]:_0x25718e[_0x8a7d('0x37')];if(_0x1b86b3[_0x8a7d('0x38')][_0x8a7d('0x45')]){_0x4cb573[_0x8a7d('0x46')]=[{'all':!![]}];}_0x4cb573=_[_0x8a7d('0x42')]({},_0x4cb573,_0x1b86b3[_0x8a7d('0x44')]);return db[_0x8a7d('0x33')][_0x8a7d('0x4c')](_0x4cb573)[_0x8a7d('0x19')](handleEntityNotFound(_0x1c58fd,null))[_0x8a7d('0x19')](respondWithResult(_0x1c58fd,null))[_0x8a7d('0x24')](handleError(_0x1c58fd,null));};exports[_0x8a7d('0x4d')]=function(_0x593ec1,_0x375750){return db[_0x8a7d('0x33')][_0x8a7d('0x4d')](_0x593ec1[_0x8a7d('0x4e')],{})['then'](respondWithResult(_0x375750,0xc9))[_0x8a7d('0x24')](handleError(_0x375750,null));};exports[_0x8a7d('0x4f')]=function(_0x3e476c,_0x325c0c){if(_0x3e476c[_0x8a7d('0x4e')]['id']){delete _0x3e476c[_0x8a7d('0x4e')]['id'];}return db[_0x8a7d('0x33')][_0x8a7d('0x4c')]({'where':{'id':_0x3e476c[_0x8a7d('0x48')]['id']}})[_0x8a7d('0x19')](handleEntityNotFound(_0x325c0c,null))[_0x8a7d('0x19')](saveUpdates(_0x3e476c[_0x8a7d('0x4e')],null))['then'](respondWithResult(_0x325c0c,null))[_0x8a7d('0x24')](handleError(_0x325c0c,null));};exports[_0x8a7d('0x2e')]=function(_0x5d9a67,_0x533129){return db[_0x8a7d('0x33')][_0x8a7d('0x4c')]({'where':{'id':_0x5d9a67[_0x8a7d('0x48')]['id']}})['then'](handleEntityNotFound(_0x533129,null))['then'](removeEntity(_0x533129,null))['catch'](handleError(_0x533129,null));};exports['getConfigurations']=function(_0x23e83f,_0xbe1793,_0x1a7fbf){var _0x78c081={};var _0x3349e6={};var _0x400ee4;var _0x5f4182;return db['ServicenowAccount']['findOne']({'where':{'id':_0x23e83f['params']['id']}})[_0x8a7d('0x19')](handleEntityNotFound(_0xbe1793,null))[_0x8a7d('0x19')](function(_0x3c142e){if(_0x3c142e){_0x400ee4=_0x3c142e;_0x3349e6[_0x8a7d('0x37')]=_[_0x8a7d('0x49')](db[_0x8a7d('0x50')][_0x8a7d('0x4a')]);_0x3349e6[_0x8a7d('0x38')]=_[_0x8a7d('0x49')](_0x23e83f['query']);_0x3349e6[_0x8a7d('0x39')]=_[_0x8a7d('0x3a')](_0x3349e6[_0x8a7d('0x37')],_0x3349e6['query']);_0x78c081[_0x8a7d('0x3b')]=_[_0x8a7d('0x3a')](_0x3349e6['model'],qs[_0x8a7d('0x4b')](_0x23e83f['query'][_0x8a7d('0x4b')]));_0x78c081[_0x8a7d('0x3b')]=_0x78c081['attributes'][_0x8a7d('0x3c')]?_0x78c081[_0x8a7d('0x3b')]:_0x3349e6[_0x8a7d('0x37')];_0x78c081[_0x8a7d('0x3e')]=qs[_0x8a7d('0x3f')](_0x23e83f[_0x8a7d('0x38')][_0x8a7d('0x3f')]);_0x78c081[_0x8a7d('0x40')]=qs['filters'](_[_0x8a7d('0x51')](_0x23e83f[_0x8a7d('0x38')],_0x3349e6['filters']));if(_0x23e83f[_0x8a7d('0x38')][_0x8a7d('0x41')]){_0x78c081['where']=_['merge'](_0x78c081[_0x8a7d('0x40')],{'$or':_[_0x8a7d('0x32')](_0x78c081[_0x8a7d('0x3b')],function(_0x50b672){var _0x3a4164={};_0x3a4164[_0x50b672]={'$like':'%'+_0x23e83f['query'][_0x8a7d('0x41')]+'%'};return _0x3a4164;})});}_0x78c081=_[_0x8a7d('0x42')]({},_0x78c081,_0x23e83f[_0x8a7d('0x44')]);return _0x400ee4[_0x8a7d('0x52')](_0x78c081);}})['then'](function(_0x5ce7cb){if(_0x5ce7cb){_0x5f4182=_0x5ce7cb['length'];if(!_0x23e83f[_0x8a7d('0x38')][_0x8a7d('0x3d')](_0x8a7d('0x53'))){_0x78c081[_0x8a7d('0x2a')]=qs[_0x8a7d('0x2a')](_0x23e83f[_0x8a7d('0x38')][_0x8a7d('0x2a')]);_0x78c081[_0x8a7d('0x29')]=qs[_0x8a7d('0x29')](_0x23e83f[_0x8a7d('0x38')]['offset']);}return _0x400ee4[_0x8a7d('0x52')](_0x78c081);}})['then'](function(_0x1ef93e){if(_0x1ef93e){return _0x1ef93e?{'count':_0x5f4182,'rows':_0x1ef93e}:null;}})[_0x8a7d('0x19')](respondWithResult(_0xbe1793,null))[_0x8a7d('0x24')](handleError(_0xbe1793,null));};exports[_0x8a7d('0x54')]=function(_0x49a6f4,_0x2e902a,_0x92ef73){if(_0x49a6f4[_0x8a7d('0x4e')]['id']){delete _0x49a6f4[_0x8a7d('0x4e')]['id'];}return db[_0x8a7d('0x33')][_0x8a7d('0x55')]({'where':{'id':_0x49a6f4[_0x8a7d('0x48')]['id']}})[_0x8a7d('0x19')](handleEntityNotFound(_0x2e902a,null))['then'](function(_0x220641){if(_0x220641){_0x49a6f4[_0x8a7d('0x4e')]['AccountId']=_0x220641['id'];_0x49a6f4[_0x8a7d('0x4e')][_0x8a7d('0x56')]=integrations[_0x8a7d('0x57')](_0x49a6f4[_0x8a7d('0x4e')][_0x8a7d('0x58')],_0x49a6f4[_0x8a7d('0x4e')]['type']);_0x49a6f4['body'][_0x8a7d('0x59')]=integrations[_0x8a7d('0x5a')](_0x49a6f4[_0x8a7d('0x4e')][_0x8a7d('0x58')],_0x49a6f4[_0x8a7d('0x4e')][_0x8a7d('0x35')]);return db[_0x8a7d('0x50')][_0x8a7d('0x4d')](_0x49a6f4['body'],{'include':[{'model':db[_0x8a7d('0x5b')],'as':'Subjects'},{'model':db[_0x8a7d('0x5b')],'as':'Descriptions'}]});}return null;})[_0x8a7d('0x19')](respondWithResult(_0x2e902a,null))['catch'](handleError(_0x2e902a,null));};exports[_0x8a7d('0x5c')]=function(_0x3390b2,_0x366abe,_0x225e6e){var _0x40e624=[_0x8a7d('0x5d'),'hold_reason',_0x8a7d('0x5e'),_0x8a7d('0x5f'),'close_code',_0x8a7d('0x60'),'incident_state',_0x8a7d('0x61'),'category'];var _0x445a64=[_0x8a7d('0x62'),_0x8a7d('0x5d'),_0x8a7d('0x63'),_0x8a7d('0x64'),_0x8a7d('0x65'),_0x8a7d('0x66'),'child_incidents',_0x8a7d('0x67'),_0x8a7d('0x68'),_0x8a7d('0x69'),_0x8a7d('0x6a'),'sys_updated_by',_0x8a7d('0x6b'),'user_input',_0x8a7d('0x6c'),_0x8a7d('0x6d'),'state','sys_created_by',_0x8a7d('0x5e'),_0x8a7d('0x3e'),_0x8a7d('0x6e'),_0x8a7d('0x6f'),'cmdb_ci','delivery_plan',_0x8a7d('0x70'),_0x8a7d('0x71'),_0x8a7d('0x72'),_0x8a7d('0x73'),_0x8a7d('0x74'),_0x8a7d('0x75'),'rfc',_0x8a7d('0x76'),'expected_start',_0x8a7d('0x77'),_0x8a7d('0x78'),_0x8a7d('0x79'),_0x8a7d('0x7a'),_0x8a7d('0x7b'),'resolved_at','caller_id',_0x8a7d('0x7c'),_0x8a7d('0x5f'),_0x8a7d('0x7d'),_0x8a7d('0x7e'),'close_code',_0x8a7d('0x7f'),_0x8a7d('0x80'),_0x8a7d('0x81'),_0x8a7d('0x82'),'business_stc',_0x8a7d('0x83'),_0x8a7d('0x84'),_0x8a7d('0x85'),_0x8a7d('0x60'),_0x8a7d('0x86'),'close_notes',_0x8a7d('0x87'),_0x8a7d('0x88'),_0x8a7d('0x89'),_0x8a7d('0x8a'),_0x8a7d('0x8b'),_0x8a7d('0x8c'),_0x8a7d('0x8d'),_0x8a7d('0x8e'),_0x8a7d('0x8f'),_0x8a7d('0x90'),_0x8a7d('0x91'),_0x8a7d('0x92'),_0x8a7d('0x93'),_0x8a7d('0x61'),_0x8a7d('0x94'),_0x8a7d('0x95'),_0x8a7d('0x96'),_0x8a7d('0x97'),_0x8a7d('0x98'),_0x8a7d('0x99'),_0x8a7d('0x9a'),_0x8a7d('0x9b'),_0x8a7d('0x9c'),'upon_approval',_0x8a7d('0x9d'),'location','category'];var _0x56e66b='';var _0x3cb01b='';var _0x467ce5=[];var _0x1facd1='';var _0x1a6abf='';var _0x42b8f6=[];var _0x36091c='';var _0x455788='';var _0x2cb17f={};var _0x5a61be='';return db[_0x8a7d('0x33')][_0x8a7d('0x55')]({'where':{'id':_0x3390b2[_0x8a7d('0x48')]['id']},'attributes':['id',_0x8a7d('0x9e'),_0x8a7d('0x9f'),_0x8a7d('0xa0'),_0x8a7d('0xa1'),'serverUrl']})[_0x8a7d('0x19')](handleEntityNotFound(_0x366abe,null))[_0x8a7d('0x19')](function(_0x3252a6){if(_0x3252a6){_0x5a61be=_0x3252a6['remoteUri'];var _0x205a4f=_0x5a61be[_0x8a7d('0xa2')](-0x1);if(_0x205a4f==='/'){_0x5a61be=_0x5a61be[_0x8a7d('0xa3')](0x0,_0x5a61be['lastIndexOf'](_0x205a4f));}_0x455788=util[_0x8a7d('0xa4')](_0x8a7d('0xa5'),_0x5a61be);_0x36091c=util[_0x8a7d('0xa4')](_0x8a7d('0xa6'),_0x5a61be);_0x2cb17f={'user':_0x3252a6[_0x8a7d('0x9e')],'pass':_0x3252a6[_0x8a7d('0x9f')]};var _0x220780={'method':_0x8a7d('0xa7'),'uri':_0x455788+_0x8a7d('0xa8'),'auth':_0x2cb17f,'json':!![]};return rp(_0x220780);}})['then'](function(_0x25cb4e){if(_0x25cb4e[_0x8a7d('0x23')][_0x8a7d('0x3c')]>0x0){_0x56e66b=_0x25cb4e[_0x8a7d('0x23')];}console[_0x8a7d('0xa9')](_0x8a7d('0xaa'),_0x56e66b);_0x42b8f6=[];_0x3cb01b=Object[_0x8a7d('0xab')]([],_0x56e66b);_[_0x8a7d('0xac')](_0x3cb01b,function(_0x1fcd98){return!_0x40e624['includes'](_0x1fcd98[_0x8a7d('0x30')]);});_0x3cb01b[_0x8a7d('0xad')](function(_0x41238c){var _0x4a4846=createFieldObject(_0x36091c,_0x2cb17f,_0x41238c[_0x8a7d('0xae')],_0x41238c[_0x8a7d('0x30')],_0x41238c[_0x8a7d('0xaf')],![]);_0x42b8f6[_0x8a7d('0xb0')](_0x4a4846);});return Promise[_0x8a7d('0xb1')](_0x42b8f6);})['then'](function(_0x477c33){_0x467ce5=_0x477c33;_0x1facd1=Object[_0x8a7d('0xab')]([],_0x56e66b);console[_0x8a7d('0xa9')](_0x8a7d('0xb2'),_0x56e66b);_[_0x8a7d('0xac')](_0x1facd1,function(_0x2dc939){return _0x445a64[_0x8a7d('0xb3')](_0x2dc939[_0x8a7d('0x30')]);});console[_0x8a7d('0xa9')](_0x8a7d('0xb4'),_0x1facd1);_0x42b8f6=[];_0x1facd1[_0x8a7d('0xad')](function(_0x508833){var _0x46792e=createFieldObject(_0x36091c,_0x2cb17f,_0x508833['internalType'],_0x508833[_0x8a7d('0x30')],_0x508833[_0x8a7d('0xaf')],!![]);_0x42b8f6[_0x8a7d('0xb0')](_0x46792e);});return Promise['all'](_0x42b8f6);})[_0x8a7d('0x19')](function(_0x365865){_0x1a6abf=_0x365865;var _0x435df3=_0x467ce5[_0x8a7d('0xb5')](_0x1a6abf);return{'count':_0x435df3[_0x8a7d('0x3c')],'rows':_0x435df3};})[_0x8a7d('0x19')](respondWithResult(_0x366abe,null))[_0x8a7d('0x24')](function(_0x502a73){console[_0x8a7d('0xa9')]('ServiceNow\x20error:\x20'+_0x502a73);var _0x88e002=_0x3390b2['query'][_0x8a7d('0xb6')]?0x1f4:_0x502a73[_0x8a7d('0xb7')]||0x1f4;logger[_0x8a7d('0x20')](_0x502a73['stack']);delete _0x502a73[_0x8a7d('0x30')];if(_0x88e002===0x191){_0x88e002=0x190;}_0x366abe[_0x8a7d('0x26')](_0x88e002)[_0x8a7d('0xb8')](_0x3390b2[_0x8a7d('0x38')][_0x8a7d('0xb6')]?{'message':'Wrong\x20credentials','statusCode':_0x502a73[_0x8a7d('0xb7')]}:_0x502a73);});};function createFieldObject(_0x5b5920,_0x3c3af5,_0x18848a,_0x3a7189,_0x44bd5b,_0x5d902a){return new Promise(function(_0x1e269c,_0x1254ec){var _0xdd69d0={'id':_0x3a7189,'name':_0x44bd5b,'custom':_0x5d902a};if(_0x18848a===_0x8a7d('0xb9')){_0xdd69d0[_0x8a7d('0x44')]=[{'name':_0x8a7d('0xba'),'value':'true'},{'name':_0x8a7d('0xbb'),'value':_0x8a7d('0xbc')}];_0x1e269c(_0xdd69d0);}else{var _0x405ceb={'method':_0x8a7d('0xa7'),'uri':_0x5b5920+_0x8a7d('0xbd')+_0x3a7189,'auth':_0x3c3af5,'json':!![]};return rp(_0x405ceb)['then'](function(_0x24c79b){var _0xcb2e4b=[];if(_0x24c79b['result'][_0x8a7d('0x3c')]>0x0){_0x24c79b[_0x8a7d('0x23')]['forEach'](function(_0x4ec9e4){if(_0x4ec9e4[_0x8a7d('0xbe')]===_0x8a7d('0xbc')){var _0x4b29bd={'name':_0x4ec9e4[_0x8a7d('0xaf')],'value':_0x4ec9e4[_0x8a7d('0xbf')]};_0xcb2e4b[_0x8a7d('0xb0')](_0x4b29bd);}});}_0xdd69d0[_0x8a7d('0x44')]=_0xcb2e4b;if(_0xdd69d0[_0x8a7d('0x44')][_0x8a7d('0x3c')]>0x0){_0x1e269c(_0xdd69d0);}else{if(_0x5d902a==![]){_0x1e269c();}else{_0x1e269c(_0xdd69d0);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 14f3135..f642889 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 _0x5089=['util','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash'];(function(_0x5442a5,_0x4110f1){var _0x130af0=function(_0x457ec2){while(--_0x457ec2){_0x5442a5['push'](_0x5442a5['shift']());}};_0x130af0(++_0x4110f1);}(_0x5089,0x1bb));var _0x9508=function(_0x24d24e,_0x4e17a4){_0x24d24e=_0x24d24e-0x0;var _0x20e068=_0x5089[_0x24d24e];return _0x20e068;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var logger=require('../../config/logger')(_0x9508('0x2'));var moment=require(_0x9508('0x3'));var BPromise=require(_0x9508('0x4'));var rp=require(_0x9508('0x5'));var fs=require('fs');var path=require(_0x9508('0x6'));var rimraf=require('rimraf');var config=require(_0x9508('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x9508('0x8'));module[_0x9508('0x9')]=function(_0x257318,_0x4ab3c6){return _0x257318[_0x9508('0xa')](_0x9508('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2ca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0xf2ca[_0x549278];return _0x1ea9a1;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xaf2c('0x9'));module[_0xaf2c('0xa')]=function(_0x297740,_0x1f9531){return _0x297740['define'](_0xaf2c('0xb'),attributes,{'tableName':_0xaf2c('0xc'),'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 3bc786b..b34d4bb 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 _0x49ab=['message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','ShowServicenowAccount','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x38c274,_0x3f0678){var _0x2930e2=function(_0x4fadcb){while(--_0x4fadcb){_0x38c274['push'](_0x38c274['shift']());}};_0x2930e2(++_0x3f0678);}(_0x49ab,0x1e3));var _0xb49a=function(_0x3794b6,_0x14fb57){_0x3794b6=_0x3794b6-0x0;var _0x5deb73=_0x49ab[_0x3794b6];return _0x5deb73;};'use strict';var _=require(_0xb49a('0x0'));var util=require(_0xb49a('0x1'));var moment=require(_0xb49a('0x2'));var BPromise=require('bluebird');var rs=require(_0xb49a('0x3'));var fs=require('fs');var Redis=require(_0xb49a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb49a('0x5'));var logger=require(_0xb49a('0x6'))(_0xb49a('0x7'));var config=require(_0xb49a('0x8'));var jayson=require(_0xb49a('0x9'));var client=jayson['client'][_0xb49a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1703e6,_0x361990,_0x45f2b2){return new BPromise(function(_0xf3d487,_0x5c7085){return client[_0xb49a('0xb')](_0x1703e6,_0x45f2b2)[_0xb49a('0xc')](function(_0x364912){logger[_0xb49a('0xd')](_0xb49a('0xe'),_0x361990,_0xb49a('0xf'));logger[_0xb49a('0x10')](_0xb49a('0x11'),_0x361990,_0xb49a('0xf'),JSON[_0xb49a('0x12')](_0x364912));if(_0x364912[_0xb49a('0x13')]){if(_0x364912[_0xb49a('0x13')][_0xb49a('0x14')]===0x1f4){logger[_0xb49a('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x361990,_0x364912[_0xb49a('0x13')]['message']);return _0x5c7085(_0x364912['error'][_0xb49a('0x15')]);}logger['error'](_0xb49a('0xe'),_0x361990,_0x364912['error'][_0xb49a('0x15')]);return _0xf3d487(_0x364912[_0xb49a('0x13')][_0xb49a('0x15')]);}else{logger[_0xb49a('0xd')](_0xb49a('0xe'),_0x361990,'request\x20sent');_0xf3d487(_0x364912[_0xb49a('0x16')][_0xb49a('0x15')]);}})[_0xb49a('0x17')](function(_0x4969d3){logger[_0xb49a('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x361990,_0x4969d3);_0x5c7085(_0x4969d3);});});}exports[_0xb49a('0x18')]=function(_0x1e1aba){var _0xc7e283=this;return new Promise(function(_0x19a0dc,_0x2e51e4){return db[_0xb49a('0x19')][_0xb49a('0x1a')]({'raw':_0x1e1aba[_0xb49a('0x1b')]?_0x1e1aba[_0xb49a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1e1aba[_0xb49a('0x1b')]?_0x1e1aba[_0xb49a('0x1b')][_0xb49a('0x1c')]||null:null,'attributes':_0x1e1aba[_0xb49a('0x1b')]?_0x1e1aba[_0xb49a('0x1b')][_0xb49a('0x1d')]||null:null,'limit':_0x1e1aba['options']?_0x1e1aba[_0xb49a('0x1b')][_0xb49a('0x1e')]||null:null,'include':_0x1e1aba[_0xb49a('0x1b')]?_0x1e1aba[_0xb49a('0x1b')][_0xb49a('0x1f')]?_[_0xb49a('0x20')](_0x1e1aba[_0xb49a('0x1b')][_0xb49a('0x1f')],function(_0x40a9fc){return{'model':db[_0x40a9fc['model']],'as':_0x40a9fc['as'],'attributes':_0x40a9fc['attributes'],'include':_0x40a9fc[_0xb49a('0x1f')]?_[_0xb49a('0x20')](_0x40a9fc[_0xb49a('0x1f')],function(_0x45380b){return{'model':db[_0x45380b['model']],'as':_0x45380b['as'],'attributes':_0x45380b[_0xb49a('0x1d')],'include':_0x45380b[_0xb49a('0x1f')]?_[_0xb49a('0x20')](_0x45380b[_0xb49a('0x1f')],function(_0x1c52d1){return{'model':db[_0x1c52d1[_0xb49a('0x21')]],'as':_0x1c52d1['as'],'attributes':_0x1c52d1[_0xb49a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb49a('0xc')](function(_0x34948f){logger[_0xb49a('0xd')](_0xb49a('0x18'),_0x1e1aba);logger['debug'](_0xb49a('0x18'),_0x1e1aba,JSON['stringify'](_0x34948f));_0x19a0dc(_0x34948f);})[_0xb49a('0x17')](function(_0xa88072){logger[_0xb49a('0x13')](_0xb49a('0x18'),_0xa88072[_0xb49a('0x15')],_0x1e1aba);_0x2e51e4(_0xc7e283[_0xb49a('0x13')](0x1f4,_0xa88072['message']));});});};exports[_0xb49a('0x22')]=function(_0x101a49){var _0x534baa=this;return new Promise(function(_0x5ce912,_0x4906b5){return db['ServicenowAccount']['find']({'raw':_0x101a49[_0xb49a('0x1b')]?_0x101a49[_0xb49a('0x1b')][_0xb49a('0x23')]===undefined?!![]:![]:!![],'where':_0x101a49[_0xb49a('0x1b')]?_0x101a49[_0xb49a('0x1b')]['where']||null:null,'attributes':_0x101a49[_0xb49a('0x1b')]?_0x101a49[_0xb49a('0x1b')][_0xb49a('0x1d')]||null:null,'include':_0x101a49[_0xb49a('0x1b')]?_0x101a49[_0xb49a('0x1b')][_0xb49a('0x1f')]?_[_0xb49a('0x20')](_0x101a49[_0xb49a('0x1b')][_0xb49a('0x1f')],function(_0x1e6c93){return{'model':db[_0x1e6c93[_0xb49a('0x21')]],'as':_0x1e6c93['as'],'attributes':_0x1e6c93[_0xb49a('0x1d')],'include':_0x1e6c93[_0xb49a('0x1f')]?_[_0xb49a('0x20')](_0x1e6c93['include'],function(_0x5c34ad){return{'model':db[_0x5c34ad['model']],'as':_0x5c34ad['as'],'attributes':_0x5c34ad[_0xb49a('0x1d')],'include':_0x5c34ad['include']?_[_0xb49a('0x20')](_0x5c34ad[_0xb49a('0x1f')],function(_0x5957f8){return{'model':db[_0x5957f8[_0xb49a('0x21')]],'as':_0x5957f8['as'],'attributes':_0x5957f8[_0xb49a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2633cf){logger[_0xb49a('0xd')](_0xb49a('0x22'),_0x101a49);logger['debug'](_0xb49a('0x22'),_0x101a49,JSON['stringify'](_0x2633cf));_0x5ce912(_0x2633cf);})['catch'](function(_0x331eee){logger[_0xb49a('0x13')]('ShowServicenowAccount',_0x331eee[_0xb49a('0x15')],_0x101a49);_0x4906b5(_0x534baa['error'](0x1f4,_0x331eee[_0xb49a('0x15')]));});});}; \ No newline at end of file +var _0xfc52=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','GetServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowServicenowAccount','find'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xfc52,0xee));var _0x2fc5=function(_0x5b8a39,_0x18eb9c){_0x5b8a39=_0x5b8a39-0x0;var _0x12394d=_0xfc52[_0x5b8a39];return _0x12394d;};'use strict';var _=require(_0x2fc5('0x0'));var util=require(_0x2fc5('0x1'));var moment=require('moment');var BPromise=require(_0x2fc5('0x2'));var rs=require(_0x2fc5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fc5('0x4'))['db'];var utils=require(_0x2fc5('0x5'));var logger=require('../../config/logger')(_0x2fc5('0x6'));var config=require(_0x2fc5('0x7'));var jayson=require(_0x2fc5('0x8'));var client=jayson[_0x2fc5('0x9')][_0x2fc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57a751,_0x379b24,_0x1de912){return new BPromise(function(_0x1bbcf7,_0x4361bf){return client[_0x2fc5('0xb')](_0x57a751,_0x1de912)[_0x2fc5('0xc')](function(_0x1cc861){logger[_0x2fc5('0xd')](_0x2fc5('0xe'),_0x379b24,_0x2fc5('0xf'));logger[_0x2fc5('0x10')](_0x2fc5('0x11'),_0x379b24,'request\x20sent',JSON[_0x2fc5('0x12')](_0x1cc861));if(_0x1cc861[_0x2fc5('0x13')]){if(_0x1cc861[_0x2fc5('0x13')]['code']===0x1f4){logger[_0x2fc5('0x13')](_0x2fc5('0xe'),_0x379b24,_0x1cc861[_0x2fc5('0x13')][_0x2fc5('0x14')]);return _0x4361bf(_0x1cc861['error'][_0x2fc5('0x14')]);}logger[_0x2fc5('0x13')](_0x2fc5('0xe'),_0x379b24,_0x1cc861[_0x2fc5('0x13')][_0x2fc5('0x14')]);return _0x1bbcf7(_0x1cc861['error'][_0x2fc5('0x14')]);}else{logger['info'](_0x2fc5('0xe'),_0x379b24,_0x2fc5('0xf'));_0x1bbcf7(_0x1cc861['result'][_0x2fc5('0x14')]);}})['catch'](function(_0x51f6a7){logger[_0x2fc5('0x13')](_0x2fc5('0xe'),_0x379b24,_0x51f6a7);_0x4361bf(_0x51f6a7);});});}exports[_0x2fc5('0x15')]=function(_0x230491){var _0x165b34=this;return new Promise(function(_0xe3847f,_0x42bcca){return db['ServicenowAccount'][_0x2fc5('0x16')]({'raw':_0x230491[_0x2fc5('0x17')]?_0x230491['options'][_0x2fc5('0x18')]===undefined?!![]:![]:!![],'where':_0x230491[_0x2fc5('0x17')]?_0x230491[_0x2fc5('0x17')][_0x2fc5('0x19')]||null:null,'attributes':_0x230491[_0x2fc5('0x17')]?_0x230491['options'][_0x2fc5('0x1a')]||null:null,'limit':_0x230491[_0x2fc5('0x17')]?_0x230491['options'][_0x2fc5('0x1b')]||null:null,'include':_0x230491[_0x2fc5('0x17')]?_0x230491['options']['include']?_[_0x2fc5('0x1c')](_0x230491['options']['include'],function(_0x2f9bd6){return{'model':db[_0x2f9bd6['model']],'as':_0x2f9bd6['as'],'attributes':_0x2f9bd6[_0x2fc5('0x1a')],'include':_0x2f9bd6[_0x2fc5('0x1d')]?_[_0x2fc5('0x1c')](_0x2f9bd6[_0x2fc5('0x1d')],function(_0x5e2526){return{'model':db[_0x5e2526[_0x2fc5('0x1e')]],'as':_0x5e2526['as'],'attributes':_0x5e2526[_0x2fc5('0x1a')],'include':_0x5e2526[_0x2fc5('0x1d')]?_[_0x2fc5('0x1c')](_0x5e2526['include'],function(_0x1ee62e){return{'model':db[_0x1ee62e[_0x2fc5('0x1e')]],'as':_0x1ee62e['as'],'attributes':_0x1ee62e[_0x2fc5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2fc5('0xc')](function(_0xa94fbb){logger[_0x2fc5('0xd')]('GetServicenowAccount',_0x230491);logger['debug'](_0x2fc5('0x15'),_0x230491,JSON[_0x2fc5('0x12')](_0xa94fbb));_0xe3847f(_0xa94fbb);})[_0x2fc5('0x1f')](function(_0x2df539){logger['error'](_0x2fc5('0x15'),_0x2df539['message'],_0x230491);_0x42bcca(_0x165b34[_0x2fc5('0x13')](0x1f4,_0x2df539[_0x2fc5('0x14')]));});});};exports[_0x2fc5('0x20')]=function(_0x4b0faf){var _0x23d5cb=this;return new Promise(function(_0xed8428,_0x119c14){return db['ServicenowAccount'][_0x2fc5('0x21')]({'raw':_0x4b0faf[_0x2fc5('0x17')]?_0x4b0faf[_0x2fc5('0x17')][_0x2fc5('0x18')]===undefined?!![]:![]:!![],'where':_0x4b0faf[_0x2fc5('0x17')]?_0x4b0faf[_0x2fc5('0x17')][_0x2fc5('0x19')]||null:null,'attributes':_0x4b0faf[_0x2fc5('0x17')]?_0x4b0faf[_0x2fc5('0x17')]['attributes']||null:null,'include':_0x4b0faf[_0x2fc5('0x17')]?_0x4b0faf[_0x2fc5('0x17')]['include']?_[_0x2fc5('0x1c')](_0x4b0faf[_0x2fc5('0x17')][_0x2fc5('0x1d')],function(_0x2d7eab){return{'model':db[_0x2d7eab[_0x2fc5('0x1e')]],'as':_0x2d7eab['as'],'attributes':_0x2d7eab[_0x2fc5('0x1a')],'include':_0x2d7eab['include']?_['map'](_0x2d7eab['include'],function(_0x4f6282){return{'model':db[_0x4f6282[_0x2fc5('0x1e')]],'as':_0x4f6282['as'],'attributes':_0x4f6282[_0x2fc5('0x1a')],'include':_0x4f6282[_0x2fc5('0x1d')]?_[_0x2fc5('0x1c')](_0x4f6282['include'],function(_0x248fae){return{'model':db[_0x248fae[_0x2fc5('0x1e')]],'as':_0x248fae['as'],'attributes':_0x248fae[_0x2fc5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2fc5('0xc')](function(_0x348347){logger[_0x2fc5('0xd')](_0x2fc5('0x20'),_0x4b0faf);logger[_0x2fc5('0x10')](_0x2fc5('0x20'),_0x4b0faf,JSON[_0x2fc5('0x12')](_0x348347));_0xed8428(_0x348347);})[_0x2fc5('0x1f')](function(_0x53f0ef){logger[_0x2fc5('0x13')](_0x2fc5('0x20'),_0x53f0ef[_0x2fc5('0x14')],_0x4b0faf);_0x119c14(_0x23d5cb[_0x2fc5('0x13')](0x1f4,_0x53f0ef[_0x2fc5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 162c185..05ff4e4 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 _0xe74b=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','destroy'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xe74b,0x79));var _0xbe74=function(_0x447bda,_0x919a61){_0x447bda=_0x447bda-0x0;var _0x5a3829=_0xe74b[_0x447bda];return _0x5a3829;};'use strict';var multer=require(_0xbe74('0x0'));var util=require(_0xbe74('0x1'));var path=require(_0xbe74('0x2'));var timeout=require(_0xbe74('0x3'));var express=require(_0xbe74('0x4'));var router=express[_0xbe74('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe74('0x6'));var config=require(_0xbe74('0x7'));var controller=require(_0xbe74('0x8'));router[_0xbe74('0x9')]('/',auth[_0xbe74('0xa')](),controller[_0xbe74('0xb')]);router[_0xbe74('0x9')](_0xbe74('0xc'),auth[_0xbe74('0xa')](),controller[_0xbe74('0xd')]);router[_0xbe74('0x9')](_0xbe74('0xe'),auth[_0xbe74('0xa')](),controller[_0xbe74('0xf')]);router[_0xbe74('0x9')](_0xbe74('0x10'),auth[_0xbe74('0xa')](),controller['getSubjects']);router[_0xbe74('0x9')](_0xbe74('0x11'),auth['isAuthenticated'](),controller[_0xbe74('0x12')]);router['post']('/',auth[_0xbe74('0xa')](),controller[_0xbe74('0x13')]);router[_0xbe74('0x14')](_0xbe74('0xc'),auth[_0xbe74('0xa')](),controller[_0xbe74('0x15')]);router['delete'](_0xbe74('0xc'),auth[_0xbe74('0xa')](),controller[_0xbe74('0x16')]);module[_0xbe74('0x17')]=router; \ No newline at end of file +var _0x871d=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2575eb,_0x456f3f){var _0x1c49da=function(_0x32dcb1){while(--_0x32dcb1){_0x2575eb['push'](_0x2575eb['shift']());}};_0x1c49da(++_0x456f3f);}(_0x871d,0x67));var _0xd871=function(_0x2eeae0,_0x469b4d){_0x2eeae0=_0x2eeae0-0x0;var _0x14185b=_0x871d[_0x2eeae0];return _0x14185b;};'use strict';var multer=require(_0xd871('0x0'));var util=require(_0xd871('0x1'));var path=require(_0xd871('0x2'));var timeout=require(_0xd871('0x3'));var express=require(_0xd871('0x4'));var router=express[_0xd871('0x5')]();var auth=require(_0xd871('0x6'));var interaction=require(_0xd871('0x7'));var config=require(_0xd871('0x8'));var controller=require(_0xd871('0x9'));router[_0xd871('0xa')]('/',auth[_0xd871('0xb')](),controller[_0xd871('0xc')]);router[_0xd871('0xa')]('/:id',auth[_0xd871('0xb')](),controller['show']);router[_0xd871('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xd871('0xa')](_0xd871('0xd'),auth[_0xd871('0xb')](),controller['getSubjects']);router[_0xd871('0xa')](_0xd871('0xe'),auth['isAuthenticated'](),controller[_0xd871('0xf')]);router['post']('/',auth[_0xd871('0xb')](),controller[_0xd871('0x10')]);router[_0xd871('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd871('0x12')]);router[_0xd871('0x13')](_0xd871('0x14'),auth[_0xd871('0xb')](),controller[_0xd871('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index e3a1b90..d930a77 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 _0xb81f=['exports','STRING'];(function(_0x11f04f,_0x1c4a78){var _0x3d4e6e=function(_0x4b847e){while(--_0x4b847e){_0x11f04f['push'](_0x11f04f['shift']());}};_0x3d4e6e(++_0x1c4a78);}(_0xb81f,0x17a));var _0xfb81=function(_0x32ca3c,_0x16f889){_0x32ca3c=_0x32ca3c-0x0;var _0x47d9f4=_0xb81f[_0x32ca3c];return _0x47d9f4;};'use strict';var Sequelize=require('sequelize');module[_0xfb81('0x0')]={'name':{'type':Sequelize[_0xfb81('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2c4d=['exports','sequelize'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x2c4d,0x1ab));var _0xd2c4=function(_0x42e25e,_0x46cfd1){_0x42e25e=_0x42e25e-0x0;var _0x1ed3a6=_0x2c4d[_0x42e25e];return _0x1ed3a6;};'use strict';var Sequelize=require(_0xd2c4('0x0'));module[_0xd2c4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 1e99615..94ff25f 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 _0x5280=['ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','params','find','create','body','getFields','findOne','ServicenowField','order','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','set','apply','save','update','destroy','stack','name','send','index'];(function(_0x59244f,_0x5dd9d2){var _0xcbd670=function(_0x29ca5b){while(--_0x29ca5b){_0x59244f['push'](_0x59244f['shift']());}};_0xcbd670(++_0x5dd9d2);}(_0x5280,0xd2));var _0x0528=function(_0x5a4a1f,_0x3f90b6){_0x5a4a1f=_0x5a4a1f-0x0;var _0x43db26=_0x5280[_0x5a4a1f];return _0x43db26;};'use strict';var pdf=require(_0x0528('0x0'));var emlformat=require(_0x0528('0x1'));var rimraf=require(_0x0528('0x2'));var zipdir=require(_0x0528('0x3'));var jsonpatch=require(_0x0528('0x4'));var rp=require('request-promise');var moment=require(_0x0528('0x5'));var BPromise=require(_0x0528('0x6'));var Mustache=require(_0x0528('0x7'));var util=require(_0x0528('0x8'));var path=require('path');var sox=require(_0x0528('0x9'));var csv=require(_0x0528('0xa'));var ejs=require(_0x0528('0xb'));var fs=require('fs');var _=require(_0x0528('0xc'));var squel=require(_0x0528('0xd'));var crypto=require(_0x0528('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0528('0xf'));var toCsv=require(_0x0528('0xa'));var querystring=require(_0x0528('0x10'));var Papa=require(_0x0528('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0528('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0528('0x13'));var logger=require(_0x0528('0x14'))('api');var utils=require(_0x0528('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0528('0x16'));var db=require(_0x0528('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1eaaa2,_0x220f00,_0x29e636,_0x3acfc7){return new BPromise(function(_0x5bf509,_0x3689c3){var _0x4067be=_0x3acfc7||client;return _0x4067be[_0x0528('0x18')](_0x1eaaa2,_0x29e636)[_0x0528('0x19')](function(_0x2fe3a0){logger[_0x0528('0x1a')](_0x0528('0x1b'),_0x220f00,_0x0528('0x1c'));logger[_0x0528('0x1d')](_0x0528('0x1e'),_0x220f00,_0x0528('0x1c'),JSON[_0x0528('0x1f')](_0x2fe3a0));if(_0x2fe3a0[_0x0528('0x20')]){if(_0x2fe3a0[_0x0528('0x20')][_0x0528('0x21')]===0x1f4){logger[_0x0528('0x20')](_0x0528('0x1b'),_0x220f00,_0x2fe3a0['error'][_0x0528('0x22')]);return _0x3689c3(_0x2fe3a0[_0x0528('0x20')][_0x0528('0x22')]);}logger['error'](_0x0528('0x1b'),_0x220f00,_0x2fe3a0[_0x0528('0x20')][_0x0528('0x22')]);return _0x5bf509(_0x2fe3a0['error'][_0x0528('0x22')]);}else{logger['info'](_0x0528('0x1b'),_0x220f00,'request\x20sent');_0x5bf509(_0x2fe3a0[_0x0528('0x23')]['message']);}})[_0x0528('0x24')](function(_0x3ecb98){logger[_0x0528('0x20')](_0x0528('0x1b'),_0x220f00,_0x3ecb98);_0x3689c3(_0x3ecb98);});});}function respondWithStatusCode(_0x1073e1,_0x49984e){_0x49984e=_0x49984e||0xcc;return function(_0x584c34){if(_0x584c34){return _0x1073e1['sendStatus'](_0x49984e);}return _0x1073e1[_0x0528('0x25')](_0x49984e)[_0x0528('0x26')]();};}function respondWithResult(_0x40be61,_0x2188f5){_0x2188f5=_0x2188f5||0xc8;return function(_0x373fa1){if(_0x373fa1){return _0x40be61[_0x0528('0x25')](_0x2188f5)[_0x0528('0x27')](_0x373fa1);}};}function respondWithFilteredResult(_0xe69d9f,_0x206a3a){return function(_0x5c0ae7){if(_0x5c0ae7){var _0x2ddc40=_0x5c0ae7[_0x0528('0x28')],_0x3cacc9=_0x206a3a[_0x0528('0x29')],_0x5897fe=_0x206a3a['offset']+_0x206a3a['limit'],_0xe9d97b;if(_0x5897fe>=_0x2ddc40){_0x5897fe=_0x2ddc40;_0xe9d97b=0xc8;}else{_0xe9d97b=0xce;}_0xe69d9f[_0x0528('0x25')](_0xe9d97b);return _0xe69d9f[_0x0528('0x2a')]('Content-Range',_0x3cacc9+'-'+_0x5897fe+'/'+_0x2ddc40)[_0x0528('0x27')](_0x5c0ae7);}return null;};}function patchUpdates(_0x2b45ed){return function(_0x380fc4){try{jsonpatch[_0x0528('0x2b')](_0x380fc4,_0x2b45ed,!![]);}catch(_0xd96fb4){return BPromise['reject'](_0xd96fb4);}return _0x380fc4[_0x0528('0x2c')]();};}function saveUpdates(_0x35912e,_0x267ec9){return function(_0x47d134){if(_0x47d134){return _0x47d134[_0x0528('0x2d')](_0x35912e)[_0x0528('0x19')](function(_0x3ffb7c){return _0x3ffb7c;});}return null;};}function removeEntity(_0x2261c3,_0x58690a){return function(_0x6d54bf){if(_0x6d54bf){return _0x6d54bf[_0x0528('0x2e')]()[_0x0528('0x19')](function(){_0x2261c3[_0x0528('0x25')](0xcc)[_0x0528('0x26')]();});}};}function handleEntityNotFound(_0x4a5a79,_0x29f0b0){return function(_0x28b2a6){if(!_0x28b2a6){_0x4a5a79['sendStatus'](0x194);}return _0x28b2a6;};}function handleError(_0x49e363,_0x4a4e90){_0x4a4e90=_0x4a4e90||0x1f4;return function(_0x314ea7){logger['error'](_0x314ea7[_0x0528('0x2f')]);if(_0x314ea7[_0x0528('0x30')]){delete _0x314ea7[_0x0528('0x30')];}_0x49e363[_0x0528('0x25')](_0x4a4e90)[_0x0528('0x31')](_0x314ea7);};}exports[_0x0528('0x32')]=function(_0x36fad1,_0x1ae6af){var _0x20f59c={},_0x23d15d={},_0x4469c7={'count':0x0,'rows':[]};var _0x4d2bbd=_['map'](db[_0x0528('0x33')][_0x0528('0x34')],function(_0x1e7142){return{'name':_0x1e7142[_0x0528('0x35')],'type':_0x1e7142[_0x0528('0x36')][_0x0528('0x37')]};});_0x23d15d[_0x0528('0x38')]=_[_0x0528('0x39')](_0x4d2bbd,_0x0528('0x30'));_0x23d15d[_0x0528('0x3a')]=_[_0x0528('0x3b')](_0x36fad1[_0x0528('0x3a')]);_0x23d15d[_0x0528('0x3c')]=_['intersection'](_0x23d15d['model'],_0x23d15d[_0x0528('0x3a')]);_0x20f59c[_0x0528('0x3d')]=_[_0x0528('0x3e')](_0x23d15d[_0x0528('0x38')],qs[_0x0528('0x3f')](_0x36fad1[_0x0528('0x3a')][_0x0528('0x3f')]));_0x20f59c['attributes']=_0x20f59c['attributes'][_0x0528('0x40')]?_0x20f59c[_0x0528('0x3d')]:_0x23d15d[_0x0528('0x38')];if(!_0x36fad1[_0x0528('0x3a')][_0x0528('0x41')](_0x0528('0x42'))){_0x20f59c[_0x0528('0x43')]=qs[_0x0528('0x43')](_0x36fad1[_0x0528('0x3a')][_0x0528('0x43')]);_0x20f59c[_0x0528('0x29')]=qs['offset'](_0x36fad1[_0x0528('0x3a')][_0x0528('0x29')]);}_0x20f59c['order']=qs[_0x0528('0x44')](_0x36fad1[_0x0528('0x3a')][_0x0528('0x44')]);_0x20f59c[_0x0528('0x45')]=qs[_0x0528('0x3c')](_[_0x0528('0x46')](_0x36fad1['query'],_0x23d15d['filters']),_0x4d2bbd);if(_0x36fad1[_0x0528('0x3a')][_0x0528('0x47')]){_0x20f59c[_0x0528('0x45')]=_[_0x0528('0x48')](_0x20f59c['where'],{'$or':_[_0x0528('0x39')](_0x4d2bbd,function(_0x57043b){if(_0x57043b['type']!==_0x0528('0x49')){var _0x127f06={};_0x127f06[_0x57043b[_0x0528('0x30')]]={'$like':'%'+_0x36fad1[_0x0528('0x3a')][_0x0528('0x47')]+'%'};return _0x127f06;}})});}_0x20f59c=_[_0x0528('0x48')]({},_0x20f59c,_0x36fad1[_0x0528('0x4a')]);var _0x4838c0={'where':_0x20f59c[_0x0528('0x45')]};return db[_0x0528('0x33')][_0x0528('0x28')](_0x4838c0)[_0x0528('0x19')](function(_0x5aed8b){_0x4469c7[_0x0528('0x28')]=_0x5aed8b;if(_0x36fad1[_0x0528('0x3a')]['includeAll']){_0x20f59c[_0x0528('0x4b')]=[{'all':!![]}];}return db[_0x0528('0x33')][_0x0528('0x4c')](_0x20f59c);})['then'](function(_0x553c30){_0x4469c7['rows']=_0x553c30;return _0x4469c7;})[_0x0528('0x19')](respondWithFilteredResult(_0x1ae6af,_0x20f59c))[_0x0528('0x24')](handleError(_0x1ae6af,null));};exports['show']=function(_0x3fd4f1,_0x17869a){var _0x3f8222={'raw':![],'where':{'id':_0x3fd4f1[_0x0528('0x4d')]['id']}},_0x4c7c02={};_0x4c7c02[_0x0528('0x38')]=_['keys'](db[_0x0528('0x33')][_0x0528('0x34')]);_0x4c7c02[_0x0528('0x3a')]=_[_0x0528('0x3b')](_0x3fd4f1[_0x0528('0x3a')]);_0x4c7c02[_0x0528('0x3c')]=_[_0x0528('0x3e')](_0x4c7c02[_0x0528('0x38')],_0x4c7c02[_0x0528('0x3a')]);_0x3f8222[_0x0528('0x3d')]=_[_0x0528('0x3e')](_0x4c7c02[_0x0528('0x38')],qs[_0x0528('0x3f')](_0x3fd4f1['query'][_0x0528('0x3f')]));_0x3f8222['attributes']=_0x3f8222[_0x0528('0x3d')][_0x0528('0x40')]?_0x3f8222[_0x0528('0x3d')]:_0x4c7c02[_0x0528('0x38')];if(_0x3fd4f1[_0x0528('0x3a')]['includeAll']){_0x3f8222['include']=[{'all':!![]}];}_0x3f8222=_[_0x0528('0x48')]({},_0x3f8222,_0x3fd4f1[_0x0528('0x4a')]);return db[_0x0528('0x33')][_0x0528('0x4e')](_0x3f8222)[_0x0528('0x19')](handleEntityNotFound(_0x17869a,null))['then'](respondWithResult(_0x17869a,null))[_0x0528('0x24')](handleError(_0x17869a,null));};exports[_0x0528('0x4f')]=function(_0x24b281,_0x2f90da){return db['ServicenowConfiguration'][_0x0528('0x4f')](_0x24b281[_0x0528('0x50')],{})['then'](respondWithResult(_0x2f90da,0xc9))[_0x0528('0x24')](handleError(_0x2f90da,null));};exports['update']=function(_0xb740b,_0x579fb0){if(_0xb740b[_0x0528('0x50')]['id']){delete _0xb740b[_0x0528('0x50')]['id'];}return db[_0x0528('0x33')][_0x0528('0x4e')]({'where':{'id':_0xb740b[_0x0528('0x4d')]['id']}})[_0x0528('0x19')](handleEntityNotFound(_0x579fb0,null))[_0x0528('0x19')](saveUpdates(_0xb740b[_0x0528('0x50')],null))[_0x0528('0x19')](respondWithResult(_0x579fb0,null))[_0x0528('0x24')](handleError(_0x579fb0,null));};exports[_0x0528('0x2e')]=function(_0x165465,_0x5de33a){return db['ServicenowConfiguration'][_0x0528('0x4e')]({'where':{'id':_0x165465[_0x0528('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5de33a,null))[_0x0528('0x19')](removeEntity(_0x5de33a,null))[_0x0528('0x24')](handleError(_0x5de33a,null));};exports[_0x0528('0x51')]=function(_0x3e7795,_0x3e5031,_0x31de33){var _0xec7d30={};var _0x10e0c7={};var _0x2dd9df;var _0x2b75af;return db['ServicenowConfiguration'][_0x0528('0x52')]({'where':{'id':_0x3e7795[_0x0528('0x4d')]['id']}})[_0x0528('0x19')](handleEntityNotFound(_0x3e5031,null))[_0x0528('0x19')](function(_0x466c89){if(_0x466c89){_0x2dd9df=_0x466c89;_0x10e0c7[_0x0528('0x38')]=_[_0x0528('0x3b')](db[_0x0528('0x53')][_0x0528('0x34')]);_0x10e0c7[_0x0528('0x3a')]=_[_0x0528('0x3b')](_0x3e7795[_0x0528('0x3a')]);_0x10e0c7['filters']=_[_0x0528('0x3e')](_0x10e0c7[_0x0528('0x38')],_0x10e0c7[_0x0528('0x3a')]);_0xec7d30[_0x0528('0x3d')]=_[_0x0528('0x3e')](_0x10e0c7[_0x0528('0x38')],qs[_0x0528('0x3f')](_0x3e7795[_0x0528('0x3a')]['fields']));_0xec7d30[_0x0528('0x3d')]=_0xec7d30[_0x0528('0x3d')][_0x0528('0x40')]?_0xec7d30[_0x0528('0x3d')]:_0x10e0c7[_0x0528('0x38')];_0xec7d30[_0x0528('0x54')]=qs[_0x0528('0x44')](_0x3e7795[_0x0528('0x3a')][_0x0528('0x44')]);_0xec7d30[_0x0528('0x45')]=qs[_0x0528('0x3c')](_[_0x0528('0x46')](_0x3e7795['query'],_0x10e0c7['filters']));if(_0x3e7795['query'][_0x0528('0x47')]){_0xec7d30[_0x0528('0x45')]=_[_0x0528('0x48')](_0xec7d30[_0x0528('0x45')],{'$or':_[_0x0528('0x39')](_0xec7d30['attributes'],function(_0x59087a){var _0x9c42ce={};_0x9c42ce[_0x59087a]={'$like':'%'+_0x3e7795[_0x0528('0x3a')][_0x0528('0x47')]+'%'};return _0x9c42ce;})});}_0xec7d30=_['merge']({},_0xec7d30,_0x3e7795['options']);return _0x2dd9df['getFields'](_0xec7d30);}})[_0x0528('0x19')](function(_0x2cf83d){if(_0x2cf83d){_0x2b75af=_0x2cf83d[_0x0528('0x40')];if(!_0x3e7795[_0x0528('0x3a')][_0x0528('0x41')]('nolimit')){_0xec7d30[_0x0528('0x43')]=qs['limit'](_0x3e7795[_0x0528('0x3a')][_0x0528('0x43')]);_0xec7d30[_0x0528('0x29')]=qs[_0x0528('0x29')](_0x3e7795[_0x0528('0x3a')][_0x0528('0x29')]);}return _0x2dd9df[_0x0528('0x51')](_0xec7d30);}})[_0x0528('0x19')](function(_0x193da8){if(_0x193da8){return _0x193da8?{'count':_0x2b75af,'rows':_0x193da8}:null;}})[_0x0528('0x19')](respondWithResult(_0x3e5031,null))[_0x0528('0x24')](handleError(_0x3e5031,null));};exports['getSubjects']=function(_0x5d4a10,_0x2cd764,_0x7c8511){var _0x32bd9a={};var _0x2b1649={};var _0x1b577d;var _0x411995;return db[_0x0528('0x33')]['findOne']({'where':{'id':_0x5d4a10['params']['id']}})['then'](handleEntityNotFound(_0x2cd764,null))['then'](function(_0x888fc){if(_0x888fc){_0x1b577d=_0x888fc;_0x2b1649['model']=_[_0x0528('0x3b')](db['ServicenowField'][_0x0528('0x34')]);_0x2b1649[_0x0528('0x3a')]=_[_0x0528('0x3b')](_0x5d4a10[_0x0528('0x3a')]);_0x2b1649[_0x0528('0x3c')]=_[_0x0528('0x3e')](_0x2b1649['model'],_0x2b1649['query']);_0x32bd9a[_0x0528('0x3d')]=_[_0x0528('0x3e')](_0x2b1649[_0x0528('0x38')],qs['fields'](_0x5d4a10[_0x0528('0x3a')][_0x0528('0x3f')]));_0x32bd9a[_0x0528('0x3d')]=_0x32bd9a[_0x0528('0x3d')]['length']?_0x32bd9a[_0x0528('0x3d')]:_0x2b1649['model'];_0x32bd9a[_0x0528('0x54')]=qs[_0x0528('0x44')](_0x5d4a10['query'][_0x0528('0x44')]);_0x32bd9a[_0x0528('0x45')]=qs[_0x0528('0x3c')](_[_0x0528('0x46')](_0x5d4a10[_0x0528('0x3a')],_0x2b1649[_0x0528('0x3c')]));if(_0x5d4a10[_0x0528('0x3a')][_0x0528('0x47')]){_0x32bd9a['where']=_[_0x0528('0x48')](_0x32bd9a[_0x0528('0x45')],{'$or':_['map'](_0x32bd9a['attributes'],function(_0x4f94e0){var _0x32921b={};_0x32921b[_0x4f94e0]={'$like':'%'+_0x5d4a10[_0x0528('0x3a')][_0x0528('0x47')]+'%'};return _0x32921b;})});}_0x32bd9a=_['merge']({},_0x32bd9a,_0x5d4a10[_0x0528('0x4a')]);return _0x1b577d['getSubjects'](_0x32bd9a);}})[_0x0528('0x19')](function(_0x4824fd){if(_0x4824fd){_0x411995=_0x4824fd['length'];if(!_0x5d4a10[_0x0528('0x3a')][_0x0528('0x41')]('nolimit')){_0x32bd9a[_0x0528('0x43')]=qs[_0x0528('0x43')](_0x5d4a10['query']['limit']);_0x32bd9a[_0x0528('0x29')]=qs['offset'](_0x5d4a10[_0x0528('0x3a')][_0x0528('0x29')]);}return _0x1b577d[_0x0528('0x55')](_0x32bd9a);}})['then'](function(_0x2af3fc){if(_0x2af3fc){return _0x2af3fc?{'count':_0x411995,'rows':_0x2af3fc}:null;}})[_0x0528('0x19')](respondWithResult(_0x2cd764,null))[_0x0528('0x24')](handleError(_0x2cd764,null));};exports[_0x0528('0x56')]=function(_0x3c1d18,_0x63db1a,_0x3b27ec){var _0x394b31={};var _0x210529={};var _0x39857c;var _0x104a4a;return db['ServicenowConfiguration'][_0x0528('0x52')]({'where':{'id':_0x3c1d18[_0x0528('0x4d')]['id']}})[_0x0528('0x19')](handleEntityNotFound(_0x63db1a,null))['then'](function(_0x13dcb7){if(_0x13dcb7){_0x39857c=_0x13dcb7;_0x210529['model']=_[_0x0528('0x3b')](db[_0x0528('0x53')]['rawAttributes']);_0x210529[_0x0528('0x3a')]=_[_0x0528('0x3b')](_0x3c1d18[_0x0528('0x3a')]);_0x210529[_0x0528('0x3c')]=_['intersection'](_0x210529[_0x0528('0x38')],_0x210529[_0x0528('0x3a')]);_0x394b31[_0x0528('0x3d')]=_['intersection'](_0x210529['model'],qs['fields'](_0x3c1d18[_0x0528('0x3a')]['fields']));_0x394b31[_0x0528('0x3d')]=_0x394b31[_0x0528('0x3d')][_0x0528('0x40')]?_0x394b31[_0x0528('0x3d')]:_0x210529['model'];_0x394b31[_0x0528('0x54')]=qs['sort'](_0x3c1d18[_0x0528('0x3a')][_0x0528('0x44')]);_0x394b31[_0x0528('0x45')]=qs[_0x0528('0x3c')](_[_0x0528('0x46')](_0x3c1d18[_0x0528('0x3a')],_0x210529['filters']));if(_0x3c1d18[_0x0528('0x3a')][_0x0528('0x47')]){_0x394b31[_0x0528('0x45')]=_[_0x0528('0x48')](_0x394b31[_0x0528('0x45')],{'$or':_[_0x0528('0x39')](_0x394b31[_0x0528('0x3d')],function(_0x2c9865){var _0x1988f5={};_0x1988f5[_0x2c9865]={'$like':'%'+_0x3c1d18['query'][_0x0528('0x47')]+'%'};return _0x1988f5;})});}_0x394b31=_['merge']({},_0x394b31,_0x3c1d18['options']);return _0x39857c['getDescriptions'](_0x394b31);}})['then'](function(_0x8d11c4){if(_0x8d11c4){_0x104a4a=_0x8d11c4[_0x0528('0x40')];if(!_0x3c1d18[_0x0528('0x3a')]['hasOwnProperty'](_0x0528('0x42'))){_0x394b31[_0x0528('0x43')]=qs[_0x0528('0x43')](_0x3c1d18[_0x0528('0x3a')][_0x0528('0x43')]);_0x394b31[_0x0528('0x29')]=qs[_0x0528('0x29')](_0x3c1d18[_0x0528('0x3a')][_0x0528('0x29')]);}return _0x39857c[_0x0528('0x56')](_0x394b31);}})[_0x0528('0x19')](function(_0x52c502){if(_0x52c502){return _0x52c502?{'count':_0x104a4a,'rows':_0x52c502}:null;}})[_0x0528('0x19')](respondWithResult(_0x63db1a,null))[_0x0528('0x24')](handleError(_0x63db1a,null));}; \ No newline at end of file +var _0x148c=['api','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','count','offset','Content-Range','json','save','destroy','name','index','map','ServicenowConfiguration','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','find','create','update','body','ServicenowField','pick','getFields','nolimit','getSubjects','findOne','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x195919,_0x177c79){var _0x2aa39d=function(_0x31841c){while(--_0x31841c){_0x195919['push'](_0x195919['shift']());}};_0x2aa39d(++_0x177c79);}(_0x148c,0x140));var _0xc148=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x148c[_0x278e3c];return _0x3e2d9b;};'use strict';var pdf=require(_0xc148('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc148('0x1'));var zipdir=require(_0xc148('0x2'));var jsonpatch=require(_0xc148('0x3'));var rp=require(_0xc148('0x4'));var moment=require(_0xc148('0x5'));var BPromise=require(_0xc148('0x6'));var Mustache=require(_0xc148('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc148('0x8'));var csv=require(_0xc148('0x9'));var ejs=require(_0xc148('0xa'));var fs=require('fs');var _=require(_0xc148('0xb'));var squel=require(_0xc148('0xc'));var crypto=require(_0xc148('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc148('0xe'));var toCsv=require(_0xc148('0x9'));var querystring=require('querystring');var Papa=require(_0xc148('0xf'));var Redis=require('ioredis');var authService=require(_0xc148('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc148('0x11'));var hardwareService=require(_0xc148('0x12'));var logger=require(_0xc148('0x13'))(_0xc148('0x14'));var utils=require(_0xc148('0x15'));var config=require(_0xc148('0x16'));var licenseUtil=require(_0xc148('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xc148('0x18')][_0xc148('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x312bd1,_0xaf16f9,_0x5d7481,_0x1a7226){return new BPromise(function(_0x2255b6,_0xe1431f){var _0x11b55a=_0x1a7226||client;return _0x11b55a[_0xc148('0x1a')](_0x312bd1,_0x5d7481)[_0xc148('0x1b')](function(_0x7d6f08){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0xaf16f9,_0xc148('0x1c'));logger[_0xc148('0x1d')](_0xc148('0x1e'),_0xaf16f9,_0xc148('0x1c'),JSON['stringify'](_0x7d6f08));if(_0x7d6f08['error']){if(_0x7d6f08[_0xc148('0x1f')]['code']===0x1f4){logger[_0xc148('0x1f')](_0xc148('0x20'),_0xaf16f9,_0x7d6f08[_0xc148('0x1f')][_0xc148('0x21')]);return _0xe1431f(_0x7d6f08[_0xc148('0x1f')]['message']);}logger[_0xc148('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s',_0xaf16f9,_0x7d6f08[_0xc148('0x1f')][_0xc148('0x21')]);return _0x2255b6(_0x7d6f08[_0xc148('0x1f')][_0xc148('0x21')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0xaf16f9,'request\x20sent');_0x2255b6(_0x7d6f08[_0xc148('0x22')][_0xc148('0x21')]);}})[_0xc148('0x23')](function(_0x35432e){logger['error'](_0xc148('0x20'),_0xaf16f9,_0x35432e);_0xe1431f(_0x35432e);});});}function respondWithStatusCode(_0x30548b,_0x28054f){_0x28054f=_0x28054f||0xcc;return function(_0x3ac297){if(_0x3ac297){return _0x30548b[_0xc148('0x24')](_0x28054f);}return _0x30548b['status'](_0x28054f)[_0xc148('0x25')]();};}function respondWithResult(_0x48f6c9,_0x482b33){_0x482b33=_0x482b33||0xc8;return function(_0x28de61){if(_0x28de61){return _0x48f6c9[_0xc148('0x26')](_0x482b33)['json'](_0x28de61);}};}function respondWithFilteredResult(_0x2aa8f4,_0x464871){return function(_0x185128){if(_0x185128){var _0x1e6d07=_0x185128[_0xc148('0x27')],_0x1cb259=_0x464871[_0xc148('0x28')],_0x2da587=_0x464871[_0xc148('0x28')]+_0x464871['limit'],_0x253398;if(_0x2da587>=_0x1e6d07){_0x2da587=_0x1e6d07;_0x253398=0xc8;}else{_0x253398=0xce;}_0x2aa8f4['status'](_0x253398);return _0x2aa8f4['set'](_0xc148('0x29'),_0x1cb259+'-'+_0x2da587+'/'+_0x1e6d07)[_0xc148('0x2a')](_0x185128);}return null;};}function patchUpdates(_0x143936){return function(_0x26a6a2){try{jsonpatch['apply'](_0x26a6a2,_0x143936,!![]);}catch(_0x4e2bec){return BPromise['reject'](_0x4e2bec);}return _0x26a6a2[_0xc148('0x2b')]();};}function saveUpdates(_0x130afd,_0x1000ee){return function(_0x1afd9d){if(_0x1afd9d){return _0x1afd9d['update'](_0x130afd)[_0xc148('0x1b')](function(_0x359884){return _0x359884;});}return null;};}function removeEntity(_0x2babe6,_0x51c9c1){return function(_0x163fd7){if(_0x163fd7){return _0x163fd7[_0xc148('0x2c')]()[_0xc148('0x1b')](function(){_0x2babe6[_0xc148('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d0cc7,_0x36c66f){return function(_0x462e){if(!_0x462e){_0x3d0cc7[_0xc148('0x24')](0x194);}return _0x462e;};}function handleError(_0x2cc886,_0xdb6193){_0xdb6193=_0xdb6193||0x1f4;return function(_0x275d86){logger['error'](_0x275d86['stack']);if(_0x275d86[_0xc148('0x2d')]){delete _0x275d86[_0xc148('0x2d')];}_0x2cc886[_0xc148('0x26')](_0xdb6193)['send'](_0x275d86);};}exports[_0xc148('0x2e')]=function(_0xe3d762,_0x1e2add){var _0x325aff={},_0x36cb5f={},_0x3a0c92={'count':0x0,'rows':[]};var _0x2325ef=_[_0xc148('0x2f')](db[_0xc148('0x30')][_0xc148('0x31')],function(_0x33d11b){return{'name':_0x33d11b['fieldName'],'type':_0x33d11b['type'][_0xc148('0x32')]};});_0x36cb5f[_0xc148('0x33')]=_['map'](_0x2325ef,_0xc148('0x2d'));_0x36cb5f['query']=_['keys'](_0xe3d762[_0xc148('0x34')]);_0x36cb5f['filters']=_[_0xc148('0x35')](_0x36cb5f[_0xc148('0x33')],_0x36cb5f['query']);_0x325aff[_0xc148('0x36')]=_['intersection'](_0x36cb5f[_0xc148('0x33')],qs[_0xc148('0x37')](_0xe3d762['query'][_0xc148('0x37')]));_0x325aff[_0xc148('0x36')]=_0x325aff[_0xc148('0x36')][_0xc148('0x38')]?_0x325aff[_0xc148('0x36')]:_0x36cb5f[_0xc148('0x33')];if(!_0xe3d762[_0xc148('0x34')][_0xc148('0x39')]('nolimit')){_0x325aff[_0xc148('0x3a')]=qs[_0xc148('0x3a')](_0xe3d762[_0xc148('0x34')][_0xc148('0x3a')]);_0x325aff[_0xc148('0x28')]=qs[_0xc148('0x28')](_0xe3d762[_0xc148('0x34')][_0xc148('0x28')]);}_0x325aff[_0xc148('0x3b')]=qs['sort'](_0xe3d762[_0xc148('0x34')][_0xc148('0x3c')]);_0x325aff['where']=qs[_0xc148('0x3d')](_['pick'](_0xe3d762[_0xc148('0x34')],_0x36cb5f[_0xc148('0x3d')]),_0x2325ef);if(_0xe3d762[_0xc148('0x34')][_0xc148('0x3e')]){_0x325aff[_0xc148('0x3f')]=_['merge'](_0x325aff[_0xc148('0x3f')],{'$or':_[_0xc148('0x2f')](_0x2325ef,function(_0x69213a){if(_0x69213a[_0xc148('0x40')]!==_0xc148('0x41')){var _0x3702e6={};_0x3702e6[_0x69213a[_0xc148('0x2d')]]={'$like':'%'+_0xe3d762[_0xc148('0x34')][_0xc148('0x3e')]+'%'};return _0x3702e6;}})});}_0x325aff=_[_0xc148('0x42')]({},_0x325aff,_0xe3d762[_0xc148('0x43')]);var _0x36ac60={'where':_0x325aff[_0xc148('0x3f')]};return db[_0xc148('0x30')][_0xc148('0x27')](_0x36ac60)[_0xc148('0x1b')](function(_0x72fe19){_0x3a0c92[_0xc148('0x27')]=_0x72fe19;if(_0xe3d762[_0xc148('0x34')][_0xc148('0x44')]){_0x325aff[_0xc148('0x45')]=[{'all':!![]}];}return db[_0xc148('0x30')][_0xc148('0x46')](_0x325aff);})[_0xc148('0x1b')](function(_0x25040c){_0x3a0c92['rows']=_0x25040c;return _0x3a0c92;})[_0xc148('0x1b')](respondWithFilteredResult(_0x1e2add,_0x325aff))['catch'](handleError(_0x1e2add,null));};exports[_0xc148('0x47')]=function(_0x1d024e,_0x5eccf1){var _0x5897df={'raw':![],'where':{'id':_0x1d024e[_0xc148('0x48')]['id']}},_0x9f020f={};_0x9f020f[_0xc148('0x33')]=_[_0xc148('0x49')](db[_0xc148('0x30')][_0xc148('0x31')]);_0x9f020f['query']=_[_0xc148('0x49')](_0x1d024e['query']);_0x9f020f[_0xc148('0x3d')]=_[_0xc148('0x35')](_0x9f020f[_0xc148('0x33')],_0x9f020f[_0xc148('0x34')]);_0x5897df[_0xc148('0x36')]=_[_0xc148('0x35')](_0x9f020f[_0xc148('0x33')],qs[_0xc148('0x37')](_0x1d024e['query'][_0xc148('0x37')]));_0x5897df[_0xc148('0x36')]=_0x5897df[_0xc148('0x36')][_0xc148('0x38')]?_0x5897df[_0xc148('0x36')]:_0x9f020f[_0xc148('0x33')];if(_0x1d024e[_0xc148('0x34')][_0xc148('0x44')]){_0x5897df[_0xc148('0x45')]=[{'all':!![]}];}_0x5897df=_[_0xc148('0x42')]({},_0x5897df,_0x1d024e[_0xc148('0x43')]);return db[_0xc148('0x30')][_0xc148('0x4a')](_0x5897df)['then'](handleEntityNotFound(_0x5eccf1,null))[_0xc148('0x1b')](respondWithResult(_0x5eccf1,null))['catch'](handleError(_0x5eccf1,null));};exports[_0xc148('0x4b')]=function(_0x27e00a,_0x507997){return db[_0xc148('0x30')][_0xc148('0x4b')](_0x27e00a['body'],{})[_0xc148('0x1b')](respondWithResult(_0x507997,0xc9))[_0xc148('0x23')](handleError(_0x507997,null));};exports[_0xc148('0x4c')]=function(_0x5f0d49,_0x372a12){if(_0x5f0d49['body']['id']){delete _0x5f0d49[_0xc148('0x4d')]['id'];}return db[_0xc148('0x30')][_0xc148('0x4a')]({'where':{'id':_0x5f0d49[_0xc148('0x48')]['id']}})[_0xc148('0x1b')](handleEntityNotFound(_0x372a12,null))[_0xc148('0x1b')](saveUpdates(_0x5f0d49[_0xc148('0x4d')],null))[_0xc148('0x1b')](respondWithResult(_0x372a12,null))[_0xc148('0x23')](handleError(_0x372a12,null));};exports[_0xc148('0x2c')]=function(_0x4d38d7,_0x1fbc0a){return db[_0xc148('0x30')][_0xc148('0x4a')]({'where':{'id':_0x4d38d7[_0xc148('0x48')]['id']}})[_0xc148('0x1b')](handleEntityNotFound(_0x1fbc0a,null))[_0xc148('0x1b')](removeEntity(_0x1fbc0a,null))[_0xc148('0x23')](handleError(_0x1fbc0a,null));};exports['getFields']=function(_0x2494c3,_0x531bff,_0x322bef){var _0x34c3b8={};var _0x46aadc={};var _0x5e2d6c;var _0x2d2786;return db[_0xc148('0x30')]['findOne']({'where':{'id':_0x2494c3[_0xc148('0x48')]['id']}})[_0xc148('0x1b')](handleEntityNotFound(_0x531bff,null))[_0xc148('0x1b')](function(_0xbf8456){if(_0xbf8456){_0x5e2d6c=_0xbf8456;_0x46aadc[_0xc148('0x33')]=_[_0xc148('0x49')](db[_0xc148('0x4e')][_0xc148('0x31')]);_0x46aadc[_0xc148('0x34')]=_['keys'](_0x2494c3[_0xc148('0x34')]);_0x46aadc[_0xc148('0x3d')]=_['intersection'](_0x46aadc[_0xc148('0x33')],_0x46aadc['query']);_0x34c3b8['attributes']=_[_0xc148('0x35')](_0x46aadc[_0xc148('0x33')],qs[_0xc148('0x37')](_0x2494c3[_0xc148('0x34')][_0xc148('0x37')]));_0x34c3b8[_0xc148('0x36')]=_0x34c3b8[_0xc148('0x36')][_0xc148('0x38')]?_0x34c3b8[_0xc148('0x36')]:_0x46aadc['model'];_0x34c3b8[_0xc148('0x3b')]=qs[_0xc148('0x3c')](_0x2494c3[_0xc148('0x34')][_0xc148('0x3c')]);_0x34c3b8['where']=qs[_0xc148('0x3d')](_[_0xc148('0x4f')](_0x2494c3[_0xc148('0x34')],_0x46aadc[_0xc148('0x3d')]));if(_0x2494c3[_0xc148('0x34')][_0xc148('0x3e')]){_0x34c3b8[_0xc148('0x3f')]=_[_0xc148('0x42')](_0x34c3b8[_0xc148('0x3f')],{'$or':_[_0xc148('0x2f')](_0x34c3b8[_0xc148('0x36')],function(_0x375a2e){var _0x2776fd={};_0x2776fd[_0x375a2e]={'$like':'%'+_0x2494c3['query'][_0xc148('0x3e')]+'%'};return _0x2776fd;})});}_0x34c3b8=_[_0xc148('0x42')]({},_0x34c3b8,_0x2494c3[_0xc148('0x43')]);return _0x5e2d6c[_0xc148('0x50')](_0x34c3b8);}})[_0xc148('0x1b')](function(_0x2fdd43){if(_0x2fdd43){_0x2d2786=_0x2fdd43['length'];if(!_0x2494c3['query'][_0xc148('0x39')](_0xc148('0x51'))){_0x34c3b8[_0xc148('0x3a')]=qs[_0xc148('0x3a')](_0x2494c3[_0xc148('0x34')][_0xc148('0x3a')]);_0x34c3b8[_0xc148('0x28')]=qs['offset'](_0x2494c3[_0xc148('0x34')][_0xc148('0x28')]);}return _0x5e2d6c['getFields'](_0x34c3b8);}})[_0xc148('0x1b')](function(_0x45e398){if(_0x45e398){return _0x45e398?{'count':_0x2d2786,'rows':_0x45e398}:null;}})[_0xc148('0x1b')](respondWithResult(_0x531bff,null))['catch'](handleError(_0x531bff,null));};exports[_0xc148('0x52')]=function(_0xb0347f,_0x35f9ed,_0xab04df){var _0x4e1205={};var _0x2c859e={};var _0xf8f8cf;var _0x1fbc01;return db[_0xc148('0x30')][_0xc148('0x53')]({'where':{'id':_0xb0347f[_0xc148('0x48')]['id']}})[_0xc148('0x1b')](handleEntityNotFound(_0x35f9ed,null))['then'](function(_0x345e3d){if(_0x345e3d){_0xf8f8cf=_0x345e3d;_0x2c859e[_0xc148('0x33')]=_['keys'](db[_0xc148('0x4e')]['rawAttributes']);_0x2c859e[_0xc148('0x34')]=_[_0xc148('0x49')](_0xb0347f[_0xc148('0x34')]);_0x2c859e[_0xc148('0x3d')]=_[_0xc148('0x35')](_0x2c859e['model'],_0x2c859e[_0xc148('0x34')]);_0x4e1205[_0xc148('0x36')]=_['intersection'](_0x2c859e[_0xc148('0x33')],qs[_0xc148('0x37')](_0xb0347f['query'][_0xc148('0x37')]));_0x4e1205[_0xc148('0x36')]=_0x4e1205[_0xc148('0x36')][_0xc148('0x38')]?_0x4e1205['attributes']:_0x2c859e[_0xc148('0x33')];_0x4e1205[_0xc148('0x3b')]=qs[_0xc148('0x3c')](_0xb0347f[_0xc148('0x34')]['sort']);_0x4e1205['where']=qs['filters'](_[_0xc148('0x4f')](_0xb0347f[_0xc148('0x34')],_0x2c859e['filters']));if(_0xb0347f['query'][_0xc148('0x3e')]){_0x4e1205[_0xc148('0x3f')]=_['merge'](_0x4e1205[_0xc148('0x3f')],{'$or':_['map'](_0x4e1205['attributes'],function(_0x227573){var _0x16e39d={};_0x16e39d[_0x227573]={'$like':'%'+_0xb0347f[_0xc148('0x34')][_0xc148('0x3e')]+'%'};return _0x16e39d;})});}_0x4e1205=_['merge']({},_0x4e1205,_0xb0347f[_0xc148('0x43')]);return _0xf8f8cf['getSubjects'](_0x4e1205);}})['then'](function(_0x1e8891){if(_0x1e8891){_0x1fbc01=_0x1e8891[_0xc148('0x38')];if(!_0xb0347f['query']['hasOwnProperty']('nolimit')){_0x4e1205[_0xc148('0x3a')]=qs['limit'](_0xb0347f[_0xc148('0x34')][_0xc148('0x3a')]);_0x4e1205['offset']=qs[_0xc148('0x28')](_0xb0347f[_0xc148('0x34')][_0xc148('0x28')]);}return _0xf8f8cf[_0xc148('0x52')](_0x4e1205);}})[_0xc148('0x1b')](function(_0x3b2c03){if(_0x3b2c03){return _0x3b2c03?{'count':_0x1fbc01,'rows':_0x3b2c03}:null;}})['then'](respondWithResult(_0x35f9ed,null))[_0xc148('0x23')](handleError(_0x35f9ed,null));};exports[_0xc148('0x54')]=function(_0x2d82fb,_0x3c9bb5,_0x3911d5){var _0x1403f9={};var _0x4c738d={};var _0xf9a2c8;var _0x163b5e;return db[_0xc148('0x30')]['findOne']({'where':{'id':_0x2d82fb[_0xc148('0x48')]['id']}})[_0xc148('0x1b')](handleEntityNotFound(_0x3c9bb5,null))[_0xc148('0x1b')](function(_0x5ea3b3){if(_0x5ea3b3){_0xf9a2c8=_0x5ea3b3;_0x4c738d['model']=_[_0xc148('0x49')](db[_0xc148('0x4e')][_0xc148('0x31')]);_0x4c738d[_0xc148('0x34')]=_[_0xc148('0x49')](_0x2d82fb['query']);_0x4c738d[_0xc148('0x3d')]=_[_0xc148('0x35')](_0x4c738d[_0xc148('0x33')],_0x4c738d['query']);_0x1403f9[_0xc148('0x36')]=_[_0xc148('0x35')](_0x4c738d[_0xc148('0x33')],qs[_0xc148('0x37')](_0x2d82fb[_0xc148('0x34')][_0xc148('0x37')]));_0x1403f9[_0xc148('0x36')]=_0x1403f9[_0xc148('0x36')][_0xc148('0x38')]?_0x1403f9[_0xc148('0x36')]:_0x4c738d[_0xc148('0x33')];_0x1403f9['order']=qs[_0xc148('0x3c')](_0x2d82fb[_0xc148('0x34')][_0xc148('0x3c')]);_0x1403f9[_0xc148('0x3f')]=qs[_0xc148('0x3d')](_[_0xc148('0x4f')](_0x2d82fb[_0xc148('0x34')],_0x4c738d[_0xc148('0x3d')]));if(_0x2d82fb[_0xc148('0x34')][_0xc148('0x3e')]){_0x1403f9[_0xc148('0x3f')]=_[_0xc148('0x42')](_0x1403f9[_0xc148('0x3f')],{'$or':_[_0xc148('0x2f')](_0x1403f9['attributes'],function(_0x25ebe7){var _0x2a2761={};_0x2a2761[_0x25ebe7]={'$like':'%'+_0x2d82fb[_0xc148('0x34')][_0xc148('0x3e')]+'%'};return _0x2a2761;})});}_0x1403f9=_[_0xc148('0x42')]({},_0x1403f9,_0x2d82fb[_0xc148('0x43')]);return _0xf9a2c8[_0xc148('0x54')](_0x1403f9);}})[_0xc148('0x1b')](function(_0x1b6aa9){if(_0x1b6aa9){_0x163b5e=_0x1b6aa9['length'];if(!_0x2d82fb['query'][_0xc148('0x39')]('nolimit')){_0x1403f9[_0xc148('0x3a')]=qs[_0xc148('0x3a')](_0x2d82fb[_0xc148('0x34')][_0xc148('0x3a')]);_0x1403f9['offset']=qs['offset'](_0x2d82fb[_0xc148('0x34')][_0xc148('0x28')]);}return _0xf9a2c8[_0xc148('0x54')](_0x1403f9);}})[_0xc148('0x1b')](function(_0x365390){if(_0x365390){return _0x365390?{'count':_0x163b5e,'rows':_0x365390}:null;}})[_0xc148('0x1b')](respondWithResult(_0x3c9bb5,null))[_0xc148('0x23')](handleError(_0x3c9bb5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index ec2f907..11d078d 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 _0x4a1a=['lodash','util','../../config/logger','api','bluebird','path','rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x1b2dd5,_0x2be65f){var _0x4767ec=function(_0x1ebb13){while(--_0x1ebb13){_0x1b2dd5['push'](_0x1b2dd5['shift']());}};_0x4767ec(++_0x2be65f);}(_0x4a1a,0xf0));var _0xa4a1=function(_0x5455a4,_0x2cec94){_0x5455a4=_0x5455a4-0x0;var _0x3c967b=_0x4a1a[_0x5455a4];return _0x3c967b;};'use strict';var _=require(_0xa4a1('0x0'));var util=require(_0xa4a1('0x1'));var logger=require(_0xa4a1('0x2'))(_0xa4a1('0x3'));var moment=require('moment');var BPromise=require(_0xa4a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa4a1('0x5'));var rimraf=require(_0xa4a1('0x6'));var config=require('../../config/environment');var attributes=require(_0xa4a1('0x7'));module[_0xa4a1('0x8')]=function(_0x126216,_0xa77013){return _0x126216[_0xa4a1('0x9')](_0xa4a1('0xa'),attributes,{'tableName':_0xa4a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87ea=['rimraf','exports','ServicenowConfiguration','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x87ea,0x8a));var _0xa87e=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0x87ea[_0x37b7b6];return _0x10c4c3;};'use strict';var _=require('lodash');var util=require(_0xa87e('0x0'));var logger=require(_0xa87e('0x1'))(_0xa87e('0x2'));var moment=require(_0xa87e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa87e('0x4'));var fs=require('fs');var path=require(_0xa87e('0x5'));var rimraf=require(_0xa87e('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xa87e('0x7')]=function(_0x3bd7bb,_0x409ad0){return _0x3bd7bb['define'](_0xa87e('0x8'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 6d512cb..65bc816 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 _0x3730=['error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4ec7f2,_0x3d92d2){var _0x118004=function(_0x1ac4fb){while(--_0x1ac4fb){_0x4ec7f2['push'](_0x4ec7f2['shift']());}};_0x118004(++_0x3d92d2);}(_0x3730,0x148));var _0x0373=function(_0x17d422,_0x54f4bb){_0x17d422=_0x17d422-0x0;var _0x10f751=_0x3730[_0x17d422];return _0x10f751;};'use strict';var _=require(_0x0373('0x0'));var util=require(_0x0373('0x1'));var moment=require('moment');var BPromise=require(_0x0373('0x2'));var rs=require(_0x0373('0x3'));var fs=require('fs');var Redis=require(_0x0373('0x4'));var db=require(_0x0373('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0373('0x6'))(_0x0373('0x7'));var config=require(_0x0373('0x8'));var jayson=require(_0x0373('0x9'));var client=jayson[_0x0373('0xa')][_0x0373('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c6df,_0x5eb405,_0x99b300){return new BPromise(function(_0x547604,_0x442e6b){return client['request'](_0x6c6df,_0x99b300)['then'](function(_0x25eea8){logger[_0x0373('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5eb405,_0x0373('0xd'));logger[_0x0373('0xe')](_0x0373('0xf'),_0x5eb405,_0x0373('0xd'),JSON[_0x0373('0x10')](_0x25eea8));if(_0x25eea8['error']){if(_0x25eea8[_0x0373('0x11')][_0x0373('0x12')]===0x1f4){logger['error'](_0x0373('0x13'),_0x5eb405,_0x25eea8[_0x0373('0x11')][_0x0373('0x14')]);return _0x442e6b(_0x25eea8[_0x0373('0x11')]['message']);}logger['error'](_0x0373('0x13'),_0x5eb405,_0x25eea8[_0x0373('0x11')][_0x0373('0x14')]);return _0x547604(_0x25eea8[_0x0373('0x11')]['message']);}else{logger[_0x0373('0xc')](_0x0373('0x13'),_0x5eb405,_0x0373('0xd'));_0x547604(_0x25eea8[_0x0373('0x15')][_0x0373('0x14')]);}})[_0x0373('0x16')](function(_0x264a52){logger[_0x0373('0x11')](_0x0373('0x13'),_0x5eb405,_0x264a52);_0x442e6b(_0x264a52);});});} \ No newline at end of file +var _0x4617=['info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x221054,_0x144661){var _0x2bb1e7=function(_0x54ae15){while(--_0x54ae15){_0x221054['push'](_0x221054['shift']());}};_0x2bb1e7(++_0x144661);}(_0x4617,0x163));var _0x7461=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4617[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x7461('0x0'));var util=require(_0x7461('0x1'));var moment=require(_0x7461('0x2'));var BPromise=require(_0x7461('0x3'));var rs=require(_0x7461('0x4'));var fs=require('fs');var Redis=require(_0x7461('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7461('0x6'));var logger=require(_0x7461('0x7'))(_0x7461('0x8'));var config=require(_0x7461('0x9'));var jayson=require(_0x7461('0xa'));var client=jayson[_0x7461('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d1d23,_0x2406ef,_0xe614f){return new BPromise(function(_0x2aafa6,_0x3e01da){return client[_0x7461('0xc')](_0x2d1d23,_0xe614f)['then'](function(_0x436ac5){logger[_0x7461('0xd')](_0x7461('0xe'),_0x2406ef,'request\x20sent');logger[_0x7461('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x2406ef,_0x7461('0x10'),JSON[_0x7461('0x11')](_0x436ac5));if(_0x436ac5['error']){if(_0x436ac5['error'][_0x7461('0x12')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x2406ef,_0x436ac5[_0x7461('0x13')][_0x7461('0x14')]);return _0x3e01da(_0x436ac5['error']['message']);}logger[_0x7461('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2406ef,_0x436ac5[_0x7461('0x13')][_0x7461('0x14')]);return _0x2aafa6(_0x436ac5[_0x7461('0x13')]['message']);}else{logger[_0x7461('0xd')](_0x7461('0xe'),_0x2406ef,_0x7461('0x10'));_0x2aafa6(_0x436ac5[_0x7461('0x15')][_0x7461('0x14')]);}})[_0x7461('0x16')](function(_0x3a0fe){logger[_0x7461('0x13')](_0x7461('0xe'),_0x2406ef,_0x3a0fe);_0x3e01da(_0x3a0fe);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index dd2091f..aa9c6a9 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 _0xd842=['update','delete','destroy','exports','multer','util','path','express','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd842,0x134));var _0x2d84=function(_0x555764,_0x5534a8){_0x555764=_0x555764-0x0;var _0x5aec28=_0xd842[_0x555764];return _0x5aec28;};'use strict';var multer=require(_0x2d84('0x0'));var util=require(_0x2d84('0x1'));var path=require(_0x2d84('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d84('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2d84('0x4'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x2d84('0x5')]('/',auth[_0x2d84('0x6')](),controller[_0x2d84('0x7')]);router[_0x2d84('0x5')](_0x2d84('0x8'),auth[_0x2d84('0x6')](),controller['show']);router[_0x2d84('0x9')]('/',auth[_0x2d84('0x6')](),controller[_0x2d84('0xa')]);router[_0x2d84('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2d84('0xc')]);router[_0x2d84('0xd')](_0x2d84('0x8'),auth[_0x2d84('0x6')](),controller[_0x2d84('0xe')]);module[_0x2d84('0xf')]=router; \ No newline at end of file +var _0x6037=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports'];(function(_0xd98a91,_0x4f429f){var _0x20a2c7=function(_0x73b9b){while(--_0x73b9b){_0xd98a91['push'](_0xd98a91['shift']());}};_0x20a2c7(++_0x4f429f);}(_0x6037,0xea));var _0x7603=function(_0x1ca316,_0x1280be){_0x1ca316=_0x1ca316-0x0;var _0x29f476=_0x6037[_0x1ca316];return _0x29f476;};'use strict';var multer=require('multer');var util=require(_0x7603('0x0'));var path=require(_0x7603('0x1'));var timeout=require(_0x7603('0x2'));var express=require(_0x7603('0x3'));var router=express[_0x7603('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7603('0x5'));var config=require(_0x7603('0x6'));var controller=require('./intServicenowField.controller');router[_0x7603('0x7')]('/',auth['isAuthenticated'](),controller[_0x7603('0x8')]);router[_0x7603('0x7')](_0x7603('0x9'),auth[_0x7603('0xa')](),controller['show']);router[_0x7603('0xb')]('/',auth['isAuthenticated'](),controller[_0x7603('0xc')]);router[_0x7603('0xd')](_0x7603('0x9'),auth[_0x7603('0xa')](),controller[_0x7603('0xe')]);router[_0x7603('0xf')](_0x7603('0x9'),auth['isAuthenticated'](),controller[_0x7603('0x10')]);module[_0x7603('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 2a9db12..f3a2968 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 _0x46ed=['sequelize','exports','string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN'];(function(_0x22ae67,_0x1d3acc){var _0x5c83b3=function(_0x105f14){while(--_0x105f14){_0x22ae67['push'](_0x22ae67['shift']());}};_0x5c83b3(++_0x1d3acc);}(_0x46ed,0x168));var _0xd46e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x46ed[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd46e('0x2'),_0xd46e('0x3'),_0xd46e('0x4'),'keyValue',_0xd46e('0x5')),'defaultValue':_0xd46e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd46e('0x6')]},'keyType':{'type':Sequelize[_0xd46e('0x7')](_0xd46e('0x2'),_0xd46e('0x3'),_0xd46e('0x4'))},'keyContent':{'type':Sequelize[_0xd46e('0x6')]},'idField':{'type':Sequelize[_0xd46e('0x6')]},'nameField':{'type':Sequelize[_0xd46e('0x6')]},'customField':{'type':Sequelize[_0xd46e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd46e('0x6')]}}; \ No newline at end of file +var _0x5fd1=['variable','picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string'];(function(_0xcd389e,_0xaa53b4){var _0x3bef5c=function(_0x4b54fb){while(--_0x4b54fb){_0xcd389e['push'](_0xcd389e['shift']());}};_0x3bef5c(++_0xaa53b4);}(_0x5fd1,0x155));var _0x15fd=function(_0xfa4104,_0xaf200c){_0xfa4104=_0xfa4104-0x0;var _0x34e2e9=_0x5fd1[_0xfa4104];return _0x34e2e9;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'type':{'type':Sequelize[_0x15fd('0x1')](_0x15fd('0x2'),_0x15fd('0x3'),'customVariable','keyValue',_0x15fd('0x4')),'defaultValue':_0x15fd('0x2')},'content':{'type':Sequelize[_0x15fd('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x15fd('0x1')](_0x15fd('0x2'),_0x15fd('0x3'),_0x15fd('0x6'))},'keyContent':{'type':Sequelize[_0x15fd('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x15fd('0x5')]},'customField':{'type':Sequelize[_0x15fd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x15fd('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 72ee68a..cdb0796 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 _0x282b=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x282b,0xec));var _0xb282=function(_0x48c9eb,_0x323b4f){_0x48c9eb=_0x48c9eb-0x0;var _0x294dda=_0x282b[_0x48c9eb];return _0x294dda;};'use strict';var pdf=require(_0xb282('0x0'));var emlformat=require(_0xb282('0x1'));var rimraf=require(_0xb282('0x2'));var zipdir=require(_0xb282('0x3'));var jsonpatch=require(_0xb282('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb282('0x5'));var Mustache=require('mustache');var util=require(_0xb282('0x6'));var path=require(_0xb282('0x7'));var sox=require(_0xb282('0x8'));var csv=require(_0xb282('0x9'));var ejs=require(_0xb282('0xa'));var fs=require('fs');var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=_0x13cea1['count'],_0x7c20df=_0x5bc7c3[_0xb282('0x19')],_0xbb182=_0x5bc7c3[_0xb282('0x19')]+_0x5bc7c3[_0xb282('0x1a')],_0x438a05;if(_0xbb182>=_0x350676){_0xbb182=_0x350676;_0x438a05=0xc8;}else{_0x438a05=0xce;}_0x525cfa[_0xb282('0x18')](_0x438a05);return _0x525cfa[_0xb282('0x1b')]('Content-Range',_0x7c20df+'-'+_0xbb182+'/'+_0x350676)['json'](_0x13cea1);}return null;};}function patchUpdates(_0xcea320){return function(_0x2cdeb1){try{jsonpatch['apply'](_0x2cdeb1,_0xcea320,!![]);}catch(_0x89543a){return BPromise[_0xb282('0x1c')](_0x89543a);}return _0x2cdeb1[_0xb282('0x1d')]();};}function saveUpdates(_0x438dbe,_0x1c3084){return function(_0x533147){if(_0x533147){return _0x533147[_0xb282('0x1e')](_0x438dbe)[_0xb282('0x1f')](function(_0x1f3e12){return _0x1f3e12;});}return null;};}function removeEntity(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x20')]()[_0xb282('0x1f')](function(){_0x4b79d7[_0xb282('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d624f,_0x360f15){return function(_0x3c7f1f){if(!_0x3c7f1f){_0x4d624f['sendStatus'](0x194);}return _0x3c7f1f;};}function handleError(_0x5e828e,_0x34774d){_0x34774d=_0x34774d||0x1f4;return function(_0x114f77){logger[_0xb282('0x21')](_0x114f77[_0xb282('0x22')]);if(_0x114f77[_0xb282('0x23')]){delete _0x114f77[_0xb282('0x23')];}_0x5e828e['status'](_0x34774d)[_0xb282('0x24')](_0x114f77);};}exports[_0xb282('0x25')]=function(_0x50bd73,_0x22d895){var _0x38a1f8={},_0x2a4491={},_0x280940={'count':0x0,'rows':[]};var _0x59644e=_[_0xb282('0x26')](db[_0xb282('0x27')][_0xb282('0x28')],function(_0x433ad5){return{'name':_0x433ad5[_0xb282('0x29')],'type':_0x433ad5[_0xb282('0x2a')][_0xb282('0x2b')]};});_0x2a4491['model']=_[_0xb282('0x26')](_0x59644e,_0xb282('0x23'));_0x2a4491[_0xb282('0x2c')]=_[_0xb282('0x2d')](_0x50bd73[_0xb282('0x2c')]);_0x2a4491['filters']=_[_0xb282('0x2e')](_0x2a4491['model'],_0x2a4491[_0xb282('0x2c')]);_0x38a1f8[_0xb282('0x2f')]=_[_0xb282('0x2e')](_0x2a4491['model'],qs[_0xb282('0x30')](_0x50bd73['query'][_0xb282('0x30')]));_0x38a1f8[_0xb282('0x2f')]=_0x38a1f8[_0xb282('0x2f')][_0xb282('0x31')]?_0x38a1f8[_0xb282('0x2f')]:_0x2a4491[_0xb282('0x32')];if(!_0x50bd73['query'][_0xb282('0x33')](_0xb282('0x34'))){_0x38a1f8['limit']=qs['limit'](_0x50bd73[_0xb282('0x2c')][_0xb282('0x1a')]);_0x38a1f8[_0xb282('0x19')]=qs['offset'](_0x50bd73['query']['offset']);}_0x38a1f8[_0xb282('0x35')]=qs[_0xb282('0x36')](_0x50bd73[_0xb282('0x2c')][_0xb282('0x36')]);_0x38a1f8[_0xb282('0x37')]=qs[_0xb282('0x38')](_[_0xb282('0x39')](_0x50bd73['query'],_0x2a4491[_0xb282('0x38')]),_0x59644e);if(_0x50bd73['query'][_0xb282('0x3a')]){_0x38a1f8[_0xb282('0x37')]=_[_0xb282('0x3b')](_0x38a1f8['where'],{'$or':_[_0xb282('0x26')](_0x59644e,function(_0x4beef2){if(_0x4beef2[_0xb282('0x2a')]!==_0xb282('0x3c')){var _0x1deac2={};_0x1deac2[_0x4beef2[_0xb282('0x23')]]={'$like':'%'+_0x50bd73['query']['filter']+'%'};return _0x1deac2;}})});}_0x38a1f8=_[_0xb282('0x3b')]({},_0x38a1f8,_0x50bd73[_0xb282('0x3d')]);var _0x3791fd={'where':_0x38a1f8[_0xb282('0x37')]};return db['ServicenowField'][_0xb282('0x3e')](_0x3791fd)['then'](function(_0x475895){_0x280940[_0xb282('0x3e')]=_0x475895;if(_0x50bd73['query'][_0xb282('0x3f')]){_0x38a1f8[_0xb282('0x40')]=[{'all':!![]}];}return db[_0xb282('0x27')][_0xb282('0x41')](_0x38a1f8);})[_0xb282('0x1f')](function(_0x23c6b8){_0x280940[_0xb282('0x42')]=_0x23c6b8;return _0x280940;})[_0xb282('0x1f')](respondWithFilteredResult(_0x22d895,_0x38a1f8))[_0xb282('0x43')](handleError(_0x22d895,null));};exports[_0xb282('0x44')]=function(_0x461e17,_0x91fe43){var _0x1caff0={'raw':!![],'where':{'id':_0x461e17[_0xb282('0x45')]['id']}},_0x138a72={};_0x138a72[_0xb282('0x32')]=_[_0xb282('0x2d')](db[_0xb282('0x27')]['rawAttributes']);_0x138a72[_0xb282('0x2c')]=_['keys'](_0x461e17[_0xb282('0x2c')]);_0x138a72[_0xb282('0x38')]=_[_0xb282('0x2e')](_0x138a72[_0xb282('0x32')],_0x138a72[_0xb282('0x2c')]);_0x1caff0[_0xb282('0x2f')]=_['intersection'](_0x138a72['model'],qs[_0xb282('0x30')](_0x461e17['query'][_0xb282('0x30')]));_0x1caff0[_0xb282('0x2f')]=_0x1caff0['attributes'][_0xb282('0x31')]?_0x1caff0[_0xb282('0x2f')]:_0x138a72[_0xb282('0x32')];if(_0x461e17['query']['includeAll']){_0x1caff0[_0xb282('0x40')]=[{'all':!![]}];}_0x1caff0=_['merge']({},_0x1caff0,_0x461e17[_0xb282('0x3d')]);return db[_0xb282('0x27')][_0xb282('0x46')](_0x1caff0)[_0xb282('0x1f')](handleEntityNotFound(_0x91fe43,null))[_0xb282('0x1f')](respondWithResult(_0x91fe43,null))[_0xb282('0x43')](handleError(_0x91fe43,null));};exports['create']=function(_0x1c95c8,_0xb0cf81){return db[_0xb282('0x27')]['create'](_0x1c95c8[_0xb282('0x47')],{})['then'](respondWithResult(_0xb0cf81,0xc9))[_0xb282('0x43')](handleError(_0xb0cf81,null));};exports['update']=function(_0x1bf51c,_0x4ac56f){if(_0x1bf51c['body']['id']){delete _0x1bf51c['body']['id'];}return db[_0xb282('0x27')][_0xb282('0x46')]({'where':{'id':_0x1bf51c[_0xb282('0x45')]['id']}})[_0xb282('0x1f')](handleEntityNotFound(_0x4ac56f,null))['then'](saveUpdates(_0x1bf51c['body'],null))['then'](respondWithResult(_0x4ac56f,null))[_0xb282('0x43')](handleError(_0x4ac56f,null));};exports[_0xb282('0x20')]=function(_0x3bed8d,_0x1ab323){return db['ServicenowField'][_0xb282('0x46')]({'where':{'id':_0x3bed8d[_0xb282('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ab323,null))[_0xb282('0x1f')](removeEntity(_0x1ab323,null))[_0xb282('0x43')](handleError(_0x1ab323,null));}; \ No newline at end of file +var _0x3eae=['stack','name','send','map','ServicenowField','rawAttributes','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','intersection','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','then','destroy','error'];(function(_0x2598b3,_0x1cc0a8){var _0x55607f=function(_0x3b37fd){while(--_0x3b37fd){_0x2598b3['push'](_0x2598b3['shift']());}};_0x55607f(++_0x1cc0a8);}(_0x3eae,0x66));var _0xe3ea=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0x3eae[_0x575057];return _0x49dbc8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe3ea('0x0'));var zipdir=require(_0xe3ea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3ea('0x2'));var moment=require(_0xe3ea('0x3'));var BPromise=require(_0xe3ea('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe3ea('0x5'));var sox=require(_0xe3ea('0x6'));var csv=require('to-csv');var ejs=require(_0xe3ea('0x7'));var fs=require('fs');var _=require(_0xe3ea('0x8'));var squel=require('squel');var crypto=require(_0xe3ea('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe3ea('0xa'));var toCsv=require(_0xe3ea('0xb'));var querystring=require(_0xe3ea('0xc'));var Papa=require('papaparse');var Redis=require(_0xe3ea('0xd'));var authService=require(_0xe3ea('0xe'));var qs=require(_0xe3ea('0xf'));var as=require(_0xe3ea('0x10'));var hardwareService=require(_0xe3ea('0x11'));var logger=require(_0xe3ea('0x12'))(_0xe3ea('0x13'));var utils=require(_0xe3ea('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe3ea('0x15'))['db'];function respondWithStatusCode(_0x6a9294,_0x36c2dd){_0x36c2dd=_0x36c2dd||0xcc;return function(_0x247139){if(_0x247139){return _0x6a9294[_0xe3ea('0x16')](_0x36c2dd);}return _0x6a9294[_0xe3ea('0x17')](_0x36c2dd)[_0xe3ea('0x18')]();};}function respondWithResult(_0x2b36ec,_0x31357a){_0x31357a=_0x31357a||0xc8;return function(_0x11f560){if(_0x11f560){return _0x2b36ec[_0xe3ea('0x17')](_0x31357a)[_0xe3ea('0x19')](_0x11f560);}};}function respondWithFilteredResult(_0x445775,_0x492c29){return function(_0x3c3700){if(_0x3c3700){var _0x2a086a=_0x3c3700[_0xe3ea('0x1a')],_0x1d686c=_0x492c29[_0xe3ea('0x1b')],_0x6f5ab2=_0x492c29[_0xe3ea('0x1b')]+_0x492c29[_0xe3ea('0x1c')],_0x3d12be;if(_0x6f5ab2>=_0x2a086a){_0x6f5ab2=_0x2a086a;_0x3d12be=0xc8;}else{_0x3d12be=0xce;}_0x445775[_0xe3ea('0x17')](_0x3d12be);return _0x445775[_0xe3ea('0x1d')](_0xe3ea('0x1e'),_0x1d686c+'-'+_0x6f5ab2+'/'+_0x2a086a)[_0xe3ea('0x19')](_0x3c3700);}return null;};}function patchUpdates(_0x2bc16c){return function(_0x2a397b){try{jsonpatch[_0xe3ea('0x1f')](_0x2a397b,_0x2bc16c,!![]);}catch(_0x1280be){return BPromise[_0xe3ea('0x20')](_0x1280be);}return _0x2a397b[_0xe3ea('0x21')]();};}function saveUpdates(_0x29e32e,_0xd61c1c){return function(_0x339d08){if(_0x339d08){return _0x339d08[_0xe3ea('0x22')](_0x29e32e)[_0xe3ea('0x23')](function(_0x2462c4){return _0x2462c4;});}return null;};}function removeEntity(_0x4a537d,_0x5ed42a){return function(_0x4f0e9e){if(_0x4f0e9e){return _0x4f0e9e[_0xe3ea('0x24')]()['then'](function(){_0x4a537d['status'](0xcc)[_0xe3ea('0x18')]();});}};}function handleEntityNotFound(_0x19dd53,_0x4cda82){return function(_0x3766eb){if(!_0x3766eb){_0x19dd53[_0xe3ea('0x16')](0x194);}return _0x3766eb;};}function handleError(_0x594ba1,_0xd023cc){_0xd023cc=_0xd023cc||0x1f4;return function(_0x4bb839){logger[_0xe3ea('0x25')](_0x4bb839[_0xe3ea('0x26')]);if(_0x4bb839[_0xe3ea('0x27')]){delete _0x4bb839['name'];}_0x594ba1[_0xe3ea('0x17')](_0xd023cc)[_0xe3ea('0x28')](_0x4bb839);};}exports['index']=function(_0x522a3f,_0x5518d3){var _0x5bd356={},_0x58e3ff={},_0x5f1eff={'count':0x0,'rows':[]};var _0x3accb1=_[_0xe3ea('0x29')](db[_0xe3ea('0x2a')][_0xe3ea('0x2b')],function(_0x5395fa){return{'name':_0x5395fa['fieldName'],'type':_0x5395fa[_0xe3ea('0x2c')]['key']};});_0x58e3ff[_0xe3ea('0x2d')]=_[_0xe3ea('0x29')](_0x3accb1,_0xe3ea('0x27'));_0x58e3ff['query']=_['keys'](_0x522a3f[_0xe3ea('0x2e')]);_0x58e3ff[_0xe3ea('0x2f')]=_['intersection'](_0x58e3ff[_0xe3ea('0x2d')],_0x58e3ff[_0xe3ea('0x2e')]);_0x5bd356[_0xe3ea('0x30')]=_['intersection'](_0x58e3ff[_0xe3ea('0x2d')],qs[_0xe3ea('0x31')](_0x522a3f['query'][_0xe3ea('0x31')]));_0x5bd356[_0xe3ea('0x30')]=_0x5bd356[_0xe3ea('0x30')][_0xe3ea('0x32')]?_0x5bd356[_0xe3ea('0x30')]:_0x58e3ff[_0xe3ea('0x2d')];if(!_0x522a3f[_0xe3ea('0x2e')][_0xe3ea('0x33')](_0xe3ea('0x34'))){_0x5bd356['limit']=qs['limit'](_0x522a3f[_0xe3ea('0x2e')][_0xe3ea('0x1c')]);_0x5bd356[_0xe3ea('0x1b')]=qs[_0xe3ea('0x1b')](_0x522a3f[_0xe3ea('0x2e')][_0xe3ea('0x1b')]);}_0x5bd356['order']=qs['sort'](_0x522a3f[_0xe3ea('0x2e')][_0xe3ea('0x35')]);_0x5bd356[_0xe3ea('0x36')]=qs[_0xe3ea('0x2f')](_[_0xe3ea('0x37')](_0x522a3f[_0xe3ea('0x2e')],_0x58e3ff[_0xe3ea('0x2f')]),_0x3accb1);if(_0x522a3f[_0xe3ea('0x2e')][_0xe3ea('0x38')]){_0x5bd356[_0xe3ea('0x36')]=_['merge'](_0x5bd356[_0xe3ea('0x36')],{'$or':_[_0xe3ea('0x29')](_0x3accb1,function(_0x24c06b){if(_0x24c06b['type']!=='VIRTUAL'){var _0x4f1300={};_0x4f1300[_0x24c06b[_0xe3ea('0x27')]]={'$like':'%'+_0x522a3f[_0xe3ea('0x2e')]['filter']+'%'};return _0x4f1300;}})});}_0x5bd356=_[_0xe3ea('0x39')]({},_0x5bd356,_0x522a3f[_0xe3ea('0x3a')]);var _0x1823d5={'where':_0x5bd356['where']};return db[_0xe3ea('0x2a')][_0xe3ea('0x1a')](_0x1823d5)[_0xe3ea('0x23')](function(_0x3a3b6c){_0x5f1eff['count']=_0x3a3b6c;if(_0x522a3f[_0xe3ea('0x2e')][_0xe3ea('0x3b')]){_0x5bd356[_0xe3ea('0x3c')]=[{'all':!![]}];}return db['ServicenowField'][_0xe3ea('0x3d')](_0x5bd356);})[_0xe3ea('0x23')](function(_0x16e150){_0x5f1eff[_0xe3ea('0x3e')]=_0x16e150;return _0x5f1eff;})[_0xe3ea('0x23')](respondWithFilteredResult(_0x5518d3,_0x5bd356))[_0xe3ea('0x3f')](handleError(_0x5518d3,null));};exports['show']=function(_0x420f56,_0x50bc87){var _0x90a15b={'raw':!![],'where':{'id':_0x420f56[_0xe3ea('0x40')]['id']}},_0x899be6={};_0x899be6['model']=_[_0xe3ea('0x41')](db['ServicenowField'][_0xe3ea('0x2b')]);_0x899be6[_0xe3ea('0x2e')]=_[_0xe3ea('0x41')](_0x420f56['query']);_0x899be6['filters']=_[_0xe3ea('0x42')](_0x899be6['model'],_0x899be6[_0xe3ea('0x2e')]);_0x90a15b['attributes']=_[_0xe3ea('0x42')](_0x899be6[_0xe3ea('0x2d')],qs[_0xe3ea('0x31')](_0x420f56[_0xe3ea('0x2e')][_0xe3ea('0x31')]));_0x90a15b[_0xe3ea('0x30')]=_0x90a15b['attributes'][_0xe3ea('0x32')]?_0x90a15b[_0xe3ea('0x30')]:_0x899be6[_0xe3ea('0x2d')];if(_0x420f56[_0xe3ea('0x2e')][_0xe3ea('0x3b')]){_0x90a15b['include']=[{'all':!![]}];}_0x90a15b=_[_0xe3ea('0x39')]({},_0x90a15b,_0x420f56[_0xe3ea('0x3a')]);return db[_0xe3ea('0x2a')][_0xe3ea('0x43')](_0x90a15b)[_0xe3ea('0x23')](handleEntityNotFound(_0x50bc87,null))['then'](respondWithResult(_0x50bc87,null))[_0xe3ea('0x3f')](handleError(_0x50bc87,null));};exports['create']=function(_0x150c67,_0x5c8ed6){return db[_0xe3ea('0x2a')][_0xe3ea('0x44')](_0x150c67['body'],{})['then'](respondWithResult(_0x5c8ed6,0xc9))[_0xe3ea('0x3f')](handleError(_0x5c8ed6,null));};exports['update']=function(_0x5806fd,_0x542996){if(_0x5806fd[_0xe3ea('0x45')]['id']){delete _0x5806fd[_0xe3ea('0x45')]['id'];}return db[_0xe3ea('0x2a')]['find']({'where':{'id':_0x5806fd[_0xe3ea('0x40')]['id']}})[_0xe3ea('0x23')](handleEntityNotFound(_0x542996,null))[_0xe3ea('0x23')](saveUpdates(_0x5806fd['body'],null))[_0xe3ea('0x23')](respondWithResult(_0x542996,null))['catch'](handleError(_0x542996,null));};exports[_0xe3ea('0x24')]=function(_0x39bfb9,_0x13871e){return db[_0xe3ea('0x2a')]['find']({'where':{'id':_0x39bfb9[_0xe3ea('0x40')]['id']}})[_0xe3ea('0x23')](handleEntityNotFound(_0x13871e,null))[_0xe3ea('0x23')](removeEntity(_0x13871e,null))[_0xe3ea('0x3f')](handleError(_0x13871e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 3045f41..c736ca0 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 _0xb552=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index'];(function(_0x353b1e,_0x1ba48e){var _0x1f9efb=function(_0x4cc968){while(--_0x4cc968){_0x353b1e['push'](_0x353b1e['shift']());}};_0x1f9efb(++_0x1ba48e);}(_0xb552,0x197));var _0x2b55=function(_0x25bf63,_0xd75ad6){_0x25bf63=_0x25bf63-0x0;var _0x267e2c=_0xb552[_0x25bf63];return _0x267e2c;};'use strict';var _=require(_0x2b55('0x0'));var util=require(_0x2b55('0x1'));var logger=require(_0x2b55('0x2'))('api');var moment=require(_0x2b55('0x3'));var BPromise=require(_0x2b55('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2b55('0x5'));var config=require(_0x2b55('0x6'));var attributes=require(_0x2b55('0x7'));module[_0x2b55('0x8')]=function(_0x3b9a9e,_0x581ca2){return _0x3b9a9e[_0x2b55('0x9')](_0x2b55('0xa'),attributes,{'tableName':_0x2b55('0xb'),'paranoid':![],'indexes':[{'name':_0x2b55('0xc'),'fields':[_0x2b55('0xd'),_0x2b55('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0958=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','int_servicenow_fields','servicenow_unique_index','FieldId','lodash'];(function(_0x1c12ba,_0x15bf45){var _0x2f9c6d=function(_0x568fe3){while(--_0x568fe3){_0x1c12ba['push'](_0x1c12ba['shift']());}};_0x2f9c6d(++_0x15bf45);}(_0x0958,0xcf));var _0x8095=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0958[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x8095('0x0'));var util=require(_0x8095('0x1'));var logger=require(_0x8095('0x2'))(_0x8095('0x3'));var moment=require(_0x8095('0x4'));var BPromise=require(_0x8095('0x5'));var rp=require(_0x8095('0x6'));var fs=require('fs');var path=require(_0x8095('0x7'));var rimraf=require('rimraf');var config=require(_0x8095('0x8'));var attributes=require(_0x8095('0x9'));module['exports']=function(_0x41b13f,_0x3665fa){return _0x41b13f['define']('ServicenowField',attributes,{'tableName':_0x8095('0xa'),'paranoid':![],'indexes':[{'name':_0x8095('0xb'),'fields':['idField',_0x8095('0xc')],'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 0a936a9..3e65ea1 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 _0x754b=['debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','ServicenowField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent'];(function(_0x5c0176,_0x552972){var _0x4e4afe=function(_0x2eabf1){while(--_0x2eabf1){_0x5c0176['push'](_0x5c0176['shift']());}};_0x4e4afe(++_0x552972);}(_0x754b,0x65));var _0xb754=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x754b[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xb754('0x0'));var util=require(_0xb754('0x1'));var moment=require(_0xb754('0x2'));var BPromise=require(_0xb754('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb754('0x4'));var db=require(_0xb754('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb754('0x6'))(_0xb754('0x7'));var config=require(_0xb754('0x8'));var jayson=require(_0xb754('0x9'));var client=jayson['client'][_0xb754('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d0ed3,_0x31f394,_0x5a1b9b){return new BPromise(function(_0x54ebd3,_0x51e649){return client[_0xb754('0xb')](_0x2d0ed3,_0x5a1b9b)[_0xb754('0xc')](function(_0x2fc280){logger['info']('ServicenowField,\x20%s,\x20%s',_0x31f394,_0xb754('0xd'));logger[_0xb754('0xe')](_0xb754('0xf'),_0x31f394,_0xb754('0xd'),JSON['stringify'](_0x2fc280));if(_0x2fc280[_0xb754('0x10')]){if(_0x2fc280['error'][_0xb754('0x11')]===0x1f4){logger[_0xb754('0x10')](_0xb754('0x12'),_0x31f394,_0x2fc280['error']['message']);return _0x51e649(_0x2fc280[_0xb754('0x10')][_0xb754('0x13')]);}logger[_0xb754('0x10')](_0xb754('0x12'),_0x31f394,_0x2fc280[_0xb754('0x10')][_0xb754('0x13')]);return _0x54ebd3(_0x2fc280['error'][_0xb754('0x13')]);}else{logger[_0xb754('0x14')](_0xb754('0x12'),_0x31f394,'request\x20sent');_0x54ebd3(_0x2fc280[_0xb754('0x15')][_0xb754('0x13')]);}})[_0xb754('0x16')](function(_0x1159a4){logger[_0xb754('0x10')](_0xb754('0x12'),_0x31f394,_0x1159a4);_0x51e649(_0x1159a4);});});} \ No newline at end of file +var _0x7165=['message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowField,\x20%s,\x20%s'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7165,0x1b9));var _0x5716=function(_0x179ee8,_0x234a72){_0x179ee8=_0x179ee8-0x0;var _0xd35dc5=_0x7165[_0x179ee8];return _0xd35dc5;};'use strict';var _=require(_0x5716('0x0'));var util=require(_0x5716('0x1'));var moment=require('moment');var BPromise=require(_0x5716('0x2'));var rs=require(_0x5716('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5716('0x4'))['db'];var utils=require(_0x5716('0x5'));var logger=require(_0x5716('0x6'))('rpc');var config=require(_0x5716('0x7'));var jayson=require(_0x5716('0x8'));var client=jayson[_0x5716('0x9')][_0x5716('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f898c,_0x3b566b,_0x16abe0){return new BPromise(function(_0x4c20b7,_0x453946){return client[_0x5716('0xb')](_0x2f898c,_0x16abe0)[_0x5716('0xc')](function(_0x3fab10){logger['info']('ServicenowField,\x20%s,\x20%s',_0x3b566b,_0x5716('0xd'));logger['debug'](_0x5716('0xe'),_0x3b566b,_0x5716('0xd'),JSON[_0x5716('0xf')](_0x3fab10));if(_0x3fab10[_0x5716('0x10')]){if(_0x3fab10[_0x5716('0x10')][_0x5716('0x11')]===0x1f4){logger[_0x5716('0x10')](_0x5716('0x12'),_0x3b566b,_0x3fab10[_0x5716('0x10')][_0x5716('0x13')]);return _0x453946(_0x3fab10[_0x5716('0x10')][_0x5716('0x13')]);}logger[_0x5716('0x10')](_0x5716('0x12'),_0x3b566b,_0x3fab10[_0x5716('0x10')][_0x5716('0x13')]);return _0x4c20b7(_0x3fab10['error'][_0x5716('0x13')]);}else{logger[_0x5716('0x14')]('ServicenowField,\x20%s,\x20%s',_0x3b566b,_0x5716('0xd'));_0x4c20b7(_0x3fab10[_0x5716('0x15')][_0x5716('0x13')]);}})[_0x5716('0x16')](function(_0x6d9ac5){logger[_0x5716('0x10')](_0x5716('0x12'),_0x3b566b,_0x6d9ac5);_0x453946(_0x6d9ac5);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index f025f97..2210c42 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 _0x2e76=['show','get','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','index','isAuthenticated'];(function(_0x518576,_0x1790a1){var _0x1317a2=function(_0x2362c2){while(--_0x2362c2){_0x518576['push'](_0x518576['shift']());}};_0x1317a2(++_0x1790a1);}(_0x2e76,0x199));var _0x62e7=function(_0x21ab3b,_0x36b587){_0x21ab3b=_0x21ab3b-0x0;var _0x50bdcc=_0x2e76[_0x21ab3b];return _0x50bdcc;};'use strict';var multer=require(_0x62e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x62e7('0x1'));var express=require('express');var router=express[_0x62e7('0x2')]();var auth=require(_0x62e7('0x3'));var interaction=require(_0x62e7('0x4'));var config=require(_0x62e7('0x5'));var controller=require(_0x62e7('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x62e7('0x7')]);router['get']('/:id',auth[_0x62e7('0x8')](),controller[_0x62e7('0x9')]);router['get']('/:id/configurations',auth[_0x62e7('0x8')](),controller['getConfigurations']);router[_0x62e7('0xa')]('/:id/fields',auth[_0x62e7('0x8')](),controller[_0x62e7('0xb')]);router[_0x62e7('0xc')]('/',auth[_0x62e7('0x8')](),controller[_0x62e7('0xd')]);router[_0x62e7('0xc')](_0x62e7('0xe'),auth[_0x62e7('0x8')](),controller[_0x62e7('0xf')]);router[_0x62e7('0x10')](_0x62e7('0x11'),auth['isAuthenticated'](),controller[_0x62e7('0x12')]);router[_0x62e7('0x13')]('/:id',auth[_0x62e7('0x8')](),controller[_0x62e7('0x14')]);module[_0x62e7('0x15')]=router; \ No newline at end of file +var _0xab6a=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','isAuthenticated','update','delete','destroy'];(function(_0x40e83a,_0x507d0c){var _0x181e5b=function(_0x152bee){while(--_0x152bee){_0x40e83a['push'](_0x40e83a['shift']());}};_0x181e5b(++_0x507d0c);}(_0xab6a,0x177));var _0xaab6=function(_0x1077d3,_0x43ad46){_0x1077d3=_0x1077d3-0x0;var _0x44a6fa=_0xab6a[_0x1077d3];return _0x44a6fa;};'use strict';var multer=require(_0xaab6('0x0'));var util=require(_0xaab6('0x1'));var path=require(_0xaab6('0x2'));var timeout=require(_0xaab6('0x3'));var express=require('express');var router=express[_0xaab6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xaab6('0x5'));var config=require(_0xaab6('0x6'));var controller=require(_0xaab6('0x7'));router[_0xaab6('0x8')]('/',auth['isAuthenticated'](),controller[_0xaab6('0x9')]);router[_0xaab6('0x8')](_0xaab6('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xaab6('0x8')](_0xaab6('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xaab6('0xc'),auth['isAuthenticated'](),controller[_0xaab6('0xd')]);router[_0xaab6('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaab6('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xaab6('0xf')]);router[_0xaab6('0x10')]('/:id',auth[_0xaab6('0x11')](),controller[_0xaab6('0x12')]);router[_0xaab6('0x13')](_0xaab6('0xa'),auth[_0xaab6('0x11')](),controller[_0xaab6('0x14')]);module[_0xaab6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 39ae9b8..3e12966 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 _0x38f0=['exports','STRING'];(function(_0x2724ab,_0x4890a8){var _0x3e05d8=function(_0x13555d){while(--_0x13555d){_0x2724ab['push'](_0x2724ab['shift']());}};_0x3e05d8(++_0x4890a8);}(_0x38f0,0x180));var _0x038f=function(_0x1cd75c,_0x9330ea){_0x1cd75c=_0x1cd75c-0x0;var _0x3ea048=_0x38f0[_0x1cd75c];return _0x3ea048;};'use strict';var Sequelize=require('sequelize');module[_0x038f('0x0')]={'name':{'type':Sequelize[_0x038f('0x1')]},'description':{'type':Sequelize[_0x038f('0x1')]},'username':{'type':Sequelize[_0x038f('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x038f('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xda00=['remoteUri','sequelize','exports','STRING'];(function(_0x62088f,_0x13fdd6){var _0x1d637f=function(_0x10c44c){while(--_0x10c44c){_0x62088f['push'](_0x62088f['shift']());}};_0x1d637f(++_0x13fdd6);}(_0xda00,0xcd));var _0x0da0=function(_0x4eb797,_0x4101d4){_0x4eb797=_0x4eb797-0x0;var _0x1b0d40=_0xda00[_0x4eb797];return _0x1b0d40;};'use strict';var Sequelize=require(_0x0da0('0x0'));module[_0x0da0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0da0('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x0da0('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0da0('0x3')},'serverUrl':{'type':Sequelize[_0x0da0('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index cc137ef..0473fd8 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 _0x0b4b=['key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','pick','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type'];(function(_0xd73d53,_0x598443){var _0x560148=function(_0x3c8918){while(--_0x3c8918){_0xd73d53['push'](_0xd73d53['shift']());}};_0x560148(++_0x598443);}(_0x0b4b,0x1e1));var _0xb0b4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x0b4b[_0x13b02f];return _0x12e9a6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb0b4('0x0'));var rimraf=require(_0xb0b4('0x1'));var zipdir=require(_0xb0b4('0x2'));var jsonpatch=require(_0xb0b4('0x3'));var rp=require(_0xb0b4('0x4'));var moment=require(_0xb0b4('0x5'));var BPromise=require(_0xb0b4('0x6'));var Mustache=require(_0xb0b4('0x7'));var util=require(_0xb0b4('0x8'));var path=require(_0xb0b4('0x9'));var sox=require(_0xb0b4('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb0b4('0xb'));var squel=require(_0xb0b4('0xc'));var crypto=require(_0xb0b4('0xd'));var jsforce=require(_0xb0b4('0xe'));var deskjs=require(_0xb0b4('0xf'));var toCsv=require(_0xb0b4('0x10'));var querystring=require(_0xb0b4('0x11'));var Papa=require(_0xb0b4('0x12'));var Redis=require(_0xb0b4('0x13'));var authService=require(_0xb0b4('0x14'));var qs=require(_0xb0b4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0b4('0x16'));var logger=require(_0xb0b4('0x17'))(_0xb0b4('0x18'));var utils=require(_0xb0b4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb0b4('0x1a'));var db=require(_0xb0b4('0x1b'))['db'];var integrations=require(_0xb0b4('0x1c'));var jayson=require('jayson/promise');var client=jayson[_0xb0b4('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x314f9b,_0x1cd294,_0x173ac6,_0x44a698){return new BPromise(function(_0x6b83f0,_0x28e12a){var _0x34b79d=_0x44a698||client;return _0x34b79d[_0xb0b4('0x1e')](_0x314f9b,_0x173ac6)[_0xb0b4('0x1f')](function(_0x1a0ac0){logger[_0xb0b4('0x20')](_0xb0b4('0x21'),_0x1cd294,_0xb0b4('0x22'));logger[_0xb0b4('0x23')](_0xb0b4('0x24'),_0x1cd294,_0xb0b4('0x22'),JSON[_0xb0b4('0x25')](_0x1a0ac0));if(_0x1a0ac0['error']){if(_0x1a0ac0[_0xb0b4('0x26')][_0xb0b4('0x27')]===0x1f4){logger[_0xb0b4('0x26')](_0xb0b4('0x21'),_0x1cd294,_0x1a0ac0[_0xb0b4('0x26')][_0xb0b4('0x28')]);return _0x28e12a(_0x1a0ac0['error']['message']);}logger[_0xb0b4('0x26')](_0xb0b4('0x21'),_0x1cd294,_0x1a0ac0[_0xb0b4('0x26')]['message']);return _0x6b83f0(_0x1a0ac0[_0xb0b4('0x26')][_0xb0b4('0x28')]);}else{logger[_0xb0b4('0x20')](_0xb0b4('0x21'),_0x1cd294,_0xb0b4('0x22'));_0x6b83f0(_0x1a0ac0[_0xb0b4('0x29')][_0xb0b4('0x28')]);}})[_0xb0b4('0x2a')](function(_0x5879eb){logger[_0xb0b4('0x26')](_0xb0b4('0x21'),_0x1cd294,_0x5879eb);_0x28e12a(_0x5879eb);});});}function respondWithStatusCode(_0x21aebc,_0x30d136){_0x30d136=_0x30d136||0xcc;return function(_0x3cf3fe){if(_0x3cf3fe){return _0x21aebc[_0xb0b4('0x2b')](_0x30d136);}return _0x21aebc[_0xb0b4('0x2c')](_0x30d136)[_0xb0b4('0x2d')]();};}function respondWithResult(_0x126466,_0x17c9a5){_0x17c9a5=_0x17c9a5||0xc8;return function(_0x4a7309){if(_0x4a7309){return _0x126466['status'](_0x17c9a5)[_0xb0b4('0x2e')](_0x4a7309);}};}function respondWithFilteredResult(_0xe798e2,_0x1a8383){return function(_0x137223){if(_0x137223){var _0x2f91ab=_0x137223['count'],_0x4813d0=_0x1a8383['offset'],_0x43c29b=_0x1a8383[_0xb0b4('0x2f')]+_0x1a8383[_0xb0b4('0x30')],_0x44345b;if(_0x43c29b>=_0x2f91ab){_0x43c29b=_0x2f91ab;_0x44345b=0xc8;}else{_0x44345b=0xce;}_0xe798e2[_0xb0b4('0x2c')](_0x44345b);return _0xe798e2[_0xb0b4('0x31')](_0xb0b4('0x32'),_0x4813d0+'-'+_0x43c29b+'/'+_0x2f91ab)[_0xb0b4('0x2e')](_0x137223);}return null;};}function patchUpdates(_0x199365){return function(_0x3ef25d){try{jsonpatch[_0xb0b4('0x33')](_0x3ef25d,_0x199365,!![]);}catch(_0x41803c){return BPromise['reject'](_0x41803c);}return _0x3ef25d[_0xb0b4('0x34')]();};}function saveUpdates(_0x1c3a72,_0x20aedd){return function(_0x46c9eb){if(_0x46c9eb){return _0x46c9eb[_0xb0b4('0x35')](_0x1c3a72)[_0xb0b4('0x1f')](function(_0x24ffe8){return _0x24ffe8;});}return null;};}function removeEntity(_0x5ac28c,_0x99a1e0){return function(_0x2fbea6){if(_0x2fbea6){return _0x2fbea6[_0xb0b4('0x36')]()[_0xb0b4('0x1f')](function(){_0x5ac28c[_0xb0b4('0x2c')](0xcc)[_0xb0b4('0x2d')]();});}};}function handleEntityNotFound(_0x19eba5,_0x147243){return function(_0x72df34){if(!_0x72df34){_0x19eba5[_0xb0b4('0x2b')](0x194);}return _0x72df34;};}function handleError(_0xe08bfd,_0x3eea67){_0x3eea67=_0x3eea67||0x1f4;return function(_0x3bbb8d){logger[_0xb0b4('0x26')](_0x3bbb8d[_0xb0b4('0x37')]);if(_0x3bbb8d[_0xb0b4('0x38')]){delete _0x3bbb8d['name'];}_0xe08bfd[_0xb0b4('0x2c')](_0x3eea67)[_0xb0b4('0x39')](_0x3bbb8d);};}exports[_0xb0b4('0x3a')]=function(_0x3fd109,_0x5332c4){var _0x5d1295={},_0x48dd87={},_0x1232c9={'count':0x0,'rows':[]};var _0x4159bf=_[_0xb0b4('0x3b')](db[_0xb0b4('0x3c')][_0xb0b4('0x3d')],function(_0x599dd3){return{'name':_0x599dd3['fieldName'],'type':_0x599dd3[_0xb0b4('0x3e')][_0xb0b4('0x3f')]};});_0x48dd87[_0xb0b4('0x40')]=_[_0xb0b4('0x3b')](_0x4159bf,'name');_0x48dd87['query']=_[_0xb0b4('0x41')](_0x3fd109[_0xb0b4('0x42')]);_0x48dd87[_0xb0b4('0x43')]=_['intersection'](_0x48dd87[_0xb0b4('0x40')],_0x48dd87[_0xb0b4('0x42')]);_0x5d1295[_0xb0b4('0x44')]=_[_0xb0b4('0x45')](_0x48dd87[_0xb0b4('0x40')],qs[_0xb0b4('0x46')](_0x3fd109[_0xb0b4('0x42')][_0xb0b4('0x46')]));_0x5d1295[_0xb0b4('0x44')]=_0x5d1295['attributes'][_0xb0b4('0x47')]?_0x5d1295['attributes']:_0x48dd87[_0xb0b4('0x40')];if(!_0x3fd109['query'][_0xb0b4('0x48')](_0xb0b4('0x49'))){_0x5d1295['limit']=qs['limit'](_0x3fd109[_0xb0b4('0x42')]['limit']);_0x5d1295[_0xb0b4('0x2f')]=qs[_0xb0b4('0x2f')](_0x3fd109[_0xb0b4('0x42')][_0xb0b4('0x2f')]);}_0x5d1295[_0xb0b4('0x4a')]=qs['sort'](_0x3fd109['query'][_0xb0b4('0x4b')]);_0x5d1295[_0xb0b4('0x4c')]=qs[_0xb0b4('0x43')](_['pick'](_0x3fd109[_0xb0b4('0x42')],_0x48dd87[_0xb0b4('0x43')]),_0x4159bf);if(_0x3fd109[_0xb0b4('0x42')][_0xb0b4('0x4d')]){_0x5d1295[_0xb0b4('0x4c')]=_[_0xb0b4('0x4e')](_0x5d1295['where'],{'$or':_[_0xb0b4('0x3b')](_0x4159bf,function(_0x157614){if(_0x157614[_0xb0b4('0x3e')]!==_0xb0b4('0x4f')){var _0x30c3fe={};_0x30c3fe[_0x157614[_0xb0b4('0x38')]]={'$like':'%'+_0x3fd109['query'][_0xb0b4('0x4d')]+'%'};return _0x30c3fe;}})});}_0x5d1295=_['merge']({},_0x5d1295,_0x3fd109[_0xb0b4('0x50')]);var _0x3a2d96={'where':_0x5d1295[_0xb0b4('0x4c')]};return db['SugarcrmAccount'][_0xb0b4('0x51')](_0x3a2d96)[_0xb0b4('0x1f')](function(_0x2bb5fe){_0x1232c9['count']=_0x2bb5fe;if(_0x3fd109['query'][_0xb0b4('0x52')]){_0x5d1295[_0xb0b4('0x53')]=[{'all':!![]}];}return db[_0xb0b4('0x3c')][_0xb0b4('0x54')](_0x5d1295);})[_0xb0b4('0x1f')](function(_0x50a473){_0x1232c9[_0xb0b4('0x55')]=_0x50a473;return _0x1232c9;})[_0xb0b4('0x1f')](respondWithFilteredResult(_0x5332c4,_0x5d1295))[_0xb0b4('0x2a')](handleError(_0x5332c4,null));};exports[_0xb0b4('0x56')]=function(_0x522342,_0x1eea86){var _0x2a1337={'raw':![],'where':{'id':_0x522342[_0xb0b4('0x57')]['id']}},_0xca0d07={};_0xca0d07[_0xb0b4('0x40')]=_[_0xb0b4('0x41')](db['SugarcrmAccount'][_0xb0b4('0x3d')]);_0xca0d07[_0xb0b4('0x42')]=_[_0xb0b4('0x41')](_0x522342[_0xb0b4('0x42')]);_0xca0d07[_0xb0b4('0x43')]=_[_0xb0b4('0x45')](_0xca0d07['model'],_0xca0d07[_0xb0b4('0x42')]);_0x2a1337['attributes']=_['intersection'](_0xca0d07[_0xb0b4('0x40')],qs[_0xb0b4('0x46')](_0x522342[_0xb0b4('0x42')][_0xb0b4('0x46')]));_0x2a1337[_0xb0b4('0x44')]=_0x2a1337[_0xb0b4('0x44')]['length']?_0x2a1337[_0xb0b4('0x44')]:_0xca0d07[_0xb0b4('0x40')];if(_0x522342[_0xb0b4('0x42')][_0xb0b4('0x52')]){_0x2a1337['include']=[{'all':!![]}];}_0x2a1337=_[_0xb0b4('0x4e')]({},_0x2a1337,_0x522342[_0xb0b4('0x50')]);return db[_0xb0b4('0x3c')][_0xb0b4('0x58')](_0x2a1337)['then'](handleEntityNotFound(_0x1eea86,null))[_0xb0b4('0x1f')](respondWithResult(_0x1eea86,null))['catch'](handleError(_0x1eea86,null));};exports[_0xb0b4('0x59')]=function(_0x1ffdd7,_0x4ca025){return db['SugarcrmAccount'][_0xb0b4('0x59')](_0x1ffdd7[_0xb0b4('0x5a')],{})[_0xb0b4('0x1f')](respondWithResult(_0x4ca025,0xc9))[_0xb0b4('0x2a')](handleError(_0x4ca025,null));};exports[_0xb0b4('0x35')]=function(_0x417eb3,_0x1d991c){if(_0x417eb3[_0xb0b4('0x5a')]['id']){delete _0x417eb3[_0xb0b4('0x5a')]['id'];}return db['SugarcrmAccount'][_0xb0b4('0x58')]({'where':{'id':_0x417eb3[_0xb0b4('0x57')]['id']}})[_0xb0b4('0x1f')](handleEntityNotFound(_0x1d991c,null))[_0xb0b4('0x1f')](saveUpdates(_0x417eb3[_0xb0b4('0x5a')],null))[_0xb0b4('0x1f')](respondWithResult(_0x1d991c,null))[_0xb0b4('0x2a')](handleError(_0x1d991c,null));};exports[_0xb0b4('0x36')]=function(_0x5ade05,_0x4411d8){return db[_0xb0b4('0x3c')][_0xb0b4('0x58')]({'where':{'id':_0x5ade05[_0xb0b4('0x57')]['id']}})[_0xb0b4('0x1f')](handleEntityNotFound(_0x4411d8,null))[_0xb0b4('0x1f')](removeEntity(_0x4411d8,null))[_0xb0b4('0x2a')](handleError(_0x4411d8,null));};exports[_0xb0b4('0x5b')]=function(_0x1d8f18,_0x33bcce,_0x2b0605){var _0x40316a={};var _0x313ae8={};var _0x3c0988;var _0x36e4cf;return db['SugarcrmAccount'][_0xb0b4('0x5c')]({'where':{'id':_0x1d8f18['params']['id']}})['then'](handleEntityNotFound(_0x33bcce,null))[_0xb0b4('0x1f')](function(_0x494b9b){if(_0x494b9b){_0x3c0988=_0x494b9b;_0x313ae8[_0xb0b4('0x40')]=_[_0xb0b4('0x41')](db['SugarcrmConfiguration']['rawAttributes']);_0x313ae8['query']=_[_0xb0b4('0x41')](_0x1d8f18['query']);_0x313ae8[_0xb0b4('0x43')]=_[_0xb0b4('0x45')](_0x313ae8['model'],_0x313ae8['query']);_0x40316a[_0xb0b4('0x44')]=_['intersection'](_0x313ae8[_0xb0b4('0x40')],qs[_0xb0b4('0x46')](_0x1d8f18['query'][_0xb0b4('0x46')]));_0x40316a[_0xb0b4('0x44')]=_0x40316a[_0xb0b4('0x44')][_0xb0b4('0x47')]?_0x40316a[_0xb0b4('0x44')]:_0x313ae8[_0xb0b4('0x40')];_0x40316a[_0xb0b4('0x4a')]=qs[_0xb0b4('0x4b')](_0x1d8f18[_0xb0b4('0x42')][_0xb0b4('0x4b')]);_0x40316a[_0xb0b4('0x4c')]=qs[_0xb0b4('0x43')](_[_0xb0b4('0x5d')](_0x1d8f18[_0xb0b4('0x42')],_0x313ae8[_0xb0b4('0x43')]));if(_0x1d8f18['query'][_0xb0b4('0x4d')]){_0x40316a[_0xb0b4('0x4c')]=_[_0xb0b4('0x4e')](_0x40316a[_0xb0b4('0x4c')],{'$or':_[_0xb0b4('0x3b')](_0x40316a[_0xb0b4('0x44')],function(_0x36d187){var _0x1610c3={};_0x1610c3[_0x36d187]={'$like':'%'+_0x1d8f18[_0xb0b4('0x42')]['filter']+'%'};return _0x1610c3;})});}_0x40316a=_[_0xb0b4('0x4e')]({},_0x40316a,_0x1d8f18[_0xb0b4('0x50')]);return _0x3c0988[_0xb0b4('0x5b')](_0x40316a);}})[_0xb0b4('0x1f')](function(_0x19458){if(_0x19458){_0x36e4cf=_0x19458['length'];if(!_0x1d8f18['query']['hasOwnProperty'](_0xb0b4('0x49'))){_0x40316a[_0xb0b4('0x30')]=qs[_0xb0b4('0x30')](_0x1d8f18['query'][_0xb0b4('0x30')]);_0x40316a[_0xb0b4('0x2f')]=qs['offset'](_0x1d8f18[_0xb0b4('0x42')][_0xb0b4('0x2f')]);}return _0x3c0988[_0xb0b4('0x5b')](_0x40316a);}})[_0xb0b4('0x1f')](function(_0x43d73a){if(_0x43d73a){return _0x43d73a?{'count':_0x36e4cf,'rows':_0x43d73a}:null;}})[_0xb0b4('0x1f')](respondWithResult(_0x33bcce,null))['catch'](handleError(_0x33bcce,null));};exports[_0xb0b4('0x5e')]=function(_0x1028b1,_0x1ef7af,_0x14e179){if(_0x1028b1['body']['id']){delete _0x1028b1[_0xb0b4('0x5a')]['id'];}return db[_0xb0b4('0x3c')][_0xb0b4('0x5c')]({'where':{'id':_0x1028b1[_0xb0b4('0x57')]['id']}})['then'](handleEntityNotFound(_0x1ef7af,null))[_0xb0b4('0x1f')](function(_0x58b862){if(_0x58b862){_0x1028b1[_0xb0b4('0x5a')][_0xb0b4('0x5f')]=_0x58b862['id'];_0x1028b1['body']['Subjects']=integrations[_0xb0b4('0x60')](_0x1028b1[_0xb0b4('0x5a')]['channel'],_0x1028b1[_0xb0b4('0x5a')]['type']);_0x1028b1[_0xb0b4('0x5a')][_0xb0b4('0x61')]=integrations[_0xb0b4('0x62')](_0x1028b1[_0xb0b4('0x5a')]['channel'],_0x1028b1[_0xb0b4('0x5a')]['type']);return db['SugarcrmConfiguration'][_0xb0b4('0x59')](_0x1028b1[_0xb0b4('0x5a')],{'include':[{'model':db[_0xb0b4('0x63')],'as':_0xb0b4('0x64')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xb0b4('0x1f')](respondWithResult(_0x1ef7af,null))['catch'](handleError(_0x1ef7af,null));};exports[_0xb0b4('0x65')]=function(_0x4b706a,_0x2fd842,_0x528a95){var _0x1bdbcc='';var _0x1656a8=['id',_0xb0b4('0x38'),_0xb0b4('0x66'),_0xb0b4('0x67'),_0xb0b4('0x68'),'date_start',_0xb0b4('0x69'),_0xb0b4('0x6a'),'parent_id',_0xb0b4('0x6b'),_0xb0b4('0x6c'),_0xb0b4('0x6d')];return db['SugarcrmAccount'][_0xb0b4('0x5c')]({'where':{'id':_0x4b706a[_0xb0b4('0x57')]['id']},'attributes':['id',_0xb0b4('0x6e'),_0xb0b4('0x6f'),'remoteUri']})[_0xb0b4('0x1f')](handleEntityNotFound(_0x2fd842,null))[_0xb0b4('0x1f')](function(_0x44fc54){if(_0x44fc54){_0x1bdbcc=_0x44fc54['remoteUri'];var _0x161f44=_0x1bdbcc[_0xb0b4('0x70')](-0x1);if(_0x161f44==='/'){_0x1bdbcc=_0x1bdbcc[_0xb0b4('0x71')](0x0,_0x1bdbcc[_0xb0b4('0x72')](_0x161f44));}return rp({'method':'POST','uri':util[_0xb0b4('0x73')](_0xb0b4('0x74'),_0x1bdbcc,_0xb0b4('0x75')),'json':!![],'form':{'method':_0xb0b4('0x76'),'input_type':_0xb0b4('0x77'),'response_type':_0xb0b4('0x77'),'rest_data':JSON[_0xb0b4('0x25')]({'user_auth':{'user_name':_0x44fc54[_0xb0b4('0x6e')],'password':_0x44fc54[_0xb0b4('0x6f')],'encryption':_0xb0b4('0x78')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xb0b4('0x1f')](function(_0x1c0314){if(_0x1c0314&&_0x1c0314['name']!==_0xb0b4('0x79')&&_0x1c0314[_0xb0b4('0x38')]!==_0xb0b4('0x7a')){return rp({'method':_0xb0b4('0x7b'),'uri':util[_0xb0b4('0x73')]('%s%s',_0x1bdbcc,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xb0b4('0x7c'),'input_type':'JSON','response_type':_0xb0b4('0x77'),'rest_data':JSON[_0xb0b4('0x25')]({'session':_0x1c0314['id'],'module_name':_0xb0b4('0x7d')})}})['then'](function(_0xdb4626){if(_0xdb4626){var _0x508123=_['values'](_0xdb4626[_0xb0b4('0x7e')]);_[_0xb0b4('0x7f')](_0x508123,function(_0x16ca3a){return _0x1656a8[_0xb0b4('0x80')](_0x16ca3a[_0xb0b4('0x38')]);});return{'count':_0x508123['length'],'rows':_['map'](_0x508123,function(_0x5ed8b9){return{'id':_0x5ed8b9[_0xb0b4('0x38')],'name':_0x5ed8b9[_0xb0b4('0x81')],'custom':_[_0xb0b4('0x82')](_0x5ed8b9['name'],'_c')?!![]:![],'options':_0x5ed8b9['options']?_['map'](_[_0xb0b4('0x83')](_0x5ed8b9[_0xb0b4('0x50')]),function(_0x274c94){return{'name':_0x274c94[_0xb0b4('0x84')],'value':_0x274c94[_0xb0b4('0x38')]};}):[]};})};}})[_0xb0b4('0x1f')](respondWithResult(_0x2fd842,null))[_0xb0b4('0x2a')](function(_0x566454){var _0x5518d0=_0x4b706a[_0xb0b4('0x42')]['test']?0x1f4:_0x566454[_0xb0b4('0x85')]||0x1f4;logger['error'](_0xb0b4('0x86'),_0xb0b4('0x65'),_0x5518d0,JSON[_0xb0b4('0x25')](_0x566454));delete _0x566454[_0xb0b4('0x38')];if(_0x5518d0===0x191){_0x5518d0=0x190;}_0x2fd842['status'](_0x5518d0)['send'](_0x4b706a[_0xb0b4('0x42')]['test']?{'message':_0xb0b4('0x87'),'statusCode':_0x566454[_0xb0b4('0x85')]}:_0x566454);});}else{var _0x40353b=0x1f4;_0x2fd842[_0xb0b4('0x2c')](_0x40353b)[_0xb0b4('0x39')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x49dd=['Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','save','destroy','stack','name','send','map','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','VIRTUAL','merge','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','username','password','remoteUri','slice','substring','POST','format','%s%s','login','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','JSON','Calls','values','includes','label','endsWith','value','test','statusCode'];(function(_0x2ec9e1,_0x33de63){var _0x174908=function(_0x287443){while(--_0x287443){_0x2ec9e1['push'](_0x2ec9e1['shift']());}};_0x174908(++_0x33de63);}(_0x49dd,0xfb));var _0xd49d=function(_0x3582d7,_0x1d3c7e){_0x3582d7=_0x3582d7-0x0;var _0x51e6b2=_0x49dd[_0x3582d7];return _0x51e6b2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd49d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd49d('0x1'));var jsonpatch=require(_0xd49d('0x2'));var rp=require(_0xd49d('0x3'));var moment=require('moment');var BPromise=require(_0xd49d('0x4'));var Mustache=require(_0xd49d('0x5'));var util=require('util');var path=require(_0xd49d('0x6'));var sox=require(_0xd49d('0x7'));var csv=require(_0xd49d('0x8'));var ejs=require(_0xd49d('0x9'));var fs=require('fs');var _=require(_0xd49d('0xa'));var squel=require(_0xd49d('0xb'));var crypto=require(_0xd49d('0xc'));var jsforce=require(_0xd49d('0xd'));var deskjs=require(_0xd49d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd49d('0xf'));var Papa=require('papaparse');var Redis=require(_0xd49d('0x10'));var authService=require(_0xd49d('0x11'));var qs=require(_0xd49d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd49d('0x13'));var logger=require('../../config/logger')(_0xd49d('0x14'));var utils=require(_0xd49d('0x15'));var config=require(_0xd49d('0x16'));var licenseUtil=require(_0xd49d('0x17'));var db=require(_0xd49d('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xd49d('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21dd77,_0x264a6f,_0x1924ec,_0x40438e){return new BPromise(function(_0x51743f,_0x4a436a){var _0x56e6bd=_0x40438e||client;return _0x56e6bd[_0xd49d('0x1a')](_0x21dd77,_0x1924ec)[_0xd49d('0x1b')](function(_0x363e6e){logger[_0xd49d('0x1c')](_0xd49d('0x1d'),_0x264a6f,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x264a6f,'request\x20sent',JSON[_0xd49d('0x1e')](_0x363e6e));if(_0x363e6e[_0xd49d('0x1f')]){if(_0x363e6e[_0xd49d('0x1f')]['code']===0x1f4){logger[_0xd49d('0x1f')](_0xd49d('0x1d'),_0x264a6f,_0x363e6e['error'][_0xd49d('0x20')]);return _0x4a436a(_0x363e6e['error'][_0xd49d('0x20')]);}logger[_0xd49d('0x1f')](_0xd49d('0x1d'),_0x264a6f,_0x363e6e[_0xd49d('0x1f')][_0xd49d('0x20')]);return _0x51743f(_0x363e6e[_0xd49d('0x1f')]['message']);}else{logger[_0xd49d('0x1c')](_0xd49d('0x1d'),_0x264a6f,_0xd49d('0x21'));_0x51743f(_0x363e6e[_0xd49d('0x22')][_0xd49d('0x20')]);}})['catch'](function(_0x39a5fc){logger[_0xd49d('0x1f')](_0xd49d('0x1d'),_0x264a6f,_0x39a5fc);_0x4a436a(_0x39a5fc);});});}function respondWithStatusCode(_0x4562ca,_0x4ad6ad){_0x4ad6ad=_0x4ad6ad||0xcc;return function(_0x1009e8){if(_0x1009e8){return _0x4562ca[_0xd49d('0x23')](_0x4ad6ad);}return _0x4562ca['status'](_0x4ad6ad)[_0xd49d('0x24')]();};}function respondWithResult(_0x117f17,_0x169c6a){_0x169c6a=_0x169c6a||0xc8;return function(_0x1a0149){if(_0x1a0149){return _0x117f17[_0xd49d('0x25')](_0x169c6a)['json'](_0x1a0149);}};}function respondWithFilteredResult(_0x403a17,_0x1c5cbd){return function(_0x3fd29e){if(_0x3fd29e){var _0x18c839=_0x3fd29e[_0xd49d('0x26')],_0x5e8902=_0x1c5cbd['offset'],_0x5c079a=_0x1c5cbd[_0xd49d('0x27')]+_0x1c5cbd[_0xd49d('0x28')],_0x329973;if(_0x5c079a>=_0x18c839){_0x5c079a=_0x18c839;_0x329973=0xc8;}else{_0x329973=0xce;}_0x403a17[_0xd49d('0x25')](_0x329973);return _0x403a17['set'](_0xd49d('0x29'),_0x5e8902+'-'+_0x5c079a+'/'+_0x18c839)['json'](_0x3fd29e);}return null;};}function patchUpdates(_0x3ed653){return function(_0x497533){try{jsonpatch[_0xd49d('0x2a')](_0x497533,_0x3ed653,!![]);}catch(_0x567482){return BPromise[_0xd49d('0x2b')](_0x567482);}return _0x497533[_0xd49d('0x2c')]();};}function saveUpdates(_0x59d088,_0x4fe242){return function(_0x470500){if(_0x470500){return _0x470500['update'](_0x59d088)[_0xd49d('0x1b')](function(_0x500526){return _0x500526;});}return null;};}function removeEntity(_0x441465,_0x597b55){return function(_0x34dc5f){if(_0x34dc5f){return _0x34dc5f[_0xd49d('0x2d')]()[_0xd49d('0x1b')](function(){_0x441465['status'](0xcc)[_0xd49d('0x24')]();});}};}function handleEntityNotFound(_0x4f82f,_0x79fb55){return function(_0x296ef2){if(!_0x296ef2){_0x4f82f[_0xd49d('0x23')](0x194);}return _0x296ef2;};}function handleError(_0x2376b9,_0x251f40){_0x251f40=_0x251f40||0x1f4;return function(_0x4181a0){logger[_0xd49d('0x1f')](_0x4181a0[_0xd49d('0x2e')]);if(_0x4181a0[_0xd49d('0x2f')]){delete _0x4181a0['name'];}_0x2376b9[_0xd49d('0x25')](_0x251f40)[_0xd49d('0x30')](_0x4181a0);};}exports['index']=function(_0x4444be,_0xa16049){var _0x32ae03={},_0x3dc3e4={},_0x49ca83={'count':0x0,'rows':[]};var _0xcfb674=_[_0xd49d('0x31')](db['SugarcrmAccount']['rawAttributes'],function(_0x4cf83b){return{'name':_0x4cf83b[_0xd49d('0x32')],'type':_0x4cf83b['type']['key']};});_0x3dc3e4[_0xd49d('0x33')]=_[_0xd49d('0x31')](_0xcfb674,_0xd49d('0x2f'));_0x3dc3e4[_0xd49d('0x34')]=_[_0xd49d('0x35')](_0x4444be['query']);_0x3dc3e4['filters']=_['intersection'](_0x3dc3e4['model'],_0x3dc3e4[_0xd49d('0x34')]);_0x32ae03[_0xd49d('0x36')]=_[_0xd49d('0x37')](_0x3dc3e4[_0xd49d('0x33')],qs[_0xd49d('0x38')](_0x4444be[_0xd49d('0x34')][_0xd49d('0x38')]));_0x32ae03[_0xd49d('0x36')]=_0x32ae03['attributes'][_0xd49d('0x39')]?_0x32ae03[_0xd49d('0x36')]:_0x3dc3e4['model'];if(!_0x4444be[_0xd49d('0x34')][_0xd49d('0x3a')](_0xd49d('0x3b'))){_0x32ae03['limit']=qs[_0xd49d('0x28')](_0x4444be[_0xd49d('0x34')][_0xd49d('0x28')]);_0x32ae03[_0xd49d('0x27')]=qs[_0xd49d('0x27')](_0x4444be[_0xd49d('0x34')][_0xd49d('0x27')]);}_0x32ae03[_0xd49d('0x3c')]=qs[_0xd49d('0x3d')](_0x4444be[_0xd49d('0x34')][_0xd49d('0x3d')]);_0x32ae03['where']=qs[_0xd49d('0x3e')](_['pick'](_0x4444be[_0xd49d('0x34')],_0x3dc3e4[_0xd49d('0x3e')]),_0xcfb674);if(_0x4444be[_0xd49d('0x34')][_0xd49d('0x3f')]){_0x32ae03[_0xd49d('0x40')]=_['merge'](_0x32ae03['where'],{'$or':_[_0xd49d('0x31')](_0xcfb674,function(_0x226edb){if(_0x226edb[_0xd49d('0x41')]!==_0xd49d('0x42')){var _0x520caf={};_0x520caf[_0x226edb[_0xd49d('0x2f')]]={'$like':'%'+_0x4444be[_0xd49d('0x34')][_0xd49d('0x3f')]+'%'};return _0x520caf;}})});}_0x32ae03=_[_0xd49d('0x43')]({},_0x32ae03,_0x4444be[_0xd49d('0x44')]);var _0x1ab882={'where':_0x32ae03[_0xd49d('0x40')]};return db[_0xd49d('0x45')][_0xd49d('0x26')](_0x1ab882)[_0xd49d('0x1b')](function(_0x2194f1){_0x49ca83[_0xd49d('0x26')]=_0x2194f1;if(_0x4444be[_0xd49d('0x34')][_0xd49d('0x46')]){_0x32ae03[_0xd49d('0x47')]=[{'all':!![]}];}return db[_0xd49d('0x45')][_0xd49d('0x48')](_0x32ae03);})[_0xd49d('0x1b')](function(_0x561ca0){_0x49ca83[_0xd49d('0x49')]=_0x561ca0;return _0x49ca83;})[_0xd49d('0x1b')](respondWithFilteredResult(_0xa16049,_0x32ae03))[_0xd49d('0x4a')](handleError(_0xa16049,null));};exports[_0xd49d('0x4b')]=function(_0x53f69f,_0x2edd7f){var _0x4663b1={'raw':![],'where':{'id':_0x53f69f[_0xd49d('0x4c')]['id']}},_0x33168f={};_0x33168f[_0xd49d('0x33')]=_[_0xd49d('0x35')](db[_0xd49d('0x45')][_0xd49d('0x4d')]);_0x33168f[_0xd49d('0x34')]=_[_0xd49d('0x35')](_0x53f69f[_0xd49d('0x34')]);_0x33168f[_0xd49d('0x3e')]=_[_0xd49d('0x37')](_0x33168f['model'],_0x33168f['query']);_0x4663b1['attributes']=_[_0xd49d('0x37')](_0x33168f[_0xd49d('0x33')],qs['fields'](_0x53f69f[_0xd49d('0x34')][_0xd49d('0x38')]));_0x4663b1[_0xd49d('0x36')]=_0x4663b1[_0xd49d('0x36')]['length']?_0x4663b1[_0xd49d('0x36')]:_0x33168f[_0xd49d('0x33')];if(_0x53f69f['query'][_0xd49d('0x46')]){_0x4663b1[_0xd49d('0x47')]=[{'all':!![]}];}_0x4663b1=_[_0xd49d('0x43')]({},_0x4663b1,_0x53f69f['options']);return db[_0xd49d('0x45')][_0xd49d('0x4e')](_0x4663b1)[_0xd49d('0x1b')](handleEntityNotFound(_0x2edd7f,null))[_0xd49d('0x1b')](respondWithResult(_0x2edd7f,null))[_0xd49d('0x4a')](handleError(_0x2edd7f,null));};exports[_0xd49d('0x4f')]=function(_0x562a62,_0x1b4296){return db['SugarcrmAccount']['create'](_0x562a62[_0xd49d('0x50')],{})['then'](respondWithResult(_0x1b4296,0xc9))[_0xd49d('0x4a')](handleError(_0x1b4296,null));};exports[_0xd49d('0x51')]=function(_0x2bbb7c,_0x20778e){if(_0x2bbb7c[_0xd49d('0x50')]['id']){delete _0x2bbb7c['body']['id'];}return db[_0xd49d('0x45')][_0xd49d('0x4e')]({'where':{'id':_0x2bbb7c[_0xd49d('0x4c')]['id']}})[_0xd49d('0x1b')](handleEntityNotFound(_0x20778e,null))['then'](saveUpdates(_0x2bbb7c[_0xd49d('0x50')],null))[_0xd49d('0x1b')](respondWithResult(_0x20778e,null))[_0xd49d('0x4a')](handleError(_0x20778e,null));};exports['destroy']=function(_0x378579,_0x43a60a){return db['SugarcrmAccount']['find']({'where':{'id':_0x378579[_0xd49d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x43a60a,null))[_0xd49d('0x1b')](removeEntity(_0x43a60a,null))[_0xd49d('0x4a')](handleError(_0x43a60a,null));};exports[_0xd49d('0x52')]=function(_0x401662,_0x718da7,_0x1d86b4){var _0x16ad5f={};var _0x4441bf={};var _0x5d3a0b;var _0x231555;return db['SugarcrmAccount'][_0xd49d('0x53')]({'where':{'id':_0x401662[_0xd49d('0x4c')]['id']}})[_0xd49d('0x1b')](handleEntityNotFound(_0x718da7,null))[_0xd49d('0x1b')](function(_0x3b867b){if(_0x3b867b){_0x5d3a0b=_0x3b867b;_0x4441bf[_0xd49d('0x33')]=_[_0xd49d('0x35')](db[_0xd49d('0x54')]['rawAttributes']);_0x4441bf[_0xd49d('0x34')]=_[_0xd49d('0x35')](_0x401662[_0xd49d('0x34')]);_0x4441bf[_0xd49d('0x3e')]=_[_0xd49d('0x37')](_0x4441bf[_0xd49d('0x33')],_0x4441bf[_0xd49d('0x34')]);_0x16ad5f[_0xd49d('0x36')]=_[_0xd49d('0x37')](_0x4441bf[_0xd49d('0x33')],qs[_0xd49d('0x38')](_0x401662[_0xd49d('0x34')][_0xd49d('0x38')]));_0x16ad5f[_0xd49d('0x36')]=_0x16ad5f[_0xd49d('0x36')][_0xd49d('0x39')]?_0x16ad5f['attributes']:_0x4441bf[_0xd49d('0x33')];_0x16ad5f['order']=qs[_0xd49d('0x3d')](_0x401662[_0xd49d('0x34')][_0xd49d('0x3d')]);_0x16ad5f['where']=qs[_0xd49d('0x3e')](_[_0xd49d('0x55')](_0x401662['query'],_0x4441bf['filters']));if(_0x401662[_0xd49d('0x34')]['filter']){_0x16ad5f[_0xd49d('0x40')]=_[_0xd49d('0x43')](_0x16ad5f['where'],{'$or':_[_0xd49d('0x31')](_0x16ad5f[_0xd49d('0x36')],function(_0x2d418e){var _0x20ce34={};_0x20ce34[_0x2d418e]={'$like':'%'+_0x401662['query']['filter']+'%'};return _0x20ce34;})});}_0x16ad5f=_[_0xd49d('0x43')]({},_0x16ad5f,_0x401662[_0xd49d('0x44')]);return _0x5d3a0b[_0xd49d('0x52')](_0x16ad5f);}})['then'](function(_0x1a3d4e){if(_0x1a3d4e){_0x231555=_0x1a3d4e[_0xd49d('0x39')];if(!_0x401662[_0xd49d('0x34')][_0xd49d('0x3a')](_0xd49d('0x3b'))){_0x16ad5f[_0xd49d('0x28')]=qs[_0xd49d('0x28')](_0x401662[_0xd49d('0x34')][_0xd49d('0x28')]);_0x16ad5f['offset']=qs['offset'](_0x401662[_0xd49d('0x34')][_0xd49d('0x27')]);}return _0x5d3a0b[_0xd49d('0x52')](_0x16ad5f);}})[_0xd49d('0x1b')](function(_0x2c3202){if(_0x2c3202){return _0x2c3202?{'count':_0x231555,'rows':_0x2c3202}:null;}})[_0xd49d('0x1b')](respondWithResult(_0x718da7,null))[_0xd49d('0x4a')](handleError(_0x718da7,null));};exports[_0xd49d('0x56')]=function(_0x34717f,_0x4c1024,_0x3cedb6){if(_0x34717f[_0xd49d('0x50')]['id']){delete _0x34717f['body']['id'];}return db[_0xd49d('0x45')][_0xd49d('0x53')]({'where':{'id':_0x34717f['params']['id']}})[_0xd49d('0x1b')](handleEntityNotFound(_0x4c1024,null))[_0xd49d('0x1b')](function(_0x2cdec0){if(_0x2cdec0){_0x34717f[_0xd49d('0x50')][_0xd49d('0x57')]=_0x2cdec0['id'];_0x34717f['body'][_0xd49d('0x58')]=integrations[_0xd49d('0x59')](_0x34717f['body'][_0xd49d('0x5a')],_0x34717f['body'][_0xd49d('0x41')]);_0x34717f['body']['Descriptions']=integrations[_0xd49d('0x5b')](_0x34717f[_0xd49d('0x50')][_0xd49d('0x5a')],_0x34717f['body']['type']);return db[_0xd49d('0x54')][_0xd49d('0x4f')](_0x34717f['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xd49d('0x58')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xd49d('0x1b')](respondWithResult(_0x4c1024,null))['catch'](handleError(_0x4c1024,null));};exports[_0xd49d('0x5c')]=function(_0x33e29c,_0x528e60,_0x3e6c00){var _0x1a067c='';var _0x5baaba=['id',_0xd49d('0x2f'),_0xd49d('0x5d'),_0xd49d('0x5e'),_0xd49d('0x5f'),_0xd49d('0x60'),_0xd49d('0x61'),_0xd49d('0x62'),_0xd49d('0x63'),'parent_type',_0xd49d('0x64'),'direction'];return db[_0xd49d('0x45')][_0xd49d('0x53')]({'where':{'id':_0x33e29c[_0xd49d('0x4c')]['id']},'attributes':['id',_0xd49d('0x65'),_0xd49d('0x66'),'remoteUri']})[_0xd49d('0x1b')](handleEntityNotFound(_0x528e60,null))[_0xd49d('0x1b')](function(_0x2229a9){if(_0x2229a9){_0x1a067c=_0x2229a9[_0xd49d('0x67')];var _0x53ceda=_0x1a067c[_0xd49d('0x68')](-0x1);if(_0x53ceda==='/'){_0x1a067c=_0x1a067c[_0xd49d('0x69')](0x0,_0x1a067c['lastIndexOf'](_0x53ceda));}return rp({'method':_0xd49d('0x6a'),'uri':util[_0xd49d('0x6b')](_0xd49d('0x6c'),_0x1a067c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xd49d('0x6d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xd49d('0x1e')]({'user_auth':{'user_name':_0x2229a9[_0xd49d('0x65')],'password':_0x2229a9[_0xd49d('0x66')],'encryption':_0xd49d('0x6e')},'application':_0xd49d('0x6f')})}});}})[_0xd49d('0x1b')](function(_0x53b805){if(_0x53b805&&_0x53b805[_0xd49d('0x2f')]!=='Invalid\x20Login'&&_0x53b805[_0xd49d('0x2f')]!==_0xd49d('0x70')){return rp({'method':_0xd49d('0x6a'),'uri':util[_0xd49d('0x6b')](_0xd49d('0x6c'),_0x1a067c,_0xd49d('0x71')),'json':!![],'form':{'method':_0xd49d('0x72'),'input_type':_0xd49d('0x73'),'response_type':_0xd49d('0x73'),'rest_data':JSON[_0xd49d('0x1e')]({'session':_0x53b805['id'],'module_name':_0xd49d('0x74')})}})[_0xd49d('0x1b')](function(_0x1a38ee){if(_0x1a38ee){var _0x58503c=_[_0xd49d('0x75')](_0x1a38ee['module_fields']);_['remove'](_0x58503c,function(_0x158fcf){return _0x5baaba[_0xd49d('0x76')](_0x158fcf[_0xd49d('0x2f')]);});return{'count':_0x58503c[_0xd49d('0x39')],'rows':_[_0xd49d('0x31')](_0x58503c,function(_0x35c147){return{'id':_0x35c147[_0xd49d('0x2f')],'name':_0x35c147[_0xd49d('0x77')],'custom':_[_0xd49d('0x78')](_0x35c147[_0xd49d('0x2f')],'_c')?!![]:![],'options':_0x35c147[_0xd49d('0x44')]?_[_0xd49d('0x31')](_[_0xd49d('0x75')](_0x35c147[_0xd49d('0x44')]),function(_0x39cd62){return{'name':_0x39cd62[_0xd49d('0x79')],'value':_0x39cd62[_0xd49d('0x2f')]};}):[]};})};}})[_0xd49d('0x1b')](respondWithResult(_0x528e60,null))[_0xd49d('0x4a')](function(_0xbfb8ea){var _0x500795=_0x33e29c['query'][_0xd49d('0x7a')]?0x1f4:_0xbfb8ea[_0xd49d('0x7b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xd49d('0x5c'),_0x500795,JSON['stringify'](_0xbfb8ea));delete _0xbfb8ea['name'];if(_0x500795===0x191){_0x500795=0x190;}_0x528e60['status'](_0x500795)['send'](_0x33e29c['query'][_0xd49d('0x7a')]?{'message':_0xd49d('0x7c'),'statusCode':_0xbfb8ea['statusCode']}:_0xbfb8ea);});}else{var _0x322721=0x1f4;_0x528e60['status'](_0x322721)[_0xd49d('0x30')]({'message':_0xd49d('0x7c'),'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 f7d61b2..16ebfba 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 _0x52f2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','util'];(function(_0x1658ce,_0x4e2dc4){var _0x4ef14d=function(_0x454609){while(--_0x454609){_0x1658ce['push'](_0x1658ce['shift']());}};_0x4ef14d(++_0x4e2dc4);}(_0x52f2,0x1c0));var _0x252f=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x52f2[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x252f('0x0'));var util=require(_0x252f('0x1'));var logger=require(_0x252f('0x2'))(_0x252f('0x3'));var moment=require(_0x252f('0x4'));var BPromise=require(_0x252f('0x5'));var rp=require(_0x252f('0x6'));var fs=require('fs');var path=require(_0x252f('0x7'));var rimraf=require(_0x252f('0x8'));var config=require(_0x252f('0x9'));var attributes=require(_0x252f('0xa'));var integrations=require(_0x252f('0xb'));module[_0x252f('0xc')]=function(_0x377fde,_0x494537){return _0x377fde[_0x252f('0xd')](_0x252f('0xe'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb6a=['bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0xdb6a,0x102));var _0xadb6=function(_0x34d5d7,_0x22ea94){_0x34d5d7=_0x34d5d7-0x0;var _0x39d597=_0xdb6a[_0x34d5d7];return _0x39d597;};'use strict';var _=require(_0xadb6('0x0'));var util=require(_0xadb6('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xadb6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xadb6('0x3'));var rimraf=require(_0xadb6('0x4'));var config=require(_0xadb6('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xadb6('0x6'));module[_0xadb6('0x7')]=function(_0x5d4680,_0x5cd190){return _0x5d4680['define'](_0xadb6('0x8'),attributes,{'tableName':_0xadb6('0x9'),'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 92ec478..310c2f6 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 _0x6428=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','find','raw','lodash','util','bluebird'];(function(_0x3e936d,_0x37e020){var _0x268436=function(_0x2e0159){while(--_0x2e0159){_0x3e936d['push'](_0x3e936d['shift']());}};_0x268436(++_0x37e020);}(_0x6428,0x115));var _0x8642=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x6428[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x8642('0x0'));var util=require(_0x8642('0x1'));var moment=require('moment');var BPromise=require(_0x8642('0x2'));var rs=require(_0x8642('0x3'));var fs=require('fs');var Redis=require(_0x8642('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8642('0x5'));var logger=require('../../config/logger')(_0x8642('0x6'));var config=require(_0x8642('0x7'));var jayson=require(_0x8642('0x8'));var client=jayson['client'][_0x8642('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46603c,_0x126388,_0x4860bf){return new BPromise(function(_0x4e65aa,_0x42a5a0){return client[_0x8642('0xa')](_0x46603c,_0x4860bf)[_0x8642('0xb')](function(_0x2272ca){logger[_0x8642('0xc')](_0x8642('0xd'),_0x126388,_0x8642('0xe'));logger[_0x8642('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x126388,_0x8642('0xe'),JSON[_0x8642('0x10')](_0x2272ca));if(_0x2272ca[_0x8642('0x11')]){if(_0x2272ca[_0x8642('0x11')][_0x8642('0x12')]===0x1f4){logger[_0x8642('0x11')](_0x8642('0xd'),_0x126388,_0x2272ca[_0x8642('0x11')][_0x8642('0x13')]);return _0x42a5a0(_0x2272ca[_0x8642('0x11')]['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x126388,_0x2272ca[_0x8642('0x11')][_0x8642('0x13')]);return _0x4e65aa(_0x2272ca[_0x8642('0x11')][_0x8642('0x13')]);}else{logger['info'](_0x8642('0xd'),_0x126388,_0x8642('0xe'));_0x4e65aa(_0x2272ca[_0x8642('0x14')][_0x8642('0x13')]);}})[_0x8642('0x15')](function(_0x1daf68){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x126388,_0x1daf68);_0x42a5a0(_0x1daf68);});});}exports['GetSugarcrmAccount']=function(_0x958aa0){var _0x2f91c7=this;return new Promise(function(_0xa93bb0,_0xbb0b03){return db[_0x8642('0x16')][_0x8642('0x17')]({'raw':_0x958aa0[_0x8642('0x18')]?_0x958aa0['options']['raw']===undefined?!![]:![]:!![],'where':_0x958aa0[_0x8642('0x18')]?_0x958aa0[_0x8642('0x18')][_0x8642('0x19')]||null:null,'attributes':_0x958aa0['options']?_0x958aa0[_0x8642('0x18')][_0x8642('0x1a')]||null:null,'limit':_0x958aa0[_0x8642('0x18')]?_0x958aa0[_0x8642('0x18')][_0x8642('0x1b')]||null:null,'include':_0x958aa0[_0x8642('0x18')]?_0x958aa0[_0x8642('0x18')][_0x8642('0x1c')]?_[_0x8642('0x1d')](_0x958aa0[_0x8642('0x18')][_0x8642('0x1c')],function(_0x48bce6){return{'model':db[_0x48bce6[_0x8642('0x1e')]],'as':_0x48bce6['as'],'attributes':_0x48bce6[_0x8642('0x1a')],'include':_0x48bce6[_0x8642('0x1c')]?_[_0x8642('0x1d')](_0x48bce6[_0x8642('0x1c')],function(_0x3ec294){return{'model':db[_0x3ec294[_0x8642('0x1e')]],'as':_0x3ec294['as'],'attributes':_0x3ec294[_0x8642('0x1a')],'include':_0x3ec294['include']?_[_0x8642('0x1d')](_0x3ec294[_0x8642('0x1c')],function(_0x44c563){return{'model':db[_0x44c563['model']],'as':_0x44c563['as'],'attributes':_0x44c563[_0x8642('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8642('0xb')](function(_0x5dd121){logger[_0x8642('0xc')](_0x8642('0x1f'),_0x958aa0);logger[_0x8642('0xf')]('GetSugarcrmAccount',_0x958aa0,JSON[_0x8642('0x10')](_0x5dd121));_0xa93bb0(_0x5dd121);})[_0x8642('0x15')](function(_0x103ec1){logger['error'](_0x8642('0x1f'),_0x103ec1[_0x8642('0x13')],_0x958aa0);_0xbb0b03(_0x2f91c7[_0x8642('0x11')](0x1f4,_0x103ec1[_0x8642('0x13')]));});});};exports[_0x8642('0x20')]=function(_0x23d733){var _0x498223=this;return new Promise(function(_0x37c18a,_0x4aabf3){return db[_0x8642('0x16')][_0x8642('0x21')]({'raw':_0x23d733[_0x8642('0x18')]?_0x23d733[_0x8642('0x18')][_0x8642('0x22')]===undefined?!![]:![]:!![],'where':_0x23d733['options']?_0x23d733['options'][_0x8642('0x19')]||null:null,'attributes':_0x23d733[_0x8642('0x18')]?_0x23d733[_0x8642('0x18')][_0x8642('0x1a')]||null:null,'include':_0x23d733['options']?_0x23d733[_0x8642('0x18')][_0x8642('0x1c')]?_[_0x8642('0x1d')](_0x23d733[_0x8642('0x18')][_0x8642('0x1c')],function(_0x24c558){return{'model':db[_0x24c558[_0x8642('0x1e')]],'as':_0x24c558['as'],'attributes':_0x24c558['attributes'],'include':_0x24c558[_0x8642('0x1c')]?_[_0x8642('0x1d')](_0x24c558[_0x8642('0x1c')],function(_0x277da1){return{'model':db[_0x277da1[_0x8642('0x1e')]],'as':_0x277da1['as'],'attributes':_0x277da1[_0x8642('0x1a')],'include':_0x277da1['include']?_[_0x8642('0x1d')](_0x277da1['include'],function(_0x27de80){return{'model':db[_0x27de80[_0x8642('0x1e')]],'as':_0x27de80['as'],'attributes':_0x27de80['attributes']};}):[]};}):[]};}):[]:[]})[_0x8642('0xb')](function(_0x40bd3e){logger['info']('ShowSugarcrmAccount',_0x23d733);logger[_0x8642('0xf')](_0x8642('0x20'),_0x23d733,JSON[_0x8642('0x10')](_0x40bd3e));_0x37c18a(_0x40bd3e);})[_0x8642('0x15')](function(_0x96d3be){logger[_0x8642('0x11')](_0x8642('0x20'),_0x96d3be[_0x8642('0x13')],_0x23d733);_0x4aabf3(_0x498223[_0x8642('0x11')](0x1f4,_0x96d3be['message']));});});}; \ No newline at end of file +var _0x6e88=['request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','debug','ShowSugarcrmAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s'];(function(_0x546f97,_0x4a6ec5){var _0x2b1ed2=function(_0x91a22f){while(--_0x91a22f){_0x546f97['push'](_0x546f97['shift']());}};_0x2b1ed2(++_0x4a6ec5);}(_0x6e88,0xec));var _0x86e8=function(_0x35ab2d,_0x1c3c15){_0x35ab2d=_0x35ab2d-0x0;var _0x22baea=_0x6e88[_0x35ab2d];return _0x22baea;};'use strict';var _=require('lodash');var util=require(_0x86e8('0x0'));var moment=require(_0x86e8('0x1'));var BPromise=require(_0x86e8('0x2'));var rs=require(_0x86e8('0x3'));var fs=require('fs');var Redis=require(_0x86e8('0x4'));var db=require(_0x86e8('0x5'))['db'];var utils=require(_0x86e8('0x6'));var logger=require(_0x86e8('0x7'))(_0x86e8('0x8'));var config=require('../../config/environment');var jayson=require(_0x86e8('0x9'));var client=jayson[_0x86e8('0xa')][_0x86e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c6610,_0x42dd0d,_0xba16a1){return new BPromise(function(_0xcadae6,_0x1a3192){return client[_0x86e8('0xc')](_0x5c6610,_0xba16a1)[_0x86e8('0xd')](function(_0xfc7921){logger[_0x86e8('0xe')](_0x86e8('0xf'),_0x42dd0d,_0x86e8('0x10'));logger['debug'](_0x86e8('0x11'),_0x42dd0d,_0x86e8('0x10'),JSON[_0x86e8('0x12')](_0xfc7921));if(_0xfc7921['error']){if(_0xfc7921[_0x86e8('0x13')][_0x86e8('0x14')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x42dd0d,_0xfc7921[_0x86e8('0x13')][_0x86e8('0x15')]);return _0x1a3192(_0xfc7921[_0x86e8('0x13')][_0x86e8('0x15')]);}logger[_0x86e8('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x42dd0d,_0xfc7921[_0x86e8('0x13')][_0x86e8('0x15')]);return _0xcadae6(_0xfc7921['error'][_0x86e8('0x15')]);}else{logger['info'](_0x86e8('0xf'),_0x42dd0d,_0x86e8('0x10'));_0xcadae6(_0xfc7921[_0x86e8('0x16')]['message']);}})[_0x86e8('0x17')](function(_0x233d85){logger['error'](_0x86e8('0xf'),_0x42dd0d,_0x233d85);_0x1a3192(_0x233d85);});});}exports['GetSugarcrmAccount']=function(_0x94ca45){var _0x2e70b8=this;return new Promise(function(_0x12077f,_0x2aba9c){return db[_0x86e8('0x18')]['findAll']({'raw':_0x94ca45[_0x86e8('0x19')]?_0x94ca45['options'][_0x86e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x94ca45[_0x86e8('0x19')]?_0x94ca45['options'][_0x86e8('0x1b')]||null:null,'attributes':_0x94ca45[_0x86e8('0x19')]?_0x94ca45[_0x86e8('0x19')][_0x86e8('0x1c')]||null:null,'limit':_0x94ca45['options']?_0x94ca45[_0x86e8('0x19')][_0x86e8('0x1d')]||null:null,'include':_0x94ca45[_0x86e8('0x19')]?_0x94ca45['options'][_0x86e8('0x1e')]?_[_0x86e8('0x1f')](_0x94ca45['options'][_0x86e8('0x1e')],function(_0x4fe862){return{'model':db[_0x4fe862[_0x86e8('0x20')]],'as':_0x4fe862['as'],'attributes':_0x4fe862[_0x86e8('0x1c')],'include':_0x4fe862[_0x86e8('0x1e')]?_[_0x86e8('0x1f')](_0x4fe862[_0x86e8('0x1e')],function(_0x177800){return{'model':db[_0x177800[_0x86e8('0x20')]],'as':_0x177800['as'],'attributes':_0x177800[_0x86e8('0x1c')],'include':_0x177800[_0x86e8('0x1e')]?_['map'](_0x177800['include'],function(_0x3b72b5){return{'model':db[_0x3b72b5[_0x86e8('0x20')]],'as':_0x3b72b5['as'],'attributes':_0x3b72b5[_0x86e8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x86e8('0xd')](function(_0x3ef255){logger['info'](_0x86e8('0x21'),_0x94ca45);logger[_0x86e8('0x22')]('GetSugarcrmAccount',_0x94ca45,JSON[_0x86e8('0x12')](_0x3ef255));_0x12077f(_0x3ef255);})[_0x86e8('0x17')](function(_0x9437b9){logger[_0x86e8('0x13')](_0x86e8('0x21'),_0x9437b9[_0x86e8('0x15')],_0x94ca45);_0x2aba9c(_0x2e70b8[_0x86e8('0x13')](0x1f4,_0x9437b9[_0x86e8('0x15')]));});});};exports[_0x86e8('0x23')]=function(_0xe028a3){var _0x1420cf=this;return new Promise(function(_0x32f9e6,_0x31f2ea){return db['SugarcrmAccount']['find']({'raw':_0xe028a3[_0x86e8('0x19')]?_0xe028a3[_0x86e8('0x19')][_0x86e8('0x1a')]===undefined?!![]:![]:!![],'where':_0xe028a3['options']?_0xe028a3[_0x86e8('0x19')][_0x86e8('0x1b')]||null:null,'attributes':_0xe028a3[_0x86e8('0x19')]?_0xe028a3[_0x86e8('0x19')]['attributes']||null:null,'include':_0xe028a3[_0x86e8('0x19')]?_0xe028a3[_0x86e8('0x19')][_0x86e8('0x1e')]?_[_0x86e8('0x1f')](_0xe028a3[_0x86e8('0x19')]['include'],function(_0x9a7068){return{'model':db[_0x9a7068['model']],'as':_0x9a7068['as'],'attributes':_0x9a7068[_0x86e8('0x1c')],'include':_0x9a7068[_0x86e8('0x1e')]?_[_0x86e8('0x1f')](_0x9a7068['include'],function(_0xcc2528){return{'model':db[_0xcc2528[_0x86e8('0x20')]],'as':_0xcc2528['as'],'attributes':_0xcc2528[_0x86e8('0x1c')],'include':_0xcc2528[_0x86e8('0x1e')]?_[_0x86e8('0x1f')](_0xcc2528[_0x86e8('0x1e')],function(_0x3e559e){return{'model':db[_0x3e559e['model']],'as':_0x3e559e['as'],'attributes':_0x3e559e[_0x86e8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x86e8('0xd')](function(_0x1acc56){logger['info'](_0x86e8('0x23'),_0xe028a3);logger[_0x86e8('0x22')](_0x86e8('0x23'),_0xe028a3,JSON[_0x86e8('0x12')](_0x1acc56));_0x32f9e6(_0x1acc56);})['catch'](function(_0x39f238){logger[_0x86e8('0x13')](_0x86e8('0x23'),_0x39f238['message'],_0xe028a3);_0x31f2ea(_0x1420cf[_0x86e8('0x13')](0x1f4,_0x39f238[_0x86e8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index e9b53c3..f2dfa17 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 _0x6f40=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1f5887,_0x2fa1f1){var _0x21774b=function(_0x48a7e5){while(--_0x48a7e5){_0x1f5887['push'](_0x1f5887['shift']());}};_0x21774b(++_0x2fa1f1);}(_0x6f40,0x1db));var _0x06f4=function(_0x20446d,_0x196b02){_0x20446d=_0x20446d-0x0;var _0x3b126d=_0x6f40[_0x20446d];return _0x3b126d;};'use strict';var multer=require(_0x06f4('0x0'));var util=require(_0x06f4('0x1'));var path=require(_0x06f4('0x2'));var timeout=require('connect-timeout');var express=require(_0x06f4('0x3'));var router=express[_0x06f4('0x4')]();var auth=require(_0x06f4('0x5'));var interaction=require(_0x06f4('0x6'));var config=require(_0x06f4('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x06f4('0x8')]('/',auth[_0x06f4('0x9')](),controller[_0x06f4('0xa')]);router['get'](_0x06f4('0xb'),auth[_0x06f4('0x9')](),controller[_0x06f4('0xc')]);router[_0x06f4('0x8')](_0x06f4('0xd'),auth[_0x06f4('0x9')](),controller[_0x06f4('0xe')]);router['get'](_0x06f4('0xf'),auth[_0x06f4('0x9')](),controller['getSubjects']);router[_0x06f4('0x8')](_0x06f4('0x10'),auth[_0x06f4('0x9')](),controller[_0x06f4('0x11')]);router[_0x06f4('0x12')]('/',auth[_0x06f4('0x9')](),controller[_0x06f4('0x13')]);router[_0x06f4('0x14')](_0x06f4('0xb'),auth[_0x06f4('0x9')](),controller['update']);router['delete'](_0x06f4('0xb'),auth['isAuthenticated'](),controller[_0x06f4('0x15')]);module[_0x06f4('0x16')]=router; \ No newline at end of file +var _0xd6e0=['index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x181c46,_0x3cc3a1){var _0x50e841=function(_0x2cd7de){while(--_0x2cd7de){_0x181c46['push'](_0x181c46['shift']());}};_0x50e841(++_0x3cc3a1);}(_0xd6e0,0x1ef));var _0x0d6e=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0xd6e0[_0x5756f8];return _0x3bb749;};'use strict';var multer=require(_0x0d6e('0x0'));var util=require(_0x0d6e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0d6e('0x2'));var router=express[_0x0d6e('0x3')]();var auth=require(_0x0d6e('0x4'));var interaction=require(_0x0d6e('0x5'));var config=require('../../config/environment');var controller=require(_0x0d6e('0x6'));router[_0x0d6e('0x7')]('/',auth[_0x0d6e('0x8')](),controller[_0x0d6e('0x9')]);router[_0x0d6e('0x7')](_0x0d6e('0xa'),auth[_0x0d6e('0x8')](),controller[_0x0d6e('0xb')]);router[_0x0d6e('0x7')](_0x0d6e('0xc'),auth[_0x0d6e('0x8')](),controller[_0x0d6e('0xd')]);router[_0x0d6e('0x7')](_0x0d6e('0xe'),auth[_0x0d6e('0x8')](),controller['getSubjects']);router[_0x0d6e('0x7')](_0x0d6e('0xf'),auth[_0x0d6e('0x8')](),controller[_0x0d6e('0x10')]);router[_0x0d6e('0x11')]('/',auth[_0x0d6e('0x8')](),controller[_0x0d6e('0x12')]);router['put'](_0x0d6e('0xa'),auth[_0x0d6e('0x8')](),controller['update']);router['delete'](_0x0d6e('0xa'),auth[_0x0d6e('0x8')](),controller[_0x0d6e('0x13')]);module[_0x0d6e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 9bd9769..f839d5c 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 _0xa3a4=['sequelize','exports'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0xa3a4,0xd0));var _0x4a3a=function(_0x66b31e,_0x36ea65){_0x66b31e=_0x66b31e-0x0;var _0x1be075=_0xa3a4[_0x66b31e];return _0x1be075;};'use strict';var Sequelize=require(_0x4a3a('0x0'));module[_0x4a3a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb319=['STRING','sequelize'];(function(_0x22ce3a,_0xf4a6d4){var _0x4be173=function(_0x48acdf){while(--_0x48acdf){_0x22ce3a['push'](_0x22ce3a['shift']());}};_0x4be173(++_0xf4a6d4);}(_0xb319,0x18b));var _0x9b31=function(_0x190cc5,_0x3aa467){_0x190cc5=_0x190cc5-0x0;var _0x23b67c=_0xb319[_0x190cc5];return _0x23b67c;};'use strict';var Sequelize=require(_0x9b31('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b31('0x1')]},'description':{'type':Sequelize[_0x9b31('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index d665fe3..d0cf897 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 _0xdd73=['getSubjects','hasOwnProperty','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','code','error','message','request\x20sent','result','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','SugarcrmConfiguration','includeAll','include','rows','show','params','rawAttributes','find','create','body','getFields','findOne','SugarcrmField'];(function(_0x524b42,_0xfdf7bd){var _0x317cf9=function(_0x38da08){while(--_0x38da08){_0x524b42['push'](_0x524b42['shift']());}};_0x317cf9(++_0xfdf7bd);}(_0xdd73,0x1c0));var _0x3dd7=function(_0x8d823c,_0x4dfa8e){_0x8d823c=_0x8d823c-0x0;var _0x1399a6=_0xdd73[_0x8d823c];return _0x1399a6;};'use strict';var pdf=require(_0x3dd7('0x0'));var emlformat=require(_0x3dd7('0x1'));var rimraf=require(_0x3dd7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3dd7('0x3'));var moment=require('moment');var BPromise=require(_0x3dd7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3dd7('0x5'));var sox=require('sox');var csv=require(_0x3dd7('0x6'));var ejs=require(_0x3dd7('0x7'));var fs=require('fs');var _=require(_0x3dd7('0x8'));var squel=require('squel');var crypto=require(_0x3dd7('0x9'));var jsforce=require(_0x3dd7('0xa'));var deskjs=require(_0x3dd7('0xb'));var toCsv=require(_0x3dd7('0x6'));var querystring=require('querystring');var Papa=require(_0x3dd7('0xc'));var Redis=require(_0x3dd7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3dd7('0xe'));var as=require(_0x3dd7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3dd7('0x10'))(_0x3dd7('0x11'));var utils=require(_0x3dd7('0x12'));var config=require(_0x3dd7('0x13'));var licenseUtil=require(_0x3dd7('0x14'));var db=require(_0x3dd7('0x15'))['db'];var jayson=require(_0x3dd7('0x16'));var client=jayson[_0x3dd7('0x17')][_0x3dd7('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x10e318,_0x35a871,_0x14fac9,_0x554b64){return new BPromise(function(_0x4a0079,_0x432e7a){var _0x4a7578=_0x554b64||client;return _0x4a7578[_0x3dd7('0x19')](_0x10e318,_0x14fac9)[_0x3dd7('0x1a')](function(_0x4fe308){logger[_0x3dd7('0x1b')](_0x3dd7('0x1c'),_0x35a871,'request\x20sent');logger[_0x3dd7('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x35a871,'request\x20sent',JSON['stringify'](_0x4fe308));if(_0x4fe308['error']){if(_0x4fe308['error'][_0x3dd7('0x1e')]===0x1f4){logger[_0x3dd7('0x1f')](_0x3dd7('0x1c'),_0x35a871,_0x4fe308['error'][_0x3dd7('0x20')]);return _0x432e7a(_0x4fe308['error']['message']);}logger[_0x3dd7('0x1f')](_0x3dd7('0x1c'),_0x35a871,_0x4fe308['error']['message']);return _0x4a0079(_0x4fe308[_0x3dd7('0x1f')]['message']);}else{logger[_0x3dd7('0x1b')](_0x3dd7('0x1c'),_0x35a871,_0x3dd7('0x21'));_0x4a0079(_0x4fe308[_0x3dd7('0x22')]['message']);}})[_0x3dd7('0x23')](function(_0x284bc9){logger[_0x3dd7('0x1f')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x35a871,_0x284bc9);_0x432e7a(_0x284bc9);});});}function respondWithStatusCode(_0x394dbb,_0x3854fd){_0x3854fd=_0x3854fd||0xcc;return function(_0x92c00f){if(_0x92c00f){return _0x394dbb[_0x3dd7('0x24')](_0x3854fd);}return _0x394dbb[_0x3dd7('0x25')](_0x3854fd)[_0x3dd7('0x26')]();};}function respondWithResult(_0x3a5699,_0x35b81a){_0x35b81a=_0x35b81a||0xc8;return function(_0x289d0b){if(_0x289d0b){return _0x3a5699['status'](_0x35b81a)['json'](_0x289d0b);}};}function respondWithFilteredResult(_0x1359a3,_0x17fde4){return function(_0x149f61){if(_0x149f61){var _0x457a7f=_0x149f61[_0x3dd7('0x27')],_0x5ded00=_0x17fde4[_0x3dd7('0x28')],_0x5c20f2=_0x17fde4['offset']+_0x17fde4['limit'],_0x2a782d;if(_0x5c20f2>=_0x457a7f){_0x5c20f2=_0x457a7f;_0x2a782d=0xc8;}else{_0x2a782d=0xce;}_0x1359a3[_0x3dd7('0x25')](_0x2a782d);return _0x1359a3['set'](_0x3dd7('0x29'),_0x5ded00+'-'+_0x5c20f2+'/'+_0x457a7f)[_0x3dd7('0x2a')](_0x149f61);}return null;};}function patchUpdates(_0x598a02){return function(_0x3da969){try{jsonpatch[_0x3dd7('0x2b')](_0x3da969,_0x598a02,!![]);}catch(_0x175e15){return BPromise[_0x3dd7('0x2c')](_0x175e15);}return _0x3da969[_0x3dd7('0x2d')]();};}function saveUpdates(_0x3c8000,_0x23c22a){return function(_0x27e653){if(_0x27e653){return _0x27e653[_0x3dd7('0x2e')](_0x3c8000)[_0x3dd7('0x1a')](function(_0x104895){return _0x104895;});}return null;};}function removeEntity(_0x5d5b66,_0x2783e3){return function(_0x4c8d39){if(_0x4c8d39){return _0x4c8d39[_0x3dd7('0x2f')]()[_0x3dd7('0x1a')](function(){_0x5d5b66['status'](0xcc)[_0x3dd7('0x26')]();});}};}function handleEntityNotFound(_0x5bdf6c,_0x52703a){return function(_0xb74b29){if(!_0xb74b29){_0x5bdf6c[_0x3dd7('0x24')](0x194);}return _0xb74b29;};}function handleError(_0x3aefbe,_0x604290){_0x604290=_0x604290||0x1f4;return function(_0x5912c0){logger[_0x3dd7('0x1f')](_0x5912c0[_0x3dd7('0x30')]);if(_0x5912c0[_0x3dd7('0x31')]){delete _0x5912c0[_0x3dd7('0x31')];}_0x3aefbe[_0x3dd7('0x25')](_0x604290)[_0x3dd7('0x32')](_0x5912c0);};}exports['index']=function(_0x5add2d,_0x3c9834){var _0x48a213={},_0x553940={},_0x2dd224={'count':0x0,'rows':[]};var _0xfc550b=_[_0x3dd7('0x33')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x4fcabc){return{'name':_0x4fcabc[_0x3dd7('0x34')],'type':_0x4fcabc[_0x3dd7('0x35')][_0x3dd7('0x36')]};});_0x553940['model']=_['map'](_0xfc550b,_0x3dd7('0x31'));_0x553940[_0x3dd7('0x37')]=_[_0x3dd7('0x38')](_0x5add2d['query']);_0x553940['filters']=_[_0x3dd7('0x39')](_0x553940['model'],_0x553940[_0x3dd7('0x37')]);_0x48a213[_0x3dd7('0x3a')]=_['intersection'](_0x553940[_0x3dd7('0x3b')],qs['fields'](_0x5add2d[_0x3dd7('0x37')][_0x3dd7('0x3c')]));_0x48a213['attributes']=_0x48a213[_0x3dd7('0x3a')][_0x3dd7('0x3d')]?_0x48a213[_0x3dd7('0x3a')]:_0x553940[_0x3dd7('0x3b')];if(!_0x5add2d[_0x3dd7('0x37')]['hasOwnProperty'](_0x3dd7('0x3e'))){_0x48a213[_0x3dd7('0x3f')]=qs[_0x3dd7('0x3f')](_0x5add2d[_0x3dd7('0x37')]['limit']);_0x48a213[_0x3dd7('0x28')]=qs[_0x3dd7('0x28')](_0x5add2d[_0x3dd7('0x37')][_0x3dd7('0x28')]);}_0x48a213[_0x3dd7('0x40')]=qs[_0x3dd7('0x41')](_0x5add2d[_0x3dd7('0x37')][_0x3dd7('0x41')]);_0x48a213[_0x3dd7('0x42')]=qs[_0x3dd7('0x43')](_[_0x3dd7('0x44')](_0x5add2d[_0x3dd7('0x37')],_0x553940[_0x3dd7('0x43')]),_0xfc550b);if(_0x5add2d[_0x3dd7('0x37')]['filter']){_0x48a213[_0x3dd7('0x42')]=_[_0x3dd7('0x45')](_0x48a213[_0x3dd7('0x42')],{'$or':_['map'](_0xfc550b,function(_0x48fc4e){if(_0x48fc4e[_0x3dd7('0x35')]!==_0x3dd7('0x46')){var _0x17b3da={};_0x17b3da[_0x48fc4e[_0x3dd7('0x31')]]={'$like':'%'+_0x5add2d['query'][_0x3dd7('0x47')]+'%'};return _0x17b3da;}})});}_0x48a213=_[_0x3dd7('0x45')]({},_0x48a213,_0x5add2d[_0x3dd7('0x48')]);var _0x1687a5={'where':_0x48a213['where']};return db[_0x3dd7('0x49')][_0x3dd7('0x27')](_0x1687a5)['then'](function(_0x1f5f4b){_0x2dd224[_0x3dd7('0x27')]=_0x1f5f4b;if(_0x5add2d[_0x3dd7('0x37')][_0x3dd7('0x4a')]){_0x48a213[_0x3dd7('0x4b')]=[{'all':!![]}];}return db[_0x3dd7('0x49')]['findAll'](_0x48a213);})[_0x3dd7('0x1a')](function(_0x5d2775){_0x2dd224[_0x3dd7('0x4c')]=_0x5d2775;return _0x2dd224;})[_0x3dd7('0x1a')](respondWithFilteredResult(_0x3c9834,_0x48a213))[_0x3dd7('0x23')](handleError(_0x3c9834,null));};exports[_0x3dd7('0x4d')]=function(_0x280bdb,_0x20f2b6){var _0x24a03e={'raw':![],'where':{'id':_0x280bdb[_0x3dd7('0x4e')]['id']}},_0x385018={};_0x385018[_0x3dd7('0x3b')]=_['keys'](db['SugarcrmConfiguration'][_0x3dd7('0x4f')]);_0x385018['query']=_['keys'](_0x280bdb[_0x3dd7('0x37')]);_0x385018[_0x3dd7('0x43')]=_['intersection'](_0x385018[_0x3dd7('0x3b')],_0x385018[_0x3dd7('0x37')]);_0x24a03e[_0x3dd7('0x3a')]=_[_0x3dd7('0x39')](_0x385018['model'],qs['fields'](_0x280bdb[_0x3dd7('0x37')][_0x3dd7('0x3c')]));_0x24a03e['attributes']=_0x24a03e['attributes']['length']?_0x24a03e[_0x3dd7('0x3a')]:_0x385018[_0x3dd7('0x3b')];if(_0x280bdb[_0x3dd7('0x37')][_0x3dd7('0x4a')]){_0x24a03e[_0x3dd7('0x4b')]=[{'all':!![]}];}_0x24a03e=_['merge']({},_0x24a03e,_0x280bdb[_0x3dd7('0x48')]);return db[_0x3dd7('0x49')][_0x3dd7('0x50')](_0x24a03e)[_0x3dd7('0x1a')](handleEntityNotFound(_0x20f2b6,null))[_0x3dd7('0x1a')](respondWithResult(_0x20f2b6,null))['catch'](handleError(_0x20f2b6,null));};exports[_0x3dd7('0x51')]=function(_0x25d15c,_0x43b3e6){return db[_0x3dd7('0x49')][_0x3dd7('0x51')](_0x25d15c[_0x3dd7('0x52')],{})['then'](respondWithResult(_0x43b3e6,0xc9))[_0x3dd7('0x23')](handleError(_0x43b3e6,null));};exports['update']=function(_0x16b701,_0x2a25df){if(_0x16b701[_0x3dd7('0x52')]['id']){delete _0x16b701[_0x3dd7('0x52')]['id'];}return db[_0x3dd7('0x49')][_0x3dd7('0x50')]({'where':{'id':_0x16b701['params']['id']}})[_0x3dd7('0x1a')](handleEntityNotFound(_0x2a25df,null))['then'](saveUpdates(_0x16b701[_0x3dd7('0x52')],null))[_0x3dd7('0x1a')](respondWithResult(_0x2a25df,null))[_0x3dd7('0x23')](handleError(_0x2a25df,null));};exports[_0x3dd7('0x2f')]=function(_0x530601,_0xac92d4){return db[_0x3dd7('0x49')][_0x3dd7('0x50')]({'where':{'id':_0x530601[_0x3dd7('0x4e')]['id']}})['then'](handleEntityNotFound(_0xac92d4,null))['then'](removeEntity(_0xac92d4,null))[_0x3dd7('0x23')](handleError(_0xac92d4,null));};exports[_0x3dd7('0x53')]=function(_0x104449,_0x1223d4,_0x1c61a3){var _0x340e6d={};var _0x139efe={};var _0xe46bdb;var _0x20893c;return db[_0x3dd7('0x49')][_0x3dd7('0x54')]({'where':{'id':_0x104449[_0x3dd7('0x4e')]['id']}})[_0x3dd7('0x1a')](handleEntityNotFound(_0x1223d4,null))[_0x3dd7('0x1a')](function(_0x4fd8ac){if(_0x4fd8ac){_0xe46bdb=_0x4fd8ac;_0x139efe['model']=_['keys'](db[_0x3dd7('0x55')]['rawAttributes']);_0x139efe['query']=_['keys'](_0x104449['query']);_0x139efe[_0x3dd7('0x43')]=_[_0x3dd7('0x39')](_0x139efe[_0x3dd7('0x3b')],_0x139efe[_0x3dd7('0x37')]);_0x340e6d[_0x3dd7('0x3a')]=_[_0x3dd7('0x39')](_0x139efe[_0x3dd7('0x3b')],qs[_0x3dd7('0x3c')](_0x104449['query'][_0x3dd7('0x3c')]));_0x340e6d[_0x3dd7('0x3a')]=_0x340e6d[_0x3dd7('0x3a')][_0x3dd7('0x3d')]?_0x340e6d[_0x3dd7('0x3a')]:_0x139efe['model'];_0x340e6d['order']=qs[_0x3dd7('0x41')](_0x104449[_0x3dd7('0x37')][_0x3dd7('0x41')]);_0x340e6d[_0x3dd7('0x42')]=qs['filters'](_['pick'](_0x104449[_0x3dd7('0x37')],_0x139efe['filters']));if(_0x104449[_0x3dd7('0x37')][_0x3dd7('0x47')]){_0x340e6d['where']=_[_0x3dd7('0x45')](_0x340e6d[_0x3dd7('0x42')],{'$or':_[_0x3dd7('0x33')](_0x340e6d[_0x3dd7('0x3a')],function(_0x349da9){var _0x3414a0={};_0x3414a0[_0x349da9]={'$like':'%'+_0x104449['query']['filter']+'%'};return _0x3414a0;})});}_0x340e6d=_[_0x3dd7('0x45')]({},_0x340e6d,_0x104449['options']);return _0xe46bdb[_0x3dd7('0x53')](_0x340e6d);}})[_0x3dd7('0x1a')](function(_0x1d0fba){if(_0x1d0fba){_0x20893c=_0x1d0fba['length'];if(!_0x104449[_0x3dd7('0x37')]['hasOwnProperty']('nolimit')){_0x340e6d['limit']=qs[_0x3dd7('0x3f')](_0x104449[_0x3dd7('0x37')][_0x3dd7('0x3f')]);_0x340e6d['offset']=qs[_0x3dd7('0x28')](_0x104449[_0x3dd7('0x37')]['offset']);}return _0xe46bdb['getFields'](_0x340e6d);}})['then'](function(_0x1a0c55){if(_0x1a0c55){return _0x1a0c55?{'count':_0x20893c,'rows':_0x1a0c55}:null;}})[_0x3dd7('0x1a')](respondWithResult(_0x1223d4,null))['catch'](handleError(_0x1223d4,null));};exports[_0x3dd7('0x56')]=function(_0x2cca8,_0x22fbe1,_0x49e743){var _0x2d7c44={};var _0x4b20dd={};var _0x397955;var _0x384926;return db[_0x3dd7('0x49')][_0x3dd7('0x54')]({'where':{'id':_0x2cca8['params']['id']}})[_0x3dd7('0x1a')](handleEntityNotFound(_0x22fbe1,null))[_0x3dd7('0x1a')](function(_0x5941ee){if(_0x5941ee){_0x397955=_0x5941ee;_0x4b20dd[_0x3dd7('0x3b')]=_[_0x3dd7('0x38')](db[_0x3dd7('0x55')][_0x3dd7('0x4f')]);_0x4b20dd[_0x3dd7('0x37')]=_[_0x3dd7('0x38')](_0x2cca8[_0x3dd7('0x37')]);_0x4b20dd[_0x3dd7('0x43')]=_[_0x3dd7('0x39')](_0x4b20dd[_0x3dd7('0x3b')],_0x4b20dd[_0x3dd7('0x37')]);_0x2d7c44[_0x3dd7('0x3a')]=_[_0x3dd7('0x39')](_0x4b20dd['model'],qs[_0x3dd7('0x3c')](_0x2cca8[_0x3dd7('0x37')][_0x3dd7('0x3c')]));_0x2d7c44['attributes']=_0x2d7c44[_0x3dd7('0x3a')][_0x3dd7('0x3d')]?_0x2d7c44[_0x3dd7('0x3a')]:_0x4b20dd[_0x3dd7('0x3b')];_0x2d7c44[_0x3dd7('0x40')]=qs[_0x3dd7('0x41')](_0x2cca8[_0x3dd7('0x37')]['sort']);_0x2d7c44[_0x3dd7('0x42')]=qs[_0x3dd7('0x43')](_['pick'](_0x2cca8[_0x3dd7('0x37')],_0x4b20dd[_0x3dd7('0x43')]));if(_0x2cca8[_0x3dd7('0x37')][_0x3dd7('0x47')]){_0x2d7c44[_0x3dd7('0x42')]=_[_0x3dd7('0x45')](_0x2d7c44[_0x3dd7('0x42')],{'$or':_[_0x3dd7('0x33')](_0x2d7c44[_0x3dd7('0x3a')],function(_0x269af6){var _0x27225a={};_0x27225a[_0x269af6]={'$like':'%'+_0x2cca8['query'][_0x3dd7('0x47')]+'%'};return _0x27225a;})});}_0x2d7c44=_[_0x3dd7('0x45')]({},_0x2d7c44,_0x2cca8['options']);return _0x397955[_0x3dd7('0x56')](_0x2d7c44);}})[_0x3dd7('0x1a')](function(_0x1b5c83){if(_0x1b5c83){_0x384926=_0x1b5c83[_0x3dd7('0x3d')];if(!_0x2cca8[_0x3dd7('0x37')][_0x3dd7('0x57')]('nolimit')){_0x2d7c44[_0x3dd7('0x3f')]=qs[_0x3dd7('0x3f')](_0x2cca8[_0x3dd7('0x37')]['limit']);_0x2d7c44['offset']=qs[_0x3dd7('0x28')](_0x2cca8['query'][_0x3dd7('0x28')]);}return _0x397955[_0x3dd7('0x56')](_0x2d7c44);}})['then'](function(_0x46939b){if(_0x46939b){return _0x46939b?{'count':_0x384926,'rows':_0x46939b}:null;}})[_0x3dd7('0x1a')](respondWithResult(_0x22fbe1,null))[_0x3dd7('0x23')](handleError(_0x22fbe1,null));};exports[_0x3dd7('0x58')]=function(_0x1d8be5,_0x4102e0,_0x212fc0){var _0x599109={};var _0x5ae19a={};var _0x3ac24f;var _0x5724f5;return db[_0x3dd7('0x49')][_0x3dd7('0x54')]({'where':{'id':_0x1d8be5[_0x3dd7('0x4e')]['id']}})[_0x3dd7('0x1a')](handleEntityNotFound(_0x4102e0,null))['then'](function(_0x342514){if(_0x342514){_0x3ac24f=_0x342514;_0x5ae19a[_0x3dd7('0x3b')]=_[_0x3dd7('0x38')](db[_0x3dd7('0x55')][_0x3dd7('0x4f')]);_0x5ae19a[_0x3dd7('0x37')]=_[_0x3dd7('0x38')](_0x1d8be5[_0x3dd7('0x37')]);_0x5ae19a[_0x3dd7('0x43')]=_[_0x3dd7('0x39')](_0x5ae19a[_0x3dd7('0x3b')],_0x5ae19a[_0x3dd7('0x37')]);_0x599109[_0x3dd7('0x3a')]=_[_0x3dd7('0x39')](_0x5ae19a['model'],qs[_0x3dd7('0x3c')](_0x1d8be5[_0x3dd7('0x37')]['fields']));_0x599109['attributes']=_0x599109[_0x3dd7('0x3a')]['length']?_0x599109[_0x3dd7('0x3a')]:_0x5ae19a[_0x3dd7('0x3b')];_0x599109[_0x3dd7('0x40')]=qs[_0x3dd7('0x41')](_0x1d8be5[_0x3dd7('0x37')][_0x3dd7('0x41')]);_0x599109[_0x3dd7('0x42')]=qs[_0x3dd7('0x43')](_[_0x3dd7('0x44')](_0x1d8be5[_0x3dd7('0x37')],_0x5ae19a['filters']));if(_0x1d8be5[_0x3dd7('0x37')][_0x3dd7('0x47')]){_0x599109[_0x3dd7('0x42')]=_[_0x3dd7('0x45')](_0x599109[_0x3dd7('0x42')],{'$or':_['map'](_0x599109[_0x3dd7('0x3a')],function(_0x3f97e9){var _0x382d6d={};_0x382d6d[_0x3f97e9]={'$like':'%'+_0x1d8be5[_0x3dd7('0x37')]['filter']+'%'};return _0x382d6d;})});}_0x599109=_[_0x3dd7('0x45')]({},_0x599109,_0x1d8be5[_0x3dd7('0x48')]);return _0x3ac24f['getDescriptions'](_0x599109);}})[_0x3dd7('0x1a')](function(_0x1eab44){if(_0x1eab44){_0x5724f5=_0x1eab44[_0x3dd7('0x3d')];if(!_0x1d8be5['query'][_0x3dd7('0x57')](_0x3dd7('0x3e'))){_0x599109['limit']=qs[_0x3dd7('0x3f')](_0x1d8be5['query'][_0x3dd7('0x3f')]);_0x599109['offset']=qs['offset'](_0x1d8be5[_0x3dd7('0x37')]['offset']);}return _0x3ac24f['getDescriptions'](_0x599109);}})[_0x3dd7('0x1a')](function(_0x2a84ab){if(_0x2a84ab){return _0x2a84ab?{'count':_0x5724f5,'rows':_0x2a84ab}:null;}})['then'](respondWithResult(_0x4102e0,null))[_0x3dd7('0x23')](handleError(_0x4102e0,null));}; \ No newline at end of file +var _0x4186=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','destroy','stack','name','index','SugarcrmConfiguration','rawAttributes','model','map','query','filters','attributes','fields','length','limit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','show','params','keys','intersection','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','SugarcrmField','getDescriptions','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x4186,0xfd));var _0x6418=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0x4186[_0x3a6e4b];return _0x36572d;};'use strict';var pdf=require(_0x6418('0x0'));var emlformat=require(_0x6418('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6418('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6418('0x3'));var moment=require(_0x6418('0x4'));var BPromise=require(_0x6418('0x5'));var Mustache=require(_0x6418('0x6'));var util=require(_0x6418('0x7'));var path=require(_0x6418('0x8'));var sox=require(_0x6418('0x9'));var csv=require(_0x6418('0xa'));var ejs=require(_0x6418('0xb'));var fs=require('fs');var _=require(_0x6418('0xc'));var squel=require(_0x6418('0xd'));var crypto=require(_0x6418('0xe'));var jsforce=require(_0x6418('0xf'));var deskjs=require(_0x6418('0x10'));var toCsv=require(_0x6418('0xa'));var querystring=require('querystring');var Papa=require(_0x6418('0x11'));var Redis=require(_0x6418('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6418('0x13'));var as=require(_0x6418('0x14'));var hardwareService=require(_0x6418('0x15'));var logger=require(_0x6418('0x16'))(_0x6418('0x17'));var utils=require(_0x6418('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6418('0x19'));var db=require(_0x6418('0x1a'))['db'];var jayson=require(_0x6418('0x1b'));var client=jayson[_0x6418('0x1c')][_0x6418('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x339234,_0x42e68f,_0xecb9b,_0xb0c920){return new BPromise(function(_0x418f54,_0x3b6c79){var _0x2d6332=_0xb0c920||client;return _0x2d6332[_0x6418('0x1e')](_0x339234,_0xecb9b)[_0x6418('0x1f')](function(_0x2fcfcf){logger['info'](_0x6418('0x20'),_0x42e68f,_0x6418('0x21'));logger[_0x6418('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x42e68f,_0x6418('0x21'),JSON[_0x6418('0x23')](_0x2fcfcf));if(_0x2fcfcf[_0x6418('0x24')]){if(_0x2fcfcf[_0x6418('0x24')][_0x6418('0x25')]===0x1f4){logger[_0x6418('0x24')](_0x6418('0x20'),_0x42e68f,_0x2fcfcf[_0x6418('0x24')]['message']);return _0x3b6c79(_0x2fcfcf[_0x6418('0x24')][_0x6418('0x26')]);}logger['error'](_0x6418('0x20'),_0x42e68f,_0x2fcfcf['error'][_0x6418('0x26')]);return _0x418f54(_0x2fcfcf[_0x6418('0x24')]['message']);}else{logger[_0x6418('0x27')](_0x6418('0x20'),_0x42e68f,_0x6418('0x21'));_0x418f54(_0x2fcfcf[_0x6418('0x28')]['message']);}})[_0x6418('0x29')](function(_0x4697a9){logger[_0x6418('0x24')](_0x6418('0x20'),_0x42e68f,_0x4697a9);_0x3b6c79(_0x4697a9);});});}function respondWithStatusCode(_0xe34e05,_0x1528be){_0x1528be=_0x1528be||0xcc;return function(_0x156ac0){if(_0x156ac0){return _0xe34e05[_0x6418('0x2a')](_0x1528be);}return _0xe34e05[_0x6418('0x2b')](_0x1528be)[_0x6418('0x2c')]();};}function respondWithResult(_0x30e714,_0x2a944e){_0x2a944e=_0x2a944e||0xc8;return function(_0x45745a){if(_0x45745a){return _0x30e714[_0x6418('0x2b')](_0x2a944e)['json'](_0x45745a);}};}function respondWithFilteredResult(_0x2ddbdc,_0x27e567){return function(_0x3ff0f9){if(_0x3ff0f9){var _0xa31171=_0x3ff0f9[_0x6418('0x2d')],_0x40916e=_0x27e567[_0x6418('0x2e')],_0x7827fa=_0x27e567['offset']+_0x27e567['limit'],_0x1d1ca8;if(_0x7827fa>=_0xa31171){_0x7827fa=_0xa31171;_0x1d1ca8=0xc8;}else{_0x1d1ca8=0xce;}_0x2ddbdc[_0x6418('0x2b')](_0x1d1ca8);return _0x2ddbdc[_0x6418('0x2f')](_0x6418('0x30'),_0x40916e+'-'+_0x7827fa+'/'+_0xa31171)[_0x6418('0x31')](_0x3ff0f9);}return null;};}function patchUpdates(_0x11a46e){return function(_0xa945e9){try{jsonpatch[_0x6418('0x32')](_0xa945e9,_0x11a46e,!![]);}catch(_0x51f783){return BPromise['reject'](_0x51f783);}return _0xa945e9['save']();};}function saveUpdates(_0x10bbec,_0x1d422b){return function(_0x39d136){if(_0x39d136){return _0x39d136['update'](_0x10bbec)['then'](function(_0x4e7185){return _0x4e7185;});}return null;};}function removeEntity(_0x2951ac,_0x1bcc0f){return function(_0x1a4136){if(_0x1a4136){return _0x1a4136[_0x6418('0x33')]()['then'](function(){_0x2951ac[_0x6418('0x2b')](0xcc)[_0x6418('0x2c')]();});}};}function handleEntityNotFound(_0x20d1a7,_0x2f84b7){return function(_0xceaa59){if(!_0xceaa59){_0x20d1a7[_0x6418('0x2a')](0x194);}return _0xceaa59;};}function handleError(_0x483500,_0x1e6703){_0x1e6703=_0x1e6703||0x1f4;return function(_0x20430e){logger[_0x6418('0x24')](_0x20430e[_0x6418('0x34')]);if(_0x20430e[_0x6418('0x35')]){delete _0x20430e[_0x6418('0x35')];}_0x483500[_0x6418('0x2b')](_0x1e6703)['send'](_0x20430e);};}exports[_0x6418('0x36')]=function(_0x3659e9,_0x249a3d){var _0x3bdc5e={},_0x36beba={},_0x270ca6={'count':0x0,'rows':[]};var _0x17da3c=_['map'](db[_0x6418('0x37')][_0x6418('0x38')],function(_0x439f80){return{'name':_0x439f80['fieldName'],'type':_0x439f80['type']['key']};});_0x36beba[_0x6418('0x39')]=_[_0x6418('0x3a')](_0x17da3c,_0x6418('0x35'));_0x36beba[_0x6418('0x3b')]=_['keys'](_0x3659e9['query']);_0x36beba[_0x6418('0x3c')]=_['intersection'](_0x36beba['model'],_0x36beba['query']);_0x3bdc5e[_0x6418('0x3d')]=_['intersection'](_0x36beba[_0x6418('0x39')],qs[_0x6418('0x3e')](_0x3659e9[_0x6418('0x3b')][_0x6418('0x3e')]));_0x3bdc5e['attributes']=_0x3bdc5e[_0x6418('0x3d')][_0x6418('0x3f')]?_0x3bdc5e['attributes']:_0x36beba['model'];if(!_0x3659e9[_0x6418('0x3b')]['hasOwnProperty']('nolimit')){_0x3bdc5e[_0x6418('0x40')]=qs[_0x6418('0x40')](_0x3659e9[_0x6418('0x3b')]['limit']);_0x3bdc5e['offset']=qs[_0x6418('0x2e')](_0x3659e9['query'][_0x6418('0x2e')]);}_0x3bdc5e[_0x6418('0x41')]=qs['sort'](_0x3659e9[_0x6418('0x3b')][_0x6418('0x42')]);_0x3bdc5e[_0x6418('0x43')]=qs[_0x6418('0x3c')](_[_0x6418('0x44')](_0x3659e9[_0x6418('0x3b')],_0x36beba['filters']),_0x17da3c);if(_0x3659e9[_0x6418('0x3b')][_0x6418('0x45')]){_0x3bdc5e[_0x6418('0x43')]=_[_0x6418('0x46')](_0x3bdc5e['where'],{'$or':_[_0x6418('0x3a')](_0x17da3c,function(_0x2487d0){if(_0x2487d0[_0x6418('0x47')]!=='VIRTUAL'){var _0x5b9888={};_0x5b9888[_0x2487d0[_0x6418('0x35')]]={'$like':'%'+_0x3659e9[_0x6418('0x3b')][_0x6418('0x45')]+'%'};return _0x5b9888;}})});}_0x3bdc5e=_[_0x6418('0x46')]({},_0x3bdc5e,_0x3659e9[_0x6418('0x48')]);var _0x51f6fc={'where':_0x3bdc5e[_0x6418('0x43')]};return db[_0x6418('0x37')][_0x6418('0x2d')](_0x51f6fc)[_0x6418('0x1f')](function(_0x2809e){_0x270ca6['count']=_0x2809e;if(_0x3659e9[_0x6418('0x3b')][_0x6418('0x49')]){_0x3bdc5e[_0x6418('0x4a')]=[{'all':!![]}];}return db[_0x6418('0x37')][_0x6418('0x4b')](_0x3bdc5e);})[_0x6418('0x1f')](function(_0x2a8efc){_0x270ca6['rows']=_0x2a8efc;return _0x270ca6;})[_0x6418('0x1f')](respondWithFilteredResult(_0x249a3d,_0x3bdc5e))[_0x6418('0x29')](handleError(_0x249a3d,null));};exports[_0x6418('0x4c')]=function(_0x384e4c,_0x7c6ec4){var _0x51ae6b={'raw':![],'where':{'id':_0x384e4c[_0x6418('0x4d')]['id']}},_0x4174a1={};_0x4174a1[_0x6418('0x39')]=_[_0x6418('0x4e')](db['SugarcrmConfiguration'][_0x6418('0x38')]);_0x4174a1['query']=_['keys'](_0x384e4c[_0x6418('0x3b')]);_0x4174a1[_0x6418('0x3c')]=_[_0x6418('0x4f')](_0x4174a1[_0x6418('0x39')],_0x4174a1[_0x6418('0x3b')]);_0x51ae6b[_0x6418('0x3d')]=_[_0x6418('0x4f')](_0x4174a1[_0x6418('0x39')],qs[_0x6418('0x3e')](_0x384e4c[_0x6418('0x3b')]['fields']));_0x51ae6b[_0x6418('0x3d')]=_0x51ae6b['attributes'][_0x6418('0x3f')]?_0x51ae6b['attributes']:_0x4174a1['model'];if(_0x384e4c[_0x6418('0x3b')][_0x6418('0x49')]){_0x51ae6b['include']=[{'all':!![]}];}_0x51ae6b=_[_0x6418('0x46')]({},_0x51ae6b,_0x384e4c[_0x6418('0x48')]);return db[_0x6418('0x37')][_0x6418('0x50')](_0x51ae6b)[_0x6418('0x1f')](handleEntityNotFound(_0x7c6ec4,null))[_0x6418('0x1f')](respondWithResult(_0x7c6ec4,null))[_0x6418('0x29')](handleError(_0x7c6ec4,null));};exports[_0x6418('0x51')]=function(_0x23bb61,_0x13b5e8){return db['SugarcrmConfiguration'][_0x6418('0x51')](_0x23bb61[_0x6418('0x52')],{})['then'](respondWithResult(_0x13b5e8,0xc9))['catch'](handleError(_0x13b5e8,null));};exports['update']=function(_0x396e3f,_0x5db265){if(_0x396e3f[_0x6418('0x52')]['id']){delete _0x396e3f[_0x6418('0x52')]['id'];}return db['SugarcrmConfiguration'][_0x6418('0x50')]({'where':{'id':_0x396e3f[_0x6418('0x4d')]['id']}})[_0x6418('0x1f')](handleEntityNotFound(_0x5db265,null))[_0x6418('0x1f')](saveUpdates(_0x396e3f[_0x6418('0x52')],null))[_0x6418('0x1f')](respondWithResult(_0x5db265,null))[_0x6418('0x29')](handleError(_0x5db265,null));};exports[_0x6418('0x33')]=function(_0x489174,_0x1ec7ce){return db[_0x6418('0x37')][_0x6418('0x50')]({'where':{'id':_0x489174[_0x6418('0x4d')]['id']}})[_0x6418('0x1f')](handleEntityNotFound(_0x1ec7ce,null))['then'](removeEntity(_0x1ec7ce,null))[_0x6418('0x29')](handleError(_0x1ec7ce,null));};exports[_0x6418('0x53')]=function(_0x387763,_0x53ff49,_0x4b06da){var _0x48b683={};var _0x2d7786={};var _0x1d1d8f;var _0x397c0b;return db[_0x6418('0x37')][_0x6418('0x54')]({'where':{'id':_0x387763['params']['id']}})[_0x6418('0x1f')](handleEntityNotFound(_0x53ff49,null))[_0x6418('0x1f')](function(_0x162e21){if(_0x162e21){_0x1d1d8f=_0x162e21;_0x2d7786[_0x6418('0x39')]=_[_0x6418('0x4e')](db['SugarcrmField']['rawAttributes']);_0x2d7786['query']=_[_0x6418('0x4e')](_0x387763['query']);_0x2d7786[_0x6418('0x3c')]=_[_0x6418('0x4f')](_0x2d7786[_0x6418('0x39')],_0x2d7786[_0x6418('0x3b')]);_0x48b683[_0x6418('0x3d')]=_[_0x6418('0x4f')](_0x2d7786[_0x6418('0x39')],qs[_0x6418('0x3e')](_0x387763['query']['fields']));_0x48b683[_0x6418('0x3d')]=_0x48b683[_0x6418('0x3d')][_0x6418('0x3f')]?_0x48b683[_0x6418('0x3d')]:_0x2d7786[_0x6418('0x39')];_0x48b683[_0x6418('0x41')]=qs[_0x6418('0x42')](_0x387763[_0x6418('0x3b')][_0x6418('0x42')]);_0x48b683[_0x6418('0x43')]=qs[_0x6418('0x3c')](_[_0x6418('0x44')](_0x387763[_0x6418('0x3b')],_0x2d7786['filters']));if(_0x387763[_0x6418('0x3b')][_0x6418('0x45')]){_0x48b683[_0x6418('0x43')]=_['merge'](_0x48b683[_0x6418('0x43')],{'$or':_[_0x6418('0x3a')](_0x48b683[_0x6418('0x3d')],function(_0x1d174d){var _0x56c393={};_0x56c393[_0x1d174d]={'$like':'%'+_0x387763['query']['filter']+'%'};return _0x56c393;})});}_0x48b683=_['merge']({},_0x48b683,_0x387763[_0x6418('0x48')]);return _0x1d1d8f[_0x6418('0x53')](_0x48b683);}})[_0x6418('0x1f')](function(_0x4cdafc){if(_0x4cdafc){_0x397c0b=_0x4cdafc[_0x6418('0x3f')];if(!_0x387763['query'][_0x6418('0x55')]('nolimit')){_0x48b683['limit']=qs[_0x6418('0x40')](_0x387763[_0x6418('0x3b')][_0x6418('0x40')]);_0x48b683[_0x6418('0x2e')]=qs[_0x6418('0x2e')](_0x387763['query'][_0x6418('0x2e')]);}return _0x1d1d8f[_0x6418('0x53')](_0x48b683);}})[_0x6418('0x1f')](function(_0x1bf0a6){if(_0x1bf0a6){return _0x1bf0a6?{'count':_0x397c0b,'rows':_0x1bf0a6}:null;}})['then'](respondWithResult(_0x53ff49,null))[_0x6418('0x29')](handleError(_0x53ff49,null));};exports[_0x6418('0x56')]=function(_0x32544a,_0x5ccaf3,_0x5b9368){var _0xd6b31a={};var _0xab3f25={};var _0x11e55b;var _0x11a01c;return db[_0x6418('0x37')]['findOne']({'where':{'id':_0x32544a[_0x6418('0x4d')]['id']}})[_0x6418('0x1f')](handleEntityNotFound(_0x5ccaf3,null))[_0x6418('0x1f')](function(_0x1e9f62){if(_0x1e9f62){_0x11e55b=_0x1e9f62;_0xab3f25[_0x6418('0x39')]=_[_0x6418('0x4e')](db[_0x6418('0x57')][_0x6418('0x38')]);_0xab3f25[_0x6418('0x3b')]=_[_0x6418('0x4e')](_0x32544a[_0x6418('0x3b')]);_0xab3f25[_0x6418('0x3c')]=_['intersection'](_0xab3f25[_0x6418('0x39')],_0xab3f25['query']);_0xd6b31a[_0x6418('0x3d')]=_['intersection'](_0xab3f25['model'],qs[_0x6418('0x3e')](_0x32544a['query'][_0x6418('0x3e')]));_0xd6b31a['attributes']=_0xd6b31a[_0x6418('0x3d')][_0x6418('0x3f')]?_0xd6b31a[_0x6418('0x3d')]:_0xab3f25[_0x6418('0x39')];_0xd6b31a['order']=qs['sort'](_0x32544a[_0x6418('0x3b')][_0x6418('0x42')]);_0xd6b31a[_0x6418('0x43')]=qs['filters'](_[_0x6418('0x44')](_0x32544a[_0x6418('0x3b')],_0xab3f25[_0x6418('0x3c')]));if(_0x32544a[_0x6418('0x3b')][_0x6418('0x45')]){_0xd6b31a[_0x6418('0x43')]=_[_0x6418('0x46')](_0xd6b31a[_0x6418('0x43')],{'$or':_[_0x6418('0x3a')](_0xd6b31a[_0x6418('0x3d')],function(_0x3bf827){var _0xf74430={};_0xf74430[_0x3bf827]={'$like':'%'+_0x32544a[_0x6418('0x3b')][_0x6418('0x45')]+'%'};return _0xf74430;})});}_0xd6b31a=_[_0x6418('0x46')]({},_0xd6b31a,_0x32544a['options']);return _0x11e55b['getSubjects'](_0xd6b31a);}})[_0x6418('0x1f')](function(_0x3082d0){if(_0x3082d0){_0x11a01c=_0x3082d0[_0x6418('0x3f')];if(!_0x32544a[_0x6418('0x3b')][_0x6418('0x55')]('nolimit')){_0xd6b31a[_0x6418('0x40')]=qs[_0x6418('0x40')](_0x32544a[_0x6418('0x3b')][_0x6418('0x40')]);_0xd6b31a[_0x6418('0x2e')]=qs[_0x6418('0x2e')](_0x32544a[_0x6418('0x3b')][_0x6418('0x2e')]);}return _0x11e55b[_0x6418('0x56')](_0xd6b31a);}})['then'](function(_0x293a8b){if(_0x293a8b){return _0x293a8b?{'count':_0x11a01c,'rows':_0x293a8b}:null;}})[_0x6418('0x1f')](respondWithResult(_0x5ccaf3,null))[_0x6418('0x29')](handleError(_0x5ccaf3,null));};exports[_0x6418('0x58')]=function(_0x29f570,_0x3ad369,_0x361bcf){var _0x38d57a={};var _0x2fe85e={};var _0x2ca51a;var _0x4ac16e;return db[_0x6418('0x37')][_0x6418('0x54')]({'where':{'id':_0x29f570[_0x6418('0x4d')]['id']}})[_0x6418('0x1f')](handleEntityNotFound(_0x3ad369,null))[_0x6418('0x1f')](function(_0x127b88){if(_0x127b88){_0x2ca51a=_0x127b88;_0x2fe85e[_0x6418('0x39')]=_[_0x6418('0x4e')](db[_0x6418('0x57')][_0x6418('0x38')]);_0x2fe85e[_0x6418('0x3b')]=_[_0x6418('0x4e')](_0x29f570[_0x6418('0x3b')]);_0x2fe85e[_0x6418('0x3c')]=_[_0x6418('0x4f')](_0x2fe85e['model'],_0x2fe85e[_0x6418('0x3b')]);_0x38d57a[_0x6418('0x3d')]=_[_0x6418('0x4f')](_0x2fe85e[_0x6418('0x39')],qs[_0x6418('0x3e')](_0x29f570['query']['fields']));_0x38d57a[_0x6418('0x3d')]=_0x38d57a[_0x6418('0x3d')][_0x6418('0x3f')]?_0x38d57a['attributes']:_0x2fe85e['model'];_0x38d57a[_0x6418('0x41')]=qs[_0x6418('0x42')](_0x29f570['query'][_0x6418('0x42')]);_0x38d57a[_0x6418('0x43')]=qs['filters'](_[_0x6418('0x44')](_0x29f570[_0x6418('0x3b')],_0x2fe85e[_0x6418('0x3c')]));if(_0x29f570[_0x6418('0x3b')][_0x6418('0x45')]){_0x38d57a[_0x6418('0x43')]=_[_0x6418('0x46')](_0x38d57a[_0x6418('0x43')],{'$or':_[_0x6418('0x3a')](_0x38d57a[_0x6418('0x3d')],function(_0x4e6f41){var _0xb10970={};_0xb10970[_0x4e6f41]={'$like':'%'+_0x29f570[_0x6418('0x3b')]['filter']+'%'};return _0xb10970;})});}_0x38d57a=_[_0x6418('0x46')]({},_0x38d57a,_0x29f570['options']);return _0x2ca51a['getDescriptions'](_0x38d57a);}})[_0x6418('0x1f')](function(_0x3a3434){if(_0x3a3434){_0x4ac16e=_0x3a3434[_0x6418('0x3f')];if(!_0x29f570[_0x6418('0x3b')][_0x6418('0x55')]('nolimit')){_0x38d57a[_0x6418('0x40')]=qs[_0x6418('0x40')](_0x29f570['query'][_0x6418('0x40')]);_0x38d57a[_0x6418('0x2e')]=qs['offset'](_0x29f570['query'][_0x6418('0x2e')]);}return _0x2ca51a[_0x6418('0x58')](_0x38d57a);}})['then'](function(_0x44fe77){if(_0x44fe77){return _0x44fe77?{'count':_0x4ac16e,'rows':_0x44fe77}:null;}})[_0x6418('0x1f')](respondWithResult(_0x3ad369,null))['catch'](handleError(_0x3ad369,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ed9c445..ee03c73 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 _0x8b35=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b35,0x184));var _0x58b3=function(_0x49f689,_0x1b6fc2){_0x49f689=_0x49f689-0x0;var _0x427ce8=_0x8b35[_0x49f689];return _0x427ce8;};'use strict';var _=require('lodash');var util=require(_0x58b3('0x0'));var logger=require(_0x58b3('0x1'))(_0x58b3('0x2'));var moment=require(_0x58b3('0x3'));var BPromise=require(_0x58b3('0x4'));var rp=require(_0x58b3('0x5'));var fs=require('fs');var path=require(_0x58b3('0x6'));var rimraf=require('rimraf');var config=require(_0x58b3('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x58b3('0x8')]=function(_0x2be769,_0x566197){return _0x2be769['define'](_0x58b3('0x9'),attributes,{'tableName':_0x58b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcde1=['path','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x2f7b33,_0x4dc65f){var _0x4db1cb=function(_0x10e931){while(--_0x10e931){_0x2f7b33['push'](_0x2f7b33['shift']());}};_0x4db1cb(++_0x4dc65f);}(_0xcde1,0x1db));var _0x1cde=function(_0xff456d,_0x16c7cb){_0xff456d=_0xff456d-0x0;var _0x38e493=_0xcde1[_0xff456d];return _0x38e493;};'use strict';var _=require(_0x1cde('0x0'));var util=require(_0x1cde('0x1'));var logger=require(_0x1cde('0x2'))(_0x1cde('0x3'));var moment=require(_0x1cde('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cde('0x5'));var rimraf=require('rimraf');var config=require(_0x1cde('0x6'));var attributes=require(_0x1cde('0x7'));module['exports']=function(_0xf0198b,_0x36087d){return _0xf0198b[_0x1cde('0x8')](_0x1cde('0x9'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 293999d..29aecc4 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 _0x21e8=['error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','request\x20sent','debug','stringify'];(function(_0x2e7491,_0x272655){var _0x48ba78=function(_0x419aa8){while(--_0x419aa8){_0x2e7491['push'](_0x2e7491['shift']());}};_0x48ba78(++_0x272655);}(_0x21e8,0x1d4));var _0x821e=function(_0xe461a6,_0x250bd6){_0xe461a6=_0xe461a6-0x0;var _0xaa102=_0x21e8[_0xe461a6];return _0xaa102;};'use strict';var _=require(_0x821e('0x0'));var util=require(_0x821e('0x1'));var moment=require(_0x821e('0x2'));var BPromise=require(_0x821e('0x3'));var rs=require(_0x821e('0x4'));var fs=require('fs');var Redis=require(_0x821e('0x5'));var db=require(_0x821e('0x6'))['db'];var utils=require(_0x821e('0x7'));var logger=require(_0x821e('0x8'))(_0x821e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x821e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52c5d7,_0x21bdc3,_0x3bfc22){return new BPromise(function(_0x237695,_0x92c1ec){return client['request'](_0x52c5d7,_0x3bfc22)['then'](function(_0x2ab196){logger[_0x821e('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x21bdc3,_0x821e('0xc'));logger[_0x821e('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x21bdc3,'request\x20sent',JSON[_0x821e('0xe')](_0x2ab196));if(_0x2ab196['error']){if(_0x2ab196[_0x821e('0xf')][_0x821e('0x10')]===0x1f4){logger['error'](_0x821e('0x11'),_0x21bdc3,_0x2ab196[_0x821e('0xf')]['message']);return _0x92c1ec(_0x2ab196[_0x821e('0xf')]['message']);}logger[_0x821e('0xf')](_0x821e('0x11'),_0x21bdc3,_0x2ab196[_0x821e('0xf')][_0x821e('0x12')]);return _0x237695(_0x2ab196[_0x821e('0xf')][_0x821e('0x12')]);}else{logger[_0x821e('0xb')](_0x821e('0x11'),_0x21bdc3,_0x821e('0xc'));_0x237695(_0x2ab196[_0x821e('0x13')]['message']);}})[_0x821e('0x14')](function(_0x2dc70f){logger[_0x821e('0xf')](_0x821e('0x11'),_0x21bdc3,_0x2dc70f);_0x92c1ec(_0x2dc70f);});});} \ No newline at end of file +var _0x0578=['code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','error'];(function(_0x557575,_0x33e4c6){var _0x4bba29=function(_0x44ed48){while(--_0x44ed48){_0x557575['push'](_0x557575['shift']());}};_0x4bba29(++_0x33e4c6);}(_0x0578,0xbf));var _0x8057=function(_0x2a84ef,_0x50ab86){_0x2a84ef=_0x2a84ef-0x0;var _0x540ccd=_0x0578[_0x2a84ef];return _0x540ccd;};'use strict';var _=require(_0x8057('0x0'));var util=require(_0x8057('0x1'));var moment=require('moment');var BPromise=require(_0x8057('0x2'));var rs=require(_0x8057('0x3'));var fs=require('fs');var Redis=require(_0x8057('0x4'));var db=require(_0x8057('0x5'))['db'];var utils=require(_0x8057('0x6'));var logger=require(_0x8057('0x7'))(_0x8057('0x8'));var config=require(_0x8057('0x9'));var jayson=require(_0x8057('0xa'));var client=jayson[_0x8057('0xb')][_0x8057('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f1b15,_0x402667,_0x402a03){return new BPromise(function(_0x1689ae,_0x1972d7){return client[_0x8057('0xd')](_0x5f1b15,_0x402a03)[_0x8057('0xe')](function(_0x5d14e3){logger[_0x8057('0xf')](_0x8057('0x10'),_0x402667,'request\x20sent');logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x402667,_0x8057('0x11'),JSON['stringify'](_0x5d14e3));if(_0x5d14e3[_0x8057('0x12')]){if(_0x5d14e3[_0x8057('0x12')][_0x8057('0x13')]===0x1f4){logger[_0x8057('0x12')](_0x8057('0x10'),_0x402667,_0x5d14e3['error'][_0x8057('0x14')]);return _0x1972d7(_0x5d14e3[_0x8057('0x12')]['message']);}logger['error'](_0x8057('0x10'),_0x402667,_0x5d14e3[_0x8057('0x12')][_0x8057('0x14')]);return _0x1689ae(_0x5d14e3[_0x8057('0x12')][_0x8057('0x14')]);}else{logger[_0x8057('0xf')](_0x8057('0x10'),_0x402667,_0x8057('0x11'));_0x1689ae(_0x5d14e3['result'][_0x8057('0x14')]);}})['catch'](function(_0x88c8c9){logger[_0x8057('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x402667,_0x88c8c9);_0x1972d7(_0x88c8c9);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index a85a4dc..3592656 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 _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0xcb91[_0x381379];return _0x3e1063;};'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('./intSugarcrmField.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x24aa6b,_0x5990e1){var _0x572266=function(_0x5ef779){while(--_0x5ef779){_0x24aa6b['push'](_0x24aa6b['shift']());}};_0x572266(++_0x5990e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 83871da..1edbf43 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 _0xd691=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0xec71c6,_0x7ec2d5){var _0x457791=function(_0x3bf3d7){while(--_0x3bf3d7){_0xec71c6['push'](_0xec71c6['shift']());}};_0x457791(++_0x7ec2d5);}(_0xd691,0xe6));var _0x1d69=function(_0x105a8e,_0x12dd9a){_0x105a8e=_0x105a8e-0x0;var _0x298729=_0xd691[_0x105a8e];return _0x298729;};'use strict';var Sequelize=require(_0x1d69('0x0'));module[_0x1d69('0x1')]={'type':{'type':Sequelize[_0x1d69('0x2')]('string',_0x1d69('0x3'),_0x1d69('0x4'),_0x1d69('0x5'),_0x1d69('0x6')),'defaultValue':_0x1d69('0x7')},'content':{'type':Sequelize[_0x1d69('0x8')]},'key':{'type':Sequelize[_0x1d69('0x8')]},'keyType':{'type':Sequelize[_0x1d69('0x2')](_0x1d69('0x7'),_0x1d69('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1d69('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1d69('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d69('0x8')]}}; \ No newline at end of file +var _0xedd9=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x18a72f,_0x3aacc9){var _0x3ef7e7=function(_0x371e73){while(--_0x371e73){_0x18a72f['push'](_0x18a72f['shift']());}};_0x3ef7e7(++_0x3aacc9);}(_0xedd9,0xfc));var _0x9edd=function(_0x85a68d,_0x2094e6){_0x85a68d=_0x85a68d-0x0;var _0x41212f=_0xedd9[_0x85a68d];return _0x41212f;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'type':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2'),_0x9edd('0x3'),_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'defaultValue':_0x9edd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9edd('0x7')]},'keyType':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2'),_0x9edd('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9edd('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9edd('0x7')]},'customField':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5ce7f68..439362d 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 _0x950a=['lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x950a,0x111));var _0xa950=function(_0x540e12,_0x4a993f){_0x540e12=_0x540e12-0x0;var _0x5e4e6b=_0x950a[_0x540e12];return _0x5e4e6b;};'use strict';var pdf=require(_0xa950('0x0'));var emlformat=require(_0xa950('0x1'));var rimraf=require(_0xa950('0x2'));var zipdir=require(_0xa950('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa950('0x4'));var moment=require(_0xa950('0x5'));var BPromise=require(_0xa950('0x6'));var Mustache=require(_0xa950('0x7'));var util=require('util');var path=require(_0xa950('0x8'));var sox=require(_0xa950('0x9'));var csv=require('to-csv');var ejs=require(_0xa950('0xa'));var fs=require('fs');var _=require(_0xa950('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa950('0xc'));var deskjs=require(_0xa950('0xd'));var toCsv=require(_0xa950('0xe'));var querystring=require(_0xa950('0xf'));var Papa=require(_0xa950('0x10'));var Redis=require(_0xa950('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa950('0x12'));var logger=require('../../config/logger')(_0xa950('0x13'));var utils=require(_0xa950('0x14'));var config=require(_0xa950('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa950('0x16'))['db'];function respondWithStatusCode(_0x4f9c04,_0x10e64a){_0x10e64a=_0x10e64a||0xcc;return function(_0x439097){if(_0x439097){return _0x4f9c04[_0xa950('0x17')](_0x10e64a);}return _0x4f9c04['status'](_0x10e64a)[_0xa950('0x18')]();};}function respondWithResult(_0x2aed6a,_0x1c7adb){_0x1c7adb=_0x1c7adb||0xc8;return function(_0x4ba74f){if(_0x4ba74f){return _0x2aed6a[_0xa950('0x19')](_0x1c7adb)[_0xa950('0x1a')](_0x4ba74f);}};}function respondWithFilteredResult(_0x425201,_0x5d5f4c){return function(_0x31b25b){if(_0x31b25b){var _0x46fca7=_0x31b25b[_0xa950('0x1b')],_0x1598a8=_0x5d5f4c[_0xa950('0x1c')],_0x4df9d1=_0x5d5f4c[_0xa950('0x1c')]+_0x5d5f4c[_0xa950('0x1d')],_0x146361;if(_0x4df9d1>=_0x46fca7){_0x4df9d1=_0x46fca7;_0x146361=0xc8;}else{_0x146361=0xce;}_0x425201[_0xa950('0x19')](_0x146361);return _0x425201[_0xa950('0x1e')](_0xa950('0x1f'),_0x1598a8+'-'+_0x4df9d1+'/'+_0x46fca7)[_0xa950('0x1a')](_0x31b25b);}return null;};}function patchUpdates(_0x18266c){return function(_0x28fedf){try{jsonpatch[_0xa950('0x20')](_0x28fedf,_0x18266c,!![]);}catch(_0xc690ae){return BPromise['reject'](_0xc690ae);}return _0x28fedf[_0xa950('0x21')]();};}function saveUpdates(_0x1a10fe,_0x50abe1){return function(_0x1f9894){if(_0x1f9894){return _0x1f9894[_0xa950('0x22')](_0x1a10fe)['then'](function(_0x2e6f72){return _0x2e6f72;});}return null;};}function removeEntity(_0x5ad191,_0x2eda79){return function(_0x14ada5){if(_0x14ada5){return _0x14ada5[_0xa950('0x23')]()[_0xa950('0x24')](function(){_0x5ad191['status'](0xcc)[_0xa950('0x18')]();});}};}function handleEntityNotFound(_0x3f4633,_0x31c135){return function(_0x897178){if(!_0x897178){_0x3f4633[_0xa950('0x17')](0x194);}return _0x897178;};}function handleError(_0x22e2c1,_0x300448){_0x300448=_0x300448||0x1f4;return function(_0x23cb20){logger[_0xa950('0x25')](_0x23cb20[_0xa950('0x26')]);if(_0x23cb20[_0xa950('0x27')]){delete _0x23cb20[_0xa950('0x27')];}_0x22e2c1[_0xa950('0x19')](_0x300448)['send'](_0x23cb20);};}exports[_0xa950('0x28')]=function(_0x288934,_0x3f37f8){var _0x1aa96a={},_0x31c168={},_0x186f35={'count':0x0,'rows':[]};var _0x2891ba=_['map'](db[_0xa950('0x29')][_0xa950('0x2a')],function(_0x5e4c94){return{'name':_0x5e4c94[_0xa950('0x2b')],'type':_0x5e4c94[_0xa950('0x2c')][_0xa950('0x2d')]};});_0x31c168[_0xa950('0x2e')]=_[_0xa950('0x2f')](_0x2891ba,_0xa950('0x27'));_0x31c168[_0xa950('0x30')]=_[_0xa950('0x31')](_0x288934[_0xa950('0x30')]);_0x31c168[_0xa950('0x32')]=_['intersection'](_0x31c168[_0xa950('0x2e')],_0x31c168['query']);_0x1aa96a['attributes']=_[_0xa950('0x33')](_0x31c168['model'],qs[_0xa950('0x34')](_0x288934[_0xa950('0x30')][_0xa950('0x34')]));_0x1aa96a[_0xa950('0x35')]=_0x1aa96a['attributes'][_0xa950('0x36')]?_0x1aa96a['attributes']:_0x31c168[_0xa950('0x2e')];if(!_0x288934[_0xa950('0x30')]['hasOwnProperty']('nolimit')){_0x1aa96a[_0xa950('0x1d')]=qs[_0xa950('0x1d')](_0x288934[_0xa950('0x30')][_0xa950('0x1d')]);_0x1aa96a[_0xa950('0x1c')]=qs[_0xa950('0x1c')](_0x288934['query']['offset']);}_0x1aa96a[_0xa950('0x37')]=qs['sort'](_0x288934[_0xa950('0x30')][_0xa950('0x38')]);_0x1aa96a[_0xa950('0x39')]=qs[_0xa950('0x32')](_[_0xa950('0x3a')](_0x288934[_0xa950('0x30')],_0x31c168[_0xa950('0x32')]),_0x2891ba);if(_0x288934[_0xa950('0x30')][_0xa950('0x3b')]){_0x1aa96a[_0xa950('0x39')]=_['merge'](_0x1aa96a[_0xa950('0x39')],{'$or':_['map'](_0x2891ba,function(_0x371091){if(_0x371091[_0xa950('0x2c')]!=='VIRTUAL'){var _0x4c6588={};_0x4c6588[_0x371091[_0xa950('0x27')]]={'$like':'%'+_0x288934[_0xa950('0x30')]['filter']+'%'};return _0x4c6588;}})});}_0x1aa96a=_[_0xa950('0x3c')]({},_0x1aa96a,_0x288934[_0xa950('0x3d')]);var _0x4bf63b={'where':_0x1aa96a[_0xa950('0x39')]};return db[_0xa950('0x29')][_0xa950('0x1b')](_0x4bf63b)[_0xa950('0x24')](function(_0x926d8a){_0x186f35[_0xa950('0x1b')]=_0x926d8a;if(_0x288934[_0xa950('0x30')][_0xa950('0x3e')]){_0x1aa96a['include']=[{'all':!![]}];}return db[_0xa950('0x29')][_0xa950('0x3f')](_0x1aa96a);})['then'](function(_0x732bc1){_0x186f35[_0xa950('0x40')]=_0x732bc1;return _0x186f35;})[_0xa950('0x24')](respondWithFilteredResult(_0x3f37f8,_0x1aa96a))['catch'](handleError(_0x3f37f8,null));};exports[_0xa950('0x41')]=function(_0x2de8a1,_0x8bdd37){var _0x59fd48={'raw':!![],'where':{'id':_0x2de8a1[_0xa950('0x42')]['id']}},_0x545090={};_0x545090[_0xa950('0x2e')]=_[_0xa950('0x31')](db['SugarcrmField']['rawAttributes']);_0x545090['query']=_[_0xa950('0x31')](_0x2de8a1[_0xa950('0x30')]);_0x545090[_0xa950('0x32')]=_[_0xa950('0x33')](_0x545090[_0xa950('0x2e')],_0x545090['query']);_0x59fd48[_0xa950('0x35')]=_[_0xa950('0x33')](_0x545090['model'],qs['fields'](_0x2de8a1[_0xa950('0x30')][_0xa950('0x34')]));_0x59fd48['attributes']=_0x59fd48['attributes']['length']?_0x59fd48['attributes']:_0x545090[_0xa950('0x2e')];if(_0x2de8a1[_0xa950('0x30')]['includeAll']){_0x59fd48['include']=[{'all':!![]}];}_0x59fd48=_[_0xa950('0x3c')]({},_0x59fd48,_0x2de8a1['options']);return db[_0xa950('0x29')][_0xa950('0x43')](_0x59fd48)[_0xa950('0x24')](handleEntityNotFound(_0x8bdd37,null))[_0xa950('0x24')](respondWithResult(_0x8bdd37,null))[_0xa950('0x44')](handleError(_0x8bdd37,null));};exports[_0xa950('0x45')]=function(_0x41b44d,_0x159b1a){return db['SugarcrmField'][_0xa950('0x45')](_0x41b44d['body'],{})[_0xa950('0x24')](respondWithResult(_0x159b1a,0xc9))[_0xa950('0x44')](handleError(_0x159b1a,null));};exports[_0xa950('0x22')]=function(_0x305afa,_0x362b47){if(_0x305afa[_0xa950('0x46')]['id']){delete _0x305afa[_0xa950('0x46')]['id'];}return db[_0xa950('0x29')][_0xa950('0x43')]({'where':{'id':_0x305afa['params']['id']}})[_0xa950('0x24')](handleEntityNotFound(_0x362b47,null))[_0xa950('0x24')](saveUpdates(_0x305afa[_0xa950('0x46')],null))[_0xa950('0x24')](respondWithResult(_0x362b47,null))[_0xa950('0x44')](handleError(_0x362b47,null));};exports['destroy']=function(_0x237152,_0xde68b2){return db[_0xa950('0x29')][_0xa950('0x43')]({'where':{'id':_0x237152[_0xa950('0x42')]['id']}})[_0xa950('0x24')](handleEntityNotFound(_0xde68b2,null))[_0xa950('0x24')](removeEntity(_0xde68b2,null))['catch'](handleError(_0xde68b2,null));}; \ No newline at end of file +var _0x814b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','error','name','send','index','SugarcrmField','rawAttributes','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','keys','intersection','include','options','find','create','body','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'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x814b,0x1a2));var _0xb814=function(_0x4b6507,_0x5518b5){_0x4b6507=_0x4b6507-0x0;var _0x2001ec=_0x814b[_0x4b6507];return _0x2001ec;};'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 licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){_0x3b267e['status'](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(!_0x457dac){_0x52b7a3[_0xb814('0x1b')](0x194);}return _0x457dac;};}function handleError(_0x208927,_0x1c8a2e){_0x1c8a2e=_0x1c8a2e||0x1f4;return function(_0xb9e57d){logger[_0xb814('0x26')](_0xb9e57d['stack']);if(_0xb9e57d[_0xb814('0x27')]){delete _0xb9e57d[_0xb814('0x27')];}_0x208927[_0xb814('0x1c')](_0x1c8a2e)[_0xb814('0x28')](_0xb9e57d);};}exports[_0xb814('0x29')]=function(_0x1d5965,_0x3f0150){var _0x1e4e89={},_0x5a6291={},_0x271aa8={'count':0x0,'rows':[]};var _0x328a08=_['map'](db[_0xb814('0x2a')][_0xb814('0x2b')],function(_0x530744){return{'name':_0x530744['fieldName'],'type':_0x530744[_0xb814('0x2c')][_0xb814('0x2d')]};});_0x5a6291['model']=_[_0xb814('0x2e')](_0x328a08,'name');_0x5a6291[_0xb814('0x2f')]=_['keys'](_0x1d5965['query']);_0x5a6291[_0xb814('0x30')]=_['intersection'](_0x5a6291[_0xb814('0x31')],_0x5a6291[_0xb814('0x2f')]);_0x1e4e89[_0xb814('0x32')]=_['intersection'](_0x5a6291['model'],qs[_0xb814('0x33')](_0x1d5965[_0xb814('0x2f')]['fields']));_0x1e4e89[_0xb814('0x32')]=_0x1e4e89[_0xb814('0x32')][_0xb814('0x34')]?_0x1e4e89[_0xb814('0x32')]:_0x5a6291[_0xb814('0x31')];if(!_0x1d5965[_0xb814('0x2f')][_0xb814('0x35')]('nolimit')){_0x1e4e89[_0xb814('0x36')]=qs[_0xb814('0x36')](_0x1d5965[_0xb814('0x2f')][_0xb814('0x36')]);_0x1e4e89[_0xb814('0x20')]=qs['offset'](_0x1d5965[_0xb814('0x2f')]['offset']);}_0x1e4e89[_0xb814('0x37')]=qs[_0xb814('0x38')](_0x1d5965[_0xb814('0x2f')]['sort']);_0x1e4e89[_0xb814('0x39')]=qs[_0xb814('0x30')](_['pick'](_0x1d5965[_0xb814('0x2f')],_0x5a6291[_0xb814('0x30')]),_0x328a08);if(_0x1d5965[_0xb814('0x2f')][_0xb814('0x3a')]){_0x1e4e89[_0xb814('0x39')]=_[_0xb814('0x3b')](_0x1e4e89['where'],{'$or':_[_0xb814('0x2e')](_0x328a08,function(_0x4e4684){if(_0x4e4684[_0xb814('0x2c')]!=='VIRTUAL'){var _0x4492ef={};_0x4492ef[_0x4e4684['name']]={'$like':'%'+_0x1d5965[_0xb814('0x2f')][_0xb814('0x3a')]+'%'};return _0x4492ef;}})});}_0x1e4e89=_['merge']({},_0x1e4e89,_0x1d5965['options']);var _0x5dd6bc={'where':_0x1e4e89['where']};return db[_0xb814('0x2a')][_0xb814('0x1f')](_0x5dd6bc)[_0xb814('0x24')](function(_0x42c2ed){_0x271aa8['count']=_0x42c2ed;if(_0x1d5965['query'][_0xb814('0x3c')]){_0x1e4e89['include']=[{'all':!![]}];}return db[_0xb814('0x2a')][_0xb814('0x3d')](_0x1e4e89);})[_0xb814('0x24')](function(_0x3063bf){_0x271aa8[_0xb814('0x3e')]=_0x3063bf;return _0x271aa8;})[_0xb814('0x24')](respondWithFilteredResult(_0x3f0150,_0x1e4e89))[_0xb814('0x3f')](handleError(_0x3f0150,null));};exports[_0xb814('0x40')]=function(_0x31989d,_0x4b6ff8){var _0x544d36={'raw':!![],'where':{'id':_0x31989d[_0xb814('0x41')]['id']}},_0x5d26be={};_0x5d26be['model']=_[_0xb814('0x42')](db['SugarcrmField'][_0xb814('0x2b')]);_0x5d26be[_0xb814('0x2f')]=_[_0xb814('0x42')](_0x31989d[_0xb814('0x2f')]);_0x5d26be['filters']=_[_0xb814('0x43')](_0x5d26be[_0xb814('0x31')],_0x5d26be[_0xb814('0x2f')]);_0x544d36[_0xb814('0x32')]=_[_0xb814('0x43')](_0x5d26be[_0xb814('0x31')],qs['fields'](_0x31989d[_0xb814('0x2f')][_0xb814('0x33')]));_0x544d36[_0xb814('0x32')]=_0x544d36[_0xb814('0x32')][_0xb814('0x34')]?_0x544d36[_0xb814('0x32')]:_0x5d26be[_0xb814('0x31')];if(_0x31989d['query']['includeAll']){_0x544d36[_0xb814('0x44')]=[{'all':!![]}];}_0x544d36=_[_0xb814('0x3b')]({},_0x544d36,_0x31989d[_0xb814('0x45')]);return db[_0xb814('0x2a')][_0xb814('0x46')](_0x544d36)[_0xb814('0x24')](handleEntityNotFound(_0x4b6ff8,null))[_0xb814('0x24')](respondWithResult(_0x4b6ff8,null))[_0xb814('0x3f')](handleError(_0x4b6ff8,null));};exports[_0xb814('0x47')]=function(_0x344198,_0xe73300){return db['SugarcrmField'][_0xb814('0x47')](_0x344198[_0xb814('0x48')],{})['then'](respondWithResult(_0xe73300,0xc9))[_0xb814('0x3f')](handleError(_0xe73300,null));};exports['update']=function(_0x2fb0f7,_0x37866f){if(_0x2fb0f7[_0xb814('0x48')]['id']){delete _0x2fb0f7[_0xb814('0x48')]['id'];}return db[_0xb814('0x2a')][_0xb814('0x46')]({'where':{'id':_0x2fb0f7[_0xb814('0x41')]['id']}})[_0xb814('0x24')](handleEntityNotFound(_0x37866f,null))[_0xb814('0x24')](saveUpdates(_0x2fb0f7[_0xb814('0x48')],null))['then'](respondWithResult(_0x37866f,null))['catch'](handleError(_0x37866f,null));};exports[_0xb814('0x25')]=function(_0x30f07b,_0x4156d8){return db[_0xb814('0x2a')][_0xb814('0x46')]({'where':{'id':_0x30f07b[_0xb814('0x41')]['id']}})[_0xb814('0x24')](handleEntityNotFound(_0x4156d8,null))['then'](removeEntity(_0x4156d8,null))[_0xb814('0x3f')](handleError(_0x4156d8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index e5ead1b..cd6a1e6 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 _0xa674=['sugarcrm_unique_index','../../config/logger','api','moment','bluebird','request-promise','path','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x173fab,_0x34c97d){var _0x13d99a=function(_0xb1b4b8){while(--_0xb1b4b8){_0x173fab['push'](_0x173fab['shift']());}};_0x13d99a(++_0x34c97d);}(_0xa674,0x9d));var _0x4a67=function(_0x396053,_0x338084){_0x396053=_0x396053-0x0;var _0x343894=_0xa674[_0x396053];return _0x343894;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4a67('0x0'))(_0x4a67('0x1'));var moment=require(_0x4a67('0x2'));var BPromise=require(_0x4a67('0x3'));var rp=require(_0x4a67('0x4'));var fs=require('fs');var path=require(_0x4a67('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4a67('0x6'));module[_0x4a67('0x7')]=function(_0x45dad1,_0xfd1be8){return _0x45dad1[_0x4a67('0x8')](_0x4a67('0x9'),attributes,{'tableName':_0x4a67('0xa'),'paranoid':![],'indexes':[{'name':_0x4a67('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x719b=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','sugarcrm_unique_index','idField','FieldId'];(function(_0x150322,_0x2199fb){var _0x606a08=function(_0x22cace){while(--_0x22cace){_0x150322['push'](_0x150322['shift']());}};_0x606a08(++_0x2199fb);}(_0x719b,0x1a4));var _0xb719=function(_0x2c760e,_0x3ec654){_0x2c760e=_0x2c760e-0x0;var _0x167283=_0x719b[_0x2c760e];return _0x167283;};'use strict';var _=require(_0xb719('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb719('0x1'));var moment=require(_0xb719('0x2'));var BPromise=require(_0xb719('0x3'));var rp=require(_0xb719('0x4'));var fs=require('fs');var path=require(_0xb719('0x5'));var rimraf=require(_0xb719('0x6'));var config=require(_0xb719('0x7'));var attributes=require(_0xb719('0x8'));module[_0xb719('0x9')]=function(_0x547817,_0x35ae86){return _0x547817[_0xb719('0xa')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xb719('0xb'),'fields':[_0xb719('0xc'),_0xb719('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 9fcbcf1..5d3d5a8 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 _0x9ffd=['SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SugarcrmField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x27380e,_0x4c5c6c){var _0x46eb19=function(_0x44b663){while(--_0x44b663){_0x27380e['push'](_0x27380e['shift']());}};_0x46eb19(++_0x4c5c6c);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5068ac,_0x25fc98){_0x5068ac=_0x5068ac-0x0;var _0x3aabd9=_0x9ffd[_0x5068ac];return _0x3aabd9;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('SugarcrmField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x1190cb,_0x1df254){var _0x491082=function(_0x469be1){while(--_0x469be1){_0x1190cb['push'](_0x1190cb['shift']());}};_0x491082(++_0x1df254);}(_0x2032,0xd9));var _0x2203=function(_0x2eecfc,_0x129084){_0x2eecfc=_0x2eecfc-0x0;var _0x217bfc=_0x2032[_0x2eecfc];return _0x217bfc;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f4f672e..0e4a8c5 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 _0xe9c3=['./intVtigerAccount.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','getFields','post','addConfiguration','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x516578,_0x304b3f){var _0x4565d8=function(_0xae552b){while(--_0xae552b){_0x516578['push'](_0x516578['shift']());}};_0x4565d8(++_0x304b3f);}(_0xe9c3,0x1dc));var _0x3e9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9c3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3e9c('0x0'));var util=require(_0x3e9c('0x1'));var path=require(_0x3e9c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3e9c('0x3')]();var auth=require(_0x3e9c('0x4'));var interaction=require(_0x3e9c('0x5'));var config=require(_0x3e9c('0x6'));var controller=require(_0x3e9c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3e9c('0x8')]);router[_0x3e9c('0x9')](_0x3e9c('0xa'),auth['isAuthenticated'](),controller[_0x3e9c('0xb')]);router[_0x3e9c('0x9')](_0x3e9c('0xc'),auth[_0x3e9c('0xd')](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x3e9c('0xe')]);router[_0x3e9c('0xf')]('/',auth[_0x3e9c('0xd')](),controller['create']);router[_0x3e9c('0xf')]('/:id/configurations',auth[_0x3e9c('0xd')](),controller[_0x3e9c('0x10')]);router[_0x3e9c('0x11')](_0x3e9c('0xa'),auth[_0x3e9c('0xd')](),controller[_0x3e9c('0x12')]);router[_0x3e9c('0x13')](_0x3e9c('0xa'),auth['isAuthenticated'](),controller[_0x3e9c('0x14')]);module['exports']=router; \ No newline at end of file +var _0x906c=['Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','multer','util','connect-timeout','express'];(function(_0x809314,_0xaf27c0){var _0x1a94b6=function(_0x450f50){while(--_0x450f50){_0x809314['push'](_0x809314['shift']());}};_0x1a94b6(++_0xaf27c0);}(_0x906c,0xd8));var _0xc906=function(_0x293d87,_0x21aebb){_0x293d87=_0x293d87-0x0;var _0x24e136=_0x906c[_0x293d87];return _0x24e136;};'use strict';var multer=require(_0xc906('0x0'));var util=require(_0xc906('0x1'));var path=require('path');var timeout=require(_0xc906('0x2'));var express=require(_0xc906('0x3'));var router=express[_0xc906('0x4')]();var auth=require(_0xc906('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc906('0x6'));var controller=require(_0xc906('0x7'));router[_0xc906('0x8')]('/',auth[_0xc906('0x9')](),controller[_0xc906('0xa')]);router[_0xc906('0x8')](_0xc906('0xb'),auth[_0xc906('0x9')](),controller[_0xc906('0xc')]);router[_0xc906('0x8')](_0xc906('0xd'),auth['isAuthenticated'](),controller[_0xc906('0xe')]);router[_0xc906('0x8')]('/:id/fields',auth[_0xc906('0x9')](),controller[_0xc906('0xf')]);router[_0xc906('0x10')]('/',auth[_0xc906('0x9')](),controller[_0xc906('0x11')]);router[_0xc906('0x10')](_0xc906('0xd'),auth['isAuthenticated'](),controller[_0xc906('0x12')]);router[_0xc906('0x13')](_0xc906('0xb'),auth[_0xc906('0x9')](),controller[_0xc906('0x14')]);router['delete'](_0xc906('0xb'),auth[_0xc906('0x9')](),controller[_0xc906('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index cbf44ea..a7e3596 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 _0x7d8a=['HelpDesk','sequelize','exports','STRING'];(function(_0x4bf49a,_0x134d4d){var _0x1f8e65=function(_0x474a37){while(--_0x474a37){_0x4bf49a['push'](_0x4bf49a['shift']());}};_0x1f8e65(++_0x134d4d);}(_0x7d8a,0x1e1));var _0xa7d8=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x7d8a[_0x355ce8];return _0x1db8b8;};'use strict';var Sequelize=require(_0xa7d8('0x0'));module[_0xa7d8('0x1')]={'name':{'type':Sequelize[_0xa7d8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa7d8('0x2')]},'username':{'type':Sequelize[_0xa7d8('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa7d8('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa7d8('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x97ac=['exports','STRING','sequelize'];(function(_0x42d14b,_0x23d488){var _0x3dc288=function(_0x4ab344){while(--_0x4ab344){_0x42d14b['push'](_0x42d14b['shift']());}};_0x3dc288(++_0x23d488);}(_0x97ac,0xa1));var _0xc97a=function(_0x26f081,_0x4277f3){_0x26f081=_0x26f081-0x0;var _0x4bf032=_0x97ac[_0x26f081];return _0x4bf032;};'use strict';var Sequelize=require(_0xc97a('0x0'));module[_0xc97a('0x1')]={'name':{'type':Sequelize[_0xc97a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc97a('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc97a('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xc97a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc97a('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc97a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 4b475f9..76419f6 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 _0xa176=['show','options','find','create','body','params','getConfigurations','VtigerConfiguration','filter','addConfiguration','findOne','getSubjects','Subjects','VtigerField','Descriptions','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','success','login','result','token','sessionName','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x2a52ef,_0x38d58f){var _0x3bbbc6=function(_0x2782b4){while(--_0x2782b4){_0x2a52ef['push'](_0x2a52ef['shift']());}};_0x3bbbc6(++_0x38d58f);}(_0xa176,0xaa));var _0x6a17=function(_0x286c16,_0x5c77a5){_0x286c16=_0x286c16-0x0;var _0x4b4f82=_0xa176[_0x286c16];return _0x4b4f82;};'use strict';var pdf=require(_0x6a17('0x0'));var emlformat=require(_0x6a17('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6a17('0x2'));var jsonpatch=require(_0x6a17('0x3'));var rp=require('request-promise');var moment=require(_0x6a17('0x4'));var BPromise=require(_0x6a17('0x5'));var Mustache=require(_0x6a17('0x6'));var util=require(_0x6a17('0x7'));var path=require('path');var sox=require(_0x6a17('0x8'));var csv=require(_0x6a17('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6a17('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6a17('0xb'));var deskjs=require(_0x6a17('0xc'));var toCsv=require(_0x6a17('0x9'));var querystring=require(_0x6a17('0xd'));var Papa=require(_0x6a17('0xe'));var Redis=require(_0x6a17('0xf'));var authService=require(_0x6a17('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a17('0x11'));var logger=require(_0x6a17('0x12'))(_0x6a17('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6a17('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x6a17('0x15'));var client=jayson[_0x6a17('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49bf40,_0x5d1152,_0x221278,_0x3f6d80){return new BPromise(function(_0x2db0aa,_0xf42f6){var _0x597de7=_0x3f6d80||client;return _0x597de7[_0x6a17('0x17')](_0x49bf40,_0x221278)['then'](function(_0x14352c){logger[_0x6a17('0x18')](_0x6a17('0x19'),_0x5d1152,_0x6a17('0x1a'));logger['debug'](_0x6a17('0x1b'),_0x5d1152,_0x6a17('0x1a'),JSON[_0x6a17('0x1c')](_0x14352c));if(_0x14352c[_0x6a17('0x1d')]){if(_0x14352c['error'][_0x6a17('0x1e')]===0x1f4){logger[_0x6a17('0x1d')]('VtigerAccount,\x20%s,\x20%s',_0x5d1152,_0x14352c[_0x6a17('0x1d')][_0x6a17('0x1f')]);return _0xf42f6(_0x14352c[_0x6a17('0x1d')][_0x6a17('0x1f')]);}logger[_0x6a17('0x1d')](_0x6a17('0x19'),_0x5d1152,_0x14352c['error'][_0x6a17('0x1f')]);return _0x2db0aa(_0x14352c[_0x6a17('0x1d')]['message']);}else{logger['info'](_0x6a17('0x19'),_0x5d1152,'request\x20sent');_0x2db0aa(_0x14352c['result'][_0x6a17('0x1f')]);}})[_0x6a17('0x20')](function(_0x5e4a18){logger[_0x6a17('0x1d')](_0x6a17('0x19'),_0x5d1152,_0x5e4a18);_0xf42f6(_0x5e4a18);});});}function respondWithStatusCode(_0x395c00,_0x45ee89){_0x45ee89=_0x45ee89||0xcc;return function(_0x2e6982){if(_0x2e6982){return _0x395c00[_0x6a17('0x21')](_0x45ee89);}return _0x395c00[_0x6a17('0x22')](_0x45ee89)[_0x6a17('0x23')]();};}function respondWithResult(_0x5a0dbe,_0xc0700d){_0xc0700d=_0xc0700d||0xc8;return function(_0x4add18){if(_0x4add18){return _0x5a0dbe[_0x6a17('0x22')](_0xc0700d)[_0x6a17('0x24')](_0x4add18);}};}function respondWithFilteredResult(_0xa49c03,_0x26ac0d){return function(_0x4b9d0e){if(_0x4b9d0e){var _0x398c5f=_0x4b9d0e['count'],_0x166552=_0x26ac0d[_0x6a17('0x25')],_0x12b9b5=_0x26ac0d[_0x6a17('0x25')]+_0x26ac0d['limit'],_0x2eff48;if(_0x12b9b5>=_0x398c5f){_0x12b9b5=_0x398c5f;_0x2eff48=0xc8;}else{_0x2eff48=0xce;}_0xa49c03[_0x6a17('0x22')](_0x2eff48);return _0xa49c03[_0x6a17('0x26')](_0x6a17('0x27'),_0x166552+'-'+_0x12b9b5+'/'+_0x398c5f)['json'](_0x4b9d0e);}return null;};}function patchUpdates(_0x323e0d){return function(_0x37fc8e){try{jsonpatch[_0x6a17('0x28')](_0x37fc8e,_0x323e0d,!![]);}catch(_0x234c5f){return BPromise['reject'](_0x234c5f);}return _0x37fc8e['save']();};}function saveUpdates(_0x3beb3d,_0x5dc9ab){return function(_0x101e8f){if(_0x101e8f){return _0x101e8f[_0x6a17('0x29')](_0x3beb3d)[_0x6a17('0x2a')](function(_0x46715a){return _0x46715a;});}return null;};}function removeEntity(_0xe93177,_0x4e1620){return function(_0x2cf436){if(_0x2cf436){return _0x2cf436[_0x6a17('0x2b')]()[_0x6a17('0x2a')](function(){_0xe93177['status'](0xcc)[_0x6a17('0x23')]();});}};}function handleEntityNotFound(_0x3942b3,_0x4dedc3){return function(_0x34f5a5){if(!_0x34f5a5){_0x3942b3[_0x6a17('0x21')](0x194);}return _0x34f5a5;};}function handleError(_0x374d2b,_0x894aa4){_0x894aa4=_0x894aa4||0x1f4;return function(_0x32d6ad){logger[_0x6a17('0x1d')](_0x32d6ad[_0x6a17('0x2c')]);if(_0x32d6ad[_0x6a17('0x2d')]){delete _0x32d6ad['name'];}_0x374d2b['status'](_0x894aa4)[_0x6a17('0x2e')](_0x32d6ad);};}exports[_0x6a17('0x2f')]=function(_0x2a8a0e,_0x3d44ea){var _0x57c547={},_0x4bf16f={},_0x22cdc3={'count':0x0,'rows':[]};var _0x5d5f2b=_[_0x6a17('0x30')](db[_0x6a17('0x31')][_0x6a17('0x32')],function(_0x50132f){return{'name':_0x50132f[_0x6a17('0x33')],'type':_0x50132f[_0x6a17('0x34')]['key']};});_0x4bf16f[_0x6a17('0x35')]=_[_0x6a17('0x30')](_0x5d5f2b,_0x6a17('0x2d'));_0x4bf16f[_0x6a17('0x36')]=_[_0x6a17('0x37')](_0x2a8a0e[_0x6a17('0x36')]);_0x4bf16f[_0x6a17('0x38')]=_['intersection'](_0x4bf16f['model'],_0x4bf16f[_0x6a17('0x36')]);_0x57c547[_0x6a17('0x39')]=_[_0x6a17('0x3a')](_0x4bf16f[_0x6a17('0x35')],qs[_0x6a17('0x3b')](_0x2a8a0e[_0x6a17('0x36')][_0x6a17('0x3b')]));_0x57c547[_0x6a17('0x39')]=_0x57c547['attributes'][_0x6a17('0x3c')]?_0x57c547['attributes']:_0x4bf16f['model'];if(!_0x2a8a0e[_0x6a17('0x36')][_0x6a17('0x3d')]('nolimit')){_0x57c547[_0x6a17('0x3e')]=qs[_0x6a17('0x3e')](_0x2a8a0e[_0x6a17('0x36')][_0x6a17('0x3e')]);_0x57c547[_0x6a17('0x25')]=qs[_0x6a17('0x25')](_0x2a8a0e[_0x6a17('0x36')][_0x6a17('0x25')]);}_0x57c547[_0x6a17('0x3f')]=qs[_0x6a17('0x40')](_0x2a8a0e[_0x6a17('0x36')][_0x6a17('0x40')]);_0x57c547[_0x6a17('0x41')]=qs[_0x6a17('0x38')](_[_0x6a17('0x42')](_0x2a8a0e[_0x6a17('0x36')],_0x4bf16f[_0x6a17('0x38')]),_0x5d5f2b);if(_0x2a8a0e[_0x6a17('0x36')]['filter']){_0x57c547['where']=_[_0x6a17('0x43')](_0x57c547[_0x6a17('0x41')],{'$or':_[_0x6a17('0x30')](_0x5d5f2b,function(_0x3e763c){if(_0x3e763c[_0x6a17('0x34')]!==_0x6a17('0x44')){var _0x26f9da={};_0x26f9da[_0x3e763c[_0x6a17('0x2d')]]={'$like':'%'+_0x2a8a0e[_0x6a17('0x36')]['filter']+'%'};return _0x26f9da;}})});}_0x57c547=_[_0x6a17('0x43')]({},_0x57c547,_0x2a8a0e['options']);var _0x10fbb7={'where':_0x57c547[_0x6a17('0x41')]};return db['VtigerAccount']['count'](_0x10fbb7)[_0x6a17('0x2a')](function(_0xa59cfe){_0x22cdc3['count']=_0xa59cfe;if(_0x2a8a0e[_0x6a17('0x36')][_0x6a17('0x45')]){_0x57c547[_0x6a17('0x46')]=[{'all':!![]}];}return db[_0x6a17('0x31')][_0x6a17('0x47')](_0x57c547);})[_0x6a17('0x2a')](function(_0x39315e){_0x22cdc3['rows']=_0x39315e;return _0x22cdc3;})[_0x6a17('0x2a')](respondWithFilteredResult(_0x3d44ea,_0x57c547))['catch'](handleError(_0x3d44ea,null));};exports[_0x6a17('0x48')]=function(_0x3fe5e5,_0x2a6890){var _0x20786c={'raw':![],'where':{'id':_0x3fe5e5['params']['id']}},_0x2f08ed={};_0x2f08ed[_0x6a17('0x35')]=_[_0x6a17('0x37')](db['VtigerAccount'][_0x6a17('0x32')]);_0x2f08ed[_0x6a17('0x36')]=_['keys'](_0x3fe5e5[_0x6a17('0x36')]);_0x2f08ed[_0x6a17('0x38')]=_[_0x6a17('0x3a')](_0x2f08ed[_0x6a17('0x35')],_0x2f08ed[_0x6a17('0x36')]);_0x20786c[_0x6a17('0x39')]=_['intersection'](_0x2f08ed['model'],qs[_0x6a17('0x3b')](_0x3fe5e5[_0x6a17('0x36')]['fields']));_0x20786c['attributes']=_0x20786c[_0x6a17('0x39')]['length']?_0x20786c[_0x6a17('0x39')]:_0x2f08ed['model'];if(_0x3fe5e5[_0x6a17('0x36')]['includeAll']){_0x20786c[_0x6a17('0x46')]=[{'all':!![]}];}_0x20786c=_[_0x6a17('0x43')]({},_0x20786c,_0x3fe5e5[_0x6a17('0x49')]);return db[_0x6a17('0x31')][_0x6a17('0x4a')](_0x20786c)[_0x6a17('0x2a')](handleEntityNotFound(_0x2a6890,null))[_0x6a17('0x2a')](respondWithResult(_0x2a6890,null))[_0x6a17('0x20')](handleError(_0x2a6890,null));};exports['create']=function(_0x3b2af6,_0x595e75){return db[_0x6a17('0x31')][_0x6a17('0x4b')](_0x3b2af6[_0x6a17('0x4c')],{})[_0x6a17('0x2a')](respondWithResult(_0x595e75,0xc9))[_0x6a17('0x20')](handleError(_0x595e75,null));};exports[_0x6a17('0x29')]=function(_0x547874,_0x3ff5b6){if(_0x547874['body']['id']){delete _0x547874['body']['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x547874[_0x6a17('0x4d')]['id']}})[_0x6a17('0x2a')](handleEntityNotFound(_0x3ff5b6,null))[_0x6a17('0x2a')](saveUpdates(_0x547874[_0x6a17('0x4c')],null))['then'](respondWithResult(_0x3ff5b6,null))['catch'](handleError(_0x3ff5b6,null));};exports[_0x6a17('0x2b')]=function(_0x5f240e,_0x2d6d64){return db['VtigerAccount'][_0x6a17('0x4a')]({'where':{'id':_0x5f240e[_0x6a17('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2d6d64,null))[_0x6a17('0x2a')](removeEntity(_0x2d6d64,null))[_0x6a17('0x20')](handleError(_0x2d6d64,null));};exports[_0x6a17('0x4e')]=function(_0x5dcf09,_0x17b9a9,_0x4fd67f){var _0x54dffb={};var _0x27e574={};var _0x2337bc;var _0x473858;return db['VtigerAccount']['findOne']({'where':{'id':_0x5dcf09[_0x6a17('0x4d')]['id']}})[_0x6a17('0x2a')](handleEntityNotFound(_0x17b9a9,null))[_0x6a17('0x2a')](function(_0x26b830){if(_0x26b830){_0x2337bc=_0x26b830;_0x27e574[_0x6a17('0x35')]=_[_0x6a17('0x37')](db[_0x6a17('0x4f')][_0x6a17('0x32')]);_0x27e574['query']=_[_0x6a17('0x37')](_0x5dcf09[_0x6a17('0x36')]);_0x27e574['filters']=_['intersection'](_0x27e574['model'],_0x27e574[_0x6a17('0x36')]);_0x54dffb['attributes']=_[_0x6a17('0x3a')](_0x27e574['model'],qs['fields'](_0x5dcf09['query']['fields']));_0x54dffb[_0x6a17('0x39')]=_0x54dffb['attributes'][_0x6a17('0x3c')]?_0x54dffb[_0x6a17('0x39')]:_0x27e574['model'];_0x54dffb['order']=qs['sort'](_0x5dcf09[_0x6a17('0x36')][_0x6a17('0x40')]);_0x54dffb[_0x6a17('0x41')]=qs['filters'](_[_0x6a17('0x42')](_0x5dcf09['query'],_0x27e574[_0x6a17('0x38')]));if(_0x5dcf09[_0x6a17('0x36')][_0x6a17('0x50')]){_0x54dffb[_0x6a17('0x41')]=_['merge'](_0x54dffb[_0x6a17('0x41')],{'$or':_[_0x6a17('0x30')](_0x54dffb[_0x6a17('0x39')],function(_0x5d18e2){var _0x1e4534={};_0x1e4534[_0x5d18e2]={'$like':'%'+_0x5dcf09[_0x6a17('0x36')][_0x6a17('0x50')]+'%'};return _0x1e4534;})});}_0x54dffb=_[_0x6a17('0x43')]({},_0x54dffb,_0x5dcf09[_0x6a17('0x49')]);return _0x2337bc[_0x6a17('0x4e')](_0x54dffb);}})['then'](function(_0x50759b){if(_0x50759b){_0x473858=_0x50759b[_0x6a17('0x3c')];if(!_0x5dcf09[_0x6a17('0x36')][_0x6a17('0x3d')]('nolimit')){_0x54dffb[_0x6a17('0x3e')]=qs['limit'](_0x5dcf09[_0x6a17('0x36')][_0x6a17('0x3e')]);_0x54dffb['offset']=qs[_0x6a17('0x25')](_0x5dcf09[_0x6a17('0x36')][_0x6a17('0x25')]);}return _0x2337bc[_0x6a17('0x4e')](_0x54dffb);}})[_0x6a17('0x2a')](function(_0x38ac40){if(_0x38ac40){return _0x38ac40?{'count':_0x473858,'rows':_0x38ac40}:null;}})[_0x6a17('0x2a')](respondWithResult(_0x17b9a9,null))['catch'](handleError(_0x17b9a9,null));};exports[_0x6a17('0x51')]=function(_0xeb5418,_0x2546d3,_0x3bf29f){if(_0xeb5418[_0x6a17('0x4c')]['id']){delete _0xeb5418[_0x6a17('0x4c')]['id'];}return db[_0x6a17('0x31')][_0x6a17('0x52')]({'where':{'id':_0xeb5418[_0x6a17('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2546d3,null))[_0x6a17('0x2a')](function(_0x42d7e5){if(_0x42d7e5){_0xeb5418['body']['AccountId']=_0x42d7e5['id'];_0xeb5418['body']['Subjects']=integrations[_0x6a17('0x53')](_0xeb5418[_0x6a17('0x4c')]['channel'],_0xeb5418['body'][_0x6a17('0x34')]);_0xeb5418['body']['Descriptions']=integrations['getDescriptions'](_0xeb5418['body']['channel'],_0xeb5418[_0x6a17('0x4c')][_0x6a17('0x34')]);return db[_0x6a17('0x4f')][_0x6a17('0x4b')](_0xeb5418[_0x6a17('0x4c')],{'include':[{'model':db['VtigerField'],'as':_0x6a17('0x54')},{'model':db[_0x6a17('0x55')],'as':_0x6a17('0x56')}]});}return null;})[_0x6a17('0x2a')](respondWithResult(_0x2546d3,null))[_0x6a17('0x20')](handleError(_0x2546d3,null));};var md5=require(_0x6a17('0x57'));exports['getFields']=function(_0x4f9b99,_0x3d7451,_0x5454e7){var _0x4b5be7=null;var _0x33e6b4=null;var _0x19e7f4=null;var _0x564f56=null;var _0x159707='';return db['VtigerAccount']['findOne']({'where':{'id':_0x4f9b99[_0x6a17('0x4d')]['id']},'attributes':['id',_0x6a17('0x2d'),_0x6a17('0x58'),_0x6a17('0x59'),_0x6a17('0x5a'),_0x6a17('0x5b'),_0x6a17('0x5c'),_0x6a17('0x5d')]})[_0x6a17('0x2a')](handleEntityNotFound(_0x3d7451,null))[_0x6a17('0x2a')](function(_0x2cabe0){if(_0x2cabe0){_0x4b5be7=_0x2cabe0[_0x6a17('0x58')];_0x33e6b4=_0x2cabe0[_0x6a17('0x5d')];_0x19e7f4=_0x2cabe0['moduleName'];_0x159707=_0x2cabe0[_0x6a17('0x5b')];var _0x46674d=_0x159707['slice'](-0x1);if(_0x46674d==='/'){_0x159707=_0x159707[_0x6a17('0x5e')](0x0,_0x159707[_0x6a17('0x5f')](_0x46674d));}_0x564f56=util[_0x6a17('0x60')](_0x6a17('0x61'),_0x159707);var _0x26cc93={'method':_0x6a17('0x62'),'uri':_0x564f56,'qs':{'operation':'getchallenge','username':_0x2cabe0[_0x6a17('0x58')]},'json':!![]};return rp(_0x26cc93);}})['then'](function(_0x3f3a47){if(_0x3f3a47[_0x6a17('0x63')]){var _0x5bc56a={'method':'POST','uri':_0x564f56,'form':{'operation':_0x6a17('0x64'),'username':_0x4b5be7,'accessKey':md5(_0x3f3a47[_0x6a17('0x65')][_0x6a17('0x66')]+_0x33e6b4)},'json':!![]};return rp(_0x5bc56a);}})[_0x6a17('0x2a')](function(_0x4b49be){if(_0x4b49be[_0x6a17('0x63')]){var _0x46ffdb={'method':_0x6a17('0x62'),'uri':_0x564f56,'qs':{'operation':'describe','username':_0x4b5be7,'sessionName':_0x4b49be[_0x6a17('0x65')][_0x6a17('0x67')],'elementType':_0x19e7f4},'json':!![]};return rp(_0x46ffdb);}})['then'](function(_0x26d555){if(_0x26d555['success']){var _0x172553=['autogenerated',_0x6a17('0x68'),_0x6a17('0x69')];_[_0x6a17('0x6a')](_0x26d555[_0x6a17('0x65')][_0x6a17('0x3b')],function(_0x29db3c){return _0x172553[_0x6a17('0x6b')](_0x29db3c[_0x6a17('0x34')][_0x6a17('0x2d')]);});_['remove'](_0x26d555[_0x6a17('0x65')][_0x6a17('0x3b')],function(_0x3a5dc3){return _0x3a5dc3[_0x6a17('0x6c')]===_0x6a17('0x6d');});return{'count':_0x26d555[_0x6a17('0x65')][_0x6a17('0x3b')][_0x6a17('0x3c')],'rows':_[_0x6a17('0x30')](_0x26d555[_0x6a17('0x65')][_0x6a17('0x3b')],function(_0x786fb8){return{'id':_0x786fb8['name'],'name':_0x786fb8[_0x6a17('0x6e')],'custom':_[_0x6a17('0x6f')](_0x786fb8[_0x6a17('0x2d')],_0x6a17('0x70'))?!![]:![],'options':_0x786fb8['type']['name']==='picklist'&&_0x786fb8['type'][_0x6a17('0x71')]['length']>0x0?_['map'](_0x786fb8[_0x6a17('0x34')][_0x6a17('0x71')],function(_0x102ca4){return{'name':_0x102ca4['label'],'value':_0x102ca4[_0x6a17('0x72')]};}):[]};})};}})[_0x6a17('0x2a')](respondWithResult(_0x3d7451,null))[_0x6a17('0x20')](function(_0x3f9303){console[_0x6a17('0x73')](_0x6a17('0x74')+_0x3f9303);var _0x29c48b=_0x4f9b99[_0x6a17('0x36')][_0x6a17('0x75')]?0x1f4:_0x3f9303[_0x6a17('0x76')]||0x1f4;logger[_0x6a17('0x1d')](_0x6a17('0x77'),'getFields',_0x29c48b,JSON[_0x6a17('0x1c')](_0x3f9303));delete _0x3f9303['name'];if(_0x29c48b===0x191){_0x29c48b=0x190;}_0x3d7451[_0x6a17('0x22')](_0x29c48b)[_0x6a17('0x2e')](_0x4f9b99[_0x6a17('0x36')][_0x6a17('0x75')]?{'message':_0x6a17('0x78'),'statusCode':_0x3f9303['statusCode']}:_0x3f9303);});}; \ No newline at end of file +var _0x7b70=['VtigerAccount,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','VtigerAccount','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','count','include','findAll','rows','show','params','keys','find','create','body','findOne','VtigerConfiguration','rawAttributes','filter','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','GET','getchallenge','success','login','describe','sessionName','autogenerated','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','stringify','test','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','info'];(function(_0x30dd22,_0x29be4a){var _0x4099bc=function(_0x2452cc){while(--_0x2452cc){_0x30dd22['push'](_0x30dd22['shift']());}};_0x4099bc(++_0x29be4a);}(_0x7b70,0x1f3));var _0x07b7=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x7b70[_0x476bf4];return _0x788ffe;};'use strict';var pdf=require(_0x07b7('0x0'));var emlformat=require(_0x07b7('0x1'));var rimraf=require(_0x07b7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x07b7('0x3'));var rp=require(_0x07b7('0x4'));var moment=require(_0x07b7('0x5'));var BPromise=require(_0x07b7('0x6'));var Mustache=require(_0x07b7('0x7'));var util=require(_0x07b7('0x8'));var path=require(_0x07b7('0x9'));var sox=require(_0x07b7('0xa'));var csv=require(_0x07b7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x07b7('0xc'));var squel=require('squel');var crypto=require(_0x07b7('0xd'));var jsforce=require(_0x07b7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x07b7('0xf'));var Redis=require(_0x07b7('0x10'));var authService=require(_0x07b7('0x11'));var qs=require(_0x07b7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x07b7('0x13'))('api');var utils=require(_0x07b7('0x14'));var config=require(_0x07b7('0x15'));var licenseUtil=require(_0x07b7('0x16'));var db=require(_0x07b7('0x17'))['db'];var integrations=require(_0x07b7('0x18'));var jayson=require(_0x07b7('0x19'));var client=jayson[_0x07b7('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ac31d,_0x21fa63,_0x3fb7eb,_0x1a6ab6){return new BPromise(function(_0x3878ba,_0x5c211a){var _0x552536=_0x1a6ab6||client;return _0x552536[_0x07b7('0x1b')](_0x2ac31d,_0x3fb7eb)['then'](function(_0xe61f76){logger[_0x07b7('0x1c')](_0x07b7('0x1d'),_0x21fa63,'request\x20sent');logger[_0x07b7('0x1e')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x21fa63,'request\x20sent',JSON['stringify'](_0xe61f76));if(_0xe61f76['error']){if(_0xe61f76[_0x07b7('0x1f')][_0x07b7('0x20')]===0x1f4){logger[_0x07b7('0x1f')](_0x07b7('0x1d'),_0x21fa63,_0xe61f76['error'][_0x07b7('0x21')]);return _0x5c211a(_0xe61f76[_0x07b7('0x1f')][_0x07b7('0x21')]);}logger[_0x07b7('0x1f')](_0x07b7('0x1d'),_0x21fa63,_0xe61f76['error'][_0x07b7('0x21')]);return _0x3878ba(_0xe61f76['error'][_0x07b7('0x21')]);}else{logger[_0x07b7('0x1c')](_0x07b7('0x1d'),_0x21fa63,_0x07b7('0x22'));_0x3878ba(_0xe61f76[_0x07b7('0x23')][_0x07b7('0x21')]);}})[_0x07b7('0x24')](function(_0x20c4e0){logger[_0x07b7('0x1f')](_0x07b7('0x1d'),_0x21fa63,_0x20c4e0);_0x5c211a(_0x20c4e0);});});}function respondWithStatusCode(_0x33f8db,_0x377342){_0x377342=_0x377342||0xcc;return function(_0x9758d0){if(_0x9758d0){return _0x33f8db[_0x07b7('0x25')](_0x377342);}return _0x33f8db[_0x07b7('0x26')](_0x377342)[_0x07b7('0x27')]();};}function respondWithResult(_0x5e1828,_0x4aea6b){_0x4aea6b=_0x4aea6b||0xc8;return function(_0x6c5a0f){if(_0x6c5a0f){return _0x5e1828[_0x07b7('0x26')](_0x4aea6b)[_0x07b7('0x28')](_0x6c5a0f);}};}function respondWithFilteredResult(_0x32cc3d,_0x320ef4){return function(_0x2bab1c){if(_0x2bab1c){var _0x25fbac=_0x2bab1c['count'],_0x55aa9d=_0x320ef4[_0x07b7('0x29')],_0x52bbbe=_0x320ef4[_0x07b7('0x29')]+_0x320ef4[_0x07b7('0x2a')],_0x18ea80;if(_0x52bbbe>=_0x25fbac){_0x52bbbe=_0x25fbac;_0x18ea80=0xc8;}else{_0x18ea80=0xce;}_0x32cc3d[_0x07b7('0x26')](_0x18ea80);return _0x32cc3d[_0x07b7('0x2b')](_0x07b7('0x2c'),_0x55aa9d+'-'+_0x52bbbe+'/'+_0x25fbac)['json'](_0x2bab1c);}return null;};}function patchUpdates(_0x3b2adf){return function(_0x19a76c){try{jsonpatch[_0x07b7('0x2d')](_0x19a76c,_0x3b2adf,!![]);}catch(_0x5bcce0){return BPromise[_0x07b7('0x2e')](_0x5bcce0);}return _0x19a76c[_0x07b7('0x2f')]();};}function saveUpdates(_0x474445,_0x8499fa){return function(_0x288820){if(_0x288820){return _0x288820[_0x07b7('0x30')](_0x474445)[_0x07b7('0x31')](function(_0x5ca091){return _0x5ca091;});}return null;};}function removeEntity(_0x2e83b7,_0xb8e320){return function(_0x20f9af){if(_0x20f9af){return _0x20f9af[_0x07b7('0x32')]()[_0x07b7('0x31')](function(){_0x2e83b7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5088a1,_0xea1d09){return function(_0x43ec5e){if(!_0x43ec5e){_0x5088a1['sendStatus'](0x194);}return _0x43ec5e;};}function handleError(_0x492eb9,_0x386599){_0x386599=_0x386599||0x1f4;return function(_0x1cd397){logger['error'](_0x1cd397[_0x07b7('0x33')]);if(_0x1cd397['name']){delete _0x1cd397['name'];}_0x492eb9[_0x07b7('0x26')](_0x386599)[_0x07b7('0x34')](_0x1cd397);};}exports[_0x07b7('0x35')]=function(_0x209572,_0x504da7){var _0x13c747={},_0x32b6c2={},_0x39b07e={'count':0x0,'rows':[]};var _0x522cd0=_[_0x07b7('0x36')](db[_0x07b7('0x37')]['rawAttributes'],function(_0x2fe974){return{'name':_0x2fe974[_0x07b7('0x38')],'type':_0x2fe974[_0x07b7('0x39')][_0x07b7('0x3a')]};});_0x32b6c2[_0x07b7('0x3b')]=_[_0x07b7('0x36')](_0x522cd0,_0x07b7('0x3c'));_0x32b6c2[_0x07b7('0x3d')]=_['keys'](_0x209572['query']);_0x32b6c2[_0x07b7('0x3e')]=_[_0x07b7('0x3f')](_0x32b6c2[_0x07b7('0x3b')],_0x32b6c2['query']);_0x13c747[_0x07b7('0x40')]=_[_0x07b7('0x3f')](_0x32b6c2[_0x07b7('0x3b')],qs[_0x07b7('0x41')](_0x209572['query'][_0x07b7('0x41')]));_0x13c747['attributes']=_0x13c747[_0x07b7('0x40')][_0x07b7('0x42')]?_0x13c747[_0x07b7('0x40')]:_0x32b6c2[_0x07b7('0x3b')];if(!_0x209572[_0x07b7('0x3d')][_0x07b7('0x43')](_0x07b7('0x44'))){_0x13c747[_0x07b7('0x2a')]=qs[_0x07b7('0x2a')](_0x209572[_0x07b7('0x3d')][_0x07b7('0x2a')]);_0x13c747[_0x07b7('0x29')]=qs[_0x07b7('0x29')](_0x209572[_0x07b7('0x3d')][_0x07b7('0x29')]);}_0x13c747[_0x07b7('0x45')]=qs[_0x07b7('0x46')](_0x209572[_0x07b7('0x3d')]['sort']);_0x13c747['where']=qs['filters'](_[_0x07b7('0x47')](_0x209572['query'],_0x32b6c2['filters']),_0x522cd0);if(_0x209572[_0x07b7('0x3d')]['filter']){_0x13c747['where']=_[_0x07b7('0x48')](_0x13c747[_0x07b7('0x49')],{'$or':_[_0x07b7('0x36')](_0x522cd0,function(_0x5277a6){if(_0x5277a6['type']!==_0x07b7('0x4a')){var _0x114899={};_0x114899[_0x5277a6['name']]={'$like':'%'+_0x209572[_0x07b7('0x3d')]['filter']+'%'};return _0x114899;}})});}_0x13c747=_[_0x07b7('0x48')]({},_0x13c747,_0x209572[_0x07b7('0x4b')]);var _0xc21fbc={'where':_0x13c747[_0x07b7('0x49')]};return db['VtigerAccount'][_0x07b7('0x4c')](_0xc21fbc)[_0x07b7('0x31')](function(_0x3b6f21){_0x39b07e[_0x07b7('0x4c')]=_0x3b6f21;if(_0x209572[_0x07b7('0x3d')]['includeAll']){_0x13c747[_0x07b7('0x4d')]=[{'all':!![]}];}return db[_0x07b7('0x37')][_0x07b7('0x4e')](_0x13c747);})[_0x07b7('0x31')](function(_0x42a8a0){_0x39b07e[_0x07b7('0x4f')]=_0x42a8a0;return _0x39b07e;})['then'](respondWithFilteredResult(_0x504da7,_0x13c747))[_0x07b7('0x24')](handleError(_0x504da7,null));};exports[_0x07b7('0x50')]=function(_0x2bd163,_0x4c5fc3){var _0x38f86f={'raw':![],'where':{'id':_0x2bd163[_0x07b7('0x51')]['id']}},_0x2c90a9={};_0x2c90a9[_0x07b7('0x3b')]=_['keys'](db[_0x07b7('0x37')]['rawAttributes']);_0x2c90a9[_0x07b7('0x3d')]=_[_0x07b7('0x52')](_0x2bd163[_0x07b7('0x3d')]);_0x2c90a9['filters']=_[_0x07b7('0x3f')](_0x2c90a9[_0x07b7('0x3b')],_0x2c90a9['query']);_0x38f86f[_0x07b7('0x40')]=_[_0x07b7('0x3f')](_0x2c90a9['model'],qs[_0x07b7('0x41')](_0x2bd163['query'][_0x07b7('0x41')]));_0x38f86f['attributes']=_0x38f86f[_0x07b7('0x40')]['length']?_0x38f86f[_0x07b7('0x40')]:_0x2c90a9[_0x07b7('0x3b')];if(_0x2bd163[_0x07b7('0x3d')]['includeAll']){_0x38f86f[_0x07b7('0x4d')]=[{'all':!![]}];}_0x38f86f=_['merge']({},_0x38f86f,_0x2bd163['options']);return db[_0x07b7('0x37')][_0x07b7('0x53')](_0x38f86f)[_0x07b7('0x31')](handleEntityNotFound(_0x4c5fc3,null))[_0x07b7('0x31')](respondWithResult(_0x4c5fc3,null))[_0x07b7('0x24')](handleError(_0x4c5fc3,null));};exports[_0x07b7('0x54')]=function(_0x2f77f9,_0x4c3faa){return db[_0x07b7('0x37')][_0x07b7('0x54')](_0x2f77f9[_0x07b7('0x55')],{})['then'](respondWithResult(_0x4c3faa,0xc9))[_0x07b7('0x24')](handleError(_0x4c3faa,null));};exports[_0x07b7('0x30')]=function(_0x3a76bc,_0x48f751){if(_0x3a76bc[_0x07b7('0x55')]['id']){delete _0x3a76bc[_0x07b7('0x55')]['id'];}return db[_0x07b7('0x37')]['find']({'where':{'id':_0x3a76bc[_0x07b7('0x51')]['id']}})[_0x07b7('0x31')](handleEntityNotFound(_0x48f751,null))[_0x07b7('0x31')](saveUpdates(_0x3a76bc[_0x07b7('0x55')],null))[_0x07b7('0x31')](respondWithResult(_0x48f751,null))[_0x07b7('0x24')](handleError(_0x48f751,null));};exports[_0x07b7('0x32')]=function(_0x29ba6f,_0x3d97cd){return db[_0x07b7('0x37')][_0x07b7('0x53')]({'where':{'id':_0x29ba6f[_0x07b7('0x51')]['id']}})[_0x07b7('0x31')](handleEntityNotFound(_0x3d97cd,null))[_0x07b7('0x31')](removeEntity(_0x3d97cd,null))[_0x07b7('0x24')](handleError(_0x3d97cd,null));};exports['getConfigurations']=function(_0x5c2d2b,_0x166630,_0x246a8b){var _0xd31971={};var _0x26238b={};var _0x234b61;var _0xd4c920;return db['VtigerAccount'][_0x07b7('0x56')]({'where':{'id':_0x5c2d2b[_0x07b7('0x51')]['id']}})[_0x07b7('0x31')](handleEntityNotFound(_0x166630,null))[_0x07b7('0x31')](function(_0x23a107){if(_0x23a107){_0x234b61=_0x23a107;_0x26238b[_0x07b7('0x3b')]=_[_0x07b7('0x52')](db[_0x07b7('0x57')][_0x07b7('0x58')]);_0x26238b['query']=_[_0x07b7('0x52')](_0x5c2d2b[_0x07b7('0x3d')]);_0x26238b[_0x07b7('0x3e')]=_[_0x07b7('0x3f')](_0x26238b['model'],_0x26238b[_0x07b7('0x3d')]);_0xd31971[_0x07b7('0x40')]=_[_0x07b7('0x3f')](_0x26238b['model'],qs[_0x07b7('0x41')](_0x5c2d2b[_0x07b7('0x3d')]['fields']));_0xd31971['attributes']=_0xd31971[_0x07b7('0x40')][_0x07b7('0x42')]?_0xd31971[_0x07b7('0x40')]:_0x26238b[_0x07b7('0x3b')];_0xd31971[_0x07b7('0x45')]=qs['sort'](_0x5c2d2b['query'][_0x07b7('0x46')]);_0xd31971['where']=qs[_0x07b7('0x3e')](_[_0x07b7('0x47')](_0x5c2d2b['query'],_0x26238b['filters']));if(_0x5c2d2b[_0x07b7('0x3d')][_0x07b7('0x59')]){_0xd31971['where']=_[_0x07b7('0x48')](_0xd31971[_0x07b7('0x49')],{'$or':_[_0x07b7('0x36')](_0xd31971[_0x07b7('0x40')],function(_0x20a20a){var _0x7c1d48={};_0x7c1d48[_0x20a20a]={'$like':'%'+_0x5c2d2b[_0x07b7('0x3d')][_0x07b7('0x59')]+'%'};return _0x7c1d48;})});}_0xd31971=_['merge']({},_0xd31971,_0x5c2d2b['options']);return _0x234b61[_0x07b7('0x5a')](_0xd31971);}})['then'](function(_0x1f5aab){if(_0x1f5aab){_0xd4c920=_0x1f5aab[_0x07b7('0x42')];if(!_0x5c2d2b[_0x07b7('0x3d')][_0x07b7('0x43')](_0x07b7('0x44'))){_0xd31971[_0x07b7('0x2a')]=qs['limit'](_0x5c2d2b['query'][_0x07b7('0x2a')]);_0xd31971[_0x07b7('0x29')]=qs[_0x07b7('0x29')](_0x5c2d2b['query'][_0x07b7('0x29')]);}return _0x234b61[_0x07b7('0x5a')](_0xd31971);}})[_0x07b7('0x31')](function(_0x5205b2){if(_0x5205b2){return _0x5205b2?{'count':_0xd4c920,'rows':_0x5205b2}:null;}})[_0x07b7('0x31')](respondWithResult(_0x166630,null))[_0x07b7('0x24')](handleError(_0x166630,null));};exports['addConfiguration']=function(_0x43a6b2,_0xb6e639,_0x3bb0ca){if(_0x43a6b2[_0x07b7('0x55')]['id']){delete _0x43a6b2[_0x07b7('0x55')]['id'];}return db[_0x07b7('0x37')][_0x07b7('0x56')]({'where':{'id':_0x43a6b2['params']['id']}})['then'](handleEntityNotFound(_0xb6e639,null))[_0x07b7('0x31')](function(_0x44215f){if(_0x44215f){_0x43a6b2['body'][_0x07b7('0x5b')]=_0x44215f['id'];_0x43a6b2[_0x07b7('0x55')][_0x07b7('0x5c')]=integrations[_0x07b7('0x5d')](_0x43a6b2['body']['channel'],_0x43a6b2['body'][_0x07b7('0x39')]);_0x43a6b2[_0x07b7('0x55')][_0x07b7('0x5e')]=integrations[_0x07b7('0x5f')](_0x43a6b2[_0x07b7('0x55')][_0x07b7('0x60')],_0x43a6b2[_0x07b7('0x55')]['type']);return db[_0x07b7('0x57')][_0x07b7('0x54')](_0x43a6b2[_0x07b7('0x55')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x07b7('0x61')],'as':_0x07b7('0x5e')}]});}return null;})['then'](respondWithResult(_0xb6e639,null))[_0x07b7('0x24')](handleError(_0xb6e639,null));};var md5=require(_0x07b7('0x62'));exports[_0x07b7('0x63')]=function(_0x198b88,_0x1a7992,_0x2c4936){var _0x258940=null;var _0x1e7fea=null;var _0xac708a=null;var _0x36b6a2=null;var _0x372040='';return db[_0x07b7('0x37')]['findOne']({'where':{'id':_0x198b88[_0x07b7('0x51')]['id']},'attributes':['id',_0x07b7('0x3c'),'username',_0x07b7('0x64'),_0x07b7('0x65'),_0x07b7('0x66'),_0x07b7('0x67'),_0x07b7('0x68')]})['then'](handleEntityNotFound(_0x1a7992,null))['then'](function(_0x577eab){if(_0x577eab){_0x258940=_0x577eab[_0x07b7('0x69')];_0x1e7fea=_0x577eab[_0x07b7('0x68')];_0xac708a=_0x577eab[_0x07b7('0x65')];_0x372040=_0x577eab['remoteUri'];var _0x131a71=_0x372040[_0x07b7('0x6a')](-0x1);if(_0x131a71==='/'){_0x372040=_0x372040[_0x07b7('0x6b')](0x0,_0x372040[_0x07b7('0x6c')](_0x131a71));}_0x36b6a2=util['format']('%s/webservice.php',_0x372040);var _0x157ae1={'method':_0x07b7('0x6d'),'uri':_0x36b6a2,'qs':{'operation':_0x07b7('0x6e'),'username':_0x577eab[_0x07b7('0x69')]},'json':!![]};return rp(_0x157ae1);}})[_0x07b7('0x31')](function(_0x43a3c0){if(_0x43a3c0[_0x07b7('0x6f')]){var _0x11f9bd={'method':'POST','uri':_0x36b6a2,'form':{'operation':_0x07b7('0x70'),'username':_0x258940,'accessKey':md5(_0x43a3c0[_0x07b7('0x23')]['token']+_0x1e7fea)},'json':!![]};return rp(_0x11f9bd);}})[_0x07b7('0x31')](function(_0x5bb1b2){if(_0x5bb1b2[_0x07b7('0x6f')]){var _0x5d4e95={'method':_0x07b7('0x6d'),'uri':_0x36b6a2,'qs':{'operation':_0x07b7('0x71'),'username':_0x258940,'sessionName':_0x5bb1b2[_0x07b7('0x23')][_0x07b7('0x72')],'elementType':_0xac708a},'json':!![]};return rp(_0x5d4e95);}})[_0x07b7('0x31')](function(_0x14ee87){if(_0x14ee87[_0x07b7('0x6f')]){var _0x3594d6=[_0x07b7('0x73'),'reference',_0x07b7('0x74')];_[_0x07b7('0x75')](_0x14ee87[_0x07b7('0x23')][_0x07b7('0x41')],function(_0x390ed8){return _0x3594d6[_0x07b7('0x76')](_0x390ed8[_0x07b7('0x39')][_0x07b7('0x3c')]);});_[_0x07b7('0x75')](_0x14ee87[_0x07b7('0x23')][_0x07b7('0x41')],function(_0x1bf938){return _0x1bf938[_0x07b7('0x77')]===_0x07b7('0x78');});return{'count':_0x14ee87[_0x07b7('0x23')][_0x07b7('0x41')]['length'],'rows':_[_0x07b7('0x36')](_0x14ee87[_0x07b7('0x23')]['fields'],function(_0x519851){return{'id':_0x519851[_0x07b7('0x3c')],'name':_0x519851[_0x07b7('0x79')],'custom':_[_0x07b7('0x7a')](_0x519851[_0x07b7('0x3c')],_0x07b7('0x7b'))?!![]:![],'options':_0x519851[_0x07b7('0x39')][_0x07b7('0x3c')]===_0x07b7('0x7c')&&_0x519851[_0x07b7('0x39')][_0x07b7('0x7d')]['length']>0x0?_['map'](_0x519851[_0x07b7('0x39')][_0x07b7('0x7d')],function(_0x140f50){return{'name':_0x140f50[_0x07b7('0x79')],'value':_0x140f50['value']};}):[]};})};}})['then'](respondWithResult(_0x1a7992,null))[_0x07b7('0x24')](function(_0x2df2ce){console[_0x07b7('0x7e')](_0x07b7('0x7f')+_0x2df2ce);var _0x39886b=_0x198b88['query']['test']?0x1f4:_0x2df2ce['statusCode']||0x1f4;logger[_0x07b7('0x1f')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x39886b,JSON[_0x07b7('0x80')](_0x2df2ce));delete _0x2df2ce[_0x07b7('0x3c')];if(_0x39886b===0x191){_0x39886b=0x190;}_0x1a7992[_0x07b7('0x26')](_0x39886b)[_0x07b7('0x34')](_0x198b88[_0x07b7('0x3d')][_0x07b7('0x81')]?{'message':_0x07b7('0x82'),'statusCode':_0x2df2ce[_0x07b7('0x83')]}:_0x2df2ce);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 69f2da0..b676075 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 _0x1c0e=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','../../config/logger','api','moment'];(function(_0x45e91a,_0x223adb){var _0xd80b9c=function(_0x3d9130){while(--_0x3d9130){_0x45e91a['push'](_0x45e91a['shift']());}};_0xd80b9c(++_0x223adb);}(_0x1c0e,0x1aa));var _0xe1c0=function(_0x127c9c,_0x265525){_0x127c9c=_0x127c9c-0x0;var _0x51fcff=_0x1c0e[_0x127c9c];return _0x51fcff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe1c0('0x0'))(_0xe1c0('0x1'));var moment=require(_0xe1c0('0x2'));var BPromise=require(_0xe1c0('0x3'));var rp=require(_0xe1c0('0x4'));var fs=require('fs');var path=require(_0xe1c0('0x5'));var rimraf=require(_0xe1c0('0x6'));var config=require(_0xe1c0('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xe1c0('0x8'));module[_0xe1c0('0x9')]=function(_0x163f7e,_0x1220e2){return _0x163f7e[_0xe1c0('0xa')](_0xe1c0('0xb'),attributes,{'tableName':_0xe1c0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf566=['rimraf','../../config/environment','./intVtigerAccount.attributes','define','../../config/logger','bluebird','path'];(function(_0x3c4f40,_0x302e0b){var _0x12032f=function(_0x159d92){while(--_0x159d92){_0x3c4f40['push'](_0x3c4f40['shift']());}};_0x12032f(++_0x302e0b);}(_0xf566,0x185));var _0x6f56=function(_0x4bea95,_0x2026cb){_0x4bea95=_0x4bea95-0x0;var _0x52aa29=_0xf566[_0x4bea95];return _0x52aa29;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f56('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6f56('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f56('0x2'));var rimraf=require(_0x6f56('0x3'));var config=require(_0x6f56('0x4'));var attributes=require(_0x6f56('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xbaf94b,_0xbb92df){return _0xbaf94b[_0x6f56('0x6')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','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 afe22df..1f23b5a 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 _0x4f8d=['GetVtigerAccount','stringify','ShowVtigerAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','info','catch','VtigerAccount','findAll','options','raw','where','attributes','include','map','model'];(function(_0x494cdd,_0x2d8c7b){var _0x592c2f=function(_0x309c67){while(--_0x309c67){_0x494cdd['push'](_0x494cdd['shift']());}};_0x592c2f(++_0x2d8c7b);}(_0x4f8d,0x19c));var _0xd4f8=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x4f8d[_0x27beea];return _0x122645;};'use strict';var _=require(_0xd4f8('0x0'));var util=require(_0xd4f8('0x1'));var moment=require(_0xd4f8('0x2'));var BPromise=require(_0xd4f8('0x3'));var rs=require(_0xd4f8('0x4'));var fs=require('fs');var Redis=require(_0xd4f8('0x5'));var db=require(_0xd4f8('0x6'))['db'];var utils=require(_0xd4f8('0x7'));var logger=require(_0xd4f8('0x8'))(_0xd4f8('0x9'));var config=require(_0xd4f8('0xa'));var jayson=require(_0xd4f8('0xb'));var client=jayson[_0xd4f8('0xc')][_0xd4f8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x420a99,_0x389d47,_0x78c22e){return new BPromise(function(_0x59453d,_0x5a027b){return client[_0xd4f8('0xe')](_0x420a99,_0x78c22e)['then'](function(_0x20d17c){logger['info'](_0xd4f8('0xf'),_0x389d47,_0xd4f8('0x10'));logger[_0xd4f8('0x11')](_0xd4f8('0x12'),_0x389d47,_0xd4f8('0x10'),JSON['stringify'](_0x20d17c));if(_0x20d17c[_0xd4f8('0x13')]){if(_0x20d17c[_0xd4f8('0x13')]['code']===0x1f4){logger[_0xd4f8('0x13')](_0xd4f8('0xf'),_0x389d47,_0x20d17c['error']['message']);return _0x5a027b(_0x20d17c['error'][_0xd4f8('0x14')]);}logger[_0xd4f8('0x13')](_0xd4f8('0xf'),_0x389d47,_0x20d17c[_0xd4f8('0x13')][_0xd4f8('0x14')]);return _0x59453d(_0x20d17c[_0xd4f8('0x13')][_0xd4f8('0x14')]);}else{logger[_0xd4f8('0x15')](_0xd4f8('0xf'),_0x389d47,'request\x20sent');_0x59453d(_0x20d17c['result']['message']);}})[_0xd4f8('0x16')](function(_0x4ff773){logger[_0xd4f8('0x13')](_0xd4f8('0xf'),_0x389d47,_0x4ff773);_0x5a027b(_0x4ff773);});});}exports['GetVtigerAccount']=function(_0xdca449){var _0x8c87f4=this;return new Promise(function(_0x1775c0,_0x5bdefb){return db[_0xd4f8('0x17')][_0xd4f8('0x18')]({'raw':_0xdca449['options']?_0xdca449[_0xd4f8('0x19')][_0xd4f8('0x1a')]===undefined?!![]:![]:!![],'where':_0xdca449[_0xd4f8('0x19')]?_0xdca449[_0xd4f8('0x19')][_0xd4f8('0x1b')]||null:null,'attributes':_0xdca449[_0xd4f8('0x19')]?_0xdca449[_0xd4f8('0x19')][_0xd4f8('0x1c')]||null:null,'limit':_0xdca449[_0xd4f8('0x19')]?_0xdca449[_0xd4f8('0x19')]['limit']||null:null,'include':_0xdca449[_0xd4f8('0x19')]?_0xdca449[_0xd4f8('0x19')][_0xd4f8('0x1d')]?_[_0xd4f8('0x1e')](_0xdca449['options']['include'],function(_0x2def2){return{'model':db[_0x2def2['model']],'as':_0x2def2['as'],'attributes':_0x2def2[_0xd4f8('0x1c')],'include':_0x2def2[_0xd4f8('0x1d')]?_[_0xd4f8('0x1e')](_0x2def2[_0xd4f8('0x1d')],function(_0x25ad92){return{'model':db[_0x25ad92[_0xd4f8('0x1f')]],'as':_0x25ad92['as'],'attributes':_0x25ad92[_0xd4f8('0x1c')],'include':_0x25ad92['include']?_[_0xd4f8('0x1e')](_0x25ad92[_0xd4f8('0x1d')],function(_0x58d5de){return{'model':db[_0x58d5de[_0xd4f8('0x1f')]],'as':_0x58d5de['as'],'attributes':_0x58d5de[_0xd4f8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b1641){logger[_0xd4f8('0x15')](_0xd4f8('0x20'),_0xdca449);logger[_0xd4f8('0x11')](_0xd4f8('0x20'),_0xdca449,JSON[_0xd4f8('0x21')](_0x1b1641));_0x1775c0(_0x1b1641);})[_0xd4f8('0x16')](function(_0x289a33){logger[_0xd4f8('0x13')](_0xd4f8('0x20'),_0x289a33[_0xd4f8('0x14')],_0xdca449);_0x5bdefb(_0x8c87f4['error'](0x1f4,_0x289a33[_0xd4f8('0x14')]));});});};exports[_0xd4f8('0x22')]=function(_0x696858){var _0x30a842=this;return new Promise(function(_0x2619cf,_0x439025){return db['VtigerAccount'][_0xd4f8('0x23')]({'raw':_0x696858[_0xd4f8('0x19')]?_0x696858[_0xd4f8('0x19')][_0xd4f8('0x1a')]===undefined?!![]:![]:!![],'where':_0x696858['options']?_0x696858[_0xd4f8('0x19')][_0xd4f8('0x1b')]||null:null,'attributes':_0x696858[_0xd4f8('0x19')]?_0x696858[_0xd4f8('0x19')][_0xd4f8('0x1c')]||null:null,'include':_0x696858[_0xd4f8('0x19')]?_0x696858['options'][_0xd4f8('0x1d')]?_['map'](_0x696858[_0xd4f8('0x19')]['include'],function(_0x37205e){return{'model':db[_0x37205e[_0xd4f8('0x1f')]],'as':_0x37205e['as'],'attributes':_0x37205e[_0xd4f8('0x1c')],'include':_0x37205e['include']?_[_0xd4f8('0x1e')](_0x37205e[_0xd4f8('0x1d')],function(_0x12f6a8){return{'model':db[_0x12f6a8['model']],'as':_0x12f6a8['as'],'attributes':_0x12f6a8[_0xd4f8('0x1c')],'include':_0x12f6a8[_0xd4f8('0x1d')]?_['map'](_0x12f6a8[_0xd4f8('0x1d')],function(_0x2460f5){return{'model':db[_0x2460f5[_0xd4f8('0x1f')]],'as':_0x2460f5['as'],'attributes':_0x2460f5[_0xd4f8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd4f8('0x24')](function(_0x3b14c9){logger[_0xd4f8('0x15')]('ShowVtigerAccount',_0x696858);logger[_0xd4f8('0x11')](_0xd4f8('0x22'),_0x696858,JSON['stringify'](_0x3b14c9));_0x2619cf(_0x3b14c9);})[_0xd4f8('0x16')](function(_0x1be4e2){logger[_0xd4f8('0x13')](_0xd4f8('0x22'),_0x1be4e2[_0xd4f8('0x14')],_0x696858);_0x439025(_0x30a842[_0xd4f8('0x13')](0x1f4,_0x1be4e2[_0xd4f8('0x14')]));});});}; \ No newline at end of file +var _0xdf19=['debug','stringify','catch','ShowVtigerAccount','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x1ee04d,_0x4b9f61){var _0x46a06e=function(_0x515e3a){while(--_0x515e3a){_0x1ee04d['push'](_0x1ee04d['shift']());}};_0x46a06e(++_0x4b9f61);}(_0xdf19,0x181));var _0x9df1=function(_0x1cd3e3,_0xbeb106){_0x1cd3e3=_0x1cd3e3-0x0;var _0x4a3336=_0xdf19[_0x1cd3e3];return _0x4a3336;};'use strict';var _=require(_0x9df1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9df1('0x1'));var rs=require(_0x9df1('0x2'));var fs=require('fs');var Redis=require(_0x9df1('0x3'));var db=require(_0x9df1('0x4'))['db'];var utils=require(_0x9df1('0x5'));var logger=require(_0x9df1('0x6'))(_0x9df1('0x7'));var config=require(_0x9df1('0x8'));var jayson=require(_0x9df1('0x9'));var client=jayson[_0x9df1('0xa')][_0x9df1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x265ef0,_0x4e1708,_0x5d83cd){return new BPromise(function(_0x354382,_0x3d2464){return client[_0x9df1('0xc')](_0x265ef0,_0x5d83cd)['then'](function(_0x54f0ca){logger[_0x9df1('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x4e1708,_0x9df1('0xe'));logger['debug'](_0x9df1('0xf'),_0x4e1708,'request\x20sent',JSON['stringify'](_0x54f0ca));if(_0x54f0ca[_0x9df1('0x10')]){if(_0x54f0ca[_0x9df1('0x10')][_0x9df1('0x11')]===0x1f4){logger[_0x9df1('0x10')](_0x9df1('0x12'),_0x4e1708,_0x54f0ca[_0x9df1('0x10')][_0x9df1('0x13')]);return _0x3d2464(_0x54f0ca[_0x9df1('0x10')][_0x9df1('0x13')]);}logger['error'](_0x9df1('0x12'),_0x4e1708,_0x54f0ca[_0x9df1('0x10')][_0x9df1('0x13')]);return _0x354382(_0x54f0ca['error'][_0x9df1('0x13')]);}else{logger[_0x9df1('0xd')](_0x9df1('0x12'),_0x4e1708,_0x9df1('0xe'));_0x354382(_0x54f0ca[_0x9df1('0x14')][_0x9df1('0x13')]);}})['catch'](function(_0x297d21){logger['error'](_0x9df1('0x12'),_0x4e1708,_0x297d21);_0x3d2464(_0x297d21);});});}exports[_0x9df1('0x15')]=function(_0x1b1849){var _0x366014=this;return new Promise(function(_0x4726b4,_0x2d013e){return db[_0x9df1('0x16')][_0x9df1('0x17')]({'raw':_0x1b1849['options']?_0x1b1849[_0x9df1('0x18')][_0x9df1('0x19')]===undefined?!![]:![]:!![],'where':_0x1b1849[_0x9df1('0x18')]?_0x1b1849[_0x9df1('0x18')][_0x9df1('0x1a')]||null:null,'attributes':_0x1b1849[_0x9df1('0x18')]?_0x1b1849['options'][_0x9df1('0x1b')]||null:null,'limit':_0x1b1849[_0x9df1('0x18')]?_0x1b1849[_0x9df1('0x18')][_0x9df1('0x1c')]||null:null,'include':_0x1b1849[_0x9df1('0x18')]?_0x1b1849[_0x9df1('0x18')][_0x9df1('0x1d')]?_[_0x9df1('0x1e')](_0x1b1849[_0x9df1('0x18')][_0x9df1('0x1d')],function(_0x19fd1d){return{'model':db[_0x19fd1d[_0x9df1('0x1f')]],'as':_0x19fd1d['as'],'attributes':_0x19fd1d[_0x9df1('0x1b')],'include':_0x19fd1d['include']?_['map'](_0x19fd1d[_0x9df1('0x1d')],function(_0xc85669){return{'model':db[_0xc85669[_0x9df1('0x1f')]],'as':_0xc85669['as'],'attributes':_0xc85669[_0x9df1('0x1b')],'include':_0xc85669[_0x9df1('0x1d')]?_[_0x9df1('0x1e')](_0xc85669[_0x9df1('0x1d')],function(_0x52b9e5){return{'model':db[_0x52b9e5[_0x9df1('0x1f')]],'as':_0x52b9e5['as'],'attributes':_0x52b9e5['attributes']};}):[]};}):[]};}):[]:[]})[_0x9df1('0x20')](function(_0x33e1d5){logger[_0x9df1('0xd')](_0x9df1('0x15'),_0x1b1849);logger[_0x9df1('0x21')](_0x9df1('0x15'),_0x1b1849,JSON[_0x9df1('0x22')](_0x33e1d5));_0x4726b4(_0x33e1d5);})[_0x9df1('0x23')](function(_0x37bf7b){logger[_0x9df1('0x10')]('GetVtigerAccount',_0x37bf7b[_0x9df1('0x13')],_0x1b1849);_0x2d013e(_0x366014[_0x9df1('0x10')](0x1f4,_0x37bf7b[_0x9df1('0x13')]));});});};exports[_0x9df1('0x24')]=function(_0x4e2680){var _0x592027=this;return new Promise(function(_0x36a46b,_0x260abb){return db['VtigerAccount'][_0x9df1('0x25')]({'raw':_0x4e2680['options']?_0x4e2680['options'][_0x9df1('0x19')]===undefined?!![]:![]:!![],'where':_0x4e2680[_0x9df1('0x18')]?_0x4e2680[_0x9df1('0x18')][_0x9df1('0x1a')]||null:null,'attributes':_0x4e2680[_0x9df1('0x18')]?_0x4e2680['options'][_0x9df1('0x1b')]||null:null,'include':_0x4e2680[_0x9df1('0x18')]?_0x4e2680['options']['include']?_['map'](_0x4e2680[_0x9df1('0x18')][_0x9df1('0x1d')],function(_0x47f061){return{'model':db[_0x47f061[_0x9df1('0x1f')]],'as':_0x47f061['as'],'attributes':_0x47f061[_0x9df1('0x1b')],'include':_0x47f061[_0x9df1('0x1d')]?_[_0x9df1('0x1e')](_0x47f061[_0x9df1('0x1d')],function(_0x5c0d48){return{'model':db[_0x5c0d48['model']],'as':_0x5c0d48['as'],'attributes':_0x5c0d48[_0x9df1('0x1b')],'include':_0x5c0d48['include']?_[_0x9df1('0x1e')](_0x5c0d48[_0x9df1('0x1d')],function(_0x279e96){return{'model':db[_0x279e96[_0x9df1('0x1f')]],'as':_0x279e96['as'],'attributes':_0x279e96[_0x9df1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9df1('0x20')](function(_0x5dfdfa){logger['info'](_0x9df1('0x24'),_0x4e2680);logger[_0x9df1('0x21')](_0x9df1('0x24'),_0x4e2680,JSON[_0x9df1('0x22')](_0x5dfdfa));_0x36a46b(_0x5dfdfa);})['catch'](function(_0x4d9697){logger['error'](_0x9df1('0x24'),_0x4d9697[_0x9df1('0x13')],_0x4e2680);_0x260abb(_0x592027['error'](0x1f4,_0x4d9697[_0x9df1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 1d6e79e..78e0869 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(_0x2b8107,_0x17850a){var _0x8be8e0=function(_0x1a1e86){while(--_0x1a1e86){_0x2b8107['push'](_0x2b8107['shift']());}};_0x8be8e0(++_0x17850a);}(_0xb10b,0x12a));var _0xbb10=function(_0x467cb0,_0x303070){_0x467cb0=_0x467cb0-0x0;var _0x2153f7=_0xb10b[_0x467cb0];return _0x2153f7;};'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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x4974e5,_0x563b0c){var _0x1a6ece=function(_0x338c13){while(--_0x338c13){_0x4974e5['push'](_0x4974e5['shift']());}};_0x1a6ece(++_0x563b0c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x44ebc2,_0x5986cf){_0x44ebc2=_0x44ebc2-0x0;var _0x22cdb5=_0x5f2f[_0x44ebc2];return _0x22cdb5;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 279f4df..9c78891 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 _0x673b=['exports','STRING','sequelize'];(function(_0x1b2bf7,_0x548353){var _0x5d0384=function(_0x2ecaab){while(--_0x2ecaab){_0x1b2bf7['push'](_0x1b2bf7['shift']());}};_0x5d0384(++_0x548353);}(_0x673b,0x1cd));var _0xb673=function(_0x431fc5,_0x45baf6){_0x431fc5=_0x431fc5-0x0;var _0x10ff01=_0x673b[_0x431fc5];return _0x10ff01;};'use strict';var Sequelize=require(_0xb673('0x0'));module[_0xb673('0x1')]={'name':{'type':Sequelize[_0xb673('0x2')]},'description':{'type':Sequelize[_0xb673('0x2')]}}; \ No newline at end of file +var _0x626f=['STRING','sequelize','exports'];(function(_0x154c6c,_0x5d6c86){var _0x57249c=function(_0x2e56b3){while(--_0x2e56b3){_0x154c6c['push'](_0x154c6c['shift']());}};_0x57249c(++_0x5d6c86);}(_0x626f,0x7f));var _0xf626=function(_0x435dae,_0x4ee7f4){_0x435dae=_0x435dae-0x0;var _0x3f8370=_0x626f[_0x435dae];return _0x3f8370;};'use strict';var Sequelize=require(_0xf626('0x0'));module[_0xf626('0x1')]={'name':{'type':Sequelize[_0xf626('0x2')]},'description':{'type':Sequelize[_0xf626('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index bd0ad1b..7b75477 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 _0x9b0d=['error','message','result','catch','status','json','count','offset','set','Content-Range','reject','save','destroy','end','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','VtigerConfiguration','create','body','update','find','findOne','VtigerField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x9b0d,0x139));var _0xd9b0=function(_0x3fdd0e,_0x562404){_0x3fdd0e=_0x3fdd0e-0x0;var _0x4bf82d=_0x9b0d[_0x3fdd0e];return _0x4bf82d;};'use strict';var pdf=require(_0xd9b0('0x0'));var emlformat=require(_0xd9b0('0x1'));var rimraf=require(_0xd9b0('0x2'));var zipdir=require(_0xd9b0('0x3'));var jsonpatch=require(_0xd9b0('0x4'));var rp=require(_0xd9b0('0x5'));var moment=require('moment');var BPromise=require(_0xd9b0('0x6'));var Mustache=require(_0xd9b0('0x7'));var util=require(_0xd9b0('0x8'));var path=require(_0xd9b0('0x9'));var sox=require(_0xd9b0('0xa'));var csv=require('to-csv');var ejs=require(_0xd9b0('0xb'));var fs=require('fs');var _=require(_0xd9b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd9b0('0xd'));var deskjs=require(_0xd9b0('0xe'));var toCsv=require(_0xd9b0('0xf'));var querystring=require('querystring');var Papa=require(_0xd9b0('0x10'));var Redis=require('ioredis');var authService=require(_0xd9b0('0x11'));var qs=require(_0xd9b0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9b0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd9b0('0x14'));var config=require(_0xd9b0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd9b0('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd9b0('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x351b42,_0x2fa5da,_0x485fe4,_0x3adbcf){return new BPromise(function(_0x5a5657,_0x4b266e){var _0x4d2c78=_0x3adbcf||client;return _0x4d2c78[_0xd9b0('0x18')](_0x351b42,_0x485fe4)[_0xd9b0('0x19')](function(_0x134a69){logger[_0xd9b0('0x1a')](_0xd9b0('0x1b'),_0x2fa5da,_0xd9b0('0x1c'));logger[_0xd9b0('0x1d')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2fa5da,_0xd9b0('0x1c'),JSON[_0xd9b0('0x1e')](_0x134a69));if(_0x134a69[_0xd9b0('0x1f')]){if(_0x134a69['error']['code']===0x1f4){logger['error'](_0xd9b0('0x1b'),_0x2fa5da,_0x134a69['error']['message']);return _0x4b266e(_0x134a69[_0xd9b0('0x1f')][_0xd9b0('0x20')]);}logger[_0xd9b0('0x1f')](_0xd9b0('0x1b'),_0x2fa5da,_0x134a69[_0xd9b0('0x1f')][_0xd9b0('0x20')]);return _0x5a5657(_0x134a69['error']['message']);}else{logger[_0xd9b0('0x1a')](_0xd9b0('0x1b'),_0x2fa5da,'request\x20sent');_0x5a5657(_0x134a69[_0xd9b0('0x21')]['message']);}})[_0xd9b0('0x22')](function(_0x5a1071){logger[_0xd9b0('0x1f')](_0xd9b0('0x1b'),_0x2fa5da,_0x5a1071);_0x4b266e(_0x5a1071);});});}function respondWithStatusCode(_0x4f0ecb,_0x5b99d3){_0x5b99d3=_0x5b99d3||0xcc;return function(_0x272207){if(_0x272207){return _0x4f0ecb['sendStatus'](_0x5b99d3);}return _0x4f0ecb[_0xd9b0('0x23')](_0x5b99d3)['end']();};}function respondWithResult(_0xed6c2c,_0x223e0d){_0x223e0d=_0x223e0d||0xc8;return function(_0x58cdbe){if(_0x58cdbe){return _0xed6c2c[_0xd9b0('0x23')](_0x223e0d)[_0xd9b0('0x24')](_0x58cdbe);}};}function respondWithFilteredResult(_0x19ee55,_0x4f1545){return function(_0x2158e3){if(_0x2158e3){var _0x4c8237=_0x2158e3[_0xd9b0('0x25')],_0x234c5b=_0x4f1545[_0xd9b0('0x26')],_0x2095d2=_0x4f1545[_0xd9b0('0x26')]+_0x4f1545['limit'],_0x1e3ac8;if(_0x2095d2>=_0x4c8237){_0x2095d2=_0x4c8237;_0x1e3ac8=0xc8;}else{_0x1e3ac8=0xce;}_0x19ee55[_0xd9b0('0x23')](_0x1e3ac8);return _0x19ee55[_0xd9b0('0x27')](_0xd9b0('0x28'),_0x234c5b+'-'+_0x2095d2+'/'+_0x4c8237)['json'](_0x2158e3);}return null;};}function patchUpdates(_0x44f8cb){return function(_0xf67095){try{jsonpatch['apply'](_0xf67095,_0x44f8cb,!![]);}catch(_0x381925){return BPromise[_0xd9b0('0x29')](_0x381925);}return _0xf67095[_0xd9b0('0x2a')]();};}function saveUpdates(_0x10dba4,_0x1c7161){return function(_0x898cf2){if(_0x898cf2){return _0x898cf2['update'](_0x10dba4)[_0xd9b0('0x19')](function(_0x2ffa25){return _0x2ffa25;});}return null;};}function removeEntity(_0x4581cc,_0x355a5d){return function(_0x51e61d){if(_0x51e61d){return _0x51e61d[_0xd9b0('0x2b')]()[_0xd9b0('0x19')](function(){_0x4581cc[_0xd9b0('0x23')](0xcc)[_0xd9b0('0x2c')]();});}};}function handleEntityNotFound(_0x3b81ca,_0x576427){return function(_0x542fb5){if(!_0x542fb5){_0x3b81ca['sendStatus'](0x194);}return _0x542fb5;};}function handleError(_0x220390,_0x22f1be){_0x22f1be=_0x22f1be||0x1f4;return function(_0x51b13c){logger[_0xd9b0('0x1f')](_0x51b13c[_0xd9b0('0x2d')]);if(_0x51b13c[_0xd9b0('0x2e')]){delete _0x51b13c[_0xd9b0('0x2e')];}_0x220390[_0xd9b0('0x23')](_0x22f1be)['send'](_0x51b13c);};}exports['index']=function(_0x9ae8b4,_0x3b899b){var _0x5aee34={},_0x4db1fc={},_0x154715={'count':0x0,'rows':[]};var _0xbe0da8=_[_0xd9b0('0x2f')](db['VtigerConfiguration'][_0xd9b0('0x30')],function(_0x5eaffa){return{'name':_0x5eaffa[_0xd9b0('0x31')],'type':_0x5eaffa[_0xd9b0('0x32')][_0xd9b0('0x33')]};});_0x4db1fc[_0xd9b0('0x34')]=_['map'](_0xbe0da8,_0xd9b0('0x2e'));_0x4db1fc[_0xd9b0('0x35')]=_[_0xd9b0('0x36')](_0x9ae8b4[_0xd9b0('0x35')]);_0x4db1fc[_0xd9b0('0x37')]=_[_0xd9b0('0x38')](_0x4db1fc['model'],_0x4db1fc[_0xd9b0('0x35')]);_0x5aee34[_0xd9b0('0x39')]=_[_0xd9b0('0x38')](_0x4db1fc[_0xd9b0('0x34')],qs[_0xd9b0('0x3a')](_0x9ae8b4['query'][_0xd9b0('0x3a')]));_0x5aee34['attributes']=_0x5aee34[_0xd9b0('0x39')][_0xd9b0('0x3b')]?_0x5aee34[_0xd9b0('0x39')]:_0x4db1fc[_0xd9b0('0x34')];if(!_0x9ae8b4[_0xd9b0('0x35')][_0xd9b0('0x3c')](_0xd9b0('0x3d'))){_0x5aee34[_0xd9b0('0x3e')]=qs[_0xd9b0('0x3e')](_0x9ae8b4[_0xd9b0('0x35')]['limit']);_0x5aee34[_0xd9b0('0x26')]=qs[_0xd9b0('0x26')](_0x9ae8b4[_0xd9b0('0x35')][_0xd9b0('0x26')]);}_0x5aee34['order']=qs[_0xd9b0('0x3f')](_0x9ae8b4[_0xd9b0('0x35')][_0xd9b0('0x3f')]);_0x5aee34[_0xd9b0('0x40')]=qs[_0xd9b0('0x37')](_[_0xd9b0('0x41')](_0x9ae8b4[_0xd9b0('0x35')],_0x4db1fc['filters']),_0xbe0da8);if(_0x9ae8b4[_0xd9b0('0x35')][_0xd9b0('0x42')]){_0x5aee34['where']=_[_0xd9b0('0x43')](_0x5aee34[_0xd9b0('0x40')],{'$or':_['map'](_0xbe0da8,function(_0x3e6499){if(_0x3e6499['type']!==_0xd9b0('0x44')){var _0x11e18c={};_0x11e18c[_0x3e6499[_0xd9b0('0x2e')]]={'$like':'%'+_0x9ae8b4[_0xd9b0('0x35')]['filter']+'%'};return _0x11e18c;}})});}_0x5aee34=_[_0xd9b0('0x43')]({},_0x5aee34,_0x9ae8b4[_0xd9b0('0x45')]);var _0x5c5e04={'where':_0x5aee34['where']};return db['VtigerConfiguration']['count'](_0x5c5e04)[_0xd9b0('0x19')](function(_0x12e4e7){_0x154715['count']=_0x12e4e7;if(_0x9ae8b4[_0xd9b0('0x35')][_0xd9b0('0x46')]){_0x5aee34[_0xd9b0('0x47')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x5aee34);})['then'](function(_0xa894fa){_0x154715[_0xd9b0('0x48')]=_0xa894fa;return _0x154715;})[_0xd9b0('0x19')](respondWithFilteredResult(_0x3b899b,_0x5aee34))[_0xd9b0('0x22')](handleError(_0x3b899b,null));};exports[_0xd9b0('0x49')]=function(_0x512184,_0x44da5a){var _0x461146={'raw':![],'where':{'id':_0x512184[_0xd9b0('0x4a')]['id']}},_0x10a6f9={};_0x10a6f9['model']=_[_0xd9b0('0x36')](db[_0xd9b0('0x4b')][_0xd9b0('0x30')]);_0x10a6f9[_0xd9b0('0x35')]=_[_0xd9b0('0x36')](_0x512184[_0xd9b0('0x35')]);_0x10a6f9[_0xd9b0('0x37')]=_['intersection'](_0x10a6f9[_0xd9b0('0x34')],_0x10a6f9[_0xd9b0('0x35')]);_0x461146[_0xd9b0('0x39')]=_[_0xd9b0('0x38')](_0x10a6f9['model'],qs['fields'](_0x512184[_0xd9b0('0x35')][_0xd9b0('0x3a')]));_0x461146[_0xd9b0('0x39')]=_0x461146[_0xd9b0('0x39')][_0xd9b0('0x3b')]?_0x461146['attributes']:_0x10a6f9['model'];if(_0x512184[_0xd9b0('0x35')][_0xd9b0('0x46')]){_0x461146[_0xd9b0('0x47')]=[{'all':!![]}];}_0x461146=_[_0xd9b0('0x43')]({},_0x461146,_0x512184[_0xd9b0('0x45')]);return db[_0xd9b0('0x4b')]['find'](_0x461146)[_0xd9b0('0x19')](handleEntityNotFound(_0x44da5a,null))[_0xd9b0('0x19')](respondWithResult(_0x44da5a,null))[_0xd9b0('0x22')](handleError(_0x44da5a,null));};exports[_0xd9b0('0x4c')]=function(_0x12a638,_0x13d4e9){return db[_0xd9b0('0x4b')][_0xd9b0('0x4c')](_0x12a638[_0xd9b0('0x4d')],{})[_0xd9b0('0x19')](respondWithResult(_0x13d4e9,0xc9))[_0xd9b0('0x22')](handleError(_0x13d4e9,null));};exports[_0xd9b0('0x4e')]=function(_0xfeb6e6,_0x530a58){if(_0xfeb6e6[_0xd9b0('0x4d')]['id']){delete _0xfeb6e6[_0xd9b0('0x4d')]['id'];}return db[_0xd9b0('0x4b')][_0xd9b0('0x4f')]({'where':{'id':_0xfeb6e6[_0xd9b0('0x4a')]['id']}})[_0xd9b0('0x19')](handleEntityNotFound(_0x530a58,null))[_0xd9b0('0x19')](saveUpdates(_0xfeb6e6[_0xd9b0('0x4d')],null))['then'](respondWithResult(_0x530a58,null))[_0xd9b0('0x22')](handleError(_0x530a58,null));};exports[_0xd9b0('0x2b')]=function(_0x20bf36,_0x518dca){return db[_0xd9b0('0x4b')][_0xd9b0('0x4f')]({'where':{'id':_0x20bf36['params']['id']}})[_0xd9b0('0x19')](handleEntityNotFound(_0x518dca,null))[_0xd9b0('0x19')](removeEntity(_0x518dca,null))[_0xd9b0('0x22')](handleError(_0x518dca,null));};exports['getFields']=function(_0x1bb0a3,_0x5abd65,_0x15a593){var _0x4ee578={};var _0x92208e={};var _0x26a106;var _0x9e6cf3;return db[_0xd9b0('0x4b')][_0xd9b0('0x50')]({'where':{'id':_0x1bb0a3['params']['id']}})['then'](handleEntityNotFound(_0x5abd65,null))[_0xd9b0('0x19')](function(_0x1504d0){if(_0x1504d0){_0x26a106=_0x1504d0;_0x92208e[_0xd9b0('0x34')]=_[_0xd9b0('0x36')](db[_0xd9b0('0x51')]['rawAttributes']);_0x92208e[_0xd9b0('0x35')]=_[_0xd9b0('0x36')](_0x1bb0a3[_0xd9b0('0x35')]);_0x92208e[_0xd9b0('0x37')]=_[_0xd9b0('0x38')](_0x92208e['model'],_0x92208e[_0xd9b0('0x35')]);_0x4ee578['attributes']=_[_0xd9b0('0x38')](_0x92208e[_0xd9b0('0x34')],qs[_0xd9b0('0x3a')](_0x1bb0a3[_0xd9b0('0x35')][_0xd9b0('0x3a')]));_0x4ee578[_0xd9b0('0x39')]=_0x4ee578['attributes'][_0xd9b0('0x3b')]?_0x4ee578[_0xd9b0('0x39')]:_0x92208e[_0xd9b0('0x34')];_0x4ee578[_0xd9b0('0x52')]=qs['sort'](_0x1bb0a3[_0xd9b0('0x35')]['sort']);_0x4ee578[_0xd9b0('0x40')]=qs[_0xd9b0('0x37')](_[_0xd9b0('0x41')](_0x1bb0a3['query'],_0x92208e['filters']));if(_0x1bb0a3[_0xd9b0('0x35')]['filter']){_0x4ee578[_0xd9b0('0x40')]=_['merge'](_0x4ee578['where'],{'$or':_[_0xd9b0('0x2f')](_0x4ee578['attributes'],function(_0x1a24d4){var _0x572788={};_0x572788[_0x1a24d4]={'$like':'%'+_0x1bb0a3[_0xd9b0('0x35')][_0xd9b0('0x42')]+'%'};return _0x572788;})});}_0x4ee578=_['merge']({},_0x4ee578,_0x1bb0a3['options']);return _0x26a106[_0xd9b0('0x53')](_0x4ee578);}})[_0xd9b0('0x19')](function(_0x356996){if(_0x356996){_0x9e6cf3=_0x356996[_0xd9b0('0x3b')];if(!_0x1bb0a3[_0xd9b0('0x35')][_0xd9b0('0x3c')](_0xd9b0('0x3d'))){_0x4ee578[_0xd9b0('0x3e')]=qs[_0xd9b0('0x3e')](_0x1bb0a3[_0xd9b0('0x35')]['limit']);_0x4ee578[_0xd9b0('0x26')]=qs[_0xd9b0('0x26')](_0x1bb0a3[_0xd9b0('0x35')][_0xd9b0('0x26')]);}return _0x26a106[_0xd9b0('0x53')](_0x4ee578);}})[_0xd9b0('0x19')](function(_0x33776f){if(_0x33776f){return _0x33776f?{'count':_0x9e6cf3,'rows':_0x33776f}:null;}})[_0xd9b0('0x19')](respondWithResult(_0x5abd65,null))[_0xd9b0('0x22')](handleError(_0x5abd65,null));};exports[_0xd9b0('0x54')]=function(_0x3c3948,_0x5db31e,_0x4c9a10){var _0x6896c9={};var _0x379c5d={};var _0x1e7d69;var _0x5859b3;return db[_0xd9b0('0x4b')][_0xd9b0('0x50')]({'where':{'id':_0x3c3948[_0xd9b0('0x4a')]['id']}})[_0xd9b0('0x19')](handleEntityNotFound(_0x5db31e,null))[_0xd9b0('0x19')](function(_0x4712be){if(_0x4712be){_0x1e7d69=_0x4712be;_0x379c5d[_0xd9b0('0x34')]=_[_0xd9b0('0x36')](db[_0xd9b0('0x51')]['rawAttributes']);_0x379c5d[_0xd9b0('0x35')]=_[_0xd9b0('0x36')](_0x3c3948[_0xd9b0('0x35')]);_0x379c5d[_0xd9b0('0x37')]=_[_0xd9b0('0x38')](_0x379c5d[_0xd9b0('0x34')],_0x379c5d[_0xd9b0('0x35')]);_0x6896c9[_0xd9b0('0x39')]=_[_0xd9b0('0x38')](_0x379c5d[_0xd9b0('0x34')],qs[_0xd9b0('0x3a')](_0x3c3948[_0xd9b0('0x35')]['fields']));_0x6896c9[_0xd9b0('0x39')]=_0x6896c9[_0xd9b0('0x39')][_0xd9b0('0x3b')]?_0x6896c9['attributes']:_0x379c5d[_0xd9b0('0x34')];_0x6896c9[_0xd9b0('0x52')]=qs[_0xd9b0('0x3f')](_0x3c3948[_0xd9b0('0x35')][_0xd9b0('0x3f')]);_0x6896c9[_0xd9b0('0x40')]=qs['filters'](_[_0xd9b0('0x41')](_0x3c3948[_0xd9b0('0x35')],_0x379c5d[_0xd9b0('0x37')]));if(_0x3c3948['query'][_0xd9b0('0x42')]){_0x6896c9[_0xd9b0('0x40')]=_[_0xd9b0('0x43')](_0x6896c9['where'],{'$or':_[_0xd9b0('0x2f')](_0x6896c9[_0xd9b0('0x39')],function(_0x11685d){var _0x38028a={};_0x38028a[_0x11685d]={'$like':'%'+_0x3c3948[_0xd9b0('0x35')][_0xd9b0('0x42')]+'%'};return _0x38028a;})});}_0x6896c9=_[_0xd9b0('0x43')]({},_0x6896c9,_0x3c3948[_0xd9b0('0x45')]);return _0x1e7d69['getSubjects'](_0x6896c9);}})[_0xd9b0('0x19')](function(_0x2cac36){if(_0x2cac36){_0x5859b3=_0x2cac36['length'];if(!_0x3c3948['query'][_0xd9b0('0x3c')](_0xd9b0('0x3d'))){_0x6896c9[_0xd9b0('0x3e')]=qs[_0xd9b0('0x3e')](_0x3c3948[_0xd9b0('0x35')][_0xd9b0('0x3e')]);_0x6896c9[_0xd9b0('0x26')]=qs['offset'](_0x3c3948[_0xd9b0('0x35')]['offset']);}return _0x1e7d69[_0xd9b0('0x54')](_0x6896c9);}})[_0xd9b0('0x19')](function(_0x2508c8){if(_0x2508c8){return _0x2508c8?{'count':_0x5859b3,'rows':_0x2508c8}:null;}})[_0xd9b0('0x19')](respondWithResult(_0x5db31e,null))[_0xd9b0('0x22')](handleError(_0x5db31e,null));};exports[_0xd9b0('0x55')]=function(_0x571dc9,_0x125f3f,_0xdac3d8){var _0x3b0e87={};var _0x1a8d46={};var _0x5a5854;var _0x5e8c10;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x571dc9['params']['id']}})[_0xd9b0('0x19')](handleEntityNotFound(_0x125f3f,null))[_0xd9b0('0x19')](function(_0x2764c1){if(_0x2764c1){_0x5a5854=_0x2764c1;_0x1a8d46[_0xd9b0('0x34')]=_[_0xd9b0('0x36')](db['VtigerField'][_0xd9b0('0x30')]);_0x1a8d46['query']=_['keys'](_0x571dc9[_0xd9b0('0x35')]);_0x1a8d46[_0xd9b0('0x37')]=_['intersection'](_0x1a8d46['model'],_0x1a8d46[_0xd9b0('0x35')]);_0x3b0e87['attributes']=_[_0xd9b0('0x38')](_0x1a8d46[_0xd9b0('0x34')],qs[_0xd9b0('0x3a')](_0x571dc9[_0xd9b0('0x35')][_0xd9b0('0x3a')]));_0x3b0e87[_0xd9b0('0x39')]=_0x3b0e87[_0xd9b0('0x39')]['length']?_0x3b0e87['attributes']:_0x1a8d46[_0xd9b0('0x34')];_0x3b0e87[_0xd9b0('0x52')]=qs['sort'](_0x571dc9['query'][_0xd9b0('0x3f')]);_0x3b0e87[_0xd9b0('0x40')]=qs[_0xd9b0('0x37')](_[_0xd9b0('0x41')](_0x571dc9[_0xd9b0('0x35')],_0x1a8d46[_0xd9b0('0x37')]));if(_0x571dc9[_0xd9b0('0x35')][_0xd9b0('0x42')]){_0x3b0e87[_0xd9b0('0x40')]=_[_0xd9b0('0x43')](_0x3b0e87['where'],{'$or':_[_0xd9b0('0x2f')](_0x3b0e87['attributes'],function(_0x25bdc7){var _0xaeaba6={};_0xaeaba6[_0x25bdc7]={'$like':'%'+_0x571dc9['query']['filter']+'%'};return _0xaeaba6;})});}_0x3b0e87=_['merge']({},_0x3b0e87,_0x571dc9['options']);return _0x5a5854[_0xd9b0('0x55')](_0x3b0e87);}})[_0xd9b0('0x19')](function(_0x40e000){if(_0x40e000){_0x5e8c10=_0x40e000[_0xd9b0('0x3b')];if(!_0x571dc9['query']['hasOwnProperty']('nolimit')){_0x3b0e87[_0xd9b0('0x3e')]=qs[_0xd9b0('0x3e')](_0x571dc9[_0xd9b0('0x35')][_0xd9b0('0x3e')]);_0x3b0e87[_0xd9b0('0x26')]=qs[_0xd9b0('0x26')](_0x571dc9[_0xd9b0('0x35')]['offset']);}return _0x5a5854[_0xd9b0('0x55')](_0x3b0e87);}})[_0xd9b0('0x19')](function(_0x4d8bc3){if(_0x4d8bc3){return _0x4d8bc3?{'count':_0x5e8c10,'rows':_0x4d8bc3}:null;}})[_0xd9b0('0x19')](respondWithResult(_0x125f3f,null))[_0xd9b0('0x22')](handleError(_0x125f3f,null));}; \ No newline at end of file +var _0x587a=['fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','create','body','getFields','findOne','VtigerField','order','getSubjects','getDescriptions','pick','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','count','offset','limit','set','apply','save','update','destroy','end','sendStatus','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','attributes','intersection'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x587a,0x18b));var _0xa587=function(_0x463f91,_0x26ec38){_0x463f91=_0x463f91-0x0;var _0x552e15=_0x587a[_0x463f91];return _0x552e15;};'use strict';var pdf=require(_0xa587('0x0'));var emlformat=require(_0xa587('0x1'));var rimraf=require(_0xa587('0x2'));var zipdir=require(_0xa587('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa587('0x4'));var BPromise=require(_0xa587('0x5'));var Mustache=require(_0xa587('0x6'));var util=require(_0xa587('0x7'));var path=require('path');var sox=require(_0xa587('0x8'));var csv=require(_0xa587('0x9'));var ejs=require(_0xa587('0xa'));var fs=require('fs');var _=require(_0xa587('0xb'));var squel=require(_0xa587('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa587('0xd'));var toCsv=require(_0xa587('0x9'));var querystring=require(_0xa587('0xe'));var Papa=require(_0xa587('0xf'));var Redis=require(_0xa587('0x10'));var authService=require(_0xa587('0x11'));var qs=require(_0xa587('0x12'));var as=require(_0xa587('0x13'));var hardwareService=require(_0xa587('0x14'));var logger=require(_0xa587('0x15'))('api');var utils=require(_0xa587('0x16'));var config=require(_0xa587('0x17'));var licenseUtil=require(_0xa587('0x18'));var db=require(_0xa587('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa587('0x1a')][_0xa587('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x56c380,_0x4eb46b,_0x5cd0ec,_0x58fd50){return new BPromise(function(_0x22b5d2,_0x4780db){var _0x37b22c=_0x58fd50||client;return _0x37b22c[_0xa587('0x1c')](_0x56c380,_0x5cd0ec)[_0xa587('0x1d')](function(_0x54d3bc){logger[_0xa587('0x1e')](_0xa587('0x1f'),_0x4eb46b,_0xa587('0x20'));logger[_0xa587('0x21')](_0xa587('0x22'),_0x4eb46b,_0xa587('0x20'),JSON['stringify'](_0x54d3bc));if(_0x54d3bc[_0xa587('0x23')]){if(_0x54d3bc[_0xa587('0x23')][_0xa587('0x24')]===0x1f4){logger['error'](_0xa587('0x1f'),_0x4eb46b,_0x54d3bc[_0xa587('0x23')]['message']);return _0x4780db(_0x54d3bc[_0xa587('0x23')][_0xa587('0x25')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4eb46b,_0x54d3bc[_0xa587('0x23')][_0xa587('0x25')]);return _0x22b5d2(_0x54d3bc['error'][_0xa587('0x25')]);}else{logger[_0xa587('0x1e')]('VtigerConfiguration,\x20%s,\x20%s',_0x4eb46b,_0xa587('0x20'));_0x22b5d2(_0x54d3bc[_0xa587('0x26')][_0xa587('0x25')]);}})[_0xa587('0x27')](function(_0x4db979){logger[_0xa587('0x23')](_0xa587('0x1f'),_0x4eb46b,_0x4db979);_0x4780db(_0x4db979);});});}function respondWithStatusCode(_0x4abca3,_0x18fef3){_0x18fef3=_0x18fef3||0xcc;return function(_0x40e4bc){if(_0x40e4bc){return _0x4abca3['sendStatus'](_0x18fef3);}return _0x4abca3[_0xa587('0x28')](_0x18fef3)['end']();};}function respondWithResult(_0xfe01d,_0x5e3a78){_0x5e3a78=_0x5e3a78||0xc8;return function(_0xfc03bd){if(_0xfc03bd){return _0xfe01d[_0xa587('0x28')](_0x5e3a78)[_0xa587('0x29')](_0xfc03bd);}};}function respondWithFilteredResult(_0x3e1eda,_0x1a3a1d){return function(_0x4b52d8){if(_0x4b52d8){var _0x27df76=_0x4b52d8[_0xa587('0x2a')],_0x3e4773=_0x1a3a1d['offset'],_0x556c3e=_0x1a3a1d[_0xa587('0x2b')]+_0x1a3a1d[_0xa587('0x2c')],_0x1e1ae8;if(_0x556c3e>=_0x27df76){_0x556c3e=_0x27df76;_0x1e1ae8=0xc8;}else{_0x1e1ae8=0xce;}_0x3e1eda['status'](_0x1e1ae8);return _0x3e1eda[_0xa587('0x2d')]('Content-Range',_0x3e4773+'-'+_0x556c3e+'/'+_0x27df76)['json'](_0x4b52d8);}return null;};}function patchUpdates(_0x42b370){return function(_0x794ee4){try{jsonpatch[_0xa587('0x2e')](_0x794ee4,_0x42b370,!![]);}catch(_0x2bad22){return BPromise['reject'](_0x2bad22);}return _0x794ee4[_0xa587('0x2f')]();};}function saveUpdates(_0x59c44e,_0x54d475){return function(_0x36d526){if(_0x36d526){return _0x36d526[_0xa587('0x30')](_0x59c44e)['then'](function(_0x12b5d0){return _0x12b5d0;});}return null;};}function removeEntity(_0x474197,_0x3749ba){return function(_0x21ee33){if(_0x21ee33){return _0x21ee33[_0xa587('0x31')]()['then'](function(){_0x474197['status'](0xcc)[_0xa587('0x32')]();});}};}function handleEntityNotFound(_0x2dc62d,_0x3e7218){return function(_0x3132f1){if(!_0x3132f1){_0x2dc62d[_0xa587('0x33')](0x194);}return _0x3132f1;};}function handleError(_0x4614eb,_0x2d5fc5){_0x2d5fc5=_0x2d5fc5||0x1f4;return function(_0x207108){logger['error'](_0x207108[_0xa587('0x34')]);if(_0x207108[_0xa587('0x35')]){delete _0x207108['name'];}_0x4614eb[_0xa587('0x28')](_0x2d5fc5)[_0xa587('0x36')](_0x207108);};}exports['index']=function(_0xdd6045,_0x32fc0d){var _0x3d9787={},_0xbe0111={},_0xf34573={'count':0x0,'rows':[]};var _0x2cff93=_[_0xa587('0x37')](db[_0xa587('0x38')][_0xa587('0x39')],function(_0x5a25a1){return{'name':_0x5a25a1[_0xa587('0x3a')],'type':_0x5a25a1[_0xa587('0x3b')]['key']};});_0xbe0111[_0xa587('0x3c')]=_[_0xa587('0x37')](_0x2cff93,'name');_0xbe0111[_0xa587('0x3d')]=_[_0xa587('0x3e')](_0xdd6045[_0xa587('0x3d')]);_0xbe0111['filters']=_['intersection'](_0xbe0111[_0xa587('0x3c')],_0xbe0111[_0xa587('0x3d')]);_0x3d9787[_0xa587('0x3f')]=_[_0xa587('0x40')](_0xbe0111[_0xa587('0x3c')],qs[_0xa587('0x41')](_0xdd6045[_0xa587('0x3d')][_0xa587('0x41')]));_0x3d9787['attributes']=_0x3d9787[_0xa587('0x3f')][_0xa587('0x42')]?_0x3d9787[_0xa587('0x3f')]:_0xbe0111[_0xa587('0x3c')];if(!_0xdd6045[_0xa587('0x3d')][_0xa587('0x43')](_0xa587('0x44'))){_0x3d9787['limit']=qs[_0xa587('0x2c')](_0xdd6045[_0xa587('0x3d')][_0xa587('0x2c')]);_0x3d9787[_0xa587('0x2b')]=qs[_0xa587('0x2b')](_0xdd6045[_0xa587('0x3d')][_0xa587('0x2b')]);}_0x3d9787['order']=qs[_0xa587('0x45')](_0xdd6045[_0xa587('0x3d')]['sort']);_0x3d9787['where']=qs[_0xa587('0x46')](_['pick'](_0xdd6045['query'],_0xbe0111[_0xa587('0x46')]),_0x2cff93);if(_0xdd6045[_0xa587('0x3d')][_0xa587('0x47')]){_0x3d9787['where']=_['merge'](_0x3d9787[_0xa587('0x48')],{'$or':_['map'](_0x2cff93,function(_0x83881f){if(_0x83881f[_0xa587('0x3b')]!==_0xa587('0x49')){var _0x15007f={};_0x15007f[_0x83881f[_0xa587('0x35')]]={'$like':'%'+_0xdd6045[_0xa587('0x3d')]['filter']+'%'};return _0x15007f;}})});}_0x3d9787=_['merge']({},_0x3d9787,_0xdd6045[_0xa587('0x4a')]);var _0x26ca4d={'where':_0x3d9787['where']};return db[_0xa587('0x38')][_0xa587('0x2a')](_0x26ca4d)[_0xa587('0x1d')](function(_0xb0847d){_0xf34573[_0xa587('0x2a')]=_0xb0847d;if(_0xdd6045[_0xa587('0x3d')][_0xa587('0x4b')]){_0x3d9787[_0xa587('0x4c')]=[{'all':!![]}];}return db[_0xa587('0x38')][_0xa587('0x4d')](_0x3d9787);})['then'](function(_0x20189f){_0xf34573[_0xa587('0x4e')]=_0x20189f;return _0xf34573;})[_0xa587('0x1d')](respondWithFilteredResult(_0x32fc0d,_0x3d9787))[_0xa587('0x27')](handleError(_0x32fc0d,null));};exports[_0xa587('0x4f')]=function(_0xdbe5a1,_0x451f33){var _0x1e1b18={'raw':![],'where':{'id':_0xdbe5a1[_0xa587('0x50')]['id']}},_0x4d1648={};_0x4d1648[_0xa587('0x3c')]=_[_0xa587('0x3e')](db['VtigerConfiguration'][_0xa587('0x39')]);_0x4d1648['query']=_[_0xa587('0x3e')](_0xdbe5a1[_0xa587('0x3d')]);_0x4d1648[_0xa587('0x46')]=_[_0xa587('0x40')](_0x4d1648['model'],_0x4d1648[_0xa587('0x3d')]);_0x1e1b18[_0xa587('0x3f')]=_['intersection'](_0x4d1648[_0xa587('0x3c')],qs[_0xa587('0x41')](_0xdbe5a1[_0xa587('0x3d')][_0xa587('0x41')]));_0x1e1b18['attributes']=_0x1e1b18[_0xa587('0x3f')][_0xa587('0x42')]?_0x1e1b18[_0xa587('0x3f')]:_0x4d1648[_0xa587('0x3c')];if(_0xdbe5a1[_0xa587('0x3d')][_0xa587('0x4b')]){_0x1e1b18['include']=[{'all':!![]}];}_0x1e1b18=_[_0xa587('0x51')]({},_0x1e1b18,_0xdbe5a1['options']);return db['VtigerConfiguration'][_0xa587('0x52')](_0x1e1b18)['then'](handleEntityNotFound(_0x451f33,null))[_0xa587('0x1d')](respondWithResult(_0x451f33,null))[_0xa587('0x27')](handleError(_0x451f33,null));};exports['create']=function(_0x357bcd,_0x4ab22f){return db[_0xa587('0x38')][_0xa587('0x53')](_0x357bcd[_0xa587('0x54')],{})[_0xa587('0x1d')](respondWithResult(_0x4ab22f,0xc9))['catch'](handleError(_0x4ab22f,null));};exports[_0xa587('0x30')]=function(_0x51feff,_0x11a946){if(_0x51feff['body']['id']){delete _0x51feff['body']['id'];}return db[_0xa587('0x38')]['find']({'where':{'id':_0x51feff[_0xa587('0x50')]['id']}})[_0xa587('0x1d')](handleEntityNotFound(_0x11a946,null))['then'](saveUpdates(_0x51feff[_0xa587('0x54')],null))[_0xa587('0x1d')](respondWithResult(_0x11a946,null))['catch'](handleError(_0x11a946,null));};exports['destroy']=function(_0x2942ef,_0x33c088){return db[_0xa587('0x38')][_0xa587('0x52')]({'where':{'id':_0x2942ef['params']['id']}})[_0xa587('0x1d')](handleEntityNotFound(_0x33c088,null))[_0xa587('0x1d')](removeEntity(_0x33c088,null))[_0xa587('0x27')](handleError(_0x33c088,null));};exports[_0xa587('0x55')]=function(_0x28f500,_0x31f1e2,_0x3d2c97){var _0x46aaf1={};var _0x3cb200={};var _0x407245;var _0x56d274;return db['VtigerConfiguration'][_0xa587('0x56')]({'where':{'id':_0x28f500['params']['id']}})[_0xa587('0x1d')](handleEntityNotFound(_0x31f1e2,null))[_0xa587('0x1d')](function(_0x5b8ac8){if(_0x5b8ac8){_0x407245=_0x5b8ac8;_0x3cb200['model']=_['keys'](db[_0xa587('0x57')][_0xa587('0x39')]);_0x3cb200[_0xa587('0x3d')]=_[_0xa587('0x3e')](_0x28f500[_0xa587('0x3d')]);_0x3cb200['filters']=_[_0xa587('0x40')](_0x3cb200[_0xa587('0x3c')],_0x3cb200[_0xa587('0x3d')]);_0x46aaf1['attributes']=_[_0xa587('0x40')](_0x3cb200[_0xa587('0x3c')],qs[_0xa587('0x41')](_0x28f500[_0xa587('0x3d')][_0xa587('0x41')]));_0x46aaf1[_0xa587('0x3f')]=_0x46aaf1[_0xa587('0x3f')][_0xa587('0x42')]?_0x46aaf1[_0xa587('0x3f')]:_0x3cb200[_0xa587('0x3c')];_0x46aaf1[_0xa587('0x58')]=qs[_0xa587('0x45')](_0x28f500['query'][_0xa587('0x45')]);_0x46aaf1[_0xa587('0x48')]=qs[_0xa587('0x46')](_['pick'](_0x28f500[_0xa587('0x3d')],_0x3cb200[_0xa587('0x46')]));if(_0x28f500[_0xa587('0x3d')][_0xa587('0x47')]){_0x46aaf1[_0xa587('0x48')]=_['merge'](_0x46aaf1['where'],{'$or':_['map'](_0x46aaf1[_0xa587('0x3f')],function(_0x31150a){var _0x4e1313={};_0x4e1313[_0x31150a]={'$like':'%'+_0x28f500[_0xa587('0x3d')][_0xa587('0x47')]+'%'};return _0x4e1313;})});}_0x46aaf1=_[_0xa587('0x51')]({},_0x46aaf1,_0x28f500[_0xa587('0x4a')]);return _0x407245[_0xa587('0x55')](_0x46aaf1);}})['then'](function(_0x48c66d){if(_0x48c66d){_0x56d274=_0x48c66d[_0xa587('0x42')];if(!_0x28f500['query']['hasOwnProperty'](_0xa587('0x44'))){_0x46aaf1['limit']=qs[_0xa587('0x2c')](_0x28f500[_0xa587('0x3d')][_0xa587('0x2c')]);_0x46aaf1['offset']=qs[_0xa587('0x2b')](_0x28f500['query'][_0xa587('0x2b')]);}return _0x407245[_0xa587('0x55')](_0x46aaf1);}})[_0xa587('0x1d')](function(_0x1b05ba){if(_0x1b05ba){return _0x1b05ba?{'count':_0x56d274,'rows':_0x1b05ba}:null;}})[_0xa587('0x1d')](respondWithResult(_0x31f1e2,null))[_0xa587('0x27')](handleError(_0x31f1e2,null));};exports['getSubjects']=function(_0x1f2ad6,_0x4959a4,_0x44965e){var _0x15c11d={};var _0x48c35f={};var _0x10f8d9;var _0x457786;return db[_0xa587('0x38')][_0xa587('0x56')]({'where':{'id':_0x1f2ad6[_0xa587('0x50')]['id']}})[_0xa587('0x1d')](handleEntityNotFound(_0x4959a4,null))[_0xa587('0x1d')](function(_0x196807){if(_0x196807){_0x10f8d9=_0x196807;_0x48c35f[_0xa587('0x3c')]=_[_0xa587('0x3e')](db[_0xa587('0x57')]['rawAttributes']);_0x48c35f[_0xa587('0x3d')]=_[_0xa587('0x3e')](_0x1f2ad6['query']);_0x48c35f['filters']=_[_0xa587('0x40')](_0x48c35f[_0xa587('0x3c')],_0x48c35f[_0xa587('0x3d')]);_0x15c11d['attributes']=_[_0xa587('0x40')](_0x48c35f[_0xa587('0x3c')],qs[_0xa587('0x41')](_0x1f2ad6[_0xa587('0x3d')][_0xa587('0x41')]));_0x15c11d[_0xa587('0x3f')]=_0x15c11d['attributes'][_0xa587('0x42')]?_0x15c11d[_0xa587('0x3f')]:_0x48c35f[_0xa587('0x3c')];_0x15c11d[_0xa587('0x58')]=qs[_0xa587('0x45')](_0x1f2ad6[_0xa587('0x3d')][_0xa587('0x45')]);_0x15c11d[_0xa587('0x48')]=qs['filters'](_['pick'](_0x1f2ad6[_0xa587('0x3d')],_0x48c35f[_0xa587('0x46')]));if(_0x1f2ad6[_0xa587('0x3d')][_0xa587('0x47')]){_0x15c11d['where']=_[_0xa587('0x51')](_0x15c11d['where'],{'$or':_[_0xa587('0x37')](_0x15c11d[_0xa587('0x3f')],function(_0x3abd7b){var _0x3add0a={};_0x3add0a[_0x3abd7b]={'$like':'%'+_0x1f2ad6[_0xa587('0x3d')][_0xa587('0x47')]+'%'};return _0x3add0a;})});}_0x15c11d=_[_0xa587('0x51')]({},_0x15c11d,_0x1f2ad6[_0xa587('0x4a')]);return _0x10f8d9[_0xa587('0x59')](_0x15c11d);}})[_0xa587('0x1d')](function(_0x41aa10){if(_0x41aa10){_0x457786=_0x41aa10[_0xa587('0x42')];if(!_0x1f2ad6['query'][_0xa587('0x43')](_0xa587('0x44'))){_0x15c11d[_0xa587('0x2c')]=qs[_0xa587('0x2c')](_0x1f2ad6[_0xa587('0x3d')][_0xa587('0x2c')]);_0x15c11d[_0xa587('0x2b')]=qs[_0xa587('0x2b')](_0x1f2ad6[_0xa587('0x3d')][_0xa587('0x2b')]);}return _0x10f8d9[_0xa587('0x59')](_0x15c11d);}})[_0xa587('0x1d')](function(_0x242fa7){if(_0x242fa7){return _0x242fa7?{'count':_0x457786,'rows':_0x242fa7}:null;}})[_0xa587('0x1d')](respondWithResult(_0x4959a4,null))[_0xa587('0x27')](handleError(_0x4959a4,null));};exports[_0xa587('0x5a')]=function(_0x399193,_0x315669,_0x426237){var _0x5b07a1={};var _0x465cb6={};var _0xddff1f;var _0x10bba5;return db[_0xa587('0x38')]['findOne']({'where':{'id':_0x399193['params']['id']}})[_0xa587('0x1d')](handleEntityNotFound(_0x315669,null))['then'](function(_0x13f918){if(_0x13f918){_0xddff1f=_0x13f918;_0x465cb6[_0xa587('0x3c')]=_[_0xa587('0x3e')](db['VtigerField'][_0xa587('0x39')]);_0x465cb6['query']=_[_0xa587('0x3e')](_0x399193[_0xa587('0x3d')]);_0x465cb6[_0xa587('0x46')]=_[_0xa587('0x40')](_0x465cb6[_0xa587('0x3c')],_0x465cb6[_0xa587('0x3d')]);_0x5b07a1[_0xa587('0x3f')]=_[_0xa587('0x40')](_0x465cb6[_0xa587('0x3c')],qs[_0xa587('0x41')](_0x399193[_0xa587('0x3d')]['fields']));_0x5b07a1[_0xa587('0x3f')]=_0x5b07a1[_0xa587('0x3f')][_0xa587('0x42')]?_0x5b07a1[_0xa587('0x3f')]:_0x465cb6[_0xa587('0x3c')];_0x5b07a1[_0xa587('0x58')]=qs[_0xa587('0x45')](_0x399193[_0xa587('0x3d')][_0xa587('0x45')]);_0x5b07a1[_0xa587('0x48')]=qs[_0xa587('0x46')](_[_0xa587('0x5b')](_0x399193[_0xa587('0x3d')],_0x465cb6[_0xa587('0x46')]));if(_0x399193[_0xa587('0x3d')]['filter']){_0x5b07a1[_0xa587('0x48')]=_['merge'](_0x5b07a1[_0xa587('0x48')],{'$or':_[_0xa587('0x37')](_0x5b07a1[_0xa587('0x3f')],function(_0x4c2cc6){var _0x43daa3={};_0x43daa3[_0x4c2cc6]={'$like':'%'+_0x399193[_0xa587('0x3d')][_0xa587('0x47')]+'%'};return _0x43daa3;})});}_0x5b07a1=_[_0xa587('0x51')]({},_0x5b07a1,_0x399193[_0xa587('0x4a')]);return _0xddff1f[_0xa587('0x5a')](_0x5b07a1);}})[_0xa587('0x1d')](function(_0xc00c8f){if(_0xc00c8f){_0x10bba5=_0xc00c8f[_0xa587('0x42')];if(!_0x399193[_0xa587('0x3d')][_0xa587('0x43')]('nolimit')){_0x5b07a1[_0xa587('0x2c')]=qs['limit'](_0x399193[_0xa587('0x3d')][_0xa587('0x2c')]);_0x5b07a1[_0xa587('0x2b')]=qs[_0xa587('0x2b')](_0x399193[_0xa587('0x3d')]['offset']);}return _0xddff1f[_0xa587('0x5a')](_0x5b07a1);}})['then'](function(_0x124f28){if(_0x124f28){return _0x124f28?{'count':_0x10bba5,'rows':_0x124f28}:null;}})[_0xa587('0x1d')](respondWithResult(_0x315669,null))[_0xa587('0x27')](handleError(_0x315669,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 76be927..371220f 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 _0x74b8=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','moment','path','rimraf','./intVtigerConfiguration.attributes'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x74b8,0x1c6));var _0x874b=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x74b8[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x874b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x874b('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x874b('0x2'));var rimraf=require(_0x874b('0x3'));var config=require('../../config/environment');var attributes=require(_0x874b('0x4'));module[_0x874b('0x5')]=function(_0x14c55c,_0x5c1d3b){return _0x14c55c[_0x874b('0x6')](_0x874b('0x7'),attributes,{'tableName':_0x874b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1a9=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xa1a9,0x142));var _0x9a1a=function(_0xfcbd0a,_0x24cd30){_0xfcbd0a=_0xfcbd0a-0x0;var _0x3a06a5=_0xa1a9[_0xfcbd0a];return _0x3a06a5;};'use strict';var _=require(_0x9a1a('0x0'));var util=require(_0x9a1a('0x1'));var logger=require(_0x9a1a('0x2'))('api');var moment=require(_0x9a1a('0x3'));var BPromise=require(_0x9a1a('0x4'));var rp=require(_0x9a1a('0x5'));var fs=require('fs');var path=require(_0x9a1a('0x6'));var rimraf=require('rimraf');var config=require(_0x9a1a('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x9a1a('0x8')]=function(_0x562e11,_0x47bb08){return _0x562e11[_0x9a1a('0x9')](_0x9a1a('0xa'),attributes,{'tableName':_0x9a1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index b1465c2..ad60a53 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 _0x8417=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x32eb64,_0x57cbf4){var _0x279b61=function(_0x22f5fc){while(--_0x22f5fc){_0x32eb64['push'](_0x32eb64['shift']());}};_0x279b61(++_0x57cbf4);}(_0x8417,0x12f));var _0x7841=function(_0x8583bb,_0x3cc7ae){_0x8583bb=_0x8583bb-0x0;var _0x361369=_0x8417[_0x8583bb];return _0x361369;};'use strict';var _=require(_0x7841('0x0'));var util=require(_0x7841('0x1'));var moment=require(_0x7841('0x2'));var BPromise=require(_0x7841('0x3'));var rs=require(_0x7841('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7841('0x5'));var logger=require(_0x7841('0x6'))('rpc');var config=require(_0x7841('0x7'));var jayson=require(_0x7841('0x8'));var client=jayson[_0x7841('0x9')][_0x7841('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x487b3f,_0x954c3d,_0x3b25d7){return new BPromise(function(_0x3e4289,_0x485098){return client[_0x7841('0xb')](_0x487b3f,_0x3b25d7)['then'](function(_0x267f3e){logger['info'](_0x7841('0xc'),_0x954c3d,_0x7841('0xd'));logger[_0x7841('0xe')](_0x7841('0xf'),_0x954c3d,_0x7841('0xd'),JSON['stringify'](_0x267f3e));if(_0x267f3e[_0x7841('0x10')]){if(_0x267f3e[_0x7841('0x10')][_0x7841('0x11')]===0x1f4){logger[_0x7841('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x954c3d,_0x267f3e[_0x7841('0x10')][_0x7841('0x12')]);return _0x485098(_0x267f3e[_0x7841('0x10')][_0x7841('0x12')]);}logger[_0x7841('0x10')](_0x7841('0xc'),_0x954c3d,_0x267f3e[_0x7841('0x10')]['message']);return _0x3e4289(_0x267f3e[_0x7841('0x10')][_0x7841('0x12')]);}else{logger[_0x7841('0x13')](_0x7841('0xc'),_0x954c3d,'request\x20sent');_0x3e4289(_0x267f3e['result'][_0x7841('0x12')]);}})[_0x7841('0x14')](function(_0x3b32ce){logger[_0x7841('0x10')](_0x7841('0xc'),_0x954c3d,_0x3b32ce);_0x485098(_0x3b32ce);});});} \ No newline at end of file +var _0xfb9b=['client','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xa59083,_0x246ac5){var _0x4e52f0=function(_0x8b13c3){while(--_0x8b13c3){_0xa59083['push'](_0xa59083['shift']());}};_0x4e52f0(++_0x246ac5);}(_0xfb9b,0x10d));var _0xbfb9=function(_0x562848,_0x41dff3){_0x562848=_0x562848-0x0;var _0x47391a=_0xfb9b[_0x562848];return _0x47391a;};'use strict';var _=require(_0xbfb9('0x0'));var util=require(_0xbfb9('0x1'));var moment=require(_0xbfb9('0x2'));var BPromise=require('bluebird');var rs=require(_0xbfb9('0x3'));var fs=require('fs');var Redis=require(_0xbfb9('0x4'));var db=require(_0xbfb9('0x5'))['db'];var utils=require(_0xbfb9('0x6'));var logger=require(_0xbfb9('0x7'))(_0xbfb9('0x8'));var config=require(_0xbfb9('0x9'));var jayson=require(_0xbfb9('0xa'));var client=jayson[_0xbfb9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x227b6a,_0x162c51,_0x460d6f){return new BPromise(function(_0x19e51c,_0x810b4c){return client[_0xbfb9('0xc')](_0x227b6a,_0x460d6f)['then'](function(_0x2eacf1){logger['info'](_0xbfb9('0xd'),_0x162c51,_0xbfb9('0xe'));logger['debug'](_0xbfb9('0xf'),_0x162c51,_0xbfb9('0xe'),JSON['stringify'](_0x2eacf1));if(_0x2eacf1[_0xbfb9('0x10')]){if(_0x2eacf1[_0xbfb9('0x10')]['code']===0x1f4){logger['error'](_0xbfb9('0xd'),_0x162c51,_0x2eacf1['error'][_0xbfb9('0x11')]);return _0x810b4c(_0x2eacf1['error'][_0xbfb9('0x11')]);}logger[_0xbfb9('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x162c51,_0x2eacf1[_0xbfb9('0x10')][_0xbfb9('0x11')]);return _0x19e51c(_0x2eacf1[_0xbfb9('0x10')][_0xbfb9('0x11')]);}else{logger[_0xbfb9('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x162c51,'request\x20sent');_0x19e51c(_0x2eacf1['result'][_0xbfb9('0x11')]);}})[_0xbfb9('0x13')](function(_0x3e545e){logger[_0xbfb9('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x162c51,_0x3e545e);_0x810b4c(_0x3e545e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 8bc554a..19725e9 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 _0x7063=['isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7063,0x1d3));var _0x3706=function(_0x4d0adc,_0x38b2ca){_0x4d0adc=_0x4d0adc-0x0;var _0x5a0222=_0x7063[_0x4d0adc];return _0x5a0222;};'use strict';var multer=require(_0x3706('0x0'));var util=require(_0x3706('0x1'));var path=require(_0x3706('0x2'));var timeout=require(_0x3706('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3706('0x4'));var config=require(_0x3706('0x5'));var controller=require(_0x3706('0x6'));router[_0x3706('0x7')]('/',auth[_0x3706('0x8')](),controller[_0x3706('0x9')]);router[_0x3706('0x7')]('/:id',auth[_0x3706('0x8')](),controller[_0x3706('0xa')]);router[_0x3706('0xb')]('/',auth[_0x3706('0x8')](),controller[_0x3706('0xc')]);router[_0x3706('0xd')](_0x3706('0xe'),auth[_0x3706('0x8')](),controller[_0x3706('0xf')]);router[_0x3706('0x10')](_0x3706('0xe'),auth[_0x3706('0x8')](),controller[_0x3706('0x11')]);module[_0x3706('0x12')]=router; \ No newline at end of file +var _0xc3bf=['post','create','put','delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','show'];(function(_0x308ecc,_0x462554){var _0x361bcb=function(_0x1f799b){while(--_0x1f799b){_0x308ecc['push'](_0x308ecc['shift']());}};_0x361bcb(++_0x462554);}(_0xc3bf,0x145));var _0xfc3b=function(_0x28386a,_0x523e52){_0x28386a=_0x28386a-0x0;var _0x1f3ff9=_0xc3bf[_0x28386a];return _0x1f3ff9;};'use strict';var multer=require(_0xfc3b('0x0'));var util=require('util');var path=require(_0xfc3b('0x1'));var timeout=require('connect-timeout');var express=require(_0xfc3b('0x2'));var router=express['Router']();var auth=require(_0xfc3b('0x3'));var interaction=require(_0xfc3b('0x4'));var config=require(_0xfc3b('0x5'));var controller=require(_0xfc3b('0x6'));router[_0xfc3b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfc3b('0x7')](_0xfc3b('0x8'),auth[_0xfc3b('0x9')](),controller[_0xfc3b('0xa')]);router[_0xfc3b('0xb')]('/',auth[_0xfc3b('0x9')](),controller[_0xfc3b('0xc')]);router[_0xfc3b('0xd')](_0xfc3b('0x8'),auth[_0xfc3b('0x9')](),controller['update']);router[_0xfc3b('0xe')](_0xfc3b('0x8'),auth['isAuthenticated'](),controller[_0xfc3b('0xf')]);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 cf3168a..4c0ff24 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 _0x34e8=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x18dc32,_0x26d38e){var _0x2adfaf=function(_0x59f994){while(--_0x59f994){_0x18dc32['push'](_0x18dc32['shift']());}};_0x2adfaf(++_0x26d38e);}(_0x34e8,0x12c));var _0x834e=function(_0x4c93c5,_0x1320e0){_0x4c93c5=_0x4c93c5-0x0;var _0x25efb9=_0x34e8[_0x4c93c5];return _0x25efb9;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'type':{'type':Sequelize[_0x834e('0x2')](_0x834e('0x3'),'variable',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'defaultValue':_0x834e('0x3')},'content':{'type':Sequelize[_0x834e('0x7')]},'key':{'type':Sequelize[_0x834e('0x7')]},'keyType':{'type':Sequelize[_0x834e('0x2')]('string',_0x834e('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x834e('0x7')]},'idField':{'type':Sequelize[_0x834e('0x7')]},'nameField':{'type':Sequelize[_0x834e('0x7')]},'customField':{'type':Sequelize[_0x834e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x834e('0x7')]}}; \ No newline at end of file +var _0xd3d1=['sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN'];(function(_0x488b85,_0x10ec23){var _0x59d07d=function(_0x16838b){while(--_0x16838b){_0x488b85['push'](_0x488b85['shift']());}};_0x59d07d(++_0x10ec23);}(_0xd3d1,0x172));var _0x1d3d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3d1[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x1d3d('0x0'));module[_0x1d3d('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x1d3d('0x2'),_0x1d3d('0x3'),_0x1d3d('0x4'),_0x1d3d('0x5')),'defaultValue':_0x1d3d('0x6')},'content':{'type':Sequelize[_0x1d3d('0x7')]},'key':{'type':Sequelize[_0x1d3d('0x7')]},'keyType':{'type':Sequelize[_0x1d3d('0x8')](_0x1d3d('0x6'),_0x1d3d('0x2'),_0x1d3d('0x3'))},'keyContent':{'type':Sequelize[_0x1d3d('0x7')]},'idField':{'type':Sequelize[_0x1d3d('0x7')]},'nameField':{'type':Sequelize[_0x1d3d('0x7')]},'customField':{'type':Sequelize[_0x1d3d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d3d('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5298ac9..4d86260 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 _0x06ae=['query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','limit','set','apply','reject','update','then','destroy','sendStatus','error','name','send','map','VtigerField','rawAttributes','fieldName','type','key','model'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe06a('0x0'));var rimraf=require(_0xe06a('0x1'));var zipdir=require(_0xe06a('0x2'));var jsonpatch=require(_0xe06a('0x3'));var rp=require(_0xe06a('0x4'));var moment=require(_0xe06a('0x5'));var BPromise=require(_0xe06a('0x6'));var Mustache=require(_0xe06a('0x7'));var util=require(_0xe06a('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe06a('0x9'));var fs=require('fs');var _=require(_0xe06a('0xa'));var squel=require(_0xe06a('0xb'));var crypto=require(_0xe06a('0xc'));var jsforce=require(_0xe06a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe06a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe06a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe06a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe06a('0x11'))(_0xe06a('0x12'));var utils=require('../../config/utils');var config=require(_0xe06a('0x13'));var licenseUtil=require(_0xe06a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb402c7,_0x87ff63){_0x87ff63=_0x87ff63||0xcc;return function(_0x3aaf53){if(_0x3aaf53){return _0xb402c7['sendStatus'](_0x87ff63);}return _0xb402c7[_0xe06a('0x15')](_0x87ff63)[_0xe06a('0x16')]();};}function respondWithResult(_0x359273,_0xf8a9a7){_0xf8a9a7=_0xf8a9a7||0xc8;return function(_0x335c0d){if(_0x335c0d){return _0x359273['status'](_0xf8a9a7)[_0xe06a('0x17')](_0x335c0d);}};}function respondWithFilteredResult(_0x1080da,_0x171b77){return function(_0xe471a9){if(_0xe471a9){var _0x4d0e41=_0xe471a9['count'],_0x403a92=_0x171b77['offset'],_0x57b590=_0x171b77['offset']+_0x171b77[_0xe06a('0x18')],_0xa9b1af;if(_0x57b590>=_0x4d0e41){_0x57b590=_0x4d0e41;_0xa9b1af=0xc8;}else{_0xa9b1af=0xce;}_0x1080da[_0xe06a('0x15')](_0xa9b1af);return _0x1080da[_0xe06a('0x19')]('Content-Range',_0x403a92+'-'+_0x57b590+'/'+_0x4d0e41)[_0xe06a('0x17')](_0xe471a9);}return null;};}function patchUpdates(_0x6483d4){return function(_0x5806b6){try{jsonpatch[_0xe06a('0x1a')](_0x5806b6,_0x6483d4,!![]);}catch(_0x5382a6){return BPromise[_0xe06a('0x1b')](_0x5382a6);}return _0x5806b6['save']();};}function saveUpdates(_0x550ff8,_0x70d702){return function(_0x99dcd5){if(_0x99dcd5){return _0x99dcd5[_0xe06a('0x1c')](_0x550ff8)[_0xe06a('0x1d')](function(_0xf8921e){return _0xf8921e;});}return null;};}function removeEntity(_0xd2adcd,_0x2ab25f){return function(_0x2c30c7){if(_0x2c30c7){return _0x2c30c7[_0xe06a('0x1e')]()[_0xe06a('0x1d')](function(){_0xd2adcd['status'](0xcc)[_0xe06a('0x16')]();});}};}function handleEntityNotFound(_0x31c2cb,_0xf13325){return function(_0x82ba72){if(!_0x82ba72){_0x31c2cb[_0xe06a('0x1f')](0x194);}return _0x82ba72;};}function handleError(_0x2c96bd,_0x3f468e){_0x3f468e=_0x3f468e||0x1f4;return function(_0x19a7e0){logger[_0xe06a('0x20')](_0x19a7e0['stack']);if(_0x19a7e0['name']){delete _0x19a7e0[_0xe06a('0x21')];}_0x2c96bd['status'](_0x3f468e)[_0xe06a('0x22')](_0x19a7e0);};}exports['index']=function(_0x4afa75,_0x5e0b56){var _0x37ff49={},_0x4316bb={},_0x58525a={'count':0x0,'rows':[]};var _0x217f24=_[_0xe06a('0x23')](db[_0xe06a('0x24')][_0xe06a('0x25')],function(_0x15cf61){return{'name':_0x15cf61[_0xe06a('0x26')],'type':_0x15cf61[_0xe06a('0x27')][_0xe06a('0x28')]};});_0x4316bb[_0xe06a('0x29')]=_['map'](_0x217f24,'name');_0x4316bb[_0xe06a('0x2a')]=_[_0xe06a('0x2b')](_0x4afa75[_0xe06a('0x2a')]);_0x4316bb[_0xe06a('0x2c')]=_['intersection'](_0x4316bb[_0xe06a('0x29')],_0x4316bb['query']);_0x37ff49[_0xe06a('0x2d')]=_[_0xe06a('0x2e')](_0x4316bb[_0xe06a('0x29')],qs[_0xe06a('0x2f')](_0x4afa75['query'][_0xe06a('0x2f')]));_0x37ff49[_0xe06a('0x2d')]=_0x37ff49[_0xe06a('0x2d')][_0xe06a('0x30')]?_0x37ff49['attributes']:_0x4316bb['model'];if(!_0x4afa75[_0xe06a('0x2a')][_0xe06a('0x31')](_0xe06a('0x32'))){_0x37ff49[_0xe06a('0x18')]=qs[_0xe06a('0x18')](_0x4afa75[_0xe06a('0x2a')]['limit']);_0x37ff49['offset']=qs[_0xe06a('0x33')](_0x4afa75['query'][_0xe06a('0x33')]);}_0x37ff49['order']=qs[_0xe06a('0x34')](_0x4afa75[_0xe06a('0x2a')][_0xe06a('0x34')]);_0x37ff49['where']=qs['filters'](_[_0xe06a('0x35')](_0x4afa75[_0xe06a('0x2a')],_0x4316bb[_0xe06a('0x2c')]),_0x217f24);if(_0x4afa75[_0xe06a('0x2a')][_0xe06a('0x36')]){_0x37ff49[_0xe06a('0x37')]=_['merge'](_0x37ff49['where'],{'$or':_['map'](_0x217f24,function(_0x598caf){if(_0x598caf[_0xe06a('0x27')]!==_0xe06a('0x38')){var _0x33499a={};_0x33499a[_0x598caf[_0xe06a('0x21')]]={'$like':'%'+_0x4afa75[_0xe06a('0x2a')]['filter']+'%'};return _0x33499a;}})});}_0x37ff49=_[_0xe06a('0x39')]({},_0x37ff49,_0x4afa75[_0xe06a('0x3a')]);var _0x9c0671={'where':_0x37ff49['where']};return db[_0xe06a('0x24')][_0xe06a('0x3b')](_0x9c0671)[_0xe06a('0x1d')](function(_0x27f6cb){_0x58525a[_0xe06a('0x3b')]=_0x27f6cb;if(_0x4afa75[_0xe06a('0x2a')][_0xe06a('0x3c')]){_0x37ff49[_0xe06a('0x3d')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x37ff49);})[_0xe06a('0x1d')](function(_0x5730f7){_0x58525a['rows']=_0x5730f7;return _0x58525a;})[_0xe06a('0x1d')](respondWithFilteredResult(_0x5e0b56,_0x37ff49))[_0xe06a('0x3e')](handleError(_0x5e0b56,null));};exports[_0xe06a('0x3f')]=function(_0x54da2b,_0x57c990){var _0x13ac63={'raw':!![],'where':{'id':_0x54da2b[_0xe06a('0x40')]['id']}},_0x353349={};_0x353349[_0xe06a('0x29')]=_['keys'](db[_0xe06a('0x24')]['rawAttributes']);_0x353349[_0xe06a('0x2a')]=_[_0xe06a('0x2b')](_0x54da2b['query']);_0x353349[_0xe06a('0x2c')]=_[_0xe06a('0x2e')](_0x353349['model'],_0x353349['query']);_0x13ac63['attributes']=_['intersection'](_0x353349[_0xe06a('0x29')],qs['fields'](_0x54da2b['query']['fields']));_0x13ac63['attributes']=_0x13ac63[_0xe06a('0x2d')][_0xe06a('0x30')]?_0x13ac63[_0xe06a('0x2d')]:_0x353349[_0xe06a('0x29')];if(_0x54da2b[_0xe06a('0x2a')][_0xe06a('0x3c')]){_0x13ac63['include']=[{'all':!![]}];}_0x13ac63=_[_0xe06a('0x39')]({},_0x13ac63,_0x54da2b[_0xe06a('0x3a')]);return db[_0xe06a('0x24')][_0xe06a('0x41')](_0x13ac63)[_0xe06a('0x1d')](handleEntityNotFound(_0x57c990,null))['then'](respondWithResult(_0x57c990,null))['catch'](handleError(_0x57c990,null));};exports[_0xe06a('0x42')]=function(_0x1030ba,_0x459faf){return db[_0xe06a('0x24')]['create'](_0x1030ba[_0xe06a('0x43')],{})[_0xe06a('0x1d')](respondWithResult(_0x459faf,0xc9))[_0xe06a('0x3e')](handleError(_0x459faf,null));};exports['update']=function(_0x590271,_0x5c533b){if(_0x590271[_0xe06a('0x43')]['id']){delete _0x590271[_0xe06a('0x43')]['id'];}return db[_0xe06a('0x24')][_0xe06a('0x41')]({'where':{'id':_0x590271['params']['id']}})[_0xe06a('0x1d')](handleEntityNotFound(_0x5c533b,null))[_0xe06a('0x1d')](saveUpdates(_0x590271[_0xe06a('0x43')],null))[_0xe06a('0x1d')](respondWithResult(_0x5c533b,null))[_0xe06a('0x3e')](handleError(_0x5c533b,null));};exports['destroy']=function(_0xa37eaa,_0x19ff97){return db[_0xe06a('0x24')][_0xe06a('0x41')]({'where':{'id':_0xa37eaa['params']['id']}})['then'](handleEntityNotFound(_0x19ff97,null))[_0xe06a('0x1d')](removeEntity(_0x19ff97,null))[_0xe06a('0x3e')](handleError(_0x19ff97,null));}; \ No newline at end of file +var _0x444e=['stack','name','send','index','map','VtigerField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','Content-Range','reject','save','update','then','destroy','sendStatus'];(function(_0x3c16b7,_0x8b65cf){var _0x4daed3=function(_0x51004f){while(--_0x51004f){_0x3c16b7['push'](_0x3c16b7['shift']());}};_0x4daed3(++_0x8b65cf);}(_0x444e,0xe8));var _0xe444=function(_0x3f557c,_0x3de1e1){_0x3f557c=_0x3f557c-0x0;var _0x16a71a=_0x444e[_0x3f557c];return _0x16a71a;};'use strict';var pdf=require(_0xe444('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe444('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe444('0x2'));var rp=require('request-promise');var moment=require(_0xe444('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe444('0x4'));var util=require(_0xe444('0x5'));var path=require(_0xe444('0x6'));var sox=require(_0xe444('0x7'));var csv=require(_0xe444('0x8'));var ejs=require(_0xe444('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe444('0xa'));var crypto=require('crypto');var jsforce=require(_0xe444('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe444('0x8'));var querystring=require(_0xe444('0xc'));var Papa=require(_0xe444('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe444('0xe'));var as=require(_0xe444('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe444('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xe444('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xe444('0x12'))['db'];function respondWithStatusCode(_0x2f9d12,_0x59792f){_0x59792f=_0x59792f||0xcc;return function(_0x28c3e4){if(_0x28c3e4){return _0x2f9d12['sendStatus'](_0x59792f);}return _0x2f9d12['status'](_0x59792f)[_0xe444('0x13')]();};}function respondWithResult(_0x3e3b9f,_0x5eb55c){_0x5eb55c=_0x5eb55c||0xc8;return function(_0x192c1a){if(_0x192c1a){return _0x3e3b9f['status'](_0x5eb55c)[_0xe444('0x14')](_0x192c1a);}};}function respondWithFilteredResult(_0x3acd97,_0x18f7cf){return function(_0x3af415){if(_0x3af415){var _0x363716=_0x3af415[_0xe444('0x15')],_0x2d44af=_0x18f7cf[_0xe444('0x16')],_0x16ab23=_0x18f7cf[_0xe444('0x16')]+_0x18f7cf[_0xe444('0x17')],_0x3e1b57;if(_0x16ab23>=_0x363716){_0x16ab23=_0x363716;_0x3e1b57=0xc8;}else{_0x3e1b57=0xce;}_0x3acd97[_0xe444('0x18')](_0x3e1b57);return _0x3acd97['set'](_0xe444('0x19'),_0x2d44af+'-'+_0x16ab23+'/'+_0x363716)[_0xe444('0x14')](_0x3af415);}return null;};}function patchUpdates(_0x12eb54){return function(_0x2f6a4a){try{jsonpatch['apply'](_0x2f6a4a,_0x12eb54,!![]);}catch(_0x306e05){return BPromise[_0xe444('0x1a')](_0x306e05);}return _0x2f6a4a[_0xe444('0x1b')]();};}function saveUpdates(_0xf213c0,_0x37c15e){return function(_0x582bad){if(_0x582bad){return _0x582bad[_0xe444('0x1c')](_0xf213c0)[_0xe444('0x1d')](function(_0x529336){return _0x529336;});}return null;};}function removeEntity(_0x2b52a6,_0x5ef1a4){return function(_0x13108c){if(_0x13108c){return _0x13108c[_0xe444('0x1e')]()[_0xe444('0x1d')](function(){_0x2b52a6[_0xe444('0x18')](0xcc)[_0xe444('0x13')]();});}};}function handleEntityNotFound(_0x481762,_0x527bf5){return function(_0x251efb){if(!_0x251efb){_0x481762[_0xe444('0x1f')](0x194);}return _0x251efb;};}function handleError(_0x1ac266,_0x1ff6d2){_0x1ff6d2=_0x1ff6d2||0x1f4;return function(_0x2a03a2){logger['error'](_0x2a03a2[_0xe444('0x20')]);if(_0x2a03a2[_0xe444('0x21')]){delete _0x2a03a2['name'];}_0x1ac266[_0xe444('0x18')](_0x1ff6d2)[_0xe444('0x22')](_0x2a03a2);};}exports[_0xe444('0x23')]=function(_0x26ca6f,_0x2619cf){var _0x23072c={},_0x16915c={},_0x5d29ba={'count':0x0,'rows':[]};var _0x3015c7=_[_0xe444('0x24')](db[_0xe444('0x25')][_0xe444('0x26')],function(_0x5bc063){return{'name':_0x5bc063['fieldName'],'type':_0x5bc063[_0xe444('0x27')][_0xe444('0x28')]};});_0x16915c[_0xe444('0x29')]=_[_0xe444('0x24')](_0x3015c7,'name');_0x16915c[_0xe444('0x2a')]=_[_0xe444('0x2b')](_0x26ca6f[_0xe444('0x2a')]);_0x16915c[_0xe444('0x2c')]=_['intersection'](_0x16915c['model'],_0x16915c['query']);_0x23072c[_0xe444('0x2d')]=_[_0xe444('0x2e')](_0x16915c[_0xe444('0x29')],qs[_0xe444('0x2f')](_0x26ca6f[_0xe444('0x2a')]['fields']));_0x23072c[_0xe444('0x2d')]=_0x23072c[_0xe444('0x2d')][_0xe444('0x30')]?_0x23072c['attributes']:_0x16915c[_0xe444('0x29')];if(!_0x26ca6f['query']['hasOwnProperty'](_0xe444('0x31'))){_0x23072c[_0xe444('0x17')]=qs['limit'](_0x26ca6f[_0xe444('0x2a')]['limit']);_0x23072c[_0xe444('0x16')]=qs['offset'](_0x26ca6f['query'][_0xe444('0x16')]);}_0x23072c['order']=qs[_0xe444('0x32')](_0x26ca6f[_0xe444('0x2a')][_0xe444('0x32')]);_0x23072c[_0xe444('0x33')]=qs['filters'](_[_0xe444('0x34')](_0x26ca6f[_0xe444('0x2a')],_0x16915c[_0xe444('0x2c')]),_0x3015c7);if(_0x26ca6f['query'][_0xe444('0x35')]){_0x23072c['where']=_[_0xe444('0x36')](_0x23072c[_0xe444('0x33')],{'$or':_[_0xe444('0x24')](_0x3015c7,function(_0x4dc4c9){if(_0x4dc4c9['type']!==_0xe444('0x37')){var _0x246da5={};_0x246da5[_0x4dc4c9[_0xe444('0x21')]]={'$like':'%'+_0x26ca6f[_0xe444('0x2a')][_0xe444('0x35')]+'%'};return _0x246da5;}})});}_0x23072c=_[_0xe444('0x36')]({},_0x23072c,_0x26ca6f[_0xe444('0x38')]);var _0x5c2ddf={'where':_0x23072c['where']};return db[_0xe444('0x25')]['count'](_0x5c2ddf)[_0xe444('0x1d')](function(_0x5cfdaa){_0x5d29ba[_0xe444('0x15')]=_0x5cfdaa;if(_0x26ca6f[_0xe444('0x2a')][_0xe444('0x39')]){_0x23072c[_0xe444('0x3a')]=[{'all':!![]}];}return db[_0xe444('0x25')][_0xe444('0x3b')](_0x23072c);})['then'](function(_0x1216c4){_0x5d29ba[_0xe444('0x3c')]=_0x1216c4;return _0x5d29ba;})[_0xe444('0x1d')](respondWithFilteredResult(_0x2619cf,_0x23072c))[_0xe444('0x3d')](handleError(_0x2619cf,null));};exports['show']=function(_0x442467,_0x19283c){var _0x2370cd={'raw':!![],'where':{'id':_0x442467[_0xe444('0x3e')]['id']}},_0x34d3e8={};_0x34d3e8[_0xe444('0x29')]=_[_0xe444('0x2b')](db[_0xe444('0x25')][_0xe444('0x26')]);_0x34d3e8['query']=_['keys'](_0x442467['query']);_0x34d3e8[_0xe444('0x2c')]=_[_0xe444('0x2e')](_0x34d3e8[_0xe444('0x29')],_0x34d3e8[_0xe444('0x2a')]);_0x2370cd[_0xe444('0x2d')]=_['intersection'](_0x34d3e8['model'],qs[_0xe444('0x2f')](_0x442467[_0xe444('0x2a')][_0xe444('0x2f')]));_0x2370cd['attributes']=_0x2370cd[_0xe444('0x2d')][_0xe444('0x30')]?_0x2370cd[_0xe444('0x2d')]:_0x34d3e8[_0xe444('0x29')];if(_0x442467[_0xe444('0x2a')][_0xe444('0x39')]){_0x2370cd['include']=[{'all':!![]}];}_0x2370cd=_['merge']({},_0x2370cd,_0x442467[_0xe444('0x38')]);return db[_0xe444('0x25')][_0xe444('0x3f')](_0x2370cd)[_0xe444('0x1d')](handleEntityNotFound(_0x19283c,null))['then'](respondWithResult(_0x19283c,null))[_0xe444('0x3d')](handleError(_0x19283c,null));};exports[_0xe444('0x40')]=function(_0x3549d0,_0x394665){return db[_0xe444('0x25')][_0xe444('0x40')](_0x3549d0[_0xe444('0x41')],{})[_0xe444('0x1d')](respondWithResult(_0x394665,0xc9))['catch'](handleError(_0x394665,null));};exports[_0xe444('0x1c')]=function(_0x1c584d,_0x5afcdb){if(_0x1c584d['body']['id']){delete _0x1c584d[_0xe444('0x41')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x1c584d['params']['id']}})[_0xe444('0x1d')](handleEntityNotFound(_0x5afcdb,null))[_0xe444('0x1d')](saveUpdates(_0x1c584d['body'],null))['then'](respondWithResult(_0x5afcdb,null))[_0xe444('0x3d')](handleError(_0x5afcdb,null));};exports[_0xe444('0x1e')]=function(_0x53bde2,_0xc82495){return db[_0xe444('0x25')][_0xe444('0x3f')]({'where':{'id':_0x53bde2['params']['id']}})[_0xe444('0x1d')](handleEntityNotFound(_0xc82495,null))['then'](removeEntity(_0xc82495,null))[_0xe444('0x3d')](handleError(_0xc82495,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index e751c73..07ef6da 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 2744af8..41d4ce1 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 _0x6257=['info','request\x20sent','debug','code','message','error','VtigerField,\x20%s,\x20%s','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x420eb0,_0x1fb312){var _0x5d80a5=function(_0x224e84){while(--_0x224e84){_0x420eb0['push'](_0x420eb0['shift']());}};_0x5d80a5(++_0x1fb312);}(_0x6257,0x1d4));var _0x7625=function(_0x329509,_0x3e6bf9){_0x329509=_0x329509-0x0;var _0x4e0dcb=_0x6257[_0x329509];return _0x4e0dcb;};'use strict';var _=require(_0x7625('0x0'));var util=require('util');var moment=require(_0x7625('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7625('0x2'));var db=require(_0x7625('0x3'))['db'];var utils=require(_0x7625('0x4'));var logger=require(_0x7625('0x5'))(_0x7625('0x6'));var config=require(_0x7625('0x7'));var jayson=require(_0x7625('0x8'));var client=jayson[_0x7625('0x9')][_0x7625('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427050,_0x5cf7a8,_0x4b790d){return new BPromise(function(_0x287434,_0x1a02de){return client['request'](_0x427050,_0x4b790d)[_0x7625('0xb')](function(_0x2a2625){logger[_0x7625('0xc')]('VtigerField,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'));logger[_0x7625('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'),JSON['stringify'](_0x2a2625));if(_0x2a2625['error']){if(_0x2a2625['error'][_0x7625('0xf')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x5cf7a8,_0x2a2625['error'][_0x7625('0x10')]);return _0x1a02de(_0x2a2625[_0x7625('0x11')][_0x7625('0x10')]);}logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x2a2625[_0x7625('0x11')]['message']);return _0x287434(_0x2a2625['error'][_0x7625('0x10')]);}else{logger['info'](_0x7625('0x12'),_0x5cf7a8,_0x7625('0xd'));_0x287434(_0x2a2625[_0x7625('0x13')]['message']);}})['catch'](function(_0x43206e){logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x43206e);_0x1a02de(_0x43206e);});});} \ No newline at end of file +var _0xa321=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x1634b2,_0x24e67c){var _0x32a57b=function(_0x5470d2){while(--_0x5470d2){_0x1634b2['push'](_0x1634b2['shift']());}};_0x32a57b(++_0x24e67c);}(_0xa321,0x9d));var _0x1a32=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0xa321[_0xbb9dbf];return _0x30223c;};'use strict';var _=require(_0x1a32('0x0'));var util=require(_0x1a32('0x1'));var moment=require(_0x1a32('0x2'));var BPromise=require(_0x1a32('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a32('0x4'));var db=require(_0x1a32('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a32('0x6'))(_0x1a32('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1a32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4859d6,_0x13b4d2,_0x1fa204){return new BPromise(function(_0xdfa9fe,_0x3f4723){return client[_0x1a32('0x9')](_0x4859d6,_0x1fa204)['then'](function(_0x343faf){logger[_0x1a32('0xa')]('VtigerField,\x20%s,\x20%s',_0x13b4d2,_0x1a32('0xb'));logger[_0x1a32('0xc')](_0x1a32('0xd'),_0x13b4d2,_0x1a32('0xb'),JSON[_0x1a32('0xe')](_0x343faf));if(_0x343faf[_0x1a32('0xf')]){if(_0x343faf['error'][_0x1a32('0x10')]===0x1f4){logger[_0x1a32('0xf')](_0x1a32('0x11'),_0x13b4d2,_0x343faf['error'][_0x1a32('0x12')]);return _0x3f4723(_0x343faf[_0x1a32('0xf')][_0x1a32('0x12')]);}logger[_0x1a32('0xf')](_0x1a32('0x11'),_0x13b4d2,_0x343faf['error'][_0x1a32('0x12')]);return _0xdfa9fe(_0x343faf[_0x1a32('0xf')][_0x1a32('0x12')]);}else{logger[_0x1a32('0xa')](_0x1a32('0x11'),_0x13b4d2,_0x1a32('0xb'));_0xdfa9fe(_0x343faf['result'][_0x1a32('0x12')]);}})[_0x1a32('0x13')](function(_0x47bb8e){logger[_0x1a32('0xf')](_0x1a32('0x11'),_0x13b4d2,_0x47bb8e);_0x3f4723(_0x47bb8e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 688e205..069f6dc 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 _0x01d5=['addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','post','create'];(function(_0x3e8a15,_0x355ad8){var _0x20684a=function(_0x3020a7){while(--_0x3020a7){_0x3e8a15['push'](_0x3e8a15['shift']());}};_0x20684a(++_0x355ad8);}(_0x01d5,0x10f));var _0x501d=function(_0x231688,_0x284948){_0x231688=_0x231688-0x0;var _0xedbfb1=_0x01d5[_0x231688];return _0xedbfb1;};'use strict';var multer=require(_0x501d('0x0'));var util=require(_0x501d('0x1'));var path=require('path');var timeout=require(_0x501d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x501d('0x3'));var interaction=require(_0x501d('0x4'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x501d('0x5')](),controller[_0x501d('0x6')]);router[_0x501d('0x7')](_0x501d('0x8'),auth[_0x501d('0x5')](),controller[_0x501d('0x9')]);router[_0x501d('0x7')](_0x501d('0xa'),auth[_0x501d('0x5')](),controller[_0x501d('0xb')]);router[_0x501d('0x7')]('/:id/fields',auth[_0x501d('0x5')](),controller['getFields']);router[_0x501d('0xc')]('/',auth['isAuthenticated'](),controller[_0x501d('0xd')]);router[_0x501d('0xc')]('/:id/configurations',auth[_0x501d('0x5')](),controller[_0x501d('0xe')]);router['put'](_0x501d('0x8'),auth[_0x501d('0x5')](),controller[_0x501d('0xf')]);router[_0x501d('0x10')](_0x501d('0x8'),auth[_0x501d('0x5')](),controller[_0x501d('0x11')]);module[_0x501d('0x12')]=router; \ No newline at end of file +var _0xda1c=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x57714d,_0x4f5c05){var _0xaf2381=function(_0x8db42){while(--_0x8db42){_0x57714d['push'](_0x57714d['shift']());}};_0xaf2381(++_0x4f5c05);}(_0xda1c,0x68));var _0xcda1=function(_0x545473,_0x4c5bf9){_0x545473=_0x545473-0x0;var _0x56c683=_0xda1c[_0x545473];return _0x56c683;};'use strict';var multer=require(_0xcda1('0x0'));var util=require(_0xcda1('0x1'));var path=require(_0xcda1('0x2'));var timeout=require(_0xcda1('0x3'));var express=require(_0xcda1('0x4'));var router=express[_0xcda1('0x5')]();var auth=require(_0xcda1('0x6'));var interaction=require(_0xcda1('0x7'));var config=require(_0xcda1('0x8'));var controller=require(_0xcda1('0x9'));router[_0xcda1('0xa')]('/',auth['isAuthenticated'](),controller[_0xcda1('0xb')]);router[_0xcda1('0xa')](_0xcda1('0xc'),auth[_0xcda1('0xd')](),controller[_0xcda1('0xe')]);router[_0xcda1('0xa')]('/:id/configurations',auth[_0xcda1('0xd')](),controller[_0xcda1('0xf')]);router[_0xcda1('0xa')](_0xcda1('0x10'),auth[_0xcda1('0xd')](),controller[_0xcda1('0x11')]);router[_0xcda1('0x12')]('/',auth[_0xcda1('0xd')](),controller[_0xcda1('0x13')]);router[_0xcda1('0x12')]('/:id/configurations',auth[_0xcda1('0xd')](),controller[_0xcda1('0x14')]);router[_0xcda1('0x15')](_0xcda1('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xcda1('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xcda1('0x17')]);module[_0xcda1('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 69d1724..0e6c452 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 _0x6265=['newTab','integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x459d6d,_0x2791e2){var _0x130f7e=function(_0x5f3d8c){while(--_0x5f3d8c){_0x459d6d['push'](_0x459d6d['shift']());}};_0x130f7e(++_0x2791e2);}(_0x6265,0x64));var _0x5626=function(_0x363151,_0x38ebd5){_0x363151=_0x363151-0x0;var _0x4845f9=_0x6265[_0x363151];return _0x4845f9;};'use strict';var Sequelize=require(_0x5626('0x0'));module[_0x5626('0x1')]={'name':{'type':Sequelize[_0x5626('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x5626('0x3')},'password':{'type':Sequelize[_0x5626('0x2')]},'token':{'type':Sequelize[_0x5626('0x2')]},'remoteUri':{'type':Sequelize[_0x5626('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x5626('0x4')]('password','token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5626('0x4')]('integrationTab',_0x5626('0x5')),'defaultValue':_0x5626('0x6')}}; \ No newline at end of file +var _0x78f1=['STRING','username','remoteUri','ENUM','password','newTab','integrationTab','sequelize','exports'];(function(_0x80f51a,_0x32e95e){var _0x327148=function(_0x16f788){while(--_0x16f788){_0x80f51a['push'](_0x80f51a['shift']());}};_0x327148(++_0x32e95e);}(_0x78f1,0x6a));var _0x178f=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x78f1[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x178f('0x0'));module[_0x178f('0x1')]={'name':{'type':Sequelize[_0x178f('0x2')]},'description':{'type':Sequelize[_0x178f('0x2')]},'username':{'type':Sequelize[_0x178f('0x2')],'unique':_0x178f('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x178f('0x4')},'authType':{'type':Sequelize[_0x178f('0x5')](_0x178f('0x6'),'token'),'defaultValue':_0x178f('0x6')},'serverUrl':{'type':Sequelize[_0x178f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x178f('0x7')),'defaultValue':_0x178f('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 67c8d5d..9d4d2cb 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 _0x4fc2=['Subjects','username','password','authType','remoteUri','substring','%s/%s','ticket_fields','headers','format','Basic\x20%s','token','base64','Sequelize','ValidationError','subject','description','group','assignee','remove','includes','title','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','reject','update','destroy','stack','name','send','ZendeskAccount','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','then','show','params','rawAttributes','includeAll','find','create','body','getConfigurations','ZendeskConfiguration','length','pick','findOne','channel','Descriptions','ZendeskField'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x4fc2,0x111));var _0x24fc=function(_0x4ede09,_0x18801d){_0x4ede09=_0x4ede09-0x0;var _0x253193=_0x4fc2[_0x4ede09];return _0x253193;};'use strict';var pdf=require(_0x24fc('0x0'));var emlformat=require(_0x24fc('0x1'));var rimraf=require(_0x24fc('0x2'));var zipdir=require(_0x24fc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24fc('0x4'));var moment=require(_0x24fc('0x5'));var BPromise=require(_0x24fc('0x6'));var Mustache=require('mustache');var util=require(_0x24fc('0x7'));var path=require(_0x24fc('0x8'));var sox=require('sox');var csv=require(_0x24fc('0x9'));var ejs=require(_0x24fc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0x9'));var querystring=require(_0x24fc('0xf'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x10'));var authService=require(_0x24fc('0x11'));var qs=require(_0x24fc('0x12'));var as=require(_0x24fc('0x13'));var hardwareService=require(_0x24fc('0x14'));var logger=require(_0x24fc('0x15'))(_0x24fc('0x16'));var utils=require(_0x24fc('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x18'));var db=require(_0x24fc('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x24fc('0x1a'));var client=jayson[_0x24fc('0x1b')][_0x24fc('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3bc30b,_0x30f19b,_0x326276,_0x537b5c){return new BPromise(function(_0x2a0971,_0x18c0a7){var _0x2ffed3=_0x537b5c||client;return _0x2ffed3[_0x24fc('0x1d')](_0x3bc30b,_0x326276)['then'](function(_0x2ac989){logger['info'](_0x24fc('0x1e'),_0x30f19b,_0x24fc('0x1f'));logger[_0x24fc('0x20')](_0x24fc('0x21'),_0x30f19b,_0x24fc('0x1f'),JSON['stringify'](_0x2ac989));if(_0x2ac989[_0x24fc('0x22')]){if(_0x2ac989[_0x24fc('0x22')][_0x24fc('0x23')]===0x1f4){logger[_0x24fc('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x30f19b,_0x2ac989[_0x24fc('0x22')][_0x24fc('0x24')]);return _0x18c0a7(_0x2ac989[_0x24fc('0x22')]['message']);}logger[_0x24fc('0x22')](_0x24fc('0x1e'),_0x30f19b,_0x2ac989[_0x24fc('0x22')][_0x24fc('0x24')]);return _0x2a0971(_0x2ac989['error'][_0x24fc('0x24')]);}else{logger['info'](_0x24fc('0x1e'),_0x30f19b,'request\x20sent');_0x2a0971(_0x2ac989[_0x24fc('0x25')][_0x24fc('0x24')]);}})[_0x24fc('0x26')](function(_0x595475){logger[_0x24fc('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x30f19b,_0x595475);_0x18c0a7(_0x595475);});});}function respondWithStatusCode(_0x35a9c7,_0x2bb93a){_0x2bb93a=_0x2bb93a||0xcc;return function(_0x36a9b4){if(_0x36a9b4){return _0x35a9c7[_0x24fc('0x27')](_0x2bb93a);}return _0x35a9c7[_0x24fc('0x28')](_0x2bb93a)[_0x24fc('0x29')]();};}function respondWithResult(_0x3f0875,_0x20192b){_0x20192b=_0x20192b||0xc8;return function(_0x168d98){if(_0x168d98){return _0x3f0875[_0x24fc('0x28')](_0x20192b)['json'](_0x168d98);}};}function respondWithFilteredResult(_0x11c913,_0x16f27f){return function(_0x3ee302){if(_0x3ee302){var _0x5bb4c8=_0x3ee302[_0x24fc('0x2a')],_0xf2f77d=_0x16f27f[_0x24fc('0x2b')],_0x3d1ec8=_0x16f27f[_0x24fc('0x2b')]+_0x16f27f['limit'],_0x35f9f9;if(_0x3d1ec8>=_0x5bb4c8){_0x3d1ec8=_0x5bb4c8;_0x35f9f9=0xc8;}else{_0x35f9f9=0xce;}_0x11c913[_0x24fc('0x28')](_0x35f9f9);return _0x11c913[_0x24fc('0x2c')](_0x24fc('0x2d'),_0xf2f77d+'-'+_0x3d1ec8+'/'+_0x5bb4c8)[_0x24fc('0x2e')](_0x3ee302);}return null;};}function patchUpdates(_0x9f7bbc){return function(_0x490aa5){try{jsonpatch['apply'](_0x490aa5,_0x9f7bbc,!![]);}catch(_0x4e6f73){return BPromise[_0x24fc('0x2f')](_0x4e6f73);}return _0x490aa5['save']();};}function saveUpdates(_0x3f2464,_0x3e6389){return function(_0xae4f22){if(_0xae4f22){return _0xae4f22[_0x24fc('0x30')](_0x3f2464)['then'](function(_0x66eec0){return _0x66eec0;});}return null;};}function removeEntity(_0x33f368,_0x523c1f){return function(_0xf46cd5){if(_0xf46cd5){return _0xf46cd5[_0x24fc('0x31')]()['then'](function(){_0x33f368['status'](0xcc)[_0x24fc('0x29')]();});}};}function handleEntityNotFound(_0x56eae7,_0x3c20a7){return function(_0x98e81b){if(!_0x98e81b){_0x56eae7['sendStatus'](0x194);}return _0x98e81b;};}function handleError(_0x2ae896,_0x33bbf2){_0x33bbf2=_0x33bbf2||0x1f4;return function(_0x3b2862){logger[_0x24fc('0x22')](_0x3b2862[_0x24fc('0x32')]);if(_0x3b2862[_0x24fc('0x33')]){delete _0x3b2862[_0x24fc('0x33')];}_0x2ae896[_0x24fc('0x28')](_0x33bbf2)[_0x24fc('0x34')](_0x3b2862);};}exports['index']=function(_0x320d2e,_0x4224f4){var _0x2fbe30={},_0x316aa2={},_0x242bd5={'count':0x0,'rows':[]};var _0x5781d2=_['map'](db[_0x24fc('0x35')]['rawAttributes'],function(_0x22ef18){return{'name':_0x22ef18[_0x24fc('0x36')],'type':_0x22ef18[_0x24fc('0x37')][_0x24fc('0x38')]};});_0x316aa2['model']=_[_0x24fc('0x39')](_0x5781d2,'name');_0x316aa2[_0x24fc('0x3a')]=_[_0x24fc('0x3b')](_0x320d2e[_0x24fc('0x3a')]);_0x316aa2[_0x24fc('0x3c')]=_[_0x24fc('0x3d')](_0x316aa2['model'],_0x316aa2[_0x24fc('0x3a')]);_0x2fbe30[_0x24fc('0x3e')]=_[_0x24fc('0x3d')](_0x316aa2[_0x24fc('0x3f')],qs['fields'](_0x320d2e[_0x24fc('0x3a')][_0x24fc('0x40')]));_0x2fbe30['attributes']=_0x2fbe30[_0x24fc('0x3e')]['length']?_0x2fbe30[_0x24fc('0x3e')]:_0x316aa2[_0x24fc('0x3f')];if(!_0x320d2e[_0x24fc('0x3a')][_0x24fc('0x41')](_0x24fc('0x42'))){_0x2fbe30[_0x24fc('0x43')]=qs[_0x24fc('0x43')](_0x320d2e[_0x24fc('0x3a')]['limit']);_0x2fbe30[_0x24fc('0x2b')]=qs[_0x24fc('0x2b')](_0x320d2e[_0x24fc('0x3a')]['offset']);}_0x2fbe30[_0x24fc('0x44')]=qs[_0x24fc('0x45')](_0x320d2e['query'][_0x24fc('0x45')]);_0x2fbe30[_0x24fc('0x46')]=qs[_0x24fc('0x3c')](_['pick'](_0x320d2e[_0x24fc('0x3a')],_0x316aa2[_0x24fc('0x3c')]),_0x5781d2);if(_0x320d2e['query'][_0x24fc('0x47')]){_0x2fbe30[_0x24fc('0x46')]=_[_0x24fc('0x48')](_0x2fbe30[_0x24fc('0x46')],{'$or':_['map'](_0x5781d2,function(_0x2eecaf){if(_0x2eecaf[_0x24fc('0x37')]!==_0x24fc('0x49')){var _0x7b38fa={};_0x7b38fa[_0x2eecaf[_0x24fc('0x33')]]={'$like':'%'+_0x320d2e['query'][_0x24fc('0x47')]+'%'};return _0x7b38fa;}})});}_0x2fbe30=_[_0x24fc('0x48')]({},_0x2fbe30,_0x320d2e[_0x24fc('0x4a')]);var _0x3c6ffb={'where':_0x2fbe30['where']};return db[_0x24fc('0x35')][_0x24fc('0x2a')](_0x3c6ffb)['then'](function(_0x5bbb6c){_0x242bd5[_0x24fc('0x2a')]=_0x5bbb6c;if(_0x320d2e['query']['includeAll']){_0x2fbe30[_0x24fc('0x4b')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x24fc('0x4c')](_0x2fbe30);})[_0x24fc('0x4d')](function(_0x5052c8){_0x242bd5['rows']=_0x5052c8;return _0x242bd5;})[_0x24fc('0x4d')](respondWithFilteredResult(_0x4224f4,_0x2fbe30))[_0x24fc('0x26')](handleError(_0x4224f4,null));};exports[_0x24fc('0x4e')]=function(_0x1ad8d6,_0x39873d){var _0x6c6754={'raw':![],'where':{'id':_0x1ad8d6[_0x24fc('0x4f')]['id']}},_0x166f6c={};_0x166f6c['model']=_['keys'](db[_0x24fc('0x35')][_0x24fc('0x50')]);_0x166f6c[_0x24fc('0x3a')]=_['keys'](_0x1ad8d6['query']);_0x166f6c[_0x24fc('0x3c')]=_[_0x24fc('0x3d')](_0x166f6c[_0x24fc('0x3f')],_0x166f6c[_0x24fc('0x3a')]);_0x6c6754[_0x24fc('0x3e')]=_[_0x24fc('0x3d')](_0x166f6c[_0x24fc('0x3f')],qs[_0x24fc('0x40')](_0x1ad8d6[_0x24fc('0x3a')][_0x24fc('0x40')]));_0x6c6754[_0x24fc('0x3e')]=_0x6c6754[_0x24fc('0x3e')]['length']?_0x6c6754[_0x24fc('0x3e')]:_0x166f6c[_0x24fc('0x3f')];if(_0x1ad8d6[_0x24fc('0x3a')][_0x24fc('0x51')]){_0x6c6754[_0x24fc('0x4b')]=[{'all':!![]}];}_0x6c6754=_['merge']({},_0x6c6754,_0x1ad8d6[_0x24fc('0x4a')]);return db['ZendeskAccount'][_0x24fc('0x52')](_0x6c6754)[_0x24fc('0x4d')](handleEntityNotFound(_0x39873d,null))[_0x24fc('0x4d')](respondWithResult(_0x39873d,null))[_0x24fc('0x26')](handleError(_0x39873d,null));};exports[_0x24fc('0x53')]=function(_0x3dd8e0,_0x4c9216){return db[_0x24fc('0x35')][_0x24fc('0x53')](_0x3dd8e0[_0x24fc('0x54')],{})[_0x24fc('0x4d')](respondWithResult(_0x4c9216,0xc9))[_0x24fc('0x26')](handleError(_0x4c9216,null));};exports[_0x24fc('0x30')]=function(_0x540b22,_0x36d500){if(_0x540b22[_0x24fc('0x54')]['id']){delete _0x540b22[_0x24fc('0x54')]['id'];}return db[_0x24fc('0x35')][_0x24fc('0x52')]({'where':{'id':_0x540b22[_0x24fc('0x4f')]['id']}})[_0x24fc('0x4d')](handleEntityNotFound(_0x36d500,null))['then'](saveUpdates(_0x540b22[_0x24fc('0x54')],null))[_0x24fc('0x4d')](respondWithResult(_0x36d500,null))['catch'](handleError(_0x36d500,null));};exports[_0x24fc('0x31')]=function(_0x192aa8,_0x276f11){return db[_0x24fc('0x35')][_0x24fc('0x52')]({'where':{'id':_0x192aa8[_0x24fc('0x4f')]['id']}})['then'](handleEntityNotFound(_0x276f11,null))[_0x24fc('0x4d')](removeEntity(_0x276f11,null))['catch'](handleError(_0x276f11,null));};exports[_0x24fc('0x55')]=function(_0x8c9649,_0x50e5b0,_0x435442){var _0x5c1a92={};var _0x1c1f74={};var _0x595c47;var _0xdff811;return db[_0x24fc('0x35')]['findOne']({'where':{'id':_0x8c9649[_0x24fc('0x4f')]['id']}})['then'](handleEntityNotFound(_0x50e5b0,null))[_0x24fc('0x4d')](function(_0x16dc59){if(_0x16dc59){_0x595c47=_0x16dc59;_0x1c1f74['model']=_[_0x24fc('0x3b')](db[_0x24fc('0x56')][_0x24fc('0x50')]);_0x1c1f74[_0x24fc('0x3a')]=_[_0x24fc('0x3b')](_0x8c9649['query']);_0x1c1f74[_0x24fc('0x3c')]=_[_0x24fc('0x3d')](_0x1c1f74[_0x24fc('0x3f')],_0x1c1f74[_0x24fc('0x3a')]);_0x5c1a92[_0x24fc('0x3e')]=_['intersection'](_0x1c1f74['model'],qs[_0x24fc('0x40')](_0x8c9649[_0x24fc('0x3a')]['fields']));_0x5c1a92['attributes']=_0x5c1a92[_0x24fc('0x3e')][_0x24fc('0x57')]?_0x5c1a92[_0x24fc('0x3e')]:_0x1c1f74[_0x24fc('0x3f')];_0x5c1a92['order']=qs[_0x24fc('0x45')](_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x45')]);_0x5c1a92[_0x24fc('0x46')]=qs[_0x24fc('0x3c')](_[_0x24fc('0x58')](_0x8c9649[_0x24fc('0x3a')],_0x1c1f74[_0x24fc('0x3c')]));if(_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x47')]){_0x5c1a92[_0x24fc('0x46')]=_[_0x24fc('0x48')](_0x5c1a92[_0x24fc('0x46')],{'$or':_[_0x24fc('0x39')](_0x5c1a92[_0x24fc('0x3e')],function(_0x54ead5){var _0xd53778={};_0xd53778[_0x54ead5]={'$like':'%'+_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x47')]+'%'};return _0xd53778;})});}_0x5c1a92=_[_0x24fc('0x48')]({},_0x5c1a92,_0x8c9649[_0x24fc('0x4a')]);return _0x595c47[_0x24fc('0x55')](_0x5c1a92);}})[_0x24fc('0x4d')](function(_0x4659f9){if(_0x4659f9){_0xdff811=_0x4659f9['length'];if(!_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x41')](_0x24fc('0x42'))){_0x5c1a92[_0x24fc('0x43')]=qs['limit'](_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x43')]);_0x5c1a92['offset']=qs['offset'](_0x8c9649['query'][_0x24fc('0x2b')]);}return _0x595c47[_0x24fc('0x55')](_0x5c1a92);}})[_0x24fc('0x4d')](function(_0x2c6a97){if(_0x2c6a97){return _0x2c6a97?{'count':_0xdff811,'rows':_0x2c6a97}:null;}})[_0x24fc('0x4d')](respondWithResult(_0x50e5b0,null))[_0x24fc('0x26')](handleError(_0x50e5b0,null));};exports['addConfiguration']=function(_0x11bafd,_0x15e8a3,_0x5a2c09){if(_0x11bafd['body']['id']){delete _0x11bafd[_0x24fc('0x54')]['id'];}return db[_0x24fc('0x35')][_0x24fc('0x59')]({'where':{'id':_0x11bafd['params']['id']}})[_0x24fc('0x4d')](handleEntityNotFound(_0x15e8a3,null))[_0x24fc('0x4d')](function(_0x33f04e){if(_0x33f04e){_0x11bafd['body']['AccountId']=_0x33f04e['id'];_0x11bafd['body']['Subjects']=integrations['getSubjects'](_0x11bafd[_0x24fc('0x54')][_0x24fc('0x5a')],_0x11bafd[_0x24fc('0x54')][_0x24fc('0x37')]);_0x11bafd['body'][_0x24fc('0x5b')]=integrations['getDescriptions'](_0x11bafd[_0x24fc('0x54')]['channel'],_0x11bafd[_0x24fc('0x54')][_0x24fc('0x37')]);return db[_0x24fc('0x56')][_0x24fc('0x53')](_0x11bafd[_0x24fc('0x54')],{'include':[{'model':db[_0x24fc('0x5c')],'as':_0x24fc('0x5d')},{'model':db['ZendeskField'],'as':_0x24fc('0x5b')}]});}return null;})[_0x24fc('0x4d')](respondWithResult(_0x15e8a3,null))[_0x24fc('0x26')](handleError(_0x15e8a3,null));};exports['getFields']=function(_0x5201e7,_0x13d4ba,_0x1d80db){var _0x4d4291='';return db[_0x24fc('0x35')][_0x24fc('0x59')]({'where':{'id':_0x5201e7['params']['id']},'attributes':['id',_0x24fc('0x5e'),_0x24fc('0x5f'),'token',_0x24fc('0x60'),_0x24fc('0x61')]})[_0x24fc('0x4d')](handleEntityNotFound(_0x13d4ba,null))[_0x24fc('0x4d')](function(_0x1c67fc){if(_0x1c67fc){_0x4d4291=_0x1c67fc[_0x24fc('0x61')];var _0x4e3cca=_0x4d4291['slice'](-0x1);if(_0x4e3cca==='/'){_0x4d4291=_0x4d4291[_0x24fc('0x62')](0x0,_0x4d4291['lastIndexOf'](_0x4e3cca));}var _0x29bd9f={'method':'GET','uri':util['format'](_0x24fc('0x63'),_0x4d4291,_0x24fc('0x64')),'json':!![]};switch(_0x1c67fc[_0x24fc('0x60')]){case _0x24fc('0x5f'):_0x29bd9f[_0x24fc('0x65')]={'Authorization':util[_0x24fc('0x66')](_0x24fc('0x67'),new Buffer(util[_0x24fc('0x66')]('%s:%s',_0x1c67fc[_0x24fc('0x5e')],_0x1c67fc[_0x24fc('0x5f')]))['toString']('base64'))};break;case _0x24fc('0x68'):_0x29bd9f[_0x24fc('0x65')]={'Authorization':util[_0x24fc('0x66')](_0x24fc('0x67'),new Buffer(util[_0x24fc('0x66')]('%s/token:%s',_0x1c67fc[_0x24fc('0x5e')],_0x1c67fc[_0x24fc('0x68')]))['toString'](_0x24fc('0x69')))};break;default:throw new db[(_0x24fc('0x6a'))][(_0x24fc('0x6b'))]('Unknown\x20authentication\x20type');}return rp(_0x29bd9f);}})[_0x24fc('0x4d')](function(_0x4752ba){if(_0x4752ba){var _0x3399fe=[_0x24fc('0x6c'),_0x24fc('0x6d'),_0x24fc('0x6e'),_0x24fc('0x6f')];_[_0x24fc('0x70')](_0x4752ba[_0x24fc('0x64')],function(_0x54f379){return _0x3399fe[_0x24fc('0x71')](_0x54f379[_0x24fc('0x37')]);});return{'count':_0x4752ba[_0x24fc('0x64')]['length'],'rows':_['map'](_0x4752ba['ticket_fields'],function(_0x1c6e01){return{'id':_0x1c6e01['id'],'name':_0x1c6e01['position']>0x7?_0x1c6e01[_0x24fc('0x72')]:_0x1c6e01[_0x24fc('0x37')],'custom':_0x1c6e01['position']>0x7?!![]:![],'options':_0x1c6e01[_0x24fc('0x73')]?_0x1c6e01['system_field_options']:_0x1c6e01[_0x24fc('0x74')]?_0x1c6e01['custom_field_options']:[]};})};}})[_0x24fc('0x4d')](respondWithResult(_0x13d4ba,null))[_0x24fc('0x26')](function(_0x1ef6f3){var _0x360f3e=_0x5201e7[_0x24fc('0x3a')][_0x24fc('0x75')]?0x1f4:_0x1ef6f3['statusCode']||0x1f4;logger[_0x24fc('0x22')](_0x24fc('0x76'),_0x24fc('0x77'),_0x360f3e,JSON[_0x24fc('0x78')](_0x1ef6f3));delete _0x1ef6f3[_0x24fc('0x33')];if(_0x360f3e===0x191){_0x360f3e=0x190;}_0x13d4ba[_0x24fc('0x28')](_0x360f3e)[_0x24fc('0x34')](_0x5201e7[_0x24fc('0x3a')][_0x24fc('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x1ef6f3[_0x24fc('0x79')]}:_0x1ef6f3);});}; \ No newline at end of file +var _0xa20a=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','count','offset','set','Content-Range','json','reject','update','destroy','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','pick','type','ZendeskAccount','includeAll','include','show','params','fields','merge','options','find','create','body','getConfigurations','ZendeskConfiguration','rawAttributes','filter','nolimit','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','assignee','remove','includes','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel'];(function(_0x1035a3,_0x5f38ef){var _0x19c9f7=function(_0x13b063){while(--_0x13b063){_0x1035a3['push'](_0x1035a3['shift']());}};_0x19c9f7(++_0x5f38ef);}(_0xa20a,0x74));var _0xaa20=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xa20a[_0x5ddaac];return _0x2a9c58;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xaa20('0x0'));var zipdir=require(_0xaa20('0x1'));var jsonpatch=require(_0xaa20('0x2'));var rp=require(_0xaa20('0x3'));var moment=require('moment');var BPromise=require(_0xaa20('0x4'));var Mustache=require(_0xaa20('0x5'));var util=require(_0xaa20('0x6'));var path=require(_0xaa20('0x7'));var sox=require(_0xaa20('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa20('0x9'));var squel=require(_0xaa20('0xa'));var crypto=require(_0xaa20('0xb'));var jsforce=require(_0xaa20('0xc'));var deskjs=require(_0xaa20('0xd'));var toCsv=require(_0xaa20('0xe'));var querystring=require(_0xaa20('0xf'));var Papa=require(_0xaa20('0x10'));var Redis=require(_0xaa20('0x11'));var authService=require(_0xaa20('0x12'));var qs=require(_0xaa20('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa20('0x14'));var logger=require(_0xaa20('0x15'))('api');var utils=require(_0xaa20('0x16'));var config=require(_0xaa20('0x17'));var licenseUtil=require(_0xaa20('0x18'));var db=require(_0xaa20('0x19'))['db'];var integrations=require(_0xaa20('0x1a'));var jayson=require(_0xaa20('0x1b'));var client=jayson['client'][_0xaa20('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x163677,_0x476bb3,_0x364459,_0x179b55){return new BPromise(function(_0xd88a1c,_0x338ce0){var _0x133d1a=_0x179b55||client;return _0x133d1a[_0xaa20('0x1d')](_0x163677,_0x364459)[_0xaa20('0x1e')](function(_0x1e0cc8){logger[_0xaa20('0x1f')](_0xaa20('0x20'),_0x476bb3,_0xaa20('0x21'));logger[_0xaa20('0x22')](_0xaa20('0x23'),_0x476bb3,_0xaa20('0x21'),JSON['stringify'](_0x1e0cc8));if(_0x1e0cc8[_0xaa20('0x24')]){if(_0x1e0cc8['error'][_0xaa20('0x25')]===0x1f4){logger[_0xaa20('0x24')]('ZendeskAccount,\x20%s,\x20%s',_0x476bb3,_0x1e0cc8[_0xaa20('0x24')][_0xaa20('0x26')]);return _0x338ce0(_0x1e0cc8[_0xaa20('0x24')][_0xaa20('0x26')]);}logger[_0xaa20('0x24')]('ZendeskAccount,\x20%s,\x20%s',_0x476bb3,_0x1e0cc8['error']['message']);return _0xd88a1c(_0x1e0cc8['error']['message']);}else{logger[_0xaa20('0x1f')](_0xaa20('0x20'),_0x476bb3,_0xaa20('0x21'));_0xd88a1c(_0x1e0cc8[_0xaa20('0x27')][_0xaa20('0x26')]);}})[_0xaa20('0x28')](function(_0x63ccef){logger[_0xaa20('0x24')](_0xaa20('0x20'),_0x476bb3,_0x63ccef);_0x338ce0(_0x63ccef);});});}function respondWithStatusCode(_0x48aa88,_0x5a2905){_0x5a2905=_0x5a2905||0xcc;return function(_0xc4ba0b){if(_0xc4ba0b){return _0x48aa88[_0xaa20('0x29')](_0x5a2905);}return _0x48aa88['status'](_0x5a2905)[_0xaa20('0x2a')]();};}function respondWithResult(_0x1388dc,_0x5a722b){_0x5a722b=_0x5a722b||0xc8;return function(_0x193fb2){if(_0x193fb2){return _0x1388dc[_0xaa20('0x2b')](_0x5a722b)['json'](_0x193fb2);}};}function respondWithFilteredResult(_0x428c18,_0x5705dd){return function(_0x3fa53a){if(_0x3fa53a){var _0x7ffdf1=_0x3fa53a[_0xaa20('0x2c')],_0x213d4e=_0x5705dd['offset'],_0x3c166d=_0x5705dd[_0xaa20('0x2d')]+_0x5705dd['limit'],_0x24fc6f;if(_0x3c166d>=_0x7ffdf1){_0x3c166d=_0x7ffdf1;_0x24fc6f=0xc8;}else{_0x24fc6f=0xce;}_0x428c18['status'](_0x24fc6f);return _0x428c18[_0xaa20('0x2e')](_0xaa20('0x2f'),_0x213d4e+'-'+_0x3c166d+'/'+_0x7ffdf1)[_0xaa20('0x30')](_0x3fa53a);}return null;};}function patchUpdates(_0x45e2fa){return function(_0x49e704){try{jsonpatch['apply'](_0x49e704,_0x45e2fa,!![]);}catch(_0xe0a579){return BPromise[_0xaa20('0x31')](_0xe0a579);}return _0x49e704['save']();};}function saveUpdates(_0x40b5d9,_0x25b7b4){return function(_0x12974d){if(_0x12974d){return _0x12974d[_0xaa20('0x32')](_0x40b5d9)[_0xaa20('0x1e')](function(_0x1596b7){return _0x1596b7;});}return null;};}function removeEntity(_0x257932,_0x3da1f5){return function(_0x3e8539){if(_0x3e8539){return _0x3e8539[_0xaa20('0x33')]()['then'](function(){_0x257932[_0xaa20('0x2b')](0xcc)[_0xaa20('0x2a')]();});}};}function handleEntityNotFound(_0xe00f47,_0x36738e){return function(_0x57036c){if(!_0x57036c){_0xe00f47['sendStatus'](0x194);}return _0x57036c;};}function handleError(_0x3eb301,_0x190a4c){_0x190a4c=_0x190a4c||0x1f4;return function(_0x415cff){logger['error'](_0x415cff[_0xaa20('0x34')]);if(_0x415cff[_0xaa20('0x35')]){delete _0x415cff[_0xaa20('0x35')];}_0x3eb301['status'](_0x190a4c)[_0xaa20('0x36')](_0x415cff);};}exports[_0xaa20('0x37')]=function(_0x1730f3,_0x46f5e7){var _0x6f773c={},_0x101e6a={},_0x230937={'count':0x0,'rows':[]};var _0x5a41ca=_[_0xaa20('0x38')](db['ZendeskAccount']['rawAttributes'],function(_0x355fe5){return{'name':_0x355fe5[_0xaa20('0x39')],'type':_0x355fe5['type'][_0xaa20('0x3a')]};});_0x101e6a[_0xaa20('0x3b')]=_[_0xaa20('0x38')](_0x5a41ca,_0xaa20('0x35'));_0x101e6a[_0xaa20('0x3c')]=_[_0xaa20('0x3d')](_0x1730f3[_0xaa20('0x3c')]);_0x101e6a[_0xaa20('0x3e')]=_[_0xaa20('0x3f')](_0x101e6a[_0xaa20('0x3b')],_0x101e6a[_0xaa20('0x3c')]);_0x6f773c[_0xaa20('0x40')]=_[_0xaa20('0x3f')](_0x101e6a[_0xaa20('0x3b')],qs['fields'](_0x1730f3[_0xaa20('0x3c')]['fields']));_0x6f773c['attributes']=_0x6f773c['attributes'][_0xaa20('0x41')]?_0x6f773c['attributes']:_0x101e6a[_0xaa20('0x3b')];if(!_0x1730f3['query'][_0xaa20('0x42')]('nolimit')){_0x6f773c[_0xaa20('0x43')]=qs[_0xaa20('0x43')](_0x1730f3[_0xaa20('0x3c')]['limit']);_0x6f773c[_0xaa20('0x2d')]=qs[_0xaa20('0x2d')](_0x1730f3[_0xaa20('0x3c')][_0xaa20('0x2d')]);}_0x6f773c[_0xaa20('0x44')]=qs[_0xaa20('0x45')](_0x1730f3[_0xaa20('0x3c')][_0xaa20('0x45')]);_0x6f773c[_0xaa20('0x46')]=qs['filters'](_[_0xaa20('0x47')](_0x1730f3[_0xaa20('0x3c')],_0x101e6a[_0xaa20('0x3e')]),_0x5a41ca);if(_0x1730f3[_0xaa20('0x3c')]['filter']){_0x6f773c['where']=_['merge'](_0x6f773c['where'],{'$or':_['map'](_0x5a41ca,function(_0xb300b5){if(_0xb300b5[_0xaa20('0x48')]!=='VIRTUAL'){var _0x29f359={};_0x29f359[_0xb300b5[_0xaa20('0x35')]]={'$like':'%'+_0x1730f3[_0xaa20('0x3c')]['filter']+'%'};return _0x29f359;}})});}_0x6f773c=_['merge']({},_0x6f773c,_0x1730f3['options']);var _0x33dd49={'where':_0x6f773c['where']};return db[_0xaa20('0x49')]['count'](_0x33dd49)[_0xaa20('0x1e')](function(_0x1d74f8){_0x230937[_0xaa20('0x2c')]=_0x1d74f8;if(_0x1730f3[_0xaa20('0x3c')][_0xaa20('0x4a')]){_0x6f773c[_0xaa20('0x4b')]=[{'all':!![]}];}return db[_0xaa20('0x49')]['findAll'](_0x6f773c);})[_0xaa20('0x1e')](function(_0x573dcb){_0x230937['rows']=_0x573dcb;return _0x230937;})[_0xaa20('0x1e')](respondWithFilteredResult(_0x46f5e7,_0x6f773c))[_0xaa20('0x28')](handleError(_0x46f5e7,null));};exports[_0xaa20('0x4c')]=function(_0x73c7b6,_0x1e24d4){var _0x367b90={'raw':![],'where':{'id':_0x73c7b6[_0xaa20('0x4d')]['id']}},_0x3edbd7={};_0x3edbd7[_0xaa20('0x3b')]=_['keys'](db[_0xaa20('0x49')]['rawAttributes']);_0x3edbd7[_0xaa20('0x3c')]=_['keys'](_0x73c7b6[_0xaa20('0x3c')]);_0x3edbd7[_0xaa20('0x3e')]=_['intersection'](_0x3edbd7[_0xaa20('0x3b')],_0x3edbd7[_0xaa20('0x3c')]);_0x367b90[_0xaa20('0x40')]=_[_0xaa20('0x3f')](_0x3edbd7[_0xaa20('0x3b')],qs['fields'](_0x73c7b6[_0xaa20('0x3c')][_0xaa20('0x4e')]));_0x367b90[_0xaa20('0x40')]=_0x367b90[_0xaa20('0x40')][_0xaa20('0x41')]?_0x367b90[_0xaa20('0x40')]:_0x3edbd7[_0xaa20('0x3b')];if(_0x73c7b6[_0xaa20('0x3c')][_0xaa20('0x4a')]){_0x367b90['include']=[{'all':!![]}];}_0x367b90=_[_0xaa20('0x4f')]({},_0x367b90,_0x73c7b6[_0xaa20('0x50')]);return db['ZendeskAccount'][_0xaa20('0x51')](_0x367b90)['then'](handleEntityNotFound(_0x1e24d4,null))[_0xaa20('0x1e')](respondWithResult(_0x1e24d4,null))[_0xaa20('0x28')](handleError(_0x1e24d4,null));};exports[_0xaa20('0x52')]=function(_0x14e705,_0x46890c){return db[_0xaa20('0x49')][_0xaa20('0x52')](_0x14e705[_0xaa20('0x53')],{})[_0xaa20('0x1e')](respondWithResult(_0x46890c,0xc9))['catch'](handleError(_0x46890c,null));};exports[_0xaa20('0x32')]=function(_0x3eed96,_0x5e6bfa){if(_0x3eed96[_0xaa20('0x53')]['id']){delete _0x3eed96[_0xaa20('0x53')]['id'];}return db['ZendeskAccount'][_0xaa20('0x51')]({'where':{'id':_0x3eed96['params']['id']}})[_0xaa20('0x1e')](handleEntityNotFound(_0x5e6bfa,null))[_0xaa20('0x1e')](saveUpdates(_0x3eed96[_0xaa20('0x53')],null))[_0xaa20('0x1e')](respondWithResult(_0x5e6bfa,null))[_0xaa20('0x28')](handleError(_0x5e6bfa,null));};exports['destroy']=function(_0xda0b2b,_0x5e02ca){return db['ZendeskAccount'][_0xaa20('0x51')]({'where':{'id':_0xda0b2b[_0xaa20('0x4d')]['id']}})[_0xaa20('0x1e')](handleEntityNotFound(_0x5e02ca,null))[_0xaa20('0x1e')](removeEntity(_0x5e02ca,null))[_0xaa20('0x28')](handleError(_0x5e02ca,null));};exports[_0xaa20('0x54')]=function(_0x5a11cc,_0x5e0730,_0x49cd74){var _0x7bc548={};var _0x3f76ed={};var _0x4a5b65;var _0x3bb3fe;return db['ZendeskAccount']['findOne']({'where':{'id':_0x5a11cc['params']['id']}})['then'](handleEntityNotFound(_0x5e0730,null))[_0xaa20('0x1e')](function(_0x25059a){if(_0x25059a){_0x4a5b65=_0x25059a;_0x3f76ed['model']=_['keys'](db[_0xaa20('0x55')][_0xaa20('0x56')]);_0x3f76ed[_0xaa20('0x3c')]=_[_0xaa20('0x3d')](_0x5a11cc[_0xaa20('0x3c')]);_0x3f76ed[_0xaa20('0x3e')]=_['intersection'](_0x3f76ed[_0xaa20('0x3b')],_0x3f76ed[_0xaa20('0x3c')]);_0x7bc548['attributes']=_[_0xaa20('0x3f')](_0x3f76ed[_0xaa20('0x3b')],qs[_0xaa20('0x4e')](_0x5a11cc[_0xaa20('0x3c')]['fields']));_0x7bc548[_0xaa20('0x40')]=_0x7bc548[_0xaa20('0x40')][_0xaa20('0x41')]?_0x7bc548[_0xaa20('0x40')]:_0x3f76ed['model'];_0x7bc548[_0xaa20('0x44')]=qs[_0xaa20('0x45')](_0x5a11cc[_0xaa20('0x3c')][_0xaa20('0x45')]);_0x7bc548[_0xaa20('0x46')]=qs[_0xaa20('0x3e')](_[_0xaa20('0x47')](_0x5a11cc['query'],_0x3f76ed[_0xaa20('0x3e')]));if(_0x5a11cc[_0xaa20('0x3c')][_0xaa20('0x57')]){_0x7bc548[_0xaa20('0x46')]=_['merge'](_0x7bc548[_0xaa20('0x46')],{'$or':_[_0xaa20('0x38')](_0x7bc548['attributes'],function(_0x4c37a0){var _0x201ecb={};_0x201ecb[_0x4c37a0]={'$like':'%'+_0x5a11cc[_0xaa20('0x3c')]['filter']+'%'};return _0x201ecb;})});}_0x7bc548=_[_0xaa20('0x4f')]({},_0x7bc548,_0x5a11cc[_0xaa20('0x50')]);return _0x4a5b65['getConfigurations'](_0x7bc548);}})['then'](function(_0x1783a1){if(_0x1783a1){_0x3bb3fe=_0x1783a1[_0xaa20('0x41')];if(!_0x5a11cc[_0xaa20('0x3c')][_0xaa20('0x42')](_0xaa20('0x58'))){_0x7bc548[_0xaa20('0x43')]=qs['limit'](_0x5a11cc[_0xaa20('0x3c')][_0xaa20('0x43')]);_0x7bc548[_0xaa20('0x2d')]=qs[_0xaa20('0x2d')](_0x5a11cc[_0xaa20('0x3c')][_0xaa20('0x2d')]);}return _0x4a5b65[_0xaa20('0x54')](_0x7bc548);}})[_0xaa20('0x1e')](function(_0x3c294a){if(_0x3c294a){return _0x3c294a?{'count':_0x3bb3fe,'rows':_0x3c294a}:null;}})[_0xaa20('0x1e')](respondWithResult(_0x5e0730,null))[_0xaa20('0x28')](handleError(_0x5e0730,null));};exports[_0xaa20('0x59')]=function(_0x1bf25a,_0x34a94b,_0x34b63d){if(_0x1bf25a[_0xaa20('0x53')]['id']){delete _0x1bf25a[_0xaa20('0x53')]['id'];}return db[_0xaa20('0x49')][_0xaa20('0x5a')]({'where':{'id':_0x1bf25a[_0xaa20('0x4d')]['id']}})[_0xaa20('0x1e')](handleEntityNotFound(_0x34a94b,null))[_0xaa20('0x1e')](function(_0x202ac2){if(_0x202ac2){_0x1bf25a[_0xaa20('0x53')][_0xaa20('0x5b')]=_0x202ac2['id'];_0x1bf25a[_0xaa20('0x53')]['Subjects']=integrations[_0xaa20('0x5c')](_0x1bf25a['body']['channel'],_0x1bf25a[_0xaa20('0x53')][_0xaa20('0x48')]);_0x1bf25a[_0xaa20('0x53')][_0xaa20('0x5d')]=integrations[_0xaa20('0x5e')](_0x1bf25a[_0xaa20('0x53')]['channel'],_0x1bf25a['body']['type']);return db[_0xaa20('0x55')]['create'](_0x1bf25a['body'],{'include':[{'model':db[_0xaa20('0x5f')],'as':_0xaa20('0x60')},{'model':db['ZendeskField'],'as':_0xaa20('0x5d')}]});}return null;})[_0xaa20('0x1e')](respondWithResult(_0x34a94b,null))['catch'](handleError(_0x34a94b,null));};exports[_0xaa20('0x61')]=function(_0x23504c,_0x3d3ef3,_0x4c4b95){var _0xdc1913='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x23504c[_0xaa20('0x4d')]['id']},'attributes':['id',_0xaa20('0x62'),_0xaa20('0x63'),_0xaa20('0x64'),_0xaa20('0x65'),'remoteUri']})['then'](handleEntityNotFound(_0x3d3ef3,null))[_0xaa20('0x1e')](function(_0x2c9d0c){if(_0x2c9d0c){_0xdc1913=_0x2c9d0c[_0xaa20('0x66')];var _0x519ce3=_0xdc1913[_0xaa20('0x67')](-0x1);if(_0x519ce3==='/'){_0xdc1913=_0xdc1913[_0xaa20('0x68')](0x0,_0xdc1913['lastIndexOf'](_0x519ce3));}var _0x140a3f={'method':_0xaa20('0x69'),'uri':util[_0xaa20('0x6a')](_0xaa20('0x6b'),_0xdc1913,_0xaa20('0x6c')),'json':!![]};switch(_0x2c9d0c[_0xaa20('0x65')]){case _0xaa20('0x63'):_0x140a3f['headers']={'Authorization':util[_0xaa20('0x6a')](_0xaa20('0x6d'),new Buffer(util[_0xaa20('0x6a')](_0xaa20('0x6e'),_0x2c9d0c['username'],_0x2c9d0c['password']))[_0xaa20('0x6f')](_0xaa20('0x70')))};break;case _0xaa20('0x64'):_0x140a3f['headers']={'Authorization':util[_0xaa20('0x6a')](_0xaa20('0x6d'),new Buffer(util['format'](_0xaa20('0x71'),_0x2c9d0c[_0xaa20('0x62')],_0x2c9d0c['token']))[_0xaa20('0x6f')](_0xaa20('0x70')))};break;default:throw new db[(_0xaa20('0x72'))][(_0xaa20('0x73'))]('Unknown\x20authentication\x20type');}return rp(_0x140a3f);}})['then'](function(_0x3870af){if(_0x3870af){var _0x120d28=['subject','description','group',_0xaa20('0x74')];_[_0xaa20('0x75')](_0x3870af[_0xaa20('0x6c')],function(_0x38a090){return _0x120d28[_0xaa20('0x76')](_0x38a090['type']);});return{'count':_0x3870af[_0xaa20('0x6c')]['length'],'rows':_['map'](_0x3870af[_0xaa20('0x6c')],function(_0x3e49c8){return{'id':_0x3e49c8['id'],'name':_0x3e49c8['position']>0x7?_0x3e49c8[_0xaa20('0x77')]:_0x3e49c8[_0xaa20('0x48')],'custom':_0x3e49c8['position']>0x7?!![]:![],'options':_0x3e49c8[_0xaa20('0x78')]?_0x3e49c8[_0xaa20('0x78')]:_0x3e49c8[_0xaa20('0x79')]?_0x3e49c8[_0xaa20('0x79')]:[]};})};}})[_0xaa20('0x1e')](respondWithResult(_0x3d3ef3,null))['catch'](function(_0x21a1b6){var _0x1c8b2e=_0x23504c['query'][_0xaa20('0x7a')]?0x1f4:_0x21a1b6[_0xaa20('0x7b')]||0x1f4;logger[_0xaa20('0x24')](_0xaa20('0x7c'),_0xaa20('0x61'),_0x1c8b2e,JSON[_0xaa20('0x7d')](_0x21a1b6));delete _0x21a1b6[_0xaa20('0x35')];if(_0x1c8b2e===0x191){_0x1c8b2e=0x190;}_0x3d3ef3[_0xaa20('0x2b')](_0x1c8b2e)['send'](_0x23504c[_0xaa20('0x3c')][_0xaa20('0x7a')]?{'message':_0xaa20('0x7e'),'statusCode':_0x21a1b6[_0xaa20('0x7b')]}:_0x21a1b6);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index cd06c08..0d6c95e 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 _0x2b6f=['lodash','util','../../config/logger','moment','request-promise','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts'];(function(_0xaa4d37,_0x1f2fc4){var _0x38e8a5=function(_0x199d27){while(--_0x199d27){_0xaa4d37['push'](_0xaa4d37['shift']());}};_0x38e8a5(++_0x1f2fc4);}(_0x2b6f,0xb0));var _0xf2b6=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x2b6f[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0xf2b6('0x0'));var util=require(_0xf2b6('0x1'));var logger=require(_0xf2b6('0x2'))('api');var moment=require(_0xf2b6('0x3'));var BPromise=require('bluebird');var rp=require(_0xf2b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf2b6('0x5'));var attributes=require(_0xf2b6('0x6'));var integrations=require(_0xf2b6('0x7'));module[_0xf2b6('0x8')]=function(_0x316414,_0x510fa5){return _0x316414[_0xf2b6('0x9')]('ZendeskAccount',attributes,{'tableName':_0xf2b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb91d=['api','moment','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util'];(function(_0x467128,_0x525714){var _0x5a2df5=function(_0x17e0dc){while(--_0x17e0dc){_0x467128['push'](_0x467128['shift']());}};_0x5a2df5(++_0x525714);}(_0xb91d,0x19e));var _0xdb91=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xb91d[_0x3f4891];return _0x54f2d8;};'use strict';var _=require(_0xdb91('0x0'));var util=require(_0xdb91('0x1'));var logger=require('../../config/logger')(_0xdb91('0x2'));var moment=require(_0xdb91('0x3'));var BPromise=require('bluebird');var rp=require(_0xdb91('0x4'));var fs=require('fs');var path=require(_0xdb91('0x5'));var rimraf=require(_0xdb91('0x6'));var config=require('../../config/environment');var attributes=require(_0xdb91('0x7'));var integrations=require(_0xdb91('0x8'));module[_0xdb91('0x9')]=function(_0x47925d,_0x96077b){return _0x47925d[_0xdb91('0xa')](_0xdb91('0xb'),attributes,{'tableName':_0xdb91('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 b4f0179..568f388 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(_0x341df1,_0x4a5e0a){var _0x3b9b3f=function(_0x4435c1){while(--_0x4435c1){_0x341df1['push'](_0x341df1['shift']());}};_0x3b9b3f(++_0x4a5e0a);}(_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(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 6e535df..511356c 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 _0x7ec2=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','getSubjects','/:id/descriptions','post','/:id/tags','setTags','put','update','delete','multer'];(function(_0x2079c0,_0x4e7ba6){var _0x87730f=function(_0x51eeb1){while(--_0x51eeb1){_0x2079c0['push'](_0x2079c0['shift']());}};_0x87730f(++_0x4e7ba6);}(_0x7ec2,0x1b8));var _0x27ec=function(_0x14f8c9,_0x2cc0c0){_0x14f8c9=_0x14f8c9-0x0;var _0x1b0a02=_0x7ec2[_0x14f8c9];return _0x1b0a02;};'use strict';var multer=require(_0x27ec('0x0'));var util=require('util');var path=require(_0x27ec('0x1'));var timeout=require(_0x27ec('0x2'));var express=require(_0x27ec('0x3'));var router=express['Router']();var auth=require(_0x27ec('0x4'));var interaction=require(_0x27ec('0x5'));var config=require(_0x27ec('0x6'));var controller=require(_0x27ec('0x7'));router[_0x27ec('0x8')]('/',auth[_0x27ec('0x9')](),controller[_0x27ec('0xa')]);router['get']('/:id',auth[_0x27ec('0x9')](),controller['show']);router[_0x27ec('0x8')](_0x27ec('0xb'),auth[_0x27ec('0x9')](),controller[_0x27ec('0xc')]);router[_0x27ec('0x8')]('/:id/subjects',auth[_0x27ec('0x9')](),controller[_0x27ec('0xd')]);router['get'](_0x27ec('0xe'),auth[_0x27ec('0x9')](),controller['getDescriptions']);router[_0x27ec('0x8')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0x27ec('0x9')](),controller['create']);router[_0x27ec('0xf')](_0x27ec('0x10'),auth['isAuthenticated'](),controller[_0x27ec('0x11')]);router[_0x27ec('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x27ec('0x13')]);router[_0x27ec('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd360=['/:id/tags','setTags','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create'];(function(_0x128832,_0x480891){var _0x245228=function(_0x4e1641){while(--_0x4e1641){_0x128832['push'](_0x128832['shift']());}};_0x245228(++_0x480891);}(_0xd360,0xbe));var _0x0d36=function(_0x338706,_0x15e65d){_0x338706=_0x338706-0x0;var _0x278cb9=_0xd360[_0x338706];return _0x278cb9;};'use strict';var multer=require(_0x0d36('0x0'));var util=require('util');var path=require(_0x0d36('0x1'));var timeout=require(_0x0d36('0x2'));var express=require(_0x0d36('0x3'));var router=express[_0x0d36('0x4')]();var auth=require(_0x0d36('0x5'));var interaction=require(_0x0d36('0x6'));var config=require(_0x0d36('0x7'));var controller=require(_0x0d36('0x8'));router[_0x0d36('0x9')]('/',auth[_0x0d36('0xa')](),controller[_0x0d36('0xb')]);router['get']('/:id',auth[_0x0d36('0xa')](),controller['show']);router[_0x0d36('0x9')](_0x0d36('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x0d36('0x9')](_0x0d36('0xd'),auth[_0x0d36('0xa')](),controller[_0x0d36('0xe')]);router[_0x0d36('0x9')]('/:id/descriptions',auth[_0x0d36('0xa')](),controller[_0x0d36('0xf')]);router[_0x0d36('0x9')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0x0d36('0x10')]('/',auth['isAuthenticated'](),controller[_0x0d36('0x11')]);router[_0x0d36('0x10')](_0x0d36('0x12'),auth[_0x0d36('0xa')](),controller[_0x0d36('0x13')]);router[_0x0d36('0x14')](_0x0d36('0x15'),auth[_0x0d36('0xa')](),controller[_0x0d36('0x16')]);router[_0x0d36('0x17')](_0x0d36('0x15'),auth[_0x0d36('0xa')](),controller[_0x0d36('0x18')]);module[_0x0d36('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6d6b7df..957e342 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 _0x9a8a=['STRING','sequelize'];(function(_0x40d422,_0x21f3a9){var _0x2a1789=function(_0xbe14d0){while(--_0xbe14d0){_0x40d422['push'](_0x40d422['shift']());}};_0x2a1789(++_0x21f3a9);}(_0x9a8a,0x173));var _0xa9a8=function(_0x380153,_0x140bb2){_0x380153=_0x380153-0x0;var _0x157a03=_0x9a8a[_0x380153];return _0x157a03;};'use strict';var Sequelize=require(_0xa9a8('0x0'));module['exports']={'name':{'type':Sequelize[_0xa9a8('0x1')]},'description':{'type':Sequelize[_0xa9a8('0x1')]}}; \ No newline at end of file +var _0x7a2b=['exports','STRING','sequelize'];(function(_0xbd059a,_0x309bd9){var _0x5c3526=function(_0x1770e4){while(--_0x1770e4){_0xbd059a['push'](_0xbd059a['shift']());}};_0x5c3526(++_0x309bd9);}(_0x7a2b,0x17c));var _0xb7a2=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x7a2b[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0xb7a2('0x0'));module[_0xb7a2('0x1')]={'name':{'type':Sequelize[_0xb7a2('0x2')]},'description':{'type':Sequelize[_0xb7a2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 989aa1b..910e348 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 _0xde04=['../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','options','ZendeskConfiguration','count','includeAll','include','findAll','rows','show','params','merge','find','create','update','body','findOne','ZendeskField','length','getFields','getSubjects','getDescriptions','getTags','Tag','ids','rimraf','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x25dbc3,_0x1b1184){var _0x77bfd9=function(_0x205548){while(--_0x205548){_0x25dbc3['push'](_0x25dbc3['shift']());}};_0x77bfd9(++_0x1b1184);}(_0xde04,0x161));var _0x4de0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde04[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4de0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4de0('0x1'));var Mustache=require(_0x4de0('0x2'));var util=require(_0x4de0('0x3'));var path=require('path');var sox=require(_0x4de0('0x4'));var csv=require(_0x4de0('0x5'));var ejs=require(_0x4de0('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4de0('0x7'));var crypto=require(_0x4de0('0x8'));var jsforce=require(_0x4de0('0x9'));var deskjs=require(_0x4de0('0xa'));var toCsv=require(_0x4de0('0x5'));var querystring=require(_0x4de0('0xb'));var Papa=require(_0x4de0('0xc'));var Redis=require(_0x4de0('0xd'));var authService=require(_0x4de0('0xe'));var qs=require(_0x4de0('0xf'));var as=require(_0x4de0('0x10'));var hardwareService=require(_0x4de0('0x11'));var logger=require('../../config/logger')(_0x4de0('0x12'));var utils=require(_0x4de0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4de0('0x14'));var db=require(_0x4de0('0x15'))['db'];var jayson=require(_0x4de0('0x16'));var client=jayson['client'][_0x4de0('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x340483,_0x713c69,_0x43f275,_0x387baf){return new BPromise(function(_0x2e01b8,_0x536bf2){var _0xccd34e=_0x387baf||client;return _0xccd34e[_0x4de0('0x18')](_0x340483,_0x43f275)['then'](function(_0x102311){logger['info'](_0x4de0('0x19'),_0x713c69,_0x4de0('0x1a'));logger[_0x4de0('0x1b')](_0x4de0('0x1c'),_0x713c69,'request\x20sent',JSON['stringify'](_0x102311));if(_0x102311[_0x4de0('0x1d')]){if(_0x102311[_0x4de0('0x1d')][_0x4de0('0x1e')]===0x1f4){logger[_0x4de0('0x1d')](_0x4de0('0x19'),_0x713c69,_0x102311['error']['message']);return _0x536bf2(_0x102311['error'][_0x4de0('0x1f')]);}logger[_0x4de0('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x713c69,_0x102311[_0x4de0('0x1d')][_0x4de0('0x1f')]);return _0x2e01b8(_0x102311[_0x4de0('0x1d')][_0x4de0('0x1f')]);}else{logger[_0x4de0('0x20')](_0x4de0('0x19'),_0x713c69,_0x4de0('0x1a'));_0x2e01b8(_0x102311[_0x4de0('0x21')]['message']);}})[_0x4de0('0x22')](function(_0xc04e58){logger[_0x4de0('0x1d')](_0x4de0('0x19'),_0x713c69,_0xc04e58);_0x536bf2(_0xc04e58);});});}function respondWithStatusCode(_0x3b5291,_0x42d112){_0x42d112=_0x42d112||0xcc;return function(_0x29f086){if(_0x29f086){return _0x3b5291[_0x4de0('0x23')](_0x42d112);}return _0x3b5291[_0x4de0('0x24')](_0x42d112)['end']();};}function respondWithResult(_0x253bd9,_0x342e7e){_0x342e7e=_0x342e7e||0xc8;return function(_0x406307){if(_0x406307){return _0x253bd9['status'](_0x342e7e)[_0x4de0('0x25')](_0x406307);}};}function respondWithFilteredResult(_0x17b3d3,_0x4a2e4f){return function(_0x3f344c){if(_0x3f344c){var _0x2489e0=_0x3f344c['count'],_0x319864=_0x4a2e4f['offset'],_0x4cf4de=_0x4a2e4f['offset']+_0x4a2e4f['limit'],_0x6bfc7d;if(_0x4cf4de>=_0x2489e0){_0x4cf4de=_0x2489e0;_0x6bfc7d=0xc8;}else{_0x6bfc7d=0xce;}_0x17b3d3[_0x4de0('0x24')](_0x6bfc7d);return _0x17b3d3[_0x4de0('0x26')](_0x4de0('0x27'),_0x319864+'-'+_0x4cf4de+'/'+_0x2489e0)[_0x4de0('0x25')](_0x3f344c);}return null;};}function patchUpdates(_0x563a81){return function(_0x5d1e61){try{jsonpatch[_0x4de0('0x28')](_0x5d1e61,_0x563a81,!![]);}catch(_0x4ce163){return BPromise[_0x4de0('0x29')](_0x4ce163);}return _0x5d1e61[_0x4de0('0x2a')]();};}function saveUpdates(_0x2c77f8,_0x22007d){return function(_0x7f6129){if(_0x7f6129){return _0x7f6129['update'](_0x2c77f8)[_0x4de0('0x2b')](function(_0x13bd13){return _0x13bd13;});}return null;};}function removeEntity(_0x5f3f90,_0x1fa93b){return function(_0x2efacf){if(_0x2efacf){return _0x2efacf[_0x4de0('0x2c')]()[_0x4de0('0x2b')](function(){_0x5f3f90[_0x4de0('0x24')](0xcc)[_0x4de0('0x2d')]();});}};}function handleEntityNotFound(_0x1f143d,_0x254a6f){return function(_0x5c1b85){if(!_0x5c1b85){_0x1f143d[_0x4de0('0x23')](0x194);}return _0x5c1b85;};}function handleError(_0x5bfa06,_0x2aba2e){_0x2aba2e=_0x2aba2e||0x1f4;return function(_0x1bc8fb){logger[_0x4de0('0x1d')](_0x1bc8fb[_0x4de0('0x2e')]);if(_0x1bc8fb[_0x4de0('0x2f')]){delete _0x1bc8fb[_0x4de0('0x2f')];}_0x5bfa06[_0x4de0('0x24')](_0x2aba2e)[_0x4de0('0x30')](_0x1bc8fb);};}exports[_0x4de0('0x31')]=function(_0x4f32da,_0x6f6cd3){var _0x48dac8={},_0x370922={},_0x27e4ad={'count':0x0,'rows':[]};var _0x57b7a3=_[_0x4de0('0x32')](db['ZendeskConfiguration'][_0x4de0('0x33')],function(_0x699b6b){return{'name':_0x699b6b[_0x4de0('0x34')],'type':_0x699b6b[_0x4de0('0x35')]['key']};});_0x370922[_0x4de0('0x36')]=_[_0x4de0('0x32')](_0x57b7a3,_0x4de0('0x2f'));_0x370922['query']=_[_0x4de0('0x37')](_0x4f32da[_0x4de0('0x38')]);_0x370922[_0x4de0('0x39')]=_[_0x4de0('0x3a')](_0x370922[_0x4de0('0x36')],_0x370922['query']);_0x48dac8[_0x4de0('0x3b')]=_['intersection'](_0x370922[_0x4de0('0x36')],qs[_0x4de0('0x3c')](_0x4f32da[_0x4de0('0x38')]['fields']));_0x48dac8[_0x4de0('0x3b')]=_0x48dac8['attributes']['length']?_0x48dac8[_0x4de0('0x3b')]:_0x370922[_0x4de0('0x36')];if(!_0x4f32da['query'][_0x4de0('0x3d')](_0x4de0('0x3e'))){_0x48dac8['limit']=qs['limit'](_0x4f32da['query'][_0x4de0('0x3f')]);_0x48dac8[_0x4de0('0x40')]=qs[_0x4de0('0x40')](_0x4f32da[_0x4de0('0x38')]['offset']);}_0x48dac8[_0x4de0('0x41')]=qs[_0x4de0('0x42')](_0x4f32da[_0x4de0('0x38')][_0x4de0('0x42')]);_0x48dac8[_0x4de0('0x43')]=qs[_0x4de0('0x39')](_[_0x4de0('0x44')](_0x4f32da[_0x4de0('0x38')],_0x370922['filters']),_0x57b7a3);if(_0x4f32da[_0x4de0('0x38')][_0x4de0('0x45')]){_0x48dac8['where']=_['merge'](_0x48dac8[_0x4de0('0x43')],{'$or':_['map'](_0x57b7a3,function(_0x3ace2f){if(_0x3ace2f[_0x4de0('0x35')]!=='VIRTUAL'){var _0xd1742b={};_0xd1742b[_0x3ace2f[_0x4de0('0x2f')]]={'$like':'%'+_0x4f32da[_0x4de0('0x38')][_0x4de0('0x45')]+'%'};return _0xd1742b;}})});}_0x48dac8=_['merge']({},_0x48dac8,_0x4f32da[_0x4de0('0x46')]);var _0x4b432c={'where':_0x48dac8[_0x4de0('0x43')]};return db[_0x4de0('0x47')][_0x4de0('0x48')](_0x4b432c)[_0x4de0('0x2b')](function(_0x523d78){_0x27e4ad['count']=_0x523d78;if(_0x4f32da[_0x4de0('0x38')][_0x4de0('0x49')]){_0x48dac8[_0x4de0('0x4a')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x4de0('0x4b')](_0x48dac8);})[_0x4de0('0x2b')](function(_0x3b6c91){_0x27e4ad[_0x4de0('0x4c')]=_0x3b6c91;return _0x27e4ad;})[_0x4de0('0x2b')](respondWithFilteredResult(_0x6f6cd3,_0x48dac8))[_0x4de0('0x22')](handleError(_0x6f6cd3,null));};exports[_0x4de0('0x4d')]=function(_0x2675f1,_0x755b0){var _0x30c8e3={'raw':![],'where':{'id':_0x2675f1[_0x4de0('0x4e')]['id']}},_0x3a6a0b={};_0x3a6a0b['model']=_['keys'](db[_0x4de0('0x47')]['rawAttributes']);_0x3a6a0b[_0x4de0('0x38')]=_['keys'](_0x2675f1[_0x4de0('0x38')]);_0x3a6a0b[_0x4de0('0x39')]=_[_0x4de0('0x3a')](_0x3a6a0b[_0x4de0('0x36')],_0x3a6a0b[_0x4de0('0x38')]);_0x30c8e3[_0x4de0('0x3b')]=_['intersection'](_0x3a6a0b[_0x4de0('0x36')],qs[_0x4de0('0x3c')](_0x2675f1['query']['fields']));_0x30c8e3[_0x4de0('0x3b')]=_0x30c8e3['attributes']['length']?_0x30c8e3[_0x4de0('0x3b')]:_0x3a6a0b[_0x4de0('0x36')];if(_0x2675f1[_0x4de0('0x38')]['includeAll']){_0x30c8e3[_0x4de0('0x4a')]=[{'all':!![]}];}_0x30c8e3=_[_0x4de0('0x4f')]({},_0x30c8e3,_0x2675f1[_0x4de0('0x46')]);return db[_0x4de0('0x47')][_0x4de0('0x50')](_0x30c8e3)['then'](handleEntityNotFound(_0x755b0,null))[_0x4de0('0x2b')](respondWithResult(_0x755b0,null))[_0x4de0('0x22')](handleError(_0x755b0,null));};exports[_0x4de0('0x51')]=function(_0xbd4666,_0x349010){return db[_0x4de0('0x47')][_0x4de0('0x51')](_0xbd4666['body'],{})[_0x4de0('0x2b')](respondWithResult(_0x349010,0xc9))['catch'](handleError(_0x349010,null));};exports[_0x4de0('0x52')]=function(_0x5cefa0,_0xa96535){if(_0x5cefa0[_0x4de0('0x53')]['id']){delete _0x5cefa0[_0x4de0('0x53')]['id'];}return db[_0x4de0('0x47')][_0x4de0('0x50')]({'where':{'id':_0x5cefa0[_0x4de0('0x4e')]['id']}})[_0x4de0('0x2b')](handleEntityNotFound(_0xa96535,null))[_0x4de0('0x2b')](saveUpdates(_0x5cefa0['body'],null))['then'](respondWithResult(_0xa96535,null))['catch'](handleError(_0xa96535,null));};exports[_0x4de0('0x2c')]=function(_0x59bfce,_0x42da04){return db['ZendeskConfiguration']['find']({'where':{'id':_0x59bfce[_0x4de0('0x4e')]['id']}})[_0x4de0('0x2b')](handleEntityNotFound(_0x42da04,null))[_0x4de0('0x2b')](removeEntity(_0x42da04,null))[_0x4de0('0x22')](handleError(_0x42da04,null));};exports['getFields']=function(_0x5eef2c,_0x497683,_0x1f70af){var _0x40ec5c={};var _0x1d14c9={};var _0x527295;var _0xfc39d8;return db['ZendeskConfiguration'][_0x4de0('0x54')]({'where':{'id':_0x5eef2c['params']['id']}})[_0x4de0('0x2b')](handleEntityNotFound(_0x497683,null))[_0x4de0('0x2b')](function(_0x2b2d88){if(_0x2b2d88){_0x527295=_0x2b2d88;_0x1d14c9[_0x4de0('0x36')]=_[_0x4de0('0x37')](db[_0x4de0('0x55')][_0x4de0('0x33')]);_0x1d14c9[_0x4de0('0x38')]=_[_0x4de0('0x37')](_0x5eef2c[_0x4de0('0x38')]);_0x1d14c9[_0x4de0('0x39')]=_[_0x4de0('0x3a')](_0x1d14c9[_0x4de0('0x36')],_0x1d14c9['query']);_0x40ec5c['attributes']=_[_0x4de0('0x3a')](_0x1d14c9['model'],qs[_0x4de0('0x3c')](_0x5eef2c[_0x4de0('0x38')]['fields']));_0x40ec5c[_0x4de0('0x3b')]=_0x40ec5c[_0x4de0('0x3b')][_0x4de0('0x56')]?_0x40ec5c[_0x4de0('0x3b')]:_0x1d14c9[_0x4de0('0x36')];_0x40ec5c[_0x4de0('0x41')]=qs[_0x4de0('0x42')](_0x5eef2c[_0x4de0('0x38')][_0x4de0('0x42')]);_0x40ec5c['where']=qs[_0x4de0('0x39')](_[_0x4de0('0x44')](_0x5eef2c[_0x4de0('0x38')],_0x1d14c9[_0x4de0('0x39')]));if(_0x5eef2c[_0x4de0('0x38')][_0x4de0('0x45')]){_0x40ec5c[_0x4de0('0x43')]=_[_0x4de0('0x4f')](_0x40ec5c['where'],{'$or':_['map'](_0x40ec5c[_0x4de0('0x3b')],function(_0x2aef87){var _0x177f00={};_0x177f00[_0x2aef87]={'$like':'%'+_0x5eef2c[_0x4de0('0x38')][_0x4de0('0x45')]+'%'};return _0x177f00;})});}_0x40ec5c=_[_0x4de0('0x4f')]({},_0x40ec5c,_0x5eef2c['options']);return _0x527295[_0x4de0('0x57')](_0x40ec5c);}})[_0x4de0('0x2b')](function(_0x425c81){if(_0x425c81){_0xfc39d8=_0x425c81[_0x4de0('0x56')];if(!_0x5eef2c[_0x4de0('0x38')][_0x4de0('0x3d')](_0x4de0('0x3e'))){_0x40ec5c['limit']=qs[_0x4de0('0x3f')](_0x5eef2c[_0x4de0('0x38')][_0x4de0('0x3f')]);_0x40ec5c[_0x4de0('0x40')]=qs[_0x4de0('0x40')](_0x5eef2c[_0x4de0('0x38')][_0x4de0('0x40')]);}return _0x527295[_0x4de0('0x57')](_0x40ec5c);}})['then'](function(_0x1fade8){if(_0x1fade8){return _0x1fade8?{'count':_0xfc39d8,'rows':_0x1fade8}:null;}})['then'](respondWithResult(_0x497683,null))[_0x4de0('0x22')](handleError(_0x497683,null));};exports[_0x4de0('0x58')]=function(_0x2ee290,_0x489555,_0x6d5a23){var _0x18418f={};var _0x4bd8b3={};var _0x328852;var _0xd330ca;return db[_0x4de0('0x47')]['findOne']({'where':{'id':_0x2ee290['params']['id']}})[_0x4de0('0x2b')](handleEntityNotFound(_0x489555,null))[_0x4de0('0x2b')](function(_0x514b7b){if(_0x514b7b){_0x328852=_0x514b7b;_0x4bd8b3[_0x4de0('0x36')]=_[_0x4de0('0x37')](db[_0x4de0('0x55')][_0x4de0('0x33')]);_0x4bd8b3['query']=_[_0x4de0('0x37')](_0x2ee290[_0x4de0('0x38')]);_0x4bd8b3[_0x4de0('0x39')]=_[_0x4de0('0x3a')](_0x4bd8b3['model'],_0x4bd8b3[_0x4de0('0x38')]);_0x18418f[_0x4de0('0x3b')]=_[_0x4de0('0x3a')](_0x4bd8b3[_0x4de0('0x36')],qs[_0x4de0('0x3c')](_0x2ee290[_0x4de0('0x38')][_0x4de0('0x3c')]));_0x18418f[_0x4de0('0x3b')]=_0x18418f[_0x4de0('0x3b')][_0x4de0('0x56')]?_0x18418f['attributes']:_0x4bd8b3[_0x4de0('0x36')];_0x18418f[_0x4de0('0x41')]=qs[_0x4de0('0x42')](_0x2ee290[_0x4de0('0x38')][_0x4de0('0x42')]);_0x18418f[_0x4de0('0x43')]=qs[_0x4de0('0x39')](_['pick'](_0x2ee290[_0x4de0('0x38')],_0x4bd8b3[_0x4de0('0x39')]));if(_0x2ee290['query'][_0x4de0('0x45')]){_0x18418f[_0x4de0('0x43')]=_[_0x4de0('0x4f')](_0x18418f[_0x4de0('0x43')],{'$or':_[_0x4de0('0x32')](_0x18418f[_0x4de0('0x3b')],function(_0x3189f7){var _0x52800f={};_0x52800f[_0x3189f7]={'$like':'%'+_0x2ee290['query'][_0x4de0('0x45')]+'%'};return _0x52800f;})});}_0x18418f=_[_0x4de0('0x4f')]({},_0x18418f,_0x2ee290[_0x4de0('0x46')]);return _0x328852[_0x4de0('0x58')](_0x18418f);}})[_0x4de0('0x2b')](function(_0xa804d5){if(_0xa804d5){_0xd330ca=_0xa804d5['length'];if(!_0x2ee290[_0x4de0('0x38')][_0x4de0('0x3d')](_0x4de0('0x3e'))){_0x18418f[_0x4de0('0x3f')]=qs['limit'](_0x2ee290['query'][_0x4de0('0x3f')]);_0x18418f['offset']=qs[_0x4de0('0x40')](_0x2ee290[_0x4de0('0x38')][_0x4de0('0x40')]);}return _0x328852[_0x4de0('0x58')](_0x18418f);}})[_0x4de0('0x2b')](function(_0x14a6d8){if(_0x14a6d8){return _0x14a6d8?{'count':_0xd330ca,'rows':_0x14a6d8}:null;}})[_0x4de0('0x2b')](respondWithResult(_0x489555,null))[_0x4de0('0x22')](handleError(_0x489555,null));};exports[_0x4de0('0x59')]=function(_0x26374e,_0xc466b2,_0x4a3b49){var _0x233982={};var _0x4955dd={};var _0x2ff2cd;var _0x597229;return db[_0x4de0('0x47')][_0x4de0('0x54')]({'where':{'id':_0x26374e[_0x4de0('0x4e')]['id']}})[_0x4de0('0x2b')](handleEntityNotFound(_0xc466b2,null))[_0x4de0('0x2b')](function(_0x3df17a){if(_0x3df17a){_0x2ff2cd=_0x3df17a;_0x4955dd[_0x4de0('0x36')]=_[_0x4de0('0x37')](db[_0x4de0('0x55')][_0x4de0('0x33')]);_0x4955dd[_0x4de0('0x38')]=_[_0x4de0('0x37')](_0x26374e[_0x4de0('0x38')]);_0x4955dd[_0x4de0('0x39')]=_[_0x4de0('0x3a')](_0x4955dd[_0x4de0('0x36')],_0x4955dd[_0x4de0('0x38')]);_0x233982[_0x4de0('0x3b')]=_[_0x4de0('0x3a')](_0x4955dd[_0x4de0('0x36')],qs[_0x4de0('0x3c')](_0x26374e['query'][_0x4de0('0x3c')]));_0x233982[_0x4de0('0x3b')]=_0x233982['attributes'][_0x4de0('0x56')]?_0x233982[_0x4de0('0x3b')]:_0x4955dd[_0x4de0('0x36')];_0x233982[_0x4de0('0x41')]=qs[_0x4de0('0x42')](_0x26374e[_0x4de0('0x38')][_0x4de0('0x42')]);_0x233982[_0x4de0('0x43')]=qs[_0x4de0('0x39')](_[_0x4de0('0x44')](_0x26374e[_0x4de0('0x38')],_0x4955dd[_0x4de0('0x39')]));if(_0x26374e['query'][_0x4de0('0x45')]){_0x233982[_0x4de0('0x43')]=_[_0x4de0('0x4f')](_0x233982[_0x4de0('0x43')],{'$or':_[_0x4de0('0x32')](_0x233982[_0x4de0('0x3b')],function(_0x1386e5){var _0x5cd35d={};_0x5cd35d[_0x1386e5]={'$like':'%'+_0x26374e[_0x4de0('0x38')][_0x4de0('0x45')]+'%'};return _0x5cd35d;})});}_0x233982=_[_0x4de0('0x4f')]({},_0x233982,_0x26374e[_0x4de0('0x46')]);return _0x2ff2cd[_0x4de0('0x59')](_0x233982);}})['then'](function(_0x820808){if(_0x820808){_0x597229=_0x820808[_0x4de0('0x56')];if(!_0x26374e[_0x4de0('0x38')][_0x4de0('0x3d')]('nolimit')){_0x233982[_0x4de0('0x3f')]=qs[_0x4de0('0x3f')](_0x26374e['query']['limit']);_0x233982[_0x4de0('0x40')]=qs[_0x4de0('0x40')](_0x26374e['query'][_0x4de0('0x40')]);}return _0x2ff2cd[_0x4de0('0x59')](_0x233982);}})[_0x4de0('0x2b')](function(_0xa2e953){if(_0xa2e953){return _0xa2e953?{'count':_0x597229,'rows':_0xa2e953}:null;}})[_0x4de0('0x2b')](respondWithResult(_0xc466b2,null))[_0x4de0('0x22')](handleError(_0xc466b2,null));};exports[_0x4de0('0x5a')]=function(_0x2af70b,_0x257ee0,_0x5e1e87){var _0x1a576b={};var _0x165518={};var _0xd27a3;var _0x59cb20;return db[_0x4de0('0x47')]['findOne']({'where':{'id':_0x2af70b['params']['id']}})['then'](handleEntityNotFound(_0x257ee0,null))[_0x4de0('0x2b')](function(_0x3bea58){if(_0x3bea58){_0xd27a3=_0x3bea58;_0x165518[_0x4de0('0x36')]=_[_0x4de0('0x37')](db[_0x4de0('0x5b')]['rawAttributes']);_0x165518[_0x4de0('0x38')]=_[_0x4de0('0x37')](_0x2af70b[_0x4de0('0x38')]);_0x165518[_0x4de0('0x39')]=_[_0x4de0('0x3a')](_0x165518[_0x4de0('0x36')],_0x165518['query']);_0x1a576b[_0x4de0('0x3b')]=_[_0x4de0('0x3a')](_0x165518[_0x4de0('0x36')],qs[_0x4de0('0x3c')](_0x2af70b[_0x4de0('0x38')]['fields']));_0x1a576b[_0x4de0('0x3b')]=_0x1a576b['attributes']['length']?_0x1a576b[_0x4de0('0x3b')]:_0x165518[_0x4de0('0x36')];_0x1a576b[_0x4de0('0x41')]=qs[_0x4de0('0x42')](_0x2af70b[_0x4de0('0x38')][_0x4de0('0x42')]);_0x1a576b[_0x4de0('0x43')]=qs[_0x4de0('0x39')](_[_0x4de0('0x44')](_0x2af70b[_0x4de0('0x38')],_0x165518[_0x4de0('0x39')]));if(_0x2af70b['query']['filter']){_0x1a576b['where']=_[_0x4de0('0x4f')](_0x1a576b['where'],{'$or':_[_0x4de0('0x32')](_0x1a576b['attributes'],function(_0x3b72ab){var _0x556fd9={};_0x556fd9[_0x3b72ab]={'$like':'%'+_0x2af70b['query'][_0x4de0('0x45')]+'%'};return _0x556fd9;})});}_0x1a576b=_[_0x4de0('0x4f')]({},_0x1a576b,_0x2af70b[_0x4de0('0x46')]);return _0xd27a3[_0x4de0('0x5a')](_0x1a576b);}})[_0x4de0('0x2b')](function(_0x3d4c33){if(_0x3d4c33){_0x59cb20=_0x3d4c33[_0x4de0('0x56')];if(!_0x2af70b['query']['hasOwnProperty'](_0x4de0('0x3e'))){_0x1a576b[_0x4de0('0x3f')]=qs[_0x4de0('0x3f')](_0x2af70b[_0x4de0('0x38')][_0x4de0('0x3f')]);_0x1a576b['offset']=qs['offset'](_0x2af70b[_0x4de0('0x38')][_0x4de0('0x40')]);}return _0xd27a3['getTags'](_0x1a576b);}})[_0x4de0('0x2b')](function(_0x6f804f){if(_0x6f804f){return _0x6f804f?{'count':_0x59cb20,'rows':_0x6f804f}:null;}})['then'](respondWithResult(_0x257ee0,null))[_0x4de0('0x22')](handleError(_0x257ee0,null));};exports['setTags']=function(_0x23732c,_0x3c40e5,_0x143a40){if(_0x23732c['body']['id']){delete _0x23732c['body']['id'];}return db[_0x4de0('0x47')][_0x4de0('0x54')]({'where':{'id':_0x23732c[_0x4de0('0x4e')]['id']}})[_0x4de0('0x2b')](handleEntityNotFound(_0x3c40e5,null))[_0x4de0('0x2b')](function(_0x503f59){if(_0x503f59){return _0x503f59['setTags'](_0x23732c['body'][_0x4de0('0x5c')]||[]);}return null;})[_0x4de0('0x2b')](respondWithResult(_0x3c40e5,null))[_0x4de0('0x22')](handleError(_0x3c40e5,null));}; \ No newline at end of file +var _0x87fa=['zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','apply','save','update','sendStatus','stack','name','send','index','ZendeskConfiguration','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','show','length','include','find','create','body','params','getFields','findOne','ZendeskField','rawAttributes','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf'];(function(_0x387311,_0x124f97){var _0x4c8d4e=function(_0x46b2f9){while(--_0x46b2f9){_0x387311['push'](_0x387311['shift']());}};_0x4c8d4e(++_0x124f97);}(_0x87fa,0x10c));var _0xa87f=function(_0x3474d0,_0x22d867){_0x3474d0=_0x3474d0-0x0;var _0xe202c4=_0x87fa[_0x3474d0];return _0xe202c4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa87f('0x0'));var rimraf=require(_0xa87f('0x1'));var zipdir=require(_0xa87f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa87f('0x3'));var moment=require(_0xa87f('0x4'));var BPromise=require(_0xa87f('0x5'));var Mustache=require(_0xa87f('0x6'));var util=require('util');var path=require(_0xa87f('0x7'));var sox=require(_0xa87f('0x8'));var csv=require(_0xa87f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa87f('0xa'));var squel=require(_0xa87f('0xb'));var crypto=require(_0xa87f('0xc'));var jsforce=require(_0xa87f('0xd'));var deskjs=require(_0xa87f('0xe'));var toCsv=require(_0xa87f('0x9'));var querystring=require('querystring');var Papa=require(_0xa87f('0xf'));var Redis=require('ioredis');var authService=require(_0xa87f('0x10'));var qs=require(_0xa87f('0x11'));var as=require(_0xa87f('0x12'));var hardwareService=require(_0xa87f('0x13'));var logger=require(_0xa87f('0x14'))(_0xa87f('0x15'));var utils=require(_0xa87f('0x16'));var config=require(_0xa87f('0x17'));var licenseUtil=require(_0xa87f('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa87f('0x19'));var client=jayson[_0xa87f('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57e5ef,_0x804aee,_0x1b1d8c,_0x119062){return new BPromise(function(_0x32dca8,_0x4c5914){var _0x23c75f=_0x119062||client;return _0x23c75f['request'](_0x57e5ef,_0x1b1d8c)[_0xa87f('0x1b')](function(_0xe2fe5){logger[_0xa87f('0x1c')](_0xa87f('0x1d'),_0x804aee,_0xa87f('0x1e'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x804aee,'request\x20sent',JSON[_0xa87f('0x1f')](_0xe2fe5));if(_0xe2fe5['error']){if(_0xe2fe5[_0xa87f('0x20')][_0xa87f('0x21')]===0x1f4){logger[_0xa87f('0x20')](_0xa87f('0x1d'),_0x804aee,_0xe2fe5[_0xa87f('0x20')][_0xa87f('0x22')]);return _0x4c5914(_0xe2fe5['error'][_0xa87f('0x22')]);}logger['error'](_0xa87f('0x1d'),_0x804aee,_0xe2fe5[_0xa87f('0x20')]['message']);return _0x32dca8(_0xe2fe5['error'][_0xa87f('0x22')]);}else{logger[_0xa87f('0x1c')](_0xa87f('0x1d'),_0x804aee,_0xa87f('0x1e'));_0x32dca8(_0xe2fe5[_0xa87f('0x23')][_0xa87f('0x22')]);}})[_0xa87f('0x24')](function(_0x4c9bc2){logger[_0xa87f('0x20')](_0xa87f('0x1d'),_0x804aee,_0x4c9bc2);_0x4c5914(_0x4c9bc2);});});}function respondWithStatusCode(_0x33a2ce,_0x2878c7){_0x2878c7=_0x2878c7||0xcc;return function(_0x4fa966){if(_0x4fa966){return _0x33a2ce['sendStatus'](_0x2878c7);}return _0x33a2ce[_0xa87f('0x25')](_0x2878c7)[_0xa87f('0x26')]();};}function respondWithResult(_0x33b39e,_0x132995){_0x132995=_0x132995||0xc8;return function(_0x1840ce){if(_0x1840ce){return _0x33b39e[_0xa87f('0x25')](_0x132995)[_0xa87f('0x27')](_0x1840ce);}};}function respondWithFilteredResult(_0x369e26,_0xa9e7eb){return function(_0x1adf7b){if(_0x1adf7b){var _0x18b857=_0x1adf7b[_0xa87f('0x28')],_0x105ca2=_0xa9e7eb[_0xa87f('0x29')],_0x29b987=_0xa9e7eb['offset']+_0xa9e7eb[_0xa87f('0x2a')],_0x391e1c;if(_0x29b987>=_0x18b857){_0x29b987=_0x18b857;_0x391e1c=0xc8;}else{_0x391e1c=0xce;}_0x369e26[_0xa87f('0x25')](_0x391e1c);return _0x369e26['set']('Content-Range',_0x105ca2+'-'+_0x29b987+'/'+_0x18b857)[_0xa87f('0x27')](_0x1adf7b);}return null;};}function patchUpdates(_0x3d73cc){return function(_0x18ebfe){try{jsonpatch[_0xa87f('0x2b')](_0x18ebfe,_0x3d73cc,!![]);}catch(_0x53f090){return BPromise['reject'](_0x53f090);}return _0x18ebfe[_0xa87f('0x2c')]();};}function saveUpdates(_0x39f2c8,_0x36eca1){return function(_0x46d2dd){if(_0x46d2dd){return _0x46d2dd[_0xa87f('0x2d')](_0x39f2c8)[_0xa87f('0x1b')](function(_0x4deb29){return _0x4deb29;});}return null;};}function removeEntity(_0x239513,_0x241b57){return function(_0xa78777){if(_0xa78777){return _0xa78777['destroy']()[_0xa87f('0x1b')](function(){_0x239513[_0xa87f('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1521b5,_0x40cd48){return function(_0x337ea3){if(!_0x337ea3){_0x1521b5[_0xa87f('0x2e')](0x194);}return _0x337ea3;};}function handleError(_0x14cbac,_0x3d4f24){_0x3d4f24=_0x3d4f24||0x1f4;return function(_0x464b00){logger[_0xa87f('0x20')](_0x464b00[_0xa87f('0x2f')]);if(_0x464b00['name']){delete _0x464b00[_0xa87f('0x30')];}_0x14cbac['status'](_0x3d4f24)[_0xa87f('0x31')](_0x464b00);};}exports[_0xa87f('0x32')]=function(_0xa47d68,_0x445990){var _0x156c9c={},_0x5bb039={},_0x4aaf8b={'count':0x0,'rows':[]};var _0x179676=_['map'](db[_0xa87f('0x33')]['rawAttributes'],function(_0xcb226e){return{'name':_0xcb226e['fieldName'],'type':_0xcb226e[_0xa87f('0x34')][_0xa87f('0x35')]};});_0x5bb039[_0xa87f('0x36')]=_[_0xa87f('0x37')](_0x179676,_0xa87f('0x30'));_0x5bb039[_0xa87f('0x38')]=_[_0xa87f('0x39')](_0xa47d68['query']);_0x5bb039[_0xa87f('0x3a')]=_[_0xa87f('0x3b')](_0x5bb039[_0xa87f('0x36')],_0x5bb039[_0xa87f('0x38')]);_0x156c9c[_0xa87f('0x3c')]=_[_0xa87f('0x3b')](_0x5bb039['model'],qs['fields'](_0xa47d68[_0xa87f('0x38')][_0xa87f('0x3d')]));_0x156c9c['attributes']=_0x156c9c['attributes']['length']?_0x156c9c[_0xa87f('0x3c')]:_0x5bb039[_0xa87f('0x36')];if(!_0xa47d68[_0xa87f('0x38')]['hasOwnProperty'](_0xa87f('0x3e'))){_0x156c9c[_0xa87f('0x2a')]=qs['limit'](_0xa47d68[_0xa87f('0x38')][_0xa87f('0x2a')]);_0x156c9c['offset']=qs[_0xa87f('0x29')](_0xa47d68[_0xa87f('0x38')][_0xa87f('0x29')]);}_0x156c9c[_0xa87f('0x3f')]=qs[_0xa87f('0x40')](_0xa47d68[_0xa87f('0x38')][_0xa87f('0x40')]);_0x156c9c[_0xa87f('0x41')]=qs[_0xa87f('0x3a')](_[_0xa87f('0x42')](_0xa47d68[_0xa87f('0x38')],_0x5bb039[_0xa87f('0x3a')]),_0x179676);if(_0xa47d68['query'][_0xa87f('0x43')]){_0x156c9c['where']=_[_0xa87f('0x44')](_0x156c9c[_0xa87f('0x41')],{'$or':_[_0xa87f('0x37')](_0x179676,function(_0x27b68f){if(_0x27b68f[_0xa87f('0x34')]!==_0xa87f('0x45')){var _0x380d36={};_0x380d36[_0x27b68f[_0xa87f('0x30')]]={'$like':'%'+_0xa47d68[_0xa87f('0x38')][_0xa87f('0x43')]+'%'};return _0x380d36;}})});}_0x156c9c=_[_0xa87f('0x44')]({},_0x156c9c,_0xa47d68[_0xa87f('0x46')]);var _0x51e2d0={'where':_0x156c9c['where']};return db[_0xa87f('0x33')][_0xa87f('0x28')](_0x51e2d0)[_0xa87f('0x1b')](function(_0x397aae){_0x4aaf8b[_0xa87f('0x28')]=_0x397aae;if(_0xa47d68[_0xa87f('0x38')]['includeAll']){_0x156c9c['include']=[{'all':!![]}];}return db[_0xa87f('0x33')][_0xa87f('0x47')](_0x156c9c);})[_0xa87f('0x1b')](function(_0xc51066){_0x4aaf8b['rows']=_0xc51066;return _0x4aaf8b;})[_0xa87f('0x1b')](respondWithFilteredResult(_0x445990,_0x156c9c))[_0xa87f('0x24')](handleError(_0x445990,null));};exports[_0xa87f('0x48')]=function(_0x5e043c,_0x5209f2){var _0x50ad52={'raw':![],'where':{'id':_0x5e043c['params']['id']}},_0x507ba8={};_0x507ba8[_0xa87f('0x36')]=_[_0xa87f('0x39')](db[_0xa87f('0x33')]['rawAttributes']);_0x507ba8[_0xa87f('0x38')]=_['keys'](_0x5e043c[_0xa87f('0x38')]);_0x507ba8[_0xa87f('0x3a')]=_['intersection'](_0x507ba8[_0xa87f('0x36')],_0x507ba8[_0xa87f('0x38')]);_0x50ad52[_0xa87f('0x3c')]=_['intersection'](_0x507ba8[_0xa87f('0x36')],qs['fields'](_0x5e043c[_0xa87f('0x38')][_0xa87f('0x3d')]));_0x50ad52[_0xa87f('0x3c')]=_0x50ad52[_0xa87f('0x3c')][_0xa87f('0x49')]?_0x50ad52[_0xa87f('0x3c')]:_0x507ba8[_0xa87f('0x36')];if(_0x5e043c[_0xa87f('0x38')]['includeAll']){_0x50ad52[_0xa87f('0x4a')]=[{'all':!![]}];}_0x50ad52=_['merge']({},_0x50ad52,_0x5e043c[_0xa87f('0x46')]);return db[_0xa87f('0x33')][_0xa87f('0x4b')](_0x50ad52)[_0xa87f('0x1b')](handleEntityNotFound(_0x5209f2,null))['then'](respondWithResult(_0x5209f2,null))['catch'](handleError(_0x5209f2,null));};exports[_0xa87f('0x4c')]=function(_0x2bbf52,_0x4143c1){return db[_0xa87f('0x33')][_0xa87f('0x4c')](_0x2bbf52[_0xa87f('0x4d')],{})['then'](respondWithResult(_0x4143c1,0xc9))['catch'](handleError(_0x4143c1,null));};exports[_0xa87f('0x2d')]=function(_0x54dd13,_0x33f583){if(_0x54dd13[_0xa87f('0x4d')]['id']){delete _0x54dd13['body']['id'];}return db[_0xa87f('0x33')]['find']({'where':{'id':_0x54dd13[_0xa87f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x33f583,null))[_0xa87f('0x1b')](saveUpdates(_0x54dd13[_0xa87f('0x4d')],null))['then'](respondWithResult(_0x33f583,null))[_0xa87f('0x24')](handleError(_0x33f583,null));};exports['destroy']=function(_0x59becc,_0xa60a99){return db[_0xa87f('0x33')]['find']({'where':{'id':_0x59becc[_0xa87f('0x4e')]['id']}})[_0xa87f('0x1b')](handleEntityNotFound(_0xa60a99,null))[_0xa87f('0x1b')](removeEntity(_0xa60a99,null))[_0xa87f('0x24')](handleError(_0xa60a99,null));};exports[_0xa87f('0x4f')]=function(_0x812af5,_0x439e68,_0x4558b4){var _0x35cf17={};var _0x3ee398={};var _0x7fd32d;var _0x238edd;return db['ZendeskConfiguration'][_0xa87f('0x50')]({'where':{'id':_0x812af5[_0xa87f('0x4e')]['id']}})[_0xa87f('0x1b')](handleEntityNotFound(_0x439e68,null))['then'](function(_0x4772db){if(_0x4772db){_0x7fd32d=_0x4772db;_0x3ee398[_0xa87f('0x36')]=_[_0xa87f('0x39')](db[_0xa87f('0x51')][_0xa87f('0x52')]);_0x3ee398[_0xa87f('0x38')]=_[_0xa87f('0x39')](_0x812af5[_0xa87f('0x38')]);_0x3ee398['filters']=_[_0xa87f('0x3b')](_0x3ee398[_0xa87f('0x36')],_0x3ee398[_0xa87f('0x38')]);_0x35cf17['attributes']=_['intersection'](_0x3ee398['model'],qs[_0xa87f('0x3d')](_0x812af5['query']['fields']));_0x35cf17[_0xa87f('0x3c')]=_0x35cf17[_0xa87f('0x3c')][_0xa87f('0x49')]?_0x35cf17['attributes']:_0x3ee398[_0xa87f('0x36')];_0x35cf17[_0xa87f('0x3f')]=qs[_0xa87f('0x40')](_0x812af5['query']['sort']);_0x35cf17[_0xa87f('0x41')]=qs['filters'](_[_0xa87f('0x42')](_0x812af5[_0xa87f('0x38')],_0x3ee398[_0xa87f('0x3a')]));if(_0x812af5[_0xa87f('0x38')]['filter']){_0x35cf17[_0xa87f('0x41')]=_['merge'](_0x35cf17['where'],{'$or':_[_0xa87f('0x37')](_0x35cf17[_0xa87f('0x3c')],function(_0x48a241){var _0x1641ec={};_0x1641ec[_0x48a241]={'$like':'%'+_0x812af5[_0xa87f('0x38')][_0xa87f('0x43')]+'%'};return _0x1641ec;})});}_0x35cf17=_['merge']({},_0x35cf17,_0x812af5[_0xa87f('0x46')]);return _0x7fd32d[_0xa87f('0x4f')](_0x35cf17);}})['then'](function(_0x335f64){if(_0x335f64){_0x238edd=_0x335f64[_0xa87f('0x49')];if(!_0x812af5[_0xa87f('0x38')][_0xa87f('0x53')](_0xa87f('0x3e'))){_0x35cf17[_0xa87f('0x2a')]=qs[_0xa87f('0x2a')](_0x812af5[_0xa87f('0x38')]['limit']);_0x35cf17['offset']=qs[_0xa87f('0x29')](_0x812af5['query'][_0xa87f('0x29')]);}return _0x7fd32d[_0xa87f('0x4f')](_0x35cf17);}})[_0xa87f('0x1b')](function(_0x3b2f51){if(_0x3b2f51){return _0x3b2f51?{'count':_0x238edd,'rows':_0x3b2f51}:null;}})[_0xa87f('0x1b')](respondWithResult(_0x439e68,null))[_0xa87f('0x24')](handleError(_0x439e68,null));};exports[_0xa87f('0x54')]=function(_0x726e4e,_0x1725c9,_0x228cb3){var _0x16c918={};var _0x4f4af4={};var _0x24ea1e;var _0x375296;return db[_0xa87f('0x33')][_0xa87f('0x50')]({'where':{'id':_0x726e4e[_0xa87f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1725c9,null))[_0xa87f('0x1b')](function(_0x256a2e){if(_0x256a2e){_0x24ea1e=_0x256a2e;_0x4f4af4[_0xa87f('0x36')]=_[_0xa87f('0x39')](db[_0xa87f('0x51')]['rawAttributes']);_0x4f4af4[_0xa87f('0x38')]=_[_0xa87f('0x39')](_0x726e4e[_0xa87f('0x38')]);_0x4f4af4[_0xa87f('0x3a')]=_[_0xa87f('0x3b')](_0x4f4af4[_0xa87f('0x36')],_0x4f4af4[_0xa87f('0x38')]);_0x16c918['attributes']=_['intersection'](_0x4f4af4[_0xa87f('0x36')],qs[_0xa87f('0x3d')](_0x726e4e[_0xa87f('0x38')][_0xa87f('0x3d')]));_0x16c918[_0xa87f('0x3c')]=_0x16c918[_0xa87f('0x3c')][_0xa87f('0x49')]?_0x16c918['attributes']:_0x4f4af4[_0xa87f('0x36')];_0x16c918['order']=qs[_0xa87f('0x40')](_0x726e4e[_0xa87f('0x38')][_0xa87f('0x40')]);_0x16c918[_0xa87f('0x41')]=qs['filters'](_['pick'](_0x726e4e[_0xa87f('0x38')],_0x4f4af4[_0xa87f('0x3a')]));if(_0x726e4e[_0xa87f('0x38')][_0xa87f('0x43')]){_0x16c918[_0xa87f('0x41')]=_[_0xa87f('0x44')](_0x16c918[_0xa87f('0x41')],{'$or':_['map'](_0x16c918[_0xa87f('0x3c')],function(_0x74ef5e){var _0x30a1c4={};_0x30a1c4[_0x74ef5e]={'$like':'%'+_0x726e4e[_0xa87f('0x38')][_0xa87f('0x43')]+'%'};return _0x30a1c4;})});}_0x16c918=_['merge']({},_0x16c918,_0x726e4e[_0xa87f('0x46')]);return _0x24ea1e[_0xa87f('0x54')](_0x16c918);}})['then'](function(_0x51a65d){if(_0x51a65d){_0x375296=_0x51a65d[_0xa87f('0x49')];if(!_0x726e4e['query'][_0xa87f('0x53')](_0xa87f('0x3e'))){_0x16c918[_0xa87f('0x2a')]=qs[_0xa87f('0x2a')](_0x726e4e[_0xa87f('0x38')][_0xa87f('0x2a')]);_0x16c918[_0xa87f('0x29')]=qs[_0xa87f('0x29')](_0x726e4e[_0xa87f('0x38')][_0xa87f('0x29')]);}return _0x24ea1e[_0xa87f('0x54')](_0x16c918);}})[_0xa87f('0x1b')](function(_0x5c13bf){if(_0x5c13bf){return _0x5c13bf?{'count':_0x375296,'rows':_0x5c13bf}:null;}})[_0xa87f('0x1b')](respondWithResult(_0x1725c9,null))['catch'](handleError(_0x1725c9,null));};exports[_0xa87f('0x55')]=function(_0x2f596d,_0x367a93,_0x590119){var _0x5aaa48={};var _0x43007b={};var _0x2617d9;var _0x5bb283;return db[_0xa87f('0x33')]['findOne']({'where':{'id':_0x2f596d[_0xa87f('0x4e')]['id']}})[_0xa87f('0x1b')](handleEntityNotFound(_0x367a93,null))[_0xa87f('0x1b')](function(_0x52bcd8){if(_0x52bcd8){_0x2617d9=_0x52bcd8;_0x43007b[_0xa87f('0x36')]=_[_0xa87f('0x39')](db['ZendeskField']['rawAttributes']);_0x43007b[_0xa87f('0x38')]=_[_0xa87f('0x39')](_0x2f596d[_0xa87f('0x38')]);_0x43007b[_0xa87f('0x3a')]=_[_0xa87f('0x3b')](_0x43007b[_0xa87f('0x36')],_0x43007b['query']);_0x5aaa48[_0xa87f('0x3c')]=_['intersection'](_0x43007b['model'],qs['fields'](_0x2f596d[_0xa87f('0x38')][_0xa87f('0x3d')]));_0x5aaa48['attributes']=_0x5aaa48[_0xa87f('0x3c')][_0xa87f('0x49')]?_0x5aaa48[_0xa87f('0x3c')]:_0x43007b[_0xa87f('0x36')];_0x5aaa48[_0xa87f('0x3f')]=qs['sort'](_0x2f596d[_0xa87f('0x38')][_0xa87f('0x40')]);_0x5aaa48['where']=qs[_0xa87f('0x3a')](_['pick'](_0x2f596d['query'],_0x43007b[_0xa87f('0x3a')]));if(_0x2f596d[_0xa87f('0x38')]['filter']){_0x5aaa48[_0xa87f('0x41')]=_[_0xa87f('0x44')](_0x5aaa48[_0xa87f('0x41')],{'$or':_[_0xa87f('0x37')](_0x5aaa48[_0xa87f('0x3c')],function(_0x1195c5){var _0x18837d={};_0x18837d[_0x1195c5]={'$like':'%'+_0x2f596d[_0xa87f('0x38')][_0xa87f('0x43')]+'%'};return _0x18837d;})});}_0x5aaa48=_[_0xa87f('0x44')]({},_0x5aaa48,_0x2f596d[_0xa87f('0x46')]);return _0x2617d9[_0xa87f('0x55')](_0x5aaa48);}})[_0xa87f('0x1b')](function(_0x4bd00b){if(_0x4bd00b){_0x5bb283=_0x4bd00b['length'];if(!_0x2f596d[_0xa87f('0x38')][_0xa87f('0x53')](_0xa87f('0x3e'))){_0x5aaa48['limit']=qs[_0xa87f('0x2a')](_0x2f596d[_0xa87f('0x38')][_0xa87f('0x2a')]);_0x5aaa48[_0xa87f('0x29')]=qs[_0xa87f('0x29')](_0x2f596d[_0xa87f('0x38')]['offset']);}return _0x2617d9[_0xa87f('0x55')](_0x5aaa48);}})[_0xa87f('0x1b')](function(_0xfcd403){if(_0xfcd403){return _0xfcd403?{'count':_0x5bb283,'rows':_0xfcd403}:null;}})[_0xa87f('0x1b')](respondWithResult(_0x367a93,null))[_0xa87f('0x24')](handleError(_0x367a93,null));};exports[_0xa87f('0x56')]=function(_0x430bb9,_0x264aa6,_0x113046){var _0x1100fc={};var _0x49dbd9={};var _0x2f6c7b;var _0x3e86fc;return db[_0xa87f('0x33')][_0xa87f('0x50')]({'where':{'id':_0x430bb9[_0xa87f('0x4e')]['id']}})[_0xa87f('0x1b')](handleEntityNotFound(_0x264aa6,null))[_0xa87f('0x1b')](function(_0x1e52e6){if(_0x1e52e6){_0x2f6c7b=_0x1e52e6;_0x49dbd9[_0xa87f('0x36')]=_[_0xa87f('0x39')](db[_0xa87f('0x57')][_0xa87f('0x52')]);_0x49dbd9[_0xa87f('0x38')]=_[_0xa87f('0x39')](_0x430bb9[_0xa87f('0x38')]);_0x49dbd9[_0xa87f('0x3a')]=_[_0xa87f('0x3b')](_0x49dbd9[_0xa87f('0x36')],_0x49dbd9[_0xa87f('0x38')]);_0x1100fc[_0xa87f('0x3c')]=_[_0xa87f('0x3b')](_0x49dbd9[_0xa87f('0x36')],qs[_0xa87f('0x3d')](_0x430bb9[_0xa87f('0x38')][_0xa87f('0x3d')]));_0x1100fc['attributes']=_0x1100fc['attributes'][_0xa87f('0x49')]?_0x1100fc[_0xa87f('0x3c')]:_0x49dbd9[_0xa87f('0x36')];_0x1100fc['order']=qs[_0xa87f('0x40')](_0x430bb9[_0xa87f('0x38')]['sort']);_0x1100fc[_0xa87f('0x41')]=qs['filters'](_[_0xa87f('0x42')](_0x430bb9[_0xa87f('0x38')],_0x49dbd9[_0xa87f('0x3a')]));if(_0x430bb9['query']['filter']){_0x1100fc[_0xa87f('0x41')]=_[_0xa87f('0x44')](_0x1100fc['where'],{'$or':_[_0xa87f('0x37')](_0x1100fc[_0xa87f('0x3c')],function(_0x1e095a){var _0x2fb6eb={};_0x2fb6eb[_0x1e095a]={'$like':'%'+_0x430bb9[_0xa87f('0x38')][_0xa87f('0x43')]+'%'};return _0x2fb6eb;})});}_0x1100fc=_[_0xa87f('0x44')]({},_0x1100fc,_0x430bb9[_0xa87f('0x46')]);return _0x2f6c7b[_0xa87f('0x56')](_0x1100fc);}})[_0xa87f('0x1b')](function(_0x5500fc){if(_0x5500fc){_0x3e86fc=_0x5500fc[_0xa87f('0x49')];if(!_0x430bb9['query'][_0xa87f('0x53')]('nolimit')){_0x1100fc[_0xa87f('0x2a')]=qs[_0xa87f('0x2a')](_0x430bb9[_0xa87f('0x38')]['limit']);_0x1100fc[_0xa87f('0x29')]=qs['offset'](_0x430bb9['query']['offset']);}return _0x2f6c7b[_0xa87f('0x56')](_0x1100fc);}})['then'](function(_0x2b0136){if(_0x2b0136){return _0x2b0136?{'count':_0x3e86fc,'rows':_0x2b0136}:null;}})[_0xa87f('0x1b')](respondWithResult(_0x264aa6,null))[_0xa87f('0x24')](handleError(_0x264aa6,null));};exports[_0xa87f('0x58')]=function(_0x1fbd67,_0x3d7a6e,_0x30143f){if(_0x1fbd67[_0xa87f('0x4d')]['id']){delete _0x1fbd67[_0xa87f('0x4d')]['id'];}return db[_0xa87f('0x33')][_0xa87f('0x50')]({'where':{'id':_0x1fbd67[_0xa87f('0x4e')]['id']}})[_0xa87f('0x1b')](handleEntityNotFound(_0x3d7a6e,null))['then'](function(_0x5ebd74){if(_0x5ebd74){return _0x5ebd74[_0xa87f('0x58')](_0x1fbd67['body'][_0xa87f('0x59')]||[]);}return null;})['then'](respondWithResult(_0x3d7a6e,null))[_0xa87f('0x24')](handleError(_0x3d7a6e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 5dd2015..2151d8b 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 _0xbcb9=['ZendeskConfiguration','int_zendesk_configurations','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xbcb9,0x1a0));var _0x9bcb=function(_0x55e72d,_0x2d8182){_0x55e72d=_0x55e72d-0x0;var _0x3249aa=_0xbcb9[_0x55e72d];return _0x3249aa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9bcb('0x0'))('api');var moment=require('moment');var BPromise=require(_0x9bcb('0x1'));var rp=require(_0x9bcb('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9bcb('0x3'));var config=require(_0x9bcb('0x4'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x9bcb('0x5')]=function(_0x4d183d,_0x429c68){return _0x4d183d[_0x9bcb('0x6')](_0x9bcb('0x7'),attributes,{'tableName':_0x9bcb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2730=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','lodash','../../config/logger','api'];(function(_0x1a00b8,_0x5363fb){var _0x664a54=function(_0xaadc0c){while(--_0xaadc0c){_0x1a00b8['push'](_0x1a00b8['shift']());}};_0x664a54(++_0x5363fb);}(_0x2730,0x1e1));var _0x0273=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2730[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x0273('0x0'));var util=require('util');var logger=require(_0x0273('0x1'))(_0x0273('0x2'));var moment=require('moment');var BPromise=require(_0x0273('0x3'));var rp=require(_0x0273('0x4'));var fs=require('fs');var path=require(_0x0273('0x5'));var rimraf=require(_0x0273('0x6'));var config=require(_0x0273('0x7'));var attributes=require(_0x0273('0x8'));module['exports']=function(_0x16ff08,_0x154feb){return _0x16ff08[_0x0273('0x9')](_0x0273('0xa'),attributes,{'tableName':'int_zendesk_configurations','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 c6d8209..78d6ef2 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 _0xb5af=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0xb5af,0x1cb));var _0xfb5a=function(_0x105784,_0x205534){_0x105784=_0x105784-0x0;var _0x3c4aac=_0xb5af[_0x105784];return _0x3c4aac;};'use strict';var _=require(_0xfb5a('0x0'));var util=require(_0xfb5a('0x1'));var moment=require('moment');var BPromise=require(_0xfb5a('0x2'));var rs=require(_0xfb5a('0x3'));var fs=require('fs');var Redis=require(_0xfb5a('0x4'));var db=require(_0xfb5a('0x5'))['db'];var utils=require(_0xfb5a('0x6'));var logger=require(_0xfb5a('0x7'))(_0xfb5a('0x8'));var config=require(_0xfb5a('0x9'));var jayson=require(_0xfb5a('0xa'));var client=jayson[_0xfb5a('0xb')][_0xfb5a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x92dc47,_0x577640,_0x25ec44){return new BPromise(function(_0x20acc0,_0x1ffa18){return client['request'](_0x92dc47,_0x25ec44)[_0xfb5a('0xd')](function(_0x1aaacf){logger[_0xfb5a('0xe')](_0xfb5a('0xf'),_0x577640,_0xfb5a('0x10'));logger[_0xfb5a('0x11')](_0xfb5a('0x12'),_0x577640,_0xfb5a('0x10'),JSON[_0xfb5a('0x13')](_0x1aaacf));if(_0x1aaacf[_0xfb5a('0x14')]){if(_0x1aaacf['error'][_0xfb5a('0x15')]===0x1f4){logger[_0xfb5a('0x14')](_0xfb5a('0xf'),_0x577640,_0x1aaacf['error'][_0xfb5a('0x16')]);return _0x1ffa18(_0x1aaacf[_0xfb5a('0x14')][_0xfb5a('0x16')]);}logger[_0xfb5a('0x14')](_0xfb5a('0xf'),_0x577640,_0x1aaacf[_0xfb5a('0x14')][_0xfb5a('0x16')]);return _0x20acc0(_0x1aaacf[_0xfb5a('0x14')]['message']);}else{logger['info'](_0xfb5a('0xf'),_0x577640,_0xfb5a('0x10'));_0x20acc0(_0x1aaacf['result'][_0xfb5a('0x16')]);}})[_0xfb5a('0x17')](function(_0x1e9d06){logger[_0xfb5a('0x14')](_0xfb5a('0xf'),_0x577640,_0x1e9d06);_0x1ffa18(_0x1e9d06);});});} \ No newline at end of file +var _0xf77c=['stringify','error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2ae4b5,_0x2251e8){var _0x1fb3d3=function(_0x332919){while(--_0x332919){_0x2ae4b5['push'](_0x2ae4b5['shift']());}};_0x1fb3d3(++_0x2251e8);}(_0xf77c,0x16c));var _0xcf77=function(_0x28725b,_0x5f270a){_0x28725b=_0x28725b-0x0;var _0xc6c07c=_0xf77c[_0x28725b];return _0xc6c07c;};'use strict';var _=require(_0xcf77('0x0'));var util=require(_0xcf77('0x1'));var moment=require('moment');var BPromise=require(_0xcf77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf77('0x3'));var db=require(_0xcf77('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcf77('0x5'));var config=require(_0xcf77('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcf77('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50a88d,_0x30130f,_0x546f5d){return new BPromise(function(_0x45baa5,_0x32efbf){return client[_0xcf77('0x8')](_0x50a88d,_0x546f5d)[_0xcf77('0x9')](function(_0x360b77){logger[_0xcf77('0xa')](_0xcf77('0xb'),_0x30130f,_0xcf77('0xc'));logger['debug'](_0xcf77('0xd'),_0x30130f,'request\x20sent',JSON[_0xcf77('0xe')](_0x360b77));if(_0x360b77[_0xcf77('0xf')]){if(_0x360b77[_0xcf77('0xf')]['code']===0x1f4){logger['error'](_0xcf77('0xb'),_0x30130f,_0x360b77[_0xcf77('0xf')]['message']);return _0x32efbf(_0x360b77['error'][_0xcf77('0x10')]);}logger[_0xcf77('0xf')](_0xcf77('0xb'),_0x30130f,_0x360b77[_0xcf77('0xf')][_0xcf77('0x10')]);return _0x45baa5(_0x360b77[_0xcf77('0xf')][_0xcf77('0x10')]);}else{logger['info'](_0xcf77('0xb'),_0x30130f,_0xcf77('0xc'));_0x45baa5(_0x360b77['result']['message']);}})[_0xcf77('0x11')](function(_0x1830e6){logger[_0xcf77('0xf')](_0xcf77('0xb'),_0x30130f,_0x1830e6);_0x32efbf(_0x1830e6);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8dda387..dd72b40 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 _0xcb08=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','exports','multer','util','path','express'];(function(_0x41a21d,_0x406a7c){var _0x57216c=function(_0x43eab6){while(--_0x43eab6){_0x41a21d['push'](_0x41a21d['shift']());}};_0x57216c(++_0x406a7c);}(_0xcb08,0x1ea));var _0x8cb0=function(_0x54e082,_0x38d8df){_0x54e082=_0x54e082-0x0;var _0x460b06=_0xcb08[_0x54e082];return _0x460b06;};'use strict';var multer=require(_0x8cb0('0x0'));var util=require(_0x8cb0('0x1'));var path=require(_0x8cb0('0x2'));var timeout=require('connect-timeout');var express=require(_0x8cb0('0x3'));var router=express[_0x8cb0('0x4')]();var auth=require(_0x8cb0('0x5'));var interaction=require(_0x8cb0('0x6'));var config=require(_0x8cb0('0x7'));var controller=require(_0x8cb0('0x8'));router['get']('/',auth[_0x8cb0('0x9')](),controller[_0x8cb0('0xa')]);router[_0x8cb0('0xb')](_0x8cb0('0xc'),auth[_0x8cb0('0x9')](),controller['show']);router[_0x8cb0('0xd')]('/',auth[_0x8cb0('0x9')](),controller[_0x8cb0('0xe')]);router[_0x8cb0('0xf')](_0x8cb0('0xc'),auth[_0x8cb0('0x9')](),controller[_0x8cb0('0x10')]);router[_0x8cb0('0x11')](_0x8cb0('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x8cb0('0x12')]=router; \ No newline at end of file +var _0x1bf8=['exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1bf8,0x145));var _0x81bf=function(_0x43469f,_0x1476d8){_0x43469f=_0x43469f-0x0;var _0x18d4df=_0x1bf8[_0x43469f];return _0x18d4df;};'use strict';var multer=require(_0x81bf('0x0'));var util=require(_0x81bf('0x1'));var path=require(_0x81bf('0x2'));var timeout=require('connect-timeout');var express=require(_0x81bf('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x81bf('0x4'));var config=require(_0x81bf('0x5'));var controller=require(_0x81bf('0x6'));router[_0x81bf('0x7')]('/',auth[_0x81bf('0x8')](),controller[_0x81bf('0x9')]);router[_0x81bf('0x7')](_0x81bf('0xa'),auth[_0x81bf('0x8')](),controller[_0x81bf('0xb')]);router[_0x81bf('0xc')]('/',auth[_0x81bf('0x8')](),controller['create']);router[_0x81bf('0xd')]('/:id',auth[_0x81bf('0x8')](),controller[_0x81bf('0xe')]);router[_0x81bf('0xf')](_0x81bf('0xa'),auth[_0x81bf('0x8')](),controller[_0x81bf('0x10')]);module[_0x81bf('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index c131108..f9e610a 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 _0x5ad3=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x5b06b7,_0x5cdcaf){var _0x2e1422=function(_0xb6bd97){while(--_0xb6bd97){_0x5b06b7['push'](_0x5b06b7['shift']());}};_0x2e1422(++_0x5cdcaf);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0x5ad3[_0x421e36];return _0x20b3e3;};'use strict';var Sequelize=require(_0x35ad('0x0'));module[_0x35ad('0x1')]={'type':{'type':Sequelize[_0x35ad('0x2')](_0x35ad('0x3'),'variable',_0x35ad('0x4'),_0x35ad('0x5'),_0x35ad('0x6')),'defaultValue':_0x35ad('0x3')},'content':{'type':Sequelize[_0x35ad('0x7')]},'key':{'type':Sequelize[_0x35ad('0x7')]},'keyType':{'type':Sequelize[_0x35ad('0x2')](_0x35ad('0x3'),_0x35ad('0x8'),_0x35ad('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x35ad('0x7')]},'nameField':{'type':Sequelize[_0x35ad('0x7')]},'customField':{'type':Sequelize[_0x35ad('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x79a8=['STRING','customVariable','sequelize','ENUM','string','variable','keyValue'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x79a8,0x1d0));var _0x879a=function(_0x4cce8,_0x22d1fe){_0x4cce8=_0x4cce8-0x0;var _0x458440=_0x79a8[_0x4cce8];return _0x458440;};'use strict';var Sequelize=require(_0x879a('0x0'));module['exports']={'type':{'type':Sequelize[_0x879a('0x1')](_0x879a('0x2'),_0x879a('0x3'),'customVariable',_0x879a('0x4'),'picklist'),'defaultValue':_0x879a('0x2')},'content':{'type':Sequelize[_0x879a('0x5')]},'key':{'type':Sequelize[_0x879a('0x5')]},'keyType':{'type':Sequelize[_0x879a('0x1')](_0x879a('0x2'),_0x879a('0x3'),_0x879a('0x6'))},'keyContent':{'type':Sequelize[_0x879a('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x879a('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x879a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 5fc6691..09e33c4 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 _0x8952=['limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','ZendeskField','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x7b575e,_0x12dc3e){var _0x5a03e3=function(_0x5e25ff){while(--_0x5e25ff){_0x7b575e['push'](_0x7b575e['shift']());}};_0x5a03e3(++_0x12dc3e);}(_0x8952,0x17e));var _0x2895=function(_0x313cbd,_0x324c16){_0x313cbd=_0x313cbd-0x0;var _0x57224f=_0x8952[_0x313cbd];return _0x57224f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2895('0x0'));var rimraf=require(_0x2895('0x1'));var zipdir=require(_0x2895('0x2'));var jsonpatch=require(_0x2895('0x3'));var rp=require(_0x2895('0x4'));var moment=require('moment');var BPromise=require(_0x2895('0x5'));var Mustache=require(_0x2895('0x6'));var util=require(_0x2895('0x7'));var path=require('path');var sox=require(_0x2895('0x8'));var csv=require(_0x2895('0x9'));var ejs=require(_0x2895('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x9'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=_0x1d3659[_0x2895('0x18')],_0x6a5c7e=_0x1ae013[_0x2895('0x19')],_0x31bb7f=_0x1ae013[_0x2895('0x19')]+_0x1ae013[_0x2895('0x1a')],_0x3e96d7;if(_0x31bb7f>=_0x2627e6){_0x31bb7f=_0x2627e6;_0x3e96d7=0xc8;}else{_0x3e96d7=0xce;}_0x27b50e[_0x2895('0x16')](_0x3e96d7);return _0x27b50e[_0x2895('0x1b')](_0x2895('0x1c'),_0x6a5c7e+'-'+_0x31bb7f+'/'+_0x2627e6)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x1e8d47){return function(_0x5a8eab){try{jsonpatch['apply'](_0x5a8eab,_0x1e8d47,!![]);}catch(_0x493851){return BPromise[_0x2895('0x1d')](_0x493851);}return _0x5a8eab[_0x2895('0x1e')]();};}function saveUpdates(_0x3ec4da,_0x593e47){return function(_0x2813a3){if(_0x2813a3){return _0x2813a3[_0x2895('0x1f')](_0x3ec4da)[_0x2895('0x20')](function(_0x19228e){return _0x19228e;});}return null;};}function removeEntity(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x21')]()['then'](function(){_0x8b75e0[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x6f8ad4,_0x511286){return function(_0x4e884f){if(!_0x4e884f){_0x6f8ad4[_0x2895('0x15')](0x194);}return _0x4e884f;};}function handleError(_0x4569b5,_0x23b0eb){_0x23b0eb=_0x23b0eb||0x1f4;return function(_0x4a21cf){logger[_0x2895('0x23')](_0x4a21cf[_0x2895('0x24')]);if(_0x4a21cf['name']){delete _0x4a21cf[_0x2895('0x25')];}_0x4569b5[_0x2895('0x16')](_0x23b0eb)[_0x2895('0x26')](_0x4a21cf);};}exports['index']=function(_0x320661,_0x30f491){var _0x5eedfc={},_0x21f549={},_0x501898={'count':0x0,'rows':[]};var _0x5d70f5=_[_0x2895('0x27')](db['ZendeskField'][_0x2895('0x28')],function(_0x381538){return{'name':_0x381538['fieldName'],'type':_0x381538['type'][_0x2895('0x29')]};});_0x21f549[_0x2895('0x2a')]=_[_0x2895('0x27')](_0x5d70f5,_0x2895('0x25'));_0x21f549[_0x2895('0x2b')]=_[_0x2895('0x2c')](_0x320661[_0x2895('0x2b')]);_0x21f549['filters']=_[_0x2895('0x2d')](_0x21f549[_0x2895('0x2a')],_0x21f549[_0x2895('0x2b')]);_0x5eedfc['attributes']=_[_0x2895('0x2d')](_0x21f549[_0x2895('0x2a')],qs[_0x2895('0x2e')](_0x320661[_0x2895('0x2b')]['fields']));_0x5eedfc[_0x2895('0x2f')]=_0x5eedfc[_0x2895('0x2f')][_0x2895('0x30')]?_0x5eedfc[_0x2895('0x2f')]:_0x21f549[_0x2895('0x2a')];if(!_0x320661['query']['hasOwnProperty'](_0x2895('0x31'))){_0x5eedfc[_0x2895('0x1a')]=qs['limit'](_0x320661[_0x2895('0x2b')]['limit']);_0x5eedfc[_0x2895('0x19')]=qs[_0x2895('0x19')](_0x320661['query'][_0x2895('0x19')]);}_0x5eedfc['order']=qs[_0x2895('0x32')](_0x320661['query']['sort']);_0x5eedfc[_0x2895('0x33')]=qs[_0x2895('0x34')](_[_0x2895('0x35')](_0x320661['query'],_0x21f549[_0x2895('0x34')]),_0x5d70f5);if(_0x320661[_0x2895('0x2b')][_0x2895('0x36')]){_0x5eedfc[_0x2895('0x33')]=_[_0x2895('0x37')](_0x5eedfc[_0x2895('0x33')],{'$or':_[_0x2895('0x27')](_0x5d70f5,function(_0x240230){if(_0x240230[_0x2895('0x38')]!==_0x2895('0x39')){var _0x59b0e6={};_0x59b0e6[_0x240230[_0x2895('0x25')]]={'$like':'%'+_0x320661[_0x2895('0x2b')][_0x2895('0x36')]+'%'};return _0x59b0e6;}})});}_0x5eedfc=_[_0x2895('0x37')]({},_0x5eedfc,_0x320661[_0x2895('0x3a')]);var _0x12d7d8={'where':_0x5eedfc[_0x2895('0x33')]};return db['ZendeskField']['count'](_0x12d7d8)[_0x2895('0x20')](function(_0x29dc63){_0x501898[_0x2895('0x18')]=_0x29dc63;if(_0x320661[_0x2895('0x2b')][_0x2895('0x3b')]){_0x5eedfc[_0x2895('0x3c')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x5eedfc);})[_0x2895('0x20')](function(_0x20208f){_0x501898['rows']=_0x20208f;return _0x501898;})['then'](respondWithFilteredResult(_0x30f491,_0x5eedfc))[_0x2895('0x3d')](handleError(_0x30f491,null));};exports[_0x2895('0x3e')]=function(_0x3cc827,_0x28967f){var _0x2bac35={'raw':!![],'where':{'id':_0x3cc827['params']['id']}},_0x3e1d16={};_0x3e1d16[_0x2895('0x2a')]=_[_0x2895('0x2c')](db[_0x2895('0x3f')][_0x2895('0x28')]);_0x3e1d16['query']=_[_0x2895('0x2c')](_0x3cc827[_0x2895('0x2b')]);_0x3e1d16[_0x2895('0x34')]=_[_0x2895('0x2d')](_0x3e1d16['model'],_0x3e1d16['query']);_0x2bac35[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x3e1d16[_0x2895('0x2a')],qs[_0x2895('0x2e')](_0x3cc827[_0x2895('0x2b')]['fields']));_0x2bac35['attributes']=_0x2bac35[_0x2895('0x2f')][_0x2895('0x30')]?_0x2bac35[_0x2895('0x2f')]:_0x3e1d16[_0x2895('0x2a')];if(_0x3cc827[_0x2895('0x2b')][_0x2895('0x3b')]){_0x2bac35[_0x2895('0x3c')]=[{'all':!![]}];}_0x2bac35=_['merge']({},_0x2bac35,_0x3cc827[_0x2895('0x3a')]);return db[_0x2895('0x3f')][_0x2895('0x40')](_0x2bac35)[_0x2895('0x20')](handleEntityNotFound(_0x28967f,null))[_0x2895('0x20')](respondWithResult(_0x28967f,null))[_0x2895('0x3d')](handleError(_0x28967f,null));};exports[_0x2895('0x41')]=function(_0x299d71,_0x549059){return db[_0x2895('0x3f')][_0x2895('0x41')](_0x299d71[_0x2895('0x42')],{})['then'](respondWithResult(_0x549059,0xc9))[_0x2895('0x3d')](handleError(_0x549059,null));};exports[_0x2895('0x1f')]=function(_0x5e4f70,_0xbb09a6){if(_0x5e4f70[_0x2895('0x42')]['id']){delete _0x5e4f70[_0x2895('0x42')]['id'];}return db[_0x2895('0x3f')][_0x2895('0x40')]({'where':{'id':_0x5e4f70[_0x2895('0x43')]['id']}})[_0x2895('0x20')](handleEntityNotFound(_0xbb09a6,null))['then'](saveUpdates(_0x5e4f70[_0x2895('0x42')],null))[_0x2895('0x20')](respondWithResult(_0xbb09a6,null))['catch'](handleError(_0xbb09a6,null));};exports['destroy']=function(_0x574839,_0x212a1f){return db[_0x2895('0x3f')][_0x2895('0x40')]({'where':{'id':_0x574839[_0x2895('0x43')]['id']}})[_0x2895('0x20')](handleEntityNotFound(_0x212a1f,null))[_0x2895('0x20')](removeEntity(_0x212a1f,null))[_0x2895('0x3d')](handleError(_0x212a1f,null));}; \ No newline at end of file +var _0xda2d=['send','index','map','rawAttributes','type','key','model','query','keys','filters','length','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','ZendeskField','findAll','show','params','intersection','fields','includeAll','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack'];(function(_0x4559c8,_0x12b545){var _0x4cd9d2=function(_0x3ba15a){while(--_0x3ba15a){_0x4559c8['push'](_0x4559c8['shift']());}};_0x4cd9d2(++_0x12b545);}(_0xda2d,0x102));var _0xdda2=function(_0x4d7fe5,_0x17155a){_0x4d7fe5=_0x4d7fe5-0x0;var _0x3e3ed2=_0xda2d[_0x4d7fe5];return _0x3e3ed2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdda2('0x0'));var rimraf=require(_0xdda2('0x1'));var zipdir=require(_0xdda2('0x2'));var jsonpatch=require(_0xdda2('0x3'));var rp=require(_0xdda2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdda2('0x5'));var path=require(_0xdda2('0x6'));var sox=require(_0xdda2('0x7'));var csv=require(_0xdda2('0x8'));var ejs=require(_0xdda2('0x9'));var fs=require('fs');var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d25d,_0xa6446b){_0xa6446b=_0xa6446b||0xcc;return function(_0x320f73){if(_0x320f73){return _0x56d25d[_0xdda2('0x19')](_0xa6446b);}return _0x56d25d[_0xdda2('0x1a')](_0xa6446b)[_0xdda2('0x1b')]();};}function respondWithResult(_0x475222,_0x3490f1){_0x3490f1=_0x3490f1||0xc8;return function(_0x4df902){if(_0x4df902){return _0x475222[_0xdda2('0x1a')](_0x3490f1)['json'](_0x4df902);}};}function respondWithFilteredResult(_0xbef148,_0xb6b01e){return function(_0x3553d5){if(_0x3553d5){var _0x457764=_0x3553d5[_0xdda2('0x1c')],_0x1922b1=_0xb6b01e['offset'],_0x5d8a83=_0xb6b01e[_0xdda2('0x1d')]+_0xb6b01e[_0xdda2('0x1e')],_0x55d674;if(_0x5d8a83>=_0x457764){_0x5d8a83=_0x457764;_0x55d674=0xc8;}else{_0x55d674=0xce;}_0xbef148[_0xdda2('0x1a')](_0x55d674);return _0xbef148[_0xdda2('0x1f')](_0xdda2('0x20'),_0x1922b1+'-'+_0x5d8a83+'/'+_0x457764)[_0xdda2('0x21')](_0x3553d5);}return null;};}function patchUpdates(_0x3ca127){return function(_0x351151){try{jsonpatch[_0xdda2('0x22')](_0x351151,_0x3ca127,!![]);}catch(_0x337b0b){return BPromise[_0xdda2('0x23')](_0x337b0b);}return _0x351151[_0xdda2('0x24')]();};}function saveUpdates(_0x4eed30,_0x41fe7d){return function(_0x5dfce7){if(_0x5dfce7){return _0x5dfce7[_0xdda2('0x25')](_0x4eed30)[_0xdda2('0x26')](function(_0xf994dc){return _0xf994dc;});}return null;};}function removeEntity(_0x4c5226,_0x347ee6){return function(_0x5a9bb8){if(_0x5a9bb8){return _0x5a9bb8[_0xdda2('0x27')]()[_0xdda2('0x26')](function(){_0x4c5226['status'](0xcc)[_0xdda2('0x1b')]();});}};}function handleEntityNotFound(_0xfda248,_0x2528d7){return function(_0x13b0f3){if(!_0x13b0f3){_0xfda248[_0xdda2('0x19')](0x194);}return _0x13b0f3;};}function handleError(_0x5739ad,_0x38cdf){_0x38cdf=_0x38cdf||0x1f4;return function(_0x4be5ea){logger[_0xdda2('0x28')](_0x4be5ea[_0xdda2('0x29')]);if(_0x4be5ea['name']){delete _0x4be5ea['name'];}_0x5739ad[_0xdda2('0x1a')](_0x38cdf)[_0xdda2('0x2a')](_0x4be5ea);};}exports[_0xdda2('0x2b')]=function(_0x5e9e74,_0x90d919){var _0x5d26ae={},_0x2e755b={},_0xe53dee={'count':0x0,'rows':[]};var _0xe16ec7=_[_0xdda2('0x2c')](db['ZendeskField'][_0xdda2('0x2d')],function(_0x255bbc){return{'name':_0x255bbc['fieldName'],'type':_0x255bbc[_0xdda2('0x2e')][_0xdda2('0x2f')]};});_0x2e755b[_0xdda2('0x30')]=_[_0xdda2('0x2c')](_0xe16ec7,'name');_0x2e755b[_0xdda2('0x31')]=_[_0xdda2('0x32')](_0x5e9e74['query']);_0x2e755b[_0xdda2('0x33')]=_['intersection'](_0x2e755b[_0xdda2('0x30')],_0x2e755b['query']);_0x5d26ae['attributes']=_['intersection'](_0x2e755b[_0xdda2('0x30')],qs['fields'](_0x5e9e74[_0xdda2('0x31')]['fields']));_0x5d26ae['attributes']=_0x5d26ae['attributes'][_0xdda2('0x34')]?_0x5d26ae[_0xdda2('0x35')]:_0x2e755b[_0xdda2('0x30')];if(!_0x5e9e74[_0xdda2('0x31')][_0xdda2('0x36')](_0xdda2('0x37'))){_0x5d26ae[_0xdda2('0x1e')]=qs[_0xdda2('0x1e')](_0x5e9e74[_0xdda2('0x31')][_0xdda2('0x1e')]);_0x5d26ae['offset']=qs[_0xdda2('0x1d')](_0x5e9e74[_0xdda2('0x31')][_0xdda2('0x1d')]);}_0x5d26ae[_0xdda2('0x38')]=qs[_0xdda2('0x39')](_0x5e9e74[_0xdda2('0x31')][_0xdda2('0x39')]);_0x5d26ae['where']=qs['filters'](_[_0xdda2('0x3a')](_0x5e9e74[_0xdda2('0x31')],_0x2e755b[_0xdda2('0x33')]),_0xe16ec7);if(_0x5e9e74['query']['filter']){_0x5d26ae[_0xdda2('0x3b')]=_[_0xdda2('0x3c')](_0x5d26ae[_0xdda2('0x3b')],{'$or':_[_0xdda2('0x2c')](_0xe16ec7,function(_0x246001){if(_0x246001['type']!==_0xdda2('0x3d')){var _0x21fc6d={};_0x21fc6d[_0x246001['name']]={'$like':'%'+_0x5e9e74['query'][_0xdda2('0x3e')]+'%'};return _0x21fc6d;}})});}_0x5d26ae=_[_0xdda2('0x3c')]({},_0x5d26ae,_0x5e9e74[_0xdda2('0x3f')]);var _0x2708f4={'where':_0x5d26ae[_0xdda2('0x3b')]};return db['ZendeskField'][_0xdda2('0x1c')](_0x2708f4)[_0xdda2('0x26')](function(_0x7dac2c){_0xe53dee[_0xdda2('0x1c')]=_0x7dac2c;if(_0x5e9e74['query']['includeAll']){_0x5d26ae[_0xdda2('0x40')]=[{'all':!![]}];}return db[_0xdda2('0x41')][_0xdda2('0x42')](_0x5d26ae);})['then'](function(_0x1bb2a7){_0xe53dee['rows']=_0x1bb2a7;return _0xe53dee;})[_0xdda2('0x26')](respondWithFilteredResult(_0x90d919,_0x5d26ae))['catch'](handleError(_0x90d919,null));};exports[_0xdda2('0x43')]=function(_0x2bebab,_0x1db762){var _0x2eec64={'raw':!![],'where':{'id':_0x2bebab[_0xdda2('0x44')]['id']}},_0x57bd0e={};_0x57bd0e['model']=_[_0xdda2('0x32')](db['ZendeskField'][_0xdda2('0x2d')]);_0x57bd0e[_0xdda2('0x31')]=_[_0xdda2('0x32')](_0x2bebab[_0xdda2('0x31')]);_0x57bd0e[_0xdda2('0x33')]=_['intersection'](_0x57bd0e[_0xdda2('0x30')],_0x57bd0e[_0xdda2('0x31')]);_0x2eec64['attributes']=_[_0xdda2('0x45')](_0x57bd0e['model'],qs[_0xdda2('0x46')](_0x2bebab[_0xdda2('0x31')][_0xdda2('0x46')]));_0x2eec64[_0xdda2('0x35')]=_0x2eec64[_0xdda2('0x35')][_0xdda2('0x34')]?_0x2eec64[_0xdda2('0x35')]:_0x57bd0e[_0xdda2('0x30')];if(_0x2bebab[_0xdda2('0x31')][_0xdda2('0x47')]){_0x2eec64[_0xdda2('0x40')]=[{'all':!![]}];}_0x2eec64=_[_0xdda2('0x3c')]({},_0x2eec64,_0x2bebab[_0xdda2('0x3f')]);return db['ZendeskField']['find'](_0x2eec64)['then'](handleEntityNotFound(_0x1db762,null))[_0xdda2('0x26')](respondWithResult(_0x1db762,null))[_0xdda2('0x48')](handleError(_0x1db762,null));};exports['create']=function(_0x2c41dc,_0x18f229){return db[_0xdda2('0x41')]['create'](_0x2c41dc[_0xdda2('0x49')],{})[_0xdda2('0x26')](respondWithResult(_0x18f229,0xc9))['catch'](handleError(_0x18f229,null));};exports['update']=function(_0x37422b,_0x5efd20){if(_0x37422b[_0xdda2('0x49')]['id']){delete _0x37422b['body']['id'];}return db[_0xdda2('0x41')][_0xdda2('0x4a')]({'where':{'id':_0x37422b['params']['id']}})['then'](handleEntityNotFound(_0x5efd20,null))[_0xdda2('0x26')](saveUpdates(_0x37422b[_0xdda2('0x49')],null))[_0xdda2('0x26')](respondWithResult(_0x5efd20,null))[_0xdda2('0x48')](handleError(_0x5efd20,null));};exports['destroy']=function(_0x1edbc6,_0x3bba94){return db[_0xdda2('0x41')][_0xdda2('0x4a')]({'where':{'id':_0x1edbc6[_0xdda2('0x44')]['id']}})['then'](handleEntityNotFound(_0x3bba94,null))[_0xdda2('0x26')](removeEntity(_0x3bba94,null))[_0xdda2('0x48')](handleError(_0x3bba94,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 0bdb39c..1135e8b 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 _0x2cbd=['bluebird','path','rimraf','exports','define','int_zendesk_fields','idField','lodash','util','api','moment'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x2cbd[_0x5d8018];return _0x151ac4;};'use strict';var _=require(_0xd2cb('0x0'));var util=require(_0xd2cb('0x1'));var logger=require('../../config/logger')(_0xd2cb('0x2'));var moment=require(_0xd2cb('0x3'));var BPromise=require(_0xd2cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2cb('0x5'));var rimraf=require(_0xd2cb('0x6'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0xd2cb('0x7')]=function(_0x20ff39,_0x3894f9){return _0x20ff39[_0xd2cb('0x8')]('ZendeskField',attributes,{'tableName':_0xd2cb('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xd2cb('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x83e1=['lodash','util','api','bluebird','rimraf','../../config/environment','define','ZendeskField','zendesk_unique_index','idField','FieldId'];(function(_0x535aab,_0x51fd70){var _0x22afdd=function(_0x4e113c){while(--_0x4e113c){_0x535aab['push'](_0x535aab['shift']());}};_0x22afdd(++_0x51fd70);}(_0x83e1,0x1ad));var _0x183e=function(_0x1fe28f,_0xc753e6){_0x1fe28f=_0x1fe28f-0x0;var _0x304463=_0x83e1[_0x1fe28f];return _0x304463;};'use strict';var _=require(_0x183e('0x0'));var util=require(_0x183e('0x1'));var logger=require('../../config/logger')(_0x183e('0x2'));var moment=require('moment');var BPromise=require(_0x183e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x183e('0x4'));var config=require(_0x183e('0x5'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x4d7710,_0x2e3bbd){return _0x4d7710[_0x183e('0x6')](_0x183e('0x7'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x183e('0x8'),'fields':[_0x183e('0x9'),_0x183e('0xa')],'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 b3efc78..11e52ba 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 _0x6807=['rpc','../../config/environment','jayson/promise','client','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5c4849,_0x2e714a){var _0x5cc043=function(_0x225e74){while(--_0x225e74){_0x5c4849['push'](_0x5c4849['shift']());}};_0x5cc043(++_0x2e714a);}(_0x6807,0x169));var _0x7680=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x6807[_0x3305de];return _0x3b5a84;};'use strict';var _=require('lodash');var util=require(_0x7680('0x0'));var moment=require(_0x7680('0x1'));var BPromise=require('bluebird');var rs=require(_0x7680('0x2'));var fs=require('fs');var Redis=require(_0x7680('0x3'));var db=require(_0x7680('0x4'))['db'];var utils=require(_0x7680('0x5'));var logger=require(_0x7680('0x6'))(_0x7680('0x7'));var config=require(_0x7680('0x8'));var jayson=require(_0x7680('0x9'));var client=jayson[_0x7680('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9565da,_0x4bf84c,_0x211bb3){return new BPromise(function(_0x56b6e2,_0x1e6850){return client['request'](_0x9565da,_0x211bb3)[_0x7680('0xb')](function(_0x310b7a){logger[_0x7680('0xc')](_0x7680('0xd'),_0x4bf84c,_0x7680('0xe'));logger[_0x7680('0xf')](_0x7680('0x10'),_0x4bf84c,_0x7680('0xe'),JSON[_0x7680('0x11')](_0x310b7a));if(_0x310b7a[_0x7680('0x12')]){if(_0x310b7a[_0x7680('0x12')][_0x7680('0x13')]===0x1f4){logger['error'](_0x7680('0xd'),_0x4bf84c,_0x310b7a[_0x7680('0x12')][_0x7680('0x14')]);return _0x1e6850(_0x310b7a[_0x7680('0x12')]['message']);}logger[_0x7680('0x12')]('ZendeskField,\x20%s,\x20%s',_0x4bf84c,_0x310b7a[_0x7680('0x12')][_0x7680('0x14')]);return _0x56b6e2(_0x310b7a[_0x7680('0x12')][_0x7680('0x14')]);}else{logger[_0x7680('0xc')](_0x7680('0xd'),_0x4bf84c,_0x7680('0xe'));_0x56b6e2(_0x310b7a[_0x7680('0x15')]['message']);}})[_0x7680('0x16')](function(_0x563ba3){logger[_0x7680('0x12')]('ZendeskField,\x20%s,\x20%s',_0x4bf84c,_0x563ba3);_0x1e6850(_0x563ba3);});});} \ No newline at end of file +var _0xfd74=['jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x12bcb6,_0xd613a8){var _0x4ee45b=function(_0x34d575){while(--_0x34d575){_0x12bcb6['push'](_0x12bcb6['shift']());}};_0x4ee45b(++_0xd613a8);}(_0xfd74,0xde));var _0x4fd7=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0xfd74[_0x16dbfd];return _0x382254;};'use strict';var _=require(_0x4fd7('0x0'));var util=require(_0x4fd7('0x1'));var moment=require(_0x4fd7('0x2'));var BPromise=require(_0x4fd7('0x3'));var rs=require(_0x4fd7('0x4'));var fs=require('fs');var Redis=require(_0x4fd7('0x5'));var db=require(_0x4fd7('0x6'))['db'];var utils=require(_0x4fd7('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x4fd7('0x8'));var jayson=require(_0x4fd7('0x9'));var client=jayson[_0x4fd7('0xa')][_0x4fd7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cc5f3,_0xe375ba,_0x3964e5){return new BPromise(function(_0x3f8806,_0x9dd00d){return client[_0x4fd7('0xc')](_0x1cc5f3,_0x3964e5)[_0x4fd7('0xd')](function(_0x13e9c9){logger['info'](_0x4fd7('0xe'),_0xe375ba,'request\x20sent');logger[_0x4fd7('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0xe375ba,_0x4fd7('0x10'),JSON['stringify'](_0x13e9c9));if(_0x13e9c9[_0x4fd7('0x11')]){if(_0x13e9c9[_0x4fd7('0x11')][_0x4fd7('0x12')]===0x1f4){logger[_0x4fd7('0x11')](_0x4fd7('0xe'),_0xe375ba,_0x13e9c9['error'][_0x4fd7('0x13')]);return _0x9dd00d(_0x13e9c9['error'][_0x4fd7('0x13')]);}logger[_0x4fd7('0x11')](_0x4fd7('0xe'),_0xe375ba,_0x13e9c9['error'][_0x4fd7('0x13')]);return _0x3f8806(_0x13e9c9['error'][_0x4fd7('0x13')]);}else{logger[_0x4fd7('0x14')](_0x4fd7('0xe'),_0xe375ba,_0x4fd7('0x10'));_0x3f8806(_0x13e9c9['result'][_0x4fd7('0x13')]);}})['catch'](function(_0x96f469){logger[_0x4fd7('0x11')](_0x4fd7('0xe'),_0xe375ba,_0x96f469);_0x9dd00d(_0x96f469);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 444d0a0..df32969 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 _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x35afb7,_0x2ded44){var _0x277957=function(_0x548169){while(--_0x548169){_0x35afb7['push'](_0x35afb7['shift']());}};_0x277957(++_0x2ded44);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x2a80f1,_0x2bbfc0){var _0x388ef6=function(_0x305429){while(--_0x305429){_0x2a80f1['push'](_0x2a80f1['shift']());}};_0x388ef6(++_0x2bbfc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('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 d477e64..f56e365 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 _0x9f36=['exports','STRING','sequelize'];(function(_0x5ad0c6,_0x56ee17){var _0x167958=function(_0x32dd81){while(--_0x32dd81){_0x5ad0c6['push'](_0x5ad0c6['shift']());}};_0x167958(++_0x56ee17);}(_0x9f36,0x116));var _0x69f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9f36[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x69f3('0x0'));module[_0x69f3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x69f3('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x69f3('0x2')]},'clientId':{'type':Sequelize[_0x69f3('0x2')]},'clientSecret':{'type':Sequelize[_0x69f3('0x2')]},'serverUrl':{'type':Sequelize[_0x69f3('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x69f3('0x2')]},'refreshToken':{'type':Sequelize[_0x69f3('0x2')]}}; \ No newline at end of file +var _0xd5b6=['STRING'];(function(_0x381d3c,_0x4bc7d0){var _0x12542e=function(_0xc3e0c7){while(--_0xc3e0c7){_0x381d3c['push'](_0x381d3c['shift']());}};_0x12542e(++_0x4bc7d0);}(_0xd5b6,0x191));var _0x6d5b=function(_0x18acd1,_0xf9f53e){_0x18acd1=_0x18acd1-0x0;var _0x2c0015=_0xd5b6[_0x18acd1];return _0x2c0015;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6d5b('0x0')]},'host':{'type':Sequelize[_0x6d5b('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6d5b('0x0')]},'clientSecret':{'type':Sequelize[_0x6d5b('0x0')]},'serverUrl':{'type':Sequelize[_0x6d5b('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x6d5b('0x0')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index e17269d..957c922 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 _0xa35e=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','pick','nolimit','addConfiguration','AccountId','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','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','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Start_Time','Call_Type','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields','statusCode','html-pdf','rimraf','zip-dir'];(function(_0x47e561,_0x1f5906){var _0xe67452=function(_0x1a2f69){while(--_0x1a2f69){_0x47e561['push'](_0x47e561['shift']());}};_0xe67452(++_0x1f5906);}(_0xa35e,0x111));var _0xea35=function(_0xc5d22c,_0x2ac7d0){_0xc5d22c=_0xc5d22c-0x0;var _0x6a357a=_0xa35e[_0xc5d22c];return _0x6a357a;};'use strict';var pdf=require(_0xea35('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xea35('0x1'));var zipdir=require(_0xea35('0x2'));var jsonpatch=require(_0xea35('0x3'));var rp=require(_0xea35('0x4'));var moment=require(_0xea35('0x5'));var BPromise=require(_0xea35('0x6'));var Mustache=require(_0xea35('0x7'));var util=require(_0xea35('0x8'));var path=require(_0xea35('0x9'));var sox=require(_0xea35('0xa'));var csv=require(_0xea35('0xb'));var ejs=require(_0xea35('0xc'));var fs=require('fs');var _=require(_0xea35('0xd'));var squel=require(_0xea35('0xe'));var crypto=require('crypto');var jsforce=require(_0xea35('0xf'));var deskjs=require(_0xea35('0x10'));var toCsv=require(_0xea35('0xb'));var querystring=require('querystring');var Papa=require(_0xea35('0x11'));var Redis=require(_0xea35('0x12'));var authService=require(_0xea35('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xea35('0x14'));var hardwareService=require(_0xea35('0x15'));var logger=require(_0xea35('0x16'))(_0xea35('0x17'));var utils=require(_0xea35('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xea35('0x19'));var db=require(_0xea35('0x1a'))['db'];var integrations=require(_0xea35('0x1b'));var jayson=require('jayson/promise');var client=jayson['client'][_0xea35('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x420dc3,_0x10938a,_0xb5f9a8,_0x4907be){return new BPromise(function(_0x2c400a,_0x5d27f4){var _0x11f9ba=_0x4907be||client;return _0x11f9ba[_0xea35('0x1d')](_0x420dc3,_0xb5f9a8)['then'](function(_0x281846){logger[_0xea35('0x1e')](_0xea35('0x1f'),_0x10938a,_0xea35('0x20'));logger[_0xea35('0x21')](_0xea35('0x22'),_0x10938a,_0xea35('0x20'),JSON[_0xea35('0x23')](_0x281846));if(_0x281846[_0xea35('0x24')]){if(_0x281846[_0xea35('0x24')]['code']===0x1f4){logger[_0xea35('0x24')](_0xea35('0x1f'),_0x10938a,_0x281846[_0xea35('0x24')][_0xea35('0x25')]);return _0x5d27f4(_0x281846[_0xea35('0x24')]['message']);}logger[_0xea35('0x24')]('ZohoAccount,\x20%s,\x20%s',_0x10938a,_0x281846[_0xea35('0x24')][_0xea35('0x25')]);return _0x2c400a(_0x281846['error'][_0xea35('0x25')]);}else{logger[_0xea35('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x10938a,_0xea35('0x20'));_0x2c400a(_0x281846[_0xea35('0x26')][_0xea35('0x25')]);}})[_0xea35('0x27')](function(_0x42940b){logger[_0xea35('0x24')](_0xea35('0x1f'),_0x10938a,_0x42940b);_0x5d27f4(_0x42940b);});});}function respondWithStatusCode(_0x1cb455,_0x342749){_0x342749=_0x342749||0xcc;return function(_0x416d86){if(_0x416d86){return _0x1cb455[_0xea35('0x28')](_0x342749);}return _0x1cb455[_0xea35('0x29')](_0x342749)[_0xea35('0x2a')]();};}function respondWithResult(_0x49edd3,_0x5e6443){_0x5e6443=_0x5e6443||0xc8;return function(_0x53510d){if(_0x53510d){return _0x49edd3[_0xea35('0x29')](_0x5e6443)['json'](_0x53510d);}};}function respondWithFilteredResult(_0x56a63f,_0x27b55a){return function(_0x585d66){if(_0x585d66){var _0x454034=_0x585d66['count'],_0x24b56c=_0x27b55a[_0xea35('0x2b')],_0x119da7=_0x27b55a[_0xea35('0x2b')]+_0x27b55a[_0xea35('0x2c')],_0x16b032;if(_0x119da7>=_0x454034){_0x119da7=_0x454034;_0x16b032=0xc8;}else{_0x16b032=0xce;}_0x56a63f[_0xea35('0x29')](_0x16b032);return _0x56a63f['set'](_0xea35('0x2d'),_0x24b56c+'-'+_0x119da7+'/'+_0x454034)['json'](_0x585d66);}return null;};}function patchUpdates(_0x7385e4){return function(_0x1cb82a){try{jsonpatch[_0xea35('0x2e')](_0x1cb82a,_0x7385e4,!![]);}catch(_0x2ff076){return BPromise[_0xea35('0x2f')](_0x2ff076);}return _0x1cb82a[_0xea35('0x30')]();};}function saveUpdates(_0x32fe5f,_0x2e7b4d){return function(_0x5d3bb4){if(_0x5d3bb4){return _0x5d3bb4[_0xea35('0x31')](_0x32fe5f)[_0xea35('0x32')](function(_0x4d1947){return _0x4d1947;});}return null;};}function removeEntity(_0xef6b57,_0x579f7f){return function(_0x3adad1){if(_0x3adad1){return _0x3adad1[_0xea35('0x33')]()[_0xea35('0x32')](function(){_0xef6b57[_0xea35('0x29')](0xcc)[_0xea35('0x2a')]();});}};}function handleEntityNotFound(_0x27dd80,_0x211170){return function(_0x4aac9c){if(!_0x4aac9c){_0x27dd80['sendStatus'](0x194);}return _0x4aac9c;};}function handleError(_0x46e5bf,_0x334a7d){_0x334a7d=_0x334a7d||0x1f4;return function(_0x5dab24){logger[_0xea35('0x24')](_0x5dab24[_0xea35('0x34')]);if(_0x5dab24['name']){delete _0x5dab24[_0xea35('0x35')];}_0x46e5bf['status'](_0x334a7d)[_0xea35('0x36')](_0x5dab24);};}exports[_0xea35('0x37')]=function(_0x3c0707,_0x476309){var _0x3a7700={},_0x28e7c7={},_0x1ed54f={'count':0x0,'rows':[]};var _0x34f1d2=_[_0xea35('0x38')](db[_0xea35('0x39')][_0xea35('0x3a')],function(_0x5eb6fd){return{'name':_0x5eb6fd['fieldName'],'type':_0x5eb6fd[_0xea35('0x3b')][_0xea35('0x3c')]};});_0x28e7c7['model']=_['map'](_0x34f1d2,_0xea35('0x35'));_0x28e7c7[_0xea35('0x3d')]=_[_0xea35('0x3e')](_0x3c0707['query']);_0x28e7c7[_0xea35('0x3f')]=_['intersection'](_0x28e7c7['model'],_0x28e7c7[_0xea35('0x3d')]);_0x3a7700[_0xea35('0x40')]=_[_0xea35('0x41')](_0x28e7c7['model'],qs['fields'](_0x3c0707[_0xea35('0x3d')][_0xea35('0x42')]));_0x3a7700['attributes']=_0x3a7700[_0xea35('0x40')][_0xea35('0x43')]?_0x3a7700[_0xea35('0x40')]:_0x28e7c7[_0xea35('0x44')];if(!_0x3c0707[_0xea35('0x3d')][_0xea35('0x45')]('nolimit')){_0x3a7700[_0xea35('0x2c')]=qs[_0xea35('0x2c')](_0x3c0707['query'][_0xea35('0x2c')]);_0x3a7700[_0xea35('0x2b')]=qs[_0xea35('0x2b')](_0x3c0707[_0xea35('0x3d')][_0xea35('0x2b')]);}_0x3a7700[_0xea35('0x46')]=qs[_0xea35('0x47')](_0x3c0707['query'][_0xea35('0x47')]);_0x3a7700['where']=qs['filters'](_['pick'](_0x3c0707[_0xea35('0x3d')],_0x28e7c7[_0xea35('0x3f')]),_0x34f1d2);if(_0x3c0707[_0xea35('0x3d')][_0xea35('0x48')]){_0x3a7700[_0xea35('0x49')]=_['merge'](_0x3a7700[_0xea35('0x49')],{'$or':_[_0xea35('0x38')](_0x34f1d2,function(_0x365469){if(_0x365469[_0xea35('0x3b')]!=='VIRTUAL'){var _0x37cdca={};_0x37cdca[_0x365469[_0xea35('0x35')]]={'$like':'%'+_0x3c0707[_0xea35('0x3d')]['filter']+'%'};return _0x37cdca;}})});}_0x3a7700=_[_0xea35('0x4a')]({},_0x3a7700,_0x3c0707[_0xea35('0x4b')]);var _0x22bc38={'where':_0x3a7700[_0xea35('0x49')]};return db['ZohoAccount']['count'](_0x22bc38)[_0xea35('0x32')](function(_0x5b710d){_0x1ed54f['count']=_0x5b710d;if(_0x3c0707[_0xea35('0x3d')][_0xea35('0x4c')]){_0x3a7700[_0xea35('0x4d')]=[{'all':!![]}];}return db[_0xea35('0x39')][_0xea35('0x4e')](_0x3a7700);})['then'](function(_0x244285){_0x1ed54f[_0xea35('0x4f')]=_0x244285;return _0x1ed54f;})[_0xea35('0x32')](respondWithFilteredResult(_0x476309,_0x3a7700))[_0xea35('0x27')](handleError(_0x476309,null));};exports[_0xea35('0x50')]=function(_0x58a14f,_0x9a51ff){var _0x1ae9f2={'raw':![],'where':{'id':_0x58a14f[_0xea35('0x51')]['id']}},_0x55b557={};_0x55b557[_0xea35('0x44')]=_[_0xea35('0x3e')](db[_0xea35('0x39')]['rawAttributes']);_0x55b557[_0xea35('0x3d')]=_['keys'](_0x58a14f[_0xea35('0x3d')]);_0x55b557['filters']=_[_0xea35('0x41')](_0x55b557[_0xea35('0x44')],_0x55b557[_0xea35('0x3d')]);_0x1ae9f2[_0xea35('0x40')]=_[_0xea35('0x41')](_0x55b557[_0xea35('0x44')],qs['fields'](_0x58a14f[_0xea35('0x3d')]['fields']));_0x1ae9f2['attributes']=_0x1ae9f2[_0xea35('0x40')][_0xea35('0x43')]?_0x1ae9f2[_0xea35('0x40')]:_0x55b557[_0xea35('0x44')];if(_0x58a14f[_0xea35('0x3d')][_0xea35('0x4c')]){_0x1ae9f2[_0xea35('0x4d')]=[{'all':!![]}];}_0x1ae9f2=_['merge']({},_0x1ae9f2,_0x58a14f[_0xea35('0x4b')]);return db[_0xea35('0x39')][_0xea35('0x52')](_0x1ae9f2)['then'](handleEntityNotFound(_0x9a51ff,null))['then'](respondWithResult(_0x9a51ff,null))['catch'](handleError(_0x9a51ff,null));};exports[_0xea35('0x53')]=function(_0x3e3736,_0x265d00){return db[_0xea35('0x39')][_0xea35('0x53')](_0x3e3736[_0xea35('0x54')],{})['then'](respondWithResult(_0x265d00,0xc9))[_0xea35('0x27')](handleError(_0x265d00,null));};exports[_0xea35('0x31')]=function(_0x13a489,_0x22a642){if(_0x13a489[_0xea35('0x54')]['id']){delete _0x13a489['body']['id'];}return db[_0xea35('0x39')][_0xea35('0x52')]({'where':{'id':_0x13a489[_0xea35('0x51')]['id']}})[_0xea35('0x32')](handleEntityNotFound(_0x22a642,null))['then'](saveUpdates(_0x13a489[_0xea35('0x54')],null))[_0xea35('0x32')](respondWithResult(_0x22a642,null))[_0xea35('0x27')](handleError(_0x22a642,null));};exports['destroy']=function(_0x3b3fed,_0x4c06bf){return db[_0xea35('0x39')][_0xea35('0x52')]({'where':{'id':_0x3b3fed[_0xea35('0x51')]['id']}})[_0xea35('0x32')](handleEntityNotFound(_0x4c06bf,null))[_0xea35('0x32')](removeEntity(_0x4c06bf,null))[_0xea35('0x27')](handleError(_0x4c06bf,null));};exports[_0xea35('0x55')]=function(_0x2f4412,_0x3a17b9,_0x3a29bd){var _0x5be85d={};var _0x47c705={};var _0x44f676;var _0x4a897c;return db[_0xea35('0x39')][_0xea35('0x56')]({'where':{'id':_0x2f4412[_0xea35('0x51')]['id']}})[_0xea35('0x32')](handleEntityNotFound(_0x3a17b9,null))[_0xea35('0x32')](function(_0x1a5181){if(_0x1a5181){_0x44f676=_0x1a5181;_0x47c705[_0xea35('0x44')]=_[_0xea35('0x3e')](db['ZohoConfiguration'][_0xea35('0x3a')]);_0x47c705[_0xea35('0x3d')]=_[_0xea35('0x3e')](_0x2f4412['query']);_0x47c705['filters']=_[_0xea35('0x41')](_0x47c705[_0xea35('0x44')],_0x47c705[_0xea35('0x3d')]);_0x5be85d[_0xea35('0x40')]=_['intersection'](_0x47c705[_0xea35('0x44')],qs[_0xea35('0x42')](_0x2f4412[_0xea35('0x3d')]['fields']));_0x5be85d[_0xea35('0x40')]=_0x5be85d[_0xea35('0x40')][_0xea35('0x43')]?_0x5be85d[_0xea35('0x40')]:_0x47c705[_0xea35('0x44')];_0x5be85d['order']=qs[_0xea35('0x47')](_0x2f4412[_0xea35('0x3d')][_0xea35('0x47')]);_0x5be85d['where']=qs[_0xea35('0x3f')](_[_0xea35('0x57')](_0x2f4412[_0xea35('0x3d')],_0x47c705[_0xea35('0x3f')]));if(_0x2f4412['query']['filter']){_0x5be85d[_0xea35('0x49')]=_[_0xea35('0x4a')](_0x5be85d['where'],{'$or':_[_0xea35('0x38')](_0x5be85d[_0xea35('0x40')],function(_0x13f601){var _0x1ca5b4={};_0x1ca5b4[_0x13f601]={'$like':'%'+_0x2f4412[_0xea35('0x3d')]['filter']+'%'};return _0x1ca5b4;})});}_0x5be85d=_[_0xea35('0x4a')]({},_0x5be85d,_0x2f4412['options']);return _0x44f676[_0xea35('0x55')](_0x5be85d);}})['then'](function(_0x4af4ac){if(_0x4af4ac){_0x4a897c=_0x4af4ac['length'];if(!_0x2f4412['query'][_0xea35('0x45')](_0xea35('0x58'))){_0x5be85d[_0xea35('0x2c')]=qs[_0xea35('0x2c')](_0x2f4412[_0xea35('0x3d')][_0xea35('0x2c')]);_0x5be85d[_0xea35('0x2b')]=qs[_0xea35('0x2b')](_0x2f4412[_0xea35('0x3d')]['offset']);}return _0x44f676[_0xea35('0x55')](_0x5be85d);}})[_0xea35('0x32')](function(_0x2ca133){if(_0x2ca133){return _0x2ca133?{'count':_0x4a897c,'rows':_0x2ca133}:null;}})[_0xea35('0x32')](respondWithResult(_0x3a17b9,null))[_0xea35('0x27')](handleError(_0x3a17b9,null));};exports[_0xea35('0x59')]=function(_0x13b123,_0x5c2f84,_0x2ec49a){if(_0x13b123[_0xea35('0x54')]['id']){delete _0x13b123[_0xea35('0x54')]['id'];}return db['ZohoAccount'][_0xea35('0x56')]({'where':{'id':_0x13b123[_0xea35('0x51')]['id']}})['then'](handleEntityNotFound(_0x5c2f84,null))[_0xea35('0x32')](function(_0x49e120){if(_0x49e120){_0x13b123[_0xea35('0x54')][_0xea35('0x5a')]=_0x49e120['id'];_0x13b123[_0xea35('0x54')]['Subjects']=integrations['getSubjects'](_0x13b123[_0xea35('0x54')]['channel'],_0x13b123['body'][_0xea35('0x3b')]);_0x13b123[_0xea35('0x54')][_0xea35('0x5b')]=integrations[_0xea35('0x5c')](_0x13b123['body'][_0xea35('0x5d')],_0x13b123[_0xea35('0x54')]['type']);return db['ZohoConfiguration'][_0xea35('0x53')](_0x13b123[_0xea35('0x54')],{'include':[{'model':db[_0xea35('0x5e')],'as':'Subjects'},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5c2f84,null))[_0xea35('0x27')](handleError(_0x5c2f84,null));};function getAccessToken(_0x53d536){return new Promise(function(_0x1c012a,_0x2108f1){var _0x1fdd02;switch(_0x53d536[_0xea35('0x5f')]){case'US':_0x1fdd02=_0xea35('0x60');break;case'AU':_0x1fdd02=_0xea35('0x61');break;case'EU':_0x1fdd02='https://accounts.zoho.eu';break;case'IN':_0x1fdd02=_0xea35('0x62');break;case'CN':_0x1fdd02=_0xea35('0x63');break;default:_0x1fdd02='https://accounts.zoho.eu';break;}var _0x13a8b6={'method':_0xea35('0x64'),'uri':_0x1fdd02+_0xea35('0x65'),'qs':{'refresh_token':_0x53d536[_0xea35('0x66')],'client_id':_0x53d536[_0xea35('0x67')],'client_secret':_0x53d536[_0xea35('0x68')],'grant_type':_0xea35('0x69')},'json':!![]};return rp(_0x13a8b6)[_0xea35('0x32')](function(_0x11c546){if(_0x11c546[_0xea35('0x6a')]){_0x1c012a(_0x11c546[_0xea35('0x6a')]);}else{_0x2108f1(_0xea35('0x6b'));}})[_0xea35('0x27')](function(_0x15716e){_0x2108f1(_0x15716e);});});}exports['getFields']=function(_0x1608d4,_0xd1f8eb,_0x481762){var _0x464340,_0x49e3a7,_0x34d42c,_0x3664ed,_0x39ccb3;return db[_0xea35('0x39')][_0xea35('0x56')]({'where':{'id':_0x1608d4[_0xea35('0x51')]['id']},'attributes':['id',_0xea35('0x6c'),_0xea35('0x5f'),_0xea35('0x67'),_0xea35('0x68'),_0xea35('0x6d'),'code',_0xea35('0x66')]})[_0xea35('0x32')](handleEntityNotFound(_0xd1f8eb,null))[_0xea35('0x32')](function(_0x14daa0){_0x39ccb3=_0x14daa0;_0x464340=_0x39ccb3[_0xea35('0x6c')];_0x49e3a7=_0x464340===_0xea35('0x6e')?'eu':_0xea35('0x6f');_0x34d42c=_0x39ccb3[_0xea35('0x6d')];var _0x129438=_0x34d42c[_0xea35('0x70')](-0x1);if(_0x129438==='/'||_0x129438==='\x5c'||_0x129438===':'){_0x34d42c=_0x34d42c[_0xea35('0x71')](0x0,_0x34d42c[_0xea35('0x72')](_0x129438));}if(!_0x39ccb3[_0xea35('0x66')]){throw new Error(_0xea35('0x73'));}return getAccessToken(_0x39ccb3);})[_0xea35('0x32')](function(_0x403bf3){if(_0x403bf3){return rp({'method':_0xea35('0x74'),'uri':util[_0xea35('0x75')](_0xea35('0x76'),_0x49e3a7),'qs':{'module':_0xea35('0x77')},'headers':{'Authorization':_0xea35('0x78')+_0x403bf3},'json':!![]});}})[_0xea35('0x32')](function(_0x460078){if(_0x460078){if(_0x460078['response']&&_0x460078[_0xea35('0x79')]['error']){throw new Error(_0x460078['response'][_0xea35('0x24')][_0xea35('0x25')]);}var _0x5bcff1=[];var _0x1f825f=[];var _0x3dd02d=[_0xea35('0x7a'),_0xea35('0x7b'),'Description',_0xea35('0x7c'),'Call_Duration','Call_Result',_0xea35('0x7d'),_0xea35('0x7e')];_0x1f825f=_['remove'](_0x460078['fields'],function(_0x796bef){return _0x3dd02d[_0xea35('0x7f')](_0x796bef['api_name']);});for(var _0x1e719b=0x0;_0x1e719b<_0x1f825f[_0xea35('0x43')];_0x1e719b++){if(_0x1f825f[_0x1e719b][_0xea35('0x80')]===![]){_0x5bcff1[_0xea35('0x81')]({'id':_0x1f825f[_0x1e719b]['id'],'name':_0x1f825f[_0x1e719b][_0xea35('0x82')],'custom':_0x1f825f[_0x1e719b][_0xea35('0x83')],'options':_0x1f825f[_0x1e719b][_0xea35('0x84')]===_0xea35('0x85')&&_0x1f825f[_0x1e719b]['pick_list_values'][_0xea35('0x43')]>-0x1?_[_0xea35('0x38')](_0x1f825f[_0x1e719b][_0xea35('0x86')],function(_0x1a2c5c){return{'name':_0x1a2c5c,'value':_0x1a2c5c};}):[]});}}return{'count':_0x5bcff1[_0xea35('0x43')],'rows':_0x5bcff1};}else{return{'count':0x0,'rows':[]};}})[_0xea35('0x32')](respondWithResult(_0xd1f8eb,null))[_0xea35('0x27')](function(_0x14e0f9){var _0x16d1a1=_0x1608d4[_0xea35('0x3d')][_0xea35('0x87')]?0x1f4:_0x14e0f9['statusCode']||0x1f4;logger[_0xea35('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xea35('0x88'),_0x16d1a1,JSON[_0xea35('0x23')](_0x14e0f9));delete _0x14e0f9[_0xea35('0x35')];if(_0x16d1a1===0x191){_0x16d1a1=0x190;}_0xd1f8eb['status'](_0x16d1a1)['send'](_0x1608d4[_0xea35('0x3d')][_0xea35('0x87')]?{'message':'Wrong\x20credentials','statusCode':_0x14e0f9[_0xea35('0x89')]}:_0x14e0f9);});}; \ No newline at end of file +var _0x236c=['keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','ZohoAccount','includeAll','show','fields','include','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','pick','options','addConfiguration','AccountId','Subjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','code','refreshToken','zoho.eu','serverUrl','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','custom_field','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','count','offset','limit','Content-Range','json','reject','update','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x5206d4,_0x4cddaa){var _0x17e57f=function(_0x204674){while(--_0x204674){_0x5206d4['push'](_0x5206d4['shift']());}};_0x17e57f(++_0x4cddaa);}(_0x236c,0x155));var _0xc236=function(_0x16b981,_0x1838f6){_0x16b981=_0x16b981-0x0;var _0xf20218=_0x236c[_0x16b981];return _0xf20218;};'use strict';var pdf=require(_0xc236('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc236('0x1'));var zipdir=require(_0xc236('0x2'));var jsonpatch=require(_0xc236('0x3'));var rp=require(_0xc236('0x4'));var moment=require(_0xc236('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc236('0x6'));var util=require(_0xc236('0x7'));var path=require(_0xc236('0x8'));var sox=require(_0xc236('0x9'));var csv=require(_0xc236('0xa'));var ejs=require(_0xc236('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xc236('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6db6b9,_0x442095,_0x2184c9,_0x71bce2){return new BPromise(function(_0x5052db,_0x13a42b){var _0x55b188=_0x71bce2||client;return _0x55b188['request'](_0x6db6b9,_0x2184c9)[_0xc236('0x19')](function(_0x32f2fd){logger[_0xc236('0x1a')](_0xc236('0x1b'),_0x442095,_0xc236('0x1c'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x442095,'request\x20sent',JSON[_0xc236('0x1d')](_0x32f2fd));if(_0x32f2fd[_0xc236('0x1e')]){if(_0x32f2fd[_0xc236('0x1e')]['code']===0x1f4){logger[_0xc236('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x442095,_0x32f2fd['error'][_0xc236('0x1f')]);return _0x13a42b(_0x32f2fd[_0xc236('0x1e')][_0xc236('0x1f')]);}logger[_0xc236('0x1e')](_0xc236('0x1b'),_0x442095,_0x32f2fd[_0xc236('0x1e')][_0xc236('0x1f')]);return _0x5052db(_0x32f2fd[_0xc236('0x1e')][_0xc236('0x1f')]);}else{logger[_0xc236('0x1a')](_0xc236('0x1b'),_0x442095,'request\x20sent');_0x5052db(_0x32f2fd[_0xc236('0x20')][_0xc236('0x1f')]);}})[_0xc236('0x21')](function(_0xd18bd0){logger[_0xc236('0x1e')](_0xc236('0x1b'),_0x442095,_0xd18bd0);_0x13a42b(_0xd18bd0);});});}function respondWithStatusCode(_0x3a315b,_0xf921e6){_0xf921e6=_0xf921e6||0xcc;return function(_0x1d65e2){if(_0x1d65e2){return _0x3a315b[_0xc236('0x22')](_0xf921e6);}return _0x3a315b[_0xc236('0x23')](_0xf921e6)['end']();};}function respondWithResult(_0x308cd6,_0x21d78f){_0x21d78f=_0x21d78f||0xc8;return function(_0x356042){if(_0x356042){return _0x308cd6[_0xc236('0x23')](_0x21d78f)['json'](_0x356042);}};}function respondWithFilteredResult(_0x42f248,_0x5da4b2){return function(_0x5351bc){if(_0x5351bc){var _0x15ead8=_0x5351bc[_0xc236('0x24')],_0x4eace8=_0x5da4b2['offset'],_0x36e578=_0x5da4b2[_0xc236('0x25')]+_0x5da4b2[_0xc236('0x26')],_0x4f753c;if(_0x36e578>=_0x15ead8){_0x36e578=_0x15ead8;_0x4f753c=0xc8;}else{_0x4f753c=0xce;}_0x42f248['status'](_0x4f753c);return _0x42f248['set'](_0xc236('0x27'),_0x4eace8+'-'+_0x36e578+'/'+_0x15ead8)[_0xc236('0x28')](_0x5351bc);}return null;};}function patchUpdates(_0x1f4995){return function(_0x6ad83f){try{jsonpatch['apply'](_0x6ad83f,_0x1f4995,!![]);}catch(_0x4e3262){return BPromise[_0xc236('0x29')](_0x4e3262);}return _0x6ad83f['save']();};}function saveUpdates(_0x2c756f,_0x4ddc87){return function(_0x1a3409){if(_0x1a3409){return _0x1a3409[_0xc236('0x2a')](_0x2c756f)['then'](function(_0x5a5ec3){return _0x5a5ec3;});}return null;};}function removeEntity(_0x2537f9,_0x3053a3){return function(_0xbda858){if(_0xbda858){return _0xbda858[_0xc236('0x2b')]()[_0xc236('0x19')](function(){_0x2537f9[_0xc236('0x23')](0xcc)[_0xc236('0x2c')]();});}};}function handleEntityNotFound(_0x22a2ca,_0x3f58a0){return function(_0x4942d7){if(!_0x4942d7){_0x22a2ca['sendStatus'](0x194);}return _0x4942d7;};}function handleError(_0x5c151a,_0x1b4fb2){_0x1b4fb2=_0x1b4fb2||0x1f4;return function(_0xfda1f9){logger[_0xc236('0x1e')](_0xfda1f9[_0xc236('0x2d')]);if(_0xfda1f9[_0xc236('0x2e')]){delete _0xfda1f9[_0xc236('0x2e')];}_0x5c151a[_0xc236('0x23')](_0x1b4fb2)['send'](_0xfda1f9);};}exports[_0xc236('0x2f')]=function(_0x3f9b1d,_0xc77281){var _0x5057ff={},_0x40de85={},_0x2a8f33={'count':0x0,'rows':[]};var _0x3740c9=_[_0xc236('0x30')](db['ZohoAccount'][_0xc236('0x31')],function(_0x40ec71){return{'name':_0x40ec71[_0xc236('0x32')],'type':_0x40ec71[_0xc236('0x33')][_0xc236('0x34')]};});_0x40de85[_0xc236('0x35')]=_[_0xc236('0x30')](_0x3740c9,_0xc236('0x2e'));_0x40de85[_0xc236('0x36')]=_[_0xc236('0x37')](_0x3f9b1d[_0xc236('0x36')]);_0x40de85[_0xc236('0x38')]=_[_0xc236('0x39')](_0x40de85[_0xc236('0x35')],_0x40de85[_0xc236('0x36')]);_0x5057ff[_0xc236('0x3a')]=_[_0xc236('0x39')](_0x40de85['model'],qs['fields'](_0x3f9b1d['query']['fields']));_0x5057ff[_0xc236('0x3a')]=_0x5057ff['attributes'][_0xc236('0x3b')]?_0x5057ff[_0xc236('0x3a')]:_0x40de85[_0xc236('0x35')];if(!_0x3f9b1d[_0xc236('0x36')][_0xc236('0x3c')](_0xc236('0x3d'))){_0x5057ff[_0xc236('0x26')]=qs[_0xc236('0x26')](_0x3f9b1d[_0xc236('0x36')][_0xc236('0x26')]);_0x5057ff[_0xc236('0x25')]=qs[_0xc236('0x25')](_0x3f9b1d[_0xc236('0x36')][_0xc236('0x25')]);}_0x5057ff[_0xc236('0x3e')]=qs['sort'](_0x3f9b1d[_0xc236('0x36')][_0xc236('0x3f')]);_0x5057ff['where']=qs[_0xc236('0x38')](_['pick'](_0x3f9b1d[_0xc236('0x36')],_0x40de85['filters']),_0x3740c9);if(_0x3f9b1d[_0xc236('0x36')][_0xc236('0x40')]){_0x5057ff[_0xc236('0x41')]=_['merge'](_0x5057ff[_0xc236('0x41')],{'$or':_[_0xc236('0x30')](_0x3740c9,function(_0x1b8480){if(_0x1b8480['type']!==_0xc236('0x42')){var _0x169aee={};_0x169aee[_0x1b8480[_0xc236('0x2e')]]={'$like':'%'+_0x3f9b1d[_0xc236('0x36')][_0xc236('0x40')]+'%'};return _0x169aee;}})});}_0x5057ff=_[_0xc236('0x43')]({},_0x5057ff,_0x3f9b1d['options']);var _0x359f21={'where':_0x5057ff['where']};return db[_0xc236('0x44')][_0xc236('0x24')](_0x359f21)[_0xc236('0x19')](function(_0x2bd744){_0x2a8f33[_0xc236('0x24')]=_0x2bd744;if(_0x3f9b1d[_0xc236('0x36')][_0xc236('0x45')]){_0x5057ff['include']=[{'all':!![]}];}return db[_0xc236('0x44')]['findAll'](_0x5057ff);})[_0xc236('0x19')](function(_0x2f52b9){_0x2a8f33['rows']=_0x2f52b9;return _0x2a8f33;})[_0xc236('0x19')](respondWithFilteredResult(_0xc77281,_0x5057ff))[_0xc236('0x21')](handleError(_0xc77281,null));};exports[_0xc236('0x46')]=function(_0x161890,_0x181dd6){var _0x3bac04={'raw':![],'where':{'id':_0x161890['params']['id']}},_0x37bf72={};_0x37bf72['model']=_[_0xc236('0x37')](db[_0xc236('0x44')]['rawAttributes']);_0x37bf72[_0xc236('0x36')]=_[_0xc236('0x37')](_0x161890[_0xc236('0x36')]);_0x37bf72[_0xc236('0x38')]=_[_0xc236('0x39')](_0x37bf72[_0xc236('0x35')],_0x37bf72[_0xc236('0x36')]);_0x3bac04[_0xc236('0x3a')]=_[_0xc236('0x39')](_0x37bf72['model'],qs[_0xc236('0x47')](_0x161890[_0xc236('0x36')][_0xc236('0x47')]));_0x3bac04[_0xc236('0x3a')]=_0x3bac04[_0xc236('0x3a')][_0xc236('0x3b')]?_0x3bac04[_0xc236('0x3a')]:_0x37bf72['model'];if(_0x161890[_0xc236('0x36')][_0xc236('0x45')]){_0x3bac04[_0xc236('0x48')]=[{'all':!![]}];}_0x3bac04=_[_0xc236('0x43')]({},_0x3bac04,_0x161890['options']);return db[_0xc236('0x44')][_0xc236('0x49')](_0x3bac04)[_0xc236('0x19')](handleEntityNotFound(_0x181dd6,null))[_0xc236('0x19')](respondWithResult(_0x181dd6,null))[_0xc236('0x21')](handleError(_0x181dd6,null));};exports['create']=function(_0x38d504,_0x4a1251){return db[_0xc236('0x44')][_0xc236('0x4a')](_0x38d504[_0xc236('0x4b')],{})[_0xc236('0x19')](respondWithResult(_0x4a1251,0xc9))[_0xc236('0x21')](handleError(_0x4a1251,null));};exports['update']=function(_0x5929ef,_0x3bee67){if(_0x5929ef[_0xc236('0x4b')]['id']){delete _0x5929ef[_0xc236('0x4b')]['id'];}return db[_0xc236('0x44')][_0xc236('0x49')]({'where':{'id':_0x5929ef[_0xc236('0x4c')]['id']}})[_0xc236('0x19')](handleEntityNotFound(_0x3bee67,null))[_0xc236('0x19')](saveUpdates(_0x5929ef[_0xc236('0x4b')],null))[_0xc236('0x19')](respondWithResult(_0x3bee67,null))['catch'](handleError(_0x3bee67,null));};exports['destroy']=function(_0xd3bdff,_0x3a84b1){return db[_0xc236('0x44')][_0xc236('0x49')]({'where':{'id':_0xd3bdff['params']['id']}})[_0xc236('0x19')](handleEntityNotFound(_0x3a84b1,null))[_0xc236('0x19')](removeEntity(_0x3a84b1,null))['catch'](handleError(_0x3a84b1,null));};exports[_0xc236('0x4d')]=function(_0x3adb81,_0x445f03,_0x182618){var _0x5801d6={};var _0x1558dd={};var _0xec00da;var _0x35955c;return db[_0xc236('0x44')][_0xc236('0x4e')]({'where':{'id':_0x3adb81[_0xc236('0x4c')]['id']}})[_0xc236('0x19')](handleEntityNotFound(_0x445f03,null))['then'](function(_0x490a69){if(_0x490a69){_0xec00da=_0x490a69;_0x1558dd['model']=_[_0xc236('0x37')](db[_0xc236('0x4f')][_0xc236('0x31')]);_0x1558dd[_0xc236('0x36')]=_['keys'](_0x3adb81[_0xc236('0x36')]);_0x1558dd[_0xc236('0x38')]=_[_0xc236('0x39')](_0x1558dd['model'],_0x1558dd[_0xc236('0x36')]);_0x5801d6[_0xc236('0x3a')]=_[_0xc236('0x39')](_0x1558dd[_0xc236('0x35')],qs[_0xc236('0x47')](_0x3adb81[_0xc236('0x36')]['fields']));_0x5801d6['attributes']=_0x5801d6[_0xc236('0x3a')][_0xc236('0x3b')]?_0x5801d6[_0xc236('0x3a')]:_0x1558dd[_0xc236('0x35')];_0x5801d6[_0xc236('0x3e')]=qs[_0xc236('0x3f')](_0x3adb81[_0xc236('0x36')]['sort']);_0x5801d6['where']=qs['filters'](_[_0xc236('0x50')](_0x3adb81[_0xc236('0x36')],_0x1558dd[_0xc236('0x38')]));if(_0x3adb81[_0xc236('0x36')]['filter']){_0x5801d6['where']=_['merge'](_0x5801d6['where'],{'$or':_[_0xc236('0x30')](_0x5801d6['attributes'],function(_0x20a1eb){var _0x519e48={};_0x519e48[_0x20a1eb]={'$like':'%'+_0x3adb81[_0xc236('0x36')][_0xc236('0x40')]+'%'};return _0x519e48;})});}_0x5801d6=_[_0xc236('0x43')]({},_0x5801d6,_0x3adb81[_0xc236('0x51')]);return _0xec00da[_0xc236('0x4d')](_0x5801d6);}})[_0xc236('0x19')](function(_0x1d019d){if(_0x1d019d){_0x35955c=_0x1d019d['length'];if(!_0x3adb81[_0xc236('0x36')]['hasOwnProperty'](_0xc236('0x3d'))){_0x5801d6[_0xc236('0x26')]=qs[_0xc236('0x26')](_0x3adb81[_0xc236('0x36')][_0xc236('0x26')]);_0x5801d6[_0xc236('0x25')]=qs['offset'](_0x3adb81[_0xc236('0x36')][_0xc236('0x25')]);}return _0xec00da['getConfigurations'](_0x5801d6);}})[_0xc236('0x19')](function(_0x5f33ec){if(_0x5f33ec){return _0x5f33ec?{'count':_0x35955c,'rows':_0x5f33ec}:null;}})[_0xc236('0x19')](respondWithResult(_0x445f03,null))['catch'](handleError(_0x445f03,null));};exports[_0xc236('0x52')]=function(_0x45fe5a,_0x5897a1,_0x2c8f89){if(_0x45fe5a[_0xc236('0x4b')]['id']){delete _0x45fe5a[_0xc236('0x4b')]['id'];}return db[_0xc236('0x44')][_0xc236('0x4e')]({'where':{'id':_0x45fe5a[_0xc236('0x4c')]['id']}})[_0xc236('0x19')](handleEntityNotFound(_0x5897a1,null))[_0xc236('0x19')](function(_0x3de937){if(_0x3de937){_0x45fe5a['body'][_0xc236('0x53')]=_0x3de937['id'];_0x45fe5a[_0xc236('0x4b')][_0xc236('0x54')]=integrations['getSubjects'](_0x45fe5a[_0xc236('0x4b')][_0xc236('0x55')],_0x45fe5a[_0xc236('0x4b')][_0xc236('0x33')]);_0x45fe5a['body'][_0xc236('0x56')]=integrations['getDescriptions'](_0x45fe5a[_0xc236('0x4b')]['channel'],_0x45fe5a[_0xc236('0x4b')][_0xc236('0x33')]);return db['ZohoConfiguration']['create'](_0x45fe5a['body'],{'include':[{'model':db[_0xc236('0x57')],'as':'Subjects'},{'model':db[_0xc236('0x57')],'as':_0xc236('0x56')}]});}return null;})['then'](respondWithResult(_0x5897a1,null))[_0xc236('0x21')](handleError(_0x5897a1,null));};function getAccessToken(_0x2e0009){return new Promise(function(_0x4d7e8d,_0xdbeea2){var _0x2181aa;switch(_0x2e0009[_0xc236('0x58')]){case'US':_0x2181aa=_0xc236('0x59');break;case'AU':_0x2181aa='https://accounts.zoho.com.au';break;case'EU':_0x2181aa=_0xc236('0x5a');break;case'IN':_0x2181aa=_0xc236('0x5b');break;case'CN':_0x2181aa=_0xc236('0x5c');break;default:_0x2181aa=_0xc236('0x5a');break;}var _0x93aa0f={'method':_0xc236('0x5d'),'uri':_0x2181aa+_0xc236('0x5e'),'qs':{'refresh_token':_0x2e0009['refreshToken'],'client_id':_0x2e0009['clientId'],'client_secret':_0x2e0009[_0xc236('0x5f')],'grant_type':_0xc236('0x60')},'json':!![]};return rp(_0x93aa0f)[_0xc236('0x19')](function(_0x41edb8){if(_0x41edb8[_0xc236('0x61')]){_0x4d7e8d(_0x41edb8[_0xc236('0x61')]);}else{_0xdbeea2(_0xc236('0x62'));}})[_0xc236('0x21')](function(_0x4df1a5){_0xdbeea2(_0x4df1a5);});});}exports['getFields']=function(_0x2c037a,_0x47cd85,_0x35e0d8){var _0x1c4835,_0x25d982,_0x598397,_0x15ffa6,_0x4b0345;return db[_0xc236('0x44')][_0xc236('0x4e')]({'where':{'id':_0x2c037a[_0xc236('0x4c')]['id']},'attributes':['id',_0xc236('0x63'),'zone',_0xc236('0x64'),_0xc236('0x5f'),'serverUrl',_0xc236('0x65'),_0xc236('0x66')]})[_0xc236('0x19')](handleEntityNotFound(_0x47cd85,null))[_0xc236('0x19')](function(_0x11684e){_0x4b0345=_0x11684e;_0x1c4835=_0x4b0345[_0xc236('0x63')];_0x25d982=_0x1c4835===_0xc236('0x67')?'eu':'com';_0x598397=_0x4b0345[_0xc236('0x68')];var _0x40350d=_0x598397[_0xc236('0x69')](-0x1);if(_0x40350d==='/'||_0x40350d==='\x5c'||_0x40350d===':'){_0x598397=_0x598397[_0xc236('0x6a')](0x0,_0x598397['lastIndexOf'](_0x40350d));}if(!_0x4b0345[_0xc236('0x66')]){throw new Error(_0xc236('0x6b'));}return getAccessToken(_0x4b0345);})['then'](function(_0x40fd6d){if(_0x40fd6d){return rp({'method':'GET','uri':util[_0xc236('0x6c')](_0xc236('0x6d'),_0x25d982),'qs':{'module':'Calls'},'headers':{'Authorization':_0xc236('0x6e')+_0x40fd6d},'json':!![]});}})[_0xc236('0x19')](function(_0x5dd792){if(_0x5dd792){if(_0x5dd792['response']&&_0x5dd792[_0xc236('0x6f')][_0xc236('0x1e')]){throw new Error(_0x5dd792[_0xc236('0x6f')][_0xc236('0x1e')][_0xc236('0x1f')]);}var _0x17ce2d=[];var _0x5ef38a=[];var _0x155308=[_0xc236('0x70'),_0xc236('0x71'),_0xc236('0x72'),'WhoId',_0xc236('0x73'),_0xc236('0x74'),_0xc236('0x75'),_0xc236('0x76')];_0x5ef38a=_[_0xc236('0x77')](_0x5dd792['fields'],function(_0x485261){return _0x155308[_0xc236('0x78')](_0x485261['api_name']);});for(var _0x143d2e=0x0;_0x143d2e<_0x5ef38a[_0xc236('0x3b')];_0x143d2e++){if(_0x5ef38a[_0x143d2e][_0xc236('0x79')]===![]){_0x17ce2d[_0xc236('0x7a')]({'id':_0x5ef38a[_0x143d2e]['id'],'name':_0x5ef38a[_0x143d2e]['display_label'],'custom':_0x5ef38a[_0x143d2e][_0xc236('0x7b')],'options':_0x5ef38a[_0x143d2e]['data_type']===_0xc236('0x7c')&&_0x5ef38a[_0x143d2e]['pick_list_values'][_0xc236('0x3b')]>-0x1?_[_0xc236('0x30')](_0x5ef38a[_0x143d2e][_0xc236('0x7d')],function(_0x461341){return{'name':_0x461341,'value':_0x461341};}):[]});}}return{'count':_0x17ce2d[_0xc236('0x3b')],'rows':_0x17ce2d};}else{return{'count':0x0,'rows':[]};}})[_0xc236('0x19')](respondWithResult(_0x47cd85,null))[_0xc236('0x21')](function(_0x1c9f87){var _0x21da06=_0x2c037a['query']['test']?0x1f4:_0x1c9f87[_0xc236('0x7e')]||0x1f4;logger[_0xc236('0x1e')](_0xc236('0x7f'),_0xc236('0x80'),_0x21da06,JSON[_0xc236('0x1d')](_0x1c9f87));delete _0x1c9f87[_0xc236('0x2e')];if(_0x21da06===0x191){_0x21da06=0x190;}_0x47cd85['status'](_0x21da06)[_0xc236('0x81')](_0x2c037a[_0xc236('0x36')][_0xc236('0x82')]?{'message':_0xc236('0x83'),'statusCode':_0x1c9f87[_0xc236('0x7e')]}:_0x1c9f87);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 573f2df..19fee71 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 _0x0181=['authorization_code','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','api','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','changed','serverUrl','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST'];(function(_0x4c7d8b,_0x572388){var _0x187158=function(_0x5e956d){while(--_0x5e956d){_0x4c7d8b['push'](_0x4c7d8b['shift']());}};_0x187158(++_0x572388);}(_0x0181,0x80));var _0x1018=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x0181[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0x1018('0x0'));var util=require(_0x1018('0x1'));var logger=require('../../config/logger')(_0x1018('0x2'));var moment=require('moment');var BPromise=require(_0x1018('0x3'));var rp=require(_0x1018('0x4'));var fs=require('fs');var path=require(_0x1018('0x5'));var rimraf=require('rimraf');var config=require(_0x1018('0x6'));var attributes=require(_0x1018('0x7'));var integrations=require(_0x1018('0x8'));module['exports']=function(_0x2c9c4c,_0x962186){return _0x2c9c4c[_0x1018('0x9')](_0x1018('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x317ccd,_0x1362fa,_0x20569d){if(_0x317ccd[_0x1018('0xb')]('zone')||_0x317ccd[_0x1018('0xb')](_0x1018('0xc'))||_0x317ccd['changed']('clientId')||_0x317ccd['changed'](_0x1018('0xd'))||_0x317ccd[_0x1018('0xb')](_0x1018('0xe'))||_0x317ccd[_0x1018('0xb')](_0x1018('0xf'))){var _0x2ea3b6,_0x172879;_0x2ea3b6=_0x317ccd[_0x1018('0xc')];var _0xaf1876=_0x2ea3b6[_0x1018('0x10')](-0x1);if(_0xaf1876==='/'||_0xaf1876==='\x5c'||_0xaf1876===':'){_0x2ea3b6=_0x2ea3b6[_0x1018('0x11')](0x0,_0x2ea3b6[_0x1018('0x12')](_0xaf1876));}switch(_0x317ccd[_0x1018('0x13')]){case'US':_0x172879=_0x1018('0x14');break;case'AU':_0x172879='https://accounts.zoho.com.au';break;case'IN':_0x172879=_0x1018('0x15');break;case'CN':_0x172879=_0x1018('0x16');break;default:_0x172879='https://accounts.zoho.eu';break;}var _0x568878={'method':'POST','uri':_0x172879+_0x1018('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x317ccd[_0x1018('0x18')],'client_secret':_0x317ccd[_0x1018('0xd')],'redirect_uri':_0x317ccd[_0x1018('0xc')],'code':_0x317ccd[_0x1018('0xe')]},'headers':{'Content-Type':_0x1018('0x19')}};return rp(_0x568878)[_0x1018('0x1a')](function(_0x4d89a5){var _0x3ac085=JSON[_0x1018('0x1b')](_0x4d89a5);if(_0x3ac085[_0x1018('0x1c')]){_0x317ccd[_0x1018('0x1d')]=_0x3ac085[_0x1018('0x1c')];logger[_0x1018('0x1e')](util[_0x1018('0x1f')](_0x1018('0x20'),_0x317ccd[_0x1018('0x21')],_0x317ccd['id']));}else{logger[_0x1018('0x22')](util[_0x1018('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x317ccd[_0x1018('0x21')],_0x317ccd['id']),util[_0x1018('0x23')](_0x3ac085,{'showHidden':![],'depth':null}));}return _0x20569d(null,_0x1362fa);})[_0x1018('0x24')](function(_0x1559e9){logger[_0x1018('0x22')](util[_0x1018('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x317ccd['name'],_0x317ccd['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x20569d(_0x1559e9);});}else{return _0x20569d(null,_0x1362fa);}},'beforeUpdate':function(_0x4ac03c,_0x260a33,_0x5791ae){if(_0x4ac03c[_0x1018('0xb')](_0x1018('0x13'))||_0x4ac03c['changed']('serverUrl')||_0x4ac03c[_0x1018('0xb')](_0x1018('0x18'))||_0x4ac03c[_0x1018('0xb')]('clientSecret')||_0x4ac03c['changed'](_0x1018('0xe'))||_0x4ac03c[_0x1018('0xb')]('host')){var _0xe443ed,_0x29b946;_0xe443ed=_0x4ac03c['serverUrl'];var _0x4a8b11=_0xe443ed[_0x1018('0x10')](-0x1);if(_0x4a8b11==='/'||_0x4a8b11==='\x5c'||_0x4a8b11===':'){_0xe443ed=_0xe443ed['substring'](0x0,_0xe443ed[_0x1018('0x12')](_0x4a8b11));}switch(_0x4ac03c['zone']){case'US':_0x29b946='https://accounts.zoho.com';break;case'AU':_0x29b946=_0x1018('0x25');break;case'IN':_0x29b946='https://accounts.zoho.in';break;case'CN':_0x29b946=_0x1018('0x16');break;default:_0x29b946=_0x1018('0x26');break;}var _0x39771f={'method':_0x1018('0x27'),'uri':_0x29b946+_0x1018('0x17'),'form':{'grant_type':_0x1018('0x28'),'client_id':_0x4ac03c['clientId'],'client_secret':_0x4ac03c[_0x1018('0xd')],'redirect_uri':_0x4ac03c[_0x1018('0xc')],'code':_0x4ac03c['code']},'headers':{'Content-Type':_0x1018('0x19')}};return rp(_0x39771f)[_0x1018('0x1a')](function(_0x1c9cdb){var _0x1b2850=JSON[_0x1018('0x1b')](_0x1c9cdb);if(_0x1b2850[_0x1018('0x1c')]){_0x4ac03c[_0x1018('0x1d')]=_0x1b2850[_0x1018('0x1c')];logger[_0x1018('0x1e')](util[_0x1018('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4ac03c[_0x1018('0x21')],_0x4ac03c['id']));}else{logger['error'](util['format'](_0x1018('0x29'),_0x4ac03c[_0x1018('0x21')],_0x4ac03c['id']),util[_0x1018('0x23')](_0x1b2850,{'showHidden':![],'depth':null}));}return _0x5791ae(null,_0x260a33);})['catch'](function(_0x30ee69){logger[_0x1018('0x22')](util[_0x1018('0x1f')](_0x1018('0x29'),_0x4ac03c[_0x1018('0x21')],_0x4ac03c['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5791ae(_0x30ee69);});}else{return _0x5791ae(null,_0x260a33);}}}});}; \ No newline at end of file +var _0xd215=['https://accounts.zoho.com','https://accounts.zoho.in','POST','authorization_code','lodash','util','api','moment','request-promise','../../config/environment','./intZohoAccount.attributes','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','name','slice'];(function(_0xf3d379,_0x6ce552){var _0x4107a1=function(_0xf69bc5){while(--_0xf69bc5){_0xf3d379['push'](_0xf3d379['shift']());}};_0x4107a1(++_0x6ce552);}(_0xd215,0x18a));var _0x5d21=function(_0x162f05,_0x15898c){_0x162f05=_0x162f05-0x0;var _0x263946=_0xd215[_0x162f05];return _0x263946;};'use strict';var _=require(_0x5d21('0x0'));var util=require(_0x5d21('0x1'));var logger=require('../../config/logger')(_0x5d21('0x2'));var moment=require(_0x5d21('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d21('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5d21('0x5'));var attributes=require(_0x5d21('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x5d21('0x7')]=function(_0x4ad003,_0x59a3ea){return _0x4ad003[_0x5d21('0x8')]('ZohoAccount',attributes,{'tableName':_0x5d21('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15c8d8,_0x8530b0,_0x37600d){if(_0x15c8d8[_0x5d21('0xa')](_0x5d21('0xb'))||_0x15c8d8['changed'](_0x5d21('0xc'))||_0x15c8d8['changed'](_0x5d21('0xd'))||_0x15c8d8[_0x5d21('0xa')](_0x5d21('0xe'))||_0x15c8d8[_0x5d21('0xa')](_0x5d21('0xf'))||_0x15c8d8[_0x5d21('0xa')](_0x5d21('0x10'))){var _0x48f460,_0x2ffb60;_0x48f460=_0x15c8d8[_0x5d21('0xc')];var _0x46b287=_0x48f460['slice'](-0x1);if(_0x46b287==='/'||_0x46b287==='\x5c'||_0x46b287===':'){_0x48f460=_0x48f460[_0x5d21('0x11')](0x0,_0x48f460[_0x5d21('0x12')](_0x46b287));}switch(_0x15c8d8[_0x5d21('0xb')]){case'US':_0x2ffb60='https://accounts.zoho.com';break;case'AU':_0x2ffb60=_0x5d21('0x13');break;case'IN':_0x2ffb60='https://accounts.zoho.in';break;case'CN':_0x2ffb60='https://accounts.zoho.com.cn';break;default:_0x2ffb60=_0x5d21('0x14');break;}var _0x461b2c={'method':'POST','uri':_0x2ffb60+_0x5d21('0x15'),'form':{'grant_type':'authorization_code','client_id':_0x15c8d8[_0x5d21('0xd')],'client_secret':_0x15c8d8[_0x5d21('0xe')],'redirect_uri':_0x15c8d8[_0x5d21('0xc')],'code':_0x15c8d8[_0x5d21('0xf')]},'headers':{'Content-Type':_0x5d21('0x16')}};return rp(_0x461b2c)[_0x5d21('0x17')](function(_0x2eb9de){var _0x332da4=JSON[_0x5d21('0x18')](_0x2eb9de);if(_0x332da4[_0x5d21('0x19')]){_0x15c8d8[_0x5d21('0x1a')]=_0x332da4[_0x5d21('0x19')];logger[_0x5d21('0x1b')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x15c8d8['name'],_0x15c8d8['id']));}else{logger[_0x5d21('0x1c')](util[_0x5d21('0x1d')](_0x5d21('0x1e'),_0x15c8d8['name'],_0x15c8d8['id']),util[_0x5d21('0x1f')](_0x332da4,{'showHidden':![],'depth':null}));}return _0x37600d(null,_0x8530b0);})[_0x5d21('0x20')](function(_0x58baf4){logger[_0x5d21('0x1c')](util['format'](_0x5d21('0x1e'),_0x15c8d8[_0x5d21('0x21')],_0x15c8d8['id']),util[_0x5d21('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x37600d(_0x58baf4);});}else{return _0x37600d(null,_0x8530b0);}},'beforeUpdate':function(_0x58abf0,_0x417478,_0x3576fb){if(_0x58abf0[_0x5d21('0xa')](_0x5d21('0xb'))||_0x58abf0['changed']('serverUrl')||_0x58abf0['changed'](_0x5d21('0xd'))||_0x58abf0[_0x5d21('0xa')](_0x5d21('0xe'))||_0x58abf0[_0x5d21('0xa')]('code')||_0x58abf0['changed'](_0x5d21('0x10'))){var _0x404469,_0x409b19;_0x404469=_0x58abf0['serverUrl'];var _0x177c0c=_0x404469[_0x5d21('0x22')](-0x1);if(_0x177c0c==='/'||_0x177c0c==='\x5c'||_0x177c0c===':'){_0x404469=_0x404469['substring'](0x0,_0x404469[_0x5d21('0x12')](_0x177c0c));}switch(_0x58abf0[_0x5d21('0xb')]){case'US':_0x409b19=_0x5d21('0x23');break;case'AU':_0x409b19=_0x5d21('0x13');break;case'IN':_0x409b19=_0x5d21('0x24');break;case'CN':_0x409b19='https://accounts.zoho.com.cn';break;default:_0x409b19='https://accounts.zoho.eu';break;}var _0x3ad509={'method':_0x5d21('0x25'),'uri':_0x409b19+_0x5d21('0x15'),'form':{'grant_type':_0x5d21('0x26'),'client_id':_0x58abf0[_0x5d21('0xd')],'client_secret':_0x58abf0[_0x5d21('0xe')],'redirect_uri':_0x58abf0[_0x5d21('0xc')],'code':_0x58abf0[_0x5d21('0xf')]},'headers':{'Content-Type':_0x5d21('0x16')}};return rp(_0x3ad509)[_0x5d21('0x17')](function(_0x56c4b6){var _0x1097f9=JSON['parse'](_0x56c4b6);if(_0x1097f9[_0x5d21('0x19')]){_0x58abf0[_0x5d21('0x1a')]=_0x1097f9[_0x5d21('0x19')];logger[_0x5d21('0x1b')](util[_0x5d21('0x1d')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x58abf0[_0x5d21('0x21')],_0x58abf0['id']));}else{logger[_0x5d21('0x1c')](util[_0x5d21('0x1d')](_0x5d21('0x1e'),_0x58abf0[_0x5d21('0x21')],_0x58abf0['id']),util[_0x5d21('0x1f')](_0x1097f9,{'showHidden':![],'depth':null}));}return _0x3576fb(null,_0x417478);})['catch'](function(_0x2d6d94){logger[_0x5d21('0x1c')](util[_0x5d21('0x1d')](_0x5d21('0x1e'),_0x58abf0[_0x5d21('0x21')],_0x58abf0['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3576fb(_0x2d6d94);});}else{return _0x3576fb(null,_0x417478);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b6b0195..4552b25 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 _0xfcf4=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ZohoAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetZohoAccount','ShowZohoAccount'];(function(_0x13a786,_0x245695){var _0x5d9440=function(_0x1de99a){while(--_0x1de99a){_0x13a786['push'](_0x13a786['shift']());}};_0x5d9440(++_0x245695);}(_0xfcf4,0x131));var _0x4fcf=function(_0x23b56e,_0x2fe273){_0x23b56e=_0x23b56e-0x0;var _0x1865b2=_0xfcf4[_0x23b56e];return _0x1865b2;};'use strict';var _=require(_0x4fcf('0x0'));var util=require(_0x4fcf('0x1'));var moment=require(_0x4fcf('0x2'));var BPromise=require(_0x4fcf('0x3'));var rs=require(_0x4fcf('0x4'));var fs=require('fs');var Redis=require(_0x4fcf('0x5'));var db=require(_0x4fcf('0x6'))['db'];var utils=require(_0x4fcf('0x7'));var logger=require('../../config/logger')(_0x4fcf('0x8'));var config=require('../../config/environment');var jayson=require(_0x4fcf('0x9'));var client=jayson[_0x4fcf('0xa')][_0x4fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d4a34,_0x3c4997,_0x30c6c8){return new BPromise(function(_0x45a83f,_0x3a65c6){return client[_0x4fcf('0xc')](_0x1d4a34,_0x30c6c8)[_0x4fcf('0xd')](function(_0x5f1f7d){logger[_0x4fcf('0xe')](_0x4fcf('0xf'),_0x3c4997,_0x4fcf('0x10'));logger[_0x4fcf('0x11')](_0x4fcf('0x12'),_0x3c4997,_0x4fcf('0x10'),JSON[_0x4fcf('0x13')](_0x5f1f7d));if(_0x5f1f7d[_0x4fcf('0x14')]){if(_0x5f1f7d[_0x4fcf('0x14')][_0x4fcf('0x15')]===0x1f4){logger['error'](_0x4fcf('0xf'),_0x3c4997,_0x5f1f7d[_0x4fcf('0x14')][_0x4fcf('0x16')]);return _0x3a65c6(_0x5f1f7d[_0x4fcf('0x14')][_0x4fcf('0x16')]);}logger[_0x4fcf('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x3c4997,_0x5f1f7d[_0x4fcf('0x14')][_0x4fcf('0x16')]);return _0x45a83f(_0x5f1f7d[_0x4fcf('0x14')]['message']);}else{logger[_0x4fcf('0xe')](_0x4fcf('0xf'),_0x3c4997,'request\x20sent');_0x45a83f(_0x5f1f7d[_0x4fcf('0x17')][_0x4fcf('0x16')]);}})[_0x4fcf('0x18')](function(_0x2c7634){logger['error'](_0x4fcf('0xf'),_0x3c4997,_0x2c7634);_0x3a65c6(_0x2c7634);});});}exports['GetZohoAccount']=function(_0x58344d){var _0x2a5644=this;return new Promise(function(_0x3f963b,_0x142f7b){return db[_0x4fcf('0x19')][_0x4fcf('0x1a')]({'raw':_0x58344d[_0x4fcf('0x1b')]?_0x58344d['options'][_0x4fcf('0x1c')]===undefined?!![]:![]:!![],'where':_0x58344d['options']?_0x58344d[_0x4fcf('0x1b')][_0x4fcf('0x1d')]||null:null,'attributes':_0x58344d[_0x4fcf('0x1b')]?_0x58344d[_0x4fcf('0x1b')]['attributes']||null:null,'limit':_0x58344d[_0x4fcf('0x1b')]?_0x58344d['options'][_0x4fcf('0x1e')]||null:null,'include':_0x58344d[_0x4fcf('0x1b')]?_0x58344d['options'][_0x4fcf('0x1f')]?_[_0x4fcf('0x20')](_0x58344d[_0x4fcf('0x1b')]['include'],function(_0x2c6bac){return{'model':db[_0x2c6bac[_0x4fcf('0x21')]],'as':_0x2c6bac['as'],'attributes':_0x2c6bac[_0x4fcf('0x22')],'include':_0x2c6bac[_0x4fcf('0x1f')]?_[_0x4fcf('0x20')](_0x2c6bac[_0x4fcf('0x1f')],function(_0x3a6adb){return{'model':db[_0x3a6adb[_0x4fcf('0x21')]],'as':_0x3a6adb['as'],'attributes':_0x3a6adb[_0x4fcf('0x22')],'include':_0x3a6adb['include']?_[_0x4fcf('0x20')](_0x3a6adb[_0x4fcf('0x1f')],function(_0x1fa25c){return{'model':db[_0x1fa25c[_0x4fcf('0x21')]],'as':_0x1fa25c['as'],'attributes':_0x1fa25c[_0x4fcf('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53ae46){logger['info'](_0x4fcf('0x23'),_0x58344d);logger[_0x4fcf('0x11')](_0x4fcf('0x23'),_0x58344d,JSON[_0x4fcf('0x13')](_0x53ae46));_0x3f963b(_0x53ae46);})[_0x4fcf('0x18')](function(_0x1c4c3c){logger['error'](_0x4fcf('0x23'),_0x1c4c3c[_0x4fcf('0x16')],_0x58344d);_0x142f7b(_0x2a5644[_0x4fcf('0x14')](0x1f4,_0x1c4c3c['message']));});});};exports[_0x4fcf('0x24')]=function(_0x4cbf20){var _0x2ac068=this;return new Promise(function(_0x195bfa,_0x38efdb){return db['ZohoAccount'][_0x4fcf('0x25')]({'raw':_0x4cbf20[_0x4fcf('0x1b')]?_0x4cbf20['options'][_0x4fcf('0x1c')]===undefined?!![]:![]:!![],'where':_0x4cbf20[_0x4fcf('0x1b')]?_0x4cbf20[_0x4fcf('0x1b')][_0x4fcf('0x1d')]||null:null,'attributes':_0x4cbf20['options']?_0x4cbf20[_0x4fcf('0x1b')][_0x4fcf('0x22')]||null:null,'include':_0x4cbf20['options']?_0x4cbf20[_0x4fcf('0x1b')][_0x4fcf('0x1f')]?_[_0x4fcf('0x20')](_0x4cbf20[_0x4fcf('0x1b')][_0x4fcf('0x1f')],function(_0x53c3fd){return{'model':db[_0x53c3fd[_0x4fcf('0x21')]],'as':_0x53c3fd['as'],'attributes':_0x53c3fd[_0x4fcf('0x22')],'include':_0x53c3fd[_0x4fcf('0x1f')]?_['map'](_0x53c3fd[_0x4fcf('0x1f')],function(_0x2fee3d){return{'model':db[_0x2fee3d['model']],'as':_0x2fee3d['as'],'attributes':_0x2fee3d[_0x4fcf('0x22')],'include':_0x2fee3d[_0x4fcf('0x1f')]?_[_0x4fcf('0x20')](_0x2fee3d[_0x4fcf('0x1f')],function(_0x5ae15d){return{'model':db[_0x5ae15d[_0x4fcf('0x21')]],'as':_0x5ae15d['as'],'attributes':_0x5ae15d[_0x4fcf('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4fcf('0xd')](function(_0x62f93a){logger['info'](_0x4fcf('0x24'),_0x4cbf20);logger[_0x4fcf('0x11')](_0x4fcf('0x24'),_0x4cbf20,JSON[_0x4fcf('0x13')](_0x62f93a));_0x195bfa(_0x62f93a);})[_0x4fcf('0x18')](function(_0x16aa8c){logger[_0x4fcf('0x14')](_0x4fcf('0x24'),_0x16aa8c[_0x4fcf('0x16')],_0x4cbf20);_0x38efdb(_0x2ac068['error'](0x1f4,_0x16aa8c[_0x4fcf('0x16')]));});});}; \ No newline at end of file +var _0x03e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','include','map','model','attributes','debug','ShowZohoAccount','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x49b6b6,_0x54b0f0){var _0x188c67=function(_0x55644c){while(--_0x55644c){_0x49b6b6['push'](_0x49b6b6['shift']());}};_0x188c67(++_0x54b0f0);}(_0x03e9,0x13f));var _0x903e=function(_0x5c372d,_0x462038){_0x5c372d=_0x5c372d-0x0;var _0xa61c6e=_0x03e9[_0x5c372d];return _0xa61c6e;};'use strict';var _=require(_0x903e('0x0'));var util=require(_0x903e('0x1'));var moment=require('moment');var BPromise=require(_0x903e('0x2'));var rs=require(_0x903e('0x3'));var fs=require('fs');var Redis=require(_0x903e('0x4'));var db=require(_0x903e('0x5'))['db'];var utils=require(_0x903e('0x6'));var logger=require(_0x903e('0x7'))('rpc');var config=require(_0x903e('0x8'));var jayson=require(_0x903e('0x9'));var client=jayson[_0x903e('0xa')][_0x903e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36e697,_0x1b2754,_0x1937ca){return new BPromise(function(_0x471cdc,_0x47f79c){return client[_0x903e('0xc')](_0x36e697,_0x1937ca)[_0x903e('0xd')](function(_0x134020){logger[_0x903e('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1b2754,_0x903e('0xf'));logger['debug'](_0x903e('0x10'),_0x1b2754,'request\x20sent',JSON[_0x903e('0x11')](_0x134020));if(_0x134020['error']){if(_0x134020[_0x903e('0x12')][_0x903e('0x13')]===0x1f4){logger['error'](_0x903e('0x14'),_0x1b2754,_0x134020[_0x903e('0x12')][_0x903e('0x15')]);return _0x47f79c(_0x134020[_0x903e('0x12')][_0x903e('0x15')]);}logger[_0x903e('0x12')](_0x903e('0x14'),_0x1b2754,_0x134020['error']['message']);return _0x471cdc(_0x134020['error'][_0x903e('0x15')]);}else{logger[_0x903e('0xe')](_0x903e('0x14'),_0x1b2754,_0x903e('0xf'));_0x471cdc(_0x134020[_0x903e('0x16')][_0x903e('0x15')]);}})['catch'](function(_0x4aeb1e){logger[_0x903e('0x12')](_0x903e('0x14'),_0x1b2754,_0x4aeb1e);_0x47f79c(_0x4aeb1e);});});}exports[_0x903e('0x17')]=function(_0x14b783){var _0x13f1a0=this;return new Promise(function(_0x8b8e36,_0x121d5a){return db[_0x903e('0x18')][_0x903e('0x19')]({'raw':_0x14b783['options']?_0x14b783[_0x903e('0x1a')][_0x903e('0x1b')]===undefined?!![]:![]:!![],'where':_0x14b783[_0x903e('0x1a')]?_0x14b783['options'][_0x903e('0x1c')]||null:null,'attributes':_0x14b783[_0x903e('0x1a')]?_0x14b783[_0x903e('0x1a')]['attributes']||null:null,'limit':_0x14b783[_0x903e('0x1a')]?_0x14b783['options']['limit']||null:null,'include':_0x14b783[_0x903e('0x1a')]?_0x14b783[_0x903e('0x1a')][_0x903e('0x1d')]?_[_0x903e('0x1e')](_0x14b783[_0x903e('0x1a')]['include'],function(_0x50277f){return{'model':db[_0x50277f[_0x903e('0x1f')]],'as':_0x50277f['as'],'attributes':_0x50277f[_0x903e('0x20')],'include':_0x50277f[_0x903e('0x1d')]?_['map'](_0x50277f['include'],function(_0x4a92e8){return{'model':db[_0x4a92e8[_0x903e('0x1f')]],'as':_0x4a92e8['as'],'attributes':_0x4a92e8[_0x903e('0x20')],'include':_0x4a92e8['include']?_[_0x903e('0x1e')](_0x4a92e8[_0x903e('0x1d')],function(_0x1643b9){return{'model':db[_0x1643b9[_0x903e('0x1f')]],'as':_0x1643b9['as'],'attributes':_0x1643b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x903e('0xd')](function(_0x32bbdd){logger[_0x903e('0xe')]('GetZohoAccount',_0x14b783);logger[_0x903e('0x21')]('GetZohoAccount',_0x14b783,JSON[_0x903e('0x11')](_0x32bbdd));_0x8b8e36(_0x32bbdd);})['catch'](function(_0xb4e297){logger[_0x903e('0x12')](_0x903e('0x17'),_0xb4e297[_0x903e('0x15')],_0x14b783);_0x121d5a(_0x13f1a0[_0x903e('0x12')](0x1f4,_0xb4e297[_0x903e('0x15')]));});});};exports[_0x903e('0x22')]=function(_0x4744c5){var _0x39a226=this;return new Promise(function(_0x5d23d2,_0x4ba580){return db[_0x903e('0x18')]['find']({'raw':_0x4744c5[_0x903e('0x1a')]?_0x4744c5[_0x903e('0x1a')][_0x903e('0x1b')]===undefined?!![]:![]:!![],'where':_0x4744c5[_0x903e('0x1a')]?_0x4744c5[_0x903e('0x1a')][_0x903e('0x1c')]||null:null,'attributes':_0x4744c5[_0x903e('0x1a')]?_0x4744c5[_0x903e('0x1a')][_0x903e('0x20')]||null:null,'include':_0x4744c5[_0x903e('0x1a')]?_0x4744c5[_0x903e('0x1a')]['include']?_[_0x903e('0x1e')](_0x4744c5['options'][_0x903e('0x1d')],function(_0x1215af){return{'model':db[_0x1215af['model']],'as':_0x1215af['as'],'attributes':_0x1215af[_0x903e('0x20')],'include':_0x1215af['include']?_[_0x903e('0x1e')](_0x1215af['include'],function(_0x1a53a1){return{'model':db[_0x1a53a1[_0x903e('0x1f')]],'as':_0x1a53a1['as'],'attributes':_0x1a53a1['attributes'],'include':_0x1a53a1['include']?_[_0x903e('0x1e')](_0x1a53a1['include'],function(_0x2e280b){return{'model':db[_0x2e280b[_0x903e('0x1f')]],'as':_0x2e280b['as'],'attributes':_0x2e280b[_0x903e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x903e('0xd')](function(_0x5ebf3c){logger[_0x903e('0xe')](_0x903e('0x22'),_0x4744c5);logger['debug'](_0x903e('0x22'),_0x4744c5,JSON[_0x903e('0x11')](_0x5ebf3c));_0x5d23d2(_0x5ebf3c);})[_0x903e('0x23')](function(_0x376bb4){logger[_0x903e('0x12')]('ShowZohoAccount',_0x376bb4[_0x903e('0x15')],_0x4744c5);_0x4ba580(_0x39a226[_0x903e('0x12')](0x1f4,_0x376bb4[_0x903e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 4e5c2e4..420dd7d 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 _0x4dfc=['/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','/:id','show','/:id/fields','getFields'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4dfc,0xda));var _0xc4df=function(_0x880aed,_0x16597b){_0x880aed=_0x880aed-0x0;var _0x40df37=_0x4dfc[_0x880aed];return _0x40df37;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc4df('0x0'));var express=require(_0xc4df('0x1'));var router=express[_0xc4df('0x2')]();var auth=require(_0xc4df('0x3'));var interaction=require(_0xc4df('0x4'));var config=require(_0xc4df('0x5'));var controller=require(_0xc4df('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc4df('0x7')](_0xc4df('0x8'),auth['isAuthenticated'](),controller[_0xc4df('0x9')]);router[_0xc4df('0x7')](_0xc4df('0xa'),auth['isAuthenticated'](),controller[_0xc4df('0xb')]);router[_0xc4df('0x7')](_0xc4df('0xc'),auth[_0xc4df('0xd')](),controller[_0xc4df('0xe')]);router[_0xc4df('0x7')](_0xc4df('0xf'),auth[_0xc4df('0xd')](),controller['getDescriptions']);router[_0xc4df('0x10')]('/',auth[_0xc4df('0xd')](),controller[_0xc4df('0x11')]);router[_0xc4df('0x12')](_0xc4df('0x8'),auth[_0xc4df('0xd')](),controller[_0xc4df('0x13')]);router[_0xc4df('0x14')](_0xc4df('0x8'),auth[_0xc4df('0xd')](),controller[_0xc4df('0x15')]);module[_0xc4df('0x16')]=router; \ No newline at end of file +var _0x407f=['../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service'];(function(_0x41720b,_0x2c6945){var _0xfad2bd=function(_0x3df7f7){while(--_0x3df7f7){_0x41720b['push'](_0x41720b['shift']());}};_0xfad2bd(++_0x2c6945);}(_0x407f,0xc2));var _0xf407=function(_0x8e9235,_0x552ac0){_0x8e9235=_0x8e9235-0x0;var _0x385465=_0x407f[_0x8e9235];return _0x385465;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf407('0x0'));var express=require(_0xf407('0x1'));var router=express[_0xf407('0x2')]();var auth=require(_0xf407('0x3'));var interaction=require(_0xf407('0x4'));var config=require(_0xf407('0x5'));var controller=require(_0xf407('0x6'));router[_0xf407('0x7')]('/',auth[_0xf407('0x8')](),controller[_0xf407('0x9')]);router[_0xf407('0x7')](_0xf407('0xa'),auth[_0xf407('0x8')](),controller[_0xf407('0xb')]);router[_0xf407('0x7')](_0xf407('0xc'),auth['isAuthenticated'](),controller[_0xf407('0xd')]);router[_0xf407('0x7')](_0xf407('0xe'),auth[_0xf407('0x8')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xf407('0x8')](),controller[_0xf407('0xf')]);router[_0xf407('0x10')]('/',auth[_0xf407('0x8')](),controller[_0xf407('0x11')]);router['put'](_0xf407('0xa'),auth[_0xf407('0x8')](),controller[_0xf407('0x12')]);router[_0xf407('0x13')](_0xf407('0xa'),auth[_0xf407('0x8')](),controller[_0xf407('0x14')]);module[_0xf407('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 81e8c10..6fd0065 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 _0x7a13=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a13,0x68));var _0x37a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a13[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x37a1('0x0'));module['exports']={'name':{'type':Sequelize[_0x37a1('0x1')]},'moduleCreate':{'type':Sequelize[_0x37a1('0x2')](_0x37a1('0x3'),_0x37a1('0x4'),_0x37a1('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x37a1('0x2')](_0x37a1('0x6'),_0x37a1('0x4'),_0x37a1('0x3')),'defaultValue':_0x37a1('0x6')},'description':{'type':Sequelize[_0x37a1('0x1')]}}; \ No newline at end of file +var _0xca89=['ENUM','contact_lead','contact','sequelize','exports','STRING','lead','nothing'];(function(_0x6fc67a,_0x54d3b8){var _0x535543=function(_0x5778a4){while(--_0x5778a4){_0x6fc67a['push'](_0x6fc67a['shift']());}};_0x535543(++_0x54d3b8);}(_0xca89,0x6b));var _0x9ca8=function(_0x5ed4fb,_0x40dcaa){_0x5ed4fb=_0x5ed4fb-0x0;var _0x4d5ac0=_0xca89[_0x5ed4fb];return _0x4d5ac0;};'use strict';var Sequelize=require(_0x9ca8('0x0'));module[_0x9ca8('0x1')]={'name':{'type':Sequelize[_0x9ca8('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x9ca8('0x3'),'contact',_0x9ca8('0x4')),'defaultValue':_0x9ca8('0x3')},'moduleSearch':{'type':Sequelize[_0x9ca8('0x5')](_0x9ca8('0x6'),_0x9ca8('0x7'),'lead'),'defaultValue':_0x9ca8('0x6')},'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 27e063e..bfb284c 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 _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','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','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x375126,_0x514a8e){var _0x1f76bb=function(_0x22f2d0){while(--_0x22f2d0){_0x375126['push'](_0x375126['shift']());}};_0x1f76bb(++_0x514a8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file +var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','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','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 6ae8ad4..fb7fb75 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 _0x379b=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0x379b,0x1a4));var _0xb379=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x379b[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xb379('0x0'));var util=require(_0xb379('0x1'));var logger=require(_0xb379('0x2'))('api');var moment=require(_0xb379('0x3'));var BPromise=require(_0xb379('0x4'));var rp=require(_0xb379('0x5'));var fs=require('fs');var path=require(_0xb379('0x6'));var rimraf=require(_0xb379('0x7'));var config=require(_0xb379('0x8'));var attributes=require(_0xb379('0x9'));module[_0xb379('0xa')]=function(_0xb1195e,_0x2d0752){return _0xb1195e[_0xb379('0xb')](_0xb379('0xc'),attributes,{'tableName':_0xb379('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe071=['define','ZohoConfiguration','int_zoho_configurations','util','api','bluebird','path','rimraf','./intZohoConfiguration.attributes','exports'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xe071,0x7b));var _0x1e07=function(_0xddc012,_0x5cf07a){_0xddc012=_0xddc012-0x0;var _0x395581=_0xe071[_0xddc012];return _0x395581;};'use strict';var _=require('lodash');var util=require(_0x1e07('0x0'));var logger=require('../../config/logger')(_0x1e07('0x1'));var moment=require('moment');var BPromise=require(_0x1e07('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e07('0x3'));var rimraf=require(_0x1e07('0x4'));var config=require('../../config/environment');var attributes=require(_0x1e07('0x5'));module[_0x1e07('0x6')]=function(_0x2dc9cc,_0x22661c){return _0x2dc9cc[_0x1e07('0x7')](_0x1e07('0x8'),attributes,{'tableName':_0x1e07('0x9'),'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 0510148..d79042a 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 _0xfae8=['request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x38f76d,_0x329bf7){var _0x3f30da=function(_0x1d1a88){while(--_0x1d1a88){_0x38f76d['push'](_0x38f76d['shift']());}};_0x3f30da(++_0x329bf7);}(_0xfae8,0xe4));var _0x8fae=function(_0x3507b2,_0x4d7e9e){_0x3507b2=_0x3507b2-0x0;var _0x5bd960=_0xfae8[_0x3507b2];return _0x5bd960;};'use strict';var _=require(_0x8fae('0x0'));var util=require(_0x8fae('0x1'));var moment=require(_0x8fae('0x2'));var BPromise=require(_0x8fae('0x3'));var rs=require(_0x8fae('0x4'));var fs=require('fs');var Redis=require(_0x8fae('0x5'));var db=require(_0x8fae('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fae('0x7'))('rpc');var config=require(_0x8fae('0x8'));var jayson=require(_0x8fae('0x9'));var client=jayson[_0x8fae('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x456b1b,_0x134067,_0x3baf2d){return new BPromise(function(_0x22bcf4,_0x1b2088){return client[_0x8fae('0xb')](_0x456b1b,_0x3baf2d)[_0x8fae('0xc')](function(_0x4bbeb8){logger['info'](_0x8fae('0xd'),_0x134067,_0x8fae('0xe'));logger[_0x8fae('0xf')](_0x8fae('0x10'),_0x134067,_0x8fae('0xe'),JSON[_0x8fae('0x11')](_0x4bbeb8));if(_0x4bbeb8[_0x8fae('0x12')]){if(_0x4bbeb8[_0x8fae('0x12')][_0x8fae('0x13')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x134067,_0x4bbeb8[_0x8fae('0x12')][_0x8fae('0x14')]);return _0x1b2088(_0x4bbeb8[_0x8fae('0x12')][_0x8fae('0x14')]);}logger[_0x8fae('0x12')](_0x8fae('0xd'),_0x134067,_0x4bbeb8['error'][_0x8fae('0x14')]);return _0x22bcf4(_0x4bbeb8[_0x8fae('0x12')]['message']);}else{logger['info'](_0x8fae('0xd'),_0x134067,_0x8fae('0xe'));_0x22bcf4(_0x4bbeb8[_0x8fae('0x15')][_0x8fae('0x14')]);}})['catch'](function(_0x3ce79c){logger[_0x8fae('0x12')](_0x8fae('0xd'),_0x134067,_0x3ce79c);_0x1b2088(_0x3ce79c);});});} \ No newline at end of file +var _0x6fb9=['ioredis','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','randomstring'];(function(_0x4ad963,_0x17395f){var _0x169807=function(_0x5f312d){while(--_0x5f312d){_0x4ad963['push'](_0x4ad963['shift']());}};_0x169807(++_0x17395f);}(_0x6fb9,0x1b2));var _0x96fb=function(_0x58da8a,_0x1c0584){_0x58da8a=_0x58da8a-0x0;var _0x5ba3a3=_0x6fb9[_0x58da8a];return _0x5ba3a3;};'use strict';var _=require('lodash');var util=require(_0x96fb('0x0'));var moment=require(_0x96fb('0x1'));var BPromise=require('bluebird');var rs=require(_0x96fb('0x2'));var fs=require('fs');var Redis=require(_0x96fb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x96fb('0x4'));var config=require(_0x96fb('0x5'));var jayson=require(_0x96fb('0x6'));var client=jayson[_0x96fb('0x7')][_0x96fb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36d5a5,_0x5c8caa,_0x4d2f78){return new BPromise(function(_0xdbcb1c,_0x459a8f){return client['request'](_0x36d5a5,_0x4d2f78)[_0x96fb('0x9')](function(_0x40de8b){logger[_0x96fb('0xa')](_0x96fb('0xb'),_0x5c8caa,'request\x20sent');logger['debug'](_0x96fb('0xc'),_0x5c8caa,_0x96fb('0xd'),JSON['stringify'](_0x40de8b));if(_0x40de8b[_0x96fb('0xe')]){if(_0x40de8b[_0x96fb('0xe')][_0x96fb('0xf')]===0x1f4){logger[_0x96fb('0xe')](_0x96fb('0xb'),_0x5c8caa,_0x40de8b[_0x96fb('0xe')][_0x96fb('0x10')]);return _0x459a8f(_0x40de8b[_0x96fb('0xe')][_0x96fb('0x10')]);}logger[_0x96fb('0xe')](_0x96fb('0xb'),_0x5c8caa,_0x40de8b[_0x96fb('0xe')]['message']);return _0xdbcb1c(_0x40de8b['error']['message']);}else{logger[_0x96fb('0xa')](_0x96fb('0xb'),_0x5c8caa,_0x96fb('0xd'));_0xdbcb1c(_0x40de8b[_0x96fb('0x11')][_0x96fb('0x10')]);}})[_0x96fb('0x12')](function(_0x1cb207){logger[_0x96fb('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c8caa,_0x1cb207);_0x459a8f(_0x1cb207);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 38acf5b..efce3a4 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 _0x3f0f=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','/:id','show','create','put','update','destroy','exports','util'];(function(_0x5adbfb,_0x1c2343){var _0x448c57=function(_0x239ea7){while(--_0x239ea7){_0x5adbfb['push'](_0x5adbfb['shift']());}};_0x448c57(++_0x1c2343);}(_0x3f0f,0x1a3));var _0xf3f0=function(_0x41e2cc,_0x1be892){_0x41e2cc=_0x41e2cc-0x0;var _0x3b11a1=_0x3f0f[_0x41e2cc];return _0x3b11a1;};'use strict';var multer=require('multer');var util=require(_0xf3f0('0x0'));var path=require('path');var timeout=require(_0xf3f0('0x1'));var express=require(_0xf3f0('0x2'));var router=express['Router']();var auth=require(_0xf3f0('0x3'));var interaction=require(_0xf3f0('0x4'));var config=require('../../config/environment');var controller=require(_0xf3f0('0x5'));router[_0xf3f0('0x6')]('/',auth[_0xf3f0('0x7')](),controller['index']);router['get'](_0xf3f0('0x8'),auth[_0xf3f0('0x7')](),controller[_0xf3f0('0x9')]);router['post']('/',auth[_0xf3f0('0x7')](),controller[_0xf3f0('0xa')]);router[_0xf3f0('0xb')](_0xf3f0('0x8'),auth[_0xf3f0('0x7')](),controller[_0xf3f0('0xc')]);router['delete'](_0xf3f0('0x8'),auth[_0xf3f0('0x7')](),controller[_0xf3f0('0xd')]);module[_0xf3f0('0xe')]=router; \ No newline at end of file +var _0x2299=['../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x2458f0,_0xf805c){var _0x2b4fd9=function(_0x57deeb){while(--_0x57deeb){_0x2458f0['push'](_0x2458f0['shift']());}};_0x2b4fd9(++_0xf805c);}(_0x2299,0x1be));var _0x9229=function(_0x57dcf5,_0x3c8953){_0x57dcf5=_0x57dcf5-0x0;var _0x27cdb7=_0x2299[_0x57dcf5];return _0x27cdb7;};'use strict';var multer=require(_0x9229('0x0'));var util=require(_0x9229('0x1'));var path=require(_0x9229('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9229('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9229('0x4'));var config=require('../../config/environment');var controller=require(_0x9229('0x5'));router[_0x9229('0x6')]('/',auth[_0x9229('0x7')](),controller[_0x9229('0x8')]);router[_0x9229('0x6')]('/:id',auth[_0x9229('0x7')](),controller[_0x9229('0x9')]);router[_0x9229('0xa')]('/',auth['isAuthenticated'](),controller[_0x9229('0xb')]);router[_0x9229('0xc')](_0x9229('0xd'),auth[_0x9229('0x7')](),controller[_0x9229('0xe')]);router[_0x9229('0xf')](_0x9229('0xd'),auth[_0x9229('0x7')](),controller[_0x9229('0x10')]);module[_0x9229('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 65589d7..b925898 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 _0x402f=['string','variable','BOOLEAN','sequelize','ENUM','customVariable','keyValue','picklist','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x402f,0x6f));var _0xf402=function(_0x7b8acb,_0x59e16c){_0x7b8acb=_0x7b8acb-0x0;var _0x1eba9b=_0x402f[_0x7b8acb];return _0x1eba9b;};'use strict';var Sequelize=require(_0xf402('0x0'));module['exports']={'type':{'type':Sequelize[_0xf402('0x1')]('string','variable',_0xf402('0x2'),_0xf402('0x3'),_0xf402('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf402('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf402('0x1')](_0xf402('0x6'),_0xf402('0x7'),_0xf402('0x2'))},'keyContent':{'type':Sequelize[_0xf402('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf402('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf402('0x5')]}}; \ No newline at end of file +var _0xa9e0=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','picklist','string'];(function(_0x1e90bf,_0x6e2b4a){var _0x964912=function(_0x2709ac){while(--_0x2709ac){_0x1e90bf['push'](_0x1e90bf['shift']());}};_0x964912(++_0x6e2b4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('string','variable',_0x0a9e('0x3'),'keyValue',_0x0a9e('0x4')),'defaultValue':_0x0a9e('0x5')},'content':{'type':Sequelize[_0x0a9e('0x6')]},'key':{'type':Sequelize[_0x0a9e('0x6')]},'keyType':{'type':Sequelize[_0x0a9e('0x2')]('string',_0x0a9e('0x7'),_0x0a9e('0x3'))},'keyContent':{'type':Sequelize[_0x0a9e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index c91a911..fc1e982 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 _0x73ad=['find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','keys','fields','length'];(function(_0x4e9e82,_0x3144a4){var _0x57e451=function(_0x359af6){while(--_0x359af6){_0x4e9e82['push'](_0x4e9e82['shift']());}};_0x57e451(++_0x3144a4);}(_0x73ad,0x1c5));var _0xd73a=function(_0x527e6f,_0x48bf8f){_0x527e6f=_0x527e6f-0x0;var _0x3c530e=_0x73ad[_0x527e6f];return _0x3c530e;};'use strict';var pdf=require(_0xd73a('0x0'));var emlformat=require(_0xd73a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd73a('0x2'));var jsonpatch=require(_0xd73a('0x3'));var rp=require(_0xd73a('0x4'));var moment=require(_0xd73a('0x5'));var BPromise=require(_0xd73a('0x6'));var Mustache=require(_0xd73a('0x7'));var util=require(_0xd73a('0x8'));var path=require(_0xd73a('0x9'));var sox=require(_0xd73a('0xa'));var csv=require(_0xd73a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd73a('0xc'));var squel=require(_0xd73a('0xd'));var crypto=require(_0xd73a('0xe'));var jsforce=require(_0xd73a('0xf'));var deskjs=require(_0xd73a('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd73a('0x11'));var Papa=require(_0xd73a('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd73a('0x13'));var as=require(_0xd73a('0x14'));var hardwareService=require(_0xd73a('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd73a('0x16'));var licenseUtil=require(_0xd73a('0x17'));var db=require(_0xd73a('0x18'))['db'];function respondWithStatusCode(_0x59daa5,_0x536554){_0x536554=_0x536554||0xcc;return function(_0x57239a){if(_0x57239a){return _0x59daa5[_0xd73a('0x19')](_0x536554);}return _0x59daa5[_0xd73a('0x1a')](_0x536554)[_0xd73a('0x1b')]();};}function respondWithResult(_0x279df8,_0x150cd7){_0x150cd7=_0x150cd7||0xc8;return function(_0x2bd178){if(_0x2bd178){return _0x279df8[_0xd73a('0x1a')](_0x150cd7)['json'](_0x2bd178);}};}function respondWithFilteredResult(_0x31212a,_0x29fcb0){return function(_0x5df4e0){if(_0x5df4e0){var _0x4b25fe=_0x5df4e0['count'],_0x6a2165=_0x29fcb0['offset'],_0x54c887=_0x29fcb0[_0xd73a('0x1c')]+_0x29fcb0[_0xd73a('0x1d')],_0x3f0faf;if(_0x54c887>=_0x4b25fe){_0x54c887=_0x4b25fe;_0x3f0faf=0xc8;}else{_0x3f0faf=0xce;}_0x31212a['status'](_0x3f0faf);return _0x31212a[_0xd73a('0x1e')](_0xd73a('0x1f'),_0x6a2165+'-'+_0x54c887+'/'+_0x4b25fe)[_0xd73a('0x20')](_0x5df4e0);}return null;};}function patchUpdates(_0xdee733){return function(_0x2bbc3c){try{jsonpatch[_0xd73a('0x21')](_0x2bbc3c,_0xdee733,!![]);}catch(_0x2487b7){return BPromise[_0xd73a('0x22')](_0x2487b7);}return _0x2bbc3c['save']();};}function saveUpdates(_0x4d9d79,_0x5aacbe){return function(_0x45ccba){if(_0x45ccba){return _0x45ccba[_0xd73a('0x23')](_0x4d9d79)[_0xd73a('0x24')](function(_0x3277b2){return _0x3277b2;});}return null;};}function removeEntity(_0x12add4,_0x53420d){return function(_0x2a4c6){if(_0x2a4c6){return _0x2a4c6[_0xd73a('0x25')]()['then'](function(){_0x12add4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53edfd,_0x459283){return function(_0x2ce3e6){if(!_0x2ce3e6){_0x53edfd[_0xd73a('0x19')](0x194);}return _0x2ce3e6;};}function handleError(_0x1e047b,_0x5c3884){_0x5c3884=_0x5c3884||0x1f4;return function(_0x5d50ae){logger[_0xd73a('0x26')](_0x5d50ae[_0xd73a('0x27')]);if(_0x5d50ae['name']){delete _0x5d50ae[_0xd73a('0x28')];}_0x1e047b[_0xd73a('0x1a')](_0x5c3884)[_0xd73a('0x29')](_0x5d50ae);};}exports[_0xd73a('0x2a')]=function(_0x43a737,_0x176f69){var _0x9bc353={},_0x3ed28b={},_0x28354a={'count':0x0,'rows':[]};var _0x12188d=_[_0xd73a('0x2b')](db[_0xd73a('0x2c')][_0xd73a('0x2d')],function(_0x551a7e){return{'name':_0x551a7e[_0xd73a('0x2e')],'type':_0x551a7e[_0xd73a('0x2f')][_0xd73a('0x30')]};});_0x3ed28b[_0xd73a('0x31')]=_[_0xd73a('0x2b')](_0x12188d,_0xd73a('0x28'));_0x3ed28b['query']=_['keys'](_0x43a737[_0xd73a('0x32')]);_0x3ed28b[_0xd73a('0x33')]=_[_0xd73a('0x34')](_0x3ed28b['model'],_0x3ed28b[_0xd73a('0x32')]);_0x9bc353[_0xd73a('0x35')]=_['intersection'](_0x3ed28b[_0xd73a('0x31')],qs['fields'](_0x43a737[_0xd73a('0x32')]['fields']));_0x9bc353[_0xd73a('0x35')]=_0x9bc353[_0xd73a('0x35')]['length']?_0x9bc353['attributes']:_0x3ed28b[_0xd73a('0x31')];if(!_0x43a737[_0xd73a('0x32')][_0xd73a('0x36')]('nolimit')){_0x9bc353[_0xd73a('0x1d')]=qs[_0xd73a('0x1d')](_0x43a737[_0xd73a('0x32')][_0xd73a('0x1d')]);_0x9bc353['offset']=qs[_0xd73a('0x1c')](_0x43a737[_0xd73a('0x32')]['offset']);}_0x9bc353[_0xd73a('0x37')]=qs[_0xd73a('0x38')](_0x43a737['query'][_0xd73a('0x38')]);_0x9bc353['where']=qs['filters'](_[_0xd73a('0x39')](_0x43a737[_0xd73a('0x32')],_0x3ed28b[_0xd73a('0x33')]),_0x12188d);if(_0x43a737[_0xd73a('0x32')][_0xd73a('0x3a')]){_0x9bc353[_0xd73a('0x3b')]=_[_0xd73a('0x3c')](_0x9bc353[_0xd73a('0x3b')],{'$or':_[_0xd73a('0x2b')](_0x12188d,function(_0x1cb578){if(_0x1cb578[_0xd73a('0x2f')]!==_0xd73a('0x3d')){var _0x417d16={};_0x417d16[_0x1cb578[_0xd73a('0x28')]]={'$like':'%'+_0x43a737['query'][_0xd73a('0x3a')]+'%'};return _0x417d16;}})});}_0x9bc353=_[_0xd73a('0x3c')]({},_0x9bc353,_0x43a737['options']);var _0x40b093={'where':_0x9bc353[_0xd73a('0x3b')]};return db[_0xd73a('0x2c')][_0xd73a('0x3e')](_0x40b093)['then'](function(_0x17a0cb){_0x28354a[_0xd73a('0x3e')]=_0x17a0cb;if(_0x43a737[_0xd73a('0x32')][_0xd73a('0x3f')]){_0x9bc353[_0xd73a('0x40')]=[{'all':!![]}];}return db[_0xd73a('0x2c')][_0xd73a('0x41')](_0x9bc353);})['then'](function(_0x292906){_0x28354a['rows']=_0x292906;return _0x28354a;})[_0xd73a('0x24')](respondWithFilteredResult(_0x176f69,_0x9bc353))[_0xd73a('0x42')](handleError(_0x176f69,null));};exports[_0xd73a('0x43')]=function(_0x1f4b46,_0x3f7846){var _0x5b6020={'raw':!![],'where':{'id':_0x1f4b46[_0xd73a('0x44')]['id']}},_0xea56e0={};_0xea56e0[_0xd73a('0x31')]=_[_0xd73a('0x45')](db['ZohoField'][_0xd73a('0x2d')]);_0xea56e0[_0xd73a('0x32')]=_['keys'](_0x1f4b46[_0xd73a('0x32')]);_0xea56e0[_0xd73a('0x33')]=_[_0xd73a('0x34')](_0xea56e0[_0xd73a('0x31')],_0xea56e0[_0xd73a('0x32')]);_0x5b6020[_0xd73a('0x35')]=_[_0xd73a('0x34')](_0xea56e0[_0xd73a('0x31')],qs[_0xd73a('0x46')](_0x1f4b46['query']['fields']));_0x5b6020[_0xd73a('0x35')]=_0x5b6020['attributes'][_0xd73a('0x47')]?_0x5b6020[_0xd73a('0x35')]:_0xea56e0[_0xd73a('0x31')];if(_0x1f4b46[_0xd73a('0x32')][_0xd73a('0x3f')]){_0x5b6020[_0xd73a('0x40')]=[{'all':!![]}];}_0x5b6020=_[_0xd73a('0x3c')]({},_0x5b6020,_0x1f4b46['options']);return db[_0xd73a('0x2c')][_0xd73a('0x48')](_0x5b6020)[_0xd73a('0x24')](handleEntityNotFound(_0x3f7846,null))[_0xd73a('0x24')](respondWithResult(_0x3f7846,null))[_0xd73a('0x42')](handleError(_0x3f7846,null));};exports['create']=function(_0x42b8cc,_0x3a6038){return db['ZohoField'][_0xd73a('0x49')](_0x42b8cc[_0xd73a('0x4a')],{})['then'](respondWithResult(_0x3a6038,0xc9))[_0xd73a('0x42')](handleError(_0x3a6038,null));};exports['update']=function(_0x3286d6,_0x3f6a47){if(_0x3286d6[_0xd73a('0x4a')]['id']){delete _0x3286d6[_0xd73a('0x4a')]['id'];}return db['ZohoField'][_0xd73a('0x48')]({'where':{'id':_0x3286d6[_0xd73a('0x44')]['id']}})[_0xd73a('0x24')](handleEntityNotFound(_0x3f6a47,null))[_0xd73a('0x24')](saveUpdates(_0x3286d6[_0xd73a('0x4a')],null))[_0xd73a('0x24')](respondWithResult(_0x3f6a47,null))[_0xd73a('0x42')](handleError(_0x3f6a47,null));};exports['destroy']=function(_0x269b8c,_0x23d422){return db[_0xd73a('0x2c')]['find']({'where':{'id':_0x269b8c[_0xd73a('0x44')]['id']}})[_0xd73a('0x24')](handleEntityNotFound(_0x23d422,null))['then'](removeEntity(_0x23d422,null))[_0xd73a('0x42')](handleError(_0x23d422,null));}; \ No newline at end of file +var _0x3b4d=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2e07e2,_0x4b0f3e){var _0x4bd158=function(_0x525bbf){while(--_0x525bbf){_0x2e07e2['push'](_0x2e07e2['shift']());}};_0x4bd158(++_0x4b0f3e);}(_0x3b4d,0x153));var _0xd3b4=function(_0x5a8323,_0x172f3f){_0x5a8323=_0x5a8323-0x0;var _0xbd7886=_0x3b4d[_0x5a8323];return _0xbd7886;};'use strict';var pdf=require(_0xd3b4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd3b4('0x1'));var zipdir=require(_0xd3b4('0x2'));var jsonpatch=require(_0xd3b4('0x3'));var rp=require('request-promise');var moment=require(_0xd3b4('0x4'));var BPromise=require(_0xd3b4('0x5'));var Mustache=require(_0xd3b4('0x6'));var util=require('util');var path=require(_0xd3b4('0x7'));var sox=require(_0xd3b4('0x8'));var csv=require(_0xd3b4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd3b4('0xa'));var squel=require(_0xd3b4('0xb'));var crypto=require(_0xd3b4('0xc'));var jsforce=require(_0xd3b4('0xd'));var deskjs=require(_0xd3b4('0xe'));var toCsv=require(_0xd3b4('0x9'));var querystring=require('querystring');var Papa=require(_0xd3b4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd3b4('0x10'));var as=require(_0xd3b4('0x11'));var hardwareService=require(_0xd3b4('0x12'));var logger=require(_0xd3b4('0x13'))(_0xd3b4('0x14'));var utils=require(_0xd3b4('0x15'));var config=require(_0xd3b4('0x16'));var licenseUtil=require(_0xd3b4('0x17'));var db=require(_0xd3b4('0x18'))['db'];function respondWithStatusCode(_0x5ee9e9,_0x505604){_0x505604=_0x505604||0xcc;return function(_0x4d73a6){if(_0x4d73a6){return _0x5ee9e9[_0xd3b4('0x19')](_0x505604);}return _0x5ee9e9[_0xd3b4('0x1a')](_0x505604)['end']();};}function respondWithResult(_0x2313ba,_0x43702c){_0x43702c=_0x43702c||0xc8;return function(_0x1e4348){if(_0x1e4348){return _0x2313ba['status'](_0x43702c)['json'](_0x1e4348);}};}function respondWithFilteredResult(_0x46d9ff,_0x4d9be3){return function(_0xa61c02){if(_0xa61c02){var _0xc45918=_0xa61c02[_0xd3b4('0x1b')],_0xddff74=_0x4d9be3[_0xd3b4('0x1c')],_0x23e918=_0x4d9be3[_0xd3b4('0x1c')]+_0x4d9be3[_0xd3b4('0x1d')],_0x2b3e3b;if(_0x23e918>=_0xc45918){_0x23e918=_0xc45918;_0x2b3e3b=0xc8;}else{_0x2b3e3b=0xce;}_0x46d9ff[_0xd3b4('0x1a')](_0x2b3e3b);return _0x46d9ff[_0xd3b4('0x1e')](_0xd3b4('0x1f'),_0xddff74+'-'+_0x23e918+'/'+_0xc45918)['json'](_0xa61c02);}return null;};}function patchUpdates(_0x26602b){return function(_0x3e2af9){try{jsonpatch[_0xd3b4('0x20')](_0x3e2af9,_0x26602b,!![]);}catch(_0x5cbab0){return BPromise[_0xd3b4('0x21')](_0x5cbab0);}return _0x3e2af9[_0xd3b4('0x22')]();};}function saveUpdates(_0x103a3e,_0x5b50b3){return function(_0x251503){if(_0x251503){return _0x251503[_0xd3b4('0x23')](_0x103a3e)[_0xd3b4('0x24')](function(_0x34a268){return _0x34a268;});}return null;};}function removeEntity(_0x2184fb,_0x14fbb8){return function(_0x3e8c29){if(_0x3e8c29){return _0x3e8c29['destroy']()[_0xd3b4('0x24')](function(){_0x2184fb['status'](0xcc)[_0xd3b4('0x25')]();});}};}function handleEntityNotFound(_0x3ec198,_0x583b44){return function(_0x48d42e){if(!_0x48d42e){_0x3ec198[_0xd3b4('0x19')](0x194);}return _0x48d42e;};}function handleError(_0x46d5d6,_0x480b19){_0x480b19=_0x480b19||0x1f4;return function(_0x6cc0dd){logger['error'](_0x6cc0dd['stack']);if(_0x6cc0dd['name']){delete _0x6cc0dd[_0xd3b4('0x26')];}_0x46d5d6[_0xd3b4('0x1a')](_0x480b19)['send'](_0x6cc0dd);};}exports[_0xd3b4('0x27')]=function(_0x3b246b,_0x1ee071){var _0xff9983={},_0x38a6c7={},_0x43be5f={'count':0x0,'rows':[]};var _0x135c69=_[_0xd3b4('0x28')](db[_0xd3b4('0x29')][_0xd3b4('0x2a')],function(_0x48c219){return{'name':_0x48c219[_0xd3b4('0x2b')],'type':_0x48c219[_0xd3b4('0x2c')][_0xd3b4('0x2d')]};});_0x38a6c7[_0xd3b4('0x2e')]=_[_0xd3b4('0x28')](_0x135c69,_0xd3b4('0x26'));_0x38a6c7[_0xd3b4('0x2f')]=_[_0xd3b4('0x30')](_0x3b246b[_0xd3b4('0x2f')]);_0x38a6c7[_0xd3b4('0x31')]=_[_0xd3b4('0x32')](_0x38a6c7[_0xd3b4('0x2e')],_0x38a6c7['query']);_0xff9983[_0xd3b4('0x33')]=_[_0xd3b4('0x32')](_0x38a6c7['model'],qs[_0xd3b4('0x34')](_0x3b246b[_0xd3b4('0x2f')]['fields']));_0xff9983['attributes']=_0xff9983[_0xd3b4('0x33')]['length']?_0xff9983['attributes']:_0x38a6c7[_0xd3b4('0x2e')];if(!_0x3b246b[_0xd3b4('0x2f')][_0xd3b4('0x35')](_0xd3b4('0x36'))){_0xff9983[_0xd3b4('0x1d')]=qs[_0xd3b4('0x1d')](_0x3b246b[_0xd3b4('0x2f')][_0xd3b4('0x1d')]);_0xff9983['offset']=qs[_0xd3b4('0x1c')](_0x3b246b[_0xd3b4('0x2f')][_0xd3b4('0x1c')]);}_0xff9983[_0xd3b4('0x37')]=qs[_0xd3b4('0x38')](_0x3b246b[_0xd3b4('0x2f')]['sort']);_0xff9983['where']=qs['filters'](_['pick'](_0x3b246b[_0xd3b4('0x2f')],_0x38a6c7[_0xd3b4('0x31')]),_0x135c69);if(_0x3b246b[_0xd3b4('0x2f')][_0xd3b4('0x39')]){_0xff9983[_0xd3b4('0x3a')]=_[_0xd3b4('0x3b')](_0xff9983[_0xd3b4('0x3a')],{'$or':_[_0xd3b4('0x28')](_0x135c69,function(_0x19e8da){if(_0x19e8da[_0xd3b4('0x2c')]!==_0xd3b4('0x3c')){var _0xafa356={};_0xafa356[_0x19e8da[_0xd3b4('0x26')]]={'$like':'%'+_0x3b246b[_0xd3b4('0x2f')][_0xd3b4('0x39')]+'%'};return _0xafa356;}})});}_0xff9983=_[_0xd3b4('0x3b')]({},_0xff9983,_0x3b246b[_0xd3b4('0x3d')]);var _0x49478d={'where':_0xff9983['where']};return db[_0xd3b4('0x29')][_0xd3b4('0x1b')](_0x49478d)['then'](function(_0x4057f5){_0x43be5f[_0xd3b4('0x1b')]=_0x4057f5;if(_0x3b246b[_0xd3b4('0x2f')][_0xd3b4('0x3e')]){_0xff9983[_0xd3b4('0x3f')]=[{'all':!![]}];}return db[_0xd3b4('0x29')]['findAll'](_0xff9983);})['then'](function(_0x232b29){_0x43be5f[_0xd3b4('0x40')]=_0x232b29;return _0x43be5f;})[_0xd3b4('0x24')](respondWithFilteredResult(_0x1ee071,_0xff9983))[_0xd3b4('0x41')](handleError(_0x1ee071,null));};exports[_0xd3b4('0x42')]=function(_0xe0bbd7,_0x200730){var _0x41c190={'raw':!![],'where':{'id':_0xe0bbd7[_0xd3b4('0x43')]['id']}},_0x533263={};_0x533263[_0xd3b4('0x2e')]=_[_0xd3b4('0x30')](db['ZohoField'][_0xd3b4('0x2a')]);_0x533263[_0xd3b4('0x2f')]=_[_0xd3b4('0x30')](_0xe0bbd7[_0xd3b4('0x2f')]);_0x533263[_0xd3b4('0x31')]=_['intersection'](_0x533263[_0xd3b4('0x2e')],_0x533263[_0xd3b4('0x2f')]);_0x41c190['attributes']=_['intersection'](_0x533263['model'],qs[_0xd3b4('0x34')](_0xe0bbd7['query'][_0xd3b4('0x34')]));_0x41c190[_0xd3b4('0x33')]=_0x41c190[_0xd3b4('0x33')]['length']?_0x41c190['attributes']:_0x533263[_0xd3b4('0x2e')];if(_0xe0bbd7[_0xd3b4('0x2f')][_0xd3b4('0x3e')]){_0x41c190[_0xd3b4('0x3f')]=[{'all':!![]}];}_0x41c190=_['merge']({},_0x41c190,_0xe0bbd7[_0xd3b4('0x3d')]);return db[_0xd3b4('0x29')][_0xd3b4('0x44')](_0x41c190)[_0xd3b4('0x24')](handleEntityNotFound(_0x200730,null))[_0xd3b4('0x24')](respondWithResult(_0x200730,null))[_0xd3b4('0x41')](handleError(_0x200730,null));};exports[_0xd3b4('0x45')]=function(_0x3f798f,_0x5d21ee){return db[_0xd3b4('0x29')][_0xd3b4('0x45')](_0x3f798f[_0xd3b4('0x46')],{})[_0xd3b4('0x24')](respondWithResult(_0x5d21ee,0xc9))[_0xd3b4('0x41')](handleError(_0x5d21ee,null));};exports[_0xd3b4('0x23')]=function(_0x2647e6,_0xcba5){if(_0x2647e6[_0xd3b4('0x46')]['id']){delete _0x2647e6[_0xd3b4('0x46')]['id'];}return db[_0xd3b4('0x29')][_0xd3b4('0x44')]({'where':{'id':_0x2647e6['params']['id']}})[_0xd3b4('0x24')](handleEntityNotFound(_0xcba5,null))[_0xd3b4('0x24')](saveUpdates(_0x2647e6[_0xd3b4('0x46')],null))['then'](respondWithResult(_0xcba5,null))[_0xd3b4('0x41')](handleError(_0xcba5,null));};exports[_0xd3b4('0x47')]=function(_0x442db8,_0x2dc47e){return db[_0xd3b4('0x29')][_0xd3b4('0x44')]({'where':{'id':_0x442db8[_0xd3b4('0x43')]['id']}})[_0xd3b4('0x24')](handleEntityNotFound(_0x2dc47e,null))[_0xd3b4('0x24')](removeEntity(_0x2dc47e,null))[_0xd3b4('0x41')](handleError(_0x2dc47e,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index fa77574..c97ce5f 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 _0xe6f3=['request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','int_zoho_fields','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6f3,0x1bb));var _0x3e6f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe6f3[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x3e6f('0x0'));var logger=require(_0x3e6f('0x1'))(_0x3e6f('0x2'));var moment=require(_0x3e6f('0x3'));var BPromise=require(_0x3e6f('0x4'));var rp=require(_0x3e6f('0x5'));var fs=require('fs');var path=require(_0x3e6f('0x6'));var rimraf=require(_0x3e6f('0x7'));var config=require(_0x3e6f('0x8'));var attributes=require(_0x3e6f('0x9'));module[_0x3e6f('0xa')]=function(_0x18c768,_0x3839bd){return _0x18c768['define']('ZohoField',attributes,{'tableName':_0x3e6f('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x3e6f('0xc'),_0x3e6f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e8d=['lodash','util','../../config/logger','api','bluebird','request-promise','path','exports','define','ZohoField','zoho_unique_index','idField','FieldId'];(function(_0x3a9b86,_0x3d5660){var _0x4a8e74=function(_0x429a15){while(--_0x429a15){_0x3a9b86['push'](_0x3a9b86['shift']());}};_0x4a8e74(++_0x3d5660);}(_0x2e8d,0x1ee));var _0xd2e8=function(_0x489ba5,_0xa1a03c){_0x489ba5=_0x489ba5-0x0;var _0x3727e9=_0x2e8d[_0x489ba5];return _0x3727e9;};'use strict';var _=require(_0xd2e8('0x0'));var util=require(_0xd2e8('0x1'));var logger=require(_0xd2e8('0x2'))(_0xd2e8('0x3'));var moment=require('moment');var BPromise=require(_0xd2e8('0x4'));var rp=require(_0xd2e8('0x5'));var fs=require('fs');var path=require(_0xd2e8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0xd2e8('0x7')]=function(_0x597274,_0x2b07b2){return _0x597274[_0xd2e8('0x8')](_0xd2e8('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xd2e8('0xa'),'fields':[_0xd2e8('0xb'),_0xd2e8('0xc')],'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 701fcce..9343d4a 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3b1ef9,_0x239b83){var _0x5077bd=function(_0x35a908){while(--_0x35a908){_0x3b1ef9['push'](_0x3b1ef9['shift']());}};_0x5077bd(++_0x239b83);}(_0x34e8,0x12c));var _0x834e=function(_0x3e62ad,_0x2ed58e){_0x3e62ad=_0x3e62ad-0x0;var _0x8d5433=_0x34e8[_0x3e62ad];return _0x8d5433;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('ZohoField,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('ZohoField,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x24ca=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s'];(function(_0x49d02a,_0xbb6876){var _0x1dc79d=function(_0x2bcf84){while(--_0x2bcf84){_0x49d02a['push'](_0x49d02a['shift']());}};_0x1dc79d(++_0xbb6876);}(_0x24ca,0x1bc));var _0xa24c=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x24ca[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){return client[_0xa24c('0xc')](_0x2dd348,_0x9a5013)[_0xa24c('0xd')](function(_0x5eac78){logger[_0xa24c('0xe')](_0xa24c('0xf'),_0x257264,_0xa24c('0x10'));logger[_0xa24c('0x11')](_0xa24c('0x12'),_0x257264,_0xa24c('0x10'),JSON[_0xa24c('0x13')](_0x5eac78));if(_0x5eac78[_0xa24c('0x14')]){if(_0x5eac78[_0xa24c('0x14')]['code']===0x1f4){logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x42d89c(_0x5eac78['error'][_0xa24c('0x15')]);}logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x481196(_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x257264,_0xa24c('0x10'));_0x481196(_0x5eac78[_0xa24c('0x16')]['message']);}})['catch'](function(_0x221d21){logger[_0xa24c('0x14')]('ZohoField,\x20%s,\x20%s',_0x257264,_0x221d21);_0x42d89c(_0x221d21);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 644ba82..0fc3400 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 _0x9263=['../../config/environment','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x187499,_0x5e416a){var _0x2965fe=function(_0xc6645e){while(--_0xc6645e){_0x187499['push'](_0x187499['shift']());}};_0x2965fe(++_0x5e416a);}(_0x9263,0x10c));var _0x3926=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x9263[_0x3305de];return _0x3b5a84;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3926('0x0'));var express=require(_0x3926('0x1'));var router=express[_0x3926('0x2')]();var auth=require(_0x3926('0x3'));var interaction=require(_0x3926('0x4'));var config=require(_0x3926('0x5'));module[_0x3926('0x6')]=router; \ No newline at end of file +var _0x1327=['../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x244f5d,_0x3c98c6){var _0x1a3886=function(_0x2bf049){while(--_0x2bf049){_0x244f5d['push'](_0x244f5d['shift']());}};_0x1a3886(++_0x3c98c6);}(_0x1327,0x192));var _0x7132=function(_0x4e72a5,_0x59d207){_0x4e72a5=_0x4e72a5-0x0;var _0x5c608f=_0x1327[_0x4e72a5];return _0x5c608f;};'use strict';var multer=require(_0x7132('0x0'));var util=require(_0x7132('0x1'));var path=require(_0x7132('0x2'));var timeout=require(_0x7132('0x3'));var express=require('express');var router=express[_0x7132('0x4')]();var auth=require(_0x7132('0x5'));var interaction=require(_0x7132('0x6'));var config=require(_0x7132('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 9e46df2..733cfa6 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 _0x1b81=['unique_name_and_version','app.js','STRING','INTEGER'];(function(_0x422a6a,_0x34cc4){var _0x137714=function(_0xfee063){while(--_0xfee063){_0x422a6a['push'](_0x422a6a['shift']());}};_0x137714(++_0x34cc4);}(_0x1b81,0x1e0));var _0x11b8=function(_0x1b1ade,_0xcd78bd){_0x1b1ade=_0x1b1ade-0x0;var _0x44f66d=_0x1b81[_0x1b1ade];return _0x44f66d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x11b8('0x0')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x11b8('0x0')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x11b8('0x1')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x11b8('0x2')]},'size':{'type':Sequelize[_0x11b8('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x11b8('0x2')]},'logo':{'type':Sequelize[_0x11b8('0x2')]},'state':{'type':Sequelize[_0x11b8('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x11b8('0x2')]},'title':{'type':Sequelize[_0x11b8('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x11b8('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x09ab=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0xaf524,_0x288431){var _0x4a5cf2=function(_0x5c1330){while(--_0x5c1330){_0xaf524['push'](_0xaf524['shift']());}};_0x4a5cf2(++_0x288431);}(_0x09ab,0x179));var _0xb09a=function(_0x561d9f,_0x447dea){_0x561d9f=_0x561d9f-0x0;var _0x4ecca0=_0x09ab[_0x561d9f];return _0x4ecca0;};'use strict';var Sequelize=require(_0xb09a('0x0'));module[_0xb09a('0x1')]={'name':{'type':Sequelize[_0xb09a('0x2')],'allowNull':![],'unique':_0xb09a('0x3')},'version':{'type':Sequelize[_0xb09a('0x2')],'allowNull':![],'unique':_0xb09a('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xb09a('0x4')},'filename':{'type':Sequelize[_0xb09a('0x2')]},'path':{'type':Sequelize[_0xb09a('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xb09a('0x5')]},'active':{'type':Sequelize[_0xb09a('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xb09a('0x2')],'unique':_0xb09a('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb09a('0x2')]},'link':{'type':Sequelize[_0xb09a('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 9379ad8..9162a14 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 _0x337f=['find','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','json','apply','reject','save','update','then','stack','send','map','Integration','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x4863ce,_0x5a4495){var _0xed3b70=function(_0x44dd70){while(--_0x44dd70){_0x4863ce['push'](_0x4863ce['shift']());}};_0xed3b70(++_0x5a4495);}(_0x337f,0x11c));var _0xf337=function(_0xaba5bf,_0x1f81e4){_0xaba5bf=_0xaba5bf-0x0;var _0x4f2a54=_0x337f[_0xaba5bf];return _0x4f2a54;};'use strict';var pdf=require(_0xf337('0x0'));var emlformat=require(_0xf337('0x1'));var rimraf=require(_0xf337('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf337('0x3'));var rp=require(_0xf337('0x4'));var moment=require(_0xf337('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf337('0x6'));var util=require(_0xf337('0x7'));var path=require('path');var sox=require(_0xf337('0x8'));var csv=require('to-csv');var ejs=require(_0xf337('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf337('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf337('0xb'));var toCsv=require(_0xf337('0xc'));var querystring=require(_0xf337('0xd'));var Papa=require(_0xf337('0xe'));var Redis=require(_0xf337('0xf'));var authService=require(_0xf337('0x10'));var qs=require(_0xf337('0x11'));var as=require(_0xf337('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf337('0x13'))(_0xf337('0x14'));var utils=require(_0xf337('0x15'));var config=require(_0xf337('0x16'));var licenseUtil=require(_0xf337('0x17'));var db=require(_0xf337('0x18'))['db'];function respondWithStatusCode(_0x3be783,_0x213810){_0x213810=_0x213810||0xcc;return function(_0x44721e){if(_0x44721e){return _0x3be783[_0xf337('0x19')](_0x213810);}return _0x3be783[_0xf337('0x1a')](_0x213810)[_0xf337('0x1b')]();};}function respondWithResult(_0x53d3bc,_0x2da77a){_0x2da77a=_0x2da77a||0xc8;return function(_0x3873ea){if(_0x3873ea){return _0x53d3bc[_0xf337('0x1a')](_0x2da77a)['json'](_0x3873ea);}};}function respondWithFilteredResult(_0x407f05,_0x4ad818){return function(_0x5de61e){if(_0x5de61e){var _0x1147e4=_0x5de61e[_0xf337('0x1c')],_0x39146c=_0x4ad818['offset'],_0x100cb0=_0x4ad818[_0xf337('0x1d')]+_0x4ad818[_0xf337('0x1e')],_0x4a7e4c;if(_0x100cb0>=_0x1147e4){_0x100cb0=_0x1147e4;_0x4a7e4c=0xc8;}else{_0x4a7e4c=0xce;}_0x407f05[_0xf337('0x1a')](_0x4a7e4c);return _0x407f05['set']('Content-Range',_0x39146c+'-'+_0x100cb0+'/'+_0x1147e4)[_0xf337('0x1f')](_0x5de61e);}return null;};}function patchUpdates(_0x303d97){return function(_0x193607){try{jsonpatch[_0xf337('0x20')](_0x193607,_0x303d97,!![]);}catch(_0x8858fe){return BPromise[_0xf337('0x21')](_0x8858fe);}return _0x193607[_0xf337('0x22')]();};}function saveUpdates(_0x240612,_0x424326){return function(_0x15074d){if(_0x15074d){return _0x15074d[_0xf337('0x23')](_0x240612)[_0xf337('0x24')](function(_0x1b9429){return _0x1b9429;});}return null;};}function removeEntity(_0x5e56d8,_0x2d9e2e){return function(_0x4e4191){if(_0x4e4191){return _0x4e4191['destroy']()[_0xf337('0x24')](function(){_0x5e56d8[_0xf337('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ef1cc,_0x3880b4){return function(_0x48f81e){if(!_0x48f81e){_0x1ef1cc['sendStatus'](0x194);}return _0x48f81e;};}function handleError(_0xe332ef,_0x5dceac){_0x5dceac=_0x5dceac||0x1f4;return function(_0x4e906a){logger['error'](_0x4e906a[_0xf337('0x25')]);if(_0x4e906a['name']){delete _0x4e906a['name'];}_0xe332ef[_0xf337('0x1a')](_0x5dceac)[_0xf337('0x26')](_0x4e906a);};}exports['index']=function(_0x57b357,_0x1f28ff){var _0x1d76c1={},_0x1863b4={},_0x311eb2={'count':0x0,'rows':[]};var _0x4d1242=_[_0xf337('0x27')](db[_0xf337('0x28')][_0xf337('0x29')],function(_0x1053cd){return{'name':_0x1053cd[_0xf337('0x2a')],'type':_0x1053cd[_0xf337('0x2b')]['key']};});_0x1863b4[_0xf337('0x2c')]=_[_0xf337('0x27')](_0x4d1242,_0xf337('0x2d'));_0x1863b4[_0xf337('0x2e')]=_[_0xf337('0x2f')](_0x57b357['query']);_0x1863b4[_0xf337('0x30')]=_[_0xf337('0x31')](_0x1863b4[_0xf337('0x2c')],_0x1863b4['query']);_0x1d76c1[_0xf337('0x32')]=_[_0xf337('0x31')](_0x1863b4[_0xf337('0x2c')],qs[_0xf337('0x33')](_0x57b357[_0xf337('0x2e')]['fields']));_0x1d76c1['attributes']=_0x1d76c1['attributes'][_0xf337('0x34')]?_0x1d76c1[_0xf337('0x32')]:_0x1863b4[_0xf337('0x2c')];if(!_0x57b357[_0xf337('0x2e')]['hasOwnProperty'](_0xf337('0x35'))){_0x1d76c1['limit']=qs[_0xf337('0x1e')](_0x57b357[_0xf337('0x2e')][_0xf337('0x1e')]);_0x1d76c1[_0xf337('0x1d')]=qs[_0xf337('0x1d')](_0x57b357[_0xf337('0x2e')][_0xf337('0x1d')]);}_0x1d76c1['order']=qs[_0xf337('0x36')](_0x57b357[_0xf337('0x2e')][_0xf337('0x36')]);_0x1d76c1[_0xf337('0x37')]=qs[_0xf337('0x30')](_['pick'](_0x57b357[_0xf337('0x2e')],_0x1863b4[_0xf337('0x30')]),_0x4d1242);if(_0x57b357['query'][_0xf337('0x38')]){_0x1d76c1[_0xf337('0x37')]=_[_0xf337('0x39')](_0x1d76c1['where'],{'$or':_[_0xf337('0x27')](_0x4d1242,function(_0x1a089f){if(_0x1a089f['type']!==_0xf337('0x3a')){var _0x517592={};_0x517592[_0x1a089f[_0xf337('0x2d')]]={'$like':'%'+_0x57b357['query'][_0xf337('0x38')]+'%'};return _0x517592;}})});}_0x1d76c1=_[_0xf337('0x39')]({},_0x1d76c1,_0x57b357[_0xf337('0x3b')]);var _0x4d989f={'where':_0x1d76c1[_0xf337('0x37')]};return db[_0xf337('0x28')]['count'](_0x4d989f)['then'](function(_0x1ff5b3){_0x311eb2[_0xf337('0x1c')]=_0x1ff5b3;if(_0x57b357[_0xf337('0x2e')][_0xf337('0x3c')]){_0x1d76c1[_0xf337('0x3d')]=[{'all':!![]}];}return db[_0xf337('0x28')][_0xf337('0x3e')](_0x1d76c1);})[_0xf337('0x24')](function(_0x4f7caf){_0x311eb2[_0xf337('0x3f')]=_0x4f7caf;return _0x311eb2;})[_0xf337('0x24')](respondWithFilteredResult(_0x1f28ff,_0x1d76c1))[_0xf337('0x40')](handleError(_0x1f28ff,null));};exports[_0xf337('0x41')]=function(_0x4a8e1c,_0x57fcb0){var _0x106cae={'raw':![],'where':{'id':_0x4a8e1c['params']['id']}},_0x45bc59={};_0x45bc59[_0xf337('0x2c')]=_[_0xf337('0x2f')](db[_0xf337('0x28')][_0xf337('0x29')]);_0x45bc59['query']=_[_0xf337('0x2f')](_0x4a8e1c[_0xf337('0x2e')]);_0x45bc59[_0xf337('0x30')]=_[_0xf337('0x31')](_0x45bc59[_0xf337('0x2c')],_0x45bc59[_0xf337('0x2e')]);_0x106cae[_0xf337('0x32')]=_[_0xf337('0x31')](_0x45bc59[_0xf337('0x2c')],qs['fields'](_0x4a8e1c['query'][_0xf337('0x33')]));_0x106cae['attributes']=_0x106cae[_0xf337('0x32')][_0xf337('0x34')]?_0x106cae[_0xf337('0x32')]:_0x45bc59[_0xf337('0x2c')];if(_0x4a8e1c['query']['includeAll']){_0x106cae[_0xf337('0x3d')]=[{'all':!![]}];}_0x106cae=_[_0xf337('0x39')]({},_0x106cae,_0x4a8e1c['options']);return db['Integration'][_0xf337('0x42')](_0x106cae)[_0xf337('0x24')](handleEntityNotFound(_0x57fcb0,null))[_0xf337('0x24')](respondWithResult(_0x57fcb0,null))[_0xf337('0x40')](handleError(_0x57fcb0,null));};exports[_0xf337('0x43')]=function(_0x1dc89f,_0x27570f){return db['Integration']['create'](_0x1dc89f[_0xf337('0x44')],{})[_0xf337('0x24')](respondWithResult(_0x27570f,0xc9))[_0xf337('0x40')](handleError(_0x27570f,null));};exports[_0xf337('0x23')]=function(_0x38470d,_0x3e841a){if(_0x38470d['body']['id']){delete _0x38470d[_0xf337('0x44')]['id'];}return db[_0xf337('0x28')][_0xf337('0x42')]({'where':{'id':_0x38470d['params']['id']}})[_0xf337('0x24')](handleEntityNotFound(_0x3e841a,null))[_0xf337('0x24')](saveUpdates(_0x38470d['body'],null))[_0xf337('0x24')](respondWithResult(_0x3e841a,null))[_0xf337('0x40')](handleError(_0x3e841a,null));};exports[_0xf337('0x45')]=function(_0x46d876,_0x1a6233){return db[_0xf337('0x28')][_0xf337('0x42')]({'where':{'id':_0x46d876['params']['id']}})['then'](handleEntityNotFound(_0x1a6233,null))[_0xf337('0x24')](removeEntity(_0x1a6233,null))[_0xf337('0x40')](handleError(_0x1a6233,null));}; \ No newline at end of file +var _0x314e=['model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','options','include','catch','show','params','length','includeAll','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x103e59,_0x19e72a){var _0x17c311=function(_0x580e2d){while(--_0x580e2d){_0x103e59['push'](_0x103e59['shift']());}};_0x17c311(++_0x19e72a);}(_0x314e,0x173));var _0xe314=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x314e[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xe314('0x0'));var emlformat=require(_0xe314('0x1'));var rimraf=require(_0xe314('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe314('0x3'));var rp=require('request-promise');var moment=require(_0xe314('0x4'));var BPromise=require(_0xe314('0x5'));var Mustache=require('mustache');var util=require(_0xe314('0x6'));var path=require('path');var sox=require(_0xe314('0x7'));var csv=require(_0xe314('0x8'));var ejs=require(_0xe314('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe314('0xa'));var jsforce=require(_0xe314('0xb'));var deskjs=require(_0xe314('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe314('0xd'));var Redis=require(_0xe314('0xe'));var authService=require(_0xe314('0xf'));var qs=require(_0xe314('0x10'));var as=require(_0xe314('0x11'));var hardwareService=require(_0xe314('0x12'));var logger=require(_0xe314('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe314('0x14'));var licenseUtil=require(_0xe314('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cb3b3,_0x2888b9){_0x2888b9=_0x2888b9||0xcc;return function(_0x1b7407){if(_0x1b7407){return _0x5cb3b3['sendStatus'](_0x2888b9);}return _0x5cb3b3['status'](_0x2888b9)[_0xe314('0x16')]();};}function respondWithResult(_0x1a0df8,_0xb59a5e){_0xb59a5e=_0xb59a5e||0xc8;return function(_0x365ddf){if(_0x365ddf){return _0x1a0df8[_0xe314('0x17')](_0xb59a5e)[_0xe314('0x18')](_0x365ddf);}};}function respondWithFilteredResult(_0x2a4644,_0x58e694){return function(_0x4af251){if(_0x4af251){var _0x4f0705=_0x4af251[_0xe314('0x19')],_0x52dde9=_0x58e694['offset'],_0x529279=_0x58e694[_0xe314('0x1a')]+_0x58e694[_0xe314('0x1b')],_0x503bb2;if(_0x529279>=_0x4f0705){_0x529279=_0x4f0705;_0x503bb2=0xc8;}else{_0x503bb2=0xce;}_0x2a4644['status'](_0x503bb2);return _0x2a4644[_0xe314('0x1c')](_0xe314('0x1d'),_0x52dde9+'-'+_0x529279+'/'+_0x4f0705)[_0xe314('0x18')](_0x4af251);}return null;};}function patchUpdates(_0x2368c9){return function(_0x54e426){try{jsonpatch[_0xe314('0x1e')](_0x54e426,_0x2368c9,!![]);}catch(_0xf4da4e){return BPromise[_0xe314('0x1f')](_0xf4da4e);}return _0x54e426[_0xe314('0x20')]();};}function saveUpdates(_0xd37018,_0x9f7c02){return function(_0x265c35){if(_0x265c35){return _0x265c35[_0xe314('0x21')](_0xd37018)[_0xe314('0x22')](function(_0x562e4a){return _0x562e4a;});}return null;};}function removeEntity(_0x11c27f,_0x3a9326){return function(_0x5ce605){if(_0x5ce605){return _0x5ce605[_0xe314('0x23')]()[_0xe314('0x22')](function(){_0x11c27f[_0xe314('0x17')](0xcc)[_0xe314('0x16')]();});}};}function handleEntityNotFound(_0x1f1625,_0x5d62b4){return function(_0x3cfe75){if(!_0x3cfe75){_0x1f1625[_0xe314('0x24')](0x194);}return _0x3cfe75;};}function handleError(_0x288066,_0x201690){_0x201690=_0x201690||0x1f4;return function(_0x4effcd){logger[_0xe314('0x25')](_0x4effcd['stack']);if(_0x4effcd[_0xe314('0x26')]){delete _0x4effcd[_0xe314('0x26')];}_0x288066[_0xe314('0x17')](_0x201690)[_0xe314('0x27')](_0x4effcd);};}exports['index']=function(_0x3911e7,_0xb0a1ac){var _0x1cf240={},_0x346b61={},_0x1116f7={'count':0x0,'rows':[]};var _0x378895=_[_0xe314('0x28')](db[_0xe314('0x29')][_0xe314('0x2a')],function(_0x561baa){return{'name':_0x561baa[_0xe314('0x2b')],'type':_0x561baa[_0xe314('0x2c')][_0xe314('0x2d')]};});_0x346b61['model']=_[_0xe314('0x28')](_0x378895,'name');_0x346b61[_0xe314('0x2e')]=_[_0xe314('0x2f')](_0x3911e7[_0xe314('0x2e')]);_0x346b61[_0xe314('0x30')]=_['intersection'](_0x346b61[_0xe314('0x31')],_0x346b61[_0xe314('0x2e')]);_0x1cf240[_0xe314('0x32')]=_[_0xe314('0x33')](_0x346b61[_0xe314('0x31')],qs[_0xe314('0x34')](_0x3911e7[_0xe314('0x2e')][_0xe314('0x34')]));_0x1cf240['attributes']=_0x1cf240[_0xe314('0x32')]['length']?_0x1cf240['attributes']:_0x346b61[_0xe314('0x31')];if(!_0x3911e7[_0xe314('0x2e')]['hasOwnProperty'](_0xe314('0x35'))){_0x1cf240[_0xe314('0x1b')]=qs[_0xe314('0x1b')](_0x3911e7[_0xe314('0x2e')][_0xe314('0x1b')]);_0x1cf240[_0xe314('0x1a')]=qs[_0xe314('0x1a')](_0x3911e7[_0xe314('0x2e')][_0xe314('0x1a')]);}_0x1cf240[_0xe314('0x36')]=qs[_0xe314('0x37')](_0x3911e7[_0xe314('0x2e')][_0xe314('0x37')]);_0x1cf240[_0xe314('0x38')]=qs[_0xe314('0x30')](_[_0xe314('0x39')](_0x3911e7[_0xe314('0x2e')],_0x346b61[_0xe314('0x30')]),_0x378895);if(_0x3911e7[_0xe314('0x2e')][_0xe314('0x3a')]){_0x1cf240['where']=_[_0xe314('0x3b')](_0x1cf240['where'],{'$or':_['map'](_0x378895,function(_0x10916b){if(_0x10916b['type']!=='VIRTUAL'){var _0x1fa3aa={};_0x1fa3aa[_0x10916b[_0xe314('0x26')]]={'$like':'%'+_0x3911e7[_0xe314('0x2e')][_0xe314('0x3a')]+'%'};return _0x1fa3aa;}})});}_0x1cf240=_[_0xe314('0x3b')]({},_0x1cf240,_0x3911e7[_0xe314('0x3c')]);var _0x29834a={'where':_0x1cf240['where']};return db[_0xe314('0x29')][_0xe314('0x19')](_0x29834a)['then'](function(_0x28b0d2){_0x1116f7[_0xe314('0x19')]=_0x28b0d2;if(_0x3911e7[_0xe314('0x2e')]['includeAll']){_0x1cf240[_0xe314('0x3d')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x1cf240);})[_0xe314('0x22')](function(_0x279073){_0x1116f7['rows']=_0x279073;return _0x1116f7;})[_0xe314('0x22')](respondWithFilteredResult(_0xb0a1ac,_0x1cf240))[_0xe314('0x3e')](handleError(_0xb0a1ac,null));};exports[_0xe314('0x3f')]=function(_0x5b06b1,_0x45d231){var _0x2e86f1={'raw':![],'where':{'id':_0x5b06b1[_0xe314('0x40')]['id']}},_0x121ad8={};_0x121ad8[_0xe314('0x31')]=_[_0xe314('0x2f')](db[_0xe314('0x29')][_0xe314('0x2a')]);_0x121ad8[_0xe314('0x2e')]=_[_0xe314('0x2f')](_0x5b06b1[_0xe314('0x2e')]);_0x121ad8[_0xe314('0x30')]=_[_0xe314('0x33')](_0x121ad8[_0xe314('0x31')],_0x121ad8[_0xe314('0x2e')]);_0x2e86f1[_0xe314('0x32')]=_[_0xe314('0x33')](_0x121ad8[_0xe314('0x31')],qs[_0xe314('0x34')](_0x5b06b1[_0xe314('0x2e')][_0xe314('0x34')]));_0x2e86f1[_0xe314('0x32')]=_0x2e86f1['attributes'][_0xe314('0x41')]?_0x2e86f1[_0xe314('0x32')]:_0x121ad8[_0xe314('0x31')];if(_0x5b06b1['query'][_0xe314('0x42')]){_0x2e86f1[_0xe314('0x3d')]=[{'all':!![]}];}_0x2e86f1=_['merge']({},_0x2e86f1,_0x5b06b1[_0xe314('0x3c')]);return db[_0xe314('0x29')]['find'](_0x2e86f1)['then'](handleEntityNotFound(_0x45d231,null))[_0xe314('0x22')](respondWithResult(_0x45d231,null))[_0xe314('0x3e')](handleError(_0x45d231,null));};exports[_0xe314('0x43')]=function(_0x18bf68,_0x497fa0){return db[_0xe314('0x29')]['create'](_0x18bf68[_0xe314('0x44')],{})[_0xe314('0x22')](respondWithResult(_0x497fa0,0xc9))[_0xe314('0x3e')](handleError(_0x497fa0,null));};exports[_0xe314('0x21')]=function(_0x5f10a4,_0x174fc0){if(_0x5f10a4[_0xe314('0x44')]['id']){delete _0x5f10a4[_0xe314('0x44')]['id'];}return db[_0xe314('0x29')]['find']({'where':{'id':_0x5f10a4[_0xe314('0x40')]['id']}})['then'](handleEntityNotFound(_0x174fc0,null))[_0xe314('0x22')](saveUpdates(_0x5f10a4[_0xe314('0x44')],null))[_0xe314('0x22')](respondWithResult(_0x174fc0,null))[_0xe314('0x3e')](handleError(_0x174fc0,null));};exports[_0xe314('0x23')]=function(_0x29af46,_0x52f28d){return db['Integration'][_0xe314('0x45')]({'where':{'id':_0x29af46[_0xe314('0x40')]['id']}})[_0xe314('0x22')](handleEntityNotFound(_0x52f28d,null))[_0xe314('0x22')](removeEntity(_0x52f28d,null))['catch'](handleError(_0x52f28d,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 435e399..0c7d234 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 _0x7c4b=['bluebird','request-promise','path','../../config/environment','exports','integrations','util','../../config/logger','api','moment'];(function(_0x55f345,_0x50ade5){var _0x28afce=function(_0x4ce70c){while(--_0x4ce70c){_0x55f345['push'](_0x55f345['shift']());}};_0x28afce(++_0x50ade5);}(_0x7c4b,0xb0));var _0xb7c4=function(_0x25ecbf,_0x165978){_0x25ecbf=_0x25ecbf-0x0;var _0x3a987f=_0x7c4b[_0x25ecbf];return _0x3a987f;};'use strict';var _=require('lodash');var util=require(_0xb7c4('0x0'));var logger=require(_0xb7c4('0x1'))(_0xb7c4('0x2'));var moment=require(_0xb7c4('0x3'));var BPromise=require(_0xb7c4('0x4'));var rp=require(_0xb7c4('0x5'));var fs=require('fs');var path=require(_0xb7c4('0x6'));var rimraf=require('rimraf');var config=require(_0xb7c4('0x7'));var attributes=require('./integration.attributes');module[_0xb7c4('0x8')]=function(_0x54b86e,_0x182771){return _0x54b86e['define']('Integration',attributes,{'tableName':_0xb7c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05b4=['../../config/environment','./integration.attributes','exports','define','Integration','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x05b4,0x1cd));var _0x405b=function(_0xaf7bae,_0x571f22){_0xaf7bae=_0xaf7bae-0x0;var _0x5e446d=_0x05b4[_0xaf7bae];return _0x5e446d;};'use strict';var _=require(_0x405b('0x0'));var util=require(_0x405b('0x1'));var logger=require(_0x405b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x405b('0x3'));var rp=require(_0x405b('0x4'));var fs=require('fs');var path=require(_0x405b('0x5'));var rimraf=require(_0x405b('0x6'));var config=require(_0x405b('0x7'));var attributes=require(_0x405b('0x8'));module[_0x405b('0x9')]=function(_0x3b5980,_0x286f6b){return _0x3b5980[_0x405b('0xa')](_0x405b('0xb'),attributes,{'tableName':'integrations','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 02aaf8b..890540a 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 _0x93b6=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0xb6890,_0x5d9f5b){var _0x452ec5=function(_0x33f0c9){while(--_0x33f0c9){_0xb6890['push'](_0xb6890['shift']());}};_0x452ec5(++_0x5d9f5b);}(_0x93b6,0x151));var _0x693b=function(_0x4787d7,_0x93e670){_0x4787d7=_0x4787d7-0x0;var _0x444f4a=_0x93b6[_0x4787d7];return _0x444f4a;};'use strict';var _=require(_0x693b('0x0'));var util=require(_0x693b('0x1'));var moment=require('moment');var BPromise=require(_0x693b('0x2'));var rs=require(_0x693b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x693b('0x4'))['db'];var utils=require(_0x693b('0x5'));var logger=require(_0x693b('0x6'))(_0x693b('0x7'));var config=require(_0x693b('0x8'));var jayson=require(_0x693b('0x9'));var client=jayson[_0x693b('0xa')][_0x693b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e2cd4,_0x2a8ec8,_0x484f5b){return new BPromise(function(_0x4a3466,_0x54ae5c){return client[_0x693b('0xc')](_0x3e2cd4,_0x484f5b)[_0x693b('0xd')](function(_0x1f41e8){logger[_0x693b('0xe')](_0x693b('0xf'),_0x2a8ec8,_0x693b('0x10'));logger[_0x693b('0x11')](_0x693b('0x12'),_0x2a8ec8,'request\x20sent',JSON[_0x693b('0x13')](_0x1f41e8));if(_0x1f41e8[_0x693b('0x14')]){if(_0x1f41e8[_0x693b('0x14')]['code']===0x1f4){logger[_0x693b('0x14')](_0x693b('0xf'),_0x2a8ec8,_0x1f41e8[_0x693b('0x14')][_0x693b('0x15')]);return _0x54ae5c(_0x1f41e8[_0x693b('0x14')][_0x693b('0x15')]);}logger[_0x693b('0x14')]('Integration,\x20%s,\x20%s',_0x2a8ec8,_0x1f41e8[_0x693b('0x14')][_0x693b('0x15')]);return _0x4a3466(_0x1f41e8[_0x693b('0x14')][_0x693b('0x15')]);}else{logger[_0x693b('0xe')](_0x693b('0xf'),_0x2a8ec8,_0x693b('0x10'));_0x4a3466(_0x1f41e8[_0x693b('0x16')][_0x693b('0x15')]);}})[_0x693b('0x17')](function(_0x34a178){logger[_0x693b('0x14')]('Integration,\x20%s,\x20%s',_0x2a8ec8,_0x34a178);_0x54ae5c(_0x34a178);});});} \ No newline at end of file +var _0xc99e=['Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2c1265,_0x1f04d8){var _0x2b1084=function(_0x1ef9ce){while(--_0x1ef9ce){_0x2c1265['push'](_0x2c1265['shift']());}};_0x2b1084(++_0x1f04d8);}(_0xc99e,0x6e));var _0xec99=function(_0x43d3ed,_0xa17d4){_0x43d3ed=_0x43d3ed-0x0;var _0x2affeb=_0xc99e[_0x43d3ed];return _0x2affeb;};'use strict';var _=require(_0xec99('0x0'));var util=require(_0xec99('0x1'));var moment=require(_0xec99('0x2'));var BPromise=require(_0xec99('0x3'));var rs=require(_0xec99('0x4'));var fs=require('fs');var Redis=require(_0xec99('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xec99('0x6'));var logger=require(_0xec99('0x7'))(_0xec99('0x8'));var config=require(_0xec99('0x9'));var jayson=require(_0xec99('0xa'));var client=jayson[_0xec99('0xb')][_0xec99('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x470d70,_0x558b08,_0x797806){return new BPromise(function(_0x425a61,_0x546391){return client[_0xec99('0xd')](_0x470d70,_0x797806)[_0xec99('0xe')](function(_0x47ecf6){logger['info'](_0xec99('0xf'),_0x558b08,_0xec99('0x10'));logger[_0xec99('0x11')]('Integration,\x20%s,\x20%s,\x20%s',_0x558b08,_0xec99('0x10'),JSON[_0xec99('0x12')](_0x47ecf6));if(_0x47ecf6[_0xec99('0x13')]){if(_0x47ecf6[_0xec99('0x13')][_0xec99('0x14')]===0x1f4){logger[_0xec99('0x13')]('Integration,\x20%s,\x20%s',_0x558b08,_0x47ecf6[_0xec99('0x13')]['message']);return _0x546391(_0x47ecf6[_0xec99('0x13')]['message']);}logger[_0xec99('0x13')]('Integration,\x20%s,\x20%s',_0x558b08,_0x47ecf6['error'][_0xec99('0x15')]);return _0x425a61(_0x47ecf6['error'][_0xec99('0x15')]);}else{logger[_0xec99('0x16')](_0xec99('0xf'),_0x558b08,_0xec99('0x10'));_0x425a61(_0x47ecf6[_0xec99('0x17')][_0xec99('0x15')]);}})[_0xec99('0x18')](function(_0x4e03db){logger[_0xec99('0x13')](_0xec99('0xf'),_0x558b08,_0x4e03db);_0x546391(_0x4e03db);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 1cd0891..f499d79 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 _0x7c80=['show','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./integrationReport.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x8ca3e2,_0x24bbdc){var _0x3220d2=function(_0x4d6b17){while(--_0x4d6b17){_0x8ca3e2['push'](_0x8ca3e2['shift']());}};_0x3220d2(++_0x24bbdc);}(_0x7c80,0xa4));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x07c8('0x0'));var util=require(_0x07c8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x07c8('0x2'));var router=express[_0x07c8('0x3')]();var auth=require(_0x07c8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x07c8('0x5'));var controller=require(_0x07c8('0x6'));router[_0x07c8('0x7')]('/',auth['isAuthenticated'](),controller[_0x07c8('0x8')]);router['get']('/describe',auth[_0x07c8('0x9')](),controller[_0x07c8('0xa')]);router[_0x07c8('0x7')](_0x07c8('0xb'),auth[_0x07c8('0x9')](),controller[_0x07c8('0xc')]);router['post']('/',auth[_0x07c8('0x9')](),controller['create']);router['put'](_0x07c8('0xb'),auth['isAuthenticated'](),controller[_0x07c8('0xd')]);router['delete']('/:id',auth[_0x07c8('0x9')](),controller[_0x07c8('0xe')]);module[_0x07c8('0xf')]=router; \ No newline at end of file +var _0xdeff=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer'];(function(_0x20ea37,_0x108e2b){var _0xf8200f=function(_0xd8ebff){while(--_0xd8ebff){_0x20ea37['push'](_0x20ea37['shift']());}};_0xf8200f(++_0x108e2b);}(_0xdeff,0xef));var _0xfdef=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0xdeff[_0x12254f];return _0x3a4fa2;};'use strict';var multer=require(_0xfdef('0x0'));var util=require(_0xfdef('0x1'));var path=require(_0xfdef('0x2'));var timeout=require(_0xfdef('0x3'));var express=require('express');var router=express[_0xfdef('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfdef('0x5'));var config=require(_0xfdef('0x6'));var controller=require(_0xfdef('0x7'));router[_0xfdef('0x8')]('/',auth[_0xfdef('0x9')](),controller[_0xfdef('0xa')]);router[_0xfdef('0x8')](_0xfdef('0xb'),auth[_0xfdef('0x9')](),controller[_0xfdef('0xc')]);router[_0xfdef('0x8')](_0xfdef('0xd'),auth['isAuthenticated'](),controller[_0xfdef('0xe')]);router['post']('/',auth[_0xfdef('0x9')](),controller['create']);router[_0xfdef('0xf')](_0xfdef('0xd'),auth['isAuthenticated'](),controller[_0xfdef('0x10')]);router[_0xfdef('0x11')](_0xfdef('0xd'),auth[_0xfdef('0x9')](),controller[_0xfdef('0x12')]);module[_0xfdef('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f70de73..071452b 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 _0x1d09=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED'];(function(_0x5924a8,_0x1bf491){var _0xf9c5c2=function(_0x29ec09){while(--_0x29ec09){_0x5924a8['push'](_0x5924a8['shift']());}};_0xf9c5c2(++_0x1bf491);}(_0x1d09,0x12a));var _0x91d0=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x1d09[_0x2706da];return _0x3ba87e;};'use strict';var Sequelize=require(_0x91d0('0x0'));module[_0x91d0('0x1')]={'integration':{'type':Sequelize[_0x91d0('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x91d0('0x2')]},'ticketId':{'type':Sequelize[_0x91d0('0x2')]},'integrationId':{'type':Sequelize[_0x91d0('0x3')]},'contacts':{'type':Sequelize[_0x91d0('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x91d0('0x2')]},'calleridname':{'type':Sequelize[_0x91d0('0x2')]},'queue':{'type':Sequelize[_0x91d0('0x2')]},'interface':{'type':Sequelize[_0x91d0('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x91d0('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x91d0('0x3')]},'agentcomplete':{'type':Sequelize[_0x91d0('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x91d0('0x4')]},'talktime':{'type':Sequelize[_0x91d0('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x91d0('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x91d0('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x91d0('0x4')]},'agentdump':{'type':Sequelize[_0x91d0('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x91d0('0x4')]},'lastevent':{'type':Sequelize[_0x91d0('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x91d0('0x3')]},'channelstatedesc':{'type':Sequelize[_0x91d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0x91d0('0x2')]},'connectedlinename':{'type':Sequelize[_0x91d0('0x2')]},'language':{'type':Sequelize[_0x91d0('0x2')]},'accountcode':{'type':Sequelize[_0x91d0('0x2')]},'context':{'type':Sequelize[_0x91d0('0x2')]},'exten':{'type':Sequelize[_0x91d0('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x91d0('0x2')]},'destchannelstate':{'type':Sequelize[_0x91d0('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x91d0('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x91d0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x91d0('0x2')]},'destexten':{'type':Sequelize[_0x91d0('0x2')]},'destpriority':{'type':Sequelize[_0x91d0('0x2')]},'destuniqueid':{'type':Sequelize[_0x91d0('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x91d0('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x91d0('0x2')]},'to':{'type':Sequelize[_0x91d0('0x2')]},'cc':{'type':Sequelize[_0x91d0('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x91d0('0x6')]},'status':{'type':Sequelize[_0x91d0('0x7')]('SENT',_0x91d0('0x8'),_0x91d0('0x9'),_0x91d0('0xa'))},'url':{'type':Sequelize[_0x91d0('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x91d0('0x3')]}}; \ No newline at end of file +var _0x645c=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','FAILED','sequelize'];(function(_0x4779ae,_0x1a74ac){var _0x25627f=function(_0x3882b8){while(--_0x3882b8){_0x4779ae['push'](_0x4779ae['shift']());}};_0x25627f(++_0x1a74ac);}(_0x645c,0xef));var _0xc645=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x645c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc645('0x0'));module[_0xc645('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xc645('0x2')]},'integrationId':{'type':Sequelize[_0xc645('0x3')]},'contacts':{'type':Sequelize[_0xc645('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc645('0x2')]},'calleridname':{'type':Sequelize[_0xc645('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xc645('0x2')]},'membername':{'type':Sequelize[_0xc645('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc645('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xc645('0x3')]},'agentcomplete':{'type':Sequelize[_0xc645('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc645('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xc645('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc645('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xc645('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc645('0x4')]},'lastevent':{'type':Sequelize[_0xc645('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xc645('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xc645('0x2')]},'language':{'type':Sequelize[_0xc645('0x2')]},'accountcode':{'type':Sequelize[_0xc645('0x2')]},'context':{'type':Sequelize[_0xc645('0x2')]},'exten':{'type':Sequelize[_0xc645('0x2')]},'priority':{'type':Sequelize[_0xc645('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc645('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xc645('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc645('0x2')]},'destcalleridname':{'type':Sequelize[_0xc645('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc645('0x2')]},'destaccountcode':{'type':Sequelize[_0xc645('0x2')]},'destcontext':{'type':Sequelize[_0xc645('0x2')]},'destexten':{'type':Sequelize[_0xc645('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xc645('0x2')]},'messageId':{'type':Sequelize[_0xc645('0x2')]},'inReplyTo':{'type':Sequelize[_0xc645('0x2')]},'subject':{'type':Sequelize[_0xc645('0x2')]},'from':{'type':Sequelize[_0xc645('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc645('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xc645('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xc645('0x7')](_0xc645('0x8'),'SENDING','RECEIVED',_0xc645('0x9'))},'url':{'type':Sequelize[_0xc645('0x2')]},'app':{'type':Sequelize[_0xc645('0x2')]},'appdata':{'type':Sequelize[_0xc645('0x2')]},'projectId':{'type':Sequelize[_0xc645('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 5b89c6c..8911e50 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 _0x0b08=['api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','save','then','error','stack','name','index','map','IntegrationReport','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','destroy','describe','html-pdf','eml-format','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2ed01c,_0x3adaf0){var _0x4f6dce=function(_0x34cec2){while(--_0x34cec2){_0x2ed01c['push'](_0x2ed01c['shift']());}};_0x4f6dce(++_0x3adaf0);}(_0x0b08,0x108));var _0x80b0=function(_0x59a3e9,_0x27fb38){_0x59a3e9=_0x59a3e9-0x0;var _0x5179ac=_0x0b08[_0x59a3e9];return _0x5179ac;};'use strict';var pdf=require(_0x80b0('0x0'));var emlformat=require(_0x80b0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x80b0('0x2'));var rp=require(_0x80b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x80b0('0x4'));var util=require('util');var path=require(_0x80b0('0x5'));var sox=require(_0x80b0('0x6'));var csv=require('to-csv');var ejs=require(_0x80b0('0x7'));var fs=require('fs');var _=require(_0x80b0('0x8'));var squel=require(_0x80b0('0x9'));var crypto=require(_0x80b0('0xa'));var jsforce=require(_0x80b0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x80b0('0xc'));var querystring=require(_0x80b0('0xd'));var Papa=require(_0x80b0('0xe'));var Redis=require('ioredis');var authService=require(_0x80b0('0xf'));var qs=require(_0x80b0('0x10'));var as=require(_0x80b0('0x11'));var hardwareService=require(_0x80b0('0x12'));var logger=require(_0x80b0('0x13'))(_0x80b0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x80b0('0x15'));var db=require(_0x80b0('0x16'))['db'];function respondWithStatusCode(_0x20b14d,_0x2552f5){_0x2552f5=_0x2552f5||0xcc;return function(_0x26540f){if(_0x26540f){return _0x20b14d['sendStatus'](_0x2552f5);}return _0x20b14d[_0x80b0('0x17')](_0x2552f5)[_0x80b0('0x18')]();};}function respondWithResult(_0x3e2b94,_0x3cdf6e){_0x3cdf6e=_0x3cdf6e||0xc8;return function(_0x3ceead){if(_0x3ceead){return _0x3e2b94[_0x80b0('0x17')](_0x3cdf6e)[_0x80b0('0x19')](_0x3ceead);}};}function respondWithFilteredResult(_0xfa137b,_0x146c73){return function(_0x593bf6){if(_0x593bf6){var _0x2b05ad=_0x593bf6['count'],_0x4cf603=_0x146c73[_0x80b0('0x1a')],_0x15ebe6=_0x146c73[_0x80b0('0x1a')]+_0x146c73[_0x80b0('0x1b')],_0x4abe8e;if(_0x15ebe6>=_0x2b05ad){_0x15ebe6=_0x2b05ad;_0x4abe8e=0xc8;}else{_0x4abe8e=0xce;}_0xfa137b[_0x80b0('0x17')](_0x4abe8e);return _0xfa137b[_0x80b0('0x1c')](_0x80b0('0x1d'),_0x4cf603+'-'+_0x15ebe6+'/'+_0x2b05ad)['json'](_0x593bf6);}return null;};}function patchUpdates(_0x5b2467){return function(_0x485711){try{jsonpatch[_0x80b0('0x1e')](_0x485711,_0x5b2467,!![]);}catch(_0x357434){return BPromise['reject'](_0x357434);}return _0x485711[_0x80b0('0x1f')]();};}function saveUpdates(_0x5b1a6a,_0x380b9a){return function(_0x1a9d70){if(_0x1a9d70){return _0x1a9d70['update'](_0x5b1a6a)[_0x80b0('0x20')](function(_0xb48903){return _0xb48903;});}return null;};}function removeEntity(_0x55ed93,_0x79937f){return function(_0x396e54){if(_0x396e54){return _0x396e54['destroy']()[_0x80b0('0x20')](function(){_0x55ed93[_0x80b0('0x17')](0xcc)[_0x80b0('0x18')]();});}};}function handleEntityNotFound(_0x4df008,_0x78fd21){return function(_0x321236){if(!_0x321236){_0x4df008['sendStatus'](0x194);}return _0x321236;};}function handleError(_0x409efc,_0x47f75f){_0x47f75f=_0x47f75f||0x1f4;return function(_0x3bc4b2){logger[_0x80b0('0x21')](_0x3bc4b2[_0x80b0('0x22')]);if(_0x3bc4b2[_0x80b0('0x23')]){delete _0x3bc4b2[_0x80b0('0x23')];}_0x409efc[_0x80b0('0x17')](_0x47f75f)['send'](_0x3bc4b2);};}exports[_0x80b0('0x24')]=function(_0x119cfa,_0x1f9ae2){var _0xc96977={},_0x1604e1={},_0x2cfd5c={'count':0x0,'rows':[]};var _0x56678d=_[_0x80b0('0x25')](db[_0x80b0('0x26')]['rawAttributes'],function(_0x401b59){return{'name':_0x401b59[_0x80b0('0x27')],'type':_0x401b59[_0x80b0('0x28')][_0x80b0('0x29')]};});_0x1604e1[_0x80b0('0x2a')]=_[_0x80b0('0x25')](_0x56678d,'name');_0x1604e1['query']=_[_0x80b0('0x2b')](_0x119cfa['query']);_0x1604e1[_0x80b0('0x2c')]=_[_0x80b0('0x2d')](_0x1604e1['model'],_0x1604e1[_0x80b0('0x2e')]);_0xc96977[_0x80b0('0x2f')]=_[_0x80b0('0x2d')](_0x1604e1[_0x80b0('0x2a')],qs[_0x80b0('0x30')](_0x119cfa[_0x80b0('0x2e')][_0x80b0('0x30')]));_0xc96977[_0x80b0('0x2f')]=_0xc96977[_0x80b0('0x2f')][_0x80b0('0x31')]?_0xc96977[_0x80b0('0x2f')]:_0x1604e1[_0x80b0('0x2a')];if(!_0x119cfa[_0x80b0('0x2e')][_0x80b0('0x32')]('nolimit')){_0xc96977['limit']=qs['limit'](_0x119cfa[_0x80b0('0x2e')][_0x80b0('0x1b')]);_0xc96977[_0x80b0('0x1a')]=qs[_0x80b0('0x1a')](_0x119cfa['query'][_0x80b0('0x1a')]);}_0xc96977[_0x80b0('0x33')]=qs['sort'](_0x119cfa['query']['sort']);_0xc96977[_0x80b0('0x34')]=qs[_0x80b0('0x2c')](_[_0x80b0('0x35')](_0x119cfa[_0x80b0('0x2e')],_0x1604e1[_0x80b0('0x2c')]),_0x56678d);if(_0x119cfa['query'][_0x80b0('0x36')]){_0xc96977['where']=_[_0x80b0('0x37')](_0xc96977[_0x80b0('0x34')],{'$or':_[_0x80b0('0x25')](_0x56678d,function(_0x5a66e2){if(_0x5a66e2[_0x80b0('0x28')]!==_0x80b0('0x38')){var _0x30bb55={};_0x30bb55[_0x5a66e2[_0x80b0('0x23')]]={'$like':'%'+_0x119cfa[_0x80b0('0x2e')][_0x80b0('0x36')]+'%'};return _0x30bb55;}})});}_0xc96977=_[_0x80b0('0x37')]({},_0xc96977,_0x119cfa[_0x80b0('0x39')]);var _0x20bb54={'where':_0xc96977[_0x80b0('0x34')]};return db['IntegrationReport']['count'](_0x20bb54)[_0x80b0('0x20')](function(_0x4cb92f){_0x2cfd5c['count']=_0x4cb92f;if(_0x119cfa['query']['includeAll']){_0xc96977[_0x80b0('0x3a')]=[{'all':!![]}];}return db[_0x80b0('0x26')][_0x80b0('0x3b')](_0xc96977);})[_0x80b0('0x20')](function(_0x84306e){_0x2cfd5c[_0x80b0('0x3c')]=_0x84306e;return _0x2cfd5c;})[_0x80b0('0x20')](respondWithFilteredResult(_0x1f9ae2,_0xc96977))[_0x80b0('0x3d')](handleError(_0x1f9ae2,null));};exports[_0x80b0('0x3e')]=function(_0x16009c,_0x365ffa){var _0xaea340={'raw':![],'where':{'id':_0x16009c[_0x80b0('0x3f')]['id']}},_0x51989c={};_0x51989c['model']=_[_0x80b0('0x2b')](db[_0x80b0('0x26')]['rawAttributes']);_0x51989c[_0x80b0('0x2e')]=_['keys'](_0x16009c[_0x80b0('0x2e')]);_0x51989c[_0x80b0('0x2c')]=_['intersection'](_0x51989c[_0x80b0('0x2a')],_0x51989c['query']);_0xaea340[_0x80b0('0x2f')]=_[_0x80b0('0x2d')](_0x51989c[_0x80b0('0x2a')],qs['fields'](_0x16009c['query']['fields']));_0xaea340[_0x80b0('0x2f')]=_0xaea340[_0x80b0('0x2f')][_0x80b0('0x31')]?_0xaea340[_0x80b0('0x2f')]:_0x51989c[_0x80b0('0x2a')];if(_0x16009c['query'][_0x80b0('0x40')]){_0xaea340[_0x80b0('0x3a')]=[{'all':!![]}];}_0xaea340=_['merge']({},_0xaea340,_0x16009c[_0x80b0('0x39')]);return db[_0x80b0('0x26')][_0x80b0('0x41')](_0xaea340)[_0x80b0('0x20')](handleEntityNotFound(_0x365ffa,null))['then'](respondWithResult(_0x365ffa,null))[_0x80b0('0x3d')](handleError(_0x365ffa,null));};exports[_0x80b0('0x42')]=function(_0x13c800,_0x286d78){return db[_0x80b0('0x26')][_0x80b0('0x42')](_0x13c800[_0x80b0('0x43')],{})['then'](respondWithResult(_0x286d78,0xc9))['catch'](handleError(_0x286d78,null));};exports[_0x80b0('0x44')]=function(_0x62ae20,_0x2ba0a1){if(_0x62ae20[_0x80b0('0x43')]['id']){delete _0x62ae20[_0x80b0('0x43')]['id'];}return db['IntegrationReport'][_0x80b0('0x41')]({'where':{'id':_0x62ae20[_0x80b0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2ba0a1,null))[_0x80b0('0x20')](saveUpdates(_0x62ae20['body'],null))[_0x80b0('0x20')](respondWithResult(_0x2ba0a1,null))[_0x80b0('0x3d')](handleError(_0x2ba0a1,null));};exports[_0x80b0('0x45')]=function(_0xe30d7b,_0x423911){return db['IntegrationReport'][_0x80b0('0x41')]({'where':{'id':_0xe30d7b[_0x80b0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x423911,null))[_0x80b0('0x20')](removeEntity(_0x423911,null))[_0x80b0('0x3d')](handleError(_0x423911,null));};exports[_0x80b0('0x46')]=function(_0x28ff3a,_0x35bdad){return db[_0x80b0('0x26')][_0x80b0('0x46')]()[_0x80b0('0x20')](respondWithResult(_0x35bdad,null))['catch'](handleError(_0x35bdad,null));}; \ No newline at end of file +var _0x837c=['error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','IntegrationReport','includeAll','findAll','rows','show','params','body','catch','update','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','reject','then','destroy'];(function(_0x15efae,_0x428a5d){var _0x3c1d6b=function(_0x3fd392){while(--_0x3fd392){_0x15efae['push'](_0x15efae['shift']());}};_0x3c1d6b(++_0x428a5d);}(_0x837c,0xb0));var _0xc837=function(_0x121a73,_0x59de7e){_0x121a73=_0x121a73-0x0;var _0x28f494=_0x837c[_0x121a73];return _0x28f494;};'use strict';var pdf=require(_0xc837('0x0'));var emlformat=require(_0xc837('0x1'));var rimraf=require(_0xc837('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc837('0x3'));var rp=require(_0xc837('0x4'));var moment=require(_0xc837('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc837('0x6'));var util=require(_0xc837('0x7'));var path=require(_0xc837('0x8'));var sox=require(_0xc837('0x9'));var csv=require(_0xc837('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc837('0xb'));var squel=require(_0xc837('0xc'));var crypto=require(_0xc837('0xd'));var jsforce=require(_0xc837('0xe'));var deskjs=require(_0xc837('0xf'));var toCsv=require(_0xc837('0xa'));var querystring=require(_0xc837('0x10'));var Papa=require(_0xc837('0x11'));var Redis=require(_0xc837('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc837('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc837('0x14'));var logger=require('../../config/logger')(_0xc837('0x15'));var utils=require(_0xc837('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc837('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c9d2c,_0x5a6d2d){_0x5a6d2d=_0x5a6d2d||0xcc;return function(_0x219e2f){if(_0x219e2f){return _0x1c9d2c[_0xc837('0x18')](_0x5a6d2d);}return _0x1c9d2c[_0xc837('0x19')](_0x5a6d2d)[_0xc837('0x1a')]();};}function respondWithResult(_0x6bef77,_0xa21246){_0xa21246=_0xa21246||0xc8;return function(_0x2ef9fd){if(_0x2ef9fd){return _0x6bef77[_0xc837('0x19')](_0xa21246)[_0xc837('0x1b')](_0x2ef9fd);}};}function respondWithFilteredResult(_0x26aea9,_0x5e2bd1){return function(_0x58e47b){if(_0x58e47b){var _0x18d739=_0x58e47b[_0xc837('0x1c')],_0x5682ac=_0x5e2bd1[_0xc837('0x1d')],_0x238bd6=_0x5e2bd1[_0xc837('0x1d')]+_0x5e2bd1[_0xc837('0x1e')],_0x3513ee;if(_0x238bd6>=_0x18d739){_0x238bd6=_0x18d739;_0x3513ee=0xc8;}else{_0x3513ee=0xce;}_0x26aea9[_0xc837('0x19')](_0x3513ee);return _0x26aea9['set']('Content-Range',_0x5682ac+'-'+_0x238bd6+'/'+_0x18d739)[_0xc837('0x1b')](_0x58e47b);}return null;};}function patchUpdates(_0x2f63f1){return function(_0x5e59fd){try{jsonpatch['apply'](_0x5e59fd,_0x2f63f1,!![]);}catch(_0x5cee93){return BPromise[_0xc837('0x1f')](_0x5cee93);}return _0x5e59fd['save']();};}function saveUpdates(_0x3bcf2c,_0x23f1ae){return function(_0x39c4ac){if(_0x39c4ac){return _0x39c4ac['update'](_0x3bcf2c)[_0xc837('0x20')](function(_0x4e22b9){return _0x4e22b9;});}return null;};}function removeEntity(_0x5e7fcf,_0x3f479f){return function(_0x159a54){if(_0x159a54){return _0x159a54[_0xc837('0x21')]()[_0xc837('0x20')](function(){_0x5e7fcf[_0xc837('0x19')](0xcc)[_0xc837('0x1a')]();});}};}function handleEntityNotFound(_0x2df026,_0x7ae7c3){return function(_0x288acd){if(!_0x288acd){_0x2df026['sendStatus'](0x194);}return _0x288acd;};}function handleError(_0x65d56,_0x3c9c98){_0x3c9c98=_0x3c9c98||0x1f4;return function(_0x13916d){logger[_0xc837('0x22')](_0x13916d[_0xc837('0x23')]);if(_0x13916d[_0xc837('0x24')]){delete _0x13916d[_0xc837('0x24')];}_0x65d56[_0xc837('0x19')](_0x3c9c98)[_0xc837('0x25')](_0x13916d);};}exports['index']=function(_0x3cae14,_0x3675b2){var _0x3c2468={},_0x9dcba1={},_0x1b4481={'count':0x0,'rows':[]};var _0x5aa81e=_[_0xc837('0x26')](db['IntegrationReport'][_0xc837('0x27')],function(_0xb68385){return{'name':_0xb68385[_0xc837('0x28')],'type':_0xb68385[_0xc837('0x29')][_0xc837('0x2a')]};});_0x9dcba1[_0xc837('0x2b')]=_[_0xc837('0x26')](_0x5aa81e,_0xc837('0x24'));_0x9dcba1[_0xc837('0x2c')]=_[_0xc837('0x2d')](_0x3cae14[_0xc837('0x2c')]);_0x9dcba1[_0xc837('0x2e')]=_[_0xc837('0x2f')](_0x9dcba1[_0xc837('0x2b')],_0x9dcba1[_0xc837('0x2c')]);_0x3c2468[_0xc837('0x30')]=_[_0xc837('0x2f')](_0x9dcba1['model'],qs[_0xc837('0x31')](_0x3cae14['query'][_0xc837('0x31')]));_0x3c2468[_0xc837('0x30')]=_0x3c2468[_0xc837('0x30')][_0xc837('0x32')]?_0x3c2468[_0xc837('0x30')]:_0x9dcba1[_0xc837('0x2b')];if(!_0x3cae14[_0xc837('0x2c')][_0xc837('0x33')]('nolimit')){_0x3c2468[_0xc837('0x1e')]=qs['limit'](_0x3cae14[_0xc837('0x2c')][_0xc837('0x1e')]);_0x3c2468[_0xc837('0x1d')]=qs[_0xc837('0x1d')](_0x3cae14[_0xc837('0x2c')][_0xc837('0x1d')]);}_0x3c2468['order']=qs[_0xc837('0x34')](_0x3cae14['query']['sort']);_0x3c2468[_0xc837('0x35')]=qs[_0xc837('0x2e')](_[_0xc837('0x36')](_0x3cae14[_0xc837('0x2c')],_0x9dcba1[_0xc837('0x2e')]),_0x5aa81e);if(_0x3cae14[_0xc837('0x2c')][_0xc837('0x37')]){_0x3c2468[_0xc837('0x35')]=_[_0xc837('0x38')](_0x3c2468[_0xc837('0x35')],{'$or':_[_0xc837('0x26')](_0x5aa81e,function(_0x2509e3){if(_0x2509e3[_0xc837('0x29')]!==_0xc837('0x39')){var _0x4440b7={};_0x4440b7[_0x2509e3[_0xc837('0x24')]]={'$like':'%'+_0x3cae14[_0xc837('0x2c')]['filter']+'%'};return _0x4440b7;}})});}_0x3c2468=_['merge']({},_0x3c2468,_0x3cae14[_0xc837('0x3a')]);var _0x511f8b={'where':_0x3c2468[_0xc837('0x35')]};return db[_0xc837('0x3b')][_0xc837('0x1c')](_0x511f8b)[_0xc837('0x20')](function(_0x2d0ac4){_0x1b4481[_0xc837('0x1c')]=_0x2d0ac4;if(_0x3cae14['query'][_0xc837('0x3c')]){_0x3c2468['include']=[{'all':!![]}];}return db['IntegrationReport'][_0xc837('0x3d')](_0x3c2468);})['then'](function(_0x10b7dc){_0x1b4481[_0xc837('0x3e')]=_0x10b7dc;return _0x1b4481;})['then'](respondWithFilteredResult(_0x3675b2,_0x3c2468))['catch'](handleError(_0x3675b2,null));};exports[_0xc837('0x3f')]=function(_0x18759e,_0x34018d){var _0x2635e4={'raw':![],'where':{'id':_0x18759e[_0xc837('0x40')]['id']}},_0xcd7434={};_0xcd7434[_0xc837('0x2b')]=_[_0xc837('0x2d')](db[_0xc837('0x3b')][_0xc837('0x27')]);_0xcd7434[_0xc837('0x2c')]=_[_0xc837('0x2d')](_0x18759e[_0xc837('0x2c')]);_0xcd7434[_0xc837('0x2e')]=_['intersection'](_0xcd7434[_0xc837('0x2b')],_0xcd7434['query']);_0x2635e4[_0xc837('0x30')]=_[_0xc837('0x2f')](_0xcd7434[_0xc837('0x2b')],qs['fields'](_0x18759e[_0xc837('0x2c')]['fields']));_0x2635e4[_0xc837('0x30')]=_0x2635e4['attributes'][_0xc837('0x32')]?_0x2635e4['attributes']:_0xcd7434[_0xc837('0x2b')];if(_0x18759e[_0xc837('0x2c')][_0xc837('0x3c')]){_0x2635e4['include']=[{'all':!![]}];}_0x2635e4=_['merge']({},_0x2635e4,_0x18759e[_0xc837('0x3a')]);return db[_0xc837('0x3b')]['find'](_0x2635e4)[_0xc837('0x20')](handleEntityNotFound(_0x34018d,null))[_0xc837('0x20')](respondWithResult(_0x34018d,null))['catch'](handleError(_0x34018d,null));};exports['create']=function(_0x332583,_0x2ca9d2){return db['IntegrationReport']['create'](_0x332583[_0xc837('0x41')],{})[_0xc837('0x20')](respondWithResult(_0x2ca9d2,0xc9))[_0xc837('0x42')](handleError(_0x2ca9d2,null));};exports[_0xc837('0x43')]=function(_0x5b1499,_0x1749bf){if(_0x5b1499[_0xc837('0x41')]['id']){delete _0x5b1499[_0xc837('0x41')]['id'];}return db[_0xc837('0x3b')][_0xc837('0x44')]({'where':{'id':_0x5b1499[_0xc837('0x40')]['id']}})[_0xc837('0x20')](handleEntityNotFound(_0x1749bf,null))[_0xc837('0x20')](saveUpdates(_0x5b1499['body'],null))['then'](respondWithResult(_0x1749bf,null))[_0xc837('0x42')](handleError(_0x1749bf,null));};exports[_0xc837('0x21')]=function(_0x54c33f,_0x492061){return db[_0xc837('0x3b')][_0xc837('0x44')]({'where':{'id':_0x54c33f[_0xc837('0x40')]['id']}})[_0xc837('0x20')](handleEntityNotFound(_0x492061,null))[_0xc837('0x20')](removeEntity(_0x492061,null))[_0xc837('0x42')](handleError(_0x492061,null));};exports[_0xc837('0x45')]=function(_0x1c3982,_0x5bbb68){return db[_0xc837('0x3b')][_0xc837('0x45')]()[_0xc837('0x20')](respondWithResult(_0x5bbb68,null))[_0xc837('0x42')](handleError(_0x5bbb68,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 57aed3f..7ddc349 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 _0x0d6e=['rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x47c220,_0x4da937){var _0x494c93=function(_0x333c15){while(--_0x333c15){_0x47c220['push'](_0x47c220['shift']());}};_0x494c93(++_0x4da937);}(_0x0d6e,0x165));var _0xe0d6=function(_0x52ca2c,_0x2aacc){_0x52ca2c=_0x52ca2c-0x0;var _0x42e8ef=_0x0d6e[_0x52ca2c];return _0x42e8ef;};'use strict';var _=require(_0xe0d6('0x0'));var util=require(_0xe0d6('0x1'));var logger=require('../../config/logger')(_0xe0d6('0x2'));var moment=require(_0xe0d6('0x3'));var BPromise=require(_0xe0d6('0x4'));var rp=require(_0xe0d6('0x5'));var fs=require('fs');var path=require(_0xe0d6('0x6'));var rimraf=require(_0xe0d6('0x7'));var config=require(_0xe0d6('0x8'));var attributes=require(_0xe0d6('0x9'));module[_0xe0d6('0xa')]=function(_0x443fbc,_0x1eeb0){return _0x443fbc[_0xe0d6('0xb')](_0xe0d6('0xc'),attributes,{'tableName':_0xe0d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaec4=['api','moment','request-promise','path','rimraf','./integrationReport.attributes','exports','define','../../config/logger'];(function(_0x5bb08f,_0x49de63){var _0x3ddfef=function(_0x339791){while(--_0x339791){_0x5bb08f['push'](_0x5bb08f['shift']());}};_0x3ddfef(++_0x49de63);}(_0xaec4,0x194));var _0x4aec=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xaec4[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4aec('0x0'))(_0x4aec('0x1'));var moment=require(_0x4aec('0x2'));var BPromise=require('bluebird');var rp=require(_0x4aec('0x3'));var fs=require('fs');var path=require(_0x4aec('0x4'));var rimraf=require(_0x4aec('0x5'));var config=require('../../config/environment');var attributes=require(_0x4aec('0x6'));module[_0x4aec('0x7')]=function(_0x624b91,_0x55eb7b){return _0x624b91[_0x4aec('0x8')]('IntegrationReport',attributes,{'tableName':'report_integration','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 8079388..6432c31 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 _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(_0x52e44b,_0x24aebf){var _0x5f08ca=function(_0x2beb91){while(--_0x2beb91){_0x52e44b['push'](_0x52e44b['shift']());}};_0x5f08ca(++_0x24aebf);}(_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 +var _0x0b0e=['IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x0b0e[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index ee1a7e7..e43b0be 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 _0xedd9=['getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sub_intervals'];(function(_0x5ae798,_0x1d2789){var _0x1567ca=function(_0x2c27cc){while(--_0x2c27cc){_0x5ae798['push'](_0x5ae798['shift']());}};_0x1567ca(++_0x1d2789);}(_0xedd9,0xfc));var _0x9edd=function(_0x37047e,_0x4203f4){_0x37047e=_0x37047e-0x0;var _0xcdbf0f=_0xedd9[_0x37047e];return _0xcdbf0f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./interval.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xd')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xd')]('/:id/sub_intervals/create_many',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router[_0x9edd('0x10')](_0x9edd('0x11'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0x11'),auth['isAuthenticated'](),controller[_0x9edd('0x14')]);module[_0x9edd('0x15')]=router; \ No newline at end of file +var _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x213e70,_0x5df20b){var _0x567335=function(_0x2504f6){while(--_0x2504f6){_0x213e70['push'](_0x213e70['shift']());}};_0x567335(++_0x5df20b);}(_0x34e8,0x12c));var _0x834e=function(_0x1026ec,_0x339055){_0x1026ec=_0x1026ec-0x0;var _0x1c1f71=_0x34e8[_0x1026ec];return _0x1c1f71;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index b876f88..bdf6cf4 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 _0x418f=['sequelize','STRING'];(function(_0x2a566f,_0x19a56a){var _0x298923=function(_0x94ae08){while(--_0x94ae08){_0x2a566f['push'](_0x2a566f['shift']());}};_0x298923(++_0x19a56a);}(_0x418f,0x178));var _0xf418=function(_0x4719b1,_0x4d3628){_0x4719b1=_0x4719b1-0x0;var _0x5cc325=_0x418f[_0x4719b1];return _0x5cc325;};'use strict';var Sequelize=require(_0xf418('0x0'));module['exports']={'name':{'type':Sequelize[_0xf418('0x1')]},'description':{'type':Sequelize[_0xf418('0x1')]},'interval':{'type':Sequelize[_0xf418('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xe98e=['STRING'];(function(_0x4b9dc9,_0x14b3a2){var _0x57b302=function(_0x4f99ff){while(--_0x4f99ff){_0x4b9dc9['push'](_0x4b9dc9['shift']());}};_0x57b302(++_0x14b3a2);}(_0xe98e,0x97));var _0xee98=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xe98e[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xee98('0x0')]},'description':{'type':Sequelize[_0xee98('0x0')]},'interval':{'type':Sequelize[_0xee98('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 499da03..0b27ea7 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 _0x894a=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','Intervals','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','Interval','includeAll','rows','catch','params','include','find','create','user'];(function(_0x156163,_0x254e37){var _0x4586f4=function(_0x494872){while(--_0x494872){_0x156163['push'](_0x156163['shift']());}};_0x4586f4(++_0x254e37);}(_0x894a,0xc8));var _0xa894=function(_0x369516,_0x349f40){_0x369516=_0x369516-0x0;var _0x4f789b=_0x894a[_0x369516];return _0x4f789b;};'use strict';var pdf=require(_0xa894('0x0'));var emlformat=require(_0xa894('0x1'));var rimraf=require(_0xa894('0x2'));var zipdir=require(_0xa894('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa894('0x4'));var moment=require(_0xa894('0x5'));var BPromise=require(_0xa894('0x6'));var Mustache=require(_0xa894('0x7'));var util=require(_0xa894('0x8'));var path=require('path');var sox=require(_0xa894('0x9'));var csv=require(_0xa894('0xa'));var ejs=require(_0xa894('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa894('0xc'));var crypto=require('crypto');var jsforce=require(_0xa894('0xd'));var deskjs=require(_0xa894('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa894('0xf'));var Papa=require(_0xa894('0x10'));var Redis=require(_0xa894('0x11'));var authService=require(_0xa894('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa894('0x13'));var logger=require('../../config/logger')(_0xa894('0x14'));var utils=require(_0xa894('0x15'));var config=require(_0xa894('0x16'));var licenseUtil=require(_0xa894('0x17'));var db=require(_0xa894('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x69e204,_0x315216){_0x315216=_0x315216||0xcc;return function(_0x3f7c55){if(_0x3f7c55){return _0x69e204[_0xa894('0x19')](_0x315216);}return _0x69e204[_0xa894('0x1a')](_0x315216)[_0xa894('0x1b')]();};}function respondWithResult(_0x9e34f1,_0x489538){_0x489538=_0x489538||0xc8;return function(_0x36f202){if(_0x36f202){return _0x9e34f1['status'](_0x489538)[_0xa894('0x1c')](_0x36f202);}};}function respondWithFilteredResult(_0x165364,_0x54a6e4){return function(_0x5d3657){if(_0x5d3657){var _0x1eefb7=_0x5d3657[_0xa894('0x1d')],_0x5a1df1=_0x54a6e4['offset'],_0x4b7f7d=_0x54a6e4[_0xa894('0x1e')]+_0x54a6e4[_0xa894('0x1f')],_0x2a6bde;if(_0x4b7f7d>=_0x1eefb7){_0x4b7f7d=_0x1eefb7;_0x2a6bde=0xc8;}else{_0x2a6bde=0xce;}_0x165364[_0xa894('0x1a')](_0x2a6bde);return _0x165364[_0xa894('0x20')]('Content-Range',_0x5a1df1+'-'+_0x4b7f7d+'/'+_0x1eefb7)[_0xa894('0x1c')](_0x5d3657);}return null;};}function patchUpdates(_0x2a8f13){return function(_0x380715){try{jsonpatch[_0xa894('0x21')](_0x380715,_0x2a8f13,!![]);}catch(_0xa78661){return BPromise[_0xa894('0x22')](_0xa78661);}return _0x380715[_0xa894('0x23')]();};}function saveUpdates(_0x4b729a,_0x203058){return function(_0x53a38d){if(_0x53a38d){return _0x53a38d[_0xa894('0x24')](_0x4b729a)['then'](function(_0x102781){return _0x102781;});}return null;};}function removeEntity(_0x213089,_0x53af65){return function(_0x1e4985){if(_0x1e4985){return _0x1e4985['destroy']()[_0xa894('0x25')](function(){var _0x16d449=_0x1e4985[_0xa894('0x26')]({'plain':!![]});var _0x252ca0=_0xa894('0x27');return db['UserProfileResource'][_0xa894('0x28')]({'where':{'type':_0x252ca0,'resourceId':_0x16d449['id']}})[_0xa894('0x25')](function(){return _0x1e4985;});})[_0xa894('0x25')](function(){_0x213089[_0xa894('0x1a')](0xcc)[_0xa894('0x1b')]();});}};}function handleEntityNotFound(_0x53aec0,_0x1a5026){return function(_0x26c1d3){if(!_0x26c1d3){_0x53aec0[_0xa894('0x19')](0x194);}return _0x26c1d3;};}function handleError(_0x5e9ea8,_0x115282){_0x115282=_0x115282||0x1f4;return function(_0x3ebdee){logger['error'](_0x3ebdee[_0xa894('0x29')]);if(_0x3ebdee['name']){delete _0x3ebdee[_0xa894('0x2a')];}_0x5e9ea8[_0xa894('0x1a')](_0x115282)[_0xa894('0x2b')](_0x3ebdee);};}exports['index']=function(_0x5f40d8,_0x26fa4e){var _0x2c0d80={},_0x1e7519={},_0x45d8a1={'count':0x0,'rows':[]};var _0x12411d=_[_0xa894('0x2c')](db['Interval'][_0xa894('0x2d')],function(_0x14e2ac){return{'name':_0x14e2ac[_0xa894('0x2e')],'type':_0x14e2ac[_0xa894('0x2f')][_0xa894('0x30')]};});_0x1e7519[_0xa894('0x31')]=_['map'](_0x12411d,_0xa894('0x2a'));_0x1e7519[_0xa894('0x32')]=_[_0xa894('0x33')](_0x5f40d8[_0xa894('0x32')]);_0x1e7519['filters']=_[_0xa894('0x34')](_0x1e7519[_0xa894('0x31')],_0x1e7519['query']);_0x2c0d80[_0xa894('0x35')]=_[_0xa894('0x34')](_0x1e7519[_0xa894('0x31')],qs['fields'](_0x5f40d8[_0xa894('0x32')][_0xa894('0x36')]));_0x2c0d80[_0xa894('0x35')]=_0x2c0d80[_0xa894('0x35')][_0xa894('0x37')]?_0x2c0d80[_0xa894('0x35')]:_0x1e7519[_0xa894('0x31')];if(!_0x5f40d8[_0xa894('0x32')][_0xa894('0x38')](_0xa894('0x39'))){_0x2c0d80[_0xa894('0x1f')]=qs['limit'](_0x5f40d8[_0xa894('0x32')][_0xa894('0x1f')]);_0x2c0d80[_0xa894('0x1e')]=qs[_0xa894('0x1e')](_0x5f40d8[_0xa894('0x32')][_0xa894('0x1e')]);}_0x2c0d80[_0xa894('0x3a')]=qs[_0xa894('0x3b')](_0x5f40d8[_0xa894('0x32')]['sort']);_0x2c0d80['where']=qs[_0xa894('0x3c')](_[_0xa894('0x3d')](_0x5f40d8['query'],_0x1e7519[_0xa894('0x3c')]),_0x12411d);if(_0x5f40d8[_0xa894('0x32')]['filter']){_0x2c0d80[_0xa894('0x3e')]=_[_0xa894('0x3f')](_0x2c0d80['where'],{'$or':_[_0xa894('0x2c')](_0x12411d,function(_0x365f63){if(_0x365f63['type']!==_0xa894('0x40')){var _0x4009af={};_0x4009af[_0x365f63[_0xa894('0x2a')]]={'$like':'%'+_0x5f40d8['query'][_0xa894('0x41')]+'%'};return _0x4009af;}})});}_0x2c0d80=_[_0xa894('0x3f')]({},_0x2c0d80,_0x5f40d8[_0xa894('0x42')]);var _0x110096={'where':_0x2c0d80[_0xa894('0x3e')]};return db[_0xa894('0x43')][_0xa894('0x1d')](_0x110096)['then'](function(_0x4d72ef){_0x45d8a1[_0xa894('0x1d')]=_0x4d72ef;if(_0x5f40d8[_0xa894('0x32')][_0xa894('0x44')]){_0x2c0d80['include']=[{'all':!![]}];}return db[_0xa894('0x43')]['findAll'](_0x2c0d80);})['then'](function(_0x413758){_0x45d8a1[_0xa894('0x45')]=_0x413758;return _0x45d8a1;})[_0xa894('0x25')](respondWithFilteredResult(_0x26fa4e,_0x2c0d80))[_0xa894('0x46')](handleError(_0x26fa4e,null));};exports['show']=function(_0x3f1031,_0x59f351){var _0x2dca8f={'raw':!![],'where':{'id':_0x3f1031[_0xa894('0x47')]['id']}},_0x4c8e37={};_0x4c8e37['model']=_[_0xa894('0x33')](db[_0xa894('0x43')][_0xa894('0x2d')]);_0x4c8e37[_0xa894('0x32')]=_[_0xa894('0x33')](_0x3f1031[_0xa894('0x32')]);_0x4c8e37['filters']=_[_0xa894('0x34')](_0x4c8e37[_0xa894('0x31')],_0x4c8e37[_0xa894('0x32')]);_0x2dca8f[_0xa894('0x35')]=_['intersection'](_0x4c8e37['model'],qs[_0xa894('0x36')](_0x3f1031[_0xa894('0x32')][_0xa894('0x36')]));_0x2dca8f[_0xa894('0x35')]=_0x2dca8f['attributes'][_0xa894('0x37')]?_0x2dca8f[_0xa894('0x35')]:_0x4c8e37[_0xa894('0x31')];if(_0x3f1031['query']['includeAll']){_0x2dca8f[_0xa894('0x48')]=[{'all':!![]}];}_0x2dca8f=_[_0xa894('0x3f')]({},_0x2dca8f,_0x3f1031[_0xa894('0x42')]);return db[_0xa894('0x43')][_0xa894('0x49')](_0x2dca8f)['then'](handleEntityNotFound(_0x59f351,null))['then'](respondWithResult(_0x59f351,null))[_0xa894('0x46')](handleError(_0x59f351,null));};exports['create']=function(_0x5d0be1,_0x220f32){return db[_0xa894('0x43')][_0xa894('0x4a')](_0x5d0be1['body'],{})[_0xa894('0x25')](function(_0x2a7ac7){var _0x63b734=_0x5d0be1[_0xa894('0x4b')][_0xa894('0x26')]({'plain':!![]});if(!_0x63b734)throw new Error(_0xa894('0x4c'));if(_0x63b734[_0xa894('0x4d')]===_0xa894('0x4b')){var _0x312127=_0x2a7ac7[_0xa894('0x26')]({'plain':!![]});var _0x3554f7=_0xa894('0x27');return db['UserProfileSection'][_0xa894('0x49')]({'where':{'name':_0x3554f7,'userProfileId':_0x63b734[_0xa894('0x4e')]},'raw':!![]})[_0xa894('0x25')](function(_0x1ae59a){if(_0x1ae59a&&_0x1ae59a[_0xa894('0x4f')]===0x0){return db[_0xa894('0x50')][_0xa894('0x4a')]({'name':_0x312127[_0xa894('0x2a')],'resourceId':_0x312127['id'],'type':_0x1ae59a[_0xa894('0x2a')],'sectionId':_0x1ae59a['id']},{})[_0xa894('0x25')](function(){return _0x2a7ac7;});}else{return _0x2a7ac7;}})[_0xa894('0x46')](function(_0xa89354){logger[_0xa894('0x51')](_0xa894('0x52'),_0xa89354);throw _0xa89354;});}return _0x2a7ac7;})[_0xa894('0x25')](respondWithResult(_0x220f32,0xc9))['catch'](handleError(_0x220f32,null));};exports['update']=function(_0x97e56a,_0x3cde41){if(_0x97e56a[_0xa894('0x53')]['id']){delete _0x97e56a[_0xa894('0x53')]['id'];}return db[_0xa894('0x43')][_0xa894('0x49')]({'where':{'id':_0x97e56a[_0xa894('0x47')]['id']}})['then'](handleEntityNotFound(_0x3cde41,null))[_0xa894('0x25')](saveUpdates(_0x97e56a[_0xa894('0x53')],null))[_0xa894('0x25')](respondWithResult(_0x3cde41,null))[_0xa894('0x46')](handleError(_0x3cde41,null));};exports[_0xa894('0x28')]=function(_0xcd6a3e,_0x14b6a6){return db[_0xa894('0x43')][_0xa894('0x49')]({'where':{'id':_0xcd6a3e[_0xa894('0x47')]['id']}})[_0xa894('0x25')](handleEntityNotFound(_0x14b6a6,null))[_0xa894('0x25')](removeEntity(_0x14b6a6,null))[_0xa894('0x46')](handleError(_0x14b6a6,null));};exports[_0xa894('0x54')]=function(_0x3e269b,_0x576cff,_0x57de0a){if(_0x3e269b[_0xa894('0x53')]['id']){delete _0x3e269b[_0xa894('0x53')]['id'];}return db[_0xa894('0x43')]['find']({'where':{'id':_0x3e269b['params']['id']}})[_0xa894('0x25')](handleEntityNotFound(_0x576cff,null))[_0xa894('0x25')](function(_0x43264d){if(_0x43264d){_0x3e269b[_0xa894('0x53')][_0xa894('0x55')]=_0x43264d['id'];return db[_0xa894('0x43')][_0xa894('0x4a')](_0x3e269b[_0xa894('0x53')]);}})['then'](respondWithResult(_0x576cff,null))['catch'](handleError(_0x576cff,null));};exports[_0xa894('0x56')]=function(_0x4cba85,_0x13da5e,_0x52be29){var _0x63abd2={};var _0x5b0348={};var _0x2517b3;var _0x381e6c;return db['Interval']['findOne']({'where':{'id':_0x4cba85[_0xa894('0x47')]['id']}})['then'](handleEntityNotFound(_0x13da5e,null))[_0xa894('0x25')](function(_0x1b4e17){if(_0x1b4e17){_0x2517b3=_0x1b4e17;_0x5b0348['model']=_[_0xa894('0x33')](db[_0xa894('0x43')][_0xa894('0x2d')]);_0x5b0348[_0xa894('0x32')]=_['keys'](_0x4cba85[_0xa894('0x32')]);_0x5b0348[_0xa894('0x3c')]=_[_0xa894('0x34')](_0x5b0348[_0xa894('0x31')],_0x5b0348[_0xa894('0x32')]);_0x63abd2[_0xa894('0x35')]=_['intersection'](_0x5b0348[_0xa894('0x31')],qs['fields'](_0x4cba85[_0xa894('0x32')][_0xa894('0x36')]));_0x63abd2[_0xa894('0x35')]=_0x63abd2['attributes'][_0xa894('0x37')]?_0x63abd2[_0xa894('0x35')]:_0x5b0348[_0xa894('0x31')];_0x63abd2[_0xa894('0x3a')]=qs['sort'](_0x4cba85[_0xa894('0x32')][_0xa894('0x3b')]);_0x63abd2[_0xa894('0x3e')]=qs[_0xa894('0x3c')](_[_0xa894('0x3d')](_0x4cba85[_0xa894('0x32')],_0x5b0348[_0xa894('0x3c')]));if(_0x4cba85[_0xa894('0x32')][_0xa894('0x41')]){_0x63abd2[_0xa894('0x3e')]=_['merge'](_0x63abd2[_0xa894('0x3e')],{'$or':_[_0xa894('0x2c')](_0x63abd2['attributes'],function(_0x4c547b){var _0x93736c={};_0x93736c[_0x4c547b]={'$like':'%'+_0x4cba85[_0xa894('0x32')]['filter']+'%'};return _0x93736c;})});}_0x63abd2=_[_0xa894('0x3f')]({},_0x63abd2,_0x4cba85[_0xa894('0x42')]);return _0x2517b3[_0xa894('0x56')](_0x63abd2);}})[_0xa894('0x25')](function(_0x4df45c){if(_0x4df45c){_0x381e6c=_0x4df45c[_0xa894('0x37')];if(!_0x4cba85['query'][_0xa894('0x38')](_0xa894('0x39'))){_0x63abd2[_0xa894('0x1f')]=qs[_0xa894('0x1f')](_0x4cba85[_0xa894('0x32')]['limit']);_0x63abd2[_0xa894('0x1e')]=qs[_0xa894('0x1e')](_0x4cba85[_0xa894('0x32')]['offset']);}return _0x2517b3[_0xa894('0x56')](_0x63abd2);}})['then'](function(_0x7d87e2){if(_0x7d87e2){return _0x7d87e2?{'count':_0x381e6c,'rows':_0x7d87e2}:null;}})[_0xa894('0x25')](respondWithResult(_0x13da5e,null))[_0xa894('0x46')](handleError(_0x13da5e,null));};exports[_0xa894('0x57')]=function(_0xba92a5,_0x543732,_0x611879){return db[_0xa894('0x43')][_0xa894('0x58')]({'where':{'id':_0xba92a5[_0xa894('0x47')]['id']}})['then'](handleEntityNotFound(_0x543732,null))[_0xa894('0x25')](function(_0x26c2df){if(_0x26c2df){return db[_0xa894('0x59')][_0xa894('0x5a')](function(_0x30dd22){return db['Interval'][_0xa894('0x28')]({'where':{'IntervalId':_0xba92a5[_0xa894('0x47')]['id']},'transaction':_0x30dd22})['then'](function(_0x26a6e4){var _0x16493d=_[_0xa894('0x2c')](_0xba92a5[_0xa894('0x53')],function(_0x2236e0){delete _0x2236e0['id'];_0x2236e0['IntervalId']=_0xba92a5[_0xa894('0x47')]['id'];return _0x2236e0;});return db[_0xa894('0x43')][_0xa894('0x5b')](_0x16493d,{'transaction':_0x30dd22});});})[_0xa894('0x25')](function(){return db[_0xa894('0x43')]['findAll']({'where':{'IntervalId':_0xba92a5[_0xa894('0x47')]['id']}});});}})['then'](respondWithResult(_0x543732,null))[_0xa894('0x46')](handleError(_0x543732,null));}; \ No newline at end of file +var _0xc782=['merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','findOne','pick','getIntervals','hasOwnProperty','nolimit','sequelize','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','count','offset','limit','set','Content-Range','json','apply','save','then','get','UserProfileResource','destroy','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc782,0x17c));var _0x2c78=function(_0x4f3dee,_0x46bb90){_0x4f3dee=_0x4f3dee-0x0;var _0x291aad=_0xc782[_0x4f3dee];return _0x291aad;};'use strict';var pdf=require(_0x2c78('0x0'));var emlformat=require(_0x2c78('0x1'));var rimraf=require(_0x2c78('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c78('0x3'));var rp=require(_0x2c78('0x4'));var moment=require(_0x2c78('0x5'));var BPromise=require(_0x2c78('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2c78('0x7'));var sox=require(_0x2c78('0x8'));var csv=require(_0x2c78('0x9'));var ejs=require(_0x2c78('0xa'));var fs=require('fs');var _=require(_0x2c78('0xb'));var squel=require(_0x2c78('0xc'));var crypto=require(_0x2c78('0xd'));var jsforce=require(_0x2c78('0xe'));var deskjs=require(_0x2c78('0xf'));var toCsv=require(_0x2c78('0x9'));var querystring=require(_0x2c78('0x10'));var Papa=require(_0x2c78('0x11'));var Redis=require(_0x2c78('0x12'));var authService=require(_0x2c78('0x13'));var qs=require(_0x2c78('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c78('0x15'));var logger=require(_0x2c78('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2c78('0x17'));var db=require(_0x2c78('0x18'))['db'];var extensions=require(_0x2c78('0x19'));function respondWithStatusCode(_0x166935,_0x242196){_0x242196=_0x242196||0xcc;return function(_0x4f4cb6){if(_0x4f4cb6){return _0x166935['sendStatus'](_0x242196);}return _0x166935[_0x2c78('0x1a')](_0x242196)[_0x2c78('0x1b')]();};}function respondWithResult(_0x17998c,_0x328338){_0x328338=_0x328338||0xc8;return function(_0x4c1cd3){if(_0x4c1cd3){return _0x17998c[_0x2c78('0x1a')](_0x328338)['json'](_0x4c1cd3);}};}function respondWithFilteredResult(_0x1287e7,_0x21ea64){return function(_0x1c75de){if(_0x1c75de){var _0x28f8df=_0x1c75de[_0x2c78('0x1c')],_0x30d8b1=_0x21ea64[_0x2c78('0x1d')],_0x12130c=_0x21ea64[_0x2c78('0x1d')]+_0x21ea64[_0x2c78('0x1e')],_0x4a95fd;if(_0x12130c>=_0x28f8df){_0x12130c=_0x28f8df;_0x4a95fd=0xc8;}else{_0x4a95fd=0xce;}_0x1287e7[_0x2c78('0x1a')](_0x4a95fd);return _0x1287e7[_0x2c78('0x1f')](_0x2c78('0x20'),_0x30d8b1+'-'+_0x12130c+'/'+_0x28f8df)[_0x2c78('0x21')](_0x1c75de);}return null;};}function patchUpdates(_0x5a6558){return function(_0x44df4a){try{jsonpatch[_0x2c78('0x22')](_0x44df4a,_0x5a6558,!![]);}catch(_0x1b337b){return BPromise['reject'](_0x1b337b);}return _0x44df4a[_0x2c78('0x23')]();};}function saveUpdates(_0x31f37d,_0x3a6916){return function(_0x302f6a){if(_0x302f6a){return _0x302f6a['update'](_0x31f37d)[_0x2c78('0x24')](function(_0x42a642){return _0x42a642;});}return null;};}function removeEntity(_0x555bff,_0x5be877){return function(_0x13cd97){if(_0x13cd97){return _0x13cd97['destroy']()[_0x2c78('0x24')](function(){var _0x1e4010=_0x13cd97[_0x2c78('0x25')]({'plain':!![]});var _0x21dd8a='Intervals';return db[_0x2c78('0x26')][_0x2c78('0x27')]({'where':{'type':_0x21dd8a,'resourceId':_0x1e4010['id']}})['then'](function(){return _0x13cd97;});})[_0x2c78('0x24')](function(){_0x555bff[_0x2c78('0x1a')](0xcc)[_0x2c78('0x1b')]();});}};}function handleEntityNotFound(_0x2652cd,_0x256d90){return function(_0x1cc1ed){if(!_0x1cc1ed){_0x2652cd['sendStatus'](0x194);}return _0x1cc1ed;};}function handleError(_0x54b3df,_0x4ae710){_0x4ae710=_0x4ae710||0x1f4;return function(_0x11f971){logger['error'](_0x11f971[_0x2c78('0x28')]);if(_0x11f971['name']){delete _0x11f971[_0x2c78('0x29')];}_0x54b3df['status'](_0x4ae710)[_0x2c78('0x2a')](_0x11f971);};}exports[_0x2c78('0x2b')]=function(_0x527282,_0x438fa2){var _0x279517={},_0x10edf4={},_0x1ff37a={'count':0x0,'rows':[]};var _0x4073b1=_[_0x2c78('0x2c')](db[_0x2c78('0x2d')][_0x2c78('0x2e')],function(_0x2b1f18){return{'name':_0x2b1f18[_0x2c78('0x2f')],'type':_0x2b1f18[_0x2c78('0x30')][_0x2c78('0x31')]};});_0x10edf4[_0x2c78('0x32')]=_[_0x2c78('0x2c')](_0x4073b1,_0x2c78('0x29'));_0x10edf4[_0x2c78('0x33')]=_[_0x2c78('0x34')](_0x527282[_0x2c78('0x33')]);_0x10edf4[_0x2c78('0x35')]=_[_0x2c78('0x36')](_0x10edf4[_0x2c78('0x32')],_0x10edf4[_0x2c78('0x33')]);_0x279517[_0x2c78('0x37')]=_[_0x2c78('0x36')](_0x10edf4['model'],qs[_0x2c78('0x38')](_0x527282[_0x2c78('0x33')][_0x2c78('0x38')]));_0x279517[_0x2c78('0x37')]=_0x279517[_0x2c78('0x37')]['length']?_0x279517[_0x2c78('0x37')]:_0x10edf4[_0x2c78('0x32')];if(!_0x527282[_0x2c78('0x33')]['hasOwnProperty']('nolimit')){_0x279517[_0x2c78('0x1e')]=qs['limit'](_0x527282[_0x2c78('0x33')][_0x2c78('0x1e')]);_0x279517[_0x2c78('0x1d')]=qs[_0x2c78('0x1d')](_0x527282[_0x2c78('0x33')][_0x2c78('0x1d')]);}_0x279517[_0x2c78('0x39')]=qs[_0x2c78('0x3a')](_0x527282['query'][_0x2c78('0x3a')]);_0x279517[_0x2c78('0x3b')]=qs[_0x2c78('0x35')](_['pick'](_0x527282[_0x2c78('0x33')],_0x10edf4['filters']),_0x4073b1);if(_0x527282[_0x2c78('0x33')][_0x2c78('0x3c')]){_0x279517[_0x2c78('0x3b')]=_['merge'](_0x279517[_0x2c78('0x3b')],{'$or':_[_0x2c78('0x2c')](_0x4073b1,function(_0x4be6c3){if(_0x4be6c3[_0x2c78('0x30')]!==_0x2c78('0x3d')){var _0x355163={};_0x355163[_0x4be6c3['name']]={'$like':'%'+_0x527282[_0x2c78('0x33')]['filter']+'%'};return _0x355163;}})});}_0x279517=_['merge']({},_0x279517,_0x527282[_0x2c78('0x3e')]);var _0x1d2746={'where':_0x279517[_0x2c78('0x3b')]};return db[_0x2c78('0x2d')][_0x2c78('0x1c')](_0x1d2746)['then'](function(_0xb1f075){_0x1ff37a[_0x2c78('0x1c')]=_0xb1f075;if(_0x527282[_0x2c78('0x33')][_0x2c78('0x3f')]){_0x279517[_0x2c78('0x40')]=[{'all':!![]}];}return db['Interval'][_0x2c78('0x41')](_0x279517);})['then'](function(_0x543d15){_0x1ff37a[_0x2c78('0x42')]=_0x543d15;return _0x1ff37a;})['then'](respondWithFilteredResult(_0x438fa2,_0x279517))['catch'](handleError(_0x438fa2,null));};exports[_0x2c78('0x43')]=function(_0x25ec3c,_0x5e1180){var _0x3071b7={'raw':!![],'where':{'id':_0x25ec3c[_0x2c78('0x44')]['id']}},_0x224195={};_0x224195['model']=_[_0x2c78('0x34')](db[_0x2c78('0x2d')][_0x2c78('0x2e')]);_0x224195['query']=_[_0x2c78('0x34')](_0x25ec3c[_0x2c78('0x33')]);_0x224195[_0x2c78('0x35')]=_['intersection'](_0x224195['model'],_0x224195['query']);_0x3071b7[_0x2c78('0x37')]=_[_0x2c78('0x36')](_0x224195['model'],qs['fields'](_0x25ec3c[_0x2c78('0x33')][_0x2c78('0x38')]));_0x3071b7[_0x2c78('0x37')]=_0x3071b7['attributes'][_0x2c78('0x45')]?_0x3071b7[_0x2c78('0x37')]:_0x224195[_0x2c78('0x32')];if(_0x25ec3c[_0x2c78('0x33')][_0x2c78('0x3f')]){_0x3071b7['include']=[{'all':!![]}];}_0x3071b7=_[_0x2c78('0x46')]({},_0x3071b7,_0x25ec3c[_0x2c78('0x3e')]);return db['Interval'][_0x2c78('0x47')](_0x3071b7)[_0x2c78('0x24')](handleEntityNotFound(_0x5e1180,null))['then'](respondWithResult(_0x5e1180,null))['catch'](handleError(_0x5e1180,null));};exports['create']=function(_0x2456f9,_0x4ba3a0){return db[_0x2c78('0x2d')][_0x2c78('0x48')](_0x2456f9['body'],{})[_0x2c78('0x24')](function(_0x5c2f8e){var _0x349d63=_0x2456f9['user']['get']({'plain':!![]});if(!_0x349d63)throw new Error(_0x2c78('0x49'));if(_0x349d63[_0x2c78('0x4a')]===_0x2c78('0x4b')){var _0x31a408=_0x5c2f8e[_0x2c78('0x25')]({'plain':!![]});var _0x3b2214=_0x2c78('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x3b2214,'userProfileId':_0x349d63[_0x2c78('0x4d')]},'raw':!![]})['then'](function(_0x1c35e1){if(_0x1c35e1&&_0x1c35e1['autoAssociation']===0x0){return db[_0x2c78('0x26')]['create']({'name':_0x31a408[_0x2c78('0x29')],'resourceId':_0x31a408['id'],'type':_0x1c35e1[_0x2c78('0x29')],'sectionId':_0x1c35e1['id']},{})[_0x2c78('0x24')](function(){return _0x5c2f8e;});}else{return _0x5c2f8e;}})[_0x2c78('0x4e')](function(_0x5a344c){logger['error'](_0x2c78('0x4f'),_0x5a344c);throw _0x5a344c;});}return _0x5c2f8e;})[_0x2c78('0x24')](respondWithResult(_0x4ba3a0,0xc9))[_0x2c78('0x4e')](handleError(_0x4ba3a0,null));};exports['update']=function(_0x1561eb,_0x1ac68e){if(_0x1561eb[_0x2c78('0x50')]['id']){delete _0x1561eb[_0x2c78('0x50')]['id'];}return db[_0x2c78('0x2d')]['find']({'where':{'id':_0x1561eb[_0x2c78('0x44')]['id']}})[_0x2c78('0x24')](handleEntityNotFound(_0x1ac68e,null))[_0x2c78('0x24')](saveUpdates(_0x1561eb['body'],null))[_0x2c78('0x24')](respondWithResult(_0x1ac68e,null))[_0x2c78('0x4e')](handleError(_0x1ac68e,null));};exports['destroy']=function(_0x431c54,_0x273af8){return db['Interval'][_0x2c78('0x47')]({'where':{'id':_0x431c54['params']['id']}})['then'](handleEntityNotFound(_0x273af8,null))['then'](removeEntity(_0x273af8,null))[_0x2c78('0x4e')](handleError(_0x273af8,null));};exports[_0x2c78('0x51')]=function(_0x2f1a8b,_0x3d3591,_0x1cd57b){if(_0x2f1a8b[_0x2c78('0x50')]['id']){delete _0x2f1a8b[_0x2c78('0x50')]['id'];}return db[_0x2c78('0x2d')]['find']({'where':{'id':_0x2f1a8b[_0x2c78('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d3591,null))[_0x2c78('0x24')](function(_0x21d262){if(_0x21d262){_0x2f1a8b[_0x2c78('0x50')][_0x2c78('0x52')]=_0x21d262['id'];return db[_0x2c78('0x2d')][_0x2c78('0x48')](_0x2f1a8b[_0x2c78('0x50')]);}})[_0x2c78('0x24')](respondWithResult(_0x3d3591,null))['catch'](handleError(_0x3d3591,null));};exports['getIntervals']=function(_0xeb6e2f,_0x238538,_0x253293){var _0x4cc3f2={};var _0x2fb592={};var _0x36905d;var _0x445e43;return db[_0x2c78('0x2d')][_0x2c78('0x53')]({'where':{'id':_0xeb6e2f[_0x2c78('0x44')]['id']}})['then'](handleEntityNotFound(_0x238538,null))[_0x2c78('0x24')](function(_0x54f48c){if(_0x54f48c){_0x36905d=_0x54f48c;_0x2fb592['model']=_[_0x2c78('0x34')](db[_0x2c78('0x2d')][_0x2c78('0x2e')]);_0x2fb592['query']=_[_0x2c78('0x34')](_0xeb6e2f['query']);_0x2fb592['filters']=_[_0x2c78('0x36')](_0x2fb592[_0x2c78('0x32')],_0x2fb592['query']);_0x4cc3f2['attributes']=_[_0x2c78('0x36')](_0x2fb592[_0x2c78('0x32')],qs['fields'](_0xeb6e2f[_0x2c78('0x33')][_0x2c78('0x38')]));_0x4cc3f2['attributes']=_0x4cc3f2['attributes'][_0x2c78('0x45')]?_0x4cc3f2['attributes']:_0x2fb592[_0x2c78('0x32')];_0x4cc3f2[_0x2c78('0x39')]=qs['sort'](_0xeb6e2f[_0x2c78('0x33')][_0x2c78('0x3a')]);_0x4cc3f2[_0x2c78('0x3b')]=qs[_0x2c78('0x35')](_[_0x2c78('0x54')](_0xeb6e2f[_0x2c78('0x33')],_0x2fb592['filters']));if(_0xeb6e2f['query'][_0x2c78('0x3c')]){_0x4cc3f2['where']=_['merge'](_0x4cc3f2[_0x2c78('0x3b')],{'$or':_['map'](_0x4cc3f2[_0x2c78('0x37')],function(_0xd2d476){var _0x47e1eb={};_0x47e1eb[_0xd2d476]={'$like':'%'+_0xeb6e2f[_0x2c78('0x33')][_0x2c78('0x3c')]+'%'};return _0x47e1eb;})});}_0x4cc3f2=_[_0x2c78('0x46')]({},_0x4cc3f2,_0xeb6e2f[_0x2c78('0x3e')]);return _0x36905d[_0x2c78('0x55')](_0x4cc3f2);}})[_0x2c78('0x24')](function(_0x11ac7e){if(_0x11ac7e){_0x445e43=_0x11ac7e[_0x2c78('0x45')];if(!_0xeb6e2f[_0x2c78('0x33')][_0x2c78('0x56')](_0x2c78('0x57'))){_0x4cc3f2[_0x2c78('0x1e')]=qs[_0x2c78('0x1e')](_0xeb6e2f['query']['limit']);_0x4cc3f2[_0x2c78('0x1d')]=qs[_0x2c78('0x1d')](_0xeb6e2f['query'][_0x2c78('0x1d')]);}return _0x36905d[_0x2c78('0x55')](_0x4cc3f2);}})['then'](function(_0x16decb){if(_0x16decb){return _0x16decb?{'count':_0x445e43,'rows':_0x16decb}:null;}})['then'](respondWithResult(_0x238538,null))[_0x2c78('0x4e')](handleError(_0x238538,null));};exports['addIntervals']=function(_0x39626f,_0x5b6d68,_0xb2e493){return db['Interval'][_0x2c78('0x53')]({'where':{'id':_0x39626f[_0x2c78('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b6d68,null))[_0x2c78('0x24')](function(_0x2c9774){if(_0x2c9774){return db[_0x2c78('0x58')]['transaction'](function(_0x3e5ea5){return db[_0x2c78('0x2d')]['destroy']({'where':{'IntervalId':_0x39626f[_0x2c78('0x44')]['id']},'transaction':_0x3e5ea5})['then'](function(_0x1e05c6){var _0x489988=_['map'](_0x39626f['body'],function(_0x2b3031){delete _0x2b3031['id'];_0x2b3031['IntervalId']=_0x39626f[_0x2c78('0x44')]['id'];return _0x2b3031;});return db[_0x2c78('0x2d')][_0x2c78('0x59')](_0x489988,{'transaction':_0x3e5ea5});});})[_0x2c78('0x24')](function(){return db[_0x2c78('0x2d')][_0x2c78('0x41')]({'where':{'IntervalId':_0x39626f['params']['id']}});});}})[_0x2c78('0x24')](respondWithResult(_0x5b6d68,null))[_0x2c78('0x4e')](handleError(_0x5b6d68,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index e228f45..6293b4d 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 _0xa3b9=['define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite'];(function(_0x22e133,_0x527287){var _0x3455ca=function(_0x50084b){while(--_0x50084b){_0x22e133['push'](_0x22e133['shift']());}};_0x3455ca(++_0x527287);}(_0xa3b9,0x112));var _0x9a3b=function(_0xeda9a4,_0x52f6dc){_0xeda9a4=_0xeda9a4-0x0;var _0x2cc258=_0xa3b9[_0xeda9a4];return _0x2cc258;};'use strict';var _=require(_0x9a3b('0x0'));var util=require(_0x9a3b('0x1'));var logger=require(_0x9a3b('0x2'))(_0x9a3b('0x3'));var moment=require(_0x9a3b('0x4'));var BPromise=require(_0x9a3b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a3b('0x6'));var rimraf=require(_0x9a3b('0x7'));var config=require(_0x9a3b('0x8'));var attributes=require(_0x9a3b('0x9'));var extensions=require(_0x9a3b('0xa'));module['exports']=function(_0x5d4f7e,_0x3a6a0d){return _0x5d4f7e[_0x9a3b('0xb')](_0x9a3b('0xc'),attributes,{'tableName':_0x9a3b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x204d1f,_0x1c8614){extensions[_0x9a3b('0xe')](_0x5d4f7e,_0x204d1f);},'afterBulkCreate':function(_0x593fef,_0x15ba19,_0x1beb32){_0x1beb32();extensions[_0x9a3b('0xe')](_0x5d4f7e,_0x593fef[0x0]);},'afterUpdate':function(_0x3e5858,_0x4a4161){extensions[_0x9a3b('0xe')](_0x5d4f7e,_0x3e5858);},'afterDestroy':function(_0x2090e9,_0x3457e5){extensions['rewrite'](_0x5d4f7e,_0x2090e9);}}});}; \ No newline at end of file +var _0x9f4d=['request-promise','path','rimraf','./interval.attributes','exports','define','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2b9905,_0x56dfac){var _0x3694d4=function(_0x262089){while(--_0x262089){_0x2b9905['push'](_0x2b9905['shift']());}};_0x3694d4(++_0x56dfac);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x2c961d,_0x106e3a){_0x2c961d=_0x2c961d-0x0;var _0xb29a42=_0x9f4d[_0x2c961d];return _0xb29a42;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var logger=require(_0xd9f4('0x2'))(_0xd9f4('0x3'));var moment=require(_0xd9f4('0x4'));var BPromise=require(_0xd9f4('0x5'));var rp=require(_0xd9f4('0x6'));var fs=require('fs');var path=require(_0xd9f4('0x7'));var rimraf=require(_0xd9f4('0x8'));var config=require('../../config/environment');var attributes=require(_0xd9f4('0x9'));var extensions=require('../../components/extensions/rewrite');module[_0xd9f4('0xa')]=function(_0x3ebf1b,_0x2cc036){return _0x3ebf1b[_0xd9f4('0xb')]('Interval',attributes,{'tableName':_0xd9f4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x18305f,_0x533971){extensions[_0xd9f4('0xd')](_0x3ebf1b,_0x18305f);},'afterBulkCreate':function(_0x47d52f,_0x16cacf,_0x41709a){_0x41709a();extensions[_0xd9f4('0xd')](_0x3ebf1b,_0x47d52f[0x0]);},'afterUpdate':function(_0x429d90,_0x2bd084){extensions['rewrite'](_0x3ebf1b,_0x429d90);},'afterDestroy':function(_0x1b0100,_0x312d09){extensions[_0xd9f4('0xd')](_0x3ebf1b,_0x1b0100);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c3ed3bd..90467ce 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 _0xbeb4=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Interval,\x20%s,\x20%s','result','catch','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','GetInterval','debug','ShowInterval'];(function(_0x229659,_0x3c4aaa){var _0x4b7cd7=function(_0x44692b){while(--_0x44692b){_0x229659['push'](_0x229659['shift']());}};_0x4b7cd7(++_0x3c4aaa);}(_0xbeb4,0x1d5));var _0x4beb=function(_0x300a6b,_0x12ff60){_0x300a6b=_0x300a6b-0x0;var _0x433405=_0xbeb4[_0x300a6b];return _0x433405;};'use strict';var _=require(_0x4beb('0x0'));var util=require(_0x4beb('0x1'));var moment=require(_0x4beb('0x2'));var BPromise=require(_0x4beb('0x3'));var rs=require(_0x4beb('0x4'));var fs=require('fs');var Redis=require(_0x4beb('0x5'));var db=require(_0x4beb('0x6'))['db'];var utils=require(_0x4beb('0x7'));var logger=require(_0x4beb('0x8'))(_0x4beb('0x9'));var config=require(_0x4beb('0xa'));var jayson=require(_0x4beb('0xb'));var client=jayson[_0x4beb('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39d330,_0x4a943d,_0x2c65cf){return new BPromise(function(_0x337050,_0x11c3a7){return client[_0x4beb('0xd')](_0x39d330,_0x2c65cf)['then'](function(_0x39857a){logger[_0x4beb('0xe')]('Interval,\x20%s,\x20%s',_0x4a943d,'request\x20sent');logger['debug'](_0x4beb('0xf'),_0x4a943d,_0x4beb('0x10'),JSON[_0x4beb('0x11')](_0x39857a));if(_0x39857a[_0x4beb('0x12')]){if(_0x39857a[_0x4beb('0x12')][_0x4beb('0x13')]===0x1f4){logger[_0x4beb('0x12')]('Interval,\x20%s,\x20%s',_0x4a943d,_0x39857a['error'][_0x4beb('0x14')]);return _0x11c3a7(_0x39857a[_0x4beb('0x12')][_0x4beb('0x14')]);}logger[_0x4beb('0x12')](_0x4beb('0x15'),_0x4a943d,_0x39857a['error'][_0x4beb('0x14')]);return _0x337050(_0x39857a['error'][_0x4beb('0x14')]);}else{logger[_0x4beb('0xe')](_0x4beb('0x15'),_0x4a943d,_0x4beb('0x10'));_0x337050(_0x39857a[_0x4beb('0x16')][_0x4beb('0x14')]);}})[_0x4beb('0x17')](function(_0x1e58ba){logger[_0x4beb('0x12')]('Interval,\x20%s,\x20%s',_0x4a943d,_0x1e58ba);_0x11c3a7(_0x1e58ba);});});}exports['GetInterval']=function(_0x576038){var _0x479802=this;return new Promise(function(_0x4092ac,_0x6a7268){return db[_0x4beb('0x18')][_0x4beb('0x19')]({'raw':_0x576038[_0x4beb('0x1a')]?_0x576038[_0x4beb('0x1a')][_0x4beb('0x1b')]===undefined?!![]:![]:!![],'where':_0x576038[_0x4beb('0x1a')]?_0x576038[_0x4beb('0x1a')][_0x4beb('0x1c')]||null:null,'attributes':_0x576038[_0x4beb('0x1a')]?_0x576038[_0x4beb('0x1a')][_0x4beb('0x1d')]||null:null,'limit':_0x576038[_0x4beb('0x1a')]?_0x576038[_0x4beb('0x1a')][_0x4beb('0x1e')]||null:null,'include':_0x576038['options']?_0x576038['options'][_0x4beb('0x1f')]?_[_0x4beb('0x20')](_0x576038[_0x4beb('0x1a')][_0x4beb('0x1f')],function(_0x1d9981){return{'model':db[_0x1d9981[_0x4beb('0x21')]],'as':_0x1d9981['as'],'attributes':_0x1d9981[_0x4beb('0x1d')],'include':_0x1d9981[_0x4beb('0x1f')]?_[_0x4beb('0x20')](_0x1d9981[_0x4beb('0x1f')],function(_0x10ac2b){return{'model':db[_0x10ac2b[_0x4beb('0x21')]],'as':_0x10ac2b['as'],'attributes':_0x10ac2b[_0x4beb('0x1d')],'include':_0x10ac2b[_0x4beb('0x1f')]?_[_0x4beb('0x20')](_0x10ac2b[_0x4beb('0x1f')],function(_0x52180b){return{'model':db[_0x52180b[_0x4beb('0x21')]],'as':_0x52180b['as'],'attributes':_0x52180b['attributes']};}):[]};}):[]};}):[]:[]})[_0x4beb('0x22')](function(_0x288265){logger[_0x4beb('0xe')](_0x4beb('0x23'),_0x576038);logger[_0x4beb('0x24')](_0x4beb('0x23'),_0x576038,JSON['stringify'](_0x288265));_0x4092ac(_0x288265);})[_0x4beb('0x17')](function(_0x143a3f){logger['error'](_0x4beb('0x23'),_0x143a3f[_0x4beb('0x14')],_0x576038);_0x6a7268(_0x479802['error'](0x1f4,_0x143a3f['message']));});});};exports[_0x4beb('0x25')]=function(_0x1d4ce7){var _0x18a295=this;return new Promise(function(_0x212a4a,_0x1a7f80){return db['Interval'][_0x4beb('0x26')]({'raw':_0x1d4ce7[_0x4beb('0x1a')]?_0x1d4ce7[_0x4beb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1d4ce7[_0x4beb('0x1a')]?_0x1d4ce7[_0x4beb('0x1a')][_0x4beb('0x1c')]||null:null,'attributes':_0x1d4ce7[_0x4beb('0x1a')]?_0x1d4ce7[_0x4beb('0x1a')][_0x4beb('0x1d')]||null:null,'include':_0x1d4ce7[_0x4beb('0x1a')]?_0x1d4ce7[_0x4beb('0x1a')]['include']?_[_0x4beb('0x20')](_0x1d4ce7[_0x4beb('0x1a')][_0x4beb('0x1f')],function(_0x507f01){return{'model':db[_0x507f01[_0x4beb('0x21')]],'as':_0x507f01['as'],'attributes':_0x507f01['attributes'],'include':_0x507f01['include']?_[_0x4beb('0x20')](_0x507f01['include'],function(_0x3c9b5e){return{'model':db[_0x3c9b5e['model']],'as':_0x3c9b5e['as'],'attributes':_0x3c9b5e[_0x4beb('0x1d')],'include':_0x3c9b5e[_0x4beb('0x1f')]?_[_0x4beb('0x20')](_0x3c9b5e[_0x4beb('0x1f')],function(_0x588bd6){return{'model':db[_0x588bd6[_0x4beb('0x21')]],'as':_0x588bd6['as'],'attributes':_0x588bd6[_0x4beb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4beb('0x22')](function(_0xba121c){logger['info']('ShowInterval',_0x1d4ce7);logger[_0x4beb('0x24')]('ShowInterval',_0x1d4ce7,JSON[_0x4beb('0x11')](_0xba121c));_0x212a4a(_0xba121c);})['catch'](function(_0x1de324){logger[_0x4beb('0x12')](_0x4beb('0x25'),_0x1de324[_0x4beb('0x14')],_0x1d4ce7);_0x1a7f80(_0x18a295['error'](0x1f4,_0x1de324['message']));});});}; \ No newline at end of file +var _0x3a9f=['stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options','where','attributes','limit','include','model','map','raw','ShowInterval','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x4c0629,_0xc61b41){var _0xe34b2a=function(_0x3c01ca){while(--_0x3c01ca){_0x4c0629['push'](_0x4c0629['shift']());}};_0xe34b2a(++_0xc61b41);}(_0x3a9f,0x170));var _0xf3a9=function(_0x32a767,_0x4e3e76){_0x32a767=_0x32a767-0x0;var _0x2b4e6d=_0x3a9f[_0x32a767];return _0x2b4e6d;};'use strict';var _=require(_0xf3a9('0x0'));var util=require(_0xf3a9('0x1'));var moment=require(_0xf3a9('0x2'));var BPromise=require(_0xf3a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf3a9('0x5'))('rpc');var config=require(_0xf3a9('0x6'));var jayson=require(_0xf3a9('0x7'));var client=jayson[_0xf3a9('0x8')][_0xf3a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x146025,_0x49713d,_0x18edf9){return new BPromise(function(_0x34afd9,_0x4517ce){return client[_0xf3a9('0xa')](_0x146025,_0x18edf9)[_0xf3a9('0xb')](function(_0x4b7ec0){logger[_0xf3a9('0xc')](_0xf3a9('0xd'),_0x49713d,_0xf3a9('0xe'));logger[_0xf3a9('0xf')](_0xf3a9('0x10'),_0x49713d,_0xf3a9('0xe'),JSON[_0xf3a9('0x11')](_0x4b7ec0));if(_0x4b7ec0[_0xf3a9('0x12')]){if(_0x4b7ec0['error'][_0xf3a9('0x13')]===0x1f4){logger[_0xf3a9('0x12')](_0xf3a9('0xd'),_0x49713d,_0x4b7ec0[_0xf3a9('0x12')][_0xf3a9('0x14')]);return _0x4517ce(_0x4b7ec0['error'][_0xf3a9('0x14')]);}logger['error'](_0xf3a9('0xd'),_0x49713d,_0x4b7ec0[_0xf3a9('0x12')]['message']);return _0x34afd9(_0x4b7ec0[_0xf3a9('0x12')][_0xf3a9('0x14')]);}else{logger[_0xf3a9('0xc')](_0xf3a9('0xd'),_0x49713d,'request\x20sent');_0x34afd9(_0x4b7ec0[_0xf3a9('0x15')][_0xf3a9('0x14')]);}})[_0xf3a9('0x16')](function(_0x5495c7){logger[_0xf3a9('0x12')](_0xf3a9('0xd'),_0x49713d,_0x5495c7);_0x4517ce(_0x5495c7);});});}exports[_0xf3a9('0x17')]=function(_0x4ba467){var _0x5f155a=this;return new Promise(function(_0x505099,_0x130f9b){return db[_0xf3a9('0x18')][_0xf3a9('0x19')]({'raw':_0x4ba467[_0xf3a9('0x1a')]?_0x4ba467[_0xf3a9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4ba467['options']?_0x4ba467[_0xf3a9('0x1a')][_0xf3a9('0x1b')]||null:null,'attributes':_0x4ba467[_0xf3a9('0x1a')]?_0x4ba467[_0xf3a9('0x1a')][_0xf3a9('0x1c')]||null:null,'limit':_0x4ba467[_0xf3a9('0x1a')]?_0x4ba467[_0xf3a9('0x1a')][_0xf3a9('0x1d')]||null:null,'include':_0x4ba467[_0xf3a9('0x1a')]?_0x4ba467[_0xf3a9('0x1a')][_0xf3a9('0x1e')]?_['map'](_0x4ba467['options'][_0xf3a9('0x1e')],function(_0x50921d){return{'model':db[_0x50921d[_0xf3a9('0x1f')]],'as':_0x50921d['as'],'attributes':_0x50921d['attributes'],'include':_0x50921d[_0xf3a9('0x1e')]?_[_0xf3a9('0x20')](_0x50921d['include'],function(_0xf29347){return{'model':db[_0xf29347[_0xf3a9('0x1f')]],'as':_0xf29347['as'],'attributes':_0xf29347[_0xf3a9('0x1c')],'include':_0xf29347[_0xf3a9('0x1e')]?_[_0xf3a9('0x20')](_0xf29347[_0xf3a9('0x1e')],function(_0x1b4cd3){return{'model':db[_0x1b4cd3[_0xf3a9('0x1f')]],'as':_0x1b4cd3['as'],'attributes':_0x1b4cd3[_0xf3a9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf3a9('0xb')](function(_0x374e37){logger['info'](_0xf3a9('0x17'),_0x4ba467);logger[_0xf3a9('0xf')](_0xf3a9('0x17'),_0x4ba467,JSON[_0xf3a9('0x11')](_0x374e37));_0x505099(_0x374e37);})[_0xf3a9('0x16')](function(_0x1ec8fe){logger[_0xf3a9('0x12')](_0xf3a9('0x17'),_0x1ec8fe[_0xf3a9('0x14')],_0x4ba467);_0x130f9b(_0x5f155a['error'](0x1f4,_0x1ec8fe['message']));});});};exports['ShowInterval']=function(_0x4acc20){var _0x21192f=this;return new Promise(function(_0x31fb3e,_0xaf23bc){return db[_0xf3a9('0x18')]['find']({'raw':_0x4acc20['options']?_0x4acc20[_0xf3a9('0x1a')][_0xf3a9('0x21')]===undefined?!![]:![]:!![],'where':_0x4acc20[_0xf3a9('0x1a')]?_0x4acc20[_0xf3a9('0x1a')]['where']||null:null,'attributes':_0x4acc20[_0xf3a9('0x1a')]?_0x4acc20[_0xf3a9('0x1a')][_0xf3a9('0x1c')]||null:null,'include':_0x4acc20['options']?_0x4acc20[_0xf3a9('0x1a')]['include']?_[_0xf3a9('0x20')](_0x4acc20['options']['include'],function(_0x1fb981){return{'model':db[_0x1fb981[_0xf3a9('0x1f')]],'as':_0x1fb981['as'],'attributes':_0x1fb981[_0xf3a9('0x1c')],'include':_0x1fb981['include']?_[_0xf3a9('0x20')](_0x1fb981[_0xf3a9('0x1e')],function(_0xbe0cee){return{'model':db[_0xbe0cee[_0xf3a9('0x1f')]],'as':_0xbe0cee['as'],'attributes':_0xbe0cee['attributes'],'include':_0xbe0cee['include']?_[_0xf3a9('0x20')](_0xbe0cee[_0xf3a9('0x1e')],function(_0x2c1174){return{'model':db[_0x2c1174['model']],'as':_0x2c1174['as'],'attributes':_0x2c1174['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e62d5){logger['info']('ShowInterval',_0x4acc20);logger[_0xf3a9('0xf')](_0xf3a9('0x22'),_0x4acc20,JSON[_0xf3a9('0x11')](_0x3e62d5));_0x31fb3e(_0x3e62d5);})[_0xf3a9('0x16')](function(_0xceb28d){logger[_0xf3a9('0x12')](_0xf3a9('0x22'),_0xceb28d[_0xf3a9('0x14')],_0x4acc20);_0xaf23bc(_0x21192f['error'](0x1f4,_0xceb28d[_0xf3a9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e46bd19..f3624a6 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 _0x7b93=['exports','express','Router','../../components/auth/service','./jira.controller','isAuthenticated'];(function(_0x411172,_0x5f3b53){var _0x489979=function(_0x295d59){while(--_0x295d59){_0x411172['push'](_0x411172['shift']());}};_0x489979(++_0x5f3b53);}(_0x7b93,0x1bd));var _0x37b9=function(_0x4b33ff,_0x34193c){_0x4b33ff=_0x4b33ff-0x0;var _0x24c2f7=_0x7b93[_0x4b33ff];return _0x24c2f7;};'use strict';var express=require(_0x37b9('0x0'));var router=express[_0x37b9('0x1')]();var auth=require(_0x37b9('0x2'));var controller=require(_0x37b9('0x3'));router['post']('/',auth[_0x37b9('0x4')](),controller['send']);module[_0x37b9('0x5')]=router; \ No newline at end of file +var _0x6824=['express','../../components/auth/service','isAuthenticated','send','exports'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x6824,0x195));var _0x4682=function(_0x15e8e9,_0x46b7bd){_0x15e8e9=_0x15e8e9-0x0;var _0x3ab66e=_0x6824[_0x15e8e9];return _0x3ab66e;};'use strict';var express=require(_0x4682('0x0'));var router=express['Router']();var auth=require(_0x4682('0x1'));var controller=require('./jira.controller');router['post']('/',auth[_0x4682('0x2')](),controller[_0x4682('0x3')]);module[_0x4682('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 b324918..23c4dea 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 _0xc022=['remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','POST','application/json','toString','base64','request','end','status','json','parse','error','api.jira','openIssue','send','body','headers','x-forwarded-for','connection'];(function(_0x2b96d1,_0x4a7018){var _0x2d883d=function(_0x1cfe11){while(--_0x1cfe11){_0x2b96d1['push'](_0x2b96d1['shift']());}};_0x2d883d(++_0x4a7018);}(_0xc022,0x1e6));var _0x2c02=function(_0x38dca6,_0x471cb7){_0x38dca6=_0x38dca6-0x0;var _0x29bcd7=_0xc022[_0x38dca6];return _0x29bcd7;};'use strict';var BPromise=require(_0x2c02('0x0'));var https=require(_0x2c02('0x1'));var logger=require(_0x2c02('0x2'))(_0x2c02('0x3'));var USERNAME=_0x2c02('0x4');var PASSWORD=_0x2c02('0x5');function openIssue(_0xdb6c06,_0x3d83be){var _0x480053={'fields':{'project':{'key':_0xdb6c06[_0x2c02('0x6')]||_0x2c02('0x7')},'summary':(_0xdb6c06['summary']||_0x2c02('0x8'))+_0x2c02('0x9')+_0xdb6c06['ip'],'description':_0xdb6c06[_0x2c02('0xa')]||JSON[_0x2c02('0xb')](_0xdb6c06),'issuetype':{'name':_0xdb6c06[_0x2c02('0xc')]||'Bug'}}};_0x480053[_0x2c02('0xd')][_0x2c02('0xe')]=_0xdb6c06[_0x2c02('0xf')];_0x480053[_0x2c02('0xd')][_0x2c02('0x10')]=_0xdb6c06[_0x2c02('0x11')];_0x480053[_0x2c02('0xd')][_0x2c02('0x12')]=_0xdb6c06[_0x2c02('0x13')];_0x480053[_0x2c02('0xd')][_0x2c02('0x14')]=_0xdb6c06[_0x2c02('0x15')];_0x480053[_0x2c02('0xd')][_0x2c02('0x16')]=_0xdb6c06[_0x2c02('0x17')];_0x480053[_0x2c02('0xd')][_0x2c02('0x18')]=_0xdb6c06['ip'];var _0xa3ede6={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0x2c02('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x2c02('0x1a'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x2c02('0x1b')](_0x2c02('0x1c'))}};var _0x269b2b=JSON[_0x2c02('0xb')](_0x480053);var _0x253f4b=https[_0x2c02('0x1d')](_0xa3ede6,function(_0x5e8528){_0x5e8528['setEncoding']('utf8');var _0xb71f6b='';_0x5e8528['on']('data',function(_0x1089ab){_0xb71f6b+=_0x1089ab;});_0x5e8528['on'](_0x2c02('0x1e'),function(){if(_0x3d83be){return _0x3d83be[_0x2c02('0x1f')](_0x5e8528['statusCode'])[_0x2c02('0x20')](JSON[_0x2c02('0x21')](_0xb71f6b));}});});_0x253f4b['on'](_0x2c02('0x22'),function(_0x4e36b3){if(_0x3d83be){return _0x3d83be[_0x2c02('0x1f')](0x1f4)[_0x2c02('0x20')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x2c02('0x23')}]});}});_0x253f4b['write'](_0x269b2b);_0x253f4b[_0x2c02('0x1e')]();}exports[_0x2c02('0x24')]=openIssue;exports[_0x2c02('0x25')]=function(_0x40fa5e,_0x23f443){_0x40fa5e[_0x2c02('0x26')]['ip']=_0x40fa5e[_0x2c02('0x27')][_0x2c02('0x28')]||_0x40fa5e[_0x2c02('0x29')][_0x2c02('0x2a')]||_0x40fa5e[_0x2c02('0x2b')][_0x2c02('0x2a')]||_0x40fa5e['connection']['socket'][_0x2c02('0x2a')];return openIssue(_0x40fa5e[_0x2c02('0x26')],_0x23f443);}; \ No newline at end of file +var _0x339a=['customfield_11504','reason','track.xcallymotion.com','POST','application/json','toString','base64','request','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','customfield_11500','email','fields','oldToken','customfield_11502','name'];(function(_0x55ae30,_0x281726){var _0x17ecf0=function(_0x2fbae7){while(--_0x2fbae7){_0x55ae30['push'](_0x55ae30['shift']());}};_0x17ecf0(++_0x281726);}(_0x339a,0xce));var _0xa339=function(_0x3af714,_0x38e54f){_0x3af714=_0x3af714-0x0;var _0x38d899=_0x339a[_0x3af714];return _0x38d899;};'use strict';var BPromise=require(_0xa339('0x0'));var https=require(_0xa339('0x1'));var logger=require(_0xa339('0x2'))('api');var USERNAME=_0xa339('0x3');var PASSWORD=_0xa339('0x4');function openIssue(_0x4297f2,_0x4ffb07){var _0xeb7557={'fields':{'project':{'key':_0x4297f2[_0xa339('0x5')]||_0xa339('0x6')},'summary':(_0x4297f2[_0xa339('0x7')]||_0xa339('0x8'))+_0xa339('0x9')+_0x4297f2['ip'],'description':_0x4297f2[_0xa339('0xa')]||JSON[_0xa339('0xb')](_0x4297f2),'issuetype':{'name':_0x4297f2['issuetype']||_0xa339('0xc')}}};_0xeb7557['fields'][_0xa339('0xd')]=_0x4297f2[_0xa339('0xe')];_0xeb7557[_0xa339('0xf')]['customfield_11501']=_0x4297f2[_0xa339('0x10')];_0xeb7557['fields'][_0xa339('0x11')]=_0x4297f2['newToken'];_0xeb7557[_0xa339('0xf')]['customfield_11503']=_0x4297f2[_0xa339('0x12')];_0xeb7557['fields'][_0xa339('0x13')]=_0x4297f2[_0xa339('0x14')];_0xeb7557[_0xa339('0xf')]['customfield_10102']=_0x4297f2['ip'];var _0x4e031c={'host':_0xa339('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xa339('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xa339('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xa339('0x18')](_0xa339('0x19'))}};var _0x4e92d3=JSON['stringify'](_0xeb7557);var _0x20b899=https[_0xa339('0x1a')](_0x4e031c,function(_0x318575){_0x318575['setEncoding'](_0xa339('0x1b'));var _0x217f24='';_0x318575['on'](_0xa339('0x1c'),function(_0x13dfb){_0x217f24+=_0x13dfb;});_0x318575['on'](_0xa339('0x1d'),function(){if(_0x4ffb07){return _0x4ffb07[_0xa339('0x1e')](_0x318575['statusCode'])[_0xa339('0x1f')](JSON[_0xa339('0x20')](_0x217f24));}});});_0x20b899['on'](_0xa339('0x21'),function(_0xf27cc){if(_0x4ffb07){return _0x4ffb07[_0xa339('0x1e')](0x1f4)[_0xa339('0x1f')]({'errors':[{'message':_0xa339('0x22'),'type':_0xa339('0x23')}]});}});_0x20b899[_0xa339('0x24')](_0x4e92d3);_0x20b899[_0xa339('0x1d')]();}exports[_0xa339('0x25')]=openIssue;exports[_0xa339('0x26')]=function(_0x214c62,_0x250c93){_0x214c62['body']['ip']=_0x214c62[_0xa339('0x27')][_0xa339('0x28')]||_0x214c62[_0xa339('0x29')][_0xa339('0x2a')]||_0x214c62[_0xa339('0x2b')][_0xa339('0x2a')]||_0x214c62[_0xa339('0x29')][_0xa339('0x2b')]['remoteAddress'];return openIssue(_0x214c62[_0xa339('0x2c')],_0x250c93);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index dcb217a..15bec46 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 _0xa954=['./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','util','path','Router','../../components/interaction/service','../../config/environment'];(function(_0xa30654,_0xca4d8a){var _0xbdac28=function(_0xdb007a){while(--_0xdb007a){_0xa30654['push'](_0xa30654['shift']());}};_0xbdac28(++_0xca4d8a);}(_0xa954,0x13e));var _0x4a95=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0xa954[_0x53e3fa];return _0xe8584a;};'use strict';var multer=require('multer');var util=require(_0x4a95('0x0'));var path=require(_0x4a95('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4a95('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x4a95('0x3'));var config=require(_0x4a95('0x4'));var controller=require(_0x4a95('0x5'));router['get']('/',auth[_0x4a95('0x6')](),controller[_0x4a95('0x7')]);router[_0x4a95('0x8')](_0x4a95('0x9'),auth[_0x4a95('0x6')](),controller[_0x4a95('0xa')]);router[_0x4a95('0x8')]('/:id',auth[_0x4a95('0x6')](),controller[_0x4a95('0xb')]);router[_0x4a95('0xc')]('/',auth[_0x4a95('0x6')](),controller['create']);router[_0x4a95('0xd')](_0x4a95('0xe'),auth[_0x4a95('0x6')](),controller[_0x4a95('0xf')]);router[_0x4a95('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4a95('0x11')]);module[_0x4a95('0x12')]=router; \ No newline at end of file +var _0x7ddb=['../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x4a54ac,_0x1878f6){var _0x583cd8=function(_0x2679a1){while(--_0x2679a1){_0x4a54ac['push'](_0x4a54ac['shift']());}};_0x583cd8(++_0x1878f6);}(_0x7ddb,0xc7));var _0xb7dd=function(_0x31f95e,_0x39ccc1){_0x31f95e=_0x31f95e-0x0;var _0x7f698b=_0x7ddb[_0x31f95e];return _0x7f698b;};'use strict';var multer=require(_0xb7dd('0x0'));var util=require(_0xb7dd('0x1'));var path=require(_0xb7dd('0x2'));var timeout=require('connect-timeout');var express=require(_0xb7dd('0x3'));var router=express[_0xb7dd('0x4')]();var auth=require(_0xb7dd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb7dd('0x6'));router[_0xb7dd('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb7dd('0x7')]('/describe',auth[_0xb7dd('0x8')](),controller[_0xb7dd('0x9')]);router[_0xb7dd('0x7')](_0xb7dd('0xa'),auth[_0xb7dd('0x8')](),controller['show']);router[_0xb7dd('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb7dd('0xc')](_0xb7dd('0xa'),auth['isAuthenticated'](),controller[_0xb7dd('0xd')]);router[_0xb7dd('0xe')](_0xb7dd('0xa'),auth['isAuthenticated'](),controller[_0xb7dd('0xf')]);module[_0xb7dd('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 07c7cc8..2f2f26d 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 _0x5b12=['TEXT','long','STRING','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5b12,0xa3));var _0x25b1=function(_0x252875,_0x374a9d){_0x252875=_0x252875-0x0;var _0x189c67=_0x5b12[_0x252875];return _0x189c67;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'question':{'type':Sequelize[_0x25b1('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x25b1('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x25b1('0x4')]},'queue':{'type':Sequelize[_0x25b1('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x25b1('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x28f2=['TEXT','long','STRING','sequelize','exports'];(function(_0x35659e,_0x58daa8){var _0x59006f=function(_0x47e4c4){while(--_0x47e4c4){_0x35659e['push'](_0x35659e['shift']());}};_0x59006f(++_0x58daa8);}(_0x28f2,0x193));var _0x228f=function(_0x513332,_0x27ab3b){_0x513332=_0x513332-0x0;var _0x4678d4=_0x28f2[_0x513332];return _0x4678d4;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'question':{'type':Sequelize[_0x228f('0x2')]},'answer':{'type':Sequelize[_0x228f('0x2')](_0x228f('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x228f('0x4')]},'queue':{'type':Sequelize[_0x228f('0x4')]},'uniqueid':{'type':Sequelize[_0x228f('0x4')]},'calleridname':{'type':Sequelize[_0x228f('0x4')]},'calleridnum':{'type':Sequelize[_0x228f('0x4')]},'questionId':{'type':Sequelize[_0x228f('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index d164b92..5a9154c 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 _0x6212=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','body','catch','find','destroy','describe','zip-dir','request-promise','moment','mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','Content-Range','apply','reject','save','update','then','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x6212,0xa4));var _0x2621=function(_0x3a71a9,_0x3c666a){_0x3a71a9=_0x3a71a9-0x0;var _0x38e1a2=_0x6212[_0x3a71a9];return _0x38e1a2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2621('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2621('0x1'));var moment=require(_0x2621('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2621('0x3'));var util=require('util');var path=require('path');var sox=require(_0x2621('0x4'));var csv=require(_0x2621('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2621('0x6'));var crypto=require(_0x2621('0x7'));var jsforce=require(_0x2621('0x8'));var deskjs=require(_0x2621('0x9'));var toCsv=require('to-csv');var querystring=require(_0x2621('0xa'));var Papa=require(_0x2621('0xb'));var Redis=require(_0x2621('0xc'));var authService=require(_0x2621('0xd'));var qs=require(_0x2621('0xe'));var as=require(_0x2621('0xf'));var hardwareService=require(_0x2621('0x10'));var logger=require(_0x2621('0x11'))('api');var utils=require(_0x2621('0x12'));var config=require(_0x2621('0x13'));var licenseUtil=require(_0x2621('0x14'));var db=require(_0x2621('0x15'))['db'];function respondWithStatusCode(_0x4ae63f,_0x3dff2d){_0x3dff2d=_0x3dff2d||0xcc;return function(_0x29e3e4){if(_0x29e3e4){return _0x4ae63f['sendStatus'](_0x3dff2d);}return _0x4ae63f[_0x2621('0x16')](_0x3dff2d)[_0x2621('0x17')]();};}function respondWithResult(_0x2d5493,_0xcb4449){_0xcb4449=_0xcb4449||0xc8;return function(_0x14c7a7){if(_0x14c7a7){return _0x2d5493[_0x2621('0x16')](_0xcb4449)[_0x2621('0x18')](_0x14c7a7);}};}function respondWithFilteredResult(_0x4716c8,_0x1b1ef5){return function(_0x3f6620){if(_0x3f6620){var _0x4b87f4=_0x3f6620['count'],_0x3709ad=_0x1b1ef5[_0x2621('0x19')],_0x34ce2f=_0x1b1ef5[_0x2621('0x19')]+_0x1b1ef5['limit'],_0x7b28b5;if(_0x34ce2f>=_0x4b87f4){_0x34ce2f=_0x4b87f4;_0x7b28b5=0xc8;}else{_0x7b28b5=0xce;}_0x4716c8[_0x2621('0x16')](_0x7b28b5);return _0x4716c8['set'](_0x2621('0x1a'),_0x3709ad+'-'+_0x34ce2f+'/'+_0x4b87f4)[_0x2621('0x18')](_0x3f6620);}return null;};}function patchUpdates(_0x20f177){return function(_0x137a93){try{jsonpatch[_0x2621('0x1b')](_0x137a93,_0x20f177,!![]);}catch(_0x446135){return BPromise[_0x2621('0x1c')](_0x446135);}return _0x137a93[_0x2621('0x1d')]();};}function saveUpdates(_0x4a83b5,_0xca5893){return function(_0x5c463f){if(_0x5c463f){return _0x5c463f[_0x2621('0x1e')](_0x4a83b5)[_0x2621('0x1f')](function(_0x131c89){return _0x131c89;});}return null;};}function removeEntity(_0x237bca,_0x31a995){return function(_0x4084c7){if(_0x4084c7){return _0x4084c7['destroy']()['then'](function(){_0x237bca[_0x2621('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1859f5,_0x2ae025){return function(_0x70b457){if(!_0x70b457){_0x1859f5['sendStatus'](0x194);}return _0x70b457;};}function handleError(_0x3ce019,_0x49b1cb){_0x49b1cb=_0x49b1cb||0x1f4;return function(_0x4d3f9a){logger['error'](_0x4d3f9a[_0x2621('0x20')]);if(_0x4d3f9a[_0x2621('0x21')]){delete _0x4d3f9a[_0x2621('0x21')];}_0x3ce019[_0x2621('0x16')](_0x49b1cb)['send'](_0x4d3f9a);};}exports[_0x2621('0x22')]=function(_0x58c5f5,_0x59834e){var _0x110e58={},_0x3ca492={},_0x8dd71d={'count':0x0,'rows':[]};var _0x2ad3aa=_[_0x2621('0x23')](db[_0x2621('0x24')][_0x2621('0x25')],function(_0xc6ed1){return{'name':_0xc6ed1[_0x2621('0x26')],'type':_0xc6ed1[_0x2621('0x27')]['key']};});_0x3ca492[_0x2621('0x28')]=_[_0x2621('0x23')](_0x2ad3aa,'name');_0x3ca492[_0x2621('0x29')]=_[_0x2621('0x2a')](_0x58c5f5['query']);_0x3ca492[_0x2621('0x2b')]=_['intersection'](_0x3ca492[_0x2621('0x28')],_0x3ca492[_0x2621('0x29')]);_0x110e58[_0x2621('0x2c')]=_[_0x2621('0x2d')](_0x3ca492[_0x2621('0x28')],qs[_0x2621('0x2e')](_0x58c5f5[_0x2621('0x29')][_0x2621('0x2e')]));_0x110e58['attributes']=_0x110e58[_0x2621('0x2c')][_0x2621('0x2f')]?_0x110e58[_0x2621('0x2c')]:_0x3ca492['model'];if(!_0x58c5f5['query'][_0x2621('0x30')](_0x2621('0x31'))){_0x110e58[_0x2621('0x32')]=qs[_0x2621('0x32')](_0x58c5f5[_0x2621('0x29')][_0x2621('0x32')]);_0x110e58[_0x2621('0x19')]=qs[_0x2621('0x19')](_0x58c5f5['query'][_0x2621('0x19')]);}_0x110e58[_0x2621('0x33')]=qs[_0x2621('0x34')](_0x58c5f5['query']['sort']);_0x110e58[_0x2621('0x35')]=qs[_0x2621('0x2b')](_[_0x2621('0x36')](_0x58c5f5[_0x2621('0x29')],_0x3ca492[_0x2621('0x2b')]),_0x2ad3aa);if(_0x58c5f5[_0x2621('0x29')][_0x2621('0x37')]){_0x110e58[_0x2621('0x35')]=_[_0x2621('0x38')](_0x110e58[_0x2621('0x35')],{'$or':_['map'](_0x2ad3aa,function(_0x1691e5){if(_0x1691e5[_0x2621('0x27')]!==_0x2621('0x39')){var _0x5a27a2={};_0x5a27a2[_0x1691e5[_0x2621('0x21')]]={'$like':'%'+_0x58c5f5['query'][_0x2621('0x37')]+'%'};return _0x5a27a2;}})});}_0x110e58=_[_0x2621('0x38')]({},_0x110e58,_0x58c5f5[_0x2621('0x3a')]);var _0x38992d={'where':_0x110e58[_0x2621('0x35')]};return db[_0x2621('0x24')]['count'](_0x38992d)[_0x2621('0x1f')](function(_0x4a0bd2){_0x8dd71d['count']=_0x4a0bd2;if(_0x58c5f5[_0x2621('0x29')][_0x2621('0x3b')]){_0x110e58[_0x2621('0x3c')]=[{'all':!![]}];}return db[_0x2621('0x24')][_0x2621('0x3d')](_0x110e58);})[_0x2621('0x1f')](function(_0x2b5c7d){_0x8dd71d[_0x2621('0x3e')]=_0x2b5c7d;return _0x8dd71d;})[_0x2621('0x1f')](respondWithFilteredResult(_0x59834e,_0x110e58))['catch'](handleError(_0x59834e,null));};exports[_0x2621('0x3f')]=function(_0x7f813a,_0x3d8f73){var _0x427fee={'raw':!![],'where':{'id':_0x7f813a[_0x2621('0x40')]['id']}},_0x41589c={};_0x41589c[_0x2621('0x28')]=_[_0x2621('0x2a')](db[_0x2621('0x24')][_0x2621('0x25')]);_0x41589c['query']=_['keys'](_0x7f813a[_0x2621('0x29')]);_0x41589c[_0x2621('0x2b')]=_[_0x2621('0x2d')](_0x41589c[_0x2621('0x28')],_0x41589c[_0x2621('0x29')]);_0x427fee[_0x2621('0x2c')]=_[_0x2621('0x2d')](_0x41589c[_0x2621('0x28')],qs[_0x2621('0x2e')](_0x7f813a[_0x2621('0x29')][_0x2621('0x2e')]));_0x427fee[_0x2621('0x2c')]=_0x427fee[_0x2621('0x2c')][_0x2621('0x2f')]?_0x427fee[_0x2621('0x2c')]:_0x41589c[_0x2621('0x28')];if(_0x7f813a['query'][_0x2621('0x3b')]){_0x427fee[_0x2621('0x3c')]=[{'all':!![]}];}_0x427fee=_[_0x2621('0x38')]({},_0x427fee,_0x7f813a[_0x2621('0x3a')]);return db[_0x2621('0x24')]['find'](_0x427fee)[_0x2621('0x1f')](handleEntityNotFound(_0x3d8f73,null))[_0x2621('0x1f')](respondWithResult(_0x3d8f73,null))['catch'](handleError(_0x3d8f73,null));};exports['create']=function(_0x347d8f,_0x24e7b4){return db['JscriptyAnswerReport']['create'](_0x347d8f[_0x2621('0x41')],{})[_0x2621('0x1f')](respondWithResult(_0x24e7b4,0xc9))[_0x2621('0x42')](handleError(_0x24e7b4,null));};exports[_0x2621('0x1e')]=function(_0x9ff5d9,_0x24d276){if(_0x9ff5d9[_0x2621('0x41')]['id']){delete _0x9ff5d9['body']['id'];}return db[_0x2621('0x24')][_0x2621('0x43')]({'where':{'id':_0x9ff5d9[_0x2621('0x40')]['id']}})[_0x2621('0x1f')](handleEntityNotFound(_0x24d276,null))[_0x2621('0x1f')](saveUpdates(_0x9ff5d9[_0x2621('0x41')],null))[_0x2621('0x1f')](respondWithResult(_0x24d276,null))['catch'](handleError(_0x24d276,null));};exports[_0x2621('0x44')]=function(_0x5f3c02,_0x4dafb8){return db[_0x2621('0x24')][_0x2621('0x43')]({'where':{'id':_0x5f3c02['params']['id']}})[_0x2621('0x1f')](handleEntityNotFound(_0x4dafb8,null))[_0x2621('0x1f')](removeEntity(_0x4dafb8,null))[_0x2621('0x42')](handleError(_0x4dafb8,null));};exports['describe']=function(_0x4e3261,_0x39dd7d){return db[_0x2621('0x24')][_0x2621('0x45')]()[_0x2621('0x1f')](respondWithResult(_0x39dd7d,null))[_0x2621('0x42')](handleError(_0x39dd7d,null));}; \ No newline at end of file +var _0x9423=['index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','length','hasOwnProperty','order','sort','where','type','VIRTUAL','filter','merge','JscriptyAnswerReport','count','includeAll','include','findAll','rows','params','intersection','fields','options','catch','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x5c3d11,_0x589686){var _0x31e455=function(_0x251512){while(--_0x251512){_0x5c3d11['push'](_0x5c3d11['shift']());}};_0x31e455(++_0x589686);}(_0x9423,0x100));var _0x3942=function(_0x34177d,_0x4fdcf9){_0x34177d=_0x34177d-0x0;var _0x561eef=_0x9423[_0x34177d];return _0x561eef;};'use strict';var pdf=require(_0x3942('0x0'));var emlformat=require(_0x3942('0x1'));var rimraf=require(_0x3942('0x2'));var zipdir=require(_0x3942('0x3'));var jsonpatch=require(_0x3942('0x4'));var rp=require('request-promise');var moment=require(_0x3942('0x5'));var BPromise=require(_0x3942('0x6'));var Mustache=require(_0x3942('0x7'));var util=require(_0x3942('0x8'));var path=require(_0x3942('0x9'));var sox=require(_0x3942('0xa'));var csv=require(_0x3942('0xb'));var ejs=require(_0x3942('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3942('0xd'));var crypto=require('crypto');var jsforce=require(_0x3942('0xe'));var deskjs=require(_0x3942('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3942('0x10'));var Papa=require(_0x3942('0x11'));var Redis=require(_0x3942('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3942('0x13'));var as=require(_0x3942('0x14'));var hardwareService=require(_0x3942('0x15'));var logger=require('../../config/logger')(_0x3942('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3942('0x17'));var db=require(_0x3942('0x18'))['db'];function respondWithStatusCode(_0x445ed6,_0x51600c){_0x51600c=_0x51600c||0xcc;return function(_0x4ceb99){if(_0x4ceb99){return _0x445ed6[_0x3942('0x19')](_0x51600c);}return _0x445ed6[_0x3942('0x1a')](_0x51600c)[_0x3942('0x1b')]();};}function respondWithResult(_0x5dbbe4,_0xd636ee){_0xd636ee=_0xd636ee||0xc8;return function(_0x538d24){if(_0x538d24){return _0x5dbbe4[_0x3942('0x1a')](_0xd636ee)[_0x3942('0x1c')](_0x538d24);}};}function respondWithFilteredResult(_0x2b5687,_0x54f401){return function(_0x130719){if(_0x130719){var _0x47968a=_0x130719['count'],_0x50c7d8=_0x54f401[_0x3942('0x1d')],_0x38612e=_0x54f401[_0x3942('0x1d')]+_0x54f401[_0x3942('0x1e')],_0xf3cf8;if(_0x38612e>=_0x47968a){_0x38612e=_0x47968a;_0xf3cf8=0xc8;}else{_0xf3cf8=0xce;}_0x2b5687[_0x3942('0x1a')](_0xf3cf8);return _0x2b5687['set']('Content-Range',_0x50c7d8+'-'+_0x38612e+'/'+_0x47968a)[_0x3942('0x1c')](_0x130719);}return null;};}function patchUpdates(_0x4c6730){return function(_0x4d09f4){try{jsonpatch[_0x3942('0x1f')](_0x4d09f4,_0x4c6730,!![]);}catch(_0x3e193b){return BPromise[_0x3942('0x20')](_0x3e193b);}return _0x4d09f4['save']();};}function saveUpdates(_0x6aa6f3,_0x34cec5){return function(_0x4b3b8d){if(_0x4b3b8d){return _0x4b3b8d[_0x3942('0x21')](_0x6aa6f3)[_0x3942('0x22')](function(_0x3019f5){return _0x3019f5;});}return null;};}function removeEntity(_0x7ee008,_0x29f236){return function(_0x3e2b9b){if(_0x3e2b9b){return _0x3e2b9b[_0x3942('0x23')]()[_0x3942('0x22')](function(){_0x7ee008[_0x3942('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x270500,_0x2fa72f){return function(_0x9da1c4){if(!_0x9da1c4){_0x270500['sendStatus'](0x194);}return _0x9da1c4;};}function handleError(_0x24c7c7,_0x45a1e0){_0x45a1e0=_0x45a1e0||0x1f4;return function(_0x13619e){logger[_0x3942('0x24')](_0x13619e[_0x3942('0x25')]);if(_0x13619e[_0x3942('0x26')]){delete _0x13619e[_0x3942('0x26')];}_0x24c7c7['status'](_0x45a1e0)[_0x3942('0x27')](_0x13619e);};}exports[_0x3942('0x28')]=function(_0x53af80,_0x2549d1){var _0x57bad5={},_0x32a90f={},_0x1063e9={'count':0x0,'rows':[]};var _0x2896cc=_[_0x3942('0x29')](db['JscriptyAnswerReport'][_0x3942('0x2a')],function(_0x226c6a){return{'name':_0x226c6a[_0x3942('0x2b')],'type':_0x226c6a['type'][_0x3942('0x2c')]};});_0x32a90f[_0x3942('0x2d')]=_[_0x3942('0x29')](_0x2896cc,'name');_0x32a90f[_0x3942('0x2e')]=_[_0x3942('0x2f')](_0x53af80[_0x3942('0x2e')]);_0x32a90f[_0x3942('0x30')]=_['intersection'](_0x32a90f[_0x3942('0x2d')],_0x32a90f[_0x3942('0x2e')]);_0x57bad5[_0x3942('0x31')]=_['intersection'](_0x32a90f[_0x3942('0x2d')],qs['fields'](_0x53af80[_0x3942('0x2e')]['fields']));_0x57bad5[_0x3942('0x31')]=_0x57bad5[_0x3942('0x31')][_0x3942('0x32')]?_0x57bad5[_0x3942('0x31')]:_0x32a90f[_0x3942('0x2d')];if(!_0x53af80[_0x3942('0x2e')][_0x3942('0x33')]('nolimit')){_0x57bad5[_0x3942('0x1e')]=qs[_0x3942('0x1e')](_0x53af80['query'][_0x3942('0x1e')]);_0x57bad5[_0x3942('0x1d')]=qs[_0x3942('0x1d')](_0x53af80['query'][_0x3942('0x1d')]);}_0x57bad5[_0x3942('0x34')]=qs[_0x3942('0x35')](_0x53af80['query'][_0x3942('0x35')]);_0x57bad5[_0x3942('0x36')]=qs[_0x3942('0x30')](_['pick'](_0x53af80[_0x3942('0x2e')],_0x32a90f['filters']),_0x2896cc);if(_0x53af80[_0x3942('0x2e')]['filter']){_0x57bad5[_0x3942('0x36')]=_['merge'](_0x57bad5[_0x3942('0x36')],{'$or':_[_0x3942('0x29')](_0x2896cc,function(_0x2468f7){if(_0x2468f7[_0x3942('0x37')]!==_0x3942('0x38')){var _0x4c1c6d={};_0x4c1c6d[_0x2468f7[_0x3942('0x26')]]={'$like':'%'+_0x53af80[_0x3942('0x2e')][_0x3942('0x39')]+'%'};return _0x4c1c6d;}})});}_0x57bad5=_[_0x3942('0x3a')]({},_0x57bad5,_0x53af80['options']);var _0x3bd39d={'where':_0x57bad5[_0x3942('0x36')]};return db[_0x3942('0x3b')][_0x3942('0x3c')](_0x3bd39d)[_0x3942('0x22')](function(_0x185eb7){_0x1063e9[_0x3942('0x3c')]=_0x185eb7;if(_0x53af80[_0x3942('0x2e')][_0x3942('0x3d')]){_0x57bad5[_0x3942('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x3942('0x3f')](_0x57bad5);})['then'](function(_0x512ba4){_0x1063e9[_0x3942('0x40')]=_0x512ba4;return _0x1063e9;})[_0x3942('0x22')](respondWithFilteredResult(_0x2549d1,_0x57bad5))['catch'](handleError(_0x2549d1,null));};exports['show']=function(_0x512dfa,_0x5967d6){var _0x1aec71={'raw':!![],'where':{'id':_0x512dfa[_0x3942('0x41')]['id']}},_0x697a85={};_0x697a85[_0x3942('0x2d')]=_['keys'](db[_0x3942('0x3b')][_0x3942('0x2a')]);_0x697a85[_0x3942('0x2e')]=_[_0x3942('0x2f')](_0x512dfa['query']);_0x697a85['filters']=_[_0x3942('0x42')](_0x697a85[_0x3942('0x2d')],_0x697a85[_0x3942('0x2e')]);_0x1aec71['attributes']=_[_0x3942('0x42')](_0x697a85[_0x3942('0x2d')],qs[_0x3942('0x43')](_0x512dfa[_0x3942('0x2e')]['fields']));_0x1aec71[_0x3942('0x31')]=_0x1aec71['attributes'][_0x3942('0x32')]?_0x1aec71[_0x3942('0x31')]:_0x697a85[_0x3942('0x2d')];if(_0x512dfa['query']['includeAll']){_0x1aec71[_0x3942('0x3e')]=[{'all':!![]}];}_0x1aec71=_[_0x3942('0x3a')]({},_0x1aec71,_0x512dfa[_0x3942('0x44')]);return db['JscriptyAnswerReport']['find'](_0x1aec71)[_0x3942('0x22')](handleEntityNotFound(_0x5967d6,null))[_0x3942('0x22')](respondWithResult(_0x5967d6,null))[_0x3942('0x45')](handleError(_0x5967d6,null));};exports['create']=function(_0x24fa3d,_0x6b5f11){return db[_0x3942('0x3b')][_0x3942('0x46')](_0x24fa3d[_0x3942('0x47')],{})['then'](respondWithResult(_0x6b5f11,0xc9))[_0x3942('0x45')](handleError(_0x6b5f11,null));};exports['update']=function(_0x59d4ce,_0x4604ff){if(_0x59d4ce[_0x3942('0x47')]['id']){delete _0x59d4ce['body']['id'];}return db['JscriptyAnswerReport'][_0x3942('0x48')]({'where':{'id':_0x59d4ce['params']['id']}})['then'](handleEntityNotFound(_0x4604ff,null))[_0x3942('0x22')](saveUpdates(_0x59d4ce[_0x3942('0x47')],null))[_0x3942('0x22')](respondWithResult(_0x4604ff,null))[_0x3942('0x45')](handleError(_0x4604ff,null));};exports[_0x3942('0x23')]=function(_0x4a669e,_0x41e8b8){return db['JscriptyAnswerReport'][_0x3942('0x48')]({'where':{'id':_0x4a669e[_0x3942('0x41')]['id']}})[_0x3942('0x22')](handleEntityNotFound(_0x41e8b8,null))[_0x3942('0x22')](removeEntity(_0x41e8b8,null))[_0x3942('0x45')](handleError(_0x41e8b8,null));};exports[_0x3942('0x49')]=function(_0x3a965c,_0x1e6160){return db[_0x3942('0x3b')][_0x3942('0x49')]()[_0x3942('0x22')](respondWithResult(_0x1e6160,null))[_0x3942('0x45')](handleError(_0x1e6160,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 998790e..0f55a17 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 _0x315e=['exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x588faf,_0x23d0f7){var _0x5f5592=function(_0x19a1dd){while(--_0x19a1dd){_0x588faf['push'](_0x588faf['shift']());}};_0x5f5592(++_0x23d0f7);}(_0x315e,0x190));var _0xe315=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x315e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe315('0x0'));var util=require(_0xe315('0x1'));var logger=require(_0xe315('0x2'))(_0xe315('0x3'));var moment=require('moment');var BPromise=require(_0xe315('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe315('0x5'));var rimraf=require(_0xe315('0x6'));var config=require(_0xe315('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xe315('0x8')]=function(_0x5bb7b6,_0xbd563){return _0x5bb7b6[_0xe315('0x9')](_0xe315('0xa'),attributes,{'tableName':_0xe315('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47fb=['bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','../../config/logger','moment'];(function(_0x273006,_0x2fac38){var _0xfb0637=function(_0x31c1e3){while(--_0x31c1e3){_0x273006['push'](_0x273006['shift']());}};_0xfb0637(++_0x2fac38);}(_0x47fb,0x1cb));var _0xb47f=function(_0x423adf,_0x120823){_0x423adf=_0x423adf-0x0;var _0x5c5f14=_0x47fb[_0x423adf];return _0x5c5f14;};'use strict';var _=require(_0xb47f('0x0'));var util=require('util');var logger=require(_0xb47f('0x1'))('api');var moment=require(_0xb47f('0x2'));var BPromise=require(_0xb47f('0x3'));var rp=require(_0xb47f('0x4'));var fs=require('fs');var path=require(_0xb47f('0x5'));var rimraf=require('rimraf');var config=require(_0xb47f('0x6'));var attributes=require(_0xb47f('0x7'));module[_0xb47f('0x8')]=function(_0x314890,_0xac1305){return _0x314890[_0xb47f('0x9')](_0xb47f('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index db41760..7fb0165 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 _0x2407=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x487ee4,_0x3d3e66){var _0x3b0877=function(_0x5fba36){while(--_0x5fba36){_0x487ee4['push'](_0x487ee4['shift']());}};_0x3b0877(++_0x3d3e66);}(_0x2407,0x123));var _0x7240=function(_0x2ecd91,_0x1f21e8){_0x2ecd91=_0x2ecd91-0x0;var _0x3bf737=_0x2407[_0x2ecd91];return _0x3bf737;};'use strict';var _=require(_0x7240('0x0'));var util=require(_0x7240('0x1'));var moment=require(_0x7240('0x2'));var BPromise=require(_0x7240('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7240('0x4'));var db=require(_0x7240('0x5'))['db'];var utils=require(_0x7240('0x6'));var logger=require(_0x7240('0x7'))('rpc');var config=require(_0x7240('0x8'));var jayson=require(_0x7240('0x9'));var client=jayson[_0x7240('0xa')][_0x7240('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b6d71,_0x3985d5,_0x9679a9){return new BPromise(function(_0xc50471,_0x36ddb1){return client[_0x7240('0xc')](_0x4b6d71,_0x9679a9)[_0x7240('0xd')](function(_0x132aa4){logger[_0x7240('0xe')](_0x7240('0xf'),_0x3985d5,_0x7240('0x10'));logger[_0x7240('0x11')](_0x7240('0x12'),_0x3985d5,_0x7240('0x10'),JSON['stringify'](_0x132aa4));if(_0x132aa4[_0x7240('0x13')]){if(_0x132aa4[_0x7240('0x13')][_0x7240('0x14')]===0x1f4){logger[_0x7240('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3985d5,_0x132aa4[_0x7240('0x13')][_0x7240('0x15')]);return _0x36ddb1(_0x132aa4[_0x7240('0x13')][_0x7240('0x15')]);}logger[_0x7240('0x13')](_0x7240('0xf'),_0x3985d5,_0x132aa4['error']['message']);return _0xc50471(_0x132aa4[_0x7240('0x13')][_0x7240('0x15')]);}else{logger['info'](_0x7240('0xf'),_0x3985d5,_0x7240('0x10'));_0xc50471(_0x132aa4['result'][_0x7240('0x15')]);}})[_0x7240('0x16')](function(_0x1399b4){logger[_0x7240('0x13')](_0x7240('0xf'),_0x3985d5,_0x1399b4);_0x36ddb1(_0x1399b4);});});} \ No newline at end of file +var _0x1411=['moment','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x380a3f,_0x202483){var _0x2b4eca=function(_0x1e99b2){while(--_0x1e99b2){_0x380a3f['push'](_0x380a3f['shift']());}};_0x2b4eca(++_0x202483);}(_0x1411,0x12b));var _0x1141=function(_0x13eaae,_0x11ec0a){_0x13eaae=_0x13eaae-0x0;var _0x4493db=_0x1411[_0x13eaae];return _0x4493db;};'use strict';var _=require(_0x1141('0x0'));var util=require('util');var moment=require(_0x1141('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1141('0x2'));var db=require(_0x1141('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1141('0x4'))(_0x1141('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1141('0x6')][_0x1141('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x179985,_0x536b37,_0x4b89e8){return new BPromise(function(_0x42ddf1,_0x222976){return client[_0x1141('0x8')](_0x179985,_0x4b89e8)[_0x1141('0x9')](function(_0x272972){logger[_0x1141('0xa')](_0x1141('0xb'),_0x536b37,'request\x20sent');logger[_0x1141('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x536b37,_0x1141('0xd'),JSON[_0x1141('0xe')](_0x272972));if(_0x272972[_0x1141('0xf')]){if(_0x272972[_0x1141('0xf')][_0x1141('0x10')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x536b37,_0x272972[_0x1141('0xf')]['message']);return _0x222976(_0x272972[_0x1141('0xf')][_0x1141('0x11')]);}logger[_0x1141('0xf')](_0x1141('0xb'),_0x536b37,_0x272972[_0x1141('0xf')][_0x1141('0x11')]);return _0x42ddf1(_0x272972['error'][_0x1141('0x11')]);}else{logger['info'](_0x1141('0xb'),_0x536b37,_0x1141('0xd'));_0x42ddf1(_0x272972[_0x1141('0x12')][_0x1141('0x11')]);}})[_0x1141('0x13')](function(_0xe216fb){logger['error'](_0x1141('0xb'),_0x536b37,_0xe216fb);_0x222976(_0xe216fb);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 8403701..57317e6 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 _0xe436=['./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','create','post','/:id/clone','clone','put','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe436,0x1a3));var _0x6e43=function(_0x5a3062,_0x579eb2){_0x5a3062=_0x5a3062-0x0;var _0x249c90=_0xe436[_0x5a3062];return _0x249c90;};'use strict';var multer=require(_0x6e43('0x0'));var util=require(_0x6e43('0x1'));var path=require(_0x6e43('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e43('0x3'));var router=express[_0x6e43('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6e43('0x5'));var config=require('../../config/environment');var controller=require(_0x6e43('0x6'));router[_0x6e43('0x7')]('/',auth[_0x6e43('0x8')](),controller[_0x6e43('0x9')]);router[_0x6e43('0x7')](_0x6e43('0xa'),auth[_0x6e43('0x8')](),controller['show']);router['get'](_0x6e43('0xb'),auth['isAuthenticated'](),controller[_0x6e43('0xc')]);router[_0x6e43('0x7')](_0x6e43('0xd'),auth[_0x6e43('0x8')](),controller[_0x6e43('0xe')]);router[_0x6e43('0x7')](_0x6e43('0xf'),auth[_0x6e43('0x8')](),timeout(_0x6e43('0x10')),controller['getSummary']);router['post']('/',auth['isAuthenticated'](),controller[_0x6e43('0x11')]);router[_0x6e43('0x12')](_0x6e43('0x13'),auth[_0x6e43('0x8')](),controller[_0x6e43('0x14')]);router[_0x6e43('0x15')](_0x6e43('0xa'),auth['isAuthenticated'](),controller[_0x6e43('0x16')]);router[_0x6e43('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6e43('0x18')]=router; \ No newline at end of file +var _0xba96=['/:id/summary','30s','getSummary','post','create','/:id/clone','put','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','show','getSessions','/:id/answers','isAuthenticated','getAnswers'];(function(_0xc8e8aa,_0x500acd){var _0x13bb8d=function(_0x1b4e71){while(--_0x1b4e71){_0xc8e8aa['push'](_0xc8e8aa['shift']());}};_0x13bb8d(++_0x500acd);}(_0xba96,0xeb));var _0x6ba9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xba96[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x6ba9('0x0'));var util=require(_0x6ba9('0x1'));var path=require('path');var timeout=require(_0x6ba9('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x6ba9('0x3'));var interaction=require(_0x6ba9('0x4'));var config=require(_0x6ba9('0x5'));var controller=require(_0x6ba9('0x6'));router[_0x6ba9('0x7')]('/',auth['isAuthenticated'](),controller[_0x6ba9('0x8')]);router[_0x6ba9('0x7')](_0x6ba9('0x9'),auth['isAuthenticated'](),controller[_0x6ba9('0xa')]);router[_0x6ba9('0x7')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x6ba9('0xb')]);router[_0x6ba9('0x7')](_0x6ba9('0xc'),auth[_0x6ba9('0xd')](),controller[_0x6ba9('0xe')]);router[_0x6ba9('0x7')](_0x6ba9('0xf'),auth['isAuthenticated'](),timeout(_0x6ba9('0x10')),controller[_0x6ba9('0x11')]);router[_0x6ba9('0x12')]('/',auth[_0x6ba9('0xd')](),controller[_0x6ba9('0x13')]);router[_0x6ba9('0x12')](_0x6ba9('0x14'),auth[_0x6ba9('0xd')](),controller['clone']);router[_0x6ba9('0x15')](_0x6ba9('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x6ba9('0x16')](_0x6ba9('0x9'),auth[_0x6ba9('0xd')](),controller[_0x6ba9('0x17')]);module[_0x6ba9('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 35714b4..e34ddb1 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 _0x53c9=['getDataValue','BOOLEAN','sequelize','lodash','util','name','STRING','isObjectLike','setDataValue','stringify','isString','formData','format'];(function(_0x442ea4,_0x57ad7c){var _0x4a2e0b=function(_0x5c5832){while(--_0x5c5832){_0x442ea4['push'](_0x442ea4['shift']());}};_0x4a2e0b(++_0x57ad7c);}(_0x53c9,0xd2));var _0x953c=function(_0x46e421,_0x1eeabf){_0x46e421=_0x46e421-0x0;var _0x3bc5b9=_0x53c9[_0x46e421];return _0x3bc5b9;};'use strict';var Sequelize=require(_0x953c('0x0'));var _=require(_0x953c('0x1'));var util=require(_0x953c('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x953c('0x3')},'description':{'type':Sequelize[_0x953c('0x4')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x13e19e){if(_[_0x953c('0x5')](_0x13e19e)){this[_0x953c('0x6')]('formData',JSON[_0x953c('0x7')](_0x13e19e));}else if(_[_0x953c('0x8')](_0x13e19e)){this['setDataValue'](_0x953c('0x9'),_0x13e19e);}else{this['setDataValue'](_0x953c('0x9'),util[_0x953c('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x953c('0xb')]('name')||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x953c('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9f6f=['TEXT','long','isObjectLike','stringify','isString','setDataValue','formData','format','getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','name'];(function(_0x35b47f,_0x45f028){var _0x393abb=function(_0x1cebf2){while(--_0x1cebf2){_0x35b47f['push'](_0x35b47f['shift']());}};_0x393abb(++_0x45f028);}(_0x9f6f,0x1db));var _0xf9f6=function(_0x201a17,_0x5241f0){_0x201a17=_0x201a17-0x0;var _0x1c13a0=_0x9f6f[_0x201a17];return _0x1c13a0;};'use strict';var Sequelize=require(_0xf9f6('0x0'));var _=require('lodash');var util=require(_0xf9f6('0x1'));module[_0xf9f6('0x2')]={'name':{'type':Sequelize[_0xf9f6('0x3')],'unique':_0xf9f6('0x4')},'description':{'type':Sequelize[_0xf9f6('0x3')]},'formData':{'type':Sequelize[_0xf9f6('0x5')](_0xf9f6('0x6')),'set':function(_0x4ce5d9){if(_[_0xf9f6('0x7')](_0x4ce5d9)){this['setDataValue']('formData',JSON[_0xf9f6('0x8')](_0x4ce5d9));}else if(_[_0xf9f6('0x9')](_0x4ce5d9)){this[_0xf9f6('0xa')](_0xf9f6('0xb'),_0x4ce5d9);}else{this[_0xf9f6('0xa')](_0xf9f6('0xb'),util[_0xf9f6('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xf9f6('0xd')](_0xf9f6('0x4'))||'',this[_0xf9f6('0xd')](_0xf9f6('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf9f6('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c0cea08..f936273 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 _0x6bd3=['catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','createdAt','updatedAt','omit','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','starttime','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','update','then','get','Projects','UserProfileResource','destroy','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params'];(function(_0xbe0d54,_0x5c3362){var _0x13e619=function(_0xfa3e7f){while(--_0xfa3e7f){_0xbe0d54['push'](_0xbe0d54['shift']());}};_0x13e619(++_0x5c3362);}(_0x6bd3,0x9d));var _0x36bd=function(_0x3e4cf4,_0xb2eb34){_0x3e4cf4=_0x3e4cf4-0x0;var _0x251276=_0x6bd3[_0x3e4cf4];return _0x251276;};'use strict';var pdf=require(_0x36bd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x36bd('0x1'));var rp=require(_0x36bd('0x2'));var moment=require(_0x36bd('0x3'));var BPromise=require(_0x36bd('0x4'));var Mustache=require(_0x36bd('0x5'));var util=require('util');var path=require(_0x36bd('0x6'));var sox=require(_0x36bd('0x7'));var csv=require('to-csv');var ejs=require(_0x36bd('0x8'));var fs=require('fs');var _=require(_0x36bd('0x9'));var squel=require(_0x36bd('0xa'));var crypto=require(_0x36bd('0xb'));var jsforce=require(_0x36bd('0xc'));var deskjs=require(_0x36bd('0xd'));var toCsv=require(_0x36bd('0xe'));var querystring=require(_0x36bd('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36bd('0x10'));var qs=require(_0x36bd('0x11'));var as=require(_0x36bd('0x12'));var hardwareService=require(_0x36bd('0x13'));var logger=require(_0x36bd('0x14'))(_0x36bd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x36bd('0x16'));var db=require(_0x36bd('0x17'))['db'];function respondWithStatusCode(_0x108b50,_0x12d437){_0x12d437=_0x12d437||0xcc;return function(_0x2eee5a){if(_0x2eee5a){return _0x108b50[_0x36bd('0x18')](_0x12d437);}return _0x108b50[_0x36bd('0x19')](_0x12d437)[_0x36bd('0x1a')]();};}function respondWithResult(_0xa9410f,_0x19d685){_0x19d685=_0x19d685||0xc8;return function(_0x1ccacb){if(_0x1ccacb){return _0xa9410f[_0x36bd('0x19')](_0x19d685)['json'](_0x1ccacb);}};}function respondWithFilteredResult(_0x262d50,_0x306fbf){return function(_0x15e8af){if(_0x15e8af){var _0x4c66e3=_0x15e8af[_0x36bd('0x1b')],_0x4d6a7b=_0x306fbf['offset'],_0x2e10aa=_0x306fbf[_0x36bd('0x1c')]+_0x306fbf[_0x36bd('0x1d')],_0x4a45d0;if(_0x2e10aa>=_0x4c66e3){_0x2e10aa=_0x4c66e3;_0x4a45d0=0xc8;}else{_0x4a45d0=0xce;}_0x262d50[_0x36bd('0x19')](_0x4a45d0);return _0x262d50[_0x36bd('0x1e')](_0x36bd('0x1f'),_0x4d6a7b+'-'+_0x2e10aa+'/'+_0x4c66e3)['json'](_0x15e8af);}return null;};}function patchUpdates(_0x39bf47){return function(_0x23225e){try{jsonpatch[_0x36bd('0x20')](_0x23225e,_0x39bf47,!![]);}catch(_0x4d05d8){return BPromise['reject'](_0x4d05d8);}return _0x23225e[_0x36bd('0x21')]();};}function saveUpdates(_0x5582af,_0x553289){return function(_0x5cd184){if(_0x5cd184){return _0x5cd184[_0x36bd('0x22')](_0x5582af)[_0x36bd('0x23')](function(_0x29f6d9){return _0x29f6d9;});}return null;};}function removeEntity(_0x532b8b,_0x8872b){return function(_0x32ce74){if(_0x32ce74){return _0x32ce74['destroy']()[_0x36bd('0x23')](function(){var _0x4e745c=_0x32ce74[_0x36bd('0x24')]({'plain':!![]});var _0x82e3a6=_0x36bd('0x25');return db[_0x36bd('0x26')][_0x36bd('0x27')]({'where':{'type':_0x82e3a6,'resourceId':_0x4e745c['id']}})[_0x36bd('0x23')](function(){return _0x32ce74;});})[_0x36bd('0x23')](function(){_0x532b8b[_0x36bd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ac6b7,_0x3aebd3){return function(_0x35c323){if(!_0x35c323){_0x2ac6b7['sendStatus'](0x194);}return _0x35c323;};}function handleError(_0x497939,_0x249d85){_0x249d85=_0x249d85||0x1f4;return function(_0x57bac7){logger[_0x36bd('0x28')](_0x57bac7[_0x36bd('0x29')]);if(_0x57bac7['name']){delete _0x57bac7[_0x36bd('0x2a')];}_0x497939['status'](_0x249d85)[_0x36bd('0x2b')](_0x57bac7);};}exports[_0x36bd('0x2c')]=function(_0x4714e5,_0x522bb3){var _0x37b176={},_0x4ece63={},_0x171154={'count':0x0,'rows':[]};var _0x4c78fc=_[_0x36bd('0x2d')](db[_0x36bd('0x2e')][_0x36bd('0x2f')],function(_0x1fb78d){return{'name':_0x1fb78d[_0x36bd('0x30')],'type':_0x1fb78d[_0x36bd('0x31')][_0x36bd('0x32')]};});_0x4ece63[_0x36bd('0x33')]=_[_0x36bd('0x2d')](_0x4c78fc,_0x36bd('0x2a'));_0x4ece63[_0x36bd('0x34')]=_[_0x36bd('0x35')](_0x4714e5[_0x36bd('0x34')]);_0x4ece63[_0x36bd('0x36')]=_[_0x36bd('0x37')](_0x4ece63[_0x36bd('0x33')],_0x4ece63['query']);_0x37b176[_0x36bd('0x38')]=_[_0x36bd('0x37')](_0x4ece63[_0x36bd('0x33')],qs[_0x36bd('0x39')](_0x4714e5[_0x36bd('0x34')][_0x36bd('0x39')]));_0x37b176[_0x36bd('0x38')]=_0x37b176[_0x36bd('0x38')][_0x36bd('0x3a')]?_0x37b176[_0x36bd('0x38')]:_0x4ece63['model'];if(!_0x4714e5[_0x36bd('0x34')][_0x36bd('0x3b')](_0x36bd('0x3c'))){_0x37b176[_0x36bd('0x1d')]=qs[_0x36bd('0x1d')](_0x4714e5[_0x36bd('0x34')][_0x36bd('0x1d')]);_0x37b176[_0x36bd('0x1c')]=qs[_0x36bd('0x1c')](_0x4714e5['query'][_0x36bd('0x1c')]);}_0x37b176[_0x36bd('0x3d')]=qs[_0x36bd('0x3e')](_0x4714e5[_0x36bd('0x34')][_0x36bd('0x3e')]);_0x37b176[_0x36bd('0x3f')]=qs[_0x36bd('0x36')](_[_0x36bd('0x40')](_0x4714e5[_0x36bd('0x34')],_0x4ece63['filters']),_0x4c78fc);if(_0x4714e5['query'][_0x36bd('0x41')]){_0x37b176[_0x36bd('0x3f')]=_['merge'](_0x37b176[_0x36bd('0x3f')],{'$or':_[_0x36bd('0x2d')](_0x4c78fc,function(_0x1f06f4){if(_0x1f06f4[_0x36bd('0x31')]!==_0x36bd('0x42')){var _0x56a607={};_0x56a607[_0x1f06f4[_0x36bd('0x2a')]]={'$like':'%'+_0x4714e5[_0x36bd('0x34')][_0x36bd('0x41')]+'%'};return _0x56a607;}})});}_0x37b176=_[_0x36bd('0x43')]({},_0x37b176,_0x4714e5[_0x36bd('0x44')]);var _0x1315a3={'where':_0x37b176[_0x36bd('0x3f')]};return db[_0x36bd('0x2e')][_0x36bd('0x1b')](_0x1315a3)[_0x36bd('0x23')](function(_0x4a1968){_0x171154[_0x36bd('0x1b')]=_0x4a1968;if(_0x4714e5['query'][_0x36bd('0x45')]){_0x37b176[_0x36bd('0x46')]=[{'all':!![]}];}return db[_0x36bd('0x2e')][_0x36bd('0x47')](_0x37b176);})[_0x36bd('0x23')](function(_0x58313f){_0x171154[_0x36bd('0x48')]=_0x58313f;return _0x171154;})['then'](respondWithFilteredResult(_0x522bb3,_0x37b176))['catch'](handleError(_0x522bb3,null));};exports[_0x36bd('0x49')]=function(_0x5c546e,_0x4b7317){var _0x597502={'raw':![],'where':{'id':_0x5c546e[_0x36bd('0x4a')]['id']}},_0x4029b3={};_0x4029b3[_0x36bd('0x33')]=_[_0x36bd('0x35')](db[_0x36bd('0x2e')][_0x36bd('0x2f')]);_0x4029b3[_0x36bd('0x34')]=_['keys'](_0x5c546e[_0x36bd('0x34')]);_0x4029b3[_0x36bd('0x36')]=_[_0x36bd('0x37')](_0x4029b3[_0x36bd('0x33')],_0x4029b3[_0x36bd('0x34')]);_0x597502[_0x36bd('0x38')]=_[_0x36bd('0x37')](_0x4029b3[_0x36bd('0x33')],qs['fields'](_0x5c546e[_0x36bd('0x34')][_0x36bd('0x39')]));_0x597502[_0x36bd('0x38')]=_0x597502[_0x36bd('0x38')][_0x36bd('0x3a')]?_0x597502[_0x36bd('0x38')]:_0x4029b3[_0x36bd('0x33')];if(_0x5c546e[_0x36bd('0x34')][_0x36bd('0x45')]){_0x597502[_0x36bd('0x46')]=[{'all':!![]}];}_0x597502=_[_0x36bd('0x43')]({},_0x597502,_0x5c546e['options']);return db[_0x36bd('0x2e')]['find'](_0x597502)['then'](handleEntityNotFound(_0x4b7317,null))[_0x36bd('0x23')](respondWithResult(_0x4b7317,null))[_0x36bd('0x4b')](handleError(_0x4b7317,null));};exports[_0x36bd('0x4c')]=function(_0x4f5655,_0xb63fa6){return db[_0x36bd('0x2e')][_0x36bd('0x4c')](_0x4f5655[_0x36bd('0x4d')],{})[_0x36bd('0x23')](function(_0x21c172){var _0x1e31ac=_0x4f5655['user'][_0x36bd('0x24')]({'plain':!![]});if(!_0x1e31ac)throw new Error(_0x36bd('0x4e'));if(_0x1e31ac[_0x36bd('0x4f')]===_0x36bd('0x50')){var _0x4be7b1=_0x21c172[_0x36bd('0x24')]({'plain':!![]});var _0x3dcce4='Projects';return db['UserProfileSection'][_0x36bd('0x51')]({'where':{'name':_0x3dcce4,'userProfileId':_0x1e31ac['userProfileId']},'raw':!![]})['then'](function(_0x39ff88){if(_0x39ff88&&_0x39ff88[_0x36bd('0x52')]===0x0){return db[_0x36bd('0x26')]['create']({'name':_0x4be7b1['name'],'resourceId':_0x4be7b1['id'],'type':_0x39ff88[_0x36bd('0x2a')],'sectionId':_0x39ff88['id']},{})[_0x36bd('0x23')](function(){return _0x21c172;});}else{return _0x21c172;}})['catch'](function(_0x4be136){logger[_0x36bd('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4be136);throw _0x4be136;});}return _0x21c172;})[_0x36bd('0x23')](respondWithResult(_0xb63fa6,0xc9))[_0x36bd('0x4b')](handleError(_0xb63fa6,null));};exports['clone']=function(_0x5adeb9,_0x1c44b7){var _0x7aae01={'where':{'id':_0x5adeb9[_0x36bd('0x4a')]['id']}},_0x21bb92={};_0x21bb92[_0x36bd('0x33')]=_[_0x36bd('0x35')](db[_0x36bd('0x2e')]['rawAttributes']);_0x7aae01['attributes']=_['intersection'](_0x21bb92[_0x36bd('0x33')],qs['fields'](_0x5adeb9[_0x36bd('0x34')][_0x36bd('0x39')]));_0x7aae01[_0x36bd('0x38')]=_0x7aae01['attributes']['length']?_0x7aae01[_0x36bd('0x38')]:_0x21bb92[_0x36bd('0x33')];if(_0x5adeb9['query']['includeAll']){_0x7aae01['include']=[{'all':!![]}];}_0x7aae01=_[_0x36bd('0x43')]({},_0x7aae01,_0x5adeb9['options']);return db[_0x36bd('0x2e')]['find'](_0x7aae01)[_0x36bd('0x23')](handleEntityNotFound(_0x1c44b7,null))['then'](function(_0x52f2c1){if(_0x52f2c1){var _0x1648b4=_0x52f2c1[_0x36bd('0x24')]({'plain':!![]});_0x1648b4=qs['omit'](_0x1648b4,['id',_0x36bd('0x53'),_0x36bd('0x54')]);_0x5adeb9[_0x36bd('0x4d')]=_[_0x36bd('0x55')](_0x5adeb9[_0x36bd('0x4d')],['id',_0x36bd('0x53'),'updatedAt']);return db[_0x36bd('0x2e')][_0x36bd('0x4c')](_['merge'](_0x1648b4,_0x5adeb9[_0x36bd('0x4d')]),{'include':_0x5adeb9[_0x36bd('0x34')][_0x36bd('0x45')]?[{'all':!![]}]:undefined})[_0x36bd('0x23')](function(_0x48adc9){var _0x65305f=_0x5adeb9[_0x36bd('0x50')][_0x36bd('0x24')]({'plain':!![]});if(!_0x65305f)throw new Error(_0x36bd('0x4e'));if(_0x65305f[_0x36bd('0x4f')]===_0x36bd('0x50')){var _0x55e66a=_0x48adc9['get']({'plain':!![]});var _0x4ec17c=_0x36bd('0x25');return db[_0x36bd('0x56')][_0x36bd('0x51')]({'where':{'name':_0x4ec17c,'userProfileId':_0x65305f[_0x36bd('0x57')]},'raw':!![]})['then'](function(_0x514638){if(_0x514638&&_0x514638['autoAssociation']===0x0){return db['UserProfileResource'][_0x36bd('0x4c')]({'name':_0x55e66a[_0x36bd('0x2a')],'resourceId':_0x55e66a['id'],'type':_0x514638[_0x36bd('0x2a')],'sectionId':_0x514638['id']},{})[_0x36bd('0x23')](function(){return _0x48adc9;});}else{return _0x48adc9;}})['catch'](function(_0xcdd00e){logger[_0x36bd('0x28')](_0x36bd('0x58'),_0xcdd00e);throw _0xcdd00e;});}return _0x48adc9;});}})['then'](respondWithResult(_0x1c44b7,0xc9))['catch'](handleError(_0x1c44b7,null));};exports['update']=function(_0x2bab41,_0x478d18){if(_0x2bab41['body']['id']){delete _0x2bab41[_0x36bd('0x4d')]['id'];}return db[_0x36bd('0x2e')]['find']({'where':{'id':_0x2bab41['params']['id']}})[_0x36bd('0x23')](handleEntityNotFound(_0x478d18,null))[_0x36bd('0x23')](saveUpdates(_0x2bab41[_0x36bd('0x4d')],null))[_0x36bd('0x23')](respondWithResult(_0x478d18,null))[_0x36bd('0x4b')](handleError(_0x478d18,null));};exports['destroy']=function(_0x38cbaa,_0x8eec68){return db[_0x36bd('0x2e')][_0x36bd('0x51')]({'where':{'id':_0x38cbaa[_0x36bd('0x4a')]['id']}})[_0x36bd('0x23')](handleEntityNotFound(_0x8eec68,null))[_0x36bd('0x23')](removeEntity(_0x8eec68,null))[_0x36bd('0x4b')](handleError(_0x8eec68,null));};exports[_0x36bd('0x59')]=function(_0x388f88,_0x599b17,_0x1e3d02){var _0x1a88f4={'raw':!![],'where':{}};var _0x2565de={};var _0x1d5f45={'count':0x0,'rows':[]};return db[_0x36bd('0x2e')][_0x36bd('0x5a')]({'where':{'id':_0x388f88['params']['id']}})[_0x36bd('0x23')](handleEntityNotFound(_0x599b17,null))[_0x36bd('0x23')](function(_0x2e13bd){if(_0x2e13bd){_0x2565de['model']=_[_0x36bd('0x35')](db[_0x36bd('0x5b')][_0x36bd('0x2f')]);_0x2565de[_0x36bd('0x34')]=_[_0x36bd('0x35')](_0x388f88['query']);_0x2565de[_0x36bd('0x36')]=_['intersection'](_0x2565de[_0x36bd('0x33')],_0x2565de[_0x36bd('0x34')]);_0x1a88f4[_0x36bd('0x38')]=_[_0x36bd('0x37')](_0x2565de[_0x36bd('0x33')],qs[_0x36bd('0x39')](_0x388f88[_0x36bd('0x34')][_0x36bd('0x39')]));_0x1a88f4['attributes']=_0x1a88f4[_0x36bd('0x38')][_0x36bd('0x3a')]?_0x1a88f4[_0x36bd('0x38')]:_0x2565de[_0x36bd('0x33')];if(!_0x388f88['query'][_0x36bd('0x3b')]('nolimit')){_0x1a88f4[_0x36bd('0x1d')]=qs[_0x36bd('0x1d')](_0x388f88[_0x36bd('0x34')]['limit']);_0x1a88f4[_0x36bd('0x1c')]=qs[_0x36bd('0x1c')](_0x388f88[_0x36bd('0x34')][_0x36bd('0x1c')]);}_0x1a88f4[_0x36bd('0x3d')]=qs[_0x36bd('0x3e')](_0x388f88[_0x36bd('0x34')][_0x36bd('0x3e')]);_0x1a88f4[_0x36bd('0x3f')]=qs[_0x36bd('0x36')](_['pick'](_0x388f88[_0x36bd('0x34')],_0x2565de[_0x36bd('0x36')]));_0x1a88f4[_0x36bd('0x3f')][_0x36bd('0x5c')]=_0x2e13bd['id'];if(_0x388f88[_0x36bd('0x34')]['filter']){_0x1a88f4['where']=_['merge'](_0x1a88f4[_0x36bd('0x3f')],{'$or':_['map'](_0x1a88f4[_0x36bd('0x38')],function(_0x1f7a0c){var _0x3e52e6={};_0x3e52e6[_0x1f7a0c]={'$like':'%'+_0x388f88['query']['filter']+'%'};return _0x3e52e6;})});}_0x1a88f4=_[_0x36bd('0x43')]({},_0x1a88f4,_0x388f88[_0x36bd('0x44')]);return db[_0x36bd('0x5b')][_0x36bd('0x1b')]({'where':_0x1a88f4[_0x36bd('0x3f')]})[_0x36bd('0x23')](function(_0x538015){_0x1d5f45[_0x36bd('0x1b')]=_0x538015;if(_0x388f88[_0x36bd('0x34')][_0x36bd('0x45')]){_0x1a88f4[_0x36bd('0x46')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x36bd('0x47')](_0x1a88f4);})[_0x36bd('0x23')](function(_0x2220e7){_0x1d5f45[_0x36bd('0x48')]=_0x2220e7;return _0x1d5f45;});}})['then'](respondWithFilteredResult(_0x599b17,_0x1a88f4))[_0x36bd('0x4b')](handleError(_0x599b17,null));};exports[_0x36bd('0x5d')]=function(_0x1ca3eb,_0x135334,_0x4a9cf6){var _0x2eab0c={'raw':!![],'where':{}};var _0x4486f6={};var _0x5b14b1={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x36bd('0x5a')]({'where':{'id':_0x1ca3eb[_0x36bd('0x4a')]['id']}})[_0x36bd('0x23')](handleEntityNotFound(_0x135334,null))['then'](function(_0x579bc1){if(_0x579bc1){_0x4486f6[_0x36bd('0x33')]=_['keys'](db['JscriptyAnswerReport'][_0x36bd('0x2f')]);_0x4486f6[_0x36bd('0x34')]=_[_0x36bd('0x35')](_0x1ca3eb[_0x36bd('0x34')]);_0x4486f6[_0x36bd('0x36')]=_[_0x36bd('0x37')](_0x4486f6['model'],_0x4486f6[_0x36bd('0x34')]);_0x2eab0c[_0x36bd('0x38')]=_[_0x36bd('0x37')](_0x4486f6[_0x36bd('0x33')],qs[_0x36bd('0x39')](_0x1ca3eb[_0x36bd('0x34')][_0x36bd('0x39')]));_0x2eab0c[_0x36bd('0x38')]=_0x2eab0c[_0x36bd('0x38')][_0x36bd('0x3a')]?_0x2eab0c['attributes']:_0x4486f6[_0x36bd('0x33')];if(!_0x1ca3eb[_0x36bd('0x34')][_0x36bd('0x3b')](_0x36bd('0x3c'))){_0x2eab0c[_0x36bd('0x1d')]=qs['limit'](_0x1ca3eb[_0x36bd('0x34')][_0x36bd('0x1d')]);_0x2eab0c[_0x36bd('0x1c')]=qs[_0x36bd('0x1c')](_0x1ca3eb[_0x36bd('0x34')][_0x36bd('0x1c')]);}_0x2eab0c[_0x36bd('0x3d')]=qs[_0x36bd('0x3e')](_0x1ca3eb[_0x36bd('0x34')][_0x36bd('0x3e')]);_0x2eab0c[_0x36bd('0x3f')]=qs[_0x36bd('0x36')](_[_0x36bd('0x40')](_0x1ca3eb['query'],_0x4486f6[_0x36bd('0x36')]));_0x2eab0c[_0x36bd('0x3f')][_0x36bd('0x5c')]=_0x579bc1['id'];if(_0x1ca3eb[_0x36bd('0x34')][_0x36bd('0x41')]){_0x2eab0c[_0x36bd('0x3f')]=_[_0x36bd('0x43')](_0x2eab0c[_0x36bd('0x3f')],{'$or':_[_0x36bd('0x2d')](_0x2eab0c[_0x36bd('0x38')],function(_0x598ee3){var _0x175b16={};_0x175b16[_0x598ee3]={'$like':'%'+_0x1ca3eb[_0x36bd('0x34')]['filter']+'%'};return _0x175b16;})});}_0x2eab0c=_[_0x36bd('0x43')]({},_0x2eab0c,_0x1ca3eb['options']);return db['JscriptyAnswerReport'][_0x36bd('0x1b')]({'where':_0x2eab0c['where']})['then'](function(_0x2c6f51){_0x5b14b1[_0x36bd('0x1b')]=_0x2c6f51;if(_0x1ca3eb[_0x36bd('0x34')][_0x36bd('0x45')]){_0x2eab0c[_0x36bd('0x46')]=[{'all':!![]}];}return db[_0x36bd('0x5e')]['findAll'](_0x2eab0c);})['then'](function(_0x5a0c8d){_0x5b14b1['rows']=_0x5a0c8d;return _0x5b14b1;});}})['then'](respondWithFilteredResult(_0x135334,_0x2eab0c))[_0x36bd('0x4b')](handleError(_0x135334,null));};function char(_0xee1ae2){return'number'===typeof _0xee1ae2?String[_0x36bd('0x5f')][_0x36bd('0x20')](null,arguments):_0xee1ae2;}function needsEncapsulation(_0x2cf724){return!!_0x2cf724&&(_0x2cf724[_0x36bd('0x60')]()[_0x36bd('0x61')](char(0xd))>=0x0||_0x2cf724[_0x36bd('0x60')]()['indexOf'](char(0xa))>=0x0||_0x2cf724[_0x36bd('0x60')]()[_0x36bd('0x61')](char(0x2c))>=0x0||_0x2cf724[_0x36bd('0x60')]()[_0x36bd('0x61')](char(0x22))>=0x0);}function encapsulate(_0x450e5f){var _0x254926=char(0x22),_0xb6ec51='\x5c'+char(0x22),_0x1d1a15=_0x450e5f[_0x36bd('0x60')]()[_0x36bd('0x62')](new RegExp(_0x254926,'g'),_0xb6ec51);return _0x254926+_0x1d1a15+_0x254926;}exports[_0x36bd('0x63')]=function(_0x36a05c,_0xc5c3bc,_0x110f5c){var _0x3aa667,_0x479e56;var _0x4ce733={'where':{'ProjectId':_0x36a05c[_0x36bd('0x4a')]['id']}};if(_0x36a05c[_0x36bd('0x34')]['startTime']){_0x4ce733['where'][_0x36bd('0x64')]=JSON['parse'](_0x36a05c[_0x36bd('0x34')][_0x36bd('0x65')]);}return db['JscriptySessionReport'][_0x36bd('0x47')](_0x4ce733)[_0x36bd('0x23')](handleEntityNotFound(_0xc5c3bc,null))['then'](function(_0x4199d5){if(_0x4199d5){_0x3aa667=_0x4199d5;return db[_0x36bd('0x66')][_0x36bd('0x47')]({'where':{'SessionId':{'$in':_[_0x36bd('0x2d')](_0x3aa667,'id')},'ProjectId':_0x36a05c[_0x36bd('0x4a')]['id']},'order':_0x36bd('0x67')});}})['then'](handleEntityNotFound(_0xc5c3bc,null))[_0x36bd('0x23')](function(_0x2d769c){if(_0x2d769c){_0x479e56=_0x2d769c;var _0x3f66d3={};for(var _0x13fae6=0x0,_0x539f39=_0x479e56[_0x36bd('0x3a')];_0x13fae6<_0x539f39;_0x13fae6++){if(!_0x3f66d3['hasOwnProperty'](_0x479e56[_0x13fae6][_0x36bd('0x68')])){_0x3f66d3[_0x479e56[_0x13fae6][_0x36bd('0x68')]]=needsEncapsulation(_0x479e56[_0x13fae6][_0x36bd('0x69')])?encapsulate(_0x479e56[_0x13fae6]['question']):_0x479e56[_0x13fae6][_0x36bd('0x69')];}}var _0x310e23=[],_0x2dbbc9={};for(var _0x3965fc=0x0,_0x32bff0=_0x3aa667['length'];_0x3965fc<_0x32bff0;_0x3965fc++){_0x2dbbc9={'ProjectId':_0x36a05c[_0x36bd('0x4a')]['id'],'SessionId':_0x3aa667[_0x3965fc]['id'],'StartTime':moment(_0x3aa667[_0x3965fc][_0x36bd('0x64')])[_0x36bd('0x6a')](_0x36bd('0x6b'))};for(var _0x23a23a=0x0,_0x49b4f2=_0x479e56[_0x36bd('0x3a')];_0x23a23a<_0x49b4f2;_0x23a23a++){if(_0x479e56[_0x23a23a][_0x36bd('0x6c')]==_0x3aa667[_0x3965fc]['id']&&_0x3f66d3['hasOwnProperty'](_0x479e56[_0x23a23a]['questionId'])){_0x2dbbc9[_0x3f66d3[_0x479e56[_0x23a23a][_0x36bd('0x68')]]]=_0x479e56[_0x23a23a][_0x36bd('0x6d')];}}for(var _0x1c69dc in _0x3f66d3){if(!_0x2dbbc9['hasOwnProperty'](_0x3f66d3[_0x1c69dc])){_0x2dbbc9[_0x3f66d3[_0x1c69dc]]=null;}}_0x310e23['push'](_0x2dbbc9);}return _0x310e23;}})['then'](function(_0xa81903){if(!_[_0x36bd('0x6e')](_0xa81903)){var _0x4fb8f3=toCsv(_0xa81903);var _0x5f365c=Date[_0x36bd('0x6f')]();fs['writeFileSync'](util[_0x36bd('0x6a')](_0x36bd('0x70'),_0x36a05c[_0x36bd('0x4a')]['id'],_0x5f365c),_0x4fb8f3);_0xc5c3bc['setHeader'](_0x36bd('0x71'),'attachment;\x20filename='+util[_0x36bd('0x6a')](_0x36bd('0x72'),_0x36a05c[_0x36bd('0x4a')]['id'],_0x5f365c));_0xc5c3bc['setHeader']('Content-type',_0x36bd('0x73'));return _0xc5c3bc['download'](util['format'](_0x36bd('0x70'),_0x36a05c[_0x36bd('0x4a')]['id'],_0x5f365c));}else{return _0xc5c3bc[_0x36bd('0x18')](0xcc);}})[_0x36bd('0x4b')](handleError(_0xc5c3bc,null));}; \ No newline at end of file +var _0x39a2=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','reject','save','update','then','destroy','Projects','UserProfileResource','end','error','stack','name','send','index','map','JscriptyProject','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','fields','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','getSessions','findOne','pick','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','fromCharCode','apply','indexOf','toString','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x366e61,_0x2a6041){var _0x1b0afb=function(_0x2c3178){while(--_0x2c3178){_0x366e61['push'](_0x366e61['shift']());}};_0x1b0afb(++_0x2a6041);}(_0x39a2,0x1d4));var _0x239a=function(_0x5a5276,_0x262d69){_0x5a5276=_0x5a5276-0x0;var _0x3e8ee2=_0x39a2[_0x5a5276];return _0x3e8ee2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x239a('0x0'));var rimraf=require(_0x239a('0x1'));var zipdir=require(_0x239a('0x2'));var jsonpatch=require(_0x239a('0x3'));var rp=require(_0x239a('0x4'));var moment=require(_0x239a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x239a('0x6'));var path=require('path');var sox=require(_0x239a('0x7'));var csv=require(_0x239a('0x8'));var ejs=require(_0x239a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x239a('0xa'));var crypto=require(_0x239a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x239a('0x8'));var querystring=require(_0x239a('0xc'));var Papa=require('papaparse');var Redis=require(_0x239a('0xd'));var authService=require(_0x239a('0xe'));var qs=require(_0x239a('0xf'));var as=require(_0x239a('0x10'));var hardwareService=require(_0x239a('0x11'));var logger=require(_0x239a('0x12'))(_0x239a('0x13'));var utils=require(_0x239a('0x14'));var config=require(_0x239a('0x15'));var licenseUtil=require(_0x239a('0x16'));var db=require(_0x239a('0x17'))['db'];function respondWithStatusCode(_0x2a2433,_0x405c4d){_0x405c4d=_0x405c4d||0xcc;return function(_0x2ea9d2){if(_0x2ea9d2){return _0x2a2433[_0x239a('0x18')](_0x405c4d);}return _0x2a2433[_0x239a('0x19')](_0x405c4d)['end']();};}function respondWithResult(_0x128247,_0x57b7c7){_0x57b7c7=_0x57b7c7||0xc8;return function(_0x5b0898){if(_0x5b0898){return _0x128247[_0x239a('0x19')](_0x57b7c7)[_0x239a('0x1a')](_0x5b0898);}};}function respondWithFilteredResult(_0x32101b,_0x4c30d7){return function(_0x5534e7){if(_0x5534e7){var _0x36d3b9=_0x5534e7['count'],_0x2d9086=_0x4c30d7[_0x239a('0x1b')],_0x10c74e=_0x4c30d7[_0x239a('0x1b')]+_0x4c30d7['limit'],_0x3089bc;if(_0x10c74e>=_0x36d3b9){_0x10c74e=_0x36d3b9;_0x3089bc=0xc8;}else{_0x3089bc=0xce;}_0x32101b[_0x239a('0x19')](_0x3089bc);return _0x32101b[_0x239a('0x1c')](_0x239a('0x1d'),_0x2d9086+'-'+_0x10c74e+'/'+_0x36d3b9)['json'](_0x5534e7);}return null;};}function patchUpdates(_0x4d9e22){return function(_0x354c85){try{jsonpatch['apply'](_0x354c85,_0x4d9e22,!![]);}catch(_0x31e3b6){return BPromise[_0x239a('0x1e')](_0x31e3b6);}return _0x354c85[_0x239a('0x1f')]();};}function saveUpdates(_0x23d535,_0x29fc15){return function(_0x405c01){if(_0x405c01){return _0x405c01[_0x239a('0x20')](_0x23d535)[_0x239a('0x21')](function(_0x67b4be){return _0x67b4be;});}return null;};}function removeEntity(_0x31b3ea,_0x2886c9){return function(_0x26aa53){if(_0x26aa53){return _0x26aa53[_0x239a('0x22')]()[_0x239a('0x21')](function(){var _0xe17bd2=_0x26aa53['get']({'plain':!![]});var _0x1b9aa6=_0x239a('0x23');return db[_0x239a('0x24')][_0x239a('0x22')]({'where':{'type':_0x1b9aa6,'resourceId':_0xe17bd2['id']}})[_0x239a('0x21')](function(){return _0x26aa53;});})[_0x239a('0x21')](function(){_0x31b3ea[_0x239a('0x19')](0xcc)[_0x239a('0x25')]();});}};}function handleEntityNotFound(_0x2030a9,_0x5a2518){return function(_0x3fca4e){if(!_0x3fca4e){_0x2030a9[_0x239a('0x18')](0x194);}return _0x3fca4e;};}function handleError(_0xcf9dbc,_0x18ea5c){_0x18ea5c=_0x18ea5c||0x1f4;return function(_0x525508){logger[_0x239a('0x26')](_0x525508[_0x239a('0x27')]);if(_0x525508[_0x239a('0x28')]){delete _0x525508[_0x239a('0x28')];}_0xcf9dbc[_0x239a('0x19')](_0x18ea5c)[_0x239a('0x29')](_0x525508);};}exports[_0x239a('0x2a')]=function(_0x3b9a16,_0x338b07){var _0x56ea8c={},_0xeee3c2={},_0x37817e={'count':0x0,'rows':[]};var _0xc6bff2=_[_0x239a('0x2b')](db[_0x239a('0x2c')]['rawAttributes'],function(_0x4b996b){return{'name':_0x4b996b[_0x239a('0x2d')],'type':_0x4b996b[_0x239a('0x2e')]['key']};});_0xeee3c2[_0x239a('0x2f')]=_[_0x239a('0x2b')](_0xc6bff2,_0x239a('0x28'));_0xeee3c2[_0x239a('0x30')]=_['keys'](_0x3b9a16[_0x239a('0x30')]);_0xeee3c2[_0x239a('0x31')]=_[_0x239a('0x32')](_0xeee3c2['model'],_0xeee3c2[_0x239a('0x30')]);_0x56ea8c['attributes']=_[_0x239a('0x32')](_0xeee3c2[_0x239a('0x2f')],qs['fields'](_0x3b9a16['query']['fields']));_0x56ea8c[_0x239a('0x33')]=_0x56ea8c[_0x239a('0x33')][_0x239a('0x34')]?_0x56ea8c[_0x239a('0x33')]:_0xeee3c2[_0x239a('0x2f')];if(!_0x3b9a16[_0x239a('0x30')][_0x239a('0x35')](_0x239a('0x36'))){_0x56ea8c[_0x239a('0x37')]=qs[_0x239a('0x37')](_0x3b9a16[_0x239a('0x30')][_0x239a('0x37')]);_0x56ea8c['offset']=qs[_0x239a('0x1b')](_0x3b9a16['query'][_0x239a('0x1b')]);}_0x56ea8c[_0x239a('0x38')]=qs[_0x239a('0x39')](_0x3b9a16[_0x239a('0x30')][_0x239a('0x39')]);_0x56ea8c[_0x239a('0x3a')]=qs[_0x239a('0x31')](_['pick'](_0x3b9a16[_0x239a('0x30')],_0xeee3c2['filters']),_0xc6bff2);if(_0x3b9a16[_0x239a('0x30')][_0x239a('0x3b')]){_0x56ea8c[_0x239a('0x3a')]=_[_0x239a('0x3c')](_0x56ea8c[_0x239a('0x3a')],{'$or':_[_0x239a('0x2b')](_0xc6bff2,function(_0x371629){if(_0x371629['type']!==_0x239a('0x3d')){var _0x4707ca={};_0x4707ca[_0x371629[_0x239a('0x28')]]={'$like':'%'+_0x3b9a16[_0x239a('0x30')][_0x239a('0x3b')]+'%'};return _0x4707ca;}})});}_0x56ea8c=_['merge']({},_0x56ea8c,_0x3b9a16[_0x239a('0x3e')]);var _0xab171e={'where':_0x56ea8c['where']};return db[_0x239a('0x2c')][_0x239a('0x3f')](_0xab171e)[_0x239a('0x21')](function(_0x517dd6){_0x37817e[_0x239a('0x3f')]=_0x517dd6;if(_0x3b9a16['query'][_0x239a('0x40')]){_0x56ea8c[_0x239a('0x41')]=[{'all':!![]}];}return db[_0x239a('0x2c')][_0x239a('0x42')](_0x56ea8c);})['then'](function(_0x29a998){_0x37817e[_0x239a('0x43')]=_0x29a998;return _0x37817e;})[_0x239a('0x21')](respondWithFilteredResult(_0x338b07,_0x56ea8c))[_0x239a('0x44')](handleError(_0x338b07,null));};exports[_0x239a('0x45')]=function(_0x3fc951,_0x496ad2){var _0x2958cd={'raw':![],'where':{'id':_0x3fc951[_0x239a('0x46')]['id']}},_0x4624e3={};_0x4624e3[_0x239a('0x2f')]=_[_0x239a('0x47')](db[_0x239a('0x2c')][_0x239a('0x48')]);_0x4624e3[_0x239a('0x30')]=_[_0x239a('0x47')](_0x3fc951['query']);_0x4624e3['filters']=_[_0x239a('0x32')](_0x4624e3[_0x239a('0x2f')],_0x4624e3[_0x239a('0x30')]);_0x2958cd[_0x239a('0x33')]=_[_0x239a('0x32')](_0x4624e3[_0x239a('0x2f')],qs['fields'](_0x3fc951[_0x239a('0x30')]['fields']));_0x2958cd[_0x239a('0x33')]=_0x2958cd[_0x239a('0x33')]['length']?_0x2958cd['attributes']:_0x4624e3['model'];if(_0x3fc951['query']['includeAll']){_0x2958cd[_0x239a('0x41')]=[{'all':!![]}];}_0x2958cd=_[_0x239a('0x3c')]({},_0x2958cd,_0x3fc951[_0x239a('0x3e')]);return db[_0x239a('0x2c')][_0x239a('0x49')](_0x2958cd)[_0x239a('0x21')](handleEntityNotFound(_0x496ad2,null))['then'](respondWithResult(_0x496ad2,null))[_0x239a('0x44')](handleError(_0x496ad2,null));};exports['create']=function(_0x59edb4,_0x36e1de){return db[_0x239a('0x2c')][_0x239a('0x4a')](_0x59edb4[_0x239a('0x4b')],{})[_0x239a('0x21')](function(_0x74c77a){var _0x585135=_0x59edb4[_0x239a('0x4c')][_0x239a('0x4d')]({'plain':!![]});if(!_0x585135)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x585135[_0x239a('0x4e')]===_0x239a('0x4c')){var _0x1f9c45=_0x74c77a[_0x239a('0x4d')]({'plain':!![]});var _0x13b332=_0x239a('0x23');return db['UserProfileSection'][_0x239a('0x49')]({'where':{'name':_0x13b332,'userProfileId':_0x585135[_0x239a('0x4f')]},'raw':!![]})[_0x239a('0x21')](function(_0x5085ab){if(_0x5085ab&&_0x5085ab[_0x239a('0x50')]===0x0){return db[_0x239a('0x24')][_0x239a('0x4a')]({'name':_0x1f9c45['name'],'resourceId':_0x1f9c45['id'],'type':_0x5085ab[_0x239a('0x28')],'sectionId':_0x5085ab['id']},{})[_0x239a('0x21')](function(){return _0x74c77a;});}else{return _0x74c77a;}})[_0x239a('0x44')](function(_0x515a4d){logger['error'](_0x239a('0x51'),_0x515a4d);throw _0x515a4d;});}return _0x74c77a;})[_0x239a('0x21')](respondWithResult(_0x36e1de,0xc9))[_0x239a('0x44')](handleError(_0x36e1de,null));};exports[_0x239a('0x52')]=function(_0x400b56,_0x390f40){var _0x1bd584={'where':{'id':_0x400b56[_0x239a('0x46')]['id']}},_0x5761b7={};_0x5761b7['model']=_[_0x239a('0x47')](db[_0x239a('0x2c')]['rawAttributes']);_0x1bd584[_0x239a('0x33')]=_[_0x239a('0x32')](_0x5761b7[_0x239a('0x2f')],qs[_0x239a('0x53')](_0x400b56[_0x239a('0x30')]['fields']));_0x1bd584[_0x239a('0x33')]=_0x1bd584['attributes'][_0x239a('0x34')]?_0x1bd584['attributes']:_0x5761b7[_0x239a('0x2f')];if(_0x400b56['query'][_0x239a('0x40')]){_0x1bd584[_0x239a('0x41')]=[{'all':!![]}];}_0x1bd584=_[_0x239a('0x3c')]({},_0x1bd584,_0x400b56[_0x239a('0x3e')]);return db[_0x239a('0x2c')][_0x239a('0x49')](_0x1bd584)[_0x239a('0x21')](handleEntityNotFound(_0x390f40,null))[_0x239a('0x21')](function(_0x343f71){if(_0x343f71){var _0x31d5f0=_0x343f71[_0x239a('0x4d')]({'plain':!![]});_0x31d5f0=qs[_0x239a('0x54')](_0x31d5f0,['id',_0x239a('0x55'),_0x239a('0x56')]);_0x400b56[_0x239a('0x4b')]=_[_0x239a('0x54')](_0x400b56[_0x239a('0x4b')],['id',_0x239a('0x55'),'updatedAt']);return db['JscriptyProject'][_0x239a('0x4a')](_[_0x239a('0x3c')](_0x31d5f0,_0x400b56[_0x239a('0x4b')]),{'include':_0x400b56[_0x239a('0x30')][_0x239a('0x40')]?[{'all':!![]}]:undefined})[_0x239a('0x21')](function(_0x404ae1){var _0x3fd9fa=_0x400b56['user'][_0x239a('0x4d')]({'plain':!![]});if(!_0x3fd9fa)throw new Error(_0x239a('0x57'));if(_0x3fd9fa[_0x239a('0x4e')]==='user'){var _0x45f3a3=_0x404ae1[_0x239a('0x4d')]({'plain':!![]});var _0x21ed02='Projects';return db[_0x239a('0x58')][_0x239a('0x49')]({'where':{'name':_0x21ed02,'userProfileId':_0x3fd9fa[_0x239a('0x4f')]},'raw':!![]})[_0x239a('0x21')](function(_0xff13cd){if(_0xff13cd&&_0xff13cd[_0x239a('0x50')]===0x0){return db[_0x239a('0x24')][_0x239a('0x4a')]({'name':_0x45f3a3[_0x239a('0x28')],'resourceId':_0x45f3a3['id'],'type':_0xff13cd[_0x239a('0x28')],'sectionId':_0xff13cd['id']},{})[_0x239a('0x21')](function(){return _0x404ae1;});}else{return _0x404ae1;}})[_0x239a('0x44')](function(_0x4267fd){logger[_0x239a('0x26')](_0x239a('0x51'),_0x4267fd);throw _0x4267fd;});}return _0x404ae1;});}})[_0x239a('0x21')](respondWithResult(_0x390f40,0xc9))[_0x239a('0x44')](handleError(_0x390f40,null));};exports[_0x239a('0x20')]=function(_0x1a6195,_0x360246){if(_0x1a6195[_0x239a('0x4b')]['id']){delete _0x1a6195['body']['id'];}return db[_0x239a('0x2c')][_0x239a('0x49')]({'where':{'id':_0x1a6195[_0x239a('0x46')]['id']}})[_0x239a('0x21')](handleEntityNotFound(_0x360246,null))[_0x239a('0x21')](saveUpdates(_0x1a6195[_0x239a('0x4b')],null))['then'](respondWithResult(_0x360246,null))['catch'](handleError(_0x360246,null));};exports[_0x239a('0x22')]=function(_0x14af3e,_0xabf99a){return db[_0x239a('0x2c')][_0x239a('0x49')]({'where':{'id':_0x14af3e[_0x239a('0x46')]['id']}})['then'](handleEntityNotFound(_0xabf99a,null))[_0x239a('0x21')](removeEntity(_0xabf99a,null))['catch'](handleError(_0xabf99a,null));};exports[_0x239a('0x59')]=function(_0x134849,_0x104ba1,_0x1715e4){var _0x5ebe57={'raw':!![],'where':{}};var _0x1db459={};var _0x54ac50={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x239a('0x5a')]({'where':{'id':_0x134849[_0x239a('0x46')]['id']}})[_0x239a('0x21')](handleEntityNotFound(_0x104ba1,null))[_0x239a('0x21')](function(_0x3e478b){if(_0x3e478b){_0x1db459[_0x239a('0x2f')]=_[_0x239a('0x47')](db['JscriptySessionReport'][_0x239a('0x48')]);_0x1db459['query']=_['keys'](_0x134849[_0x239a('0x30')]);_0x1db459['filters']=_[_0x239a('0x32')](_0x1db459[_0x239a('0x2f')],_0x1db459['query']);_0x5ebe57['attributes']=_['intersection'](_0x1db459['model'],qs[_0x239a('0x53')](_0x134849[_0x239a('0x30')][_0x239a('0x53')]));_0x5ebe57[_0x239a('0x33')]=_0x5ebe57['attributes']['length']?_0x5ebe57[_0x239a('0x33')]:_0x1db459[_0x239a('0x2f')];if(!_0x134849['query'][_0x239a('0x35')](_0x239a('0x36'))){_0x5ebe57['limit']=qs['limit'](_0x134849[_0x239a('0x30')][_0x239a('0x37')]);_0x5ebe57['offset']=qs[_0x239a('0x1b')](_0x134849[_0x239a('0x30')]['offset']);}_0x5ebe57[_0x239a('0x38')]=qs[_0x239a('0x39')](_0x134849[_0x239a('0x30')]['sort']);_0x5ebe57[_0x239a('0x3a')]=qs[_0x239a('0x31')](_[_0x239a('0x5b')](_0x134849['query'],_0x1db459[_0x239a('0x31')]));_0x5ebe57[_0x239a('0x3a')][_0x239a('0x5c')]=_0x3e478b['id'];if(_0x134849['query'][_0x239a('0x3b')]){_0x5ebe57[_0x239a('0x3a')]=_[_0x239a('0x3c')](_0x5ebe57['where'],{'$or':_[_0x239a('0x2b')](_0x5ebe57[_0x239a('0x33')],function(_0x51fd6b){var _0x19bc0c={};_0x19bc0c[_0x51fd6b]={'$like':'%'+_0x134849[_0x239a('0x30')][_0x239a('0x3b')]+'%'};return _0x19bc0c;})});}_0x5ebe57=_[_0x239a('0x3c')]({},_0x5ebe57,_0x134849[_0x239a('0x3e')]);return db[_0x239a('0x5d')]['count']({'where':_0x5ebe57['where']})[_0x239a('0x21')](function(_0x186204){_0x54ac50[_0x239a('0x3f')]=_0x186204;if(_0x134849[_0x239a('0x30')][_0x239a('0x40')]){_0x5ebe57['include']=[{'all':!![]}];}return db[_0x239a('0x5d')][_0x239a('0x42')](_0x5ebe57);})[_0x239a('0x21')](function(_0x17ccd9){_0x54ac50[_0x239a('0x43')]=_0x17ccd9;return _0x54ac50;});}})[_0x239a('0x21')](respondWithFilteredResult(_0x104ba1,_0x5ebe57))[_0x239a('0x44')](handleError(_0x104ba1,null));};exports[_0x239a('0x5e')]=function(_0x514412,_0x8b0310,_0x3294c5){var _0x2e6cca={'raw':!![],'where':{}};var _0x564cca={};var _0x778d27={'count':0x0,'rows':[]};return db[_0x239a('0x2c')][_0x239a('0x5a')]({'where':{'id':_0x514412[_0x239a('0x46')]['id']}})['then'](handleEntityNotFound(_0x8b0310,null))[_0x239a('0x21')](function(_0x151649){if(_0x151649){_0x564cca['model']=_[_0x239a('0x47')](db[_0x239a('0x5f')][_0x239a('0x48')]);_0x564cca[_0x239a('0x30')]=_[_0x239a('0x47')](_0x514412[_0x239a('0x30')]);_0x564cca[_0x239a('0x31')]=_['intersection'](_0x564cca[_0x239a('0x2f')],_0x564cca['query']);_0x2e6cca['attributes']=_[_0x239a('0x32')](_0x564cca[_0x239a('0x2f')],qs['fields'](_0x514412['query'][_0x239a('0x53')]));_0x2e6cca[_0x239a('0x33')]=_0x2e6cca[_0x239a('0x33')]['length']?_0x2e6cca[_0x239a('0x33')]:_0x564cca[_0x239a('0x2f')];if(!_0x514412[_0x239a('0x30')][_0x239a('0x35')](_0x239a('0x36'))){_0x2e6cca[_0x239a('0x37')]=qs['limit'](_0x514412[_0x239a('0x30')]['limit']);_0x2e6cca[_0x239a('0x1b')]=qs[_0x239a('0x1b')](_0x514412[_0x239a('0x30')][_0x239a('0x1b')]);}_0x2e6cca[_0x239a('0x38')]=qs[_0x239a('0x39')](_0x514412[_0x239a('0x30')]['sort']);_0x2e6cca[_0x239a('0x3a')]=qs[_0x239a('0x31')](_['pick'](_0x514412[_0x239a('0x30')],_0x564cca[_0x239a('0x31')]));_0x2e6cca[_0x239a('0x3a')][_0x239a('0x5c')]=_0x151649['id'];if(_0x514412['query'][_0x239a('0x3b')]){_0x2e6cca[_0x239a('0x3a')]=_[_0x239a('0x3c')](_0x2e6cca[_0x239a('0x3a')],{'$or':_[_0x239a('0x2b')](_0x2e6cca[_0x239a('0x33')],function(_0xd80890){var _0x2bfb4f={};_0x2bfb4f[_0xd80890]={'$like':'%'+_0x514412[_0x239a('0x30')][_0x239a('0x3b')]+'%'};return _0x2bfb4f;})});}_0x2e6cca=_[_0x239a('0x3c')]({},_0x2e6cca,_0x514412['options']);return db[_0x239a('0x5f')]['count']({'where':_0x2e6cca['where']})[_0x239a('0x21')](function(_0x331cdc){_0x778d27[_0x239a('0x3f')]=_0x331cdc;if(_0x514412[_0x239a('0x30')][_0x239a('0x40')]){_0x2e6cca[_0x239a('0x41')]=[{'all':!![]}];}return db[_0x239a('0x5f')][_0x239a('0x42')](_0x2e6cca);})[_0x239a('0x21')](function(_0x5f104c){_0x778d27[_0x239a('0x43')]=_0x5f104c;return _0x778d27;});}})[_0x239a('0x21')](respondWithFilteredResult(_0x8b0310,_0x2e6cca))[_0x239a('0x44')](handleError(_0x8b0310,null));};function char(_0x1b043d){return'number'===typeof _0x1b043d?String[_0x239a('0x60')][_0x239a('0x61')](null,arguments):_0x1b043d;}function needsEncapsulation(_0x416b83){return!!_0x416b83&&(_0x416b83['toString']()[_0x239a('0x62')](char(0xd))>=0x0||_0x416b83[_0x239a('0x63')]()[_0x239a('0x62')](char(0xa))>=0x0||_0x416b83[_0x239a('0x63')]()['indexOf'](char(0x2c))>=0x0||_0x416b83['toString']()[_0x239a('0x62')](char(0x22))>=0x0);}function encapsulate(_0x350e31){var _0x3cf034=char(0x22),_0x362d9b='\x5c'+char(0x22),_0x5f3fb0=_0x350e31[_0x239a('0x63')]()[_0x239a('0x64')](new RegExp(_0x3cf034,'g'),_0x362d9b);return _0x3cf034+_0x5f3fb0+_0x3cf034;}exports[_0x239a('0x65')]=function(_0x364688,_0x1ec1c1,_0xf1129){var _0x1e54df,_0x5d5d65;var _0x3bdc24={'where':{'ProjectId':_0x364688[_0x239a('0x46')]['id']}};if(_0x364688[_0x239a('0x30')][_0x239a('0x66')]){_0x3bdc24[_0x239a('0x3a')]['starttime']=JSON[_0x239a('0x67')](_0x364688['query'][_0x239a('0x66')]);}return db[_0x239a('0x5d')][_0x239a('0x42')](_0x3bdc24)[_0x239a('0x21')](handleEntityNotFound(_0x1ec1c1,null))[_0x239a('0x21')](function(_0x8f721c){if(_0x8f721c){_0x1e54df=_0x8f721c;return db[_0x239a('0x68')][_0x239a('0x42')]({'where':{'SessionId':{'$in':_[_0x239a('0x2b')](_0x1e54df,'id')},'ProjectId':_0x364688[_0x239a('0x46')]['id']},'order':_0x239a('0x69')});}})[_0x239a('0x21')](handleEntityNotFound(_0x1ec1c1,null))[_0x239a('0x21')](function(_0x51ccfa){if(_0x51ccfa){_0x5d5d65=_0x51ccfa;var _0x433fdb={};for(var _0x1f07be=0x0,_0x103daf=_0x5d5d65[_0x239a('0x34')];_0x1f07be<_0x103daf;_0x1f07be++){if(!_0x433fdb[_0x239a('0x35')](_0x5d5d65[_0x1f07be][_0x239a('0x6a')])){_0x433fdb[_0x5d5d65[_0x1f07be][_0x239a('0x6a')]]=needsEncapsulation(_0x5d5d65[_0x1f07be][_0x239a('0x6b')])?encapsulate(_0x5d5d65[_0x1f07be][_0x239a('0x6b')]):_0x5d5d65[_0x1f07be]['question'];}}var _0x2cbb9c=[],_0x2880cc={};for(var _0x4bf5c9=0x0,_0x441360=_0x1e54df[_0x239a('0x34')];_0x4bf5c9<_0x441360;_0x4bf5c9++){_0x2880cc={'ProjectId':_0x364688['params']['id'],'SessionId':_0x1e54df[_0x4bf5c9]['id'],'StartTime':moment(_0x1e54df[_0x4bf5c9]['starttime'])['format'](_0x239a('0x6c'))};for(var _0x499eec=0x0,_0x2eb5a0=_0x5d5d65[_0x239a('0x34')];_0x499eec<_0x2eb5a0;_0x499eec++){if(_0x5d5d65[_0x499eec][_0x239a('0x6d')]==_0x1e54df[_0x4bf5c9]['id']&&_0x433fdb[_0x239a('0x35')](_0x5d5d65[_0x499eec][_0x239a('0x6a')])){_0x2880cc[_0x433fdb[_0x5d5d65[_0x499eec][_0x239a('0x6a')]]]=_0x5d5d65[_0x499eec][_0x239a('0x6e')];}}for(var _0x39a28f in _0x433fdb){if(!_0x2880cc[_0x239a('0x35')](_0x433fdb[_0x39a28f])){_0x2880cc[_0x433fdb[_0x39a28f]]=null;}}_0x2cbb9c[_0x239a('0x6f')](_0x2880cc);}return _0x2cbb9c;}})['then'](function(_0x24c4ea){if(!_[_0x239a('0x70')](_0x24c4ea)){var _0x366f71=toCsv(_0x24c4ea);var _0x2404f7=Date['now']();fs[_0x239a('0x71')](util[_0x239a('0x72')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x364688[_0x239a('0x46')]['id'],_0x2404f7),_0x366f71);_0x1ec1c1[_0x239a('0x73')](_0x239a('0x74'),_0x239a('0x75')+util[_0x239a('0x72')](_0x239a('0x76'),_0x364688[_0x239a('0x46')]['id'],_0x2404f7));_0x1ec1c1['setHeader'](_0x239a('0x77'),'text/csv');return _0x1ec1c1[_0x239a('0x78')](util[_0x239a('0x72')](_0x239a('0x79'),_0x364688[_0x239a('0x46')]['id'],_0x2404f7));}else{return _0x1ec1c1['sendStatus'](0xcc);}})['catch'](handleError(_0x1ec1c1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 51d9281..4424758 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 _0xd113=['bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','api','moment'];(function(_0x113dd1,_0x15aaa1){var _0x1605e0=function(_0x138857){while(--_0x138857){_0x113dd1['push'](_0x113dd1['shift']());}};_0x1605e0(++_0x15aaa1);}(_0xd113,0x19c));var _0x3d11=function(_0x24693e,_0x2ba888){_0x24693e=_0x24693e-0x0;var _0x53e672=_0xd113[_0x24693e];return _0x53e672;};'use strict';var _=require(_0x3d11('0x0'));var util=require(_0x3d11('0x1'));var logger=require('../../config/logger')(_0x3d11('0x2'));var moment=require(_0x3d11('0x3'));var BPromise=require(_0x3d11('0x4'));var rp=require(_0x3d11('0x5'));var fs=require('fs');var path=require(_0x3d11('0x6'));var rimraf=require(_0x3d11('0x7'));var config=require('../../config/environment');var attributes=require(_0x3d11('0x8'));module[_0x3d11('0x9')]=function(_0x5424cc,_0x16220b){return _0x5424cc[_0x3d11('0xa')](_0x3d11('0xb'),attributes,{'tableName':_0x3d11('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x223b=['path','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x43557f,_0x2d10bc){var _0x8e70bf=function(_0x14bc47){while(--_0x14bc47){_0x43557f['push'](_0x43557f['shift']());}};_0x8e70bf(++_0x2d10bc);}(_0x223b,0x10e));var _0xb223=function(_0x4ab503,_0x301433){_0x4ab503=_0x4ab503-0x0;var _0x3d034f=_0x223b[_0x4ab503];return _0x3d034f;};'use strict';var _=require(_0xb223('0x0'));var util=require('util');var logger=require(_0xb223('0x1'))('api');var moment=require(_0xb223('0x2'));var BPromise=require(_0xb223('0x3'));var rp=require(_0xb223('0x4'));var fs=require('fs');var path=require(_0xb223('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb223('0x6'));module[_0xb223('0x7')]=function(_0x4fff59,_0x9be15c){return _0x4fff59[_0xb223('0x8')](_0xb223('0x9'),attributes,{'tableName':_0xb223('0xa'),'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 ecd15ee..1ada09b 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 _0x1225=['request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x120d55,_0xe7f868){var _0x266408=function(_0x486835){while(--_0x486835){_0x120d55['push'](_0x120d55['shift']());}};_0x266408(++_0xe7f868);}(_0x1225,0x1d4));var _0x5122=function(_0x67198d,_0x4298f2){_0x67198d=_0x67198d-0x0;var _0x221702=_0x1225[_0x67198d];return _0x221702;};'use strict';var _=require(_0x5122('0x0'));var util=require(_0x5122('0x1'));var moment=require(_0x5122('0x2'));var BPromise=require('bluebird');var rs=require(_0x5122('0x3'));var fs=require('fs');var Redis=require(_0x5122('0x4'));var db=require(_0x5122('0x5'))['db'];var utils=require(_0x5122('0x6'));var logger=require(_0x5122('0x7'))(_0x5122('0x8'));var config=require(_0x5122('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5122('0xa')][_0x5122('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cb2a4,_0x1a9af7,_0x4083e1){return new BPromise(function(_0x2ce175,_0x5299da){return client[_0x5122('0xc')](_0x1cb2a4,_0x4083e1)[_0x5122('0xd')](function(_0x52dc63){logger[_0x5122('0xe')](_0x5122('0xf'),_0x1a9af7,_0x5122('0x10'));logger[_0x5122('0x11')](_0x5122('0x12'),_0x1a9af7,_0x5122('0x10'),JSON[_0x5122('0x13')](_0x52dc63));if(_0x52dc63[_0x5122('0x14')]){if(_0x52dc63[_0x5122('0x14')]['code']===0x1f4){logger[_0x5122('0x14')](_0x5122('0xf'),_0x1a9af7,_0x52dc63[_0x5122('0x14')][_0x5122('0x15')]);return _0x5299da(_0x52dc63[_0x5122('0x14')][_0x5122('0x15')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x1a9af7,_0x52dc63[_0x5122('0x14')][_0x5122('0x15')]);return _0x2ce175(_0x52dc63[_0x5122('0x14')][_0x5122('0x15')]);}else{logger[_0x5122('0xe')](_0x5122('0xf'),_0x1a9af7,_0x5122('0x10'));_0x2ce175(_0x52dc63[_0x5122('0x16')][_0x5122('0x15')]);}})[_0x5122('0x17')](function(_0x3a39f6){logger[_0x5122('0x14')]('JscriptyProject,\x20%s,\x20%s',_0x1a9af7,_0x3a39f6);_0x5299da(_0x3a39f6);});});} \ No newline at end of file +var _0xe353=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyProject,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe353,0xb9));var _0x3e35=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xe353[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x3e35('0x0'));var moment=require(_0x3e35('0x1'));var BPromise=require(_0x3e35('0x2'));var rs=require(_0x3e35('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e35('0x4'))['db'];var utils=require(_0x3e35('0x5'));var logger=require('../../config/logger')(_0x3e35('0x6'));var config=require(_0x3e35('0x7'));var jayson=require(_0x3e35('0x8'));var client=jayson[_0x3e35('0x9')][_0x3e35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb5e7d0,_0x316dce,_0x40af70){return new BPromise(function(_0x36c82d,_0x1abe3a){return client[_0x3e35('0xb')](_0xb5e7d0,_0x40af70)['then'](function(_0x5f055c){logger[_0x3e35('0xc')](_0x3e35('0xd'),_0x316dce,'request\x20sent');logger[_0x3e35('0xe')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x316dce,_0x3e35('0xf'),JSON[_0x3e35('0x10')](_0x5f055c));if(_0x5f055c['error']){if(_0x5f055c[_0x3e35('0x11')]['code']===0x1f4){logger[_0x3e35('0x11')](_0x3e35('0xd'),_0x316dce,_0x5f055c[_0x3e35('0x11')]['message']);return _0x1abe3a(_0x5f055c['error']['message']);}logger[_0x3e35('0x11')](_0x3e35('0xd'),_0x316dce,_0x5f055c[_0x3e35('0x11')][_0x3e35('0x12')]);return _0x36c82d(_0x5f055c[_0x3e35('0x11')][_0x3e35('0x12')]);}else{logger[_0x3e35('0xc')](_0x3e35('0xd'),_0x316dce,_0x3e35('0xf'));_0x36c82d(_0x5f055c['result']['message']);}})['catch'](function(_0x180e5a){logger['error'](_0x3e35('0xd'),_0x316dce,_0x180e5a);_0x1abe3a(_0x180e5a);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 759a50c..27938e0 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 _0xeddd=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated','/:id','show','post','create','update','destroy','exports','multer','util','path'];(function(_0x54783e,_0xe85a52){var _0x4b03f4=function(_0x4095ba){while(--_0x4095ba){_0x54783e['push'](_0x54783e['shift']());}};_0x4b03f4(++_0xe85a52);}(_0xeddd,0x153));var _0xdedd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xeddd[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xdedd('0x0'));var util=require(_0xdedd('0x1'));var path=require(_0xdedd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdedd('0x3')]();var auth=require(_0xdedd('0x4'));var interaction=require(_0xdedd('0x5'));var config=require(_0xdedd('0x6'));var controller=require(_0xdedd('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdedd('0x8')]);router[_0xdedd('0x9')](_0xdedd('0xa'),auth[_0xdedd('0xb')](),controller['describe']);router[_0xdedd('0x9')](_0xdedd('0xc'),auth[_0xdedd('0xb')](),controller[_0xdedd('0xd')]);router[_0xdedd('0xe')]('/',auth[_0xdedd('0xb')](),controller[_0xdedd('0xf')]);router['put'](_0xdedd('0xc'),auth[_0xdedd('0xb')](),controller[_0xdedd('0x10')]);router['delete'](_0xdedd('0xc'),auth[_0xdedd('0xb')](),controller[_0xdedd('0x11')]);module[_0xdedd('0x12')]=router; \ No newline at end of file +var _0xe651=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x39143b,_0x186a7a){var _0x56503f=function(_0x5d2d00){while(--_0x5d2d00){_0x39143b['push'](_0x39143b['shift']());}};_0x56503f(++_0x186a7a);}(_0xe651,0x1a5));var _0x1e65=function(_0x3a6a2b,_0x1cc6a4){_0x3a6a2b=_0x3a6a2b-0x0;var _0xe3ebf3=_0xe651[_0x3a6a2b];return _0xe3ebf3;};'use strict';var multer=require(_0x1e65('0x0'));var util=require(_0x1e65('0x1'));var path=require(_0x1e65('0x2'));var timeout=require(_0x1e65('0x3'));var express=require(_0x1e65('0x4'));var router=express[_0x1e65('0x5')]();var auth=require(_0x1e65('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1e65('0x7'));var controller=require(_0x1e65('0x8'));router[_0x1e65('0x9')]('/',auth[_0x1e65('0xa')](),controller[_0x1e65('0xb')]);router['get']('/describe',auth[_0x1e65('0xa')](),controller['describe']);router[_0x1e65('0x9')](_0x1e65('0xc'),auth[_0x1e65('0xa')](),controller[_0x1e65('0xd')]);router[_0x1e65('0xe')]('/',auth[_0x1e65('0xa')](),controller['create']);router[_0x1e65('0xf')](_0x1e65('0xc'),auth['isAuthenticated'](),controller[_0x1e65('0x10')]);router[_0x1e65('0x11')](_0x1e65('0xc'),auth[_0x1e65('0xa')](),controller['destroy']);module[_0x1e65('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 6cfeac1..21da5e7 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 _0xb03e=['TEXT','long','STRING','exports'];(function(_0x38750a,_0x316de4){var _0x92e34a=function(_0x4f83e1){while(--_0x4f83e1){_0x38750a['push'](_0x38750a['shift']());}};_0x92e34a(++_0x316de4);}(_0xb03e,0x1eb));var _0xeb03=function(_0x124709,_0x4b991c){_0x124709=_0x124709-0x0;var _0x2eed17=_0xb03e[_0x124709];return _0x2eed17;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'question':{'type':Sequelize[_0xeb03('0x1')]},'answer':{'type':Sequelize[_0xeb03('0x1')](_0xeb03('0x2'))},'membername':{'type':Sequelize[_0xeb03('0x3')]},'projectname':{'type':Sequelize[_0xeb03('0x3')]},'queue':{'type':Sequelize[_0xeb03('0x3')]},'uniqueid':{'type':Sequelize[_0xeb03('0x3')]},'calleridname':{'type':Sequelize[_0xeb03('0x3')]},'calleridnum':{'type':Sequelize[_0xeb03('0x3')]},'questionId':{'type':Sequelize[_0xeb03('0x3')]}}; \ No newline at end of file +var _0x2b65=['sequelize','exports','TEXT','long','STRING'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x2b65,0x131));var _0x52b6=function(_0xbbcb36,_0x586383){_0xbbcb36=_0xbbcb36-0x0;var _0x4278ff=_0x2b65[_0xbbcb36];return _0x4278ff;};'use strict';var Sequelize=require(_0x52b6('0x0'));module[_0x52b6('0x1')]={'question':{'type':Sequelize[_0x52b6('0x2')]},'answer':{'type':Sequelize[_0x52b6('0x2')](_0x52b6('0x3'))},'membername':{'type':Sequelize[_0x52b6('0x4')]},'projectname':{'type':Sequelize[_0x52b6('0x4')]},'queue':{'type':Sequelize[_0x52b6('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x52b6('0x4')]},'calleridnum':{'type':Sequelize[_0x52b6('0x4')]},'questionId':{'type':Sequelize[_0x52b6('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index b60f499..f58054f 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 _0xd090=['../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','update','then','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd090,0xc8));var _0x0d09=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd090[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x0d09('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0d09('0x1'));var zipdir=require(_0x0d09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d09('0x3'));var moment=require(_0x0d09('0x4'));var BPromise=require(_0x0d09('0x5'));var Mustache=require(_0x0d09('0x6'));var util=require(_0x0d09('0x7'));var path=require('path');var sox=require(_0x0d09('0x8'));var csv=require(_0x0d09('0x9'));var ejs=require(_0x0d09('0xa'));var fs=require('fs');var _=require(_0x0d09('0xb'));var squel=require('squel');var crypto=require(_0x0d09('0xc'));var jsforce=require(_0x0d09('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0d09('0x9'));var querystring=require(_0x0d09('0xe'));var Papa=require('papaparse');var Redis=require(_0x0d09('0xf'));var authService=require(_0x0d09('0x10'));var qs=require(_0x0d09('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d09('0x12'));var logger=require('../../config/logger')(_0x0d09('0x13'));var utils=require(_0x0d09('0x14'));var config=require(_0x0d09('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d09('0x16'))['db'];function respondWithStatusCode(_0x7e3c13,_0x1ace6d){_0x1ace6d=_0x1ace6d||0xcc;return function(_0x19a11c){if(_0x19a11c){return _0x7e3c13['sendStatus'](_0x1ace6d);}return _0x7e3c13[_0x0d09('0x17')](_0x1ace6d)['end']();};}function respondWithResult(_0x6342b3,_0x391854){_0x391854=_0x391854||0xc8;return function(_0x5eb788){if(_0x5eb788){return _0x6342b3[_0x0d09('0x17')](_0x391854)[_0x0d09('0x18')](_0x5eb788);}};}function respondWithFilteredResult(_0x192ebf,_0x22e326){return function(_0x5b6698){if(_0x5b6698){var _0x130e46=_0x5b6698[_0x0d09('0x19')],_0x27b1ed=_0x22e326[_0x0d09('0x1a')],_0x247976=_0x22e326[_0x0d09('0x1a')]+_0x22e326[_0x0d09('0x1b')],_0xc04102;if(_0x247976>=_0x130e46){_0x247976=_0x130e46;_0xc04102=0xc8;}else{_0xc04102=0xce;}_0x192ebf[_0x0d09('0x17')](_0xc04102);return _0x192ebf['set'](_0x0d09('0x1c'),_0x27b1ed+'-'+_0x247976+'/'+_0x130e46)[_0x0d09('0x18')](_0x5b6698);}return null;};}function patchUpdates(_0x275da5){return function(_0xabd8a7){try{jsonpatch[_0x0d09('0x1d')](_0xabd8a7,_0x275da5,!![]);}catch(_0x3a691c){return BPromise[_0x0d09('0x1e')](_0x3a691c);}return _0xabd8a7['save']();};}function saveUpdates(_0x3a538d,_0x59b194){return function(_0x24fb0c){if(_0x24fb0c){return _0x24fb0c[_0x0d09('0x1f')](_0x3a538d)[_0x0d09('0x20')](function(_0x2cb23d){return _0x2cb23d;});}return null;};}function removeEntity(_0x518475,_0x101fc1){return function(_0x14b656){if(_0x14b656){return _0x14b656['destroy']()[_0x0d09('0x20')](function(){_0x518475[_0x0d09('0x17')](0xcc)[_0x0d09('0x21')]();});}};}function handleEntityNotFound(_0x339d00,_0x25d19e){return function(_0x1f3300){if(!_0x1f3300){_0x339d00['sendStatus'](0x194);}return _0x1f3300;};}function handleError(_0x2a284a,_0x207da){_0x207da=_0x207da||0x1f4;return function(_0x208630){logger[_0x0d09('0x22')](_0x208630['stack']);if(_0x208630[_0x0d09('0x23')]){delete _0x208630[_0x0d09('0x23')];}_0x2a284a[_0x0d09('0x17')](_0x207da)[_0x0d09('0x24')](_0x208630);};}exports[_0x0d09('0x25')]=function(_0x49e67e,_0x3fe49b){var _0x237ae5={},_0xe2c9c2={},_0x2956e3={'count':0x0,'rows':[]};var _0x1eec6b=_[_0x0d09('0x26')](db['JscriptyQuestionReport'][_0x0d09('0x27')],function(_0x545724){return{'name':_0x545724[_0x0d09('0x28')],'type':_0x545724[_0x0d09('0x29')][_0x0d09('0x2a')]};});_0xe2c9c2[_0x0d09('0x2b')]=_['map'](_0x1eec6b,_0x0d09('0x23'));_0xe2c9c2[_0x0d09('0x2c')]=_['keys'](_0x49e67e[_0x0d09('0x2c')]);_0xe2c9c2['filters']=_[_0x0d09('0x2d')](_0xe2c9c2[_0x0d09('0x2b')],_0xe2c9c2['query']);_0x237ae5[_0x0d09('0x2e')]=_[_0x0d09('0x2d')](_0xe2c9c2[_0x0d09('0x2b')],qs[_0x0d09('0x2f')](_0x49e67e['query'][_0x0d09('0x2f')]));_0x237ae5[_0x0d09('0x2e')]=_0x237ae5[_0x0d09('0x2e')]['length']?_0x237ae5[_0x0d09('0x2e')]:_0xe2c9c2[_0x0d09('0x2b')];if(!_0x49e67e[_0x0d09('0x2c')][_0x0d09('0x30')](_0x0d09('0x31'))){_0x237ae5[_0x0d09('0x1b')]=qs[_0x0d09('0x1b')](_0x49e67e[_0x0d09('0x2c')]['limit']);_0x237ae5['offset']=qs['offset'](_0x49e67e['query'][_0x0d09('0x1a')]);}_0x237ae5[_0x0d09('0x32')]=qs[_0x0d09('0x33')](_0x49e67e[_0x0d09('0x2c')]['sort']);_0x237ae5[_0x0d09('0x34')]=qs[_0x0d09('0x35')](_[_0x0d09('0x36')](_0x49e67e[_0x0d09('0x2c')],_0xe2c9c2['filters']),_0x1eec6b);if(_0x49e67e[_0x0d09('0x2c')]['filter']){_0x237ae5[_0x0d09('0x34')]=_[_0x0d09('0x37')](_0x237ae5[_0x0d09('0x34')],{'$or':_[_0x0d09('0x26')](_0x1eec6b,function(_0xbec2dd){if(_0xbec2dd[_0x0d09('0x29')]!==_0x0d09('0x38')){var _0x5ce549={};_0x5ce549[_0xbec2dd[_0x0d09('0x23')]]={'$like':'%'+_0x49e67e[_0x0d09('0x2c')][_0x0d09('0x39')]+'%'};return _0x5ce549;}})});}_0x237ae5=_[_0x0d09('0x37')]({},_0x237ae5,_0x49e67e[_0x0d09('0x3a')]);var _0x26b28e={'where':_0x237ae5[_0x0d09('0x34')]};return db[_0x0d09('0x3b')][_0x0d09('0x19')](_0x26b28e)[_0x0d09('0x20')](function(_0x4c89d8){_0x2956e3[_0x0d09('0x19')]=_0x4c89d8;if(_0x49e67e[_0x0d09('0x2c')][_0x0d09('0x3c')]){_0x237ae5[_0x0d09('0x3d')]=[{'all':!![]}];}return db[_0x0d09('0x3b')][_0x0d09('0x3e')](_0x237ae5);})[_0x0d09('0x20')](function(_0x5014c2){_0x2956e3[_0x0d09('0x3f')]=_0x5014c2;return _0x2956e3;})[_0x0d09('0x20')](respondWithFilteredResult(_0x3fe49b,_0x237ae5))[_0x0d09('0x40')](handleError(_0x3fe49b,null));};exports[_0x0d09('0x41')]=function(_0x330d4d,_0x5a6838){var _0x3a4e70={'raw':!![],'where':{'id':_0x330d4d[_0x0d09('0x42')]['id']}},_0x138e7f={};_0x138e7f[_0x0d09('0x2b')]=_[_0x0d09('0x43')](db[_0x0d09('0x3b')]['rawAttributes']);_0x138e7f[_0x0d09('0x2c')]=_[_0x0d09('0x43')](_0x330d4d['query']);_0x138e7f[_0x0d09('0x35')]=_[_0x0d09('0x2d')](_0x138e7f[_0x0d09('0x2b')],_0x138e7f['query']);_0x3a4e70[_0x0d09('0x2e')]=_[_0x0d09('0x2d')](_0x138e7f[_0x0d09('0x2b')],qs[_0x0d09('0x2f')](_0x330d4d['query'][_0x0d09('0x2f')]));_0x3a4e70[_0x0d09('0x2e')]=_0x3a4e70[_0x0d09('0x2e')][_0x0d09('0x44')]?_0x3a4e70[_0x0d09('0x2e')]:_0x138e7f[_0x0d09('0x2b')];if(_0x330d4d['query'][_0x0d09('0x3c')]){_0x3a4e70[_0x0d09('0x3d')]=[{'all':!![]}];}_0x3a4e70=_[_0x0d09('0x37')]({},_0x3a4e70,_0x330d4d[_0x0d09('0x3a')]);return db['JscriptyQuestionReport'][_0x0d09('0x45')](_0x3a4e70)[_0x0d09('0x20')](handleEntityNotFound(_0x5a6838,null))['then'](respondWithResult(_0x5a6838,null))[_0x0d09('0x40')](handleError(_0x5a6838,null));};exports[_0x0d09('0x46')]=function(_0xd05374,_0x5f0d7a){return db[_0x0d09('0x3b')][_0x0d09('0x46')](_0xd05374[_0x0d09('0x47')],{})[_0x0d09('0x20')](respondWithResult(_0x5f0d7a,0xc9))[_0x0d09('0x40')](handleError(_0x5f0d7a,null));};exports[_0x0d09('0x1f')]=function(_0x5618cc,_0x51cec7){if(_0x5618cc[_0x0d09('0x47')]['id']){delete _0x5618cc[_0x0d09('0x47')]['id'];}return db[_0x0d09('0x3b')][_0x0d09('0x45')]({'where':{'id':_0x5618cc['params']['id']}})[_0x0d09('0x20')](handleEntityNotFound(_0x51cec7,null))[_0x0d09('0x20')](saveUpdates(_0x5618cc[_0x0d09('0x47')],null))[_0x0d09('0x20')](respondWithResult(_0x51cec7,null))[_0x0d09('0x40')](handleError(_0x51cec7,null));};exports[_0x0d09('0x48')]=function(_0x188619,_0x190a10){return db[_0x0d09('0x3b')][_0x0d09('0x45')]({'where':{'id':_0x188619['params']['id']}})[_0x0d09('0x20')](handleEntityNotFound(_0x190a10,null))[_0x0d09('0x20')](removeEntity(_0x190a10,null))['catch'](handleError(_0x190a10,null));};exports['describe']=function(_0x301dd7,_0x1a1d3b){return db[_0x0d09('0x3b')][_0x0d09('0x49')]()[_0x0d09('0x20')](respondWithResult(_0x1a1d3b,null))['catch'](handleError(_0x1a1d3b,null));}; \ No newline at end of file +var _0xf24c=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','catch','show','include','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4f1423,_0x13cc99){var _0x33c235=function(_0x48f704){while(--_0x48f704){_0x4f1423['push'](_0x4f1423['shift']());}};_0x33c235(++_0x13cc99);}(_0xf24c,0x158));var _0xcf24=function(_0x15cbc7,_0x186e17){_0x15cbc7=_0x15cbc7-0x0;var _0x5fdf24=_0xf24c[_0x15cbc7];return _0x5fdf24;};'use strict';var pdf=require(_0xcf24('0x0'));var emlformat=require(_0xcf24('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcf24('0x2'));var jsonpatch=require(_0xcf24('0x3'));var rp=require('request-promise');var moment=require(_0xcf24('0x4'));var BPromise=require(_0xcf24('0x5'));var Mustache=require('mustache');var util=require(_0xcf24('0x6'));var path=require(_0xcf24('0x7'));var sox=require(_0xcf24('0x8'));var csv=require(_0xcf24('0x9'));var ejs=require(_0xcf24('0xa'));var fs=require('fs');var _=require(_0xcf24('0xb'));var squel=require(_0xcf24('0xc'));var crypto=require(_0xcf24('0xd'));var jsforce=require(_0xcf24('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcf24('0x9'));var querystring=require(_0xcf24('0xf'));var Papa=require(_0xcf24('0x10'));var Redis=require(_0xcf24('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcf24('0x12'));var as=require(_0xcf24('0x13'));var hardwareService=require(_0xcf24('0x14'));var logger=require('../../config/logger')(_0xcf24('0x15'));var utils=require('../../config/utils');var config=require(_0xcf24('0x16'));var licenseUtil=require(_0xcf24('0x17'));var db=require(_0xcf24('0x18'))['db'];function respondWithStatusCode(_0x3f6b61,_0x116569){_0x116569=_0x116569||0xcc;return function(_0x202fc6){if(_0x202fc6){return _0x3f6b61[_0xcf24('0x19')](_0x116569);}return _0x3f6b61[_0xcf24('0x1a')](_0x116569)[_0xcf24('0x1b')]();};}function respondWithResult(_0x162f07,_0xcb9dd5){_0xcb9dd5=_0xcb9dd5||0xc8;return function(_0x324d25){if(_0x324d25){return _0x162f07[_0xcf24('0x1a')](_0xcb9dd5)[_0xcf24('0x1c')](_0x324d25);}};}function respondWithFilteredResult(_0x3e16b8,_0x462b92){return function(_0x27d0ac){if(_0x27d0ac){var _0x7a7453=_0x27d0ac[_0xcf24('0x1d')],_0x269948=_0x462b92[_0xcf24('0x1e')],_0x3ef4dd=_0x462b92['offset']+_0x462b92[_0xcf24('0x1f')],_0x253da3;if(_0x3ef4dd>=_0x7a7453){_0x3ef4dd=_0x7a7453;_0x253da3=0xc8;}else{_0x253da3=0xce;}_0x3e16b8[_0xcf24('0x1a')](_0x253da3);return _0x3e16b8['set']('Content-Range',_0x269948+'-'+_0x3ef4dd+'/'+_0x7a7453)[_0xcf24('0x1c')](_0x27d0ac);}return null;};}function patchUpdates(_0x35dd14){return function(_0x11dcbd){try{jsonpatch[_0xcf24('0x20')](_0x11dcbd,_0x35dd14,!![]);}catch(_0x465e4e){return BPromise[_0xcf24('0x21')](_0x465e4e);}return _0x11dcbd[_0xcf24('0x22')]();};}function saveUpdates(_0x3a1304,_0x213204){return function(_0x4b53ad){if(_0x4b53ad){return _0x4b53ad[_0xcf24('0x23')](_0x3a1304)[_0xcf24('0x24')](function(_0x18d08d){return _0x18d08d;});}return null;};}function removeEntity(_0x47eb41,_0xe9e885){return function(_0x2d95dd){if(_0x2d95dd){return _0x2d95dd[_0xcf24('0x25')]()[_0xcf24('0x24')](function(){_0x47eb41['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35dc3c,_0x3e9eae){return function(_0x42a7e6){if(!_0x42a7e6){_0x35dc3c[_0xcf24('0x19')](0x194);}return _0x42a7e6;};}function handleError(_0x4f3689,_0x59d0a2){_0x59d0a2=_0x59d0a2||0x1f4;return function(_0x4503f2){logger[_0xcf24('0x26')](_0x4503f2[_0xcf24('0x27')]);if(_0x4503f2[_0xcf24('0x28')]){delete _0x4503f2[_0xcf24('0x28')];}_0x4f3689[_0xcf24('0x1a')](_0x59d0a2)[_0xcf24('0x29')](_0x4503f2);};}exports[_0xcf24('0x2a')]=function(_0x5c79f8,_0x4aa4d4){var _0x3780a2={},_0x258d0a={},_0x4f6594={'count':0x0,'rows':[]};var _0x179ed5=_['map'](db[_0xcf24('0x2b')][_0xcf24('0x2c')],function(_0x57d58f){return{'name':_0x57d58f[_0xcf24('0x2d')],'type':_0x57d58f[_0xcf24('0x2e')][_0xcf24('0x2f')]};});_0x258d0a['model']=_[_0xcf24('0x30')](_0x179ed5,_0xcf24('0x28'));_0x258d0a[_0xcf24('0x31')]=_[_0xcf24('0x32')](_0x5c79f8[_0xcf24('0x31')]);_0x258d0a['filters']=_[_0xcf24('0x33')](_0x258d0a[_0xcf24('0x34')],_0x258d0a['query']);_0x3780a2[_0xcf24('0x35')]=_[_0xcf24('0x33')](_0x258d0a[_0xcf24('0x34')],qs[_0xcf24('0x36')](_0x5c79f8[_0xcf24('0x31')]['fields']));_0x3780a2[_0xcf24('0x35')]=_0x3780a2['attributes'][_0xcf24('0x37')]?_0x3780a2[_0xcf24('0x35')]:_0x258d0a['model'];if(!_0x5c79f8['query'][_0xcf24('0x38')]('nolimit')){_0x3780a2[_0xcf24('0x1f')]=qs[_0xcf24('0x1f')](_0x5c79f8[_0xcf24('0x31')]['limit']);_0x3780a2[_0xcf24('0x1e')]=qs[_0xcf24('0x1e')](_0x5c79f8[_0xcf24('0x31')]['offset']);}_0x3780a2[_0xcf24('0x39')]=qs[_0xcf24('0x3a')](_0x5c79f8[_0xcf24('0x31')][_0xcf24('0x3a')]);_0x3780a2[_0xcf24('0x3b')]=qs[_0xcf24('0x3c')](_['pick'](_0x5c79f8[_0xcf24('0x31')],_0x258d0a[_0xcf24('0x3c')]),_0x179ed5);if(_0x5c79f8[_0xcf24('0x31')][_0xcf24('0x3d')]){_0x3780a2[_0xcf24('0x3b')]=_[_0xcf24('0x3e')](_0x3780a2['where'],{'$or':_[_0xcf24('0x30')](_0x179ed5,function(_0x5cdf53){if(_0x5cdf53[_0xcf24('0x2e')]!=='VIRTUAL'){var _0x5326a4={};_0x5326a4[_0x5cdf53[_0xcf24('0x28')]]={'$like':'%'+_0x5c79f8[_0xcf24('0x31')][_0xcf24('0x3d')]+'%'};return _0x5326a4;}})});}_0x3780a2=_[_0xcf24('0x3e')]({},_0x3780a2,_0x5c79f8[_0xcf24('0x3f')]);var _0x3c61bc={'where':_0x3780a2[_0xcf24('0x3b')]};return db[_0xcf24('0x2b')][_0xcf24('0x1d')](_0x3c61bc)[_0xcf24('0x24')](function(_0xe16534){_0x4f6594[_0xcf24('0x1d')]=_0xe16534;if(_0x5c79f8[_0xcf24('0x31')][_0xcf24('0x40')]){_0x3780a2['include']=[{'all':!![]}];}return db[_0xcf24('0x2b')]['findAll'](_0x3780a2);})[_0xcf24('0x24')](function(_0x2d9348){_0x4f6594['rows']=_0x2d9348;return _0x4f6594;})[_0xcf24('0x24')](respondWithFilteredResult(_0x4aa4d4,_0x3780a2))[_0xcf24('0x41')](handleError(_0x4aa4d4,null));};exports[_0xcf24('0x42')]=function(_0x27d17c,_0x39e403){var _0x110c33={'raw':!![],'where':{'id':_0x27d17c['params']['id']}},_0x4e2006={};_0x4e2006[_0xcf24('0x34')]=_['keys'](db[_0xcf24('0x2b')][_0xcf24('0x2c')]);_0x4e2006[_0xcf24('0x31')]=_[_0xcf24('0x32')](_0x27d17c[_0xcf24('0x31')]);_0x4e2006[_0xcf24('0x3c')]=_[_0xcf24('0x33')](_0x4e2006[_0xcf24('0x34')],_0x4e2006['query']);_0x110c33[_0xcf24('0x35')]=_['intersection'](_0x4e2006['model'],qs[_0xcf24('0x36')](_0x27d17c[_0xcf24('0x31')][_0xcf24('0x36')]));_0x110c33[_0xcf24('0x35')]=_0x110c33['attributes'][_0xcf24('0x37')]?_0x110c33[_0xcf24('0x35')]:_0x4e2006[_0xcf24('0x34')];if(_0x27d17c[_0xcf24('0x31')][_0xcf24('0x40')]){_0x110c33[_0xcf24('0x43')]=[{'all':!![]}];}_0x110c33=_[_0xcf24('0x3e')]({},_0x110c33,_0x27d17c[_0xcf24('0x3f')]);return db[_0xcf24('0x2b')][_0xcf24('0x44')](_0x110c33)[_0xcf24('0x24')](handleEntityNotFound(_0x39e403,null))['then'](respondWithResult(_0x39e403,null))[_0xcf24('0x41')](handleError(_0x39e403,null));};exports['create']=function(_0x122374,_0x52897){return db['JscriptyQuestionReport'][_0xcf24('0x45')](_0x122374[_0xcf24('0x46')],{})['then'](respondWithResult(_0x52897,0xc9))[_0xcf24('0x41')](handleError(_0x52897,null));};exports['update']=function(_0x3f785a,_0x386080){if(_0x3f785a[_0xcf24('0x46')]['id']){delete _0x3f785a['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x3f785a[_0xcf24('0x47')]['id']}})[_0xcf24('0x24')](handleEntityNotFound(_0x386080,null))[_0xcf24('0x24')](saveUpdates(_0x3f785a[_0xcf24('0x46')],null))[_0xcf24('0x24')](respondWithResult(_0x386080,null))[_0xcf24('0x41')](handleError(_0x386080,null));};exports[_0xcf24('0x25')]=function(_0x16d75e,_0x44bfb8){return db['JscriptyQuestionReport'][_0xcf24('0x44')]({'where':{'id':_0x16d75e[_0xcf24('0x47')]['id']}})[_0xcf24('0x24')](handleEntityNotFound(_0x44bfb8,null))[_0xcf24('0x24')](removeEntity(_0x44bfb8,null))[_0xcf24('0x41')](handleError(_0x44bfb8,null));};exports[_0xcf24('0x48')]=function(_0x2c1bfb,_0x51011f){return db['JscriptyQuestionReport'][_0xcf24('0x48')]()['then'](respondWithResult(_0x51011f,null))[_0xcf24('0x41')](handleError(_0x51011f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 811d4f5..6f87ed9 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 _0x9b25=['exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes'];(function(_0x548af0,_0x2f9fd8){var _0x595aeb=function(_0x25ba45){while(--_0x25ba45){_0x548af0['push'](_0x548af0['shift']());}};_0x595aeb(++_0x2f9fd8);}(_0x9b25,0x70));var _0x59b2=function(_0x385dba,_0x1b20a2){_0x385dba=_0x385dba-0x0;var _0x3b7ee3=_0x9b25[_0x385dba];return _0x3b7ee3;};'use strict';var _=require(_0x59b2('0x0'));var util=require('util');var logger=require(_0x59b2('0x1'))(_0x59b2('0x2'));var moment=require(_0x59b2('0x3'));var BPromise=require(_0x59b2('0x4'));var rp=require(_0x59b2('0x5'));var fs=require('fs');var path=require(_0x59b2('0x6'));var rimraf=require(_0x59b2('0x7'));var config=require('../../config/environment');var attributes=require(_0x59b2('0x8'));module[_0x59b2('0x9')]=function(_0x1e963f,_0xa19159){return _0x1e963f[_0x59b2('0xa')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24d9=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','util'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x24d9,0xc2));var _0x924d=function(_0x281e4b,_0x13cc6a){_0x281e4b=_0x281e4b-0x0;var _0x53b735=_0x24d9[_0x281e4b];return _0x53b735;};'use strict';var _=require('lodash');var util=require(_0x924d('0x0'));var logger=require(_0x924d('0x1'))(_0x924d('0x2'));var moment=require(_0x924d('0x3'));var BPromise=require(_0x924d('0x4'));var rp=require(_0x924d('0x5'));var fs=require('fs');var path=require(_0x924d('0x6'));var rimraf=require('rimraf');var config=require(_0x924d('0x7'));var attributes=require(_0x924d('0x8'));module[_0x924d('0x9')]=function(_0x34f4c2,_0x1c02ee){return _0x34f4c2[_0x924d('0xa')](_0x924d('0xb'),attributes,{'tableName':_0x924d('0xc'),'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 6e8fedc..390f7d8 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 _0x1f2d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x3ab0f1,_0x31acba){var _0x2c2fb8=function(_0x5da5c4){while(--_0x5da5c4){_0x3ab0f1['push'](_0x3ab0f1['shift']());}};_0x2c2fb8(++_0x31acba);}(_0x1f2d,0x1b2));var _0xd1f2=function(_0xf61d62,_0x5e1ce1){_0xf61d62=_0xf61d62-0x0;var _0x1b8b00=_0x1f2d[_0xf61d62];return _0x1b8b00;};'use strict';var _=require(_0xd1f2('0x0'));var util=require(_0xd1f2('0x1'));var moment=require(_0xd1f2('0x2'));var BPromise=require(_0xd1f2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1f2('0x5'));var logger=require(_0xd1f2('0x6'))(_0xd1f2('0x7'));var config=require(_0xd1f2('0x8'));var jayson=require(_0xd1f2('0x9'));var client=jayson[_0xd1f2('0xa')][_0xd1f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaa0485,_0xdf1a8e,_0x50c978){return new BPromise(function(_0x3b598f,_0x276c4b){return client['request'](_0xaa0485,_0x50c978)[_0xd1f2('0xc')](function(_0x5526c9){logger[_0xd1f2('0xd')](_0xd1f2('0xe'),_0xdf1a8e,_0xd1f2('0xf'));logger[_0xd1f2('0x10')](_0xd1f2('0x11'),_0xdf1a8e,'request\x20sent',JSON[_0xd1f2('0x12')](_0x5526c9));if(_0x5526c9[_0xd1f2('0x13')]){if(_0x5526c9[_0xd1f2('0x13')][_0xd1f2('0x14')]===0x1f4){logger['error'](_0xd1f2('0xe'),_0xdf1a8e,_0x5526c9['error'][_0xd1f2('0x15')]);return _0x276c4b(_0x5526c9[_0xd1f2('0x13')]['message']);}logger[_0xd1f2('0x13')](_0xd1f2('0xe'),_0xdf1a8e,_0x5526c9[_0xd1f2('0x13')][_0xd1f2('0x15')]);return _0x3b598f(_0x5526c9['error'][_0xd1f2('0x15')]);}else{logger[_0xd1f2('0xd')](_0xd1f2('0xe'),_0xdf1a8e,_0xd1f2('0xf'));_0x3b598f(_0x5526c9['result'][_0xd1f2('0x15')]);}})['catch'](function(_0x3f91e9){logger[_0xd1f2('0x13')](_0xd1f2('0xe'),_0xdf1a8e,_0x3f91e9);_0x276c4b(_0x3f91e9);});});} \ No newline at end of file +var _0x6311=['then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\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','request'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x6311,0x183));var _0x1631=function(_0x439af6,_0x479095){_0x439af6=_0x439af6-0x0;var _0x259601=_0x6311[_0x439af6];return _0x259601;};'use strict';var _=require(_0x1631('0x0'));var util=require(_0x1631('0x1'));var moment=require(_0x1631('0x2'));var BPromise=require(_0x1631('0x3'));var rs=require(_0x1631('0x4'));var fs=require('fs');var Redis=require(_0x1631('0x5'));var db=require(_0x1631('0x6'))['db'];var utils=require(_0x1631('0x7'));var logger=require(_0x1631('0x8'))(_0x1631('0x9'));var config=require(_0x1631('0xa'));var jayson=require(_0x1631('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x81c39c,_0x2dbb25,_0x275764){return new BPromise(function(_0x4d128f,_0x391963){return client[_0x1631('0xc')](_0x81c39c,_0x275764)[_0x1631('0xd')](function(_0x179d13){logger[_0x1631('0xe')](_0x1631('0xf'),_0x2dbb25,_0x1631('0x10'));logger[_0x1631('0x11')](_0x1631('0x12'),_0x2dbb25,_0x1631('0x10'),JSON[_0x1631('0x13')](_0x179d13));if(_0x179d13[_0x1631('0x14')]){if(_0x179d13[_0x1631('0x14')][_0x1631('0x15')]===0x1f4){logger[_0x1631('0x14')](_0x1631('0xf'),_0x2dbb25,_0x179d13[_0x1631('0x14')][_0x1631('0x16')]);return _0x391963(_0x179d13[_0x1631('0x14')]['message']);}logger['error'](_0x1631('0xf'),_0x2dbb25,_0x179d13[_0x1631('0x14')]['message']);return _0x4d128f(_0x179d13['error']['message']);}else{logger[_0x1631('0xe')](_0x1631('0xf'),_0x2dbb25,_0x1631('0x10'));_0x4d128f(_0x179d13[_0x1631('0x17')][_0x1631('0x16')]);}})[_0x1631('0x18')](function(_0x306214){logger[_0x1631('0x14')](_0x1631('0xf'),_0x2dbb25,_0x306214);_0x391963(_0x306214);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index a0a13a1..ca6231a 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 _0x202c=['express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','isAuthenticated','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x30b074,_0x3747d1){var _0x130a1f=function(_0x1029be){while(--_0x1029be){_0x30b074['push'](_0x30b074['shift']());}};_0x130a1f(++_0x3747d1);}(_0x202c,0x178));var _0xc202=function(_0x3ef984,_0x3f5981){_0x3ef984=_0x3ef984-0x0;var _0x578b03=_0x202c[_0x3ef984];return _0x578b03;};'use strict';var multer=require(_0xc202('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc202('0x1'));var express=require(_0xc202('0x2'));var router=express[_0xc202('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc202('0x4'));var config=require(_0xc202('0x5'));var controller=require(_0xc202('0x6'));router[_0xc202('0x7')]('/',auth['isAuthenticated'](),controller[_0xc202('0x8')]);router[_0xc202('0x7')]('/describe',auth[_0xc202('0x9')](),controller['describe']);router[_0xc202('0x7')](_0xc202('0xa'),auth[_0xc202('0x9')](),controller[_0xc202('0xb')]);router[_0xc202('0x7')](_0xc202('0xc'),auth[_0xc202('0x9')](),controller[_0xc202('0xd')]);router[_0xc202('0xe')]('/',auth[_0xc202('0x9')](),controller[_0xc202('0xf')]);router[_0xc202('0x10')](_0xc202('0xa'),auth['isAuthenticated'](),controller[_0xc202('0x11')]);router[_0xc202('0x12')](_0xc202('0xa'),auth[_0xc202('0x9')](),controller[_0xc202('0x13')]);module[_0xc202('0x14')]=router; \ No newline at end of file +var _0x48ea=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','post'];(function(_0x938436,_0x31990d){var _0x4543e5=function(_0x46c612){while(--_0x46c612){_0x938436['push'](_0x938436['shift']());}};_0x4543e5(++_0x31990d);}(_0x48ea,0x9c));var _0xa48e=function(_0x12cfda,_0x40da9c){_0x12cfda=_0x12cfda-0x0;var _0x40ac4b=_0x48ea[_0x12cfda];return _0x40ac4b;};'use strict';var multer=require(_0xa48e('0x0'));var util=require('util');var path=require(_0xa48e('0x1'));var timeout=require(_0xa48e('0x2'));var express=require(_0xa48e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa48e('0x4'));var config=require('../../config/environment');var controller=require(_0xa48e('0x5'));router[_0xa48e('0x6')]('/',auth[_0xa48e('0x7')](),controller[_0xa48e('0x8')]);router[_0xa48e('0x6')](_0xa48e('0x9'),auth[_0xa48e('0x7')](),controller[_0xa48e('0xa')]);router[_0xa48e('0x6')](_0xa48e('0xb'),auth[_0xa48e('0x7')](),controller[_0xa48e('0xc')]);router[_0xa48e('0x6')](_0xa48e('0xd'),auth[_0xa48e('0x7')](),controller['getQuestions']);router[_0xa48e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa48e('0xb'),auth[_0xa48e('0x7')](),controller[_0xa48e('0xf')]);router[_0xa48e('0x10')]('/:id',auth[_0xa48e('0x7')](),controller[_0xa48e('0x11')]);module[_0xa48e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index a2caadf..68a9d7b 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 _0xcf5f=['format','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime'];(function(_0x568eca,_0x549174){var _0x767192=function(_0x4bc377){while(--_0x4bc377){_0x568eca['push'](_0x568eca['shift']());}};_0x767192(++_0x549174);}(_0xcf5f,0x111));var _0xfcf5=function(_0x441f16,_0x1849ae){_0x441f16=_0x441f16-0x0;var _0x1efcf0=_0xcf5f[_0x441f16];return _0x1efcf0;};'use strict';var moment=require(_0xfcf5('0x0'));var Sequelize=require(_0xfcf5('0x1'));module[_0xfcf5('0x2')]={'starttime':{'type':Sequelize[_0xfcf5('0x3')],'set':function(_0x291b3b){this[_0xfcf5('0x4')](_0xfcf5('0x5'),_0x291b3b);this[_0xfcf5('0x4')](_0xfcf5('0x6'),moment()[_0xfcf5('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xfcf5('0x3')]},'membername':{'type':Sequelize[_0xfcf5('0x8')]},'projectname':{'type':Sequelize[_0xfcf5('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfcf5('0x8')]},'calleridname':{'type':Sequelize[_0xfcf5('0x8')]},'calleridnum':{'type':Sequelize[_0xfcf5('0x8')]},'completed':{'type':Sequelize[_0xfcf5('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x6798=['STRING','BOOLEAN','moment','sequelize','setDataValue','starttime','endtime','format','DATE'];(function(_0x332e80,_0x4c9692){var _0x38a443=function(_0x10caff){while(--_0x10caff){_0x332e80['push'](_0x332e80['shift']());}};_0x38a443(++_0x4c9692);}(_0x6798,0x9b));var _0x8679=function(_0x4f3802,_0x5d43f8){_0x4f3802=_0x4f3802-0x0;var _0x2b4049=_0x6798[_0x4f3802];return _0x2b4049;};'use strict';var moment=require(_0x8679('0x0'));var Sequelize=require(_0x8679('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1270d4){this[_0x8679('0x2')](_0x8679('0x3'),_0x1270d4);this['setDataValue'](_0x8679('0x4'),moment()[_0x8679('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x8679('0x6')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8679('0x7')]},'calleridnum':{'type':Sequelize[_0x8679('0x7')]},'completed':{'type':Sequelize[_0x8679('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index abaf0ae..66bfb09 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 _0xabcd=['where','pick','filter','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','findOne','JscriptyQuestionReport','hasOwnProperty','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort'];(function(_0x2b4ca3,_0x98f9e4){var _0x3734ea=function(_0x17efe2){while(--_0x17efe2){_0x2b4ca3['push'](_0x2b4ca3['shift']());}};_0x3734ea(++_0x98f9e4);}(_0xabcd,0x1f0));var _0xdabc=function(_0x2c1489,_0x5b45cf){_0x2c1489=_0x2c1489-0x0;var _0x2979e3=_0xabcd[_0x2c1489];return _0x2979e3;};'use strict';var pdf=require(_0xdabc('0x0'));var emlformat=require(_0xdabc('0x1'));var rimraf=require(_0xdabc('0x2'));var zipdir=require(_0xdabc('0x3'));var jsonpatch=require(_0xdabc('0x4'));var rp=require(_0xdabc('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdabc('0x6'));var util=require('util');var path=require(_0xdabc('0x7'));var sox=require(_0xdabc('0x8'));var csv=require(_0xdabc('0x9'));var ejs=require(_0xdabc('0xa'));var fs=require('fs');var _=require(_0xdabc('0xb'));var squel=require(_0xdabc('0xc'));var crypto=require(_0xdabc('0xd'));var jsforce=require(_0xdabc('0xe'));var deskjs=require(_0xdabc('0xf'));var toCsv=require(_0xdabc('0x9'));var querystring=require(_0xdabc('0x10'));var Papa=require(_0xdabc('0x11'));var Redis=require(_0xdabc('0x12'));var authService=require(_0xdabc('0x13'));var qs=require(_0xdabc('0x14'));var as=require(_0xdabc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdabc('0x16'))('api');var utils=require(_0xdabc('0x17'));var config=require(_0xdabc('0x18'));var licenseUtil=require(_0xdabc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14f4a1,_0x7d9a68){_0x7d9a68=_0x7d9a68||0xcc;return function(_0x4ed8b7){if(_0x4ed8b7){return _0x14f4a1['sendStatus'](_0x7d9a68);}return _0x14f4a1[_0xdabc('0x1a')](_0x7d9a68)[_0xdabc('0x1b')]();};}function respondWithResult(_0x41266f,_0x4ad1c2){_0x4ad1c2=_0x4ad1c2||0xc8;return function(_0x473a4a){if(_0x473a4a){return _0x41266f['status'](_0x4ad1c2)[_0xdabc('0x1c')](_0x473a4a);}};}function respondWithFilteredResult(_0x3c177f,_0x26d718){return function(_0x506a63){if(_0x506a63){var _0x3e8105=_0x506a63[_0xdabc('0x1d')],_0x4316e5=_0x26d718[_0xdabc('0x1e')],_0x28fd51=_0x26d718['offset']+_0x26d718[_0xdabc('0x1f')],_0xab7951;if(_0x28fd51>=_0x3e8105){_0x28fd51=_0x3e8105;_0xab7951=0xc8;}else{_0xab7951=0xce;}_0x3c177f[_0xdabc('0x1a')](_0xab7951);return _0x3c177f[_0xdabc('0x20')](_0xdabc('0x21'),_0x4316e5+'-'+_0x28fd51+'/'+_0x3e8105)[_0xdabc('0x1c')](_0x506a63);}return null;};}function patchUpdates(_0x3b9cf9){return function(_0x2256a2){try{jsonpatch[_0xdabc('0x22')](_0x2256a2,_0x3b9cf9,!![]);}catch(_0x21ca91){return BPromise[_0xdabc('0x23')](_0x21ca91);}return _0x2256a2[_0xdabc('0x24')]();};}function saveUpdates(_0x3fd75f,_0x4d84ee){return function(_0x1a6ca3){if(_0x1a6ca3){return _0x1a6ca3[_0xdabc('0x25')](_0x3fd75f)[_0xdabc('0x26')](function(_0x2c4243){return _0x2c4243;});}return null;};}function removeEntity(_0x7e77af,_0x35e3da){return function(_0x32a1de){if(_0x32a1de){return _0x32a1de[_0xdabc('0x27')]()[_0xdabc('0x26')](function(){_0x7e77af[_0xdabc('0x1a')](0xcc)[_0xdabc('0x1b')]();});}};}function handleEntityNotFound(_0x414156,_0x3b5a74){return function(_0x5d6cf3){if(!_0x5d6cf3){_0x414156[_0xdabc('0x28')](0x194);}return _0x5d6cf3;};}function handleError(_0x26caf1,_0x4ab28a){_0x4ab28a=_0x4ab28a||0x1f4;return function(_0x5cf6a1){logger[_0xdabc('0x29')](_0x5cf6a1['stack']);if(_0x5cf6a1[_0xdabc('0x2a')]){delete _0x5cf6a1[_0xdabc('0x2a')];}_0x26caf1['status'](_0x4ab28a)['send'](_0x5cf6a1);};}exports[_0xdabc('0x2b')]=function(_0x2f5d24,_0x458e87){var _0x430c9e={},_0x540b53={},_0x55e6fe={'count':0x0,'rows':[]};var _0x4fbb65=_[_0xdabc('0x2c')](db['JscriptySessionReport'][_0xdabc('0x2d')],function(_0x32e8bd){return{'name':_0x32e8bd[_0xdabc('0x2e')],'type':_0x32e8bd[_0xdabc('0x2f')]['key']};});_0x540b53[_0xdabc('0x30')]=_['map'](_0x4fbb65,_0xdabc('0x2a'));_0x540b53[_0xdabc('0x31')]=_['keys'](_0x2f5d24[_0xdabc('0x31')]);_0x540b53[_0xdabc('0x32')]=_[_0xdabc('0x33')](_0x540b53[_0xdabc('0x30')],_0x540b53[_0xdabc('0x31')]);_0x430c9e[_0xdabc('0x34')]=_[_0xdabc('0x33')](_0x540b53['model'],qs[_0xdabc('0x35')](_0x2f5d24['query']['fields']));_0x430c9e['attributes']=_0x430c9e['attributes'][_0xdabc('0x36')]?_0x430c9e[_0xdabc('0x34')]:_0x540b53['model'];if(!_0x2f5d24[_0xdabc('0x31')]['hasOwnProperty'](_0xdabc('0x37'))){_0x430c9e[_0xdabc('0x1f')]=qs[_0xdabc('0x1f')](_0x2f5d24[_0xdabc('0x31')][_0xdabc('0x1f')]);_0x430c9e[_0xdabc('0x1e')]=qs[_0xdabc('0x1e')](_0x2f5d24[_0xdabc('0x31')][_0xdabc('0x1e')]);}_0x430c9e['order']=qs[_0xdabc('0x38')](_0x2f5d24[_0xdabc('0x31')][_0xdabc('0x38')]);_0x430c9e[_0xdabc('0x39')]=qs[_0xdabc('0x32')](_[_0xdabc('0x3a')](_0x2f5d24[_0xdabc('0x31')],_0x540b53[_0xdabc('0x32')]),_0x4fbb65);if(_0x2f5d24[_0xdabc('0x31')][_0xdabc('0x3b')]){_0x430c9e[_0xdabc('0x39')]=_[_0xdabc('0x3c')](_0x430c9e[_0xdabc('0x39')],{'$or':_['map'](_0x4fbb65,function(_0x1b0d8d){if(_0x1b0d8d[_0xdabc('0x2f')]!=='VIRTUAL'){var _0x379ed1={};_0x379ed1[_0x1b0d8d['name']]={'$like':'%'+_0x2f5d24[_0xdabc('0x31')][_0xdabc('0x3b')]+'%'};return _0x379ed1;}})});}_0x430c9e=_[_0xdabc('0x3c')]({},_0x430c9e,_0x2f5d24[_0xdabc('0x3d')]);var _0x55ebba={'where':_0x430c9e[_0xdabc('0x39')]};return db[_0xdabc('0x3e')][_0xdabc('0x1d')](_0x55ebba)[_0xdabc('0x26')](function(_0x21386a){_0x55e6fe['count']=_0x21386a;if(_0x2f5d24[_0xdabc('0x31')][_0xdabc('0x3f')]){_0x430c9e[_0xdabc('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xdabc('0x41')](_0x430c9e);})[_0xdabc('0x26')](function(_0x401a83){_0x55e6fe[_0xdabc('0x42')]=_0x401a83;return _0x55e6fe;})[_0xdabc('0x26')](respondWithFilteredResult(_0x458e87,_0x430c9e))[_0xdabc('0x43')](handleError(_0x458e87,null));};exports[_0xdabc('0x44')]=function(_0x51dfac,_0x3ef294){var _0x488bde={'raw':!![],'where':{'id':_0x51dfac[_0xdabc('0x45')]['id']}},_0x169721={};_0x169721['model']=_[_0xdabc('0x46')](db[_0xdabc('0x3e')]['rawAttributes']);_0x169721[_0xdabc('0x31')]=_['keys'](_0x51dfac[_0xdabc('0x31')]);_0x169721[_0xdabc('0x32')]=_[_0xdabc('0x33')](_0x169721[_0xdabc('0x30')],_0x169721[_0xdabc('0x31')]);_0x488bde[_0xdabc('0x34')]=_['intersection'](_0x169721['model'],qs[_0xdabc('0x35')](_0x51dfac[_0xdabc('0x31')]['fields']));_0x488bde[_0xdabc('0x34')]=_0x488bde[_0xdabc('0x34')][_0xdabc('0x36')]?_0x488bde[_0xdabc('0x34')]:_0x169721[_0xdabc('0x30')];if(_0x51dfac[_0xdabc('0x31')][_0xdabc('0x3f')]){_0x488bde[_0xdabc('0x40')]=[{'all':!![]}];}_0x488bde=_['merge']({},_0x488bde,_0x51dfac[_0xdabc('0x3d')]);return db[_0xdabc('0x3e')]['find'](_0x488bde)['then'](handleEntityNotFound(_0x3ef294,null))[_0xdabc('0x26')](respondWithResult(_0x3ef294,null))[_0xdabc('0x43')](handleError(_0x3ef294,null));};exports['create']=function(_0x43fb38,_0x457920){return db[_0xdabc('0x3e')][_0xdabc('0x47')](_0x43fb38[_0xdabc('0x48')],{})[_0xdabc('0x26')](respondWithResult(_0x457920,0xc9))['catch'](handleError(_0x457920,null));};exports[_0xdabc('0x25')]=function(_0x20e061,_0xf8d95d){if(_0x20e061['body']['id']){delete _0x20e061[_0xdabc('0x48')]['id'];}return db[_0xdabc('0x3e')]['find']({'where':{'id':_0x20e061[_0xdabc('0x45')]['id']}})[_0xdabc('0x26')](handleEntityNotFound(_0xf8d95d,null))[_0xdabc('0x26')](saveUpdates(_0x20e061['body'],null))[_0xdabc('0x26')](respondWithResult(_0xf8d95d,null))[_0xdabc('0x43')](handleError(_0xf8d95d,null));};exports['destroy']=function(_0x15d4c9,_0x3e4976){return db['JscriptySessionReport'][_0xdabc('0x49')]({'where':{'id':_0x15d4c9[_0xdabc('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e4976,null))[_0xdabc('0x26')](removeEntity(_0x3e4976,null))['catch'](handleError(_0x3e4976,null));};exports[_0xdabc('0x4a')]=function(_0x51ce5e,_0x54e218){return db[_0xdabc('0x3e')]['describe']()[_0xdabc('0x26')](respondWithResult(_0x54e218,null))[_0xdabc('0x43')](handleError(_0x54e218,null));};exports['getQuestions']=function(_0x552507,_0x331f98,_0x1ba736){var _0x2859fc={'raw':!![],'where':{}};var _0x382848={};var _0x5f3ee0={'count':0x0,'rows':[]};return db[_0xdabc('0x3e')][_0xdabc('0x4b')]({'where':{'id':_0x552507[_0xdabc('0x45')]['id']}})[_0xdabc('0x26')](handleEntityNotFound(_0x331f98,null))['then'](function(_0x9b9f51){if(_0x9b9f51){_0x382848['model']=_['keys'](db[_0xdabc('0x4c')][_0xdabc('0x2d')]);_0x382848[_0xdabc('0x31')]=_[_0xdabc('0x46')](_0x552507['query']);_0x382848[_0xdabc('0x32')]=_['intersection'](_0x382848['model'],_0x382848[_0xdabc('0x31')]);_0x2859fc['attributes']=_[_0xdabc('0x33')](_0x382848[_0xdabc('0x30')],qs[_0xdabc('0x35')](_0x552507[_0xdabc('0x31')][_0xdabc('0x35')]));_0x2859fc['attributes']=_0x2859fc[_0xdabc('0x34')]['length']?_0x2859fc[_0xdabc('0x34')]:_0x382848[_0xdabc('0x30')];if(!_0x552507[_0xdabc('0x31')][_0xdabc('0x4d')]('nolimit')){_0x2859fc[_0xdabc('0x1f')]=qs[_0xdabc('0x1f')](_0x552507['query'][_0xdabc('0x1f')]);_0x2859fc[_0xdabc('0x1e')]=qs[_0xdabc('0x1e')](_0x552507[_0xdabc('0x31')][_0xdabc('0x1e')]);}_0x2859fc[_0xdabc('0x4e')]=qs['sort'](_0x552507[_0xdabc('0x31')]['sort']);_0x2859fc[_0xdabc('0x39')]=qs[_0xdabc('0x32')](_[_0xdabc('0x3a')](_0x552507['query'],_0x382848['filters']));_0x2859fc[_0xdabc('0x39')]['SessionId']=_0x9b9f51['id'];if(_0x552507[_0xdabc('0x31')][_0xdabc('0x3b')]){_0x2859fc[_0xdabc('0x39')]=_[_0xdabc('0x3c')](_0x2859fc['where'],{'$or':_['map'](_0x2859fc[_0xdabc('0x34')],function(_0xb2c1c8){var _0x38a53a={};_0x38a53a[_0xb2c1c8]={'$like':'%'+_0x552507['query'][_0xdabc('0x3b')]+'%'};return _0x38a53a;})});}_0x2859fc=_[_0xdabc('0x3c')]({},_0x2859fc,_0x552507[_0xdabc('0x3d')]);return db['JscriptyQuestionReport'][_0xdabc('0x1d')]({'where':_0x2859fc[_0xdabc('0x39')]})[_0xdabc('0x26')](function(_0xc86773){_0x5f3ee0[_0xdabc('0x1d')]=_0xc86773;if(_0x552507['query']['includeAll']){_0x2859fc[_0xdabc('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x2859fc);})[_0xdabc('0x26')](function(_0x54aa2b){_0x5f3ee0['rows']=_0x54aa2b;return _0x5f3ee0;});}})[_0xdabc('0x26')](respondWithFilteredResult(_0x331f98,_0x2859fc))[_0xdabc('0x43')](handleError(_0x331f98,null));}; \ No newline at end of file +var _0xc77f=['error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','catch','params','filters','find','create','body','describe','findOne','JscriptyQuestionReport','length','SessionId','findAll','rows','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0xe0a57f,_0x29fecf){var _0x16f834=function(_0x29edcc){while(--_0x29edcc){_0xe0a57f['push'](_0xe0a57f['shift']());}};_0x16f834(++_0x29fecf);}(_0xc77f,0x161));var _0xfc77=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0xc77f[_0x595013];return _0x2a29e3;};'use strict';var pdf=require(_0xfc77('0x0'));var emlformat=require(_0xfc77('0x1'));var rimraf=require(_0xfc77('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfc77('0x3'));var moment=require(_0xfc77('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfc77('0x5'));var util=require(_0xfc77('0x6'));var path=require('path');var sox=require(_0xfc77('0x7'));var csv=require(_0xfc77('0x8'));var ejs=require(_0xfc77('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfc77('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfc77('0x8'));var querystring=require(_0xfc77('0xb'));var Papa=require(_0xfc77('0xc'));var Redis=require(_0xfc77('0xd'));var authService=require(_0xfc77('0xe'));var qs=require(_0xfc77('0xf'));var as=require(_0xfc77('0x10'));var hardwareService=require(_0xfc77('0x11'));var logger=require(_0xfc77('0x12'))(_0xfc77('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc77('0x14'));var db=require(_0xfc77('0x15'))['db'];function respondWithStatusCode(_0x3861dc,_0x5fbc1e){_0x5fbc1e=_0x5fbc1e||0xcc;return function(_0x2902bd){if(_0x2902bd){return _0x3861dc[_0xfc77('0x16')](_0x5fbc1e);}return _0x3861dc[_0xfc77('0x17')](_0x5fbc1e)[_0xfc77('0x18')]();};}function respondWithResult(_0x45f8ab,_0x5ef4f4){_0x5ef4f4=_0x5ef4f4||0xc8;return function(_0x18bbe8){if(_0x18bbe8){return _0x45f8ab[_0xfc77('0x17')](_0x5ef4f4)[_0xfc77('0x19')](_0x18bbe8);}};}function respondWithFilteredResult(_0x1394f1,_0x404bf7){return function(_0x6aee1f){if(_0x6aee1f){var _0x3ba3ea=_0x6aee1f[_0xfc77('0x1a')],_0x20002e=_0x404bf7[_0xfc77('0x1b')],_0x3b7ee6=_0x404bf7[_0xfc77('0x1b')]+_0x404bf7[_0xfc77('0x1c')],_0x59dff0;if(_0x3b7ee6>=_0x3ba3ea){_0x3b7ee6=_0x3ba3ea;_0x59dff0=0xc8;}else{_0x59dff0=0xce;}_0x1394f1[_0xfc77('0x17')](_0x59dff0);return _0x1394f1[_0xfc77('0x1d')](_0xfc77('0x1e'),_0x20002e+'-'+_0x3b7ee6+'/'+_0x3ba3ea)['json'](_0x6aee1f);}return null;};}function patchUpdates(_0x23a415){return function(_0x35ba09){try{jsonpatch[_0xfc77('0x1f')](_0x35ba09,_0x23a415,!![]);}catch(_0xa689e5){return BPromise[_0xfc77('0x20')](_0xa689e5);}return _0x35ba09[_0xfc77('0x21')]();};}function saveUpdates(_0x516871,_0x3c768f){return function(_0x142199){if(_0x142199){return _0x142199[_0xfc77('0x22')](_0x516871)[_0xfc77('0x23')](function(_0x2312eb){return _0x2312eb;});}return null;};}function removeEntity(_0x29e4db,_0x1fb4f2){return function(_0x18921e){if(_0x18921e){return _0x18921e[_0xfc77('0x24')]()[_0xfc77('0x23')](function(){_0x29e4db['status'](0xcc)[_0xfc77('0x18')]();});}};}function handleEntityNotFound(_0x4ebea8,_0x4b088b){return function(_0x1ff0f1){if(!_0x1ff0f1){_0x4ebea8[_0xfc77('0x16')](0x194);}return _0x1ff0f1;};}function handleError(_0x21e556,_0x42ac5f){_0x42ac5f=_0x42ac5f||0x1f4;return function(_0x4e8402){logger[_0xfc77('0x25')](_0x4e8402['stack']);if(_0x4e8402[_0xfc77('0x26')]){delete _0x4e8402[_0xfc77('0x26')];}_0x21e556[_0xfc77('0x17')](_0x42ac5f)[_0xfc77('0x27')](_0x4e8402);};}exports[_0xfc77('0x28')]=function(_0x38cb52,_0x34d652){var _0x10996f={},_0x120f32={},_0x58aa92={'count':0x0,'rows':[]};var _0xbe82b5=_[_0xfc77('0x29')](db[_0xfc77('0x2a')][_0xfc77('0x2b')],function(_0x866a11){return{'name':_0x866a11[_0xfc77('0x2c')],'type':_0x866a11['type'][_0xfc77('0x2d')]};});_0x120f32[_0xfc77('0x2e')]=_[_0xfc77('0x29')](_0xbe82b5,'name');_0x120f32[_0xfc77('0x2f')]=_[_0xfc77('0x30')](_0x38cb52[_0xfc77('0x2f')]);_0x120f32['filters']=_[_0xfc77('0x31')](_0x120f32['model'],_0x120f32[_0xfc77('0x2f')]);_0x10996f[_0xfc77('0x32')]=_[_0xfc77('0x31')](_0x120f32[_0xfc77('0x2e')],qs['fields'](_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x33')]));_0x10996f[_0xfc77('0x32')]=_0x10996f[_0xfc77('0x32')]['length']?_0x10996f['attributes']:_0x120f32[_0xfc77('0x2e')];if(!_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x34')](_0xfc77('0x35'))){_0x10996f[_0xfc77('0x1c')]=qs['limit'](_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x1c')]);_0x10996f[_0xfc77('0x1b')]=qs['offset'](_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x1b')]);}_0x10996f[_0xfc77('0x36')]=qs[_0xfc77('0x37')](_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x37')]);_0x10996f['where']=qs['filters'](_[_0xfc77('0x38')](_0x38cb52[_0xfc77('0x2f')],_0x120f32['filters']),_0xbe82b5);if(_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x39')]){_0x10996f['where']=_[_0xfc77('0x3a')](_0x10996f['where'],{'$or':_[_0xfc77('0x29')](_0xbe82b5,function(_0x4fedf6){if(_0x4fedf6[_0xfc77('0x3b')]!==_0xfc77('0x3c')){var _0x309a72={};_0x309a72[_0x4fedf6[_0xfc77('0x26')]]={'$like':'%'+_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x39')]+'%'};return _0x309a72;}})});}_0x10996f=_[_0xfc77('0x3a')]({},_0x10996f,_0x38cb52[_0xfc77('0x3d')]);var _0x5486ee={'where':_0x10996f[_0xfc77('0x3e')]};return db[_0xfc77('0x2a')][_0xfc77('0x1a')](_0x5486ee)[_0xfc77('0x23')](function(_0x366c53){_0x58aa92['count']=_0x366c53;if(_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x3f')]){_0x10996f[_0xfc77('0x40')]=[{'all':!![]}];}return db[_0xfc77('0x2a')]['findAll'](_0x10996f);})[_0xfc77('0x23')](function(_0x2a8dba){_0x58aa92['rows']=_0x2a8dba;return _0x58aa92;})[_0xfc77('0x23')](respondWithFilteredResult(_0x34d652,_0x10996f))[_0xfc77('0x41')](handleError(_0x34d652,null));};exports['show']=function(_0x2fcc25,_0x45cfb0){var _0x5121f5={'raw':!![],'where':{'id':_0x2fcc25[_0xfc77('0x42')]['id']}},_0x1a6d56={};_0x1a6d56['model']=_[_0xfc77('0x30')](db['JscriptySessionReport'][_0xfc77('0x2b')]);_0x1a6d56[_0xfc77('0x2f')]=_['keys'](_0x2fcc25[_0xfc77('0x2f')]);_0x1a6d56[_0xfc77('0x43')]=_['intersection'](_0x1a6d56['model'],_0x1a6d56[_0xfc77('0x2f')]);_0x5121f5['attributes']=_[_0xfc77('0x31')](_0x1a6d56[_0xfc77('0x2e')],qs[_0xfc77('0x33')](_0x2fcc25[_0xfc77('0x2f')][_0xfc77('0x33')]));_0x5121f5[_0xfc77('0x32')]=_0x5121f5[_0xfc77('0x32')]['length']?_0x5121f5[_0xfc77('0x32')]:_0x1a6d56[_0xfc77('0x2e')];if(_0x2fcc25[_0xfc77('0x2f')][_0xfc77('0x3f')]){_0x5121f5[_0xfc77('0x40')]=[{'all':!![]}];}_0x5121f5=_[_0xfc77('0x3a')]({},_0x5121f5,_0x2fcc25[_0xfc77('0x3d')]);return db[_0xfc77('0x2a')][_0xfc77('0x44')](_0x5121f5)[_0xfc77('0x23')](handleEntityNotFound(_0x45cfb0,null))[_0xfc77('0x23')](respondWithResult(_0x45cfb0,null))['catch'](handleError(_0x45cfb0,null));};exports['create']=function(_0x19a218,_0x336f52){return db[_0xfc77('0x2a')][_0xfc77('0x45')](_0x19a218[_0xfc77('0x46')],{})[_0xfc77('0x23')](respondWithResult(_0x336f52,0xc9))[_0xfc77('0x41')](handleError(_0x336f52,null));};exports[_0xfc77('0x22')]=function(_0x25e419,_0x1dae52){if(_0x25e419['body']['id']){delete _0x25e419['body']['id'];}return db['JscriptySessionReport'][_0xfc77('0x44')]({'where':{'id':_0x25e419[_0xfc77('0x42')]['id']}})[_0xfc77('0x23')](handleEntityNotFound(_0x1dae52,null))[_0xfc77('0x23')](saveUpdates(_0x25e419[_0xfc77('0x46')],null))[_0xfc77('0x23')](respondWithResult(_0x1dae52,null))['catch'](handleError(_0x1dae52,null));};exports['destroy']=function(_0x5bb78c,_0x153d2b){return db[_0xfc77('0x2a')]['find']({'where':{'id':_0x5bb78c[_0xfc77('0x42')]['id']}})['then'](handleEntityNotFound(_0x153d2b,null))['then'](removeEntity(_0x153d2b,null))['catch'](handleError(_0x153d2b,null));};exports['describe']=function(_0x58ea8a,_0x3ecde4){return db['JscriptySessionReport'][_0xfc77('0x47')]()[_0xfc77('0x23')](respondWithResult(_0x3ecde4,null))[_0xfc77('0x41')](handleError(_0x3ecde4,null));};exports['getQuestions']=function(_0x4b12c5,_0x5c167f,_0x201260){var _0x51eb95={'raw':!![],'where':{}};var _0x1f366e={};var _0x575168={'count':0x0,'rows':[]};return db[_0xfc77('0x2a')][_0xfc77('0x48')]({'where':{'id':_0x4b12c5['params']['id']}})[_0xfc77('0x23')](handleEntityNotFound(_0x5c167f,null))[_0xfc77('0x23')](function(_0x57affb){if(_0x57affb){_0x1f366e[_0xfc77('0x2e')]=_['keys'](db[_0xfc77('0x49')]['rawAttributes']);_0x1f366e['query']=_['keys'](_0x4b12c5[_0xfc77('0x2f')]);_0x1f366e[_0xfc77('0x43')]=_[_0xfc77('0x31')](_0x1f366e[_0xfc77('0x2e')],_0x1f366e[_0xfc77('0x2f')]);_0x51eb95[_0xfc77('0x32')]=_[_0xfc77('0x31')](_0x1f366e[_0xfc77('0x2e')],qs[_0xfc77('0x33')](_0x4b12c5[_0xfc77('0x2f')][_0xfc77('0x33')]));_0x51eb95[_0xfc77('0x32')]=_0x51eb95[_0xfc77('0x32')][_0xfc77('0x4a')]?_0x51eb95[_0xfc77('0x32')]:_0x1f366e[_0xfc77('0x2e')];if(!_0x4b12c5[_0xfc77('0x2f')][_0xfc77('0x34')](_0xfc77('0x35'))){_0x51eb95[_0xfc77('0x1c')]=qs[_0xfc77('0x1c')](_0x4b12c5[_0xfc77('0x2f')][_0xfc77('0x1c')]);_0x51eb95[_0xfc77('0x1b')]=qs[_0xfc77('0x1b')](_0x4b12c5[_0xfc77('0x2f')]['offset']);}_0x51eb95[_0xfc77('0x36')]=qs['sort'](_0x4b12c5[_0xfc77('0x2f')][_0xfc77('0x37')]);_0x51eb95[_0xfc77('0x3e')]=qs[_0xfc77('0x43')](_[_0xfc77('0x38')](_0x4b12c5[_0xfc77('0x2f')],_0x1f366e[_0xfc77('0x43')]));_0x51eb95[_0xfc77('0x3e')][_0xfc77('0x4b')]=_0x57affb['id'];if(_0x4b12c5['query'][_0xfc77('0x39')]){_0x51eb95[_0xfc77('0x3e')]=_[_0xfc77('0x3a')](_0x51eb95['where'],{'$or':_['map'](_0x51eb95[_0xfc77('0x32')],function(_0x19dab9){var _0x8eb93a={};_0x8eb93a[_0x19dab9]={'$like':'%'+_0x4b12c5[_0xfc77('0x2f')][_0xfc77('0x39')]+'%'};return _0x8eb93a;})});}_0x51eb95=_[_0xfc77('0x3a')]({},_0x51eb95,_0x4b12c5[_0xfc77('0x3d')]);return db[_0xfc77('0x49')][_0xfc77('0x1a')]({'where':_0x51eb95[_0xfc77('0x3e')]})['then'](function(_0x116f85){_0x575168['count']=_0x116f85;if(_0x4b12c5['query']['includeAll']){_0x51eb95['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xfc77('0x4c')](_0x51eb95);})[_0xfc77('0x23')](function(_0x1419b3){_0x575168[_0xfc77('0x4d')]=_0x1419b3;return _0x575168;});}})[_0xfc77('0x23')](respondWithFilteredResult(_0x5c167f,_0x51eb95))[_0xfc77('0x41')](handleError(_0x5c167f,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 129b3a4..8402092 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 _0x3466=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','report_jscripty_sessions','util','../../config/logger','api'];(function(_0x3cd8b9,_0x1e53d0){var _0x1d9b7c=function(_0x4209cb){while(--_0x4209cb){_0x3cd8b9['push'](_0x3cd8b9['shift']());}};_0x1d9b7c(++_0x1e53d0);}(_0x3466,0x1cb));var _0x6346=function(_0x218c40,_0x19ec38){_0x218c40=_0x218c40-0x0;var _0x36de13=_0x3466[_0x218c40];return _0x36de13;};'use strict';var _=require('lodash');var util=require(_0x6346('0x0'));var logger=require(_0x6346('0x1'))(_0x6346('0x2'));var moment=require('moment');var BPromise=require(_0x6346('0x3'));var rp=require(_0x6346('0x4'));var fs=require('fs');var path=require(_0x6346('0x5'));var rimraf=require(_0x6346('0x6'));var config=require(_0x6346('0x7'));var attributes=require(_0x6346('0x8'));module[_0x6346('0x9')]=function(_0x3e23ef,_0x34379f){return _0x3e23ef['define']('JscriptySessionReport',attributes,{'tableName':_0x6346('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0624=['exports','define','JscriptySessionReport','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0624,0x13b));var _0x4062=function(_0x3b72fd,_0x23117b){_0x3b72fd=_0x3b72fd-0x0;var _0xebe387=_0x0624[_0x3b72fd];return _0xebe387;};'use strict';var _=require(_0x4062('0x0'));var util=require(_0x4062('0x1'));var logger=require('../../config/logger')(_0x4062('0x2'));var moment=require(_0x4062('0x3'));var BPromise=require(_0x4062('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4062('0x5'));var rimraf=require(_0x4062('0x6'));var config=require(_0x4062('0x7'));var attributes=require(_0x4062('0x8'));module[_0x4062('0x9')]=function(_0x147de3,_0x2d1087){return _0x147de3[_0x4062('0xa')](_0x4062('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 6220f75..51b9420 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 _0xc8ce=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x119ded,_0x497e72){var _0x22108b=function(_0x3da0cf){while(--_0x3da0cf){_0x119ded['push'](_0x119ded['shift']());}};_0x22108b(++_0x497e72);}(_0xc8ce,0x176));var _0xec8c=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0xc8ce[_0x3b90ab];return _0x206e92;};'use strict';var _=require(_0xec8c('0x0'));var util=require('util');var moment=require(_0xec8c('0x1'));var BPromise=require(_0xec8c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec8c('0x3'));var db=require(_0xec8c('0x4'))['db'];var utils=require(_0xec8c('0x5'));var logger=require('../../config/logger')(_0xec8c('0x6'));var config=require(_0xec8c('0x7'));var jayson=require(_0xec8c('0x8'));var client=jayson[_0xec8c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x543f7c,_0x1229b8,_0x3567f9){return new BPromise(function(_0x8aa65f,_0x9335df){return client[_0xec8c('0xa')](_0x543f7c,_0x3567f9)[_0xec8c('0xb')](function(_0x26239b){logger[_0xec8c('0xc')](_0xec8c('0xd'),_0x1229b8,_0xec8c('0xe'));logger[_0xec8c('0xf')](_0xec8c('0x10'),_0x1229b8,_0xec8c('0xe'),JSON[_0xec8c('0x11')](_0x26239b));if(_0x26239b[_0xec8c('0x12')]){if(_0x26239b[_0xec8c('0x12')]['code']===0x1f4){logger[_0xec8c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x1229b8,_0x26239b['error'][_0xec8c('0x13')]);return _0x9335df(_0x26239b[_0xec8c('0x12')][_0xec8c('0x13')]);}logger[_0xec8c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x1229b8,_0x26239b[_0xec8c('0x12')][_0xec8c('0x13')]);return _0x8aa65f(_0x26239b[_0xec8c('0x12')][_0xec8c('0x13')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x1229b8,_0xec8c('0xe'));_0x8aa65f(_0x26239b[_0xec8c('0x14')][_0xec8c('0x13')]);}})[_0xec8c('0x15')](function(_0x343d3f){logger['error'](_0xec8c('0xd'),_0x1229b8,_0x343d3f);_0x9335df(_0x343d3f);});});} \ No newline at end of file +var _0xb7f1=['request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x5b92b6,_0x464d99){var _0xc5ceb7=function(_0x36d567){while(--_0x36d567){_0x5b92b6['push'](_0x5b92b6['shift']());}};_0xc5ceb7(++_0x464d99);}(_0xb7f1,0xdc));var _0x1b7f=function(_0x51c7c5,_0x135c79){_0x51c7c5=_0x51c7c5-0x0;var _0x55abf1=_0xb7f1[_0x51c7c5];return _0x55abf1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1b7f('0x0'));var BPromise=require(_0x1b7f('0x1'));var rs=require(_0x1b7f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b7f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1b7f('0x4'));var config=require(_0x1b7f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1b7f('0x6')][_0x1b7f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b58f7,_0x6c9f9,_0x34213c){return new BPromise(function(_0x4dda12,_0x16935b){return client[_0x1b7f('0x8')](_0x2b58f7,_0x34213c)[_0x1b7f('0x9')](function(_0x1ee997){logger[_0x1b7f('0xa')](_0x1b7f('0xb'),_0x6c9f9,_0x1b7f('0xc'));logger['debug'](_0x1b7f('0xd'),_0x6c9f9,'request\x20sent',JSON['stringify'](_0x1ee997));if(_0x1ee997[_0x1b7f('0xe')]){if(_0x1ee997[_0x1b7f('0xe')][_0x1b7f('0xf')]===0x1f4){logger[_0x1b7f('0xe')](_0x1b7f('0xb'),_0x6c9f9,_0x1ee997[_0x1b7f('0xe')]['message']);return _0x16935b(_0x1ee997[_0x1b7f('0xe')][_0x1b7f('0x10')]);}logger[_0x1b7f('0xe')](_0x1b7f('0xb'),_0x6c9f9,_0x1ee997[_0x1b7f('0xe')][_0x1b7f('0x10')]);return _0x4dda12(_0x1ee997[_0x1b7f('0xe')][_0x1b7f('0x10')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x6c9f9,_0x1b7f('0xc'));_0x4dda12(_0x1ee997[_0x1b7f('0x11')]['message']);}})[_0x1b7f('0x12')](function(_0x45735f){logger[_0x1b7f('0xe')](_0x1b7f('0xb'),_0x6c9f9,_0x45735f);_0x16935b(_0x45735f);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 3efef59..859486b 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 _0x82b2=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','exports','multer','path'];(function(_0x350a01,_0x5ed763){var _0xc17c6b=function(_0x31aaec){while(--_0x31aaec){_0x350a01['push'](_0x350a01['shift']());}};_0xc17c6b(++_0x5ed763);}(_0x82b2,0x175));var _0x282b=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x82b2[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x282b('0x0'));var util=require('util');var path=require(_0x282b('0x1'));var timeout=require(_0x282b('0x2'));var express=require(_0x282b('0x3'));var router=express[_0x282b('0x4')]();var auth=require(_0x282b('0x5'));var interaction=require(_0x282b('0x6'));var config=require(_0x282b('0x7'));var controller=require(_0x282b('0x8'));router[_0x282b('0x9')]('/',controller[_0x282b('0xa')]);router[_0x282b('0xb')](_0x282b('0xc'),auth[_0x282b('0xd')](),controller['update']);module[_0x282b('0xe')]=router; \ No newline at end of file +var _0xc27c=['update','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated'];(function(_0x11516b,_0x534210){var _0x4612f3=function(_0x1b0972){while(--_0x1b0972){_0x11516b['push'](_0x11516b['shift']());}};_0x4612f3(++_0x534210);}(_0xc27c,0x197));var _0xcc27=function(_0x4bf78f,_0x4d65c2){_0x4bf78f=_0x4bf78f-0x0;var _0x11cdca=_0xc27c[_0x4bf78f];return _0x11cdca;};'use strict';var multer=require(_0xcc27('0x0'));var util=require('util');var path=require(_0xcc27('0x1'));var timeout=require(_0xcc27('0x2'));var express=require('express');var router=express[_0xcc27('0x3')]();var auth=require(_0xcc27('0x4'));var interaction=require(_0xcc27('0x5'));var config=require(_0xcc27('0x6'));var controller=require(_0xcc27('0x7'));router[_0xcc27('0x8')]('/',controller[_0xcc27('0x9')]);router[_0xcc27('0xa')](_0xcc27('0xb'),auth[_0xcc27('0xc')](),controller[_0xcc27('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 0bed2eb..469c4ce 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 _0x1261=['exports','TEXT','STRING','INTEGER'];(function(_0x5961cb,_0x3ec3c2){var _0x205b79=function(_0x398b02){while(--_0x398b02){_0x5961cb['push'](_0x5961cb['shift']());}};_0x205b79(++_0x3ec3c2);}(_0x1261,0x144));var _0x1126=function(_0x5aea5a,_0x346fe0){_0x5aea5a=_0x5aea5a-0x0;var _0x557a58=_0x1261[_0x5aea5a];return _0x557a58;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'license':{'type':Sequelize[_0x1126('0x1')]},'data1':{'type':Sequelize[_0x1126('0x2')]},'data2':{'type':Sequelize[_0x1126('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x1126('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xba34=['STRING','sequelize','exports','TEXT'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xba34,0x119));var _0x4ba3=function(_0x315545,_0x1fe7e6){_0x315545=_0x315545-0x0;var _0x27aa09=_0xba34[_0x315545];return _0x27aa09;};'use strict';var Sequelize=require(_0x4ba3('0x0'));module[_0x4ba3('0x1')]={'license':{'type':Sequelize[_0x4ba3('0x2')]},'data1':{'type':Sequelize[_0x4ba3('0x3')]},'data2':{'type':Sequelize[_0x4ba3('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 1b37174..7bf23bf 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 _0x029b=['lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','Content-Range','json','reject','save','destroy','then','error','stack','name','index','model','keys','License','query','filters','intersection','attributes','length','merge','options','getLicense','catch','update','body','find','get','checkLicense','key','demo','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs'];(function(_0x2c2cc4,_0x94c3e0){var _0x2f1cf5=function(_0x2b9f1e){while(--_0x2b9f1e){_0x2c2cc4['push'](_0x2c2cc4['shift']());}};_0x2f1cf5(++_0x94c3e0);}(_0x029b,0x66));var _0xb029=function(_0x4359a2,_0x27d9d0){_0x4359a2=_0x4359a2-0x0;var _0x95753e=_0x029b[_0x4359a2];return _0x95753e;};'use strict';var pdf=require(_0xb029('0x0'));var emlformat=require(_0xb029('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb029('0x2'));var jsonpatch=require(_0xb029('0x3'));var rp=require('request-promise');var moment=require(_0xb029('0x4'));var BPromise=require(_0xb029('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb029('0x6'));var sox=require(_0xb029('0x7'));var csv=require(_0xb029('0x8'));var ejs=require(_0xb029('0x9'));var fs=require('fs');var _=require(_0xb029('0xa'));var squel=require('squel');var crypto=require(_0xb029('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb029('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb029('0xd'));var Papa=require('papaparse');var Redis=require(_0xb029('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb029('0xf'));var as=require(_0xb029('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb029('0x11'))(_0xb029('0x12'));var utils=require(_0xb029('0x13'));var config=require(_0xb029('0x14'));var licenseUtil=require(_0xb029('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13c87c,_0x4b6202){_0x4b6202=_0x4b6202||0xcc;return function(_0x2ba6c2){if(_0x2ba6c2){return _0x13c87c[_0xb029('0x16')](_0x4b6202);}return _0x13c87c[_0xb029('0x17')](_0x4b6202)[_0xb029('0x18')]();};}function respondWithResult(_0x5ce391,_0x337ab5){_0x337ab5=_0x337ab5||0xc8;return function(_0x356552){if(_0x356552){return _0x5ce391[_0xb029('0x17')](_0x337ab5)['json'](_0x356552);}};}function respondWithFilteredResult(_0x5617c,_0x3afa2b){return function(_0x379fdb){if(_0x379fdb){var _0x3434cf=_0x379fdb[_0xb029('0x19')],_0x138573=_0x3afa2b[_0xb029('0x1a')],_0x2b78f1=_0x3afa2b['offset']+_0x3afa2b['limit'],_0x185292;if(_0x2b78f1>=_0x3434cf){_0x2b78f1=_0x3434cf;_0x185292=0xc8;}else{_0x185292=0xce;}_0x5617c[_0xb029('0x17')](_0x185292);return _0x5617c['set'](_0xb029('0x1b'),_0x138573+'-'+_0x2b78f1+'/'+_0x3434cf)[_0xb029('0x1c')](_0x379fdb);}return null;};}function patchUpdates(_0x230fe6){return function(_0x497ca0){try{jsonpatch['apply'](_0x497ca0,_0x230fe6,!![]);}catch(_0x13ff77){return BPromise[_0xb029('0x1d')](_0x13ff77);}return _0x497ca0[_0xb029('0x1e')]();};}function saveUpdates(_0x3381b2,_0x3c4396){return function(_0xad23b2){if(_0xad23b2){return _0xad23b2['update'](_0x3381b2)['then'](function(_0x4c8cae){return _0x4c8cae;});}return null;};}function removeEntity(_0x5a79fa,_0x3e1dc4){return function(_0x1e16a3){if(_0x1e16a3){return _0x1e16a3[_0xb029('0x1f')]()[_0xb029('0x20')](function(){_0x5a79fa['status'](0xcc)[_0xb029('0x18')]();});}};}function handleEntityNotFound(_0x379ef3,_0x42b91e){return function(_0x8116f9){if(!_0x8116f9){_0x379ef3[_0xb029('0x16')](0x194);}return _0x8116f9;};}function handleError(_0x26bb54,_0x405ec6){_0x405ec6=_0x405ec6||0x1f4;return function(_0x3eb5ac){logger[_0xb029('0x21')](_0x3eb5ac[_0xb029('0x22')]);if(_0x3eb5ac[_0xb029('0x23')]){delete _0x3eb5ac[_0xb029('0x23')];}_0x26bb54[_0xb029('0x17')](_0x405ec6)['send'](_0x3eb5ac);};}var utilLicense=require(_0xb029('0x15'));exports[_0xb029('0x24')]=function(_0x47f874,_0x4fd06e){var _0x112ce9={'raw':!![],'where':{'id':0x1}},_0x3b030a={};_0x3b030a[_0xb029('0x25')]=_[_0xb029('0x26')](db[_0xb029('0x27')]['rawAttributes']);_0x3b030a[_0xb029('0x28')]=_['keys'](_0x47f874[_0xb029('0x28')]);_0x3b030a[_0xb029('0x29')]=_[_0xb029('0x2a')](_0x3b030a['model'],_0x3b030a[_0xb029('0x28')]);_0x112ce9[_0xb029('0x2b')]=_['intersection'](_0x3b030a[_0xb029('0x25')],qs['fields'](_0x47f874[_0xb029('0x28')]['fields']));_0x112ce9[_0xb029('0x2b')]=_0x112ce9[_0xb029('0x2b')][_0xb029('0x2c')]?_0x112ce9[_0xb029('0x2b')]:_0x3b030a[_0xb029('0x25')];_0x112ce9=_[_0xb029('0x2d')]({},_0x112ce9,_0x47f874[_0xb029('0x2e')]);return utilLicense[_0xb029('0x2f')](_0x112ce9)['then'](respondWithResult(_0x4fd06e,null))[_0xb029('0x30')](handleError(_0x4fd06e,null));};exports[_0xb029('0x31')]=function(_0x130663,_0x53753a){if(_0x130663[_0xb029('0x32')]['id']){delete _0x130663[_0xb029('0x32')]['id'];}return db['License'][_0xb029('0x33')]({'where':{'id':_0x130663['params']['id']}})[_0xb029('0x20')](handleEntityNotFound(_0x53753a,null))['then'](function(_0x29f68e){var _0x42f980=_0x29f68e[_0xb029('0x34')]({'plain':!![]});return utilLicense[_0xb029('0x35')](_0x42f980,_0x130663[_0xb029('0x32')][_0xb029('0x36')]);})[_0xb029('0x20')](function(_0x5a1d11){if(!_0x5a1d11[_0xb029('0x37')]){return saveUpdates(_0x130663[_0xb029('0x32')],null);}return _0x5a1d11;})['then'](respondWithResult(_0x53753a,null))[_0xb029('0x30')](handleError(_0x53753a,null));}; \ No newline at end of file +var _0x2070=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','keys','rawAttributes','query','filters','attributes','intersection','model','fields','length','merge','options','getLicense','catch','body','License','find','params','get','checkLicense','key','demo','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x26cce5,_0x2b9242){var _0x470a45=function(_0x9ef30e){while(--_0x9ef30e){_0x26cce5['push'](_0x26cce5['shift']());}};_0x470a45(++_0x2b9242);}(_0x2070,0x1a2));var _0x0207=function(_0x4bf01f,_0x4cf23e){_0x4bf01f=_0x4bf01f-0x0;var _0x5e50ca=_0x2070[_0x4bf01f];return _0x5e50ca;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0207('0x0'));var zipdir=require(_0x0207('0x1'));var jsonpatch=require(_0x0207('0x2'));var rp=require('request-promise');var moment=require(_0x0207('0x3'));var BPromise=require(_0x0207('0x4'));var Mustache=require('mustache');var util=require(_0x0207('0x5'));var path=require(_0x0207('0x6'));var sox=require('sox');var csv=require(_0x0207('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0207('0x8'));var crypto=require(_0x0207('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0207('0xa'));var toCsv=require(_0x0207('0x7'));var querystring=require('querystring');var Papa=require(_0x0207('0xb'));var Redis=require(_0x0207('0xc'));var authService=require(_0x0207('0xd'));var qs=require(_0x0207('0xe'));var as=require(_0x0207('0xf'));var hardwareService=require(_0x0207('0x10'));var logger=require(_0x0207('0x11'))(_0x0207('0x12'));var utils=require(_0x0207('0x13'));var config=require(_0x0207('0x14'));var licenseUtil=require(_0x0207('0x15'));var db=require(_0x0207('0x16'))['db'];function respondWithStatusCode(_0x22be26,_0x7c84b){_0x7c84b=_0x7c84b||0xcc;return function(_0x5bb744){if(_0x5bb744){return _0x22be26[_0x0207('0x17')](_0x7c84b);}return _0x22be26['status'](_0x7c84b)[_0x0207('0x18')]();};}function respondWithResult(_0x3bd0c4,_0x3ffc3a){_0x3ffc3a=_0x3ffc3a||0xc8;return function(_0x1748a1){if(_0x1748a1){return _0x3bd0c4[_0x0207('0x19')](_0x3ffc3a)['json'](_0x1748a1);}};}function respondWithFilteredResult(_0x3cb346,_0x1cbefd){return function(_0x5e8d17){if(_0x5e8d17){var _0x2bb662=_0x5e8d17['count'],_0x31880b=_0x1cbefd[_0x0207('0x1a')],_0x108181=_0x1cbefd[_0x0207('0x1a')]+_0x1cbefd[_0x0207('0x1b')],_0x325eb1;if(_0x108181>=_0x2bb662){_0x108181=_0x2bb662;_0x325eb1=0xc8;}else{_0x325eb1=0xce;}_0x3cb346[_0x0207('0x19')](_0x325eb1);return _0x3cb346[_0x0207('0x1c')](_0x0207('0x1d'),_0x31880b+'-'+_0x108181+'/'+_0x2bb662)[_0x0207('0x1e')](_0x5e8d17);}return null;};}function patchUpdates(_0x1151e8){return function(_0x4255bb){try{jsonpatch[_0x0207('0x1f')](_0x4255bb,_0x1151e8,!![]);}catch(_0x61f1bd){return BPromise[_0x0207('0x20')](_0x61f1bd);}return _0x4255bb[_0x0207('0x21')]();};}function saveUpdates(_0xfc201,_0x3474f3){return function(_0x5a8d60){if(_0x5a8d60){return _0x5a8d60[_0x0207('0x22')](_0xfc201)['then'](function(_0x1438df){return _0x1438df;});}return null;};}function removeEntity(_0x1421e7,_0x37c050){return function(_0x56a158){if(_0x56a158){return _0x56a158[_0x0207('0x23')]()[_0x0207('0x24')](function(){_0x1421e7['status'](0xcc)[_0x0207('0x18')]();});}};}function handleEntityNotFound(_0x11bb0f,_0x40224d){return function(_0x412d3a){if(!_0x412d3a){_0x11bb0f[_0x0207('0x17')](0x194);}return _0x412d3a;};}function handleError(_0x520a88,_0x17cfc9){_0x17cfc9=_0x17cfc9||0x1f4;return function(_0x4089f1){logger['error'](_0x4089f1[_0x0207('0x25')]);if(_0x4089f1['name']){delete _0x4089f1[_0x0207('0x26')];}_0x520a88[_0x0207('0x19')](_0x17cfc9)[_0x0207('0x27')](_0x4089f1);};}var utilLicense=require('../../config/license/util');exports[_0x0207('0x28')]=function(_0x26e59b,_0x1f6286){var _0x35085c={'raw':!![],'where':{'id':0x1}},_0x1bc810={};_0x1bc810['model']=_[_0x0207('0x29')](db['License'][_0x0207('0x2a')]);_0x1bc810[_0x0207('0x2b')]=_[_0x0207('0x29')](_0x26e59b['query']);_0x1bc810[_0x0207('0x2c')]=_['intersection'](_0x1bc810['model'],_0x1bc810[_0x0207('0x2b')]);_0x35085c[_0x0207('0x2d')]=_[_0x0207('0x2e')](_0x1bc810[_0x0207('0x2f')],qs[_0x0207('0x30')](_0x26e59b['query'][_0x0207('0x30')]));_0x35085c[_0x0207('0x2d')]=_0x35085c[_0x0207('0x2d')][_0x0207('0x31')]?_0x35085c['attributes']:_0x1bc810[_0x0207('0x2f')];_0x35085c=_[_0x0207('0x32')]({},_0x35085c,_0x26e59b[_0x0207('0x33')]);return utilLicense[_0x0207('0x34')](_0x35085c)[_0x0207('0x24')](respondWithResult(_0x1f6286,null))[_0x0207('0x35')](handleError(_0x1f6286,null));};exports['update']=function(_0x54aac8,_0x55576d){if(_0x54aac8['body']['id']){delete _0x54aac8[_0x0207('0x36')]['id'];}return db[_0x0207('0x37')][_0x0207('0x38')]({'where':{'id':_0x54aac8[_0x0207('0x39')]['id']}})['then'](handleEntityNotFound(_0x55576d,null))[_0x0207('0x24')](function(_0x4f1e91){var _0x558885=_0x4f1e91[_0x0207('0x3a')]({'plain':!![]});return utilLicense[_0x0207('0x3b')](_0x558885,_0x54aac8[_0x0207('0x36')][_0x0207('0x3c')]);})[_0x0207('0x24')](function(_0x1fe836){if(!_0x1fe836[_0x0207('0x3d')]){return saveUpdates(_0x54aac8['body'],null);}return _0x1fe836;})[_0x0207('0x24')](respondWithResult(_0x55576d,null))[_0x0207('0x35')](handleError(_0x55576d,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4a52079..d2aef54 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 _0x572b=['./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x492af5,_0xd51471){var _0x59f529=function(_0x40c9aa){while(--_0x40c9aa){_0x492af5['push'](_0x492af5['shift']());}};_0x59f529(++_0xd51471);}(_0x572b,0x1b2));var _0xb572=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0x572b[_0x43a5c7];return _0x3b12a2;};'use strict';var _=require(_0xb572('0x0'));var util=require(_0xb572('0x1'));var logger=require(_0xb572('0x2'))(_0xb572('0x3'));var moment=require(_0xb572('0x4'));var BPromise=require('bluebird');var rp=require(_0xb572('0x5'));var fs=require('fs');var path=require(_0xb572('0x6'));var rimraf=require(_0xb572('0x7'));var config=require('../../config/environment');var attributes=require(_0xb572('0x8'));module[_0xb572('0x9')]=function(_0x46ed9a,_0x2925dc){return _0x46ed9a[_0xb572('0xa')](_0xb572('0xb'),attributes,{'tableName':_0xb572('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f50=['License','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./license.attributes','exports','define'];(function(_0x57aac1,_0x14d928){var _0x43f9ef=function(_0x50627e){while(--_0x50627e){_0x57aac1['push'](_0x57aac1['shift']());}};_0x43f9ef(++_0x14d928);}(_0x2f50,0x7a));var _0x02f5=function(_0x433541,_0x2e830f){_0x433541=_0x433541-0x0;var _0x57e70e=_0x2f50[_0x433541];return _0x57e70e;};'use strict';var _=require(_0x02f5('0x0'));var util=require(_0x02f5('0x1'));var logger=require(_0x02f5('0x2'))(_0x02f5('0x3'));var moment=require('moment');var BPromise=require(_0x02f5('0x4'));var rp=require(_0x02f5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02f5('0x6'));var config=require('../../config/environment');var attributes=require(_0x02f5('0x7'));module[_0x02f5('0x8')]=function(_0x511ab3,_0x46e985){return _0x511ab3[_0x02f5('0x9')](_0x02f5('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 94eea01..cbcba99 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 _0xf6e8=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','License,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x47215b,_0x2ee68c){var _0x56ab77=function(_0xffd8e1){while(--_0xffd8e1){_0x47215b['push'](_0x47215b['shift']());}};_0x56ab77(++_0x2ee68c);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x1cdff2,_0x2bc78c){_0x1cdff2=_0x1cdff2-0x0;var _0x1d5a44=_0xf6e8[_0x1cdff2];return _0x1d5a44;};'use strict';var _=require('lodash');var util=require(_0x8f6e('0x0'));var moment=require(_0x8f6e('0x1'));var BPromise=require(_0x8f6e('0x2'));var rs=require(_0x8f6e('0x3'));var fs=require('fs');var Redis=require(_0x8f6e('0x4'));var db=require(_0x8f6e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f6e('0x6'))('rpc');var config=require(_0x8f6e('0x7'));var jayson=require(_0x8f6e('0x8'));var client=jayson['client'][_0x8f6e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233158,_0xd26126,_0x71b52c){return new BPromise(function(_0x423ed4,_0x105076){return client[_0x8f6e('0xa')](_0x233158,_0x71b52c)[_0x8f6e('0xb')](function(_0x364ade){logger[_0x8f6e('0xc')]('License,\x20%s,\x20%s',_0xd26126,_0x8f6e('0xd'));logger[_0x8f6e('0xe')]('License,\x20%s,\x20%s,\x20%s',_0xd26126,_0x8f6e('0xd'),JSON[_0x8f6e('0xf')](_0x364ade));if(_0x364ade[_0x8f6e('0x10')]){if(_0x364ade[_0x8f6e('0x10')][_0x8f6e('0x11')]===0x1f4){logger[_0x8f6e('0x10')](_0x8f6e('0x12'),_0xd26126,_0x364ade[_0x8f6e('0x10')][_0x8f6e('0x13')]);return _0x105076(_0x364ade[_0x8f6e('0x10')][_0x8f6e('0x13')]);}logger[_0x8f6e('0x10')](_0x8f6e('0x12'),_0xd26126,_0x364ade['error'][_0x8f6e('0x13')]);return _0x423ed4(_0x364ade[_0x8f6e('0x10')]['message']);}else{logger[_0x8f6e('0xc')](_0x8f6e('0x12'),_0xd26126,_0x8f6e('0xd'));_0x423ed4(_0x364ade['result']['message']);}})['catch'](function(_0x201991){logger[_0x8f6e('0x10')](_0x8f6e('0x12'),_0xd26126,_0x201991);_0x105076(_0x201991);});});} \ No newline at end of file +var _0xd816=['error','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','License,\x20%s,\x20%s'];(function(_0x24a4a3,_0x10a76){var _0x310386=function(_0x26e030){while(--_0x26e030){_0x24a4a3['push'](_0x24a4a3['shift']());}};_0x310386(++_0x10a76);}(_0xd816,0xd5));var _0x6d81=function(_0x1b33f1,_0x299364){_0x1b33f1=_0x1b33f1-0x0;var _0x166bc5=_0xd816[_0x1b33f1];return _0x166bc5;};'use strict';var _=require(_0x6d81('0x0'));var util=require(_0x6d81('0x1'));var moment=require('moment');var BPromise=require(_0x6d81('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6d81('0x3'));var logger=require(_0x6d81('0x4'))(_0x6d81('0x5'));var config=require(_0x6d81('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6d81('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10f1a7,_0x522603,_0x96d1ac){return new BPromise(function(_0x15d634,_0x4e77e8){return client[_0x6d81('0x8')](_0x10f1a7,_0x96d1ac)[_0x6d81('0x9')](function(_0x8612be){logger[_0x6d81('0xa')]('License,\x20%s,\x20%s',_0x522603,_0x6d81('0xb'));logger['debug'](_0x6d81('0xc'),_0x522603,_0x6d81('0xb'),JSON[_0x6d81('0xd')](_0x8612be));if(_0x8612be['error']){if(_0x8612be['error']['code']===0x1f4){logger['error'](_0x6d81('0xe'),_0x522603,_0x8612be[_0x6d81('0xf')][_0x6d81('0x10')]);return _0x4e77e8(_0x8612be[_0x6d81('0xf')]['message']);}logger[_0x6d81('0xf')](_0x6d81('0xe'),_0x522603,_0x8612be[_0x6d81('0xf')][_0x6d81('0x10')]);return _0x15d634(_0x8612be['error'][_0x6d81('0x10')]);}else{logger['info']('License,\x20%s,\x20%s',_0x522603,_0x6d81('0xb'));_0x15d634(_0x8612be[_0x6d81('0x11')][_0x6d81('0x10')]);}})[_0x6d81('0x12')](function(_0x219f73){logger[_0x6d81('0xf')](_0x6d81('0xe'),_0x522603,_0x219f73);_0x4e77e8(_0x219f73);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index b43870f..b69027b 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 _0xb9f9=['isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','addAnswer','create','addImap','/:id/out_servers','addSmtp','addApplications','/:id/send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index'];(function(_0x1e1b18,_0x5d471b){var _0x3da8f2=function(_0x51fe71){while(--_0x51fe71){_0x1e1b18['push'](_0x1e1b18['shift']());}};_0x3da8f2(++_0x5d471b);}(_0xb9f9,0x12c));var _0x9b9f=function(_0x7c93da,_0x27ae80){_0x7c93da=_0x7c93da-0x0;var _0x48508e=_0xb9f9[_0x7c93da];return _0x48508e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9b9f('0x0'));var express=require(_0x9b9f('0x1'));var router=express['Router']();var auth=require(_0x9b9f('0x2'));var interaction=require(_0x9b9f('0x3'));var config=require(_0x9b9f('0x4'));var controller=require(_0x9b9f('0x5'));router[_0x9b9f('0x6')]('/',auth['isAuthenticated'](),controller[_0x9b9f('0x7')]);router['get']('/describe',auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x9')]);router[_0x9b9f('0x6')](_0x9b9f('0xa'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0xb')]);router['get'](_0x9b9f('0xc'),auth['isAuthenticated'](),controller[_0x9b9f('0xd')]);router[_0x9b9f('0x6')](_0x9b9f('0xe'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0xf')]);router[_0x9b9f('0x6')](_0x9b9f('0x10'),auth['isAuthenticated'](),controller[_0x9b9f('0x11')]);router[_0x9b9f('0x6')]('/:id/out_servers',auth[_0x9b9f('0x8')](),controller['getSmtp']);router[_0x9b9f('0x6')](_0x9b9f('0x12'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x13')]);router['get'](_0x9b9f('0x14'),auth[_0x9b9f('0x8')](),controller['getApplications']);router[_0x9b9f('0x6')](_0x9b9f('0x15'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x16')]);router['get'](_0x9b9f('0x17'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x18')]);router['get'](_0x9b9f('0x19'),auth['isAuthenticated'](),controller['getAgents']);router[_0x9b9f('0x1a')](_0x9b9f('0xc'),auth[_0x9b9f('0x8')](),controller['addDisposition']);router['post'](_0x9b9f('0xe'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x1b')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9b9f('0x1c')]);router[_0x9b9f('0x1a')](_0x9b9f('0x10'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x1d')]);router[_0x9b9f('0x1a')](_0x9b9f('0x1e'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x1f')]);router['post']('/:id/interactions',auth[_0x9b9f('0x8')](),controller['addInteraction']);router[_0x9b9f('0x1a')](_0x9b9f('0x14'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x20')]);router[_0x9b9f('0x1a')](_0x9b9f('0x21'),auth[_0x9b9f('0x8')](),controller['send']);router[_0x9b9f('0x1a')](_0x9b9f('0x19'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x22')]);router[_0x9b9f('0x23')](_0x9b9f('0xa'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x24')]);router[_0x9b9f('0x25')](_0x9b9f('0xc'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x26')]);router[_0x9b9f('0x25')]('/:id/canned_answers',auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x27')]);router['delete']('/:id/in_servers',auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x28')]);router['delete'](_0x9b9f('0x1e'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x29')]);router[_0x9b9f('0x25')](_0x9b9f('0xa'),auth[_0x9b9f('0x8')](),controller[_0x9b9f('0x2a')]);router[_0x9b9f('0x25')](_0x9b9f('0x19'),auth[_0x9b9f('0x8')](),controller['removeAgents']);module[_0x9b9f('0x2b')]=router; \ No newline at end of file +var _0xa381=['show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addImap','addSmtp','addInteraction','addApplications','/:id/send','addAgents','update','delete','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','describe','/:id'];(function(_0x561adb,_0x5043ef){var _0x3156e8=function(_0x4acd2f){while(--_0x4acd2f){_0x561adb['push'](_0x561adb['shift']());}};_0x3156e8(++_0x5043ef);}(_0xa381,0x79));var _0x1a38=function(_0x57fa91,_0x87ea8a){_0x57fa91=_0x57fa91-0x0;var _0x425572=_0xa381[_0x57fa91];return _0x425572;};'use strict';var multer=require(_0x1a38('0x0'));var util=require(_0x1a38('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1a38('0x2'));var router=express[_0x1a38('0x3')]();var auth=require(_0x1a38('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1a38('0x5'));var controller=require(_0x1a38('0x6'));router[_0x1a38('0x7')]('/',auth[_0x1a38('0x8')](),controller['index']);router[_0x1a38('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x1a38('0x9')]);router['get'](_0x1a38('0xa'),auth[_0x1a38('0x8')](),controller[_0x1a38('0xb')]);router[_0x1a38('0x7')]('/:id/dispositions',auth[_0x1a38('0x8')](),controller[_0x1a38('0xc')]);router[_0x1a38('0x7')](_0x1a38('0xd'),auth[_0x1a38('0x8')](),controller[_0x1a38('0xe')]);router[_0x1a38('0x7')](_0x1a38('0xf'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x10')]);router[_0x1a38('0x7')](_0x1a38('0x11'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x12')]);router[_0x1a38('0x7')](_0x1a38('0x13'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x14')]);router[_0x1a38('0x7')](_0x1a38('0x15'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x16')]);router[_0x1a38('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x1a38('0x17')]);router['get'](_0x1a38('0x18'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x19')]);router[_0x1a38('0x7')](_0x1a38('0x1a'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x1b')]);router[_0x1a38('0x1c')](_0x1a38('0x1d'),auth['isAuthenticated'](),controller[_0x1a38('0x1e')]);router['post'](_0x1a38('0xd'),auth[_0x1a38('0x8')](),controller['addAnswer']);router[_0x1a38('0x1c')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a38('0x1c')](_0x1a38('0xf'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x1f')]);router['post'](_0x1a38('0x11'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x20')]);router['post'](_0x1a38('0x13'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x21')]);router[_0x1a38('0x1c')](_0x1a38('0x15'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x22')]);router[_0x1a38('0x1c')](_0x1a38('0x23'),auth[_0x1a38('0x8')](),controller['send']);router[_0x1a38('0x1c')]('/:id/users',auth[_0x1a38('0x8')](),controller[_0x1a38('0x24')]);router['put'](_0x1a38('0xa'),auth['isAuthenticated'](),controller[_0x1a38('0x25')]);router[_0x1a38('0x26')](_0x1a38('0x1d'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x1a38('0x26')](_0x1a38('0xd'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x27')]);router[_0x1a38('0x26')](_0x1a38('0xf'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x28')]);router['delete']('/:id/out_servers',auth[_0x1a38('0x8')](),controller[_0x1a38('0x29')]);router[_0x1a38('0x26')](_0x1a38('0xa'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x2a')]);router[_0x1a38('0x26')]('/:id/users',auth[_0x1a38('0x8')](),controller['removeAgents']);module[_0x1a38('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4dd4a96..48c0657 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 _0x3cce=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x3ff673,_0x51dfb3){var _0x570980=function(_0x21d4b7){while(--_0x21d4b7){_0x3ff673['push'](_0x3ff673['shift']());}};_0x570980(++_0x51dfb3);}(_0x3cce,0x117));var _0xe3cc=function(_0x5ea463,_0x4bac5f){_0x5ea463=_0x5ea463-0x0;var _0x27e575=_0x3cce[_0x5ea463];return _0x27e575;};'use strict';var Sequelize=require(_0xe3cc('0x0'));module['exports']={'description':{'type':Sequelize[_0xe3cc('0x1')]},'name':{'type':Sequelize[_0xe3cc('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xe3cc('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xe3cc('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xe3cc('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe3cc('0x1')],'allowNull':![],'defaultValue':_0xe3cc('0x4')},'fontSize':{'type':Sequelize[_0xe3cc('0x5')](0x2)[_0xe3cc('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe3cc('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[_0xe3cc('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe3cc('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe3cc('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe3cc('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe3cc('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe3cc('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe3cc('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4c8ad3){if(!_0x4c8ad3)this[_0xe3cc('0x7')](_0xe3cc('0x8'),null);this[_0xe3cc('0x7')](_0xe3cc('0x9'),_0x4c8ad3);}}}; \ No newline at end of file +var _0x34cd=['exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','setDataValue','mandatoryDispositionPauseId'];(function(_0x1b8e7f,_0x555ac7){var _0x2bfe29=function(_0x4623e0){while(--_0x4623e0){_0x1b8e7f['push'](_0x1b8e7f['shift']());}};_0x2bfe29(++_0x555ac7);}(_0x34cd,0xfc));var _0xd34c=function(_0x188c44,_0xcaf8a8){_0x188c44=_0x188c44-0x0;var _0x332933=_0x34cd[_0x188c44];return _0x332933;};'use strict';var Sequelize=require('sequelize');module[_0xd34c('0x0')]={'description':{'type':Sequelize[_0xd34c('0x1')]},'name':{'type':Sequelize[_0xd34c('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xd34c('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd34c('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xd34c('0x3')]},'markAsUnread':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd34c('0x4')},'fontSize':{'type':Sequelize[_0xd34c('0x5')](0x2)[_0xd34c('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd34c('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[_0xd34c('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd34c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x280399){if(!_0x280399)this[_0xd34c('0x7')](_0xd34c('0x8'),null);this[_0xd34c('0x7')]('mandatoryDisposition',_0x280399);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 3291289..22f3e1e 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 _0x36d0=['papaparse','html-to-text','juice','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','register','jayson/promise','client','request','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','MailAccounts','UserProfileResource','destroy','name','send','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','MailServerIn','length','find','update','body','describe','addDisposition','Disposition','create','MailAccountId','removeDispositions','ids','CannedAnswer','findOne','removeAnswers','email','ListId','active','description','cservice','user','authentication','host','port','service','pass','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','CmContact','Contact','Owner','fullname','internal','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','isNil','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0xbd77c1,_0x50b969){var _0x47fa83=function(_0x38dac1){while(--_0x38dac1){_0xbd77c1['push'](_0xbd77c1['shift']());}};_0x47fa83(++_0x50b969);}(_0x36d0,0xaf));var _0x036d=function(_0xbe2ba3,_0x31e1a5){_0xbe2ba3=_0xbe2ba3-0x0;var _0x546abd=_0x36d0[_0xbe2ba3];return _0x546abd;};'use strict';var pdf=require(_0x036d('0x0'));var emlformat=require(_0x036d('0x1'));var rimraf=require(_0x036d('0x2'));var zipdir=require(_0x036d('0x3'));var jsonpatch=require(_0x036d('0x4'));var rp=require(_0x036d('0x5'));var moment=require(_0x036d('0x6'));var BPromise=require(_0x036d('0x7'));var Mustache=require(_0x036d('0x8'));var util=require('util');var path=require(_0x036d('0x9'));var sox=require(_0x036d('0xa'));var csv=require(_0x036d('0xb'));var ejs=require(_0x036d('0xc'));var fs=require('fs');var _=require(_0x036d('0xd'));var squel=require(_0x036d('0xe'));var crypto=require(_0x036d('0xf'));var jsforce=require(_0x036d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x036d('0xb'));var querystring=require('querystring');var Papa=require(_0x036d('0x11'));var htmlToText=require(_0x036d('0x12'));var juice=require(_0x036d('0x13'));var Redis=require(_0x036d('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x036d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x036d('0x16'))(_0x036d('0x17'));var utils=require(_0x036d('0x18'));var config=require(_0x036d('0x19'));var licenseUtil=require(_0x036d('0x1a'));var db=require(_0x036d('0x1b'))['db'];config['redis']=_[_0x036d('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailAccount.socket')[_0x036d('0x1d')](socket);var jayson=require(_0x036d('0x1e'));var client=jayson[_0x036d('0x1f')]['http']({'port':0x232b});function respondWithRpcPromise(_0x4695b3,_0x411f60,_0x564c1d,_0x12caeb){return new BPromise(function(_0x355b3a,_0x3ae71c){var _0x15bc26=_0x12caeb||client;return _0x15bc26[_0x036d('0x20')](_0x4695b3,_0x564c1d)['then'](function(_0x449677){logger['info']('MailAccount,\x20%s,\x20%s',_0x411f60,_0x036d('0x21'));logger[_0x036d('0x22')](_0x036d('0x23'),_0x411f60,_0x036d('0x21'),JSON['stringify'](_0x449677));if(_0x449677[_0x036d('0x24')]){if(_0x449677[_0x036d('0x24')][_0x036d('0x25')]===0x1f4){logger['error'](_0x036d('0x26'),_0x411f60,_0x449677['error'][_0x036d('0x27')]);return _0x3ae71c(_0x449677[_0x036d('0x24')][_0x036d('0x27')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x411f60,_0x449677[_0x036d('0x24')][_0x036d('0x27')]);return _0x355b3a(_0x449677[_0x036d('0x24')]['message']);}else{logger[_0x036d('0x28')]('MailAccount,\x20%s,\x20%s',_0x411f60,_0x036d('0x21'));_0x355b3a(_0x449677[_0x036d('0x29')][_0x036d('0x27')]);}})[_0x036d('0x2a')](function(_0x516ad5){logger[_0x036d('0x24')]('MailAccount,\x20%s,\x20%s',_0x411f60,_0x516ad5);_0x3ae71c(_0x516ad5);});});}function respondWithStatusCode(_0x5089d4,_0x204880){_0x204880=_0x204880||0xcc;return function(_0x53dc4d){if(_0x53dc4d){return _0x5089d4[_0x036d('0x2b')](_0x204880);}return _0x5089d4[_0x036d('0x2c')](_0x204880)[_0x036d('0x2d')]();};}function respondWithResult(_0x2cf768,_0x52bc04){_0x52bc04=_0x52bc04||0xc8;return function(_0x5ce414){if(_0x5ce414){return _0x2cf768['status'](_0x52bc04)[_0x036d('0x2e')](_0x5ce414);}};}function respondWithFilteredResult(_0x40e2a7,_0x15228e){return function(_0x2a8391){if(_0x2a8391){var _0x28c3ae=_0x2a8391[_0x036d('0x2f')],_0x333e3b=_0x15228e['offset'],_0x248ae6=_0x15228e[_0x036d('0x30')]+_0x15228e[_0x036d('0x31')],_0x2c032e;if(_0x248ae6>=_0x28c3ae){_0x248ae6=_0x28c3ae;_0x2c032e=0xc8;}else{_0x2c032e=0xce;}_0x40e2a7['status'](_0x2c032e);return _0x40e2a7[_0x036d('0x32')](_0x036d('0x33'),_0x333e3b+'-'+_0x248ae6+'/'+_0x28c3ae)[_0x036d('0x2e')](_0x2a8391);}return null;};}function patchUpdates(_0x3b9331){return function(_0x170007){try{jsonpatch[_0x036d('0x34')](_0x170007,_0x3b9331,!![]);}catch(_0x5ef000){return BPromise[_0x036d('0x35')](_0x5ef000);}return _0x170007[_0x036d('0x36')]();};}function saveUpdates(_0x49465b,_0x1cad30){return function(_0x4228d8){if(_0x4228d8){return _0x4228d8['update'](_0x49465b)['then'](function(_0x99a042){return _0x99a042;});}return null;};}function removeEntity(_0xbe8dc3,_0xedae63){return function(_0x3ced8c){if(_0x3ced8c){return _0x3ced8c['destroy']()[_0x036d('0x37')](function(){var _0x137c06=_0x3ced8c[_0x036d('0x38')]({'plain':!![]});var _0x57a9e0=_0x036d('0x39');return db[_0x036d('0x3a')][_0x036d('0x3b')]({'where':{'type':_0x57a9e0,'resourceId':_0x137c06['id']}})[_0x036d('0x37')](function(){return _0x3ced8c;});})[_0x036d('0x37')](function(){_0xbe8dc3[_0x036d('0x2c')](0xcc)[_0x036d('0x2d')]();});}};}function handleEntityNotFound(_0x2b22b3,_0x5317a5){return function(_0x249079){if(!_0x249079){_0x2b22b3[_0x036d('0x2b')](0x194);}return _0x249079;};}function handleError(_0xe0a4cb,_0x46ab37){_0x46ab37=_0x46ab37||0x1f4;return function(_0x2e1920){logger['error'](_0x2e1920['stack']);if(_0x2e1920[_0x036d('0x3c')]){delete _0x2e1920[_0x036d('0x3c')];}_0xe0a4cb['status'](_0x46ab37)[_0x036d('0x3d')](_0x2e1920);};}exports[_0x036d('0x3e')]=function(_0x492afc,_0x2ed788){var _0x235546={'include':[{'model':db['MailServerIn'],'as':_0x036d('0x3f')},{'model':db[_0x036d('0x40')],'as':_0x036d('0x41')},{'model':db[_0x036d('0x42')],'as':_0x036d('0x43')}]},_0x314d96={},_0x524581={'count':0x0,'rows':[]};var _0x5380b5=_[_0x036d('0x44')](db[_0x036d('0x45')][_0x036d('0x46')],function(_0x2eb0c3){return{'name':_0x2eb0c3['fieldName'],'type':_0x2eb0c3[_0x036d('0x47')][_0x036d('0x48')]};});_0x314d96[_0x036d('0x49')]=_[_0x036d('0x44')](_0x5380b5,'name');_0x314d96[_0x036d('0x4a')]=_[_0x036d('0x4b')](_0x492afc[_0x036d('0x4a')]);_0x314d96['filters']=_[_0x036d('0x4c')](_0x314d96[_0x036d('0x49')],_0x314d96[_0x036d('0x4a')]);_0x235546[_0x036d('0x4d')]=_[_0x036d('0x4c')](_0x314d96[_0x036d('0x49')],qs[_0x036d('0x4e')](_0x492afc[_0x036d('0x4a')]['fields']));_0x235546['attributes']=_0x235546[_0x036d('0x4d')]['length']?_0x235546['attributes']:_0x314d96[_0x036d('0x49')];if(!_0x492afc[_0x036d('0x4a')][_0x036d('0x4f')](_0x036d('0x50'))){_0x235546[_0x036d('0x31')]=qs['limit'](_0x492afc['query']['limit']);_0x235546[_0x036d('0x30')]=qs[_0x036d('0x30')](_0x492afc['query']['offset']);}_0x235546[_0x036d('0x51')]=qs[_0x036d('0x52')](_0x492afc[_0x036d('0x4a')][_0x036d('0x52')]);_0x235546[_0x036d('0x53')]=qs[_0x036d('0x54')](_[_0x036d('0x55')](_0x492afc[_0x036d('0x4a')],_0x314d96[_0x036d('0x54')]),_0x5380b5);if(_0x492afc['query'][_0x036d('0x56')]){_0x235546[_0x036d('0x53')]=_['merge'](_0x235546[_0x036d('0x53')],{'$or':_[_0x036d('0x44')](_0x5380b5,function(_0x441d98){if(_0x441d98[_0x036d('0x47')]!=='VIRTUAL'){var _0x2d561f={};_0x2d561f[_0x441d98['name']]={'$like':'%'+_0x492afc['query'][_0x036d('0x56')]+'%'};return _0x2d561f;}})});}_0x235546=_[_0x036d('0x57')]({},_0x235546,_0x492afc[_0x036d('0x58')]);var _0x380646={'where':_0x235546[_0x036d('0x53')]};return db[_0x036d('0x45')][_0x036d('0x2f')](_0x380646)['then'](function(_0x1768d7){_0x524581[_0x036d('0x2f')]=_0x1768d7;if(_0x492afc[_0x036d('0x4a')][_0x036d('0x59')]){_0x235546[_0x036d('0x5a')]=[{'all':!![]}];}return db[_0x036d('0x45')][_0x036d('0x5b')](_0x235546);})[_0x036d('0x37')](function(_0x38648d){_0x524581[_0x036d('0x5c')]=_0x38648d;return _0x524581;})[_0x036d('0x37')](respondWithFilteredResult(_0x2ed788,_0x235546))[_0x036d('0x2a')](handleError(_0x2ed788,null));};exports[_0x036d('0x5d')]=function(_0x5cbe4c,_0x467a77){var _0x25776a={'raw':![],'where':{'id':_0x5cbe4c[_0x036d('0x5e')]['id']},'include':[{'model':db[_0x036d('0x5f')],'as':_0x036d('0x3f')},{'model':db['MailServerOut'],'as':_0x036d('0x41')},{'model':db[_0x036d('0x42')],'as':_0x036d('0x43')}]},_0x518f60={};_0x518f60[_0x036d('0x49')]=_['keys'](db['MailAccount'][_0x036d('0x46')]);_0x518f60[_0x036d('0x4a')]=_[_0x036d('0x4b')](_0x5cbe4c[_0x036d('0x4a')]);_0x518f60[_0x036d('0x54')]=_[_0x036d('0x4c')](_0x518f60[_0x036d('0x49')],_0x518f60[_0x036d('0x4a')]);_0x25776a['attributes']=_['intersection'](_0x518f60[_0x036d('0x49')],qs[_0x036d('0x4e')](_0x5cbe4c[_0x036d('0x4a')][_0x036d('0x4e')]));_0x25776a['attributes']=_0x25776a[_0x036d('0x4d')][_0x036d('0x60')]?_0x25776a[_0x036d('0x4d')]:_0x518f60[_0x036d('0x49')];if(_0x5cbe4c[_0x036d('0x4a')][_0x036d('0x59')]){_0x25776a[_0x036d('0x5a')]=[{'all':!![]}];}_0x25776a=_[_0x036d('0x57')]({},_0x25776a,_0x5cbe4c[_0x036d('0x58')]);return db[_0x036d('0x45')][_0x036d('0x61')](_0x25776a)['then'](handleEntityNotFound(_0x467a77,null))[_0x036d('0x37')](respondWithResult(_0x467a77,null))[_0x036d('0x2a')](handleError(_0x467a77,null));};exports[_0x036d('0x62')]=function(_0xde0c4b,_0x281a4a){if(_0xde0c4b[_0x036d('0x63')]['id']){delete _0xde0c4b['body']['id'];}return db[_0x036d('0x45')][_0x036d('0x61')]({'where':{'id':_0xde0c4b[_0x036d('0x5e')]['id']},'include':[{'model':db[_0x036d('0x5f')],'as':_0x036d('0x3f')},{'model':db[_0x036d('0x40')],'as':_0x036d('0x41')},{'model':db['Pause'],'as':_0x036d('0x43')}]})[_0x036d('0x37')](handleEntityNotFound(_0x281a4a,null))['then'](saveUpdates(_0xde0c4b[_0x036d('0x63')],null))[_0x036d('0x37')](function(_0x4af87a){if(_0x4af87a&&_0xde0c4b['body'][_0x036d('0x3f')]){return db[_0x036d('0x5f')][_0x036d('0x62')](_0xde0c4b['body'][_0x036d('0x3f')],{'where':{'MailAccountId':_0x4af87a['id']}})[_0x036d('0x37')](function(){return _0x4af87a;});}return _0x4af87a;})[_0x036d('0x37')](function(_0x2ceb19){if(_0x2ceb19&&_0xde0c4b[_0x036d('0x63')][_0x036d('0x41')]){return db[_0x036d('0x40')][_0x036d('0x62')](_0xde0c4b[_0x036d('0x63')][_0x036d('0x41')],{'where':{'MailAccountId':_0x2ceb19['id']}})[_0x036d('0x37')](function(){return _0x2ceb19;});}return _0x2ceb19;})[_0x036d('0x37')](respondWithResult(_0x281a4a,null))[_0x036d('0x2a')](handleError(_0x281a4a,null));};exports[_0x036d('0x64')]=function(_0xbd5922,_0x2cbc4a){return db[_0x036d('0x45')]['describe']()[_0x036d('0x37')](respondWithResult(_0x2cbc4a,null))[_0x036d('0x2a')](handleError(_0x2cbc4a,null));};exports[_0x036d('0x65')]=function(_0x58fe1f,_0x56b792,_0x20f04f){if(_0x58fe1f['body']['id']){delete _0x58fe1f[_0x036d('0x63')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x58fe1f[_0x036d('0x5e')]['id']}})[_0x036d('0x37')](handleEntityNotFound(_0x56b792,null))[_0x036d('0x37')](function(_0x4ca34c){if(_0x4ca34c){_0x58fe1f[_0x036d('0x63')]['MailAccountId']=_0x4ca34c['id'];return db[_0x036d('0x66')][_0x036d('0x67')](_0x58fe1f['body']);}})[_0x036d('0x37')](respondWithResult(_0x56b792,null))[_0x036d('0x2a')](handleError(_0x56b792,null));};exports['getDispositions']=function(_0xed27df,_0x251b3b,_0x634896){var _0x4169cd={'raw':![],'where':{}};var _0x38c08f={};var _0x1e392c={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0xed27df[_0x036d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x251b3b,null))['then'](function(_0x223c10){if(_0x223c10){_0x38c08f['model']=_[_0x036d('0x4b')](db[_0x036d('0x66')][_0x036d('0x46')]);_0x38c08f['query']=_['keys'](_0xed27df[_0x036d('0x4a')]);_0x38c08f['filters']=_[_0x036d('0x4c')](_0x38c08f['model'],_0x38c08f[_0x036d('0x4a')]);_0x4169cd['attributes']=_[_0x036d('0x4c')](_0x38c08f[_0x036d('0x49')],qs[_0x036d('0x4e')](_0xed27df[_0x036d('0x4a')][_0x036d('0x4e')]));_0x4169cd[_0x036d('0x4d')]=_0x4169cd[_0x036d('0x4d')][_0x036d('0x60')]?_0x4169cd[_0x036d('0x4d')]:_0x38c08f[_0x036d('0x49')];if(!_0xed27df['query'][_0x036d('0x4f')](_0x036d('0x50'))){_0x4169cd[_0x036d('0x31')]=qs['limit'](_0xed27df['query'][_0x036d('0x31')]);_0x4169cd['offset']=qs[_0x036d('0x30')](_0xed27df[_0x036d('0x4a')]['offset']);}_0x4169cd[_0x036d('0x51')]=qs[_0x036d('0x52')](_0xed27df['query']['sort']);_0x4169cd['where']=qs[_0x036d('0x54')](_[_0x036d('0x55')](_0xed27df['query'],_0x38c08f[_0x036d('0x54')]));_0x4169cd[_0x036d('0x53')][_0x036d('0x68')]=_0x223c10['id'];if(_0xed27df['query'][_0x036d('0x56')]){_0x4169cd[_0x036d('0x53')]=_[_0x036d('0x57')](_0x4169cd[_0x036d('0x53')],{'$or':_[_0x036d('0x44')](_0x4169cd[_0x036d('0x4d')],function(_0x595fbf){var _0x394119={};_0x394119[_0x595fbf]={'$like':'%'+_0xed27df[_0x036d('0x4a')][_0x036d('0x56')]+'%'};return _0x394119;})});}_0x4169cd=_[_0x036d('0x57')]({},_0x4169cd,_0xed27df[_0x036d('0x58')]);return db['Disposition'][_0x036d('0x2f')]({'where':_0x4169cd['where']})[_0x036d('0x37')](function(_0x19fd8f){_0x1e392c[_0x036d('0x2f')]=_0x19fd8f;if(_0xed27df[_0x036d('0x4a')][_0x036d('0x59')]){_0x4169cd[_0x036d('0x5a')]=[{'all':!![]}];}return db[_0x036d('0x66')][_0x036d('0x5b')](_0x4169cd);})['then'](function(_0x25f199){_0x1e392c[_0x036d('0x5c')]=_0x25f199;return _0x1e392c;});}})[_0x036d('0x37')](respondWithFilteredResult(_0x251b3b,_0x4169cd))[_0x036d('0x2a')](handleError(_0x251b3b,null));};exports[_0x036d('0x69')]=function(_0x54e52e,_0x242962,_0x3fe79a){return db[_0x036d('0x45')][_0x036d('0x61')]({'where':{'id':_0x54e52e[_0x036d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x242962,null))[_0x036d('0x37')](function(_0x2dee75){if(_0x2dee75){return _0x2dee75[_0x036d('0x69')](_0x54e52e[_0x036d('0x4a')][_0x036d('0x6a')]);}})[_0x036d('0x37')](respondWithStatusCode(_0x242962,null))[_0x036d('0x2a')](handleError(_0x242962,null));};exports['addAnswer']=function(_0x51a4aa,_0xaf0350,_0x1de823){if(_0x51a4aa[_0x036d('0x63')]['id']){delete _0x51a4aa[_0x036d('0x63')]['id'];}return db[_0x036d('0x45')][_0x036d('0x61')]({'where':{'id':_0x51a4aa[_0x036d('0x5e')]['id']}})[_0x036d('0x37')](handleEntityNotFound(_0xaf0350,null))[_0x036d('0x37')](function(_0x2633af){if(_0x2633af){_0x51a4aa['body']['MailAccountId']=_0x2633af['id'];return db[_0x036d('0x6b')]['create'](_0x51a4aa[_0x036d('0x63')]);}})[_0x036d('0x37')](respondWithResult(_0xaf0350,null))['catch'](handleError(_0xaf0350,null));};exports['getAnswers']=function(_0x591ac8,_0x27383f,_0x1b28dc){var _0xc676f2={'raw':![],'where':{}};var _0x50f598={};var _0x23450d={'count':0x0,'rows':[]};return db[_0x036d('0x45')][_0x036d('0x6c')]({'where':{'id':_0x591ac8['params']['id']}})[_0x036d('0x37')](handleEntityNotFound(_0x27383f,null))[_0x036d('0x37')](function(_0x30dff1){if(_0x30dff1){_0x50f598[_0x036d('0x49')]=_[_0x036d('0x4b')](db[_0x036d('0x6b')]['rawAttributes']);_0x50f598['query']=_[_0x036d('0x4b')](_0x591ac8[_0x036d('0x4a')]);_0x50f598['filters']=_[_0x036d('0x4c')](_0x50f598['model'],_0x50f598['query']);_0xc676f2[_0x036d('0x4d')]=_[_0x036d('0x4c')](_0x50f598[_0x036d('0x49')],qs[_0x036d('0x4e')](_0x591ac8[_0x036d('0x4a')][_0x036d('0x4e')]));_0xc676f2['attributes']=_0xc676f2[_0x036d('0x4d')][_0x036d('0x60')]?_0xc676f2[_0x036d('0x4d')]:_0x50f598[_0x036d('0x49')];if(!_0x591ac8[_0x036d('0x4a')]['hasOwnProperty']('nolimit')){_0xc676f2['limit']=qs[_0x036d('0x31')](_0x591ac8[_0x036d('0x4a')][_0x036d('0x31')]);_0xc676f2[_0x036d('0x30')]=qs[_0x036d('0x30')](_0x591ac8['query'][_0x036d('0x30')]);}_0xc676f2[_0x036d('0x51')]=qs['sort'](_0x591ac8[_0x036d('0x4a')]['sort']);_0xc676f2[_0x036d('0x53')]=qs[_0x036d('0x54')](_['pick'](_0x591ac8[_0x036d('0x4a')],_0x50f598[_0x036d('0x54')]));_0xc676f2[_0x036d('0x53')][_0x036d('0x68')]=_0x30dff1['id'];if(_0x591ac8[_0x036d('0x4a')][_0x036d('0x56')]){_0xc676f2[_0x036d('0x53')]=_[_0x036d('0x57')](_0xc676f2[_0x036d('0x53')],{'$or':_['map'](_0xc676f2[_0x036d('0x4d')],function(_0x203aa3){var _0x59f16d={};_0x59f16d[_0x203aa3]={'$like':'%'+_0x591ac8[_0x036d('0x4a')]['filter']+'%'};return _0x59f16d;})});}_0xc676f2=_['merge']({},_0xc676f2,_0x591ac8[_0x036d('0x58')]);return db[_0x036d('0x6b')][_0x036d('0x2f')]({'where':_0xc676f2[_0x036d('0x53')]})[_0x036d('0x37')](function(_0x2f7d20){_0x23450d[_0x036d('0x2f')]=_0x2f7d20;if(_0x591ac8[_0x036d('0x4a')][_0x036d('0x59')]){_0xc676f2[_0x036d('0x5a')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xc676f2);})[_0x036d('0x37')](function(_0x2b1e50){_0x23450d['rows']=_0x2b1e50;return _0x23450d;});}})['then'](respondWithFilteredResult(_0x27383f,_0xc676f2))[_0x036d('0x2a')](handleError(_0x27383f,null));};exports[_0x036d('0x6d')]=function(_0x1933d1,_0x57f553,_0x558cbb){return db[_0x036d('0x45')][_0x036d('0x61')]({'where':{'id':_0x1933d1[_0x036d('0x5e')]['id']}})[_0x036d('0x37')](handleEntityNotFound(_0x57f553,null))['then'](function(_0x190815){if(_0x190815){return _0x190815[_0x036d('0x6d')](_0x1933d1['query'][_0x036d('0x6a')]);}})[_0x036d('0x37')](respondWithStatusCode(_0x57f553,null))[_0x036d('0x2a')](handleError(_0x57f553,null));};exports[_0x036d('0x67')]=function(_0x2e46cd,_0x173773){var _0x23ed75={'name':_0x2e46cd[_0x036d('0x63')][_0x036d('0x3c')],'key':_0x2e46cd[_0x036d('0x63')][_0x036d('0x48')],'email':_0x2e46cd['body'][_0x036d('0x6e')],'ListId':_0x2e46cd[_0x036d('0x63')][_0x036d('0x6f')],'active':!_['isNil'](_0x2e46cd[_0x036d('0x63')][_0x036d('0x70')])?_0x2e46cd['body'][_0x036d('0x70')]:!![],'description':_0x2e46cd[_0x036d('0x63')][_0x036d('0x71')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x2e46cd[_0x036d('0x63')][_0x036d('0x72')])){if(_0x2e46cd[_0x036d('0x63')]['cauthentication']){_0x23ed75[_0x036d('0x3f')][_0x036d('0x73')]=_0x23ed75['Smtp'][_0x036d('0x73')]=_0x2e46cd['body']['cuser'];_0x23ed75[_0x036d('0x3f')]['password']=_0x23ed75['Smtp']['pass']=_0x2e46cd[_0x036d('0x63')]['cpassword'];}else{_0x23ed75[_0x036d('0x3f')][_0x036d('0x74')]=_0x23ed75[_0x036d('0x41')][_0x036d('0x74')]=![];}_0x23ed75[_0x036d('0x3f')][_0x036d('0x75')]=_0x2e46cd[_0x036d('0x63')]['Imap'][_0x036d('0x75')];_0x23ed75[_0x036d('0x3f')][_0x036d('0x76')]=_0x2e46cd[_0x036d('0x63')][_0x036d('0x3f')][_0x036d('0x76')];_0x23ed75['Smtp'][_0x036d('0x75')]=_0x2e46cd[_0x036d('0x63')]['Smtp'][_0x036d('0x75')];_0x23ed75[_0x036d('0x41')][_0x036d('0x76')]=_0x2e46cd[_0x036d('0x63')][_0x036d('0x41')][_0x036d('0x76')];}else{_0x23ed75[_0x036d('0x3f')][_0x036d('0x77')]=_0x23ed75[_0x036d('0x41')]['service']=_0x2e46cd[_0x036d('0x63')][_0x036d('0x72')];_0x23ed75[_0x036d('0x3f')][_0x036d('0x73')]=_0x23ed75[_0x036d('0x41')][_0x036d('0x73')]=_0x2e46cd[_0x036d('0x63')]['cuser'];_0x23ed75[_0x036d('0x3f')]['password']=_0x23ed75[_0x036d('0x41')][_0x036d('0x78')]=_0x2e46cd[_0x036d('0x63')]['cpassword'];}return db[_0x036d('0x45')][_0x036d('0x67')](_0x23ed75,{'include':[{'model':db[_0x036d('0x40')],'as':'Smtp'},{'model':db[_0x036d('0x5f')],'as':_0x036d('0x3f')}]})[_0x036d('0x37')](function(_0x3f684d){var _0x57ea71=_0x2e46cd[_0x036d('0x73')]['get']({'plain':!![]});if(!_0x57ea71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57ea71[_0x036d('0x79')]===_0x036d('0x73')){var _0x560772=_0x3f684d[_0x036d('0x38')]({'plain':!![]});return db['UserProfileSection'][_0x036d('0x61')]({'where':{'name':'MailAccounts','userProfileId':_0x57ea71[_0x036d('0x7a')]},'raw':!![]})[_0x036d('0x37')](function(_0x68cffe){if(_0x68cffe&&_0x68cffe[_0x036d('0x7b')]===0x0){return db[_0x036d('0x3a')]['create']({'name':_0x560772[_0x036d('0x3c')],'resourceId':_0x560772['id'],'type':_0x68cffe[_0x036d('0x3c')],'sectionId':_0x68cffe['id']},{})[_0x036d('0x37')](function(){return _0x3f684d;});}else{return _0x3f684d;}})[_0x036d('0x2a')](function(_0x198e87){logger[_0x036d('0x24')](_0x036d('0x7c'),_0x198e87);throw _0x198e87;});}return _0x3f684d;})['then'](respondWithResult(_0x173773,0xc9))[_0x036d('0x2a')](handleError(_0x173773,null));};exports[_0x036d('0x7d')]=function(_0x50c49d,_0x218ba1,_0x52a06b){return db[_0x036d('0x45')][_0x036d('0x6c')]({'where':{'id':_0x50c49d[_0x036d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x218ba1,null))[_0x036d('0x37')](function(_0x2b4e73){if(_0x2b4e73){return _0x2b4e73[_0x036d('0x7d')]();}return null;})[_0x036d('0x37')](respondWithResult(_0x218ba1,null))[_0x036d('0x2a')](handleError(_0x218ba1,null));};exports[_0x036d('0x7e')]=function(_0x43ca3a,_0x32ef37,_0x327102){if(_0x43ca3a[_0x036d('0x63')]['id']){delete _0x43ca3a[_0x036d('0x63')]['id'];}return db[_0x036d('0x45')][_0x036d('0x61')]({'where':{'id':_0x43ca3a[_0x036d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x32ef37,null))[_0x036d('0x37')](function(_0x23ba2d){if(_0x23ba2d){_0x43ca3a[_0x036d('0x63')][_0x036d('0x68')]=_0x23ba2d['id'];return db['MailServerIn'][_0x036d('0x67')](_0x43ca3a[_0x036d('0x63')]);}})[_0x036d('0x37')](respondWithResult(_0x32ef37,null))[_0x036d('0x2a')](handleError(_0x32ef37,null));};exports[_0x036d('0x7f')]=function(_0x3c7542,_0x534e15,_0x1c1afe){return db[_0x036d('0x45')][_0x036d('0x6c')]({'where':{'id':_0x3c7542[_0x036d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x534e15,null))[_0x036d('0x37')](function(_0x4d3621){if(_0x4d3621){return _0x4d3621[_0x036d('0x80')](null);}return null;})['then'](respondWithStatusCode(_0x534e15,null))[_0x036d('0x2a')](handleError(_0x534e15,null));};exports[_0x036d('0x81')]=function(_0x15df7b,_0x58c603,_0x524d46){return db[_0x036d('0x45')][_0x036d('0x6c')]({'where':{'id':_0x15df7b['params']['id']}})['then'](handleEntityNotFound(_0x58c603,null))['then'](function(_0x157bad){if(_0x157bad){return _0x157bad[_0x036d('0x81')]();}return null;})[_0x036d('0x37')](respondWithResult(_0x58c603,null))['catch'](handleError(_0x58c603,null));};exports[_0x036d('0x82')]=function(_0x2cc030,_0x2dc760,_0x4d8d38){if(_0x2cc030[_0x036d('0x63')]['id']){delete _0x2cc030[_0x036d('0x63')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x2cc030[_0x036d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2dc760,null))[_0x036d('0x37')](function(_0x5e7c40){if(_0x5e7c40){_0x2cc030['body'][_0x036d('0x68')]=_0x5e7c40['id'];return db[_0x036d('0x40')]['create'](_0x2cc030[_0x036d('0x63')]);}})[_0x036d('0x37')](respondWithResult(_0x2dc760,null))['catch'](handleError(_0x2dc760,null));};exports[_0x036d('0x83')]=function(_0x5bb632,_0x48668f,_0x35efd1){return db[_0x036d('0x45')][_0x036d('0x6c')]({'where':{'id':_0x5bb632[_0x036d('0x5e')]['id']}})[_0x036d('0x37')](handleEntityNotFound(_0x48668f,null))[_0x036d('0x37')](function(_0x4e077b){if(_0x4e077b){return _0x4e077b[_0x036d('0x84')](null);}return null;})[_0x036d('0x37')](respondWithStatusCode(_0x48668f,null))[_0x036d('0x2a')](handleError(_0x48668f,null));};exports[_0x036d('0x85')]=function(_0x5b3e9,_0x360b2c,_0x348c6b){return db[_0x036d('0x86')]['find']({'where':{'id':_0x5b3e9[_0x036d('0x5e')]['id']}})[_0x036d('0x37')](handleEntityNotFound(_0x360b2c,null))[_0x036d('0x37')](function(_0x567eaf){if(_0x567eaf){return _0x567eaf[_0x036d('0x85')](_0x5b3e9[_0x036d('0x63')]['ids'],_['omit'](_0x5b3e9['body'],[_0x036d('0x6a'),'id'])||{});}})[_0x036d('0x37')](respondWithResult(_0x360b2c,null))[_0x036d('0x2a')](handleError(_0x360b2c,null));};exports['getInteractions']=function(_0x4f1da9,_0x56caf9,_0x2f669d){var _0x308515={'raw':![],'where':{}};var _0x32e7a5={};var _0x336795={'count':0x0,'rows':[]};return db['MailAccount'][_0x036d('0x6c')]({'where':{'id':_0x4f1da9[_0x036d('0x5e')]['id']}})[_0x036d('0x37')](handleEntityNotFound(_0x56caf9,null))[_0x036d('0x37')](function(_0x3ace03){if(_0x3ace03){_0x32e7a5[_0x036d('0x49')]=_[_0x036d('0x4b')](db[_0x036d('0x86')][_0x036d('0x46')]);_0x32e7a5['query']=_[_0x036d('0x4b')](_0x4f1da9[_0x036d('0x4a')]);_0x32e7a5[_0x036d('0x54')]=_[_0x036d('0x4c')](_0x32e7a5[_0x036d('0x49')],_0x32e7a5['query']);_0x308515[_0x036d('0x4d')]=_[_0x036d('0x4c')](_0x32e7a5['model'],qs[_0x036d('0x4e')](_0x4f1da9[_0x036d('0x4a')][_0x036d('0x4e')]));_0x308515['attributes']=_0x308515['attributes'][_0x036d('0x60')]?_0x308515['attributes']:_0x32e7a5['model'];if(!_0x4f1da9[_0x036d('0x4a')]['hasOwnProperty'](_0x036d('0x50'))){_0x308515[_0x036d('0x31')]=qs[_0x036d('0x31')](_0x4f1da9[_0x036d('0x4a')][_0x036d('0x31')]);_0x308515[_0x036d('0x30')]=qs[_0x036d('0x30')](_0x4f1da9[_0x036d('0x4a')][_0x036d('0x30')]);}_0x308515[_0x036d('0x51')]=qs[_0x036d('0x52')](_0x4f1da9[_0x036d('0x4a')][_0x036d('0x52')]);_0x308515[_0x036d('0x53')]=qs[_0x036d('0x54')](_[_0x036d('0x55')](_0x4f1da9[_0x036d('0x4a')],_0x32e7a5[_0x036d('0x54')]));_0x308515[_0x036d('0x53')][_0x036d('0x68')]=_0x3ace03['id'];if(_0x4f1da9['query'][_0x036d('0x56')]){_0x308515['where']=_[_0x036d('0x57')](_0x308515[_0x036d('0x53')],{'$or':_[_0x036d('0x44')](_0x308515['attributes'],function(_0x7dd725){var _0x58ee31={};_0x58ee31[_0x7dd725]={'$like':'%'+_0x4f1da9[_0x036d('0x4a')][_0x036d('0x56')]+'%'};return _0x58ee31;})});}_0x308515=_[_0x036d('0x57')]({},_0x308515,_0x4f1da9[_0x036d('0x58')]);return db['MailInteraction'][_0x036d('0x2f')]({'where':_0x308515[_0x036d('0x53')]})['then'](function(_0x5ad907){_0x336795[_0x036d('0x2f')]=_0x5ad907;if(_0x4f1da9[_0x036d('0x4a')][_0x036d('0x59')]){_0x308515['include']=[{'model':db[_0x036d('0x87')],'as':_0x036d('0x88'),'required':![]},{'model':db['User'],'as':_0x036d('0x89'),'attributes':[_0x036d('0x3c'),_0x036d('0x8a'),_0x036d('0x8b')],'required':![]},{'model':db['Tag'],'as':_0x036d('0x8c'),'attributes':['id',_0x036d('0x3c'),'color'],'where':_0x4f1da9[_0x036d('0x4a')]['tag']?{'id':_0x4f1da9[_0x036d('0x4a')][_0x036d('0x8d')]}:undefined,'required':_0x4f1da9[_0x036d('0x4a')]['tag']?!![]:![]}];}return db[_0x036d('0x86')][_0x036d('0x5b')](_0x308515);})['then'](function(_0x4d291a){_0x336795[_0x036d('0x5c')]=_0x4d291a;return _0x336795;});}})[_0x036d('0x37')](respondWithFilteredResult(_0x56caf9,_0x308515))['catch'](handleError(_0x56caf9,null));};exports[_0x036d('0x8e')]=function(_0x5a9e3d,_0x140d84,_0x34dc36){return db[_0x036d('0x45')][_0x036d('0x6c')]({'where':{'id':_0x5a9e3d[_0x036d('0x5e')]['id']}})[_0x036d('0x37')](handleEntityNotFound(_0x140d84,null))[_0x036d('0x37')](function(_0x48b555){if(_0x48b555){return db[_0x036d('0x8f')][_0x036d('0x90')](function(_0x128077){return db[_0x036d('0x91')][_0x036d('0x3b')]({'where':{'MailAccountId':_0x5a9e3d[_0x036d('0x5e')]['id']},'transaction':_0x128077})[_0x036d('0x37')](function(_0x37681f){var _0x5cff4e=_[_0x036d('0x44')](_0x5a9e3d[_0x036d('0x63')],function(_0x4e305a){_0x4e305a[_0x036d('0x68')]=_0x5a9e3d['params']['id'];return _0x4e305a;});return db[_0x036d('0x91')][_0x036d('0x92')](_0x5cff4e,{'transaction':_0x128077});});})[_0x036d('0x37')](function(){return db[_0x036d('0x91')][_0x036d('0x93')]({'where':{'MailAccountId':_0x5a9e3d[_0x036d('0x5e')]['id']},'order':_0x036d('0x94')});});}})[_0x036d('0x37')](respondWithResult(_0x140d84,null))['catch'](handleError(_0x140d84,null));};exports[_0x036d('0x95')]=function(_0x5c7ed3,_0x519b90,_0x1a6463){var _0x40ffb3={};var _0x3673d6={};var _0x38d2c8;var _0x40c43b;return db['MailAccount']['findOne']({'where':{'id':_0x5c7ed3['params']['id']}})['then'](handleEntityNotFound(_0x519b90,null))[_0x036d('0x37')](function(_0x3fd571){if(_0x3fd571){_0x38d2c8=_0x3fd571;_0x3673d6['model']=_[_0x036d('0x4b')](db['MailApplication']['rawAttributes']);_0x3673d6[_0x036d('0x4a')]=_[_0x036d('0x4b')](_0x5c7ed3[_0x036d('0x4a')]);_0x3673d6[_0x036d('0x54')]=_[_0x036d('0x4c')](_0x3673d6[_0x036d('0x49')],_0x3673d6[_0x036d('0x4a')]);_0x40ffb3[_0x036d('0x4d')]=_['intersection'](_0x3673d6[_0x036d('0x49')],qs[_0x036d('0x4e')](_0x5c7ed3[_0x036d('0x4a')][_0x036d('0x4e')]));_0x40ffb3[_0x036d('0x4d')]=_0x40ffb3['attributes'][_0x036d('0x60')]?_0x40ffb3['attributes']:_0x3673d6[_0x036d('0x49')];_0x40ffb3[_0x036d('0x51')]=qs[_0x036d('0x52')](_0x5c7ed3['query']['sort']);_0x40ffb3[_0x036d('0x53')]=qs[_0x036d('0x54')](_[_0x036d('0x55')](_0x5c7ed3[_0x036d('0x4a')],_0x3673d6[_0x036d('0x54')]));if(_0x5c7ed3[_0x036d('0x4a')]['filter']){_0x40ffb3[_0x036d('0x53')]=_[_0x036d('0x57')](_0x40ffb3[_0x036d('0x53')],{'$or':_[_0x036d('0x44')](_0x40ffb3[_0x036d('0x4d')],function(_0x187bd2){var _0x3a46d8={};_0x3a46d8[_0x187bd2]={'$like':'%'+_0x5c7ed3[_0x036d('0x4a')][_0x036d('0x56')]+'%'};return _0x3a46d8;})});}_0x40ffb3=_[_0x036d('0x57')]({},_0x40ffb3,_0x5c7ed3[_0x036d('0x58')]);return _0x38d2c8[_0x036d('0x95')](_0x40ffb3);}})['then'](function(_0x28a1bc){if(_0x28a1bc){_0x40c43b=_0x28a1bc[_0x036d('0x60')];if(!_0x5c7ed3[_0x036d('0x4a')]['hasOwnProperty'](_0x036d('0x50'))){_0x40ffb3[_0x036d('0x31')]=qs[_0x036d('0x31')](_0x5c7ed3[_0x036d('0x4a')][_0x036d('0x31')]);_0x40ffb3[_0x036d('0x30')]=qs[_0x036d('0x30')](_0x5c7ed3[_0x036d('0x4a')][_0x036d('0x30')]);}return _0x38d2c8[_0x036d('0x95')](_0x40ffb3);}})['then'](function(_0x1e21a0){if(_0x1e21a0){return _0x1e21a0?{'count':_0x40c43b,'rows':_0x1e21a0}:null;}})[_0x036d('0x37')](respondWithResult(_0x519b90,null))[_0x036d('0x2a')](handleError(_0x519b90,null));};exports[_0x036d('0x96')]=function(_0x16ca76,_0x36bfd6,_0x1b594d){var _0x3630f9={'raw':!![],'where':{}};var _0x5c219e={};var _0x5d6e19={'count':0x0,'rows':[]};return db[_0x036d('0x45')][_0x036d('0x6c')]({'where':{'id':_0x16ca76[_0x036d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x36bfd6,null))[_0x036d('0x37')](function(_0x5d1411){if(_0x5d1411){_0x5c219e['model']=_[_0x036d('0x4b')](db['MailMessage'][_0x036d('0x46')]);_0x5c219e[_0x036d('0x4a')]=_[_0x036d('0x4b')](_0x16ca76['query']);_0x5c219e[_0x036d('0x54')]=_[_0x036d('0x4c')](_0x5c219e['model'],_0x5c219e['query']);_0x3630f9[_0x036d('0x4d')]=_[_0x036d('0x4c')](_0x5c219e[_0x036d('0x49')],qs[_0x036d('0x4e')](_0x16ca76[_0x036d('0x4a')]['fields']));_0x3630f9[_0x036d('0x4d')]=_0x3630f9[_0x036d('0x4d')][_0x036d('0x60')]?_0x3630f9[_0x036d('0x4d')]:_0x5c219e[_0x036d('0x49')];if(!_0x16ca76[_0x036d('0x4a')][_0x036d('0x4f')](_0x036d('0x50'))){_0x3630f9[_0x036d('0x31')]=qs[_0x036d('0x31')](_0x16ca76['query'][_0x036d('0x31')]);_0x3630f9[_0x036d('0x30')]=qs[_0x036d('0x30')](_0x16ca76[_0x036d('0x4a')][_0x036d('0x30')]);}_0x3630f9[_0x036d('0x51')]=qs['sort'](_0x16ca76[_0x036d('0x4a')][_0x036d('0x52')]);_0x3630f9['where']=qs[_0x036d('0x54')](_[_0x036d('0x55')](_0x16ca76['query'],_0x5c219e[_0x036d('0x54')]));_0x3630f9[_0x036d('0x53')]['MailAccountId']=_0x5d1411['id'];if(_0x16ca76[_0x036d('0x4a')][_0x036d('0x56')]){_0x3630f9[_0x036d('0x53')]=_[_0x036d('0x57')](_0x3630f9['where'],{'$or':_[_0x036d('0x44')](_0x3630f9['attributes'],function(_0x1fd128){var _0x9ffe26={};_0x9ffe26[_0x1fd128]={'$like':'%'+_0x16ca76[_0x036d('0x4a')]['filter']+'%'};return _0x9ffe26;})});}if(_0x16ca76['query']['$gte']){var _0x2c9e0b=_0x16ca76[_0x036d('0x4a')][_0x036d('0x97')][_0x036d('0x98')](',');var _0x45e4ea={};_0x45e4ea[_0x2c9e0b[0x0]]={'$gte':moment(_0x2c9e0b[0x1])[_0x036d('0x99')](_0x036d('0x9a'))};_0x3630f9['where']=_[_0x036d('0x57')](_0x3630f9[_0x036d('0x53')],_0x45e4ea);}_0x3630f9=_[_0x036d('0x57')]({},_0x3630f9,_0x16ca76[_0x036d('0x58')]);return db[_0x036d('0x9b')][_0x036d('0x2f')]({'where':_0x3630f9[_0x036d('0x53')]})['then'](function(_0x4e40c1){_0x5d6e19['count']=_0x4e40c1;if(_0x16ca76[_0x036d('0x4a')][_0x036d('0x59')]){_0x3630f9['include']=[{'all':!![]}];}return db[_0x036d('0x9b')][_0x036d('0x5b')](_0x3630f9);})['then'](function(_0x42e101){if(_0x16ca76['query'][_0x036d('0x9c')]===_0x036d('0x9d')){for(var _0x30b320=0x0;_0x30b320<_0x42e101[_0x036d('0x60')];_0x30b320++){_0x42e101[_0x30b320][_0x036d('0x63')]=juice(_0x42e101[_0x30b320][_0x036d('0x63')]);}}_0x5d6e19[_0x036d('0x5c')]=_0x42e101;return _0x5d6e19;});}})[_0x036d('0x37')](respondWithFilteredResult(_0x36bfd6,_0x3630f9))[_0x036d('0x2a')](handleError(_0x36bfd6,null));};exports[_0x036d('0x3d')]=function(_0x1686f7,_0x4d2c0e,_0x31076d){var _0x592baf,_0x3591d1={},_0x5f5e09;if(_0x1686f7[_0x036d('0x63')]['to']){_0x5f5e09=_0x1686f7[_0x036d('0x63')]['to'][_0x036d('0x98')](',')[0x0];}return db[_0x036d('0x45')][_0x036d('0x61')]({'where':{'id':_0x1686f7[_0x036d('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x036d('0x9e'),'include':[{'model':db[_0x036d('0x87')],'as':_0x036d('0x9f'),'where':{'email':_0x5f5e09},'limit':0x1,'order':[[_0x036d('0xa0'),_0x036d('0xa1')]]}]},{'model':db[_0x036d('0x40')],'as':_0x036d('0x41'),'raw':!![]}]})[_0x036d('0x37')](handleEntityNotFound(_0x4d2c0e,null))[_0x036d('0x37')](function(_0x11342f){if(_0x11342f){_0x592baf=_0x11342f;if(_0x11342f[_0x036d('0x41')]){if(_['isNil'](_0x1686f7[_0x036d('0x63')]['from'])){_0x1686f7[_0x036d('0x63')][_0x036d('0xa2')]=util[_0x036d('0x99')](_0x036d('0xa3'),_0x11342f['name'],_0x11342f[_0x036d('0x6e')]||_0x11342f[_0x036d('0x41')][_0x036d('0x73')]);}if(_0x1686f7[_0x036d('0x63')][_0x036d('0xa4')]&&_0x1686f7['body']['attachments'][_0x036d('0x60')]){for(var _0x323c19=0x0;_0x323c19<_0x1686f7[_0x036d('0x63')][_0x036d('0xa4')][_0x036d('0x60')];_0x323c19+=0x1){_0x1686f7[_0x036d('0x63')][_0x036d('0xa4')][_0x323c19]={'filename':_0x1686f7[_0x036d('0x63')][_0x036d('0xa4')][_0x323c19]['name'],'path':path['join'](config[_0x036d('0xa5')],_0x036d('0xa6'),_0x1686f7['body'][_0x036d('0xa4')][_0x323c19]['basename'])};}}var _0x1e133c={'tls':{'rejectUnauthorized':![]}};if(_[_0x036d('0xa7')](_0x11342f[_0x036d('0x41')]['service'])){if(_0x11342f[_0x036d('0x41')][_0x036d('0x74')]){_0x1e133c[_0x036d('0xa8')]={'user':_0x11342f[_0x036d('0x41')][_0x036d('0x73')],'pass':_0x11342f[_0x036d('0x41')][_0x036d('0x78')]};}_0x1e133c['host']=_0x11342f[_0x036d('0x41')][_0x036d('0x75')];_0x1e133c['port']=_0x11342f[_0x036d('0x41')][_0x036d('0x76')];_0x1e133c[_0x036d('0xa9')]=_0x11342f[_0x036d('0x41')]['secure'];}else{_0x1e133c['service']=_0x11342f[_0x036d('0x41')]['service'];_0x1e133c[_0x036d('0xa8')]={'user':_0x11342f[_0x036d('0x41')][_0x036d('0x73')],'pass':_0x11342f[_0x036d('0x41')]['pass']};}return respondWithRpcPromise(_0x036d('0xaa'),_0x036d('0xab'),{'account':_0x1e133c,'message':_0x1686f7[_0x036d('0x63')]});}else{throw new Error('List\x20not\x20found');}}})[_0x036d('0x37')](function(_0x26f46d){if(_0x26f46d){_0x3591d1=_0x26f46d;if(_0x592baf['List']){if(_0x592baf['List'][_0x036d('0x9f')][_0x036d('0x60')]){return _0x592baf['List']['Contacts'][0x0];}else{return db[_0x036d('0x87')][_0x036d('0x67')](_['defaults'](_0x1686f7[_0x036d('0x63')],{'firstName':_0x1686f7[_0x036d('0x63')]['to'],'email':_0x1686f7[_0x036d('0x63')]['to'],'phone':_0x1686f7[_0x036d('0x63')]['to'],'ListId':_0x592baf[_0x036d('0x6f')]}));}}else{throw new Error(_0x036d('0xac'));}}})[_0x036d('0x37')](function(_0x595e96){if(_0x595e96){var _0x56e99a={'UserId':_0x1686f7[_0x036d('0x73')]['id'],'ContactId':_0x595e96['id'],'MailAccountId':_0x592baf['id'],'inReplyTo':_0x3591d1[_0x036d('0xad')],'to':_0x1686f7[_0x036d('0x63')]['from'],'cc':_0x1686f7[_0x036d('0x63')]['cc'],'subject':_0x1686f7[_0x036d('0x63')][_0x036d('0xae')],'attach':_0x1686f7[_0x036d('0x63')][_0x036d('0xaf')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x036d('0x99')](_0x036d('0x9a')),'lastMsgDirection':_0x036d('0xb0'),'lastMsgBody':_0x1686f7[_0x036d('0x63')][_0x036d('0x63')],'Messages':[_[_0x036d('0x57')](_0x1686f7[_0x036d('0x63')],{'messageId':_0x3591d1['messageId'],'sentAt':moment()['format'](_0x036d('0x9a')),'read':!![],'MailAccountId':_0x592baf['id'],'UserId':_0x1686f7[_0x036d('0x73')]['id'],'ContactId':_0x595e96['id']})]};if(_0x1686f7[_0x036d('0x63')][_0x036d('0xb1')]){_0x56e99a=_[_0x036d('0x57')](_0x56e99a,_0x1686f7['body'][_0x036d('0xb1')]);}return db[_0x036d('0x86')][_0x036d('0x67')](_0x56e99a,{'include':[{'model':db[_0x036d('0x9b')],'as':'Messages'}]});}})[_0x036d('0x37')](respondWithResult(_0x4d2c0e,null))[_0x036d('0x2a')](handleError(_0x4d2c0e,null));};exports[_0x036d('0xb2')]=function(_0xf40204,_0x4d5d77,_0x595dc3){return db['MailAccount']['find']({'where':{'id':_0xf40204[_0x036d('0x5e')]['id']},'include':[{'model':db[_0x036d('0x40')],'as':_0x036d('0x41'),'raw':!![]}]})['then'](handleEntityNotFound(_0x4d5d77,null))[_0x036d('0x37')](function(_0x481cb9){if(_0x481cb9&&_0x481cb9['Smtp']){var _0x33c7b0={'id':_0x481cb9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x481cb9['Smtp'][_0x036d('0x77')]){_0x33c7b0['service']=_0x481cb9[_0x036d('0x41')]['service'];}else{_0x33c7b0['host']=_0x481cb9[_0x036d('0x41')][_0x036d('0x75')];_0x33c7b0[_0x036d('0x76')]=_0x481cb9[_0x036d('0x41')][_0x036d('0x76')];_0x33c7b0[_0x036d('0xa9')]=_0x481cb9[_0x036d('0x41')][_0x036d('0xa9')];}if(_0x481cb9['Smtp'][_0x036d('0x74')]){_0x33c7b0[_0x036d('0xa8')]={'user':_0x481cb9['Smtp'][_0x036d('0x73')],'pass':_0x481cb9['Smtp'][_0x036d('0x78')]};}return respondWithRpcPromise(_0x036d('0xb3'),_0x036d('0xb2'),{'account':_0x33c7b0});}})[_0x036d('0x37')](respondWithResult(_0x4d5d77,null))[_0x036d('0x2a')](handleError(_0x4d5d77,null));};exports[_0x036d('0x3b')]=function(_0x1277d1,_0x470781){return db[_0x036d('0x45')][_0x036d('0x61')]({'where':{'id':_0x1277d1['params']['id']}})['then'](handleEntityNotFound(_0x470781,null))['then'](function(_0x35a080){if(_0x35a080&&_0x35a080[_0x036d('0x77')]){throw new db['Sequelize'][(_0x036d('0xb4'))](_0x036d('0xb5'));}return _0x35a080;})[_0x036d('0x37')](removeEntity(_0x470781,null))['catch'](handleError(_0x470781,null));};exports['addAgents']=function(_0x1f1a8a,_0x5e13aa,_0x411905){return db[_0x036d('0x45')]['find']({'where':{'id':_0x1f1a8a[_0x036d('0x5e')]['id']}})[_0x036d('0x37')](handleEntityNotFound(_0x5e13aa,null))[_0x036d('0x37')](function(_0x4c738b){if(_0x4c738b){return _0x4c738b[_0x036d('0xb6')](_0x1f1a8a[_0x036d('0x63')][_0x036d('0x6a')],_[_0x036d('0xb7')](_0x1f1a8a[_0x036d('0x63')],[_0x036d('0x6a'),'id'])||{})[_0x036d('0xb8')](function(_0x3a0b0e){for(var _0x42868e=0x0;_0x42868e<_0x1f1a8a['body']['ids'][_0x036d('0x60')];_0x42868e+=0x1){socket[_0x036d('0xb9')](_0x036d('0xba'),{'UserId':_0x1f1a8a['body'][_0x036d('0x6a')][_0x42868e],'MailAccountId':_0x1f1a8a[_0x036d('0x5e')]['id']});}return _0x3a0b0e;});}})[_0x036d('0x37')](respondWithResult(_0x5e13aa,null))[_0x036d('0x2a')](handleError(_0x5e13aa,null));};exports[_0x036d('0xbb')]=function(_0x72332c,_0x230c78,_0x3e81c3){return db[_0x036d('0x45')][_0x036d('0x61')]({'where':{'id':_0x72332c[_0x036d('0x5e')]['id']}})[_0x036d('0x37')](handleEntityNotFound(_0x230c78,null))['then'](function(_0x1ac560){if(_0x1ac560){return _0x1ac560[_0x036d('0xbb')](_0x72332c[_0x036d('0x4a')][_0x036d('0x6a')])[_0x036d('0x37')](function(){if(_[_0x036d('0xbc')](_0x72332c[_0x036d('0x4a')][_0x036d('0x6a')])){for(var _0x222afe=0x0;_0x222afe<_0x72332c['query']['ids'][_0x036d('0x60')];_0x222afe+=0x1){socket[_0x036d('0xb9')](_0x036d('0xbd'),{'UserId':Number(_0x72332c[_0x036d('0x4a')][_0x036d('0x6a')][_0x222afe]),'MailAccountId':Number(_0x72332c[_0x036d('0x5e')]['id'])});}}else{socket[_0x036d('0xb9')](_0x036d('0xbd'),{'UserId':Number(_0x72332c['query'][_0x036d('0x6a')]),'MailAccountId':Number(_0x72332c['params']['id'])});}});}})[_0x036d('0x37')](respondWithStatusCode(_0x230c78,null))[_0x036d('0x2a')](handleError(_0x230c78,null));};exports['getAgents']=function(_0x4eb56a,_0x577dda,_0x10a1e6){var _0x518a6b={};var _0x4e959b={};var _0x1cbba5;var _0x456254;return db[_0x036d('0x45')][_0x036d('0x6c')]({'where':{'id':_0x4eb56a[_0x036d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x577dda,null))[_0x036d('0x37')](function(_0x3067b2){if(_0x3067b2){_0x1cbba5=_0x3067b2;_0x4e959b[_0x036d('0x49')]=_[_0x036d('0x4b')](db[_0x036d('0xbe')][_0x036d('0x46')]);_0x4e959b[_0x036d('0x4a')]=_[_0x036d('0x4b')](_0x4eb56a[_0x036d('0x4a')]);_0x4e959b[_0x036d('0x54')]=_[_0x036d('0x4c')](_0x4e959b[_0x036d('0x49')],_0x4e959b['query']);_0x518a6b[_0x036d('0x4d')]=_[_0x036d('0x4c')](_0x4e959b[_0x036d('0x49')],qs[_0x036d('0x4e')](_0x4eb56a[_0x036d('0x4a')][_0x036d('0x4e')]));_0x518a6b[_0x036d('0x4d')]=_0x518a6b[_0x036d('0x4d')]['length']?_0x518a6b[_0x036d('0x4d')]:_0x4e959b[_0x036d('0x49')];_0x518a6b[_0x036d('0x51')]=qs[_0x036d('0x52')](_0x4eb56a['query'][_0x036d('0x52')]);_0x518a6b['where']=qs[_0x036d('0x54')](_[_0x036d('0x55')](_0x4eb56a[_0x036d('0x4a')],_0x4e959b[_0x036d('0x54')]));if(_0x4eb56a['query'][_0x036d('0x56')]){_0x518a6b[_0x036d('0x53')]=_[_0x036d('0x57')](_0x518a6b[_0x036d('0x53')],{'$or':_[_0x036d('0x44')](_0x518a6b[_0x036d('0x4d')],function(_0x1d926c){var _0x4dc878={};_0x4dc878[_0x1d926c]={'$like':'%'+_0x4eb56a['query'][_0x036d('0x56')]+'%'};return _0x4dc878;})});}_0x518a6b=_[_0x036d('0x57')]({},_0x518a6b,_0x4eb56a['options']);return _0x1cbba5['getAgents'](_0x518a6b);}})['then'](function(_0x763221){if(_0x763221){_0x456254=_0x763221[_0x036d('0x60')];if(!_0x4eb56a['query'][_0x036d('0x4f')](_0x036d('0x50'))){_0x518a6b[_0x036d('0x31')]=qs[_0x036d('0x31')](_0x4eb56a[_0x036d('0x4a')][_0x036d('0x31')]);_0x518a6b[_0x036d('0x30')]=qs[_0x036d('0x30')](_0x4eb56a[_0x036d('0x4a')]['offset']);}return _0x1cbba5[_0x036d('0xbf')](_0x518a6b);}})[_0x036d('0x37')](function(_0x3d0533){if(_0x3d0533){return _0x3d0533?{'count':_0x456254,'rows':_0x3d0533}:null;}})[_0x036d('0x37')](respondWithResult(_0x577dda,null))[_0x036d('0x2a')](handleError(_0x577dda,null));}; \ No newline at end of file +var _0x2d6e=['emit','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','html-to-text','juice','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./mailAccount.socket','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','MailServerOut','Pause','map','MailAccount','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','findAll','show','Imap','mandatoryDispositionPause','rawAttributes','find','body','params','Smtp','describe','addDisposition','MailAccountId','create','getDispositions','Disposition','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','email','ListId','isNil','active','description','cservice','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','removeImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','rows','addApplications','sequelize','MailApplication','destroy','bulkCreate','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','auth','secure','sendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray'];(function(_0x575cdf,_0x2cf0c8){var _0x5d93f0=function(_0x5b5302){while(--_0x5b5302){_0x575cdf['push'](_0x575cdf['shift']());}};_0x5d93f0(++_0x2cf0c8);}(_0x2d6e,0x193));var _0xe2d6=function(_0x213011,_0x1de2e2){_0x213011=_0x213011-0x0;var _0xacf03f=_0x2d6e[_0x213011];return _0xacf03f;};'use strict';var pdf=require(_0xe2d6('0x0'));var emlformat=require(_0xe2d6('0x1'));var rimraf=require(_0xe2d6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe2d6('0x3'));var moment=require(_0xe2d6('0x4'));var BPromise=require(_0xe2d6('0x5'));var Mustache=require(_0xe2d6('0x6'));var util=require(_0xe2d6('0x7'));var path=require(_0xe2d6('0x8'));var sox=require(_0xe2d6('0x9'));var csv=require('to-csv');var ejs=require(_0xe2d6('0xa'));var fs=require('fs');var _=require(_0xe2d6('0xb'));var squel=require('squel');var crypto=require(_0xe2d6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe2d6('0xd'));var toCsv=require(_0xe2d6('0xe'));var querystring=require(_0xe2d6('0xf'));var Papa=require(_0xe2d6('0x10'));var htmlToText=require(_0xe2d6('0x11'));var juice=require(_0xe2d6('0x12'));var Redis=require(_0xe2d6('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe2d6('0x14'));var hardwareService=require(_0xe2d6('0x15'));var logger=require(_0xe2d6('0x16'))(_0xe2d6('0x17'));var utils=require(_0xe2d6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe2d6('0x19'));var db=require(_0xe2d6('0x1a'))['db'];config[_0xe2d6('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe2d6('0x1c'))(new Redis(config['redis']));require(_0xe2d6('0x1d'))['register'](socket);var jayson=require(_0xe2d6('0x1e'));var client=jayson['client'][_0xe2d6('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x31ec82,_0x3d68a8,_0x248652,_0x7a4a86){return new BPromise(function(_0x3d1992,_0x4ae12e){var _0x17df2b=_0x7a4a86||client;return _0x17df2b[_0xe2d6('0x20')](_0x31ec82,_0x248652)[_0xe2d6('0x21')](function(_0x5aad8b){logger[_0xe2d6('0x22')](_0xe2d6('0x23'),_0x3d68a8,_0xe2d6('0x24'));logger[_0xe2d6('0x25')](_0xe2d6('0x26'),_0x3d68a8,_0xe2d6('0x24'),JSON[_0xe2d6('0x27')](_0x5aad8b));if(_0x5aad8b[_0xe2d6('0x28')]){if(_0x5aad8b['error'][_0xe2d6('0x29')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x3d68a8,_0x5aad8b[_0xe2d6('0x28')]['message']);return _0x4ae12e(_0x5aad8b[_0xe2d6('0x28')][_0xe2d6('0x2a')]);}logger[_0xe2d6('0x28')](_0xe2d6('0x23'),_0x3d68a8,_0x5aad8b[_0xe2d6('0x28')][_0xe2d6('0x2a')]);return _0x3d1992(_0x5aad8b['error'][_0xe2d6('0x2a')]);}else{logger[_0xe2d6('0x22')](_0xe2d6('0x23'),_0x3d68a8,_0xe2d6('0x24'));_0x3d1992(_0x5aad8b['result'][_0xe2d6('0x2a')]);}})[_0xe2d6('0x2b')](function(_0x43c83b){logger['error'](_0xe2d6('0x23'),_0x3d68a8,_0x43c83b);_0x4ae12e(_0x43c83b);});});}function respondWithStatusCode(_0x261fac,_0x4cf710){_0x4cf710=_0x4cf710||0xcc;return function(_0x3e25e8){if(_0x3e25e8){return _0x261fac[_0xe2d6('0x2c')](_0x4cf710);}return _0x261fac[_0xe2d6('0x2d')](_0x4cf710)[_0xe2d6('0x2e')]();};}function respondWithResult(_0x9481b3,_0x2c05c9){_0x2c05c9=_0x2c05c9||0xc8;return function(_0x2e65d2){if(_0x2e65d2){return _0x9481b3[_0xe2d6('0x2d')](_0x2c05c9)[_0xe2d6('0x2f')](_0x2e65d2);}};}function respondWithFilteredResult(_0x106497,_0x295028){return function(_0x5aa975){if(_0x5aa975){var _0x343cfe=_0x5aa975['count'],_0x7adbbc=_0x295028[_0xe2d6('0x30')],_0x21d87a=_0x295028[_0xe2d6('0x30')]+_0x295028[_0xe2d6('0x31')],_0x4104bf;if(_0x21d87a>=_0x343cfe){_0x21d87a=_0x343cfe;_0x4104bf=0xc8;}else{_0x4104bf=0xce;}_0x106497['status'](_0x4104bf);return _0x106497[_0xe2d6('0x32')](_0xe2d6('0x33'),_0x7adbbc+'-'+_0x21d87a+'/'+_0x343cfe)[_0xe2d6('0x2f')](_0x5aa975);}return null;};}function patchUpdates(_0x947a8f){return function(_0x1b9ad6){try{jsonpatch[_0xe2d6('0x34')](_0x1b9ad6,_0x947a8f,!![]);}catch(_0x174f3e){return BPromise[_0xe2d6('0x35')](_0x174f3e);}return _0x1b9ad6[_0xe2d6('0x36')]();};}function saveUpdates(_0x1adb70,_0x37b298){return function(_0x6920d5){if(_0x6920d5){return _0x6920d5[_0xe2d6('0x37')](_0x1adb70)[_0xe2d6('0x21')](function(_0x38eea3){return _0x38eea3;});}return null;};}function removeEntity(_0x216f30,_0x58fb93){return function(_0x2a88bc){if(_0x2a88bc){return _0x2a88bc['destroy']()['then'](function(){var _0x38fe5=_0x2a88bc[_0xe2d6('0x38')]({'plain':!![]});var _0x542788=_0xe2d6('0x39');return db[_0xe2d6('0x3a')]['destroy']({'where':{'type':_0x542788,'resourceId':_0x38fe5['id']}})[_0xe2d6('0x21')](function(){return _0x2a88bc;});})[_0xe2d6('0x21')](function(){_0x216f30[_0xe2d6('0x2d')](0xcc)[_0xe2d6('0x2e')]();});}};}function handleEntityNotFound(_0x12590e,_0x171cdf){return function(_0x2a7ac3){if(!_0x2a7ac3){_0x12590e[_0xe2d6('0x2c')](0x194);}return _0x2a7ac3;};}function handleError(_0x2b379c,_0x3df2ae){_0x3df2ae=_0x3df2ae||0x1f4;return function(_0x1b2e28){logger[_0xe2d6('0x28')](_0x1b2e28[_0xe2d6('0x3b')]);if(_0x1b2e28['name']){delete _0x1b2e28[_0xe2d6('0x3c')];}_0x2b379c[_0xe2d6('0x2d')](_0x3df2ae)[_0xe2d6('0x3d')](_0x1b2e28);};}exports[_0xe2d6('0x3e')]=function(_0x3368ce,_0x5cb850){var _0x1d86ee={'include':[{'model':db[_0xe2d6('0x3f')],'as':'Imap'},{'model':db[_0xe2d6('0x40')],'as':'Smtp'},{'model':db[_0xe2d6('0x41')],'as':'mandatoryDispositionPause'}]},_0x78724e={},_0x2a6db2={'count':0x0,'rows':[]};var _0x12522c=_[_0xe2d6('0x42')](db[_0xe2d6('0x43')]['rawAttributes'],function(_0x2deb3e){return{'name':_0x2deb3e[_0xe2d6('0x44')],'type':_0x2deb3e[_0xe2d6('0x45')][_0xe2d6('0x46')]};});_0x78724e['model']=_[_0xe2d6('0x42')](_0x12522c,'name');_0x78724e['query']=_[_0xe2d6('0x47')](_0x3368ce['query']);_0x78724e[_0xe2d6('0x48')]=_[_0xe2d6('0x49')](_0x78724e[_0xe2d6('0x4a')],_0x78724e[_0xe2d6('0x4b')]);_0x1d86ee[_0xe2d6('0x4c')]=_['intersection'](_0x78724e['model'],qs[_0xe2d6('0x4d')](_0x3368ce[_0xe2d6('0x4b')]['fields']));_0x1d86ee['attributes']=_0x1d86ee[_0xe2d6('0x4c')][_0xe2d6('0x4e')]?_0x1d86ee[_0xe2d6('0x4c')]:_0x78724e[_0xe2d6('0x4a')];if(!_0x3368ce[_0xe2d6('0x4b')][_0xe2d6('0x4f')](_0xe2d6('0x50'))){_0x1d86ee[_0xe2d6('0x31')]=qs[_0xe2d6('0x31')](_0x3368ce[_0xe2d6('0x4b')][_0xe2d6('0x31')]);_0x1d86ee[_0xe2d6('0x30')]=qs[_0xe2d6('0x30')](_0x3368ce[_0xe2d6('0x4b')][_0xe2d6('0x30')]);}_0x1d86ee[_0xe2d6('0x51')]=qs[_0xe2d6('0x52')](_0x3368ce[_0xe2d6('0x4b')]['sort']);_0x1d86ee[_0xe2d6('0x53')]=qs[_0xe2d6('0x48')](_['pick'](_0x3368ce['query'],_0x78724e['filters']),_0x12522c);if(_0x3368ce['query'][_0xe2d6('0x54')]){_0x1d86ee[_0xe2d6('0x53')]=_[_0xe2d6('0x55')](_0x1d86ee['where'],{'$or':_['map'](_0x12522c,function(_0x1eeb00){if(_0x1eeb00['type']!=='VIRTUAL'){var _0x3512b4={};_0x3512b4[_0x1eeb00[_0xe2d6('0x3c')]]={'$like':'%'+_0x3368ce['query'][_0xe2d6('0x54')]+'%'};return _0x3512b4;}})});}_0x1d86ee=_[_0xe2d6('0x55')]({},_0x1d86ee,_0x3368ce[_0xe2d6('0x56')]);var _0x38d1ad={'where':_0x1d86ee[_0xe2d6('0x53')]};return db[_0xe2d6('0x43')][_0xe2d6('0x57')](_0x38d1ad)[_0xe2d6('0x21')](function(_0x54156d){_0x2a6db2[_0xe2d6('0x57')]=_0x54156d;if(_0x3368ce[_0xe2d6('0x4b')][_0xe2d6('0x58')]){_0x1d86ee[_0xe2d6('0x59')]=[{'all':!![]}];}return db[_0xe2d6('0x43')][_0xe2d6('0x5a')](_0x1d86ee);})[_0xe2d6('0x21')](function(_0xfaf60b){_0x2a6db2['rows']=_0xfaf60b;return _0x2a6db2;})[_0xe2d6('0x21')](respondWithFilteredResult(_0x5cb850,_0x1d86ee))[_0xe2d6('0x2b')](handleError(_0x5cb850,null));};exports[_0xe2d6('0x5b')]=function(_0x3cc104,_0x181267){var _0x3acacf={'raw':![],'where':{'id':_0x3cc104['params']['id']},'include':[{'model':db[_0xe2d6('0x3f')],'as':_0xe2d6('0x5c')},{'model':db[_0xe2d6('0x40')],'as':'Smtp'},{'model':db['Pause'],'as':_0xe2d6('0x5d')}]},_0x5ce17e={};_0x5ce17e[_0xe2d6('0x4a')]=_[_0xe2d6('0x47')](db[_0xe2d6('0x43')][_0xe2d6('0x5e')]);_0x5ce17e[_0xe2d6('0x4b')]=_['keys'](_0x3cc104[_0xe2d6('0x4b')]);_0x5ce17e[_0xe2d6('0x48')]=_[_0xe2d6('0x49')](_0x5ce17e['model'],_0x5ce17e['query']);_0x3acacf[_0xe2d6('0x4c')]=_[_0xe2d6('0x49')](_0x5ce17e[_0xe2d6('0x4a')],qs[_0xe2d6('0x4d')](_0x3cc104['query'][_0xe2d6('0x4d')]));_0x3acacf[_0xe2d6('0x4c')]=_0x3acacf[_0xe2d6('0x4c')][_0xe2d6('0x4e')]?_0x3acacf[_0xe2d6('0x4c')]:_0x5ce17e[_0xe2d6('0x4a')];if(_0x3cc104[_0xe2d6('0x4b')][_0xe2d6('0x58')]){_0x3acacf[_0xe2d6('0x59')]=[{'all':!![]}];}_0x3acacf=_[_0xe2d6('0x55')]({},_0x3acacf,_0x3cc104[_0xe2d6('0x56')]);return db[_0xe2d6('0x43')][_0xe2d6('0x5f')](_0x3acacf)[_0xe2d6('0x21')](handleEntityNotFound(_0x181267,null))[_0xe2d6('0x21')](respondWithResult(_0x181267,null))[_0xe2d6('0x2b')](handleError(_0x181267,null));};exports[_0xe2d6('0x37')]=function(_0x43d4b5,_0x198112){if(_0x43d4b5[_0xe2d6('0x60')]['id']){delete _0x43d4b5[_0xe2d6('0x60')]['id'];}return db[_0xe2d6('0x43')]['find']({'where':{'id':_0x43d4b5[_0xe2d6('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xe2d6('0x5c')},{'model':db['MailServerOut'],'as':_0xe2d6('0x62')},{'model':db[_0xe2d6('0x41')],'as':_0xe2d6('0x5d')}]})[_0xe2d6('0x21')](handleEntityNotFound(_0x198112,null))['then'](saveUpdates(_0x43d4b5['body'],null))['then'](function(_0x44a80b){if(_0x44a80b&&_0x43d4b5['body'][_0xe2d6('0x5c')]){return db[_0xe2d6('0x3f')][_0xe2d6('0x37')](_0x43d4b5[_0xe2d6('0x60')][_0xe2d6('0x5c')],{'where':{'MailAccountId':_0x44a80b['id']}})[_0xe2d6('0x21')](function(){return _0x44a80b;});}return _0x44a80b;})[_0xe2d6('0x21')](function(_0x5492e5){if(_0x5492e5&&_0x43d4b5['body'][_0xe2d6('0x62')]){return db[_0xe2d6('0x40')][_0xe2d6('0x37')](_0x43d4b5[_0xe2d6('0x60')]['Smtp'],{'where':{'MailAccountId':_0x5492e5['id']}})[_0xe2d6('0x21')](function(){return _0x5492e5;});}return _0x5492e5;})[_0xe2d6('0x21')](respondWithResult(_0x198112,null))[_0xe2d6('0x2b')](handleError(_0x198112,null));};exports[_0xe2d6('0x63')]=function(_0x50de9d,_0x360c3b){return db['MailAccount']['describe']()[_0xe2d6('0x21')](respondWithResult(_0x360c3b,null))[_0xe2d6('0x2b')](handleError(_0x360c3b,null));};exports[_0xe2d6('0x64')]=function(_0x5ac485,_0x2ef1db,_0x4c02bb){if(_0x5ac485[_0xe2d6('0x60')]['id']){delete _0x5ac485[_0xe2d6('0x60')]['id'];}return db[_0xe2d6('0x43')]['find']({'where':{'id':_0x5ac485['params']['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x2ef1db,null))['then'](function(_0xcb19f1){if(_0xcb19f1){_0x5ac485[_0xe2d6('0x60')][_0xe2d6('0x65')]=_0xcb19f1['id'];return db['Disposition'][_0xe2d6('0x66')](_0x5ac485[_0xe2d6('0x60')]);}})['then'](respondWithResult(_0x2ef1db,null))[_0xe2d6('0x2b')](handleError(_0x2ef1db,null));};exports[_0xe2d6('0x67')]=function(_0x502eaf,_0x340d1b,_0x15262e){var _0x538538={'raw':![],'where':{}};var _0x4e8451={};var _0xfd7bee={'count':0x0,'rows':[]};return db[_0xe2d6('0x43')]['findOne']({'where':{'id':_0x502eaf[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x340d1b,null))['then'](function(_0xe5f95){if(_0xe5f95){_0x4e8451[_0xe2d6('0x4a')]=_[_0xe2d6('0x47')](db[_0xe2d6('0x68')][_0xe2d6('0x5e')]);_0x4e8451['query']=_[_0xe2d6('0x47')](_0x502eaf[_0xe2d6('0x4b')]);_0x4e8451['filters']=_[_0xe2d6('0x49')](_0x4e8451[_0xe2d6('0x4a')],_0x4e8451['query']);_0x538538[_0xe2d6('0x4c')]=_[_0xe2d6('0x49')](_0x4e8451[_0xe2d6('0x4a')],qs[_0xe2d6('0x4d')](_0x502eaf[_0xe2d6('0x4b')]['fields']));_0x538538[_0xe2d6('0x4c')]=_0x538538['attributes'][_0xe2d6('0x4e')]?_0x538538[_0xe2d6('0x4c')]:_0x4e8451[_0xe2d6('0x4a')];if(!_0x502eaf['query'][_0xe2d6('0x4f')]('nolimit')){_0x538538[_0xe2d6('0x31')]=qs['limit'](_0x502eaf['query'][_0xe2d6('0x31')]);_0x538538['offset']=qs[_0xe2d6('0x30')](_0x502eaf[_0xe2d6('0x4b')][_0xe2d6('0x30')]);}_0x538538[_0xe2d6('0x51')]=qs[_0xe2d6('0x52')](_0x502eaf['query'][_0xe2d6('0x52')]);_0x538538[_0xe2d6('0x53')]=qs[_0xe2d6('0x48')](_[_0xe2d6('0x69')](_0x502eaf['query'],_0x4e8451['filters']));_0x538538['where'][_0xe2d6('0x65')]=_0xe5f95['id'];if(_0x502eaf[_0xe2d6('0x4b')][_0xe2d6('0x54')]){_0x538538[_0xe2d6('0x53')]=_['merge'](_0x538538[_0xe2d6('0x53')],{'$or':_[_0xe2d6('0x42')](_0x538538[_0xe2d6('0x4c')],function(_0x48a06e){var _0x329e18={};_0x329e18[_0x48a06e]={'$like':'%'+_0x502eaf[_0xe2d6('0x4b')]['filter']+'%'};return _0x329e18;})});}_0x538538=_[_0xe2d6('0x55')]({},_0x538538,_0x502eaf[_0xe2d6('0x56')]);return db[_0xe2d6('0x68')][_0xe2d6('0x57')]({'where':_0x538538[_0xe2d6('0x53')]})[_0xe2d6('0x21')](function(_0x47f498){_0xfd7bee[_0xe2d6('0x57')]=_0x47f498;if(_0x502eaf[_0xe2d6('0x4b')][_0xe2d6('0x58')]){_0x538538[_0xe2d6('0x59')]=[{'all':!![]}];}return db['Disposition'][_0xe2d6('0x5a')](_0x538538);})[_0xe2d6('0x21')](function(_0xa802d9){_0xfd7bee['rows']=_0xa802d9;return _0xfd7bee;});}})[_0xe2d6('0x21')](respondWithFilteredResult(_0x340d1b,_0x538538))[_0xe2d6('0x2b')](handleError(_0x340d1b,null));};exports[_0xe2d6('0x6a')]=function(_0x42f1ee,_0x3e0f79,_0x546af9){return db[_0xe2d6('0x43')]['find']({'where':{'id':_0x42f1ee['params']['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x3e0f79,null))[_0xe2d6('0x21')](function(_0x438a46){if(_0x438a46){return _0x438a46[_0xe2d6('0x6a')](_0x42f1ee['query'][_0xe2d6('0x6b')]);}})[_0xe2d6('0x21')](respondWithStatusCode(_0x3e0f79,null))[_0xe2d6('0x2b')](handleError(_0x3e0f79,null));};exports[_0xe2d6('0x6c')]=function(_0xcf66f4,_0x12e856,_0x23e2c7){if(_0xcf66f4[_0xe2d6('0x60')]['id']){delete _0xcf66f4[_0xe2d6('0x60')]['id'];}return db[_0xe2d6('0x43')][_0xe2d6('0x5f')]({'where':{'id':_0xcf66f4[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x12e856,null))['then'](function(_0x48e096){if(_0x48e096){_0xcf66f4[_0xe2d6('0x60')][_0xe2d6('0x65')]=_0x48e096['id'];return db[_0xe2d6('0x6d')][_0xe2d6('0x66')](_0xcf66f4[_0xe2d6('0x60')]);}})[_0xe2d6('0x21')](respondWithResult(_0x12e856,null))[_0xe2d6('0x2b')](handleError(_0x12e856,null));};exports[_0xe2d6('0x6e')]=function(_0x584593,_0x3d6d00,_0x220264){var _0x321dc3={'raw':![],'where':{}};var _0x50efff={};var _0x1ab41b={'count':0x0,'rows':[]};return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x584593['params']['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x3d6d00,null))['then'](function(_0x5025d5){if(_0x5025d5){_0x50efff[_0xe2d6('0x4a')]=_['keys'](db[_0xe2d6('0x6d')]['rawAttributes']);_0x50efff[_0xe2d6('0x4b')]=_[_0xe2d6('0x47')](_0x584593[_0xe2d6('0x4b')]);_0x50efff[_0xe2d6('0x48')]=_['intersection'](_0x50efff[_0xe2d6('0x4a')],_0x50efff[_0xe2d6('0x4b')]);_0x321dc3[_0xe2d6('0x4c')]=_[_0xe2d6('0x49')](_0x50efff[_0xe2d6('0x4a')],qs[_0xe2d6('0x4d')](_0x584593['query']['fields']));_0x321dc3[_0xe2d6('0x4c')]=_0x321dc3[_0xe2d6('0x4c')][_0xe2d6('0x4e')]?_0x321dc3[_0xe2d6('0x4c')]:_0x50efff[_0xe2d6('0x4a')];if(!_0x584593[_0xe2d6('0x4b')][_0xe2d6('0x4f')](_0xe2d6('0x50'))){_0x321dc3[_0xe2d6('0x31')]=qs[_0xe2d6('0x31')](_0x584593[_0xe2d6('0x4b')]['limit']);_0x321dc3[_0xe2d6('0x30')]=qs[_0xe2d6('0x30')](_0x584593[_0xe2d6('0x4b')][_0xe2d6('0x30')]);}_0x321dc3['order']=qs[_0xe2d6('0x52')](_0x584593[_0xe2d6('0x4b')]['sort']);_0x321dc3['where']=qs[_0xe2d6('0x48')](_[_0xe2d6('0x69')](_0x584593['query'],_0x50efff[_0xe2d6('0x48')]));_0x321dc3[_0xe2d6('0x53')][_0xe2d6('0x65')]=_0x5025d5['id'];if(_0x584593['query']['filter']){_0x321dc3[_0xe2d6('0x53')]=_[_0xe2d6('0x55')](_0x321dc3[_0xe2d6('0x53')],{'$or':_[_0xe2d6('0x42')](_0x321dc3['attributes'],function(_0x4c4196){var _0x3c233b={};_0x3c233b[_0x4c4196]={'$like':'%'+_0x584593[_0xe2d6('0x4b')][_0xe2d6('0x54')]+'%'};return _0x3c233b;})});}_0x321dc3=_['merge']({},_0x321dc3,_0x584593[_0xe2d6('0x56')]);return db['CannedAnswer'][_0xe2d6('0x57')]({'where':_0x321dc3[_0xe2d6('0x53')]})[_0xe2d6('0x21')](function(_0x49e022){_0x1ab41b[_0xe2d6('0x57')]=_0x49e022;if(_0x584593[_0xe2d6('0x4b')][_0xe2d6('0x58')]){_0x321dc3['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x321dc3);})[_0xe2d6('0x21')](function(_0x2a7d11){_0x1ab41b['rows']=_0x2a7d11;return _0x1ab41b;});}})['then'](respondWithFilteredResult(_0x3d6d00,_0x321dc3))[_0xe2d6('0x2b')](handleError(_0x3d6d00,null));};exports[_0xe2d6('0x70')]=function(_0x532d7a,_0x3cbbc0,_0x506a60){return db[_0xe2d6('0x43')]['find']({'where':{'id':_0x532d7a[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x3cbbc0,null))[_0xe2d6('0x21')](function(_0x1f65f5){if(_0x1f65f5){return _0x1f65f5[_0xe2d6('0x70')](_0x532d7a['query'][_0xe2d6('0x6b')]);}})[_0xe2d6('0x21')](respondWithStatusCode(_0x3cbbc0,null))[_0xe2d6('0x2b')](handleError(_0x3cbbc0,null));};exports['create']=function(_0x5044b0,_0x1439f7){var _0x57cc4a={'name':_0x5044b0[_0xe2d6('0x60')]['name'],'key':_0x5044b0['body'][_0xe2d6('0x46')],'email':_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x71')],'ListId':_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x72')],'active':!_[_0xe2d6('0x73')](_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x74')])?_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x74')]:!![],'description':_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0xe2d6('0x73')](_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x76')])){if(_0x5044b0[_0xe2d6('0x60')]['cauthentication']){_0x57cc4a[_0xe2d6('0x5c')][_0xe2d6('0x77')]=_0x57cc4a[_0xe2d6('0x62')]['user']=_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x78')];_0x57cc4a[_0xe2d6('0x5c')][_0xe2d6('0x79')]=_0x57cc4a[_0xe2d6('0x62')][_0xe2d6('0x7a')]=_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x7b')];}else{_0x57cc4a[_0xe2d6('0x5c')][_0xe2d6('0x7c')]=_0x57cc4a[_0xe2d6('0x62')][_0xe2d6('0x7c')]=![];}_0x57cc4a['Imap'][_0xe2d6('0x7d')]=_0x5044b0['body'][_0xe2d6('0x5c')]['host'];_0x57cc4a[_0xe2d6('0x5c')]['port']=_0x5044b0[_0xe2d6('0x60')]['Imap']['port'];_0x57cc4a[_0xe2d6('0x62')][_0xe2d6('0x7d')]=_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x62')][_0xe2d6('0x7d')];_0x57cc4a[_0xe2d6('0x62')][_0xe2d6('0x7e')]=_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x62')][_0xe2d6('0x7e')];}else{_0x57cc4a[_0xe2d6('0x5c')][_0xe2d6('0x7f')]=_0x57cc4a['Smtp'][_0xe2d6('0x7f')]=_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x76')];_0x57cc4a[_0xe2d6('0x5c')][_0xe2d6('0x77')]=_0x57cc4a[_0xe2d6('0x62')][_0xe2d6('0x77')]=_0x5044b0[_0xe2d6('0x60')]['cuser'];_0x57cc4a['Imap'][_0xe2d6('0x79')]=_0x57cc4a[_0xe2d6('0x62')]['pass']=_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x7b')];}return db['MailAccount']['create'](_0x57cc4a,{'include':[{'model':db[_0xe2d6('0x40')],'as':_0xe2d6('0x62')},{'model':db[_0xe2d6('0x3f')],'as':_0xe2d6('0x5c')}]})[_0xe2d6('0x21')](function(_0x102b39){var _0x40d92e=_0x5044b0['user'][_0xe2d6('0x38')]({'plain':!![]});if(!_0x40d92e)throw new Error(_0xe2d6('0x80'));if(_0x40d92e['role']===_0xe2d6('0x77')){var _0xc8465c=_0x102b39['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xe2d6('0x39'),'userProfileId':_0x40d92e[_0xe2d6('0x81')]},'raw':!![]})['then'](function(_0x1e33cb){if(_0x1e33cb&&_0x1e33cb[_0xe2d6('0x82')]===0x0){return db[_0xe2d6('0x3a')][_0xe2d6('0x66')]({'name':_0xc8465c[_0xe2d6('0x3c')],'resourceId':_0xc8465c['id'],'type':_0x1e33cb[_0xe2d6('0x3c')],'sectionId':_0x1e33cb['id']},{})['then'](function(){return _0x102b39;});}else{return _0x102b39;}})['catch'](function(_0x58c190){logger[_0xe2d6('0x28')](_0xe2d6('0x83'),_0x58c190);throw _0x58c190;});}return _0x102b39;})[_0xe2d6('0x21')](respondWithResult(_0x1439f7,0xc9))[_0xe2d6('0x2b')](handleError(_0x1439f7,null));};exports['getImap']=function(_0xa10f5a,_0x176a38,_0x21007d){return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0xa10f5a[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x176a38,null))[_0xe2d6('0x21')](function(_0x5ebd88){if(_0x5ebd88){return _0x5ebd88['getImap']();}return null;})[_0xe2d6('0x21')](respondWithResult(_0x176a38,null))[_0xe2d6('0x2b')](handleError(_0x176a38,null));};exports[_0xe2d6('0x84')]=function(_0xacd9c6,_0x550df8,_0x59b2e1){if(_0xacd9c6[_0xe2d6('0x60')]['id']){delete _0xacd9c6[_0xe2d6('0x60')]['id'];}return db[_0xe2d6('0x43')]['find']({'where':{'id':_0xacd9c6['params']['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x550df8,null))['then'](function(_0x40041b){if(_0x40041b){_0xacd9c6[_0xe2d6('0x60')]['MailAccountId']=_0x40041b['id'];return db[_0xe2d6('0x3f')][_0xe2d6('0x66')](_0xacd9c6[_0xe2d6('0x60')]);}})['then'](respondWithResult(_0x550df8,null))[_0xe2d6('0x2b')](handleError(_0x550df8,null));};exports[_0xe2d6('0x85')]=function(_0x4b07a2,_0x93a5b,_0x511461){return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x4b07a2[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x93a5b,null))['then'](function(_0x225cf4){if(_0x225cf4){return _0x225cf4['setImap'](null);}return null;})[_0xe2d6('0x21')](respondWithStatusCode(_0x93a5b,null))[_0xe2d6('0x2b')](handleError(_0x93a5b,null));};exports['getSmtp']=function(_0x1031f5,_0x34eac7,_0x36636d){return db['MailAccount']['findOne']({'where':{'id':_0x1031f5[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x34eac7,null))[_0xe2d6('0x21')](function(_0x5bd7e8){if(_0x5bd7e8){return _0x5bd7e8[_0xe2d6('0x86')]();}return null;})['then'](respondWithResult(_0x34eac7,null))[_0xe2d6('0x2b')](handleError(_0x34eac7,null));};exports['addSmtp']=function(_0x1443dd,_0x5cc1be,_0x237982){if(_0x1443dd[_0xe2d6('0x60')]['id']){delete _0x1443dd['body']['id'];}return db[_0xe2d6('0x43')][_0xe2d6('0x5f')]({'where':{'id':_0x1443dd[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x5cc1be,null))[_0xe2d6('0x21')](function(_0x276704){if(_0x276704){_0x1443dd[_0xe2d6('0x60')][_0xe2d6('0x65')]=_0x276704['id'];return db[_0xe2d6('0x40')][_0xe2d6('0x66')](_0x1443dd[_0xe2d6('0x60')]);}})[_0xe2d6('0x21')](respondWithResult(_0x5cc1be,null))[_0xe2d6('0x2b')](handleError(_0x5cc1be,null));};exports[_0xe2d6('0x87')]=function(_0x5af208,_0x53b432,_0xd43fbc){return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x5af208[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x53b432,null))[_0xe2d6('0x21')](function(_0x58f30d){if(_0x58f30d){return _0x58f30d[_0xe2d6('0x88')](null);}return null;})[_0xe2d6('0x21')](respondWithStatusCode(_0x53b432,null))[_0xe2d6('0x2b')](handleError(_0x53b432,null));};exports['addInteraction']=function(_0x46f020,_0xa4f920,_0x341683){return db[_0xe2d6('0x89')][_0xe2d6('0x5f')]({'where':{'id':_0x46f020['params']['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0xa4f920,null))['then'](function(_0x4749c9){if(_0x4749c9){return _0x4749c9[_0xe2d6('0x8a')](_0x46f020['body'][_0xe2d6('0x6b')],_[_0xe2d6('0x8b')](_0x46f020[_0xe2d6('0x60')],['ids','id'])||{});}})[_0xe2d6('0x21')](respondWithResult(_0xa4f920,null))['catch'](handleError(_0xa4f920,null));};exports[_0xe2d6('0x8c')]=function(_0x5a082b,_0x14eaaf,_0x1b830a){var _0x2cda28={'raw':![],'where':{}};var _0x3bab16={};var _0x44f34f={'count':0x0,'rows':[]};return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x5a082b[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x14eaaf,null))[_0xe2d6('0x21')](function(_0x2b0707){if(_0x2b0707){_0x3bab16[_0xe2d6('0x4a')]=_['keys'](db[_0xe2d6('0x89')][_0xe2d6('0x5e')]);_0x3bab16['query']=_[_0xe2d6('0x47')](_0x5a082b[_0xe2d6('0x4b')]);_0x3bab16['filters']=_[_0xe2d6('0x49')](_0x3bab16[_0xe2d6('0x4a')],_0x3bab16[_0xe2d6('0x4b')]);_0x2cda28['attributes']=_[_0xe2d6('0x49')](_0x3bab16[_0xe2d6('0x4a')],qs[_0xe2d6('0x4d')](_0x5a082b['query'][_0xe2d6('0x4d')]));_0x2cda28['attributes']=_0x2cda28[_0xe2d6('0x4c')]['length']?_0x2cda28[_0xe2d6('0x4c')]:_0x3bab16[_0xe2d6('0x4a')];if(!_0x5a082b['query'][_0xe2d6('0x4f')](_0xe2d6('0x50'))){_0x2cda28[_0xe2d6('0x31')]=qs['limit'](_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x31')]);_0x2cda28[_0xe2d6('0x30')]=qs[_0xe2d6('0x30')](_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x30')]);}_0x2cda28[_0xe2d6('0x51')]=qs[_0xe2d6('0x52')](_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x52')]);_0x2cda28[_0xe2d6('0x53')]=qs[_0xe2d6('0x48')](_['pick'](_0x5a082b[_0xe2d6('0x4b')],_0x3bab16[_0xe2d6('0x48')]));_0x2cda28[_0xe2d6('0x53')][_0xe2d6('0x65')]=_0x2b0707['id'];if(_0x5a082b['query'][_0xe2d6('0x54')]){_0x2cda28[_0xe2d6('0x53')]=_[_0xe2d6('0x55')](_0x2cda28[_0xe2d6('0x53')],{'$or':_[_0xe2d6('0x42')](_0x2cda28[_0xe2d6('0x4c')],function(_0x1fc6dd){var _0x354bac={};_0x354bac[_0x1fc6dd]={'$like':'%'+_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x54')]+'%'};return _0x354bac;})});}_0x2cda28=_[_0xe2d6('0x55')]({},_0x2cda28,_0x5a082b[_0xe2d6('0x56')]);return db[_0xe2d6('0x89')][_0xe2d6('0x57')]({'where':_0x2cda28[_0xe2d6('0x53')]})[_0xe2d6('0x21')](function(_0x7d8ad3){_0x44f34f[_0xe2d6('0x57')]=_0x7d8ad3;if(_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x58')]){_0x2cda28[_0xe2d6('0x59')]=[{'model':db[_0xe2d6('0x8d')],'as':'Contact','required':![]},{'model':db[_0xe2d6('0x8e')],'as':_0xe2d6('0x8f'),'attributes':[_0xe2d6('0x3c'),_0xe2d6('0x90'),_0xe2d6('0x91')],'required':![]},{'model':db[_0xe2d6('0x92')],'as':_0xe2d6('0x93'),'attributes':['id',_0xe2d6('0x3c'),_0xe2d6('0x94')],'where':_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x95')]?{'id':_0x5a082b['query'][_0xe2d6('0x95')]}:undefined,'required':_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x95')]?!![]:![]}];}return db[_0xe2d6('0x89')][_0xe2d6('0x5a')](_0x2cda28);})[_0xe2d6('0x21')](function(_0x578fc3){_0x44f34f[_0xe2d6('0x96')]=_0x578fc3;return _0x44f34f;});}})['then'](respondWithFilteredResult(_0x14eaaf,_0x2cda28))[_0xe2d6('0x2b')](handleError(_0x14eaaf,null));};exports[_0xe2d6('0x97')]=function(_0x2cb8bc,_0x3724df,_0x3a3d12){return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x2cb8bc[_0xe2d6('0x61')]['id']}})['then'](handleEntityNotFound(_0x3724df,null))[_0xe2d6('0x21')](function(_0x5f6b86){if(_0x5f6b86){return db[_0xe2d6('0x98')]['transaction'](function(_0x5ecd77){return db[_0xe2d6('0x99')][_0xe2d6('0x9a')]({'where':{'MailAccountId':_0x2cb8bc[_0xe2d6('0x61')]['id']},'transaction':_0x5ecd77})['then'](function(_0x229374){var _0x58f1ed=_[_0xe2d6('0x42')](_0x2cb8bc[_0xe2d6('0x60')],function(_0x1c74be){_0x1c74be[_0xe2d6('0x65')]=_0x2cb8bc[_0xe2d6('0x61')]['id'];return _0x1c74be;});return db[_0xe2d6('0x99')][_0xe2d6('0x9b')](_0x58f1ed,{'transaction':_0x5ecd77});});})[_0xe2d6('0x21')](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x2cb8bc[_0xe2d6('0x61')]['id']},'order':_0xe2d6('0x9c')});});}})[_0xe2d6('0x21')](respondWithResult(_0x3724df,null))[_0xe2d6('0x2b')](handleError(_0x3724df,null));};exports[_0xe2d6('0x9d')]=function(_0x568e07,_0x2562a7,_0xb8e9a3){var _0xd76eb1={};var _0x6790d4={};var _0x562882;var _0x3c5129;return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x568e07[_0xe2d6('0x61')]['id']}})['then'](handleEntityNotFound(_0x2562a7,null))[_0xe2d6('0x21')](function(_0x580bf3){if(_0x580bf3){_0x562882=_0x580bf3;_0x6790d4[_0xe2d6('0x4a')]=_['keys'](db[_0xe2d6('0x99')][_0xe2d6('0x5e')]);_0x6790d4[_0xe2d6('0x4b')]=_[_0xe2d6('0x47')](_0x568e07[_0xe2d6('0x4b')]);_0x6790d4[_0xe2d6('0x48')]=_[_0xe2d6('0x49')](_0x6790d4['model'],_0x6790d4['query']);_0xd76eb1[_0xe2d6('0x4c')]=_[_0xe2d6('0x49')](_0x6790d4[_0xe2d6('0x4a')],qs[_0xe2d6('0x4d')](_0x568e07[_0xe2d6('0x4b')][_0xe2d6('0x4d')]));_0xd76eb1[_0xe2d6('0x4c')]=_0xd76eb1[_0xe2d6('0x4c')][_0xe2d6('0x4e')]?_0xd76eb1['attributes']:_0x6790d4[_0xe2d6('0x4a')];_0xd76eb1[_0xe2d6('0x51')]=qs[_0xe2d6('0x52')](_0x568e07[_0xe2d6('0x4b')]['sort']);_0xd76eb1[_0xe2d6('0x53')]=qs[_0xe2d6('0x48')](_[_0xe2d6('0x69')](_0x568e07[_0xe2d6('0x4b')],_0x6790d4[_0xe2d6('0x48')]));if(_0x568e07[_0xe2d6('0x4b')][_0xe2d6('0x54')]){_0xd76eb1['where']=_[_0xe2d6('0x55')](_0xd76eb1[_0xe2d6('0x53')],{'$or':_[_0xe2d6('0x42')](_0xd76eb1[_0xe2d6('0x4c')],function(_0x3f9ef0){var _0x3e1bdb={};_0x3e1bdb[_0x3f9ef0]={'$like':'%'+_0x568e07[_0xe2d6('0x4b')]['filter']+'%'};return _0x3e1bdb;})});}_0xd76eb1=_[_0xe2d6('0x55')]({},_0xd76eb1,_0x568e07[_0xe2d6('0x56')]);return _0x562882[_0xe2d6('0x9d')](_0xd76eb1);}})[_0xe2d6('0x21')](function(_0x49afa7){if(_0x49afa7){_0x3c5129=_0x49afa7[_0xe2d6('0x4e')];if(!_0x568e07[_0xe2d6('0x4b')]['hasOwnProperty'](_0xe2d6('0x50'))){_0xd76eb1[_0xe2d6('0x31')]=qs[_0xe2d6('0x31')](_0x568e07['query'][_0xe2d6('0x31')]);_0xd76eb1['offset']=qs[_0xe2d6('0x30')](_0x568e07[_0xe2d6('0x4b')][_0xe2d6('0x30')]);}return _0x562882[_0xe2d6('0x9d')](_0xd76eb1);}})['then'](function(_0x1ae853){if(_0x1ae853){return _0x1ae853?{'count':_0x3c5129,'rows':_0x1ae853}:null;}})[_0xe2d6('0x21')](respondWithResult(_0x2562a7,null))['catch'](handleError(_0x2562a7,null));};exports[_0xe2d6('0x9e')]=function(_0x33a766,_0x310388,_0x2173d8){var _0x4454fa={'raw':!![],'where':{}};var _0x409ebd={};var _0x1e0d24={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x33a766[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x310388,null))['then'](function(_0x3e096b){if(_0x3e096b){_0x409ebd[_0xe2d6('0x4a')]=_[_0xe2d6('0x47')](db['MailMessage'][_0xe2d6('0x5e')]);_0x409ebd[_0xe2d6('0x4b')]=_['keys'](_0x33a766[_0xe2d6('0x4b')]);_0x409ebd[_0xe2d6('0x48')]=_[_0xe2d6('0x49')](_0x409ebd['model'],_0x409ebd[_0xe2d6('0x4b')]);_0x4454fa['attributes']=_[_0xe2d6('0x49')](_0x409ebd[_0xe2d6('0x4a')],qs['fields'](_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0x4d')]));_0x4454fa['attributes']=_0x4454fa[_0xe2d6('0x4c')][_0xe2d6('0x4e')]?_0x4454fa['attributes']:_0x409ebd[_0xe2d6('0x4a')];if(!_0x33a766[_0xe2d6('0x4b')]['hasOwnProperty']('nolimit')){_0x4454fa[_0xe2d6('0x31')]=qs['limit'](_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0x31')]);_0x4454fa[_0xe2d6('0x30')]=qs[_0xe2d6('0x30')](_0x33a766['query'][_0xe2d6('0x30')]);}_0x4454fa['order']=qs[_0xe2d6('0x52')](_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0x52')]);_0x4454fa[_0xe2d6('0x53')]=qs[_0xe2d6('0x48')](_[_0xe2d6('0x69')](_0x33a766[_0xe2d6('0x4b')],_0x409ebd[_0xe2d6('0x48')]));_0x4454fa[_0xe2d6('0x53')][_0xe2d6('0x65')]=_0x3e096b['id'];if(_0x33a766['query'][_0xe2d6('0x54')]){_0x4454fa[_0xe2d6('0x53')]=_[_0xe2d6('0x55')](_0x4454fa[_0xe2d6('0x53')],{'$or':_['map'](_0x4454fa[_0xe2d6('0x4c')],function(_0x1c7911){var _0x5acefb={};_0x5acefb[_0x1c7911]={'$like':'%'+_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0x54')]+'%'};return _0x5acefb;})});}if(_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0x9f')]){var _0xa27451=_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0x9f')][_0xe2d6('0xa0')](',');var _0x5caac6={};_0x5caac6[_0xa27451[0x0]]={'$gte':moment(_0xa27451[0x1])[_0xe2d6('0xa1')](_0xe2d6('0xa2'))};_0x4454fa[_0xe2d6('0x53')]=_[_0xe2d6('0x55')](_0x4454fa['where'],_0x5caac6);}_0x4454fa=_[_0xe2d6('0x55')]({},_0x4454fa,_0x33a766[_0xe2d6('0x56')]);return db[_0xe2d6('0xa3')][_0xe2d6('0x57')]({'where':_0x4454fa[_0xe2d6('0x53')]})[_0xe2d6('0x21')](function(_0x287251){_0x1e0d24[_0xe2d6('0x57')]=_0x287251;if(_0x33a766[_0xe2d6('0x4b')]['includeAll']){_0x4454fa[_0xe2d6('0x59')]=[{'all':!![]}];}return db[_0xe2d6('0xa3')][_0xe2d6('0x5a')](_0x4454fa);})['then'](function(_0x5e6ebe){if(_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0xa4')]===_0xe2d6('0xa5')){for(var _0x3454d2=0x0;_0x3454d2<_0x5e6ebe[_0xe2d6('0x4e')];_0x3454d2++){_0x5e6ebe[_0x3454d2]['body']=juice(_0x5e6ebe[_0x3454d2][_0xe2d6('0x60')]);}}_0x1e0d24['rows']=_0x5e6ebe;return _0x1e0d24;});}})[_0xe2d6('0x21')](respondWithFilteredResult(_0x310388,_0x4454fa))[_0xe2d6('0x2b')](handleError(_0x310388,null));};exports['send']=function(_0x41c934,_0x41a798,_0x320ac4){var _0x2222c5,_0x4ea805={},_0x4256bc;if(_0x41c934['body']['to']){_0x4256bc=_0x41c934[_0xe2d6('0x60')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xe2d6('0x5f')]({'where':{'id':_0x41c934[_0xe2d6('0x61')]['id']},'include':[{'model':db[_0xe2d6('0xa6')],'as':_0xe2d6('0xa7'),'include':[{'model':db[_0xe2d6('0x8d')],'as':_0xe2d6('0xa8'),'where':{'email':_0x4256bc},'limit':0x1,'order':[[_0xe2d6('0xa9'),_0xe2d6('0xaa')]]}]},{'model':db['MailServerOut'],'as':_0xe2d6('0x62'),'raw':!![]}]})['then'](handleEntityNotFound(_0x41a798,null))[_0xe2d6('0x21')](function(_0x1ada59){if(_0x1ada59){_0x2222c5=_0x1ada59;if(_0x1ada59[_0xe2d6('0x62')]){if(_[_0xe2d6('0x73')](_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xab')])){_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xab')]=util[_0xe2d6('0xa1')](_0xe2d6('0xac'),_0x1ada59[_0xe2d6('0x3c')],_0x1ada59[_0xe2d6('0x71')]||_0x1ada59['Smtp'][_0xe2d6('0x77')]);}if(_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xad')]&&_0x41c934['body']['attachments'][_0xe2d6('0x4e')]){for(var _0x2ce7d6=0x0;_0x2ce7d6<_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xad')]['length'];_0x2ce7d6+=0x1){_0x41c934['body'][_0xe2d6('0xad')][_0x2ce7d6]={'filename':_0x41c934[_0xe2d6('0x60')]['attachments'][_0x2ce7d6]['name'],'path':path[_0xe2d6('0xae')](config[_0xe2d6('0xaf')],_0xe2d6('0xb0'),_0x41c934[_0xe2d6('0x60')]['attachments'][_0x2ce7d6]['basename'])};}}var _0xb2cbf5={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x1ada59['Smtp']['service'])){if(_0x1ada59[_0xe2d6('0x62')][_0xe2d6('0x7c')]){_0xb2cbf5[_0xe2d6('0xb1')]={'user':_0x1ada59[_0xe2d6('0x62')][_0xe2d6('0x77')],'pass':_0x1ada59['Smtp']['pass']};}_0xb2cbf5[_0xe2d6('0x7d')]=_0x1ada59[_0xe2d6('0x62')][_0xe2d6('0x7d')];_0xb2cbf5[_0xe2d6('0x7e')]=_0x1ada59[_0xe2d6('0x62')][_0xe2d6('0x7e')];_0xb2cbf5[_0xe2d6('0xb2')]=_0x1ada59[_0xe2d6('0x62')]['secure'];}else{_0xb2cbf5[_0xe2d6('0x7f')]=_0x1ada59[_0xe2d6('0x62')][_0xe2d6('0x7f')];_0xb2cbf5[_0xe2d6('0xb1')]={'user':_0x1ada59['Smtp'][_0xe2d6('0x77')],'pass':_0x1ada59[_0xe2d6('0x62')][_0xe2d6('0x7a')]};}return respondWithRpcPromise('SendMail',_0xe2d6('0xb3'),{'account':_0xb2cbf5,'message':_0x41c934[_0xe2d6('0x60')]});}else{throw new Error(_0xe2d6('0xb4'));}}})['then'](function(_0x50b7cf){if(_0x50b7cf){_0x4ea805=_0x50b7cf;if(_0x2222c5[_0xe2d6('0xa7')]){if(_0x2222c5[_0xe2d6('0xa7')]['Contacts']['length']){return _0x2222c5[_0xe2d6('0xa7')][_0xe2d6('0xa8')][0x0];}else{return db[_0xe2d6('0x8d')][_0xe2d6('0x66')](_[_0xe2d6('0xb5')](_0x41c934[_0xe2d6('0x60')],{'firstName':_0x41c934[_0xe2d6('0x60')]['to'],'email':_0x41c934[_0xe2d6('0x60')]['to'],'phone':_0x41c934[_0xe2d6('0x60')]['to'],'ListId':_0x2222c5[_0xe2d6('0x72')]}));}}else{throw new Error(_0xe2d6('0xb4'));}}})[_0xe2d6('0x21')](function(_0xf1099a){if(_0xf1099a){var _0x428042={'UserId':_0x41c934[_0xe2d6('0x77')]['id'],'ContactId':_0xf1099a['id'],'MailAccountId':_0x2222c5['id'],'inReplyTo':_0x4ea805[_0xe2d6('0xb6')],'to':_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xab')],'cc':_0x41c934[_0xe2d6('0x60')]['cc'],'subject':_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xb7')],'attach':_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xb8')],'firstMsgDirection':_0xe2d6('0xb9'),'lastMsgAt':moment()[_0xe2d6('0xa1')](_0xe2d6('0xa2')),'lastMsgDirection':_0xe2d6('0xb9'),'lastMsgBody':_0x41c934[_0xe2d6('0x60')][_0xe2d6('0x60')],'Messages':[_[_0xe2d6('0x55')](_0x41c934[_0xe2d6('0x60')],{'messageId':_0x4ea805[_0xe2d6('0xb6')],'sentAt':moment()['format'](_0xe2d6('0xa2')),'read':!![],'MailAccountId':_0x2222c5['id'],'UserId':_0x41c934[_0xe2d6('0x77')]['id'],'ContactId':_0xf1099a['id']})]};if(_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xba')]){_0x428042=_[_0xe2d6('0x55')](_0x428042,_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xba')]);}return db[_0xe2d6('0x89')][_0xe2d6('0x66')](_0x428042,{'include':[{'model':db[_0xe2d6('0xa3')],'as':_0xe2d6('0xbb')}]});}})[_0xe2d6('0x21')](respondWithResult(_0x41a798,null))[_0xe2d6('0x2b')](handleError(_0x41a798,null));};exports[_0xe2d6('0xbc')]=function(_0x10bedd,_0x19a088,_0x488c49){return db['MailAccount'][_0xe2d6('0x5f')]({'where':{'id':_0x10bedd[_0xe2d6('0x61')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xe2d6('0x62'),'raw':!![]}]})[_0xe2d6('0x21')](handleEntityNotFound(_0x19a088,null))[_0xe2d6('0x21')](function(_0xb7599){if(_0xb7599&&_0xb7599[_0xe2d6('0x62')]){var _0x229ee4={'id':_0xb7599['id'],'tls':{'rejectUnauthorized':![]}};if(_0xb7599[_0xe2d6('0x62')][_0xe2d6('0x7f')]){_0x229ee4[_0xe2d6('0x7f')]=_0xb7599['Smtp']['service'];}else{_0x229ee4[_0xe2d6('0x7d')]=_0xb7599['Smtp'][_0xe2d6('0x7d')];_0x229ee4[_0xe2d6('0x7e')]=_0xb7599[_0xe2d6('0x62')][_0xe2d6('0x7e')];_0x229ee4[_0xe2d6('0xb2')]=_0xb7599[_0xe2d6('0x62')]['secure'];}if(_0xb7599[_0xe2d6('0x62')][_0xe2d6('0x7c')]){_0x229ee4[_0xe2d6('0xb1')]={'user':_0xb7599[_0xe2d6('0x62')][_0xe2d6('0x77')],'pass':_0xb7599['Smtp'][_0xe2d6('0x7a')]};}return respondWithRpcPromise(_0xe2d6('0xbd'),_0xe2d6('0xbc'),{'account':_0x229ee4});}})[_0xe2d6('0x21')](respondWithResult(_0x19a088,null))[_0xe2d6('0x2b')](handleError(_0x19a088,null));};exports[_0xe2d6('0x9a')]=function(_0x324b4f,_0x1d01ce){return db[_0xe2d6('0x43')][_0xe2d6('0x5f')]({'where':{'id':_0x324b4f[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x1d01ce,null))[_0xe2d6('0x21')](function(_0x55fc0c){if(_0x55fc0c&&_0x55fc0c[_0xe2d6('0x7f')]){throw new db['Sequelize'][(_0xe2d6('0xbe'))](_0xe2d6('0xbf'));}return _0x55fc0c;})[_0xe2d6('0x21')](removeEntity(_0x1d01ce,null))['catch'](handleError(_0x1d01ce,null));};exports[_0xe2d6('0xc0')]=function(_0x33804f,_0x2ee199,_0x5e124e){return db['MailAccount']['find']({'where':{'id':_0x33804f[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x2ee199,null))[_0xe2d6('0x21')](function(_0x49725a){if(_0x49725a){return _0x49725a[_0xe2d6('0xc0')](_0x33804f[_0xe2d6('0x60')][_0xe2d6('0x6b')],_[_0xe2d6('0x8b')](_0x33804f[_0xe2d6('0x60')],[_0xe2d6('0x6b'),'id'])||{})[_0xe2d6('0xc1')](function(_0x3ba97f){for(var _0xb8fb84=0x0;_0xb8fb84<_0x33804f[_0xe2d6('0x60')][_0xe2d6('0x6b')][_0xe2d6('0x4e')];_0xb8fb84+=0x1){socket['emit'](_0xe2d6('0xc2'),{'UserId':_0x33804f['body']['ids'][_0xb8fb84],'MailAccountId':_0x33804f[_0xe2d6('0x61')]['id']});}return _0x3ba97f;});}})[_0xe2d6('0x21')](respondWithResult(_0x2ee199,null))['catch'](handleError(_0x2ee199,null));};exports['removeAgents']=function(_0x48fba0,_0x3d6d98,_0x45c7f1){return db[_0xe2d6('0x43')][_0xe2d6('0x5f')]({'where':{'id':_0x48fba0[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x3d6d98,null))['then'](function(_0x6803ee){if(_0x6803ee){return _0x6803ee[_0xe2d6('0xc3')](_0x48fba0[_0xe2d6('0x4b')]['ids'])[_0xe2d6('0x21')](function(){if(_[_0xe2d6('0xc4')](_0x48fba0['query'][_0xe2d6('0x6b')])){for(var _0x4861ae=0x0;_0x4861ae<_0x48fba0[_0xe2d6('0x4b')]['ids']['length'];_0x4861ae+=0x1){socket[_0xe2d6('0xc5')]('userMailAccount:remove',{'UserId':Number(_0x48fba0[_0xe2d6('0x4b')][_0xe2d6('0x6b')][_0x4861ae]),'MailAccountId':Number(_0x48fba0[_0xe2d6('0x61')]['id'])});}}else{socket['emit'](_0xe2d6('0xc6'),{'UserId':Number(_0x48fba0[_0xe2d6('0x4b')][_0xe2d6('0x6b')]),'MailAccountId':Number(_0x48fba0[_0xe2d6('0x61')]['id'])});}});}})[_0xe2d6('0x21')](respondWithStatusCode(_0x3d6d98,null))[_0xe2d6('0x2b')](handleError(_0x3d6d98,null));};exports['getAgents']=function(_0x4aa98d,_0x3441e1,_0x374197){var _0x4ee4f9={};var _0x47ee17={};var _0x4896ed;var _0x3db6b6;return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x4aa98d[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x3441e1,null))[_0xe2d6('0x21')](function(_0x42c4f3){if(_0x42c4f3){_0x4896ed=_0x42c4f3;_0x47ee17['model']=_[_0xe2d6('0x47')](db[_0xe2d6('0x8e')][_0xe2d6('0x5e')]);_0x47ee17[_0xe2d6('0x4b')]=_[_0xe2d6('0x47')](_0x4aa98d[_0xe2d6('0x4b')]);_0x47ee17[_0xe2d6('0x48')]=_['intersection'](_0x47ee17[_0xe2d6('0x4a')],_0x47ee17['query']);_0x4ee4f9[_0xe2d6('0x4c')]=_[_0xe2d6('0x49')](_0x47ee17[_0xe2d6('0x4a')],qs[_0xe2d6('0x4d')](_0x4aa98d[_0xe2d6('0x4b')][_0xe2d6('0x4d')]));_0x4ee4f9['attributes']=_0x4ee4f9[_0xe2d6('0x4c')][_0xe2d6('0x4e')]?_0x4ee4f9[_0xe2d6('0x4c')]:_0x47ee17['model'];_0x4ee4f9[_0xe2d6('0x51')]=qs[_0xe2d6('0x52')](_0x4aa98d[_0xe2d6('0x4b')]['sort']);_0x4ee4f9['where']=qs[_0xe2d6('0x48')](_[_0xe2d6('0x69')](_0x4aa98d['query'],_0x47ee17[_0xe2d6('0x48')]));if(_0x4aa98d[_0xe2d6('0x4b')][_0xe2d6('0x54')]){_0x4ee4f9[_0xe2d6('0x53')]=_[_0xe2d6('0x55')](_0x4ee4f9['where'],{'$or':_[_0xe2d6('0x42')](_0x4ee4f9[_0xe2d6('0x4c')],function(_0x3d216f){var _0x3513b4={};_0x3513b4[_0x3d216f]={'$like':'%'+_0x4aa98d[_0xe2d6('0x4b')]['filter']+'%'};return _0x3513b4;})});}_0x4ee4f9=_[_0xe2d6('0x55')]({},_0x4ee4f9,_0x4aa98d[_0xe2d6('0x56')]);return _0x4896ed['getAgents'](_0x4ee4f9);}})[_0xe2d6('0x21')](function(_0xb46f5c){if(_0xb46f5c){_0x3db6b6=_0xb46f5c['length'];if(!_0x4aa98d['query'][_0xe2d6('0x4f')](_0xe2d6('0x50'))){_0x4ee4f9[_0xe2d6('0x31')]=qs['limit'](_0x4aa98d[_0xe2d6('0x4b')][_0xe2d6('0x31')]);_0x4ee4f9[_0xe2d6('0x30')]=qs[_0xe2d6('0x30')](_0x4aa98d['query']['offset']);}return _0x4896ed[_0xe2d6('0xc7')](_0x4ee4f9);}})[_0xe2d6('0x21')](function(_0x529b00){if(_0x529b00){return _0x529b00?{'count':_0x3db6b6,'rows':_0x529b00}:null;}})[_0xe2d6('0x21')](respondWithResult(_0x3441e1,null))[_0xe2d6('0x2b')](handleError(_0x3441e1,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 453fe89..962f7e2 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 _0xbcfe=['events','MailAccount','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0xbcfe,0x68));var _0xebcf=function(_0xb601f6,_0x44326d){_0xb601f6=_0xb601f6-0x0;var _0x343546=_0xbcfe[_0xb601f6];return _0x343546;};'use strict';var EventEmitter=require(_0xebcf('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xebcf('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xebcf('0x2'),'afterUpdate':_0xebcf('0x3'),'afterDestroy':_0xebcf('0x4')};function emitEvent(_0x23d595){return function(_0x33ee0b,_0x1281f7,_0x1d7f2f){MailAccountEvents[_0xebcf('0x5')](_0x23d595+':'+_0x33ee0b['id'],_0x33ee0b);MailAccountEvents[_0xebcf('0x5')](_0x23d595,_0x33ee0b);_0x1d7f2f(null);};}for(var e in events){if(events[_0xebcf('0x6')](e)){var event=events[e];MailAccount[_0xebcf('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x0d10=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x1fa8dd,_0x491111){var _0x5610e5=function(_0x11826e){while(--_0x11826e){_0x1fa8dd['push'](_0x1fa8dd['shift']());}};_0x5610e5(++_0x491111);}(_0x0d10,0x1bf));var _0x00d1=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0x0d10[_0x53ad58];return _0x554b03;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x00d1('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x00d1('0x1')](0x0);var events={'afterCreate':_0x00d1('0x2'),'afterUpdate':_0x00d1('0x3'),'afterDestroy':_0x00d1('0x4')};function emitEvent(_0x2ad3d1){return function(_0x1d6f71,_0x346ad2,_0x15936b){MailAccountEvents['emit'](_0x2ad3d1+':'+_0x1d6f71['id'],_0x1d6f71);MailAccountEvents[_0x00d1('0x5')](_0x2ad3d1,_0x1d6f71);_0x15936b(null);};}for(var e in events){if(events[_0x00d1('0x6')](e)){var event=events[e];MailAccount[_0x00d1('0x7')](e,emitEvent(event));}}module[_0x00d1('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index c089a72..673bc46 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 _0xbdb1=['./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xbdb1,0x6d));var _0x1bdb=function(_0x15b6d2,_0x3bf4be){_0x15b6d2=_0x15b6d2-0x0;var _0x36a1e2=_0xbdb1[_0x15b6d2];return _0x36a1e2;};'use strict';var _=require(_0x1bdb('0x0'));var util=require(_0x1bdb('0x1'));var logger=require('../../config/logger')(_0x1bdb('0x2'));var moment=require(_0x1bdb('0x3'));var BPromise=require(_0x1bdb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1bdb('0x5'));var rimraf=require(_0x1bdb('0x6'));var config=require(_0x1bdb('0x7'));var attributes=require(_0x1bdb('0x8'));module[_0x1bdb('0x9')]=function(_0x52ba35,_0x47c158){return _0x52ba35[_0x1bdb('0xa')](_0x1bdb('0xb'),attributes,{'tableName':_0x1bdb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36f9=['mail_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x36f9,0x7f));var _0x936f=function(_0x4bfa2e,_0x59d749){_0x4bfa2e=_0x4bfa2e-0x0;var _0x5613bf=_0x36f9[_0x4bfa2e];return _0x5613bf;};'use strict';var _=require('lodash');var util=require(_0x936f('0x0'));var logger=require(_0x936f('0x1'))(_0x936f('0x2'));var moment=require(_0x936f('0x3'));var BPromise=require(_0x936f('0x4'));var rp=require(_0x936f('0x5'));var fs=require('fs');var path=require(_0x936f('0x6'));var rimraf=require(_0x936f('0x7'));var config=require(_0x936f('0x8'));var attributes=require(_0x936f('0x9'));module[_0x936f('0xa')]=function(_0x290b95,_0xb2ab68){return _0x290b95[_0x936f('0xb')](_0x936f('0xc'),attributes,{'tableName':_0x936f('0xd'),'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 2c0bb98..9014c04 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 _0x9f49=['request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailAccount','MailAccount','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','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','MailApplication','Applications','MailServerOut','List','get','omit','applications','orderBy','priority','push','length','*,*,*,*','Contacts','defaults','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','interaction','created','MailMessage','originTo','originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x9f49,0x1e8));var _0x99f4=function(_0x2bb03a,_0x4e3936){_0x2bb03a=_0x2bb03a-0x0;var _0xaf04df=_0x9f49[_0x2bb03a];return _0xaf04df;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x99f4('0x0'));var BPromise=require(_0x99f4('0x1'));var rs=require(_0x99f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x99f4('0x3'));var logger=require('../../config/logger')(_0x99f4('0x4'));var config=require(_0x99f4('0x5'));var jayson=require(_0x99f4('0x6'));var client=jayson['client'][_0x99f4('0x7')]({'port':0x232c});config[_0x99f4('0x8')]=_['defaults'](config['redis'],{'host':_0x99f4('0x9'),'port':0x18eb});var socket=require(_0x99f4('0xa'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x99f4('0xb')](socket);function respondWithRpcPromise(_0x5f2f31,_0x2d51f0,_0x385e55){return new BPromise(function(_0x3bc887,_0xfe4dbd){return client[_0x99f4('0xc')](_0x5f2f31,_0x385e55)[_0x99f4('0xd')](function(_0x1a96a0){logger['info'](_0x99f4('0xe'),_0x2d51f0,'request\x20sent');logger[_0x99f4('0xf')](_0x99f4('0x10'),_0x2d51f0,_0x99f4('0x11'),JSON['stringify'](_0x1a96a0));if(_0x1a96a0[_0x99f4('0x12')]){if(_0x1a96a0[_0x99f4('0x12')]['code']===0x1f4){logger['error'](_0x99f4('0xe'),_0x2d51f0,_0x1a96a0[_0x99f4('0x12')][_0x99f4('0x13')]);return _0xfe4dbd(_0x1a96a0[_0x99f4('0x12')][_0x99f4('0x13')]);}logger[_0x99f4('0x12')](_0x99f4('0xe'),_0x2d51f0,_0x1a96a0[_0x99f4('0x12')][_0x99f4('0x13')]);return _0x3bc887(_0x1a96a0[_0x99f4('0x12')][_0x99f4('0x13')]);}else{logger[_0x99f4('0x14')](_0x99f4('0xe'),_0x2d51f0,_0x99f4('0x11'));_0x3bc887(_0x1a96a0['result'][_0x99f4('0x13')]);}})[_0x99f4('0x15')](function(_0x2889a5){logger['error']('MailAccount,\x20%s,\x20%s',_0x2d51f0,_0x2889a5);_0xfe4dbd(_0x2889a5);});});}exports[_0x99f4('0x16')]=function(_0x28845c){var _0x3bd401=this;return new Promise(function(_0x3893c4,_0x35501a){return db['MailAccount'][_0x99f4('0x17')]({'raw':_0x28845c[_0x99f4('0x18')]?_0x28845c[_0x99f4('0x18')][_0x99f4('0x19')]===undefined?!![]:![]:!![],'where':_0x28845c[_0x99f4('0x18')]?_0x28845c[_0x99f4('0x18')][_0x99f4('0x1a')]||null:null,'attributes':_0x28845c['options']?_0x28845c[_0x99f4('0x18')][_0x99f4('0x1b')]||null:null,'limit':_0x28845c[_0x99f4('0x18')]?_0x28845c['options'][_0x99f4('0x1c')]||null:null,'include':_0x28845c[_0x99f4('0x18')]?_0x28845c['options'][_0x99f4('0x1d')]?_[_0x99f4('0x1e')](_0x28845c['options'][_0x99f4('0x1d')],function(_0x280c7){return{'model':db[_0x280c7[_0x99f4('0x1f')]],'as':_0x280c7['as'],'attributes':_0x280c7[_0x99f4('0x1b')],'include':_0x280c7[_0x99f4('0x1d')]?_[_0x99f4('0x1e')](_0x280c7['include'],function(_0x422eaa){return{'model':db[_0x422eaa[_0x99f4('0x1f')]],'as':_0x422eaa['as'],'attributes':_0x422eaa['attributes'],'include':_0x422eaa[_0x99f4('0x1d')]?_['map'](_0x422eaa[_0x99f4('0x1d')],function(_0x1f75ca){return{'model':db[_0x1f75ca[_0x99f4('0x1f')]],'as':_0x1f75ca['as'],'attributes':_0x1f75ca['attributes']};}):[]};}):[]};}):[]:[]})[_0x99f4('0xd')](function(_0xee816d){logger[_0x99f4('0x14')](_0x99f4('0x16'),_0x28845c);logger[_0x99f4('0xf')]('GetMailAccount',_0x28845c,JSON[_0x99f4('0x20')](_0xee816d));_0x3893c4(_0xee816d);})['catch'](function(_0x40bdf5){logger[_0x99f4('0x12')]('GetMailAccount',_0x40bdf5[_0x99f4('0x13')],_0x28845c);_0x35501a(_0x3bd401[_0x99f4('0x12')](0x1f4,_0x40bdf5['message']));});});};exports[_0x99f4('0x21')]=function(_0xa5c408){var _0x1725a8=this;return new Promise(function(_0x5e5e30,_0x7addc9){return db[_0x99f4('0x22')]['find']({'raw':_0xa5c408['options']?_0xa5c408[_0x99f4('0x18')][_0x99f4('0x19')]===undefined?!![]:![]:!![],'where':_0xa5c408['options']?_0xa5c408[_0x99f4('0x18')][_0x99f4('0x1a')]||null:null,'attributes':_0xa5c408[_0x99f4('0x18')]?_0xa5c408[_0x99f4('0x18')][_0x99f4('0x1b')]||null:null,'include':_0xa5c408[_0x99f4('0x18')]?_0xa5c408[_0x99f4('0x18')][_0x99f4('0x1d')]?_['map'](_0xa5c408[_0x99f4('0x18')][_0x99f4('0x1d')],function(_0x386e97){return{'model':db[_0x386e97[_0x99f4('0x1f')]],'as':_0x386e97['as'],'attributes':_0x386e97[_0x99f4('0x1b')],'include':_0x386e97[_0x99f4('0x1d')]?_[_0x99f4('0x1e')](_0x386e97[_0x99f4('0x1d')],function(_0x238941){return{'model':db[_0x238941['model']],'as':_0x238941['as'],'attributes':_0x238941['attributes'],'include':_0x238941[_0x99f4('0x1d')]?_[_0x99f4('0x1e')](_0x238941[_0x99f4('0x1d')],function(_0x41572e){return{'model':db[_0x41572e[_0x99f4('0x1f')]],'as':_0x41572e['as'],'attributes':_0x41572e[_0x99f4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x99f4('0xd')](function(_0x2346b9){logger[_0x99f4('0x14')](_0x99f4('0x21'),_0xa5c408);logger[_0x99f4('0xf')](_0x99f4('0x21'),_0xa5c408,JSON[_0x99f4('0x20')](_0x2346b9));_0x5e5e30(_0x2346b9);})[_0x99f4('0x15')](function(_0xbcc819){logger[_0x99f4('0x12')](_0x99f4('0x21'),_0xbcc819['message'],_0xa5c408);_0x7addc9(_0x1725a8['error'](0x1f4,_0xbcc819['message']));});});};exports[_0x99f4('0x23')]=function(_0x31464d){var _0x31377f=this;return new Promise(function(_0x10c4ce,_0x23098c){var _0x44da55={'body':_0x31464d[_0x99f4('0x24')],'channel':_0x99f4('0x25')};var _0x38ee16=_[_0x99f4('0x26')](_[_0x99f4('0x27')](db[_0x99f4('0x28')][_0x99f4('0x29')]),[_0x99f4('0x2a'),_0x99f4('0x2b'),_0x99f4('0x2c'),_0x99f4('0x2d')]);var _0x2b35ee=![];if(_0x31464d[_0x99f4('0x24')]['id']){delete _0x31464d['body']['id'];}if(_[_0x99f4('0x2e')](_0x31464d[_0x99f4('0x24')][_0x99f4('0x2f')])){return _0x23098c(_0x31377f['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x99f4('0x2e')](_0x31464d[_0x99f4('0x24')][_0x99f4('0x24')])||_0x31464d['body'][_0x99f4('0x24')]===''){return _0x23098c(_0x31377f[_0x99f4('0x12')](0x1f4,_0x99f4('0x30')));}if(_[_0x99f4('0x2e')](_0x31464d[_0x99f4('0x24')][_0x99f4('0x31')])){return _0x23098c(_0x31377f['error'](0x1f4,_0x99f4('0x32')+_0x38ee16));}if(!_[_0x99f4('0x33')](_0x38ee16,_0x31464d[_0x99f4('0x24')][_0x99f4('0x31')])){return _0x23098c(_0x31377f[_0x99f4('0x12')](0x1f4,_0x99f4('0x34')+_0x38ee16));}var _0x4c817f={};_0x4c817f[_0x31464d[_0x99f4('0x24')][_0x99f4('0x31')]]=_0x31464d[_0x99f4('0x24')][_0x99f4('0x2f')];return db['MailAccount']['find']({'where':{'id':_0x31464d[_0x99f4('0x35')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4c817f,'limit':0x1,'order':[[_0x99f4('0x2b'),'DESC']]}]},{'model':db[_0x99f4('0x36')],'as':_0x99f4('0x37')},{'model':db[_0x99f4('0x38')],'as':'Smtp'}]})[_0x99f4('0xd')](function(_0x3cb2a9){if(_0x3cb2a9&&_0x3cb2a9[_0x99f4('0x39')]){var _0x5383fc=_0x3cb2a9[_0x99f4('0x3a')]({'plain':!![]});_0x44da55[_0x99f4('0x35')]=_[_0x99f4('0x3b')](_0x5383fc,[_0x99f4('0x37'),'List']);_0x44da55[_0x99f4('0x3c')]=_0x5383fc['Applications'];_0x44da55['list']=_0x5383fc[_0x99f4('0x39')];_0x44da55['applications']=_[_0x99f4('0x3d')](_0x44da55['applications'],[_0x99f4('0x3e')],['asc']);if(_0x44da55[_0x99f4('0x35')]&&_0x44da55[_0x99f4('0x35')]['autoclose']){_0x44da55[_0x99f4('0x3c')][_0x99f4('0x3f')]({'id':0x0,'priority':_0x44da55[_0x99f4('0x3c')][_0x99f4('0x40')]+0x1,'app':'close','appdata':'autoclose','interval':_0x99f4('0x41')});}if(_0x44da55[_0x99f4('0x35')][_0x99f4('0x37')]){delete _0x44da55[_0x99f4('0x35')][_0x99f4('0x37')];}if(_0x44da55['account'][_0x99f4('0x39')]){delete _0x44da55[_0x99f4('0x35')][_0x99f4('0x39')];}if(_0x5383fc[_0x99f4('0x39')]['Contacts'][_0x99f4('0x40')]){return _0x5383fc[_0x99f4('0x39')][_0x99f4('0x42')][0x0];}var _0x131c25=_[_0x99f4('0x43')](_0x31464d['body'],{'firstName':_0x31464d[_0x99f4('0x24')][_0x99f4('0x2f')],'ListId':_0x5383fc[_0x99f4('0x2d')]});_0x131c25[_0x31464d[_0x99f4('0x24')][_0x99f4('0x31')]]=_0x31464d[_0x99f4('0x24')][_0x99f4('0x2f')];return db[_0x99f4('0x28')][_0x99f4('0x44')](_0x131c25);}else{throw new Error(_0x99f4('0x45'));}})['then'](function(_0x1fb3c5){_0x44da55[_0x99f4('0x46')]=_0x1fb3c5;if(_0x1fb3c5){if(!_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')][_0x99f4('0x47')]){_0x31464d[_0x99f4('0x24')]['message'][_0x99f4('0x47')]=rs[_0x99f4('0x48')]()+'\x20'+_0x31464d[_0x99f4('0x24')]['message'][_0x99f4('0x2f')];}var _0x1d8537={'ContactId':_0x1fb3c5['id'],'MailAccountId':_0x31464d[_0x99f4('0x35')]['id'],'inReplyTo':_0x31464d[_0x99f4('0x24')]['message'][_0x99f4('0x47')],'to':_0x31464d[_0x99f4('0x24')]['message'][_0x99f4('0x2f')],'cc':_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')]['cc'],'subject':_0x31464d['body'][_0x99f4('0x13')]['subject'],'attach':_0x31464d['body']['message'][_0x99f4('0x49')],'lastMsgAt':moment()[_0x99f4('0x4a')](_0x99f4('0x4b')),'lastMsgDirection':'in','lastMsgBody':_0x31464d[_0x99f4('0x24')][_0x99f4('0x24')]};return db[_0x99f4('0x4c')][_0x99f4('0x4d')]({'where':{'closed':![],'MailAccountId':_0x31464d[_0x99f4('0x35')]['id']},'include':[{'model':db['MailMessage'],'as':_0x99f4('0x4e'),'attributes':[_0x99f4('0x47')],'where':{'messageId':_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')][_0x99f4('0x4f')]}}]})[_0x99f4('0xd')](function(_0x4ad49e){if(_0x4ad49e){return[_0x4ad49e,![]];}return db['MailInteraction'][_0x99f4('0x44')](_0x1d8537)[_0x99f4('0xd')](function(_0x55f38e){return[_0x55f38e,!![]];});});}else{throw new Error(_0x99f4('0x50'));}})[_0x99f4('0x51')](function(_0x4e4390,_0x3901ef){if(_0x4e4390){_0x2b35ee=_0x3901ef;if(!_0x3901ef){return _0x4e4390[_0x99f4('0x52')]({'inReplyTo':_0x31464d[_0x99f4('0x24')]['message'][_0x99f4('0x47')],'to':_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')]['from'],'cc':_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')]['cc'],'subject':_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')][_0x99f4('0x53')],'attach':_0x4e4390[_0x99f4('0x49')]?_0x4e4390[_0x99f4('0x49')]:_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')][_0x99f4('0x49')],'substatus':null,'substatusAt':moment()[_0x99f4('0x4a')](_0x99f4('0x4b')),'lastMsgAt':moment()[_0x99f4('0x4a')](_0x99f4('0x4b')),'lastMsgDirection':'in','lastMsgBody':_0x31464d['body']['body']});}else{return _0x4e4390;}}})[_0x99f4('0xd')](function(_0x215315){_0x44da55[_0x99f4('0x54')]=_0x215315[_0x99f4('0x3a')]({'plain':!![]});_0x44da55[_0x99f4('0x54')][_0x99f4('0x55')]=_0x2b35ee;return db[_0x99f4('0x56')]['create']({'body':_0x31464d[_0x99f4('0x24')][_0x99f4('0x24')],'MailAccountId':_0x31464d[_0x99f4('0x35')]['id'],'MailInteractionId':_0x215315['id'],'direction':'in','ContactId':_0x44da55[_0x99f4('0x46')]['id'],'messageId':_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')]['messageId'],'from':_0x31464d['body'][_0x99f4('0x13')][_0x99f4('0x2f')],'to':_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')]['to'],'cc':_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')]['cc'],'subject':_0x31464d[_0x99f4('0x24')]['message'][_0x99f4('0x53')],'attach':_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')][_0x99f4('0x49')],'Attachments':_0x31464d['body']['message']['attachments'],'originTo':_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')][_0x99f4('0x57')],'originCc':_0x31464d[_0x99f4('0x24')]['message'][_0x99f4('0x58')],'bcc':_0x31464d['body']['message'][_0x99f4('0x59')],'ChatWebsiteId':_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')]['ChatWebsiteId']||null,'originChannel':_0x31464d['body'][_0x99f4('0x13')][_0x99f4('0x5a')]||'Email','ChatOfflineMessageId':_0x31464d[_0x99f4('0x24')][_0x99f4('0x13')][_0x99f4('0x5b')]||null},{'include':[{'model':db[_0x99f4('0x5c')],'as':_0x99f4('0x5d')}]});})['then'](function(_0x32d57c){_0x44da55[_0x99f4('0x13')]=_0x32d57c;if(_0x44da55['interaction'][_0x99f4('0x5e')]){return db[_0x99f4('0x5f')][_0x99f4('0x4d')]({'attributes':['id','name'],'where':{'id':_0x44da55[_0x99f4('0x54')][_0x99f4('0x5e')]}})[_0x99f4('0xd')](function(_0x3824d8){if(_0x3824d8){_0x44da55[_0x99f4('0x3c')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3824d8[_0x99f4('0x60')]+','+(_0x44da55[_0x99f4('0x35')][_0x99f4('0x61')]||0xa),'interval':_0x99f4('0x41')});}return respondWithRpcPromise(_0x99f4('0x62'),'startRouting',_0x44da55);});}return respondWithRpcPromise(_0x99f4('0x62'),_0x99f4('0x63'),_0x44da55);})[_0x99f4('0xd')](function(_0x100687){_0x10c4ce(_0x100687);})[_0x99f4('0x15')](function(_0x1eabbe){_0x23098c(_0x31377f[_0x99f4('0x12')](0x1f4,_0x1eabbe[_0x99f4('0x13')]));});});}; \ No newline at end of file +var _0x411b=['mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','List','get','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','YYYY-MM-DD\x20HH:mm:ss','interaction','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailAccount','options','where','limit','include','map','model','attributes','GetMailAccount','find','ShowMailAccount','body','mail','difference','keys','CmContact','createdAt','CompanyId','ListId','isNil','from'];(function(_0x56b965,_0x4b5b84){var _0x13dc5e=function(_0x596634){while(--_0x596634){_0x56b965['push'](_0x56b965['shift']());}};_0x13dc5e(++_0x4b5b84);}(_0x411b,0x1d6));var _0xb411=function(_0x1477ef,_0x3cdd13){_0x1477ef=_0x1477ef-0x0;var _0x1c11b2=_0x411b[_0x1477ef];return _0x1c11b2;};'use strict';var _=require(_0xb411('0x0'));var util=require(_0xb411('0x1'));var moment=require(_0xb411('0x2'));var BPromise=require(_0xb411('0x3'));var rs=require(_0xb411('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb411('0x5'))['db'];var utils=require(_0xb411('0x6'));var logger=require('../../config/logger')(_0xb411('0x7'));var config=require(_0xb411('0x8'));var jayson=require(_0xb411('0x9'));var client=jayson[_0xb411('0xa')]['http']({'port':0x232c});config[_0xb411('0xb')]=_[_0xb411('0xc')](config[_0xb411('0xb')],{'host':_0xb411('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb411('0xb')]));require(_0xb411('0xe'))[_0xb411('0xf')](socket);function respondWithRpcPromise(_0x318287,_0x3f05e0,_0x17ba5a){return new BPromise(function(_0x4b32f5,_0x9d915d){return client[_0xb411('0x10')](_0x318287,_0x17ba5a)[_0xb411('0x11')](function(_0xe4a3c3){logger[_0xb411('0x12')](_0xb411('0x13'),_0x3f05e0,_0xb411('0x14'));logger[_0xb411('0x15')](_0xb411('0x16'),_0x3f05e0,_0xb411('0x14'),JSON[_0xb411('0x17')](_0xe4a3c3));if(_0xe4a3c3[_0xb411('0x18')]){if(_0xe4a3c3[_0xb411('0x18')][_0xb411('0x19')]===0x1f4){logger[_0xb411('0x18')]('MailAccount,\x20%s,\x20%s',_0x3f05e0,_0xe4a3c3['error'][_0xb411('0x1a')]);return _0x9d915d(_0xe4a3c3['error']['message']);}logger[_0xb411('0x18')](_0xb411('0x13'),_0x3f05e0,_0xe4a3c3[_0xb411('0x18')][_0xb411('0x1a')]);return _0x4b32f5(_0xe4a3c3[_0xb411('0x18')][_0xb411('0x1a')]);}else{logger[_0xb411('0x12')](_0xb411('0x13'),_0x3f05e0,_0xb411('0x14'));_0x4b32f5(_0xe4a3c3[_0xb411('0x1b')]['message']);}})[_0xb411('0x1c')](function(_0x9c143c){logger['error'](_0xb411('0x13'),_0x3f05e0,_0x9c143c);_0x9d915d(_0x9c143c);});});}exports['GetMailAccount']=function(_0x19cf18){var _0xeb485a=this;return new Promise(function(_0x3ad86c,_0x42f3c7){return db[_0xb411('0x1d')]['findAll']({'raw':_0x19cf18['options']?_0x19cf18[_0xb411('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x19cf18[_0xb411('0x1e')]?_0x19cf18['options'][_0xb411('0x1f')]||null:null,'attributes':_0x19cf18['options']?_0x19cf18['options']['attributes']||null:null,'limit':_0x19cf18[_0xb411('0x1e')]?_0x19cf18['options'][_0xb411('0x20')]||null:null,'include':_0x19cf18['options']?_0x19cf18['options'][_0xb411('0x21')]?_[_0xb411('0x22')](_0x19cf18[_0xb411('0x1e')]['include'],function(_0x1403df){return{'model':db[_0x1403df[_0xb411('0x23')]],'as':_0x1403df['as'],'attributes':_0x1403df[_0xb411('0x24')],'include':_0x1403df[_0xb411('0x21')]?_['map'](_0x1403df[_0xb411('0x21')],function(_0x345f5c){return{'model':db[_0x345f5c[_0xb411('0x23')]],'as':_0x345f5c['as'],'attributes':_0x345f5c[_0xb411('0x24')],'include':_0x345f5c[_0xb411('0x21')]?_[_0xb411('0x22')](_0x345f5c[_0xb411('0x21')],function(_0x303a8a){return{'model':db[_0x303a8a['model']],'as':_0x303a8a['as'],'attributes':_0x303a8a['attributes']};}):[]};}):[]};}):[]:[]})[_0xb411('0x11')](function(_0x34461a){logger[_0xb411('0x12')](_0xb411('0x25'),_0x19cf18);logger['debug'](_0xb411('0x25'),_0x19cf18,JSON['stringify'](_0x34461a));_0x3ad86c(_0x34461a);})[_0xb411('0x1c')](function(_0x79ec7b){logger[_0xb411('0x18')]('GetMailAccount',_0x79ec7b[_0xb411('0x1a')],_0x19cf18);_0x42f3c7(_0xeb485a[_0xb411('0x18')](0x1f4,_0x79ec7b[_0xb411('0x1a')]));});});};exports['ShowMailAccount']=function(_0x2948e2){var _0x25b1f7=this;return new Promise(function(_0x2ba887,_0x260e9f){return db[_0xb411('0x1d')][_0xb411('0x26')]({'raw':_0x2948e2['options']?_0x2948e2[_0xb411('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2948e2[_0xb411('0x1e')]?_0x2948e2[_0xb411('0x1e')]['where']||null:null,'attributes':_0x2948e2[_0xb411('0x1e')]?_0x2948e2[_0xb411('0x1e')]['attributes']||null:null,'include':_0x2948e2['options']?_0x2948e2[_0xb411('0x1e')][_0xb411('0x21')]?_['map'](_0x2948e2[_0xb411('0x1e')][_0xb411('0x21')],function(_0xdf7e21){return{'model':db[_0xdf7e21[_0xb411('0x23')]],'as':_0xdf7e21['as'],'attributes':_0xdf7e21[_0xb411('0x24')],'include':_0xdf7e21[_0xb411('0x21')]?_['map'](_0xdf7e21['include'],function(_0x265013){return{'model':db[_0x265013['model']],'as':_0x265013['as'],'attributes':_0x265013[_0xb411('0x24')],'include':_0x265013[_0xb411('0x21')]?_[_0xb411('0x22')](_0x265013['include'],function(_0x57efbf){return{'model':db[_0x57efbf['model']],'as':_0x57efbf['as'],'attributes':_0x57efbf[_0xb411('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb411('0x11')](function(_0x29fd59){logger['info'](_0xb411('0x27'),_0x2948e2);logger[_0xb411('0x15')](_0xb411('0x27'),_0x2948e2,JSON[_0xb411('0x17')](_0x29fd59));_0x2ba887(_0x29fd59);})['catch'](function(_0x5797b9){logger[_0xb411('0x18')]('ShowMailAccount',_0x5797b9[_0xb411('0x1a')],_0x2948e2);_0x260e9f(_0x25b1f7[_0xb411('0x18')](0x1f4,_0x5797b9['message']));});});};exports['NotifyMailAccount']=function(_0x10b560){var _0x14dee3=this;return new Promise(function(_0x44050e,_0x52fff7){var _0x138379={'body':_0x10b560[_0xb411('0x28')],'channel':_0xb411('0x29')};var _0x5c589c=_[_0xb411('0x2a')](_[_0xb411('0x2b')](db[_0xb411('0x2c')]['rawAttributes']),[_0xb411('0x2d'),'updatedAt',_0xb411('0x2e'),_0xb411('0x2f')]);var _0x118acb=![];if(_0x10b560[_0xb411('0x28')]['id']){delete _0x10b560['body']['id'];}if(_[_0xb411('0x30')](_0x10b560[_0xb411('0x28')][_0xb411('0x31')])){return _0x52fff7(_0x14dee3[_0xb411('0x18')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xb411('0x30')](_0x10b560[_0xb411('0x28')][_0xb411('0x28')])||_0x10b560[_0xb411('0x28')][_0xb411('0x28')]===''){return _0x52fff7(_0x14dee3['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x10b560[_0xb411('0x28')][_0xb411('0x32')])){return _0x52fff7(_0x14dee3['error'](0x1f4,_0xb411('0x33')+_0x5c589c));}if(!_[_0xb411('0x34')](_0x5c589c,_0x10b560['body']['mapKey'])){return _0x52fff7(_0x14dee3['error'](0x1f4,_0xb411('0x35')+_0x5c589c));}var _0x42b611={};_0x42b611[_0x10b560['body'][_0xb411('0x32')]]=_0x10b560[_0xb411('0x28')][_0xb411('0x31')];return db[_0xb411('0x1d')][_0xb411('0x26')]({'where':{'id':_0x10b560[_0xb411('0x36')]['id']},'include':[{'model':db[_0xb411('0x37')],'as':'List','include':[{'model':db['CmContact'],'as':_0xb411('0x38'),'where':_0x42b611,'limit':0x1,'order':[['updatedAt',_0xb411('0x39')]]}]},{'model':db[_0xb411('0x3a')],'as':_0xb411('0x3b')},{'model':db[_0xb411('0x3c')],'as':_0xb411('0x3d')}]})[_0xb411('0x11')](function(_0x48bf22){if(_0x48bf22&&_0x48bf22[_0xb411('0x3e')]){var _0x306c3e=_0x48bf22[_0xb411('0x3f')]({'plain':!![]});_0x138379['account']=_[_0xb411('0x40')](_0x306c3e,[_0xb411('0x3b'),_0xb411('0x3e')]);_0x138379[_0xb411('0x41')]=_0x306c3e[_0xb411('0x3b')];_0x138379[_0xb411('0x42')]=_0x306c3e[_0xb411('0x3e')];_0x138379[_0xb411('0x41')]=_[_0xb411('0x43')](_0x138379[_0xb411('0x41')],[_0xb411('0x44')],[_0xb411('0x45')]);if(_0x138379['account']&&_0x138379[_0xb411('0x36')][_0xb411('0x46')]){_0x138379[_0xb411('0x41')][_0xb411('0x47')]({'id':0x0,'priority':_0x138379['applications'][_0xb411('0x48')]+0x1,'app':_0xb411('0x49'),'appdata':_0xb411('0x46'),'interval':'*,*,*,*'});}if(_0x138379[_0xb411('0x36')][_0xb411('0x3b')]){delete _0x138379[_0xb411('0x36')]['Applications'];}if(_0x138379[_0xb411('0x36')][_0xb411('0x3e')]){delete _0x138379[_0xb411('0x36')][_0xb411('0x3e')];}if(_0x306c3e[_0xb411('0x3e')][_0xb411('0x38')][_0xb411('0x48')]){return _0x306c3e[_0xb411('0x3e')]['Contacts'][0x0];}var _0x3a0f46=_['defaults'](_0x10b560[_0xb411('0x28')],{'firstName':_0x10b560[_0xb411('0x28')]['from'],'ListId':_0x306c3e['ListId']});_0x3a0f46[_0x10b560['body'][_0xb411('0x32')]]=_0x10b560[_0xb411('0x28')]['from'];return db['CmContact'][_0xb411('0x4a')](_0x3a0f46);}else{throw new Error(_0xb411('0x4b'));}})['then'](function(_0xcde6d4){_0x138379[_0xb411('0x4c')]=_0xcde6d4;if(_0xcde6d4){if(!_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x4d')]){_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x4d')]=rs[_0xb411('0x4e')]()+'\x20'+_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x31')];}var _0x2700ab={'ContactId':_0xcde6d4['id'],'MailAccountId':_0x10b560[_0xb411('0x36')]['id'],'inReplyTo':_0x10b560['body'][_0xb411('0x1a')][_0xb411('0x4d')],'to':_0x10b560['body'][_0xb411('0x1a')][_0xb411('0x31')],'cc':_0x10b560['body']['message']['cc'],'subject':_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x4f')],'attach':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x50')],'lastMsgAt':moment()[_0xb411('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x10b560[_0xb411('0x28')][_0xb411('0x28')]};return db[_0xb411('0x52')][_0xb411('0x26')]({'where':{'closed':![],'MailAccountId':_0x10b560[_0xb411('0x36')]['id']},'include':[{'model':db[_0xb411('0x53')],'as':_0xb411('0x54'),'attributes':[_0xb411('0x4d')],'where':{'messageId':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x55')]}}]})[_0xb411('0x11')](function(_0x378783){if(_0x378783){return[_0x378783,![]];}return db[_0xb411('0x52')][_0xb411('0x4a')](_0x2700ab)[_0xb411('0x11')](function(_0x3c6f9e){return[_0x3c6f9e,!![]];});});}else{throw new Error(_0xb411('0x56'));}})[_0xb411('0x57')](function(_0x4fff7c,_0x51fa3c){if(_0x4fff7c){_0x118acb=_0x51fa3c;if(!_0x51fa3c){return _0x4fff7c['update']({'inReplyTo':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')]['messageId'],'to':_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x31')],'cc':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')]['cc'],'subject':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x4f')],'attach':_0x4fff7c['attach']?_0x4fff7c[_0xb411('0x50')]:_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x50')],'substatus':null,'substatusAt':moment()['format'](_0xb411('0x58')),'lastMsgAt':moment()['format'](_0xb411('0x58')),'lastMsgDirection':'in','lastMsgBody':_0x10b560[_0xb411('0x28')]['body']});}else{return _0x4fff7c;}}})[_0xb411('0x11')](function(_0xa524e5){_0x138379[_0xb411('0x59')]=_0xa524e5['get']({'plain':!![]});_0x138379[_0xb411('0x59')]['created']=_0x118acb;return db[_0xb411('0x53')][_0xb411('0x4a')]({'body':_0x10b560[_0xb411('0x28')][_0xb411('0x28')],'MailAccountId':_0x10b560[_0xb411('0x36')]['id'],'MailInteractionId':_0xa524e5['id'],'direction':'in','ContactId':_0x138379[_0xb411('0x4c')]['id'],'messageId':_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x4d')],'from':_0x10b560['body'][_0xb411('0x1a')][_0xb411('0x31')],'to':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')]['to'],'cc':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')]['cc'],'subject':_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x4f')],'attach':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x50')],'Attachments':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')]['attachments'],'originTo':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x5a')],'originCc':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x5b')],'bcc':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x5c')],'ChatWebsiteId':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x5d')]||null,'originChannel':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')]['originChannel']||_0xb411('0x5e'),'ChatOfflineMessageId':_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':_0xb411('0x60')}]});})['then'](function(_0x837d7d){_0x138379[_0xb411('0x1a')]=_0x837d7d;if(_0x138379[_0xb411('0x59')][_0xb411('0x61')]){return db[_0xb411('0x62')][_0xb411('0x26')]({'attributes':['id',_0xb411('0x63')],'where':{'id':_0x138379[_0xb411('0x59')]['UserId']}})[_0xb411('0x11')](function(_0x48367f){if(_0x48367f){_0x138379[_0xb411('0x41')][_0xb411('0x64')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x48367f[_0xb411('0x63')]+','+(_0x138379[_0xb411('0x36')][_0xb411('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb411('0x66'),_0xb411('0x67'),_0x138379);});}return respondWithRpcPromise(_0xb411('0x66'),_0xb411('0x67'),_0x138379);})[_0xb411('0x11')](function(_0x4724ec){_0x44050e(_0x4724ec);})['catch'](function(_0x1736ba){_0x52fff7(_0x14dee3[_0xb411('0x18')](0x1f4,_0x1736ba[_0xb411('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 4e6c536..a311500 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 _0xd101=['emit','register','length','mailAccount:','./mailAccount.events','remove','update'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xd101,0xc1));var _0x1d10=function(_0x1b423f,_0x481983){_0x1b423f=_0x1b423f-0x0;var _0x1a1feb=_0xd101[_0x1b423f];return _0x1a1feb;};'use strict';var MailAccountEvents=require(_0x1d10('0x0'));var events=['save',_0x1d10('0x1'),_0x1d10('0x2')];function createListener(_0x1142f8,_0x21b32e){return function(_0xaa1d24){_0x21b32e[_0x1d10('0x3')](_0x1142f8,_0xaa1d24);};}function removeListener(_0x12c320,_0x1e83e0){return function(){MailAccountEvents['removeListener'](_0x12c320,_0x1e83e0);};}exports[_0x1d10('0x4')]=function(_0x203072){for(var _0x2a4e2d=0x0,_0x27d569=events[_0x1d10('0x5')];_0x2a4e2d<_0x27d569;_0x2a4e2d++){var _0x36335e=events[_0x2a4e2d];var _0x6d6def=createListener(_0x1d10('0x6')+_0x36335e,_0x203072);MailAccountEvents['on'](_0x36335e,_0x6d6def);}}; \ No newline at end of file +var _0x644f=['emit','removeListener','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x591e11,_0x363e09){var _0x23a0a=function(_0x43734d){while(--_0x43734d){_0x591e11['push'](_0x591e11['shift']());}};_0x23a0a(++_0x363e09);}(_0x644f,0xc2));var _0xf644=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x644f[_0x1abeb2];return _0x48da20;};'use strict';var MailAccountEvents=require(_0xf644('0x0'));var events=[_0xf644('0x1'),'remove','update'];function createListener(_0x19242f,_0xc5044c){return function(_0x240500){_0xc5044c[_0xf644('0x2')](_0x19242f,_0x240500);};}function removeListener(_0x372b63,_0x3759da){return function(){MailAccountEvents[_0xf644('0x3')](_0x372b63,_0x3759da);};}exports[_0xf644('0x4')]=function(_0x9938ed){for(var _0x1a6cbb=0x0,_0x2c7aaf=events[_0xf644('0x5')];_0x1a6cbb<_0x2c7aaf;_0x1a6cbb++){var _0x50362e=events[_0x1a6cbb];var _0x2c2868=createListener(_0xf644('0x6')+_0x50362e,_0x9938ed);MailAccountEvents['on'](_0x50362e,_0x2c2868);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 9b33773..ee64f7e 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 _0x2547=['../../config/environment','get','/:id','isAuthenticated','show','update','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x551ae9,_0x539204){var _0xb0e09c=function(_0x348c04){while(--_0x348c04){_0x551ae9['push'](_0x551ae9['shift']());}};_0xb0e09c(++_0x539204);}(_0x2547,0x1cd));var _0x7254=function(_0x555517,_0xa66c93){_0x555517=_0x555517-0x0;var _0x2a22ac=_0x2547[_0x555517];return _0x2a22ac;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var auth=require(_0x7254('0x5'));var interaction=require(_0x7254('0x6'));var config=require(_0x7254('0x7'));var controller=require('./mailApplication.controller');router[_0x7254('0x8')](_0x7254('0x9'),auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['put'](_0x7254('0x9'),auth[_0x7254('0xa')](),controller[_0x7254('0xc')]);router['delete'](_0x7254('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2e54=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','update','destroy'];(function(_0x1dfbf0,_0x25aa11){var _0x248732=function(_0x322ab7){while(--_0x322ab7){_0x1dfbf0['push'](_0x1dfbf0['shift']());}};_0x248732(++_0x25aa11);}(_0x2e54,0x1dd));var _0x42e5=function(_0x23d4a2,_0x8a4d6d){_0x23d4a2=_0x23d4a2-0x0;var _0x43d2b3=_0x2e54[_0x23d4a2];return _0x43d2b3;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var auth=require(_0x42e5('0x4'));var interaction=require(_0x42e5('0x5'));var config=require(_0x42e5('0x6'));var controller=require(_0x42e5('0x7'));router['get'](_0x42e5('0x8'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['put'](_0x42e5('0x8'),auth['isAuthenticated'](),controller[_0x42e5('0xb')]);router['delete'](_0x42e5('0x8'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xc')]);module[_0x42e5('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 9f38fe1..e8df9e5 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 _0x4415=['sequelize','exports','TEXT','STRING'];(function(_0x131f90,_0x56ea56){var _0x38db03=function(_0x27d5ed){while(--_0x27d5ed){_0x131f90['push'](_0x131f90['shift']());}};_0x38db03(++_0x56ea56);}(_0x4415,0xb8));var _0x5441=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x4415[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0x5441('0x0'));module[_0x5441('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5441('0x2')]()},'description':{'type':Sequelize[_0x5441('0x3')]},'interval':{'type':Sequelize[_0x5441('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb583=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x589ac8,_0x10ac6e){var _0x1bb5dc=function(_0x7a6239){while(--_0x7a6239){_0x589ac8['push'](_0x589ac8['shift']());}};_0x1bb5dc(++_0x10ac6e);}(_0xb583,0xb0));var _0x3b58=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb583[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x3b58('0x0'));module[_0x3b58('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3b58('0x2')],'allowNull':![],'defaultValue':_0x3b58('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3b58('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 8859c2f..9bf7a99 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 _0x47e1=['length','include','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x47e1,0xb6));var _0x147e=function(_0x31df4c,_0x3d611f){_0x31df4c=_0x31df4c-0x0;var _0x47524b=_0x47e1[_0x31df4c];return _0x47524b;};'use strict';var pdf=require(_0x147e('0x0'));var emlformat=require(_0x147e('0x1'));var rimraf=require(_0x147e('0x2'));var zipdir=require(_0x147e('0x3'));var jsonpatch=require(_0x147e('0x4'));var rp=require(_0x147e('0x5'));var moment=require(_0x147e('0x6'));var BPromise=require(_0x147e('0x7'));var Mustache=require('mustache');var util=require(_0x147e('0x8'));var path=require(_0x147e('0x9'));var sox=require(_0x147e('0xa'));var csv=require(_0x147e('0xb'));var ejs=require(_0x147e('0xc'));var fs=require('fs');var _=require(_0x147e('0xd'));var squel=require(_0x147e('0xe'));var crypto=require(_0x147e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x147e('0x10'));var toCsv=require(_0x147e('0xb'));var querystring=require(_0x147e('0x11'));var Papa=require(_0x147e('0x12'));var Redis=require(_0x147e('0x13'));var authService=require(_0x147e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x147e('0x15'));var hardwareService=require(_0x147e('0x16'));var logger=require(_0x147e('0x17'))('api');var utils=require(_0x147e('0x18'));var config=require(_0x147e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x147e('0x1a'))['db'];function respondWithStatusCode(_0x3a033a,_0x28af3e){_0x28af3e=_0x28af3e||0xcc;return function(_0x4a1b6f){if(_0x4a1b6f){return _0x3a033a['sendStatus'](_0x28af3e);}return _0x3a033a['status'](_0x28af3e)[_0x147e('0x1b')]();};}function respondWithResult(_0x1b8d11,_0x2e3f9b){_0x2e3f9b=_0x2e3f9b||0xc8;return function(_0x263be5){if(_0x263be5){return _0x1b8d11[_0x147e('0x1c')](_0x2e3f9b)[_0x147e('0x1d')](_0x263be5);}};}function respondWithFilteredResult(_0x28cdad,_0x16ad8c){return function(_0x596a51){if(_0x596a51){var _0x153ce1=_0x596a51[_0x147e('0x1e')],_0x38bce1=_0x16ad8c[_0x147e('0x1f')],_0xeb182=_0x16ad8c[_0x147e('0x1f')]+_0x16ad8c['limit'],_0x21e95d;if(_0xeb182>=_0x153ce1){_0xeb182=_0x153ce1;_0x21e95d=0xc8;}else{_0x21e95d=0xce;}_0x28cdad[_0x147e('0x1c')](_0x21e95d);return _0x28cdad[_0x147e('0x20')](_0x147e('0x21'),_0x38bce1+'-'+_0xeb182+'/'+_0x153ce1)[_0x147e('0x1d')](_0x596a51);}return null;};}function patchUpdates(_0xa5ac3a){return function(_0xde4a09){try{jsonpatch[_0x147e('0x22')](_0xde4a09,_0xa5ac3a,!![]);}catch(_0x38c4cb){return BPromise[_0x147e('0x23')](_0x38c4cb);}return _0xde4a09[_0x147e('0x24')]();};}function saveUpdates(_0x19225f,_0x224aae){return function(_0x10fee4){if(_0x10fee4){return _0x10fee4[_0x147e('0x25')](_0x19225f)[_0x147e('0x26')](function(_0x3f29a0){return _0x3f29a0;});}return null;};}function removeEntity(_0x5bd8d4,_0x514b70){return function(_0x42b930){if(_0x42b930){return _0x42b930[_0x147e('0x27')]()[_0x147e('0x26')](function(){_0x5bd8d4[_0x147e('0x1c')](0xcc)[_0x147e('0x1b')]();});}};}function handleEntityNotFound(_0x272d78,_0x568586){return function(_0x1d1078){if(!_0x1d1078){_0x272d78[_0x147e('0x28')](0x194);}return _0x1d1078;};}function handleError(_0x55bb2e,_0x5e161a){_0x5e161a=_0x5e161a||0x1f4;return function(_0x2a0710){logger['error'](_0x2a0710['stack']);if(_0x2a0710[_0x147e('0x29')]){delete _0x2a0710['name'];}_0x55bb2e[_0x147e('0x1c')](_0x5e161a)[_0x147e('0x2a')](_0x2a0710);};}exports[_0x147e('0x2b')]=function(_0x1ad237,_0x4ec842){var _0x41f1e3={'raw':!![],'where':{'id':_0x1ad237[_0x147e('0x2c')]['id']}},_0x3bd22b={};_0x3bd22b[_0x147e('0x2d')]=_[_0x147e('0x2e')](db[_0x147e('0x2f')][_0x147e('0x30')]);_0x3bd22b[_0x147e('0x31')]=_[_0x147e('0x2e')](_0x1ad237[_0x147e('0x31')]);_0x3bd22b[_0x147e('0x32')]=_[_0x147e('0x33')](_0x3bd22b['model'],_0x3bd22b[_0x147e('0x31')]);_0x41f1e3[_0x147e('0x34')]=_['intersection'](_0x3bd22b[_0x147e('0x2d')],qs[_0x147e('0x35')](_0x1ad237[_0x147e('0x31')][_0x147e('0x35')]));_0x41f1e3['attributes']=_0x41f1e3[_0x147e('0x34')][_0x147e('0x36')]?_0x41f1e3[_0x147e('0x34')]:_0x3bd22b[_0x147e('0x2d')];if(_0x1ad237[_0x147e('0x31')]['includeAll']){_0x41f1e3[_0x147e('0x37')]=[{'all':!![]}];}_0x41f1e3=_['merge']({},_0x41f1e3,_0x1ad237['options']);return db[_0x147e('0x2f')][_0x147e('0x38')](_0x41f1e3)[_0x147e('0x26')](handleEntityNotFound(_0x4ec842,null))[_0x147e('0x26')](respondWithResult(_0x4ec842,null))[_0x147e('0x39')](handleError(_0x4ec842,null));};exports[_0x147e('0x25')]=function(_0x1981a2,_0x57745f){if(_0x1981a2[_0x147e('0x3a')]['id']){delete _0x1981a2['body']['id'];}return db[_0x147e('0x2f')]['find']({'where':{'id':_0x1981a2[_0x147e('0x2c')]['id']}})[_0x147e('0x26')](handleEntityNotFound(_0x57745f,null))[_0x147e('0x26')](saveUpdates(_0x1981a2[_0x147e('0x3a')],null))['then'](respondWithResult(_0x57745f,null))[_0x147e('0x39')](handleError(_0x57745f,null));};exports[_0x147e('0x27')]=function(_0x464fe8,_0x44558d){return db[_0x147e('0x2f')]['find']({'where':{'id':_0x464fe8[_0x147e('0x2c')]['id']}})[_0x147e('0x26')](handleEntityNotFound(_0x44558d,null))[_0x147e('0x26')](removeEntity(_0x44558d,null))[_0x147e('0x39')](handleError(_0x44558d,null));}; \ No newline at end of file +var _0xc8bc=['intersection','attributes','fields','length','includeAll','include','merge','catch','body','params','find','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','show','model','keys','MailApplication','rawAttributes','query','filters'];(function(_0x427126,_0x5b9d2a){var _0x170228=function(_0x59e5de){while(--_0x59e5de){_0x427126['push'](_0x427126['shift']());}};_0x170228(++_0x5b9d2a);}(_0xc8bc,0xf7));var _0xcc8b=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xc8bc[_0x478c8a];return _0x3b6b3e;};'use strict';var pdf=require(_0xcc8b('0x0'));var emlformat=require(_0xcc8b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcc8b('0x2'));var jsonpatch=require(_0xcc8b('0x3'));var rp=require('request-promise');var moment=require(_0xcc8b('0x4'));var BPromise=require(_0xcc8b('0x5'));var Mustache=require(_0xcc8b('0x6'));var util=require('util');var path=require(_0xcc8b('0x7'));var sox=require('sox');var csv=require(_0xcc8b('0x8'));var ejs=require(_0xcc8b('0x9'));var fs=require('fs');var _=require(_0xcc8b('0xa'));var squel=require(_0xcc8b('0xb'));var crypto=require(_0xcc8b('0xc'));var jsforce=require(_0xcc8b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcc8b('0x8'));var querystring=require('querystring');var Papa=require(_0xcc8b('0xe'));var Redis=require(_0xcc8b('0xf'));var authService=require(_0xcc8b('0x10'));var qs=require(_0xcc8b('0x11'));var as=require(_0xcc8b('0x12'));var hardwareService=require(_0xcc8b('0x13'));var logger=require(_0xcc8b('0x14'))(_0xcc8b('0x15'));var utils=require(_0xcc8b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcc8b('0x17'));var db=require(_0xcc8b('0x18'))['db'];function respondWithStatusCode(_0x739f7,_0x8cfd84){_0x8cfd84=_0x8cfd84||0xcc;return function(_0x349ccc){if(_0x349ccc){return _0x739f7[_0xcc8b('0x19')](_0x8cfd84);}return _0x739f7['status'](_0x8cfd84)['end']();};}function respondWithResult(_0x672cd4,_0x294424){_0x294424=_0x294424||0xc8;return function(_0x2b14f3){if(_0x2b14f3){return _0x672cd4[_0xcc8b('0x1a')](_0x294424)[_0xcc8b('0x1b')](_0x2b14f3);}};}function respondWithFilteredResult(_0x4b9462,_0x795b81){return function(_0x4f6775){if(_0x4f6775){var _0x1752ee=_0x4f6775[_0xcc8b('0x1c')],_0x31a563=_0x795b81[_0xcc8b('0x1d')],_0x55c954=_0x795b81[_0xcc8b('0x1d')]+_0x795b81[_0xcc8b('0x1e')],_0x35e30a;if(_0x55c954>=_0x1752ee){_0x55c954=_0x1752ee;_0x35e30a=0xc8;}else{_0x35e30a=0xce;}_0x4b9462[_0xcc8b('0x1a')](_0x35e30a);return _0x4b9462[_0xcc8b('0x1f')](_0xcc8b('0x20'),_0x31a563+'-'+_0x55c954+'/'+_0x1752ee)[_0xcc8b('0x1b')](_0x4f6775);}return null;};}function patchUpdates(_0x7e4af4){return function(_0x5ea626){try{jsonpatch[_0xcc8b('0x21')](_0x5ea626,_0x7e4af4,!![]);}catch(_0x44c2df){return BPromise['reject'](_0x44c2df);}return _0x5ea626['save']();};}function saveUpdates(_0x56322b,_0x3f437f){return function(_0x22ca9c){if(_0x22ca9c){return _0x22ca9c[_0xcc8b('0x22')](_0x56322b)[_0xcc8b('0x23')](function(_0x13114f){return _0x13114f;});}return null;};}function removeEntity(_0x567b14,_0x2f78e8){return function(_0x34abbf){if(_0x34abbf){return _0x34abbf[_0xcc8b('0x24')]()[_0xcc8b('0x23')](function(){_0x567b14[_0xcc8b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x266b15,_0x382c66){return function(_0x2ea08c){if(!_0x2ea08c){_0x266b15[_0xcc8b('0x19')](0x194);}return _0x2ea08c;};}function handleError(_0x4758a2,_0x2ac96c){_0x2ac96c=_0x2ac96c||0x1f4;return function(_0x435a42){logger[_0xcc8b('0x25')](_0x435a42[_0xcc8b('0x26')]);if(_0x435a42[_0xcc8b('0x27')]){delete _0x435a42[_0xcc8b('0x27')];}_0x4758a2['status'](_0x2ac96c)[_0xcc8b('0x28')](_0x435a42);};}exports[_0xcc8b('0x29')]=function(_0xde2a1b,_0x25ce63){var _0x5decaf={'raw':!![],'where':{'id':_0xde2a1b['params']['id']}},_0x4f6160={};_0x4f6160[_0xcc8b('0x2a')]=_[_0xcc8b('0x2b')](db[_0xcc8b('0x2c')][_0xcc8b('0x2d')]);_0x4f6160['query']=_[_0xcc8b('0x2b')](_0xde2a1b[_0xcc8b('0x2e')]);_0x4f6160[_0xcc8b('0x2f')]=_[_0xcc8b('0x30')](_0x4f6160['model'],_0x4f6160['query']);_0x5decaf[_0xcc8b('0x31')]=_[_0xcc8b('0x30')](_0x4f6160[_0xcc8b('0x2a')],qs[_0xcc8b('0x32')](_0xde2a1b[_0xcc8b('0x2e')]['fields']));_0x5decaf[_0xcc8b('0x31')]=_0x5decaf[_0xcc8b('0x31')][_0xcc8b('0x33')]?_0x5decaf[_0xcc8b('0x31')]:_0x4f6160[_0xcc8b('0x2a')];if(_0xde2a1b[_0xcc8b('0x2e')][_0xcc8b('0x34')]){_0x5decaf[_0xcc8b('0x35')]=[{'all':!![]}];}_0x5decaf=_[_0xcc8b('0x36')]({},_0x5decaf,_0xde2a1b['options']);return db[_0xcc8b('0x2c')]['find'](_0x5decaf)[_0xcc8b('0x23')](handleEntityNotFound(_0x25ce63,null))[_0xcc8b('0x23')](respondWithResult(_0x25ce63,null))[_0xcc8b('0x37')](handleError(_0x25ce63,null));};exports['update']=function(_0x2698c2,_0x1e92dc){if(_0x2698c2[_0xcc8b('0x38')]['id']){delete _0x2698c2[_0xcc8b('0x38')]['id'];}return db[_0xcc8b('0x2c')]['find']({'where':{'id':_0x2698c2[_0xcc8b('0x39')]['id']}})['then'](handleEntityNotFound(_0x1e92dc,null))['then'](saveUpdates(_0x2698c2[_0xcc8b('0x38')],null))[_0xcc8b('0x23')](respondWithResult(_0x1e92dc,null))[_0xcc8b('0x37')](handleError(_0x1e92dc,null));};exports['destroy']=function(_0x4f9b9a,_0x4fd499){return db[_0xcc8b('0x2c')][_0xcc8b('0x3a')]({'where':{'id':_0x4f9b9a[_0xcc8b('0x39')]['id']}})['then'](handleEntityNotFound(_0x4fd499,null))[_0xcc8b('0x23')](removeEntity(_0x4fd499,null))[_0xcc8b('0x37')](handleError(_0x4fd499,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 9535e54..b71db24 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 _0xdac7=['lodash','util','bluebird','request-promise','path','rimraf','MailApplication','utf8mb4'];(function(_0x1d5da3,_0x52ffff){var _0x40be08=function(_0xe6069){while(--_0xe6069){_0x1d5da3['push'](_0x1d5da3['shift']());}};_0x40be08(++_0x52ffff);}(_0xdac7,0x180));var _0x7dac=function(_0x47ad3e,_0x4d5514){_0x47ad3e=_0x47ad3e-0x0;var _0xdeacbe=_0xdac7[_0x47ad3e];return _0xdeacbe;};'use strict';var _=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7dac('0x2'));var rp=require(_0x7dac('0x3'));var fs=require('fs');var path=require(_0x7dac('0x4'));var rimraf=require(_0x7dac('0x5'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module['exports']=function(_0x17a05f,_0x2557ee){return _0x17a05f['define'](_0x7dac('0x6'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7dac('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x955f=['moment','request-promise','../../config/environment','exports','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x54e970,_0x56881d){var _0x64c2ae=function(_0x14fc8c){while(--_0x14fc8c){_0x54e970['push'](_0x54e970['shift']());}};_0x64c2ae(++_0x56881d);}(_0x955f,0x1eb));var _0xf955=function(_0x4c1a6d,_0x8fdd49){_0x4c1a6d=_0x4c1a6d-0x0;var _0x38e1a2=_0x955f[_0x4c1a6d];return _0x38e1a2;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var logger=require(_0xf955('0x2'))(_0xf955('0x3'));var moment=require(_0xf955('0x4'));var BPromise=require('bluebird');var rp=require(_0xf955('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf955('0x6'));var attributes=require('./mailApplication.attributes');module[_0xf955('0x7')]=function(_0x2caff2,_0x3fdac2){return _0x2caff2['define'](_0xf955('0x8'),attributes,{'tableName':_0xf955('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf955('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a952a21..650ac1c 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 _0x609f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x31df61,_0x110d45){var _0x293ffe=function(_0x324690){while(--_0x324690){_0x31df61['push'](_0x31df61['shift']());}};_0x293ffe(++_0x110d45);}(_0x609f,0x167));var _0xf609=function(_0x173060,_0xf5ad1){_0x173060=_0x173060-0x0;var _0x122cad=_0x609f[_0x173060];return _0x122cad;};'use strict';var _=require(_0xf609('0x0'));var util=require(_0xf609('0x1'));var moment=require(_0xf609('0x2'));var BPromise=require(_0xf609('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf609('0x4'));var db=require(_0xf609('0x5'))['db'];var utils=require(_0xf609('0x6'));var logger=require(_0xf609('0x7'))(_0xf609('0x8'));var config=require(_0xf609('0x9'));var jayson=require(_0xf609('0xa'));var client=jayson[_0xf609('0xb')][_0xf609('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e40cc,_0x5c9525,_0x2ec401){return new BPromise(function(_0x4c90b8,_0x48b078){return client[_0xf609('0xd')](_0x2e40cc,_0x2ec401)[_0xf609('0xe')](function(_0x385e90){logger['info'](_0xf609('0xf'),_0x5c9525,_0xf609('0x10'));logger[_0xf609('0x11')](_0xf609('0x12'),_0x5c9525,'request\x20sent',JSON['stringify'](_0x385e90));if(_0x385e90[_0xf609('0x13')]){if(_0x385e90[_0xf609('0x13')][_0xf609('0x14')]===0x1f4){logger['error'](_0xf609('0xf'),_0x5c9525,_0x385e90[_0xf609('0x13')][_0xf609('0x15')]);return _0x48b078(_0x385e90['error']['message']);}logger['error']('MailApplication,\x20%s,\x20%s',_0x5c9525,_0x385e90['error'][_0xf609('0x15')]);return _0x4c90b8(_0x385e90[_0xf609('0x13')][_0xf609('0x15')]);}else{logger[_0xf609('0x16')](_0xf609('0xf'),_0x5c9525,_0xf609('0x10'));_0x4c90b8(_0x385e90[_0xf609('0x17')][_0xf609('0x15')]);}})['catch'](function(_0xc31e73){logger[_0xf609('0x13')](_0xf609('0xf'),_0x5c9525,_0xc31e73);_0x48b078(_0xc31e73);});});}exports[_0xf609('0x18')]=function(_0x30cf8b){var _0x5b3be6=this;return new Promise(function(_0x85ff5f,_0x7f82b3){return db[_0xf609('0x19')][_0xf609('0x1a')](_0x30cf8b[_0xf609('0x1b')],{'raw':_0x30cf8b[_0xf609('0x1c')]?_0x30cf8b['options'][_0xf609('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30cf8b[_0xf609('0x1c')]?_0x30cf8b[_0xf609('0x1c')][_0xf609('0x1e')]||null:null,'attributes':_0x30cf8b[_0xf609('0x1c')]?_0x30cf8b[_0xf609('0x1c')][_0xf609('0x1f')]||null:null,'limit':_0x30cf8b[_0xf609('0x1c')]?_0x30cf8b[_0xf609('0x1c')][_0xf609('0x20')]||null:null})[_0xf609('0xe')](function(_0x97aa2d){logger[_0xf609('0x16')](_0xf609('0x18'),_0x30cf8b);logger[_0xf609('0x11')]('UpdateMailApplication',_0x30cf8b,JSON['stringify'](_0x97aa2d));_0x85ff5f(_0x97aa2d);})['catch'](function(_0x4d9df3){logger[_0xf609('0x13')](_0xf609('0x18'),_0x4d9df3[_0xf609('0x15')],_0x30cf8b);_0x7f82b3(_0x5b3be6[_0xf609('0x13')](0x1f4,_0x4d9df3[_0xf609('0x15')]));});});}; \ No newline at end of file +var _0x0012=['request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','result','update','body','options','raw','where','info','UpdateMailApplication','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0012,0x1d0));var _0x2001=function(_0x560ecf,_0x406bd1){_0x560ecf=_0x560ecf-0x0;var _0x267aba=_0x0012[_0x560ecf];return _0x267aba;};'use strict';var _=require('lodash');var util=require(_0x2001('0x0'));var moment=require(_0x2001('0x1'));var BPromise=require(_0x2001('0x2'));var rs=require(_0x2001('0x3'));var fs=require('fs');var Redis=require(_0x2001('0x4'));var db=require(_0x2001('0x5'))['db'];var utils=require(_0x2001('0x6'));var logger=require('../../config/logger')(_0x2001('0x7'));var config=require(_0x2001('0x8'));var jayson=require(_0x2001('0x9'));var client=jayson[_0x2001('0xa')][_0x2001('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2970eb,_0x26dae4,_0xc0b9ba){return new BPromise(function(_0x521c37,_0xa42e4a){return client[_0x2001('0xc')](_0x2970eb,_0xc0b9ba)[_0x2001('0xd')](function(_0xaaabef){logger['info'](_0x2001('0xe'),_0x26dae4,_0x2001('0xf'));logger[_0x2001('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x26dae4,'request\x20sent',JSON['stringify'](_0xaaabef));if(_0xaaabef['error']){if(_0xaaabef[_0x2001('0x11')]['code']===0x1f4){logger[_0x2001('0x11')](_0x2001('0xe'),_0x26dae4,_0xaaabef['error']['message']);return _0xa42e4a(_0xaaabef[_0x2001('0x11')][_0x2001('0x12')]);}logger['error'](_0x2001('0xe'),_0x26dae4,_0xaaabef[_0x2001('0x11')][_0x2001('0x12')]);return _0x521c37(_0xaaabef[_0x2001('0x11')][_0x2001('0x12')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x26dae4,_0x2001('0xf'));_0x521c37(_0xaaabef[_0x2001('0x13')][_0x2001('0x12')]);}})['catch'](function(_0x90ef05){logger[_0x2001('0x11')](_0x2001('0xe'),_0x26dae4,_0x90ef05);_0xa42e4a(_0x90ef05);});});}exports['UpdateMailApplication']=function(_0x45e7d0){var _0x4a4cad=this;return new Promise(function(_0x1f8478,_0x1a87e4){return db['MailApplication'][_0x2001('0x14')](_0x45e7d0[_0x2001('0x15')],{'raw':_0x45e7d0[_0x2001('0x16')]?_0x45e7d0['options'][_0x2001('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45e7d0[_0x2001('0x16')]?_0x45e7d0[_0x2001('0x16')][_0x2001('0x18')]||null:null,'attributes':_0x45e7d0['options']?_0x45e7d0[_0x2001('0x16')]['attributes']||null:null,'limit':_0x45e7d0[_0x2001('0x16')]?_0x45e7d0[_0x2001('0x16')]['limit']||null:null})[_0x2001('0xd')](function(_0x431c91){logger[_0x2001('0x19')](_0x2001('0x1a'),_0x45e7d0);logger['debug'](_0x2001('0x1a'),_0x45e7d0,JSON['stringify'](_0x431c91));_0x1f8478(_0x431c91);})[_0x2001('0x1b')](function(_0x9d3364){logger['error'](_0x2001('0x1a'),_0x9d3364[_0x2001('0x12')],_0x45e7d0);_0x1a87e4(_0x4a4cad[_0x2001('0x11')](0x1f4,_0x9d3364[_0x2001('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 28030db..bc10585 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 _0x7388=['addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mail','mailinteraction:destroy','destroy','removeTags','exports','multer','util','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/messages','/:id/download','download','post','create'];(function(_0x5b9829,_0x197062){var _0x2e9e4b=function(_0x43cad5){while(--_0x43cad5){_0x5b9829['push'](_0x5b9829['shift']());}};_0x2e9e4b(++_0x197062);}(_0x7388,0xf8));var _0x8738=function(_0x13e426,_0x5c0edf){_0x13e426=_0x13e426-0x0;var _0x2d4504=_0x7388[_0x13e426];return _0x2d4504;};'use strict';var multer=require(_0x8738('0x0'));var util=require(_0x8738('0x1'));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(_0x8738('0x2'));var config=require('../../config/environment');var controller=require('./mailInteraction.controller');router[_0x8738('0x3')]('/',auth[_0x8738('0x4')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x8738('0x5'),auth['isAuthenticated'](),controller[_0x8738('0x6')]);router[_0x8738('0x3')](_0x8738('0x7'),auth[_0x8738('0x4')](),controller['getMessages']);router[_0x8738('0x3')](_0x8738('0x8'),auth[_0x8738('0x4')](),controller[_0x8738('0x9')]);router[_0x8738('0xa')]('/',auth[_0x8738('0x4')](),controller[_0x8738('0xb')]);router[_0x8738('0xa')](_0x8738('0x7'),auth[_0x8738('0x4')](),controller[_0x8738('0xc')]);router[_0x8738('0xa')](_0x8738('0xd'),auth[_0x8738('0x4')](),interaction[_0x8738('0xe')]('mail',_0x8738('0xf')),controller[_0x8738('0x10')]);router[_0x8738('0x11')](_0x8738('0x5'),auth[_0x8738('0x4')](),interaction[_0x8738('0xe')]('mail',_0x8738('0x12')),controller[_0x8738('0x13')]);router[_0x8738('0x14')]('/:id',auth[_0x8738('0x4')](),interaction[_0x8738('0xe')](_0x8738('0x15'),_0x8738('0x16')),controller[_0x8738('0x17')]);router[_0x8738('0x14')](_0x8738('0xd'),auth[_0x8738('0x4')](),controller[_0x8738('0x18')]);module[_0x8738('0x19')]=router; \ No newline at end of file +var _0x2e9f=['delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','/:id','mailinteraction:update','update'];(function(_0x39678c,_0x37c03c){var _0x1624a2=function(_0x131fc9){while(--_0x131fc9){_0x39678c['push'](_0x39678c['shift']());}};_0x1624a2(++_0x37c03c);}(_0x2e9f,0xc5));var _0xf2e9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2e9f[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xf2e9('0x0'));var util=require(_0xf2e9('0x1'));var path=require('path');var timeout=require(_0xf2e9('0x2'));var express=require(_0xf2e9('0x3'));var router=express[_0xf2e9('0x4')]();var auth=require(_0xf2e9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf2e9('0x6'));var controller=require('./mailInteraction.controller');router[_0xf2e9('0x7')]('/',auth[_0xf2e9('0x8')](),controller[_0xf2e9('0x9')]);router['get']('/describe',auth[_0xf2e9('0x8')](),controller[_0xf2e9('0xa')]);router[_0xf2e9('0x7')]('/:id',auth[_0xf2e9('0x8')](),controller[_0xf2e9('0xb')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xf2e9('0xc')]);router[_0xf2e9('0x7')](_0xf2e9('0xd'),auth['isAuthenticated'](),controller[_0xf2e9('0xe')]);router[_0xf2e9('0xf')]('/',auth[_0xf2e9('0x8')](),controller[_0xf2e9('0x10')]);router[_0xf2e9('0xf')](_0xf2e9('0x11'),auth[_0xf2e9('0x8')](),controller[_0xf2e9('0x12')]);router[_0xf2e9('0xf')](_0xf2e9('0x13'),auth[_0xf2e9('0x8')](),interaction[_0xf2e9('0x14')](_0xf2e9('0x15'),_0xf2e9('0x16')),controller[_0xf2e9('0x17')]);router['put'](_0xf2e9('0x18'),auth['isAuthenticated'](),interaction[_0xf2e9('0x14')](_0xf2e9('0x15'),_0xf2e9('0x19')),controller[_0xf2e9('0x1a')]);router[_0xf2e9('0x1b')](_0xf2e9('0x18'),auth[_0xf2e9('0x8')](),interaction[_0xf2e9('0x14')](_0xf2e9('0x15'),_0xf2e9('0x1c')),controller[_0xf2e9('0x1d')]);router['delete'](_0xf2e9('0x13'),auth[_0xf2e9('0x8')](),controller[_0xf2e9('0x1e')]);module[_0xf2e9('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 84bb351..f272fcd 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 _0x8c5b=['ENUM','out','long','iconv','exports','DATE','STRING','TEXT','BOOLEAN'];(function(_0x432f0c,_0x2e5b06){var _0x2e1081=function(_0x168de2){while(--_0x168de2){_0x432f0c['push'](_0x432f0c['shift']());}};_0x2e1081(++_0x2e5b06);}(_0x8c5b,0x6f));var _0xb8c5=function(_0x15b192,_0x38c235){_0x15b192=_0x15b192-0x0;var _0x396e73=_0x8c5b[_0x15b192];return _0x396e73;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xb8c5('0x0'));module[_0xb8c5('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb8c5('0x2')]},'disposition':{'type':Sequelize[_0xb8c5('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb8c5('0x3')]},'note':{'type':Sequelize[_0xb8c5('0x3')]},'inReplyTo':{'type':Sequelize[_0xb8c5('0x3')](0x1fe)},'to':{'type':Sequelize[_0xb8c5('0x3')]},'cc':{'type':Sequelize[_0xb8c5('0x4')]('long')},'subject':{'type':Sequelize[_0xb8c5('0x4')]()},'attach':{'type':Sequelize[_0xb8c5('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb8c5('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xb8c5('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xb8c5('0x6')]('in',_0xb8c5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb8c5('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xb8c5('0x6')]('in',_0xb8c5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xb8c5('0x4')](_0xb8c5('0x8'))},'lastMsgText':{'type':Sequelize[_0xb8c5('0x4')](_0xb8c5('0x8'))}}; \ No newline at end of file +var _0x117a=['iconv','DATE','STRING','TEXT','long','BOOLEAN','ENUM','out'];(function(_0x28297f,_0x343fd4){var _0x13ec6b=function(_0x5afaaf){while(--_0x5afaaf){_0x28297f['push'](_0x28297f['shift']());}};_0x13ec6b(++_0x343fd4);}(_0x117a,0x1d8));var _0xa117=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0x117a[_0x112fe3];return _0x1ec903;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xa117('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa117('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa117('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa117('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xa117('0x3')](_0xa117('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xa117('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa117('0x1')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xa117('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xa117('0x6')]('in',_0xa117('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa117('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xa117('0x6')]('in',_0xa117('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xa117('0x3')](_0xa117('0x4'))},'lastMsgText':{'type':Sequelize['TEXT'](_0xa117('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 11cfa74..6ef4351 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 _0xa478=['Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','MailInteractionId','findOne','enableEmailPreview','push','all','show','params','includeAll','include','options','create','body','destroy','describe','addMessage','ids','omit','nolimit','pick','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','rows','addTags','setTags','findAll','color','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','writeFileSync','message%d.eml','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','MailInteraction','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','select','field','tools_tags','u.id','from','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','expr','search','sqlOperator','conditions','length','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','plainBody','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','sequelize','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal'];(function(_0x4dadb4,_0x3905a2){var _0x1758ed=function(_0x3304d2){while(--_0x3304d2){_0x4dadb4['push'](_0x4dadb4['shift']());}};_0x1758ed(++_0x3905a2);}(_0xa478,0x136));var _0x8a47=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0xa478[_0x543c51];return _0x360555;};'use strict';var pdf=require(_0x8a47('0x0'));var emlformat=require(_0x8a47('0x1'));var rimraf=require(_0x8a47('0x2'));var zipdir=require(_0x8a47('0x3'));var jsonpatch=require(_0x8a47('0x4'));var rp=require(_0x8a47('0x5'));var moment=require(_0x8a47('0x6'));var BPromise=require(_0x8a47('0x7'));var Mustache=require(_0x8a47('0x8'));var util=require(_0x8a47('0x9'));var path=require(_0x8a47('0xa'));var sox=require(_0x8a47('0xb'));var csv=require('to-csv');var ejs=require(_0x8a47('0xc'));var fs=require('fs');var _=require(_0x8a47('0xd'));var squel=require(_0x8a47('0xe'));var crypto=require(_0x8a47('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8a47('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a47('0x11'));var Papa=require(_0x8a47('0x12'));var htmlToText=require(_0x8a47('0x13'));var juice=require('juice');var Redis=require(_0x8a47('0x14'));var authService=require(_0x8a47('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x8a47('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a47('0x17'))(_0x8a47('0x18'));var utils=require(_0x8a47('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8a47('0x1a')]=_[_0x8a47('0x1b')](config['redis'],{'host':_0x8a47('0x1c'),'port':0x18eb});var socket=require(_0x8a47('0x1d'))(new Redis(config[_0x8a47('0x1a')]));require(_0x8a47('0x1e'))[_0x8a47('0x1f')](socket);function respondWithStatusCode(_0xee9ffb,_0x2f682e){_0x2f682e=_0x2f682e||0xcc;return function(_0x1c8488){if(_0x1c8488){return _0xee9ffb[_0x8a47('0x20')](_0x2f682e);}return _0xee9ffb[_0x8a47('0x21')](_0x2f682e)[_0x8a47('0x22')]();};}function respondWithResult(_0x226c43,_0x2917d9){_0x2917d9=_0x2917d9||0xc8;return function(_0x4ad72d){if(_0x4ad72d){return _0x226c43[_0x8a47('0x21')](_0x2917d9)[_0x8a47('0x23')](_0x4ad72d);}};}function respondWithFilteredResult(_0x3f9093,_0x5f5884){return function(_0x341089){if(_0x341089){var _0x5c62eb=_0x341089[_0x8a47('0x24')],_0x538ed2=_0x5f5884[_0x8a47('0x25')],_0x1cf650=_0x5f5884[_0x8a47('0x25')]+_0x5f5884[_0x8a47('0x26')],_0x2174b1;if(_0x1cf650>=_0x5c62eb){_0x1cf650=_0x5c62eb;_0x2174b1=0xc8;}else{_0x2174b1=0xce;}_0x3f9093[_0x8a47('0x21')](_0x2174b1);return _0x3f9093[_0x8a47('0x27')](_0x8a47('0x28'),_0x538ed2+'-'+_0x1cf650+'/'+_0x5c62eb)[_0x8a47('0x23')](_0x341089);}return null;};}function patchUpdates(_0x54ce6a){return function(_0x20f8af){try{jsonpatch['apply'](_0x20f8af,_0x54ce6a,!![]);}catch(_0x289f28){return BPromise[_0x8a47('0x29')](_0x289f28);}return _0x20f8af[_0x8a47('0x2a')]();};}function saveUpdates(_0x3658aa,_0x5d4b6c){return function(_0x116b5e){if(_0x116b5e){return _0x116b5e['update'](_0x3658aa)['then'](function(_0x4d71f4){return _0x4d71f4;});}return null;};}function removeEntity(_0x4cbd83,_0xf46d2c){return function(_0x15a812){if(_0x15a812){return _0x15a812['destroy']()[_0x8a47('0x2b')](function(){_0x4cbd83[_0x8a47('0x21')](0xcc)[_0x8a47('0x22')]();});}};}function handleEntityNotFound(_0xfb9ae0,_0x44cf20){return function(_0xd06be6){if(!_0xd06be6){_0xfb9ae0[_0x8a47('0x20')](0x194);}return _0xd06be6;};}function handleError(_0x576fb3,_0x22a52f){_0x22a52f=_0x22a52f||0x1f4;return function(_0x4a10c3){logger[_0x8a47('0x2c')](_0x4a10c3[_0x8a47('0x2d')]);if(_0x4a10c3['name']){delete _0x4a10c3[_0x8a47('0x2e')];}_0x576fb3['status'](_0x22a52f)['send'](_0x4a10c3);};}function getInteractionUsers(_0x12470a,_0x9b51b8){return new BPromise(function(_0x1ddbcf,_0x12f0b7){try{if(_0x9b51b8[_0x12470a['id']]){_0x12470a[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x9b51b8[_0x12470a['id']],function(_0x58aa06){return{'id':_0x58aa06['id'],'fullname':_0x58aa06[_0x8a47('0x31')]};});}}catch(_0x4d78b5){_0x12f0b7(_0x4d78b5);}_0x1ddbcf(_0x12470a);});}function getInteractionTags(_0x549913,_0x448459){return new BPromise(function(_0x2d24c3,_0x179077){try{if(_0x549913[_0x8a47('0x32')]){_0x549913[_0x8a47('0x33')]=[];_0x549913[_0x8a47('0x32')][_0x8a47('0x34')](',')[_0x8a47('0x35')](function(_0x7242e7){_0x549913[_0x8a47('0x33')]['push'](_0x448459[_0x7242e7]);});}delete _0x549913[_0x8a47('0x32')];}catch(_0x2aa367){_0x179077(_0x2aa367);}_0x2d24c3(_0x549913);});}function getLastMessageText(_0x6b3a71){return new BPromise(function(_0x4c4f9b,_0x8d8812){return db[_0x8a47('0x36')]['findOne']({'where':{'id':_0x6b3a71['id']},'attributes':[_0x8a47('0x37'),_0x8a47('0x38')],'raw':!![]})[_0x8a47('0x2b')](function(_0x20551b){if(!_0x20551b['lastMsgText']){_0x6b3a71['lastMsgText']=_[_0x8a47('0x39')](htmlToText[_0x8a47('0x3a')](_0x20551b[_0x8a47('0x37')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x6b3a71[_0x8a47('0x38')]=_0x20551b[_0x8a47('0x38')];}_0x4c4f9b(_0x6b3a71);})[_0x8a47('0x3b')](function(_0x1819ef){_0x8d8812(_0x1819ef);});});}function updateMailInteraction(_0x49fde2,_0x50cd23,_0x36e37e,_0x3636af){return new BPromise(function(_0x336b60,_0x7a195b){return getInteractionUsers(_0x49fde2,_0x36e37e)[_0x8a47('0x2b')](function(_0x1280ce){return getInteractionTags(_0x1280ce,_0x50cd23);})[_0x8a47('0x2b')](function(_0xd8af46){if(_0x3636af){_0x336b60(getLastMessageText(_0xd8af46));}else{_0x336b60(_0xd8af46);}})[_0x8a47('0x3b')](function(_0x2570e0){_0x7a195b(_0x2570e0);});});}exports[_0x8a47('0x3c')]=function(_0x5a4bb1,_0x258cc4){var _0x563fe2={},_0x541832={},_0x544fe2={'count':0x0,'rows':[]};var _0x4a9da2=_['map'](db[_0x8a47('0x36')][_0x8a47('0x3d')],function(_0xbaafd8){return{'name':_0xbaafd8[_0x8a47('0x3e')],'type':_0xbaafd8[_0x8a47('0x3f')][_0x8a47('0x40')]};});_0x541832[_0x8a47('0x41')]=_[_0x8a47('0x30')](_0x4a9da2,'name');_0x541832['query']=_[_0x8a47('0x42')](_0x5a4bb1[_0x8a47('0x43')]);_0x541832[_0x8a47('0x44')]=_[_0x8a47('0x45')](_0x541832['model'],_0x541832[_0x8a47('0x43')]);_0x563fe2[_0x8a47('0x46')]=_[_0x8a47('0x45')](_0x541832[_0x8a47('0x41')],qs[_0x8a47('0x47')](_0x5a4bb1['query'][_0x8a47('0x47')]));_0x563fe2[_0x8a47('0x46')]=_0x563fe2[_0x8a47('0x46')]['length']?_0x563fe2[_0x8a47('0x46')]:_0x541832[_0x8a47('0x41')];if(!_0x5a4bb1[_0x8a47('0x43')][_0x8a47('0x48')]('nolimit')){_0x563fe2[_0x8a47('0x26')]=qs[_0x8a47('0x26')](_0x5a4bb1[_0x8a47('0x43')][_0x8a47('0x26')]);_0x563fe2[_0x8a47('0x25')]=qs[_0x8a47('0x25')](_0x5a4bb1['query']['offset']);}_0x563fe2[_0x8a47('0x49')]=qs[_0x8a47('0x4a')](_0x5a4bb1[_0x8a47('0x43')]['sort']);_0x563fe2[_0x8a47('0x4b')]=qs[_0x8a47('0x44')](_['pick'](_0x5a4bb1['query'],_0x541832[_0x8a47('0x44')]),_0x4a9da2);var _0x554c93=[];var _0xbfc938=squel[_0x8a47('0x4c')]()[_0x8a47('0x4d')]('id')[_0x8a47('0x4d')](_0x8a47('0x2e'))[_0x8a47('0x4d')]('color')['from'](_0x8a47('0x4e'));var _0x956308=squel[_0x8a47('0x4c')]()[_0x8a47('0x4d')](_0x8a47('0x4f'))['field']('u.fullname')[_0x8a47('0x4d')]('ui.MailInteractionId')[_0x8a47('0x50')](_0x8a47('0x51'),'ui')['left_join'](_0x8a47('0x52'),'u',_0x8a47('0x53'));var _0x14e22c=squel[_0x8a47('0x4c')]()[_0x8a47('0x50')](_0x8a47('0x54'),'i')[_0x8a47('0x55')](_0x8a47('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8a47('0x55')](_0x8a47('0x52'),'o',_0x8a47('0x57'))[_0x8a47('0x55')]('mail_accounts','a',_0x8a47('0x58'))[_0x8a47('0x55')](_0x8a47('0x59'),'me',_0x8a47('0x5a'))[_0x8a47('0x55')](_0x8a47('0x5b'),'it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x8a47('0x4e'),'t','t.id\x20=\x20it.TagId');var _0x1da8b7=squel[_0x8a47('0x5c')]();var _0x5a1b29=[];var _0xb05ed1=squel['expr']();var _0x315111;if(_0x5a4bb1['query'][_0x8a47('0x5d')]){_0x315111=as['parseSearch'](_0x5a4bb1[_0x8a47('0x43')][_0x8a47('0x5d')]);var _0xdaa896=_0x315111[_0x8a47('0x5e')];for(var _0x4590ae=0x0;_0x4590ae<_0x315111[_0x8a47('0x5f')][_0x8a47('0x60')];_0x4590ae++){var _0xbdd75e=_0x315111[_0x8a47('0x5f')][_0x4590ae];var _0x2a4f13='i';var _0x927a61=_['find'](_0x4a9da2,[_0x8a47('0x2e'),_0xbdd75e[_0x8a47('0x4d')]]);if(!_0x927a61){switch(_0xbdd75e['field']){case _0x8a47('0x61'):if(_0xbdd75e[_0x8a47('0x62')]==0x1){_0x14e22c[_0x8a47('0x63')]('`'+_0xbdd75e[_0x8a47('0x4d')]+_0x8a47('0x64'));}else{_0x14e22c[_0x8a47('0x63')]('`'+_0xbdd75e[_0x8a47('0x4d')]+_0x8a47('0x65'));}break;case _0x8a47('0x66'):if(_0xbdd75e[_0x8a47('0x67')]===_0x8a47('0x68')){if(_0xbdd75e[_0x8a47('0x62')]['split']('\x20')[_0x8a47('0x60')]>0x1){_0x1da8b7[_0xdaa896](_0x8a47('0x69'),qs[_0x8a47('0x6a')](_0xbdd75e[_0x8a47('0x62')]),null);}else{var _0x2291bc='%'+_0xbdd75e[_0x8a47('0x62')]+'%';_0x1da8b7[_0xdaa896](_0x8a47('0x6b'),_0x2291bc,_0x2291bc,_0x2291bc);}}else{_0x927a61=_[_0x8a47('0x6c')](_0x4a9da2,[_0x8a47('0x2e'),_0x8a47('0x6d')]);_0xbdd75e[_0x8a47('0x4d')]=_0x8a47('0x6d');_0x19f7a9=as[_0x8a47('0x6e')](_0x2a4f13,_0x927a61[_0x8a47('0x3f')],_0xbdd75e);_0x1da8b7[_0xdaa896](_0x19f7a9[_0x8a47('0x6f')],_0x19f7a9[_0x8a47('0x62')]['start'],_0x19f7a9[_0x8a47('0x62')]['end']);}break;case _0x8a47('0x70'):var _0x2a4e4d=_0xbdd75e[_0x8a47('0x62')][_0x8a47('0x34')](',')[_0x8a47('0x30')](function(_0x17cdd7){return Number(_0x17cdd7);});_0x2a4e4d['forEach'](function(_0x170c7d){_0xb05ed1['or'](_0x8a47('0x71'),'%,'+_0x170c7d+',%');});_0x5a1b29=_[_0x8a47('0x72')](_0x5a1b29,_0x2a4e4d);break;case'User':if(_0xbdd75e['operator']===_0x8a47('0x68')){_0x1da8b7[_0xdaa896](_0x8a47('0x73'),'%'+_0xbdd75e['value']+'%',null);}else{_0x927a61=_[_0x8a47('0x6c')](_0x4a9da2,[_0x8a47('0x2e'),_0x8a47('0x74')]);_0xbdd75e[_0x8a47('0x4d')]=_0x8a47('0x74');_0x19f7a9=as[_0x8a47('0x6e')](_0x2a4f13,_0x927a61[_0x8a47('0x3f')],_0xbdd75e);_0x1da8b7[_0xdaa896](_0x19f7a9[_0x8a47('0x6f')],_0x19f7a9[_0x8a47('0x62')][_0x8a47('0x75')],_0x19f7a9[_0x8a47('0x62')][_0x8a47('0x22')]);}break;case _0x8a47('0x76'):_0x19f7a9=as['buildExpression']('me',null,_0xbdd75e);_0x1da8b7[_0xdaa896](_0x19f7a9[_0x8a47('0x6f')],_0x19f7a9[_0x8a47('0x62')][_0x8a47('0x75')],_0x19f7a9[_0x8a47('0x62')][_0x8a47('0x22')]);break;}}else{var _0x19f7a9=as['buildExpression'](_0x2a4f13,_0x927a61[_0x8a47('0x3f')],_0xbdd75e);_0x1da8b7[_0xdaa896](_0x19f7a9['text'],_0x19f7a9['value'][_0x8a47('0x75')],_0x19f7a9[_0x8a47('0x62')][_0x8a47('0x22')]);}}}else{var _0x423003=_(_0x5a4bb1[_0x8a47('0x43')])[_0x8a47('0x42')]()['map'](function(_0x581262){return _[_0x8a47('0x77')](_0x4a9da2,['name',_0x581262])?_0x581262:undefined;})[_0x8a47('0x78')]()[_0x8a47('0x62')]();if(!_[_0x8a47('0x79')](_0x423003)){_0x423003[_0x8a47('0x35')](function(_0x3ee94e){if(_0x3ee94e===_0x8a47('0x7a')){_0x14e22c[_0x8a47('0x4b')](_0x8a47('0x7b'),[]['concat'](_0x5a4bb1['query'][_0x3ee94e]));}else if(_0x3ee94e===_0x8a47('0x7c')){var _0x131176=JSON[_0x8a47('0x7d')](_0x5a4bb1['query'][_0x3ee94e])['$gte'];var _0x48ef5a=JSON[_0x8a47('0x7d')](_0x5a4bb1['query'][_0x3ee94e])[_0x8a47('0x7e')];_0x14e22c[_0x8a47('0x4b')](_0x8a47('0x7f'),_0x131176,_0x48ef5a);}else{if(_0x5a4bb1[_0x8a47('0x43')][_0x3ee94e]==='null'){_0x14e22c[_0x8a47('0x4b')]('i.'+_0x3ee94e+'\x20IS\x20NULL');}else{_0x14e22c[_0x8a47('0x4b')]('i.'+_0x3ee94e+_0x8a47('0x80'),_0x5a4bb1[_0x8a47('0x43')][_0x3ee94e]);}}});}if(_0x5a4bb1['query'][_0x8a47('0x81')]){if(_0x5a4bb1[_0x8a47('0x43')]['read']==0x1){_0x14e22c[_0x8a47('0x63')](_0x8a47('0x82'));}else{_0x14e22c[_0x8a47('0x63')](_0x8a47('0x83'));}}if(_0x5a4bb1[_0x8a47('0x43')][_0x8a47('0x84')]){_0x5a1b29=_[_0x8a47('0x85')](_0x5a4bb1[_0x8a47('0x43')]['tag'])?_0x5a4bb1[_0x8a47('0x43')][_0x8a47('0x84')]:new Array(_0x5a4bb1['query'][_0x8a47('0x84')]);_0x5a1b29[_0x8a47('0x35')](function(_0x5d50c7){_0xb05ed1['or'](_0x8a47('0x71'),'%,'+_0x5d50c7+',%');});}if(_0x5a4bb1[_0x8a47('0x43')][_0x8a47('0x86')]){var _0x44bb9b=_0x5a4bb1[_0x8a47('0x43')]['filter']['replace']('\x5c','\x5c\x5c')[_0x8a47('0x87')](/'/g,'\x27\x27');if(qs[_0x8a47('0x88')](_0x44bb9b)){_0x1da8b7['or'](_0x8a47('0x89'),_0x44bb9b+'%');}else if(qs[_0x8a47('0x8a')](_0x44bb9b)){_0x1da8b7['or'](_0x8a47('0x8b'),_0x44bb9b+'%');}else{_0x1da8b7['or'](_0x8a47('0x8c'),qs[_0x8a47('0x6a')](_0x44bb9b))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8a47('0x6a')](_0x44bb9b));}}}_0x14e22c[_0x8a47('0x4b')](_0x1da8b7);_0x14e22c[_0x8a47('0x8d')]('i.id');var _0x37de36={'type':db[_0x8a47('0x8e')][_0x8a47('0x8f')][_0x8a47('0x90')],'raw':!![]};var _0xc57191=_0x14e22c[_0x8a47('0x91')]();_0xc57191[_0x8a47('0x4d')](_0x8a47('0x92'));_0xc57191['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8a47('0x61'));if(_0x563fe2[_0x8a47('0x49')]){_0x563fe2[_0x8a47('0x49')]['forEach'](function(_0xa83ba1){var _0x155463=_0xa83ba1[0x0]===_0x8a47('0x93')?_0xa83ba1[0x0]:'i.'+_0xa83ba1[0x0];_0x14e22c[_0x8a47('0x49')](_0x155463,_0xa83ba1[0x1]===_0x8a47('0x94')?![]:!![]);});}if(!_[_0x8a47('0x79')](_0x5a1b29)){_0x14e22c[_0x8a47('0x63')](_0xb05ed1);_0xc57191[_0x8a47('0x4b')](_0x8a47('0x95'),_0x5a1b29);}BPromise[_0x8a47('0x96')]()[_0x8a47('0x2b')](function(){if(!_0x315111){if(_0x5a4bb1[_0x8a47('0x43')]['MailAccountId'])return;_0xc57191[_0x8a47('0x4b')](_0x8a47('0x97'));_0x14e22c[_0x8a47('0x4b')](_0x8a47('0x97'));return;}if(_0x5a4bb1[_0x8a47('0x98')][_0x8a47('0x99')]!==_0x8a47('0x9a'))return;return _0x5a4bb1[_0x8a47('0x98')][_0x8a47('0x9b')]({'attributes':['id'],'raw':!![]})[_0x8a47('0x2b')](function(_0x3f7aba){if(_['isEmpty'](_0x3f7aba)){_0xc57191[_0x8a47('0x4b')](_0x8a47('0x9c'));_0x14e22c[_0x8a47('0x4b')](_0x8a47('0x9c'));}else{_0xc57191[_0x8a47('0x4b')](_0x8a47('0x7b'),_[_0x8a47('0x30')](_0x3f7aba,'id'));_0x14e22c[_0x8a47('0x4b')](_0x8a47('0x7b'),_['map'](_0x3f7aba,'id'));}});})[_0x8a47('0x2b')](function(){if(_0x5a4bb1['user'][_0x8a47('0x99')]==='agent'&&!_0x315111&&!_0x5a4bb1[_0x8a47('0x43')][_0x8a47('0x7a')])return[];return db['sequelize'][_0x8a47('0x43')](_0xc57191[_0x8a47('0x9d')](),_0x37de36);})[_0x8a47('0x2b')](function(_0x187531){_0x544fe2['count']=_0x187531[_0x8a47('0x60')];if(_0x544fe2[_0x8a47('0x24')]===0x0)return[];return db[_0x8a47('0x9e')][_0x8a47('0x43')](_0xbfc938[_0x8a47('0x9d')](),_0x37de36)[_0x8a47('0x2b')](function(_0x10681c){_0x554c93=_[_0x8a47('0x9f')](_0x10681c,'id');_0x37de36=_['merge'](_0x37de36,{'model':db[_0x8a47('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a4bb1[_0x8a47('0x43')]['fields']){_0x563fe2[_0x8a47('0x46')]['forEach'](function(_0x501b7e){_0x14e22c[_0x8a47('0x4d')]('i.'+_0x501b7e);});}else{_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xa0'),'unreadMessages');_0x14e22c['field'](_0x8a47('0xa1'),'Account.key');_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xa2'),_0x8a47('0xa3'));_0x14e22c['field'](_0x8a47('0xa4'),_0x8a47('0x93'));_0x14e22c[_0x8a47('0x4d')](_0x8a47('0x92'));_0x14e22c[_0x8a47('0x4d')]('i.createdAt');_0x14e22c[_0x8a47('0x4d')]('i.updatedAt');_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xa5'));_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xa6'));_0x14e22c['field']('i.attach');_0x14e22c['field'](_0x8a47('0xa7'));_0x14e22c['field'](_0x8a47('0xa8'));_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xa9'));_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xaa'));_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xab'));_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xac'));_0x14e22c['field']('i.substatus');_0x14e22c[_0x8a47('0x4d')]('i.to');_0x14e22c['field'](_0x8a47('0xad'));_0x14e22c[_0x8a47('0x4d')]('i.MailAccountId');_0x14e22c['field'](_0x8a47('0xae'));_0x14e22c[_0x8a47('0x4d')]('c.firstName',_0x8a47('0xaf'));_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xb0'),_0x8a47('0xb1'));_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xb2'),'Contact.email');_0x14e22c[_0x8a47('0x4d')]('c.phone',_0x8a47('0xb3'));_0x14e22c['field']('c.mobile',_0x8a47('0xb4'));_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xb5'),_0x8a47('0xb6'));_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xb7'),_0x8a47('0xb8'));_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xb9'),_0x8a47('0xba'));_0x14e22c[_0x8a47('0x4d')](_0x8a47('0xbb'),_0x8a47('0x32'));}if(_0x563fe2['limit'])_0x14e22c[_0x8a47('0x26')](_0x563fe2['limit']);if(_0x563fe2[_0x8a47('0x25')])_0x14e22c[_0x8a47('0x25')](_0x563fe2[_0x8a47('0x25')]);return db[_0x8a47('0x9e')]['query'](_0x14e22c[_0x8a47('0x9d')](),_0x37de36);})[_0x8a47('0x2b')](function(_0x19a789){_0x956308[_0x8a47('0x4b')]('ui.MailInteractionId\x20IN\x20?',_[_0x8a47('0x30')](_0x19a789,'id'));return db[_0x8a47('0x9e')][_0x8a47('0x43')](_0x956308[_0x8a47('0x9d')](),_0x37de36)[_0x8a47('0x2b')](function(_0x54047b){var _0x396843=_['groupBy'](_0x54047b,_0x8a47('0xbc'));var _0x22c7a0=[];return db['Setting'][_0x8a47('0xbd')]({'attributes':[_0x8a47('0xbe')],'raw':!![]})[_0x8a47('0x2b')](function(_0x49ef3b){var _0x3b14cf=_0x49ef3b[_0x8a47('0xbe')];_0x19a789['forEach'](function(_0x14f44b){_0x22c7a0[_0x8a47('0xbf')](updateMailInteraction(_0x14f44b,_0x554c93,_0x396843,_0x3b14cf));});return BPromise[_0x8a47('0xc0')](_0x22c7a0);});});});})[_0x8a47('0x2b')](function(_0x3b8247){_0x544fe2['rows']=_0x3b8247;return _0x544fe2;})[_0x8a47('0x2b')](respondWithFilteredResult(_0x258cc4,_0x563fe2))['catch'](handleError(_0x258cc4,null));};exports[_0x8a47('0xc1')]=function(_0x7b0217,_0xfa67fc){var _0x44e8a2={'raw':![],'where':{'id':_0x7b0217[_0x8a47('0xc2')]['id']}},_0x8dbaec={};_0x8dbaec['model']=_[_0x8a47('0x42')](db[_0x8a47('0x36')]['rawAttributes']);_0x8dbaec['query']=_['keys'](_0x7b0217[_0x8a47('0x43')]);_0x8dbaec[_0x8a47('0x44')]=_[_0x8a47('0x45')](_0x8dbaec[_0x8a47('0x41')],_0x8dbaec[_0x8a47('0x43')]);_0x44e8a2[_0x8a47('0x46')]=_[_0x8a47('0x45')](_0x8dbaec[_0x8a47('0x41')],qs[_0x8a47('0x47')](_0x7b0217[_0x8a47('0x43')]['fields']));_0x44e8a2[_0x8a47('0x46')]=_0x44e8a2[_0x8a47('0x46')][_0x8a47('0x60')]?_0x44e8a2['attributes']:_0x8dbaec['model'];if(_0x7b0217[_0x8a47('0x43')][_0x8a47('0xc3')]){_0x44e8a2[_0x8a47('0xc4')]=[{'all':!![]}];}_0x44e8a2=_['merge']({},_0x44e8a2,_0x7b0217[_0x8a47('0xc5')]);return db[_0x8a47('0x36')][_0x8a47('0x6c')](_0x44e8a2)[_0x8a47('0x2b')](handleEntityNotFound(_0xfa67fc,null))[_0x8a47('0x2b')](respondWithResult(_0xfa67fc,null))[_0x8a47('0x3b')](handleError(_0xfa67fc,null));};exports[_0x8a47('0xc6')]=function(_0x26d41a,_0x5be7e6){return db['MailInteraction']['create'](_0x26d41a['body'],{})[_0x8a47('0x2b')](respondWithResult(_0x5be7e6,0xc9))['catch'](handleError(_0x5be7e6,null));};exports['update']=function(_0x35da78,_0x38a964){if(_0x35da78[_0x8a47('0xc7')]['id']){delete _0x35da78[_0x8a47('0xc7')]['id'];}return db[_0x8a47('0x36')][_0x8a47('0x6c')]({'where':{'id':_0x35da78[_0x8a47('0xc2')]['id']}})[_0x8a47('0x2b')](handleEntityNotFound(_0x38a964,null))[_0x8a47('0x2b')](saveUpdates(_0x35da78['body'],null))['then'](respondWithResult(_0x38a964,null))[_0x8a47('0x3b')](handleError(_0x38a964,null));};exports[_0x8a47('0xc8')]=function(_0x3dc6e3,_0x2d1ff7){return db[_0x8a47('0x36')][_0x8a47('0x6c')]({'where':{'id':_0x3dc6e3['params']['id']}})[_0x8a47('0x2b')](handleEntityNotFound(_0x2d1ff7,null))[_0x8a47('0x2b')](removeEntity(_0x2d1ff7,null))[_0x8a47('0x3b')](handleError(_0x2d1ff7,null));};exports[_0x8a47('0xc9')]=function(_0x25e5af,_0x32b296){return db[_0x8a47('0x36')][_0x8a47('0xc9')]()[_0x8a47('0x2b')](respondWithResult(_0x32b296,null))[_0x8a47('0x3b')](handleError(_0x32b296,null));};exports[_0x8a47('0xca')]=function(_0x4161be,_0x78eb00,_0x36b861){return db['MailMessage']['find']({'where':{'id':_0x4161be['params']['id']}})[_0x8a47('0x2b')](handleEntityNotFound(_0x78eb00,null))[_0x8a47('0x2b')](function(_0x4e070a){if(_0x4e070a){return _0x4e070a[_0x8a47('0xca')](_0x4161be[_0x8a47('0xc7')][_0x8a47('0xcb')],_[_0x8a47('0xcc')](_0x4161be['body'],['ids','id'])||{});}})[_0x8a47('0x2b')](respondWithResult(_0x78eb00,null))[_0x8a47('0x3b')](handleError(_0x78eb00,null));};exports['getMessages']=function(_0x33d218,_0x3818be,_0x2509b5){var _0x2f10c1={'raw':![],'where':{}};var _0x398a0b={};var _0x2fb919={'count':0x0,'rows':[]};return db[_0x8a47('0x36')][_0x8a47('0xbd')]({'where':{'id':_0x33d218[_0x8a47('0xc2')]['id']}})[_0x8a47('0x2b')](handleEntityNotFound(_0x3818be,null))['then'](function(_0x125299){if(_0x125299){_0x398a0b[_0x8a47('0x41')]=_[_0x8a47('0x42')](db['MailMessage'][_0x8a47('0x3d')]);_0x398a0b[_0x8a47('0x43')]=_[_0x8a47('0x42')](_0x33d218[_0x8a47('0x43')]);_0x398a0b[_0x8a47('0x44')]=_[_0x8a47('0x45')](_0x398a0b['model'],_0x398a0b[_0x8a47('0x43')]);_0x2f10c1[_0x8a47('0x46')]=_[_0x8a47('0x45')](_0x398a0b[_0x8a47('0x41')],qs['fields'](_0x33d218[_0x8a47('0x43')][_0x8a47('0x47')]));_0x2f10c1[_0x8a47('0x46')]=_0x2f10c1[_0x8a47('0x46')]['length']?_0x2f10c1[_0x8a47('0x46')]:_0x398a0b[_0x8a47('0x41')];if(!_0x33d218[_0x8a47('0x43')][_0x8a47('0x48')](_0x8a47('0xcd'))){_0x2f10c1['limit']=qs['limit'](_0x33d218[_0x8a47('0x43')][_0x8a47('0x26')]);_0x2f10c1[_0x8a47('0x25')]=qs[_0x8a47('0x25')](_0x33d218[_0x8a47('0x43')][_0x8a47('0x25')]);}_0x2f10c1[_0x8a47('0x49')]=qs[_0x8a47('0x4a')](_0x33d218[_0x8a47('0x43')][_0x8a47('0x4a')]);_0x2f10c1[_0x8a47('0x4b')]=qs[_0x8a47('0x44')](_[_0x8a47('0xce')](_0x33d218['query'],_0x398a0b[_0x8a47('0x44')]));_0x2f10c1[_0x8a47('0x4b')][_0x8a47('0xbc')]=_0x125299['id'];if(_0x33d218[_0x8a47('0x43')][_0x8a47('0x86')]){_0x2f10c1[_0x8a47('0x4b')]=_[_0x8a47('0xcf')](_0x2f10c1[_0x8a47('0x4b')],{'$or':_['map'](_0x2f10c1[_0x8a47('0x46')],function(_0x40da78){var _0x102d60={};_0x102d60[_0x40da78]={'$like':'%'+_0x33d218[_0x8a47('0x43')][_0x8a47('0x86')]+'%'};return _0x102d60;})});}if(_0x33d218[_0x8a47('0x43')][_0x8a47('0xd0')]){var _0x13270c=_0x33d218[_0x8a47('0x43')][_0x8a47('0xd0')][_0x8a47('0x34')](',');var _0x24fbd0={};_0x24fbd0[_0x13270c[0x0]]={'$gte':moment(_0x13270c[0x1])[_0x8a47('0xd1')](_0x8a47('0xd2'))};_0x2f10c1[_0x8a47('0x4b')]=_[_0x8a47('0xcf')](_0x2f10c1['where'],_0x24fbd0);}_0x2f10c1=_['merge']({},_0x2f10c1,_0x33d218[_0x8a47('0xc5')]);return db[_0x8a47('0xd3')][_0x8a47('0x24')]({'where':_0x2f10c1[_0x8a47('0x4b')]})[_0x8a47('0x2b')](function(_0x32155a){_0x2fb919['count']=_0x32155a;if(_0x33d218[_0x8a47('0x43')]['includeAll']){_0x2f10c1[_0x8a47('0xc4')]=[{'all':!![]}];}return db[_0x8a47('0xd3')]['findAll'](_0x2f10c1);})[_0x8a47('0x2b')](function(_0x167316){if(_0x33d218[_0x8a47('0x43')][_0x8a47('0xd4')]===_0x8a47('0xd5')){for(var _0x2640b6=0x0;_0x2640b6<_0x167316[_0x8a47('0x60')];_0x2640b6++){_0x167316[_0x2640b6]['body']=juice(_0x167316[_0x2640b6]['body']);}}_0x2fb919[_0x8a47('0xd6')]=_0x167316;return _0x2fb919;});}})[_0x8a47('0x2b')](respondWithFilteredResult(_0x3818be,_0x2f10c1))[_0x8a47('0x3b')](handleError(_0x3818be,null));};exports[_0x8a47('0xd7')]=function(_0x503c26,_0x2f534c,_0x2d5524){return db[_0x8a47('0x36')]['find']({'where':{'id':_0x503c26['params']['id']}})[_0x8a47('0x2b')](handleEntityNotFound(_0x2f534c,null))['then'](function(_0x20c9cf){if(_0x20c9cf){return _0x20c9cf[_0x8a47('0xd8')](_0x503c26[_0x8a47('0xc7')][_0x8a47('0xcb')],_[_0x8a47('0xcc')](_0x503c26[_0x8a47('0xc7')],[_0x8a47('0xcb'),'id'])||{})['spread'](function(){return db[_0x8a47('0x70')][_0x8a47('0xd9')]({'attributes':['id','name',_0x8a47('0xda')],'where':{'id':_0x503c26[_0x8a47('0xc7')][_0x8a47('0xcb')]}});})[_0x8a47('0x2b')](function(_0x206b98){socket[_0x8a47('0xdb')](_0x8a47('0xdc'),{'id':Number(_0x503c26[_0x8a47('0xc2')]['id']),'tags':_0x206b98||[]});return{'id':Number(_0x503c26['params']['id']),'tags':_0x206b98||[]};});}})[_0x8a47('0x2b')](respondWithResult(_0x2f534c,null))['catch'](handleError(_0x2f534c,null));};exports[_0x8a47('0xdd')]=function(_0x4d8f82,_0x34b93b,_0x440416){return db[_0x8a47('0x36')][_0x8a47('0x6c')]({'where':{'id':_0x4d8f82[_0x8a47('0xc2')]['id']}})[_0x8a47('0x2b')](handleEntityNotFound(_0x34b93b,null))[_0x8a47('0x2b')](function(_0x560c96){if(_0x560c96){return _0x560c96[_0x8a47('0xdd')](_0x4d8f82['query'][_0x8a47('0xcb')]);}})[_0x8a47('0x2b')](respondWithStatusCode(_0x34b93b,null))[_0x8a47('0x3b')](handleError(_0x34b93b,null));};exports['download']=function(_0x27eba2,_0x176394){var _0x4ede45=moment()[_0x8a47('0xde')]()[_0x8a47('0x9d')]();var _0x598901=path[_0x8a47('0xdf')](config[_0x8a47('0xe0')],_0x8a47('0xe1'),_0x8a47('0xe2'),_0x8a47('0xe3'));var _0x4e7ce8=path[_0x8a47('0xdf')](config[_0x8a47('0xe0')],_0x8a47('0xe1'),'files','attachments');var _0x5d1884=path[_0x8a47('0xdf')](_0x598901,_0x4ede45);var _0x4d44c3=util[_0x8a47('0xd1')](_0x8a47('0xe4'),_0x27eba2[_0x8a47('0xc2')]['id'],_0x4ede45);var _0x273b8f=path[_0x8a47('0xdf')](_0x598901,_0x4d44c3);var _0x5c8432=[];if(_0x27eba2['query'][_0x8a47('0xe5')]){_0x5c8432[_0x8a47('0xbf')]({'model':db[_0x8a47('0xe6')],'as':_0x8a47('0xe7'),'raw':!![]});}var _0x4e1dc0=[{'model':db[_0x8a47('0xd3')],'as':_0x8a47('0xe8'),'attributes':['id',_0x8a47('0xc7'),_0x8a47('0x50'),'to','cc',_0x8a47('0xe9'),_0x8a47('0xea'),_0x8a47('0x7c')],'where':{'secret':![]},'order':qs[_0x8a47('0x4a')]('id'),'include':_0x5c8432}];return db['MailInteraction']['find']({'where':{'id':_0x27eba2['params']['id']},'include':_0x4e1dc0})[_0x8a47('0x2b')](handleEntityNotFound(_0x176394,null))['then'](function(_0x506e42){if(_0x506e42&&_0x506e42['Messages']){var _0x25fffa=_0x506e42[_0x8a47('0xeb')]({'plain':!![]});fs[_0x8a47('0xec')](_0x5d1884);return BPromise[_0x8a47('0xed')](_0x25fffa['Messages'],function(_0x5a0f73,_0x266898){var _0x39b648={'from':_0x5a0f73[_0x8a47('0x50')],'to':_0x5a0f73['to'],'subject':_0x5a0f73[_0x8a47('0xea')],'html':_0x5a0f73[_0x8a47('0xc7')],'headers':{'Date':moment(_0x5a0f73[_0x8a47('0x7c')])['format'](_0x8a47('0xee'))},'attachments':[]};if(_0x5a0f73['cc']){_0x39b648[_0x8a47('0xef')]['Cc']=_0x5a0f73['cc'];}if(_0x5a0f73[_0x8a47('0xe9')]){_0x39b648[_0x8a47('0xef')]['Bcc']=_0x5a0f73['bcc'];}return new BPromise(function(_0x4a1993,_0x167e58){if(_0x5a0f73[_0x8a47('0xe7')]){for(var _0x228ea4=0x0;_0x228ea4<_0x5a0f73[_0x8a47('0xe7')][_0x8a47('0x60')];_0x228ea4++){var _0x29dc52=_0x5a0f73['Attachments'][_0x228ea4];var _0x932887=path[_0x8a47('0xdf')](_0x4e7ce8,_0x29dc52[_0x8a47('0xf0')]);if(fs[_0x8a47('0xf1')](_0x932887)){_0x39b648['attachments']['push']({'name':_0x29dc52[_0x8a47('0x2e')],'contentType':_0x29dc52['type'],'data':fs['readFileSync'](_0x932887)});}}}emlformat['build'](_0x39b648,function(_0x5e52d7,_0x5ccd2b){if(_0x5e52d7)return _0x167e58(_0x5e52d7);fs[_0x8a47('0xf2')](path[_0x8a47('0xdf')](_0x5d1884,util['format'](_0x8a47('0xf3'),_0x266898)),_0x5ccd2b);return _0x4a1993(_0x5ccd2b);});});})[_0x8a47('0x2b')](function(){return new BPromise(function(_0x3f3d9b,_0x2095de){zipdir(_0x5d1884,{'saveTo':_0x273b8f},function(_0x2fab05,_0xecfc5){if(_0x2fab05)return _0x2095de(_0x2fab05);return _0x3f3d9b(_0xecfc5);});})['then'](function(){return new BPromise(function(_0x218fa0,_0x34ab54){rimraf(_0x5d1884,function(_0x4f745e){if(_0x4f745e)_0x34ab54(_0x4f745e);return _0x218fa0();});});})[_0x8a47('0x2b')](function(){return _0x176394[_0x8a47('0xf4')](_0x273b8f,_0x4d44c3,function(_0x569f2b){if(_0x569f2b){console[_0x8a47('0xf5')](_0x8a47('0xf6'),_0x569f2b);}else{fs[_0x8a47('0xf7')](_0x273b8f);}});});});}else{return _0x176394[_0x8a47('0x20')](0xc8);}})[_0x8a47('0x3b')](handleError(_0x176394,null));}; \ No newline at end of file +var _0x5c3c=['o.fullname','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','all','rows','show','params','includeAll','include','merge','options','create','body','describe','MailMessage','addMessage','ids','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','sort','get','mkdirSync','each','headers','Bcc','basename','existsSync','readFileSync','message%d.eml','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','Tags','TagIds','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','fromString','catch','index','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','field','color','from','select','u.id','ui.MailInteractionId','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','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','plainBody','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.subject','i.secondDisposition','i.thirdDisposition','i.to','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax'];(function(_0x473068,_0xf0d848){var _0x47476a=function(_0x59b1f7){while(--_0x59b1f7){_0x473068['push'](_0x473068['shift']());}};_0x47476a(++_0xf0d848);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x5c3c[_0x1b828b];return _0x98da1a;};'use strict';var pdf=require(_0xc5c3('0x0'));var emlformat=require(_0xc5c3('0x1'));var rimraf=require(_0xc5c3('0x2'));var zipdir=require(_0xc5c3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5c3('0x4'));var moment=require(_0xc5c3('0x5'));var BPromise=require(_0xc5c3('0x6'));var Mustache=require(_0xc5c3('0x7'));var util=require(_0xc5c3('0x8'));var path=require(_0xc5c3('0x9'));var sox=require(_0xc5c3('0xa'));var csv=require(_0xc5c3('0xb'));var ejs=require(_0xc5c3('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var htmlToText=require('html-to-text');var juice=require(_0xc5c3('0x11'));var Redis=require(_0xc5c3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc5c3('0x13'));var as=require(_0xc5c3('0x14'));var hardwareService=require(_0xc5c3('0x15'));var logger=require('../../config/logger')(_0xc5c3('0x16'));var utils=require(_0xc5c3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc5c3('0x18'));var db=require(_0xc5c3('0x19'))['db'];config[_0xc5c3('0x1a')]=_['defaults'](config[_0xc5c3('0x1a')],{'host':_0xc5c3('0x1b'),'port':0x18eb});var socket=require(_0xc5c3('0x1c'))(new Redis(config[_0xc5c3('0x1a')]));require(_0xc5c3('0x1d'))['register'](socket);function respondWithStatusCode(_0x5c0341,_0x4445ea){_0x4445ea=_0x4445ea||0xcc;return function(_0x577e1a){if(_0x577e1a){return _0x5c0341[_0xc5c3('0x1e')](_0x4445ea);}return _0x5c0341[_0xc5c3('0x1f')](_0x4445ea)['end']();};}function respondWithResult(_0x4ff2de,_0x467ba9){_0x467ba9=_0x467ba9||0xc8;return function(_0x52cd2e){if(_0x52cd2e){return _0x4ff2de[_0xc5c3('0x1f')](_0x467ba9)[_0xc5c3('0x20')](_0x52cd2e);}};}function respondWithFilteredResult(_0x2ff158,_0x13c867){return function(_0x28bae6){if(_0x28bae6){var _0x5e11d5=_0x28bae6[_0xc5c3('0x21')],_0x364f42=_0x13c867['offset'],_0x41af00=_0x13c867[_0xc5c3('0x22')]+_0x13c867[_0xc5c3('0x23')],_0x123dba;if(_0x41af00>=_0x5e11d5){_0x41af00=_0x5e11d5;_0x123dba=0xc8;}else{_0x123dba=0xce;}_0x2ff158[_0xc5c3('0x1f')](_0x123dba);return _0x2ff158[_0xc5c3('0x24')](_0xc5c3('0x25'),_0x364f42+'-'+_0x41af00+'/'+_0x5e11d5)['json'](_0x28bae6);}return null;};}function patchUpdates(_0xb07420){return function(_0x159bec){try{jsonpatch[_0xc5c3('0x26')](_0x159bec,_0xb07420,!![]);}catch(_0x2de266){return BPromise[_0xc5c3('0x27')](_0x2de266);}return _0x159bec[_0xc5c3('0x28')]();};}function saveUpdates(_0x40ebcc,_0x5996a0){return function(_0x52d638){if(_0x52d638){return _0x52d638[_0xc5c3('0x29')](_0x40ebcc)[_0xc5c3('0x2a')](function(_0x53ab72){return _0x53ab72;});}return null;};}function removeEntity(_0x5c7329,_0x23e2fb){return function(_0x1591e3){if(_0x1591e3){return _0x1591e3[_0xc5c3('0x2b')]()['then'](function(){_0x5c7329['status'](0xcc)[_0xc5c3('0x2c')]();});}};}function handleEntityNotFound(_0x22f607,_0x20c506){return function(_0x29791c){if(!_0x29791c){_0x22f607['sendStatus'](0x194);}return _0x29791c;};}function handleError(_0x21efd6,_0x5176c4){_0x5176c4=_0x5176c4||0x1f4;return function(_0x2eacec){logger['error'](_0x2eacec[_0xc5c3('0x2d')]);if(_0x2eacec[_0xc5c3('0x2e')]){delete _0x2eacec[_0xc5c3('0x2e')];}_0x21efd6[_0xc5c3('0x1f')](_0x5176c4)[_0xc5c3('0x2f')](_0x2eacec);};}function getInteractionUsers(_0x2d07e1,_0x35a397){return new BPromise(function(_0x4b5a0c,_0xbcafd6){try{if(_0x35a397[_0x2d07e1['id']]){_0x2d07e1['Users']=_[_0xc5c3('0x30')](_0x35a397[_0x2d07e1['id']],function(_0x43ebfc){return{'id':_0x43ebfc['id'],'fullname':_0x43ebfc['fullname']};});}}catch(_0x4daa8b){_0xbcafd6(_0x4daa8b);}_0x4b5a0c(_0x2d07e1);});}function getInteractionTags(_0x2e648f,_0x46f149){return new BPromise(function(_0x66e83c,_0x19e482){try{if(_0x2e648f['TagIds']){_0x2e648f[_0xc5c3('0x31')]=[];_0x2e648f[_0xc5c3('0x32')][_0xc5c3('0x33')](',')[_0xc5c3('0x34')](function(_0x1b4538){_0x2e648f[_0xc5c3('0x31')][_0xc5c3('0x35')](_0x46f149[_0x1b4538]);});}delete _0x2e648f[_0xc5c3('0x32')];}catch(_0x1d1e6d){_0x19e482(_0x1d1e6d);}_0x66e83c(_0x2e648f);});}function getLastMessageText(_0x4b8be9){return new BPromise(function(_0x340439,_0x7fd66e){return db[_0xc5c3('0x36')][_0xc5c3('0x37')]({'where':{'id':_0x4b8be9['id']},'attributes':[_0xc5c3('0x38'),_0xc5c3('0x39')],'raw':!![]})[_0xc5c3('0x2a')](function(_0x4c1ab4){if(!_0x4c1ab4['lastMsgText']){_0x4b8be9[_0xc5c3('0x39')]=_['trimStart'](htmlToText[_0xc5c3('0x3a')](_0x4c1ab4[_0xc5c3('0x38')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x4b8be9[_0xc5c3('0x39')]=_0x4c1ab4[_0xc5c3('0x39')];}_0x340439(_0x4b8be9);})[_0xc5c3('0x3b')](function(_0x498677){_0x7fd66e(_0x498677);});});}function updateMailInteraction(_0x21b243,_0xdaecce,_0x547e20,_0x29f57d){return new BPromise(function(_0x17d93c,_0x321917){return getInteractionUsers(_0x21b243,_0x547e20)[_0xc5c3('0x2a')](function(_0x7347d){return getInteractionTags(_0x7347d,_0xdaecce);})[_0xc5c3('0x2a')](function(_0x168056){if(_0x29f57d){_0x17d93c(getLastMessageText(_0x168056));}else{_0x17d93c(_0x168056);}})[_0xc5c3('0x3b')](function(_0x1fb127){_0x321917(_0x1fb127);});});}exports[_0xc5c3('0x3c')]=function(_0x49523a,_0x361b04){var _0x541bbd={},_0x4fdbe6={},_0x11c029={'count':0x0,'rows':[]};var _0x10e27d=_[_0xc5c3('0x30')](db[_0xc5c3('0x36')][_0xc5c3('0x3d')],function(_0x499791){return{'name':_0x499791['fieldName'],'type':_0x499791[_0xc5c3('0x3e')][_0xc5c3('0x3f')]};});_0x4fdbe6['model']=_[_0xc5c3('0x30')](_0x10e27d,'name');_0x4fdbe6[_0xc5c3('0x40')]=_[_0xc5c3('0x41')](_0x49523a[_0xc5c3('0x40')]);_0x4fdbe6['filters']=_[_0xc5c3('0x42')](_0x4fdbe6[_0xc5c3('0x43')],_0x4fdbe6['query']);_0x541bbd[_0xc5c3('0x44')]=_['intersection'](_0x4fdbe6[_0xc5c3('0x43')],qs[_0xc5c3('0x45')](_0x49523a['query']['fields']));_0x541bbd['attributes']=_0x541bbd[_0xc5c3('0x44')][_0xc5c3('0x46')]?_0x541bbd['attributes']:_0x4fdbe6[_0xc5c3('0x43')];if(!_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x47')](_0xc5c3('0x48'))){_0x541bbd['limit']=qs[_0xc5c3('0x23')](_0x49523a['query']['limit']);_0x541bbd[_0xc5c3('0x22')]=qs[_0xc5c3('0x22')](_0x49523a['query'][_0xc5c3('0x22')]);}_0x541bbd[_0xc5c3('0x49')]=qs['sort'](_0x49523a[_0xc5c3('0x40')]['sort']);_0x541bbd[_0xc5c3('0x4a')]=qs[_0xc5c3('0x4b')](_['pick'](_0x49523a[_0xc5c3('0x40')],_0x4fdbe6['filters']),_0x10e27d);var _0x11b997=[];var _0x30179f=squel['select']()[_0xc5c3('0x4c')]('id')[_0xc5c3('0x4c')](_0xc5c3('0x2e'))[_0xc5c3('0x4c')](_0xc5c3('0x4d'))[_0xc5c3('0x4e')]('tools_tags');var _0x3e658b=squel[_0xc5c3('0x4f')]()[_0xc5c3('0x4c')](_0xc5c3('0x50'))[_0xc5c3('0x4c')]('u.fullname')['field'](_0xc5c3('0x51'))[_0xc5c3('0x4e')](_0xc5c3('0x52'),'ui')['left_join'](_0xc5c3('0x53'),'u',_0xc5c3('0x54'));var _0x3a901f=squel[_0xc5c3('0x4f')]()[_0xc5c3('0x4e')](_0xc5c3('0x55'),'i')[_0xc5c3('0x56')]('cm_contacts','c',_0xc5c3('0x57'))[_0xc5c3('0x56')](_0xc5c3('0x53'),'o','o.id\x20=\x20i.UserId')[_0xc5c3('0x56')](_0xc5c3('0x58'),'a',_0xc5c3('0x59'))[_0xc5c3('0x56')](_0xc5c3('0x5a'),'me','me.MailInteractionId\x20=\x20i.id')[_0xc5c3('0x56')]('mail_interaction_has_tags','it',_0xc5c3('0x5b'))['left_join'](_0xc5c3('0x5c'),'t',_0xc5c3('0x5d'));var _0x4add6b=squel[_0xc5c3('0x5e')]();var _0x1311de=[];var _0x4be969=squel[_0xc5c3('0x5e')]();var _0x1b906;if(_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x5f')]){_0x1b906=as[_0xc5c3('0x60')](_0x49523a['query'][_0xc5c3('0x5f')]);var _0x34bf9c=_0x1b906[_0xc5c3('0x61')];for(var _0x4d1ff8=0x0;_0x4d1ff8<_0x1b906[_0xc5c3('0x62')]['length'];_0x4d1ff8++){var _0x5a6480=_0x1b906[_0xc5c3('0x62')][_0x4d1ff8];var _0x11a6c4='i';var _0x110105=_[_0xc5c3('0x63')](_0x10e27d,[_0xc5c3('0x2e'),_0x5a6480[_0xc5c3('0x4c')]]);if(!_0x110105){switch(_0x5a6480['field']){case _0xc5c3('0x64'):if(_0x5a6480[_0xc5c3('0x65')]==0x1){_0x3a901f[_0xc5c3('0x66')]('`'+_0x5a6480[_0xc5c3('0x4c')]+_0xc5c3('0x67'));}else{_0x3a901f[_0xc5c3('0x66')]('`'+_0x5a6480[_0xc5c3('0x4c')]+'`\x20>\x200');}break;case'Contact':if(_0x5a6480[_0xc5c3('0x68')]===_0xc5c3('0x69')){if(_0x5a6480['value'][_0xc5c3('0x33')]('\x20')[_0xc5c3('0x46')]>0x1){_0x4add6b[_0x34bf9c](_0xc5c3('0x6a'),qs[_0xc5c3('0x6b')](_0x5a6480['value']),null);}else{var _0x41fc40='%'+_0x5a6480[_0xc5c3('0x65')]+'%';_0x4add6b[_0x34bf9c](_0xc5c3('0x6c'),_0x41fc40,_0x41fc40,_0x41fc40);}}else{_0x110105=_[_0xc5c3('0x63')](_0x10e27d,[_0xc5c3('0x2e'),_0xc5c3('0x6d')]);_0x5a6480[_0xc5c3('0x4c')]=_0xc5c3('0x6d');_0x578843=as[_0xc5c3('0x6e')](_0x11a6c4,_0x110105['type'],_0x5a6480);_0x4add6b[_0x34bf9c](_0x578843[_0xc5c3('0x6f')],_0x578843[_0xc5c3('0x65')][_0xc5c3('0x70')],_0x578843['value'][_0xc5c3('0x2c')]);}break;case _0xc5c3('0x71'):var _0x18adc4=_0x5a6480[_0xc5c3('0x65')][_0xc5c3('0x33')](',')['map'](function(_0xf54924){return Number(_0xf54924);});_0x18adc4[_0xc5c3('0x34')](function(_0xf40f27){_0x4be969['or'](_0xc5c3('0x72'),'%,'+_0xf40f27+',%');});_0x1311de=_[_0xc5c3('0x73')](_0x1311de,_0x18adc4);break;case _0xc5c3('0x74'):if(_0x5a6480[_0xc5c3('0x68')]==='$substring'){_0x4add6b[_0x34bf9c](_0xc5c3('0x75'),'%'+_0x5a6480[_0xc5c3('0x65')]+'%',null);}else{_0x110105=_[_0xc5c3('0x63')](_0x10e27d,[_0xc5c3('0x2e'),_0xc5c3('0x76')]);_0x5a6480[_0xc5c3('0x4c')]=_0xc5c3('0x76');_0x578843=as['buildExpression'](_0x11a6c4,_0x110105['type'],_0x5a6480);_0x4add6b[_0x34bf9c](_0x578843[_0xc5c3('0x6f')],_0x578843[_0xc5c3('0x65')][_0xc5c3('0x70')],_0x578843[_0xc5c3('0x65')][_0xc5c3('0x2c')]);}break;case _0xc5c3('0x77'):_0x578843=as[_0xc5c3('0x6e')]('me',null,_0x5a6480);_0x4add6b[_0x34bf9c](_0x578843[_0xc5c3('0x6f')],_0x578843[_0xc5c3('0x65')]['start'],_0x578843[_0xc5c3('0x65')][_0xc5c3('0x2c')]);break;}}else{var _0x578843=as['buildExpression'](_0x11a6c4,_0x110105[_0xc5c3('0x3e')],_0x5a6480);_0x4add6b[_0x34bf9c](_0x578843[_0xc5c3('0x6f')],_0x578843[_0xc5c3('0x65')][_0xc5c3('0x70')],_0x578843[_0xc5c3('0x65')][_0xc5c3('0x2c')]);}}}else{var _0x34f284=_(_0x49523a[_0xc5c3('0x40')])[_0xc5c3('0x41')]()['map'](function(_0x429fcb){return _[_0xc5c3('0x78')](_0x10e27d,[_0xc5c3('0x2e'),_0x429fcb])?_0x429fcb:undefined;})[_0xc5c3('0x79')]()[_0xc5c3('0x65')]();if(!_[_0xc5c3('0x7a')](_0x34f284)){_0x34f284[_0xc5c3('0x34')](function(_0x114c90){if(_0x114c90===_0xc5c3('0x7b')){_0x3a901f[_0xc5c3('0x4a')](_0xc5c3('0x7c'),[]['concat'](_0x49523a['query'][_0x114c90]));}else if(_0x114c90===_0xc5c3('0x7d')){var _0xcf6fc0=JSON[_0xc5c3('0x7e')](_0x49523a[_0xc5c3('0x40')][_0x114c90])[_0xc5c3('0x7f')];var _0x2da018=JSON[_0xc5c3('0x7e')](_0x49523a[_0xc5c3('0x40')][_0x114c90])[_0xc5c3('0x80')];_0x3a901f[_0xc5c3('0x4a')](_0xc5c3('0x81'),_0xcf6fc0,_0x2da018);}else{if(_0x49523a[_0xc5c3('0x40')][_0x114c90]==='null'){_0x3a901f[_0xc5c3('0x4a')]('i.'+_0x114c90+'\x20IS\x20NULL');}else{_0x3a901f[_0xc5c3('0x4a')]('i.'+_0x114c90+_0xc5c3('0x82'),_0x49523a[_0xc5c3('0x40')][_0x114c90]);}}});}if(_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x83')]){if(_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x83')]==0x1){_0x3a901f[_0xc5c3('0x66')]('`unreadMessages`\x20=\x200');}else{_0x3a901f[_0xc5c3('0x66')](_0xc5c3('0x84'));}}if(_0x49523a[_0xc5c3('0x40')]['tag']){_0x1311de=_['isArray'](_0x49523a[_0xc5c3('0x40')]['tag'])?_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x85')]:new Array(_0x49523a[_0xc5c3('0x40')]['tag']);_0x1311de[_0xc5c3('0x34')](function(_0x5bc049){_0x4be969['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5bc049+',%');});}if(_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x86')]){var _0x5c9862=_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x86')]['replace']('\x5c','\x5c\x5c')[_0xc5c3('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5c9862)){_0x4add6b['or'](_0xc5c3('0x88'),_0x5c9862+'%');}else if(qs[_0xc5c3('0x89')](_0x5c9862)){_0x4add6b['or'](_0xc5c3('0x8a'),_0x5c9862+'%');}else{_0x4add6b['or'](_0xc5c3('0x8b'),qs[_0xc5c3('0x6b')](_0x5c9862))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5c9862));}}}_0x3a901f['where'](_0x4add6b);_0x3a901f[_0xc5c3('0x8c')](_0xc5c3('0x8d'));var _0xa78c7e={'type':db['Sequelize'][_0xc5c3('0x8e')][_0xc5c3('0x8f')],'raw':!![]};var _0x5dcd4d=_0x3a901f[_0xc5c3('0x90')]();_0x5dcd4d['field'](_0xc5c3('0x8d'));_0x5dcd4d[_0xc5c3('0x4c')](_0xc5c3('0x91'),_0xc5c3('0x64'));if(_0x541bbd['order']){_0x541bbd[_0xc5c3('0x49')][_0xc5c3('0x34')](function(_0x370a03){var _0x2bd0ac=_0x370a03[0x0]===_0xc5c3('0x92')?_0x370a03[0x0]:'i.'+_0x370a03[0x0];_0x3a901f[_0xc5c3('0x49')](_0x2bd0ac,_0x370a03[0x1]===_0xc5c3('0x93')?![]:!![]);});}if(!_[_0xc5c3('0x7a')](_0x1311de)){_0x3a901f['having'](_0x4be969);_0x5dcd4d['where']('t.id\x20IN\x20?',_0x1311de);}BPromise['resolve']()[_0xc5c3('0x2a')](function(){if(!_0x1b906){if(_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x7b')])return;_0x5dcd4d[_0xc5c3('0x4a')](_0xc5c3('0x94'));_0x3a901f[_0xc5c3('0x4a')](_0xc5c3('0x94'));return;}if(_0x49523a[_0xc5c3('0x95')][_0xc5c3('0x96')]!=='agent')return;return _0x49523a[_0xc5c3('0x95')][_0xc5c3('0x97')]({'attributes':['id'],'raw':!![]})[_0xc5c3('0x2a')](function(_0x1efa1d){if(_[_0xc5c3('0x7a')](_0x1efa1d)){_0x5dcd4d[_0xc5c3('0x4a')](_0xc5c3('0x98'));_0x3a901f['where']('i.MailAccountId\x20IS\x20NULL');}else{_0x5dcd4d[_0xc5c3('0x4a')](_0xc5c3('0x7c'),_[_0xc5c3('0x30')](_0x1efa1d,'id'));_0x3a901f[_0xc5c3('0x4a')](_0xc5c3('0x7c'),_[_0xc5c3('0x30')](_0x1efa1d,'id'));}});})[_0xc5c3('0x2a')](function(){if(_0x49523a[_0xc5c3('0x95')][_0xc5c3('0x96')]===_0xc5c3('0x99')&&!_0x1b906&&!_0x49523a[_0xc5c3('0x40')]['MailAccountId'])return[];return db[_0xc5c3('0x9a')][_0xc5c3('0x40')](_0x5dcd4d[_0xc5c3('0x9b')](),_0xa78c7e);})[_0xc5c3('0x2a')](function(_0x12df92){_0x11c029['count']=_0x12df92[_0xc5c3('0x46')];if(_0x11c029[_0xc5c3('0x21')]===0x0)return[];return db[_0xc5c3('0x9a')][_0xc5c3('0x40')](_0x30179f['toString'](),_0xa78c7e)[_0xc5c3('0x2a')](function(_0x2a59eb){_0x11b997=_[_0xc5c3('0x9c')](_0x2a59eb,'id');_0xa78c7e=_['merge'](_0xa78c7e,{'model':db[_0xc5c3('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x45')]){_0x541bbd[_0xc5c3('0x44')][_0xc5c3('0x34')](function(_0x2eb475){_0x3a901f[_0xc5c3('0x4c')]('i.'+_0x2eb475);});}else{_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0x91'),_0xc5c3('0x64'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0x9d'),_0xc5c3('0x9e'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0x9f'),_0xc5c3('0xa0'));_0x3a901f['field'](_0xc5c3('0xa1'),_0xc5c3('0x92'));_0x3a901f['field'](_0xc5c3('0x8d'));_0x3a901f['field'](_0xc5c3('0xa2'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xa3'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xa4'));_0x3a901f['field'](_0xc5c3('0xa5'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xa6'));_0x3a901f['field']('i.lastMsgAt');_0x3a901f[_0xc5c3('0x4c')]('i.lastMsgDirection');_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xa7'));_0x3a901f[_0xc5c3('0x4c')]('i.disposition');_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xa8'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xa9'));_0x3a901f[_0xc5c3('0x4c')]('i.substatus');_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xaa'));_0x3a901f[_0xc5c3('0x4c')]('i.ContactId');_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xab'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xac'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xad'),_0xc5c3('0xae'));_0x3a901f[_0xc5c3('0x4c')]('c.lastName',_0xc5c3('0xaf'));_0x3a901f['field'](_0xc5c3('0xb0'),_0xc5c3('0xb1'));_0x3a901f['field'](_0xc5c3('0xb2'),_0xc5c3('0xb3'));_0x3a901f['field'](_0xc5c3('0xb4'),_0xc5c3('0xb5'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xb6'),_0xc5c3('0xb7'));_0x3a901f['field'](_0xc5c3('0xb8'),_0xc5c3('0xb9'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xba'),_0xc5c3('0xbb'));_0x3a901f[_0xc5c3('0x4c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc5c3('0x32'));}if(_0x541bbd[_0xc5c3('0x23')])_0x3a901f['limit'](_0x541bbd['limit']);if(_0x541bbd[_0xc5c3('0x22')])_0x3a901f[_0xc5c3('0x22')](_0x541bbd['offset']);return db[_0xc5c3('0x9a')][_0xc5c3('0x40')](_0x3a901f[_0xc5c3('0x9b')](),_0xa78c7e);})['then'](function(_0xe29de8){_0x3e658b[_0xc5c3('0x4a')](_0xc5c3('0xbc'),_[_0xc5c3('0x30')](_0xe29de8,'id'));return db[_0xc5c3('0x9a')][_0xc5c3('0x40')](_0x3e658b[_0xc5c3('0x9b')](),_0xa78c7e)[_0xc5c3('0x2a')](function(_0x413e50){var _0x13798=_[_0xc5c3('0xbd')](_0x413e50,_0xc5c3('0xbe'));var _0x4d1f82=[];return db['Setting'][_0xc5c3('0x37')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x433f74){var _0x527db5=_0x433f74[_0xc5c3('0xbf')];_0xe29de8[_0xc5c3('0x34')](function(_0x589064){_0x4d1f82['push'](updateMailInteraction(_0x589064,_0x11b997,_0x13798,_0x527db5));});return BPromise[_0xc5c3('0xc0')](_0x4d1f82);});});});})['then'](function(_0x50409f){_0x11c029[_0xc5c3('0xc1')]=_0x50409f;return _0x11c029;})[_0xc5c3('0x2a')](respondWithFilteredResult(_0x361b04,_0x541bbd))[_0xc5c3('0x3b')](handleError(_0x361b04,null));};exports[_0xc5c3('0xc2')]=function(_0x1fa1fb,_0x111551){var _0x116965={'raw':![],'where':{'id':_0x1fa1fb[_0xc5c3('0xc3')]['id']}},_0xa4672a={};_0xa4672a['model']=_['keys'](db[_0xc5c3('0x36')][_0xc5c3('0x3d')]);_0xa4672a[_0xc5c3('0x40')]=_[_0xc5c3('0x41')](_0x1fa1fb[_0xc5c3('0x40')]);_0xa4672a['filters']=_[_0xc5c3('0x42')](_0xa4672a['model'],_0xa4672a[_0xc5c3('0x40')]);_0x116965[_0xc5c3('0x44')]=_[_0xc5c3('0x42')](_0xa4672a[_0xc5c3('0x43')],qs[_0xc5c3('0x45')](_0x1fa1fb[_0xc5c3('0x40')][_0xc5c3('0x45')]));_0x116965[_0xc5c3('0x44')]=_0x116965['attributes']['length']?_0x116965['attributes']:_0xa4672a[_0xc5c3('0x43')];if(_0x1fa1fb[_0xc5c3('0x40')][_0xc5c3('0xc4')]){_0x116965[_0xc5c3('0xc5')]=[{'all':!![]}];}_0x116965=_[_0xc5c3('0xc6')]({},_0x116965,_0x1fa1fb[_0xc5c3('0xc7')]);return db[_0xc5c3('0x36')][_0xc5c3('0x63')](_0x116965)[_0xc5c3('0x2a')](handleEntityNotFound(_0x111551,null))[_0xc5c3('0x2a')](respondWithResult(_0x111551,null))['catch'](handleError(_0x111551,null));};exports[_0xc5c3('0xc8')]=function(_0x463900,_0x1db1c4){return db[_0xc5c3('0x36')][_0xc5c3('0xc8')](_0x463900['body'],{})[_0xc5c3('0x2a')](respondWithResult(_0x1db1c4,0xc9))[_0xc5c3('0x3b')](handleError(_0x1db1c4,null));};exports[_0xc5c3('0x29')]=function(_0x4ee116,_0x263c51){if(_0x4ee116[_0xc5c3('0xc9')]['id']){delete _0x4ee116[_0xc5c3('0xc9')]['id'];}return db[_0xc5c3('0x36')][_0xc5c3('0x63')]({'where':{'id':_0x4ee116[_0xc5c3('0xc3')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x263c51,null))['then'](saveUpdates(_0x4ee116[_0xc5c3('0xc9')],null))[_0xc5c3('0x2a')](respondWithResult(_0x263c51,null))['catch'](handleError(_0x263c51,null));};exports[_0xc5c3('0x2b')]=function(_0x2dc6ca,_0x96f5db){return db[_0xc5c3('0x36')]['find']({'where':{'id':_0x2dc6ca[_0xc5c3('0xc3')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x96f5db,null))[_0xc5c3('0x2a')](removeEntity(_0x96f5db,null))[_0xc5c3('0x3b')](handleError(_0x96f5db,null));};exports[_0xc5c3('0xca')]=function(_0x2b49da,_0x47bd08){return db[_0xc5c3('0x36')][_0xc5c3('0xca')]()['then'](respondWithResult(_0x47bd08,null))[_0xc5c3('0x3b')](handleError(_0x47bd08,null));};exports['addMessage']=function(_0xde9430,_0x40399c,_0x43d0a4){return db[_0xc5c3('0xcb')]['find']({'where':{'id':_0xde9430['params']['id']}})['then'](handleEntityNotFound(_0x40399c,null))[_0xc5c3('0x2a')](function(_0x2d6dd0){if(_0x2d6dd0){return _0x2d6dd0[_0xc5c3('0xcc')](_0xde9430['body'][_0xc5c3('0xcd')],_['omit'](_0xde9430[_0xc5c3('0xc9')],[_0xc5c3('0xcd'),'id'])||{});}})[_0xc5c3('0x2a')](respondWithResult(_0x40399c,null))[_0xc5c3('0x3b')](handleError(_0x40399c,null));};exports[_0xc5c3('0xce')]=function(_0x247496,_0x4bdb59,_0x3f468e){var _0x423d82={'raw':![],'where':{}};var _0x27d2df={};var _0x5db455={'count':0x0,'rows':[]};return db[_0xc5c3('0x36')]['findOne']({'where':{'id':_0x247496[_0xc5c3('0xc3')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x4bdb59,null))[_0xc5c3('0x2a')](function(_0x21941a){if(_0x21941a){_0x27d2df['model']=_[_0xc5c3('0x41')](db[_0xc5c3('0xcb')][_0xc5c3('0x3d')]);_0x27d2df['query']=_['keys'](_0x247496[_0xc5c3('0x40')]);_0x27d2df['filters']=_[_0xc5c3('0x42')](_0x27d2df[_0xc5c3('0x43')],_0x27d2df['query']);_0x423d82[_0xc5c3('0x44')]=_[_0xc5c3('0x42')](_0x27d2df['model'],qs['fields'](_0x247496[_0xc5c3('0x40')][_0xc5c3('0x45')]));_0x423d82[_0xc5c3('0x44')]=_0x423d82[_0xc5c3('0x44')]['length']?_0x423d82[_0xc5c3('0x44')]:_0x27d2df[_0xc5c3('0x43')];if(!_0x247496[_0xc5c3('0x40')]['hasOwnProperty'](_0xc5c3('0x48'))){_0x423d82[_0xc5c3('0x23')]=qs['limit'](_0x247496[_0xc5c3('0x40')][_0xc5c3('0x23')]);_0x423d82[_0xc5c3('0x22')]=qs[_0xc5c3('0x22')](_0x247496[_0xc5c3('0x40')]['offset']);}_0x423d82[_0xc5c3('0x49')]=qs['sort'](_0x247496['query']['sort']);_0x423d82[_0xc5c3('0x4a')]=qs['filters'](_[_0xc5c3('0xcf')](_0x247496['query'],_0x27d2df[_0xc5c3('0x4b')]));_0x423d82['where'][_0xc5c3('0xbe')]=_0x21941a['id'];if(_0x247496[_0xc5c3('0x40')][_0xc5c3('0x86')]){_0x423d82[_0xc5c3('0x4a')]=_[_0xc5c3('0xc6')](_0x423d82['where'],{'$or':_[_0xc5c3('0x30')](_0x423d82['attributes'],function(_0x4d626c){var _0x5f1e2a={};_0x5f1e2a[_0x4d626c]={'$like':'%'+_0x247496[_0xc5c3('0x40')][_0xc5c3('0x86')]+'%'};return _0x5f1e2a;})});}if(_0x247496[_0xc5c3('0x40')][_0xc5c3('0x7f')]){var _0x4106d2=_0x247496[_0xc5c3('0x40')][_0xc5c3('0x7f')][_0xc5c3('0x33')](',');var _0x17561f={};_0x17561f[_0x4106d2[0x0]]={'$gte':moment(_0x4106d2[0x1])[_0xc5c3('0xd0')](_0xc5c3('0xd1'))};_0x423d82['where']=_[_0xc5c3('0xc6')](_0x423d82[_0xc5c3('0x4a')],_0x17561f);}_0x423d82=_[_0xc5c3('0xc6')]({},_0x423d82,_0x247496[_0xc5c3('0xc7')]);return db[_0xc5c3('0xcb')][_0xc5c3('0x21')]({'where':_0x423d82[_0xc5c3('0x4a')]})['then'](function(_0x1a5285){_0x5db455[_0xc5c3('0x21')]=_0x1a5285;if(_0x247496['query']['includeAll']){_0x423d82[_0xc5c3('0xc5')]=[{'all':!![]}];}return db[_0xc5c3('0xcb')][_0xc5c3('0xd2')](_0x423d82);})['then'](function(_0x2cefe2){if(_0x247496[_0xc5c3('0x40')][_0xc5c3('0xd3')]===_0xc5c3('0xd4')){for(var _0x370c8c=0x0;_0x370c8c<_0x2cefe2[_0xc5c3('0x46')];_0x370c8c++){_0x2cefe2[_0x370c8c][_0xc5c3('0xc9')]=juice(_0x2cefe2[_0x370c8c][_0xc5c3('0xc9')]);}}_0x5db455[_0xc5c3('0xc1')]=_0x2cefe2;return _0x5db455;});}})[_0xc5c3('0x2a')](respondWithFilteredResult(_0x4bdb59,_0x423d82))[_0xc5c3('0x3b')](handleError(_0x4bdb59,null));};exports['addTags']=function(_0x457169,_0x1daaeb,_0x90b891){return db[_0xc5c3('0x36')][_0xc5c3('0x63')]({'where':{'id':_0x457169[_0xc5c3('0xc3')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x1daaeb,null))[_0xc5c3('0x2a')](function(_0x3091bf){if(_0x3091bf){return _0x3091bf[_0xc5c3('0xd5')](_0x457169['body']['ids'],_[_0xc5c3('0xd6')](_0x457169[_0xc5c3('0xc9')],[_0xc5c3('0xcd'),'id'])||{})[_0xc5c3('0xd7')](function(){return db[_0xc5c3('0x71')][_0xc5c3('0xd2')]({'attributes':['id',_0xc5c3('0x2e'),_0xc5c3('0x4d')],'where':{'id':_0x457169['body']['ids']}});})['then'](function(_0x1d2d28){socket[_0xc5c3('0xd8')](_0xc5c3('0xd9'),{'id':Number(_0x457169[_0xc5c3('0xc3')]['id']),'tags':_0x1d2d28||[]});return{'id':Number(_0x457169['params']['id']),'tags':_0x1d2d28||[]};});}})[_0xc5c3('0x2a')](respondWithResult(_0x1daaeb,null))[_0xc5c3('0x3b')](handleError(_0x1daaeb,null));};exports[_0xc5c3('0xda')]=function(_0x4c019e,_0x1cf503,_0x464c69){return db[_0xc5c3('0x36')]['find']({'where':{'id':_0x4c019e[_0xc5c3('0xc3')]['id']}})['then'](handleEntityNotFound(_0x1cf503,null))[_0xc5c3('0x2a')](function(_0x47e898){if(_0x47e898){return _0x47e898[_0xc5c3('0xda')](_0x4c019e[_0xc5c3('0x40')][_0xc5c3('0xcd')]);}})[_0xc5c3('0x2a')](respondWithStatusCode(_0x1cf503,null))[_0xc5c3('0x3b')](handleError(_0x1cf503,null));};exports[_0xc5c3('0xdb')]=function(_0x5e15d8,_0x429d7d){var _0x19bce4=moment()[_0xc5c3('0xdc')]()[_0xc5c3('0x9b')]();var _0x5672fc=path[_0xc5c3('0xdd')](config[_0xc5c3('0xde')],_0xc5c3('0xdf'),_0xc5c3('0xe0'),_0xc5c3('0xe1'));var _0x5b737b=path[_0xc5c3('0xdd')](config[_0xc5c3('0xde')],_0xc5c3('0xdf'),_0xc5c3('0xe0'),'attachments');var _0xbd0a3=path[_0xc5c3('0xdd')](_0x5672fc,_0x19bce4);var _0x514e7f=util['format'](_0xc5c3('0xe2'),_0x5e15d8[_0xc5c3('0xc3')]['id'],_0x19bce4);var _0x2ca239=path[_0xc5c3('0xdd')](_0x5672fc,_0x514e7f);var _0x21d793=[];if(_0x5e15d8[_0xc5c3('0x40')]['attachments']){_0x21d793['push']({'model':db[_0xc5c3('0xe3')],'as':_0xc5c3('0xe4'),'raw':!![]});}var _0x2cc211=[{'model':db[_0xc5c3('0xcb')],'as':_0xc5c3('0xe5'),'attributes':['id','body',_0xc5c3('0x4e'),'to','cc',_0xc5c3('0xe6'),_0xc5c3('0xe7'),_0xc5c3('0x7d')],'where':{'secret':![]},'order':qs[_0xc5c3('0xe8')]('id'),'include':_0x21d793}];return db[_0xc5c3('0x36')]['find']({'where':{'id':_0x5e15d8[_0xc5c3('0xc3')]['id']},'include':_0x2cc211})['then'](handleEntityNotFound(_0x429d7d,null))['then'](function(_0x3e0c0f){if(_0x3e0c0f&&_0x3e0c0f['Messages']){var _0xe7c279=_0x3e0c0f[_0xc5c3('0xe9')]({'plain':!![]});fs[_0xc5c3('0xea')](_0xbd0a3);return BPromise[_0xc5c3('0xeb')](_0xe7c279[_0xc5c3('0xe5')],function(_0x571069,_0x1debce){var _0x2bad2b={'from':_0x571069[_0xc5c3('0x4e')],'to':_0x571069['to'],'subject':_0x571069['subject'],'html':_0x571069[_0xc5c3('0xc9')],'headers':{'Date':moment(_0x571069[_0xc5c3('0x7d')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x571069['cc']){_0x2bad2b[_0xc5c3('0xec')]['Cc']=_0x571069['cc'];}if(_0x571069[_0xc5c3('0xe6')]){_0x2bad2b[_0xc5c3('0xec')][_0xc5c3('0xed')]=_0x571069[_0xc5c3('0xe6')];}return new BPromise(function(_0x242d2c,_0x4e7f36){if(_0x571069[_0xc5c3('0xe4')]){for(var _0x1b9194=0x0;_0x1b9194<_0x571069['Attachments'][_0xc5c3('0x46')];_0x1b9194++){var _0x291bcd=_0x571069['Attachments'][_0x1b9194];var _0x3403bd=path[_0xc5c3('0xdd')](_0x5b737b,_0x291bcd[_0xc5c3('0xee')]);if(fs[_0xc5c3('0xef')](_0x3403bd)){_0x2bad2b['attachments'][_0xc5c3('0x35')]({'name':_0x291bcd[_0xc5c3('0x2e')],'contentType':_0x291bcd[_0xc5c3('0x3e')],'data':fs[_0xc5c3('0xf0')](_0x3403bd)});}}}emlformat['build'](_0x2bad2b,function(_0x40f04b,_0xeb98c9){if(_0x40f04b)return _0x4e7f36(_0x40f04b);fs['writeFileSync'](path[_0xc5c3('0xdd')](_0xbd0a3,util['format'](_0xc5c3('0xf1'),_0x1debce)),_0xeb98c9);return _0x242d2c(_0xeb98c9);});});})[_0xc5c3('0x2a')](function(){return new BPromise(function(_0x155df0,_0x29f72c){zipdir(_0xbd0a3,{'saveTo':_0x2ca239},function(_0xcb0a62,_0x2bdc13){if(_0xcb0a62)return _0x29f72c(_0xcb0a62);return _0x155df0(_0x2bdc13);});})[_0xc5c3('0x2a')](function(){return new BPromise(function(_0x57e84f,_0x35b5a2){rimraf(_0xbd0a3,function(_0x1e23a9){if(_0x1e23a9)_0x35b5a2(_0x1e23a9);return _0x57e84f();});});})['then'](function(){return _0x429d7d[_0xc5c3('0xdb')](_0x2ca239,_0x514e7f,function(_0x457533){if(_0x457533){console[_0xc5c3('0xf2')](_0xc5c3('0xf3'),_0x457533);}else{fs[_0xc5c3('0xf4')](_0x2ca239);}});});});}else{return _0x429d7d[_0xc5c3('0x1e')](0xc8);}})[_0xc5c3('0x3b')](handleError(_0x429d7d,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 96d1fb4..d3d8501 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 _0xfa28=['../../mysqldb','MailMessage','setMaxListeners','update','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','events'];(function(_0x2e7468,_0x13d97e){var _0x380b87=function(_0x9a5ce3){while(--_0x9a5ce3){_0x2e7468['push'](_0x2e7468['shift']());}};_0x380b87(++_0x13d97e);}(_0xfa28,0x11d));var _0x8fa2=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xfa28[_0x4b5813];return _0x423465;};'use strict';var EventEmitter=require(_0x8fa2('0x0'));var MailInteraction=require(_0x8fa2('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x8fa2('0x1'))['db'][_0x8fa2('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x8fa2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8fa2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x500db8){return function(_0x5b73b6,_0x280400,_0x12cbe5){_0x5b73b6['getUsers']({'attributes':['id'],'raw':!![]})[_0x8fa2('0x5')](function(_0x3d8233){_0x5b73b6[_0x8fa2('0x6')](_0x8fa2('0x7'),_0x3d8233[_0x8fa2('0x8')](function(_0x10776d){return{'id':_0x10776d['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5b73b6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8fa2('0x5')](function(_0xf3763b){_0x5b73b6[_0x8fa2('0x6')]('unreadMessages',_0xf3763b[_0x8fa2('0x9')]);MailInteractionEvents[_0x8fa2('0xa')](_0x500db8+':'+_0x5b73b6['id'],_0x5b73b6);MailInteractionEvents[_0x8fa2('0xa')](_0x500db8,_0x5b73b6);_0x12cbe5(null);})[_0x8fa2('0xb')](_0x12cbe5(null));};}for(var e in events){if(events[_0x8fa2('0xc')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xa38e=['setDataValue','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','getUsers','then'];(function(_0x457b21,_0x4d9208){var _0x313056=function(_0x34be41){while(--_0x34be41){_0x457b21['push'](_0x457b21['shift']());}};_0x313056(++_0x4d9208);}(_0xa38e,0xcb));var _0xea38=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xa38e[_0x2b9b7f];return _0x4ed19a;};'use strict';var EventEmitter=require(_0xea38('0x0'));var MailInteraction=require(_0xea38('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xea38('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea38('0x2'),'afterUpdate':_0xea38('0x3'),'afterDestroy':_0xea38('0x4')};function emitEvent(_0x408368){return function(_0x5ee119,_0x193495,_0x4632f2){_0x5ee119[_0xea38('0x5')]({'attributes':['id'],'raw':!![]})[_0xea38('0x6')](function(_0x4029f6){_0x5ee119[_0xea38('0x7')]('Users',_0x4029f6['map'](function(_0x52d902){return{'id':_0x52d902['id']};}));return MailMessage[_0xea38('0x8')]({'where':{'MailInteractionId':_0x5ee119['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x11e583){_0x5ee119['setDataValue'](_0xea38('0x9'),_0x11e583['length']);MailInteractionEvents['emit'](_0x408368+':'+_0x5ee119['id'],_0x5ee119);MailInteractionEvents[_0xea38('0xa')](_0x408368,_0x5ee119);_0x4632f2(null);})[_0xea38('0xb')](_0x4632f2(null));};}for(var e in events){if(events[_0xea38('0xc')](e)){var event=events[e];MailInteraction[_0xea38('0xd')](e,emitEvent(event));}}module[_0xea38('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 5afbc35..bf2b76e 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 _0xcc73=['changed','closedAt','models','get','MailMessage','update','then','catch','utf8mb4','util','../../config/logger','bluebird','path','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed'];(function(_0xfd0cf0,_0x19d0af){var _0x2f7857=function(_0x2c9ed9){while(--_0x2c9ed9){_0xfd0cf0['push'](_0xfd0cf0['shift']());}};_0x2f7857(++_0x19d0af);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xcc73[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x3cc7('0x0'));var logger=require(_0x3cc7('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3cc7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cc7('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3cc7('0x4'));module[_0x3cc7('0x5')]=function(_0x1ccad1,_0x10d0f9){return _0x1ccad1[_0x3cc7('0x6')]('MailInteraction',attributes,{'tableName':_0x3cc7('0x7'),'paranoid':![],'indexes':[{'name':_0x3cc7('0x8'),'fields':[_0x3cc7('0x9'),'to'],'type':_0x3cc7('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4e047d,_0x2ff7ba,_0x44005b){if(_0x4e047d[_0x3cc7('0xb')]){_0x4e047d[_0x3cc7('0xc')]=moment()[_0x3cc7('0xd')](_0x3cc7('0xe'));}if(_0x4e047d[_0x3cc7('0xf')]){_0x4e047d['closedAt']=moment()['format'](_0x3cc7('0xe'));}_0x44005b(null,_0x2ff7ba);},'beforeUpdate':function(_0x5a3924,_0x2ee990,_0x29c832){if(_0x5a3924[_0x3cc7('0x10')](_0x3cc7('0xb'))){_0x5a3924[_0x3cc7('0xc')]=_0x5a3924[_0x3cc7('0xb')]?moment()[_0x3cc7('0xd')](_0x3cc7('0xe')):null;}if(_0x5a3924[_0x3cc7('0x10')](_0x3cc7('0xf'))){_0x5a3924[_0x3cc7('0x11')]=moment()[_0x3cc7('0xd')](_0x3cc7('0xe'));_0x5a3924[_0x3cc7('0xb')]=null;_0x5a3924[_0x3cc7('0xc')]=null;}_0x29c832(null,_0x5a3924);},'afterUpdate':function(_0x857775,_0x2c4688,_0x1320a8){var _0x386a31=_0x1ccad1[_0x3cc7('0x12')];var _0xfa1cc8=_0x857775[_0x3cc7('0x13')]({'plain':!![]});if(_0xfa1cc8[_0x3cc7('0xf')]){return _0x386a31[_0x3cc7('0x14')][_0x3cc7('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0xfa1cc8['id']}})[_0x3cc7('0x16')](function(){_0x1320a8();})[_0x3cc7('0x17')](function(_0x2483c9){_0x1320a8(_0x2483c9);});}else{_0x1320a8();}}},'charset':_0x3cc7('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf3dc=['closed','get','update','then','catch','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','format'];(function(_0x3bc5a6,_0x5befea){var _0x414f51=function(_0xc08f80){while(--_0xc08f80){_0x3bc5a6['push'](_0x3bc5a6['shift']());}};_0x414f51(++_0x5befea);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x183c00,_0x5327b8){_0x183c00=_0x183c00-0x0;var _0x4a8361=_0xf3dc[_0x183c00];return _0x4a8361;};'use strict';var _=require(_0xcf3d('0x0'));var util=require(_0xcf3d('0x1'));var logger=require(_0xcf3d('0x2'))('api');var moment=require(_0xcf3d('0x3'));var BPromise=require(_0xcf3d('0x4'));var rp=require(_0xcf3d('0x5'));var fs=require('fs');var path=require(_0xcf3d('0x6'));var rimraf=require(_0xcf3d('0x7'));var config=require(_0xcf3d('0x8'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x55074b,_0x5b1441){return _0x55074b['define']('MailInteraction',attributes,{'tableName':_0xcf3d('0x9'),'paranoid':![],'indexes':[{'name':_0xcf3d('0xa'),'fields':[_0xcf3d('0xb'),'to'],'type':_0xcf3d('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x368e74,_0x27c49c,_0x249945){if(_0x368e74[_0xcf3d('0xd')]){_0x368e74[_0xcf3d('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x368e74['closed']){_0x368e74[_0xcf3d('0xf')]=moment()['format'](_0xcf3d('0x10'));}_0x249945(null,_0x27c49c);},'beforeUpdate':function(_0x29f0e7,_0x100427,_0x16d627){if(_0x29f0e7[_0xcf3d('0x11')](_0xcf3d('0xd'))){_0x29f0e7[_0xcf3d('0xe')]=_0x29f0e7[_0xcf3d('0xd')]?moment()[_0xcf3d('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x29f0e7['changed'](_0xcf3d('0x13'))){_0x29f0e7[_0xcf3d('0xf')]=moment()[_0xcf3d('0x12')](_0xcf3d('0x10'));_0x29f0e7[_0xcf3d('0xd')]=null;_0x29f0e7[_0xcf3d('0xe')]=null;}_0x16d627(null,_0x29f0e7);},'afterUpdate':function(_0x196b1f,_0x71e44b,_0x410004){var _0x88c2de=_0x55074b['models'];var _0x5e5f18=_0x196b1f[_0xcf3d('0x14')]({'plain':!![]});if(_0x5e5f18[_0xcf3d('0x13')]){return _0x88c2de['MailMessage'][_0xcf3d('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x5e5f18['id']}})[_0xcf3d('0x16')](function(){_0x410004();})[_0xcf3d('0x17')](function(_0x18d5fb){_0x410004(_0x18d5fb);});}else{_0x410004();}}},'charset':_0xcf3d('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 6daa007..3d9fcce 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 _0xc577=['attributes','limit','then','stringify','AddTagsToMailInteraction','where','addTags','omit','ids','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options'];(function(_0x290a56,_0x5c540a){var _0x89610=function(_0x4e901f){while(--_0x4e901f){_0x290a56['push'](_0x290a56['shift']());}};_0x89610(++_0x5c540a);}(_0xc577,0x172));var _0x7c57=function(_0x414166,_0x5e87f3){_0x414166=_0x414166-0x0;var _0x373505=_0xc577[_0x414166];return _0x373505;};'use strict';var _=require(_0x7c57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7c57('0x1'));var rs=require(_0x7c57('0x2'));var fs=require('fs');var Redis=require(_0x7c57('0x3'));var db=require(_0x7c57('0x4'))['db'];var utils=require(_0x7c57('0x5'));var logger=require(_0x7c57('0x6'))(_0x7c57('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c57('0x8'));var client=jayson[_0x7c57('0x9')][_0x7c57('0xa')]({'port':0x232a});config[_0x7c57('0xb')]=_[_0x7c57('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c57('0xb')]));require('./mailInteraction.socket')[_0x7c57('0xd')](socket);function respondWithRpcPromise(_0x2e63cc,_0x11dd41,_0x3665f9){return new BPromise(function(_0x4f8f51,_0x1e4a96){return client[_0x7c57('0xe')](_0x2e63cc,_0x3665f9)['then'](function(_0x20aae1){logger[_0x7c57('0xf')](_0x7c57('0x10'),_0x11dd41,_0x7c57('0x11'));logger[_0x7c57('0x12')](_0x7c57('0x13'),_0x11dd41,_0x7c57('0x11'),JSON['stringify'](_0x20aae1));if(_0x20aae1['error']){if(_0x20aae1['error'][_0x7c57('0x14')]===0x1f4){logger[_0x7c57('0x15')](_0x7c57('0x10'),_0x11dd41,_0x20aae1[_0x7c57('0x15')][_0x7c57('0x16')]);return _0x1e4a96(_0x20aae1[_0x7c57('0x15')][_0x7c57('0x16')]);}logger[_0x7c57('0x15')]('MailInteraction,\x20%s,\x20%s',_0x11dd41,_0x20aae1['error'][_0x7c57('0x16')]);return _0x4f8f51(_0x20aae1[_0x7c57('0x15')][_0x7c57('0x16')]);}else{logger[_0x7c57('0xf')](_0x7c57('0x10'),_0x11dd41,'request\x20sent');_0x4f8f51(_0x20aae1[_0x7c57('0x17')][_0x7c57('0x16')]);}})[_0x7c57('0x18')](function(_0x87617b){logger[_0x7c57('0x15')](_0x7c57('0x10'),_0x11dd41,_0x87617b);_0x1e4a96(_0x87617b);});});}exports[_0x7c57('0x19')]=function(_0x3a6dce){var _0x2ace9d=this;return new Promise(function(_0x5488b7,_0x45221e){return db[_0x7c57('0x1a')][_0x7c57('0x1b')](_0x3a6dce[_0x7c57('0x1c')],{'raw':_0x3a6dce['options']?_0x3a6dce['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a6dce[_0x7c57('0x1d')]?_0x3a6dce[_0x7c57('0x1d')]['where']||null:null,'attributes':_0x3a6dce[_0x7c57('0x1d')]?_0x3a6dce[_0x7c57('0x1d')][_0x7c57('0x1e')]||null:null,'limit':_0x3a6dce[_0x7c57('0x1d')]?_0x3a6dce[_0x7c57('0x1d')][_0x7c57('0x1f')]||null:null})[_0x7c57('0x20')](function(_0x56fd57){logger[_0x7c57('0xf')](_0x7c57('0x19'),_0x3a6dce);logger[_0x7c57('0x12')](_0x7c57('0x19'),_0x3a6dce,JSON[_0x7c57('0x21')](_0x56fd57));_0x5488b7(_0x56fd57);})[_0x7c57('0x18')](function(_0x41125b){logger[_0x7c57('0x15')](_0x7c57('0x19'),_0x41125b['message'],_0x3a6dce);_0x45221e(_0x2ace9d['error'](0x1f4,_0x41125b[_0x7c57('0x16')]));});});};exports[_0x7c57('0x22')]=function(_0x327575){return new Promise(function(_0x54b294,_0x9b9d1f){return db['MailInteraction']['find']({'where':_0x327575['options']?_0x327575[_0x7c57('0x1d')][_0x7c57('0x23')]||null:null})['then'](function(_0x423434){if(_0x423434){return _0x423434[_0x7c57('0x24')](_0x327575[_0x7c57('0x1c')]['ids'],_[_0x7c57('0x25')](_0x327575[_0x7c57('0x1c')],[_0x7c57('0x26'),'id'])||{});}})['spread'](function(_0x408860){logger[_0x7c57('0xf')](_0x7c57('0x27'),_0x327575);logger[_0x7c57('0x12')](_0x7c57('0x27'),_0x327575,JSON[_0x7c57('0x21')](_0x408860));_0x54b294(_0x408860);})[_0x7c57('0x18')](function(_0x299d22){logger[_0x7c57('0x15')](_0x7c57('0x27'),_0x299d22['message'],_0x327575);_0x9b9d1f(_this[_0x7c57('0x15')](0x1f4,_0x299d22[_0x7c57('0x16')]));});});}; \ No newline at end of file +var _0x4e61=['then','info','debug','AddTagsToMailInteraction','addTags','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4e61,0x8c));var _0x14e6=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x4e61[_0x261522];return _0x98a25a;};'use strict';var _=require(_0x14e6('0x0'));var util=require(_0x14e6('0x1'));var moment=require(_0x14e6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14e6('0x3'));var db=require(_0x14e6('0x4'))['db'];var utils=require(_0x14e6('0x5'));var logger=require(_0x14e6('0x6'))(_0x14e6('0x7'));var config=require(_0x14e6('0x8'));var jayson=require(_0x14e6('0x9'));var client=jayson[_0x14e6('0xa')][_0x14e6('0xb')]({'port':0x232a});config[_0x14e6('0xc')]=_[_0x14e6('0xd')](config[_0x14e6('0xc')],{'host':_0x14e6('0xe'),'port':0x18eb});var socket=require(_0x14e6('0xf'))(new Redis(config[_0x14e6('0xc')]));require(_0x14e6('0x10'))[_0x14e6('0x11')](socket);function respondWithRpcPromise(_0x40ce5d,_0x4bc647,_0x213bf3){return new BPromise(function(_0x473ed2,_0x1ae9be){return client[_0x14e6('0x12')](_0x40ce5d,_0x213bf3)['then'](function(_0x57e88a){logger['info']('MailInteraction,\x20%s,\x20%s',_0x4bc647,_0x14e6('0x13'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4bc647,_0x14e6('0x13'),JSON[_0x14e6('0x14')](_0x57e88a));if(_0x57e88a[_0x14e6('0x15')]){if(_0x57e88a['error'][_0x14e6('0x16')]===0x1f4){logger[_0x14e6('0x15')](_0x14e6('0x17'),_0x4bc647,_0x57e88a[_0x14e6('0x15')][_0x14e6('0x18')]);return _0x1ae9be(_0x57e88a['error'][_0x14e6('0x18')]);}logger[_0x14e6('0x15')](_0x14e6('0x17'),_0x4bc647,_0x57e88a[_0x14e6('0x15')][_0x14e6('0x18')]);return _0x473ed2(_0x57e88a['error'][_0x14e6('0x18')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x4bc647,'request\x20sent');_0x473ed2(_0x57e88a[_0x14e6('0x19')][_0x14e6('0x18')]);}})[_0x14e6('0x1a')](function(_0x3423b3){logger['error']('MailInteraction,\x20%s,\x20%s',_0x4bc647,_0x3423b3);_0x1ae9be(_0x3423b3);});});}exports[_0x14e6('0x1b')]=function(_0xaa4597){var _0x4280e8=this;return new Promise(function(_0x3d2837,_0x28f75f){return db[_0x14e6('0x1c')][_0x14e6('0x1d')](_0xaa4597[_0x14e6('0x1e')],{'raw':_0xaa4597[_0x14e6('0x1f')]?_0xaa4597[_0x14e6('0x1f')][_0x14e6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xaa4597[_0x14e6('0x1f')]?_0xaa4597[_0x14e6('0x1f')][_0x14e6('0x21')]||null:null,'attributes':_0xaa4597[_0x14e6('0x1f')]?_0xaa4597[_0x14e6('0x1f')][_0x14e6('0x22')]||null:null,'limit':_0xaa4597[_0x14e6('0x1f')]?_0xaa4597[_0x14e6('0x1f')][_0x14e6('0x23')]||null:null})[_0x14e6('0x24')](function(_0x4a5084){logger[_0x14e6('0x25')](_0x14e6('0x1b'),_0xaa4597);logger[_0x14e6('0x26')](_0x14e6('0x1b'),_0xaa4597,JSON[_0x14e6('0x14')](_0x4a5084));_0x3d2837(_0x4a5084);})[_0x14e6('0x1a')](function(_0x477833){logger['error'](_0x14e6('0x1b'),_0x477833['message'],_0xaa4597);_0x28f75f(_0x4280e8['error'](0x1f4,_0x477833['message']));});});};exports[_0x14e6('0x27')]=function(_0x52e725){return new Promise(function(_0x31f5d7,_0x1aef5d){return db[_0x14e6('0x1c')]['find']({'where':_0x52e725[_0x14e6('0x1f')]?_0x52e725[_0x14e6('0x1f')][_0x14e6('0x21')]||null:null})['then'](function(_0x1e21a3){if(_0x1e21a3){return _0x1e21a3[_0x14e6('0x28')](_0x52e725[_0x14e6('0x1e')][_0x14e6('0x29')],_['omit'](_0x52e725[_0x14e6('0x1e')],['ids','id'])||{});}})[_0x14e6('0x2a')](function(_0x11ca20){logger['info'](_0x14e6('0x2b'),_0x52e725);logger[_0x14e6('0x26')](_0x14e6('0x2b'),_0x52e725,JSON[_0x14e6('0x14')](_0x11ca20));_0x31f5d7(_0x11ca20);})['catch'](function(_0x14b18a){logger[_0x14e6('0x15')](_0x14e6('0x2b'),_0x14b18a[_0x14e6('0x18')],_0x52e725);_0x1aef5d(_this[_0x14e6('0x15')](0x1f4,_0x14b18a[_0x14e6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index ef8da6e..f65c9c8 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 _0xf049=['removeListener','register','./mailInteraction.events','remove','update','emit'];(function(_0x305116,_0x5e6ef2){var _0x4a3cc3=function(_0x19d489){while(--_0x19d489){_0x305116['push'](_0x305116['shift']());}};_0x4a3cc3(++_0x5e6ef2);}(_0xf049,0x176));var _0x9f04=function(_0x31c22e,_0x3994ff){_0x31c22e=_0x31c22e-0x0;var _0x2e445a=_0xf049[_0x31c22e];return _0x2e445a;};'use strict';var MailInteractionEvents=require(_0x9f04('0x0'));var events=['save',_0x9f04('0x1'),_0x9f04('0x2')];function createListener(_0x2e0274,_0x23dfc6){return function(_0x4dfa79){_0x23dfc6[_0x9f04('0x3')](_0x2e0274,_0x4dfa79);};}function removeListener(_0x4313ae,_0x510a60){return function(){MailInteractionEvents[_0x9f04('0x4')](_0x4313ae,_0x510a60);};}exports[_0x9f04('0x5')]=function(_0x352af9){for(var _0x44cbb9=0x0,_0x47727c=events['length'];_0x44cbb9<_0x47727c;_0x44cbb9++){var _0x493995=events[_0x44cbb9];var _0xbdd44=createListener('mailInteraction:'+_0x493995,_0x352af9);MailInteractionEvents['on'](_0x493995,_0xbdd44);}}; \ No newline at end of file +var _0x7a72=['mailInteraction:','./mailInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x5eb529,_0x43ea86){var _0x48ce78=function(_0x14d14c){while(--_0x14d14c){_0x5eb529['push'](_0x5eb529['shift']());}};_0x48ce78(++_0x43ea86);}(_0x7a72,0x109));var _0x27a7=function(_0x3ca0da,_0x2691f5){_0x3ca0da=_0x3ca0da-0x0;var _0x5298b7=_0x7a72[_0x3ca0da];return _0x5298b7;};'use strict';var MailInteractionEvents=require(_0x27a7('0x0'));var events=[_0x27a7('0x1'),_0x27a7('0x2'),_0x27a7('0x3')];function createListener(_0x540ec6,_0x5b1707){return function(_0x3713a4){_0x5b1707['emit'](_0x540ec6,_0x3713a4);};}function removeListener(_0x1c5b2c,_0x2f56c8){return function(){MailInteractionEvents[_0x27a7('0x4')](_0x1c5b2c,_0x2f56c8);};}exports[_0x27a7('0x5')]=function(_0x1e9593){for(var _0x43051f=0x0,_0x1ac5c7=events[_0x27a7('0x6')];_0x43051f<_0x1ac5c7;_0x43051f++){var _0x17b6e6=events[_0x43051f];var _0x484ed7=createListener(_0x27a7('0x7')+_0x17b6e6,_0x1e9593);MailInteractionEvents['on'](_0x17b6e6,_0x484ed7);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 9f5844a..3686ffe 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 _0x7217=['mailmessage:create','create','put','update','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','mail'];(function(_0x520259,_0x4fc2a4){var _0x525849=function(_0xcdf87d){while(--_0xcdf87d){_0x520259['push'](_0x520259['shift']());}};_0x525849(++_0x4fc2a4);}(_0x7217,0x19e));var _0x7721=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7217[_0x411add];return _0x238242;};'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('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0x7')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller['download']);router[_0x7721('0xf')]('/',auth[_0x7721('0x8')](),interaction[_0x7721('0x10')](_0x7721('0x11'),_0x7721('0x12')),controller[_0x7721('0x13')]);router[_0x7721('0x14')](_0x7721('0xc'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x14')]('/:id/accept',auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);router[_0x7721('0x14')](_0x7721('0x17'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router[_0x7721('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7721('0x1a')]=router; \ No newline at end of file +var _0x55ca=['get','isAuthenticated','index','/describe','describe','show','download','post','tracked','mail','mailmessage:create','create','put','/:id','/:id/reject','reject','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./mailMessage.controller'];(function(_0x21b3b9,_0x1e6fe2){var _0x7588e3=function(_0x3f56cf){while(--_0x3f56cf){_0x21b3b9['push'](_0x21b3b9['shift']());}};_0x7588e3(++_0x1e6fe2);}(_0x55ca,0x126));var _0xa55c=function(_0xb4ec3a,_0x2bace0){_0xb4ec3a=_0xb4ec3a-0x0;var _0x1b83db=_0x55ca[_0xb4ec3a];return _0x1b83db;};'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/download',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')]('/',auth[_0xa55c('0x7')](),interaction[_0xa55c('0xe')](_0xa55c('0xf'),_0xa55c('0x10')),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth['isAuthenticated'](),controller['update']);router[_0xa55c('0x12')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0xa55c('0x12')](_0xa55c('0x14'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x15')]);router[_0xa55c('0x16')](_0xa55c('0x13'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);module[_0xa55c('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 91c5305..b9ee3ba 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 _0xdf59=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','exports','long'];(function(_0x3c20ad,_0x1a1be6){var _0x57de44=function(_0x3b62d1){while(--_0x3b62d1){_0x3c20ad['push'](_0x3c20ad['shift']());}};_0x57de44(++_0x1a1be6);}(_0xdf59,0xf4));var _0x9df5=function(_0x59f650,_0x121de5){_0x59f650=_0x59f650-0x0;var _0xd7f7a5=_0xdf59[_0x59f650];return _0xd7f7a5;};'use strict';var Sequelize=require(_0x9df5('0x0'));var _=require('lodash');module[_0x9df5('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9df5('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9df5('0x3')](_0x9df5('0x4'))},'read':{'type':Sequelize[_0x9df5('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9df5('0x6')]('in','out'),'defaultValue':_0x9df5('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9df5('0x8')](0x1fe)},'from':{'type':Sequelize[_0x9df5('0x8')]},'to':{'type':Sequelize[_0x9df5('0x3')](_0x9df5('0x2'))},'cc':{'type':Sequelize[_0x9df5('0x3')]('long')},'bcc':{'type':Sequelize[_0x9df5('0x3')](_0x9df5('0x2'))},'subject':{'type':Sequelize[_0x9df5('0x3')]},'sentAt':{'type':Sequelize[_0x9df5('0x9')]},'attach':{'type':Sequelize[_0x9df5('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9df5('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9df5('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x9df5('0x2'))},'originCc':{'type':Sequelize[_0x9df5('0x3')](_0x9df5('0x2'))},'originChannel':{'type':Sequelize[_0x9df5('0x6')](_0x9df5('0xb'),_0x9df5('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x3d65=['long','BOOLEAN','STRING','DATE','ENUM','Email','Chat','sequelize','lodash','exports','TEXT'];(function(_0x19aa66,_0x2dc75a){var _0x4ab50e=function(_0x43f485){while(--_0x43f485){_0x19aa66['push'](_0x19aa66['shift']());}};_0x4ab50e(++_0x2dc75a);}(_0x3d65,0x11a));var _0x53d6=function(_0x4fe5d2,_0x45b077){_0x4fe5d2=_0x4fe5d2-0x0;var _0x107113=_0x3d65[_0x4fe5d2];return _0x107113;};'use strict';var Sequelize=require(_0x53d6('0x0'));var _=require(_0x53d6('0x1'));module[_0x53d6('0x2')]={'body':{'type':Sequelize[_0x53d6('0x3')](_0x53d6('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x53d6('0x3')]('medium')},'read':{'type':Sequelize[_0x53d6('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x53d6('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x53d6('0x3')](_0x53d6('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x53d6('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x53d6('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x53d6('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x53d6('0x7')]},'originTo':{'type':Sequelize[_0x53d6('0x3')](_0x53d6('0x4'))},'originCc':{'type':Sequelize[_0x53d6('0x3')](_0x53d6('0x4'))},'originChannel':{'type':Sequelize[_0x53d6('0x8')](_0x53d6('0x9'),_0x53d6('0xa')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 3aadb98..dfc16ca 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 _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x13935b,_0x354db4){var _0x379b2c=function(_0x8b3f8e){while(--_0x8b3f8e){_0x13935b['push'](_0x13935b['shift']());}};_0x379b2c(++_0x354db4);}(_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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file +var _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x13bd80,_0x23202a){var _0x4e19af=function(_0x210a9a){while(--_0x210a9a){_0x13bd80['push'](_0x13bd80['shift']());}};_0x4e19af(++_0x23202a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f99a78d..4be9a42 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 _0xa3d5=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x395c74,_0x29273b){var _0x35367a=function(_0x5a3ff5){while(--_0x5a3ff5){_0x395c74['push'](_0x395c74['shift']());}};_0x35367a(++_0x29273b);}(_0xa3d5,0x1c8));var _0x5a3d=function(_0x4e2272,_0x2e1ae0){_0x4e2272=_0x4e2272-0x0;var _0x45511c=_0xa3d5[_0x4e2272];return _0x45511c;};'use strict';var EventEmitter=require(_0x5a3d('0x0'));var MailMessage=require(_0x5a3d('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5a3d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5a3d('0x3'),'afterDestroy':_0x5a3d('0x4')};function emitEvent(_0x5360e4){return function(_0x209993,_0x442ec7,_0xce336d){MailMessageEvents[_0x5a3d('0x5')](_0x5360e4+':'+_0x209993['id'],_0x209993);MailMessageEvents[_0x5a3d('0x5')](_0x5360e4,_0x209993);_0xce336d(null);};}for(var e in events){if(events[_0x5a3d('0x6')](e)){var event=events[e];MailMessage[_0x5a3d('0x7')](e,emitEvent(event));}}module[_0x5a3d('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xa508=['hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x5e657e,_0xe942d6){var _0x2690af=function(_0x530275){while(--_0x530275){_0x5e657e['push'](_0x5e657e['shift']());}};_0x2690af(++_0xe942d6);}(_0xa508,0x18f));var _0x8a50=function(_0x5a4e85,_0x30ba85){_0x5a4e85=_0x5a4e85-0x0;var _0x209aa7=_0xa508[_0x5a4e85];return _0x209aa7;};'use strict';var EventEmitter=require(_0x8a50('0x0'));var MailMessage=require(_0x8a50('0x1'))['db'][_0x8a50('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8a50('0x3')](0x0);var events={'afterCreate':_0x8a50('0x4'),'afterUpdate':_0x8a50('0x5'),'afterDestroy':_0x8a50('0x6')};function emitEvent(_0x437b30){return function(_0x15d7ba,_0xd73afa,_0xd1ede2){MailMessageEvents[_0x8a50('0x7')](_0x437b30+':'+_0x15d7ba['id'],_0x15d7ba);MailMessageEvents[_0x8a50('0x7')](_0x437b30,_0x15d7ba);_0xd1ede2(null);};}for(var e in events){if(events[_0x8a50('0x8')](e)){var event=events[e];MailMessage[_0x8a50('0x9')](e,emitEvent(event));}}module[_0x8a50('0xa')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 76c94ed..9bb7b26 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 _0xf2dc=['UserId','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','body','fromString','models','direction','toLowerCase','secret'];(function(_0x221f57,_0x2e5ea3){var _0x4c5d4f=function(_0x23bd67){while(--_0x23bd67){_0x221f57['push'](_0x221f57['shift']());}};_0x4c5d4f(++_0x2e5ea3);}(_0xf2dc,0x16a));var _0xcf2d=function(_0x5161d9,_0x30dbee){_0x5161d9=_0x5161d9-0x0;var _0x30146e=_0xf2dc[_0x5161d9];return _0x30146e;};'use strict';var _=require(_0xcf2d('0x0'));var util=require(_0xcf2d('0x1'));var logger=require('../../config/logger')(_0xcf2d('0x2'));var moment=require('moment');var BPromise=require(_0xcf2d('0x3'));var rp=require(_0xcf2d('0x4'));var htmlToText=require(_0xcf2d('0x5'));var fs=require('fs');var path=require(_0xcf2d('0x6'));var rimraf=require(_0xcf2d('0x7'));var config=require(_0xcf2d('0x8'));var attributes=require(_0xcf2d('0x9'));module[_0xcf2d('0xa')]=function(_0x26937b,_0x2db1ec){return _0x26937b[_0xcf2d('0xb')](_0xcf2d('0xc'),attributes,{'tableName':_0xcf2d('0xd'),'paranoid':![],'indexes':[{'name':_0xcf2d('0xe'),'fields':[_0xcf2d('0xe')]},{'name':'fti_mail_messages','fields':[_0xcf2d('0xf'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3ff41e,_0x1d60d9,_0x3ba01b){if(_0x3ff41e[_0xcf2d('0x10')]){_0x3ff41e[_0xcf2d('0xf')]=htmlToText[_0xcf2d('0x11')](_0x3ff41e[_0xcf2d('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3ba01b(null,_0x1d60d9);},'afterCreate':function(_0x66e541,_0x5f5597,_0x89ea7a){var _0x54acfc=_0x26937b[_0xcf2d('0x12')];var _0x167b79=_0x66e541['get']({'plain':!![]});if(_0x167b79[_0xcf2d('0x13')][_0xcf2d('0x14')]()==='in'||_0x167b79['direction'][_0xcf2d('0x14')]()==='out'&&!_0x167b79[_0xcf2d('0x15')]&&!_['isNil'](_0x167b79[_0xcf2d('0x16')])){_0x54acfc['MailInteraction'][_0xcf2d('0x17')]({'where':{'id':_0x167b79[_0xcf2d('0x18')]}})[_0xcf2d('0x19')](function(_0x2af9b6){if(_0x2af9b6){_0x2af9b6[_0xcf2d('0x1a')]({'lastMsgAt':_0x167b79[_0xcf2d('0x1b')],'lastMsgDirection':_0x167b79[_0xcf2d('0x13')][_0xcf2d('0x14')](),'lastMsgBody':_0x167b79[_0xcf2d('0x10')]});}})[_0xcf2d('0x1c')](function(_0x2ac3ba){console[_0xcf2d('0x1d')](_0x2ac3ba);});}_0x89ea7a();}},'charset':_0xcf2d('0x1e'),'collate':_0xcf2d('0x1f')});}; \ No newline at end of file +var _0x5a04=['subject','FULLTEXT','body','get','direction','toLowerCase','out','isNil','UserId','findOne','MailInteractionId','then','update','catch','error','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','../../config/environment','exports','define','MailMessage','messageId','fti_mail_messages','plainBody'];(function(_0x131f2b,_0x52b085){var _0x245d8c=function(_0x49a492){while(--_0x49a492){_0x131f2b['push'](_0x131f2b['shift']());}};_0x245d8c(++_0x52b085);}(_0x5a04,0xab));var _0x45a0=function(_0x568d6f,_0x1e579d){_0x568d6f=_0x568d6f-0x0;var _0x29597b=_0x5a04[_0x568d6f];return _0x29597b;};'use strict';var _=require('lodash');var util=require(_0x45a0('0x0'));var logger=require(_0x45a0('0x1'))(_0x45a0('0x2'));var moment=require(_0x45a0('0x3'));var BPromise=require(_0x45a0('0x4'));var rp=require(_0x45a0('0x5'));var htmlToText=require(_0x45a0('0x6'));var fs=require('fs');var path=require(_0x45a0('0x7'));var rimraf=require('rimraf');var config=require(_0x45a0('0x8'));var attributes=require('./mailMessage.attributes');module[_0x45a0('0x9')]=function(_0x4bda94,_0x589063){return _0x4bda94[_0x45a0('0xa')](_0x45a0('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x45a0('0xc')]},{'name':_0x45a0('0xd'),'fields':[_0x45a0('0xe'),_0x45a0('0xf')],'type':_0x45a0('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x11dc31,_0x1bc47e,_0x4a17ac){if(_0x11dc31[_0x45a0('0x11')]){_0x11dc31[_0x45a0('0xe')]=htmlToText['fromString'](_0x11dc31[_0x45a0('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4a17ac(null,_0x1bc47e);},'afterCreate':function(_0x4ece52,_0x324fc2,_0x3743e7){var _0x5793a6=_0x4bda94['models'];var _0x5ca31a=_0x4ece52[_0x45a0('0x12')]({'plain':!![]});if(_0x5ca31a[_0x45a0('0x13')][_0x45a0('0x14')]()==='in'||_0x5ca31a[_0x45a0('0x13')][_0x45a0('0x14')]()===_0x45a0('0x15')&&!_0x5ca31a['secret']&&!_[_0x45a0('0x16')](_0x5ca31a[_0x45a0('0x17')])){_0x5793a6['MailInteraction'][_0x45a0('0x18')]({'where':{'id':_0x5ca31a[_0x45a0('0x19')]}})[_0x45a0('0x1a')](function(_0x3c52e1){if(_0x3c52e1){_0x3c52e1[_0x45a0('0x1b')]({'lastMsgAt':_0x5ca31a['createdAt'],'lastMsgDirection':_0x5ca31a[_0x45a0('0x13')][_0x45a0('0x14')](),'lastMsgBody':_0x5ca31a[_0x45a0('0x11')]});}})[_0x45a0('0x1c')](function(_0x32c713){console[_0x45a0('0x1d')](_0x32c713);});}_0x3743e7();}},'charset':_0x45a0('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index e4ac2bb..d662b1c 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 _0x8a47=['register','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','socket.io-emitter','./mailMessage.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a47,0x17e));var _0x78a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8a47[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x78a4('0x0'));var util=require(_0x78a4('0x1'));var moment=require(_0x78a4('0x2'));var BPromise=require(_0x78a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78a4('0x4'));var db=require(_0x78a4('0x5'))['db'];var utils=require(_0x78a4('0x6'));var logger=require(_0x78a4('0x7'))('rpc');var config=require(_0x78a4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x78a4('0x9')][_0x78a4('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x78a4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x78a4('0xc'))(new Redis(config[_0x78a4('0xb')]));require(_0x78a4('0xd'))[_0x78a4('0xe')](socket);function respondWithRpcPromise(_0x2ccfa9,_0x74abfb,_0x2d859b){return new BPromise(function(_0x301e86,_0x35fe8f){return client[_0x78a4('0xf')](_0x2ccfa9,_0x2d859b)[_0x78a4('0x10')](function(_0x8b8294){logger[_0x78a4('0x11')](_0x78a4('0x12'),_0x74abfb,'request\x20sent');logger[_0x78a4('0x13')](_0x78a4('0x14'),_0x74abfb,_0x78a4('0x15'),JSON[_0x78a4('0x16')](_0x8b8294));if(_0x8b8294[_0x78a4('0x17')]){if(_0x8b8294['error'][_0x78a4('0x18')]===0x1f4){logger[_0x78a4('0x17')](_0x78a4('0x12'),_0x74abfb,_0x8b8294[_0x78a4('0x17')][_0x78a4('0x19')]);return _0x35fe8f(_0x8b8294[_0x78a4('0x17')][_0x78a4('0x19')]);}logger[_0x78a4('0x17')](_0x78a4('0x12'),_0x74abfb,_0x8b8294[_0x78a4('0x17')]['message']);return _0x301e86(_0x8b8294[_0x78a4('0x17')][_0x78a4('0x19')]);}else{logger[_0x78a4('0x11')](_0x78a4('0x12'),_0x74abfb,_0x78a4('0x15'));_0x301e86(_0x8b8294[_0x78a4('0x1a')][_0x78a4('0x19')]);}})[_0x78a4('0x1b')](function(_0x31e4a3){logger[_0x78a4('0x17')]('MailMessage,\x20%s,\x20%s',_0x74abfb,_0x31e4a3);_0x35fe8f(_0x31e4a3);});});}exports[_0x78a4('0x1c')]=function(_0x39b2b5){var _0x2a4366=this;return new Promise(function(_0x293bd8,_0x45035e){return db[_0x78a4('0x1d')][_0x78a4('0x1e')](_0x39b2b5[_0x78a4('0x1f')],{'raw':_0x39b2b5[_0x78a4('0x20')]?_0x39b2b5[_0x78a4('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5cd778){logger[_0x78a4('0x11')](_0x78a4('0x1c'),_0x39b2b5);logger[_0x78a4('0x13')](_0x78a4('0x1c'),_0x39b2b5,JSON[_0x78a4('0x16')](_0x5cd778));_0x293bd8(_0x5cd778);})[_0x78a4('0x1b')](function(_0x5087e0){logger['error']('CreateMailMessage',_0x5087e0[_0x78a4('0x19')],_0x39b2b5);_0x45035e(_0x2a4366[_0x78a4('0x17')](0x1f4,_0x5087e0[_0x78a4('0x19')]));});});}; \ No newline at end of file +var _0x5915=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','client','http','defaults','redis','localhost','socket.io-emitter','register','request','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateMailMessage','MailMessage','raw','then','debug'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5915,0x14a));var _0x5591=function(_0x28598b,_0x34b0ec){_0x28598b=_0x28598b-0x0;var _0xb19018=_0x5915[_0x28598b];return _0xb19018;};'use strict';var _=require(_0x5591('0x0'));var util=require(_0x5591('0x1'));var moment=require(_0x5591('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5591('0x3'));var db=require(_0x5591('0x4'))['db'];var utils=require(_0x5591('0x5'));var logger=require('../../config/logger')(_0x5591('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5591('0x7')][_0x5591('0x8')]({'port':0x232a});config['redis']=_[_0x5591('0x9')](config[_0x5591('0xa')],{'host':_0x5591('0xb'),'port':0x18eb});var socket=require(_0x5591('0xc'))(new Redis(config[_0x5591('0xa')]));require('./mailMessage.socket')[_0x5591('0xd')](socket);function respondWithRpcPromise(_0x3ca61c,_0x5a964e,_0xa9a68f){return new BPromise(function(_0x5d8375,_0x1636d3){return client[_0x5591('0xe')](_0x3ca61c,_0xa9a68f)['then'](function(_0x2b97a3){logger['info'](_0x5591('0xf'),_0x5a964e,_0x5591('0x10'));logger['debug'](_0x5591('0x11'),_0x5a964e,_0x5591('0x10'),JSON[_0x5591('0x12')](_0x2b97a3));if(_0x2b97a3[_0x5591('0x13')]){if(_0x2b97a3[_0x5591('0x13')][_0x5591('0x14')]===0x1f4){logger['error'](_0x5591('0xf'),_0x5a964e,_0x2b97a3[_0x5591('0x13')]['message']);return _0x1636d3(_0x2b97a3[_0x5591('0x13')][_0x5591('0x15')]);}logger[_0x5591('0x13')](_0x5591('0xf'),_0x5a964e,_0x2b97a3['error'][_0x5591('0x15')]);return _0x5d8375(_0x2b97a3[_0x5591('0x13')][_0x5591('0x15')]);}else{logger[_0x5591('0x16')](_0x5591('0xf'),_0x5a964e,_0x5591('0x10'));_0x5d8375(_0x2b97a3[_0x5591('0x17')][_0x5591('0x15')]);}})[_0x5591('0x18')](function(_0xf8fd40){logger[_0x5591('0x13')](_0x5591('0xf'),_0x5a964e,_0xf8fd40);_0x1636d3(_0xf8fd40);});});}exports[_0x5591('0x19')]=function(_0xb8449f){var _0x129c92=this;return new Promise(function(_0x5105dc,_0x15694a){return db[_0x5591('0x1a')]['create'](_0xb8449f['body'],{'raw':_0xb8449f['options']?_0xb8449f['options'][_0x5591('0x1b')]===undefined?!![]:![]:!![]})[_0x5591('0x1c')](function(_0x277c45){logger[_0x5591('0x16')](_0x5591('0x19'),_0xb8449f);logger[_0x5591('0x1d')](_0x5591('0x19'),_0xb8449f,JSON['stringify'](_0x277c45));_0x5105dc(_0x277c45);})['catch'](function(_0xf4d2a1){logger[_0x5591('0x13')](_0x5591('0x19'),_0xf4d2a1[_0x5591('0x15')],_0xb8449f);_0x15694a(_0x129c92['error'](0x1f4,_0xf4d2a1[_0x5591('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 34344d2..d2e9397 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 _0x8d5b=['./mailMessage.events','update','emit','removeListener','length'];(function(_0x2adade,_0x1e74dc){var _0x34c2e0=function(_0x1898a9){while(--_0x1898a9){_0x2adade['push'](_0x2adade['shift']());}};_0x34c2e0(++_0x1e74dc);}(_0x8d5b,0x19f));var _0xb8d5=function(_0x209575,_0x417ae0){_0x209575=_0x209575-0x0;var _0x5b183d=_0x8d5b[_0x209575];return _0x5b183d;};'use strict';var MailMessageEvents=require(_0xb8d5('0x0'));var events=['save','remove',_0xb8d5('0x1')];function createListener(_0x451513,_0x288652){return function(_0x50a161){_0x288652[_0xb8d5('0x2')](_0x451513,_0x50a161);};}function removeListener(_0x28503c,_0x1a7148){return function(){MailMessageEvents[_0xb8d5('0x3')](_0x28503c,_0x1a7148);};}exports['register']=function(_0x5eb975){for(var _0x3a841b=0x0,_0x493e5b=events[_0xb8d5('0x4')];_0x3a841b<_0x493e5b;_0x3a841b++){var _0xba9d6e=events[_0x3a841b];var _0x2df97e=createListener('mailMessage:'+_0xba9d6e,_0x5eb975);MailMessageEvents['on'](_0xba9d6e,_0x2df97e);}}; \ No newline at end of file +var _0x5173=['mailMessage:','./mailMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x4c114f,_0x1c1318){var _0x5a4d3e=function(_0x30b622){while(--_0x30b622){_0x4c114f['push'](_0x4c114f['shift']());}};_0x5a4d3e(++_0x1c1318);}(_0x5173,0x109));var _0x3517=function(_0x3968ec,_0x4d2221){_0x3968ec=_0x3968ec-0x0;var _0x30e7f4=_0x5173[_0x3968ec];return _0x30e7f4;};'use strict';var MailMessageEvents=require(_0x3517('0x0'));var events=[_0x3517('0x1'),_0x3517('0x2'),'update'];function createListener(_0x3b8ca7,_0x5bafab){return function(_0x3eb5a7){_0x5bafab[_0x3517('0x3')](_0x3b8ca7,_0x3eb5a7);};}function removeListener(_0x48d6d6,_0x256e3a){return function(){MailMessageEvents[_0x3517('0x4')](_0x48d6d6,_0x256e3a);};}exports[_0x3517('0x5')]=function(_0x46d835){for(var _0x2a0b0c=0x0,_0x3c65f6=events[_0x3517('0x6')];_0x2a0b0c<_0x3c65f6;_0x2a0b0c++){var _0x47d5b7=events[_0x2a0b0c];var _0x241a49=createListener(_0x3517('0x7')+_0x47d5b7,_0x46d835);MailMessageEvents['on'](_0x47d5b7,_0x241a49);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 5ca5393..1a5068f 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 _0x3899=['exports','multer','util','express','Router','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x9ac595,_0x22ed2a){var _0x162ab1=function(_0x2f49cf){while(--_0x2f49cf){_0x9ac595['push'](_0x9ac595['shift']());}};_0x162ab1(++_0x22ed2a);}(_0x3899,0x16d));var _0x9389=function(_0x3ad348,_0xa455af){_0x3ad348=_0x3ad348-0x0;var _0x566b07=_0x3899[_0x3ad348];return _0x566b07;};'use strict';var multer=require(_0x9389('0x0'));var util=require(_0x9389('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9389('0x2'));var router=express[_0x9389('0x3')]();var auth=require(_0x9389('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailQueue.controller');router['get']('/',auth[_0x9389('0x5')](),controller[_0x9389('0x6')]);router[_0x9389('0x7')](_0x9389('0x8'),auth[_0x9389('0x5')](),controller[_0x9389('0x9')]);router[_0x9389('0x7')](_0x9389('0xa'),auth['isAuthenticated'](),controller[_0x9389('0xb')]);router[_0x9389('0x7')](_0x9389('0xc'),auth[_0x9389('0x5')](),controller[_0x9389('0xd')]);router[_0x9389('0x7')](_0x9389('0xe'),auth[_0x9389('0x5')](),controller[_0x9389('0xf')]);router[_0x9389('0x7')](_0x9389('0x10'),auth[_0x9389('0x5')](),controller[_0x9389('0x11')]);router[_0x9389('0x12')]('/',auth[_0x9389('0x5')](),controller[_0x9389('0x13')]);router[_0x9389('0x12')](_0x9389('0xe'),auth['isAuthenticated'](),controller[_0x9389('0x14')]);router[_0x9389('0x12')](_0x9389('0x10'),auth[_0x9389('0x5')](),controller[_0x9389('0x15')]);router[_0x9389('0x16')](_0x9389('0xa'),auth['isAuthenticated'](),controller[_0x9389('0x17')]);router[_0x9389('0x18')](_0x9389('0xa'),auth[_0x9389('0x5')](),controller[_0x9389('0x19')]);router['delete'](_0x9389('0xe'),auth[_0x9389('0x5')](),controller[_0x9389('0x1a')]);router[_0x9389('0x18')](_0x9389('0x10'),auth[_0x9389('0x5')](),controller['removeAgents']);module[_0x9389('0x1b')]=router; \ No newline at end of file +var _0xd9da=['addTeams','addAgents','put','/:id','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','/describe','describe','show','/:id/members','get','/:id/teams','getTeams','/:id/users','create','post'];(function(_0x73e318,_0x199dcd){var _0x3ac574=function(_0xe88ebc){while(--_0xe88ebc){_0x73e318['push'](_0x73e318['shift']());}};_0x3ac574(++_0x199dcd);}(_0xd9da,0xdc));var _0xad9d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd9da[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xad9d('0x0'));var util=require(_0xad9d('0x1'));var path=require(_0xad9d('0x2'));var timeout=require(_0xad9d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xad9d('0x4'));var interaction=require(_0xad9d('0x5'));var config=require(_0xad9d('0x6'));var controller=require(_0xad9d('0x7'));router['get']('/',auth[_0xad9d('0x8')](),controller[_0xad9d('0x9')]);router['get'](_0xad9d('0xa'),auth[_0xad9d('0x8')](),controller[_0xad9d('0xb')]);router['get']('/:id',auth[_0xad9d('0x8')](),controller[_0xad9d('0xc')]);router['get'](_0xad9d('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0xad9d('0xe')](_0xad9d('0xf'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x10')]);router[_0xad9d('0xe')](_0xad9d('0x11'),auth[_0xad9d('0x8')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xad9d('0x12')]);router[_0xad9d('0x13')](_0xad9d('0xf'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x14')]);router[_0xad9d('0x13')](_0xad9d('0x11'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x15')]);router[_0xad9d('0x16')](_0xad9d('0x17'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x18')]);router['delete'](_0xad9d('0x17'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x19')]);router['delete'](_0xad9d('0xf'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x1a')]);router[_0xad9d('0x1b')](_0xad9d('0x11'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x1c')]);module[_0xad9d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f6c9339..0feebd5 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 _0x80a3=['sequelize','exports','STRING','ENUM','rrmemory','beepall'];(function(_0x215acd,_0x410e3d){var _0x42739c=function(_0x2747fb){while(--_0x2747fb){_0x215acd['push'](_0x215acd['shift']());}};_0x42739c(++_0x410e3d);}(_0x80a3,0x1e6));var _0x380a=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x80a3[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0x380a('0x0'));module[_0x380a('0x1')]={'name':{'type':Sequelize[_0x380a('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x380a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x380a('0x3')](_0x380a('0x4'),_0x380a('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x75ff=['name','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x75ff,0x131));var _0xf75f=function(_0x1c391b,_0x331dc5){_0x1c391b=_0x1c391b-0x0;var _0x3da0c1=_0x75ff[_0x1c391b];return _0x3da0c1;};'use strict';var Sequelize=require(_0xf75f('0x0'));module[_0xf75f('0x1')]={'name':{'type':Sequelize[_0xf75f('0x2')],'unique':_0xf75f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf75f('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf75f('0x4')](_0xf75f('0x5'),_0xf75f('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index b9d9b10..9047816 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 _0x4fad=['merge','options','includeAll','MailQueue','findAll','rows','catch','keys','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','UserMailQueue','nolimit','MailQueueId','filter','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','getTeams','findOne','addTeams','ids','Team','Agents','interface','flatMap','transaction','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','value','sequelize','removeAgents','userMailQueue:remove','addAgents','omit','userMailQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','where'];(function(_0x429913,_0xc8deb5){var _0x51bb09=function(_0x495f06){while(--_0x495f06){_0x429913['push'](_0x429913['shift']());}};_0x51bb09(++_0xc8deb5);}(_0x4fad,0xcb));var _0xd4fa=function(_0x518309,_0xa202f5){_0x518309=_0x518309-0x0;var _0x567423=_0x4fad[_0x518309];return _0x567423;};'use strict';var pdf=require(_0xd4fa('0x0'));var emlformat=require(_0xd4fa('0x1'));var rimraf=require(_0xd4fa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4fa('0x3'));var rp=require(_0xd4fa('0x4'));var moment=require(_0xd4fa('0x5'));var BPromise=require(_0xd4fa('0x6'));var Mustache=require(_0xd4fa('0x7'));var util=require(_0xd4fa('0x8'));var path=require(_0xd4fa('0x9'));var sox=require(_0xd4fa('0xa'));var csv=require('to-csv');var ejs=require(_0xd4fa('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd4fa('0xc'));var crypto=require(_0xd4fa('0xd'));var jsforce=require(_0xd4fa('0xe'));var deskjs=require(_0xd4fa('0xf'));var toCsv=require(_0xd4fa('0x10'));var querystring=require('querystring');var Papa=require(_0xd4fa('0x11'));var Redis=require(_0xd4fa('0x12'));var authService=require(_0xd4fa('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd4fa('0x14'));var hardwareService=require(_0xd4fa('0x15'));var logger=require(_0xd4fa('0x16'))(_0xd4fa('0x17'));var utils=require('../../config/utils');var config=require(_0xd4fa('0x18'));var licenseUtil=require(_0xd4fa('0x19'));var db=require(_0xd4fa('0x1a'))['db'];config['redis']=_[_0xd4fa('0x1b')](config[_0xd4fa('0x1c')],{'host':_0xd4fa('0x1d'),'port':0x18eb});var socket=require(_0xd4fa('0x1e'))(new Redis(config[_0xd4fa('0x1c')]));require(_0xd4fa('0x1f'))['register'](socket);function respondWithStatusCode(_0x29e101,_0x187a02){_0x187a02=_0x187a02||0xcc;return function(_0x1a4bc4){if(_0x1a4bc4){return _0x29e101[_0xd4fa('0x20')](_0x187a02);}return _0x29e101[_0xd4fa('0x21')](_0x187a02)[_0xd4fa('0x22')]();};}function respondWithResult(_0xa8bb45,_0x49c0c6){_0x49c0c6=_0x49c0c6||0xc8;return function(_0x37bc80){if(_0x37bc80){return _0xa8bb45[_0xd4fa('0x21')](_0x49c0c6)[_0xd4fa('0x23')](_0x37bc80);}};}function respondWithFilteredResult(_0x5c221a,_0x5f48d5){return function(_0x1faa0b){if(_0x1faa0b){var _0x5601d6=_0x1faa0b[_0xd4fa('0x24')],_0x5df190=_0x5f48d5[_0xd4fa('0x25')],_0x1f9be1=_0x5f48d5['offset']+_0x5f48d5[_0xd4fa('0x26')],_0x628bc7;if(_0x1f9be1>=_0x5601d6){_0x1f9be1=_0x5601d6;_0x628bc7=0xc8;}else{_0x628bc7=0xce;}_0x5c221a[_0xd4fa('0x21')](_0x628bc7);return _0x5c221a['set'](_0xd4fa('0x27'),_0x5df190+'-'+_0x1f9be1+'/'+_0x5601d6)['json'](_0x1faa0b);}return null;};}function patchUpdates(_0x485db5){return function(_0x25d73c){try{jsonpatch[_0xd4fa('0x28')](_0x25d73c,_0x485db5,!![]);}catch(_0x31a90c){return BPromise[_0xd4fa('0x29')](_0x31a90c);}return _0x25d73c['save']();};}function saveUpdates(_0x13d59a,_0x248a77){return function(_0x4201eb){if(_0x4201eb){return _0x4201eb[_0xd4fa('0x2a')](_0x13d59a)[_0xd4fa('0x2b')](function(_0x4b24cb){return _0x4b24cb;});}return null;};}function removeEntity(_0x2a9d07,_0x14ea6e){return function(_0x4c5836){if(_0x4c5836){return _0x4c5836[_0xd4fa('0x2c')]()[_0xd4fa('0x2b')](function(){var _0x1de4c7=_0x4c5836[_0xd4fa('0x2d')]({'plain':!![]});var _0x2d68ca=_0xd4fa('0x2e');return db[_0xd4fa('0x2f')][_0xd4fa('0x2c')]({'where':{'type':_0x2d68ca,'resourceId':_0x1de4c7['id']}})[_0xd4fa('0x2b')](function(){return _0x4c5836;});})['then'](function(){_0x2a9d07[_0xd4fa('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f817,_0x136d2c){return function(_0x59446d){if(!_0x59446d){_0x21f817[_0xd4fa('0x20')](0x194);}return _0x59446d;};}function handleError(_0x41aa35,_0x1b16ba){_0x1b16ba=_0x1b16ba||0x1f4;return function(_0x5345c4){logger[_0xd4fa('0x30')](_0x5345c4[_0xd4fa('0x31')]);if(_0x5345c4['name']){delete _0x5345c4[_0xd4fa('0x32')];}_0x41aa35[_0xd4fa('0x21')](_0x1b16ba)['send'](_0x5345c4);};}exports[_0xd4fa('0x33')]=function(_0x21a96b,_0x51c6df){var _0x2152c6={},_0x4490eb={},_0x32bfb5={'count':0x0,'rows':[]};var _0x1ce1e3=_[_0xd4fa('0x34')](db['MailQueue'][_0xd4fa('0x35')],function(_0x1ba5a8){return{'name':_0x1ba5a8[_0xd4fa('0x36')],'type':_0x1ba5a8[_0xd4fa('0x37')]['key']};});_0x4490eb[_0xd4fa('0x38')]=_[_0xd4fa('0x34')](_0x1ce1e3,_0xd4fa('0x32'));_0x4490eb[_0xd4fa('0x39')]=_['keys'](_0x21a96b['query']);_0x4490eb['filters']=_['intersection'](_0x4490eb[_0xd4fa('0x38')],_0x4490eb[_0xd4fa('0x39')]);_0x2152c6['attributes']=_['intersection'](_0x4490eb['model'],qs['fields'](_0x21a96b[_0xd4fa('0x39')][_0xd4fa('0x3a')]));_0x2152c6['attributes']=_0x2152c6[_0xd4fa('0x3b')][_0xd4fa('0x3c')]?_0x2152c6['attributes']:_0x4490eb[_0xd4fa('0x38')];if(!_0x21a96b['query'][_0xd4fa('0x3d')]('nolimit')){_0x2152c6[_0xd4fa('0x26')]=qs[_0xd4fa('0x26')](_0x21a96b[_0xd4fa('0x39')][_0xd4fa('0x26')]);_0x2152c6[_0xd4fa('0x25')]=qs['offset'](_0x21a96b[_0xd4fa('0x39')][_0xd4fa('0x25')]);}_0x2152c6[_0xd4fa('0x3e')]=qs[_0xd4fa('0x3f')](_0x21a96b[_0xd4fa('0x39')][_0xd4fa('0x3f')]);_0x2152c6['where']=qs[_0xd4fa('0x40')](_[_0xd4fa('0x41')](_0x21a96b[_0xd4fa('0x39')],_0x4490eb[_0xd4fa('0x40')]),_0x1ce1e3);if(_0x21a96b[_0xd4fa('0x39')]['filter']){_0x2152c6[_0xd4fa('0x42')]=_['merge'](_0x2152c6[_0xd4fa('0x42')],{'$or':_[_0xd4fa('0x34')](_0x1ce1e3,function(_0x4c806d){if(_0x4c806d['type']!=='VIRTUAL'){var _0x26772b={};_0x26772b[_0x4c806d[_0xd4fa('0x32')]]={'$like':'%'+_0x21a96b[_0xd4fa('0x39')]['filter']+'%'};return _0x26772b;}})});}_0x2152c6=_[_0xd4fa('0x43')]({},_0x2152c6,_0x21a96b[_0xd4fa('0x44')]);var _0x3551f2={'where':_0x2152c6[_0xd4fa('0x42')]};return db['MailQueue']['count'](_0x3551f2)[_0xd4fa('0x2b')](function(_0x1e0347){_0x32bfb5[_0xd4fa('0x24')]=_0x1e0347;if(_0x21a96b[_0xd4fa('0x39')][_0xd4fa('0x45')]){_0x2152c6['include']=[{'all':!![]}];}return db[_0xd4fa('0x46')][_0xd4fa('0x47')](_0x2152c6);})[_0xd4fa('0x2b')](function(_0x17d133){_0x32bfb5[_0xd4fa('0x48')]=_0x17d133;return _0x32bfb5;})[_0xd4fa('0x2b')](respondWithFilteredResult(_0x51c6df,_0x2152c6))[_0xd4fa('0x49')](handleError(_0x51c6df,null));};exports['show']=function(_0x3a0a57,_0x359c76){var _0x2b9897={'raw':!![],'where':{'id':_0x3a0a57['params']['id']}},_0x62099b={};_0x62099b[_0xd4fa('0x38')]=_[_0xd4fa('0x4a')](db[_0xd4fa('0x46')][_0xd4fa('0x35')]);_0x62099b[_0xd4fa('0x39')]=_[_0xd4fa('0x4a')](_0x3a0a57[_0xd4fa('0x39')]);_0x62099b[_0xd4fa('0x40')]=_[_0xd4fa('0x4b')](_0x62099b[_0xd4fa('0x38')],_0x62099b[_0xd4fa('0x39')]);_0x2b9897[_0xd4fa('0x3b')]=_[_0xd4fa('0x4b')](_0x62099b[_0xd4fa('0x38')],qs[_0xd4fa('0x3a')](_0x3a0a57['query'][_0xd4fa('0x3a')]));_0x2b9897[_0xd4fa('0x3b')]=_0x2b9897[_0xd4fa('0x3b')]['length']?_0x2b9897[_0xd4fa('0x3b')]:_0x62099b[_0xd4fa('0x38')];if(_0x3a0a57[_0xd4fa('0x39')]['includeAll']){_0x2b9897['include']=[{'all':!![]}];}_0x2b9897=_[_0xd4fa('0x43')]({},_0x2b9897,_0x3a0a57['options']);return db[_0xd4fa('0x46')]['find'](_0x2b9897)[_0xd4fa('0x2b')](handleEntityNotFound(_0x359c76,null))['then'](respondWithResult(_0x359c76,null))[_0xd4fa('0x49')](handleError(_0x359c76,null));};exports[_0xd4fa('0x4c')]=function(_0x46ff53,_0x30773e){return db[_0xd4fa('0x46')][_0xd4fa('0x4c')](_0x46ff53['body'],{})['then'](function(_0xa1b36f){var _0x3a0b01=_0x46ff53[_0xd4fa('0x4d')][_0xd4fa('0x2d')]({'plain':!![]});if(!_0x3a0b01)throw new Error(_0xd4fa('0x4e'));if(_0x3a0b01[_0xd4fa('0x4f')]===_0xd4fa('0x4d')){var _0x21b6a4=_0xa1b36f['get']({'plain':!![]});var _0x1dfe77=_0xd4fa('0x2e');return db[_0xd4fa('0x50')][_0xd4fa('0x51')]({'where':{'name':_0x1dfe77,'userProfileId':_0x3a0b01[_0xd4fa('0x52')]},'raw':!![]})[_0xd4fa('0x2b')](function(_0xf52d1){if(_0xf52d1&&_0xf52d1[_0xd4fa('0x53')]===0x0){return db[_0xd4fa('0x2f')][_0xd4fa('0x4c')]({'name':_0x21b6a4['name'],'resourceId':_0x21b6a4['id'],'type':_0xf52d1['name'],'sectionId':_0xf52d1['id']},{})[_0xd4fa('0x2b')](function(){return _0xa1b36f;});}else{return _0xa1b36f;}})[_0xd4fa('0x49')](function(_0x49d734){logger[_0xd4fa('0x30')](_0xd4fa('0x54'),_0x49d734);throw _0x49d734;});}return _0xa1b36f;})[_0xd4fa('0x2b')](respondWithResult(_0x30773e,0xc9))['catch'](handleError(_0x30773e,null));};exports['update']=function(_0x37b0a4,_0x3d17ba){if(_0x37b0a4[_0xd4fa('0x55')]['id']){delete _0x37b0a4[_0xd4fa('0x55')]['id'];}return db[_0xd4fa('0x46')][_0xd4fa('0x51')]({'where':{'id':_0x37b0a4[_0xd4fa('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d17ba,null))[_0xd4fa('0x2b')](saveUpdates(_0x37b0a4[_0xd4fa('0x55')],null))[_0xd4fa('0x2b')](respondWithResult(_0x3d17ba,null))[_0xd4fa('0x49')](handleError(_0x3d17ba,null));};exports['destroy']=function(_0xa81c3e,_0x291a9e){return db[_0xd4fa('0x46')][_0xd4fa('0x51')]({'where':{'id':_0xa81c3e[_0xd4fa('0x56')]['id']}})[_0xd4fa('0x2b')](handleEntityNotFound(_0x291a9e,null))[_0xd4fa('0x2b')](removeEntity(_0x291a9e,null))[_0xd4fa('0x49')](handleError(_0x291a9e,null));};exports['describe']=function(_0x49fa11,_0x24b9be){return db[_0xd4fa('0x46')][_0xd4fa('0x57')]()[_0xd4fa('0x2b')](respondWithResult(_0x24b9be,null))[_0xd4fa('0x49')](handleError(_0x24b9be,null));};exports[_0xd4fa('0x58')]=function(_0x3785aa,_0x2bfb46,_0xbfe8e9){var _0x2ee6e5={'raw':!![],'where':{}},_0x474815={},_0x2225cf;return db[_0xd4fa('0x46')]['findOne']({'where':{'id':_0x3785aa['params']['id']}})[_0xd4fa('0x2b')](handleEntityNotFound(_0x2bfb46,null))['then'](function(_0x3317b3){if(_0x3317b3){_0x2225cf=_0x3317b3['get']({'plain':!![]});_0x474815[_0xd4fa('0x38')]=_[_0xd4fa('0x4a')](db[_0xd4fa('0x59')]['rawAttributes']);_0x474815[_0xd4fa('0x39')]=_[_0xd4fa('0x4a')](_0x3785aa[_0xd4fa('0x39')]);_0x474815[_0xd4fa('0x40')]=_['intersection'](_0x474815[_0xd4fa('0x38')],_0x474815['query']);_0x2ee6e5[_0xd4fa('0x3b')]=_[_0xd4fa('0x4b')](_0x474815[_0xd4fa('0x38')],qs[_0xd4fa('0x3a')](_0x3785aa[_0xd4fa('0x39')][_0xd4fa('0x3a')]));_0x2ee6e5[_0xd4fa('0x3b')]=_0x2ee6e5['attributes'][_0xd4fa('0x3c')]?_0x2ee6e5[_0xd4fa('0x3b')]:_0x474815['model'];if(!_0x3785aa[_0xd4fa('0x39')]['hasOwnProperty'](_0xd4fa('0x5a'))){_0x2ee6e5['limit']=qs[_0xd4fa('0x26')](_0x3785aa[_0xd4fa('0x39')][_0xd4fa('0x26')]);_0x2ee6e5[_0xd4fa('0x25')]=qs[_0xd4fa('0x25')](_0x3785aa['query'][_0xd4fa('0x25')]);}_0x2ee6e5[_0xd4fa('0x3e')]=qs[_0xd4fa('0x3f')](_0x3785aa[_0xd4fa('0x39')]['sort']);_0x2ee6e5[_0xd4fa('0x42')]=qs[_0xd4fa('0x40')](_[_0xd4fa('0x41')](_0x3785aa[_0xd4fa('0x39')],_0x474815[_0xd4fa('0x40')]));_0x2ee6e5[_0xd4fa('0x42')][_0xd4fa('0x5b')]=_0x3317b3['id'];if(_0x3785aa[_0xd4fa('0x39')][_0xd4fa('0x5c')]){_0x2ee6e5[_0xd4fa('0x42')]=_[_0xd4fa('0x43')](_0x2ee6e5[_0xd4fa('0x42')],{'$or':_['map'](_0x2ee6e5['attributes'],function(_0x26de56){var _0x109b1a={};_0x109b1a[_0x26de56]={'$like':'%'+_0x3785aa['query'][_0xd4fa('0x5c')]+'%'};return _0x109b1a;})});}_0x2ee6e5=_['merge']({},_0x2ee6e5,_0x3785aa['options']);return db[_0xd4fa('0x59')]['findAll'](_0x2ee6e5);}})[_0xd4fa('0x2b')](function(_0x3a60d0){if(_0x3a60d0){return db[_0xd4fa('0x5d')][_0xd4fa('0x5e')]({'where':{'id':_[_0xd4fa('0x34')](_0x3a60d0,_0xd4fa('0x5f')),'role':_0xd4fa('0x60')},'attributes':['id',_0xd4fa('0x32'),_0xd4fa('0x61'),_0xd4fa('0x62'),_0xd4fa('0x63')]});}})[_0xd4fa('0x2b')](function(_0x2f2685){if(_0x2f2685){return{'count':_0x2f2685[_0xd4fa('0x24')],'rows':_[_0xd4fa('0x34')](_0x2f2685[_0xd4fa('0x48')],function(_0x4db827){return{'membername':_0x4db827[_0xd4fa('0x32')],'UserId':_0x4db827['id'],'queue_name':_0x2225cf['name'],'MailQueueId':_0x2225cf['id'],'interface':util[_0xd4fa('0x64')]('%s/%s','SIP',_0x4db827[_0xd4fa('0x32')]),'penalty':0x0,'paused':_0x4db827[_0xd4fa('0x61')],'createdAt':_0x4db827[_0xd4fa('0x63')],'updatedAt':_0x4db827[_0xd4fa('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd4fa('0x2b')](respondWithFilteredResult(_0x2bfb46,_0x2ee6e5))[_0xd4fa('0x49')](handleError(_0x2bfb46,null));};exports[_0xd4fa('0x65')]=function(_0x12ef81,_0x3dfad5,_0x829133){var _0x411dc0={};var _0x1f834b={};var _0x138479;var _0x100d13;return db[_0xd4fa('0x46')][_0xd4fa('0x66')]({'where':{'id':_0x12ef81[_0xd4fa('0x56')]['id']}})[_0xd4fa('0x2b')](handleEntityNotFound(_0x3dfad5,null))[_0xd4fa('0x2b')](function(_0x1a93c7){if(_0x1a93c7){_0x138479=_0x1a93c7;_0x1f834b[_0xd4fa('0x38')]=_['keys'](db['Team'][_0xd4fa('0x35')]);_0x1f834b['query']=_[_0xd4fa('0x4a')](_0x12ef81['query']);_0x1f834b[_0xd4fa('0x40')]=_[_0xd4fa('0x4b')](_0x1f834b[_0xd4fa('0x38')],_0x1f834b[_0xd4fa('0x39')]);_0x411dc0['attributes']=_['intersection'](_0x1f834b[_0xd4fa('0x38')],qs[_0xd4fa('0x3a')](_0x12ef81['query']['fields']));_0x411dc0[_0xd4fa('0x3b')]=_0x411dc0['attributes'][_0xd4fa('0x3c')]?_0x411dc0[_0xd4fa('0x3b')]:_0x1f834b[_0xd4fa('0x38')];_0x411dc0[_0xd4fa('0x3e')]=qs[_0xd4fa('0x3f')](_0x12ef81['query']['sort']);_0x411dc0[_0xd4fa('0x42')]=qs[_0xd4fa('0x40')](_[_0xd4fa('0x41')](_0x12ef81[_0xd4fa('0x39')],_0x1f834b['filters']));if(_0x12ef81[_0xd4fa('0x39')][_0xd4fa('0x5c')]){_0x411dc0['where']=_['merge'](_0x411dc0[_0xd4fa('0x42')],{'$or':_['map'](_0x411dc0[_0xd4fa('0x3b')],function(_0x446ee4){var _0x13fa0f={};_0x13fa0f[_0x446ee4]={'$like':'%'+_0x12ef81[_0xd4fa('0x39')][_0xd4fa('0x5c')]+'%'};return _0x13fa0f;})});}_0x411dc0=_[_0xd4fa('0x43')]({},_0x411dc0,_0x12ef81[_0xd4fa('0x44')]);return _0x138479['getTeams'](_0x411dc0);}})['then'](function(_0x59e20c){if(_0x59e20c){_0x100d13=_0x59e20c[_0xd4fa('0x3c')];if(!_0x12ef81[_0xd4fa('0x39')][_0xd4fa('0x3d')](_0xd4fa('0x5a'))){_0x411dc0[_0xd4fa('0x26')]=qs[_0xd4fa('0x26')](_0x12ef81['query'][_0xd4fa('0x26')]);_0x411dc0[_0xd4fa('0x25')]=qs[_0xd4fa('0x25')](_0x12ef81[_0xd4fa('0x39')]['offset']);}return _0x138479[_0xd4fa('0x65')](_0x411dc0);}})[_0xd4fa('0x2b')](function(_0x1aad01){if(_0x1aad01){return _0x1aad01?{'count':_0x100d13,'rows':_0x1aad01}:null;}})[_0xd4fa('0x2b')](respondWithResult(_0x3dfad5,null))[_0xd4fa('0x49')](handleError(_0x3dfad5,null));};exports[_0xd4fa('0x67')]=function(_0x2a283a,_0x5a0c51,_0x4287e9){var _0x254764=_0x2a283a[_0xd4fa('0x55')][_0xd4fa('0x68')];return db[_0xd4fa('0x69')][_0xd4fa('0x47')]({'where':{'id':_0x254764},'attributes':['id'],'include':[{'model':db[_0xd4fa('0x5d')],'as':_0xd4fa('0x6a'),'attributes':['id',_0xd4fa('0x32'),'online','voicePause',_0xd4fa('0x6b')],'raw':!![]}]})[_0xd4fa('0x2b')](function(_0x34c66c){if(_0x34c66c){var _0x16fc8c=_[_0xd4fa('0x6c')](_0x34c66c,function(_0x270ad5){var _0x2e5580=_0x270ad5[_0xd4fa('0x2d')]({'plain':!![]});return _0x2e5580['Agents'];});return db[_0xd4fa('0x46')][_0xd4fa('0x51')]({'where':{'id':_0x2a283a[_0xd4fa('0x56')]['id']}})['then'](function(_0x369ce3){return db['sequelize'][_0xd4fa('0x6d')](function(_0x2329a7){return _0x369ce3[_0xd4fa('0x67')](_0x254764,{'transaction':_0x2329a7})[_0xd4fa('0x2b')](function(){return BPromise['each'](_0x16fc8c,function(_0x503f5e){return db[_0xd4fa('0x59')][_0xd4fa('0x6e')]({'where':{'UserId':_0x503f5e['id'],'MailQueueId':_0x2a283a['params']['id']},'transaction':_0x2329a7});});})[_0xd4fa('0x2b')](function(){_0x16fc8c[_0xd4fa('0x6f')](function(_0xb6ad46){socket[_0xd4fa('0x70')]('userMailQueue:save',{'UserId':_0xb6ad46['id'],'MailQueueId':_0x369ce3['id']});});});});});}})[_0xd4fa('0x2b')](respondWithStatusCode(_0x5a0c51,null))[_0xd4fa('0x49')](handleError(_0x5a0c51,null));};exports[_0xd4fa('0x71')]=function(_0x21453d,_0x2e258a,_0x58836f){return db['Team'][_0xd4fa('0x47')]({'where':{'id':_0x21453d[_0xd4fa('0x39')][_0xd4fa('0x68')]},'attributes':['id'],'include':[{'model':db[_0xd4fa('0x5d')],'as':_0xd4fa('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2e258a,null))['then'](function(_0x55ea0f){var _0x2fdb65=_[_0xd4fa('0x34')](_0x55ea0f,'id');var _0x270ef5=[];var _0xfb935a=[];var _0x47395b=squel['select']();_0x47395b[_0xd4fa('0x72')](_0xd4fa('0x73'))['from']('team_has_mail_queues','tq')['join']('user_has_teams','ut',_0xd4fa('0x74'))['where'](_0xd4fa('0x75'),_0x21453d[_0xd4fa('0x56')]['id']);for(var _0x6d081f=0x0;_0x6d081f<_0x55ea0f[_0xd4fa('0x3c')];_0x6d081f+=0x1){let _0x4c2301=_0x55ea0f[_0x6d081f];for(var _0x53b025=0x0;_0x53b025<_0x4c2301[_0xd4fa('0x6a')][_0xd4fa('0x3c')];_0x53b025+=0x1){let _0x432738=_0x4c2301['Agents'][_0x53b025];var _0x52fa77=_0x47395b['clone']();_0x52fa77[_0xd4fa('0x42')](_0xd4fa('0x76'),_0x432738['id']);_0xfb935a[_0xd4fa('0x77')](db['sequelize'][_0xd4fa('0x39')](_0x52fa77[_0xd4fa('0x78')](),{'type':db['sequelize'][_0xd4fa('0x79')]['SELECT']})[_0xd4fa('0x2b')](function(_0x8e44bd){if(_0x8e44bd[_0xd4fa('0x3c')]===0x1){return _0x432738['id'];}else{var _0x3f43d7=_[_0xd4fa('0x7a')](_[_0xd4fa('0x34')](_0x8e44bd,_0xd4fa('0x7b')),function(_0x10fa7f){return _[_0xd4fa('0x7c')](_0x2fdb65,_0x10fa7f);});if(_0x3f43d7){return _0x432738['id'];}}}));}}return BPromise[_0xd4fa('0x7d')](_0xfb935a)[_0xd4fa('0x2b')](function(_0x4674d5){_0x270ef5=_(_0x270ef5)['union'](_0x4674d5)['compact']()[_0xd4fa('0x7e')]();return db[_0xd4fa('0x46')]['find']({'where':{'id':_0x21453d[_0xd4fa('0x56')]['id']}})[_0xd4fa('0x2b')](function(_0x2a46a8){return db[_0xd4fa('0x7f')][_0xd4fa('0x6d')](function(_0x3deea1){return _0x2a46a8['removeTeams'](_0x21453d[_0xd4fa('0x39')][_0xd4fa('0x68')],{'transaction':_0x3deea1})['then'](function(){if(!_['isEmpty'](_0x270ef5)){return _0x2a46a8[_0xd4fa('0x80')](_0x270ef5,{'transaction':_0x3deea1});}})[_0xd4fa('0x2b')](function(){_0x270ef5['forEach'](function(_0x38933b){socket['emit'](_0xd4fa('0x81'),{'UserId':_0x38933b,'MailQueueId':_0x2a46a8['id']});});});});});});})[_0xd4fa('0x2b')](respondWithStatusCode(_0x2e258a,null))[_0xd4fa('0x49')](handleError(_0x2e258a,null));};exports[_0xd4fa('0x82')]=function(_0x184df0,_0x1a3458,_0x4c8c5d){return db[_0xd4fa('0x46')][_0xd4fa('0x51')]({'where':{'id':_0x184df0['params']['id']}})[_0xd4fa('0x2b')](handleEntityNotFound(_0x1a3458,null))['then'](function(_0xb22dff){if(_0xb22dff){return _0xb22dff[_0xd4fa('0x82')](_0x184df0['body'][_0xd4fa('0x68')],_[_0xd4fa('0x83')](_0x184df0['body'],[_0xd4fa('0x68'),'id'])||{})['spread'](function(_0x223580){for(var _0x17aede=0x0;_0x17aede<_0x184df0[_0xd4fa('0x55')]['ids'][_0xd4fa('0x3c')];_0x17aede+=0x1){socket[_0xd4fa('0x70')](_0xd4fa('0x84'),{'UserId':_0x184df0['body'][_0xd4fa('0x68')][_0x17aede],'MailQueueId':_0x184df0[_0xd4fa('0x56')]['id']});}return _0x223580;});}})[_0xd4fa('0x2b')](respondWithResult(_0x1a3458,null))[_0xd4fa('0x49')](handleError(_0x1a3458,null));};exports[_0xd4fa('0x80')]=function(_0x1f109e,_0x2be57d,_0x4f0016){return db[_0xd4fa('0x46')][_0xd4fa('0x51')]({'where':{'id':_0x1f109e['params']['id']}})[_0xd4fa('0x2b')](handleEntityNotFound(_0x2be57d,null))[_0xd4fa('0x2b')](function(_0x29985c){if(_0x29985c){return _0x29985c['removeAgents'](_0x1f109e[_0xd4fa('0x39')][_0xd4fa('0x68')])[_0xd4fa('0x2b')](function(){if(_[_0xd4fa('0x85')](_0x1f109e[_0xd4fa('0x39')][_0xd4fa('0x68')])){for(var _0x261c6c=0x0;_0x261c6c<_0x1f109e[_0xd4fa('0x39')]['ids'][_0xd4fa('0x3c')];_0x261c6c+=0x1){socket[_0xd4fa('0x70')](_0xd4fa('0x81'),{'UserId':Number(_0x1f109e[_0xd4fa('0x39')]['ids'][_0x261c6c]),'MailQueueId':Number(_0x1f109e[_0xd4fa('0x56')]['id'])});}}else{socket[_0xd4fa('0x70')]('userMailQueue:remove',{'UserId':Number(_0x1f109e['query'][_0xd4fa('0x68')]),'MailQueueId':Number(_0x1f109e[_0xd4fa('0x56')]['id'])});}});}})[_0xd4fa('0x2b')](respondWithStatusCode(_0x2be57d,null))[_0xd4fa('0x49')](handleError(_0x2be57d,null));};exports[_0xd4fa('0x86')]=function(_0xd4e138,_0x10e150,_0x27e5cd){var _0x286592={};var _0xc80359={};var _0x4efeb4;var _0x508ad2;return db[_0xd4fa('0x46')]['findOne']({'where':{'id':_0xd4e138[_0xd4fa('0x56')]['id']}})[_0xd4fa('0x2b')](handleEntityNotFound(_0x10e150,null))[_0xd4fa('0x2b')](function(_0x36aff2){if(_0x36aff2){_0x4efeb4=_0x36aff2;_0xc80359[_0xd4fa('0x38')]=_[_0xd4fa('0x4a')](db[_0xd4fa('0x5d')][_0xd4fa('0x35')]);_0xc80359[_0xd4fa('0x39')]=_[_0xd4fa('0x4a')](_0xd4e138[_0xd4fa('0x39')]);_0xc80359[_0xd4fa('0x40')]=_[_0xd4fa('0x4b')](_0xc80359['model'],_0xc80359[_0xd4fa('0x39')]);_0x286592[_0xd4fa('0x3b')]=_['intersection'](_0xc80359[_0xd4fa('0x38')],qs[_0xd4fa('0x3a')](_0xd4e138['query'][_0xd4fa('0x3a')]));_0x286592[_0xd4fa('0x3b')]=_0x286592[_0xd4fa('0x3b')][_0xd4fa('0x3c')]?_0x286592['attributes']:_0xc80359[_0xd4fa('0x38')];_0x286592[_0xd4fa('0x3e')]=qs[_0xd4fa('0x3f')](_0xd4e138[_0xd4fa('0x39')]['sort']);_0x286592[_0xd4fa('0x42')]=qs[_0xd4fa('0x40')](_[_0xd4fa('0x41')](_0xd4e138[_0xd4fa('0x39')],_0xc80359['filters']));if(_0xd4e138['query'][_0xd4fa('0x5c')]){_0x286592['where']=_[_0xd4fa('0x43')](_0x286592['where'],{'$or':_[_0xd4fa('0x34')](_0x286592[_0xd4fa('0x3b')],function(_0x1e66ed){var _0x3e80cb={};_0x3e80cb[_0x1e66ed]={'$like':'%'+_0xd4e138['query'][_0xd4fa('0x5c')]+'%'};return _0x3e80cb;})});}_0x286592=_[_0xd4fa('0x43')]({},_0x286592,_0xd4e138[_0xd4fa('0x44')]);return _0x4efeb4[_0xd4fa('0x86')](_0x286592);}})[_0xd4fa('0x2b')](function(_0x32eed9){if(_0x32eed9){_0x508ad2=_0x32eed9['length'];if(!_0xd4e138[_0xd4fa('0x39')][_0xd4fa('0x3d')](_0xd4fa('0x5a'))){_0x286592[_0xd4fa('0x26')]=qs[_0xd4fa('0x26')](_0xd4e138[_0xd4fa('0x39')]['limit']);_0x286592['offset']=qs['offset'](_0xd4e138[_0xd4fa('0x39')][_0xd4fa('0x25')]);}return _0x4efeb4[_0xd4fa('0x86')](_0x286592);}})[_0xd4fa('0x2b')](function(_0x387b8f){if(_0x387b8f){return _0x387b8f?{'count':_0x508ad2,'rows':_0x387b8f}:null;}})[_0xd4fa('0x2b')](respondWithResult(_0x10e150,null))['catch'](handleError(_0x10e150,null));}; \ No newline at end of file +var _0xa1aa=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','stack','name','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','findAll','rows','params','keys','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','mailPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','online','voicePause','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','SELECT','every','TeamId','includes','value','removeTeams','ids','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','getAgents','pick'];(function(_0x1a776e,_0x413797){var _0x1bdd49=function(_0x5d0a6f){while(--_0x5d0a6f){_0x1a776e['push'](_0x1a776e['shift']());}};_0x1bdd49(++_0x413797);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x4f71be,_0x287d60){_0x4f71be=_0x4f71be-0x0;var _0x387505=_0xa1aa[_0x4f71be];return _0x387505;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaa1a('0x0'));var rimraf=require(_0xaa1a('0x1'));var zipdir=require(_0xaa1a('0x2'));var jsonpatch=require(_0xaa1a('0x3'));var rp=require(_0xaa1a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaa1a('0x5'));var util=require(_0xaa1a('0x6'));var path=require('path');var sox=require(_0xaa1a('0x7'));var csv=require(_0xaa1a('0x8'));var ejs=require(_0xaa1a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaa1a('0xa'));var crypto=require('crypto');var jsforce=require(_0xaa1a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaa1a('0x8'));var querystring=require(_0xaa1a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa1a('0xd'));var qs=require(_0xaa1a('0xe'));var as=require(_0xaa1a('0xf'));var hardwareService=require(_0xaa1a('0x10'));var logger=require('../../config/logger')(_0xaa1a('0x11'));var utils=require(_0xaa1a('0x12'));var config=require(_0xaa1a('0x13'));var licenseUtil=require(_0xaa1a('0x14'));var db=require(_0xaa1a('0x15'))['db'];config[_0xaa1a('0x16')]=_[_0xaa1a('0x17')](config[_0xaa1a('0x16')],{'host':_0xaa1a('0x18'),'port':0x18eb});var socket=require(_0xaa1a('0x19'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xaa1a('0x1a')](socket);function respondWithStatusCode(_0x3a577f,_0x268f91){_0x268f91=_0x268f91||0xcc;return function(_0x14f6b5){if(_0x14f6b5){return _0x3a577f[_0xaa1a('0x1b')](_0x268f91);}return _0x3a577f['status'](_0x268f91)[_0xaa1a('0x1c')]();};}function respondWithResult(_0x480a27,_0x12153c){_0x12153c=_0x12153c||0xc8;return function(_0x384eb3){if(_0x384eb3){return _0x480a27[_0xaa1a('0x1d')](_0x12153c)[_0xaa1a('0x1e')](_0x384eb3);}};}function respondWithFilteredResult(_0x5ba030,_0x521a8e){return function(_0x1b3174){if(_0x1b3174){var _0xcb3609=_0x1b3174[_0xaa1a('0x1f')],_0x56ff91=_0x521a8e[_0xaa1a('0x20')],_0x33f564=_0x521a8e[_0xaa1a('0x20')]+_0x521a8e[_0xaa1a('0x21')],_0x32e118;if(_0x33f564>=_0xcb3609){_0x33f564=_0xcb3609;_0x32e118=0xc8;}else{_0x32e118=0xce;}_0x5ba030['status'](_0x32e118);return _0x5ba030[_0xaa1a('0x22')](_0xaa1a('0x23'),_0x56ff91+'-'+_0x33f564+'/'+_0xcb3609)[_0xaa1a('0x1e')](_0x1b3174);}return null;};}function patchUpdates(_0x3298ed){return function(_0x2c0238){try{jsonpatch[_0xaa1a('0x24')](_0x2c0238,_0x3298ed,!![]);}catch(_0x21019a){return BPromise['reject'](_0x21019a);}return _0x2c0238[_0xaa1a('0x25')]();};}function saveUpdates(_0x282f07,_0x1ac174){return function(_0x506db4){if(_0x506db4){return _0x506db4[_0xaa1a('0x26')](_0x282f07)[_0xaa1a('0x27')](function(_0x583c90){return _0x583c90;});}return null;};}function removeEntity(_0x4accdf,_0x64fc15){return function(_0x3b0eaa){if(_0x3b0eaa){return _0x3b0eaa[_0xaa1a('0x28')]()[_0xaa1a('0x27')](function(){var _0x582843=_0x3b0eaa[_0xaa1a('0x29')]({'plain':!![]});var _0x32f406='MailQueues';return db[_0xaa1a('0x2a')][_0xaa1a('0x28')]({'where':{'type':_0x32f406,'resourceId':_0x582843['id']}})[_0xaa1a('0x27')](function(){return _0x3b0eaa;});})['then'](function(){_0x4accdf[_0xaa1a('0x1d')](0xcc)[_0xaa1a('0x1c')]();});}};}function handleEntityNotFound(_0x1b1b67,_0x139f53){return function(_0x3f29a8){if(!_0x3f29a8){_0x1b1b67[_0xaa1a('0x1b')](0x194);}return _0x3f29a8;};}function handleError(_0x26fdea,_0x5291be){_0x5291be=_0x5291be||0x1f4;return function(_0x4c495f){logger['error'](_0x4c495f[_0xaa1a('0x2b')]);if(_0x4c495f[_0xaa1a('0x2c')]){delete _0x4c495f[_0xaa1a('0x2c')];}_0x26fdea[_0xaa1a('0x1d')](_0x5291be)['send'](_0x4c495f);};}exports[_0xaa1a('0x2d')]=function(_0x22ba1d,_0x2767be){var _0x22b4e3={},_0x13afce={},_0xd3390e={'count':0x0,'rows':[]};var _0x27047b=_[_0xaa1a('0x2e')](db[_0xaa1a('0x2f')][_0xaa1a('0x30')],function(_0x1b874f){return{'name':_0x1b874f[_0xaa1a('0x31')],'type':_0x1b874f[_0xaa1a('0x32')][_0xaa1a('0x33')]};});_0x13afce[_0xaa1a('0x34')]=_['map'](_0x27047b,'name');_0x13afce[_0xaa1a('0x35')]=_['keys'](_0x22ba1d[_0xaa1a('0x35')]);_0x13afce[_0xaa1a('0x36')]=_[_0xaa1a('0x37')](_0x13afce[_0xaa1a('0x34')],_0x13afce[_0xaa1a('0x35')]);_0x22b4e3[_0xaa1a('0x38')]=_['intersection'](_0x13afce[_0xaa1a('0x34')],qs[_0xaa1a('0x39')](_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x39')]));_0x22b4e3[_0xaa1a('0x38')]=_0x22b4e3[_0xaa1a('0x38')][_0xaa1a('0x3a')]?_0x22b4e3[_0xaa1a('0x38')]:_0x13afce['model'];if(!_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x3b')](_0xaa1a('0x3c'))){_0x22b4e3[_0xaa1a('0x21')]=qs[_0xaa1a('0x21')](_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x21')]);_0x22b4e3[_0xaa1a('0x20')]=qs[_0xaa1a('0x20')](_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x20')]);}_0x22b4e3[_0xaa1a('0x3d')]=qs[_0xaa1a('0x3e')](_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x3e')]);_0x22b4e3[_0xaa1a('0x3f')]=qs['filters'](_['pick'](_0x22ba1d[_0xaa1a('0x35')],_0x13afce[_0xaa1a('0x36')]),_0x27047b);if(_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x40')]){_0x22b4e3[_0xaa1a('0x3f')]=_[_0xaa1a('0x41')](_0x22b4e3['where'],{'$or':_[_0xaa1a('0x2e')](_0x27047b,function(_0x529e82){if(_0x529e82[_0xaa1a('0x32')]!=='VIRTUAL'){var _0x31c95a={};_0x31c95a[_0x529e82[_0xaa1a('0x2c')]]={'$like':'%'+_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x40')]+'%'};return _0x31c95a;}})});}_0x22b4e3=_['merge']({},_0x22b4e3,_0x22ba1d['options']);var _0x18e373={'where':_0x22b4e3[_0xaa1a('0x3f')]};return db['MailQueue'][_0xaa1a('0x1f')](_0x18e373)[_0xaa1a('0x27')](function(_0x4fbd5d){_0xd3390e['count']=_0x4fbd5d;if(_0x22ba1d[_0xaa1a('0x35')]['includeAll']){_0x22b4e3[_0xaa1a('0x42')]=[{'all':!![]}];}return db[_0xaa1a('0x2f')][_0xaa1a('0x43')](_0x22b4e3);})[_0xaa1a('0x27')](function(_0x253998){_0xd3390e[_0xaa1a('0x44')]=_0x253998;return _0xd3390e;})['then'](respondWithFilteredResult(_0x2767be,_0x22b4e3))['catch'](handleError(_0x2767be,null));};exports['show']=function(_0x5ce7f1,_0x27fcfd){var _0x4e4f67={'raw':!![],'where':{'id':_0x5ce7f1[_0xaa1a('0x45')]['id']}},_0x2ca78b={};_0x2ca78b[_0xaa1a('0x34')]=_[_0xaa1a('0x46')](db[_0xaa1a('0x2f')][_0xaa1a('0x30')]);_0x2ca78b[_0xaa1a('0x35')]=_[_0xaa1a('0x46')](_0x5ce7f1[_0xaa1a('0x35')]);_0x2ca78b[_0xaa1a('0x36')]=_[_0xaa1a('0x37')](_0x2ca78b['model'],_0x2ca78b[_0xaa1a('0x35')]);_0x4e4f67[_0xaa1a('0x38')]=_[_0xaa1a('0x37')](_0x2ca78b['model'],qs[_0xaa1a('0x39')](_0x5ce7f1['query'][_0xaa1a('0x39')]));_0x4e4f67[_0xaa1a('0x38')]=_0x4e4f67[_0xaa1a('0x38')][_0xaa1a('0x3a')]?_0x4e4f67['attributes']:_0x2ca78b[_0xaa1a('0x34')];if(_0x5ce7f1[_0xaa1a('0x35')][_0xaa1a('0x47')]){_0x4e4f67[_0xaa1a('0x42')]=[{'all':!![]}];}_0x4e4f67=_[_0xaa1a('0x41')]({},_0x4e4f67,_0x5ce7f1[_0xaa1a('0x48')]);return db[_0xaa1a('0x2f')][_0xaa1a('0x49')](_0x4e4f67)[_0xaa1a('0x27')](handleEntityNotFound(_0x27fcfd,null))['then'](respondWithResult(_0x27fcfd,null))[_0xaa1a('0x4a')](handleError(_0x27fcfd,null));};exports[_0xaa1a('0x4b')]=function(_0x13f32e,_0x955779){return db[_0xaa1a('0x2f')][_0xaa1a('0x4b')](_0x13f32e[_0xaa1a('0x4c')],{})[_0xaa1a('0x27')](function(_0x2da50f){var _0x31c3b3=_0x13f32e[_0xaa1a('0x4d')][_0xaa1a('0x29')]({'plain':!![]});if(!_0x31c3b3)throw new Error(_0xaa1a('0x4e'));if(_0x31c3b3[_0xaa1a('0x4f')]===_0xaa1a('0x4d')){var _0x42c5e5=_0x2da50f[_0xaa1a('0x29')]({'plain':!![]});var _0xa23e7f='MailQueues';return db[_0xaa1a('0x50')][_0xaa1a('0x49')]({'where':{'name':_0xa23e7f,'userProfileId':_0x31c3b3[_0xaa1a('0x51')]},'raw':!![]})['then'](function(_0x56a465){if(_0x56a465&&_0x56a465[_0xaa1a('0x52')]===0x0){return db['UserProfileResource'][_0xaa1a('0x4b')]({'name':_0x42c5e5['name'],'resourceId':_0x42c5e5['id'],'type':_0x56a465[_0xaa1a('0x2c')],'sectionId':_0x56a465['id']},{})['then'](function(){return _0x2da50f;});}else{return _0x2da50f;}})[_0xaa1a('0x4a')](function(_0x453243){logger[_0xaa1a('0x53')](_0xaa1a('0x54'),_0x453243);throw _0x453243;});}return _0x2da50f;})[_0xaa1a('0x27')](respondWithResult(_0x955779,0xc9))['catch'](handleError(_0x955779,null));};exports['update']=function(_0x4cd226,_0x2ce080){if(_0x4cd226[_0xaa1a('0x4c')]['id']){delete _0x4cd226[_0xaa1a('0x4c')]['id'];}return db['MailQueue'][_0xaa1a('0x49')]({'where':{'id':_0x4cd226[_0xaa1a('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ce080,null))['then'](saveUpdates(_0x4cd226[_0xaa1a('0x4c')],null))[_0xaa1a('0x27')](respondWithResult(_0x2ce080,null))[_0xaa1a('0x4a')](handleError(_0x2ce080,null));};exports[_0xaa1a('0x28')]=function(_0x321b28,_0x2e5e6a){return db[_0xaa1a('0x2f')][_0xaa1a('0x49')]({'where':{'id':_0x321b28[_0xaa1a('0x45')]['id']}})[_0xaa1a('0x27')](handleEntityNotFound(_0x2e5e6a,null))[_0xaa1a('0x27')](removeEntity(_0x2e5e6a,null))[_0xaa1a('0x4a')](handleError(_0x2e5e6a,null));};exports['describe']=function(_0xda7d2e,_0x56e9c9){return db[_0xaa1a('0x2f')][_0xaa1a('0x55')]()['then'](respondWithResult(_0x56e9c9,null))['catch'](handleError(_0x56e9c9,null));};exports[_0xaa1a('0x56')]=function(_0x5e692d,_0xdbe347,_0x38eba5){var _0x39a663={'raw':!![],'where':{}},_0x38fb88={},_0x170669;return db[_0xaa1a('0x2f')][_0xaa1a('0x57')]({'where':{'id':_0x5e692d[_0xaa1a('0x45')]['id']}})['then'](handleEntityNotFound(_0xdbe347,null))[_0xaa1a('0x27')](function(_0x170f91){if(_0x170f91){_0x170669=_0x170f91['get']({'plain':!![]});_0x38fb88[_0xaa1a('0x34')]=_[_0xaa1a('0x46')](db[_0xaa1a('0x58')][_0xaa1a('0x30')]);_0x38fb88[_0xaa1a('0x35')]=_[_0xaa1a('0x46')](_0x5e692d['query']);_0x38fb88[_0xaa1a('0x36')]=_[_0xaa1a('0x37')](_0x38fb88[_0xaa1a('0x34')],_0x38fb88['query']);_0x39a663['attributes']=_[_0xaa1a('0x37')](_0x38fb88[_0xaa1a('0x34')],qs[_0xaa1a('0x39')](_0x5e692d['query']['fields']));_0x39a663[_0xaa1a('0x38')]=_0x39a663[_0xaa1a('0x38')]['length']?_0x39a663[_0xaa1a('0x38')]:_0x38fb88[_0xaa1a('0x34')];if(!_0x5e692d[_0xaa1a('0x35')][_0xaa1a('0x3b')](_0xaa1a('0x3c'))){_0x39a663[_0xaa1a('0x21')]=qs['limit'](_0x5e692d[_0xaa1a('0x35')][_0xaa1a('0x21')]);_0x39a663[_0xaa1a('0x20')]=qs[_0xaa1a('0x20')](_0x5e692d[_0xaa1a('0x35')][_0xaa1a('0x20')]);}_0x39a663[_0xaa1a('0x3d')]=qs['sort'](_0x5e692d[_0xaa1a('0x35')]['sort']);_0x39a663[_0xaa1a('0x3f')]=qs[_0xaa1a('0x36')](_['pick'](_0x5e692d[_0xaa1a('0x35')],_0x38fb88[_0xaa1a('0x36')]));_0x39a663[_0xaa1a('0x3f')][_0xaa1a('0x59')]=_0x170f91['id'];if(_0x5e692d[_0xaa1a('0x35')][_0xaa1a('0x40')]){_0x39a663[_0xaa1a('0x3f')]=_[_0xaa1a('0x41')](_0x39a663[_0xaa1a('0x3f')],{'$or':_[_0xaa1a('0x2e')](_0x39a663[_0xaa1a('0x38')],function(_0x954f13){var _0xd6f995={};_0xd6f995[_0x954f13]={'$like':'%'+_0x5e692d[_0xaa1a('0x35')][_0xaa1a('0x40')]+'%'};return _0xd6f995;})});}_0x39a663=_['merge']({},_0x39a663,_0x5e692d['options']);return db[_0xaa1a('0x58')][_0xaa1a('0x43')](_0x39a663);}})[_0xaa1a('0x27')](function(_0x3f48b2){if(_0x3f48b2){return db[_0xaa1a('0x5a')][_0xaa1a('0x5b')]({'where':{'id':_[_0xaa1a('0x2e')](_0x3f48b2,_0xaa1a('0x5c')),'role':'agent'},'attributes':['id',_0xaa1a('0x2c'),_0xaa1a('0x5d'),'updatedAt','createdAt']});}})[_0xaa1a('0x27')](function(_0x42f479){if(_0x42f479){return{'count':_0x42f479[_0xaa1a('0x1f')],'rows':_[_0xaa1a('0x2e')](_0x42f479[_0xaa1a('0x44')],function(_0x3966e8){return{'membername':_0x3966e8[_0xaa1a('0x2c')],'UserId':_0x3966e8['id'],'queue_name':_0x170669[_0xaa1a('0x2c')],'MailQueueId':_0x170669['id'],'interface':util[_0xaa1a('0x5e')](_0xaa1a('0x5f'),_0xaa1a('0x60'),_0x3966e8[_0xaa1a('0x2c')]),'penalty':0x0,'paused':_0x3966e8[_0xaa1a('0x5d')],'createdAt':_0x3966e8[_0xaa1a('0x61')],'updatedAt':_0x3966e8[_0xaa1a('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaa1a('0x27')](respondWithFilteredResult(_0xdbe347,_0x39a663))[_0xaa1a('0x4a')](handleError(_0xdbe347,null));};exports[_0xaa1a('0x63')]=function(_0x1ae2c3,_0x5ef63e,_0xd65317){var _0x160e71={};var _0x2e46ab={};var _0x172290;var _0x5ca901;return db[_0xaa1a('0x2f')][_0xaa1a('0x57')]({'where':{'id':_0x1ae2c3[_0xaa1a('0x45')]['id']}})[_0xaa1a('0x27')](handleEntityNotFound(_0x5ef63e,null))[_0xaa1a('0x27')](function(_0xbf7190){if(_0xbf7190){_0x172290=_0xbf7190;_0x2e46ab[_0xaa1a('0x34')]=_[_0xaa1a('0x46')](db[_0xaa1a('0x64')]['rawAttributes']);_0x2e46ab[_0xaa1a('0x35')]=_[_0xaa1a('0x46')](_0x1ae2c3['query']);_0x2e46ab['filters']=_[_0xaa1a('0x37')](_0x2e46ab[_0xaa1a('0x34')],_0x2e46ab[_0xaa1a('0x35')]);_0x160e71[_0xaa1a('0x38')]=_[_0xaa1a('0x37')](_0x2e46ab[_0xaa1a('0x34')],qs[_0xaa1a('0x39')](_0x1ae2c3['query'][_0xaa1a('0x39')]));_0x160e71['attributes']=_0x160e71[_0xaa1a('0x38')][_0xaa1a('0x3a')]?_0x160e71['attributes']:_0x2e46ab['model'];_0x160e71['order']=qs[_0xaa1a('0x3e')](_0x1ae2c3['query'][_0xaa1a('0x3e')]);_0x160e71['where']=qs[_0xaa1a('0x36')](_['pick'](_0x1ae2c3[_0xaa1a('0x35')],_0x2e46ab[_0xaa1a('0x36')]));if(_0x1ae2c3[_0xaa1a('0x35')]['filter']){_0x160e71['where']=_[_0xaa1a('0x41')](_0x160e71[_0xaa1a('0x3f')],{'$or':_[_0xaa1a('0x2e')](_0x160e71[_0xaa1a('0x38')],function(_0x31786a){var _0x21d6b3={};_0x21d6b3[_0x31786a]={'$like':'%'+_0x1ae2c3[_0xaa1a('0x35')][_0xaa1a('0x40')]+'%'};return _0x21d6b3;})});}_0x160e71=_[_0xaa1a('0x41')]({},_0x160e71,_0x1ae2c3[_0xaa1a('0x48')]);return _0x172290[_0xaa1a('0x63')](_0x160e71);}})['then'](function(_0x32bff4){if(_0x32bff4){_0x5ca901=_0x32bff4[_0xaa1a('0x3a')];if(!_0x1ae2c3[_0xaa1a('0x35')][_0xaa1a('0x3b')](_0xaa1a('0x3c'))){_0x160e71['limit']=qs[_0xaa1a('0x21')](_0x1ae2c3[_0xaa1a('0x35')]['limit']);_0x160e71['offset']=qs['offset'](_0x1ae2c3[_0xaa1a('0x35')][_0xaa1a('0x20')]);}return _0x172290[_0xaa1a('0x63')](_0x160e71);}})['then'](function(_0x23f195){if(_0x23f195){return _0x23f195?{'count':_0x5ca901,'rows':_0x23f195}:null;}})['then'](respondWithResult(_0x5ef63e,null))['catch'](handleError(_0x5ef63e,null));};exports[_0xaa1a('0x65')]=function(_0xd06d62,_0x163c29,_0x11ff88){var _0x5ed542=_0xd06d62[_0xaa1a('0x4c')]['ids'];return db[_0xaa1a('0x64')][_0xaa1a('0x43')]({'where':{'id':_0x5ed542},'attributes':['id'],'include':[{'model':db[_0xaa1a('0x5a')],'as':'Agents','attributes':['id',_0xaa1a('0x2c'),_0xaa1a('0x66'),_0xaa1a('0x67'),'interface'],'raw':!![]}]})['then'](function(_0x561b81){if(_0x561b81){var _0x3ced80=_[_0xaa1a('0x68')](_0x561b81,function(_0x454860){var _0x8f7837=_0x454860[_0xaa1a('0x29')]({'plain':!![]});return _0x8f7837[_0xaa1a('0x69')];});return db[_0xaa1a('0x2f')]['find']({'where':{'id':_0xd06d62[_0xaa1a('0x45')]['id']}})[_0xaa1a('0x27')](function(_0x230470){return db[_0xaa1a('0x6a')][_0xaa1a('0x6b')](function(_0x18319c){return _0x230470['addTeams'](_0x5ed542,{'transaction':_0x18319c})['then'](function(){return BPromise['each'](_0x3ced80,function(_0x26ad59){return db[_0xaa1a('0x58')][_0xaa1a('0x6c')]({'where':{'UserId':_0x26ad59['id'],'MailQueueId':_0xd06d62[_0xaa1a('0x45')]['id']},'transaction':_0x18319c});});})[_0xaa1a('0x27')](function(){_0x3ced80[_0xaa1a('0x6d')](function(_0x2cac45){socket[_0xaa1a('0x6e')]('userMailQueue:save',{'UserId':_0x2cac45['id'],'MailQueueId':_0x230470['id']});});});});});}})[_0xaa1a('0x27')](respondWithStatusCode(_0x163c29,null))[_0xaa1a('0x4a')](handleError(_0x163c29,null));};exports['removeTeams']=function(_0x2b6224,_0x456bed,_0x984c47){return db['Team'][_0xaa1a('0x43')]({'where':{'id':_0x2b6224['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xaa1a('0x5a')],'as':_0xaa1a('0x69'),'attributes':['id'],'raw':!![]}]})[_0xaa1a('0x27')](handleEntityNotFound(_0x456bed,null))[_0xaa1a('0x27')](function(_0x4265c3){var _0x19f8fe=_[_0xaa1a('0x2e')](_0x4265c3,'id');var _0x5eaea4=[];var _0x56ed8b=[];var _0x3fcead=squel[_0xaa1a('0x6f')]();_0x3fcead['field'](_0xaa1a('0x70'))[_0xaa1a('0x71')](_0xaa1a('0x72'),'tq')[_0xaa1a('0x73')](_0xaa1a('0x74'),'ut',_0xaa1a('0x75'))[_0xaa1a('0x3f')](_0xaa1a('0x76'),_0x2b6224[_0xaa1a('0x45')]['id']);for(var _0x2d8990=0x0;_0x2d8990<_0x4265c3[_0xaa1a('0x3a')];_0x2d8990+=0x1){let _0x4a3349=_0x4265c3[_0x2d8990];for(var _0x1d0493=0x0;_0x1d0493<_0x4a3349[_0xaa1a('0x69')][_0xaa1a('0x3a')];_0x1d0493+=0x1){let _0x3e89a4=_0x4a3349[_0xaa1a('0x69')][_0x1d0493];var _0x4389fb=_0x3fcead[_0xaa1a('0x77')]();_0x4389fb[_0xaa1a('0x3f')]('ut.UserId\x20=\x20?',_0x3e89a4['id']);_0x56ed8b['push'](db[_0xaa1a('0x6a')]['query'](_0x4389fb[_0xaa1a('0x78')](),{'type':db[_0xaa1a('0x6a')]['QueryTypes'][_0xaa1a('0x79')]})[_0xaa1a('0x27')](function(_0x39325b){if(_0x39325b[_0xaa1a('0x3a')]===0x1){return _0x3e89a4['id'];}else{var _0x3791c9=_[_0xaa1a('0x7a')](_[_0xaa1a('0x2e')](_0x39325b,_0xaa1a('0x7b')),function(_0x3b19f0){return _[_0xaa1a('0x7c')](_0x19f8fe,_0x3b19f0);});if(_0x3791c9){return _0x3e89a4['id'];}}}));}}return BPromise['all'](_0x56ed8b)[_0xaa1a('0x27')](function(_0x165f50){_0x5eaea4=_(_0x5eaea4)['union'](_0x165f50)['compact']()[_0xaa1a('0x7d')]();return db['MailQueue'][_0xaa1a('0x49')]({'where':{'id':_0x2b6224['params']['id']}})['then'](function(_0x35a8ea){return db['sequelize']['transaction'](function(_0x21789a){return _0x35a8ea[_0xaa1a('0x7e')](_0x2b6224[_0xaa1a('0x35')][_0xaa1a('0x7f')],{'transaction':_0x21789a})[_0xaa1a('0x27')](function(){if(!_[_0xaa1a('0x80')](_0x5eaea4)){return _0x35a8ea[_0xaa1a('0x81')](_0x5eaea4,{'transaction':_0x21789a});}})[_0xaa1a('0x27')](function(){_0x5eaea4[_0xaa1a('0x6d')](function(_0x1d6984){socket[_0xaa1a('0x6e')](_0xaa1a('0x82'),{'UserId':_0x1d6984,'MailQueueId':_0x35a8ea['id']});});});});});});})[_0xaa1a('0x27')](respondWithStatusCode(_0x456bed,null))[_0xaa1a('0x4a')](handleError(_0x456bed,null));};exports[_0xaa1a('0x83')]=function(_0x4e86a7,_0x334b9c,_0x2ea85c){return db[_0xaa1a('0x2f')][_0xaa1a('0x49')]({'where':{'id':_0x4e86a7[_0xaa1a('0x45')]['id']}})['then'](handleEntityNotFound(_0x334b9c,null))[_0xaa1a('0x27')](function(_0x46ed30){if(_0x46ed30){return _0x46ed30[_0xaa1a('0x83')](_0x4e86a7['body'][_0xaa1a('0x7f')],_[_0xaa1a('0x84')](_0x4e86a7[_0xaa1a('0x4c')],['ids','id'])||{})[_0xaa1a('0x85')](function(_0x19dd74){for(var _0xdd9f5e=0x0;_0xdd9f5e<_0x4e86a7['body'][_0xaa1a('0x7f')][_0xaa1a('0x3a')];_0xdd9f5e+=0x1){socket[_0xaa1a('0x6e')](_0xaa1a('0x86'),{'UserId':_0x4e86a7['body'][_0xaa1a('0x7f')][_0xdd9f5e],'MailQueueId':_0x4e86a7[_0xaa1a('0x45')]['id']});}return _0x19dd74;});}})[_0xaa1a('0x27')](respondWithResult(_0x334b9c,null))[_0xaa1a('0x4a')](handleError(_0x334b9c,null));};exports[_0xaa1a('0x81')]=function(_0x4f43aa,_0x16aa1e,_0x103c39){return db[_0xaa1a('0x2f')][_0xaa1a('0x49')]({'where':{'id':_0x4f43aa[_0xaa1a('0x45')]['id']}})['then'](handleEntityNotFound(_0x16aa1e,null))[_0xaa1a('0x27')](function(_0x5475a9){if(_0x5475a9){return _0x5475a9[_0xaa1a('0x81')](_0x4f43aa['query']['ids'])[_0xaa1a('0x27')](function(){if(_['isArray'](_0x4f43aa['query'][_0xaa1a('0x7f')])){for(var _0xe9f54b=0x0;_0xe9f54b<_0x4f43aa[_0xaa1a('0x35')][_0xaa1a('0x7f')]['length'];_0xe9f54b+=0x1){socket[_0xaa1a('0x6e')]('userMailQueue:remove',{'UserId':Number(_0x4f43aa['query']['ids'][_0xe9f54b]),'MailQueueId':Number(_0x4f43aa[_0xaa1a('0x45')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x4f43aa[_0xaa1a('0x35')]['ids']),'MailQueueId':Number(_0x4f43aa[_0xaa1a('0x45')]['id'])});}});}})[_0xaa1a('0x27')](respondWithStatusCode(_0x16aa1e,null))[_0xaa1a('0x4a')](handleError(_0x16aa1e,null));};exports[_0xaa1a('0x87')]=function(_0x1e48c8,_0x108539,_0x5eacaa){var _0x581847={};var _0x4f92a8={};var _0x5ccaa6;var _0x21d6cd;return db[_0xaa1a('0x2f')]['findOne']({'where':{'id':_0x1e48c8[_0xaa1a('0x45')]['id']}})['then'](handleEntityNotFound(_0x108539,null))[_0xaa1a('0x27')](function(_0x14d468){if(_0x14d468){_0x5ccaa6=_0x14d468;_0x4f92a8[_0xaa1a('0x34')]=_[_0xaa1a('0x46')](db[_0xaa1a('0x5a')][_0xaa1a('0x30')]);_0x4f92a8['query']=_['keys'](_0x1e48c8[_0xaa1a('0x35')]);_0x4f92a8['filters']=_[_0xaa1a('0x37')](_0x4f92a8[_0xaa1a('0x34')],_0x4f92a8[_0xaa1a('0x35')]);_0x581847[_0xaa1a('0x38')]=_['intersection'](_0x4f92a8[_0xaa1a('0x34')],qs[_0xaa1a('0x39')](_0x1e48c8[_0xaa1a('0x35')]['fields']));_0x581847[_0xaa1a('0x38')]=_0x581847[_0xaa1a('0x38')][_0xaa1a('0x3a')]?_0x581847['attributes']:_0x4f92a8['model'];_0x581847['order']=qs[_0xaa1a('0x3e')](_0x1e48c8[_0xaa1a('0x35')][_0xaa1a('0x3e')]);_0x581847[_0xaa1a('0x3f')]=qs[_0xaa1a('0x36')](_[_0xaa1a('0x88')](_0x1e48c8[_0xaa1a('0x35')],_0x4f92a8['filters']));if(_0x1e48c8[_0xaa1a('0x35')]['filter']){_0x581847['where']=_[_0xaa1a('0x41')](_0x581847[_0xaa1a('0x3f')],{'$or':_[_0xaa1a('0x2e')](_0x581847['attributes'],function(_0xa0ca69){var _0x3dd8af={};_0x3dd8af[_0xa0ca69]={'$like':'%'+_0x1e48c8[_0xaa1a('0x35')][_0xaa1a('0x40')]+'%'};return _0x3dd8af;})});}_0x581847=_[_0xaa1a('0x41')]({},_0x581847,_0x1e48c8[_0xaa1a('0x48')]);return _0x5ccaa6[_0xaa1a('0x87')](_0x581847);}})['then'](function(_0xbe1d44){if(_0xbe1d44){_0x21d6cd=_0xbe1d44[_0xaa1a('0x3a')];if(!_0x1e48c8[_0xaa1a('0x35')][_0xaa1a('0x3b')]('nolimit')){_0x581847['limit']=qs[_0xaa1a('0x21')](_0x1e48c8[_0xaa1a('0x35')][_0xaa1a('0x21')]);_0x581847['offset']=qs[_0xaa1a('0x20')](_0x1e48c8['query']['offset']);}return _0x5ccaa6[_0xaa1a('0x87')](_0x581847);}})[_0xaa1a('0x27')](function(_0x2bac9f){if(_0x2bac9f){return _0x2bac9f?{'count':_0x21d6cd,'rows':_0x2bac9f}:null;}})['then'](respondWithResult(_0x108539,null))['catch'](handleError(_0x108539,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 3a2852d..df65180 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 _0x0d7f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x0d7f,0x122));var _0xf0d7=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x0d7f[_0x17b6e3];return _0x3906f3;};'use strict';var EventEmitter=require(_0xf0d7('0x0'));var MailQueue=require(_0xf0d7('0x1'))['db'][_0xf0d7('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf0d7('0x3')](0x0);var events={'afterCreate':_0xf0d7('0x4'),'afterUpdate':_0xf0d7('0x5'),'afterDestroy':_0xf0d7('0x6')};function emitEvent(_0xaaaf28){return function(_0x3958dd,_0x5f3f77,_0x2ab368){MailQueueEvents[_0xf0d7('0x7')](_0xaaaf28+':'+_0x3958dd['id'],_0x3958dd);MailQueueEvents[_0xf0d7('0x7')](_0xaaaf28,_0x3958dd);_0x2ab368(null);};}for(var e in events){if(events[_0xf0d7('0x8')](e)){var event=events[e];MailQueue[_0xf0d7('0x9')](e,emitEvent(event));}}module[_0xf0d7('0xa')]=MailQueueEvents; \ No newline at end of file +var _0x4510=['MailQueue','setMaxListeners','save','remove','emit','hook','exports','../../mysqldb'];(function(_0x218695,_0x37ad20){var _0x3e759e=function(_0x5164a8){while(--_0x5164a8){_0x218695['push'](_0x218695['shift']());}};_0x3e759e(++_0x37ad20);}(_0x4510,0x197));var _0x0451=function(_0x1c37f4,_0x3a9610){_0x1c37f4=_0x1c37f4-0x0;var _0xc0552e=_0x4510[_0x1c37f4];return _0xc0552e;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x0451('0x0'))['db'][_0x0451('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0451('0x2')](0x0);var events={'afterCreate':_0x0451('0x3'),'afterUpdate':'update','afterDestroy':_0x0451('0x4')};function emitEvent(_0x170e2e){return function(_0x29cb03,_0x2060a0,_0x174e45){MailQueueEvents[_0x0451('0x5')](_0x170e2e+':'+_0x29cb03['id'],_0x29cb03);MailQueueEvents[_0x0451('0x5')](_0x170e2e,_0x29cb03);_0x174e45(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x0451('0x6')](e,emitEvent(event));}}module[_0x0451('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 46f64ee..719edd9 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 _0x0fb1=['lodash','api','request-promise','path','../../config/environment','./mailQueue.attributes','exports','MailQueue'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0fb1,0x138));var _0x10fb=function(_0x1f2aee,_0x34a98c){_0x1f2aee=_0x1f2aee-0x0;var _0x57f4bf=_0x0fb1[_0x1f2aee];return _0x57f4bf;};'use strict';var _=require(_0x10fb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x10fb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x10fb('0x2'));var fs=require('fs');var path=require(_0x10fb('0x3'));var rimraf=require('rimraf');var config=require(_0x10fb('0x4'));var attributes=require(_0x10fb('0x5'));module[_0x10fb('0x6')]=function(_0x2dfce3,_0x802f1d){return _0x2dfce3['define'](_0x10fb('0x7'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ee4=['path','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27c038,_0x18a452){var _0x1be2f9=function(_0x31ddc8){while(--_0x31ddc8){_0x27c038['push'](_0x27c038['shift']());}};_0x1be2f9(++_0x18a452);}(_0x2ee4,0x12d));var _0x42ee=function(_0x2e10b1,_0x845b82){_0x2e10b1=_0x2e10b1-0x0;var _0x41de8b=_0x2ee4[_0x2e10b1];return _0x41de8b;};'use strict';var _=require(_0x42ee('0x0'));var util=require(_0x42ee('0x1'));var logger=require(_0x42ee('0x2'))(_0x42ee('0x3'));var moment=require(_0x42ee('0x4'));var BPromise=require(_0x42ee('0x5'));var rp=require(_0x42ee('0x6'));var fs=require('fs');var path=require(_0x42ee('0x7'));var rimraf=require(_0x42ee('0x8'));var config=require('../../config/environment');var attributes=require(_0x42ee('0x9'));module[_0x42ee('0xa')]=function(_0x3f6e26,_0x373efc){return _0x3f6e26[_0x42ee('0xb')](_0x42ee('0xc'),attributes,{'tableName':_0x42ee('0xd'),'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 827ec21..a52e783 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 _0x44b4=['http','redis','defaults','localhost','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowMailQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x44b4,0x17c));var _0x444b=function(_0x5c273c,_0x518fc4){_0x5c273c=_0x5c273c-0x0;var _0x16e3d5=_0x44b4[_0x5c273c];return _0x16e3d5;};'use strict';var _=require('lodash');var util=require(_0x444b('0x0'));var moment=require('moment');var BPromise=require(_0x444b('0x1'));var rs=require(_0x444b('0x2'));var fs=require('fs');var Redis=require(_0x444b('0x3'));var db=require(_0x444b('0x4'))['db'];var utils=require(_0x444b('0x5'));var logger=require(_0x444b('0x6'))(_0x444b('0x7'));var config=require(_0x444b('0x8'));var jayson=require(_0x444b('0x9'));var client=jayson['client'][_0x444b('0xa')]({'port':0x232a});config[_0x444b('0xb')]=_[_0x444b('0xc')](config[_0x444b('0xb')],{'host':_0x444b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x444b('0xb')]));require(_0x444b('0xe'))[_0x444b('0xf')](socket);function respondWithRpcPromise(_0x4c38ef,_0x154974,_0x3b823f){return new BPromise(function(_0x166c49,_0x4f4195){return client['request'](_0x4c38ef,_0x3b823f)[_0x444b('0x10')](function(_0x3ced2c){logger[_0x444b('0x11')](_0x444b('0x12'),_0x154974,_0x444b('0x13'));logger['debug'](_0x444b('0x14'),_0x154974,'request\x20sent',JSON[_0x444b('0x15')](_0x3ced2c));if(_0x3ced2c[_0x444b('0x16')]){if(_0x3ced2c[_0x444b('0x16')]['code']===0x1f4){logger[_0x444b('0x16')](_0x444b('0x12'),_0x154974,_0x3ced2c[_0x444b('0x16')][_0x444b('0x17')]);return _0x4f4195(_0x3ced2c[_0x444b('0x16')][_0x444b('0x17')]);}logger[_0x444b('0x16')](_0x444b('0x12'),_0x154974,_0x3ced2c['error'][_0x444b('0x17')]);return _0x166c49(_0x3ced2c[_0x444b('0x16')][_0x444b('0x17')]);}else{logger[_0x444b('0x11')](_0x444b('0x12'),_0x154974,'request\x20sent');_0x166c49(_0x3ced2c[_0x444b('0x18')]['message']);}})[_0x444b('0x19')](function(_0x15419a){logger[_0x444b('0x16')](_0x444b('0x12'),_0x154974,_0x15419a);_0x4f4195(_0x15419a);});});}exports[_0x444b('0x1a')]=function(_0x1fa87c){var _0x4f1863=this;return new Promise(function(_0x2a0645,_0x534cc){return db[_0x444b('0x1b')]['findAll']({'raw':_0x1fa87c['options']?_0x1fa87c[_0x444b('0x1c')][_0x444b('0x1d')]===undefined?!![]:![]:!![],'where':_0x1fa87c['options']?_0x1fa87c[_0x444b('0x1c')][_0x444b('0x1e')]||null:null,'attributes':_0x1fa87c[_0x444b('0x1c')]?_0x1fa87c['options'][_0x444b('0x1f')]||null:null,'limit':_0x1fa87c['options']?_0x1fa87c['options'][_0x444b('0x20')]||null:null,'include':_0x1fa87c[_0x444b('0x1c')]?_0x1fa87c['options'][_0x444b('0x21')]?_[_0x444b('0x22')](_0x1fa87c['options']['include'],function(_0x1dda44){return{'model':db[_0x1dda44[_0x444b('0x23')]],'as':_0x1dda44['as'],'attributes':_0x1dda44[_0x444b('0x1f')],'include':_0x1dda44[_0x444b('0x21')]?_['map'](_0x1dda44[_0x444b('0x21')],function(_0x3f6529){return{'model':db[_0x3f6529[_0x444b('0x23')]],'as':_0x3f6529['as'],'attributes':_0x3f6529[_0x444b('0x1f')],'include':_0x3f6529[_0x444b('0x21')]?_[_0x444b('0x22')](_0x3f6529[_0x444b('0x21')],function(_0x21d7ce){return{'model':db[_0x21d7ce[_0x444b('0x23')]],'as':_0x21d7ce['as'],'attributes':_0x21d7ce['attributes']};}):[]};}):[]};}):[]:[]})[_0x444b('0x10')](function(_0x4474f4){logger['info']('GetMailQueue',_0x1fa87c);logger[_0x444b('0x24')](_0x444b('0x1a'),_0x1fa87c,JSON[_0x444b('0x15')](_0x4474f4));_0x2a0645(_0x4474f4);})['catch'](function(_0x4cc693){logger[_0x444b('0x16')]('GetMailQueue',_0x4cc693['message'],_0x1fa87c);_0x534cc(_0x4f1863['error'](0x1f4,_0x4cc693[_0x444b('0x17')]));});});};exports[_0x444b('0x25')]=function(_0xb897f2){var _0x492f9d=this;return new Promise(function(_0x49011b,_0x1a9a4e){return db[_0x444b('0x1b')][_0x444b('0x26')]({'raw':_0xb897f2['options']?_0xb897f2['options']['raw']===undefined?!![]:![]:!![],'where':_0xb897f2[_0x444b('0x1c')]?_0xb897f2[_0x444b('0x1c')][_0x444b('0x1e')]||null:null,'attributes':_0xb897f2['options']?_0xb897f2[_0x444b('0x1c')][_0x444b('0x1f')]||null:null,'include':_0xb897f2[_0x444b('0x1c')]?_0xb897f2[_0x444b('0x1c')][_0x444b('0x21')]?_[_0x444b('0x22')](_0xb897f2[_0x444b('0x1c')][_0x444b('0x21')],function(_0x435566){return{'model':db[_0x435566[_0x444b('0x23')]],'as':_0x435566['as'],'attributes':_0x435566[_0x444b('0x1f')],'include':_0x435566['include']?_[_0x444b('0x22')](_0x435566[_0x444b('0x21')],function(_0x4ee869){return{'model':db[_0x4ee869[_0x444b('0x23')]],'as':_0x4ee869['as'],'attributes':_0x4ee869[_0x444b('0x1f')],'include':_0x4ee869['include']?_[_0x444b('0x22')](_0x4ee869['include'],function(_0x280203){return{'model':db[_0x280203['model']],'as':_0x280203['as'],'attributes':_0x280203[_0x444b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c807d){logger[_0x444b('0x11')](_0x444b('0x25'),_0xb897f2);logger[_0x444b('0x24')]('ShowMailQueue',_0xb897f2,JSON[_0x444b('0x15')](_0x5c807d));_0x49011b(_0x5c807d);})[_0x444b('0x19')](function(_0x3e66d3){logger['error'](_0x444b('0x25'),_0x3e66d3[_0x444b('0x17')],_0xb897f2);_0x1a9a4e(_0x492f9d[_0x444b('0x16')](0x1f4,_0x3e66d3['message']));});});}; \ No newline at end of file +var _0x73b7=['localhost','socket.io-emitter','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','findAll','options','where','attributes','limit','include','map','model','ShowMailQueue','MailQueue','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73b7,0x1bd));var _0x773b=function(_0x50a2ee,_0x5ef06e){_0x50a2ee=_0x50a2ee-0x0;var _0x130080=_0x73b7[_0x50a2ee];return _0x130080;};'use strict';var _=require(_0x773b('0x0'));var util=require(_0x773b('0x1'));var moment=require(_0x773b('0x2'));var BPromise=require(_0x773b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x773b('0x4'))['db'];var utils=require(_0x773b('0x5'));var logger=require(_0x773b('0x6'))('rpc');var config=require(_0x773b('0x7'));var jayson=require(_0x773b('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x773b('0x9')]=_[_0x773b('0xa')](config[_0x773b('0x9')],{'host':_0x773b('0xb'),'port':0x18eb});var socket=require(_0x773b('0xc'))(new Redis(config[_0x773b('0x9')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x251ca7,_0x17a704,_0x5c6df2){return new BPromise(function(_0x26e28d,_0x15483f){return client[_0x773b('0xd')](_0x251ca7,_0x5c6df2)[_0x773b('0xe')](function(_0x12557f){logger[_0x773b('0xf')](_0x773b('0x10'),_0x17a704,_0x773b('0x11'));logger[_0x773b('0x12')](_0x773b('0x13'),_0x17a704,_0x773b('0x11'),JSON[_0x773b('0x14')](_0x12557f));if(_0x12557f[_0x773b('0x15')]){if(_0x12557f[_0x773b('0x15')][_0x773b('0x16')]===0x1f4){logger[_0x773b('0x15')]('MailQueue,\x20%s,\x20%s',_0x17a704,_0x12557f[_0x773b('0x15')]['message']);return _0x15483f(_0x12557f[_0x773b('0x15')][_0x773b('0x17')]);}logger[_0x773b('0x15')](_0x773b('0x10'),_0x17a704,_0x12557f[_0x773b('0x15')][_0x773b('0x17')]);return _0x26e28d(_0x12557f[_0x773b('0x15')][_0x773b('0x17')]);}else{logger['info'](_0x773b('0x10'),_0x17a704,_0x773b('0x11'));_0x26e28d(_0x12557f[_0x773b('0x18')][_0x773b('0x17')]);}})[_0x773b('0x19')](function(_0x2bbe00){logger['error']('MailQueue,\x20%s,\x20%s',_0x17a704,_0x2bbe00);_0x15483f(_0x2bbe00);});});}exports[_0x773b('0x1a')]=function(_0x4229a6){var _0x433526=this;return new Promise(function(_0x4b608f,_0x52e365){return db['MailQueue'][_0x773b('0x1b')]({'raw':_0x4229a6[_0x773b('0x1c')]?_0x4229a6['options']['raw']===undefined?!![]:![]:!![],'where':_0x4229a6[_0x773b('0x1c')]?_0x4229a6['options'][_0x773b('0x1d')]||null:null,'attributes':_0x4229a6[_0x773b('0x1c')]?_0x4229a6[_0x773b('0x1c')][_0x773b('0x1e')]||null:null,'limit':_0x4229a6[_0x773b('0x1c')]?_0x4229a6[_0x773b('0x1c')][_0x773b('0x1f')]||null:null,'include':_0x4229a6[_0x773b('0x1c')]?_0x4229a6[_0x773b('0x1c')][_0x773b('0x20')]?_[_0x773b('0x21')](_0x4229a6['options'][_0x773b('0x20')],function(_0x331016){return{'model':db[_0x331016[_0x773b('0x22')]],'as':_0x331016['as'],'attributes':_0x331016[_0x773b('0x1e')],'include':_0x331016[_0x773b('0x20')]?_[_0x773b('0x21')](_0x331016[_0x773b('0x20')],function(_0x36f046){return{'model':db[_0x36f046[_0x773b('0x22')]],'as':_0x36f046['as'],'attributes':_0x36f046[_0x773b('0x1e')],'include':_0x36f046['include']?_[_0x773b('0x21')](_0x36f046['include'],function(_0xcf0126){return{'model':db[_0xcf0126[_0x773b('0x22')]],'as':_0xcf0126['as'],'attributes':_0xcf0126[_0x773b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29794f){logger[_0x773b('0xf')]('GetMailQueue',_0x4229a6);logger[_0x773b('0x12')](_0x773b('0x1a'),_0x4229a6,JSON[_0x773b('0x14')](_0x29794f));_0x4b608f(_0x29794f);})[_0x773b('0x19')](function(_0x1f7355){logger['error']('GetMailQueue',_0x1f7355[_0x773b('0x17')],_0x4229a6);_0x52e365(_0x433526[_0x773b('0x15')](0x1f4,_0x1f7355[_0x773b('0x17')]));});});};exports[_0x773b('0x23')]=function(_0x5a0c1c){var _0x1328e5=this;return new Promise(function(_0x44a770,_0x3cd8e4){return db[_0x773b('0x24')][_0x773b('0x25')]({'raw':_0x5a0c1c[_0x773b('0x1c')]?_0x5a0c1c[_0x773b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5a0c1c[_0x773b('0x1c')]?_0x5a0c1c[_0x773b('0x1c')][_0x773b('0x1d')]||null:null,'attributes':_0x5a0c1c[_0x773b('0x1c')]?_0x5a0c1c[_0x773b('0x1c')]['attributes']||null:null,'include':_0x5a0c1c[_0x773b('0x1c')]?_0x5a0c1c[_0x773b('0x1c')][_0x773b('0x20')]?_[_0x773b('0x21')](_0x5a0c1c['options']['include'],function(_0x3e14e7){return{'model':db[_0x3e14e7[_0x773b('0x22')]],'as':_0x3e14e7['as'],'attributes':_0x3e14e7[_0x773b('0x1e')],'include':_0x3e14e7['include']?_[_0x773b('0x21')](_0x3e14e7[_0x773b('0x20')],function(_0xa58a59){return{'model':db[_0xa58a59[_0x773b('0x22')]],'as':_0xa58a59['as'],'attributes':_0xa58a59['attributes'],'include':_0xa58a59[_0x773b('0x20')]?_[_0x773b('0x21')](_0xa58a59[_0x773b('0x20')],function(_0x284fa8){return{'model':db[_0x284fa8[_0x773b('0x22')]],'as':_0x284fa8['as'],'attributes':_0x284fa8[_0x773b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x773b('0xe')](function(_0x4c4769){logger[_0x773b('0xf')](_0x773b('0x23'),_0x5a0c1c);logger[_0x773b('0x12')](_0x773b('0x23'),_0x5a0c1c,JSON[_0x773b('0x14')](_0x4c4769));_0x44a770(_0x4c4769);})[_0x773b('0x19')](function(_0x42f3d4){logger[_0x773b('0x15')](_0x773b('0x23'),_0x42f3d4['message'],_0x5a0c1c);_0x3cd8e4(_0x1328e5['error'](0x1f4,_0x42f3d4[_0x773b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 63d454a..17e2e7b 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 _0x5770=['save','remove','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x5770,0x14f));var _0x0577=function(_0x44d720,_0x5e82de){_0x44d720=_0x44d720-0x0;var _0x46d103=_0x5770[_0x44d720];return _0x46d103;};'use strict';var MailQueueEvents=require(_0x0577('0x0'));var events=[_0x0577('0x1'),_0x0577('0x2'),'update'];function createListener(_0x1fd1ed,_0x77ef3f){return function(_0x3a7c03){_0x77ef3f['emit'](_0x1fd1ed,_0x3a7c03);};}function removeListener(_0x1a869e,_0x54e08f){return function(){MailQueueEvents[_0x0577('0x3')](_0x1a869e,_0x54e08f);};}exports[_0x0577('0x4')]=function(_0x180ae9){for(var _0xde24f2=0x0,_0xd9083c=events[_0x0577('0x5')];_0xde24f2<_0xd9083c;_0xde24f2++){var _0x116450=events[_0xde24f2];var _0x4b11ee=createListener(_0x0577('0x6')+_0x116450,_0x180ae9);MailQueueEvents['on'](_0x116450,_0x4b11ee);}}; \ No newline at end of file +var _0xbe81=['emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0xbe81,0xf8));var _0x1be8=function(_0x10aa73,_0xc744f4){_0x10aa73=_0x10aa73-0x0;var _0x3496d9=_0xbe81[_0x10aa73];return _0x3496d9;};'use strict';var MailQueueEvents=require(_0x1be8('0x0'));var events=[_0x1be8('0x1'),_0x1be8('0x2'),_0x1be8('0x3')];function createListener(_0x58cbe2,_0x492268){return function(_0x2e5186){_0x492268[_0x1be8('0x4')](_0x58cbe2,_0x2e5186);};}function removeListener(_0x10bba5,_0x3ce815){return function(){MailQueueEvents[_0x1be8('0x5')](_0x10bba5,_0x3ce815);};}exports[_0x1be8('0x6')]=function(_0x20f866){for(var _0x255554=0x0,_0x3c37f8=events[_0x1be8('0x7')];_0x255554<_0x3c37f8;_0x255554++){var _0x959a25=events[_0x255554];var _0x100221=createListener(_0x1be8('0x8')+_0x959a25,_0x20f866);MailQueueEvents['on'](_0x959a25,_0x100221);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 472afb5..81edd79 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 _0x2628=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','put','update','destroy','exports'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x2628,0x18c));var _0x8262=function(_0x501202,_0x9a4b62){_0x501202=_0x501202-0x0;var _0x544cee=_0x2628[_0x501202];return _0x544cee;};'use strict';var multer=require('multer');var util=require(_0x8262('0x0'));var path=require(_0x8262('0x1'));var timeout=require(_0x8262('0x2'));var express=require(_0x8262('0x3'));var router=express[_0x8262('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8262('0x5'));var config=require(_0x8262('0x6'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x8262('0x7')](),controller[_0x8262('0x8')]);router[_0x8262('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x8262('0xa')]);router['get'](_0x8262('0xb'),auth[_0x8262('0x7')](),controller[_0x8262('0xc')]);router[_0x8262('0xd')]('/',auth[_0x8262('0x7')](),controller['create']);router[_0x8262('0xe')](_0x8262('0xb'),auth['isAuthenticated'](),controller[_0x8262('0xf')]);router['delete'](_0x8262('0xb'),auth['isAuthenticated'](),controller[_0x8262('0x10')]);module[_0x8262('0x11')]=router; \ No newline at end of file +var _0x9e75=['../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4e27af,_0x184574){var _0x4a80b9=function(_0x2b690f){while(--_0x2b690f){_0x4e27af['push'](_0x4e27af['shift']());}};_0x4a80b9(++_0x184574);}(_0x9e75,0x12b));var _0x59e7=function(_0x54dc37,_0xd3065a){_0x54dc37=_0x54dc37-0x0;var _0x140ba7=_0x9e75[_0x54dc37];return _0x140ba7;};'use strict';var multer=require(_0x59e7('0x0'));var util=require(_0x59e7('0x1'));var path=require(_0x59e7('0x2'));var timeout=require(_0x59e7('0x3'));var express=require(_0x59e7('0x4'));var router=express[_0x59e7('0x5')]();var auth=require(_0x59e7('0x6'));var interaction=require(_0x59e7('0x7'));var config=require('../../config/environment');var controller=require(_0x59e7('0x8'));router[_0x59e7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x59e7('0x9')]('/describe',auth[_0x59e7('0xa')](),controller[_0x59e7('0xb')]);router[_0x59e7('0x9')](_0x59e7('0xc'),auth[_0x59e7('0xa')](),controller[_0x59e7('0xd')]);router['post']('/',auth[_0x59e7('0xa')](),controller[_0x59e7('0xe')]);router[_0x59e7('0xf')](_0x59e7('0xc'),auth[_0x59e7('0xa')](),controller[_0x59e7('0x10')]);router['delete'](_0x59e7('0xc'),auth[_0x59e7('0xa')](),controller['destroy']);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 989c52c..fbc6278 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 _0x02f5=['moment','sequelize','exports','STRING','DATE'];(function(_0x1c3392,_0x561ea2){var _0x52f8b8=function(_0x5a9525){while(--_0x5a9525){_0x1c3392['push'](_0x1c3392['shift']());}};_0x52f8b8(++_0x561ea2);}(_0x02f5,0x140));var _0x502f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x02f5[_0x178e48];return _0x440d7e;};'use strict';var moment=require(_0x502f('0x0'));var Sequelize=require(_0x502f('0x1'));module[_0x502f('0x2')]={'uniqueid':{'type':Sequelize[_0x502f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x502f('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x502f('0x4')]},'acceptAt':{'type':Sequelize[_0x502f('0x4')]},'exitAt':{'type':Sequelize[_0x502f('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5e4e=['DATE','moment','exports','STRING'];(function(_0x515be7,_0x222362){var _0x84eba1=function(_0x9e5413){while(--_0x9e5413){_0x515be7['push'](_0x515be7['shift']());}};_0x84eba1(++_0x222362);}(_0x5e4e,0x131));var _0xe5e4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5e4e[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0xe5e4('0x0'));var Sequelize=require('sequelize');module[_0xe5e4('0x1')]={'uniqueid':{'type':Sequelize[_0xe5e4('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe5e4('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe5e4('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe5e4('0x3')]},'reason':{'type':Sequelize[_0xe5e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index b023441..5d484df 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 _0xdc75=['keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','MailQueueReport','findAll','rows','catch','show','length','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','rawAttributes','fieldName','type','key','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdc75,0xb0));var _0x5dc7=function(_0x477c9f,_0x1a9264){_0x477c9f=_0x477c9f-0x0;var _0x24059a=_0xdc75[_0x477c9f];return _0x24059a;};'use strict';var pdf=require(_0x5dc7('0x0'));var emlformat=require(_0x5dc7('0x1'));var rimraf=require(_0x5dc7('0x2'));var zipdir=require(_0x5dc7('0x3'));var jsonpatch=require(_0x5dc7('0x4'));var rp=require(_0x5dc7('0x5'));var moment=require(_0x5dc7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5dc7('0x7'));var util=require('util');var path=require(_0x5dc7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5dc7('0x9'));var squel=require(_0x5dc7('0xa'));var crypto=require(_0x5dc7('0xb'));var jsforce=require(_0x5dc7('0xc'));var deskjs=require(_0x5dc7('0xd'));var toCsv=require(_0x5dc7('0xe'));var querystring=require(_0x5dc7('0xf'));var Papa=require('papaparse');var Redis=require(_0x5dc7('0x10'));var authService=require(_0x5dc7('0x11'));var qs=require(_0x5dc7('0x12'));var as=require(_0x5dc7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5dc7('0x14'))(_0x5dc7('0x15'));var utils=require(_0x5dc7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5dc7('0x17'));var db=require(_0x5dc7('0x18'))['db'];function respondWithStatusCode(_0xea4f6e,_0x4ad469){_0x4ad469=_0x4ad469||0xcc;return function(_0x3a3c78){if(_0x3a3c78){return _0xea4f6e['sendStatus'](_0x4ad469);}return _0xea4f6e[_0x5dc7('0x19')](_0x4ad469)[_0x5dc7('0x1a')]();};}function respondWithResult(_0x33d4c5,_0x4fdedf){_0x4fdedf=_0x4fdedf||0xc8;return function(_0x58c244){if(_0x58c244){return _0x33d4c5[_0x5dc7('0x19')](_0x4fdedf)[_0x5dc7('0x1b')](_0x58c244);}};}function respondWithFilteredResult(_0xca8992,_0x2da704){return function(_0x297bd7){if(_0x297bd7){var _0x3972b8=_0x297bd7[_0x5dc7('0x1c')],_0x3acb3f=_0x2da704[_0x5dc7('0x1d')],_0x1bf453=_0x2da704[_0x5dc7('0x1d')]+_0x2da704['limit'],_0x5042b0;if(_0x1bf453>=_0x3972b8){_0x1bf453=_0x3972b8;_0x5042b0=0xc8;}else{_0x5042b0=0xce;}_0xca8992[_0x5dc7('0x19')](_0x5042b0);return _0xca8992[_0x5dc7('0x1e')](_0x5dc7('0x1f'),_0x3acb3f+'-'+_0x1bf453+'/'+_0x3972b8)['json'](_0x297bd7);}return null;};}function patchUpdates(_0x371c09){return function(_0x36a785){try{jsonpatch[_0x5dc7('0x20')](_0x36a785,_0x371c09,!![]);}catch(_0x5ca57f){return BPromise[_0x5dc7('0x21')](_0x5ca57f);}return _0x36a785[_0x5dc7('0x22')]();};}function saveUpdates(_0x42392b,_0x195c75){return function(_0x406c83){if(_0x406c83){return _0x406c83[_0x5dc7('0x23')](_0x42392b)[_0x5dc7('0x24')](function(_0x356399){return _0x356399;});}return null;};}function removeEntity(_0x549f97,_0x130a42){return function(_0x4afb6e){if(_0x4afb6e){return _0x4afb6e[_0x5dc7('0x25')]()['then'](function(){_0x549f97[_0x5dc7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5804ca,_0x55d619){return function(_0x157999){if(!_0x157999){_0x5804ca[_0x5dc7('0x26')](0x194);}return _0x157999;};}function handleError(_0x18f419,_0xd7b7ed){_0xd7b7ed=_0xd7b7ed||0x1f4;return function(_0x32117b){logger[_0x5dc7('0x27')](_0x32117b['stack']);if(_0x32117b[_0x5dc7('0x28')]){delete _0x32117b[_0x5dc7('0x28')];}_0x18f419[_0x5dc7('0x19')](_0xd7b7ed)['send'](_0x32117b);};}exports['index']=function(_0x714d10,_0x32ad79){var _0x2c33da={},_0x14e29a={},_0x8e3a56={'count':0x0,'rows':[]};var _0x250311=_['map'](db['MailQueueReport'][_0x5dc7('0x29')],function(_0x5e0e87){return{'name':_0x5e0e87[_0x5dc7('0x2a')],'type':_0x5e0e87[_0x5dc7('0x2b')][_0x5dc7('0x2c')]};});_0x14e29a['model']=_[_0x5dc7('0x2d')](_0x250311,_0x5dc7('0x28'));_0x14e29a['query']=_[_0x5dc7('0x2e')](_0x714d10[_0x5dc7('0x2f')]);_0x14e29a[_0x5dc7('0x30')]=_[_0x5dc7('0x31')](_0x14e29a['model'],_0x14e29a[_0x5dc7('0x2f')]);_0x2c33da[_0x5dc7('0x32')]=_[_0x5dc7('0x31')](_0x14e29a[_0x5dc7('0x33')],qs[_0x5dc7('0x34')](_0x714d10['query'][_0x5dc7('0x34')]));_0x2c33da['attributes']=_0x2c33da['attributes']['length']?_0x2c33da[_0x5dc7('0x32')]:_0x14e29a['model'];if(!_0x714d10['query'][_0x5dc7('0x35')](_0x5dc7('0x36'))){_0x2c33da[_0x5dc7('0x37')]=qs[_0x5dc7('0x37')](_0x714d10['query']['limit']);_0x2c33da[_0x5dc7('0x1d')]=qs[_0x5dc7('0x1d')](_0x714d10[_0x5dc7('0x2f')]['offset']);}_0x2c33da[_0x5dc7('0x38')]=qs[_0x5dc7('0x39')](_0x714d10[_0x5dc7('0x2f')][_0x5dc7('0x39')]);_0x2c33da[_0x5dc7('0x3a')]=qs[_0x5dc7('0x30')](_['pick'](_0x714d10[_0x5dc7('0x2f')],_0x14e29a[_0x5dc7('0x30')]),_0x250311);if(_0x714d10[_0x5dc7('0x2f')][_0x5dc7('0x3b')]){_0x2c33da['where']=_[_0x5dc7('0x3c')](_0x2c33da[_0x5dc7('0x3a')],{'$or':_[_0x5dc7('0x2d')](_0x250311,function(_0x2a6150){if(_0x2a6150[_0x5dc7('0x2b')]!==_0x5dc7('0x3d')){var _0x817c9f={};_0x817c9f[_0x2a6150[_0x5dc7('0x28')]]={'$like':'%'+_0x714d10[_0x5dc7('0x2f')]['filter']+'%'};return _0x817c9f;}})});}_0x2c33da=_[_0x5dc7('0x3c')]({},_0x2c33da,_0x714d10['options']);var _0x1fce0f={'where':_0x2c33da[_0x5dc7('0x3a')]};return db[_0x5dc7('0x3e')][_0x5dc7('0x1c')](_0x1fce0f)['then'](function(_0x5a2ba5){_0x8e3a56[_0x5dc7('0x1c')]=_0x5a2ba5;if(_0x714d10[_0x5dc7('0x2f')]['includeAll']){_0x2c33da['include']=[{'all':!![]}];}return db['MailQueueReport'][_0x5dc7('0x3f')](_0x2c33da);})[_0x5dc7('0x24')](function(_0x50659e){_0x8e3a56[_0x5dc7('0x40')]=_0x50659e;return _0x8e3a56;})[_0x5dc7('0x24')](respondWithFilteredResult(_0x32ad79,_0x2c33da))[_0x5dc7('0x41')](handleError(_0x32ad79,null));};exports[_0x5dc7('0x42')]=function(_0x32f087,_0x9c7fca){var _0x12deb4={'raw':!![],'where':{'id':_0x32f087['params']['id']}},_0x38f60c={};_0x38f60c[_0x5dc7('0x33')]=_[_0x5dc7('0x2e')](db['MailQueueReport'][_0x5dc7('0x29')]);_0x38f60c['query']=_[_0x5dc7('0x2e')](_0x32f087[_0x5dc7('0x2f')]);_0x38f60c[_0x5dc7('0x30')]=_[_0x5dc7('0x31')](_0x38f60c[_0x5dc7('0x33')],_0x38f60c[_0x5dc7('0x2f')]);_0x12deb4[_0x5dc7('0x32')]=_['intersection'](_0x38f60c['model'],qs[_0x5dc7('0x34')](_0x32f087['query'][_0x5dc7('0x34')]));_0x12deb4[_0x5dc7('0x32')]=_0x12deb4[_0x5dc7('0x32')][_0x5dc7('0x43')]?_0x12deb4[_0x5dc7('0x32')]:_0x38f60c[_0x5dc7('0x33')];if(_0x32f087[_0x5dc7('0x2f')]['includeAll']){_0x12deb4[_0x5dc7('0x44')]=[{'all':!![]}];}_0x12deb4=_[_0x5dc7('0x3c')]({},_0x12deb4,_0x32f087['options']);return db[_0x5dc7('0x3e')][_0x5dc7('0x45')](_0x12deb4)[_0x5dc7('0x24')](handleEntityNotFound(_0x9c7fca,null))['then'](respondWithResult(_0x9c7fca,null))[_0x5dc7('0x41')](handleError(_0x9c7fca,null));};exports[_0x5dc7('0x46')]=function(_0x345cee,_0x5d0bb7){return db[_0x5dc7('0x3e')][_0x5dc7('0x46')](_0x345cee[_0x5dc7('0x47')],{})['then'](respondWithResult(_0x5d0bb7,0xc9))[_0x5dc7('0x41')](handleError(_0x5d0bb7,null));};exports[_0x5dc7('0x23')]=function(_0x400855,_0x2bca9c){if(_0x400855[_0x5dc7('0x47')]['id']){delete _0x400855[_0x5dc7('0x47')]['id'];}return db['MailQueueReport'][_0x5dc7('0x45')]({'where':{'id':_0x400855[_0x5dc7('0x48')]['id']}})[_0x5dc7('0x24')](handleEntityNotFound(_0x2bca9c,null))[_0x5dc7('0x24')](saveUpdates(_0x400855['body'],null))[_0x5dc7('0x24')](respondWithResult(_0x2bca9c,null))[_0x5dc7('0x41')](handleError(_0x2bca9c,null));};exports['destroy']=function(_0x42cc2c,_0x556ffa){return db[_0x5dc7('0x3e')][_0x5dc7('0x45')]({'where':{'id':_0x42cc2c['params']['id']}})[_0x5dc7('0x24')](handleEntityNotFound(_0x556ffa,null))[_0x5dc7('0x24')](removeEntity(_0x556ffa,null))[_0x5dc7('0x41')](handleError(_0x556ffa,null));};exports[_0x5dc7('0x49')]=function(_0x155a4d,_0x5ef51c){return db[_0x5dc7('0x3e')][_0x5dc7('0x49')]()[_0x5dc7('0x24')](respondWithResult(_0x5ef51c,null))[_0x5dc7('0x41')](handleError(_0x5ef51c,null));}; \ No newline at end of file +var _0xedfb=['reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','include','MailQueueReport','findAll','rows','catch','params','keys','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply'];(function(_0x1c3a11,_0x303924){var _0x1a344b=function(_0x39a468){while(--_0x39a468){_0x1c3a11['push'](_0x1c3a11['shift']());}};_0x1a344b(++_0x303924);}(_0xedfb,0xc7));var _0xbedf=function(_0x28202e,_0x5d0604){_0x28202e=_0x28202e-0x0;var _0x126f8b=_0xedfb[_0x28202e];return _0x126f8b;};'use strict';var pdf=require(_0xbedf('0x0'));var emlformat=require(_0xbedf('0x1'));var rimraf=require(_0xbedf('0x2'));var zipdir=require(_0xbedf('0x3'));var jsonpatch=require(_0xbedf('0x4'));var rp=require('request-promise');var moment=require(_0xbedf('0x5'));var BPromise=require(_0xbedf('0x6'));var Mustache=require(_0xbedf('0x7'));var util=require(_0xbedf('0x8'));var path=require('path');var sox=require(_0xbedf('0x9'));var csv=require('to-csv');var ejs=require(_0xbedf('0xa'));var fs=require('fs');var _=require(_0xbedf('0xb'));var squel=require(_0xbedf('0xc'));var crypto=require(_0xbedf('0xd'));var jsforce=require(_0xbedf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbedf('0xf'));var querystring=require(_0xbedf('0x10'));var Papa=require(_0xbedf('0x11'));var Redis=require('ioredis');var authService=require(_0xbedf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbedf('0x13'));var hardwareService=require(_0xbedf('0x14'));var logger=require(_0xbedf('0x15'))(_0xbedf('0x16'));var utils=require('../../config/utils');var config=require(_0xbedf('0x17'));var licenseUtil=require(_0xbedf('0x18'));var db=require(_0xbedf('0x19'))['db'];function respondWithStatusCode(_0x49d0d1,_0x25061c){_0x25061c=_0x25061c||0xcc;return function(_0x55f492){if(_0x55f492){return _0x49d0d1[_0xbedf('0x1a')](_0x25061c);}return _0x49d0d1['status'](_0x25061c)['end']();};}function respondWithResult(_0x510556,_0x3714a1){_0x3714a1=_0x3714a1||0xc8;return function(_0xd643b7){if(_0xd643b7){return _0x510556[_0xbedf('0x1b')](_0x3714a1)['json'](_0xd643b7);}};}function respondWithFilteredResult(_0x3b6186,_0x5c0e36){return function(_0x86f898){if(_0x86f898){var _0x18d7c0=_0x86f898[_0xbedf('0x1c')],_0x1639b4=_0x5c0e36[_0xbedf('0x1d')],_0x528f32=_0x5c0e36[_0xbedf('0x1d')]+_0x5c0e36[_0xbedf('0x1e')],_0x3535bc;if(_0x528f32>=_0x18d7c0){_0x528f32=_0x18d7c0;_0x3535bc=0xc8;}else{_0x3535bc=0xce;}_0x3b6186[_0xbedf('0x1b')](_0x3535bc);return _0x3b6186[_0xbedf('0x1f')](_0xbedf('0x20'),_0x1639b4+'-'+_0x528f32+'/'+_0x18d7c0)[_0xbedf('0x21')](_0x86f898);}return null;};}function patchUpdates(_0x32e232){return function(_0x1369b0){try{jsonpatch[_0xbedf('0x22')](_0x1369b0,_0x32e232,!![]);}catch(_0x57d458){return BPromise[_0xbedf('0x23')](_0x57d458);}return _0x1369b0[_0xbedf('0x24')]();};}function saveUpdates(_0x37a808,_0x384c35){return function(_0x492604){if(_0x492604){return _0x492604[_0xbedf('0x25')](_0x37a808)[_0xbedf('0x26')](function(_0x3a1d83){return _0x3a1d83;});}return null;};}function removeEntity(_0x297c73,_0x2f4fcc){return function(_0x1784f3){if(_0x1784f3){return _0x1784f3[_0xbedf('0x27')]()['then'](function(){_0x297c73[_0xbedf('0x1b')](0xcc)[_0xbedf('0x28')]();});}};}function handleEntityNotFound(_0x5ef640,_0x2809bc){return function(_0x406bfe){if(!_0x406bfe){_0x5ef640[_0xbedf('0x1a')](0x194);}return _0x406bfe;};}function handleError(_0x26301f,_0xc03a4){_0xc03a4=_0xc03a4||0x1f4;return function(_0x3f2249){logger[_0xbedf('0x29')](_0x3f2249[_0xbedf('0x2a')]);if(_0x3f2249[_0xbedf('0x2b')]){delete _0x3f2249[_0xbedf('0x2b')];}_0x26301f[_0xbedf('0x1b')](_0xc03a4)['send'](_0x3f2249);};}exports[_0xbedf('0x2c')]=function(_0x4c866c,_0x473b9d){var _0x4ca126={},_0x5c012d={},_0x27eea3={'count':0x0,'rows':[]};var _0x4445e1=_[_0xbedf('0x2d')](db['MailQueueReport'][_0xbedf('0x2e')],function(_0x1b8b7d){return{'name':_0x1b8b7d[_0xbedf('0x2f')],'type':_0x1b8b7d[_0xbedf('0x30')][_0xbedf('0x31')]};});_0x5c012d[_0xbedf('0x32')]=_[_0xbedf('0x2d')](_0x4445e1,_0xbedf('0x2b'));_0x5c012d[_0xbedf('0x33')]=_['keys'](_0x4c866c[_0xbedf('0x33')]);_0x5c012d['filters']=_[_0xbedf('0x34')](_0x5c012d[_0xbedf('0x32')],_0x5c012d[_0xbedf('0x33')]);_0x4ca126[_0xbedf('0x35')]=_[_0xbedf('0x34')](_0x5c012d[_0xbedf('0x32')],qs[_0xbedf('0x36')](_0x4c866c[_0xbedf('0x33')]['fields']));_0x4ca126[_0xbedf('0x35')]=_0x4ca126[_0xbedf('0x35')][_0xbedf('0x37')]?_0x4ca126[_0xbedf('0x35')]:_0x5c012d[_0xbedf('0x32')];if(!_0x4c866c[_0xbedf('0x33')][_0xbedf('0x38')](_0xbedf('0x39'))){_0x4ca126[_0xbedf('0x1e')]=qs['limit'](_0x4c866c[_0xbedf('0x33')]['limit']);_0x4ca126[_0xbedf('0x1d')]=qs[_0xbedf('0x1d')](_0x4c866c[_0xbedf('0x33')][_0xbedf('0x1d')]);}_0x4ca126[_0xbedf('0x3a')]=qs[_0xbedf('0x3b')](_0x4c866c[_0xbedf('0x33')][_0xbedf('0x3b')]);_0x4ca126[_0xbedf('0x3c')]=qs[_0xbedf('0x3d')](_[_0xbedf('0x3e')](_0x4c866c[_0xbedf('0x33')],_0x5c012d[_0xbedf('0x3d')]),_0x4445e1);if(_0x4c866c[_0xbedf('0x33')]['filter']){_0x4ca126[_0xbedf('0x3c')]=_[_0xbedf('0x3f')](_0x4ca126[_0xbedf('0x3c')],{'$or':_[_0xbedf('0x2d')](_0x4445e1,function(_0x416161){if(_0x416161['type']!==_0xbedf('0x40')){var _0x434938={};_0x434938[_0x416161['name']]={'$like':'%'+_0x4c866c['query'][_0xbedf('0x41')]+'%'};return _0x434938;}})});}_0x4ca126=_['merge']({},_0x4ca126,_0x4c866c['options']);var _0x1c385a={'where':_0x4ca126['where']};return db['MailQueueReport'][_0xbedf('0x1c')](_0x1c385a)[_0xbedf('0x26')](function(_0x384b1a){_0x27eea3['count']=_0x384b1a;if(_0x4c866c[_0xbedf('0x33')]['includeAll']){_0x4ca126[_0xbedf('0x42')]=[{'all':!![]}];}return db[_0xbedf('0x43')][_0xbedf('0x44')](_0x4ca126);})[_0xbedf('0x26')](function(_0x5b017b){_0x27eea3[_0xbedf('0x45')]=_0x5b017b;return _0x27eea3;})['then'](respondWithFilteredResult(_0x473b9d,_0x4ca126))[_0xbedf('0x46')](handleError(_0x473b9d,null));};exports['show']=function(_0x4e7ed6,_0xc007b3){var _0x5d2d56={'raw':!![],'where':{'id':_0x4e7ed6[_0xbedf('0x47')]['id']}},_0x6b4ed5={};_0x6b4ed5[_0xbedf('0x32')]=_[_0xbedf('0x48')](db[_0xbedf('0x43')][_0xbedf('0x2e')]);_0x6b4ed5[_0xbedf('0x33')]=_[_0xbedf('0x48')](_0x4e7ed6[_0xbedf('0x33')]);_0x6b4ed5['filters']=_[_0xbedf('0x34')](_0x6b4ed5[_0xbedf('0x32')],_0x6b4ed5[_0xbedf('0x33')]);_0x5d2d56['attributes']=_[_0xbedf('0x34')](_0x6b4ed5[_0xbedf('0x32')],qs[_0xbedf('0x36')](_0x4e7ed6[_0xbedf('0x33')][_0xbedf('0x36')]));_0x5d2d56[_0xbedf('0x35')]=_0x5d2d56['attributes'][_0xbedf('0x37')]?_0x5d2d56['attributes']:_0x6b4ed5[_0xbedf('0x32')];if(_0x4e7ed6[_0xbedf('0x33')][_0xbedf('0x49')]){_0x5d2d56[_0xbedf('0x42')]=[{'all':!![]}];}_0x5d2d56=_[_0xbedf('0x3f')]({},_0x5d2d56,_0x4e7ed6['options']);return db['MailQueueReport']['find'](_0x5d2d56)[_0xbedf('0x26')](handleEntityNotFound(_0xc007b3,null))[_0xbedf('0x26')](respondWithResult(_0xc007b3,null))[_0xbedf('0x46')](handleError(_0xc007b3,null));};exports['create']=function(_0x3c2e96,_0x4861f4){return db[_0xbedf('0x43')][_0xbedf('0x4a')](_0x3c2e96[_0xbedf('0x4b')],{})[_0xbedf('0x26')](respondWithResult(_0x4861f4,0xc9))['catch'](handleError(_0x4861f4,null));};exports[_0xbedf('0x25')]=function(_0x116b6f,_0x267afb){if(_0x116b6f[_0xbedf('0x4b')]['id']){delete _0x116b6f['body']['id'];}return db['MailQueueReport'][_0xbedf('0x4c')]({'where':{'id':_0x116b6f['params']['id']}})[_0xbedf('0x26')](handleEntityNotFound(_0x267afb,null))[_0xbedf('0x26')](saveUpdates(_0x116b6f[_0xbedf('0x4b')],null))[_0xbedf('0x26')](respondWithResult(_0x267afb,null))[_0xbedf('0x46')](handleError(_0x267afb,null));};exports[_0xbedf('0x27')]=function(_0x3c8c0a,_0xce6af1){return db[_0xbedf('0x43')]['find']({'where':{'id':_0x3c8c0a[_0xbedf('0x47')]['id']}})['then'](handleEntityNotFound(_0xce6af1,null))[_0xbedf('0x26')](removeEntity(_0xce6af1,null))[_0xbedf('0x46')](handleError(_0xce6af1,null));};exports[_0xbedf('0x4d')]=function(_0x3e0e6a,_0x1f3fb5){return db[_0xbedf('0x43')][_0xbedf('0x4d')]()[_0xbedf('0x26')](respondWithResult(_0x1f3fb5,null))['catch'](handleError(_0x1f3fb5,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index e122111..8bcea11 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 _0xbde1=['uniqueid','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x4a2e17,_0x2d1b36){var _0x28b96c=function(_0xc57d81){while(--_0xc57d81){_0x4a2e17['push'](_0x4a2e17['shift']());}};_0x28b96c(++_0x2d1b36);}(_0xbde1,0x6f));var _0x1bde=function(_0x264d27,_0x2c5dae){_0x264d27=_0x264d27-0x0;var _0x31aabc=_0xbde1[_0x264d27];return _0x31aabc;};'use strict';var _=require('lodash');var util=require(_0x1bde('0x0'));var logger=require(_0x1bde('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1bde('0x2'));var rp=require(_0x1bde('0x3'));var fs=require('fs');var path=require(_0x1bde('0x4'));var rimraf=require(_0x1bde('0x5'));var config=require(_0x1bde('0x6'));var attributes=require(_0x1bde('0x7'));module[_0x1bde('0x8')]=function(_0x18a573,_0x2c2507){return _0x18a573['define']('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x1bde('0x9'),'fields':[_0x1bde('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44c5=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util'];(function(_0x1eebe7,_0x2124cf){var _0x4dc17c=function(_0x17bb80){while(--_0x17bb80){_0x1eebe7['push'](_0x1eebe7['shift']());}};_0x4dc17c(++_0x2124cf);}(_0x44c5,0x76));var _0x544c=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x44c5[_0x43a37c];return _0x5d1d40;};'use strict';var _=require(_0x544c('0x0'));var util=require(_0x544c('0x1'));var logger=require(_0x544c('0x2'))(_0x544c('0x3'));var moment=require('moment');var BPromise=require(_0x544c('0x4'));var rp=require(_0x544c('0x5'));var fs=require('fs');var path=require(_0x544c('0x6'));var rimraf=require(_0x544c('0x7'));var config=require(_0x544c('0x8'));var attributes=require(_0x544c('0x9'));module[_0x544c('0xa')]=function(_0xcfd37a,_0x45d35f){return _0xcfd37a[_0x544c('0xb')](_0x544c('0xc'),attributes,{'tableName':_0x544c('0xd'),'paranoid':![],'indexes':[{'name':_0x544c('0xe'),'fields':[_0x544c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8e013f6..a4246b7 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 _0x830a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailQueueReport,\x20%s,\x20%s','message','result','catch','CreateMailQueueReport','create','options','raw','UpdateMailQueueReport','MailQueueReport','update','body','attributes','lodash'];(function(_0x3bd4e5,_0x33854f){var _0x2d1522=function(_0x37e6df){while(--_0x37e6df){_0x3bd4e5['push'](_0x3bd4e5['shift']());}};_0x2d1522(++_0x33854f);}(_0x830a,0x17f));var _0xa830=function(_0x4f1430,_0x2bcfc2){_0x4f1430=_0x4f1430-0x0;var _0x11bb75=_0x830a[_0x4f1430];return _0x11bb75;};'use strict';var _=require(_0xa830('0x0'));var util=require(_0xa830('0x1'));var moment=require(_0xa830('0x2'));var BPromise=require(_0xa830('0x3'));var rs=require(_0xa830('0x4'));var fs=require('fs');var Redis=require(_0xa830('0x5'));var db=require(_0xa830('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa830('0x7'))('rpc');var config=require(_0xa830('0x8'));var jayson=require(_0xa830('0x9'));var client=jayson['client'][_0xa830('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6b77,_0x3c75c1,_0x448599){return new BPromise(function(_0x4b62ee,_0x1dc585){return client[_0xa830('0xb')](_0x3a6b77,_0x448599)[_0xa830('0xc')](function(_0x316006){logger[_0xa830('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x3c75c1,'request\x20sent');logger[_0xa830('0xe')](_0xa830('0xf'),_0x3c75c1,_0xa830('0x10'),JSON[_0xa830('0x11')](_0x316006));if(_0x316006[_0xa830('0x12')]){if(_0x316006[_0xa830('0x12')]['code']===0x1f4){logger[_0xa830('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x3c75c1,_0x316006['error']['message']);return _0x1dc585(_0x316006[_0xa830('0x12')]['message']);}logger[_0xa830('0x12')](_0xa830('0x13'),_0x3c75c1,_0x316006[_0xa830('0x12')]['message']);return _0x4b62ee(_0x316006['error'][_0xa830('0x14')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x3c75c1,_0xa830('0x10'));_0x4b62ee(_0x316006[_0xa830('0x15')][_0xa830('0x14')]);}})[_0xa830('0x16')](function(_0x49a4a9){logger[_0xa830('0x12')](_0xa830('0x13'),_0x3c75c1,_0x49a4a9);_0x1dc585(_0x49a4a9);});});}exports[_0xa830('0x17')]=function(_0x1d86a9){var _0x5cfa09=this;return new Promise(function(_0x30afa5,_0x386559){return db['MailQueueReport'][_0xa830('0x18')](_0x1d86a9['body'],{'raw':_0x1d86a9['options']?_0x1d86a9[_0xa830('0x19')][_0xa830('0x1a')]===undefined?!![]:![]:!![]})[_0xa830('0xc')](function(_0x2b9657){logger[_0xa830('0xd')](_0xa830('0x17'),_0x1d86a9);logger[_0xa830('0xe')](_0xa830('0x17'),_0x1d86a9,JSON[_0xa830('0x11')](_0x2b9657));_0x30afa5(_0x2b9657);})[_0xa830('0x16')](function(_0x4a672f){logger[_0xa830('0x12')]('CreateMailQueueReport',_0x4a672f[_0xa830('0x14')],_0x1d86a9);_0x386559(_0x5cfa09[_0xa830('0x12')](0x1f4,_0x4a672f['message']));});});};exports[_0xa830('0x1b')]=function(_0x2200b8){var _0x32cc18=this;return new Promise(function(_0x255a26,_0x4457f5){return db[_0xa830('0x1c')][_0xa830('0x1d')](_0x2200b8[_0xa830('0x1e')],{'raw':_0x2200b8[_0xa830('0x19')]?_0x2200b8[_0xa830('0x19')][_0xa830('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2200b8['options']?_0x2200b8[_0xa830('0x19')]['where']||null:null,'attributes':_0x2200b8['options']?_0x2200b8[_0xa830('0x19')][_0xa830('0x1f')]||null:null,'limit':_0x2200b8['options']?_0x2200b8['options']['limit']||null:null})[_0xa830('0xc')](function(_0x3626f9){logger[_0xa830('0xd')](_0xa830('0x1b'),_0x2200b8);logger[_0xa830('0xe')](_0xa830('0x1b'),_0x2200b8,JSON[_0xa830('0x11')](_0x3626f9));_0x255a26(_0x3626f9);})[_0xa830('0x16')](function(_0x1331ee){logger[_0xa830('0x12')](_0xa830('0x1b'),_0x1331ee[_0xa830('0x14')],_0x2200b8);_0x4457f5(_0x32cc18[_0xa830('0x12')](0x1f4,_0x1331ee[_0xa830('0x14')]));});});}; \ No newline at end of file +var _0xf148=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','info','attributes','limit','UpdateMailQueueReport','lodash'];(function(_0x3c528e,_0x20c64a){var _0x9fc602=function(_0x989b03){while(--_0x989b03){_0x3c528e['push'](_0x3c528e['shift']());}};_0x9fc602(++_0x20c64a);}(_0xf148,0x11f));var _0x8f14=function(_0x23cf6f,_0x11d345){_0x23cf6f=_0x23cf6f-0x0;var _0xa8eb7a=_0xf148[_0x23cf6f];return _0xa8eb7a;};'use strict';var _=require(_0x8f14('0x0'));var util=require(_0x8f14('0x1'));var moment=require(_0x8f14('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f14('0x3'));var fs=require('fs');var Redis=require(_0x8f14('0x4'));var db=require(_0x8f14('0x5'))['db'];var utils=require(_0x8f14('0x6'));var logger=require(_0x8f14('0x7'))(_0x8f14('0x8'));var config=require(_0x8f14('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5c82,_0x3ee0cc,_0x225912){return new BPromise(function(_0x41103c,_0x5a2939){return client[_0x8f14('0xa')](_0x3b5c82,_0x225912)[_0x8f14('0xb')](function(_0x2116e5){logger['info'](_0x8f14('0xc'),_0x3ee0cc,_0x8f14('0xd'));logger[_0x8f14('0xe')](_0x8f14('0xf'),_0x3ee0cc,_0x8f14('0xd'),JSON[_0x8f14('0x10')](_0x2116e5));if(_0x2116e5[_0x8f14('0x11')]){if(_0x2116e5[_0x8f14('0x11')][_0x8f14('0x12')]===0x1f4){logger[_0x8f14('0x11')](_0x8f14('0xc'),_0x3ee0cc,_0x2116e5[_0x8f14('0x11')]['message']);return _0x5a2939(_0x2116e5[_0x8f14('0x11')][_0x8f14('0x13')]);}logger[_0x8f14('0x11')](_0x8f14('0xc'),_0x3ee0cc,_0x2116e5[_0x8f14('0x11')][_0x8f14('0x13')]);return _0x41103c(_0x2116e5['error']['message']);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x3ee0cc,'request\x20sent');_0x41103c(_0x2116e5[_0x8f14('0x14')][_0x8f14('0x13')]);}})[_0x8f14('0x15')](function(_0x2cac99){logger['error'](_0x8f14('0xc'),_0x3ee0cc,_0x2cac99);_0x5a2939(_0x2cac99);});});}exports[_0x8f14('0x16')]=function(_0x354151){var _0xc2d286=this;return new Promise(function(_0x1714db,_0x244d9a){return db[_0x8f14('0x17')][_0x8f14('0x18')](_0x354151[_0x8f14('0x19')],{'raw':_0x354151[_0x8f14('0x1a')]?_0x354151[_0x8f14('0x1a')][_0x8f14('0x1b')]===undefined?!![]:![]:!![]})[_0x8f14('0xb')](function(_0x4dd31a){logger[_0x8f14('0x1c')](_0x8f14('0x16'),_0x354151);logger[_0x8f14('0xe')](_0x8f14('0x16'),_0x354151,JSON[_0x8f14('0x10')](_0x4dd31a));_0x1714db(_0x4dd31a);})[_0x8f14('0x15')](function(_0x56431b){logger['error'](_0x8f14('0x16'),_0x56431b[_0x8f14('0x13')],_0x354151);_0x244d9a(_0xc2d286['error'](0x1f4,_0x56431b[_0x8f14('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x87b7b6){var _0x5ee143=this;return new Promise(function(_0x15784b,_0x3d6364){return db[_0x8f14('0x17')]['update'](_0x87b7b6[_0x8f14('0x19')],{'raw':_0x87b7b6[_0x8f14('0x1a')]?_0x87b7b6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x87b7b6['options']?_0x87b7b6[_0x8f14('0x1a')]['where']||null:null,'attributes':_0x87b7b6[_0x8f14('0x1a')]?_0x87b7b6['options'][_0x8f14('0x1d')]||null:null,'limit':_0x87b7b6[_0x8f14('0x1a')]?_0x87b7b6[_0x8f14('0x1a')][_0x8f14('0x1e')]||null:null})[_0x8f14('0xb')](function(_0x456372){logger[_0x8f14('0x1c')]('UpdateMailQueueReport',_0x87b7b6);logger[_0x8f14('0xe')]('UpdateMailQueueReport',_0x87b7b6,JSON[_0x8f14('0x10')](_0x456372));_0x15784b(_0x456372);})[_0x8f14('0x15')](function(_0x382f6a){logger[_0x8f14('0x11')](_0x8f14('0x1f'),_0x382f6a['message'],_0x87b7b6);_0x3d6364(_0x5ee143[_0x8f14('0x11')](0x1f4,_0x382f6a[_0x8f14('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 7622b00..1c6e63c 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 _0xf226=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x29ccf8,_0x118a15){var _0x5f08a3=function(_0x29cc16){while(--_0x29cc16){_0x29ccf8['push'](_0x29ccf8['shift']());}};_0x5f08a3(++_0x118a15);}(_0xf226,0x15f));var _0x6f22=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf226[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6f22('0x0'));var util=require('util');var path=require(_0x6f22('0x1'));var timeout=require(_0x6f22('0x2'));var express=require(_0x6f22('0x3'));var router=express[_0x6f22('0x4')]();var auth=require(_0x6f22('0x5'));var interaction=require(_0x6f22('0x6'));var config=require(_0x6f22('0x7'));module[_0x6f22('0x8')]=router; \ No newline at end of file +var _0x0bcd=['../../components/interaction/service','../../config/environment','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x4deba6,_0x290b83){var _0x947b6e=function(_0x3766fe){while(--_0x3766fe){_0x4deba6['push'](_0x4deba6['shift']());}};_0x947b6e(++_0x290b83);}(_0x0bcd,0xa3));var _0xd0bc=function(_0x52f3b4,_0x2bcaec){_0x52f3b4=_0x52f3b4-0x0;var _0x2ac632=_0x0bcd[_0x52f3b4];return _0x2ac632;};'use strict';var multer=require(_0xd0bc('0x0'));var util=require('util');var path=require(_0xd0bc('0x1'));var timeout=require('connect-timeout');var express=require(_0xd0bc('0x2'));var router=express[_0xd0bc('0x3')]();var auth=require(_0xd0bc('0x4'));var interaction=require(_0xd0bc('0x5'));var config=require(_0xd0bc('0x6'));module[_0xd0bc('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 85a2dea..a861ce8 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 _0xc486=['INTEGER','sequelize','STRING','BOOLEAN','username','INBOX'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc486,0x187));var _0x6c48=function(_0x530c53,_0x546020){_0x530c53=_0x530c53-0x0;var _0x5408ca=_0xc486[_0x530c53];return _0x5408ca;};'use strict';var Sequelize=require(_0x6c48('0x0'));module['exports']={'description':{'type':Sequelize[_0x6c48('0x1')]},'host':{'type':Sequelize[_0x6c48('0x1')]},'authentication':{'type':Sequelize[_0x6c48('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x6c48('0x3')},'password':{'type':Sequelize[_0x6c48('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x6c48('0x1')],'defaultValue':_0x6c48('0x4')},'connTimeout':{'type':Sequelize[_0x6c48('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x6c48('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x6c48('0x1')]}}; \ No newline at end of file +var _0x4084=['BOOLEAN','username','INTEGER','sequelize','exports','STRING'];(function(_0x2af952,_0x2fca4b){var _0x158e89=function(_0x5d991b){while(--_0x5d991b){_0x2af952['push'](_0x2af952['shift']());}};_0x158e89(++_0x2fca4b);}(_0x4084,0xc9));var _0x4408=function(_0x3110e5,_0x5daeae){_0x3110e5=_0x3110e5-0x0;var _0x8c9d4=_0x4084[_0x3110e5];return _0x8c9d4;};'use strict';var Sequelize=require(_0x4408('0x0'));module[_0x4408('0x1')]={'description':{'type':Sequelize[_0x4408('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x4408('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4408('0x2')],'unique':_0x4408('0x4')},'password':{'type':Sequelize[_0x4408('0x2')]},'port':{'type':Sequelize[_0x4408('0x5')]},'tls':{'type':Sequelize[_0x4408('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x4408('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 23ddab3..cd57270 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 _0xab40=['rimraf','../../config/environment','define','MailServerIn','mail_servers_in','lodash','util','bluebird','request-promise','path'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0xab40,0xcd));var _0x0ab4=function(_0x1aa57a,_0x360341){_0x1aa57a=_0x1aa57a-0x0;var _0x554a5c=_0xab40[_0x1aa57a];return _0x554a5c;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0ab4('0x2'));var rp=require(_0x0ab4('0x3'));var fs=require('fs');var path=require(_0x0ab4('0x4'));var rimraf=require(_0x0ab4('0x5'));var config=require(_0x0ab4('0x6'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x28b17a,_0x4ba9d2){return _0x28b17a[_0x0ab4('0x7')](_0x0ab4('0x8'),attributes,{'tableName':_0x0ab4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x777d=['./mailServerIn.attributes','define','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5a5139,_0x45b1e3){var _0xec7ba6=function(_0x48f137){while(--_0x48f137){_0x5a5139['push'](_0x5a5139['shift']());}};_0xec7ba6(++_0x45b1e3);}(_0x777d,0xe9));var _0xd777=function(_0x32efcb,_0x55523f){_0x32efcb=_0x32efcb-0x0;var _0x1dae88=_0x777d[_0x32efcb];return _0x1dae88;};'use strict';var _=require('lodash');var util=require(_0xd777('0x0'));var logger=require(_0xd777('0x1'))(_0xd777('0x2'));var moment=require('moment');var BPromise=require(_0xd777('0x3'));var rp=require(_0xd777('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd777('0x5'));module['exports']=function(_0x253dc1,_0x51e918){return _0x253dc1[_0xd777('0x6')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 3c95bcb..b87b168 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 _0xf966=['MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x479bed,_0x5c6bb6){var _0x46fa26=function(_0xbf37d0){while(--_0xbf37d0){_0x479bed['push'](_0x479bed['shift']());}};_0x46fa26(++_0x5c6bb6);}(_0xf966,0xde));var _0x6f96=function(_0xea842a,_0x3d99ad){_0xea842a=_0xea842a-0x0;var _0x5995da=_0xf966[_0xea842a];return _0x5995da;};'use strict';var _=require(_0x6f96('0x0'));var util=require(_0x6f96('0x1'));var moment=require(_0x6f96('0x2'));var BPromise=require(_0x6f96('0x3'));var rs=require(_0x6f96('0x4'));var fs=require('fs');var Redis=require(_0x6f96('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f96('0x6'));var logger=require('../../config/logger')(_0x6f96('0x7'));var config=require(_0x6f96('0x8'));var jayson=require(_0x6f96('0x9'));var client=jayson[_0x6f96('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37e0cc,_0x563781,_0x4d20d7){return new BPromise(function(_0x2340e,_0x1f4577){return client[_0x6f96('0xb')](_0x37e0cc,_0x4d20d7)[_0x6f96('0xc')](function(_0x2163be){logger[_0x6f96('0xd')](_0x6f96('0xe'),_0x563781,_0x6f96('0xf'));logger['debug'](_0x6f96('0x10'),_0x563781,_0x6f96('0xf'),JSON['stringify'](_0x2163be));if(_0x2163be[_0x6f96('0x11')]){if(_0x2163be[_0x6f96('0x11')][_0x6f96('0x12')]===0x1f4){logger[_0x6f96('0x11')](_0x6f96('0xe'),_0x563781,_0x2163be['error']['message']);return _0x1f4577(_0x2163be[_0x6f96('0x11')][_0x6f96('0x13')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x563781,_0x2163be[_0x6f96('0x11')]['message']);return _0x2340e(_0x2163be[_0x6f96('0x11')][_0x6f96('0x13')]);}else{logger[_0x6f96('0xd')]('MailServerIn,\x20%s,\x20%s',_0x563781,_0x6f96('0xf'));_0x2340e(_0x2163be['result']['message']);}})[_0x6f96('0x14')](function(_0x4f7e8a){logger[_0x6f96('0x11')](_0x6f96('0xe'),_0x563781,_0x4f7e8a);_0x1f4577(_0x4f7e8a);});});}exports[_0x6f96('0x15')]=function(_0x4ca3fe){var _0x3cfd2c=this;return new Promise(function(_0x22c278,_0x2dd4b9){return db[_0x6f96('0x16')][_0x6f96('0x17')]({'raw':_0x4ca3fe[_0x6f96('0x18')]?_0x4ca3fe['options'][_0x6f96('0x19')]===undefined?!![]:![]:!![],'where':_0x4ca3fe[_0x6f96('0x18')]?_0x4ca3fe[_0x6f96('0x18')][_0x6f96('0x1a')]||null:null,'attributes':_0x4ca3fe[_0x6f96('0x18')]?_0x4ca3fe[_0x6f96('0x18')][_0x6f96('0x1b')]||null:null,'limit':_0x4ca3fe[_0x6f96('0x18')]?_0x4ca3fe[_0x6f96('0x18')][_0x6f96('0x1c')]||null:null,'include':_0x4ca3fe['options']?_0x4ca3fe[_0x6f96('0x18')][_0x6f96('0x1d')]?_[_0x6f96('0x1e')](_0x4ca3fe[_0x6f96('0x18')][_0x6f96('0x1d')],function(_0x55dfcf){return{'model':db[_0x55dfcf['model']],'as':_0x55dfcf['as'],'attributes':_0x55dfcf[_0x6f96('0x1b')],'include':_0x55dfcf[_0x6f96('0x1d')]?_[_0x6f96('0x1e')](_0x55dfcf[_0x6f96('0x1d')],function(_0x328354){return{'model':db[_0x328354[_0x6f96('0x1f')]],'as':_0x328354['as'],'attributes':_0x328354[_0x6f96('0x1b')],'include':_0x328354[_0x6f96('0x1d')]?_[_0x6f96('0x1e')](_0x328354[_0x6f96('0x1d')],function(_0x2c8fba){return{'model':db[_0x2c8fba['model']],'as':_0x2c8fba['as'],'attributes':_0x2c8fba['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f96('0xc')](function(_0x202f6d){logger[_0x6f96('0xd')](_0x6f96('0x15'),_0x4ca3fe);logger[_0x6f96('0x20')](_0x6f96('0x15'),_0x4ca3fe,JSON[_0x6f96('0x21')](_0x202f6d));_0x22c278(_0x202f6d);})[_0x6f96('0x14')](function(_0x1501c5){logger['error'](_0x6f96('0x15'),_0x1501c5[_0x6f96('0x13')],_0x4ca3fe);_0x2dd4b9(_0x3cfd2c[_0x6f96('0x11')](0x1f4,_0x1501c5[_0x6f96('0x13')]));});});}; \ No newline at end of file +var _0x0f10=['MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','include','model','map','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0f10,0x16c));var _0x00f1=function(_0x556957,_0x3a10dd){_0x556957=_0x556957-0x0;var _0x353dee=_0x0f10[_0x556957];return _0x353dee;};'use strict';var _=require(_0x00f1('0x0'));var util=require(_0x00f1('0x1'));var moment=require('moment');var BPromise=require(_0x00f1('0x2'));var rs=require(_0x00f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00f1('0x4'))['db'];var utils=require(_0x00f1('0x5'));var logger=require(_0x00f1('0x6'))(_0x00f1('0x7'));var config=require('../../config/environment');var jayson=require(_0x00f1('0x8'));var client=jayson[_0x00f1('0x9')][_0x00f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa601dc,_0x33f2c1,_0x4ff66f){return new BPromise(function(_0x2a84fa,_0x5e874c){return client['request'](_0xa601dc,_0x4ff66f)[_0x00f1('0xb')](function(_0x4158c1){logger[_0x00f1('0xc')]('MailServerIn,\x20%s,\x20%s',_0x33f2c1,_0x00f1('0xd'));logger[_0x00f1('0xe')](_0x00f1('0xf'),_0x33f2c1,'request\x20sent',JSON[_0x00f1('0x10')](_0x4158c1));if(_0x4158c1[_0x00f1('0x11')]){if(_0x4158c1[_0x00f1('0x11')][_0x00f1('0x12')]===0x1f4){logger[_0x00f1('0x11')]('MailServerIn,\x20%s,\x20%s',_0x33f2c1,_0x4158c1[_0x00f1('0x11')][_0x00f1('0x13')]);return _0x5e874c(_0x4158c1['error']['message']);}logger[_0x00f1('0x11')](_0x00f1('0x14'),_0x33f2c1,_0x4158c1[_0x00f1('0x11')][_0x00f1('0x13')]);return _0x2a84fa(_0x4158c1[_0x00f1('0x11')]['message']);}else{logger[_0x00f1('0xc')]('MailServerIn,\x20%s,\x20%s',_0x33f2c1,'request\x20sent');_0x2a84fa(_0x4158c1[_0x00f1('0x15')][_0x00f1('0x13')]);}})[_0x00f1('0x16')](function(_0xa19b77){logger[_0x00f1('0x11')](_0x00f1('0x14'),_0x33f2c1,_0xa19b77);_0x5e874c(_0xa19b77);});});}exports[_0x00f1('0x17')]=function(_0x308df3){var _0xb2a08b=this;return new Promise(function(_0x57c868,_0x13cd3c){return db[_0x00f1('0x18')][_0x00f1('0x19')]({'raw':_0x308df3[_0x00f1('0x1a')]?_0x308df3[_0x00f1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x308df3[_0x00f1('0x1a')]?_0x308df3['options'][_0x00f1('0x1b')]||null:null,'attributes':_0x308df3[_0x00f1('0x1a')]?_0x308df3['options'][_0x00f1('0x1c')]||null:null,'limit':_0x308df3[_0x00f1('0x1a')]?_0x308df3['options']['limit']||null:null,'include':_0x308df3[_0x00f1('0x1a')]?_0x308df3[_0x00f1('0x1a')][_0x00f1('0x1d')]?_['map'](_0x308df3[_0x00f1('0x1a')]['include'],function(_0x30cc45){return{'model':db[_0x30cc45[_0x00f1('0x1e')]],'as':_0x30cc45['as'],'attributes':_0x30cc45[_0x00f1('0x1c')],'include':_0x30cc45[_0x00f1('0x1d')]?_[_0x00f1('0x1f')](_0x30cc45[_0x00f1('0x1d')],function(_0x107e91){return{'model':db[_0x107e91[_0x00f1('0x1e')]],'as':_0x107e91['as'],'attributes':_0x107e91[_0x00f1('0x1c')],'include':_0x107e91[_0x00f1('0x1d')]?_[_0x00f1('0x1f')](_0x107e91[_0x00f1('0x1d')],function(_0x4c70){return{'model':db[_0x4c70['model']],'as':_0x4c70['as'],'attributes':_0x4c70[_0x00f1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x00f1('0xb')](function(_0x18ed3a){logger['info'](_0x00f1('0x17'),_0x308df3);logger[_0x00f1('0xe')](_0x00f1('0x17'),_0x308df3,JSON[_0x00f1('0x10')](_0x18ed3a));_0x57c868(_0x18ed3a);})[_0x00f1('0x16')](function(_0x414400){logger[_0x00f1('0x11')]('GetMailServerIn',_0x414400['message'],_0x308df3);_0x13cd3c(_0xb2a08b[_0x00f1('0x11')](0x1f4,_0x414400[_0x00f1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index a808bad..2eb6746 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 _0x23f9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router'];(function(_0x565b61,_0x82f78){var _0x3cd0da=function(_0x250049){while(--_0x250049){_0x565b61['push'](_0x565b61['shift']());}};_0x3cd0da(++_0x82f78);}(_0x23f9,0x81));var _0x923f=function(_0xe37ac,_0x4f1b84){_0xe37ac=_0xe37ac-0x0;var _0x52e052=_0x23f9[_0xe37ac];return _0x52e052;};'use strict';var multer=require(_0x923f('0x0'));var util=require(_0x923f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x923f('0x2'));var router=express[_0x923f('0x3')]();var auth=require(_0x923f('0x4'));var interaction=require(_0x923f('0x5'));var config=require(_0x923f('0x6'));var controller=require(_0x923f('0x7'));router[_0x923f('0x8')]('/',auth[_0x923f('0x9')](),controller[_0x923f('0xa')]);router[_0x923f('0x8')]('/:id',auth[_0x923f('0x9')](),controller['show']);router[_0x923f('0xb')]('/',auth[_0x923f('0x9')](),controller[_0x923f('0xc')]);router[_0x923f('0xd')](_0x923f('0xe'),auth[_0x923f('0x9')](),controller[_0x923f('0xf')]);router[_0x923f('0x10')](_0x923f('0xe'),auth['isAuthenticated'](),controller[_0x923f('0x11')]);module[_0x923f('0x12')]=router; \ No newline at end of file +var _0xc526=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','post','isAuthenticated','update','destroy'];(function(_0x25a065,_0x127082){var _0x4690be=function(_0x299990){while(--_0x299990){_0x25a065['push'](_0x25a065['shift']());}};_0x4690be(++_0x127082);}(_0xc526,0xf1));var _0x6c52=function(_0x1b736c,_0x283f44){_0x1b736c=_0x1b736c-0x0;var _0x18f7da=_0xc526[_0x1b736c];return _0x18f7da;};'use strict';var multer=require('multer');var util=require(_0x6c52('0x0'));var path=require(_0x6c52('0x1'));var timeout=require(_0x6c52('0x2'));var express=require(_0x6c52('0x3'));var router=express['Router']();var auth=require(_0x6c52('0x4'));var interaction=require(_0x6c52('0x5'));var config=require(_0x6c52('0x6'));var controller=require(_0x6c52('0x7'));router[_0x6c52('0x8')]('/',auth['isAuthenticated'](),controller[_0x6c52('0x9')]);router['get'](_0x6c52('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6c52('0xb')]('/',auth[_0x6c52('0xc')](),controller['create']);router['put']('/:id',auth[_0x6c52('0xc')](),controller[_0x6c52('0xd')]);router['delete'](_0x6c52('0xa'),auth[_0x6c52('0xc')](),controller[_0x6c52('0xe')]);module[_0x6c52('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 00bce38..0555c7a 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 _0xfc46=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x5a18c3,_0x5c6928){var _0x3e22e7=function(_0x1cc5a5){while(--_0x1cc5a5){_0x5a18c3['push'](_0x5a18c3['shift']());}};_0x3e22e7(++_0x5c6928);}(_0xfc46,0x9a));var _0x6fc4=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xfc46[_0x18a436];return _0x5c2cf8;};'use strict';var Sequelize=require(_0x6fc4('0x0'));module['exports']={'description':{'type':Sequelize[_0x6fc4('0x1')]},'host':{'type':Sequelize[_0x6fc4('0x1')]},'user':{'type':Sequelize[_0x6fc4('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x6fc4('0x2')]},'secure':{'type':Sequelize[_0x6fc4('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x6fc4('0x1')]},'authentication':{'type':Sequelize[_0x6fc4('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xac41=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0xac41,0xdd));var _0x1ac4=function(_0xa95b36,_0x106e4a){_0xa95b36=_0xa95b36-0x0;var _0x4de65a=_0xac41[_0xa95b36];return _0x4de65a;};'use strict';var Sequelize=require(_0x1ac4('0x0'));module[_0x1ac4('0x1')]={'description':{'type':Sequelize[_0x1ac4('0x2')]},'host':{'type':Sequelize[_0x1ac4('0x2')]},'user':{'type':Sequelize[_0x1ac4('0x2')]},'pass':{'type':Sequelize[_0x1ac4('0x2')]},'port':{'type':Sequelize[_0x1ac4('0x3')]},'secure':{'type':Sequelize[_0x1ac4('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x1ac4('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index ab40128..92db940 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 _0x4874=['rawAttributes','fields','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','send','index','map','MailServerOut','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params'];(function(_0x5b6a53,_0x4e2dd9){var _0x16ef4c=function(_0x5b6037){while(--_0x5b6037){_0x5b6a53['push'](_0x5b6a53['shift']());}};_0x16ef4c(++_0x4e2dd9);}(_0x4874,0x1d3));var _0x4487=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x4874[_0x53ccf2];return _0x5a2964;};'use strict';var pdf=require(_0x4487('0x0'));var emlformat=require(_0x4487('0x1'));var rimraf=require(_0x4487('0x2'));var zipdir=require(_0x4487('0x3'));var jsonpatch=require(_0x4487('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4487('0x5'));var Mustache=require(_0x4487('0x6'));var util=require(_0x4487('0x7'));var path=require(_0x4487('0x8'));var sox=require(_0x4487('0x9'));var csv=require(_0x4487('0xa'));var ejs=require(_0x4487('0xb'));var fs=require('fs');var _=require(_0x4487('0xc'));var squel=require(_0x4487('0xd'));var crypto=require(_0x4487('0xe'));var jsforce=require(_0x4487('0xf'));var deskjs=require(_0x4487('0x10'));var toCsv=require(_0x4487('0xa'));var querystring=require(_0x4487('0x11'));var Papa=require(_0x4487('0x12'));var Redis=require(_0x4487('0x13'));var authService=require(_0x4487('0x14'));var qs=require(_0x4487('0x15'));var as=require(_0x4487('0x16'));var hardwareService=require(_0x4487('0x17'));var logger=require(_0x4487('0x18'))(_0x4487('0x19'));var utils=require(_0x4487('0x1a'));var config=require(_0x4487('0x1b'));var licenseUtil=require(_0x4487('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5becdc,_0x48fb26){_0x48fb26=_0x48fb26||0xcc;return function(_0x326a6a){if(_0x326a6a){return _0x5becdc[_0x4487('0x1d')](_0x48fb26);}return _0x5becdc[_0x4487('0x1e')](_0x48fb26)[_0x4487('0x1f')]();};}function respondWithResult(_0x1e3922,_0x42fd0c){_0x42fd0c=_0x42fd0c||0xc8;return function(_0x387ae1){if(_0x387ae1){return _0x1e3922['status'](_0x42fd0c)[_0x4487('0x20')](_0x387ae1);}};}function respondWithFilteredResult(_0x4217e6,_0x4e2bc0){return function(_0x161b73){if(_0x161b73){var _0x47fa4f=_0x161b73[_0x4487('0x21')],_0x4dbdec=_0x4e2bc0[_0x4487('0x22')],_0x2d6c1e=_0x4e2bc0[_0x4487('0x22')]+_0x4e2bc0[_0x4487('0x23')],_0x374070;if(_0x2d6c1e>=_0x47fa4f){_0x2d6c1e=_0x47fa4f;_0x374070=0xc8;}else{_0x374070=0xce;}_0x4217e6[_0x4487('0x1e')](_0x374070);return _0x4217e6[_0x4487('0x24')](_0x4487('0x25'),_0x4dbdec+'-'+_0x2d6c1e+'/'+_0x47fa4f)[_0x4487('0x20')](_0x161b73);}return null;};}function patchUpdates(_0x3e7289){return function(_0x29b825){try{jsonpatch[_0x4487('0x26')](_0x29b825,_0x3e7289,!![]);}catch(_0x1b6f9c){return BPromise['reject'](_0x1b6f9c);}return _0x29b825[_0x4487('0x27')]();};}function saveUpdates(_0x4166ac,_0x588b8d){return function(_0x413201){if(_0x413201){return _0x413201[_0x4487('0x28')](_0x4166ac)[_0x4487('0x29')](function(_0x978a9c){return _0x978a9c;});}return null;};}function removeEntity(_0x4e9649,_0x548505){return function(_0x2c0444){if(_0x2c0444){return _0x2c0444[_0x4487('0x2a')]()['then'](function(){_0x4e9649[_0x4487('0x1e')](0xcc)[_0x4487('0x1f')]();});}};}function handleEntityNotFound(_0x1d2037,_0x350570){return function(_0x1b11b1){if(!_0x1b11b1){_0x1d2037[_0x4487('0x1d')](0x194);}return _0x1b11b1;};}function handleError(_0x12d392,_0x522ce5){_0x522ce5=_0x522ce5||0x1f4;return function(_0x20efea){logger[_0x4487('0x2b')](_0x20efea['stack']);if(_0x20efea['name']){delete _0x20efea['name'];}_0x12d392[_0x4487('0x1e')](_0x522ce5)[_0x4487('0x2c')](_0x20efea);};}exports[_0x4487('0x2d')]=function(_0xbfdedf,_0x130373){var _0x53759e={},_0x3e2ed4={},_0x482adc={'count':0x0,'rows':[]};var _0x153e26=_[_0x4487('0x2e')](db[_0x4487('0x2f')]['rawAttributes'],function(_0x23a35c){return{'name':_0x23a35c[_0x4487('0x30')],'type':_0x23a35c[_0x4487('0x31')][_0x4487('0x32')]};});_0x3e2ed4[_0x4487('0x33')]=_[_0x4487('0x2e')](_0x153e26,_0x4487('0x34'));_0x3e2ed4[_0x4487('0x35')]=_[_0x4487('0x36')](_0xbfdedf['query']);_0x3e2ed4[_0x4487('0x37')]=_[_0x4487('0x38')](_0x3e2ed4[_0x4487('0x33')],_0x3e2ed4[_0x4487('0x35')]);_0x53759e[_0x4487('0x39')]=_[_0x4487('0x38')](_0x3e2ed4[_0x4487('0x33')],qs['fields'](_0xbfdedf['query']['fields']));_0x53759e[_0x4487('0x39')]=_0x53759e[_0x4487('0x39')][_0x4487('0x3a')]?_0x53759e['attributes']:_0x3e2ed4[_0x4487('0x33')];if(!_0xbfdedf[_0x4487('0x35')][_0x4487('0x3b')]('nolimit')){_0x53759e['limit']=qs[_0x4487('0x23')](_0xbfdedf[_0x4487('0x35')][_0x4487('0x23')]);_0x53759e[_0x4487('0x22')]=qs['offset'](_0xbfdedf[_0x4487('0x35')][_0x4487('0x22')]);}_0x53759e[_0x4487('0x3c')]=qs[_0x4487('0x3d')](_0xbfdedf[_0x4487('0x35')]['sort']);_0x53759e['where']=qs[_0x4487('0x37')](_['pick'](_0xbfdedf[_0x4487('0x35')],_0x3e2ed4[_0x4487('0x37')]),_0x153e26);if(_0xbfdedf[_0x4487('0x35')]['filter']){_0x53759e[_0x4487('0x3e')]=_[_0x4487('0x3f')](_0x53759e[_0x4487('0x3e')],{'$or':_[_0x4487('0x2e')](_0x153e26,function(_0x4bb7f0){if(_0x4bb7f0['type']!==_0x4487('0x40')){var _0x312f50={};_0x312f50[_0x4bb7f0['name']]={'$like':'%'+_0xbfdedf[_0x4487('0x35')][_0x4487('0x41')]+'%'};return _0x312f50;}})});}_0x53759e=_[_0x4487('0x3f')]({},_0x53759e,_0xbfdedf[_0x4487('0x42')]);var _0x174250={'where':_0x53759e[_0x4487('0x3e')]};return db['MailServerOut'][_0x4487('0x21')](_0x174250)[_0x4487('0x29')](function(_0x4836f0){_0x482adc[_0x4487('0x21')]=_0x4836f0;if(_0xbfdedf['query'][_0x4487('0x43')]){_0x53759e[_0x4487('0x44')]=[{'all':!![]}];}return db[_0x4487('0x2f')]['findAll'](_0x53759e);})[_0x4487('0x29')](function(_0x1423d4){_0x482adc[_0x4487('0x45')]=_0x1423d4;return _0x482adc;})[_0x4487('0x29')](respondWithFilteredResult(_0x130373,_0x53759e))[_0x4487('0x46')](handleError(_0x130373,null));};exports['show']=function(_0x555e39,_0x23152c){var _0x58d0b2={'raw':!![],'where':{'id':_0x555e39[_0x4487('0x47')]['id']}},_0x39c187={};_0x39c187['model']=_[_0x4487('0x36')](db[_0x4487('0x2f')][_0x4487('0x48')]);_0x39c187[_0x4487('0x35')]=_['keys'](_0x555e39[_0x4487('0x35')]);_0x39c187[_0x4487('0x37')]=_[_0x4487('0x38')](_0x39c187[_0x4487('0x33')],_0x39c187['query']);_0x58d0b2[_0x4487('0x39')]=_[_0x4487('0x38')](_0x39c187[_0x4487('0x33')],qs['fields'](_0x555e39[_0x4487('0x35')][_0x4487('0x49')]));_0x58d0b2[_0x4487('0x39')]=_0x58d0b2['attributes'][_0x4487('0x3a')]?_0x58d0b2[_0x4487('0x39')]:_0x39c187[_0x4487('0x33')];if(_0x555e39[_0x4487('0x35')][_0x4487('0x43')]){_0x58d0b2[_0x4487('0x44')]=[{'all':!![]}];}_0x58d0b2=_[_0x4487('0x3f')]({},_0x58d0b2,_0x555e39[_0x4487('0x42')]);return db[_0x4487('0x2f')]['find'](_0x58d0b2)[_0x4487('0x29')](handleEntityNotFound(_0x23152c,null))[_0x4487('0x29')](respondWithResult(_0x23152c,null))[_0x4487('0x46')](handleError(_0x23152c,null));};exports['create']=function(_0x8e476c,_0x3b7008){return db[_0x4487('0x2f')][_0x4487('0x4a')](_0x8e476c['body'],{})[_0x4487('0x29')](respondWithResult(_0x3b7008,0xc9))['catch'](handleError(_0x3b7008,null));};exports['update']=function(_0x3de73d,_0x3963e2){if(_0x3de73d[_0x4487('0x4b')]['id']){delete _0x3de73d[_0x4487('0x4b')]['id'];}return db[_0x4487('0x2f')]['find']({'where':{'id':_0x3de73d[_0x4487('0x47')]['id']}})['then'](handleEntityNotFound(_0x3963e2,null))[_0x4487('0x29')](saveUpdates(_0x3de73d[_0x4487('0x4b')],null))[_0x4487('0x29')](respondWithResult(_0x3963e2,null))[_0x4487('0x46')](handleError(_0x3963e2,null));};exports['destroy']=function(_0x42ddb3,_0x2a124e){return db[_0x4487('0x2f')][_0x4487('0x4c')]({'where':{'id':_0x42ddb3[_0x4487('0x47')]['id']}})[_0x4487('0x29')](handleEntityNotFound(_0x2a124e,null))[_0x4487('0x29')](removeEntity(_0x2a124e,null))['catch'](handleError(_0x2a124e,null));}; \ No newline at end of file +var _0x19ed=['fields','includeAll','include','find','create','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/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','attributes','intersection','length','nolimit','order','sort','pick','filters','filter','where','merge','type','options','MailServerOut','findAll','rows','catch','show','params'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x19ed,0xa2));var _0xd19e=function(_0x8c51b6,_0x431aff){_0x8c51b6=_0x8c51b6-0x0;var _0x2fe4b7=_0x19ed[_0x8c51b6];return _0x2fe4b7;};'use strict';var pdf=require(_0xd19e('0x0'));var emlformat=require(_0xd19e('0x1'));var rimraf=require(_0xd19e('0x2'));var zipdir=require(_0xd19e('0x3'));var jsonpatch=require(_0xd19e('0x4'));var rp=require(_0xd19e('0x5'));var moment=require(_0xd19e('0x6'));var BPromise=require(_0xd19e('0x7'));var Mustache=require(_0xd19e('0x8'));var util=require(_0xd19e('0x9'));var path=require(_0xd19e('0xa'));var sox=require(_0xd19e('0xb'));var csv=require(_0xd19e('0xc'));var ejs=require(_0xd19e('0xd'));var fs=require('fs');var _=require(_0xd19e('0xe'));var squel=require(_0xd19e('0xf'));var crypto=require(_0xd19e('0x10'));var jsforce=require(_0xd19e('0x11'));var deskjs=require(_0xd19e('0x12'));var toCsv=require(_0xd19e('0xc'));var querystring=require(_0xd19e('0x13'));var Papa=require(_0xd19e('0x14'));var Redis=require('ioredis');var authService=require(_0xd19e('0x15'));var qs=require(_0xd19e('0x16'));var as=require(_0xd19e('0x17'));var hardwareService=require(_0xd19e('0x18'));var logger=require(_0xd19e('0x19'))('api');var utils=require(_0xd19e('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xd19e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20e56b,_0x308617){_0x308617=_0x308617||0xcc;return function(_0x574ffb){if(_0x574ffb){return _0x20e56b[_0xd19e('0x1c')](_0x308617);}return _0x20e56b[_0xd19e('0x1d')](_0x308617)[_0xd19e('0x1e')]();};}function respondWithResult(_0x74b82f,_0x5d08ba){_0x5d08ba=_0x5d08ba||0xc8;return function(_0x52d9b1){if(_0x52d9b1){return _0x74b82f['status'](_0x5d08ba)[_0xd19e('0x1f')](_0x52d9b1);}};}function respondWithFilteredResult(_0x3ee7d6,_0x1a84ba){return function(_0x57eb77){if(_0x57eb77){var _0x488d08=_0x57eb77[_0xd19e('0x20')],_0x45565b=_0x1a84ba['offset'],_0x3fa8e3=_0x1a84ba[_0xd19e('0x21')]+_0x1a84ba[_0xd19e('0x22')],_0x57f669;if(_0x3fa8e3>=_0x488d08){_0x3fa8e3=_0x488d08;_0x57f669=0xc8;}else{_0x57f669=0xce;}_0x3ee7d6[_0xd19e('0x1d')](_0x57f669);return _0x3ee7d6[_0xd19e('0x23')](_0xd19e('0x24'),_0x45565b+'-'+_0x3fa8e3+'/'+_0x488d08)[_0xd19e('0x1f')](_0x57eb77);}return null;};}function patchUpdates(_0x5fd1c6){return function(_0x4da0d1){try{jsonpatch[_0xd19e('0x25')](_0x4da0d1,_0x5fd1c6,!![]);}catch(_0x13d884){return BPromise[_0xd19e('0x26')](_0x13d884);}return _0x4da0d1[_0xd19e('0x27')]();};}function saveUpdates(_0x3dab4a,_0x197312){return function(_0x703d68){if(_0x703d68){return _0x703d68[_0xd19e('0x28')](_0x3dab4a)[_0xd19e('0x29')](function(_0x2222ef){return _0x2222ef;});}return null;};}function removeEntity(_0x55140f,_0xc26d3f){return function(_0x1587df){if(_0x1587df){return _0x1587df['destroy']()[_0xd19e('0x29')](function(){_0x55140f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c3ef6,_0x3eb9f0){return function(_0x136778){if(!_0x136778){_0x1c3ef6[_0xd19e('0x1c')](0x194);}return _0x136778;};}function handleError(_0x3adb90,_0x5f8dd6){_0x5f8dd6=_0x5f8dd6||0x1f4;return function(_0x103e74){logger[_0xd19e('0x2a')](_0x103e74[_0xd19e('0x2b')]);if(_0x103e74[_0xd19e('0x2c')]){delete _0x103e74[_0xd19e('0x2c')];}_0x3adb90[_0xd19e('0x1d')](_0x5f8dd6)[_0xd19e('0x2d')](_0x103e74);};}exports[_0xd19e('0x2e')]=function(_0x46bfa6,_0x5e025a){var _0x12e758={},_0x27fff3={},_0x4299b1={'count':0x0,'rows':[]};var _0x382104=_[_0xd19e('0x2f')](db['MailServerOut'][_0xd19e('0x30')],function(_0x10df7d){return{'name':_0x10df7d[_0xd19e('0x31')],'type':_0x10df7d['type'][_0xd19e('0x32')]};});_0x27fff3[_0xd19e('0x33')]=_[_0xd19e('0x2f')](_0x382104,'name');_0x27fff3[_0xd19e('0x34')]=_['keys'](_0x46bfa6[_0xd19e('0x34')]);_0x27fff3['filters']=_['intersection'](_0x27fff3['model'],_0x27fff3['query']);_0x12e758[_0xd19e('0x35')]=_[_0xd19e('0x36')](_0x27fff3[_0xd19e('0x33')],qs['fields'](_0x46bfa6['query']['fields']));_0x12e758['attributes']=_0x12e758[_0xd19e('0x35')][_0xd19e('0x37')]?_0x12e758['attributes']:_0x27fff3['model'];if(!_0x46bfa6[_0xd19e('0x34')]['hasOwnProperty'](_0xd19e('0x38'))){_0x12e758[_0xd19e('0x22')]=qs[_0xd19e('0x22')](_0x46bfa6[_0xd19e('0x34')][_0xd19e('0x22')]);_0x12e758[_0xd19e('0x21')]=qs[_0xd19e('0x21')](_0x46bfa6['query'][_0xd19e('0x21')]);}_0x12e758[_0xd19e('0x39')]=qs['sort'](_0x46bfa6[_0xd19e('0x34')][_0xd19e('0x3a')]);_0x12e758['where']=qs['filters'](_[_0xd19e('0x3b')](_0x46bfa6[_0xd19e('0x34')],_0x27fff3[_0xd19e('0x3c')]),_0x382104);if(_0x46bfa6[_0xd19e('0x34')][_0xd19e('0x3d')]){_0x12e758[_0xd19e('0x3e')]=_[_0xd19e('0x3f')](_0x12e758[_0xd19e('0x3e')],{'$or':_[_0xd19e('0x2f')](_0x382104,function(_0x24e6e0){if(_0x24e6e0[_0xd19e('0x40')]!=='VIRTUAL'){var _0x468f98={};_0x468f98[_0x24e6e0[_0xd19e('0x2c')]]={'$like':'%'+_0x46bfa6[_0xd19e('0x34')][_0xd19e('0x3d')]+'%'};return _0x468f98;}})});}_0x12e758=_[_0xd19e('0x3f')]({},_0x12e758,_0x46bfa6[_0xd19e('0x41')]);var _0x2ee783={'where':_0x12e758[_0xd19e('0x3e')]};return db['MailServerOut']['count'](_0x2ee783)[_0xd19e('0x29')](function(_0xddc1bd){_0x4299b1[_0xd19e('0x20')]=_0xddc1bd;if(_0x46bfa6[_0xd19e('0x34')]['includeAll']){_0x12e758['include']=[{'all':!![]}];}return db[_0xd19e('0x42')][_0xd19e('0x43')](_0x12e758);})[_0xd19e('0x29')](function(_0x1c13fc){_0x4299b1[_0xd19e('0x44')]=_0x1c13fc;return _0x4299b1;})[_0xd19e('0x29')](respondWithFilteredResult(_0x5e025a,_0x12e758))[_0xd19e('0x45')](handleError(_0x5e025a,null));};exports[_0xd19e('0x46')]=function(_0x242d94,_0xb3e51a){var _0x491612={'raw':!![],'where':{'id':_0x242d94[_0xd19e('0x47')]['id']}},_0x599518={};_0x599518[_0xd19e('0x33')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x599518[_0xd19e('0x34')]=_['keys'](_0x242d94[_0xd19e('0x34')]);_0x599518['filters']=_[_0xd19e('0x36')](_0x599518['model'],_0x599518[_0xd19e('0x34')]);_0x491612[_0xd19e('0x35')]=_['intersection'](_0x599518[_0xd19e('0x33')],qs[_0xd19e('0x48')](_0x242d94['query'][_0xd19e('0x48')]));_0x491612[_0xd19e('0x35')]=_0x491612['attributes'][_0xd19e('0x37')]?_0x491612[_0xd19e('0x35')]:_0x599518['model'];if(_0x242d94[_0xd19e('0x34')][_0xd19e('0x49')]){_0x491612[_0xd19e('0x4a')]=[{'all':!![]}];}_0x491612=_['merge']({},_0x491612,_0x242d94[_0xd19e('0x41')]);return db[_0xd19e('0x42')][_0xd19e('0x4b')](_0x491612)[_0xd19e('0x29')](handleEntityNotFound(_0xb3e51a,null))[_0xd19e('0x29')](respondWithResult(_0xb3e51a,null))['catch'](handleError(_0xb3e51a,null));};exports[_0xd19e('0x4c')]=function(_0x5d8c34,_0x3926bf){return db[_0xd19e('0x42')][_0xd19e('0x4c')](_0x5d8c34[_0xd19e('0x4d')],{})[_0xd19e('0x29')](respondWithResult(_0x3926bf,0xc9))[_0xd19e('0x45')](handleError(_0x3926bf,null));};exports['update']=function(_0x5e99d9,_0x65835d){if(_0x5e99d9['body']['id']){delete _0x5e99d9['body']['id'];}return db[_0xd19e('0x42')][_0xd19e('0x4b')]({'where':{'id':_0x5e99d9['params']['id']}})[_0xd19e('0x29')](handleEntityNotFound(_0x65835d,null))['then'](saveUpdates(_0x5e99d9['body'],null))[_0xd19e('0x29')](respondWithResult(_0x65835d,null))[_0xd19e('0x45')](handleError(_0x65835d,null));};exports['destroy']=function(_0x452767,_0x2e57e0){return db[_0xd19e('0x42')][_0xd19e('0x4b')]({'where':{'id':_0x452767['params']['id']}})['then'](handleEntityNotFound(_0x2e57e0,null))[_0xd19e('0x29')](removeEntity(_0x2e57e0,null))[_0xd19e('0x45')](handleError(_0x2e57e0,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a79adab..a6f23ae 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 _0xe14b=['bluebird','path','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','moment'];(function(_0xeca40e,_0x389fce){var _0x19b371=function(_0xa6ddb){while(--_0xa6ddb){_0xeca40e['push'](_0xeca40e['shift']());}};_0x19b371(++_0x389fce);}(_0xe14b,0x93));var _0xbe14=function(_0x4003f0,_0x40fd43){_0x4003f0=_0x4003f0-0x0;var _0x2db16b=_0xe14b[_0x4003f0];return _0x2db16b;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x5d40e2,_0x4a967c){var _0x845291=function(_0x59d0dd){while(--_0x59d0dd){_0x5d40e2['push'](_0x5d40e2['shift']());}};_0x845291(++_0x4a967c);}(_0xba34,0x119));var _0x4ba3=function(_0x379cba,_0x5c0a8f){_0x379cba=_0x379cba-0x0;var _0x10862a=_0xba34[_0x379cba];return _0x10862a;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('MailServerOut',attributes,{'tableName':_0x4ba3('0xa'),'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 99303e1..9db93b3 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 _0xa8f0=['http','request','then','info','request\x20sent','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x128b5c,_0x574888){var _0x442f32=function(_0x3c76b6){while(--_0x3c76b6){_0x128b5c['push'](_0x128b5c['shift']());}};_0x442f32(++_0x574888);}(_0xa8f0,0x15f));var _0x0a8f=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0xa8f0[_0x15ea09];return _0x3e9c78;};'use strict';var _=require(_0x0a8f('0x0'));var util=require(_0x0a8f('0x1'));var moment=require('moment');var BPromise=require(_0x0a8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a8f('0x3'));var db=require(_0x0a8f('0x4'))['db'];var utils=require(_0x0a8f('0x5'));var logger=require(_0x0a8f('0x6'))(_0x0a8f('0x7'));var config=require(_0x0a8f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0a8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ac9fd,_0x16a432,_0x3f9ece){return new BPromise(function(_0x5938be,_0x3d85ba){return client[_0x0a8f('0xa')](_0x1ac9fd,_0x3f9ece)[_0x0a8f('0xb')](function(_0x379511){logger[_0x0a8f('0xc')]('MailServerOut,\x20%s,\x20%s',_0x16a432,_0x0a8f('0xd'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0x16a432,_0x0a8f('0xd'),JSON[_0x0a8f('0xe')](_0x379511));if(_0x379511[_0x0a8f('0xf')]){if(_0x379511['error'][_0x0a8f('0x10')]===0x1f4){logger['error'](_0x0a8f('0x11'),_0x16a432,_0x379511[_0x0a8f('0xf')][_0x0a8f('0x12')]);return _0x3d85ba(_0x379511[_0x0a8f('0xf')][_0x0a8f('0x12')]);}logger['error'](_0x0a8f('0x11'),_0x16a432,_0x379511[_0x0a8f('0xf')]['message']);return _0x5938be(_0x379511['error']['message']);}else{logger[_0x0a8f('0xc')](_0x0a8f('0x11'),_0x16a432,_0x0a8f('0xd'));_0x5938be(_0x379511[_0x0a8f('0x13')][_0x0a8f('0x12')]);}})['catch'](function(_0x46a76d){logger[_0x0a8f('0xf')](_0x0a8f('0x11'),_0x16a432,_0x46a76d);_0x3d85ba(_0x46a76d);});});} \ No newline at end of file +var _0x0445=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x1137ac,_0x353892){var _0x2ac89b=function(_0x36993a){while(--_0x36993a){_0x1137ac['push'](_0x1137ac['shift']());}};_0x2ac89b(++_0x353892);}(_0x0445,0xa8));var _0x5044=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0x0445[_0x99ff94];return _0x1b5bc0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5044('0x0'));var rs=require(_0x5044('0x1'));var fs=require('fs');var Redis=require(_0x5044('0x2'));var db=require(_0x5044('0x3'))['db'];var utils=require(_0x5044('0x4'));var logger=require(_0x5044('0x5'))(_0x5044('0x6'));var config=require('../../config/environment');var jayson=require(_0x5044('0x7'));var client=jayson[_0x5044('0x8')][_0x5044('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a5969,_0x16dbfa,_0x9c194c){return new BPromise(function(_0x2c3332,_0x194b24){return client[_0x5044('0xa')](_0x1a5969,_0x9c194c)[_0x5044('0xb')](function(_0x29a823){logger['info'](_0x5044('0xc'),_0x16dbfa,_0x5044('0xd'));logger[_0x5044('0xe')](_0x5044('0xf'),_0x16dbfa,'request\x20sent',JSON[_0x5044('0x10')](_0x29a823));if(_0x29a823[_0x5044('0x11')]){if(_0x29a823[_0x5044('0x11')]['code']===0x1f4){logger[_0x5044('0x11')](_0x5044('0xc'),_0x16dbfa,_0x29a823[_0x5044('0x11')][_0x5044('0x12')]);return _0x194b24(_0x29a823[_0x5044('0x11')][_0x5044('0x12')]);}logger[_0x5044('0x11')]('MailServerOut,\x20%s,\x20%s',_0x16dbfa,_0x29a823[_0x5044('0x11')][_0x5044('0x12')]);return _0x2c3332(_0x29a823[_0x5044('0x11')][_0x5044('0x12')]);}else{logger[_0x5044('0x13')](_0x5044('0xc'),_0x16dbfa,'request\x20sent');_0x2c3332(_0x29a823[_0x5044('0x14')][_0x5044('0x12')]);}})['catch'](function(_0x20c92b){logger[_0x5044('0x11')]('MailServerOut,\x20%s,\x20%s',_0x16dbfa,_0x20c92b);_0x194b24(_0x20c92b);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f7ae856..a1f295d 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 _0xfced=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','create','delete','destroy','exports','multer','util'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0xfced,0x12a));var _0xdfce=function(_0x3ecdc6,_0x5b42ec){_0x3ecdc6=_0x3ecdc6-0x0;var _0x224277=_0xfced[_0x3ecdc6];return _0x224277;};'use strict';var multer=require(_0xdfce('0x0'));var util=require(_0xdfce('0x1'));var path=require(_0xdfce('0x2'));var timeout=require(_0xdfce('0x3'));var express=require(_0xdfce('0x4'));var router=express[_0xdfce('0x5')]();var auth=require(_0xdfce('0x6'));var interaction=require(_0xdfce('0x7'));var config=require(_0xdfce('0x8'));var controller=require(_0xdfce('0x9'));router[_0xdfce('0xa')]('/',auth[_0xdfce('0xb')](),controller['index']);router[_0xdfce('0xa')](_0xdfce('0xc'),auth[_0xdfce('0xb')](),controller[_0xdfce('0xd')]);router[_0xdfce('0xa')](_0xdfce('0xe'),auth[_0xdfce('0xb')](),controller[_0xdfce('0xf')]);router['post']('/',auth[_0xdfce('0xb')](),controller[_0xdfce('0x10')]);router['put']('/:id',auth[_0xdfce('0xb')](),controller['update']);router[_0xdfce('0x11')](_0xdfce('0xe'),auth['isAuthenticated'](),controller[_0xdfce('0x12')]);module[_0xdfce('0x13')]=router; \ No newline at end of file +var _0x8d12=['connect-timeout','express','../../components/auth/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d12,0x9e));var _0x28d1=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x8d12[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x28d1('0x0'));var util=require(_0x28d1('0x1'));var path=require('path');var timeout=require(_0x28d1('0x2'));var express=require(_0x28d1('0x3'));var router=express['Router']();var auth=require(_0x28d1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x28d1('0x5'));router[_0x28d1('0x6')]('/',auth[_0x28d1('0x7')](),controller[_0x28d1('0x8')]);router[_0x28d1('0x6')](_0x28d1('0x9'),auth[_0x28d1('0x7')](),controller[_0x28d1('0xa')]);router[_0x28d1('0x6')](_0x28d1('0xb'),auth['isAuthenticated'](),controller[_0x28d1('0xc')]);router[_0x28d1('0xd')]('/',auth[_0x28d1('0x7')](),controller[_0x28d1('0xe')]);router[_0x28d1('0xf')](_0x28d1('0xb'),auth[_0x28d1('0x7')](),controller[_0x28d1('0x10')]);router[_0x28d1('0x11')](_0x28d1('0xb'),auth['isAuthenticated'](),controller[_0x28d1('0x12')]);module[_0x28d1('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 380375e..1f0fd41 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 _0x97ce=['name','sequelize','exports','STRING'];(function(_0x384b19,_0x3c7aad){var _0x218b5b=function(_0x20686b){while(--_0x20686b){_0x384b19['push'](_0x384b19['shift']());}};_0x218b5b(++_0x3c7aad);}(_0x97ce,0x151));var _0xe97c=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x97ce[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0xe97c('0x0'));module[_0xe97c('0x1')]={'name':{'type':Sequelize[_0xe97c('0x2')],'unique':_0xe97c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf3a8=['exports','STRING'];(function(_0x555337,_0x1559d1){var _0x49b217=function(_0x3cb634){while(--_0x3cb634){_0x555337['push'](_0x555337['shift']());}};_0x49b217(++_0x1559d1);}(_0xf3a8,0xf2));var _0x8f3a=function(_0x25c2dd,_0x686804){_0x25c2dd=_0x25c2dd-0x0;var _0x193894=_0xf3a8[_0x25c2dd];return _0x193894;};'use strict';var Sequelize=require('sequelize');module[_0x8f3a('0x0')]={'name':{'type':Sequelize[_0x8f3a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8f3a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 3f755e3..7b0bc30 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 _0x06a1=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','includeAll','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query'];(function(_0x2c5ff6,_0x3043d6){var _0x4da112=function(_0x5af306){while(--_0x5af306){_0x2c5ff6['push'](_0x2c5ff6['shift']());}};_0x4da112(++_0x3043d6);}(_0x06a1,0x67));var _0x106a=function(_0x1d6bb7,_0x7f712a){_0x1d6bb7=_0x1d6bb7-0x0;var _0x1bb39=_0x06a1[_0x1d6bb7];return _0x1bb39;};'use strict';var pdf=require(_0x106a('0x0'));var emlformat=require(_0x106a('0x1'));var rimraf=require(_0x106a('0x2'));var zipdir=require(_0x106a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x106a('0x4'));var moment=require(_0x106a('0x5'));var BPromise=require(_0x106a('0x6'));var Mustache=require(_0x106a('0x7'));var util=require(_0x106a('0x8'));var path=require(_0x106a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x106a('0xa'));var squel=require(_0x106a('0xb'));var crypto=require(_0x106a('0xc'));var jsforce=require(_0x106a('0xd'));var deskjs=require(_0x106a('0xe'));var toCsv=require(_0x106a('0xf'));var querystring=require(_0x106a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x106a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x106a('0x12'));var hardwareService=require(_0x106a('0x13'));var logger=require('../../config/logger')(_0x106a('0x14'));var utils=require(_0x106a('0x15'));var config=require(_0x106a('0x16'));var licenseUtil=require(_0x106a('0x17'));var db=require(_0x106a('0x18'))['db'];function respondWithStatusCode(_0x8fac35,_0x593421){_0x593421=_0x593421||0xcc;return function(_0x5ba5d2){if(_0x5ba5d2){return _0x8fac35['sendStatus'](_0x593421);}return _0x8fac35[_0x106a('0x19')](_0x593421)[_0x106a('0x1a')]();};}function respondWithResult(_0x2d6da9,_0x16ed82){_0x16ed82=_0x16ed82||0xc8;return function(_0xdb4cc2){if(_0xdb4cc2){return _0x2d6da9[_0x106a('0x19')](_0x16ed82)[_0x106a('0x1b')](_0xdb4cc2);}};}function respondWithFilteredResult(_0xde448a,_0x397164){return function(_0x30e10d){if(_0x30e10d){var _0x142882=_0x30e10d['count'],_0x18c2cd=_0x397164[_0x106a('0x1c')],_0xbc99f8=_0x397164[_0x106a('0x1c')]+_0x397164[_0x106a('0x1d')],_0x8df647;if(_0xbc99f8>=_0x142882){_0xbc99f8=_0x142882;_0x8df647=0xc8;}else{_0x8df647=0xce;}_0xde448a[_0x106a('0x19')](_0x8df647);return _0xde448a[_0x106a('0x1e')](_0x106a('0x1f'),_0x18c2cd+'-'+_0xbc99f8+'/'+_0x142882)[_0x106a('0x1b')](_0x30e10d);}return null;};}function patchUpdates(_0x4dce2e){return function(_0x65c9c1){try{jsonpatch['apply'](_0x65c9c1,_0x4dce2e,!![]);}catch(_0x5c2d0a){return BPromise[_0x106a('0x20')](_0x5c2d0a);}return _0x65c9c1[_0x106a('0x21')]();};}function saveUpdates(_0x45d224,_0x5dc884){return function(_0x8c6eed){if(_0x8c6eed){return _0x8c6eed[_0x106a('0x22')](_0x45d224)[_0x106a('0x23')](function(_0x322829){return _0x322829;});}return null;};}function removeEntity(_0x41f92d,_0x58ed85){return function(_0x58bc6d){if(_0x58bc6d){return _0x58bc6d[_0x106a('0x24')]()['then'](function(){_0x41f92d[_0x106a('0x19')](0xcc)[_0x106a('0x1a')]();});}};}function handleEntityNotFound(_0x46bddf,_0x2688a3){return function(_0x20710f){if(!_0x20710f){_0x46bddf[_0x106a('0x25')](0x194);}return _0x20710f;};}function handleError(_0x4f2817,_0x14a3d4){_0x14a3d4=_0x14a3d4||0x1f4;return function(_0x4a73a9){logger[_0x106a('0x26')](_0x4a73a9[_0x106a('0x27')]);if(_0x4a73a9[_0x106a('0x28')]){delete _0x4a73a9[_0x106a('0x28')];}_0x4f2817[_0x106a('0x19')](_0x14a3d4)[_0x106a('0x29')](_0x4a73a9);};}exports[_0x106a('0x2a')]=function(_0xfa7267,_0x5cd840){var _0x58e65d={},_0x2df167={},_0x2a9730={'count':0x0,'rows':[]};var _0x32c12a=_[_0x106a('0x2b')](db[_0x106a('0x2c')][_0x106a('0x2d')],function(_0x50545b){return{'name':_0x50545b[_0x106a('0x2e')],'type':_0x50545b[_0x106a('0x2f')][_0x106a('0x30')]};});_0x2df167[_0x106a('0x31')]=_[_0x106a('0x2b')](_0x32c12a,_0x106a('0x28'));_0x2df167[_0x106a('0x32')]=_[_0x106a('0x33')](_0xfa7267[_0x106a('0x32')]);_0x2df167[_0x106a('0x34')]=_[_0x106a('0x35')](_0x2df167['model'],_0x2df167[_0x106a('0x32')]);_0x58e65d[_0x106a('0x36')]=_[_0x106a('0x35')](_0x2df167[_0x106a('0x31')],qs[_0x106a('0x37')](_0xfa7267['query'][_0x106a('0x37')]));_0x58e65d[_0x106a('0x36')]=_0x58e65d[_0x106a('0x36')][_0x106a('0x38')]?_0x58e65d[_0x106a('0x36')]:_0x2df167[_0x106a('0x31')];if(!_0xfa7267[_0x106a('0x32')][_0x106a('0x39')](_0x106a('0x3a'))){_0x58e65d[_0x106a('0x1d')]=qs['limit'](_0xfa7267[_0x106a('0x32')][_0x106a('0x1d')]);_0x58e65d[_0x106a('0x1c')]=qs['offset'](_0xfa7267[_0x106a('0x32')]['offset']);}_0x58e65d[_0x106a('0x3b')]=qs[_0x106a('0x3c')](_0xfa7267[_0x106a('0x32')][_0x106a('0x3c')]);_0x58e65d[_0x106a('0x3d')]=qs['filters'](_['pick'](_0xfa7267['query'],_0x2df167[_0x106a('0x34')]),_0x32c12a);if(_0xfa7267[_0x106a('0x32')][_0x106a('0x3e')]){_0x58e65d[_0x106a('0x3d')]=_[_0x106a('0x3f')](_0x58e65d[_0x106a('0x3d')],{'$or':_[_0x106a('0x2b')](_0x32c12a,function(_0x3656e5){if(_0x3656e5['type']!==_0x106a('0x40')){var _0x1ff9ae={};_0x1ff9ae[_0x3656e5[_0x106a('0x28')]]={'$like':'%'+_0xfa7267[_0x106a('0x32')][_0x106a('0x3e')]+'%'};return _0x1ff9ae;}})});}_0x58e65d=_[_0x106a('0x3f')]({},_0x58e65d,_0xfa7267[_0x106a('0x41')]);var _0x27c343={'where':_0x58e65d['where']};return db[_0x106a('0x2c')]['count'](_0x27c343)[_0x106a('0x23')](function(_0x2ca694){_0x2a9730[_0x106a('0x42')]=_0x2ca694;if(_0xfa7267['query']['includeAll']){_0x58e65d[_0x106a('0x43')]=[{'all':!![]}];}return db['MailSubstatus'][_0x106a('0x44')](_0x58e65d);})[_0x106a('0x23')](function(_0x35e982){_0x2a9730[_0x106a('0x45')]=_0x35e982;return _0x2a9730;})[_0x106a('0x23')](respondWithFilteredResult(_0x5cd840,_0x58e65d))['catch'](handleError(_0x5cd840,null));};exports[_0x106a('0x46')]=function(_0x2a4cd4,_0x17d161){var _0x188efb={'raw':!![],'where':{'id':_0x2a4cd4[_0x106a('0x47')]['id']}},_0x30f185={};_0x30f185['model']=_[_0x106a('0x33')](db[_0x106a('0x2c')]['rawAttributes']);_0x30f185['query']=_[_0x106a('0x33')](_0x2a4cd4[_0x106a('0x32')]);_0x30f185['filters']=_[_0x106a('0x35')](_0x30f185[_0x106a('0x31')],_0x30f185['query']);_0x188efb[_0x106a('0x36')]=_[_0x106a('0x35')](_0x30f185[_0x106a('0x31')],qs['fields'](_0x2a4cd4[_0x106a('0x32')][_0x106a('0x37')]));_0x188efb[_0x106a('0x36')]=_0x188efb[_0x106a('0x36')]['length']?_0x188efb[_0x106a('0x36')]:_0x30f185['model'];if(_0x2a4cd4[_0x106a('0x32')][_0x106a('0x48')]){_0x188efb[_0x106a('0x43')]=[{'all':!![]}];}_0x188efb=_['merge']({},_0x188efb,_0x2a4cd4[_0x106a('0x41')]);return db['MailSubstatus'][_0x106a('0x49')](_0x188efb)[_0x106a('0x23')](handleEntityNotFound(_0x17d161,null))[_0x106a('0x23')](respondWithResult(_0x17d161,null))[_0x106a('0x4a')](handleError(_0x17d161,null));};exports[_0x106a('0x4b')]=function(_0x3f93fe,_0xccbc9e){return db[_0x106a('0x2c')][_0x106a('0x4b')](_0x3f93fe[_0x106a('0x4c')],{})[_0x106a('0x23')](respondWithResult(_0xccbc9e,0xc9))[_0x106a('0x4a')](handleError(_0xccbc9e,null));};exports[_0x106a('0x22')]=function(_0x2a8636,_0x5182d0){if(_0x2a8636['body']['id']){delete _0x2a8636[_0x106a('0x4c')]['id'];}return db[_0x106a('0x2c')]['find']({'where':{'id':_0x2a8636['params']['id']}})[_0x106a('0x23')](handleEntityNotFound(_0x5182d0,null))['then'](saveUpdates(_0x2a8636[_0x106a('0x4c')],null))[_0x106a('0x23')](respondWithResult(_0x5182d0,null))[_0x106a('0x4a')](handleError(_0x5182d0,null));};exports[_0x106a('0x24')]=function(_0x1832f0,_0xe5fa54){return db[_0x106a('0x2c')][_0x106a('0x49')]({'where':{'id':_0x1832f0[_0x106a('0x47')]['id']}})[_0x106a('0x23')](handleEntityNotFound(_0xe5fa54,null))[_0x106a('0x23')](removeEntity(_0xe5fa54,null))['catch'](handleError(_0xe5fa54,null));};exports['describe']=function(_0x3adb77,_0x44d60f){return db[_0x106a('0x2c')]['describe']()[_0x106a('0x23')](respondWithResult(_0x44d60f,null))[_0x106a('0x4a')](handleError(_0x44d60f,null));}; \ No newline at end of file +var _0x4fcb=['MailSubstatus','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','map'];(function(_0x424329,_0x1a3e61){var _0x324625=function(_0x3e2ce2){while(--_0x3e2ce2){_0x424329['push'](_0x424329['shift']());}};_0x324625(++_0x1a3e61);}(_0x4fcb,0x102));var _0xb4fc=function(_0x586362,_0x20d7b7){_0x586362=_0x586362-0x0;var _0x2edefe=_0x4fcb[_0x586362];return _0x2edefe;};'use strict';var pdf=require(_0xb4fc('0x0'));var emlformat=require(_0xb4fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb4fc('0x2'));var jsonpatch=require(_0xb4fc('0x3'));var rp=require(_0xb4fc('0x4'));var moment=require(_0xb4fc('0x5'));var BPromise=require(_0xb4fc('0x6'));var Mustache=require(_0xb4fc('0x7'));var util=require(_0xb4fc('0x8'));var path=require('path');var sox=require(_0xb4fc('0x9'));var csv=require(_0xb4fc('0xa'));var ejs=require(_0xb4fc('0xb'));var fs=require('fs');var _=require(_0xb4fc('0xc'));var squel=require(_0xb4fc('0xd'));var crypto=require(_0xb4fc('0xe'));var jsforce=require(_0xb4fc('0xf'));var deskjs=require(_0xb4fc('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb4fc('0x11'));var Papa=require(_0xb4fc('0x12'));var Redis=require('ioredis');var authService=require(_0xb4fc('0x13'));var qs=require(_0xb4fc('0x14'));var as=require(_0xb4fc('0x15'));var hardwareService=require(_0xb4fc('0x16'));var logger=require(_0xb4fc('0x17'))(_0xb4fc('0x18'));var utils=require(_0xb4fc('0x19'));var config=require(_0xb4fc('0x1a'));var licenseUtil=require(_0xb4fc('0x1b'));var db=require(_0xb4fc('0x1c'))['db'];function respondWithStatusCode(_0x16c8ab,_0x1de020){_0x1de020=_0x1de020||0xcc;return function(_0x59f1b2){if(_0x59f1b2){return _0x16c8ab['sendStatus'](_0x1de020);}return _0x16c8ab['status'](_0x1de020)[_0xb4fc('0x1d')]();};}function respondWithResult(_0x173a4b,_0x2e41b7){_0x2e41b7=_0x2e41b7||0xc8;return function(_0x26b908){if(_0x26b908){return _0x173a4b[_0xb4fc('0x1e')](_0x2e41b7)[_0xb4fc('0x1f')](_0x26b908);}};}function respondWithFilteredResult(_0x3b183f,_0x2b7fcf){return function(_0x55ca00){if(_0x55ca00){var _0x5d0f03=_0x55ca00[_0xb4fc('0x20')],_0x3af3b4=_0x2b7fcf[_0xb4fc('0x21')],_0x2d0faa=_0x2b7fcf['offset']+_0x2b7fcf[_0xb4fc('0x22')],_0x2c2b21;if(_0x2d0faa>=_0x5d0f03){_0x2d0faa=_0x5d0f03;_0x2c2b21=0xc8;}else{_0x2c2b21=0xce;}_0x3b183f[_0xb4fc('0x1e')](_0x2c2b21);return _0x3b183f[_0xb4fc('0x23')](_0xb4fc('0x24'),_0x3af3b4+'-'+_0x2d0faa+'/'+_0x5d0f03)[_0xb4fc('0x1f')](_0x55ca00);}return null;};}function patchUpdates(_0x22b35b){return function(_0x26293b){try{jsonpatch['apply'](_0x26293b,_0x22b35b,!![]);}catch(_0x5d46e7){return BPromise[_0xb4fc('0x25')](_0x5d46e7);}return _0x26293b[_0xb4fc('0x26')]();};}function saveUpdates(_0x3488bd,_0x2319a8){return function(_0x46aae6){if(_0x46aae6){return _0x46aae6['update'](_0x3488bd)[_0xb4fc('0x27')](function(_0x47aa12){return _0x47aa12;});}return null;};}function removeEntity(_0x31b2b0,_0x1a5315){return function(_0x59747e){if(_0x59747e){return _0x59747e[_0xb4fc('0x28')]()[_0xb4fc('0x27')](function(){_0x31b2b0['status'](0xcc)[_0xb4fc('0x1d')]();});}};}function handleEntityNotFound(_0x2683ff,_0x50b5e0){return function(_0x481bb3){if(!_0x481bb3){_0x2683ff[_0xb4fc('0x29')](0x194);}return _0x481bb3;};}function handleError(_0xb8f598,_0x554e69){_0x554e69=_0x554e69||0x1f4;return function(_0x555640){logger[_0xb4fc('0x2a')](_0x555640[_0xb4fc('0x2b')]);if(_0x555640[_0xb4fc('0x2c')]){delete _0x555640['name'];}_0xb8f598['status'](_0x554e69)['send'](_0x555640);};}exports['index']=function(_0x5e9f84,_0x1b4965){var _0x418b37={},_0x47a138={},_0x436fde={'count':0x0,'rows':[]};var _0x5d6413=_[_0xb4fc('0x2d')](db[_0xb4fc('0x2e')]['rawAttributes'],function(_0x480d48){return{'name':_0x480d48[_0xb4fc('0x2f')],'type':_0x480d48['type']['key']};});_0x47a138[_0xb4fc('0x30')]=_[_0xb4fc('0x2d')](_0x5d6413,_0xb4fc('0x2c'));_0x47a138[_0xb4fc('0x31')]=_[_0xb4fc('0x32')](_0x5e9f84[_0xb4fc('0x31')]);_0x47a138[_0xb4fc('0x33')]=_[_0xb4fc('0x34')](_0x47a138[_0xb4fc('0x30')],_0x47a138['query']);_0x418b37[_0xb4fc('0x35')]=_['intersection'](_0x47a138[_0xb4fc('0x30')],qs[_0xb4fc('0x36')](_0x5e9f84[_0xb4fc('0x31')][_0xb4fc('0x36')]));_0x418b37[_0xb4fc('0x35')]=_0x418b37['attributes'][_0xb4fc('0x37')]?_0x418b37[_0xb4fc('0x35')]:_0x47a138['model'];if(!_0x5e9f84[_0xb4fc('0x31')]['hasOwnProperty'](_0xb4fc('0x38'))){_0x418b37['limit']=qs[_0xb4fc('0x22')](_0x5e9f84['query'][_0xb4fc('0x22')]);_0x418b37[_0xb4fc('0x21')]=qs[_0xb4fc('0x21')](_0x5e9f84[_0xb4fc('0x31')][_0xb4fc('0x21')]);}_0x418b37['order']=qs[_0xb4fc('0x39')](_0x5e9f84[_0xb4fc('0x31')]['sort']);_0x418b37[_0xb4fc('0x3a')]=qs[_0xb4fc('0x33')](_[_0xb4fc('0x3b')](_0x5e9f84[_0xb4fc('0x31')],_0x47a138[_0xb4fc('0x33')]),_0x5d6413);if(_0x5e9f84[_0xb4fc('0x31')][_0xb4fc('0x3c')]){_0x418b37[_0xb4fc('0x3a')]=_[_0xb4fc('0x3d')](_0x418b37[_0xb4fc('0x3a')],{'$or':_[_0xb4fc('0x2d')](_0x5d6413,function(_0x48e4f7){if(_0x48e4f7[_0xb4fc('0x3e')]!==_0xb4fc('0x3f')){var _0x36287b={};_0x36287b[_0x48e4f7['name']]={'$like':'%'+_0x5e9f84[_0xb4fc('0x31')][_0xb4fc('0x3c')]+'%'};return _0x36287b;}})});}_0x418b37=_[_0xb4fc('0x3d')]({},_0x418b37,_0x5e9f84[_0xb4fc('0x40')]);var _0x3cfbd3={'where':_0x418b37[_0xb4fc('0x3a')]};return db['MailSubstatus'][_0xb4fc('0x20')](_0x3cfbd3)['then'](function(_0x1e3098){_0x436fde[_0xb4fc('0x20')]=_0x1e3098;if(_0x5e9f84[_0xb4fc('0x31')][_0xb4fc('0x41')]){_0x418b37[_0xb4fc('0x42')]=[{'all':!![]}];}return db[_0xb4fc('0x2e')][_0xb4fc('0x43')](_0x418b37);})[_0xb4fc('0x27')](function(_0x5fe403){_0x436fde[_0xb4fc('0x44')]=_0x5fe403;return _0x436fde;})[_0xb4fc('0x27')](respondWithFilteredResult(_0x1b4965,_0x418b37))[_0xb4fc('0x45')](handleError(_0x1b4965,null));};exports['show']=function(_0x16fbe7,_0x152c96){var _0x2cd3c6={'raw':!![],'where':{'id':_0x16fbe7[_0xb4fc('0x46')]['id']}},_0x4d1f42={};_0x4d1f42[_0xb4fc('0x30')]=_[_0xb4fc('0x32')](db['MailSubstatus'][_0xb4fc('0x47')]);_0x4d1f42[_0xb4fc('0x31')]=_[_0xb4fc('0x32')](_0x16fbe7[_0xb4fc('0x31')]);_0x4d1f42[_0xb4fc('0x33')]=_[_0xb4fc('0x34')](_0x4d1f42[_0xb4fc('0x30')],_0x4d1f42[_0xb4fc('0x31')]);_0x2cd3c6[_0xb4fc('0x35')]=_[_0xb4fc('0x34')](_0x4d1f42[_0xb4fc('0x30')],qs[_0xb4fc('0x36')](_0x16fbe7[_0xb4fc('0x31')][_0xb4fc('0x36')]));_0x2cd3c6['attributes']=_0x2cd3c6[_0xb4fc('0x35')][_0xb4fc('0x37')]?_0x2cd3c6['attributes']:_0x4d1f42[_0xb4fc('0x30')];if(_0x16fbe7['query']['includeAll']){_0x2cd3c6[_0xb4fc('0x42')]=[{'all':!![]}];}_0x2cd3c6=_[_0xb4fc('0x3d')]({},_0x2cd3c6,_0x16fbe7[_0xb4fc('0x40')]);return db['MailSubstatus'][_0xb4fc('0x48')](_0x2cd3c6)[_0xb4fc('0x27')](handleEntityNotFound(_0x152c96,null))[_0xb4fc('0x27')](respondWithResult(_0x152c96,null))[_0xb4fc('0x45')](handleError(_0x152c96,null));};exports[_0xb4fc('0x49')]=function(_0x11d420,_0x12f5a1){return db[_0xb4fc('0x2e')][_0xb4fc('0x49')](_0x11d420[_0xb4fc('0x4a')],{})[_0xb4fc('0x27')](respondWithResult(_0x12f5a1,0xc9))[_0xb4fc('0x45')](handleError(_0x12f5a1,null));};exports['update']=function(_0x7586d8,_0x568ac9){if(_0x7586d8['body']['id']){delete _0x7586d8[_0xb4fc('0x4a')]['id'];}return db[_0xb4fc('0x2e')][_0xb4fc('0x48')]({'where':{'id':_0x7586d8[_0xb4fc('0x46')]['id']}})[_0xb4fc('0x27')](handleEntityNotFound(_0x568ac9,null))[_0xb4fc('0x27')](saveUpdates(_0x7586d8[_0xb4fc('0x4a')],null))[_0xb4fc('0x27')](respondWithResult(_0x568ac9,null))[_0xb4fc('0x45')](handleError(_0x568ac9,null));};exports[_0xb4fc('0x28')]=function(_0x520900,_0x5b9633){return db[_0xb4fc('0x2e')][_0xb4fc('0x48')]({'where':{'id':_0x520900[_0xb4fc('0x46')]['id']}})[_0xb4fc('0x27')](handleEntityNotFound(_0x5b9633,null))['then'](removeEntity(_0x5b9633,null))[_0xb4fc('0x45')](handleError(_0x5b9633,null));};exports[_0xb4fc('0x4b')]=function(_0x31b9ab,_0x21dc92){return db[_0xb4fc('0x2e')][_0xb4fc('0x4b')]()[_0xb4fc('0x27')](respondWithResult(_0x21dc92,null))[_0xb4fc('0x45')](handleError(_0x21dc92,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5466681..de85c42 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 _0x09df=['../../config/environment','./mailSubstatus.attributes','define','mail_substatuses','lodash','util','api','request-promise'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x09df,0x164));var _0xf09d=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x09df[_0x4ce028];return _0x583d0c;};'use strict';var _=require(_0xf09d('0x0'));var util=require(_0xf09d('0x1'));var logger=require('../../config/logger')(_0xf09d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf09d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf09d('0x4'));var attributes=require(_0xf09d('0x5'));module['exports']=function(_0x4db4e7,_0x4b452b){return _0x4db4e7[_0xf09d('0x6')]('MailSubstatus',attributes,{'tableName':_0xf09d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0e4=['rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x1b07c0,_0x2a7322){var _0xe57578=function(_0x37fc87){while(--_0x37fc87){_0x1b07c0['push'](_0x1b07c0['shift']());}};_0xe57578(++_0x2a7322);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x1698f6,_0x441e4b){_0x1698f6=_0x1698f6-0x0;var _0x11d58f=_0xd0e4[_0x1698f6];return _0x11d58f;};'use strict';var _=require(_0x4d0e('0x0'));var util=require(_0x4d0e('0x1'));var logger=require(_0x4d0e('0x2'))(_0x4d0e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d0e('0x4'));var fs=require('fs');var path=require(_0x4d0e('0x5'));var rimraf=require(_0x4d0e('0x6'));var config=require(_0x4d0e('0x7'));var attributes=require(_0x4d0e('0x8'));module['exports']=function(_0x588895,_0x5be772){return _0x588895[_0x4d0e('0x9')](_0x4d0e('0xa'),attributes,{'tableName':'mail_substatuses','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 bf47c7e..378155a 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 _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x186d11,_0x290d2e){var _0x3621dd=function(_0x3d356a){while(--_0x3d356a){_0x186d11['push'](_0x186d11['shift']());}};_0x3621dd(++_0x290d2e);}(_0xda55,0x6d));var _0x5da5=function(_0xb247e3,_0x1319d1){_0xb247e3=_0xb247e3-0x0;var _0x57fb7b=_0xda55[_0xb247e3];return _0x57fb7b;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result'];(function(_0x186e7c,_0x542c10){var _0x1715e3=function(_0x165e08){while(--_0x165e08){_0x186e7c['push'](_0x186e7c['shift']());}};_0x1715e3(++_0x542c10);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x556a99,_0x3d0574){_0x556a99=_0x556a99-0x0;var _0x45a65a=_0xf3cd[_0x556a99];return _0x45a65a;};'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')]('MailSubstatus,\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')]('MailSubstatus,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 42cbc7d..cf8168d 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 _0xbf29=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x5dcb8e,_0x29c8a8){var _0x109f69=function(_0x17bd71){while(--_0x17bd71){_0x5dcb8e['push'](_0x5dcb8e['shift']());}};_0x109f69(++_0x29c8a8);}(_0xbf29,0x93));var _0x9bf2=function(_0x38669a,_0x3369e2){_0x38669a=_0x38669a-0x0;var _0x3fee1d=_0xbf29[_0x38669a];return _0x3fee1d;};'use strict';var multer=require(_0x9bf2('0x0'));var util=require('util');var path=require(_0x9bf2('0x1'));var timeout=require(_0x9bf2('0x2'));var express=require(_0x9bf2('0x3'));var router=express['Router']();var auth=require(_0x9bf2('0x4'));var interaction=require(_0x9bf2('0x5'));var config=require(_0x9bf2('0x6'));var controller=require(_0x9bf2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9bf2('0x8')]);router[_0x9bf2('0x9')](_0x9bf2('0xa'),auth[_0x9bf2('0xb')](),controller[_0x9bf2('0xc')]);router[_0x9bf2('0x9')](_0x9bf2('0xd'),auth[_0x9bf2('0xb')](),controller[_0x9bf2('0xe')]);router[_0x9bf2('0xf')]('/',auth['isAuthenticated'](),controller[_0x9bf2('0x10')]);router['put'](_0x9bf2('0xd'),auth[_0x9bf2('0xb')](),controller[_0x9bf2('0x11')]);router[_0x9bf2('0x12')]('/:id',auth[_0x9bf2('0xb')](),controller[_0x9bf2('0x13')]);module[_0x9bf2('0x14')]=router; \ No newline at end of file +var _0xbfec=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0xbfec,0xf7));var _0xcbfe=function(_0x2e44d9,_0x47ecdb){_0x2e44d9=_0x2e44d9-0x0;var _0x3ddf6b=_0xbfec[_0x2e44d9];return _0x3ddf6b;};'use strict';var multer=require(_0xcbfe('0x0'));var util=require(_0xcbfe('0x1'));var path=require(_0xcbfe('0x2'));var timeout=require(_0xcbfe('0x3'));var express=require('express');var router=express[_0xcbfe('0x4')]();var auth=require(_0xcbfe('0x5'));var interaction=require(_0xcbfe('0x6'));var config=require(_0xcbfe('0x7'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xcbfe('0x8')](),controller['index']);router[_0xcbfe('0x9')](_0xcbfe('0xa'),auth[_0xcbfe('0x8')](),controller[_0xcbfe('0xb')]);router[_0xcbfe('0x9')](_0xcbfe('0xc'),auth[_0xcbfe('0x8')](),controller[_0xcbfe('0xd')]);router[_0xcbfe('0xe')]('/',auth[_0xcbfe('0x8')](),controller[_0xcbfe('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xcbfe('0x10')]);router[_0xcbfe('0x11')](_0xcbfe('0xc'),auth[_0xcbfe('0x8')](),controller[_0xcbfe('0x12')]);module[_0xcbfe('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 3352555..a6400cd 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 _0xc436=['moment','sequelize','STRING','ENUM','account','agent','queue','DATE'];(function(_0x344ee5,_0x4eefb3){var _0x1c8d4a=function(_0x1e749c){while(--_0x1e749c){_0x344ee5['push'](_0x344ee5['shift']());}};_0x1c8d4a(++_0x4eefb3);}(_0xc436,0x1b0));var _0x6c43=function(_0x137ee9,_0x1aeb2b){_0x137ee9=_0x137ee9-0x0;var _0x373e15=_0xc436[_0x137ee9];return _0x373e15;};'use strict';var moment=require(_0x6c43('0x0'));var Sequelize=require(_0x6c43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6c43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6c43('0x3')](_0x6c43('0x4'),_0x6c43('0x5'),_0x6c43('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x6c43('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xcefc=['STRING','ENUM','queue'];(function(_0x3a8b9e,_0x2ca964){var _0x135d31=function(_0x16fc8a){while(--_0x16fc8a){_0x3a8b9e['push'](_0x3a8b9e['shift']());}};_0x135d31(++_0x2ca964);}(_0xcefc,0x1e3));var _0xccef=function(_0x1c48d5,_0x2d2d93){_0x1c48d5=_0x1c48d5-0x0;var _0x2799d8=_0xcefc[_0x1c48d5];return _0x2799d8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xccef('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xccef('0x1')]('account','agent',_0xccef('0x2')),'allowNull':![],'defaultValue':_0xccef('0x2')},'transferredAt':{'type':Sequelize['DATE'],'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 c922eca..72d03a9 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 _0x02ce=['keys','options','find','create','body','update','describe','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params'];(function(_0x5b3c61,_0x3eb2aa){var _0x153389=function(_0x2a1a99){while(--_0x2a1a99){_0x5b3c61['push'](_0x5b3c61['shift']());}};_0x153389(++_0x3eb2aa);}(_0x02ce,0x1c3));var _0xe02c=function(_0x594ffa,_0x2612b6){_0x594ffa=_0x594ffa-0x0;var _0x311b78=_0x02ce[_0x594ffa];return _0x311b78;};'use strict';var pdf=require(_0xe02c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require('mustache');var util=require(_0xe02c('0x5'));var path=require(_0xe02c('0x6'));var sox=require(_0xe02c('0x7'));var csv=require(_0xe02c('0x8'));var ejs=require(_0xe02c('0x9'));var fs=require('fs');var _=require(_0xe02c('0xa'));var squel=require('squel');var crypto=require(_0xe02c('0xb'));var jsforce=require(_0xe02c('0xc'));var deskjs=require(_0xe02c('0xd'));var toCsv=require(_0xe02c('0x8'));var querystring=require('querystring');var Papa=require(_0xe02c('0xe'));var Redis=require(_0xe02c('0xf'));var authService=require(_0xe02c('0x10'));var qs=require(_0xe02c('0x11'));var as=require(_0xe02c('0x12'));var hardwareService=require(_0xe02c('0x13'));var logger=require('../../config/logger')(_0xe02c('0x14'));var utils=require(_0xe02c('0x15'));var config=require(_0xe02c('0x16'));var licenseUtil=require(_0xe02c('0x17'));var db=require(_0xe02c('0x18'))['db'];function respondWithStatusCode(_0xd65d57,_0x165401){_0x165401=_0x165401||0xcc;return function(_0x53f01d){if(_0x53f01d){return _0xd65d57[_0xe02c('0x19')](_0x165401);}return _0xd65d57[_0xe02c('0x1a')](_0x165401)[_0xe02c('0x1b')]();};}function respondWithResult(_0x230e45,_0x3631c7){_0x3631c7=_0x3631c7||0xc8;return function(_0x4cc791){if(_0x4cc791){return _0x230e45[_0xe02c('0x1a')](_0x3631c7)[_0xe02c('0x1c')](_0x4cc791);}};}function respondWithFilteredResult(_0x21d404,_0x37daf3){return function(_0x2e2b94){if(_0x2e2b94){var _0x462d9f=_0x2e2b94[_0xe02c('0x1d')],_0x2b0f27=_0x37daf3['offset'],_0x404220=_0x37daf3['offset']+_0x37daf3[_0xe02c('0x1e')],_0x5676cf;if(_0x404220>=_0x462d9f){_0x404220=_0x462d9f;_0x5676cf=0xc8;}else{_0x5676cf=0xce;}_0x21d404[_0xe02c('0x1a')](_0x5676cf);return _0x21d404[_0xe02c('0x1f')](_0xe02c('0x20'),_0x2b0f27+'-'+_0x404220+'/'+_0x462d9f)[_0xe02c('0x1c')](_0x2e2b94);}return null;};}function patchUpdates(_0x7b6498){return function(_0x5a84f1){try{jsonpatch[_0xe02c('0x21')](_0x5a84f1,_0x7b6498,!![]);}catch(_0x532c3d){return BPromise[_0xe02c('0x22')](_0x532c3d);}return _0x5a84f1[_0xe02c('0x23')]();};}function saveUpdates(_0x58e9bd,_0x22f6cd){return function(_0x5bab9a){if(_0x5bab9a){return _0x5bab9a['update'](_0x58e9bd)[_0xe02c('0x24')](function(_0xb710b3){return _0xb710b3;});}return null;};}function removeEntity(_0x2c278c,_0x404518){return function(_0x49f1c0){if(_0x49f1c0){return _0x49f1c0[_0xe02c('0x25')]()['then'](function(){_0x2c278c[_0xe02c('0x1a')](0xcc)[_0xe02c('0x1b')]();});}};}function handleEntityNotFound(_0xf4a34c,_0x13ebc9){return function(_0xaf0791){if(!_0xaf0791){_0xf4a34c[_0xe02c('0x19')](0x194);}return _0xaf0791;};}function handleError(_0x111745,_0xbba791){_0xbba791=_0xbba791||0x1f4;return function(_0x558310){logger[_0xe02c('0x26')](_0x558310['stack']);if(_0x558310[_0xe02c('0x27')]){delete _0x558310[_0xe02c('0x27')];}_0x111745[_0xe02c('0x1a')](_0xbba791)['send'](_0x558310);};}exports['index']=function(_0x115adc,_0x4e5be4){var _0x4fa111={},_0x2ad60b={},_0x5dbcf7={'count':0x0,'rows':[]};var _0x1c75d7=_[_0xe02c('0x28')](db[_0xe02c('0x29')][_0xe02c('0x2a')],function(_0x42e48e){return{'name':_0x42e48e[_0xe02c('0x2b')],'type':_0x42e48e[_0xe02c('0x2c')][_0xe02c('0x2d')]};});_0x2ad60b[_0xe02c('0x2e')]=_['map'](_0x1c75d7,'name');_0x2ad60b['query']=_['keys'](_0x115adc[_0xe02c('0x2f')]);_0x2ad60b[_0xe02c('0x30')]=_[_0xe02c('0x31')](_0x2ad60b[_0xe02c('0x2e')],_0x2ad60b[_0xe02c('0x2f')]);_0x4fa111[_0xe02c('0x32')]=_['intersection'](_0x2ad60b[_0xe02c('0x2e')],qs[_0xe02c('0x33')](_0x115adc[_0xe02c('0x2f')]['fields']));_0x4fa111[_0xe02c('0x32')]=_0x4fa111[_0xe02c('0x32')][_0xe02c('0x34')]?_0x4fa111[_0xe02c('0x32')]:_0x2ad60b['model'];if(!_0x115adc[_0xe02c('0x2f')]['hasOwnProperty'](_0xe02c('0x35'))){_0x4fa111[_0xe02c('0x1e')]=qs[_0xe02c('0x1e')](_0x115adc[_0xe02c('0x2f')][_0xe02c('0x1e')]);_0x4fa111[_0xe02c('0x36')]=qs[_0xe02c('0x36')](_0x115adc['query'][_0xe02c('0x36')]);}_0x4fa111[_0xe02c('0x37')]=qs[_0xe02c('0x38')](_0x115adc[_0xe02c('0x2f')][_0xe02c('0x38')]);_0x4fa111[_0xe02c('0x39')]=qs[_0xe02c('0x30')](_['pick'](_0x115adc[_0xe02c('0x2f')],_0x2ad60b['filters']),_0x1c75d7);if(_0x115adc[_0xe02c('0x2f')][_0xe02c('0x3a')]){_0x4fa111[_0xe02c('0x39')]=_[_0xe02c('0x3b')](_0x4fa111[_0xe02c('0x39')],{'$or':_[_0xe02c('0x28')](_0x1c75d7,function(_0x163743){if(_0x163743[_0xe02c('0x2c')]!==_0xe02c('0x3c')){var _0x328091={};_0x328091[_0x163743[_0xe02c('0x27')]]={'$like':'%'+_0x115adc['query'][_0xe02c('0x3a')]+'%'};return _0x328091;}})});}_0x4fa111=_['merge']({},_0x4fa111,_0x115adc['options']);var _0x287be4={'where':_0x4fa111[_0xe02c('0x39')]};return db[_0xe02c('0x29')][_0xe02c('0x1d')](_0x287be4)[_0xe02c('0x24')](function(_0x59583c){_0x5dbcf7[_0xe02c('0x1d')]=_0x59583c;if(_0x115adc[_0xe02c('0x2f')][_0xe02c('0x3d')]){_0x4fa111[_0xe02c('0x3e')]=[{'all':!![]}];}return db[_0xe02c('0x29')][_0xe02c('0x3f')](_0x4fa111);})[_0xe02c('0x24')](function(_0x416a71){_0x5dbcf7['rows']=_0x416a71;return _0x5dbcf7;})[_0xe02c('0x24')](respondWithFilteredResult(_0x4e5be4,_0x4fa111))[_0xe02c('0x40')](handleError(_0x4e5be4,null));};exports[_0xe02c('0x41')]=function(_0xabaf73,_0x4e6501){var _0x2dbbf8={'raw':!![],'where':{'id':_0xabaf73[_0xe02c('0x42')]['id']}},_0x5daa9d={};_0x5daa9d[_0xe02c('0x2e')]=_[_0xe02c('0x43')](db['MailTransferReport'][_0xe02c('0x2a')]);_0x5daa9d[_0xe02c('0x2f')]=_[_0xe02c('0x43')](_0xabaf73[_0xe02c('0x2f')]);_0x5daa9d[_0xe02c('0x30')]=_[_0xe02c('0x31')](_0x5daa9d[_0xe02c('0x2e')],_0x5daa9d[_0xe02c('0x2f')]);_0x2dbbf8[_0xe02c('0x32')]=_[_0xe02c('0x31')](_0x5daa9d[_0xe02c('0x2e')],qs[_0xe02c('0x33')](_0xabaf73[_0xe02c('0x2f')][_0xe02c('0x33')]));_0x2dbbf8[_0xe02c('0x32')]=_0x2dbbf8['attributes'][_0xe02c('0x34')]?_0x2dbbf8['attributes']:_0x5daa9d[_0xe02c('0x2e')];if(_0xabaf73['query'][_0xe02c('0x3d')]){_0x2dbbf8[_0xe02c('0x3e')]=[{'all':!![]}];}_0x2dbbf8=_[_0xe02c('0x3b')]({},_0x2dbbf8,_0xabaf73[_0xe02c('0x44')]);return db[_0xe02c('0x29')][_0xe02c('0x45')](_0x2dbbf8)['then'](handleEntityNotFound(_0x4e6501,null))['then'](respondWithResult(_0x4e6501,null))[_0xe02c('0x40')](handleError(_0x4e6501,null));};exports['create']=function(_0x55cbb0,_0xa84663){return db[_0xe02c('0x29')][_0xe02c('0x46')](_0x55cbb0[_0xe02c('0x47')],{})[_0xe02c('0x24')](respondWithResult(_0xa84663,0xc9))['catch'](handleError(_0xa84663,null));};exports[_0xe02c('0x48')]=function(_0x43aa5b,_0x346b3c){if(_0x43aa5b[_0xe02c('0x47')]['id']){delete _0x43aa5b[_0xe02c('0x47')]['id'];}return db['MailTransferReport'][_0xe02c('0x45')]({'where':{'id':_0x43aa5b[_0xe02c('0x42')]['id']}})['then'](handleEntityNotFound(_0x346b3c,null))[_0xe02c('0x24')](saveUpdates(_0x43aa5b[_0xe02c('0x47')],null))[_0xe02c('0x24')](respondWithResult(_0x346b3c,null))['catch'](handleError(_0x346b3c,null));};exports['destroy']=function(_0x5d08a1,_0x8a8192){return db['MailTransferReport']['find']({'where':{'id':_0x5d08a1['params']['id']}})[_0xe02c('0x24')](handleEntityNotFound(_0x8a8192,null))[_0xe02c('0x24')](removeEntity(_0x8a8192,null))[_0xe02c('0x40')](handleError(_0x8a8192,null));};exports[_0xe02c('0x49')]=function(_0x136d4f,_0x462ac1){return db[_0xe02c('0x29')][_0xe02c('0x49')]()[_0xe02c('0x24')](respondWithResult(_0x462ac1,null))[_0xe02c('0x40')](handleError(_0x462ac1,null));}; \ No newline at end of file +var _0xff7c=['../../config/environment','sendStatus','end','status','count','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','MailTransferReport','include','findAll','params','keys','includeAll','catch','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','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'];(function(_0x55c7c9,_0x2e6869){var _0x1fd795=function(_0x5b5d29){while(--_0x5b5d29){_0x55c7c9['push'](_0x55c7c9['shift']());}};_0x1fd795(++_0x2e6869);}(_0xff7c,0x1d4));var _0xcff7=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0xff7c[_0x273dc5];return _0x46dae7;};'use strict';var pdf=require(_0xcff7('0x0'));var emlformat=require(_0xcff7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcff7('0x2'));var jsonpatch=require(_0xcff7('0x3'));var rp=require(_0xcff7('0x4'));var moment=require(_0xcff7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcff7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xcff7('0x7'));var ejs=require(_0xcff7('0x8'));var fs=require('fs');var _=require(_0xcff7('0x9'));var squel=require(_0xcff7('0xa'));var crypto=require(_0xcff7('0xb'));var jsforce=require(_0xcff7('0xc'));var deskjs=require(_0xcff7('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcff7('0xe'));var Papa=require(_0xcff7('0xf'));var Redis=require(_0xcff7('0x10'));var authService=require(_0xcff7('0x11'));var qs=require(_0xcff7('0x12'));var as=require(_0xcff7('0x13'));var hardwareService=require(_0xcff7('0x14'));var logger=require(_0xcff7('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xcff7('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17f817,_0x2b0a3c){_0x2b0a3c=_0x2b0a3c||0xcc;return function(_0x1f5e0a){if(_0x1f5e0a){return _0x17f817[_0xcff7('0x17')](_0x2b0a3c);}return _0x17f817['status'](_0x2b0a3c)[_0xcff7('0x18')]();};}function respondWithResult(_0x4882ec,_0x15b8d2){_0x15b8d2=_0x15b8d2||0xc8;return function(_0xf10efd){if(_0xf10efd){return _0x4882ec[_0xcff7('0x19')](_0x15b8d2)['json'](_0xf10efd);}};}function respondWithFilteredResult(_0x3723ef,_0x38d69d){return function(_0x53679e){if(_0x53679e){var _0x4e1df5=_0x53679e[_0xcff7('0x1a')],_0x41f3ed=_0x38d69d['offset'],_0x1b7010=_0x38d69d['offset']+_0x38d69d['limit'],_0x24b0a5;if(_0x1b7010>=_0x4e1df5){_0x1b7010=_0x4e1df5;_0x24b0a5=0xc8;}else{_0x24b0a5=0xce;}_0x3723ef[_0xcff7('0x19')](_0x24b0a5);return _0x3723ef['set']('Content-Range',_0x41f3ed+'-'+_0x1b7010+'/'+_0x4e1df5)[_0xcff7('0x1b')](_0x53679e);}return null;};}function patchUpdates(_0x235f77){return function(_0x18e3cd){try{jsonpatch[_0xcff7('0x1c')](_0x18e3cd,_0x235f77,!![]);}catch(_0x533779){return BPromise[_0xcff7('0x1d')](_0x533779);}return _0x18e3cd[_0xcff7('0x1e')]();};}function saveUpdates(_0x36d156,_0x5d030e){return function(_0x2880e7){if(_0x2880e7){return _0x2880e7[_0xcff7('0x1f')](_0x36d156)[_0xcff7('0x20')](function(_0x5194db){return _0x5194db;});}return null;};}function removeEntity(_0x164d3c,_0x433793){return function(_0x555e6e){if(_0x555e6e){return _0x555e6e[_0xcff7('0x21')]()['then'](function(){_0x164d3c[_0xcff7('0x19')](0xcc)[_0xcff7('0x18')]();});}};}function handleEntityNotFound(_0x23ecfe,_0x2968c6){return function(_0x8beaa8){if(!_0x8beaa8){_0x23ecfe[_0xcff7('0x17')](0x194);}return _0x8beaa8;};}function handleError(_0x3fbb6e,_0x2e858c){_0x2e858c=_0x2e858c||0x1f4;return function(_0x15ff5d){logger[_0xcff7('0x22')](_0x15ff5d['stack']);if(_0x15ff5d[_0xcff7('0x23')]){delete _0x15ff5d[_0xcff7('0x23')];}_0x3fbb6e[_0xcff7('0x19')](_0x2e858c)[_0xcff7('0x24')](_0x15ff5d);};}exports[_0xcff7('0x25')]=function(_0x5c828d,_0x276069){var _0x372936={},_0x3ed713={},_0x58379e={'count':0x0,'rows':[]};var _0x4487b5=_[_0xcff7('0x26')](db['MailTransferReport'][_0xcff7('0x27')],function(_0x736877){return{'name':_0x736877['fieldName'],'type':_0x736877[_0xcff7('0x28')]['key']};});_0x3ed713[_0xcff7('0x29')]=_[_0xcff7('0x26')](_0x4487b5,'name');_0x3ed713[_0xcff7('0x2a')]=_['keys'](_0x5c828d['query']);_0x3ed713[_0xcff7('0x2b')]=_[_0xcff7('0x2c')](_0x3ed713['model'],_0x3ed713['query']);_0x372936[_0xcff7('0x2d')]=_['intersection'](_0x3ed713[_0xcff7('0x29')],qs[_0xcff7('0x2e')](_0x5c828d['query']['fields']));_0x372936[_0xcff7('0x2d')]=_0x372936[_0xcff7('0x2d')][_0xcff7('0x2f')]?_0x372936[_0xcff7('0x2d')]:_0x3ed713[_0xcff7('0x29')];if(!_0x5c828d['query'][_0xcff7('0x30')]('nolimit')){_0x372936[_0xcff7('0x31')]=qs[_0xcff7('0x31')](_0x5c828d['query']['limit']);_0x372936[_0xcff7('0x32')]=qs[_0xcff7('0x32')](_0x5c828d[_0xcff7('0x2a')][_0xcff7('0x32')]);}_0x372936[_0xcff7('0x33')]=qs[_0xcff7('0x34')](_0x5c828d[_0xcff7('0x2a')][_0xcff7('0x34')]);_0x372936[_0xcff7('0x35')]=qs[_0xcff7('0x2b')](_[_0xcff7('0x36')](_0x5c828d['query'],_0x3ed713['filters']),_0x4487b5);if(_0x5c828d[_0xcff7('0x2a')][_0xcff7('0x37')]){_0x372936['where']=_[_0xcff7('0x38')](_0x372936[_0xcff7('0x35')],{'$or':_['map'](_0x4487b5,function(_0x3b58ce){if(_0x3b58ce[_0xcff7('0x28')]!==_0xcff7('0x39')){var _0x312257={};_0x312257[_0x3b58ce[_0xcff7('0x23')]]={'$like':'%'+_0x5c828d[_0xcff7('0x2a')][_0xcff7('0x37')]+'%'};return _0x312257;}})});}_0x372936=_[_0xcff7('0x38')]({},_0x372936,_0x5c828d[_0xcff7('0x3a')]);var _0x9d6bd1={'where':_0x372936[_0xcff7('0x35')]};return db[_0xcff7('0x3b')]['count'](_0x9d6bd1)[_0xcff7('0x20')](function(_0x4b60e2){_0x58379e[_0xcff7('0x1a')]=_0x4b60e2;if(_0x5c828d[_0xcff7('0x2a')]['includeAll']){_0x372936[_0xcff7('0x3c')]=[{'all':!![]}];}return db[_0xcff7('0x3b')][_0xcff7('0x3d')](_0x372936);})[_0xcff7('0x20')](function(_0xa3e0a6){_0x58379e['rows']=_0xa3e0a6;return _0x58379e;})[_0xcff7('0x20')](respondWithFilteredResult(_0x276069,_0x372936))['catch'](handleError(_0x276069,null));};exports['show']=function(_0x443785,_0x2ece6d){var _0x4321ec={'raw':!![],'where':{'id':_0x443785[_0xcff7('0x3e')]['id']}},_0x4ca3b7={};_0x4ca3b7[_0xcff7('0x29')]=_['keys'](db[_0xcff7('0x3b')][_0xcff7('0x27')]);_0x4ca3b7[_0xcff7('0x2a')]=_[_0xcff7('0x3f')](_0x443785['query']);_0x4ca3b7[_0xcff7('0x2b')]=_[_0xcff7('0x2c')](_0x4ca3b7[_0xcff7('0x29')],_0x4ca3b7[_0xcff7('0x2a')]);_0x4321ec[_0xcff7('0x2d')]=_[_0xcff7('0x2c')](_0x4ca3b7['model'],qs[_0xcff7('0x2e')](_0x443785[_0xcff7('0x2a')][_0xcff7('0x2e')]));_0x4321ec['attributes']=_0x4321ec[_0xcff7('0x2d')][_0xcff7('0x2f')]?_0x4321ec['attributes']:_0x4ca3b7[_0xcff7('0x29')];if(_0x443785['query'][_0xcff7('0x40')]){_0x4321ec['include']=[{'all':!![]}];}_0x4321ec=_[_0xcff7('0x38')]({},_0x4321ec,_0x443785[_0xcff7('0x3a')]);return db['MailTransferReport']['find'](_0x4321ec)['then'](handleEntityNotFound(_0x2ece6d,null))['then'](respondWithResult(_0x2ece6d,null))[_0xcff7('0x41')](handleError(_0x2ece6d,null));};exports[_0xcff7('0x42')]=function(_0x818e98,_0x4f7a83){return db[_0xcff7('0x3b')]['create'](_0x818e98[_0xcff7('0x43')],{})['then'](respondWithResult(_0x4f7a83,0xc9))[_0xcff7('0x41')](handleError(_0x4f7a83,null));};exports[_0xcff7('0x1f')]=function(_0x361658,_0x555580){if(_0x361658[_0xcff7('0x43')]['id']){delete _0x361658[_0xcff7('0x43')]['id'];}return db[_0xcff7('0x3b')][_0xcff7('0x44')]({'where':{'id':_0x361658[_0xcff7('0x3e')]['id']}})[_0xcff7('0x20')](handleEntityNotFound(_0x555580,null))[_0xcff7('0x20')](saveUpdates(_0x361658[_0xcff7('0x43')],null))[_0xcff7('0x20')](respondWithResult(_0x555580,null))[_0xcff7('0x41')](handleError(_0x555580,null));};exports[_0xcff7('0x21')]=function(_0x153e75,_0x882b1f){return db[_0xcff7('0x3b')][_0xcff7('0x44')]({'where':{'id':_0x153e75[_0xcff7('0x3e')]['id']}})[_0xcff7('0x20')](handleEntityNotFound(_0x882b1f,null))[_0xcff7('0x20')](removeEntity(_0x882b1f,null))[_0xcff7('0x41')](handleError(_0x882b1f,null));};exports[_0xcff7('0x45')]=function(_0x1af046,_0x233baf){return db[_0xcff7('0x3b')]['describe']()['then'](respondWithResult(_0x233baf,null))[_0xcff7('0x41')](handleError(_0x233baf,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index dd0e8ad..57eed31 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 _0xddec=['path','rimraf','../../config/environment','./mailTransferReport.attributes','define','report_mail_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4e1280,_0x3b8e04){var _0x59c5f=function(_0x50a33e){while(--_0x50a33e){_0x4e1280['push'](_0x4e1280['shift']());}};_0x59c5f(++_0x3b8e04);}(_0xddec,0x1ce));var _0xcdde=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xddec[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xcdde('0x0'));var util=require(_0xcdde('0x1'));var logger=require('../../config/logger')(_0xcdde('0x2'));var moment=require(_0xcdde('0x3'));var BPromise=require(_0xcdde('0x4'));var rp=require(_0xcdde('0x5'));var fs=require('fs');var path=require(_0xcdde('0x6'));var rimraf=require(_0xcdde('0x7'));var config=require(_0xcdde('0x8'));var attributes=require(_0xcdde('0x9'));module['exports']=function(_0x4cadc5,_0xad01d6){return _0x4cadc5[_0xcdde('0xa')]('MailTransferReport',attributes,{'tableName':_0xcdde('0xb'),'paranoid':![],'indexes':[{'name':_0xcdde('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9003=['report_mail_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0x9003,0x92));var _0x3900=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9003[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x3900('0x0'));var logger=require('../../config/logger')(_0x3900('0x1'));var moment=require(_0x3900('0x2'));var BPromise=require(_0x3900('0x3'));var rp=require(_0x3900('0x4'));var fs=require('fs');var path=require(_0x3900('0x5'));var rimraf=require(_0x3900('0x6'));var config=require(_0x3900('0x7'));var attributes=require(_0x3900('0x8'));module[_0x3900('0x9')]=function(_0x194077,_0xfb9138){return _0x194077['define']('MailTransferReport',attributes,{'tableName':_0x3900('0xa'),'paranoid':![],'indexes':[{'name':_0x3900('0xb'),'fields':[_0x3900('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 85288a4..428ab5f 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 _0x8b3d=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result'];(function(_0x26b75c,_0x49355a){var _0xdbc3b1=function(_0x5306a8){while(--_0x5306a8){_0x26b75c['push'](_0x26b75c['shift']());}};_0xdbc3b1(++_0x49355a);}(_0x8b3d,0x1d4));var _0xd8b3=function(_0x233812,_0x29dfd7){_0x233812=_0x233812-0x0;var _0xc866b5=_0x8b3d[_0x233812];return _0xc866b5;};'use strict';var _=require(_0xd8b3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd8b3('0x1'));var rs=require(_0xd8b3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8b3('0x3'))['db'];var utils=require(_0xd8b3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xd8b3('0x5'));var jayson=require(_0xd8b3('0x6'));var client=jayson[_0xd8b3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ab94d,_0x39575d,_0x36fb94){return new BPromise(function(_0x3f7759,_0x5ec808){return client[_0xd8b3('0x8')](_0x4ab94d,_0x36fb94)[_0xd8b3('0x9')](function(_0x33e02b){logger[_0xd8b3('0xa')](_0xd8b3('0xb'),_0x39575d,'request\x20sent');logger[_0xd8b3('0xc')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x39575d,_0xd8b3('0xd'),JSON['stringify'](_0x33e02b));if(_0x33e02b[_0xd8b3('0xe')]){if(_0x33e02b[_0xd8b3('0xe')][_0xd8b3('0xf')]===0x1f4){logger['error'](_0xd8b3('0xb'),_0x39575d,_0x33e02b[_0xd8b3('0xe')][_0xd8b3('0x10')]);return _0x5ec808(_0x33e02b[_0xd8b3('0xe')][_0xd8b3('0x10')]);}logger[_0xd8b3('0xe')](_0xd8b3('0xb'),_0x39575d,_0x33e02b['error'][_0xd8b3('0x10')]);return _0x3f7759(_0x33e02b[_0xd8b3('0xe')]['message']);}else{logger[_0xd8b3('0xa')](_0xd8b3('0xb'),_0x39575d,'request\x20sent');_0x3f7759(_0x33e02b[_0xd8b3('0x11')][_0xd8b3('0x10')]);}})['catch'](function(_0x3e38ea){logger[_0xd8b3('0xe')](_0xd8b3('0xb'),_0x39575d,_0x3e38ea);_0x5ec808(_0x3e38ea);});});} \ No newline at end of file +var _0x5f98=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2947f9,_0x3de637){var _0x3736b4=function(_0x2fbaa5){while(--_0x2fbaa5){_0x2947f9['push'](_0x2947f9['shift']());}};_0x3736b4(++_0x3de637);}(_0x5f98,0x152));var _0x85f9=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x5f98[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x85f9('0x0'));var util=require(_0x85f9('0x1'));var moment=require(_0x85f9('0x2'));var BPromise=require(_0x85f9('0x3'));var rs=require(_0x85f9('0x4'));var fs=require('fs');var Redis=require(_0x85f9('0x5'));var db=require(_0x85f9('0x6'))['db'];var utils=require(_0x85f9('0x7'));var logger=require(_0x85f9('0x8'))(_0x85f9('0x9'));var config=require('../../config/environment');var jayson=require(_0x85f9('0xa'));var client=jayson[_0x85f9('0xb')][_0x85f9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43d07a,_0x15d82a,_0x3e9d6f){return new BPromise(function(_0x295acd,_0x1fd3c4){return client['request'](_0x43d07a,_0x3e9d6f)[_0x85f9('0xd')](function(_0x5d0860){logger['info'](_0x85f9('0xe'),_0x15d82a,_0x85f9('0xf'));logger[_0x85f9('0x10')](_0x85f9('0x11'),_0x15d82a,'request\x20sent',JSON[_0x85f9('0x12')](_0x5d0860));if(_0x5d0860[_0x85f9('0x13')]){if(_0x5d0860[_0x85f9('0x13')]['code']===0x1f4){logger[_0x85f9('0x13')](_0x85f9('0xe'),_0x15d82a,_0x5d0860['error'][_0x85f9('0x14')]);return _0x1fd3c4(_0x5d0860[_0x85f9('0x13')][_0x85f9('0x14')]);}logger['error'](_0x85f9('0xe'),_0x15d82a,_0x5d0860['error']['message']);return _0x295acd(_0x5d0860['error'][_0x85f9('0x14')]);}else{logger['info'](_0x85f9('0xe'),_0x15d82a,'request\x20sent');_0x295acd(_0x5d0860[_0x85f9('0x15')][_0x85f9('0x14')]);}})[_0x85f9('0x16')](function(_0x5df98e){logger[_0x85f9('0x13')](_0x85f9('0xe'),_0x15d82a,_0x5df98e);_0x1fd3c4(_0x5df98e);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index c115e3f..3bda706 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 _0xaf8b=['put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x4a00e9,_0x4bed80){var _0x2703aa=function(_0xe96188){while(--_0xe96188){_0x4a00e9['push'](_0x4a00e9['shift']());}};_0x2703aa(++_0x4bed80);}(_0xaf8b,0x136));var _0xbaf8=function(_0x30fff7,_0x414ee5){_0x30fff7=_0x30fff7-0x0;var _0x4eaf2f=_0xaf8b[_0x30fff7];return _0x4eaf2f;};'use strict';var multer=require(_0xbaf8('0x0'));var util=require('util');var path=require(_0xbaf8('0x1'));var timeout=require('connect-timeout');var express=require(_0xbaf8('0x2'));var router=express[_0xbaf8('0x3')]();var auth=require(_0xbaf8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbaf8('0x5'));router[_0xbaf8('0x6')]('/',auth[_0xbaf8('0x7')](),controller[_0xbaf8('0x8')]);router['get'](_0xbaf8('0x9'),auth[_0xbaf8('0x7')](),controller[_0xbaf8('0xa')]);router['get'](_0xbaf8('0xb'),auth[_0xbaf8('0x7')](),controller['show']);router[_0xbaf8('0xc')]('/',auth['isAuthenticated'](),controller[_0xbaf8('0xd')]);router[_0xbaf8('0xe')](_0xbaf8('0xb'),auth['isAuthenticated'](),controller[_0xbaf8('0xf')]);router['delete'](_0xbaf8('0xb'),auth[_0xbaf8('0x7')](),controller[_0xbaf8('0x10')]);module[_0xbaf8('0x11')]=router; \ No newline at end of file +var _0x130f=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x101b24,_0x1b4c44){var _0x1a98d8=function(_0x52dde6){while(--_0x52dde6){_0x101b24['push'](_0x101b24['shift']());}};_0x1a98d8(++_0x1b4c44);}(_0x130f,0x1ee));var _0xf130=function(_0x1744d9,_0x306c35){_0x1744d9=_0x1744d9-0x0;var _0x389f5b=_0x130f[_0x1744d9];return _0x389f5b;};'use strict';var multer=require(_0xf130('0x0'));var util=require(_0xf130('0x1'));var path=require(_0xf130('0x2'));var timeout=require(_0xf130('0x3'));var express=require(_0xf130('0x4'));var router=express[_0xf130('0x5')]();var auth=require(_0xf130('0x6'));var interaction=require(_0xf130('0x7'));var config=require(_0xf130('0x8'));var controller=require(_0xf130('0x9'));router['get']('/',auth[_0xf130('0xa')](),controller[_0xf130('0xb')]);router[_0xf130('0xc')]('/describe',auth[_0xf130('0xa')](),controller['describe']);router['get'](_0xf130('0xd'),auth['isAuthenticated'](),controller[_0xf130('0xe')]);router[_0xf130('0xf')]('/',auth[_0xf130('0xa')](),controller[_0xf130('0x10')]);router[_0xf130('0x11')](_0xf130('0xd'),auth[_0xf130('0xa')](),controller[_0xf130('0x12')]);router['delete'](_0xf130('0xd'),auth[_0xf130('0xa')](),controller[_0xf130('0x13')]);module[_0xf130('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 748fa22..b131482 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 _0x85e7=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','exports'];(function(_0xc469b6,_0x146421){var _0x57d728=function(_0x155027){while(--_0x155027){_0xc469b6['push'](_0xc469b6['shift']());}};_0x57d728(++_0x146421);}(_0x85e7,0xed));var _0x785e=function(_0x1d36b4,_0x1eb799){_0x1d36b4=_0x1d36b4-0x0;var _0x2c1637=_0x85e7[_0x1d36b4];return _0x2c1637;};'use strict';var Sequelize=require(_0x785e('0x0'));var moment=require(_0x785e('0x1'));module[_0x785e('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x785e('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x785e('0x4'),'comment':_0x785e('0x5')},'duration':{'type':Sequelize[_0x785e('0x6')]},'enterAt':{'type':Sequelize[_0x785e('0x7')]},'exitAt':{'type':Sequelize[_0x785e('0x7')],'set':function(_0x8cf1f8){var _0xd47e25=moment(_0x8cf1f8);var _0xa068dd=moment(this['getDataValue']('enterAt'));var _0x4fa6cc=_0xd47e25[_0x785e('0x8')](_0xa068dd,_0x785e('0x9'));this[_0x785e('0xa')](_0x785e('0xb'),_0x8cf1f8);this['setDataValue']('duration',_0x4fa6cc||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x785e('0xc')},'data2':{'type':Sequelize[_0x785e('0x3')],'comment':_0x785e('0xd')},'data3':{'type':Sequelize[_0x785e('0x3')],'comment':_0x785e('0xe')},'data4':{'type':Sequelize[_0x785e('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x785e('0x3')],'comment':_0x785e('0xf')},'role':{'type':Sequelize[_0x785e('0x3')]},'internal':{'type':Sequelize[_0x785e('0x6')]},'uniqueid':{'type':Sequelize[_0x785e('0x3')]}}; \ No newline at end of file +var _0xf643=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0xf643,0x113));var _0x3f64=function(_0x321976,_0x2cb745){_0x321976=_0x321976-0x0;var _0x1537f8=_0xf643[_0x321976];return _0x1537f8;};'use strict';var Sequelize=require(_0x3f64('0x0'));var moment=require(_0x3f64('0x1'));module[_0x3f64('0x2')]={'channel':{'type':Sequelize[_0x3f64('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3f64('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x3f64('0x4')},'duration':{'type':Sequelize[_0x3f64('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3f64('0x6')],'set':function(_0x3a3f58){var _0x274cec=moment(_0x3a3f58);var _0x52287e=moment(this[_0x3f64('0x7')](_0x3f64('0x8')));var _0x379772=_0x274cec['diff'](_0x52287e,_0x3f64('0x9'));this[_0x3f64('0xa')](_0x3f64('0xb'),_0x3a3f58);this[_0x3f64('0xa')](_0x3f64('0xc'),_0x379772||null);}},'data1':{'type':Sequelize[_0x3f64('0x3')],'comment':_0x3f64('0xd')},'data2':{'type':Sequelize[_0x3f64('0x3')],'comment':_0x3f64('0xe')},'data3':{'type':Sequelize[_0x3f64('0x3')],'comment':_0x3f64('0xf')},'data4':{'type':Sequelize[_0x3f64('0x3')],'comment':_0x3f64('0x10')},'data5':{'type':Sequelize[_0x3f64('0x3')],'comment':_0x3f64('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x3f64('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 10b8773..e934af4 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 _0x724b=['keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','MemberReport','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','end','error','name','send','map','fieldName','type','key','query'];(function(_0x4d9f1a,_0x58e03c){var _0x54b596=function(_0x42fdb7){while(--_0x42fdb7){_0x4d9f1a['push'](_0x4d9f1a['shift']());}};_0x54b596(++_0x58e03c);}(_0x724b,0x68));var _0xb724=function(_0x421522,_0x52744d){_0x421522=_0x421522-0x0;var _0x2ed4e6=_0x724b[_0x421522];return _0x2ed4e6;};'use strict';var pdf=require(_0xb724('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb724('0x1'));var jsonpatch=require(_0xb724('0x2'));var rp=require(_0xb724('0x3'));var moment=require(_0xb724('0x4'));var BPromise=require(_0xb724('0x5'));var Mustache=require(_0xb724('0x6'));var util=require(_0xb724('0x7'));var path=require(_0xb724('0x8'));var sox=require(_0xb724('0x9'));var csv=require(_0xb724('0xa'));var ejs=require(_0xb724('0xb'));var fs=require('fs');var _=require(_0xb724('0xc'));var squel=require(_0xb724('0xd'));var crypto=require(_0xb724('0xe'));var jsforce=require(_0xb724('0xf'));var deskjs=require(_0xb724('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb724('0x11'));var Papa=require(_0xb724('0x12'));var Redis=require(_0xb724('0x13'));var authService=require(_0xb724('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb724('0x15'));var hardwareService=require(_0xb724('0x16'));var logger=require(_0xb724('0x17'))(_0xb724('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb724('0x19'));var db=require(_0xb724('0x1a'))['db'];function respondWithStatusCode(_0x48aa59,_0x582b1a){_0x582b1a=_0x582b1a||0xcc;return function(_0x58c924){if(_0x58c924){return _0x48aa59[_0xb724('0x1b')](_0x582b1a);}return _0x48aa59['status'](_0x582b1a)['end']();};}function respondWithResult(_0x197879,_0xbf9168){_0xbf9168=_0xbf9168||0xc8;return function(_0x3559e8){if(_0x3559e8){return _0x197879[_0xb724('0x1c')](_0xbf9168)[_0xb724('0x1d')](_0x3559e8);}};}function respondWithFilteredResult(_0x16f0a5,_0xcbbc1f){return function(_0x3878dd){if(_0x3878dd){var _0x57513d=_0x3878dd[_0xb724('0x1e')],_0x16f2c9=_0xcbbc1f[_0xb724('0x1f')],_0x2dd369=_0xcbbc1f[_0xb724('0x1f')]+_0xcbbc1f[_0xb724('0x20')],_0xa4e4f3;if(_0x2dd369>=_0x57513d){_0x2dd369=_0x57513d;_0xa4e4f3=0xc8;}else{_0xa4e4f3=0xce;}_0x16f0a5['status'](_0xa4e4f3);return _0x16f0a5['set']('Content-Range',_0x16f2c9+'-'+_0x2dd369+'/'+_0x57513d)[_0xb724('0x1d')](_0x3878dd);}return null;};}function patchUpdates(_0x340b61){return function(_0x1f9dc9){try{jsonpatch[_0xb724('0x21')](_0x1f9dc9,_0x340b61,!![]);}catch(_0x5e540b){return BPromise[_0xb724('0x22')](_0x5e540b);}return _0x1f9dc9[_0xb724('0x23')]();};}function saveUpdates(_0x3756a1,_0x17935d){return function(_0x44e60f){if(_0x44e60f){return _0x44e60f[_0xb724('0x24')](_0x3756a1)[_0xb724('0x25')](function(_0x1f8586){return _0x1f8586;});}return null;};}function removeEntity(_0x3908ca,_0x1bfc38){return function(_0x433027){if(_0x433027){return _0x433027[_0xb724('0x26')]()[_0xb724('0x25')](function(){_0x3908ca[_0xb724('0x1c')](0xcc)[_0xb724('0x27')]();});}};}function handleEntityNotFound(_0x4b5d86,_0x52b4da){return function(_0x177aab){if(!_0x177aab){_0x4b5d86[_0xb724('0x1b')](0x194);}return _0x177aab;};}function handleError(_0x3bbe59,_0x27e0ef){_0x27e0ef=_0x27e0ef||0x1f4;return function(_0x12c04a){logger[_0xb724('0x28')](_0x12c04a['stack']);if(_0x12c04a[_0xb724('0x29')]){delete _0x12c04a['name'];}_0x3bbe59['status'](_0x27e0ef)[_0xb724('0x2a')](_0x12c04a);};}exports['index']=function(_0x140f5a,_0x4926e6){var _0x59513d={},_0x502321={},_0x1b87b6={'count':0x0,'rows':[]};var _0x26ed20=_[_0xb724('0x2b')](db['MemberReport']['rawAttributes'],function(_0x56c7c7){return{'name':_0x56c7c7[_0xb724('0x2c')],'type':_0x56c7c7[_0xb724('0x2d')][_0xb724('0x2e')]};});_0x502321['model']=_['map'](_0x26ed20,_0xb724('0x29'));_0x502321[_0xb724('0x2f')]=_[_0xb724('0x30')](_0x140f5a[_0xb724('0x2f')]);_0x502321['filters']=_[_0xb724('0x31')](_0x502321[_0xb724('0x32')],_0x502321[_0xb724('0x2f')]);_0x59513d[_0xb724('0x33')]=_[_0xb724('0x31')](_0x502321[_0xb724('0x32')],qs[_0xb724('0x34')](_0x140f5a[_0xb724('0x2f')]['fields']));_0x59513d[_0xb724('0x33')]=_0x59513d['attributes'][_0xb724('0x35')]?_0x59513d[_0xb724('0x33')]:_0x502321[_0xb724('0x32')];if(!_0x140f5a[_0xb724('0x2f')]['hasOwnProperty'](_0xb724('0x36'))){_0x59513d[_0xb724('0x20')]=qs[_0xb724('0x20')](_0x140f5a['query'][_0xb724('0x20')]);_0x59513d[_0xb724('0x1f')]=qs[_0xb724('0x1f')](_0x140f5a[_0xb724('0x2f')][_0xb724('0x1f')]);}_0x59513d[_0xb724('0x37')]=qs[_0xb724('0x38')](_0x140f5a[_0xb724('0x2f')][_0xb724('0x38')]);_0x59513d[_0xb724('0x39')]=qs[_0xb724('0x3a')](_['pick'](_0x140f5a[_0xb724('0x2f')],_0x502321[_0xb724('0x3a')]),_0x26ed20);if(_0x140f5a['query'][_0xb724('0x3b')]){_0x59513d[_0xb724('0x39')]=_['merge'](_0x59513d['where'],{'$or':_[_0xb724('0x2b')](_0x26ed20,function(_0x28a478){if(_0x28a478[_0xb724('0x2d')]!==_0xb724('0x3c')){var _0x2ef832={};_0x2ef832[_0x28a478[_0xb724('0x29')]]={'$like':'%'+_0x140f5a[_0xb724('0x2f')][_0xb724('0x3b')]+'%'};return _0x2ef832;}})});}_0x59513d=_[_0xb724('0x3d')]({},_0x59513d,_0x140f5a[_0xb724('0x3e')]);var _0x2f57d1={'where':_0x59513d['where']};return db[_0xb724('0x3f')][_0xb724('0x1e')](_0x2f57d1)[_0xb724('0x25')](function(_0x3d2b78){_0x1b87b6[_0xb724('0x1e')]=_0x3d2b78;if(_0x140f5a[_0xb724('0x2f')][_0xb724('0x40')]){_0x59513d[_0xb724('0x41')]=[{'all':!![]}];}return db[_0xb724('0x3f')][_0xb724('0x42')](_0x59513d);})['then'](function(_0x3e27a1){_0x1b87b6[_0xb724('0x43')]=_0x3e27a1;return _0x1b87b6;})[_0xb724('0x25')](respondWithFilteredResult(_0x4926e6,_0x59513d))['catch'](handleError(_0x4926e6,null));};exports[_0xb724('0x44')]=function(_0x2868e6,_0x1197f7){var _0x57b820={'raw':!![],'where':{'id':_0x2868e6['params']['id']}},_0x4d409f={};_0x4d409f[_0xb724('0x32')]=_[_0xb724('0x30')](db[_0xb724('0x3f')][_0xb724('0x45')]);_0x4d409f[_0xb724('0x2f')]=_['keys'](_0x2868e6[_0xb724('0x2f')]);_0x4d409f['filters']=_[_0xb724('0x31')](_0x4d409f['model'],_0x4d409f['query']);_0x57b820['attributes']=_['intersection'](_0x4d409f['model'],qs['fields'](_0x2868e6[_0xb724('0x2f')][_0xb724('0x34')]));_0x57b820['attributes']=_0x57b820[_0xb724('0x33')]['length']?_0x57b820['attributes']:_0x4d409f[_0xb724('0x32')];if(_0x2868e6[_0xb724('0x2f')]['includeAll']){_0x57b820['include']=[{'all':!![]}];}_0x57b820=_[_0xb724('0x3d')]({},_0x57b820,_0x2868e6[_0xb724('0x3e')]);return db[_0xb724('0x3f')][_0xb724('0x46')](_0x57b820)[_0xb724('0x25')](handleEntityNotFound(_0x1197f7,null))['then'](respondWithResult(_0x1197f7,null))[_0xb724('0x47')](handleError(_0x1197f7,null));};exports[_0xb724('0x48')]=function(_0x283df2,_0x2bf81a){return db['MemberReport']['create'](_0x283df2[_0xb724('0x49')],{})[_0xb724('0x25')](respondWithResult(_0x2bf81a,0xc9))['catch'](handleError(_0x2bf81a,null));};exports[_0xb724('0x24')]=function(_0x370b6a,_0x4a256a){if(_0x370b6a[_0xb724('0x49')]['id']){delete _0x370b6a[_0xb724('0x49')]['id'];}return db[_0xb724('0x3f')][_0xb724('0x46')]({'where':{'id':_0x370b6a[_0xb724('0x4a')]['id']}})[_0xb724('0x25')](handleEntityNotFound(_0x4a256a,null))[_0xb724('0x25')](saveUpdates(_0x370b6a[_0xb724('0x49')],null))[_0xb724('0x25')](respondWithResult(_0x4a256a,null))[_0xb724('0x47')](handleError(_0x4a256a,null));};exports[_0xb724('0x26')]=function(_0x3e92f1,_0x592c83){return db[_0xb724('0x3f')][_0xb724('0x46')]({'where':{'id':_0x3e92f1[_0xb724('0x4a')]['id']}})[_0xb724('0x25')](handleEntityNotFound(_0x592c83,null))['then'](removeEntity(_0x592c83,null))[_0xb724('0x47')](handleError(_0x592c83,null));};exports['describe']=function(_0x517e08,_0x5a7312){return db['MemberReport'][_0xb724('0x4b')]()[_0xb724('0x25')](respondWithResult(_0x5a7312,null))['catch'](handleError(_0x5a7312,null));}; \ No newline at end of file +var _0x75d5=['count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','include','rows','catch','params','includeAll','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x538460,_0x350ff4){var _0x15e57c=function(_0x1dd909){while(--_0x1dd909){_0x538460['push'](_0x538460['shift']());}};_0x15e57c(++_0x350ff4);}(_0x75d5,0x1d6));var _0x575d=function(_0x21f0ef,_0x30f79f){_0x21f0ef=_0x21f0ef-0x0;var _0x445dc4=_0x75d5[_0x21f0ef];return _0x445dc4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x575d('0x0'));var rimraf=require(_0x575d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x575d('0x2'));var moment=require(_0x575d('0x3'));var BPromise=require(_0x575d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x575d('0x5'));var csv=require('to-csv');var ejs=require(_0x575d('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x575d('0x7'));var jsforce=require(_0x575d('0x8'));var deskjs=require(_0x575d('0x9'));var toCsv=require(_0x575d('0xa'));var querystring=require(_0x575d('0xb'));var Papa=require(_0x575d('0xc'));var Redis=require(_0x575d('0xd'));var authService=require(_0x575d('0xe'));var qs=require(_0x575d('0xf'));var as=require(_0x575d('0x10'));var hardwareService=require(_0x575d('0x11'));var logger=require(_0x575d('0x12'))(_0x575d('0x13'));var utils=require(_0x575d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x575d('0x15'));var db=require(_0x575d('0x16'))['db'];function respondWithStatusCode(_0x5727d2,_0x17c153){_0x17c153=_0x17c153||0xcc;return function(_0x4381a4){if(_0x4381a4){return _0x5727d2[_0x575d('0x17')](_0x17c153);}return _0x5727d2[_0x575d('0x18')](_0x17c153)[_0x575d('0x19')]();};}function respondWithResult(_0x462e4e,_0x349d23){_0x349d23=_0x349d23||0xc8;return function(_0x5c4d05){if(_0x5c4d05){return _0x462e4e[_0x575d('0x18')](_0x349d23)[_0x575d('0x1a')](_0x5c4d05);}};}function respondWithFilteredResult(_0x46bf33,_0x5960dc){return function(_0x5e7992){if(_0x5e7992){var _0x16c34f=_0x5e7992[_0x575d('0x1b')],_0x91842c=_0x5960dc[_0x575d('0x1c')],_0x5ed4c5=_0x5960dc[_0x575d('0x1c')]+_0x5960dc[_0x575d('0x1d')],_0x54a1ae;if(_0x5ed4c5>=_0x16c34f){_0x5ed4c5=_0x16c34f;_0x54a1ae=0xc8;}else{_0x54a1ae=0xce;}_0x46bf33[_0x575d('0x18')](_0x54a1ae);return _0x46bf33[_0x575d('0x1e')](_0x575d('0x1f'),_0x91842c+'-'+_0x5ed4c5+'/'+_0x16c34f)['json'](_0x5e7992);}return null;};}function patchUpdates(_0x5e610c){return function(_0x205017){try{jsonpatch[_0x575d('0x20')](_0x205017,_0x5e610c,!![]);}catch(_0x1da570){return BPromise['reject'](_0x1da570);}return _0x205017[_0x575d('0x21')]();};}function saveUpdates(_0x2c68b8,_0x38c53a){return function(_0x464dcc){if(_0x464dcc){return _0x464dcc[_0x575d('0x22')](_0x2c68b8)[_0x575d('0x23')](function(_0x224dd5){return _0x224dd5;});}return null;};}function removeEntity(_0x201dc5,_0x5a37cb){return function(_0x467eab){if(_0x467eab){return _0x467eab[_0x575d('0x24')]()[_0x575d('0x23')](function(){_0x201dc5['status'](0xcc)[_0x575d('0x19')]();});}};}function handleEntityNotFound(_0x3cd9f6,_0x2b27a9){return function(_0xb0c261){if(!_0xb0c261){_0x3cd9f6['sendStatus'](0x194);}return _0xb0c261;};}function handleError(_0x496ebe,_0x3c1f85){_0x3c1f85=_0x3c1f85||0x1f4;return function(_0x15b3bf){logger[_0x575d('0x25')](_0x15b3bf[_0x575d('0x26')]);if(_0x15b3bf[_0x575d('0x27')]){delete _0x15b3bf['name'];}_0x496ebe['status'](_0x3c1f85)[_0x575d('0x28')](_0x15b3bf);};}exports[_0x575d('0x29')]=function(_0x3cdbbd,_0x550922){var _0x35828f={},_0x5697c7={},_0x292bf2={'count':0x0,'rows':[]};var _0x4a88f2=_[_0x575d('0x2a')](db[_0x575d('0x2b')][_0x575d('0x2c')],function(_0x3611d0){return{'name':_0x3611d0[_0x575d('0x2d')],'type':_0x3611d0[_0x575d('0x2e')]['key']};});_0x5697c7[_0x575d('0x2f')]=_[_0x575d('0x2a')](_0x4a88f2,_0x575d('0x27'));_0x5697c7[_0x575d('0x30')]=_[_0x575d('0x31')](_0x3cdbbd[_0x575d('0x30')]);_0x5697c7[_0x575d('0x32')]=_[_0x575d('0x33')](_0x5697c7[_0x575d('0x2f')],_0x5697c7[_0x575d('0x30')]);_0x35828f[_0x575d('0x34')]=_['intersection'](_0x5697c7['model'],qs[_0x575d('0x35')](_0x3cdbbd[_0x575d('0x30')][_0x575d('0x35')]));_0x35828f[_0x575d('0x34')]=_0x35828f['attributes'][_0x575d('0x36')]?_0x35828f[_0x575d('0x34')]:_0x5697c7[_0x575d('0x2f')];if(!_0x3cdbbd['query'][_0x575d('0x37')]('nolimit')){_0x35828f['limit']=qs[_0x575d('0x1d')](_0x3cdbbd[_0x575d('0x30')]['limit']);_0x35828f[_0x575d('0x1c')]=qs['offset'](_0x3cdbbd[_0x575d('0x30')]['offset']);}_0x35828f[_0x575d('0x38')]=qs[_0x575d('0x39')](_0x3cdbbd[_0x575d('0x30')]['sort']);_0x35828f[_0x575d('0x3a')]=qs[_0x575d('0x32')](_['pick'](_0x3cdbbd[_0x575d('0x30')],_0x5697c7[_0x575d('0x32')]),_0x4a88f2);if(_0x3cdbbd[_0x575d('0x30')]['filter']){_0x35828f[_0x575d('0x3a')]=_[_0x575d('0x3b')](_0x35828f['where'],{'$or':_[_0x575d('0x2a')](_0x4a88f2,function(_0x3799f9){if(_0x3799f9['type']!=='VIRTUAL'){var _0x3c5e6e={};_0x3c5e6e[_0x3799f9['name']]={'$like':'%'+_0x3cdbbd[_0x575d('0x30')][_0x575d('0x3c')]+'%'};return _0x3c5e6e;}})});}_0x35828f=_[_0x575d('0x3b')]({},_0x35828f,_0x3cdbbd[_0x575d('0x3d')]);var _0x4b0521={'where':_0x35828f[_0x575d('0x3a')]};return db['MemberReport'][_0x575d('0x1b')](_0x4b0521)[_0x575d('0x23')](function(_0x430925){_0x292bf2[_0x575d('0x1b')]=_0x430925;if(_0x3cdbbd[_0x575d('0x30')]['includeAll']){_0x35828f[_0x575d('0x3e')]=[{'all':!![]}];}return db['MemberReport']['findAll'](_0x35828f);})[_0x575d('0x23')](function(_0x504853){_0x292bf2[_0x575d('0x3f')]=_0x504853;return _0x292bf2;})[_0x575d('0x23')](respondWithFilteredResult(_0x550922,_0x35828f))[_0x575d('0x40')](handleError(_0x550922,null));};exports['show']=function(_0x5471e2,_0x2af30a){var _0x54716d={'raw':!![],'where':{'id':_0x5471e2[_0x575d('0x41')]['id']}},_0x3f2692={};_0x3f2692[_0x575d('0x2f')]=_['keys'](db[_0x575d('0x2b')][_0x575d('0x2c')]);_0x3f2692['query']=_['keys'](_0x5471e2[_0x575d('0x30')]);_0x3f2692[_0x575d('0x32')]=_[_0x575d('0x33')](_0x3f2692[_0x575d('0x2f')],_0x3f2692[_0x575d('0x30')]);_0x54716d[_0x575d('0x34')]=_['intersection'](_0x3f2692[_0x575d('0x2f')],qs[_0x575d('0x35')](_0x5471e2[_0x575d('0x30')][_0x575d('0x35')]));_0x54716d[_0x575d('0x34')]=_0x54716d[_0x575d('0x34')]['length']?_0x54716d[_0x575d('0x34')]:_0x3f2692[_0x575d('0x2f')];if(_0x5471e2[_0x575d('0x30')][_0x575d('0x42')]){_0x54716d[_0x575d('0x3e')]=[{'all':!![]}];}_0x54716d=_['merge']({},_0x54716d,_0x5471e2[_0x575d('0x3d')]);return db[_0x575d('0x2b')][_0x575d('0x43')](_0x54716d)[_0x575d('0x23')](handleEntityNotFound(_0x2af30a,null))[_0x575d('0x23')](respondWithResult(_0x2af30a,null))[_0x575d('0x40')](handleError(_0x2af30a,null));};exports[_0x575d('0x44')]=function(_0x1874db,_0x2f8cdf){return db[_0x575d('0x2b')][_0x575d('0x44')](_0x1874db['body'],{})[_0x575d('0x23')](respondWithResult(_0x2f8cdf,0xc9))[_0x575d('0x40')](handleError(_0x2f8cdf,null));};exports[_0x575d('0x22')]=function(_0x25eb34,_0x195cb9){if(_0x25eb34[_0x575d('0x45')]['id']){delete _0x25eb34[_0x575d('0x45')]['id'];}return db[_0x575d('0x2b')][_0x575d('0x43')]({'where':{'id':_0x25eb34[_0x575d('0x41')]['id']}})['then'](handleEntityNotFound(_0x195cb9,null))[_0x575d('0x23')](saveUpdates(_0x25eb34[_0x575d('0x45')],null))[_0x575d('0x23')](respondWithResult(_0x195cb9,null))['catch'](handleError(_0x195cb9,null));};exports[_0x575d('0x24')]=function(_0x35f0a2,_0x190458){return db[_0x575d('0x2b')][_0x575d('0x43')]({'where':{'id':_0x35f0a2['params']['id']}})[_0x575d('0x23')](handleEntityNotFound(_0x190458,null))['then'](removeEntity(_0x190458,null))[_0x575d('0x40')](handleError(_0x190458,null));};exports[_0x575d('0x46')]=function(_0x52a2a6,_0x909129){return db[_0x575d('0x2b')]['describe']()[_0x575d('0x23')](respondWithResult(_0x909129,null))[_0x575d('0x40')](handleError(_0x909129,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index aacdd01..792747e 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 _0x6b44=['path','rimraf','exports','define','membername_interface','interface','lodash','util','../../config/logger','api','moment'];(function(_0x55ed4a,_0x46bb79){var _0x5a75ca=function(_0x4352c0){while(--_0x4352c0){_0x55ed4a['push'](_0x55ed4a['shift']());}};_0x5a75ca(++_0x46bb79);}(_0x6b44,0x124));var _0x46b4=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0x6b44[_0x5e42a7];return _0x36d21b;};'use strict';var _=require(_0x46b4('0x0'));var util=require(_0x46b4('0x1'));var logger=require(_0x46b4('0x2'))(_0x46b4('0x3'));var moment=require(_0x46b4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x46b4('0x5'));var rimraf=require(_0x46b4('0x6'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x46b4('0x7')]=function(_0x4a7f88,_0x4ee5e7){return _0x4a7f88[_0x46b4('0x8')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x46b4('0x9'),'fields':['membername',_0x46b4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a91=['../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','interface','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3d916c,_0x2dbb05){var _0x2d5d74=function(_0x1a131b){while(--_0x1a131b){_0x3d916c['push'](_0x3d916c['shift']());}};_0x2d5d74(++_0x2dbb05);}(_0x4a91,0xa8));var _0x14a9=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x4a91[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x14a9('0x0'));var util=require(_0x14a9('0x1'));var logger=require('../../config/logger')(_0x14a9('0x2'));var moment=require(_0x14a9('0x3'));var BPromise=require(_0x14a9('0x4'));var rp=require(_0x14a9('0x5'));var fs=require('fs');var path=require(_0x14a9('0x6'));var rimraf=require(_0x14a9('0x7'));var config=require(_0x14a9('0x8'));var attributes=require(_0x14a9('0x9'));module[_0x14a9('0xa')]=function(_0x4071fe,_0xb90cd5){return _0x4071fe[_0x14a9('0xb')](_0x14a9('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x14a9('0xd'),'fields':[_0x14a9('0xe'),_0x14a9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 3959a5c..ced603d 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 _0x2673=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMemberReport','MemberReport','options','attributes','limit','include','map','model','CreateMemberReport','create','body','raw','UpdateMemberReport','update','where','lodash','util'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x2673,0x154));var _0x3267=function(_0x73b1cd,_0x176535){_0x73b1cd=_0x73b1cd-0x0;var _0x243426=_0x2673[_0x73b1cd];return _0x243426;};'use strict';var _=require(_0x3267('0x0'));var util=require(_0x3267('0x1'));var moment=require(_0x3267('0x2'));var BPromise=require(_0x3267('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3267('0x4'));var db=require(_0x3267('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3267('0x6'))(_0x3267('0x7'));var config=require(_0x3267('0x8'));var jayson=require(_0x3267('0x9'));var client=jayson[_0x3267('0xa')][_0x3267('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57768e,_0xa2b304,_0x2cd393){return new BPromise(function(_0x37f546,_0x1ca8d3){return client[_0x3267('0xc')](_0x57768e,_0x2cd393)[_0x3267('0xd')](function(_0x1d3755){logger[_0x3267('0xe')](_0x3267('0xf'),_0xa2b304,_0x3267('0x10'));logger[_0x3267('0x11')]('MemberReport,\x20%s,\x20%s,\x20%s',_0xa2b304,_0x3267('0x10'),JSON[_0x3267('0x12')](_0x1d3755));if(_0x1d3755['error']){if(_0x1d3755[_0x3267('0x13')]['code']===0x1f4){logger[_0x3267('0x13')](_0x3267('0xf'),_0xa2b304,_0x1d3755[_0x3267('0x13')]['message']);return _0x1ca8d3(_0x1d3755[_0x3267('0x13')][_0x3267('0x14')]);}logger[_0x3267('0x13')]('MemberReport,\x20%s,\x20%s',_0xa2b304,_0x1d3755[_0x3267('0x13')][_0x3267('0x14')]);return _0x37f546(_0x1d3755['error'][_0x3267('0x14')]);}else{logger[_0x3267('0xe')](_0x3267('0xf'),_0xa2b304,_0x3267('0x10'));_0x37f546(_0x1d3755[_0x3267('0x15')][_0x3267('0x14')]);}})[_0x3267('0x16')](function(_0x599a68){logger[_0x3267('0x13')](_0x3267('0xf'),_0xa2b304,_0x599a68);_0x1ca8d3(_0x599a68);});});}exports[_0x3267('0x17')]=function(_0x2b0727){var _0x31a099=this;return new Promise(function(_0x6259b2,_0x189ca2){return db[_0x3267('0x18')]['findAll']({'raw':_0x2b0727['options']?_0x2b0727[_0x3267('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2b0727[_0x3267('0x19')]?_0x2b0727['options']['where']||null:null,'attributes':_0x2b0727[_0x3267('0x19')]?_0x2b0727[_0x3267('0x19')][_0x3267('0x1a')]||null:null,'limit':_0x2b0727[_0x3267('0x19')]?_0x2b0727['options'][_0x3267('0x1b')]||null:null,'include':_0x2b0727['options']?_0x2b0727[_0x3267('0x19')][_0x3267('0x1c')]?_[_0x3267('0x1d')](_0x2b0727[_0x3267('0x19')]['include'],function(_0x3a7e42){return{'model':db[_0x3a7e42[_0x3267('0x1e')]],'as':_0x3a7e42['as'],'attributes':_0x3a7e42[_0x3267('0x1a')],'include':_0x3a7e42['include']?_[_0x3267('0x1d')](_0x3a7e42[_0x3267('0x1c')],function(_0x5dd003){return{'model':db[_0x5dd003[_0x3267('0x1e')]],'as':_0x5dd003['as'],'attributes':_0x5dd003[_0x3267('0x1a')],'include':_0x5dd003[_0x3267('0x1c')]?_[_0x3267('0x1d')](_0x5dd003[_0x3267('0x1c')],function(_0x471701){return{'model':db[_0x471701[_0x3267('0x1e')]],'as':_0x471701['as'],'attributes':_0x471701[_0x3267('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bf2ea){logger[_0x3267('0xe')](_0x3267('0x17'),_0x2b0727);logger[_0x3267('0x11')](_0x3267('0x17'),_0x2b0727,JSON['stringify'](_0x2bf2ea));_0x6259b2(_0x2bf2ea);})[_0x3267('0x16')](function(_0x3f4ad1){logger[_0x3267('0x13')](_0x3267('0x17'),_0x3f4ad1[_0x3267('0x14')],_0x2b0727);_0x189ca2(_0x31a099['error'](0x1f4,_0x3f4ad1[_0x3267('0x14')]));});});};exports[_0x3267('0x1f')]=function(_0x14aa2f){var _0xd50f4c=this;return new Promise(function(_0x118955,_0x29fe6e){return db[_0x3267('0x18')][_0x3267('0x20')](_0x14aa2f[_0x3267('0x21')],{'raw':_0x14aa2f[_0x3267('0x19')]?_0x14aa2f[_0x3267('0x19')][_0x3267('0x22')]===undefined?!![]:![]:!![]})[_0x3267('0xd')](function(_0x2940f0){logger[_0x3267('0xe')](_0x3267('0x1f'),_0x14aa2f);logger[_0x3267('0x11')]('CreateMemberReport',_0x14aa2f,JSON[_0x3267('0x12')](_0x2940f0));_0x118955(_0x2940f0);})['catch'](function(_0x142e13){logger[_0x3267('0x13')](_0x3267('0x1f'),_0x142e13['message'],_0x14aa2f);_0x29fe6e(_0xd50f4c['error'](0x1f4,_0x142e13['message']));});});};exports[_0x3267('0x23')]=function(_0x577ca2){var _0x25c0ef=this;return new Promise(function(_0x40fa99,_0x325a45){return db[_0x3267('0x18')][_0x3267('0x24')](_0x577ca2[_0x3267('0x21')],{'raw':_0x577ca2['options']?_0x577ca2[_0x3267('0x19')][_0x3267('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x577ca2[_0x3267('0x19')]?_0x577ca2[_0x3267('0x19')][_0x3267('0x25')]||null:null,'attributes':_0x577ca2['options']?_0x577ca2['options'][_0x3267('0x1a')]||null:null,'limit':_0x577ca2['options']?_0x577ca2[_0x3267('0x19')]['limit']||null:null})['then'](function(_0x3fb20a){logger[_0x3267('0xe')](_0x3267('0x23'),_0x577ca2);logger['debug'](_0x3267('0x23'),_0x577ca2,JSON[_0x3267('0x12')](_0x3fb20a));_0x40fa99(_0x3fb20a);})[_0x3267('0x16')](function(_0x354b1a){logger[_0x3267('0x13')](_0x3267('0x23'),_0x354b1a[_0x3267('0x14')],_0x577ca2);_0x325a45(_0x25c0ef[_0x3267('0x13')](0x1f4,_0x354b1a[_0x3267('0x14')]));});});}; \ No newline at end of file +var _0x2f66=['jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','then','GetMemberReport','stringify','CreateMemberReport','body','update','UpdateMemberReport','lodash','randomstring','../../config/utils'];(function(_0x46288b,_0x4f51b0){var _0x1a3d7f=function(_0x2053a3){while(--_0x2053a3){_0x46288b['push'](_0x46288b['shift']());}};_0x1a3d7f(++_0x4f51b0);}(_0x2f66,0x168));var _0x62f6=function(_0x14f681,_0xa0808e){_0x14f681=_0x14f681-0x0;var _0x1d4cb2=_0x2f66[_0x14f681];return _0x1d4cb2;};'use strict';var _=require(_0x62f6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x62f6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x62f6('0x2'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x62f6('0x3'));var client=jayson[_0x62f6('0x4')][_0x62f6('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x42d121,_0x54f1ee,_0x5e3d86){return new BPromise(function(_0x3c8b5f,_0x10b5c5){return client[_0x62f6('0x6')](_0x42d121,_0x5e3d86)['then'](function(_0x37f322){logger[_0x62f6('0x7')](_0x62f6('0x8'),_0x54f1ee,'request\x20sent');logger[_0x62f6('0x9')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x54f1ee,_0x62f6('0xa'),JSON['stringify'](_0x37f322));if(_0x37f322[_0x62f6('0xb')]){if(_0x37f322[_0x62f6('0xb')][_0x62f6('0xc')]===0x1f4){logger[_0x62f6('0xb')](_0x62f6('0x8'),_0x54f1ee,_0x37f322[_0x62f6('0xb')][_0x62f6('0xd')]);return _0x10b5c5(_0x37f322[_0x62f6('0xb')][_0x62f6('0xd')]);}logger[_0x62f6('0xb')](_0x62f6('0x8'),_0x54f1ee,_0x37f322[_0x62f6('0xb')][_0x62f6('0xd')]);return _0x3c8b5f(_0x37f322[_0x62f6('0xb')][_0x62f6('0xd')]);}else{logger[_0x62f6('0x7')]('MemberReport,\x20%s,\x20%s',_0x54f1ee,_0x62f6('0xa'));_0x3c8b5f(_0x37f322[_0x62f6('0xe')][_0x62f6('0xd')]);}})[_0x62f6('0xf')](function(_0x1f56a0){logger[_0x62f6('0xb')](_0x62f6('0x8'),_0x54f1ee,_0x1f56a0);_0x10b5c5(_0x1f56a0);});});}exports['GetMemberReport']=function(_0x508857){var _0x536e78=this;return new Promise(function(_0x1ab341,_0x518777){return db[_0x62f6('0x10')][_0x62f6('0x11')]({'raw':_0x508857[_0x62f6('0x12')]?_0x508857['options'][_0x62f6('0x13')]===undefined?!![]:![]:!![],'where':_0x508857[_0x62f6('0x12')]?_0x508857['options'][_0x62f6('0x14')]||null:null,'attributes':_0x508857[_0x62f6('0x12')]?_0x508857[_0x62f6('0x12')]['attributes']||null:null,'limit':_0x508857[_0x62f6('0x12')]?_0x508857[_0x62f6('0x12')][_0x62f6('0x15')]||null:null,'include':_0x508857[_0x62f6('0x12')]?_0x508857[_0x62f6('0x12')][_0x62f6('0x16')]?_[_0x62f6('0x17')](_0x508857[_0x62f6('0x12')]['include'],function(_0x1c3eb4){return{'model':db[_0x1c3eb4['model']],'as':_0x1c3eb4['as'],'attributes':_0x1c3eb4['attributes'],'include':_0x1c3eb4['include']?_['map'](_0x1c3eb4[_0x62f6('0x16')],function(_0x56b34d){return{'model':db[_0x56b34d[_0x62f6('0x18')]],'as':_0x56b34d['as'],'attributes':_0x56b34d[_0x62f6('0x19')],'include':_0x56b34d[_0x62f6('0x16')]?_[_0x62f6('0x17')](_0x56b34d[_0x62f6('0x16')],function(_0x32a6de){return{'model':db[_0x32a6de[_0x62f6('0x18')]],'as':_0x32a6de['as'],'attributes':_0x32a6de['attributes']};}):[]};}):[]};}):[]:[]})[_0x62f6('0x1a')](function(_0x5b4fac){logger[_0x62f6('0x7')](_0x62f6('0x1b'),_0x508857);logger[_0x62f6('0x9')](_0x62f6('0x1b'),_0x508857,JSON[_0x62f6('0x1c')](_0x5b4fac));_0x1ab341(_0x5b4fac);})[_0x62f6('0xf')](function(_0x4035f2){logger[_0x62f6('0xb')](_0x62f6('0x1b'),_0x4035f2[_0x62f6('0xd')],_0x508857);_0x518777(_0x536e78[_0x62f6('0xb')](0x1f4,_0x4035f2['message']));});});};exports[_0x62f6('0x1d')]=function(_0x1fcde0){var _0x23ccc1=this;return new Promise(function(_0x299881,_0x694f29){return db[_0x62f6('0x10')]['create'](_0x1fcde0[_0x62f6('0x1e')],{'raw':_0x1fcde0[_0x62f6('0x12')]?_0x1fcde0[_0x62f6('0x12')]['raw']===undefined?!![]:![]:!![]})[_0x62f6('0x1a')](function(_0x4d9a46){logger[_0x62f6('0x7')](_0x62f6('0x1d'),_0x1fcde0);logger[_0x62f6('0x9')](_0x62f6('0x1d'),_0x1fcde0,JSON['stringify'](_0x4d9a46));_0x299881(_0x4d9a46);})[_0x62f6('0xf')](function(_0x215bb9){logger[_0x62f6('0xb')](_0x62f6('0x1d'),_0x215bb9['message'],_0x1fcde0);_0x694f29(_0x23ccc1[_0x62f6('0xb')](0x1f4,_0x215bb9['message']));});});};exports['UpdateMemberReport']=function(_0x5e6e91){var _0x3ec9af=this;return new Promise(function(_0x2551e6,_0x2a743b){return db[_0x62f6('0x10')][_0x62f6('0x1f')](_0x5e6e91['body'],{'raw':_0x5e6e91['options']?_0x5e6e91[_0x62f6('0x12')][_0x62f6('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6e91['options']?_0x5e6e91[_0x62f6('0x12')][_0x62f6('0x14')]||null:null,'attributes':_0x5e6e91['options']?_0x5e6e91[_0x62f6('0x12')][_0x62f6('0x19')]||null:null,'limit':_0x5e6e91[_0x62f6('0x12')]?_0x5e6e91[_0x62f6('0x12')][_0x62f6('0x15')]||null:null})[_0x62f6('0x1a')](function(_0x43df98){logger[_0x62f6('0x7')](_0x62f6('0x20'),_0x5e6e91);logger[_0x62f6('0x9')]('UpdateMemberReport',_0x5e6e91,JSON['stringify'](_0x43df98));_0x2551e6(_0x43df98);})[_0x62f6('0xf')](function(_0x4c0be8){logger[_0x62f6('0xb')]('UpdateMemberReport',_0x4c0be8[_0x62f6('0xd')],_0x5e6e91);_0x2a743b(_0x3ec9af[_0x62f6('0xb')](0x1f4,_0x4c0be8[_0x62f6('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 21f6cbd..640e8d5 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 _0x3266=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','exports','multer','util','path','connect-timeout'];(function(_0x1a58e2,_0x2204bf){var _0x8a1401=function(_0x1b8ae3){while(--_0x1b8ae3){_0x1a58e2['push'](_0x1a58e2['shift']());}};_0x8a1401(++_0x2204bf);}(_0x3266,0x6a));var _0x6326=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x3266[_0xc0a3d3];return _0x3386e8;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var auth=require(_0x6326('0x6'));var interaction=require(_0x6326('0x7'));var config=require(_0x6326('0x8'));var controller=require('./migration.controller');router[_0x6326('0x9')]('/',controller['index']);module[_0x6326('0xa')]=router; \ No newline at end of file +var _0xb9be=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','exports','multer'];(function(_0x54813d,_0x101c1f){var _0x561eea=function(_0x1faa0a){while(--_0x1faa0a){_0x54813d['push'](_0x54813d['shift']());}};_0x561eea(++_0x101c1f);}(_0xb9be,0xc5));var _0xeb9b=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0xb9be[_0x496738];return _0xee1381;};'use strict';var multer=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var path=require(_0xeb9b('0x2'));var timeout=require(_0xeb9b('0x3'));var express=require(_0xeb9b('0x4'));var router=express[_0xeb9b('0x5')]();var auth=require(_0xeb9b('0x6'));var interaction=require(_0xeb9b('0x7'));var config=require(_0xeb9b('0x8'));var controller=require('./migration.controller');router['get']('/',controller[_0xeb9b('0x9')]);module[_0xeb9b('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index c9d02d5..475db5e 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 _0xd707=['version','sequelize','exports'];(function(_0x6aea3a,_0x4fa133){var _0x2c9a38=function(_0x7f9cb2){while(--_0x7f9cb2){_0x6aea3a['push'](_0x6aea3a['shift']());}};_0x2c9a38(++_0x4fa133);}(_0xd707,0x172));var _0x7d70=function(_0x210ca0,_0x1b6d00){_0x210ca0=_0x210ca0-0x0;var _0x1a3f9b=_0xd707[_0x210ca0];return _0x1a3f9b;};'use strict';var Sequelize=require(_0x7d70('0x0'));module[_0x7d70('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x7d70('0x2')}}; \ No newline at end of file +var _0x906a=['exports','version'];(function(_0x18f18d,_0x5ea672){var _0x24899c=function(_0x19b80c){while(--_0x19b80c){_0x18f18d['push'](_0x18f18d['shift']());}};_0x24899c(++_0x5ea672);}(_0x906a,0x90));var _0xa906=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x906a[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xa906('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0xa906('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 44acb68..a42227b 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 _0x1e62=['reject','save','update','then','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','Migration','includeAll','include','findAll','rows','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply'];(function(_0x44073b,_0x53116c){var _0x3757d4=function(_0x1a7263){while(--_0x1a7263){_0x44073b['push'](_0x44073b['shift']());}};_0x3757d4(++_0x53116c);}(_0x1e62,0x153));var _0x21e6=function(_0x541a6f,_0xd32796){_0x541a6f=_0x541a6f-0x0;var _0x4d6427=_0x1e62[_0x541a6f];return _0x4d6427;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x21e6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x21e6('0x1'));var rp=require(_0x21e6('0x2'));var moment=require(_0x21e6('0x3'));var BPromise=require(_0x21e6('0x4'));var Mustache=require(_0x21e6('0x5'));var util=require(_0x21e6('0x6'));var path=require(_0x21e6('0x7'));var sox=require(_0x21e6('0x8'));var csv=require(_0x21e6('0x9'));var ejs=require(_0x21e6('0xa'));var fs=require('fs');var _=require(_0x21e6('0xb'));var squel=require(_0x21e6('0xc'));var crypto=require(_0x21e6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x21e6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x21e6('0xf'));var Papa=require(_0x21e6('0x10'));var Redis=require(_0x21e6('0x11'));var authService=require(_0x21e6('0x12'));var qs=require(_0x21e6('0x13'));var as=require(_0x21e6('0x14'));var hardwareService=require(_0x21e6('0x15'));var logger=require(_0x21e6('0x16'))(_0x21e6('0x17'));var utils=require(_0x21e6('0x18'));var config=require(_0x21e6('0x19'));var licenseUtil=require(_0x21e6('0x1a'));var db=require(_0x21e6('0x1b'))['db'];function respondWithStatusCode(_0x5e6c60,_0xb17a4c){_0xb17a4c=_0xb17a4c||0xcc;return function(_0x13ccb6){if(_0x13ccb6){return _0x5e6c60[_0x21e6('0x1c')](_0xb17a4c);}return _0x5e6c60[_0x21e6('0x1d')](_0xb17a4c)['end']();};}function respondWithResult(_0x2ff0e6,_0x40db7d){_0x40db7d=_0x40db7d||0xc8;return function(_0xbd877c){if(_0xbd877c){return _0x2ff0e6[_0x21e6('0x1d')](_0x40db7d)[_0x21e6('0x1e')](_0xbd877c);}};}function respondWithFilteredResult(_0x324f1d,_0xddabcf){return function(_0x49db83){if(_0x49db83){var _0x37a327=_0x49db83[_0x21e6('0x1f')],_0x105b59=_0xddabcf[_0x21e6('0x20')],_0x5d2b10=_0xddabcf[_0x21e6('0x20')]+_0xddabcf['limit'],_0x59157c;if(_0x5d2b10>=_0x37a327){_0x5d2b10=_0x37a327;_0x59157c=0xc8;}else{_0x59157c=0xce;}_0x324f1d[_0x21e6('0x1d')](_0x59157c);return _0x324f1d[_0x21e6('0x21')](_0x21e6('0x22'),_0x105b59+'-'+_0x5d2b10+'/'+_0x37a327)[_0x21e6('0x1e')](_0x49db83);}return null;};}function patchUpdates(_0x3708dd){return function(_0x132e64){try{jsonpatch[_0x21e6('0x23')](_0x132e64,_0x3708dd,!![]);}catch(_0x33da23){return BPromise[_0x21e6('0x24')](_0x33da23);}return _0x132e64[_0x21e6('0x25')]();};}function saveUpdates(_0x588010,_0x42a877){return function(_0x289e80){if(_0x289e80){return _0x289e80[_0x21e6('0x26')](_0x588010)[_0x21e6('0x27')](function(_0x18165a){return _0x18165a;});}return null;};}function removeEntity(_0x56d4e1,_0x5123e8){return function(_0xad888f){if(_0xad888f){return _0xad888f[_0x21e6('0x28')]()[_0x21e6('0x27')](function(){_0x56d4e1[_0x21e6('0x1d')](0xcc)[_0x21e6('0x29')]();});}};}function handleEntityNotFound(_0x319d29,_0x2a5400){return function(_0x55a022){if(!_0x55a022){_0x319d29[_0x21e6('0x1c')](0x194);}return _0x55a022;};}function handleError(_0x158495,_0x536391){_0x536391=_0x536391||0x1f4;return function(_0x4a2e2f){logger['error'](_0x4a2e2f[_0x21e6('0x2a')]);if(_0x4a2e2f[_0x21e6('0x2b')]){delete _0x4a2e2f['name'];}_0x158495[_0x21e6('0x1d')](_0x536391)[_0x21e6('0x2c')](_0x4a2e2f);};}exports[_0x21e6('0x2d')]=function(_0x5ded02,_0x505855){var _0x2d9152={},_0x3877da={},_0x3d04a6={'count':0x0,'rows':[]};var _0x2eaaad=_['map'](db['Migration'][_0x21e6('0x2e')],function(_0x199d33){return{'name':_0x199d33[_0x21e6('0x2f')],'type':_0x199d33[_0x21e6('0x30')]['key']};});_0x3877da[_0x21e6('0x31')]=_[_0x21e6('0x32')](_0x2eaaad,_0x21e6('0x2b'));_0x3877da[_0x21e6('0x33')]=_[_0x21e6('0x34')](_0x5ded02[_0x21e6('0x33')]);_0x3877da[_0x21e6('0x35')]=_[_0x21e6('0x36')](_0x3877da[_0x21e6('0x31')],_0x3877da['query']);_0x2d9152[_0x21e6('0x37')]=_['intersection'](_0x3877da[_0x21e6('0x31')],qs[_0x21e6('0x38')](_0x5ded02[_0x21e6('0x33')]['fields']));_0x2d9152[_0x21e6('0x37')]=_0x2d9152[_0x21e6('0x37')][_0x21e6('0x39')]?_0x2d9152[_0x21e6('0x37')]:_0x3877da[_0x21e6('0x31')];if(!_0x5ded02[_0x21e6('0x33')][_0x21e6('0x3a')](_0x21e6('0x3b'))){_0x2d9152[_0x21e6('0x3c')]=qs[_0x21e6('0x3c')](_0x5ded02[_0x21e6('0x33')][_0x21e6('0x3c')]);_0x2d9152[_0x21e6('0x20')]=qs[_0x21e6('0x20')](_0x5ded02[_0x21e6('0x33')]['offset']);}_0x2d9152[_0x21e6('0x3d')]=qs[_0x21e6('0x3e')](_0x5ded02[_0x21e6('0x33')][_0x21e6('0x3e')]);_0x2d9152['where']=qs[_0x21e6('0x35')](_[_0x21e6('0x3f')](_0x5ded02[_0x21e6('0x33')],_0x3877da['filters']),_0x2eaaad);if(_0x5ded02[_0x21e6('0x33')][_0x21e6('0x40')]){_0x2d9152[_0x21e6('0x41')]=_[_0x21e6('0x42')](_0x2d9152[_0x21e6('0x41')],{'$or':_[_0x21e6('0x32')](_0x2eaaad,function(_0x597399){if(_0x597399[_0x21e6('0x30')]!==_0x21e6('0x43')){var _0x31f297={};_0x31f297[_0x597399[_0x21e6('0x2b')]]={'$like':'%'+_0x5ded02[_0x21e6('0x33')][_0x21e6('0x40')]+'%'};return _0x31f297;}})});}_0x2d9152=_[_0x21e6('0x42')]({},_0x2d9152,_0x5ded02[_0x21e6('0x44')]);var _0x36f3ac={'where':_0x2d9152[_0x21e6('0x41')]};return db[_0x21e6('0x45')]['count'](_0x36f3ac)['then'](function(_0x499d83){_0x3d04a6[_0x21e6('0x1f')]=_0x499d83;if(_0x5ded02['query'][_0x21e6('0x46')]){_0x2d9152[_0x21e6('0x47')]=[{'all':!![]}];}return db[_0x21e6('0x45')][_0x21e6('0x48')](_0x2d9152);})[_0x21e6('0x27')](function(_0x44c265){_0x3d04a6[_0x21e6('0x49')]=_0x44c265;return _0x3d04a6;})['then'](respondWithFilteredResult(_0x505855,_0x2d9152))[_0x21e6('0x4a')](handleError(_0x505855,null));}; \ No newline at end of file +var _0x89a5=['ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','then','destroy','error','name','send','Migration','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x89a5,0x1a9));var _0x589a=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x89a5[_0x2aec52];return _0x3b8835;};'use strict';var pdf=require(_0x589a('0x0'));var emlformat=require(_0x589a('0x1'));var rimraf=require(_0x589a('0x2'));var zipdir=require(_0x589a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x589a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x589a('0x5'));var path=require(_0x589a('0x6'));var sox=require(_0x589a('0x7'));var csv=require(_0x589a('0x8'));var ejs=require(_0x589a('0x9'));var fs=require('fs');var _=require(_0x589a('0xa'));var squel=require('squel');var crypto=require(_0x589a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x589a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x589a('0xd'));var Papa=require(_0x589a('0xe'));var Redis=require(_0x589a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x589a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x589a('0x11'));var logger=require('../../config/logger')(_0x589a('0x12'));var utils=require('../../config/utils');var config=require(_0x589a('0x13'));var licenseUtil=require(_0x589a('0x14'));var db=require(_0x589a('0x15'))['db'];function respondWithStatusCode(_0x1e9eb2,_0x3b2265){_0x3b2265=_0x3b2265||0xcc;return function(_0xea49c){if(_0xea49c){return _0x1e9eb2[_0x589a('0x16')](_0x3b2265);}return _0x1e9eb2[_0x589a('0x17')](_0x3b2265)[_0x589a('0x18')]();};}function respondWithResult(_0x1bb211,_0x2cc166){_0x2cc166=_0x2cc166||0xc8;return function(_0x3cbd3c){if(_0x3cbd3c){return _0x1bb211[_0x589a('0x17')](_0x2cc166)[_0x589a('0x19')](_0x3cbd3c);}};}function respondWithFilteredResult(_0x1255dd,_0x3de3cc){return function(_0xb1f4fe){if(_0xb1f4fe){var _0x613bcd=_0xb1f4fe[_0x589a('0x1a')],_0x192032=_0x3de3cc[_0x589a('0x1b')],_0x812305=_0x3de3cc[_0x589a('0x1b')]+_0x3de3cc[_0x589a('0x1c')],_0x2f4485;if(_0x812305>=_0x613bcd){_0x812305=_0x613bcd;_0x2f4485=0xc8;}else{_0x2f4485=0xce;}_0x1255dd[_0x589a('0x17')](_0x2f4485);return _0x1255dd['set'](_0x589a('0x1d'),_0x192032+'-'+_0x812305+'/'+_0x613bcd)[_0x589a('0x19')](_0xb1f4fe);}return null;};}function patchUpdates(_0x4a1776){return function(_0x39915f){try{jsonpatch[_0x589a('0x1e')](_0x39915f,_0x4a1776,!![]);}catch(_0x2dbcdf){return BPromise['reject'](_0x2dbcdf);}return _0x39915f[_0x589a('0x1f')]();};}function saveUpdates(_0x4e4603,_0x3bf58b){return function(_0x69883d){if(_0x69883d){return _0x69883d['update'](_0x4e4603)[_0x589a('0x20')](function(_0x4cba31){return _0x4cba31;});}return null;};}function removeEntity(_0x15f387,_0x46e449){return function(_0x5692da){if(_0x5692da){return _0x5692da[_0x589a('0x21')]()[_0x589a('0x20')](function(){_0x15f387[_0x589a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x176101,_0x446bba){return function(_0x36515e){if(!_0x36515e){_0x176101[_0x589a('0x16')](0x194);}return _0x36515e;};}function handleError(_0x45d353,_0x30a4ca){_0x30a4ca=_0x30a4ca||0x1f4;return function(_0x4a93bb){logger[_0x589a('0x22')](_0x4a93bb['stack']);if(_0x4a93bb[_0x589a('0x23')]){delete _0x4a93bb[_0x589a('0x23')];}_0x45d353['status'](_0x30a4ca)[_0x589a('0x24')](_0x4a93bb);};}exports['index']=function(_0x20a08b,_0x5b415e){var _0x369411={},_0x618b3={},_0x3beedb={'count':0x0,'rows':[]};var _0x26f799=_['map'](db[_0x589a('0x25')][_0x589a('0x26')],function(_0x7a62c7){return{'name':_0x7a62c7['fieldName'],'type':_0x7a62c7[_0x589a('0x27')][_0x589a('0x28')]};});_0x618b3[_0x589a('0x29')]=_[_0x589a('0x2a')](_0x26f799,'name');_0x618b3[_0x589a('0x2b')]=_['keys'](_0x20a08b[_0x589a('0x2b')]);_0x618b3[_0x589a('0x2c')]=_[_0x589a('0x2d')](_0x618b3[_0x589a('0x29')],_0x618b3[_0x589a('0x2b')]);_0x369411[_0x589a('0x2e')]=_[_0x589a('0x2d')](_0x618b3[_0x589a('0x29')],qs[_0x589a('0x2f')](_0x20a08b['query'][_0x589a('0x2f')]));_0x369411['attributes']=_0x369411[_0x589a('0x2e')][_0x589a('0x30')]?_0x369411[_0x589a('0x2e')]:_0x618b3['model'];if(!_0x20a08b['query']['hasOwnProperty']('nolimit')){_0x369411['limit']=qs[_0x589a('0x1c')](_0x20a08b['query'][_0x589a('0x1c')]);_0x369411[_0x589a('0x1b')]=qs[_0x589a('0x1b')](_0x20a08b[_0x589a('0x2b')][_0x589a('0x1b')]);}_0x369411[_0x589a('0x31')]=qs[_0x589a('0x32')](_0x20a08b[_0x589a('0x2b')][_0x589a('0x32')]);_0x369411[_0x589a('0x33')]=qs[_0x589a('0x2c')](_[_0x589a('0x34')](_0x20a08b[_0x589a('0x2b')],_0x618b3[_0x589a('0x2c')]),_0x26f799);if(_0x20a08b[_0x589a('0x2b')][_0x589a('0x35')]){_0x369411[_0x589a('0x33')]=_['merge'](_0x369411[_0x589a('0x33')],{'$or':_[_0x589a('0x2a')](_0x26f799,function(_0x2fd60a){if(_0x2fd60a[_0x589a('0x27')]!==_0x589a('0x36')){var _0x332920={};_0x332920[_0x2fd60a[_0x589a('0x23')]]={'$like':'%'+_0x20a08b[_0x589a('0x2b')]['filter']+'%'};return _0x332920;}})});}_0x369411=_[_0x589a('0x37')]({},_0x369411,_0x20a08b[_0x589a('0x38')]);var _0x2f9a72={'where':_0x369411['where']};return db[_0x589a('0x25')][_0x589a('0x1a')](_0x2f9a72)[_0x589a('0x20')](function(_0x18efa6){_0x3beedb[_0x589a('0x1a')]=_0x18efa6;if(_0x20a08b[_0x589a('0x2b')][_0x589a('0x39')]){_0x369411[_0x589a('0x3a')]=[{'all':!![]}];}return db['Migration'][_0x589a('0x3b')](_0x369411);})[_0x589a('0x20')](function(_0x55f51c){_0x3beedb[_0x589a('0x3c')]=_0x55f51c;return _0x3beedb;})[_0x589a('0x20')](respondWithFilteredResult(_0x5b415e,_0x369411))[_0x589a('0x3d')](handleError(_0x5b415e,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index de5be90..90958f1 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 _0xb5d5=['./migration.attributes','exports','define','migrations','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x9d9d58,_0x7bf873){var _0x51d4d3=function(_0x3e7528){while(--_0x3e7528){_0x9d9d58['push'](_0x9d9d58['shift']());}};_0x51d4d3(++_0x7bf873);}(_0xb5d5,0x1c0));var _0x5b5d=function(_0x3c6e08,_0x5686e4){_0x3c6e08=_0x3c6e08-0x0;var _0x38f68b=_0xb5d5[_0x3c6e08];return _0x38f68b;};'use strict';var _=require('lodash');var util=require(_0x5b5d('0x0'));var logger=require('../../config/logger')(_0x5b5d('0x1'));var moment=require(_0x5b5d('0x2'));var BPromise=require(_0x5b5d('0x3'));var rp=require(_0x5b5d('0x4'));var fs=require('fs');var path=require(_0x5b5d('0x5'));var rimraf=require(_0x5b5d('0x6'));var config=require(_0x5b5d('0x7'));var attributes=require(_0x5b5d('0x8'));module[_0x5b5d('0x9')]=function(_0x4bdedb,_0x579236){return _0x4bdedb[_0x5b5d('0xa')]('Migration',attributes,{'tableName':_0x5b5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7700=['path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x27ad07,_0x2d3d47){var _0x3148b4=function(_0x3e8f75){while(--_0x3e8f75){_0x27ad07['push'](_0x27ad07['shift']());}};_0x3148b4(++_0x2d3d47);}(_0x7700,0xcb));var _0x0770=function(_0x3d3a2d,_0x1e246b){_0x3d3a2d=_0x3d3a2d-0x0;var _0x3f16ae=_0x7700[_0x3d3a2d];return _0x3f16ae;};'use strict';var _=require('lodash');var util=require(_0x0770('0x0'));var logger=require(_0x0770('0x1'))('api');var moment=require(_0x0770('0x2'));var BPromise=require(_0x0770('0x3'));var rp=require(_0x0770('0x4'));var fs=require('fs');var path=require(_0x0770('0x5'));var rimraf=require(_0x0770('0x6'));var config=require(_0x0770('0x7'));var attributes=require(_0x0770('0x8'));module[_0x0770('0x9')]=function(_0x225ac2,_0x33f0e5){return _0x225ac2[_0x0770('0xa')](_0x0770('0xb'),attributes,{'tableName':_0x0770('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index ebcf647..ee03dd5 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 _0x00a4=['then','request\x20sent','stringify','error','code','message','Migration,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x69e491,_0x3148ef){var _0x4d80cb=function(_0x3c8739){while(--_0x3c8739){_0x69e491['push'](_0x69e491['shift']());}};_0x4d80cb(++_0x3148ef);}(_0x00a4,0x186));var _0x400a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00a4[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x400a('0x0'));var util=require(_0x400a('0x1'));var moment=require(_0x400a('0x2'));var BPromise=require(_0x400a('0x3'));var rs=require(_0x400a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x400a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x400a('0x6'))(_0x400a('0x7'));var config=require('../../config/environment');var jayson=require(_0x400a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x209c30,_0x27f92b,_0xbc350){return new BPromise(function(_0x38772e,_0x32b08f){return client['request'](_0x209c30,_0xbc350)[_0x400a('0x9')](function(_0x3d505e){logger['info']('Migration,\x20%s,\x20%s',_0x27f92b,_0x400a('0xa'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x27f92b,_0x400a('0xa'),JSON[_0x400a('0xb')](_0x3d505e));if(_0x3d505e[_0x400a('0xc')]){if(_0x3d505e[_0x400a('0xc')][_0x400a('0xd')]===0x1f4){logger[_0x400a('0xc')]('Migration,\x20%s,\x20%s',_0x27f92b,_0x3d505e[_0x400a('0xc')][_0x400a('0xe')]);return _0x32b08f(_0x3d505e['error']['message']);}logger['error'](_0x400a('0xf'),_0x27f92b,_0x3d505e[_0x400a('0xc')][_0x400a('0xe')]);return _0x38772e(_0x3d505e[_0x400a('0xc')][_0x400a('0xe')]);}else{logger[_0x400a('0x10')]('Migration,\x20%s,\x20%s',_0x27f92b,_0x400a('0xa'));_0x38772e(_0x3d505e[_0x400a('0x11')][_0x400a('0xe')]);}})[_0x400a('0x12')](function(_0x18de24){logger[_0x400a('0xc')](_0x400a('0xf'),_0x27f92b,_0x18de24);_0x32b08f(_0x18de24);});});} \ No newline at end of file +var _0x6ca5=['client','http','then','info','Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1af105,_0x1221b8){var _0x13f7ec=function(_0x3530cf){while(--_0x3530cf){_0x1af105['push'](_0x1af105['shift']());}};_0x13f7ec(++_0x1221b8);}(_0x6ca5,0xf2));var _0x56ca=function(_0x2e046d,_0x346fb9){_0x2e046d=_0x2e046d-0x0;var _0x536fa2=_0x6ca5[_0x2e046d];return _0x536fa2;};'use strict';var _=require(_0x56ca('0x0'));var util=require(_0x56ca('0x1'));var moment=require('moment');var BPromise=require(_0x56ca('0x2'));var rs=require(_0x56ca('0x3'));var fs=require('fs');var Redis=require(_0x56ca('0x4'));var db=require(_0x56ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x56ca('0x6'))(_0x56ca('0x7'));var config=require(_0x56ca('0x8'));var jayson=require(_0x56ca('0x9'));var client=jayson[_0x56ca('0xa')][_0x56ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fae6a,_0x3d98c0,_0x7a06da){return new BPromise(function(_0x51d51d,_0x30b506){return client['request'](_0x4fae6a,_0x7a06da)[_0x56ca('0xc')](function(_0x23aed8){logger[_0x56ca('0xd')](_0x56ca('0xe'),_0x3d98c0,'request\x20sent');logger['debug'](_0x56ca('0xf'),_0x3d98c0,_0x56ca('0x10'),JSON[_0x56ca('0x11')](_0x23aed8));if(_0x23aed8['error']){if(_0x23aed8[_0x56ca('0x12')]['code']===0x1f4){logger['error'](_0x56ca('0xe'),_0x3d98c0,_0x23aed8[_0x56ca('0x12')][_0x56ca('0x13')]);return _0x30b506(_0x23aed8[_0x56ca('0x12')]['message']);}logger[_0x56ca('0x12')]('Migration,\x20%s,\x20%s',_0x3d98c0,_0x23aed8[_0x56ca('0x12')][_0x56ca('0x13')]);return _0x51d51d(_0x23aed8[_0x56ca('0x12')][_0x56ca('0x13')]);}else{logger[_0x56ca('0xd')](_0x56ca('0xe'),_0x3d98c0,_0x56ca('0x10'));_0x51d51d(_0x23aed8['result'][_0x56ca('0x13')]);}})[_0x56ca('0x14')](function(_0x5c0ddc){logger[_0x56ca('0x12')]('Migration,\x20%s,\x20%s',_0x3d98c0,_0x5c0ddc);_0x30b506(_0x5c0ddc);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 24b6834..5dd6b2c 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 _0x4886=['delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','create','put','update'];(function(_0x55593e,_0x5eab12){var _0x439cb8=function(_0x51be21){while(--_0x51be21){_0x55593e['push'](_0x55593e['shift']());}};_0x439cb8(++_0x5eab12);}(_0x4886,0x122));var _0x6488=function(_0x181ebd,_0x2e49f6){_0x181ebd=_0x181ebd-0x0;var _0x584e12=_0x4886[_0x181ebd];return _0x584e12;};'use strict';var multer=require(_0x6488('0x0'));var util=require('util');var path=require(_0x6488('0x1'));var timeout=require(_0x6488('0x2'));var express=require(_0x6488('0x3'));var router=express['Router']();var auth=require(_0x6488('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6488('0x5'));var controller=require(_0x6488('0x6'));router[_0x6488('0x7')]('/',auth['isAuthenticated'](),controller[_0x6488('0x8')]);router['get'](_0x6488('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6488('0xa')](),controller[_0x6488('0xb')]);router[_0x6488('0xc')](_0x6488('0x9'),auth[_0x6488('0xa')](),controller[_0x6488('0xd')]);router[_0x6488('0xe')](_0x6488('0x9'),auth[_0x6488('0xa')](),controller[_0x6488('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5733=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x40c616,_0x805861){var _0x39d91b=function(_0x2ce277){while(--_0x2ce277){_0x40c616['push'](_0x40c616['shift']());}};_0x39d91b(++_0x805861);}(_0x5733,0x163));var _0x3573=function(_0x891272,_0x4e33fc){_0x891272=_0x891272-0x0;var _0x5eaf79=_0x5733[_0x891272];return _0x5eaf79;};'use strict';var multer=require(_0x3573('0x0'));var util=require(_0x3573('0x1'));var path=require(_0x3573('0x2'));var timeout=require(_0x3573('0x3'));var express=require(_0x3573('0x4'));var router=express[_0x3573('0x5')]();var auth=require(_0x3573('0x6'));var interaction=require(_0x3573('0x7'));var config=require(_0x3573('0x8'));var controller=require('./network.controller');router[_0x3573('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3573('0x9')](_0x3573('0xa'),auth[_0x3573('0xb')](),controller[_0x3573('0xc')]);router[_0x3573('0xd')]('/',auth[_0x3573('0xb')](),controller[_0x3573('0xe')]);router[_0x3573('0xf')](_0x3573('0xa'),auth['isAuthenticated'](),controller[_0x3573('0x10')]);router[_0x3573('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3573('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 27efdb4..597bec9 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(_0x37d2af,_0x20d2be){var _0x3a6510=function(_0xc38fc4){while(--_0xc38fc4){_0x37d2af['push'](_0x37d2af['shift']());}};_0x3a6510(++_0x20d2be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x4c0bb0,_0x155af2){var _0x2ef50b=function(_0x10d114){while(--_0x10d114){_0x4c0bb0['push'](_0x4c0bb0['shift']());}};_0x2ef50b(++_0x155af2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 b790a48..cd8fa04 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 _0x3cf3=['debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','index','map','Network','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','sequelize','transaction','body','toUpperCase','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','create','join','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','STUN','server/files/templates/stun_multiple.ejs','server/files/templates/network.ejs','format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','Network,\x20%s,\x20%s','request\x20sent'];(function(_0x12abec,_0x40124c){var _0x4a13a6=function(_0x114512){while(--_0x114512){_0x12abec['push'](_0x12abec['shift']());}};_0x4a13a6(++_0x40124c);}(_0x3cf3,0x128));var _0x33cf=function(_0x25fe9e,_0x2088a4){_0x25fe9e=_0x25fe9e-0x0;var _0x1210ce=_0x3cf3[_0x25fe9e];return _0x1210ce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x33cf('0x0'));var rimraf=require(_0x33cf('0x1'));var zipdir=require(_0x33cf('0x2'));var jsonpatch=require(_0x33cf('0x3'));var rp=require('request-promise');var moment=require(_0x33cf('0x4'));var BPromise=require(_0x33cf('0x5'));var Mustache=require('mustache');var util=require(_0x33cf('0x6'));var path=require(_0x33cf('0x7'));var sox=require(_0x33cf('0x8'));var csv=require(_0x33cf('0x9'));var ejs=require(_0x33cf('0xa'));var fs=require('fs');var _=require(_0x33cf('0xb'));var squel=require(_0x33cf('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x33cf('0xd'));var toCsv=require(_0x33cf('0x9'));var querystring=require(_0x33cf('0xe'));var Papa=require(_0x33cf('0xf'));var Redis=require(_0x33cf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x33cf('0x11'));var as=require(_0x33cf('0x12'));var hardwareService=require(_0x33cf('0x13'));var logger=require(_0x33cf('0x14'))(_0x33cf('0x15'));var utils=require(_0x33cf('0x16'));var config=require(_0x33cf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x33cf('0x18'))['db'];var jayson=require(_0x33cf('0x19'));var client=jayson[_0x33cf('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x87f256,_0x151813,_0x4e7d72,_0x25f967){return new BPromise(function(_0x21c32e,_0x3c0017){var _0x132cea=_0x25f967||client;return _0x132cea[_0x33cf('0x1b')](_0x87f256,_0x4e7d72)[_0x33cf('0x1c')](function(_0xdcbdee){logger['info'](_0x33cf('0x1d'),_0x151813,_0x33cf('0x1e'));logger[_0x33cf('0x1f')](_0x33cf('0x20'),_0x151813,_0x33cf('0x1e'),JSON[_0x33cf('0x21')](_0xdcbdee));if(_0xdcbdee['error']){if(_0xdcbdee[_0x33cf('0x22')]['code']===0x1f4){logger[_0x33cf('0x22')](_0x33cf('0x1d'),_0x151813,_0xdcbdee['error'][_0x33cf('0x23')]);return _0x3c0017(_0xdcbdee[_0x33cf('0x22')][_0x33cf('0x23')]);}logger[_0x33cf('0x22')](_0x33cf('0x1d'),_0x151813,_0xdcbdee[_0x33cf('0x22')][_0x33cf('0x23')]);return _0x21c32e(_0xdcbdee[_0x33cf('0x22')][_0x33cf('0x23')]);}else{logger[_0x33cf('0x24')]('Network,\x20%s,\x20%s',_0x151813,_0x33cf('0x1e'));_0x21c32e(_0xdcbdee[_0x33cf('0x25')][_0x33cf('0x23')]);}})[_0x33cf('0x26')](function(_0x17fdee){logger['error'](_0x33cf('0x1d'),_0x151813,_0x17fdee);_0x3c0017(_0x17fdee);});});}function respondWithStatusCode(_0x4a9f3c,_0x277150){_0x277150=_0x277150||0xcc;return function(_0x16624f){if(_0x16624f){return _0x4a9f3c[_0x33cf('0x27')](_0x277150);}return _0x4a9f3c[_0x33cf('0x28')](_0x277150)[_0x33cf('0x29')]();};}function respondWithResult(_0x8ee8b5,_0x1f570f){_0x1f570f=_0x1f570f||0xc8;return function(_0x5af06e){if(_0x5af06e){return _0x8ee8b5[_0x33cf('0x28')](_0x1f570f)['json'](_0x5af06e);}};}function respondWithFilteredResult(_0x4463af,_0x5f3b2f){return function(_0x352cf8){if(_0x352cf8){var _0xc341f6=_0x352cf8[_0x33cf('0x2a')],_0x350dab=_0x5f3b2f[_0x33cf('0x2b')],_0x1e0abc=_0x5f3b2f[_0x33cf('0x2b')]+_0x5f3b2f[_0x33cf('0x2c')],_0x259d8a;if(_0x1e0abc>=_0xc341f6){_0x1e0abc=_0xc341f6;_0x259d8a=0xc8;}else{_0x259d8a=0xce;}_0x4463af[_0x33cf('0x28')](_0x259d8a);return _0x4463af[_0x33cf('0x2d')](_0x33cf('0x2e'),_0x350dab+'-'+_0x1e0abc+'/'+_0xc341f6)[_0x33cf('0x2f')](_0x352cf8);}return null;};}function patchUpdates(_0x597672){return function(_0x33ef3f){try{jsonpatch[_0x33cf('0x30')](_0x33ef3f,_0x597672,!![]);}catch(_0x599b33){return BPromise['reject'](_0x599b33);}return _0x33ef3f[_0x33cf('0x31')]();};}function saveUpdates(_0x2eb0fd,_0x4c628c){return function(_0x144ba8){if(_0x144ba8){return _0x144ba8[_0x33cf('0x32')](_0x2eb0fd)[_0x33cf('0x1c')](function(_0x2b37da){return _0x2b37da;});}return null;};}function removeEntity(_0x547932,_0x22596e){return function(_0x4c9ee2){if(_0x4c9ee2){return _0x4c9ee2[_0x33cf('0x33')]()['then'](function(){_0x547932[_0x33cf('0x28')](0xcc)[_0x33cf('0x29')]();});}};}function handleEntityNotFound(_0x47e140,_0x27dd8f){return function(_0x2fc83a){if(!_0x2fc83a){_0x47e140[_0x33cf('0x27')](0x194);}return _0x2fc83a;};}function handleError(_0xe21a8f,_0x3012e9){_0x3012e9=_0x3012e9||0x1f4;return function(_0x578b8c){logger[_0x33cf('0x22')](_0x578b8c[_0x33cf('0x34')]);if(_0x578b8c[_0x33cf('0x35')]){delete _0x578b8c[_0x33cf('0x35')];}_0xe21a8f[_0x33cf('0x28')](_0x3012e9)['send'](_0x578b8c);};}exports[_0x33cf('0x36')]=function(_0x93c0cd,_0x3c3a07){var _0x126d3c={},_0x3421fd={},_0x4610b6={'count':0x0,'rows':[]};var _0x46155d=_[_0x33cf('0x37')](db[_0x33cf('0x38')][_0x33cf('0x39')],function(_0x5824b2){return{'name':_0x5824b2['fieldName'],'type':_0x5824b2[_0x33cf('0x3a')][_0x33cf('0x3b')]};});_0x3421fd['model']=_[_0x33cf('0x37')](_0x46155d,_0x33cf('0x35'));_0x3421fd[_0x33cf('0x3c')]=_[_0x33cf('0x3d')](_0x93c0cd[_0x33cf('0x3c')]);_0x3421fd[_0x33cf('0x3e')]=_[_0x33cf('0x3f')](_0x3421fd[_0x33cf('0x40')],_0x3421fd[_0x33cf('0x3c')]);_0x126d3c[_0x33cf('0x41')]=_[_0x33cf('0x3f')](_0x3421fd[_0x33cf('0x40')],qs['fields'](_0x93c0cd[_0x33cf('0x3c')][_0x33cf('0x42')]));_0x126d3c[_0x33cf('0x41')]=_0x126d3c[_0x33cf('0x41')][_0x33cf('0x43')]?_0x126d3c[_0x33cf('0x41')]:_0x3421fd[_0x33cf('0x40')];if(!_0x93c0cd[_0x33cf('0x3c')][_0x33cf('0x44')](_0x33cf('0x45'))){_0x126d3c[_0x33cf('0x2c')]=qs[_0x33cf('0x2c')](_0x93c0cd[_0x33cf('0x3c')][_0x33cf('0x2c')]);_0x126d3c[_0x33cf('0x2b')]=qs['offset'](_0x93c0cd[_0x33cf('0x3c')]['offset']);}_0x126d3c[_0x33cf('0x46')]=qs[_0x33cf('0x47')](_0x93c0cd['query']['sort']);_0x126d3c[_0x33cf('0x48')]=qs[_0x33cf('0x3e')](_[_0x33cf('0x49')](_0x93c0cd[_0x33cf('0x3c')],_0x3421fd[_0x33cf('0x3e')]),_0x46155d);if(_0x93c0cd[_0x33cf('0x3c')][_0x33cf('0x4a')]){_0x126d3c[_0x33cf('0x48')]=_[_0x33cf('0x4b')](_0x126d3c[_0x33cf('0x48')],{'$or':_[_0x33cf('0x37')](_0x46155d,function(_0x44fb96){if(_0x44fb96[_0x33cf('0x3a')]!==_0x33cf('0x4c')){var _0x3537b3={};_0x3537b3[_0x44fb96[_0x33cf('0x35')]]={'$like':'%'+_0x93c0cd[_0x33cf('0x3c')][_0x33cf('0x4a')]+'%'};return _0x3537b3;}})});}_0x126d3c=_[_0x33cf('0x4b')]({},_0x126d3c,_0x93c0cd[_0x33cf('0x4d')]);var _0x2d2ed7={'where':_0x126d3c['where']};return db[_0x33cf('0x38')][_0x33cf('0x2a')](_0x2d2ed7)[_0x33cf('0x1c')](function(_0xf07b6a){_0x4610b6[_0x33cf('0x2a')]=_0xf07b6a;if(_0x93c0cd['query']['includeAll']){_0x126d3c[_0x33cf('0x4e')]=[{'all':!![]}];}return db[_0x33cf('0x38')][_0x33cf('0x4f')](_0x126d3c);})[_0x33cf('0x1c')](function(_0x299ff1){_0x4610b6[_0x33cf('0x50')]=_0x299ff1;return _0x4610b6;})[_0x33cf('0x1c')](respondWithFilteredResult(_0x3c3a07,_0x126d3c))['catch'](handleError(_0x3c3a07,null));};exports[_0x33cf('0x51')]=function(_0x185465,_0x19e142){var _0x938c45={'raw':!![],'where':{'id':_0x185465[_0x33cf('0x52')]['id']}},_0x467dee={};_0x467dee['model']=_[_0x33cf('0x3d')](db[_0x33cf('0x38')][_0x33cf('0x39')]);_0x467dee[_0x33cf('0x3c')]=_[_0x33cf('0x3d')](_0x185465[_0x33cf('0x3c')]);_0x467dee[_0x33cf('0x3e')]=_['intersection'](_0x467dee['model'],_0x467dee[_0x33cf('0x3c')]);_0x938c45[_0x33cf('0x41')]=_[_0x33cf('0x3f')](_0x467dee[_0x33cf('0x40')],qs[_0x33cf('0x42')](_0x185465[_0x33cf('0x3c')]['fields']));_0x938c45[_0x33cf('0x41')]=_0x938c45[_0x33cf('0x41')][_0x33cf('0x43')]?_0x938c45[_0x33cf('0x41')]:_0x467dee[_0x33cf('0x40')];if(_0x185465[_0x33cf('0x3c')][_0x33cf('0x53')]){_0x938c45[_0x33cf('0x4e')]=[{'all':!![]}];}_0x938c45=_['merge']({},_0x938c45,_0x185465[_0x33cf('0x4d')]);return db[_0x33cf('0x38')][_0x33cf('0x54')](_0x938c45)[_0x33cf('0x1c')](handleEntityNotFound(_0x19e142,null))[_0x33cf('0x1c')](respondWithResult(_0x19e142,null))[_0x33cf('0x26')](handleError(_0x19e142,null));};exports['create']=function(_0x3c7955,_0x32c87c,_0x187893){var _0x296efa;return db[_0x33cf('0x55')][_0x33cf('0x56')](function(_0x91c52){return db[_0x33cf('0x38')]['create'](_0x3c7955[_0x33cf('0x57')],{'raw':!![]})[_0x33cf('0x1c')](function(_0x40edaf){_0x296efa=_0x40edaf;return db['Network'][_0x33cf('0x4f')]({'where':{'type':_0x3c7955[_0x33cf('0x57')][_0x33cf('0x3a')]},'raw':!![]});})[_0x33cf('0x1c')](function(_0x4b5e21){if(_0x296efa[_0x33cf('0x3a')][_0x33cf('0x58')]()=='STUN'){var _0x5da4b0=fs[_0x33cf('0x59')](path['join'](config[_0x33cf('0x5a')],'server/files/templates/stun_multiple.ejs'),_0x33cf('0x5b'));var _0x45393d=ejs[_0x33cf('0x5c')](_0x5da4b0,{'networks':_0x4b5e21||[]});fs[_0x33cf('0x5d')](_0x33cf('0x5e'),_0x45393d);return respondWithRpcPromise(_0x33cf('0x5f'),'create',{'module':_0x33cf('0x60')});}else if(_0x296efa['type'][_0x33cf('0x58')]()==_0x33cf('0x61')){var _0x4cc1d2=fs[_0x33cf('0x59')](path['join'](config[_0x33cf('0x5a')],_0x33cf('0x62')),_0x33cf('0x5b'));var _0x54d054=ejs[_0x33cf('0x5c')](_0x4cc1d2,{'networks':_0x4b5e21||[]});fs[_0x33cf('0x5d')](_0x33cf('0x63'),_0x54d054);return respondWithRpcPromise(_0x33cf('0x5f'),_0x33cf('0x64'),{'module':_0x33cf('0x60')});}else{var _0x33df7c=fs[_0x33cf('0x59')](path[_0x33cf('0x65')](config[_0x33cf('0x5a')],'server/files/templates/network.ejs'),'utf8');var _0x3b5fe5=ejs['render'](_0x33df7c,{'networks':_0x4b5e21||[]});fs[_0x33cf('0x5d')](util['format'](_0x33cf('0x66'),_0x3c7955[_0x33cf('0x57')][_0x33cf('0x3a')][_0x33cf('0x67')]()),_0x3b5fe5);return respondWithRpcPromise(_0x33cf('0x5f'),_0x33cf('0x64'),{'module':_0x33cf('0x68')});}return null;})['then'](function(){return _0x296efa;});})[_0x33cf('0x1c')](respondWithResult(_0x32c87c,0xc9))[_0x33cf('0x26')](handleError(_0x32c87c,null));};exports['update']=function(_0x3d6052,_0x1e1732,_0xc46760){var _0x28ffb1;return db['sequelize'][_0x33cf('0x56')](function(_0x658d67){return db[_0x33cf('0x38')][_0x33cf('0x54')]({'where':{'id':_0x3d6052[_0x33cf('0x52')]['id']}})[_0x33cf('0x1c')](handleEntityNotFound(_0x1e1732,null))[_0x33cf('0x1c')](saveUpdates(_0x3d6052['body'],null))[_0x33cf('0x1c')](function(_0x1b1176){if(_0x1b1176){_0x28ffb1=_0x1b1176;return db[_0x33cf('0x38')][_0x33cf('0x4f')]({'where':{'type':_0x28ffb1[_0x33cf('0x3a')]},'raw':!![]});}return null;})[_0x33cf('0x1c')](function(_0x24e6cf){if(_0x28ffb1[_0x33cf('0x3a')][_0x33cf('0x58')]()==_0x33cf('0x69')){var _0x4e596f=fs[_0x33cf('0x59')](path['join'](config[_0x33cf('0x5a')],_0x33cf('0x6a')),_0x33cf('0x5b'));var _0x3c8ccb=ejs[_0x33cf('0x5c')](_0x4e596f,{'networks':_0x24e6cf||[]});fs[_0x33cf('0x5d')](_0x33cf('0x5e'),_0x3c8ccb);return respondWithRpcPromise(_0x33cf('0x5f'),'update',{'module':_0x33cf('0x60')});}else if(_0x28ffb1[_0x33cf('0x3a')][_0x33cf('0x58')]()==_0x33cf('0x61')){var _0x65daf5=fs[_0x33cf('0x59')](path[_0x33cf('0x65')](config[_0x33cf('0x5a')],_0x33cf('0x62')),_0x33cf('0x5b'));var _0x4d13bd=ejs['render'](_0x65daf5,{'networks':_0x24e6cf||[]});fs[_0x33cf('0x5d')](_0x33cf('0x63'),_0x4d13bd);return respondWithRpcPromise(_0x33cf('0x5f'),'update',{'module':_0x33cf('0x60')});}else{var _0x21118b=fs[_0x33cf('0x59')](path[_0x33cf('0x65')](config['root'],_0x33cf('0x6b')),'utf8');var _0x40de55=ejs['render'](_0x21118b,{'networks':_0x24e6cf||[]});fs[_0x33cf('0x5d')](util[_0x33cf('0x6c')](_0x33cf('0x66'),_0x3d6052[_0x33cf('0x57')][_0x33cf('0x3a')]['toLowerCase']()),_0x40de55);return respondWithRpcPromise(_0x33cf('0x5f'),_0x33cf('0x32'),{'module':_0x33cf('0x68')});}return null;})['then'](function(_0x52cb8f){if(_0x52cb8f){return _0x28ffb1;}return null;});})[_0x33cf('0x1c')](respondWithResult(_0x1e1732,null))[_0x33cf('0x26')](handleError(_0x1e1732,null));};exports['destroy']=function(_0x1bbe0b,_0x32fee5,_0x366199){var _0x21b52b;return db[_0x33cf('0x38')][_0x33cf('0x54')]({'where':{'id':_0x1bbe0b[_0x33cf('0x52')]['id']}})[_0x33cf('0x1c')](function(_0x5c2633){_0x21b52b=_0x5c2633;return _0x5c2633;})['then'](handleEntityNotFound(_0x32fee5,null))['then'](removeEntity(_0x32fee5,null))[_0x33cf('0x1c')](function(){if(_0x21b52b){return db[_0x33cf('0x38')][_0x33cf('0x4f')]({'where':{'type':_0x21b52b[_0x33cf('0x3a')]},'raw':!![]});}})['then'](function(_0x547597){if(_0x21b52b[_0x33cf('0x3a')][_0x33cf('0x58')]()==_0x33cf('0x69')){var _0x157da7=fs[_0x33cf('0x59')](path[_0x33cf('0x65')](config[_0x33cf('0x5a')],'server/files/templates/stun_multiple.ejs'),_0x33cf('0x5b'));var _0x2e228c=ejs[_0x33cf('0x5c')](_0x157da7,{'networks':_0x547597||[]});fs['writeFileSync'](_0x33cf('0x5e'),_0x2e228c);return respondWithRpcPromise('Reload',_0x33cf('0x33'),{'module':'res_stun_monitor.so'});}else if(_0x21b52b[_0x33cf('0x3a')][_0x33cf('0x58')]()==_0x33cf('0x61')){var _0x42a33b=fs[_0x33cf('0x59')](path[_0x33cf('0x65')](config[_0x33cf('0x5a')],_0x33cf('0x62')),_0x33cf('0x5b'));var _0x1831bb=ejs[_0x33cf('0x5c')](_0x42a33b,{'networks':_0x547597||[]});fs[_0x33cf('0x5d')](_0x33cf('0x63'),_0x1831bb);return respondWithRpcPromise(_0x33cf('0x5f'),'destroy',{'module':_0x33cf('0x60')});}else{var _0x1e468b=fs[_0x33cf('0x59')](path[_0x33cf('0x65')](config[_0x33cf('0x5a')],_0x33cf('0x6b')),_0x33cf('0x5b'));var _0xe3cb35=ejs[_0x33cf('0x5c')](_0x1e468b,{'networks':_0x547597||[]});fs[_0x33cf('0x5d')](util[_0x33cf('0x6c')](_0x33cf('0x66'),_0x1bbe0b[_0x33cf('0x57')][_0x33cf('0x3a')][_0x33cf('0x67')]()),_0xe3cb35);return respondWithRpcPromise(_0x33cf('0x5f'),_0x33cf('0x33'),{'module':_0x33cf('0x68')});}return null;})[_0x33cf('0x26')](handleError(_0x32fee5,null));}; \ No newline at end of file +var _0x02fe=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','Network','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','rows','show','params','include','find','sequelize','transaction','create','body','findAll','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','writeFileSync','Reload','res_stun_monitor.so','TURN','utf8','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','toUpperCase','/etc/asterisk/stun_xcally.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x5085c1,_0x222c2a){var _0x399a43=function(_0x2cfd2d){while(--_0x2cfd2d){_0x5085c1['push'](_0x5085c1['shift']());}};_0x399a43(++_0x222c2a);}(_0x02fe,0x1b8));var _0xe02f=function(_0x46015e,_0x3a20f9){_0x46015e=_0x46015e-0x0;var _0x3c1bfc=_0x02fe[_0x46015e];return _0x3c1bfc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe02f('0x0'));var rimraf=require(_0xe02f('0x1'));var zipdir=require(_0xe02f('0x2'));var jsonpatch=require(_0xe02f('0x3'));var rp=require(_0xe02f('0x4'));var moment=require(_0xe02f('0x5'));var BPromise=require(_0xe02f('0x6'));var Mustache=require(_0xe02f('0x7'));var util=require(_0xe02f('0x8'));var path=require(_0xe02f('0x9'));var sox=require(_0xe02f('0xa'));var csv=require(_0xe02f('0xb'));var ejs=require(_0xe02f('0xc'));var fs=require('fs');var _=require(_0xe02f('0xd'));var squel=require(_0xe02f('0xe'));var crypto=require(_0xe02f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe02f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe02f('0x11'));var Papa=require(_0xe02f('0x12'));var Redis=require(_0xe02f('0x13'));var authService=require(_0xe02f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe02f('0x15'));var hardwareService=require(_0xe02f('0x16'));var logger=require(_0xe02f('0x17'))(_0xe02f('0x18'));var utils=require(_0xe02f('0x19'));var config=require(_0xe02f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe02f('0x1b'))['db'];var jayson=require(_0xe02f('0x1c'));var client=jayson[_0xe02f('0x1d')][_0xe02f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x445c46,_0x4e6c5d,_0x58eaa3,_0x2ef418){return new BPromise(function(_0x1fe881,_0x35fe54){var _0x5ed618=_0x2ef418||client;return _0x5ed618['request'](_0x445c46,_0x58eaa3)[_0xe02f('0x1f')](function(_0x3cdec3){logger['info']('Network,\x20%s,\x20%s',_0x4e6c5d,'request\x20sent');logger[_0xe02f('0x20')](_0xe02f('0x21'),_0x4e6c5d,_0xe02f('0x22'),JSON[_0xe02f('0x23')](_0x3cdec3));if(_0x3cdec3['error']){if(_0x3cdec3[_0xe02f('0x24')][_0xe02f('0x25')]===0x1f4){logger[_0xe02f('0x24')](_0xe02f('0x26'),_0x4e6c5d,_0x3cdec3['error']['message']);return _0x35fe54(_0x3cdec3[_0xe02f('0x24')]['message']);}logger[_0xe02f('0x24')](_0xe02f('0x26'),_0x4e6c5d,_0x3cdec3[_0xe02f('0x24')][_0xe02f('0x27')]);return _0x1fe881(_0x3cdec3[_0xe02f('0x24')][_0xe02f('0x27')]);}else{logger[_0xe02f('0x28')]('Network,\x20%s,\x20%s',_0x4e6c5d,'request\x20sent');_0x1fe881(_0x3cdec3[_0xe02f('0x29')][_0xe02f('0x27')]);}})[_0xe02f('0x2a')](function(_0x246c73){logger['error'](_0xe02f('0x26'),_0x4e6c5d,_0x246c73);_0x35fe54(_0x246c73);});});}function respondWithStatusCode(_0x272608,_0x53dfaa){_0x53dfaa=_0x53dfaa||0xcc;return function(_0x41ecc2){if(_0x41ecc2){return _0x272608[_0xe02f('0x2b')](_0x53dfaa);}return _0x272608[_0xe02f('0x2c')](_0x53dfaa)[_0xe02f('0x2d')]();};}function respondWithResult(_0xcd2da3,_0x4a986a){_0x4a986a=_0x4a986a||0xc8;return function(_0xf5644){if(_0xf5644){return _0xcd2da3['status'](_0x4a986a)[_0xe02f('0x2e')](_0xf5644);}};}function respondWithFilteredResult(_0x4fa9ea,_0xd35be5){return function(_0x314ecf){if(_0x314ecf){var _0x1d69ff=_0x314ecf[_0xe02f('0x2f')],_0xa8d9ee=_0xd35be5[_0xe02f('0x30')],_0x18ce7c=_0xd35be5[_0xe02f('0x30')]+_0xd35be5[_0xe02f('0x31')],_0x35b481;if(_0x18ce7c>=_0x1d69ff){_0x18ce7c=_0x1d69ff;_0x35b481=0xc8;}else{_0x35b481=0xce;}_0x4fa9ea['status'](_0x35b481);return _0x4fa9ea[_0xe02f('0x32')](_0xe02f('0x33'),_0xa8d9ee+'-'+_0x18ce7c+'/'+_0x1d69ff)[_0xe02f('0x2e')](_0x314ecf);}return null;};}function patchUpdates(_0x29ede1){return function(_0x389d59){try{jsonpatch[_0xe02f('0x34')](_0x389d59,_0x29ede1,!![]);}catch(_0x25601c){return BPromise[_0xe02f('0x35')](_0x25601c);}return _0x389d59[_0xe02f('0x36')]();};}function saveUpdates(_0xdd06d,_0x58fe33){return function(_0x4d5c23){if(_0x4d5c23){return _0x4d5c23[_0xe02f('0x37')](_0xdd06d)[_0xe02f('0x1f')](function(_0x141267){return _0x141267;});}return null;};}function removeEntity(_0x285561,_0x5a4a9e){return function(_0x320bec){if(_0x320bec){return _0x320bec[_0xe02f('0x38')]()['then'](function(){_0x285561['status'](0xcc)[_0xe02f('0x2d')]();});}};}function handleEntityNotFound(_0x38d6f2,_0x3a0bab){return function(_0x55ffe6){if(!_0x55ffe6){_0x38d6f2[_0xe02f('0x2b')](0x194);}return _0x55ffe6;};}function handleError(_0x2500fa,_0x70e878){_0x70e878=_0x70e878||0x1f4;return function(_0x5f35a1){logger[_0xe02f('0x24')](_0x5f35a1[_0xe02f('0x39')]);if(_0x5f35a1['name']){delete _0x5f35a1[_0xe02f('0x3a')];}_0x2500fa[_0xe02f('0x2c')](_0x70e878)['send'](_0x5f35a1);};}exports[_0xe02f('0x3b')]=function(_0x50f294,_0x4acd22){var _0x3fb321={},_0x5bd86e={},_0x279576={'count':0x0,'rows':[]};var _0x554fa2=_[_0xe02f('0x3c')](db[_0xe02f('0x3d')]['rawAttributes'],function(_0x4db336){return{'name':_0x4db336[_0xe02f('0x3e')],'type':_0x4db336[_0xe02f('0x3f')][_0xe02f('0x40')]};});_0x5bd86e[_0xe02f('0x41')]=_[_0xe02f('0x3c')](_0x554fa2,_0xe02f('0x3a'));_0x5bd86e[_0xe02f('0x42')]=_[_0xe02f('0x43')](_0x50f294[_0xe02f('0x42')]);_0x5bd86e[_0xe02f('0x44')]=_['intersection'](_0x5bd86e[_0xe02f('0x41')],_0x5bd86e[_0xe02f('0x42')]);_0x3fb321[_0xe02f('0x45')]=_[_0xe02f('0x46')](_0x5bd86e[_0xe02f('0x41')],qs[_0xe02f('0x47')](_0x50f294['query'][_0xe02f('0x47')]));_0x3fb321[_0xe02f('0x45')]=_0x3fb321[_0xe02f('0x45')][_0xe02f('0x48')]?_0x3fb321[_0xe02f('0x45')]:_0x5bd86e[_0xe02f('0x41')];if(!_0x50f294[_0xe02f('0x42')][_0xe02f('0x49')](_0xe02f('0x4a'))){_0x3fb321[_0xe02f('0x31')]=qs[_0xe02f('0x31')](_0x50f294['query']['limit']);_0x3fb321[_0xe02f('0x30')]=qs[_0xe02f('0x30')](_0x50f294['query'][_0xe02f('0x30')]);}_0x3fb321[_0xe02f('0x4b')]=qs[_0xe02f('0x4c')](_0x50f294[_0xe02f('0x42')][_0xe02f('0x4c')]);_0x3fb321[_0xe02f('0x4d')]=qs['filters'](_['pick'](_0x50f294['query'],_0x5bd86e[_0xe02f('0x44')]),_0x554fa2);if(_0x50f294['query'][_0xe02f('0x4e')]){_0x3fb321[_0xe02f('0x4d')]=_[_0xe02f('0x4f')](_0x3fb321['where'],{'$or':_[_0xe02f('0x3c')](_0x554fa2,function(_0x6c1946){if(_0x6c1946['type']!==_0xe02f('0x50')){var _0x3fe9a7={};_0x3fe9a7[_0x6c1946[_0xe02f('0x3a')]]={'$like':'%'+_0x50f294['query'][_0xe02f('0x4e')]+'%'};return _0x3fe9a7;}})});}_0x3fb321=_[_0xe02f('0x4f')]({},_0x3fb321,_0x50f294['options']);var _0x212b27={'where':_0x3fb321[_0xe02f('0x4d')]};return db[_0xe02f('0x3d')][_0xe02f('0x2f')](_0x212b27)[_0xe02f('0x1f')](function(_0x3c0114){_0x279576[_0xe02f('0x2f')]=_0x3c0114;if(_0x50f294[_0xe02f('0x42')][_0xe02f('0x51')]){_0x3fb321['include']=[{'all':!![]}];}return db[_0xe02f('0x3d')]['findAll'](_0x3fb321);})[_0xe02f('0x1f')](function(_0x5b17c8){_0x279576[_0xe02f('0x52')]=_0x5b17c8;return _0x279576;})[_0xe02f('0x1f')](respondWithFilteredResult(_0x4acd22,_0x3fb321))[_0xe02f('0x2a')](handleError(_0x4acd22,null));};exports[_0xe02f('0x53')]=function(_0x27b8a9,_0x3c0883){var _0x30c4ec={'raw':!![],'where':{'id':_0x27b8a9[_0xe02f('0x54')]['id']}},_0x2de3ce={};_0x2de3ce['model']=_[_0xe02f('0x43')](db[_0xe02f('0x3d')]['rawAttributes']);_0x2de3ce[_0xe02f('0x42')]=_[_0xe02f('0x43')](_0x27b8a9[_0xe02f('0x42')]);_0x2de3ce[_0xe02f('0x44')]=_[_0xe02f('0x46')](_0x2de3ce[_0xe02f('0x41')],_0x2de3ce['query']);_0x30c4ec[_0xe02f('0x45')]=_['intersection'](_0x2de3ce[_0xe02f('0x41')],qs[_0xe02f('0x47')](_0x27b8a9['query']['fields']));_0x30c4ec[_0xe02f('0x45')]=_0x30c4ec['attributes']['length']?_0x30c4ec[_0xe02f('0x45')]:_0x2de3ce[_0xe02f('0x41')];if(_0x27b8a9[_0xe02f('0x42')][_0xe02f('0x51')]){_0x30c4ec[_0xe02f('0x55')]=[{'all':!![]}];}_0x30c4ec=_[_0xe02f('0x4f')]({},_0x30c4ec,_0x27b8a9['options']);return db['Network'][_0xe02f('0x56')](_0x30c4ec)[_0xe02f('0x1f')](handleEntityNotFound(_0x3c0883,null))[_0xe02f('0x1f')](respondWithResult(_0x3c0883,null))[_0xe02f('0x2a')](handleError(_0x3c0883,null));};exports['create']=function(_0x1d31e4,_0x1e8169,_0x3f8e92){var _0x1926fd;return db[_0xe02f('0x57')][_0xe02f('0x58')](function(_0x1f40cd){return db[_0xe02f('0x3d')][_0xe02f('0x59')](_0x1d31e4[_0xe02f('0x5a')],{'raw':!![]})[_0xe02f('0x1f')](function(_0x3cb43f){_0x1926fd=_0x3cb43f;return db[_0xe02f('0x3d')][_0xe02f('0x5b')]({'where':{'type':_0x1d31e4['body']['type']},'raw':!![]});})[_0xe02f('0x1f')](function(_0x4cd2e2){if(_0x1926fd[_0xe02f('0x3f')]['toUpperCase']()==_0xe02f('0x5c')){var _0x587eec=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config[_0xe02f('0x5f')],_0xe02f('0x60')),'utf8');var _0x119a62=ejs['render'](_0x587eec,{'networks':_0x4cd2e2||[]});fs[_0xe02f('0x61')]('/etc/asterisk/stun_xcally.conf',_0x119a62);return respondWithRpcPromise(_0xe02f('0x62'),_0xe02f('0x59'),{'module':_0xe02f('0x63')});}else if(_0x1926fd[_0xe02f('0x3f')]['toUpperCase']()==_0xe02f('0x64')){var _0x5e472d=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xe02f('0x65'));var _0xf224f4=ejs[_0xe02f('0x66')](_0x5e472d,{'networks':_0x4cd2e2||[]});fs[_0xe02f('0x61')](_0xe02f('0x67'),_0xf224f4);return respondWithRpcPromise(_0xe02f('0x62'),'create',{'module':_0xe02f('0x63')});}else{var _0x1f23d7=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config[_0xe02f('0x5f')],_0xe02f('0x68')),'utf8');var _0x3ce900=ejs[_0xe02f('0x66')](_0x1f23d7,{'networks':_0x4cd2e2||[]});fs['writeFileSync'](util[_0xe02f('0x69')](_0xe02f('0x6a'),_0x1d31e4[_0xe02f('0x5a')][_0xe02f('0x3f')][_0xe02f('0x6b')]()),_0x3ce900);return respondWithRpcPromise(_0xe02f('0x62'),_0xe02f('0x59'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x1926fd;});})[_0xe02f('0x1f')](respondWithResult(_0x1e8169,0xc9))[_0xe02f('0x2a')](handleError(_0x1e8169,null));};exports[_0xe02f('0x37')]=function(_0x31e85f,_0x2e1631,_0x1dca35){var _0x552869;return db[_0xe02f('0x57')][_0xe02f('0x58')](function(_0x207c40){return db[_0xe02f('0x3d')]['find']({'where':{'id':_0x31e85f['params']['id']}})[_0xe02f('0x1f')](handleEntityNotFound(_0x2e1631,null))[_0xe02f('0x1f')](saveUpdates(_0x31e85f[_0xe02f('0x5a')],null))['then'](function(_0x4ebb8e){if(_0x4ebb8e){_0x552869=_0x4ebb8e;return db['Network'][_0xe02f('0x5b')]({'where':{'type':_0x552869[_0xe02f('0x3f')]},'raw':!![]});}return null;})['then'](function(_0x3a05e5){if(_0x552869[_0xe02f('0x3f')][_0xe02f('0x6c')]()=='STUN'){var _0x1483bd=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config[_0xe02f('0x5f')],_0xe02f('0x60')),'utf8');var _0x296e5e=ejs['render'](_0x1483bd,{'networks':_0x3a05e5||[]});fs[_0xe02f('0x61')](_0xe02f('0x6d'),_0x296e5e);return respondWithRpcPromise(_0xe02f('0x62'),'update',{'module':'res_stun_monitor.so'});}else if(_0x552869[_0xe02f('0x3f')][_0xe02f('0x6c')]()==_0xe02f('0x64')){var _0x562adb=fs['readFileSync'](path[_0xe02f('0x5e')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xe02f('0x65'));var _0x58ab89=ejs[_0xe02f('0x66')](_0x562adb,{'networks':_0x3a05e5||[]});fs[_0xe02f('0x61')](_0xe02f('0x67'),_0x58ab89);return respondWithRpcPromise(_0xe02f('0x62'),_0xe02f('0x37'),{'module':_0xe02f('0x63')});}else{var _0x1de5cd=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config['root'],_0xe02f('0x68')),'utf8');var _0x3eb6b3=ejs[_0xe02f('0x66')](_0x1de5cd,{'networks':_0x3a05e5||[]});fs[_0xe02f('0x61')](util[_0xe02f('0x69')](_0xe02f('0x6a'),_0x31e85f['body'][_0xe02f('0x3f')]['toLowerCase']()),_0x3eb6b3);return respondWithRpcPromise('Reload',_0xe02f('0x37'),{'module':_0xe02f('0x6e')});}return null;})[_0xe02f('0x1f')](function(_0x952607){if(_0x952607){return _0x552869;}return null;});})[_0xe02f('0x1f')](respondWithResult(_0x2e1631,null))['catch'](handleError(_0x2e1631,null));};exports['destroy']=function(_0x4212ad,_0x548036,_0x341619){var _0x3c8e63;return db['Network'][_0xe02f('0x56')]({'where':{'id':_0x4212ad[_0xe02f('0x54')]['id']}})[_0xe02f('0x1f')](function(_0x45c845){_0x3c8e63=_0x45c845;return _0x45c845;})[_0xe02f('0x1f')](handleEntityNotFound(_0x548036,null))['then'](removeEntity(_0x548036,null))[_0xe02f('0x1f')](function(){if(_0x3c8e63){return db['Network'][_0xe02f('0x5b')]({'where':{'type':_0x3c8e63['type']},'raw':!![]});}})[_0xe02f('0x1f')](function(_0x40592b){if(_0x3c8e63[_0xe02f('0x3f')][_0xe02f('0x6c')]()==_0xe02f('0x5c')){var _0x4edfa6=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config[_0xe02f('0x5f')],'server/files/templates/stun_multiple.ejs'),_0xe02f('0x65'));var _0x402682=ejs[_0xe02f('0x66')](_0x4edfa6,{'networks':_0x40592b||[]});fs[_0xe02f('0x61')](_0xe02f('0x6d'),_0x402682);return respondWithRpcPromise('Reload','destroy',{'module':_0xe02f('0x63')});}else if(_0x3c8e63['type'][_0xe02f('0x6c')]()==_0xe02f('0x64')){var _0x131634=fs['readFileSync'](path[_0xe02f('0x5e')](config[_0xe02f('0x5f')],'server/files/templates/turn_multiple.ejs'),_0xe02f('0x65'));var _0x2b94f5=ejs['render'](_0x131634,{'networks':_0x40592b||[]});fs[_0xe02f('0x61')](_0xe02f('0x67'),_0x2b94f5);return respondWithRpcPromise(_0xe02f('0x62'),_0xe02f('0x38'),{'module':_0xe02f('0x63')});}else{var _0x5e4920=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config[_0xe02f('0x5f')],'server/files/templates/network.ejs'),_0xe02f('0x65'));var _0x4e4091=ejs[_0xe02f('0x66')](_0x5e4920,{'networks':_0x40592b||[]});fs[_0xe02f('0x61')](util[_0xe02f('0x69')](_0xe02f('0x6a'),_0x4212ad[_0xe02f('0x5a')][_0xe02f('0x3f')][_0xe02f('0x6b')]()),_0x4e4091);return respondWithRpcPromise(_0xe02f('0x62'),'destroy',{'module':_0xe02f('0x6e')});}return null;})[_0xe02f('0x2a')](handleError(_0x548036,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 9d15b46..b6a9d8c 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 _0x999f=['api','moment','request-promise','path','../../config/environment','exports','define','network','lodash','../../config/logger'];(function(_0x3aea92,_0x145c0a){var _0x3e9c65=function(_0xefe1d1){while(--_0xefe1d1){_0x3aea92['push'](_0x3aea92['shift']());}};_0x3e9c65(++_0x145c0a);}(_0x999f,0xf8));var _0xf999=function(_0x915de9,_0xabf9e5){_0x915de9=_0x915de9-0x0;var _0x274129=_0x999f[_0x915de9];return _0x274129;};'use strict';var _=require(_0xf999('0x0'));var util=require('util');var logger=require(_0xf999('0x1'))(_0xf999('0x2'));var moment=require(_0xf999('0x3'));var BPromise=require('bluebird');var rp=require(_0xf999('0x4'));var fs=require('fs');var path=require(_0xf999('0x5'));var rimraf=require('rimraf');var config=require(_0xf999('0x6'));var attributes=require('./network.attributes');module[_0xf999('0x7')]=function(_0x1fd9e0,_0x5d48fa){return _0x1fd9e0[_0xf999('0x8')]('Network',attributes,{'tableName':_0xf999('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d7f=['Network','network','lodash','util','api','request-promise','path','../../config/environment','./network.attributes','exports'];(function(_0x120da6,_0x15f450){var _0x3d6c07=function(_0x5acddd){while(--_0x5acddd){_0x120da6['push'](_0x120da6['shift']());}};_0x3d6c07(++_0x15f450);}(_0x6d7f,0xd4));var _0xf6d7=function(_0xa0dbc5,_0x3816c6){_0xa0dbc5=_0xa0dbc5-0x0;var _0x5f1a78=_0x6d7f[_0xa0dbc5];return _0x5f1a78;};'use strict';var _=require(_0xf6d7('0x0'));var util=require(_0xf6d7('0x1'));var logger=require('../../config/logger')(_0xf6d7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6d7('0x3'));var fs=require('fs');var path=require(_0xf6d7('0x4'));var rimraf=require('rimraf');var config=require(_0xf6d7('0x5'));var attributes=require(_0xf6d7('0x6'));module[_0xf6d7('0x7')]=function(_0x3ec586,_0x1763d8){return _0x3ec586['define'](_0xf6d7('0x8'),attributes,{'tableName':_0xf6d7('0x9'),'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 cad1f44..561b0d0 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 _0xe4d6=['request','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x4b3b92,_0x576dff){var _0x93f30a=function(_0x4c85c2){while(--_0x4c85c2){_0x4b3b92['push'](_0x4b3b92['shift']());}};_0x93f30a(++_0x576dff);}(_0xe4d6,0x81));var _0x6e4d=function(_0x58b826,_0xb52d5e){_0x58b826=_0x58b826-0x0;var _0x575b01=_0xe4d6[_0x58b826];return _0x575b01;};'use strict';var _=require(_0x6e4d('0x0'));var util=require(_0x6e4d('0x1'));var moment=require('moment');var BPromise=require(_0x6e4d('0x2'));var rs=require(_0x6e4d('0x3'));var fs=require('fs');var Redis=require(_0x6e4d('0x4'));var db=require(_0x6e4d('0x5'))['db'];var utils=require(_0x6e4d('0x6'));var logger=require(_0x6e4d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6e4d('0x8'));var client=jayson[_0x6e4d('0x9')][_0x6e4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e9786,_0x2a9976,_0x1507d4){return new BPromise(function(_0x4fb17f,_0xb532d7){return client[_0x6e4d('0xb')](_0x1e9786,_0x1507d4)['then'](function(_0x24dea3){logger['info'](_0x6e4d('0xc'),_0x2a9976,_0x6e4d('0xd'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x2a9976,_0x6e4d('0xd'),JSON[_0x6e4d('0xe')](_0x24dea3));if(_0x24dea3[_0x6e4d('0xf')]){if(_0x24dea3['error'][_0x6e4d('0x10')]===0x1f4){logger['error'](_0x6e4d('0xc'),_0x2a9976,_0x24dea3[_0x6e4d('0xf')]['message']);return _0xb532d7(_0x24dea3[_0x6e4d('0xf')][_0x6e4d('0x11')]);}logger[_0x6e4d('0xf')]('Network,\x20%s,\x20%s',_0x2a9976,_0x24dea3[_0x6e4d('0xf')][_0x6e4d('0x11')]);return _0x4fb17f(_0x24dea3['error'][_0x6e4d('0x11')]);}else{logger[_0x6e4d('0x12')](_0x6e4d('0xc'),_0x2a9976,_0x6e4d('0xd'));_0x4fb17f(_0x24dea3[_0x6e4d('0x13')][_0x6e4d('0x11')]);}})['catch'](function(_0x434028){logger[_0x6e4d('0xf')](_0x6e4d('0xc'),_0x2a9976,_0x434028);_0xb532d7(_0x434028);});});} \ No newline at end of file +var _0xd746=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0xd746,0x14f));var _0x6d74=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd746[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x6d74('0x0'));var util=require(_0x6d74('0x1'));var moment=require(_0x6d74('0x2'));var BPromise=require(_0x6d74('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d74('0x4'));var db=require(_0x6d74('0x5'))['db'];var utils=require(_0x6d74('0x6'));var logger=require(_0x6d74('0x7'))(_0x6d74('0x8'));var config=require(_0x6d74('0x9'));var jayson=require(_0x6d74('0xa'));var client=jayson[_0x6d74('0xb')][_0x6d74('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c8fe3,_0xf465a,_0x489e44){return new BPromise(function(_0x27ab4c,_0x1a1cf1){return client['request'](_0x4c8fe3,_0x489e44)[_0x6d74('0xd')](function(_0x548a7e){logger[_0x6d74('0xe')](_0x6d74('0xf'),_0xf465a,'request\x20sent');logger[_0x6d74('0x10')](_0x6d74('0x11'),_0xf465a,_0x6d74('0x12'),JSON[_0x6d74('0x13')](_0x548a7e));if(_0x548a7e[_0x6d74('0x14')]){if(_0x548a7e[_0x6d74('0x14')]['code']===0x1f4){logger[_0x6d74('0x14')](_0x6d74('0xf'),_0xf465a,_0x548a7e[_0x6d74('0x14')][_0x6d74('0x15')]);return _0x1a1cf1(_0x548a7e[_0x6d74('0x14')][_0x6d74('0x15')]);}logger[_0x6d74('0x14')](_0x6d74('0xf'),_0xf465a,_0x548a7e[_0x6d74('0x14')][_0x6d74('0x15')]);return _0x27ab4c(_0x548a7e['error'][_0x6d74('0x15')]);}else{logger[_0x6d74('0xe')](_0x6d74('0xf'),_0xf465a,_0x6d74('0x12'));_0x27ab4c(_0x548a7e[_0x6d74('0x16')][_0x6d74('0x15')]);}})[_0x6d74('0x17')](function(_0x47e85a){logger[_0x6d74('0x14')](_0x6d74('0xf'),_0xf465a,_0x47e85a);_0x1a1cf1(_0x47e85a);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 50f8838..79b66ad 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 _0xd800=['removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','getApplications','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/notify','notify','/:id/applications','addAgents','/:id/send','update','delete','destroy'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0xd800,0x1ed));var _0x0d80=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xd800[_0x134c2e];return _0x2825db;};'use strict';var multer=require('multer');var util=require(_0x0d80('0x0'));var path=require(_0x0d80('0x1'));var timeout=require(_0x0d80('0x2'));var express=require(_0x0d80('0x3'));var router=express['Router']();var auth=require(_0x0d80('0x4'));var interaction=require(_0x0d80('0x5'));var config=require(_0x0d80('0x6'));var controller=require(_0x0d80('0x7'));router[_0x0d80('0x8')]('/',auth[_0x0d80('0x9')](),controller[_0x0d80('0xa')]);router[_0x0d80('0x8')](_0x0d80('0xb'),auth[_0x0d80('0x9')](),controller[_0x0d80('0xc')]);router[_0x0d80('0x8')](_0x0d80('0xd'),auth['isAuthenticated'](),controller[_0x0d80('0xe')]);router['get']('/:id/dispositions',auth[_0x0d80('0x9')](),controller['getDispositions']);router['get'](_0x0d80('0xf'),auth[_0x0d80('0x9')](),controller[_0x0d80('0x10')]);router[_0x0d80('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x0d80('0x11')]);router[_0x0d80('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x0d80('0x8')](_0x0d80('0x12'),auth['isAuthenticated'](),controller[_0x0d80('0x13')]);router[_0x0d80('0x14')]('/',auth['isAuthenticated'](),controller[_0x0d80('0x15')]);router[_0x0d80('0x14')](_0x0d80('0x16'),auth[_0x0d80('0x9')](),controller[_0x0d80('0x17')]);router[_0x0d80('0x14')](_0x0d80('0xf'),auth[_0x0d80('0x9')](),controller['addAnswer']);router['post'](_0x0d80('0x18'),controller[_0x0d80('0x19')]);router[_0x0d80('0x14')](_0x0d80('0x1a'),auth[_0x0d80('0x9')](),controller['addApplications']);router[_0x0d80('0x14')]('/:id/users',auth[_0x0d80('0x9')](),controller[_0x0d80('0x1b')]);router['post'](_0x0d80('0x1c'),auth[_0x0d80('0x9')](),controller['send']);router['put'](_0x0d80('0xd'),auth[_0x0d80('0x9')](),controller[_0x0d80('0x1d')]);router[_0x0d80('0x1e')](_0x0d80('0xd'),auth[_0x0d80('0x9')](),controller[_0x0d80('0x1f')]);router[_0x0d80('0x1e')]('/:id/dispositions',auth[_0x0d80('0x9')](),controller[_0x0d80('0x20')]);router[_0x0d80('0x1e')](_0x0d80('0xf'),auth[_0x0d80('0x9')](),controller[_0x0d80('0x21')]);router[_0x0d80('0x1e')](_0x0d80('0x12'),auth[_0x0d80('0x9')](),controller['removeAgents']);module[_0x0d80('0x22')]=router; \ No newline at end of file +var _0xfcd7=['addDisposition','/:id/notify','notify','addApplications','addAgents','/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions'];(function(_0x1cf57c,_0x1bf6fe){var _0x4f6ad9=function(_0x12e8a3){while(--_0x12e8a3){_0x1cf57c['push'](_0x1cf57c['shift']());}};_0x4f6ad9(++_0x1bf6fe);}(_0xfcd7,0xa2));var _0x7fcd=function(_0x55856f,_0x35f6c2){_0x55856f=_0x55856f-0x0;var _0x3bef91=_0xfcd7[_0x55856f];return _0x3bef91;};'use strict';var multer=require(_0x7fcd('0x0'));var util=require(_0x7fcd('0x1'));var path=require('path');var timeout=require(_0x7fcd('0x2'));var express=require('express');var router=express[_0x7fcd('0x3')]();var auth=require(_0x7fcd('0x4'));var interaction=require(_0x7fcd('0x5'));var config=require(_0x7fcd('0x6'));var controller=require('./openchannelAccount.controller');router[_0x7fcd('0x7')]('/',auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x9')]);router[_0x7fcd('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x7fcd('0xa')]);router['get'](_0x7fcd('0xb'),auth['isAuthenticated'](),controller[_0x7fcd('0xc')]);router[_0x7fcd('0x7')]('/:id/dispositions',auth[_0x7fcd('0x8')](),controller['getDispositions']);router[_0x7fcd('0x7')](_0x7fcd('0xd'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0xe')]);router['get'](_0x7fcd('0xf'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x10')]);router[_0x7fcd('0x7')]('/:id/interactions',auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x11')]);router[_0x7fcd('0x7')](_0x7fcd('0x12'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x13')]);router[_0x7fcd('0x14')]('/',auth['isAuthenticated'](),controller[_0x7fcd('0x15')]);router[_0x7fcd('0x14')](_0x7fcd('0x16'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x17')]);router[_0x7fcd('0x14')](_0x7fcd('0xd'),auth[_0x7fcd('0x8')](),controller['addAnswer']);router[_0x7fcd('0x14')](_0x7fcd('0x18'),controller[_0x7fcd('0x19')]);router[_0x7fcd('0x14')](_0x7fcd('0xf'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x1a')]);router[_0x7fcd('0x14')]('/:id/users',auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x1b')]);router['post'](_0x7fcd('0x1c'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x1d')]);router['put']('/:id',auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x1e')]);router[_0x7fcd('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x7fcd('0x20')]);router[_0x7fcd('0x1f')]('/:id/dispositions',auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x21')]);router[_0x7fcd('0x1f')](_0x7fcd('0xd'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x22')]);router['delete'](_0x7fcd('0x12'),auth['isAuthenticated'](),controller[_0x7fcd('0x23')]);module[_0x7fcd('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 524a851..ad712cf 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 _0x8e2b=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','STRING','name','generate','TEXT'];(function(_0x3cdbce,_0x53b525){var _0x4e2401=function(_0x57cbd3){while(--_0x57cbd3){_0x3cdbce['push'](_0x3cdbce['shift']());}};_0x4e2401(++_0x53b525);}(_0x8e2b,0x1c2));var _0xb8e2=function(_0x2c0275,_0x7a6b6d){_0x2c0275=_0x2c0275-0x0;var _0x352cc9=_0x8e2b[_0x2c0275];return _0x352cc9;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb8e2('0x0'));module['exports']={'name':{'type':Sequelize[_0xb8e2('0x1')],'unique':_0xb8e2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb8e2('0x1')]},'token':{'type':Sequelize[_0xb8e2('0x1')],'defaultValue':function(){return rs[_0xb8e2('0x3')]();}},'replyUri':{'type':Sequelize[_0xb8e2('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb8e2('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb8e2('0x4')],'defaultValue':function(){return _0xb8e2('0x5');}},'notificationSound':{'type':Sequelize[_0xb8e2('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb8e2('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb8e2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb8e2('0x1')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb8e2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb8e2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb8e2('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xb8e2('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb8e2('0x9'),'set':function(_0x37c300){if(!_0x37c300)this['setDataValue'](_0xb8e2('0xa'),null);this[_0xb8e2('0xb')](_0xb8e2('0xc'),_0x37c300);}}}; \ No newline at end of file +var _0xca1c=['STRING','name','TEXT','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','randomstring'];(function(_0x3df00d,_0xe9a05){var _0x3d1400=function(_0x2a2139){while(--_0x2a2139){_0x3df00d['push'](_0x3df00d['shift']());}};_0x3d1400(++_0xe9a05);}(_0xca1c,0x13a));var _0xcca1=function(_0x4640b0,_0x13cb46){_0x4640b0=_0x4640b0-0x0;var _0x22665f=_0xca1c[_0x4640b0];return _0x22665f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcca1('0x0'));module['exports']={'name':{'type':Sequelize[_0xcca1('0x1')],'unique':_0xcca1('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xcca1('0x1')]},'token':{'type':Sequelize[_0xcca1('0x1')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xcca1('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xcca1('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcca1('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcca1('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xcca1('0x1')]},'queueTransfer':{'type':Sequelize[_0xcca1('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcca1('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcca1('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcca1('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xcca1('0x6')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x52a028){if(!_0x52a028)this['setDataValue'](_0xcca1('0x7'),null);this[_0xcca1('0x8')]('mandatoryDisposition',_0x52a028);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 84e500f..d24e981 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 _0xd1f9=['UserProfileResource','stack','name','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','find','userProfileId','autoAssociation','update','describe','addDisposition','OpenchannelAccountId','getDispositions','Disposition','removeDispositions','ids','getAnswers','findOne','CannedAnswer','removeAnswers','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','account','applications','list','orderBy','priority','asc','CmContact','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','autoclose','push','close','unmanaged','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','sequelize','transaction','OpenchannelApplication','findAndCountAll','getApplications','getInteractions','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','ListId','out','OpenchannelMessage','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd1f9,0x88));var _0x9d1f=function(_0x56c70f,_0x4e4493){_0x56c70f=_0x56c70f-0x0;var _0x3812ed=_0xd1f9[_0x56c70f];return _0x3812ed;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9d1f('0x0'));var zipdir=require(_0x9d1f('0x1'));var jsonpatch=require(_0x9d1f('0x2'));var rp=require(_0x9d1f('0x3'));var moment=require(_0x9d1f('0x4'));var BPromise=require(_0x9d1f('0x5'));var Mustache=require(_0x9d1f('0x6'));var util=require(_0x9d1f('0x7'));var path=require(_0x9d1f('0x8'));var sox=require('sox');var csv=require(_0x9d1f('0x9'));var ejs=require(_0x9d1f('0xa'));var fs=require('fs');var _=require(_0x9d1f('0xb'));var squel=require(_0x9d1f('0xc'));var crypto=require(_0x9d1f('0xd'));var jsforce=require(_0x9d1f('0xe'));var deskjs=require(_0x9d1f('0xf'));var toCsv=require(_0x9d1f('0x9'));var querystring=require(_0x9d1f('0x10'));var Papa=require(_0x9d1f('0x11'));var Redis=require(_0x9d1f('0x12'));var authService=require(_0x9d1f('0x13'));var qs=require(_0x9d1f('0x14'));var as=require(_0x9d1f('0x15'));var hardwareService=require(_0x9d1f('0x16'));var logger=require(_0x9d1f('0x17'))(_0x9d1f('0x18'));var utils=require(_0x9d1f('0x19'));var config=require(_0x9d1f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d1f('0x1b'))['db'];config[_0x9d1f('0x1c')]=_[_0x9d1f('0x1d')](config['redis'],{'host':_0x9d1f('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9d1f('0x1f'))[_0x9d1f('0x20')](socket);var jayson=require(_0x9d1f('0x21'));var client=jayson[_0x9d1f('0x22')][_0x9d1f('0x23')]({'port':0x232c});var client9002=jayson[_0x9d1f('0x22')][_0x9d1f('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2488a3,_0x24cd8a,_0x45a870,_0x1f9338){return new BPromise(function(_0x1dd0bd,_0x1fa256){var _0x57ba11=_0x1f9338||client;return _0x57ba11[_0x9d1f('0x24')](_0x2488a3,_0x45a870)[_0x9d1f('0x25')](function(_0x4e5328){logger[_0x9d1f('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x24cd8a,'request\x20sent');logger['debug'](_0x9d1f('0x27'),_0x24cd8a,_0x9d1f('0x28'),JSON[_0x9d1f('0x29')](_0x4e5328));if(_0x4e5328['error']){if(_0x4e5328[_0x9d1f('0x2a')]['code']===0x1f4){logger[_0x9d1f('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x24cd8a,_0x4e5328['error'][_0x9d1f('0x2b')]);return _0x1fa256(_0x4e5328[_0x9d1f('0x2a')][_0x9d1f('0x2b')]);}logger[_0x9d1f('0x2a')](_0x9d1f('0x2c'),_0x24cd8a,_0x4e5328[_0x9d1f('0x2a')][_0x9d1f('0x2b')]);return _0x1dd0bd(_0x4e5328[_0x9d1f('0x2a')][_0x9d1f('0x2b')]);}else{logger[_0x9d1f('0x26')](_0x9d1f('0x2c'),_0x24cd8a,_0x9d1f('0x28'));_0x1dd0bd(_0x4e5328[_0x9d1f('0x2d')][_0x9d1f('0x2b')]);}})['catch'](function(_0x2b234d){logger[_0x9d1f('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x24cd8a,_0x2b234d);_0x1fa256(_0x2b234d);});});}function respondWithStatusCode(_0x5c9fe7,_0x1f2b0e){_0x1f2b0e=_0x1f2b0e||0xcc;return function(_0xfdd4ae){if(_0xfdd4ae){return _0x5c9fe7[_0x9d1f('0x2e')](_0x1f2b0e);}return _0x5c9fe7[_0x9d1f('0x2f')](_0x1f2b0e)[_0x9d1f('0x30')]();};}function respondWithResult(_0x55f7de,_0x47fc5e){_0x47fc5e=_0x47fc5e||0xc8;return function(_0x1724a6){if(_0x1724a6){return _0x55f7de[_0x9d1f('0x2f')](_0x47fc5e)[_0x9d1f('0x31')](_0x1724a6);}};}function respondWithFilteredResult(_0x44515d,_0x1df1b8){return function(_0x1d8ffe){if(_0x1d8ffe){var _0x48fbf5=_0x1d8ffe[_0x9d1f('0x32')],_0x2b11db=_0x1df1b8[_0x9d1f('0x33')],_0x4daec3=_0x1df1b8[_0x9d1f('0x33')]+_0x1df1b8[_0x9d1f('0x34')],_0x129b70;if(_0x4daec3>=_0x48fbf5){_0x4daec3=_0x48fbf5;_0x129b70=0xc8;}else{_0x129b70=0xce;}_0x44515d['status'](_0x129b70);return _0x44515d[_0x9d1f('0x35')](_0x9d1f('0x36'),_0x2b11db+'-'+_0x4daec3+'/'+_0x48fbf5)[_0x9d1f('0x31')](_0x1d8ffe);}return null;};}function patchUpdates(_0x5df800){return function(_0x5a4da8){try{jsonpatch[_0x9d1f('0x37')](_0x5a4da8,_0x5df800,!![]);}catch(_0xd0ebe7){return BPromise['reject'](_0xd0ebe7);}return _0x5a4da8[_0x9d1f('0x38')]();};}function saveUpdates(_0x3de2d1,_0x25885e){return function(_0x3b9d25){if(_0x3b9d25){return _0x3b9d25['update'](_0x3de2d1)[_0x9d1f('0x25')](function(_0x272c81){return _0x272c81;});}return null;};}function removeEntity(_0x30a248,_0x24c6ef){return function(_0x4c0cac){if(_0x4c0cac){return _0x4c0cac[_0x9d1f('0x39')]()['then'](function(){var _0x378f93=_0x4c0cac[_0x9d1f('0x3a')]({'plain':!![]});var _0x425568='OpenchannelAccounts';return db[_0x9d1f('0x3b')][_0x9d1f('0x39')]({'where':{'type':_0x425568,'resourceId':_0x378f93['id']}})[_0x9d1f('0x25')](function(){return _0x4c0cac;});})[_0x9d1f('0x25')](function(){_0x30a248[_0x9d1f('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x328c62,_0x5ffb7){return function(_0x440def){if(!_0x440def){_0x328c62[_0x9d1f('0x2e')](0x194);}return _0x440def;};}function handleError(_0x245675,_0x381654){_0x381654=_0x381654||0x1f4;return function(_0x1674c5){logger['error'](_0x1674c5[_0x9d1f('0x3c')]);if(_0x1674c5[_0x9d1f('0x3d')]){delete _0x1674c5[_0x9d1f('0x3d')];}_0x245675[_0x9d1f('0x2f')](_0x381654)['send'](_0x1674c5);};}exports[_0x9d1f('0x3e')]=function(_0x557490,_0x518c9e){var _0x57c0a4={'include':[{'model':db['Pause'],'as':_0x9d1f('0x3f')}]},_0x3c9a17={},_0x1253e2={'count':0x0,'rows':[]};var _0x28fde6=_[_0x9d1f('0x40')](db[_0x9d1f('0x41')][_0x9d1f('0x42')],function(_0x3af218){return{'name':_0x3af218[_0x9d1f('0x43')],'type':_0x3af218['type'][_0x9d1f('0x44')]};});_0x3c9a17['model']=_[_0x9d1f('0x40')](_0x28fde6,_0x9d1f('0x3d'));_0x3c9a17['query']=_[_0x9d1f('0x45')](_0x557490[_0x9d1f('0x46')]);_0x3c9a17[_0x9d1f('0x47')]=_[_0x9d1f('0x48')](_0x3c9a17[_0x9d1f('0x49')],_0x3c9a17[_0x9d1f('0x46')]);_0x57c0a4[_0x9d1f('0x4a')]=_['intersection'](_0x3c9a17[_0x9d1f('0x49')],qs[_0x9d1f('0x4b')](_0x557490['query'][_0x9d1f('0x4b')]));_0x57c0a4['attributes']=_0x57c0a4[_0x9d1f('0x4a')][_0x9d1f('0x4c')]?_0x57c0a4['attributes']:_0x3c9a17[_0x9d1f('0x49')];if(!_0x557490[_0x9d1f('0x46')][_0x9d1f('0x4d')](_0x9d1f('0x4e'))){_0x57c0a4[_0x9d1f('0x34')]=qs['limit'](_0x557490[_0x9d1f('0x46')][_0x9d1f('0x34')]);_0x57c0a4['offset']=qs[_0x9d1f('0x33')](_0x557490[_0x9d1f('0x46')][_0x9d1f('0x33')]);}_0x57c0a4[_0x9d1f('0x4f')]=qs[_0x9d1f('0x50')](_0x557490[_0x9d1f('0x46')][_0x9d1f('0x50')]);_0x57c0a4[_0x9d1f('0x51')]=qs[_0x9d1f('0x47')](_[_0x9d1f('0x52')](_0x557490[_0x9d1f('0x46')],_0x3c9a17[_0x9d1f('0x47')]),_0x28fde6);if(_0x557490[_0x9d1f('0x46')][_0x9d1f('0x53')]){_0x57c0a4['where']=_[_0x9d1f('0x54')](_0x57c0a4[_0x9d1f('0x51')],{'$or':_[_0x9d1f('0x40')](_0x28fde6,function(_0x133075){if(_0x133075[_0x9d1f('0x55')]!==_0x9d1f('0x56')){var _0x1f15c9={};_0x1f15c9[_0x133075[_0x9d1f('0x3d')]]={'$like':'%'+_0x557490['query'][_0x9d1f('0x53')]+'%'};return _0x1f15c9;}})});}_0x57c0a4=_[_0x9d1f('0x54')]({},_0x57c0a4,_0x557490[_0x9d1f('0x57')]);var _0x20d616={'where':_0x57c0a4['where']};return db[_0x9d1f('0x41')]['count'](_0x20d616)['then'](function(_0x361381){_0x1253e2[_0x9d1f('0x32')]=_0x361381;if(_0x557490[_0x9d1f('0x46')][_0x9d1f('0x58')]){_0x57c0a4[_0x9d1f('0x59')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x9d1f('0x5a')](_0x57c0a4);})[_0x9d1f('0x25')](function(_0x4643dc){_0x1253e2[_0x9d1f('0x5b')]=_0x4643dc;return _0x1253e2;})[_0x9d1f('0x25')](respondWithFilteredResult(_0x518c9e,_0x57c0a4))['catch'](handleError(_0x518c9e,null));};exports[_0x9d1f('0x5c')]=function(_0x19dd60,_0x4c0f05){var _0x5a9b0d={'raw':![],'where':{'id':_0x19dd60[_0x9d1f('0x5d')]['id']},'include':[{'model':db[_0x9d1f('0x5e')],'as':_0x9d1f('0x3f')}]},_0x16a10f={};_0x16a10f[_0x9d1f('0x49')]=_['keys'](db['OpenchannelAccount'][_0x9d1f('0x42')]);_0x16a10f[_0x9d1f('0x46')]=_[_0x9d1f('0x45')](_0x19dd60[_0x9d1f('0x46')]);_0x16a10f['filters']=_[_0x9d1f('0x48')](_0x16a10f['model'],_0x16a10f[_0x9d1f('0x46')]);_0x5a9b0d[_0x9d1f('0x4a')]=_[_0x9d1f('0x48')](_0x16a10f['model'],qs[_0x9d1f('0x4b')](_0x19dd60[_0x9d1f('0x46')][_0x9d1f('0x4b')]));_0x5a9b0d[_0x9d1f('0x4a')]=_0x5a9b0d[_0x9d1f('0x4a')][_0x9d1f('0x4c')]?_0x5a9b0d[_0x9d1f('0x4a')]:_0x16a10f[_0x9d1f('0x49')];if(_0x19dd60['query'][_0x9d1f('0x58')]){_0x5a9b0d[_0x9d1f('0x59')]=[{'all':!![]}];}_0x5a9b0d=_[_0x9d1f('0x54')]({},_0x5a9b0d,_0x19dd60['options']);return db[_0x9d1f('0x41')]['find'](_0x5a9b0d)[_0x9d1f('0x25')](handleEntityNotFound(_0x4c0f05,null))['then'](respondWithResult(_0x4c0f05,null))[_0x9d1f('0x5f')](handleError(_0x4c0f05,null));};exports['create']=function(_0x2d2da1,_0xd00eeb){return db[_0x9d1f('0x41')][_0x9d1f('0x60')](_0x2d2da1[_0x9d1f('0x61')],{})[_0x9d1f('0x25')](function(_0x5b268a){var _0x48447b=_0x2d2da1[_0x9d1f('0x62')]['get']({'plain':!![]});if(!_0x48447b)throw new Error(_0x9d1f('0x63'));if(_0x48447b[_0x9d1f('0x64')]===_0x9d1f('0x62')){var _0x3c2f70=_0x5b268a['get']({'plain':!![]});var _0x43a076=_0x9d1f('0x65');return db[_0x9d1f('0x66')][_0x9d1f('0x67')]({'where':{'name':_0x43a076,'userProfileId':_0x48447b[_0x9d1f('0x68')]},'raw':!![]})['then'](function(_0x1676ab){if(_0x1676ab&&_0x1676ab[_0x9d1f('0x69')]===0x0){return db[_0x9d1f('0x3b')]['create']({'name':_0x3c2f70[_0x9d1f('0x3d')],'resourceId':_0x3c2f70['id'],'type':_0x1676ab[_0x9d1f('0x3d')],'sectionId':_0x1676ab['id']},{})[_0x9d1f('0x25')](function(){return _0x5b268a;});}else{return _0x5b268a;}})['catch'](function(_0x2e2eea){logger[_0x9d1f('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e2eea);throw _0x2e2eea;});}return _0x5b268a;})['then'](respondWithResult(_0xd00eeb,0xc9))[_0x9d1f('0x5f')](handleError(_0xd00eeb,null));};exports[_0x9d1f('0x6a')]=function(_0x1a2232,_0xfbbbb2){if(_0x1a2232[_0x9d1f('0x61')]['id']){delete _0x1a2232['body']['id'];}return db[_0x9d1f('0x41')]['find']({'where':{'id':_0x1a2232[_0x9d1f('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x9d1f('0x3f')}]})['then'](handleEntityNotFound(_0xfbbbb2,null))[_0x9d1f('0x25')](saveUpdates(_0x1a2232[_0x9d1f('0x61')],null))[_0x9d1f('0x25')](respondWithResult(_0xfbbbb2,null))[_0x9d1f('0x5f')](handleError(_0xfbbbb2,null));};exports[_0x9d1f('0x39')]=function(_0x4a3bd2,_0x55eaea){return db[_0x9d1f('0x41')][_0x9d1f('0x67')]({'where':{'id':_0x4a3bd2[_0x9d1f('0x5d')]['id']}})[_0x9d1f('0x25')](handleEntityNotFound(_0x55eaea,null))[_0x9d1f('0x25')](removeEntity(_0x55eaea,null))[_0x9d1f('0x5f')](handleError(_0x55eaea,null));};exports[_0x9d1f('0x6b')]=function(_0xb881b9,_0x4ce90e){return db[_0x9d1f('0x41')][_0x9d1f('0x6b')]()[_0x9d1f('0x25')](respondWithResult(_0x4ce90e,null))[_0x9d1f('0x5f')](handleError(_0x4ce90e,null));};exports[_0x9d1f('0x6c')]=function(_0x1836f3,_0x34edfe,_0x25955e){if(_0x1836f3[_0x9d1f('0x61')]['id']){delete _0x1836f3[_0x9d1f('0x61')]['id'];}return db[_0x9d1f('0x41')][_0x9d1f('0x67')]({'where':{'id':_0x1836f3[_0x9d1f('0x5d')]['id']}})[_0x9d1f('0x25')](handleEntityNotFound(_0x34edfe,null))[_0x9d1f('0x25')](function(_0x4e4741){if(_0x4e4741){_0x1836f3[_0x9d1f('0x61')][_0x9d1f('0x6d')]=_0x4e4741['id'];return db['Disposition'][_0x9d1f('0x60')](_0x1836f3[_0x9d1f('0x61')]);}})[_0x9d1f('0x25')](respondWithResult(_0x34edfe,null))[_0x9d1f('0x5f')](handleError(_0x34edfe,null));};exports[_0x9d1f('0x6e')]=function(_0x455fe0,_0x14ed7f,_0x451c75){var _0x550571={'raw':![],'where':{}};var _0x5b284c={};var _0x1cb3f8={'count':0x0,'rows':[]};return db[_0x9d1f('0x41')]['findOne']({'where':{'id':_0x455fe0[_0x9d1f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x14ed7f,null))[_0x9d1f('0x25')](function(_0x3dd1e1){if(_0x3dd1e1){_0x5b284c[_0x9d1f('0x49')]=_['keys'](db[_0x9d1f('0x6f')]['rawAttributes']);_0x5b284c[_0x9d1f('0x46')]=_['keys'](_0x455fe0[_0x9d1f('0x46')]);_0x5b284c[_0x9d1f('0x47')]=_['intersection'](_0x5b284c[_0x9d1f('0x49')],_0x5b284c[_0x9d1f('0x46')]);_0x550571['attributes']=_[_0x9d1f('0x48')](_0x5b284c[_0x9d1f('0x49')],qs[_0x9d1f('0x4b')](_0x455fe0[_0x9d1f('0x46')][_0x9d1f('0x4b')]));_0x550571['attributes']=_0x550571['attributes'][_0x9d1f('0x4c')]?_0x550571[_0x9d1f('0x4a')]:_0x5b284c[_0x9d1f('0x49')];if(!_0x455fe0[_0x9d1f('0x46')][_0x9d1f('0x4d')](_0x9d1f('0x4e'))){_0x550571[_0x9d1f('0x34')]=qs[_0x9d1f('0x34')](_0x455fe0[_0x9d1f('0x46')][_0x9d1f('0x34')]);_0x550571[_0x9d1f('0x33')]=qs[_0x9d1f('0x33')](_0x455fe0[_0x9d1f('0x46')]['offset']);}_0x550571['order']=qs[_0x9d1f('0x50')](_0x455fe0[_0x9d1f('0x46')][_0x9d1f('0x50')]);_0x550571[_0x9d1f('0x51')]=qs[_0x9d1f('0x47')](_[_0x9d1f('0x52')](_0x455fe0['query'],_0x5b284c[_0x9d1f('0x47')]));_0x550571[_0x9d1f('0x51')][_0x9d1f('0x6d')]=_0x3dd1e1['id'];if(_0x455fe0[_0x9d1f('0x46')][_0x9d1f('0x53')]){_0x550571[_0x9d1f('0x51')]=_[_0x9d1f('0x54')](_0x550571[_0x9d1f('0x51')],{'$or':_[_0x9d1f('0x40')](_0x550571[_0x9d1f('0x4a')],function(_0x243c3a){var _0x5a48b7={};_0x5a48b7[_0x243c3a]={'$like':'%'+_0x455fe0[_0x9d1f('0x46')][_0x9d1f('0x53')]+'%'};return _0x5a48b7;})});}_0x550571=_[_0x9d1f('0x54')]({},_0x550571,_0x455fe0['options']);return db[_0x9d1f('0x6f')]['count']({'where':_0x550571[_0x9d1f('0x51')]})[_0x9d1f('0x25')](function(_0x4f1f7f){_0x1cb3f8[_0x9d1f('0x32')]=_0x4f1f7f;if(_0x455fe0['query'][_0x9d1f('0x58')]){_0x550571['include']=[{'all':!![]}];}return db[_0x9d1f('0x6f')][_0x9d1f('0x5a')](_0x550571);})[_0x9d1f('0x25')](function(_0x26dadf){_0x1cb3f8[_0x9d1f('0x5b')]=_0x26dadf;return _0x1cb3f8;});}})[_0x9d1f('0x25')](respondWithFilteredResult(_0x14ed7f,_0x550571))[_0x9d1f('0x5f')](handleError(_0x14ed7f,null));};exports[_0x9d1f('0x70')]=function(_0xeb8685,_0x20fb47,_0x4a6652){return db[_0x9d1f('0x41')][_0x9d1f('0x67')]({'where':{'id':_0xeb8685[_0x9d1f('0x5d')]['id']}})[_0x9d1f('0x25')](handleEntityNotFound(_0x20fb47,null))[_0x9d1f('0x25')](function(_0x5a4939){if(_0x5a4939){return _0x5a4939['removeDispositions'](_0xeb8685['query'][_0x9d1f('0x71')]);}})[_0x9d1f('0x25')](respondWithStatusCode(_0x20fb47,null))['catch'](handleError(_0x20fb47,null));};exports['addAnswer']=function(_0x2735c0,_0x495cb1,_0x450a75){if(_0x2735c0['body']['id']){delete _0x2735c0['body']['id'];}return db[_0x9d1f('0x41')][_0x9d1f('0x67')]({'where':{'id':_0x2735c0['params']['id']}})['then'](handleEntityNotFound(_0x495cb1,null))[_0x9d1f('0x25')](function(_0x419b5b){if(_0x419b5b){_0x2735c0[_0x9d1f('0x61')][_0x9d1f('0x6d')]=_0x419b5b['id'];return db['CannedAnswer'][_0x9d1f('0x60')](_0x2735c0[_0x9d1f('0x61')]);}})[_0x9d1f('0x25')](respondWithResult(_0x495cb1,null))[_0x9d1f('0x5f')](handleError(_0x495cb1,null));};exports[_0x9d1f('0x72')]=function(_0x37d8fe,_0x848720,_0x12a0bd){var _0x1e5bc8={'raw':![],'where':{}};var _0x182706={};var _0x3fece5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9d1f('0x73')]({'where':{'id':_0x37d8fe['params']['id']}})[_0x9d1f('0x25')](handleEntityNotFound(_0x848720,null))['then'](function(_0x10ff02){if(_0x10ff02){_0x182706[_0x9d1f('0x49')]=_[_0x9d1f('0x45')](db['CannedAnswer'][_0x9d1f('0x42')]);_0x182706[_0x9d1f('0x46')]=_['keys'](_0x37d8fe[_0x9d1f('0x46')]);_0x182706[_0x9d1f('0x47')]=_['intersection'](_0x182706[_0x9d1f('0x49')],_0x182706[_0x9d1f('0x46')]);_0x1e5bc8[_0x9d1f('0x4a')]=_[_0x9d1f('0x48')](_0x182706[_0x9d1f('0x49')],qs[_0x9d1f('0x4b')](_0x37d8fe['query'][_0x9d1f('0x4b')]));_0x1e5bc8[_0x9d1f('0x4a')]=_0x1e5bc8['attributes'][_0x9d1f('0x4c')]?_0x1e5bc8['attributes']:_0x182706[_0x9d1f('0x49')];if(!_0x37d8fe[_0x9d1f('0x46')]['hasOwnProperty']('nolimit')){_0x1e5bc8[_0x9d1f('0x34')]=qs[_0x9d1f('0x34')](_0x37d8fe[_0x9d1f('0x46')][_0x9d1f('0x34')]);_0x1e5bc8[_0x9d1f('0x33')]=qs[_0x9d1f('0x33')](_0x37d8fe['query'][_0x9d1f('0x33')]);}_0x1e5bc8[_0x9d1f('0x4f')]=qs['sort'](_0x37d8fe[_0x9d1f('0x46')]['sort']);_0x1e5bc8[_0x9d1f('0x51')]=qs[_0x9d1f('0x47')](_['pick'](_0x37d8fe[_0x9d1f('0x46')],_0x182706[_0x9d1f('0x47')]));_0x1e5bc8[_0x9d1f('0x51')][_0x9d1f('0x6d')]=_0x10ff02['id'];if(_0x37d8fe['query'][_0x9d1f('0x53')]){_0x1e5bc8[_0x9d1f('0x51')]=_['merge'](_0x1e5bc8['where'],{'$or':_[_0x9d1f('0x40')](_0x1e5bc8[_0x9d1f('0x4a')],function(_0x27801a){var _0x5f391b={};_0x5f391b[_0x27801a]={'$like':'%'+_0x37d8fe[_0x9d1f('0x46')][_0x9d1f('0x53')]+'%'};return _0x5f391b;})});}_0x1e5bc8=_['merge']({},_0x1e5bc8,_0x37d8fe[_0x9d1f('0x57')]);return db['CannedAnswer'][_0x9d1f('0x32')]({'where':_0x1e5bc8[_0x9d1f('0x51')]})['then'](function(_0x519bcb){_0x3fece5['count']=_0x519bcb;if(_0x37d8fe[_0x9d1f('0x46')][_0x9d1f('0x58')]){_0x1e5bc8[_0x9d1f('0x59')]=[{'all':!![]}];}return db[_0x9d1f('0x74')]['findAll'](_0x1e5bc8);})[_0x9d1f('0x25')](function(_0x512507){_0x3fece5[_0x9d1f('0x5b')]=_0x512507;return _0x3fece5;});}})[_0x9d1f('0x25')](respondWithFilteredResult(_0x848720,_0x1e5bc8))['catch'](handleError(_0x848720,null));};exports['removeAnswers']=function(_0x4f8cc7,_0x22c382,_0x40a62a){return db[_0x9d1f('0x41')][_0x9d1f('0x67')]({'where':{'id':_0x4f8cc7[_0x9d1f('0x5d')]['id']}})[_0x9d1f('0x25')](handleEntityNotFound(_0x22c382,null))[_0x9d1f('0x25')](function(_0x30ca8e){if(_0x30ca8e){return _0x30ca8e[_0x9d1f('0x75')](_0x4f8cc7[_0x9d1f('0x46')][_0x9d1f('0x71')]);}})[_0x9d1f('0x25')](respondWithStatusCode(_0x22c382,null))[_0x9d1f('0x5f')](handleError(_0x22c382,null));};exports['notify']=function(_0x41d310,_0x5b6dad,_0x386ce8){var _0x3f6270={'body':_0x41d310[_0x9d1f('0x61')],'channel':_0x9d1f('0x76')};var _0x2385a0=[];var _0xe4cfb1=[];var _0x108e8b={};var _0x489868=![];return db['CmContact'][_0x9d1f('0x6b')]()[_0x9d1f('0x25')](function(_0x4a3dbd){if(!_0x4a3dbd){throw new db[(_0x9d1f('0x77'))][(_0x9d1f('0x78'))](_0x9d1f('0x79'));}_0x2385a0=_[_0x9d1f('0x7a')](_[_0x9d1f('0x45')](_0x4a3dbd),[_0x9d1f('0x7b'),'updatedAt']);_0xe4cfb1=_[_0x9d1f('0x7a')](_[_0x9d1f('0x45')](_0x4a3dbd),[_0x9d1f('0x7b'),_0x9d1f('0x7c'),_0x9d1f('0x7d'),'ListId']);if(_0x41d310[_0x9d1f('0x61')]['id']){delete _0x41d310['body']['id'];}if(_[_0x9d1f('0x7e')](_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x7f')])){throw new db[(_0x9d1f('0x77'))][(_0x9d1f('0x78'))](_0x9d1f('0x80'));}if(_[_0x9d1f('0x7e')](_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x61')])||_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x61')]===''){throw new db[(_0x9d1f('0x77'))][(_0x9d1f('0x78'))](_0x9d1f('0x81'));}if(_[_0x9d1f('0x7e')](_0x41d310[_0x9d1f('0x61')]['mapKey'])){throw new db[(_0x9d1f('0x77'))]['ValidationError'](_0x9d1f('0x82')+_0xe4cfb1);}if(!_[_0x9d1f('0x83')](_0xe4cfb1,_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x84')])){throw new db['Sequelize'][(_0x9d1f('0x78'))](_0x9d1f('0x85')+_0xe4cfb1);}_0x108e8b[_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x84')]]=_0x41d310[_0x9d1f('0x61')]['from'];})[_0x9d1f('0x25')](function(){return db['OpenchannelAccount'][_0x9d1f('0x67')]({'where':{'id':_0x41d310[_0x9d1f('0x5d')]['id']},'include':[{'model':db[_0x9d1f('0x86')],'as':_0x9d1f('0x87'),'include':[{'model':db['CmContact'],'as':_0x9d1f('0x88'),'where':_0x108e8b,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x9d1f('0x89')}]});})[_0x9d1f('0x25')](handleEntityNotFound(_0x5b6dad,null))['then'](function(_0x3268f6){if(_0x3268f6&&_0x3268f6['List']){_0x3f6270[_0x9d1f('0x8a')]=_0x3268f6;_0x3f6270[_0x9d1f('0x8b')]=_0x3268f6[_0x9d1f('0x89')];_0x3f6270[_0x9d1f('0x8c')]=_0x3268f6[_0x9d1f('0x87')];_0x3f6270[_0x9d1f('0x8b')]=_[_0x9d1f('0x8d')](_0x3f6270[_0x9d1f('0x8b')],[_0x9d1f('0x8e')],[_0x9d1f('0x8f')]);if(_0x3f6270[_0x9d1f('0x8a')][_0x9d1f('0x89')]){delete _0x3f6270[_0x9d1f('0x8a')]['Applications'];}if(_0x3f6270['account'][_0x9d1f('0x87')]&&_0x3f6270['account'][_0x9d1f('0x87')][_0x9d1f('0x88')][_0x9d1f('0x4c')]){return _0x3f6270[_0x9d1f('0x8a')][_0x9d1f('0x87')][_0x9d1f('0x88')][0x0];}var _0x257f17=_[_0x9d1f('0x1d')](_0x41d310[_0x9d1f('0x61')],{'firstName':_0x41d310['body'][_0x9d1f('0x7f')],'ListId':_0x3268f6['ListId']});_0x257f17[_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x84')]]=_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x7f')];return db[_0x9d1f('0x90')]['create'](_0x257f17,{'fields':_0x2385a0,'raw':!![]});}})['then'](handleEntityNotFound(_0x5b6dad,null))[_0x9d1f('0x25')](function(_0x160bc0){_0x3f6270[_0x9d1f('0x91')]=_0x160bc0;if(_0x160bc0){var _0x2712bc={'ContactId':_0x160bc0['id'],'OpenchannelAccountId':_0x41d310[_0x9d1f('0x5d')]['id'],'from':(_0x160bc0[_0x9d1f('0x92')]||'')+'\x20'+(_0x160bc0['lastName']||'')};var _0x18befa={'OpenchannelAccountId':_0x41d310[_0x9d1f('0x5d')]['id'],'closed':![]};if(_0x41d310['body'][_0x9d1f('0x93')]){_0x18befa[_0x9d1f('0x93')]=_0x41d310['body']['threadId'];return db[_0x9d1f('0x94')][_0x9d1f('0x67')]({'where':_0x18befa})[_0x9d1f('0x25')](function(_0x8ab51e){if(_0x8ab51e){return[_0x8ab51e,![]];}_0x2712bc[_0x9d1f('0x93')]=_0x41d310['body'][_0x9d1f('0x93')];_0x2712bc[_0x9d1f('0x95')]=_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x95')];return db[_0x9d1f('0x94')][_0x9d1f('0x60')](_0x2712bc)['then'](function(_0x56d044){return[_0x56d044,!![]];});});}else{_0x18befa[_0x9d1f('0x93')]=null;}_0x18befa[_0x9d1f('0x96')]=_0x160bc0['id'];return db[_0x9d1f('0x94')][_0x9d1f('0x67')]({'where':_0x18befa})['then'](function(_0xaf805){if(_0xaf805){return[_0xaf805,![]];}return db[_0x9d1f('0x94')][_0x9d1f('0x60')](_0x2712bc)[_0x9d1f('0x25')](function(_0x36e650){return[_0x36e650,!![]];});});}})[_0x9d1f('0x97')](function(_0x4c59a0,_0x59895a){if(_0x4c59a0){_0x489868=_0x59895a;if(!_0x59895a){var _0x47a396={'from':(_0x3f6270[_0x9d1f('0x91')]['firstName']||'')+'\x20'+(_0x3f6270[_0x9d1f('0x91')][_0x9d1f('0x98')]||'')};if(_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x93')]&&_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x99')]&&_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x93')]!=_0x41d310['body']['messageId']){_0x47a396[_0x9d1f('0x93')]=_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x99')];}return _0x4c59a0[_0x9d1f('0x6a')](_0x47a396);}else{return _0x4c59a0;}}})[_0x9d1f('0x25')](function(_0x47e7e7){_0x3f6270[_0x9d1f('0x9a')]=_0x47e7e7[_0x9d1f('0x3a')]({'plain':!![]});_0x3f6270[_0x9d1f('0x9a')]['created']=_0x489868;if(_0x3f6270['interaction']['created']){if(_0x3f6270[_0x9d1f('0x8a')][_0x9d1f('0x9b')]){_0x3f6270['applications'][_0x9d1f('0x9c')]({'id':0x0,'priority':_0x3f6270['applications'][_0x9d1f('0x4c')]+0x1,'app':_0x9d1f('0x9d'),'appdata':_0x9d1f('0x9e'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x9d1f('0x60')]({'body':_0x41d310['body']['body'],'OpenchannelAccountId':_0x41d310[_0x9d1f('0x5d')]['id'],'OpenchannelInteractionId':_0x47e7e7['id'],'direction':'in','ContactId':_0x3f6270[_0x9d1f('0x91')]['id'],'AttachmentId':_0x41d310[_0x9d1f('0x61')][_0x9d1f('0x9f')]});})[_0x9d1f('0x25')](function(_0x57dfc3){_0x3f6270[_0x9d1f('0x2b')]=_0x57dfc3;if(_0x3f6270['interaction'][_0x9d1f('0xa0')]){return db[_0x9d1f('0xa1')][_0x9d1f('0x67')]({'attributes':['id','name'],'where':{'id':_0x3f6270['interaction'][_0x9d1f('0xa0')]}})[_0x9d1f('0x25')](function(_0x6981df){if(_0x6981df){_0x3f6270[_0x9d1f('0x8b')][_0x9d1f('0xa2')]({'id':0x0,'priority':0x0,'app':_0x9d1f('0xa3'),'appdata':_0x6981df[_0x9d1f('0x3d')]+','+(_0x3f6270[_0x9d1f('0x8a')][_0x9d1f('0xa4')]||0xa),'interval':_0x9d1f('0xa5')});_0x3f6270[_0x9d1f('0xa6')]=![];}return respondWithRpcPromise(_0x9d1f('0xa7'),_0x9d1f('0xa8'),_0x3f6270);});}return respondWithRpcPromise(_0x9d1f('0xa7'),'startRouting',_0x3f6270);})['then'](function(_0x44f417){respondWithRpcPromise('EventManager',_0x9d1f('0xa9'),{'event':_0x9d1f('0xaa'),'message':_0x44f417},client9002);return _0x44f417;})[_0x9d1f('0x25')](respondWithResult(_0x5b6dad,null))[_0x9d1f('0x5f')](handleError(_0x5b6dad,null));};exports['addApplications']=function(_0x39a3d5,_0xa82c46,_0x2edb95){return db[_0x9d1f('0x41')][_0x9d1f('0x73')]({'where':{'id':_0x39a3d5[_0x9d1f('0x5d')]['id']}})[_0x9d1f('0x25')](handleEntityNotFound(_0xa82c46,null))[_0x9d1f('0x25')](function(_0x2f0428){if(_0x2f0428){return db[_0x9d1f('0xab')][_0x9d1f('0xac')](function(_0x26004a){return db[_0x9d1f('0xad')][_0x9d1f('0x39')]({'where':{'OpenchannelAccountId':_0x39a3d5[_0x9d1f('0x5d')]['id']},'transaction':_0x26004a})['then'](function(_0x2b586b){var _0x2d4f21=_[_0x9d1f('0x40')](_0x39a3d5['body'],function(_0xb42813){_0xb42813['OpenchannelAccountId']=_0x39a3d5['params']['id'];return _0xb42813;});return db[_0x9d1f('0xad')]['bulkCreate'](_0x2d4f21,{'transaction':_0x26004a});});})[_0x9d1f('0x25')](function(){return db[_0x9d1f('0xad')][_0x9d1f('0xae')]({'where':{'OpenchannelAccountId':_0x39a3d5['params']['id']},'order':_0x9d1f('0x8e')});});}})['then'](respondWithResult(_0xa82c46,null))[_0x9d1f('0x5f')](handleError(_0xa82c46,null));};exports[_0x9d1f('0xaf')]=function(_0x4a9e8b,_0x1a0562,_0x2dfb8b){var _0x58206a={};var _0x4a2d00={};var _0x4d76f6;var _0x1ce51e;return db[_0x9d1f('0x41')][_0x9d1f('0x73')]({'where':{'id':_0x4a9e8b[_0x9d1f('0x5d')]['id']}})[_0x9d1f('0x25')](handleEntityNotFound(_0x1a0562,null))['then'](function(_0x41974e){if(_0x41974e){_0x4d76f6=_0x41974e;_0x4a2d00[_0x9d1f('0x49')]=_[_0x9d1f('0x45')](db[_0x9d1f('0xad')][_0x9d1f('0x42')]);_0x4a2d00[_0x9d1f('0x46')]=_[_0x9d1f('0x45')](_0x4a9e8b['query']);_0x4a2d00[_0x9d1f('0x47')]=_[_0x9d1f('0x48')](_0x4a2d00[_0x9d1f('0x49')],_0x4a2d00[_0x9d1f('0x46')]);_0x58206a[_0x9d1f('0x4a')]=_['intersection'](_0x4a2d00[_0x9d1f('0x49')],qs[_0x9d1f('0x4b')](_0x4a9e8b[_0x9d1f('0x46')][_0x9d1f('0x4b')]));_0x58206a[_0x9d1f('0x4a')]=_0x58206a[_0x9d1f('0x4a')][_0x9d1f('0x4c')]?_0x58206a[_0x9d1f('0x4a')]:_0x4a2d00[_0x9d1f('0x49')];_0x58206a[_0x9d1f('0x4f')]=qs[_0x9d1f('0x50')](_0x4a9e8b['query'][_0x9d1f('0x50')]);_0x58206a[_0x9d1f('0x51')]=qs[_0x9d1f('0x47')](_[_0x9d1f('0x52')](_0x4a9e8b[_0x9d1f('0x46')],_0x4a2d00[_0x9d1f('0x47')]));if(_0x4a9e8b['query'][_0x9d1f('0x53')]){_0x58206a[_0x9d1f('0x51')]=_['merge'](_0x58206a[_0x9d1f('0x51')],{'$or':_[_0x9d1f('0x40')](_0x58206a[_0x9d1f('0x4a')],function(_0x24db9a){var _0x427dd5={};_0x427dd5[_0x24db9a]={'$like':'%'+_0x4a9e8b['query'][_0x9d1f('0x53')]+'%'};return _0x427dd5;})});}_0x58206a=_[_0x9d1f('0x54')]({},_0x58206a,_0x4a9e8b[_0x9d1f('0x57')]);return _0x4d76f6[_0x9d1f('0xaf')](_0x58206a);}})[_0x9d1f('0x25')](function(_0x10bf22){if(_0x10bf22){_0x1ce51e=_0x10bf22['length'];if(!_0x4a9e8b[_0x9d1f('0x46')][_0x9d1f('0x4d')](_0x9d1f('0x4e'))){_0x58206a[_0x9d1f('0x34')]=qs['limit'](_0x4a9e8b[_0x9d1f('0x46')]['limit']);_0x58206a[_0x9d1f('0x33')]=qs[_0x9d1f('0x33')](_0x4a9e8b[_0x9d1f('0x46')][_0x9d1f('0x33')]);}return _0x4d76f6[_0x9d1f('0xaf')](_0x58206a);}})[_0x9d1f('0x25')](function(_0x4b7117){if(_0x4b7117){return _0x4b7117?{'count':_0x1ce51e,'rows':_0x4b7117}:null;}})[_0x9d1f('0x25')](respondWithResult(_0x1a0562,null))[_0x9d1f('0x5f')](handleError(_0x1a0562,null));};exports[_0x9d1f('0xb0')]=function(_0x2eb9b7,_0x41a1b9,_0x535c7f){var _0x19f7a6={'raw':![],'where':{}};var _0x4d5018={};var _0x4f81f9={'count':0x0,'rows':[]};return db[_0x9d1f('0x41')][_0x9d1f('0x73')]({'where':{'id':_0x2eb9b7[_0x9d1f('0x5d')]['id']}})[_0x9d1f('0x25')](handleEntityNotFound(_0x41a1b9,null))[_0x9d1f('0x25')](function(_0x407a5b){if(_0x407a5b){_0x4d5018['model']=_[_0x9d1f('0x45')](db[_0x9d1f('0x94')][_0x9d1f('0x42')]);_0x4d5018[_0x9d1f('0x46')]=_[_0x9d1f('0x45')](_0x2eb9b7[_0x9d1f('0x46')]);_0x4d5018[_0x9d1f('0x47')]=_['intersection'](_0x4d5018['model'],_0x4d5018[_0x9d1f('0x46')]);_0x19f7a6[_0x9d1f('0x4a')]=_[_0x9d1f('0x48')](_0x4d5018[_0x9d1f('0x49')],qs[_0x9d1f('0x4b')](_0x2eb9b7[_0x9d1f('0x46')][_0x9d1f('0x4b')]));_0x19f7a6[_0x9d1f('0x4a')]=_0x19f7a6['attributes'][_0x9d1f('0x4c')]?_0x19f7a6['attributes']:_0x4d5018[_0x9d1f('0x49')];if(!_0x2eb9b7[_0x9d1f('0x46')]['hasOwnProperty'](_0x9d1f('0x4e'))){_0x19f7a6['limit']=qs[_0x9d1f('0x34')](_0x2eb9b7[_0x9d1f('0x46')]['limit']);_0x19f7a6[_0x9d1f('0x33')]=qs['offset'](_0x2eb9b7[_0x9d1f('0x46')][_0x9d1f('0x33')]);}_0x19f7a6[_0x9d1f('0x4f')]=qs[_0x9d1f('0x50')](_0x2eb9b7['query'][_0x9d1f('0x50')]);_0x19f7a6['where']=qs[_0x9d1f('0x47')](_[_0x9d1f('0x52')](_0x2eb9b7[_0x9d1f('0x46')],_0x4d5018[_0x9d1f('0x47')]));_0x19f7a6[_0x9d1f('0x51')][_0x9d1f('0x6d')]=_0x407a5b['id'];if(_0x2eb9b7['query']['filter']){_0x19f7a6['where']=_[_0x9d1f('0x54')](_0x19f7a6['where'],{'$or':_[_0x9d1f('0x40')](_0x19f7a6['attributes'],function(_0x3838d7){var _0x455543={};_0x455543[_0x3838d7]={'$like':'%'+_0x2eb9b7[_0x9d1f('0x46')]['filter']+'%'};return _0x455543;})});}_0x19f7a6=_['merge']({},_0x19f7a6,_0x2eb9b7[_0x9d1f('0x57')]);return db[_0x9d1f('0x94')]['count']({'where':_0x19f7a6['where']})['then'](function(_0x18b4e9){_0x4f81f9[_0x9d1f('0x32')]=_0x18b4e9;if(_0x2eb9b7[_0x9d1f('0x46')]['includeAll']){_0x19f7a6[_0x9d1f('0x59')]=[{'model':db[_0x9d1f('0x90')],'as':'Contact','required':![]},{'model':db[_0x9d1f('0xa1')],'as':'Owner','attributes':[_0x9d1f('0x3d'),'fullname',_0x9d1f('0xb1')],'required':![]},{'model':db[_0x9d1f('0xb2')],'as':'Tags','attributes':['id',_0x9d1f('0x3d'),_0x9d1f('0xb3')],'where':_0x2eb9b7['query'][_0x9d1f('0xb4')]?{'id':_0x2eb9b7[_0x9d1f('0x46')]['tag']}:undefined,'required':_0x2eb9b7[_0x9d1f('0x46')]['tag']?!![]:![]}];}return db[_0x9d1f('0x94')]['findAll'](_0x19f7a6);})[_0x9d1f('0x25')](function(_0x9d6e99){_0x4f81f9[_0x9d1f('0x5b')]=_0x9d6e99;return _0x4f81f9;});}})['then'](respondWithFilteredResult(_0x41a1b9,_0x19f7a6))[_0x9d1f('0x5f')](handleError(_0x41a1b9,null));};exports[_0x9d1f('0xb5')]=function(_0x3e640f,_0x4428c5,_0xe5780){return db['OpenchannelAccount'][_0x9d1f('0x67')]({'where':{'id':_0x3e640f['params']['id']}})[_0x9d1f('0x25')](handleEntityNotFound(_0x4428c5,null))[_0x9d1f('0x25')](function(_0x5d2050){if(_0x5d2050){return _0x5d2050['addAgents'](_0x3e640f[_0x9d1f('0x61')][_0x9d1f('0x71')],_[_0x9d1f('0xb6')](_0x3e640f['body'],[_0x9d1f('0x71'),'id'])||{})['spread'](function(_0x496764){for(var _0x5c14d1=0x0;_0x5c14d1<_0x3e640f[_0x9d1f('0x61')][_0x9d1f('0x71')][_0x9d1f('0x4c')];_0x5c14d1+=0x1){socket[_0x9d1f('0xb7')](_0x9d1f('0xb8'),{'UserId':_0x3e640f[_0x9d1f('0x61')][_0x9d1f('0x71')][_0x5c14d1],'OpenchannelAccountId':_0x3e640f[_0x9d1f('0x5d')]['id']});}return _0x496764;});}})[_0x9d1f('0x25')](respondWithResult(_0x4428c5,null))[_0x9d1f('0x5f')](handleError(_0x4428c5,null));};exports[_0x9d1f('0xb9')]=function(_0x1983b6,_0x2b6fde,_0x36b57b){return db[_0x9d1f('0x41')]['find']({'where':{'id':_0x1983b6['params']['id']}})[_0x9d1f('0x25')](handleEntityNotFound(_0x2b6fde,null))[_0x9d1f('0x25')](function(_0x332e44){if(_0x332e44){return _0x332e44[_0x9d1f('0xb9')](_0x1983b6[_0x9d1f('0x46')][_0x9d1f('0x71')])[_0x9d1f('0x25')](function(){if(_[_0x9d1f('0xba')](_0x1983b6['query'][_0x9d1f('0x71')])){for(var _0x2edc6e=0x0;_0x2edc6e<_0x1983b6[_0x9d1f('0x46')]['ids']['length'];_0x2edc6e+=0x1){socket[_0x9d1f('0xb7')](_0x9d1f('0xbb'),{'UserId':Number(_0x1983b6['query'][_0x9d1f('0x71')][_0x2edc6e]),'OpenchannelAccountId':Number(_0x1983b6[_0x9d1f('0x5d')]['id'])});}}else{socket[_0x9d1f('0xb7')]('userOpenchannelAccount:remove',{'UserId':Number(_0x1983b6['query'][_0x9d1f('0x71')]),'OpenchannelAccountId':Number(_0x1983b6['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2b6fde,null))[_0x9d1f('0x5f')](handleError(_0x2b6fde,null));};exports['getAgents']=function(_0x5f2c2e,_0x263008,_0x59d278){var _0x50a15f={};var _0x6d4c48={};var _0x4e9f5c;var _0x1240af;return db[_0x9d1f('0x41')][_0x9d1f('0x73')]({'where':{'id':_0x5f2c2e[_0x9d1f('0x5d')]['id']}})[_0x9d1f('0x25')](handleEntityNotFound(_0x263008,null))[_0x9d1f('0x25')](function(_0x4e05d6){if(_0x4e05d6){_0x4e9f5c=_0x4e05d6;_0x6d4c48[_0x9d1f('0x49')]=_[_0x9d1f('0x45')](db[_0x9d1f('0xa1')][_0x9d1f('0x42')]);_0x6d4c48[_0x9d1f('0x46')]=_[_0x9d1f('0x45')](_0x5f2c2e['query']);_0x6d4c48['filters']=_['intersection'](_0x6d4c48[_0x9d1f('0x49')],_0x6d4c48[_0x9d1f('0x46')]);_0x50a15f[_0x9d1f('0x4a')]=_['intersection'](_0x6d4c48[_0x9d1f('0x49')],qs[_0x9d1f('0x4b')](_0x5f2c2e['query'][_0x9d1f('0x4b')]));_0x50a15f[_0x9d1f('0x4a')]=_0x50a15f[_0x9d1f('0x4a')]['length']?_0x50a15f['attributes']:_0x6d4c48[_0x9d1f('0x49')];_0x50a15f[_0x9d1f('0x4f')]=qs['sort'](_0x5f2c2e[_0x9d1f('0x46')][_0x9d1f('0x50')]);_0x50a15f[_0x9d1f('0x51')]=qs[_0x9d1f('0x47')](_['pick'](_0x5f2c2e['query'],_0x6d4c48[_0x9d1f('0x47')]));if(_0x5f2c2e['query'][_0x9d1f('0x53')]){_0x50a15f[_0x9d1f('0x51')]=_[_0x9d1f('0x54')](_0x50a15f[_0x9d1f('0x51')],{'$or':_[_0x9d1f('0x40')](_0x50a15f['attributes'],function(_0x1be580){var _0x3847c9={};_0x3847c9[_0x1be580]={'$like':'%'+_0x5f2c2e[_0x9d1f('0x46')][_0x9d1f('0x53')]+'%'};return _0x3847c9;})});}_0x50a15f=_[_0x9d1f('0x54')]({},_0x50a15f,_0x5f2c2e[_0x9d1f('0x57')]);return _0x4e9f5c[_0x9d1f('0xbc')](_0x50a15f);}})[_0x9d1f('0x25')](function(_0xbba35f){if(_0xbba35f){_0x1240af=_0xbba35f[_0x9d1f('0x4c')];if(!_0x5f2c2e[_0x9d1f('0x46')][_0x9d1f('0x4d')](_0x9d1f('0x4e'))){_0x50a15f[_0x9d1f('0x34')]=qs['limit'](_0x5f2c2e[_0x9d1f('0x46')][_0x9d1f('0x34')]);_0x50a15f[_0x9d1f('0x33')]=qs[_0x9d1f('0x33')](_0x5f2c2e['query']['offset']);}return _0x4e9f5c[_0x9d1f('0xbc')](_0x50a15f);}})[_0x9d1f('0x25')](function(_0x59ccbf){if(_0x59ccbf){return _0x59ccbf?{'count':_0x1240af,'rows':_0x59ccbf}:null;}})[_0x9d1f('0x25')](respondWithResult(_0x263008,null))[_0x9d1f('0x5f')](handleError(_0x263008,null));};exports[_0x9d1f('0xbd')]=function(_0x8e3b80,_0x4065ef,_0x2e2c91){var _0x29a5af,_0x37549e,_0x3a09f6;if(_[_0x9d1f('0x7e')](_0x8e3b80[_0x9d1f('0x61')]['body'])||_0x8e3b80[_0x9d1f('0x61')][_0x9d1f('0x61')]===''){throw new db[(_0x9d1f('0x77'))][(_0x9d1f('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x8e3b80[_0x9d1f('0x61')]['to'])){}_0x29a5af=_0x8e3b80[_0x9d1f('0x61')]['to'];return db[_0x9d1f('0x41')][_0x9d1f('0x73')]({'where':{'id':_0x8e3b80[_0x9d1f('0x5d')]['id']}})[_0x9d1f('0x25')](handleEntityNotFound(_0x4065ef,null))[_0x9d1f('0x25')](function(_0x2c116f){if(_0x2c116f){return db[_0x9d1f('0x41')][_0x9d1f('0x67')]({'where':{'id':_0x2c116f['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9d1f('0x90')],'as':_0x9d1f('0x88'),'where':{[_0x2c116f[_0x9d1f('0x84')]]:_0x29a5af},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x9d1f('0x25')](handleEntityNotFound(_0x4065ef,null))[_0x9d1f('0x25')](function(_0x2462c9){if(_0x2462c9&&_0x2462c9[_0x9d1f('0x87')]){_0x37549e=_0x2462c9['get']({'plain':!![]});if(_0x37549e[_0x9d1f('0x87')]&&_0x37549e['List'][_0x9d1f('0x88')][_0x9d1f('0x4c')]){return _0x37549e[_0x9d1f('0x87')][_0x9d1f('0x88')][0x0];}return db[_0x9d1f('0x90')][_0x9d1f('0x60')](_['defaults'](_0x8e3b80[_0x9d1f('0x61')],{'firstName':_0x29a5af,[_0x2462c9[_0x9d1f('0x84')]]:_0x29a5af,'phone':_0x29a5af,'ListId':_0x37549e[_0x9d1f('0xbe')]}));}})[_0x9d1f('0x25')](handleEntityNotFound(_0x4065ef,null))[_0x9d1f('0x25')](function(_0x5d41bc){if(_0x5d41bc){_0x3a09f6=_0x5d41bc;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x3a09f6['id'],'closed':![],'OpenchannelAccountId':_0x37549e['id']}})[_0x9d1f('0x25')](function(_0x584117){if(_0x584117){return[_0x584117,![]];}return db['OpenchannelInteraction'][_0x9d1f('0x60')]({'UserId':_0x8e3b80[_0x9d1f('0x62')]['id'],'ContactId':_0x3a09f6['id'],'OpenchannelAccountId':_0x37549e['id'],'lastMsgDirection':_0x9d1f('0xbf'),'Messages':[_['merge'](_0x8e3b80[_0x9d1f('0x61')],{'read':![],'body':_0x8e3b80[_0x9d1f('0x61')][_0x9d1f('0x61')],'OpenchannelAccountId':_0x37549e['id'],'UserId':_0x8e3b80['user']['id'],'ContactId':_0x3a09f6['id']})]},{'include':[{'model':db[_0x9d1f('0xc0')],'as':_0x9d1f('0xc1')}]})[_0x9d1f('0x25')](function(_0xb95708){return[_0xb95708,!![]];});});}})[_0x9d1f('0x97')](function(_0x534fef,_0x34735d){if(_0x34735d){return _0x534fef;}return db[_0x9d1f('0xc0')][_0x9d1f('0x60')](_[_0x9d1f('0x54')](_0x8e3b80[_0x9d1f('0x61')],{'read':![],'body':_0x8e3b80[_0x9d1f('0x61')][_0x9d1f('0x61')],'OpenchannelAccountId':_0x37549e['id'],'OpenchannelInteractionId':_0x534fef['id'],'UserId':_0x8e3b80[_0x9d1f('0x62')]['id'],'ContactId':_0x3a09f6['id']}))['then'](function(_0x16d232){_0x534fef[_0x9d1f('0xc2')][_0x9d1f('0xc1')]=[];_0x534fef['dataValues']['Messages'][_0x9d1f('0x9c')](_0x16d232[_0x9d1f('0xc2')]);return _0x534fef;});});}})[_0x9d1f('0x25')](respondWithResult(_0x4065ef,null))[_0x9d1f('0x5f')](handleError(_0x4065ef,null));}; \ No newline at end of file +var _0x3181=['save','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','find','create','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','Sequelize','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','from','CmList','Contacts','OpenchannelApplication','Applications','List','applications','orderBy','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0x39fca6,_0x202c8d){var _0x1ccb27=function(_0x2c870a){while(--_0x2c870a){_0x39fca6['push'](_0x39fca6['shift']());}};_0x1ccb27(++_0x202c8d);}(_0x3181,0x142));var _0x1318=function(_0x21c601,_0x26f456){_0x21c601=_0x21c601-0x0;var _0xd423f=_0x3181[_0x21c601];return _0xd423f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1318('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1318('0x1'));var jsonpatch=require(_0x1318('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1318('0x3'));var Mustache=require('mustache');var util=require(_0x1318('0x4'));var path=require(_0x1318('0x5'));var sox=require(_0x1318('0x6'));var csv=require('to-csv');var ejs=require(_0x1318('0x7'));var fs=require('fs');var _=require(_0x1318('0x8'));var squel=require('squel');var crypto=require(_0x1318('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1318('0xa'));var toCsv=require(_0x1318('0xb'));var querystring=require(_0x1318('0xc'));var Papa=require(_0x1318('0xd'));var Redis=require('ioredis');var authService=require(_0x1318('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1318('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1318('0x10'))(_0x1318('0x11'));var utils=require(_0x1318('0x12'));var config=require(_0x1318('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1318('0x14'))['db'];config[_0x1318('0x15')]=_[_0x1318('0x16')](config[_0x1318('0x15')],{'host':_0x1318('0x17'),'port':0x18eb});var socket=require(_0x1318('0x18'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x1318('0x19')](socket);var jayson=require(_0x1318('0x1a'));var client=jayson[_0x1318('0x1b')][_0x1318('0x1c')]({'port':0x232c});var client9002=jayson[_0x1318('0x1b')][_0x1318('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x129b5a,_0x7cdd18,_0x3742f0,_0xcbca1b){return new BPromise(function(_0x1f205b,_0x49a895){var _0x2865f7=_0xcbca1b||client;return _0x2865f7[_0x1318('0x1d')](_0x129b5a,_0x3742f0)[_0x1318('0x1e')](function(_0x460c8a){logger[_0x1318('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x7cdd18,'request\x20sent');logger[_0x1318('0x20')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x7cdd18,_0x1318('0x21'),JSON[_0x1318('0x22')](_0x460c8a));if(_0x460c8a[_0x1318('0x23')]){if(_0x460c8a[_0x1318('0x23')][_0x1318('0x24')]===0x1f4){logger[_0x1318('0x23')](_0x1318('0x25'),_0x7cdd18,_0x460c8a[_0x1318('0x23')][_0x1318('0x26')]);return _0x49a895(_0x460c8a[_0x1318('0x23')]['message']);}logger[_0x1318('0x23')](_0x1318('0x25'),_0x7cdd18,_0x460c8a[_0x1318('0x23')]['message']);return _0x1f205b(_0x460c8a['error'][_0x1318('0x26')]);}else{logger[_0x1318('0x1f')](_0x1318('0x25'),_0x7cdd18,_0x1318('0x21'));_0x1f205b(_0x460c8a[_0x1318('0x27')][_0x1318('0x26')]);}})[_0x1318('0x28')](function(_0x3f7791){logger[_0x1318('0x23')](_0x1318('0x25'),_0x7cdd18,_0x3f7791);_0x49a895(_0x3f7791);});});}function respondWithStatusCode(_0x5e9f78,_0x1f83d9){_0x1f83d9=_0x1f83d9||0xcc;return function(_0xd35c64){if(_0xd35c64){return _0x5e9f78[_0x1318('0x29')](_0x1f83d9);}return _0x5e9f78[_0x1318('0x2a')](_0x1f83d9)[_0x1318('0x2b')]();};}function respondWithResult(_0x41f653,_0x8afc07){_0x8afc07=_0x8afc07||0xc8;return function(_0x3655d7){if(_0x3655d7){return _0x41f653[_0x1318('0x2a')](_0x8afc07)[_0x1318('0x2c')](_0x3655d7);}};}function respondWithFilteredResult(_0x1d93d5,_0x2ba3bc){return function(_0x1ac6bf){if(_0x1ac6bf){var _0x476270=_0x1ac6bf['count'],_0xd5612=_0x2ba3bc[_0x1318('0x2d')],_0x10511b=_0x2ba3bc[_0x1318('0x2d')]+_0x2ba3bc[_0x1318('0x2e')],_0x2d07f3;if(_0x10511b>=_0x476270){_0x10511b=_0x476270;_0x2d07f3=0xc8;}else{_0x2d07f3=0xce;}_0x1d93d5['status'](_0x2d07f3);return _0x1d93d5[_0x1318('0x2f')](_0x1318('0x30'),_0xd5612+'-'+_0x10511b+'/'+_0x476270)[_0x1318('0x2c')](_0x1ac6bf);}return null;};}function patchUpdates(_0x385062){return function(_0x2e4303){try{jsonpatch[_0x1318('0x31')](_0x2e4303,_0x385062,!![]);}catch(_0x3512e1){return BPromise['reject'](_0x3512e1);}return _0x2e4303[_0x1318('0x32')]();};}function saveUpdates(_0x4af375,_0x1a6670){return function(_0x3b0421){if(_0x3b0421){return _0x3b0421['update'](_0x4af375)[_0x1318('0x1e')](function(_0x17c7aa){return _0x17c7aa;});}return null;};}function removeEntity(_0x4587b9,_0x1f5d42){return function(_0x1acc09){if(_0x1acc09){return _0x1acc09['destroy']()[_0x1318('0x1e')](function(){var _0x4f4300=_0x1acc09['get']({'plain':!![]});var _0xeb4a72=_0x1318('0x33');return db[_0x1318('0x34')][_0x1318('0x35')]({'where':{'type':_0xeb4a72,'resourceId':_0x4f4300['id']}})[_0x1318('0x1e')](function(){return _0x1acc09;});})['then'](function(){_0x4587b9[_0x1318('0x2a')](0xcc)[_0x1318('0x2b')]();});}};}function handleEntityNotFound(_0x10bfe6,_0x1c52f2){return function(_0xf63d07){if(!_0xf63d07){_0x10bfe6[_0x1318('0x29')](0x194);}return _0xf63d07;};}function handleError(_0x4f8b15,_0x1c7aac){_0x1c7aac=_0x1c7aac||0x1f4;return function(_0x1e8c38){logger[_0x1318('0x23')](_0x1e8c38[_0x1318('0x36')]);if(_0x1e8c38[_0x1318('0x37')]){delete _0x1e8c38[_0x1318('0x37')];}_0x4f8b15[_0x1318('0x2a')](_0x1c7aac)[_0x1318('0x38')](_0x1e8c38);};}exports['index']=function(_0x131415,_0xdf7217){var _0x352327={'include':[{'model':db[_0x1318('0x39')],'as':_0x1318('0x3a')}]},_0x128f77={},_0x3a4b77={'count':0x0,'rows':[]};var _0x4b7bbc=_[_0x1318('0x3b')](db[_0x1318('0x3c')][_0x1318('0x3d')],function(_0x298dfb){return{'name':_0x298dfb[_0x1318('0x3e')],'type':_0x298dfb[_0x1318('0x3f')]['key']};});_0x128f77[_0x1318('0x40')]=_[_0x1318('0x3b')](_0x4b7bbc,'name');_0x128f77['query']=_[_0x1318('0x41')](_0x131415[_0x1318('0x42')]);_0x128f77[_0x1318('0x43')]=_[_0x1318('0x44')](_0x128f77['model'],_0x128f77[_0x1318('0x42')]);_0x352327[_0x1318('0x45')]=_[_0x1318('0x44')](_0x128f77[_0x1318('0x40')],qs[_0x1318('0x46')](_0x131415[_0x1318('0x42')][_0x1318('0x46')]));_0x352327[_0x1318('0x45')]=_0x352327[_0x1318('0x45')][_0x1318('0x47')]?_0x352327['attributes']:_0x128f77[_0x1318('0x40')];if(!_0x131415[_0x1318('0x42')][_0x1318('0x48')](_0x1318('0x49'))){_0x352327[_0x1318('0x2e')]=qs[_0x1318('0x2e')](_0x131415[_0x1318('0x42')]['limit']);_0x352327[_0x1318('0x2d')]=qs[_0x1318('0x2d')](_0x131415[_0x1318('0x42')][_0x1318('0x2d')]);}_0x352327[_0x1318('0x4a')]=qs['sort'](_0x131415[_0x1318('0x42')][_0x1318('0x4b')]);_0x352327[_0x1318('0x4c')]=qs[_0x1318('0x43')](_[_0x1318('0x4d')](_0x131415[_0x1318('0x42')],_0x128f77[_0x1318('0x43')]),_0x4b7bbc);if(_0x131415[_0x1318('0x42')][_0x1318('0x4e')]){_0x352327[_0x1318('0x4c')]=_['merge'](_0x352327[_0x1318('0x4c')],{'$or':_[_0x1318('0x3b')](_0x4b7bbc,function(_0x11b30b){if(_0x11b30b['type']!==_0x1318('0x4f')){var _0x5bb4b6={};_0x5bb4b6[_0x11b30b[_0x1318('0x37')]]={'$like':'%'+_0x131415[_0x1318('0x42')][_0x1318('0x4e')]+'%'};return _0x5bb4b6;}})});}_0x352327=_[_0x1318('0x50')]({},_0x352327,_0x131415[_0x1318('0x51')]);var _0x11fce8={'where':_0x352327['where']};return db[_0x1318('0x3c')][_0x1318('0x52')](_0x11fce8)['then'](function(_0x32f5b6){_0x3a4b77['count']=_0x32f5b6;if(_0x131415['query'][_0x1318('0x53')]){_0x352327[_0x1318('0x54')]=[{'all':!![]}];}return db[_0x1318('0x3c')][_0x1318('0x55')](_0x352327);})[_0x1318('0x1e')](function(_0x3127a0){_0x3a4b77['rows']=_0x3127a0;return _0x3a4b77;})['then'](respondWithFilteredResult(_0xdf7217,_0x352327))['catch'](handleError(_0xdf7217,null));};exports[_0x1318('0x56')]=function(_0x38f5b3,_0x3b765e){var _0x3870fd={'raw':![],'where':{'id':_0x38f5b3[_0x1318('0x57')]['id']},'include':[{'model':db[_0x1318('0x39')],'as':_0x1318('0x3a')}]},_0x558305={};_0x558305['model']=_[_0x1318('0x41')](db['OpenchannelAccount'][_0x1318('0x3d')]);_0x558305[_0x1318('0x42')]=_[_0x1318('0x41')](_0x38f5b3[_0x1318('0x42')]);_0x558305[_0x1318('0x43')]=_[_0x1318('0x44')](_0x558305['model'],_0x558305[_0x1318('0x42')]);_0x3870fd[_0x1318('0x45')]=_['intersection'](_0x558305['model'],qs[_0x1318('0x46')](_0x38f5b3[_0x1318('0x42')][_0x1318('0x46')]));_0x3870fd[_0x1318('0x45')]=_0x3870fd[_0x1318('0x45')][_0x1318('0x47')]?_0x3870fd['attributes']:_0x558305[_0x1318('0x40')];if(_0x38f5b3['query'][_0x1318('0x53')]){_0x3870fd[_0x1318('0x54')]=[{'all':!![]}];}_0x3870fd=_[_0x1318('0x50')]({},_0x3870fd,_0x38f5b3[_0x1318('0x51')]);return db[_0x1318('0x3c')][_0x1318('0x58')](_0x3870fd)[_0x1318('0x1e')](handleEntityNotFound(_0x3b765e,null))[_0x1318('0x1e')](respondWithResult(_0x3b765e,null))[_0x1318('0x28')](handleError(_0x3b765e,null));};exports['create']=function(_0x34f7fe,_0x2b5cb8){return db[_0x1318('0x3c')][_0x1318('0x59')](_0x34f7fe['body'],{})[_0x1318('0x1e')](function(_0x17f092){var _0x3c7b1a=_0x34f7fe[_0x1318('0x5a')][_0x1318('0x5b')]({'plain':!![]});if(!_0x3c7b1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c7b1a[_0x1318('0x5c')]===_0x1318('0x5a')){var _0x4942fc=_0x17f092[_0x1318('0x5b')]({'plain':!![]});var _0x1d5f4c=_0x1318('0x33');return db[_0x1318('0x5d')]['find']({'where':{'name':_0x1d5f4c,'userProfileId':_0x3c7b1a[_0x1318('0x5e')]},'raw':!![]})[_0x1318('0x1e')](function(_0xc7c257){if(_0xc7c257&&_0xc7c257['autoAssociation']===0x0){return db[_0x1318('0x34')][_0x1318('0x59')]({'name':_0x4942fc[_0x1318('0x37')],'resourceId':_0x4942fc['id'],'type':_0xc7c257[_0x1318('0x37')],'sectionId':_0xc7c257['id']},{})[_0x1318('0x1e')](function(){return _0x17f092;});}else{return _0x17f092;}})[_0x1318('0x28')](function(_0x34f24e){logger[_0x1318('0x23')](_0x1318('0x5f'),_0x34f24e);throw _0x34f24e;});}return _0x17f092;})[_0x1318('0x1e')](respondWithResult(_0x2b5cb8,0xc9))[_0x1318('0x28')](handleError(_0x2b5cb8,null));};exports[_0x1318('0x60')]=function(_0x38dc58,_0x294bb8){if(_0x38dc58[_0x1318('0x61')]['id']){delete _0x38dc58[_0x1318('0x61')]['id'];}return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x38dc58[_0x1318('0x57')]['id']},'include':[{'model':db[_0x1318('0x39')],'as':_0x1318('0x3a')}]})[_0x1318('0x1e')](handleEntityNotFound(_0x294bb8,null))['then'](saveUpdates(_0x38dc58['body'],null))[_0x1318('0x1e')](respondWithResult(_0x294bb8,null))['catch'](handleError(_0x294bb8,null));};exports['destroy']=function(_0x5d58a1,_0x2df7aa){return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x5d58a1[_0x1318('0x57')]['id']}})['then'](handleEntityNotFound(_0x2df7aa,null))[_0x1318('0x1e')](removeEntity(_0x2df7aa,null))['catch'](handleError(_0x2df7aa,null));};exports[_0x1318('0x62')]=function(_0x406c28,_0x5a4f65){return db[_0x1318('0x3c')][_0x1318('0x62')]()[_0x1318('0x1e')](respondWithResult(_0x5a4f65,null))['catch'](handleError(_0x5a4f65,null));};exports[_0x1318('0x63')]=function(_0x109340,_0x12fe9c,_0x3fc627){if(_0x109340['body']['id']){delete _0x109340[_0x1318('0x61')]['id'];}return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x109340['params']['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x12fe9c,null))[_0x1318('0x1e')](function(_0x27fb1f){if(_0x27fb1f){_0x109340[_0x1318('0x61')][_0x1318('0x64')]=_0x27fb1f['id'];return db[_0x1318('0x65')][_0x1318('0x59')](_0x109340[_0x1318('0x61')]);}})[_0x1318('0x1e')](respondWithResult(_0x12fe9c,null))[_0x1318('0x28')](handleError(_0x12fe9c,null));};exports[_0x1318('0x66')]=function(_0x5232cf,_0x1dbf30,_0x44656d){var _0x4ba8ec={'raw':![],'where':{}};var _0x26f5f5={};var _0x4b287f={'count':0x0,'rows':[]};return db[_0x1318('0x3c')][_0x1318('0x67')]({'where':{'id':_0x5232cf[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x1dbf30,null))['then'](function(_0xe79af){if(_0xe79af){_0x26f5f5[_0x1318('0x40')]=_['keys'](db[_0x1318('0x65')][_0x1318('0x3d')]);_0x26f5f5[_0x1318('0x42')]=_[_0x1318('0x41')](_0x5232cf[_0x1318('0x42')]);_0x26f5f5[_0x1318('0x43')]=_['intersection'](_0x26f5f5[_0x1318('0x40')],_0x26f5f5[_0x1318('0x42')]);_0x4ba8ec[_0x1318('0x45')]=_[_0x1318('0x44')](_0x26f5f5['model'],qs[_0x1318('0x46')](_0x5232cf[_0x1318('0x42')][_0x1318('0x46')]));_0x4ba8ec[_0x1318('0x45')]=_0x4ba8ec[_0x1318('0x45')][_0x1318('0x47')]?_0x4ba8ec[_0x1318('0x45')]:_0x26f5f5[_0x1318('0x40')];if(!_0x5232cf[_0x1318('0x42')][_0x1318('0x48')](_0x1318('0x49'))){_0x4ba8ec[_0x1318('0x2e')]=qs['limit'](_0x5232cf[_0x1318('0x42')][_0x1318('0x2e')]);_0x4ba8ec[_0x1318('0x2d')]=qs[_0x1318('0x2d')](_0x5232cf[_0x1318('0x42')][_0x1318('0x2d')]);}_0x4ba8ec['order']=qs['sort'](_0x5232cf[_0x1318('0x42')][_0x1318('0x4b')]);_0x4ba8ec[_0x1318('0x4c')]=qs[_0x1318('0x43')](_[_0x1318('0x4d')](_0x5232cf[_0x1318('0x42')],_0x26f5f5[_0x1318('0x43')]));_0x4ba8ec[_0x1318('0x4c')]['OpenchannelAccountId']=_0xe79af['id'];if(_0x5232cf[_0x1318('0x42')][_0x1318('0x4e')]){_0x4ba8ec[_0x1318('0x4c')]=_[_0x1318('0x50')](_0x4ba8ec[_0x1318('0x4c')],{'$or':_['map'](_0x4ba8ec['attributes'],function(_0x36cf89){var _0x284908={};_0x284908[_0x36cf89]={'$like':'%'+_0x5232cf['query'][_0x1318('0x4e')]+'%'};return _0x284908;})});}_0x4ba8ec=_[_0x1318('0x50')]({},_0x4ba8ec,_0x5232cf[_0x1318('0x51')]);return db[_0x1318('0x65')]['count']({'where':_0x4ba8ec[_0x1318('0x4c')]})[_0x1318('0x1e')](function(_0x4309d5){_0x4b287f[_0x1318('0x52')]=_0x4309d5;if(_0x5232cf['query'][_0x1318('0x53')]){_0x4ba8ec[_0x1318('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x1318('0x55')](_0x4ba8ec);})['then'](function(_0x2115bf){_0x4b287f[_0x1318('0x68')]=_0x2115bf;return _0x4b287f;});}})[_0x1318('0x1e')](respondWithFilteredResult(_0x1dbf30,_0x4ba8ec))[_0x1318('0x28')](handleError(_0x1dbf30,null));};exports[_0x1318('0x69')]=function(_0x47550f,_0x2fd86f,_0x34e21a){return db['OpenchannelAccount']['find']({'where':{'id':_0x47550f[_0x1318('0x57')]['id']}})['then'](handleEntityNotFound(_0x2fd86f,null))[_0x1318('0x1e')](function(_0x172c56){if(_0x172c56){return _0x172c56[_0x1318('0x69')](_0x47550f['query'][_0x1318('0x6a')]);}})['then'](respondWithStatusCode(_0x2fd86f,null))[_0x1318('0x28')](handleError(_0x2fd86f,null));};exports[_0x1318('0x6b')]=function(_0x479dc8,_0x19bf4e,_0x2a0392){if(_0x479dc8[_0x1318('0x61')]['id']){delete _0x479dc8[_0x1318('0x61')]['id'];}return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x479dc8['params']['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x19bf4e,null))[_0x1318('0x1e')](function(_0x3e7124){if(_0x3e7124){_0x479dc8[_0x1318('0x61')][_0x1318('0x64')]=_0x3e7124['id'];return db[_0x1318('0x6c')][_0x1318('0x59')](_0x479dc8[_0x1318('0x61')]);}})['then'](respondWithResult(_0x19bf4e,null))[_0x1318('0x28')](handleError(_0x19bf4e,null));};exports['getAnswers']=function(_0x278935,_0x2fd89a,_0x57970f){var _0x34263a={'raw':![],'where':{}};var _0x477fb1={};var _0x27f700={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x1318('0x67')]({'where':{'id':_0x278935[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x2fd89a,null))[_0x1318('0x1e')](function(_0x5b53ed){if(_0x5b53ed){_0x477fb1['model']=_[_0x1318('0x41')](db[_0x1318('0x6c')][_0x1318('0x3d')]);_0x477fb1[_0x1318('0x42')]=_[_0x1318('0x41')](_0x278935['query']);_0x477fb1[_0x1318('0x43')]=_[_0x1318('0x44')](_0x477fb1['model'],_0x477fb1['query']);_0x34263a['attributes']=_[_0x1318('0x44')](_0x477fb1[_0x1318('0x40')],qs[_0x1318('0x46')](_0x278935[_0x1318('0x42')]['fields']));_0x34263a[_0x1318('0x45')]=_0x34263a[_0x1318('0x45')][_0x1318('0x47')]?_0x34263a['attributes']:_0x477fb1[_0x1318('0x40')];if(!_0x278935['query'][_0x1318('0x48')](_0x1318('0x49'))){_0x34263a['limit']=qs['limit'](_0x278935[_0x1318('0x42')][_0x1318('0x2e')]);_0x34263a[_0x1318('0x2d')]=qs[_0x1318('0x2d')](_0x278935[_0x1318('0x42')][_0x1318('0x2d')]);}_0x34263a[_0x1318('0x4a')]=qs[_0x1318('0x4b')](_0x278935['query']['sort']);_0x34263a[_0x1318('0x4c')]=qs['filters'](_[_0x1318('0x4d')](_0x278935['query'],_0x477fb1[_0x1318('0x43')]));_0x34263a[_0x1318('0x4c')][_0x1318('0x64')]=_0x5b53ed['id'];if(_0x278935[_0x1318('0x42')][_0x1318('0x4e')]){_0x34263a[_0x1318('0x4c')]=_[_0x1318('0x50')](_0x34263a['where'],{'$or':_[_0x1318('0x3b')](_0x34263a[_0x1318('0x45')],function(_0x1ee83f){var _0x5eb0e1={};_0x5eb0e1[_0x1ee83f]={'$like':'%'+_0x278935[_0x1318('0x42')]['filter']+'%'};return _0x5eb0e1;})});}_0x34263a=_['merge']({},_0x34263a,_0x278935[_0x1318('0x51')]);return db[_0x1318('0x6c')]['count']({'where':_0x34263a[_0x1318('0x4c')]})['then'](function(_0x118993){_0x27f700[_0x1318('0x52')]=_0x118993;if(_0x278935[_0x1318('0x42')]['includeAll']){_0x34263a[_0x1318('0x54')]=[{'all':!![]}];}return db[_0x1318('0x6c')][_0x1318('0x55')](_0x34263a);})[_0x1318('0x1e')](function(_0x29045e){_0x27f700['rows']=_0x29045e;return _0x27f700;});}})[_0x1318('0x1e')](respondWithFilteredResult(_0x2fd89a,_0x34263a))[_0x1318('0x28')](handleError(_0x2fd89a,null));};exports[_0x1318('0x6d')]=function(_0x5d7736,_0x359fc1,_0x555be6){return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x5d7736[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x359fc1,null))[_0x1318('0x1e')](function(_0x4e3760){if(_0x4e3760){return _0x4e3760[_0x1318('0x6d')](_0x5d7736['query'][_0x1318('0x6a')]);}})['then'](respondWithStatusCode(_0x359fc1,null))[_0x1318('0x28')](handleError(_0x359fc1,null));};exports[_0x1318('0x6e')]=function(_0x5031e6,_0x20853d,_0x341bce){var _0x15d1a7={'body':_0x5031e6['body'],'channel':_0x1318('0x6f')};var _0x16f67a=[];var _0x18ed94=[];var _0xb8dc1d={};var _0x4b8f1b=![];return db[_0x1318('0x70')][_0x1318('0x62')]()[_0x1318('0x1e')](function(_0x414372){if(!_0x414372){throw new db['Sequelize'][(_0x1318('0x71'))](_0x1318('0x72'));}_0x16f67a=_[_0x1318('0x73')](_[_0x1318('0x41')](_0x414372),[_0x1318('0x74'),_0x1318('0x75')]);_0x18ed94=_[_0x1318('0x73')](_[_0x1318('0x41')](_0x414372),['createdAt',_0x1318('0x75'),_0x1318('0x76'),_0x1318('0x77')]);if(_0x5031e6[_0x1318('0x61')]['id']){delete _0x5031e6[_0x1318('0x61')]['id'];}if(_[_0x1318('0x78')](_0x5031e6[_0x1318('0x61')]['from'])){throw new db[(_0x1318('0x79'))][(_0x1318('0x71'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5031e6[_0x1318('0x61')]['body'])||_0x5031e6[_0x1318('0x61')][_0x1318('0x61')]===''){throw new db[(_0x1318('0x79'))][(_0x1318('0x71'))](_0x1318('0x7a'));}if(_['isNil'](_0x5031e6[_0x1318('0x61')]['mapKey'])){throw new db[(_0x1318('0x79'))][(_0x1318('0x71'))](_0x1318('0x7b')+_0x18ed94);}if(!_[_0x1318('0x7c')](_0x18ed94,_0x5031e6[_0x1318('0x61')][_0x1318('0x7d')])){throw new db[(_0x1318('0x79'))]['ValidationError'](_0x1318('0x7e')+_0x18ed94);}_0xb8dc1d[_0x5031e6[_0x1318('0x61')][_0x1318('0x7d')]]=_0x5031e6[_0x1318('0x61')][_0x1318('0x7f')];})[_0x1318('0x1e')](function(){return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x5031e6[_0x1318('0x57')]['id']},'include':[{'model':db[_0x1318('0x80')],'as':'List','include':[{'model':db['CmContact'],'as':_0x1318('0x81'),'where':_0xb8dc1d,'limit':0x1,'order':[[_0x1318('0x75'),'DESC']]}]},{'model':db[_0x1318('0x82')],'as':_0x1318('0x83')}]});})['then'](handleEntityNotFound(_0x20853d,null))[_0x1318('0x1e')](function(_0x462817){if(_0x462817&&_0x462817[_0x1318('0x84')]){_0x15d1a7['account']=_0x462817;_0x15d1a7[_0x1318('0x85')]=_0x462817[_0x1318('0x83')];_0x15d1a7['list']=_0x462817['List'];_0x15d1a7['applications']=_[_0x1318('0x86')](_0x15d1a7['applications'],['priority'],[_0x1318('0x87')]);if(_0x15d1a7[_0x1318('0x88')][_0x1318('0x83')]){delete _0x15d1a7['account'][_0x1318('0x83')];}if(_0x15d1a7[_0x1318('0x88')][_0x1318('0x84')]&&_0x15d1a7[_0x1318('0x88')][_0x1318('0x84')][_0x1318('0x81')][_0x1318('0x47')]){return _0x15d1a7[_0x1318('0x88')][_0x1318('0x84')][_0x1318('0x81')][0x0];}var _0x5e8d4d=_[_0x1318('0x16')](_0x5031e6[_0x1318('0x61')],{'firstName':_0x5031e6[_0x1318('0x61')][_0x1318('0x7f')],'ListId':_0x462817[_0x1318('0x77')]});_0x5e8d4d[_0x5031e6['body']['mapKey']]=_0x5031e6[_0x1318('0x61')][_0x1318('0x7f')];return db[_0x1318('0x70')][_0x1318('0x59')](_0x5e8d4d,{'fields':_0x16f67a,'raw':!![]});}})['then'](handleEntityNotFound(_0x20853d,null))['then'](function(_0x5ad6b6){_0x15d1a7[_0x1318('0x89')]=_0x5ad6b6;if(_0x5ad6b6){var _0x2598d4={'ContactId':_0x5ad6b6['id'],'OpenchannelAccountId':_0x5031e6[_0x1318('0x57')]['id'],'from':(_0x5ad6b6[_0x1318('0x8a')]||'')+'\x20'+(_0x5ad6b6[_0x1318('0x8b')]||'')};var _0xdab5d9={'OpenchannelAccountId':_0x5031e6[_0x1318('0x57')]['id'],'closed':![]};if(_0x5031e6[_0x1318('0x61')][_0x1318('0x8c')]){_0xdab5d9['threadId']=_0x5031e6[_0x1318('0x61')][_0x1318('0x8c')];return db[_0x1318('0x8d')][_0x1318('0x58')]({'where':_0xdab5d9})[_0x1318('0x1e')](function(_0x23023f){if(_0x23023f){return[_0x23023f,![]];}_0x2598d4['threadId']=_0x5031e6[_0x1318('0x61')][_0x1318('0x8c')];_0x2598d4[_0x1318('0x8e')]=_0x5031e6['body'][_0x1318('0x8e')];return db['OpenchannelInteraction']['create'](_0x2598d4)['then'](function(_0x4af0cd){return[_0x4af0cd,!![]];});});}else{_0xdab5d9['threadId']=null;}_0xdab5d9[_0x1318('0x8f')]=_0x5ad6b6['id'];return db[_0x1318('0x8d')]['find']({'where':_0xdab5d9})[_0x1318('0x1e')](function(_0x584bb2){if(_0x584bb2){return[_0x584bb2,![]];}return db[_0x1318('0x8d')][_0x1318('0x59')](_0x2598d4)['then'](function(_0x270aff){return[_0x270aff,!![]];});});}})[_0x1318('0x90')](function(_0x34947f,_0x37bb7b){if(_0x34947f){_0x4b8f1b=_0x37bb7b;if(!_0x37bb7b){var _0x5351fa={'from':(_0x15d1a7['contact']['firstName']||'')+'\x20'+(_0x15d1a7[_0x1318('0x89')]['lastName']||'')};if(_0x5031e6[_0x1318('0x61')]['threadId']&&_0x5031e6['body']['messageId']&&_0x5031e6[_0x1318('0x61')][_0x1318('0x8c')]!=_0x5031e6[_0x1318('0x61')][_0x1318('0x91')]){_0x5351fa[_0x1318('0x8c')]=_0x5031e6[_0x1318('0x61')][_0x1318('0x91')];}return _0x34947f[_0x1318('0x60')](_0x5351fa);}else{return _0x34947f;}}})[_0x1318('0x1e')](function(_0x20b938){_0x15d1a7[_0x1318('0x92')]=_0x20b938[_0x1318('0x5b')]({'plain':!![]});_0x15d1a7[_0x1318('0x92')][_0x1318('0x93')]=_0x4b8f1b;if(_0x15d1a7[_0x1318('0x92')][_0x1318('0x93')]){if(_0x15d1a7[_0x1318('0x88')][_0x1318('0x94')]){_0x15d1a7['applications'][_0x1318('0x95')]({'id':0x0,'priority':_0x15d1a7['applications'][_0x1318('0x47')]+0x1,'app':_0x1318('0x96'),'appdata':_0x1318('0x97'),'interval':_0x1318('0x98')});}}return db[_0x1318('0x99')][_0x1318('0x59')]({'body':_0x5031e6['body']['body'],'OpenchannelAccountId':_0x5031e6[_0x1318('0x57')]['id'],'OpenchannelInteractionId':_0x20b938['id'],'direction':'in','ContactId':_0x15d1a7[_0x1318('0x89')]['id'],'AttachmentId':_0x5031e6[_0x1318('0x61')][_0x1318('0x9a')]});})[_0x1318('0x1e')](function(_0x17df23){_0x15d1a7['message']=_0x17df23;if(_0x15d1a7[_0x1318('0x92')][_0x1318('0x9b')]){return db[_0x1318('0x9c')]['find']({'attributes':['id','name'],'where':{'id':_0x15d1a7[_0x1318('0x92')]['UserId']}})[_0x1318('0x1e')](function(_0x292106){if(_0x292106){_0x15d1a7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x1318('0x9d'),'appdata':_0x292106[_0x1318('0x37')]+','+(_0x15d1a7['account'][_0x1318('0x9e')]||0xa),'interval':_0x1318('0x98')});_0x15d1a7[_0x1318('0x9f')]=![];}return respondWithRpcPromise('Start','startRouting',_0x15d1a7);});}return respondWithRpcPromise(_0x1318('0xa0'),_0x1318('0xa1'),_0x15d1a7);})[_0x1318('0x1e')](function(_0x33c420){respondWithRpcPromise(_0x1318('0xa2'),_0x1318('0xa2'),{'event':'notify','message':_0x33c420},client9002);return _0x33c420;})[_0x1318('0x1e')](respondWithResult(_0x20853d,null))[_0x1318('0x28')](handleError(_0x20853d,null));};exports[_0x1318('0xa3')]=function(_0x232a60,_0x51d1fd,_0x312310){return db[_0x1318('0x3c')][_0x1318('0x67')]({'where':{'id':_0x232a60[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x51d1fd,null))['then'](function(_0x3846b0){if(_0x3846b0){return db['sequelize'][_0x1318('0xa4')](function(_0x13a8a1){return db[_0x1318('0x82')][_0x1318('0x35')]({'where':{'OpenchannelAccountId':_0x232a60[_0x1318('0x57')]['id']},'transaction':_0x13a8a1})[_0x1318('0x1e')](function(_0x2dac90){var _0x468573=_[_0x1318('0x3b')](_0x232a60[_0x1318('0x61')],function(_0x4aacec){_0x4aacec[_0x1318('0x64')]=_0x232a60[_0x1318('0x57')]['id'];return _0x4aacec;});return db[_0x1318('0x82')]['bulkCreate'](_0x468573,{'transaction':_0x13a8a1});});})[_0x1318('0x1e')](function(){return db[_0x1318('0x82')][_0x1318('0xa5')]({'where':{'OpenchannelAccountId':_0x232a60[_0x1318('0x57')]['id']},'order':'priority'});});}})[_0x1318('0x1e')](respondWithResult(_0x51d1fd,null))[_0x1318('0x28')](handleError(_0x51d1fd,null));};exports[_0x1318('0xa6')]=function(_0x56a0ad,_0x4c210e,_0x550abf){var _0x37e6aa={};var _0x11782d={};var _0x45a700;var _0x4a1824;return db[_0x1318('0x3c')][_0x1318('0x67')]({'where':{'id':_0x56a0ad[_0x1318('0x57')]['id']}})['then'](handleEntityNotFound(_0x4c210e,null))[_0x1318('0x1e')](function(_0x24de4c){if(_0x24de4c){_0x45a700=_0x24de4c;_0x11782d[_0x1318('0x40')]=_['keys'](db[_0x1318('0x82')][_0x1318('0x3d')]);_0x11782d['query']=_[_0x1318('0x41')](_0x56a0ad[_0x1318('0x42')]);_0x11782d[_0x1318('0x43')]=_[_0x1318('0x44')](_0x11782d[_0x1318('0x40')],_0x11782d['query']);_0x37e6aa[_0x1318('0x45')]=_[_0x1318('0x44')](_0x11782d[_0x1318('0x40')],qs[_0x1318('0x46')](_0x56a0ad[_0x1318('0x42')][_0x1318('0x46')]));_0x37e6aa[_0x1318('0x45')]=_0x37e6aa[_0x1318('0x45')][_0x1318('0x47')]?_0x37e6aa['attributes']:_0x11782d[_0x1318('0x40')];_0x37e6aa[_0x1318('0x4a')]=qs['sort'](_0x56a0ad[_0x1318('0x42')]['sort']);_0x37e6aa[_0x1318('0x4c')]=qs['filters'](_[_0x1318('0x4d')](_0x56a0ad['query'],_0x11782d[_0x1318('0x43')]));if(_0x56a0ad[_0x1318('0x42')][_0x1318('0x4e')]){_0x37e6aa[_0x1318('0x4c')]=_['merge'](_0x37e6aa[_0x1318('0x4c')],{'$or':_[_0x1318('0x3b')](_0x37e6aa[_0x1318('0x45')],function(_0x4e0903){var _0x5cbe70={};_0x5cbe70[_0x4e0903]={'$like':'%'+_0x56a0ad[_0x1318('0x42')][_0x1318('0x4e')]+'%'};return _0x5cbe70;})});}_0x37e6aa=_[_0x1318('0x50')]({},_0x37e6aa,_0x56a0ad['options']);return _0x45a700['getApplications'](_0x37e6aa);}})[_0x1318('0x1e')](function(_0x21df85){if(_0x21df85){_0x4a1824=_0x21df85[_0x1318('0x47')];if(!_0x56a0ad[_0x1318('0x42')][_0x1318('0x48')](_0x1318('0x49'))){_0x37e6aa[_0x1318('0x2e')]=qs['limit'](_0x56a0ad[_0x1318('0x42')]['limit']);_0x37e6aa[_0x1318('0x2d')]=qs['offset'](_0x56a0ad[_0x1318('0x42')][_0x1318('0x2d')]);}return _0x45a700[_0x1318('0xa6')](_0x37e6aa);}})['then'](function(_0x39a995){if(_0x39a995){return _0x39a995?{'count':_0x4a1824,'rows':_0x39a995}:null;}})[_0x1318('0x1e')](respondWithResult(_0x4c210e,null))[_0x1318('0x28')](handleError(_0x4c210e,null));};exports[_0x1318('0xa7')]=function(_0x5bd200,_0x5ede97,_0x5ac6bb){var _0x5854bc={'raw':![],'where':{}};var _0x24269f={};var _0x4aa99d={'count':0x0,'rows':[]};return db[_0x1318('0x3c')][_0x1318('0x67')]({'where':{'id':_0x5bd200[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x5ede97,null))[_0x1318('0x1e')](function(_0xde9b99){if(_0xde9b99){_0x24269f[_0x1318('0x40')]=_[_0x1318('0x41')](db[_0x1318('0x8d')][_0x1318('0x3d')]);_0x24269f[_0x1318('0x42')]=_[_0x1318('0x41')](_0x5bd200[_0x1318('0x42')]);_0x24269f[_0x1318('0x43')]=_['intersection'](_0x24269f[_0x1318('0x40')],_0x24269f['query']);_0x5854bc[_0x1318('0x45')]=_['intersection'](_0x24269f[_0x1318('0x40')],qs[_0x1318('0x46')](_0x5bd200['query'][_0x1318('0x46')]));_0x5854bc[_0x1318('0x45')]=_0x5854bc[_0x1318('0x45')][_0x1318('0x47')]?_0x5854bc['attributes']:_0x24269f['model'];if(!_0x5bd200[_0x1318('0x42')][_0x1318('0x48')](_0x1318('0x49'))){_0x5854bc[_0x1318('0x2e')]=qs[_0x1318('0x2e')](_0x5bd200[_0x1318('0x42')][_0x1318('0x2e')]);_0x5854bc[_0x1318('0x2d')]=qs['offset'](_0x5bd200[_0x1318('0x42')][_0x1318('0x2d')]);}_0x5854bc[_0x1318('0x4a')]=qs[_0x1318('0x4b')](_0x5bd200['query'][_0x1318('0x4b')]);_0x5854bc[_0x1318('0x4c')]=qs[_0x1318('0x43')](_['pick'](_0x5bd200[_0x1318('0x42')],_0x24269f[_0x1318('0x43')]));_0x5854bc[_0x1318('0x4c')][_0x1318('0x64')]=_0xde9b99['id'];if(_0x5bd200[_0x1318('0x42')][_0x1318('0x4e')]){_0x5854bc['where']=_[_0x1318('0x50')](_0x5854bc[_0x1318('0x4c')],{'$or':_['map'](_0x5854bc['attributes'],function(_0x62e470){var _0x59f720={};_0x59f720[_0x62e470]={'$like':'%'+_0x5bd200[_0x1318('0x42')][_0x1318('0x4e')]+'%'};return _0x59f720;})});}_0x5854bc=_[_0x1318('0x50')]({},_0x5854bc,_0x5bd200['options']);return db[_0x1318('0x8d')][_0x1318('0x52')]({'where':_0x5854bc[_0x1318('0x4c')]})[_0x1318('0x1e')](function(_0x4daa0a){_0x4aa99d['count']=_0x4daa0a;if(_0x5bd200[_0x1318('0x42')][_0x1318('0x53')]){_0x5854bc[_0x1318('0x54')]=[{'model':db[_0x1318('0x70')],'as':_0x1318('0xa8'),'required':![]},{'model':db['User'],'as':_0x1318('0xa9'),'attributes':[_0x1318('0x37'),'fullname',_0x1318('0xaa')],'required':![]},{'model':db[_0x1318('0xab')],'as':_0x1318('0xac'),'attributes':['id','name',_0x1318('0xad')],'where':_0x5bd200[_0x1318('0x42')][_0x1318('0xae')]?{'id':_0x5bd200[_0x1318('0x42')][_0x1318('0xae')]}:undefined,'required':_0x5bd200['query']['tag']?!![]:![]}];}return db[_0x1318('0x8d')][_0x1318('0x55')](_0x5854bc);})[_0x1318('0x1e')](function(_0x2ca7c3){_0x4aa99d[_0x1318('0x68')]=_0x2ca7c3;return _0x4aa99d;});}})[_0x1318('0x1e')](respondWithFilteredResult(_0x5ede97,_0x5854bc))[_0x1318('0x28')](handleError(_0x5ede97,null));};exports[_0x1318('0xaf')]=function(_0x4adfce,_0x7e7434,_0x5cc826){return db['OpenchannelAccount'][_0x1318('0x58')]({'where':{'id':_0x4adfce[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x7e7434,null))[_0x1318('0x1e')](function(_0x56ff04){if(_0x56ff04){return _0x56ff04[_0x1318('0xaf')](_0x4adfce[_0x1318('0x61')]['ids'],_[_0x1318('0xb0')](_0x4adfce['body'],[_0x1318('0x6a'),'id'])||{})[_0x1318('0x90')](function(_0x1e7d4f){for(var _0x5532eb=0x0;_0x5532eb<_0x4adfce[_0x1318('0x61')][_0x1318('0x6a')][_0x1318('0x47')];_0x5532eb+=0x1){socket[_0x1318('0xb1')]('userOpenchannelAccount:save',{'UserId':_0x4adfce[_0x1318('0x61')][_0x1318('0x6a')][_0x5532eb],'OpenchannelAccountId':_0x4adfce[_0x1318('0x57')]['id']});}return _0x1e7d4f;});}})[_0x1318('0x1e')](respondWithResult(_0x7e7434,null))[_0x1318('0x28')](handleError(_0x7e7434,null));};exports[_0x1318('0xb2')]=function(_0x98cf2e,_0x5c6be9,_0x24d483){return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x98cf2e[_0x1318('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c6be9,null))[_0x1318('0x1e')](function(_0x53e587){if(_0x53e587){return _0x53e587[_0x1318('0xb2')](_0x98cf2e[_0x1318('0x42')][_0x1318('0x6a')])[_0x1318('0x1e')](function(){if(_[_0x1318('0xb3')](_0x98cf2e[_0x1318('0x42')][_0x1318('0x6a')])){for(var _0x49e677=0x0;_0x49e677<_0x98cf2e[_0x1318('0x42')][_0x1318('0x6a')]['length'];_0x49e677+=0x1){socket[_0x1318('0xb1')]('userOpenchannelAccount:remove',{'UserId':Number(_0x98cf2e[_0x1318('0x42')][_0x1318('0x6a')][_0x49e677]),'OpenchannelAccountId':Number(_0x98cf2e[_0x1318('0x57')]['id'])});}}else{socket[_0x1318('0xb1')](_0x1318('0xb4'),{'UserId':Number(_0x98cf2e[_0x1318('0x42')][_0x1318('0x6a')]),'OpenchannelAccountId':Number(_0x98cf2e[_0x1318('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x5c6be9,null))[_0x1318('0x28')](handleError(_0x5c6be9,null));};exports[_0x1318('0xb5')]=function(_0x58d2ab,_0xf8adb,_0x36022c){var _0x3697a0={};var _0x3d99a3={};var _0x499959;var _0xe7ecf8;return db[_0x1318('0x3c')][_0x1318('0x67')]({'where':{'id':_0x58d2ab['params']['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0xf8adb,null))[_0x1318('0x1e')](function(_0x21dcb7){if(_0x21dcb7){_0x499959=_0x21dcb7;_0x3d99a3[_0x1318('0x40')]=_[_0x1318('0x41')](db[_0x1318('0x9c')][_0x1318('0x3d')]);_0x3d99a3[_0x1318('0x42')]=_[_0x1318('0x41')](_0x58d2ab[_0x1318('0x42')]);_0x3d99a3[_0x1318('0x43')]=_[_0x1318('0x44')](_0x3d99a3[_0x1318('0x40')],_0x3d99a3[_0x1318('0x42')]);_0x3697a0[_0x1318('0x45')]=_[_0x1318('0x44')](_0x3d99a3[_0x1318('0x40')],qs['fields'](_0x58d2ab[_0x1318('0x42')]['fields']));_0x3697a0[_0x1318('0x45')]=_0x3697a0[_0x1318('0x45')][_0x1318('0x47')]?_0x3697a0[_0x1318('0x45')]:_0x3d99a3[_0x1318('0x40')];_0x3697a0[_0x1318('0x4a')]=qs[_0x1318('0x4b')](_0x58d2ab['query'][_0x1318('0x4b')]);_0x3697a0[_0x1318('0x4c')]=qs[_0x1318('0x43')](_[_0x1318('0x4d')](_0x58d2ab['query'],_0x3d99a3[_0x1318('0x43')]));if(_0x58d2ab[_0x1318('0x42')][_0x1318('0x4e')]){_0x3697a0[_0x1318('0x4c')]=_[_0x1318('0x50')](_0x3697a0['where'],{'$or':_[_0x1318('0x3b')](_0x3697a0[_0x1318('0x45')],function(_0x4f2cb5){var _0x4c6a16={};_0x4c6a16[_0x4f2cb5]={'$like':'%'+_0x58d2ab['query'][_0x1318('0x4e')]+'%'};return _0x4c6a16;})});}_0x3697a0=_['merge']({},_0x3697a0,_0x58d2ab['options']);return _0x499959[_0x1318('0xb5')](_0x3697a0);}})[_0x1318('0x1e')](function(_0x498029){if(_0x498029){_0xe7ecf8=_0x498029[_0x1318('0x47')];if(!_0x58d2ab[_0x1318('0x42')]['hasOwnProperty']('nolimit')){_0x3697a0[_0x1318('0x2e')]=qs[_0x1318('0x2e')](_0x58d2ab[_0x1318('0x42')]['limit']);_0x3697a0['offset']=qs[_0x1318('0x2d')](_0x58d2ab[_0x1318('0x42')][_0x1318('0x2d')]);}return _0x499959[_0x1318('0xb5')](_0x3697a0);}})['then'](function(_0x2fd7e4){if(_0x2fd7e4){return _0x2fd7e4?{'count':_0xe7ecf8,'rows':_0x2fd7e4}:null;}})[_0x1318('0x1e')](respondWithResult(_0xf8adb,null))['catch'](handleError(_0xf8adb,null));};exports['send']=function(_0x476f90,_0x470a85,_0x32e649){var _0x40668a,_0x49e859,_0x586cef;if(_['isNil'](_0x476f90[_0x1318('0x61')]['body'])||_0x476f90[_0x1318('0x61')]['body']===''){throw new db[(_0x1318('0x79'))][(_0x1318('0x71'))](_0x1318('0x7a'));}if(_[_0x1318('0x78')](_0x476f90['body']['to'])){}_0x40668a=_0x476f90['body']['to'];return db['OpenchannelAccount'][_0x1318('0x67')]({'where':{'id':_0x476f90[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x470a85,null))[_0x1318('0x1e')](function(_0x4ce2b9){if(_0x4ce2b9){return db['OpenchannelAccount'][_0x1318('0x58')]({'where':{'id':_0x4ce2b9['id']},'include':[{'model':db[_0x1318('0x80')],'as':_0x1318('0x84'),'include':[{'model':db[_0x1318('0x70')],'as':_0x1318('0x81'),'where':{[_0x4ce2b9['mapKey']]:_0x40668a},'limit':0x1,'order':[['updatedAt',_0x1318('0xb6')]]}]}]})[_0x1318('0x1e')](handleEntityNotFound(_0x470a85,null))[_0x1318('0x1e')](function(_0x494a09){if(_0x494a09&&_0x494a09['List']){_0x49e859=_0x494a09[_0x1318('0x5b')]({'plain':!![]});if(_0x49e859['List']&&_0x49e859[_0x1318('0x84')]['Contacts'][_0x1318('0x47')]){return _0x49e859[_0x1318('0x84')][_0x1318('0x81')][0x0];}return db[_0x1318('0x70')][_0x1318('0x59')](_[_0x1318('0x16')](_0x476f90[_0x1318('0x61')],{'firstName':_0x40668a,[_0x494a09[_0x1318('0x7d')]]:_0x40668a,'phone':_0x40668a,'ListId':_0x49e859[_0x1318('0x77')]}));}})[_0x1318('0x1e')](handleEntityNotFound(_0x470a85,null))[_0x1318('0x1e')](function(_0x2f723c){if(_0x2f723c){_0x586cef=_0x2f723c;return db[_0x1318('0x8d')][_0x1318('0x58')]({'where':{'ContactId':_0x586cef['id'],'closed':![],'OpenchannelAccountId':_0x49e859['id']}})[_0x1318('0x1e')](function(_0xd4926e){if(_0xd4926e){return[_0xd4926e,![]];}return db[_0x1318('0x8d')][_0x1318('0x59')]({'UserId':_0x476f90[_0x1318('0x5a')]['id'],'ContactId':_0x586cef['id'],'OpenchannelAccountId':_0x49e859['id'],'lastMsgDirection':_0x1318('0xb7'),'Messages':[_[_0x1318('0x50')](_0x476f90['body'],{'read':![],'body':_0x476f90[_0x1318('0x61')][_0x1318('0x61')],'OpenchannelAccountId':_0x49e859['id'],'UserId':_0x476f90[_0x1318('0x5a')]['id'],'ContactId':_0x586cef['id']})]},{'include':[{'model':db[_0x1318('0x99')],'as':_0x1318('0xb8')}]})[_0x1318('0x1e')](function(_0x3b7f32){return[_0x3b7f32,!![]];});});}})[_0x1318('0x90')](function(_0x4c3bbc,_0x3cad9b){if(_0x3cad9b){return _0x4c3bbc;}return db[_0x1318('0x99')][_0x1318('0x59')](_[_0x1318('0x50')](_0x476f90['body'],{'read':![],'body':_0x476f90['body'][_0x1318('0x61')],'OpenchannelAccountId':_0x49e859['id'],'OpenchannelInteractionId':_0x4c3bbc['id'],'UserId':_0x476f90[_0x1318('0x5a')]['id'],'ContactId':_0x586cef['id']}))[_0x1318('0x1e')](function(_0x205cdc){_0x4c3bbc[_0x1318('0xb9')][_0x1318('0xb8')]=[];_0x4c3bbc[_0x1318('0xb9')]['Messages']['push'](_0x205cdc[_0x1318('0xb9')]);return _0x4c3bbc;});});}})[_0x1318('0x1e')](respondWithResult(_0x470a85,null))[_0x1318('0x28')](handleError(_0x470a85,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 43b583b..9d08fdf 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 _0xebcc=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x6a3fe9,_0x203f21){var _0x32bd75=function(_0x2984aa){while(--_0x2984aa){_0x6a3fe9['push'](_0x6a3fe9['shift']());}};_0x32bd75(++_0x203f21);}(_0xebcc,0x1df));var _0xcebc=function(_0x2a1140,_0x103c82){_0x2a1140=_0x2a1140-0x0;var _0x3a595b=_0xebcc[_0x2a1140];return _0x3a595b;};'use strict';var EventEmitter=require(_0xcebc('0x0'));var OpenchannelAccount=require(_0xcebc('0x1'))['db'][_0xcebc('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xcebc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcebc('0x4'),'afterDestroy':_0xcebc('0x5')};function emitEvent(_0x80c4c7){return function(_0x12ef1f,_0x898c57,_0x4363a5){OpenchannelAccountEvents[_0xcebc('0x6')](_0x80c4c7+':'+_0x12ef1f['id'],_0x12ef1f);OpenchannelAccountEvents[_0xcebc('0x6')](_0x80c4c7,_0x12ef1f);_0x4363a5(null);};}for(var e in events){if(events[_0xcebc('0x7')](e)){var event=events[e];OpenchannelAccount[_0xcebc('0x8')](e,emitEvent(event));}}module[_0xcebc('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x32bc=['events','OpenchannelAccount','update','remove','hasOwnProperty','hook'];(function(_0x549e1d,_0x4c5ddf){var _0x2da99d=function(_0x49f919){while(--_0x49f919){_0x549e1d['push'](_0x549e1d['shift']());}};_0x2da99d(++_0x4c5ddf);}(_0x32bc,0x12c));var _0xc32b=function(_0x69d1e7,_0x32abb4){_0x69d1e7=_0x69d1e7-0x0;var _0xa45a7e=_0x32bc[_0x69d1e7];return _0xa45a7e;};'use strict';var EventEmitter=require(_0xc32b('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xc32b('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc32b('0x2'),'afterDestroy':_0xc32b('0x3')};function emitEvent(_0x4a2dbd){return function(_0x458077,_0x1fab1d,_0x4c5193){OpenchannelAccountEvents['emit'](_0x4a2dbd+':'+_0x458077['id'],_0x458077);OpenchannelAccountEvents['emit'](_0x4a2dbd,_0x458077);_0x4c5193(null);};}for(var e in events){if(events[_0xc32b('0x4')](e)){var event=events[e];OpenchannelAccount[_0xc32b('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 3789032..5ba0e65 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 _0x1417=['../../config/environment','./openchannelAccount.attributes','define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xa24e1,_0x2e0478){var _0x5b32af=function(_0x52e1ad){while(--_0x52e1ad){_0xa24e1['push'](_0xa24e1['shift']());}};_0x5b32af(++_0x2e0478);}(_0x1417,0xef));var _0x7141=function(_0x346d96,_0x186d68){_0x346d96=_0x346d96-0x0;var _0x533f44=_0x1417[_0x346d96];return _0x533f44;};'use strict';var _=require(_0x7141('0x0'));var util=require(_0x7141('0x1'));var logger=require(_0x7141('0x2'))(_0x7141('0x3'));var moment=require(_0x7141('0x4'));var BPromise=require(_0x7141('0x5'));var rp=require(_0x7141('0x6'));var fs=require('fs');var path=require(_0x7141('0x7'));var rimraf=require('rimraf');var config=require(_0x7141('0x8'));var attributes=require(_0x7141('0x9'));module['exports']=function(_0xc51d39,_0x2c92aa){return _0xc51d39[_0x7141('0xa')](_0x7141('0xb'),attributes,{'tableName':_0x7141('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb492=['path','rimraf','../../config/environment','./openchannelAccount.attributes','define','OpenchannelAccount','openchannel_accounts','util','../../config/logger','api','moment'];(function(_0x2fffaf,_0x2e4fd9){var _0x5289f3=function(_0x3cc196){while(--_0x3cc196){_0x2fffaf['push'](_0x2fffaf['shift']());}};_0x5289f3(++_0x2e4fd9);}(_0xb492,0x172));var _0x2b49=function(_0x329b49,_0xeaf527){_0x329b49=_0x329b49-0x0;var _0x37e23a=_0xb492[_0x329b49];return _0x37e23a;};'use strict';var _=require('lodash');var util=require(_0x2b49('0x0'));var logger=require(_0x2b49('0x1'))(_0x2b49('0x2'));var moment=require(_0x2b49('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b49('0x4'));var rimraf=require(_0x2b49('0x5'));var config=require(_0x2b49('0x6'));var attributes=require(_0x2b49('0x7'));module['exports']=function(_0x53508a,_0x346359){return _0x53508a[_0x2b49('0x8')](_0x2b49('0x9'),attributes,{'tableName':_0x2b49('0xa'),'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 188422f..016832e 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 _0xb5dd=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x58704f,_0x381bf6){var _0x427836=function(_0x1a26e9){while(--_0x1a26e9){_0x58704f['push'](_0x58704f['shift']());}};_0x427836(++_0x381bf6);}(_0xb5dd,0x1ce));var _0xdb5d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb5dd[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xdb5d('0x0'));var util=require(_0xdb5d('0x1'));var moment=require(_0xdb5d('0x2'));var BPromise=require(_0xdb5d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb5d('0x5'));var logger=require('../../config/logger')(_0xdb5d('0x6'));var config=require(_0xdb5d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdb5d('0x8')][_0xdb5d('0x9')]({'port':0x232a});config[_0xdb5d('0xa')]=_[_0xdb5d('0xb')](config[_0xdb5d('0xa')],{'host':_0xdb5d('0xc'),'port':0x18eb});var socket=require(_0xdb5d('0xd'))(new Redis(config[_0xdb5d('0xa')]));require(_0xdb5d('0xe'))['register'](socket);function respondWithRpcPromise(_0x55e93b,_0x1d9f05,_0x2c2aec){return new BPromise(function(_0x41b5b8,_0x4fb424){return client[_0xdb5d('0xf')](_0x55e93b,_0x2c2aec)['then'](function(_0x447649){logger[_0xdb5d('0x10')](_0xdb5d('0x11'),_0x1d9f05,_0xdb5d('0x12'));logger['debug'](_0xdb5d('0x13'),_0x1d9f05,_0xdb5d('0x12'),JSON[_0xdb5d('0x14')](_0x447649));if(_0x447649[_0xdb5d('0x15')]){if(_0x447649[_0xdb5d('0x15')][_0xdb5d('0x16')]===0x1f4){logger[_0xdb5d('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x1d9f05,_0x447649['error'][_0xdb5d('0x17')]);return _0x4fb424(_0x447649['error']['message']);}logger[_0xdb5d('0x15')](_0xdb5d('0x11'),_0x1d9f05,_0x447649['error'][_0xdb5d('0x17')]);return _0x41b5b8(_0x447649[_0xdb5d('0x15')][_0xdb5d('0x17')]);}else{logger[_0xdb5d('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x1d9f05,_0xdb5d('0x12'));_0x41b5b8(_0x447649[_0xdb5d('0x18')][_0xdb5d('0x17')]);}})[_0xdb5d('0x19')](function(_0x3c6ea3){logger[_0xdb5d('0x15')](_0xdb5d('0x11'),_0x1d9f05,_0x3c6ea3);_0x4fb424(_0x3c6ea3);});});} \ No newline at end of file +var _0xaeec=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x368a25,_0x1d41a6){var _0x13d06a=function(_0xf71c46){while(--_0xf71c46){_0x368a25['push'](_0x368a25['shift']());}};_0x13d06a(++_0x1d41a6);}(_0xaeec,0x1cc));var _0xcaee=function(_0x270191,_0x1ab7e0){_0x270191=_0x270191-0x0;var _0x1164fd=_0xaeec[_0x270191];return _0x1164fd;};'use strict';var _=require(_0xcaee('0x0'));var util=require(_0xcaee('0x1'));var moment=require(_0xcaee('0x2'));var BPromise=require(_0xcaee('0x3'));var rs=require(_0xcaee('0x4'));var fs=require('fs');var Redis=require(_0xcaee('0x5'));var db=require(_0xcaee('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcaee('0x7'))(_0xcaee('0x8'));var config=require(_0xcaee('0x9'));var jayson=require(_0xcaee('0xa'));var client=jayson['client'][_0xcaee('0xb')]({'port':0x232a});config['redis']=_[_0xcaee('0xc')](config['redis'],{'host':_0xcaee('0xd'),'port':0x18eb});var socket=require(_0xcaee('0xe'))(new Redis(config[_0xcaee('0xf')]));require(_0xcaee('0x10'))[_0xcaee('0x11')](socket);function respondWithRpcPromise(_0x3c5227,_0x726baf,_0x447b84){return new BPromise(function(_0x22ed58,_0x2d9f41){return client[_0xcaee('0x12')](_0x3c5227,_0x447b84)[_0xcaee('0x13')](function(_0x18d854){logger[_0xcaee('0x14')](_0xcaee('0x15'),_0x726baf,_0xcaee('0x16'));logger[_0xcaee('0x17')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x726baf,_0xcaee('0x16'),JSON['stringify'](_0x18d854));if(_0x18d854[_0xcaee('0x18')]){if(_0x18d854[_0xcaee('0x18')][_0xcaee('0x19')]===0x1f4){logger['error'](_0xcaee('0x15'),_0x726baf,_0x18d854[_0xcaee('0x18')][_0xcaee('0x1a')]);return _0x2d9f41(_0x18d854[_0xcaee('0x18')][_0xcaee('0x1a')]);}logger[_0xcaee('0x18')](_0xcaee('0x15'),_0x726baf,_0x18d854[_0xcaee('0x18')]['message']);return _0x22ed58(_0x18d854[_0xcaee('0x18')][_0xcaee('0x1a')]);}else{logger['info'](_0xcaee('0x15'),_0x726baf,_0xcaee('0x16'));_0x22ed58(_0x18d854[_0xcaee('0x1b')][_0xcaee('0x1a')]);}})[_0xcaee('0x1c')](function(_0x21f71d){logger[_0xcaee('0x18')](_0xcaee('0x15'),_0x726baf,_0x21f71d);_0x2d9f41(_0x21f71d);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 682398c..1330a4b 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 _0x3434=['register','length','./openchannelAccount.events','save','remove'];(function(_0x4a1cf9,_0x213622){var _0x13c5d5=function(_0x4f1b88){while(--_0x4f1b88){_0x4a1cf9['push'](_0x4a1cf9['shift']());}};_0x13c5d5(++_0x213622);}(_0x3434,0x93));var _0x4343=function(_0x467aae,_0x515e6e){_0x467aae=_0x467aae-0x0;var _0x543242=_0x3434[_0x467aae];return _0x543242;};'use strict';var OpenchannelAccountEvents=require(_0x4343('0x0'));var events=[_0x4343('0x1'),_0x4343('0x2'),'update'];function createListener(_0x1f8fbc,_0x3d250b){return function(_0x15d719){_0x3d250b['emit'](_0x1f8fbc,_0x15d719);};}function removeListener(_0x1ea100,_0x14f90d){return function(){OpenchannelAccountEvents['removeListener'](_0x1ea100,_0x14f90d);};}exports[_0x4343('0x3')]=function(_0x23b94a){for(var _0x596b6a=0x0,_0x41e934=events[_0x4343('0x4')];_0x596b6a<_0x41e934;_0x596b6a++){var _0x2d09ee=events[_0x596b6a];var _0x20b6b1=createListener('openchannelAccount:'+_0x2d09ee,_0x23b94a);OpenchannelAccountEvents['on'](_0x2d09ee,_0x20b6b1);}}; \ No newline at end of file +var _0x4822=['emit','length','openchannelAccount:','save','remove','update'];(function(_0x4fd27a,_0x3aa758){var _0x1c179f=function(_0x44b251){while(--_0x44b251){_0x4fd27a['push'](_0x4fd27a['shift']());}};_0x1c179f(++_0x3aa758);}(_0x4822,0x153));var _0x2482=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0x4822[_0x41c381];return _0x427981;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x2482('0x0'),_0x2482('0x1'),_0x2482('0x2')];function createListener(_0x5d9d40,_0x22e420){return function(_0x27d4c4){_0x22e420[_0x2482('0x3')](_0x5d9d40,_0x27d4c4);};}function removeListener(_0x19125a,_0x44d940){return function(){OpenchannelAccountEvents['removeListener'](_0x19125a,_0x44d940);};}exports['register']=function(_0x598f90){for(var _0x47ba56=0x0,_0x1aa6a4=events[_0x2482('0x4')];_0x47ba56<_0x1aa6a4;_0x47ba56++){var _0x4b825e=events[_0x47ba56];var _0x165389=createListener(_0x2482('0x5')+_0x4b825e,_0x598f90);OpenchannelAccountEvents['on'](_0x4b825e,_0x165389);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index b718edf..1e60fdb 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 _0x690b=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0x690b,0x64));var _0xb690=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x690b[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0xb690('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb690('0x1'));var express=require(_0xb690('0x2'));var router=express['Router']();var auth=require(_0xb690('0x3'));var interaction=require(_0xb690('0x4'));var config=require(_0xb690('0x5'));var controller=require(_0xb690('0x6'));router[_0xb690('0x7')]('/',auth[_0xb690('0x8')](),controller[_0xb690('0x9')]);router[_0xb690('0x7')](_0xb690('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb690('0x8')](),controller[_0xb690('0xb')]);router[_0xb690('0xc')](_0xb690('0xa'),auth[_0xb690('0x8')](),controller[_0xb690('0xd')]);router[_0xb690('0xe')](_0xb690('0xa'),auth[_0xb690('0x8')](),controller[_0xb690('0xf')]);module[_0xb690('0x10')]=router; \ No newline at end of file +var _0x00b8=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x3451cf,_0x432594){var _0x485e36=function(_0x5d6120){while(--_0x5d6120){_0x3451cf['push'](_0x3451cf['shift']());}};_0x485e36(++_0x432594);}(_0x00b8,0x145));var _0x800b=function(_0x47dcef,_0x1d6e3a){_0x47dcef=_0x47dcef-0x0;var _0x1f6765=_0x00b8[_0x47dcef];return _0x1f6765;};'use strict';var multer=require(_0x800b('0x0'));var util=require(_0x800b('0x1'));var path=require(_0x800b('0x2'));var timeout=require(_0x800b('0x3'));var express=require(_0x800b('0x4'));var router=express[_0x800b('0x5')]();var auth=require(_0x800b('0x6'));var interaction=require(_0x800b('0x7'));var config=require(_0x800b('0x8'));var controller=require(_0x800b('0x9'));router[_0x800b('0xa')]('/',auth[_0x800b('0xb')](),controller[_0x800b('0xc')]);router[_0x800b('0xa')](_0x800b('0xd'),auth[_0x800b('0xb')](),controller[_0x800b('0xe')]);router[_0x800b('0xf')]('/',auth[_0x800b('0xb')](),controller[_0x800b('0x10')]);router[_0x800b('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x800b('0x12')](_0x800b('0xd'),auth[_0x800b('0xb')](),controller[_0x800b('0x13')]);module[_0x800b('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 5c2f000..9150ead 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 _0x1a94=['sequelize','exports','INTEGER','STRING'];(function(_0x234ef2,_0x3fb5fd){var _0x4456d2=function(_0x2fba86){while(--_0x2fba86){_0x234ef2['push'](_0x234ef2['shift']());}};_0x4456d2(++_0x3fb5fd);}(_0x1a94,0x138));var _0x41a9=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x1a94[_0x34bc30];return _0x5706de;};'use strict';var Sequelize=require(_0x41a9('0x0'));module[_0x41a9('0x1')]={'priority':{'type':Sequelize[_0x41a9('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x41a9('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x133a=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0x133a,0xbb));var _0xa133=function(_0x133fe4,_0x1f473b){_0x133fe4=_0x133fe4-0x0;var _0x4c4017=_0x133a[_0x133fe4];return _0x4c4017;};'use strict';var Sequelize=require('sequelize');module[_0xa133('0x0')]={'priority':{'type':Sequelize[_0xa133('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa133('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa133('0x3')]()},'description':{'type':Sequelize[_0xa133('0x2')]},'interval':{'type':Sequelize[_0xa133('0x2')],'defaultValue':_0xa133('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index f11963a..d1ebd7a 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 _0xfa43=['VIRTUAL','OpenchannelApplication','includeAll','include','findAll','rows','show','options','find','catch','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge'];(function(_0x37cb86,_0x456e6d){var _0x5d1aa8=function(_0x23852f){while(--_0x23852f){_0x37cb86['push'](_0x37cb86['shift']());}};_0x5d1aa8(++_0x456e6d);}(_0xfa43,0x145));var _0x3fa4=function(_0x4d9abf,_0x323f72){_0x4d9abf=_0x4d9abf-0x0;var _0x39c5d0=_0xfa43[_0x4d9abf];return _0x39c5d0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3fa4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3fa4('0x1'));var rp=require(_0x3fa4('0x2'));var moment=require(_0x3fa4('0x3'));var BPromise=require(_0x3fa4('0x4'));var Mustache=require(_0x3fa4('0x5'));var util=require(_0x3fa4('0x6'));var path=require('path');var sox=require(_0x3fa4('0x7'));var csv=require(_0x3fa4('0x8'));var ejs=require(_0x3fa4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3fa4('0xa'));var deskjs=require(_0x3fa4('0xb'));var toCsv=require(_0x3fa4('0x8'));var querystring=require(_0x3fa4('0xc'));var Papa=require(_0x3fa4('0xd'));var Redis=require(_0x3fa4('0xe'));var authService=require(_0x3fa4('0xf'));var qs=require(_0x3fa4('0x10'));var as=require(_0x3fa4('0x11'));var hardwareService=require(_0x3fa4('0x12'));var logger=require(_0x3fa4('0x13'))(_0x3fa4('0x14'));var utils=require(_0x3fa4('0x15'));var config=require(_0x3fa4('0x16'));var licenseUtil=require(_0x3fa4('0x17'));var db=require(_0x3fa4('0x18'))['db'];function respondWithStatusCode(_0x2ba3c7,_0x53dc81){_0x53dc81=_0x53dc81||0xcc;return function(_0x3edb68){if(_0x3edb68){return _0x2ba3c7[_0x3fa4('0x19')](_0x53dc81);}return _0x2ba3c7[_0x3fa4('0x1a')](_0x53dc81)['end']();};}function respondWithResult(_0x15c7bb,_0x29c5dc){_0x29c5dc=_0x29c5dc||0xc8;return function(_0x4c36bc){if(_0x4c36bc){return _0x15c7bb[_0x3fa4('0x1a')](_0x29c5dc)[_0x3fa4('0x1b')](_0x4c36bc);}};}function respondWithFilteredResult(_0x486e27,_0x287944){return function(_0x1c54ef){if(_0x1c54ef){var _0x2a49cc=_0x1c54ef[_0x3fa4('0x1c')],_0x54cd61=_0x287944[_0x3fa4('0x1d')],_0x1dd9fe=_0x287944[_0x3fa4('0x1d')]+_0x287944['limit'],_0x4fbb74;if(_0x1dd9fe>=_0x2a49cc){_0x1dd9fe=_0x2a49cc;_0x4fbb74=0xc8;}else{_0x4fbb74=0xce;}_0x486e27['status'](_0x4fbb74);return _0x486e27[_0x3fa4('0x1e')](_0x3fa4('0x1f'),_0x54cd61+'-'+_0x1dd9fe+'/'+_0x2a49cc)[_0x3fa4('0x1b')](_0x1c54ef);}return null;};}function patchUpdates(_0x4b0567){return function(_0x5b8043){try{jsonpatch[_0x3fa4('0x20')](_0x5b8043,_0x4b0567,!![]);}catch(_0x30a342){return BPromise[_0x3fa4('0x21')](_0x30a342);}return _0x5b8043[_0x3fa4('0x22')]();};}function saveUpdates(_0x41a54e,_0x348774){return function(_0x296a58){if(_0x296a58){return _0x296a58[_0x3fa4('0x23')](_0x41a54e)[_0x3fa4('0x24')](function(_0x2578ad){return _0x2578ad;});}return null;};}function removeEntity(_0x201f5b,_0x2da594){return function(_0x47a98e){if(_0x47a98e){return _0x47a98e[_0x3fa4('0x25')]()[_0x3fa4('0x24')](function(){_0x201f5b['status'](0xcc)[_0x3fa4('0x26')]();});}};}function handleEntityNotFound(_0x336743,_0x5a5f3f){return function(_0x4f855c){if(!_0x4f855c){_0x336743['sendStatus'](0x194);}return _0x4f855c;};}function handleError(_0x5730f5,_0x73950a){_0x73950a=_0x73950a||0x1f4;return function(_0x621e0){logger[_0x3fa4('0x27')](_0x621e0[_0x3fa4('0x28')]);if(_0x621e0[_0x3fa4('0x29')]){delete _0x621e0[_0x3fa4('0x29')];}_0x5730f5[_0x3fa4('0x1a')](_0x73950a)[_0x3fa4('0x2a')](_0x621e0);};}exports[_0x3fa4('0x2b')]=function(_0x20d869,_0x1a8525){var _0x81e4a={},_0x4bf666={},_0x4b617e={'count':0x0,'rows':[]};var _0x2188e9=_[_0x3fa4('0x2c')](db['OpenchannelApplication'][_0x3fa4('0x2d')],function(_0x36b73c){return{'name':_0x36b73c[_0x3fa4('0x2e')],'type':_0x36b73c[_0x3fa4('0x2f')][_0x3fa4('0x30')]};});_0x4bf666[_0x3fa4('0x31')]=_['map'](_0x2188e9,'name');_0x4bf666['query']=_[_0x3fa4('0x32')](_0x20d869['query']);_0x4bf666[_0x3fa4('0x33')]=_[_0x3fa4('0x34')](_0x4bf666[_0x3fa4('0x31')],_0x4bf666['query']);_0x81e4a[_0x3fa4('0x35')]=_[_0x3fa4('0x34')](_0x4bf666['model'],qs[_0x3fa4('0x36')](_0x20d869[_0x3fa4('0x37')][_0x3fa4('0x36')]));_0x81e4a[_0x3fa4('0x35')]=_0x81e4a['attributes']['length']?_0x81e4a[_0x3fa4('0x35')]:_0x4bf666[_0x3fa4('0x31')];if(!_0x20d869[_0x3fa4('0x37')][_0x3fa4('0x38')](_0x3fa4('0x39'))){_0x81e4a[_0x3fa4('0x3a')]=qs[_0x3fa4('0x3a')](_0x20d869['query'][_0x3fa4('0x3a')]);_0x81e4a[_0x3fa4('0x1d')]=qs['offset'](_0x20d869[_0x3fa4('0x37')][_0x3fa4('0x1d')]);}_0x81e4a[_0x3fa4('0x3b')]=qs['sort'](_0x20d869['query'][_0x3fa4('0x3c')]);_0x81e4a[_0x3fa4('0x3d')]=qs[_0x3fa4('0x33')](_[_0x3fa4('0x3e')](_0x20d869[_0x3fa4('0x37')],_0x4bf666[_0x3fa4('0x33')]),_0x2188e9);if(_0x20d869[_0x3fa4('0x37')][_0x3fa4('0x3f')]){_0x81e4a[_0x3fa4('0x3d')]=_[_0x3fa4('0x40')](_0x81e4a['where'],{'$or':_['map'](_0x2188e9,function(_0x196df6){if(_0x196df6[_0x3fa4('0x2f')]!==_0x3fa4('0x41')){var _0x21ab39={};_0x21ab39[_0x196df6['name']]={'$like':'%'+_0x20d869['query']['filter']+'%'};return _0x21ab39;}})});}_0x81e4a=_[_0x3fa4('0x40')]({},_0x81e4a,_0x20d869['options']);var _0x3ec52d={'where':_0x81e4a['where']};return db[_0x3fa4('0x42')][_0x3fa4('0x1c')](_0x3ec52d)[_0x3fa4('0x24')](function(_0x3d342e){_0x4b617e[_0x3fa4('0x1c')]=_0x3d342e;if(_0x20d869[_0x3fa4('0x37')][_0x3fa4('0x43')]){_0x81e4a[_0x3fa4('0x44')]=[{'all':!![]}];}return db[_0x3fa4('0x42')][_0x3fa4('0x45')](_0x81e4a);})['then'](function(_0x515c03){_0x4b617e[_0x3fa4('0x46')]=_0x515c03;return _0x4b617e;})[_0x3fa4('0x24')](respondWithFilteredResult(_0x1a8525,_0x81e4a))['catch'](handleError(_0x1a8525,null));};exports[_0x3fa4('0x47')]=function(_0x500935,_0x51f9b6){var _0x4ff14f={'raw':!![],'where':{'id':_0x500935['params']['id']}},_0x1970b0={};_0x1970b0['model']=_['keys'](db[_0x3fa4('0x42')][_0x3fa4('0x2d')]);_0x1970b0['query']=_[_0x3fa4('0x32')](_0x500935['query']);_0x1970b0[_0x3fa4('0x33')]=_['intersection'](_0x1970b0['model'],_0x1970b0['query']);_0x4ff14f['attributes']=_[_0x3fa4('0x34')](_0x1970b0[_0x3fa4('0x31')],qs[_0x3fa4('0x36')](_0x500935[_0x3fa4('0x37')][_0x3fa4('0x36')]));_0x4ff14f['attributes']=_0x4ff14f[_0x3fa4('0x35')]['length']?_0x4ff14f[_0x3fa4('0x35')]:_0x1970b0['model'];if(_0x500935[_0x3fa4('0x37')][_0x3fa4('0x43')]){_0x4ff14f[_0x3fa4('0x44')]=[{'all':!![]}];}_0x4ff14f=_[_0x3fa4('0x40')]({},_0x4ff14f,_0x500935[_0x3fa4('0x48')]);return db['OpenchannelApplication'][_0x3fa4('0x49')](_0x4ff14f)['then'](handleEntityNotFound(_0x51f9b6,null))[_0x3fa4('0x24')](respondWithResult(_0x51f9b6,null))[_0x3fa4('0x4a')](handleError(_0x51f9b6,null));};exports['create']=function(_0x4aeaf2,_0x4af324){return db['OpenchannelApplication'][_0x3fa4('0x4b')](_0x4aeaf2[_0x3fa4('0x4c')],{})[_0x3fa4('0x24')](respondWithResult(_0x4af324,0xc9))['catch'](handleError(_0x4af324,null));};exports['update']=function(_0x365adb,_0x37435f){if(_0x365adb[_0x3fa4('0x4c')]['id']){delete _0x365adb[_0x3fa4('0x4c')]['id'];}return db[_0x3fa4('0x42')]['find']({'where':{'id':_0x365adb[_0x3fa4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x37435f,null))[_0x3fa4('0x24')](saveUpdates(_0x365adb[_0x3fa4('0x4c')],null))['then'](respondWithResult(_0x37435f,null))['catch'](handleError(_0x37435f,null));};exports[_0x3fa4('0x25')]=function(_0xb2261,_0xde2ab0){return db['OpenchannelApplication']['find']({'where':{'id':_0xb2261[_0x3fa4('0x4d')]['id']}})[_0x3fa4('0x24')](handleEntityNotFound(_0xde2ab0,null))[_0x3fa4('0x24')](removeEntity(_0xde2ab0,null))['catch'](handleError(_0xde2ab0,null));}; \ No newline at end of file +var _0xa595=['update','find','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','reject','save','then','destroy','error','stack','name','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','catch','show','params','length','include','create','body'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xa595,0x1f3));var _0x5a59=function(_0x585cd0,_0x301032){_0x585cd0=_0x585cd0-0x0;var _0x1f5a9f=_0xa595[_0x585cd0];return _0x1f5a9f;};'use strict';var pdf=require(_0x5a59('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5a59('0x1'));var jsonpatch=require(_0x5a59('0x2'));var rp=require(_0x5a59('0x3'));var moment=require(_0x5a59('0x4'));var BPromise=require(_0x5a59('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5a59('0x6'));var sox=require(_0x5a59('0x7'));var csv=require('to-csv');var ejs=require(_0x5a59('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5a59('0x9'));var crypto=require(_0x5a59('0xa'));var jsforce=require(_0x5a59('0xb'));var deskjs=require(_0x5a59('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5a59('0xd'));var Papa=require(_0x5a59('0xe'));var Redis=require(_0x5a59('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5a59('0x10'));var as=require(_0x5a59('0x11'));var hardwareService=require(_0x5a59('0x12'));var logger=require(_0x5a59('0x13'))(_0x5a59('0x14'));var utils=require(_0x5a59('0x15'));var config=require(_0x5a59('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a59('0x17'))['db'];function respondWithStatusCode(_0x14412f,_0x1460d0){_0x1460d0=_0x1460d0||0xcc;return function(_0x56ba3e){if(_0x56ba3e){return _0x14412f[_0x5a59('0x18')](_0x1460d0);}return _0x14412f[_0x5a59('0x19')](_0x1460d0)[_0x5a59('0x1a')]();};}function respondWithResult(_0x589e5a,_0x469bcb){_0x469bcb=_0x469bcb||0xc8;return function(_0x5cb9f6){if(_0x5cb9f6){return _0x589e5a[_0x5a59('0x19')](_0x469bcb)[_0x5a59('0x1b')](_0x5cb9f6);}};}function respondWithFilteredResult(_0x1ff2fb,_0x492efd){return function(_0x55b8a4){if(_0x55b8a4){var _0x14393d=_0x55b8a4['count'],_0xfa79e0=_0x492efd['offset'],_0x1159a1=_0x492efd['offset']+_0x492efd[_0x5a59('0x1c')],_0x570f62;if(_0x1159a1>=_0x14393d){_0x1159a1=_0x14393d;_0x570f62=0xc8;}else{_0x570f62=0xce;}_0x1ff2fb[_0x5a59('0x19')](_0x570f62);return _0x1ff2fb[_0x5a59('0x1d')]('Content-Range',_0xfa79e0+'-'+_0x1159a1+'/'+_0x14393d)['json'](_0x55b8a4);}return null;};}function patchUpdates(_0x43447a){return function(_0x15d41c){try{jsonpatch['apply'](_0x15d41c,_0x43447a,!![]);}catch(_0x1940dc){return BPromise[_0x5a59('0x1e')](_0x1940dc);}return _0x15d41c[_0x5a59('0x1f')]();};}function saveUpdates(_0x16301d,_0x1d342f){return function(_0xed3e69){if(_0xed3e69){return _0xed3e69['update'](_0x16301d)[_0x5a59('0x20')](function(_0x304b32){return _0x304b32;});}return null;};}function removeEntity(_0x443798,_0x3e7feb){return function(_0x19bc7a){if(_0x19bc7a){return _0x19bc7a[_0x5a59('0x21')]()[_0x5a59('0x20')](function(){_0x443798['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18b775,_0x29e77e){return function(_0x5a0098){if(!_0x5a0098){_0x18b775[_0x5a59('0x18')](0x194);}return _0x5a0098;};}function handleError(_0x3f49d1,_0x233a92){_0x233a92=_0x233a92||0x1f4;return function(_0x230464){logger[_0x5a59('0x22')](_0x230464[_0x5a59('0x23')]);if(_0x230464[_0x5a59('0x24')]){delete _0x230464[_0x5a59('0x24')];}_0x3f49d1['status'](_0x233a92)['send'](_0x230464);};}exports['index']=function(_0x290986,_0x3d1ee6){var _0x47e4df={},_0x54ce4a={},_0x5168ba={'count':0x0,'rows':[]};var _0x2b5415=_[_0x5a59('0x25')](db[_0x5a59('0x26')][_0x5a59('0x27')],function(_0x5a9f50){return{'name':_0x5a9f50[_0x5a59('0x28')],'type':_0x5a9f50[_0x5a59('0x29')][_0x5a59('0x2a')]};});_0x54ce4a[_0x5a59('0x2b')]=_[_0x5a59('0x25')](_0x2b5415,_0x5a59('0x24'));_0x54ce4a[_0x5a59('0x2c')]=_[_0x5a59('0x2d')](_0x290986[_0x5a59('0x2c')]);_0x54ce4a['filters']=_['intersection'](_0x54ce4a['model'],_0x54ce4a['query']);_0x47e4df['attributes']=_[_0x5a59('0x2e')](_0x54ce4a[_0x5a59('0x2b')],qs[_0x5a59('0x2f')](_0x290986[_0x5a59('0x2c')][_0x5a59('0x2f')]));_0x47e4df['attributes']=_0x47e4df['attributes']['length']?_0x47e4df[_0x5a59('0x30')]:_0x54ce4a[_0x5a59('0x2b')];if(!_0x290986[_0x5a59('0x2c')][_0x5a59('0x31')](_0x5a59('0x32'))){_0x47e4df['limit']=qs['limit'](_0x290986[_0x5a59('0x2c')][_0x5a59('0x1c')]);_0x47e4df[_0x5a59('0x33')]=qs[_0x5a59('0x33')](_0x290986[_0x5a59('0x2c')]['offset']);}_0x47e4df[_0x5a59('0x34')]=qs[_0x5a59('0x35')](_0x290986[_0x5a59('0x2c')][_0x5a59('0x35')]);_0x47e4df[_0x5a59('0x36')]=qs['filters'](_['pick'](_0x290986['query'],_0x54ce4a[_0x5a59('0x37')]),_0x2b5415);if(_0x290986[_0x5a59('0x2c')][_0x5a59('0x38')]){_0x47e4df['where']=_[_0x5a59('0x39')](_0x47e4df[_0x5a59('0x36')],{'$or':_['map'](_0x2b5415,function(_0x171137){if(_0x171137['type']!==_0x5a59('0x3a')){var _0x136d52={};_0x136d52[_0x171137['name']]={'$like':'%'+_0x290986['query'][_0x5a59('0x38')]+'%'};return _0x136d52;}})});}_0x47e4df=_[_0x5a59('0x39')]({},_0x47e4df,_0x290986[_0x5a59('0x3b')]);var _0x17926f={'where':_0x47e4df['where']};return db[_0x5a59('0x26')][_0x5a59('0x3c')](_0x17926f)[_0x5a59('0x20')](function(_0x1115d1){_0x5168ba[_0x5a59('0x3c')]=_0x1115d1;if(_0x290986[_0x5a59('0x2c')][_0x5a59('0x3d')]){_0x47e4df['include']=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x47e4df);})[_0x5a59('0x20')](function(_0x592a45){_0x5168ba['rows']=_0x592a45;return _0x5168ba;})['then'](respondWithFilteredResult(_0x3d1ee6,_0x47e4df))[_0x5a59('0x3e')](handleError(_0x3d1ee6,null));};exports[_0x5a59('0x3f')]=function(_0x398a66,_0x5231d1){var _0xf28575={'raw':!![],'where':{'id':_0x398a66[_0x5a59('0x40')]['id']}},_0x3364b1={};_0x3364b1[_0x5a59('0x2b')]=_[_0x5a59('0x2d')](db['OpenchannelApplication'][_0x5a59('0x27')]);_0x3364b1[_0x5a59('0x2c')]=_[_0x5a59('0x2d')](_0x398a66[_0x5a59('0x2c')]);_0x3364b1[_0x5a59('0x37')]=_[_0x5a59('0x2e')](_0x3364b1['model'],_0x3364b1[_0x5a59('0x2c')]);_0xf28575[_0x5a59('0x30')]=_['intersection'](_0x3364b1[_0x5a59('0x2b')],qs[_0x5a59('0x2f')](_0x398a66['query'][_0x5a59('0x2f')]));_0xf28575[_0x5a59('0x30')]=_0xf28575[_0x5a59('0x30')][_0x5a59('0x41')]?_0xf28575[_0x5a59('0x30')]:_0x3364b1[_0x5a59('0x2b')];if(_0x398a66[_0x5a59('0x2c')][_0x5a59('0x3d')]){_0xf28575[_0x5a59('0x42')]=[{'all':!![]}];}_0xf28575=_[_0x5a59('0x39')]({},_0xf28575,_0x398a66[_0x5a59('0x3b')]);return db[_0x5a59('0x26')]['find'](_0xf28575)[_0x5a59('0x20')](handleEntityNotFound(_0x5231d1,null))[_0x5a59('0x20')](respondWithResult(_0x5231d1,null))['catch'](handleError(_0x5231d1,null));};exports[_0x5a59('0x43')]=function(_0x4e7562,_0xa9b09c){return db[_0x5a59('0x26')]['create'](_0x4e7562[_0x5a59('0x44')],{})['then'](respondWithResult(_0xa9b09c,0xc9))['catch'](handleError(_0xa9b09c,null));};exports[_0x5a59('0x45')]=function(_0x267816,_0x5613ff){if(_0x267816[_0x5a59('0x44')]['id']){delete _0x267816['body']['id'];}return db['OpenchannelApplication'][_0x5a59('0x46')]({'where':{'id':_0x267816['params']['id']}})[_0x5a59('0x20')](handleEntityNotFound(_0x5613ff,null))[_0x5a59('0x20')](saveUpdates(_0x267816[_0x5a59('0x44')],null))[_0x5a59('0x20')](respondWithResult(_0x5613ff,null))[_0x5a59('0x3e')](handleError(_0x5613ff,null));};exports[_0x5a59('0x21')]=function(_0x22f2d0,_0x4edb6e){return db[_0x5a59('0x26')]['find']({'where':{'id':_0x22f2d0[_0x5a59('0x40')]['id']}})[_0x5a59('0x20')](handleEntityNotFound(_0x4edb6e,null))['then'](removeEntity(_0x4edb6e,null))[_0x5a59('0x3e')](handleError(_0x4edb6e,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 68638a8..5255b90 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 _0x97ca=['api','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2cacef,_0xba1573){var _0x289ba6=function(_0x4ac8b9){while(--_0x4ac8b9){_0x2cacef['push'](_0x2cacef['shift']());}};_0x289ba6(++_0xba1573);}(_0x97ca,0x85));var _0xa97c=function(_0x569998,_0x361b8d){_0x569998=_0x569998-0x0;var _0x2f8256=_0x97ca[_0x569998];return _0x2f8256;};'use strict';var _=require(_0xa97c('0x0'));var util=require(_0xa97c('0x1'));var logger=require('../../config/logger')(_0xa97c('0x2'));var moment=require(_0xa97c('0x3'));var BPromise=require(_0xa97c('0x4'));var rp=require(_0xa97c('0x5'));var fs=require('fs');var path=require(_0xa97c('0x6'));var rimraf=require(_0xa97c('0x7'));var config=require('../../config/environment');var attributes=require(_0xa97c('0x8'));module[_0xa97c('0x9')]=function(_0x4c454c,_0x141be3){return _0x4c454c[_0xa97c('0xa')](_0xa97c('0xb'),attributes,{'tableName':_0xa97c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa97c('0xd'),'collate':_0xa97c('0xe')});}; \ No newline at end of file +var _0x9e3d=['moment','request-promise','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x52deaf,_0x311297){var _0x53da8a=function(_0x165c95){while(--_0x165c95){_0x52deaf['push'](_0x52deaf['shift']());}};_0x53da8a(++_0x311297);}(_0x9e3d,0x1bc));var _0xd9e3=function(_0x8b9819,_0x4aa221){_0x8b9819=_0x8b9819-0x0;var _0x46d5eb=_0x9e3d[_0x8b9819];return _0x46d5eb;};'use strict';var _=require(_0xd9e3('0x0'));var util=require(_0xd9e3('0x1'));var logger=require(_0xd9e3('0x2'))(_0xd9e3('0x3'));var moment=require(_0xd9e3('0x4'));var BPromise=require('bluebird');var rp=require(_0xd9e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd9e3('0x6'));var attributes=require(_0xd9e3('0x7'));module[_0xd9e3('0x8')]=function(_0x32af3f,_0x33613b){return _0x32af3f[_0xd9e3('0x9')](_0xd9e3('0xa'),attributes,{'tableName':_0xd9e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd9e3('0xc'),'collate':_0xd9e3('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 88d5904..231eab3 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x17046f,_0x4150cd){var _0x282f23=function(_0x17f084){while(--_0x17f084){_0x17046f['push'](_0x17046f['shift']());}};_0x282f23(++_0x4150cd);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xb10b[_0x4b91c4];return _0x25cb80;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x282c41,_0x106967){var _0x5f546c=function(_0x4d845c){while(--_0x4d845c){_0x282c41['push'](_0x282c41['shift']());}};_0x5f546c(++_0x106967);}(_0xb10b,0x12a));var _0xbb10=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xb10b[_0x251e8c];return _0x1e0c1d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 0d13f73..b71f981 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 _0x878a=['openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannel','addTags','/:id'];(function(_0x7a319d,_0x235959){var _0x5c6b4e=function(_0x2e5b17){while(--_0x2e5b17){_0x7a319d['push'](_0x7a319d['shift']());}};_0x5c6b4e(++_0x235959);}(_0x878a,0xd1));var _0xa878=function(_0x5da6a2,_0x2e855e){_0x5da6a2=_0x5da6a2-0x0;var _0x3b239f=_0x878a[_0x5da6a2];return _0x3b239f;};'use strict';var multer=require(_0xa878('0x0'));var util=require(_0xa878('0x1'));var path=require(_0xa878('0x2'));var timeout=require('connect-timeout');var express=require(_0xa878('0x3'));var router=express['Router']();var auth=require(_0xa878('0x4'));var interaction=require(_0xa878('0x5'));var config=require(_0xa878('0x6'));var controller=require(_0xa878('0x7'));router[_0xa878('0x8')]('/',auth['isAuthenticated'](),controller[_0xa878('0x9')]);router[_0xa878('0x8')](_0xa878('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xa878('0x8')]('/:id',auth[_0xa878('0xb')](),controller['show']);router[_0xa878('0x8')](_0xa878('0xc'),auth[_0xa878('0xb')](),controller[_0xa878('0xd')]);router[_0xa878('0x8')](_0xa878('0xe'),auth[_0xa878('0xb')](),controller['download']);router[_0xa878('0xf')]('/',auth[_0xa878('0xb')](),controller[_0xa878('0x10')]);router[_0xa878('0xf')](_0xa878('0xc'),auth['isAuthenticated'](),controller[_0xa878('0x11')]);router[_0xa878('0xf')](_0xa878('0x12'),auth[_0xa878('0xb')](),interaction[_0xa878('0x13')](_0xa878('0x14'),'openchannelinteraction:addtags'),controller[_0xa878('0x15')]);router['put'](_0xa878('0x16'),auth[_0xa878('0xb')](),interaction[_0xa878('0x13')](_0xa878('0x14'),_0xa878('0x17')),controller[_0xa878('0x18')]);router[_0xa878('0x19')]('/:id',auth[_0xa878('0xb')](),interaction[_0xa878('0x13')]('openchannel','openchannelinteraction:destroy'),controller[_0xa878('0x1a')]);router['delete'](_0xa878('0x12'),auth[_0xa878('0xb')](),controller[_0xa878('0x1b')]);module[_0xa878('0x1c')]=router; \ No newline at end of file +var _0xa0af=['show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa0af,0x13d));var _0xfa0a=function(_0x33b0b3,_0x7f6db9){_0x33b0b3=_0x33b0b3-0x0;var _0x2a25f2=_0xa0af[_0x33b0b3];return _0x2a25f2;};'use strict';var multer=require(_0xfa0a('0x0'));var util=require('util');var path=require(_0xfa0a('0x1'));var timeout=require(_0xfa0a('0x2'));var express=require(_0xfa0a('0x3'));var router=express[_0xfa0a('0x4')]();var auth=require(_0xfa0a('0x5'));var interaction=require(_0xfa0a('0x6'));var config=require(_0xfa0a('0x7'));var controller=require('./openchannelInteraction.controller');router[_0xfa0a('0x8')]('/',auth[_0xfa0a('0x9')](),controller[_0xfa0a('0xa')]);router['get']('/describe',auth[_0xfa0a('0x9')](),controller[_0xfa0a('0xb')]);router[_0xfa0a('0x8')](_0xfa0a('0xc'),auth[_0xfa0a('0x9')](),controller[_0xfa0a('0xd')]);router[_0xfa0a('0x8')](_0xfa0a('0xe'),auth[_0xfa0a('0x9')](),controller[_0xfa0a('0xf')]);router[_0xfa0a('0x8')](_0xfa0a('0x10'),auth['isAuthenticated'](),controller[_0xfa0a('0x11')]);router[_0xfa0a('0x12')]('/',auth[_0xfa0a('0x9')](),controller[_0xfa0a('0x13')]);router[_0xfa0a('0x12')](_0xfa0a('0xe'),auth[_0xfa0a('0x9')](),controller[_0xfa0a('0x14')]);router[_0xfa0a('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xfa0a('0x15'),_0xfa0a('0x16')),controller[_0xfa0a('0x17')]);router[_0xfa0a('0x18')](_0xfa0a('0xc'),auth['isAuthenticated'](),interaction[_0xfa0a('0x19')]('openchannel',_0xfa0a('0x1a')),controller[_0xfa0a('0x1b')]);router[_0xfa0a('0x1c')](_0xfa0a('0xc'),auth[_0xfa0a('0x9')](),interaction[_0xfa0a('0x19')](_0xfa0a('0x15'),'openchannelinteraction:destroy'),controller[_0xfa0a('0x1d')]);router[_0xfa0a('0x1c')](_0xfa0a('0x1e'),auth[_0xfa0a('0x9')](),controller[_0xfa0a('0x1f')]);module[_0xfa0a('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 214a80f..7ffe494 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 _0xd87b=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x203db3,_0x512d2e){var _0x3136a0=function(_0x4d80ef){while(--_0x4d80ef){_0x203db3['push'](_0x203db3['shift']());}};_0x3136a0(++_0x512d2e);}(_0xd87b,0xa4));var _0xbd87=function(_0x308d56,_0x35a44d){_0x308d56=_0x308d56-0x0;var _0x25e1d7=_0xd87b[_0x308d56];return _0x25e1d7;};'use strict';var Sequelize=require('sequelize');module[_0xbd87('0x0')]={'closed':{'type':Sequelize[_0xbd87('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbd87('0x2')]},'disposition':{'type':Sequelize[_0xbd87('0x3')]},'secondDisposition':{'type':Sequelize[_0xbd87('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbd87('0x3')]},'note':{'type':Sequelize[_0xbd87('0x3')]},'read1stAt':{'type':Sequelize[_0xbd87('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xbd87('0x3')]},'lastMsgAt':{'type':Sequelize[_0xbd87('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xbd87('0x4')]('in',_0xbd87('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xbd87('0x3')]}}; \ No newline at end of file +var _0x62ee=['STRING','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x55db31,_0x331a96){var _0x2f1cf4=function(_0x170373){while(--_0x170373){_0x55db31['push'](_0x55db31['shift']());}};_0x2f1cf4(++_0x331a96);}(_0x62ee,0x13a));var _0xe62e=function(_0x57a670,_0x30e402){_0x57a670=_0x57a670-0x0;var _0x41ce21=_0x62ee[_0x57a670];return _0x41ce21;};'use strict';var Sequelize=require(_0xe62e('0x0'));module[_0xe62e('0x1')]={'closed':{'type':Sequelize[_0xe62e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe62e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe62e('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe62e('0x4')]},'note':{'type':Sequelize[_0xe62e('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xe62e('0x4')]},'lastMsgAt':{'type':Sequelize[_0xe62e('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe62e('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe62e('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 9eee8c2..af4ff8b 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 _0x749c=['create','destroy','describe','addMessage','ids','getMessages','OpenchannelMessage','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','secret','Account','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','Openchannel','YYYY-MM-DD','Owner','N.A.','closedAt','disposition','existsSync','pipe','createWriteStream','basename','System','direction','out','renderFile','views','downloadInteraction.html','toFile','transcript-','log','unlinkSync','html-pdf','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','status','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','from','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','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?','find','ContactId','buildExpression','text','start','Tag','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','catch','show','params','includeAll','include'];(function(_0x243107,_0x250b4d){var _0x2f3dba=function(_0x42f871){while(--_0x42f871){_0x243107['push'](_0x243107['shift']());}};_0x2f3dba(++_0x250b4d);}(_0x749c,0x134));var _0xc749=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x749c[_0x45fc6a];return _0x14bcfd;};'use strict';var pdf=require(_0xc749('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc749('0x1'));var moment=require(_0xc749('0x2'));var BPromise=require(_0xc749('0x3'));var Mustache=require(_0xc749('0x4'));var util=require(_0xc749('0x5'));var path=require('path');var sox=require(_0xc749('0x6'));var csv=require('to-csv');var ejs=require(_0xc749('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc749('0x8'));var crypto=require('crypto');var jsforce=require(_0xc749('0x9'));var deskjs=require(_0xc749('0xa'));var toCsv=require(_0xc749('0xb'));var querystring=require(_0xc749('0xc'));var Papa=require(_0xc749('0xd'));var Redis=require(_0xc749('0xe'));var authService=require(_0xc749('0xf'));var qs=require(_0xc749('0x10'));var as=require(_0xc749('0x11'));var hardwareService=require(_0xc749('0x12'));var logger=require(_0xc749('0x13'))(_0xc749('0x14'));var utils=require(_0xc749('0x15'));var config=require(_0xc749('0x16'));var licenseUtil=require(_0xc749('0x17'));var db=require(_0xc749('0x18'))['db'];config[_0xc749('0x19')]=_[_0xc749('0x1a')](config[_0xc749('0x19')],{'host':_0xc749('0x1b'),'port':0x18eb});var socket=require(_0xc749('0x1c'))(new Redis(config[_0xc749('0x19')]));require(_0xc749('0x1d'))['register'](socket);function respondWithStatusCode(_0x52a17d,_0x7383a6){_0x7383a6=_0x7383a6||0xcc;return function(_0x322af3){if(_0x322af3){return _0x52a17d[_0xc749('0x1e')](_0x7383a6);}return _0x52a17d['status'](_0x7383a6)[_0xc749('0x1f')]();};}function respondWithResult(_0x14c577,_0x2b9a63){_0x2b9a63=_0x2b9a63||0xc8;return function(_0x20fbde){if(_0x20fbde){return _0x14c577['status'](_0x2b9a63)[_0xc749('0x20')](_0x20fbde);}};}function respondWithFilteredResult(_0x1fa960,_0x5d6588){return function(_0x2901eb){if(_0x2901eb){var _0x1fc304=_0x2901eb[_0xc749('0x21')],_0x236a31=_0x5d6588[_0xc749('0x22')],_0x1bc904=_0x5d6588[_0xc749('0x22')]+_0x5d6588[_0xc749('0x23')],_0x1a9cab;if(_0x1bc904>=_0x1fc304){_0x1bc904=_0x1fc304;_0x1a9cab=0xc8;}else{_0x1a9cab=0xce;}_0x1fa960['status'](_0x1a9cab);return _0x1fa960['set'](_0xc749('0x24'),_0x236a31+'-'+_0x1bc904+'/'+_0x1fc304)[_0xc749('0x20')](_0x2901eb);}return null;};}function patchUpdates(_0x573dd4){return function(_0x39ad96){try{jsonpatch[_0xc749('0x25')](_0x39ad96,_0x573dd4,!![]);}catch(_0x594201){return BPromise[_0xc749('0x26')](_0x594201);}return _0x39ad96[_0xc749('0x27')]();};}function saveUpdates(_0x3c9c48,_0x58a282){return function(_0x120194){if(_0x120194){return _0x120194[_0xc749('0x28')](_0x3c9c48)['then'](function(_0x1fa313){return _0x1fa313;});}return null;};}function removeEntity(_0x409e1a,_0x2fbf0e){return function(_0x380733){if(_0x380733){return _0x380733['destroy']()[_0xc749('0x29')](function(){_0x409e1a[_0xc749('0x2a')](0xcc)[_0xc749('0x1f')]();});}};}function handleEntityNotFound(_0x2c2f37,_0x1f8bc6){return function(_0x3b6f0e){if(!_0x3b6f0e){_0x2c2f37[_0xc749('0x1e')](0x194);}return _0x3b6f0e;};}function handleError(_0x123902,_0x311c78){_0x311c78=_0x311c78||0x1f4;return function(_0x3c4552){logger[_0xc749('0x2b')](_0x3c4552[_0xc749('0x2c')]);if(_0x3c4552['name']){delete _0x3c4552[_0xc749('0x2d')];}_0x123902[_0xc749('0x2a')](_0x311c78)[_0xc749('0x2e')](_0x3c4552);};}function getInteractionUsers(_0x32a5c5,_0x5f4203){return new BPromise(function(_0x20b77b,_0x4d0495){try{if(_0x5f4203[_0x32a5c5['id']]){_0x32a5c5[_0xc749('0x2f')]=_[_0xc749('0x30')](_0x5f4203[_0x32a5c5['id']],function(_0x3d38a8){return{'id':_0x3d38a8['id'],'fullname':_0x3d38a8[_0xc749('0x31')]};});}}catch(_0x8fe03a){_0x4d0495(_0x8fe03a);}_0x20b77b(_0x32a5c5);});}function getInteractionTags(_0x355b8f,_0x2451d8){return new BPromise(function(_0x3e026c,_0x52ca90){try{if(_0x355b8f[_0xc749('0x32')]){_0x355b8f[_0xc749('0x33')]=[];_0x355b8f[_0xc749('0x32')][_0xc749('0x34')](',')[_0xc749('0x35')](function(_0x58b2d6){_0x355b8f[_0xc749('0x33')]['push'](_0x2451d8[_0x58b2d6]);});}delete _0x355b8f[_0xc749('0x32')];}catch(_0x26598c){_0x52ca90(_0x26598c);}_0x3e026c(_0x355b8f);});}function updateOpenchannelInteraction(_0x19dd7b,_0x29d8c1,_0x361d5c){return new BPromise(function(_0x4b9084,_0x2f3ccb){return getInteractionUsers(_0x19dd7b,_0x361d5c)['then'](function(_0x1d392e){return getInteractionTags(_0x1d392e,_0x29d8c1);})[_0xc749('0x29')](function(_0x2256f5){_0x4b9084(_0x2256f5);})['catch'](function(_0x5cf9cb){_0x2f3ccb(_0x5cf9cb);});});}exports[_0xc749('0x36')]=function(_0x3739d9,_0x4fc3c0){var _0x3ab24c={},_0x36fe39={},_0x26f932={'count':0x0,'rows':[]};var _0x515db4=_[_0xc749('0x30')](db[_0xc749('0x37')][_0xc749('0x38')],function(_0x3be381){return{'name':_0x3be381[_0xc749('0x39')],'type':_0x3be381[_0xc749('0x3a')][_0xc749('0x3b')]};});_0x36fe39[_0xc749('0x3c')]=_[_0xc749('0x30')](_0x515db4,'name');_0x36fe39[_0xc749('0x3d')]=_[_0xc749('0x3e')](_0x3739d9[_0xc749('0x3d')]);_0x36fe39['filters']=_[_0xc749('0x3f')](_0x36fe39[_0xc749('0x3c')],_0x36fe39['query']);_0x3ab24c[_0xc749('0x40')]=_[_0xc749('0x3f')](_0x36fe39[_0xc749('0x3c')],qs['fields'](_0x3739d9[_0xc749('0x3d')][_0xc749('0x41')]));_0x3ab24c['attributes']=_0x3ab24c['attributes'][_0xc749('0x42')]?_0x3ab24c[_0xc749('0x40')]:_0x36fe39['model'];if(!_0x3739d9[_0xc749('0x3d')][_0xc749('0x43')](_0xc749('0x44'))){_0x3ab24c[_0xc749('0x23')]=qs[_0xc749('0x23')](_0x3739d9['query'][_0xc749('0x23')]);_0x3ab24c[_0xc749('0x22')]=qs[_0xc749('0x22')](_0x3739d9[_0xc749('0x3d')]['offset']);}_0x3ab24c[_0xc749('0x45')]=qs[_0xc749('0x46')](_0x3739d9['query'][_0xc749('0x46')]);_0x3ab24c[_0xc749('0x47')]=qs[_0xc749('0x48')](_[_0xc749('0x49')](_0x3739d9[_0xc749('0x3d')],_0x36fe39[_0xc749('0x48')]),_0x515db4);var _0x2113c8=[];var _0x4b1ac1=squel[_0xc749('0x4a')]()[_0xc749('0x4b')]('id')['field'](_0xc749('0x2d'))['field'](_0xc749('0x4c'))['from'](_0xc749('0x4d'));var _0x255d8b=squel['select']()['field'](_0xc749('0x4e'))[_0xc749('0x4b')](_0xc749('0x4f'))['field'](_0xc749('0x50'))['from'](_0xc749('0x51'),'ui')['left_join'](_0xc749('0x52'),'u',_0xc749('0x53'));var _0x441ae4=squel[_0xc749('0x4a')]()[_0xc749('0x54')](_0xc749('0x55'),'i')['left_join'](_0xc749('0x56'),'c',_0xc749('0x57'))[_0xc749('0x58')]('users','o','o.id\x20=\x20i.UserId')['left_join']('openchannel_accounts','a',_0xc749('0x59'))[_0xc749('0x58')](_0xc749('0x5a'),'me',_0xc749('0x5b'))[_0xc749('0x58')](_0xc749('0x5c'),'it',_0xc749('0x5d'))[_0xc749('0x58')](_0xc749('0x4d'),'t','t.id\x20=\x20it.TagId');var _0x233c9a=squel[_0xc749('0x5e')]();var _0x2901d3=[];var _0x5026db=squel[_0xc749('0x5e')]();var _0x2eee16;if(_0x3739d9['query'][_0xc749('0x5f')]){_0x2eee16=as[_0xc749('0x60')](_0x3739d9[_0xc749('0x3d')]['search']);var _0x1a3b5c=_0x2eee16[_0xc749('0x61')];for(var _0x547d5b=0x0;_0x547d5b<_0x2eee16['conditions'][_0xc749('0x42')];_0x547d5b++){var _0x2238e0=_0x2eee16['conditions'][_0x547d5b];var _0x44ace5='i';var _0x4cbd50=_['find'](_0x515db4,[_0xc749('0x2d'),_0x2238e0[_0xc749('0x4b')]]);if(!_0x4cbd50){switch(_0x2238e0[_0xc749('0x4b')]){case _0xc749('0x62'):if(_0x2238e0[_0xc749('0x63')]==0x1){_0x441ae4[_0xc749('0x64')]('`'+_0x2238e0[_0xc749('0x4b')]+_0xc749('0x65'));}else{_0x441ae4[_0xc749('0x64')]('`'+_0x2238e0[_0xc749('0x4b')]+_0xc749('0x66'));}break;case _0xc749('0x67'):if(_0x2238e0[_0xc749('0x68')]==='$substring'){if(_0x2238e0[_0xc749('0x63')][_0xc749('0x34')]('\x20')[_0xc749('0x42')]>0x1){_0x233c9a[_0x1a3b5c](_0xc749('0x69'),qs[_0xc749('0x6a')](_0x2238e0[_0xc749('0x63')]),null);}else{var _0x1dfb7c='%'+_0x2238e0[_0xc749('0x63')]+'%';_0x233c9a[_0x1a3b5c](_0xc749('0x6b'),_0x1dfb7c,_0x1dfb7c,_0x1dfb7c);}}else{_0x4cbd50=_[_0xc749('0x6c')](_0x515db4,[_0xc749('0x2d'),_0xc749('0x6d')]);_0x2238e0[_0xc749('0x4b')]=_0xc749('0x6d');_0x46edf5=as[_0xc749('0x6e')](_0x44ace5,_0x4cbd50[_0xc749('0x3a')],_0x2238e0);_0x233c9a[_0x1a3b5c](_0x46edf5[_0xc749('0x6f')],_0x46edf5[_0xc749('0x63')][_0xc749('0x70')],_0x46edf5[_0xc749('0x63')][_0xc749('0x1f')]);}break;case _0xc749('0x71'):var _0x1835b6=_0x2238e0[_0xc749('0x63')][_0xc749('0x34')](',')['map'](function(_0x47d76c){return Number(_0x47d76c);});_0x1835b6['forEach'](function(_0x18ac27){_0x5026db['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x18ac27+',%');});_0x2901d3=_['union'](_0x2901d3,_0x1835b6);break;case _0xc749('0x72'):if(_0x2238e0[_0xc749('0x68')]===_0xc749('0x73')){_0x233c9a[_0x1a3b5c](_0xc749('0x74'),'%'+_0x2238e0[_0xc749('0x63')]+'%',null);}else{_0x4cbd50=_[_0xc749('0x6c')](_0x515db4,[_0xc749('0x2d'),_0xc749('0x75')]);_0x2238e0[_0xc749('0x4b')]='UserId';_0x46edf5=as['buildExpression'](_0x44ace5,_0x4cbd50[_0xc749('0x3a')],_0x2238e0);_0x233c9a[_0x1a3b5c](_0x46edf5[_0xc749('0x6f')],_0x46edf5[_0xc749('0x63')]['start'],_0x46edf5[_0xc749('0x63')][_0xc749('0x1f')]);}break;case _0xc749('0x76'):_0x46edf5=as['buildExpression']('me',null,_0x2238e0);_0x233c9a[_0x1a3b5c](_0x46edf5[_0xc749('0x6f')],_0x46edf5[_0xc749('0x63')][_0xc749('0x70')],_0x46edf5[_0xc749('0x63')][_0xc749('0x1f')]);break;}}else{var _0x46edf5=as[_0xc749('0x6e')](_0x44ace5,_0x4cbd50[_0xc749('0x3a')],_0x2238e0);_0x233c9a[_0x1a3b5c](_0x46edf5[_0xc749('0x6f')],_0x46edf5['value'][_0xc749('0x70')],_0x46edf5[_0xc749('0x63')][_0xc749('0x1f')]);}}}else{var _0x8f0004=_(_0x3739d9[_0xc749('0x3d')])['keys']()[_0xc749('0x30')](function(_0xdbbe14){return _['some'](_0x515db4,[_0xc749('0x2d'),_0xdbbe14])?_0xdbbe14:undefined;})['compact']()['value']();if(!_[_0xc749('0x77')](_0x8f0004)){_0x8f0004[_0xc749('0x35')](function(_0x2f9a5f){if(_0x2f9a5f===_0xc749('0x78')){_0x441ae4[_0xc749('0x47')](_0xc749('0x79'),[]['concat'](_0x3739d9[_0xc749('0x3d')][_0x2f9a5f]));}else if(_0x2f9a5f===_0xc749('0x7a')){var _0x39f1d7=JSON[_0xc749('0x7b')](_0x3739d9[_0xc749('0x3d')][_0x2f9a5f])[_0xc749('0x7c')];var _0x2518d7=JSON[_0xc749('0x7b')](_0x3739d9[_0xc749('0x3d')][_0x2f9a5f])[_0xc749('0x7d')];_0x441ae4[_0xc749('0x47')](_0xc749('0x7e'),_0x39f1d7,_0x2518d7);}else{if(_0x3739d9[_0xc749('0x3d')][_0x2f9a5f]===_0xc749('0x7f')){_0x441ae4[_0xc749('0x47')]('i.'+_0x2f9a5f+'\x20IS\x20NULL');}else{_0x441ae4[_0xc749('0x47')]('i.'+_0x2f9a5f+_0xc749('0x80'),_0x3739d9[_0xc749('0x3d')][_0x2f9a5f]);}}});}if(_0x3739d9[_0xc749('0x3d')][_0xc749('0x81')]){if(_0x3739d9[_0xc749('0x3d')][_0xc749('0x81')]==0x1){_0x441ae4['having'](_0xc749('0x82'));}else{_0x441ae4[_0xc749('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x3739d9[_0xc749('0x3d')][_0xc749('0x83')]){_0x2901d3=_[_0xc749('0x84')](_0x3739d9['query'][_0xc749('0x83')])?_0x3739d9[_0xc749('0x3d')]['tag']:new Array(_0x3739d9[_0xc749('0x3d')][_0xc749('0x83')]);_0x2901d3['forEach'](function(_0x8d80ad){_0x5026db['or'](_0xc749('0x85'),'%,'+_0x8d80ad+',%');});}if(_0x3739d9[_0xc749('0x3d')][_0xc749('0x86')]){var _0x2fc336=_0x3739d9[_0xc749('0x3d')][_0xc749('0x86')][_0xc749('0x87')]('\x5c','\x5c\x5c')[_0xc749('0x87')](/'/g,'\x27\x27');if(qs[_0xc749('0x88')](_0x2fc336)){_0x233c9a['or']('i.id\x20LIKE\x20?',_0x2fc336+'%');}else{_0x233c9a['or'](_0xc749('0x89'),qs[_0xc749('0x6a')](_0x2fc336))['or'](_0xc749('0x8a'),_0x2fc336+'%')['or'](_0xc749('0x8b'),_0x2fc336+'%');}}}_0x441ae4[_0xc749('0x47')](_0x233c9a);_0x441ae4[_0xc749('0x8c')]('i.id');var _0x9438a1={'type':db['Sequelize'][_0xc749('0x8d')]['SELECT'],'raw':!![]};var _0x19cda1=_0x441ae4[_0xc749('0x8e')]();_0x19cda1['field'](_0xc749('0x8f'));_0x19cda1[_0xc749('0x4b')](_0xc749('0x90'),_0xc749('0x62'));if(_0x3ab24c['order']){_0x3ab24c[_0xc749('0x45')][_0xc749('0x35')](function(_0x20fbfa){var _0x4466cb=_0x20fbfa[0x0]==='contactName'?_0x20fbfa[0x0]:'i.'+_0x20fbfa[0x0];_0x441ae4[_0xc749('0x45')](_0x4466cb,_0x20fbfa[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc749('0x77')](_0x2901d3)){_0x441ae4[_0xc749('0x64')](_0x5026db);_0x19cda1['where'](_0xc749('0x91'),_0x2901d3);}BPromise[_0xc749('0x92')]()[_0xc749('0x29')](function(){if(!_0x2eee16){if(_0x3739d9[_0xc749('0x3d')][_0xc749('0x78')])return;_0x19cda1[_0xc749('0x47')](_0xc749('0x93'));_0x441ae4[_0xc749('0x47')](_0xc749('0x93'));return;}if(_0x3739d9[_0xc749('0x94')]['role']!==_0xc749('0x95'))return;return _0x3739d9[_0xc749('0x94')][_0xc749('0x96')]({'attributes':['id'],'raw':!![]})[_0xc749('0x29')](function(_0x569591){if(_[_0xc749('0x77')](_0x569591)){_0x19cda1['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x441ae4['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x19cda1[_0xc749('0x47')](_0xc749('0x79'),_['map'](_0x569591,'id'));_0x441ae4['where'](_0xc749('0x79'),_['map'](_0x569591,'id'));}});})['then'](function(){if(_0x3739d9['user']['role']==='agent'&&!_0x2eee16&&!_0x3739d9[_0xc749('0x3d')][_0xc749('0x78')])return[];return db['sequelize'][_0xc749('0x3d')](_0x19cda1[_0xc749('0x97')](),_0x9438a1);})[_0xc749('0x29')](function(_0x1d59f1){_0x26f932['count']=_0x1d59f1[_0xc749('0x42')];if(_0x26f932[_0xc749('0x21')]===0x0)return[];return db['sequelize'][_0xc749('0x3d')](_0x4b1ac1[_0xc749('0x97')](),_0x9438a1)[_0xc749('0x29')](function(_0x16fc83){_0x2113c8=_[_0xc749('0x98')](_0x16fc83,'id');_0x9438a1=_[_0xc749('0x99')](_0x9438a1,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3739d9['query'][_0xc749('0x41')]){_0x3ab24c[_0xc749('0x40')][_0xc749('0x35')](function(_0x3c32c6){_0x441ae4[_0xc749('0x4b')]('i.'+_0x3c32c6);});}else{_0x441ae4[_0xc749('0x4b')](_0xc749('0x90'),_0xc749('0x62'));_0x441ae4[_0xc749('0x4b')](_0xc749('0x9a'),_0xc749('0x9b'));_0x441ae4[_0xc749('0x4b')](_0xc749('0x9c'),_0xc749('0x9d'));_0x441ae4['field']('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xc749('0x9e'));_0x441ae4['field']('i.*');_0x441ae4[_0xc749('0x4b')](_0xc749('0x9f'),_0xc749('0xa0'));_0x441ae4[_0xc749('0x4b')](_0xc749('0xa1'),_0xc749('0xa2'));_0x441ae4[_0xc749('0x4b')](_0xc749('0xa3'),_0xc749('0xa4'));_0x441ae4['field'](_0xc749('0xa5'),_0xc749('0xa6'));_0x441ae4[_0xc749('0x4b')](_0xc749('0xa7'),_0xc749('0xa8'));_0x441ae4['field'](_0xc749('0xa9'),_0xc749('0xaa'));_0x441ae4[_0xc749('0x4b')]('o.fullname',_0xc749('0xab'));_0x441ae4[_0xc749('0x4b')]('o.internal',_0xc749('0xac'));_0x441ae4['field'](_0xc749('0xad'),_0xc749('0x32'));}if(_0x3ab24c[_0xc749('0x23')])_0x441ae4[_0xc749('0x23')](_0x3ab24c[_0xc749('0x23')]);if(_0x3ab24c['offset'])_0x441ae4[_0xc749('0x22')](_0x3ab24c[_0xc749('0x22')]);return db['sequelize'][_0xc749('0x3d')](_0x441ae4['toString'](),_0x9438a1);})[_0xc749('0x29')](function(_0x4929e3){_0x255d8b[_0xc749('0x47')](_0xc749('0xae'),_[_0xc749('0x30')](_0x4929e3,'id'));return db['sequelize']['query'](_0x255d8b[_0xc749('0x97')](),_0x9438a1)[_0xc749('0x29')](function(_0x437bbc){var _0xbf17f1=_[_0xc749('0xaf')](_0x437bbc,_0xc749('0xb0'));var _0x5ceca5=[];_0x4929e3[_0xc749('0x35')](function(_0x5cfe6c){_0x5ceca5[_0xc749('0xb1')](updateOpenchannelInteraction(_0x5cfe6c,_0x2113c8,_0xbf17f1));});return BPromise[_0xc749('0xb2')](_0x5ceca5);});});})[_0xc749('0x29')](function(_0x448aa5){_0x26f932['rows']=_0x448aa5;return _0x26f932;})['then'](respondWithFilteredResult(_0x4fc3c0,_0x3ab24c))[_0xc749('0xb3')](handleError(_0x4fc3c0,null));};exports[_0xc749('0xb4')]=function(_0x448ad0,_0x3084bc){var _0x48674e={};if(_0x448ad0[_0xc749('0x3d')][_0xc749('0x3a')]&&_0x448ad0[_0xc749('0x3d')][_0xc749('0x3a')]===_0xc749('0x54')){_0x48674e['from']=_0x448ad0[_0xc749('0xb5')]['id'];}else{_0x48674e['id']=_0x448ad0[_0xc749('0xb5')]['id'];}var _0x9e4790={'raw':![],'where':_0x48674e},_0x4e0798={};_0x4e0798[_0xc749('0x3c')]=_[_0xc749('0x3e')](db[_0xc749('0x37')][_0xc749('0x38')]);_0x4e0798['query']=_[_0xc749('0x3e')](_0x448ad0['query']);_0x4e0798['filters']=_[_0xc749('0x3f')](_0x4e0798[_0xc749('0x3c')],_0x4e0798[_0xc749('0x3d')]);_0x9e4790[_0xc749('0x40')]=_[_0xc749('0x3f')](_0x4e0798[_0xc749('0x3c')],qs['fields'](_0x448ad0[_0xc749('0x3d')][_0xc749('0x41')]));_0x9e4790[_0xc749('0x40')]=_0x9e4790[_0xc749('0x40')][_0xc749('0x42')]?_0x9e4790[_0xc749('0x40')]:_0x4e0798[_0xc749('0x3c')];if(_0x448ad0[_0xc749('0x3d')][_0xc749('0xb6')]){_0x9e4790[_0xc749('0xb7')]=[{'all':!![]}];}_0x9e4790=_[_0xc749('0x99')]({},_0x9e4790,_0x448ad0['options']);return db[_0xc749('0x37')][_0xc749('0x6c')](_0x9e4790)[_0xc749('0x29')](handleEntityNotFound(_0x3084bc,null))[_0xc749('0x29')](respondWithResult(_0x3084bc,null))['catch'](handleError(_0x3084bc,null));};exports[_0xc749('0xb8')]=function(_0x57f9f6,_0x642fc6){return db['OpenchannelInteraction'][_0xc749('0xb8')](_0x57f9f6[_0xc749('0x76')],{})[_0xc749('0x29')](respondWithResult(_0x642fc6,0xc9))['catch'](handleError(_0x642fc6,null));};exports['update']=function(_0x18d994,_0x290851){if(_0x18d994[_0xc749('0x76')]['id']){delete _0x18d994[_0xc749('0x76')]['id'];}return db[_0xc749('0x37')][_0xc749('0x6c')]({'where':{'id':_0x18d994[_0xc749('0xb5')]['id']}})[_0xc749('0x29')](handleEntityNotFound(_0x290851,null))[_0xc749('0x29')](saveUpdates(_0x18d994[_0xc749('0x76')],null))[_0xc749('0x29')](respondWithResult(_0x290851,null))['catch'](handleError(_0x290851,null));};exports[_0xc749('0xb9')]=function(_0xcebe0b,_0x31a6c2){return db[_0xc749('0x37')][_0xc749('0x6c')]({'where':{'id':_0xcebe0b[_0xc749('0xb5')]['id']}})[_0xc749('0x29')](handleEntityNotFound(_0x31a6c2,null))[_0xc749('0x29')](removeEntity(_0x31a6c2,null))[_0xc749('0xb3')](handleError(_0x31a6c2,null));};exports[_0xc749('0xba')]=function(_0x107769,_0x5cfd87){return db[_0xc749('0x37')][_0xc749('0xba')]()[_0xc749('0x29')](respondWithResult(_0x5cfd87,null))[_0xc749('0xb3')](handleError(_0x5cfd87,null));};exports[_0xc749('0xbb')]=function(_0x16afa3,_0x505cf8,_0x13dbc9){return db['OpenchannelMessage'][_0xc749('0x6c')]({'where':{'id':_0x16afa3[_0xc749('0xb5')]['id']}})[_0xc749('0x29')](handleEntityNotFound(_0x505cf8,null))[_0xc749('0x29')](function(_0x227fb4){if(_0x227fb4){return _0x227fb4[_0xc749('0xbb')](_0x16afa3['body']['ids'],_['omit'](_0x16afa3['body'],[_0xc749('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x505cf8,null))[_0xc749('0xb3')](handleError(_0x505cf8,null));};exports[_0xc749('0xbd')]=function(_0x42251d,_0x5e4ef3,_0x5a8e82){var _0x1fa6ca={'raw':![],'where':{}};var _0x1d02ca={};var _0x38d6b3={'count':0x0,'rows':[]};return db[_0xc749('0x37')]['findOne']({'where':{'id':_0x42251d[_0xc749('0xb5')]['id']}})[_0xc749('0x29')](handleEntityNotFound(_0x5e4ef3,null))[_0xc749('0x29')](function(_0x213b34){if(_0x213b34){_0x1d02ca[_0xc749('0x3c')]=_[_0xc749('0x3e')](db[_0xc749('0xbe')][_0xc749('0x38')]);_0x1d02ca[_0xc749('0x3d')]=_['keys'](_0x42251d[_0xc749('0x3d')]);_0x1d02ca['filters']=_[_0xc749('0x3f')](_0x1d02ca[_0xc749('0x3c')],_0x1d02ca[_0xc749('0x3d')]);_0x1fa6ca['attributes']=_[_0xc749('0x3f')](_0x1d02ca[_0xc749('0x3c')],qs[_0xc749('0x41')](_0x42251d['query'][_0xc749('0x41')]));_0x1fa6ca[_0xc749('0x40')]=_0x1fa6ca['attributes'][_0xc749('0x42')]?_0x1fa6ca[_0xc749('0x40')]:_0x1d02ca[_0xc749('0x3c')];if(!_0x42251d[_0xc749('0x3d')][_0xc749('0x43')](_0xc749('0x44'))){_0x1fa6ca[_0xc749('0x23')]=qs[_0xc749('0x23')](_0x42251d[_0xc749('0x3d')][_0xc749('0x23')]);_0x1fa6ca[_0xc749('0x22')]=qs[_0xc749('0x22')](_0x42251d[_0xc749('0x3d')][_0xc749('0x22')]);}_0x1fa6ca[_0xc749('0x45')]=qs[_0xc749('0x46')](_0x42251d[_0xc749('0x3d')]['sort']);_0x1fa6ca[_0xc749('0x47')]=qs[_0xc749('0x48')](_['pick'](_0x42251d['query'],_0x1d02ca[_0xc749('0x48')]));_0x1fa6ca[_0xc749('0x47')][_0xc749('0xb0')]=_0x213b34['id'];if(_0x42251d[_0xc749('0x3d')][_0xc749('0x86')]){_0x1fa6ca[_0xc749('0x47')]=_[_0xc749('0x99')](_0x1fa6ca['where'],{'$or':_['map'](_0x1fa6ca[_0xc749('0x40')],function(_0x51cece){var _0x4e1e2f={};_0x4e1e2f[_0x51cece]={'$like':'%'+_0x42251d[_0xc749('0x3d')][_0xc749('0x86')]+'%'};return _0x4e1e2f;})});}if(_0x42251d[_0xc749('0x3d')][_0xc749('0x7c')]){var _0x3764bd=_0x42251d[_0xc749('0x3d')][_0xc749('0x7c')][_0xc749('0x34')](',');var _0x40db73={};_0x40db73[_0x3764bd[0x0]]={'$gte':moment(_0x3764bd[0x1])[_0xc749('0xbf')](_0xc749('0xc0'))};_0x1fa6ca[_0xc749('0x47')]=_['merge'](_0x1fa6ca[_0xc749('0x47')],_0x40db73);}_0x1fa6ca=_[_0xc749('0x99')]({},_0x1fa6ca,_0x42251d[_0xc749('0xc1')]);return db[_0xc749('0xbe')][_0xc749('0x21')]({'where':_0x1fa6ca[_0xc749('0x47')]})[_0xc749('0x29')](function(_0x55c7a3){_0x38d6b3[_0xc749('0x21')]=_0x55c7a3;if(_0x42251d[_0xc749('0x3d')][_0xc749('0xb6')]){_0x1fa6ca[_0xc749('0xb7')]=[{'all':!![]}];}return db[_0xc749('0xbe')][_0xc749('0xc2')](_0x1fa6ca);})[_0xc749('0x29')](function(_0x124a71){_0x38d6b3[_0xc749('0xc3')]=_0x124a71;return _0x38d6b3;});}})[_0xc749('0x29')](respondWithFilteredResult(_0x5e4ef3,_0x1fa6ca))[_0xc749('0xb3')](handleError(_0x5e4ef3,null));};exports[_0xc749('0xc4')]=function(_0x1cde2e,_0x465232,_0x3ea204){return db[_0xc749('0x37')][_0xc749('0x6c')]({'where':{'id':_0x1cde2e[_0xc749('0xb5')]['id']}})['then'](handleEntityNotFound(_0x465232,null))['then'](function(_0x2c61e9){if(_0x2c61e9){return _0x2c61e9['setTags'](_0x1cde2e[_0xc749('0x76')][_0xc749('0xbc')],_[_0xc749('0xc5')](_0x1cde2e['body'],[_0xc749('0xbc'),'id'])||{})[_0xc749('0xc6')](function(){return db[_0xc749('0x71')]['findAll']({'attributes':['id',_0xc749('0x2d'),'color'],'where':{'id':_0x1cde2e[_0xc749('0x76')][_0xc749('0xbc')]}});})[_0xc749('0x29')](function(_0x272189){socket[_0xc749('0xc7')](_0xc749('0xc8'),{'id':Number(_0x1cde2e['params']['id']),'tags':_0x272189||[]});return{'id':Number(_0x1cde2e[_0xc749('0xb5')]['id']),'tags':_0x272189||[]};});}})['then'](respondWithResult(_0x465232,null))[_0xc749('0xb3')](handleError(_0x465232,null));};exports['removeTags']=function(_0x113548,_0x124667,_0x3b4bf0){return db[_0xc749('0x37')]['find']({'where':{'id':_0x113548[_0xc749('0xb5')]['id']}})[_0xc749('0x29')](handleEntityNotFound(_0x124667,null))[_0xc749('0x29')](function(_0x4aaa40){if(_0x4aaa40){return _0x4aaa40[_0xc749('0xc9')](_0x113548[_0xc749('0x3d')][_0xc749('0xbc')]);}})['then'](respondWithStatusCode(_0x124667,null))[_0xc749('0xb3')](handleError(_0x124667,null));};exports[_0xc749('0xca')]=function(_0x241c55,_0x3d3e75){var _0x1fa588=moment()[_0xc749('0xcb')]()[_0xc749('0x97')]();var _0x216136=path[_0xc749('0xcc')](config[_0xc749('0xcd')],_0xc749('0xce'),_0xc749('0xcf'),_0xc749('0xd0'));var _0x4c7e6e=path[_0xc749('0xcc')](config[_0xc749('0xcd')],_0xc749('0xce'),_0xc749('0xcf'),_0xc749('0xd1'));var _0x3e71e5=path['join'](_0x216136,_0x1fa588);var _0xe9905f=util[_0xc749('0xbf')](_0xc749('0xd2'),_0x241c55[_0xc749('0xb5')]['id'],_0x1fa588);var _0x4ba791=path['join'](_0x216136,_0xe9905f);var _0x329c07=[];_0x329c07[_0xc749('0xb1')]({'model':db['User'],'as':_0xc749('0x72'),'attributes':['id',_0xc749('0x31')],'raw':!![]});_0x329c07[_0xc749('0xb1')]({'model':db[_0xc749('0xd3')],'as':_0xc749('0x67'),'attributes':['id',_0xc749('0xd4'),_0xc749('0xd5')],'raw':!![]});if(_0x241c55[_0xc749('0x3d')][_0xc749('0xd1')]){_0x329c07[_0xc749('0xb1')]({'model':db[_0xc749('0xd6')],'as':_0xc749('0xd6'),'raw':!![]});}var _0x3101f0=[{'model':db[_0xc749('0xbe')],'as':_0xc749('0xd7'),'attributes':['id',_0xc749('0x76'),'createdAt','direction',_0xc749('0xd8'),_0xc749('0x81')],'include':_0x329c07}];_0x3101f0[_0xc749('0xb1')]({'model':db['OpenchannelAccount'],'as':_0xc749('0xd9'),'attributes':['id',_0xc749('0x2d')]});_0x3101f0[_0xc749('0xb1')]({'model':db[_0xc749('0x72')],'as':'Owner','attributes':['id',_0xc749('0x31')]});return db[_0xc749('0x37')][_0xc749('0x6c')]({'where':{'id':_0x241c55[_0xc749('0xb5')]['id']},'include':_0x3101f0})[_0xc749('0x29')](handleEntityNotFound(_0x3d3e75,null))['then'](function(_0x537ce0){if(_0x537ce0){var _0x36a3e2=_0x537ce0[_0xc749('0xda')]({'plain':!![]});fs[_0xc749('0xdb')](_0x3e71e5);var _0x283974={'format':'A4','border':_0xc749('0xdc'),'header':{'height':_0xc749('0xdd'),'contents':{'first':_0xc749('0xde')}},'footer':{'height':_0xc749('0xdf'),'contents':{'default':util[_0xc749('0xbf')](_0xc749('0xe0'),util[_0xc749('0xbf')](_0xc749('0xe1'),_0xc749('0xe2'),_0x36a3e2['id']),moment()[_0xc749('0xbf')](_0xc749('0xe3'))[_0xc749('0x97')]())}}};var _0x49ae35={'channel':_0xc749('0xe2'),'account':_0x36a3e2[_0xc749('0xd9')][_0xc749('0x2d')],'agent':_0x36a3e2[_0xc749('0xe4')]?_0x36a3e2[_0xc749('0xe4')][_0xc749('0x31')]:_0xc749('0xe5'),'createdAt':moment(_0x36a3e2[_0xc749('0x7a')])[_0xc749('0xbf')](_0xc749('0xc0'))[_0xc749('0x97')](),'closedAt':_0x36a3e2['closed']?moment(_0x36a3e2[_0xc749('0xe6')])[_0xc749('0xbf')](_0xc749('0xc0'))[_0xc749('0x97')]():'','disposition':_0x36a3e2[_0xc749('0xe7')],'visibility':_0x36a3e2['threadId']?'Public':'Private','messages':_(_0x36a3e2[_0xc749('0xd7')])['filter']({'secret':![]})['map'](function(_0x222e3f){if(_0x222e3f[_0xc749('0xd6')]){var _0x5b645e=path[_0xc749('0xcc')](_0x4c7e6e,_0x222e3f[_0xc749('0xd6')]['basename']);if(fs[_0xc749('0xe8')](_0x5b645e)){fs['createReadStream'](_0x5b645e)[_0xc749('0xe9')](fs[_0xc749('0xea')](path[_0xc749('0xcc')](_0x3e71e5,_0x222e3f[_0xc749('0xd6')][_0xc749('0xeb')])));}}return{'date':moment(_0x222e3f[_0xc749('0x7a')])[_0xc749('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc749('0x97')](),'sender':_0x222e3f['direction']==='out'?_0x222e3f[_0xc749('0x72')]?_0x222e3f[_0xc749('0x72')]['fullname']:_0xc749('0xec'):_0x222e3f[_0xc749('0x67')][_0xc749('0xd4')]+(_0x222e3f['Contact'][_0xc749('0xd5')]?'\x20'+_0x222e3f['Contact'][_0xc749('0xd5')]:''),'body':_0x222e3f[_0xc749('0xd6')]?_0x222e3f[_0xc749('0xd6')]['basename']:_0x222e3f[_0xc749('0x76')],'direction':_0x222e3f[_0xc749('0xed')]===_0xc749('0xee')?'A':'C','secret':_0x222e3f[_0xc749('0xd8')],'read':_0x222e3f[_0xc749('0x81')],'attachment':_0x222e3f[_0xc749('0xd6')]};})[_0xc749('0x63')]()};return ejs[_0xc749('0xef')](path[_0xc749('0xcc')](config['root'],_0xc749('0xce'),_0xc749('0xf0'),_0xc749('0xf1')),{'interaction':_0x49ae35})[_0xc749('0x29')](function(_0x34de7b){return new BPromise(function(_0x32736a,_0x5a08ce){pdf[_0xc749('0xb8')](_0x34de7b,_0x283974)[_0xc749('0xf2')](path['join'](_0x3e71e5,_0xc749('0xf3')+_0x36a3e2['id']+'-'+_0x1fa588+'.pdf'),function(_0x516c49,_0x2e41a1){if(_0x516c49)return _0x5a08ce(_0x516c49);_0x32736a(_0x2e41a1);});});})['then'](function(){return new BPromise(function(_0x2fb813,_0x37be9b){zipdir(_0x3e71e5,{'saveTo':_0x4ba791},function(_0x1825ed,_0x74812){if(_0x1825ed)return _0x37be9b(_0x1825ed);return _0x2fb813(_0x74812);});})['then'](function(){return new BPromise(function(_0x223249,_0xf82bba){rimraf(_0x3e71e5,function(_0x583077){if(_0x583077)_0xf82bba(_0x583077);return _0x223249();});});})[_0xc749('0x29')](function(){return _0x3d3e75[_0xc749('0xca')](_0x4ba791,_0xe9905f,function(_0x205279){if(_0x205279){console[_0xc749('0xf4')]('err',_0x205279);}else{fs[_0xc749('0xf5')](_0x4ba791);}});});});}else{return _0x3d3e75[_0xc749('0x1e')](0xc8);}})[_0xc749('0xb3')](handleError(_0x3d3e75,null));}; \ No newline at end of file +var _0x7002=['i.createdAt\x20BETWEEN\x20?\x20AND\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)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','groupBy','OpenchannelInteractionId','push','rows','params','keys','includeAll','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','User','CmContact','Contact','firstName','Attachment','Messages','direction','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','\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.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','System','lastName','secret','views','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelInteraction.socket','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','Users','fullname','split','forEach','Tags','catch','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','unreadMessages','value','`\x20=\x200','operator','$substring','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?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','$gte','parse','$lte'];(function(_0x1e4ff5,_0x3944ed){var _0xf644b7=function(_0x46e6ff){while(--_0x46e6ff){_0x1e4ff5['push'](_0x1e4ff5['shift']());}};_0xf644b7(++_0x3944ed);}(_0x7002,0x164));var _0x2700=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x7002[_0x22cc16];return _0x399b70;};'use strict';var pdf=require(_0x2700('0x0'));var emlformat=require(_0x2700('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2700('0x2'));var jsonpatch=require(_0x2700('0x3'));var rp=require(_0x2700('0x4'));var moment=require(_0x2700('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2700('0x6'));var path=require(_0x2700('0x7'));var sox=require(_0x2700('0x8'));var csv=require(_0x2700('0x9'));var ejs=require(_0x2700('0xa'));var fs=require('fs');var _=require(_0x2700('0xb'));var squel=require(_0x2700('0xc'));var crypto=require(_0x2700('0xd'));var jsforce=require(_0x2700('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2700('0x9'));var querystring=require(_0x2700('0xf'));var Papa=require(_0x2700('0x10'));var Redis=require(_0x2700('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2700('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2700('0x13'))(_0x2700('0x14'));var utils=require(_0x2700('0x15'));var config=require(_0x2700('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2700('0x17'))['db'];config['redis']=_[_0x2700('0x18')](config[_0x2700('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2700('0x1a'))(new Redis(config[_0x2700('0x19')]));require(_0x2700('0x1b'))['register'](socket);function respondWithStatusCode(_0x5ae468,_0x5e723a){_0x5e723a=_0x5e723a||0xcc;return function(_0x3d296a){if(_0x3d296a){return _0x5ae468[_0x2700('0x1c')](_0x5e723a);}return _0x5ae468['status'](_0x5e723a)[_0x2700('0x1d')]();};}function respondWithResult(_0x34a246,_0x1db136){_0x1db136=_0x1db136||0xc8;return function(_0x1e8794){if(_0x1e8794){return _0x34a246[_0x2700('0x1e')](_0x1db136)[_0x2700('0x1f')](_0x1e8794);}};}function respondWithFilteredResult(_0x7ffdaf,_0x4c67aa){return function(_0x12eafb){if(_0x12eafb){var _0x510aaa=_0x12eafb[_0x2700('0x20')],_0x3649a9=_0x4c67aa[_0x2700('0x21')],_0x1c646a=_0x4c67aa[_0x2700('0x21')]+_0x4c67aa['limit'],_0x127dd1;if(_0x1c646a>=_0x510aaa){_0x1c646a=_0x510aaa;_0x127dd1=0xc8;}else{_0x127dd1=0xce;}_0x7ffdaf[_0x2700('0x1e')](_0x127dd1);return _0x7ffdaf[_0x2700('0x22')](_0x2700('0x23'),_0x3649a9+'-'+_0x1c646a+'/'+_0x510aaa)[_0x2700('0x1f')](_0x12eafb);}return null;};}function patchUpdates(_0x4d3b9a){return function(_0x298851){try{jsonpatch[_0x2700('0x24')](_0x298851,_0x4d3b9a,!![]);}catch(_0x55d2b6){return BPromise[_0x2700('0x25')](_0x55d2b6);}return _0x298851[_0x2700('0x26')]();};}function saveUpdates(_0x5455da,_0x1b1748){return function(_0x167344){if(_0x167344){return _0x167344[_0x2700('0x27')](_0x5455da)['then'](function(_0x3c3c5d){return _0x3c3c5d;});}return null;};}function removeEntity(_0x1bf6b0,_0x4e69f1){return function(_0x15b90e){if(_0x15b90e){return _0x15b90e[_0x2700('0x28')]()[_0x2700('0x29')](function(){_0x1bf6b0[_0x2700('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2716ad,_0x4235f8){return function(_0x44fe8d){if(!_0x44fe8d){_0x2716ad['sendStatus'](0x194);}return _0x44fe8d;};}function handleError(_0x2b2c85,_0x1f9785){_0x1f9785=_0x1f9785||0x1f4;return function(_0x533783){logger[_0x2700('0x2a')](_0x533783[_0x2700('0x2b')]);if(_0x533783[_0x2700('0x2c')]){delete _0x533783[_0x2700('0x2c')];}_0x2b2c85['status'](_0x1f9785)['send'](_0x533783);};}function getInteractionUsers(_0x5eeb05,_0x1f889f){return new BPromise(function(_0x1a6bee,_0x5676b6){try{if(_0x1f889f[_0x5eeb05['id']]){_0x5eeb05[_0x2700('0x2d')]=_['map'](_0x1f889f[_0x5eeb05['id']],function(_0x4a8f5e){return{'id':_0x4a8f5e['id'],'fullname':_0x4a8f5e[_0x2700('0x2e')]};});}}catch(_0x20fbd0){_0x5676b6(_0x20fbd0);}_0x1a6bee(_0x5eeb05);});}function getInteractionTags(_0x4f3221,_0xad4516){return new BPromise(function(_0x45bcfe,_0x4fb4ed){try{if(_0x4f3221['TagIds']){_0x4f3221['Tags']=[];_0x4f3221['TagIds'][_0x2700('0x2f')](',')[_0x2700('0x30')](function(_0x43c15c){_0x4f3221[_0x2700('0x31')]['push'](_0xad4516[_0x43c15c]);});}delete _0x4f3221['TagIds'];}catch(_0x5887fc){_0x4fb4ed(_0x5887fc);}_0x45bcfe(_0x4f3221);});}function updateOpenchannelInteraction(_0x1ec729,_0x4f8c68,_0x3c13c2){return new BPromise(function(_0x27360f,_0x3cdefa){return getInteractionUsers(_0x1ec729,_0x3c13c2)[_0x2700('0x29')](function(_0x597bea){return getInteractionTags(_0x597bea,_0x4f8c68);})['then'](function(_0x4594eb){_0x27360f(_0x4594eb);})[_0x2700('0x32')](function(_0x1de6d0){_0x3cdefa(_0x1de6d0);});});}exports[_0x2700('0x33')]=function(_0x27db02,_0xe8272a){var _0x8d5cb={},_0x323d44={},_0x47a354={'count':0x0,'rows':[]};var _0x2aafc2=_[_0x2700('0x34')](db[_0x2700('0x35')][_0x2700('0x36')],function(_0x5b3d36){return{'name':_0x5b3d36[_0x2700('0x37')],'type':_0x5b3d36[_0x2700('0x38')][_0x2700('0x39')]};});_0x323d44[_0x2700('0x3a')]=_[_0x2700('0x34')](_0x2aafc2,_0x2700('0x2c'));_0x323d44[_0x2700('0x3b')]=_['keys'](_0x27db02[_0x2700('0x3b')]);_0x323d44[_0x2700('0x3c')]=_['intersection'](_0x323d44['model'],_0x323d44[_0x2700('0x3b')]);_0x8d5cb[_0x2700('0x3d')]=_[_0x2700('0x3e')](_0x323d44[_0x2700('0x3a')],qs[_0x2700('0x3f')](_0x27db02[_0x2700('0x3b')][_0x2700('0x3f')]));_0x8d5cb[_0x2700('0x3d')]=_0x8d5cb[_0x2700('0x3d')][_0x2700('0x40')]?_0x8d5cb[_0x2700('0x3d')]:_0x323d44[_0x2700('0x3a')];if(!_0x27db02[_0x2700('0x3b')][_0x2700('0x41')](_0x2700('0x42'))){_0x8d5cb[_0x2700('0x43')]=qs[_0x2700('0x43')](_0x27db02['query'][_0x2700('0x43')]);_0x8d5cb['offset']=qs[_0x2700('0x21')](_0x27db02[_0x2700('0x3b')]['offset']);}_0x8d5cb[_0x2700('0x44')]=qs[_0x2700('0x45')](_0x27db02[_0x2700('0x3b')][_0x2700('0x45')]);_0x8d5cb[_0x2700('0x46')]=qs[_0x2700('0x3c')](_[_0x2700('0x47')](_0x27db02[_0x2700('0x3b')],_0x323d44[_0x2700('0x3c')]),_0x2aafc2);var _0x479b85=[];var _0x3526d2=squel[_0x2700('0x48')]()[_0x2700('0x49')]('id')[_0x2700('0x49')](_0x2700('0x2c'))[_0x2700('0x49')](_0x2700('0x4a'))[_0x2700('0x4b')](_0x2700('0x4c'));var _0xea3afe=squel[_0x2700('0x48')]()[_0x2700('0x49')](_0x2700('0x4d'))[_0x2700('0x49')](_0x2700('0x4e'))[_0x2700('0x49')]('ui.OpenchannelInteractionId')['from']('user_has_openchannel_interactions','ui')[_0x2700('0x4f')](_0x2700('0x50'),'u',_0x2700('0x51'));var _0x145e13=squel[_0x2700('0x48')]()[_0x2700('0x4b')]('openchannel_interactions','i')['left_join'](_0x2700('0x52'),'c',_0x2700('0x53'))['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x2700('0x4f')](_0x2700('0x54'),'a',_0x2700('0x55'))['left_join']('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x2700('0x4f')]('openchannel_interaction_has_tags','it',_0x2700('0x56'))[_0x2700('0x4f')]('tools_tags','t',_0x2700('0x57'));var _0x41e2e9=squel[_0x2700('0x58')]();var _0x50d45f=[];var _0x31ae6c=squel['expr']();var _0x4add9d;if(_0x27db02['query'][_0x2700('0x59')]){_0x4add9d=as[_0x2700('0x5a')](_0x27db02[_0x2700('0x3b')]['search']);var _0x54749d=_0x4add9d[_0x2700('0x5b')];for(var _0x5b5d9d=0x0;_0x5b5d9d<_0x4add9d['conditions'][_0x2700('0x40')];_0x5b5d9d++){var _0x2af115=_0x4add9d['conditions'][_0x5b5d9d];var _0x15bc91='i';var _0x3e0d43=_['find'](_0x2aafc2,[_0x2700('0x2c'),_0x2af115[_0x2700('0x49')]]);if(!_0x3e0d43){switch(_0x2af115['field']){case _0x2700('0x5c'):if(_0x2af115[_0x2700('0x5d')]==0x1){_0x145e13['having']('`'+_0x2af115[_0x2700('0x49')]+_0x2700('0x5e'));}else{_0x145e13['having']('`'+_0x2af115[_0x2700('0x49')]+'`\x20>\x200');}break;case'Contact':if(_0x2af115[_0x2700('0x5f')]===_0x2700('0x60')){if(_0x2af115[_0x2700('0x5d')][_0x2700('0x2f')]('\x20')['length']>0x1){_0x41e2e9[_0x54749d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2af115[_0x2700('0x5d')]),null);}else{var _0x7052bd='%'+_0x2af115['value']+'%';_0x41e2e9[_0x54749d](_0x2700('0x61'),_0x7052bd,_0x7052bd,_0x7052bd);}}else{_0x3e0d43=_[_0x2700('0x62')](_0x2aafc2,['name',_0x2700('0x63')]);_0x2af115[_0x2700('0x49')]='ContactId';_0x5a9fc3=as[_0x2700('0x64')](_0x15bc91,_0x3e0d43[_0x2700('0x38')],_0x2af115);_0x41e2e9[_0x54749d](_0x5a9fc3[_0x2700('0x65')],_0x5a9fc3['value'][_0x2700('0x66')],_0x5a9fc3['value'][_0x2700('0x1d')]);}break;case _0x2700('0x67'):var _0x6f637=_0x2af115[_0x2700('0x5d')][_0x2700('0x2f')](',')[_0x2700('0x34')](function(_0x2a698c){return Number(_0x2a698c);});_0x6f637[_0x2700('0x30')](function(_0x921f98){_0x31ae6c['or'](_0x2700('0x68'),'%,'+_0x921f98+',%');});_0x50d45f=_['union'](_0x50d45f,_0x6f637);break;case'User':if(_0x2af115['operator']===_0x2700('0x60')){_0x41e2e9[_0x54749d](_0x2700('0x69'),'%'+_0x2af115[_0x2700('0x5d')]+'%',null);}else{_0x3e0d43=_[_0x2700('0x62')](_0x2aafc2,[_0x2700('0x2c'),_0x2700('0x6a')]);_0x2af115[_0x2700('0x49')]='UserId';_0x5a9fc3=as[_0x2700('0x64')](_0x15bc91,_0x3e0d43[_0x2700('0x38')],_0x2af115);_0x41e2e9[_0x54749d](_0x5a9fc3[_0x2700('0x65')],_0x5a9fc3[_0x2700('0x5d')]['start'],_0x5a9fc3['value'][_0x2700('0x1d')]);}break;case _0x2700('0x6b'):_0x5a9fc3=as[_0x2700('0x64')]('me',null,_0x2af115);_0x41e2e9[_0x54749d](_0x5a9fc3[_0x2700('0x65')],_0x5a9fc3[_0x2700('0x5d')][_0x2700('0x66')],_0x5a9fc3['value'][_0x2700('0x1d')]);break;}}else{var _0x5a9fc3=as[_0x2700('0x64')](_0x15bc91,_0x3e0d43[_0x2700('0x38')],_0x2af115);_0x41e2e9[_0x54749d](_0x5a9fc3[_0x2700('0x65')],_0x5a9fc3['value']['start'],_0x5a9fc3[_0x2700('0x5d')][_0x2700('0x1d')]);}}}else{var _0x14a214=_(_0x27db02[_0x2700('0x3b')])['keys']()[_0x2700('0x34')](function(_0xbc2d0d){return _[_0x2700('0x6c')](_0x2aafc2,['name',_0xbc2d0d])?_0xbc2d0d:undefined;})[_0x2700('0x6d')]()['value']();if(!_['isEmpty'](_0x14a214)){_0x14a214[_0x2700('0x30')](function(_0x5bc47b){if(_0x5bc47b===_0x2700('0x6e')){_0x145e13[_0x2700('0x46')](_0x2700('0x6f'),[]['concat'](_0x27db02[_0x2700('0x3b')][_0x5bc47b]));}else if(_0x5bc47b===_0x2700('0x70')){var _0x2836f3=JSON['parse'](_0x27db02[_0x2700('0x3b')][_0x5bc47b])[_0x2700('0x71')];var _0x55d1b5=JSON[_0x2700('0x72')](_0x27db02['query'][_0x5bc47b])[_0x2700('0x73')];_0x145e13['where'](_0x2700('0x74'),_0x2836f3,_0x55d1b5);}else{if(_0x27db02[_0x2700('0x3b')][_0x5bc47b]==='null'){_0x145e13[_0x2700('0x46')]('i.'+_0x5bc47b+'\x20IS\x20NULL');}else{_0x145e13[_0x2700('0x46')]('i.'+_0x5bc47b+'\x20=\x20?',_0x27db02[_0x2700('0x3b')][_0x5bc47b]);}}});}if(_0x27db02[_0x2700('0x3b')]['read']){if(_0x27db02[_0x2700('0x3b')][_0x2700('0x75')]==0x1){_0x145e13['having'](_0x2700('0x76'));}else{_0x145e13['having'](_0x2700('0x77'));}}if(_0x27db02['query'][_0x2700('0x78')]){_0x50d45f=_[_0x2700('0x79')](_0x27db02[_0x2700('0x3b')][_0x2700('0x78')])?_0x27db02[_0x2700('0x3b')][_0x2700('0x78')]:new Array(_0x27db02[_0x2700('0x3b')][_0x2700('0x78')]);_0x50d45f[_0x2700('0x30')](function(_0x1debf8){_0x31ae6c['or'](_0x2700('0x68'),'%,'+_0x1debf8+',%');});}if(_0x27db02[_0x2700('0x3b')]['filter']){var _0x5228ba=_0x27db02[_0x2700('0x3b')][_0x2700('0x7a')]['replace']('\x5c','\x5c\x5c')[_0x2700('0x7b')](/'/g,'\x27\x27');if(qs[_0x2700('0x7c')](_0x5228ba)){_0x41e2e9['or'](_0x2700('0x7d'),_0x5228ba+'%');}else{_0x41e2e9['or'](_0x2700('0x7e'),qs[_0x2700('0x7f')](_0x5228ba))['or'](_0x2700('0x80'),_0x5228ba+'%')['or'](_0x2700('0x81'),_0x5228ba+'%');}}}_0x145e13['where'](_0x41e2e9);_0x145e13[_0x2700('0x82')](_0x2700('0x83'));var _0x343383={'type':db[_0x2700('0x84')][_0x2700('0x85')]['SELECT'],'raw':!![]};var _0x2c2c2d=_0x145e13['clone']();_0x2c2c2d[_0x2700('0x49')](_0x2700('0x83'));_0x2c2c2d[_0x2700('0x49')](_0x2700('0x86'),_0x2700('0x5c'));if(_0x8d5cb[_0x2700('0x44')]){_0x8d5cb[_0x2700('0x44')][_0x2700('0x30')](function(_0x1b9f3b){var _0x4c6e54=_0x1b9f3b[0x0]===_0x2700('0x87')?_0x1b9f3b[0x0]:'i.'+_0x1b9f3b[0x0];_0x145e13[_0x2700('0x44')](_0x4c6e54,_0x1b9f3b[0x1]===_0x2700('0x88')?![]:!![]);});}if(!_[_0x2700('0x89')](_0x50d45f)){_0x145e13[_0x2700('0x8a')](_0x31ae6c);_0x2c2c2d['where'](_0x2700('0x8b'),_0x50d45f);}BPromise[_0x2700('0x8c')]()[_0x2700('0x29')](function(){if(!_0x4add9d){if(_0x27db02[_0x2700('0x3b')]['OpenchannelAccountId'])return;_0x2c2c2d['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x145e13[_0x2700('0x46')](_0x2700('0x8d'));return;}if(_0x27db02['user'][_0x2700('0x8e')]!==_0x2700('0x8f'))return;return _0x27db02[_0x2700('0x90')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x2700('0x29')](function(_0x19c2c7){if(_[_0x2700('0x89')](_0x19c2c7)){_0x2c2c2d[_0x2700('0x46')](_0x2700('0x91'));_0x145e13['where'](_0x2700('0x91'));}else{_0x2c2c2d[_0x2700('0x46')](_0x2700('0x6f'),_[_0x2700('0x34')](_0x19c2c7,'id'));_0x145e13[_0x2700('0x46')](_0x2700('0x6f'),_['map'](_0x19c2c7,'id'));}});})[_0x2700('0x29')](function(){if(_0x27db02['user'][_0x2700('0x8e')]===_0x2700('0x8f')&&!_0x4add9d&&!_0x27db02[_0x2700('0x3b')][_0x2700('0x6e')])return[];return db[_0x2700('0x92')][_0x2700('0x3b')](_0x2c2c2d[_0x2700('0x93')](),_0x343383);})['then'](function(_0x175fd6){_0x47a354[_0x2700('0x20')]=_0x175fd6[_0x2700('0x40')];if(_0x47a354[_0x2700('0x20')]===0x0)return[];return db[_0x2700('0x92')][_0x2700('0x3b')](_0x3526d2[_0x2700('0x93')](),_0x343383)['then'](function(_0x5519a7){_0x479b85=_['keyBy'](_0x5519a7,'id');_0x343383=_[_0x2700('0x94')](_0x343383,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27db02[_0x2700('0x3b')]['fields']){_0x8d5cb['attributes']['forEach'](function(_0x5f0328){_0x145e13[_0x2700('0x49')]('i.'+_0x5f0328);});}else{_0x145e13['field'](_0x2700('0x86'),_0x2700('0x5c'));_0x145e13[_0x2700('0x49')](_0x2700('0x95'),'Account.key');_0x145e13[_0x2700('0x49')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x145e13[_0x2700('0x49')](_0x2700('0x96'),_0x2700('0x87'));_0x145e13[_0x2700('0x49')]('i.*');_0x145e13['field'](_0x2700('0x97'),_0x2700('0x98'));_0x145e13['field'](_0x2700('0x99'),_0x2700('0x9a'));_0x145e13[_0x2700('0x49')]('c.email',_0x2700('0x9b'));_0x145e13['field']('c.phone','Contact.phone');_0x145e13[_0x2700('0x49')](_0x2700('0x9c'),_0x2700('0x9d'));_0x145e13[_0x2700('0x49')]('c.fax',_0x2700('0x9e'));_0x145e13[_0x2700('0x49')](_0x2700('0x9f'),_0x2700('0xa0'));_0x145e13[_0x2700('0x49')](_0x2700('0xa1'),'Owner.internal');_0x145e13[_0x2700('0x49')](_0x2700('0xa2'),_0x2700('0xa3'));}if(_0x8d5cb[_0x2700('0x43')])_0x145e13['limit'](_0x8d5cb[_0x2700('0x43')]);if(_0x8d5cb[_0x2700('0x21')])_0x145e13[_0x2700('0x21')](_0x8d5cb[_0x2700('0x21')]);return db[_0x2700('0x92')][_0x2700('0x3b')](_0x145e13[_0x2700('0x93')](),_0x343383);})['then'](function(_0x100066){_0xea3afe[_0x2700('0x46')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x2700('0x34')](_0x100066,'id'));return db[_0x2700('0x92')][_0x2700('0x3b')](_0xea3afe[_0x2700('0x93')](),_0x343383)[_0x2700('0x29')](function(_0x105190){var _0x50f9c5=_[_0x2700('0xa4')](_0x105190,_0x2700('0xa5'));var _0x56781d=[];_0x100066['forEach'](function(_0x4b4d08){_0x56781d[_0x2700('0xa6')](updateOpenchannelInteraction(_0x4b4d08,_0x479b85,_0x50f9c5));});return BPromise['all'](_0x56781d);});});})['then'](function(_0x37eaad){_0x47a354[_0x2700('0xa7')]=_0x37eaad;return _0x47a354;})[_0x2700('0x29')](respondWithFilteredResult(_0xe8272a,_0x8d5cb))[_0x2700('0x32')](handleError(_0xe8272a,null));};exports['show']=function(_0x4bda52,_0x5d0666){var _0x5b92f1={};if(_0x4bda52[_0x2700('0x3b')][_0x2700('0x38')]&&_0x4bda52['query'][_0x2700('0x38')]===_0x2700('0x4b')){_0x5b92f1[_0x2700('0x4b')]=_0x4bda52[_0x2700('0xa8')]['id'];}else{_0x5b92f1['id']=_0x4bda52[_0x2700('0xa8')]['id'];}var _0x24342e={'raw':![],'where':_0x5b92f1},_0x56ff7f={};_0x56ff7f['model']=_['keys'](db[_0x2700('0x35')][_0x2700('0x36')]);_0x56ff7f['query']=_[_0x2700('0xa9')](_0x4bda52[_0x2700('0x3b')]);_0x56ff7f[_0x2700('0x3c')]=_[_0x2700('0x3e')](_0x56ff7f[_0x2700('0x3a')],_0x56ff7f[_0x2700('0x3b')]);_0x24342e[_0x2700('0x3d')]=_[_0x2700('0x3e')](_0x56ff7f['model'],qs[_0x2700('0x3f')](_0x4bda52[_0x2700('0x3b')][_0x2700('0x3f')]));_0x24342e[_0x2700('0x3d')]=_0x24342e[_0x2700('0x3d')][_0x2700('0x40')]?_0x24342e[_0x2700('0x3d')]:_0x56ff7f[_0x2700('0x3a')];if(_0x4bda52[_0x2700('0x3b')][_0x2700('0xaa')]){_0x24342e['include']=[{'all':!![]}];}_0x24342e=_[_0x2700('0x94')]({},_0x24342e,_0x4bda52[_0x2700('0xab')]);return db[_0x2700('0x35')][_0x2700('0x62')](_0x24342e)[_0x2700('0x29')](handleEntityNotFound(_0x5d0666,null))[_0x2700('0x29')](respondWithResult(_0x5d0666,null))[_0x2700('0x32')](handleError(_0x5d0666,null));};exports['create']=function(_0xf238d4,_0x552ecd){return db[_0x2700('0x35')][_0x2700('0xac')](_0xf238d4[_0x2700('0x6b')],{})[_0x2700('0x29')](respondWithResult(_0x552ecd,0xc9))[_0x2700('0x32')](handleError(_0x552ecd,null));};exports[_0x2700('0x27')]=function(_0x3d50a7,_0x3d374c){if(_0x3d50a7[_0x2700('0x6b')]['id']){delete _0x3d50a7['body']['id'];}return db[_0x2700('0x35')][_0x2700('0x62')]({'where':{'id':_0x3d50a7[_0x2700('0xa8')]['id']}})[_0x2700('0x29')](handleEntityNotFound(_0x3d374c,null))[_0x2700('0x29')](saveUpdates(_0x3d50a7[_0x2700('0x6b')],null))[_0x2700('0x29')](respondWithResult(_0x3d374c,null))['catch'](handleError(_0x3d374c,null));};exports[_0x2700('0x28')]=function(_0xafc921,_0x5b4d71){return db[_0x2700('0x35')][_0x2700('0x62')]({'where':{'id':_0xafc921[_0x2700('0xa8')]['id']}})[_0x2700('0x29')](handleEntityNotFound(_0x5b4d71,null))[_0x2700('0x29')](removeEntity(_0x5b4d71,null))[_0x2700('0x32')](handleError(_0x5b4d71,null));};exports['describe']=function(_0x32f4f5,_0x5b5783){return db['OpenchannelInteraction'][_0x2700('0xad')]()[_0x2700('0x29')](respondWithResult(_0x5b5783,null))[_0x2700('0x32')](handleError(_0x5b5783,null));};exports[_0x2700('0xae')]=function(_0x31ddec,_0x5ebd79,_0x10e75d){return db[_0x2700('0xaf')][_0x2700('0x62')]({'where':{'id':_0x31ddec[_0x2700('0xa8')]['id']}})[_0x2700('0x29')](handleEntityNotFound(_0x5ebd79,null))[_0x2700('0x29')](function(_0x4d9911){if(_0x4d9911){return _0x4d9911[_0x2700('0xae')](_0x31ddec[_0x2700('0x6b')][_0x2700('0xb0')],_[_0x2700('0xb1')](_0x31ddec[_0x2700('0x6b')],[_0x2700('0xb0'),'id'])||{});}})[_0x2700('0x29')](respondWithResult(_0x5ebd79,null))['catch'](handleError(_0x5ebd79,null));};exports[_0x2700('0xb2')]=function(_0x4b0dc6,_0x1df0be,_0x513e3b){var _0x59944f={'raw':![],'where':{}};var _0x2fe9ea={};var _0x5c442a={'count':0x0,'rows':[]};return db[_0x2700('0x35')][_0x2700('0xb3')]({'where':{'id':_0x4b0dc6[_0x2700('0xa8')]['id']}})[_0x2700('0x29')](handleEntityNotFound(_0x1df0be,null))[_0x2700('0x29')](function(_0x5a5d3b){if(_0x5a5d3b){_0x2fe9ea[_0x2700('0x3a')]=_[_0x2700('0xa9')](db['OpenchannelMessage']['rawAttributes']);_0x2fe9ea[_0x2700('0x3b')]=_[_0x2700('0xa9')](_0x4b0dc6[_0x2700('0x3b')]);_0x2fe9ea[_0x2700('0x3c')]=_[_0x2700('0x3e')](_0x2fe9ea[_0x2700('0x3a')],_0x2fe9ea['query']);_0x59944f[_0x2700('0x3d')]=_['intersection'](_0x2fe9ea['model'],qs[_0x2700('0x3f')](_0x4b0dc6[_0x2700('0x3b')]['fields']));_0x59944f[_0x2700('0x3d')]=_0x59944f['attributes']['length']?_0x59944f[_0x2700('0x3d')]:_0x2fe9ea[_0x2700('0x3a')];if(!_0x4b0dc6[_0x2700('0x3b')]['hasOwnProperty'](_0x2700('0x42'))){_0x59944f[_0x2700('0x43')]=qs[_0x2700('0x43')](_0x4b0dc6['query'][_0x2700('0x43')]);_0x59944f[_0x2700('0x21')]=qs[_0x2700('0x21')](_0x4b0dc6[_0x2700('0x3b')][_0x2700('0x21')]);}_0x59944f[_0x2700('0x44')]=qs['sort'](_0x4b0dc6[_0x2700('0x3b')][_0x2700('0x45')]);_0x59944f[_0x2700('0x46')]=qs[_0x2700('0x3c')](_[_0x2700('0x47')](_0x4b0dc6['query'],_0x2fe9ea[_0x2700('0x3c')]));_0x59944f[_0x2700('0x46')][_0x2700('0xa5')]=_0x5a5d3b['id'];if(_0x4b0dc6[_0x2700('0x3b')][_0x2700('0x7a')]){_0x59944f[_0x2700('0x46')]=_[_0x2700('0x94')](_0x59944f[_0x2700('0x46')],{'$or':_[_0x2700('0x34')](_0x59944f[_0x2700('0x3d')],function(_0x4c4300){var _0x2900d5={};_0x2900d5[_0x4c4300]={'$like':'%'+_0x4b0dc6[_0x2700('0x3b')][_0x2700('0x7a')]+'%'};return _0x2900d5;})});}if(_0x4b0dc6['query'][_0x2700('0x71')]){var _0x10c747=_0x4b0dc6[_0x2700('0x3b')][_0x2700('0x71')][_0x2700('0x2f')](',');var _0x4c772c={};_0x4c772c[_0x10c747[0x0]]={'$gte':moment(_0x10c747[0x1])[_0x2700('0xb4')](_0x2700('0xb5'))};_0x59944f['where']=_[_0x2700('0x94')](_0x59944f[_0x2700('0x46')],_0x4c772c);}_0x59944f=_[_0x2700('0x94')]({},_0x59944f,_0x4b0dc6['options']);return db[_0x2700('0xaf')][_0x2700('0x20')]({'where':_0x59944f[_0x2700('0x46')]})[_0x2700('0x29')](function(_0x5574c7){_0x5c442a['count']=_0x5574c7;if(_0x4b0dc6[_0x2700('0x3b')][_0x2700('0xaa')]){_0x59944f['include']=[{'all':!![]}];}return db[_0x2700('0xaf')]['findAll'](_0x59944f);})[_0x2700('0x29')](function(_0x46a6e0){_0x5c442a[_0x2700('0xa7')]=_0x46a6e0;return _0x5c442a;});}})['then'](respondWithFilteredResult(_0x1df0be,_0x59944f))['catch'](handleError(_0x1df0be,null));};exports[_0x2700('0xb6')]=function(_0x554de8,_0x431d15,_0x49bcf3){return db['OpenchannelInteraction'][_0x2700('0x62')]({'where':{'id':_0x554de8[_0x2700('0xa8')]['id']}})[_0x2700('0x29')](handleEntityNotFound(_0x431d15,null))[_0x2700('0x29')](function(_0x4b1edd){if(_0x4b1edd){return _0x4b1edd[_0x2700('0xb7')](_0x554de8[_0x2700('0x6b')][_0x2700('0xb0')],_[_0x2700('0xb1')](_0x554de8[_0x2700('0x6b')],[_0x2700('0xb0'),'id'])||{})[_0x2700('0xb8')](function(){return db[_0x2700('0x67')][_0x2700('0xb9')]({'attributes':['id',_0x2700('0x2c'),_0x2700('0x4a')],'where':{'id':_0x554de8['body'][_0x2700('0xb0')]}});})['then'](function(_0x4faea4){socket[_0x2700('0xba')](_0x2700('0xbb'),{'id':Number(_0x554de8[_0x2700('0xa8')]['id']),'tags':_0x4faea4||[]});return{'id':Number(_0x554de8[_0x2700('0xa8')]['id']),'tags':_0x4faea4||[]};});}})['then'](respondWithResult(_0x431d15,null))[_0x2700('0x32')](handleError(_0x431d15,null));};exports[_0x2700('0xbc')]=function(_0xc0735c,_0x1d3de9,_0x38a9f0){return db[_0x2700('0x35')][_0x2700('0x62')]({'where':{'id':_0xc0735c[_0x2700('0xa8')]['id']}})['then'](handleEntityNotFound(_0x1d3de9,null))['then'](function(_0x2b61dc){if(_0x2b61dc){return _0x2b61dc[_0x2700('0xbc')](_0xc0735c['query'][_0x2700('0xb0')]);}})[_0x2700('0x29')](respondWithStatusCode(_0x1d3de9,null))[_0x2700('0x32')](handleError(_0x1d3de9,null));};exports[_0x2700('0xbd')]=function(_0x35fd5f,_0x4fcc45){var _0x9a861e=moment()[_0x2700('0xbe')]()[_0x2700('0x93')]();var _0x4ab6ab=path[_0x2700('0xbf')](config['root'],_0x2700('0xc0'),_0x2700('0xc1'),_0x2700('0xc2'));var _0x180eef=path[_0x2700('0xbf')](config[_0x2700('0xc3')],_0x2700('0xc0'),'files',_0x2700('0xc4'));var _0x47b35e=path['join'](_0x4ab6ab,_0x9a861e);var _0x3418d4=util[_0x2700('0xb4')]('transcript-%d-%s.zip',_0x35fd5f['params']['id'],_0x9a861e);var _0x5f1f15=path[_0x2700('0xbf')](_0x4ab6ab,_0x3418d4);var _0x1d85b2=[];_0x1d85b2[_0x2700('0xa6')]({'model':db[_0x2700('0xc5')],'as':_0x2700('0xc5'),'attributes':['id','fullname'],'raw':!![]});_0x1d85b2['push']({'model':db[_0x2700('0xc6')],'as':_0x2700('0xc7'),'attributes':['id',_0x2700('0xc8'),'lastName'],'raw':!![]});if(_0x35fd5f[_0x2700('0x3b')][_0x2700('0xc4')]){_0x1d85b2[_0x2700('0xa6')]({'model':db[_0x2700('0xc9')],'as':_0x2700('0xc9'),'raw':!![]});}var _0x255aff=[{'model':db[_0x2700('0xaf')],'as':_0x2700('0xca'),'attributes':['id',_0x2700('0x6b'),_0x2700('0x70'),_0x2700('0xcb'),'secret',_0x2700('0x75')],'include':_0x1d85b2}];_0x255aff[_0x2700('0xa6')]({'model':db['OpenchannelAccount'],'as':_0x2700('0xcc'),'attributes':['id',_0x2700('0x2c')]});_0x255aff['push']({'model':db[_0x2700('0xc5')],'as':_0x2700('0xcd'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x2700('0x62')]({'where':{'id':_0x35fd5f[_0x2700('0xa8')]['id']},'include':_0x255aff})[_0x2700('0x29')](handleEntityNotFound(_0x4fcc45,null))[_0x2700('0x29')](function(_0x1db6f9){if(_0x1db6f9){var _0xd053fd=_0x1db6f9[_0x2700('0xce')]({'plain':!![]});fs['mkdirSync'](_0x47b35e);var _0x38da33={'format':'A4','border':_0x2700('0xcf'),'header':{'height':_0x2700('0xd0'),'contents':{'first':_0x2700('0xd1')}},'footer':{'height':_0x2700('0xd2'),'contents':{'default':util[_0x2700('0xb4')](_0x2700('0xd3'),util[_0x2700('0xb4')]('%s\x20#%d',_0x2700('0xd4'),_0xd053fd['id']),moment()[_0x2700('0xb4')](_0x2700('0xd5'))['toString']())}}};var _0x1d80e3={'channel':_0x2700('0xd4'),'account':_0xd053fd[_0x2700('0xcc')]['name'],'agent':_0xd053fd['Owner']?_0xd053fd['Owner']['fullname']:_0x2700('0xd6'),'createdAt':moment(_0xd053fd['createdAt'])[_0x2700('0xb4')](_0x2700('0xb5'))[_0x2700('0x93')](),'closedAt':_0xd053fd[_0x2700('0xd7')]?moment(_0xd053fd[_0x2700('0xd8')])[_0x2700('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2700('0x93')]():'','disposition':_0xd053fd[_0x2700('0xd9')],'visibility':_0xd053fd[_0x2700('0xda')]?_0x2700('0xdb'):_0x2700('0xdc'),'messages':_(_0xd053fd[_0x2700('0xca')])[_0x2700('0x7a')]({'secret':![]})[_0x2700('0x34')](function(_0x397582){if(_0x397582[_0x2700('0xc9')]){var _0x626ca1=path[_0x2700('0xbf')](_0x180eef,_0x397582[_0x2700('0xc9')][_0x2700('0xdd')]);if(fs[_0x2700('0xde')](_0x626ca1)){fs[_0x2700('0xdf')](_0x626ca1)[_0x2700('0xe0')](fs[_0x2700('0xe1')](path[_0x2700('0xbf')](_0x47b35e,_0x397582[_0x2700('0xc9')]['basename'])));}}return{'date':moment(_0x397582[_0x2700('0x70')])['format'](_0x2700('0xb5'))['toString'](),'sender':_0x397582['direction']==='out'?_0x397582['User']?_0x397582[_0x2700('0xc5')]['fullname']:_0x2700('0xe2'):_0x397582[_0x2700('0xc7')][_0x2700('0xc8')]+(_0x397582['Contact']['lastName']?'\x20'+_0x397582['Contact'][_0x2700('0xe3')]:''),'body':_0x397582[_0x2700('0xc9')]?_0x397582['Attachment'][_0x2700('0xdd')]:_0x397582[_0x2700('0x6b')],'direction':_0x397582['direction']==='out'?'A':'C','secret':_0x397582[_0x2700('0xe4')],'read':_0x397582[_0x2700('0x75')],'attachment':_0x397582[_0x2700('0xc9')]};})[_0x2700('0x5d')]()};return ejs['renderFile'](path[_0x2700('0xbf')](config[_0x2700('0xc3')],'server',_0x2700('0xe5'),'downloadInteraction.html'),{'interaction':_0x1d80e3})[_0x2700('0x29')](function(_0x1d69b4){return new BPromise(function(_0x27cc96,_0x2ec386){pdf[_0x2700('0xac')](_0x1d69b4,_0x38da33)[_0x2700('0xe6')](path[_0x2700('0xbf')](_0x47b35e,_0x2700('0xe7')+_0xd053fd['id']+'-'+_0x9a861e+_0x2700('0xe8')),function(_0x19ed15,_0x2f26c8){if(_0x19ed15)return _0x2ec386(_0x19ed15);_0x27cc96(_0x2f26c8);});});})[_0x2700('0x29')](function(){return new BPromise(function(_0x3b38d8,_0x507b58){zipdir(_0x47b35e,{'saveTo':_0x5f1f15},function(_0x242c06,_0x400f0d){if(_0x242c06)return _0x507b58(_0x242c06);return _0x3b38d8(_0x400f0d);});})[_0x2700('0x29')](function(){return new BPromise(function(_0xab54e8,_0x2e02f4){rimraf(_0x47b35e,function(_0x19dbe4){if(_0x19dbe4)_0x2e02f4(_0x19dbe4);return _0xab54e8();});});})[_0x2700('0x29')](function(){return _0x4fcc45['download'](_0x5f1f15,_0x3418d4,function(_0x2264a5){if(_0x2264a5){console[_0x2700('0xe9')](_0x2700('0xea'),_0x2264a5);}else{fs[_0x2700('0xeb')](_0x5f1f15);}});});});}else{return _0x4fcc45[_0x2700('0x1c')](0xc8);}})['catch'](handleError(_0x4fcc45,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index ae01b13..5b3a09d 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 _0xa234=['hasOwnProperty','hook','exports','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x2a18b7,_0x5041c8){var _0x45e74e=function(_0x1d32d6){while(--_0x1d32d6){_0x2a18b7['push'](_0x2a18b7['shift']());}};_0x45e74e(++_0x5041c8);}(_0xa234,0x124));var _0x4a23=function(_0x135dec,_0xd0994e){_0x135dec=_0x135dec-0x0;var _0x2d3277=_0xa234[_0x135dec];return _0x2d3277;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0x4a23('0x0')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x4a23('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4a23('0x2')](0x0);var events={'afterCreate':_0x4a23('0x3'),'afterUpdate':_0x4a23('0x4'),'afterDestroy':_0x4a23('0x5')};function emitEvent(_0x90c41e){return function(_0x46f93c,_0x4a3f9e,_0xcad2b5){_0x46f93c['getUsers']({'attributes':['id'],'raw':!![]})[_0x4a23('0x6')](function(_0x219f5a){_0x46f93c[_0x4a23('0x7')](_0x4a23('0x8'),_0x219f5a[_0x4a23('0x9')](function(_0x4831d8){return{'id':_0x4831d8['id']};}));return OpenchannelMessage[_0x4a23('0xa')]({'where':{'OpenchannelInteractionId':_0x46f93c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x51bc44){_0x46f93c[_0x4a23('0x7')](_0x4a23('0xb'),_0x51bc44[_0x4a23('0xc')]);OpenchannelInteractionEvents[_0x4a23('0xd')](_0x90c41e+':'+_0x46f93c['id'],_0x46f93c);OpenchannelInteractionEvents[_0x4a23('0xd')](_0x90c41e,_0x46f93c);_0xcad2b5(null);})['catch'](_0xcad2b5(null));};}for(var e in events){if(events[_0x4a23('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x4a23('0xf')](e,emitEvent(event));}}module[_0x4a23('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x579e=['setDataValue','map','findAll','unreadMessages','emit','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then'];(function(_0x250010,_0x489f87){var _0x2448f2=function(_0x56f2b2){while(--_0x56f2b2){_0x250010['push'](_0x250010['shift']());}};_0x2448f2(++_0x489f87);}(_0x579e,0x114));var _0xe579=function(_0x526763,_0x3d3cdd){_0x526763=_0x526763-0x0;var _0x535351=_0x579e[_0x526763];return _0x535351;};'use strict';var EventEmitter=require(_0xe579('0x0'));var OpenchannelInteraction=require(_0xe579('0x1'))['db'][_0xe579('0x2')];var OpenchannelMessage=require(_0xe579('0x1'))['db'][_0xe579('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe579('0x4')](0x0);var events={'afterCreate':_0xe579('0x5'),'afterUpdate':_0xe579('0x6'),'afterDestroy':_0xe579('0x7')};function emitEvent(_0x4a2279){return function(_0x46e171,_0x2d76e3,_0x4fe629){_0x46e171['getUsers']({'attributes':['id'],'raw':!![]})[_0xe579('0x8')](function(_0x258da1){_0x46e171[_0xe579('0x9')]('Users',_0x258da1[_0xe579('0xa')](function(_0x5023b9){return{'id':_0x5023b9['id']};}));return OpenchannelMessage[_0xe579('0xb')]({'where':{'OpenchannelInteractionId':_0x46e171['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2bf610){_0x46e171['setDataValue'](_0xe579('0xc'),_0x2bf610['length']);OpenchannelInteractionEvents['emit'](_0x4a2279+':'+_0x46e171['id'],_0x46e171);OpenchannelInteractionEvents[_0xe579('0xd')](_0x4a2279,_0x46e171);_0x4fe629(null);})['catch'](_0x4fe629(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xe579('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 9a44ac8..9636d32 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 _0xbfe8=['openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x2cb169,_0x38ec0a){var _0x54c758=function(_0x3f3cf4){while(--_0x3f3cf4){_0x2cb169['push'](_0x2cb169['shift']());}};_0x54c758(++_0x38ec0a);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x17e209,_0x5c751d){_0x17e209=_0x17e209-0x0;var _0x370caa=_0xbfe8[_0x17e209];return _0x370caa;};'use strict';var _=require('lodash');var util=require(_0x8bfe('0x0'));var logger=require('../../config/logger')(_0x8bfe('0x1'));var moment=require(_0x8bfe('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bfe('0x3'));var rimraf=require(_0x8bfe('0x4'));var config=require('../../config/environment');var attributes=require(_0x8bfe('0x5'));module[_0x8bfe('0x6')]=function(_0x314a9a,_0x4933c9){return _0x314a9a[_0x8bfe('0x7')](_0x8bfe('0x8'),attributes,{'tableName':_0x8bfe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4602fc,_0x5d4e54,_0x1bb8ca){if(_0x4602fc[_0x8bfe('0xa')](_0x8bfe('0xb'))){_0x4602fc[_0x8bfe('0xc')]=moment()[_0x8bfe('0xd')](_0x8bfe('0xe'));}_0x1bb8ca(null,_0x4602fc);}}});}; \ No newline at end of file +var _0xe015=['changed','closed','format','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','openchannel_interactions'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0xe015,0x13b));var _0x5e01=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe015[_0x4565bf];return _0x5610ba;};'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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 229f625..4adfbc0 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 _0x80ce=['register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','attributes','limit','AddTagsToOpenchannelInteraction','find','where','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter'];(function(_0x43b9b3,_0x5a9907){var _0x168b8f=function(_0x36e09c){while(--_0x36e09c){_0x43b9b3['push'](_0x43b9b3['shift']());}};_0x168b8f(++_0x5a9907);}(_0x80ce,0x1d2));var _0xe80c=function(_0x3aa314,_0x43b806){_0x3aa314=_0x3aa314-0x0;var _0x39d0d8=_0x80ce[_0x3aa314];return _0x39d0d8;};'use strict';var _=require(_0xe80c('0x0'));var util=require(_0xe80c('0x1'));var moment=require(_0xe80c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe80c('0x3'));var fs=require('fs');var Redis=require(_0xe80c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe80c('0x5'));var logger=require(_0xe80c('0x6'))(_0xe80c('0x7'));var config=require(_0xe80c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe80c('0x9')]['http']({'port':0x232a});config['redis']=_[_0xe80c('0xa')](config[_0xe80c('0xb')],{'host':_0xe80c('0xc'),'port':0x18eb});var socket=require(_0xe80c('0xd'))(new Redis(config[_0xe80c('0xb')]));require('./openchannelInteraction.socket')[_0xe80c('0xe')](socket);function respondWithRpcPromise(_0x1bc2ba,_0x4420a3,_0x5d08fa){return new BPromise(function(_0x14fc94,_0x4b4114){return client[_0xe80c('0xf')](_0x1bc2ba,_0x5d08fa)[_0xe80c('0x10')](function(_0x346da0){logger[_0xe80c('0x11')](_0xe80c('0x12'),_0x4420a3,_0xe80c('0x13'));logger[_0xe80c('0x14')](_0xe80c('0x15'),_0x4420a3,'request\x20sent',JSON[_0xe80c('0x16')](_0x346da0));if(_0x346da0[_0xe80c('0x17')]){if(_0x346da0[_0xe80c('0x17')][_0xe80c('0x18')]===0x1f4){logger[_0xe80c('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4420a3,_0x346da0[_0xe80c('0x17')]['message']);return _0x4b4114(_0x346da0[_0xe80c('0x17')]['message']);}logger[_0xe80c('0x17')](_0xe80c('0x12'),_0x4420a3,_0x346da0['error']['message']);return _0x14fc94(_0x346da0[_0xe80c('0x17')][_0xe80c('0x19')]);}else{logger[_0xe80c('0x11')](_0xe80c('0x12'),_0x4420a3,_0xe80c('0x13'));_0x14fc94(_0x346da0[_0xe80c('0x1a')][_0xe80c('0x19')]);}})[_0xe80c('0x1b')](function(_0x2a9656){logger['error'](_0xe80c('0x12'),_0x4420a3,_0x2a9656);_0x4b4114(_0x2a9656);});});}exports[_0xe80c('0x1c')]=function(_0x25da43){var _0x5e979d=this;return new Promise(function(_0x22d005,_0x5ee974){return db[_0xe80c('0x1d')][_0xe80c('0x1e')](_0x25da43[_0xe80c('0x1f')],{'raw':_0x25da43[_0xe80c('0x20')]?_0x25da43['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25da43[_0xe80c('0x20')]?_0x25da43[_0xe80c('0x20')]['where']||null:null,'attributes':_0x25da43[_0xe80c('0x20')]?_0x25da43[_0xe80c('0x20')][_0xe80c('0x21')]||null:null,'limit':_0x25da43[_0xe80c('0x20')]?_0x25da43[_0xe80c('0x20')][_0xe80c('0x22')]||null:null})[_0xe80c('0x10')](function(_0x208504){logger[_0xe80c('0x11')](_0xe80c('0x1c'),_0x25da43);logger[_0xe80c('0x14')](_0xe80c('0x1c'),_0x25da43,JSON['stringify'](_0x208504));_0x22d005(_0x208504);})[_0xe80c('0x1b')](function(_0x27b638){logger[_0xe80c('0x17')]('UpdateOpenchannelInteraction',_0x27b638[_0xe80c('0x19')],_0x25da43);_0x5ee974(_0x5e979d[_0xe80c('0x17')](0x1f4,_0x27b638[_0xe80c('0x19')]));});});};exports[_0xe80c('0x23')]=function(_0x2f9e40){return new Promise(function(_0xe7d4b,_0x1eda71){return db[_0xe80c('0x1d')][_0xe80c('0x24')]({'where':_0x2f9e40[_0xe80c('0x20')]?_0x2f9e40['options'][_0xe80c('0x25')]||null:null})['then'](function(_0x59badd){if(_0x59badd){return _0x59badd['addTags'](_0x2f9e40[_0xe80c('0x1f')][_0xe80c('0x26')],_['omit'](_0x2f9e40[_0xe80c('0x1f')],['ids','id'])||{});}})['spread'](function(_0x298370){logger[_0xe80c('0x11')](_0xe80c('0x27'),_0x2f9e40);logger[_0xe80c('0x14')](_0xe80c('0x27'),_0x2f9e40,JSON[_0xe80c('0x16')](_0x298370));_0xe7d4b(_0x298370);})[_0xe80c('0x1b')](function(_0x570c1c){logger[_0xe80c('0x17')](_0xe80c('0x27'),_0x570c1c[_0xe80c('0x19')],_0x2f9e40);_0x1eda71(_this[_0xe80c('0x17')](0x1f4,_0x570c1c[_0xe80c('0x19')]));});});}; \ No newline at end of file +var _0x3b3a=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./openchannelInteraction.socket','request','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','limit','then','AddTagsToOpenchannelInteraction','find','ids','omit','spread','AddTags'];(function(_0x5a6b9b,_0x3d6b3f){var _0x3e71fd=function(_0x31b025){while(--_0x31b025){_0x5a6b9b['push'](_0x5a6b9b['shift']());}};_0x3e71fd(++_0x3d6b3f);}(_0x3b3a,0x190));var _0xa3b3=function(_0x1be0fd,_0xc90ad1){_0x1be0fd=_0x1be0fd-0x0;var _0x5a4e57=_0x3b3a[_0x1be0fd];return _0x5a4e57;};'use strict';var _=require('lodash');var util=require(_0xa3b3('0x0'));var moment=require(_0xa3b3('0x1'));var BPromise=require(_0xa3b3('0x2'));var rs=require(_0xa3b3('0x3'));var fs=require('fs');var Redis=require(_0xa3b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3b3('0x5'));var logger=require(_0xa3b3('0x6'))(_0xa3b3('0x7'));var config=require(_0xa3b3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa3b3('0x9')][_0xa3b3('0xa')]({'port':0x232a});config[_0xa3b3('0xb')]=_[_0xa3b3('0xc')](config[_0xa3b3('0xb')],{'host':_0xa3b3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3b3('0xb')]));require(_0xa3b3('0xe'))['register'](socket);function respondWithRpcPromise(_0x8bc38e,_0x2fdc9f,_0x2307cc){return new BPromise(function(_0x56c282,_0xf9a160){return client[_0xa3b3('0xf')](_0x8bc38e,_0x2307cc)['then'](function(_0x4eb8a9){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x2fdc9f,_0xa3b3('0x10'));logger[_0xa3b3('0x11')](_0xa3b3('0x12'),_0x2fdc9f,_0xa3b3('0x10'),JSON[_0xa3b3('0x13')](_0x4eb8a9));if(_0x4eb8a9[_0xa3b3('0x14')]){if(_0x4eb8a9['error']['code']===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x2fdc9f,_0x4eb8a9[_0xa3b3('0x14')][_0xa3b3('0x15')]);return _0xf9a160(_0x4eb8a9['error'][_0xa3b3('0x15')]);}logger[_0xa3b3('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2fdc9f,_0x4eb8a9['error'][_0xa3b3('0x15')]);return _0x56c282(_0x4eb8a9['error'][_0xa3b3('0x15')]);}else{logger[_0xa3b3('0x16')](_0xa3b3('0x17'),_0x2fdc9f,_0xa3b3('0x10'));_0x56c282(_0x4eb8a9[_0xa3b3('0x18')][_0xa3b3('0x15')]);}})[_0xa3b3('0x19')](function(_0x55c2e8){logger[_0xa3b3('0x14')](_0xa3b3('0x17'),_0x2fdc9f,_0x55c2e8);_0xf9a160(_0x55c2e8);});});}exports[_0xa3b3('0x1a')]=function(_0x41dbbf){var _0xbc7827=this;return new Promise(function(_0x5c23d4,_0x1e8173){return db[_0xa3b3('0x1b')][_0xa3b3('0x1c')](_0x41dbbf[_0xa3b3('0x1d')],{'raw':_0x41dbbf['options']?_0x41dbbf[_0xa3b3('0x1e')][_0xa3b3('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41dbbf[_0xa3b3('0x1e')]?_0x41dbbf['options']['where']||null:null,'attributes':_0x41dbbf[_0xa3b3('0x1e')]?_0x41dbbf[_0xa3b3('0x1e')]['attributes']||null:null,'limit':_0x41dbbf[_0xa3b3('0x1e')]?_0x41dbbf[_0xa3b3('0x1e')][_0xa3b3('0x20')]||null:null})[_0xa3b3('0x21')](function(_0x15ffa1){logger[_0xa3b3('0x16')](_0xa3b3('0x1a'),_0x41dbbf);logger[_0xa3b3('0x11')](_0xa3b3('0x1a'),_0x41dbbf,JSON[_0xa3b3('0x13')](_0x15ffa1));_0x5c23d4(_0x15ffa1);})[_0xa3b3('0x19')](function(_0x214252){logger[_0xa3b3('0x14')](_0xa3b3('0x1a'),_0x214252[_0xa3b3('0x15')],_0x41dbbf);_0x1e8173(_0xbc7827['error'](0x1f4,_0x214252['message']));});});};exports[_0xa3b3('0x22')]=function(_0x1b15fa){return new Promise(function(_0x190e72,_0x31b6bb){return db[_0xa3b3('0x1b')][_0xa3b3('0x23')]({'where':_0x1b15fa[_0xa3b3('0x1e')]?_0x1b15fa[_0xa3b3('0x1e')]['where']||null:null})['then'](function(_0x3bfb65){if(_0x3bfb65){return _0x3bfb65['addTags'](_0x1b15fa['body'][_0xa3b3('0x24')],_[_0xa3b3('0x25')](_0x1b15fa[_0xa3b3('0x1d')],[_0xa3b3('0x24'),'id'])||{});}})[_0xa3b3('0x26')](function(_0x43a17f){logger[_0xa3b3('0x16')](_0xa3b3('0x27'),_0x1b15fa);logger[_0xa3b3('0x11')](_0xa3b3('0x27'),_0x1b15fa,JSON[_0xa3b3('0x13')](_0x43a17f));_0x190e72(_0x43a17f);})[_0xa3b3('0x19')](function(_0x5501c1){logger['error']('AddTags',_0x5501c1[_0xa3b3('0x15')],_0x1b15fa);_0x31b6bb(_this[_0xa3b3('0x14')](0x1f4,_0x5501c1[_0xa3b3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e4ecef9..562c400 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 _0x33b4=['emit','removeListener','register','length','./openchannelInteraction.events','save'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x33b4,0x124));var _0x433b=function(_0x4fb74c,_0x32ab4a){_0x4fb74c=_0x4fb74c-0x0;var _0x1400f2=_0x33b4[_0x4fb74c];return _0x1400f2;};'use strict';var OpenchannelInteractionEvents=require(_0x433b('0x0'));var events=[_0x433b('0x1'),'remove','update'];function createListener(_0x378e06,_0x5a7b95){return function(_0xf77214){_0x5a7b95[_0x433b('0x2')](_0x378e06,_0xf77214);};}function removeListener(_0x3f3730,_0x3e70a1){return function(){OpenchannelInteractionEvents[_0x433b('0x3')](_0x3f3730,_0x3e70a1);};}exports[_0x433b('0x4')]=function(_0x971d02){for(var _0x5b91f7=0x0,_0x203dd4=events[_0x433b('0x5')];_0x5b91f7<_0x203dd4;_0x5b91f7++){var _0x3afa99=events[_0x5b91f7];var _0x2e39ca=createListener('openchannelInteraction:'+_0x3afa99,_0x971d02);OpenchannelInteractionEvents['on'](_0x3afa99,_0x2e39ca);}}; \ No newline at end of file +var _0x43db=['register','length','emit','removeListener'];(function(_0x2aa699,_0x376685){var _0x198f6b=function(_0x2f4150){while(--_0x2f4150){_0x2aa699['push'](_0x2aa699['shift']());}};_0x198f6b(++_0x376685);}(_0x43db,0x126));var _0xb43d=function(_0x44ea1b,_0x36bbd3){_0x44ea1b=_0x44ea1b-0x0;var _0x239690=_0x43db[_0x44ea1b];return _0x239690;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save','remove','update'];function createListener(_0x9bc814,_0x574ea8){return function(_0x202f97){_0x574ea8[_0xb43d('0x0')](_0x9bc814,_0x202f97);};}function removeListener(_0x2a82e7,_0x176559){return function(){OpenchannelInteractionEvents[_0xb43d('0x1')](_0x2a82e7,_0x176559);};}exports[_0xb43d('0x2')]=function(_0x1961a8){for(var _0x40cebe=0x0,_0x4c35b2=events[_0xb43d('0x3')];_0x40cebe<_0x4c35b2;_0x40cebe++){var _0x11102f=events[_0x40cebe];var _0xadc336=createListener('openchannelInteraction:'+_0x11102f,_0x1961a8);OpenchannelInteractionEvents['on'](_0x11102f,_0xadc336);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 5b79f41..9e515fe 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 _0xa835=['multer','util','path','express','Router','../../components/auth/service','./openchannelMessage.controller','isAuthenticated','index','get','/describe','/:id','show','post','tracked','openchannelmessage:create','put','accept','/:id/reject','reject','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa835,0x176));var _0x5a83=function(_0x3e8c44,_0x465af8){_0x3e8c44=_0x3e8c44-0x0;var _0x15fc19=_0xa835[_0x3e8c44];return _0x15fc19;};'use strict';var multer=require(_0x5a83('0x0'));var util=require(_0x5a83('0x1'));var path=require(_0x5a83('0x2'));var timeout=require('connect-timeout');var express=require(_0x5a83('0x3'));var router=express[_0x5a83('0x4')]();var auth=require(_0x5a83('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5a83('0x6'));router['get']('/',auth[_0x5a83('0x7')](),controller[_0x5a83('0x8')]);router[_0x5a83('0x9')](_0x5a83('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x5a83('0xb'),auth[_0x5a83('0x7')](),controller[_0x5a83('0xc')]);router[_0x5a83('0xd')]('/',auth[_0x5a83('0x7')](),interaction[_0x5a83('0xe')]('openchannel',_0x5a83('0xf')),controller['create']);router[_0x5a83('0x10')](_0x5a83('0xb'),auth[_0x5a83('0x7')](),controller['update']);router[_0x5a83('0x10')]('/:id/accept',auth[_0x5a83('0x7')](),controller[_0x5a83('0x11')]);router['put'](_0x5a83('0x12'),auth[_0x5a83('0x7')](),controller[_0x5a83('0x13')]);router[_0x5a83('0x14')](_0x5a83('0xb'),auth[_0x5a83('0x7')](),controller[_0x5a83('0x15')]);module['exports']=router; \ No newline at end of file +var _0x241c=['express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','describe','show','post','tracked','openchannelmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x30ea0d,_0x17aa56){var _0x55699e=function(_0x52a83f){while(--_0x52a83f){_0x30ea0d['push'](_0x30ea0d['shift']());}};_0x55699e(++_0x17aa56);}(_0x241c,0x1c7));var _0xc241=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x241c[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc241('0x0'));var util=require(_0xc241('0x1'));var path=require(_0xc241('0x2'));var timeout=require(_0xc241('0x3'));var express=require(_0xc241('0x4'));var router=express[_0xc241('0x5')]();var auth=require(_0xc241('0x6'));var interaction=require(_0xc241('0x7'));var config=require('../../config/environment');var controller=require(_0xc241('0x8'));router[_0xc241('0x9')]('/',auth[_0xc241('0xa')](),controller['index']);router[_0xc241('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xc241('0xb')]);router[_0xc241('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc241('0xc')]);router[_0xc241('0xd')]('/',auth[_0xc241('0xa')](),interaction[_0xc241('0xe')]('openchannel',_0xc241('0xf')),controller[_0xc241('0x10')]);router[_0xc241('0x11')](_0xc241('0x12'),auth[_0xc241('0xa')](),controller[_0xc241('0x13')]);router[_0xc241('0x11')](_0xc241('0x14'),auth[_0xc241('0xa')](),controller[_0xc241('0x15')]);router[_0xc241('0x11')](_0xc241('0x16'),auth[_0xc241('0xa')](),controller[_0xc241('0x17')]);router[_0xc241('0x18')](_0xc241('0x12'),auth[_0xc241('0xa')](),controller[_0xc241('0x19')]);module[_0xc241('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 449f674..cc82a5a 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 _0x78dc=['STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x78dc,0x13a));var _0xc78d=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x78dc[_0x158da6];return _0x429c30;};'use strict';var Sequelize=require(_0xc78d('0x0'));module[_0xc78d('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc78d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc78d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc78d('0x4')]('in',_0xc78d('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc78d('0x6')]},'providerResponse':{'type':Sequelize[_0xc78d('0x7')]}}; \ No newline at end of file +var _0xa938=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x2835b8,_0x2038aa){var _0x4111d0=function(_0x56ae66){while(--_0x56ae66){_0x2835b8['push'](_0x2835b8['shift']());}};_0x4111d0(++_0x2038aa);}(_0xa938,0x92));var _0x8a93=function(_0x2e39ff,_0x34e9ca){_0x2e39ff=_0x2e39ff-0x0;var _0x253f7b=_0xa938[_0x2e39ff];return _0x253f7b;};'use strict';var Sequelize=require(_0x8a93('0x0'));module[_0x8a93('0x1')]={'body':{'type':Sequelize[_0x8a93('0x2')](_0x8a93('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8a93('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8a93('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8a93('0x5')]('in','out'),'defaultValue':_0x8a93('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x8a93('0x7')]},'providerResponse':{'type':Sequelize[_0x8a93('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 4b85abf..d07816b 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 _0x5a59=['key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','html-pdf','rimraf','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type'];(function(_0x5a5722,_0xdbec98){var _0x5d8b5b=function(_0x5034ea){while(--_0x5034ea){_0x5a5722['push'](_0x5a5722['shift']());}};_0x5d8b5b(++_0xdbec98);}(_0x5a59,0xb6));var _0x95a5=function(_0x335f4e,_0x1b49c1){_0x335f4e=_0x335f4e-0x0;var _0x57e754=_0x5a59[_0x335f4e];return _0x57e754;};'use strict';var pdf=require(_0x95a5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x95a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x95a5('0x2'));var moment=require(_0x95a5('0x3'));var BPromise=require(_0x95a5('0x4'));var Mustache=require(_0x95a5('0x5'));var util=require(_0x95a5('0x6'));var path=require(_0x95a5('0x7'));var sox=require(_0x95a5('0x8'));var csv=require(_0x95a5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x95a5('0xa'));var squel=require(_0x95a5('0xb'));var crypto=require(_0x95a5('0xc'));var jsforce=require(_0x95a5('0xd'));var deskjs=require(_0x95a5('0xe'));var toCsv=require(_0x95a5('0x9'));var querystring=require(_0x95a5('0xf'));var Papa=require(_0x95a5('0x10'));var Redis=require(_0x95a5('0x11'));var authService=require(_0x95a5('0x12'));var qs=require(_0x95a5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95a5('0x14'));var logger=require(_0x95a5('0x15'))(_0x95a5('0x16'));var utils=require(_0x95a5('0x17'));var config=require(_0x95a5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x95a5('0x19'))['db'];config[_0x95a5('0x1a')]=_[_0x95a5('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x95a5('0x1c'))(new Redis(config[_0x95a5('0x1a')]));require(_0x95a5('0x1d'))[_0x95a5('0x1e')](socket);var jayson=require(_0x95a5('0x1f'));var client=jayson[_0x95a5('0x20')][_0x95a5('0x21')]({'port':0x232c});var client9002=jayson[_0x95a5('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x744439,_0x1aafb5,_0x2932d7,_0x1d8e2f){return new BPromise(function(_0x2d00b5,_0xfea76e){var _0x22c460=_0x1d8e2f||client;return _0x22c460['request'](_0x744439,_0x2932d7)['then'](function(_0x2d8c54){logger[_0x95a5('0x22')](_0x95a5('0x23'),_0x1aafb5,_0x95a5('0x24'));logger['debug'](_0x95a5('0x25'),_0x1aafb5,_0x95a5('0x24'),JSON[_0x95a5('0x26')](_0x2d8c54));if(_0x2d8c54[_0x95a5('0x27')]){if(_0x2d8c54[_0x95a5('0x27')][_0x95a5('0x28')]===0x1f4){logger[_0x95a5('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x1aafb5,_0x2d8c54[_0x95a5('0x27')][_0x95a5('0x29')]);return _0xfea76e(_0x2d8c54['error'][_0x95a5('0x29')]);}logger['error'](_0x95a5('0x23'),_0x1aafb5,_0x2d8c54['error'][_0x95a5('0x29')]);return _0x2d00b5(_0x2d8c54[_0x95a5('0x27')][_0x95a5('0x29')]);}else{logger[_0x95a5('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x1aafb5,_0x95a5('0x24'));_0x2d00b5(_0x2d8c54[_0x95a5('0x2a')]['message']);}})[_0x95a5('0x2b')](function(_0x1c82a8){logger['error'](_0x95a5('0x23'),_0x1aafb5,_0x1c82a8);_0xfea76e(_0x1c82a8);});});}function respondWithStatusCode(_0x3a47e9,_0x32b10e){_0x32b10e=_0x32b10e||0xcc;return function(_0x58ff39){if(_0x58ff39){return _0x3a47e9[_0x95a5('0x2c')](_0x32b10e);}return _0x3a47e9[_0x95a5('0x2d')](_0x32b10e)[_0x95a5('0x2e')]();};}function respondWithResult(_0x222388,_0x397a9d){_0x397a9d=_0x397a9d||0xc8;return function(_0x2a88c9){if(_0x2a88c9){return _0x222388[_0x95a5('0x2d')](_0x397a9d)['json'](_0x2a88c9);}};}function respondWithFilteredResult(_0x55c7cb,_0x1a8f42){return function(_0x16065c){if(_0x16065c){var _0x2dc661=_0x16065c[_0x95a5('0x2f')],_0x2080fa=_0x1a8f42[_0x95a5('0x30')],_0x48566e=_0x1a8f42[_0x95a5('0x30')]+_0x1a8f42[_0x95a5('0x31')],_0x230a7a;if(_0x48566e>=_0x2dc661){_0x48566e=_0x2dc661;_0x230a7a=0xc8;}else{_0x230a7a=0xce;}_0x55c7cb[_0x95a5('0x2d')](_0x230a7a);return _0x55c7cb[_0x95a5('0x32')](_0x95a5('0x33'),_0x2080fa+'-'+_0x48566e+'/'+_0x2dc661)[_0x95a5('0x34')](_0x16065c);}return null;};}function patchUpdates(_0x5b2bd6){return function(_0x54f03c){try{jsonpatch[_0x95a5('0x35')](_0x54f03c,_0x5b2bd6,!![]);}catch(_0x346e68){return BPromise[_0x95a5('0x36')](_0x346e68);}return _0x54f03c[_0x95a5('0x37')]();};}function saveUpdates(_0x3f5d54,_0x3344c4){return function(_0x3c8ed1){if(_0x3c8ed1){return _0x3c8ed1[_0x95a5('0x38')](_0x3f5d54)[_0x95a5('0x39')](function(_0x5e6616){return _0x5e6616;});}return null;};}function removeEntity(_0x216ff2,_0xbea07f){return function(_0x426ece){if(_0x426ece){return _0x426ece[_0x95a5('0x3a')]()[_0x95a5('0x39')](function(){_0x216ff2[_0x95a5('0x2d')](0xcc)[_0x95a5('0x2e')]();});}};}function handleEntityNotFound(_0x402af4,_0x555788){return function(_0xda88ce){if(!_0xda88ce){_0x402af4[_0x95a5('0x2c')](0x194);}return _0xda88ce;};}function handleError(_0x22de0e,_0x502aab){_0x502aab=_0x502aab||0x1f4;return function(_0x155b84){logger[_0x95a5('0x27')](_0x155b84['stack']);if(_0x155b84[_0x95a5('0x3b')]){delete _0x155b84[_0x95a5('0x3b')];}_0x22de0e['status'](_0x502aab)['send'](_0x155b84);};}exports[_0x95a5('0x3c')]=function(_0xe58e2f,_0x54f9a9){var _0x33e8fd={},_0x4add2e={},_0x2c435e={'count':0x0,'rows':[]};var _0x45ae07=_[_0x95a5('0x3d')](db[_0x95a5('0x3e')][_0x95a5('0x3f')],function(_0x3f1211){return{'name':_0x3f1211[_0x95a5('0x40')],'type':_0x3f1211[_0x95a5('0x41')][_0x95a5('0x42')]};});_0x4add2e[_0x95a5('0x43')]=_[_0x95a5('0x3d')](_0x45ae07,_0x95a5('0x3b'));_0x4add2e['query']=_['keys'](_0xe58e2f[_0x95a5('0x44')]);_0x4add2e['filters']=_[_0x95a5('0x45')](_0x4add2e[_0x95a5('0x43')],_0x4add2e['query']);_0x33e8fd[_0x95a5('0x46')]=_[_0x95a5('0x45')](_0x4add2e[_0x95a5('0x43')],qs[_0x95a5('0x47')](_0xe58e2f[_0x95a5('0x44')]['fields']));_0x33e8fd[_0x95a5('0x46')]=_0x33e8fd[_0x95a5('0x46')][_0x95a5('0x48')]?_0x33e8fd[_0x95a5('0x46')]:_0x4add2e[_0x95a5('0x43')];if(!_0xe58e2f[_0x95a5('0x44')]['hasOwnProperty'](_0x95a5('0x49'))){_0x33e8fd[_0x95a5('0x31')]=qs[_0x95a5('0x31')](_0xe58e2f[_0x95a5('0x44')][_0x95a5('0x31')]);_0x33e8fd['offset']=qs['offset'](_0xe58e2f[_0x95a5('0x44')][_0x95a5('0x30')]);}_0x33e8fd[_0x95a5('0x4a')]=qs[_0x95a5('0x4b')](_0xe58e2f[_0x95a5('0x44')][_0x95a5('0x4b')]);_0x33e8fd[_0x95a5('0x4c')]=qs[_0x95a5('0x4d')](_[_0x95a5('0x4e')](_0xe58e2f[_0x95a5('0x44')],_0x4add2e[_0x95a5('0x4d')]),_0x45ae07);if(_0xe58e2f[_0x95a5('0x44')][_0x95a5('0x4f')]){_0x33e8fd[_0x95a5('0x4c')]=_[_0x95a5('0x50')](_0x33e8fd[_0x95a5('0x4c')],{'$or':_[_0x95a5('0x3d')](_0x45ae07,function(_0x42d736){if(_0x42d736[_0x95a5('0x41')]!==_0x95a5('0x51')){var _0x5da489={};_0x5da489[_0x42d736['name']]={'$like':'%'+_0xe58e2f[_0x95a5('0x44')][_0x95a5('0x4f')]+'%'};return _0x5da489;}})});}_0x33e8fd=_[_0x95a5('0x50')]({},_0x33e8fd,_0xe58e2f[_0x95a5('0x52')]);var _0x1cdcce={'where':_0x33e8fd[_0x95a5('0x4c')]};return db['OpenchannelMessage'][_0x95a5('0x2f')](_0x1cdcce)[_0x95a5('0x39')](function(_0x555d8e){_0x2c435e[_0x95a5('0x2f')]=_0x555d8e;if(_0xe58e2f[_0x95a5('0x44')][_0x95a5('0x53')]){_0x33e8fd[_0x95a5('0x54')]=[{'all':!![]}];}return db[_0x95a5('0x3e')][_0x95a5('0x55')](_0x33e8fd);})['then'](function(_0x35de33){_0x2c435e[_0x95a5('0x56')]=_0x35de33;return _0x2c435e;})[_0x95a5('0x39')](respondWithFilteredResult(_0x54f9a9,_0x33e8fd))[_0x95a5('0x2b')](handleError(_0x54f9a9,null));};exports[_0x95a5('0x57')]=function(_0x4895cf,_0x391547){var _0x5be82b={'raw':!![],'where':{'id':_0x4895cf['params']['id']}},_0x2a2028={};_0x2a2028[_0x95a5('0x43')]=_[_0x95a5('0x58')](db[_0x95a5('0x3e')]['rawAttributes']);_0x2a2028[_0x95a5('0x44')]=_[_0x95a5('0x58')](_0x4895cf[_0x95a5('0x44')]);_0x2a2028['filters']=_[_0x95a5('0x45')](_0x2a2028['model'],_0x2a2028[_0x95a5('0x44')]);_0x5be82b[_0x95a5('0x46')]=_[_0x95a5('0x45')](_0x2a2028['model'],qs[_0x95a5('0x47')](_0x4895cf[_0x95a5('0x44')][_0x95a5('0x47')]));_0x5be82b[_0x95a5('0x46')]=_0x5be82b[_0x95a5('0x46')][_0x95a5('0x48')]?_0x5be82b[_0x95a5('0x46')]:_0x2a2028['model'];if(_0x4895cf[_0x95a5('0x44')][_0x95a5('0x53')]){_0x5be82b[_0x95a5('0x54')]=[{'all':!![]}];}_0x5be82b=_[_0x95a5('0x50')]({},_0x5be82b,_0x4895cf[_0x95a5('0x52')]);return db['OpenchannelMessage'][_0x95a5('0x59')](_0x5be82b)[_0x95a5('0x39')](handleEntityNotFound(_0x391547,null))[_0x95a5('0x39')](respondWithResult(_0x391547,null))[_0x95a5('0x2b')](handleError(_0x391547,null));};exports[_0x95a5('0x5a')]=function(_0x126746,_0x34d368){return db[_0x95a5('0x3e')][_0x95a5('0x5a')](_0x126746[_0x95a5('0x5b')],{})['then'](respondWithResult(_0x34d368,0xc9))['catch'](handleError(_0x34d368,null));};exports['update']=function(_0x52a5f5,_0x1b1ff6){if(_0x52a5f5[_0x95a5('0x5b')]['id']){delete _0x52a5f5[_0x95a5('0x5b')]['id'];}return db[_0x95a5('0x3e')][_0x95a5('0x59')]({'where':{'id':_0x52a5f5[_0x95a5('0x5c')]['id']}})[_0x95a5('0x39')](handleEntityNotFound(_0x1b1ff6,null))['then'](saveUpdates(_0x52a5f5[_0x95a5('0x5b')],null))['then'](respondWithResult(_0x1b1ff6,null))[_0x95a5('0x2b')](handleError(_0x1b1ff6,null));};exports[_0x95a5('0x3a')]=function(_0x5ea907,_0x532a68){return db[_0x95a5('0x3e')][_0x95a5('0x59')]({'where':{'id':_0x5ea907[_0x95a5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x532a68,null))[_0x95a5('0x39')](removeEntity(_0x532a68,null))['catch'](handleError(_0x532a68,null));};exports[_0x95a5('0x5d')]=function(_0x3cce7e,_0x292dae){return db[_0x95a5('0x3e')]['describe']()[_0x95a5('0x39')](respondWithResult(_0x292dae,null))[_0x95a5('0x2b')](handleError(_0x292dae,null));};var interaction_log=require(_0x95a5('0x15'))(_0x95a5('0x5e'));exports[_0x95a5('0x5f')]=function(_0x439a09,_0xfa71e2,_0x4ee3bb){var _0x44de23={'agent':{},'channel':_0x95a5('0x60')};if(_0x439a09[_0x95a5('0x5b')]['id']){delete _0x439a09[_0x95a5('0x5b')]['id'];}_0x439a09[_0x95a5('0x5b')]['read']=!![];_0x439a09[_0x95a5('0x5b')][_0x95a5('0x61')]=moment()[_0x95a5('0x62')](_0x95a5('0x63'));_0x439a09[_0x95a5('0x5b')]['UserId']=_0x439a09[_0x95a5('0x5b')][_0x95a5('0x64')]||_0x439a09[_0x95a5('0x65')]['id'];_0x44de23['agent']['id']=_0x439a09[_0x95a5('0x5b')][_0x95a5('0x64')];return db['OpenchannelMessage'][_0x95a5('0x59')]({'where':{'id':_0x439a09['params']['id'],'UserId':null},'include':[{'model':db[_0x95a5('0x66')],'as':_0x95a5('0x67')}]})[_0x95a5('0x39')](handleEntityNotFound(_0xfa71e2,null))[_0x95a5('0x39')](saveUpdates(_0x439a09[_0x95a5('0x5b')],null))[_0x95a5('0x39')](function(_0x4707cc){if(_0x4707cc){_0x44de23[_0x95a5('0x29')]=_0x4707cc[_0x95a5('0x68')]({'plain':!![]});return db['OpenchannelInteraction'][_0x95a5('0x59')]({'where':{'id':_0x4707cc[_0x95a5('0x69')]}});}return null;})[_0x95a5('0x39')](handleEntityNotFound(_0xfa71e2,null))[_0x95a5('0x39')](function(_0x5ac476){if(_0x5ac476){return _0x5ac476[_0x95a5('0x38')]({'UserId':_0x439a09[_0x95a5('0x5b')][_0x95a5('0x64')],'read1stAt':_[_0x95a5('0x6a')](_0x5ac476['read1stAt'])?moment()[_0x95a5('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x95a5('0x39')](function(_0x35fac1){if(_0x35fac1){_0x44de23[_0x95a5('0x6b')]=_0x35fac1[_0x95a5('0x68')]({'plain':!![]});interaction_log[_0x95a5('0x22')](_0x95a5('0x6c'),_0x439a09['user']['id'],_0x439a09[_0x95a5('0x65')][_0x95a5('0x3b')],_0x439a09[_0x95a5('0x65')][_0x95a5('0x6d')],_0x44de23['interaction']['id'],_0x439a09[_0x95a5('0x5b')]?JSON['stringify'](_0x439a09[_0x95a5('0x5b')]):_0x95a5('0x6e'));return respondWithRpcPromise(_0x95a5('0x6f'),_0x95a5('0x70'),_0x44de23);}return null;})[_0x95a5('0x39')](function(_0x851cfa){if(_0x851cfa){if(_0x439a09[_0x95a5('0x5b')]['manual']){_0x44de23[_0x95a5('0x29')][_0x95a5('0x71')]=util[_0x95a5('0x62')](_0x95a5('0x72'),_0x439a09[_0x95a5('0x65')][_0x95a5('0x3b')]);_0x44de23['message']['channel']=_0x44de23[_0x95a5('0x73')];_0x44de23[_0x95a5('0x29')][_0x95a5('0x74')]=_0x95a5('0x5f');return respondWithRpcPromise(_0x95a5('0x75'),'EventManager',{'event':_0x95a5('0x76'),'message':_0x44de23[_0x95a5('0x29')]},client9002)[_0x95a5('0x39')](function(){return _0x44de23;});}return _0x44de23;}return null;})['then'](respondWithResult(_0xfa71e2,null))[_0x95a5('0x2b')](handleError(_0xfa71e2,null));};var interaction_log=require(_0x95a5('0x15'))(_0x95a5('0x5e'));exports['reject']=function(_0x17af4f,_0x2d5473,_0x177e77){var _0x8254a5={'agent':{},'channel':'openchannel'};if(_0x17af4f[_0x95a5('0x5b')]['id']){delete _0x17af4f[_0x95a5('0x5b')]['id'];}_0x17af4f[_0x95a5('0x5b')][_0x95a5('0x64')]=_0x17af4f[_0x95a5('0x5b')][_0x95a5('0x64')]||_0x17af4f[_0x95a5('0x65')]['id'];_0x8254a5[_0x95a5('0x77')]['id']=_0x17af4f[_0x95a5('0x5b')][_0x95a5('0x64')];return db[_0x95a5('0x3e')]['find']({'where':{'id':_0x17af4f['params']['id'],'UserId':null}})[_0x95a5('0x39')](handleEntityNotFound(_0x2d5473,null))['then'](function(_0x3ad9ea){if(_0x3ad9ea){_0x8254a5[_0x95a5('0x29')]=_0x3ad9ea[_0x95a5('0x68')]({'plain':!![]});return db[_0x95a5('0x78')][_0x95a5('0x59')]({'where':{'id':_0x3ad9ea[_0x95a5('0x69')]}});}return null;})[_0x95a5('0x39')](handleEntityNotFound(_0x2d5473,null))['then'](function(_0x448331){if(_0x448331){_0x8254a5[_0x95a5('0x6b')]=_0x448331['get']({'plain':!![]});interaction_log[_0x95a5('0x22')](_0x95a5('0x79'),_0x17af4f[_0x95a5('0x65')]['id'],_0x17af4f[_0x95a5('0x65')]['name'],_0x17af4f[_0x95a5('0x65')][_0x95a5('0x6d')],_0x8254a5[_0x95a5('0x6b')]['id'],_0x17af4f['body']?JSON[_0x95a5('0x26')](_0x17af4f[_0x95a5('0x5b')]):_0x95a5('0x6e'));return respondWithRpcPromise('RejectMessage',_0x95a5('0x7a'),_0x8254a5);}return null;})[_0x95a5('0x39')](function(_0x4280ca){if(_0x4280ca){_0x4280ca[_0x95a5('0x29')][_0x95a5('0x71')]=util[_0x95a5('0x62')](_0x95a5('0x72'),_0x17af4f[_0x95a5('0x65')][_0x95a5('0x3b')]);_0x4280ca[_0x95a5('0x29')]['channel']=_0x8254a5['channel'];_0x4280ca['message'][_0x95a5('0x74')]=_0x95a5('0x36');respondWithRpcPromise('EventManager',_0x95a5('0x75'),{'event':_0x95a5('0x7b'),'message':_0x4280ca['message']},client9002);return _0x8254a5;}return null;})['then'](respondWithResult(_0x2d5473,null))[_0x95a5('0x2b')](handleError(_0x2d5473,null));}; \ No newline at end of file +var _0x4daa=['accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','interface','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','destroy','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','find','create','update','body','params','describe','openchannel-interactions','openchannel','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','manual','SIP/%s','channel','event'];(function(_0x2c3775,_0x145f1b){var _0x2d78ff=function(_0x129318){while(--_0x129318){_0x2c3775['push'](_0x2c3775['shift']());}};_0x2d78ff(++_0x145f1b);}(_0x4daa,0x7d));var _0xa4da=function(_0x1811e0,_0x487da0){_0x1811e0=_0x1811e0-0x0;var _0x3ce439=_0x4daa[_0x1811e0];return _0x3ce439;};'use strict';var pdf=require(_0xa4da('0x0'));var emlformat=require(_0xa4da('0x1'));var rimraf=require(_0xa4da('0x2'));var zipdir=require(_0xa4da('0x3'));var jsonpatch=require(_0xa4da('0x4'));var rp=require(_0xa4da('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa4da('0x6'));var util=require(_0xa4da('0x7'));var path=require(_0xa4da('0x8'));var sox=require(_0xa4da('0x9'));var csv=require(_0xa4da('0xa'));var ejs=require(_0xa4da('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa4da('0xc'));var jsforce=require(_0xa4da('0xd'));var deskjs=require(_0xa4da('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa4da('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa4da('0x10'));var qs=require(_0xa4da('0x11'));var as=require(_0xa4da('0x12'));var hardwareService=require(_0xa4da('0x13'));var logger=require(_0xa4da('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xa4da('0x15'));var licenseUtil=require(_0xa4da('0x16'));var db=require(_0xa4da('0x17'))['db'];config['redis']=_[_0xa4da('0x18')](config[_0xa4da('0x19')],{'host':_0xa4da('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa4da('0x19')]));require(_0xa4da('0x1b'))['register'](socket);var jayson=require(_0xa4da('0x1c'));var client=jayson[_0xa4da('0x1d')][_0xa4da('0x1e')]({'port':0x232c});var client9002=jayson[_0xa4da('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19363a,_0x33e910,_0x364b2d,_0x272f05){return new BPromise(function(_0x5132e8,_0x105640){var _0x589713=_0x272f05||client;return _0x589713[_0xa4da('0x1f')](_0x19363a,_0x364b2d)[_0xa4da('0x20')](function(_0x5b9e09){logger[_0xa4da('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x33e910,'request\x20sent');logger[_0xa4da('0x22')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x33e910,_0xa4da('0x23'),JSON['stringify'](_0x5b9e09));if(_0x5b9e09['error']){if(_0x5b9e09[_0xa4da('0x24')][_0xa4da('0x25')]===0x1f4){logger['error'](_0xa4da('0x26'),_0x33e910,_0x5b9e09[_0xa4da('0x24')][_0xa4da('0x27')]);return _0x105640(_0x5b9e09['error'][_0xa4da('0x27')]);}logger[_0xa4da('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x33e910,_0x5b9e09[_0xa4da('0x24')][_0xa4da('0x27')]);return _0x5132e8(_0x5b9e09[_0xa4da('0x24')][_0xa4da('0x27')]);}else{logger[_0xa4da('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x33e910,'request\x20sent');_0x5132e8(_0x5b9e09[_0xa4da('0x28')][_0xa4da('0x27')]);}})[_0xa4da('0x29')](function(_0x3c3d9a){logger[_0xa4da('0x24')](_0xa4da('0x26'),_0x33e910,_0x3c3d9a);_0x105640(_0x3c3d9a);});});}function respondWithStatusCode(_0x1db40c,_0x5a4de7){_0x5a4de7=_0x5a4de7||0xcc;return function(_0x14033b){if(_0x14033b){return _0x1db40c[_0xa4da('0x2a')](_0x5a4de7);}return _0x1db40c[_0xa4da('0x2b')](_0x5a4de7)[_0xa4da('0x2c')]();};}function respondWithResult(_0x53e401,_0x4cfb9e){_0x4cfb9e=_0x4cfb9e||0xc8;return function(_0x2ba5a2){if(_0x2ba5a2){return _0x53e401[_0xa4da('0x2b')](_0x4cfb9e)[_0xa4da('0x2d')](_0x2ba5a2);}};}function respondWithFilteredResult(_0x41f9e9,_0x3c571d){return function(_0x585f86){if(_0x585f86){var _0x2f14d1=_0x585f86[_0xa4da('0x2e')],_0x36fe74=_0x3c571d[_0xa4da('0x2f')],_0x7bbb56=_0x3c571d[_0xa4da('0x2f')]+_0x3c571d[_0xa4da('0x30')],_0x5bad55;if(_0x7bbb56>=_0x2f14d1){_0x7bbb56=_0x2f14d1;_0x5bad55=0xc8;}else{_0x5bad55=0xce;}_0x41f9e9[_0xa4da('0x2b')](_0x5bad55);return _0x41f9e9['set'](_0xa4da('0x31'),_0x36fe74+'-'+_0x7bbb56+'/'+_0x2f14d1)['json'](_0x585f86);}return null;};}function patchUpdates(_0xc54441){return function(_0x42d6bd){try{jsonpatch['apply'](_0x42d6bd,_0xc54441,!![]);}catch(_0x2e1a36){return BPromise[_0xa4da('0x32')](_0x2e1a36);}return _0x42d6bd['save']();};}function saveUpdates(_0x15be41,_0xbc9d77){return function(_0x32c277){if(_0x32c277){return _0x32c277['update'](_0x15be41)[_0xa4da('0x20')](function(_0x325f33){return _0x325f33;});}return null;};}function removeEntity(_0x5b6d6c,_0xaa8ede){return function(_0x45c733){if(_0x45c733){return _0x45c733[_0xa4da('0x33')]()['then'](function(){_0x5b6d6c[_0xa4da('0x2b')](0xcc)[_0xa4da('0x2c')]();});}};}function handleEntityNotFound(_0xf31475,_0x280ba8){return function(_0x515e57){if(!_0x515e57){_0xf31475[_0xa4da('0x2a')](0x194);}return _0x515e57;};}function handleError(_0x4df4fc,_0x3aa1aa){_0x3aa1aa=_0x3aa1aa||0x1f4;return function(_0x214647){logger[_0xa4da('0x24')](_0x214647['stack']);if(_0x214647[_0xa4da('0x34')]){delete _0x214647[_0xa4da('0x34')];}_0x4df4fc[_0xa4da('0x2b')](_0x3aa1aa)[_0xa4da('0x35')](_0x214647);};}exports['index']=function(_0x222dff,_0x245664){var _0x12b6a2={},_0x42a204={},_0x290062={'count':0x0,'rows':[]};var _0x5bb764=_[_0xa4da('0x36')](db[_0xa4da('0x37')][_0xa4da('0x38')],function(_0x5d61fc){return{'name':_0x5d61fc[_0xa4da('0x39')],'type':_0x5d61fc[_0xa4da('0x3a')][_0xa4da('0x3b')]};});_0x42a204[_0xa4da('0x3c')]=_['map'](_0x5bb764,_0xa4da('0x34'));_0x42a204[_0xa4da('0x3d')]=_[_0xa4da('0x3e')](_0x222dff['query']);_0x42a204[_0xa4da('0x3f')]=_[_0xa4da('0x40')](_0x42a204[_0xa4da('0x3c')],_0x42a204[_0xa4da('0x3d')]);_0x12b6a2[_0xa4da('0x41')]=_[_0xa4da('0x40')](_0x42a204[_0xa4da('0x3c')],qs[_0xa4da('0x42')](_0x222dff['query']['fields']));_0x12b6a2[_0xa4da('0x41')]=_0x12b6a2[_0xa4da('0x41')][_0xa4da('0x43')]?_0x12b6a2[_0xa4da('0x41')]:_0x42a204[_0xa4da('0x3c')];if(!_0x222dff['query'][_0xa4da('0x44')]('nolimit')){_0x12b6a2[_0xa4da('0x30')]=qs['limit'](_0x222dff[_0xa4da('0x3d')][_0xa4da('0x30')]);_0x12b6a2[_0xa4da('0x2f')]=qs['offset'](_0x222dff[_0xa4da('0x3d')][_0xa4da('0x2f')]);}_0x12b6a2[_0xa4da('0x45')]=qs[_0xa4da('0x46')](_0x222dff[_0xa4da('0x3d')][_0xa4da('0x46')]);_0x12b6a2['where']=qs[_0xa4da('0x3f')](_[_0xa4da('0x47')](_0x222dff[_0xa4da('0x3d')],_0x42a204['filters']),_0x5bb764);if(_0x222dff[_0xa4da('0x3d')][_0xa4da('0x48')]){_0x12b6a2['where']=_[_0xa4da('0x49')](_0x12b6a2[_0xa4da('0x4a')],{'$or':_[_0xa4da('0x36')](_0x5bb764,function(_0x4b4d22){if(_0x4b4d22[_0xa4da('0x3a')]!=='VIRTUAL'){var _0x55b6fb={};_0x55b6fb[_0x4b4d22['name']]={'$like':'%'+_0x222dff['query']['filter']+'%'};return _0x55b6fb;}})});}_0x12b6a2=_[_0xa4da('0x49')]({},_0x12b6a2,_0x222dff[_0xa4da('0x4b')]);var _0x2ad107={'where':_0x12b6a2[_0xa4da('0x4a')]};return db[_0xa4da('0x37')]['count'](_0x2ad107)['then'](function(_0x921b06){_0x290062[_0xa4da('0x2e')]=_0x921b06;if(_0x222dff[_0xa4da('0x3d')][_0xa4da('0x4c')]){_0x12b6a2[_0xa4da('0x4d')]=[{'all':!![]}];}return db[_0xa4da('0x37')][_0xa4da('0x4e')](_0x12b6a2);})[_0xa4da('0x20')](function(_0x2693f6){_0x290062[_0xa4da('0x4f')]=_0x2693f6;return _0x290062;})['then'](respondWithFilteredResult(_0x245664,_0x12b6a2))['catch'](handleError(_0x245664,null));};exports[_0xa4da('0x50')]=function(_0x3711b7,_0x2abdd7){var _0x57917e={'raw':!![],'where':{'id':_0x3711b7['params']['id']}},_0x5cb81b={};_0x5cb81b['model']=_[_0xa4da('0x3e')](db[_0xa4da('0x37')][_0xa4da('0x38')]);_0x5cb81b[_0xa4da('0x3d')]=_[_0xa4da('0x3e')](_0x3711b7['query']);_0x5cb81b[_0xa4da('0x3f')]=_[_0xa4da('0x40')](_0x5cb81b[_0xa4da('0x3c')],_0x5cb81b[_0xa4da('0x3d')]);_0x57917e['attributes']=_[_0xa4da('0x40')](_0x5cb81b[_0xa4da('0x3c')],qs[_0xa4da('0x42')](_0x3711b7['query'][_0xa4da('0x42')]));_0x57917e[_0xa4da('0x41')]=_0x57917e[_0xa4da('0x41')][_0xa4da('0x43')]?_0x57917e[_0xa4da('0x41')]:_0x5cb81b['model'];if(_0x3711b7[_0xa4da('0x3d')]['includeAll']){_0x57917e[_0xa4da('0x4d')]=[{'all':!![]}];}_0x57917e=_[_0xa4da('0x49')]({},_0x57917e,_0x3711b7[_0xa4da('0x4b')]);return db[_0xa4da('0x37')][_0xa4da('0x51')](_0x57917e)[_0xa4da('0x20')](handleEntityNotFound(_0x2abdd7,null))[_0xa4da('0x20')](respondWithResult(_0x2abdd7,null))[_0xa4da('0x29')](handleError(_0x2abdd7,null));};exports[_0xa4da('0x52')]=function(_0x469ec8,_0x1c2b5a){return db[_0xa4da('0x37')][_0xa4da('0x52')](_0x469ec8['body'],{})[_0xa4da('0x20')](respondWithResult(_0x1c2b5a,0xc9))[_0xa4da('0x29')](handleError(_0x1c2b5a,null));};exports[_0xa4da('0x53')]=function(_0x21a15d,_0x4e0a1e){if(_0x21a15d[_0xa4da('0x54')]['id']){delete _0x21a15d[_0xa4da('0x54')]['id'];}return db[_0xa4da('0x37')][_0xa4da('0x51')]({'where':{'id':_0x21a15d[_0xa4da('0x55')]['id']}})[_0xa4da('0x20')](handleEntityNotFound(_0x4e0a1e,null))[_0xa4da('0x20')](saveUpdates(_0x21a15d[_0xa4da('0x54')],null))['then'](respondWithResult(_0x4e0a1e,null))[_0xa4da('0x29')](handleError(_0x4e0a1e,null));};exports['destroy']=function(_0x146212,_0x1c378c){return db[_0xa4da('0x37')][_0xa4da('0x51')]({'where':{'id':_0x146212[_0xa4da('0x55')]['id']}})[_0xa4da('0x20')](handleEntityNotFound(_0x1c378c,null))[_0xa4da('0x20')](removeEntity(_0x1c378c,null))[_0xa4da('0x29')](handleError(_0x1c378c,null));};exports[_0xa4da('0x56')]=function(_0x4f4fc1,_0x2fa8b1){return db[_0xa4da('0x37')]['describe']()[_0xa4da('0x20')](respondWithResult(_0x2fa8b1,null))['catch'](handleError(_0x2fa8b1,null));};var interaction_log=require('../../config/logger')(_0xa4da('0x57'));exports['accept']=function(_0x311e17,_0x2b77a4,_0x2ae768){var _0x25d39f={'agent':{},'channel':_0xa4da('0x58')};if(_0x311e17[_0xa4da('0x54')]['id']){delete _0x311e17[_0xa4da('0x54')]['id'];}_0x311e17[_0xa4da('0x54')]['read']=!![];_0x311e17[_0xa4da('0x54')][_0xa4da('0x59')]=moment()['format'](_0xa4da('0x5a'));_0x311e17[_0xa4da('0x54')][_0xa4da('0x5b')]=_0x311e17['body'][_0xa4da('0x5b')]||_0x311e17[_0xa4da('0x5c')]['id'];_0x25d39f[_0xa4da('0x5d')]['id']=_0x311e17[_0xa4da('0x54')][_0xa4da('0x5b')];return db[_0xa4da('0x37')][_0xa4da('0x51')]({'where':{'id':_0x311e17[_0xa4da('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xa4da('0x5e')],'as':_0xa4da('0x5f')}]})[_0xa4da('0x20')](handleEntityNotFound(_0x2b77a4,null))[_0xa4da('0x20')](saveUpdates(_0x311e17['body'],null))[_0xa4da('0x20')](function(_0x3d2174){if(_0x3d2174){_0x25d39f[_0xa4da('0x27')]=_0x3d2174[_0xa4da('0x60')]({'plain':!![]});return db[_0xa4da('0x61')][_0xa4da('0x51')]({'where':{'id':_0x3d2174[_0xa4da('0x62')]}});}return null;})[_0xa4da('0x20')](handleEntityNotFound(_0x2b77a4,null))[_0xa4da('0x20')](function(_0x37dd34){if(_0x37dd34){return _0x37dd34[_0xa4da('0x53')]({'UserId':_0x311e17[_0xa4da('0x54')]['UserId'],'read1stAt':_[_0xa4da('0x63')](_0x37dd34[_0xa4da('0x64')])?moment()[_0xa4da('0x65')](_0xa4da('0x5a')):undefined});}return null;})[_0xa4da('0x20')](function(_0x25651f){if(_0x25651f){_0x25d39f[_0xa4da('0x66')]=_0x25651f[_0xa4da('0x60')]({'plain':!![]});interaction_log['info'](_0xa4da('0x67'),_0x311e17[_0xa4da('0x5c')]['id'],_0x311e17[_0xa4da('0x5c')][_0xa4da('0x34')],_0x311e17[_0xa4da('0x5c')]['role'],_0x25d39f[_0xa4da('0x66')]['id'],_0x311e17[_0xa4da('0x54')]?JSON[_0xa4da('0x68')](_0x311e17['body']):_0xa4da('0x69'));return respondWithRpcPromise(_0xa4da('0x6a'),'acceptMessage',_0x25d39f);}return null;})[_0xa4da('0x20')](function(_0x3eab92){if(_0x3eab92){if(_0x311e17['body'][_0xa4da('0x6b')]){_0x25d39f[_0xa4da('0x27')]['interface']=util['format'](_0xa4da('0x6c'),_0x311e17['user'][_0xa4da('0x34')]);_0x25d39f[_0xa4da('0x27')][_0xa4da('0x6d')]=_0x25d39f['channel'];_0x25d39f[_0xa4da('0x27')][_0xa4da('0x6e')]=_0xa4da('0x6f');return respondWithRpcPromise(_0xa4da('0x70'),_0xa4da('0x70'),{'event':_0xa4da('0x71'),'message':_0x25d39f[_0xa4da('0x27')]},client9002)[_0xa4da('0x20')](function(){return _0x25d39f;});}return _0x25d39f;}return null;})['then'](respondWithResult(_0x2b77a4,null))[_0xa4da('0x29')](handleError(_0x2b77a4,null));};var interaction_log=require(_0xa4da('0x14'))(_0xa4da('0x57'));exports['reject']=function(_0x500afd,_0x5e128e,_0x6cb415){var _0x5b8ae6={'agent':{},'channel':_0xa4da('0x58')};if(_0x500afd[_0xa4da('0x54')]['id']){delete _0x500afd['body']['id'];}_0x500afd[_0xa4da('0x54')][_0xa4da('0x5b')]=_0x500afd['body'][_0xa4da('0x5b')]||_0x500afd[_0xa4da('0x5c')]['id'];_0x5b8ae6[_0xa4da('0x5d')]['id']=_0x500afd[_0xa4da('0x54')]['UserId'];return db[_0xa4da('0x37')][_0xa4da('0x51')]({'where':{'id':_0x500afd[_0xa4da('0x55')]['id'],'UserId':null}})[_0xa4da('0x20')](handleEntityNotFound(_0x5e128e,null))[_0xa4da('0x20')](function(_0x1c2391){if(_0x1c2391){_0x5b8ae6['message']=_0x1c2391['get']({'plain':!![]});return db[_0xa4da('0x61')][_0xa4da('0x51')]({'where':{'id':_0x1c2391['OpenchannelInteractionId']}});}return null;})[_0xa4da('0x20')](handleEntityNotFound(_0x5e128e,null))[_0xa4da('0x20')](function(_0x28629a){if(_0x28629a){_0x5b8ae6['interaction']=_0x28629a[_0xa4da('0x60')]({'plain':!![]});interaction_log[_0xa4da('0x21')](_0xa4da('0x72'),_0x500afd[_0xa4da('0x5c')]['id'],_0x500afd['user'][_0xa4da('0x34')],_0x500afd[_0xa4da('0x5c')][_0xa4da('0x73')],_0x5b8ae6[_0xa4da('0x66')]['id'],_0x500afd['body']?JSON[_0xa4da('0x68')](_0x500afd[_0xa4da('0x54')]):'null');return respondWithRpcPromise(_0xa4da('0x74'),'rejectMessage',_0x5b8ae6);}return null;})['then'](function(_0x1065c0){if(_0x1065c0){_0x1065c0[_0xa4da('0x27')][_0xa4da('0x75')]=util['format'](_0xa4da('0x6c'),_0x500afd[_0xa4da('0x5c')][_0xa4da('0x34')]);_0x1065c0[_0xa4da('0x27')]['channel']=_0x5b8ae6[_0xa4da('0x6d')];_0x1065c0[_0xa4da('0x27')]['event']=_0xa4da('0x32');respondWithRpcPromise('EventManager',_0xa4da('0x70'),{'event':'rejectmessage','message':_0x1065c0[_0xa4da('0x27')]},client9002);return _0x5b8ae6;}return null;})['then'](respondWithResult(_0x5e128e,null))[_0xa4da('0x29')](handleError(_0x5e128e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 8554487..ce5d2b7 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 _0x8873=['remove','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','setMaxListeners','update'];(function(_0x4ca7b9,_0x33730e){var _0x332e96=function(_0x379e16){while(--_0x379e16){_0x4ca7b9['push'](_0x4ca7b9['shift']());}};_0x332e96(++_0x33730e);}(_0x8873,0x184));var _0x3887=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x8873[_0x2adbeb];return _0x5e18a6;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x3887('0x0'))['db'][_0x3887('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3887('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3887('0x3'),'afterDestroy':_0x3887('0x4')};function emitEvent(_0x1719c9){return function(_0x4b4a56,_0x38dfb7,_0x458c35){OpenchannelMessageEvents[_0x3887('0x5')](_0x1719c9+':'+_0x4b4a56['id'],_0x4b4a56);OpenchannelMessageEvents['emit'](_0x1719c9,_0x4b4a56);_0x458c35(null);};}for(var e in events){if(events[_0x3887('0x6')](e)){var event=events[e];OpenchannelMessage[_0x3887('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xac8d=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xac8d,0x1f0));var _0xdac8=function(_0xd066c8,_0x46b223){_0xd066c8=_0xd066c8-0x0;var _0x369df2=_0xac8d[_0xd066c8];return _0x369df2;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xdac8('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdac8('0x1'),'afterUpdate':_0xdac8('0x2'),'afterDestroy':'remove'};function emitEvent(_0x311d47){return function(_0xd8c066,_0x219fa2,_0x357f00){OpenchannelMessageEvents[_0xdac8('0x3')](_0x311d47+':'+_0xd8c066['id'],_0xd8c066);OpenchannelMessageEvents['emit'](_0x311d47,_0xd8c066);_0x357f00(null);};}for(var e in events){if(events[_0xdac8('0x4')](e)){var event=events[e];OpenchannelMessage[_0xdac8('0x5')](e,emitEvent(event));}}module[_0xdac8('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index d8703a6..e716f75 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 _0x646a=['./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','toLowerCase','isNil','findOne','OpenchannelInteractionId','createdAt','direction','catch','error','out','CmContact','describe','find','OpenchannelAccountId','OpenchannelInteraction','Contact','keys','then','get','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','Interactions','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','inspect','finally','utf8mb4','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x54665c,_0x3727f5){var _0x535d7d=function(_0x282a13){while(--_0x282a13){_0x54665c['push'](_0x54665c['shift']());}};_0x535d7d(++_0x3727f5);}(_0x646a,0x151));var _0xa646=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x646a[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require('lodash');var util=require(_0xa646('0x0'));var logger=require(_0xa646('0x1'))(_0xa646('0x2'));var moment=require('moment');var BPromise=require(_0xa646('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa646('0x4'));var rimraf=require('rimraf');var config=require(_0xa646('0x5'));var attributes=require(_0xa646('0x6'));module['exports']=function(_0xcb7047,_0x1a8aeb){return _0xcb7047[_0xa646('0x7')](_0xa646('0x8'),attributes,{'tableName':_0xa646('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xa646('0xa')],'type':_0xa646('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2652e9,_0x2c17aa,_0xb39f54){var _0x43d80c=_0xcb7047[_0xa646('0xc')];var _0x631cbd=_0x2652e9['get']({'plain':!![]});if(_0x631cbd['direction'][_0xa646('0xd')]()==='in'||_0x631cbd['direction'][_0xa646('0xd')]()==='out'&&!_0x631cbd['secret']&&!_[_0xa646('0xe')](_0x631cbd['UserId'])){_0x43d80c['OpenchannelInteraction'][_0xa646('0xf')]({'where':{'id':_0x631cbd[_0xa646('0x10')]}})['then'](function(_0x53be71){if(_0x53be71){_0x53be71['update']({'lastMsgAt':_0x631cbd[_0xa646('0x11')],'lastMsgDirection':_0x631cbd[_0xa646('0x12')][_0xa646('0xd')]()});}})[_0xa646('0x13')](function(_0x30b3ac){console[_0xa646('0x14')](_0x30b3ac);});}if(_0x631cbd[_0xa646('0x12')]===_0xa646('0x15')&&!_0x631cbd['secret']){var _0x48ef1c;_0x43d80c[_0xa646('0x16')][_0xa646('0x17')]()['then'](function(_0x54dba5){return _0x43d80c['OpenchannelAccount'][_0xa646('0x18')]({'where':{'id':_0x631cbd[_0xa646('0x19')]},'include':[{'model':_0x43d80c[_0xa646('0x1a')],'as':'Interactions','where':{'id':_0x631cbd[_0xa646('0x10')]},'limit':0x1,'include':[{'model':_0x43d80c[_0xa646('0x16')],'as':_0xa646('0x1b'),'attributes':_[_0xa646('0x1c')](_0x54dba5)}]}]});})[_0xa646('0x1d')](function(_0x518ccb){_0x48ef1c=_0x518ccb[_0xa646('0x1e')]({'plain':!![]});if(_0x48ef1c&&_0x48ef1c['replyUri']){logger[_0xa646('0x1f')](_0xa646('0x20'),_0xa646('0x21'),util[_0xa646('0x22')](_0xa646('0x23'),_0x631cbd['id'],_0x48ef1c[_0xa646('0x24')]));if(_0x48ef1c['Interactions']&&_0x48ef1c['Interactions'][_0xa646('0x25')]){_0x631cbd['Interaction']=_[_0xa646('0x26')](_0x48ef1c[_0xa646('0x27')][0x0],_0xa646('0x1b'));_0x631cbd['Contact']=_0x48ef1c[_0xa646('0x27')][0x0][_0xa646('0x1b')];}var _0x2c17aa={'method':'POST','uri':encodeURI(_0x48ef1c[_0xa646('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2c17aa['method']){case _0xa646('0x28'):_0x2c17aa['qs']=_0x631cbd;break;case _0xa646('0x29'):_0x2c17aa[_0xa646('0xa')]=_0x631cbd;break;}return rp(_0x2c17aa)[_0xa646('0x1d')](function(_0x2b3223){logger[_0xa646('0x1f')](_0xa646('0x20'),_0xa646('0x21'),util['format'](_0xa646('0x2a'),_0x631cbd['id'],_0x48ef1c[_0xa646('0x24')]));if(_0x2b3223[_0xa646('0xa')][_0xa646('0x2b')]&&_0x2b3223[_0xa646('0xa')][_0xa646('0x2b')]!=_0x631cbd[_0xa646('0x2c')][_0xa646('0x2b')]){return _0x43d80c['OpenchannelInteraction'][_0xa646('0x2d')]({'threadId':_0x2b3223['body'][_0xa646('0x2b')]},{'logging':!![],'where':{'id':_0x631cbd['Interaction']['id']}});}else{return;}})['then'](function(){return _0x2652e9[_0xa646('0x2d')]({'read':!![]});})['catch'](function(_0x13a5cc){logger[_0xa646('0x14')](_0xa646('0x20'),_0xa646('0x21'),util[_0xa646('0x2e')](_0x13a5cc,{'showHidden':![],'depth':null}));_0xb39f54();});}else{_0xb39f54();}})[_0xa646('0x2f')](function(){_0xb39f54();});}else{_0xb39f54();}}},'charset':_0xa646('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x45fe=['findOne','OpenchannelInteractionId','then','update','createdAt','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','method','GET','POST','body','threadId','catch','error','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','FULLTEXT','models','direction','out','secret','isNil','UserId','OpenchannelInteraction'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x45fe,0x1eb));var _0xe45f=function(_0x5055f1,_0x3cbb87){_0x5055f1=_0x5055f1-0x0;var _0x28a9f0=_0x45fe[_0x5055f1];return _0x28a9f0;};'use strict';var _=require(_0xe45f('0x0'));var util=require(_0xe45f('0x1'));var logger=require(_0xe45f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe45f('0x3'));var rp=require(_0xe45f('0x4'));var fs=require('fs');var path=require(_0xe45f('0x5'));var rimraf=require('rimraf');var config=require(_0xe45f('0x6'));var attributes=require(_0xe45f('0x7'));module['exports']=function(_0x403ea7,_0x2517a0){return _0x403ea7[_0xe45f('0x8')](_0xe45f('0x9'),attributes,{'tableName':_0xe45f('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':_0xe45f('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bdb8e,_0xb7d102,_0x2059d3){var _0x3626bc=_0x403ea7[_0xe45f('0xc')];var _0x446ad8=_0x2bdb8e['get']({'plain':!![]});if(_0x446ad8[_0xe45f('0xd')]['toLowerCase']()==='in'||_0x446ad8[_0xe45f('0xd')]['toLowerCase']()===_0xe45f('0xe')&&!_0x446ad8[_0xe45f('0xf')]&&!_[_0xe45f('0x10')](_0x446ad8[_0xe45f('0x11')])){_0x3626bc[_0xe45f('0x12')][_0xe45f('0x13')]({'where':{'id':_0x446ad8[_0xe45f('0x14')]}})[_0xe45f('0x15')](function(_0x37a1e1){if(_0x37a1e1){_0x37a1e1[_0xe45f('0x16')]({'lastMsgAt':_0x446ad8[_0xe45f('0x17')],'lastMsgDirection':_0x446ad8['direction']['toLowerCase']()});}})['catch'](function(_0x253294){console['error'](_0x253294);});}if(_0x446ad8['direction']===_0xe45f('0xe')&&!_0x446ad8[_0xe45f('0xf')]){var _0xf3118;_0x3626bc[_0xe45f('0x18')][_0xe45f('0x19')]()[_0xe45f('0x15')](function(_0x205d56){return _0x3626bc[_0xe45f('0x1a')]['find']({'where':{'id':_0x446ad8[_0xe45f('0x1b')]},'include':[{'model':_0x3626bc[_0xe45f('0x12')],'as':_0xe45f('0x1c'),'where':{'id':_0x446ad8['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3626bc[_0xe45f('0x18')],'as':_0xe45f('0x1d'),'attributes':_[_0xe45f('0x1e')](_0x205d56)}]}]});})[_0xe45f('0x15')](function(_0x38551f){_0xf3118=_0x38551f[_0xe45f('0x1f')]({'plain':!![]});if(_0xf3118&&_0xf3118[_0xe45f('0x20')]){logger[_0xe45f('0x21')](_0xe45f('0x22'),'afterCreate',util[_0xe45f('0x23')](_0xe45f('0x24'),_0x446ad8['id'],_0xf3118[_0xe45f('0x20')]));if(_0xf3118[_0xe45f('0x1c')]&&_0xf3118[_0xe45f('0x1c')]['length']){_0x446ad8[_0xe45f('0x25')]=_[_0xe45f('0x26')](_0xf3118[_0xe45f('0x1c')][0x0],'Contact');_0x446ad8[_0xe45f('0x1d')]=_0xf3118[_0xe45f('0x1c')][0x0][_0xe45f('0x1d')];}var _0xb7d102={'method':'POST','uri':encodeURI(_0xf3118[_0xe45f('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xb7d102[_0xe45f('0x27')]){case _0xe45f('0x28'):_0xb7d102['qs']=_0x446ad8;break;case _0xe45f('0x29'):_0xb7d102[_0xe45f('0x2a')]=_0x446ad8;break;}return rp(_0xb7d102)[_0xe45f('0x15')](function(_0x260f9c){logger[_0xe45f('0x21')](_0xe45f('0x22'),'afterCreate',util[_0xe45f('0x23')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x446ad8['id'],_0xf3118[_0xe45f('0x20')]));if(_0x260f9c[_0xe45f('0x2a')][_0xe45f('0x2b')]&&_0x260f9c[_0xe45f('0x2a')][_0xe45f('0x2b')]!=_0x446ad8[_0xe45f('0x25')][_0xe45f('0x2b')]){return _0x3626bc[_0xe45f('0x12')][_0xe45f('0x16')]({'threadId':_0x260f9c[_0xe45f('0x2a')][_0xe45f('0x2b')]},{'logging':!![],'where':{'id':_0x446ad8['Interaction']['id']}});}else{return;}})[_0xe45f('0x15')](function(){return _0x2bdb8e[_0xe45f('0x16')]({'read':!![]});})[_0xe45f('0x2c')](function(_0x215f9d){logger[_0xe45f('0x2d')](_0xe45f('0x22'),_0xe45f('0x2e'),util[_0xe45f('0x2f')](_0x215f9d,{'showHidden':![],'depth':null}));_0x2059d3();});}else{_0x2059d3();}})[_0xe45f('0x30')](function(){_0x2059d3();});}else{_0x2059d3();}}},'charset':_0xe45f('0x31'),'collate':_0xe45f('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 71f4323..35b6f02 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 _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash'];(function(_0x5b4310,_0x2a9146){var _0x415f7c=function(_0xaf441b){while(--_0xaf441b){_0x5b4310['push'](_0x5b4310['shift']());}};_0x415f7c(++_0x2a9146);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x9aa89,_0x42ec7a){var _0x2b4495=function(_0x5f4dfc){while(--_0x5f4dfc){_0x9aa89['push'](_0x9aa89['shift']());}};_0x2b4495(++_0x42ec7a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1474f3,_0x3212ab){_0x1474f3=_0x1474f3-0x0;var _0x5811d3=_0x5f2f[_0x1474f3];return _0x5811d3;};'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('./openchannelMessage.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['CreateOpenchannelMessage']=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/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 20ab513..555e1fc 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 _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x4cd32e,_0x384826){var _0xd54b8c=function(_0x5a52ca){while(--_0x5a52ca){_0x4cd32e['push'](_0x4cd32e['shift']());}};_0xd54b8c(++_0x384826);}(_0xf4eb,0xec));var _0xbf4e=function(_0x50b650,_0x69b843){_0x50b650=_0x50b650-0x0;var _0x113472=_0xf4eb[_0x50b650];return _0x113472;};'use strict';var OpenchannelMessageEvents=require(_0xbf4e('0x0'));var events=['save','remove','update'];function createListener(_0x5ed5b9,_0xbbbf01){return function(_0x49d80e){_0xbbbf01['emit'](_0x5ed5b9,_0x49d80e);};}function removeListener(_0x2e3070,_0x1c7606){return function(){OpenchannelMessageEvents[_0xbf4e('0x1')](_0x2e3070,_0x1c7606);};}exports[_0xbf4e('0x2')]=function(_0xa4dcf5){for(var _0x2fcfed=0x0,_0x15b99f=events['length'];_0x2fcfed<_0x15b99f;_0x2fcfed++){var _0x449d55=events[_0x2fcfed];var _0x5013c2=createListener('openchannelMessage:'+_0x449d55,_0xa4dcf5);OpenchannelMessageEvents['on'](_0x449d55,_0x5013c2);}}; \ No newline at end of file +var _0xcb91=['remove','update','emit','removeListener','register'];(function(_0x54a83b,_0x33ce12){var _0x4cfc0e=function(_0x397378){while(--_0x397378){_0x54a83b['push'](_0x54a83b['shift']());}};_0x4cfc0e(++_0x33ce12);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xcb91[_0x5cc8b9];return _0x58892e;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x1cb9('0x0'),_0x1cb9('0x1')];function createListener(_0x17d4ec,_0x22c4b8){return function(_0x4c37e8){_0x22c4b8[_0x1cb9('0x2')](_0x17d4ec,_0x4c37e8);};}function removeListener(_0x2c17b8,_0x545a34){return function(){OpenchannelMessageEvents[_0x1cb9('0x3')](_0x2c17b8,_0x545a34);};}exports[_0x1cb9('0x4')]=function(_0x53ffbd){for(var _0x226b69=0x0,_0x3f7deb=events['length'];_0x226b69<_0x3f7deb;_0x226b69++){var _0x38737d=events[_0x226b69];var _0x12567c=createListener('openchannelMessage:'+_0x38737d,_0x53ffbd);OpenchannelMessageEvents['on'](_0x38737d,_0x12567c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ce83a6f..2a747fe 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 _0xab36=['/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x23f3fe,_0x37a19c){var _0x1b1cb1=function(_0x1a96a7){while(--_0x1a96a7){_0x23f3fe['push'](_0x23f3fe['shift']());}};_0x1b1cb1(++_0x37a19c);}(_0xab36,0x1df));var _0x6ab3=function(_0x4de76b,_0x3692df){_0x4de76b=_0x4de76b-0x0;var _0xf66d11=_0xab36[_0x4de76b];return _0xf66d11;};'use strict';var multer=require(_0x6ab3('0x0'));var util=require(_0x6ab3('0x1'));var path=require(_0x6ab3('0x2'));var timeout=require(_0x6ab3('0x3'));var express=require(_0x6ab3('0x4'));var router=express['Router']();var auth=require(_0x6ab3('0x5'));var interaction=require(_0x6ab3('0x6'));var config=require(_0x6ab3('0x7'));var controller=require('./openchannelQueue.controller');router[_0x6ab3('0x8')]('/',auth[_0x6ab3('0x9')](),controller[_0x6ab3('0xa')]);router[_0x6ab3('0x8')](_0x6ab3('0xb'),auth[_0x6ab3('0x9')](),controller['describe']);router[_0x6ab3('0x8')](_0x6ab3('0xc'),auth['isAuthenticated'](),controller[_0x6ab3('0xd')]);router['get'](_0x6ab3('0xe'),auth[_0x6ab3('0x9')](),controller[_0x6ab3('0xf')]);router[_0x6ab3('0x8')](_0x6ab3('0x10'),auth[_0x6ab3('0x9')](),controller['getTeams']);router[_0x6ab3('0x8')]('/:id/users',auth[_0x6ab3('0x9')](),controller[_0x6ab3('0x11')]);router[_0x6ab3('0x12')]('/',auth[_0x6ab3('0x9')](),controller[_0x6ab3('0x13')]);router['post'](_0x6ab3('0x10'),auth[_0x6ab3('0x9')](),controller[_0x6ab3('0x14')]);router[_0x6ab3('0x12')](_0x6ab3('0x15'),auth['isAuthenticated'](),controller[_0x6ab3('0x16')]);router['put'](_0x6ab3('0xc'),auth[_0x6ab3('0x9')](),controller[_0x6ab3('0x17')]);router[_0x6ab3('0x18')](_0x6ab3('0xc'),auth[_0x6ab3('0x9')](),controller[_0x6ab3('0x19')]);router[_0x6ab3('0x18')](_0x6ab3('0x10'),auth['isAuthenticated'](),controller[_0x6ab3('0x1a')]);router['delete'](_0x6ab3('0x15'),auth[_0x6ab3('0x9')](),controller[_0x6ab3('0x1b')]);module[_0x6ab3('0x1c')]=router; \ No newline at end of file +var _0x38e4=['removeTeams','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addAgents','put','/:id','update','delete','destroy'];(function(_0xd59da5,_0x44c4e6){var _0x25793a=function(_0x4d94c9){while(--_0x4d94c9){_0xd59da5['push'](_0xd59da5['shift']());}};_0x25793a(++_0x44c4e6);}(_0x38e4,0x9e));var _0x438e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x38e4[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x438e('0x0'));var util=require(_0x438e('0x1'));var path=require('path');var timeout=require(_0x438e('0x2'));var express=require(_0x438e('0x3'));var router=express['Router']();var auth=require(_0x438e('0x4'));var interaction=require(_0x438e('0x5'));var config=require(_0x438e('0x6'));var controller=require('./openchannelQueue.controller');router[_0x438e('0x7')]('/',auth[_0x438e('0x8')](),controller[_0x438e('0x9')]);router[_0x438e('0x7')](_0x438e('0xa'),auth[_0x438e('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x438e('0xb')]);router[_0x438e('0x7')](_0x438e('0xc'),auth[_0x438e('0x8')](),controller['getMembers']);router[_0x438e('0x7')]('/:id/teams',auth[_0x438e('0x8')](),controller['getTeams']);router[_0x438e('0x7')](_0x438e('0xd'),auth[_0x438e('0x8')](),controller[_0x438e('0xe')]);router[_0x438e('0xf')]('/',auth['isAuthenticated'](),controller[_0x438e('0x10')]);router[_0x438e('0xf')](_0x438e('0x11'),auth[_0x438e('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0x438e('0x8')](),controller[_0x438e('0x12')]);router[_0x438e('0x13')](_0x438e('0x14'),auth[_0x438e('0x8')](),controller[_0x438e('0x15')]);router[_0x438e('0x16')]('/:id',auth[_0x438e('0x8')](),controller[_0x438e('0x17')]);router[_0x438e('0x16')](_0x438e('0x11'),auth[_0x438e('0x8')](),controller[_0x438e('0x18')]);router['delete'](_0x438e('0xd'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x438e('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 8380a02..981e0e3 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 _0x847d=['ENUM','rrmemory','roundrobin','exports','STRING','name','INTEGER'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0x847d,0xf8));var _0xd847=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0x847d[_0x27604f];return _0x40d189;};'use strict';var Sequelize=require('sequelize');module[_0xd847('0x0')]={'name':{'type':Sequelize[_0xd847('0x1')],'unique':_0xd847('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd847('0x1')]},'timeout':{'type':Sequelize[_0xd847('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd847('0x4')](_0xd847('0x5'),'beepall',_0xd847('0x6'))}}; \ No newline at end of file +var _0xf198=['name','STRING','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x5e3e3d,_0x1a10e4){var _0x502e62=function(_0x23b38e){while(--_0x23b38e){_0x5e3e3d['push'](_0x5e3e3d['shift']());}};_0x502e62(++_0x1a10e4);}(_0xf198,0xd1));var _0x8f19=function(_0x2abae0,_0x5658ba){_0x2abae0=_0x2abae0-0x0;var _0x1c0b69=_0xf198[_0x2abae0];return _0x1c0b69;};'use strict';var Sequelize=require('sequelize');module[_0x8f19('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8f19('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8f19('0x2')]},'timeout':{'type':Sequelize[_0x8f19('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8f19('0x4'),_0x8f19('0x5'),_0x8f19('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index ba452e7..38eb9c5 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 _0xf9ea=['create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','sort','pick','User','UserId','openchannelPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','field','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','removeAgents','emit','addAgents','omit','spread','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','count','offset','limit','set','json','reject','save','then','destroy','get','OpenchannelQueues','end','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','map','query','keys','filters','attributes','fields','length','nolimit','order','where','filter','type','options','include','findAll','catch','params','intersection','model','includeAll','merge','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x17096,_0x3d80e5){var _0x5416ff=function(_0x5d7dc6){while(--_0x5d7dc6){_0x17096['push'](_0x17096['shift']());}};_0x5416ff(++_0x3d80e5);}(_0xf9ea,0xc3));var _0xaf9e=function(_0x550500,_0x8dd443){_0x550500=_0x550500-0x0;var _0x113660=_0xf9ea[_0x550500];return _0x113660;};'use strict';var pdf=require(_0xaf9e('0x0'));var emlformat=require(_0xaf9e('0x1'));var rimraf=require(_0xaf9e('0x2'));var zipdir=require(_0xaf9e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf9e('0x4'));var moment=require('moment');var BPromise=require(_0xaf9e('0x5'));var Mustache=require(_0xaf9e('0x6'));var util=require(_0xaf9e('0x7'));var path=require('path');var sox=require(_0xaf9e('0x8'));var csv=require(_0xaf9e('0x9'));var ejs=require(_0xaf9e('0xa'));var fs=require('fs');var _=require(_0xaf9e('0xb'));var squel=require(_0xaf9e('0xc'));var crypto=require(_0xaf9e('0xd'));var jsforce=require(_0xaf9e('0xe'));var deskjs=require(_0xaf9e('0xf'));var toCsv=require(_0xaf9e('0x9'));var querystring=require('querystring');var Papa=require(_0xaf9e('0x10'));var Redis=require('ioredis');var authService=require(_0xaf9e('0x11'));var qs=require(_0xaf9e('0x12'));var as=require(_0xaf9e('0x13'));var hardwareService=require(_0xaf9e('0x14'));var logger=require(_0xaf9e('0x15'))(_0xaf9e('0x16'));var utils=require(_0xaf9e('0x17'));var config=require(_0xaf9e('0x18'));var licenseUtil=require(_0xaf9e('0x19'));var db=require(_0xaf9e('0x1a'))['db'];config[_0xaf9e('0x1b')]=_['defaults'](config[_0xaf9e('0x1b')],{'host':_0xaf9e('0x1c'),'port':0x18eb});var socket=require(_0xaf9e('0x1d'))(new Redis(config['redis']));require(_0xaf9e('0x1e'))['register'](socket);function respondWithStatusCode(_0x4ce34b,_0x37bf51){_0x37bf51=_0x37bf51||0xcc;return function(_0x56776d){if(_0x56776d){return _0x4ce34b[_0xaf9e('0x1f')](_0x37bf51);}return _0x4ce34b['status'](_0x37bf51)['end']();};}function respondWithResult(_0x32830b,_0x4ff39e){_0x4ff39e=_0x4ff39e||0xc8;return function(_0x32d333){if(_0x32d333){return _0x32830b[_0xaf9e('0x20')](_0x4ff39e)['json'](_0x32d333);}};}function respondWithFilteredResult(_0xc12e15,_0x1442c4){return function(_0x283b4d){if(_0x283b4d){var _0x4db9a3=_0x283b4d[_0xaf9e('0x21')],_0x26e9f4=_0x1442c4[_0xaf9e('0x22')],_0x5c0db1=_0x1442c4[_0xaf9e('0x22')]+_0x1442c4[_0xaf9e('0x23')],_0x2b5018;if(_0x5c0db1>=_0x4db9a3){_0x5c0db1=_0x4db9a3;_0x2b5018=0xc8;}else{_0x2b5018=0xce;}_0xc12e15[_0xaf9e('0x20')](_0x2b5018);return _0xc12e15[_0xaf9e('0x24')]('Content-Range',_0x26e9f4+'-'+_0x5c0db1+'/'+_0x4db9a3)[_0xaf9e('0x25')](_0x283b4d);}return null;};}function patchUpdates(_0x42d095){return function(_0x54e09e){try{jsonpatch['apply'](_0x54e09e,_0x42d095,!![]);}catch(_0x380dad){return BPromise[_0xaf9e('0x26')](_0x380dad);}return _0x54e09e[_0xaf9e('0x27')]();};}function saveUpdates(_0x50ac2e,_0x234882){return function(_0x4d0865){if(_0x4d0865){return _0x4d0865['update'](_0x50ac2e)[_0xaf9e('0x28')](function(_0x407e4d){return _0x407e4d;});}return null;};}function removeEntity(_0x130f85,_0x155fb0){return function(_0x109dd7){if(_0x109dd7){return _0x109dd7[_0xaf9e('0x29')]()[_0xaf9e('0x28')](function(){var _0x50d8e3=_0x109dd7[_0xaf9e('0x2a')]({'plain':!![]});var _0x99fc02=_0xaf9e('0x2b');return db['UserProfileResource'][_0xaf9e('0x29')]({'where':{'type':_0x99fc02,'resourceId':_0x50d8e3['id']}})[_0xaf9e('0x28')](function(){return _0x109dd7;});})['then'](function(){_0x130f85[_0xaf9e('0x20')](0xcc)[_0xaf9e('0x2c')]();});}};}function handleEntityNotFound(_0x15e057,_0x22c4f2){return function(_0x128ac0){if(!_0x128ac0){_0x15e057[_0xaf9e('0x1f')](0x194);}return _0x128ac0;};}function handleError(_0x242610,_0x2b22af){_0x2b22af=_0x2b22af||0x1f4;return function(_0x363ddc){logger['error'](_0x363ddc[_0xaf9e('0x2d')]);if(_0x363ddc[_0xaf9e('0x2e')]){delete _0x363ddc[_0xaf9e('0x2e')];}_0x242610['status'](_0x2b22af)[_0xaf9e('0x2f')](_0x363ddc);};}exports[_0xaf9e('0x30')]=function(_0x43d07a,_0x3d98e5){var _0x2c4e77={},_0x193106={},_0x1194a7={'count':0x0,'rows':[]};var _0x2e8b72=_['map'](db[_0xaf9e('0x31')][_0xaf9e('0x32')],function(_0x257e14){return{'name':_0x257e14[_0xaf9e('0x33')],'type':_0x257e14['type']['key']};});_0x193106['model']=_[_0xaf9e('0x34')](_0x2e8b72,_0xaf9e('0x2e'));_0x193106[_0xaf9e('0x35')]=_[_0xaf9e('0x36')](_0x43d07a[_0xaf9e('0x35')]);_0x193106[_0xaf9e('0x37')]=_['intersection'](_0x193106['model'],_0x193106['query']);_0x2c4e77[_0xaf9e('0x38')]=_['intersection'](_0x193106['model'],qs[_0xaf9e('0x39')](_0x43d07a[_0xaf9e('0x35')][_0xaf9e('0x39')]));_0x2c4e77[_0xaf9e('0x38')]=_0x2c4e77[_0xaf9e('0x38')][_0xaf9e('0x3a')]?_0x2c4e77['attributes']:_0x193106['model'];if(!_0x43d07a['query']['hasOwnProperty'](_0xaf9e('0x3b'))){_0x2c4e77[_0xaf9e('0x23')]=qs[_0xaf9e('0x23')](_0x43d07a[_0xaf9e('0x35')][_0xaf9e('0x23')]);_0x2c4e77['offset']=qs['offset'](_0x43d07a['query'][_0xaf9e('0x22')]);}_0x2c4e77[_0xaf9e('0x3c')]=qs['sort'](_0x43d07a[_0xaf9e('0x35')]['sort']);_0x2c4e77[_0xaf9e('0x3d')]=qs['filters'](_['pick'](_0x43d07a['query'],_0x193106[_0xaf9e('0x37')]),_0x2e8b72);if(_0x43d07a[_0xaf9e('0x35')][_0xaf9e('0x3e')]){_0x2c4e77['where']=_['merge'](_0x2c4e77['where'],{'$or':_['map'](_0x2e8b72,function(_0x34c009){if(_0x34c009[_0xaf9e('0x3f')]!=='VIRTUAL'){var _0x4d4545={};_0x4d4545[_0x34c009[_0xaf9e('0x2e')]]={'$like':'%'+_0x43d07a[_0xaf9e('0x35')][_0xaf9e('0x3e')]+'%'};return _0x4d4545;}})});}_0x2c4e77=_['merge']({},_0x2c4e77,_0x43d07a[_0xaf9e('0x40')]);var _0x3cd186={'where':_0x2c4e77[_0xaf9e('0x3d')]};return db[_0xaf9e('0x31')][_0xaf9e('0x21')](_0x3cd186)[_0xaf9e('0x28')](function(_0x468b5e){_0x1194a7[_0xaf9e('0x21')]=_0x468b5e;if(_0x43d07a['query']['includeAll']){_0x2c4e77[_0xaf9e('0x41')]=[{'all':!![]}];}return db[_0xaf9e('0x31')][_0xaf9e('0x42')](_0x2c4e77);})['then'](function(_0x55b686){_0x1194a7['rows']=_0x55b686;return _0x1194a7;})[_0xaf9e('0x28')](respondWithFilteredResult(_0x3d98e5,_0x2c4e77))[_0xaf9e('0x43')](handleError(_0x3d98e5,null));};exports['show']=function(_0x1d4ced,_0x17d9ba){var _0x3f4aeb={'raw':!![],'where':{'id':_0x1d4ced[_0xaf9e('0x44')]['id']}},_0x18eb32={};_0x18eb32['model']=_['keys'](db[_0xaf9e('0x31')][_0xaf9e('0x32')]);_0x18eb32[_0xaf9e('0x35')]=_[_0xaf9e('0x36')](_0x1d4ced['query']);_0x18eb32[_0xaf9e('0x37')]=_[_0xaf9e('0x45')](_0x18eb32[_0xaf9e('0x46')],_0x18eb32[_0xaf9e('0x35')]);_0x3f4aeb[_0xaf9e('0x38')]=_[_0xaf9e('0x45')](_0x18eb32['model'],qs[_0xaf9e('0x39')](_0x1d4ced[_0xaf9e('0x35')][_0xaf9e('0x39')]));_0x3f4aeb[_0xaf9e('0x38')]=_0x3f4aeb[_0xaf9e('0x38')]['length']?_0x3f4aeb['attributes']:_0x18eb32[_0xaf9e('0x46')];if(_0x1d4ced[_0xaf9e('0x35')][_0xaf9e('0x47')]){_0x3f4aeb[_0xaf9e('0x41')]=[{'all':!![]}];}_0x3f4aeb=_[_0xaf9e('0x48')]({},_0x3f4aeb,_0x1d4ced[_0xaf9e('0x40')]);return db[_0xaf9e('0x31')][_0xaf9e('0x49')](_0x3f4aeb)[_0xaf9e('0x28')](handleEntityNotFound(_0x17d9ba,null))[_0xaf9e('0x28')](respondWithResult(_0x17d9ba,null))['catch'](handleError(_0x17d9ba,null));};exports['create']=function(_0x58162f,_0x1f5dd0){return db[_0xaf9e('0x31')]['create'](_0x58162f['body'],{})['then'](function(_0xcd191){var _0x44bbb2=_0x58162f[_0xaf9e('0x4a')][_0xaf9e('0x2a')]({'plain':!![]});if(!_0x44bbb2)throw new Error(_0xaf9e('0x4b'));if(_0x44bbb2[_0xaf9e('0x4c')]===_0xaf9e('0x4a')){var _0x5407d1=_0xcd191['get']({'plain':!![]});var _0x5a0880='OpenchannelQueues';return db[_0xaf9e('0x4d')]['find']({'where':{'name':_0x5a0880,'userProfileId':_0x44bbb2[_0xaf9e('0x4e')]},'raw':!![]})['then'](function(_0x4290f7){if(_0x4290f7&&_0x4290f7[_0xaf9e('0x4f')]===0x0){return db[_0xaf9e('0x50')][_0xaf9e('0x51')]({'name':_0x5407d1[_0xaf9e('0x2e')],'resourceId':_0x5407d1['id'],'type':_0x4290f7[_0xaf9e('0x2e')],'sectionId':_0x4290f7['id']},{})[_0xaf9e('0x28')](function(){return _0xcd191;});}else{return _0xcd191;}})[_0xaf9e('0x43')](function(_0x232ee2){logger[_0xaf9e('0x52')](_0xaf9e('0x53'),_0x232ee2);throw _0x232ee2;});}return _0xcd191;})[_0xaf9e('0x28')](respondWithResult(_0x1f5dd0,0xc9))[_0xaf9e('0x43')](handleError(_0x1f5dd0,null));};exports['update']=function(_0x23682d,_0x1238a5){if(_0x23682d[_0xaf9e('0x54')]['id']){delete _0x23682d['body']['id'];}return db[_0xaf9e('0x31')][_0xaf9e('0x49')]({'where':{'id':_0x23682d['params']['id']}})[_0xaf9e('0x28')](handleEntityNotFound(_0x1238a5,null))[_0xaf9e('0x28')](saveUpdates(_0x23682d[_0xaf9e('0x54')],null))[_0xaf9e('0x28')](respondWithResult(_0x1238a5,null))['catch'](handleError(_0x1238a5,null));};exports[_0xaf9e('0x29')]=function(_0x29713e,_0x3daa2f){return db[_0xaf9e('0x31')][_0xaf9e('0x49')]({'where':{'id':_0x29713e[_0xaf9e('0x44')]['id']}})[_0xaf9e('0x28')](handleEntityNotFound(_0x3daa2f,null))[_0xaf9e('0x28')](removeEntity(_0x3daa2f,null))[_0xaf9e('0x43')](handleError(_0x3daa2f,null));};exports[_0xaf9e('0x55')]=function(_0x13fd93,_0x4b95a1){return db[_0xaf9e('0x31')][_0xaf9e('0x55')]()[_0xaf9e('0x28')](respondWithResult(_0x4b95a1,null))['catch'](handleError(_0x4b95a1,null));};exports[_0xaf9e('0x56')]=function(_0x730f7d,_0x481fbc,_0x131b4b){var _0x531a08={'raw':!![],'where':{}},_0x1ff038={},_0x5123d2;return db[_0xaf9e('0x31')][_0xaf9e('0x57')]({'where':{'id':_0x730f7d['params']['id']}})[_0xaf9e('0x28')](handleEntityNotFound(_0x481fbc,null))[_0xaf9e('0x28')](function(_0x1d8cb4){if(_0x1d8cb4){_0x5123d2=_0x1d8cb4[_0xaf9e('0x2a')]({'plain':!![]});_0x1ff038['model']=_[_0xaf9e('0x36')](db[_0xaf9e('0x58')]['rawAttributes']);_0x1ff038[_0xaf9e('0x35')]=_['keys'](_0x730f7d['query']);_0x1ff038[_0xaf9e('0x37')]=_[_0xaf9e('0x45')](_0x1ff038[_0xaf9e('0x46')],_0x1ff038[_0xaf9e('0x35')]);_0x531a08[_0xaf9e('0x38')]=_[_0xaf9e('0x45')](_0x1ff038[_0xaf9e('0x46')],qs[_0xaf9e('0x39')](_0x730f7d[_0xaf9e('0x35')][_0xaf9e('0x39')]));_0x531a08[_0xaf9e('0x38')]=_0x531a08[_0xaf9e('0x38')]['length']?_0x531a08[_0xaf9e('0x38')]:_0x1ff038['model'];if(!_0x730f7d[_0xaf9e('0x35')][_0xaf9e('0x59')]('nolimit')){_0x531a08[_0xaf9e('0x23')]=qs[_0xaf9e('0x23')](_0x730f7d['query'][_0xaf9e('0x23')]);_0x531a08[_0xaf9e('0x22')]=qs[_0xaf9e('0x22')](_0x730f7d[_0xaf9e('0x35')]['offset']);}_0x531a08['order']=qs['sort'](_0x730f7d['query'][_0xaf9e('0x5a')]);_0x531a08['where']=qs[_0xaf9e('0x37')](_[_0xaf9e('0x5b')](_0x730f7d[_0xaf9e('0x35')],_0x1ff038[_0xaf9e('0x37')]));_0x531a08[_0xaf9e('0x3d')]['OpenchannelQueueId']=_0x1d8cb4['id'];if(_0x730f7d[_0xaf9e('0x35')][_0xaf9e('0x3e')]){_0x531a08[_0xaf9e('0x3d')]=_[_0xaf9e('0x48')](_0x531a08['where'],{'$or':_[_0xaf9e('0x34')](_0x531a08[_0xaf9e('0x38')],function(_0x24a4bd){var _0x47953e={};_0x47953e[_0x24a4bd]={'$like':'%'+_0x730f7d[_0xaf9e('0x35')][_0xaf9e('0x3e')]+'%'};return _0x47953e;})});}_0x531a08=_[_0xaf9e('0x48')]({},_0x531a08,_0x730f7d[_0xaf9e('0x40')]);return db[_0xaf9e('0x58')][_0xaf9e('0x42')](_0x531a08);}})[_0xaf9e('0x28')](function(_0x1826e7){if(_0x1826e7){return db[_0xaf9e('0x5c')]['findAndCountAll']({'where':{'id':_[_0xaf9e('0x34')](_0x1826e7,_0xaf9e('0x5d')),'role':'agent'},'attributes':['id',_0xaf9e('0x2e'),_0xaf9e('0x5e'),_0xaf9e('0x5f'),_0xaf9e('0x60')]});}})[_0xaf9e('0x28')](function(_0x21e0e4){if(_0x21e0e4){return{'count':_0x21e0e4[_0xaf9e('0x21')],'rows':_[_0xaf9e('0x34')](_0x21e0e4[_0xaf9e('0x61')],function(_0x1ac2bc){return{'membername':_0x1ac2bc[_0xaf9e('0x2e')],'UserId':_0x1ac2bc['id'],'queue_name':_0x5123d2[_0xaf9e('0x2e')],'OpenchannelQueueId':_0x5123d2['id'],'interface':util[_0xaf9e('0x62')]('%s/%s',_0xaf9e('0x63'),_0x1ac2bc[_0xaf9e('0x2e')]),'penalty':0x0,'paused':_0x1ac2bc[_0xaf9e('0x5e')],'createdAt':_0x1ac2bc[_0xaf9e('0x60')],'updatedAt':_0x1ac2bc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xaf9e('0x28')](respondWithFilteredResult(_0x481fbc,_0x531a08))[_0xaf9e('0x43')](handleError(_0x481fbc,null));};exports[_0xaf9e('0x64')]=function(_0x401d7e,_0x5e0a62,_0x3e7bd5){var _0x45c81f={};var _0x41e25c={};var _0x45b08;var _0x3998a2;return db[_0xaf9e('0x31')][_0xaf9e('0x57')]({'where':{'id':_0x401d7e[_0xaf9e('0x44')]['id']}})[_0xaf9e('0x28')](handleEntityNotFound(_0x5e0a62,null))[_0xaf9e('0x28')](function(_0x2bf0c5){if(_0x2bf0c5){_0x45b08=_0x2bf0c5;_0x41e25c[_0xaf9e('0x46')]=_['keys'](db[_0xaf9e('0x65')][_0xaf9e('0x32')]);_0x41e25c[_0xaf9e('0x35')]=_[_0xaf9e('0x36')](_0x401d7e['query']);_0x41e25c[_0xaf9e('0x37')]=_['intersection'](_0x41e25c[_0xaf9e('0x46')],_0x41e25c[_0xaf9e('0x35')]);_0x45c81f[_0xaf9e('0x38')]=_[_0xaf9e('0x45')](_0x41e25c[_0xaf9e('0x46')],qs[_0xaf9e('0x39')](_0x401d7e['query']['fields']));_0x45c81f[_0xaf9e('0x38')]=_0x45c81f[_0xaf9e('0x38')][_0xaf9e('0x3a')]?_0x45c81f[_0xaf9e('0x38')]:_0x41e25c[_0xaf9e('0x46')];_0x45c81f[_0xaf9e('0x3c')]=qs[_0xaf9e('0x5a')](_0x401d7e[_0xaf9e('0x35')][_0xaf9e('0x5a')]);_0x45c81f['where']=qs[_0xaf9e('0x37')](_[_0xaf9e('0x5b')](_0x401d7e[_0xaf9e('0x35')],_0x41e25c[_0xaf9e('0x37')]));if(_0x401d7e['query']['filter']){_0x45c81f[_0xaf9e('0x3d')]=_[_0xaf9e('0x48')](_0x45c81f[_0xaf9e('0x3d')],{'$or':_[_0xaf9e('0x34')](_0x45c81f[_0xaf9e('0x38')],function(_0x2b28a7){var _0x4774e0={};_0x4774e0[_0x2b28a7]={'$like':'%'+_0x401d7e[_0xaf9e('0x35')]['filter']+'%'};return _0x4774e0;})});}_0x45c81f=_[_0xaf9e('0x48')]({},_0x45c81f,_0x401d7e[_0xaf9e('0x40')]);return _0x45b08['getTeams'](_0x45c81f);}})[_0xaf9e('0x28')](function(_0x4aa345){if(_0x4aa345){_0x3998a2=_0x4aa345['length'];if(!_0x401d7e[_0xaf9e('0x35')][_0xaf9e('0x59')](_0xaf9e('0x3b'))){_0x45c81f[_0xaf9e('0x23')]=qs[_0xaf9e('0x23')](_0x401d7e[_0xaf9e('0x35')][_0xaf9e('0x23')]);_0x45c81f[_0xaf9e('0x22')]=qs[_0xaf9e('0x22')](_0x401d7e['query'][_0xaf9e('0x22')]);}return _0x45b08[_0xaf9e('0x64')](_0x45c81f);}})['then'](function(_0xd3bac0){if(_0xd3bac0){return _0xd3bac0?{'count':_0x3998a2,'rows':_0xd3bac0}:null;}})['then'](respondWithResult(_0x5e0a62,null))[_0xaf9e('0x43')](handleError(_0x5e0a62,null));};exports[_0xaf9e('0x66')]=function(_0x47ed1b,_0xe3b89b,_0x344619){var _0x123b6a=_0x47ed1b[_0xaf9e('0x54')][_0xaf9e('0x67')];return db['Team'][_0xaf9e('0x42')]({'where':{'id':_0x123b6a},'attributes':['id'],'include':[{'model':db[_0xaf9e('0x5c')],'as':_0xaf9e('0x68'),'attributes':['id','name',_0xaf9e('0x69'),_0xaf9e('0x6a'),_0xaf9e('0x6b')],'raw':!![]}]})[_0xaf9e('0x28')](function(_0x2b5ba2){if(_0x2b5ba2){var _0x545071=_[_0xaf9e('0x6c')](_0x2b5ba2,function(_0x320bce){var _0xcf1179=_0x320bce[_0xaf9e('0x2a')]({'plain':!![]});return _0xcf1179[_0xaf9e('0x68')];});return db['OpenchannelQueue'][_0xaf9e('0x49')]({'where':{'id':_0x47ed1b[_0xaf9e('0x44')]['id']}})[_0xaf9e('0x28')](function(_0x55f751){return db[_0xaf9e('0x6d')][_0xaf9e('0x6e')](function(_0x111ddc){return _0x55f751[_0xaf9e('0x66')](_0x123b6a,{'transaction':_0x111ddc})['then'](function(){return BPromise[_0xaf9e('0x6f')](_0x545071,function(_0x552e03){return db[_0xaf9e('0x58')][_0xaf9e('0x70')]({'where':{'UserId':_0x552e03['id'],'OpenchannelQueueId':_0x47ed1b['params']['id']},'transaction':_0x111ddc});});})[_0xaf9e('0x28')](function(){_0x545071[_0xaf9e('0x71')](function(_0x2a8963){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x2a8963['id'],'OpenchannelQueueId':_0x55f751['id']});});});});});}})[_0xaf9e('0x28')](respondWithStatusCode(_0xe3b89b,null))[_0xaf9e('0x43')](handleError(_0xe3b89b,null));};exports[_0xaf9e('0x72')]=function(_0x5153dd,_0x3703ae,_0x421231){return db[_0xaf9e('0x65')][_0xaf9e('0x42')]({'where':{'id':_0x5153dd[_0xaf9e('0x35')][_0xaf9e('0x67')]},'attributes':['id'],'include':[{'model':db[_0xaf9e('0x5c')],'as':_0xaf9e('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3703ae,null))['then'](function(_0x379318){var _0x44aa7b=_[_0xaf9e('0x34')](_0x379318,'id');var _0x4ede8d=[];var _0x11cf45=[];var _0x393ae4=squel['select']();_0x393ae4[_0xaf9e('0x73')]('tq.TeamId')['from']('team_has_openchannel_queues','tq')['join'](_0xaf9e('0x74'),'ut',_0xaf9e('0x75'))[_0xaf9e('0x3d')](_0xaf9e('0x76'),_0x5153dd[_0xaf9e('0x44')]['id']);for(var _0x20a85b=0x0;_0x20a85b<_0x379318[_0xaf9e('0x3a')];_0x20a85b+=0x1){let _0x39338c=_0x379318[_0x20a85b];for(var _0x5cd1d9=0x0;_0x5cd1d9<_0x39338c['Agents']['length'];_0x5cd1d9+=0x1){let _0x2ac8ab=_0x39338c[_0xaf9e('0x68')][_0x5cd1d9];var _0xfcbe7d=_0x393ae4['clone']();_0xfcbe7d['where'](_0xaf9e('0x77'),_0x2ac8ab['id']);_0x11cf45[_0xaf9e('0x78')](db[_0xaf9e('0x6d')][_0xaf9e('0x35')](_0xfcbe7d[_0xaf9e('0x79')](),{'type':db[_0xaf9e('0x6d')][_0xaf9e('0x7a')][_0xaf9e('0x7b')]})['then'](function(_0x4f8bc0){if(_0x4f8bc0[_0xaf9e('0x3a')]===0x1){return _0x2ac8ab['id'];}else{var _0x3312af=_['every'](_[_0xaf9e('0x34')](_0x4f8bc0,_0xaf9e('0x7c')),function(_0x1facd6){return _['includes'](_0x44aa7b,_0x1facd6);});if(_0x3312af){return _0x2ac8ab['id'];}}}));}}return BPromise[_0xaf9e('0x7d')](_0x11cf45)['then'](function(_0x1870f3){_0x4ede8d=_(_0x4ede8d)[_0xaf9e('0x7e')](_0x1870f3)[_0xaf9e('0x7f')]()[_0xaf9e('0x80')]();return db[_0xaf9e('0x31')][_0xaf9e('0x49')]({'where':{'id':_0x5153dd['params']['id']}})[_0xaf9e('0x28')](function(_0x592cd5){return db[_0xaf9e('0x6d')]['transaction'](function(_0x267f7e){return _0x592cd5[_0xaf9e('0x72')](_0x5153dd[_0xaf9e('0x35')][_0xaf9e('0x67')],{'transaction':_0x267f7e})['then'](function(){if(!_['isEmpty'](_0x4ede8d)){return _0x592cd5[_0xaf9e('0x81')](_0x4ede8d,{'transaction':_0x267f7e});}})['then'](function(){_0x4ede8d[_0xaf9e('0x71')](function(_0x2bcd58){socket[_0xaf9e('0x82')]('userOpenchannelQueue:remove',{'UserId':_0x2bcd58,'OpenchannelQueueId':_0x592cd5['id']});});});});});});})[_0xaf9e('0x28')](respondWithStatusCode(_0x3703ae,null))[_0xaf9e('0x43')](handleError(_0x3703ae,null));};exports[_0xaf9e('0x83')]=function(_0x27bec7,_0x41aa6a,_0x2cc953){return db['OpenchannelQueue'][_0xaf9e('0x49')]({'where':{'id':_0x27bec7['params']['id']}})['then'](handleEntityNotFound(_0x41aa6a,null))['then'](function(_0x30b1ea){if(_0x30b1ea){return _0x30b1ea[_0xaf9e('0x83')](_0x27bec7[_0xaf9e('0x54')][_0xaf9e('0x67')],_[_0xaf9e('0x84')](_0x27bec7[_0xaf9e('0x54')],[_0xaf9e('0x67'),'id'])||{})[_0xaf9e('0x85')](function(_0x4a5ecc){for(var _0x2b0f95=0x0;_0x2b0f95<_0x27bec7[_0xaf9e('0x54')][_0xaf9e('0x67')][_0xaf9e('0x3a')];_0x2b0f95+=0x1){socket[_0xaf9e('0x82')](_0xaf9e('0x86'),{'UserId':_0x27bec7[_0xaf9e('0x54')][_0xaf9e('0x67')][_0x2b0f95],'OpenchannelQueueId':_0x27bec7[_0xaf9e('0x44')]['id']});}return _0x4a5ecc;});}})['then'](respondWithResult(_0x41aa6a,null))[_0xaf9e('0x43')](handleError(_0x41aa6a,null));};exports[_0xaf9e('0x81')]=function(_0x1b253e,_0x541b6c,_0x1cd14b){return db[_0xaf9e('0x31')][_0xaf9e('0x49')]({'where':{'id':_0x1b253e[_0xaf9e('0x44')]['id']}})[_0xaf9e('0x28')](handleEntityNotFound(_0x541b6c,null))[_0xaf9e('0x28')](function(_0x12ad7c){if(_0x12ad7c){return _0x12ad7c[_0xaf9e('0x81')](_0x1b253e[_0xaf9e('0x35')][_0xaf9e('0x67')])['then'](function(){if(_[_0xaf9e('0x87')](_0x1b253e[_0xaf9e('0x35')]['ids'])){for(var _0x1635e8=0x0;_0x1635e8<_0x1b253e[_0xaf9e('0x35')]['ids'][_0xaf9e('0x3a')];_0x1635e8+=0x1){socket['emit'](_0xaf9e('0x88'),{'UserId':Number(_0x1b253e[_0xaf9e('0x35')][_0xaf9e('0x67')][_0x1635e8]),'OpenchannelQueueId':Number(_0x1b253e[_0xaf9e('0x44')]['id'])});}}else{socket['emit'](_0xaf9e('0x88'),{'UserId':Number(_0x1b253e[_0xaf9e('0x35')]['ids']),'OpenchannelQueueId':Number(_0x1b253e['params']['id'])});}});}})[_0xaf9e('0x28')](respondWithStatusCode(_0x541b6c,null))['catch'](handleError(_0x541b6c,null));};exports[_0xaf9e('0x89')]=function(_0x5f3e7b,_0x538e2d,_0x1efd03){var _0x5a2290={};var _0x303be5={};var _0x7170b2;var _0x5f0ce0;return db[_0xaf9e('0x31')]['findOne']({'where':{'id':_0x5f3e7b['params']['id']}})[_0xaf9e('0x28')](handleEntityNotFound(_0x538e2d,null))[_0xaf9e('0x28')](function(_0x1350aa){if(_0x1350aa){_0x7170b2=_0x1350aa;_0x303be5['model']=_[_0xaf9e('0x36')](db[_0xaf9e('0x5c')][_0xaf9e('0x32')]);_0x303be5[_0xaf9e('0x35')]=_[_0xaf9e('0x36')](_0x5f3e7b['query']);_0x303be5[_0xaf9e('0x37')]=_[_0xaf9e('0x45')](_0x303be5[_0xaf9e('0x46')],_0x303be5['query']);_0x5a2290[_0xaf9e('0x38')]=_[_0xaf9e('0x45')](_0x303be5[_0xaf9e('0x46')],qs[_0xaf9e('0x39')](_0x5f3e7b[_0xaf9e('0x35')][_0xaf9e('0x39')]));_0x5a2290[_0xaf9e('0x38')]=_0x5a2290[_0xaf9e('0x38')][_0xaf9e('0x3a')]?_0x5a2290['attributes']:_0x303be5['model'];_0x5a2290['order']=qs[_0xaf9e('0x5a')](_0x5f3e7b[_0xaf9e('0x35')][_0xaf9e('0x5a')]);_0x5a2290[_0xaf9e('0x3d')]=qs[_0xaf9e('0x37')](_['pick'](_0x5f3e7b[_0xaf9e('0x35')],_0x303be5[_0xaf9e('0x37')]));if(_0x5f3e7b[_0xaf9e('0x35')]['filter']){_0x5a2290['where']=_[_0xaf9e('0x48')](_0x5a2290[_0xaf9e('0x3d')],{'$or':_[_0xaf9e('0x34')](_0x5a2290[_0xaf9e('0x38')],function(_0x987759){var _0x3b1a83={};_0x3b1a83[_0x987759]={'$like':'%'+_0x5f3e7b['query'][_0xaf9e('0x3e')]+'%'};return _0x3b1a83;})});}_0x5a2290=_['merge']({},_0x5a2290,_0x5f3e7b[_0xaf9e('0x40')]);return _0x7170b2[_0xaf9e('0x89')](_0x5a2290);}})['then'](function(_0x202560){if(_0x202560){_0x5f0ce0=_0x202560[_0xaf9e('0x3a')];if(!_0x5f3e7b[_0xaf9e('0x35')][_0xaf9e('0x59')]('nolimit')){_0x5a2290[_0xaf9e('0x23')]=qs[_0xaf9e('0x23')](_0x5f3e7b[_0xaf9e('0x35')][_0xaf9e('0x23')]);_0x5a2290['offset']=qs[_0xaf9e('0x22')](_0x5f3e7b['query'][_0xaf9e('0x22')]);}return _0x7170b2[_0xaf9e('0x89')](_0x5a2290);}})['then'](function(_0x8db4f5){if(_0x8db4f5){return _0x8db4f5?{'count':_0x5f0ce0,'rows':_0x8db4f5}:null;}})[_0xaf9e('0x28')](respondWithResult(_0x538e2d,null))[_0xaf9e('0x43')](handleError(_0x538e2d,null));}; \ No newline at end of file +var _0x1a29=['include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','body','describe','UserOpenchannelQueue','order','OpenchannelQueueId','filter','options','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','openchannelPause','getTeams','findOne','Team','addTeams','ids','User','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeTeams','isEmpty','addAgents','spread','removeAgents','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filters','merge','VIRTUAL','where','includeAll','findAll','catch','show','params'];(function(_0x1e723e,_0x577e17){var _0x1a243b=function(_0x538d3f){while(--_0x538d3f){_0x1e723e['push'](_0x1e723e['shift']());}};_0x1a243b(++_0x577e17);}(_0x1a29,0xcb));var _0x91a2=function(_0x218556,_0x265ca4){_0x218556=_0x218556-0x0;var _0x394646=_0x1a29[_0x218556];return _0x394646;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x91a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x91a2('0x1'));var rp=require(_0x91a2('0x2'));var moment=require(_0x91a2('0x3'));var BPromise=require(_0x91a2('0x4'));var Mustache=require(_0x91a2('0x5'));var util=require('util');var path=require(_0x91a2('0x6'));var sox=require('sox');var csv=require(_0x91a2('0x7'));var ejs=require(_0x91a2('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x91a2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x91a2('0xa'));var toCsv=require(_0x91a2('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x91a2('0xb'));var authService=require(_0x91a2('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x91a2('0xd'));var hardwareService=require(_0x91a2('0xe'));var logger=require(_0x91a2('0xf'))(_0x91a2('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x91a2('0x11'));var db=require(_0x91a2('0x12'))['db'];config[_0x91a2('0x13')]=_[_0x91a2('0x14')](config[_0x91a2('0x13')],{'host':_0x91a2('0x15'),'port':0x18eb});var socket=require(_0x91a2('0x16'))(new Redis(config['redis']));require(_0x91a2('0x17'))[_0x91a2('0x18')](socket);function respondWithStatusCode(_0x36b70a,_0x1bbec4){_0x1bbec4=_0x1bbec4||0xcc;return function(_0x16cfc8){if(_0x16cfc8){return _0x36b70a[_0x91a2('0x19')](_0x1bbec4);}return _0x36b70a[_0x91a2('0x1a')](_0x1bbec4)['end']();};}function respondWithResult(_0x4a1cab,_0x3b562b){_0x3b562b=_0x3b562b||0xc8;return function(_0x1b4715){if(_0x1b4715){return _0x4a1cab[_0x91a2('0x1a')](_0x3b562b)[_0x91a2('0x1b')](_0x1b4715);}};}function respondWithFilteredResult(_0x25a7c4,_0x6cf194){return function(_0x2089f9){if(_0x2089f9){var _0x298d70=_0x2089f9[_0x91a2('0x1c')],_0x15e029=_0x6cf194[_0x91a2('0x1d')],_0x3c56ce=_0x6cf194[_0x91a2('0x1d')]+_0x6cf194['limit'],_0x1ef3c2;if(_0x3c56ce>=_0x298d70){_0x3c56ce=_0x298d70;_0x1ef3c2=0xc8;}else{_0x1ef3c2=0xce;}_0x25a7c4[_0x91a2('0x1a')](_0x1ef3c2);return _0x25a7c4[_0x91a2('0x1e')](_0x91a2('0x1f'),_0x15e029+'-'+_0x3c56ce+'/'+_0x298d70)[_0x91a2('0x1b')](_0x2089f9);}return null;};}function patchUpdates(_0x42d393){return function(_0x44814e){try{jsonpatch['apply'](_0x44814e,_0x42d393,!![]);}catch(_0x1323fa){return BPromise[_0x91a2('0x20')](_0x1323fa);}return _0x44814e[_0x91a2('0x21')]();};}function saveUpdates(_0x1fd847,_0x4011e2){return function(_0x1b4110){if(_0x1b4110){return _0x1b4110[_0x91a2('0x22')](_0x1fd847)[_0x91a2('0x23')](function(_0x361339){return _0x361339;});}return null;};}function removeEntity(_0x3dd1b9,_0x179bc7){return function(_0x4777e2){if(_0x4777e2){return _0x4777e2[_0x91a2('0x24')]()['then'](function(){var _0x1867db=_0x4777e2[_0x91a2('0x25')]({'plain':!![]});var _0x2f6a53=_0x91a2('0x26');return db[_0x91a2('0x27')][_0x91a2('0x24')]({'where':{'type':_0x2f6a53,'resourceId':_0x1867db['id']}})[_0x91a2('0x23')](function(){return _0x4777e2;});})[_0x91a2('0x23')](function(){_0x3dd1b9[_0x91a2('0x1a')](0xcc)[_0x91a2('0x28')]();});}};}function handleEntityNotFound(_0x2ec5e4,_0x2ead3f){return function(_0x50b4ba){if(!_0x50b4ba){_0x2ec5e4['sendStatus'](0x194);}return _0x50b4ba;};}function handleError(_0x7d2d6,_0x13db9f){_0x13db9f=_0x13db9f||0x1f4;return function(_0x5e3d3f){logger[_0x91a2('0x29')](_0x5e3d3f[_0x91a2('0x2a')]);if(_0x5e3d3f[_0x91a2('0x2b')]){delete _0x5e3d3f[_0x91a2('0x2b')];}_0x7d2d6[_0x91a2('0x1a')](_0x13db9f)[_0x91a2('0x2c')](_0x5e3d3f);};}exports[_0x91a2('0x2d')]=function(_0x266617,_0x38143e){var _0x146f85={},_0x425402={},_0x3c2238={'count':0x0,'rows':[]};var _0x4c1fc9=_[_0x91a2('0x2e')](db[_0x91a2('0x2f')][_0x91a2('0x30')],function(_0x7c8d62){return{'name':_0x7c8d62[_0x91a2('0x31')],'type':_0x7c8d62[_0x91a2('0x32')][_0x91a2('0x33')]};});_0x425402[_0x91a2('0x34')]=_['map'](_0x4c1fc9,_0x91a2('0x2b'));_0x425402[_0x91a2('0x35')]=_[_0x91a2('0x36')](_0x266617[_0x91a2('0x35')]);_0x425402['filters']=_[_0x91a2('0x37')](_0x425402['model'],_0x425402[_0x91a2('0x35')]);_0x146f85[_0x91a2('0x38')]=_[_0x91a2('0x37')](_0x425402[_0x91a2('0x34')],qs[_0x91a2('0x39')](_0x266617[_0x91a2('0x35')][_0x91a2('0x39')]));_0x146f85['attributes']=_0x146f85[_0x91a2('0x38')][_0x91a2('0x3a')]?_0x146f85['attributes']:_0x425402[_0x91a2('0x34')];if(!_0x266617[_0x91a2('0x35')][_0x91a2('0x3b')](_0x91a2('0x3c'))){_0x146f85['limit']=qs[_0x91a2('0x3d')](_0x266617[_0x91a2('0x35')]['limit']);_0x146f85[_0x91a2('0x1d')]=qs['offset'](_0x266617[_0x91a2('0x35')][_0x91a2('0x1d')]);}_0x146f85['order']=qs[_0x91a2('0x3e')](_0x266617[_0x91a2('0x35')][_0x91a2('0x3e')]);_0x146f85['where']=qs['filters'](_[_0x91a2('0x3f')](_0x266617[_0x91a2('0x35')],_0x425402[_0x91a2('0x40')]),_0x4c1fc9);if(_0x266617[_0x91a2('0x35')]['filter']){_0x146f85['where']=_[_0x91a2('0x41')](_0x146f85['where'],{'$or':_['map'](_0x4c1fc9,function(_0x422f93){if(_0x422f93[_0x91a2('0x32')]!==_0x91a2('0x42')){var _0x22d576={};_0x22d576[_0x422f93[_0x91a2('0x2b')]]={'$like':'%'+_0x266617[_0x91a2('0x35')]['filter']+'%'};return _0x22d576;}})});}_0x146f85=_['merge']({},_0x146f85,_0x266617['options']);var _0x38bba8={'where':_0x146f85[_0x91a2('0x43')]};return db[_0x91a2('0x2f')]['count'](_0x38bba8)[_0x91a2('0x23')](function(_0x4131a4){_0x3c2238['count']=_0x4131a4;if(_0x266617[_0x91a2('0x35')][_0x91a2('0x44')]){_0x146f85['include']=[{'all':!![]}];}return db[_0x91a2('0x2f')][_0x91a2('0x45')](_0x146f85);})['then'](function(_0x39ef2b){_0x3c2238['rows']=_0x39ef2b;return _0x3c2238;})[_0x91a2('0x23')](respondWithFilteredResult(_0x38143e,_0x146f85))[_0x91a2('0x46')](handleError(_0x38143e,null));};exports[_0x91a2('0x47')]=function(_0x34680d,_0x41725a){var _0x26374f={'raw':!![],'where':{'id':_0x34680d[_0x91a2('0x48')]['id']}},_0x37ac0a={};_0x37ac0a[_0x91a2('0x34')]=_[_0x91a2('0x36')](db[_0x91a2('0x2f')][_0x91a2('0x30')]);_0x37ac0a['query']=_['keys'](_0x34680d[_0x91a2('0x35')]);_0x37ac0a[_0x91a2('0x40')]=_['intersection'](_0x37ac0a['model'],_0x37ac0a[_0x91a2('0x35')]);_0x26374f[_0x91a2('0x38')]=_['intersection'](_0x37ac0a[_0x91a2('0x34')],qs[_0x91a2('0x39')](_0x34680d[_0x91a2('0x35')]['fields']));_0x26374f[_0x91a2('0x38')]=_0x26374f[_0x91a2('0x38')][_0x91a2('0x3a')]?_0x26374f[_0x91a2('0x38')]:_0x37ac0a[_0x91a2('0x34')];if(_0x34680d[_0x91a2('0x35')][_0x91a2('0x44')]){_0x26374f[_0x91a2('0x49')]=[{'all':!![]}];}_0x26374f=_[_0x91a2('0x41')]({},_0x26374f,_0x34680d['options']);return db[_0x91a2('0x2f')][_0x91a2('0x4a')](_0x26374f)[_0x91a2('0x23')](handleEntityNotFound(_0x41725a,null))[_0x91a2('0x23')](respondWithResult(_0x41725a,null))[_0x91a2('0x46')](handleError(_0x41725a,null));};exports[_0x91a2('0x4b')]=function(_0x42bdd8,_0x17c6b0){return db['OpenchannelQueue'][_0x91a2('0x4b')](_0x42bdd8['body'],{})[_0x91a2('0x23')](function(_0x543ee1){var _0x44debd=_0x42bdd8[_0x91a2('0x4c')]['get']({'plain':!![]});if(!_0x44debd)throw new Error(_0x91a2('0x4d'));if(_0x44debd[_0x91a2('0x4e')]===_0x91a2('0x4c')){var _0x2068ff=_0x543ee1[_0x91a2('0x25')]({'plain':!![]});var _0x16f8c0=_0x91a2('0x26');return db['UserProfileSection'][_0x91a2('0x4a')]({'where':{'name':_0x16f8c0,'userProfileId':_0x44debd[_0x91a2('0x4f')]},'raw':!![]})[_0x91a2('0x23')](function(_0x10666d){if(_0x10666d&&_0x10666d[_0x91a2('0x50')]===0x0){return db[_0x91a2('0x27')][_0x91a2('0x4b')]({'name':_0x2068ff[_0x91a2('0x2b')],'resourceId':_0x2068ff['id'],'type':_0x10666d[_0x91a2('0x2b')],'sectionId':_0x10666d['id']},{})[_0x91a2('0x23')](function(){return _0x543ee1;});}else{return _0x543ee1;}})[_0x91a2('0x46')](function(_0x1abf87){logger[_0x91a2('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1abf87);throw _0x1abf87;});}return _0x543ee1;})['then'](respondWithResult(_0x17c6b0,0xc9))[_0x91a2('0x46')](handleError(_0x17c6b0,null));};exports[_0x91a2('0x22')]=function(_0x3be701,_0xc9ef83){if(_0x3be701[_0x91a2('0x51')]['id']){delete _0x3be701[_0x91a2('0x51')]['id'];}return db[_0x91a2('0x2f')][_0x91a2('0x4a')]({'where':{'id':_0x3be701[_0x91a2('0x48')]['id']}})[_0x91a2('0x23')](handleEntityNotFound(_0xc9ef83,null))[_0x91a2('0x23')](saveUpdates(_0x3be701[_0x91a2('0x51')],null))[_0x91a2('0x23')](respondWithResult(_0xc9ef83,null))[_0x91a2('0x46')](handleError(_0xc9ef83,null));};exports['destroy']=function(_0x2768a1,_0x27065b){return db['OpenchannelQueue'][_0x91a2('0x4a')]({'where':{'id':_0x2768a1['params']['id']}})['then'](handleEntityNotFound(_0x27065b,null))[_0x91a2('0x23')](removeEntity(_0x27065b,null))['catch'](handleError(_0x27065b,null));};exports[_0x91a2('0x52')]=function(_0x35e126,_0x3a8803){return db[_0x91a2('0x2f')]['describe']()[_0x91a2('0x23')](respondWithResult(_0x3a8803,null))[_0x91a2('0x46')](handleError(_0x3a8803,null));};exports['getMembers']=function(_0x133ed7,_0x174df9,_0x5e8223){var _0x5a45ea={'raw':!![],'where':{}},_0x31da0f={},_0x2f4963;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x133ed7[_0x91a2('0x48')]['id']}})['then'](handleEntityNotFound(_0x174df9,null))[_0x91a2('0x23')](function(_0x274f75){if(_0x274f75){_0x2f4963=_0x274f75[_0x91a2('0x25')]({'plain':!![]});_0x31da0f['model']=_[_0x91a2('0x36')](db[_0x91a2('0x53')][_0x91a2('0x30')]);_0x31da0f['query']=_[_0x91a2('0x36')](_0x133ed7[_0x91a2('0x35')]);_0x31da0f[_0x91a2('0x40')]=_[_0x91a2('0x37')](_0x31da0f['model'],_0x31da0f['query']);_0x5a45ea['attributes']=_[_0x91a2('0x37')](_0x31da0f['model'],qs[_0x91a2('0x39')](_0x133ed7[_0x91a2('0x35')][_0x91a2('0x39')]));_0x5a45ea[_0x91a2('0x38')]=_0x5a45ea[_0x91a2('0x38')][_0x91a2('0x3a')]?_0x5a45ea[_0x91a2('0x38')]:_0x31da0f[_0x91a2('0x34')];if(!_0x133ed7[_0x91a2('0x35')][_0x91a2('0x3b')](_0x91a2('0x3c'))){_0x5a45ea['limit']=qs[_0x91a2('0x3d')](_0x133ed7[_0x91a2('0x35')][_0x91a2('0x3d')]);_0x5a45ea[_0x91a2('0x1d')]=qs[_0x91a2('0x1d')](_0x133ed7['query'][_0x91a2('0x1d')]);}_0x5a45ea[_0x91a2('0x54')]=qs[_0x91a2('0x3e')](_0x133ed7[_0x91a2('0x35')][_0x91a2('0x3e')]);_0x5a45ea['where']=qs[_0x91a2('0x40')](_[_0x91a2('0x3f')](_0x133ed7['query'],_0x31da0f[_0x91a2('0x40')]));_0x5a45ea[_0x91a2('0x43')][_0x91a2('0x55')]=_0x274f75['id'];if(_0x133ed7[_0x91a2('0x35')][_0x91a2('0x56')]){_0x5a45ea[_0x91a2('0x43')]=_[_0x91a2('0x41')](_0x5a45ea['where'],{'$or':_[_0x91a2('0x2e')](_0x5a45ea[_0x91a2('0x38')],function(_0x2906aa){var _0x1b91e0={};_0x1b91e0[_0x2906aa]={'$like':'%'+_0x133ed7[_0x91a2('0x35')][_0x91a2('0x56')]+'%'};return _0x1b91e0;})});}_0x5a45ea=_['merge']({},_0x5a45ea,_0x133ed7[_0x91a2('0x57')]);return db[_0x91a2('0x53')]['findAll'](_0x5a45ea);}})[_0x91a2('0x23')](function(_0x555b9e){if(_0x555b9e){return db['User']['findAndCountAll']({'where':{'id':_[_0x91a2('0x2e')](_0x555b9e,_0x91a2('0x58')),'role':_0x91a2('0x59')},'attributes':['id',_0x91a2('0x2b'),'openchannelPause',_0x91a2('0x5a'),_0x91a2('0x5b')]});}})[_0x91a2('0x23')](function(_0x133a4a){if(_0x133a4a){return{'count':_0x133a4a['count'],'rows':_['map'](_0x133a4a[_0x91a2('0x5c')],function(_0x46bcaa){return{'membername':_0x46bcaa[_0x91a2('0x2b')],'UserId':_0x46bcaa['id'],'queue_name':_0x2f4963['name'],'OpenchannelQueueId':_0x2f4963['id'],'interface':util[_0x91a2('0x5d')](_0x91a2('0x5e'),_0x91a2('0x5f'),_0x46bcaa[_0x91a2('0x2b')]),'penalty':0x0,'paused':_0x46bcaa[_0x91a2('0x60')],'createdAt':_0x46bcaa[_0x91a2('0x5b')],'updatedAt':_0x46bcaa[_0x91a2('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x174df9,_0x5a45ea))[_0x91a2('0x46')](handleError(_0x174df9,null));};exports[_0x91a2('0x61')]=function(_0x408277,_0x51bfa6,_0x378433){var _0x45e5de={};var _0x4b006f={};var _0x3e390d;var _0x3d4a09;return db[_0x91a2('0x2f')][_0x91a2('0x62')]({'where':{'id':_0x408277[_0x91a2('0x48')]['id']}})[_0x91a2('0x23')](handleEntityNotFound(_0x51bfa6,null))[_0x91a2('0x23')](function(_0xa2e797){if(_0xa2e797){_0x3e390d=_0xa2e797;_0x4b006f[_0x91a2('0x34')]=_[_0x91a2('0x36')](db[_0x91a2('0x63')][_0x91a2('0x30')]);_0x4b006f[_0x91a2('0x35')]=_[_0x91a2('0x36')](_0x408277[_0x91a2('0x35')]);_0x4b006f[_0x91a2('0x40')]=_[_0x91a2('0x37')](_0x4b006f[_0x91a2('0x34')],_0x4b006f[_0x91a2('0x35')]);_0x45e5de[_0x91a2('0x38')]=_[_0x91a2('0x37')](_0x4b006f[_0x91a2('0x34')],qs[_0x91a2('0x39')](_0x408277[_0x91a2('0x35')]['fields']));_0x45e5de['attributes']=_0x45e5de[_0x91a2('0x38')][_0x91a2('0x3a')]?_0x45e5de[_0x91a2('0x38')]:_0x4b006f[_0x91a2('0x34')];_0x45e5de[_0x91a2('0x54')]=qs[_0x91a2('0x3e')](_0x408277['query'][_0x91a2('0x3e')]);_0x45e5de['where']=qs[_0x91a2('0x40')](_[_0x91a2('0x3f')](_0x408277[_0x91a2('0x35')],_0x4b006f[_0x91a2('0x40')]));if(_0x408277[_0x91a2('0x35')]['filter']){_0x45e5de[_0x91a2('0x43')]=_['merge'](_0x45e5de[_0x91a2('0x43')],{'$or':_[_0x91a2('0x2e')](_0x45e5de['attributes'],function(_0x2d3f74){var _0x117b19={};_0x117b19[_0x2d3f74]={'$like':'%'+_0x408277[_0x91a2('0x35')]['filter']+'%'};return _0x117b19;})});}_0x45e5de=_[_0x91a2('0x41')]({},_0x45e5de,_0x408277['options']);return _0x3e390d[_0x91a2('0x61')](_0x45e5de);}})['then'](function(_0x1e7e88){if(_0x1e7e88){_0x3d4a09=_0x1e7e88[_0x91a2('0x3a')];if(!_0x408277[_0x91a2('0x35')][_0x91a2('0x3b')](_0x91a2('0x3c'))){_0x45e5de[_0x91a2('0x3d')]=qs[_0x91a2('0x3d')](_0x408277[_0x91a2('0x35')][_0x91a2('0x3d')]);_0x45e5de['offset']=qs[_0x91a2('0x1d')](_0x408277['query'][_0x91a2('0x1d')]);}return _0x3e390d[_0x91a2('0x61')](_0x45e5de);}})[_0x91a2('0x23')](function(_0x2bd7f0){if(_0x2bd7f0){return _0x2bd7f0?{'count':_0x3d4a09,'rows':_0x2bd7f0}:null;}})['then'](respondWithResult(_0x51bfa6,null))['catch'](handleError(_0x51bfa6,null));};exports[_0x91a2('0x64')]=function(_0x4df1b5,_0x3a2025,_0x296e16){var _0x32088b=_0x4df1b5[_0x91a2('0x51')][_0x91a2('0x65')];return db['Team'][_0x91a2('0x45')]({'where':{'id':_0x32088b},'attributes':['id'],'include':[{'model':db[_0x91a2('0x66')],'as':'Agents','attributes':['id','name',_0x91a2('0x67'),_0x91a2('0x68'),_0x91a2('0x69')],'raw':!![]}]})[_0x91a2('0x23')](function(_0x4afde4){if(_0x4afde4){var _0x134de0=_['flatMap'](_0x4afde4,function(_0xf5f8c){var _0x103c4a=_0xf5f8c[_0x91a2('0x25')]({'plain':!![]});return _0x103c4a[_0x91a2('0x6a')];});return db[_0x91a2('0x2f')][_0x91a2('0x4a')]({'where':{'id':_0x4df1b5['params']['id']}})[_0x91a2('0x23')](function(_0x331c43){return db[_0x91a2('0x6b')][_0x91a2('0x6c')](function(_0x1c21f){return _0x331c43[_0x91a2('0x64')](_0x32088b,{'transaction':_0x1c21f})[_0x91a2('0x23')](function(){return BPromise[_0x91a2('0x6d')](_0x134de0,function(_0x2ed3d1){return db[_0x91a2('0x53')][_0x91a2('0x6e')]({'where':{'UserId':_0x2ed3d1['id'],'OpenchannelQueueId':_0x4df1b5['params']['id']},'transaction':_0x1c21f});});})[_0x91a2('0x23')](function(){_0x134de0[_0x91a2('0x6f')](function(_0x10d381){socket[_0x91a2('0x70')](_0x91a2('0x71'),{'UserId':_0x10d381['id'],'OpenchannelQueueId':_0x331c43['id']});});});});});}})['then'](respondWithStatusCode(_0x3a2025,null))['catch'](handleError(_0x3a2025,null));};exports['removeTeams']=function(_0x561e3e,_0x13ae20,_0x52cab8){return db['Team'][_0x91a2('0x45')]({'where':{'id':_0x561e3e[_0x91a2('0x35')][_0x91a2('0x65')]},'attributes':['id'],'include':[{'model':db[_0x91a2('0x66')],'as':_0x91a2('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x91a2('0x23')](handleEntityNotFound(_0x13ae20,null))[_0x91a2('0x23')](function(_0x24212f){var _0x3b1c9d=_['map'](_0x24212f,'id');var _0x1b515d=[];var _0x3989f0=[];var _0x32fb4c=squel['select']();_0x32fb4c[_0x91a2('0x72')](_0x91a2('0x73'))[_0x91a2('0x74')]('team_has_openchannel_queues','tq')[_0x91a2('0x75')](_0x91a2('0x76'),'ut',_0x91a2('0x77'))[_0x91a2('0x43')]('OpenchannelQueueId\x20=\x20?',_0x561e3e[_0x91a2('0x48')]['id']);for(var _0x80126b=0x0;_0x80126b<_0x24212f[_0x91a2('0x3a')];_0x80126b+=0x1){let _0xba6d3c=_0x24212f[_0x80126b];for(var _0x2ab4fe=0x0;_0x2ab4fe<_0xba6d3c['Agents'][_0x91a2('0x3a')];_0x2ab4fe+=0x1){let _0x3cbdb6=_0xba6d3c[_0x91a2('0x6a')][_0x2ab4fe];var _0x4a599c=_0x32fb4c[_0x91a2('0x78')]();_0x4a599c[_0x91a2('0x43')]('ut.UserId\x20=\x20?',_0x3cbdb6['id']);_0x3989f0[_0x91a2('0x79')](db[_0x91a2('0x6b')][_0x91a2('0x35')](_0x4a599c[_0x91a2('0x7a')](),{'type':db[_0x91a2('0x6b')][_0x91a2('0x7b')][_0x91a2('0x7c')]})['then'](function(_0xf4cb60){if(_0xf4cb60[_0x91a2('0x3a')]===0x1){return _0x3cbdb6['id'];}else{var _0x2c342d=_[_0x91a2('0x7d')](_[_0x91a2('0x2e')](_0xf4cb60,_0x91a2('0x7e')),function(_0x2ffb3f){return _['includes'](_0x3b1c9d,_0x2ffb3f);});if(_0x2c342d){return _0x3cbdb6['id'];}}}));}}return BPromise[_0x91a2('0x7f')](_0x3989f0)[_0x91a2('0x23')](function(_0x4954ff){_0x1b515d=_(_0x1b515d)[_0x91a2('0x80')](_0x4954ff)[_0x91a2('0x81')]()[_0x91a2('0x82')]();return db['OpenchannelQueue'][_0x91a2('0x4a')]({'where':{'id':_0x561e3e[_0x91a2('0x48')]['id']}})[_0x91a2('0x23')](function(_0x5a3afe){return db[_0x91a2('0x6b')][_0x91a2('0x6c')](function(_0x4dd533){return _0x5a3afe[_0x91a2('0x83')](_0x561e3e[_0x91a2('0x35')][_0x91a2('0x65')],{'transaction':_0x4dd533})[_0x91a2('0x23')](function(){if(!_[_0x91a2('0x84')](_0x1b515d)){return _0x5a3afe['removeAgents'](_0x1b515d,{'transaction':_0x4dd533});}})[_0x91a2('0x23')](function(){_0x1b515d['forEach'](function(_0x3f8d75){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x3f8d75,'OpenchannelQueueId':_0x5a3afe['id']});});});});});});})['then'](respondWithStatusCode(_0x13ae20,null))[_0x91a2('0x46')](handleError(_0x13ae20,null));};exports[_0x91a2('0x85')]=function(_0x3baad3,_0xa7af71,_0x55df32){return db['OpenchannelQueue'][_0x91a2('0x4a')]({'where':{'id':_0x3baad3['params']['id']}})[_0x91a2('0x23')](handleEntityNotFound(_0xa7af71,null))[_0x91a2('0x23')](function(_0x21b497){if(_0x21b497){return _0x21b497[_0x91a2('0x85')](_0x3baad3['body'][_0x91a2('0x65')],_['omit'](_0x3baad3[_0x91a2('0x51')],['ids','id'])||{})[_0x91a2('0x86')](function(_0x11170a){for(var _0x51de6f=0x0;_0x51de6f<_0x3baad3[_0x91a2('0x51')]['ids'][_0x91a2('0x3a')];_0x51de6f+=0x1){socket[_0x91a2('0x70')]('userOpenchannelQueue:save',{'UserId':_0x3baad3[_0x91a2('0x51')][_0x91a2('0x65')][_0x51de6f],'OpenchannelQueueId':_0x3baad3['params']['id']});}return _0x11170a;});}})[_0x91a2('0x23')](respondWithResult(_0xa7af71,null))[_0x91a2('0x46')](handleError(_0xa7af71,null));};exports[_0x91a2('0x87')]=function(_0x4dcba0,_0x2c14e1,_0x5c3cd8){return db[_0x91a2('0x2f')]['find']({'where':{'id':_0x4dcba0[_0x91a2('0x48')]['id']}})[_0x91a2('0x23')](handleEntityNotFound(_0x2c14e1,null))[_0x91a2('0x23')](function(_0x2cac7a){if(_0x2cac7a){return _0x2cac7a[_0x91a2('0x87')](_0x4dcba0[_0x91a2('0x35')][_0x91a2('0x65')])[_0x91a2('0x23')](function(){if(_[_0x91a2('0x88')](_0x4dcba0['query']['ids'])){for(var _0x3870ca=0x0;_0x3870ca<_0x4dcba0[_0x91a2('0x35')][_0x91a2('0x65')][_0x91a2('0x3a')];_0x3870ca+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x4dcba0[_0x91a2('0x35')]['ids'][_0x3870ca]),'OpenchannelQueueId':Number(_0x4dcba0[_0x91a2('0x48')]['id'])});}}else{socket[_0x91a2('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4dcba0[_0x91a2('0x35')][_0x91a2('0x65')]),'OpenchannelQueueId':Number(_0x4dcba0[_0x91a2('0x48')]['id'])});}});}})[_0x91a2('0x23')](respondWithStatusCode(_0x2c14e1,null))[_0x91a2('0x46')](handleError(_0x2c14e1,null));};exports[_0x91a2('0x89')]=function(_0x15e94a,_0x2bf7f7,_0x11c881){var _0x5c1066={};var _0x2f0200={};var _0x1f3e59;var _0xa86cd7;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x15e94a['params']['id']}})[_0x91a2('0x23')](handleEntityNotFound(_0x2bf7f7,null))[_0x91a2('0x23')](function(_0x527c39){if(_0x527c39){_0x1f3e59=_0x527c39;_0x2f0200[_0x91a2('0x34')]=_[_0x91a2('0x36')](db[_0x91a2('0x66')]['rawAttributes']);_0x2f0200[_0x91a2('0x35')]=_[_0x91a2('0x36')](_0x15e94a['query']);_0x2f0200[_0x91a2('0x40')]=_[_0x91a2('0x37')](_0x2f0200['model'],_0x2f0200[_0x91a2('0x35')]);_0x5c1066['attributes']=_[_0x91a2('0x37')](_0x2f0200[_0x91a2('0x34')],qs[_0x91a2('0x39')](_0x15e94a[_0x91a2('0x35')][_0x91a2('0x39')]));_0x5c1066['attributes']=_0x5c1066[_0x91a2('0x38')][_0x91a2('0x3a')]?_0x5c1066['attributes']:_0x2f0200['model'];_0x5c1066['order']=qs[_0x91a2('0x3e')](_0x15e94a[_0x91a2('0x35')][_0x91a2('0x3e')]);_0x5c1066['where']=qs[_0x91a2('0x40')](_['pick'](_0x15e94a[_0x91a2('0x35')],_0x2f0200[_0x91a2('0x40')]));if(_0x15e94a['query'][_0x91a2('0x56')]){_0x5c1066['where']=_[_0x91a2('0x41')](_0x5c1066[_0x91a2('0x43')],{'$or':_[_0x91a2('0x2e')](_0x5c1066[_0x91a2('0x38')],function(_0x6d5e00){var _0x2ccbc8={};_0x2ccbc8[_0x6d5e00]={'$like':'%'+_0x15e94a['query'][_0x91a2('0x56')]+'%'};return _0x2ccbc8;})});}_0x5c1066=_[_0x91a2('0x41')]({},_0x5c1066,_0x15e94a[_0x91a2('0x57')]);return _0x1f3e59[_0x91a2('0x89')](_0x5c1066);}})[_0x91a2('0x23')](function(_0x7d5a7b){if(_0x7d5a7b){_0xa86cd7=_0x7d5a7b['length'];if(!_0x15e94a['query'][_0x91a2('0x3b')]('nolimit')){_0x5c1066[_0x91a2('0x3d')]=qs['limit'](_0x15e94a[_0x91a2('0x35')][_0x91a2('0x3d')]);_0x5c1066[_0x91a2('0x1d')]=qs['offset'](_0x15e94a['query']['offset']);}return _0x1f3e59[_0x91a2('0x89')](_0x5c1066);}})[_0x91a2('0x23')](function(_0x1c9885){if(_0x1c9885){return _0x1c9885?{'count':_0xa86cd7,'rows':_0x1c9885}:null;}})[_0x91a2('0x23')](respondWithResult(_0x2bf7f7,null))[_0x91a2('0x46')](handleError(_0x2bf7f7,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index c3423ce..2a10901 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 _0xaf07=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x48bec2,_0x199312){var _0x51889d=function(_0x291752){while(--_0x291752){_0x48bec2['push'](_0x48bec2['shift']());}};_0x51889d(++_0x199312);}(_0xaf07,0x109));var _0x7af0=function(_0x22bdd4,_0x35d831){_0x22bdd4=_0x22bdd4-0x0;var _0x262625=_0xaf07[_0x22bdd4];return _0x262625;};'use strict';var EventEmitter=require(_0x7af0('0x0'));var OpenchannelQueue=require(_0x7af0('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x7af0('0x2')](0x0);var events={'afterCreate':_0x7af0('0x3'),'afterUpdate':_0x7af0('0x4'),'afterDestroy':_0x7af0('0x5')};function emitEvent(_0x106521){return function(_0x15a358,_0x390f93,_0x496375){OpenchannelQueueEvents[_0x7af0('0x6')](_0x106521+':'+_0x15a358['id'],_0x15a358);OpenchannelQueueEvents[_0x7af0('0x6')](_0x106521,_0x15a358);_0x496375(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x7af0('0x7')](e,emitEvent(event));}}module[_0x7af0('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x7553=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x8582f3,_0x46df44){var _0x5ec81c=function(_0x4813d0){while(--_0x4813d0){_0x8582f3['push'](_0x8582f3['shift']());}};_0x5ec81c(++_0x46df44);}(_0x7553,0x19a));var _0x3755=function(_0x5b6dd2,_0x43f939){_0x5b6dd2=_0x5b6dd2-0x0;var _0x4a62e8=_0x7553[_0x5b6dd2];return _0x4a62e8;};'use strict';var EventEmitter=require(_0x3755('0x0'));var OpenchannelQueue=require(_0x3755('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3755('0x2')](0x0);var events={'afterCreate':_0x3755('0x3'),'afterUpdate':_0x3755('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1b6cb6){return function(_0x146d2f,_0x2fd2a9,_0x2c72d3){OpenchannelQueueEvents[_0x3755('0x5')](_0x1b6cb6+':'+_0x146d2f['id'],_0x146d2f);OpenchannelQueueEvents[_0x3755('0x5')](_0x1b6cb6,_0x146d2f);_0x2c72d3(null);};}for(var e in events){if(events[_0x3755('0x6')](e)){var event=events[e];OpenchannelQueue[_0x3755('0x7')](e,emitEvent(event));}}module[_0x3755('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 97d0ece..d98b85b 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 _0x342e=['bluebird','request-promise','../../config/environment','./openchannelQueue.attributes','exports','openchannel_queues','lodash','util','../../config/logger'];(function(_0x18dc32,_0x26d38e){var _0x2adfaf=function(_0x59f994){while(--_0x59f994){_0x18dc32['push'](_0x18dc32['shift']());}};_0x2adfaf(++_0x26d38e);}(_0x342e,0xde));var _0xe342=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x342e[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0xe342('0x0'));var util=require(_0xe342('0x1'));var logger=require(_0xe342('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe342('0x3'));var rp=require(_0xe342('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe342('0x5'));var attributes=require(_0xe342('0x6'));module[_0xe342('0x7')]=function(_0x590e9,_0x164e21){return _0x590e9['define']('OpenchannelQueue',attributes,{'tableName':_0xe342('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7b4=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','api','moment'];(function(_0x50f9ee,_0x453849){var _0x39e025=function(_0x74f170){while(--_0x74f170){_0x50f9ee['push'](_0x50f9ee['shift']());}};_0x39e025(++_0x453849);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2f60f5,_0xcbf7cb){_0x2f60f5=_0x2f60f5-0x0;var _0x28ec03=_0xf7b4[_0x2f60f5];return _0x28ec03;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f7b('0x1'));var moment=require(_0x4f7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f7b('0x3'));var rimraf=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var attributes=require(_0x4f7b('0x6'));module[_0x4f7b('0x7')]=function(_0x2637f0,_0x427f8b){return _0x2637f0[_0x4f7b('0x8')](_0x4f7b('0x9'),attributes,{'tableName':_0x4f7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index d7e85aa..df0e9ce 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 _0x9d6d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','findAll','options','raw','where','attributes','limit','map','include','model','GetOpenchannelQueue','catch','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring'];(function(_0x57523f,_0x1cdf44){var _0x3f6659=function(_0x110670){while(--_0x110670){_0x57523f['push'](_0x57523f['shift']());}};_0x3f6659(++_0x1cdf44);}(_0x9d6d,0x97));var _0xd9d6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x9d6d[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xd9d6('0x0'));var util=require(_0xd9d6('0x1'));var moment=require(_0xd9d6('0x2'));var BPromise=require(_0xd9d6('0x3'));var rs=require(_0xd9d6('0x4'));var fs=require('fs');var Redis=require(_0xd9d6('0x5'));var db=require(_0xd9d6('0x6'))['db'];var utils=require(_0xd9d6('0x7'));var logger=require(_0xd9d6('0x8'))(_0xd9d6('0x9'));var config=require(_0xd9d6('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd9d6('0xb')]({'port':0x232a});config[_0xd9d6('0xc')]=_[_0xd9d6('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd9d6('0xc')]));require(_0xd9d6('0xe'))[_0xd9d6('0xf')](socket);function respondWithRpcPromise(_0x383303,_0x5544bc,_0xb3f1b5){return new BPromise(function(_0x481776,_0x58cf6c){return client[_0xd9d6('0x10')](_0x383303,_0xb3f1b5)[_0xd9d6('0x11')](function(_0x5b1c9c){logger[_0xd9d6('0x12')](_0xd9d6('0x13'),_0x5544bc,_0xd9d6('0x14'));logger[_0xd9d6('0x15')](_0xd9d6('0x16'),_0x5544bc,_0xd9d6('0x14'),JSON[_0xd9d6('0x17')](_0x5b1c9c));if(_0x5b1c9c[_0xd9d6('0x18')]){if(_0x5b1c9c[_0xd9d6('0x18')][_0xd9d6('0x19')]===0x1f4){logger[_0xd9d6('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x5544bc,_0x5b1c9c['error']['message']);return _0x58cf6c(_0x5b1c9c[_0xd9d6('0x18')][_0xd9d6('0x1a')]);}logger[_0xd9d6('0x18')](_0xd9d6('0x13'),_0x5544bc,_0x5b1c9c[_0xd9d6('0x18')]['message']);return _0x481776(_0x5b1c9c[_0xd9d6('0x18')][_0xd9d6('0x1a')]);}else{logger['info'](_0xd9d6('0x13'),_0x5544bc,'request\x20sent');_0x481776(_0x5b1c9c['result']['message']);}})['catch'](function(_0x5b1a14){logger[_0xd9d6('0x18')](_0xd9d6('0x13'),_0x5544bc,_0x5b1a14);_0x58cf6c(_0x5b1a14);});});}exports['GetOpenchannelQueue']=function(_0x4d2904){var _0x40a678=this;return new Promise(function(_0x1c08aa,_0x14f3b7){return db['OpenchannelQueue'][_0xd9d6('0x1b')]({'raw':_0x4d2904[_0xd9d6('0x1c')]?_0x4d2904[_0xd9d6('0x1c')][_0xd9d6('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d2904[_0xd9d6('0x1c')]?_0x4d2904[_0xd9d6('0x1c')][_0xd9d6('0x1e')]||null:null,'attributes':_0x4d2904[_0xd9d6('0x1c')]?_0x4d2904[_0xd9d6('0x1c')][_0xd9d6('0x1f')]||null:null,'limit':_0x4d2904['options']?_0x4d2904[_0xd9d6('0x1c')][_0xd9d6('0x20')]||null:null,'include':_0x4d2904['options']?_0x4d2904[_0xd9d6('0x1c')]['include']?_[_0xd9d6('0x21')](_0x4d2904[_0xd9d6('0x1c')][_0xd9d6('0x22')],function(_0x4152dd){return{'model':db[_0x4152dd[_0xd9d6('0x23')]],'as':_0x4152dd['as'],'attributes':_0x4152dd['attributes'],'include':_0x4152dd[_0xd9d6('0x22')]?_['map'](_0x4152dd[_0xd9d6('0x22')],function(_0x2c5222){return{'model':db[_0x2c5222[_0xd9d6('0x23')]],'as':_0x2c5222['as'],'attributes':_0x2c5222['attributes'],'include':_0x2c5222[_0xd9d6('0x22')]?_[_0xd9d6('0x21')](_0x2c5222[_0xd9d6('0x22')],function(_0x2f0e0c){return{'model':db[_0x2f0e0c[_0xd9d6('0x23')]],'as':_0x2f0e0c['as'],'attributes':_0x2f0e0c[_0xd9d6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd9d6('0x11')](function(_0x5cc65b){logger[_0xd9d6('0x12')](_0xd9d6('0x24'),_0x4d2904);logger[_0xd9d6('0x15')](_0xd9d6('0x24'),_0x4d2904,JSON[_0xd9d6('0x17')](_0x5cc65b));_0x1c08aa(_0x5cc65b);})[_0xd9d6('0x25')](function(_0xf7ad9e){logger[_0xd9d6('0x18')]('GetOpenchannelQueue',_0xf7ad9e['message'],_0x4d2904);_0x14f3b7(_0x40a678[_0xd9d6('0x18')](0x1f4,_0xf7ad9e[_0xd9d6('0x1a')]));});});};exports[_0xd9d6('0x26')]=function(_0x180435){var _0x3f164e=this;return new Promise(function(_0x2e98ad,_0x36ea21){return db['OpenchannelQueue']['find']({'raw':_0x180435['options']?_0x180435[_0xd9d6('0x1c')][_0xd9d6('0x1d')]===undefined?!![]:![]:!![],'where':_0x180435[_0xd9d6('0x1c')]?_0x180435[_0xd9d6('0x1c')]['where']||null:null,'attributes':_0x180435[_0xd9d6('0x1c')]?_0x180435['options'][_0xd9d6('0x1f')]||null:null,'include':_0x180435[_0xd9d6('0x1c')]?_0x180435[_0xd9d6('0x1c')]['include']?_['map'](_0x180435['options'][_0xd9d6('0x22')],function(_0x475259){return{'model':db[_0x475259[_0xd9d6('0x23')]],'as':_0x475259['as'],'attributes':_0x475259[_0xd9d6('0x1f')],'include':_0x475259[_0xd9d6('0x22')]?_[_0xd9d6('0x21')](_0x475259[_0xd9d6('0x22')],function(_0x3f72ab){return{'model':db[_0x3f72ab[_0xd9d6('0x23')]],'as':_0x3f72ab['as'],'attributes':_0x3f72ab['attributes'],'include':_0x3f72ab[_0xd9d6('0x22')]?_[_0xd9d6('0x21')](_0x3f72ab['include'],function(_0x51f8f5){return{'model':db[_0x51f8f5[_0xd9d6('0x23')]],'as':_0x51f8f5['as'],'attributes':_0x51f8f5[_0xd9d6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd9d6('0x11')](function(_0x1b78b6){logger[_0xd9d6('0x12')]('ShowOpenchannelQueue',_0x180435);logger[_0xd9d6('0x15')]('ShowOpenchannelQueue',_0x180435,JSON[_0xd9d6('0x17')](_0x1b78b6));_0x2e98ad(_0x1b78b6);})[_0xd9d6('0x25')](function(_0x10d9b4){logger['error'](_0xd9d6('0x26'),_0x10d9b4[_0xd9d6('0x1a')],_0x180435);_0x36ea21(_0x3f164e['error'](0x1f4,_0x10d9b4[_0xd9d6('0x1a')]));});});}; \ No newline at end of file +var _0x4517=['OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4517,0x17d));var _0x7451=function(_0x2dc9ef,_0x36ed96){_0x2dc9ef=_0x2dc9ef-0x0;var _0xbeb7ff=_0x4517[_0x2dc9ef];return _0xbeb7ff;};'use strict';var _=require(_0x7451('0x0'));var util=require(_0x7451('0x1'));var moment=require(_0x7451('0x2'));var BPromise=require('bluebird');var rs=require(_0x7451('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7451('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7451('0x5'))(_0x7451('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7451('0x7')][_0x7451('0x8')]({'port':0x232a});config[_0x7451('0x9')]=_[_0x7451('0xa')](config[_0x7451('0x9')],{'host':_0x7451('0xb'),'port':0x18eb});var socket=require(_0x7451('0xc'))(new Redis(config[_0x7451('0x9')]));require(_0x7451('0xd'))[_0x7451('0xe')](socket);function respondWithRpcPromise(_0x53625c,_0x22afc1,_0x571072){return new BPromise(function(_0x494287,_0x142602){return client['request'](_0x53625c,_0x571072)[_0x7451('0xf')](function(_0x1665f6){logger[_0x7451('0x10')](_0x7451('0x11'),_0x22afc1,_0x7451('0x12'));logger['debug'](_0x7451('0x13'),_0x22afc1,'request\x20sent',JSON[_0x7451('0x14')](_0x1665f6));if(_0x1665f6[_0x7451('0x15')]){if(_0x1665f6['error'][_0x7451('0x16')]===0x1f4){logger[_0x7451('0x15')](_0x7451('0x11'),_0x22afc1,_0x1665f6[_0x7451('0x15')][_0x7451('0x17')]);return _0x142602(_0x1665f6[_0x7451('0x15')][_0x7451('0x17')]);}logger['error'](_0x7451('0x11'),_0x22afc1,_0x1665f6[_0x7451('0x15')][_0x7451('0x17')]);return _0x494287(_0x1665f6['error'][_0x7451('0x17')]);}else{logger[_0x7451('0x10')](_0x7451('0x11'),_0x22afc1,_0x7451('0x12'));_0x494287(_0x1665f6[_0x7451('0x18')][_0x7451('0x17')]);}})[_0x7451('0x19')](function(_0x2edde3){logger[_0x7451('0x15')](_0x7451('0x11'),_0x22afc1,_0x2edde3);_0x142602(_0x2edde3);});});}exports[_0x7451('0x1a')]=function(_0x13baf5){var _0x4db8cc=this;return new Promise(function(_0x57a01d,_0x761b03){return db['OpenchannelQueue'][_0x7451('0x1b')]({'raw':_0x13baf5[_0x7451('0x1c')]?_0x13baf5[_0x7451('0x1c')][_0x7451('0x1d')]===undefined?!![]:![]:!![],'where':_0x13baf5[_0x7451('0x1c')]?_0x13baf5[_0x7451('0x1c')][_0x7451('0x1e')]||null:null,'attributes':_0x13baf5[_0x7451('0x1c')]?_0x13baf5[_0x7451('0x1c')]['attributes']||null:null,'limit':_0x13baf5['options']?_0x13baf5[_0x7451('0x1c')][_0x7451('0x1f')]||null:null,'include':_0x13baf5[_0x7451('0x1c')]?_0x13baf5[_0x7451('0x1c')][_0x7451('0x20')]?_[_0x7451('0x21')](_0x13baf5[_0x7451('0x1c')][_0x7451('0x20')],function(_0x19b222){return{'model':db[_0x19b222[_0x7451('0x22')]],'as':_0x19b222['as'],'attributes':_0x19b222['attributes'],'include':_0x19b222[_0x7451('0x20')]?_[_0x7451('0x21')](_0x19b222['include'],function(_0x46fab8){return{'model':db[_0x46fab8[_0x7451('0x22')]],'as':_0x46fab8['as'],'attributes':_0x46fab8[_0x7451('0x23')],'include':_0x46fab8[_0x7451('0x20')]?_[_0x7451('0x21')](_0x46fab8[_0x7451('0x20')],function(_0x160dcc){return{'model':db[_0x160dcc['model']],'as':_0x160dcc['as'],'attributes':_0x160dcc[_0x7451('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7451('0xf')](function(_0x18592e){logger[_0x7451('0x10')](_0x7451('0x1a'),_0x13baf5);logger[_0x7451('0x24')](_0x7451('0x1a'),_0x13baf5,JSON[_0x7451('0x14')](_0x18592e));_0x57a01d(_0x18592e);})[_0x7451('0x19')](function(_0x292d2d){logger[_0x7451('0x15')](_0x7451('0x1a'),_0x292d2d[_0x7451('0x17')],_0x13baf5);_0x761b03(_0x4db8cc[_0x7451('0x15')](0x1f4,_0x292d2d['message']));});});};exports[_0x7451('0x25')]=function(_0x1aff06){var _0x5a2dee=this;return new Promise(function(_0x4ceaac,_0x1e3eee){return db[_0x7451('0x26')][_0x7451('0x27')]({'raw':_0x1aff06[_0x7451('0x1c')]?_0x1aff06['options'][_0x7451('0x1d')]===undefined?!![]:![]:!![],'where':_0x1aff06[_0x7451('0x1c')]?_0x1aff06[_0x7451('0x1c')]['where']||null:null,'attributes':_0x1aff06[_0x7451('0x1c')]?_0x1aff06[_0x7451('0x1c')][_0x7451('0x23')]||null:null,'include':_0x1aff06['options']?_0x1aff06[_0x7451('0x1c')][_0x7451('0x20')]?_[_0x7451('0x21')](_0x1aff06['options']['include'],function(_0x16a112){return{'model':db[_0x16a112[_0x7451('0x22')]],'as':_0x16a112['as'],'attributes':_0x16a112['attributes'],'include':_0x16a112[_0x7451('0x20')]?_[_0x7451('0x21')](_0x16a112[_0x7451('0x20')],function(_0x472e69){return{'model':db[_0x472e69['model']],'as':_0x472e69['as'],'attributes':_0x472e69[_0x7451('0x23')],'include':_0x472e69[_0x7451('0x20')]?_[_0x7451('0x21')](_0x472e69[_0x7451('0x20')],function(_0x31bb8b){return{'model':db[_0x31bb8b[_0x7451('0x22')]],'as':_0x31bb8b['as'],'attributes':_0x31bb8b[_0x7451('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1419a8){logger[_0x7451('0x10')]('ShowOpenchannelQueue',_0x1aff06);logger['debug'](_0x7451('0x25'),_0x1aff06,JSON[_0x7451('0x14')](_0x1419a8));_0x4ceaac(_0x1419a8);})['catch'](function(_0x144aa5){logger['error'](_0x7451('0x25'),_0x144aa5['message'],_0x1aff06);_0x1e3eee(_0x5a2dee['error'](0x1f4,_0x144aa5[_0x7451('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 9ad3559..59b1cb2 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 _0x62f0=['register','length','save','remove','update','emit','removeListener'];(function(_0x39ea39,_0x2b0716){var _0x28bd08=function(_0x11ed99){while(--_0x11ed99){_0x39ea39['push'](_0x39ea39['shift']());}};_0x28bd08(++_0x2b0716);}(_0x62f0,0x10c));var _0x062f=function(_0x49c68e,_0x1c1673){_0x49c68e=_0x49c68e-0x0;var _0x33032b=_0x62f0[_0x49c68e];return _0x33032b;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x062f('0x0'),_0x062f('0x1'),_0x062f('0x2')];function createListener(_0x3cc3e6,_0x579269){return function(_0x3262c4){_0x579269[_0x062f('0x3')](_0x3cc3e6,_0x3262c4);};}function removeListener(_0x4ac62b,_0x44c941){return function(){OpenchannelQueueEvents[_0x062f('0x4')](_0x4ac62b,_0x44c941);};}exports[_0x062f('0x5')]=function(_0x30991c){for(var _0x2037f9=0x0,_0x6d9a87=events[_0x062f('0x6')];_0x2037f9<_0x6d9a87;_0x2037f9++){var _0x211fca=events[_0x2037f9];var _0x592ed3=createListener('openchannelQueue:'+_0x211fca,_0x30991c);OpenchannelQueueEvents['on'](_0x211fca,_0x592ed3);}}; \ No newline at end of file +var _0xbab7=['save','update','emit','removeListener','./openchannelQueue.events'];(function(_0xd34e50,_0x5edfe0){var _0x42ecb9=function(_0x28535a){while(--_0x28535a){_0xd34e50['push'](_0xd34e50['shift']());}};_0x42ecb9(++_0x5edfe0);}(_0xbab7,0x72));var _0x7bab=function(_0x30dbae,_0x323301){_0x30dbae=_0x30dbae-0x0;var _0x1ce5bf=_0xbab7[_0x30dbae];return _0x1ce5bf;};'use strict';var OpenchannelQueueEvents=require(_0x7bab('0x0'));var events=[_0x7bab('0x1'),'remove',_0x7bab('0x2')];function createListener(_0x376a62,_0x15e427){return function(_0x4789e5){_0x15e427[_0x7bab('0x3')](_0x376a62,_0x4789e5);};}function removeListener(_0x3f5ec6,_0x4f425e){return function(){OpenchannelQueueEvents[_0x7bab('0x4')](_0x3f5ec6,_0x4f425e);};}exports['register']=function(_0x2de1a4){for(var _0x48da58=0x0,_0x323bca=events['length'];_0x48da58<_0x323bca;_0x48da58++){var _0xd1f3b0=events[_0x48da58];var _0x1be3d9=createListener('openchannelQueue:'+_0xd1f3b0,_0x2de1a4);OpenchannelQueueEvents['on'](_0xd1f3b0,_0x1be3d9);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index cf5c75d..decd561 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 _0x32f8=['exports','util','path','express','Router','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','put','/:id','delete','destroy'];(function(_0x110c9a,_0x3a240f){var _0x151c32=function(_0x1efa80){while(--_0x1efa80){_0x110c9a['push'](_0x110c9a['shift']());}};_0x151c32(++_0x3a240f);}(_0x32f8,0x191));var _0x832f=function(_0xe3f837,_0x136b1c){_0xe3f837=_0xe3f837-0x0;var _0x5b96d3=_0x32f8[_0xe3f837];return _0x5b96d3;};'use strict';var multer=require('multer');var util=require(_0x832f('0x0'));var path=require(_0x832f('0x1'));var timeout=require('connect-timeout');var express=require(_0x832f('0x2'));var router=express[_0x832f('0x3')]();var auth=require(_0x832f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x832f('0x5'));var controller=require(_0x832f('0x6'));router[_0x832f('0x7')]('/',auth[_0x832f('0x8')](),controller[_0x832f('0x9')]);router[_0x832f('0x7')]('/describe',auth[_0x832f('0x8')](),controller[_0x832f('0xa')]);router[_0x832f('0x7')]('/:id',auth[_0x832f('0x8')](),controller['show']);router['post']('/',auth[_0x832f('0x8')](),controller['create']);router[_0x832f('0xb')](_0x832f('0xc'),auth[_0x832f('0x8')](),controller['update']);router[_0x832f('0xd')](_0x832f('0xc'),auth[_0x832f('0x8')](),controller[_0x832f('0xe')]);module[_0x832f('0xf')]=router; \ No newline at end of file +var _0x9c9b=['show','post','create','put','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x355a33,_0x1fbe85){var _0x4050d3=function(_0x159fb0){while(--_0x159fb0){_0x355a33['push'](_0x355a33['shift']());}};_0x4050d3(++_0x1fbe85);}(_0x9c9b,0x1b6));var _0xb9c9=function(_0x442cd3,_0x3fcd7d){_0x442cd3=_0x442cd3-0x0;var _0x49db3e=_0x9c9b[_0x442cd3];return _0x49db3e;};'use strict';var multer=require(_0xb9c9('0x0'));var util=require(_0xb9c9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9c9('0x2'));var router=express[_0xb9c9('0x3')]();var auth=require(_0xb9c9('0x4'));var interaction=require(_0xb9c9('0x5'));var config=require('../../config/environment');var controller=require(_0xb9c9('0x6'));router['get']('/',auth[_0xb9c9('0x7')](),controller[_0xb9c9('0x8')]);router[_0xb9c9('0x9')]('/describe',auth[_0xb9c9('0x7')](),controller[_0xb9c9('0xa')]);router[_0xb9c9('0x9')](_0xb9c9('0xb'),auth['isAuthenticated'](),controller[_0xb9c9('0xc')]);router[_0xb9c9('0xd')]('/',auth[_0xb9c9('0x7')](),controller[_0xb9c9('0xe')]);router[_0xb9c9('0xf')](_0xb9c9('0xb'),auth[_0xb9c9('0x7')](),controller['update']);router[_0xb9c9('0x10')](_0xb9c9('0xb'),auth[_0xb9c9('0x7')](),controller[_0xb9c9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 1ba2ac2..54ea246 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 _0xbb93=['DATE','moment','sequelize','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbb93,0x1b9));var _0x3bb9=function(_0x402a58,_0x796153){_0x402a58=_0x402a58-0x0;var _0x1f5512=_0xbb93[_0x402a58];return _0x1f5512;};'use strict';var moment=require(_0x3bb9('0x0'));var Sequelize=require(_0x3bb9('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3bb9('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3bb9('0x3')]},'acceptAt':{'type':Sequelize[_0x3bb9('0x3')]},'exitAt':{'type':Sequelize[_0x3bb9('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6db3=['DATE','STRING','moment','sequelize','exports'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x6db3,0x18d));var _0x36db=function(_0xd519cd,_0x410d5c){_0xd519cd=_0xd519cd-0x0;var _0x212e12=_0x6db3[_0xd519cd];return _0x212e12;};'use strict';var moment=require(_0x36db('0x0'));var Sequelize=require(_0x36db('0x1'));module[_0x36db('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x36db('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x36db('0x3')]},'reason':{'type':Sequelize[_0x36db('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 49f0bab..fccf347 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 _0x2bd6=['reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','status','Content-Range'];(function(_0x24fd0c,_0x185e27){var _0x101095=function(_0xcf0891){while(--_0xcf0891){_0x24fd0c['push'](_0x24fd0c['shift']());}};_0x101095(++_0x185e27);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0x2bd6[_0x421eeb];return _0x2c7371;};'use strict';var pdf=require(_0x62bd('0x0'));var emlformat=require(_0x62bd('0x1'));var rimraf=require(_0x62bd('0x2'));var zipdir=require(_0x62bd('0x3'));var jsonpatch=require(_0x62bd('0x4'));var rp=require('request-promise');var moment=require(_0x62bd('0x5'));var BPromise=require(_0x62bd('0x6'));var Mustache=require(_0x62bd('0x7'));var util=require('util');var path=require(_0x62bd('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x62bd('0x9'));var fs=require('fs');var _=require(_0x62bd('0xa'));var squel=require('squel');var crypto=require(_0x62bd('0xb'));var jsforce=require(_0x62bd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x62bd('0xd'));var querystring=require(_0x62bd('0xe'));var Papa=require(_0x62bd('0xf'));var Redis=require(_0x62bd('0x10'));var authService=require(_0x62bd('0x11'));var qs=require(_0x62bd('0x12'));var as=require(_0x62bd('0x13'));var hardwareService=require(_0x62bd('0x14'));var logger=require(_0x62bd('0x15'))(_0x62bd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x62bd('0x17'));var db=require(_0x62bd('0x18'))['db'];function respondWithStatusCode(_0x32941d,_0x7acd92){_0x7acd92=_0x7acd92||0xcc;return function(_0x2b1c2e){if(_0x2b1c2e){return _0x32941d[_0x62bd('0x19')](_0x7acd92);}return _0x32941d['status'](_0x7acd92)[_0x62bd('0x1a')]();};}function respondWithResult(_0x5d42f8,_0x1b751c){_0x1b751c=_0x1b751c||0xc8;return function(_0x5dc408){if(_0x5dc408){return _0x5d42f8['status'](_0x1b751c)[_0x62bd('0x1b')](_0x5dc408);}};}function respondWithFilteredResult(_0x397a41,_0x5260f9){return function(_0x3073e1){if(_0x3073e1){var _0x1d178b=_0x3073e1['count'],_0x3e2133=_0x5260f9[_0x62bd('0x1c')],_0x1a815e=_0x5260f9[_0x62bd('0x1c')]+_0x5260f9[_0x62bd('0x1d')],_0x16f723;if(_0x1a815e>=_0x1d178b){_0x1a815e=_0x1d178b;_0x16f723=0xc8;}else{_0x16f723=0xce;}_0x397a41[_0x62bd('0x1e')](_0x16f723);return _0x397a41['set'](_0x62bd('0x1f'),_0x3e2133+'-'+_0x1a815e+'/'+_0x1d178b)[_0x62bd('0x1b')](_0x3073e1);}return null;};}function patchUpdates(_0x204ac1){return function(_0x21613e){try{jsonpatch['apply'](_0x21613e,_0x204ac1,!![]);}catch(_0xb4953c){return BPromise[_0x62bd('0x20')](_0xb4953c);}return _0x21613e[_0x62bd('0x21')]();};}function saveUpdates(_0x2298d9,_0x482bff){return function(_0x3f8dc1){if(_0x3f8dc1){return _0x3f8dc1[_0x62bd('0x22')](_0x2298d9)[_0x62bd('0x23')](function(_0xa6bae9){return _0xa6bae9;});}return null;};}function removeEntity(_0x5ec823,_0x2d1d56){return function(_0x3bc39c){if(_0x3bc39c){return _0x3bc39c[_0x62bd('0x24')]()[_0x62bd('0x23')](function(){_0x5ec823[_0x62bd('0x1e')](0xcc)[_0x62bd('0x1a')]();});}};}function handleEntityNotFound(_0x245628,_0x304cf0){return function(_0x364258){if(!_0x364258){_0x245628[_0x62bd('0x19')](0x194);}return _0x364258;};}function handleError(_0xe02ab1,_0x2f5c03){_0x2f5c03=_0x2f5c03||0x1f4;return function(_0x45e4f2){logger['error'](_0x45e4f2[_0x62bd('0x25')]);if(_0x45e4f2[_0x62bd('0x26')]){delete _0x45e4f2['name'];}_0xe02ab1[_0x62bd('0x1e')](_0x2f5c03)[_0x62bd('0x27')](_0x45e4f2);};}exports[_0x62bd('0x28')]=function(_0x56890f,_0x191063){var _0x205d78={},_0x43add5={},_0x28ac58={'count':0x0,'rows':[]};var _0x2820f5=_[_0x62bd('0x29')](db[_0x62bd('0x2a')][_0x62bd('0x2b')],function(_0x532515){return{'name':_0x532515['fieldName'],'type':_0x532515[_0x62bd('0x2c')][_0x62bd('0x2d')]};});_0x43add5[_0x62bd('0x2e')]=_[_0x62bd('0x29')](_0x2820f5,_0x62bd('0x26'));_0x43add5[_0x62bd('0x2f')]=_['keys'](_0x56890f[_0x62bd('0x2f')]);_0x43add5[_0x62bd('0x30')]=_[_0x62bd('0x31')](_0x43add5[_0x62bd('0x2e')],_0x43add5[_0x62bd('0x2f')]);_0x205d78['attributes']=_[_0x62bd('0x31')](_0x43add5['model'],qs['fields'](_0x56890f[_0x62bd('0x2f')][_0x62bd('0x32')]));_0x205d78[_0x62bd('0x33')]=_0x205d78[_0x62bd('0x33')][_0x62bd('0x34')]?_0x205d78['attributes']:_0x43add5[_0x62bd('0x2e')];if(!_0x56890f[_0x62bd('0x2f')][_0x62bd('0x35')](_0x62bd('0x36'))){_0x205d78[_0x62bd('0x1d')]=qs[_0x62bd('0x1d')](_0x56890f[_0x62bd('0x2f')][_0x62bd('0x1d')]);_0x205d78[_0x62bd('0x1c')]=qs['offset'](_0x56890f[_0x62bd('0x2f')]['offset']);}_0x205d78[_0x62bd('0x37')]=qs['sort'](_0x56890f[_0x62bd('0x2f')][_0x62bd('0x38')]);_0x205d78['where']=qs[_0x62bd('0x30')](_[_0x62bd('0x39')](_0x56890f[_0x62bd('0x2f')],_0x43add5[_0x62bd('0x30')]),_0x2820f5);if(_0x56890f[_0x62bd('0x2f')][_0x62bd('0x3a')]){_0x205d78[_0x62bd('0x3b')]=_[_0x62bd('0x3c')](_0x205d78['where'],{'$or':_['map'](_0x2820f5,function(_0x1f4f7c){if(_0x1f4f7c[_0x62bd('0x2c')]!==_0x62bd('0x3d')){var _0x9b24a9={};_0x9b24a9[_0x1f4f7c[_0x62bd('0x26')]]={'$like':'%'+_0x56890f[_0x62bd('0x2f')][_0x62bd('0x3a')]+'%'};return _0x9b24a9;}})});}_0x205d78=_['merge']({},_0x205d78,_0x56890f[_0x62bd('0x3e')]);var _0x51ab8b={'where':_0x205d78[_0x62bd('0x3b')]};return db[_0x62bd('0x2a')][_0x62bd('0x3f')](_0x51ab8b)[_0x62bd('0x23')](function(_0x27b580){_0x28ac58['count']=_0x27b580;if(_0x56890f[_0x62bd('0x2f')][_0x62bd('0x40')]){_0x205d78[_0x62bd('0x41')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x62bd('0x42')](_0x205d78);})['then'](function(_0xa282f1){_0x28ac58[_0x62bd('0x43')]=_0xa282f1;return _0x28ac58;})[_0x62bd('0x23')](respondWithFilteredResult(_0x191063,_0x205d78))[_0x62bd('0x44')](handleError(_0x191063,null));};exports[_0x62bd('0x45')]=function(_0x33c7cf,_0x428211){var _0x411019={'raw':!![],'where':{'id':_0x33c7cf[_0x62bd('0x46')]['id']}},_0x42973a={};_0x42973a[_0x62bd('0x2e')]=_['keys'](db[_0x62bd('0x2a')][_0x62bd('0x2b')]);_0x42973a[_0x62bd('0x2f')]=_[_0x62bd('0x47')](_0x33c7cf[_0x62bd('0x2f')]);_0x42973a[_0x62bd('0x30')]=_[_0x62bd('0x31')](_0x42973a[_0x62bd('0x2e')],_0x42973a[_0x62bd('0x2f')]);_0x411019[_0x62bd('0x33')]=_[_0x62bd('0x31')](_0x42973a[_0x62bd('0x2e')],qs[_0x62bd('0x32')](_0x33c7cf[_0x62bd('0x2f')][_0x62bd('0x32')]));_0x411019['attributes']=_0x411019['attributes'][_0x62bd('0x34')]?_0x411019['attributes']:_0x42973a[_0x62bd('0x2e')];if(_0x33c7cf[_0x62bd('0x2f')][_0x62bd('0x40')]){_0x411019[_0x62bd('0x41')]=[{'all':!![]}];}_0x411019=_[_0x62bd('0x3c')]({},_0x411019,_0x33c7cf[_0x62bd('0x3e')]);return db[_0x62bd('0x2a')][_0x62bd('0x48')](_0x411019)['then'](handleEntityNotFound(_0x428211,null))['then'](respondWithResult(_0x428211,null))[_0x62bd('0x44')](handleError(_0x428211,null));};exports[_0x62bd('0x49')]=function(_0x37991c,_0x3d0d52){return db['OpenchannelQueueReport'][_0x62bd('0x49')](_0x37991c[_0x62bd('0x4a')],{})[_0x62bd('0x23')](respondWithResult(_0x3d0d52,0xc9))[_0x62bd('0x44')](handleError(_0x3d0d52,null));};exports[_0x62bd('0x22')]=function(_0x3b05f0,_0x51ce41){if(_0x3b05f0[_0x62bd('0x4a')]['id']){delete _0x3b05f0[_0x62bd('0x4a')]['id'];}return db[_0x62bd('0x2a')][_0x62bd('0x48')]({'where':{'id':_0x3b05f0[_0x62bd('0x46')]['id']}})[_0x62bd('0x23')](handleEntityNotFound(_0x51ce41,null))['then'](saveUpdates(_0x3b05f0['body'],null))['then'](respondWithResult(_0x51ce41,null))[_0x62bd('0x44')](handleError(_0x51ce41,null));};exports[_0x62bd('0x24')]=function(_0x4f9f45,_0x39df7f){return db[_0x62bd('0x2a')][_0x62bd('0x48')]({'where':{'id':_0x4f9f45['params']['id']}})['then'](handleEntityNotFound(_0x39df7f,null))[_0x62bd('0x23')](removeEntity(_0x39df7f,null))[_0x62bd('0x44')](handleError(_0x39df7f,null));};exports[_0x62bd('0x4b')]=function(_0xcdb38b,_0x4cebae){return db['OpenchannelQueueReport'][_0x62bd('0x4b')]()[_0x62bd('0x23')](respondWithResult(_0x4cebae,null))['catch'](handleError(_0x4cebae,null));}; \ No newline at end of file +var _0x257e=['sort','pick','filter','where','merge','type','VIRTUAL','options','OpenchannelQueueReport','count','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','apply','destroy','then','error','name','send','index','map','rawAttributes','fieldName','model','query','intersection','attributes','fields','nolimit','limit','order'];(function(_0x1ad279,_0x42d157){var _0x272861=function(_0x3cb41f){while(--_0x3cb41f){_0x1ad279['push'](_0x1ad279['shift']());}};_0x272861(++_0x42d157);}(_0x257e,0x1dc));var _0xe257=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x257e[_0x2aea9e];return _0x430b92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe257('0x0'));var rimraf=require(_0xe257('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe257('0x2'));var rp=require('request-promise');var moment=require(_0xe257('0x3'));var BPromise=require(_0xe257('0x4'));var Mustache=require(_0xe257('0x5'));var util=require(_0xe257('0x6'));var path=require('path');var sox=require(_0xe257('0x7'));var csv=require(_0xe257('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe257('0x9'));var squel=require(_0xe257('0xa'));var crypto=require(_0xe257('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe257('0xc'));var toCsv=require(_0xe257('0x8'));var querystring=require(_0xe257('0xd'));var Papa=require(_0xe257('0xe'));var Redis=require(_0xe257('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe257('0x10'));var hardwareService=require(_0xe257('0x11'));var logger=require('../../config/logger')(_0xe257('0x12'));var utils=require(_0xe257('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe257('0x14'));var db=require(_0xe257('0x15'))['db'];function respondWithStatusCode(_0x8d4cee,_0x41b454){_0x41b454=_0x41b454||0xcc;return function(_0x2bc9a3){if(_0x2bc9a3){return _0x8d4cee['sendStatus'](_0x41b454);}return _0x8d4cee[_0xe257('0x16')](_0x41b454)[_0xe257('0x17')]();};}function respondWithResult(_0x49afa3,_0x273854){_0x273854=_0x273854||0xc8;return function(_0x441cde){if(_0x441cde){return _0x49afa3[_0xe257('0x16')](_0x273854)[_0xe257('0x18')](_0x441cde);}};}function respondWithFilteredResult(_0x1e34db,_0x44f6d8){return function(_0x44a016){if(_0x44a016){var _0x396be4=_0x44a016['count'],_0x54a00c=_0x44f6d8[_0xe257('0x19')],_0x47e8eb=_0x44f6d8['offset']+_0x44f6d8['limit'],_0x9df9de;if(_0x47e8eb>=_0x396be4){_0x47e8eb=_0x396be4;_0x9df9de=0xc8;}else{_0x9df9de=0xce;}_0x1e34db[_0xe257('0x16')](_0x9df9de);return _0x1e34db['set']('Content-Range',_0x54a00c+'-'+_0x47e8eb+'/'+_0x396be4)[_0xe257('0x18')](_0x44a016);}return null;};}function patchUpdates(_0x50764b){return function(_0x3d62ce){try{jsonpatch[_0xe257('0x1a')](_0x3d62ce,_0x50764b,!![]);}catch(_0x4ba2a0){return BPromise['reject'](_0x4ba2a0);}return _0x3d62ce['save']();};}function saveUpdates(_0x34033d,_0x5ca40f){return function(_0x51e6f4){if(_0x51e6f4){return _0x51e6f4['update'](_0x34033d)['then'](function(_0x181ec6){return _0x181ec6;});}return null;};}function removeEntity(_0x47f1ed,_0x2a2816){return function(_0x3a8bc6){if(_0x3a8bc6){return _0x3a8bc6[_0xe257('0x1b')]()[_0xe257('0x1c')](function(){_0x47f1ed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bc026,_0x11b467){return function(_0x59e7fa){if(!_0x59e7fa){_0x3bc026['sendStatus'](0x194);}return _0x59e7fa;};}function handleError(_0x17be93,_0x1dfda2){_0x1dfda2=_0x1dfda2||0x1f4;return function(_0x301fd4){logger[_0xe257('0x1d')](_0x301fd4['stack']);if(_0x301fd4[_0xe257('0x1e')]){delete _0x301fd4[_0xe257('0x1e')];}_0x17be93[_0xe257('0x16')](_0x1dfda2)[_0xe257('0x1f')](_0x301fd4);};}exports[_0xe257('0x20')]=function(_0x5532d3,_0x1c3c8c){var _0x260baa={},_0x550762={},_0x31a468={'count':0x0,'rows':[]};var _0x5097cc=_[_0xe257('0x21')](db['OpenchannelQueueReport'][_0xe257('0x22')],function(_0x3b3b32){return{'name':_0x3b3b32[_0xe257('0x23')],'type':_0x3b3b32['type']['key']};});_0x550762[_0xe257('0x24')]=_['map'](_0x5097cc,'name');_0x550762[_0xe257('0x25')]=_['keys'](_0x5532d3[_0xe257('0x25')]);_0x550762['filters']=_[_0xe257('0x26')](_0x550762[_0xe257('0x24')],_0x550762['query']);_0x260baa[_0xe257('0x27')]=_['intersection'](_0x550762[_0xe257('0x24')],qs[_0xe257('0x28')](_0x5532d3[_0xe257('0x25')][_0xe257('0x28')]));_0x260baa[_0xe257('0x27')]=_0x260baa['attributes']['length']?_0x260baa['attributes']:_0x550762[_0xe257('0x24')];if(!_0x5532d3[_0xe257('0x25')]['hasOwnProperty'](_0xe257('0x29'))){_0x260baa[_0xe257('0x2a')]=qs[_0xe257('0x2a')](_0x5532d3[_0xe257('0x25')][_0xe257('0x2a')]);_0x260baa[_0xe257('0x19')]=qs[_0xe257('0x19')](_0x5532d3[_0xe257('0x25')][_0xe257('0x19')]);}_0x260baa[_0xe257('0x2b')]=qs[_0xe257('0x2c')](_0x5532d3[_0xe257('0x25')][_0xe257('0x2c')]);_0x260baa['where']=qs['filters'](_[_0xe257('0x2d')](_0x5532d3[_0xe257('0x25')],_0x550762['filters']),_0x5097cc);if(_0x5532d3['query'][_0xe257('0x2e')]){_0x260baa[_0xe257('0x2f')]=_[_0xe257('0x30')](_0x260baa[_0xe257('0x2f')],{'$or':_[_0xe257('0x21')](_0x5097cc,function(_0x3d8dc8){if(_0x3d8dc8[_0xe257('0x31')]!==_0xe257('0x32')){var _0x1223a0={};_0x1223a0[_0x3d8dc8[_0xe257('0x1e')]]={'$like':'%'+_0x5532d3[_0xe257('0x25')]['filter']+'%'};return _0x1223a0;}})});}_0x260baa=_[_0xe257('0x30')]({},_0x260baa,_0x5532d3[_0xe257('0x33')]);var _0x550908={'where':_0x260baa[_0xe257('0x2f')]};return db[_0xe257('0x34')]['count'](_0x550908)[_0xe257('0x1c')](function(_0x389c4e){_0x31a468[_0xe257('0x35')]=_0x389c4e;if(_0x5532d3[_0xe257('0x25')][_0xe257('0x36')]){_0x260baa[_0xe257('0x37')]=[{'all':!![]}];}return db[_0xe257('0x34')][_0xe257('0x38')](_0x260baa);})[_0xe257('0x1c')](function(_0x2e6572){_0x31a468[_0xe257('0x39')]=_0x2e6572;return _0x31a468;})[_0xe257('0x1c')](respondWithFilteredResult(_0x1c3c8c,_0x260baa))[_0xe257('0x3a')](handleError(_0x1c3c8c,null));};exports[_0xe257('0x3b')]=function(_0x34e566,_0x54efe0){var _0x189011={'raw':!![],'where':{'id':_0x34e566[_0xe257('0x3c')]['id']}},_0x3dce11={};_0x3dce11[_0xe257('0x24')]=_[_0xe257('0x3d')](db[_0xe257('0x34')]['rawAttributes']);_0x3dce11['query']=_[_0xe257('0x3d')](_0x34e566[_0xe257('0x25')]);_0x3dce11['filters']=_['intersection'](_0x3dce11['model'],_0x3dce11[_0xe257('0x25')]);_0x189011['attributes']=_['intersection'](_0x3dce11[_0xe257('0x24')],qs[_0xe257('0x28')](_0x34e566[_0xe257('0x25')]['fields']));_0x189011['attributes']=_0x189011[_0xe257('0x27')]['length']?_0x189011[_0xe257('0x27')]:_0x3dce11['model'];if(_0x34e566[_0xe257('0x25')][_0xe257('0x36')]){_0x189011[_0xe257('0x37')]=[{'all':!![]}];}_0x189011=_[_0xe257('0x30')]({},_0x189011,_0x34e566['options']);return db['OpenchannelQueueReport'][_0xe257('0x3e')](_0x189011)[_0xe257('0x1c')](handleEntityNotFound(_0x54efe0,null))[_0xe257('0x1c')](respondWithResult(_0x54efe0,null))[_0xe257('0x3a')](handleError(_0x54efe0,null));};exports['create']=function(_0x126906,_0x21c7da){return db[_0xe257('0x34')]['create'](_0x126906[_0xe257('0x3f')],{})[_0xe257('0x1c')](respondWithResult(_0x21c7da,0xc9))['catch'](handleError(_0x21c7da,null));};exports['update']=function(_0x7685d3,_0x2df1c6){if(_0x7685d3[_0xe257('0x3f')]['id']){delete _0x7685d3[_0xe257('0x3f')]['id'];}return db[_0xe257('0x34')][_0xe257('0x3e')]({'where':{'id':_0x7685d3[_0xe257('0x3c')]['id']}})[_0xe257('0x1c')](handleEntityNotFound(_0x2df1c6,null))[_0xe257('0x1c')](saveUpdates(_0x7685d3[_0xe257('0x3f')],null))[_0xe257('0x1c')](respondWithResult(_0x2df1c6,null))['catch'](handleError(_0x2df1c6,null));};exports[_0xe257('0x1b')]=function(_0x53d481,_0x2ba9e8){return db[_0xe257('0x34')][_0xe257('0x3e')]({'where':{'id':_0x53d481[_0xe257('0x3c')]['id']}})[_0xe257('0x1c')](handleEntityNotFound(_0x2ba9e8,null))['then'](removeEntity(_0x2ba9e8,null))['catch'](handleError(_0x2ba9e8,null));};exports[_0xe257('0x40')]=function(_0x59344a,_0x4c6e1d){return db[_0xe257('0x34')]['describe']()[_0xe257('0x1c')](respondWithResult(_0x4c6e1d,null))['catch'](handleError(_0x4c6e1d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 79f269b..bf14ba9 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 _0x535f=['uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','OpenchannelQueueReport','report_openchannel_queue'];(function(_0xae42e,_0x3958f0){var _0x436833=function(_0x41155e){while(--_0x41155e){_0xae42e['push'](_0xae42e['shift']());}};_0x436833(++_0x3958f0);}(_0x535f,0x160));var _0xf535=function(_0x2f098c,_0x159232){_0x2f098c=_0x2f098c-0x0;var _0xe8f6ef=_0x535f[_0x2f098c];return _0xe8f6ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf535('0x0'))(_0xf535('0x1'));var moment=require(_0xf535('0x2'));var BPromise=require(_0xf535('0x3'));var rp=require(_0xf535('0x4'));var fs=require('fs');var path=require(_0xf535('0x5'));var rimraf=require(_0xf535('0x6'));var config=require(_0xf535('0x7'));var attributes=require(_0xf535('0x8'));module['exports']=function(_0x1ff8cc,_0x3303c8){return _0x1ff8cc[_0xf535('0x9')](_0xf535('0xa'),attributes,{'tableName':_0xf535('0xb'),'paranoid':![],'indexes':[{'name':_0xf535('0xc'),'fields':[_0xf535('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7351=['exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes'];(function(_0x5793ad,_0x2d917b){var _0x3e8920=function(_0x3a9699){while(--_0x3a9699){_0x5793ad['push'](_0x5793ad['shift']());}};_0x3e8920(++_0x2d917b);}(_0x7351,0x139));var _0x1735=function(_0x128b5c,_0x574888){_0x128b5c=_0x128b5c-0x0;var _0x442f32=_0x7351[_0x128b5c];return _0x442f32;};'use strict';var _=require(_0x1735('0x0'));var util=require(_0x1735('0x1'));var logger=require(_0x1735('0x2'))(_0x1735('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1735('0x4'));var fs=require('fs');var path=require(_0x1735('0x5'));var rimraf=require(_0x1735('0x6'));var config=require(_0x1735('0x7'));var attributes=require(_0x1735('0x8'));module[_0x1735('0x9')]=function(_0x47fa51,_0x3fdcc1){return _0x47fa51[_0x1735('0xa')](_0x1735('0xb'),attributes,{'tableName':_0x1735('0xc'),'paranoid':![],'indexes':[{'name':_0x1735('0xd'),'fields':[_0x1735('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 0432e35..6b535f4 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 _0xee14=['util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','update','attributes','limit'];(function(_0x4f37d4,_0x5907d2){var _0x5f1efe=function(_0x5afebd){while(--_0x5afebd){_0x4f37d4['push'](_0x4f37d4['shift']());}};_0x5f1efe(++_0x5907d2);}(_0xee14,0xe8));var _0x4ee1=function(_0x125ec8,_0x1db394){_0x125ec8=_0x125ec8-0x0;var _0x147e66=_0xee14[_0x125ec8];return _0x147e66;};'use strict';var _=require('lodash');var util=require(_0x4ee1('0x0'));var moment=require(_0x4ee1('0x1'));var BPromise=require(_0x4ee1('0x2'));var rs=require(_0x4ee1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ee1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4ee1('0x5'));var config=require(_0x4ee1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4ee1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b2fdc,_0x3ee251,_0x498a85){return new BPromise(function(_0x48bef2,_0xf378eb){return client[_0x4ee1('0x8')](_0x3b2fdc,_0x498a85)[_0x4ee1('0x9')](function(_0x3af430){logger[_0x4ee1('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3ee251,_0x4ee1('0xb'));logger[_0x4ee1('0xc')](_0x4ee1('0xd'),_0x3ee251,'request\x20sent',JSON[_0x4ee1('0xe')](_0x3af430));if(_0x3af430[_0x4ee1('0xf')]){if(_0x3af430['error'][_0x4ee1('0x10')]===0x1f4){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3ee251,_0x3af430[_0x4ee1('0xf')]['message']);return _0xf378eb(_0x3af430['error']['message']);}logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3ee251,_0x3af430[_0x4ee1('0xf')][_0x4ee1('0x12')]);return _0x48bef2(_0x3af430[_0x4ee1('0xf')][_0x4ee1('0x12')]);}else{logger[_0x4ee1('0xa')](_0x4ee1('0x11'),_0x3ee251,_0x4ee1('0xb'));_0x48bef2(_0x3af430['result']['message']);}})[_0x4ee1('0x13')](function(_0x47d55b){logger['error'](_0x4ee1('0x11'),_0x3ee251,_0x47d55b);_0xf378eb(_0x47d55b);});});}exports[_0x4ee1('0x14')]=function(_0x4416a5){var _0x4037ad=this;return new Promise(function(_0x4e3b06,_0xd86d29){return db[_0x4ee1('0x15')]['create'](_0x4416a5[_0x4ee1('0x16')],{'raw':_0x4416a5[_0x4ee1('0x17')]?_0x4416a5['options'][_0x4ee1('0x18')]===undefined?!![]:![]:!![]})[_0x4ee1('0x9')](function(_0x3d4cc3){logger[_0x4ee1('0xa')](_0x4ee1('0x14'),_0x4416a5);logger['debug']('CreateOpenchannelQueueReport',_0x4416a5,JSON[_0x4ee1('0xe')](_0x3d4cc3));_0x4e3b06(_0x3d4cc3);})[_0x4ee1('0x13')](function(_0x2e909c){logger[_0x4ee1('0xf')](_0x4ee1('0x14'),_0x2e909c[_0x4ee1('0x12')],_0x4416a5);_0xd86d29(_0x4037ad['error'](0x1f4,_0x2e909c['message']));});});};exports[_0x4ee1('0x19')]=function(_0x1c9532){var _0x51dd4d=this;return new Promise(function(_0x33f93b,_0x58236f){return db[_0x4ee1('0x15')][_0x4ee1('0x1a')](_0x1c9532[_0x4ee1('0x16')],{'raw':_0x1c9532[_0x4ee1('0x17')]?_0x1c9532[_0x4ee1('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c9532[_0x4ee1('0x17')]?_0x1c9532[_0x4ee1('0x17')]['where']||null:null,'attributes':_0x1c9532[_0x4ee1('0x17')]?_0x1c9532[_0x4ee1('0x17')][_0x4ee1('0x1b')]||null:null,'limit':_0x1c9532[_0x4ee1('0x17')]?_0x1c9532[_0x4ee1('0x17')][_0x4ee1('0x1c')]||null:null})[_0x4ee1('0x9')](function(_0x4f8c02){logger[_0x4ee1('0xa')](_0x4ee1('0x19'),_0x1c9532);logger[_0x4ee1('0xc')](_0x4ee1('0x19'),_0x1c9532,JSON['stringify'](_0x4f8c02));_0x33f93b(_0x4f8c02);})[_0x4ee1('0x13')](function(_0x582520){logger[_0x4ee1('0xf')]('UpdateOpenchannelQueueReport',_0x582520['message'],_0x1c9532);_0x58236f(_0x51dd4d['error'](0x1f4,_0x582520[_0x4ee1('0x12')]));});});}; \ No newline at end of file +var _0xd783=['where','attributes','UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateOpenchannelQueueReport','create','options','raw','OpenchannelQueueReport','update'];(function(_0x18c191,_0x360a7c){var _0x170a62=function(_0x498bdf){while(--_0x498bdf){_0x18c191['push'](_0x18c191['shift']());}};_0x170a62(++_0x360a7c);}(_0xd783,0xa3));var _0x3d78=function(_0x2ab3c5,_0x35a3ef){_0x2ab3c5=_0x2ab3c5-0x0;var _0x2733aa=_0xd783[_0x2ab3c5];return _0x2733aa;};'use strict';var _=require('lodash');var util=require(_0x3d78('0x0'));var moment=require(_0x3d78('0x1'));var BPromise=require(_0x3d78('0x2'));var rs=require(_0x3d78('0x3'));var fs=require('fs');var Redis=require(_0x3d78('0x4'));var db=require(_0x3d78('0x5'))['db'];var utils=require(_0x3d78('0x6'));var logger=require(_0x3d78('0x7'))('rpc');var config=require(_0x3d78('0x8'));var jayson=require(_0x3d78('0x9'));var client=jayson[_0x3d78('0xa')][_0x3d78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2747d8,_0x326927,_0x115e88){return new BPromise(function(_0x2f7df0,_0x49974d){return client[_0x3d78('0xc')](_0x2747d8,_0x115e88)[_0x3d78('0xd')](function(_0x3fb4ec){logger[_0x3d78('0xe')](_0x3d78('0xf'),_0x326927,_0x3d78('0x10'));logger[_0x3d78('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x326927,_0x3d78('0x10'),JSON[_0x3d78('0x12')](_0x3fb4ec));if(_0x3fb4ec[_0x3d78('0x13')]){if(_0x3fb4ec[_0x3d78('0x13')]['code']===0x1f4){logger[_0x3d78('0x13')](_0x3d78('0xf'),_0x326927,_0x3fb4ec[_0x3d78('0x13')][_0x3d78('0x14')]);return _0x49974d(_0x3fb4ec[_0x3d78('0x13')][_0x3d78('0x14')]);}logger['error'](_0x3d78('0xf'),_0x326927,_0x3fb4ec[_0x3d78('0x13')]['message']);return _0x2f7df0(_0x3fb4ec[_0x3d78('0x13')][_0x3d78('0x14')]);}else{logger[_0x3d78('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x326927,_0x3d78('0x10'));_0x2f7df0(_0x3fb4ec[_0x3d78('0x15')][_0x3d78('0x14')]);}})[_0x3d78('0x16')](function(_0x26f39c){logger[_0x3d78('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x326927,_0x26f39c);_0x49974d(_0x26f39c);});});}exports[_0x3d78('0x17')]=function(_0xb190ec){var _0x4fa5ce=this;return new Promise(function(_0x486318,_0x630467){return db['OpenchannelQueueReport'][_0x3d78('0x18')](_0xb190ec['body'],{'raw':_0xb190ec[_0x3d78('0x19')]?_0xb190ec[_0x3d78('0x19')][_0x3d78('0x1a')]===undefined?!![]:![]:!![]})[_0x3d78('0xd')](function(_0x1afc97){logger[_0x3d78('0xe')](_0x3d78('0x17'),_0xb190ec);logger[_0x3d78('0x11')](_0x3d78('0x17'),_0xb190ec,JSON[_0x3d78('0x12')](_0x1afc97));_0x486318(_0x1afc97);})['catch'](function(_0x1d6717){logger[_0x3d78('0x13')](_0x3d78('0x17'),_0x1d6717[_0x3d78('0x14')],_0xb190ec);_0x630467(_0x4fa5ce[_0x3d78('0x13')](0x1f4,_0x1d6717[_0x3d78('0x14')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x4d355f){var _0x503984=this;return new Promise(function(_0x5ba151,_0x7bf56){return db[_0x3d78('0x1b')][_0x3d78('0x1c')](_0x4d355f['body'],{'raw':_0x4d355f[_0x3d78('0x19')]?_0x4d355f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d355f['options']?_0x4d355f['options'][_0x3d78('0x1d')]||null:null,'attributes':_0x4d355f[_0x3d78('0x19')]?_0x4d355f['options'][_0x3d78('0x1e')]||null:null,'limit':_0x4d355f[_0x3d78('0x19')]?_0x4d355f[_0x3d78('0x19')]['limit']||null:null})[_0x3d78('0xd')](function(_0x244d29){logger[_0x3d78('0xe')](_0x3d78('0x1f'),_0x4d355f);logger[_0x3d78('0x11')](_0x3d78('0x1f'),_0x4d355f,JSON[_0x3d78('0x12')](_0x244d29));_0x5ba151(_0x244d29);})[_0x3d78('0x16')](function(_0x5ea37e){logger[_0x3d78('0x13')](_0x3d78('0x1f'),_0x5ea37e['message'],_0x4d355f);_0x7bf56(_0x503984[_0x3d78('0x13')](0x1f4,_0x5ea37e[_0x3d78('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 81bae73..dfe866a 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(_0x58c851,_0x1f3d96){var _0x534d8a=function(_0x10c1a0){while(--_0x10c1a0){_0x58c851['push'](_0x58c851['shift']());}};_0x534d8a(++_0x1f3d96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x37c07d,_0xdbdb5f){var _0x10dadc=function(_0x2bafb7){while(--_0x2bafb7){_0x37c07d['push'](_0x37c07d['shift']());}};_0x10dadc(++_0xdbdb5f);}(_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('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 ba66247..1a8d3cc 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 _0x5689=['account','agent','queue','moment','exports','STRING','ENUM'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0x5689,0x199));var _0x9568=function(_0x72230b,_0x4b92eb){_0x72230b=_0x72230b-0x0;var _0x21ffe7=_0x5689[_0x72230b];return _0x21ffe7;};'use strict';var moment=require(_0x9568('0x0'));var Sequelize=require('sequelize');module[_0x9568('0x1')]={'uniqueid':{'type':Sequelize[_0x9568('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9568('0x3')](_0x9568('0x4'),_0x9568('0x5'),_0x9568('0x6')),'allowNull':![],'defaultValue':_0x9568('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x6d63=['queue','DATE','moment','exports','STRING','ENUM','agent'];(function(_0x5ccfa9,_0x415e4d){var _0x228ced=function(_0x57750a){while(--_0x57750a){_0x5ccfa9['push'](_0x5ccfa9['shift']());}};_0x228ced(++_0x415e4d);}(_0x6d63,0x19f));var _0x36d6=function(_0x279ab4,_0x68df8c){_0x279ab4=_0x279ab4-0x0;var _0x6952f8=_0x6d63[_0x279ab4];return _0x6952f8;};'use strict';var moment=require(_0x36d6('0x0'));var Sequelize=require('sequelize');module[_0x36d6('0x1')]={'uniqueid':{'type':Sequelize[_0x36d6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x36d6('0x3')]('account',_0x36d6('0x4'),_0x36d6('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x36d6('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 6d52ffd..ae8f4db 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 _0x579b=['querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','count','offset','limit','status','set','json','apply','reject','update','then','destroy','stack','name','send','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','OpenchannelTransferReport','includeAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x2b4cac,_0x4e6390){var _0x390887=function(_0x48e6b0){while(--_0x48e6b0){_0x2b4cac['push'](_0x2b4cac['shift']());}};_0x390887(++_0x4e6390);}(_0x579b,0x19a));var _0xb579=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x579b[_0x376b45];return _0x2341b3;};'use strict';var pdf=require(_0xb579('0x0'));var emlformat=require(_0xb579('0x1'));var rimraf=require(_0xb579('0x2'));var zipdir=require(_0xb579('0x3'));var jsonpatch=require(_0xb579('0x4'));var rp=require(_0xb579('0x5'));var moment=require(_0xb579('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb579('0x7'));var util=require('util');var path=require(_0xb579('0x8'));var sox=require(_0xb579('0x9'));var csv=require(_0xb579('0xa'));var ejs=require(_0xb579('0xb'));var fs=require('fs');var _=require(_0xb579('0xc'));var squel=require('squel');var crypto=require(_0xb579('0xd'));var jsforce=require(_0xb579('0xe'));var deskjs=require(_0xb579('0xf'));var toCsv=require(_0xb579('0xa'));var querystring=require(_0xb579('0x10'));var Papa=require('papaparse');var Redis=require(_0xb579('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb579('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb579('0x13'));var logger=require(_0xb579('0x14'))(_0xb579('0x15'));var utils=require(_0xb579('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33765f,_0x1dbd13){_0x1dbd13=_0x1dbd13||0xcc;return function(_0x14b9b6){if(_0x14b9b6){return _0x33765f[_0xb579('0x17')](_0x1dbd13);}return _0x33765f['status'](_0x1dbd13)[_0xb579('0x18')]();};}function respondWithResult(_0xebc741,_0x52467c){_0x52467c=_0x52467c||0xc8;return function(_0x2b65e3){if(_0x2b65e3){return _0xebc741['status'](_0x52467c)['json'](_0x2b65e3);}};}function respondWithFilteredResult(_0x21e098,_0x4df59d){return function(_0x567588){if(_0x567588){var _0x4c0622=_0x567588[_0xb579('0x19')],_0x1dfd85=_0x4df59d['offset'],_0x23b9ad=_0x4df59d[_0xb579('0x1a')]+_0x4df59d[_0xb579('0x1b')],_0x272e43;if(_0x23b9ad>=_0x4c0622){_0x23b9ad=_0x4c0622;_0x272e43=0xc8;}else{_0x272e43=0xce;}_0x21e098[_0xb579('0x1c')](_0x272e43);return _0x21e098[_0xb579('0x1d')]('Content-Range',_0x1dfd85+'-'+_0x23b9ad+'/'+_0x4c0622)[_0xb579('0x1e')](_0x567588);}return null;};}function patchUpdates(_0x1c37fa){return function(_0x38c5e4){try{jsonpatch[_0xb579('0x1f')](_0x38c5e4,_0x1c37fa,!![]);}catch(_0x2049f6){return BPromise[_0xb579('0x20')](_0x2049f6);}return _0x38c5e4['save']();};}function saveUpdates(_0x8a3a0c,_0x4478ba){return function(_0x39ed75){if(_0x39ed75){return _0x39ed75[_0xb579('0x21')](_0x8a3a0c)[_0xb579('0x22')](function(_0x39deac){return _0x39deac;});}return null;};}function removeEntity(_0x427fbc,_0x3875a9){return function(_0x2d77d9){if(_0x2d77d9){return _0x2d77d9[_0xb579('0x23')]()['then'](function(){_0x427fbc[_0xb579('0x1c')](0xcc)[_0xb579('0x18')]();});}};}function handleEntityNotFound(_0x515efc,_0x504961){return function(_0x35e243){if(!_0x35e243){_0x515efc[_0xb579('0x17')](0x194);}return _0x35e243;};}function handleError(_0x185358,_0x21a9fb){_0x21a9fb=_0x21a9fb||0x1f4;return function(_0x291888){logger['error'](_0x291888[_0xb579('0x24')]);if(_0x291888[_0xb579('0x25')]){delete _0x291888[_0xb579('0x25')];}_0x185358[_0xb579('0x1c')](_0x21a9fb)[_0xb579('0x26')](_0x291888);};}exports['index']=function(_0x108abc,_0x2517fb){var _0x3c74fe={},_0x13d0d6={},_0x7fc14c={'count':0x0,'rows':[]};var _0x28b40c=_[_0xb579('0x27')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x1e6460){return{'name':_0x1e6460[_0xb579('0x28')],'type':_0x1e6460[_0xb579('0x29')]['key']};});_0x13d0d6[_0xb579('0x2a')]=_[_0xb579('0x27')](_0x28b40c,'name');_0x13d0d6[_0xb579('0x2b')]=_[_0xb579('0x2c')](_0x108abc[_0xb579('0x2b')]);_0x13d0d6[_0xb579('0x2d')]=_[_0xb579('0x2e')](_0x13d0d6[_0xb579('0x2a')],_0x13d0d6[_0xb579('0x2b')]);_0x3c74fe[_0xb579('0x2f')]=_[_0xb579('0x2e')](_0x13d0d6[_0xb579('0x2a')],qs[_0xb579('0x30')](_0x108abc[_0xb579('0x2b')][_0xb579('0x30')]));_0x3c74fe[_0xb579('0x2f')]=_0x3c74fe['attributes'][_0xb579('0x31')]?_0x3c74fe['attributes']:_0x13d0d6[_0xb579('0x2a')];if(!_0x108abc[_0xb579('0x2b')][_0xb579('0x32')](_0xb579('0x33'))){_0x3c74fe['limit']=qs[_0xb579('0x1b')](_0x108abc[_0xb579('0x2b')][_0xb579('0x1b')]);_0x3c74fe['offset']=qs[_0xb579('0x1a')](_0x108abc[_0xb579('0x2b')][_0xb579('0x1a')]);}_0x3c74fe[_0xb579('0x34')]=qs[_0xb579('0x35')](_0x108abc[_0xb579('0x2b')][_0xb579('0x35')]);_0x3c74fe[_0xb579('0x36')]=qs['filters'](_[_0xb579('0x37')](_0x108abc[_0xb579('0x2b')],_0x13d0d6[_0xb579('0x2d')]),_0x28b40c);if(_0x108abc[_0xb579('0x2b')]['filter']){_0x3c74fe['where']=_['merge'](_0x3c74fe[_0xb579('0x36')],{'$or':_[_0xb579('0x27')](_0x28b40c,function(_0x4427a3){if(_0x4427a3[_0xb579('0x29')]!==_0xb579('0x38')){var _0x3661db={};_0x3661db[_0x4427a3['name']]={'$like':'%'+_0x108abc[_0xb579('0x2b')][_0xb579('0x39')]+'%'};return _0x3661db;}})});}_0x3c74fe=_[_0xb579('0x3a')]({},_0x3c74fe,_0x108abc[_0xb579('0x3b')]);var _0x5234d6={'where':_0x3c74fe[_0xb579('0x36')]};return db[_0xb579('0x3c')]['count'](_0x5234d6)[_0xb579('0x22')](function(_0x302ef9){_0x7fc14c[_0xb579('0x19')]=_0x302ef9;if(_0x108abc[_0xb579('0x2b')][_0xb579('0x3d')]){_0x3c74fe['include']=[{'all':!![]}];}return db[_0xb579('0x3c')]['findAll'](_0x3c74fe);})[_0xb579('0x22')](function(_0x55e1a8){_0x7fc14c[_0xb579('0x3e')]=_0x55e1a8;return _0x7fc14c;})[_0xb579('0x22')](respondWithFilteredResult(_0x2517fb,_0x3c74fe))[_0xb579('0x3f')](handleError(_0x2517fb,null));};exports[_0xb579('0x40')]=function(_0x463679,_0x5aab6e){var _0xab171e={'raw':!![],'where':{'id':_0x463679[_0xb579('0x41')]['id']}},_0xbdb82c={};_0xbdb82c[_0xb579('0x2a')]=_[_0xb579('0x2c')](db[_0xb579('0x3c')][_0xb579('0x42')]);_0xbdb82c['query']=_[_0xb579('0x2c')](_0x463679[_0xb579('0x2b')]);_0xbdb82c[_0xb579('0x2d')]=_[_0xb579('0x2e')](_0xbdb82c[_0xb579('0x2a')],_0xbdb82c[_0xb579('0x2b')]);_0xab171e[_0xb579('0x2f')]=_['intersection'](_0xbdb82c[_0xb579('0x2a')],qs[_0xb579('0x30')](_0x463679[_0xb579('0x2b')][_0xb579('0x30')]));_0xab171e['attributes']=_0xab171e[_0xb579('0x2f')][_0xb579('0x31')]?_0xab171e[_0xb579('0x2f')]:_0xbdb82c[_0xb579('0x2a')];if(_0x463679[_0xb579('0x2b')][_0xb579('0x3d')]){_0xab171e['include']=[{'all':!![]}];}_0xab171e=_[_0xb579('0x3a')]({},_0xab171e,_0x463679[_0xb579('0x3b')]);return db[_0xb579('0x3c')][_0xb579('0x43')](_0xab171e)[_0xb579('0x22')](handleEntityNotFound(_0x5aab6e,null))[_0xb579('0x22')](respondWithResult(_0x5aab6e,null))[_0xb579('0x3f')](handleError(_0x5aab6e,null));};exports[_0xb579('0x44')]=function(_0x63b90f,_0x375143){return db[_0xb579('0x3c')][_0xb579('0x44')](_0x63b90f[_0xb579('0x45')],{})['then'](respondWithResult(_0x375143,0xc9))[_0xb579('0x3f')](handleError(_0x375143,null));};exports['update']=function(_0x30d09e,_0xf2cfb6){if(_0x30d09e[_0xb579('0x45')]['id']){delete _0x30d09e[_0xb579('0x45')]['id'];}return db[_0xb579('0x3c')][_0xb579('0x43')]({'where':{'id':_0x30d09e['params']['id']}})[_0xb579('0x22')](handleEntityNotFound(_0xf2cfb6,null))[_0xb579('0x22')](saveUpdates(_0x30d09e['body'],null))[_0xb579('0x22')](respondWithResult(_0xf2cfb6,null))[_0xb579('0x3f')](handleError(_0xf2cfb6,null));};exports[_0xb579('0x23')]=function(_0x253230,_0x5ef823){return db[_0xb579('0x3c')]['find']({'where':{'id':_0x253230['params']['id']}})[_0xb579('0x22')](handleEntityNotFound(_0x5ef823,null))[_0xb579('0x22')](removeEntity(_0x5ef823,null))[_0xb579('0x3f')](handleError(_0x5ef823,null));};exports[_0xb579('0x46')]=function(_0x1f51bd,_0x1c5180){return db[_0xb579('0x3c')][_0xb579('0x46')]()['then'](respondWithResult(_0x1c5180,null))[_0xb579('0x3f')](handleError(_0x1c5180,null));}; \ No newline at end of file +var _0x20fc=['lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','index','map','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','nolimit','limit','offset','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','params','keys','OpenchannelTransferReport','options','catch','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x4398b9,_0xf7d1f8){var _0x2b1ae9=function(_0x4f5e52){while(--_0x4f5e52){_0x4398b9['push'](_0x4398b9['shift']());}};_0x2b1ae9(++_0xf7d1f8);}(_0x20fc,0xd5));var _0xc20f=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0x20fc[_0xb24fad];return _0x173226;};'use strict';var pdf=require(_0xc20f('0x0'));var emlformat=require(_0xc20f('0x1'));var rimraf=require(_0xc20f('0x2'));var zipdir=require(_0xc20f('0x3'));var jsonpatch=require(_0xc20f('0x4'));var rp=require(_0xc20f('0x5'));var moment=require(_0xc20f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc20f('0x7'));var util=require(_0xc20f('0x8'));var path=require(_0xc20f('0x9'));var sox=require(_0xc20f('0xa'));var csv=require('to-csv');var ejs=require(_0xc20f('0xb'));var fs=require('fs');var _=require(_0xc20f('0xc'));var squel=require(_0xc20f('0xd'));var crypto=require('crypto');var jsforce=require(_0xc20f('0xe'));var deskjs=require(_0xc20f('0xf'));var toCsv=require(_0xc20f('0x10'));var querystring=require('querystring');var Papa=require(_0xc20f('0x11'));var Redis=require(_0xc20f('0x12'));var authService=require(_0xc20f('0x13'));var qs=require(_0xc20f('0x14'));var as=require(_0xc20f('0x15'));var hardwareService=require(_0xc20f('0x16'));var logger=require(_0xc20f('0x17'))('api');var utils=require(_0xc20f('0x18'));var config=require(_0xc20f('0x19'));var licenseUtil=require(_0xc20f('0x1a'));var db=require(_0xc20f('0x1b'))['db'];function respondWithStatusCode(_0xfe704c,_0x544dbc){_0x544dbc=_0x544dbc||0xcc;return function(_0x40102a){if(_0x40102a){return _0xfe704c['sendStatus'](_0x544dbc);}return _0xfe704c[_0xc20f('0x1c')](_0x544dbc)['end']();};}function respondWithResult(_0x477bca,_0x2d1ad5){_0x2d1ad5=_0x2d1ad5||0xc8;return function(_0x2444e6){if(_0x2444e6){return _0x477bca['status'](_0x2d1ad5)['json'](_0x2444e6);}};}function respondWithFilteredResult(_0x53455e,_0x110af5){return function(_0x3afed1){if(_0x3afed1){var _0xc7e2f9=_0x3afed1['count'],_0x243cdd=_0x110af5['offset'],_0x1998c6=_0x110af5['offset']+_0x110af5['limit'],_0x264c21;if(_0x1998c6>=_0xc7e2f9){_0x1998c6=_0xc7e2f9;_0x264c21=0xc8;}else{_0x264c21=0xce;}_0x53455e[_0xc20f('0x1c')](_0x264c21);return _0x53455e[_0xc20f('0x1d')](_0xc20f('0x1e'),_0x243cdd+'-'+_0x1998c6+'/'+_0xc7e2f9)[_0xc20f('0x1f')](_0x3afed1);}return null;};}function patchUpdates(_0x48cb82){return function(_0x2fac32){try{jsonpatch[_0xc20f('0x20')](_0x2fac32,_0x48cb82,!![]);}catch(_0x524649){return BPromise[_0xc20f('0x21')](_0x524649);}return _0x2fac32[_0xc20f('0x22')]();};}function saveUpdates(_0x154304,_0x40283d){return function(_0x90109e){if(_0x90109e){return _0x90109e[_0xc20f('0x23')](_0x154304)[_0xc20f('0x24')](function(_0x396fc8){return _0x396fc8;});}return null;};}function removeEntity(_0x577ce7,_0x16d7fe){return function(_0x2c2be2){if(_0x2c2be2){return _0x2c2be2['destroy']()[_0xc20f('0x24')](function(){_0x577ce7[_0xc20f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15bcd8,_0xefb8e4){return function(_0x4f671b){if(!_0x4f671b){_0x15bcd8[_0xc20f('0x25')](0x194);}return _0x4f671b;};}function handleError(_0x60e381,_0x4f758c){_0x4f758c=_0x4f758c||0x1f4;return function(_0x2dc739){logger[_0xc20f('0x26')](_0x2dc739['stack']);if(_0x2dc739[_0xc20f('0x27')]){delete _0x2dc739[_0xc20f('0x27')];}_0x60e381['status'](_0x4f758c)['send'](_0x2dc739);};}exports[_0xc20f('0x28')]=function(_0x1c0a44,_0xac795a){var _0x163360={},_0x23a837={},_0x2325c1={'count':0x0,'rows':[]};var _0x55fc81=_[_0xc20f('0x29')](db['OpenchannelTransferReport'][_0xc20f('0x2a')],function(_0x1dee5f){return{'name':_0x1dee5f[_0xc20f('0x2b')],'type':_0x1dee5f[_0xc20f('0x2c')]['key']};});_0x23a837[_0xc20f('0x2d')]=_[_0xc20f('0x29')](_0x55fc81,_0xc20f('0x27'));_0x23a837[_0xc20f('0x2e')]=_['keys'](_0x1c0a44[_0xc20f('0x2e')]);_0x23a837['filters']=_['intersection'](_0x23a837[_0xc20f('0x2d')],_0x23a837['query']);_0x163360[_0xc20f('0x2f')]=_[_0xc20f('0x30')](_0x23a837[_0xc20f('0x2d')],qs['fields'](_0x1c0a44[_0xc20f('0x2e')][_0xc20f('0x31')]));_0x163360[_0xc20f('0x2f')]=_0x163360[_0xc20f('0x2f')][_0xc20f('0x32')]?_0x163360[_0xc20f('0x2f')]:_0x23a837[_0xc20f('0x2d')];if(!_0x1c0a44['query']['hasOwnProperty'](_0xc20f('0x33'))){_0x163360[_0xc20f('0x34')]=qs[_0xc20f('0x34')](_0x1c0a44[_0xc20f('0x2e')]['limit']);_0x163360[_0xc20f('0x35')]=qs['offset'](_0x1c0a44[_0xc20f('0x2e')]['offset']);}_0x163360[_0xc20f('0x36')]=qs[_0xc20f('0x37')](_0x1c0a44[_0xc20f('0x2e')][_0xc20f('0x37')]);_0x163360['where']=qs[_0xc20f('0x38')](_[_0xc20f('0x39')](_0x1c0a44[_0xc20f('0x2e')],_0x23a837[_0xc20f('0x38')]),_0x55fc81);if(_0x1c0a44[_0xc20f('0x2e')][_0xc20f('0x3a')]){_0x163360[_0xc20f('0x3b')]=_[_0xc20f('0x3c')](_0x163360['where'],{'$or':_[_0xc20f('0x29')](_0x55fc81,function(_0x11ccc3){if(_0x11ccc3[_0xc20f('0x2c')]!==_0xc20f('0x3d')){var _0x1ee7de={};_0x1ee7de[_0x11ccc3['name']]={'$like':'%'+_0x1c0a44[_0xc20f('0x2e')][_0xc20f('0x3a')]+'%'};return _0x1ee7de;}})});}_0x163360=_[_0xc20f('0x3c')]({},_0x163360,_0x1c0a44['options']);var _0x32874c={'where':_0x163360[_0xc20f('0x3b')]};return db['OpenchannelTransferReport']['count'](_0x32874c)['then'](function(_0x5d3189){_0x2325c1['count']=_0x5d3189;if(_0x1c0a44[_0xc20f('0x2e')][_0xc20f('0x3e')]){_0x163360[_0xc20f('0x3f')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xc20f('0x40')](_0x163360);})['then'](function(_0x2206c4){_0x2325c1['rows']=_0x2206c4;return _0x2325c1;})[_0xc20f('0x24')](respondWithFilteredResult(_0xac795a,_0x163360))['catch'](handleError(_0xac795a,null));};exports['show']=function(_0x1ae2f9,_0x4090aa){var _0x183669={'raw':!![],'where':{'id':_0x1ae2f9[_0xc20f('0x41')]['id']}},_0x39bbdd={};_0x39bbdd[_0xc20f('0x2d')]=_[_0xc20f('0x42')](db[_0xc20f('0x43')][_0xc20f('0x2a')]);_0x39bbdd[_0xc20f('0x2e')]=_[_0xc20f('0x42')](_0x1ae2f9[_0xc20f('0x2e')]);_0x39bbdd[_0xc20f('0x38')]=_['intersection'](_0x39bbdd[_0xc20f('0x2d')],_0x39bbdd[_0xc20f('0x2e')]);_0x183669[_0xc20f('0x2f')]=_['intersection'](_0x39bbdd[_0xc20f('0x2d')],qs[_0xc20f('0x31')](_0x1ae2f9['query'][_0xc20f('0x31')]));_0x183669[_0xc20f('0x2f')]=_0x183669['attributes'][_0xc20f('0x32')]?_0x183669['attributes']:_0x39bbdd[_0xc20f('0x2d')];if(_0x1ae2f9[_0xc20f('0x2e')][_0xc20f('0x3e')]){_0x183669[_0xc20f('0x3f')]=[{'all':!![]}];}_0x183669=_[_0xc20f('0x3c')]({},_0x183669,_0x1ae2f9[_0xc20f('0x44')]);return db[_0xc20f('0x43')]['find'](_0x183669)[_0xc20f('0x24')](handleEntityNotFound(_0x4090aa,null))[_0xc20f('0x24')](respondWithResult(_0x4090aa,null))[_0xc20f('0x45')](handleError(_0x4090aa,null));};exports['create']=function(_0x65e72a,_0x5013f3){return db['OpenchannelTransferReport'][_0xc20f('0x46')](_0x65e72a['body'],{})[_0xc20f('0x24')](respondWithResult(_0x5013f3,0xc9))['catch'](handleError(_0x5013f3,null));};exports['update']=function(_0x13ecbf,_0x748c4c){if(_0x13ecbf['body']['id']){delete _0x13ecbf[_0xc20f('0x47')]['id'];}return db[_0xc20f('0x43')][_0xc20f('0x48')]({'where':{'id':_0x13ecbf['params']['id']}})[_0xc20f('0x24')](handleEntityNotFound(_0x748c4c,null))[_0xc20f('0x24')](saveUpdates(_0x13ecbf[_0xc20f('0x47')],null))[_0xc20f('0x24')](respondWithResult(_0x748c4c,null))[_0xc20f('0x45')](handleError(_0x748c4c,null));};exports[_0xc20f('0x49')]=function(_0x470000,_0x40e210){return db[_0xc20f('0x43')][_0xc20f('0x48')]({'where':{'id':_0x470000[_0xc20f('0x41')]['id']}})[_0xc20f('0x24')](handleEntityNotFound(_0x40e210,null))[_0xc20f('0x24')](removeEntity(_0x40e210,null))['catch'](handleError(_0x40e210,null));};exports[_0xc20f('0x4a')]=function(_0x38b0c1,_0x4ba068){return db[_0xc20f('0x43')][_0xc20f('0x4a')]()[_0xc20f('0x24')](respondWithResult(_0x4ba068,null))['catch'](handleError(_0x4ba068,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 60f4539..eab86f6 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 _0x1b78=['request-promise','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4c9e63,_0x583572){var _0x2cfe32=function(_0x58962d){while(--_0x58962d){_0x4c9e63['push'](_0x4c9e63['shift']());}};_0x2cfe32(++_0x583572);}(_0x1b78,0x1b7));var _0x81b7=function(_0xba2e24,_0x492630){_0xba2e24=_0xba2e24-0x0;var _0x3b0fb7=_0x1b78[_0xba2e24];return _0x3b0fb7;};'use strict';var _=require(_0x81b7('0x0'));var util=require(_0x81b7('0x1'));var logger=require(_0x81b7('0x2'))('api');var moment=require(_0x81b7('0x3'));var BPromise=require(_0x81b7('0x4'));var rp=require(_0x81b7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x81b7('0x6'));var config=require(_0x81b7('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x81b7('0x8')]=function(_0x547c51,_0x4e7f0e){return _0x547c51[_0x81b7('0x9')](_0x81b7('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x81b7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1df0=['lodash','../../config/logger','request-promise','path','../../config/environment','define','report_openchannel_transfer','uniqueid'];(function(_0x54e22d,_0x28226e){var _0x305c2f=function(_0x546b66){while(--_0x546b66){_0x54e22d['push'](_0x54e22d['shift']());}};_0x305c2f(++_0x28226e);}(_0x1df0,0x178));var _0x01df=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x1df0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x01df('0x0'));var util=require('util');var logger=require(_0x01df('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x01df('0x2'));var fs=require('fs');var path=require(_0x01df('0x3'));var rimraf=require('rimraf');var config=require(_0x01df('0x4'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x5dc80c,_0x461c67){return _0x5dc80c[_0x01df('0x5')]('OpenchannelTransferReport',attributes,{'tableName':_0x01df('0x6'),'paranoid':![],'indexes':[{'name':_0x01df('0x7'),'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 2d971a8..1b9a967 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 _0xb34e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3c5b8a,_0x82f078){var _0x3e5874=function(_0x4c4b82){while(--_0x4c4b82){_0x3c5b8a['push'](_0x3c5b8a['shift']());}};_0x3e5874(++_0x82f078);}(_0xb34e,0x181));var _0xeb34=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb34e[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0xeb34('0x0'));var util=require(_0xeb34('0x1'));var moment=require(_0xeb34('0x2'));var BPromise=require(_0xeb34('0x3'));var rs=require(_0xeb34('0x4'));var fs=require('fs');var Redis=require(_0xeb34('0x5'));var db=require(_0xeb34('0x6'))['db'];var utils=require(_0xeb34('0x7'));var logger=require(_0xeb34('0x8'))(_0xeb34('0x9'));var config=require(_0xeb34('0xa'));var jayson=require(_0xeb34('0xb'));var client=jayson['client'][_0xeb34('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cada2,_0x22033e,_0x3294a3){return new BPromise(function(_0x36cd46,_0x1363da){return client['request'](_0x5cada2,_0x3294a3)[_0xeb34('0xd')](function(_0x364d9d){logger[_0xeb34('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x22033e,_0xeb34('0xf'));logger['debug'](_0xeb34('0x10'),_0x22033e,_0xeb34('0xf'),JSON['stringify'](_0x364d9d));if(_0x364d9d[_0xeb34('0x11')]){if(_0x364d9d[_0xeb34('0x11')][_0xeb34('0x12')]===0x1f4){logger['error'](_0xeb34('0x13'),_0x22033e,_0x364d9d[_0xeb34('0x11')][_0xeb34('0x14')]);return _0x1363da(_0x364d9d[_0xeb34('0x11')][_0xeb34('0x14')]);}logger['error'](_0xeb34('0x13'),_0x22033e,_0x364d9d[_0xeb34('0x11')]['message']);return _0x36cd46(_0x364d9d['error'][_0xeb34('0x14')]);}else{logger[_0xeb34('0xe')](_0xeb34('0x13'),_0x22033e,'request\x20sent');_0x36cd46(_0x364d9d[_0xeb34('0x15')][_0xeb34('0x14')]);}})[_0xeb34('0x16')](function(_0x2776b1){logger[_0xeb34('0x11')](_0xeb34('0x13'),_0x22033e,_0x2776b1);_0x1363da(_0x2776b1);});});} \ No newline at end of file +var _0x4504=['error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3ca271,_0x446052){var _0x51ef4a=function(_0x2aceef){while(--_0x2aceef){_0x3ca271['push'](_0x3ca271['shift']());}};_0x51ef4a(++_0x446052);}(_0x4504,0xd4));var _0x4450=function(_0x2caf5d,_0x33ce95){_0x2caf5d=_0x2caf5d-0x0;var _0x309b75=_0x4504[_0x2caf5d];return _0x309b75;};'use strict';var _=require(_0x4450('0x0'));var util=require(_0x4450('0x1'));var moment=require('moment');var BPromise=require(_0x4450('0x2'));var rs=require(_0x4450('0x3'));var fs=require('fs');var Redis=require(_0x4450('0x4'));var db=require(_0x4450('0x5'))['db'];var utils=require(_0x4450('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4450('0x7'));var client=jayson[_0x4450('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ba484,_0x34afba,_0xa9671){return new BPromise(function(_0x4767b8,_0x1b9e98){return client[_0x4450('0x9')](_0x2ba484,_0xa9671)[_0x4450('0xa')](function(_0x2564ae){logger[_0x4450('0xb')](_0x4450('0xc'),_0x34afba,_0x4450('0xd'));logger[_0x4450('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x34afba,_0x4450('0xd'),JSON[_0x4450('0xf')](_0x2564ae));if(_0x2564ae['error']){if(_0x2564ae['error']['code']===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x34afba,_0x2564ae[_0x4450('0x10')][_0x4450('0x11')]);return _0x1b9e98(_0x2564ae[_0x4450('0x10')][_0x4450('0x11')]);}logger[_0x4450('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x34afba,_0x2564ae['error'][_0x4450('0x11')]);return _0x4767b8(_0x2564ae[_0x4450('0x10')][_0x4450('0x11')]);}else{logger['info'](_0x4450('0xc'),_0x34afba,_0x4450('0xd'));_0x4767b8(_0x2564ae['result'][_0x4450('0x11')]);}})[_0x4450('0x12')](function(_0x5977d8){logger[_0x4450('0x10')](_0x4450('0xc'),_0x34afba,_0x5977d8);_0x1b9e98(_0x5977d8);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 685c541..07ddf4b 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 _0x4e75=['get','post','/:id','update','destroy','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index'];(function(_0x57ebed,_0xfac0ac){var _0x3a0874=function(_0x271491){while(--_0x271491){_0x57ebed['push'](_0x57ebed['shift']());}};_0x3a0874(++_0xfac0ac);}(_0x4e75,0x17f));var _0x54e7=function(_0x259484,_0x96621e){_0x259484=_0x259484-0x0;var _0x92d439=_0x4e75[_0x259484];return _0x92d439;};'use strict';var multer=require(_0x54e7('0x0'));var util=require('util');var path=require(_0x54e7('0x1'));var timeout=require(_0x54e7('0x2'));var express=require('express');var router=express[_0x54e7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x54e7('0x4'));var config=require(_0x54e7('0x5'));var controller=require(_0x54e7('0x6'));router['get']('/',auth[_0x54e7('0x7')](),controller[_0x54e7('0x8')]);router[_0x54e7('0x9')]('/:id',auth[_0x54e7('0x7')](),controller['show']);router[_0x54e7('0xa')]('/',auth[_0x54e7('0x7')](),controller['create']);router['put'](_0x54e7('0xb'),auth[_0x54e7('0x7')](),controller[_0x54e7('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x54e7('0xd')]);module['exports']=router; \ No newline at end of file +var _0x5955=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x559546,_0x5131f4){var _0x23a025=function(_0x44036b){while(--_0x44036b){_0x559546['push'](_0x559546['shift']());}};_0x23a025(++_0x5131f4);}(_0x5955,0x182));var _0x5595=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x5955[_0x59d89e];return _0x554e93;};'use strict';var multer=require(_0x5595('0x0'));var util=require(_0x5595('0x1'));var path=require(_0x5595('0x2'));var timeout=require(_0x5595('0x3'));var express=require(_0x5595('0x4'));var router=express['Router']();var auth=require(_0x5595('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5595('0x6'));var controller=require('./pause.controller');router[_0x5595('0x7')]('/',auth[_0x5595('0x8')](),controller[_0x5595('0x9')]);router[_0x5595('0x7')](_0x5595('0xa'),auth['isAuthenticated'](),controller[_0x5595('0xb')]);router[_0x5595('0xc')]('/',auth[_0x5595('0x8')](),controller[_0x5595('0xd')]);router[_0x5595('0xe')](_0x5595('0xa'),auth[_0x5595('0x8')](),controller[_0x5595('0xf')]);router[_0x5595('0x10')](_0x5595('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5595('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index ffa9526..93e883b 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 _0x4305=['name','STRING','sequelize','exports'];(function(_0xefed82,_0x55f9d7){var _0xc4bd61=function(_0x2d6952){while(--_0x2d6952){_0xefed82['push'](_0xefed82['shift']());}};_0xc4bd61(++_0x55f9d7);}(_0x4305,0x166));var _0x5430=function(_0x4a9fb7,_0x4cbfd7){_0x4a9fb7=_0x4a9fb7-0x0;var _0x40b90e=_0x4305[_0x4a9fb7];return _0x40b90e;};'use strict';var Sequelize=require(_0x5430('0x0'));module[_0x5430('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5430('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5430('0x3')]}}; \ No newline at end of file +var _0xeb7d=['sequelize','exports','name'];(function(_0x26addb,_0x31d999){var _0x348788=function(_0x5d17c5){while(--_0x5d17c5){_0x26addb['push'](_0x26addb['shift']());}};_0x348788(++_0x31d999);}(_0xeb7d,0xa2));var _0xdeb7=function(_0x29d824,_0x24a09d){_0x29d824=_0x29d824-0x0;var _0x39d80c=_0xeb7d[_0x29d824];return _0x39d80c;};'use strict';var Sequelize=require(_0xdeb7('0x0'));module[_0xdeb7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdeb7('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index d2ac516..9f57203 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 _0x7944=['role','user','UserProfileSection','find','userProfileId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x59acba,_0x57a0b1){var _0x178926=function(_0x4acc2d){while(--_0x4acc2d){_0x59acba['push'](_0x59acba['shift']());}};_0x178926(++_0x57a0b1);}(_0x7944,0x145));var _0x4794=function(_0x2cb413,_0x1b8015){_0x2cb413=_0x2cb413-0x0;var _0x541f48=_0x7944[_0x2cb413];return _0x541f48;};'use strict';var pdf=require(_0x4794('0x0'));var emlformat=require(_0x4794('0x1'));var rimraf=require(_0x4794('0x2'));var zipdir=require(_0x4794('0x3'));var jsonpatch=require(_0x4794('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4794('0x5'));var Mustache=require('mustache');var util=require(_0x4794('0x6'));var path=require(_0x4794('0x7'));var sox=require(_0x4794('0x8'));var csv=require('to-csv');var ejs=require(_0x4794('0x9'));var fs=require('fs');var _=require(_0x4794('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4794('0xb'));var deskjs=require(_0x4794('0xc'));var toCsv=require(_0x4794('0xd'));var querystring=require(_0x4794('0xe'));var Papa=require('papaparse');var Redis=require(_0x4794('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4794('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4794('0x11'));var logger=require(_0x4794('0x12'))(_0x4794('0x13'));var utils=require('../../config/utils');var config=require(_0x4794('0x14'));var licenseUtil=require(_0x4794('0x15'));var db=require(_0x4794('0x16'))['db'];function respondWithStatusCode(_0x2f7f64,_0xd09c25){_0xd09c25=_0xd09c25||0xcc;return function(_0x1e7795){if(_0x1e7795){return _0x2f7f64[_0x4794('0x17')](_0xd09c25);}return _0x2f7f64[_0x4794('0x18')](_0xd09c25)[_0x4794('0x19')]();};}function respondWithResult(_0x1b8862,_0x46ecd3){_0x46ecd3=_0x46ecd3||0xc8;return function(_0x549da4){if(_0x549da4){return _0x1b8862[_0x4794('0x18')](_0x46ecd3)[_0x4794('0x1a')](_0x549da4);}};}function respondWithFilteredResult(_0xa50a2e,_0x137c53){return function(_0x331778){if(_0x331778){var _0x5f5480=_0x331778['count'],_0x28947a=_0x137c53[_0x4794('0x1b')],_0x170272=_0x137c53[_0x4794('0x1b')]+_0x137c53[_0x4794('0x1c')],_0xf20237;if(_0x170272>=_0x5f5480){_0x170272=_0x5f5480;_0xf20237=0xc8;}else{_0xf20237=0xce;}_0xa50a2e[_0x4794('0x18')](_0xf20237);return _0xa50a2e['set']('Content-Range',_0x28947a+'-'+_0x170272+'/'+_0x5f5480)[_0x4794('0x1a')](_0x331778);}return null;};}function patchUpdates(_0x48edca){return function(_0x1577bc){try{jsonpatch[_0x4794('0x1d')](_0x1577bc,_0x48edca,!![]);}catch(_0x403b58){return BPromise[_0x4794('0x1e')](_0x403b58);}return _0x1577bc['save']();};}function saveUpdates(_0x282edf,_0x1775f0){return function(_0x46c791){if(_0x46c791){return _0x46c791[_0x4794('0x1f')](_0x282edf)[_0x4794('0x20')](function(_0x2f687c){return _0x2f687c;});}return null;};}function removeEntity(_0x271f89,_0x194934){return function(_0x39e4dc){if(_0x39e4dc){return _0x39e4dc[_0x4794('0x21')]()[_0x4794('0x20')](function(){var _0x1a19dd=_0x39e4dc[_0x4794('0x22')]({'plain':!![]});var _0x43d05e=_0x4794('0x23');return db[_0x4794('0x24')][_0x4794('0x21')]({'where':{'type':_0x43d05e,'resourceId':_0x1a19dd['id']}})[_0x4794('0x20')](function(){return _0x39e4dc;});})['then'](function(){_0x271f89[_0x4794('0x18')](0xcc)[_0x4794('0x19')]();});}};}function handleEntityNotFound(_0x4b6c8f,_0x561bcc){return function(_0x1e455f){if(!_0x1e455f){_0x4b6c8f[_0x4794('0x17')](0x194);}return _0x1e455f;};}function handleError(_0x4f65d3,_0x13f4f8){_0x13f4f8=_0x13f4f8||0x1f4;return function(_0x257e0c){logger[_0x4794('0x25')](_0x257e0c[_0x4794('0x26')]);if(_0x257e0c[_0x4794('0x27')]){delete _0x257e0c[_0x4794('0x27')];}_0x4f65d3['status'](_0x13f4f8)[_0x4794('0x28')](_0x257e0c);};}exports[_0x4794('0x29')]=function(_0x4709a6,_0x3015ba){var _0x375190={},_0x2bae37={},_0x219a13={'count':0x0,'rows':[]};var _0x332fe9=_[_0x4794('0x2a')](db[_0x4794('0x2b')][_0x4794('0x2c')],function(_0x2abf12){return{'name':_0x2abf12['fieldName'],'type':_0x2abf12[_0x4794('0x2d')][_0x4794('0x2e')]};});_0x2bae37[_0x4794('0x2f')]=_[_0x4794('0x2a')](_0x332fe9,'name');_0x2bae37[_0x4794('0x30')]=_[_0x4794('0x31')](_0x4709a6[_0x4794('0x30')]);_0x2bae37[_0x4794('0x32')]=_[_0x4794('0x33')](_0x2bae37[_0x4794('0x2f')],_0x2bae37[_0x4794('0x30')]);_0x375190[_0x4794('0x34')]=_[_0x4794('0x33')](_0x2bae37[_0x4794('0x2f')],qs[_0x4794('0x35')](_0x4709a6['query'][_0x4794('0x35')]));_0x375190['attributes']=_0x375190[_0x4794('0x34')][_0x4794('0x36')]?_0x375190[_0x4794('0x34')]:_0x2bae37[_0x4794('0x2f')];if(!_0x4709a6['query'][_0x4794('0x37')](_0x4794('0x38'))){_0x375190[_0x4794('0x1c')]=qs[_0x4794('0x1c')](_0x4709a6['query'][_0x4794('0x1c')]);_0x375190[_0x4794('0x1b')]=qs['offset'](_0x4709a6[_0x4794('0x30')][_0x4794('0x1b')]);}_0x375190[_0x4794('0x39')]=qs[_0x4794('0x3a')](_0x4709a6[_0x4794('0x30')][_0x4794('0x3a')]);_0x375190[_0x4794('0x3b')]=qs[_0x4794('0x32')](_[_0x4794('0x3c')](_0x4709a6['query'],_0x2bae37[_0x4794('0x32')]),_0x332fe9);if(_0x4709a6[_0x4794('0x30')][_0x4794('0x3d')]){_0x375190[_0x4794('0x3b')]=_['merge'](_0x375190[_0x4794('0x3b')],{'$or':_[_0x4794('0x2a')](_0x332fe9,function(_0x3660bb){if(_0x3660bb[_0x4794('0x2d')]!==_0x4794('0x3e')){var _0x212aa1={};_0x212aa1[_0x3660bb[_0x4794('0x27')]]={'$like':'%'+_0x4709a6[_0x4794('0x30')][_0x4794('0x3d')]+'%'};return _0x212aa1;}})});}_0x375190=_[_0x4794('0x3f')]({},_0x375190,_0x4709a6['options']);var _0x74edea={'where':_0x375190['where']};return db['Pause'][_0x4794('0x40')](_0x74edea)[_0x4794('0x20')](function(_0x355112){_0x219a13[_0x4794('0x40')]=_0x355112;if(_0x4709a6[_0x4794('0x30')][_0x4794('0x41')]){_0x375190[_0x4794('0x42')]=[{'all':!![]}];}return db[_0x4794('0x2b')][_0x4794('0x43')](_0x375190);})[_0x4794('0x20')](function(_0x342b29){_0x219a13[_0x4794('0x44')]=_0x342b29;return _0x219a13;})[_0x4794('0x20')](respondWithFilteredResult(_0x3015ba,_0x375190))[_0x4794('0x45')](handleError(_0x3015ba,null));};exports['show']=function(_0x594cdd,_0x13be55){var _0x1e3e5e={'raw':!![],'where':{'id':_0x594cdd[_0x4794('0x46')]['id']}},_0x4902d9={};_0x4902d9[_0x4794('0x2f')]=_[_0x4794('0x31')](db[_0x4794('0x2b')][_0x4794('0x2c')]);_0x4902d9['query']=_[_0x4794('0x31')](_0x594cdd[_0x4794('0x30')]);_0x4902d9[_0x4794('0x32')]=_[_0x4794('0x33')](_0x4902d9[_0x4794('0x2f')],_0x4902d9['query']);_0x1e3e5e[_0x4794('0x34')]=_[_0x4794('0x33')](_0x4902d9[_0x4794('0x2f')],qs[_0x4794('0x35')](_0x594cdd[_0x4794('0x30')][_0x4794('0x35')]));_0x1e3e5e[_0x4794('0x34')]=_0x1e3e5e['attributes'][_0x4794('0x36')]?_0x1e3e5e['attributes']:_0x4902d9[_0x4794('0x2f')];if(_0x594cdd[_0x4794('0x30')][_0x4794('0x41')]){_0x1e3e5e[_0x4794('0x42')]=[{'all':!![]}];}_0x1e3e5e=_[_0x4794('0x3f')]({},_0x1e3e5e,_0x594cdd[_0x4794('0x47')]);return db[_0x4794('0x2b')]['find'](_0x1e3e5e)['then'](handleEntityNotFound(_0x13be55,null))[_0x4794('0x20')](respondWithResult(_0x13be55,null))['catch'](handleError(_0x13be55,null));};exports[_0x4794('0x48')]=function(_0xd5a5a4,_0x8349b3){return db[_0x4794('0x2b')][_0x4794('0x48')](_0xd5a5a4[_0x4794('0x49')],{})['then'](function(_0x452fb8){var _0xbec064=_0xd5a5a4['user'][_0x4794('0x22')]({'plain':!![]});if(!_0xbec064)throw new Error(_0x4794('0x4a'));if(_0xbec064[_0x4794('0x4b')]===_0x4794('0x4c')){var _0xf39aa4=_0x452fb8[_0x4794('0x22')]({'plain':!![]});var _0x4ce262=_0x4794('0x23');return db[_0x4794('0x4d')][_0x4794('0x4e')]({'where':{'name':_0x4ce262,'userProfileId':_0xbec064[_0x4794('0x4f')]},'raw':!![]})[_0x4794('0x20')](function(_0x98c347){if(_0x98c347&&_0x98c347['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xf39aa4[_0x4794('0x27')],'resourceId':_0xf39aa4['id'],'type':_0x98c347['name'],'sectionId':_0x98c347['id']},{})[_0x4794('0x20')](function(){return _0x452fb8;});}else{return _0x452fb8;}})['catch'](function(_0x2b8499){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b8499);throw _0x2b8499;});}return _0x452fb8;})[_0x4794('0x20')](respondWithResult(_0x8349b3,0xc9))[_0x4794('0x45')](handleError(_0x8349b3,null));};exports[_0x4794('0x1f')]=function(_0x5d2580,_0x5f0880){if(_0x5d2580[_0x4794('0x49')]['id']){delete _0x5d2580[_0x4794('0x49')]['id'];}return db[_0x4794('0x2b')][_0x4794('0x4e')]({'where':{'id':_0x5d2580[_0x4794('0x46')]['id']}})[_0x4794('0x20')](handleEntityNotFound(_0x5f0880,null))['then'](saveUpdates(_0x5d2580[_0x4794('0x49')],null))[_0x4794('0x20')](respondWithResult(_0x5f0880,null))[_0x4794('0x45')](handleError(_0x5f0880,null));};exports[_0x4794('0x21')]=function(_0x1b6e03,_0x3ff9be){return db[_0x4794('0x2b')][_0x4794('0x4e')]({'where':{'id':_0x1b6e03[_0x4794('0x46')]['id']}})[_0x4794('0x20')](handleEntityNotFound(_0x3ff9be,null))[_0x4794('0x20')](removeEntity(_0x3ff9be,null))[_0x4794('0x45')](handleError(_0x3ff9be,null));}; \ No newline at end of file +var _0x28e5=['get','Pauses','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','update','then','destroy'];(function(_0x7e6b22,_0x4116fd){var _0x3f7e2a=function(_0xd26244){while(--_0xd26244){_0x7e6b22['push'](_0x7e6b22['shift']());}};_0x3f7e2a(++_0x4116fd);}(_0x28e5,0x1a6));var _0x528e=function(_0x4ff51a,_0x15de86){_0x4ff51a=_0x4ff51a-0x0;var _0x8646c1=_0x28e5[_0x4ff51a];return _0x8646c1;};'use strict';var pdf=require(_0x528e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x528e('0x1'));var jsonpatch=require(_0x528e('0x2'));var rp=require('request-promise');var moment=require(_0x528e('0x3'));var BPromise=require(_0x528e('0x4'));var Mustache=require(_0x528e('0x5'));var util=require(_0x528e('0x6'));var path=require(_0x528e('0x7'));var sox=require('sox');var csv=require(_0x528e('0x8'));var ejs=require(_0x528e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x528e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x528e('0xb'));var toCsv=require(_0x528e('0x8'));var querystring=require(_0x528e('0xc'));var Papa=require(_0x528e('0xd'));var Redis=require(_0x528e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x528e('0xf'));var as=require(_0x528e('0x10'));var hardwareService=require(_0x528e('0x11'));var logger=require(_0x528e('0x12'))(_0x528e('0x13'));var utils=require('../../config/utils');var config=require(_0x528e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x528e('0x15'))['db'];function respondWithStatusCode(_0x1935bb,_0x549e7a){_0x549e7a=_0x549e7a||0xcc;return function(_0x114d21){if(_0x114d21){return _0x1935bb[_0x528e('0x16')](_0x549e7a);}return _0x1935bb[_0x528e('0x17')](_0x549e7a)[_0x528e('0x18')]();};}function respondWithResult(_0x4ec194,_0xc554f){_0xc554f=_0xc554f||0xc8;return function(_0x2cb351){if(_0x2cb351){return _0x4ec194[_0x528e('0x17')](_0xc554f)[_0x528e('0x19')](_0x2cb351);}};}function respondWithFilteredResult(_0x31d44f,_0x4c72a5){return function(_0x5e1fbe){if(_0x5e1fbe){var _0x2fa85d=_0x5e1fbe[_0x528e('0x1a')],_0x2fe62b=_0x4c72a5[_0x528e('0x1b')],_0x18e0ed=_0x4c72a5[_0x528e('0x1b')]+_0x4c72a5[_0x528e('0x1c')],_0x33af04;if(_0x18e0ed>=_0x2fa85d){_0x18e0ed=_0x2fa85d;_0x33af04=0xc8;}else{_0x33af04=0xce;}_0x31d44f[_0x528e('0x17')](_0x33af04);return _0x31d44f['set']('Content-Range',_0x2fe62b+'-'+_0x18e0ed+'/'+_0x2fa85d)['json'](_0x5e1fbe);}return null;};}function patchUpdates(_0x2fe890){return function(_0x24d8a5){try{jsonpatch[_0x528e('0x1d')](_0x24d8a5,_0x2fe890,!![]);}catch(_0x324f8f){return BPromise[_0x528e('0x1e')](_0x324f8f);}return _0x24d8a5['save']();};}function saveUpdates(_0x2e17cf,_0x59e76e){return function(_0xcf05cb){if(_0xcf05cb){return _0xcf05cb[_0x528e('0x1f')](_0x2e17cf)[_0x528e('0x20')](function(_0x5d7cf1){return _0x5d7cf1;});}return null;};}function removeEntity(_0x1ded39,_0x573144){return function(_0xeac146){if(_0xeac146){return _0xeac146[_0x528e('0x21')]()[_0x528e('0x20')](function(){var _0x60e01=_0xeac146[_0x528e('0x22')]({'plain':!![]});var _0x2fa2c0=_0x528e('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x2fa2c0,'resourceId':_0x60e01['id']}})[_0x528e('0x20')](function(){return _0xeac146;});})['then'](function(){_0x1ded39[_0x528e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15ceba,_0x82b734){return function(_0x59eb82){if(!_0x59eb82){_0x15ceba[_0x528e('0x16')](0x194);}return _0x59eb82;};}function handleError(_0x54a16a,_0x4db05f){_0x4db05f=_0x4db05f||0x1f4;return function(_0x21e916){logger[_0x528e('0x24')](_0x21e916[_0x528e('0x25')]);if(_0x21e916[_0x528e('0x26')]){delete _0x21e916[_0x528e('0x26')];}_0x54a16a['status'](_0x4db05f)[_0x528e('0x27')](_0x21e916);};}exports[_0x528e('0x28')]=function(_0x4159ea,_0x3f9ce6){var _0x2a217d={},_0x27a3d3={},_0x33b543={'count':0x0,'rows':[]};var _0x41402d=_[_0x528e('0x29')](db[_0x528e('0x2a')][_0x528e('0x2b')],function(_0x4720ff){return{'name':_0x4720ff[_0x528e('0x2c')],'type':_0x4720ff[_0x528e('0x2d')][_0x528e('0x2e')]};});_0x27a3d3[_0x528e('0x2f')]=_['map'](_0x41402d,_0x528e('0x26'));_0x27a3d3['query']=_['keys'](_0x4159ea[_0x528e('0x30')]);_0x27a3d3[_0x528e('0x31')]=_[_0x528e('0x32')](_0x27a3d3[_0x528e('0x2f')],_0x27a3d3[_0x528e('0x30')]);_0x2a217d[_0x528e('0x33')]=_['intersection'](_0x27a3d3[_0x528e('0x2f')],qs['fields'](_0x4159ea['query'][_0x528e('0x34')]));_0x2a217d[_0x528e('0x33')]=_0x2a217d['attributes'][_0x528e('0x35')]?_0x2a217d['attributes']:_0x27a3d3[_0x528e('0x2f')];if(!_0x4159ea['query'][_0x528e('0x36')]('nolimit')){_0x2a217d[_0x528e('0x1c')]=qs[_0x528e('0x1c')](_0x4159ea[_0x528e('0x30')]['limit']);_0x2a217d[_0x528e('0x1b')]=qs[_0x528e('0x1b')](_0x4159ea[_0x528e('0x30')][_0x528e('0x1b')]);}_0x2a217d[_0x528e('0x37')]=qs[_0x528e('0x38')](_0x4159ea['query'][_0x528e('0x38')]);_0x2a217d[_0x528e('0x39')]=qs[_0x528e('0x31')](_[_0x528e('0x3a')](_0x4159ea[_0x528e('0x30')],_0x27a3d3[_0x528e('0x31')]),_0x41402d);if(_0x4159ea['query']['filter']){_0x2a217d[_0x528e('0x39')]=_[_0x528e('0x3b')](_0x2a217d[_0x528e('0x39')],{'$or':_[_0x528e('0x29')](_0x41402d,function(_0x4a05b4){if(_0x4a05b4['type']!==_0x528e('0x3c')){var _0xd4de7a={};_0xd4de7a[_0x4a05b4[_0x528e('0x26')]]={'$like':'%'+_0x4159ea[_0x528e('0x30')][_0x528e('0x3d')]+'%'};return _0xd4de7a;}})});}_0x2a217d=_[_0x528e('0x3b')]({},_0x2a217d,_0x4159ea['options']);var _0x515526={'where':_0x2a217d[_0x528e('0x39')]};return db[_0x528e('0x2a')][_0x528e('0x1a')](_0x515526)[_0x528e('0x20')](function(_0x3a1629){_0x33b543[_0x528e('0x1a')]=_0x3a1629;if(_0x4159ea[_0x528e('0x30')][_0x528e('0x3e')]){_0x2a217d[_0x528e('0x3f')]=[{'all':!![]}];}return db[_0x528e('0x2a')]['findAll'](_0x2a217d);})[_0x528e('0x20')](function(_0x1b434d){_0x33b543['rows']=_0x1b434d;return _0x33b543;})[_0x528e('0x20')](respondWithFilteredResult(_0x3f9ce6,_0x2a217d))[_0x528e('0x40')](handleError(_0x3f9ce6,null));};exports['show']=function(_0x16f251,_0x6cbc63){var _0x5f2d1c={'raw':!![],'where':{'id':_0x16f251[_0x528e('0x41')]['id']}},_0x2157e1={};_0x2157e1[_0x528e('0x2f')]=_['keys'](db[_0x528e('0x2a')]['rawAttributes']);_0x2157e1['query']=_['keys'](_0x16f251[_0x528e('0x30')]);_0x2157e1['filters']=_[_0x528e('0x32')](_0x2157e1[_0x528e('0x2f')],_0x2157e1[_0x528e('0x30')]);_0x5f2d1c[_0x528e('0x33')]=_[_0x528e('0x32')](_0x2157e1[_0x528e('0x2f')],qs['fields'](_0x16f251['query'][_0x528e('0x34')]));_0x5f2d1c['attributes']=_0x5f2d1c[_0x528e('0x33')][_0x528e('0x35')]?_0x5f2d1c[_0x528e('0x33')]:_0x2157e1[_0x528e('0x2f')];if(_0x16f251[_0x528e('0x30')]['includeAll']){_0x5f2d1c[_0x528e('0x3f')]=[{'all':!![]}];}_0x5f2d1c=_[_0x528e('0x3b')]({},_0x5f2d1c,_0x16f251[_0x528e('0x42')]);return db[_0x528e('0x2a')][_0x528e('0x43')](_0x5f2d1c)[_0x528e('0x20')](handleEntityNotFound(_0x6cbc63,null))[_0x528e('0x20')](respondWithResult(_0x6cbc63,null))[_0x528e('0x40')](handleError(_0x6cbc63,null));};exports[_0x528e('0x44')]=function(_0x1c0e20,_0x5e065a){return db[_0x528e('0x2a')][_0x528e('0x44')](_0x1c0e20[_0x528e('0x45')],{})[_0x528e('0x20')](function(_0x44f616){var _0x20bd4d=_0x1c0e20['user'][_0x528e('0x22')]({'plain':!![]});if(!_0x20bd4d)throw new Error(_0x528e('0x46'));if(_0x20bd4d[_0x528e('0x47')]===_0x528e('0x48')){var _0x4d4f5d=_0x44f616['get']({'plain':!![]});var _0x2481f0='Pauses';return db[_0x528e('0x49')]['find']({'where':{'name':_0x2481f0,'userProfileId':_0x20bd4d[_0x528e('0x4a')]},'raw':!![]})[_0x528e('0x20')](function(_0x48b98a){if(_0x48b98a&&_0x48b98a['autoAssociation']===0x0){return db[_0x528e('0x4b')][_0x528e('0x44')]({'name':_0x4d4f5d[_0x528e('0x26')],'resourceId':_0x4d4f5d['id'],'type':_0x48b98a[_0x528e('0x26')],'sectionId':_0x48b98a['id']},{})[_0x528e('0x20')](function(){return _0x44f616;});}else{return _0x44f616;}})['catch'](function(_0x1ffcd9){logger[_0x528e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ffcd9);throw _0x1ffcd9;});}return _0x44f616;})[_0x528e('0x20')](respondWithResult(_0x5e065a,0xc9))[_0x528e('0x40')](handleError(_0x5e065a,null));};exports['update']=function(_0x8bdddb,_0x1d92e5){if(_0x8bdddb[_0x528e('0x45')]['id']){delete _0x8bdddb[_0x528e('0x45')]['id'];}return db[_0x528e('0x2a')][_0x528e('0x43')]({'where':{'id':_0x8bdddb['params']['id']}})[_0x528e('0x20')](handleEntityNotFound(_0x1d92e5,null))['then'](saveUpdates(_0x8bdddb[_0x528e('0x45')],null))[_0x528e('0x20')](respondWithResult(_0x1d92e5,null))[_0x528e('0x40')](handleError(_0x1d92e5,null));};exports[_0x528e('0x21')]=function(_0x1ae267,_0x28290e){return db['Pause'][_0x528e('0x43')]({'where':{'id':_0x1ae267[_0x528e('0x41')]['id']}})[_0x528e('0x20')](handleEntityNotFound(_0x28290e,null))[_0x528e('0x20')](removeEntity(_0x28290e,null))[_0x528e('0x40')](handleError(_0x28290e,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 0969067..c91387c 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 _0x566f=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util'];(function(_0x46c8e1,_0x2e1733){var _0x421f93=function(_0x35ba56){while(--_0x35ba56){_0x46c8e1['push'](_0x46c8e1['shift']());}};_0x421f93(++_0x2e1733);}(_0x566f,0x124));var _0xf566=function(_0x34a0f7,_0x252853){_0x34a0f7=_0x34a0f7-0x0;var _0x35da78=_0x566f[_0x34a0f7];return _0x35da78;};'use strict';var _=require(_0xf566('0x0'));var util=require(_0xf566('0x1'));var logger=require(_0xf566('0x2'))(_0xf566('0x3'));var moment=require(_0xf566('0x4'));var BPromise=require(_0xf566('0x5'));var rp=require(_0xf566('0x6'));var fs=require('fs');var path=require(_0xf566('0x7'));var rimraf=require('rimraf');var config=require(_0xf566('0x8'));var attributes=require(_0xf566('0x9'));module[_0xf566('0xa')]=function(_0x117398,_0x5898ea){return _0x117398[_0xf566('0xb')](_0xf566('0xc'),attributes,{'tableName':_0xf566('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d11=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','define','Pause'];(function(_0x28e2cd,_0x153b42){var _0x11fd46=function(_0x50df13){while(--_0x50df13){_0x28e2cd['push'](_0x28e2cd['shift']());}};_0x11fd46(++_0x153b42);}(_0x1d11,0xb6));var _0x11d1=function(_0x3504a6,_0x49e159){_0x3504a6=_0x3504a6-0x0;var _0x3a035c=_0x1d11[_0x3504a6];return _0x3a035c;};'use strict';var _=require(_0x11d1('0x0'));var util=require(_0x11d1('0x1'));var logger=require(_0x11d1('0x2'))(_0x11d1('0x3'));var moment=require(_0x11d1('0x4'));var BPromise=require(_0x11d1('0x5'));var rp=require(_0x11d1('0x6'));var fs=require('fs');var path=require(_0x11d1('0x7'));var rimraf=require(_0x11d1('0x8'));var config=require(_0x11d1('0x9'));var attributes=require(_0x11d1('0xa'));module['exports']=function(_0x32d808,_0x4a9622){return _0x32d808[_0x11d1('0xb')](_0x11d1('0xc'),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 d5c2708..68eeef7 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 _0x9c64=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','ShowPause','Pause','find','options','where','include','map','model','attributes','catch','util'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x9c64,0x16a));var _0x49c6=function(_0x31af4e,_0x589a8b){_0x31af4e=_0x31af4e-0x0;var _0x2b09be=_0x9c64[_0x31af4e];return _0x2b09be;};'use strict';var _=require('lodash');var util=require(_0x49c6('0x0'));var moment=require(_0x49c6('0x1'));var BPromise=require(_0x49c6('0x2'));var rs=require(_0x49c6('0x3'));var fs=require('fs');var Redis=require(_0x49c6('0x4'));var db=require(_0x49c6('0x5'))['db'];var utils=require(_0x49c6('0x6'));var logger=require(_0x49c6('0x7'))(_0x49c6('0x8'));var config=require(_0x49c6('0x9'));var jayson=require(_0x49c6('0xa'));var client=jayson[_0x49c6('0xb')][_0x49c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x194b7f,_0x5e65ed,_0x5b648e){return new BPromise(function(_0x31acfe,_0x129d8a){return client[_0x49c6('0xd')](_0x194b7f,_0x5b648e)[_0x49c6('0xe')](function(_0xc23520){logger[_0x49c6('0xf')](_0x49c6('0x10'),_0x5e65ed,'request\x20sent');logger[_0x49c6('0x11')]('Pause,\x20%s,\x20%s,\x20%s',_0x5e65ed,_0x49c6('0x12'),JSON[_0x49c6('0x13')](_0xc23520));if(_0xc23520[_0x49c6('0x14')]){if(_0xc23520[_0x49c6('0x14')][_0x49c6('0x15')]===0x1f4){logger[_0x49c6('0x14')](_0x49c6('0x10'),_0x5e65ed,_0xc23520[_0x49c6('0x14')][_0x49c6('0x16')]);return _0x129d8a(_0xc23520[_0x49c6('0x14')]['message']);}logger[_0x49c6('0x14')](_0x49c6('0x10'),_0x5e65ed,_0xc23520[_0x49c6('0x14')][_0x49c6('0x16')]);return _0x31acfe(_0xc23520[_0x49c6('0x14')][_0x49c6('0x16')]);}else{logger[_0x49c6('0xf')](_0x49c6('0x10'),_0x5e65ed,_0x49c6('0x12'));_0x31acfe(_0xc23520['result'][_0x49c6('0x16')]);}})['catch'](function(_0x2bafcd){logger[_0x49c6('0x14')](_0x49c6('0x10'),_0x5e65ed,_0x2bafcd);_0x129d8a(_0x2bafcd);});});}exports[_0x49c6('0x17')]=function(_0x1e9e9a){var _0x4bfcfd=this;return new Promise(function(_0x4b4097,_0x413fa2){return db[_0x49c6('0x18')][_0x49c6('0x19')]({'raw':_0x1e9e9a[_0x49c6('0x1a')]?_0x1e9e9a[_0x49c6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1e9e9a[_0x49c6('0x1a')]?_0x1e9e9a['options'][_0x49c6('0x1b')]||null:null,'attributes':_0x1e9e9a[_0x49c6('0x1a')]?_0x1e9e9a[_0x49c6('0x1a')]['attributes']||null:null,'include':_0x1e9e9a[_0x49c6('0x1a')]?_0x1e9e9a[_0x49c6('0x1a')][_0x49c6('0x1c')]?_[_0x49c6('0x1d')](_0x1e9e9a[_0x49c6('0x1a')][_0x49c6('0x1c')],function(_0x3fad4a){return{'model':db[_0x3fad4a[_0x49c6('0x1e')]],'as':_0x3fad4a['as'],'attributes':_0x3fad4a[_0x49c6('0x1f')],'include':_0x3fad4a[_0x49c6('0x1c')]?_['map'](_0x3fad4a[_0x49c6('0x1c')],function(_0x579d1a){return{'model':db[_0x579d1a[_0x49c6('0x1e')]],'as':_0x579d1a['as'],'attributes':_0x579d1a[_0x49c6('0x1f')],'include':_0x579d1a[_0x49c6('0x1c')]?_[_0x49c6('0x1d')](_0x579d1a[_0x49c6('0x1c')],function(_0x173402){return{'model':db[_0x173402[_0x49c6('0x1e')]],'as':_0x173402['as'],'attributes':_0x173402[_0x49c6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x49c6('0xe')](function(_0xe31549){logger[_0x49c6('0xf')](_0x49c6('0x17'),_0x1e9e9a);logger[_0x49c6('0x11')](_0x49c6('0x17'),_0x1e9e9a,JSON['stringify'](_0xe31549));_0x4b4097(_0xe31549);})[_0x49c6('0x20')](function(_0xcecbd2){logger['error']('ShowPause',_0xcecbd2[_0x49c6('0x16')],_0x1e9e9a);_0x413fa2(_0x4bfcfd[_0x49c6('0x14')](0x1f4,_0xcecbd2[_0x49c6('0x16')]));});});}; \ No newline at end of file +var _0xe7a5=['catch','ShowPause','Pause','find','options','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4a6065,_0x2333b8){var _0x1619e1=function(_0x7e0fab){while(--_0x7e0fab){_0x4a6065['push'](_0x4a6065['shift']());}};_0x1619e1(++_0x2333b8);}(_0xe7a5,0xe4));var _0x5e7a=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xe7a5[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x5e7a('0x0'));var util=require(_0x5e7a('0x1'));var moment=require(_0x5e7a('0x2'));var BPromise=require(_0x5e7a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e7a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5e7a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5e7a('0x6'));var client=jayson[_0x5e7a('0x7')][_0x5e7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58edde,_0x1c9607,_0x15a5dd){return new BPromise(function(_0x5444f6,_0x319a48){return client[_0x5e7a('0x9')](_0x58edde,_0x15a5dd)[_0x5e7a('0xa')](function(_0x1ad75a){logger[_0x5e7a('0xb')](_0x5e7a('0xc'),_0x1c9607,_0x5e7a('0xd'));logger[_0x5e7a('0xe')](_0x5e7a('0xf'),_0x1c9607,_0x5e7a('0xd'),JSON['stringify'](_0x1ad75a));if(_0x1ad75a[_0x5e7a('0x10')]){if(_0x1ad75a[_0x5e7a('0x10')][_0x5e7a('0x11')]===0x1f4){logger[_0x5e7a('0x10')](_0x5e7a('0xc'),_0x1c9607,_0x1ad75a[_0x5e7a('0x10')][_0x5e7a('0x12')]);return _0x319a48(_0x1ad75a[_0x5e7a('0x10')][_0x5e7a('0x12')]);}logger[_0x5e7a('0x10')](_0x5e7a('0xc'),_0x1c9607,_0x1ad75a[_0x5e7a('0x10')][_0x5e7a('0x12')]);return _0x5444f6(_0x1ad75a[_0x5e7a('0x10')][_0x5e7a('0x12')]);}else{logger[_0x5e7a('0xb')](_0x5e7a('0xc'),_0x1c9607,'request\x20sent');_0x5444f6(_0x1ad75a[_0x5e7a('0x13')][_0x5e7a('0x12')]);}})[_0x5e7a('0x14')](function(_0x1babcc){logger[_0x5e7a('0x10')](_0x5e7a('0xc'),_0x1c9607,_0x1babcc);_0x319a48(_0x1babcc);});});}exports[_0x5e7a('0x15')]=function(_0xe3a873){var _0x1825c5=this;return new Promise(function(_0x578eee,_0x35a872){return db[_0x5e7a('0x16')][_0x5e7a('0x17')]({'raw':_0xe3a873[_0x5e7a('0x18')]?_0xe3a873[_0x5e7a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xe3a873['options']?_0xe3a873[_0x5e7a('0x18')][_0x5e7a('0x19')]||null:null,'attributes':_0xe3a873[_0x5e7a('0x18')]?_0xe3a873[_0x5e7a('0x18')][_0x5e7a('0x1a')]||null:null,'include':_0xe3a873[_0x5e7a('0x18')]?_0xe3a873[_0x5e7a('0x18')][_0x5e7a('0x1b')]?_[_0x5e7a('0x1c')](_0xe3a873[_0x5e7a('0x18')][_0x5e7a('0x1b')],function(_0x32255a){return{'model':db[_0x32255a[_0x5e7a('0x1d')]],'as':_0x32255a['as'],'attributes':_0x32255a[_0x5e7a('0x1a')],'include':_0x32255a['include']?_['map'](_0x32255a['include'],function(_0x41ff43){return{'model':db[_0x41ff43[_0x5e7a('0x1d')]],'as':_0x41ff43['as'],'attributes':_0x41ff43[_0x5e7a('0x1a')],'include':_0x41ff43[_0x5e7a('0x1b')]?_['map'](_0x41ff43[_0x5e7a('0x1b')],function(_0x54a51c){return{'model':db[_0x54a51c[_0x5e7a('0x1d')]],'as':_0x54a51c['as'],'attributes':_0x54a51c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e7a('0xa')](function(_0x4a7cb3){logger[_0x5e7a('0xb')]('ShowPause',_0xe3a873);logger[_0x5e7a('0xe')](_0x5e7a('0x15'),_0xe3a873,JSON[_0x5e7a('0x1e')](_0x4a7cb3));_0x578eee(_0x4a7cb3);})['catch'](function(_0x37c046){logger[_0x5e7a('0x10')](_0x5e7a('0x15'),_0x37c046[_0x5e7a('0x12')],_0xe3a873);_0x35a872(_0x1825c5[_0x5e7a('0x10')](0x1f4,_0x37c046[_0x5e7a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d72f9fd..a406d26 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 _0xea59=['file','webhookPost','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','root','originalname','replace','format','%s-%s%s','basename','extname','now','post'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xea59,0x159));var _0x9ea5=function(_0x525869,_0x5a3a44){_0x525869=_0x525869-0x0;var _0x166a73=_0xea59[_0x525869];return _0x166a73;};'use strict';var multer=require('multer');var util=require(_0x9ea5('0x0'));var path=require(_0x9ea5('0x1'));var timeout=require(_0x9ea5('0x2'));var express=require(_0x9ea5('0x3'));var router=express[_0x9ea5('0x4')]();var auth=require(_0x9ea5('0x5'));var interaction=require(_0x9ea5('0x6'));var config=require(_0x9ea5('0x7'));var controller=require(_0x9ea5('0x8'));router[_0x9ea5('0x9')]('/',auth[_0x9ea5('0xa')](),controller[_0x9ea5('0xb')]);router[_0x9ea5('0x9')](_0x9ea5('0xc'),controller[_0x9ea5('0xd')]);router[_0x9ea5('0x9')](_0x9ea5('0xe'),auth[_0x9ea5('0xa')](),controller[_0x9ea5('0xf')]);router[_0x9ea5('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x9ea5('0x10')]);var upload=multer({'storage':multer[_0x9ea5('0x11')]({'destination':function(_0x1cfaf5,_0x2194f1,_0x3d0652){_0x3d0652(null,path['join'](config[_0x9ea5('0x12')],'server/files/plugins'));},'filename':function(_0x3c59b1,_0x30ef49,_0x25a818){_0x30ef49[_0x9ea5('0x13')]=_0x30ef49[_0x9ea5('0x13')][_0x9ea5('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x25a818(null,util[_0x9ea5('0x15')](_0x9ea5('0x16'),path[_0x9ea5('0x17')](_0x30ef49[_0x9ea5('0x13')],path[_0x9ea5('0x18')](_0x30ef49[_0x9ea5('0x13')])),Date[_0x9ea5('0x19')](),path[_0x9ea5('0x18')](_0x30ef49[_0x9ea5('0x13')])));}})});router[_0x9ea5('0x1a')]('/',upload['single'](_0x9ea5('0x1b')),controller['upload']);router[_0x9ea5('0x1a')]('/webhook',controller[_0x9ea5('0x1c')]);router['put'](_0x9ea5('0xe'),auth[_0x9ea5('0xa')](),controller['update']);router[_0x9ea5('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x9ea5('0x1d')]);module[_0x9ea5('0x1e')]=router; \ No newline at end of file +var _0x258f=['webhookGet','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','extname','now','post','single','webhookPost','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook'];(function(_0x4b36df,_0x346c32){var _0x4246f5=function(_0xb42f39){while(--_0xb42f39){_0x4b36df['push'](_0x4b36df['shift']());}};_0x4246f5(++_0x346c32);}(_0x258f,0x160));var _0xf258=function(_0x4c31c2,_0x2befb6){_0x4c31c2=_0x4c31c2-0x0;var _0x4357f9=_0x258f[_0x4c31c2];return _0x4357f9;};'use strict';var multer=require(_0xf258('0x0'));var util=require(_0xf258('0x1'));var path=require('path');var timeout=require(_0xf258('0x2'));var express=require(_0xf258('0x3'));var router=express['Router']();var auth=require(_0xf258('0x4'));var interaction=require(_0xf258('0x5'));var config=require(_0xf258('0x6'));var controller=require(_0xf258('0x7'));router[_0xf258('0x8')]('/',auth['isAuthenticated'](),controller[_0xf258('0x9')]);router[_0xf258('0x8')](_0xf258('0xa'),controller[_0xf258('0xb')]);router['get'](_0xf258('0xc'),auth[_0xf258('0xd')](),controller[_0xf258('0xe')]);router[_0xf258('0x8')](_0xf258('0xf'),auth[_0xf258('0xd')](),controller['download']);var upload=multer({'storage':multer[_0xf258('0x10')]({'destination':function(_0xef3958,_0x5d3ce4,_0x2ae0dd){_0x2ae0dd(null,path[_0xf258('0x11')](config[_0xf258('0x12')],_0xf258('0x13')));},'filename':function(_0x4abc2e,_0x5b4260,_0x247bec){_0x5b4260[_0xf258('0x14')]=_0x5b4260[_0xf258('0x14')][_0xf258('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x247bec(null,util[_0xf258('0x16')]('%s-%s%s',path[_0xf258('0x17')](_0x5b4260[_0xf258('0x14')],path[_0xf258('0x18')](_0x5b4260['originalname'])),Date[_0xf258('0x19')](),path[_0xf258('0x18')](_0x5b4260[_0xf258('0x14')])));}})});router[_0xf258('0x1a')]('/',upload[_0xf258('0x1b')]('file'),controller['upload']);router[_0xf258('0x1a')]('/webhook',controller[_0xf258('0x1c')]);router[_0xf258('0x1d')](_0xf258('0xc'),auth['isAuthenticated'](),controller[_0xf258('0x1e')]);router['delete'](_0xf258('0xc'),auth[_0xf258('0xd')](),controller[_0xf258('0x1f')]);module[_0xf258('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d2b39be..1c3239b 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 _0xe29e=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always'];(function(_0x5392e9,_0x50d300){var _0x5dc637=function(_0x30592c){while(--_0x30592c){_0x5392e9['push'](_0x5392e9['shift']());}};_0x5dc637(++_0x50d300);}(_0xe29e,0x188));var _0xee29=function(_0x50faad,_0x1c6f98){_0x50faad=_0x50faad-0x0;var _0xb70b63=_0xe29e[_0x50faad];return _0xb70b63;};'use strict';var Sequelize=require('sequelize');module[_0xee29('0x0')]={'name':{'type':Sequelize[_0xee29('0x1')]},'type':{'type':Sequelize[_0xee29('0x2')](_0xee29('0x3'),_0xee29('0x4'))},'description':{'type':Sequelize[_0xee29('0x5')]},'version':{'type':Sequelize[_0xee29('0x5')]},'path':{'type':Sequelize[_0xee29('0x1')],'comment':_0xee29('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xee29('0x7')},'sidebar':{'type':Sequelize[_0xee29('0x2')](_0xee29('0x8'),_0xee29('0x9'),_0xee29('0xa'),_0xee29('0xb')),'defaultValue':_0xee29('0xa'),'comment':_0xee29('0xc')},'icon':{'type':Sequelize[_0xee29('0x1')]},'adminUrl':{'type':Sequelize[_0xee29('0x1')]},'agentUrl':{'type':Sequelize[_0xee29('0x1')]},'scriptName':{'type':Sequelize[_0xee29('0x1')]},'scriptPath':{'type':Sequelize[_0xee29('0x1')]}}; \ No newline at end of file +var _0x9b65=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly'];(function(_0xc5f065,_0x59e711){var _0x67d9a=function(_0x3ade8f){while(--_0x3ade8f){_0xc5f065['push'](_0xc5f065['shift']());}};_0x67d9a(++_0x59e711);}(_0x9b65,0x1d2));var _0x59b6=function(_0x38f0e8,_0x266286){_0x38f0e8=_0x38f0e8-0x0;var _0x25a453=_0x9b65[_0x38f0e8];return _0x25a453;};'use strict';var Sequelize=require(_0x59b6('0x0'));module[_0x59b6('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x59b6('0x2')](_0x59b6('0x3'),_0x59b6('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x59b6('0x5')]},'path':{'type':Sequelize[_0x59b6('0x6')],'comment':_0x59b6('0x7')},'active':{'type':Sequelize[_0x59b6('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x59b6('0x2')](_0x59b6('0x9'),_0x59b6('0xa'),_0x59b6('0xb'),_0x59b6('0xc')),'defaultValue':_0x59b6('0xb'),'comment':_0x59b6('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x59b6('0x6')]},'agentUrl':{'type':Sequelize[_0x59b6('0x6')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x59b6('0x6')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index c3f76c4..cb4c0a8 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 _0x069c=['server/files/plugins','format','zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','root','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','extract-zip','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Plugins','UserProfileResource','end','error','name','send','index','Plugin','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','rawAttributes','includeAll','options','find','catch','download','join'];(function(_0x4f4421,_0x5ad4e6){var _0x530908=function(_0x41520f){while(--_0x41520f){_0x4f4421['push'](_0x4f4421['shift']());}};_0x530908(++_0x5ad4e6);}(_0x069c,0x107));var _0xc069=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x069c[_0x382e89];return _0x3a1318;};'use strict';var pdf=require(_0xc069('0x0'));var emlformat=require(_0xc069('0x1'));var rimraf=require(_0xc069('0x2'));var zipdir=require(_0xc069('0x3'));var jsonpatch=require(_0xc069('0x4'));var rp=require('request-promise');var moment=require(_0xc069('0x5'));var BPromise=require(_0xc069('0x6'));var Mustache=require(_0xc069('0x7'));var util=require(_0xc069('0x8'));var path=require(_0xc069('0x9'));var sox=require(_0xc069('0xa'));var csv=require(_0xc069('0xb'));var ejs=require(_0xc069('0xc'));var fs=require('fs');var _=require(_0xc069('0xd'));var squel=require(_0xc069('0xe'));var crypto=require('crypto');var jsforce=require(_0xc069('0xf'));var deskjs=require(_0xc069('0x10'));var toCsv=require(_0xc069('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xc069('0x11'));var rimraf=require(_0xc069('0x2'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xc069('0x12'));var qs=require(_0xc069('0x13'));var as=require(_0xc069('0x14'));var hardwareService=require(_0xc069('0x15'));var logger=require('../../config/logger')(_0xc069('0x16'));var utils=require(_0xc069('0x17'));var config=require(_0xc069('0x18'));var licenseUtil=require(_0xc069('0x19'));var db=require(_0xc069('0x1a'))['db'];config[_0xc069('0x1b')]=_[_0xc069('0x1c')](config[_0xc069('0x1b')],{'host':_0xc069('0x1d'),'port':0x18eb});var socket=require(_0xc069('0x1e'))(new Redis(config[_0xc069('0x1b')]));require('./plugin.socket')[_0xc069('0x1f')](socket);function respondWithStatusCode(_0x2b5342,_0x93597){_0x93597=_0x93597||0xcc;return function(_0x85e7e1){if(_0x85e7e1){return _0x2b5342[_0xc069('0x20')](_0x93597);}return _0x2b5342['status'](_0x93597)['end']();};}function respondWithResult(_0xa8e53e,_0x1c0bf0){_0x1c0bf0=_0x1c0bf0||0xc8;return function(_0x55b3d3){if(_0x55b3d3){return _0xa8e53e[_0xc069('0x21')](_0x1c0bf0)[_0xc069('0x22')](_0x55b3d3);}};}function respondWithFilteredResult(_0x1358c0,_0x590ce8){return function(_0x587594){if(_0x587594){var _0xce8587=_0x587594[_0xc069('0x23')],_0x3f4792=_0x590ce8[_0xc069('0x24')],_0x5ca8c4=_0x590ce8[_0xc069('0x24')]+_0x590ce8[_0xc069('0x25')],_0x33cfde;if(_0x5ca8c4>=_0xce8587){_0x5ca8c4=_0xce8587;_0x33cfde=0xc8;}else{_0x33cfde=0xce;}_0x1358c0[_0xc069('0x21')](_0x33cfde);return _0x1358c0[_0xc069('0x26')](_0xc069('0x27'),_0x3f4792+'-'+_0x5ca8c4+'/'+_0xce8587)['json'](_0x587594);}return null;};}function patchUpdates(_0x10baac){return function(_0x1dacd0){try{jsonpatch[_0xc069('0x28')](_0x1dacd0,_0x10baac,!![]);}catch(_0x3eb1f7){return BPromise[_0xc069('0x29')](_0x3eb1f7);}return _0x1dacd0[_0xc069('0x2a')]();};}function saveUpdates(_0xe8c29c,_0x5096d7){return function(_0x1dfa44){if(_0x1dfa44){return _0x1dfa44[_0xc069('0x2b')](_0xe8c29c)[_0xc069('0x2c')](function(_0x4ac9a4){return _0x4ac9a4;});}return null;};}function removeEntity(_0x131e6e,_0x4478aa){return function(_0x629659){if(_0x629659){return _0x629659[_0xc069('0x2d')]()[_0xc069('0x2c')](function(){var _0x5dbc79=_0x629659['get']({'plain':!![]});var _0x33510d=_0xc069('0x2e');return db[_0xc069('0x2f')][_0xc069('0x2d')]({'where':{'type':_0x33510d,'resourceId':_0x5dbc79['id']}})[_0xc069('0x2c')](function(){return _0x629659;});})[_0xc069('0x2c')](function(){_0x131e6e['status'](0xcc)[_0xc069('0x30')]();});}};}function handleEntityNotFound(_0x54db21,_0x2b4932){return function(_0x510097){if(!_0x510097){_0x54db21['sendStatus'](0x194);}return _0x510097;};}function handleError(_0x1a6c4e,_0x55cedd){_0x55cedd=_0x55cedd||0x1f4;return function(_0x4aed2f){logger[_0xc069('0x31')](_0x4aed2f['stack']);if(_0x4aed2f[_0xc069('0x32')]){delete _0x4aed2f['name'];}_0x1a6c4e[_0xc069('0x21')](_0x55cedd)[_0xc069('0x33')](_0x4aed2f);};}exports[_0xc069('0x34')]=function(_0xf646fd,_0x5f3627){var _0x44b779={},_0x2b29b3={},_0x1af4a8={'count':0x0,'rows':[]};var _0x4d8f97=_['map'](db[_0xc069('0x35')]['rawAttributes'],function(_0x5c202a){return{'name':_0x5c202a[_0xc069('0x36')],'type':_0x5c202a['type'][_0xc069('0x37')]};});_0x2b29b3[_0xc069('0x38')]=_[_0xc069('0x39')](_0x4d8f97,_0xc069('0x32'));_0x2b29b3[_0xc069('0x3a')]=_[_0xc069('0x3b')](_0xf646fd[_0xc069('0x3a')]);_0x2b29b3[_0xc069('0x3c')]=_[_0xc069('0x3d')](_0x2b29b3[_0xc069('0x38')],_0x2b29b3[_0xc069('0x3a')]);_0x44b779[_0xc069('0x3e')]=_['intersection'](_0x2b29b3['model'],qs['fields'](_0xf646fd[_0xc069('0x3a')][_0xc069('0x3f')]));_0x44b779['attributes']=_0x44b779[_0xc069('0x3e')][_0xc069('0x40')]?_0x44b779[_0xc069('0x3e')]:_0x2b29b3['model'];if(!_0xf646fd[_0xc069('0x3a')][_0xc069('0x41')](_0xc069('0x42'))){_0x44b779['limit']=qs[_0xc069('0x25')](_0xf646fd[_0xc069('0x3a')][_0xc069('0x25')]);_0x44b779[_0xc069('0x24')]=qs[_0xc069('0x24')](_0xf646fd[_0xc069('0x3a')]['offset']);}_0x44b779[_0xc069('0x43')]=qs[_0xc069('0x44')](_0xf646fd[_0xc069('0x3a')][_0xc069('0x44')]);_0x44b779[_0xc069('0x45')]=qs[_0xc069('0x3c')](_[_0xc069('0x46')](_0xf646fd[_0xc069('0x3a')],_0x2b29b3[_0xc069('0x3c')]),_0x4d8f97);if(_0xf646fd[_0xc069('0x3a')][_0xc069('0x47')]){_0x44b779[_0xc069('0x45')]=_[_0xc069('0x48')](_0x44b779[_0xc069('0x45')],{'$or':_[_0xc069('0x39')](_0x4d8f97,function(_0x4c1a4c){if(_0x4c1a4c[_0xc069('0x49')]!==_0xc069('0x4a')){var _0x3b3d74={};_0x3b3d74[_0x4c1a4c[_0xc069('0x32')]]={'$like':'%'+_0xf646fd[_0xc069('0x3a')][_0xc069('0x47')]+'%'};return _0x3b3d74;}})});}_0x44b779=_[_0xc069('0x48')]({},_0x44b779,_0xf646fd['options']);var _0x2369be={'where':_0x44b779['where']};return db[_0xc069('0x35')]['count'](_0x2369be)[_0xc069('0x2c')](function(_0x1f6a8f){_0x1af4a8[_0xc069('0x23')]=_0x1f6a8f;if(_0xf646fd[_0xc069('0x3a')]['includeAll']){_0x44b779[_0xc069('0x4b')]=[{'all':!![]}];}return db['Plugin'][_0xc069('0x4c')](_0x44b779);})[_0xc069('0x2c')](function(_0xbf205){_0x1af4a8[_0xc069('0x4d')]=_0xbf205;return _0x1af4a8;})[_0xc069('0x2c')](respondWithFilteredResult(_0x5f3627,_0x44b779))['catch'](handleError(_0x5f3627,null));};exports[_0xc069('0x4e')]=function(_0x5de2d3,_0x462f95){var _0x23a295={'raw':!![],'where':{'id':_0x5de2d3[_0xc069('0x4f')]['id']}},_0x57a660={};_0x57a660['model']=_[_0xc069('0x3b')](db[_0xc069('0x35')][_0xc069('0x50')]);_0x57a660['query']=_[_0xc069('0x3b')](_0x5de2d3[_0xc069('0x3a')]);_0x57a660[_0xc069('0x3c')]=_[_0xc069('0x3d')](_0x57a660['model'],_0x57a660[_0xc069('0x3a')]);_0x23a295[_0xc069('0x3e')]=_[_0xc069('0x3d')](_0x57a660['model'],qs['fields'](_0x5de2d3['query'][_0xc069('0x3f')]));_0x23a295[_0xc069('0x3e')]=_0x23a295['attributes'][_0xc069('0x40')]?_0x23a295[_0xc069('0x3e')]:_0x57a660[_0xc069('0x38')];if(_0x5de2d3[_0xc069('0x3a')][_0xc069('0x51')]){_0x23a295['include']=[{'all':!![]}];}_0x23a295=_[_0xc069('0x48')]({},_0x23a295,_0x5de2d3[_0xc069('0x52')]);return db[_0xc069('0x35')][_0xc069('0x53')](_0x23a295)[_0xc069('0x2c')](handleEntityNotFound(_0x462f95,null))['then'](respondWithResult(_0x462f95,null))[_0xc069('0x54')](handleError(_0x462f95,null));};exports[_0xc069('0x55')]=function(_0x4b7bdc,_0x25d433,_0x1b236d){return db[_0xc069('0x35')][_0xc069('0x53')]({'where':{'id':_0x4b7bdc[_0xc069('0x4f')]['id']},'attributes':[_0xc069('0x32'),_0xc069('0x9')],'raw':!![]})[_0xc069('0x2c')](handleEntityNotFound(_0x25d433,null))['then'](function(_0x50fd62){if(_0x50fd62){var _0x215199=path[_0xc069('0x56')](config['root'],_0xc069('0x57'),util[_0xc069('0x58')]('%s.zip',path['basename'](_0x50fd62[_0xc069('0x9')])));var _0xd7bc43=fs['createWriteStream'](_0x215199);var _0x47c26e=archiver(_0xc069('0x59'),{'zlib':{'level':0x9}});_0x47c26e['on']('warning',function(_0x3c1325){if(_0x3c1325[_0xc069('0x5a')]==='ENOENT'){logger[_0xc069('0x31')](_0x3c1325);}else{throw new db[(_0xc069('0x5b'))][(_0xc069('0x5c'))](_0xc069('0x5d'));}});_0x47c26e['on'](_0xc069('0x31'),function(_0x2aa7ce){throw new db[(_0xc069('0x5b'))][(_0xc069('0x5c'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x47c26e[_0xc069('0x5e')](_0xd7bc43);_0x47c26e['glob'](_0xc069('0x5f'),{'cwd':path[_0xc069('0x56')](config['root'],_0xc069('0x57'),path[_0xc069('0x60')](_0x50fd62[_0xc069('0x9')])),'ignore':[path[_0xc069('0x56')](path[_0xc069('0x61')](_0x50fd62[_0xc069('0x9')]),_0xc069('0x62')),path[_0xc069('0x56')](path[_0xc069('0x61')](_0x50fd62[_0xc069('0x9')]),_0xc069('0x63'))],'nodir':!![]})[_0xc069('0x64')]();_0xd7bc43['on'](_0xc069('0x65'),function(){if(!fs[_0xc069('0x66')](_0x215199)){throw new db[(_0xc069('0x5b'))][(_0xc069('0x5c'))]('Plugin\x20not\x20found');}return _0x25d433[_0xc069('0x55')](_0x215199,util['format'](_0xc069('0x67'),path[_0xc069('0x61')](_0x50fd62[_0xc069('0x9')])),function(_0x631b3a){if(_0x631b3a){throw new db['Sequelize'][(_0xc069('0x5c'))](_0xc069('0x68'));}fs[_0xc069('0x69')](_0x215199);logger[_0xc069('0x6a')](_0xc069('0x6b'));logger['info'](_0xc069('0x6c'));});});}return null;})[_0xc069('0x54')](handleError(_0x25d433,null));};exports[_0xc069('0x6d')]=function(_0x2fb072,_0x3d2d1a,_0x1667d0){var _0x462dc3=path[_0xc069('0x61')](_0x2fb072[_0xc069('0x6e')]['filename'],path['extname'](_0x2fb072[_0xc069('0x6e')]['filename']));var _0x3061a5=path['join'](config[_0xc069('0x6f')],_0xc069('0x57'),_0x2fb072[_0xc069('0x6e')][_0xc069('0x70')]);var _0x424e67=path['join'](config[_0xc069('0x6f')],'server/files/plugins',_0x462dc3);logger[_0xc069('0x6a')](_0xc069('0x71'),_0x3061a5);logger['info'](_0xc069('0x72'),_0x424e67);try{fs[_0xc069('0x73')](_0x3061a5,parseInt('0777',0x8));extract(_0x3061a5,{'dir':_0x424e67},function(_0x58a2c5){if(_0x58a2c5){logger['error'](_0x58a2c5);handleError(_0x58a2c5,!![]);};var _0x12c077=fs['readdirSync'](_0x424e67);if(_0x12c077['length']>0x1){removeReferences(_0x3061a5,_0x424e67);logger[_0xc069('0x31')](_0xc069('0x74'));return _0x1667d0(new Error('Invalid\x20plugin\x20structure'));}var _0x507e69=fs['lstatSync'](path[_0xc069('0x56')](_0x424e67,_0x12c077[0x0]));if(_0x507e69[_0xc069('0x75')]()){removeReferences(_0x3061a5,_0x424e67);logger['error'](_0xc069('0x74'));return _0x1667d0(new Error(_0xc069('0x74')));}if(_0x507e69[_0xc069('0x76')]()){var _0x5ee7ab=fs[_0xc069('0x77')](path[_0xc069('0x56')](_0x424e67,_0x12c077[0x0]));if(_0x5ee7ab[_0xc069('0x40')]===0x0){removeReferences(_0x3061a5,_0x424e67);logger[_0xc069('0x31')]('Invalid\x20plugin\x20structure');return _0x1667d0(new Error('Invalid\x20plugin\x20structure'));}var _0x76b575=_0x5ee7ab[_0xc069('0x78')](function(_0x599181){return _0x599181===_0xc069('0x79');});if(!_0x76b575){return _0x1667d0(new Error(_0xc069('0x7a')));}var _0x9a3461=fs[_0xc069('0x7b')](path['join'](_0x424e67,_0x12c077[0x0],_0xc069('0x79')));var _0x72f0c5=JSON[_0xc069('0x7c')](_0x9a3461);if('undefined'==typeof _0x72f0c5['name']){return _0x1667d0(new Error(_0xc069('0x7d')));}if(_0xc069('0x7e')==typeof _0x72f0c5['type']){return _0x1667d0(new Error(_0xc069('0x7f')));}if('undefined'==typeof _0x72f0c5[_0xc069('0x80')]){return _0x1667d0(new Error(_0xc069('0x81')));}if(_0xc069('0x7e')==typeof _0x72f0c5[_0xc069('0x82')]){return _0x1667d0(new Error(_0xc069('0x83')));}if(_0x72f0c5[_0xc069('0x49')]===_0xc069('0x84')){if(_0xc069('0x7e')==typeof _0x72f0c5[_0xc069('0x82')]['views']){return _0x1667d0(new Error(_0xc069('0x85')));}if('undefined'==typeof _0x72f0c5['parameters']['views']['admin']&&'undefined'==typeof _0x72f0c5[_0xc069('0x82')][_0xc069('0x86')][_0xc069('0x87')]){return _0x1667d0(new Error(_0xc069('0x88')));}}else if(_0x72f0c5[_0xc069('0x49')]===_0xc069('0x89')){if(_0xc069('0x7e')==typeof _0x72f0c5[_0xc069('0x82')][_0xc069('0x8a')]){return _0x1667d0(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xc069('0x7e')==typeof _0x72f0c5[_0xc069('0x82')][_0xc069('0x8b')]){return _0x1667d0(new Error(_0xc069('0x8c')));}}else{return _0x1667d0(new Error(_0xc069('0x8d')));}var _0x2433d4=_0x72f0c5['name'];var _0x1ef430=_0x72f0c5[_0xc069('0x8e')];var _0xfd80ce=_0x72f0c5['type'];var _0x3654ec=_0x72f0c5[_0xc069('0x8f')]?_0x72f0c5[_0xc069('0x8f')]:_0xc069('0x90');var _0xab093d=_0x72f0c5[_0xc069('0x91')]?_0x72f0c5[_0xc069('0x91')]:'icon-apps';var _0x577ea5='';var _0x450b69='';var _0x290740='';var _0x53f462='';var _0x2e2762=_0x72f0c5[_0xc069('0x80')];if(_0xfd80ce===_0xc069('0x84')){if(_0xc069('0x7e')!=typeof _0x72f0c5['parameters'][_0xc069('0x86')]['admin']){var _0x1ecaee=_0x72f0c5['parameters'][_0xc069('0x86')][_0xc069('0x92')];if(!/^(f|ht)tps?:\/\//i[_0xc069('0x93')](_0x1ecaee)){_0x577ea5=path[_0xc069('0x56')](_0xc069('0x94'),_0x462dc3,_0x12c077[0x0],_0x1ecaee);}else{_0x577ea5=_0x1ecaee;}}else{logger['info'](_0xc069('0x95'));}if(_0xc069('0x7e')!=typeof _0x72f0c5['parameters'][_0xc069('0x86')]['agent']){var _0x468636=_0x72f0c5[_0xc069('0x82')][_0xc069('0x86')][_0xc069('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xc069('0x93')](_0x468636)){_0x450b69=path[_0xc069('0x56')]('plugins',_0x462dc3,_0x12c077[0x0],_0x468636);}else{_0x450b69=_0x468636;}}else{logger[_0xc069('0x6a')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0xfd80ce===_0xc069('0x89')){_0x290740=_0x72f0c5[_0xc069('0x82')][_0xc069('0x8a')];_0x53f462=_0x72f0c5[_0xc069('0x82')]['scriptPath'];if(_0xc069('0x7e')!=typeof _0x72f0c5[_0xc069('0x82')][_0xc069('0x86')]){if(_0xc069('0x7e')!=typeof _0x72f0c5[_0xc069('0x82')][_0xc069('0x86')][_0xc069('0x92')]){var _0x1ecaee=_0x72f0c5[_0xc069('0x82')][_0xc069('0x86')][_0xc069('0x92')];if(!/^(f|ht)tps?:\/\//i[_0xc069('0x93')](_0x1ecaee)){_0x577ea5=path[_0xc069('0x56')](_0xc069('0x94'),_0x462dc3,_0x12c077[0x0],_0x1ecaee);}else{_0x577ea5=_0x1ecaee;}}if('undefined'!=typeof _0x72f0c5[_0xc069('0x82')][_0xc069('0x86')][_0xc069('0x87')]){var _0x468636=_0x72f0c5[_0xc069('0x82')][_0xc069('0x86')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xc069('0x93')](_0x468636)){_0x450b69=path[_0xc069('0x56')]('plugins',_0x462dc3,_0x12c077[0x0],_0x468636);}else{_0x450b69=_0x468636;}}}}var _0x818e30={'name':_0x2433d4,'description':_0x1ef430,'path':path[_0xc069('0x56')](_0x462dc3,_0x12c077[0x0]),'type':_0xfd80ce,'sidebar':_0x3654ec,'icon':_0xab093d,'adminUrl':_0x577ea5,'agentUrl':_0x450b69,'scriptName':_0x290740,'scriptPath':_0x53f462,'version':_0x2e2762};removeReferences(_0x3061a5,null);return db[_0xc069('0x35')][_0xc069('0x96')](_0x818e30)[_0xc069('0x2c')](function(_0x2c052a){var _0x59f9da={'role':_0x2fb072[_0xc069('0x97')][_0xc069('0x98')],'userProfileId':_0x2fb072[_0xc069('0x97')][_0xc069('0x99')]};if(!_0x59f9da)throw new Error(_0xc069('0x9a'));if(_0x59f9da[_0xc069('0x98')]==='user'){var _0x2836b5=_0x2c052a[_0xc069('0x9b')]({'plain':!![]});return db[_0xc069('0x9c')]['find']({'where':{'name':'Plugins','userProfileId':_0x59f9da[_0xc069('0x99')]},'raw':!![]})['then'](function(_0x221656){if(_0x221656&&_0x221656[_0xc069('0x9d')]===0x0){return db['UserProfileResource']['create']({'name':_0x2836b5[_0xc069('0x32')],'resourceId':_0x2836b5['id'],'type':_0x221656['name'],'sectionId':_0x221656['id']},{})['then'](function(){return _0x2c052a;});}else{return _0x2c052a;}})['catch'](function(_0x50963d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50963d);throw _0x50963d;});}return _0x2c052a;})[_0xc069('0x2c')](respondWithResult(_0x3d2d1a,null))[_0xc069('0x54')](handleError(_0x3d2d1a,null));}});}catch(_0x5834dd){_0x3d2d1a[_0xc069('0x21')](0x1f4)[_0xc069('0x33')](_0x5834dd);}};function removeReferences(_0x231a91,_0x110dcb){try{if(_0x231a91){fs[_0xc069('0x69')](_0x231a91);logger['info'](_0xc069('0x9e'));}if(_0x110dcb){rimraf(_0x110dcb,function(){});logger[_0xc069('0x6a')](_0xc069('0x9f'));}}catch(_0x15458f){logger[_0xc069('0x31')](_0x15458f);}}exports[_0xc069('0x2b')]=function(_0xfbc056,_0x39abbc,_0x519ebe){return db[_0xc069('0x35')][_0xc069('0x53')]({'where':{'id':_0xfbc056['params']['id']}})[_0xc069('0x2c')](handleEntityNotFound(_0x39abbc,null))[_0xc069('0x2c')](saveUpdates(_0xfbc056[_0xc069('0x97')],null))[_0xc069('0x2c')](respondWithResult(_0x39abbc,null))[_0xc069('0x54')](handleError(_0x39abbc,null));};exports[_0xc069('0xa0')]=function(_0x59f949,_0x3d55fb,_0x1d4cee){return db[_0xc069('0x35')][_0xc069('0x53')]({'where':{'id':_0x59f949['params']['id']}})[_0xc069('0x2c')](function(_0x4a4e75){if(_0x4a4e75){return _0x4a4e75[_0xc069('0x2d')]();}})[_0xc069('0x2c')](function(_0x4b41db){rimraf(path[_0xc069('0x56')](config[_0xc069('0x6f')],_0xc069('0x57'),path[_0xc069('0x60')](_0x4b41db['path'])),function(){});return _0x4b41db;})[_0xc069('0x2c')](handleEntityNotFound(_0x3d55fb,null))[_0xc069('0x2c')](respondWithStatusCode(_0x3d55fb,null))[_0xc069('0x54')](handleError(_0x3d55fb,null));};exports[_0xc069('0xa1')]=function(_0x54f62e,_0x6b6a00,_0x3191a2){return BPromise[_0xc069('0xa2')]()[_0xc069('0x2c')](function(){if(!_0x54f62e['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x54f62e[_0xc069('0x3a')][_0xc069('0xa3')]){throw new Error(_0xc069('0xa4'));}var _0x49f0a7=_0x54f62e[_0xc069('0x3a')]['hostname']?_0x54f62e[_0xc069('0x3a')][_0xc069('0xa5')]+':'+_0x54f62e[_0xc069('0x3a')][_0xc069('0xa3')]:_0xc069('0xa6')+_0x54f62e[_0xc069('0x3a')][_0xc069('0xa3')];var _0x1da278=_0x54f62e[_0xc069('0x3a')][_0xc069('0x22')]?_0x54f62e[_0xc069('0x3a')][_0xc069('0x22')]:!![];var _0x2f5d24=_0x54f62e[_0xc069('0x3a')]['encoding']?_0x54f62e[_0xc069('0x3a')][_0xc069('0xa7')]:null;var _0x4cf5ab={'method':_0x54f62e[_0xc069('0xa8')],'uri':util['format'](_0xc069('0xa9'),_0x49f0a7,_0x54f62e[_0xc069('0x3a')][_0xc069('0x9')]),'json':_0x1da278,'resolveWithFullResponse':!![],'encoding':_0x2f5d24,'qs':_0x54f62e[_0xc069('0x3a')]};if(_0x54f62e[_0xc069('0xaa')]){_0x4cf5ab[_0xc069('0xaa')]=_0x54f62e[_0xc069('0xaa')];if(_0x4cf5ab['headers'][_0xc069('0xab')]){delete _0x4cf5ab['headers'][_0xc069('0xab')];}}if(_0x4cf5ab[_0xc069('0xaa')][_0xc069('0xac')]){delete _0x4cf5ab[_0xc069('0xaa')]['content-type'];}return rp(_0x4cf5ab);})['then'](function(_0xe408b4){if(_0xe408b4){_0x6b6a00['set'](_0xe408b4[_0xc069('0xaa')]);logger[_0xc069('0x6a')](_0xe408b4['body']);if(_[_0xc069('0xad')](_0x54f62e[_0xc069('0x3a')][_0xc069('0x9')],_0xc069('0x55'))&&_0xe408b4[_0xc069('0xae')]==0x1f4){return _0x6b6a00[_0xc069('0x20')](_0xe408b4['statusCode']);}else{return _0x6b6a00[_0xc069('0x21')](_0xe408b4[_0xc069('0xae')])[_0xc069('0x33')](_0xe408b4['body']);}}else{return _0x6b6a00['sendStatus'](0xc8);}})[_0xc069('0x54')](handleError(_0x6b6a00,null));};exports['webhookPost']=function(_0x5888b9,_0x190fd4,_0x52fdb5){return BPromise[_0xc069('0xa2')]()[_0xc069('0x2c')](function(){if(!_0x5888b9[_0xc069('0x3a')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5888b9[_0xc069('0x3a')][_0xc069('0xa3')]){throw new Error(_0xc069('0xa4'));}var _0x235ca2=_0x5888b9[_0xc069('0x3a')][_0xc069('0xa5')]?_0x5888b9[_0xc069('0x3a')][_0xc069('0xa5')]+':'+_0x5888b9[_0xc069('0x3a')][_0xc069('0xa3')]:_0xc069('0xa6')+_0x5888b9[_0xc069('0x3a')]['port'];var _0x3be9a8=_0x5888b9[_0xc069('0x3a')][_0xc069('0x22')]?_0x5888b9[_0xc069('0x3a')]['json']:!![];var _0x107a9e=_0x5888b9[_0xc069('0x3a')][_0xc069('0xa7')]?_0x5888b9[_0xc069('0x3a')][_0xc069('0xa7')]:null;var _0x6347a1={'method':_0x5888b9['method'],'uri':util[_0xc069('0x58')](_0xc069('0xa9'),_0x235ca2,_0x5888b9[_0xc069('0x3a')]['path']),'json':_0x3be9a8,'resolveWithFullResponse':!![],'encoding':_0x107a9e,'body':_0x5888b9['body']};if(_0x5888b9['headers']){_0x6347a1[_0xc069('0xaa')]=_0x5888b9[_0xc069('0xaa')];if(_0x6347a1['headers'][_0xc069('0xab')]){delete _0x6347a1[_0xc069('0xaa')][_0xc069('0xab')];}}if(_0x6347a1['headers'][_0xc069('0xac')]){delete _0x6347a1[_0xc069('0xaa')][_0xc069('0xac')];}return rp(_0x6347a1);})['then'](function(_0x32c142){if(_0x32c142){_0x190fd4['set'](_0x32c142[_0xc069('0xaa')]);logger['info'](_0x32c142[_0xc069('0x97')]);return _0x190fd4['status'](_0x32c142[_0xc069('0xae')])['send'](_0x32c142[_0xc069('0x97')]);}else{return _0x190fd4['sendStatus'](0xc8);}})['catch'](handleError(_0x190fd4,null));}; \ No newline at end of file +var _0x8338=['scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','resolve','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','Plugins','UserProfileResource','sendStatus','stack','send','map','rawAttributes','fieldName','key','keys','query','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','VIRTUAL','name','merge','options','Plugin','includeAll','include','findAll','rows','show','params','find','download','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','root','dirname','node_modules/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing'];(function(_0x974307,_0x19d1af){var _0x5bec47=function(_0x19d7a3){while(--_0x19d7a3){_0x974307['push'](_0x974307['shift']());}};_0x5bec47(++_0x19d1af);}(_0x8338,0xd2));var _0x8833=function(_0x36c516,_0x4f9f40){_0x36c516=_0x36c516-0x0;var _0x55a95c=_0x8338[_0x36c516];return _0x55a95c;};'use strict';var pdf=require(_0x8833('0x0'));var emlformat=require(_0x8833('0x1'));var rimraf=require(_0x8833('0x2'));var zipdir=require(_0x8833('0x3'));var jsonpatch=require(_0x8833('0x4'));var rp=require(_0x8833('0x5'));var moment=require(_0x8833('0x6'));var BPromise=require(_0x8833('0x7'));var Mustache=require(_0x8833('0x8'));var util=require('util');var path=require(_0x8833('0x9'));var sox=require(_0x8833('0xa'));var csv=require(_0x8833('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8833('0xc'));var squel=require(_0x8833('0xd'));var crypto=require(_0x8833('0xe'));var jsforce=require(_0x8833('0xf'));var deskjs=require(_0x8833('0x10'));var toCsv=require(_0x8833('0xb'));var querystring=require(_0x8833('0x11'));var Papa=require(_0x8833('0x12'));var extract=require(_0x8833('0x13'));var rimraf=require(_0x8833('0x2'));var archiver=require(_0x8833('0x14'));var Redis=require(_0x8833('0x15'));var authService=require(_0x8833('0x16'));var qs=require(_0x8833('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8833('0x18'));var logger=require(_0x8833('0x19'))(_0x8833('0x1a'));var utils=require(_0x8833('0x1b'));var config=require(_0x8833('0x1c'));var licenseUtil=require(_0x8833('0x1d'));var db=require(_0x8833('0x1e'))['db'];config[_0x8833('0x1f')]=_[_0x8833('0x20')](config[_0x8833('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0x8833('0x21'))(new Redis(config[_0x8833('0x1f')]));require('./plugin.socket')[_0x8833('0x22')](socket);function respondWithStatusCode(_0x42ea05,_0x46bd5){_0x46bd5=_0x46bd5||0xcc;return function(_0x49d33b){if(_0x49d33b){return _0x42ea05['sendStatus'](_0x46bd5);}return _0x42ea05[_0x8833('0x23')](_0x46bd5)[_0x8833('0x24')]();};}function respondWithResult(_0x5a8009,_0x597408){_0x597408=_0x597408||0xc8;return function(_0x5924a1){if(_0x5924a1){return _0x5a8009['status'](_0x597408)[_0x8833('0x25')](_0x5924a1);}};}function respondWithFilteredResult(_0x231fca,_0x390564){return function(_0x4adefa){if(_0x4adefa){var _0x4caa50=_0x4adefa[_0x8833('0x26')],_0x5db36b=_0x390564[_0x8833('0x27')],_0x338db9=_0x390564[_0x8833('0x27')]+_0x390564[_0x8833('0x28')],_0x370719;if(_0x338db9>=_0x4caa50){_0x338db9=_0x4caa50;_0x370719=0xc8;}else{_0x370719=0xce;}_0x231fca[_0x8833('0x23')](_0x370719);return _0x231fca[_0x8833('0x29')](_0x8833('0x2a'),_0x5db36b+'-'+_0x338db9+'/'+_0x4caa50)[_0x8833('0x25')](_0x4adefa);}return null;};}function patchUpdates(_0x192b77){return function(_0x516518){try{jsonpatch[_0x8833('0x2b')](_0x516518,_0x192b77,!![]);}catch(_0x17483e){return BPromise[_0x8833('0x2c')](_0x17483e);}return _0x516518['save']();};}function saveUpdates(_0x39fc2d,_0x32d105){return function(_0x111b3b){if(_0x111b3b){return _0x111b3b[_0x8833('0x2d')](_0x39fc2d)[_0x8833('0x2e')](function(_0x51bebe){return _0x51bebe;});}return null;};}function removeEntity(_0x3f217e,_0x3c6813){return function(_0x48876e){if(_0x48876e){return _0x48876e[_0x8833('0x2f')]()['then'](function(){var _0x53f3ec=_0x48876e['get']({'plain':!![]});var _0x232141=_0x8833('0x30');return db[_0x8833('0x31')]['destroy']({'where':{'type':_0x232141,'resourceId':_0x53f3ec['id']}})[_0x8833('0x2e')](function(){return _0x48876e;});})[_0x8833('0x2e')](function(){_0x3f217e[_0x8833('0x23')](0xcc)[_0x8833('0x24')]();});}};}function handleEntityNotFound(_0x291a39,_0x50435e){return function(_0x18e4d0){if(!_0x18e4d0){_0x291a39[_0x8833('0x32')](0x194);}return _0x18e4d0;};}function handleError(_0x488845,_0x678b9a){_0x678b9a=_0x678b9a||0x1f4;return function(_0x5296a2){logger['error'](_0x5296a2[_0x8833('0x33')]);if(_0x5296a2['name']){delete _0x5296a2['name'];}_0x488845[_0x8833('0x23')](_0x678b9a)[_0x8833('0x34')](_0x5296a2);};}exports['index']=function(_0x2f68da,_0x218232){var _0xa33cfa={},_0x3f0f8c={},_0x3241b7={'count':0x0,'rows':[]};var _0x2753a8=_[_0x8833('0x35')](db['Plugin'][_0x8833('0x36')],function(_0x466da9){return{'name':_0x466da9[_0x8833('0x37')],'type':_0x466da9['type'][_0x8833('0x38')]};});_0x3f0f8c['model']=_[_0x8833('0x35')](_0x2753a8,'name');_0x3f0f8c['query']=_[_0x8833('0x39')](_0x2f68da[_0x8833('0x3a')]);_0x3f0f8c['filters']=_[_0x8833('0x3b')](_0x3f0f8c['model'],_0x3f0f8c[_0x8833('0x3a')]);_0xa33cfa['attributes']=_[_0x8833('0x3b')](_0x3f0f8c['model'],qs[_0x8833('0x3c')](_0x2f68da[_0x8833('0x3a')][_0x8833('0x3c')]));_0xa33cfa[_0x8833('0x3d')]=_0xa33cfa[_0x8833('0x3d')][_0x8833('0x3e')]?_0xa33cfa[_0x8833('0x3d')]:_0x3f0f8c[_0x8833('0x3f')];if(!_0x2f68da[_0x8833('0x3a')][_0x8833('0x40')](_0x8833('0x41'))){_0xa33cfa['limit']=qs[_0x8833('0x28')](_0x2f68da[_0x8833('0x3a')][_0x8833('0x28')]);_0xa33cfa[_0x8833('0x27')]=qs['offset'](_0x2f68da['query'][_0x8833('0x27')]);}_0xa33cfa[_0x8833('0x42')]=qs[_0x8833('0x43')](_0x2f68da['query']['sort']);_0xa33cfa['where']=qs['filters'](_['pick'](_0x2f68da['query'],_0x3f0f8c[_0x8833('0x44')]),_0x2753a8);if(_0x2f68da[_0x8833('0x3a')][_0x8833('0x45')]){_0xa33cfa[_0x8833('0x46')]=_['merge'](_0xa33cfa[_0x8833('0x46')],{'$or':_[_0x8833('0x35')](_0x2753a8,function(_0x100c97){if(_0x100c97[_0x8833('0x47')]!==_0x8833('0x48')){var _0x2544a7={};_0x2544a7[_0x100c97[_0x8833('0x49')]]={'$like':'%'+_0x2f68da[_0x8833('0x3a')]['filter']+'%'};return _0x2544a7;}})});}_0xa33cfa=_[_0x8833('0x4a')]({},_0xa33cfa,_0x2f68da[_0x8833('0x4b')]);var _0xab0951={'where':_0xa33cfa['where']};return db[_0x8833('0x4c')][_0x8833('0x26')](_0xab0951)[_0x8833('0x2e')](function(_0x3a5c8e){_0x3241b7['count']=_0x3a5c8e;if(_0x2f68da[_0x8833('0x3a')][_0x8833('0x4d')]){_0xa33cfa[_0x8833('0x4e')]=[{'all':!![]}];}return db['Plugin'][_0x8833('0x4f')](_0xa33cfa);})['then'](function(_0x407e90){_0x3241b7[_0x8833('0x50')]=_0x407e90;return _0x3241b7;})[_0x8833('0x2e')](respondWithFilteredResult(_0x218232,_0xa33cfa))['catch'](handleError(_0x218232,null));};exports[_0x8833('0x51')]=function(_0x2e2961,_0x48dee){var _0x5b98f7={'raw':!![],'where':{'id':_0x2e2961[_0x8833('0x52')]['id']}},_0x3170b6={};_0x3170b6[_0x8833('0x3f')]=_['keys'](db[_0x8833('0x4c')][_0x8833('0x36')]);_0x3170b6['query']=_[_0x8833('0x39')](_0x2e2961[_0x8833('0x3a')]);_0x3170b6[_0x8833('0x44')]=_[_0x8833('0x3b')](_0x3170b6[_0x8833('0x3f')],_0x3170b6[_0x8833('0x3a')]);_0x5b98f7[_0x8833('0x3d')]=_['intersection'](_0x3170b6[_0x8833('0x3f')],qs['fields'](_0x2e2961['query']['fields']));_0x5b98f7[_0x8833('0x3d')]=_0x5b98f7['attributes']['length']?_0x5b98f7[_0x8833('0x3d')]:_0x3170b6[_0x8833('0x3f')];if(_0x2e2961[_0x8833('0x3a')][_0x8833('0x4d')]){_0x5b98f7['include']=[{'all':!![]}];}_0x5b98f7=_[_0x8833('0x4a')]({},_0x5b98f7,_0x2e2961['options']);return db[_0x8833('0x4c')][_0x8833('0x53')](_0x5b98f7)[_0x8833('0x2e')](handleEntityNotFound(_0x48dee,null))[_0x8833('0x2e')](respondWithResult(_0x48dee,null))['catch'](handleError(_0x48dee,null));};exports[_0x8833('0x54')]=function(_0x899533,_0x55dfaf,_0x370ceb){return db[_0x8833('0x4c')][_0x8833('0x53')]({'where':{'id':_0x899533[_0x8833('0x52')]['id']},'attributes':[_0x8833('0x49'),_0x8833('0x9')],'raw':!![]})['then'](handleEntityNotFound(_0x55dfaf,null))[_0x8833('0x2e')](function(_0x369c1f){if(_0x369c1f){var _0x38f047=path['join'](config['root'],_0x8833('0x55'),util[_0x8833('0x56')](_0x8833('0x57'),path[_0x8833('0x58')](_0x369c1f[_0x8833('0x9')])));var _0x30dd9a=fs[_0x8833('0x59')](_0x38f047);var _0xe7c6b8=archiver('zip',{'zlib':{'level':0x9}});_0xe7c6b8['on'](_0x8833('0x5a'),function(_0xc654c0){if(_0xc654c0[_0x8833('0x5b')]===_0x8833('0x5c')){logger[_0x8833('0x5d')](_0xc654c0);}else{throw new db[(_0x8833('0x5e'))][(_0x8833('0x5f'))](_0x8833('0x60'));}});_0xe7c6b8['on']('error',function(_0x2715aa){throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xe7c6b8[_0x8833('0x61')](_0x30dd9a);_0xe7c6b8[_0x8833('0x62')](_0x8833('0x63'),{'cwd':path[_0x8833('0x64')](config[_0x8833('0x65')],_0x8833('0x55'),path[_0x8833('0x66')](_0x369c1f['path'])),'ignore':[path['join'](path['basename'](_0x369c1f[_0x8833('0x9')]),_0x8833('0x67')),path[_0x8833('0x64')](path['basename'](_0x369c1f['path']),'attachments/**/*')],'nodir':!![]})[_0x8833('0x68')]();_0x30dd9a['on'](_0x8833('0x69'),function(){if(!fs[_0x8833('0x6a')](_0x38f047)){throw new db[(_0x8833('0x5e'))][(_0x8833('0x5f'))]('Plugin\x20not\x20found');}return _0x55dfaf[_0x8833('0x54')](_0x38f047,util[_0x8833('0x56')](_0x8833('0x57'),path[_0x8833('0x58')](_0x369c1f[_0x8833('0x9')])),function(_0x23f0e5){if(_0x23f0e5){throw new db[(_0x8833('0x5e'))]['Error'](_0x8833('0x6b'));}fs[_0x8833('0x6c')](_0x38f047);logger[_0x8833('0x6d')](_0x8833('0x6e'));logger['info'](_0x8833('0x6f'));});});}return null;})[_0x8833('0x70')](handleError(_0x55dfaf,null));};exports[_0x8833('0x71')]=function(_0x2108e2,_0x55bcdb,_0x38d2ba){var _0x1cf741=path[_0x8833('0x58')](_0x2108e2[_0x8833('0x72')][_0x8833('0x73')],path['extname'](_0x2108e2['file'][_0x8833('0x73')]));var _0x743b6b=path[_0x8833('0x64')](config[_0x8833('0x65')],_0x8833('0x55'),_0x2108e2[_0x8833('0x72')][_0x8833('0x73')]);var _0x3f7d19=path[_0x8833('0x64')](config[_0x8833('0x65')],'server/files/plugins',_0x1cf741);logger[_0x8833('0x6d')](_0x8833('0x74'),_0x743b6b);logger[_0x8833('0x6d')]('Plugin\x20upload\x20destination:\x20%s',_0x3f7d19);try{fs[_0x8833('0x75')](_0x743b6b,parseInt(_0x8833('0x76'),0x8));extract(_0x743b6b,{'dir':_0x3f7d19},function(_0x34b4ca){if(_0x34b4ca){logger[_0x8833('0x5d')](_0x34b4ca);handleError(_0x34b4ca,!![]);};var _0x50dc29=fs[_0x8833('0x77')](_0x3f7d19);if(_0x50dc29['length']>0x1){removeReferences(_0x743b6b,_0x3f7d19);logger['error'](_0x8833('0x78'));return _0x38d2ba(new Error('Invalid\x20plugin\x20structure'));}var _0x1b739b=fs[_0x8833('0x79')](path[_0x8833('0x64')](_0x3f7d19,_0x50dc29[0x0]));if(_0x1b739b['isFile']()){removeReferences(_0x743b6b,_0x3f7d19);logger[_0x8833('0x5d')]('Invalid\x20plugin\x20structure');return _0x38d2ba(new Error('Invalid\x20plugin\x20structure'));}if(_0x1b739b[_0x8833('0x7a')]()){var _0xa634d7=fs[_0x8833('0x77')](path['join'](_0x3f7d19,_0x50dc29[0x0]));if(_0xa634d7[_0x8833('0x3e')]===0x0){removeReferences(_0x743b6b,_0x3f7d19);logger[_0x8833('0x5d')](_0x8833('0x78'));return _0x38d2ba(new Error(_0x8833('0x78')));}var _0x2c33b4=_0xa634d7[_0x8833('0x7b')](function(_0x400566){return _0x400566===_0x8833('0x7c');});if(!_0x2c33b4){return _0x38d2ba(new Error(_0x8833('0x7d')));}var _0x45e750=fs[_0x8833('0x7e')](path['join'](_0x3f7d19,_0x50dc29[0x0],_0x8833('0x7c')));var _0x3fb2ed=JSON[_0x8833('0x7f')](_0x45e750);if(_0x8833('0x80')==typeof _0x3fb2ed[_0x8833('0x49')]){return _0x38d2ba(new Error(_0x8833('0x81')));}if(_0x8833('0x80')==typeof _0x3fb2ed[_0x8833('0x47')]){return _0x38d2ba(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x8833('0x80')==typeof _0x3fb2ed['version']){return _0x38d2ba(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x3fb2ed[_0x8833('0x82')]){return _0x38d2ba(new Error(_0x8833('0x83')));}if(_0x3fb2ed[_0x8833('0x47')]==='html'){if(_0x8833('0x80')==typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')]){return _0x38d2ba(new Error(_0x8833('0x85')));}if(_0x8833('0x80')==typeof _0x3fb2ed['parameters'][_0x8833('0x84')][_0x8833('0x86')]&&_0x8833('0x80')==typeof _0x3fb2ed['parameters'][_0x8833('0x84')][_0x8833('0x87')]){return _0x38d2ba(new Error(_0x8833('0x88')));}}else if(_0x3fb2ed['type']===_0x8833('0x89')){if(_0x8833('0x80')==typeof _0x3fb2ed['parameters'][_0x8833('0x8a')]){return _0x38d2ba(new Error(_0x8833('0x8b')));}if(_0x8833('0x80')==typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x8c')]){return _0x38d2ba(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x38d2ba(new Error(_0x8833('0x8d')));}var _0x59e960=_0x3fb2ed[_0x8833('0x49')];var _0x562267=_0x3fb2ed[_0x8833('0x8e')];var _0x3c89f0=_0x3fb2ed['type'];var _0x4386f2=_0x3fb2ed['sidebar']?_0x3fb2ed[_0x8833('0x8f')]:'always';var _0x455aa3=_0x3fb2ed['icon']?_0x3fb2ed[_0x8833('0x90')]:_0x8833('0x91');var _0x56255c='';var _0x57d553='';var _0x2fadcd='';var _0x2d4a5c='';var _0x5efc59=_0x3fb2ed['version'];if(_0x3c89f0==='html'){if(_0x8833('0x80')!=typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')][_0x8833('0x86')]){var _0x1af950=_0x3fb2ed['parameters']['views'][_0x8833('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x8833('0x92')](_0x1af950)){_0x56255c=path[_0x8833('0x64')](_0x8833('0x93'),_0x1cf741,_0x50dc29[0x0],_0x1af950);}else{_0x56255c=_0x1af950;}}else{logger[_0x8833('0x6d')](_0x8833('0x94'));}if('undefined'!=typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')]['agent']){var _0x5246e7=_0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')][_0x8833('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x8833('0x92')](_0x5246e7)){_0x57d553=path[_0x8833('0x64')](_0x8833('0x93'),_0x1cf741,_0x50dc29[0x0],_0x5246e7);}else{_0x57d553=_0x5246e7;}}else{logger[_0x8833('0x6d')](_0x8833('0x95'));}}else if(_0x3c89f0===_0x8833('0x89')){_0x2fadcd=_0x3fb2ed['parameters'][_0x8833('0x8a')];_0x2d4a5c=_0x3fb2ed[_0x8833('0x82')][_0x8833('0x8c')];if(_0x8833('0x80')!=typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')]){if('undefined'!=typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')]['admin']){var _0x1af950=_0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')][_0x8833('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x8833('0x92')](_0x1af950)){_0x56255c=path[_0x8833('0x64')](_0x8833('0x93'),_0x1cf741,_0x50dc29[0x0],_0x1af950);}else{_0x56255c=_0x1af950;}}if(_0x8833('0x80')!=typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')][_0x8833('0x87')]){var _0x5246e7=_0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x8833('0x92')](_0x5246e7)){_0x57d553=path[_0x8833('0x64')](_0x8833('0x93'),_0x1cf741,_0x50dc29[0x0],_0x5246e7);}else{_0x57d553=_0x5246e7;}}}}var _0x398455={'name':_0x59e960,'description':_0x562267,'path':path[_0x8833('0x64')](_0x1cf741,_0x50dc29[0x0]),'type':_0x3c89f0,'sidebar':_0x4386f2,'icon':_0x455aa3,'adminUrl':_0x56255c,'agentUrl':_0x57d553,'scriptName':_0x2fadcd,'scriptPath':_0x2d4a5c,'version':_0x5efc59};removeReferences(_0x743b6b,null);return db[_0x8833('0x4c')][_0x8833('0x96')](_0x398455)[_0x8833('0x2e')](function(_0xe73f5a){var _0x4c692a={'role':_0x2108e2[_0x8833('0x97')][_0x8833('0x98')],'userProfileId':_0x2108e2[_0x8833('0x97')][_0x8833('0x99')]};if(!_0x4c692a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c692a[_0x8833('0x98')]==='user'){var _0x59735b=_0xe73f5a[_0x8833('0x9a')]({'plain':!![]});return db['UserProfileSection'][_0x8833('0x53')]({'where':{'name':'Plugins','userProfileId':_0x4c692a[_0x8833('0x99')]},'raw':!![]})[_0x8833('0x2e')](function(_0x35b281){if(_0x35b281&&_0x35b281[_0x8833('0x9b')]===0x0){return db['UserProfileResource'][_0x8833('0x96')]({'name':_0x59735b[_0x8833('0x49')],'resourceId':_0x59735b['id'],'type':_0x35b281[_0x8833('0x49')],'sectionId':_0x35b281['id']},{})[_0x8833('0x2e')](function(){return _0xe73f5a;});}else{return _0xe73f5a;}})[_0x8833('0x70')](function(_0x1fdcab){logger[_0x8833('0x5d')](_0x8833('0x9c'),_0x1fdcab);throw _0x1fdcab;});}return _0xe73f5a;})[_0x8833('0x2e')](respondWithResult(_0x55bcdb,null))[_0x8833('0x70')](handleError(_0x55bcdb,null));}});}catch(_0x11be53){_0x55bcdb[_0x8833('0x23')](0x1f4)[_0x8833('0x34')](_0x11be53);}};function removeReferences(_0xe72395,_0x33574f){try{if(_0xe72395){fs[_0x8833('0x6c')](_0xe72395);logger[_0x8833('0x6d')](_0x8833('0x9d'));}if(_0x33574f){rimraf(_0x33574f,function(){});logger[_0x8833('0x6d')](_0x8833('0x9e'));}}catch(_0x40e464){logger[_0x8833('0x5d')](_0x40e464);}}exports[_0x8833('0x2d')]=function(_0xe61a12,_0x4455b4,_0x236a10){return db[_0x8833('0x4c')][_0x8833('0x53')]({'where':{'id':_0xe61a12[_0x8833('0x52')]['id']}})[_0x8833('0x2e')](handleEntityNotFound(_0x4455b4,null))[_0x8833('0x2e')](saveUpdates(_0xe61a12[_0x8833('0x97')],null))[_0x8833('0x2e')](respondWithResult(_0x4455b4,null))[_0x8833('0x70')](handleError(_0x4455b4,null));};exports[_0x8833('0x9f')]=function(_0x576a0b,_0x25ac27,_0x23ee61){return db[_0x8833('0x4c')]['find']({'where':{'id':_0x576a0b[_0x8833('0x52')]['id']}})[_0x8833('0x2e')](function(_0x499de3){if(_0x499de3){return _0x499de3[_0x8833('0x2f')]();}})[_0x8833('0x2e')](function(_0x1d1c74){rimraf(path['join'](config[_0x8833('0x65')],_0x8833('0x55'),path[_0x8833('0x66')](_0x1d1c74[_0x8833('0x9')])),function(){});return _0x1d1c74;})[_0x8833('0x2e')](handleEntityNotFound(_0x25ac27,null))[_0x8833('0x2e')](respondWithStatusCode(_0x25ac27,null))['catch'](handleError(_0x25ac27,null));};exports[_0x8833('0xa0')]=function(_0x589c1b,_0x99a763,_0x369aaf){return BPromise['resolve']()[_0x8833('0x2e')](function(){if(!_0x589c1b['query'][_0x8833('0x9')]){throw new Error(_0x8833('0xa1'));}if(!_0x589c1b[_0x8833('0x3a')]['port']){throw new Error(_0x8833('0xa2'));}var _0x4fd8e2=_0x589c1b['query']['hostname']?_0x589c1b[_0x8833('0x3a')][_0x8833('0xa3')]+':'+_0x589c1b[_0x8833('0x3a')][_0x8833('0xa4')]:_0x8833('0xa5')+_0x589c1b['query'][_0x8833('0xa4')];var _0x204144=_0x589c1b[_0x8833('0x3a')]['json']?_0x589c1b[_0x8833('0x3a')]['json']:!![];var _0x17e04e=_0x589c1b[_0x8833('0x3a')][_0x8833('0xa6')]?_0x589c1b['query'][_0x8833('0xa6')]:null;var _0x1052bb={'method':_0x589c1b[_0x8833('0xa7')],'uri':util[_0x8833('0x56')](_0x8833('0xa8'),_0x4fd8e2,_0x589c1b[_0x8833('0x3a')][_0x8833('0x9')]),'json':_0x204144,'resolveWithFullResponse':!![],'encoding':_0x17e04e,'qs':_0x589c1b['query']};if(_0x589c1b[_0x8833('0xa9')]){_0x1052bb['headers']=_0x589c1b[_0x8833('0xa9')];if(_0x1052bb[_0x8833('0xa9')][_0x8833('0xaa')]){delete _0x1052bb['headers'][_0x8833('0xaa')];}}if(_0x1052bb['headers'][_0x8833('0xab')]){delete _0x1052bb[_0x8833('0xa9')][_0x8833('0xab')];}return rp(_0x1052bb);})['then'](function(_0x19c6c8){if(_0x19c6c8){_0x99a763[_0x8833('0x29')](_0x19c6c8['headers']);logger[_0x8833('0x6d')](_0x19c6c8[_0x8833('0x97')]);if(_['endsWith'](_0x589c1b[_0x8833('0x3a')][_0x8833('0x9')],_0x8833('0x54'))&&_0x19c6c8[_0x8833('0xac')]==0x1f4){return _0x99a763[_0x8833('0x32')](_0x19c6c8[_0x8833('0xac')]);}else{return _0x99a763[_0x8833('0x23')](_0x19c6c8[_0x8833('0xac')])[_0x8833('0x34')](_0x19c6c8['body']);}}else{return _0x99a763[_0x8833('0x32')](0xc8);}})[_0x8833('0x70')](handleError(_0x99a763,null));};exports[_0x8833('0xad')]=function(_0xfbef67,_0x29e90e,_0x2933b5){return BPromise[_0x8833('0xae')]()[_0x8833('0x2e')](function(){if(!_0xfbef67[_0x8833('0x3a')][_0x8833('0x9')]){throw new Error(_0x8833('0xa1'));}if(!_0xfbef67[_0x8833('0x3a')][_0x8833('0xa4')]){throw new Error(_0x8833('0xa2'));}var _0x751734=_0xfbef67[_0x8833('0x3a')][_0x8833('0xa3')]?_0xfbef67['query'][_0x8833('0xa3')]+':'+_0xfbef67[_0x8833('0x3a')][_0x8833('0xa4')]:_0x8833('0xa5')+_0xfbef67[_0x8833('0x3a')][_0x8833('0xa4')];var _0x50fc31=_0xfbef67[_0x8833('0x3a')]['json']?_0xfbef67['query']['json']:!![];var _0x42a7ee=_0xfbef67[_0x8833('0x3a')]['encoding']?_0xfbef67[_0x8833('0x3a')][_0x8833('0xa6')]:null;var _0x7cdb9b={'method':_0xfbef67[_0x8833('0xa7')],'uri':util[_0x8833('0x56')](_0x8833('0xa8'),_0x751734,_0xfbef67[_0x8833('0x3a')][_0x8833('0x9')]),'json':_0x50fc31,'resolveWithFullResponse':!![],'encoding':_0x42a7ee,'body':_0xfbef67[_0x8833('0x97')]};if(_0xfbef67[_0x8833('0xa9')]){_0x7cdb9b[_0x8833('0xa9')]=_0xfbef67[_0x8833('0xa9')];if(_0x7cdb9b['headers'][_0x8833('0xaa')]){delete _0x7cdb9b[_0x8833('0xa9')][_0x8833('0xaa')];}}if(_0x7cdb9b[_0x8833('0xa9')][_0x8833('0xab')]){delete _0x7cdb9b[_0x8833('0xa9')][_0x8833('0xab')];}return rp(_0x7cdb9b);})[_0x8833('0x2e')](function(_0xbb448b){if(_0xbb448b){_0x29e90e[_0x8833('0x29')](_0xbb448b[_0x8833('0xa9')]);logger[_0x8833('0x6d')](_0xbb448b['body']);return _0x29e90e['status'](_0xbb448b['statusCode'])['send'](_0xbb448b[_0x8833('0x97')]);}else{return _0x29e90e['sendStatus'](0xc8);}})[_0x8833('0x70')](handleError(_0x29e90e,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 7da6425..94ddc52 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 _0x3266=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3266,0x6a));var _0x6326=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0x3266[_0x3ba924];return _0x4cc1df;};'use strict';var EventEmitter=require(_0x6326('0x0'));var Plugin=require(_0x6326('0x1'))['db'][_0x6326('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6326('0x3')](0x0);var events={'afterCreate':_0x6326('0x4'),'afterUpdate':_0x6326('0x5'),'afterDestroy':_0x6326('0x6')};function emitEvent(_0x365dbf){return function(_0x265264,_0x5a6b4d,_0x30b22e){PluginEvents['emit'](_0x365dbf+':'+_0x265264['id'],_0x265264);PluginEvents[_0x6326('0x7')](_0x365dbf,_0x265264);_0x30b22e(null);};}for(var e in events){if(events[_0x6326('0x8')](e)){var event=events[e];Plugin[_0x6326('0x9')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x98cf51,_0xb7ab54){var _0x4b3e99=function(_0x4c7b5e){while(--_0x4c7b5e){_0x98cf51['push'](_0x98cf51['shift']());}};_0x4b3e99(++_0xb7ab54);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2b59b1,_0x46c17c){_0x2b59b1=_0x2b59b1-0x0;var _0x4a44bb=_0x5f2f[_0x2b59b1];return _0x4a44bb;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Plugin=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){PluginEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);PluginEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Plugin[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index dd39b9f..ee2161a 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 _0x7217=['../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0x7217,0x19e));var _0x7721=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x7217[_0x481bf7];return _0x461787;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d17=['define','plugins','lodash','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x591022,_0x4063aa){var _0xdd803d=function(_0x3031bb){while(--_0x3031bb){_0x591022['push'](_0x591022['shift']());}};_0xdd803d(++_0x4063aa);}(_0x2d17,0x17e));var _0x72d1=function(_0x40308d,_0x5305cb){_0x40308d=_0x40308d-0x0;var _0x326bb9=_0x2d17[_0x40308d];return _0x326bb9;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./plugin.attributes');module[_0x72d1('0x7')]=function(_0x50f551,_0x139ba0){return _0x50f551[_0x72d1('0x8')]('Plugin',attributes,{'tableName':_0x72d1('0x9'),'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 1ae7191..53bc0c1 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 _0x36e9=['stringify','error','message','result','Plugin','create','body','options','raw','CreatePlugin','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x36e9,0x161));var _0x936e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x36e9[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x936e('0x0'));var util=require(_0x936e('0x1'));var moment=require('moment');var BPromise=require(_0x936e('0x2'));var rs=require(_0x936e('0x3'));var fs=require('fs');var Redis=require(_0x936e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x936e('0x5'))(_0x936e('0x6'));var config=require('../../config/environment');var jayson=require(_0x936e('0x7'));var client=jayson[_0x936e('0x8')][_0x936e('0x9')]({'port':0x232a});config['redis']=_[_0x936e('0xa')](config[_0x936e('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x936e('0xb')]));require('./plugin.socket')[_0x936e('0xc')](socket);function respondWithRpcPromise(_0x27a797,_0xf1e697,_0x589993){return new BPromise(function(_0x3553f4,_0x4b24bb){return client[_0x936e('0xd')](_0x27a797,_0x589993)[_0x936e('0xe')](function(_0x17458b){logger[_0x936e('0xf')](_0x936e('0x10'),_0xf1e697,_0x936e('0x11'));logger['debug'](_0x936e('0x12'),_0xf1e697,_0x936e('0x11'),JSON[_0x936e('0x13')](_0x17458b));if(_0x17458b['error']){if(_0x17458b[_0x936e('0x14')]['code']===0x1f4){logger[_0x936e('0x14')]('Plugin,\x20%s,\x20%s',_0xf1e697,_0x17458b[_0x936e('0x14')][_0x936e('0x15')]);return _0x4b24bb(_0x17458b['error'][_0x936e('0x15')]);}logger['error'](_0x936e('0x10'),_0xf1e697,_0x17458b[_0x936e('0x14')][_0x936e('0x15')]);return _0x3553f4(_0x17458b[_0x936e('0x14')][_0x936e('0x15')]);}else{logger['info'](_0x936e('0x10'),_0xf1e697,_0x936e('0x11'));_0x3553f4(_0x17458b[_0x936e('0x16')][_0x936e('0x15')]);}})['catch'](function(_0x354df9){logger[_0x936e('0x14')](_0x936e('0x10'),_0xf1e697,_0x354df9);_0x4b24bb(_0x354df9);});});}exports['CreatePlugin']=function(_0x1a8218){var _0x4e4593=this;return new Promise(function(_0x335559,_0x34980b){return db[_0x936e('0x17')][_0x936e('0x18')](_0x1a8218[_0x936e('0x19')],{'raw':_0x1a8218['options']?_0x1a8218[_0x936e('0x1a')][_0x936e('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3675fb){logger[_0x936e('0xf')](_0x936e('0x1c'),_0x1a8218);logger[_0x936e('0x1d')](_0x936e('0x1c'),_0x1a8218,JSON[_0x936e('0x13')](_0x3675fb));_0x335559(_0x3675fb);})[_0x936e('0x1e')](function(_0x3afc0e){logger[_0x936e('0x14')](_0x936e('0x1c'),_0x3afc0e[_0x936e('0x15')],_0x1a8218);_0x34980b(_0x4e4593['error'](0x1f4,_0x3afc0e[_0x936e('0x15')]));});});}; \ No newline at end of file +var _0xe7c4=['Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreatePlugin','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','info','Plugin,\x20%s,\x20%s','debug'];(function(_0x37ad9e,_0x84649d){var _0x3fb925=function(_0x335e2a){while(--_0x335e2a){_0x37ad9e['push'](_0x37ad9e['shift']());}};_0x3fb925(++_0x84649d);}(_0xe7c4,0x1cb));var _0x4e7c=function(_0x4ac467,_0x31aca6){_0x4ac467=_0x4ac467-0x0;var _0x41fc07=_0xe7c4[_0x4ac467];return _0x41fc07;};'use strict';var _=require(_0x4e7c('0x0'));var util=require(_0x4e7c('0x1'));var moment=require(_0x4e7c('0x2'));var BPromise=require(_0x4e7c('0x3'));var rs=require(_0x4e7c('0x4'));var fs=require('fs');var Redis=require(_0x4e7c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e7c('0x6'));var logger=require('../../config/logger')(_0x4e7c('0x7'));var config=require(_0x4e7c('0x8'));var jayson=require(_0x4e7c('0x9'));var client=jayson[_0x4e7c('0xa')][_0x4e7c('0xb')]({'port':0x232a});config[_0x4e7c('0xc')]=_[_0x4e7c('0xd')](config[_0x4e7c('0xc')],{'host':_0x4e7c('0xe'),'port':0x18eb});var socket=require(_0x4e7c('0xf'))(new Redis(config[_0x4e7c('0xc')]));require(_0x4e7c('0x10'))[_0x4e7c('0x11')](socket);function respondWithRpcPromise(_0x3dcd25,_0x542ce1,_0x38d265){return new BPromise(function(_0x488273,_0x42cb6d){return client['request'](_0x3dcd25,_0x38d265)['then'](function(_0x488f37){logger[_0x4e7c('0x12')](_0x4e7c('0x13'),_0x542ce1,'request\x20sent');logger[_0x4e7c('0x14')](_0x4e7c('0x15'),_0x542ce1,_0x4e7c('0x16'),JSON[_0x4e7c('0x17')](_0x488f37));if(_0x488f37[_0x4e7c('0x18')]){if(_0x488f37[_0x4e7c('0x18')]['code']===0x1f4){logger[_0x4e7c('0x18')](_0x4e7c('0x13'),_0x542ce1,_0x488f37[_0x4e7c('0x18')]['message']);return _0x42cb6d(_0x488f37[_0x4e7c('0x18')]['message']);}logger[_0x4e7c('0x18')](_0x4e7c('0x13'),_0x542ce1,_0x488f37['error'][_0x4e7c('0x19')]);return _0x488273(_0x488f37[_0x4e7c('0x18')][_0x4e7c('0x19')]);}else{logger['info'](_0x4e7c('0x13'),_0x542ce1,'request\x20sent');_0x488273(_0x488f37[_0x4e7c('0x1a')][_0x4e7c('0x19')]);}})['catch'](function(_0x2b398f){logger[_0x4e7c('0x18')](_0x4e7c('0x13'),_0x542ce1,_0x2b398f);_0x42cb6d(_0x2b398f);});});}exports[_0x4e7c('0x1b')]=function(_0x1a874d){var _0x3f9e07=this;return new Promise(function(_0x5452cc,_0x2cc43d){return db['Plugin']['create'](_0x1a874d[_0x4e7c('0x1c')],{'raw':_0x1a874d[_0x4e7c('0x1d')]?_0x1a874d['options'][_0x4e7c('0x1e')]===undefined?!![]:![]:!![]})[_0x4e7c('0x1f')](function(_0x4a0606){logger[_0x4e7c('0x12')]('CreatePlugin',_0x1a874d);logger[_0x4e7c('0x14')](_0x4e7c('0x1b'),_0x1a874d,JSON[_0x4e7c('0x17')](_0x4a0606));_0x5452cc(_0x4a0606);})['catch'](function(_0x405a53){logger[_0x4e7c('0x18')](_0x4e7c('0x1b'),_0x405a53[_0x4e7c('0x19')],_0x1a874d);_0x2cc43d(_0x3f9e07[_0x4e7c('0x18')](0x1f4,_0x405a53[_0x4e7c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index bc346ec..5b8a634 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 _0xe6e4=['update','emit','removeListener','plugin:','./plugin.events','save','remove'];(function(_0xdb472f,_0x4e87cc){var _0x1a11ed=function(_0x481afa){while(--_0x481afa){_0xdb472f['push'](_0xdb472f['shift']());}};_0x1a11ed(++_0x4e87cc);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x5374eb,_0x4e5e18){_0x5374eb=_0x5374eb-0x0;var _0x406a25=_0xe6e4[_0x5374eb];return _0x406a25;};'use strict';var PluginEvents=require(_0x4e6e('0x0'));var events=[_0x4e6e('0x1'),_0x4e6e('0x2'),_0x4e6e('0x3')];function createListener(_0x199682,_0x19360e){return function(_0xa8a187){_0x19360e[_0x4e6e('0x4')](_0x199682,_0xa8a187);};}function removeListener(_0x1745c9,_0x5ddd07){return function(){PluginEvents[_0x4e6e('0x5')](_0x1745c9,_0x5ddd07);};}exports['register']=function(_0x5b7441){for(var _0x3f753a=0x0,_0x474042=events['length'];_0x3f753a<_0x474042;_0x3f753a++){var _0x19d9e9=events[_0x3f753a];var _0x324547=createListener(_0x4e6e('0x6')+_0x19d9e9,_0x5b7441);PluginEvents['on'](_0x19d9e9,_0x324547);}}; \ No newline at end of file +var _0xe6b6=['register','save','remove','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6b6,0x150));var _0x6e6b=function(_0x243f03,_0x413413){_0x243f03=_0x243f03-0x0;var _0x2e327b=_0xe6b6[_0x243f03];return _0x2e327b;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x6e6b('0x0'),_0x6e6b('0x1'),'update'];function createListener(_0x444d9a,_0x4df263){return function(_0x4dc4cd){_0x4df263[_0x6e6b('0x2')](_0x444d9a,_0x4dc4cd);};}function removeListener(_0x4b96f8,_0x377bd0){return function(){PluginEvents[_0x6e6b('0x3')](_0x4b96f8,_0x377bd0);};}exports[_0x6e6b('0x4')]=function(_0x5c0fdc){for(var _0x528f42=0x0,_0x1bb636=events['length'];_0x528f42<_0x1bb636;_0x528f42++){var _0x3d3b77=events[_0x528f42];var _0x506791=createListener('plugin:'+_0x3d3b77,_0x5c0fdc);PluginEvents['on'](_0x3d3b77,_0x506791);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index e38c276..93a0653 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 _0x72f4=['get','isAuthenticated','index','show','post','create','/:id','update','destroy','express','../../components/auth/service','./pm2.controller'];(function(_0x5e8c98,_0xf42c9c){var _0x487a2a=function(_0x3457a1){while(--_0x3457a1){_0x5e8c98['push'](_0x5e8c98['shift']());}};_0x487a2a(++_0xf42c9c);}(_0x72f4,0x1a1));var _0x472f=function(_0x515054,_0xd00cb5){_0x515054=_0x515054-0x0;var _0x17b1de=_0x72f4[_0x515054];return _0x17b1de;};'use strict';var express=require(_0x472f('0x0'));var router=express['Router']();var auth=require(_0x472f('0x1'));var controller=require(_0x472f('0x2'));router[_0x472f('0x3')]('/',auth[_0x472f('0x4')](),controller[_0x472f('0x5')]);router['get']('/:id',auth[_0x472f('0x4')](),controller[_0x472f('0x6')]);router[_0x472f('0x7')]('/',auth[_0x472f('0x4')](),controller[_0x472f('0x8')]);router['put'](_0x472f('0x9'),auth[_0x472f('0x4')](),controller[_0x472f('0xa')]);router['delete'](_0x472f('0x9'),auth[_0x472f('0x4')](),controller[_0x472f('0xb')]);module['exports']=router; \ No newline at end of file +var _0x0d89=['express','Router','./pm2.controller','get','isAuthenticated','/:id','post','create','put','update','delete','exports'];(function(_0x2be920,_0x558694){var _0x2f5ca3=function(_0x504e25){while(--_0x504e25){_0x2be920['push'](_0x2be920['shift']());}};_0x2f5ca3(++_0x558694);}(_0x0d89,0x180));var _0x90d8=function(_0x3e7b5a,_0x4c06fe){_0x3e7b5a=_0x3e7b5a-0x0;var _0x4880aa=_0x0d89[_0x3e7b5a];return _0x4880aa;};'use strict';var express=require(_0x90d8('0x0'));var router=express[_0x90d8('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x90d8('0x2'));router[_0x90d8('0x3')]('/',auth[_0x90d8('0x4')](),controller['index']);router[_0x90d8('0x3')](_0x90d8('0x5'),auth[_0x90d8('0x4')](),controller['show']);router[_0x90d8('0x6')]('/',auth[_0x90d8('0x4')](),controller[_0x90d8('0x7')]);router[_0x90d8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x90d8('0x9')]);router[_0x90d8('0xa')]('/:id',auth[_0x90d8('0x4')](),controller['destroy']);module[_0x90d8('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 106598c..2291cc0 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 _0x2e21=['name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','status','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','json','error','stack'];(function(_0x12ee16,_0xf403cb){var _0x47341a=function(_0x55ed5d){while(--_0x55ed5d){_0x12ee16['push'](_0x12ee16['shift']());}};_0x47341a(++_0xf403cb);}(_0x2e21,0x1ed));var _0x12e2=function(_0x34bc4b,_0x1d829e){_0x34bc4b=_0x34bc4b-0x0;var _0x446fcb=_0x2e21[_0x34bc4b];return _0x446fcb;};'use strict';var _=require(_0x12e2('0x0'));var pm2=require(_0x12e2('0x1'));var logger=require('../../config/logger')(_0x12e2('0x2'));var path=require(_0x12e2('0x3'));var exec=require(_0x12e2('0x4'))[_0x12e2('0x5')];var BPromise=require(_0x12e2('0x6'));function handleEntityNotFound(_0x59b294,_0x2139e2){return function(_0x2c3160){if(!_0x2c3160){_0x59b294[_0x12e2('0x7')](0x194);;}return _0x2c3160;};}function respondWithResult(_0x3d7e9b,_0x4f2d5c){_0x4f2d5c=_0x4f2d5c||0xc8;return function(_0x5b7a69){if(_0x5b7a69){return _0x3d7e9b['status'](_0x4f2d5c)[_0x12e2('0x8')](_0x5b7a69);}return null;};}function handleError(_0x46b700,_0x121389){_0x121389=_0x121389||0x1f4;return function(_0x3a5427){logger[_0x12e2('0x9')](_0x3a5427[_0x12e2('0xa')]);if(_0x3a5427['name']){delete _0x3a5427[_0x12e2('0xb')];}_0x46b700['status'](_0x121389)[_0x12e2('0xc')](_0x3a5427);};}function execChildProcess(){return new BPromise(function(_0x51f320,_0x4d2866){exec(_0x12e2('0xd'),function(_0x28b5e0,_0x49ae05,_0x206f6f){logger[_0x12e2('0xe')](_0x49ae05);logger['info'](_0x206f6f);if(_0x28b5e0){logger['error'](_0x28b5e0);return _0x4d2866(_0x28b5e0);}return _0x51f320(_0x49ae05);});});}exports[_0x12e2('0xf')]=function(_0x180633,_0x5e7668){return pm2[_0x12e2('0x10')]()[_0x12e2('0x11')](function(_0x1b8569){if(_0x1b8569){var _0x12415d=_[_0x12e2('0x12')](_0x1b8569,function(_0x14e9b3){return _0x14e9b3[_0x12e2('0xb')]===_0x12e2('0x13')||_0x14e9b3['name']===_0x12e2('0x14');});return{'rows':_0x12415d,'count':_0x12415d[_0x12e2('0x15')]};}return null;})[_0x12e2('0x11')](respondWithResult(_0x5e7668,null))[_0x12e2('0x16')](handleError(_0x5e7668,null));};exports['show']=function(_0x410c75,_0x260444){return pm2['describe'](_0x410c75[_0x12e2('0x17')]['id'])[_0x12e2('0x11')](respondWithResult(_0x260444,null))[_0x12e2('0x11')](handleEntityNotFound(_0x260444,null))[_0x12e2('0x16')](handleError(_0x260444,null));};exports[_0x12e2('0x18')]=function(_0x5b44b0,_0xf124bd){if(_0x5b44b0[_0x12e2('0x19')][_0x12e2('0xb')]&&_0x5b44b0['body'][_0x12e2('0x1a')]){var _0x284b60=path[_0x12e2('0x1b')](__dirname,_0x12e2('0x1c'),_0x5b44b0[_0x12e2('0x19')][_0x12e2('0x1a')]);var _0x4a3b13=process[_0x12e2('0x1d')]();process[_0x12e2('0x1e')](path[_0x12e2('0x1f')](_0x284b60));return execChildProcess()[_0x12e2('0x11')](function(_0x5e05d8){process[_0x12e2('0x1e')](_0x4a3b13);return pm2[_0x12e2('0x20')]({'name':_0x5b44b0[_0x12e2('0x19')][_0x12e2('0xb')],'script':_0x284b60});})[_0x12e2('0x11')](function(_0x5a50ae){pm2[_0x12e2('0x21')]();return _0x5a50ae[0x0];})[_0x12e2('0x11')](respondWithResult(_0xf124bd,0xc9))['catch'](handleError(_0xf124bd,null));}else{return _0xf124bd[_0x12e2('0x22')](0x1f4)[_0x12e2('0xc')]({'message':_0x12e2('0x23')});}};exports['update']=function(_0x400441,_0x8e49f7){if(_0x400441[_0x12e2('0x19')]['id']){delete _0x400441[_0x12e2('0x19')]['id'];}var _0x37f4b7={'online':_0x12e2('0x24'),'stopped':_0x12e2('0x25')};if(_0x37f4b7[_0x12e2('0x26')](_0x400441[_0x12e2('0x19')][_0x12e2('0x22')])){return pm2[_0x37f4b7[_0x400441['body'][_0x12e2('0x22')]]](_0x400441['params']['id'])[_0x12e2('0x11')](respondWithResult(_0x8e49f7,0xc8))['catch'](handleError(_0x8e49f7,null));}else{return _0x8e49f7[_0x12e2('0x22')](0x1f4)[_0x12e2('0xc')]({'message':_0x12e2('0x27')});}};exports[_0x12e2('0x28')]=function(_0x19605f,_0x28836a){if(_0x19605f['body']['id']){delete _0x19605f[_0x12e2('0x19')]['id'];}if(_0x19605f[_0x12e2('0x17')]['id']){return pm2[_0x12e2('0x29')](_0x19605f[_0x12e2('0x17')]['id'])[_0x12e2('0x11')](function(_0x183e2a){pm2[_0x12e2('0x21')]();return _0x183e2a[0x0];})['then'](respondWithResult(_0x28836a,null))[_0x12e2('0x16')](handleError(_0x28836a,null));}else{return _0x28836a['status'](0x1f4)[_0x12e2('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xa50f=['npm\x20install','info','index','reject','express','motion2','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','start','dump','then','update','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','exec','sendStatus','status','json','error','name','send'];(function(_0x39f9da,_0x3832cd){var _0x2b75cd=function(_0x3a22ef){while(--_0x3a22ef){_0x39f9da['push'](_0x39f9da['shift']());}};_0x2b75cd(++_0x3832cd);}(_0xa50f,0x85));var _0xfa50=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xa50f[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xfa50('0x0'));var pm2=require(_0xfa50('0x1'));var logger=require(_0xfa50('0x2'))('api');var path=require(_0xfa50('0x3'));var exec=require('child_process')[_0xfa50('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x590ed8,_0x56bde3){return function(_0x1f68f0){if(!_0x1f68f0){_0x590ed8[_0xfa50('0x5')](0x194);;}return _0x1f68f0;};}function respondWithResult(_0x3124db,_0x2da7f8){_0x2da7f8=_0x2da7f8||0xc8;return function(_0x281734){if(_0x281734){return _0x3124db[_0xfa50('0x6')](_0x2da7f8)[_0xfa50('0x7')](_0x281734);}return null;};}function handleError(_0x38d8a4,_0x48e08f){_0x48e08f=_0x48e08f||0x1f4;return function(_0x11c605){logger[_0xfa50('0x8')](_0x11c605['stack']);if(_0x11c605['name']){delete _0x11c605[_0xfa50('0x9')];}_0x38d8a4[_0xfa50('0x6')](_0x48e08f)[_0xfa50('0xa')](_0x11c605);};}function execChildProcess(){return new BPromise(function(_0x4e8cf1,_0x1511b3){exec(_0xfa50('0xb'),function(_0x54863f,_0x2ba81b,_0x3077fd){logger[_0xfa50('0xc')](_0x2ba81b);logger[_0xfa50('0xc')](_0x3077fd);if(_0x54863f){logger[_0xfa50('0x8')](_0x54863f);return _0x1511b3(_0x54863f);}return _0x4e8cf1(_0x2ba81b);});});}exports[_0xfa50('0xd')]=function(_0x9452e2,_0x5a8f27){return pm2['list']()['then'](function(_0x31dfe4){if(_0x31dfe4){var _0x473d30=_[_0xfa50('0xe')](_0x31dfe4,function(_0x3056d4){return _0x3056d4['name']===_0xfa50('0xf')||_0x3056d4[_0xfa50('0x9')]===_0xfa50('0x10');});return{'rows':_0x473d30,'count':_0x473d30['length']};}return null;})['then'](respondWithResult(_0x5a8f27,null))[_0xfa50('0x11')](handleError(_0x5a8f27,null));};exports[_0xfa50('0x12')]=function(_0x33d756,_0x425ee6){return pm2[_0xfa50('0x13')](_0x33d756[_0xfa50('0x14')]['id'])['then'](respondWithResult(_0x425ee6,null))['then'](handleEntityNotFound(_0x425ee6,null))[_0xfa50('0x11')](handleError(_0x425ee6,null));};exports['create']=function(_0x99e2a3,_0x31889f){if(_0x99e2a3[_0xfa50('0x15')][_0xfa50('0x9')]&&_0x99e2a3[_0xfa50('0x15')][_0xfa50('0x16')]){var _0x94eb44=path[_0xfa50('0x17')](__dirname,_0xfa50('0x18'),_0x99e2a3['body'][_0xfa50('0x16')]);var _0x1b5a5c=process[_0xfa50('0x19')]();process[_0xfa50('0x1a')](path['dirname'](_0x94eb44));return execChildProcess()['then'](function(_0x4b7e4f){process[_0xfa50('0x1a')](_0x1b5a5c);return pm2[_0xfa50('0x1b')]({'name':_0x99e2a3[_0xfa50('0x15')][_0xfa50('0x9')],'script':_0x94eb44});})['then'](function(_0x5627c7){pm2[_0xfa50('0x1c')]();return _0x5627c7[0x0];})[_0xfa50('0x1d')](respondWithResult(_0x31889f,0xc9))['catch'](handleError(_0x31889f,null));}else{return _0x31889f[_0xfa50('0x6')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xfa50('0x1e')]=function(_0x484085,_0x26f434){if(_0x484085['body']['id']){delete _0x484085[_0xfa50('0x15')]['id'];}var _0x1ca328={'online':'restart','stopped':_0xfa50('0x1f')};if(_0x1ca328[_0xfa50('0x20')](_0x484085[_0xfa50('0x15')][_0xfa50('0x6')])){return pm2[_0x1ca328[_0x484085['body'][_0xfa50('0x6')]]](_0x484085[_0xfa50('0x14')]['id'])[_0xfa50('0x1d')](respondWithResult(_0x26f434,0xc8))['catch'](handleError(_0x26f434,null));}else{return _0x26f434[_0xfa50('0x6')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0xfa50('0x21')]=function(_0xe9d2a9,_0x512ab1){if(_0xe9d2a9[_0xfa50('0x15')]['id']){delete _0xe9d2a9[_0xfa50('0x15')]['id'];}if(_0xe9d2a9[_0xfa50('0x14')]['id']){return pm2[_0xfa50('0x22')](_0xe9d2a9[_0xfa50('0x14')]['id'])[_0xfa50('0x1d')](function(_0x653de6){pm2[_0xfa50('0x1c')]();return _0x653de6[0x0];})['then'](respondWithResult(_0x512ab1,null))[_0xfa50('0x11')](handleError(_0x512ab1,null));}else{return _0x512ab1['status'](0x1f4)[_0xfa50('0xa')]({'message':_0xfa50('0x23')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index bfa349e..429acce 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 _0x82a5=['multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x18ed09,_0x185d4a){var _0x1956ac=function(_0x4481bd){while(--_0x4481bd){_0x18ed09['push'](_0x18ed09['shift']());}};_0x1956ac(++_0x185d4a);}(_0x82a5,0x173));var _0x582a=function(_0x139d4c,_0x441686){_0x139d4c=_0x139d4c-0x0;var _0x1d9897=_0x82a5[_0x139d4c];return _0x1d9897;};'use strict';var multer=require(_0x582a('0x0'));var util=require('util');var path=require(_0x582a('0x1'));var timeout=require('connect-timeout');var express=require(_0x582a('0x2'));var router=express['Router']();var auth=require(_0x582a('0x3'));var interaction=require(_0x582a('0x4'));var config=require(_0x582a('0x5'));module[_0x582a('0x6')]=router; \ No newline at end of file +var _0xb050=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3935d7,_0x39958f){var _0x2ca73e=function(_0x4a6c5d){while(--_0x4a6c5d){_0x3935d7['push'](_0x3935d7['shift']());}};_0x2ca73e(++_0x39958f);}(_0xb050,0x127));var _0x0b05=function(_0x5514be,_0x3b37cb){_0x5514be=_0x5514be-0x0;var _0x2b21ff=_0xb050[_0x5514be];return _0x2b21ff;};'use strict';var multer=require(_0x0b05('0x0'));var util=require(_0x0b05('0x1'));var path=require(_0x0b05('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0b05('0x3')]();var auth=require(_0x0b05('0x4'));var interaction=require(_0x0b05('0x5'));var config=require('../../config/environment');module[_0x0b05('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 2eff701..50b48b6 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 _0xf828=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf828,0x192));var _0x8f82=function(_0x12cbed,_0x250b62){_0x12cbed=_0x12cbed-0x0;var _0x56ba23=_0xf828[_0x12cbed];return _0x56ba23;};'use strict';var Sequelize=require(_0x8f82('0x0'));module[_0x8f82('0x1')]={'state':{'type':Sequelize[_0x8f82('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8f82('0x3')]},'scheduledat':{'type':Sequelize[_0x8f82('0x4')]},'uniqueid':{'type':Sequelize[_0x8f82('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8f82('0x4')]},'ringtime':{'type':Sequelize[_0x8f82('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8f82('0x3')]},'campaigntype':{'type':Sequelize[_0x8f82('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0ca2=['INTEGER','DATE','STRING','exports'];(function(_0x17b140,_0xc447af){var _0x273ca5=function(_0x3323ab){while(--_0x3323ab){_0x17b140['push'](_0x17b140['shift']());}};_0x273ca5(++_0xc447af);}(_0x0ca2,0x10f));var _0x20ca=function(_0x297acf,_0x530d6c){_0x297acf=_0x297acf-0x0;var _0x2dd757=_0x0ca2[_0x297acf];return _0x2dd757;};'use strict';var Sequelize=require('sequelize');module[_0x20ca('0x0')]={'state':{'type':Sequelize[_0x20ca('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x20ca('0x2')]},'uniqueid':{'type':Sequelize[_0x20ca('0x3')]},'starttime':{'type':Sequelize[_0x20ca('0x2')]},'responsetime':{'type':Sequelize[_0x20ca('0x2')]},'ringtime':{'type':Sequelize[_0x20ca('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x20ca('0x3')]},'campaigntype':{'type':Sequelize[_0x20ca('0x3')]},'membername':{'type':Sequelize[_0x20ca('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0bf6de9..39346ae 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 _0x25d0=['bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','lodash','util','api','moment'];(function(_0x251218,_0x49200c){var _0x26c598=function(_0x492ca6){while(--_0x492ca6){_0x251218['push'](_0x251218['shift']());}};_0x26c598(++_0x49200c);}(_0x25d0,0xb0));var _0x025d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x025d('0x0'));var util=require(_0x025d('0x1'));var logger=require('../../config/logger')(_0x025d('0x2'));var moment=require(_0x025d('0x3'));var BPromise=require(_0x025d('0x4'));var rp=require(_0x025d('0x5'));var fs=require('fs');var path=require(_0x025d('0x6'));var rimraf=require(_0x025d('0x7'));var config=require(_0x025d('0x8'));var attributes=require(_0x025d('0x9'));module['exports']=function(_0x5dc624,_0x31910a){return _0x5dc624[_0x025d('0xa')](_0x025d('0xb'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a3a=['../../config/logger','api','moment','bluebird','request-promise','./reportAgentPreview.attributes','exports','ReportAgentPreview','util'];(function(_0x30b84a,_0x25bad2){var _0x3748db=function(_0x469630){while(--_0x469630){_0x30b84a['push'](_0x30b84a['shift']());}};_0x3748db(++_0x25bad2);}(_0x4a3a,0xe0));var _0xa4a3=function(_0x49b8c0,_0x49b7a4){_0x49b8c0=_0x49b8c0-0x0;var _0x29450e=_0x4a3a[_0x49b8c0];return _0x29450e;};'use strict';var _=require('lodash');var util=require(_0xa4a3('0x0'));var logger=require(_0xa4a3('0x1'))(_0xa4a3('0x2'));var moment=require(_0xa4a3('0x3'));var BPromise=require(_0xa4a3('0x4'));var rp=require(_0xa4a3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa4a3('0x6'));module[_0xa4a3('0x7')]=function(_0x27de75,_0x4910b5){return _0x27de75['define'](_0xa4a3('0x8'),attributes,{'tableName':'report_agent_preview','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 c7e82a7..b893a9b 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 _0x5009=['options','raw','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateReportAgentPreview','create'];(function(_0x3b8cb5,_0x42f86d){var _0x3b7acd=function(_0x37a9a0){while(--_0x37a9a0){_0x3b8cb5['push'](_0x3b8cb5['shift']());}};_0x3b7acd(++_0x42f86d);}(_0x5009,0x107));var _0x9500=function(_0x229103,_0x5b3760){_0x229103=_0x229103-0x0;var _0x88ea2f=_0x5009[_0x229103];return _0x88ea2f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9500('0x0'));var BPromise=require('bluebird');var rs=require(_0x9500('0x1'));var fs=require('fs');var Redis=require(_0x9500('0x2'));var db=require(_0x9500('0x3'))['db'];var utils=require(_0x9500('0x4'));var logger=require(_0x9500('0x5'))(_0x9500('0x6'));var config=require(_0x9500('0x7'));var jayson=require(_0x9500('0x8'));var client=jayson['client'][_0x9500('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17a667,_0x1dad78,_0x258ba7){return new BPromise(function(_0x3ef1f5,_0x123371){return client[_0x9500('0xa')](_0x17a667,_0x258ba7)[_0x9500('0xb')](function(_0x43e24f){logger[_0x9500('0xc')](_0x9500('0xd'),_0x1dad78,_0x9500('0xe'));logger[_0x9500('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x1dad78,_0x9500('0xe'),JSON[_0x9500('0x10')](_0x43e24f));if(_0x43e24f[_0x9500('0x11')]){if(_0x43e24f['error'][_0x9500('0x12')]===0x1f4){logger['error'](_0x9500('0xd'),_0x1dad78,_0x43e24f[_0x9500('0x11')][_0x9500('0x13')]);return _0x123371(_0x43e24f[_0x9500('0x11')][_0x9500('0x13')]);}logger[_0x9500('0x11')](_0x9500('0xd'),_0x1dad78,_0x43e24f[_0x9500('0x11')]['message']);return _0x3ef1f5(_0x43e24f['error'][_0x9500('0x13')]);}else{logger[_0x9500('0xc')](_0x9500('0xd'),_0x1dad78,_0x9500('0xe'));_0x3ef1f5(_0x43e24f[_0x9500('0x14')]['message']);}})['catch'](function(_0x1e13c9){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1dad78,_0x1e13c9);_0x123371(_0x1e13c9);});});}exports[_0x9500('0x15')]=function(_0x15f8a8){var _0x5c6e78=this;return new Promise(function(_0x21ca3f,_0x4b2d93){return db['ReportAgentPreview'][_0x9500('0x16')](_0x15f8a8['body'],{'raw':_0x15f8a8['options']?_0x15f8a8[_0x9500('0x17')][_0x9500('0x18')]===undefined?!![]:![]:!![]})[_0x9500('0xb')](function(_0x4f945d){logger['info']('CreateReportAgentPreview',_0x15f8a8);logger[_0x9500('0xf')](_0x9500('0x15'),_0x15f8a8,JSON[_0x9500('0x10')](_0x4f945d));_0x21ca3f(_0x4f945d);})[_0x9500('0x19')](function(_0x2ac6db){logger[_0x9500('0x11')](_0x9500('0x15'),_0x2ac6db[_0x9500('0x13')],_0x15f8a8);_0x4b2d93(_0x5c6e78['error'](0x1f4,_0x2ac6db[_0x9500('0x13')]));});});}; \ No newline at end of file +var _0x0a5c=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','create','body','options','raw','lodash'];(function(_0x217f8,_0x369f44){var _0x2ae878=function(_0x28ee38){while(--_0x28ee38){_0x217f8['push'](_0x217f8['shift']());}};_0x2ae878(++_0x369f44);}(_0x0a5c,0x117));var _0xc0a5=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x0a5c[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xc0a5('0x0'));var util=require(_0xc0a5('0x1'));var moment=require(_0xc0a5('0x2'));var BPromise=require(_0xc0a5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0a5('0x4'));var db=require(_0xc0a5('0x5'))['db'];var utils=require(_0xc0a5('0x6'));var logger=require(_0xc0a5('0x7'))(_0xc0a5('0x8'));var config=require('../../config/environment');var jayson=require(_0xc0a5('0x9'));var client=jayson['client'][_0xc0a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x388635,_0x20472b,_0x24cac0){return new BPromise(function(_0x3b4174,_0x4c93b7){return client['request'](_0x388635,_0x24cac0)[_0xc0a5('0xb')](function(_0xde0d29){logger[_0xc0a5('0xc')](_0xc0a5('0xd'),_0x20472b,_0xc0a5('0xe'));logger[_0xc0a5('0xf')](_0xc0a5('0x10'),_0x20472b,_0xc0a5('0xe'),JSON[_0xc0a5('0x11')](_0xde0d29));if(_0xde0d29[_0xc0a5('0x12')]){if(_0xde0d29[_0xc0a5('0x12')][_0xc0a5('0x13')]===0x1f4){logger[_0xc0a5('0x12')](_0xc0a5('0xd'),_0x20472b,_0xde0d29['error'][_0xc0a5('0x14')]);return _0x4c93b7(_0xde0d29[_0xc0a5('0x12')]['message']);}logger[_0xc0a5('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x20472b,_0xde0d29[_0xc0a5('0x12')][_0xc0a5('0x14')]);return _0x3b4174(_0xde0d29['error'][_0xc0a5('0x14')]);}else{logger[_0xc0a5('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x20472b,_0xc0a5('0xe'));_0x3b4174(_0xde0d29[_0xc0a5('0x15')][_0xc0a5('0x14')]);}})[_0xc0a5('0x16')](function(_0x4bc17b){logger[_0xc0a5('0x12')](_0xc0a5('0xd'),_0x20472b,_0x4bc17b);_0x4c93b7(_0x4bc17b);});});}exports[_0xc0a5('0x17')]=function(_0x5752e1){var _0x215690=this;return new Promise(function(_0x40c8c0,_0x500a4e){return db['ReportAgentPreview'][_0xc0a5('0x18')](_0x5752e1[_0xc0a5('0x19')],{'raw':_0x5752e1[_0xc0a5('0x1a')]?_0x5752e1[_0xc0a5('0x1a')][_0xc0a5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1bd7fe){logger[_0xc0a5('0xc')]('CreateReportAgentPreview',_0x5752e1);logger[_0xc0a5('0xf')]('CreateReportAgentPreview',_0x5752e1,JSON[_0xc0a5('0x11')](_0x1bd7fe));_0x40c8c0(_0x1bd7fe);})['catch'](function(_0x966e49){logger[_0xc0a5('0x12')](_0xc0a5('0x17'),_0x966e49['message'],_0x5752e1);_0x500a4e(_0x215690[_0xc0a5('0x12')](0x1f4,_0x966e49[_0xc0a5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c3933b3..b5b7a59 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 _0x3f78=['/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/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','showVoiceQueues','/outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues'];(function(_0x349ec0,_0x58be4f){var _0x5cd2db=function(_0x29f11f){while(--_0x29f11f){_0x349ec0['push'](_0x349ec0['shift']());}};_0x5cd2db(++_0x58be4f);}(_0x3f78,0xe0));var _0x83f7=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x3f78[_0x4e7d25];return _0x526fe6;};'use strict';var multer=require(_0x83f7('0x0'));var util=require(_0x83f7('0x1'));var path=require('path');var express=require(_0x83f7('0x2'));var router=express[_0x83f7('0x3')]();var auth=require(_0x83f7('0x4'));var controller=require(_0x83f7('0x5'));router[_0x83f7('0x6')]('/voice/channels',auth[_0x83f7('0x7')](),controller[_0x83f7('0x8')]);router[_0x83f7('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x83f7('0x9')]);router[_0x83f7('0x6')](_0x83f7('0xa'),auth[_0x83f7('0x7')](),controller[_0x83f7('0xb')]);router[_0x83f7('0x6')](_0x83f7('0xc'),auth[_0x83f7('0x7')](),controller[_0x83f7('0xd')]);router['get'](_0x83f7('0xe'),auth[_0x83f7('0x7')](),controller['chatQueues']);router[_0x83f7('0x6')](_0x83f7('0xf'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x10')]);router[_0x83f7('0x6')]('/mail/accounts',auth[_0x83f7('0x7')](),controller[_0x83f7('0x11')]);router[_0x83f7('0x6')](_0x83f7('0x12'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x13')]);router[_0x83f7('0x6')](_0x83f7('0x14'),auth['isAuthenticated'](),controller[_0x83f7('0x15')]);router['get'](_0x83f7('0x16'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x17')]);router[_0x83f7('0x6')](_0x83f7('0x18'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x19')]);router[_0x83f7('0x6')](_0x83f7('0x1a'),auth[_0x83f7('0x7')](),controller['voiceQueuesPreview']);router['get'](_0x83f7('0x1b'),auth['isAuthenticated'](),controller[_0x83f7('0x1c')]);router[_0x83f7('0x6')](_0x83f7('0x1d'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x1e')]);router[_0x83f7('0x6')](_0x83f7('0x1f'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x20')]);router[_0x83f7('0x6')](_0x83f7('0x21'),auth['isAuthenticated'](),controller[_0x83f7('0x22')]);router[_0x83f7('0x6')](_0x83f7('0x23'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x24')]);router[_0x83f7('0x6')](_0x83f7('0x25'),auth[_0x83f7('0x7')](),controller['outbound']);router['get'](_0x83f7('0x26'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x27')]);router[_0x83f7('0x6')](_0x83f7('0x28'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x29')]);router[_0x83f7('0x2a')]('/agents/:id/capacity',auth[_0x83f7('0x7')](),controller[_0x83f7('0x2b')]);router[_0x83f7('0x6')](_0x83f7('0x2c'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x2d')]);router[_0x83f7('0x6')](_0x83f7('0x2e'),auth['isAuthenticated'](),controller[_0x83f7('0x2f')]);router['get'](_0x83f7('0x30'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x31')]);router[_0x83f7('0x6')](_0x83f7('0x32'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x33')]);router[_0x83f7('0x6')](_0x83f7('0x34'),auth[_0x83f7('0x7')](),controller['chatQueuesWaitingInteractions']);router['get'](_0x83f7('0x35'),auth['isAuthenticated'](),controller[_0x83f7('0x36')]);router[_0x83f7('0x6')](_0x83f7('0x37'),auth['isAuthenticated'](),controller[_0x83f7('0x38')]);router[_0x83f7('0x6')](_0x83f7('0x39'),auth['isAuthenticated'](),controller[_0x83f7('0x3a')]);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x83f7('0x3b')]);router['get'](_0x83f7('0x3c'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x3d')]);router['get']('/fax/queues/waitinginteractions',auth[_0x83f7('0x7')](),controller[_0x83f7('0x3e')]);router[_0x83f7('0x3f')](_0x83f7('0x40'),auth['isAuthenticated'](),controller[_0x83f7('0x41')]('mail'));router['get'](_0x83f7('0x42'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x43')]);router[_0x83f7('0x3f')](_0x83f7('0x44'),auth['isAuthenticated'](),controller['queueNotify'](_0x83f7('0x45')));router[_0x83f7('0x6')](_0x83f7('0x46'),auth['isAuthenticated'](),controller[_0x83f7('0x47')]);router[_0x83f7('0x3f')]('/fax/queues/:id/notify',auth[_0x83f7('0x7')](),controller[_0x83f7('0x41')](_0x83f7('0x48')));router[_0x83f7('0x6')]('/fax/queues/:id',auth[_0x83f7('0x7')](),controller['showFaxQueues']);router[_0x83f7('0x3f')](_0x83f7('0x49'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x41')]('openchannel'));router[_0x83f7('0x6')](_0x83f7('0x4a'),auth['isAuthenticated'](),controller[_0x83f7('0x4b')]);router['post']('/sms/queues/:id/notify',auth[_0x83f7('0x7')](),controller[_0x83f7('0x41')]('sms'));router['post'](_0x83f7('0x4c'),auth['isAuthenticated'](),controller[_0x83f7('0x41')]('whatsapp'));router[_0x83f7('0x6')](_0x83f7('0x4d'),auth[_0x83f7('0x7')](),controller['showSmsQueues']);router[_0x83f7('0x6')](_0x83f7('0x4e'),auth['isAuthenticated'](),controller[_0x83f7('0x4f')]);router[_0x83f7('0x3f')](_0x83f7('0x50'),auth[_0x83f7('0x7')](),controller[_0x83f7('0x51')]);module['exports']=router; \ No newline at end of file +var _0xc5b1=['./rpc.controller','get','/voice/channels','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','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','/outbound','outbound','outboundChannels','/agents','agents','agentCapacity','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x35cab3,_0x3a165f){var _0x1f82a8=function(_0x3e56a2){while(--_0x3e56a2){_0x35cab3['push'](_0x35cab3['shift']());}};_0x1f82a8(++_0x3a165f);}(_0xc5b1,0x98));var _0x1c5b=function(_0x198897,_0x39167a){_0x198897=_0x198897-0x0;var _0x2b10d6=_0xc5b1[_0x198897];return _0x2b10d6;};'use strict';var multer=require(_0x1c5b('0x0'));var util=require(_0x1c5b('0x1'));var path=require(_0x1c5b('0x2'));var express=require(_0x1c5b('0x3'));var router=express[_0x1c5b('0x4')]();var auth=require(_0x1c5b('0x5'));var controller=require(_0x1c5b('0x6'));router[_0x1c5b('0x7')](_0x1c5b('0x8'),auth['isAuthenticated'](),controller[_0x1c5b('0x9')]);router[_0x1c5b('0x7')](_0x1c5b('0xa'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0xc')]);router['get'](_0x1c5b('0xd'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0xe')]);router[_0x1c5b('0x7')](_0x1c5b('0xf'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x10')]);router[_0x1c5b('0x7')](_0x1c5b('0x11'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x12')]);router[_0x1c5b('0x7')](_0x1c5b('0x13'),auth['isAuthenticated'](),controller[_0x1c5b('0x14')]);router['get'](_0x1c5b('0x15'),auth[_0x1c5b('0xb')](),controller['mailAccounts']);router[_0x1c5b('0x7')](_0x1c5b('0x16'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x17')]);router[_0x1c5b('0x7')](_0x1c5b('0x18'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x19')]);router[_0x1c5b('0x7')](_0x1c5b('0x1a'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x1b')]);router['get']('/fax/queues',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x1c')]);router['get']('/voice/queues/preview/:id',auth[_0x1c5b('0xb')](),controller['voiceQueuesPreview']);router[_0x1c5b('0x7')](_0x1c5b('0x1d'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x1e')]);router['get'](_0x1c5b('0x1f'),auth[_0x1c5b('0xb')](),controller['voiceQueuesChannel']);router[_0x1c5b('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x20')]);router['get'](_0x1c5b('0x21'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x1c5b('0x7')](_0x1c5b('0x22'),auth[_0x1c5b('0xb')](),controller['showVoiceQueues']);router[_0x1c5b('0x7')](_0x1c5b('0x23'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x24')]);router[_0x1c5b('0x7')]('/outbound/channels',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x25')]);router[_0x1c5b('0x7')](_0x1c5b('0x26'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x27')]);router['put']('/agents/:id/capacity',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x28')]);router['get']('/telephones',auth[_0x1c5b('0xb')](),controller['telephones']);router['get'](_0x1c5b('0x29'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x2a')]);router['get'](_0x1c5b('0x2b'),auth[_0x1c5b('0xb')](),controller['campaigns']);router[_0x1c5b('0x7')]('/fax/accounts',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x2c')]);router['get'](_0x1c5b('0x2d'),auth[_0x1c5b('0xb')](),controller['chatQueuesWaitingInteractions']);router[_0x1c5b('0x7')]('/mail/queues/waitinginteractions',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x2e')]);router['get'](_0x1c5b('0x2f'),auth[_0x1c5b('0xb')](),controller['openchannelQueuesWaitingInteractions']);router[_0x1c5b('0x7')](_0x1c5b('0x30'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x31')]);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x1c5b('0x32')]);router[_0x1c5b('0x7')](_0x1c5b('0x33'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x34')]);router['get']('/fax/queues/waitinginteractions',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x35')]);router['post'](_0x1c5b('0x36'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x37')](_0x1c5b('0x38')));router['get'](_0x1c5b('0x39'),auth['isAuthenticated'](),controller[_0x1c5b('0x3a')]);router[_0x1c5b('0x3b')]('/chat/queues/:id/notify',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x37')](_0x1c5b('0x3c')));router['get'](_0x1c5b('0x3d'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x3e')]);router[_0x1c5b('0x3b')](_0x1c5b('0x3f'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x37')]('fax'));router[_0x1c5b('0x7')](_0x1c5b('0x40'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x1c5b('0x3b')](_0x1c5b('0x41'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x37')]('openchannel'));router[_0x1c5b('0x7')](_0x1c5b('0x42'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x43')]);router[_0x1c5b('0x3b')](_0x1c5b('0x44'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x37')](_0x1c5b('0x45')));router[_0x1c5b('0x3b')](_0x1c5b('0x46'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x37')](_0x1c5b('0x47')));router[_0x1c5b('0x7')](_0x1c5b('0x48'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x49')]);router['get'](_0x1c5b('0x4a'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x4b')]);router['post'](_0x1c5b('0x4c'),auth['isAuthenticated'](),controller[_0x1c5b('0x4d')]);module[_0x1c5b('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f258c3c..3d949b1 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 _0x38cb=['Outbound','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','AgentCapacity','capacity','telephones','trunks','Trunks','Campaigns','showChatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','type','uniq','value','indexOf','queue_id','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','agent','Message','MessageId','Start','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','then','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound'];(function(_0x7f13cb,_0x9bad75){var _0x2779b1=function(_0x5402c3){while(--_0x5402c3){_0x7f13cb['push'](_0x7f13cb['shift']());}};_0x2779b1(++_0x9bad75);}(_0x38cb,0x1d0));var _0xb38c=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x38cb[_0x1b349a];return _0x5d1f7c;};'use strict';var BPromise=require(_0xb38c('0x0'));var moment=require(_0xb38c('0x1'));var _=require(_0xb38c('0x2'));var util=require(_0xb38c('0x3'));var db=require(_0xb38c('0x4'))['db'];var logger=require(_0xb38c('0x5'))(_0xb38c('0x6'));var jayson=require(_0xb38c('0x7'));var amiClient=jayson['client'][_0xb38c('0x8')]({'port':0x232a});var mailClient=jayson[_0xb38c('0x9')][_0xb38c('0x8')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x4427b6,_0x1c0de5,_0x2f858a){return new BPromise(function(_0x39e4d1,_0x129b68){var _0x30776c=_0x2f858a?_0x2f858a:amiClient;return _0x30776c['request'](_0x4427b6,_0x1c0de5)['then'](function(_0x3d2216){if(_0x3d2216[_0xb38c('0xa')]){if(_0x3d2216[_0xb38c('0xa')][_0xb38c('0xb')]===0x1f4){return _0x129b68(_0x3d2216['error'][_0xb38c('0xc')]);}return _0x39e4d1(_0x3d2216['error']['message']);}else{_0x39e4d1(_0x3d2216[_0xb38c('0xd')]);}})[_0xb38c('0xe')](function(_0x3a3e62){_0x129b68(_0x3a3e62);});});}function respondWithResult(_0x416ea4,_0x3720bd){_0x3720bd=_0x3720bd||0xc8;return function(_0x24508e){if(_0x24508e){return _0x416ea4[_0xb38c('0xf')](_0x3720bd)[_0xb38c('0x10')](_0x24508e);}return _0x416ea4[_0xb38c('0x11')](0x194);};}function handleError(_0xfb2d57,_0x517ced){_0x517ced=_0x517ced||0x1f4;return function(_0x22be1c){logger['error'](_0x22be1c[_0xb38c('0x12')]);if(_0x22be1c[_0xb38c('0x13')]){delete _0x22be1c[_0xb38c('0x13')];}_0xfb2d57[_0xb38c('0xf')](_0x517ced)[_0xb38c('0x14')](_0x22be1c);};}function findById(_0x31806d){return function(_0x3481ea){if(!_[_0xb38c('0x15')](_0x31806d)&&!_['isNil'](_0x3481ea)&&!_[_0xb38c('0x15')](_0x3481ea[_0xb38c('0x16')])){return _['find'](_0x3481ea[_0xb38c('0x16')],function(_0xf63441){return _0xf63441['id']==_0x31806d;});}return null;};}exports['voiceChannels']=function(_0xdc6f3,_0x5ca628){return respondWithRpcPromise(_0xb38c('0x17'),_0xdc6f3[_0xb38c('0x18')])['then'](respondWithResult(_0x5ca628,null))['catch'](handleError(_0x5ca628,null));};exports[_0xb38c('0x19')]=function(_0x33154c,_0x58930a){return respondWithRpcPromise(_0xb38c('0x1a'),_[_0xb38c('0x1b')](_0x33154c[_0xb38c('0x18')],_0x33154c[_0xb38c('0x1c')]))[_0xb38c('0x1d')](respondWithResult(_0x58930a,null))[_0xb38c('0xe')](handleError(_0x58930a,null));};exports[_0xb38c('0x1e')]=function(_0x48f614,_0x226dbc){return respondWithRpcPromise(_0xb38c('0x1f'),_[_0xb38c('0x1b')](_0x48f614['query'],_0x48f614[_0xb38c('0x1c')]))[_0xb38c('0x1d')](respondWithResult(_0x226dbc,null))[_0xb38c('0xe')](handleError(_0x226dbc,null));};exports[_0xb38c('0x20')]=function(_0x11edc8,_0xebad8a){return respondWithRpcPromise(_0xb38c('0x21'),_0x11edc8[_0xb38c('0x18')])['then'](respondWithResult(_0xebad8a,null))[_0xb38c('0xe')](handleError(_0xebad8a,null));};exports[_0xb38c('0x22')]=function(_0x53aded,_0xa147f4){return respondWithRpcPromise(_0xb38c('0x21'),_0x53aded[_0xb38c('0x18')])[_0xb38c('0x1d')](findById(_0x53aded['params']['id']))[_0xb38c('0x1d')](respondWithResult(_0xa147f4,null))['catch'](handleError(_0xa147f4,null));};exports['voiceQueuesPreview']=function(_0x30b520,_0x3bcf03){return respondWithRpcPromise(_0xb38c('0x23'),_[_0xb38c('0x1b')](_0x30b520[_0xb38c('0x18')],_0x30b520[_0xb38c('0x1c')]))[_0xb38c('0x1d')](respondWithResult(_0x3bcf03,null))[_0xb38c('0xe')](handleError(_0x3bcf03,null));};exports['voiceQueuesChannels']=function(_0x41482c,_0x5af46a){return respondWithRpcPromise(_0xb38c('0x24'),_0x41482c[_0xb38c('0x18')])[_0xb38c('0x1d')](respondWithResult(_0x5af46a,null))[_0xb38c('0xe')](handleError(_0x5af46a,null));};exports[_0xb38c('0x25')]=function(_0x32c4b8,_0x90933){return respondWithRpcPromise(_0xb38c('0x26'),_[_0xb38c('0x1b')](_0x32c4b8[_0xb38c('0x18')],_0x32c4b8['params']))['then'](respondWithResult(_0x90933,null))['catch'](handleError(_0x90933,null));};exports[_0xb38c('0x27')]=function(_0x4ae9f2,_0x1bc490){return respondWithRpcPromise(_0xb38c('0x28'),_['merge'](_0x4ae9f2['query'],_0x4ae9f2[_0xb38c('0x1c')]))[_0xb38c('0x1d')](respondWithResult(_0x1bc490,null))[_0xb38c('0xe')](handleError(_0x1bc490,null));};exports[_0xb38c('0x29')]=function(_0x51ad8e,_0x372814){return respondWithRpcPromise(_0xb38c('0x2a'),_[_0xb38c('0x1b')](_0x51ad8e[_0xb38c('0x18')],_0x51ad8e[_0xb38c('0x1c')]))['then'](respondWithResult(_0x372814,null))[_0xb38c('0xe')](handleError(_0x372814,null));};exports[_0xb38c('0x2b')]=function(_0xea4ee7,_0x5c93ac){return respondWithRpcPromise(_0xb38c('0x2c'),_0xea4ee7[_0xb38c('0x18')])['then'](respondWithResult(_0x5c93ac,null))[_0xb38c('0xe')](handleError(_0x5c93ac,null));};exports['outboundChannels']=function(_0x130c80,_0x199d06){return respondWithRpcPromise(_0xb38c('0x2d'),_0x130c80[_0xb38c('0x18')])[_0xb38c('0x1d')](respondWithResult(_0x199d06,null))[_0xb38c('0xe')](handleError(_0x199d06,null));};exports[_0xb38c('0x2e')]=function(_0x4ecc08,_0x404526){var _0x58fea4;return respondWithRpcPromise(_0xb38c('0x2f'),_0x4ecc08[_0xb38c('0x18')])[_0xb38c('0x1d')](function(_0x22a0a6){_0x58fea4=_0x22a0a6;return respondWithRpcPromise(_0xb38c('0x2f'),_0x4ecc08[_0xb38c('0x18')],routingClient);})['then'](function(_0x40064c){return _[_0xb38c('0x1b')]({},_0x40064c,_0x58fea4);})[_0xb38c('0x1d')](respondWithResult(_0x404526,null))[_0xb38c('0xe')](handleError(_0x404526,null));};exports['agentCapacity']=function(_0x3ef5cb,_0x4cd308){if(_0x3ef5cb[_0xb38c('0x30')]&&_0x3ef5cb['body']['interaction']&&_0x3ef5cb[_0xb38c('0x31')]&&_0x3ef5cb[_0xb38c('0x31')][_0xb38c('0x13')]){for(var _0x4d3b2e in _0x3ef5cb[_0xb38c('0x30')][_0xb38c('0x32')]){if(_0x3ef5cb[_0xb38c('0x30')][_0xb38c('0x32')][_0xb38c('0x33')](_0x4d3b2e)){db[_0xb38c('0x34')][_0xb38c('0x35')]({'where':{'channel':_0x4d3b2e,'membername':_0x3ef5cb[_0xb38c('0x31')]['name'],'type':_0xb38c('0x36'),'exitAt':null,'uniqueid':_0x3ef5cb['body']['interaction'][_0x4d3b2e]&&_0x3ef5cb[_0xb38c('0x30')][_0xb38c('0x32')][_0x4d3b2e][_0xb38c('0x37')]?{'$notIn':_0x3ef5cb[_0xb38c('0x30')][_0xb38c('0x32')][_0x4d3b2e]}:{'$ne':null}}})['then'](function(_0x5985db){var _0x550bb6=moment()[_0xb38c('0x38')](_0xb38c('0x39'));for(var _0x52fe94=0x0,_0x5be010=_0x5985db[_0xb38c('0x37')];_0x52fe94<_0x5be010;_0x52fe94+=0x1){_0x5985db[_0x52fe94][_0xb38c('0x3a')]({'exitAt':_0x550bb6});}});for(var _0x4cea3a=0x0;_0x4cea3a<_0x3ef5cb['body'][_0xb38c('0x32')][_0x4d3b2e][_0xb38c('0x37')];_0x4cea3a+=0x1){db[_0xb38c('0x34')][_0xb38c('0x3b')]({'where':{'channel':_0x4d3b2e,'membername':_0x3ef5cb['user'][_0xb38c('0x13')],'type':'INTERACTION','uniqueid':_0x3ef5cb[_0xb38c('0x30')][_0xb38c('0x32')][_0x4d3b2e][_0x4cea3a],'exitAt':null},'defaults':{'channel':_0x4d3b2e,'membername':_0x3ef5cb['user'][_0xb38c('0x13')],'interface':_[_0xb38c('0x15')](_0x3ef5cb[_0xb38c('0x31')][_0xb38c('0x3c')])?util[_0xb38c('0x38')](_0xb38c('0x3d'),_0x3ef5cb[_0xb38c('0x31')][_0xb38c('0x13')]):_0x3ef5cb['user'][_0xb38c('0x3c')],'type':_0xb38c('0x36'),'enterAt':moment()[_0xb38c('0x38')](_0xb38c('0x39')),'role':'agent','internal':_0x3ef5cb[_0xb38c('0x31')]['internal'],'uniqueid':_0x3ef5cb[_0xb38c('0x30')][_0xb38c('0x32')][_0x4d3b2e][_0x4cea3a]}});}}}}return respondWithRpcPromise(_0xb38c('0x3e'),{'id':_0x3ef5cb['params']['id'],'capacity':_0x3ef5cb[_0xb38c('0x30')][_0xb38c('0x3f')]},routingClient)[_0xb38c('0x1d')](respondWithResult(_0x4cd308,null))[_0xb38c('0xe')](handleError(_0x4cd308,null));};exports[_0xb38c('0x40')]=function(_0x596c46,_0x1995dd){return respondWithRpcPromise('Telephones',_0x596c46[_0xb38c('0x18')])[_0xb38c('0x1d')](respondWithResult(_0x1995dd,null))['catch'](handleError(_0x1995dd,null));};exports[_0xb38c('0x41')]=function(_0x18a8d1,_0x46594b){return respondWithRpcPromise(_0xb38c('0x42'),_0x18a8d1['query'])[_0xb38c('0x1d')](respondWithResult(_0x46594b,null))[_0xb38c('0xe')](handleError(_0x46594b,null));};exports['campaigns']=function(_0x1093b7,_0x16c8e9){return respondWithRpcPromise(_0xb38c('0x43'),_0x1093b7['query'])[_0xb38c('0x1d')](respondWithResult(_0x16c8e9,null))[_0xb38c('0xe')](handleError(_0x16c8e9,null));};exports['chatQueues']=function(_0x3449b4,_0x28cab9){return respondWithRpcPromise('ChatQueues',_0x3449b4[_0xb38c('0x18')],routingClient)[_0xb38c('0x1d')](respondWithResult(_0x28cab9,null))[_0xb38c('0xe')](handleError(_0x28cab9,null));};exports[_0xb38c('0x44')]=function(_0x56b704,_0x18b068){return respondWithRpcPromise(_0xb38c('0x45'),_0x56b704[_0xb38c('0x18')],routingClient)[_0xb38c('0x1d')](findById(_0x56b704['params']['id']))[_0xb38c('0x1d')](respondWithResult(_0x18b068,null))[_0xb38c('0xe')](handleError(_0x18b068,null));};exports[_0xb38c('0x46')]=function(_0x10f7c3,_0x56ab54){return respondWithRpcPromise('MailQueues',_0x10f7c3[_0xb38c('0x18')],routingClient)[_0xb38c('0x1d')](respondWithResult(_0x56ab54,null))[_0xb38c('0xe')](handleError(_0x56ab54,null));};exports[_0xb38c('0x47')]=function(_0x4e3956,_0x109905){return respondWithRpcPromise(_0xb38c('0x48'),_0x4e3956[_0xb38c('0x18')],routingClient)[_0xb38c('0x1d')](findById(_0x4e3956[_0xb38c('0x1c')]['id']))['then'](respondWithResult(_0x109905,null))['catch'](handleError(_0x109905,null));};exports['mailAccounts']=function(_0x2c5d79,_0x5cd790){return respondWithRpcPromise('MailAccounts',_0x2c5d79['query'],mailClient)[_0xb38c('0x1d')](respondWithResult(_0x5cd790,null))[_0xb38c('0xe')](handleError(_0x5cd790,null));};exports[_0xb38c('0x49')]=function(_0x1489df,_0xfade82){return respondWithRpcPromise(_0xb38c('0x4a'),_0x1489df[_0xb38c('0x18')],routingClient)['then'](respondWithResult(_0xfade82,null))[_0xb38c('0xe')](handleError(_0xfade82,null));};exports['showOpenchannelQueues']=function(_0x3f1791,_0x129ec5){return respondWithRpcPromise(_0xb38c('0x4a'),_0x3f1791[_0xb38c('0x18')],routingClient)[_0xb38c('0x1d')](findById(_0x3f1791[_0xb38c('0x1c')]['id']))['then'](respondWithResult(_0x129ec5,null))['catch'](handleError(_0x129ec5,null));};exports[_0xb38c('0x4b')]=function(_0x7c01c0,_0xa9fe04){return respondWithRpcPromise(_0xb38c('0x4c'),_0x7c01c0['query'],routingClient)[_0xb38c('0x1d')](respondWithResult(_0xa9fe04,null))[_0xb38c('0xe')](handleError(_0xa9fe04,null));};exports[_0xb38c('0x4d')]=function(_0x1edcf1,_0x158e0d){return respondWithRpcPromise(_0xb38c('0x4c'),_0x1edcf1['query'],routingClient)[_0xb38c('0x1d')](findById(_0x1edcf1[_0xb38c('0x1c')]['id']))[_0xb38c('0x1d')](respondWithResult(_0x158e0d,null))[_0xb38c('0xe')](handleError(_0x158e0d,null));};exports[_0xb38c('0x4e')]=function(_0x1ce36c,_0x417621){return respondWithRpcPromise(_0xb38c('0x4f'),_0x1ce36c[_0xb38c('0x18')],routingClient)[_0xb38c('0x1d')](respondWithResult(_0x417621,null))[_0xb38c('0xe')](handleError(_0x417621,null));};exports['showWhatsappQueues']=function(_0x486eca,_0x13029c){return respondWithRpcPromise(_0xb38c('0x4f'),_0x486eca[_0xb38c('0x18')],routingClient)['then'](findById(_0x486eca[_0xb38c('0x1c')]['id']))['then'](respondWithResult(_0x13029c,null))[_0xb38c('0xe')](handleError(_0x13029c,null));};exports[_0xb38c('0x50')]=function(_0x22b5d6,_0x20379f){return respondWithRpcPromise(_0xb38c('0x51'),_0x22b5d6[_0xb38c('0x18')],routingClient)[_0xb38c('0x1d')](respondWithResult(_0x20379f,null))['catch'](handleError(_0x20379f,null));};exports['showFaxQueues']=function(_0x1cc419,_0x5c5f30){return respondWithRpcPromise('FaxQueues',_0x1cc419[_0xb38c('0x18')],routingClient)['then'](findById(_0x1cc419[_0xb38c('0x1c')]['id']))['then'](respondWithResult(_0x5c5f30,null))[_0xb38c('0xe')](handleError(_0x5c5f30,null));};exports[_0xb38c('0x52')]=function(_0x2351b3,_0x553ce0){return respondWithRpcPromise(_0xb38c('0x53'),_0x2351b3[_0xb38c('0x18')])[_0xb38c('0x1d')](respondWithResult(_0x553ce0,null))[_0xb38c('0xe')](handleError(_0x553ce0,null));};exports[_0xb38c('0x54')]=function(_0x10fe58,_0x287f50){return respondWithRpcPromise(_0xb38c('0x55'),_0x10fe58[_0xb38c('0x18')],routingClient)[_0xb38c('0x1d')](respondWithResult(_0x287f50,null))[_0xb38c('0xe')](handleError(_0x287f50,null));};exports['mailQueuesWaitingInteractions']=function(_0x51fd79,_0x463c7b){return respondWithRpcPromise(_0xb38c('0x56'),_0x51fd79['query'],routingClient)[_0xb38c('0x1d')](respondWithResult(_0x463c7b,null))[_0xb38c('0xe')](handleError(_0x463c7b,null));};exports[_0xb38c('0x57')]=function(_0x395459,_0x273b8e){return respondWithRpcPromise(_0xb38c('0x58'),_0x395459[_0xb38c('0x18')],routingClient)['then'](respondWithResult(_0x273b8e,null))[_0xb38c('0xe')](handleError(_0x273b8e,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x190c00,_0x214f0e){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x190c00[_0xb38c('0x18')],routingClient)[_0xb38c('0x1d')](function(_0x5d5e68){if(_0x190c00[_0xb38c('0x18')]['type']!==undefined){var _0x51dad6=_(_0x5d5e68['rows'])[_0xb38c('0x59')]([_0x190c00[_0xb38c('0x18')][_0xb38c('0x5a')],_0x190c00[_0xb38c('0x1c')]['id']])['map']('queue_id')[_0xb38c('0x5b')]()[_0xb38c('0x5c')]();return _0x5d5e68[_0xb38c('0x16')][_0xb38c('0x59')](function(_0x1b880e){return _0x51dad6[_0xb38c('0x5d')](_0x1b880e[_0xb38c('0x5e')])>-0x1;});}else{return _0x5d5e68[_0xb38c('0x16')][_0xb38c('0x59')](function(_0x542063){return _0x542063[_0xb38c('0x5e')]===parseInt(_0x190c00['params']['id']);});}})[_0xb38c('0x1d')](respondWithResult(_0x214f0e,null))[_0xb38c('0xe')](handleError(_0x214f0e,null));};exports[_0xb38c('0x5f')]=function(_0x12d058,_0x4bc875){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x12d058[_0xb38c('0x18')],routingClient)[_0xb38c('0x1d')](respondWithResult(_0x4bc875,null))[_0xb38c('0xe')](handleError(_0x4bc875,null));};exports[_0xb38c('0x60')]=function(_0x88ecea,_0x5a1c82){return respondWithRpcPromise(_0xb38c('0x61'),_0x88ecea[_0xb38c('0x18')],routingClient)[_0xb38c('0x1d')](respondWithResult(_0x5a1c82,null))[_0xb38c('0xe')](handleError(_0x5a1c82,null));};exports['faxQueuesWaitingInteractions']=function(_0xd2d47,_0x38161b){return respondWithRpcPromise(_0xb38c('0x62'),_0xd2d47[_0xb38c('0x18')],routingClient)[_0xb38c('0x1d')](respondWithResult(_0x38161b,null))[_0xb38c('0xe')](handleError(_0x38161b,null));};exports[_0xb38c('0x63')]=function(_0x2623fd){return function(_0x1dd820,_0x4898ff){var _0x4522fc,_0x1a1f22;var _0x42ba1c=_[_0xb38c('0x64')](_0x2623fd);var _0x4791ea=_0x2623fd==='chat'?_0xb38c('0x65'):_0xb38c('0x66');return db[_0x42ba1c+'Queue'][_0xb38c('0x67')]({'raw':!![],'where':{'id':_0x1dd820[_0xb38c('0x1c')]['id']}})[_0xb38c('0x1d')](function(_0x23b256){if(_[_0xb38c('0x15')](_0x23b256)){throw new Error(_0x42ba1c+_0xb38c('0x68'));}_0x4522fc=_0x23b256;return db[_0x42ba1c+'Message'][_0xb38c('0x67')]({'where':{'id':_0x1dd820[_0xb38c('0x30')][_0xb38c('0x69')]},'include':[{'model':db[_0x42ba1c+_0xb38c('0x6a')],'as':_0xb38c('0x6a')},{'model':db[_0x42ba1c+_0x4791ea],'as':_0xb38c('0x66')}]});})[_0xb38c('0x1d')](function(_0x565051){if(_['isNil'](_0x565051)){throw new Error(_0x42ba1c+_0xb38c('0x6b'));}_0x1a1f22=_0x565051;return _0x565051[_0xb38c('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb38c('0x1d')](function(){var _0x5c035c={'uniqueid':_0x2623fd+'.'+_0x1a1f22['id']+'.'+_0x1a1f22[_0xb38c('0x6a')]['id'],'FromUserId':_0x1dd820[_0xb38c('0x31')]['id'],'type':_0xb38c('0x6d')};_0x5c035c[_0x42ba1c+'MessageId']=_0x1a1f22['id'];_0x5c035c[_0x42ba1c+_0xb38c('0x6e')]=_0x1a1f22[_0xb38c('0x6a')]['id'];_0x5c035c[_0xb38c('0x6f')+_0x42ba1c+_0x4791ea+'Id']=_0x1a1f22[_0xb38c('0x66')]['id'];_0x5c035c['To'+_0x42ba1c+_0xb38c('0x70')]=_0x4522fc['id'];return db[_0x42ba1c+_0xb38c('0x71')][_0xb38c('0x72')](_0x5c035c);})[_0xb38c('0x1d')](function(){return respondWithRpcPromise('Start',{'channel':_0x2623fd,'interaction':_0x1a1f22[_0xb38c('0x6a')],'message':_0x1a1f22,'account':_0x1a1f22[_0xb38c('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4522fc[_0xb38c('0x13')]+','+(_0x1a1f22[_0xb38c('0x66')][_0xb38c('0x73')]||0x12c),'interval':_0xb38c('0x74')}]},routingClient);})['then'](respondWithResult(_0x4898ff,null))[_0xb38c('0xe')](handleError(_0x4898ff,null));};};exports[_0xb38c('0x75')]=function(_0x48a566,_0x25d02b){var _0x5e52fd,_0x1b3f0a;if(_[_0xb38c('0x15')](_0x48a566[_0xb38c('0x30')][_0xb38c('0x76')])){throw new Error(_0xb38c('0x77'));}var _0x303176=_0x48a566[_0xb38c('0x30')][_0xb38c('0x76')];var _0x25af42=_[_0xb38c('0x64')](_0x303176);var _0x15f737=_0x303176===_0xb38c('0x78')?_0xb38c('0x65'):'Account';return db[_0xb38c('0x79')][_0xb38c('0x67')]({'raw':!![],'where':{'id':_0x48a566[_0xb38c('0x1c')]['id'],'role':_0xb38c('0x7a')}})[_0xb38c('0x1d')](function(_0x5bbda){if(_[_0xb38c('0x15')](_0x5bbda)){throw new Error('Agent\x20not\x20found');}_0x5e52fd=_0x5bbda;return db[_0x25af42+_0xb38c('0x7b')][_0xb38c('0x67')]({'where':{'id':_0x48a566[_0xb38c('0x30')][_0xb38c('0x69')]},'include':[{'model':db[_0x25af42+_0xb38c('0x6a')],'as':_0xb38c('0x6a')},{'model':db[_0x25af42+_0x15f737],'as':_0xb38c('0x66')}]});})[_0xb38c('0x1d')](function(_0xbffd48){if(_['isNil'](_0xbffd48)){throw new Error(_0x25af42+'\x20Message\x20not\x20found');}_0x1b3f0a=_0xbffd48;return _0xbffd48['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xb38c('0x1d')](function(){var _0x5a8c4d={'uniqueid':_0x303176+'.'+_0x1b3f0a['id']+'.'+_0x1b3f0a[_0xb38c('0x6a')]['id'],'FromUserId':_0x48a566['user']['id'],'type':_0xb38c('0x6d'),'ToUserId':_0x5e52fd['id']};_0x5a8c4d[_0x25af42+_0xb38c('0x7c')]=_0x1b3f0a['id'];_0x5a8c4d[_0x25af42+_0xb38c('0x6e')]=_0x1b3f0a[_0xb38c('0x6a')]['id'];_0x5a8c4d[_0xb38c('0x6f')+_0x25af42+_0x15f737+'Id']=_0x1b3f0a[_0xb38c('0x66')]['id'];return db[_0x25af42+'TransferReport'][_0xb38c('0x72')](_0x5a8c4d);})['then'](function(){return respondWithRpcPromise(_0xb38c('0x7d'),{'channel':_0x303176,'interaction':_0x1b3f0a[_0xb38c('0x6a')],'message':_0x1b3f0a,'account':_0x1b3f0a['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xb38c('0x7a'),'appdata':_0x5e52fd['name']+','+(_0x1b3f0a['Account'][_0xb38c('0x7e')]||0x12c),'interval':_0xb38c('0x74')}]},routingClient);})[_0xb38c('0x1d')](respondWithResult(_0x25d02b,null))[_0xb38c('0xe')](handleError(_0x25d02b,null));}; \ No newline at end of file +var _0xfdf6=['VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','format','SIP/%s','agent','AgentCapacity','capacity','telephones','Telephones','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Agent\x20not\x20found','\x20Message\x20not\x20found','update','TransferReport','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','api','client','http','then','error','code','message','result','catch','status','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','voiceChannelMixMonitor'];(function(_0x4adb59,_0x204658){var _0x4358dc=function(_0x25dc5f){while(--_0x25dc5f){_0x4adb59['push'](_0x4adb59['shift']());}};_0x4358dc(++_0x204658);}(_0xfdf6,0x1cc));var _0x6fdf=function(_0x3cf741,_0x31a0f6){_0x3cf741=_0x3cf741-0x0;var _0x311e57=_0xfdf6[_0x3cf741];return _0x311e57;};'use strict';var BPromise=require(_0x6fdf('0x0'));var moment=require('moment');var _=require(_0x6fdf('0x1'));var util=require(_0x6fdf('0x2'));var db=require(_0x6fdf('0x3'))['db'];var logger=require(_0x6fdf('0x4'))(_0x6fdf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x6fdf('0x6')][_0x6fdf('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x6fdf('0x6')][_0x6fdf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x4449dc,_0x305c36,_0x33f7e3){return new BPromise(function(_0x51799a,_0x41f164){var _0x29fae1=_0x33f7e3?_0x33f7e3:amiClient;return _0x29fae1['request'](_0x4449dc,_0x305c36)[_0x6fdf('0x8')](function(_0x57cea2){if(_0x57cea2[_0x6fdf('0x9')]){if(_0x57cea2[_0x6fdf('0x9')][_0x6fdf('0xa')]===0x1f4){return _0x41f164(_0x57cea2[_0x6fdf('0x9')][_0x6fdf('0xb')]);}return _0x51799a(_0x57cea2[_0x6fdf('0x9')][_0x6fdf('0xb')]);}else{_0x51799a(_0x57cea2[_0x6fdf('0xc')]);}})[_0x6fdf('0xd')](function(_0x46b66a){_0x41f164(_0x46b66a);});});}function respondWithResult(_0x1f4d11,_0x348557){_0x348557=_0x348557||0xc8;return function(_0x378c87){if(_0x378c87){return _0x1f4d11[_0x6fdf('0xe')](_0x348557)['json'](_0x378c87);}return _0x1f4d11['sendStatus'](0x194);};}function handleError(_0x41c710,_0x5776c7){_0x5776c7=_0x5776c7||0x1f4;return function(_0x105395){logger['error'](_0x105395[_0x6fdf('0xf')]);if(_0x105395[_0x6fdf('0x10')]){delete _0x105395[_0x6fdf('0x10')];}_0x41c710[_0x6fdf('0xe')](_0x5776c7)[_0x6fdf('0x11')](_0x105395);};}function findById(_0x21493f){return function(_0x37c50c){if(!_[_0x6fdf('0x12')](_0x21493f)&&!_[_0x6fdf('0x12')](_0x37c50c)&&!_[_0x6fdf('0x12')](_0x37c50c[_0x6fdf('0x13')])){return _[_0x6fdf('0x14')](_0x37c50c[_0x6fdf('0x13')],function(_0x40a5c0){return _0x40a5c0['id']==_0x21493f;});}return null;};}exports[_0x6fdf('0x15')]=function(_0x1f2742,_0x39f08b){return respondWithRpcPromise(_0x6fdf('0x16'),_0x1f2742['query'])['then'](respondWithResult(_0x39f08b,null))[_0x6fdf('0xd')](handleError(_0x39f08b,null));};exports[_0x6fdf('0x17')]=function(_0x23ebd0,_0x3796b5){return respondWithRpcPromise(_0x6fdf('0x18'),_[_0x6fdf('0x19')](_0x23ebd0[_0x6fdf('0x1a')],_0x23ebd0[_0x6fdf('0x1b')]))[_0x6fdf('0x8')](respondWithResult(_0x3796b5,null))[_0x6fdf('0xd')](handleError(_0x3796b5,null));};exports['voiceChannelStopMixMonitor']=function(_0x4be876,_0x272d81){return respondWithRpcPromise(_0x6fdf('0x1c'),_['merge'](_0x4be876[_0x6fdf('0x1a')],_0x4be876['params']))[_0x6fdf('0x8')](respondWithResult(_0x272d81,null))[_0x6fdf('0xd')](handleError(_0x272d81,null));};exports[_0x6fdf('0x1d')]=function(_0x2a05e0,_0x10075f){return respondWithRpcPromise(_0x6fdf('0x1e'),_0x2a05e0[_0x6fdf('0x1a')])[_0x6fdf('0x8')](respondWithResult(_0x10075f,null))[_0x6fdf('0xd')](handleError(_0x10075f,null));};exports[_0x6fdf('0x1f')]=function(_0x4e7078,_0x196941){return respondWithRpcPromise(_0x6fdf('0x1e'),_0x4e7078[_0x6fdf('0x1a')])[_0x6fdf('0x8')](findById(_0x4e7078[_0x6fdf('0x1b')]['id']))[_0x6fdf('0x8')](respondWithResult(_0x196941,null))[_0x6fdf('0xd')](handleError(_0x196941,null));};exports[_0x6fdf('0x20')]=function(_0x2e63ea,_0x1f9d4d){return respondWithRpcPromise(_0x6fdf('0x21'),_[_0x6fdf('0x19')](_0x2e63ea[_0x6fdf('0x1a')],_0x2e63ea['params']))[_0x6fdf('0x8')](respondWithResult(_0x1f9d4d,null))[_0x6fdf('0xd')](handleError(_0x1f9d4d,null));};exports[_0x6fdf('0x22')]=function(_0x11f2ac,_0xd11c1a){return respondWithRpcPromise('VoiceQueuesChannels',_0x11f2ac['query'])[_0x6fdf('0x8')](respondWithResult(_0xd11c1a,null))[_0x6fdf('0xd')](handleError(_0xd11c1a,null));};exports[_0x6fdf('0x23')]=function(_0x4ec445,_0x65c445){return respondWithRpcPromise(_0x6fdf('0x24'),_[_0x6fdf('0x19')](_0x4ec445[_0x6fdf('0x1a')],_0x4ec445[_0x6fdf('0x1b')]))[_0x6fdf('0x8')](respondWithResult(_0x65c445,null))[_0x6fdf('0xd')](handleError(_0x65c445,null));};exports['voiceQueuesChannelHangup']=function(_0x4af836,_0x444eb6){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x6fdf('0x19')](_0x4af836[_0x6fdf('0x1a')],_0x4af836[_0x6fdf('0x1b')]))[_0x6fdf('0x8')](respondWithResult(_0x444eb6,null))[_0x6fdf('0xd')](handleError(_0x444eb6,null));};exports[_0x6fdf('0x25')]=function(_0x5f4be3,_0x3076d1){return respondWithRpcPromise(_0x6fdf('0x26'),_[_0x6fdf('0x19')](_0x5f4be3[_0x6fdf('0x1a')],_0x5f4be3['params']))['then'](respondWithResult(_0x3076d1,null))[_0x6fdf('0xd')](handleError(_0x3076d1,null));};exports['outbound']=function(_0x541b4c,_0x19b13e){return respondWithRpcPromise(_0x6fdf('0x27'),_0x541b4c[_0x6fdf('0x1a')])[_0x6fdf('0x8')](respondWithResult(_0x19b13e,null))['catch'](handleError(_0x19b13e,null));};exports[_0x6fdf('0x28')]=function(_0x4b7325,_0xc51b45){return respondWithRpcPromise(_0x6fdf('0x29'),_0x4b7325[_0x6fdf('0x1a')])[_0x6fdf('0x8')](respondWithResult(_0xc51b45,null))[_0x6fdf('0xd')](handleError(_0xc51b45,null));};exports[_0x6fdf('0x2a')]=function(_0x4b76f8,_0x45db2a){var _0x3c9106;return respondWithRpcPromise(_0x6fdf('0x2b'),_0x4b76f8[_0x6fdf('0x1a')])[_0x6fdf('0x8')](function(_0x33263d){_0x3c9106=_0x33263d;return respondWithRpcPromise(_0x6fdf('0x2b'),_0x4b76f8[_0x6fdf('0x1a')],routingClient);})[_0x6fdf('0x8')](function(_0xa0c4a2){return _[_0x6fdf('0x19')]({},_0xa0c4a2,_0x3c9106);})['then'](respondWithResult(_0x45db2a,null))[_0x6fdf('0xd')](handleError(_0x45db2a,null));};exports[_0x6fdf('0x2c')]=function(_0x51d926,_0x437b36){if(_0x51d926['body']&&_0x51d926[_0x6fdf('0x2d')][_0x6fdf('0x2e')]&&_0x51d926['user']&&_0x51d926[_0x6fdf('0x2f')][_0x6fdf('0x10')]){for(var _0x3dd206 in _0x51d926['body'][_0x6fdf('0x2e')]){if(_0x51d926[_0x6fdf('0x2d')]['interaction'][_0x6fdf('0x30')](_0x3dd206)){db[_0x6fdf('0x31')][_0x6fdf('0x32')]({'where':{'channel':_0x3dd206,'membername':_0x51d926[_0x6fdf('0x2f')]['name'],'type':_0x6fdf('0x33'),'exitAt':null,'uniqueid':_0x51d926[_0x6fdf('0x2d')][_0x6fdf('0x2e')][_0x3dd206]&&_0x51d926[_0x6fdf('0x2d')]['interaction'][_0x3dd206][_0x6fdf('0x34')]?{'$notIn':_0x51d926[_0x6fdf('0x2d')]['interaction'][_0x3dd206]}:{'$ne':null}}})[_0x6fdf('0x8')](function(_0x323d53){var _0x13d63c=moment()['format'](_0x6fdf('0x35'));for(var _0x39ca37=0x0,_0x13627d=_0x323d53[_0x6fdf('0x34')];_0x39ca37<_0x13627d;_0x39ca37+=0x1){_0x323d53[_0x39ca37][_0x6fdf('0x36')]({'exitAt':_0x13d63c});}});for(var _0x176f09=0x0;_0x176f09<_0x51d926['body'][_0x6fdf('0x2e')][_0x3dd206][_0x6fdf('0x34')];_0x176f09+=0x1){db[_0x6fdf('0x31')]['findOrCreate']({'where':{'channel':_0x3dd206,'membername':_0x51d926[_0x6fdf('0x2f')][_0x6fdf('0x10')],'type':_0x6fdf('0x33'),'uniqueid':_0x51d926['body'][_0x6fdf('0x2e')][_0x3dd206][_0x176f09],'exitAt':null},'defaults':{'channel':_0x3dd206,'membername':_0x51d926[_0x6fdf('0x2f')][_0x6fdf('0x10')],'interface':_['isNil'](_0x51d926['user'][_0x6fdf('0x37')])?util[_0x6fdf('0x38')](_0x6fdf('0x39'),_0x51d926[_0x6fdf('0x2f')][_0x6fdf('0x10')]):_0x51d926['user'][_0x6fdf('0x37')],'type':'INTERACTION','enterAt':moment()[_0x6fdf('0x38')](_0x6fdf('0x35')),'role':_0x6fdf('0x3a'),'internal':_0x51d926[_0x6fdf('0x2f')]['internal'],'uniqueid':_0x51d926[_0x6fdf('0x2d')][_0x6fdf('0x2e')][_0x3dd206][_0x176f09]}});}}}}return respondWithRpcPromise(_0x6fdf('0x3b'),{'id':_0x51d926['params']['id'],'capacity':_0x51d926[_0x6fdf('0x2d')][_0x6fdf('0x3c')]},routingClient)[_0x6fdf('0x8')](respondWithResult(_0x437b36,null))['catch'](handleError(_0x437b36,null));};exports[_0x6fdf('0x3d')]=function(_0x37cf4c,_0x14a097){return respondWithRpcPromise(_0x6fdf('0x3e'),_0x37cf4c[_0x6fdf('0x1a')])['then'](respondWithResult(_0x14a097,null))['catch'](handleError(_0x14a097,null));};exports['trunks']=function(_0x23d739,_0x161b01){return respondWithRpcPromise(_0x6fdf('0x3f'),_0x23d739[_0x6fdf('0x1a')])[_0x6fdf('0x8')](respondWithResult(_0x161b01,null))[_0x6fdf('0xd')](handleError(_0x161b01,null));};exports['campaigns']=function(_0x253715,_0x2420f2){return respondWithRpcPromise(_0x6fdf('0x40'),_0x253715['query'])['then'](respondWithResult(_0x2420f2,null))['catch'](handleError(_0x2420f2,null));};exports[_0x6fdf('0x41')]=function(_0x5c4734,_0x896543){return respondWithRpcPromise(_0x6fdf('0x42'),_0x5c4734[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x896543,null))['catch'](handleError(_0x896543,null));};exports[_0x6fdf('0x43')]=function(_0x13fb45,_0x320633){return respondWithRpcPromise(_0x6fdf('0x42'),_0x13fb45[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](findById(_0x13fb45[_0x6fdf('0x1b')]['id']))[_0x6fdf('0x8')](respondWithResult(_0x320633,null))['catch'](handleError(_0x320633,null));};exports[_0x6fdf('0x44')]=function(_0xae1618,_0x475c09){return respondWithRpcPromise(_0x6fdf('0x45'),_0xae1618[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x475c09,null))[_0x6fdf('0xd')](handleError(_0x475c09,null));};exports[_0x6fdf('0x46')]=function(_0x1914a,_0x326352){return respondWithRpcPromise(_0x6fdf('0x45'),_0x1914a[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](findById(_0x1914a['params']['id']))[_0x6fdf('0x8')](respondWithResult(_0x326352,null))['catch'](handleError(_0x326352,null));};exports['mailAccounts']=function(_0xd66c73,_0x3c0845){return respondWithRpcPromise(_0x6fdf('0x47'),_0xd66c73[_0x6fdf('0x1a')],mailClient)[_0x6fdf('0x8')](respondWithResult(_0x3c0845,null))['catch'](handleError(_0x3c0845,null));};exports[_0x6fdf('0x48')]=function(_0x10d97f,_0x3a40e7){return respondWithRpcPromise(_0x6fdf('0x49'),_0x10d97f['query'],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x3a40e7,null))[_0x6fdf('0xd')](handleError(_0x3a40e7,null));};exports[_0x6fdf('0x4a')]=function(_0x5e4d1e,_0x5d3de4){return respondWithRpcPromise(_0x6fdf('0x49'),_0x5e4d1e[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](findById(_0x5e4d1e[_0x6fdf('0x1b')]['id']))['then'](respondWithResult(_0x5d3de4,null))[_0x6fdf('0xd')](handleError(_0x5d3de4,null));};exports['smsQueues']=function(_0x165567,_0x3c8929){return respondWithRpcPromise('SmsQueues',_0x165567[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x3c8929,null))['catch'](handleError(_0x3c8929,null));};exports[_0x6fdf('0x4b')]=function(_0x1bed78,_0x20065b){return respondWithRpcPromise(_0x6fdf('0x4c'),_0x1bed78[_0x6fdf('0x1a')],routingClient)['then'](findById(_0x1bed78[_0x6fdf('0x1b')]['id']))[_0x6fdf('0x8')](respondWithResult(_0x20065b,null))['catch'](handleError(_0x20065b,null));};exports[_0x6fdf('0x4d')]=function(_0x219054,_0x4a01f8){return respondWithRpcPromise(_0x6fdf('0x4e'),_0x219054[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x4a01f8,null))['catch'](handleError(_0x4a01f8,null));};exports[_0x6fdf('0x4f')]=function(_0x372aaa,_0x55fdb1){return respondWithRpcPromise(_0x6fdf('0x4e'),_0x372aaa[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](findById(_0x372aaa['params']['id']))[_0x6fdf('0x8')](respondWithResult(_0x55fdb1,null))[_0x6fdf('0xd')](handleError(_0x55fdb1,null));};exports['faxQueues']=function(_0x292c84,_0x18a520){return respondWithRpcPromise(_0x6fdf('0x50'),_0x292c84[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x18a520,null))[_0x6fdf('0xd')](handleError(_0x18a520,null));};exports[_0x6fdf('0x51')]=function(_0x547965,_0xf4db55){return respondWithRpcPromise('FaxQueues',_0x547965[_0x6fdf('0x1a')],routingClient)['then'](findById(_0x547965['params']['id']))[_0x6fdf('0x8')](respondWithResult(_0xf4db55,null))[_0x6fdf('0xd')](handleError(_0xf4db55,null));};exports['faxAccounts']=function(_0x3e4b49,_0x5812be){return respondWithRpcPromise('FaxAccounts',_0x3e4b49[_0x6fdf('0x1a')])[_0x6fdf('0x8')](respondWithResult(_0x5812be,null))[_0x6fdf('0xd')](handleError(_0x5812be,null));};exports['chatQueuesWaitingInteractions']=function(_0x5b8730,_0x54801c){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5b8730[_0x6fdf('0x1a')],routingClient)['then'](respondWithResult(_0x54801c,null))[_0x6fdf('0xd')](handleError(_0x54801c,null));};exports['mailQueuesWaitingInteractions']=function(_0x416f02,_0x30c61a){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x416f02[_0x6fdf('0x1a')],routingClient)['then'](respondWithResult(_0x30c61a,null))[_0x6fdf('0xd')](handleError(_0x30c61a,null));};exports[_0x6fdf('0x52')]=function(_0x3653c2,_0x299135){return respondWithRpcPromise(_0x6fdf('0x53'),_0x3653c2[_0x6fdf('0x1a')],routingClient)['then'](respondWithResult(_0x299135,null))[_0x6fdf('0xd')](handleError(_0x299135,null));};exports[_0x6fdf('0x54')]=function(_0x22abdb,_0x4eafa5){return respondWithRpcPromise(_0x6fdf('0x53'),_0x22abdb[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](function(_0x49533d){if(_0x22abdb[_0x6fdf('0x1a')][_0x6fdf('0x55')]!==undefined){var _0x44a91a=_(_0x49533d['rows'])[_0x6fdf('0x56')]([_0x22abdb['query'][_0x6fdf('0x55')],_0x22abdb['params']['id']])['map'](_0x6fdf('0x57'))['uniq']()[_0x6fdf('0x58')]();return _0x49533d['rows'][_0x6fdf('0x56')](function(_0x53ebc2){return _0x44a91a[_0x6fdf('0x59')](_0x53ebc2[_0x6fdf('0x57')])>-0x1;});}else{return _0x49533d[_0x6fdf('0x13')][_0x6fdf('0x56')](function(_0x1cd39c){return _0x1cd39c['queue_id']===parseInt(_0x22abdb[_0x6fdf('0x1b')]['id']);});}})[_0x6fdf('0x8')](respondWithResult(_0x4eafa5,null))[_0x6fdf('0xd')](handleError(_0x4eafa5,null));};exports[_0x6fdf('0x5a')]=function(_0x5837b1,_0x2760f8){return respondWithRpcPromise(_0x6fdf('0x5b'),_0x5837b1['query'],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x2760f8,null))[_0x6fdf('0xd')](handleError(_0x2760f8,null));};exports[_0x6fdf('0x5c')]=function(_0x11fe12,_0x192dd0){return respondWithRpcPromise(_0x6fdf('0x5d'),_0x11fe12['query'],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x192dd0,null))[_0x6fdf('0xd')](handleError(_0x192dd0,null));};exports[_0x6fdf('0x5e')]=function(_0x517740,_0xe27bc7){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x517740[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](respondWithResult(_0xe27bc7,null))[_0x6fdf('0xd')](handleError(_0xe27bc7,null));};exports[_0x6fdf('0x5f')]=function(_0x256e67){return function(_0x196eb0,_0x1db725){var _0x50b6ab,_0x189196;var _0x35c615=_[_0x6fdf('0x60')](_0x256e67);var _0x13383b=_0x256e67===_0x6fdf('0x61')?_0x6fdf('0x62'):_0x6fdf('0x63');return db[_0x35c615+'Queue'][_0x6fdf('0x64')]({'raw':!![],'where':{'id':_0x196eb0[_0x6fdf('0x1b')]['id']}})[_0x6fdf('0x8')](function(_0x327465){if(_[_0x6fdf('0x12')](_0x327465)){throw new Error(_0x35c615+_0x6fdf('0x65'));}_0x50b6ab=_0x327465;return db[_0x35c615+_0x6fdf('0x66')][_0x6fdf('0x64')]({'where':{'id':_0x196eb0[_0x6fdf('0x2d')][_0x6fdf('0x67')]},'include':[{'model':db[_0x35c615+_0x6fdf('0x68')],'as':_0x6fdf('0x68')},{'model':db[_0x35c615+_0x13383b],'as':'Account'}]});})['then'](function(_0x48e48f){if(_['isNil'](_0x48e48f)){throw new Error(_0x35c615+'\x20Message\x20not\x20found');}_0x189196=_0x48e48f;return _0x48e48f['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1f114c={'uniqueid':_0x256e67+'.'+_0x189196['id']+'.'+_0x189196[_0x6fdf('0x68')]['id'],'FromUserId':_0x196eb0[_0x6fdf('0x2f')]['id'],'type':'queue'};_0x1f114c[_0x35c615+_0x6fdf('0x69')]=_0x189196['id'];_0x1f114c[_0x35c615+_0x6fdf('0x6a')]=_0x189196[_0x6fdf('0x68')]['id'];_0x1f114c[_0x6fdf('0x6b')+_0x35c615+_0x13383b+'Id']=_0x189196[_0x6fdf('0x63')]['id'];_0x1f114c['To'+_0x35c615+_0x6fdf('0x6c')]=_0x50b6ab['id'];return db[_0x35c615+'TransferReport'][_0x6fdf('0x6d')](_0x1f114c);})[_0x6fdf('0x8')](function(){return respondWithRpcPromise(_0x6fdf('0x6e'),{'channel':_0x256e67,'interaction':_0x189196['Interaction'],'message':_0x189196,'account':_0x189196[_0x6fdf('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6fdf('0x6f'),'appdata':_0x50b6ab[_0x6fdf('0x10')]+','+(_0x189196[_0x6fdf('0x63')][_0x6fdf('0x70')]||0x12c),'interval':_0x6fdf('0x71')}]},routingClient);})[_0x6fdf('0x8')](respondWithResult(_0x1db725,null))['catch'](handleError(_0x1db725,null));};};exports[_0x6fdf('0x72')]=function(_0x13d7a3,_0x5e877d){var _0x2b999e,_0x2ddc96;if(_[_0x6fdf('0x12')](_0x13d7a3[_0x6fdf('0x2d')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x572741=_0x13d7a3['body'][_0x6fdf('0x73')];var _0x5ed5ba=_[_0x6fdf('0x60')](_0x572741);var _0x3f2eab=_0x572741===_0x6fdf('0x61')?_0x6fdf('0x62'):_0x6fdf('0x63');return db['User'][_0x6fdf('0x64')]({'raw':!![],'where':{'id':_0x13d7a3[_0x6fdf('0x1b')]['id'],'role':_0x6fdf('0x3a')}})[_0x6fdf('0x8')](function(_0x4b7855){if(_['isNil'](_0x4b7855)){throw new Error(_0x6fdf('0x74'));}_0x2b999e=_0x4b7855;return db[_0x5ed5ba+_0x6fdf('0x66')][_0x6fdf('0x64')]({'where':{'id':_0x13d7a3[_0x6fdf('0x2d')][_0x6fdf('0x67')]},'include':[{'model':db[_0x5ed5ba+_0x6fdf('0x68')],'as':_0x6fdf('0x68')},{'model':db[_0x5ed5ba+_0x3f2eab],'as':'Account'}]});})[_0x6fdf('0x8')](function(_0x31c418){if(_['isNil'](_0x31c418)){throw new Error(_0x5ed5ba+_0x6fdf('0x75'));}_0x2ddc96=_0x31c418;return _0x31c418[_0x6fdf('0x76')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4bad81={'uniqueid':_0x572741+'.'+_0x2ddc96['id']+'.'+_0x2ddc96[_0x6fdf('0x68')]['id'],'FromUserId':_0x13d7a3[_0x6fdf('0x2f')]['id'],'type':'queue','ToUserId':_0x2b999e['id']};_0x4bad81[_0x5ed5ba+'MessageId']=_0x2ddc96['id'];_0x4bad81[_0x5ed5ba+'InteractionId']=_0x2ddc96['Interaction']['id'];_0x4bad81[_0x6fdf('0x6b')+_0x5ed5ba+_0x3f2eab+'Id']=_0x2ddc96[_0x6fdf('0x63')]['id'];return db[_0x5ed5ba+_0x6fdf('0x77')]['create'](_0x4bad81);})[_0x6fdf('0x8')](function(){return respondWithRpcPromise(_0x6fdf('0x6e'),{'channel':_0x572741,'interaction':_0x2ddc96[_0x6fdf('0x68')],'message':_0x2ddc96,'account':_0x2ddc96['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x6fdf('0x3a'),'appdata':_0x2b999e[_0x6fdf('0x10')]+','+(_0x2ddc96[_0x6fdf('0x63')][_0x6fdf('0x78')]||0x12c),'interval':_0x6fdf('0x71')}]},routingClient);})['then'](respondWithResult(_0x5e877d,null))[_0x6fdf('0xd')](handleError(_0x5e877d,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 2f53279..1d2f229 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 _0x1f3d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','run','create','delete','destroy','exports','util','path','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f3d,0x129));var _0xd1f3=function(_0x4ed153,_0x5a6e7a){_0x4ed153=_0x4ed153-0x0;var _0x598d6e=_0x1f3d[_0x4ed153];return _0x598d6e;};'use strict';var multer=require('multer');var util=require(_0xd1f3('0x0'));var path=require(_0xd1f3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd1f3('0x2')]();var auth=require(_0xd1f3('0x3'));var interaction=require(_0xd1f3('0x4'));var config=require(_0xd1f3('0x5'));var controller=require(_0xd1f3('0x6'));router[_0xd1f3('0x7')]('/',auth[_0xd1f3('0x8')](),controller['index']);router[_0xd1f3('0x7')](_0xd1f3('0x9'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/run',auth[_0xd1f3('0x8')](),controller[_0xd1f3('0xa')]);router['post']('/',auth[_0xd1f3('0x8')](),controller[_0xd1f3('0xb')]);router['put'](_0xd1f3('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xd1f3('0xc')](_0xd1f3('0x9'),auth[_0xd1f3('0x8')](),controller[_0xd1f3('0xd')]);module[_0xd1f3('0xe')]=router; \ No newline at end of file +var _0xd374=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','/:id/run','run','put','delete','destroy','exports','multer'];(function(_0x4d199d,_0x308fdb){var _0x4005b5=function(_0x3de0a6){while(--_0x3de0a6){_0x4d199d['push'](_0x4d199d['shift']());}};_0x4005b5(++_0x308fdb);}(_0xd374,0x12b));var _0x4d37=function(_0x5824f4,_0x589538){_0x5824f4=_0x5824f4-0x0;var _0x1b800f=_0xd374[_0x5824f4];return _0x1b800f;};'use strict';var multer=require(_0x4d37('0x0'));var util=require('util');var path=require(_0x4d37('0x1'));var timeout=require(_0x4d37('0x2'));var express=require(_0x4d37('0x3'));var router=express[_0x4d37('0x4')]();var auth=require(_0x4d37('0x5'));var interaction=require(_0x4d37('0x6'));var config=require(_0x4d37('0x7'));var controller=require(_0x4d37('0x8'));router['get']('/',auth[_0x4d37('0x9')](),controller[_0x4d37('0xa')]);router[_0x4d37('0xb')](_0x4d37('0xc'),auth['isAuthenticated'](),controller[_0x4d37('0xd')]);router[_0x4d37('0xb')](_0x4d37('0xe'),auth[_0x4d37('0x9')](),controller[_0x4d37('0xf')]);router['post']('/',auth[_0x4d37('0x9')](),controller['create']);router[_0x4d37('0x10')](_0x4d37('0xc'),auth[_0x4d37('0x9')](),controller['update']);router[_0x4d37('0x11')]('/:id',auth[_0x4d37('0x9')](),controller[_0x4d37('0x12')]);module[_0x4d37('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 00522d4..d52fe64 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 _0x687b=['weeks','days','minutes','csv','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x687b,0x14a));var _0xb687=function(_0x14f6db,_0x4d9f26){_0x14f6db=_0x14f6db-0x0;var _0x45344d=_0x687b[_0x14f6db];return _0x45344d;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'name':{'type':Sequelize[_0xb687('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb687('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb687('0x3')},'startAt':{'type':Sequelize[_0xb687('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb687('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb687('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb687('0x6')](_0xb687('0x7'),_0xb687('0x8'),_0xb687('0x9'),_0xb687('0xa'),_0xb687('0xb'),'hours',_0xb687('0xc')),'allowNull':![],'defaultValue':_0xb687('0xb')},'output':{'type':Sequelize['ENUM'](_0xb687('0xd'),_0xb687('0xe'),_0xb687('0xf')),'allowNull':![],'defaultValue':_0xb687('0xd')},'type':{'type':Sequelize[_0xb687('0x6')](_0xb687('0x10'),_0xb687('0x11')),'allowNull':![],'defaultValue':_0xb687('0x10')},'sendMail':{'type':Sequelize[_0xb687('0x12')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xb687('0x13')]},'bcc':{'type':Sequelize[_0xb687('0x13')]},'sendIfEmpty':{'type':Sequelize[_0xb687('0x12')],'defaultValue':!![]}}; \ No newline at end of file +var _0x39d9=['years','months','days','hours','minutes','csv','pdf','custom','default','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x39d9,0x17f));var _0x939d=function(_0x197ee2,_0x241000){_0x197ee2=_0x197ee2-0x0;var _0x4cc669=_0x39d9[_0x197ee2];return _0x4cc669;};'use strict';var Sequelize=require(_0x939d('0x0'));module[_0x939d('0x1')]={'name':{'type':Sequelize[_0x939d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x939d('0x2')]},'active':{'type':Sequelize[_0x939d('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x939d('0x2')],'allowNull':![],'defaultValue':_0x939d('0x4')},'startAt':{'type':Sequelize[_0x939d('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x939d('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x939d('0x7')](_0x939d('0x8'),'quarters',_0x939d('0x9'),'weeks',_0x939d('0xa'),_0x939d('0xb'),_0x939d('0xc')),'allowNull':![],'defaultValue':_0x939d('0xa')},'output':{'type':Sequelize[_0x939d('0x7')](_0x939d('0xd'),_0x939d('0xe'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x939d('0x7')](_0x939d('0xf'),_0x939d('0x10')),'allowNull':![],'defaultValue':_0x939d('0xf')},'sendMail':{'type':Sequelize[_0x939d('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x939d('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 49fc34c..edc1277 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 _0xe02b=['nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','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/utils','../../config/environment','../../config/license/util','status','count','offset','limit','set','Content-Range','json','apply','reject','update','get','Scheduler','UserProfileResource','destroy','then','stack','name','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0xe02b,0x1ba));var _0xbe02=function(_0x236c13,_0x50cc9f){_0x236c13=_0x236c13-0x0;var _0x35aa66=_0xe02b[_0x236c13];return _0x35aa66;};'use strict';var pdf=require(_0xbe02('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbe02('0x1'));var zipdir=require(_0xbe02('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe02('0x3'));var moment=require(_0xbe02('0x4'));var BPromise=require(_0xbe02('0x5'));var Mustache=require('mustache');var util=require(_0xbe02('0x6'));var path=require(_0xbe02('0x7'));var sox=require(_0xbe02('0x8'));var csv=require(_0xbe02('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbe02('0xa'));var squel=require(_0xbe02('0xb'));var crypto=require(_0xbe02('0xc'));var jsforce=require(_0xbe02('0xd'));var deskjs=require(_0xbe02('0xe'));var toCsv=require(_0xbe02('0x9'));var querystring=require(_0xbe02('0xf'));var Papa=require(_0xbe02('0x10'));var Redis=require(_0xbe02('0x11'));var authService=require(_0xbe02('0x12'));var qs=require(_0xbe02('0x13'));var as=require(_0xbe02('0x14'));var hardwareService=require(_0xbe02('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xbe02('0x16'));var config=require(_0xbe02('0x17'));var licenseUtil=require(_0xbe02('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x314d3c,_0x3c7418){_0x3c7418=_0x3c7418||0xcc;return function(_0x25f120){if(_0x25f120){return _0x314d3c['sendStatus'](_0x3c7418);}return _0x314d3c[_0xbe02('0x19')](_0x3c7418)['end']();};}function respondWithResult(_0x46122c,_0xe91c3c){_0xe91c3c=_0xe91c3c||0xc8;return function(_0x4c553a){if(_0x4c553a){return _0x46122c['status'](_0xe91c3c)['json'](_0x4c553a);}};}function respondWithFilteredResult(_0xbd1a36,_0x8fccf0){return function(_0x189e85){if(_0x189e85){var _0x2d1482=_0x189e85[_0xbe02('0x1a')],_0x2d888e=_0x8fccf0[_0xbe02('0x1b')],_0x43e3c5=_0x8fccf0['offset']+_0x8fccf0[_0xbe02('0x1c')],_0x5a9942;if(_0x43e3c5>=_0x2d1482){_0x43e3c5=_0x2d1482;_0x5a9942=0xc8;}else{_0x5a9942=0xce;}_0xbd1a36[_0xbe02('0x19')](_0x5a9942);return _0xbd1a36[_0xbe02('0x1d')](_0xbe02('0x1e'),_0x2d888e+'-'+_0x43e3c5+'/'+_0x2d1482)[_0xbe02('0x1f')](_0x189e85);}return null;};}function patchUpdates(_0x1f24f1){return function(_0x11dbcc){try{jsonpatch[_0xbe02('0x20')](_0x11dbcc,_0x1f24f1,!![]);}catch(_0x19532a){return BPromise[_0xbe02('0x21')](_0x19532a);}return _0x11dbcc['save']();};}function saveUpdates(_0x2d936d,_0x36fe4d){return function(_0xfe104c){if(_0xfe104c){return _0xfe104c[_0xbe02('0x22')](_0x2d936d)['then'](function(_0x13fa24){return _0x13fa24;});}return null;};}function removeEntity(_0x366502,_0xc2cf44){return function(_0x2683e1){if(_0x2683e1){return _0x2683e1['destroy']()['then'](function(){var _0x11d192=_0x2683e1[_0xbe02('0x23')]({'plain':!![]});var _0x5200b8=_0xbe02('0x24');return db[_0xbe02('0x25')][_0xbe02('0x26')]({'where':{'type':_0x5200b8,'resourceId':_0x11d192['id']}})['then'](function(){return _0x2683e1;});})[_0xbe02('0x27')](function(){_0x366502[_0xbe02('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb4fb67,_0x2d77a5){return function(_0x399190){if(!_0x399190){_0xb4fb67['sendStatus'](0x194);}return _0x399190;};}function handleError(_0x2c4a37,_0x31e990){_0x31e990=_0x31e990||0x1f4;return function(_0x5ad0b6){logger['error'](_0x5ad0b6[_0xbe02('0x28')]);if(_0x5ad0b6[_0xbe02('0x29')]){delete _0x5ad0b6[_0xbe02('0x29')];}_0x2c4a37[_0xbe02('0x19')](_0x31e990)['send'](_0x5ad0b6);};}exports[_0xbe02('0x2a')]=function(_0x5e162e,_0x33f535){var _0xeec6e1={},_0x52ca2b={},_0x4e48d5={'count':0x0,'rows':[]};var _0xc91bc4=_[_0xbe02('0x2b')](db[_0xbe02('0x2c')][_0xbe02('0x2d')],function(_0xf31bb3){return{'name':_0xf31bb3[_0xbe02('0x2e')],'type':_0xf31bb3[_0xbe02('0x2f')][_0xbe02('0x30')]};});_0x52ca2b[_0xbe02('0x31')]=_[_0xbe02('0x2b')](_0xc91bc4,'name');_0x52ca2b[_0xbe02('0x32')]=_[_0xbe02('0x33')](_0x5e162e[_0xbe02('0x32')]);_0x52ca2b[_0xbe02('0x34')]=_[_0xbe02('0x35')](_0x52ca2b[_0xbe02('0x31')],_0x52ca2b[_0xbe02('0x32')]);_0xeec6e1[_0xbe02('0x36')]=_[_0xbe02('0x35')](_0x52ca2b[_0xbe02('0x31')],qs[_0xbe02('0x37')](_0x5e162e[_0xbe02('0x32')][_0xbe02('0x37')]));_0xeec6e1['attributes']=_0xeec6e1[_0xbe02('0x36')]['length']?_0xeec6e1[_0xbe02('0x36')]:_0x52ca2b[_0xbe02('0x31')];if(!_0x5e162e['query']['hasOwnProperty'](_0xbe02('0x38'))){_0xeec6e1[_0xbe02('0x1c')]=qs['limit'](_0x5e162e[_0xbe02('0x32')][_0xbe02('0x1c')]);_0xeec6e1[_0xbe02('0x1b')]=qs['offset'](_0x5e162e[_0xbe02('0x32')][_0xbe02('0x1b')]);}_0xeec6e1['order']=qs['sort'](_0x5e162e[_0xbe02('0x32')][_0xbe02('0x39')]);_0xeec6e1[_0xbe02('0x3a')]=qs[_0xbe02('0x34')](_[_0xbe02('0x3b')](_0x5e162e[_0xbe02('0x32')],_0x52ca2b[_0xbe02('0x34')]),_0xc91bc4);if(_0x5e162e['query'][_0xbe02('0x3c')]){_0xeec6e1[_0xbe02('0x3a')]=_[_0xbe02('0x3d')](_0xeec6e1[_0xbe02('0x3a')],{'$or':_['map'](_0xc91bc4,function(_0x19435b){if(_0x19435b['type']!=='VIRTUAL'){var _0x5d2d2e={};_0x5d2d2e[_0x19435b[_0xbe02('0x29')]]={'$like':'%'+_0x5e162e['query'][_0xbe02('0x3c')]+'%'};return _0x5d2d2e;}})});}_0xeec6e1=_[_0xbe02('0x3d')]({},_0xeec6e1,_0x5e162e[_0xbe02('0x3e')]);var _0x299ca8={'where':_0xeec6e1[_0xbe02('0x3a')]};return db['Schedule']['count'](_0x299ca8)[_0xbe02('0x27')](function(_0xd30f50){_0x4e48d5[_0xbe02('0x1a')]=_0xd30f50;if(_0x5e162e[_0xbe02('0x32')][_0xbe02('0x3f')]){_0xeec6e1[_0xbe02('0x40')]=[{'all':!![]}];}return db[_0xbe02('0x2c')][_0xbe02('0x41')](_0xeec6e1);})[_0xbe02('0x27')](function(_0x3b79ce){_0x4e48d5[_0xbe02('0x42')]=_0x3b79ce;return _0x4e48d5;})['then'](respondWithFilteredResult(_0x33f535,_0xeec6e1))['catch'](handleError(_0x33f535,null));};exports[_0xbe02('0x43')]=function(_0x4869ef,_0x18927b){var _0x60242={'raw':![],'where':{'id':_0x4869ef[_0xbe02('0x44')]['id']}},_0x431a97={};_0x431a97[_0xbe02('0x31')]=_['keys'](db['Schedule']['rawAttributes']);_0x431a97[_0xbe02('0x32')]=_[_0xbe02('0x33')](_0x4869ef[_0xbe02('0x32')]);_0x431a97[_0xbe02('0x34')]=_[_0xbe02('0x35')](_0x431a97[_0xbe02('0x31')],_0x431a97[_0xbe02('0x32')]);_0x60242['attributes']=_[_0xbe02('0x35')](_0x431a97[_0xbe02('0x31')],qs[_0xbe02('0x37')](_0x4869ef[_0xbe02('0x32')][_0xbe02('0x37')]));_0x60242[_0xbe02('0x36')]=_0x60242['attributes'][_0xbe02('0x45')]?_0x60242[_0xbe02('0x36')]:_0x431a97[_0xbe02('0x31')];if(_0x4869ef['query'][_0xbe02('0x3f')]){_0x60242[_0xbe02('0x40')]=[{'all':!![]}];}_0x60242=_['merge']({},_0x60242,_0x4869ef['options']);return db['Schedule'][_0xbe02('0x46')](_0x60242)[_0xbe02('0x27')](handleEntityNotFound(_0x18927b,null))[_0xbe02('0x27')](respondWithResult(_0x18927b,null))['catch'](handleError(_0x18927b,null));};exports[_0xbe02('0x47')]=function(_0x59a5db,_0x44e391){return db[_0xbe02('0x2c')][_0xbe02('0x47')](_0x59a5db[_0xbe02('0x48')],{})[_0xbe02('0x27')](function(_0x10c082){var _0x5a295b=_0x59a5db[_0xbe02('0x49')][_0xbe02('0x23')]({'plain':!![]});if(!_0x5a295b)throw new Error(_0xbe02('0x4a'));if(_0x5a295b[_0xbe02('0x4b')]===_0xbe02('0x49')){var _0x3b4e9b=_0x10c082[_0xbe02('0x23')]({'plain':!![]});var _0x2fdb82=_0xbe02('0x24');return db[_0xbe02('0x4c')][_0xbe02('0x46')]({'where':{'name':_0x2fdb82,'userProfileId':_0x5a295b[_0xbe02('0x4d')]},'raw':!![]})['then'](function(_0x3c5304){if(_0x3c5304&&_0x3c5304[_0xbe02('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x3b4e9b['name'],'resourceId':_0x3b4e9b['id'],'type':_0x3c5304[_0xbe02('0x29')],'sectionId':_0x3c5304['id']},{})[_0xbe02('0x27')](function(){return _0x10c082;});}else{return _0x10c082;}})[_0xbe02('0x4f')](function(_0x2ee270){logger['error'](_0xbe02('0x50'),_0x2ee270);throw _0x2ee270;});}return _0x10c082;})[_0xbe02('0x27')](respondWithResult(_0x44e391,0xc9))[_0xbe02('0x4f')](handleError(_0x44e391,null));};exports[_0xbe02('0x22')]=function(_0x2dafa6,_0x2c7d5e){if(_0x2dafa6[_0xbe02('0x48')]['id']){delete _0x2dafa6['body']['id'];}return db[_0xbe02('0x2c')][_0xbe02('0x46')]({'where':{'id':_0x2dafa6['params']['id']}})[_0xbe02('0x27')](handleEntityNotFound(_0x2c7d5e,null))[_0xbe02('0x27')](saveUpdates(_0x2dafa6[_0xbe02('0x48')],null))[_0xbe02('0x27')](respondWithResult(_0x2c7d5e,null))[_0xbe02('0x4f')](handleError(_0x2c7d5e,null));};exports['destroy']=function(_0x57aab0,_0x4cd0c8){return db[_0xbe02('0x2c')][_0xbe02('0x46')]({'where':{'id':_0x57aab0[_0xbe02('0x44')]['id']}})[_0xbe02('0x27')](handleEntityNotFound(_0x4cd0c8,null))['then'](removeEntity(_0x4cd0c8,null))[_0xbe02('0x4f')](handleError(_0x4cd0c8,null));};exports[_0xbe02('0x51')]=function(_0x39703a,_0x9fc9c,_0x44a23c){var _0x4c6cef=require(_0xbe02('0x52'));return db['Schedule'][_0xbe02('0x46')]({'where':{'id':_0x39703a[_0xbe02('0x44')]['id']},'raw':!![]})[_0xbe02('0x27')](handleEntityNotFound(_0x9fc9c,null))['then'](function(){_0x4c6cef[_0xbe02('0x51')](_0x39703a[_0xbe02('0x44')]['id']);})[_0xbe02('0x27')](respondWithStatusCode(_0x9fc9c,null))['catch'](handleError(_0x9fc9c,null));}; \ No newline at end of file +var _0x6c91=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','include','findAll','rows','intersection','includeAll','merge','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Scheduler','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','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','destroy','then','end','error','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c91,0x7a));var _0x16c9=function(_0x50ce90,_0x134a0f){_0x50ce90=_0x50ce90-0x0;var _0x212fc9=_0x6c91[_0x50ce90];return _0x212fc9;};'use strict';var pdf=require(_0x16c9('0x0'));var emlformat=require(_0x16c9('0x1'));var rimraf=require(_0x16c9('0x2'));var zipdir=require(_0x16c9('0x3'));var jsonpatch=require(_0x16c9('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x16c9('0x5'));var Mustache=require(_0x16c9('0x6'));var util=require('util');var path=require(_0x16c9('0x7'));var sox=require(_0x16c9('0x8'));var csv=require(_0x16c9('0x9'));var ejs=require(_0x16c9('0xa'));var fs=require('fs');var _=require(_0x16c9('0xb'));var squel=require('squel');var crypto=require(_0x16c9('0xc'));var jsforce=require(_0x16c9('0xd'));var deskjs=require(_0x16c9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x16c9('0xf'));var Redis=require(_0x16c9('0x10'));var authService=require(_0x16c9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x16c9('0x12'));var hardwareService=require(_0x16c9('0x13'));var logger=require(_0x16c9('0x14'))('api');var utils=require(_0x16c9('0x15'));var config=require(_0x16c9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x16c9('0x17'))['db'];function respondWithStatusCode(_0x25250f,_0x3e2c5c){_0x3e2c5c=_0x3e2c5c||0xcc;return function(_0x378b24){if(_0x378b24){return _0x25250f[_0x16c9('0x18')](_0x3e2c5c);}return _0x25250f[_0x16c9('0x19')](_0x3e2c5c)['end']();};}function respondWithResult(_0x217536,_0x2843b7){_0x2843b7=_0x2843b7||0xc8;return function(_0x15d202){if(_0x15d202){return _0x217536[_0x16c9('0x19')](_0x2843b7)[_0x16c9('0x1a')](_0x15d202);}};}function respondWithFilteredResult(_0x6f2a1d,_0x46d778){return function(_0x4a1009){if(_0x4a1009){var _0x395cb5=_0x4a1009[_0x16c9('0x1b')],_0x2bb2f2=_0x46d778[_0x16c9('0x1c')],_0x6187da=_0x46d778['offset']+_0x46d778[_0x16c9('0x1d')],_0x37157c;if(_0x6187da>=_0x395cb5){_0x6187da=_0x395cb5;_0x37157c=0xc8;}else{_0x37157c=0xce;}_0x6f2a1d[_0x16c9('0x19')](_0x37157c);return _0x6f2a1d[_0x16c9('0x1e')](_0x16c9('0x1f'),_0x2bb2f2+'-'+_0x6187da+'/'+_0x395cb5)[_0x16c9('0x1a')](_0x4a1009);}return null;};}function patchUpdates(_0x3adb5a){return function(_0xf7059a){try{jsonpatch[_0x16c9('0x20')](_0xf7059a,_0x3adb5a,!![]);}catch(_0x150aec){return BPromise[_0x16c9('0x21')](_0x150aec);}return _0xf7059a['save']();};}function saveUpdates(_0xde32b1,_0x1a6c56){return function(_0x5dbf1b){if(_0x5dbf1b){return _0x5dbf1b[_0x16c9('0x22')](_0xde32b1)['then'](function(_0x4f3123){return _0x4f3123;});}return null;};}function removeEntity(_0x11ee75,_0x6077f5){return function(_0x1caeaa){if(_0x1caeaa){return _0x1caeaa[_0x16c9('0x23')]()['then'](function(){var _0x19d13b=_0x1caeaa['get']({'plain':!![]});var _0x6185e3='Scheduler';return db['UserProfileResource']['destroy']({'where':{'type':_0x6185e3,'resourceId':_0x19d13b['id']}})[_0x16c9('0x24')](function(){return _0x1caeaa;});})[_0x16c9('0x24')](function(){_0x11ee75[_0x16c9('0x19')](0xcc)[_0x16c9('0x25')]();});}};}function handleEntityNotFound(_0x5eaa42,_0x519c35){return function(_0x239f94){if(!_0x239f94){_0x5eaa42[_0x16c9('0x18')](0x194);}return _0x239f94;};}function handleError(_0x12ee90,_0xd4abe6){_0xd4abe6=_0xd4abe6||0x1f4;return function(_0xcef46e){logger[_0x16c9('0x26')](_0xcef46e['stack']);if(_0xcef46e[_0x16c9('0x27')]){delete _0xcef46e[_0x16c9('0x27')];}_0x12ee90[_0x16c9('0x19')](_0xd4abe6)[_0x16c9('0x28')](_0xcef46e);};}exports[_0x16c9('0x29')]=function(_0x110d72,_0x197c6e){var _0x52a174={},_0x15b7ba={},_0x14964f={'count':0x0,'rows':[]};var _0x3d8f63=_['map'](db[_0x16c9('0x2a')][_0x16c9('0x2b')],function(_0x3a9760){return{'name':_0x3a9760[_0x16c9('0x2c')],'type':_0x3a9760[_0x16c9('0x2d')][_0x16c9('0x2e')]};});_0x15b7ba[_0x16c9('0x2f')]=_[_0x16c9('0x30')](_0x3d8f63,'name');_0x15b7ba[_0x16c9('0x31')]=_[_0x16c9('0x32')](_0x110d72[_0x16c9('0x31')]);_0x15b7ba[_0x16c9('0x33')]=_['intersection'](_0x15b7ba['model'],_0x15b7ba['query']);_0x52a174[_0x16c9('0x34')]=_['intersection'](_0x15b7ba[_0x16c9('0x2f')],qs[_0x16c9('0x35')](_0x110d72['query'][_0x16c9('0x35')]));_0x52a174['attributes']=_0x52a174[_0x16c9('0x34')][_0x16c9('0x36')]?_0x52a174[_0x16c9('0x34')]:_0x15b7ba[_0x16c9('0x2f')];if(!_0x110d72['query'][_0x16c9('0x37')](_0x16c9('0x38'))){_0x52a174[_0x16c9('0x1d')]=qs[_0x16c9('0x1d')](_0x110d72[_0x16c9('0x31')]['limit']);_0x52a174[_0x16c9('0x1c')]=qs['offset'](_0x110d72[_0x16c9('0x31')][_0x16c9('0x1c')]);}_0x52a174[_0x16c9('0x39')]=qs[_0x16c9('0x3a')](_0x110d72[_0x16c9('0x31')]['sort']);_0x52a174[_0x16c9('0x3b')]=qs[_0x16c9('0x33')](_[_0x16c9('0x3c')](_0x110d72[_0x16c9('0x31')],_0x15b7ba[_0x16c9('0x33')]),_0x3d8f63);if(_0x110d72[_0x16c9('0x31')][_0x16c9('0x3d')]){_0x52a174['where']=_['merge'](_0x52a174['where'],{'$or':_[_0x16c9('0x30')](_0x3d8f63,function(_0x2a60e3){if(_0x2a60e3['type']!==_0x16c9('0x3e')){var _0x354656={};_0x354656[_0x2a60e3[_0x16c9('0x27')]]={'$like':'%'+_0x110d72[_0x16c9('0x31')][_0x16c9('0x3d')]+'%'};return _0x354656;}})});}_0x52a174=_['merge']({},_0x52a174,_0x110d72['options']);var _0x66f72d={'where':_0x52a174['where']};return db[_0x16c9('0x2a')][_0x16c9('0x1b')](_0x66f72d)[_0x16c9('0x24')](function(_0x13f6e1){_0x14964f[_0x16c9('0x1b')]=_0x13f6e1;if(_0x110d72[_0x16c9('0x31')]['includeAll']){_0x52a174[_0x16c9('0x3f')]=[{'all':!![]}];}return db[_0x16c9('0x2a')][_0x16c9('0x40')](_0x52a174);})[_0x16c9('0x24')](function(_0x37eb5c){_0x14964f[_0x16c9('0x41')]=_0x37eb5c;return _0x14964f;})[_0x16c9('0x24')](respondWithFilteredResult(_0x197c6e,_0x52a174))['catch'](handleError(_0x197c6e,null));};exports['show']=function(_0x348d78,_0x2281b8){var _0x46fc8f={'raw':![],'where':{'id':_0x348d78['params']['id']}},_0x3d38dd={};_0x3d38dd[_0x16c9('0x2f')]=_['keys'](db[_0x16c9('0x2a')][_0x16c9('0x2b')]);_0x3d38dd[_0x16c9('0x31')]=_[_0x16c9('0x32')](_0x348d78[_0x16c9('0x31')]);_0x3d38dd[_0x16c9('0x33')]=_[_0x16c9('0x42')](_0x3d38dd[_0x16c9('0x2f')],_0x3d38dd[_0x16c9('0x31')]);_0x46fc8f['attributes']=_[_0x16c9('0x42')](_0x3d38dd['model'],qs[_0x16c9('0x35')](_0x348d78[_0x16c9('0x31')][_0x16c9('0x35')]));_0x46fc8f['attributes']=_0x46fc8f['attributes'][_0x16c9('0x36')]?_0x46fc8f['attributes']:_0x3d38dd['model'];if(_0x348d78[_0x16c9('0x31')][_0x16c9('0x43')]){_0x46fc8f[_0x16c9('0x3f')]=[{'all':!![]}];}_0x46fc8f=_[_0x16c9('0x44')]({},_0x46fc8f,_0x348d78[_0x16c9('0x45')]);return db[_0x16c9('0x2a')]['find'](_0x46fc8f)[_0x16c9('0x24')](handleEntityNotFound(_0x2281b8,null))[_0x16c9('0x24')](respondWithResult(_0x2281b8,null))['catch'](handleError(_0x2281b8,null));};exports[_0x16c9('0x46')]=function(_0x1296b5,_0x553ea7){return db[_0x16c9('0x2a')]['create'](_0x1296b5[_0x16c9('0x47')],{})['then'](function(_0xf15167){var _0x4b9ef3=_0x1296b5['user'][_0x16c9('0x48')]({'plain':!![]});if(!_0x4b9ef3)throw new Error(_0x16c9('0x49'));if(_0x4b9ef3[_0x16c9('0x4a')]===_0x16c9('0x4b')){var _0x55a9b3=_0xf15167[_0x16c9('0x48')]({'plain':!![]});var _0x271c4f=_0x16c9('0x4c');return db[_0x16c9('0x4d')][_0x16c9('0x4e')]({'where':{'name':_0x271c4f,'userProfileId':_0x4b9ef3[_0x16c9('0x4f')]},'raw':!![]})['then'](function(_0x2f0baa){if(_0x2f0baa&&_0x2f0baa[_0x16c9('0x50')]===0x0){return db[_0x16c9('0x51')][_0x16c9('0x46')]({'name':_0x55a9b3[_0x16c9('0x27')],'resourceId':_0x55a9b3['id'],'type':_0x2f0baa[_0x16c9('0x27')],'sectionId':_0x2f0baa['id']},{})[_0x16c9('0x24')](function(){return _0xf15167;});}else{return _0xf15167;}})[_0x16c9('0x52')](function(_0x380c1f){logger[_0x16c9('0x26')](_0x16c9('0x53'),_0x380c1f);throw _0x380c1f;});}return _0xf15167;})[_0x16c9('0x24')](respondWithResult(_0x553ea7,0xc9))[_0x16c9('0x52')](handleError(_0x553ea7,null));};exports[_0x16c9('0x22')]=function(_0x284be9,_0x56975e){if(_0x284be9['body']['id']){delete _0x284be9[_0x16c9('0x47')]['id'];}return db['Schedule'][_0x16c9('0x4e')]({'where':{'id':_0x284be9[_0x16c9('0x54')]['id']}})[_0x16c9('0x24')](handleEntityNotFound(_0x56975e,null))[_0x16c9('0x24')](saveUpdates(_0x284be9[_0x16c9('0x47')],null))[_0x16c9('0x24')](respondWithResult(_0x56975e,null))[_0x16c9('0x52')](handleError(_0x56975e,null));};exports[_0x16c9('0x23')]=function(_0x2cace0,_0x33f188){return db['Schedule'][_0x16c9('0x4e')]({'where':{'id':_0x2cace0[_0x16c9('0x54')]['id']}})['then'](handleEntityNotFound(_0x33f188,null))[_0x16c9('0x24')](removeEntity(_0x33f188,null))[_0x16c9('0x52')](handleError(_0x33f188,null));};exports[_0x16c9('0x55')]=function(_0x3b86c3,_0x20f1ab,_0xa84c99){var _0x391e26=require(_0x16c9('0x56'));return db[_0x16c9('0x2a')][_0x16c9('0x4e')]({'where':{'id':_0x3b86c3[_0x16c9('0x54')]['id']},'raw':!![]})[_0x16c9('0x24')](handleEntityNotFound(_0x20f1ab,null))[_0x16c9('0x24')](function(){_0x391e26[_0x16c9('0x55')](_0x3b86c3['params']['id']);})[_0x16c9('0x24')](respondWithStatusCode(_0x20f1ab,null))['catch'](handleError(_0x20f1ab,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index a7a85de..e0dbd5c 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 _0xb474=['define','Schedule','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0xdf51bf,_0x559419){var _0x545aa4=function(_0x3cff04){while(--_0x3cff04){_0xdf51bf['push'](_0xdf51bf['shift']());}};_0x545aa4(++_0x559419);}(_0xb474,0xac));var _0x4b47=function(_0x3d7978,_0x15709d){_0x3d7978=_0x3d7978-0x0;var _0x3a6a4d=_0xb474[_0x3d7978];return _0x3a6a4d;};'use strict';var _=require(_0x4b47('0x0'));var util=require(_0x4b47('0x1'));var logger=require(_0x4b47('0x2'))(_0x4b47('0x3'));var moment=require(_0x4b47('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b47('0x5'));var rimraf=require(_0x4b47('0x6'));var config=require(_0x4b47('0x7'));var attributes=require('./schedule.attributes');module['exports']=function(_0xaaa7bb,_0x508098){return _0xaaa7bb[_0x4b47('0x8')](_0x4b47('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8932=['../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','lodash','api','request-promise','path','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8932,0xa5));var _0x2893=function(_0x55298e,_0x43c1e3){_0x55298e=_0x55298e-0x0;var _0x3aa916=_0x8932[_0x55298e];return _0x3aa916;};'use strict';var _=require(_0x2893('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2893('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2893('0x2'));var fs=require('fs');var path=require(_0x2893('0x3'));var rimraf=require(_0x2893('0x4'));var config=require(_0x2893('0x5'));var attributes=require(_0x2893('0x6'));module['exports']=function(_0x41c4a4,_0x35f842){return _0x41c4a4[_0x2893('0x7')](_0x2893('0x8'),attributes,{'tableName':_0x2893('0x9'),'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 fab2624..d8709d1 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 _0x5aa3=['result','lodash','bluebird','randomstring','../../config/logger','rpc','../../config/environment','http','Schedule,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info'];(function(_0x5c950c,_0xd89946){var _0x5b6e8f=function(_0x442c69){while(--_0x442c69){_0x5c950c['push'](_0x5c950c['shift']());}};_0x5b6e8f(++_0xd89946);}(_0x5aa3,0x1e1));var _0x35aa=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x5aa3[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x35aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x35aa('0x1'));var rs=require(_0x35aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x35aa('0x3'))(_0x35aa('0x4'));var config=require(_0x35aa('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x35aa('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2675d3,_0x249e07,_0x37a55e){return new BPromise(function(_0x5349af,_0x3e43ba){return client['request'](_0x2675d3,_0x37a55e)['then'](function(_0x1e5398){logger['info'](_0x35aa('0x7'),_0x249e07,_0x35aa('0x8'));logger[_0x35aa('0x9')]('Schedule,\x20%s,\x20%s,\x20%s',_0x249e07,_0x35aa('0x8'),JSON['stringify'](_0x1e5398));if(_0x1e5398[_0x35aa('0xa')]){if(_0x1e5398[_0x35aa('0xa')][_0x35aa('0xb')]===0x1f4){logger[_0x35aa('0xa')](_0x35aa('0x7'),_0x249e07,_0x1e5398[_0x35aa('0xa')][_0x35aa('0xc')]);return _0x3e43ba(_0x1e5398[_0x35aa('0xa')][_0x35aa('0xc')]);}logger[_0x35aa('0xa')](_0x35aa('0x7'),_0x249e07,_0x1e5398[_0x35aa('0xa')][_0x35aa('0xc')]);return _0x5349af(_0x1e5398[_0x35aa('0xa')][_0x35aa('0xc')]);}else{logger[_0x35aa('0xd')](_0x35aa('0x7'),_0x249e07,_0x35aa('0x8'));_0x5349af(_0x1e5398[_0x35aa('0xe')]['message']);}})['catch'](function(_0x58e393){logger[_0x35aa('0xa')](_0x35aa('0x7'),_0x249e07,_0x58e393);_0x3e43ba(_0x58e393);});});} \ No newline at end of file +var _0x2f22=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x1233a7,_0x377b60){var _0x18e0eb=function(_0x43dfd2){while(--_0x43dfd2){_0x1233a7['push'](_0x1233a7['shift']());}};_0x18e0eb(++_0x377b60);}(_0x2f22,0xe7));var _0x22f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f22[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x22f2('0x0'));var moment=require(_0x22f2('0x1'));var BPromise=require(_0x22f2('0x2'));var rs=require(_0x22f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22f2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x22f2('0x5'))('rpc');var config=require(_0x22f2('0x6'));var jayson=require(_0x22f2('0x7'));var client=jayson['client'][_0x22f2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d22ba,_0x43ec6c,_0x1a5487){return new BPromise(function(_0x4f340e,_0x35d271){return client[_0x22f2('0x9')](_0x4d22ba,_0x1a5487)[_0x22f2('0xa')](function(_0x1d53a2){logger['info'](_0x22f2('0xb'),_0x43ec6c,_0x22f2('0xc'));logger[_0x22f2('0xd')](_0x22f2('0xe'),_0x43ec6c,'request\x20sent',JSON[_0x22f2('0xf')](_0x1d53a2));if(_0x1d53a2[_0x22f2('0x10')]){if(_0x1d53a2[_0x22f2('0x10')][_0x22f2('0x11')]===0x1f4){logger[_0x22f2('0x10')](_0x22f2('0xb'),_0x43ec6c,_0x1d53a2['error'][_0x22f2('0x12')]);return _0x35d271(_0x1d53a2[_0x22f2('0x10')][_0x22f2('0x12')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x43ec6c,_0x1d53a2[_0x22f2('0x10')]['message']);return _0x4f340e(_0x1d53a2['error'][_0x22f2('0x12')]);}else{logger[_0x22f2('0x13')](_0x22f2('0xb'),_0x43ec6c,_0x22f2('0xc'));_0x4f340e(_0x1d53a2[_0x22f2('0x14')]['message']);}})['catch'](function(_0x4dd401){logger[_0x22f2('0x10')](_0x22f2('0xb'),_0x43ec6c,_0x4dd401);_0x35d271(_0x4dd401);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 47f435c..71e73c4 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 _0xe10c=['multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','create','update','delete','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe10c,0x1e0));var _0xce10=function(_0x1733fd,_0x2e44a9){_0x1733fd=_0x1733fd-0x0;var _0x22e955=_0xe10c[_0x1733fd];return _0x22e955;};'use strict';var multer=require(_0xce10('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xce10('0x1'));var express=require(_0xce10('0x2'));var router=express[_0xce10('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xce10('0x4'));var config=require(_0xce10('0x5'));var controller=require(_0xce10('0x6'));router[_0xce10('0x7')]('/',auth[_0xce10('0x8')](),controller[_0xce10('0x9')]);router['get'](_0xce10('0xa'),auth[_0xce10('0x8')](),controller[_0xce10('0xb')]);router[_0xce10('0x7')](_0xce10('0xc'),auth[_0xce10('0x8')](),controller['show']);router['get'](_0xce10('0xd'),auth[_0xce10('0x8')](),controller[_0xce10('0xe')]);router[_0xce10('0xf')]('/',auth[_0xce10('0x8')](),controller[_0xce10('0x10')]);router['put']('/:id',auth[_0xce10('0x8')](),controller[_0xce10('0x11')]);router[_0xce10('0x12')]('/:id',auth[_0xce10('0x8')](),controller['destroy']);module[_0xce10('0x13')]=router; \ No newline at end of file +var _0xe58a=['../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','/:id/download','download','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x5b93d2,_0x1ca258){var _0xa8786d=function(_0x271f3b){while(--_0x271f3b){_0x5b93d2['push'](_0x5b93d2['shift']());}};_0xa8786d(++_0x1ca258);}(_0xe58a,0x19f));var _0xae58=function(_0x31dd31,_0x142a2f){_0x31dd31=_0x31dd31-0x0;var _0x4117f9=_0xe58a[_0x31dd31];return _0x4117f9;};'use strict';var multer=require(_0xae58('0x0'));var util=require(_0xae58('0x1'));var path=require(_0xae58('0x2'));var timeout=require(_0xae58('0x3'));var express=require('express');var router=express[_0xae58('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xae58('0x5'));var config=require(_0xae58('0x6'));var controller=require(_0xae58('0x7'));router['get']('/',auth[_0xae58('0x8')](),controller[_0xae58('0x9')]);router[_0xae58('0xa')](_0xae58('0xb'),auth[_0xae58('0x8')](),controller['describe']);router[_0xae58('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xae58('0xa')](_0xae58('0xc'),auth[_0xae58('0x8')](),controller[_0xae58('0xd')]);router[_0xae58('0xe')]('/',auth[_0xae58('0x8')](),controller['create']);router[_0xae58('0xf')](_0xae58('0x10'),auth[_0xae58('0x8')](),controller[_0xae58('0x11')]);router[_0xae58('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xae58('0x13')]);module[_0xae58('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index d2b1f4e..62db5cb 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 _0x9f62=['exports','VIRTUAL','extname','getDataValue','value','STRING','replace','setDataValue','startedAt','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','../../config/environment'];(function(_0xb2eb9,_0x30c85b){var _0x53d698=function(_0x532900){while(--_0x532900){_0xb2eb9['push'](_0xb2eb9['shift']());}};_0x53d698(++_0x30c85b);}(_0x9f62,0x154));var _0x29f6=function(_0x51fe0a,_0x4841bd){_0x51fe0a=_0x51fe0a-0x0;var _0x5b8ff7=_0x9f62[_0x51fe0a];return _0x5b8ff7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x29f6('0x0'));var path=require('path');var config=require(_0x29f6('0x1'));module[_0x29f6('0x2')]={'format':{'type':Sequelize[_0x29f6('0x3')],'get':function(){return this['getDataValue']('value')?path[_0x29f6('0x4')](this[_0x29f6('0x5')](_0x29f6('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x29f6('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x29f6('0x7')],'set':function(_0x272876){var _0x9a43fe=_0x272876[_0x29f6('0x8')](/\\/g,'/');this[_0x29f6('0x9')]('value',_0x9a43fe);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x549f64){this[_0x29f6('0x9')](_0x29f6('0xa'),moment()['subtract'](_0x549f64,'ms'));this['setDataValue'](_0x29f6('0xb'),moment());this[_0x29f6('0x9')]('duration',_0x549f64);}},'startedAt':{'type':Sequelize[_0x29f6('0xc')],'get':function(){return moment(this[_0x29f6('0x5')]('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0x29f6('0xc')],'get':function(){return moment(this[_0x29f6('0x5')](_0x29f6('0xb')))[_0x29f6('0xd')](_0x29f6('0xe'))[_0x29f6('0xf')]();}},'createdAt':{'type':Sequelize[_0x29f6('0xc')],'get':function(){return moment(this[_0x29f6('0x5')](_0x29f6('0x10')))[_0x29f6('0xd')](_0x29f6('0xe'))[_0x29f6('0xf')]();}},'updatedAt':{'type':Sequelize[_0x29f6('0xc')],'get':function(){return moment(this[_0x29f6('0x5')](_0x29f6('0x11')))[_0x29f6('0xd')](_0x29f6('0xe'))['toString']();}}}; \ No newline at end of file +var _0x5fc3=['duration','startedAt','toString','closedAt','format','MM-DD-YYYY\x20HH:mm','DATE','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','subtract'];(function(_0x3e6832,_0xd3ce6d){var _0x41410c=function(_0x5cf605){while(--_0x5cf605){_0x3e6832['push'](_0x3e6832['shift']());}};_0x41410c(++_0xd3ce6d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x5fc3[_0x5ebc04];return _0x17845c;};'use strict';var Sequelize=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));var path=require('path');var config=require(_0x35fc('0x2'));module[_0x35fc('0x3')]={'format':{'type':Sequelize[_0x35fc('0x4')],'get':function(){return this[_0x35fc('0x5')](_0x35fc('0x6'))?path['extname'](this[_0x35fc('0x5')](_0x35fc('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x35fc('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x19a0d1){var _0x508b32=_0x19a0d1[_0x35fc('0x8')](/\\/g,'/');this[_0x35fc('0x9')](_0x35fc('0x6'),_0x508b32);}},'rating':{'type':Sequelize[_0x35fc('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x35fc('0xa')],'set':function(_0xf9d3a6){this[_0x35fc('0x9')]('startedAt',moment()[_0x35fc('0xb')](_0xf9d3a6,'ms'));this[_0x35fc('0x9')]('closedAt',moment());this[_0x35fc('0x9')](_0x35fc('0xc'),_0xf9d3a6);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x35fc('0x5')](_0x35fc('0xd')))['format']('MM-DD-YYYY\x20HH:mm')[_0x35fc('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x35fc('0x5')](_0x35fc('0xf')))[_0x35fc('0x10')](_0x35fc('0x11'))[_0x35fc('0xe')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('createdAt'))['format'](_0x35fc('0x11'))[_0x35fc('0xe')]();}},'updatedAt':{'type':Sequelize[_0x35fc('0x12')],'get':function(){return moment(this[_0x35fc('0x5')](_0x35fc('0x13')))[_0x35fc('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x35fc('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 11b2caf..8db910d 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 _0x9da5=['fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','differenceBy','format','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x11d95f,_0x34f442){var _0x2b1a14=function(_0x3a4fa5){while(--_0x3a4fa5){_0x11d95f['push'](_0x11d95f['shift']());}};_0x2b1a14(++_0x34f442);}(_0x9da5,0x1a4));var _0x59da=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0x9da5[_0x17c8cc];return _0x3db4eb;};'use strict';var pdf=require(_0x59da('0x0'));var emlformat=require(_0x59da('0x1'));var rimraf=require(_0x59da('0x2'));var zipdir=require(_0x59da('0x3'));var jsonpatch=require(_0x59da('0x4'));var rp=require(_0x59da('0x5'));var moment=require(_0x59da('0x6'));var BPromise=require(_0x59da('0x7'));var Mustache=require('mustache');var util=require(_0x59da('0x8'));var path=require(_0x59da('0x9'));var sox=require('sox');var csv=require(_0x59da('0xa'));var ejs=require(_0x59da('0xb'));var fs=require('fs');var _=require(_0x59da('0xc'));var squel=require(_0x59da('0xd'));var crypto=require(_0x59da('0xe'));var jsforce=require(_0x59da('0xf'));var deskjs=require(_0x59da('0x10'));var toCsv=require(_0x59da('0xa'));var querystring=require(_0x59da('0x11'));var Papa=require('papaparse');var Redis=require(_0x59da('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x59da('0x13'));var as=require(_0x59da('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59da('0x15'))(_0x59da('0x16'));var utils=require('../../config/utils');var config=require(_0x59da('0x17'));var licenseUtil=require(_0x59da('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xce1eb3,_0x265396){_0x265396=_0x265396||0xcc;return function(_0x2c312f){if(_0x2c312f){return _0xce1eb3[_0x59da('0x19')](_0x265396);}return _0xce1eb3[_0x59da('0x1a')](_0x265396)[_0x59da('0x1b')]();};}function respondWithResult(_0x539241,_0x5cac5c){_0x5cac5c=_0x5cac5c||0xc8;return function(_0x24adff){if(_0x24adff){return _0x539241['status'](_0x5cac5c)[_0x59da('0x1c')](_0x24adff);}};}function respondWithFilteredResult(_0x7af379,_0x10ba79){return function(_0x3dd97d){if(_0x3dd97d){var _0x4c6ecc=_0x3dd97d[_0x59da('0x1d')],_0x5dee29=_0x10ba79[_0x59da('0x1e')],_0x11c603=_0x10ba79[_0x59da('0x1e')]+_0x10ba79['limit'],_0x328a52;if(_0x11c603>=_0x4c6ecc){_0x11c603=_0x4c6ecc;_0x328a52=0xc8;}else{_0x328a52=0xce;}_0x7af379[_0x59da('0x1a')](_0x328a52);return _0x7af379[_0x59da('0x1f')](_0x59da('0x20'),_0x5dee29+'-'+_0x11c603+'/'+_0x4c6ecc)[_0x59da('0x1c')](_0x3dd97d);}return null;};}function patchUpdates(_0x1a5794){return function(_0x2d5083){try{jsonpatch['apply'](_0x2d5083,_0x1a5794,!![]);}catch(_0x2f736a){return BPromise[_0x59da('0x21')](_0x2f736a);}return _0x2d5083[_0x59da('0x22')]();};}function saveUpdates(_0x319409,_0x574e26){return function(_0x3ec7f1){if(_0x3ec7f1){return _0x3ec7f1[_0x59da('0x23')](_0x319409)['then'](function(_0x5b9b2f){return _0x5b9b2f;});}return null;};}function removeEntity(_0x435e82,_0x9a05e8){return function(_0x3d5e53){if(_0x3d5e53){return _0x3d5e53[_0x59da('0x24')]()[_0x59da('0x25')](function(){_0x435e82[_0x59da('0x1a')](0xcc)[_0x59da('0x1b')]();});}};}function handleEntityNotFound(_0x3303c7,_0x3b0dff){return function(_0x4844af){if(!_0x4844af){_0x3303c7['sendStatus'](0x194);}return _0x4844af;};}function handleError(_0x2afd22,_0x20f09e){_0x20f09e=_0x20f09e||0x1f4;return function(_0x4e9814){logger['error'](_0x4e9814[_0x59da('0x26')]);if(_0x4e9814[_0x59da('0x27')]){delete _0x4e9814['name'];}_0x2afd22[_0x59da('0x1a')](_0x20f09e)[_0x59da('0x28')](_0x4e9814);};}exports[_0x59da('0x29')]=function(_0x43ace3,_0x459874){var _0x33d055={},_0x3d1db7={},_0x29d91b={'count':0x0,'rows':[]};var _0x10a8de=_[_0x59da('0x2a')](db[_0x59da('0x2b')][_0x59da('0x2c')],function(_0x18ab7f){return{'name':_0x18ab7f[_0x59da('0x2d')],'type':_0x18ab7f[_0x59da('0x2e')]['key']};});_0x3d1db7['model']=_[_0x59da('0x2f')](_['map'](_0x10a8de,_0x59da('0x27')),[_0x59da('0x30')]);_0x3d1db7[_0x59da('0x31')]=_[_0x59da('0x32')](_0x43ace3['query']);_0x3d1db7[_0x59da('0x33')]=_[_0x59da('0x34')](_0x3d1db7['model'],_0x3d1db7[_0x59da('0x31')]);_0x33d055['attributes']=_[_0x59da('0x34')](_0x3d1db7[_0x59da('0x35')],qs[_0x59da('0x36')](_0x43ace3[_0x59da('0x31')][_0x59da('0x36')]));_0x33d055['attributes']=_0x33d055[_0x59da('0x37')][_0x59da('0x38')]?_0x33d055[_0x59da('0x37')]:_0x3d1db7[_0x59da('0x35')];if(!_0x43ace3[_0x59da('0x31')][_0x59da('0x39')]('nolimit')){_0x33d055[_0x59da('0x3a')]=qs[_0x59da('0x3a')](_0x43ace3[_0x59da('0x31')]['limit']);_0x33d055[_0x59da('0x1e')]=qs[_0x59da('0x1e')](_0x43ace3[_0x59da('0x31')]['offset']);}_0x33d055[_0x59da('0x3b')]=qs[_0x59da('0x3c')](_0x43ace3[_0x59da('0x31')][_0x59da('0x3c')]);_0x33d055[_0x59da('0x3d')]=qs[_0x59da('0x33')](_[_0x59da('0x3e')](_0x43ace3[_0x59da('0x31')],_0x3d1db7['filters']),_0x10a8de);if(_0x43ace3[_0x59da('0x31')]['filter']){_0x33d055['where']=_['merge'](_0x33d055[_0x59da('0x3d')],{'$or':_[_0x59da('0x2a')](_0x10a8de,function(_0x44f58a){if(_0x44f58a[_0x59da('0x2e')]!==_0x59da('0x3f')){var _0x242226={};_0x242226[_0x44f58a[_0x59da('0x27')]]={'$like':'%'+_0x43ace3[_0x59da('0x31')][_0x59da('0x40')]+'%'};return _0x242226;}})});}_0x33d055=_[_0x59da('0x41')]({},_0x33d055,_0x43ace3[_0x59da('0x42')]);var _0xe3d647={'where':_0x33d055[_0x59da('0x3d')]};return db[_0x59da('0x2b')][_0x59da('0x1d')](_0xe3d647)['then'](function(_0x5e5e94){_0x29d91b[_0x59da('0x1d')]=_0x5e5e94;if(_0x43ace3[_0x59da('0x31')][_0x59da('0x43')]){_0x33d055[_0x59da('0x44')]=[{'all':!![]}];}return db[_0x59da('0x2b')][_0x59da('0x45')](_0x33d055);})['then'](function(_0x1c0b11){_0x29d91b[_0x59da('0x46')]=_0x1c0b11;return _0x29d91b;})[_0x59da('0x25')](respondWithFilteredResult(_0x459874,_0x33d055))[_0x59da('0x47')](handleError(_0x459874,null));};exports['show']=function(_0x697fba,_0xccff0b){var _0x157f31={'raw':![],'where':{'id':_0x697fba[_0x59da('0x48')]['id']}},_0x4503ff={};_0x4503ff[_0x59da('0x35')]=_[_0x59da('0x32')](db[_0x59da('0x2b')]['rawAttributes']);_0x4503ff[_0x59da('0x31')]=_[_0x59da('0x32')](_0x697fba[_0x59da('0x31')]);_0x4503ff[_0x59da('0x33')]=_[_0x59da('0x34')](_0x4503ff['model'],_0x4503ff[_0x59da('0x31')]);_0x157f31[_0x59da('0x37')]=_['intersection'](_0x4503ff[_0x59da('0x35')],qs[_0x59da('0x36')](_0x697fba['query'][_0x59da('0x36')]));_0x157f31['attributes']=_0x157f31[_0x59da('0x37')][_0x59da('0x38')]?_0x157f31[_0x59da('0x37')]:_0x4503ff[_0x59da('0x35')];if(_0x697fba['query'][_0x59da('0x43')]){_0x157f31[_0x59da('0x44')]=[{'all':!![]}];}_0x157f31=_[_0x59da('0x41')]({},_0x157f31,_0x697fba['options']);return db[_0x59da('0x2b')][_0x59da('0x49')](_0x157f31)[_0x59da('0x25')](handleEntityNotFound(_0xccff0b,null))[_0x59da('0x25')](respondWithResult(_0xccff0b,null))[_0x59da('0x47')](handleError(_0xccff0b,null));};exports['create']=function(_0x479aca,_0x399618){return db['ScreenRecording'][_0x59da('0x4a')](_0x479aca[_0x59da('0x4b')],{})[_0x59da('0x25')](respondWithResult(_0x399618,0xc9))[_0x59da('0x47')](handleError(_0x399618,null));};exports[_0x59da('0x23')]=function(_0x44e9b2,_0x59caa9){if(_0x44e9b2[_0x59da('0x4b')]['id']){delete _0x44e9b2['body']['id'];}delete _0x44e9b2[_0x59da('0x4b')][_0x59da('0x4c')];delete _0x44e9b2['body'][_0x59da('0x4d')];delete _0x44e9b2[_0x59da('0x4b')][_0x59da('0x4e')];delete _0x44e9b2[_0x59da('0x4b')][_0x59da('0x4f')];return db[_0x59da('0x2b')][_0x59da('0x49')]({'where':{'id':_0x44e9b2[_0x59da('0x48')]['id']}})['then'](handleEntityNotFound(_0x59caa9,null))['then'](saveUpdates(_0x44e9b2[_0x59da('0x4b')],null))[_0x59da('0x25')](respondWithResult(_0x59caa9,null))[_0x59da('0x47')](handleError(_0x59caa9,null));};exports[_0x59da('0x50')]=function(_0xbb495e,_0x17797c){return db['ScreenRecording'][_0x59da('0x50')]()['then'](respondWithResult(_0x17797c,null))[_0x59da('0x47')](handleError(_0x17797c,null));};exports[_0x59da('0x51')]=function(_0x59e0a9,_0x4cdeef,_0x1e2b3c){var _0x36d283=require('../../components/encryptor');var _0x4a268a=![];var _0x10b21c={};if(_0x59e0a9['query'][_0x59da('0x2e')]&&_0x59e0a9[_0x59da('0x31')][_0x59da('0x2e')]===_0x59da('0x52')){_0x10b21c['uniqueid']=_0x59e0a9['params']['id'];}else{_0x10b21c['id']=_0x59e0a9['params']['id'];}return db[_0x59da('0x2b')][_0x59da('0x49')]({'where':_0x10b21c,'attributes':['id',_0x59da('0x4f')],'raw':!![]})[_0x59da('0x25')](handleEntityNotFound(_0x4cdeef,null))[_0x59da('0x25')](function(_0x192f59){if(_0x192f59){var _0x22501b=path[_0x59da('0x53')](config[_0x59da('0x54')],_0x59da('0x55'),_0x192f59[_0x59da('0x4f')]);var _0x5941b6=util[_0x59da('0x30')](_0x59da('0x56'),_0x22501b);if(fs[_0x59da('0x57')](_0x5941b6)){_0x4a268a=!![];return _0x36d283[_0x59da('0x58')](_0x5941b6,_0x22501b,config['secrets'][_0x59da('0x59')])['then'](function(){return _0x192f59;});}return _0x192f59;}})[_0x59da('0x25')](function(_0x4c7795){if(_0x4c7795){var _0x1e8a72=path[_0x59da('0x53')](config[_0x59da('0x54')],_0x59da('0x55'),_0x4c7795[_0x59da('0x4f')]);if(!fs[_0x59da('0x57')](_0x1e8a72)){throw new db[(_0x59da('0x5a'))][(_0x59da('0x5b'))](_0x59da('0x5c'));}if(_0x4c7795[_0x59da('0x5d')]){return _0x4cdeef[_0x59da('0x51')](_0x1e8a72,_0x4c7795[_0x59da('0x5d')]+path[_0x59da('0x5e')](_0x1e8a72),function(){if(_0x4a268a){fs[_0x59da('0x5f')](_0x1e8a72);}});}else{return _0x4cdeef['download'](_0x1e8a72,function(_0x36e4de){if(_0x4a268a){fs[_0x59da('0x5f')](_0x1e8a72);}});}}})['catch'](function(_0x2461cd){if(_0x2461cd[_0x59da('0x60')]===_0x59da('0x5c')){_0x4cdeef['status'](0x194)['send'](_0x59da('0x61'));}else{return handleError(_0x4cdeef,null);}});};exports['destroy']=function(_0xa5f31b,_0xfdbb74){return db[_0x59da('0x2b')][_0x59da('0x49')]({'where':{'id':_0xa5f31b[_0x59da('0x48')]['id']}})['then'](function(_0x56960c){if(!_0x56960c)throw new ReferenceError(_0x59da('0x62'));return _0x56960c;})[_0x59da('0x25')](function(_0xc0060c){var _0x779dbd=path[_0x59da('0x53')](config[_0x59da('0x54')],_0x59da('0x55'),_0xc0060c[_0x59da('0x4f')]);logger[_0x59da('0x63')](_0x59da('0x64'),_0x779dbd);if(!_[_0x59da('0x65')](_0xc0060c['value'])&&fs[_0x59da('0x57')](_0x779dbd)){logger[_0x59da('0x63')](_0x59da('0x66')+_0x779dbd+_0x59da('0x67'));fs[_0x59da('0x68')](_0x779dbd);}_0x779dbd=_0x779dbd+_0x59da('0x69');if(!_[_0x59da('0x65')](_0xc0060c[_0x59da('0x4f')])&&fs[_0x59da('0x57')](_0x779dbd)){logger[_0x59da('0x63')](_0x59da('0x66')+_0x779dbd+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x59da('0x68')](_0x779dbd);}return _0xc0060c;})[_0x59da('0x25')](function(_0x4d7c13){if(!_0x4d7c13)throw new InternalError();return _0x4d7c13[_0x59da('0x24')]();})['then'](function(){_0xfdbb74[_0x59da('0x1a')](0xcc)[_0x59da('0x1b')]();})[_0x59da('0x47')](handleError(_0xfdbb74,null));}; \ No newline at end of file +var _0x3a00=['ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','rawAttributes','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','join','Sequelize','ValidationError'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0x3a00,0x74));var _0x03a0=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0x3a00[_0x30f07a];return _0xb38461;};'use strict';var pdf=require(_0x03a0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x03a0('0x1'));var zipdir=require(_0x03a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03a0('0x3'));var moment=require(_0x03a0('0x4'));var BPromise=require(_0x03a0('0x5'));var Mustache=require(_0x03a0('0x6'));var util=require(_0x03a0('0x7'));var path=require(_0x03a0('0x8'));var sox=require('sox');var csv=require(_0x03a0('0x9'));var ejs=require(_0x03a0('0xa'));var fs=require('fs');var _=require(_0x03a0('0xb'));var squel=require(_0x03a0('0xc'));var crypto=require(_0x03a0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x03a0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x03a0('0xf'));var Papa=require(_0x03a0('0x10'));var Redis=require(_0x03a0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x03a0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03a0('0x13'));var logger=require(_0x03a0('0x14'))('api');var utils=require(_0x03a0('0x15'));var config=require(_0x03a0('0x16'));var licenseUtil=require(_0x03a0('0x17'));var db=require(_0x03a0('0x18'))['db'];function respondWithStatusCode(_0xdd010d,_0xfa8d4a){_0xfa8d4a=_0xfa8d4a||0xcc;return function(_0x581b9f){if(_0x581b9f){return _0xdd010d[_0x03a0('0x19')](_0xfa8d4a);}return _0xdd010d[_0x03a0('0x1a')](_0xfa8d4a)[_0x03a0('0x1b')]();};}function respondWithResult(_0x10e5ea,_0x4530a0){_0x4530a0=_0x4530a0||0xc8;return function(_0x1bfcda){if(_0x1bfcda){return _0x10e5ea['status'](_0x4530a0)[_0x03a0('0x1c')](_0x1bfcda);}};}function respondWithFilteredResult(_0xbf6037,_0x440280){return function(_0x55d027){if(_0x55d027){var _0x54a42f=_0x55d027[_0x03a0('0x1d')],_0x56c9ce=_0x440280[_0x03a0('0x1e')],_0x1ba070=_0x440280[_0x03a0('0x1e')]+_0x440280[_0x03a0('0x1f')],_0x2cf36a;if(_0x1ba070>=_0x54a42f){_0x1ba070=_0x54a42f;_0x2cf36a=0xc8;}else{_0x2cf36a=0xce;}_0xbf6037[_0x03a0('0x1a')](_0x2cf36a);return _0xbf6037[_0x03a0('0x20')](_0x03a0('0x21'),_0x56c9ce+'-'+_0x1ba070+'/'+_0x54a42f)[_0x03a0('0x1c')](_0x55d027);}return null;};}function patchUpdates(_0x3eebec){return function(_0x2018c1){try{jsonpatch[_0x03a0('0x22')](_0x2018c1,_0x3eebec,!![]);}catch(_0x1c84b1){return BPromise[_0x03a0('0x23')](_0x1c84b1);}return _0x2018c1['save']();};}function saveUpdates(_0x430336,_0x18229d){return function(_0x251929){if(_0x251929){return _0x251929[_0x03a0('0x24')](_0x430336)[_0x03a0('0x25')](function(_0x385cc8){return _0x385cc8;});}return null;};}function removeEntity(_0x1a8e17,_0x1a2336){return function(_0x221d98){if(_0x221d98){return _0x221d98[_0x03a0('0x26')]()[_0x03a0('0x25')](function(){_0x1a8e17[_0x03a0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2532e4,_0x4d7cbd){return function(_0x2d69be){if(!_0x2d69be){_0x2532e4[_0x03a0('0x19')](0x194);}return _0x2d69be;};}function handleError(_0x72abb,_0x54be37){_0x54be37=_0x54be37||0x1f4;return function(_0x4bf469){logger['error'](_0x4bf469[_0x03a0('0x27')]);if(_0x4bf469[_0x03a0('0x28')]){delete _0x4bf469[_0x03a0('0x28')];}_0x72abb[_0x03a0('0x1a')](_0x54be37)['send'](_0x4bf469);};}exports[_0x03a0('0x29')]=function(_0x1f8a6c,_0x3c3d19){var _0x4ad23d={},_0x5733de={},_0x195523={'count':0x0,'rows':[]};var _0x58206a=_[_0x03a0('0x2a')](db['ScreenRecording'][_0x03a0('0x2b')],function(_0x512baa){return{'name':_0x512baa['fieldName'],'type':_0x512baa[_0x03a0('0x2c')]['key']};});_0x5733de[_0x03a0('0x2d')]=_[_0x03a0('0x2e')](_[_0x03a0('0x2a')](_0x58206a,'name'),[_0x03a0('0x2f')]);_0x5733de[_0x03a0('0x30')]=_[_0x03a0('0x31')](_0x1f8a6c[_0x03a0('0x30')]);_0x5733de[_0x03a0('0x32')]=_[_0x03a0('0x33')](_0x5733de['model'],_0x5733de[_0x03a0('0x30')]);_0x4ad23d[_0x03a0('0x34')]=_[_0x03a0('0x33')](_0x5733de['model'],qs['fields'](_0x1f8a6c[_0x03a0('0x30')][_0x03a0('0x35')]));_0x4ad23d[_0x03a0('0x34')]=_0x4ad23d[_0x03a0('0x34')][_0x03a0('0x36')]?_0x4ad23d[_0x03a0('0x34')]:_0x5733de[_0x03a0('0x2d')];if(!_0x1f8a6c['query'][_0x03a0('0x37')](_0x03a0('0x38'))){_0x4ad23d[_0x03a0('0x1f')]=qs[_0x03a0('0x1f')](_0x1f8a6c[_0x03a0('0x30')][_0x03a0('0x1f')]);_0x4ad23d[_0x03a0('0x1e')]=qs[_0x03a0('0x1e')](_0x1f8a6c['query'][_0x03a0('0x1e')]);}_0x4ad23d[_0x03a0('0x39')]=qs['sort'](_0x1f8a6c[_0x03a0('0x30')][_0x03a0('0x3a')]);_0x4ad23d[_0x03a0('0x3b')]=qs[_0x03a0('0x32')](_['pick'](_0x1f8a6c[_0x03a0('0x30')],_0x5733de[_0x03a0('0x32')]),_0x58206a);if(_0x1f8a6c[_0x03a0('0x30')][_0x03a0('0x3c')]){_0x4ad23d[_0x03a0('0x3b')]=_[_0x03a0('0x3d')](_0x4ad23d[_0x03a0('0x3b')],{'$or':_['map'](_0x58206a,function(_0x56f41b){if(_0x56f41b[_0x03a0('0x2c')]!=='VIRTUAL'){var _0x417c80={};_0x417c80[_0x56f41b[_0x03a0('0x28')]]={'$like':'%'+_0x1f8a6c[_0x03a0('0x30')][_0x03a0('0x3c')]+'%'};return _0x417c80;}})});}_0x4ad23d=_['merge']({},_0x4ad23d,_0x1f8a6c[_0x03a0('0x3e')]);var _0x459948={'where':_0x4ad23d[_0x03a0('0x3b')]};return db[_0x03a0('0x3f')][_0x03a0('0x1d')](_0x459948)[_0x03a0('0x25')](function(_0x383772){_0x195523['count']=_0x383772;if(_0x1f8a6c[_0x03a0('0x30')][_0x03a0('0x40')]){_0x4ad23d[_0x03a0('0x41')]=[{'all':!![]}];}return db[_0x03a0('0x3f')][_0x03a0('0x42')](_0x4ad23d);})[_0x03a0('0x25')](function(_0x5bdd00){_0x195523[_0x03a0('0x43')]=_0x5bdd00;return _0x195523;})['then'](respondWithFilteredResult(_0x3c3d19,_0x4ad23d))[_0x03a0('0x44')](handleError(_0x3c3d19,null));};exports['show']=function(_0x50e730,_0x1f197b){var _0x3d9af1={'raw':![],'where':{'id':_0x50e730[_0x03a0('0x45')]['id']}},_0x1e59a9={};_0x1e59a9[_0x03a0('0x2d')]=_[_0x03a0('0x31')](db[_0x03a0('0x3f')][_0x03a0('0x2b')]);_0x1e59a9[_0x03a0('0x30')]=_[_0x03a0('0x31')](_0x50e730[_0x03a0('0x30')]);_0x1e59a9[_0x03a0('0x32')]=_[_0x03a0('0x33')](_0x1e59a9[_0x03a0('0x2d')],_0x1e59a9[_0x03a0('0x30')]);_0x3d9af1[_0x03a0('0x34')]=_['intersection'](_0x1e59a9['model'],qs['fields'](_0x50e730['query'][_0x03a0('0x35')]));_0x3d9af1['attributes']=_0x3d9af1[_0x03a0('0x34')]['length']?_0x3d9af1[_0x03a0('0x34')]:_0x1e59a9['model'];if(_0x50e730[_0x03a0('0x30')][_0x03a0('0x40')]){_0x3d9af1['include']=[{'all':!![]}];}_0x3d9af1=_[_0x03a0('0x3d')]({},_0x3d9af1,_0x50e730[_0x03a0('0x3e')]);return db[_0x03a0('0x3f')][_0x03a0('0x46')](_0x3d9af1)[_0x03a0('0x25')](handleEntityNotFound(_0x1f197b,null))[_0x03a0('0x25')](respondWithResult(_0x1f197b,null))[_0x03a0('0x44')](handleError(_0x1f197b,null));};exports[_0x03a0('0x47')]=function(_0x1b8208,_0x2efe3d){return db[_0x03a0('0x3f')][_0x03a0('0x47')](_0x1b8208['body'],{})['then'](respondWithResult(_0x2efe3d,0xc9))[_0x03a0('0x44')](handleError(_0x2efe3d,null));};exports['update']=function(_0x1d584f,_0x38b3b0){if(_0x1d584f[_0x03a0('0x48')]['id']){delete _0x1d584f['body']['id'];}delete _0x1d584f[_0x03a0('0x48')][_0x03a0('0x49')];delete _0x1d584f[_0x03a0('0x48')][_0x03a0('0x4a')];delete _0x1d584f[_0x03a0('0x48')][_0x03a0('0x4b')];delete _0x1d584f[_0x03a0('0x48')][_0x03a0('0x4c')];return db['ScreenRecording'][_0x03a0('0x46')]({'where':{'id':_0x1d584f[_0x03a0('0x45')]['id']}})['then'](handleEntityNotFound(_0x38b3b0,null))['then'](saveUpdates(_0x1d584f[_0x03a0('0x48')],null))[_0x03a0('0x25')](respondWithResult(_0x38b3b0,null))['catch'](handleError(_0x38b3b0,null));};exports[_0x03a0('0x4d')]=function(_0x136ea6,_0x458b3a){return db[_0x03a0('0x3f')][_0x03a0('0x4d')]()['then'](respondWithResult(_0x458b3a,null))['catch'](handleError(_0x458b3a,null));};exports[_0x03a0('0x4e')]=function(_0x102f24,_0x1f5cb0,_0x43a439){var _0x593f56=require(_0x03a0('0x4f'));var _0x207713=![];var _0x593ad4={};if(_0x102f24[_0x03a0('0x30')][_0x03a0('0x2c')]&&_0x102f24[_0x03a0('0x30')][_0x03a0('0x2c')]===_0x03a0('0x50')){_0x593ad4[_0x03a0('0x50')]=_0x102f24[_0x03a0('0x45')]['id'];}else{_0x593ad4['id']=_0x102f24['params']['id'];}return db[_0x03a0('0x3f')][_0x03a0('0x46')]({'where':_0x593ad4,'attributes':['id','value'],'raw':!![]})[_0x03a0('0x25')](handleEntityNotFound(_0x1f5cb0,null))['then'](function(_0x62afeb){if(_0x62afeb){var _0x1695f9=path['join'](config[_0x03a0('0x51')],_0x03a0('0x52'),_0x62afeb[_0x03a0('0x4c')]);var _0x1a0e5b=util['format'](_0x03a0('0x53'),_0x1695f9);if(fs[_0x03a0('0x54')](_0x1a0e5b)){_0x207713=!![];return _0x593f56[_0x03a0('0x55')](_0x1a0e5b,_0x1695f9,config['secrets'][_0x03a0('0x56')])[_0x03a0('0x25')](function(){return _0x62afeb;});}return _0x62afeb;}})[_0x03a0('0x25')](function(_0x2ba9a4){if(_0x2ba9a4){var _0x4ab989=path[_0x03a0('0x57')](config[_0x03a0('0x51')],'server/files/screen_recordings',_0x2ba9a4['value']);if(!fs[_0x03a0('0x54')](_0x4ab989)){throw new db[(_0x03a0('0x58'))][(_0x03a0('0x59'))](_0x03a0('0x5a'));}if(_0x2ba9a4['filename']){return _0x1f5cb0[_0x03a0('0x4e')](_0x4ab989,_0x2ba9a4[_0x03a0('0x5b')]+path['extname'](_0x4ab989),function(){if(_0x207713){fs[_0x03a0('0x5c')](_0x4ab989);}});}else{return _0x1f5cb0[_0x03a0('0x4e')](_0x4ab989,function(_0x19c03f){if(_0x207713){fs[_0x03a0('0x5c')](_0x4ab989);}});}}})[_0x03a0('0x44')](function(_0xf6eea8){if(_0xf6eea8[_0x03a0('0x5d')]===_0x03a0('0x5a')){_0x1f5cb0['status'](0x194)['send'](_0x03a0('0x5e'));}else{return handleError(_0x1f5cb0,null);}});};exports[_0x03a0('0x26')]=function(_0xb55b4c,_0x26d524){return db[_0x03a0('0x3f')][_0x03a0('0x46')]({'where':{'id':_0xb55b4c[_0x03a0('0x45')]['id']}})['then'](function(_0xd7971c){if(!_0xd7971c)throw new ReferenceError(_0x03a0('0x5f'));return _0xd7971c;})['then'](function(_0x270dc9){var _0x49cd5d=path[_0x03a0('0x57')](config[_0x03a0('0x51')],'server/files/screen_recordings',_0x270dc9['value']);logger[_0x03a0('0x60')](_0x03a0('0x61'),_0x49cd5d);if(!_[_0x03a0('0x62')](_0x270dc9[_0x03a0('0x4c')])&&fs[_0x03a0('0x54')](_0x49cd5d)){logger['info'](_0x03a0('0x63')+_0x49cd5d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x49cd5d);}_0x49cd5d=_0x49cd5d+_0x03a0('0x64');if(!_[_0x03a0('0x62')](_0x270dc9[_0x03a0('0x4c')])&&fs[_0x03a0('0x54')](_0x49cd5d)){logger[_0x03a0('0x60')](_0x03a0('0x63')+_0x49cd5d+_0x03a0('0x65'));fs[_0x03a0('0x66')](_0x49cd5d);}return _0x270dc9;})['then'](function(_0x597c20){if(!_0x597c20)throw new InternalError();return _0x597c20[_0x03a0('0x26')]();})[_0x03a0('0x25')](function(){_0x26d524['status'](0xcc)[_0x03a0('0x1b')]();})[_0x03a0('0x44')](handleError(_0x26d524,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 648f348..2f98c76 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 _0x170d=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger'];(function(_0x15c9f8,_0x1cc5f2){var _0x52b276=function(_0x31c250){while(--_0x31c250){_0x15c9f8['push'](_0x15c9f8['shift']());}};_0x52b276(++_0x1cc5f2);}(_0x170d,0xcf));var _0xd170=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x170d[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xd170('0x0'));var util=require(_0xd170('0x1'));var logger=require(_0xd170('0x2'))(_0xd170('0x3'));var moment=require(_0xd170('0x4'));var BPromise=require(_0xd170('0x5'));var rp=require(_0xd170('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd170('0x7'));var config=require(_0xd170('0x8'));var attributes=require(_0xd170('0x9'));module[_0xd170('0xa')]=function(_0x42aad8,_0x2c2bae){return _0x42aad8[_0xd170('0xb')](_0xd170('0xc'),attributes,{'tableName':_0xd170('0xd'),'paranoid':![],'indexes':[{'name':_0xd170('0xe'),'fields':[_0xd170('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdddd=['request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0xdddd,0x1cf));var _0xdddd=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0xdddd[_0x21af3a];return _0x268a49;};'use strict';var _=require(_0xdddd('0x0'));var util=require(_0xdddd('0x1'));var logger=require(_0xdddd('0x2'))(_0xdddd('0x3'));var moment=require(_0xdddd('0x4'));var BPromise=require('bluebird');var rp=require(_0xdddd('0x5'));var fs=require('fs');var path=require(_0xdddd('0x6'));var rimraf=require(_0xdddd('0x7'));var config=require(_0xdddd('0x8'));var attributes=require(_0xdddd('0x9'));module['exports']=function(_0x1b68b8,_0x233464){return _0x1b68b8[_0xdddd('0xa')](_0xdddd('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xdddd('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index a8acc85..edefd49 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(_0x22db01,_0x242e80){var _0x4cbc81=function(_0x5f113d){while(--_0x5f113d){_0x22db01['push'](_0x22db01['shift']());}};_0x4cbc81(++_0x242e80);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xc0ea3d,_0x542a0e){var _0x1612cd=function(_0x23f91b){while(--_0x23f91b){_0xc0ea3d['push'](_0xc0ea3d['shift']());}};_0x1612cd(++_0x542a0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index a69901d..0d1056b 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 _0xc995=['getLogoLogin','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','/:id/logo','single','file','addLogo','join','logologin','originalname','post','addLogoLogin','preferred','/:id/preferred','addFavicon','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','getLogo','/:id/logo_login'];(function(_0x15fcb3,_0x327271){var _0x3f803c=function(_0x2b8a61){while(--_0x2b8a61){_0x15fcb3['push'](_0x15fcb3['shift']());}};_0x3f803c(++_0x327271);}(_0xc995,0xc6));var _0x5c99=function(_0x147389,_0x305665){_0x147389=_0x147389-0x0;var _0x10c071=_0xc995[_0x147389];return _0x10c071;};'use strict';var multer=require(_0x5c99('0x0'));var util=require(_0x5c99('0x1'));var path=require(_0x5c99('0x2'));var timeout=require(_0x5c99('0x3'));var express=require(_0x5c99('0x4'));var router=express[_0x5c99('0x5')]();var auth=require(_0x5c99('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5c99('0x7'));router[_0x5c99('0x8')]('/',auth[_0x5c99('0x9')](),controller[_0x5c99('0xa')]);router['get'](_0x5c99('0xb'),controller[_0x5c99('0xc')]);router['get'](_0x5c99('0xd'),controller[_0x5c99('0xe')]);router[_0x5c99('0x8')]('/:id/logo',controller[_0x5c99('0xf')]);router[_0x5c99('0x8')](_0x5c99('0x10'),controller[_0x5c99('0x11')]);router[_0x5c99('0x8')]('/:id/gdpr',controller[_0x5c99('0x12')]);router['get']('/:id/preferred',controller[_0x5c99('0x13')]);router['get'](_0x5c99('0x14'),controller[_0x5c99('0x15')]);var upload=multer({'storage':multer[_0x5c99('0x16')]({'destination':function(_0x5a796d,_0x1163e8,_0x2fe5fb){_0x2fe5fb(null,path['join'](config[_0x5c99('0x17')],_0x5c99('0x18')));},'filename':function(_0x492a77,_0x4f5f16,_0x14cd35){_0x14cd35(null,util[_0x5c99('0x19')](_0x5c99('0x1a'),_0x5c99('0x1b'),path[_0x5c99('0x1c')](_0x4f5f16['originalname'])));}})});router['post'](_0x5c99('0x1d'),upload[_0x5c99('0x1e')](_0x5c99('0x1f')),controller[_0x5c99('0x20')]);var upload=multer({'storage':multer[_0x5c99('0x16')]({'destination':function(_0x1ea8f9,_0x1622e4,_0x252b4b){_0x252b4b(null,path[_0x5c99('0x21')](config[_0x5c99('0x17')],_0x5c99('0x18')));},'filename':function(_0x48f94e,_0xec0057,_0x43b233){_0x43b233(null,util['format'](_0x5c99('0x1a'),_0x5c99('0x22'),path[_0x5c99('0x1c')](_0xec0057[_0x5c99('0x23')])));}})});router[_0x5c99('0x24')](_0x5c99('0x10'),upload['single'](_0x5c99('0x1f')),controller[_0x5c99('0x25')]);var upload=multer({'storage':multer[_0x5c99('0x16')]({'destination':function(_0x4871eb,_0x99131a,_0x374c78){_0x374c78(null,path[_0x5c99('0x21')](config['root'],_0x5c99('0x18')));},'filename':function(_0x1133da,_0xa9709e,_0x20969a){_0x20969a(null,util[_0x5c99('0x19')](_0x5c99('0x1a'),_0x5c99('0x26'),path[_0x5c99('0x1c')](_0xa9709e[_0x5c99('0x23')])));}})});router[_0x5c99('0x24')](_0x5c99('0x27'),upload['single'](_0x5c99('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x395784,_0x5d621f,_0x48585c){_0x48585c(null,path[_0x5c99('0x21')](config[_0x5c99('0x17')],_0x5c99('0x18')));},'filename':function(_0x152b01,_0x5d01fb,_0x232527){_0x232527(null,util['format'](_0x5c99('0x1a'),'favicon',path[_0x5c99('0x1c')](_0x5d01fb[_0x5c99('0x23')])));}})});router[_0x5c99('0x24')]('/:id/favicon',upload['single'](_0x5c99('0x1f')),controller[_0x5c99('0x28')]);router[_0x5c99('0x29')](_0x5c99('0xd'),auth[_0x5c99('0x9')](),controller[_0x5c99('0x2a')]);module['exports']=router; \ No newline at end of file +var _0xb52e=['./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/preferred','getFavicon','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','diskStorage','join','logologin','addLogoLogin','addPreferred','/:id/favicon','file','update','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1626ac,_0x517818){var _0x3753ef=function(_0x4a9113){while(--_0x4a9113){_0x1626ac['push'](_0x1626ac['shift']());}};_0x3753ef(++_0x517818);}(_0xb52e,0x1a6));var _0xeb52=function(_0x43b5b9,_0x1c307c){_0x43b5b9=_0x43b5b9-0x0;var _0x4fbd27=_0xb52e[_0x43b5b9];return _0x4fbd27;};'use strict';var multer=require(_0xeb52('0x0'));var util=require(_0xeb52('0x1'));var path=require('path');var timeout=require(_0xeb52('0x2'));var express=require('express');var router=express[_0xeb52('0x3')]();var auth=require(_0xeb52('0x4'));var interaction=require(_0xeb52('0x5'));var config=require(_0xeb52('0x6'));var controller=require(_0xeb52('0x7'));router[_0xeb52('0x8')]('/',auth[_0xeb52('0x9')](),controller[_0xeb52('0xa')]);router[_0xeb52('0x8')](_0xeb52('0xb'),controller[_0xeb52('0xc')]);router[_0xeb52('0x8')](_0xeb52('0xd'),controller[_0xeb52('0xe')]);router['get'](_0xeb52('0xf'),controller[_0xeb52('0x10')]);router[_0xeb52('0x8')](_0xeb52('0x11'),controller[_0xeb52('0x12')]);router['get']('/:id/gdpr',controller['gdpr']);router[_0xeb52('0x8')](_0xeb52('0x13'),controller['getPreferred']);router[_0xeb52('0x8')]('/:id/favicon',controller[_0xeb52('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x342f40,_0xcfc55f,_0xa976d5){_0xa976d5(null,path['join'](config[_0xeb52('0x15')],_0xeb52('0x16')));},'filename':function(_0x53380d,_0x138bd1,_0x3fa6a9){_0x3fa6a9(null,util[_0xeb52('0x17')](_0xeb52('0x18'),_0xeb52('0x19'),path[_0xeb52('0x1a')](_0x138bd1[_0xeb52('0x1b')])));}})});router[_0xeb52('0x1c')](_0xeb52('0xf'),upload[_0xeb52('0x1d')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xeb52('0x1e')]({'destination':function(_0x5ed1e4,_0x2264d2,_0x297cfc){_0x297cfc(null,path[_0xeb52('0x1f')](config[_0xeb52('0x15')],_0xeb52('0x16')));},'filename':function(_0x56d0ee,_0x4741bd,_0x2811a8){_0x2811a8(null,util[_0xeb52('0x17')](_0xeb52('0x18'),_0xeb52('0x20'),path[_0xeb52('0x1a')](_0x4741bd[_0xeb52('0x1b')])));}})});router['post'](_0xeb52('0x11'),upload[_0xeb52('0x1d')]('file'),controller[_0xeb52('0x21')]);var upload=multer({'storage':multer[_0xeb52('0x1e')]({'destination':function(_0x3a0961,_0x38efad,_0x55d71b){_0x55d71b(null,path[_0xeb52('0x1f')](config[_0xeb52('0x15')],_0xeb52('0x16')));},'filename':function(_0x5031da,_0x5e130f,_0x59b1c3){_0x59b1c3(null,util['format']('%s%s','preferred',path['extname'](_0x5e130f[_0xeb52('0x1b')])));}})});router['post'](_0xeb52('0x13'),upload[_0xeb52('0x1d')]('file'),controller[_0xeb52('0x22')]);var upload=multer({'storage':multer[_0xeb52('0x1e')]({'destination':function(_0x8cbcd,_0x6ee42e,_0x2bfeb7){_0x2bfeb7(null,path[_0xeb52('0x1f')](config[_0xeb52('0x15')],_0xeb52('0x16')));},'filename':function(_0x50b86a,_0x70111,_0x1571de){_0x1571de(null,util[_0xeb52('0x17')](_0xeb52('0x18'),'favicon',path[_0xeb52('0x1a')](_0x70111[_0xeb52('0x1b')])));}})});router['post'](_0xeb52('0x23'),upload['single'](_0xeb52('0x24')),controller['addFavicon']);router['put'](_0xeb52('0xd'),auth['isAuthenticated'](),controller[_0xeb52('0x25')]);module[_0xeb52('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index b6bfb62..7675352 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 _0xbe39=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING'];(function(_0x2804d7,_0x2d8d6c){var _0x4a84e7=function(_0x3a03e9){while(--_0x3a03e9){_0x2804d7['push'](_0x2804d7['shift']());}};_0x4a84e7(++_0x2d8d6c);}(_0xbe39,0x151));var _0x9be3=function(_0x2c1fc6,_0x292eab){_0x2c1fc6=_0x2c1fc6-0x0;var _0x59335b=_0xbe39[_0x2c1fc6];return _0x59335b;};'use strict';var Sequelize=require('sequelize');module[_0x9be3('0x0')]={'min_internal':{'type':Sequelize[_0x9be3('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x9be3('0x1')](0xb),'unique':_0x9be3('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x9be3('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x9be3('0x3')},'logo':{'type':Sequelize[_0x9be3('0x4')]},'defaultLogo':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x9be3('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x9be3('0x4')]},'turnusername':{'type':Sequelize[_0x9be3('0x4')]},'turnpassword':{'type':Sequelize[_0x9be3('0x4')]},'pageTitle':{'type':Sequelize[_0x9be3('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x9be3('0x4')],'defaultValue':_0x9be3('0x6')},'enableEmailPreview':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x9be3('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9be3('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x9be3('0x7')},'chatTimeout':{'type':Sequelize[_0x9be3('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x9be3('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x9be3('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x9be3('0x4')]},'defaultFavicon':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9be3('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x9be3('0x1')]},'transcribeRegion':{'type':Sequelize[_0x9be3('0x4')]},'sentiment':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x9be3('0x1')]},'sentimentRegion':{'type':Sequelize[_0x9be3('0x4')]},'language':{'type':Sequelize[_0x9be3('0x4')]},'bucket':{'type':Sequelize[_0x9be3('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x9be3('0x1')](0x2)[_0x9be3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x9be3('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x9be3('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x9be3('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xe168=['exports','min_internal','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize'];(function(_0x5e6122,_0x43ac49){var _0x54b993=function(_0x3d6bd8){while(--_0x3d6bd8){_0x5e6122['push'](_0x5e6122['shift']());}};_0x54b993(++_0x43ac49);}(_0xe168,0xb3));var _0x8e16=function(_0x49df79,_0x3c7442){_0x49df79=_0x49df79-0x0;var _0x2724db=_0xe168[_0x49df79];return _0x2724db;};'use strict';var Sequelize=require(_0x8e16('0x0'));module[_0x8e16('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x8e16('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x8e16('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x8e16('0x4')],'defaultValue':_0x8e16('0x5')},'logo':{'type':Sequelize[_0x8e16('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x8e16('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x8e16('0x4')]},'turnaddr':{'type':Sequelize[_0x8e16('0x4')]},'turnusername':{'type':Sequelize[_0x8e16('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x8e16('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x8e16('0x4')],'defaultValue':_0x8e16('0x7')},'enableEmailPreview':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x8e16('0x4')],'defaultValue':_0x8e16('0x8')},'chatTimeout':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x8e16('0x4')]},'defaultPreferred':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x8e16('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x8e16('0x3')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x8e16('0x3')]},'sentimentRegion':{'type':Sequelize[_0x8e16('0x4')]},'language':{'type':Sequelize[_0x8e16('0x4')]},'bucket':{'type':Sequelize[_0x8e16('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x8e16('0x3')](0x2)[_0x8e16('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c813757..c0115ca 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 _0xff6a=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','map','Setting','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','params','keys','rawAttributes','includeAll','include','options','body','find','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','toLower','root','join','default_logo.svg','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','defaultPreferred','default_loginLogo.svg','gdpr','securePassword','getPreferred','favicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','default','download','getDate','utcOffset','now','send','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x343b0a,_0x586263){var _0x3d8ff8=function(_0x53c629){while(--_0x53c629){_0x343b0a['push'](_0x343b0a['shift']());}};_0x3d8ff8(++_0x586263);}(_0xff6a,0x6d));var _0xaff6=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xff6a[_0x4a53d];return _0x27410e;};'use strict';var pdf=require(_0xaff6('0x0'));var emlformat=require(_0xaff6('0x1'));var rimraf=require(_0xaff6('0x2'));var zipdir=require(_0xaff6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaff6('0x4'));var moment=require(_0xaff6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaff6('0x6'));var util=require(_0xaff6('0x7'));var path=require(_0xaff6('0x8'));var sox=require(_0xaff6('0x9'));var csv=require(_0xaff6('0xa'));var ejs=require(_0xaff6('0xb'));var fs=require('fs');var _=require(_0xaff6('0xc'));var squel=require(_0xaff6('0xd'));var crypto=require('crypto');var jsforce=require(_0xaff6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaff6('0xf'));var Papa=require(_0xaff6('0x10'));var Redis=require(_0xaff6('0x11'));var authService=require(_0xaff6('0x12'));var qs=require(_0xaff6('0x13'));var as=require(_0xaff6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaff6('0x15'));var utils=require(_0xaff6('0x16'));var config=require(_0xaff6('0x17'));var licenseUtil=require(_0xaff6('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xaff6('0x19'));var client=jayson[_0xaff6('0x1a')][_0xaff6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3a2fb3,_0x4928f0,_0x1894f3,_0x459b8f){return new BPromise(function(_0x3663ce,_0x3e11e7){var _0xc0ae6d=_0x459b8f||client;return _0xc0ae6d[_0xaff6('0x1c')](_0x3a2fb3,_0x1894f3)[_0xaff6('0x1d')](function(_0x1b93fe){logger['info'](_0xaff6('0x1e'),_0x4928f0,_0xaff6('0x1f'));logger[_0xaff6('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x4928f0,_0xaff6('0x1f'),JSON[_0xaff6('0x21')](_0x1b93fe));if(_0x1b93fe[_0xaff6('0x22')]){if(_0x1b93fe[_0xaff6('0x22')]['code']===0x1f4){logger[_0xaff6('0x22')](_0xaff6('0x1e'),_0x4928f0,_0x1b93fe[_0xaff6('0x22')][_0xaff6('0x23')]);return _0x3e11e7(_0x1b93fe[_0xaff6('0x22')][_0xaff6('0x23')]);}logger[_0xaff6('0x22')](_0xaff6('0x1e'),_0x4928f0,_0x1b93fe['error'][_0xaff6('0x23')]);return _0x3663ce(_0x1b93fe['error']['message']);}else{logger['info'](_0xaff6('0x1e'),_0x4928f0,_0xaff6('0x1f'));_0x3663ce(_0x1b93fe[_0xaff6('0x24')][_0xaff6('0x23')]);}})[_0xaff6('0x25')](function(_0x3bf57f){logger[_0xaff6('0x22')]('Setting,\x20%s,\x20%s',_0x4928f0,_0x3bf57f);_0x3e11e7(_0x3bf57f);});});}function respondWithStatusCode(_0x4bba65,_0x57cfd8){_0x57cfd8=_0x57cfd8||0xcc;return function(_0x23ba7b){if(_0x23ba7b){return _0x4bba65[_0xaff6('0x26')](_0x57cfd8);}return _0x4bba65[_0xaff6('0x27')](_0x57cfd8)[_0xaff6('0x28')]();};}function respondWithResult(_0x1a1cc0,_0x393c3c){_0x393c3c=_0x393c3c||0xc8;return function(_0x4fa7bd){if(_0x4fa7bd){return _0x1a1cc0[_0xaff6('0x27')](_0x393c3c)[_0xaff6('0x29')](_0x4fa7bd);}};}function respondWithFilteredResult(_0x1741f3,_0x3e9978){return function(_0x48184e){if(_0x48184e){var _0x237d05=_0x48184e[_0xaff6('0x2a')],_0x46e9ec=_0x3e9978[_0xaff6('0x2b')],_0x4b4e80=_0x3e9978[_0xaff6('0x2b')]+_0x3e9978[_0xaff6('0x2c')],_0x258e45;if(_0x4b4e80>=_0x237d05){_0x4b4e80=_0x237d05;_0x258e45=0xc8;}else{_0x258e45=0xce;}_0x1741f3['status'](_0x258e45);return _0x1741f3[_0xaff6('0x2d')](_0xaff6('0x2e'),_0x46e9ec+'-'+_0x4b4e80+'/'+_0x237d05)[_0xaff6('0x29')](_0x48184e);}return null;};}function patchUpdates(_0x2216f1){return function(_0x8c668c){try{jsonpatch['apply'](_0x8c668c,_0x2216f1,!![]);}catch(_0x4011a0){return BPromise[_0xaff6('0x2f')](_0x4011a0);}return _0x8c668c[_0xaff6('0x30')]();};}function saveUpdates(_0x5d7930,_0x40eec6){return function(_0x1b52a1){if(_0x1b52a1){return _0x1b52a1[_0xaff6('0x31')](_0x5d7930)['then'](function(_0x3cafe2){return _0x3cafe2;});}return null;};}function removeEntity(_0x40d7ca,_0x32747){return function(_0x56ea3d){if(_0x56ea3d){return _0x56ea3d[_0xaff6('0x32')]()[_0xaff6('0x1d')](function(){_0x40d7ca[_0xaff6('0x27')](0xcc)[_0xaff6('0x28')]();});}};}function handleEntityNotFound(_0x1d38ba,_0x5d8933){return function(_0xdf400d){if(!_0xdf400d){_0x1d38ba['sendStatus'](0x194);}return _0xdf400d;};}function handleError(_0x3f07c6,_0x48f69f){_0x48f69f=_0x48f69f||0x1f4;return function(_0x40af0f){logger['error'](_0x40af0f[_0xaff6('0x33')]);if(_0x40af0f['name']){delete _0x40af0f[_0xaff6('0x34')];}_0x3f07c6[_0xaff6('0x27')](_0x48f69f)['send'](_0x40af0f);};}exports['index']=function(_0x38f8f7,_0x5d016){var _0x3da8ba={},_0x5971d0={},_0x3c0429={'count':0x0,'rows':[]};var _0x7aa325=_[_0xaff6('0x35')](db[_0xaff6('0x36')]['rawAttributes'],function(_0x5159da){return{'name':_0x5159da[_0xaff6('0x37')],'type':_0x5159da[_0xaff6('0x38')][_0xaff6('0x39')]};});_0x5971d0[_0xaff6('0x3a')]=_['map'](_0x7aa325,'name');_0x5971d0[_0xaff6('0x3b')]=_['keys'](_0x38f8f7[_0xaff6('0x3b')]);_0x5971d0[_0xaff6('0x3c')]=_[_0xaff6('0x3d')](_0x5971d0[_0xaff6('0x3a')],_0x5971d0[_0xaff6('0x3b')]);_0x3da8ba[_0xaff6('0x3e')]=_[_0xaff6('0x3d')](_0x5971d0['model'],qs[_0xaff6('0x3f')](_0x38f8f7[_0xaff6('0x3b')][_0xaff6('0x3f')]));_0x3da8ba['attributes']=_0x3da8ba[_0xaff6('0x3e')][_0xaff6('0x40')]?_0x3da8ba['attributes']:_0x5971d0[_0xaff6('0x3a')];if(!_0x38f8f7[_0xaff6('0x3b')]['hasOwnProperty'](_0xaff6('0x41'))){_0x3da8ba[_0xaff6('0x2c')]=qs[_0xaff6('0x2c')](_0x38f8f7[_0xaff6('0x3b')]['limit']);_0x3da8ba['offset']=qs[_0xaff6('0x2b')](_0x38f8f7[_0xaff6('0x3b')]['offset']);}_0x3da8ba['order']=qs[_0xaff6('0x42')](_0x38f8f7[_0xaff6('0x3b')][_0xaff6('0x42')]);_0x3da8ba[_0xaff6('0x43')]=qs[_0xaff6('0x3c')](_[_0xaff6('0x44')](_0x38f8f7['query'],_0x5971d0[_0xaff6('0x3c')]),_0x7aa325);if(_0x38f8f7[_0xaff6('0x3b')][_0xaff6('0x45')]){_0x3da8ba[_0xaff6('0x43')]=_[_0xaff6('0x46')](_0x3da8ba[_0xaff6('0x43')],{'$or':_['map'](_0x7aa325,function(_0x2a0dca){if(_0x2a0dca[_0xaff6('0x38')]!==_0xaff6('0x47')){var _0x117151={};_0x117151[_0x2a0dca[_0xaff6('0x34')]]={'$like':'%'+_0x38f8f7['query'][_0xaff6('0x45')]+'%'};return _0x117151;}})});}_0x3da8ba=_[_0xaff6('0x46')]({},_0x3da8ba,_0x38f8f7['options']);var _0x3d5ab7={'where':_0x3da8ba['where']};return db[_0xaff6('0x36')]['count'](_0x3d5ab7)[_0xaff6('0x1d')](function(_0x361542){_0x3c0429[_0xaff6('0x2a')]=_0x361542;if(_0x38f8f7[_0xaff6('0x3b')]['includeAll']){_0x3da8ba['include']=[{'all':!![]}];}return db[_0xaff6('0x36')][_0xaff6('0x48')](_0x3da8ba);})['then'](function(_0x909740){_0x3c0429[_0xaff6('0x49')]=_0x909740;return _0x3c0429;})[_0xaff6('0x1d')](respondWithFilteredResult(_0x5d016,_0x3da8ba))[_0xaff6('0x25')](handleError(_0x5d016,null));};exports[_0xaff6('0x4a')]=function(_0x488f53,_0x4d0a95){var _0x3cd290={'raw':![],'where':{'id':_0x488f53[_0xaff6('0x4b')]['id']}},_0x1b101e={};_0x1b101e[_0xaff6('0x3a')]=_[_0xaff6('0x4c')](db[_0xaff6('0x36')][_0xaff6('0x4d')]);_0x1b101e[_0xaff6('0x3b')]=_['keys'](_0x488f53['query']);_0x1b101e['filters']=_[_0xaff6('0x3d')](_0x1b101e['model'],_0x1b101e['query']);_0x3cd290[_0xaff6('0x3e')]=_[_0xaff6('0x3d')](_0x1b101e[_0xaff6('0x3a')],qs[_0xaff6('0x3f')](_0x488f53[_0xaff6('0x3b')][_0xaff6('0x3f')]));_0x3cd290['attributes']=_0x3cd290[_0xaff6('0x3e')][_0xaff6('0x40')]?_0x3cd290[_0xaff6('0x3e')]:_0x1b101e['model'];if(_0x488f53['query'][_0xaff6('0x4e')]){_0x3cd290[_0xaff6('0x4f')]=[{'all':!![]}];}_0x3cd290=_[_0xaff6('0x46')]({},_0x3cd290,_0x488f53[_0xaff6('0x50')]);return db[_0xaff6('0x36')]['find'](_0x3cd290)['then'](handleEntityNotFound(_0x4d0a95,null))[_0xaff6('0x1d')](respondWithResult(_0x4d0a95,null))[_0xaff6('0x25')](handleError(_0x4d0a95,null));};exports['update']=function(_0x303555,_0x2a8327){if(_0x303555['body']['id']){delete _0x303555[_0xaff6('0x51')]['id'];}return db[_0xaff6('0x36')][_0xaff6('0x52')]({'where':{'id':_0x303555[_0xaff6('0x4b')]['id']}})[_0xaff6('0x1d')](handleEntityNotFound(_0x2a8327,null))[_0xaff6('0x1d')](saveUpdates(_0x303555[_0xaff6('0x51')],null))[_0xaff6('0x1d')](respondWithResult(_0x2a8327,null))['catch'](handleError(_0x2a8327,null));};exports[_0xaff6('0x53')]=function(_0x4a6367,_0x79e8e4,_0x23f019){if(_0x4a6367[_0xaff6('0x54')]&&_0x4a6367['file'][_0xaff6('0x55')]){_0x4a6367[_0xaff6('0x51')]['logo']=_0x4a6367['file']['filename'];}return db[_0xaff6('0x36')][_0xaff6('0x52')]({'where':{'id':_0x4a6367[_0xaff6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x79e8e4,null))[_0xaff6('0x1d')](saveUpdates(_0x4a6367[_0xaff6('0x51')],null))[_0xaff6('0x1d')](respondWithResult(_0x79e8e4,null))[_0xaff6('0x25')](handleError(_0x79e8e4,null));};exports[_0xaff6('0x56')]=function(_0x4235b7,_0x306022,_0x51c652){if(_0x4235b7[_0xaff6('0x54')]&&_0x4235b7[_0xaff6('0x54')][_0xaff6('0x55')]){_0x4235b7[_0xaff6('0x51')][_0xaff6('0x57')]=_0x4235b7[_0xaff6('0x54')]['filename'];}return db[_0xaff6('0x36')][_0xaff6('0x52')]({'where':{'id':_0x4235b7[_0xaff6('0x4b')]['id']}})[_0xaff6('0x1d')](handleEntityNotFound(_0x306022,null))[_0xaff6('0x1d')](saveUpdates(_0x4235b7[_0xaff6('0x51')],null))[_0xaff6('0x1d')](respondWithResult(_0x306022,null))[_0xaff6('0x25')](handleError(_0x306022,null));};var utilLicense=require(_0xaff6('0x18'));exports[_0xaff6('0x58')]=function(_0x45cda5,_0x1e3162,_0x32d7a9){var _0x17a84c=_0xaff6('0x59');var _0x4b3db8={'custom':![]};return utilLicense[_0xaff6('0x5a')]()[_0xaff6('0x1d')](function(_0xfaaa61){if(_0xfaaa61){_0x4b3db8=_0xfaaa61;}return db[_0xaff6('0x36')]['find']({'where':{'id':_0x45cda5[_0xaff6('0x4b')]['id']},'attributes':[_0xaff6('0x5b'),_0xaff6('0x57'),_0xaff6('0x5c'),'favicon',_0xaff6('0x5d'),_0xaff6('0x5e'),'defaultPreferred',_0xaff6('0x5f')],'raw':!![]});})[_0xaff6('0x1d')](handleEntityNotFound(_0x1e3162,null))[_0xaff6('0x1d')](function(_0x52afb8){if(_0x52afb8){var _0x3ee065=_0x52afb8[_0xaff6('0x5b')]&&fs[_0xaff6('0x60')](path['join'](config['root'],_0x17a84c,_[_0xaff6('0x61')](_0x52afb8[_0xaff6('0x5b')])))?path['join'](config[_0xaff6('0x62')],_0x17a84c,_['toLower'](_0x52afb8[_0xaff6('0x5b')])):path[_0xaff6('0x63')](config[_0xaff6('0x62')],_0x17a84c,_[_0xaff6('0x61')](_0xaff6('0x64')));var _0x249aee='default'+_['upperFirst'](_0xaff6('0x5b'));if(_0x52afb8[_0x249aee]||!_0x4b3db8[_0xaff6('0x65')]){_0x3ee065=path[_0xaff6('0x63')](config['root'],_0x17a84c,_[_0xaff6('0x61')](_0xaff6('0x64')));}if(!fs[_0xaff6('0x60')](_0x3ee065)){throw new db[(_0xaff6('0x66'))][(_0xaff6('0x67'))](_[_0xaff6('0x68')](_0xaff6('0x5b'))+_0xaff6('0x69'));}return _0x1e3162['download'](_0x3ee065);}})[_0xaff6('0x25')](handleError(_0x1e3162,null));};var utilLicense=require(_0xaff6('0x18'));exports[_0xaff6('0x6a')]=function(_0xf26b5d,_0x4160b1,_0x42610d){var _0x7f2be9=_0xaff6('0x59');var _0x20070e={'custom':![]};return utilLicense[_0xaff6('0x5a')]()[_0xaff6('0x1d')](function(_0x2855b1){if(_0x2855b1){_0x20070e=_0x2855b1;}return db[_0xaff6('0x36')][_0xaff6('0x52')]({'where':{'id':_0xf26b5d['params']['id']},'attributes':[_0xaff6('0x5b'),'loginLogo',_0xaff6('0x5c'),'favicon','defaultLogo','defaultLoginLogo',_0xaff6('0x6b'),'defaultFavicon'],'raw':!![]});})[_0xaff6('0x1d')](handleEntityNotFound(_0x4160b1,null))[_0xaff6('0x1d')](function(_0x2557cd){if(_0x2557cd){var _0x2475e8=_0x2557cd['loginLogo']&&fs[_0xaff6('0x60')](path[_0xaff6('0x63')](config[_0xaff6('0x62')],_0x7f2be9,_[_0xaff6('0x61')](_0x2557cd['loginLogo'])))?path['join'](config[_0xaff6('0x62')],_0x7f2be9,_['toLower'](_0x2557cd[_0xaff6('0x57')])):path[_0xaff6('0x63')](config[_0xaff6('0x62')],_0x7f2be9,_[_0xaff6('0x61')]('default_loginLogo.svg'));var _0x3ff734='default'+_[_0xaff6('0x68')](_0xaff6('0x57'));if(_0x2557cd[_0x3ff734]||!_0x20070e['custom']){_0x2475e8=path[_0xaff6('0x63')](config[_0xaff6('0x62')],_0x7f2be9,_['toLower'](_0xaff6('0x6c')));}if(!fs[_0xaff6('0x60')](_0x2475e8)){throw new db[(_0xaff6('0x66'))][(_0xaff6('0x67'))](_['upperFirst'](_0xaff6('0x57'))+_0xaff6('0x69'));}return _0x4160b1['download'](_0x2475e8);}})['catch'](handleError(_0x4160b1,null));};exports[_0xaff6('0x6d')]=function(_0x37fdfe,_0x2d2c07){return db['Setting']['find']({'where':{'id':_0x37fdfe[_0xaff6('0x4b')]['id']},'attributes':[_0xaff6('0x6e')]})[_0xaff6('0x1d')](respondWithResult(_0x2d2c07,null))['catch'](handleError(_0x2d2c07,null));};exports['addPreferred']=function(_0x2acc69,_0x33ec12,_0x214a5a){if(_0x2acc69[_0xaff6('0x54')]&&_0x2acc69[_0xaff6('0x54')][_0xaff6('0x55')]){_0x2acc69[_0xaff6('0x51')][_0xaff6('0x5c')]=_0x2acc69['file'][_0xaff6('0x55')];}return db['Setting'][_0xaff6('0x52')]({'where':{'id':_0x2acc69[_0xaff6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x33ec12,null))[_0xaff6('0x1d')](saveUpdates(_0x2acc69[_0xaff6('0x51')],null))[_0xaff6('0x1d')](respondWithResult(_0x33ec12,null))[_0xaff6('0x25')](handleError(_0x33ec12,null));};var utilLicense=require(_0xaff6('0x18'));exports[_0xaff6('0x6f')]=function(_0xdbefdc,_0x46ac32,_0x1315cc){var _0x309685=_0xaff6('0x59');var _0x2b0416={'custom':![]};return utilLicense[_0xaff6('0x5a')]()[_0xaff6('0x1d')](function(_0x4f0468){if(_0x4f0468){_0x2b0416=_0x4f0468;}return db[_0xaff6('0x36')][_0xaff6('0x52')]({'where':{'id':_0xdbefdc[_0xaff6('0x4b')]['id']},'attributes':[_0xaff6('0x5b'),_0xaff6('0x57'),_0xaff6('0x5c'),_0xaff6('0x70'),'defaultLogo',_0xaff6('0x5e'),'defaultPreferred',_0xaff6('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x46ac32,null))['then'](function(_0x28d3ac){if(_0x28d3ac){var _0x170cc1=_0x28d3ac['preferred']&&fs[_0xaff6('0x60')](path[_0xaff6('0x63')](config['root'],_0x309685,_['toLower'](_0x28d3ac[_0xaff6('0x5c')])))?path[_0xaff6('0x63')](config['root'],_0x309685,_[_0xaff6('0x61')](_0x28d3ac[_0xaff6('0x5c')])):path[_0xaff6('0x63')](config[_0xaff6('0x62')],_0x309685,_['toLower'](_0xaff6('0x71')));var _0x1a17d0='default'+_[_0xaff6('0x68')]('preferred');if(_0x28d3ac[_0x1a17d0]||!_0x2b0416[_0xaff6('0x65')]||!_0x2b0416['preferred']){_0x170cc1=path['join'](config[_0xaff6('0x62')],_0x309685,_['toLower']('default_preferred.png'));}if(!fs[_0xaff6('0x60')](_0x170cc1)){throw new db[(_0xaff6('0x66'))]['ValidationError'](_[_0xaff6('0x68')](_0xaff6('0x5c'))+_0xaff6('0x69'));}return _0x46ac32['download'](_0x170cc1);}})[_0xaff6('0x25')](handleError(_0x46ac32,null));};exports[_0xaff6('0x72')]=function(_0xa19d76,_0x15432e,_0x1559fe){if(_0xa19d76[_0xaff6('0x54')]&&_0xa19d76[_0xaff6('0x54')][_0xaff6('0x55')]){_0xa19d76[_0xaff6('0x51')][_0xaff6('0x70')]=_0xa19d76['file'][_0xaff6('0x55')];}return db[_0xaff6('0x36')][_0xaff6('0x52')]({'where':{'id':_0xa19d76['params']['id']}})[_0xaff6('0x1d')](handleEntityNotFound(_0x15432e,null))['then'](saveUpdates(_0xa19d76['body'],null))[_0xaff6('0x1d')](respondWithResult(_0x15432e,null))[_0xaff6('0x25')](handleError(_0x15432e,null));};var utilLicense=require(_0xaff6('0x18'));exports[_0xaff6('0x73')]=function(_0x170572,_0x1648a7,_0x3ad70d){var _0xf46ba0=_0xaff6('0x59');var _0x4e61e7={'custom':![]};return utilLicense['getLicense']()[_0xaff6('0x1d')](function(_0x269ae2){if(_0x269ae2){_0x4e61e7=_0x269ae2;}return db[_0xaff6('0x36')]['find']({'where':{'id':_0x170572[_0xaff6('0x4b')]['id']},'attributes':[_0xaff6('0x5b'),'loginLogo',_0xaff6('0x5c'),_0xaff6('0x70'),_0xaff6('0x5d'),_0xaff6('0x5e'),'defaultPreferred',_0xaff6('0x5f')],'raw':!![]});})[_0xaff6('0x1d')](handleEntityNotFound(_0x1648a7,null))[_0xaff6('0x1d')](function(_0x48c2b9){if(_0x48c2b9){var _0x9f9d42=_0x48c2b9['favicon']&&fs[_0xaff6('0x60')](path[_0xaff6('0x63')](config[_0xaff6('0x62')],_0xf46ba0,_[_0xaff6('0x61')](_0x48c2b9['favicon'])))?path[_0xaff6('0x63')](config[_0xaff6('0x62')],_0xf46ba0,_[_0xaff6('0x61')](_0x48c2b9[_0xaff6('0x70')])):path[_0xaff6('0x63')](config[_0xaff6('0x62')],_0xf46ba0,_[_0xaff6('0x61')](_0xaff6('0x74')));var _0x342316=_0xaff6('0x75')+_['upperFirst'](_0xaff6('0x70'));if(_0x48c2b9[_0x342316]||!_0x4e61e7[_0xaff6('0x65')]){_0x9f9d42=path[_0xaff6('0x63')](config[_0xaff6('0x62')],_0xf46ba0,_[_0xaff6('0x61')](_0xaff6('0x74')));}if(!fs[_0xaff6('0x60')](_0x9f9d42)){throw new db['Sequelize'][(_0xaff6('0x67'))](_[_0xaff6('0x68')](_0xaff6('0x70'))+'\x20not\x20found');}return _0x1648a7[_0xaff6('0x76')](_0x9f9d42);}})[_0xaff6('0x25')](handleError(_0x1648a7,null));};exports[_0xaff6('0x77')]=function(_0x33bd52,_0x3759fa){var _0x373282={'offset':moment()[_0xaff6('0x78')]()};_0x373282[_0xaff6('0x79')]=moment()[_0xaff6('0x78')](_0x373282[_0xaff6('0x2b')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x3759fa[_0xaff6('0x27')](0xc8)[_0xaff6('0x7a')](_0x373282);}; \ No newline at end of file +var _0x10bb=['defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','download','getLogoLogin','default_loginLogo.svg','existsSync','Sequelize','ValidationError','\x20not\x20found','gdpr','addPreferred','preferred','getPreferred','server/files/images/logos','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','rows','params','length','includeAll','include','find','body','addLogo','file','filename','logo','addLogoLogin','getLicense','loginLogo','favicon','defaultLogo'];(function(_0x20099a,_0x2bf584){var _0x2c3649=function(_0x3c2f4b){while(--_0x3c2f4b){_0x20099a['push'](_0x20099a['shift']());}};_0x2c3649(++_0x2bf584);}(_0x10bb,0x10f));var _0xb10b=function(_0x2b772a,_0x40b92f){_0x2b772a=_0x2b772a-0x0;var _0xef7eb5=_0x10bb[_0x2b772a];return _0xef7eb5;};'use strict';var pdf=require(_0xb10b('0x0'));var emlformat=require(_0xb10b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb10b('0x2'));var jsonpatch=require(_0xb10b('0x3'));var rp=require('request-promise');var moment=require(_0xb10b('0x4'));var BPromise=require(_0xb10b('0x5'));var Mustache=require(_0xb10b('0x6'));var util=require(_0xb10b('0x7'));var path=require(_0xb10b('0x8'));var sox=require(_0xb10b('0x9'));var csv=require(_0xb10b('0xa'));var ejs=require(_0xb10b('0xb'));var fs=require('fs');var _=require(_0xb10b('0xc'));var squel=require(_0xb10b('0xd'));var crypto=require('crypto');var jsforce=require(_0xb10b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb10b('0xf'));var Papa=require('papaparse');var Redis=require(_0xb10b('0x10'));var authService=require(_0xb10b('0x11'));var qs=require(_0xb10b('0x12'));var as=require(_0xb10b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb10b('0x14'))(_0xb10b('0x15'));var utils=require(_0xb10b('0x16'));var config=require(_0xb10b('0x17'));var licenseUtil=require(_0xb10b('0x18'));var db=require(_0xb10b('0x19'))['db'];var jayson=require(_0xb10b('0x1a'));var client=jayson[_0xb10b('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9bf0,_0x30244d,_0x40227e,_0x495afa){return new BPromise(function(_0x1321bb,_0x356415){var _0x524578=_0x495afa||client;return _0x524578['request'](_0x2c9bf0,_0x40227e)[_0xb10b('0x1c')](function(_0x1dd19b){logger[_0xb10b('0x1d')](_0xb10b('0x1e'),_0x30244d,_0xb10b('0x1f'));logger[_0xb10b('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x30244d,'request\x20sent',JSON[_0xb10b('0x21')](_0x1dd19b));if(_0x1dd19b[_0xb10b('0x22')]){if(_0x1dd19b[_0xb10b('0x22')][_0xb10b('0x23')]===0x1f4){logger[_0xb10b('0x22')](_0xb10b('0x1e'),_0x30244d,_0x1dd19b['error'][_0xb10b('0x24')]);return _0x356415(_0x1dd19b[_0xb10b('0x22')][_0xb10b('0x24')]);}logger[_0xb10b('0x22')](_0xb10b('0x1e'),_0x30244d,_0x1dd19b[_0xb10b('0x22')][_0xb10b('0x24')]);return _0x1321bb(_0x1dd19b[_0xb10b('0x22')][_0xb10b('0x24')]);}else{logger['info'](_0xb10b('0x1e'),_0x30244d,_0xb10b('0x1f'));_0x1321bb(_0x1dd19b[_0xb10b('0x25')][_0xb10b('0x24')]);}})[_0xb10b('0x26')](function(_0x30d4e7){logger['error'](_0xb10b('0x1e'),_0x30244d,_0x30d4e7);_0x356415(_0x30d4e7);});});}function respondWithStatusCode(_0x4e61bb,_0x453d85){_0x453d85=_0x453d85||0xcc;return function(_0x2d374d){if(_0x2d374d){return _0x4e61bb[_0xb10b('0x27')](_0x453d85);}return _0x4e61bb[_0xb10b('0x28')](_0x453d85)[_0xb10b('0x29')]();};}function respondWithResult(_0x2c3340,_0x567cf6){_0x567cf6=_0x567cf6||0xc8;return function(_0x530299){if(_0x530299){return _0x2c3340[_0xb10b('0x28')](_0x567cf6)[_0xb10b('0x2a')](_0x530299);}};}function respondWithFilteredResult(_0x47c427,_0x1c6620){return function(_0x52ed82){if(_0x52ed82){var _0x22055a=_0x52ed82['count'],_0x549fe6=_0x1c6620[_0xb10b('0x2b')],_0x3aeb62=_0x1c6620[_0xb10b('0x2b')]+_0x1c6620[_0xb10b('0x2c')],_0x46e146;if(_0x3aeb62>=_0x22055a){_0x3aeb62=_0x22055a;_0x46e146=0xc8;}else{_0x46e146=0xce;}_0x47c427[_0xb10b('0x28')](_0x46e146);return _0x47c427[_0xb10b('0x2d')](_0xb10b('0x2e'),_0x549fe6+'-'+_0x3aeb62+'/'+_0x22055a)[_0xb10b('0x2a')](_0x52ed82);}return null;};}function patchUpdates(_0x392451){return function(_0x27b213){try{jsonpatch[_0xb10b('0x2f')](_0x27b213,_0x392451,!![]);}catch(_0x3f74e2){return BPromise[_0xb10b('0x30')](_0x3f74e2);}return _0x27b213['save']();};}function saveUpdates(_0x1ccc53,_0x2d39e5){return function(_0x2801db){if(_0x2801db){return _0x2801db[_0xb10b('0x31')](_0x1ccc53)[_0xb10b('0x1c')](function(_0x4da284){return _0x4da284;});}return null;};}function removeEntity(_0x2c79da,_0x500143){return function(_0x36db98){if(_0x36db98){return _0x36db98['destroy']()[_0xb10b('0x1c')](function(){_0x2c79da[_0xb10b('0x28')](0xcc)[_0xb10b('0x29')]();});}};}function handleEntityNotFound(_0x15bf99,_0x44f8e8){return function(_0x4d3d6a){if(!_0x4d3d6a){_0x15bf99[_0xb10b('0x27')](0x194);}return _0x4d3d6a;};}function handleError(_0x444653,_0x299209){_0x299209=_0x299209||0x1f4;return function(_0x3142fa){logger[_0xb10b('0x22')](_0x3142fa[_0xb10b('0x32')]);if(_0x3142fa[_0xb10b('0x33')]){delete _0x3142fa[_0xb10b('0x33')];}_0x444653[_0xb10b('0x28')](_0x299209)[_0xb10b('0x34')](_0x3142fa);};}exports[_0xb10b('0x35')]=function(_0x7f3665,_0x47358a){var _0x50419e={},_0x459b82={},_0x5e05c5={'count':0x0,'rows':[]};var _0x2c9df9=_[_0xb10b('0x36')](db[_0xb10b('0x37')][_0xb10b('0x38')],function(_0x195c81){return{'name':_0x195c81[_0xb10b('0x39')],'type':_0x195c81[_0xb10b('0x3a')][_0xb10b('0x3b')]};});_0x459b82[_0xb10b('0x3c')]=_[_0xb10b('0x36')](_0x2c9df9,_0xb10b('0x33'));_0x459b82['query']=_[_0xb10b('0x3d')](_0x7f3665['query']);_0x459b82['filters']=_[_0xb10b('0x3e')](_0x459b82['model'],_0x459b82[_0xb10b('0x3f')]);_0x50419e[_0xb10b('0x40')]=_[_0xb10b('0x3e')](_0x459b82[_0xb10b('0x3c')],qs[_0xb10b('0x41')](_0x7f3665[_0xb10b('0x3f')][_0xb10b('0x41')]));_0x50419e[_0xb10b('0x40')]=_0x50419e[_0xb10b('0x40')]['length']?_0x50419e['attributes']:_0x459b82[_0xb10b('0x3c')];if(!_0x7f3665[_0xb10b('0x3f')][_0xb10b('0x42')](_0xb10b('0x43'))){_0x50419e['limit']=qs[_0xb10b('0x2c')](_0x7f3665[_0xb10b('0x3f')][_0xb10b('0x2c')]);_0x50419e[_0xb10b('0x2b')]=qs[_0xb10b('0x2b')](_0x7f3665['query'][_0xb10b('0x2b')]);}_0x50419e[_0xb10b('0x44')]=qs[_0xb10b('0x45')](_0x7f3665[_0xb10b('0x3f')][_0xb10b('0x45')]);_0x50419e[_0xb10b('0x46')]=qs[_0xb10b('0x47')](_[_0xb10b('0x48')](_0x7f3665[_0xb10b('0x3f')],_0x459b82[_0xb10b('0x47')]),_0x2c9df9);if(_0x7f3665[_0xb10b('0x3f')][_0xb10b('0x49')]){_0x50419e[_0xb10b('0x46')]=_[_0xb10b('0x4a')](_0x50419e[_0xb10b('0x46')],{'$or':_[_0xb10b('0x36')](_0x2c9df9,function(_0x14b9f){if(_0x14b9f[_0xb10b('0x3a')]!=='VIRTUAL'){var _0x3a91b3={};_0x3a91b3[_0x14b9f[_0xb10b('0x33')]]={'$like':'%'+_0x7f3665[_0xb10b('0x3f')][_0xb10b('0x49')]+'%'};return _0x3a91b3;}})});}_0x50419e=_[_0xb10b('0x4a')]({},_0x50419e,_0x7f3665[_0xb10b('0x4b')]);var _0x5ac744={'where':_0x50419e['where']};return db[_0xb10b('0x37')]['count'](_0x5ac744)[_0xb10b('0x1c')](function(_0x1c0a83){_0x5e05c5['count']=_0x1c0a83;if(_0x7f3665[_0xb10b('0x3f')]['includeAll']){_0x50419e['include']=[{'all':!![]}];}return db[_0xb10b('0x37')]['findAll'](_0x50419e);})[_0xb10b('0x1c')](function(_0x244271){_0x5e05c5[_0xb10b('0x4c')]=_0x244271;return _0x5e05c5;})[_0xb10b('0x1c')](respondWithFilteredResult(_0x47358a,_0x50419e))[_0xb10b('0x26')](handleError(_0x47358a,null));};exports['show']=function(_0xe65109,_0x48b78a){var _0x2a7097={'raw':![],'where':{'id':_0xe65109[_0xb10b('0x4d')]['id']}},_0x64cd98={};_0x64cd98[_0xb10b('0x3c')]=_[_0xb10b('0x3d')](db[_0xb10b('0x37')]['rawAttributes']);_0x64cd98['query']=_[_0xb10b('0x3d')](_0xe65109[_0xb10b('0x3f')]);_0x64cd98[_0xb10b('0x47')]=_[_0xb10b('0x3e')](_0x64cd98[_0xb10b('0x3c')],_0x64cd98['query']);_0x2a7097[_0xb10b('0x40')]=_['intersection'](_0x64cd98['model'],qs[_0xb10b('0x41')](_0xe65109[_0xb10b('0x3f')][_0xb10b('0x41')]));_0x2a7097['attributes']=_0x2a7097[_0xb10b('0x40')][_0xb10b('0x4e')]?_0x2a7097[_0xb10b('0x40')]:_0x64cd98[_0xb10b('0x3c')];if(_0xe65109[_0xb10b('0x3f')][_0xb10b('0x4f')]){_0x2a7097[_0xb10b('0x50')]=[{'all':!![]}];}_0x2a7097=_['merge']({},_0x2a7097,_0xe65109[_0xb10b('0x4b')]);return db[_0xb10b('0x37')][_0xb10b('0x51')](_0x2a7097)[_0xb10b('0x1c')](handleEntityNotFound(_0x48b78a,null))[_0xb10b('0x1c')](respondWithResult(_0x48b78a,null))['catch'](handleError(_0x48b78a,null));};exports['update']=function(_0x7d0fb6,_0x231847){if(_0x7d0fb6[_0xb10b('0x52')]['id']){delete _0x7d0fb6[_0xb10b('0x52')]['id'];}return db[_0xb10b('0x37')]['find']({'where':{'id':_0x7d0fb6[_0xb10b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x231847,null))[_0xb10b('0x1c')](saveUpdates(_0x7d0fb6[_0xb10b('0x52')],null))['then'](respondWithResult(_0x231847,null))[_0xb10b('0x26')](handleError(_0x231847,null));};exports[_0xb10b('0x53')]=function(_0xd5576,_0xcb6698,_0x2b7752){if(_0xd5576[_0xb10b('0x54')]&&_0xd5576[_0xb10b('0x54')][_0xb10b('0x55')]){_0xd5576[_0xb10b('0x52')][_0xb10b('0x56')]=_0xd5576[_0xb10b('0x54')][_0xb10b('0x55')];}return db[_0xb10b('0x37')][_0xb10b('0x51')]({'where':{'id':_0xd5576[_0xb10b('0x4d')]['id']}})[_0xb10b('0x1c')](handleEntityNotFound(_0xcb6698,null))[_0xb10b('0x1c')](saveUpdates(_0xd5576[_0xb10b('0x52')],null))[_0xb10b('0x1c')](respondWithResult(_0xcb6698,null))[_0xb10b('0x26')](handleError(_0xcb6698,null));};exports[_0xb10b('0x57')]=function(_0x52837e,_0x6a0a95,_0x10f6e4){if(_0x52837e[_0xb10b('0x54')]&&_0x52837e[_0xb10b('0x54')]['filename']){_0x52837e[_0xb10b('0x52')]['loginLogo']=_0x52837e[_0xb10b('0x54')][_0xb10b('0x55')];}return db['Setting'][_0xb10b('0x51')]({'where':{'id':_0x52837e[_0xb10b('0x4d')]['id']}})[_0xb10b('0x1c')](handleEntityNotFound(_0x6a0a95,null))[_0xb10b('0x1c')](saveUpdates(_0x52837e[_0xb10b('0x52')],null))[_0xb10b('0x1c')](respondWithResult(_0x6a0a95,null))[_0xb10b('0x26')](handleError(_0x6a0a95,null));};var utilLicense=require(_0xb10b('0x18'));exports['getLogo']=function(_0xdb3ab8,_0x4ec8d6,_0x3e573c){var _0x1ad6e9='server/files/images/logos';var _0x1556ba={'custom':![]};return utilLicense[_0xb10b('0x58')]()[_0xb10b('0x1c')](function(_0x2a08c6){if(_0x2a08c6){_0x1556ba=_0x2a08c6;}return db[_0xb10b('0x37')][_0xb10b('0x51')]({'where':{'id':_0xdb3ab8['params']['id']},'attributes':[_0xb10b('0x56'),_0xb10b('0x59'),'preferred',_0xb10b('0x5a'),_0xb10b('0x5b'),_0xb10b('0x5c'),_0xb10b('0x5d'),_0xb10b('0x5e')],'raw':!![]});})[_0xb10b('0x1c')](handleEntityNotFound(_0x4ec8d6,null))[_0xb10b('0x1c')](function(_0x4f85e3){if(_0x4f85e3){var _0x248474=_0x4f85e3[_0xb10b('0x56')]&&fs['existsSync'](path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x1ad6e9,_[_0xb10b('0x61')](_0x4f85e3['logo'])))?path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x1ad6e9,_[_0xb10b('0x61')](_0x4f85e3['logo'])):path['join'](config[_0xb10b('0x60')],_0x1ad6e9,_[_0xb10b('0x61')](_0xb10b('0x62')));var _0x44d230=_0xb10b('0x63')+_[_0xb10b('0x64')](_0xb10b('0x56'));if(_0x4f85e3[_0x44d230]||!_0x1556ba[_0xb10b('0x65')]){_0x248474=path['join'](config[_0xb10b('0x60')],_0x1ad6e9,_[_0xb10b('0x61')]('default_logo.svg'));}if(!fs['existsSync'](_0x248474)){throw new db['Sequelize']['ValidationError'](_[_0xb10b('0x64')](_0xb10b('0x56'))+'\x20not\x20found');}return _0x4ec8d6[_0xb10b('0x66')](_0x248474);}})[_0xb10b('0x26')](handleError(_0x4ec8d6,null));};var utilLicense=require(_0xb10b('0x18'));exports[_0xb10b('0x67')]=function(_0x4ce0fc,_0x1394db,_0x2f4d6a){var _0x1ffdfb='server/files/images/logos';var _0x47ea75={'custom':![]};return utilLicense[_0xb10b('0x58')]()[_0xb10b('0x1c')](function(_0x285e1b){if(_0x285e1b){_0x47ea75=_0x285e1b;}return db[_0xb10b('0x37')][_0xb10b('0x51')]({'where':{'id':_0x4ce0fc[_0xb10b('0x4d')]['id']},'attributes':['logo',_0xb10b('0x59'),'preferred',_0xb10b('0x5a'),_0xb10b('0x5b'),_0xb10b('0x5c'),_0xb10b('0x5d'),_0xb10b('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x1394db,null))['then'](function(_0xb7add7){if(_0xb7add7){var _0x52713e=_0xb7add7[_0xb10b('0x59')]&&fs['existsSync'](path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x1ffdfb,_['toLower'](_0xb7add7[_0xb10b('0x59')])))?path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x1ffdfb,_['toLower'](_0xb7add7[_0xb10b('0x59')])):path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x1ffdfb,_[_0xb10b('0x61')]('default_loginLogo.svg'));var _0x346f2e=_0xb10b('0x63')+_[_0xb10b('0x64')](_0xb10b('0x59'));if(_0xb7add7[_0x346f2e]||!_0x47ea75['custom']){_0x52713e=path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x1ffdfb,_['toLower'](_0xb10b('0x68')));}if(!fs[_0xb10b('0x69')](_0x52713e)){throw new db[(_0xb10b('0x6a'))][(_0xb10b('0x6b'))](_[_0xb10b('0x64')](_0xb10b('0x59'))+_0xb10b('0x6c'));}return _0x1394db[_0xb10b('0x66')](_0x52713e);}})[_0xb10b('0x26')](handleError(_0x1394db,null));};exports[_0xb10b('0x6d')]=function(_0x57a71b,_0x4c7d11){return db[_0xb10b('0x37')][_0xb10b('0x51')]({'where':{'id':_0x57a71b[_0xb10b('0x4d')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x4c7d11,null))[_0xb10b('0x26')](handleError(_0x4c7d11,null));};exports[_0xb10b('0x6e')]=function(_0x1061e5,_0x33d789,_0x4aa6a3){if(_0x1061e5[_0xb10b('0x54')]&&_0x1061e5[_0xb10b('0x54')]['filename']){_0x1061e5[_0xb10b('0x52')][_0xb10b('0x6f')]=_0x1061e5[_0xb10b('0x54')]['filename'];}return db[_0xb10b('0x37')][_0xb10b('0x51')]({'where':{'id':_0x1061e5[_0xb10b('0x4d')]['id']}})[_0xb10b('0x1c')](handleEntityNotFound(_0x33d789,null))[_0xb10b('0x1c')](saveUpdates(_0x1061e5[_0xb10b('0x52')],null))['then'](respondWithResult(_0x33d789,null))['catch'](handleError(_0x33d789,null));};var utilLicense=require(_0xb10b('0x18'));exports[_0xb10b('0x70')]=function(_0x25114b,_0x242cfd,_0x1cb117){var _0x149dc5=_0xb10b('0x71');var _0x1b5559={'custom':![]};return utilLicense['getLicense']()[_0xb10b('0x1c')](function(_0x48253a){if(_0x48253a){_0x1b5559=_0x48253a;}return db['Setting']['find']({'where':{'id':_0x25114b[_0xb10b('0x4d')]['id']},'attributes':[_0xb10b('0x56'),_0xb10b('0x59'),'preferred',_0xb10b('0x5a'),_0xb10b('0x5b'),_0xb10b('0x5c'),'defaultPreferred',_0xb10b('0x5e')],'raw':!![]});})[_0xb10b('0x1c')](handleEntityNotFound(_0x242cfd,null))[_0xb10b('0x1c')](function(_0x40329b){if(_0x40329b){var _0x45f00a=_0x40329b[_0xb10b('0x6f')]&&fs[_0xb10b('0x69')](path[_0xb10b('0x5f')](config['root'],_0x149dc5,_[_0xb10b('0x61')](_0x40329b[_0xb10b('0x6f')])))?path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x149dc5,_[_0xb10b('0x61')](_0x40329b['preferred'])):path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x149dc5,_[_0xb10b('0x61')](_0xb10b('0x72')));var _0x5eaa9d=_0xb10b('0x63')+_[_0xb10b('0x64')](_0xb10b('0x6f'));if(_0x40329b[_0x5eaa9d]||!_0x1b5559['custom']||!_0x1b5559['preferred']){_0x45f00a=path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x149dc5,_['toLower'](_0xb10b('0x72')));}if(!fs[_0xb10b('0x69')](_0x45f00a)){throw new db[(_0xb10b('0x6a'))][(_0xb10b('0x6b'))](_[_0xb10b('0x64')](_0xb10b('0x6f'))+'\x20not\x20found');}return _0x242cfd[_0xb10b('0x66')](_0x45f00a);}})[_0xb10b('0x26')](handleError(_0x242cfd,null));};exports[_0xb10b('0x73')]=function(_0x1ed592,_0x1b7d02,_0x3f64a6){if(_0x1ed592[_0xb10b('0x54')]&&_0x1ed592[_0xb10b('0x54')][_0xb10b('0x55')]){_0x1ed592[_0xb10b('0x52')][_0xb10b('0x5a')]=_0x1ed592[_0xb10b('0x54')][_0xb10b('0x55')];}return db[_0xb10b('0x37')][_0xb10b('0x51')]({'where':{'id':_0x1ed592[_0xb10b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1b7d02,null))[_0xb10b('0x1c')](saveUpdates(_0x1ed592[_0xb10b('0x52')],null))[_0xb10b('0x1c')](respondWithResult(_0x1b7d02,null))[_0xb10b('0x26')](handleError(_0x1b7d02,null));};var utilLicense=require(_0xb10b('0x18'));exports['getFavicon']=function(_0x519a80,_0x5ecba4,_0x31c470){var _0x5f5cf3=_0xb10b('0x71');var _0x1122ee={'custom':![]};return utilLicense[_0xb10b('0x58')]()[_0xb10b('0x1c')](function(_0x347186){if(_0x347186){_0x1122ee=_0x347186;}return db['Setting']['find']({'where':{'id':_0x519a80[_0xb10b('0x4d')]['id']},'attributes':[_0xb10b('0x56'),'loginLogo',_0xb10b('0x6f'),_0xb10b('0x5a'),_0xb10b('0x5b'),_0xb10b('0x5c'),_0xb10b('0x5d'),_0xb10b('0x5e')],'raw':!![]});})[_0xb10b('0x1c')](handleEntityNotFound(_0x5ecba4,null))[_0xb10b('0x1c')](function(_0x1e2532){if(_0x1e2532){var _0x29380a=_0x1e2532[_0xb10b('0x5a')]&&fs[_0xb10b('0x69')](path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x5f5cf3,_[_0xb10b('0x61')](_0x1e2532[_0xb10b('0x5a')])))?path[_0xb10b('0x5f')](config['root'],_0x5f5cf3,_[_0xb10b('0x61')](_0x1e2532[_0xb10b('0x5a')])):path[_0xb10b('0x5f')](config['root'],_0x5f5cf3,_['toLower'](_0xb10b('0x74')));var _0x58373d=_0xb10b('0x63')+_[_0xb10b('0x64')](_0xb10b('0x5a'));if(_0x1e2532[_0x58373d]||!_0x1122ee[_0xb10b('0x65')]){_0x29380a=path['join'](config[_0xb10b('0x60')],_0x5f5cf3,_[_0xb10b('0x61')]('default_favicon.ico'));}if(!fs['existsSync'](_0x29380a)){throw new db[(_0xb10b('0x6a'))]['ValidationError'](_[_0xb10b('0x64')](_0xb10b('0x5a'))+_0xb10b('0x6c'));}return _0x5ecba4[_0xb10b('0x66')](_0x29380a);}})[_0xb10b('0x26')](handleError(_0x5ecba4,null));};exports[_0xb10b('0x75')]=function(_0x26a2d2,_0x1b68a1){var _0xe5504a={'offset':moment()[_0xb10b('0x76')]()};_0xe5504a[_0xb10b('0x77')]=moment()['utcOffset'](_0xe5504a['offset'])[_0xb10b('0x78')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x1b68a1[_0xb10b('0x28')](0xc8)[_0xb10b('0x34')](_0xe5504a);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index de05fb8..ba4eadb 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 _0x29db=['define','Setting','settings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x29db,0x81));var _0xb29d=function(_0x30d744,_0x21cf66){_0x30d744=_0x30d744-0x0;var _0x170788=_0x29db[_0x30d744];return _0x170788;};'use strict';var _=require(_0xb29d('0x0'));var util=require(_0xb29d('0x1'));var logger=require(_0xb29d('0x2'))(_0xb29d('0x3'));var moment=require(_0xb29d('0x4'));var BPromise=require(_0xb29d('0x5'));var rp=require(_0xb29d('0x6'));var fs=require('fs');var path=require(_0xb29d('0x7'));var rimraf=require(_0xb29d('0x8'));var config=require(_0xb29d('0x9'));var attributes=require('./setting.attributes');module[_0xb29d('0xa')]=function(_0x20925a,_0x35e6c7){return _0x20925a[_0xb29d('0xb')](_0xb29d('0xc'),attributes,{'tableName':_0xb29d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9b0=['./setting.attributes','settings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0xe9b0,0x141));var _0x0e9b=function(_0x3ddefb,_0x2641f9){_0x3ddefb=_0x3ddefb-0x0;var _0x206cfc=_0xe9b0[_0x3ddefb];return _0x206cfc;};'use strict';var _=require(_0x0e9b('0x0'));var util=require(_0x0e9b('0x1'));var logger=require(_0x0e9b('0x2'))(_0x0e9b('0x3'));var moment=require(_0x0e9b('0x4'));var BPromise=require(_0x0e9b('0x5'));var rp=require(_0x0e9b('0x6'));var fs=require('fs');var path=require(_0x0e9b('0x7'));var rimraf=require('rimraf');var config=require(_0x0e9b('0x8'));var attributes=require(_0x0e9b('0x9'));module['exports']=function(_0x16fd99,_0x8748d4){return _0x16fd99['define']('Setting',attributes,{'tableName':_0x0e9b('0xa'),'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 1fe9d86..2f1b35a 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 _0xef58=['debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','options','raw','where','attributes','map','include','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent'];(function(_0x2c0312,_0x509949){var _0x493427=function(_0x524c25){while(--_0x524c25){_0x2c0312['push'](_0x2c0312['shift']());}};_0x493427(++_0x509949);}(_0xef58,0x74));var _0x8ef5=function(_0x3bca2d,_0x1af8f4){_0x3bca2d=_0x3bca2d-0x0;var _0x144a7c=_0xef58[_0x3bca2d];return _0x144a7c;};'use strict';var _=require(_0x8ef5('0x0'));var util=require('util');var moment=require(_0x8ef5('0x1'));var BPromise=require(_0x8ef5('0x2'));var rs=require(_0x8ef5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef5('0x4'))['db'];var utils=require(_0x8ef5('0x5'));var logger=require(_0x8ef5('0x6'))(_0x8ef5('0x7'));var config=require(_0x8ef5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8ef5('0x9')][_0x8ef5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b4de9,_0xb26106,_0x5ee497){return new BPromise(function(_0x36729b,_0x144bc2){return client[_0x8ef5('0xb')](_0x4b4de9,_0x5ee497)[_0x8ef5('0xc')](function(_0x34df80){logger[_0x8ef5('0xd')](_0x8ef5('0xe'),_0xb26106,_0x8ef5('0xf'));logger[_0x8ef5('0x10')](_0x8ef5('0x11'),_0xb26106,_0x8ef5('0xf'),JSON[_0x8ef5('0x12')](_0x34df80));if(_0x34df80[_0x8ef5('0x13')]){if(_0x34df80[_0x8ef5('0x13')][_0x8ef5('0x14')]===0x1f4){logger[_0x8ef5('0x13')]('Setting,\x20%s,\x20%s',_0xb26106,_0x34df80[_0x8ef5('0x13')][_0x8ef5('0x15')]);return _0x144bc2(_0x34df80['error'][_0x8ef5('0x15')]);}logger[_0x8ef5('0x13')](_0x8ef5('0xe'),_0xb26106,_0x34df80[_0x8ef5('0x13')]['message']);return _0x36729b(_0x34df80[_0x8ef5('0x13')][_0x8ef5('0x15')]);}else{logger[_0x8ef5('0xd')](_0x8ef5('0xe'),_0xb26106,'request\x20sent');_0x36729b(_0x34df80[_0x8ef5('0x16')][_0x8ef5('0x15')]);}})[_0x8ef5('0x17')](function(_0x5eef70){logger[_0x8ef5('0x13')](_0x8ef5('0xe'),_0xb26106,_0x5eef70);_0x144bc2(_0x5eef70);});});}exports[_0x8ef5('0x18')]=function(_0x22a6c0){var _0x198384=this;return new Promise(function(_0x463899,_0x9e1436){return db[_0x8ef5('0x19')]['find']({'raw':_0x22a6c0[_0x8ef5('0x1a')]?_0x22a6c0[_0x8ef5('0x1a')][_0x8ef5('0x1b')]===undefined?!![]:![]:!![],'where':_0x22a6c0[_0x8ef5('0x1a')]?_0x22a6c0[_0x8ef5('0x1a')][_0x8ef5('0x1c')]||null:null,'attributes':_0x22a6c0[_0x8ef5('0x1a')]?_0x22a6c0[_0x8ef5('0x1a')][_0x8ef5('0x1d')]||null:null,'include':_0x22a6c0[_0x8ef5('0x1a')]?_0x22a6c0[_0x8ef5('0x1a')]['include']?_[_0x8ef5('0x1e')](_0x22a6c0[_0x8ef5('0x1a')][_0x8ef5('0x1f')],function(_0x2e3796){return{'model':db[_0x2e3796['model']],'as':_0x2e3796['as'],'attributes':_0x2e3796['attributes'],'include':_0x2e3796['include']?_[_0x8ef5('0x1e')](_0x2e3796[_0x8ef5('0x1f')],function(_0x21e2b4){return{'model':db[_0x21e2b4['model']],'as':_0x21e2b4['as'],'attributes':_0x21e2b4[_0x8ef5('0x1d')],'include':_0x21e2b4[_0x8ef5('0x1f')]?_[_0x8ef5('0x1e')](_0x21e2b4[_0x8ef5('0x1f')],function(_0x215087){return{'model':db[_0x215087[_0x8ef5('0x20')]],'as':_0x215087['as'],'attributes':_0x215087[_0x8ef5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8ef5('0xc')](function(_0x5478b3){logger['info'](_0x8ef5('0x18'),_0x22a6c0);logger['debug'](_0x8ef5('0x18'),_0x22a6c0,JSON[_0x8ef5('0x12')](_0x5478b3));_0x463899(_0x5478b3);})[_0x8ef5('0x17')](function(_0x8103f5){logger['error']('ShowSetting',_0x8103f5[_0x8ef5('0x15')],_0x22a6c0);_0x9e1436(_0x198384[_0x8ef5('0x13')](0x1f4,_0x8103f5['message']));});});}; \ No newline at end of file +var _0x677c=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','debug','stringify','code','error','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring'];(function(_0x28ee9c,_0x1ae563){var _0x36f796=function(_0x4b9d9a){while(--_0x4b9d9a){_0x28ee9c['push'](_0x28ee9c['shift']());}};_0x36f796(++_0x1ae563);}(_0x677c,0x19b));var _0xc677=function(_0x3045dc,_0x1ea42d){_0x3045dc=_0x3045dc-0x0;var _0x140e2d=_0x677c[_0x3045dc];return _0x140e2d;};'use strict';var _=require(_0xc677('0x0'));var util=require(_0xc677('0x1'));var moment=require(_0xc677('0x2'));var BPromise=require(_0xc677('0x3'));var rs=require(_0xc677('0x4'));var fs=require('fs');var Redis=require(_0xc677('0x5'));var db=require(_0xc677('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc677('0x7'))(_0xc677('0x8'));var config=require('../../config/environment');var jayson=require(_0xc677('0x9'));var client=jayson['client'][_0xc677('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x360f2d,_0x4e6c46,_0x226a10){return new BPromise(function(_0x324def,_0x53579f){return client[_0xc677('0xb')](_0x360f2d,_0x226a10)[_0xc677('0xc')](function(_0x4fd896){logger[_0xc677('0xd')](_0xc677('0xe'),_0x4e6c46,'request\x20sent');logger[_0xc677('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x4e6c46,'request\x20sent',JSON[_0xc677('0x10')](_0x4fd896));if(_0x4fd896['error']){if(_0x4fd896['error'][_0xc677('0x11')]===0x1f4){logger[_0xc677('0x12')]('Setting,\x20%s,\x20%s',_0x4e6c46,_0x4fd896[_0xc677('0x12')][_0xc677('0x13')]);return _0x53579f(_0x4fd896[_0xc677('0x12')][_0xc677('0x13')]);}logger['error'](_0xc677('0xe'),_0x4e6c46,_0x4fd896[_0xc677('0x12')][_0xc677('0x13')]);return _0x324def(_0x4fd896[_0xc677('0x12')][_0xc677('0x13')]);}else{logger[_0xc677('0xd')](_0xc677('0xe'),_0x4e6c46,'request\x20sent');_0x324def(_0x4fd896[_0xc677('0x14')][_0xc677('0x13')]);}})[_0xc677('0x15')](function(_0x5ec254){logger[_0xc677('0x12')]('Setting,\x20%s,\x20%s',_0x4e6c46,_0x5ec254);_0x53579f(_0x5ec254);});});}exports[_0xc677('0x16')]=function(_0x14ef4c){var _0x3ef27c=this;return new Promise(function(_0x8d01a4,_0x563b5e){return db[_0xc677('0x17')][_0xc677('0x18')]({'raw':_0x14ef4c['options']?_0x14ef4c[_0xc677('0x19')][_0xc677('0x1a')]===undefined?!![]:![]:!![],'where':_0x14ef4c[_0xc677('0x19')]?_0x14ef4c[_0xc677('0x19')][_0xc677('0x1b')]||null:null,'attributes':_0x14ef4c[_0xc677('0x19')]?_0x14ef4c[_0xc677('0x19')][_0xc677('0x1c')]||null:null,'include':_0x14ef4c['options']?_0x14ef4c[_0xc677('0x19')]['include']?_[_0xc677('0x1d')](_0x14ef4c[_0xc677('0x19')][_0xc677('0x1e')],function(_0x49ead2){return{'model':db[_0x49ead2[_0xc677('0x1f')]],'as':_0x49ead2['as'],'attributes':_0x49ead2[_0xc677('0x1c')],'include':_0x49ead2[_0xc677('0x1e')]?_[_0xc677('0x1d')](_0x49ead2['include'],function(_0x3b0072){return{'model':db[_0x3b0072['model']],'as':_0x3b0072['as'],'attributes':_0x3b0072[_0xc677('0x1c')],'include':_0x3b0072[_0xc677('0x1e')]?_[_0xc677('0x1d')](_0x3b0072[_0xc677('0x1e')],function(_0x11852d){return{'model':db[_0x11852d['model']],'as':_0x11852d['as'],'attributes':_0x11852d[_0xc677('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57ee0a){logger['info'](_0xc677('0x16'),_0x14ef4c);logger['debug'](_0xc677('0x16'),_0x14ef4c,JSON[_0xc677('0x10')](_0x57ee0a));_0x8d01a4(_0x57ee0a);})['catch'](function(_0x3ce1b5){logger[_0xc677('0x12')](_0xc677('0x16'),_0x3ce1b5[_0xc677('0x13')],_0x14ef4c);_0x563b5e(_0x3ef27c[_0xc677('0x12')](0x1f4,_0x3ce1b5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 1b297b5..7c71351 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 _0x6f2f=['getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions'];(function(_0x341446,_0x142432){var _0x2157df=function(_0x199f35){while(--_0x199f35){_0x341446['push'](_0x341446['shift']());}};_0x2157df(++_0x142432);}(_0x6f2f,0x1d0));var _0xf6f2=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x6f2f[_0x599e60];return _0x468e19;};'use strict';var multer=require(_0xf6f2('0x0'));var util=require('util');var path=require(_0xf6f2('0x1'));var timeout=require('connect-timeout');var express=require(_0xf6f2('0x2'));var router=express[_0xf6f2('0x3')]();var auth=require(_0xf6f2('0x4'));var interaction=require(_0xf6f2('0x5'));var config=require(_0xf6f2('0x6'));var controller=require('./smsAccount.controller');router[_0xf6f2('0x7')]('/',auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x9')]);router['get'](_0xf6f2('0xa'),auth[_0xf6f2('0x8')](),controller[_0xf6f2('0xb')]);router[_0xf6f2('0x7')](_0xf6f2('0xc'),auth['isAuthenticated'](),controller[_0xf6f2('0xd')]);router['get'](_0xf6f2('0xe'),auth[_0xf6f2('0x8')](),controller[_0xf6f2('0xf')]);router[_0xf6f2('0x7')](_0xf6f2('0x10'),auth[_0xf6f2('0x8')](),controller['getAnswers']);router[_0xf6f2('0x7')](_0xf6f2('0x11'),auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x12')]);router['get'](_0xf6f2('0x13'),auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x14')]);router[_0xf6f2('0x7')](_0xf6f2('0x15'),controller[_0xf6f2('0x16')]);router[_0xf6f2('0x7')](_0xf6f2('0x17'),auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x18')]);router[_0xf6f2('0x19')]('/',auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x1a')]);router[_0xf6f2('0x19')](_0xf6f2('0xe'),auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x1b')]);router[_0xf6f2('0x19')]('/:id/canned_answers',auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x1c')]);router[_0xf6f2('0x19')](_0xf6f2('0x1d'),controller[_0xf6f2('0x1e')]);router[_0xf6f2('0x19')](_0xf6f2('0x11'),auth['isAuthenticated'](),controller[_0xf6f2('0x1f')]);router[_0xf6f2('0x19')](_0xf6f2('0x20'),auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x21')]);router[_0xf6f2('0x19')](_0xf6f2('0x15'),controller[_0xf6f2('0x22')]);router[_0xf6f2('0x19')]('/:id/users',auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x23')]);router[_0xf6f2('0x24')]('/:id',auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x25')]);router['delete'](_0xf6f2('0xc'),auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x26')]);router[_0xf6f2('0x27')]('/:id/dispositions',auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x28')]);router[_0xf6f2('0x27')]('/:id/canned_answers',auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x29')]);router[_0xf6f2('0x27')](_0xf6f2('0x17'),auth[_0xf6f2('0x8')](),controller[_0xf6f2('0x2a')]);module[_0xf6f2('0x2b')]=router; \ No newline at end of file +var _0x6dbf=['/:id/status','statusGet','/:id/users','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','notify','send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x6dbf,0xbd));var _0xf6db=function(_0x552b6c,_0x1d04eb){_0x552b6c=_0x552b6c-0x0;var _0x7e7024=_0x6dbf[_0x552b6c];return _0x7e7024;};'use strict';var multer=require(_0xf6db('0x0'));var util=require(_0xf6db('0x1'));var path=require(_0xf6db('0x2'));var timeout=require('connect-timeout');var express=require(_0xf6db('0x3'));var router=express[_0xf6db('0x4')]();var auth=require(_0xf6db('0x5'));var interaction=require(_0xf6db('0x6'));var config=require(_0xf6db('0x7'));var controller=require(_0xf6db('0x8'));router[_0xf6db('0x9')]('/',auth[_0xf6db('0xa')](),controller['index']);router[_0xf6db('0x9')](_0xf6db('0xb'),auth[_0xf6db('0xa')](),controller[_0xf6db('0xc')]);router['get'](_0xf6db('0xd'),auth[_0xf6db('0xa')](),controller[_0xf6db('0xe')]);router[_0xf6db('0x9')]('/:id/dispositions',auth[_0xf6db('0xa')](),controller[_0xf6db('0xf')]);router[_0xf6db('0x9')]('/:id/canned_answers',auth[_0xf6db('0xa')](),controller[_0xf6db('0x10')]);router[_0xf6db('0x9')](_0xf6db('0x11'),auth[_0xf6db('0xa')](),controller[_0xf6db('0x12')]);router[_0xf6db('0x9')](_0xf6db('0x13'),auth[_0xf6db('0xa')](),controller[_0xf6db('0x14')]);router[_0xf6db('0x9')](_0xf6db('0x15'),controller[_0xf6db('0x16')]);router['get'](_0xf6db('0x17'),auth['isAuthenticated'](),controller[_0xf6db('0x18')]);router[_0xf6db('0x19')]('/',auth[_0xf6db('0xa')](),controller['create']);router[_0xf6db('0x19')](_0xf6db('0x1a'),auth[_0xf6db('0xa')](),controller[_0xf6db('0x1b')]);router[_0xf6db('0x19')](_0xf6db('0x1c'),auth[_0xf6db('0xa')](),controller[_0xf6db('0x1d')]);router[_0xf6db('0x19')]('/:id/notify',controller[_0xf6db('0x1e')]);router['post']('/:id/applications',auth[_0xf6db('0xa')](),controller['addApplications']);router[_0xf6db('0x19')]('/:id/send',auth[_0xf6db('0xa')](),controller[_0xf6db('0x1f')]);router[_0xf6db('0x19')](_0xf6db('0x15'),controller[_0xf6db('0x20')]);router['post'](_0xf6db('0x17'),auth['isAuthenticated'](),controller[_0xf6db('0x21')]);router[_0xf6db('0x22')](_0xf6db('0xd'),auth['isAuthenticated'](),controller[_0xf6db('0x23')]);router['delete'](_0xf6db('0xd'),auth[_0xf6db('0xa')](),controller[_0xf6db('0x24')]);router[_0xf6db('0x25')](_0xf6db('0x1a'),auth[_0xf6db('0xa')](),controller[_0xf6db('0x26')]);router[_0xf6db('0x25')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf6db('0x27')]);router[_0xf6db('0x25')](_0xf6db('0x17'),auth['isAuthenticated'](),controller[_0xf6db('0x28')]);module[_0xf6db('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 261adf1..36f63f9 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 _0x4046=['randomstring','exports','STRING','name','ENUM','twilio','skebby','connectel','clicksend','bandwidth','infobip','intelepeer','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x2616f3,_0x51d3f3){var _0x43716a=function(_0x397754){while(--_0x397754){_0x2616f3['push'](_0x2616f3['shift']());}};_0x43716a(++_0x51d3f3);}(_0x4046,0x126));var _0x6404=function(_0x248d94,_0x3b5a1b){_0x248d94=_0x248d94-0x0;var _0x4f604f=_0x4046[_0x248d94];return _0x4f604f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6404('0x0'));module[_0x6404('0x1')]={'name':{'type':Sequelize[_0x6404('0x2')],'unique':_0x6404('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6404('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6404('0x4')](_0x6404('0x5'),_0x6404('0x6'),_0x6404('0x7'),_0x6404('0x8'),'plivo','clickatell',_0x6404('0x9'),'csc',_0x6404('0xa'),_0x6404('0xb'))},'accountSid':{'type':Sequelize[_0x6404('0x2')]},'authId':{'type':Sequelize[_0x6404('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x6404('0x2')]},'password':{'type':Sequelize[_0x6404('0x2')]},'apiKey':{'type':Sequelize[_0x6404('0x2')]},'applicationId':{'type':Sequelize[_0x6404('0x2')]},'accountId':{'type':Sequelize[_0x6404('0x2')]},'senderString':{'type':Sequelize[_0x6404('0x2')]},'deliveryReport':{'type':Sequelize[_0x6404('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x6404('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6404('0xd')],'defaultValue':function(){return _0x6404('0xe');}},'notificationSound':{'type':Sequelize[_0x6404('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6404('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6404('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6404('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6404('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6404('0xf')],'comment':_0x6404('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6404('0x11'),'set':function(_0x1237fb){if(!_0x1237fb)this['setDataValue'](_0x6404('0x12'),null);this[_0x6404('0x13')](_0x6404('0x14'),_0x1237fb);}}}; \ No newline at end of file +var _0x7072=['randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','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','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x216d0c,_0x397ee5){var _0x57fd93=function(_0x55cacd){while(--_0x55cacd){_0x216d0c['push'](_0x216d0c['shift']());}};_0x57fd93(++_0x397ee5);}(_0x7072,0x138));var _0x2707=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x7072[_0xdc37a1];return _0x99b4fe;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2707('0x0'));module[_0x2707('0x1')]={'name':{'type':Sequelize[_0x2707('0x2')],'unique':_0x2707('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x2707('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2707('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2707('0x5')](_0x2707('0x6'),_0x2707('0x7'),_0x2707('0x8'),_0x2707('0x9'),_0x2707('0xa'),_0x2707('0xb'),_0x2707('0xc'),_0x2707('0xd'),_0x2707('0xe'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x2707('0x2')]},'authToken':{'type':Sequelize[_0x2707('0x2')]},'smsMethod':{'type':Sequelize[_0x2707('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x2707('0x2')]},'password':{'type':Sequelize[_0x2707('0x2')]},'apiKey':{'type':Sequelize[_0x2707('0x2')]},'applicationId':{'type':Sequelize[_0x2707('0x2')]},'accountId':{'type':Sequelize[_0x2707('0x2')]},'senderString':{'type':Sequelize[_0x2707('0x2')]},'deliveryReport':{'type':Sequelize[_0x2707('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x2707('0x2')]},'notificationTemplate':{'type':Sequelize[_0x2707('0x10')],'defaultValue':function(){return _0x2707('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2707('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2707('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2707('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2707('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2707('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2707('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2707('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x2707('0xf')],'defaultValue':![],'comment':_0x2707('0x14'),'set':function(_0x5d523f){if(!_0x5d523f)this[_0x2707('0x15')](_0x2707('0x16'),null);this[_0x2707('0x15')](_0x2707('0x17'),_0x5d523f);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 7adc236..fb09d0a 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 _0x9d5e=['receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','addApplications','destroy','findAndCountAll','getApplications','Contact','internal','Tags','color','tag','to\x20is\x20mandatory','List','updatedAt','out','dataValues','Messages','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','clickatell','redif','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','request','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','Disposition','getDispositions','findOne','order','pick','SmsAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','mobile','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','csc','segmentedMessage','fromNumber','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting'];(function(_0x464ec2,_0x487cc6){var _0x2d5352=function(_0x26e463){while(--_0x26e463){_0x464ec2['push'](_0x464ec2['shift']());}};_0x2d5352(++_0x487cc6);}(_0x9d5e,0x1e9));var _0xe9d5=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0x9d5e[_0x58c851];return _0x534d8a;};'use strict';var pdf=require(_0xe9d5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe9d5('0x1'));var zipdir=require(_0xe9d5('0x2'));var jsonpatch=require(_0xe9d5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe9d5('0x4'));var Mustache=require(_0xe9d5('0x5'));var util=require(_0xe9d5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe9d5('0x7'));var ejs=require(_0xe9d5('0x8'));var fs=require('fs');var _=require(_0xe9d5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe9d5('0xa'));var deskjs=require(_0xe9d5('0xb'));var toCsv=require(_0xe9d5('0x7'));var querystring=require(_0xe9d5('0xc'));var Papa=require(_0xe9d5('0xd'));var Redis=require(_0xe9d5('0xe'));var authService=require(_0xe9d5('0xf'));var qs=require(_0xe9d5('0x10'));var as=require(_0xe9d5('0x11'));var hardwareService=require(_0xe9d5('0x12'));var logger=require(_0xe9d5('0x13'))('api');var utils=require(_0xe9d5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe9d5('0x15'));var db=require(_0xe9d5('0x16'))['db'];config[_0xe9d5('0x17')]=_[_0xe9d5('0x18')](config[_0xe9d5('0x17')],{'host':_0xe9d5('0x19'),'port':0x18eb});var socket=require(_0xe9d5('0x1a'))(new Redis(config[_0xe9d5('0x17')]));require(_0xe9d5('0x1b'))[_0xe9d5('0x1c')](socket);var jayson=require(_0xe9d5('0x1d'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2236c2,_0x9436be,_0x37c8fc,_0x5923bd){return new BPromise(function(_0x14cca9,_0x2ea6ee){var _0x13581a=_0x5923bd||client;return _0x13581a[_0xe9d5('0x1e')](_0x2236c2,_0x37c8fc)['then'](function(_0x3e8b66){logger[_0xe9d5('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x9436be,_0xe9d5('0x20'));logger['debug'](_0xe9d5('0x21'),_0x9436be,'request\x20sent',JSON['stringify'](_0x3e8b66));if(_0x3e8b66[_0xe9d5('0x22')]){if(_0x3e8b66['error'][_0xe9d5('0x23')]===0x1f4){logger[_0xe9d5('0x22')](_0xe9d5('0x24'),_0x9436be,_0x3e8b66[_0xe9d5('0x22')][_0xe9d5('0x25')]);return _0x2ea6ee(_0x3e8b66['error']['message']);}logger['error'](_0xe9d5('0x24'),_0x9436be,_0x3e8b66[_0xe9d5('0x22')]['message']);return _0x14cca9(_0x3e8b66[_0xe9d5('0x22')]['message']);}else{logger[_0xe9d5('0x1f')](_0xe9d5('0x24'),_0x9436be,_0xe9d5('0x20'));_0x14cca9(_0x3e8b66[_0xe9d5('0x26')][_0xe9d5('0x25')]);}})[_0xe9d5('0x27')](function(_0x342b5e){logger[_0xe9d5('0x22')](_0xe9d5('0x24'),_0x9436be,_0x342b5e);_0x2ea6ee(_0x342b5e);});});}function respondWithStatusCode(_0xfdf763,_0x4c0cf3){_0x4c0cf3=_0x4c0cf3||0xcc;return function(_0x1290f1){if(_0x1290f1){return _0xfdf763[_0xe9d5('0x28')](_0x4c0cf3);}return _0xfdf763[_0xe9d5('0x29')](_0x4c0cf3)[_0xe9d5('0x2a')]();};}function respondWithResult(_0x116cc9,_0x505604){_0x505604=_0x505604||0xc8;return function(_0x5dd2d4){if(_0x5dd2d4){return _0x116cc9['status'](_0x505604)[_0xe9d5('0x2b')](_0x5dd2d4);}};}function respondWithFilteredResult(_0x39d3b9,_0x2c87ad){return function(_0x5970c3){if(_0x5970c3){var _0x40d2b0=_0x5970c3[_0xe9d5('0x2c')],_0x34ea85=_0x2c87ad[_0xe9d5('0x2d')],_0x63edd8=_0x2c87ad[_0xe9d5('0x2d')]+_0x2c87ad[_0xe9d5('0x2e')],_0x386980;if(_0x63edd8>=_0x40d2b0){_0x63edd8=_0x40d2b0;_0x386980=0xc8;}else{_0x386980=0xce;}_0x39d3b9[_0xe9d5('0x29')](_0x386980);return _0x39d3b9[_0xe9d5('0x2f')](_0xe9d5('0x30'),_0x34ea85+'-'+_0x63edd8+'/'+_0x40d2b0)[_0xe9d5('0x2b')](_0x5970c3);}return null;};}function patchUpdates(_0x288d21){return function(_0x5a1a29){try{jsonpatch[_0xe9d5('0x31')](_0x5a1a29,_0x288d21,!![]);}catch(_0x984c57){return BPromise[_0xe9d5('0x32')](_0x984c57);}return _0x5a1a29[_0xe9d5('0x33')]();};}function saveUpdates(_0x1dacf6,_0x19b452){return function(_0x285a28){if(_0x285a28){return _0x285a28['update'](_0x1dacf6)[_0xe9d5('0x34')](function(_0x822e2d){return _0x822e2d;});}return null;};}function removeEntity(_0x462026,_0x140364){return function(_0x48b6bd){if(_0x48b6bd){return _0x48b6bd['destroy']()[_0xe9d5('0x34')](function(){var _0x2970ed=_0x48b6bd[_0xe9d5('0x35')]({'plain':!![]});var _0x3ffcda='SmsAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x3ffcda,'resourceId':_0x2970ed['id']}})['then'](function(){return _0x48b6bd;});})[_0xe9d5('0x34')](function(){_0x462026[_0xe9d5('0x29')](0xcc)[_0xe9d5('0x2a')]();});}};}function handleEntityNotFound(_0x2e01b6,_0xad2401){return function(_0x1af34c){if(!_0x1af34c){_0x2e01b6[_0xe9d5('0x28')](0x194);}return _0x1af34c;};}function handleError(_0xe281e,_0x1efe0d){_0x1efe0d=_0x1efe0d||0x1f4;return function(_0x3398cb){logger[_0xe9d5('0x22')](_0x3398cb[_0xe9d5('0x36')]);if(_0x3398cb[_0xe9d5('0x37')]){delete _0x3398cb[_0xe9d5('0x37')];}_0xe281e[_0xe9d5('0x29')](_0x1efe0d)[_0xe9d5('0x38')](_0x3398cb);};}exports[_0xe9d5('0x39')]=function(_0x597c81,_0x2a04cf){var _0x7d7fba={'include':[{'model':db[_0xe9d5('0x3a')],'as':_0xe9d5('0x3b')}]},_0x503c5f={},_0x339e71={'count':0x0,'rows':[]};var _0x23af50=_[_0xe9d5('0x3c')](db[_0xe9d5('0x3d')][_0xe9d5('0x3e')],function(_0x38b4c5){return{'name':_0x38b4c5[_0xe9d5('0x3f')],'type':_0x38b4c5['type'][_0xe9d5('0x40')]};});_0x503c5f[_0xe9d5('0x41')]=_[_0xe9d5('0x3c')](_0x23af50,_0xe9d5('0x37'));_0x503c5f[_0xe9d5('0x42')]=_[_0xe9d5('0x43')](_0x597c81[_0xe9d5('0x42')]);_0x503c5f[_0xe9d5('0x44')]=_[_0xe9d5('0x45')](_0x503c5f[_0xe9d5('0x41')],_0x503c5f[_0xe9d5('0x42')]);_0x7d7fba[_0xe9d5('0x46')]=_[_0xe9d5('0x45')](_0x503c5f[_0xe9d5('0x41')],qs[_0xe9d5('0x47')](_0x597c81['query'][_0xe9d5('0x47')]));_0x7d7fba[_0xe9d5('0x46')]=_0x7d7fba['attributes'][_0xe9d5('0x48')]?_0x7d7fba['attributes']:_0x503c5f[_0xe9d5('0x41')];if(!_0x597c81[_0xe9d5('0x42')][_0xe9d5('0x49')](_0xe9d5('0x4a'))){_0x7d7fba['limit']=qs['limit'](_0x597c81[_0xe9d5('0x42')][_0xe9d5('0x2e')]);_0x7d7fba['offset']=qs[_0xe9d5('0x2d')](_0x597c81['query'][_0xe9d5('0x2d')]);}_0x7d7fba['order']=qs['sort'](_0x597c81[_0xe9d5('0x42')][_0xe9d5('0x4b')]);_0x7d7fba[_0xe9d5('0x4c')]=qs[_0xe9d5('0x44')](_['pick'](_0x597c81[_0xe9d5('0x42')],_0x503c5f[_0xe9d5('0x44')]),_0x23af50);if(_0x597c81['query'][_0xe9d5('0x4d')]){_0x7d7fba[_0xe9d5('0x4c')]=_[_0xe9d5('0x4e')](_0x7d7fba[_0xe9d5('0x4c')],{'$or':_[_0xe9d5('0x3c')](_0x23af50,function(_0x57887f){if(_0x57887f[_0xe9d5('0x4f')]!==_0xe9d5('0x50')){var _0x3b50c2={};_0x3b50c2[_0x57887f[_0xe9d5('0x37')]]={'$like':'%'+_0x597c81[_0xe9d5('0x42')][_0xe9d5('0x4d')]+'%'};return _0x3b50c2;}})});}_0x7d7fba=_[_0xe9d5('0x4e')]({},_0x7d7fba,_0x597c81[_0xe9d5('0x51')]);var _0x3c1d02={'where':_0x7d7fba[_0xe9d5('0x4c')]};return db[_0xe9d5('0x3d')]['count'](_0x3c1d02)[_0xe9d5('0x34')](function(_0x12cb15){_0x339e71[_0xe9d5('0x2c')]=_0x12cb15;if(_0x597c81['query'][_0xe9d5('0x52')]){_0x7d7fba[_0xe9d5('0x53')]=[{'all':!![]}];}return db[_0xe9d5('0x3d')]['findAll'](_0x7d7fba);})[_0xe9d5('0x34')](function(_0x5b55c8){_0x339e71[_0xe9d5('0x54')]=_0x5b55c8;return _0x339e71;})[_0xe9d5('0x34')](respondWithFilteredResult(_0x2a04cf,_0x7d7fba))[_0xe9d5('0x27')](handleError(_0x2a04cf,null));};exports['show']=function(_0x239492,_0x22e9ae){var _0x31122f={'raw':![],'where':{'id':_0x239492['params']['id']},'include':[{'model':db['Pause'],'as':_0xe9d5('0x3b')}]},_0x41de02={};_0x41de02[_0xe9d5('0x41')]=_[_0xe9d5('0x43')](db[_0xe9d5('0x3d')][_0xe9d5('0x3e')]);_0x41de02[_0xe9d5('0x42')]=_[_0xe9d5('0x43')](_0x239492[_0xe9d5('0x42')]);_0x41de02[_0xe9d5('0x44')]=_[_0xe9d5('0x45')](_0x41de02['model'],_0x41de02[_0xe9d5('0x42')]);_0x31122f[_0xe9d5('0x46')]=_[_0xe9d5('0x45')](_0x41de02['model'],qs[_0xe9d5('0x47')](_0x239492[_0xe9d5('0x42')][_0xe9d5('0x47')]));_0x31122f[_0xe9d5('0x46')]=_0x31122f[_0xe9d5('0x46')][_0xe9d5('0x48')]?_0x31122f[_0xe9d5('0x46')]:_0x41de02[_0xe9d5('0x41')];if(_0x239492[_0xe9d5('0x42')]['includeAll']){_0x31122f[_0xe9d5('0x53')]=[{'all':!![]}];}_0x31122f=_[_0xe9d5('0x4e')]({},_0x31122f,_0x239492[_0xe9d5('0x51')]);return db[_0xe9d5('0x3d')][_0xe9d5('0x55')](_0x31122f)[_0xe9d5('0x34')](handleEntityNotFound(_0x22e9ae,null))[_0xe9d5('0x34')](respondWithResult(_0x22e9ae,null))[_0xe9d5('0x27')](handleError(_0x22e9ae,null));};exports[_0xe9d5('0x56')]=function(_0x496d24,_0x28d4c2){return db[_0xe9d5('0x3d')][_0xe9d5('0x56')](_0x496d24[_0xe9d5('0x57')],{})[_0xe9d5('0x34')](function(_0x30a844){var _0x3f34ba=_0x496d24[_0xe9d5('0x58')][_0xe9d5('0x35')]({'plain':!![]});if(!_0x3f34ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f34ba[_0xe9d5('0x59')]==='user'){var _0x59b23d=_0x30a844[_0xe9d5('0x35')]({'plain':!![]});var _0x31723c='SmsAccounts';return db[_0xe9d5('0x5a')]['find']({'where':{'name':_0x31723c,'userProfileId':_0x3f34ba[_0xe9d5('0x5b')]},'raw':!![]})['then'](function(_0x11282d){if(_0x11282d&&_0x11282d[_0xe9d5('0x5c')]===0x0){return db[_0xe9d5('0x5d')][_0xe9d5('0x56')]({'name':_0x59b23d[_0xe9d5('0x37')],'resourceId':_0x59b23d['id'],'type':_0x11282d[_0xe9d5('0x37')],'sectionId':_0x11282d['id']},{})['then'](function(){return _0x30a844;});}else{return _0x30a844;}})[_0xe9d5('0x27')](function(_0x2cc8dc){logger['error'](_0xe9d5('0x5e'),_0x2cc8dc);throw _0x2cc8dc;});}return _0x30a844;})['then'](respondWithResult(_0x28d4c2,0xc9))[_0xe9d5('0x27')](handleError(_0x28d4c2,null));};exports[_0xe9d5('0x5f')]=function(_0x9aa8a8,_0x254d14){if(_0x9aa8a8[_0xe9d5('0x57')]['id']){delete _0x9aa8a8[_0xe9d5('0x57')]['id'];}return db[_0xe9d5('0x3d')][_0xe9d5('0x55')]({'where':{'id':_0x9aa8a8[_0xe9d5('0x60')]['id']},'include':[{'model':db[_0xe9d5('0x3a')],'as':_0xe9d5('0x3b')}]})[_0xe9d5('0x34')](handleEntityNotFound(_0x254d14,null))['then'](saveUpdates(_0x9aa8a8['body'],null))['then'](respondWithResult(_0x254d14,null))[_0xe9d5('0x27')](handleError(_0x254d14,null));};exports['destroy']=function(_0x151810,_0x32e88b){return db['SmsAccount'][_0xe9d5('0x55')]({'where':{'id':_0x151810[_0xe9d5('0x60')]['id']}})[_0xe9d5('0x34')](handleEntityNotFound(_0x32e88b,null))[_0xe9d5('0x34')](removeEntity(_0x32e88b,null))[_0xe9d5('0x27')](handleError(_0x32e88b,null));};exports['describe']=function(_0x59c4c1,_0xf02cf0){return db['SmsAccount'][_0xe9d5('0x61')]()[_0xe9d5('0x34')](respondWithResult(_0xf02cf0,null))['catch'](handleError(_0xf02cf0,null));};exports[_0xe9d5('0x62')]=function(_0x23b800,_0x1e25d9,_0x29dc45){if(_0x23b800[_0xe9d5('0x57')]['id']){delete _0x23b800['body']['id'];}return db[_0xe9d5('0x3d')][_0xe9d5('0x55')]({'where':{'id':_0x23b800[_0xe9d5('0x60')]['id']}})[_0xe9d5('0x34')](handleEntityNotFound(_0x1e25d9,null))[_0xe9d5('0x34')](function(_0x57e2c9){if(_0x57e2c9){_0x23b800[_0xe9d5('0x57')]['SmsAccountId']=_0x57e2c9['id'];return db[_0xe9d5('0x63')][_0xe9d5('0x56')](_0x23b800[_0xe9d5('0x57')]);}})[_0xe9d5('0x34')](respondWithResult(_0x1e25d9,null))[_0xe9d5('0x27')](handleError(_0x1e25d9,null));};exports[_0xe9d5('0x64')]=function(_0x1da752,_0x42f69a,_0x179bf8){var _0xb16bf9={'raw':![],'where':{}};var _0x4b56a5={};var _0x39c34b={'count':0x0,'rows':[]};return db[_0xe9d5('0x3d')][_0xe9d5('0x65')]({'where':{'id':_0x1da752[_0xe9d5('0x60')]['id']}})[_0xe9d5('0x34')](handleEntityNotFound(_0x42f69a,null))[_0xe9d5('0x34')](function(_0x3fb763){if(_0x3fb763){_0x4b56a5['model']=_[_0xe9d5('0x43')](db[_0xe9d5('0x63')]['rawAttributes']);_0x4b56a5['query']=_[_0xe9d5('0x43')](_0x1da752['query']);_0x4b56a5[_0xe9d5('0x44')]=_[_0xe9d5('0x45')](_0x4b56a5[_0xe9d5('0x41')],_0x4b56a5['query']);_0xb16bf9[_0xe9d5('0x46')]=_[_0xe9d5('0x45')](_0x4b56a5['model'],qs['fields'](_0x1da752[_0xe9d5('0x42')][_0xe9d5('0x47')]));_0xb16bf9[_0xe9d5('0x46')]=_0xb16bf9['attributes'][_0xe9d5('0x48')]?_0xb16bf9['attributes']:_0x4b56a5[_0xe9d5('0x41')];if(!_0x1da752[_0xe9d5('0x42')][_0xe9d5('0x49')](_0xe9d5('0x4a'))){_0xb16bf9[_0xe9d5('0x2e')]=qs[_0xe9d5('0x2e')](_0x1da752[_0xe9d5('0x42')][_0xe9d5('0x2e')]);_0xb16bf9[_0xe9d5('0x2d')]=qs['offset'](_0x1da752[_0xe9d5('0x42')][_0xe9d5('0x2d')]);}_0xb16bf9[_0xe9d5('0x66')]=qs['sort'](_0x1da752[_0xe9d5('0x42')][_0xe9d5('0x4b')]);_0xb16bf9[_0xe9d5('0x4c')]=qs['filters'](_[_0xe9d5('0x67')](_0x1da752[_0xe9d5('0x42')],_0x4b56a5[_0xe9d5('0x44')]));_0xb16bf9[_0xe9d5('0x4c')][_0xe9d5('0x68')]=_0x3fb763['id'];if(_0x1da752[_0xe9d5('0x42')][_0xe9d5('0x4d')]){_0xb16bf9['where']=_[_0xe9d5('0x4e')](_0xb16bf9[_0xe9d5('0x4c')],{'$or':_[_0xe9d5('0x3c')](_0xb16bf9[_0xe9d5('0x46')],function(_0x449c01){var _0x5011a4={};_0x5011a4[_0x449c01]={'$like':'%'+_0x1da752['query'][_0xe9d5('0x4d')]+'%'};return _0x5011a4;})});}_0xb16bf9=_[_0xe9d5('0x4e')]({},_0xb16bf9,_0x1da752['options']);return db[_0xe9d5('0x63')][_0xe9d5('0x2c')]({'where':_0xb16bf9[_0xe9d5('0x4c')]})[_0xe9d5('0x34')](function(_0x1408c6){_0x39c34b[_0xe9d5('0x2c')]=_0x1408c6;if(_0x1da752[_0xe9d5('0x42')][_0xe9d5('0x52')]){_0xb16bf9[_0xe9d5('0x53')]=[{'all':!![]}];}return db[_0xe9d5('0x63')][_0xe9d5('0x69')](_0xb16bf9);})[_0xe9d5('0x34')](function(_0xb475f3){_0x39c34b[_0xe9d5('0x54')]=_0xb475f3;return _0x39c34b;});}})[_0xe9d5('0x34')](respondWithFilteredResult(_0x42f69a,_0xb16bf9))[_0xe9d5('0x27')](handleError(_0x42f69a,null));};exports[_0xe9d5('0x6a')]=function(_0x26bf1c,_0x5729f6,_0x591ad1){return db['SmsAccount'][_0xe9d5('0x55')]({'where':{'id':_0x26bf1c[_0xe9d5('0x60')]['id']}})[_0xe9d5('0x34')](handleEntityNotFound(_0x5729f6,null))['then'](function(_0x144983){if(_0x144983){return _0x144983['removeDispositions'](_0x26bf1c[_0xe9d5('0x42')][_0xe9d5('0x6b')]);}})['then'](respondWithStatusCode(_0x5729f6,null))[_0xe9d5('0x27')](handleError(_0x5729f6,null));};exports[_0xe9d5('0x6c')]=function(_0x293b00,_0x200758,_0x3ac468){if(_0x293b00[_0xe9d5('0x57')]['id']){delete _0x293b00[_0xe9d5('0x57')]['id'];}return db['SmsAccount'][_0xe9d5('0x55')]({'where':{'id':_0x293b00[_0xe9d5('0x60')]['id']}})[_0xe9d5('0x34')](handleEntityNotFound(_0x200758,null))[_0xe9d5('0x34')](function(_0x4b817b){if(_0x4b817b){_0x293b00['body'][_0xe9d5('0x68')]=_0x4b817b['id'];return db[_0xe9d5('0x6d')][_0xe9d5('0x56')](_0x293b00[_0xe9d5('0x57')]);}})[_0xe9d5('0x34')](respondWithResult(_0x200758,null))[_0xe9d5('0x27')](handleError(_0x200758,null));};exports[_0xe9d5('0x6e')]=function(_0x50ca63,_0x1360d0,_0x3c8a30){var _0x48b1ca={'raw':![],'where':{}};var _0x426cf5={};var _0x576561={'count':0x0,'rows':[]};return db[_0xe9d5('0x3d')]['findOne']({'where':{'id':_0x50ca63[_0xe9d5('0x60')]['id']}})['then'](handleEntityNotFound(_0x1360d0,null))[_0xe9d5('0x34')](function(_0xdee7ed){if(_0xdee7ed){_0x426cf5[_0xe9d5('0x41')]=_['keys'](db[_0xe9d5('0x6d')]['rawAttributes']);_0x426cf5[_0xe9d5('0x42')]=_[_0xe9d5('0x43')](_0x50ca63[_0xe9d5('0x42')]);_0x426cf5[_0xe9d5('0x44')]=_[_0xe9d5('0x45')](_0x426cf5[_0xe9d5('0x41')],_0x426cf5[_0xe9d5('0x42')]);_0x48b1ca[_0xe9d5('0x46')]=_[_0xe9d5('0x45')](_0x426cf5['model'],qs['fields'](_0x50ca63['query'][_0xe9d5('0x47')]));_0x48b1ca['attributes']=_0x48b1ca[_0xe9d5('0x46')]['length']?_0x48b1ca['attributes']:_0x426cf5[_0xe9d5('0x41')];if(!_0x50ca63[_0xe9d5('0x42')][_0xe9d5('0x49')](_0xe9d5('0x4a'))){_0x48b1ca[_0xe9d5('0x2e')]=qs['limit'](_0x50ca63[_0xe9d5('0x42')]['limit']);_0x48b1ca['offset']=qs[_0xe9d5('0x2d')](_0x50ca63[_0xe9d5('0x42')][_0xe9d5('0x2d')]);}_0x48b1ca[_0xe9d5('0x66')]=qs[_0xe9d5('0x4b')](_0x50ca63[_0xe9d5('0x42')][_0xe9d5('0x4b')]);_0x48b1ca[_0xe9d5('0x4c')]=qs[_0xe9d5('0x44')](_[_0xe9d5('0x67')](_0x50ca63[_0xe9d5('0x42')],_0x426cf5[_0xe9d5('0x44')]));_0x48b1ca['where']['SmsAccountId']=_0xdee7ed['id'];if(_0x50ca63['query'][_0xe9d5('0x4d')]){_0x48b1ca[_0xe9d5('0x4c')]=_[_0xe9d5('0x4e')](_0x48b1ca[_0xe9d5('0x4c')],{'$or':_[_0xe9d5('0x3c')](_0x48b1ca[_0xe9d5('0x46')],function(_0x19c2f4){var _0x3ba314={};_0x3ba314[_0x19c2f4]={'$like':'%'+_0x50ca63[_0xe9d5('0x42')]['filter']+'%'};return _0x3ba314;})});}_0x48b1ca=_[_0xe9d5('0x4e')]({},_0x48b1ca,_0x50ca63[_0xe9d5('0x51')]);return db[_0xe9d5('0x6d')][_0xe9d5('0x2c')]({'where':_0x48b1ca[_0xe9d5('0x4c')]})['then'](function(_0x4b5288){_0x576561[_0xe9d5('0x2c')]=_0x4b5288;if(_0x50ca63[_0xe9d5('0x42')]['includeAll']){_0x48b1ca[_0xe9d5('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe9d5('0x69')](_0x48b1ca);})[_0xe9d5('0x34')](function(_0x4cc56a){_0x576561[_0xe9d5('0x54')]=_0x4cc56a;return _0x576561;});}})[_0xe9d5('0x34')](respondWithFilteredResult(_0x1360d0,_0x48b1ca))[_0xe9d5('0x27')](handleError(_0x1360d0,null));};exports['removeAnswers']=function(_0x1566f3,_0x224f64,_0x2014aa){return db['SmsAccount'][_0xe9d5('0x55')]({'where':{'id':_0x1566f3['params']['id']}})['then'](handleEntityNotFound(_0x224f64,null))[_0xe9d5('0x34')](function(_0x2217ac){if(_0x2217ac){return _0x2217ac[_0xe9d5('0x6f')](_0x1566f3[_0xe9d5('0x42')][_0xe9d5('0x6b')]);}})[_0xe9d5('0x34')](respondWithStatusCode(_0x224f64,null))['catch'](handleError(_0x224f64,null));};exports['notify']=function(_0x212949,_0x260c99,_0x49315e){var _0x9f058a={'channel':_0xe9d5('0x70')};var _0x19ad7e=[];var _0x28587c=[];var _0x2ea9a9={};return db[_0xe9d5('0x3d')][_0xe9d5('0x55')]({'where':{'id':_0x212949['params']['id']},'include':[{'model':db[_0xe9d5('0x71')],'as':_0xe9d5('0x72')}]})[_0xe9d5('0x34')](handleEntityNotFound(_0x260c99,null))['then'](function(_0x10e42b){_0x9f058a[_0xe9d5('0x73')]=_0x10e42b;_0x9f058a[_0xe9d5('0x74')]=_[_0xe9d5('0x75')](_0x10e42b['Applications'],[_0xe9d5('0x76')],['asc']);if(_0x9f058a['account']['Applications']){delete _0x9f058a[_0xe9d5('0x73')]['Applications'];}return db[_0xe9d5('0x77')][_0xe9d5('0x61')]();})[_0xe9d5('0x34')](function(_0x1c49fc){if(!_0x1c49fc){throw new db[(_0xe9d5('0x78'))][(_0xe9d5('0x79'))](_0xe9d5('0x7a'));}_0x19ad7e=_[_0xe9d5('0x7b')](_[_0xe9d5('0x43')](_0x1c49fc),['createdAt','updatedAt']);_0x28587c=_['difference'](_['keys'](_0x1c49fc),[_0xe9d5('0x7c'),'updatedAt',_0xe9d5('0x7d'),'ListId']);_0x9f058a[_0xe9d5('0x57')]={'mapKey':_0xe9d5('0x7e')};if(_0x9f058a[_0xe9d5('0x73')]['type']){switch(_0x9f058a[_0xe9d5('0x73')][_0xe9d5('0x4f')]){case'twilio':_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x7f')]=_0x212949[_0xe9d5('0x57')][_0xe9d5('0x80')];_0x9f058a[_0xe9d5('0x57')]['body']=_0x212949[_0xe9d5('0x57')][_0xe9d5('0x81')];_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x82')]=_0x212949['body'][_0xe9d5('0x83')];break;case _0xe9d5('0x84'):_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x7f')]='+'+_0x212949[_0xe9d5('0x57')][_0xe9d5('0x85')];_0x9f058a[_0xe9d5('0x57')]['body']=_0x212949['body'][_0xe9d5('0x86')];break;case _0xe9d5('0x87'):_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x7f')]=_0x212949[_0xe9d5('0x57')][_0xe9d5('0x7f')];_0x9f058a[_0xe9d5('0x57')]['body']=_0x212949['body'][_0xe9d5('0x25')];break;case _0xe9d5('0x88'):_0x9f058a[_0xe9d5('0x57')]['from']=_0x212949['body'][_0xe9d5('0x7f')];_0x9f058a[_0xe9d5('0x57')]['body']=_0x212949[_0xe9d5('0x57')][_0xe9d5('0x57')];_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x82')]=_0x212949['body'][_0xe9d5('0x89')];break;case'plivo':_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x7f')]=_0x212949[_0xe9d5('0x57')][_0xe9d5('0x80')];_0x9f058a['body']['body']=_0x212949[_0xe9d5('0x57')][_0xe9d5('0x8a')];_0x9f058a[_0xe9d5('0x57')]['messageId']=_0x212949[_0xe9d5('0x57')][_0xe9d5('0x8b')];break;case _0xe9d5('0x8c'):_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x7f')]='+'+_0x212949[_0xe9d5('0x57')][_0xe9d5('0x8d')][0x0][_0xe9d5('0x7f')];_0x9f058a['body'][_0xe9d5('0x57')]=_0x212949[_0xe9d5('0x57')]['results'][0x0][_0xe9d5('0x86')];_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x82')]=_0x212949[_0xe9d5('0x57')]['results'][0x0][_0xe9d5('0x82')];break;case _0xe9d5('0x8e'):_0x9f058a[_0xe9d5('0x57')]['from']=_0x212949[_0xe9d5('0x57')]['originatingAddress'];_0x9f058a['body'][_0xe9d5('0x57')]=_0x212949[_0xe9d5('0x57')][_0xe9d5('0x8f')][_0xe9d5('0x25')];break;case'clickatell':_0x9f058a['body'][_0xe9d5('0x7f')]=_0x212949[_0xe9d5('0x57')][_0xe9d5('0x90')];_0x9f058a[_0xe9d5('0x57')]['body']=_0x212949['body'][_0xe9d5('0x86')];_0x9f058a[_0xe9d5('0x57')]['messageId']=_0x212949[_0xe9d5('0x57')]['replyMessageId'];break;case _0xe9d5('0x91'):_0x9f058a['body'][_0xe9d5('0x82')]=_0x212949['body'][0x0][_0xe9d5('0x25')]['id'];_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x7f')]=_0x212949[_0xe9d5('0x57')][0x0][_0xe9d5('0x25')][_0xe9d5('0x7f')];_0x9f058a['body'][_0xe9d5('0x57')]=_0x212949[_0xe9d5('0x57')][0x0][_0xe9d5('0x25')][_0xe9d5('0x86')];break;case _0xe9d5('0x92'):_0x9f058a['body'][_0xe9d5('0x7f')]=_0x212949[_0xe9d5('0x57')][_0xe9d5('0x7f')];_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x57')]=_0x212949[_0xe9d5('0x57')][_0xe9d5('0x25')];_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x82')]=_0x212949[_0xe9d5('0x57')][_0xe9d5('0x93')];break;}}if(_0x9f058a[_0xe9d5('0x57')]['id']){delete _0x9f058a['body']['id'];}if(_['isNil'](_0x9f058a['body']['from'])){throw new db[(_0xe9d5('0x78'))][(_0xe9d5('0x79'))](_0xe9d5('0x94'));}if(_[_0xe9d5('0x95')](_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x57')])||_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x57')]===''){throw new db[(_0xe9d5('0x78'))][(_0xe9d5('0x79'))](_0xe9d5('0x96'));}if(_[_0xe9d5('0x95')](_0x9f058a[_0xe9d5('0x57')]['mapKey'])){throw new db[(_0xe9d5('0x78'))][(_0xe9d5('0x79'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x28587c);}if(!_['includes'](_0x28587c,_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x97')])){throw new db[(_0xe9d5('0x78'))]['ValidationError'](_0xe9d5('0x98')+_0x28587c);}_0x2ea9a9[_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x97')]]=_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x7f')];return db[_0xe9d5('0x99')]['find']({'where':{'id':_0x9f058a[_0xe9d5('0x73')][_0xe9d5('0x9a')]},'include':[{'model':db[_0xe9d5('0x77')],'as':_0xe9d5('0x9b'),'where':_0x2ea9a9,'limit':0x1,'order':[['updatedAt',_0xe9d5('0x9c')]]}]});})[_0xe9d5('0x34')](handleEntityNotFound(_0x260c99,null))['then'](function(_0x339bee){if(_0x339bee){_0x9f058a['list']=_['omit'](_0x339bee,[_0xe9d5('0x9b')]);if(_0x339bee[_0xe9d5('0x9b')][_0xe9d5('0x48')]){return _0x339bee['Contacts'][0x0];}var _0x3bafdd=_[_0xe9d5('0x18')](_0x9f058a['body'],{'firstName':_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x7f')],'ListId':_0x339bee['id']});_0x3bafdd[_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x97')]]=_0x9f058a['body']['from'];return db[_0xe9d5('0x77')][_0xe9d5('0x56')](_0x3bafdd,{'fields':_0x19ad7e,'raw':!![]});}})[_0xe9d5('0x34')](handleEntityNotFound(_0x260c99,null))[_0xe9d5('0x34')](function(_0x268b68){if(_0x268b68){_0x9f058a[_0xe9d5('0x9d')]=_0x268b68;var _0x41e7f4={'ContactId':_0x268b68['id'],'phone':_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x7f')],'SmsAccountId':_0x212949[_0xe9d5('0x60')]['id']};var _0x1e2e43={'ContactId':_0x268b68['id'],'SmsAccountId':_0x212949[_0xe9d5('0x60')]['id'],'closed':![]};return db[_0xe9d5('0x9e')]['find']({'where':_0x1e2e43})['then'](function(_0x565fdf){if(_0x565fdf){return[_0x565fdf,![]];}return db['SmsInteraction']['create'](_0x41e7f4)[_0xe9d5('0x34')](function(_0x5308f2){return[_0x5308f2,!![]];});});}})[_0xe9d5('0x9f')](function(_0x4e09f8,_0x55fe09){_0x9f058a[_0xe9d5('0xa0')]=_0x4e09f8[_0xe9d5('0x35')]({'plain':!![]});_0x9f058a[_0xe9d5('0xa0')][_0xe9d5('0xa1')]=![];if(_0x55fe09){if(_0x9f058a[_0xe9d5('0x73')][_0xe9d5('0xa2')]){_0x9f058a['applications'][_0xe9d5('0xa3')]({'id':0x0,'priority':_0x9f058a[_0xe9d5('0x74')][_0xe9d5('0x48')]+0x1,'app':_0xe9d5('0xa4'),'appdata':_0xe9d5('0xa5'),'interval':_0xe9d5('0xa6')});}_0x9f058a[_0xe9d5('0xa0')]['created']=!![];}return db[_0xe9d5('0xa7')][_0xe9d5('0x56')]({'phone':_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x7f')],'messageId':_0x9f058a[_0xe9d5('0x57')][_0xe9d5('0x82')],'body':_0x9f058a[_0xe9d5('0x57')]['body'],'SmsAccountId':_0x212949[_0xe9d5('0x60')]['id'],'SmsInteractionId':_0x4e09f8['id'],'direction':'in','ContactId':_0x4e09f8['ContactId'],'AttachmentId':_0x9f058a['body']['AttachmentId']});})[_0xe9d5('0x34')](function(_0x34861c){_0x9f058a['message']=_0x34861c;if(_0x9f058a[_0xe9d5('0xa0')][_0xe9d5('0xa8')]){return db[_0xe9d5('0xa9')][_0xe9d5('0x55')]({'attributes':['id',_0xe9d5('0x37')],'where':{'id':_0x9f058a['interaction'][_0xe9d5('0xa8')]}})['then'](function(_0x51c7f2){if(_0x51c7f2){_0x9f058a[_0xe9d5('0x74')][_0xe9d5('0xaa')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x51c7f2[_0xe9d5('0x37')]+','+(_0x9f058a['account'][_0xe9d5('0xab')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe9d5('0xac'),_0xe9d5('0xad'),_0x9f058a);});}return respondWithRpcPromise(_0xe9d5('0xac'),_0xe9d5('0xad'),_0x9f058a);})[_0xe9d5('0x34')](function(_0x1e813c){if(_0x1e813c){var _0x3fcd01=0xc8;var _0x591eae=_0xe9d5('0xae');logger[_0xe9d5('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x591eae,_0x3fcd01,_0xe9d5('0xaf'));logger[_0xe9d5('0xb0')](_0xe9d5('0xb1'),_0x591eae,_0x3fcd01,_0xe9d5('0xaf'),JSON[_0xe9d5('0xb2')](_0x1e813c));if(_0x9f058a[_0xe9d5('0x73')][_0xe9d5('0x4f')]==='twilio'){return _0x260c99[_0xe9d5('0x29')](_0x3fcd01)[_0xe9d5('0x2f')](_0xe9d5('0xb3'),'text/xml')['send']('\x0a');}else{return _0x260c99[_0xe9d5('0x29')](_0x3fcd01)[_0xe9d5('0x2b')](_0x1e813c);}}})[_0xe9d5('0x27')](handleError(_0x260c99,null));};exports[_0xe9d5('0xb4')]=function(_0x3af625,_0x2a2dc0,_0x3e3553){return db[_0xe9d5('0x3d')][_0xe9d5('0x65')]({'where':{'id':_0x3af625[_0xe9d5('0x60')]['id']}})[_0xe9d5('0x34')](handleEntityNotFound(_0x2a2dc0,null))['then'](function(_0x21e2fe){if(_0x21e2fe){return db['sequelize']['transaction'](function(_0x39494e){return db[_0xe9d5('0x71')][_0xe9d5('0xb5')]({'where':{'SmsAccountId':_0x3af625['params']['id']},'transaction':_0x39494e})['then'](function(_0x277621){var _0x448ea1=_[_0xe9d5('0x3c')](_0x3af625[_0xe9d5('0x57')],function(_0x9e71d0){_0x9e71d0[_0xe9d5('0x68')]=_0x3af625[_0xe9d5('0x60')]['id'];return _0x9e71d0;});return db['SmsApplication']['bulkCreate'](_0x448ea1,{'transaction':_0x39494e});});})[_0xe9d5('0x34')](function(){return db['SmsApplication'][_0xe9d5('0xb6')]({'where':{'SmsAccountId':_0x3af625[_0xe9d5('0x60')]['id']},'order':_0xe9d5('0x76')});});}})['then'](respondWithResult(_0x2a2dc0,null))[_0xe9d5('0x27')](handleError(_0x2a2dc0,null));};exports[_0xe9d5('0xb7')]=function(_0x3985c9,_0x55e09a,_0x536ec7){var _0x378722={};var _0x1efc9b={};var _0x4afc1;var _0x3387dd;return db[_0xe9d5('0x3d')]['findOne']({'where':{'id':_0x3985c9[_0xe9d5('0x60')]['id']}})['then'](handleEntityNotFound(_0x55e09a,null))[_0xe9d5('0x34')](function(_0x172c14){if(_0x172c14){_0x4afc1=_0x172c14;_0x1efc9b[_0xe9d5('0x41')]=_[_0xe9d5('0x43')](db[_0xe9d5('0x71')][_0xe9d5('0x3e')]);_0x1efc9b[_0xe9d5('0x42')]=_['keys'](_0x3985c9[_0xe9d5('0x42')]);_0x1efc9b[_0xe9d5('0x44')]=_[_0xe9d5('0x45')](_0x1efc9b[_0xe9d5('0x41')],_0x1efc9b[_0xe9d5('0x42')]);_0x378722[_0xe9d5('0x46')]=_[_0xe9d5('0x45')](_0x1efc9b[_0xe9d5('0x41')],qs['fields'](_0x3985c9[_0xe9d5('0x42')][_0xe9d5('0x47')]));_0x378722[_0xe9d5('0x46')]=_0x378722[_0xe9d5('0x46')]['length']?_0x378722[_0xe9d5('0x46')]:_0x1efc9b['model'];_0x378722[_0xe9d5('0x66')]=qs[_0xe9d5('0x4b')](_0x3985c9[_0xe9d5('0x42')][_0xe9d5('0x4b')]);_0x378722[_0xe9d5('0x4c')]=qs[_0xe9d5('0x44')](_['pick'](_0x3985c9[_0xe9d5('0x42')],_0x1efc9b[_0xe9d5('0x44')]));if(_0x3985c9['query']['filter']){_0x378722[_0xe9d5('0x4c')]=_[_0xe9d5('0x4e')](_0x378722[_0xe9d5('0x4c')],{'$or':_['map'](_0x378722[_0xe9d5('0x46')],function(_0x4461ae){var _0x377e2b={};_0x377e2b[_0x4461ae]={'$like':'%'+_0x3985c9[_0xe9d5('0x42')][_0xe9d5('0x4d')]+'%'};return _0x377e2b;})});}_0x378722=_[_0xe9d5('0x4e')]({},_0x378722,_0x3985c9[_0xe9d5('0x51')]);return _0x4afc1['getApplications'](_0x378722);}})[_0xe9d5('0x34')](function(_0xa50262){if(_0xa50262){_0x3387dd=_0xa50262['length'];if(!_0x3985c9[_0xe9d5('0x42')][_0xe9d5('0x49')](_0xe9d5('0x4a'))){_0x378722[_0xe9d5('0x2e')]=qs[_0xe9d5('0x2e')](_0x3985c9[_0xe9d5('0x42')]['limit']);_0x378722[_0xe9d5('0x2d')]=qs[_0xe9d5('0x2d')](_0x3985c9[_0xe9d5('0x42')]['offset']);}return _0x4afc1[_0xe9d5('0xb7')](_0x378722);}})[_0xe9d5('0x34')](function(_0x46d821){if(_0x46d821){return _0x46d821?{'count':_0x3387dd,'rows':_0x46d821}:null;}})['then'](respondWithResult(_0x55e09a,null))[_0xe9d5('0x27')](handleError(_0x55e09a,null));};exports['getInteractions']=function(_0x16300a,_0xf59f3a,_0x510653){var _0x18bdc8={'raw':![],'where':{}};var _0x2c4428={};var _0x5ce83e={'count':0x0,'rows':[]};return db[_0xe9d5('0x3d')][_0xe9d5('0x65')]({'where':{'id':_0x16300a[_0xe9d5('0x60')]['id']}})[_0xe9d5('0x34')](handleEntityNotFound(_0xf59f3a,null))[_0xe9d5('0x34')](function(_0x2dc774){if(_0x2dc774){_0x2c4428[_0xe9d5('0x41')]=_['keys'](db['SmsInteraction'][_0xe9d5('0x3e')]);_0x2c4428['query']=_[_0xe9d5('0x43')](_0x16300a[_0xe9d5('0x42')]);_0x2c4428[_0xe9d5('0x44')]=_[_0xe9d5('0x45')](_0x2c4428[_0xe9d5('0x41')],_0x2c4428[_0xe9d5('0x42')]);_0x18bdc8['attributes']=_['intersection'](_0x2c4428[_0xe9d5('0x41')],qs[_0xe9d5('0x47')](_0x16300a[_0xe9d5('0x42')]['fields']));_0x18bdc8['attributes']=_0x18bdc8[_0xe9d5('0x46')][_0xe9d5('0x48')]?_0x18bdc8[_0xe9d5('0x46')]:_0x2c4428[_0xe9d5('0x41')];if(!_0x16300a[_0xe9d5('0x42')][_0xe9d5('0x49')](_0xe9d5('0x4a'))){_0x18bdc8[_0xe9d5('0x2e')]=qs[_0xe9d5('0x2e')](_0x16300a[_0xe9d5('0x42')][_0xe9d5('0x2e')]);_0x18bdc8[_0xe9d5('0x2d')]=qs[_0xe9d5('0x2d')](_0x16300a[_0xe9d5('0x42')][_0xe9d5('0x2d')]);}_0x18bdc8['order']=qs[_0xe9d5('0x4b')](_0x16300a['query'][_0xe9d5('0x4b')]);_0x18bdc8[_0xe9d5('0x4c')]=qs['filters'](_[_0xe9d5('0x67')](_0x16300a['query'],_0x2c4428[_0xe9d5('0x44')]));_0x18bdc8[_0xe9d5('0x4c')][_0xe9d5('0x68')]=_0x2dc774['id'];if(_0x16300a[_0xe9d5('0x42')][_0xe9d5('0x4d')]){_0x18bdc8['where']=_[_0xe9d5('0x4e')](_0x18bdc8['where'],{'$or':_[_0xe9d5('0x3c')](_0x18bdc8[_0xe9d5('0x46')],function(_0x2c5a3b){var _0x5a5cdd={};_0x5a5cdd[_0x2c5a3b]={'$like':'%'+_0x16300a[_0xe9d5('0x42')][_0xe9d5('0x4d')]+'%'};return _0x5a5cdd;})});}_0x18bdc8=_['merge']({},_0x18bdc8,_0x16300a[_0xe9d5('0x51')]);return db[_0xe9d5('0x9e')][_0xe9d5('0x2c')]({'where':_0x18bdc8[_0xe9d5('0x4c')]})[_0xe9d5('0x34')](function(_0x3f1fff){_0x5ce83e[_0xe9d5('0x2c')]=_0x3f1fff;if(_0x16300a[_0xe9d5('0x42')]['includeAll']){_0x18bdc8[_0xe9d5('0x53')]=[{'model':db[_0xe9d5('0x77')],'as':_0xe9d5('0xb8'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xe9d5('0x37'),'fullname',_0xe9d5('0xb9')],'required':![]},{'model':db['Tag'],'as':_0xe9d5('0xba'),'attributes':['id','name',_0xe9d5('0xbb')],'where':_0x16300a[_0xe9d5('0x42')][_0xe9d5('0xbc')]?{'id':_0x16300a[_0xe9d5('0x42')][_0xe9d5('0xbc')]}:undefined,'required':_0x16300a[_0xe9d5('0x42')][_0xe9d5('0xbc')]?!![]:![]}];}return db[_0xe9d5('0x9e')][_0xe9d5('0x69')](_0x18bdc8);})['then'](function(_0x1fdeab){_0x5ce83e[_0xe9d5('0x54')]=_0x1fdeab;return _0x5ce83e;});}})[_0xe9d5('0x34')](respondWithFilteredResult(_0xf59f3a,_0x18bdc8))[_0xe9d5('0x27')](handleError(_0xf59f3a,null));};exports[_0xe9d5('0x38')]=function(_0xc80266,_0x2fc170,_0x7dea48){var _0xbc7456,_0x5015df,_0x2de851;if(_[_0xe9d5('0x95')](_0xc80266[_0xe9d5('0x57')][_0xe9d5('0x57')])||_0xc80266['body'][_0xe9d5('0x57')]===''){throw new db[(_0xe9d5('0x78'))][(_0xe9d5('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe9d5('0x95')](_0xc80266[_0xe9d5('0x57')]['to'])){throw new db['Sequelize'][(_0xe9d5('0x79'))](_0xe9d5('0xbd'));}_0xbc7456=_0xc80266[_0xe9d5('0x57')]['to'];return db['SmsAccount'][_0xe9d5('0x55')]({'where':{'id':_0xc80266[_0xe9d5('0x60')]['id']},'include':[{'model':db[_0xe9d5('0x99')],'as':_0xe9d5('0xbe'),'include':[{'model':db[_0xe9d5('0x77')],'as':_0xe9d5('0x9b'),'where':{'mobile':_0xbc7456},'limit':0x1,'order':[[_0xe9d5('0xbf'),_0xe9d5('0x9c')]]}]}]})[_0xe9d5('0x34')](handleEntityNotFound(_0x2fc170,null))[_0xe9d5('0x34')](function(_0x19c621){if(_0x19c621&&_0x19c621[_0xe9d5('0xbe')]){_0x5015df=_0x19c621[_0xe9d5('0x35')]({'plain':!![]});if(_0x5015df[_0xe9d5('0xbe')]&&_0x5015df[_0xe9d5('0xbe')][_0xe9d5('0x9b')][_0xe9d5('0x48')]){return _0x5015df[_0xe9d5('0xbe')][_0xe9d5('0x9b')][0x0];}return db[_0xe9d5('0x77')][_0xe9d5('0x56')](_['defaults'](_0xc80266['body'],{'firstName':_0xbc7456,'mobile':_0xbc7456,'phone':_0xbc7456,'ListId':_0x5015df[_0xe9d5('0x9a')]}));}})['then'](handleEntityNotFound(_0x2fc170,null))['then'](function(_0x2798fa){if(_0x2798fa){_0x2de851=_0x2798fa;return db['SmsInteraction'][_0xe9d5('0x55')]({'where':{'ContactId':_0x2de851['id'],'closed':![],'SmsAccountId':_0x5015df['id']}})[_0xe9d5('0x34')](function(_0x81d366){if(_0x81d366){return[_0x81d366,![]];}return db[_0xe9d5('0x9e')]['create']({'UserId':_0xc80266['user']['id'],'ContactId':_0x2de851['id'],'SmsAccountId':_0x5015df['id'],'phone':_0xbc7456,'firstMsgDirection':_0xe9d5('0xc0'),'Messages':[_[_0xe9d5('0x4e')](_0xc80266[_0xe9d5('0x57')],{'read':![],'body':_0xc80266[_0xe9d5('0x57')][_0xe9d5('0x57')],'phone':_0xbc7456,'SmsAccountId':_0x5015df['id'],'UserId':_0xc80266['user']['id'],'ContactId':_0x2de851['id']})]},{'include':[{'model':db[_0xe9d5('0xa7')],'as':'Messages'}]})[_0xe9d5('0x34')](function(_0x358434){return[_0x358434,!![]];});});}})[_0xe9d5('0x9f')](function(_0x21cdf9,_0xc971fd){if(_0xc971fd){return _0x21cdf9;}return db[_0xe9d5('0xa7')]['create'](_[_0xe9d5('0x4e')](_0xc80266[_0xe9d5('0x57')],{'read':![],'body':_0xc80266[_0xe9d5('0x57')][_0xe9d5('0x57')],'phone':_0xbc7456,'SmsAccountId':_0x5015df['id'],'SmsInteractionId':_0x21cdf9['id'],'UserId':_0xc80266['user']['id'],'ContactId':_0x2de851['id']}))[_0xe9d5('0x34')](function(_0x3fec57){_0x21cdf9[_0xe9d5('0xc1')][_0xe9d5('0xc2')]=[];_0x21cdf9[_0xe9d5('0xc1')][_0xe9d5('0xc2')]['push'](_0x3fec57[_0xe9d5('0xc1')]);return _0x21cdf9;});})[_0xe9d5('0x34')](respondWithResult(_0x2fc170,null))[_0xe9d5('0x27')](handleError(_0x2fc170,null));};exports[_0xe9d5('0x29')]=function(_0x1abec7,_0x24ae4e,_0x2278bf){if(_0x1abec7[_0xe9d5('0x57')]['id']){delete _0x1abec7[_0xe9d5('0x57')]['id'];}var _0x11ad1b,_0x4887a9,_0x4685d2;return db[_0xe9d5('0x3d')]['find']({'where':{'id':_0x1abec7[_0xe9d5('0x60')]['id']}})[_0xe9d5('0x34')](handleEntityNotFound(_0x24ae4e,null))[_0xe9d5('0x34')](function(_0x1156c1){if(_0x1156c1){_0x4685d2=_0x1156c1;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe9d5('0x29'),_0xe9d5('0xc3'),_0x1156c1['type'],util['inspect'](_0x1abec7[_0xe9d5('0x57')],{'showHidden':![],'depth':null}));switch(_0x1156c1[_0xe9d5('0x4f')]){case _0xe9d5('0x84'):if(_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0xc4')]&&_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0x29')]){_0x4887a9=_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0x29')];return db[_0xe9d5('0xa7')][_0xe9d5('0x55')]({'where':{'messageId':_0x1abec7['body'][_0xe9d5('0xc4')]}});}break;case'connectel':if(_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0xc5')]&&_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0xc6')]){_0x4887a9=_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0xc6')];return db[_0xe9d5('0xa7')][_0xe9d5('0x55')]({'where':{'messageId':_0x1abec7['body'][_0xe9d5('0xc5')]}});}break;case _0xe9d5('0x88'):if(_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0x89')]&&_0x1abec7['body']['status_code']){_0x4887a9=_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0xc7')];return db[_0xe9d5('0xa7')][_0xe9d5('0x55')]({'where':{'messageId':_0x1abec7['body'][_0xe9d5('0x89')]}});}break;case _0xe9d5('0x8c'):var _0x98aa4=_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0x8d')][0x0];if(_0x98aa4[_0xe9d5('0x82')]&&_0x98aa4[_0xe9d5('0x29')][_0xe9d5('0xc8')]==='DELIVERED'){_0x4887a9=_0x98aa4[_0xe9d5('0x29')][_0xe9d5('0xc8')];return db[_0xe9d5('0xa7')]['find']({'where':{'messageId':_0x98aa4[_0xe9d5('0x82')]}});}break;case _0xe9d5('0xc9'):if(_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0x82')]&&_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0x29')]){_0x4887a9=_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0x29')];return db['SmsMessage'][_0xe9d5('0x55')]({'where':{'messageId':_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0x82')]}});}break;case'bandwidth':if(_0x1abec7['body'][0x0][_0xe9d5('0x25')]['id']){_0x4887a9=_0x1abec7[_0xe9d5('0x57')][0x0]['type'];return db[_0xe9d5('0xa7')][_0xe9d5('0x55')]({'where':{'messageId':_0x1abec7[_0xe9d5('0x57')][0x0][_0xe9d5('0x25')]['id']}});}break;case _0xe9d5('0x92'):if(_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0xca')]&&_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0x29')]){_0x4887a9=_0x1abec7['body'][_0xe9d5('0x29')];return db[_0xe9d5('0xa7')]['find']({'where':{'messageId':_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0xca')]}});}break;}}})[_0xe9d5('0x34')](handleEntityNotFound(_0x24ae4e,null))[_0xe9d5('0x34')](function(_0x1c8058){if(_0x1c8058){_0x11ad1b=_0x1c8058;switch(_0x4685d2[_0xe9d5('0x4f')]){case _0xe9d5('0x84'):if(_0x4887a9===_0xe9d5('0xcb')){return _0x11ad1b[_0xe9d5('0x5f')]({'read':!![]});}else{logger[_0xe9d5('0x22')](_0xe9d5('0x21'),'status','skebby',util[_0xe9d5('0xcc')](_0x1abec7['body'],{'showHidden':![],'depth':null}));}break;case _0xe9d5('0x87'):if(_0x4887a9==='1'){return _0x11ad1b[_0xe9d5('0x5f')]({'read':!![]});}else{logger[_0xe9d5('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe9d5('0x29'),'skebby',util[_0xe9d5('0xcc')](_0x1abec7[_0xe9d5('0x57')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0xcd')]&&_0x4887a9>=0xc8&&_0x4887a9<=0xce){return _0x11ad1b['update']({'read':!![]});}else{logger[_0xe9d5('0x22')](_0xe9d5('0x21'),'status',_0xe9d5('0x88'),util[_0xe9d5('0xcc')](_0x1abec7[_0xe9d5('0x57')],{'showHidden':![],'depth':null}));}break;case _0xe9d5('0x8c'):var _0x5b50fd=_0x1abec7[_0xe9d5('0x57')][_0xe9d5('0x8d')][0x0];if(_0x5b50fd[_0xe9d5('0x29')][_0xe9d5('0xc8')]==='DELIVERED'){return _0x11ad1b[_0xe9d5('0x5f')]({'read':!![]});}else{logger[_0xe9d5('0x22')](_0xe9d5('0x21'),'status',_0xe9d5('0x8c'),util[_0xe9d5('0xcc')](_0x1abec7[_0xe9d5('0x57')],{'showHidden':![],'depth':null}));}break;case _0xe9d5('0xc9'):if(_0x4887a9==_0xe9d5('0xce')||_0x4887a9==_0xe9d5('0xcf')){return _0x11ad1b[_0xe9d5('0x5f')]({'read':!![]});}else{logger[_0xe9d5('0x22')](_0xe9d5('0x21'),_0xe9d5('0x29'),_0xe9d5('0xc9'),util['inspect'](_0x1abec7['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x4887a9==_0xe9d5('0xd0')){return _0x11ad1b['update']({'read':!![]});}else{logger[_0xe9d5('0x22')](_0xe9d5('0x21'),_0xe9d5('0x29'),_0xe9d5('0x91'),util['inspect'](_0x1abec7[_0xe9d5('0x57')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x4887a9===_0xe9d5('0xd1')||_0x4887a9===_0xe9d5('0xd2')){return _0x11ad1b['update']({'read':!![]});}else{logger[_0xe9d5('0x22')](_0xe9d5('0x21'),_0xe9d5('0x29'),_0xe9d5('0x92'),util['inspect'](_0x1abec7['body'],{'showHidden':![],'depth':null}));}break;}return _0x11ad1b;}})[_0xe9d5('0x34')](respondWithResult(_0x24ae4e,null))[_0xe9d5('0x27')](handleError(_0x24ae4e,null));};exports[_0xe9d5('0xd3')]=function(_0x4cf98c,_0xfab127,_0x5ec640){var _0x4f488f,_0x2b5039,_0x2b1345;return db[_0xe9d5('0x3d')][_0xe9d5('0x55')]({'where':{'id':_0x4cf98c[_0xe9d5('0x60')]['id']}})[_0xe9d5('0x34')](handleEntityNotFound(_0xfab127,null))['then'](function(_0x42c12a){if(_0x42c12a){_0x2b1345=_0x42c12a;logger[_0xe9d5('0xb0')](_0xe9d5('0x21'),_0xe9d5('0x29'),'received\x20delivery\x20report\x20from',_0x42c12a[_0xe9d5('0x4f')],util[_0xe9d5('0xcc')](_0x4cf98c[_0xe9d5('0x42')],{'showHidden':![],'depth':null}));switch(_0x42c12a[_0xe9d5('0x4f')]){case _0xe9d5('0x8e'):if(_0x4cf98c[_0xe9d5('0x42')][_0xe9d5('0xd4')]&&_0x4cf98c[_0xe9d5('0x42')][_0xe9d5('0xd5')]){_0x2b5039=_0x4cf98c[_0xe9d5('0x42')][_0xe9d5('0xd5')];return db['SmsMessage']['find']({'where':{'messageId':_0x4cf98c[_0xe9d5('0x42')][_0xe9d5('0xd4')]}});}break;}}})[_0xe9d5('0x34')](handleEntityNotFound(_0xfab127,null))[_0xe9d5('0x34')](function(_0x105e78){if(_0x105e78){_0x4f488f=_0x105e78;switch(_0x2b1345[_0xe9d5('0x4f')]){case'csc':if(_0x2b5039==='2'||_0x2b5039==='6'){return _0x4f488f[_0xe9d5('0x5f')]({'read':!![]});}else{logger[_0xe9d5('0x22')](_0xe9d5('0x21'),_0xe9d5('0x29'),_0xe9d5('0x8e'),util[_0xe9d5('0xcc')](_0x4cf98c[_0xe9d5('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x4f488f;}})[_0xe9d5('0x34')](respondWithResult(_0xfab127,null))['catch'](handleError(_0xfab127,null));};exports[_0xe9d5('0xd6')]=function(_0x172d57,_0xb6b409,_0x2be1c1){return db[_0xe9d5('0x3d')]['find']({'where':{'id':_0x172d57[_0xe9d5('0x60')]['id']}})[_0xe9d5('0x34')](handleEntityNotFound(_0xb6b409,null))[_0xe9d5('0x34')](function(_0x1372d8){if(_0x1372d8){return _0x1372d8[_0xe9d5('0xd6')](_0x172d57[_0xe9d5('0x57')][_0xe9d5('0x6b')],_[_0xe9d5('0xd7')](_0x172d57[_0xe9d5('0x57')],[_0xe9d5('0x6b'),'id'])||{})['spread'](function(_0x3c4a1c){for(var _0x5ed183=0x0;_0x5ed183<_0x172d57['body'][_0xe9d5('0x6b')]['length'];_0x5ed183+=0x1){socket['emit']('userSmsAccount:save',{'UserId':_0x172d57[_0xe9d5('0x57')][_0xe9d5('0x6b')][_0x5ed183],'SmsAccountId':_0x172d57[_0xe9d5('0x60')]['id']});}return _0x3c4a1c;});}})[_0xe9d5('0x34')](respondWithResult(_0xb6b409,null))['catch'](handleError(_0xb6b409,null));};exports[_0xe9d5('0xd8')]=function(_0x51ca3d,_0x51901a,_0x4cbb33){return db[_0xe9d5('0x3d')][_0xe9d5('0x55')]({'where':{'id':_0x51ca3d[_0xe9d5('0x60')]['id']}})['then'](handleEntityNotFound(_0x51901a,null))[_0xe9d5('0x34')](function(_0x2784a7){if(_0x2784a7){return _0x2784a7[_0xe9d5('0xd8')](_0x51ca3d[_0xe9d5('0x42')][_0xe9d5('0x6b')])[_0xe9d5('0x34')](function(){if(_[_0xe9d5('0xd9')](_0x51ca3d['query'][_0xe9d5('0x6b')])){for(var _0x1bb255=0x0;_0x1bb255<_0x51ca3d[_0xe9d5('0x42')][_0xe9d5('0x6b')][_0xe9d5('0x48')];_0x1bb255+=0x1){socket[_0xe9d5('0xda')](_0xe9d5('0xdb'),{'UserId':Number(_0x51ca3d[_0xe9d5('0x42')][_0xe9d5('0x6b')][_0x1bb255]),'SmsAccountId':Number(_0x51ca3d[_0xe9d5('0x60')]['id'])});}}else{socket[_0xe9d5('0xda')]('userSmsAccount:remove',{'UserId':Number(_0x51ca3d[_0xe9d5('0x42')][_0xe9d5('0x6b')]),'SmsAccountId':Number(_0x51ca3d[_0xe9d5('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x51901a,null))[_0xe9d5('0x27')](handleError(_0x51901a,null));};exports[_0xe9d5('0xdc')]=function(_0x1c29ee,_0x517a7a,_0x383be6){var _0x21004a={};var _0xe35cd3={};var _0x2f784b;var _0x2acaf8;return db[_0xe9d5('0x3d')][_0xe9d5('0x65')]({'where':{'id':_0x1c29ee[_0xe9d5('0x60')]['id']}})[_0xe9d5('0x34')](handleEntityNotFound(_0x517a7a,null))[_0xe9d5('0x34')](function(_0x538d1b){if(_0x538d1b){_0x2f784b=_0x538d1b;_0xe35cd3[_0xe9d5('0x41')]=_[_0xe9d5('0x43')](db['User'][_0xe9d5('0x3e')]);_0xe35cd3[_0xe9d5('0x42')]=_[_0xe9d5('0x43')](_0x1c29ee[_0xe9d5('0x42')]);_0xe35cd3[_0xe9d5('0x44')]=_[_0xe9d5('0x45')](_0xe35cd3[_0xe9d5('0x41')],_0xe35cd3['query']);_0x21004a[_0xe9d5('0x46')]=_[_0xe9d5('0x45')](_0xe35cd3[_0xe9d5('0x41')],qs[_0xe9d5('0x47')](_0x1c29ee[_0xe9d5('0x42')][_0xe9d5('0x47')]));_0x21004a[_0xe9d5('0x46')]=_0x21004a['attributes']['length']?_0x21004a[_0xe9d5('0x46')]:_0xe35cd3[_0xe9d5('0x41')];_0x21004a[_0xe9d5('0x66')]=qs[_0xe9d5('0x4b')](_0x1c29ee[_0xe9d5('0x42')][_0xe9d5('0x4b')]);_0x21004a[_0xe9d5('0x4c')]=qs[_0xe9d5('0x44')](_[_0xe9d5('0x67')](_0x1c29ee['query'],_0xe35cd3['filters']));if(_0x1c29ee[_0xe9d5('0x42')][_0xe9d5('0x4d')]){_0x21004a[_0xe9d5('0x4c')]=_['merge'](_0x21004a['where'],{'$or':_[_0xe9d5('0x3c')](_0x21004a['attributes'],function(_0x9fca9){var _0x3fda09={};_0x3fda09[_0x9fca9]={'$like':'%'+_0x1c29ee[_0xe9d5('0x42')][_0xe9d5('0x4d')]+'%'};return _0x3fda09;})});}_0x21004a=_['merge']({},_0x21004a,_0x1c29ee[_0xe9d5('0x51')]);return _0x2f784b[_0xe9d5('0xdc')](_0x21004a);}})[_0xe9d5('0x34')](function(_0x3adc12){if(_0x3adc12){_0x2acaf8=_0x3adc12[_0xe9d5('0x48')];if(!_0x1c29ee[_0xe9d5('0x42')][_0xe9d5('0x49')](_0xe9d5('0x4a'))){_0x21004a[_0xe9d5('0x2e')]=qs[_0xe9d5('0x2e')](_0x1c29ee[_0xe9d5('0x42')][_0xe9d5('0x2e')]);_0x21004a[_0xe9d5('0x2d')]=qs[_0xe9d5('0x2d')](_0x1c29ee[_0xe9d5('0x42')][_0xe9d5('0x2d')]);}return _0x2f784b[_0xe9d5('0xdc')](_0x21004a);}})[_0xe9d5('0x34')](function(_0x492d70){if(_0x492d70){return _0x492d70?{'count':_0x2acaf8,'rows':_0x492d70}:null;}})[_0xe9d5('0x34')](respondWithResult(_0x517a7a,null))['catch'](handleError(_0x517a7a,null));}; \ No newline at end of file +var _0x21ff=['state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','get','SmsAccounts','destroy','name','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','SmsAccount','findAll','rows','show','rawAttributes','keys','fields','include','find','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addDisposition','SmsAccountId','Disposition','create','findOne','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','notify','sms','SmsApplication','Applications','account','applications','priority','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','MessageSid','skebby','from','sender','text','messageId','plivo','Text','infobip','results','csc','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','push','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','send','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','error_code','clicksend','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','clickatell','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id'];(function(_0x2f51f4,_0x125a59){var _0x375e8b=function(_0x3cd8a6){while(--_0x3cd8a6){_0x2f51f4['push'](_0x2f51f4['shift']());}};_0x375e8b(++_0x125a59);}(_0x21ff,0x1c8));var _0xf21f=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0x21ff[_0x1ac77b];return _0x161584;};'use strict';var pdf=require(_0xf21f('0x0'));var emlformat=require(_0xf21f('0x1'));var rimraf=require(_0xf21f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf21f('0x3'));var moment=require(_0xf21f('0x4'));var BPromise=require(_0xf21f('0x5'));var Mustache=require(_0xf21f('0x6'));var util=require(_0xf21f('0x7'));var path=require(_0xf21f('0x8'));var sox=require(_0xf21f('0x9'));var csv=require(_0xf21f('0xa'));var ejs=require(_0xf21f('0xb'));var fs=require('fs');var _=require(_0xf21f('0xc'));var squel=require(_0xf21f('0xd'));var crypto=require('crypto');var jsforce=require(_0xf21f('0xe'));var deskjs=require(_0xf21f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf21f('0x10'));var Papa=require('papaparse');var Redis=require(_0xf21f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf21f('0x12'));var as=require(_0xf21f('0x13'));var hardwareService=require(_0xf21f('0x14'));var logger=require('../../config/logger')(_0xf21f('0x15'));var utils=require(_0xf21f('0x16'));var config=require(_0xf21f('0x17'));var licenseUtil=require(_0xf21f('0x18'));var db=require(_0xf21f('0x19'))['db'];config[_0xf21f('0x1a')]=_[_0xf21f('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf21f('0x1c'))(new Redis(config['redis']));require(_0xf21f('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0xda60ea,_0x3ff44e,_0x585373,_0x23c568){return new BPromise(function(_0xaa2206,_0x4e02d2){var _0xf49f6b=_0x23c568||client;return _0xf49f6b[_0xf21f('0x1e')](_0xda60ea,_0x585373)[_0xf21f('0x1f')](function(_0x17665c){logger['info'](_0xf21f('0x20'),_0x3ff44e,_0xf21f('0x21'));logger[_0xf21f('0x22')](_0xf21f('0x23'),_0x3ff44e,_0xf21f('0x21'),JSON['stringify'](_0x17665c));if(_0x17665c[_0xf21f('0x24')]){if(_0x17665c[_0xf21f('0x24')]['code']===0x1f4){logger[_0xf21f('0x24')](_0xf21f('0x20'),_0x3ff44e,_0x17665c[_0xf21f('0x24')]['message']);return _0x4e02d2(_0x17665c['error'][_0xf21f('0x25')]);}logger[_0xf21f('0x24')](_0xf21f('0x20'),_0x3ff44e,_0x17665c['error'][_0xf21f('0x25')]);return _0xaa2206(_0x17665c['error'][_0xf21f('0x25')]);}else{logger[_0xf21f('0x26')]('SmsAccount,\x20%s,\x20%s',_0x3ff44e,_0xf21f('0x21'));_0xaa2206(_0x17665c[_0xf21f('0x27')][_0xf21f('0x25')]);}})[_0xf21f('0x28')](function(_0x74d97a){logger['error'](_0xf21f('0x20'),_0x3ff44e,_0x74d97a);_0x4e02d2(_0x74d97a);});});}function respondWithStatusCode(_0x21f8c1,_0x3fc1a3){_0x3fc1a3=_0x3fc1a3||0xcc;return function(_0x174da3){if(_0x174da3){return _0x21f8c1['sendStatus'](_0x3fc1a3);}return _0x21f8c1['status'](_0x3fc1a3)[_0xf21f('0x29')]();};}function respondWithResult(_0x117aef,_0x28bc56){_0x28bc56=_0x28bc56||0xc8;return function(_0x1fa077){if(_0x1fa077){return _0x117aef[_0xf21f('0x2a')](_0x28bc56)[_0xf21f('0x2b')](_0x1fa077);}};}function respondWithFilteredResult(_0x1abb94,_0xedc1f3){return function(_0x4ca34d){if(_0x4ca34d){var _0x47d61f=_0x4ca34d[_0xf21f('0x2c')],_0x1a690a=_0xedc1f3[_0xf21f('0x2d')],_0x36198a=_0xedc1f3[_0xf21f('0x2d')]+_0xedc1f3[_0xf21f('0x2e')],_0x32851;if(_0x36198a>=_0x47d61f){_0x36198a=_0x47d61f;_0x32851=0xc8;}else{_0x32851=0xce;}_0x1abb94['status'](_0x32851);return _0x1abb94[_0xf21f('0x2f')](_0xf21f('0x30'),_0x1a690a+'-'+_0x36198a+'/'+_0x47d61f)[_0xf21f('0x2b')](_0x4ca34d);}return null;};}function patchUpdates(_0x417937){return function(_0x4277c0){try{jsonpatch[_0xf21f('0x31')](_0x4277c0,_0x417937,!![]);}catch(_0x1046d9){return BPromise['reject'](_0x1046d9);}return _0x4277c0[_0xf21f('0x32')]();};}function saveUpdates(_0xde1b40,_0x370aa0){return function(_0x146e11){if(_0x146e11){return _0x146e11[_0xf21f('0x33')](_0xde1b40)['then'](function(_0x7d000b){return _0x7d000b;});}return null;};}function removeEntity(_0x304e46,_0x348dc1){return function(_0x25255a){if(_0x25255a){return _0x25255a['destroy']()[_0xf21f('0x1f')](function(){var _0xaae5c9=_0x25255a[_0xf21f('0x34')]({'plain':!![]});var _0xc2cbb7=_0xf21f('0x35');return db['UserProfileResource'][_0xf21f('0x36')]({'where':{'type':_0xc2cbb7,'resourceId':_0xaae5c9['id']}})[_0xf21f('0x1f')](function(){return _0x25255a;});})['then'](function(){_0x304e46['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x448506,_0x39c003){return function(_0x2a5f56){if(!_0x2a5f56){_0x448506['sendStatus'](0x194);}return _0x2a5f56;};}function handleError(_0x5efc8f,_0x1d7c7f){_0x1d7c7f=_0x1d7c7f||0x1f4;return function(_0x503c48){logger[_0xf21f('0x24')](_0x503c48['stack']);if(_0x503c48[_0xf21f('0x37')]){delete _0x503c48[_0xf21f('0x37')];}_0x5efc8f['status'](_0x1d7c7f)['send'](_0x503c48);};}exports['index']=function(_0x32c137,_0x329fc9){var _0x51ac49={'include':[{'model':db[_0xf21f('0x38')],'as':_0xf21f('0x39')}]},_0x1813ab={},_0x3ce365={'count':0x0,'rows':[]};var _0x202690=_[_0xf21f('0x3a')](db['SmsAccount']['rawAttributes'],function(_0x20cff2){return{'name':_0x20cff2[_0xf21f('0x3b')],'type':_0x20cff2[_0xf21f('0x3c')][_0xf21f('0x3d')]};});_0x1813ab[_0xf21f('0x3e')]=_[_0xf21f('0x3a')](_0x202690,_0xf21f('0x37'));_0x1813ab[_0xf21f('0x3f')]=_['keys'](_0x32c137[_0xf21f('0x3f')]);_0x1813ab[_0xf21f('0x40')]=_[_0xf21f('0x41')](_0x1813ab[_0xf21f('0x3e')],_0x1813ab[_0xf21f('0x3f')]);_0x51ac49[_0xf21f('0x42')]=_[_0xf21f('0x41')](_0x1813ab[_0xf21f('0x3e')],qs['fields'](_0x32c137[_0xf21f('0x3f')]['fields']));_0x51ac49['attributes']=_0x51ac49[_0xf21f('0x42')][_0xf21f('0x43')]?_0x51ac49[_0xf21f('0x42')]:_0x1813ab[_0xf21f('0x3e')];if(!_0x32c137[_0xf21f('0x3f')][_0xf21f('0x44')](_0xf21f('0x45'))){_0x51ac49[_0xf21f('0x2e')]=qs[_0xf21f('0x2e')](_0x32c137[_0xf21f('0x3f')][_0xf21f('0x2e')]);_0x51ac49[_0xf21f('0x2d')]=qs['offset'](_0x32c137[_0xf21f('0x3f')][_0xf21f('0x2d')]);}_0x51ac49[_0xf21f('0x46')]=qs['sort'](_0x32c137[_0xf21f('0x3f')][_0xf21f('0x47')]);_0x51ac49[_0xf21f('0x48')]=qs[_0xf21f('0x40')](_['pick'](_0x32c137[_0xf21f('0x3f')],_0x1813ab[_0xf21f('0x40')]),_0x202690);if(_0x32c137['query'][_0xf21f('0x49')]){_0x51ac49[_0xf21f('0x48')]=_[_0xf21f('0x4a')](_0x51ac49['where'],{'$or':_['map'](_0x202690,function(_0x2766c5){if(_0x2766c5[_0xf21f('0x3c')]!==_0xf21f('0x4b')){var _0x3ae65f={};_0x3ae65f[_0x2766c5[_0xf21f('0x37')]]={'$like':'%'+_0x32c137['query'][_0xf21f('0x49')]+'%'};return _0x3ae65f;}})});}_0x51ac49=_['merge']({},_0x51ac49,_0x32c137[_0xf21f('0x4c')]);var _0x351b57={'where':_0x51ac49['where']};return db['SmsAccount'][_0xf21f('0x2c')](_0x351b57)[_0xf21f('0x1f')](function(_0x1c0d7b){_0x3ce365['count']=_0x1c0d7b;if(_0x32c137[_0xf21f('0x3f')][_0xf21f('0x4d')]){_0x51ac49['include']=[{'all':!![]}];}return db[_0xf21f('0x4e')][_0xf21f('0x4f')](_0x51ac49);})['then'](function(_0x4972ba){_0x3ce365[_0xf21f('0x50')]=_0x4972ba;return _0x3ce365;})[_0xf21f('0x1f')](respondWithFilteredResult(_0x329fc9,_0x51ac49))[_0xf21f('0x28')](handleError(_0x329fc9,null));};exports[_0xf21f('0x51')]=function(_0x384496,_0x178f0a){var _0x4018b9={'raw':![],'where':{'id':_0x384496['params']['id']},'include':[{'model':db[_0xf21f('0x38')],'as':'mandatoryDispositionPause'}]},_0x2a1bcf={};_0x2a1bcf[_0xf21f('0x3e')]=_['keys'](db[_0xf21f('0x4e')][_0xf21f('0x52')]);_0x2a1bcf[_0xf21f('0x3f')]=_[_0xf21f('0x53')](_0x384496[_0xf21f('0x3f')]);_0x2a1bcf[_0xf21f('0x40')]=_[_0xf21f('0x41')](_0x2a1bcf['model'],_0x2a1bcf[_0xf21f('0x3f')]);_0x4018b9[_0xf21f('0x42')]=_['intersection'](_0x2a1bcf[_0xf21f('0x3e')],qs[_0xf21f('0x54')](_0x384496[_0xf21f('0x3f')]['fields']));_0x4018b9[_0xf21f('0x42')]=_0x4018b9['attributes']['length']?_0x4018b9['attributes']:_0x2a1bcf[_0xf21f('0x3e')];if(_0x384496[_0xf21f('0x3f')][_0xf21f('0x4d')]){_0x4018b9[_0xf21f('0x55')]=[{'all':!![]}];}_0x4018b9=_[_0xf21f('0x4a')]({},_0x4018b9,_0x384496['options']);return db['SmsAccount'][_0xf21f('0x56')](_0x4018b9)[_0xf21f('0x1f')](handleEntityNotFound(_0x178f0a,null))[_0xf21f('0x1f')](respondWithResult(_0x178f0a,null))[_0xf21f('0x28')](handleError(_0x178f0a,null));};exports['create']=function(_0x2d82ac,_0x4f8efd){return db[_0xf21f('0x4e')]['create'](_0x2d82ac['body'],{})['then'](function(_0x1630a1){var _0x37f0de=_0x2d82ac[_0xf21f('0x57')][_0xf21f('0x34')]({'plain':!![]});if(!_0x37f0de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37f0de[_0xf21f('0x58')]==='user'){var _0x184b15=_0x1630a1[_0xf21f('0x34')]({'plain':!![]});var _0x3caeda=_0xf21f('0x35');return db[_0xf21f('0x59')]['find']({'where':{'name':_0x3caeda,'userProfileId':_0x37f0de[_0xf21f('0x5a')]},'raw':!![]})[_0xf21f('0x1f')](function(_0x26c518){if(_0x26c518&&_0x26c518[_0xf21f('0x5b')]===0x0){return db[_0xf21f('0x5c')]['create']({'name':_0x184b15[_0xf21f('0x37')],'resourceId':_0x184b15['id'],'type':_0x26c518['name'],'sectionId':_0x26c518['id']},{})[_0xf21f('0x1f')](function(){return _0x1630a1;});}else{return _0x1630a1;}})[_0xf21f('0x28')](function(_0x32fb61){logger['error'](_0xf21f('0x5d'),_0x32fb61);throw _0x32fb61;});}return _0x1630a1;})['then'](respondWithResult(_0x4f8efd,0xc9))[_0xf21f('0x28')](handleError(_0x4f8efd,null));};exports[_0xf21f('0x33')]=function(_0x3a58c8,_0x4b228d){if(_0x3a58c8[_0xf21f('0x5e')]['id']){delete _0x3a58c8[_0xf21f('0x5e')]['id'];}return db[_0xf21f('0x4e')][_0xf21f('0x56')]({'where':{'id':_0x3a58c8['params']['id']},'include':[{'model':db[_0xf21f('0x38')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4b228d,null))[_0xf21f('0x1f')](saveUpdates(_0x3a58c8[_0xf21f('0x5e')],null))[_0xf21f('0x1f')](respondWithResult(_0x4b228d,null))[_0xf21f('0x28')](handleError(_0x4b228d,null));};exports[_0xf21f('0x36')]=function(_0x34dc53,_0x4e1533){return db['SmsAccount'][_0xf21f('0x56')]({'where':{'id':_0x34dc53[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x4e1533,null))[_0xf21f('0x1f')](removeEntity(_0x4e1533,null))[_0xf21f('0x28')](handleError(_0x4e1533,null));};exports['describe']=function(_0x570c6e,_0x36fc91){return db['SmsAccount']['describe']()['then'](respondWithResult(_0x36fc91,null))[_0xf21f('0x28')](handleError(_0x36fc91,null));};exports[_0xf21f('0x60')]=function(_0x558fad,_0x136013,_0x104695){if(_0x558fad[_0xf21f('0x5e')]['id']){delete _0x558fad[_0xf21f('0x5e')]['id'];}return db[_0xf21f('0x4e')][_0xf21f('0x56')]({'where':{'id':_0x558fad[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x136013,null))['then'](function(_0x487704){if(_0x487704){_0x558fad[_0xf21f('0x5e')][_0xf21f('0x61')]=_0x487704['id'];return db[_0xf21f('0x62')][_0xf21f('0x63')](_0x558fad[_0xf21f('0x5e')]);}})[_0xf21f('0x1f')](respondWithResult(_0x136013,null))[_0xf21f('0x28')](handleError(_0x136013,null));};exports['getDispositions']=function(_0x18f394,_0x4358d8,_0x50659a){var _0x4f8812={'raw':![],'where':{}};var _0x5cfc49={};var _0x1b810c={'count':0x0,'rows':[]};return db[_0xf21f('0x4e')][_0xf21f('0x64')]({'where':{'id':_0x18f394['params']['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x4358d8,null))[_0xf21f('0x1f')](function(_0x2ce6b5){if(_0x2ce6b5){_0x5cfc49[_0xf21f('0x3e')]=_[_0xf21f('0x53')](db[_0xf21f('0x62')][_0xf21f('0x52')]);_0x5cfc49[_0xf21f('0x3f')]=_[_0xf21f('0x53')](_0x18f394[_0xf21f('0x3f')]);_0x5cfc49['filters']=_[_0xf21f('0x41')](_0x5cfc49[_0xf21f('0x3e')],_0x5cfc49['query']);_0x4f8812['attributes']=_['intersection'](_0x5cfc49[_0xf21f('0x3e')],qs['fields'](_0x18f394['query'][_0xf21f('0x54')]));_0x4f8812['attributes']=_0x4f8812[_0xf21f('0x42')][_0xf21f('0x43')]?_0x4f8812[_0xf21f('0x42')]:_0x5cfc49[_0xf21f('0x3e')];if(!_0x18f394['query'][_0xf21f('0x44')](_0xf21f('0x45'))){_0x4f8812[_0xf21f('0x2e')]=qs[_0xf21f('0x2e')](_0x18f394[_0xf21f('0x3f')][_0xf21f('0x2e')]);_0x4f8812[_0xf21f('0x2d')]=qs[_0xf21f('0x2d')](_0x18f394[_0xf21f('0x3f')][_0xf21f('0x2d')]);}_0x4f8812[_0xf21f('0x46')]=qs[_0xf21f('0x47')](_0x18f394['query'][_0xf21f('0x47')]);_0x4f8812[_0xf21f('0x48')]=qs[_0xf21f('0x40')](_[_0xf21f('0x65')](_0x18f394[_0xf21f('0x3f')],_0x5cfc49['filters']));_0x4f8812[_0xf21f('0x48')][_0xf21f('0x61')]=_0x2ce6b5['id'];if(_0x18f394[_0xf21f('0x3f')][_0xf21f('0x49')]){_0x4f8812[_0xf21f('0x48')]=_[_0xf21f('0x4a')](_0x4f8812['where'],{'$or':_[_0xf21f('0x3a')](_0x4f8812[_0xf21f('0x42')],function(_0x1bb66a){var _0x530f47={};_0x530f47[_0x1bb66a]={'$like':'%'+_0x18f394[_0xf21f('0x3f')][_0xf21f('0x49')]+'%'};return _0x530f47;})});}_0x4f8812=_['merge']({},_0x4f8812,_0x18f394[_0xf21f('0x4c')]);return db[_0xf21f('0x62')][_0xf21f('0x2c')]({'where':_0x4f8812[_0xf21f('0x48')]})[_0xf21f('0x1f')](function(_0xdb31c6){_0x1b810c[_0xf21f('0x2c')]=_0xdb31c6;if(_0x18f394[_0xf21f('0x3f')][_0xf21f('0x4d')]){_0x4f8812[_0xf21f('0x55')]=[{'all':!![]}];}return db[_0xf21f('0x62')][_0xf21f('0x4f')](_0x4f8812);})[_0xf21f('0x1f')](function(_0x7d7b64){_0x1b810c[_0xf21f('0x50')]=_0x7d7b64;return _0x1b810c;});}})[_0xf21f('0x1f')](respondWithFilteredResult(_0x4358d8,_0x4f8812))[_0xf21f('0x28')](handleError(_0x4358d8,null));};exports[_0xf21f('0x66')]=function(_0xa2970e,_0x2a9e5a,_0x3775bd){return db[_0xf21f('0x4e')]['find']({'where':{'id':_0xa2970e[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x2a9e5a,null))[_0xf21f('0x1f')](function(_0x1faa49){if(_0x1faa49){return _0x1faa49[_0xf21f('0x66')](_0xa2970e['query'][_0xf21f('0x67')]);}})[_0xf21f('0x1f')](respondWithStatusCode(_0x2a9e5a,null))[_0xf21f('0x28')](handleError(_0x2a9e5a,null));};exports[_0xf21f('0x68')]=function(_0xba7575,_0x3a9917,_0x404035){if(_0xba7575[_0xf21f('0x5e')]['id']){delete _0xba7575['body']['id'];}return db[_0xf21f('0x4e')]['find']({'where':{'id':_0xba7575[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x3a9917,null))[_0xf21f('0x1f')](function(_0x3f65f8){if(_0x3f65f8){_0xba7575[_0xf21f('0x5e')][_0xf21f('0x61')]=_0x3f65f8['id'];return db['CannedAnswer']['create'](_0xba7575['body']);}})[_0xf21f('0x1f')](respondWithResult(_0x3a9917,null))[_0xf21f('0x28')](handleError(_0x3a9917,null));};exports[_0xf21f('0x69')]=function(_0x3a0250,_0x1932c7,_0x5537fe){var _0x1aa99e={'raw':![],'where':{}};var _0x33e707={};var _0x1c51f1={'count':0x0,'rows':[]};return db[_0xf21f('0x4e')][_0xf21f('0x64')]({'where':{'id':_0x3a0250[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x1932c7,null))['then'](function(_0x12304a){if(_0x12304a){_0x33e707[_0xf21f('0x3e')]=_['keys'](db[_0xf21f('0x6a')]['rawAttributes']);_0x33e707[_0xf21f('0x3f')]=_['keys'](_0x3a0250[_0xf21f('0x3f')]);_0x33e707[_0xf21f('0x40')]=_['intersection'](_0x33e707[_0xf21f('0x3e')],_0x33e707[_0xf21f('0x3f')]);_0x1aa99e[_0xf21f('0x42')]=_[_0xf21f('0x41')](_0x33e707['model'],qs[_0xf21f('0x54')](_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x54')]));_0x1aa99e[_0xf21f('0x42')]=_0x1aa99e[_0xf21f('0x42')]['length']?_0x1aa99e['attributes']:_0x33e707['model'];if(!_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x44')]('nolimit')){_0x1aa99e[_0xf21f('0x2e')]=qs[_0xf21f('0x2e')](_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x2e')]);_0x1aa99e[_0xf21f('0x2d')]=qs[_0xf21f('0x2d')](_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x2d')]);}_0x1aa99e[_0xf21f('0x46')]=qs['sort'](_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x47')]);_0x1aa99e[_0xf21f('0x48')]=qs['filters'](_[_0xf21f('0x65')](_0x3a0250[_0xf21f('0x3f')],_0x33e707[_0xf21f('0x40')]));_0x1aa99e[_0xf21f('0x48')]['SmsAccountId']=_0x12304a['id'];if(_0x3a0250[_0xf21f('0x3f')]['filter']){_0x1aa99e[_0xf21f('0x48')]=_[_0xf21f('0x4a')](_0x1aa99e['where'],{'$or':_[_0xf21f('0x3a')](_0x1aa99e['attributes'],function(_0x52089e){var _0xd9a1fc={};_0xd9a1fc[_0x52089e]={'$like':'%'+_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x49')]+'%'};return _0xd9a1fc;})});}_0x1aa99e=_[_0xf21f('0x4a')]({},_0x1aa99e,_0x3a0250[_0xf21f('0x4c')]);return db[_0xf21f('0x6a')]['count']({'where':_0x1aa99e[_0xf21f('0x48')]})['then'](function(_0x6058cb){_0x1c51f1[_0xf21f('0x2c')]=_0x6058cb;if(_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x4d')]){_0x1aa99e[_0xf21f('0x55')]=[{'all':!![]}];}return db[_0xf21f('0x6a')][_0xf21f('0x4f')](_0x1aa99e);})[_0xf21f('0x1f')](function(_0x5c1ff0){_0x1c51f1[_0xf21f('0x50')]=_0x5c1ff0;return _0x1c51f1;});}})[_0xf21f('0x1f')](respondWithFilteredResult(_0x1932c7,_0x1aa99e))[_0xf21f('0x28')](handleError(_0x1932c7,null));};exports['removeAnswers']=function(_0x234a7b,_0x4aeab6,_0x35d3c9){return db[_0xf21f('0x4e')]['find']({'where':{'id':_0x234a7b[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x4aeab6,null))[_0xf21f('0x1f')](function(_0x27fa29){if(_0x27fa29){return _0x27fa29['removeAnswers'](_0x234a7b[_0xf21f('0x3f')]['ids']);}})[_0xf21f('0x1f')](respondWithStatusCode(_0x4aeab6,null))[_0xf21f('0x28')](handleError(_0x4aeab6,null));};exports[_0xf21f('0x6b')]=function(_0x219af5,_0xa31c39,_0x2b8559){var _0x4010ec={'channel':_0xf21f('0x6c')};var _0x3c1966=[];var _0x37cce0=[];var _0x5679d1={};return db[_0xf21f('0x4e')][_0xf21f('0x56')]({'where':{'id':_0x219af5['params']['id']},'include':[{'model':db[_0xf21f('0x6d')],'as':_0xf21f('0x6e')}]})[_0xf21f('0x1f')](handleEntityNotFound(_0xa31c39,null))[_0xf21f('0x1f')](function(_0x2875b9){_0x4010ec[_0xf21f('0x6f')]=_0x2875b9;_0x4010ec[_0xf21f('0x70')]=_['orderBy'](_0x2875b9[_0xf21f('0x6e')],[_0xf21f('0x71')],['asc']);if(_0x4010ec[_0xf21f('0x6f')][_0xf21f('0x6e')]){delete _0x4010ec[_0xf21f('0x6f')][_0xf21f('0x6e')];}return db[_0xf21f('0x72')][_0xf21f('0x73')]();})[_0xf21f('0x1f')](function(_0x2bc447){if(!_0x2bc447){throw new db[(_0xf21f('0x74'))]['ValidationError'](_0xf21f('0x75'));}_0x3c1966=_[_0xf21f('0x76')](_[_0xf21f('0x53')](_0x2bc447),[_0xf21f('0x77'),'updatedAt']);_0x37cce0=_[_0xf21f('0x76')](_[_0xf21f('0x53')](_0x2bc447),[_0xf21f('0x77'),_0xf21f('0x78'),_0xf21f('0x79'),_0xf21f('0x7a')]);_0x4010ec[_0xf21f('0x5e')]={'mapKey':_0xf21f('0x7b')};if(_0x4010ec['account']['type']){switch(_0x4010ec[_0xf21f('0x6f')][_0xf21f('0x3c')]){case _0xf21f('0x7c'):_0x4010ec[_0xf21f('0x5e')]['from']=_0x219af5['body']['From'];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]=_0x219af5[_0xf21f('0x5e')]['Body'];_0x4010ec[_0xf21f('0x5e')]['messageId']=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x7d')];break;case _0xf21f('0x7e'):_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')]='+'+_0x219af5['body'][_0xf21f('0x80')];_0x4010ec[_0xf21f('0x5e')]['body']=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x81')];break;case'connectel':_0x4010ec[_0xf21f('0x5e')]['from']=_0x219af5['body'][_0xf21f('0x7f')];_0x4010ec['body'][_0xf21f('0x5e')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x25')];break;case'clicksend':_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x7f')];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x5e')];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x82')]=_0x219af5['body']['message_id'];break;case _0xf21f('0x83'):_0x4010ec['body'][_0xf21f('0x7f')]=_0x219af5[_0xf21f('0x5e')]['From'];_0x4010ec[_0xf21f('0x5e')]['body']=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x84')];_0x4010ec[_0xf21f('0x5e')]['messageId']=_0x219af5[_0xf21f('0x5e')]['MessageUUID'];break;case _0xf21f('0x85'):_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')]='+'+_0x219af5[_0xf21f('0x5e')][_0xf21f('0x86')][0x0][_0xf21f('0x7f')];_0x4010ec[_0xf21f('0x5e')]['body']=_0x219af5['body'][_0xf21f('0x86')][0x0]['text'];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x82')]=_0x219af5['body'][_0xf21f('0x86')][0x0]['messageId'];break;case _0xf21f('0x87'):_0x4010ec['body'][_0xf21f('0x7f')]=_0x219af5[_0xf21f('0x5e')]['originatingAddress'];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x88')]['message'];break;case'clickatell':_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x89')];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]=_0x219af5['body'][_0xf21f('0x81')];_0x4010ec[_0xf21f('0x5e')]['messageId']=_0x219af5['body'][_0xf21f('0x8a')];break;case _0xf21f('0x8b'):_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x82')]=_0x219af5['body'][0x0][_0xf21f('0x25')]['id'];_0x4010ec['body'][_0xf21f('0x7f')]=_0x219af5['body'][0x0]['message'][_0xf21f('0x7f')];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]=_0x219af5[_0xf21f('0x5e')][0x0][_0xf21f('0x25')][_0xf21f('0x81')];break;case _0xf21f('0x8c'):_0x4010ec[_0xf21f('0x5e')]['from']=_0x219af5['body'][_0xf21f('0x7f')];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x25')];_0x4010ec['body'][_0xf21f('0x82')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x8d')];break;}}if(_0x4010ec[_0xf21f('0x5e')]['id']){delete _0x4010ec[_0xf21f('0x5e')]['id'];}if(_[_0xf21f('0x8e')](_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')])){throw new db[(_0xf21f('0x74'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xf21f('0x8e')](_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')])||_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]===''){throw new db[(_0xf21f('0x74'))][(_0xf21f('0x8f'))](_0xf21f('0x90'));}if(_['isNil'](_0x4010ec['body'][_0xf21f('0x91')])){throw new db[(_0xf21f('0x74'))][(_0xf21f('0x8f'))](_0xf21f('0x92')+_0x37cce0);}if(!_['includes'](_0x37cce0,_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x91')])){throw new db['Sequelize'][(_0xf21f('0x8f'))](_0xf21f('0x93')+_0x37cce0);}_0x5679d1[_0x4010ec['body'][_0xf21f('0x91')]]=_0x4010ec[_0xf21f('0x5e')]['from'];return db[_0xf21f('0x94')][_0xf21f('0x56')]({'where':{'id':_0x4010ec[_0xf21f('0x6f')][_0xf21f('0x7a')]},'include':[{'model':db[_0xf21f('0x72')],'as':_0xf21f('0x95'),'where':_0x5679d1,'limit':0x1,'order':[['updatedAt',_0xf21f('0x96')]]}]});})[_0xf21f('0x1f')](handleEntityNotFound(_0xa31c39,null))[_0xf21f('0x1f')](function(_0xe79b8b){if(_0xe79b8b){_0x4010ec[_0xf21f('0x97')]=_[_0xf21f('0x98')](_0xe79b8b,[_0xf21f('0x95')]);if(_0xe79b8b[_0xf21f('0x95')]['length']){return _0xe79b8b[_0xf21f('0x95')][0x0];}var _0x698730=_[_0xf21f('0x1b')](_0x4010ec[_0xf21f('0x5e')],{'firstName':_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')],'ListId':_0xe79b8b['id']});_0x698730[_0x4010ec['body']['mapKey']]=_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')];return db[_0xf21f('0x72')]['create'](_0x698730,{'fields':_0x3c1966,'raw':!![]});}})[_0xf21f('0x1f')](handleEntityNotFound(_0xa31c39,null))[_0xf21f('0x1f')](function(_0x4b14f3){if(_0x4b14f3){_0x4010ec[_0xf21f('0x99')]=_0x4b14f3;var _0x276a21={'ContactId':_0x4b14f3['id'],'phone':_0x4010ec['body']['from'],'SmsAccountId':_0x219af5['params']['id']};var _0x438613={'ContactId':_0x4b14f3['id'],'SmsAccountId':_0x219af5[_0xf21f('0x5f')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x438613})[_0xf21f('0x1f')](function(_0x3a33a3){if(_0x3a33a3){return[_0x3a33a3,![]];}return db[_0xf21f('0x9a')][_0xf21f('0x63')](_0x276a21)[_0xf21f('0x1f')](function(_0x5ba3df){return[_0x5ba3df,!![]];});});}})[_0xf21f('0x9b')](function(_0x14254e,_0x30b65c){_0x4010ec[_0xf21f('0x9c')]=_0x14254e[_0xf21f('0x34')]({'plain':!![]});_0x4010ec['interaction'][_0xf21f('0x9d')]=![];if(_0x30b65c){if(_0x4010ec['account']['autoclose']){_0x4010ec[_0xf21f('0x70')][_0xf21f('0x9e')]({'id':0x0,'priority':_0x4010ec[_0xf21f('0x70')][_0xf21f('0x43')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xf21f('0x9f')});}_0x4010ec[_0xf21f('0x9c')][_0xf21f('0x9d')]=!![];}return db[_0xf21f('0xa0')][_0xf21f('0x63')]({'phone':_0x4010ec['body'][_0xf21f('0x7f')],'messageId':_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x82')],'body':_0x4010ec['body'][_0xf21f('0x5e')],'SmsAccountId':_0x219af5['params']['id'],'SmsInteractionId':_0x14254e['id'],'direction':'in','ContactId':_0x14254e[_0xf21f('0xa1')],'AttachmentId':_0x4010ec[_0xf21f('0x5e')][_0xf21f('0xa2')]});})['then'](function(_0x461f79){_0x4010ec[_0xf21f('0x25')]=_0x461f79;if(_0x4010ec[_0xf21f('0x9c')][_0xf21f('0xa3')]){return db[_0xf21f('0xa4')]['find']({'attributes':['id',_0xf21f('0x37')],'where':{'id':_0x4010ec[_0xf21f('0x9c')]['UserId']}})[_0xf21f('0x1f')](function(_0x388488){if(_0x388488){_0x4010ec[_0xf21f('0x70')][_0xf21f('0xa5')]({'id':0x0,'priority':0x0,'app':_0xf21f('0xa6'),'appdata':_0x388488[_0xf21f('0x37')]+','+(_0x4010ec[_0xf21f('0x6f')][_0xf21f('0xa7')]||0xa),'interval':_0xf21f('0x9f')});}return respondWithRpcPromise(_0xf21f('0xa8'),'startRouting',_0x4010ec);});}return respondWithRpcPromise('Start',_0xf21f('0xa9'),_0x4010ec);})[_0xf21f('0x1f')](function(_0x5a4043){if(_0x5a4043){var _0xcdb8af=0xc8;var _0x23376c=_0xf21f('0xaa');logger['info'](_0xf21f('0x23'),_0x23376c,_0xcdb8af,_0xf21f('0xab'));logger[_0xf21f('0x22')](_0xf21f('0xac'),_0x23376c,_0xcdb8af,'entity\x20found',JSON[_0xf21f('0xad')](_0x5a4043));if(_0x4010ec[_0xf21f('0x6f')][_0xf21f('0x3c')]==='twilio'){return _0xa31c39[_0xf21f('0x2a')](_0xcdb8af)[_0xf21f('0x2f')](_0xf21f('0xae'),'text/xml')[_0xf21f('0xaf')](_0xf21f('0xb0'));}else{return _0xa31c39[_0xf21f('0x2a')](_0xcdb8af)[_0xf21f('0x2b')](_0x5a4043);}}})['catch'](handleError(_0xa31c39,null));};exports[_0xf21f('0xb1')]=function(_0x199e48,_0x548484,_0x20e96c){return db[_0xf21f('0x4e')][_0xf21f('0x64')]({'where':{'id':_0x199e48[_0xf21f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x548484,null))[_0xf21f('0x1f')](function(_0x3e0bb0){if(_0x3e0bb0){return db[_0xf21f('0xb2')][_0xf21f('0xb3')](function(_0x36093e){return db['SmsApplication'][_0xf21f('0x36')]({'where':{'SmsAccountId':_0x199e48[_0xf21f('0x5f')]['id']},'transaction':_0x36093e})[_0xf21f('0x1f')](function(_0xe88b3a){var _0x553c6e=_['map'](_0x199e48[_0xf21f('0x5e')],function(_0x309ed3){_0x309ed3[_0xf21f('0x61')]=_0x199e48[_0xf21f('0x5f')]['id'];return _0x309ed3;});return db['SmsApplication'][_0xf21f('0xb4')](_0x553c6e,{'transaction':_0x36093e});});})[_0xf21f('0x1f')](function(){return db[_0xf21f('0x6d')][_0xf21f('0xb5')]({'where':{'SmsAccountId':_0x199e48['params']['id']},'order':_0xf21f('0x71')});});}})[_0xf21f('0x1f')](respondWithResult(_0x548484,null))[_0xf21f('0x28')](handleError(_0x548484,null));};exports[_0xf21f('0xb6')]=function(_0x414bc1,_0xb9ef4e,_0x3868b6){var _0x44a51b={};var _0x37f7f0={};var _0x3244b7;var _0x5b9207;return db[_0xf21f('0x4e')][_0xf21f('0x64')]({'where':{'id':_0x414bc1[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0xb9ef4e,null))[_0xf21f('0x1f')](function(_0x1f118c){if(_0x1f118c){_0x3244b7=_0x1f118c;_0x37f7f0[_0xf21f('0x3e')]=_['keys'](db['SmsApplication'][_0xf21f('0x52')]);_0x37f7f0['query']=_[_0xf21f('0x53')](_0x414bc1[_0xf21f('0x3f')]);_0x37f7f0[_0xf21f('0x40')]=_['intersection'](_0x37f7f0[_0xf21f('0x3e')],_0x37f7f0[_0xf21f('0x3f')]);_0x44a51b[_0xf21f('0x42')]=_[_0xf21f('0x41')](_0x37f7f0[_0xf21f('0x3e')],qs[_0xf21f('0x54')](_0x414bc1[_0xf21f('0x3f')][_0xf21f('0x54')]));_0x44a51b[_0xf21f('0x42')]=_0x44a51b[_0xf21f('0x42')]['length']?_0x44a51b[_0xf21f('0x42')]:_0x37f7f0['model'];_0x44a51b[_0xf21f('0x46')]=qs['sort'](_0x414bc1[_0xf21f('0x3f')][_0xf21f('0x47')]);_0x44a51b['where']=qs[_0xf21f('0x40')](_[_0xf21f('0x65')](_0x414bc1[_0xf21f('0x3f')],_0x37f7f0[_0xf21f('0x40')]));if(_0x414bc1['query']['filter']){_0x44a51b[_0xf21f('0x48')]=_[_0xf21f('0x4a')](_0x44a51b[_0xf21f('0x48')],{'$or':_[_0xf21f('0x3a')](_0x44a51b[_0xf21f('0x42')],function(_0x404b73){var _0x23d336={};_0x23d336[_0x404b73]={'$like':'%'+_0x414bc1[_0xf21f('0x3f')]['filter']+'%'};return _0x23d336;})});}_0x44a51b=_[_0xf21f('0x4a')]({},_0x44a51b,_0x414bc1[_0xf21f('0x4c')]);return _0x3244b7[_0xf21f('0xb6')](_0x44a51b);}})['then'](function(_0x3b7f7b){if(_0x3b7f7b){_0x5b9207=_0x3b7f7b[_0xf21f('0x43')];if(!_0x414bc1['query'][_0xf21f('0x44')](_0xf21f('0x45'))){_0x44a51b[_0xf21f('0x2e')]=qs['limit'](_0x414bc1['query'][_0xf21f('0x2e')]);_0x44a51b['offset']=qs[_0xf21f('0x2d')](_0x414bc1[_0xf21f('0x3f')]['offset']);}return _0x3244b7['getApplications'](_0x44a51b);}})[_0xf21f('0x1f')](function(_0x84f07){if(_0x84f07){return _0x84f07?{'count':_0x5b9207,'rows':_0x84f07}:null;}})[_0xf21f('0x1f')](respondWithResult(_0xb9ef4e,null))['catch'](handleError(_0xb9ef4e,null));};exports[_0xf21f('0xb7')]=function(_0x3208b7,_0x5eaa04,_0x48204b){var _0x531a2a={'raw':![],'where':{}};var _0x3cc5f={};var _0xef825b={'count':0x0,'rows':[]};return db[_0xf21f('0x4e')][_0xf21f('0x64')]({'where':{'id':_0x3208b7[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x5eaa04,null))[_0xf21f('0x1f')](function(_0x7f41e2){if(_0x7f41e2){_0x3cc5f[_0xf21f('0x3e')]=_['keys'](db[_0xf21f('0x9a')][_0xf21f('0x52')]);_0x3cc5f['query']=_[_0xf21f('0x53')](_0x3208b7[_0xf21f('0x3f')]);_0x3cc5f['filters']=_['intersection'](_0x3cc5f[_0xf21f('0x3e')],_0x3cc5f[_0xf21f('0x3f')]);_0x531a2a[_0xf21f('0x42')]=_[_0xf21f('0x41')](_0x3cc5f['model'],qs[_0xf21f('0x54')](_0x3208b7[_0xf21f('0x3f')][_0xf21f('0x54')]));_0x531a2a[_0xf21f('0x42')]=_0x531a2a[_0xf21f('0x42')][_0xf21f('0x43')]?_0x531a2a[_0xf21f('0x42')]:_0x3cc5f[_0xf21f('0x3e')];if(!_0x3208b7['query'][_0xf21f('0x44')]('nolimit')){_0x531a2a[_0xf21f('0x2e')]=qs[_0xf21f('0x2e')](_0x3208b7[_0xf21f('0x3f')][_0xf21f('0x2e')]);_0x531a2a[_0xf21f('0x2d')]=qs[_0xf21f('0x2d')](_0x3208b7['query'][_0xf21f('0x2d')]);}_0x531a2a['order']=qs['sort'](_0x3208b7[_0xf21f('0x3f')][_0xf21f('0x47')]);_0x531a2a['where']=qs[_0xf21f('0x40')](_['pick'](_0x3208b7[_0xf21f('0x3f')],_0x3cc5f[_0xf21f('0x40')]));_0x531a2a[_0xf21f('0x48')][_0xf21f('0x61')]=_0x7f41e2['id'];if(_0x3208b7[_0xf21f('0x3f')]['filter']){_0x531a2a[_0xf21f('0x48')]=_[_0xf21f('0x4a')](_0x531a2a[_0xf21f('0x48')],{'$or':_[_0xf21f('0x3a')](_0x531a2a[_0xf21f('0x42')],function(_0x2c5102){var _0x20cde6={};_0x20cde6[_0x2c5102]={'$like':'%'+_0x3208b7[_0xf21f('0x3f')]['filter']+'%'};return _0x20cde6;})});}_0x531a2a=_[_0xf21f('0x4a')]({},_0x531a2a,_0x3208b7[_0xf21f('0x4c')]);return db[_0xf21f('0x9a')][_0xf21f('0x2c')]({'where':_0x531a2a['where']})[_0xf21f('0x1f')](function(_0x5e9694){_0xef825b[_0xf21f('0x2c')]=_0x5e9694;if(_0x3208b7[_0xf21f('0x3f')]['includeAll']){_0x531a2a[_0xf21f('0x55')]=[{'model':db[_0xf21f('0x72')],'as':_0xf21f('0xb8'),'required':![]},{'model':db['User'],'as':_0xf21f('0xb9'),'attributes':[_0xf21f('0x37'),_0xf21f('0xba'),'internal'],'required':![]},{'model':db[_0xf21f('0xbb')],'as':_0xf21f('0xbc'),'attributes':['id',_0xf21f('0x37'),_0xf21f('0xbd')],'where':_0x3208b7['query'][_0xf21f('0xbe')]?{'id':_0x3208b7[_0xf21f('0x3f')][_0xf21f('0xbe')]}:undefined,'required':_0x3208b7[_0xf21f('0x3f')][_0xf21f('0xbe')]?!![]:![]}];}return db[_0xf21f('0x9a')][_0xf21f('0x4f')](_0x531a2a);})[_0xf21f('0x1f')](function(_0x36c852){_0xef825b['rows']=_0x36c852;return _0xef825b;});}})[_0xf21f('0x1f')](respondWithFilteredResult(_0x5eaa04,_0x531a2a))[_0xf21f('0x28')](handleError(_0x5eaa04,null));};exports['send']=function(_0x123bb7,_0x3f5430,_0x531921){var _0x1f7cc7,_0x3ae9b1,_0x45260c;if(_['isNil'](_0x123bb7['body'][_0xf21f('0x5e')])||_0x123bb7['body'][_0xf21f('0x5e')]===''){throw new db[(_0xf21f('0x74'))][(_0xf21f('0x8f'))](_0xf21f('0x90'));}if(_[_0xf21f('0x8e')](_0x123bb7[_0xf21f('0x5e')]['to'])){throw new db[(_0xf21f('0x74'))]['ValidationError']('to\x20is\x20mandatory');}_0x1f7cc7=_0x123bb7[_0xf21f('0x5e')]['to'];return db[_0xf21f('0x4e')][_0xf21f('0x56')]({'where':{'id':_0x123bb7['params']['id']},'include':[{'model':db[_0xf21f('0x94')],'as':_0xf21f('0xbf'),'include':[{'model':db[_0xf21f('0x72')],'as':'Contacts','where':{'mobile':_0x1f7cc7},'limit':0x1,'order':[[_0xf21f('0x78'),'DESC']]}]}]})[_0xf21f('0x1f')](handleEntityNotFound(_0x3f5430,null))[_0xf21f('0x1f')](function(_0x322a09){if(_0x322a09&&_0x322a09[_0xf21f('0xbf')]){_0x3ae9b1=_0x322a09[_0xf21f('0x34')]({'plain':!![]});if(_0x3ae9b1[_0xf21f('0xbf')]&&_0x3ae9b1[_0xf21f('0xbf')][_0xf21f('0x95')]['length']){return _0x3ae9b1[_0xf21f('0xbf')][_0xf21f('0x95')][0x0];}return db['CmContact'][_0xf21f('0x63')](_['defaults'](_0x123bb7[_0xf21f('0x5e')],{'firstName':_0x1f7cc7,'mobile':_0x1f7cc7,'phone':_0x1f7cc7,'ListId':_0x3ae9b1['ListId']}));}})[_0xf21f('0x1f')](handleEntityNotFound(_0x3f5430,null))[_0xf21f('0x1f')](function(_0x3f6364){if(_0x3f6364){_0x45260c=_0x3f6364;return db[_0xf21f('0x9a')][_0xf21f('0x56')]({'where':{'ContactId':_0x45260c['id'],'closed':![],'SmsAccountId':_0x3ae9b1['id']}})[_0xf21f('0x1f')](function(_0x4a577b){if(_0x4a577b){return[_0x4a577b,![]];}return db['SmsInteraction'][_0xf21f('0x63')]({'UserId':_0x123bb7['user']['id'],'ContactId':_0x45260c['id'],'SmsAccountId':_0x3ae9b1['id'],'phone':_0x1f7cc7,'firstMsgDirection':_0xf21f('0xc0'),'Messages':[_['merge'](_0x123bb7['body'],{'read':![],'body':_0x123bb7[_0xf21f('0x5e')][_0xf21f('0x5e')],'phone':_0x1f7cc7,'SmsAccountId':_0x3ae9b1['id'],'UserId':_0x123bb7[_0xf21f('0x57')]['id'],'ContactId':_0x45260c['id']})]},{'include':[{'model':db[_0xf21f('0xa0')],'as':_0xf21f('0xc1')}]})[_0xf21f('0x1f')](function(_0x5ef297){return[_0x5ef297,!![]];});});}})[_0xf21f('0x9b')](function(_0x3fd251,_0x50ada6){if(_0x50ada6){return _0x3fd251;}return db[_0xf21f('0xa0')][_0xf21f('0x63')](_[_0xf21f('0x4a')](_0x123bb7[_0xf21f('0x5e')],{'read':![],'body':_0x123bb7['body'][_0xf21f('0x5e')],'phone':_0x1f7cc7,'SmsAccountId':_0x3ae9b1['id'],'SmsInteractionId':_0x3fd251['id'],'UserId':_0x123bb7[_0xf21f('0x57')]['id'],'ContactId':_0x45260c['id']}))['then'](function(_0x22d707){_0x3fd251['dataValues'][_0xf21f('0xc1')]=[];_0x3fd251[_0xf21f('0xc2')][_0xf21f('0xc1')]['push'](_0x22d707['dataValues']);return _0x3fd251;});})[_0xf21f('0x1f')](respondWithResult(_0x3f5430,null))['catch'](handleError(_0x3f5430,null));};exports[_0xf21f('0x2a')]=function(_0x4541f6,_0x45cb0b,_0x14d0ed){if(_0x4541f6[_0xf21f('0x5e')]['id']){delete _0x4541f6[_0xf21f('0x5e')]['id'];}var _0x3428c1,_0x34a063,_0x38f08f;return db[_0xf21f('0x4e')][_0xf21f('0x56')]({'where':{'id':_0x4541f6['params']['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x45cb0b,null))[_0xf21f('0x1f')](function(_0x5d0c1f){if(_0x5d0c1f){_0x38f08f=_0x5d0c1f;logger['debug'](_0xf21f('0x23'),_0xf21f('0x2a'),_0xf21f('0xc3'),_0x5d0c1f['type'],util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));switch(_0x5d0c1f[_0xf21f('0x3c')]){case'skebby':if(_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xc5')]&&_0x4541f6[_0xf21f('0x5e')]['status']){_0x34a063=_0x4541f6[_0xf21f('0x5e')]['status'];return db[_0xf21f('0xa0')][_0xf21f('0x56')]({'where':{'messageId':_0x4541f6[_0xf21f('0x5e')]['skebby_dispatch_id']}});}break;case _0xf21f('0xc6'):if(_0x4541f6['body'][_0xf21f('0xc7')]&&_0x4541f6[_0xf21f('0x5e')]['statusInt']){_0x34a063=_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xc8')];return db['SmsMessage'][_0xf21f('0x56')]({'where':{'messageId':_0x4541f6['body'][_0xf21f('0xc7')]}});}break;case'clicksend':if(_0x4541f6['body'][_0xf21f('0xc9')]&&_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xca')]){_0x34a063=_0x4541f6['body'][_0xf21f('0xca')];return db[_0xf21f('0xa0')]['find']({'where':{'messageId':_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xc9')]}});}break;case _0xf21f('0x85'):var _0x79040=_0x4541f6['body'][_0xf21f('0x86')][0x0];if(_0x79040['messageId']&&_0x79040['status'][_0xf21f('0xcb')]===_0xf21f('0xcc')){_0x34a063=_0x79040[_0xf21f('0x2a')][_0xf21f('0xcb')];return db[_0xf21f('0xa0')][_0xf21f('0x56')]({'where':{'messageId':_0x79040[_0xf21f('0x82')]}});}break;case'clickatell':if(_0x4541f6['body']['messageId']&&_0x4541f6[_0xf21f('0x5e')][_0xf21f('0x2a')]){_0x34a063=_0x4541f6['body'][_0xf21f('0x2a')];return db['SmsMessage'][_0xf21f('0x56')]({'where':{'messageId':_0x4541f6[_0xf21f('0x5e')]['messageId']}});}break;case _0xf21f('0x8b'):if(_0x4541f6[_0xf21f('0x5e')][0x0]['message']['id']){_0x34a063=_0x4541f6[_0xf21f('0x5e')][0x0][_0xf21f('0x3c')];return db[_0xf21f('0xa0')][_0xf21f('0x56')]({'where':{'messageId':_0x4541f6[_0xf21f('0x5e')][0x0][_0xf21f('0x25')]['id']}});}break;case'intelepeer':if(_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xcd')]&&_0x4541f6[_0xf21f('0x5e')][_0xf21f('0x2a')]){_0x34a063=_0x4541f6[_0xf21f('0x5e')]['status'];return db[_0xf21f('0xa0')][_0xf21f('0x56')]({'where':{'messageId':_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xcd')]}});}break;}}})['then'](handleEntityNotFound(_0x45cb0b,null))[_0xf21f('0x1f')](function(_0x171112){if(_0x171112){_0x3428c1=_0x171112;switch(_0x38f08f[_0xf21f('0x3c')]){case _0xf21f('0x7e'):if(_0x34a063==='DELIVERED'){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xf21f('0xc6'):if(_0x34a063==='1'){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')](_0xf21f('0x23'),_0xf21f('0x2a'),'skebby',util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xce')]&&_0x34a063>=0xc8&&_0x34a063<=0xce){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')](_0xf21f('0x23'),_0xf21f('0x2a'),_0xf21f('0xcf'),util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xf21f('0x85'):var _0x45c2ca=_0x4541f6[_0xf21f('0x5e')][_0xf21f('0x86')][0x0];if(_0x45c2ca[_0xf21f('0x2a')][_0xf21f('0xcb')]===_0xf21f('0xcc')){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger['error'](_0xf21f('0x23'),_0xf21f('0x2a'),'infobip',util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x34a063==_0xf21f('0xd0')||_0x34a063==_0xf21f('0xd1')){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')](_0xf21f('0x23'),_0xf21f('0x2a'),_0xf21f('0xd2'),util['inspect'](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xf21f('0x8b'):if(_0x34a063==_0xf21f('0xd3')){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xf21f('0x8b'),util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x34a063===_0xf21f('0xd4')||_0x34a063===_0xf21f('0xd5')){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')](_0xf21f('0x23'),_0xf21f('0x2a'),_0xf21f('0x8c'),util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x3428c1;}})[_0xf21f('0x1f')](respondWithResult(_0x45cb0b,null))[_0xf21f('0x28')](handleError(_0x45cb0b,null));};exports[_0xf21f('0xd6')]=function(_0x1f7737,_0x50c734,_0x1b5d83){var _0x7252ea,_0x1789ec,_0x477519;return db[_0xf21f('0x4e')]['find']({'where':{'id':_0x1f7737[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x50c734,null))[_0xf21f('0x1f')](function(_0x42030e){if(_0x42030e){_0x477519=_0x42030e;logger[_0xf21f('0x22')](_0xf21f('0x23'),_0xf21f('0x2a'),'received\x20delivery\x20report\x20from',_0x42030e[_0xf21f('0x3c')],util[_0xf21f('0xc4')](_0x1f7737[_0xf21f('0x3f')],{'showHidden':![],'depth':null}));switch(_0x42030e['type']){case _0xf21f('0x87'):if(_0x1f7737[_0xf21f('0x3f')][_0xf21f('0xd7')]&&_0x1f7737[_0xf21f('0x3f')][_0xf21f('0xd8')]){_0x1789ec=_0x1f7737[_0xf21f('0x3f')]['state'];return db[_0xf21f('0xa0')][_0xf21f('0x56')]({'where':{'messageId':_0x1f7737['query']['message-id']}});}break;}}})[_0xf21f('0x1f')](handleEntityNotFound(_0x50c734,null))[_0xf21f('0x1f')](function(_0x432d6c){if(_0x432d6c){_0x7252ea=_0x432d6c;switch(_0x477519['type']){case'csc':if(_0x1789ec==='2'||_0x1789ec==='6'){return _0x7252ea[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf21f('0x2a'),_0xf21f('0x87'),util['inspect'](_0x1f7737[_0xf21f('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x7252ea;}})[_0xf21f('0x1f')](respondWithResult(_0x50c734,null))[_0xf21f('0x28')](handleError(_0x50c734,null));};exports[_0xf21f('0xd9')]=function(_0x13290a,_0x34c639,_0x605ff6){return db[_0xf21f('0x4e')]['find']({'where':{'id':_0x13290a[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x34c639,null))['then'](function(_0x1b9983){if(_0x1b9983){return _0x1b9983[_0xf21f('0xd9')](_0x13290a[_0xf21f('0x5e')]['ids'],_[_0xf21f('0x98')](_0x13290a[_0xf21f('0x5e')],[_0xf21f('0x67'),'id'])||{})[_0xf21f('0x9b')](function(_0x20d4a0){for(var _0x32745a=0x0;_0x32745a<_0x13290a[_0xf21f('0x5e')][_0xf21f('0x67')][_0xf21f('0x43')];_0x32745a+=0x1){socket[_0xf21f('0xda')](_0xf21f('0xdb'),{'UserId':_0x13290a[_0xf21f('0x5e')][_0xf21f('0x67')][_0x32745a],'SmsAccountId':_0x13290a['params']['id']});}return _0x20d4a0;});}})['then'](respondWithResult(_0x34c639,null))[_0xf21f('0x28')](handleError(_0x34c639,null));};exports[_0xf21f('0xdc')]=function(_0x2b4fd9,_0x2cc62e,_0x48595f){return db[_0xf21f('0x4e')][_0xf21f('0x56')]({'where':{'id':_0x2b4fd9[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x2cc62e,null))[_0xf21f('0x1f')](function(_0x190a41){if(_0x190a41){return _0x190a41[_0xf21f('0xdc')](_0x2b4fd9[_0xf21f('0x3f')][_0xf21f('0x67')])[_0xf21f('0x1f')](function(){if(_[_0xf21f('0xdd')](_0x2b4fd9[_0xf21f('0x3f')][_0xf21f('0x67')])){for(var _0x400b9f=0x0;_0x400b9f<_0x2b4fd9[_0xf21f('0x3f')]['ids'][_0xf21f('0x43')];_0x400b9f+=0x1){socket[_0xf21f('0xda')](_0xf21f('0xde'),{'UserId':Number(_0x2b4fd9[_0xf21f('0x3f')][_0xf21f('0x67')][_0x400b9f]),'SmsAccountId':Number(_0x2b4fd9[_0xf21f('0x5f')]['id'])});}}else{socket['emit'](_0xf21f('0xde'),{'UserId':Number(_0x2b4fd9['query']['ids']),'SmsAccountId':Number(_0x2b4fd9[_0xf21f('0x5f')]['id'])});}});}})[_0xf21f('0x1f')](respondWithStatusCode(_0x2cc62e,null))[_0xf21f('0x28')](handleError(_0x2cc62e,null));};exports[_0xf21f('0xdf')]=function(_0x5d668f,_0x4efd38,_0x39ae9b){var _0xad5f1b={};var _0x324eb5={};var _0x28a153;var _0x4bc7ab;return db[_0xf21f('0x4e')][_0xf21f('0x64')]({'where':{'id':_0x5d668f['params']['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x4efd38,null))[_0xf21f('0x1f')](function(_0x550263){if(_0x550263){_0x28a153=_0x550263;_0x324eb5['model']=_['keys'](db[_0xf21f('0xa4')]['rawAttributes']);_0x324eb5[_0xf21f('0x3f')]=_[_0xf21f('0x53')](_0x5d668f['query']);_0x324eb5[_0xf21f('0x40')]=_[_0xf21f('0x41')](_0x324eb5[_0xf21f('0x3e')],_0x324eb5[_0xf21f('0x3f')]);_0xad5f1b[_0xf21f('0x42')]=_['intersection'](_0x324eb5['model'],qs[_0xf21f('0x54')](_0x5d668f['query'][_0xf21f('0x54')]));_0xad5f1b[_0xf21f('0x42')]=_0xad5f1b[_0xf21f('0x42')]['length']?_0xad5f1b['attributes']:_0x324eb5[_0xf21f('0x3e')];_0xad5f1b[_0xf21f('0x46')]=qs[_0xf21f('0x47')](_0x5d668f[_0xf21f('0x3f')][_0xf21f('0x47')]);_0xad5f1b[_0xf21f('0x48')]=qs[_0xf21f('0x40')](_[_0xf21f('0x65')](_0x5d668f[_0xf21f('0x3f')],_0x324eb5['filters']));if(_0x5d668f[_0xf21f('0x3f')][_0xf21f('0x49')]){_0xad5f1b['where']=_[_0xf21f('0x4a')](_0xad5f1b[_0xf21f('0x48')],{'$or':_[_0xf21f('0x3a')](_0xad5f1b[_0xf21f('0x42')],function(_0x3a5a6a){var _0x2560ce={};_0x2560ce[_0x3a5a6a]={'$like':'%'+_0x5d668f['query'][_0xf21f('0x49')]+'%'};return _0x2560ce;})});}_0xad5f1b=_[_0xf21f('0x4a')]({},_0xad5f1b,_0x5d668f['options']);return _0x28a153[_0xf21f('0xdf')](_0xad5f1b);}})[_0xf21f('0x1f')](function(_0x38d6a3){if(_0x38d6a3){_0x4bc7ab=_0x38d6a3[_0xf21f('0x43')];if(!_0x5d668f['query']['hasOwnProperty'](_0xf21f('0x45'))){_0xad5f1b[_0xf21f('0x2e')]=qs[_0xf21f('0x2e')](_0x5d668f[_0xf21f('0x3f')]['limit']);_0xad5f1b[_0xf21f('0x2d')]=qs[_0xf21f('0x2d')](_0x5d668f[_0xf21f('0x3f')][_0xf21f('0x2d')]);}return _0x28a153[_0xf21f('0xdf')](_0xad5f1b);}})[_0xf21f('0x1f')](function(_0x5d2666){if(_0x5d2666){return _0x5d2666?{'count':_0x4bc7ab,'rows':_0x5d2666}:null;}})['then'](respondWithResult(_0x4efd38,null))['catch'](handleError(_0x4efd38,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 486abe3..e2aa94b 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 _0x9d24=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','SmsAccount'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x9d24,0x1b6));var _0x49d2=function(_0x9bbaf1,_0x21ab88){_0x9bbaf1=_0x9bbaf1-0x0;var _0x4e0704=_0x9d24[_0x9bbaf1];return _0x4e0704;};'use strict';var EventEmitter=require(_0x49d2('0x0'));var SmsAccount=require(_0x49d2('0x1'))['db'][_0x49d2('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x49d2('0x3')](0x0);var events={'afterCreate':_0x49d2('0x4'),'afterUpdate':_0x49d2('0x5'),'afterDestroy':_0x49d2('0x6')};function emitEvent(_0x5d902c){return function(_0x168dd7,_0x411a5a,_0x152068){SmsAccountEvents['emit'](_0x5d902c+':'+_0x168dd7['id'],_0x168dd7);SmsAccountEvents[_0x49d2('0x7')](_0x5d902c,_0x168dd7);_0x152068(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x49d2('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x80ee=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x29436c,_0x260a6a){var _0x3760a2=function(_0xc9ee2){while(--_0xc9ee2){_0x29436c['push'](_0x29436c['shift']());}};_0x3760a2(++_0x260a6a);}(_0x80ee,0x1d9));var _0xe80e=function(_0x1abbaa,_0x1b7a38){_0x1abbaa=_0x1abbaa-0x0;var _0x40ed52=_0x80ee[_0x1abbaa];return _0x40ed52;};'use strict';var EventEmitter=require(_0xe80e('0x0'));var SmsAccount=require(_0xe80e('0x1'))['db'][_0xe80e('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe80e('0x3')](0x0);var events={'afterCreate':_0xe80e('0x4'),'afterUpdate':_0xe80e('0x5'),'afterDestroy':_0xe80e('0x6')};function emitEvent(_0x4cfee6){return function(_0x3145cb,_0x13b051,_0x3a2baa){SmsAccountEvents[_0xe80e('0x7')](_0x4cfee6+':'+_0x3145cb['id'],_0x3145cb);SmsAccountEvents[_0xe80e('0x7')](_0x4cfee6,_0x3145cb);_0x3a2baa(null);};}for(var e in events){if(events[_0xe80e('0x8')](e)){var event=events[e];SmsAccount[_0xe80e('0x9')](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 1755dbe..9cb84e1 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 _0xe886=['bluebird','request-promise','path','../../config/environment','SmsAccount','sms_accounts','util','../../config/logger','api','moment'];(function(_0x47da59,_0x3e77a2){var _0x19b96c=function(_0x28c3d8){while(--_0x28c3d8){_0x47da59['push'](_0x47da59['shift']());}};_0x19b96c(++_0x3e77a2);}(_0xe886,0x1a0));var _0x6e88=function(_0x5ab7cf,_0x173067){_0x5ab7cf=_0x5ab7cf-0x0;var _0x519b07=_0xe886[_0x5ab7cf];return _0x519b07;};'use strict';var _=require('lodash');var util=require(_0x6e88('0x0'));var logger=require(_0x6e88('0x1'))(_0x6e88('0x2'));var moment=require(_0x6e88('0x3'));var BPromise=require(_0x6e88('0x4'));var rp=require(_0x6e88('0x5'));var fs=require('fs');var path=require(_0x6e88('0x6'));var rimraf=require('rimraf');var config=require(_0x6e88('0x7'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x164a0f,_0x97da57){return _0x164a0f['define'](_0x6e88('0x8'),attributes,{'tableName':_0x6e88('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1863=['define','sms_accounts','lodash','api','moment','bluebird','request-promise','path'];(function(_0x3788d6,_0x6bd7e8){var _0x53c3e8=function(_0x358170){while(--_0x358170){_0x3788d6['push'](_0x3788d6['shift']());}};_0x53c3e8(++_0x6bd7e8);}(_0x1863,0x1ca));var _0x3186=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x1863[_0x20845e];return _0x28cf2b;};'use strict';var _=require(_0x3186('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3186('0x1'));var moment=require(_0x3186('0x2'));var BPromise=require(_0x3186('0x3'));var rp=require(_0x3186('0x4'));var fs=require('fs');var path=require(_0x3186('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module['exports']=function(_0x53a58a,_0x4a6dc5){return _0x53a58a[_0x3186('0x6')]('SmsAccount',attributes,{'tableName':_0x3186('0x7'),'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 d455950..4fe820b 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 _0xf8f5=['ioredis','../../mysqldb','../../config/environment','jayson/promise','http','redis','defaults','localhost','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','lodash'];(function(_0x284310,_0x570032){var _0x40826d=function(_0x32a578){while(--_0x32a578){_0x284310['push'](_0x284310['shift']());}};_0x40826d(++_0x570032);}(_0xf8f5,0x1b1));var _0x5f8f=function(_0x467b34,_0x23e3f6){_0x467b34=_0x467b34-0x0;var _0x3981e5=_0xf8f5[_0x467b34];return _0x3981e5;};'use strict';var _=require(_0x5f8f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f8f('0x1'));var db=require(_0x5f8f('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5f8f('0x3'));var jayson=require(_0x5f8f('0x4'));var client=jayson['client'][_0x5f8f('0x5')]({'port':0x232a});config[_0x5f8f('0x6')]=_[_0x5f8f('0x7')](config['redis'],{'host':_0x5f8f('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5f8f('0x6')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0xf3ae47,_0x3618c8,_0xf3ad34){return new BPromise(function(_0xce71a9,_0x1119c2){return client['request'](_0xf3ae47,_0xf3ad34)[_0x5f8f('0x9')](function(_0x594dda){logger[_0x5f8f('0xa')]('SmsAccount,\x20%s,\x20%s',_0x3618c8,_0x5f8f('0xb'));logger[_0x5f8f('0xc')](_0x5f8f('0xd'),_0x3618c8,_0x5f8f('0xb'),JSON[_0x5f8f('0xe')](_0x594dda));if(_0x594dda['error']){if(_0x594dda[_0x5f8f('0xf')][_0x5f8f('0x10')]===0x1f4){logger[_0x5f8f('0xf')](_0x5f8f('0x11'),_0x3618c8,_0x594dda['error'][_0x5f8f('0x12')]);return _0x1119c2(_0x594dda[_0x5f8f('0xf')][_0x5f8f('0x12')]);}logger[_0x5f8f('0xf')](_0x5f8f('0x11'),_0x3618c8,_0x594dda['error'][_0x5f8f('0x12')]);return _0xce71a9(_0x594dda[_0x5f8f('0xf')]['message']);}else{logger[_0x5f8f('0xa')](_0x5f8f('0x11'),_0x3618c8,_0x5f8f('0xb'));_0xce71a9(_0x594dda[_0x5f8f('0x13')][_0x5f8f('0x12')]);}})[_0x5f8f('0x14')](function(_0x1ddeac){logger[_0x5f8f('0xf')]('SmsAccount,\x20%s,\x20%s',_0x3618c8,_0x1ddeac);_0x1119c2(_0x1ddeac);});});}exports[_0x5f8f('0x15')]=function(_0x314a29){var _0x172d99=this;return new Promise(function(_0x16bb07,_0x31c884){return db[_0x5f8f('0x16')][_0x5f8f('0x17')]({'raw':_0x314a29['options']?_0x314a29[_0x5f8f('0x18')][_0x5f8f('0x19')]===undefined?!![]:![]:!![],'where':_0x314a29[_0x5f8f('0x18')]?_0x314a29['options'][_0x5f8f('0x1a')]||null:null,'attributes':_0x314a29[_0x5f8f('0x18')]?_0x314a29['options'][_0x5f8f('0x1b')]||null:null,'include':_0x314a29[_0x5f8f('0x18')]?_0x314a29[_0x5f8f('0x18')][_0x5f8f('0x1c')]?_[_0x5f8f('0x1d')](_0x314a29[_0x5f8f('0x18')][_0x5f8f('0x1c')],function(_0x5639c2){return{'model':db[_0x5639c2[_0x5f8f('0x1e')]],'as':_0x5639c2['as'],'attributes':_0x5639c2['attributes'],'include':_0x5639c2[_0x5f8f('0x1c')]?_[_0x5f8f('0x1d')](_0x5639c2[_0x5f8f('0x1c')],function(_0x4eb074){return{'model':db[_0x4eb074['model']],'as':_0x4eb074['as'],'attributes':_0x4eb074['attributes'],'include':_0x4eb074[_0x5f8f('0x1c')]?_[_0x5f8f('0x1d')](_0x4eb074['include'],function(_0x5ce095){return{'model':db[_0x5ce095[_0x5f8f('0x1e')]],'as':_0x5ce095['as'],'attributes':_0x5ce095[_0x5f8f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5f8f('0x9')](function(_0x178288){logger[_0x5f8f('0xa')](_0x5f8f('0x15'),_0x314a29);logger[_0x5f8f('0xc')]('ShowSmsAccount',_0x314a29,JSON['stringify'](_0x178288));_0x16bb07(_0x178288);})['catch'](function(_0x149eb9){logger[_0x5f8f('0xf')](_0x5f8f('0x15'),_0x149eb9[_0x5f8f('0x12')],_0x314a29);_0x31c884(_0x172d99[_0x5f8f('0xf')](0x1f4,_0x149eb9[_0x5f8f('0x12')]));});});}; \ No newline at end of file +var _0xf035=['where','include','map','model','attributes','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','SmsAccount,\x20%s,\x20%s','info','result','ShowSmsAccount','SmsAccount','find','options','raw'];(function(_0x273987,_0x44056f){var _0x50ebc7=function(_0x4efbf0){while(--_0x4efbf0){_0x273987['push'](_0x273987['shift']());}};_0x50ebc7(++_0x44056f);}(_0xf035,0x18d));var _0x5f03=function(_0xd8ab97,_0x2ec538){_0xd8ab97=_0xd8ab97-0x0;var _0x39eb9a=_0xf035[_0xd8ab97];return _0x39eb9a;};'use strict';var _=require(_0x5f03('0x0'));var util=require(_0x5f03('0x1'));var moment=require(_0x5f03('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f03('0x3'));var fs=require('fs');var Redis=require(_0x5f03('0x4'));var db=require(_0x5f03('0x5'))['db'];var utils=require(_0x5f03('0x6'));var logger=require(_0x5f03('0x7'))(_0x5f03('0x8'));var config=require(_0x5f03('0x9'));var jayson=require(_0x5f03('0xa'));var client=jayson[_0x5f03('0xb')][_0x5f03('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5f03('0xd')],{'host':_0x5f03('0xe'),'port':0x18eb});var socket=require(_0x5f03('0xf'))(new Redis(config[_0x5f03('0xd')]));require('./smsAccount.socket')[_0x5f03('0x10')](socket);function respondWithRpcPromise(_0x3bc800,_0x46caeb,_0x427668){return new BPromise(function(_0x3c7b77,_0x5d8086){return client['request'](_0x3bc800,_0x427668)[_0x5f03('0x11')](function(_0x362cd6){logger['info']('SmsAccount,\x20%s,\x20%s',_0x46caeb,_0x5f03('0x12'));logger[_0x5f03('0x13')](_0x5f03('0x14'),_0x46caeb,_0x5f03('0x12'),JSON['stringify'](_0x362cd6));if(_0x362cd6[_0x5f03('0x15')]){if(_0x362cd6['error'][_0x5f03('0x16')]===0x1f4){logger[_0x5f03('0x15')]('SmsAccount,\x20%s,\x20%s',_0x46caeb,_0x362cd6['error']['message']);return _0x5d8086(_0x362cd6[_0x5f03('0x15')][_0x5f03('0x17')]);}logger[_0x5f03('0x15')](_0x5f03('0x18'),_0x46caeb,_0x362cd6[_0x5f03('0x15')][_0x5f03('0x17')]);return _0x3c7b77(_0x362cd6[_0x5f03('0x15')]['message']);}else{logger[_0x5f03('0x19')](_0x5f03('0x18'),_0x46caeb,'request\x20sent');_0x3c7b77(_0x362cd6[_0x5f03('0x1a')][_0x5f03('0x17')]);}})['catch'](function(_0x2db941){logger[_0x5f03('0x15')](_0x5f03('0x18'),_0x46caeb,_0x2db941);_0x5d8086(_0x2db941);});});}exports[_0x5f03('0x1b')]=function(_0x1390b6){var _0x4e6972=this;return new Promise(function(_0x35191f,_0x57172b){return db[_0x5f03('0x1c')][_0x5f03('0x1d')]({'raw':_0x1390b6[_0x5f03('0x1e')]?_0x1390b6[_0x5f03('0x1e')][_0x5f03('0x1f')]===undefined?!![]:![]:!![],'where':_0x1390b6['options']?_0x1390b6['options'][_0x5f03('0x20')]||null:null,'attributes':_0x1390b6['options']?_0x1390b6[_0x5f03('0x1e')]['attributes']||null:null,'include':_0x1390b6[_0x5f03('0x1e')]?_0x1390b6[_0x5f03('0x1e')][_0x5f03('0x21')]?_[_0x5f03('0x22')](_0x1390b6[_0x5f03('0x1e')]['include'],function(_0x44f668){return{'model':db[_0x44f668[_0x5f03('0x23')]],'as':_0x44f668['as'],'attributes':_0x44f668[_0x5f03('0x24')],'include':_0x44f668[_0x5f03('0x21')]?_['map'](_0x44f668['include'],function(_0x5a4400){return{'model':db[_0x5a4400[_0x5f03('0x23')]],'as':_0x5a4400['as'],'attributes':_0x5a4400[_0x5f03('0x24')],'include':_0x5a4400[_0x5f03('0x21')]?_[_0x5f03('0x22')](_0x5a4400['include'],function(_0x2e9e3a){return{'model':db[_0x2e9e3a[_0x5f03('0x23')]],'as':_0x2e9e3a['as'],'attributes':_0x2e9e3a[_0x5f03('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5f03('0x11')](function(_0x53730f){logger['info']('ShowSmsAccount',_0x1390b6);logger[_0x5f03('0x13')](_0x5f03('0x1b'),_0x1390b6,JSON[_0x5f03('0x25')](_0x53730f));_0x35191f(_0x53730f);})[_0x5f03('0x26')](function(_0x79c58f){logger[_0x5f03('0x15')](_0x5f03('0x1b'),_0x79c58f[_0x5f03('0x17')],_0x1390b6);_0x57172b(_0x4e6972['error'](0x1f4,_0x79c58f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 2605538..4d47c39 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 _0xfd33=['remove','update','emit','smsAccount:','./smsAccount.events','save'];(function(_0x186d6d,_0x2d9f83){var _0x1d72a3=function(_0x3199e7){while(--_0x3199e7){_0x186d6d['push'](_0x186d6d['shift']());}};_0x1d72a3(++_0x2d9f83);}(_0xfd33,0x154));var _0x3fd3=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xfd33[_0x494d1f];return _0x457b6e;};'use strict';var SmsAccountEvents=require(_0x3fd3('0x0'));var events=[_0x3fd3('0x1'),_0x3fd3('0x2'),_0x3fd3('0x3')];function createListener(_0x239eed,_0x19d756){return function(_0xa78938){_0x19d756[_0x3fd3('0x4')](_0x239eed,_0xa78938);};}function removeListener(_0x59a302,_0x1cc55b){return function(){SmsAccountEvents['removeListener'](_0x59a302,_0x1cc55b);};}exports['register']=function(_0x34f657){for(var _0x50e459=0x0,_0x3ad1fa=events['length'];_0x50e459<_0x3ad1fa;_0x50e459++){var _0x5709e6=events[_0x50e459];var _0x4580c6=createListener(_0x3fd3('0x5')+_0x5709e6,_0x34f657);SmsAccountEvents['on'](_0x5709e6,_0x4580c6);}}; \ No newline at end of file +var _0x782b=['smsAccount:','remove','removeListener','register'];(function(_0x12c250,_0x326ae8){var _0x5eb220=function(_0x4484d0){while(--_0x4484d0){_0x12c250['push'](_0x12c250['shift']());}};_0x5eb220(++_0x326ae8);}(_0x782b,0x89));var _0xb782=function(_0x5e20bf,_0x936407){_0x5e20bf=_0x5e20bf-0x0;var _0x3978d9=_0x782b[_0x5e20bf];return _0x3978d9;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0xb782('0x0'),'update'];function createListener(_0x22424e,_0x198435){return function(_0x404d9c){_0x198435['emit'](_0x22424e,_0x404d9c);};}function removeListener(_0x31aa36,_0x735d16){return function(){SmsAccountEvents[_0xb782('0x1')](_0x31aa36,_0x735d16);};}exports[_0xb782('0x2')]=function(_0x22005f){for(var _0x177318=0x0,_0x1a33c8=events['length'];_0x177318<_0x1a33c8;_0x177318++){var _0x21a5c8=events[_0x177318];var _0x15adef=createListener(_0xb782('0x3')+_0x21a5c8,_0x22005f);SmsAccountEvents['on'](_0x21a5c8,_0x15adef);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 27b267b..ba8aa50 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 _0xdbe0=['isAuthenticated','get','post','put','/:id','update','destroy','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsApplication.controller'];(function(_0x3fd16d,_0x24f6a0){var _0x28257f=function(_0x3630d1){while(--_0x3630d1){_0x3fd16d['push'](_0x3fd16d['shift']());}};_0x28257f(++_0x24f6a0);}(_0xdbe0,0x69));var _0x0dbe=function(_0x45afa8,_0x3c1dee){_0x45afa8=_0x45afa8-0x0;var _0x21f711=_0xdbe0[_0x45afa8];return _0x21f711;};'use strict';var multer=require('multer');var util=require(_0x0dbe('0x0'));var path=require(_0x0dbe('0x1'));var timeout=require(_0x0dbe('0x2'));var express=require(_0x0dbe('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0dbe('0x4'));var config=require(_0x0dbe('0x5'));var controller=require(_0x0dbe('0x6'));router['get']('/',auth[_0x0dbe('0x7')](),controller['index']);router[_0x0dbe('0x8')]('/:id',auth[_0x0dbe('0x7')](),controller['show']);router[_0x0dbe('0x9')]('/',auth[_0x0dbe('0x7')](),controller['create']);router[_0x0dbe('0xa')](_0x0dbe('0xb'),auth[_0x0dbe('0x7')](),controller[_0x0dbe('0xc')]);router['delete'](_0x0dbe('0xb'),auth[_0x0dbe('0x7')](),controller[_0x0dbe('0xd')]);module['exports']=router; \ No newline at end of file +var _0xc57c=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','/:id','post'];(function(_0x4873e1,_0x5e4cbe){var _0x453c0a=function(_0x3ff784){while(--_0x3ff784){_0x4873e1['push'](_0x4873e1['shift']());}};_0x453c0a(++_0x5e4cbe);}(_0xc57c,0x17e));var _0xcc57=function(_0x535144,_0x20d1ca){_0x535144=_0x535144-0x0;var _0x2e33fc=_0xc57c[_0x535144];return _0x2e33fc;};'use strict';var multer=require(_0xcc57('0x0'));var util=require(_0xcc57('0x1'));var path=require(_0xcc57('0x2'));var timeout=require(_0xcc57('0x3'));var express=require(_0xcc57('0x4'));var router=express[_0xcc57('0x5')]();var auth=require(_0xcc57('0x6'));var interaction=require(_0xcc57('0x7'));var config=require(_0xcc57('0x8'));var controller=require(_0xcc57('0x9'));router[_0xcc57('0xa')]('/',auth[_0xcc57('0xb')](),controller['index']);router[_0xcc57('0xa')](_0xcc57('0xc'),auth[_0xcc57('0xb')](),controller['show']);router[_0xcc57('0xd')]('/',auth[_0xcc57('0xb')](),controller['create']);router[_0xcc57('0xe')]('/:id',auth[_0xcc57('0xb')](),controller[_0xcc57('0xf')]);router[_0xcc57('0x10')](_0xcc57('0xc'),auth[_0xcc57('0xb')](),controller[_0xcc57('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index e207cb1..2786db9 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 _0xb1ea=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x111557,_0x4671f4){var _0xc99165=function(_0x24fbac){while(--_0x24fbac){_0x111557['push'](_0x111557['shift']());}};_0xc99165(++_0x4671f4);}(_0xb1ea,0xf6));var _0xab1e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xb1ea[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0xab1e('0x0'));module[_0xab1e('0x1')]={'priority':{'type':Sequelize[_0xab1e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xab1e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xab1e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xab1e('0x3')],'defaultValue':_0xab1e('0x5')}}; \ No newline at end of file +var _0xd09c=['sequelize','exports','STRING','noop','TEXT'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xd09c,0x113));var _0xcd09=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd09c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xcd09('0x0'));module[_0xcd09('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xcd09('0x2')],'allowNull':![],'defaultValue':_0xcd09('0x3')},'appdata':{'type':Sequelize[_0xcd09('0x4')]()},'description':{'type':Sequelize[_0xcd09('0x2')]},'interval':{'type':Sequelize[_0xcd09('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 73c9851..e260d14 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 _0x32bb=['path','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x564738,_0x2c90c5){var _0x10a948=function(_0x544425){while(--_0x544425){_0x564738['push'](_0x564738['shift']());}};_0x10a948(++_0x2c90c5);}(_0x32bb,0x87));var _0xb32b=function(_0x1a3e23,_0xce45e){_0x1a3e23=_0x1a3e23-0x0;var _0x5ee0d8=_0x32bb[_0x1a3e23];return _0x5ee0d8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb32b('0x0'));var rimraf=require(_0xb32b('0x1'));var zipdir=require(_0xb32b('0x2'));var jsonpatch=require(_0xb32b('0x3'));var rp=require(_0xb32b('0x4'));var moment=require(_0xb32b('0x5'));var BPromise=require(_0xb32b('0x6'));var Mustache=require(_0xb32b('0x7'));var util=require(_0xb32b('0x8'));var path=require(_0xb32b('0x9'));var sox=require('sox');var csv=require(_0xb32b('0xa'));var ejs=require(_0xb32b('0xb'));var fs=require('fs');var _=require(_0xb32b('0xc'));var squel=require(_0xb32b('0xd'));var crypto=require(_0xb32b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb32b('0xa'));var querystring=require('querystring');var Papa=require(_0xb32b('0xf'));var Redis=require('ioredis');var authService=require(_0xb32b('0x10'));var qs=require(_0xb32b('0x11'));var as=require(_0xb32b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb32b('0x13'))(_0xb32b('0x14'));var utils=require('../../config/utils');var config=require(_0xb32b('0x15'));var licenseUtil=require(_0xb32b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15a85d,_0x481d85){_0x481d85=_0x481d85||0xcc;return function(_0x549786){if(_0x549786){return _0x15a85d[_0xb32b('0x17')](_0x481d85);}return _0x15a85d[_0xb32b('0x18')](_0x481d85)['end']();};}function respondWithResult(_0x455742,_0x1d54f1){_0x1d54f1=_0x1d54f1||0xc8;return function(_0x5be2ba){if(_0x5be2ba){return _0x455742['status'](_0x1d54f1)[_0xb32b('0x19')](_0x5be2ba);}};}function respondWithFilteredResult(_0x23be7d,_0x21dc9c){return function(_0x468854){if(_0x468854){var _0x36c805=_0x468854['count'],_0x4bbd68=_0x21dc9c['offset'],_0x510695=_0x21dc9c[_0xb32b('0x1a')]+_0x21dc9c[_0xb32b('0x1b')],_0x23a907;if(_0x510695>=_0x36c805){_0x510695=_0x36c805;_0x23a907=0xc8;}else{_0x23a907=0xce;}_0x23be7d[_0xb32b('0x18')](_0x23a907);return _0x23be7d[_0xb32b('0x1c')]('Content-Range',_0x4bbd68+'-'+_0x510695+'/'+_0x36c805)[_0xb32b('0x19')](_0x468854);}return null;};}function patchUpdates(_0x53d6ef){return function(_0x2f1a74){try{jsonpatch[_0xb32b('0x1d')](_0x2f1a74,_0x53d6ef,!![]);}catch(_0x33c34a){return BPromise[_0xb32b('0x1e')](_0x33c34a);}return _0x2f1a74[_0xb32b('0x1f')]();};}function saveUpdates(_0x3859ee,_0x4b0e5e){return function(_0x3b92a3){if(_0x3b92a3){return _0x3b92a3[_0xb32b('0x20')](_0x3859ee)[_0xb32b('0x21')](function(_0x5ee5b3){return _0x5ee5b3;});}return null;};}function removeEntity(_0x2734e1,_0x4754b7){return function(_0x40715f){if(_0x40715f){return _0x40715f[_0xb32b('0x22')]()['then'](function(){_0x2734e1[_0xb32b('0x18')](0xcc)[_0xb32b('0x23')]();});}};}function handleEntityNotFound(_0xc684f7,_0x3da8fe){return function(_0x30444c){if(!_0x30444c){_0xc684f7['sendStatus'](0x194);}return _0x30444c;};}function handleError(_0x3166fe,_0x28eba1){_0x28eba1=_0x28eba1||0x1f4;return function(_0x17963f){logger[_0xb32b('0x24')](_0x17963f[_0xb32b('0x25')]);if(_0x17963f[_0xb32b('0x26')]){delete _0x17963f['name'];}_0x3166fe['status'](_0x28eba1)[_0xb32b('0x27')](_0x17963f);};}exports[_0xb32b('0x28')]=function(_0xb39101,_0x34c90d){var _0x62997c={},_0x3b107b={},_0x1d8712={'count':0x0,'rows':[]};var _0x1993a5=_[_0xb32b('0x29')](db[_0xb32b('0x2a')][_0xb32b('0x2b')],function(_0x20061b){return{'name':_0x20061b[_0xb32b('0x2c')],'type':_0x20061b[_0xb32b('0x2d')]['key']};});_0x3b107b[_0xb32b('0x2e')]=_[_0xb32b('0x29')](_0x1993a5,_0xb32b('0x26'));_0x3b107b[_0xb32b('0x2f')]=_[_0xb32b('0x30')](_0xb39101[_0xb32b('0x2f')]);_0x3b107b['filters']=_['intersection'](_0x3b107b[_0xb32b('0x2e')],_0x3b107b[_0xb32b('0x2f')]);_0x62997c[_0xb32b('0x31')]=_[_0xb32b('0x32')](_0x3b107b[_0xb32b('0x2e')],qs['fields'](_0xb39101[_0xb32b('0x2f')][_0xb32b('0x33')]));_0x62997c[_0xb32b('0x31')]=_0x62997c[_0xb32b('0x31')]['length']?_0x62997c[_0xb32b('0x31')]:_0x3b107b[_0xb32b('0x2e')];if(!_0xb39101[_0xb32b('0x2f')][_0xb32b('0x34')](_0xb32b('0x35'))){_0x62997c[_0xb32b('0x1b')]=qs[_0xb32b('0x1b')](_0xb39101['query'][_0xb32b('0x1b')]);_0x62997c['offset']=qs['offset'](_0xb39101[_0xb32b('0x2f')][_0xb32b('0x1a')]);}_0x62997c['order']=qs[_0xb32b('0x36')](_0xb39101[_0xb32b('0x2f')]['sort']);_0x62997c[_0xb32b('0x37')]=qs[_0xb32b('0x38')](_['pick'](_0xb39101[_0xb32b('0x2f')],_0x3b107b[_0xb32b('0x38')]),_0x1993a5);if(_0xb39101[_0xb32b('0x2f')][_0xb32b('0x39')]){_0x62997c[_0xb32b('0x37')]=_[_0xb32b('0x3a')](_0x62997c['where'],{'$or':_['map'](_0x1993a5,function(_0x2a2a9f){if(_0x2a2a9f[_0xb32b('0x2d')]!==_0xb32b('0x3b')){var _0x4ae5b3={};_0x4ae5b3[_0x2a2a9f[_0xb32b('0x26')]]={'$like':'%'+_0xb39101[_0xb32b('0x2f')][_0xb32b('0x39')]+'%'};return _0x4ae5b3;}})});}_0x62997c=_['merge']({},_0x62997c,_0xb39101[_0xb32b('0x3c')]);var _0x5a5610={'where':_0x62997c[_0xb32b('0x37')]};return db[_0xb32b('0x2a')][_0xb32b('0x3d')](_0x5a5610)[_0xb32b('0x21')](function(_0x4c8bf7){_0x1d8712['count']=_0x4c8bf7;if(_0xb39101['query'][_0xb32b('0x3e')]){_0x62997c[_0xb32b('0x3f')]=[{'all':!![]}];}return db['SmsApplication'][_0xb32b('0x40')](_0x62997c);})[_0xb32b('0x21')](function(_0xa1b0c8){_0x1d8712[_0xb32b('0x41')]=_0xa1b0c8;return _0x1d8712;})[_0xb32b('0x21')](respondWithFilteredResult(_0x34c90d,_0x62997c))['catch'](handleError(_0x34c90d,null));};exports[_0xb32b('0x42')]=function(_0x540aa1,_0x2d93ce){var _0x4df202={'raw':!![],'where':{'id':_0x540aa1[_0xb32b('0x43')]['id']}},_0x134891={};_0x134891[_0xb32b('0x2e')]=_[_0xb32b('0x30')](db[_0xb32b('0x2a')][_0xb32b('0x2b')]);_0x134891[_0xb32b('0x2f')]=_[_0xb32b('0x30')](_0x540aa1[_0xb32b('0x2f')]);_0x134891['filters']=_[_0xb32b('0x32')](_0x134891[_0xb32b('0x2e')],_0x134891[_0xb32b('0x2f')]);_0x4df202[_0xb32b('0x31')]=_[_0xb32b('0x32')](_0x134891['model'],qs[_0xb32b('0x33')](_0x540aa1[_0xb32b('0x2f')][_0xb32b('0x33')]));_0x4df202[_0xb32b('0x31')]=_0x4df202[_0xb32b('0x31')]['length']?_0x4df202[_0xb32b('0x31')]:_0x134891[_0xb32b('0x2e')];if(_0x540aa1[_0xb32b('0x2f')][_0xb32b('0x3e')]){_0x4df202[_0xb32b('0x3f')]=[{'all':!![]}];}_0x4df202=_['merge']({},_0x4df202,_0x540aa1[_0xb32b('0x3c')]);return db[_0xb32b('0x2a')][_0xb32b('0x44')](_0x4df202)[_0xb32b('0x21')](handleEntityNotFound(_0x2d93ce,null))[_0xb32b('0x21')](respondWithResult(_0x2d93ce,null))[_0xb32b('0x45')](handleError(_0x2d93ce,null));};exports['create']=function(_0x3765ff,_0x24e34d){return db[_0xb32b('0x2a')][_0xb32b('0x46')](_0x3765ff[_0xb32b('0x47')],{})[_0xb32b('0x21')](respondWithResult(_0x24e34d,0xc9))[_0xb32b('0x45')](handleError(_0x24e34d,null));};exports['update']=function(_0x5dbf21,_0x182488){if(_0x5dbf21[_0xb32b('0x47')]['id']){delete _0x5dbf21[_0xb32b('0x47')]['id'];}return db[_0xb32b('0x2a')]['find']({'where':{'id':_0x5dbf21[_0xb32b('0x43')]['id']}})[_0xb32b('0x21')](handleEntityNotFound(_0x182488,null))['then'](saveUpdates(_0x5dbf21[_0xb32b('0x47')],null))[_0xb32b('0x21')](respondWithResult(_0x182488,null))['catch'](handleError(_0x182488,null));};exports['destroy']=function(_0x483f65,_0x31a557){return db[_0xb32b('0x2a')][_0xb32b('0x44')]({'where':{'id':_0x483f65[_0xb32b('0x43')]['id']}})[_0xb32b('0x21')](handleEntityNotFound(_0x31a557,null))['then'](removeEntity(_0x31a557,null))['catch'](handleError(_0x31a557,null));}; \ No newline at end of file +var _0x66ee=['squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','json','apply','reject','update','destroy','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','include','findAll','rows','then','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x34360e,_0x1009d6){var _0x4c19c7=function(_0x2755bd){while(--_0x2755bd){_0x34360e['push'](_0x34360e['shift']());}};_0x4c19c7(++_0x1009d6);}(_0x66ee,0x85));var _0xe66e=function(_0x59b583,_0x227f10){_0x59b583=_0x59b583-0x0;var _0x38217b=_0x66ee[_0x59b583];return _0x38217b;};'use strict';var pdf=require(_0xe66e('0x0'));var emlformat=require(_0xe66e('0x1'));var rimraf=require(_0xe66e('0x2'));var zipdir=require(_0xe66e('0x3'));var jsonpatch=require(_0xe66e('0x4'));var rp=require('request-promise');var moment=require(_0xe66e('0x5'));var BPromise=require(_0xe66e('0x6'));var Mustache=require(_0xe66e('0x7'));var util=require(_0xe66e('0x8'));var path=require('path');var sox=require(_0xe66e('0x9'));var csv=require(_0xe66e('0xa'));var ejs=require(_0xe66e('0xb'));var fs=require('fs');var _=require(_0xe66e('0xc'));var squel=require(_0xe66e('0xd'));var crypto=require('crypto');var jsforce=require(_0xe66e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe66e('0xf'));var Papa=require('papaparse');var Redis=require(_0xe66e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe66e('0x11'));var as=require(_0xe66e('0x12'));var hardwareService=require(_0xe66e('0x13'));var logger=require(_0xe66e('0x14'))(_0xe66e('0x15'));var utils=require(_0xe66e('0x16'));var config=require(_0xe66e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe66e('0x18'))['db'];function respondWithStatusCode(_0x279384,_0x4e68e8){_0x4e68e8=_0x4e68e8||0xcc;return function(_0x265b15){if(_0x265b15){return _0x279384[_0xe66e('0x19')](_0x4e68e8);}return _0x279384[_0xe66e('0x1a')](_0x4e68e8)[_0xe66e('0x1b')]();};}function respondWithResult(_0x39e53f,_0x3331c2){_0x3331c2=_0x3331c2||0xc8;return function(_0x22fbe9){if(_0x22fbe9){return _0x39e53f[_0xe66e('0x1a')](_0x3331c2)['json'](_0x22fbe9);}};}function respondWithFilteredResult(_0x399b99,_0x55fb65){return function(_0x88e27){if(_0x88e27){var _0x37db26=_0x88e27[_0xe66e('0x1c')],_0x3b9f1f=_0x55fb65[_0xe66e('0x1d')],_0x4591e2=_0x55fb65['offset']+_0x55fb65[_0xe66e('0x1e')],_0x386003;if(_0x4591e2>=_0x37db26){_0x4591e2=_0x37db26;_0x386003=0xc8;}else{_0x386003=0xce;}_0x399b99['status'](_0x386003);return _0x399b99['set']('Content-Range',_0x3b9f1f+'-'+_0x4591e2+'/'+_0x37db26)[_0xe66e('0x1f')](_0x88e27);}return null;};}function patchUpdates(_0x373f8a){return function(_0x593232){try{jsonpatch[_0xe66e('0x20')](_0x593232,_0x373f8a,!![]);}catch(_0xcb207c){return BPromise[_0xe66e('0x21')](_0xcb207c);}return _0x593232['save']();};}function saveUpdates(_0x263772,_0x25a2da){return function(_0x62686f){if(_0x62686f){return _0x62686f[_0xe66e('0x22')](_0x263772)['then'](function(_0x461fde){return _0x461fde;});}return null;};}function removeEntity(_0x3251bc,_0x481859){return function(_0x55ba00){if(_0x55ba00){return _0x55ba00[_0xe66e('0x23')]()['then'](function(){_0x3251bc[_0xe66e('0x1a')](0xcc)[_0xe66e('0x1b')]();});}};}function handleEntityNotFound(_0x5bb8db,_0x203961){return function(_0x2683d4){if(!_0x2683d4){_0x5bb8db['sendStatus'](0x194);}return _0x2683d4;};}function handleError(_0x45b2c7,_0x188cb7){_0x188cb7=_0x188cb7||0x1f4;return function(_0x5949ee){logger['error'](_0x5949ee[_0xe66e('0x24')]);if(_0x5949ee[_0xe66e('0x25')]){delete _0x5949ee[_0xe66e('0x25')];}_0x45b2c7[_0xe66e('0x1a')](_0x188cb7)[_0xe66e('0x26')](_0x5949ee);};}exports[_0xe66e('0x27')]=function(_0x564477,_0x21d771){var _0x10ed38={},_0xb3bbb2={},_0x3a9f68={'count':0x0,'rows':[]};var _0x3108f9=_['map'](db[_0xe66e('0x28')][_0xe66e('0x29')],function(_0x1256fb){return{'name':_0x1256fb[_0xe66e('0x2a')],'type':_0x1256fb[_0xe66e('0x2b')][_0xe66e('0x2c')]};});_0xb3bbb2[_0xe66e('0x2d')]=_[_0xe66e('0x2e')](_0x3108f9,_0xe66e('0x25'));_0xb3bbb2[_0xe66e('0x2f')]=_[_0xe66e('0x30')](_0x564477[_0xe66e('0x2f')]);_0xb3bbb2['filters']=_[_0xe66e('0x31')](_0xb3bbb2[_0xe66e('0x2d')],_0xb3bbb2['query']);_0x10ed38[_0xe66e('0x32')]=_[_0xe66e('0x31')](_0xb3bbb2[_0xe66e('0x2d')],qs['fields'](_0x564477[_0xe66e('0x2f')][_0xe66e('0x33')]));_0x10ed38[_0xe66e('0x32')]=_0x10ed38[_0xe66e('0x32')][_0xe66e('0x34')]?_0x10ed38[_0xe66e('0x32')]:_0xb3bbb2['model'];if(!_0x564477[_0xe66e('0x2f')][_0xe66e('0x35')](_0xe66e('0x36'))){_0x10ed38[_0xe66e('0x1e')]=qs[_0xe66e('0x1e')](_0x564477[_0xe66e('0x2f')]['limit']);_0x10ed38[_0xe66e('0x1d')]=qs[_0xe66e('0x1d')](_0x564477['query'][_0xe66e('0x1d')]);}_0x10ed38[_0xe66e('0x37')]=qs['sort'](_0x564477[_0xe66e('0x2f')][_0xe66e('0x38')]);_0x10ed38[_0xe66e('0x39')]=qs[_0xe66e('0x3a')](_['pick'](_0x564477[_0xe66e('0x2f')],_0xb3bbb2[_0xe66e('0x3a')]),_0x3108f9);if(_0x564477[_0xe66e('0x2f')]['filter']){_0x10ed38[_0xe66e('0x39')]=_[_0xe66e('0x3b')](_0x10ed38[_0xe66e('0x39')],{'$or':_[_0xe66e('0x2e')](_0x3108f9,function(_0x2d5527){if(_0x2d5527[_0xe66e('0x2b')]!==_0xe66e('0x3c')){var _0x59ae19={};_0x59ae19[_0x2d5527[_0xe66e('0x25')]]={'$like':'%'+_0x564477[_0xe66e('0x2f')][_0xe66e('0x3d')]+'%'};return _0x59ae19;}})});}_0x10ed38=_[_0xe66e('0x3b')]({},_0x10ed38,_0x564477[_0xe66e('0x3e')]);var _0x3f961b={'where':_0x10ed38['where']};return db[_0xe66e('0x28')]['count'](_0x3f961b)['then'](function(_0x27b11f){_0x3a9f68[_0xe66e('0x1c')]=_0x27b11f;if(_0x564477[_0xe66e('0x2f')]['includeAll']){_0x10ed38[_0xe66e('0x3f')]=[{'all':!![]}];}return db[_0xe66e('0x28')][_0xe66e('0x40')](_0x10ed38);})['then'](function(_0x482e8c){_0x3a9f68[_0xe66e('0x41')]=_0x482e8c;return _0x3a9f68;})[_0xe66e('0x42')](respondWithFilteredResult(_0x21d771,_0x10ed38))[_0xe66e('0x43')](handleError(_0x21d771,null));};exports['show']=function(_0x23c0c4,_0x2010a3){var _0x3acfa8={'raw':!![],'where':{'id':_0x23c0c4[_0xe66e('0x44')]['id']}},_0x22d5d5={};_0x22d5d5['model']=_[_0xe66e('0x30')](db[_0xe66e('0x28')][_0xe66e('0x29')]);_0x22d5d5[_0xe66e('0x2f')]=_['keys'](_0x23c0c4['query']);_0x22d5d5[_0xe66e('0x3a')]=_[_0xe66e('0x31')](_0x22d5d5['model'],_0x22d5d5[_0xe66e('0x2f')]);_0x3acfa8['attributes']=_[_0xe66e('0x31')](_0x22d5d5[_0xe66e('0x2d')],qs[_0xe66e('0x33')](_0x23c0c4[_0xe66e('0x2f')][_0xe66e('0x33')]));_0x3acfa8[_0xe66e('0x32')]=_0x3acfa8[_0xe66e('0x32')]['length']?_0x3acfa8[_0xe66e('0x32')]:_0x22d5d5[_0xe66e('0x2d')];if(_0x23c0c4[_0xe66e('0x2f')][_0xe66e('0x45')]){_0x3acfa8[_0xe66e('0x3f')]=[{'all':!![]}];}_0x3acfa8=_[_0xe66e('0x3b')]({},_0x3acfa8,_0x23c0c4['options']);return db[_0xe66e('0x28')]['find'](_0x3acfa8)[_0xe66e('0x42')](handleEntityNotFound(_0x2010a3,null))[_0xe66e('0x42')](respondWithResult(_0x2010a3,null))['catch'](handleError(_0x2010a3,null));};exports['create']=function(_0x481681,_0x33c4f8){return db['SmsApplication'][_0xe66e('0x46')](_0x481681[_0xe66e('0x47')],{})[_0xe66e('0x42')](respondWithResult(_0x33c4f8,0xc9))[_0xe66e('0x43')](handleError(_0x33c4f8,null));};exports['update']=function(_0x2c0108,_0x5666d1){if(_0x2c0108[_0xe66e('0x47')]['id']){delete _0x2c0108[_0xe66e('0x47')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x2c0108[_0xe66e('0x44')]['id']}})['then'](handleEntityNotFound(_0x5666d1,null))[_0xe66e('0x42')](saveUpdates(_0x2c0108[_0xe66e('0x47')],null))[_0xe66e('0x42')](respondWithResult(_0x5666d1,null))[_0xe66e('0x43')](handleError(_0x5666d1,null));};exports[_0xe66e('0x23')]=function(_0x4b3617,_0x5c9869){return db[_0xe66e('0x28')][_0xe66e('0x48')]({'where':{'id':_0x4b3617['params']['id']}})[_0xe66e('0x42')](handleEntityNotFound(_0x5c9869,null))[_0xe66e('0x42')](removeEntity(_0x5c9869,null))[_0xe66e('0x43')](handleError(_0x5c9869,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 7dbdd87..32a2d6d 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 _0x93a8=['path','rimraf','exports','define','SmsApplication','sms_applications','utf8mb4','../../config/logger','moment','bluebird'];(function(_0x516533,_0x56f516){var _0x363a03=function(_0x923d6f){while(--_0x923d6f){_0x516533['push'](_0x516533['shift']());}};_0x363a03(++_0x56f516);}(_0x93a8,0x197));var _0x893a=function(_0x3c8a80,_0xd5429a){_0x3c8a80=_0x3c8a80-0x0;var _0x159427=_0x93a8[_0x3c8a80];return _0x159427;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x893a('0x0'))('api');var moment=require(_0x893a('0x1'));var BPromise=require(_0x893a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x893a('0x3'));var rimraf=require(_0x893a('0x4'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x893a('0x5')]=function(_0xa13108,_0x16ffa3){return _0xa13108[_0x893a('0x6')](_0x893a('0x7'),attributes,{'tableName':_0x893a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x893a('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe3bc=['bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe3bc,0x1c6));var _0xce3b=function(_0xc03fac,_0x5e8753){_0xc03fac=_0xc03fac-0x0;var _0xa1af02=_0xe3bc[_0xc03fac];return _0xa1af02;};'use strict';var _=require(_0xce3b('0x0'));var util=require(_0xce3b('0x1'));var logger=require(_0xce3b('0x2'))(_0xce3b('0x3'));var moment=require(_0xce3b('0x4'));var BPromise=require(_0xce3b('0x5'));var rp=require(_0xce3b('0x6'));var fs=require('fs');var path=require(_0xce3b('0x7'));var rimraf=require(_0xce3b('0x8'));var config=require(_0xce3b('0x9'));var attributes=require(_0xce3b('0xa'));module[_0xce3b('0xb')]=function(_0x5ed801,_0x2fcf08){return _0x5ed801[_0xce3b('0xc')](_0xce3b('0xd'),attributes,{'tableName':_0xce3b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xce3b('0xf'),'collate':_0xce3b('0x10')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 7d656ec..c2b34c5 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 _0xaeab=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message'];(function(_0x39ada1,_0x2fca19){var _0x43ff91=function(_0x15d5dc){while(--_0x15d5dc){_0x39ada1['push'](_0x39ada1['shift']());}};_0x43ff91(++_0x2fca19);}(_0xaeab,0x91));var _0xbaea=function(_0x4f8aea,_0x580bb5){_0x4f8aea=_0x4f8aea-0x0;var _0x1dfffe=_0xaeab[_0x4f8aea];return _0x1dfffe;};'use strict';var _=require(_0xbaea('0x0'));var util=require('util');var moment=require(_0xbaea('0x1'));var BPromise=require('bluebird');var rs=require(_0xbaea('0x2'));var fs=require('fs');var Redis=require(_0xbaea('0x3'));var db=require(_0xbaea('0x4'))['db'];var utils=require(_0xbaea('0x5'));var logger=require(_0xbaea('0x6'))(_0xbaea('0x7'));var config=require(_0xbaea('0x8'));var jayson=require(_0xbaea('0x9'));var client=jayson[_0xbaea('0xa')][_0xbaea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bfed3,_0x3e2d0b,_0x267afb){return new BPromise(function(_0x202d96,_0x2136d5){return client[_0xbaea('0xc')](_0x5bfed3,_0x267afb)[_0xbaea('0xd')](function(_0x1439b0){logger[_0xbaea('0xe')]('SmsApplication,\x20%s,\x20%s',_0x3e2d0b,_0xbaea('0xf'));logger[_0xbaea('0x10')](_0xbaea('0x11'),_0x3e2d0b,_0xbaea('0xf'),JSON[_0xbaea('0x12')](_0x1439b0));if(_0x1439b0['error']){if(_0x1439b0[_0xbaea('0x13')][_0xbaea('0x14')]===0x1f4){logger['error'](_0xbaea('0x15'),_0x3e2d0b,_0x1439b0[_0xbaea('0x13')][_0xbaea('0x16')]);return _0x2136d5(_0x1439b0[_0xbaea('0x13')][_0xbaea('0x16')]);}logger[_0xbaea('0x13')]('SmsApplication,\x20%s,\x20%s',_0x3e2d0b,_0x1439b0['error'][_0xbaea('0x16')]);return _0x202d96(_0x1439b0[_0xbaea('0x13')][_0xbaea('0x16')]);}else{logger[_0xbaea('0xe')](_0xbaea('0x15'),_0x3e2d0b,'request\x20sent');_0x202d96(_0x1439b0['result'][_0xbaea('0x16')]);}})[_0xbaea('0x17')](function(_0x550e66){logger[_0xbaea('0x13')](_0xbaea('0x15'),_0x3e2d0b,_0x550e66);_0x2136d5(_0x550e66);});});} \ No newline at end of file +var _0xe35c=['request','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe35c,0x146));var _0xce35=function(_0x3d6d5e,_0x2cf163){_0x3d6d5e=_0x3d6d5e-0x0;var _0x2a7731=_0xe35c[_0x3d6d5e];return _0x2a7731;};'use strict';var _=require(_0xce35('0x0'));var util=require(_0xce35('0x1'));var moment=require(_0xce35('0x2'));var BPromise=require(_0xce35('0x3'));var rs=require(_0xce35('0x4'));var fs=require('fs');var Redis=require(_0xce35('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce35('0x6'))('rpc');var config=require(_0xce35('0x7'));var jayson=require(_0xce35('0x8'));var client=jayson[_0xce35('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x270b81,_0x2df0d0,_0x2b4a82){return new BPromise(function(_0x74ae5e,_0x55e7f0){return client[_0xce35('0xa')](_0x270b81,_0x2b4a82)['then'](function(_0x549f60){logger[_0xce35('0xb')]('SmsApplication,\x20%s,\x20%s',_0x2df0d0,'request\x20sent');logger[_0xce35('0xc')](_0xce35('0xd'),_0x2df0d0,_0xce35('0xe'),JSON[_0xce35('0xf')](_0x549f60));if(_0x549f60[_0xce35('0x10')]){if(_0x549f60['error']['code']===0x1f4){logger[_0xce35('0x10')](_0xce35('0x11'),_0x2df0d0,_0x549f60[_0xce35('0x10')][_0xce35('0x12')]);return _0x55e7f0(_0x549f60[_0xce35('0x10')]['message']);}logger['error'](_0xce35('0x11'),_0x2df0d0,_0x549f60[_0xce35('0x10')]['message']);return _0x74ae5e(_0x549f60[_0xce35('0x10')][_0xce35('0x12')]);}else{logger[_0xce35('0xb')](_0xce35('0x11'),_0x2df0d0,_0xce35('0xe'));_0x74ae5e(_0x549f60[_0xce35('0x13')][_0xce35('0x12')]);}})[_0xce35('0x14')](function(_0x4388fd){logger[_0xce35('0x10')](_0xce35('0x11'),_0x2df0d0,_0x4388fd);_0x55e7f0(_0x4388fd);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6f50ef2..cad8b39 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 _0x73e2=['sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','smsinteraction:destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x73e2,0xc4));var _0x273e=function(_0x59e970,_0x3e4228){_0x59e970=_0x59e970-0x0;var _0x221fd1=_0x73e2[_0x59e970];return _0x221fd1;};'use strict';var multer=require(_0x273e('0x0'));var util=require('util');var path=require(_0x273e('0x1'));var timeout=require(_0x273e('0x2'));var express=require('express');var router=express[_0x273e('0x3')]();var auth=require(_0x273e('0x4'));var interaction=require(_0x273e('0x5'));var config=require(_0x273e('0x6'));var controller=require(_0x273e('0x7'));router['get']('/',auth[_0x273e('0x8')](),controller[_0x273e('0x9')]);router[_0x273e('0xa')](_0x273e('0xb'),auth[_0x273e('0x8')](),controller['describe']);router['get'](_0x273e('0xc'),auth[_0x273e('0x8')](),controller[_0x273e('0xd')]);router[_0x273e('0xa')](_0x273e('0xe'),auth['isAuthenticated'](),controller[_0x273e('0xf')]);router['get']('/:id/download',auth[_0x273e('0x8')](),controller[_0x273e('0x10')]);router[_0x273e('0x11')]('/',auth['isAuthenticated'](),controller[_0x273e('0x12')]);router[_0x273e('0x11')]('/:id/messages',auth[_0x273e('0x8')](),controller[_0x273e('0x13')]);router[_0x273e('0x11')](_0x273e('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x273e('0x15'),_0x273e('0x16')),controller[_0x273e('0x17')]);router[_0x273e('0x18')]('/:id',auth[_0x273e('0x8')](),interaction[_0x273e('0x19')]('sms',_0x273e('0x1a')),controller[_0x273e('0x1b')]);router[_0x273e('0x1c')](_0x273e('0xc'),auth['isAuthenticated'](),interaction[_0x273e('0x19')]('sms',_0x273e('0x1d')),controller['destroy']);router[_0x273e('0x1c')]('/:id/tags',auth[_0x273e('0x8')](),controller['removeTags']);module[_0x273e('0x1e')]=router; \ No newline at end of file +var _0x6de3=['/describe','describe','show','/:id/messages','getMessages','post','create','addMessage','tracked','sms','addTags','put','/:id','update','delete','smsinteraction:destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2ecf03,_0x2adccf){var _0x4418ab=function(_0x201f87){while(--_0x201f87){_0x2ecf03['push'](_0x2ecf03['shift']());}};_0x4418ab(++_0x2adccf);}(_0x6de3,0x1b7));var _0x36de=function(_0x856835,_0x456eb0){_0x856835=_0x856835-0x0;var _0x10bd81=_0x6de3[_0x856835];return _0x10bd81;};'use strict';var multer=require(_0x36de('0x0'));var util=require(_0x36de('0x1'));var path=require('path');var timeout=require(_0x36de('0x2'));var express=require(_0x36de('0x3'));var router=express[_0x36de('0x4')]();var auth=require(_0x36de('0x5'));var interaction=require(_0x36de('0x6'));var config=require(_0x36de('0x7'));var controller=require('./smsInteraction.controller');router[_0x36de('0x8')]('/',auth[_0x36de('0x9')](),controller[_0x36de('0xa')]);router[_0x36de('0x8')](_0x36de('0xb'),auth[_0x36de('0x9')](),controller[_0x36de('0xc')]);router['get']('/:id',auth[_0x36de('0x9')](),controller[_0x36de('0xd')]);router[_0x36de('0x8')](_0x36de('0xe'),auth[_0x36de('0x9')](),controller[_0x36de('0xf')]);router[_0x36de('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x36de('0x10')]('/',auth['isAuthenticated'](),controller[_0x36de('0x11')]);router[_0x36de('0x10')](_0x36de('0xe'),auth[_0x36de('0x9')](),controller[_0x36de('0x12')]);router[_0x36de('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x36de('0x13')](_0x36de('0x14'),'smsinteraction:addtags'),controller[_0x36de('0x15')]);router[_0x36de('0x16')](_0x36de('0x17'),auth[_0x36de('0x9')](),interaction[_0x36de('0x13')](_0x36de('0x14'),'smsinteraction:update'),controller[_0x36de('0x18')]);router[_0x36de('0x19')](_0x36de('0x17'),auth['isAuthenticated'](),interaction[_0x36de('0x13')](_0x36de('0x14'),_0x36de('0x1a')),controller['destroy']);router[_0x36de('0x19')](_0x36de('0x1b'),auth[_0x36de('0x9')](),controller[_0x36de('0x1c')]);module[_0x36de('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f1b2691..c098daa 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 _0x1746=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x25d916,_0x163b46){var _0x2a0eca=function(_0x49d241){while(--_0x49d241){_0x25d916['push'](_0x25d916['shift']());}};_0x2a0eca(++_0x163b46);}(_0x1746,0xfa));var _0x6174=function(_0x7ad5af,_0x5f0c24){_0x7ad5af=_0x7ad5af-0x0;var _0x2cece9=_0x1746[_0x7ad5af];return _0x2cece9;};'use strict';var Sequelize=require(_0x6174('0x0'));var moment=require(_0x6174('0x1'));module[_0x6174('0x2')]={'closed':{'type':Sequelize[_0x6174('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6174('0x4')]},'disposition':{'type':Sequelize[_0x6174('0x5')]},'secondDisposition':{'type':Sequelize[_0x6174('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6174('0x5')]},'phone':{'type':Sequelize[_0x6174('0x5')]},'read1stAt':{'type':Sequelize[_0x6174('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6174('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6174('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x6174('0x6')]('in',_0x6174('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x7372=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7372,0x173));var _0x2737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7372[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2737('0x0'));var moment=require(_0x2737('0x1'));module['exports']={'closed':{'type':Sequelize[_0x2737('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2737('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2737('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2737('0x4')]},'note':{'type':Sequelize[_0x2737('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x2737('0x5')]('in',_0x2737('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2737('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2737('0x5')]('in',_0x2737('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 1c50de3..172f5b1 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 _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','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','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);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 updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\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[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file +var _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','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','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);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 updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\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[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 187be6e..5baf5fb 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 _0xc818=['map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x25589e,_0x1fdf62){var _0x150dd6=function(_0x353de9){while(--_0x353de9){_0x25589e['push'](_0x25589e['shift']());}};_0x150dd6(++_0x1fdf62);}(_0xc818,0x1e3));var _0x8c81=function(_0x560dd9,_0x266b2e){_0x560dd9=_0x560dd9-0x0;var _0x4a9d69=_0xc818[_0x560dd9];return _0x4a9d69;};'use strict';var EventEmitter=require(_0x8c81('0x0'));var SmsInteraction=require(_0x8c81('0x1'))['db'][_0x8c81('0x2')];var SmsMessage=require(_0x8c81('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8c81('0x3')](0x0);var events={'afterCreate':_0x8c81('0x4'),'afterUpdate':_0x8c81('0x5'),'afterDestroy':_0x8c81('0x6')};function emitEvent(_0x1a61ab){return function(_0xb97ac,_0x377b23,_0x4a6e65){_0xb97ac[_0x8c81('0x7')]({'attributes':['id'],'raw':!![]})[_0x8c81('0x8')](function(_0x32cf31){_0xb97ac[_0x8c81('0x9')]('Users',_0x32cf31[_0x8c81('0xa')](function(_0x448af6){return{'id':_0x448af6['id']};}));return SmsMessage[_0x8c81('0xb')]({'where':{'SmsInteractionId':_0xb97ac['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8c81('0x8')](function(_0x1b4523){_0xb97ac[_0x8c81('0x9')](_0x8c81('0xc'),_0x1b4523['length']);SmsInteractionEvents[_0x8c81('0xd')](_0x1a61ab+':'+_0xb97ac['id'],_0xb97ac);SmsInteractionEvents[_0x8c81('0xd')](_0x1a61ab,_0xb97ac);_0x4a6e65(null);})[_0x8c81('0xe')](_0x4a6e65(null));};}for(var e in events){if(events[_0x8c81('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x8c81('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xb458=['findAll','length','emit','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0xb458,0x103));var _0x8b45=function(_0x289ce3,_0x7b336){_0x289ce3=_0x289ce3-0x0;var _0x3c3f56=_0xb458[_0x289ce3];return _0x3c3f56;};'use strict';var EventEmitter=require(_0x8b45('0x0'));var SmsInteraction=require(_0x8b45('0x1'))['db'][_0x8b45('0x2')];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8b45('0x3')](0x0);var events={'afterCreate':_0x8b45('0x4'),'afterUpdate':_0x8b45('0x5'),'afterDestroy':_0x8b45('0x6')};function emitEvent(_0x5d51e4){return function(_0x333bc7,_0x59cce3,_0x5cc2d5){_0x333bc7[_0x8b45('0x7')]({'attributes':['id'],'raw':!![]})[_0x8b45('0x8')](function(_0x2daa9a){_0x333bc7[_0x8b45('0x9')](_0x8b45('0xa'),_0x2daa9a['map'](function(_0xa54725){return{'id':_0xa54725['id']};}));return SmsMessage[_0x8b45('0xb')]({'where':{'SmsInteractionId':_0x333bc7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b45('0x8')](function(_0x2bc809){_0x333bc7[_0x8b45('0x9')]('unreadMessages',_0x2bc809[_0x8b45('0xc')]);SmsInteractionEvents[_0x8b45('0xd')](_0x5d51e4+':'+_0x333bc7['id'],_0x333bc7);SmsInteractionEvents['emit'](_0x5d51e4,_0x333bc7);_0x5cc2d5(null);})['catch'](_0x5cc2d5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x8b45('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 093ab2f..10b10eb 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 _0x7850=['lodash','../../config/logger','api','bluebird','rimraf','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4ab77,_0x5980c4){var _0x2edcb9=function(_0x4b536a){while(--_0x4b536a){_0x4ab77['push'](_0x4ab77['shift']());}};_0x2edcb9(++_0x5980c4);}(_0x7850,0x10a));var _0x0785=function(_0x5759d2,_0x231744){_0x5759d2=_0x5759d2-0x0;var _0x4a41bf=_0x7850[_0x5759d2];return _0x4a41bf;};'use strict';var _=require(_0x0785('0x0'));var util=require('util');var logger=require(_0x0785('0x1'))(_0x0785('0x2'));var moment=require('moment');var BPromise=require(_0x0785('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0785('0x4'));var config=require('../../config/environment');var attributes=require(_0x0785('0x5'));module['exports']=function(_0xc1cc7d,_0xf56036){return _0xc1cc7d[_0x0785('0x6')](_0x0785('0x7'),attributes,{'tableName':_0x0785('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x340a64,_0x342a13,_0x1b3517){if(_0x340a64[_0x0785('0x9')](_0x0785('0xa'))){_0x340a64[_0x0785('0xb')]=moment()[_0x0785('0xc')](_0x0785('0xd'));}_0x1b3517(null,_0x340a64);}}});}; \ No newline at end of file +var _0xb205=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./smsInteraction.attributes','define','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5d8e8a,_0x19b690){var _0x13c1bb=function(_0x11025b){while(--_0x11025b){_0x5d8e8a['push'](_0x5d8e8a['shift']());}};_0x13c1bb(++_0x19b690);}(_0xb205,0xf0));var _0x5b20=function(_0xa314b9,_0xbe404f){_0xa314b9=_0xa314b9-0x0;var _0x4627b9=_0xb205[_0xa314b9];return _0x4627b9;};'use strict';var _=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var logger=require(_0x5b20('0x2'))(_0x5b20('0x3'));var moment=require(_0x5b20('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b20('0x5'));var rimraf=require('rimraf');var config=require(_0x5b20('0x6'));var attributes=require(_0x5b20('0x7'));module['exports']=function(_0x3206cd,_0x29d926){return _0x3206cd[_0x5b20('0x8')]('SmsInteraction',attributes,{'tableName':_0x5b20('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13fb27,_0x528c54,_0x4f19b2){if(_0x13fb27[_0x5b20('0xa')](_0x5b20('0xb'))){_0x13fb27[_0x5b20('0xc')]=moment()[_0x5b20('0xd')](_0x5b20('0xe'));}_0x4f19b2(null,_0x13fb27);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 916c31b..c727e75 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 _0xece1=['AddTagsToSmsInteraction','find','ids','spread','AddTags','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','request','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','SmsInteraction,\x20%s,\x20%s','message','info','result','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','UpdateSmsInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xece1,0xfc));var _0x1ece=function(_0x1a9d4b,_0x199e92){_0x1a9d4b=_0x1a9d4b-0x0;var _0x1501a9=_0xece1[_0x1a9d4b];return _0x1501a9;};'use strict';var _=require(_0x1ece('0x0'));var util=require(_0x1ece('0x1'));var moment=require(_0x1ece('0x2'));var BPromise=require(_0x1ece('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ece('0x4'));var db=require(_0x1ece('0x5'))['db'];var utils=require(_0x1ece('0x6'));var logger=require(_0x1ece('0x7'))(_0x1ece('0x8'));var config=require(_0x1ece('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1ece('0xa')]({'port':0x232a});config['redis']=_[_0x1ece('0xb')](config[_0x1ece('0xc')],{'host':_0x1ece('0xd'),'port':0x18eb});var socket=require(_0x1ece('0xe'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x110f87,_0x2e469c,_0x2aab36){return new BPromise(function(_0x276968,_0x3badd){return client[_0x1ece('0xf')](_0x110f87,_0x2aab36)[_0x1ece('0x10')](function(_0x8fa455){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x2e469c,_0x1ece('0x11'));logger[_0x1ece('0x12')](_0x1ece('0x13'),_0x2e469c,_0x1ece('0x11'),JSON['stringify'](_0x8fa455));if(_0x8fa455[_0x1ece('0x14')]){if(_0x8fa455['error']['code']===0x1f4){logger[_0x1ece('0x14')](_0x1ece('0x15'),_0x2e469c,_0x8fa455[_0x1ece('0x14')][_0x1ece('0x16')]);return _0x3badd(_0x8fa455[_0x1ece('0x14')][_0x1ece('0x16')]);}logger[_0x1ece('0x14')](_0x1ece('0x15'),_0x2e469c,_0x8fa455[_0x1ece('0x14')][_0x1ece('0x16')]);return _0x276968(_0x8fa455[_0x1ece('0x14')][_0x1ece('0x16')]);}else{logger[_0x1ece('0x17')](_0x1ece('0x15'),_0x2e469c,'request\x20sent');_0x276968(_0x8fa455[_0x1ece('0x18')][_0x1ece('0x16')]);}})[_0x1ece('0x19')](function(_0x109d97){logger[_0x1ece('0x14')](_0x1ece('0x15'),_0x2e469c,_0x109d97);_0x3badd(_0x109d97);});});}exports['UpdateSmsInteraction']=function(_0x2570f1){var _0xe73bb3=this;return new Promise(function(_0x5728de,_0x57212f){return db[_0x1ece('0x1a')][_0x1ece('0x1b')](_0x2570f1[_0x1ece('0x1c')],{'raw':_0x2570f1[_0x1ece('0x1d')]?_0x2570f1[_0x1ece('0x1d')][_0x1ece('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2570f1[_0x1ece('0x1d')]?_0x2570f1[_0x1ece('0x1d')][_0x1ece('0x1f')]||null:null,'attributes':_0x2570f1[_0x1ece('0x1d')]?_0x2570f1[_0x1ece('0x1d')][_0x1ece('0x20')]||null:null,'limit':_0x2570f1[_0x1ece('0x1d')]?_0x2570f1[_0x1ece('0x1d')][_0x1ece('0x21')]||null:null})[_0x1ece('0x10')](function(_0x4f3fbe){logger[_0x1ece('0x17')](_0x1ece('0x22'),_0x2570f1);logger[_0x1ece('0x12')](_0x1ece('0x22'),_0x2570f1,JSON['stringify'](_0x4f3fbe));_0x5728de(_0x4f3fbe);})[_0x1ece('0x19')](function(_0x58f8f5){logger[_0x1ece('0x14')](_0x1ece('0x22'),_0x58f8f5[_0x1ece('0x16')],_0x2570f1);_0x57212f(_0xe73bb3['error'](0x1f4,_0x58f8f5['message']));});});};exports[_0x1ece('0x23')]=function(_0x52d86d){return new Promise(function(_0x5ca3e6,_0x1908de){return db[_0x1ece('0x1a')][_0x1ece('0x24')]({'where':_0x52d86d[_0x1ece('0x1d')]?_0x52d86d[_0x1ece('0x1d')]['where']||null:null})[_0x1ece('0x10')](function(_0x2bd8ea){if(_0x2bd8ea){return _0x2bd8ea['addTags'](_0x52d86d[_0x1ece('0x1c')][_0x1ece('0x25')],_['omit'](_0x52d86d[_0x1ece('0x1c')],[_0x1ece('0x25'),'id'])||{});}})[_0x1ece('0x26')](function(_0x4a179a){logger[_0x1ece('0x17')]('AddTags',_0x52d86d);logger[_0x1ece('0x12')](_0x1ece('0x27'),_0x52d86d,JSON[_0x1ece('0x28')](_0x4a179a));_0x5ca3e6(_0x4a179a);})[_0x1ece('0x19')](function(_0x59c5d1){logger[_0x1ece('0x14')]('AddTags',_0x59c5d1[_0x1ece('0x16')],_0x52d86d);_0x1908de(_this[_0x1ece('0x14')](0x1f4,_0x59c5d1['message']));});});}; \ No newline at end of file +var _0x8ab7=['message','result','catch','UpdateSmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction','find','then','body','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x8ab7,0x6b));var _0x78ab=function(_0x1a111a,_0x3e581f){_0x1a111a=_0x1a111a-0x0;var _0x37c1d2=_0x8ab7[_0x1a111a];return _0x37c1d2;};'use strict';var _=require(_0x78ab('0x0'));var util=require(_0x78ab('0x1'));var moment=require(_0x78ab('0x2'));var BPromise=require('bluebird');var rs=require(_0x78ab('0x3'));var fs=require('fs');var Redis=require(_0x78ab('0x4'));var db=require(_0x78ab('0x5'))['db'];var utils=require(_0x78ab('0x6'));var logger=require('../../config/logger')(_0x78ab('0x7'));var config=require(_0x78ab('0x8'));var jayson=require(_0x78ab('0x9'));var client=jayson[_0x78ab('0xa')][_0x78ab('0xb')]({'port':0x232a});config[_0x78ab('0xc')]=_[_0x78ab('0xd')](config[_0x78ab('0xc')],{'host':_0x78ab('0xe'),'port':0x18eb});var socket=require(_0x78ab('0xf'))(new Redis(config['redis']));require(_0x78ab('0x10'))[_0x78ab('0x11')](socket);function respondWithRpcPromise(_0x157555,_0x582746,_0x2ece1d){return new BPromise(function(_0x571a03,_0x10c8a7){return client['request'](_0x157555,_0x2ece1d)['then'](function(_0x385df3){logger[_0x78ab('0x12')](_0x78ab('0x13'),_0x582746,_0x78ab('0x14'));logger[_0x78ab('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x582746,_0x78ab('0x14'),JSON[_0x78ab('0x16')](_0x385df3));if(_0x385df3[_0x78ab('0x17')]){if(_0x385df3['error'][_0x78ab('0x18')]===0x1f4){logger['error'](_0x78ab('0x13'),_0x582746,_0x385df3['error'][_0x78ab('0x19')]);return _0x10c8a7(_0x385df3[_0x78ab('0x17')][_0x78ab('0x19')]);}logger[_0x78ab('0x17')](_0x78ab('0x13'),_0x582746,_0x385df3['error']['message']);return _0x571a03(_0x385df3[_0x78ab('0x17')][_0x78ab('0x19')]);}else{logger['info'](_0x78ab('0x13'),_0x582746,_0x78ab('0x14'));_0x571a03(_0x385df3[_0x78ab('0x1a')][_0x78ab('0x19')]);}})[_0x78ab('0x1b')](function(_0x16a219){logger[_0x78ab('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x582746,_0x16a219);_0x10c8a7(_0x16a219);});});}exports[_0x78ab('0x1c')]=function(_0x5df0cf){var _0xfb0efc=this;return new Promise(function(_0x5e7eb5,_0x4d5ddc){return db['SmsInteraction'][_0x78ab('0x1d')](_0x5df0cf['body'],{'raw':_0x5df0cf['options']?_0x5df0cf[_0x78ab('0x1e')][_0x78ab('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5df0cf[_0x78ab('0x1e')]?_0x5df0cf[_0x78ab('0x1e')][_0x78ab('0x20')]||null:null,'attributes':_0x5df0cf[_0x78ab('0x1e')]?_0x5df0cf[_0x78ab('0x1e')][_0x78ab('0x21')]||null:null,'limit':_0x5df0cf['options']?_0x5df0cf['options'][_0x78ab('0x22')]||null:null})['then'](function(_0x131f6d){logger[_0x78ab('0x12')](_0x78ab('0x1c'),_0x5df0cf);logger[_0x78ab('0x15')]('UpdateSmsInteraction',_0x5df0cf,JSON[_0x78ab('0x16')](_0x131f6d));_0x5e7eb5(_0x131f6d);})[_0x78ab('0x1b')](function(_0x17a4a4){logger['error'](_0x78ab('0x1c'),_0x17a4a4['message'],_0x5df0cf);_0x4d5ddc(_0xfb0efc[_0x78ab('0x17')](0x1f4,_0x17a4a4[_0x78ab('0x19')]));});});};exports[_0x78ab('0x23')]=function(_0xf3c2a7){return new Promise(function(_0x49b9ed,_0x1c71f1){return db[_0x78ab('0x24')][_0x78ab('0x25')]({'where':_0xf3c2a7[_0x78ab('0x1e')]?_0xf3c2a7[_0x78ab('0x1e')]['where']||null:null})[_0x78ab('0x26')](function(_0x20c962){if(_0x20c962){return _0x20c962['addTags'](_0xf3c2a7[_0x78ab('0x27')][_0x78ab('0x28')],_[_0x78ab('0x29')](_0xf3c2a7[_0x78ab('0x27')],[_0x78ab('0x28'),'id'])||{});}})[_0x78ab('0x2a')](function(_0x54836f){logger[_0x78ab('0x12')]('AddTags',_0xf3c2a7);logger[_0x78ab('0x15')](_0x78ab('0x2b'),_0xf3c2a7,JSON[_0x78ab('0x16')](_0x54836f));_0x49b9ed(_0x54836f);})['catch'](function(_0x1332cd){logger[_0x78ab('0x17')](_0x78ab('0x2b'),_0x1332cd[_0x78ab('0x19')],_0xf3c2a7);_0x1c71f1(_this[_0x78ab('0x17')](0x1f4,_0x1332cd['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index ae06d84..e744f9e 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(_0x22d7bb,_0x4c158e){var _0x40a737=function(_0xd85bab){while(--_0xd85bab){_0x22d7bb['push'](_0x22d7bb['shift']());}};_0x40a737(++_0x4c158e);}(_0xb10b,0x12a));var _0xbb10=function(_0x42f6b1,_0x560c04){_0x42f6b1=_0x42f6b1-0x0;var _0x39b69f=_0xb10b[_0x42f6b1];return _0x39b69f;};'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 _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x21c1d2,_0x37f70c){var _0x150ce7=function(_0x34aab6){while(--_0x34aab6){_0x21c1d2['push'](_0x21c1d2['shift']());}};_0x150ce7(++_0x37f70c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 8ad0181..f961f0c 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 _0x4c53=['/:id','post','smsmessage:create','create','/:id/status','/:id/accept','accept','put','/:id/reject','reject','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated','get'];(function(_0x39d031,_0x200b06){var _0x3724af=function(_0x30bff1){while(--_0x30bff1){_0x39d031['push'](_0x39d031['shift']());}};_0x3724af(++_0x200b06);}(_0x4c53,0x1ef));var _0x34c5=function(_0x3dd8b7,_0x5646c5){_0x3dd8b7=_0x3dd8b7-0x0;var _0x5145a9=_0x4c53[_0x3dd8b7];return _0x5145a9;};'use strict';var multer=require(_0x34c5('0x0'));var util=require(_0x34c5('0x1'));var path=require(_0x34c5('0x2'));var timeout=require(_0x34c5('0x3'));var express=require(_0x34c5('0x4'));var router=express[_0x34c5('0x5')]();var auth=require(_0x34c5('0x6'));var interaction=require(_0x34c5('0x7'));var config=require('../../config/environment');var controller=require(_0x34c5('0x8'));router['get']('/',auth[_0x34c5('0x9')](),controller['index']);router[_0x34c5('0xa')]('/describe',auth[_0x34c5('0x9')](),controller['describe']);router['get'](_0x34c5('0xb'),auth[_0x34c5('0x9')](),controller['show']);router[_0x34c5('0xc')]('/',auth[_0x34c5('0x9')](),interaction['tracked']('sms',_0x34c5('0xd')),controller[_0x34c5('0xe')]);router[_0x34c5('0xc')](_0x34c5('0xf'),controller['status']);router['put'](_0x34c5('0xb'),auth['isAuthenticated'](),controller['update']);router['put'](_0x34c5('0x10'),auth[_0x34c5('0x9')](),controller[_0x34c5('0x11')]);router[_0x34c5('0x12')](_0x34c5('0x13'),auth[_0x34c5('0x9')](),controller[_0x34c5('0x14')]);router['delete'](_0x34c5('0xb'),auth[_0x34c5('0x9')](),controller[_0x34c5('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa0db=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','sms','/:id/status','status','put','update','accept','/:id/reject','delete','destroy','exports','path'];(function(_0x501066,_0x1a9b4b){var _0x4e9fc8=function(_0x2b90a3){while(--_0x2b90a3){_0x501066['push'](_0x501066['shift']());}};_0x4e9fc8(++_0x1a9b4b);}(_0xa0db,0x185));var _0xba0d=function(_0x2c537e,_0x1e24f6){_0x2c537e=_0x2c537e-0x0;var _0x32247b=_0xa0db[_0x2c537e];return _0x32247b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xba0d('0x0'));var timeout=require(_0xba0d('0x1'));var express=require(_0xba0d('0x2'));var router=express[_0xba0d('0x3')]();var auth=require(_0xba0d('0x4'));var interaction=require(_0xba0d('0x5'));var config=require(_0xba0d('0x6'));var controller=require(_0xba0d('0x7'));router[_0xba0d('0x8')]('/',auth[_0xba0d('0x9')](),controller[_0xba0d('0xa')]);router[_0xba0d('0x8')]('/describe',auth[_0xba0d('0x9')](),controller[_0xba0d('0xb')]);router[_0xba0d('0x8')](_0xba0d('0xc'),auth['isAuthenticated'](),controller[_0xba0d('0xd')]);router[_0xba0d('0xe')]('/',auth['isAuthenticated'](),interaction[_0xba0d('0xf')](_0xba0d('0x10'),'smsmessage:create'),controller['create']);router['post'](_0xba0d('0x11'),controller[_0xba0d('0x12')]);router[_0xba0d('0x13')](_0xba0d('0xc'),auth[_0xba0d('0x9')](),controller[_0xba0d('0x14')]);router[_0xba0d('0x13')]('/:id/accept',auth[_0xba0d('0x9')](),controller[_0xba0d('0x15')]);router['put'](_0xba0d('0x16'),auth[_0xba0d('0x9')](),controller['reject']);router[_0xba0d('0x17')](_0xba0d('0xc'),auth[_0xba0d('0x9')](),controller[_0xba0d('0x18')]);module[_0xba0d('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index a323907..69dd1fa 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 _0xb4fd=['ENUM','out','STRING','DATE','BOOLEAN','sequelize','TEXT','medium'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0xb4fd,0x85));var _0xdb4f=function(_0x143335,_0x370b22){_0x143335=_0x143335-0x0;var _0x196fc4=_0xb4fd[_0x143335];return _0x196fc4;};'use strict';var Sequelize=require(_0xdb4f('0x0'));module['exports']={'body':{'type':Sequelize[_0xdb4f('0x1')](_0xdb4f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdb4f('0x3')]('in',_0xdb4f('0x4')),'defaultValue':_0xdb4f('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdb4f('0x5')](0xbe)},'phone':{'type':Sequelize[_0xdb4f('0x5')]},'readAt':{'type':Sequelize[_0xdb4f('0x6')]},'secret':{'type':Sequelize[_0xdb4f('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdb4f('0x5')]},'providerResponse':{'type':Sequelize[_0xdb4f('0x1')]}}; \ No newline at end of file +var _0x94d1=['ENUM','out','STRING','DATE','TEXT','exports'];(function(_0x1caf99,_0x553050){var _0x33f759=function(_0x2ae690){while(--_0x2ae690){_0x1caf99['push'](_0x1caf99['shift']());}};_0x33f759(++_0x553050);}(_0x94d1,0xb9));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x194d('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x194d('0x1')]('in',_0x194d('0x2')),'defaultValue':_0x194d('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x194d('0x3')](0xbe)},'phone':{'type':Sequelize[_0x194d('0x3')]},'readAt':{'type':Sequelize[_0x194d('0x4')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x194d('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 64d5eef..2c06409 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 _0x742f=['EventManager','acceptmessage','SmsInteractionId','null','RejectMessage','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','groupName','DELIVERED','html-pdf','rimraf','zip-dir','request-promise','bluebird','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/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','sendStatus','stack','name','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','type','options','includeAll','rows','show','params','keys','merge','find','body','update','destroy','describe','sms-interactions','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','get','SmsInteraction','isNil','interaction','role','AcceptMessage','acceptMessage','manual','interface','format','channel','event'];(function(_0x445b71,_0x4a4bc5){var _0x816452=function(_0xa986ea){while(--_0xa986ea){_0x445b71['push'](_0x445b71['shift']());}};_0x816452(++_0x4a4bc5);}(_0x742f,0x125));var _0xf742=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x742f[_0x2f1762];return _0x8ab21;};'use strict';var pdf=require(_0xf742('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf742('0x1'));var zipdir=require(_0xf742('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf742('0x3'));var moment=require('moment');var BPromise=require(_0xf742('0x4'));var Mustache=require('mustache');var util=require(_0xf742('0x5'));var path=require(_0xf742('0x6'));var sox=require(_0xf742('0x7'));var csv=require('to-csv');var ejs=require(_0xf742('0x8'));var fs=require('fs');var _=require(_0xf742('0x9'));var squel=require(_0xf742('0xa'));var crypto=require(_0xf742('0xb'));var jsforce=require(_0xf742('0xc'));var deskjs=require(_0xf742('0xd'));var toCsv=require(_0xf742('0xe'));var querystring=require(_0xf742('0xf'));var Papa=require(_0xf742('0x10'));var Redis=require(_0xf742('0x11'));var authService=require(_0xf742('0x12'));var qs=require(_0xf742('0x13'));var as=require(_0xf742('0x14'));var hardwareService=require(_0xf742('0x15'));var logger=require(_0xf742('0x16'))('api');var utils=require(_0xf742('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf742('0x18'));var db=require(_0xf742('0x19'))['db'];config[_0xf742('0x1a')]=_[_0xf742('0x1b')](config['redis'],{'host':_0xf742('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf742('0x1a')]));require('./smsMessage.socket')[_0xf742('0x1d')](socket);var jayson=require(_0xf742('0x1e'));var client=jayson[_0xf742('0x1f')][_0xf742('0x20')]({'port':0x232c});var client9002=jayson[_0xf742('0x1f')][_0xf742('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x51e173,_0x37f2b3,_0x1693b3,_0x339c27){return new BPromise(function(_0x31e3b7,_0x4d41f3){var _0x1625b8=_0x339c27||client;return _0x1625b8[_0xf742('0x21')](_0x51e173,_0x1693b3)[_0xf742('0x22')](function(_0x361d48){logger[_0xf742('0x23')](_0xf742('0x24'),_0x37f2b3,_0xf742('0x25'));logger[_0xf742('0x26')](_0xf742('0x27'),_0x37f2b3,_0xf742('0x25'),JSON[_0xf742('0x28')](_0x361d48));if(_0x361d48[_0xf742('0x29')]){if(_0x361d48[_0xf742('0x29')][_0xf742('0x2a')]===0x1f4){logger['error'](_0xf742('0x24'),_0x37f2b3,_0x361d48[_0xf742('0x29')][_0xf742('0x2b')]);return _0x4d41f3(_0x361d48[_0xf742('0x29')][_0xf742('0x2b')]);}logger[_0xf742('0x29')](_0xf742('0x24'),_0x37f2b3,_0x361d48[_0xf742('0x29')]['message']);return _0x31e3b7(_0x361d48['error'][_0xf742('0x2b')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x37f2b3,_0xf742('0x25'));_0x31e3b7(_0x361d48[_0xf742('0x2c')]['message']);}})[_0xf742('0x2d')](function(_0x5bf9cb){logger[_0xf742('0x29')](_0xf742('0x24'),_0x37f2b3,_0x5bf9cb);_0x4d41f3(_0x5bf9cb);});});}function respondWithStatusCode(_0x15377c,_0x7c57f1){_0x7c57f1=_0x7c57f1||0xcc;return function(_0x3cd2f8){if(_0x3cd2f8){return _0x15377c['sendStatus'](_0x7c57f1);}return _0x15377c[_0xf742('0x2e')](_0x7c57f1)[_0xf742('0x2f')]();};}function respondWithResult(_0x4af7a3,_0x55ee8c){_0x55ee8c=_0x55ee8c||0xc8;return function(_0xd7f9bd){if(_0xd7f9bd){return _0x4af7a3[_0xf742('0x2e')](_0x55ee8c)['json'](_0xd7f9bd);}};}function respondWithFilteredResult(_0x7880e2,_0x1ea674){return function(_0x30ffc8){if(_0x30ffc8){var _0x12e80e=_0x30ffc8[_0xf742('0x30')],_0x4f036e=_0x1ea674[_0xf742('0x31')],_0x33d83e=_0x1ea674[_0xf742('0x31')]+_0x1ea674[_0xf742('0x32')],_0x5a299d;if(_0x33d83e>=_0x12e80e){_0x33d83e=_0x12e80e;_0x5a299d=0xc8;}else{_0x5a299d=0xce;}_0x7880e2['status'](_0x5a299d);return _0x7880e2[_0xf742('0x33')](_0xf742('0x34'),_0x4f036e+'-'+_0x33d83e+'/'+_0x12e80e)[_0xf742('0x35')](_0x30ffc8);}return null;};}function patchUpdates(_0x366ed2){return function(_0x4af518){try{jsonpatch[_0xf742('0x36')](_0x4af518,_0x366ed2,!![]);}catch(_0xc6605c){return BPromise[_0xf742('0x37')](_0xc6605c);}return _0x4af518[_0xf742('0x38')]();};}function saveUpdates(_0x100188,_0x5127a9){return function(_0xd209c5){if(_0xd209c5){return _0xd209c5['update'](_0x100188)[_0xf742('0x22')](function(_0x5a573c){return _0x5a573c;});}return null;};}function removeEntity(_0x2349ce,_0xf5487f){return function(_0x3d5d8a){if(_0x3d5d8a){return _0x3d5d8a['destroy']()['then'](function(){_0x2349ce[_0xf742('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c552f,_0x2106b2){return function(_0x4c76b3){if(!_0x4c76b3){_0x5c552f[_0xf742('0x39')](0x194);}return _0x4c76b3;};}function handleError(_0x3e2e7e,_0x523fe8){_0x523fe8=_0x523fe8||0x1f4;return function(_0x177b5b){logger[_0xf742('0x29')](_0x177b5b[_0xf742('0x3a')]);if(_0x177b5b[_0xf742('0x3b')]){delete _0x177b5b[_0xf742('0x3b')];}_0x3e2e7e[_0xf742('0x2e')](_0x523fe8)['send'](_0x177b5b);};}exports[_0xf742('0x3c')]=function(_0x40d291,_0x22d5a6){var _0x429570={},_0x5bb91d={},_0x212c93={'count':0x0,'rows':[]};var _0x33d135=_[_0xf742('0x3d')](db[_0xf742('0x3e')][_0xf742('0x3f')],function(_0xeddf02){return{'name':_0xeddf02[_0xf742('0x40')],'type':_0xeddf02['type'][_0xf742('0x41')]};});_0x5bb91d[_0xf742('0x42')]=_[_0xf742('0x3d')](_0x33d135,'name');_0x5bb91d['query']=_['keys'](_0x40d291[_0xf742('0x43')]);_0x5bb91d['filters']=_[_0xf742('0x44')](_0x5bb91d['model'],_0x5bb91d[_0xf742('0x43')]);_0x429570[_0xf742('0x45')]=_[_0xf742('0x44')](_0x5bb91d['model'],qs[_0xf742('0x46')](_0x40d291[_0xf742('0x43')][_0xf742('0x46')]));_0x429570[_0xf742('0x45')]=_0x429570[_0xf742('0x45')][_0xf742('0x47')]?_0x429570['attributes']:_0x5bb91d[_0xf742('0x42')];if(!_0x40d291[_0xf742('0x43')][_0xf742('0x48')](_0xf742('0x49'))){_0x429570[_0xf742('0x32')]=qs[_0xf742('0x32')](_0x40d291[_0xf742('0x43')][_0xf742('0x32')]);_0x429570[_0xf742('0x31')]=qs['offset'](_0x40d291[_0xf742('0x43')][_0xf742('0x31')]);}_0x429570[_0xf742('0x4a')]=qs['sort'](_0x40d291[_0xf742('0x43')]['sort']);_0x429570[_0xf742('0x4b')]=qs[_0xf742('0x4c')](_[_0xf742('0x4d')](_0x40d291['query'],_0x5bb91d[_0xf742('0x4c')]),_0x33d135);if(_0x40d291[_0xf742('0x43')][_0xf742('0x4e')]){_0x429570['where']=_['merge'](_0x429570[_0xf742('0x4b')],{'$or':_[_0xf742('0x3d')](_0x33d135,function(_0x159f24){if(_0x159f24[_0xf742('0x4f')]!=='VIRTUAL'){var _0xbfd5c3={};_0xbfd5c3[_0x159f24[_0xf742('0x3b')]]={'$like':'%'+_0x40d291[_0xf742('0x43')][_0xf742('0x4e')]+'%'};return _0xbfd5c3;}})});}_0x429570=_['merge']({},_0x429570,_0x40d291[_0xf742('0x50')]);var _0x394cd1={'where':_0x429570[_0xf742('0x4b')]};return db['SmsMessage']['count'](_0x394cd1)[_0xf742('0x22')](function(_0x2ab8c0){_0x212c93[_0xf742('0x30')]=_0x2ab8c0;if(_0x40d291[_0xf742('0x43')][_0xf742('0x51')]){_0x429570['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x429570);})[_0xf742('0x22')](function(_0x5ba0c5){_0x212c93[_0xf742('0x52')]=_0x5ba0c5;return _0x212c93;})[_0xf742('0x22')](respondWithFilteredResult(_0x22d5a6,_0x429570))[_0xf742('0x2d')](handleError(_0x22d5a6,null));};exports[_0xf742('0x53')]=function(_0x392b30,_0x2b1cc9){var _0x8e9a64={'raw':!![],'where':{'id':_0x392b30[_0xf742('0x54')]['id']}},_0x50f937={};_0x50f937[_0xf742('0x42')]=_[_0xf742('0x55')](db['SmsMessage'][_0xf742('0x3f')]);_0x50f937[_0xf742('0x43')]=_['keys'](_0x392b30[_0xf742('0x43')]);_0x50f937['filters']=_[_0xf742('0x44')](_0x50f937[_0xf742('0x42')],_0x50f937[_0xf742('0x43')]);_0x8e9a64[_0xf742('0x45')]=_[_0xf742('0x44')](_0x50f937['model'],qs[_0xf742('0x46')](_0x392b30[_0xf742('0x43')]['fields']));_0x8e9a64[_0xf742('0x45')]=_0x8e9a64[_0xf742('0x45')]['length']?_0x8e9a64[_0xf742('0x45')]:_0x50f937[_0xf742('0x42')];if(_0x392b30[_0xf742('0x43')][_0xf742('0x51')]){_0x8e9a64['include']=[{'all':!![]}];}_0x8e9a64=_[_0xf742('0x56')]({},_0x8e9a64,_0x392b30[_0xf742('0x50')]);return db[_0xf742('0x3e')][_0xf742('0x57')](_0x8e9a64)[_0xf742('0x22')](handleEntityNotFound(_0x2b1cc9,null))[_0xf742('0x22')](respondWithResult(_0x2b1cc9,null))[_0xf742('0x2d')](handleError(_0x2b1cc9,null));};exports['create']=function(_0x136d92,_0x3b5e3b){return db[_0xf742('0x3e')]['create'](_0x136d92[_0xf742('0x58')],{})[_0xf742('0x22')](respondWithResult(_0x3b5e3b,0xc9))[_0xf742('0x2d')](handleError(_0x3b5e3b,null));};exports[_0xf742('0x59')]=function(_0x8ec285,_0x40eb61){if(_0x8ec285['body']['id']){delete _0x8ec285['body']['id'];}return db[_0xf742('0x3e')]['find']({'where':{'id':_0x8ec285['params']['id']}})[_0xf742('0x22')](handleEntityNotFound(_0x40eb61,null))[_0xf742('0x22')](saveUpdates(_0x8ec285['body'],null))[_0xf742('0x22')](respondWithResult(_0x40eb61,null))[_0xf742('0x2d')](handleError(_0x40eb61,null));};exports[_0xf742('0x5a')]=function(_0x475d08,_0x401d2e){return db['SmsMessage']['find']({'where':{'id':_0x475d08[_0xf742('0x54')]['id']}})['then'](handleEntityNotFound(_0x401d2e,null))[_0xf742('0x22')](removeEntity(_0x401d2e,null))[_0xf742('0x2d')](handleError(_0x401d2e,null));};exports[_0xf742('0x5b')]=function(_0x2f6f51,_0x51e3a5){return db['SmsMessage'][_0xf742('0x5b')]()[_0xf742('0x22')](respondWithResult(_0x51e3a5,null))[_0xf742('0x2d')](handleError(_0x51e3a5,null));};var interaction_log=require('../../config/logger')(_0xf742('0x5c'));exports['accept']=function(_0x4b469a,_0x2474da,_0x3a138e){var _0x5019b3={'agent':{},'channel':_0xf742('0x5d')};if(_0x4b469a[_0xf742('0x58')]['id']){delete _0x4b469a['body']['id'];}_0x4b469a['body'][_0xf742('0x5e')]=!![];_0x4b469a[_0xf742('0x58')]['readAt']=moment()['format'](_0xf742('0x5f'));_0x4b469a['body'][_0xf742('0x60')]=_0x4b469a[_0xf742('0x58')]['UserId']||_0x4b469a[_0xf742('0x61')]['id'];_0x5019b3[_0xf742('0x62')]['id']=_0x4b469a[_0xf742('0x58')][_0xf742('0x60')];return db[_0xf742('0x3e')][_0xf742('0x57')]({'where':{'id':_0x4b469a['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xf742('0x63')}]})['then'](handleEntityNotFound(_0x2474da,null))[_0xf742('0x22')](saveUpdates(_0x4b469a['body'],null))['then'](function(_0x330e34){if(_0x330e34){_0x5019b3[_0xf742('0x2b')]=_0x330e34[_0xf742('0x64')]({'plain':!![]});return db[_0xf742('0x65')][_0xf742('0x57')]({'where':{'id':_0x330e34['SmsInteractionId']}});}return null;})[_0xf742('0x22')](handleEntityNotFound(_0x2474da,null))[_0xf742('0x22')](function(_0x5ad5e2){if(_0x5ad5e2){return _0x5ad5e2[_0xf742('0x59')]({'UserId':_0x4b469a[_0xf742('0x58')][_0xf742('0x60')],'read1stAt':_[_0xf742('0x66')](_0x5ad5e2['read1stAt'])?moment()['format'](_0xf742('0x5f')):undefined});}return null;})[_0xf742('0x22')](function(_0x236013){if(_0x236013){_0x5019b3[_0xf742('0x67')]=_0x236013['get']({'plain':!![]});interaction_log[_0xf742('0x23')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4b469a[_0xf742('0x61')]['id'],_0x4b469a[_0xf742('0x61')][_0xf742('0x3b')],_0x4b469a[_0xf742('0x61')][_0xf742('0x68')],_0x5019b3[_0xf742('0x67')]['id'],_0x4b469a[_0xf742('0x58')]?JSON[_0xf742('0x28')](_0x4b469a[_0xf742('0x58')]):'null');return respondWithRpcPromise(_0xf742('0x69'),_0xf742('0x6a'),_0x5019b3);}return null;})[_0xf742('0x22')](function(_0x32cfd9){if(_0x32cfd9){if(_0x4b469a[_0xf742('0x58')][_0xf742('0x6b')]){_0x5019b3[_0xf742('0x2b')][_0xf742('0x6c')]=util[_0xf742('0x6d')]('SIP/%s',_0x4b469a[_0xf742('0x61')]['name']);_0x5019b3[_0xf742('0x2b')][_0xf742('0x6e')]=_0x5019b3[_0xf742('0x6e')];_0x5019b3['message'][_0xf742('0x6f')]='accept';return respondWithRpcPromise(_0xf742('0x70'),_0xf742('0x70'),{'event':_0xf742('0x71'),'message':_0x5019b3[_0xf742('0x2b')]},client9002)[_0xf742('0x22')](function(){return _0x5019b3;});}return _0x5019b3;}return null;})['then'](respondWithResult(_0x2474da,null))[_0xf742('0x2d')](handleError(_0x2474da,null));};var interaction_log=require(_0xf742('0x16'))(_0xf742('0x5c'));exports[_0xf742('0x37')]=function(_0x338c23,_0xe8f50d,_0x554b24){var _0x5a91f2={'agent':{},'channel':'sms'};if(_0x338c23[_0xf742('0x58')]['id']){delete _0x338c23[_0xf742('0x58')]['id'];}_0x338c23['body']['UserId']=_0x338c23['body']['UserId']||_0x338c23[_0xf742('0x61')]['id'];_0x5a91f2[_0xf742('0x62')]['id']=_0x338c23[_0xf742('0x58')][_0xf742('0x60')];return db[_0xf742('0x3e')][_0xf742('0x57')]({'where':{'id':_0x338c23[_0xf742('0x54')]['id'],'UserId':null}})[_0xf742('0x22')](handleEntityNotFound(_0xe8f50d,null))['then'](function(_0x418028){if(_0x418028){_0x5a91f2[_0xf742('0x2b')]=_0x418028['get']({'plain':!![]});return db[_0xf742('0x65')][_0xf742('0x57')]({'where':{'id':_0x418028[_0xf742('0x72')]}});}return null;})[_0xf742('0x22')](handleEntityNotFound(_0xe8f50d,null))[_0xf742('0x22')](function(_0x104b24){if(_0x104b24){_0x5a91f2[_0xf742('0x67')]=_0x104b24[_0xf742('0x64')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x338c23[_0xf742('0x61')]['id'],_0x338c23['user'][_0xf742('0x3b')],_0x338c23[_0xf742('0x61')][_0xf742('0x68')],_0x5a91f2[_0xf742('0x67')]['id'],_0x338c23[_0xf742('0x58')]?JSON[_0xf742('0x28')](_0x338c23[_0xf742('0x58')]):_0xf742('0x73'));return respondWithRpcPromise(_0xf742('0x74'),'rejectMessage',_0x5a91f2);}return null;})[_0xf742('0x22')](function(_0x2ee5b8){if(_0x2ee5b8){_0x2ee5b8['message'][_0xf742('0x6c')]=util[_0xf742('0x6d')](_0xf742('0x75'),_0x338c23[_0xf742('0x61')]['name']);_0x2ee5b8['message'][_0xf742('0x6e')]=_0x5a91f2[_0xf742('0x6e')];_0x2ee5b8[_0xf742('0x2b')]['event']=_0xf742('0x37');respondWithRpcPromise(_0xf742('0x70'),_0xf742('0x70'),{'event':_0xf742('0x76'),'message':_0x2ee5b8[_0xf742('0x2b')]},client9002);return _0x5a91f2;}return null;})[_0xf742('0x22')](respondWithResult(_0xe8f50d,null))[_0xf742('0x2d')](handleError(_0xe8f50d,null));};exports[_0xf742('0x2e')]=function(_0x27bd48,_0x322329,_0x23625f){if(_0x27bd48[_0xf742('0x58')]['id']){delete _0x27bd48[_0xf742('0x58')]['id'];}var _0xac3850;return db['SmsMessage']['find']({'where':{'id':_0x27bd48[_0xf742('0x54')]['id']}})[_0xf742('0x22')](handleEntityNotFound(_0x322329,null))[_0xf742('0x22')](function(_0x57fdab){if(_0x57fdab){_0xac3850=_0x57fdab;return db[_0xf742('0x77')][_0xf742('0x57')]({'where':{'id':_0x57fdab[_0xf742('0x78')]}});}})['then'](handleEntityNotFound(_0x322329,null))[_0xf742('0x22')](function(_0x4b3ba1){if(_0x4b3ba1){logger['debug'](_0xf742('0x27'),_0xf742('0x2e'),_0xf742('0x79'),_0x4b3ba1[_0xf742('0x4f')],util['inspect'](_0x27bd48[_0xf742('0x58')],{'showHidden':![],'depth':null}));switch(_0x4b3ba1[_0xf742('0x4f')]){case _0xf742('0x7a'):if(_0x27bd48['body']['MessageSid']&&_0x27bd48[_0xf742('0x58')][_0xf742('0x7b')]===_0xac3850[_0xf742('0x7c')]){return _0xac3850[_0xf742('0x59')]({'read':!![]});}else{logger[_0xf742('0x29')](_0xf742('0x7d'),'status','twilio',util[_0xf742('0x7e')](_0x27bd48[_0xf742('0x58')],{'showHidden':![],'depth':null}));}break;case _0xf742('0x7f'):if(_0x27bd48[_0xf742('0x58')][_0xf742('0x80')]&&_0x27bd48[_0xf742('0x58')][_0xf742('0x80')]===_0xac3850[_0xf742('0x7c')]&&_[_0xf742('0x81')]([_0xf742('0x82'),_0xf742('0x83')],_0x27bd48[_0xf742('0x58')][_0xf742('0x84')])>=0x0){return _0xac3850['update']({'read':!![]});}else{logger[_0xf742('0x29')](_0xf742('0x7d'),'status','plivio',util[_0xf742('0x7e')](_0x27bd48[_0xf742('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x29ddd3=_0x27bd48['body']['results'][0x0];if(_0x29ddd3[_0xf742('0x2e')][_0xf742('0x85')]===_0xf742('0x86')){return _0xac3850[_0xf742('0x59')]({'read':!![]});}else{logger['error'](_0xf742('0x7d'),_0xf742('0x2e'),'infobip',util[_0xf742('0x7e')](_0x27bd48[_0xf742('0x58')],{'showHidden':![],'depth':null}));}break;}return _0xac3850;}})['then'](respondWithResult(_0x322329,null))['catch'](handleError(_0x322329,null));}; \ No newline at end of file +var _0xe2f5=['model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','type','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','show','find','create','body','params','describe','../../config/logger','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','SmsInteractionId','isNil','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','manual','SIP/%s','channel','accept','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','event','rejectmessage','SmsAccount','SmsAccountId','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','Status','plivio','infobip','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','http','client','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','code','error','message','SmsMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','set','Content-Range','reject','save','update','destroy','name','send','index','SmsMessage','rawAttributes','fieldName','key','map','query','keys','filters','intersection'];(function(_0x170914,_0x121732){var _0x5211b5=function(_0x149ef0){while(--_0x149ef0){_0x170914['push'](_0x170914['shift']());}};_0x5211b5(++_0x121732);}(_0xe2f5,0xd0));var _0x5e2f=function(_0x232be0,_0x19fe84){_0x232be0=_0x232be0-0x0;var _0x236c75=_0xe2f5[_0x232be0];return _0x236c75;};'use strict';var pdf=require(_0x5e2f('0x0'));var emlformat=require(_0x5e2f('0x1'));var rimraf=require(_0x5e2f('0x2'));var zipdir=require(_0x5e2f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e2f('0x4'));var moment=require(_0x5e2f('0x5'));var BPromise=require(_0x5e2f('0x6'));var Mustache=require(_0x5e2f('0x7'));var util=require(_0x5e2f('0x8'));var path=require(_0x5e2f('0x9'));var sox=require(_0x5e2f('0xa'));var csv=require('to-csv');var ejs=require(_0x5e2f('0xb'));var fs=require('fs');var _=require(_0x5e2f('0xc'));var squel=require('squel');var crypto=require(_0x5e2f('0xd'));var jsforce=require(_0x5e2f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5e2f('0xf'));var Redis=require(_0x5e2f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5e2f('0x11'));var hardwareService=require(_0x5e2f('0x12'));var logger=require('../../config/logger')(_0x5e2f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5e2f('0x14'));var db=require(_0x5e2f('0x15'))['db'];config[_0x5e2f('0x16')]=_['defaults'](config[_0x5e2f('0x16')],{'host':_0x5e2f('0x17'),'port':0x18eb});var socket=require(_0x5e2f('0x18'))(new Redis(config[_0x5e2f('0x16')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x5e2f('0x19'));var client=jayson['client'][_0x5e2f('0x1a')]({'port':0x232c});var client9002=jayson[_0x5e2f('0x1b')][_0x5e2f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xc26b46,_0xd9bb1b,_0x257a02,_0x1e79df){return new BPromise(function(_0x3dbcf4,_0x4a95e1){var _0x287dc6=_0x1e79df||client;return _0x287dc6[_0x5e2f('0x1c')](_0xc26b46,_0x257a02)[_0x5e2f('0x1d')](function(_0x4d561a){logger[_0x5e2f('0x1e')]('SmsMessage,\x20%s,\x20%s',_0xd9bb1b,_0x5e2f('0x1f'));logger[_0x5e2f('0x20')](_0x5e2f('0x21'),_0xd9bb1b,'request\x20sent',JSON['stringify'](_0x4d561a));if(_0x4d561a['error']){if(_0x4d561a['error'][_0x5e2f('0x22')]===0x1f4){logger[_0x5e2f('0x23')]('SmsMessage,\x20%s,\x20%s',_0xd9bb1b,_0x4d561a['error'][_0x5e2f('0x24')]);return _0x4a95e1(_0x4d561a[_0x5e2f('0x23')][_0x5e2f('0x24')]);}logger[_0x5e2f('0x23')](_0x5e2f('0x25'),_0xd9bb1b,_0x4d561a['error'][_0x5e2f('0x24')]);return _0x3dbcf4(_0x4d561a[_0x5e2f('0x23')][_0x5e2f('0x24')]);}else{logger[_0x5e2f('0x1e')]('SmsMessage,\x20%s,\x20%s',_0xd9bb1b,_0x5e2f('0x1f'));_0x3dbcf4(_0x4d561a[_0x5e2f('0x26')]['message']);}})[_0x5e2f('0x27')](function(_0x57d0dd){logger[_0x5e2f('0x23')]('SmsMessage,\x20%s,\x20%s',_0xd9bb1b,_0x57d0dd);_0x4a95e1(_0x57d0dd);});});}function respondWithStatusCode(_0x51b911,_0x45253c){_0x45253c=_0x45253c||0xcc;return function(_0x53b417){if(_0x53b417){return _0x51b911[_0x5e2f('0x28')](_0x45253c);}return _0x51b911[_0x5e2f('0x29')](_0x45253c)[_0x5e2f('0x2a')]();};}function respondWithResult(_0x3bd0a6,_0x5b85a9){_0x5b85a9=_0x5b85a9||0xc8;return function(_0x28a781){if(_0x28a781){return _0x3bd0a6[_0x5e2f('0x29')](_0x5b85a9)['json'](_0x28a781);}};}function respondWithFilteredResult(_0x1dc051,_0x38194b){return function(_0x2c4502){if(_0x2c4502){var _0x1edc4b=_0x2c4502['count'],_0x43ab8a=_0x38194b[_0x5e2f('0x2b')],_0x5cc3a0=_0x38194b[_0x5e2f('0x2b')]+_0x38194b['limit'],_0x2b4cfe;if(_0x5cc3a0>=_0x1edc4b){_0x5cc3a0=_0x1edc4b;_0x2b4cfe=0xc8;}else{_0x2b4cfe=0xce;}_0x1dc051['status'](_0x2b4cfe);return _0x1dc051[_0x5e2f('0x2c')](_0x5e2f('0x2d'),_0x43ab8a+'-'+_0x5cc3a0+'/'+_0x1edc4b)['json'](_0x2c4502);}return null;};}function patchUpdates(_0x3411d2){return function(_0x507721){try{jsonpatch['apply'](_0x507721,_0x3411d2,!![]);}catch(_0x484ad9){return BPromise[_0x5e2f('0x2e')](_0x484ad9);}return _0x507721[_0x5e2f('0x2f')]();};}function saveUpdates(_0x30070b,_0x160ad2){return function(_0x4b103c){if(_0x4b103c){return _0x4b103c[_0x5e2f('0x30')](_0x30070b)['then'](function(_0x2593f8){return _0x2593f8;});}return null;};}function removeEntity(_0x1d8a66,_0x5bdc9f){return function(_0x4f21ae){if(_0x4f21ae){return _0x4f21ae[_0x5e2f('0x31')]()['then'](function(){_0x1d8a66['status'](0xcc)[_0x5e2f('0x2a')]();});}};}function handleEntityNotFound(_0x5748aa,_0x1cdea3){return function(_0x589c82){if(!_0x589c82){_0x5748aa[_0x5e2f('0x28')](0x194);}return _0x589c82;};}function handleError(_0xc094b4,_0x4992f9){_0x4992f9=_0x4992f9||0x1f4;return function(_0x2818a2){logger[_0x5e2f('0x23')](_0x2818a2['stack']);if(_0x2818a2[_0x5e2f('0x32')]){delete _0x2818a2[_0x5e2f('0x32')];}_0xc094b4[_0x5e2f('0x29')](_0x4992f9)[_0x5e2f('0x33')](_0x2818a2);};}exports[_0x5e2f('0x34')]=function(_0x234283,_0x90ff85){var _0x9455a2={},_0x2583e5={},_0x21ae9d={'count':0x0,'rows':[]};var _0x1e6732=_['map'](db[_0x5e2f('0x35')][_0x5e2f('0x36')],function(_0x43da5d){return{'name':_0x43da5d[_0x5e2f('0x37')],'type':_0x43da5d['type'][_0x5e2f('0x38')]};});_0x2583e5['model']=_[_0x5e2f('0x39')](_0x1e6732,_0x5e2f('0x32'));_0x2583e5[_0x5e2f('0x3a')]=_[_0x5e2f('0x3b')](_0x234283['query']);_0x2583e5[_0x5e2f('0x3c')]=_[_0x5e2f('0x3d')](_0x2583e5[_0x5e2f('0x3e')],_0x2583e5['query']);_0x9455a2[_0x5e2f('0x3f')]=_[_0x5e2f('0x3d')](_0x2583e5[_0x5e2f('0x3e')],qs[_0x5e2f('0x40')](_0x234283[_0x5e2f('0x3a')][_0x5e2f('0x40')]));_0x9455a2[_0x5e2f('0x3f')]=_0x9455a2[_0x5e2f('0x3f')][_0x5e2f('0x41')]?_0x9455a2[_0x5e2f('0x3f')]:_0x2583e5[_0x5e2f('0x3e')];if(!_0x234283['query'][_0x5e2f('0x42')](_0x5e2f('0x43'))){_0x9455a2[_0x5e2f('0x44')]=qs[_0x5e2f('0x44')](_0x234283[_0x5e2f('0x3a')]['limit']);_0x9455a2['offset']=qs[_0x5e2f('0x2b')](_0x234283[_0x5e2f('0x3a')][_0x5e2f('0x2b')]);}_0x9455a2[_0x5e2f('0x45')]=qs['sort'](_0x234283[_0x5e2f('0x3a')][_0x5e2f('0x46')]);_0x9455a2[_0x5e2f('0x47')]=qs['filters'](_['pick'](_0x234283[_0x5e2f('0x3a')],_0x2583e5[_0x5e2f('0x3c')]),_0x1e6732);if(_0x234283['query']['filter']){_0x9455a2['where']=_['merge'](_0x9455a2['where'],{'$or':_['map'](_0x1e6732,function(_0x30172b){if(_0x30172b[_0x5e2f('0x48')]!==_0x5e2f('0x49')){var _0x34b97c={};_0x34b97c[_0x30172b['name']]={'$like':'%'+_0x234283[_0x5e2f('0x3a')][_0x5e2f('0x4a')]+'%'};return _0x34b97c;}})});}_0x9455a2=_[_0x5e2f('0x4b')]({},_0x9455a2,_0x234283[_0x5e2f('0x4c')]);var _0x287d4f={'where':_0x9455a2[_0x5e2f('0x47')]};return db['SmsMessage'][_0x5e2f('0x4d')](_0x287d4f)[_0x5e2f('0x1d')](function(_0x5f3cf2){_0x21ae9d['count']=_0x5f3cf2;if(_0x234283['query'][_0x5e2f('0x4e')]){_0x9455a2[_0x5e2f('0x4f')]=[{'all':!![]}];}return db[_0x5e2f('0x35')][_0x5e2f('0x50')](_0x9455a2);})[_0x5e2f('0x1d')](function(_0x33c65e){_0x21ae9d[_0x5e2f('0x51')]=_0x33c65e;return _0x21ae9d;})[_0x5e2f('0x1d')](respondWithFilteredResult(_0x90ff85,_0x9455a2))[_0x5e2f('0x27')](handleError(_0x90ff85,null));};exports[_0x5e2f('0x52')]=function(_0x51d716,_0x257484){var _0xeac2fb={'raw':!![],'where':{'id':_0x51d716['params']['id']}},_0x38c77c={};_0x38c77c[_0x5e2f('0x3e')]=_[_0x5e2f('0x3b')](db[_0x5e2f('0x35')]['rawAttributes']);_0x38c77c['query']=_[_0x5e2f('0x3b')](_0x51d716[_0x5e2f('0x3a')]);_0x38c77c[_0x5e2f('0x3c')]=_[_0x5e2f('0x3d')](_0x38c77c['model'],_0x38c77c[_0x5e2f('0x3a')]);_0xeac2fb[_0x5e2f('0x3f')]=_[_0x5e2f('0x3d')](_0x38c77c[_0x5e2f('0x3e')],qs[_0x5e2f('0x40')](_0x51d716['query'][_0x5e2f('0x40')]));_0xeac2fb[_0x5e2f('0x3f')]=_0xeac2fb[_0x5e2f('0x3f')]['length']?_0xeac2fb['attributes']:_0x38c77c['model'];if(_0x51d716['query']['includeAll']){_0xeac2fb[_0x5e2f('0x4f')]=[{'all':!![]}];}_0xeac2fb=_[_0x5e2f('0x4b')]({},_0xeac2fb,_0x51d716[_0x5e2f('0x4c')]);return db[_0x5e2f('0x35')][_0x5e2f('0x53')](_0xeac2fb)[_0x5e2f('0x1d')](handleEntityNotFound(_0x257484,null))[_0x5e2f('0x1d')](respondWithResult(_0x257484,null))['catch'](handleError(_0x257484,null));};exports[_0x5e2f('0x54')]=function(_0x2de847,_0x5e1695){return db[_0x5e2f('0x35')][_0x5e2f('0x54')](_0x2de847['body'],{})['then'](respondWithResult(_0x5e1695,0xc9))[_0x5e2f('0x27')](handleError(_0x5e1695,null));};exports[_0x5e2f('0x30')]=function(_0x2df6d8,_0xec04c9){if(_0x2df6d8[_0x5e2f('0x55')]['id']){delete _0x2df6d8[_0x5e2f('0x55')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x2df6d8['params']['id']}})[_0x5e2f('0x1d')](handleEntityNotFound(_0xec04c9,null))['then'](saveUpdates(_0x2df6d8[_0x5e2f('0x55')],null))[_0x5e2f('0x1d')](respondWithResult(_0xec04c9,null))['catch'](handleError(_0xec04c9,null));};exports[_0x5e2f('0x31')]=function(_0x2fcc85,_0x595cb3){return db[_0x5e2f('0x35')][_0x5e2f('0x53')]({'where':{'id':_0x2fcc85[_0x5e2f('0x56')]['id']}})[_0x5e2f('0x1d')](handleEntityNotFound(_0x595cb3,null))[_0x5e2f('0x1d')](removeEntity(_0x595cb3,null))[_0x5e2f('0x27')](handleError(_0x595cb3,null));};exports[_0x5e2f('0x57')]=function(_0x205d09,_0x5ca289){return db[_0x5e2f('0x35')][_0x5e2f('0x57')]()[_0x5e2f('0x1d')](respondWithResult(_0x5ca289,null))[_0x5e2f('0x27')](handleError(_0x5ca289,null));};var interaction_log=require(_0x5e2f('0x58'))(_0x5e2f('0x59'));exports['accept']=function(_0x4de77e,_0x5465f0,_0x31d6f7){var _0xe158e6={'agent':{},'channel':_0x5e2f('0x5a')};if(_0x4de77e['body']['id']){delete _0x4de77e[_0x5e2f('0x55')]['id'];}_0x4de77e[_0x5e2f('0x55')][_0x5e2f('0x5b')]=!![];_0x4de77e['body']['readAt']=moment()[_0x5e2f('0x5c')](_0x5e2f('0x5d'));_0x4de77e['body'][_0x5e2f('0x5e')]=_0x4de77e[_0x5e2f('0x55')][_0x5e2f('0x5e')]||_0x4de77e[_0x5e2f('0x5f')]['id'];_0xe158e6[_0x5e2f('0x60')]['id']=_0x4de77e[_0x5e2f('0x55')][_0x5e2f('0x5e')];return db[_0x5e2f('0x35')][_0x5e2f('0x53')]({'where':{'id':_0x4de77e[_0x5e2f('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x5e2f('0x61')],'as':_0x5e2f('0x62')}]})[_0x5e2f('0x1d')](handleEntityNotFound(_0x5465f0,null))[_0x5e2f('0x1d')](saveUpdates(_0x4de77e[_0x5e2f('0x55')],null))[_0x5e2f('0x1d')](function(_0x593afc){if(_0x593afc){_0xe158e6[_0x5e2f('0x24')]=_0x593afc['get']({'plain':!![]});return db['SmsInteraction'][_0x5e2f('0x53')]({'where':{'id':_0x593afc[_0x5e2f('0x63')]}});}return null;})[_0x5e2f('0x1d')](handleEntityNotFound(_0x5465f0,null))['then'](function(_0x2f332f){if(_0x2f332f){return _0x2f332f[_0x5e2f('0x30')]({'UserId':_0x4de77e[_0x5e2f('0x55')][_0x5e2f('0x5e')],'read1stAt':_[_0x5e2f('0x64')](_0x2f332f[_0x5e2f('0x65')])?moment()[_0x5e2f('0x5c')](_0x5e2f('0x5d')):undefined});}return null;})[_0x5e2f('0x1d')](function(_0x508b4e){if(_0x508b4e){_0xe158e6[_0x5e2f('0x66')]=_0x508b4e[_0x5e2f('0x67')]({'plain':!![]});interaction_log['info'](_0x5e2f('0x68'),_0x4de77e[_0x5e2f('0x5f')]['id'],_0x4de77e[_0x5e2f('0x5f')][_0x5e2f('0x32')],_0x4de77e[_0x5e2f('0x5f')][_0x5e2f('0x69')],_0xe158e6[_0x5e2f('0x66')]['id'],_0x4de77e[_0x5e2f('0x55')]?JSON[_0x5e2f('0x6a')](_0x4de77e[_0x5e2f('0x55')]):_0x5e2f('0x6b'));return respondWithRpcPromise(_0x5e2f('0x6c'),'acceptMessage',_0xe158e6);}return null;})[_0x5e2f('0x1d')](function(_0x590936){if(_0x590936){if(_0x4de77e[_0x5e2f('0x55')][_0x5e2f('0x6d')]){_0xe158e6[_0x5e2f('0x24')]['interface']=util['format'](_0x5e2f('0x6e'),_0x4de77e[_0x5e2f('0x5f')][_0x5e2f('0x32')]);_0xe158e6[_0x5e2f('0x24')]['channel']=_0xe158e6[_0x5e2f('0x6f')];_0xe158e6['message']['event']=_0x5e2f('0x70');return respondWithRpcPromise(_0x5e2f('0x71'),_0x5e2f('0x71'),{'event':_0x5e2f('0x72'),'message':_0xe158e6[_0x5e2f('0x24')]},client9002)['then'](function(){return _0xe158e6;});}return _0xe158e6;}return null;})['then'](respondWithResult(_0x5465f0,null))[_0x5e2f('0x27')](handleError(_0x5465f0,null));};var interaction_log=require(_0x5e2f('0x58'))(_0x5e2f('0x59'));exports[_0x5e2f('0x2e')]=function(_0x2588ae,_0x388664,_0x21414a){var _0x424732={'agent':{},'channel':_0x5e2f('0x5a')};if(_0x2588ae[_0x5e2f('0x55')]['id']){delete _0x2588ae['body']['id'];}_0x2588ae[_0x5e2f('0x55')][_0x5e2f('0x5e')]=_0x2588ae[_0x5e2f('0x55')][_0x5e2f('0x5e')]||_0x2588ae[_0x5e2f('0x5f')]['id'];_0x424732[_0x5e2f('0x60')]['id']=_0x2588ae['body']['UserId'];return db[_0x5e2f('0x35')]['find']({'where':{'id':_0x2588ae[_0x5e2f('0x56')]['id'],'UserId':null}})[_0x5e2f('0x1d')](handleEntityNotFound(_0x388664,null))[_0x5e2f('0x1d')](function(_0x1b1155){if(_0x1b1155){_0x424732['message']=_0x1b1155[_0x5e2f('0x67')]({'plain':!![]});return db[_0x5e2f('0x73')][_0x5e2f('0x53')]({'where':{'id':_0x1b1155[_0x5e2f('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x388664,null))[_0x5e2f('0x1d')](function(_0x1359bd){if(_0x1359bd){_0x424732[_0x5e2f('0x66')]=_0x1359bd[_0x5e2f('0x67')]({'plain':!![]});interaction_log[_0x5e2f('0x1e')](_0x5e2f('0x74'),_0x2588ae[_0x5e2f('0x5f')]['id'],_0x2588ae[_0x5e2f('0x5f')][_0x5e2f('0x32')],_0x2588ae[_0x5e2f('0x5f')]['role'],_0x424732[_0x5e2f('0x66')]['id'],_0x2588ae['body']?JSON[_0x5e2f('0x6a')](_0x2588ae[_0x5e2f('0x55')]):_0x5e2f('0x6b'));return respondWithRpcPromise(_0x5e2f('0x75'),'rejectMessage',_0x424732);}return null;})[_0x5e2f('0x1d')](function(_0x55be96){if(_0x55be96){_0x55be96['message'][_0x5e2f('0x76')]=util[_0x5e2f('0x5c')](_0x5e2f('0x6e'),_0x2588ae[_0x5e2f('0x5f')][_0x5e2f('0x32')]);_0x55be96[_0x5e2f('0x24')][_0x5e2f('0x6f')]=_0x424732[_0x5e2f('0x6f')];_0x55be96[_0x5e2f('0x24')][_0x5e2f('0x77')]=_0x5e2f('0x2e');respondWithRpcPromise(_0x5e2f('0x71'),_0x5e2f('0x71'),{'event':_0x5e2f('0x78'),'message':_0x55be96[_0x5e2f('0x24')]},client9002);return _0x424732;}return null;})[_0x5e2f('0x1d')](respondWithResult(_0x388664,null))[_0x5e2f('0x27')](handleError(_0x388664,null));};exports[_0x5e2f('0x29')]=function(_0x5b3d57,_0x169751,_0x204d74){if(_0x5b3d57[_0x5e2f('0x55')]['id']){delete _0x5b3d57['body']['id'];}var _0x33ab3c;return db[_0x5e2f('0x35')]['find']({'where':{'id':_0x5b3d57[_0x5e2f('0x56')]['id']}})[_0x5e2f('0x1d')](handleEntityNotFound(_0x169751,null))['then'](function(_0x3181fd){if(_0x3181fd){_0x33ab3c=_0x3181fd;return db[_0x5e2f('0x79')][_0x5e2f('0x53')]({'where':{'id':_0x3181fd[_0x5e2f('0x7a')]}});}})[_0x5e2f('0x1d')](handleEntityNotFound(_0x169751,null))[_0x5e2f('0x1d')](function(_0x45d7ce){if(_0x45d7ce){logger['debug'](_0x5e2f('0x21'),_0x5e2f('0x29'),'received\x20delivery\x20report\x20from',_0x45d7ce[_0x5e2f('0x48')],util[_0x5e2f('0x7b')](_0x5b3d57[_0x5e2f('0x55')],{'showHidden':![],'depth':null}));switch(_0x45d7ce[_0x5e2f('0x48')]){case'twilio':if(_0x5b3d57[_0x5e2f('0x55')][_0x5e2f('0x7c')]&&_0x5b3d57['body'][_0x5e2f('0x7c')]===_0x33ab3c[_0x5e2f('0x7d')]){return _0x33ab3c[_0x5e2f('0x30')]({'read':!![]});}else{logger[_0x5e2f('0x23')](_0x5e2f('0x7e'),_0x5e2f('0x29'),'twilio',util['inspect'](_0x5b3d57[_0x5e2f('0x55')],{'showHidden':![],'depth':null}));}break;case _0x5e2f('0x7f'):if(_0x5b3d57[_0x5e2f('0x55')][_0x5e2f('0x80')]&&_0x5b3d57[_0x5e2f('0x55')][_0x5e2f('0x80')]===_0x33ab3c[_0x5e2f('0x7d')]&&_[_0x5e2f('0x81')](['sent','delivered'],_0x5b3d57[_0x5e2f('0x55')][_0x5e2f('0x82')])>=0x0){return _0x33ab3c[_0x5e2f('0x30')]({'read':!![]});}else{logger['error'](_0x5e2f('0x7e'),'status',_0x5e2f('0x83'),util[_0x5e2f('0x7b')](_0x5b3d57[_0x5e2f('0x55')],{'showHidden':![],'depth':null}));}break;case _0x5e2f('0x84'):var _0x1572bd=_0x5b3d57[_0x5e2f('0x55')]['results'][0x0];if(_0x1572bd[_0x5e2f('0x29')][_0x5e2f('0x85')]===_0x5e2f('0x86')){return _0x33ab3c[_0x5e2f('0x30')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5e2f('0x29'),'infobip',util[_0x5e2f('0x7b')](_0x5b3d57[_0x5e2f('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x33ab3c;}})[_0x5e2f('0x1d')](respondWithResult(_0x169751,null))[_0x5e2f('0x27')](handleError(_0x169751,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d15e331..d4592dc 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 _0x21ac=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x393d4f,_0xd2f2e0){var _0xac5a01=function(_0x57a4d3){while(--_0x57a4d3){_0x393d4f['push'](_0x393d4f['shift']());}};_0xac5a01(++_0xd2f2e0);}(_0x21ac,0xe1));var _0xc21a=function(_0x252310,_0x283e38){_0x252310=_0x252310-0x0;var _0x4a2c12=_0x21ac[_0x252310];return _0x4a2c12;};'use strict';var EventEmitter=require(_0xc21a('0x0'));var SmsMessage=require(_0xc21a('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc21a('0x2')](0x0);var events={'afterCreate':_0xc21a('0x3'),'afterUpdate':_0xc21a('0x4'),'afterDestroy':_0xc21a('0x5')};function emitEvent(_0x3ded46){return function(_0x2ff699,_0x2975c2,_0x5cc830){SmsMessageEvents[_0xc21a('0x6')](_0x3ded46+':'+_0x2ff699['id'],_0x2ff699);SmsMessageEvents[_0xc21a('0x6')](_0x3ded46,_0x2ff699);_0x5cc830(null);};}for(var e in events){if(events[_0xc21a('0x7')](e)){var event=events[e];SmsMessage[_0xc21a('0x8')](e,emitEvent(event));}}module[_0xc21a('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x7086=['remove','hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners','update'];(function(_0x1778ac,_0x18cb8f){var _0x3c99d3=function(_0x570a3f){while(--_0x570a3f){_0x1778ac['push'](_0x1778ac['shift']());}};_0x3c99d3(++_0x18cb8f);}(_0x7086,0x64));var _0x6708=function(_0x49a9bc,_0x57d8d7){_0x49a9bc=_0x49a9bc-0x0;var _0x546fce=_0x7086[_0x49a9bc];return _0x546fce;};'use strict';var EventEmitter=require(_0x6708('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x6708('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6708('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6708('0x3'),'afterDestroy':_0x6708('0x4')};function emitEvent(_0x3e5d85){return function(_0x4efd27,_0x27e6fd,_0x1e029c){SmsMessageEvents['emit'](_0x3e5d85+':'+_0x4efd27['id'],_0x4efd27);SmsMessageEvents['emit'](_0x3e5d85,_0x4efd27);_0x1e029c(null);};}for(var e in events){if(events[_0x6708('0x5')](e)){var event=events[e];SmsMessage[_0x6708('0x6')](e,emitEvent(event));}}module[_0x6708('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 43a7718..2ac11ab 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 _0xe02f=['%s:%s','https://api.plivo.com/v1/Account/%s/Message/','base64','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','apiKey','timestamp','keys','sort','length','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','intelepeer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','then','update','createdAt','catch','error','find','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','session_key','total_sent','read','skebby','connectel','POST','https://smsapi.connectel.se/api/v2/send/','requestid','senderString','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','head','message_id','deliveryReport','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/status?token='];(function(_0x35d6ff,_0x5bd642){var _0x4d01c6=function(_0x4117db){while(--_0x4117db){_0x35d6ff['push'](_0x35d6ff['shift']());}};_0x4d01c6(++_0x5bd642);}(_0xe02f,0x112));var _0xfe02=function(_0xa0d6e8,_0x41e320){_0xa0d6e8=_0xa0d6e8-0x0;var _0x4ba300=_0xe02f[_0xa0d6e8];return _0x4ba300;};'use strict';var _=require(_0xfe02('0x0'));var util=require(_0xfe02('0x1'));var logger=require(_0xfe02('0x2'))(_0xfe02('0x3'));var moment=require(_0xfe02('0x4'));var BPromise=require(_0xfe02('0x5'));var rp=require(_0xfe02('0x6'));var fs=require('fs');var path=require(_0xfe02('0x7'));var rimraf=require('rimraf');var config=require(_0xfe02('0x8'));var attributes=require(_0xfe02('0x9'));module[_0xfe02('0xa')]=function(_0x1a6357,_0x3d02a6){return _0x1a6357[_0xfe02('0xb')](_0xfe02('0xc'),attributes,{'tableName':_0xfe02('0xd'),'paranoid':![],'indexes':[{'name':_0xfe02('0xe'),'fields':[_0xfe02('0xe')]},{'name':'fti_sms_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22670f,_0x2823d7,_0x65571c){var _0x332a8b=_0x1a6357['models'];var _0x5cb64d=_0x22670f[_0xfe02('0xf')]({'plain':!![]});if(_0x5cb64d[_0xfe02('0x10')][_0xfe02('0x11')]()==='in'||_0x5cb64d[_0xfe02('0x10')][_0xfe02('0x11')]()===_0xfe02('0x12')&&!_0x5cb64d[_0xfe02('0x13')]&&!_[_0xfe02('0x14')](_0x5cb64d[_0xfe02('0x15')])){_0x332a8b[_0xfe02('0x16')]['findOne']({'where':{'id':_0x5cb64d['SmsInteractionId']}})[_0xfe02('0x17')](function(_0x1f6fdd){if(_0x1f6fdd){_0x1f6fdd[_0xfe02('0x18')]({'lastMsgAt':_0x5cb64d[_0xfe02('0x19')],'lastMsgDirection':_0x5cb64d[_0xfe02('0x10')][_0xfe02('0x11')]()});}})[_0xfe02('0x1a')](function(_0x49b7b3){console[_0xfe02('0x1b')](_0x49b7b3);});}if(_0x5cb64d['direction']===_0xfe02('0x12')&&!_0x5cb64d[_0xfe02('0x13')]){var _0xe5da1;_0x332a8b['SmsAccount'][_0xfe02('0x1c')]({'where':{'id':_0x5cb64d['SmsAccountId']},'raw':!![]})[_0xfe02('0x17')](function(_0x44feb3){_0xe5da1=_0x44feb3;if(_0xe5da1&&_0xe5da1[_0xfe02('0x1d')]){switch(_0xe5da1['type']){case _0xfe02('0x1e'):var _0x42a4d9=require(_0xfe02('0x1e'));if(_0xe5da1[_0xfe02('0x1f')]&&_0xe5da1[_0xfe02('0x20')]&&_0xe5da1[_0xfe02('0x21')]){var _0x37d85a=new _0x42a4d9(_0xe5da1[_0xfe02('0x1f')],_0xe5da1['authToken']);_0x37d85a[_0xfe02('0x22')][_0xfe02('0x23')]({'body':_0x5cb64d[_0xfe02('0x24')],'to':_0x5cb64d[_0xfe02('0x21')],'from':_0xe5da1[_0xfe02('0x21')],'statusCallback':_0xe5da1[_0xfe02('0x25')]+_0xfe02('0x26')+_0x5cb64d['id']+'/status?token='+_0xe5da1[_0xfe02('0x27')]})['then'](function(_0x4d407b){if(_0x4d407b[_0xfe02('0x28')]){return _0x22670f['update']({'messageId':_0x4d407b[_0xfe02('0x28')]});}})[_0xfe02('0x1a')](function(_0x66785a){logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x1e'),util[_0xfe02('0x2b')](_0x66785a,{'showHidden':![],'depth':null}));});}else{logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),'twilio',_0xfe02('0x2c'));}break;case'skebby':var _0x419216='https://api.skebby.it/API/v1.0/REST/';if(_0xe5da1[_0xfe02('0x2d')]&&_0xe5da1[_0xfe02('0x2e')]){var _0x21bc31={'recipient':[_0x5cb64d['phone']],'message':_0x5cb64d[_0xfe02('0x24')],'message_type':_0xe5da1['smsMethod']};if(_0xe5da1[_0xfe02('0x2f')]&&_0xe5da1['smsMethod']!=='SI'){_0x21bc31[_0xfe02('0x30')]=_0xe5da1[_0xfe02('0x21')];}var _0xbf1e18={'url':_0x419216+_0xfe02('0x31')+_0xe5da1[_0xfe02('0x2d')]+_0xfe02('0x32')+_0xe5da1[_0xfe02('0x2e')],'method':_0xfe02('0x33')};rp(_0xbf1e18)['then'](function(_0xbdaca6){var _0x1e2297=_0xbdaca6[_0xfe02('0x34')](';');var _0x2c88ed={'user_key':_0x1e2297[0x0],'session_key':_0x1e2297[0x1]};_0xbf1e18={'url':_0x419216+_0xfe02('0x35'),'method':'POST','headers':{'user_key':_0x2c88ed['user_key'],'Session_key':_0x2c88ed[_0xfe02('0x36')]},'json':!![],'body':_0x21bc31};return rp(_0xbf1e18);})[_0xfe02('0x17')](function(_0x29fe52){if(_0x29fe52[_0xfe02('0x37')]>=0x1){var _0x4058d4={'messageId':_0x29fe52['internal_order_id']};if(_0xe5da1['smsMethod']!=='GP'||!_0xe5da1['deliveryReport']){_0x4058d4[_0xfe02('0x38')]=!![];}return _0x22670f['update'](_0x4058d4);}else{return logger[_0xfe02('0x1b')](_0xfe02('0x29'),'afterCreate',_0xfe02('0x39'),util[_0xfe02('0x2b')](_0x29fe52,{'showHidden':![],'depth':null}));}})[_0xfe02('0x1a')](function(_0x154f18){return logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x39'),util[_0xfe02('0x2b')](_0x154f18,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x39'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xfe02('0x3a'):if(_0xe5da1[_0xfe02('0x20')]){var _0x32130f={'recipient':_0x5cb64d[_0xfe02('0x21')],'message':_0x5cb64d[_0xfe02('0x24')],'sender':_0xe5da1['senderString']||_0xe5da1[_0xfe02('0x21')],'authorization':_0xe5da1[_0xfe02('0x20')]};var _0x2823d7={'method':_0xfe02('0x3b'),'uri':_0xfe02('0x3c'),'body':_0x32130f,'json':!![]};rp(_0x2823d7)[_0xfe02('0x17')](function(_0x3886b5){var _0x19ef43={'messageId':_0x3886b5[_0xfe02('0x3d')]};if(!_0xe5da1['deliveryReport']){_0x19ef43[_0xfe02('0x38')]=!![];}return _0x22670f[_0xfe02('0x18')](_0x19ef43);})['catch'](function(_0x482214){logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x3a'),util[_0xfe02('0x2b')](_0x482214,{'showHidden':![],'depth':null}));});}else{logger[_0xfe02('0x1b')](_0xfe02('0x29'),'afterCreate',_0xfe02('0x3a'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0xe5da1[_0xfe02('0x2d')]&&_0xe5da1[_0xfe02('0x2e')]){var _0x32130f={'messages':[{'source':'xCALLY\x20Motion','to':_0x5cb64d['phone'],'body':_0x5cb64d[_0xfe02('0x24')],'from':_0xe5da1[_0xfe02('0x3e')]||_0xe5da1[_0xfe02('0x21')]}]};var _0x2ed49e=util[_0xfe02('0x3f')]('%s:%s',_0xe5da1[_0xfe02('0x2d')],_0xe5da1[_0xfe02('0x2e')]);var _0x2823d7={'method':_0xfe02('0x3b'),'uri':_0xfe02('0x40'),'body':_0x32130f,'headers':{'Authorization':util[_0xfe02('0x3f')](_0xfe02('0x41'),new Buffer(_0x2ed49e)[_0xfe02('0x42')]('base64'))},'json':!![]};rp(_0x2823d7)[_0xfe02('0x17')](function(_0x430469){if(_0x430469['http_code']>=0xc8&&_0x430469[_0xfe02('0x43')]<=0xce){if(_0x430469[_0xfe02('0x44')]&&_0x430469[_0xfe02('0x44')]['queued_count']>0x0){var _0x167695=_[_0xfe02('0x45')](_0x430469['data']['messages']);var _0x5de971={'messageId':_0x167695[_0xfe02('0x46')]};if(!_0xe5da1[_0xfe02('0x47')]){_0x5de971[_0xfe02('0x38')]=!![];}return _0x22670f[_0xfe02('0x18')](_0x5de971);}else{logger[_0xfe02('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfe02('0x2a'),_0xfe02('0x48'),util[_0xfe02('0x2b')](_0x430469,{'showHidden':![],'depth':null}));}}else{logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),'clickSend',util['inspect'](_0x430469,{'showHidden':![],'depth':null}));}})[_0xfe02('0x1a')](function(_0x44d9f1){logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x48'),util[_0xfe02('0x2b')](_0x44d9f1,{'showHidden':![],'depth':null}));});}else{logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x48'),_0xfe02('0x49'));}break;case _0xfe02('0x4a'):if(_0xe5da1[_0xfe02('0x4b')]&&_0xe5da1[_0xfe02('0x20')]){var _0x32130f={'dst':_0x5cb64d[_0xfe02('0x21')],'text':_0x5cb64d[_0xfe02('0x24')],'src':_0xe5da1[_0xfe02('0x3e')]||_0xe5da1[_0xfe02('0x21')],'url':_0xe5da1[_0xfe02('0x25')]+_0xfe02('0x26')+_0x5cb64d['id']+_0xfe02('0x4c')+_0xe5da1['token']};var _0x2ed49e=util[_0xfe02('0x3f')](_0xfe02('0x4d'),_0xe5da1[_0xfe02('0x4b')],_0xe5da1[_0xfe02('0x20')]);var _0x2823d7={'method':'POST','uri':util[_0xfe02('0x3f')](_0xfe02('0x4e'),_0xe5da1[_0xfe02('0x4b')]),'body':_0x32130f,'headers':{'Authorization':util['format'](_0xfe02('0x41'),new Buffer(_0x2ed49e)[_0xfe02('0x42')](_0xfe02('0x4f')))},'json':!![]};rp(_0x2823d7)['then'](function(_0x55ced9){var _0xe85b56={'messageId':_0x55ced9['message_uuid'][0x0]};return _0x22670f[_0xfe02('0x18')](_0xe85b56);})[_0xfe02('0x1a')](function(_0x4cba1a){logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),'plivo',util['inspect'](_0x4cba1a,{'showHidden':![],'depth':null}));});}else{logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x4a'),_0xfe02('0x50'));}break;case _0xfe02('0x51'):if(_0xe5da1['username']&&_0xe5da1[_0xfe02('0x2e')]){if(_0xe5da1[_0xfe02('0x52')]){var _0x26eda1={'method':_0xfe02('0x3b'),'uri':_0xe5da1[_0xfe02('0x52')]+_0xfe02('0x53'),'body':{'username':_0xe5da1[_0xfe02('0x2d')],'password':_0xe5da1[_0xfe02('0x2e')]},'json':!![]};return rp(_0x26eda1)[_0xfe02('0x17')](function(_0x2d1dbb){var _0x258e61={'method':_0xfe02('0x3b'),'uri':_0xe5da1['baseUrl']+_0xfe02('0x54'),'body':{'messages':[{'from':_0xe5da1[_0xfe02('0x21')],'destinations':[{'to':_0x5cb64d[_0xfe02('0x21')]}],'text':_0x5cb64d[_0xfe02('0x24')],'notifyUrl':_0xe5da1[_0xfe02('0x25')]+_0xfe02('0x26')+_0x5cb64d['id']+'/status?token='+_0xe5da1[_0xfe02('0x27')],'notifyContentType':_0xfe02('0x55'),'callbackData':_0xe5da1[_0xfe02('0x21')]+';'+_0x5cb64d[_0xfe02('0x24')]}]},'headers':{'Authorization':_0xfe02('0x56')+_0x2d1dbb[_0xfe02('0x27')]},'json':!![]};return rp(_0x258e61)[_0xfe02('0x17')](function(_0x2af336){if(_0x2af336[_0xfe02('0x22')]){var _0x4e027c={'messageId':_0x2af336[_0xfe02('0x22')][0x0][_0xfe02('0xe')]};if(!_0xe5da1[_0xfe02('0x47')]){_0x4e027c[_0xfe02('0x38')]=!![];}return _0x22670f[_0xfe02('0x18')](_0x4e027c);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfe02('0x2a'),_0xfe02('0x51'),util[_0xfe02('0x2b')](_0x2af336,{'showHidden':![],'depth':null}));}});})[_0xfe02('0x1a')](function(_0x2bf906){return logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x51'),util[_0xfe02('0x2b')](_0x2bf906,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfe02('0x2a'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger['error'](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xfe02('0x57'):var _0x27e3b8=require('crypto');if(_0xe5da1[_0xfe02('0x58')]){var _0x1da290={};_0x1da290['login']=_0xe5da1['username'];_0x1da290[_0xfe02('0x21')]=_0x5cb64d['phone'];_0x1da290['sender']=_0xe5da1['phone'];_0x1da290['text']=_0x5cb64d[_0xfe02('0x24')];_0x1da290[_0xfe02('0x59')]=+new Date();var _0xbf494c='';var _0x2787ce='';var _0x1cb7a9=Object[_0xfe02('0x5a')](_0x1da290);_0x1cb7a9[_0xfe02('0x5b')]();for(var _0x3f8a1a=0x0;_0x3f8a1a<_0x1cb7a9[_0xfe02('0x5c')];_0x3f8a1a++){if(_0xbf494c!=''){_0xbf494c+='&';}_0xbf494c+=_0x1cb7a9[_0x3f8a1a]+'='+encodeURIComponent(_0x1da290[_0x1cb7a9[_0x3f8a1a]]);_0x2787ce+=_0x1da290[_0x1cb7a9[_0x3f8a1a]];}_0x2787ce+=_0xe5da1[_0xfe02('0x58')];_0x2787ce=_0x27e3b8[_0xfe02('0x5d')](_0xfe02('0x5e'))[_0xfe02('0x18')](_0x2787ce)['digest'](_0xfe02('0x5f'));if(_0xbf494c!==''){_0xbf494c+='&';}_0xbf494c+=_0xfe02('0x60')+_0x2787ce;var _0xbf1e18={'method':_0xfe02('0x33'),'uri':_0xe5da1[_0xfe02('0x52')]+_0xfe02('0x61')+_0xbf494c,'json':!![]};return rp(_0xbf1e18)[_0xfe02('0x17')](function(_0x24cc8e){var _0x49a0ef=Object[_0xfe02('0x5a')](_0x24cc8e);if(_0x24cc8e[_0x49a0ef[0x0]][_0xfe02('0x1b')]&&parseInt(_0x24cc8e[_0x49a0ef[0x0]][_0xfe02('0x1b')])===0x0){var _0x3fa0ec={'messageId':_0x24cc8e[_0x49a0ef[0x0]][_0xfe02('0x62')]};if(!_0xe5da1[_0xfe02('0x47')]){_0x3fa0ec['read']=!![];}return _0x22670f['update'](_0x3fa0ec);}else{return logger['error'](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x57'),util[_0xfe02('0x2b')](_0x24cc8e[_0xfe02('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4b494d){return logger[_0xfe02('0x1b')](_0xfe02('0x29'),'afterCreate',_0xfe02('0x57'),util[_0xfe02('0x2b')](_0x4b494d,{'showHidden':![],'depth':null}));});}else{logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0xfe02('0x63'):if(_0xe5da1[_0xfe02('0x58')]){var _0x3b91c4={'method':'POST','uri':_0xfe02('0x64'),'headers':{'Authorization':_0xe5da1[_0xfe02('0x58')]},'body':{'content':_0x5cb64d[_0xfe02('0x24')],'to':[_0x5cb64d[_0xfe02('0x21')]],'from':_0xe5da1['phone'],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x3b91c4)['then'](function(_0x38d789){if(!_0x38d789[_0xfe02('0x1b')]){var _0x2b0ba7={'messageId':_0x38d789['messages'][0x0][_0xfe02('0x65')]};if(!_0xe5da1[_0xfe02('0x47')]){_0x2b0ba7['read']=!![];}return _0x22670f[_0xfe02('0x18')](_0x2b0ba7);}else{return logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),'clickatell',util[_0xfe02('0x2b')](_0x38d789[_0xfe02('0x1b')],{'showHidden':![],'depth':null}));}})[_0xfe02('0x1a')](function(_0x557d33){return logger[_0xfe02('0x1b')](_0xfe02('0x29'),'afterCreate',_0xfe02('0x63'),util[_0xfe02('0x2b')](_0x557d33,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfe02('0x63'),_0xfe02('0x66'));}break;case _0xfe02('0x67'):if(_0xe5da1['username']&&_0xe5da1[_0xfe02('0x2e')]){var _0x2ed49e=util[_0xfe02('0x3f')]('%s:%s',_0xe5da1[_0xfe02('0x2d')],_0xe5da1['password']);var _0x2823d7={'method':_0xfe02('0x3b'),'uri':_0xfe02('0x68')+_0xe5da1[_0xfe02('0x69')]+_0xfe02('0x6a'),'body':{'to':[_0x5cb64d[_0xfe02('0x21')]],'text':_0x5cb64d[_0xfe02('0x24')],'from':_0xe5da1[_0xfe02('0x21')],'applicationId':_0xe5da1['applicationId']},'headers':{'Authorization':util[_0xfe02('0x3f')](_0xfe02('0x41'),new Buffer(_0x2ed49e)['toString'](_0xfe02('0x4f')))},'json':!![]};rp(_0x2823d7)[_0xfe02('0x17')](function(_0x33d392){if(_0x33d392['id']){var _0x5927c9={'messageId':_0x33d392['id']};return _0x22670f['update'](_0x5927c9);}else{logger['error'](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x67'),util[_0xfe02('0x2b')](_0x33d392,{'showHidden':![],'depth':null}));}})[_0xfe02('0x1a')](function(_0x580645){logger['error'](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x67'),util['inspect'](_0x580645,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfe02('0x2a'),'bandwidth',_0xfe02('0x49'));}break;case'intelepeer':if(_0xe5da1[_0xfe02('0x58')]){var _0x79274={};var _0xbf1e18={'method':_0xfe02('0x3b'),'uri':_0xfe02('0x6b'),'headers':{'Authorization':_0xfe02('0x6c')+_0xe5da1['apiKey'],'Content-Type':'application/json'},'body':{'from':_0xe5da1[_0xfe02('0x21')],'to':_0x5cb64d['phone'],'text':_0x5cb64d[_0xfe02('0x24')]},'json':!![]};return rp(_0xbf1e18)[_0xfe02('0x17')](function(_0x5cc839){if(_0x5cc839[_0xfe02('0x6d')]==0xca){_0x79274[_0xfe02('0x6e')]=_0x5cc839;var _0x273c6b={'method':_0xfe02('0x3b'),'uri':_0xfe02('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0xe5da1['apiKey'],'Content-Type':_0xfe02('0x55')},'body':{'refid':_0x79274[_0xfe02('0x6e')]['refid']},'json':!![]};return rp(_0x273c6b)[_0xfe02('0x17')](function(_0x52a509){_0x79274[_0xfe02('0x70')]=_0x52a509;var _0x1d27fe={'messageId':_0x79274[_0xfe02('0x6e')][_0xfe02('0x71')],'read':!![]};return _0x22670f[_0xfe02('0x18')](_0x1d27fe);});}else{return logger[_0xfe02('0x1b')](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x72'),util[_0xfe02('0x2b')](_0x5cc839,{'showHidden':![],'depth':null}));}})[_0xfe02('0x1a')](function(_0x2b2a46){return logger['error'](_0xfe02('0x29'),_0xfe02('0x2a'),_0xfe02('0x72'),util['inspect'](_0x2b2a46,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xfe02('0x29'),_0xfe02('0x2a'),'intelepeer','Token\x20not\x20received');}break;}}})['finally'](function(){_0x65571c();});}else{_0x65571c();}}},'charset':_0xfe02('0x73'),'collate':_0xfe02('0x74')});}; \ No newline at end of file +var _0xee2e=['secret','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','catch','find','type','twilio','accountSid','authToken','create','phone','remote','/api/sms/messages/','token','sid','error','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','split','POST','session_key','total_sent','internal_order_id','deliveryReport','inspect','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','clickSend','plivo','https://api.plivo.com/v1/Account/%s/Message/','authId','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/status?token=','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','keys','sort','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','accountId','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x260c98,_0x3268ac){var _0x2eb92f=function(_0x2fb0b6){while(--_0x2fb0b6){_0x260c98['push'](_0x260c98['shift']());}};_0x2eb92f(++_0x3268ac);}(_0xee2e,0x159));var _0xeee2=function(_0x741670,_0x260e2d){_0x741670=_0x741670-0x0;var _0xd40d7b=_0xee2e[_0x741670];return _0xd40d7b;};'use strict';var _=require(_0xeee2('0x0'));var util=require('util');var logger=require(_0xeee2('0x1'))('api');var moment=require(_0xeee2('0x2'));var BPromise=require(_0xeee2('0x3'));var rp=require(_0xeee2('0x4'));var fs=require('fs');var path=require(_0xeee2('0x5'));var rimraf=require(_0xeee2('0x6'));var config=require(_0xeee2('0x7'));var attributes=require('./smsMessage.attributes');module[_0xeee2('0x8')]=function(_0x17c206,_0x1dad21){return _0x17c206['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xeee2('0x9'),'fields':['messageId']},{'name':_0xeee2('0xa'),'fields':[_0xeee2('0xb')],'type':_0xeee2('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x43a2a3,_0x2ade1d,_0x328dbb){var _0x4a3761=_0x17c206[_0xeee2('0xd')];var _0x258862=_0x43a2a3[_0xeee2('0xe')]({'plain':!![]});if(_0x258862[_0xeee2('0xf')][_0xeee2('0x10')]()==='in'||_0x258862[_0xeee2('0xf')][_0xeee2('0x10')]()===_0xeee2('0x11')&&!_0x258862[_0xeee2('0x12')]&&!_[_0xeee2('0x13')](_0x258862[_0xeee2('0x14')])){_0x4a3761[_0xeee2('0x15')][_0xeee2('0x16')]({'where':{'id':_0x258862['SmsInteractionId']}})[_0xeee2('0x17')](function(_0x387954){if(_0x387954){_0x387954[_0xeee2('0x18')]({'lastMsgAt':_0x258862[_0xeee2('0x19')],'lastMsgDirection':_0x258862[_0xeee2('0xf')][_0xeee2('0x10')]()});}})[_0xeee2('0x1a')](function(_0x5c6016){console['error'](_0x5c6016);});}if(_0x258862['direction']==='out'&&!_0x258862[_0xeee2('0x12')]){var _0x309bcc;_0x4a3761['SmsAccount'][_0xeee2('0x1b')]({'where':{'id':_0x258862['SmsAccountId']},'raw':!![]})[_0xeee2('0x17')](function(_0x17a6e0){_0x309bcc=_0x17a6e0;if(_0x309bcc&&_0x309bcc[_0xeee2('0x1c')]){switch(_0x309bcc[_0xeee2('0x1c')]){case _0xeee2('0x1d'):var _0x1d9d4b=require('twilio');if(_0x309bcc[_0xeee2('0x1e')]&&_0x309bcc[_0xeee2('0x1f')]&&_0x309bcc['phone']){var _0x506c61=new _0x1d9d4b(_0x309bcc[_0xeee2('0x1e')],_0x309bcc[_0xeee2('0x1f')]);_0x506c61['messages'][_0xeee2('0x20')]({'body':_0x258862[_0xeee2('0xb')],'to':_0x258862['phone'],'from':_0x309bcc[_0xeee2('0x21')],'statusCallback':_0x309bcc[_0xeee2('0x22')]+_0xeee2('0x23')+_0x258862['id']+'/status?token='+_0x309bcc[_0xeee2('0x24')]})['then'](function(_0x100d2a){if(_0x100d2a[_0xeee2('0x25')]){return _0x43a2a3[_0xeee2('0x18')]({'messageId':_0x100d2a[_0xeee2('0x25')]});}})[_0xeee2('0x1a')](function(_0x1cc691){logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),_0xeee2('0x1d'),util['inspect'](_0x1cc691,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xeee2('0x28'),'afterCreate','twilio',_0xeee2('0x29'));}break;case _0xeee2('0x2a'):var _0x3b26f5='https://api.skebby.it/API/v1.0/REST/';if(_0x309bcc[_0xeee2('0x2b')]&&_0x309bcc[_0xeee2('0x2c')]){var _0x3b2ef1={'recipient':[_0x258862[_0xeee2('0x21')]],'message':_0x258862[_0xeee2('0xb')],'message_type':_0x309bcc[_0xeee2('0x2d')]};if(_0x309bcc[_0xeee2('0x2d')]&&_0x309bcc[_0xeee2('0x2d')]!=='SI'){_0x3b2ef1[_0xeee2('0x2e')]=_0x309bcc[_0xeee2('0x21')];}var _0xae9c78={'url':_0x3b26f5+_0xeee2('0x2f')+_0x309bcc['username']+_0xeee2('0x30')+_0x309bcc[_0xeee2('0x2c')],'method':'GET'};rp(_0xae9c78)[_0xeee2('0x17')](function(_0x426f39){var _0x50fb48=_0x426f39[_0xeee2('0x31')](';');var _0x449ab1={'user_key':_0x50fb48[0x0],'session_key':_0x50fb48[0x1]};_0xae9c78={'url':_0x3b26f5+'sms','method':_0xeee2('0x32'),'headers':{'user_key':_0x449ab1['user_key'],'Session_key':_0x449ab1[_0xeee2('0x33')]},'json':!![],'body':_0x3b2ef1};return rp(_0xae9c78);})[_0xeee2('0x17')](function(_0x33fe4f){if(_0x33fe4f[_0xeee2('0x34')]>=0x1){var _0x2dc134={'messageId':_0x33fe4f[_0xeee2('0x35')]};if(_0x309bcc[_0xeee2('0x2d')]!=='GP'||!_0x309bcc[_0xeee2('0x36')]){_0x2dc134['read']=!![];}return _0x43a2a3[_0xeee2('0x18')](_0x2dc134);}else{return logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),'skebby',util[_0xeee2('0x37')](_0x33fe4f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x536a30){return logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),'skebby',util[_0xeee2('0x37')](_0x536a30,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),'afterCreate',_0xeee2('0x2a'),_0xeee2('0x38'));}break;case'connectel':if(_0x309bcc[_0xeee2('0x1f')]){var _0x423ee1={'recipient':_0x258862[_0xeee2('0x21')],'message':_0x258862[_0xeee2('0xb')],'sender':_0x309bcc[_0xeee2('0x39')]||_0x309bcc[_0xeee2('0x21')],'authorization':_0x309bcc['authToken']};var _0x2ade1d={'method':_0xeee2('0x32'),'uri':_0xeee2('0x3a'),'body':_0x423ee1,'json':!![]};rp(_0x2ade1d)[_0xeee2('0x17')](function(_0x4650d6){var _0x5015d6={'messageId':_0x4650d6[_0xeee2('0x3b')]};if(!_0x309bcc[_0xeee2('0x36')]){_0x5015d6[_0xeee2('0x3c')]=!![];}return _0x43a2a3[_0xeee2('0x18')](_0x5015d6);})[_0xeee2('0x1a')](function(_0x5cf6f4){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),_0xeee2('0x3d'),util[_0xeee2('0x37')](_0x5cf6f4,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),'afterCreate','connectel',_0xeee2('0x3e'));}break;case _0xeee2('0x3f'):if(_0x309bcc[_0xeee2('0x2b')]&&_0x309bcc[_0xeee2('0x2c')]){var _0x423ee1={'messages':[{'source':_0xeee2('0x40'),'to':_0x258862['phone'],'body':_0x258862[_0xeee2('0xb')],'from':_0x309bcc[_0xeee2('0x39')]||_0x309bcc['phone']}]};var _0x30557e=util[_0xeee2('0x41')](_0xeee2('0x42'),_0x309bcc[_0xeee2('0x2b')],_0x309bcc[_0xeee2('0x2c')]);var _0x2ade1d={'method':_0xeee2('0x32'),'uri':_0xeee2('0x43'),'body':_0x423ee1,'headers':{'Authorization':util['format'](_0xeee2('0x44'),new Buffer(_0x30557e)[_0xeee2('0x45')]('base64'))},'json':!![]};rp(_0x2ade1d)[_0xeee2('0x17')](function(_0x476f18){if(_0x476f18['http_code']>=0xc8&&_0x476f18[_0xeee2('0x46')]<=0xce){if(_0x476f18[_0xeee2('0x47')]&&_0x476f18[_0xeee2('0x47')][_0xeee2('0x48')]>0x0){var _0x42b03b=_[_0xeee2('0x49')](_0x476f18[_0xeee2('0x47')]['messages']);var _0x406397={'messageId':_0x42b03b['message_id']};if(!_0x309bcc['deliveryReport']){_0x406397[_0xeee2('0x3c')]=!![];}return _0x43a2a3[_0xeee2('0x18')](_0x406397);}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),'afterCreate',_0xeee2('0x4a'),util[_0xeee2('0x37')](_0x476f18,{'showHidden':![],'depth':null}));}}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x4a'),util['inspect'](_0x476f18,{'showHidden':![],'depth':null}));}})[_0xeee2('0x1a')](function(_0x11f8b8){logger['error'](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x4a'),util[_0xeee2('0x37')](_0x11f8b8,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xeee2('0x4b'):if(_0x309bcc['authId']&&_0x309bcc[_0xeee2('0x1f')]){var _0x423ee1={'dst':_0x258862[_0xeee2('0x21')],'text':_0x258862[_0xeee2('0xb')],'src':_0x309bcc[_0xeee2('0x39')]||_0x309bcc[_0xeee2('0x21')],'url':_0x309bcc[_0xeee2('0x22')]+_0xeee2('0x23')+_0x258862['id']+'/status?token='+_0x309bcc[_0xeee2('0x24')]};var _0x30557e=util[_0xeee2('0x41')](_0xeee2('0x42'),_0x309bcc['authId'],_0x309bcc[_0xeee2('0x1f')]);var _0x2ade1d={'method':_0xeee2('0x32'),'uri':util[_0xeee2('0x41')](_0xeee2('0x4c'),_0x309bcc[_0xeee2('0x4d')]),'body':_0x423ee1,'headers':{'Authorization':util[_0xeee2('0x41')](_0xeee2('0x44'),new Buffer(_0x30557e)[_0xeee2('0x45')](_0xeee2('0x4e')))},'json':!![]};rp(_0x2ade1d)[_0xeee2('0x17')](function(_0x1f7f9b){var _0x1dbea6={'messageId':_0x1f7f9b[_0xeee2('0x4f')][0x0]};return _0x43a2a3[_0xeee2('0x18')](_0x1dbea6);})[_0xeee2('0x1a')](function(_0x4cc9ca){logger['error'](_0xeee2('0x28'),'afterCreate',_0xeee2('0x4b'),util['inspect'](_0x4cc9ca,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),_0xeee2('0x4b'),_0xeee2('0x50'));}break;case _0xeee2('0x51'):if(_0x309bcc[_0xeee2('0x2b')]&&_0x309bcc[_0xeee2('0x2c')]){if(_0x309bcc['baseUrl']){var _0x171bb1={'method':_0xeee2('0x32'),'uri':_0x309bcc[_0xeee2('0x52')]+_0xeee2('0x53'),'body':{'username':_0x309bcc['username'],'password':_0x309bcc[_0xeee2('0x2c')]},'json':!![]};return rp(_0x171bb1)[_0xeee2('0x17')](function(_0x37916d){var _0x7520b7={'method':_0xeee2('0x32'),'uri':_0x309bcc[_0xeee2('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x309bcc['phone'],'destinations':[{'to':_0x258862['phone']}],'text':_0x258862[_0xeee2('0xb')],'notifyUrl':_0x309bcc[_0xeee2('0x22')]+_0xeee2('0x23')+_0x258862['id']+_0xeee2('0x54')+_0x309bcc['token'],'notifyContentType':_0xeee2('0x55'),'callbackData':_0x309bcc[_0xeee2('0x21')]+';'+_0x258862[_0xeee2('0xb')]}]},'headers':{'Authorization':_0xeee2('0x56')+_0x37916d[_0xeee2('0x24')]},'json':!![]};return rp(_0x7520b7)['then'](function(_0x20d7a6){if(_0x20d7a6['messages']){var _0x433b4a={'messageId':_0x20d7a6[_0xeee2('0x57')][0x0][_0xeee2('0x9')]};if(!_0x309bcc[_0xeee2('0x36')]){_0x433b4a[_0xeee2('0x3c')]=!![];}return _0x43a2a3['update'](_0x433b4a);}else{return logger[_0xeee2('0x26')](_0xeee2('0x28'),'afterCreate','infobip',util['inspect'](_0x20d7a6,{'showHidden':![],'depth':null}));}});})[_0xeee2('0x1a')](function(_0x4fc11e){return logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),'infobip',util[_0xeee2('0x37')](_0x4fc11e,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x51'),_0xeee2('0x58'));}}else{logger['error'](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x51'),_0xeee2('0x38'));}break;case _0xeee2('0x59'):var _0x40520a=require(_0xeee2('0x5a'));if(_0x309bcc[_0xeee2('0x5b')]){var _0x15b93={};_0x15b93['login']=_0x309bcc[_0xeee2('0x2b')];_0x15b93['phone']=_0x258862['phone'];_0x15b93[_0xeee2('0x2e')]=_0x309bcc[_0xeee2('0x21')];_0x15b93[_0xeee2('0x5c')]=_0x258862[_0xeee2('0xb')];_0x15b93['timestamp']=+new Date();var _0x3825c3='';var _0x3c5d4a='';var _0x2c219b=Object[_0xeee2('0x5d')](_0x15b93);_0x2c219b[_0xeee2('0x5e')]();for(var _0x4e9027=0x0;_0x4e9027<_0x2c219b['length'];_0x4e9027++){if(_0x3825c3!=''){_0x3825c3+='&';}_0x3825c3+=_0x2c219b[_0x4e9027]+'='+encodeURIComponent(_0x15b93[_0x2c219b[_0x4e9027]]);_0x3c5d4a+=_0x15b93[_0x2c219b[_0x4e9027]];}_0x3c5d4a+=_0x309bcc[_0xeee2('0x5b')];_0x3c5d4a=_0x40520a[_0xeee2('0x5f')](_0xeee2('0x60'))['update'](_0x3c5d4a)[_0xeee2('0x61')](_0xeee2('0x62'));if(_0x3825c3!==''){_0x3825c3+='&';}_0x3825c3+=_0xeee2('0x63')+_0x3c5d4a;var _0xae9c78={'method':_0xeee2('0x64'),'uri':_0x309bcc[_0xeee2('0x52')]+_0xeee2('0x65')+_0x3825c3,'json':!![]};return rp(_0xae9c78)[_0xeee2('0x17')](function(_0x5c35a7){var _0x18f959=Object[_0xeee2('0x5d')](_0x5c35a7);if(_0x5c35a7[_0x18f959[0x0]][_0xeee2('0x26')]&&parseInt(_0x5c35a7[_0x18f959[0x0]]['error'])===0x0){var _0x378f10={'messageId':_0x5c35a7[_0x18f959[0x0]][_0xeee2('0x66')]};if(!_0x309bcc[_0xeee2('0x36')]){_0x378f10[_0xeee2('0x3c')]=!![];}return _0x43a2a3[_0xeee2('0x18')](_0x378f10);}else{return logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),'csc',util['inspect'](_0x5c35a7[_0xeee2('0x26')],{'showHidden':![],'depth':null}));}})[_0xeee2('0x1a')](function(_0x52143e){return logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),_0xeee2('0x59'),util[_0xeee2('0x37')](_0x52143e,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),'csc',_0xeee2('0x67'));}break;case'clickatell':if(_0x309bcc[_0xeee2('0x5b')]){var _0xe2dbd6={'method':_0xeee2('0x32'),'uri':_0xeee2('0x68'),'headers':{'Authorization':_0x309bcc[_0xeee2('0x5b')]},'body':{'content':_0x258862['body'],'to':[_0x258862[_0xeee2('0x21')]],'from':_0x309bcc[_0xeee2('0x21')],'binary':![],'clientMessageId':'uuid','charset':_0xeee2('0x69')},'json':!![]};rp(_0xe2dbd6)[_0xeee2('0x17')](function(_0x1c4fed){if(!_0x1c4fed[_0xeee2('0x26')]){var _0x1c3a3b={'messageId':_0x1c4fed[_0xeee2('0x57')][0x0][_0xeee2('0x6a')]};if(!_0x309bcc[_0xeee2('0x36')]){_0x1c3a3b['read']=!![];}return _0x43a2a3[_0xeee2('0x18')](_0x1c3a3b);}else{return logger['error'](_0xeee2('0x28'),'afterCreate',_0xeee2('0x6b'),util[_0xeee2('0x37')](_0x1c4fed[_0xeee2('0x26')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xaa17f9){return logger['error'](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x6b'),util['inspect'](_0xaa17f9,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),'clickatell',_0xeee2('0x67'));}break;case'bandwidth':if(_0x309bcc[_0xeee2('0x2b')]&&_0x309bcc[_0xeee2('0x2c')]){var _0x30557e=util[_0xeee2('0x41')](_0xeee2('0x42'),_0x309bcc[_0xeee2('0x2b')],_0x309bcc[_0xeee2('0x2c')]);var _0x2ade1d={'method':_0xeee2('0x32'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x309bcc[_0xeee2('0x6c')]+'/messages','body':{'to':[_0x258862[_0xeee2('0x21')]],'text':_0x258862[_0xeee2('0xb')],'from':_0x309bcc['phone'],'applicationId':_0x309bcc[_0xeee2('0x6d')]},'headers':{'Authorization':util[_0xeee2('0x41')](_0xeee2('0x44'),new Buffer(_0x30557e)[_0xeee2('0x45')]('base64'))},'json':!![]};rp(_0x2ade1d)[_0xeee2('0x17')](function(_0x36c29c){if(_0x36c29c['id']){var _0x2e446d={'messageId':_0x36c29c['id']};return _0x43a2a3[_0xeee2('0x18')](_0x2e446d);}else{logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xeee2('0x6e'),util[_0xeee2('0x37')](_0x36c29c,{'showHidden':![],'depth':null}));}})[_0xeee2('0x1a')](function(_0x5e1f8c){logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x6e'),util[_0xeee2('0x37')](_0x5e1f8c,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),'bandwidth',_0xeee2('0x38'));}break;case _0xeee2('0x6f'):if(_0x309bcc[_0xeee2('0x5b')]){var _0x24a4af={};var _0xae9c78={'method':_0xeee2('0x32'),'uri':_0xeee2('0x70'),'headers':{'Authorization':_0xeee2('0x71')+_0x309bcc[_0xeee2('0x5b')],'Content-Type':'application/json'},'body':{'from':_0x309bcc[_0xeee2('0x21')],'to':_0x258862[_0xeee2('0x21')],'text':_0x258862[_0xeee2('0xb')]},'json':!![]};return rp(_0xae9c78)[_0xeee2('0x17')](function(_0x15c5c2){if(_0x15c5c2[_0xeee2('0x72')]==0xca){_0x24a4af[_0xeee2('0x73')]=_0x15c5c2;var _0xf3188d={'method':'POST','uri':_0xeee2('0x74'),'headers':{'Authorization':_0xeee2('0x71')+_0x309bcc[_0xeee2('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0x24a4af[_0xeee2('0x73')][_0xeee2('0x75')]},'json':!![]};return rp(_0xf3188d)[_0xeee2('0x17')](function(_0x117817){_0x24a4af[_0xeee2('0x76')]=_0x117817;var _0x45549a={'messageId':_0x24a4af[_0xeee2('0x73')][_0xeee2('0x75')],'read':!![]};return _0x43a2a3[_0xeee2('0x18')](_0x45549a);});}else{return logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),_0xeee2('0x6f'),util[_0xeee2('0x37')](_0x15c5c2,{'showHidden':![],'depth':null}));}})[_0xeee2('0x1a')](function(_0x2b6df0){return logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x6f'),util['inspect'](_0x2b6df0,{'showHidden':![],'depth':null}));});}else{return logger[_0xeee2('0x26')](_0xeee2('0x28'),'afterCreate',_0xeee2('0x6f'),'Token\x20not\x20received');}break;}}})[_0xeee2('0x77')](function(){_0x328dbb();});}else{_0x328dbb();}}},'charset':_0xeee2('0x78'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 17e1818..6059522 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 _0x7e37=['CreateSmsMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','request\x20sent','debug','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','SmsMessage','body','raw'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7e37,0x1f1));var _0x77e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e37[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x77e3('0x0'));var util=require(_0x77e3('0x1'));var moment=require(_0x77e3('0x2'));var BPromise=require(_0x77e3('0x3'));var rs=require(_0x77e3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77e3('0x5'))['db'];var utils=require(_0x77e3('0x6'));var logger=require(_0x77e3('0x7'))('rpc');var config=require(_0x77e3('0x8'));var jayson=require(_0x77e3('0x9'));var client=jayson['client'][_0x77e3('0xa')]({'port':0x232a});config[_0x77e3('0xb')]=_['defaults'](config[_0x77e3('0xb')],{'host':_0x77e3('0xc'),'port':0x18eb});var socket=require(_0x77e3('0xd'))(new Redis(config[_0x77e3('0xb')]));require(_0x77e3('0xe'))[_0x77e3('0xf')](socket);function respondWithRpcPromise(_0x213a0b,_0x494ccc,_0x284c67){return new BPromise(function(_0x146c6a,_0x201d4f){return client[_0x77e3('0x10')](_0x213a0b,_0x284c67)['then'](function(_0x48e19a){logger[_0x77e3('0x11')]('SmsMessage,\x20%s,\x20%s',_0x494ccc,_0x77e3('0x12'));logger[_0x77e3('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x494ccc,_0x77e3('0x12'),JSON[_0x77e3('0x14')](_0x48e19a));if(_0x48e19a[_0x77e3('0x15')]){if(_0x48e19a[_0x77e3('0x15')][_0x77e3('0x16')]===0x1f4){logger[_0x77e3('0x15')]('SmsMessage,\x20%s,\x20%s',_0x494ccc,_0x48e19a[_0x77e3('0x15')][_0x77e3('0x17')]);return _0x201d4f(_0x48e19a[_0x77e3('0x15')][_0x77e3('0x17')]);}logger[_0x77e3('0x15')]('SmsMessage,\x20%s,\x20%s',_0x494ccc,_0x48e19a[_0x77e3('0x15')][_0x77e3('0x17')]);return _0x146c6a(_0x48e19a['error'][_0x77e3('0x17')]);}else{logger[_0x77e3('0x11')](_0x77e3('0x18'),_0x494ccc,'request\x20sent');_0x146c6a(_0x48e19a[_0x77e3('0x19')]['message']);}})[_0x77e3('0x1a')](function(_0x3ca4b8){logger[_0x77e3('0x15')](_0x77e3('0x18'),_0x494ccc,_0x3ca4b8);_0x201d4f(_0x3ca4b8);});});}exports['CreateSmsMessage']=function(_0x17bceb){var _0x3be15f=this;return new Promise(function(_0x2836a1,_0x11f801){return db[_0x77e3('0x1b')]['create'](_0x17bceb[_0x77e3('0x1c')],{'raw':_0x17bceb['options']?_0x17bceb['options'][_0x77e3('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x57b130){logger['info']('CreateSmsMessage',_0x17bceb);logger[_0x77e3('0x13')](_0x77e3('0x1e'),_0x17bceb,JSON['stringify'](_0x57b130));_0x2836a1(_0x57b130);})['catch'](function(_0x4275b7){logger['error'](_0x77e3('0x1e'),_0x4275b7[_0x77e3('0x17')],_0x17bceb);_0x11f801(_0x3be15f[_0x77e3('0x15')](0x1f4,_0x4275b7[_0x77e3('0x17')]));});});}; \ No newline at end of file +var _0x1c87=['socket.io-emitter','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','body','options','CreateSmsMessage','catch','lodash','util','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x264fb4,_0x341524){var _0x5a6a16=function(_0x2518d8){while(--_0x2518d8){_0x264fb4['push'](_0x264fb4['shift']());}};_0x5a6a16(++_0x341524);}(_0x1c87,0x151));var _0x71c8=function(_0x23eaad,_0x2ef62f){_0x23eaad=_0x23eaad-0x0;var _0x525ca5=_0x1c87[_0x23eaad];return _0x525ca5;};'use strict';var _=require(_0x71c8('0x0'));var util=require(_0x71c8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x71c8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x71c8('0x3'))(_0x71c8('0x4'));var config=require(_0x71c8('0x5'));var jayson=require(_0x71c8('0x6'));var client=jayson['client'][_0x71c8('0x7')]({'port':0x232a});config[_0x71c8('0x8')]=_[_0x71c8('0x9')](config[_0x71c8('0x8')],{'host':_0x71c8('0xa'),'port':0x18eb});var socket=require(_0x71c8('0xb'))(new Redis(config[_0x71c8('0x8')]));require(_0x71c8('0xc'))[_0x71c8('0xd')](socket);function respondWithRpcPromise(_0x1c86d2,_0x58bbdf,_0x4929a6){return new BPromise(function(_0x4bcce5,_0x1616e0){return client['request'](_0x1c86d2,_0x4929a6)[_0x71c8('0xe')](function(_0x5072f8){logger[_0x71c8('0xf')](_0x71c8('0x10'),_0x58bbdf,'request\x20sent');logger[_0x71c8('0x11')](_0x71c8('0x12'),_0x58bbdf,'request\x20sent',JSON[_0x71c8('0x13')](_0x5072f8));if(_0x5072f8[_0x71c8('0x14')]){if(_0x5072f8[_0x71c8('0x14')][_0x71c8('0x15')]===0x1f4){logger[_0x71c8('0x14')](_0x71c8('0x10'),_0x58bbdf,_0x5072f8[_0x71c8('0x14')]['message']);return _0x1616e0(_0x5072f8[_0x71c8('0x14')][_0x71c8('0x16')]);}logger[_0x71c8('0x14')]('SmsMessage,\x20%s,\x20%s',_0x58bbdf,_0x5072f8[_0x71c8('0x14')][_0x71c8('0x16')]);return _0x4bcce5(_0x5072f8[_0x71c8('0x14')]['message']);}else{logger['info'](_0x71c8('0x10'),_0x58bbdf,_0x71c8('0x17'));_0x4bcce5(_0x5072f8[_0x71c8('0x18')][_0x71c8('0x16')]);}})['catch'](function(_0x175a1d){logger[_0x71c8('0x14')](_0x71c8('0x10'),_0x58bbdf,_0x175a1d);_0x1616e0(_0x175a1d);});});}exports['CreateSmsMessage']=function(_0x5bb798){var _0x4bbbfe=this;return new Promise(function(_0x1c123c,_0xb805ba){return db['SmsMessage']['create'](_0x5bb798[_0x71c8('0x19')],{'raw':_0x5bb798[_0x71c8('0x1a')]?_0x5bb798[_0x71c8('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3984d9){logger[_0x71c8('0xf')](_0x71c8('0x1b'),_0x5bb798);logger[_0x71c8('0x11')](_0x71c8('0x1b'),_0x5bb798,JSON['stringify'](_0x3984d9));_0x1c123c(_0x3984d9);})[_0x71c8('0x1c')](function(_0x31c818){logger[_0x71c8('0x14')](_0x71c8('0x1b'),_0x31c818[_0x71c8('0x16')],_0x5bb798);_0xb805ba(_0x4bbbfe[_0x71c8('0x14')](0x1f4,_0x31c818['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 4bdce39..5672278 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 _0x6b37=['update','emit','register','smsMessage:','./smsMessage.events','save','remove'];(function(_0x1fe116,_0x42e204){var _0x449370=function(_0x2bfdac){while(--_0x2bfdac){_0x1fe116['push'](_0x1fe116['shift']());}};_0x449370(++_0x42e204);}(_0x6b37,0x1af));var _0x76b3=function(_0x1b4695,_0x3a90e3){_0x1b4695=_0x1b4695-0x0;var _0x376a90=_0x6b37[_0x1b4695];return _0x376a90;};'use strict';var SmsMessageEvents=require(_0x76b3('0x0'));var events=[_0x76b3('0x1'),_0x76b3('0x2'),_0x76b3('0x3')];function createListener(_0xefd4c8,_0x515285){return function(_0x392ee3){_0x515285[_0x76b3('0x4')](_0xefd4c8,_0x392ee3);};}function removeListener(_0x50cf29,_0x54d721){return function(){SmsMessageEvents['removeListener'](_0x50cf29,_0x54d721);};}exports[_0x76b3('0x5')]=function(_0x3a4cda){for(var _0x1e833e=0x0,_0x3d97eb=events['length'];_0x1e833e<_0x3d97eb;_0x1e833e++){var _0x383eaf=events[_0x1e833e];var _0x44ef21=createListener(_0x76b3('0x6')+_0x383eaf,_0x3a4cda);SmsMessageEvents['on'](_0x383eaf,_0x44ef21);}}; \ No newline at end of file +var _0xceaa=['emit','register','length','./smsMessage.events','save'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0xceaa,0x6c));var _0xacea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceaa[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0xacea('0x0'));var events=[_0xacea('0x1'),'remove','update'];function createListener(_0x75a262,_0x5b2a12){return function(_0x3d98a8){_0x5b2a12[_0xacea('0x2')](_0x75a262,_0x3d98a8);};}function removeListener(_0xe10826,_0x58a484){return function(){SmsMessageEvents['removeListener'](_0xe10826,_0x58a484);};}exports[_0xacea('0x3')]=function(_0x595060){for(var _0x48f04b=0x0,_0x29cf85=events[_0xacea('0x4')];_0x48f04b<_0x29cf85;_0x48f04b++){var _0x5c793a=events[_0x48f04b];var _0x373faf=createListener('smsMessage:'+_0x5c793a,_0x595060);SmsMessageEvents['on'](_0x5c793a,_0x373faf);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index f4cadf4..540751b 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 _0x2b47=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x2b47,0x177));var _0x72b4=function(_0x25d729,_0x20c319){_0x25d729=_0x25d729-0x0;var _0x1293b0=_0x2b47[_0x25d729];return _0x1293b0;};'use strict';var multer=require(_0x72b4('0x0'));var util=require('util');var path=require(_0x72b4('0x1'));var timeout=require(_0x72b4('0x2'));var express=require(_0x72b4('0x3'));var router=express['Router']();var auth=require(_0x72b4('0x4'));var interaction=require(_0x72b4('0x5'));var config=require(_0x72b4('0x6'));var controller=require(_0x72b4('0x7'));router[_0x72b4('0x8')]('/',auth[_0x72b4('0x9')](),controller['index']);router[_0x72b4('0x8')]('/describe',auth[_0x72b4('0x9')](),controller[_0x72b4('0xa')]);router[_0x72b4('0x8')](_0x72b4('0xb'),auth[_0x72b4('0x9')](),controller[_0x72b4('0xc')]);router[_0x72b4('0x8')](_0x72b4('0xd'),auth[_0x72b4('0x9')](),controller[_0x72b4('0xe')]);router[_0x72b4('0x8')]('/:id/teams',auth[_0x72b4('0x9')](),controller[_0x72b4('0xf')]);router[_0x72b4('0x8')](_0x72b4('0x10'),auth[_0x72b4('0x9')](),controller[_0x72b4('0x11')]);router[_0x72b4('0x12')]('/',auth[_0x72b4('0x9')](),controller[_0x72b4('0x13')]);router[_0x72b4('0x12')](_0x72b4('0x14'),auth['isAuthenticated'](),controller[_0x72b4('0x15')]);router[_0x72b4('0x12')](_0x72b4('0x10'),auth[_0x72b4('0x9')](),controller['addAgents']);router['put'](_0x72b4('0xb'),auth['isAuthenticated'](),controller[_0x72b4('0x16')]);router[_0x72b4('0x17')]('/:id',auth[_0x72b4('0x9')](),controller[_0x72b4('0x18')]);router[_0x72b4('0x17')](_0x72b4('0x14'),auth[_0x72b4('0x9')](),controller[_0x72b4('0x19')]);router[_0x72b4('0x17')](_0x72b4('0x10'),auth[_0x72b4('0x9')](),controller['removeAgents']);module[_0x72b4('0x1a')]=router; \ No newline at end of file +var _0x31c2=['delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update'];(function(_0x58fac9,_0x290a65){var _0x35da60=function(_0xff9be0){while(--_0xff9be0){_0x58fac9['push'](_0x58fac9['shift']());}};_0x35da60(++_0x290a65);}(_0x31c2,0x1e1));var _0x231c=function(_0x1b1353,_0x8b7000){_0x1b1353=_0x1b1353-0x0;var _0x1cc5d1=_0x31c2[_0x1b1353];return _0x1cc5d1;};'use strict';var multer=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var path=require(_0x231c('0x2'));var timeout=require(_0x231c('0x3'));var express=require(_0x231c('0x4'));var router=express[_0x231c('0x5')]();var auth=require(_0x231c('0x6'));var interaction=require(_0x231c('0x7'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x231c('0x8')]('/',auth[_0x231c('0x9')](),controller[_0x231c('0xa')]);router[_0x231c('0x8')]('/describe',auth[_0x231c('0x9')](),controller['describe']);router[_0x231c('0x8')](_0x231c('0xb'),auth[_0x231c('0x9')](),controller['show']);router[_0x231c('0x8')](_0x231c('0xc'),auth[_0x231c('0x9')](),controller[_0x231c('0xd')]);router[_0x231c('0x8')](_0x231c('0xe'),auth[_0x231c('0x9')](),controller['getTeams']);router[_0x231c('0x8')](_0x231c('0xf'),auth['isAuthenticated'](),controller[_0x231c('0x10')]);router[_0x231c('0x11')]('/',auth[_0x231c('0x9')](),controller[_0x231c('0x12')]);router[_0x231c('0x11')](_0x231c('0xe'),auth[_0x231c('0x9')](),controller[_0x231c('0x13')]);router[_0x231c('0x11')](_0x231c('0xf'),auth[_0x231c('0x9')](),controller[_0x231c('0x14')]);router[_0x231c('0x15')](_0x231c('0xb'),auth[_0x231c('0x9')](),controller[_0x231c('0x16')]);router[_0x231c('0x17')](_0x231c('0xb'),auth[_0x231c('0x9')](),controller[_0x231c('0x18')]);router['delete'](_0x231c('0xe'),auth[_0x231c('0x9')](),controller[_0x231c('0x19')]);router[_0x231c('0x17')](_0x231c('0xf'),auth[_0x231c('0x9')](),controller[_0x231c('0x1a')]);module[_0x231c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index e172b79..7c008bc 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 _0x6be8=['beepall','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x6be8,0x71));var _0x86be=function(_0x206dbd,_0x22bc5f){_0x206dbd=_0x206dbd-0x0;var _0x49a63a=_0x6be8[_0x206dbd];return _0x49a63a;};'use strict';var Sequelize=require(_0x86be('0x0'));module[_0x86be('0x1')]={'name':{'type':Sequelize[_0x86be('0x2')],'unique':_0x86be('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x86be('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x86be('0x4')](_0x86be('0x5'),_0x86be('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x9775=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x4a7c85,_0x258db3){var _0x4194ec=function(_0x4a8475){while(--_0x4a8475){_0x4a7c85['push'](_0x4a7c85['shift']());}};_0x4194ec(++_0x258db3);}(_0x9775,0x13b));var _0x5977=function(_0x3b4943,_0x481b16){_0x3b4943=_0x3b4943-0x0;var _0x15c6a6=_0x9775[_0x3b4943];return _0x15c6a6;};'use strict';var Sequelize=require('sequelize');module[_0x5977('0x0')]={'name':{'type':Sequelize[_0x5977('0x1')],'unique':_0x5977('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5977('0x3')](_0x5977('0x4'),_0x5977('0x5'),_0x5977('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index e72399b..2d5eb2d 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 _0xb458=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','SmsQueues','UserProfileResource','destroy','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','hasOwnProperty','ids','Team','Agents','online','voicePause','transaction','addTeams','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','tq.TeamId','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','all','union','value','isEmpty','addAgents','omit','spread','removeAgents','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0x3e779a,_0x5c52fb){var _0x272de2=function(_0x4d3179){while(--_0x4d3179){_0x3e779a['push'](_0x3e779a['shift']());}};_0x272de2(++_0x5c52fb);}(_0xb458,0x103));var _0x8b45=function(_0x15feaf,_0x53ff1c){_0x15feaf=_0x15feaf-0x0;var _0x4dbbec=_0xb458[_0x15feaf];return _0x4dbbec;};'use strict';var pdf=require(_0x8b45('0x0'));var emlformat=require(_0x8b45('0x1'));var rimraf=require(_0x8b45('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8b45('0x3'));var moment=require(_0x8b45('0x4'));var BPromise=require(_0x8b45('0x5'));var Mustache=require(_0x8b45('0x6'));var util=require('util');var path=require(_0x8b45('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8b45('0x8'));var fs=require('fs');var _=require(_0x8b45('0x9'));var squel=require(_0x8b45('0xa'));var crypto=require(_0x8b45('0xb'));var jsforce=require(_0x8b45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xd'));var querystring=require(_0x8b45('0xe'));var Papa=require(_0x8b45('0xf'));var Redis=require(_0x8b45('0x10'));var authService=require(_0x8b45('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b45('0x12'));var hardwareService=require(_0x8b45('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b45('0x14'));var db=require(_0x8b45('0x15'))['db'];config[_0x8b45('0x16')]=_['defaults'](config[_0x8b45('0x16')],{'host':_0x8b45('0x17'),'port':0x18eb});var socket=require(_0x8b45('0x18'))(new Redis(config[_0x8b45('0x16')]));require(_0x8b45('0x19'))[_0x8b45('0x1a')](socket);function respondWithStatusCode(_0x5f0b20,_0x5a14c1){_0x5a14c1=_0x5a14c1||0xcc;return function(_0x45881c){if(_0x45881c){return _0x5f0b20[_0x8b45('0x1b')](_0x5a14c1);}return _0x5f0b20[_0x8b45('0x1c')](_0x5a14c1)[_0x8b45('0x1d')]();};}function respondWithResult(_0x4781d7,_0x27ebb3){_0x27ebb3=_0x27ebb3||0xc8;return function(_0x902c50){if(_0x902c50){return _0x4781d7[_0x8b45('0x1c')](_0x27ebb3)[_0x8b45('0x1e')](_0x902c50);}};}function respondWithFilteredResult(_0x391d1e,_0x287a3b){return function(_0x21d5b2){if(_0x21d5b2){var _0x1ed5ca=_0x21d5b2[_0x8b45('0x1f')],_0x43ffb7=_0x287a3b[_0x8b45('0x20')],_0x1623d8=_0x287a3b['offset']+_0x287a3b[_0x8b45('0x21')],_0x31c6b4;if(_0x1623d8>=_0x1ed5ca){_0x1623d8=_0x1ed5ca;_0x31c6b4=0xc8;}else{_0x31c6b4=0xce;}_0x391d1e[_0x8b45('0x1c')](_0x31c6b4);return _0x391d1e[_0x8b45('0x22')](_0x8b45('0x23'),_0x43ffb7+'-'+_0x1623d8+'/'+_0x1ed5ca)[_0x8b45('0x1e')](_0x21d5b2);}return null;};}function patchUpdates(_0x23eae6){return function(_0x2f4f1c){try{jsonpatch[_0x8b45('0x24')](_0x2f4f1c,_0x23eae6,!![]);}catch(_0x563c50){return BPromise['reject'](_0x563c50);}return _0x2f4f1c[_0x8b45('0x25')]();};}function saveUpdates(_0x580e17,_0x1952fc){return function(_0x3ddb50){if(_0x3ddb50){return _0x3ddb50[_0x8b45('0x26')](_0x580e17)[_0x8b45('0x27')](function(_0x165570){return _0x165570;});}return null;};}function removeEntity(_0x2b8526,_0x32b12b){return function(_0x5563eb){if(_0x5563eb){return _0x5563eb['destroy']()[_0x8b45('0x27')](function(){var _0x2c2c06=_0x5563eb['get']({'plain':!![]});var _0x5723a2=_0x8b45('0x28');return db[_0x8b45('0x29')][_0x8b45('0x2a')]({'where':{'type':_0x5723a2,'resourceId':_0x2c2c06['id']}})[_0x8b45('0x27')](function(){return _0x5563eb;});})['then'](function(){_0x2b8526[_0x8b45('0x1c')](0xcc)[_0x8b45('0x1d')]();});}};}function handleEntityNotFound(_0x21b588,_0x9de2ad){return function(_0x395dc3){if(!_0x395dc3){_0x21b588[_0x8b45('0x1b')](0x194);}return _0x395dc3;};}function handleError(_0x461017,_0x234f62){_0x234f62=_0x234f62||0x1f4;return function(_0x1733a7){logger[_0x8b45('0x2b')](_0x1733a7[_0x8b45('0x2c')]);if(_0x1733a7[_0x8b45('0x2d')]){delete _0x1733a7[_0x8b45('0x2d')];}_0x461017['status'](_0x234f62)[_0x8b45('0x2e')](_0x1733a7);};}exports[_0x8b45('0x2f')]=function(_0x34eb03,_0x15107a){var _0x2eb4c2={},_0x638f26={},_0x1a8974={'count':0x0,'rows':[]};var _0x4216bf=_['map'](db[_0x8b45('0x30')][_0x8b45('0x31')],function(_0x50302){return{'name':_0x50302[_0x8b45('0x32')],'type':_0x50302[_0x8b45('0x33')]['key']};});_0x638f26[_0x8b45('0x34')]=_['map'](_0x4216bf,'name');_0x638f26[_0x8b45('0x35')]=_[_0x8b45('0x36')](_0x34eb03[_0x8b45('0x35')]);_0x638f26[_0x8b45('0x37')]=_[_0x8b45('0x38')](_0x638f26[_0x8b45('0x34')],_0x638f26['query']);_0x2eb4c2[_0x8b45('0x39')]=_[_0x8b45('0x38')](_0x638f26[_0x8b45('0x34')],qs[_0x8b45('0x3a')](_0x34eb03['query'][_0x8b45('0x3a')]));_0x2eb4c2[_0x8b45('0x39')]=_0x2eb4c2[_0x8b45('0x39')]['length']?_0x2eb4c2[_0x8b45('0x39')]:_0x638f26[_0x8b45('0x34')];if(!_0x34eb03[_0x8b45('0x35')]['hasOwnProperty'](_0x8b45('0x3b'))){_0x2eb4c2[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x34eb03[_0x8b45('0x35')]['limit']);_0x2eb4c2[_0x8b45('0x20')]=qs[_0x8b45('0x20')](_0x34eb03[_0x8b45('0x35')][_0x8b45('0x20')]);}_0x2eb4c2[_0x8b45('0x3c')]=qs[_0x8b45('0x3d')](_0x34eb03['query']['sort']);_0x2eb4c2[_0x8b45('0x3e')]=qs[_0x8b45('0x37')](_[_0x8b45('0x3f')](_0x34eb03[_0x8b45('0x35')],_0x638f26[_0x8b45('0x37')]),_0x4216bf);if(_0x34eb03['query'][_0x8b45('0x40')]){_0x2eb4c2['where']=_[_0x8b45('0x41')](_0x2eb4c2[_0x8b45('0x3e')],{'$or':_[_0x8b45('0x42')](_0x4216bf,function(_0x280bb0){if(_0x280bb0[_0x8b45('0x33')]!==_0x8b45('0x43')){var _0x14d665={};_0x14d665[_0x280bb0[_0x8b45('0x2d')]]={'$like':'%'+_0x34eb03[_0x8b45('0x35')][_0x8b45('0x40')]+'%'};return _0x14d665;}})});}_0x2eb4c2=_[_0x8b45('0x41')]({},_0x2eb4c2,_0x34eb03['options']);var _0x12ea31={'where':_0x2eb4c2['where']};return db[_0x8b45('0x30')]['count'](_0x12ea31)[_0x8b45('0x27')](function(_0x224c45){_0x1a8974[_0x8b45('0x1f')]=_0x224c45;if(_0x34eb03[_0x8b45('0x35')][_0x8b45('0x44')]){_0x2eb4c2[_0x8b45('0x45')]=[{'all':!![]}];}return db['SmsQueue'][_0x8b45('0x46')](_0x2eb4c2);})['then'](function(_0x4c56c8){_0x1a8974[_0x8b45('0x47')]=_0x4c56c8;return _0x1a8974;})[_0x8b45('0x27')](respondWithFilteredResult(_0x15107a,_0x2eb4c2))[_0x8b45('0x48')](handleError(_0x15107a,null));};exports['show']=function(_0x1f12cb,_0x56317d){var _0x13c36d={'raw':!![],'where':{'id':_0x1f12cb[_0x8b45('0x49')]['id']}},_0x1055db={};_0x1055db[_0x8b45('0x34')]=_[_0x8b45('0x36')](db[_0x8b45('0x30')]['rawAttributes']);_0x1055db[_0x8b45('0x35')]=_[_0x8b45('0x36')](_0x1f12cb[_0x8b45('0x35')]);_0x1055db[_0x8b45('0x37')]=_[_0x8b45('0x38')](_0x1055db[_0x8b45('0x34')],_0x1055db[_0x8b45('0x35')]);_0x13c36d[_0x8b45('0x39')]=_[_0x8b45('0x38')](_0x1055db[_0x8b45('0x34')],qs[_0x8b45('0x3a')](_0x1f12cb[_0x8b45('0x35')][_0x8b45('0x3a')]));_0x13c36d[_0x8b45('0x39')]=_0x13c36d[_0x8b45('0x39')][_0x8b45('0x4a')]?_0x13c36d['attributes']:_0x1055db['model'];if(_0x1f12cb['query'][_0x8b45('0x44')]){_0x13c36d[_0x8b45('0x45')]=[{'all':!![]}];}_0x13c36d=_[_0x8b45('0x41')]({},_0x13c36d,_0x1f12cb[_0x8b45('0x4b')]);return db[_0x8b45('0x30')][_0x8b45('0x4c')](_0x13c36d)[_0x8b45('0x27')](handleEntityNotFound(_0x56317d,null))[_0x8b45('0x27')](respondWithResult(_0x56317d,null))['catch'](handleError(_0x56317d,null));};exports[_0x8b45('0x4d')]=function(_0x5d5be2,_0x23b5c6){return db[_0x8b45('0x30')][_0x8b45('0x4d')](_0x5d5be2[_0x8b45('0x4e')],{})['then'](function(_0xc49b81){var _0x1278aa=_0x5d5be2['user'][_0x8b45('0x4f')]({'plain':!![]});if(!_0x1278aa)throw new Error(_0x8b45('0x50'));if(_0x1278aa['role']===_0x8b45('0x51')){var _0x5758c=_0xc49b81[_0x8b45('0x4f')]({'plain':!![]});var _0x3b4a4f=_0x8b45('0x28');return db[_0x8b45('0x52')]['find']({'where':{'name':_0x3b4a4f,'userProfileId':_0x1278aa['userProfileId']},'raw':!![]})[_0x8b45('0x27')](function(_0x2a2e59){if(_0x2a2e59&&_0x2a2e59[_0x8b45('0x53')]===0x0){return db['UserProfileResource'][_0x8b45('0x4d')]({'name':_0x5758c[_0x8b45('0x2d')],'resourceId':_0x5758c['id'],'type':_0x2a2e59[_0x8b45('0x2d')],'sectionId':_0x2a2e59['id']},{})[_0x8b45('0x27')](function(){return _0xc49b81;});}else{return _0xc49b81;}})[_0x8b45('0x48')](function(_0x597402){logger[_0x8b45('0x2b')](_0x8b45('0x54'),_0x597402);throw _0x597402;});}return _0xc49b81;})['then'](respondWithResult(_0x23b5c6,0xc9))[_0x8b45('0x48')](handleError(_0x23b5c6,null));};exports['update']=function(_0x20b62e,_0x35ba88){if(_0x20b62e[_0x8b45('0x4e')]['id']){delete _0x20b62e[_0x8b45('0x4e')]['id'];}return db['SmsQueue'][_0x8b45('0x4c')]({'where':{'id':_0x20b62e[_0x8b45('0x49')]['id']}})[_0x8b45('0x27')](handleEntityNotFound(_0x35ba88,null))[_0x8b45('0x27')](saveUpdates(_0x20b62e[_0x8b45('0x4e')],null))[_0x8b45('0x27')](respondWithResult(_0x35ba88,null))[_0x8b45('0x48')](handleError(_0x35ba88,null));};exports[_0x8b45('0x2a')]=function(_0x446fe5,_0x5ba878){return db[_0x8b45('0x30')][_0x8b45('0x4c')]({'where':{'id':_0x446fe5[_0x8b45('0x49')]['id']}})[_0x8b45('0x27')](handleEntityNotFound(_0x5ba878,null))[_0x8b45('0x27')](removeEntity(_0x5ba878,null))['catch'](handleError(_0x5ba878,null));};exports[_0x8b45('0x55')]=function(_0x1477bd,_0x15c9ae){return db['SmsQueue'][_0x8b45('0x55')]()[_0x8b45('0x27')](respondWithResult(_0x15c9ae,null))[_0x8b45('0x48')](handleError(_0x15c9ae,null));};exports[_0x8b45('0x56')]=function(_0x5795ca,_0x456c0e,_0x1a8822){var _0x1d99bb={'raw':!![],'where':{}},_0xbb5e67={},_0x5257a1;return db[_0x8b45('0x30')][_0x8b45('0x57')]({'where':{'id':_0x5795ca[_0x8b45('0x49')]['id']}})[_0x8b45('0x27')](handleEntityNotFound(_0x456c0e,null))[_0x8b45('0x27')](function(_0x557473){if(_0x557473){_0x5257a1=_0x557473[_0x8b45('0x4f')]({'plain':!![]});_0xbb5e67['model']=_[_0x8b45('0x36')](db[_0x8b45('0x58')][_0x8b45('0x31')]);_0xbb5e67[_0x8b45('0x35')]=_[_0x8b45('0x36')](_0x5795ca[_0x8b45('0x35')]);_0xbb5e67['filters']=_['intersection'](_0xbb5e67[_0x8b45('0x34')],_0xbb5e67[_0x8b45('0x35')]);_0x1d99bb['attributes']=_[_0x8b45('0x38')](_0xbb5e67[_0x8b45('0x34')],qs[_0x8b45('0x3a')](_0x5795ca['query']['fields']));_0x1d99bb[_0x8b45('0x39')]=_0x1d99bb[_0x8b45('0x39')]['length']?_0x1d99bb[_0x8b45('0x39')]:_0xbb5e67['model'];if(!_0x5795ca[_0x8b45('0x35')]['hasOwnProperty']('nolimit')){_0x1d99bb[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x5795ca['query'][_0x8b45('0x21')]);_0x1d99bb[_0x8b45('0x20')]=qs[_0x8b45('0x20')](_0x5795ca[_0x8b45('0x35')][_0x8b45('0x20')]);}_0x1d99bb['order']=qs[_0x8b45('0x3d')](_0x5795ca[_0x8b45('0x35')][_0x8b45('0x3d')]);_0x1d99bb['where']=qs['filters'](_[_0x8b45('0x3f')](_0x5795ca['query'],_0xbb5e67[_0x8b45('0x37')]));_0x1d99bb['where']['SmsQueueId']=_0x557473['id'];if(_0x5795ca['query'][_0x8b45('0x40')]){_0x1d99bb['where']=_[_0x8b45('0x41')](_0x1d99bb[_0x8b45('0x3e')],{'$or':_['map'](_0x1d99bb[_0x8b45('0x39')],function(_0x1b3890){var _0x5f3477={};_0x5f3477[_0x1b3890]={'$like':'%'+_0x5795ca[_0x8b45('0x35')][_0x8b45('0x40')]+'%'};return _0x5f3477;})});}_0x1d99bb=_[_0x8b45('0x41')]({},_0x1d99bb,_0x5795ca[_0x8b45('0x4b')]);return db[_0x8b45('0x58')][_0x8b45('0x46')](_0x1d99bb);}})[_0x8b45('0x27')](function(_0x35048c){if(_0x35048c){return db[_0x8b45('0x59')][_0x8b45('0x5a')]({'where':{'id':_[_0x8b45('0x42')](_0x35048c,_0x8b45('0x5b')),'role':'agent'},'attributes':['id',_0x8b45('0x2d'),_0x8b45('0x5c'),_0x8b45('0x5d'),_0x8b45('0x5e')]});}})[_0x8b45('0x27')](function(_0x304e7d){if(_0x304e7d){return{'count':_0x304e7d[_0x8b45('0x1f')],'rows':_[_0x8b45('0x42')](_0x304e7d[_0x8b45('0x47')],function(_0x1542db){return{'membername':_0x1542db[_0x8b45('0x2d')],'UserId':_0x1542db['id'],'queue_name':_0x5257a1[_0x8b45('0x2d')],'SmsQueueId':_0x5257a1['id'],'interface':util[_0x8b45('0x5f')](_0x8b45('0x60'),_0x8b45('0x61'),_0x1542db['name']),'penalty':0x0,'paused':_0x1542db[_0x8b45('0x5c')],'createdAt':_0x1542db[_0x8b45('0x5e')],'updatedAt':_0x1542db[_0x8b45('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8b45('0x27')](respondWithFilteredResult(_0x456c0e,_0x1d99bb))[_0x8b45('0x48')](handleError(_0x456c0e,null));};exports[_0x8b45('0x62')]=function(_0x1ebbca,_0x1e7c12,_0x47d8f7){var _0xd59cf2={};var _0x2140c2={};var _0x1a3cfa;var _0xa22bd0;return db[_0x8b45('0x30')][_0x8b45('0x57')]({'where':{'id':_0x1ebbca[_0x8b45('0x49')]['id']}})[_0x8b45('0x27')](handleEntityNotFound(_0x1e7c12,null))[_0x8b45('0x27')](function(_0xd19d7c){if(_0xd19d7c){_0x1a3cfa=_0xd19d7c;_0x2140c2[_0x8b45('0x34')]=_['keys'](db['Team'][_0x8b45('0x31')]);_0x2140c2[_0x8b45('0x35')]=_[_0x8b45('0x36')](_0x1ebbca[_0x8b45('0x35')]);_0x2140c2[_0x8b45('0x37')]=_[_0x8b45('0x38')](_0x2140c2[_0x8b45('0x34')],_0x2140c2[_0x8b45('0x35')]);_0xd59cf2[_0x8b45('0x39')]=_['intersection'](_0x2140c2['model'],qs[_0x8b45('0x3a')](_0x1ebbca[_0x8b45('0x35')][_0x8b45('0x3a')]));_0xd59cf2[_0x8b45('0x39')]=_0xd59cf2['attributes'][_0x8b45('0x4a')]?_0xd59cf2[_0x8b45('0x39')]:_0x2140c2[_0x8b45('0x34')];_0xd59cf2[_0x8b45('0x3c')]=qs[_0x8b45('0x3d')](_0x1ebbca[_0x8b45('0x35')]['sort']);_0xd59cf2['where']=qs[_0x8b45('0x37')](_['pick'](_0x1ebbca['query'],_0x2140c2['filters']));if(_0x1ebbca[_0x8b45('0x35')][_0x8b45('0x40')]){_0xd59cf2[_0x8b45('0x3e')]=_[_0x8b45('0x41')](_0xd59cf2[_0x8b45('0x3e')],{'$or':_[_0x8b45('0x42')](_0xd59cf2[_0x8b45('0x39')],function(_0xc9be77){var _0xc89fc6={};_0xc89fc6[_0xc9be77]={'$like':'%'+_0x1ebbca[_0x8b45('0x35')][_0x8b45('0x40')]+'%'};return _0xc89fc6;})});}_0xd59cf2=_[_0x8b45('0x41')]({},_0xd59cf2,_0x1ebbca[_0x8b45('0x4b')]);return _0x1a3cfa[_0x8b45('0x62')](_0xd59cf2);}})[_0x8b45('0x27')](function(_0x4a42e1){if(_0x4a42e1){_0xa22bd0=_0x4a42e1[_0x8b45('0x4a')];if(!_0x1ebbca[_0x8b45('0x35')][_0x8b45('0x63')](_0x8b45('0x3b'))){_0xd59cf2[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x1ebbca[_0x8b45('0x35')][_0x8b45('0x21')]);_0xd59cf2[_0x8b45('0x20')]=qs[_0x8b45('0x20')](_0x1ebbca['query'][_0x8b45('0x20')]);}return _0x1a3cfa[_0x8b45('0x62')](_0xd59cf2);}})[_0x8b45('0x27')](function(_0x3bb913){if(_0x3bb913){return _0x3bb913?{'count':_0xa22bd0,'rows':_0x3bb913}:null;}})['then'](respondWithResult(_0x1e7c12,null))[_0x8b45('0x48')](handleError(_0x1e7c12,null));};exports['addTeams']=function(_0x34c7dd,_0x55acc4,_0x2d3b89){var _0x6966ea=_0x34c7dd[_0x8b45('0x4e')][_0x8b45('0x64')];return db[_0x8b45('0x65')][_0x8b45('0x46')]({'where':{'id':_0x6966ea},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8b45('0x66'),'attributes':['id',_0x8b45('0x2d'),_0x8b45('0x67'),_0x8b45('0x68'),'interface'],'raw':!![]}]})[_0x8b45('0x27')](function(_0x3bdd64){if(_0x3bdd64){var _0x4adb06=_['flatMap'](_0x3bdd64,function(_0x260b4e){var _0x24a570=_0x260b4e[_0x8b45('0x4f')]({'plain':!![]});return _0x24a570['Agents'];});return db[_0x8b45('0x30')]['find']({'where':{'id':_0x34c7dd[_0x8b45('0x49')]['id']}})[_0x8b45('0x27')](function(_0x52ccf3){return db['sequelize'][_0x8b45('0x69')](function(_0x2ec4e3){return _0x52ccf3[_0x8b45('0x6a')](_0x6966ea,{'transaction':_0x2ec4e3})[_0x8b45('0x27')](function(){return BPromise['each'](_0x4adb06,function(_0x11d053){return db[_0x8b45('0x58')][_0x8b45('0x6b')]({'where':{'UserId':_0x11d053['id'],'SmsQueueId':_0x34c7dd[_0x8b45('0x49')]['id']},'transaction':_0x2ec4e3});});})[_0x8b45('0x27')](function(){_0x4adb06[_0x8b45('0x6c')](function(_0x59b22b){socket[_0x8b45('0x6d')](_0x8b45('0x6e'),{'UserId':_0x59b22b['id'],'SmsQueueId':_0x52ccf3['id']});});});});});}})['then'](respondWithStatusCode(_0x55acc4,null))[_0x8b45('0x48')](handleError(_0x55acc4,null));};exports[_0x8b45('0x6f')]=function(_0x569f98,_0x4837af,_0x4f6f92){return db[_0x8b45('0x65')][_0x8b45('0x46')]({'where':{'id':_0x569f98[_0x8b45('0x35')][_0x8b45('0x64')]},'attributes':['id'],'include':[{'model':db[_0x8b45('0x59')],'as':_0x8b45('0x66'),'attributes':['id'],'raw':!![]}]})[_0x8b45('0x27')](handleEntityNotFound(_0x4837af,null))['then'](function(_0x292d83){var _0x3d321f=_[_0x8b45('0x42')](_0x292d83,'id');var _0x4ac00b=[];var _0x2fde22=[];var _0x10136e=squel['select']();_0x10136e[_0x8b45('0x70')](_0x8b45('0x71'))[_0x8b45('0x72')](_0x8b45('0x73'),'tq')[_0x8b45('0x74')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8b45('0x3e')](_0x8b45('0x75'),_0x569f98[_0x8b45('0x49')]['id']);for(var _0x9993ce=0x0;_0x9993ce<_0x292d83[_0x8b45('0x4a')];_0x9993ce+=0x1){let _0x5a4aaf=_0x292d83[_0x9993ce];for(var _0x1f7f33=0x0;_0x1f7f33<_0x5a4aaf['Agents'][_0x8b45('0x4a')];_0x1f7f33+=0x1){let _0x493130=_0x5a4aaf[_0x8b45('0x66')][_0x1f7f33];var _0xc68f28=_0x10136e[_0x8b45('0x76')]();_0xc68f28[_0x8b45('0x3e')](_0x8b45('0x77'),_0x493130['id']);_0x2fde22[_0x8b45('0x78')](db[_0x8b45('0x79')][_0x8b45('0x35')](_0xc68f28[_0x8b45('0x7a')](),{'type':db[_0x8b45('0x79')][_0x8b45('0x7b')][_0x8b45('0x7c')]})[_0x8b45('0x27')](function(_0x18b68a){if(_0x18b68a['length']===0x1){return _0x493130['id'];}else{var _0x3db51c=_[_0x8b45('0x7d')](_[_0x8b45('0x42')](_0x18b68a,'TeamId'),function(_0x466c82){return _['includes'](_0x3d321f,_0x466c82);});if(_0x3db51c){return _0x493130['id'];}}}));}}return BPromise[_0x8b45('0x7e')](_0x2fde22)[_0x8b45('0x27')](function(_0x4f2b0f){_0x4ac00b=_(_0x4ac00b)[_0x8b45('0x7f')](_0x4f2b0f)['compact']()[_0x8b45('0x80')]();return db[_0x8b45('0x30')][_0x8b45('0x4c')]({'where':{'id':_0x569f98[_0x8b45('0x49')]['id']}})[_0x8b45('0x27')](function(_0x3f920f){return db['sequelize']['transaction'](function(_0x3a339c){return _0x3f920f[_0x8b45('0x6f')](_0x569f98['query']['ids'],{'transaction':_0x3a339c})['then'](function(){if(!_[_0x8b45('0x81')](_0x4ac00b)){return _0x3f920f['removeAgents'](_0x4ac00b,{'transaction':_0x3a339c});}})[_0x8b45('0x27')](function(){_0x4ac00b[_0x8b45('0x6c')](function(_0x288dfc){socket[_0x8b45('0x6d')]('userSmsQueue:remove',{'UserId':_0x288dfc,'SmsQueueId':_0x3f920f['id']});});});});});});})[_0x8b45('0x27')](respondWithStatusCode(_0x4837af,null))[_0x8b45('0x48')](handleError(_0x4837af,null));};exports[_0x8b45('0x82')]=function(_0x2d76ae,_0x1afe71,_0x3c5ea7){return db[_0x8b45('0x30')][_0x8b45('0x4c')]({'where':{'id':_0x2d76ae['params']['id']}})[_0x8b45('0x27')](handleEntityNotFound(_0x1afe71,null))['then'](function(_0x1e5f31){if(_0x1e5f31){return _0x1e5f31['addAgents'](_0x2d76ae['body']['ids'],_[_0x8b45('0x83')](_0x2d76ae[_0x8b45('0x4e')],['ids','id'])||{})[_0x8b45('0x84')](function(_0x110eee){for(var _0x36332e=0x0;_0x36332e<_0x2d76ae[_0x8b45('0x4e')][_0x8b45('0x64')][_0x8b45('0x4a')];_0x36332e+=0x1){socket[_0x8b45('0x6d')](_0x8b45('0x6e'),{'UserId':_0x2d76ae[_0x8b45('0x4e')]['ids'][_0x36332e],'SmsQueueId':_0x2d76ae[_0x8b45('0x49')]['id']});}return _0x110eee;});}})[_0x8b45('0x27')](respondWithResult(_0x1afe71,null))[_0x8b45('0x48')](handleError(_0x1afe71,null));};exports[_0x8b45('0x85')]=function(_0x4a4ef3,_0x3cd8c5,_0xa0481e){return db[_0x8b45('0x30')][_0x8b45('0x4c')]({'where':{'id':_0x4a4ef3[_0x8b45('0x49')]['id']}})['then'](handleEntityNotFound(_0x3cd8c5,null))[_0x8b45('0x27')](function(_0x4e7193){if(_0x4e7193){return _0x4e7193[_0x8b45('0x85')](_0x4a4ef3[_0x8b45('0x35')]['ids'])['then'](function(){if(_[_0x8b45('0x86')](_0x4a4ef3['query'][_0x8b45('0x64')])){for(var _0x5006a6=0x0;_0x5006a6<_0x4a4ef3[_0x8b45('0x35')][_0x8b45('0x64')][_0x8b45('0x4a')];_0x5006a6+=0x1){socket['emit'](_0x8b45('0x87'),{'UserId':Number(_0x4a4ef3['query'][_0x8b45('0x64')][_0x5006a6]),'SmsQueueId':Number(_0x4a4ef3[_0x8b45('0x49')]['id'])});}}else{socket[_0x8b45('0x6d')](_0x8b45('0x87'),{'UserId':Number(_0x4a4ef3[_0x8b45('0x35')][_0x8b45('0x64')]),'SmsQueueId':Number(_0x4a4ef3[_0x8b45('0x49')]['id'])});}});}})[_0x8b45('0x27')](respondWithStatusCode(_0x3cd8c5,null))[_0x8b45('0x48')](handleError(_0x3cd8c5,null));};exports[_0x8b45('0x88')]=function(_0x43a8ad,_0x1c9b67,_0x23dcbc){var _0x1739b1={};var _0x31f4c1={};var _0x542652;var _0x3b2ef1;return db[_0x8b45('0x30')]['findOne']({'where':{'id':_0x43a8ad['params']['id']}})[_0x8b45('0x27')](handleEntityNotFound(_0x1c9b67,null))[_0x8b45('0x27')](function(_0xa55c42){if(_0xa55c42){_0x542652=_0xa55c42;_0x31f4c1[_0x8b45('0x34')]=_[_0x8b45('0x36')](db[_0x8b45('0x59')][_0x8b45('0x31')]);_0x31f4c1[_0x8b45('0x35')]=_[_0x8b45('0x36')](_0x43a8ad['query']);_0x31f4c1[_0x8b45('0x37')]=_[_0x8b45('0x38')](_0x31f4c1['model'],_0x31f4c1[_0x8b45('0x35')]);_0x1739b1[_0x8b45('0x39')]=_[_0x8b45('0x38')](_0x31f4c1[_0x8b45('0x34')],qs[_0x8b45('0x3a')](_0x43a8ad[_0x8b45('0x35')][_0x8b45('0x3a')]));_0x1739b1[_0x8b45('0x39')]=_0x1739b1[_0x8b45('0x39')][_0x8b45('0x4a')]?_0x1739b1[_0x8b45('0x39')]:_0x31f4c1[_0x8b45('0x34')];_0x1739b1[_0x8b45('0x3c')]=qs['sort'](_0x43a8ad[_0x8b45('0x35')]['sort']);_0x1739b1[_0x8b45('0x3e')]=qs[_0x8b45('0x37')](_[_0x8b45('0x3f')](_0x43a8ad['query'],_0x31f4c1[_0x8b45('0x37')]));if(_0x43a8ad[_0x8b45('0x35')][_0x8b45('0x40')]){_0x1739b1[_0x8b45('0x3e')]=_[_0x8b45('0x41')](_0x1739b1[_0x8b45('0x3e')],{'$or':_['map'](_0x1739b1[_0x8b45('0x39')],function(_0x92617c){var _0x29d0c3={};_0x29d0c3[_0x92617c]={'$like':'%'+_0x43a8ad[_0x8b45('0x35')]['filter']+'%'};return _0x29d0c3;})});}_0x1739b1=_[_0x8b45('0x41')]({},_0x1739b1,_0x43a8ad[_0x8b45('0x4b')]);return _0x542652[_0x8b45('0x88')](_0x1739b1);}})[_0x8b45('0x27')](function(_0x505d13){if(_0x505d13){_0x3b2ef1=_0x505d13[_0x8b45('0x4a')];if(!_0x43a8ad[_0x8b45('0x35')][_0x8b45('0x63')]('nolimit')){_0x1739b1[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x43a8ad[_0x8b45('0x35')][_0x8b45('0x21')]);_0x1739b1[_0x8b45('0x20')]=qs[_0x8b45('0x20')](_0x43a8ad['query'][_0x8b45('0x20')]);}return _0x542652[_0x8b45('0x88')](_0x1739b1);}})['then'](function(_0x237efa){if(_0x237efa){return _0x237efa?{'count':_0x3b2ef1,'rows':_0x237efa}:null;}})[_0x8b45('0x27')](respondWithResult(_0x1c9b67,null))['catch'](handleError(_0x1c9b67,null));}; \ No newline at end of file +var _0x24ca=['path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./smsQueue.socket','register','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','name','send','index','map','SmsQueue','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','Team','pick','getTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x3f05df,_0x228a42){var _0xe356b1=function(_0x504b09){while(--_0x504b09){_0x3f05df['push'](_0x3f05df['shift']());}};_0xe356b1(++_0x228a42);}(_0x24ca,0x8c));var _0xa24c=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0x24ca[_0x303c30];return _0x43161b;};'use strict';var pdf=require(_0xa24c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require(_0xa24c('0x4'));var Mustache=require('mustache');var util=require(_0xa24c('0x5'));var path=require(_0xa24c('0x6'));var sox=require(_0xa24c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa24c('0x8'));var crypto=require(_0xa24c('0x9'));var jsforce=require(_0xa24c('0xa'));var deskjs=require(_0xa24c('0xb'));var toCsv=require(_0xa24c('0xc'));var querystring=require(_0xa24c('0xd'));var Papa=require('papaparse');var Redis=require(_0xa24c('0xe'));var authService=require(_0xa24c('0xf'));var qs=require(_0xa24c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa24c('0x11'))(_0xa24c('0x12'));var utils=require(_0xa24c('0x13'));var config=require(_0xa24c('0x14'));var licenseUtil=require(_0xa24c('0x15'));var db=require(_0xa24c('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xa24c('0x17'),'port':0x18eb});var socket=require(_0xa24c('0x18'))(new Redis(config[_0xa24c('0x19')]));require(_0xa24c('0x1a'))[_0xa24c('0x1b')](socket);function respondWithStatusCode(_0x4971af,_0x13076d){_0x13076d=_0x13076d||0xcc;return function(_0x488a78){if(_0x488a78){return _0x4971af['sendStatus'](_0x13076d);}return _0x4971af['status'](_0x13076d)[_0xa24c('0x1c')]();};}function respondWithResult(_0x2a4270,_0x3f762e){_0x3f762e=_0x3f762e||0xc8;return function(_0x267762){if(_0x267762){return _0x2a4270[_0xa24c('0x1d')](_0x3f762e)[_0xa24c('0x1e')](_0x267762);}};}function respondWithFilteredResult(_0x2197da,_0x32a226){return function(_0x14f0aa){if(_0x14f0aa){var _0x117177=_0x14f0aa[_0xa24c('0x1f')],_0x1970fc=_0x32a226['offset'],_0x1a667b=_0x32a226[_0xa24c('0x20')]+_0x32a226['limit'],_0x278cce;if(_0x1a667b>=_0x117177){_0x1a667b=_0x117177;_0x278cce=0xc8;}else{_0x278cce=0xce;}_0x2197da[_0xa24c('0x1d')](_0x278cce);return _0x2197da[_0xa24c('0x21')](_0xa24c('0x22'),_0x1970fc+'-'+_0x1a667b+'/'+_0x117177)[_0xa24c('0x1e')](_0x14f0aa);}return null;};}function patchUpdates(_0x240f6c){return function(_0x416dea){try{jsonpatch[_0xa24c('0x23')](_0x416dea,_0x240f6c,!![]);}catch(_0x432c15){return BPromise[_0xa24c('0x24')](_0x432c15);}return _0x416dea[_0xa24c('0x25')]();};}function saveUpdates(_0x2b471a,_0x53e729){return function(_0x4eadb2){if(_0x4eadb2){return _0x4eadb2[_0xa24c('0x26')](_0x2b471a)[_0xa24c('0x27')](function(_0x316a68){return _0x316a68;});}return null;};}function removeEntity(_0x1a04ff,_0x375c83){return function(_0xfb13c0){if(_0xfb13c0){return _0xfb13c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x304d6c=_0xfb13c0['get']({'plain':!![]});var _0x2290e1='SmsQueues';return db[_0xa24c('0x29')][_0xa24c('0x28')]({'where':{'type':_0x2290e1,'resourceId':_0x304d6c['id']}})[_0xa24c('0x27')](function(){return _0xfb13c0;});})[_0xa24c('0x27')](function(){_0x1a04ff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c86c6,_0x4e5d2c){return function(_0x23fb79){if(!_0x23fb79){_0x4c86c6[_0xa24c('0x2a')](0x194);}return _0x23fb79;};}function handleError(_0xab6197,_0x1cdee4){_0x1cdee4=_0x1cdee4||0x1f4;return function(_0x37cbd3){logger['error'](_0x37cbd3['stack']);if(_0x37cbd3[_0xa24c('0x2b')]){delete _0x37cbd3[_0xa24c('0x2b')];}_0xab6197[_0xa24c('0x1d')](_0x1cdee4)[_0xa24c('0x2c')](_0x37cbd3);};}exports[_0xa24c('0x2d')]=function(_0x3f7102,_0xc0db8f){var _0x1e30a9={},_0x29f539={},_0x17a001={'count':0x0,'rows':[]};var _0x59526b=_[_0xa24c('0x2e')](db[_0xa24c('0x2f')]['rawAttributes'],function(_0x3c9649){return{'name':_0x3c9649[_0xa24c('0x30')],'type':_0x3c9649[_0xa24c('0x31')][_0xa24c('0x32')]};});_0x29f539[_0xa24c('0x33')]=_[_0xa24c('0x2e')](_0x59526b,_0xa24c('0x2b'));_0x29f539[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x3f7102[_0xa24c('0x34')]);_0x29f539['filters']=_['intersection'](_0x29f539['model'],_0x29f539[_0xa24c('0x34')]);_0x1e30a9['attributes']=_[_0xa24c('0x36')](_0x29f539[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x3f7102['query'][_0xa24c('0x37')]));_0x1e30a9[_0xa24c('0x38')]=_0x1e30a9[_0xa24c('0x38')]['length']?_0x1e30a9[_0xa24c('0x38')]:_0x29f539[_0xa24c('0x33')];if(!_0x3f7102['query'][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x1e30a9[_0xa24c('0x3b')]=qs['limit'](_0x3f7102[_0xa24c('0x34')][_0xa24c('0x3b')]);_0x1e30a9[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x3f7102[_0xa24c('0x34')]['offset']);}_0x1e30a9[_0xa24c('0x3c')]=qs[_0xa24c('0x3d')](_0x3f7102['query'][_0xa24c('0x3d')]);_0x1e30a9[_0xa24c('0x3e')]=qs[_0xa24c('0x3f')](_['pick'](_0x3f7102['query'],_0x29f539[_0xa24c('0x3f')]),_0x59526b);if(_0x3f7102[_0xa24c('0x34')][_0xa24c('0x40')]){_0x1e30a9[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x1e30a9[_0xa24c('0x3e')],{'$or':_['map'](_0x59526b,function(_0x46c0bf){if(_0x46c0bf[_0xa24c('0x31')]!==_0xa24c('0x42')){var _0x137a1d={};_0x137a1d[_0x46c0bf['name']]={'$like':'%'+_0x3f7102[_0xa24c('0x34')][_0xa24c('0x40')]+'%'};return _0x137a1d;}})});}_0x1e30a9=_[_0xa24c('0x41')]({},_0x1e30a9,_0x3f7102[_0xa24c('0x43')]);var _0x103b50={'where':_0x1e30a9[_0xa24c('0x3e')]};return db[_0xa24c('0x2f')]['count'](_0x103b50)['then'](function(_0x22c57e){_0x17a001['count']=_0x22c57e;if(_0x3f7102[_0xa24c('0x34')]['includeAll']){_0x1e30a9[_0xa24c('0x44')]=[{'all':!![]}];}return db[_0xa24c('0x2f')][_0xa24c('0x45')](_0x1e30a9);})[_0xa24c('0x27')](function(_0x21328f){_0x17a001[_0xa24c('0x46')]=_0x21328f;return _0x17a001;})[_0xa24c('0x27')](respondWithFilteredResult(_0xc0db8f,_0x1e30a9))[_0xa24c('0x47')](handleError(_0xc0db8f,null));};exports[_0xa24c('0x48')]=function(_0x38791c,_0x45dd80){var _0x1f87b7={'raw':!![],'where':{'id':_0x38791c[_0xa24c('0x49')]['id']}},_0x2e2f06={};_0x2e2f06[_0xa24c('0x33')]=_[_0xa24c('0x35')](db['SmsQueue'][_0xa24c('0x4a')]);_0x2e2f06[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x38791c['query']);_0x2e2f06[_0xa24c('0x3f')]=_[_0xa24c('0x36')](_0x2e2f06[_0xa24c('0x33')],_0x2e2f06[_0xa24c('0x34')]);_0x1f87b7['attributes']=_[_0xa24c('0x36')](_0x2e2f06[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x38791c[_0xa24c('0x34')][_0xa24c('0x37')]));_0x1f87b7[_0xa24c('0x38')]=_0x1f87b7[_0xa24c('0x38')][_0xa24c('0x4b')]?_0x1f87b7[_0xa24c('0x38')]:_0x2e2f06[_0xa24c('0x33')];if(_0x38791c[_0xa24c('0x34')][_0xa24c('0x4c')]){_0x1f87b7[_0xa24c('0x44')]=[{'all':!![]}];}_0x1f87b7=_['merge']({},_0x1f87b7,_0x38791c[_0xa24c('0x43')]);return db['SmsQueue'][_0xa24c('0x4d')](_0x1f87b7)[_0xa24c('0x27')](handleEntityNotFound(_0x45dd80,null))[_0xa24c('0x27')](respondWithResult(_0x45dd80,null))[_0xa24c('0x47')](handleError(_0x45dd80,null));};exports[_0xa24c('0x4e')]=function(_0x42d84b,_0x338877){return db[_0xa24c('0x2f')][_0xa24c('0x4e')](_0x42d84b[_0xa24c('0x4f')],{})[_0xa24c('0x27')](function(_0x390688){var _0x14c813=_0x42d84b['user'][_0xa24c('0x50')]({'plain':!![]});if(!_0x14c813)throw new Error(_0xa24c('0x51'));if(_0x14c813[_0xa24c('0x52')]===_0xa24c('0x53')){var _0x4b6cc0=_0x390688[_0xa24c('0x50')]({'plain':!![]});var _0xd09fd4=_0xa24c('0x54');return db['UserProfileSection']['find']({'where':{'name':_0xd09fd4,'userProfileId':_0x14c813[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x4992ee){if(_0x4992ee&&_0x4992ee[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x29')]['create']({'name':_0x4b6cc0[_0xa24c('0x2b')],'resourceId':_0x4b6cc0['id'],'type':_0x4992ee['name'],'sectionId':_0x4992ee['id']},{})['then'](function(){return _0x390688;});}else{return _0x390688;}})[_0xa24c('0x47')](function(_0x58f0e8){logger[_0xa24c('0x57')](_0xa24c('0x58'),_0x58f0e8);throw _0x58f0e8;});}return _0x390688;})['then'](respondWithResult(_0x338877,0xc9))[_0xa24c('0x47')](handleError(_0x338877,null));};exports[_0xa24c('0x26')]=function(_0x37379d,_0x2fe35e){if(_0x37379d['body']['id']){delete _0x37379d[_0xa24c('0x4f')]['id'];}return db['SmsQueue'][_0xa24c('0x4d')]({'where':{'id':_0x37379d[_0xa24c('0x49')]['id']}})['then'](handleEntityNotFound(_0x2fe35e,null))['then'](saveUpdates(_0x37379d[_0xa24c('0x4f')],null))[_0xa24c('0x27')](respondWithResult(_0x2fe35e,null))[_0xa24c('0x47')](handleError(_0x2fe35e,null));};exports[_0xa24c('0x28')]=function(_0x3aa9d7,_0x5f2564){return db[_0xa24c('0x2f')]['find']({'where':{'id':_0x3aa9d7[_0xa24c('0x49')]['id']}})['then'](handleEntityNotFound(_0x5f2564,null))['then'](removeEntity(_0x5f2564,null))['catch'](handleError(_0x5f2564,null));};exports[_0xa24c('0x59')]=function(_0x5c4834,_0x5d8086){return db[_0xa24c('0x2f')]['describe']()[_0xa24c('0x27')](respondWithResult(_0x5d8086,null))[_0xa24c('0x47')](handleError(_0x5d8086,null));};exports[_0xa24c('0x5a')]=function(_0x14c819,_0x33c5f7,_0x29c643){var _0x45d2fd={'raw':!![],'where':{}},_0x366505={},_0x47a366;return db['SmsQueue'][_0xa24c('0x5b')]({'where':{'id':_0x14c819[_0xa24c('0x49')]['id']}})['then'](handleEntityNotFound(_0x33c5f7,null))[_0xa24c('0x27')](function(_0x17d92d){if(_0x17d92d){_0x47a366=_0x17d92d['get']({'plain':!![]});_0x366505[_0xa24c('0x33')]=_[_0xa24c('0x35')](db[_0xa24c('0x5c')]['rawAttributes']);_0x366505[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x14c819['query']);_0x366505[_0xa24c('0x3f')]=_['intersection'](_0x366505[_0xa24c('0x33')],_0x366505[_0xa24c('0x34')]);_0x45d2fd[_0xa24c('0x38')]=_[_0xa24c('0x36')](_0x366505[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x14c819[_0xa24c('0x34')][_0xa24c('0x37')]));_0x45d2fd[_0xa24c('0x38')]=_0x45d2fd[_0xa24c('0x38')][_0xa24c('0x4b')]?_0x45d2fd[_0xa24c('0x38')]:_0x366505[_0xa24c('0x33')];if(!_0x14c819[_0xa24c('0x34')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x45d2fd[_0xa24c('0x3b')]=qs[_0xa24c('0x3b')](_0x14c819['query'][_0xa24c('0x3b')]);_0x45d2fd['offset']=qs[_0xa24c('0x20')](_0x14c819[_0xa24c('0x34')][_0xa24c('0x20')]);}_0x45d2fd[_0xa24c('0x3c')]=qs['sort'](_0x14c819['query'][_0xa24c('0x3d')]);_0x45d2fd[_0xa24c('0x3e')]=qs[_0xa24c('0x3f')](_['pick'](_0x14c819[_0xa24c('0x34')],_0x366505[_0xa24c('0x3f')]));_0x45d2fd[_0xa24c('0x3e')][_0xa24c('0x5d')]=_0x17d92d['id'];if(_0x14c819[_0xa24c('0x34')][_0xa24c('0x40')]){_0x45d2fd[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x45d2fd[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x2e')](_0x45d2fd[_0xa24c('0x38')],function(_0x19c87a){var _0x3b68d7={};_0x3b68d7[_0x19c87a]={'$like':'%'+_0x14c819[_0xa24c('0x34')][_0xa24c('0x40')]+'%'};return _0x3b68d7;})});}_0x45d2fd=_[_0xa24c('0x41')]({},_0x45d2fd,_0x14c819[_0xa24c('0x43')]);return db[_0xa24c('0x5c')][_0xa24c('0x45')](_0x45d2fd);}})[_0xa24c('0x27')](function(_0x333cb7){if(_0x333cb7){return db[_0xa24c('0x5e')][_0xa24c('0x5f')]({'where':{'id':_[_0xa24c('0x2e')](_0x333cb7,_0xa24c('0x60')),'role':_0xa24c('0x61')},'attributes':['id',_0xa24c('0x2b'),_0xa24c('0x62'),_0xa24c('0x63'),_0xa24c('0x64')]});}})['then'](function(_0x37f25d){if(_0x37f25d){return{'count':_0x37f25d['count'],'rows':_[_0xa24c('0x2e')](_0x37f25d[_0xa24c('0x46')],function(_0x19a6f3){return{'membername':_0x19a6f3[_0xa24c('0x2b')],'UserId':_0x19a6f3['id'],'queue_name':_0x47a366['name'],'SmsQueueId':_0x47a366['id'],'interface':util[_0xa24c('0x65')](_0xa24c('0x66'),_0xa24c('0x67'),_0x19a6f3['name']),'penalty':0x0,'paused':_0x19a6f3[_0xa24c('0x62')],'createdAt':_0x19a6f3['createdAt'],'updatedAt':_0x19a6f3[_0xa24c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa24c('0x27')](respondWithFilteredResult(_0x33c5f7,_0x45d2fd))[_0xa24c('0x47')](handleError(_0x33c5f7,null));};exports['getTeams']=function(_0x2d1f56,_0x846186,_0x5ae89a){var _0x35fae7={};var _0x36e108={};var _0x316e26;var _0x2a189a;return db[_0xa24c('0x2f')][_0xa24c('0x5b')]({'where':{'id':_0x2d1f56[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x846186,null))[_0xa24c('0x27')](function(_0x327360){if(_0x327360){_0x316e26=_0x327360;_0x36e108[_0xa24c('0x33')]=_[_0xa24c('0x35')](db[_0xa24c('0x68')][_0xa24c('0x4a')]);_0x36e108[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x2d1f56['query']);_0x36e108[_0xa24c('0x3f')]=_[_0xa24c('0x36')](_0x36e108[_0xa24c('0x33')],_0x36e108[_0xa24c('0x34')]);_0x35fae7[_0xa24c('0x38')]=_['intersection'](_0x36e108['model'],qs[_0xa24c('0x37')](_0x2d1f56[_0xa24c('0x34')][_0xa24c('0x37')]));_0x35fae7[_0xa24c('0x38')]=_0x35fae7[_0xa24c('0x38')]['length']?_0x35fae7[_0xa24c('0x38')]:_0x36e108[_0xa24c('0x33')];_0x35fae7[_0xa24c('0x3c')]=qs['sort'](_0x2d1f56[_0xa24c('0x34')]['sort']);_0x35fae7['where']=qs['filters'](_[_0xa24c('0x69')](_0x2d1f56[_0xa24c('0x34')],_0x36e108[_0xa24c('0x3f')]));if(_0x2d1f56[_0xa24c('0x34')]['filter']){_0x35fae7[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x35fae7[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x2e')](_0x35fae7[_0xa24c('0x38')],function(_0x4baa40){var _0x35f8e5={};_0x35f8e5[_0x4baa40]={'$like':'%'+_0x2d1f56[_0xa24c('0x34')]['filter']+'%'};return _0x35f8e5;})});}_0x35fae7=_['merge']({},_0x35fae7,_0x2d1f56[_0xa24c('0x43')]);return _0x316e26[_0xa24c('0x6a')](_0x35fae7);}})[_0xa24c('0x27')](function(_0x3479a9){if(_0x3479a9){_0x2a189a=_0x3479a9[_0xa24c('0x4b')];if(!_0x2d1f56[_0xa24c('0x34')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x35fae7['limit']=qs['limit'](_0x2d1f56[_0xa24c('0x34')][_0xa24c('0x3b')]);_0x35fae7[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x2d1f56[_0xa24c('0x34')]['offset']);}return _0x316e26[_0xa24c('0x6a')](_0x35fae7);}})['then'](function(_0x47f744){if(_0x47f744){return _0x47f744?{'count':_0x2a189a,'rows':_0x47f744}:null;}})[_0xa24c('0x27')](respondWithResult(_0x846186,null))[_0xa24c('0x47')](handleError(_0x846186,null));};exports['addTeams']=function(_0x32b835,_0x2915f1,_0x283f63){var _0x4c7ca1=_0x32b835[_0xa24c('0x4f')]['ids'];return db[_0xa24c('0x68')][_0xa24c('0x45')]({'where':{'id':_0x4c7ca1},'attributes':['id'],'include':[{'model':db[_0xa24c('0x5e')],'as':_0xa24c('0x6b'),'attributes':['id',_0xa24c('0x2b'),_0xa24c('0x6c'),_0xa24c('0x6d'),_0xa24c('0x6e')],'raw':!![]}]})[_0xa24c('0x27')](function(_0x286b89){if(_0x286b89){var _0x475526=_[_0xa24c('0x6f')](_0x286b89,function(_0xd11c2a){var _0x569475=_0xd11c2a['get']({'plain':!![]});return _0x569475[_0xa24c('0x6b')];});return db[_0xa24c('0x2f')][_0xa24c('0x4d')]({'where':{'id':_0x32b835[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](function(_0x4b4f88){return db[_0xa24c('0x70')][_0xa24c('0x71')](function(_0x409f10){return _0x4b4f88[_0xa24c('0x72')](_0x4c7ca1,{'transaction':_0x409f10})[_0xa24c('0x27')](function(){return BPromise['each'](_0x475526,function(_0x1927c2){return db[_0xa24c('0x5c')][_0xa24c('0x73')]({'where':{'UserId':_0x1927c2['id'],'SmsQueueId':_0x32b835[_0xa24c('0x49')]['id']},'transaction':_0x409f10});});})[_0xa24c('0x27')](function(){_0x475526[_0xa24c('0x74')](function(_0x4bec32){socket[_0xa24c('0x75')](_0xa24c('0x76'),{'UserId':_0x4bec32['id'],'SmsQueueId':_0x4b4f88['id']});});});});});}})[_0xa24c('0x27')](respondWithStatusCode(_0x2915f1,null))['catch'](handleError(_0x2915f1,null));};exports[_0xa24c('0x77')]=function(_0x48edc9,_0x2c52fc,_0x43150f){return db[_0xa24c('0x68')]['findAll']({'where':{'id':_0x48edc9[_0xa24c('0x34')][_0xa24c('0x78')]},'attributes':['id'],'include':[{'model':db[_0xa24c('0x5e')],'as':_0xa24c('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xa24c('0x27')](handleEntityNotFound(_0x2c52fc,null))[_0xa24c('0x27')](function(_0x3c364d){var _0x2813cc=_[_0xa24c('0x2e')](_0x3c364d,'id');var _0x230bba=[];var _0x2e95cb=[];var _0x2f89cc=squel['select']();_0x2f89cc[_0xa24c('0x79')](_0xa24c('0x7a'))[_0xa24c('0x7b')](_0xa24c('0x7c'),'tq')[_0xa24c('0x7d')]('user_has_teams','ut',_0xa24c('0x7e'))['where'](_0xa24c('0x7f'),_0x48edc9[_0xa24c('0x49')]['id']);for(var _0x3d5949=0x0;_0x3d5949<_0x3c364d['length'];_0x3d5949+=0x1){let _0x1eb531=_0x3c364d[_0x3d5949];for(var _0x4f033b=0x0;_0x4f033b<_0x1eb531[_0xa24c('0x6b')][_0xa24c('0x4b')];_0x4f033b+=0x1){let _0x1e469d=_0x1eb531['Agents'][_0x4f033b];var _0x31b6f9=_0x2f89cc[_0xa24c('0x80')]();_0x31b6f9['where'](_0xa24c('0x81'),_0x1e469d['id']);_0x2e95cb[_0xa24c('0x82')](db[_0xa24c('0x70')][_0xa24c('0x34')](_0x31b6f9[_0xa24c('0x83')](),{'type':db[_0xa24c('0x70')][_0xa24c('0x84')][_0xa24c('0x85')]})[_0xa24c('0x27')](function(_0x2f3c06){if(_0x2f3c06[_0xa24c('0x4b')]===0x1){return _0x1e469d['id'];}else{var _0x2cffcd=_['every'](_[_0xa24c('0x2e')](_0x2f3c06,_0xa24c('0x86')),function(_0x2d3953){return _['includes'](_0x2813cc,_0x2d3953);});if(_0x2cffcd){return _0x1e469d['id'];}}}));}}return BPromise[_0xa24c('0x87')](_0x2e95cb)[_0xa24c('0x27')](function(_0xcbebc5){_0x230bba=_(_0x230bba)['union'](_0xcbebc5)[_0xa24c('0x88')]()[_0xa24c('0x89')]();return db[_0xa24c('0x2f')][_0xa24c('0x4d')]({'where':{'id':_0x48edc9[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](function(_0x5a1c2e){return db[_0xa24c('0x70')][_0xa24c('0x71')](function(_0xb4b74e){return _0x5a1c2e[_0xa24c('0x77')](_0x48edc9[_0xa24c('0x34')]['ids'],{'transaction':_0xb4b74e})[_0xa24c('0x27')](function(){if(!_[_0xa24c('0x8a')](_0x230bba)){return _0x5a1c2e[_0xa24c('0x8b')](_0x230bba,{'transaction':_0xb4b74e});}})[_0xa24c('0x27')](function(){_0x230bba[_0xa24c('0x74')](function(_0x494225){socket['emit'](_0xa24c('0x8c'),{'UserId':_0x494225,'SmsQueueId':_0x5a1c2e['id']});});});});});});})[_0xa24c('0x27')](respondWithStatusCode(_0x2c52fc,null))['catch'](handleError(_0x2c52fc,null));};exports[_0xa24c('0x8d')]=function(_0x25725d,_0x19a9d8,_0x39bfc5){return db['SmsQueue'][_0xa24c('0x4d')]({'where':{'id':_0x25725d[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x19a9d8,null))[_0xa24c('0x27')](function(_0x4a5fcd){if(_0x4a5fcd){return _0x4a5fcd['addAgents'](_0x25725d[_0xa24c('0x4f')][_0xa24c('0x78')],_[_0xa24c('0x8e')](_0x25725d[_0xa24c('0x4f')],['ids','id'])||{})[_0xa24c('0x8f')](function(_0x16f089){for(var _0x3b6a05=0x0;_0x3b6a05<_0x25725d[_0xa24c('0x4f')][_0xa24c('0x78')][_0xa24c('0x4b')];_0x3b6a05+=0x1){socket[_0xa24c('0x75')](_0xa24c('0x76'),{'UserId':_0x25725d[_0xa24c('0x4f')][_0xa24c('0x78')][_0x3b6a05],'SmsQueueId':_0x25725d[_0xa24c('0x49')]['id']});}return _0x16f089;});}})[_0xa24c('0x27')](respondWithResult(_0x19a9d8,null))[_0xa24c('0x47')](handleError(_0x19a9d8,null));};exports['removeAgents']=function(_0x4538e6,_0x3bf62c,_0x2a3d0b){return db[_0xa24c('0x2f')][_0xa24c('0x4d')]({'where':{'id':_0x4538e6['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x3bf62c,null))[_0xa24c('0x27')](function(_0x598d8e){if(_0x598d8e){return _0x598d8e['removeAgents'](_0x4538e6['query'][_0xa24c('0x78')])['then'](function(){if(_[_0xa24c('0x90')](_0x4538e6[_0xa24c('0x34')]['ids'])){for(var _0x30e24d=0x0;_0x30e24d<_0x4538e6[_0xa24c('0x34')]['ids']['length'];_0x30e24d+=0x1){socket[_0xa24c('0x75')](_0xa24c('0x8c'),{'UserId':Number(_0x4538e6[_0xa24c('0x34')][_0xa24c('0x78')][_0x30e24d]),'SmsQueueId':Number(_0x4538e6['params']['id'])});}}else{socket[_0xa24c('0x75')](_0xa24c('0x8c'),{'UserId':Number(_0x4538e6['query'][_0xa24c('0x78')]),'SmsQueueId':Number(_0x4538e6[_0xa24c('0x49')]['id'])});}});}})[_0xa24c('0x27')](respondWithStatusCode(_0x3bf62c,null))[_0xa24c('0x47')](handleError(_0x3bf62c,null));};exports[_0xa24c('0x91')]=function(_0x2bafac,_0x43e01a,_0x4e4788){var _0x55c670={};var _0x1e3114={};var _0x3bf57c;var _0x5c2235;return db['SmsQueue'][_0xa24c('0x5b')]({'where':{'id':_0x2bafac[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x43e01a,null))['then'](function(_0x469d56){if(_0x469d56){_0x3bf57c=_0x469d56;_0x1e3114[_0xa24c('0x33')]=_[_0xa24c('0x35')](db[_0xa24c('0x5e')][_0xa24c('0x4a')]);_0x1e3114[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x2bafac[_0xa24c('0x34')]);_0x1e3114['filters']=_['intersection'](_0x1e3114[_0xa24c('0x33')],_0x1e3114[_0xa24c('0x34')]);_0x55c670['attributes']=_['intersection'](_0x1e3114[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x37')]));_0x55c670[_0xa24c('0x38')]=_0x55c670[_0xa24c('0x38')][_0xa24c('0x4b')]?_0x55c670[_0xa24c('0x38')]:_0x1e3114['model'];_0x55c670[_0xa24c('0x3c')]=qs[_0xa24c('0x3d')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x3d')]);_0x55c670[_0xa24c('0x3e')]=qs[_0xa24c('0x3f')](_[_0xa24c('0x69')](_0x2bafac[_0xa24c('0x34')],_0x1e3114[_0xa24c('0x3f')]));if(_0x2bafac[_0xa24c('0x34')][_0xa24c('0x40')]){_0x55c670[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x55c670[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x2e')](_0x55c670[_0xa24c('0x38')],function(_0x5eb0fa){var _0x5af5e4={};_0x5af5e4[_0x5eb0fa]={'$like':'%'+_0x2bafac[_0xa24c('0x34')][_0xa24c('0x40')]+'%'};return _0x5af5e4;})});}_0x55c670=_[_0xa24c('0x41')]({},_0x55c670,_0x2bafac[_0xa24c('0x43')]);return _0x3bf57c[_0xa24c('0x91')](_0x55c670);}})[_0xa24c('0x27')](function(_0x2d47ca){if(_0x2d47ca){_0x5c2235=_0x2d47ca['length'];if(!_0x2bafac['query']['hasOwnProperty']('nolimit')){_0x55c670['limit']=qs[_0xa24c('0x3b')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x3b')]);_0x55c670[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x20')]);}return _0x3bf57c['getAgents'](_0x55c670);}})[_0xa24c('0x27')](function(_0x54ba90){if(_0x54ba90){return _0x54ba90?{'count':_0x5c2235,'rows':_0x54ba90}:null;}})[_0xa24c('0x27')](respondWithResult(_0x43e01a,null))[_0xa24c('0x47')](handleError(_0x43e01a,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 6a8373b..ef63579 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 _0x6e5f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x58c702,_0x1274e7){var _0x16c1a4=function(_0x52e845){while(--_0x52e845){_0x58c702['push'](_0x58c702['shift']());}};_0x16c1a4(++_0x1274e7);}(_0x6e5f,0x1bc));var _0xf6e5=function(_0x4e2ace,_0x38d43d){_0x4e2ace=_0x4e2ace-0x0;var _0xa967aa=_0x6e5f[_0x4e2ace];return _0xa967aa;};'use strict';var EventEmitter=require(_0xf6e5('0x0'));var SmsQueue=require(_0xf6e5('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf6e5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf6e5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x191eaa){return function(_0x5860f8,_0xe832c7,_0x5ac9fb){SmsQueueEvents[_0xf6e5('0x4')](_0x191eaa+':'+_0x5860f8['id'],_0x5860f8);SmsQueueEvents['emit'](_0x191eaa,_0x5860f8);_0x5ac9fb(null);};}for(var e in events){if(events[_0xf6e5('0x5')](e)){var event=events[e];SmsQueue[_0xf6e5('0x6')](e,emitEvent(event));}}module[_0xf6e5('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x23bd=['SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x42f298,_0x34bb28){var _0x3c3f82=function(_0x35782e){while(--_0x35782e){_0x42f298['push'](_0x42f298['shift']());}};_0x3c3f82(++_0x34bb28);}(_0x23bd,0x1a0));var _0xd23b=function(_0x18593c,_0x448b00){_0x18593c=_0x18593c-0x0;var _0x4f7799=_0x23bd[_0x18593c];return _0x4f7799;};'use strict';var EventEmitter=require(_0xd23b('0x0'));var SmsQueue=require(_0xd23b('0x1'))['db'][_0xd23b('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd23b('0x3')](0x0);var events={'afterCreate':_0xd23b('0x4'),'afterUpdate':_0xd23b('0x5'),'afterDestroy':_0xd23b('0x6')};function emitEvent(_0xe49824){return function(_0x28c648,_0x55535d,_0x50a114){SmsQueueEvents[_0xd23b('0x7')](_0xe49824+':'+_0x28c648['id'],_0x28c648);SmsQueueEvents[_0xd23b('0x7')](_0xe49824,_0x28c648);_0x50a114(null);};}for(var e in events){if(events[_0xd23b('0x8')](e)){var event=events[e];SmsQueue[_0xd23b('0x9')](e,emitEvent(event));}}module[_0xd23b('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 5884633..5b6db03 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 _0x0852=['lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','SmsQueue','sms_queues'];(function(_0x23558b,_0x370b2d){var _0x344908=function(_0xae5bdd){while(--_0xae5bdd){_0x23558b['push'](_0x23558b['shift']());}};_0x344908(++_0x370b2d);}(_0x0852,0x108));var _0x2085=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x0852[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x2085('0x0'));var util=require('util');var logger=require(_0x2085('0x1'))(_0x2085('0x2'));var moment=require('moment');var BPromise=require(_0x2085('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2085('0x4'));var rimraf=require(_0x2085('0x5'));var config=require(_0x2085('0x6'));var attributes=require('./smsQueue.attributes');module[_0x2085('0x7')]=function(_0x501b73,_0x1b10e2){return _0x501b73[_0x2085('0x8')](_0x2085('0x9'),attributes,{'tableName':_0x2085('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8dbd=['request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','api','moment','bluebird'];(function(_0x2c227b,_0x2ff5ee){var _0x30410b=function(_0x140dc8){while(--_0x140dc8){_0x2c227b['push'](_0x2c227b['shift']());}};_0x30410b(++_0x2ff5ee);}(_0x8dbd,0x159));var _0xd8db=function(_0x33ca86,_0x5ce8cf){_0x33ca86=_0x33ca86-0x0;var _0x5135ae=_0x8dbd[_0x33ca86];return _0x5135ae;};'use strict';var _=require(_0xd8db('0x0'));var util=require(_0xd8db('0x1'));var logger=require('../../config/logger')(_0xd8db('0x2'));var moment=require(_0xd8db('0x3'));var BPromise=require(_0xd8db('0x4'));var rp=require(_0xd8db('0x5'));var fs=require('fs');var path=require(_0xd8db('0x6'));var rimraf=require(_0xd8db('0x7'));var config=require(_0xd8db('0x8'));var attributes=require(_0xd8db('0x9'));module[_0xd8db('0xa')]=function(_0xa587d2,_0x12ada1){return _0xa587d2[_0xd8db('0xb')](_0xd8db('0xc'),attributes,{'tableName':_0xd8db('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index df4e5ef..dde641c 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 _0x0dd2=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','map','model','then','find','ShowSmsQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1cd91d,_0x17f853){var _0x41af42=function(_0x3b201d){while(--_0x3b201d){_0x1cd91d['push'](_0x1cd91d['shift']());}};_0x41af42(++_0x17f853);}(_0x0dd2,0x1b1));var _0x20dd=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0x0dd2[_0x2543d6];return _0x55213c;};'use strict';var _=require('lodash');var util=require(_0x20dd('0x0'));var moment=require(_0x20dd('0x1'));var BPromise=require(_0x20dd('0x2'));var rs=require(_0x20dd('0x3'));var fs=require('fs');var Redis=require(_0x20dd('0x4'));var db=require(_0x20dd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x20dd('0x6'))('rpc');var config=require(_0x20dd('0x7'));var jayson=require(_0x20dd('0x8'));var client=jayson[_0x20dd('0x9')][_0x20dd('0xa')]({'port':0x232a});config[_0x20dd('0xb')]=_[_0x20dd('0xc')](config[_0x20dd('0xb')],{'host':_0x20dd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x20dd('0xb')]));require(_0x20dd('0xe'))[_0x20dd('0xf')](socket);function respondWithRpcPromise(_0x33b432,_0x2d62eb,_0x6ed9b7){return new BPromise(function(_0x118110,_0x59963e){return client[_0x20dd('0x10')](_0x33b432,_0x6ed9b7)['then'](function(_0x3d315d){logger[_0x20dd('0x11')](_0x20dd('0x12'),_0x2d62eb,'request\x20sent');logger[_0x20dd('0x13')](_0x20dd('0x14'),_0x2d62eb,_0x20dd('0x15'),JSON[_0x20dd('0x16')](_0x3d315d));if(_0x3d315d[_0x20dd('0x17')]){if(_0x3d315d['error'][_0x20dd('0x18')]===0x1f4){logger[_0x20dd('0x17')](_0x20dd('0x12'),_0x2d62eb,_0x3d315d[_0x20dd('0x17')][_0x20dd('0x19')]);return _0x59963e(_0x3d315d['error'][_0x20dd('0x19')]);}logger[_0x20dd('0x17')](_0x20dd('0x12'),_0x2d62eb,_0x3d315d[_0x20dd('0x17')][_0x20dd('0x19')]);return _0x118110(_0x3d315d[_0x20dd('0x17')]['message']);}else{logger['info'](_0x20dd('0x12'),_0x2d62eb,_0x20dd('0x15'));_0x118110(_0x3d315d['result'][_0x20dd('0x19')]);}})[_0x20dd('0x1a')](function(_0x169f02){logger['error'](_0x20dd('0x12'),_0x2d62eb,_0x169f02);_0x59963e(_0x169f02);});});}exports[_0x20dd('0x1b')]=function(_0x51982a){var _0x21886e=this;return new Promise(function(_0x5d7971,_0x516b43){return db[_0x20dd('0x1c')]['findAll']({'raw':_0x51982a['options']?_0x51982a[_0x20dd('0x1d')][_0x20dd('0x1e')]===undefined?!![]:![]:!![],'where':_0x51982a[_0x20dd('0x1d')]?_0x51982a[_0x20dd('0x1d')][_0x20dd('0x1f')]||null:null,'attributes':_0x51982a[_0x20dd('0x1d')]?_0x51982a[_0x20dd('0x1d')][_0x20dd('0x20')]||null:null,'limit':_0x51982a[_0x20dd('0x1d')]?_0x51982a[_0x20dd('0x1d')][_0x20dd('0x21')]||null:null,'include':_0x51982a['options']?_0x51982a[_0x20dd('0x1d')][_0x20dd('0x22')]?_[_0x20dd('0x23')](_0x51982a[_0x20dd('0x1d')][_0x20dd('0x22')],function(_0x2db45f){return{'model':db[_0x2db45f[_0x20dd('0x24')]],'as':_0x2db45f['as'],'attributes':_0x2db45f[_0x20dd('0x20')],'include':_0x2db45f[_0x20dd('0x22')]?_[_0x20dd('0x23')](_0x2db45f[_0x20dd('0x22')],function(_0x550207){return{'model':db[_0x550207[_0x20dd('0x24')]],'as':_0x550207['as'],'attributes':_0x550207[_0x20dd('0x20')],'include':_0x550207[_0x20dd('0x22')]?_[_0x20dd('0x23')](_0x550207[_0x20dd('0x22')],function(_0x5e525a){return{'model':db[_0x5e525a[_0x20dd('0x24')]],'as':_0x5e525a['as'],'attributes':_0x5e525a[_0x20dd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x20dd('0x25')](function(_0x4fd54b){logger[_0x20dd('0x11')](_0x20dd('0x1b'),_0x51982a);logger[_0x20dd('0x13')](_0x20dd('0x1b'),_0x51982a,JSON[_0x20dd('0x16')](_0x4fd54b));_0x5d7971(_0x4fd54b);})[_0x20dd('0x1a')](function(_0x36ba1d){logger[_0x20dd('0x17')](_0x20dd('0x1b'),_0x36ba1d['message'],_0x51982a);_0x516b43(_0x21886e['error'](0x1f4,_0x36ba1d[_0x20dd('0x19')]));});});};exports['ShowSmsQueue']=function(_0x15767c){var _0x25dcfa=this;return new Promise(function(_0x5e27f8,_0xd6e169){return db[_0x20dd('0x1c')][_0x20dd('0x26')]({'raw':_0x15767c[_0x20dd('0x1d')]?_0x15767c['options'][_0x20dd('0x1e')]===undefined?!![]:![]:!![],'where':_0x15767c['options']?_0x15767c[_0x20dd('0x1d')][_0x20dd('0x1f')]||null:null,'attributes':_0x15767c[_0x20dd('0x1d')]?_0x15767c['options'][_0x20dd('0x20')]||null:null,'include':_0x15767c['options']?_0x15767c['options'][_0x20dd('0x22')]?_[_0x20dd('0x23')](_0x15767c[_0x20dd('0x1d')][_0x20dd('0x22')],function(_0x1509a7){return{'model':db[_0x1509a7[_0x20dd('0x24')]],'as':_0x1509a7['as'],'attributes':_0x1509a7[_0x20dd('0x20')],'include':_0x1509a7[_0x20dd('0x22')]?_[_0x20dd('0x23')](_0x1509a7[_0x20dd('0x22')],function(_0x34c330){return{'model':db[_0x34c330['model']],'as':_0x34c330['as'],'attributes':_0x34c330['attributes'],'include':_0x34c330[_0x20dd('0x22')]?_[_0x20dd('0x23')](_0x34c330['include'],function(_0x5b8d9c){return{'model':db[_0x5b8d9c[_0x20dd('0x24')]],'as':_0x5b8d9c['as'],'attributes':_0x5b8d9c[_0x20dd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x20dd('0x25')](function(_0x578abf){logger[_0x20dd('0x11')](_0x20dd('0x27'),_0x15767c);logger[_0x20dd('0x13')](_0x20dd('0x27'),_0x15767c,JSON[_0x20dd('0x16')](_0x578abf));_0x5e27f8(_0x578abf);})[_0x20dd('0x1a')](function(_0x378c7f){logger['error'](_0x20dd('0x27'),_0x378c7f[_0x20dd('0x19')],_0x15767c);_0xd6e169(_0x25dcfa['error'](0x1f4,_0x378c7f[_0x20dd('0x19')]));});});}; \ No newline at end of file +var _0x9ab8=['request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSmsQueue','findAll','options','where','limit','include','map','model','attributes','info','ShowSmsQueue','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket'];(function(_0x4ec485,_0x3c71d9){var _0x35f970=function(_0x478c89){while(--_0x478c89){_0x4ec485['push'](_0x4ec485['shift']());}};_0x35f970(++_0x3c71d9);}(_0x9ab8,0xd4));var _0x89ab=function(_0x501d4e,_0x17399d){_0x501d4e=_0x501d4e-0x0;var _0x4a6897=_0x9ab8[_0x501d4e];return _0x4a6897;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require('moment');var BPromise=require(_0x89ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ab('0x3'));var db=require(_0x89ab('0x4'))['db'];var utils=require(_0x89ab('0x5'));var logger=require(_0x89ab('0x6'))(_0x89ab('0x7'));var config=require(_0x89ab('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x89ab('0x9')][_0x89ab('0xa')]({'port':0x232a});config[_0x89ab('0xb')]=_[_0x89ab('0xc')](config['redis'],{'host':_0x89ab('0xd'),'port':0x18eb});var socket=require(_0x89ab('0xe'))(new Redis(config['redis']));require(_0x89ab('0xf'))['register'](socket);function respondWithRpcPromise(_0x21f97e,_0x55a27e,_0xa459c7){return new BPromise(function(_0x144405,_0x4fe91a){return client[_0x89ab('0x10')](_0x21f97e,_0xa459c7)[_0x89ab('0x11')](function(_0x160144){logger['info'](_0x89ab('0x12'),_0x55a27e,_0x89ab('0x13'));logger[_0x89ab('0x14')](_0x89ab('0x15'),_0x55a27e,_0x89ab('0x13'),JSON['stringify'](_0x160144));if(_0x160144[_0x89ab('0x16')]){if(_0x160144['error']['code']===0x1f4){logger[_0x89ab('0x16')](_0x89ab('0x12'),_0x55a27e,_0x160144[_0x89ab('0x16')]['message']);return _0x4fe91a(_0x160144[_0x89ab('0x16')]['message']);}logger[_0x89ab('0x16')](_0x89ab('0x12'),_0x55a27e,_0x160144[_0x89ab('0x16')]['message']);return _0x144405(_0x160144[_0x89ab('0x16')][_0x89ab('0x17')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x55a27e,_0x89ab('0x13'));_0x144405(_0x160144[_0x89ab('0x18')]['message']);}})[_0x89ab('0x19')](function(_0x446ae7){logger[_0x89ab('0x16')](_0x89ab('0x12'),_0x55a27e,_0x446ae7);_0x4fe91a(_0x446ae7);});});}exports[_0x89ab('0x1a')]=function(_0x982530){var _0x34da91=this;return new Promise(function(_0x27c7ef,_0x5d1c93){return db['SmsQueue'][_0x89ab('0x1b')]({'raw':_0x982530[_0x89ab('0x1c')]?_0x982530[_0x89ab('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x982530[_0x89ab('0x1c')]?_0x982530['options'][_0x89ab('0x1d')]||null:null,'attributes':_0x982530[_0x89ab('0x1c')]?_0x982530['options']['attributes']||null:null,'limit':_0x982530[_0x89ab('0x1c')]?_0x982530['options'][_0x89ab('0x1e')]||null:null,'include':_0x982530[_0x89ab('0x1c')]?_0x982530['options'][_0x89ab('0x1f')]?_[_0x89ab('0x20')](_0x982530['options'][_0x89ab('0x1f')],function(_0x5a16b6){return{'model':db[_0x5a16b6['model']],'as':_0x5a16b6['as'],'attributes':_0x5a16b6['attributes'],'include':_0x5a16b6[_0x89ab('0x1f')]?_['map'](_0x5a16b6['include'],function(_0xc45b73){return{'model':db[_0xc45b73[_0x89ab('0x21')]],'as':_0xc45b73['as'],'attributes':_0xc45b73[_0x89ab('0x22')],'include':_0xc45b73[_0x89ab('0x1f')]?_['map'](_0xc45b73[_0x89ab('0x1f')],function(_0x106409){return{'model':db[_0x106409[_0x89ab('0x21')]],'as':_0x106409['as'],'attributes':_0x106409[_0x89ab('0x22')]};}):[]};}):[]};}):[]:[]})[_0x89ab('0x11')](function(_0x35d4ce){logger[_0x89ab('0x23')](_0x89ab('0x1a'),_0x982530);logger[_0x89ab('0x14')](_0x89ab('0x1a'),_0x982530,JSON['stringify'](_0x35d4ce));_0x27c7ef(_0x35d4ce);})[_0x89ab('0x19')](function(_0x46c062){logger[_0x89ab('0x16')](_0x89ab('0x1a'),_0x46c062[_0x89ab('0x17')],_0x982530);_0x5d1c93(_0x34da91[_0x89ab('0x16')](0x1f4,_0x46c062[_0x89ab('0x17')]));});});};exports[_0x89ab('0x24')]=function(_0x31d141){var _0x4eab3e=this;return new Promise(function(_0x261a5a,_0x19847a){return db['SmsQueue']['find']({'raw':_0x31d141['options']?_0x31d141['options']['raw']===undefined?!![]:![]:!![],'where':_0x31d141[_0x89ab('0x1c')]?_0x31d141['options']['where']||null:null,'attributes':_0x31d141[_0x89ab('0x1c')]?_0x31d141[_0x89ab('0x1c')]['attributes']||null:null,'include':_0x31d141[_0x89ab('0x1c')]?_0x31d141[_0x89ab('0x1c')]['include']?_['map'](_0x31d141['options']['include'],function(_0x2d2a3f){return{'model':db[_0x2d2a3f[_0x89ab('0x21')]],'as':_0x2d2a3f['as'],'attributes':_0x2d2a3f[_0x89ab('0x22')],'include':_0x2d2a3f[_0x89ab('0x1f')]?_['map'](_0x2d2a3f[_0x89ab('0x1f')],function(_0x50e0cf){return{'model':db[_0x50e0cf[_0x89ab('0x21')]],'as':_0x50e0cf['as'],'attributes':_0x50e0cf[_0x89ab('0x22')],'include':_0x50e0cf[_0x89ab('0x1f')]?_[_0x89ab('0x20')](_0x50e0cf[_0x89ab('0x1f')],function(_0xcc0c6a){return{'model':db[_0xcc0c6a[_0x89ab('0x21')]],'as':_0xcc0c6a['as'],'attributes':_0xcc0c6a[_0x89ab('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fe7db){logger['info'](_0x89ab('0x24'),_0x31d141);logger[_0x89ab('0x14')](_0x89ab('0x24'),_0x31d141,JSON[_0x89ab('0x25')](_0x4fe7db));_0x261a5a(_0x4fe7db);})[_0x89ab('0x19')](function(_0x54e5f7){logger['error'](_0x89ab('0x24'),_0x54e5f7[_0x89ab('0x17')],_0x31d141);_0x19847a(_0x4eab3e['error'](0x1f4,_0x54e5f7['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 15cdcdc..2c72518 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 _0x5511=['register','length','smsQueue:','save','remove','update','emit'];(function(_0x2dbb79,_0x20187e){var _0x399e52=function(_0x41477f){while(--_0x41477f){_0x2dbb79['push'](_0x2dbb79['shift']());}};_0x399e52(++_0x20187e);}(_0x5511,0x18b));var _0x1551=function(_0x337b39,_0x3a5a7c){_0x337b39=_0x337b39-0x0;var _0x48850b=_0x5511[_0x337b39];return _0x48850b;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x1551('0x0'),_0x1551('0x1'),_0x1551('0x2')];function createListener(_0x4035fe,_0xc9c42c){return function(_0x2c6eb8){_0xc9c42c[_0x1551('0x3')](_0x4035fe,_0x2c6eb8);};}function removeListener(_0x42b5da,_0x546e41){return function(){SmsQueueEvents['removeListener'](_0x42b5da,_0x546e41);};}exports[_0x1551('0x4')]=function(_0xb74b11){for(var _0x1cc062=0x0,_0xf70c83=events[_0x1551('0x5')];_0x1cc062<_0xf70c83;_0x1cc062++){var _0x2fdbf7=events[_0x1cc062];var _0x44fb70=createListener(_0x1551('0x6')+_0x2fdbf7,_0xb74b11);SmsQueueEvents['on'](_0x2fdbf7,_0x44fb70);}}; \ No newline at end of file +var _0xc5a0=['length','smsQueue:','./smsQueue.events','save','remove','removeListener','register'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0xc5a0,0x1ec));var _0x0c5a=function(_0x48fe58,_0x334888){_0x48fe58=_0x48fe58-0x0;var _0x43f2c7=_0xc5a0[_0x48fe58];return _0x43f2c7;};'use strict';var SmsQueueEvents=require(_0x0c5a('0x0'));var events=[_0x0c5a('0x1'),_0x0c5a('0x2'),'update'];function createListener(_0x4e7fd0,_0xa92357){return function(_0x553a1a){_0xa92357['emit'](_0x4e7fd0,_0x553a1a);};}function removeListener(_0x1088d5,_0x569fd2){return function(){SmsQueueEvents[_0x0c5a('0x3')](_0x1088d5,_0x569fd2);};}exports[_0x0c5a('0x4')]=function(_0x16bd4e){for(var _0x4762e4=0x0,_0x3d93ad=events[_0x0c5a('0x5')];_0x4762e4<_0x3d93ad;_0x4762e4++){var _0x976af0=events[_0x4762e4];var _0x50b7ea=createListener(_0x0c5a('0x6')+_0x976af0,_0x16bd4e);SmsQueueEvents['on'](_0x976af0,_0x50b7ea);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c077d15..dabcc3f 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 _0xe6a1=['get','describe','/:id','show','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6a1,0x1c1));var _0x1e6a=function(_0x586b55,_0x437bea){_0x586b55=_0x586b55-0x0;var _0x22ea53=_0xe6a1[_0x586b55];return _0x22ea53;};'use strict';var multer=require('multer');var util=require(_0x1e6a('0x0'));var path=require(_0x1e6a('0x1'));var timeout=require(_0x1e6a('0x2'));var express=require(_0x1e6a('0x3'));var router=express[_0x1e6a('0x4')]();var auth=require(_0x1e6a('0x5'));var interaction=require(_0x1e6a('0x6'));var config=require(_0x1e6a('0x7'));var controller=require(_0x1e6a('0x8'));router['get']('/',auth[_0x1e6a('0x9')](),controller[_0x1e6a('0xa')]);router[_0x1e6a('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x1e6a('0xc')]);router[_0x1e6a('0xb')](_0x1e6a('0xd'),auth[_0x1e6a('0x9')](),controller[_0x1e6a('0xe')]);router['post']('/',auth[_0x1e6a('0x9')](),controller[_0x1e6a('0xf')]);router[_0x1e6a('0x10')]('/:id',auth[_0x1e6a('0x9')](),controller[_0x1e6a('0x11')]);router[_0x1e6a('0x12')](_0x1e6a('0xd'),auth[_0x1e6a('0x9')](),controller[_0x1e6a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8b67=['index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','path','express','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated'];(function(_0x1fe99d,_0xcfd984){var _0x2c6114=function(_0x39c3e4){while(--_0x39c3e4){_0x1fe99d['push'](_0x1fe99d['shift']());}};_0x2c6114(++_0xcfd984);}(_0x8b67,0x161));var _0x78b6=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8b67[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x78b6('0x0'));var timeout=require('connect-timeout');var express=require(_0x78b6('0x1'));var router=express[_0x78b6('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x78b6('0x3'));var config=require(_0x78b6('0x4'));var controller=require(_0x78b6('0x5'));router[_0x78b6('0x6')]('/',auth[_0x78b6('0x7')](),controller[_0x78b6('0x8')]);router[_0x78b6('0x6')](_0x78b6('0x9'),auth[_0x78b6('0x7')](),controller[_0x78b6('0xa')]);router[_0x78b6('0x6')](_0x78b6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x78b6('0xc')]('/',auth[_0x78b6('0x7')](),controller[_0x78b6('0xd')]);router[_0x78b6('0xe')](_0x78b6('0xb'),auth[_0x78b6('0x7')](),controller[_0x78b6('0xf')]);router[_0x78b6('0x10')](_0x78b6('0xb'),auth[_0x78b6('0x7')](),controller[_0x78b6('0x11')]);module[_0x78b6('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 4c6e101..6d58b9e 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 _0x21f3=['moment','STRING','DATE'];(function(_0x4abb52,_0x2d41e7){var _0xdb003a=function(_0x1a979c){while(--_0x1a979c){_0x4abb52['push'](_0x4abb52['shift']());}};_0xdb003a(++_0x2d41e7);}(_0x21f3,0xd8));var _0x321f=function(_0x475f27,_0x201863){_0x475f27=_0x475f27-0x0;var _0x57f6dc=_0x21f3[_0x475f27];return _0x57f6dc;};'use strict';var moment=require(_0x321f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x321f('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x321f('0x2')]},'leaveAt':{'type':Sequelize[_0x321f('0x2')]},'acceptAt':{'type':Sequelize[_0x321f('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9d2a=['STRING','DATE','moment','sequelize','exports'];(function(_0x21bc9b,_0x1d8157){var _0x262273=function(_0x2fe2e3){while(--_0x2fe2e3){_0x21bc9b['push'](_0x21bc9b['shift']());}};_0x262273(++_0x1d8157);}(_0x9d2a,0xb6));var _0xa9d2=function(_0x429518,_0x111948){_0x429518=_0x429518-0x0;var _0x7592d1=_0x9d2a[_0x429518];return _0x7592d1;};'use strict';var moment=require(_0xa9d2('0x0'));var Sequelize=require(_0xa9d2('0x1'));module[_0xa9d2('0x2')]={'uniqueid':{'type':Sequelize[_0xa9d2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa9d2('0x3')]},'joinAt':{'type':Sequelize[_0xa9d2('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa9d2('0x4')]},'exitAt':{'type':Sequelize[_0xa9d2('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 3b56c1f..4ac197a 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 _0x2790=['moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','status','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x19e36e,_0x6765b8){var _0x4af474=function(_0xe2388f){while(--_0xe2388f){_0x19e36e['push'](_0x19e36e['shift']());}};_0x4af474(++_0x6765b8);}(_0x2790,0x113));var _0x0279=function(_0x263714,_0x399b37){_0x263714=_0x263714-0x0;var _0x1cd43d=_0x2790[_0x263714];return _0x1cd43d;};'use strict';var pdf=require(_0x0279('0x0'));var emlformat=require(_0x0279('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0279('0x2'));var jsonpatch=require(_0x0279('0x3'));var rp=require(_0x0279('0x4'));var moment=require(_0x0279('0x5'));var BPromise=require(_0x0279('0x6'));var Mustache=require(_0x0279('0x7'));var util=require(_0x0279('0x8'));var path=require('path');var sox=require(_0x0279('0x9'));var csv=require(_0x0279('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0279('0xb'));var crypto=require(_0x0279('0xc'));var jsforce=require(_0x0279('0xd'));var deskjs=require(_0x0279('0xe'));var toCsv=require(_0x0279('0xa'));var querystring=require(_0x0279('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0279('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0279('0x11'));var utils=require(_0x0279('0x12'));var config=require(_0x0279('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0279('0x14'))['db'];function respondWithStatusCode(_0x15d888,_0x2f9b8d){_0x2f9b8d=_0x2f9b8d||0xcc;return function(_0x3899c8){if(_0x3899c8){return _0x15d888[_0x0279('0x15')](_0x2f9b8d);}return _0x15d888['status'](_0x2f9b8d)[_0x0279('0x16')]();};}function respondWithResult(_0x21284c,_0x1fc941){_0x1fc941=_0x1fc941||0xc8;return function(_0x57e8fe){if(_0x57e8fe){return _0x21284c['status'](_0x1fc941)['json'](_0x57e8fe);}};}function respondWithFilteredResult(_0x3d544e,_0xea4b39){return function(_0x501d82){if(_0x501d82){var _0xa43569=_0x501d82['count'],_0x3be9a2=_0xea4b39[_0x0279('0x17')],_0x18b57d=_0xea4b39['offset']+_0xea4b39['limit'],_0x1efcc0;if(_0x18b57d>=_0xa43569){_0x18b57d=_0xa43569;_0x1efcc0=0xc8;}else{_0x1efcc0=0xce;}_0x3d544e[_0x0279('0x18')](_0x1efcc0);return _0x3d544e[_0x0279('0x19')](_0x0279('0x1a'),_0x3be9a2+'-'+_0x18b57d+'/'+_0xa43569)[_0x0279('0x1b')](_0x501d82);}return null;};}function patchUpdates(_0x301d40){return function(_0x2b06ad){try{jsonpatch[_0x0279('0x1c')](_0x2b06ad,_0x301d40,!![]);}catch(_0x4b00ac){return BPromise[_0x0279('0x1d')](_0x4b00ac);}return _0x2b06ad[_0x0279('0x1e')]();};}function saveUpdates(_0xe3ef49,_0x124075){return function(_0x20549e){if(_0x20549e){return _0x20549e['update'](_0xe3ef49)[_0x0279('0x1f')](function(_0x32d518){return _0x32d518;});}return null;};}function removeEntity(_0x419792,_0x56308a){return function(_0x3dcad6){if(_0x3dcad6){return _0x3dcad6[_0x0279('0x20')]()[_0x0279('0x1f')](function(){_0x419792[_0x0279('0x18')](0xcc)[_0x0279('0x16')]();});}};}function handleEntityNotFound(_0x2dcaf8,_0x46dd25){return function(_0x1f31fd){if(!_0x1f31fd){_0x2dcaf8[_0x0279('0x15')](0x194);}return _0x1f31fd;};}function handleError(_0x2d0654,_0x301728){_0x301728=_0x301728||0x1f4;return function(_0x47a3a6){logger['error'](_0x47a3a6[_0x0279('0x21')]);if(_0x47a3a6[_0x0279('0x22')]){delete _0x47a3a6[_0x0279('0x22')];}_0x2d0654['status'](_0x301728)[_0x0279('0x23')](_0x47a3a6);};}exports['index']=function(_0x184c2e,_0x2d91d){var _0x1c6282={},_0xedfac2={},_0x591c9e={'count':0x0,'rows':[]};var _0x40578a=_['map'](db[_0x0279('0x24')][_0x0279('0x25')],function(_0x514fa4){return{'name':_0x514fa4[_0x0279('0x26')],'type':_0x514fa4[_0x0279('0x27')][_0x0279('0x28')]};});_0xedfac2[_0x0279('0x29')]=_['map'](_0x40578a,'name');_0xedfac2[_0x0279('0x2a')]=_[_0x0279('0x2b')](_0x184c2e[_0x0279('0x2a')]);_0xedfac2[_0x0279('0x2c')]=_[_0x0279('0x2d')](_0xedfac2[_0x0279('0x29')],_0xedfac2[_0x0279('0x2a')]);_0x1c6282[_0x0279('0x2e')]=_[_0x0279('0x2d')](_0xedfac2[_0x0279('0x29')],qs['fields'](_0x184c2e[_0x0279('0x2a')][_0x0279('0x2f')]));_0x1c6282[_0x0279('0x2e')]=_0x1c6282[_0x0279('0x2e')][_0x0279('0x30')]?_0x1c6282['attributes']:_0xedfac2[_0x0279('0x29')];if(!_0x184c2e[_0x0279('0x2a')]['hasOwnProperty'](_0x0279('0x31'))){_0x1c6282['limit']=qs[_0x0279('0x32')](_0x184c2e['query'][_0x0279('0x32')]);_0x1c6282['offset']=qs[_0x0279('0x17')](_0x184c2e[_0x0279('0x2a')][_0x0279('0x17')]);}_0x1c6282[_0x0279('0x33')]=qs[_0x0279('0x34')](_0x184c2e[_0x0279('0x2a')][_0x0279('0x34')]);_0x1c6282[_0x0279('0x35')]=qs['filters'](_[_0x0279('0x36')](_0x184c2e[_0x0279('0x2a')],_0xedfac2[_0x0279('0x2c')]),_0x40578a);if(_0x184c2e['query'][_0x0279('0x37')]){_0x1c6282[_0x0279('0x35')]=_['merge'](_0x1c6282[_0x0279('0x35')],{'$or':_['map'](_0x40578a,function(_0x195359){if(_0x195359['type']!==_0x0279('0x38')){var _0x39f25b={};_0x39f25b[_0x195359[_0x0279('0x22')]]={'$like':'%'+_0x184c2e[_0x0279('0x2a')][_0x0279('0x37')]+'%'};return _0x39f25b;}})});}_0x1c6282=_[_0x0279('0x39')]({},_0x1c6282,_0x184c2e[_0x0279('0x3a')]);var _0xec4c31={'where':_0x1c6282['where']};return db[_0x0279('0x24')][_0x0279('0x3b')](_0xec4c31)[_0x0279('0x1f')](function(_0x2aa4d0){_0x591c9e[_0x0279('0x3b')]=_0x2aa4d0;if(_0x184c2e[_0x0279('0x2a')][_0x0279('0x3c')]){_0x1c6282[_0x0279('0x3d')]=[{'all':!![]}];}return db[_0x0279('0x24')]['findAll'](_0x1c6282);})['then'](function(_0x4df4ac){_0x591c9e[_0x0279('0x3e')]=_0x4df4ac;return _0x591c9e;})['then'](respondWithFilteredResult(_0x2d91d,_0x1c6282))[_0x0279('0x3f')](handleError(_0x2d91d,null));};exports[_0x0279('0x40')]=function(_0x575c0e,_0x23e006){var _0x283a6a={'raw':!![],'where':{'id':_0x575c0e[_0x0279('0x41')]['id']}},_0x52c2d4={};_0x52c2d4[_0x0279('0x29')]=_[_0x0279('0x2b')](db['SmsQueueReport'][_0x0279('0x25')]);_0x52c2d4['query']=_[_0x0279('0x2b')](_0x575c0e['query']);_0x52c2d4[_0x0279('0x2c')]=_[_0x0279('0x2d')](_0x52c2d4[_0x0279('0x29')],_0x52c2d4[_0x0279('0x2a')]);_0x283a6a[_0x0279('0x2e')]=_[_0x0279('0x2d')](_0x52c2d4[_0x0279('0x29')],qs[_0x0279('0x2f')](_0x575c0e[_0x0279('0x2a')][_0x0279('0x2f')]));_0x283a6a[_0x0279('0x2e')]=_0x283a6a['attributes'][_0x0279('0x30')]?_0x283a6a[_0x0279('0x2e')]:_0x52c2d4[_0x0279('0x29')];if(_0x575c0e['query'][_0x0279('0x3c')]){_0x283a6a[_0x0279('0x3d')]=[{'all':!![]}];}_0x283a6a=_[_0x0279('0x39')]({},_0x283a6a,_0x575c0e['options']);return db[_0x0279('0x24')][_0x0279('0x42')](_0x283a6a)['then'](handleEntityNotFound(_0x23e006,null))[_0x0279('0x1f')](respondWithResult(_0x23e006,null))[_0x0279('0x3f')](handleError(_0x23e006,null));};exports['create']=function(_0x4158aa,_0x3da95d){return db['SmsQueueReport'][_0x0279('0x43')](_0x4158aa[_0x0279('0x44')],{})[_0x0279('0x1f')](respondWithResult(_0x3da95d,0xc9))[_0x0279('0x3f')](handleError(_0x3da95d,null));};exports['update']=function(_0x2384b5,_0x324907){if(_0x2384b5[_0x0279('0x44')]['id']){delete _0x2384b5['body']['id'];}return db[_0x0279('0x24')][_0x0279('0x42')]({'where':{'id':_0x2384b5[_0x0279('0x41')]['id']}})[_0x0279('0x1f')](handleEntityNotFound(_0x324907,null))[_0x0279('0x1f')](saveUpdates(_0x2384b5[_0x0279('0x44')],null))[_0x0279('0x1f')](respondWithResult(_0x324907,null))[_0x0279('0x3f')](handleError(_0x324907,null));};exports[_0x0279('0x20')]=function(_0x73b8ee,_0x393cc0){return db['SmsQueueReport'][_0x0279('0x42')]({'where':{'id':_0x73b8ee['params']['id']}})[_0x0279('0x1f')](handleEntityNotFound(_0x393cc0,null))['then'](removeEntity(_0x393cc0,null))[_0x0279('0x3f')](handleError(_0x393cc0,null));};exports[_0x0279('0x45')]=function(_0x5bc0b6,_0x7d039b){return db[_0x0279('0x24')]['describe']()['then'](respondWithResult(_0x7d039b,null))[_0x0279('0x3f')](handleError(_0x7d039b,null));}; \ No newline at end of file +var _0x9468=['fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','include','SmsQueueReport','rows','catch','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','attributes'];(function(_0xcffa4,_0x235b3e){var _0x5bdf7b=function(_0x3610e3){while(--_0x3610e3){_0xcffa4['push'](_0xcffa4['shift']());}};_0x5bdf7b(++_0x235b3e);}(_0x9468,0x1e6));var _0x8946=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x9468[_0x43a37c];return _0x5d1d40;};'use strict';var pdf=require(_0x8946('0x0'));var emlformat=require(_0x8946('0x1'));var rimraf=require(_0x8946('0x2'));var zipdir=require(_0x8946('0x3'));var jsonpatch=require(_0x8946('0x4'));var rp=require(_0x8946('0x5'));var moment=require(_0x8946('0x6'));var BPromise=require(_0x8946('0x7'));var Mustache=require('mustache');var util=require(_0x8946('0x8'));var path=require(_0x8946('0x9'));var sox=require(_0x8946('0xa'));var csv=require(_0x8946('0xb'));var ejs=require(_0x8946('0xc'));var fs=require('fs');var _=require(_0x8946('0xd'));var squel=require(_0x8946('0xe'));var crypto=require(_0x8946('0xf'));var jsforce=require(_0x8946('0x10'));var deskjs=require(_0x8946('0x11'));var toCsv=require('to-csv');var querystring=require(_0x8946('0x12'));var Papa=require('papaparse');var Redis=require(_0x8946('0x13'));var authService=require(_0x8946('0x14'));var qs=require(_0x8946('0x15'));var as=require(_0x8946('0x16'));var hardwareService=require(_0x8946('0x17'));var logger=require(_0x8946('0x18'))(_0x8946('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8946('0x1a'))['db'];function respondWithStatusCode(_0x36cb87,_0xb2b1d5){_0xb2b1d5=_0xb2b1d5||0xcc;return function(_0x11528b){if(_0x11528b){return _0x36cb87[_0x8946('0x1b')](_0xb2b1d5);}return _0x36cb87[_0x8946('0x1c')](_0xb2b1d5)['end']();};}function respondWithResult(_0x3c18a5,_0x28eb34){_0x28eb34=_0x28eb34||0xc8;return function(_0xefe991){if(_0xefe991){return _0x3c18a5[_0x8946('0x1c')](_0x28eb34)['json'](_0xefe991);}};}function respondWithFilteredResult(_0x5b1f8e,_0x2bfdf5){return function(_0x370a31){if(_0x370a31){var _0xe37d1e=_0x370a31['count'],_0x3b198a=_0x2bfdf5['offset'],_0x3a6bbe=_0x2bfdf5[_0x8946('0x1d')]+_0x2bfdf5[_0x8946('0x1e')],_0x4c6ce1;if(_0x3a6bbe>=_0xe37d1e){_0x3a6bbe=_0xe37d1e;_0x4c6ce1=0xc8;}else{_0x4c6ce1=0xce;}_0x5b1f8e[_0x8946('0x1c')](_0x4c6ce1);return _0x5b1f8e[_0x8946('0x1f')](_0x8946('0x20'),_0x3b198a+'-'+_0x3a6bbe+'/'+_0xe37d1e)[_0x8946('0x21')](_0x370a31);}return null;};}function patchUpdates(_0x28928a){return function(_0x3f3e8b){try{jsonpatch[_0x8946('0x22')](_0x3f3e8b,_0x28928a,!![]);}catch(_0x5ec1e9){return BPromise[_0x8946('0x23')](_0x5ec1e9);}return _0x3f3e8b[_0x8946('0x24')]();};}function saveUpdates(_0x5758b6,_0xa227a1){return function(_0x2b3c47){if(_0x2b3c47){return _0x2b3c47['update'](_0x5758b6)[_0x8946('0x25')](function(_0x3a907c){return _0x3a907c;});}return null;};}function removeEntity(_0x55a20f,_0x5afeb8){return function(_0x4b90df){if(_0x4b90df){return _0x4b90df[_0x8946('0x26')]()[_0x8946('0x25')](function(){_0x55a20f[_0x8946('0x1c')](0xcc)[_0x8946('0x27')]();});}};}function handleEntityNotFound(_0x3e9205,_0x29c8dc){return function(_0x58cd4f){if(!_0x58cd4f){_0x3e9205[_0x8946('0x1b')](0x194);}return _0x58cd4f;};}function handleError(_0x2abc0b,_0x188591){_0x188591=_0x188591||0x1f4;return function(_0x25fb8d){logger[_0x8946('0x28')](_0x25fb8d[_0x8946('0x29')]);if(_0x25fb8d['name']){delete _0x25fb8d[_0x8946('0x2a')];}_0x2abc0b['status'](_0x188591)[_0x8946('0x2b')](_0x25fb8d);};}exports['index']=function(_0x4df20d,_0x227ef7){var _0x156d8b={},_0x485635={},_0x4d8d24={'count':0x0,'rows':[]};var _0x771e2=_[_0x8946('0x2c')](db['SmsQueueReport'][_0x8946('0x2d')],function(_0x4785d2){return{'name':_0x4785d2['fieldName'],'type':_0x4785d2['type'][_0x8946('0x2e')]};});_0x485635[_0x8946('0x2f')]=_['map'](_0x771e2,'name');_0x485635[_0x8946('0x30')]=_[_0x8946('0x31')](_0x4df20d[_0x8946('0x30')]);_0x485635[_0x8946('0x32')]=_[_0x8946('0x33')](_0x485635[_0x8946('0x2f')],_0x485635['query']);_0x156d8b[_0x8946('0x34')]=_[_0x8946('0x33')](_0x485635[_0x8946('0x2f')],qs[_0x8946('0x35')](_0x4df20d[_0x8946('0x30')]['fields']));_0x156d8b[_0x8946('0x34')]=_0x156d8b[_0x8946('0x34')]['length']?_0x156d8b[_0x8946('0x34')]:_0x485635[_0x8946('0x2f')];if(!_0x4df20d[_0x8946('0x30')][_0x8946('0x36')](_0x8946('0x37'))){_0x156d8b[_0x8946('0x1e')]=qs[_0x8946('0x1e')](_0x4df20d['query'][_0x8946('0x1e')]);_0x156d8b[_0x8946('0x1d')]=qs[_0x8946('0x1d')](_0x4df20d[_0x8946('0x30')][_0x8946('0x1d')]);}_0x156d8b[_0x8946('0x38')]=qs[_0x8946('0x39')](_0x4df20d[_0x8946('0x30')][_0x8946('0x39')]);_0x156d8b[_0x8946('0x3a')]=qs[_0x8946('0x32')](_[_0x8946('0x3b')](_0x4df20d[_0x8946('0x30')],_0x485635[_0x8946('0x32')]),_0x771e2);if(_0x4df20d[_0x8946('0x30')]['filter']){_0x156d8b[_0x8946('0x3a')]=_[_0x8946('0x3c')](_0x156d8b[_0x8946('0x3a')],{'$or':_[_0x8946('0x2c')](_0x771e2,function(_0x5b8a1b){if(_0x5b8a1b[_0x8946('0x3d')]!==_0x8946('0x3e')){var _0x429b76={};_0x429b76[_0x5b8a1b[_0x8946('0x2a')]]={'$like':'%'+_0x4df20d['query'][_0x8946('0x3f')]+'%'};return _0x429b76;}})});}_0x156d8b=_['merge']({},_0x156d8b,_0x4df20d[_0x8946('0x40')]);var _0x4c0bd8={'where':_0x156d8b['where']};return db['SmsQueueReport']['count'](_0x4c0bd8)[_0x8946('0x25')](function(_0x3b2ab4){_0x4d8d24[_0x8946('0x41')]=_0x3b2ab4;if(_0x4df20d[_0x8946('0x30')][_0x8946('0x42')]){_0x156d8b[_0x8946('0x43')]=[{'all':!![]}];}return db[_0x8946('0x44')]['findAll'](_0x156d8b);})[_0x8946('0x25')](function(_0x1cf7e9){_0x4d8d24[_0x8946('0x45')]=_0x1cf7e9;return _0x4d8d24;})[_0x8946('0x25')](respondWithFilteredResult(_0x227ef7,_0x156d8b))[_0x8946('0x46')](handleError(_0x227ef7,null));};exports['show']=function(_0x3b4a6a,_0x57edde){var _0x3907ca={'raw':!![],'where':{'id':_0x3b4a6a[_0x8946('0x47')]['id']}},_0x1ba4f5={};_0x1ba4f5[_0x8946('0x2f')]=_[_0x8946('0x31')](db[_0x8946('0x44')][_0x8946('0x2d')]);_0x1ba4f5[_0x8946('0x30')]=_[_0x8946('0x31')](_0x3b4a6a[_0x8946('0x30')]);_0x1ba4f5['filters']=_[_0x8946('0x33')](_0x1ba4f5[_0x8946('0x2f')],_0x1ba4f5[_0x8946('0x30')]);_0x3907ca['attributes']=_[_0x8946('0x33')](_0x1ba4f5['model'],qs[_0x8946('0x35')](_0x3b4a6a['query'][_0x8946('0x35')]));_0x3907ca['attributes']=_0x3907ca[_0x8946('0x34')][_0x8946('0x48')]?_0x3907ca[_0x8946('0x34')]:_0x1ba4f5['model'];if(_0x3b4a6a[_0x8946('0x30')]['includeAll']){_0x3907ca[_0x8946('0x43')]=[{'all':!![]}];}_0x3907ca=_[_0x8946('0x3c')]({},_0x3907ca,_0x3b4a6a[_0x8946('0x40')]);return db[_0x8946('0x44')][_0x8946('0x49')](_0x3907ca)[_0x8946('0x25')](handleEntityNotFound(_0x57edde,null))[_0x8946('0x25')](respondWithResult(_0x57edde,null))[_0x8946('0x46')](handleError(_0x57edde,null));};exports[_0x8946('0x4a')]=function(_0x3cf443,_0x37f8da){return db[_0x8946('0x44')][_0x8946('0x4a')](_0x3cf443[_0x8946('0x4b')],{})[_0x8946('0x25')](respondWithResult(_0x37f8da,0xc9))[_0x8946('0x46')](handleError(_0x37f8da,null));};exports['update']=function(_0x193e8f,_0x58584a){if(_0x193e8f[_0x8946('0x4b')]['id']){delete _0x193e8f[_0x8946('0x4b')]['id'];}return db[_0x8946('0x44')][_0x8946('0x49')]({'where':{'id':_0x193e8f[_0x8946('0x47')]['id']}})[_0x8946('0x25')](handleEntityNotFound(_0x58584a,null))[_0x8946('0x25')](saveUpdates(_0x193e8f[_0x8946('0x4b')],null))[_0x8946('0x25')](respondWithResult(_0x58584a,null))['catch'](handleError(_0x58584a,null));};exports['destroy']=function(_0x69dd14,_0x2b26fd){return db[_0x8946('0x44')][_0x8946('0x49')]({'where':{'id':_0x69dd14[_0x8946('0x47')]['id']}})['then'](handleEntityNotFound(_0x2b26fd,null))[_0x8946('0x25')](removeEntity(_0x2b26fd,null))['catch'](handleError(_0x2b26fd,null));};exports[_0x8946('0x4c')]=function(_0x35e507,_0x33de15){return db[_0x8946('0x44')]['describe']()[_0x8946('0x25')](respondWithResult(_0x33de15,null))[_0x8946('0x46')](handleError(_0x33de15,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 88f9837..64416a6 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 _0x613f=['exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','./smsQueueReport.attributes'];(function(_0x5a60ce,_0x48f080){var _0x393e5e=function(_0x1c58fc){while(--_0x1c58fc){_0x5a60ce['push'](_0x5a60ce['shift']());}};_0x393e5e(++_0x48f080);}(_0x613f,0x6d));var _0xf613=function(_0x29a89c,_0x5523ee){_0x29a89c=_0x29a89c-0x0;var _0x5f4a51=_0x613f[_0x29a89c];return _0x5f4a51;};'use strict';var _=require(_0xf613('0x0'));var util=require(_0xf613('0x1'));var logger=require(_0xf613('0x2'))(_0xf613('0x3'));var moment=require(_0xf613('0x4'));var BPromise=require(_0xf613('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf613('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf613('0x7'));module[_0xf613('0x8')]=function(_0x42f40d,_0x28a9a4){return _0x42f40d[_0xf613('0x9')](_0xf613('0xa'),attributes,{'tableName':_0xf613('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf613('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14ac=['SmsQueueReport','report_sms_queue','uniqueid','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','define'];(function(_0x11e03f,_0x20b967){var _0x5666fe=function(_0x19ce63){while(--_0x19ce63){_0x11e03f['push'](_0x11e03f['shift']());}};_0x5666fe(++_0x20b967);}(_0x14ac,0x13b));var _0xc14a=function(_0x2b5584,_0x2c1bab){_0x2b5584=_0x2b5584-0x0;var _0x3f8885=_0x14ac[_0x2b5584];return _0x3f8885;};'use strict';var _=require('lodash');var util=require(_0xc14a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc14a('0x1'));var BPromise=require(_0xc14a('0x2'));var rp=require(_0xc14a('0x3'));var fs=require('fs');var path=require(_0xc14a('0x4'));var rimraf=require(_0xc14a('0x5'));var config=require(_0xc14a('0x6'));var attributes=require(_0xc14a('0x7'));module['exports']=function(_0x29832d,_0x22486f){return _0x29832d[_0xc14a('0x8')](_0xc14a('0x9'),attributes,{'tableName':_0xc14a('0xa'),'paranoid':![],'indexes':[{'name':_0xc14a('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 4098a91..024e71b 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 _0xefdb=['where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','SmsQueueReport','create','body','options','raw','stringify','catch','CreateSmsQueueReport','UpdateSmsQueueReport','update'];(function(_0x14bc26,_0x13be0b){var _0x441c92=function(_0x2ff922){while(--_0x2ff922){_0x14bc26['push'](_0x14bc26['shift']());}};_0x441c92(++_0x13be0b);}(_0xefdb,0x1c2));var _0xbefd=function(_0x1e90bf,_0x464a2e){_0x1e90bf=_0x1e90bf-0x0;var _0x176a4c=_0xefdb[_0x1e90bf];return _0x176a4c;};'use strict';var _=require('lodash');var util=require(_0xbefd('0x0'));var moment=require(_0xbefd('0x1'));var BPromise=require(_0xbefd('0x2'));var rs=require(_0xbefd('0x3'));var fs=require('fs');var Redis=require(_0xbefd('0x4'));var db=require(_0xbefd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbefd('0x6'))('rpc');var config=require(_0xbefd('0x7'));var jayson=require(_0xbefd('0x8'));var client=jayson['client'][_0xbefd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdca12f,_0x539cc4,_0x405844){return new BPromise(function(_0x12d6fa,_0x2f601c){return client[_0xbefd('0xa')](_0xdca12f,_0x405844)[_0xbefd('0xb')](function(_0x515133){logger[_0xbefd('0xc')](_0xbefd('0xd'),_0x539cc4,'request\x20sent');logger[_0xbefd('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x539cc4,_0xbefd('0xf'),JSON['stringify'](_0x515133));if(_0x515133[_0xbefd('0x10')]){if(_0x515133[_0xbefd('0x10')][_0xbefd('0x11')]===0x1f4){logger[_0xbefd('0x10')](_0xbefd('0xd'),_0x539cc4,_0x515133[_0xbefd('0x10')][_0xbefd('0x12')]);return _0x2f601c(_0x515133[_0xbefd('0x10')][_0xbefd('0x12')]);}logger[_0xbefd('0x10')](_0xbefd('0xd'),_0x539cc4,_0x515133[_0xbefd('0x10')][_0xbefd('0x12')]);return _0x12d6fa(_0x515133[_0xbefd('0x10')]['message']);}else{logger['info'](_0xbefd('0xd'),_0x539cc4,_0xbefd('0xf'));_0x12d6fa(_0x515133[_0xbefd('0x13')][_0xbefd('0x12')]);}})['catch'](function(_0x40943d){logger[_0xbefd('0x10')](_0xbefd('0xd'),_0x539cc4,_0x40943d);_0x2f601c(_0x40943d);});});}exports['CreateSmsQueueReport']=function(_0x5699fa){var _0x5b9360=this;return new Promise(function(_0x29e7a8,_0x5d83c7){return db[_0xbefd('0x14')][_0xbefd('0x15')](_0x5699fa[_0xbefd('0x16')],{'raw':_0x5699fa[_0xbefd('0x17')]?_0x5699fa['options'][_0xbefd('0x18')]===undefined?!![]:![]:!![]})[_0xbefd('0xb')](function(_0x4433fd){logger[_0xbefd('0xc')]('CreateSmsQueueReport',_0x5699fa);logger[_0xbefd('0xe')]('CreateSmsQueueReport',_0x5699fa,JSON[_0xbefd('0x19')](_0x4433fd));_0x29e7a8(_0x4433fd);})[_0xbefd('0x1a')](function(_0x3f26d2){logger[_0xbefd('0x10')](_0xbefd('0x1b'),_0x3f26d2[_0xbefd('0x12')],_0x5699fa);_0x5d83c7(_0x5b9360[_0xbefd('0x10')](0x1f4,_0x3f26d2[_0xbefd('0x12')]));});});};exports[_0xbefd('0x1c')]=function(_0x28154d){var _0x5af148=this;return new Promise(function(_0x1ad1fb,_0xdbe589){return db['SmsQueueReport'][_0xbefd('0x1d')](_0x28154d[_0xbefd('0x16')],{'raw':_0x28154d[_0xbefd('0x17')]?_0x28154d['options'][_0xbefd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28154d[_0xbefd('0x17')]?_0x28154d[_0xbefd('0x17')][_0xbefd('0x1e')]||null:null,'attributes':_0x28154d['options']?_0x28154d['options'][_0xbefd('0x1f')]||null:null,'limit':_0x28154d[_0xbefd('0x17')]?_0x28154d['options']['limit']||null:null})['then'](function(_0x13e0a4){logger[_0xbefd('0xc')](_0xbefd('0x1c'),_0x28154d);logger[_0xbefd('0xe')](_0xbefd('0x1c'),_0x28154d,JSON[_0xbefd('0x19')](_0x13e0a4));_0x1ad1fb(_0x13e0a4);})[_0xbefd('0x1a')](function(_0x5a2d63){logger[_0xbefd('0x10')]('UpdateSmsQueueReport',_0x5a2d63['message'],_0x28154d);_0xdbe589(_0x5af148[_0xbefd('0x10')](0x1f4,_0x5a2d63[_0xbefd('0x12')]));});});}; \ No newline at end of file +var _0xb09a=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','info','UpdateSmsQueueReport','update','body','limit','stringify','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x29a032,_0x429813){var _0x534df2=function(_0x125eb7){while(--_0x125eb7){_0x29a032['push'](_0x29a032['shift']());}};_0x534df2(++_0x429813);}(_0xb09a,0x67));var _0xab09=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xb09a[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0xab09('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab09('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab09('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xab09('0x3'));var logger=require(_0xab09('0x4'))(_0xab09('0x5'));var config=require('../../config/environment');var jayson=require(_0xab09('0x6'));var client=jayson['client'][_0xab09('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x39ed3f,_0x5a192a,_0x596a43){return new BPromise(function(_0x364a3d,_0x2cac07){return client['request'](_0x39ed3f,_0x596a43)[_0xab09('0x8')](function(_0x490f48){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x5a192a,'request\x20sent');logger[_0xab09('0x9')](_0xab09('0xa'),_0x5a192a,_0xab09('0xb'),JSON['stringify'](_0x490f48));if(_0x490f48[_0xab09('0xc')]){if(_0x490f48[_0xab09('0xc')]['code']===0x1f4){logger['error'](_0xab09('0xd'),_0x5a192a,_0x490f48[_0xab09('0xc')][_0xab09('0xe')]);return _0x2cac07(_0x490f48[_0xab09('0xc')][_0xab09('0xe')]);}logger[_0xab09('0xc')](_0xab09('0xd'),_0x5a192a,_0x490f48[_0xab09('0xc')][_0xab09('0xe')]);return _0x364a3d(_0x490f48[_0xab09('0xc')]['message']);}else{logger['info'](_0xab09('0xd'),_0x5a192a,_0xab09('0xb'));_0x364a3d(_0x490f48[_0xab09('0xf')][_0xab09('0xe')]);}})[_0xab09('0x10')](function(_0x1029b4){logger[_0xab09('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x5a192a,_0x1029b4);_0x2cac07(_0x1029b4);});});}exports[_0xab09('0x11')]=function(_0x4963cf){var _0x3c80a7=this;return new Promise(function(_0x4d4c6f,_0x55f33f){return db[_0xab09('0x12')][_0xab09('0x13')](_0x4963cf['body'],{'raw':_0x4963cf[_0xab09('0x14')]?_0x4963cf['options'][_0xab09('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x2ae8c4){logger[_0xab09('0x16')](_0xab09('0x11'),_0x4963cf);logger['debug'](_0xab09('0x11'),_0x4963cf,JSON['stringify'](_0x2ae8c4));_0x4d4c6f(_0x2ae8c4);})[_0xab09('0x10')](function(_0x5585e2){logger[_0xab09('0xc')](_0xab09('0x11'),_0x5585e2[_0xab09('0xe')],_0x4963cf);_0x55f33f(_0x3c80a7[_0xab09('0xc')](0x1f4,_0x5585e2[_0xab09('0xe')]));});});};exports[_0xab09('0x17')]=function(_0xf74e15){var _0x5a3272=this;return new Promise(function(_0x3514d6,_0x52540e){return db[_0xab09('0x12')][_0xab09('0x18')](_0xf74e15[_0xab09('0x19')],{'raw':_0xf74e15[_0xab09('0x14')]?_0xf74e15[_0xab09('0x14')][_0xab09('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf74e15[_0xab09('0x14')]?_0xf74e15['options']['where']||null:null,'attributes':_0xf74e15['options']?_0xf74e15['options']['attributes']||null:null,'limit':_0xf74e15[_0xab09('0x14')]?_0xf74e15['options'][_0xab09('0x1a')]||null:null})[_0xab09('0x8')](function(_0x19de76){logger['info'](_0xab09('0x17'),_0xf74e15);logger[_0xab09('0x9')](_0xab09('0x17'),_0xf74e15,JSON[_0xab09('0x1b')](_0x19de76));_0x3514d6(_0x19de76);})[_0xab09('0x10')](function(_0x4afaee){logger['error']('UpdateSmsQueueReport',_0x4afaee['message'],_0xf74e15);_0x52540e(_0x5a3272[_0xab09('0xc')](0x1f4,_0x4afaee[_0xab09('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 8c298fe..500d990 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 _0xd8b0=['index','get','/describe','describe','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller'];(function(_0x4e52ee,_0x46e2ee){var _0x450b6e=function(_0x41e42b){while(--_0x41e42b){_0x4e52ee['push'](_0x4e52ee['shift']());}};_0x450b6e(++_0x46e2ee);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var 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',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0x10'),auth[_0x0d8b('0xb')](),controller['update']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);module[_0x0d8b('0x13')]=router; \ No newline at end of file +var _0xf4f4=['Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x282a79,_0x1956e4){var _0x45e5f3=function(_0x24918f){while(--_0x24918f){_0x282a79['push'](_0x282a79['shift']());}};_0x45e5f3(++_0x1956e4);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x397e46,_0xff151b){_0x397e46=_0x397e46-0x0;var _0x234ba9=_0xf4f4[_0x397e46];return _0x234ba9;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var auth=require(_0x4f4f('0x5'));var interaction=require(_0x4f4f('0x6'));var config=require('../../config/environment');var controller=require(_0x4f4f('0x7'));router['get']('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x9')]);router[_0x4f4f('0xa')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xa')](_0x4f4f('0xd'),auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xf')]('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0x11')](_0x4f4f('0xd'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x12')]);router['delete']('/:id',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x13')]);module[_0x4f4f('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index a47dbd9..b0b8003 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 _0xc05b=['sequelize','exports','ENUM','account','queue','DATE','NOW','moment'];(function(_0x778c2b,_0x4575e1){var _0x21d4d3=function(_0x2dc375){while(--_0x2dc375){_0x778c2b['push'](_0x778c2b['shift']());}};_0x21d4d3(++_0x4575e1);}(_0xc05b,0x8f));var _0xbc05=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0xc05b[_0x384231];return _0x2480bf;};'use strict';var moment=require(_0xbc05('0x0'));var Sequelize=require(_0xbc05('0x1'));module[_0xbc05('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbc05('0x3')](_0xbc05('0x4'),'agent',_0xbc05('0x5')),'allowNull':![],'defaultValue':_0xbc05('0x5')},'transferredAt':{'type':Sequelize[_0xbc05('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbc05('0x7')]}}; \ No newline at end of file +var _0x4683=['moment','sequelize','exports','STRING','ENUM','agent','queue','DATE','NOW'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0x4683,0x1ef));var _0x3468=function(_0x46769b,_0x44e80d){_0x46769b=_0x46769b-0x0;var _0x4d5974=_0x4683[_0x46769b];return _0x4d5974;};'use strict';var moment=require(_0x3468('0x0'));var Sequelize=require(_0x3468('0x1'));module[_0x3468('0x2')]={'uniqueid':{'type':Sequelize[_0x3468('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x3468('0x4')]('account',_0x3468('0x5'),_0x3468('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x3468('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x3468('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 7742a51..5d69d9d 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 _0x7e16=['length','nolimit','order','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','rawAttributes','intersection','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','limit','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','SmsTransferReport','fieldName','key','model','query','keys','attributes','fields'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x7e16,0x16f));var _0x67e1=function(_0x287cb6,_0x34bd29){_0x287cb6=_0x287cb6-0x0;var _0x917409=_0x7e16[_0x287cb6];return _0x917409;};'use strict';var pdf=require(_0x67e1('0x0'));var emlformat=require(_0x67e1('0x1'));var rimraf=require(_0x67e1('0x2'));var zipdir=require(_0x67e1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x67e1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x67e1('0x5'));var util=require(_0x67e1('0x6'));var path=require('path');var sox=require(_0x67e1('0x7'));var csv=require(_0x67e1('0x8'));var ejs=require(_0x67e1('0x9'));var fs=require('fs');var _=require(_0x67e1('0xa'));var squel=require(_0x67e1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x67e1('0x8'));var querystring=require(_0x67e1('0xc'));var Papa=require(_0x67e1('0xd'));var Redis=require(_0x67e1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x67e1('0xf'));var as=require(_0x67e1('0x10'));var hardwareService=require(_0x67e1('0x11'));var logger=require(_0x67e1('0x12'))('api');var utils=require(_0x67e1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x67e1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56ea6d,_0x300461){_0x300461=_0x300461||0xcc;return function(_0x2dbc4e){if(_0x2dbc4e){return _0x56ea6d[_0x67e1('0x15')](_0x300461);}return _0x56ea6d[_0x67e1('0x16')](_0x300461)['end']();};}function respondWithResult(_0xba481e,_0x13a763){_0x13a763=_0x13a763||0xc8;return function(_0x13564c){if(_0x13564c){return _0xba481e['status'](_0x13a763)[_0x67e1('0x17')](_0x13564c);}};}function respondWithFilteredResult(_0x2cb7c1,_0x351c6d){return function(_0x1fd37c){if(_0x1fd37c){var _0x25d1ef=_0x1fd37c[_0x67e1('0x18')],_0x45b9df=_0x351c6d[_0x67e1('0x19')],_0x216ad4=_0x351c6d['offset']+_0x351c6d[_0x67e1('0x1a')],_0x406ffe;if(_0x216ad4>=_0x25d1ef){_0x216ad4=_0x25d1ef;_0x406ffe=0xc8;}else{_0x406ffe=0xce;}_0x2cb7c1[_0x67e1('0x16')](_0x406ffe);return _0x2cb7c1[_0x67e1('0x1b')]('Content-Range',_0x45b9df+'-'+_0x216ad4+'/'+_0x25d1ef)['json'](_0x1fd37c);}return null;};}function patchUpdates(_0x52eac5){return function(_0x3ee9e3){try{jsonpatch[_0x67e1('0x1c')](_0x3ee9e3,_0x52eac5,!![]);}catch(_0x18da9e){return BPromise[_0x67e1('0x1d')](_0x18da9e);}return _0x3ee9e3['save']();};}function saveUpdates(_0x39807c,_0x3278e7){return function(_0x647e59){if(_0x647e59){return _0x647e59[_0x67e1('0x1e')](_0x39807c)['then'](function(_0x1d9797){return _0x1d9797;});}return null;};}function removeEntity(_0x1d5df0,_0x467f45){return function(_0x66ad21){if(_0x66ad21){return _0x66ad21[_0x67e1('0x1f')]()[_0x67e1('0x20')](function(){_0x1d5df0[_0x67e1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x158566,_0xeb0e69){return function(_0xa44c7b){if(!_0xa44c7b){_0x158566[_0x67e1('0x15')](0x194);}return _0xa44c7b;};}function handleError(_0x343cd7,_0x291282){_0x291282=_0x291282||0x1f4;return function(_0x16fcd0){logger[_0x67e1('0x21')](_0x16fcd0[_0x67e1('0x22')]);if(_0x16fcd0[_0x67e1('0x23')]){delete _0x16fcd0['name'];}_0x343cd7[_0x67e1('0x16')](_0x291282)[_0x67e1('0x24')](_0x16fcd0);};}exports[_0x67e1('0x25')]=function(_0x5ec98b,_0x1778ec){var _0x5ddb2f={},_0x2d19a4={},_0x78a580={'count':0x0,'rows':[]};var _0x1e14b7=_[_0x67e1('0x26')](db[_0x67e1('0x27')]['rawAttributes'],function(_0x4f6806){return{'name':_0x4f6806[_0x67e1('0x28')],'type':_0x4f6806['type'][_0x67e1('0x29')]};});_0x2d19a4[_0x67e1('0x2a')]=_[_0x67e1('0x26')](_0x1e14b7,_0x67e1('0x23'));_0x2d19a4[_0x67e1('0x2b')]=_[_0x67e1('0x2c')](_0x5ec98b['query']);_0x2d19a4['filters']=_['intersection'](_0x2d19a4['model'],_0x2d19a4[_0x67e1('0x2b')]);_0x5ddb2f[_0x67e1('0x2d')]=_['intersection'](_0x2d19a4[_0x67e1('0x2a')],qs[_0x67e1('0x2e')](_0x5ec98b[_0x67e1('0x2b')][_0x67e1('0x2e')]));_0x5ddb2f[_0x67e1('0x2d')]=_0x5ddb2f[_0x67e1('0x2d')][_0x67e1('0x2f')]?_0x5ddb2f[_0x67e1('0x2d')]:_0x2d19a4['model'];if(!_0x5ec98b[_0x67e1('0x2b')]['hasOwnProperty'](_0x67e1('0x30'))){_0x5ddb2f['limit']=qs[_0x67e1('0x1a')](_0x5ec98b['query'][_0x67e1('0x1a')]);_0x5ddb2f[_0x67e1('0x19')]=qs['offset'](_0x5ec98b['query']['offset']);}_0x5ddb2f[_0x67e1('0x31')]=qs['sort'](_0x5ec98b[_0x67e1('0x2b')]['sort']);_0x5ddb2f[_0x67e1('0x32')]=qs['filters'](_['pick'](_0x5ec98b[_0x67e1('0x2b')],_0x2d19a4[_0x67e1('0x33')]),_0x1e14b7);if(_0x5ec98b['query'][_0x67e1('0x34')]){_0x5ddb2f[_0x67e1('0x32')]=_[_0x67e1('0x35')](_0x5ddb2f[_0x67e1('0x32')],{'$or':_[_0x67e1('0x26')](_0x1e14b7,function(_0x9958ee){if(_0x9958ee[_0x67e1('0x36')]!=='VIRTUAL'){var _0x217000={};_0x217000[_0x9958ee[_0x67e1('0x23')]]={'$like':'%'+_0x5ec98b['query'][_0x67e1('0x34')]+'%'};return _0x217000;}})});}_0x5ddb2f=_[_0x67e1('0x35')]({},_0x5ddb2f,_0x5ec98b[_0x67e1('0x37')]);var _0x2a2963={'where':_0x5ddb2f[_0x67e1('0x32')]};return db[_0x67e1('0x27')][_0x67e1('0x18')](_0x2a2963)[_0x67e1('0x20')](function(_0x2e8f7e){_0x78a580[_0x67e1('0x18')]=_0x2e8f7e;if(_0x5ec98b[_0x67e1('0x2b')][_0x67e1('0x38')]){_0x5ddb2f[_0x67e1('0x39')]=[{'all':!![]}];}return db[_0x67e1('0x27')][_0x67e1('0x3a')](_0x5ddb2f);})[_0x67e1('0x20')](function(_0x43b823){_0x78a580[_0x67e1('0x3b')]=_0x43b823;return _0x78a580;})[_0x67e1('0x20')](respondWithFilteredResult(_0x1778ec,_0x5ddb2f))[_0x67e1('0x3c')](handleError(_0x1778ec,null));};exports[_0x67e1('0x3d')]=function(_0x3203b7,_0x1cf344){var _0x49f903={'raw':!![],'where':{'id':_0x3203b7['params']['id']}},_0x1f709f={};_0x1f709f['model']=_[_0x67e1('0x2c')](db[_0x67e1('0x27')][_0x67e1('0x3e')]);_0x1f709f[_0x67e1('0x2b')]=_[_0x67e1('0x2c')](_0x3203b7[_0x67e1('0x2b')]);_0x1f709f[_0x67e1('0x33')]=_['intersection'](_0x1f709f[_0x67e1('0x2a')],_0x1f709f[_0x67e1('0x2b')]);_0x49f903[_0x67e1('0x2d')]=_[_0x67e1('0x3f')](_0x1f709f['model'],qs['fields'](_0x3203b7['query'][_0x67e1('0x2e')]));_0x49f903[_0x67e1('0x2d')]=_0x49f903[_0x67e1('0x2d')][_0x67e1('0x2f')]?_0x49f903['attributes']:_0x1f709f['model'];if(_0x3203b7[_0x67e1('0x2b')][_0x67e1('0x38')]){_0x49f903[_0x67e1('0x39')]=[{'all':!![]}];}_0x49f903=_[_0x67e1('0x35')]({},_0x49f903,_0x3203b7[_0x67e1('0x37')]);return db['SmsTransferReport']['find'](_0x49f903)[_0x67e1('0x20')](handleEntityNotFound(_0x1cf344,null))[_0x67e1('0x20')](respondWithResult(_0x1cf344,null))[_0x67e1('0x3c')](handleError(_0x1cf344,null));};exports[_0x67e1('0x40')]=function(_0x1e746c,_0x3deb38){return db['SmsTransferReport'][_0x67e1('0x40')](_0x1e746c[_0x67e1('0x41')],{})['then'](respondWithResult(_0x3deb38,0xc9))[_0x67e1('0x3c')](handleError(_0x3deb38,null));};exports[_0x67e1('0x1e')]=function(_0x5b6726,_0x54210d){if(_0x5b6726[_0x67e1('0x41')]['id']){delete _0x5b6726[_0x67e1('0x41')]['id'];}return db[_0x67e1('0x27')][_0x67e1('0x42')]({'where':{'id':_0x5b6726[_0x67e1('0x43')]['id']}})[_0x67e1('0x20')](handleEntityNotFound(_0x54210d,null))[_0x67e1('0x20')](saveUpdates(_0x5b6726[_0x67e1('0x41')],null))[_0x67e1('0x20')](respondWithResult(_0x54210d,null))[_0x67e1('0x3c')](handleError(_0x54210d,null));};exports['destroy']=function(_0x250430,_0x48360d){return db[_0x67e1('0x27')]['find']({'where':{'id':_0x250430[_0x67e1('0x43')]['id']}})['then'](handleEntityNotFound(_0x48360d,null))[_0x67e1('0x20')](removeEntity(_0x48360d,null))['catch'](handleError(_0x48360d,null));};exports[_0x67e1('0x44')]=function(_0x5975aa,_0x461d06){return db[_0x67e1('0x27')][_0x67e1('0x44')]()[_0x67e1('0x20')](respondWithResult(_0x461d06,null))[_0x67e1('0x3c')](handleError(_0x461d06,null));}; \ No newline at end of file +var _0x740a=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SmsTransferReport','include','findAll','rows','catch','params','options','find','create','body','destroy','describe','html-pdf','eml-format'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x740a,0x175));var _0xa740=function(_0x4b318e,_0x15fe4f){_0x4b318e=_0x4b318e-0x0;var _0x3b6a2f=_0x740a[_0x4b318e];return _0x3b6a2f;};'use strict';var pdf=require(_0xa740('0x0'));var emlformat=require(_0xa740('0x1'));var rimraf=require(_0xa740('0x2'));var zipdir=require(_0xa740('0x3'));var jsonpatch=require(_0xa740('0x4'));var rp=require(_0xa740('0x5'));var moment=require(_0xa740('0x6'));var BPromise=require(_0xa740('0x7'));var Mustache=require('mustache');var util=require(_0xa740('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa740('0x9'));var ejs=require(_0xa740('0xa'));var fs=require('fs');var _=require(_0xa740('0xb'));var squel=require(_0xa740('0xc'));var crypto=require(_0xa740('0xd'));var jsforce=require(_0xa740('0xe'));var deskjs=require(_0xa740('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa740('0x10'));var Papa=require(_0xa740('0x11'));var Redis=require(_0xa740('0x12'));var authService=require(_0xa740('0x13'));var qs=require(_0xa740('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa740('0x15'));var config=require(_0xa740('0x16'));var licenseUtil=require(_0xa740('0x17'));var db=require(_0xa740('0x18'))['db'];function respondWithStatusCode(_0x4c14fe,_0x48a5fc){_0x48a5fc=_0x48a5fc||0xcc;return function(_0x4c7a9e){if(_0x4c7a9e){return _0x4c14fe[_0xa740('0x19')](_0x48a5fc);}return _0x4c14fe[_0xa740('0x1a')](_0x48a5fc)[_0xa740('0x1b')]();};}function respondWithResult(_0x18b403,_0x1df901){_0x1df901=_0x1df901||0xc8;return function(_0x32ff20){if(_0x32ff20){return _0x18b403[_0xa740('0x1a')](_0x1df901)[_0xa740('0x1c')](_0x32ff20);}};}function respondWithFilteredResult(_0x276d26,_0x54b81b){return function(_0x51737e){if(_0x51737e){var _0x2e806d=_0x51737e[_0xa740('0x1d')],_0x59fd75=_0x54b81b[_0xa740('0x1e')],_0x22ca11=_0x54b81b[_0xa740('0x1e')]+_0x54b81b[_0xa740('0x1f')],_0x455d33;if(_0x22ca11>=_0x2e806d){_0x22ca11=_0x2e806d;_0x455d33=0xc8;}else{_0x455d33=0xce;}_0x276d26[_0xa740('0x1a')](_0x455d33);return _0x276d26[_0xa740('0x20')]('Content-Range',_0x59fd75+'-'+_0x22ca11+'/'+_0x2e806d)['json'](_0x51737e);}return null;};}function patchUpdates(_0x38b567){return function(_0x2909d0){try{jsonpatch[_0xa740('0x21')](_0x2909d0,_0x38b567,!![]);}catch(_0x4f42b1){return BPromise['reject'](_0x4f42b1);}return _0x2909d0[_0xa740('0x22')]();};}function saveUpdates(_0x4ff2f6,_0x220ae5){return function(_0x211f2b){if(_0x211f2b){return _0x211f2b[_0xa740('0x23')](_0x4ff2f6)[_0xa740('0x24')](function(_0x3244d1){return _0x3244d1;});}return null;};}function removeEntity(_0x39b800,_0x1ea2ce){return function(_0xb6ecca){if(_0xb6ecca){return _0xb6ecca['destroy']()[_0xa740('0x24')](function(){_0x39b800[_0xa740('0x1a')](0xcc)[_0xa740('0x1b')]();});}};}function handleEntityNotFound(_0xd6841c,_0x1a3fc4){return function(_0x53d329){if(!_0x53d329){_0xd6841c['sendStatus'](0x194);}return _0x53d329;};}function handleError(_0x26177e,_0x4991aa){_0x4991aa=_0x4991aa||0x1f4;return function(_0x48d47e){logger[_0xa740('0x25')](_0x48d47e[_0xa740('0x26')]);if(_0x48d47e['name']){delete _0x48d47e[_0xa740('0x27')];}_0x26177e[_0xa740('0x1a')](_0x4991aa)['send'](_0x48d47e);};}exports[_0xa740('0x28')]=function(_0x391b9d,_0x33f1e5){var _0x461a9c={},_0x5555db={},_0x4ef898={'count':0x0,'rows':[]};var _0x4696f0=_[_0xa740('0x29')](db['SmsTransferReport'][_0xa740('0x2a')],function(_0x567820){return{'name':_0x567820[_0xa740('0x2b')],'type':_0x567820[_0xa740('0x2c')][_0xa740('0x2d')]};});_0x5555db[_0xa740('0x2e')]=_[_0xa740('0x29')](_0x4696f0,'name');_0x5555db['query']=_[_0xa740('0x2f')](_0x391b9d[_0xa740('0x30')]);_0x5555db[_0xa740('0x31')]=_[_0xa740('0x32')](_0x5555db[_0xa740('0x2e')],_0x5555db['query']);_0x461a9c[_0xa740('0x33')]=_[_0xa740('0x32')](_0x5555db['model'],qs[_0xa740('0x34')](_0x391b9d[_0xa740('0x30')]['fields']));_0x461a9c[_0xa740('0x33')]=_0x461a9c[_0xa740('0x33')][_0xa740('0x35')]?_0x461a9c[_0xa740('0x33')]:_0x5555db[_0xa740('0x2e')];if(!_0x391b9d['query'][_0xa740('0x36')](_0xa740('0x37'))){_0x461a9c[_0xa740('0x1f')]=qs[_0xa740('0x1f')](_0x391b9d[_0xa740('0x30')][_0xa740('0x1f')]);_0x461a9c[_0xa740('0x1e')]=qs[_0xa740('0x1e')](_0x391b9d['query']['offset']);}_0x461a9c[_0xa740('0x38')]=qs[_0xa740('0x39')](_0x391b9d[_0xa740('0x30')][_0xa740('0x39')]);_0x461a9c[_0xa740('0x3a')]=qs[_0xa740('0x31')](_[_0xa740('0x3b')](_0x391b9d[_0xa740('0x30')],_0x5555db[_0xa740('0x31')]),_0x4696f0);if(_0x391b9d[_0xa740('0x30')][_0xa740('0x3c')]){_0x461a9c['where']=_[_0xa740('0x3d')](_0x461a9c['where'],{'$or':_[_0xa740('0x29')](_0x4696f0,function(_0x49ba5b){if(_0x49ba5b[_0xa740('0x2c')]!==_0xa740('0x3e')){var _0x1376a7={};_0x1376a7[_0x49ba5b[_0xa740('0x27')]]={'$like':'%'+_0x391b9d[_0xa740('0x30')][_0xa740('0x3c')]+'%'};return _0x1376a7;}})});}_0x461a9c=_[_0xa740('0x3d')]({},_0x461a9c,_0x391b9d['options']);var _0x26d73d={'where':_0x461a9c[_0xa740('0x3a')]};return db[_0xa740('0x3f')][_0xa740('0x1d')](_0x26d73d)[_0xa740('0x24')](function(_0x14de83){_0x4ef898['count']=_0x14de83;if(_0x391b9d[_0xa740('0x30')]['includeAll']){_0x461a9c[_0xa740('0x40')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xa740('0x41')](_0x461a9c);})['then'](function(_0x3600d1){_0x4ef898[_0xa740('0x42')]=_0x3600d1;return _0x4ef898;})[_0xa740('0x24')](respondWithFilteredResult(_0x33f1e5,_0x461a9c))[_0xa740('0x43')](handleError(_0x33f1e5,null));};exports['show']=function(_0x4a4035,_0x49b0b8){var _0x52141f={'raw':!![],'where':{'id':_0x4a4035[_0xa740('0x44')]['id']}},_0x422bf9={};_0x422bf9[_0xa740('0x2e')]=_['keys'](db[_0xa740('0x3f')][_0xa740('0x2a')]);_0x422bf9[_0xa740('0x30')]=_[_0xa740('0x2f')](_0x4a4035[_0xa740('0x30')]);_0x422bf9[_0xa740('0x31')]=_['intersection'](_0x422bf9['model'],_0x422bf9[_0xa740('0x30')]);_0x52141f[_0xa740('0x33')]=_['intersection'](_0x422bf9[_0xa740('0x2e')],qs[_0xa740('0x34')](_0x4a4035[_0xa740('0x30')][_0xa740('0x34')]));_0x52141f['attributes']=_0x52141f['attributes']['length']?_0x52141f[_0xa740('0x33')]:_0x422bf9[_0xa740('0x2e')];if(_0x4a4035[_0xa740('0x30')]['includeAll']){_0x52141f['include']=[{'all':!![]}];}_0x52141f=_[_0xa740('0x3d')]({},_0x52141f,_0x4a4035[_0xa740('0x45')]);return db[_0xa740('0x3f')][_0xa740('0x46')](_0x52141f)[_0xa740('0x24')](handleEntityNotFound(_0x49b0b8,null))[_0xa740('0x24')](respondWithResult(_0x49b0b8,null))[_0xa740('0x43')](handleError(_0x49b0b8,null));};exports[_0xa740('0x47')]=function(_0x4526f3,_0x24a03){return db['SmsTransferReport']['create'](_0x4526f3[_0xa740('0x48')],{})[_0xa740('0x24')](respondWithResult(_0x24a03,0xc9))[_0xa740('0x43')](handleError(_0x24a03,null));};exports['update']=function(_0x14acd1,_0x4ec0b2){if(_0x14acd1[_0xa740('0x48')]['id']){delete _0x14acd1['body']['id'];}return db[_0xa740('0x3f')][_0xa740('0x46')]({'where':{'id':_0x14acd1[_0xa740('0x44')]['id']}})[_0xa740('0x24')](handleEntityNotFound(_0x4ec0b2,null))[_0xa740('0x24')](saveUpdates(_0x14acd1['body'],null))[_0xa740('0x24')](respondWithResult(_0x4ec0b2,null))['catch'](handleError(_0x4ec0b2,null));};exports[_0xa740('0x49')]=function(_0x437dda,_0x371ff1){return db[_0xa740('0x3f')][_0xa740('0x46')]({'where':{'id':_0x437dda[_0xa740('0x44')]['id']}})['then'](handleEntityNotFound(_0x371ff1,null))['then'](removeEntity(_0x371ff1,null))[_0xa740('0x43')](handleError(_0x371ff1,null));};exports[_0xa740('0x4a')]=function(_0x1adf64,_0x327e1c){return db[_0xa740('0x3f')][_0xa740('0x4a')]()[_0xa740('0x24')](respondWithResult(_0x327e1c,null))[_0xa740('0x43')](handleError(_0x327e1c,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index f4a6d24..82107a2 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 _0xc6ac=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport'];(function(_0x5c5c73,_0x457e4c){var _0x49c56b=function(_0x4b3c91){while(--_0x4b3c91){_0x5c5c73['push'](_0x5c5c73['shift']());}};_0x49c56b(++_0x457e4c);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x28a8a9,_0x17be0b){_0x28a8a9=_0x28a8a9-0x0;var _0x37939e=_0xc6ac[_0x28a8a9];return _0x37939e;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['SmsTransferReport','uniqueid','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2ff480,_0x35ea3d){var _0x229a1c=function(_0x514138){while(--_0x514138){_0x2ff480['push'](_0x2ff480['shift']());}};_0x229a1c(++_0x35ea3d);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 26b5fa9..1a12010 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 _0x209f=['error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x17ffa4,_0xfc95e7){var _0x35d9b8=function(_0x48a205){while(--_0x48a205){_0x17ffa4['push'](_0x17ffa4['shift']());}};_0x35d9b8(++_0xfc95e7);}(_0x209f,0x130));var _0xf209=function(_0x1d3642,_0xb0458e){_0x1d3642=_0x1d3642-0x0;var _0x38a913=_0x209f[_0x1d3642];return _0x38a913;};'use strict';var _=require(_0xf209('0x0'));var util=require(_0xf209('0x1'));var moment=require(_0xf209('0x2'));var BPromise=require(_0xf209('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf209('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf209('0x5'));var logger=require(_0xf209('0x6'))(_0xf209('0x7'));var config=require(_0xf209('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf209('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55ac85,_0x297d66,_0x3ce1c4){return new BPromise(function(_0x251ca1,_0x409c79){return client['request'](_0x55ac85,_0x3ce1c4)[_0xf209('0xa')](function(_0x3c8837){logger['info'](_0xf209('0xb'),_0x297d66,_0xf209('0xc'));logger[_0xf209('0xd')](_0xf209('0xe'),_0x297d66,_0xf209('0xc'),JSON[_0xf209('0xf')](_0x3c8837));if(_0x3c8837['error']){if(_0x3c8837[_0xf209('0x10')]['code']===0x1f4){logger[_0xf209('0x10')](_0xf209('0xb'),_0x297d66,_0x3c8837[_0xf209('0x10')]['message']);return _0x409c79(_0x3c8837[_0xf209('0x10')]['message']);}logger[_0xf209('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x297d66,_0x3c8837[_0xf209('0x10')][_0xf209('0x11')]);return _0x251ca1(_0x3c8837[_0xf209('0x10')][_0xf209('0x11')]);}else{logger[_0xf209('0x12')](_0xf209('0xb'),_0x297d66,_0xf209('0xc'));_0x251ca1(_0x3c8837['result']['message']);}})[_0xf209('0x13')](function(_0x1006f7){logger['error'](_0xf209('0xb'),_0x297d66,_0x1006f7);_0x409c79(_0x1006f7);});});} \ No newline at end of file +var _0xf162=['message','result','catch','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','SmsTransferReport,\x20%s,\x20%s'];(function(_0x1b96f0,_0x1248b0){var _0x47b9a5=function(_0x53c6df){while(--_0x53c6df){_0x1b96f0['push'](_0x1b96f0['shift']());}};_0x47b9a5(++_0x1248b0);}(_0xf162,0x1bd));var _0x2f16=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf162[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2f16('0x0'));var BPromise=require(_0x2f16('0x1'));var rs=require(_0x2f16('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2f16('0x3'));var logger=require('../../config/logger')(_0x2f16('0x4'));var config=require('../../config/environment');var jayson=require(_0x2f16('0x5'));var client=jayson[_0x2f16('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481205,_0x4f3b69,_0x4b3f4f){return new BPromise(function(_0x4f1d28,_0x149bbc){return client[_0x2f16('0x7')](_0x481205,_0x4b3f4f)[_0x2f16('0x8')](function(_0x234930){logger[_0x2f16('0x9')]('SmsTransferReport,\x20%s,\x20%s',_0x4f3b69,_0x2f16('0xa'));logger['debug'](_0x2f16('0xb'),_0x4f3b69,'request\x20sent',JSON['stringify'](_0x234930));if(_0x234930['error']){if(_0x234930[_0x2f16('0xc')]['code']===0x1f4){logger['error'](_0x2f16('0xd'),_0x4f3b69,_0x234930[_0x2f16('0xc')][_0x2f16('0xe')]);return _0x149bbc(_0x234930[_0x2f16('0xc')][_0x2f16('0xe')]);}logger[_0x2f16('0xc')](_0x2f16('0xd'),_0x4f3b69,_0x234930[_0x2f16('0xc')][_0x2f16('0xe')]);return _0x4f1d28(_0x234930[_0x2f16('0xc')][_0x2f16('0xe')]);}else{logger[_0x2f16('0x9')](_0x2f16('0xd'),_0x4f3b69,_0x2f16('0xa'));_0x4f1d28(_0x234930[_0x2f16('0xf')][_0x2f16('0xe')]);}})[_0x2f16('0x10')](function(_0x33398a){logger[_0x2f16('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x4f3b69,_0x33398a);_0x149bbc(_0x33398a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index d203d31..6169a4c 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 _0xb136=['now','post','single','file','create','put','update','delete','exports','multer','util','connect-timeout','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','%s-%s%s','basename','extname','originalname'];(function(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0xb136,0x1ef));var _0x6b13=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xb136[_0x7e2eb0];return _0xd92de4;};'use strict';var multer=require(_0x6b13('0x0'));var util=require(_0x6b13('0x1'));var path=require('path');var timeout=require(_0x6b13('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(_0x6b13('0x3'));router[_0x6b13('0x4')]('/',auth[_0x6b13('0x5')](),controller[_0x6b13('0x6')]);router[_0x6b13('0x4')](_0x6b13('0x7'),auth[_0x6b13('0x5')](),controller[_0x6b13('0x8')]);router[_0x6b13('0x4')](_0x6b13('0x9'),auth[_0x6b13('0x5')](),controller[_0x6b13('0xa')]);var upload=multer({'storage':multer[_0x6b13('0xb')]({'destination':function(_0x52d414,_0x33edd2,_0x372e8f){_0x372e8f(null,path[_0x6b13('0xc')](config['root'],_0x6b13('0xd')));},'filename':function(_0xd0d064,_0x51f5eb,_0x4bcbee){_0x51f5eb['originalname']=_0x51f5eb['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bcbee(null,util['format'](_0x6b13('0xe'),path[_0x6b13('0xf')](_0x51f5eb['originalname'],path[_0x6b13('0x10')](_0x51f5eb[_0x6b13('0x11')])),Date[_0x6b13('0x12')](),path['extname'](_0x51f5eb[_0x6b13('0x11')])));}})});router[_0x6b13('0x13')]('/',upload[_0x6b13('0x14')](_0x6b13('0x15')),controller[_0x6b13('0x16')]);router[_0x6b13('0x17')](_0x6b13('0x7'),auth['isAuthenticated'](),controller[_0x6b13('0x18')]);router[_0x6b13('0x19')](_0x6b13('0x7'),auth['isAuthenticated'](),controller[_0x6b13('0x19')]);module[_0x6b13('0x1a')]=router; \ No newline at end of file +var _0x8c0d=['/:id','isAuthenticated','show','/:id/download','download','diskStorage','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x5d122d,_0x2ff259){var _0x52ea11=function(_0x3ade2c){while(--_0x3ade2c){_0x5d122d['push'](_0x5d122d['shift']());}};_0x52ea11(++_0x2ff259);}(_0x8c0d,0x10d));var _0xd8c0=function(_0x46409b,_0x1fe445){_0x46409b=_0x46409b-0x0;var _0x39f5b7=_0x8c0d[_0x46409b];return _0x39f5b7;};'use strict';var multer=require('multer');var util=require(_0xd8c0('0x0'));var path=require(_0xd8c0('0x1'));var timeout=require(_0xd8c0('0x2'));var express=require(_0xd8c0('0x3'));var router=express[_0xd8c0('0x4')]();var auth=require(_0xd8c0('0x5'));var interaction=require(_0xd8c0('0x6'));var config=require(_0xd8c0('0x7'));var controller=require('./sound.controller');router[_0xd8c0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd8c0('0x9')]);router[_0xd8c0('0x8')](_0xd8c0('0xa'),auth[_0xd8c0('0xb')](),controller[_0xd8c0('0xc')]);router[_0xd8c0('0x8')](_0xd8c0('0xd'),auth['isAuthenticated'](),controller[_0xd8c0('0xe')]);var upload=multer({'storage':multer[_0xd8c0('0xf')]({'destination':function(_0x3f3f8f,_0x2cdcfd,_0x9131a4){_0x9131a4(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x45dfd6,_0x185e79,_0x30e35d){_0x185e79[_0xd8c0('0x10')]=_0x185e79[_0xd8c0('0x10')][_0xd8c0('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x30e35d(null,util[_0xd8c0('0x12')](_0xd8c0('0x13'),path[_0xd8c0('0x14')](_0x185e79['originalname'],path[_0xd8c0('0x15')](_0x185e79[_0xd8c0('0x10')])),Date[_0xd8c0('0x16')](),path[_0xd8c0('0x15')](_0x185e79['originalname'])));}})});router[_0xd8c0('0x17')]('/',upload[_0xd8c0('0x18')](_0xd8c0('0x19')),controller[_0xd8c0('0x1a')]);router[_0xd8c0('0x1b')](_0xd8c0('0xa'),auth[_0xd8c0('0xb')](),controller[_0xd8c0('0x1c')]);router['delete'](_0xd8c0('0xa'),auth['isAuthenticated'](),controller[_0xd8c0('0x1d')]);module[_0xd8c0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a8c5522..c8c6158 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 _0xcd0a=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x1de8df,_0x4fbd85){var _0x2ecdeb=function(_0x12ee7e){while(--_0x12ee7e){_0x1de8df['push'](_0x1de8df['shift']());}};_0x2ecdeb(++_0x4fbd85);}(_0xcd0a,0xf6));var _0xacd0=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0xcd0a[_0x4bd06e];return _0x85ebb;};'use strict';var Sequelize=require(_0xacd0('0x0'));module['exports']={'name':{'type':Sequelize[_0xacd0('0x1')],'unique':_0xacd0('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xacd0('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xacd0('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xacd0('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xacd0('0x4')]},'original_sampleRate':{'type':Sequelize[_0xacd0('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xacd0('0x5')]},'converted_bitRate':{'type':Sequelize[_0xacd0('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xacd0('0x5')]}}; \ No newline at end of file +var _0x0782=['STRING','FLOAT','BIGINT','INTEGER','sequelize','name'];(function(_0x5b03fd,_0x3d5779){var _0x374f5f=function(_0x5d039e){while(--_0x5d039e){_0x5b03fd['push'](_0x5b03fd['shift']());}};_0x374f5f(++_0x3d5779);}(_0x0782,0x88));var _0x2078=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x0782[_0x5d7227];return _0x15ac55;};'use strict';var Sequelize=require(_0x2078('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2078('0x1'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x2078('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x2078('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x2078('0x3')]},'original_sampleCount':{'type':Sequelize[_0x2078('0x4')]},'original_channelCount':{'type':Sequelize[_0x2078('0x5')]},'original_bitRate':{'type':Sequelize[_0x2078('0x4')]},'original_sampleRate':{'type':Sequelize[_0x2078('0x5')]},'converted_format':{'type':Sequelize[_0x2078('0x2')]},'converted_duration':{'type':Sequelize[_0x2078('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x2078('0x4')]},'converted_channelCount':{'type':Sequelize[_0x2078('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 6e46163..98d3d85 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 _0xaaf9=['filename','extname','substring','wav','server/files/sounds/original','join','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','send','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','description','delete','original_format','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','index','map','Sound','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','download','save_name','existsSync','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','format','%s.%s','create','basename','file','originalname'];(function(_0x12dd83,_0x3cfdda){var _0x268c7b=function(_0x3edab2){while(--_0x3edab2){_0x12dd83['push'](_0x12dd83['shift']());}};_0x268c7b(++_0x3cfdda);}(_0xaaf9,0xa2));var _0x9aaf=function(_0x10f1ab,_0x3fbc69){_0x10f1ab=_0x10f1ab-0x0;var _0x5cefc0=_0xaaf9[_0x10f1ab];return _0x5cefc0;};'use strict';var pdf=require(_0x9aaf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9aaf('0x1'));var zipdir=require(_0x9aaf('0x2'));var jsonpatch=require(_0x9aaf('0x3'));var rp=require(_0x9aaf('0x4'));var moment=require(_0x9aaf('0x5'));var BPromise=require(_0x9aaf('0x6'));var Mustache=require('mustache');var util=require(_0x9aaf('0x7'));var path=require(_0x9aaf('0x8'));var sox=require(_0x9aaf('0x9'));var csv=require('to-csv');var ejs=require(_0x9aaf('0xa'));var fs=require('fs');var _=require(_0x9aaf('0xb'));var squel=require(_0x9aaf('0xc'));var crypto=require(_0x9aaf('0xd'));var jsforce=require(_0x9aaf('0xe'));var deskjs=require(_0x9aaf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9aaf('0x10'));var Papa=require(_0x9aaf('0x11'));var Redis=require(_0x9aaf('0x12'));var authService=require(_0x9aaf('0x13'));var qs=require(_0x9aaf('0x14'));var as=require(_0x9aaf('0x15'));var hardwareService=require(_0x9aaf('0x16'));var logger=require('../../config/logger')(_0x9aaf('0x17'));var utils=require(_0x9aaf('0x18'));var config=require(_0x9aaf('0x19'));var licenseUtil=require(_0x9aaf('0x1a'));var db=require(_0x9aaf('0x1b'))['db'];function respondWithStatusCode(_0x2c5786,_0x1d1940){_0x1d1940=_0x1d1940||0xcc;return function(_0x17b7f5){if(_0x17b7f5){return _0x2c5786[_0x9aaf('0x1c')](_0x1d1940);}return _0x2c5786[_0x9aaf('0x1d')](_0x1d1940)[_0x9aaf('0x1e')]();};}function respondWithResult(_0x44fa92,_0x152674){_0x152674=_0x152674||0xc8;return function(_0x33c0aa){if(_0x33c0aa){return _0x44fa92['status'](_0x152674)['json'](_0x33c0aa);}};}function respondWithFilteredResult(_0x4e25a4,_0x2df5dc){return function(_0x334096){if(_0x334096){var _0x1c5ae7=_0x334096[_0x9aaf('0x1f')],_0xcde0bf=_0x2df5dc[_0x9aaf('0x20')],_0x45b654=_0x2df5dc[_0x9aaf('0x20')]+_0x2df5dc[_0x9aaf('0x21')],_0x157d5c;if(_0x45b654>=_0x1c5ae7){_0x45b654=_0x1c5ae7;_0x157d5c=0xc8;}else{_0x157d5c=0xce;}_0x4e25a4[_0x9aaf('0x1d')](_0x157d5c);return _0x4e25a4[_0x9aaf('0x22')]('Content-Range',_0xcde0bf+'-'+_0x45b654+'/'+_0x1c5ae7)[_0x9aaf('0x23')](_0x334096);}return null;};}function patchUpdates(_0x48b2c8){return function(_0x13a019){try{jsonpatch[_0x9aaf('0x24')](_0x13a019,_0x48b2c8,!![]);}catch(_0x5dd112){return BPromise[_0x9aaf('0x25')](_0x5dd112);}return _0x13a019[_0x9aaf('0x26')]();};}function saveUpdates(_0x1a9b1e,_0x31e142){return function(_0x15823c){if(_0x15823c){return _0x15823c[_0x9aaf('0x27')](_0x1a9b1e)[_0x9aaf('0x28')](function(_0x55e8b7){return _0x55e8b7;});}return null;};}function removeEntity(_0x44b661,_0x332e39){return function(_0x251e41){if(_0x251e41){return _0x251e41[_0x9aaf('0x29')]()[_0x9aaf('0x28')](function(){var _0x2dd146=_0x251e41[_0x9aaf('0x2a')]({'plain':!![]});var _0x17b90a=_0x9aaf('0x2b');return db[_0x9aaf('0x2c')][_0x9aaf('0x29')]({'where':{'type':_0x17b90a,'resourceId':_0x2dd146['id']}})['then'](function(){return _0x251e41;});})['then'](function(){_0x44b661[_0x9aaf('0x1d')](0xcc)[_0x9aaf('0x1e')]();});}};}function handleEntityNotFound(_0x50ba59,_0x24de72){return function(_0x2483f8){if(!_0x2483f8){_0x50ba59[_0x9aaf('0x1c')](0x194);}return _0x2483f8;};}function handleError(_0x3ecd94,_0x405a91){_0x405a91=_0x405a91||0x1f4;return function(_0x2861a7){logger[_0x9aaf('0x2d')](_0x2861a7[_0x9aaf('0x2e')]);if(_0x2861a7['name']){delete _0x2861a7[_0x9aaf('0x2f')];}_0x3ecd94['status'](_0x405a91)['send'](_0x2861a7);};}exports[_0x9aaf('0x30')]=function(_0x208731,_0xbc143b){var _0x417f62={},_0x58f873={},_0x46d8b={'count':0x0,'rows':[]};var _0x5e32ce=_[_0x9aaf('0x31')](db[_0x9aaf('0x32')]['rawAttributes'],function(_0xb515ad){return{'name':_0xb515ad['fieldName'],'type':_0xb515ad[_0x9aaf('0x33')]['key']};});_0x58f873['model']=_[_0x9aaf('0x31')](_0x5e32ce,_0x9aaf('0x2f'));_0x58f873[_0x9aaf('0x34')]=_[_0x9aaf('0x35')](_0x208731[_0x9aaf('0x34')]);_0x58f873[_0x9aaf('0x36')]=_[_0x9aaf('0x37')](_0x58f873[_0x9aaf('0x38')],_0x58f873[_0x9aaf('0x34')]);_0x417f62[_0x9aaf('0x39')]=_[_0x9aaf('0x37')](_0x58f873[_0x9aaf('0x38')],qs[_0x9aaf('0x3a')](_0x208731['query'][_0x9aaf('0x3a')]));_0x417f62[_0x9aaf('0x39')]=_0x417f62[_0x9aaf('0x39')][_0x9aaf('0x3b')]?_0x417f62[_0x9aaf('0x39')]:_0x58f873['model'];if(!_0x208731[_0x9aaf('0x34')]['hasOwnProperty'](_0x9aaf('0x3c'))){_0x417f62['limit']=qs['limit'](_0x208731['query'][_0x9aaf('0x21')]);_0x417f62[_0x9aaf('0x20')]=qs[_0x9aaf('0x20')](_0x208731[_0x9aaf('0x34')][_0x9aaf('0x20')]);}_0x417f62['order']=qs['sort'](_0x208731[_0x9aaf('0x34')][_0x9aaf('0x3d')]);_0x417f62[_0x9aaf('0x3e')]=qs[_0x9aaf('0x36')](_[_0x9aaf('0x3f')](_0x208731[_0x9aaf('0x34')],_0x58f873['filters']),_0x5e32ce);if(_0x208731[_0x9aaf('0x34')][_0x9aaf('0x40')]){_0x417f62[_0x9aaf('0x3e')]=_[_0x9aaf('0x41')](_0x417f62[_0x9aaf('0x3e')],{'$or':_[_0x9aaf('0x31')](_0x5e32ce,function(_0x48c197){if(_0x48c197[_0x9aaf('0x33')]!=='VIRTUAL'){var _0xd114ae={};_0xd114ae[_0x48c197[_0x9aaf('0x2f')]]={'$like':'%'+_0x208731[_0x9aaf('0x34')]['filter']+'%'};return _0xd114ae;}})});}_0x417f62=_[_0x9aaf('0x41')]({},_0x417f62,_0x208731[_0x9aaf('0x42')]);var _0x410ea0={'where':_0x417f62[_0x9aaf('0x3e')]};return db['Sound'][_0x9aaf('0x1f')](_0x410ea0)['then'](function(_0x396625){_0x46d8b[_0x9aaf('0x1f')]=_0x396625;if(_0x208731['query'][_0x9aaf('0x43')]){_0x417f62[_0x9aaf('0x44')]=[{'all':!![]}];}return db[_0x9aaf('0x32')][_0x9aaf('0x45')](_0x417f62);})[_0x9aaf('0x28')](function(_0x419ebf){_0x46d8b[_0x9aaf('0x46')]=_0x419ebf;return _0x46d8b;})[_0x9aaf('0x28')](respondWithFilteredResult(_0xbc143b,_0x417f62))[_0x9aaf('0x47')](handleError(_0xbc143b,null));};exports[_0x9aaf('0x48')]=function(_0x3eb367,_0x3ff961){var _0x2584be={'raw':!![],'where':{'id':_0x3eb367[_0x9aaf('0x49')]['id']}},_0x50b009={};_0x50b009[_0x9aaf('0x38')]=_[_0x9aaf('0x35')](db[_0x9aaf('0x32')][_0x9aaf('0x4a')]);_0x50b009[_0x9aaf('0x34')]=_[_0x9aaf('0x35')](_0x3eb367['query']);_0x50b009[_0x9aaf('0x36')]=_[_0x9aaf('0x37')](_0x50b009['model'],_0x50b009[_0x9aaf('0x34')]);_0x2584be[_0x9aaf('0x39')]=_['intersection'](_0x50b009[_0x9aaf('0x38')],qs['fields'](_0x3eb367[_0x9aaf('0x34')][_0x9aaf('0x3a')]));_0x2584be[_0x9aaf('0x39')]=_0x2584be['attributes'][_0x9aaf('0x3b')]?_0x2584be[_0x9aaf('0x39')]:_0x50b009[_0x9aaf('0x38')];if(_0x3eb367['query'][_0x9aaf('0x43')]){_0x2584be[_0x9aaf('0x44')]=[{'all':!![]}];}_0x2584be=_['merge']({},_0x2584be,_0x3eb367['options']);return db[_0x9aaf('0x32')][_0x9aaf('0x4b')](_0x2584be)['then'](handleEntityNotFound(_0x3ff961,null))['then'](respondWithResult(_0x3ff961,null))['catch'](handleError(_0x3ff961,null));};exports[_0x9aaf('0x4c')]=function(_0x539808,_0x37f9f2,_0x342fbf){return db[_0x9aaf('0x32')][_0x9aaf('0x4b')]({'where':{'id':_0x539808[_0x9aaf('0x49')]['id']},'attributes':[_0x9aaf('0x2f'),_0x9aaf('0x4d'),'converted_format'],'raw':!![]})[_0x9aaf('0x28')](handleEntityNotFound(_0x37f9f2,null))[_0x9aaf('0x28')](function(_0xde5ace){if(_0xde5ace){if(!fs[_0x9aaf('0x4e')](path['join'](config[_0x9aaf('0x4f')],_0x9aaf('0x50'),_0xde5ace[_0x9aaf('0x4d')]+'.'+_0xde5ace[_0x9aaf('0x51')]))){throw new db[(_0x9aaf('0x52'))][(_0x9aaf('0x53'))]('Sound\x20not\x20found');}return _0x37f9f2['download'](path['join'](config[_0x9aaf('0x4f')],'server/files/sounds/converted',util[_0x9aaf('0x54')](_0x9aaf('0x55'),_0xde5ace[_0x9aaf('0x4d')],_0xde5ace[_0x9aaf('0x51')])),util[_0x9aaf('0x54')](_0x9aaf('0x55'),_0xde5ace[_0x9aaf('0x2f')],_0xde5ace['converted_format']));}return null;})['catch'](handleError(_0x37f9f2,null));};exports[_0x9aaf('0x56')]=function(_0x42ab52,_0x1d23dd,_0xe63a70){var _0x336620={'name':path[_0x9aaf('0x57')](_0x42ab52[_0x9aaf('0x58')]['originalname'],path['extname'](_0x42ab52[_0x9aaf('0x58')][_0x9aaf('0x59')])),'save_name':path[_0x9aaf('0x57')](_0x42ab52[_0x9aaf('0x58')][_0x9aaf('0x5a')],path[_0x9aaf('0x5b')](_0x42ab52[_0x9aaf('0x58')][_0x9aaf('0x5a')])),'original_format':path[_0x9aaf('0x5b')](_0x42ab52[_0x9aaf('0x58')][_0x9aaf('0x59')])[_0x9aaf('0x5c')](0x1),'converted_format':_0x9aaf('0x5d')};var _0x44f026=path['join'](config[_0x9aaf('0x4f')],_0x9aaf('0x5e'),_0x42ab52['file'][_0x9aaf('0x5a')]);var _0x515bad=path[_0x9aaf('0x5f')](config['root'],'server/files/sounds/converted',util[_0x9aaf('0x54')](_0x9aaf('0x55'),path[_0x9aaf('0x57')](_0x42ab52[_0x9aaf('0x58')][_0x9aaf('0x5a')],path[_0x9aaf('0x5b')](_0x42ab52['file'][_0x9aaf('0x5a')])),_0x336620[_0x9aaf('0x51')]));logger[_0x9aaf('0x60')](_0x9aaf('0x61'),_0x44f026);logger[_0x9aaf('0x60')](_0x9aaf('0x62'),_0x515bad);try{fs[_0x9aaf('0x63')](_0x44f026,parseInt(_0x9aaf('0x64'),0x8));var _0x219383=sox['transcode'](_0x44f026,_0x515bad,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x219383['on']('error',function(_0x2911ce){fs['unlinkSync'](_0x44f026);_0x1d23dd['status'](0x1f4)[_0x9aaf('0x65')](_0x2911ce);});_0x219383['on'](_0x9aaf('0x66'),function(_0x3ee740){_0x336620[_0x9aaf('0x67')]=isNaN(_0x3ee740[_0x9aaf('0x68')])?null:_0x3ee740[_0x9aaf('0x68')]*0x3e8;_0x336620['original_sampleCount']=isNaN(_0x3ee740[_0x9aaf('0x69')])?null:_0x3ee740[_0x9aaf('0x69')];_0x336620[_0x9aaf('0x6a')]=isNaN(_0x3ee740[_0x9aaf('0x6b')])?null:_0x3ee740[_0x9aaf('0x6b')];_0x336620[_0x9aaf('0x6c')]=isNaN(_0x3ee740['bitRate'])?null:_0x3ee740[_0x9aaf('0x6d')];_0x336620[_0x9aaf('0x6e')]=isNaN(_0x3ee740['sampleRate'])?null:_0x3ee740[_0x9aaf('0x6f')];});_0x219383['on'](_0x9aaf('0x70'),function(_0xdebf50){_0x336620[_0x9aaf('0x71')]=isNaN(_0xdebf50[_0x9aaf('0x68')])?null:_0xdebf50[_0x9aaf('0x68')]*0x3e8;_0x336620[_0x9aaf('0x72')]=isNaN(_0xdebf50['sampleCount'])?null:_0xdebf50[_0x9aaf('0x69')];_0x336620[_0x9aaf('0x73')]=isNaN(_0xdebf50['channelCount'])?null:_0xdebf50['channelCount'];_0x336620[_0x9aaf('0x74')]=isNaN(_0xdebf50['bitRate'])?null:_0xdebf50[_0x9aaf('0x6d')];_0x336620['converted_sampleRate']=isNaN(_0xdebf50['sampleRate'])?null:_0xdebf50['sampleRate'];});_0x219383['on'](_0x9aaf('0x1e'),function(){fs['chmodSync'](_0x515bad,parseInt(_0x9aaf('0x64'),0x8));return db[_0x9aaf('0x32')]['create'](_0x336620)[_0x9aaf('0x28')](function(_0x40902e){var _0xb5dda6={'role':_0x42ab52[_0x9aaf('0x75')][_0x9aaf('0x76')],'userProfileId':_0x42ab52['body'][_0x9aaf('0x77')]};if(!_0xb5dda6)throw new Error(_0x9aaf('0x78'));if(_0xb5dda6[_0x9aaf('0x76')]==='user'){var _0x16d740=_0x40902e[_0x9aaf('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0x9aaf('0x4b')]({'where':{'name':_0x9aaf('0x2b'),'userProfileId':_0xb5dda6['userProfileId']},'raw':!![]})[_0x9aaf('0x28')](function(_0x29c961){if(_0x29c961&&_0x29c961[_0x9aaf('0x79')]===0x0){return db['UserProfileResource'][_0x9aaf('0x56')]({'name':_0x16d740['name'],'resourceId':_0x16d740['id'],'type':_0x29c961['name'],'sectionId':_0x29c961['id']},{})[_0x9aaf('0x28')](function(){return _0x40902e;});}else{return _0x40902e;}})[_0x9aaf('0x47')](function(_0x584fb0){logger[_0x9aaf('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x584fb0);throw _0x584fb0;});}return _0x40902e;})[_0x9aaf('0x28')](respondWithResult(_0x1d23dd,null))[_0x9aaf('0x47')](handleError(_0x1d23dd,null));});_0x219383['start']();}catch(_0x156b7b){_0x1d23dd[_0x9aaf('0x1d')](0x1f4)[_0x9aaf('0x65')](_0x156b7b);}};exports[_0x9aaf('0x27')]=function(_0x5e4740,_0x5e3413,_0x106fad){return db[_0x9aaf('0x32')][_0x9aaf('0x4b')]({'where':{'id':_0x5e4740['params']['id']}})[_0x9aaf('0x28')](handleEntityNotFound(_0x5e3413,null))[_0x9aaf('0x28')](saveUpdates(_[_0x9aaf('0x3f')](_0x5e4740[_0x9aaf('0x75')],[_0x9aaf('0x2f'),_0x9aaf('0x7a')]),null))['then'](respondWithResult(_0x5e3413,null))['catch'](handleError(_0x5e3413,null));};exports[_0x9aaf('0x7b')]=function(_0x18c66b,_0x38616c,_0x5c1621){return db[_0x9aaf('0x32')][_0x9aaf('0x4b')]({'where':{'id':_0x18c66b[_0x9aaf('0x49')]['id']}})[_0x9aaf('0x28')](function(_0x35c9ea){if(_0x35c9ea){return _0x35c9ea[_0x9aaf('0x29')]();}})[_0x9aaf('0x28')](function(_0x1f8b67){var _0x3979b6=path[_0x9aaf('0x5f')](config['root'],_0x9aaf('0x5e'),util[_0x9aaf('0x54')](_0x9aaf('0x55'),_0x1f8b67[_0x9aaf('0x4d')],_0x1f8b67[_0x9aaf('0x7c')]));var _0x5a0285=path[_0x9aaf('0x5f')](config['root'],_0x9aaf('0x50'),util[_0x9aaf('0x54')](_0x9aaf('0x55'),_0x1f8b67[_0x9aaf('0x4d')],_0x1f8b67[_0x9aaf('0x51')]));fs[_0x9aaf('0x7d')](_0x3979b6);fs[_0x9aaf('0x7d')](_0x5a0285);return _0x1f8b67;})['then'](function(_0x371efe){if(_0x371efe){return _0x38616c[_0x9aaf('0x1d')](0xcc)[_0x9aaf('0x1e')]();}})['then'](handleEntityNotFound(_0x38616c,null))[_0x9aaf('0x47')](handleError(_0x38616c,null));}; \ No newline at end of file +var _0xde51=['filename','originalname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','start','update','description','delete','original_format','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','limit','status','set','Content-Range','json','apply','reject','save','then','destroy','UserProfileResource','stack','name','send','map','Sound','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','download','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','extname','basename'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0xde51,0xa5));var _0x1de5=function(_0xb5e37f,_0xc624f1){_0xb5e37f=_0xb5e37f-0x0;var _0x23f431=_0xde51[_0xb5e37f];return _0x23f431;};'use strict';var pdf=require(_0x1de5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1de5('0x1'));var zipdir=require(_0x1de5('0x2'));var jsonpatch=require(_0x1de5('0x3'));var rp=require(_0x1de5('0x4'));var moment=require(_0x1de5('0x5'));var BPromise=require(_0x1de5('0x6'));var Mustache=require('mustache');var util=require(_0x1de5('0x7'));var path=require(_0x1de5('0x8'));var sox=require('sox');var csv=require(_0x1de5('0x9'));var ejs=require(_0x1de5('0xa'));var fs=require('fs');var _=require(_0x1de5('0xb'));var squel=require(_0x1de5('0xc'));var crypto=require(_0x1de5('0xd'));var jsforce=require(_0x1de5('0xe'));var deskjs=require(_0x1de5('0xf'));var toCsv=require(_0x1de5('0x9'));var querystring=require(_0x1de5('0x10'));var Papa=require('papaparse');var Redis=require(_0x1de5('0x11'));var authService=require(_0x1de5('0x12'));var qs=require(_0x1de5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1de5('0x14'));var logger=require(_0x1de5('0x15'))(_0x1de5('0x16'));var utils=require(_0x1de5('0x17'));var config=require(_0x1de5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1de5('0x19'))['db'];function respondWithStatusCode(_0x3e9a0f,_0x54dc83){_0x54dc83=_0x54dc83||0xcc;return function(_0x2576cf){if(_0x2576cf){return _0x3e9a0f[_0x1de5('0x1a')](_0x54dc83);}return _0x3e9a0f['status'](_0x54dc83)[_0x1de5('0x1b')]();};}function respondWithResult(_0x4bec0e,_0x5a538e){_0x5a538e=_0x5a538e||0xc8;return function(_0x2117f6){if(_0x2117f6){return _0x4bec0e['status'](_0x5a538e)['json'](_0x2117f6);}};}function respondWithFilteredResult(_0x56a8c1,_0x472d53){return function(_0x4d6f99){if(_0x4d6f99){var _0x3b4c15=_0x4d6f99['count'],_0x349573=_0x472d53[_0x1de5('0x1c')],_0x6cf47a=_0x472d53[_0x1de5('0x1c')]+_0x472d53[_0x1de5('0x1d')],_0x3ed5bb;if(_0x6cf47a>=_0x3b4c15){_0x6cf47a=_0x3b4c15;_0x3ed5bb=0xc8;}else{_0x3ed5bb=0xce;}_0x56a8c1[_0x1de5('0x1e')](_0x3ed5bb);return _0x56a8c1[_0x1de5('0x1f')](_0x1de5('0x20'),_0x349573+'-'+_0x6cf47a+'/'+_0x3b4c15)[_0x1de5('0x21')](_0x4d6f99);}return null;};}function patchUpdates(_0x27897d){return function(_0xcbf7f4){try{jsonpatch[_0x1de5('0x22')](_0xcbf7f4,_0x27897d,!![]);}catch(_0x4bce46){return BPromise[_0x1de5('0x23')](_0x4bce46);}return _0xcbf7f4[_0x1de5('0x24')]();};}function saveUpdates(_0x7dd218,_0x350845){return function(_0x5e423f){if(_0x5e423f){return _0x5e423f['update'](_0x7dd218)[_0x1de5('0x25')](function(_0x43aed9){return _0x43aed9;});}return null;};}function removeEntity(_0x152483,_0xdf1e23){return function(_0x284451){if(_0x284451){return _0x284451[_0x1de5('0x26')]()[_0x1de5('0x25')](function(){var _0x11079e=_0x284451['get']({'plain':!![]});var _0x1a5040='Sounds';return db[_0x1de5('0x27')]['destroy']({'where':{'type':_0x1a5040,'resourceId':_0x11079e['id']}})[_0x1de5('0x25')](function(){return _0x284451;});})[_0x1de5('0x25')](function(){_0x152483[_0x1de5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4943ed,_0x23d560){return function(_0x41e1d5){if(!_0x41e1d5){_0x4943ed['sendStatus'](0x194);}return _0x41e1d5;};}function handleError(_0x5c23be,_0x424853){_0x424853=_0x424853||0x1f4;return function(_0x48bc6b){logger['error'](_0x48bc6b[_0x1de5('0x28')]);if(_0x48bc6b['name']){delete _0x48bc6b[_0x1de5('0x29')];}_0x5c23be[_0x1de5('0x1e')](_0x424853)[_0x1de5('0x2a')](_0x48bc6b);};}exports['index']=function(_0x589627,_0x39c9ce){var _0x42a444={},_0x581257={},_0x26ff4a={'count':0x0,'rows':[]};var _0x28fe28=_[_0x1de5('0x2b')](db[_0x1de5('0x2c')]['rawAttributes'],function(_0x3e1853){return{'name':_0x3e1853[_0x1de5('0x2d')],'type':_0x3e1853[_0x1de5('0x2e')][_0x1de5('0x2f')]};});_0x581257[_0x1de5('0x30')]=_[_0x1de5('0x2b')](_0x28fe28,_0x1de5('0x29'));_0x581257[_0x1de5('0x31')]=_[_0x1de5('0x32')](_0x589627[_0x1de5('0x31')]);_0x581257[_0x1de5('0x33')]=_[_0x1de5('0x34')](_0x581257[_0x1de5('0x30')],_0x581257[_0x1de5('0x31')]);_0x42a444[_0x1de5('0x35')]=_[_0x1de5('0x34')](_0x581257[_0x1de5('0x30')],qs[_0x1de5('0x36')](_0x589627[_0x1de5('0x31')][_0x1de5('0x36')]));_0x42a444['attributes']=_0x42a444[_0x1de5('0x35')][_0x1de5('0x37')]?_0x42a444[_0x1de5('0x35')]:_0x581257[_0x1de5('0x30')];if(!_0x589627['query'][_0x1de5('0x38')](_0x1de5('0x39'))){_0x42a444['limit']=qs['limit'](_0x589627['query'][_0x1de5('0x1d')]);_0x42a444[_0x1de5('0x1c')]=qs[_0x1de5('0x1c')](_0x589627['query'][_0x1de5('0x1c')]);}_0x42a444['order']=qs[_0x1de5('0x3a')](_0x589627['query'][_0x1de5('0x3a')]);_0x42a444[_0x1de5('0x3b')]=qs[_0x1de5('0x33')](_[_0x1de5('0x3c')](_0x589627[_0x1de5('0x31')],_0x581257['filters']),_0x28fe28);if(_0x589627['query']['filter']){_0x42a444[_0x1de5('0x3b')]=_[_0x1de5('0x3d')](_0x42a444[_0x1de5('0x3b')],{'$or':_[_0x1de5('0x2b')](_0x28fe28,function(_0x321975){if(_0x321975['type']!==_0x1de5('0x3e')){var _0x38636a={};_0x38636a[_0x321975[_0x1de5('0x29')]]={'$like':'%'+_0x589627[_0x1de5('0x31')][_0x1de5('0x3f')]+'%'};return _0x38636a;}})});}_0x42a444=_[_0x1de5('0x3d')]({},_0x42a444,_0x589627['options']);var _0x1462ee={'where':_0x42a444[_0x1de5('0x3b')]};return db[_0x1de5('0x2c')][_0x1de5('0x40')](_0x1462ee)[_0x1de5('0x25')](function(_0x383852){_0x26ff4a[_0x1de5('0x40')]=_0x383852;if(_0x589627[_0x1de5('0x31')][_0x1de5('0x41')]){_0x42a444[_0x1de5('0x42')]=[{'all':!![]}];}return db[_0x1de5('0x2c')][_0x1de5('0x43')](_0x42a444);})['then'](function(_0x22e3b5){_0x26ff4a[_0x1de5('0x44')]=_0x22e3b5;return _0x26ff4a;})[_0x1de5('0x25')](respondWithFilteredResult(_0x39c9ce,_0x42a444))[_0x1de5('0x45')](handleError(_0x39c9ce,null));};exports[_0x1de5('0x46')]=function(_0x14b0bf,_0x2c6ef2){var _0x4aed48={'raw':!![],'where':{'id':_0x14b0bf[_0x1de5('0x47')]['id']}},_0x46ac5e={};_0x46ac5e[_0x1de5('0x30')]=_['keys'](db[_0x1de5('0x2c')][_0x1de5('0x48')]);_0x46ac5e[_0x1de5('0x31')]=_[_0x1de5('0x32')](_0x14b0bf['query']);_0x46ac5e[_0x1de5('0x33')]=_[_0x1de5('0x34')](_0x46ac5e[_0x1de5('0x30')],_0x46ac5e[_0x1de5('0x31')]);_0x4aed48[_0x1de5('0x35')]=_[_0x1de5('0x34')](_0x46ac5e[_0x1de5('0x30')],qs[_0x1de5('0x36')](_0x14b0bf[_0x1de5('0x31')][_0x1de5('0x36')]));_0x4aed48[_0x1de5('0x35')]=_0x4aed48[_0x1de5('0x35')][_0x1de5('0x37')]?_0x4aed48[_0x1de5('0x35')]:_0x46ac5e[_0x1de5('0x30')];if(_0x14b0bf[_0x1de5('0x31')]['includeAll']){_0x4aed48['include']=[{'all':!![]}];}_0x4aed48=_['merge']({},_0x4aed48,_0x14b0bf[_0x1de5('0x49')]);return db[_0x1de5('0x2c')]['find'](_0x4aed48)[_0x1de5('0x25')](handleEntityNotFound(_0x2c6ef2,null))['then'](respondWithResult(_0x2c6ef2,null))['catch'](handleError(_0x2c6ef2,null));};exports[_0x1de5('0x4a')]=function(_0x5001b3,_0x461ca3,_0x535164){return db[_0x1de5('0x2c')][_0x1de5('0x4b')]({'where':{'id':_0x5001b3[_0x1de5('0x47')]['id']},'attributes':[_0x1de5('0x29'),_0x1de5('0x4c'),_0x1de5('0x4d')],'raw':!![]})[_0x1de5('0x25')](handleEntityNotFound(_0x461ca3,null))[_0x1de5('0x25')](function(_0x4aac18){if(_0x4aac18){if(!fs[_0x1de5('0x4e')](path[_0x1de5('0x4f')](config[_0x1de5('0x50')],_0x1de5('0x51'),_0x4aac18[_0x1de5('0x4c')]+'.'+_0x4aac18['converted_format']))){throw new db[(_0x1de5('0x52'))][(_0x1de5('0x53'))](_0x1de5('0x54'));}return _0x461ca3['download'](path[_0x1de5('0x4f')](config[_0x1de5('0x50')],_0x1de5('0x51'),util[_0x1de5('0x55')]('%s.%s',_0x4aac18[_0x1de5('0x4c')],_0x4aac18[_0x1de5('0x4d')])),util[_0x1de5('0x55')](_0x1de5('0x56'),_0x4aac18[_0x1de5('0x29')],_0x4aac18[_0x1de5('0x4d')]));}return null;})[_0x1de5('0x45')](handleError(_0x461ca3,null));};exports[_0x1de5('0x57')]=function(_0x39b9ab,_0x38b663,_0x204b3a){var _0x509cea={'name':path['basename'](_0x39b9ab[_0x1de5('0x58')]['originalname'],path[_0x1de5('0x59')](_0x39b9ab[_0x1de5('0x58')]['originalname'])),'save_name':path[_0x1de5('0x5a')](_0x39b9ab[_0x1de5('0x58')][_0x1de5('0x5b')],path[_0x1de5('0x59')](_0x39b9ab[_0x1de5('0x58')][_0x1de5('0x5b')])),'original_format':path['extname'](_0x39b9ab['file'][_0x1de5('0x5c')])[_0x1de5('0x5d')](0x1),'converted_format':_0x1de5('0x5e')};var _0x1dd935=path[_0x1de5('0x4f')](config[_0x1de5('0x50')],_0x1de5('0x5f'),_0x39b9ab['file']['filename']);var _0x45b0cb=path[_0x1de5('0x4f')](config[_0x1de5('0x50')],'server/files/sounds/converted',util[_0x1de5('0x55')](_0x1de5('0x56'),path[_0x1de5('0x5a')](_0x39b9ab[_0x1de5('0x58')]['filename'],path[_0x1de5('0x59')](_0x39b9ab[_0x1de5('0x58')][_0x1de5('0x5b')])),_0x509cea[_0x1de5('0x4d')]));logger[_0x1de5('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0x1dd935);logger['info'](_0x1de5('0x61'),_0x45b0cb);try{fs[_0x1de5('0x62')](_0x1dd935,parseInt(_0x1de5('0x63'),0x8));var _0x1c54c5=sox[_0x1de5('0x64')](_0x1dd935,_0x45b0cb,{'sampleRate':0x1f40,'format':_0x1de5('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1c54c5['on'](_0x1de5('0x65'),function(_0x3363a6){fs[_0x1de5('0x66')](_0x1dd935);_0x38b663[_0x1de5('0x1e')](0x1f4)[_0x1de5('0x2a')](_0x3363a6);});_0x1c54c5['on']('src',function(_0x18bab4){_0x509cea['original_duration']=isNaN(_0x18bab4[_0x1de5('0x67')])?null:_0x18bab4[_0x1de5('0x67')]*0x3e8;_0x509cea[_0x1de5('0x68')]=isNaN(_0x18bab4[_0x1de5('0x69')])?null:_0x18bab4[_0x1de5('0x69')];_0x509cea[_0x1de5('0x6a')]=isNaN(_0x18bab4[_0x1de5('0x6b')])?null:_0x18bab4[_0x1de5('0x6b')];_0x509cea[_0x1de5('0x6c')]=isNaN(_0x18bab4[_0x1de5('0x6d')])?null:_0x18bab4[_0x1de5('0x6d')];_0x509cea['original_sampleRate']=isNaN(_0x18bab4[_0x1de5('0x6e')])?null:_0x18bab4[_0x1de5('0x6e')];});_0x1c54c5['on']('dest',function(_0x8ba109){_0x509cea[_0x1de5('0x6f')]=isNaN(_0x8ba109[_0x1de5('0x67')])?null:_0x8ba109['duration']*0x3e8;_0x509cea[_0x1de5('0x70')]=isNaN(_0x8ba109[_0x1de5('0x69')])?null:_0x8ba109[_0x1de5('0x69')];_0x509cea['converted_channelCount']=isNaN(_0x8ba109['channelCount'])?null:_0x8ba109[_0x1de5('0x6b')];_0x509cea[_0x1de5('0x71')]=isNaN(_0x8ba109[_0x1de5('0x6d')])?null:_0x8ba109[_0x1de5('0x6d')];_0x509cea[_0x1de5('0x72')]=isNaN(_0x8ba109[_0x1de5('0x6e')])?null:_0x8ba109['sampleRate'];});_0x1c54c5['on'](_0x1de5('0x1b'),function(){fs[_0x1de5('0x62')](_0x45b0cb,parseInt(_0x1de5('0x63'),0x8));return db['Sound'][_0x1de5('0x57')](_0x509cea)[_0x1de5('0x25')](function(_0x4fd419){var _0x3e7509={'role':_0x39b9ab['body'][_0x1de5('0x73')],'userProfileId':_0x39b9ab[_0x1de5('0x74')][_0x1de5('0x75')]};if(!_0x3e7509)throw new Error(_0x1de5('0x76'));if(_0x3e7509['role']===_0x1de5('0x77')){var _0x9fd2b6=_0x4fd419[_0x1de5('0x78')]({'plain':!![]});return db[_0x1de5('0x79')][_0x1de5('0x4b')]({'where':{'name':'Sounds','userProfileId':_0x3e7509[_0x1de5('0x75')]},'raw':!![]})['then'](function(_0x1354a5){if(_0x1354a5&&_0x1354a5[_0x1de5('0x7a')]===0x0){return db[_0x1de5('0x27')][_0x1de5('0x57')]({'name':_0x9fd2b6['name'],'resourceId':_0x9fd2b6['id'],'type':_0x1354a5['name'],'sectionId':_0x1354a5['id']},{})['then'](function(){return _0x4fd419;});}else{return _0x4fd419;}})[_0x1de5('0x45')](function(_0x1a4f31){logger[_0x1de5('0x65')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a4f31);throw _0x1a4f31;});}return _0x4fd419;})[_0x1de5('0x25')](respondWithResult(_0x38b663,null))['catch'](handleError(_0x38b663,null));});_0x1c54c5[_0x1de5('0x7b')]();}catch(_0x15b9c0){_0x38b663[_0x1de5('0x1e')](0x1f4)['send'](_0x15b9c0);}};exports[_0x1de5('0x7c')]=function(_0x2c99d9,_0x6c84eb,_0x1802a2){return db[_0x1de5('0x2c')]['find']({'where':{'id':_0x2c99d9[_0x1de5('0x47')]['id']}})[_0x1de5('0x25')](handleEntityNotFound(_0x6c84eb,null))[_0x1de5('0x25')](saveUpdates(_[_0x1de5('0x3c')](_0x2c99d9[_0x1de5('0x74')],[_0x1de5('0x29'),_0x1de5('0x7d')]),null))[_0x1de5('0x25')](respondWithResult(_0x6c84eb,null))[_0x1de5('0x45')](handleError(_0x6c84eb,null));};exports[_0x1de5('0x7e')]=function(_0x2910f8,_0x48edc8,_0x57e544){return db['Sound']['find']({'where':{'id':_0x2910f8['params']['id']}})[_0x1de5('0x25')](function(_0x39dbc0){if(_0x39dbc0){return _0x39dbc0[_0x1de5('0x26')]();}})[_0x1de5('0x25')](function(_0x53084c){var _0x5c93df=path['join'](config[_0x1de5('0x50')],_0x1de5('0x5f'),util[_0x1de5('0x55')](_0x1de5('0x56'),_0x53084c[_0x1de5('0x4c')],_0x53084c[_0x1de5('0x7f')]));var _0x3501c3=path[_0x1de5('0x4f')](config['root'],_0x1de5('0x51'),util[_0x1de5('0x55')]('%s.%s',_0x53084c['save_name'],_0x53084c['converted_format']));fs[_0x1de5('0x66')](_0x5c93df);fs[_0x1de5('0x66')](_0x3501c3);return _0x53084c;})[_0x1de5('0x25')](function(_0x507ec0){if(_0x507ec0){return _0x48edc8[_0x1de5('0x1e')](0xcc)[_0x1de5('0x1b')]();}})[_0x1de5('0x25')](handleEntityNotFound(_0x48edc8,null))[_0x1de5('0x45')](handleError(_0x48edc8,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 9dc32ca..7eeb1be 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 _0x3026=['../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','../../config/logger','api','moment','path','rimraf'];(function(_0x13d580,_0x53a187){var _0x5e124b=function(_0x5abc88){while(--_0x5abc88){_0x13d580['push'](_0x13d580['shift']());}};_0x5e124b(++_0x53a187);}(_0x3026,0x1d4));var _0x6302=function(_0x36e0e9,_0x138073){_0x36e0e9=_0x36e0e9-0x0;var _0x4591f5=_0x3026[_0x36e0e9];return _0x4591f5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6302('0x0'))(_0x6302('0x1'));var moment=require(_0x6302('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6302('0x3'));var rimraf=require(_0x6302('0x4'));var config=require(_0x6302('0x5'));var attributes=require(_0x6302('0x6'));module[_0x6302('0x7')]=function(_0x370bd0,_0xf8d740){return _0x370bd0[_0x6302('0x8')](_0x6302('0x9'),attributes,{'tableName':_0x6302('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ecf=['../../config/environment','./sound.attributes','exports','define','Sound','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0xfc5de,_0x210af9){var _0x25ece8=function(_0x584144){while(--_0x584144){_0xfc5de['push'](_0xfc5de['shift']());}};_0x25ece8(++_0x210af9);}(_0x9ecf,0x131));var _0xf9ec=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x9ecf[_0x3747ae];return _0x339035;};'use strict';var _=require(_0xf9ec('0x0'));var util=require(_0xf9ec('0x1'));var logger=require(_0xf9ec('0x2'))(_0xf9ec('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf9ec('0x4'));var fs=require('fs');var path=require(_0xf9ec('0x5'));var rimraf=require(_0xf9ec('0x6'));var config=require(_0xf9ec('0x7'));var attributes=require(_0xf9ec('0x8'));module[_0xf9ec('0x9')]=function(_0x4dd817,_0x42223c){return _0x4dd817[_0xf9ec('0xa')](_0xf9ec('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index ff56587..d0d19da 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 _0x6a42=['find','options','raw','where','attributes','include','map','model','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','catch','ShowSound','Sound'];(function(_0x6fb5be,_0x58a8bb){var _0xe22de7=function(_0x1fdf23){while(--_0x1fdf23){_0x6fb5be['push'](_0x6fb5be['shift']());}};_0xe22de7(++_0x58a8bb);}(_0x6a42,0x8d));var _0x26a4=function(_0xe1494a,_0x1b3db4){_0xe1494a=_0xe1494a-0x0;var _0x6ad064=_0x6a42[_0xe1494a];return _0x6ad064;};'use strict';var _=require('lodash');var util=require(_0x26a4('0x0'));var moment=require(_0x26a4('0x1'));var BPromise=require(_0x26a4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26a4('0x3'));var db=require(_0x26a4('0x4'))['db'];var utils=require(_0x26a4('0x5'));var logger=require(_0x26a4('0x6'))(_0x26a4('0x7'));var config=require(_0x26a4('0x8'));var jayson=require(_0x26a4('0x9'));var client=jayson[_0x26a4('0xa')][_0x26a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4aa959,_0x23e28e,_0x51132b){return new BPromise(function(_0x108e12,_0x1dd615){return client['request'](_0x4aa959,_0x51132b)['then'](function(_0x4d5ac6){logger[_0x26a4('0xc')]('Sound,\x20%s,\x20%s',_0x23e28e,_0x26a4('0xd'));logger[_0x26a4('0xe')](_0x26a4('0xf'),_0x23e28e,_0x26a4('0xd'),JSON[_0x26a4('0x10')](_0x4d5ac6));if(_0x4d5ac6[_0x26a4('0x11')]){if(_0x4d5ac6[_0x26a4('0x11')][_0x26a4('0x12')]===0x1f4){logger[_0x26a4('0x11')](_0x26a4('0x13'),_0x23e28e,_0x4d5ac6[_0x26a4('0x11')][_0x26a4('0x14')]);return _0x1dd615(_0x4d5ac6[_0x26a4('0x11')][_0x26a4('0x14')]);}logger['error']('Sound,\x20%s,\x20%s',_0x23e28e,_0x4d5ac6['error'][_0x26a4('0x14')]);return _0x108e12(_0x4d5ac6[_0x26a4('0x11')][_0x26a4('0x14')]);}else{logger[_0x26a4('0xc')](_0x26a4('0x13'),_0x23e28e,'request\x20sent');_0x108e12(_0x4d5ac6['result'][_0x26a4('0x14')]);}})[_0x26a4('0x15')](function(_0x292cc2){logger[_0x26a4('0x11')]('Sound,\x20%s,\x20%s',_0x23e28e,_0x292cc2);_0x1dd615(_0x292cc2);});});}exports[_0x26a4('0x16')]=function(_0x48f39c){var _0x5c4f00=this;return new Promise(function(_0x45731e,_0x4c3356){return db[_0x26a4('0x17')][_0x26a4('0x18')]({'raw':_0x48f39c[_0x26a4('0x19')]?_0x48f39c[_0x26a4('0x19')][_0x26a4('0x1a')]===undefined?!![]:![]:!![],'where':_0x48f39c[_0x26a4('0x19')]?_0x48f39c['options'][_0x26a4('0x1b')]||null:null,'attributes':_0x48f39c[_0x26a4('0x19')]?_0x48f39c[_0x26a4('0x19')][_0x26a4('0x1c')]||null:null,'include':_0x48f39c[_0x26a4('0x19')]?_0x48f39c[_0x26a4('0x19')][_0x26a4('0x1d')]?_[_0x26a4('0x1e')](_0x48f39c[_0x26a4('0x19')]['include'],function(_0x200328){return{'model':db[_0x200328[_0x26a4('0x1f')]],'as':_0x200328['as'],'attributes':_0x200328['attributes'],'include':_0x200328[_0x26a4('0x1d')]?_[_0x26a4('0x1e')](_0x200328[_0x26a4('0x1d')],function(_0x534ebd){return{'model':db[_0x534ebd[_0x26a4('0x1f')]],'as':_0x534ebd['as'],'attributes':_0x534ebd['attributes'],'include':_0x534ebd['include']?_[_0x26a4('0x1e')](_0x534ebd[_0x26a4('0x1d')],function(_0x44c8a7){return{'model':db[_0x44c8a7[_0x26a4('0x1f')]],'as':_0x44c8a7['as'],'attributes':_0x44c8a7[_0x26a4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x26a4('0x20')](function(_0x2cbc19){logger['info'](_0x26a4('0x16'),_0x48f39c);logger[_0x26a4('0xe')](_0x26a4('0x16'),_0x48f39c,JSON[_0x26a4('0x10')](_0x2cbc19));_0x45731e(_0x2cbc19);})['catch'](function(_0x234660){logger[_0x26a4('0x11')](_0x26a4('0x16'),_0x234660[_0x26a4('0x14')],_0x48f39c);_0x4c3356(_0x5c4f00[_0x26a4('0x11')](0x1f4,_0x234660['message']));});});}; \ No newline at end of file +var _0xb171=['jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','info','catch','find','options','raw','where','attributes','include','map','model','ShowSound','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x1cd840,_0x5ba9fb){var _0x1c3d39=function(_0x35029c){while(--_0x35029c){_0x1cd840['push'](_0x1cd840['shift']());}};_0x1c3d39(++_0x5ba9fb);}(_0xb171,0x1ba));var _0x1b17=function(_0x431e06,_0x50638a){_0x431e06=_0x431e06-0x0;var _0x427c63=_0xb171[_0x431e06];return _0x427c63;};'use strict';var _=require(_0x1b17('0x0'));var util=require('util');var moment=require(_0x1b17('0x1'));var BPromise=require(_0x1b17('0x2'));var rs=require(_0x1b17('0x3'));var fs=require('fs');var Redis=require(_0x1b17('0x4'));var db=require(_0x1b17('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b17('0x6'))('rpc');var config=require(_0x1b17('0x7'));var jayson=require(_0x1b17('0x8'));var client=jayson[_0x1b17('0x9')][_0x1b17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x404098,_0x23d265,_0x317818){return new BPromise(function(_0x2b3bf,_0x171735){return client['request'](_0x404098,_0x317818)[_0x1b17('0xb')](function(_0x3d3fdf){logger['info']('Sound,\x20%s,\x20%s',_0x23d265,_0x1b17('0xc'));logger[_0x1b17('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x23d265,_0x1b17('0xc'),JSON[_0x1b17('0xe')](_0x3d3fdf));if(_0x3d3fdf[_0x1b17('0xf')]){if(_0x3d3fdf[_0x1b17('0xf')][_0x1b17('0x10')]===0x1f4){logger[_0x1b17('0xf')](_0x1b17('0x11'),_0x23d265,_0x3d3fdf['error'][_0x1b17('0x12')]);return _0x171735(_0x3d3fdf[_0x1b17('0xf')]['message']);}logger[_0x1b17('0xf')](_0x1b17('0x11'),_0x23d265,_0x3d3fdf[_0x1b17('0xf')]['message']);return _0x2b3bf(_0x3d3fdf[_0x1b17('0xf')]['message']);}else{logger[_0x1b17('0x13')](_0x1b17('0x11'),_0x23d265,_0x1b17('0xc'));_0x2b3bf(_0x3d3fdf['result'][_0x1b17('0x12')]);}})[_0x1b17('0x14')](function(_0x336c89){logger[_0x1b17('0xf')](_0x1b17('0x11'),_0x23d265,_0x336c89);_0x171735(_0x336c89);});});}exports['ShowSound']=function(_0x313cd3){var _0x24618f=this;return new Promise(function(_0x178c2f,_0x1f967b){return db['Sound'][_0x1b17('0x15')]({'raw':_0x313cd3[_0x1b17('0x16')]?_0x313cd3[_0x1b17('0x16')][_0x1b17('0x17')]===undefined?!![]:![]:!![],'where':_0x313cd3[_0x1b17('0x16')]?_0x313cd3[_0x1b17('0x16')][_0x1b17('0x18')]||null:null,'attributes':_0x313cd3[_0x1b17('0x16')]?_0x313cd3[_0x1b17('0x16')][_0x1b17('0x19')]||null:null,'include':_0x313cd3[_0x1b17('0x16')]?_0x313cd3[_0x1b17('0x16')][_0x1b17('0x1a')]?_['map'](_0x313cd3[_0x1b17('0x16')][_0x1b17('0x1a')],function(_0x3ba6e2){return{'model':db[_0x3ba6e2['model']],'as':_0x3ba6e2['as'],'attributes':_0x3ba6e2[_0x1b17('0x19')],'include':_0x3ba6e2[_0x1b17('0x1a')]?_['map'](_0x3ba6e2[_0x1b17('0x1a')],function(_0xdf036b){return{'model':db[_0xdf036b['model']],'as':_0xdf036b['as'],'attributes':_0xdf036b[_0x1b17('0x19')],'include':_0xdf036b[_0x1b17('0x1a')]?_[_0x1b17('0x1b')](_0xdf036b[_0x1b17('0x1a')],function(_0x360d02){return{'model':db[_0x360d02[_0x1b17('0x1c')]],'as':_0x360d02['as'],'attributes':_0x360d02[_0x1b17('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1b17('0xb')](function(_0x490849){logger[_0x1b17('0x13')](_0x1b17('0x1d'),_0x313cd3);logger[_0x1b17('0xd')](_0x1b17('0x1d'),_0x313cd3,JSON['stringify'](_0x490849));_0x178c2f(_0x490849);})[_0x1b17('0x14')](function(_0x22901a){logger[_0x1b17('0xf')](_0x1b17('0x1d'),_0x22901a[_0x1b17('0x12')],_0x313cd3);_0x1f967b(_0x24618f[_0x1b17('0xf')](0x1f4,_0x22901a[_0x1b17('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 010ac3a..af869da 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 _0x259b=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x36065a,_0x5483d4){var _0x14f1e9=function(_0x26e784){while(--_0x26e784){_0x36065a['push'](_0x36065a['shift']());}};_0x14f1e9(++_0x5483d4);}(_0x259b,0x1da));var _0xb259=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x259b[_0x42bc91];return _0x3f5507;};'use strict';var multer=require(_0xb259('0x0'));var util=require(_0xb259('0x1'));var path=require(_0xb259('0x2'));var timeout=require(_0xb259('0x3'));var express=require(_0xb259('0x4'));var router=express[_0xb259('0x5')]();var auth=require(_0xb259('0x6'));var interaction=require(_0xb259('0x7'));var config=require(_0xb259('0x8'));var controller=require('./squareMessage.controller');router[_0xb259('0x9')]('/',auth[_0xb259('0xa')](),controller['index']);router[_0xb259('0x9')](_0xb259('0xb'),auth['isAuthenticated'](),controller[_0xb259('0xc')]);router[_0xb259('0xd')]('/',auth[_0xb259('0xa')](),controller[_0xb259('0xe')]);router[_0xb259('0xf')](_0xb259('0xb'),auth['isAuthenticated'](),controller[_0xb259('0x10')]);router['delete']('/:id',auth[_0xb259('0xa')](),controller[_0xb259('0x11')]);module[_0xb259('0x12')]=router; \ No newline at end of file +var _0x3071=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x497da3,_0x1f85cd){var _0x3fb05a=function(_0x3e292b){while(--_0x3e292b){_0x497da3['push'](_0x497da3['shift']());}};_0x3fb05a(++_0x1f85cd);}(_0x3071,0xf3));var _0x1307=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x3071[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require(_0x1307('0x0'));var util=require(_0x1307('0x1'));var path=require(_0x1307('0x2'));var timeout=require(_0x1307('0x3'));var express=require(_0x1307('0x4'));var router=express['Router']();var auth=require(_0x1307('0x5'));var interaction=require(_0x1307('0x6'));var config=require(_0x1307('0x7'));var controller=require(_0x1307('0x8'));router[_0x1307('0x9')]('/',auth[_0x1307('0xa')](),controller[_0x1307('0xb')]);router[_0x1307('0x9')](_0x1307('0xc'),auth['isAuthenticated'](),controller[_0x1307('0xd')]);router['post']('/',auth[_0x1307('0xa')](),controller[_0x1307('0xe')]);router[_0x1307('0xf')](_0x1307('0xc'),auth[_0x1307('0xa')](),controller[_0x1307('0x10')]);router[_0x1307('0x11')](_0x1307('0xc'),auth[_0x1307('0xa')](),controller[_0x1307('0x12')]);module[_0x1307('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 20ab5bc..1d69022 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 _0x7fbe=['ENUM','out','STRING','TEXT','medium'];(function(_0x483385,_0x437c03){var _0x1b4449=function(_0x5768ee){while(--_0x5768ee){_0x483385['push'](_0x483385['shift']());}};_0x1b4449(++_0x437c03);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x166e33,_0x127e77){_0x166e33=_0x166e33-0x0;var _0x1a2409=_0x7fbe[_0x166e33];return _0x1a2409;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7fb('0x0')]},'body':{'type':Sequelize[_0xe7fb('0x1')](_0xe7fb('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xe7fb('0x3')]('in',_0xe7fb('0x4')),'defaultValue':_0xe7fb('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe7fb('0x0')]},'providerResponse':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file +var _0x3937=['out','sequelize','STRING','TEXT','ENUM'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x3937,0xbf));var _0x7393=function(_0x407edf,_0x4b19a1){_0x407edf=_0x407edf-0x0;var _0x291409=_0x3937[_0x407edf];return _0x291409;};'use strict';var Sequelize=require(_0x7393('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7393('0x1')]},'body':{'type':Sequelize[_0x7393('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x7393('0x3')]('in','out'),'defaultValue':_0x7393('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7393('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 47ef56a..4bfe61f 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 _0xd7f2=['json','offset','limit','set','Content-Range','reject','save','then','destroy','end','sendStatus','error','name','send','index','map','SquareMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','count','includeAll','include','rows','catch','show','options','create','update','body','find','params','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x562be0,_0x4c6d1a){var _0x2a6405=function(_0x1077c5){while(--_0x1077c5){_0x562be0['push'](_0x562be0['shift']());}};_0x2a6405(++_0x4c6d1a);}(_0xd7f2,0x192));var _0x2d7f=function(_0x28f665,_0x31bde5){_0x28f665=_0x28f665-0x0;var _0x346421=_0xd7f2[_0x28f665];return _0x346421;};'use strict';var pdf=require(_0x2d7f('0x0'));var emlformat=require(_0x2d7f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d7f('0x2'));var rp=require('request-promise');var moment=require(_0x2d7f('0x3'));var BPromise=require(_0x2d7f('0x4'));var Mustache=require(_0x2d7f('0x5'));var util=require(_0x2d7f('0x6'));var path=require(_0x2d7f('0x7'));var sox=require('sox');var csv=require(_0x2d7f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2d7f('0x9'));var squel=require('squel');var crypto=require(_0x2d7f('0xa'));var jsforce=require(_0x2d7f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2d7f('0xc'));var Papa=require(_0x2d7f('0xd'));var Redis=require(_0x2d7f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2d7f('0xf'));var as=require(_0x2d7f('0x10'));var hardwareService=require(_0x2d7f('0x11'));var logger=require(_0x2d7f('0x12'))('api');var utils=require(_0x2d7f('0x13'));var config=require(_0x2d7f('0x14'));var licenseUtil=require(_0x2d7f('0x15'));var db=require(_0x2d7f('0x16'))['db'];function respondWithStatusCode(_0x496af4,_0x13d3da){_0x13d3da=_0x13d3da||0xcc;return function(_0xf3d802){if(_0xf3d802){return _0x496af4['sendStatus'](_0x13d3da);}return _0x496af4['status'](_0x13d3da)['end']();};}function respondWithResult(_0x64ba5e,_0x199a20){_0x199a20=_0x199a20||0xc8;return function(_0x5d2f75){if(_0x5d2f75){return _0x64ba5e[_0x2d7f('0x17')](_0x199a20)[_0x2d7f('0x18')](_0x5d2f75);}};}function respondWithFilteredResult(_0x204691,_0x42c99e){return function(_0x44f68a){if(_0x44f68a){var _0x38297c=_0x44f68a['count'],_0x33457a=_0x42c99e[_0x2d7f('0x19')],_0x5165b=_0x42c99e[_0x2d7f('0x19')]+_0x42c99e[_0x2d7f('0x1a')],_0x5c88bc;if(_0x5165b>=_0x38297c){_0x5165b=_0x38297c;_0x5c88bc=0xc8;}else{_0x5c88bc=0xce;}_0x204691['status'](_0x5c88bc);return _0x204691[_0x2d7f('0x1b')](_0x2d7f('0x1c'),_0x33457a+'-'+_0x5165b+'/'+_0x38297c)[_0x2d7f('0x18')](_0x44f68a);}return null;};}function patchUpdates(_0x253bbb){return function(_0x1ddf43){try{jsonpatch['apply'](_0x1ddf43,_0x253bbb,!![]);}catch(_0x2f0f3a){return BPromise[_0x2d7f('0x1d')](_0x2f0f3a);}return _0x1ddf43[_0x2d7f('0x1e')]();};}function saveUpdates(_0x250ee2,_0x176fc9){return function(_0x575cf4){if(_0x575cf4){return _0x575cf4['update'](_0x250ee2)[_0x2d7f('0x1f')](function(_0x50af25){return _0x50af25;});}return null;};}function removeEntity(_0x5256bc,_0x5c27c3){return function(_0x20a929){if(_0x20a929){return _0x20a929[_0x2d7f('0x20')]()[_0x2d7f('0x1f')](function(){_0x5256bc[_0x2d7f('0x17')](0xcc)[_0x2d7f('0x21')]();});}};}function handleEntityNotFound(_0x39697e,_0x226678){return function(_0x515e0b){if(!_0x515e0b){_0x39697e[_0x2d7f('0x22')](0x194);}return _0x515e0b;};}function handleError(_0x15dba2,_0x19d71b){_0x19d71b=_0x19d71b||0x1f4;return function(_0x3ab7ec){logger[_0x2d7f('0x23')](_0x3ab7ec['stack']);if(_0x3ab7ec[_0x2d7f('0x24')]){delete _0x3ab7ec[_0x2d7f('0x24')];}_0x15dba2[_0x2d7f('0x17')](_0x19d71b)[_0x2d7f('0x25')](_0x3ab7ec);};}exports[_0x2d7f('0x26')]=function(_0x1532b2,_0x18a059){var _0xcfc8d6={},_0x2bdeb5={},_0x58b6f4={'count':0x0,'rows':[]};var _0x41c099=_[_0x2d7f('0x27')](db[_0x2d7f('0x28')][_0x2d7f('0x29')],function(_0x58814f){return{'name':_0x58814f['fieldName'],'type':_0x58814f[_0x2d7f('0x2a')]['key']};});_0x2bdeb5[_0x2d7f('0x2b')]=_[_0x2d7f('0x27')](_0x41c099,_0x2d7f('0x24'));_0x2bdeb5[_0x2d7f('0x2c')]=_[_0x2d7f('0x2d')](_0x1532b2[_0x2d7f('0x2c')]);_0x2bdeb5[_0x2d7f('0x2e')]=_[_0x2d7f('0x2f')](_0x2bdeb5[_0x2d7f('0x2b')],_0x2bdeb5[_0x2d7f('0x2c')]);_0xcfc8d6[_0x2d7f('0x30')]=_['intersection'](_0x2bdeb5[_0x2d7f('0x2b')],qs[_0x2d7f('0x31')](_0x1532b2[_0x2d7f('0x2c')]['fields']));_0xcfc8d6[_0x2d7f('0x30')]=_0xcfc8d6[_0x2d7f('0x30')][_0x2d7f('0x32')]?_0xcfc8d6['attributes']:_0x2bdeb5['model'];if(!_0x1532b2['query'][_0x2d7f('0x33')](_0x2d7f('0x34'))){_0xcfc8d6[_0x2d7f('0x1a')]=qs['limit'](_0x1532b2[_0x2d7f('0x2c')]['limit']);_0xcfc8d6[_0x2d7f('0x19')]=qs[_0x2d7f('0x19')](_0x1532b2[_0x2d7f('0x2c')][_0x2d7f('0x19')]);}_0xcfc8d6[_0x2d7f('0x35')]=qs['sort'](_0x1532b2[_0x2d7f('0x2c')]['sort']);_0xcfc8d6['where']=qs[_0x2d7f('0x2e')](_[_0x2d7f('0x36')](_0x1532b2[_0x2d7f('0x2c')],_0x2bdeb5[_0x2d7f('0x2e')]),_0x41c099);if(_0x1532b2[_0x2d7f('0x2c')][_0x2d7f('0x37')]){_0xcfc8d6[_0x2d7f('0x38')]=_['merge'](_0xcfc8d6[_0x2d7f('0x38')],{'$or':_[_0x2d7f('0x27')](_0x41c099,function(_0x2474e8){if(_0x2474e8['type']!==_0x2d7f('0x39')){var _0x54c6f5={};_0x54c6f5[_0x2474e8['name']]={'$like':'%'+_0x1532b2[_0x2d7f('0x2c')][_0x2d7f('0x37')]+'%'};return _0x54c6f5;}})});}_0xcfc8d6=_[_0x2d7f('0x3a')]({},_0xcfc8d6,_0x1532b2['options']);var _0x49ff17={'where':_0xcfc8d6['where']};return db[_0x2d7f('0x28')][_0x2d7f('0x3b')](_0x49ff17)[_0x2d7f('0x1f')](function(_0xaa0b7a){_0x58b6f4[_0x2d7f('0x3b')]=_0xaa0b7a;if(_0x1532b2['query'][_0x2d7f('0x3c')]){_0xcfc8d6[_0x2d7f('0x3d')]=[{'all':!![]}];}return db[_0x2d7f('0x28')]['findAll'](_0xcfc8d6);})['then'](function(_0x318f2a){_0x58b6f4[_0x2d7f('0x3e')]=_0x318f2a;return _0x58b6f4;})['then'](respondWithFilteredResult(_0x18a059,_0xcfc8d6))[_0x2d7f('0x3f')](handleError(_0x18a059,null));};exports[_0x2d7f('0x40')]=function(_0x5d92af,_0x4ba7f4){var _0x53fa89={'raw':!![],'where':{'id':_0x5d92af['params']['id']}},_0x24d759={};_0x24d759['model']=_[_0x2d7f('0x2d')](db[_0x2d7f('0x28')][_0x2d7f('0x29')]);_0x24d759[_0x2d7f('0x2c')]=_[_0x2d7f('0x2d')](_0x5d92af[_0x2d7f('0x2c')]);_0x24d759[_0x2d7f('0x2e')]=_[_0x2d7f('0x2f')](_0x24d759[_0x2d7f('0x2b')],_0x24d759['query']);_0x53fa89[_0x2d7f('0x30')]=_[_0x2d7f('0x2f')](_0x24d759['model'],qs[_0x2d7f('0x31')](_0x5d92af['query'][_0x2d7f('0x31')]));_0x53fa89[_0x2d7f('0x30')]=_0x53fa89['attributes'][_0x2d7f('0x32')]?_0x53fa89[_0x2d7f('0x30')]:_0x24d759[_0x2d7f('0x2b')];if(_0x5d92af[_0x2d7f('0x2c')][_0x2d7f('0x3c')]){_0x53fa89[_0x2d7f('0x3d')]=[{'all':!![]}];}_0x53fa89=_[_0x2d7f('0x3a')]({},_0x53fa89,_0x5d92af[_0x2d7f('0x41')]);return db[_0x2d7f('0x28')]['find'](_0x53fa89)[_0x2d7f('0x1f')](handleEntityNotFound(_0x4ba7f4,null))[_0x2d7f('0x1f')](respondWithResult(_0x4ba7f4,null))[_0x2d7f('0x3f')](handleError(_0x4ba7f4,null));};exports['create']=function(_0x2aebd5,_0x2bf723){return db[_0x2d7f('0x28')][_0x2d7f('0x42')](_0x2aebd5['body'],{})[_0x2d7f('0x1f')](respondWithResult(_0x2bf723,0xc9))[_0x2d7f('0x3f')](handleError(_0x2bf723,null));};exports[_0x2d7f('0x43')]=function(_0x4edba7,_0x47b522){if(_0x4edba7[_0x2d7f('0x44')]['id']){delete _0x4edba7[_0x2d7f('0x44')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x4edba7['params']['id']}})[_0x2d7f('0x1f')](handleEntityNotFound(_0x47b522,null))[_0x2d7f('0x1f')](saveUpdates(_0x4edba7[_0x2d7f('0x44')],null))[_0x2d7f('0x1f')](respondWithResult(_0x47b522,null))[_0x2d7f('0x3f')](handleError(_0x47b522,null));};exports[_0x2d7f('0x20')]=function(_0x5bd8a7,_0x1f45d0){return db[_0x2d7f('0x28')][_0x2d7f('0x45')]({'where':{'id':_0x5bd8a7[_0x2d7f('0x46')]['id']}})[_0x2d7f('0x1f')](handleEntityNotFound(_0x1f45d0,null))[_0x2d7f('0x1f')](removeEntity(_0x1f45d0,null))[_0x2d7f('0x3f')](handleError(_0x1f45d0,null));}; \ No newline at end of file +var _0x14e0=['lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','SquareMessage','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','length','options','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x5eee9d,_0x20c152){var _0x3690bc=function(_0x390a19){while(--_0x390a19){_0x5eee9d['push'](_0x5eee9d['shift']());}};_0x3690bc(++_0x20c152);}(_0x14e0,0x1ee));var _0x014e=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x14e0[_0x34ad72];return _0x5c9aa8;};'use strict';var pdf=require(_0x014e('0x0'));var emlformat=require(_0x014e('0x1'));var rimraf=require(_0x014e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x014e('0x3'));var moment=require(_0x014e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x014e('0x5'));var util=require(_0x014e('0x6'));var path=require(_0x014e('0x7'));var sox=require(_0x014e('0x8'));var csv=require(_0x014e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x014e('0xa'));var squel=require(_0x014e('0xb'));var crypto=require(_0x014e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x014e('0xd'));var toCsv=require(_0x014e('0x9'));var querystring=require(_0x014e('0xe'));var Papa=require(_0x014e('0xf'));var Redis=require(_0x014e('0x10'));var authService=require(_0x014e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x014e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x014e('0x13'));var utils=require(_0x014e('0x14'));var config=require(_0x014e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x014e('0x16'))['db'];function respondWithStatusCode(_0x45afef,_0x3714be){_0x3714be=_0x3714be||0xcc;return function(_0x3c629b){if(_0x3c629b){return _0x45afef[_0x014e('0x17')](_0x3714be);}return _0x45afef[_0x014e('0x18')](_0x3714be)[_0x014e('0x19')]();};}function respondWithResult(_0x2a3073,_0x4ad7da){_0x4ad7da=_0x4ad7da||0xc8;return function(_0x1ee808){if(_0x1ee808){return _0x2a3073[_0x014e('0x18')](_0x4ad7da)['json'](_0x1ee808);}};}function respondWithFilteredResult(_0x25d26c,_0x181b80){return function(_0x5927ba){if(_0x5927ba){var _0x4d1322=_0x5927ba[_0x014e('0x1a')],_0x54b6ee=_0x181b80['offset'],_0x505760=_0x181b80[_0x014e('0x1b')]+_0x181b80[_0x014e('0x1c')],_0x413941;if(_0x505760>=_0x4d1322){_0x505760=_0x4d1322;_0x413941=0xc8;}else{_0x413941=0xce;}_0x25d26c[_0x014e('0x18')](_0x413941);return _0x25d26c[_0x014e('0x1d')](_0x014e('0x1e'),_0x54b6ee+'-'+_0x505760+'/'+_0x4d1322)[_0x014e('0x1f')](_0x5927ba);}return null;};}function patchUpdates(_0x13299b){return function(_0x2fd238){try{jsonpatch[_0x014e('0x20')](_0x2fd238,_0x13299b,!![]);}catch(_0x23cfa4){return BPromise[_0x014e('0x21')](_0x23cfa4);}return _0x2fd238[_0x014e('0x22')]();};}function saveUpdates(_0x24a474,_0x49cf53){return function(_0x4f5a9f){if(_0x4f5a9f){return _0x4f5a9f[_0x014e('0x23')](_0x24a474)[_0x014e('0x24')](function(_0x11df15){return _0x11df15;});}return null;};}function removeEntity(_0xfeabc,_0x100458){return function(_0x1fbc56){if(_0x1fbc56){return _0x1fbc56[_0x014e('0x25')]()[_0x014e('0x24')](function(){_0xfeabc[_0x014e('0x18')](0xcc)[_0x014e('0x19')]();});}};}function handleEntityNotFound(_0x242c88,_0x2b971b){return function(_0x441d42){if(!_0x441d42){_0x242c88[_0x014e('0x17')](0x194);}return _0x441d42;};}function handleError(_0xbb4888,_0x3c7d0f){_0x3c7d0f=_0x3c7d0f||0x1f4;return function(_0x2436e8){logger['error'](_0x2436e8['stack']);if(_0x2436e8[_0x014e('0x26')]){delete _0x2436e8['name'];}_0xbb4888['status'](_0x3c7d0f)[_0x014e('0x27')](_0x2436e8);};}exports[_0x014e('0x28')]=function(_0x24d9d3,_0x2d3452){var _0x2ee9aa={},_0x46c1ff={},_0x34e567={'count':0x0,'rows':[]};var _0x2050eb=_[_0x014e('0x29')](db[_0x014e('0x2a')]['rawAttributes'],function(_0x18b472){return{'name':_0x18b472[_0x014e('0x2b')],'type':_0x18b472[_0x014e('0x2c')][_0x014e('0x2d')]};});_0x46c1ff[_0x014e('0x2e')]=_[_0x014e('0x29')](_0x2050eb,_0x014e('0x26'));_0x46c1ff['query']=_[_0x014e('0x2f')](_0x24d9d3[_0x014e('0x30')]);_0x46c1ff[_0x014e('0x31')]=_[_0x014e('0x32')](_0x46c1ff[_0x014e('0x2e')],_0x46c1ff[_0x014e('0x30')]);_0x2ee9aa['attributes']=_[_0x014e('0x32')](_0x46c1ff[_0x014e('0x2e')],qs[_0x014e('0x33')](_0x24d9d3[_0x014e('0x30')][_0x014e('0x33')]));_0x2ee9aa[_0x014e('0x34')]=_0x2ee9aa[_0x014e('0x34')]['length']?_0x2ee9aa[_0x014e('0x34')]:_0x46c1ff[_0x014e('0x2e')];if(!_0x24d9d3[_0x014e('0x30')][_0x014e('0x35')](_0x014e('0x36'))){_0x2ee9aa[_0x014e('0x1c')]=qs[_0x014e('0x1c')](_0x24d9d3[_0x014e('0x30')]['limit']);_0x2ee9aa[_0x014e('0x1b')]=qs[_0x014e('0x1b')](_0x24d9d3[_0x014e('0x30')][_0x014e('0x1b')]);}_0x2ee9aa[_0x014e('0x37')]=qs[_0x014e('0x38')](_0x24d9d3[_0x014e('0x30')][_0x014e('0x38')]);_0x2ee9aa[_0x014e('0x39')]=qs[_0x014e('0x31')](_[_0x014e('0x3a')](_0x24d9d3[_0x014e('0x30')],_0x46c1ff[_0x014e('0x31')]),_0x2050eb);if(_0x24d9d3[_0x014e('0x30')][_0x014e('0x3b')]){_0x2ee9aa[_0x014e('0x39')]=_[_0x014e('0x3c')](_0x2ee9aa['where'],{'$or':_[_0x014e('0x29')](_0x2050eb,function(_0x21894d){if(_0x21894d[_0x014e('0x2c')]!=='VIRTUAL'){var _0x426f93={};_0x426f93[_0x21894d[_0x014e('0x26')]]={'$like':'%'+_0x24d9d3[_0x014e('0x30')]['filter']+'%'};return _0x426f93;}})});}_0x2ee9aa=_['merge']({},_0x2ee9aa,_0x24d9d3['options']);var _0xd54032={'where':_0x2ee9aa['where']};return db[_0x014e('0x2a')][_0x014e('0x1a')](_0xd54032)[_0x014e('0x24')](function(_0x223f94){_0x34e567[_0x014e('0x1a')]=_0x223f94;if(_0x24d9d3[_0x014e('0x30')][_0x014e('0x3d')]){_0x2ee9aa[_0x014e('0x3e')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x2ee9aa);})[_0x014e('0x24')](function(_0x1640c0){_0x34e567[_0x014e('0x3f')]=_0x1640c0;return _0x34e567;})['then'](respondWithFilteredResult(_0x2d3452,_0x2ee9aa))[_0x014e('0x40')](handleError(_0x2d3452,null));};exports[_0x014e('0x41')]=function(_0x58cc95,_0x111d91){var _0x265a74={'raw':!![],'where':{'id':_0x58cc95[_0x014e('0x42')]['id']}},_0x2a1f17={};_0x2a1f17[_0x014e('0x2e')]=_['keys'](db[_0x014e('0x2a')]['rawAttributes']);_0x2a1f17[_0x014e('0x30')]=_[_0x014e('0x2f')](_0x58cc95['query']);_0x2a1f17[_0x014e('0x31')]=_[_0x014e('0x32')](_0x2a1f17['model'],_0x2a1f17[_0x014e('0x30')]);_0x265a74['attributes']=_[_0x014e('0x32')](_0x2a1f17[_0x014e('0x2e')],qs['fields'](_0x58cc95['query']['fields']));_0x265a74[_0x014e('0x34')]=_0x265a74['attributes'][_0x014e('0x43')]?_0x265a74['attributes']:_0x2a1f17[_0x014e('0x2e')];if(_0x58cc95[_0x014e('0x30')][_0x014e('0x3d')]){_0x265a74[_0x014e('0x3e')]=[{'all':!![]}];}_0x265a74=_['merge']({},_0x265a74,_0x58cc95[_0x014e('0x44')]);return db[_0x014e('0x2a')][_0x014e('0x45')](_0x265a74)[_0x014e('0x24')](handleEntityNotFound(_0x111d91,null))['then'](respondWithResult(_0x111d91,null))[_0x014e('0x40')](handleError(_0x111d91,null));};exports['create']=function(_0x597340,_0x50a529){return db[_0x014e('0x2a')][_0x014e('0x46')](_0x597340[_0x014e('0x47')],{})[_0x014e('0x24')](respondWithResult(_0x50a529,0xc9))[_0x014e('0x40')](handleError(_0x50a529,null));};exports[_0x014e('0x23')]=function(_0x4cad7b,_0x35a9f){if(_0x4cad7b['body']['id']){delete _0x4cad7b[_0x014e('0x47')]['id'];}return db[_0x014e('0x2a')][_0x014e('0x45')]({'where':{'id':_0x4cad7b[_0x014e('0x42')]['id']}})[_0x014e('0x24')](handleEntityNotFound(_0x35a9f,null))[_0x014e('0x24')](saveUpdates(_0x4cad7b[_0x014e('0x47')],null))[_0x014e('0x24')](respondWithResult(_0x35a9f,null))[_0x014e('0x40')](handleError(_0x35a9f,null));};exports['destroy']=function(_0x473941,_0x1f7d62){return db['SquareMessage'][_0x014e('0x45')]({'where':{'id':_0x473941[_0x014e('0x42')]['id']}})[_0x014e('0x24')](handleEntityNotFound(_0x1f7d62,null))['then'](removeEntity(_0x1f7d62,null))[_0x014e('0x40')](handleError(_0x1f7d62,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 812070f..46d554f 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 _0x63e0=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x1c7f29,_0x291191){var _0x1c6c15=function(_0xcd4ba4){while(--_0xcd4ba4){_0x1c7f29['push'](_0x1c7f29['shift']());}};_0x1c6c15(++_0x291191);}(_0x63e0,0x1f3));var _0x063e=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x63e0[_0x5519a9];return _0x32f2cc;};'use strict';var _=require(_0x063e('0x0'));var util=require(_0x063e('0x1'));var logger=require(_0x063e('0x2'))(_0x063e('0x3'));var moment=require('moment');var BPromise=require(_0x063e('0x4'));var rp=require(_0x063e('0x5'));var fs=require('fs');var path=require(_0x063e('0x6'));var rimraf=require(_0x063e('0x7'));var config=require(_0x063e('0x8'));var attributes=require(_0x063e('0x9'));module[_0x063e('0xa')]=function(_0x33bfd8,_0x540267){return _0x33bfd8[_0x063e('0xb')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x431d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages','util'];(function(_0x22ad2d,_0x5172c6){var _0x5638f8=function(_0x3d5d5f){while(--_0x3d5d5f){_0x22ad2d['push'](_0x22ad2d['shift']());}};_0x5638f8(++_0x5172c6);}(_0x431d,0x19f));var _0xd431=function(_0x1417c6,_0x194309){_0x1417c6=_0x1417c6-0x0;var _0x44db97=_0x431d[_0x1417c6];return _0x44db97;};'use strict';var _=require('lodash');var util=require(_0xd431('0x0'));var logger=require(_0xd431('0x1'))(_0xd431('0x2'));var moment=require(_0xd431('0x3'));var BPromise=require(_0xd431('0x4'));var rp=require(_0xd431('0x5'));var fs=require('fs');var path=require(_0xd431('0x6'));var rimraf=require(_0xd431('0x7'));var config=require('../../config/environment');var attributes=require(_0xd431('0x8'));module[_0xd431('0x9')]=function(_0x41b33a,_0x10ba41){return _0x41b33a[_0xd431('0xa')](_0xd431('0xb'),attributes,{'tableName':_0xd431('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 2835cef..a68c782 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0xaacdfa,_0x2213da){var _0x52e58f=function(_0xbfccc5){while(--_0xbfccc5){_0xaacdfa['push'](_0xaacdfa['shift']());}};_0x52e58f(++_0x2213da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x41db72,_0x3bb8ff){var _0x1f1620=function(_0x424e7f){while(--_0x424e7f){_0x41db72['push'](_0x41db72['shift']());}};_0x1f1620(++_0x3bb8ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 8a46616..1a7317c 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 _0xac3f=['multer','util','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','isAuthenticated','show','/:id/test','15s','test','post','/:id','update','delete','exports'];(function(_0x1d043b,_0x14ea5a){var _0x36bfd0=function(_0x4ab1c0){while(--_0x4ab1c0){_0x1d043b['push'](_0x1d043b['shift']());}};_0x36bfd0(++_0x14ea5a);}(_0xac3f,0x98));var _0xfac3=function(_0x2b3478,_0x58afd7){_0x2b3478=_0x2b3478-0x0;var _0x1c106f=_0xac3f[_0x2b3478];return _0x1c106f;};'use strict';var multer=require(_0xfac3('0x0'));var util=require(_0xfac3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfac3('0x2'));var router=express[_0xfac3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfac3('0x4'));var config=require(_0xfac3('0x5'));var controller=require(_0xfac3('0x6'));router[_0xfac3('0x7')]('/',auth['isAuthenticated'](),controller[_0xfac3('0x8')]);router[_0xfac3('0x7')]('/:id',auth[_0xfac3('0x9')](),controller[_0xfac3('0xa')]);router[_0xfac3('0x7')](_0xfac3('0xb'),auth[_0xfac3('0x9')](),timeout(_0xfac3('0xc')),controller[_0xfac3('0xd')]);router[_0xfac3('0xe')]('/',auth[_0xfac3('0x9')](),controller['create']);router['put'](_0xfac3('0xf'),auth[_0xfac3('0x9')](),controller[_0xfac3('0x10')]);router[_0xfac3('0x11')](_0xfac3('0xf'),auth[_0xfac3('0x9')](),controller['destroy']);module[_0xfac3('0x12')]=router; \ No newline at end of file +var _0xfdaa=['/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','/:id/test','test','post','create','put'];(function(_0x1a232b,_0x43a48d){var _0x1ff2bf=function(_0x376f51){while(--_0x376f51){_0x1a232b['push'](_0x1a232b['shift']());}};_0x1ff2bf(++_0x43a48d);}(_0xfdaa,0x12a));var _0xafda=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0xfdaa[_0x19efbc];return _0x205c5e;};'use strict';var multer=require(_0xafda('0x0'));var util=require('util');var path=require(_0xafda('0x1'));var timeout=require(_0xafda('0x2'));var express=require(_0xafda('0x3'));var router=express[_0xafda('0x4')]();var auth=require(_0xafda('0x5'));var interaction=require(_0xafda('0x6'));var config=require(_0xafda('0x7'));var controller=require('./squareOdbc.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xafda('0x8')]);router[_0xafda('0x9')]('/:id',auth[_0xafda('0xa')](),controller[_0xafda('0xb')]);router[_0xafda('0x9')](_0xafda('0xc'),auth[_0xafda('0xa')](),timeout('15s'),controller[_0xafda('0xd')]);router[_0xafda('0xe')]('/',auth[_0xafda('0xa')](),controller[_0xafda('0xf')]);router[_0xafda('0x10')](_0xafda('0x11'),auth[_0xafda('0xa')](),controller[_0xafda('0x12')]);router[_0xafda('0x13')]('/:id',auth[_0xafda('0xa')](),controller['destroy']);module[_0xafda('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index a453a31..1644796 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 _0xa90b=['STRING','sequelize','exports'];(function(_0x56a216,_0x1995d9){var _0x21f8b5=function(_0x507dcb){while(--_0x507dcb){_0x56a216['push'](_0x56a216['shift']());}};_0x21f8b5(++_0x1995d9);}(_0xa90b,0x19c));var _0xba90=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0xa90b[_0x31a938];return _0x1bf341;};'use strict';var Sequelize=require(_0xba90('0x0'));module[_0xba90('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba90('0x2')]}}; \ No newline at end of file +var _0x8eac=['name','STRING'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x8eac,0x121));var _0xc8ea=function(_0x17fd72,_0x2b8254){_0x17fd72=_0x17fd72-0x0;var _0xa8d8c6=_0x8eac[_0x17fd72];return _0xa8d8c6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc8ea('0x0')],'unique':_0xc8ea('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xc8ea('0x0')]},'description':{'type':Sequelize[_0xc8ea('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 46e961a..4327c08 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 _0x2be9=['fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','filters','include','find','create','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','then','get','ODBC','UserProfileResource','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','model','query','intersection'];(function(_0x3a2797,_0x1f905c){var _0x5c2d96=function(_0x3c7bd7){while(--_0x3c7bd7){_0x3a2797['push'](_0x3a2797['shift']());}};_0x5c2d96(++_0x1f905c);}(_0x2be9,0x6f));var _0x92be=function(_0x4df337,_0x3bf41d){_0x4df337=_0x4df337-0x0;var _0x4a1c4e=_0x2be9[_0x4df337];return _0x4a1c4e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x92be('0x0'));var rimraf=require(_0x92be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x92be('0x2'));var rp=require(_0x92be('0x3'));var moment=require(_0x92be('0x4'));var BPromise=require(_0x92be('0x5'));var Mustache=require(_0x92be('0x6'));var util=require(_0x92be('0x7'));var path=require(_0x92be('0x8'));var sox=require(_0x92be('0x9'));var csv=require(_0x92be('0xa'));var ejs=require(_0x92be('0xb'));var fs=require('fs');var _=require(_0x92be('0xc'));var squel=require('squel');var crypto=require(_0x92be('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x92be('0xe'));var toCsv=require(_0x92be('0xa'));var querystring=require(_0x92be('0xf'));var Papa=require(_0x92be('0x10'));var Redis=require(_0x92be('0x11'));var authService=require(_0x92be('0x12'));var qs=require(_0x92be('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x92be('0x14'));var logger=require(_0x92be('0x15'))('api');var utils=require(_0x92be('0x16'));var config=require(_0x92be('0x17'));var licenseUtil=require(_0x92be('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24051f,_0xd6ee51){_0xd6ee51=_0xd6ee51||0xcc;return function(_0x288859){if(_0x288859){return _0x24051f[_0x92be('0x19')](_0xd6ee51);}return _0x24051f[_0x92be('0x1a')](_0xd6ee51)[_0x92be('0x1b')]();};}function respondWithResult(_0x2a9c71,_0x2f0e84){_0x2f0e84=_0x2f0e84||0xc8;return function(_0x518af2){if(_0x518af2){return _0x2a9c71['status'](_0x2f0e84)[_0x92be('0x1c')](_0x518af2);}};}function respondWithFilteredResult(_0x271406,_0x1306f7){return function(_0x50d0ad){if(_0x50d0ad){var _0x56563a=_0x50d0ad[_0x92be('0x1d')],_0x469434=_0x1306f7[_0x92be('0x1e')],_0x1aa270=_0x1306f7[_0x92be('0x1e')]+_0x1306f7[_0x92be('0x1f')],_0x545476;if(_0x1aa270>=_0x56563a){_0x1aa270=_0x56563a;_0x545476=0xc8;}else{_0x545476=0xce;}_0x271406[_0x92be('0x1a')](_0x545476);return _0x271406['set']('Content-Range',_0x469434+'-'+_0x1aa270+'/'+_0x56563a)[_0x92be('0x1c')](_0x50d0ad);}return null;};}function patchUpdates(_0x35a5e2){return function(_0x293651){try{jsonpatch[_0x92be('0x20')](_0x293651,_0x35a5e2,!![]);}catch(_0xbc85ec){return BPromise[_0x92be('0x21')](_0xbc85ec);}return _0x293651[_0x92be('0x22')]();};}function saveUpdates(_0x2ca312,_0x1b8192){return function(_0x444aad){if(_0x444aad){return _0x444aad[_0x92be('0x23')](_0x2ca312)['then'](function(_0x2ed781){return _0x2ed781;});}return null;};}function removeEntity(_0x149a17,_0x55ee77){return function(_0x1d54f0){if(_0x1d54f0){return _0x1d54f0[_0x92be('0x24')]()[_0x92be('0x25')](function(){var _0x3fa9c3=_0x1d54f0[_0x92be('0x26')]({'plain':!![]});var _0x5b62b7=_0x92be('0x27');return db[_0x92be('0x28')][_0x92be('0x24')]({'where':{'type':_0x5b62b7,'resourceId':_0x3fa9c3['id']}})[_0x92be('0x25')](function(){return _0x1d54f0;});})[_0x92be('0x25')](function(){_0x149a17[_0x92be('0x1a')](0xcc)[_0x92be('0x1b')]();});}};}function handleEntityNotFound(_0x13197a,_0x14269c){return function(_0x1554ac){if(!_0x1554ac){_0x13197a[_0x92be('0x19')](0x194);}return _0x1554ac;};}function handleError(_0x38911b,_0x3c0bd7){_0x3c0bd7=_0x3c0bd7||0x1f4;return function(_0x46b2bc){logger[_0x92be('0x29')](_0x46b2bc[_0x92be('0x2a')]);if(_0x46b2bc['name']){delete _0x46b2bc[_0x92be('0x2b')];}_0x38911b[_0x92be('0x1a')](_0x3c0bd7)[_0x92be('0x2c')](_0x46b2bc);};}exports['index']=function(_0x1b44e6,_0x32cc21){var _0x4ff56c={},_0x1d5514={},_0x20c08b={'count':0x0,'rows':[]};var _0x1b7d5c=_[_0x92be('0x2d')](db[_0x92be('0x2e')][_0x92be('0x2f')],function(_0x5d98ec){return{'name':_0x5d98ec[_0x92be('0x30')],'type':_0x5d98ec[_0x92be('0x31')]['key']};});_0x1d5514[_0x92be('0x32')]=_[_0x92be('0x2d')](_0x1b7d5c,_0x92be('0x2b'));_0x1d5514[_0x92be('0x33')]=_['keys'](_0x1b44e6[_0x92be('0x33')]);_0x1d5514['filters']=_['intersection'](_0x1d5514[_0x92be('0x32')],_0x1d5514[_0x92be('0x33')]);_0x4ff56c['attributes']=_[_0x92be('0x34')](_0x1d5514['model'],qs[_0x92be('0x35')](_0x1b44e6[_0x92be('0x33')][_0x92be('0x35')]));_0x4ff56c[_0x92be('0x36')]=_0x4ff56c[_0x92be('0x36')][_0x92be('0x37')]?_0x4ff56c[_0x92be('0x36')]:_0x1d5514['model'];if(!_0x1b44e6['query']['hasOwnProperty'](_0x92be('0x38'))){_0x4ff56c[_0x92be('0x1f')]=qs[_0x92be('0x1f')](_0x1b44e6['query'][_0x92be('0x1f')]);_0x4ff56c['offset']=qs[_0x92be('0x1e')](_0x1b44e6[_0x92be('0x33')][_0x92be('0x1e')]);}_0x4ff56c['order']=qs[_0x92be('0x39')](_0x1b44e6[_0x92be('0x33')][_0x92be('0x39')]);_0x4ff56c[_0x92be('0x3a')]=qs['filters'](_[_0x92be('0x3b')](_0x1b44e6[_0x92be('0x33')],_0x1d5514['filters']),_0x1b7d5c);if(_0x1b44e6[_0x92be('0x33')][_0x92be('0x3c')]){_0x4ff56c[_0x92be('0x3a')]=_[_0x92be('0x3d')](_0x4ff56c['where'],{'$or':_[_0x92be('0x2d')](_0x1b7d5c,function(_0x199466){if(_0x199466['type']!==_0x92be('0x3e')){var _0x111ce7={};_0x111ce7[_0x199466[_0x92be('0x2b')]]={'$like':'%'+_0x1b44e6[_0x92be('0x33')]['filter']+'%'};return _0x111ce7;}})});}_0x4ff56c=_[_0x92be('0x3d')]({},_0x4ff56c,_0x1b44e6[_0x92be('0x3f')]);var _0x42085d={'where':_0x4ff56c[_0x92be('0x3a')]};return db[_0x92be('0x2e')][_0x92be('0x1d')](_0x42085d)[_0x92be('0x25')](function(_0x1a3513){_0x20c08b[_0x92be('0x1d')]=_0x1a3513;if(_0x1b44e6[_0x92be('0x33')]['includeAll']){_0x4ff56c['include']=[{'all':!![]}];}return db[_0x92be('0x2e')][_0x92be('0x40')](_0x4ff56c);})[_0x92be('0x25')](function(_0x4fac70){_0x20c08b[_0x92be('0x41')]=_0x4fac70;return _0x20c08b;})[_0x92be('0x25')](respondWithFilteredResult(_0x32cc21,_0x4ff56c))[_0x92be('0x42')](handleError(_0x32cc21,null));};exports[_0x92be('0x43')]=function(_0x68cdf1,_0x37d3c8){var _0x2e789b={'raw':!![],'where':{'id':_0x68cdf1[_0x92be('0x44')]['id']}},_0x5e8fc1={};_0x5e8fc1[_0x92be('0x32')]=_['keys'](db[_0x92be('0x2e')][_0x92be('0x2f')]);_0x5e8fc1['query']=_[_0x92be('0x45')](_0x68cdf1[_0x92be('0x33')]);_0x5e8fc1[_0x92be('0x46')]=_[_0x92be('0x34')](_0x5e8fc1[_0x92be('0x32')],_0x5e8fc1[_0x92be('0x33')]);_0x2e789b['attributes']=_[_0x92be('0x34')](_0x5e8fc1[_0x92be('0x32')],qs[_0x92be('0x35')](_0x68cdf1[_0x92be('0x33')]['fields']));_0x2e789b['attributes']=_0x2e789b[_0x92be('0x36')][_0x92be('0x37')]?_0x2e789b['attributes']:_0x5e8fc1[_0x92be('0x32')];if(_0x68cdf1[_0x92be('0x33')]['includeAll']){_0x2e789b[_0x92be('0x47')]=[{'all':!![]}];}_0x2e789b=_[_0x92be('0x3d')]({},_0x2e789b,_0x68cdf1[_0x92be('0x3f')]);return db[_0x92be('0x2e')][_0x92be('0x48')](_0x2e789b)[_0x92be('0x25')](handleEntityNotFound(_0x37d3c8,null))[_0x92be('0x25')](respondWithResult(_0x37d3c8,null))[_0x92be('0x42')](handleError(_0x37d3c8,null));};exports[_0x92be('0x49')]=function(_0x20cdcf,_0x5399e8){return db[_0x92be('0x2e')][_0x92be('0x49')](_0x20cdcf['body'],{})[_0x92be('0x25')](function(_0x44a2df){var _0x3f7b3f=_0x20cdcf[_0x92be('0x4a')][_0x92be('0x26')]({'plain':!![]});if(!_0x3f7b3f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f7b3f[_0x92be('0x4b')]===_0x92be('0x4a')){var _0x378aba=_0x44a2df['get']({'plain':!![]});var _0x186955=_0x92be('0x27');return db['UserProfileSection'][_0x92be('0x48')]({'where':{'name':_0x186955,'userProfileId':_0x3f7b3f[_0x92be('0x4c')]},'raw':!![]})[_0x92be('0x25')](function(_0x5e154f){if(_0x5e154f&&_0x5e154f['autoAssociation']===0x0){return db[_0x92be('0x28')]['create']({'name':_0x378aba['name'],'resourceId':_0x378aba['id'],'type':_0x5e154f[_0x92be('0x2b')],'sectionId':_0x5e154f['id']},{})['then'](function(){return _0x44a2df;});}else{return _0x44a2df;}})[_0x92be('0x42')](function(_0x2b9cea){logger['error'](_0x92be('0x4d'),_0x2b9cea);throw _0x2b9cea;});}return _0x44a2df;})[_0x92be('0x25')](respondWithResult(_0x5399e8,0xc9))[_0x92be('0x42')](handleError(_0x5399e8,null));};exports[_0x92be('0x23')]=function(_0x227aed,_0x24b802){if(_0x227aed[_0x92be('0x4e')]['id']){delete _0x227aed[_0x92be('0x4e')]['id'];}return db[_0x92be('0x2e')]['find']({'where':{'id':_0x227aed[_0x92be('0x44')]['id']}})[_0x92be('0x25')](handleEntityNotFound(_0x24b802,null))[_0x92be('0x25')](saveUpdates(_0x227aed[_0x92be('0x4e')],null))[_0x92be('0x25')](respondWithResult(_0x24b802,null))['catch'](handleError(_0x24b802,null));};exports[_0x92be('0x24')]=function(_0x3ec082,_0x3e2c24){return db[_0x92be('0x2e')]['find']({'where':{'id':_0x3ec082[_0x92be('0x44')]['id']}})[_0x92be('0x25')](handleEntityNotFound(_0x3e2c24,null))[_0x92be('0x25')](removeEntity(_0x3e2c24,null))[_0x92be('0x42')](handleError(_0x3e2c24,null));};exports[_0x92be('0x4f')]=function(_0x44932b,_0x5eebe5,_0x1189c0){var _0x264a6d;return db[_0x92be('0x2e')][_0x92be('0x48')]({'where':{'id':_0x44932b[_0x92be('0x44')]['id']},'attributes':['id',_0x92be('0x50')]})[_0x92be('0x25')](handleEntityNotFound(_0x5eebe5,null))['then'](function(_0x1d4354){if(_0x1d4354){var _0x28fc8c=require('odbc')();_0x28fc8c['openSync'](_0x1d4354[_0x92be('0x50')]);_0x28fc8c[_0x92be('0x51')]();return _0x1d4354;}})[_0x92be('0x25')](respondWithResult(_0x5eebe5,null))[_0x92be('0x42')](handleError(_0x5eebe5,null));}; \ No newline at end of file +var _0xe263=['api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','reject','save','update','then','ODBC','UserProfileResource','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','options','count','include','rows','catch','show','params','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','destroy','dsn','odbc','openSync','closeSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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'];(function(_0x4c3fbb,_0x6fce04){var _0x2e7b3b=function(_0x423537){while(--_0x423537){_0x4c3fbb['push'](_0x4c3fbb['shift']());}};_0x2e7b3b(++_0x6fce04);}(_0xe263,0x92));var _0x3e26=function(_0x76dc4f,_0x5018f9){_0x76dc4f=_0x76dc4f-0x0;var _0x357c86=_0xe263[_0x76dc4f];return _0x357c86;};'use strict';var pdf=require(_0x3e26('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3e26('0x1'));var zipdir=require(_0x3e26('0x2'));var jsonpatch=require(_0x3e26('0x3'));var rp=require(_0x3e26('0x4'));var moment=require(_0x3e26('0x5'));var BPromise=require(_0x3e26('0x6'));var Mustache=require(_0x3e26('0x7'));var util=require(_0x3e26('0x8'));var path=require('path');var sox=require(_0x3e26('0x9'));var csv=require(_0x3e26('0xa'));var ejs=require(_0x3e26('0xb'));var fs=require('fs');var _=require(_0x3e26('0xc'));var squel=require(_0x3e26('0xd'));var crypto=require('crypto');var jsforce=require(_0x3e26('0xe'));var deskjs=require(_0x3e26('0xf'));var toCsv=require(_0x3e26('0xa'));var querystring=require(_0x3e26('0x10'));var Papa=require(_0x3e26('0x11'));var Redis=require(_0x3e26('0x12'));var authService=require(_0x3e26('0x13'));var qs=require(_0x3e26('0x14'));var as=require(_0x3e26('0x15'));var hardwareService=require(_0x3e26('0x16'));var logger=require(_0x3e26('0x17'))(_0x3e26('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3e26('0x19'));var db=require(_0x3e26('0x1a'))['db'];function respondWithStatusCode(_0x169715,_0x36065d){_0x36065d=_0x36065d||0xcc;return function(_0x18903a){if(_0x18903a){return _0x169715[_0x3e26('0x1b')](_0x36065d);}return _0x169715['status'](_0x36065d)[_0x3e26('0x1c')]();};}function respondWithResult(_0xfd9db9,_0xe04371){_0xe04371=_0xe04371||0xc8;return function(_0x184b73){if(_0x184b73){return _0xfd9db9[_0x3e26('0x1d')](_0xe04371)['json'](_0x184b73);}};}function respondWithFilteredResult(_0x318fe3,_0x45d4f8){return function(_0x2b15cb){if(_0x2b15cb){var _0x5f338e=_0x2b15cb['count'],_0x48e188=_0x45d4f8[_0x3e26('0x1e')],_0x5b03d0=_0x45d4f8[_0x3e26('0x1e')]+_0x45d4f8[_0x3e26('0x1f')],_0x291d8a;if(_0x5b03d0>=_0x5f338e){_0x5b03d0=_0x5f338e;_0x291d8a=0xc8;}else{_0x291d8a=0xce;}_0x318fe3['status'](_0x291d8a);return _0x318fe3[_0x3e26('0x20')](_0x3e26('0x21'),_0x48e188+'-'+_0x5b03d0+'/'+_0x5f338e)['json'](_0x2b15cb);}return null;};}function patchUpdates(_0x463a0d){return function(_0x59b2ad){try{jsonpatch['apply'](_0x59b2ad,_0x463a0d,!![]);}catch(_0xca6398){return BPromise[_0x3e26('0x22')](_0xca6398);}return _0x59b2ad[_0x3e26('0x23')]();};}function saveUpdates(_0x32adc2,_0x5d2ad2){return function(_0x5b5197){if(_0x5b5197){return _0x5b5197[_0x3e26('0x24')](_0x32adc2)[_0x3e26('0x25')](function(_0x5348c3){return _0x5348c3;});}return null;};}function removeEntity(_0x33803a,_0x305ae5){return function(_0x164752){if(_0x164752){return _0x164752['destroy']()['then'](function(){var _0x1b46d4=_0x164752['get']({'plain':!![]});var _0x57b66e=_0x3e26('0x26');return db[_0x3e26('0x27')]['destroy']({'where':{'type':_0x57b66e,'resourceId':_0x1b46d4['id']}})[_0x3e26('0x25')](function(){return _0x164752;});})[_0x3e26('0x25')](function(){_0x33803a[_0x3e26('0x1d')](0xcc)[_0x3e26('0x1c')]();});}};}function handleEntityNotFound(_0x2d2156,_0x3f55e9){return function(_0x1ad477){if(!_0x1ad477){_0x2d2156[_0x3e26('0x1b')](0x194);}return _0x1ad477;};}function handleError(_0x216c8a,_0x80a111){_0x80a111=_0x80a111||0x1f4;return function(_0x129742){logger[_0x3e26('0x28')](_0x129742['stack']);if(_0x129742[_0x3e26('0x29')]){delete _0x129742[_0x3e26('0x29')];}_0x216c8a[_0x3e26('0x1d')](_0x80a111)[_0x3e26('0x2a')](_0x129742);};}exports[_0x3e26('0x2b')]=function(_0x55f90e,_0x3399f0){var _0x409ea6={},_0x1fbecc={},_0x4b674b={'count':0x0,'rows':[]};var _0x5858b3=_[_0x3e26('0x2c')](db[_0x3e26('0x2d')][_0x3e26('0x2e')],function(_0x15b1cf){return{'name':_0x15b1cf[_0x3e26('0x2f')],'type':_0x15b1cf['type'][_0x3e26('0x30')]};});_0x1fbecc[_0x3e26('0x31')]=_[_0x3e26('0x2c')](_0x5858b3,_0x3e26('0x29'));_0x1fbecc[_0x3e26('0x32')]=_[_0x3e26('0x33')](_0x55f90e[_0x3e26('0x32')]);_0x1fbecc[_0x3e26('0x34')]=_[_0x3e26('0x35')](_0x1fbecc[_0x3e26('0x31')],_0x1fbecc[_0x3e26('0x32')]);_0x409ea6['attributes']=_[_0x3e26('0x35')](_0x1fbecc[_0x3e26('0x31')],qs[_0x3e26('0x36')](_0x55f90e[_0x3e26('0x32')][_0x3e26('0x36')]));_0x409ea6['attributes']=_0x409ea6[_0x3e26('0x37')][_0x3e26('0x38')]?_0x409ea6[_0x3e26('0x37')]:_0x1fbecc[_0x3e26('0x31')];if(!_0x55f90e[_0x3e26('0x32')]['hasOwnProperty']('nolimit')){_0x409ea6[_0x3e26('0x1f')]=qs['limit'](_0x55f90e[_0x3e26('0x32')][_0x3e26('0x1f')]);_0x409ea6['offset']=qs[_0x3e26('0x1e')](_0x55f90e[_0x3e26('0x32')][_0x3e26('0x1e')]);}_0x409ea6[_0x3e26('0x39')]=qs[_0x3e26('0x3a')](_0x55f90e[_0x3e26('0x32')][_0x3e26('0x3a')]);_0x409ea6[_0x3e26('0x3b')]=qs['filters'](_['pick'](_0x55f90e['query'],_0x1fbecc[_0x3e26('0x34')]),_0x5858b3);if(_0x55f90e[_0x3e26('0x32')][_0x3e26('0x3c')]){_0x409ea6['where']=_['merge'](_0x409ea6['where'],{'$or':_[_0x3e26('0x2c')](_0x5858b3,function(_0x269d0a){if(_0x269d0a['type']!=='VIRTUAL'){var _0x153b15={};_0x153b15[_0x269d0a[_0x3e26('0x29')]]={'$like':'%'+_0x55f90e['query'][_0x3e26('0x3c')]+'%'};return _0x153b15;}})});}_0x409ea6=_[_0x3e26('0x3d')]({},_0x409ea6,_0x55f90e[_0x3e26('0x3e')]);var _0x4ca0a8={'where':_0x409ea6[_0x3e26('0x3b')]};return db[_0x3e26('0x2d')]['count'](_0x4ca0a8)[_0x3e26('0x25')](function(_0x2bab12){_0x4b674b[_0x3e26('0x3f')]=_0x2bab12;if(_0x55f90e['query']['includeAll']){_0x409ea6[_0x3e26('0x40')]=[{'all':!![]}];}return db[_0x3e26('0x2d')]['findAll'](_0x409ea6);})[_0x3e26('0x25')](function(_0x115fcf){_0x4b674b[_0x3e26('0x41')]=_0x115fcf;return _0x4b674b;})[_0x3e26('0x25')](respondWithFilteredResult(_0x3399f0,_0x409ea6))[_0x3e26('0x42')](handleError(_0x3399f0,null));};exports[_0x3e26('0x43')]=function(_0x363fb6,_0x283ccf){var _0x414b9a={'raw':!![],'where':{'id':_0x363fb6[_0x3e26('0x44')]['id']}},_0x2a2bb7={};_0x2a2bb7[_0x3e26('0x31')]=_[_0x3e26('0x33')](db[_0x3e26('0x2d')][_0x3e26('0x2e')]);_0x2a2bb7['query']=_[_0x3e26('0x33')](_0x363fb6[_0x3e26('0x32')]);_0x2a2bb7['filters']=_['intersection'](_0x2a2bb7[_0x3e26('0x31')],_0x2a2bb7['query']);_0x414b9a[_0x3e26('0x37')]=_[_0x3e26('0x35')](_0x2a2bb7['model'],qs[_0x3e26('0x36')](_0x363fb6['query']['fields']));_0x414b9a[_0x3e26('0x37')]=_0x414b9a[_0x3e26('0x37')][_0x3e26('0x38')]?_0x414b9a[_0x3e26('0x37')]:_0x2a2bb7['model'];if(_0x363fb6[_0x3e26('0x32')][_0x3e26('0x45')]){_0x414b9a[_0x3e26('0x40')]=[{'all':!![]}];}_0x414b9a=_[_0x3e26('0x3d')]({},_0x414b9a,_0x363fb6['options']);return db[_0x3e26('0x2d')][_0x3e26('0x46')](_0x414b9a)[_0x3e26('0x25')](handleEntityNotFound(_0x283ccf,null))[_0x3e26('0x25')](respondWithResult(_0x283ccf,null))['catch'](handleError(_0x283ccf,null));};exports['create']=function(_0x242043,_0x36f0bf){return db[_0x3e26('0x2d')][_0x3e26('0x47')](_0x242043[_0x3e26('0x48')],{})[_0x3e26('0x25')](function(_0x2911dd){var _0x2c344a=_0x242043['user'][_0x3e26('0x49')]({'plain':!![]});if(!_0x2c344a)throw new Error(_0x3e26('0x4a'));if(_0x2c344a[_0x3e26('0x4b')]===_0x3e26('0x4c')){var _0x40e9df=_0x2911dd['get']({'plain':!![]});var _0x4816a9=_0x3e26('0x26');return db[_0x3e26('0x4d')][_0x3e26('0x46')]({'where':{'name':_0x4816a9,'userProfileId':_0x2c344a[_0x3e26('0x4e')]},'raw':!![]})['then'](function(_0x33c50d){if(_0x33c50d&&_0x33c50d[_0x3e26('0x4f')]===0x0){return db[_0x3e26('0x27')][_0x3e26('0x47')]({'name':_0x40e9df[_0x3e26('0x29')],'resourceId':_0x40e9df['id'],'type':_0x33c50d[_0x3e26('0x29')],'sectionId':_0x33c50d['id']},{})['then'](function(){return _0x2911dd;});}else{return _0x2911dd;}})[_0x3e26('0x42')](function(_0x1ecf2a){logger[_0x3e26('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ecf2a);throw _0x1ecf2a;});}return _0x2911dd;})['then'](respondWithResult(_0x36f0bf,0xc9))['catch'](handleError(_0x36f0bf,null));};exports[_0x3e26('0x24')]=function(_0x3c650c,_0x5948e9){if(_0x3c650c['body']['id']){delete _0x3c650c[_0x3e26('0x48')]['id'];}return db[_0x3e26('0x2d')]['find']({'where':{'id':_0x3c650c[_0x3e26('0x44')]['id']}})[_0x3e26('0x25')](handleEntityNotFound(_0x5948e9,null))[_0x3e26('0x25')](saveUpdates(_0x3c650c['body'],null))[_0x3e26('0x25')](respondWithResult(_0x5948e9,null))['catch'](handleError(_0x5948e9,null));};exports[_0x3e26('0x50')]=function(_0x2c8e26,_0x1af618){return db[_0x3e26('0x2d')][_0x3e26('0x46')]({'where':{'id':_0x2c8e26['params']['id']}})[_0x3e26('0x25')](handleEntityNotFound(_0x1af618,null))['then'](removeEntity(_0x1af618,null))[_0x3e26('0x42')](handleError(_0x1af618,null));};exports['test']=function(_0x3e63d1,_0x1f4f85,_0xa24df1){var _0x45a5ad;return db['SquareOdbc'][_0x3e26('0x46')]({'where':{'id':_0x3e63d1[_0x3e26('0x44')]['id']},'attributes':['id',_0x3e26('0x51')]})[_0x3e26('0x25')](handleEntityNotFound(_0x1f4f85,null))[_0x3e26('0x25')](function(_0x109edf){if(_0x109edf){var _0x7e3052=require(_0x3e26('0x52'))();_0x7e3052[_0x3e26('0x53')](_0x109edf[_0x3e26('0x51')]);_0x7e3052[_0x3e26('0x54')]();return _0x109edf;}})[_0x3e26('0x25')](respondWithResult(_0x1f4f85,null))[_0x3e26('0x42')](handleError(_0x1f4f85,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 3ac06eb..f701ed0 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 _0x21ad=['square_odbc','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x4a1950,_0x102e99){var _0x5280b7=function(_0x1a80d2){while(--_0x1a80d2){_0x4a1950['push'](_0x4a1950['shift']());}};_0x5280b7(++_0x102e99);}(_0x21ad,0x85));var _0xd21a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x21ad[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xd21a('0x0'));var util=require('util');var logger=require(_0xd21a('0x1'))(_0xd21a('0x2'));var moment=require(_0xd21a('0x3'));var BPromise=require('bluebird');var rp=require(_0xd21a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd21a('0x5'));var attributes=require(_0xd21a('0x6'));module[_0xd21a('0x7')]=function(_0x3acbc0,_0x5b378b){return _0x3acbc0[_0xd21a('0x8')](_0xd21a('0x9'),attributes,{'tableName':_0xd21a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71f4=['api','moment','bluebird','request-promise','rimraf','./squareOdbc.attributes','define','SquareOdbc','square_odbc','../../config/logger'];(function(_0x681b4f,_0x4022c0){var _0x8d820a=function(_0x539b51){while(--_0x539b51){_0x681b4f['push'](_0x681b4f['shift']());}};_0x8d820a(++_0x4022c0);}(_0x71f4,0xf9));var _0x471f=function(_0x4cf8ca,_0x3ae663){_0x4cf8ca=_0x4cf8ca-0x0;var _0x23de49=_0x71f4[_0x4cf8ca];return _0x23de49;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x471f('0x0'))(_0x471f('0x1'));var moment=require(_0x471f('0x2'));var BPromise=require(_0x471f('0x3'));var rp=require(_0x471f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x471f('0x5'));var config=require('../../config/environment');var attributes=require(_0x471f('0x6'));module['exports']=function(_0x1d0101,_0x3bdf82){return _0x1d0101[_0x471f('0x7')](_0x471f('0x8'),attributes,{'tableName':_0x471f('0x9'),'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 3ccd7a2..dd6c6ee 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 _0x9957=['stringify','error','code','message','result','catch','ShowSquareOdbc','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x2f5168,_0xab6fcf){var _0x5ee402=function(_0x5e0f0a){while(--_0x5e0f0a){_0x2f5168['push'](_0x2f5168['shift']());}};_0x5ee402(++_0xab6fcf);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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']('SquareOdbc,\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['SquareOdbc'][_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,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowSquareOdbc',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x5b474c,_0x426d87){var _0x273b2c=function(_0x2a3fcf){while(--_0x2a3fcf){_0x5b474c['push'](_0x5b474c['shift']());}};_0x273b2c(++_0x426d87);}(_0xe14b,0x93));var _0xbe14=function(_0x172153,_0xa788dc){_0x172153=_0x172153-0x0;var _0x3bede0=_0xe14b[_0x172153];return _0x3bede0;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 843cf01..6835ba5 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 _0xa048=['get','/:id/users','getUsers','create','post','put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','/:id','show'];(function(_0x51f4fc,_0x1fe3ef){var _0x4d96fc=function(_0xddc9){while(--_0xddc9){_0x51f4fc['push'](_0x51f4fc['shift']());}};_0x4d96fc(++_0x1fe3ef);}(_0xa048,0x11e));var _0x8a04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa048[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8a04('0x0'));var util=require(_0x8a04('0x1'));var path=require(_0x8a04('0x2'));var timeout=require(_0x8a04('0x3'));var express=require(_0x8a04('0x4'));var router=express[_0x8a04('0x5')]();var auth=require(_0x8a04('0x6'));var interaction=require(_0x8a04('0x7'));var config=require(_0x8a04('0x8'));var controller=require(_0x8a04('0x9'));router['get']('/',auth[_0x8a04('0xa')](),controller[_0x8a04('0xb')]);router['get'](_0x8a04('0xc'),auth[_0x8a04('0xa')](),controller[_0x8a04('0xd')]);router[_0x8a04('0xe')](_0x8a04('0xf'),auth[_0x8a04('0xa')](),controller[_0x8a04('0x10')]);router['post']('/',auth[_0x8a04('0xa')](),controller[_0x8a04('0x11')]);router[_0x8a04('0x12')](_0x8a04('0xf'),auth[_0x8a04('0xa')](),controller['addUsers']);router[_0x8a04('0x13')](_0x8a04('0xc'),auth[_0x8a04('0xa')](),controller[_0x8a04('0x14')]);router[_0x8a04('0x15')](_0x8a04('0xc'),auth[_0x8a04('0xa')](),controller[_0x8a04('0x16')]);router['delete']('/:id/users',auth[_0x8a04('0xa')](),controller[_0x8a04('0x17')]);module[_0x8a04('0x18')]=router; \ No newline at end of file +var _0x0aa5=['connect-timeout','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','/:id','isAuthenticated','show','/:id/users','getUsers','post','create','put','update','delete','removeUsers','exports','multer','path'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x0aa5,0xe2));var _0x50aa=function(_0x4b7fa8,_0x2207d3){_0x4b7fa8=_0x4b7fa8-0x0;var _0x454a66=_0x0aa5[_0x4b7fa8];return _0x454a66;};'use strict';var multer=require(_0x50aa('0x0'));var util=require('util');var path=require(_0x50aa('0x1'));var timeout=require(_0x50aa('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x50aa('0x3'));var interaction=require(_0x50aa('0x4'));var config=require('../../config/environment');var controller=require(_0x50aa('0x5'));router[_0x50aa('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50aa('0x6')](_0x50aa('0x7'),auth[_0x50aa('0x8')](),controller[_0x50aa('0x9')]);router['get'](_0x50aa('0xa'),auth['isAuthenticated'](),controller[_0x50aa('0xb')]);router[_0x50aa('0xc')]('/',auth[_0x50aa('0x8')](),controller[_0x50aa('0xd')]);router[_0x50aa('0xc')](_0x50aa('0xa'),auth[_0x50aa('0x8')](),controller['addUsers']);router[_0x50aa('0xe')](_0x50aa('0x7'),auth[_0x50aa('0x8')](),controller[_0x50aa('0xf')]);router[_0x50aa('0x10')](_0x50aa('0x7'),auth[_0x50aa('0x8')](),controller['destroy']);router[_0x50aa('0x10')]('/:id/users',auth[_0x50aa('0x8')](),controller[_0x50aa('0x11')]);module[_0x50aa('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index ed75afd..579451b 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 _0xda7d=['long','getDataValue','preproduction','toString','utf8','DATE','exports','STRING','name','TEXT','BLOB'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0xda7d,0x145));var _0xdda7=function(_0x4552ad,_0xb1a6e4){_0x4552ad=_0x4552ad-0x0;var _0xe9700b=_0xda7d[_0x4552ad];return _0xe9700b;};'use strict';var Sequelize=require('sequelize');module[_0xdda7('0x0')]={'name':{'type':Sequelize[_0xdda7('0x1')],'unique':_0xdda7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xdda7('0x1')]},'notes':{'type':Sequelize[_0xdda7('0x3')]},'preproduction':{'type':Sequelize[_0xdda7('0x4')](_0xdda7('0x5')),'get':function(){if(this[_0xdda7('0x6')](_0xdda7('0x7'))){return this['getDataValue']('preproduction')[_0xdda7('0x8')](_0xdda7('0x9'));}}},'production':{'type':Sequelize[_0xdda7('0x4')](_0xdda7('0x5')),'get':function(){if(this[_0xdda7('0x6')]('production')){return this['getDataValue']('production')[_0xdda7('0x8')](_0xdda7('0x9'));}}},'savedAt':{'type':Sequelize[_0xdda7('0xa')]},'publishedAt':{'type':Sequelize[_0xdda7('0xa')]}}; \ No newline at end of file +var _0xe139=['sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE'];(function(_0x20c436,_0x14fd00){var _0x46b0e4=function(_0x28332a){while(--_0x28332a){_0x20c436['push'](_0x20c436['shift']());}};_0x46b0e4(++_0x14fd00);}(_0xe139,0x15c));var _0x9e13=function(_0x213103,_0x147186){_0x213103=_0x213103-0x0;var _0x1baa56=_0xe139[_0x213103];return _0x1baa56;};'use strict';var Sequelize=require(_0x9e13('0x0'));module[_0x9e13('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9e13('0x2')]},'notes':{'type':Sequelize[_0x9e13('0x3')]},'preproduction':{'type':Sequelize[_0x9e13('0x4')](_0x9e13('0x5')),'get':function(){if(this[_0x9e13('0x6')](_0x9e13('0x7'))){return this[_0x9e13('0x6')](_0x9e13('0x7'))[_0x9e13('0x8')](_0x9e13('0x9'));}}},'production':{'type':Sequelize[_0x9e13('0x4')]('long'),'get':function(){if(this[_0x9e13('0x6')](_0x9e13('0xa'))){return this[_0x9e13('0x6')](_0x9e13('0xa'))[_0x9e13('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x9e13('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index b11453a..9e4e797 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 _0xf15f=['bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./squareProject.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','end','error','stack','name','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareProject','includeAll','include','findAll','rows','catch','show','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','addUsers','ids','omit','removeUsers','userSquareProject:remove','getUsers','User','hasOwnProperty','nolimit','html-pdf','rimraf','zip-dir','request-promise'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0xf15f,0xb6));var _0xff15=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf15f[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require(_0xff15('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xff15('0x1'));var zipdir=require(_0xff15('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff15('0x3'));var moment=require('moment');var BPromise=require(_0xff15('0x4'));var Mustache=require(_0xff15('0x5'));var util=require('util');var path=require(_0xff15('0x6'));var sox=require(_0xff15('0x7'));var csv=require(_0xff15('0x8'));var ejs=require(_0xff15('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xff15('0xa'));var crypto=require(_0xff15('0xb'));var jsforce=require(_0xff15('0xc'));var deskjs=require(_0xff15('0xd'));var toCsv=require('to-csv');var querystring=require(_0xff15('0xe'));var Papa=require(_0xff15('0xf'));var Redis=require(_0xff15('0x10'));var authService=require(_0xff15('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xff15('0x12'));var hardwareService=require(_0xff15('0x13'));var logger=require(_0xff15('0x14'))('api');var utils=require(_0xff15('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xff15('0x16'));var db=require(_0xff15('0x17'))['db'];config['redis']=_[_0xff15('0x18')](config[_0xff15('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xff15('0x1a'))(new Redis(config[_0xff15('0x19')]));require(_0xff15('0x1b'))['register'](socket);function respondWithStatusCode(_0x272d72,_0x18cbe6){_0x18cbe6=_0x18cbe6||0xcc;return function(_0x45454f){if(_0x45454f){return _0x272d72[_0xff15('0x1c')](_0x18cbe6);}return _0x272d72[_0xff15('0x1d')](_0x18cbe6)['end']();};}function respondWithResult(_0x143458,_0xf48542){_0xf48542=_0xf48542||0xc8;return function(_0x49d2e0){if(_0x49d2e0){return _0x143458[_0xff15('0x1d')](_0xf48542)[_0xff15('0x1e')](_0x49d2e0);}};}function respondWithFilteredResult(_0x1543f0,_0x3dc65f){return function(_0x5d9752){if(_0x5d9752){var _0x58aaeb=_0x5d9752[_0xff15('0x1f')],_0x14439d=_0x3dc65f[_0xff15('0x20')],_0x366d24=_0x3dc65f[_0xff15('0x20')]+_0x3dc65f[_0xff15('0x21')],_0x845e77;if(_0x366d24>=_0x58aaeb){_0x366d24=_0x58aaeb;_0x845e77=0xc8;}else{_0x845e77=0xce;}_0x1543f0[_0xff15('0x1d')](_0x845e77);return _0x1543f0[_0xff15('0x22')](_0xff15('0x23'),_0x14439d+'-'+_0x366d24+'/'+_0x58aaeb)[_0xff15('0x1e')](_0x5d9752);}return null;};}function patchUpdates(_0x5bee68){return function(_0x22b165){try{jsonpatch[_0xff15('0x24')](_0x22b165,_0x5bee68,!![]);}catch(_0xc2e826){return BPromise['reject'](_0xc2e826);}return _0x22b165[_0xff15('0x25')]();};}function saveUpdates(_0x1a82fb,_0x6e9a3f){return function(_0x3325ed){if(_0x3325ed){return _0x3325ed[_0xff15('0x26')](_0x1a82fb)[_0xff15('0x27')](function(_0x565618){return _0x565618;});}return null;};}function removeEntity(_0x5a86e1,_0x483457){return function(_0x1f5979){if(_0x1f5979){return _0x1f5979[_0xff15('0x28')]()[_0xff15('0x27')](function(){var _0xdc4a86=_0x1f5979['get']({'plain':!![]});var _0x3a867c='SquareProjects';return db[_0xff15('0x29')][_0xff15('0x28')]({'where':{'type':_0x3a867c,'resourceId':_0xdc4a86['id']}})[_0xff15('0x27')](function(){return _0x1f5979;});})[_0xff15('0x27')](function(){_0x5a86e1[_0xff15('0x1d')](0xcc)[_0xff15('0x2a')]();});}};}function handleEntityNotFound(_0x42ca72,_0x35431b){return function(_0x3a692a){if(!_0x3a692a){_0x42ca72[_0xff15('0x1c')](0x194);}return _0x3a692a;};}function handleError(_0x3653fb,_0x408a04){_0x408a04=_0x408a04||0x1f4;return function(_0x1c7d97){logger[_0xff15('0x2b')](_0x1c7d97[_0xff15('0x2c')]);if(_0x1c7d97[_0xff15('0x2d')]){delete _0x1c7d97[_0xff15('0x2d')];}_0x3653fb[_0xff15('0x1d')](_0x408a04)['send'](_0x1c7d97);};}exports[_0xff15('0x2e')]=function(_0x338d93,_0x41c057){var _0x33549e={},_0x527877={},_0x33fa7f={'count':0x0,'rows':[]};var _0x5cedba=_['map'](db['SquareProject'][_0xff15('0x2f')],function(_0x76a5d9){return{'name':_0x76a5d9['fieldName'],'type':_0x76a5d9[_0xff15('0x30')]['key']};});_0x527877[_0xff15('0x31')]=_[_0xff15('0x32')](_0x5cedba,'name');_0x527877[_0xff15('0x33')]=_[_0xff15('0x34')](_0x338d93[_0xff15('0x33')]);_0x527877[_0xff15('0x35')]=_[_0xff15('0x36')](_0x527877['model'],_0x527877[_0xff15('0x33')]);_0x33549e[_0xff15('0x37')]=_[_0xff15('0x36')](_0x527877[_0xff15('0x31')],qs[_0xff15('0x38')](_0x338d93[_0xff15('0x33')][_0xff15('0x38')]));_0x33549e[_0xff15('0x37')]=_0x33549e[_0xff15('0x37')]['length']?_0x33549e[_0xff15('0x37')]:_0x527877[_0xff15('0x31')];if(!_0x338d93[_0xff15('0x33')]['hasOwnProperty']('nolimit')){_0x33549e['limit']=qs[_0xff15('0x21')](_0x338d93[_0xff15('0x33')][_0xff15('0x21')]);_0x33549e[_0xff15('0x20')]=qs[_0xff15('0x20')](_0x338d93['query']['offset']);}_0x33549e[_0xff15('0x39')]=qs[_0xff15('0x3a')](_0x338d93['query'][_0xff15('0x3a')]);_0x33549e[_0xff15('0x3b')]=qs[_0xff15('0x35')](_[_0xff15('0x3c')](_0x338d93['query'],_0x527877['filters']),_0x5cedba);if(_0x338d93['query'][_0xff15('0x3d')]){_0x33549e[_0xff15('0x3b')]=_['merge'](_0x33549e[_0xff15('0x3b')],{'$or':_[_0xff15('0x32')](_0x5cedba,function(_0x1b40e5){if(_0x1b40e5['type']!==_0xff15('0x3e')){var _0x39b258={};_0x39b258[_0x1b40e5[_0xff15('0x2d')]]={'$like':'%'+_0x338d93[_0xff15('0x33')][_0xff15('0x3d')]+'%'};return _0x39b258;}})});}_0x33549e=_[_0xff15('0x3f')]({},_0x33549e,_0x338d93[_0xff15('0x40')]);var _0x12352f={'where':_0x33549e[_0xff15('0x3b')]};return db[_0xff15('0x41')][_0xff15('0x1f')](_0x12352f)['then'](function(_0x5db0de){_0x33fa7f[_0xff15('0x1f')]=_0x5db0de;if(_0x338d93[_0xff15('0x33')][_0xff15('0x42')]){_0x33549e[_0xff15('0x43')]=[{'all':!![]}];}return db['SquareProject'][_0xff15('0x44')](_0x33549e);})[_0xff15('0x27')](function(_0x50a527){_0x33fa7f[_0xff15('0x45')]=_0x50a527;return _0x33fa7f;})['then'](respondWithFilteredResult(_0x41c057,_0x33549e))[_0xff15('0x46')](handleError(_0x41c057,null));};exports[_0xff15('0x47')]=function(_0x435a01,_0x4ca626){var _0x3930fa={'raw':![],'where':{'id':_0x435a01['params']['id']}},_0x377207={};_0x377207[_0xff15('0x31')]=_[_0xff15('0x34')](db['SquareProject'][_0xff15('0x2f')]);_0x377207[_0xff15('0x33')]=_[_0xff15('0x34')](_0x435a01[_0xff15('0x33')]);_0x377207[_0xff15('0x35')]=_[_0xff15('0x36')](_0x377207[_0xff15('0x31')],_0x377207[_0xff15('0x33')]);_0x3930fa[_0xff15('0x37')]=_['intersection'](_0x377207[_0xff15('0x31')],qs['fields'](_0x435a01[_0xff15('0x33')][_0xff15('0x38')]));_0x3930fa['attributes']=_0x3930fa['attributes'][_0xff15('0x48')]?_0x3930fa[_0xff15('0x37')]:_0x377207[_0xff15('0x31')];if(_0x435a01['query'][_0xff15('0x42')]){_0x3930fa[_0xff15('0x43')]=[{'all':!![]}];}_0x3930fa=_[_0xff15('0x3f')]({},_0x3930fa,_0x435a01[_0xff15('0x40')]);return db[_0xff15('0x41')]['find'](_0x3930fa)[_0xff15('0x27')](handleEntityNotFound(_0x4ca626,null))['then'](respondWithResult(_0x4ca626,null))['catch'](handleError(_0x4ca626,null));};exports['create']=function(_0x456145,_0x1ce915){return db[_0xff15('0x41')][_0xff15('0x49')](_0x456145['body'],{})[_0xff15('0x27')](function(_0x308eab){var _0x4bc8a2=_0x456145[_0xff15('0x4a')][_0xff15('0x4b')]({'plain':!![]});if(!_0x4bc8a2)throw new Error(_0xff15('0x4c'));if(_0x4bc8a2[_0xff15('0x4d')]===_0xff15('0x4a')){var _0x17c46b=_0x308eab[_0xff15('0x4b')]({'plain':!![]});var _0x14d6e4='SquareProjects';return db[_0xff15('0x4e')]['find']({'where':{'name':_0x14d6e4,'userProfileId':_0x4bc8a2[_0xff15('0x4f')]},'raw':!![]})[_0xff15('0x27')](function(_0x3dd0d5){if(_0x3dd0d5&&_0x3dd0d5['autoAssociation']===0x0){return db[_0xff15('0x29')]['create']({'name':_0x17c46b[_0xff15('0x2d')],'resourceId':_0x17c46b['id'],'type':_0x3dd0d5[_0xff15('0x2d')],'sectionId':_0x3dd0d5['id']},{})[_0xff15('0x27')](function(){return _0x308eab;});}else{return _0x308eab;}})[_0xff15('0x46')](function(_0x1fc335){logger[_0xff15('0x2b')](_0xff15('0x50'),_0x1fc335);throw _0x1fc335;});}return _0x308eab;})['then'](respondWithResult(_0x1ce915,0xc9))[_0xff15('0x46')](handleError(_0x1ce915,null));};exports[_0xff15('0x26')]=function(_0x4224a2,_0x12a080){if(_0x4224a2[_0xff15('0x51')]['id']){delete _0x4224a2['body']['id'];}return db[_0xff15('0x41')][_0xff15('0x52')]({'where':{'id':_0x4224a2['params']['id']}})[_0xff15('0x27')](handleEntityNotFound(_0x12a080,null))['then'](saveUpdates(_0x4224a2[_0xff15('0x51')],null))[_0xff15('0x27')](respondWithResult(_0x12a080,null))[_0xff15('0x46')](handleError(_0x12a080,null));};exports[_0xff15('0x28')]=function(_0x1d8ff8,_0xbad67d){return db[_0xff15('0x41')][_0xff15('0x52')]({'where':{'id':_0x1d8ff8[_0xff15('0x53')]['id']}})[_0xff15('0x27')](handleEntityNotFound(_0xbad67d,null))['then'](removeEntity(_0xbad67d,null))[_0xff15('0x46')](handleError(_0xbad67d,null));};exports['addUsers']=function(_0x16ba2a,_0x4f960a,_0xf828b9){return db['SquareProject']['find']({'where':{'id':_0x16ba2a[_0xff15('0x53')]['id']}})[_0xff15('0x27')](handleEntityNotFound(_0x4f960a,null))['then'](function(_0xa42e1d){if(_0xa42e1d){return _0xa42e1d[_0xff15('0x54')](_0x16ba2a[_0xff15('0x51')][_0xff15('0x55')],_[_0xff15('0x56')](_0x16ba2a[_0xff15('0x51')],[_0xff15('0x55'),'id'])||{});}})['then'](respondWithResult(_0x4f960a,null))[_0xff15('0x46')](handleError(_0x4f960a,null));};exports['removeUsers']=function(_0x5643b3,_0x160cdc,_0x3bd424){return db[_0xff15('0x41')]['find']({'where':{'id':_0x5643b3[_0xff15('0x53')]['id']}})[_0xff15('0x27')](handleEntityNotFound(_0x160cdc,null))[_0xff15('0x27')](function(_0x30a96b){if(_0x30a96b){return _0x30a96b[_0xff15('0x57')](_0x5643b3[_0xff15('0x33')]['ids'])[_0xff15('0x27')](function(){if(_['isArray'](_0x5643b3['query'][_0xff15('0x55')])){for(var _0x154e35=0x0;_0x154e35<_0x5643b3[_0xff15('0x33')][_0xff15('0x55')]['length'];_0x154e35+=0x1){socket['emit'](_0xff15('0x58'),{'UserId':Number(_0x5643b3[_0xff15('0x33')][_0xff15('0x55')][_0x154e35]),'SquareProjectId':Number(_0x5643b3[_0xff15('0x53')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x5643b3[_0xff15('0x33')][_0xff15('0x55')]),'SquareProjectId':Number(_0x5643b3[_0xff15('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x160cdc,null))['catch'](handleError(_0x160cdc,null));};exports[_0xff15('0x59')]=function(_0x205954,_0x39b7f6,_0x2b2516){var _0x2b21a9={};var _0x1bd192={};var _0xbe80d6;var _0x26af9d;return db['SquareProject']['findOne']({'where':{'id':_0x205954['params']['id']}})[_0xff15('0x27')](handleEntityNotFound(_0x39b7f6,null))[_0xff15('0x27')](function(_0xba2c5f){if(_0xba2c5f){_0xbe80d6=_0xba2c5f;_0x1bd192[_0xff15('0x31')]=_['keys'](db[_0xff15('0x5a')][_0xff15('0x2f')]);_0x1bd192[_0xff15('0x33')]=_['keys'](_0x205954[_0xff15('0x33')]);_0x1bd192[_0xff15('0x35')]=_['intersection'](_0x1bd192[_0xff15('0x31')],_0x1bd192[_0xff15('0x33')]);_0x2b21a9[_0xff15('0x37')]=_['intersection'](_0x1bd192[_0xff15('0x31')],qs[_0xff15('0x38')](_0x205954[_0xff15('0x33')]['fields']));_0x2b21a9[_0xff15('0x37')]=_0x2b21a9[_0xff15('0x37')][_0xff15('0x48')]?_0x2b21a9[_0xff15('0x37')]:_0x1bd192[_0xff15('0x31')];_0x2b21a9[_0xff15('0x39')]=qs['sort'](_0x205954['query'][_0xff15('0x3a')]);_0x2b21a9['where']=qs[_0xff15('0x35')](_[_0xff15('0x3c')](_0x205954['query'],_0x1bd192[_0xff15('0x35')]));if(_0x205954[_0xff15('0x33')][_0xff15('0x3d')]){_0x2b21a9[_0xff15('0x3b')]=_[_0xff15('0x3f')](_0x2b21a9[_0xff15('0x3b')],{'$or':_[_0xff15('0x32')](_0x2b21a9['attributes'],function(_0x17cc2a){var _0x45fb62={};_0x45fb62[_0x17cc2a]={'$like':'%'+_0x205954[_0xff15('0x33')][_0xff15('0x3d')]+'%'};return _0x45fb62;})});}_0x2b21a9=_[_0xff15('0x3f')]({},_0x2b21a9,_0x205954[_0xff15('0x40')]);return _0xbe80d6[_0xff15('0x59')](_0x2b21a9);}})[_0xff15('0x27')](function(_0x1844b4){if(_0x1844b4){_0x26af9d=_0x1844b4[_0xff15('0x48')];if(!_0x205954[_0xff15('0x33')][_0xff15('0x5b')](_0xff15('0x5c'))){_0x2b21a9[_0xff15('0x21')]=qs['limit'](_0x205954[_0xff15('0x33')][_0xff15('0x21')]);_0x2b21a9[_0xff15('0x20')]=qs[_0xff15('0x20')](_0x205954['query'][_0xff15('0x20')]);}return _0xbe80d6[_0xff15('0x59')](_0x2b21a9);}})[_0xff15('0x27')](function(_0x5684ed){if(_0x5684ed){return _0x5684ed?{'count':_0x26af9d,'rows':_0x5684ed}:null;}})['then'](respondWithResult(_0x39b7f6,null))[_0xff15('0x46')](handleError(_0x39b7f6,null));}; \ No newline at end of file +var _0x5649=['index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','getUsers','findOne','User','fields','pick','hasOwnProperty','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','SquareProjects','error','name'];(function(_0x1ded44,_0x35969b){var _0x58613c=function(_0x594ba9){while(--_0x594ba9){_0x1ded44['push'](_0x1ded44['shift']());}};_0x58613c(++_0x35969b);}(_0x5649,0x153));var _0x9564=function(_0x555d87,_0x207a9c){_0x555d87=_0x555d87-0x0;var _0x47a78e=_0x5649[_0x555d87];return _0x47a78e;};'use strict';var pdf=require(_0x9564('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9564('0x1'));var zipdir=require(_0x9564('0x2'));var jsonpatch=require(_0x9564('0x3'));var rp=require(_0x9564('0x4'));var moment=require(_0x9564('0x5'));var BPromise=require(_0x9564('0x6'));var Mustache=require('mustache');var util=require(_0x9564('0x7'));var path=require(_0x9564('0x8'));var sox=require(_0x9564('0x9'));var csv=require('to-csv');var ejs=require(_0x9564('0xa'));var fs=require('fs');var _=require(_0x9564('0xb'));var squel=require(_0x9564('0xc'));var crypto=require(_0x9564('0xd'));var jsforce=require(_0x9564('0xe'));var deskjs=require(_0x9564('0xf'));var toCsv=require(_0x9564('0x10'));var querystring=require(_0x9564('0x11'));var Papa=require(_0x9564('0x12'));var Redis=require('ioredis');var authService=require(_0x9564('0x13'));var qs=require(_0x9564('0x14'));var as=require(_0x9564('0x15'));var hardwareService=require(_0x9564('0x16'));var logger=require(_0x9564('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x9564('0x18'));var licenseUtil=require(_0x9564('0x19'));var db=require('../../mysqldb')['db'];config[_0x9564('0x1a')]=_[_0x9564('0x1b')](config['redis'],{'host':_0x9564('0x1c'),'port':0x18eb});var socket=require(_0x9564('0x1d'))(new Redis(config['redis']));require('./squareProject.socket')[_0x9564('0x1e')](socket);function respondWithStatusCode(_0x2c6c96,_0x33c4e6){_0x33c4e6=_0x33c4e6||0xcc;return function(_0x2ee390){if(_0x2ee390){return _0x2c6c96[_0x9564('0x1f')](_0x33c4e6);}return _0x2c6c96[_0x9564('0x20')](_0x33c4e6)[_0x9564('0x21')]();};}function respondWithResult(_0x1b195c,_0x415af8){_0x415af8=_0x415af8||0xc8;return function(_0x152a50){if(_0x152a50){return _0x1b195c[_0x9564('0x20')](_0x415af8)[_0x9564('0x22')](_0x152a50);}};}function respondWithFilteredResult(_0x1bc642,_0x19c6bf){return function(_0x144eae){if(_0x144eae){var _0x240c2a=_0x144eae[_0x9564('0x23')],_0x2678dc=_0x19c6bf['offset'],_0x123ce8=_0x19c6bf[_0x9564('0x24')]+_0x19c6bf[_0x9564('0x25')],_0x5152ee;if(_0x123ce8>=_0x240c2a){_0x123ce8=_0x240c2a;_0x5152ee=0xc8;}else{_0x5152ee=0xce;}_0x1bc642[_0x9564('0x20')](_0x5152ee);return _0x1bc642[_0x9564('0x26')](_0x9564('0x27'),_0x2678dc+'-'+_0x123ce8+'/'+_0x240c2a)[_0x9564('0x22')](_0x144eae);}return null;};}function patchUpdates(_0x43699f){return function(_0x54720f){try{jsonpatch['apply'](_0x54720f,_0x43699f,!![]);}catch(_0x3fdee6){return BPromise[_0x9564('0x28')](_0x3fdee6);}return _0x54720f[_0x9564('0x29')]();};}function saveUpdates(_0x511c3a,_0x9b2731){return function(_0x5ed2c7){if(_0x5ed2c7){return _0x5ed2c7[_0x9564('0x2a')](_0x511c3a)[_0x9564('0x2b')](function(_0x4f16fe){return _0x4f16fe;});}return null;};}function removeEntity(_0x3a200e,_0x15eca8){return function(_0x52116a){if(_0x52116a){return _0x52116a[_0x9564('0x2c')]()[_0x9564('0x2b')](function(){var _0x284110=_0x52116a[_0x9564('0x2d')]({'plain':!![]});var _0x4b0abb=_0x9564('0x2e');return db['UserProfileResource'][_0x9564('0x2c')]({'where':{'type':_0x4b0abb,'resourceId':_0x284110['id']}})[_0x9564('0x2b')](function(){return _0x52116a;});})[_0x9564('0x2b')](function(){_0x3a200e[_0x9564('0x20')](0xcc)[_0x9564('0x21')]();});}};}function handleEntityNotFound(_0xa3803a,_0x557248){return function(_0x30f06a){if(!_0x30f06a){_0xa3803a[_0x9564('0x1f')](0x194);}return _0x30f06a;};}function handleError(_0x1c1fa7,_0x448dbd){_0x448dbd=_0x448dbd||0x1f4;return function(_0xa32808){logger[_0x9564('0x2f')](_0xa32808['stack']);if(_0xa32808[_0x9564('0x30')]){delete _0xa32808[_0x9564('0x30')];}_0x1c1fa7[_0x9564('0x20')](_0x448dbd)['send'](_0xa32808);};}exports[_0x9564('0x31')]=function(_0x3c1bc0,_0x23b1a0){var _0x40e822={},_0x158ec1={},_0x506831={'count':0x0,'rows':[]};var _0x597283=_[_0x9564('0x32')](db[_0x9564('0x33')][_0x9564('0x34')],function(_0x3d8110){return{'name':_0x3d8110[_0x9564('0x35')],'type':_0x3d8110[_0x9564('0x36')][_0x9564('0x37')]};});_0x158ec1[_0x9564('0x38')]=_[_0x9564('0x32')](_0x597283,_0x9564('0x30'));_0x158ec1[_0x9564('0x39')]=_[_0x9564('0x3a')](_0x3c1bc0[_0x9564('0x39')]);_0x158ec1['filters']=_[_0x9564('0x3b')](_0x158ec1[_0x9564('0x38')],_0x158ec1['query']);_0x40e822['attributes']=_[_0x9564('0x3b')](_0x158ec1[_0x9564('0x38')],qs['fields'](_0x3c1bc0[_0x9564('0x39')]['fields']));_0x40e822[_0x9564('0x3c')]=_0x40e822[_0x9564('0x3c')]['length']?_0x40e822[_0x9564('0x3c')]:_0x158ec1[_0x9564('0x38')];if(!_0x3c1bc0[_0x9564('0x39')]['hasOwnProperty']('nolimit')){_0x40e822['limit']=qs[_0x9564('0x25')](_0x3c1bc0[_0x9564('0x39')]['limit']);_0x40e822[_0x9564('0x24')]=qs['offset'](_0x3c1bc0[_0x9564('0x39')]['offset']);}_0x40e822[_0x9564('0x3d')]=qs[_0x9564('0x3e')](_0x3c1bc0[_0x9564('0x39')][_0x9564('0x3e')]);_0x40e822[_0x9564('0x3f')]=qs[_0x9564('0x40')](_['pick'](_0x3c1bc0[_0x9564('0x39')],_0x158ec1[_0x9564('0x40')]),_0x597283);if(_0x3c1bc0[_0x9564('0x39')][_0x9564('0x41')]){_0x40e822[_0x9564('0x3f')]=_[_0x9564('0x42')](_0x40e822[_0x9564('0x3f')],{'$or':_[_0x9564('0x32')](_0x597283,function(_0x53f297){if(_0x53f297[_0x9564('0x36')]!==_0x9564('0x43')){var _0x3cbf79={};_0x3cbf79[_0x53f297[_0x9564('0x30')]]={'$like':'%'+_0x3c1bc0[_0x9564('0x39')][_0x9564('0x41')]+'%'};return _0x3cbf79;}})});}_0x40e822=_[_0x9564('0x42')]({},_0x40e822,_0x3c1bc0[_0x9564('0x44')]);var _0x41c848={'where':_0x40e822[_0x9564('0x3f')]};return db[_0x9564('0x33')]['count'](_0x41c848)['then'](function(_0x187dd2){_0x506831[_0x9564('0x23')]=_0x187dd2;if(_0x3c1bc0[_0x9564('0x39')][_0x9564('0x45')]){_0x40e822['include']=[{'all':!![]}];}return db[_0x9564('0x33')][_0x9564('0x46')](_0x40e822);})[_0x9564('0x2b')](function(_0x5efb5f){_0x506831[_0x9564('0x47')]=_0x5efb5f;return _0x506831;})[_0x9564('0x2b')](respondWithFilteredResult(_0x23b1a0,_0x40e822))[_0x9564('0x48')](handleError(_0x23b1a0,null));};exports['show']=function(_0x1b3d9b,_0x592820){var _0x1819c0={'raw':![],'where':{'id':_0x1b3d9b[_0x9564('0x49')]['id']}},_0x56bc80={};_0x56bc80[_0x9564('0x38')]=_[_0x9564('0x3a')](db[_0x9564('0x33')][_0x9564('0x34')]);_0x56bc80[_0x9564('0x39')]=_[_0x9564('0x3a')](_0x1b3d9b[_0x9564('0x39')]);_0x56bc80[_0x9564('0x40')]=_[_0x9564('0x3b')](_0x56bc80['model'],_0x56bc80[_0x9564('0x39')]);_0x1819c0['attributes']=_[_0x9564('0x3b')](_0x56bc80[_0x9564('0x38')],qs['fields'](_0x1b3d9b[_0x9564('0x39')]['fields']));_0x1819c0[_0x9564('0x3c')]=_0x1819c0[_0x9564('0x3c')][_0x9564('0x4a')]?_0x1819c0[_0x9564('0x3c')]:_0x56bc80[_0x9564('0x38')];if(_0x1b3d9b[_0x9564('0x39')][_0x9564('0x45')]){_0x1819c0[_0x9564('0x4b')]=[{'all':!![]}];}_0x1819c0=_[_0x9564('0x42')]({},_0x1819c0,_0x1b3d9b[_0x9564('0x44')]);return db[_0x9564('0x33')][_0x9564('0x4c')](_0x1819c0)[_0x9564('0x2b')](handleEntityNotFound(_0x592820,null))[_0x9564('0x2b')](respondWithResult(_0x592820,null))[_0x9564('0x48')](handleError(_0x592820,null));};exports[_0x9564('0x4d')]=function(_0xf987a2,_0x368ca0){return db['SquareProject'][_0x9564('0x4d')](_0xf987a2[_0x9564('0x4e')],{})['then'](function(_0x650f86){var _0x3458c7=_0xf987a2[_0x9564('0x4f')][_0x9564('0x2d')]({'plain':!![]});if(!_0x3458c7)throw new Error(_0x9564('0x50'));if(_0x3458c7['role']==='user'){var _0x212a16=_0x650f86[_0x9564('0x2d')]({'plain':!![]});var _0x33c713='SquareProjects';return db[_0x9564('0x51')][_0x9564('0x4c')]({'where':{'name':_0x33c713,'userProfileId':_0x3458c7['userProfileId']},'raw':!![]})[_0x9564('0x2b')](function(_0x2f2989){if(_0x2f2989&&_0x2f2989[_0x9564('0x52')]===0x0){return db[_0x9564('0x53')][_0x9564('0x4d')]({'name':_0x212a16[_0x9564('0x30')],'resourceId':_0x212a16['id'],'type':_0x2f2989[_0x9564('0x30')],'sectionId':_0x2f2989['id']},{})['then'](function(){return _0x650f86;});}else{return _0x650f86;}})[_0x9564('0x48')](function(_0x512c79){logger[_0x9564('0x2f')](_0x9564('0x54'),_0x512c79);throw _0x512c79;});}return _0x650f86;})['then'](respondWithResult(_0x368ca0,0xc9))['catch'](handleError(_0x368ca0,null));};exports['update']=function(_0x5a5078,_0xc56548){if(_0x5a5078[_0x9564('0x4e')]['id']){delete _0x5a5078[_0x9564('0x4e')]['id'];}return db[_0x9564('0x33')][_0x9564('0x4c')]({'where':{'id':_0x5a5078['params']['id']}})[_0x9564('0x2b')](handleEntityNotFound(_0xc56548,null))[_0x9564('0x2b')](saveUpdates(_0x5a5078[_0x9564('0x4e')],null))[_0x9564('0x2b')](respondWithResult(_0xc56548,null))[_0x9564('0x48')](handleError(_0xc56548,null));};exports[_0x9564('0x2c')]=function(_0x4513a2,_0x5251aa){return db['SquareProject'][_0x9564('0x4c')]({'where':{'id':_0x4513a2[_0x9564('0x49')]['id']}})[_0x9564('0x2b')](handleEntityNotFound(_0x5251aa,null))['then'](removeEntity(_0x5251aa,null))[_0x9564('0x48')](handleError(_0x5251aa,null));};exports[_0x9564('0x55')]=function(_0x19c995,_0x1ef8a2,_0xcdfd49){return db[_0x9564('0x33')]['find']({'where':{'id':_0x19c995[_0x9564('0x49')]['id']}})['then'](handleEntityNotFound(_0x1ef8a2,null))[_0x9564('0x2b')](function(_0x140086){if(_0x140086){return _0x140086[_0x9564('0x55')](_0x19c995[_0x9564('0x4e')][_0x9564('0x56')],_['omit'](_0x19c995[_0x9564('0x4e')],[_0x9564('0x56'),'id'])||{});}})[_0x9564('0x2b')](respondWithResult(_0x1ef8a2,null))[_0x9564('0x48')](handleError(_0x1ef8a2,null));};exports['removeUsers']=function(_0x16ccd4,_0x2a0f79,_0xcfda7c){return db['SquareProject'][_0x9564('0x4c')]({'where':{'id':_0x16ccd4['params']['id']}})['then'](handleEntityNotFound(_0x2a0f79,null))[_0x9564('0x2b')](function(_0x1ceec6){if(_0x1ceec6){return _0x1ceec6[_0x9564('0x57')](_0x16ccd4[_0x9564('0x39')][_0x9564('0x56')])[_0x9564('0x2b')](function(){if(_[_0x9564('0x58')](_0x16ccd4['query']['ids'])){for(var _0x122130=0x0;_0x122130<_0x16ccd4[_0x9564('0x39')][_0x9564('0x56')]['length'];_0x122130+=0x1){socket[_0x9564('0x59')]('userSquareProject:remove',{'UserId':Number(_0x16ccd4[_0x9564('0x39')][_0x9564('0x56')][_0x122130]),'SquareProjectId':Number(_0x16ccd4[_0x9564('0x49')]['id'])});}}else{socket[_0x9564('0x59')]('userSquareProject:remove',{'UserId':Number(_0x16ccd4[_0x9564('0x39')][_0x9564('0x56')]),'SquareProjectId':Number(_0x16ccd4['params']['id'])});}});}})[_0x9564('0x2b')](respondWithStatusCode(_0x2a0f79,null))[_0x9564('0x48')](handleError(_0x2a0f79,null));};exports[_0x9564('0x5a')]=function(_0x152229,_0x241937,_0x4fce61){var _0x528c7c={};var _0x2696f6={};var _0x337083;var _0x73b8c4;return db[_0x9564('0x33')][_0x9564('0x5b')]({'where':{'id':_0x152229['params']['id']}})['then'](handleEntityNotFound(_0x241937,null))[_0x9564('0x2b')](function(_0x5eed5c){if(_0x5eed5c){_0x337083=_0x5eed5c;_0x2696f6['model']=_['keys'](db[_0x9564('0x5c')][_0x9564('0x34')]);_0x2696f6[_0x9564('0x39')]=_[_0x9564('0x3a')](_0x152229[_0x9564('0x39')]);_0x2696f6[_0x9564('0x40')]=_[_0x9564('0x3b')](_0x2696f6[_0x9564('0x38')],_0x2696f6[_0x9564('0x39')]);_0x528c7c[_0x9564('0x3c')]=_[_0x9564('0x3b')](_0x2696f6[_0x9564('0x38')],qs[_0x9564('0x5d')](_0x152229[_0x9564('0x39')][_0x9564('0x5d')]));_0x528c7c[_0x9564('0x3c')]=_0x528c7c[_0x9564('0x3c')][_0x9564('0x4a')]?_0x528c7c['attributes']:_0x2696f6[_0x9564('0x38')];_0x528c7c[_0x9564('0x3d')]=qs[_0x9564('0x3e')](_0x152229[_0x9564('0x39')][_0x9564('0x3e')]);_0x528c7c['where']=qs['filters'](_[_0x9564('0x5e')](_0x152229['query'],_0x2696f6[_0x9564('0x40')]));if(_0x152229[_0x9564('0x39')][_0x9564('0x41')]){_0x528c7c['where']=_[_0x9564('0x42')](_0x528c7c[_0x9564('0x3f')],{'$or':_[_0x9564('0x32')](_0x528c7c[_0x9564('0x3c')],function(_0x960979){var _0x1ad28a={};_0x1ad28a[_0x960979]={'$like':'%'+_0x152229[_0x9564('0x39')]['filter']+'%'};return _0x1ad28a;})});}_0x528c7c=_[_0x9564('0x42')]({},_0x528c7c,_0x152229['options']);return _0x337083[_0x9564('0x5a')](_0x528c7c);}})[_0x9564('0x2b')](function(_0x8659ca){if(_0x8659ca){_0x73b8c4=_0x8659ca['length'];if(!_0x152229[_0x9564('0x39')][_0x9564('0x5f')](_0x9564('0x60'))){_0x528c7c[_0x9564('0x25')]=qs[_0x9564('0x25')](_0x152229[_0x9564('0x39')][_0x9564('0x25')]);_0x528c7c[_0x9564('0x24')]=qs[_0x9564('0x24')](_0x152229[_0x9564('0x39')]['offset']);}return _0x337083[_0x9564('0x5a')](_0x528c7c);}})['then'](function(_0x4ea03b){if(_0x4ea03b){return _0x4ea03b?{'count':_0x73b8c4,'rows':_0x4ea03b}:null;}})[_0x9564('0x2b')](respondWithResult(_0x241937,null))[_0x9564('0x48')](handleError(_0x241937,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 324a1d7..1f63023 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 _0x8343=['../../mysqldb','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x372433,_0xb55d02){var _0x375ac3=function(_0x1c1d22){while(--_0x1c1d22){_0x372433['push'](_0x372433['shift']());}};_0x375ac3(++_0xb55d02);}(_0x8343,0xd7));var _0x3834=function(_0x1757c3,_0x20b023){_0x1757c3=_0x1757c3-0x0;var _0x57e87f=_0x8343[_0x1757c3];return _0x57e87f;};'use strict';var EventEmitter=require(_0x3834('0x0'));var SquareProject=require(_0x3834('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3834('0x2'),'afterUpdate':_0x3834('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3ece46){return function(_0x3d5efe,_0x4b18a9,_0x32cbe6){SquareProjectEvents[_0x3834('0x4')](_0x3ece46+':'+_0x3d5efe['id'],_0x3d5efe);SquareProjectEvents['emit'](_0x3ece46,_0x3d5efe);_0x32cbe6(null);};}for(var e in events){if(events[_0x3834('0x5')](e)){var event=events[e];SquareProject[_0x3834('0x6')](e,emitEvent(event));}}module[_0x3834('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xe7a5=['update','emit','hasOwnProperty','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x6d4f20,_0x463805){var _0x58deec=function(_0x54d3fb){while(--_0x54d3fb){_0x6d4f20['push'](_0x6d4f20['shift']());}};_0x58deec(++_0x463805);}(_0xe7a5,0xe4));var _0x5e7a=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xe7a5[_0x361d3f];return _0x320229;};'use strict';var EventEmitter=require(_0x5e7a('0x0'));var SquareProject=require(_0x5e7a('0x1'))['db'][_0x5e7a('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5e7a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e7a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x48a953){return function(_0x391886,_0x4bc690,_0x5127a0){SquareProjectEvents[_0x5e7a('0x5')](_0x48a953+':'+_0x391886['id'],_0x391886);SquareProjectEvents[_0x5e7a('0x5')](_0x48a953,_0x391886);_0x5127a0(null);};}for(var e in events){if(events[_0x5e7a('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x5e7a('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index e83d88f..500fa63 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 _0x5577=['savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction'];(function(_0x986eb,_0x6053d){var _0x521393=function(_0x4a1523){while(--_0x4a1523){_0x986eb['push'](_0x986eb['shift']());}};_0x521393(++_0x6053d);}(_0x5577,0x1b4));var _0x7557=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x5577[_0x4653f7];return _0x5454da;};'use strict';var _=require(_0x7557('0x0'));var util=require('util');var logger=require(_0x7557('0x1'))(_0x7557('0x2'));var moment=require('moment');var BPromise=require(_0x7557('0x3'));var rp=require(_0x7557('0x4'));var fs=require('fs');var path=require(_0x7557('0x5'));var rimraf=require(_0x7557('0x6'));var config=require(_0x7557('0x7'));var attributes=require(_0x7557('0x8'));module['exports']=function(_0x7bb8c,_0x41a4a5){return _0x7bb8c[_0x7557('0x9')](_0x7557('0xa'),attributes,{'tableName':_0x7557('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x37f335,_0xa4f49a,_0x1089f8){if(_0x37f335[_0x7557('0xc')](_0x7557('0xd'))){_0x37f335[_0x7557('0xe')]=moment()[_0x7557('0xf')](_0x7557('0x10'));}if(_0x37f335[_0x7557('0xc')](_0x7557('0x11'))){_0x37f335['publishedAt']=moment()['format'](_0x7557('0x10'));}_0x1089f8(null,_0x37f335);}}});}; \ No newline at end of file +var _0xe3ee=['request-promise','../../config/environment','exports','define','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','../../config/logger','api'];(function(_0x11bbcd,_0x4a5e5f){var _0x1c8232=function(_0x21c4d0){while(--_0x21c4d0){_0x11bbcd['push'](_0x11bbcd['shift']());}};_0x1c8232(++_0x4a5e5f);}(_0xe3ee,0x116));var _0xee3e=function(_0x5b523f,_0x9f43aa){_0x5b523f=_0x5b523f-0x0;var _0x53b819=_0xe3ee[_0x5b523f];return _0x53b819;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee3e('0x0'))(_0xee3e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xee3e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xee3e('0x3'));var attributes=require('./squareProject.attributes');module[_0xee3e('0x4')]=function(_0x352eca,_0x3907a7){return _0x352eca[_0xee3e('0x5')](_0xee3e('0x6'),attributes,{'tableName':_0xee3e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43ab67,_0x17fba1,_0x5ee7fd){if(_0x43ab67[_0xee3e('0x8')](_0xee3e('0x9'))){_0x43ab67['savedAt']=moment()[_0xee3e('0xa')](_0xee3e('0xb'));}if(_0x43ab67['changed'](_0xee3e('0xc'))){_0x43ab67[_0xee3e('0xd')]=moment()[_0xee3e('0xa')](_0xee3e('0xb'));}_0x5ee7fd(null,_0x43ab67);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a02304b..fa17a57 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 _0xb0e1=['client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSquareProject','find','raw','options','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0xb0e1,0x8a));var _0x1b0e=function(_0x3c4c40,_0x1d2bc7){_0x3c4c40=_0x3c4c40-0x0;var _0x4b390f=_0xb0e1[_0x3c4c40];return _0x4b390f;};'use strict';var _=require(_0x1b0e('0x0'));var util=require(_0x1b0e('0x1'));var moment=require(_0x1b0e('0x2'));var BPromise=require(_0x1b0e('0x3'));var rs=require(_0x1b0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b0e('0x5'));var logger=require(_0x1b0e('0x6'))(_0x1b0e('0x7'));var config=require(_0x1b0e('0x8'));var jayson=require(_0x1b0e('0x9'));var client=jayson[_0x1b0e('0xa')][_0x1b0e('0xb')]({'port':0x232a});config['redis']=_[_0x1b0e('0xc')](config[_0x1b0e('0xd')],{'host':_0x1b0e('0xe'),'port':0x18eb});var socket=require(_0x1b0e('0xf'))(new Redis(config[_0x1b0e('0xd')]));require('./squareProject.socket')[_0x1b0e('0x10')](socket);function respondWithRpcPromise(_0x4d6b25,_0x567556,_0x358592){return new BPromise(function(_0xec1f52,_0x152c1f){return client[_0x1b0e('0x11')](_0x4d6b25,_0x358592)[_0x1b0e('0x12')](function(_0x1a6230){logger[_0x1b0e('0x13')](_0x1b0e('0x14'),_0x567556,_0x1b0e('0x15'));logger[_0x1b0e('0x16')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x567556,_0x1b0e('0x15'),JSON[_0x1b0e('0x17')](_0x1a6230));if(_0x1a6230[_0x1b0e('0x18')]){if(_0x1a6230[_0x1b0e('0x18')][_0x1b0e('0x19')]===0x1f4){logger[_0x1b0e('0x18')](_0x1b0e('0x14'),_0x567556,_0x1a6230['error'][_0x1b0e('0x1a')]);return _0x152c1f(_0x1a6230[_0x1b0e('0x18')][_0x1b0e('0x1a')]);}logger[_0x1b0e('0x18')](_0x1b0e('0x14'),_0x567556,_0x1a6230[_0x1b0e('0x18')][_0x1b0e('0x1a')]);return _0xec1f52(_0x1a6230[_0x1b0e('0x18')][_0x1b0e('0x1a')]);}else{logger[_0x1b0e('0x13')]('SquareProject,\x20%s,\x20%s',_0x567556,_0x1b0e('0x15'));_0xec1f52(_0x1a6230[_0x1b0e('0x1b')][_0x1b0e('0x1a')]);}})[_0x1b0e('0x1c')](function(_0x453721){logger[_0x1b0e('0x18')](_0x1b0e('0x14'),_0x567556,_0x453721);_0x152c1f(_0x453721);});});}exports[_0x1b0e('0x1d')]=function(_0x3cf2d8){var _0x2fd414=this;return new Promise(function(_0x435831,_0x51c316){return db['SquareProject'][_0x1b0e('0x1e')]({'raw':_0x3cf2d8['options']?_0x3cf2d8['options'][_0x1b0e('0x1f')]===undefined?!![]:![]:!![],'where':_0x3cf2d8[_0x1b0e('0x20')]?_0x3cf2d8['options']['where']||null:null,'attributes':_0x3cf2d8[_0x1b0e('0x20')]?_0x3cf2d8[_0x1b0e('0x20')][_0x1b0e('0x21')]||null:null,'include':_0x3cf2d8['options']?_0x3cf2d8['options'][_0x1b0e('0x22')]?_[_0x1b0e('0x23')](_0x3cf2d8[_0x1b0e('0x20')][_0x1b0e('0x22')],function(_0x3f68c8){return{'model':db[_0x3f68c8[_0x1b0e('0x24')]],'as':_0x3f68c8['as'],'attributes':_0x3f68c8[_0x1b0e('0x21')],'include':_0x3f68c8[_0x1b0e('0x22')]?_[_0x1b0e('0x23')](_0x3f68c8['include'],function(_0x3e3581){return{'model':db[_0x3e3581['model']],'as':_0x3e3581['as'],'attributes':_0x3e3581[_0x1b0e('0x21')],'include':_0x3e3581[_0x1b0e('0x22')]?_['map'](_0x3e3581[_0x1b0e('0x22')],function(_0x2da3b4){return{'model':db[_0x2da3b4[_0x1b0e('0x24')]],'as':_0x2da3b4['as'],'attributes':_0x2da3b4[_0x1b0e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1b0e('0x12')](function(_0x562ba8){logger[_0x1b0e('0x13')](_0x1b0e('0x1d'),_0x3cf2d8);logger['debug'](_0x1b0e('0x1d'),_0x3cf2d8,JSON['stringify'](_0x562ba8));_0x435831(_0x562ba8);})['catch'](function(_0x2f3364){logger['error'](_0x1b0e('0x1d'),_0x2f3364[_0x1b0e('0x1a')],_0x3cf2d8);_0x51c316(_0x2fd414[_0x1b0e('0x18')](0x1f4,_0x2f3364[_0x1b0e('0x1a')]));});});}; \ No newline at end of file +var _0x9d2c=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','ShowSquareProject','find','options','where','include','map','model','attributes','then','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x549be3,_0x196a69){var _0x91e664=function(_0x144987){while(--_0x144987){_0x549be3['push'](_0x549be3['shift']());}};_0x91e664(++_0x196a69);}(_0x9d2c,0xc0));var _0xc9d2=function(_0xa80297,_0x523270){_0xa80297=_0xa80297-0x0;var _0x2b7ec8=_0x9d2c[_0xa80297];return _0x2b7ec8;};'use strict';var _=require('lodash');var util=require(_0xc9d2('0x0'));var moment=require('moment');var BPromise=require(_0xc9d2('0x1'));var rs=require(_0xc9d2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9d2('0x3'))['db'];var utils=require(_0xc9d2('0x4'));var logger=require('../../config/logger')(_0xc9d2('0x5'));var config=require(_0xc9d2('0x6'));var jayson=require(_0xc9d2('0x7'));var client=jayson[_0xc9d2('0x8')]['http']({'port':0x232a});config[_0xc9d2('0x9')]=_[_0xc9d2('0xa')](config[_0xc9d2('0x9')],{'host':_0xc9d2('0xb'),'port':0x18eb});var socket=require(_0xc9d2('0xc'))(new Redis(config['redis']));require(_0xc9d2('0xd'))[_0xc9d2('0xe')](socket);function respondWithRpcPromise(_0x11a3d6,_0x3de411,_0x4564e8){return new BPromise(function(_0x5b2aaa,_0x11be7a){return client[_0xc9d2('0xf')](_0x11a3d6,_0x4564e8)['then'](function(_0x5d2b40){logger[_0xc9d2('0x10')](_0xc9d2('0x11'),_0x3de411,_0xc9d2('0x12'));logger[_0xc9d2('0x13')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x3de411,_0xc9d2('0x12'),JSON[_0xc9d2('0x14')](_0x5d2b40));if(_0x5d2b40[_0xc9d2('0x15')]){if(_0x5d2b40[_0xc9d2('0x15')]['code']===0x1f4){logger[_0xc9d2('0x15')](_0xc9d2('0x11'),_0x3de411,_0x5d2b40[_0xc9d2('0x15')][_0xc9d2('0x16')]);return _0x11be7a(_0x5d2b40[_0xc9d2('0x15')][_0xc9d2('0x16')]);}logger[_0xc9d2('0x15')](_0xc9d2('0x11'),_0x3de411,_0x5d2b40[_0xc9d2('0x15')][_0xc9d2('0x16')]);return _0x5b2aaa(_0x5d2b40[_0xc9d2('0x15')]['message']);}else{logger[_0xc9d2('0x10')](_0xc9d2('0x11'),_0x3de411,_0xc9d2('0x12'));_0x5b2aaa(_0x5d2b40['result'][_0xc9d2('0x16')]);}})[_0xc9d2('0x17')](function(_0x1baf19){logger[_0xc9d2('0x15')](_0xc9d2('0x11'),_0x3de411,_0x1baf19);_0x11be7a(_0x1baf19);});});}exports[_0xc9d2('0x18')]=function(_0xac8325){var _0x620d09=this;return new Promise(function(_0x18954d,_0x27de5d){return db['SquareProject'][_0xc9d2('0x19')]({'raw':_0xac8325[_0xc9d2('0x1a')]?_0xac8325[_0xc9d2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xac8325[_0xc9d2('0x1a')]?_0xac8325['options'][_0xc9d2('0x1b')]||null:null,'attributes':_0xac8325[_0xc9d2('0x1a')]?_0xac8325[_0xc9d2('0x1a')]['attributes']||null:null,'include':_0xac8325[_0xc9d2('0x1a')]?_0xac8325[_0xc9d2('0x1a')][_0xc9d2('0x1c')]?_[_0xc9d2('0x1d')](_0xac8325[_0xc9d2('0x1a')]['include'],function(_0x3d92dc){return{'model':db[_0x3d92dc[_0xc9d2('0x1e')]],'as':_0x3d92dc['as'],'attributes':_0x3d92dc[_0xc9d2('0x1f')],'include':_0x3d92dc['include']?_['map'](_0x3d92dc[_0xc9d2('0x1c')],function(_0x16db62){return{'model':db[_0x16db62['model']],'as':_0x16db62['as'],'attributes':_0x16db62[_0xc9d2('0x1f')],'include':_0x16db62[_0xc9d2('0x1c')]?_[_0xc9d2('0x1d')](_0x16db62[_0xc9d2('0x1c')],function(_0x46edef){return{'model':db[_0x46edef[_0xc9d2('0x1e')]],'as':_0x46edef['as'],'attributes':_0x46edef[_0xc9d2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc9d2('0x20')](function(_0x1e698a){logger[_0xc9d2('0x10')](_0xc9d2('0x18'),_0xac8325);logger[_0xc9d2('0x13')]('ShowSquareProject',_0xac8325,JSON[_0xc9d2('0x14')](_0x1e698a));_0x18954d(_0x1e698a);})[_0xc9d2('0x17')](function(_0x188ec2){logger[_0xc9d2('0x15')](_0xc9d2('0x18'),_0x188ec2[_0xc9d2('0x16')],_0xac8325);_0x27de5d(_0x620d09[_0xc9d2('0x15')](0x1f4,_0x188ec2[_0xc9d2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index af7b7be..bb8eda2 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 _0x687b=['update','emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove'];(function(_0x3a8545,_0x256c19){var _0x5b6ac2=function(_0x5a71d4){while(--_0x5a71d4){_0x3a8545['push'](_0x3a8545['shift']());}};_0x5b6ac2(++_0x256c19);}(_0x687b,0x14a));var _0xb687=function(_0x3edf53,_0xfcd5d){_0x3edf53=_0x3edf53-0x0;var _0x4e7f9e=_0x687b[_0x3edf53];return _0x4e7f9e;};'use strict';var SquareProjectEvents=require(_0xb687('0x0'));var events=[_0xb687('0x1'),_0xb687('0x2'),_0xb687('0x3')];function createListener(_0x5d8563,_0x5e5f06){return function(_0x35069a){_0x5e5f06[_0xb687('0x4')](_0x5d8563,_0x35069a);};}function removeListener(_0x36c468,_0x31bd0d){return function(){SquareProjectEvents[_0xb687('0x5')](_0x36c468,_0x31bd0d);};}exports[_0xb687('0x6')]=function(_0x16ccf3){for(var _0xf43a1f=0x0,_0x47ffea=events[_0xb687('0x7')];_0xf43a1f<_0x47ffea;_0xf43a1f++){var _0x48942b=events[_0xf43a1f];var _0x2aea59=createListener(_0xb687('0x8')+_0x48942b,_0x16ccf3);SquareProjectEvents['on'](_0x48942b,_0x2aea59);}}; \ No newline at end of file +var _0x7096=['emit','removeListener','register','length','save','update'];(function(_0x52dcc6,_0x176b5f){var _0x2fdf72=function(_0x4e1276){while(--_0x4e1276){_0x52dcc6['push'](_0x52dcc6['shift']());}};_0x2fdf72(++_0x176b5f);}(_0x7096,0x10c));var _0x6709=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7096[_0x56482c];return _0x5aae7a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x6709('0x0'),'remove',_0x6709('0x1')];function createListener(_0x5c668a,_0x233cbf){return function(_0x9544e0){_0x233cbf[_0x6709('0x2')](_0x5c668a,_0x9544e0);};}function removeListener(_0xccdcb5,_0x3cd087){return function(){SquareProjectEvents[_0x6709('0x3')](_0xccdcb5,_0x3cd087);};}exports[_0x6709('0x4')]=function(_0x9d630f){for(var _0xa35832=0x0,_0x3e2223=events[_0x6709('0x5')];_0xa35832<_0x3e2223;_0xa35832++){var _0x985814=events[_0xa35832];var _0x30147f=createListener('squareProject:'+_0x985814,_0x9d630f);SquareProjectEvents['on'](_0x985814,_0x30147f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index eb32cad..252f0e9 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 _0x35af=['connect-timeout','express','Router','../../components/interaction/service','get','/:id','isAuthenticated','post','create','put','update','/:id/delete','destroy','path'];(function(_0x140e8c,_0x10d88d){var _0x36fa4a=function(_0x41a3dd){while(--_0x41a3dd){_0x140e8c['push'](_0x140e8c['shift']());}};_0x36fa4a(++_0x10d88d);}(_0x35af,0x1db));var _0xf35a=function(_0x3c40a4,_0x7583ce){_0x3c40a4=_0x3c40a4-0x0;var _0x38e204=_0x35af[_0x3c40a4];return _0x38e204;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf35a('0x0'));var timeout=require(_0xf35a('0x1'));var express=require(_0xf35a('0x2'));var router=express[_0xf35a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf35a('0x4'));var config=require('../../config/environment');var controller=require('./squareRecording.controller');router[_0xf35a('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf35a('0x6'),auth[_0xf35a('0x7')](),controller['show']);router[_0xf35a('0x5')]('/:id/download',auth[_0xf35a('0x7')](),controller['download']);router[_0xf35a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf35a('0x9')]);router[_0xf35a('0xa')](_0xf35a('0x6'),auth[_0xf35a('0x7')](),controller[_0xf35a('0xb')]);router['delete'](_0xf35a('0xc'),auth[_0xf35a('0x7')](),controller[_0xf35a('0xd')]);module['exports']=router; \ No newline at end of file +var _0xc8ee=['/:id/delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated','index','get','/:id','show','/:id/download','post','put','update'];(function(_0x4eb20a,_0x175a7a){var _0x3f2fed=function(_0x22d36a){while(--_0x22d36a){_0x4eb20a['push'](_0x4eb20a['shift']());}};_0x3f2fed(++_0x175a7a);}(_0xc8ee,0x17f));var _0xec8e=function(_0x3f07d7,_0x107fd6){_0x3f07d7=_0x3f07d7-0x0;var _0x3e8de0=_0xc8ee[_0x3f07d7];return _0x3e8de0;};'use strict';var multer=require(_0xec8e('0x0'));var util=require(_0xec8e('0x1'));var path=require('path');var timeout=require(_0xec8e('0x2'));var express=require(_0xec8e('0x3'));var router=express[_0xec8e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xec8e('0x5'));var config=require(_0xec8e('0x6'));var controller=require(_0xec8e('0x7'));router['get']('/',auth[_0xec8e('0x8')](),controller[_0xec8e('0x9')]);router[_0xec8e('0xa')](_0xec8e('0xb'),auth[_0xec8e('0x8')](),controller[_0xec8e('0xc')]);router[_0xec8e('0xa')](_0xec8e('0xd'),auth[_0xec8e('0x8')](),controller['download']);router[_0xec8e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xec8e('0xf')](_0xec8e('0xb'),auth['isAuthenticated'](),controller[_0xec8e('0x10')]);router['delete'](_0xec8e('0x11'),auth[_0xec8e('0x8')](),controller[_0xec8e('0x12')]);module[_0xec8e('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index a6ae2b6..3499d71 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 _0x6546=['lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x3f774a,_0x175e48){var _0x579518=function(_0x40d0cd){while(--_0x40d0cd){_0x3f774a['push'](_0x3f774a['shift']());}};_0x579518(++_0x175e48);}(_0x6546,0x139));var _0x6654=function(_0x4aaef1,_0x1c94f5){_0x4aaef1=_0x4aaef1-0x0;var _0x114639=_0x6546[_0x4aaef1];return _0x114639;};'use strict';var Sequelize=require(_0x6654('0x0'));module[_0x6654('0x1')]={'uniqueid':{'type':Sequelize[_0x6654('0x2')]},'callerid':{'type':Sequelize[_0x6654('0x2')]},'calleridname':{'type':Sequelize[_0x6654('0x2')]},'context':{'type':Sequelize[_0x6654('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6654('0x2')]},'accountcode':{'type':Sequelize[_0x6654('0x2')]},'dnid':{'type':Sequelize[_0x6654('0x2')]},'projectName':{'type':Sequelize[_0x6654('0x2')]},'saveName':{'type':Sequelize[_0x6654('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x6654('0x3')],'get':function(){var _0x33d424='';var _0x5762ee=this[_0x6654('0x4')](_0x6654('0x5'));if(_0x5762ee){_0x33d424=_0x5762ee[_0x6654('0x6')](_0x5762ee[_0x6654('0x7')]('.'));}return _0x33d424;}}}; \ No newline at end of file +var _0xb0d9=['savePath','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x507597,_0x412525){var _0x110a0f=function(_0x57935a){while(--_0x57935a){_0x507597['push'](_0x507597['shift']());}};_0x110a0f(++_0x412525);}(_0xb0d9,0x87));var _0x9b0d=function(_0x220b1e,_0x837d87){_0x220b1e=_0x220b1e-0x0;var _0x9b08e2=_0xb0d9[_0x220b1e];return _0x9b08e2;};'use strict';var Sequelize=require(_0x9b0d('0x0'));module[_0x9b0d('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9b0d('0x2')]},'calleridname':{'type':Sequelize[_0x9b0d('0x2')]},'context':{'type':Sequelize[_0x9b0d('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9b0d('0x2')]},'accountcode':{'type':Sequelize[_0x9b0d('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x9b0d('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x9b0d('0x3')],'get':function(){var _0xadcf0b='';var _0x19be51=this[_0x9b0d('0x4')](_0x9b0d('0x5'));if(_0x19be51){_0xadcf0b=_0x19be51['substring'](_0x19be51[_0x9b0d('0x6')]('.'));}return _0xadcf0b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index bcad556..6936d0e 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 _0x3615=['options','include','findAll','catch','show','params','keys','includeAll','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','send','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','SquareRecording','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x23d7cf,_0x5ce4c5){var _0x209cd7=function(_0x453531){while(--_0x453531){_0x23d7cf['push'](_0x23d7cf['shift']());}};_0x209cd7(++_0x5ce4c5);}(_0x3615,0x88));var _0x5361=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x3615[_0x2b7764];return _0x848dcb;};'use strict';var pdf=require(_0x5361('0x0'));var emlformat=require(_0x5361('0x1'));var rimraf=require(_0x5361('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5361('0x3'));var moment=require(_0x5361('0x4'));var BPromise=require(_0x5361('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5361('0x6'));var sox=require(_0x5361('0x7'));var csv=require(_0x5361('0x8'));var ejs=require(_0x5361('0x9'));var fs=require('fs');var _=require(_0x5361('0xa'));var squel=require('squel');var crypto=require(_0x5361('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5361('0xc'));var toCsv=require(_0x5361('0x8'));var querystring=require(_0x5361('0xd'));var Papa=require(_0x5361('0xe'));var Redis=require('ioredis');var authService=require(_0x5361('0xf'));var qs=require(_0x5361('0x10'));var as=require(_0x5361('0x11'));var hardwareService=require(_0x5361('0x12'));var logger=require(_0x5361('0x13'))(_0x5361('0x14'));var utils=require('../../config/utils');var config=require(_0x5361('0x15'));var licenseUtil=require(_0x5361('0x16'));var db=require(_0x5361('0x17'))['db'];function respondWithStatusCode(_0xc8d465,_0x463079){_0x463079=_0x463079||0xcc;return function(_0x26b273){if(_0x26b273){return _0xc8d465[_0x5361('0x18')](_0x463079);}return _0xc8d465[_0x5361('0x19')](_0x463079)[_0x5361('0x1a')]();};}function respondWithResult(_0x4fa89a,_0x1146de){_0x1146de=_0x1146de||0xc8;return function(_0x2d344c){if(_0x2d344c){return _0x4fa89a[_0x5361('0x19')](_0x1146de)['json'](_0x2d344c);}};}function respondWithFilteredResult(_0x160c34,_0x43b86d){return function(_0x6cc534){if(_0x6cc534){var _0x7bbc76=_0x6cc534[_0x5361('0x1b')],_0x2f951f=_0x43b86d[_0x5361('0x1c')],_0x100234=_0x43b86d[_0x5361('0x1c')]+_0x43b86d[_0x5361('0x1d')],_0x32e2ba;if(_0x100234>=_0x7bbc76){_0x100234=_0x7bbc76;_0x32e2ba=0xc8;}else{_0x32e2ba=0xce;}_0x160c34['status'](_0x32e2ba);return _0x160c34[_0x5361('0x1e')](_0x5361('0x1f'),_0x2f951f+'-'+_0x100234+'/'+_0x7bbc76)[_0x5361('0x20')](_0x6cc534);}return null;};}function patchUpdates(_0x4a0b07){return function(_0x2f764f){try{jsonpatch[_0x5361('0x21')](_0x2f764f,_0x4a0b07,!![]);}catch(_0x2b721d){return BPromise[_0x5361('0x22')](_0x2b721d);}return _0x2f764f[_0x5361('0x23')]();};}function saveUpdates(_0x1c97f3,_0xcc054a){return function(_0x371d8a){if(_0x371d8a){return _0x371d8a[_0x5361('0x24')](_0x1c97f3)[_0x5361('0x25')](function(_0x42c3f4){return _0x42c3f4;});}return null;};}function removeEntity(_0x575298,_0x20b800){return function(_0x5a7bf9){if(_0x5a7bf9){return _0x5a7bf9['destroy']()[_0x5361('0x25')](function(){_0x575298[_0x5361('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc3b0c4,_0x1f43eb){return function(_0x499d59){if(!_0x499d59){_0xc3b0c4[_0x5361('0x18')](0x194);}return _0x499d59;};}function handleError(_0x2e30a8,_0x29c281){_0x29c281=_0x29c281||0x1f4;return function(_0xfa253b){logger[_0x5361('0x26')](_0xfa253b[_0x5361('0x27')]);if(_0xfa253b[_0x5361('0x28')]){delete _0xfa253b[_0x5361('0x28')];}_0x2e30a8[_0x5361('0x19')](_0x29c281)['send'](_0xfa253b);};}exports['index']=function(_0x19a960,_0x42fa2b){var _0x16ad4a={},_0x2a53da={},_0x423d07={'count':0x0,'rows':[]};var _0x19fb75=_['map'](db[_0x5361('0x29')][_0x5361('0x2a')],function(_0x42bd31){return{'name':_0x42bd31['fieldName'],'type':_0x42bd31['type'][_0x5361('0x2b')]};});_0x2a53da[_0x5361('0x2c')]=_[_0x5361('0x2d')](_0x19fb75,_0x5361('0x28'));_0x2a53da[_0x5361('0x2e')]=_['keys'](_0x19a960[_0x5361('0x2e')]);_0x2a53da[_0x5361('0x2f')]=_[_0x5361('0x30')](_0x2a53da[_0x5361('0x2c')],_0x2a53da[_0x5361('0x2e')]);_0x16ad4a[_0x5361('0x31')]=_['intersection'](_0x2a53da['model'],qs['fields'](_0x19a960[_0x5361('0x2e')][_0x5361('0x32')]));_0x16ad4a[_0x5361('0x31')]=_0x16ad4a[_0x5361('0x31')]['length']?_0x16ad4a[_0x5361('0x31')]:_0x2a53da[_0x5361('0x2c')];if(!_0x19a960['query'][_0x5361('0x33')]('nolimit')){_0x16ad4a[_0x5361('0x1d')]=qs[_0x5361('0x1d')](_0x19a960[_0x5361('0x2e')][_0x5361('0x1d')]);_0x16ad4a['offset']=qs[_0x5361('0x1c')](_0x19a960[_0x5361('0x2e')][_0x5361('0x1c')]);}_0x16ad4a[_0x5361('0x34')]=qs[_0x5361('0x35')](_0x19a960[_0x5361('0x2e')][_0x5361('0x35')]);_0x16ad4a[_0x5361('0x36')]=qs[_0x5361('0x2f')](_[_0x5361('0x37')](_0x19a960['query'],_0x2a53da[_0x5361('0x2f')]),_0x19fb75);if(_0x19a960[_0x5361('0x2e')][_0x5361('0x38')]){_0x16ad4a[_0x5361('0x36')]=_[_0x5361('0x39')](_0x16ad4a[_0x5361('0x36')],{'$or':_[_0x5361('0x2d')](_0x19fb75,function(_0x352979){if(_0x352979[_0x5361('0x3a')]!==_0x5361('0x3b')){var _0x5ea8fd={};_0x5ea8fd[_0x352979[_0x5361('0x28')]]={'$like':'%'+_0x19a960['query'][_0x5361('0x38')]+'%'};return _0x5ea8fd;}})});}_0x16ad4a=_[_0x5361('0x39')]({},_0x16ad4a,_0x19a960[_0x5361('0x3c')]);var _0xf9b05={'where':_0x16ad4a[_0x5361('0x36')]};return db[_0x5361('0x29')]['count'](_0xf9b05)['then'](function(_0x591047){_0x423d07[_0x5361('0x1b')]=_0x591047;if(_0x19a960['query']['includeAll']){_0x16ad4a[_0x5361('0x3d')]=[{'all':!![]}];}return db[_0x5361('0x29')][_0x5361('0x3e')](_0x16ad4a);})['then'](function(_0x3ccb36){_0x423d07['rows']=_0x3ccb36;return _0x423d07;})[_0x5361('0x25')](respondWithFilteredResult(_0x42fa2b,_0x16ad4a))[_0x5361('0x3f')](handleError(_0x42fa2b,null));};exports[_0x5361('0x40')]=function(_0x2b96f0,_0x22cadd){var _0x423046={'raw':!![],'where':{'id':_0x2b96f0[_0x5361('0x41')]['id']}},_0x1972a1={};_0x1972a1[_0x5361('0x2c')]=_[_0x5361('0x42')](db['SquareRecording'][_0x5361('0x2a')]);_0x1972a1[_0x5361('0x2e')]=_['keys'](_0x2b96f0['query']);_0x1972a1['filters']=_[_0x5361('0x30')](_0x1972a1['model'],_0x1972a1['query']);_0x423046[_0x5361('0x31')]=_[_0x5361('0x30')](_0x1972a1[_0x5361('0x2c')],qs[_0x5361('0x32')](_0x2b96f0[_0x5361('0x2e')][_0x5361('0x32')]));_0x423046[_0x5361('0x31')]=_0x423046[_0x5361('0x31')]['length']?_0x423046[_0x5361('0x31')]:_0x1972a1['model'];if(_0x2b96f0['query'][_0x5361('0x43')]){_0x423046[_0x5361('0x3d')]=[{'all':!![]}];}_0x423046=_['merge']({},_0x423046,_0x2b96f0[_0x5361('0x3c')]);return db[_0x5361('0x29')][_0x5361('0x44')](_0x423046)['then'](handleEntityNotFound(_0x22cadd,null))[_0x5361('0x25')](respondWithResult(_0x22cadd,null))[_0x5361('0x3f')](handleError(_0x22cadd,null));};exports[_0x5361('0x45')]=function(_0x40f88b,_0x41c2dd){return db[_0x5361('0x29')][_0x5361('0x45')](_0x40f88b['body'],{})['then'](respondWithResult(_0x41c2dd,0xc9))[_0x5361('0x3f')](handleError(_0x41c2dd,null));};exports['update']=function(_0x324a21,_0x53ac3d){if(_0x324a21[_0x5361('0x46')]['id']){delete _0x324a21[_0x5361('0x46')]['id'];}return db[_0x5361('0x29')][_0x5361('0x44')]({'where':{'id':_0x324a21[_0x5361('0x41')]['id']}})[_0x5361('0x25')](handleEntityNotFound(_0x53ac3d,null))[_0x5361('0x25')](saveUpdates(_0x324a21[_0x5361('0x46')],null))[_0x5361('0x25')](respondWithResult(_0x53ac3d,null))[_0x5361('0x3f')](handleError(_0x53ac3d,null));};exports[_0x5361('0x47')]=function(_0x1870c3,_0x3ed21f,_0x1dda45){var _0x11f95f=require(_0x5361('0x48'));var _0xfb980f=![];var _0x5a5fc8={};if(_0x1870c3[_0x5361('0x2e')]['type']&&_0x1870c3[_0x5361('0x2e')][_0x5361('0x3a')]===_0x5361('0x49')){_0x5a5fc8[_0x5361('0x49')]=_0x1870c3[_0x5361('0x41')]['id'];}else{_0x5a5fc8['id']=_0x1870c3['params']['id'];}return db[_0x5361('0x29')][_0x5361('0x44')]({'where':_0x5a5fc8,'attributes':['id',_0x5361('0x4a'),_0x5361('0x4b')],'raw':!![]})[_0x5361('0x25')](handleEntityNotFound(_0x3ed21f,null))['then'](function(_0x171fbe){if(_0x171fbe){var _0x2da1e3=_0x171fbe[_0x5361('0x4a')];var _0x42f9cc=util[_0x5361('0x4c')](_0x5361('0x4d'),_0x2da1e3);if(fs[_0x5361('0x4e')](_0x42f9cc)){_0xfb980f=!![];return _0x11f95f[_0x5361('0x4f')](_0x42f9cc,_0x2da1e3,config[_0x5361('0x50')][_0x5361('0x51')])[_0x5361('0x25')](function(){return _0x171fbe;});}return _0x171fbe;}})[_0x5361('0x25')](function(_0x1d1d72){if(_0x1d1d72){var _0x141216=_0x1d1d72[_0x5361('0x4a')];if(!fs[_0x5361('0x4e')](_0x141216)){throw new db[(_0x5361('0x52'))][(_0x5361('0x53'))](_0x5361('0x54'));}if(_0x1d1d72[_0x5361('0x4b')]){return _0x3ed21f[_0x5361('0x47')](_0x141216,_0x1d1d72[_0x5361('0x4b')]+path['extname'](_0x141216),function(){if(_0xfb980f){fs['unlink'](_0x141216);}});}else{return _0x3ed21f[_0x5361('0x47')](_0x141216,function(_0x48b39e){if(_0xfb980f){fs[_0x5361('0x55')](_0x141216);}});}}})[_0x5361('0x3f')](function(_0x43df6a){if(_0x43df6a[_0x5361('0x56')]===_0x5361('0x54')){_0x3ed21f[_0x5361('0x19')](0x194)[_0x5361('0x57')](_0x5361('0x58'));}else{return handleError(_0x3ed21f,null);}});};exports[_0x5361('0x59')]=function(_0x1d0df8,_0x1e47bc){return db['SquareRecording'][_0x5361('0x44')]({'where':{'id':_0x1d0df8[_0x5361('0x41')]['id']}})[_0x5361('0x25')](function(_0x5ae2b4){if(!_0x5ae2b4)throw new ReferenceError(_0x5361('0x5a'));return _0x5ae2b4;})[_0x5361('0x25')](function(_0x12a634){var _0x1f9325=_0x12a634[_0x5361('0x4a')];logger[_0x5361('0x5b')](_0x5361('0x5c'),_0x1f9325);if(!_['isNil'](_0x12a634[_0x5361('0x4a')])&&fs[_0x5361('0x4e')](_0x1f9325)){logger['info'](_0x5361('0x5d')+_0x1f9325+_0x5361('0x5e'));fs['unlinkSync'](_0x1f9325);}_0x1f9325=_0x1f9325+_0x5361('0x5f');if(!_[_0x5361('0x60')](_0x12a634['savePath'])&&fs['existsSync'](_0x1f9325)){logger[_0x5361('0x5b')](_0x5361('0x5d')+_0x1f9325+_0x5361('0x5e'));fs[_0x5361('0x61')](_0x1f9325);}return _0x12a634;})['then'](function(_0x11c694){if(!_0x11c694)throw new InternalError();return _0x11c694['destroy']();})['then'](function(){_0x1e47bc[_0x5361('0x19')](0xcc)[_0x5361('0x1a')]();})[_0x5361('0x3f')](handleError(_0x1e47bc,null));}; \ No newline at end of file +var _0x7920=['%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','unlinkSync','.cypher','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','save','destroy','then','error','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format'];(function(_0x4d5c73,_0x3fdd19){var _0xb5c564=function(_0x4fd53a){while(--_0x4fd53a){_0x4d5c73['push'](_0x4d5c73['shift']());}};_0xb5c564(++_0x3fdd19);}(_0x7920,0x131));var _0x0792=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x7920[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0x0792('0x0'));var emlformat=require(_0x0792('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0792('0x2'));var jsonpatch=require(_0x0792('0x3'));var rp=require(_0x0792('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0792('0x5'));var util=require(_0x0792('0x6'));var path=require(_0x0792('0x7'));var sox=require(_0x0792('0x8'));var csv=require(_0x0792('0x9'));var ejs=require(_0x0792('0xa'));var fs=require('fs');var _=require(_0x0792('0xb'));var squel=require(_0x0792('0xc'));var crypto=require(_0x0792('0xd'));var jsforce=require(_0x0792('0xe'));var deskjs=require(_0x0792('0xf'));var toCsv=require(_0x0792('0x9'));var querystring=require(_0x0792('0x10'));var Papa=require('papaparse');var Redis=require(_0x0792('0x11'));var authService=require(_0x0792('0x12'));var qs=require(_0x0792('0x13'));var as=require(_0x0792('0x14'));var hardwareService=require(_0x0792('0x15'));var logger=require(_0x0792('0x16'))(_0x0792('0x17'));var utils=require('../../config/utils');var config=require(_0x0792('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0792('0x19'))['db'];function respondWithStatusCode(_0x444372,_0x1dd744){_0x1dd744=_0x1dd744||0xcc;return function(_0x4e2db1){if(_0x4e2db1){return _0x444372[_0x0792('0x1a')](_0x1dd744);}return _0x444372['status'](_0x1dd744)[_0x0792('0x1b')]();};}function respondWithResult(_0x3aaf83,_0x48a251){_0x48a251=_0x48a251||0xc8;return function(_0x122fc3){if(_0x122fc3){return _0x3aaf83[_0x0792('0x1c')](_0x48a251)['json'](_0x122fc3);}};}function respondWithFilteredResult(_0x3530d8,_0x2906eb){return function(_0x3b7bc8){if(_0x3b7bc8){var _0x5a631e=_0x3b7bc8[_0x0792('0x1d')],_0x1676c6=_0x2906eb['offset'],_0x1333f3=_0x2906eb[_0x0792('0x1e')]+_0x2906eb[_0x0792('0x1f')],_0xbb8d6b;if(_0x1333f3>=_0x5a631e){_0x1333f3=_0x5a631e;_0xbb8d6b=0xc8;}else{_0xbb8d6b=0xce;}_0x3530d8[_0x0792('0x1c')](_0xbb8d6b);return _0x3530d8['set'](_0x0792('0x20'),_0x1676c6+'-'+_0x1333f3+'/'+_0x5a631e)[_0x0792('0x21')](_0x3b7bc8);}return null;};}function patchUpdates(_0x14f5b1){return function(_0x56596a){try{jsonpatch['apply'](_0x56596a,_0x14f5b1,!![]);}catch(_0x379a1f){return BPromise['reject'](_0x379a1f);}return _0x56596a[_0x0792('0x22')]();};}function saveUpdates(_0x461b3c,_0x593673){return function(_0x1c9244){if(_0x1c9244){return _0x1c9244['update'](_0x461b3c)['then'](function(_0x13840d){return _0x13840d;});}return null;};}function removeEntity(_0xebcd5f,_0x28d3b9){return function(_0x39f74c){if(_0x39f74c){return _0x39f74c[_0x0792('0x23')]()[_0x0792('0x24')](function(){_0xebcd5f[_0x0792('0x1c')](0xcc)[_0x0792('0x1b')]();});}};}function handleEntityNotFound(_0x5eac51,_0x58627e){return function(_0x461412){if(!_0x461412){_0x5eac51['sendStatus'](0x194);}return _0x461412;};}function handleError(_0x38f18e,_0x4fbada){_0x4fbada=_0x4fbada||0x1f4;return function(_0x5e438a){logger[_0x0792('0x25')](_0x5e438a[_0x0792('0x26')]);if(_0x5e438a[_0x0792('0x27')]){delete _0x5e438a['name'];}_0x38f18e[_0x0792('0x1c')](_0x4fbada)[_0x0792('0x28')](_0x5e438a);};}exports['index']=function(_0x7f9896,_0x2b8b27){var _0x30ead7={},_0xa51683={},_0x383aa4={'count':0x0,'rows':[]};var _0x3e1b1a=_[_0x0792('0x29')](db[_0x0792('0x2a')][_0x0792('0x2b')],function(_0x185408){return{'name':_0x185408[_0x0792('0x2c')],'type':_0x185408[_0x0792('0x2d')][_0x0792('0x2e')]};});_0xa51683[_0x0792('0x2f')]=_[_0x0792('0x29')](_0x3e1b1a,_0x0792('0x27'));_0xa51683[_0x0792('0x30')]=_[_0x0792('0x31')](_0x7f9896[_0x0792('0x30')]);_0xa51683[_0x0792('0x32')]=_[_0x0792('0x33')](_0xa51683['model'],_0xa51683['query']);_0x30ead7[_0x0792('0x34')]=_['intersection'](_0xa51683[_0x0792('0x2f')],qs[_0x0792('0x35')](_0x7f9896['query']['fields']));_0x30ead7[_0x0792('0x34')]=_0x30ead7[_0x0792('0x34')][_0x0792('0x36')]?_0x30ead7['attributes']:_0xa51683[_0x0792('0x2f')];if(!_0x7f9896[_0x0792('0x30')][_0x0792('0x37')](_0x0792('0x38'))){_0x30ead7[_0x0792('0x1f')]=qs[_0x0792('0x1f')](_0x7f9896[_0x0792('0x30')]['limit']);_0x30ead7[_0x0792('0x1e')]=qs[_0x0792('0x1e')](_0x7f9896[_0x0792('0x30')]['offset']);}_0x30ead7[_0x0792('0x39')]=qs[_0x0792('0x3a')](_0x7f9896[_0x0792('0x30')][_0x0792('0x3a')]);_0x30ead7['where']=qs[_0x0792('0x32')](_['pick'](_0x7f9896[_0x0792('0x30')],_0xa51683[_0x0792('0x32')]),_0x3e1b1a);if(_0x7f9896[_0x0792('0x30')][_0x0792('0x3b')]){_0x30ead7['where']=_[_0x0792('0x3c')](_0x30ead7[_0x0792('0x3d')],{'$or':_['map'](_0x3e1b1a,function(_0x3b5a52){if(_0x3b5a52[_0x0792('0x2d')]!==_0x0792('0x3e')){var _0x57aa68={};_0x57aa68[_0x3b5a52[_0x0792('0x27')]]={'$like':'%'+_0x7f9896[_0x0792('0x30')]['filter']+'%'};return _0x57aa68;}})});}_0x30ead7=_[_0x0792('0x3c')]({},_0x30ead7,_0x7f9896[_0x0792('0x3f')]);var _0x26e51f={'where':_0x30ead7['where']};return db['SquareRecording']['count'](_0x26e51f)[_0x0792('0x24')](function(_0x5f4927){_0x383aa4['count']=_0x5f4927;if(_0x7f9896[_0x0792('0x30')][_0x0792('0x40')]){_0x30ead7[_0x0792('0x41')]=[{'all':!![]}];}return db[_0x0792('0x2a')][_0x0792('0x42')](_0x30ead7);})[_0x0792('0x24')](function(_0x87f398){_0x383aa4[_0x0792('0x43')]=_0x87f398;return _0x383aa4;})[_0x0792('0x24')](respondWithFilteredResult(_0x2b8b27,_0x30ead7))[_0x0792('0x44')](handleError(_0x2b8b27,null));};exports['show']=function(_0x19936e,_0x21d9f6){var _0xc1a0a2={'raw':!![],'where':{'id':_0x19936e[_0x0792('0x45')]['id']}},_0xa53e11={};_0xa53e11['model']=_[_0x0792('0x31')](db[_0x0792('0x2a')][_0x0792('0x2b')]);_0xa53e11['query']=_[_0x0792('0x31')](_0x19936e[_0x0792('0x30')]);_0xa53e11[_0x0792('0x32')]=_[_0x0792('0x33')](_0xa53e11[_0x0792('0x2f')],_0xa53e11[_0x0792('0x30')]);_0xc1a0a2[_0x0792('0x34')]=_[_0x0792('0x33')](_0xa53e11[_0x0792('0x2f')],qs['fields'](_0x19936e[_0x0792('0x30')][_0x0792('0x35')]));_0xc1a0a2[_0x0792('0x34')]=_0xc1a0a2['attributes'][_0x0792('0x36')]?_0xc1a0a2[_0x0792('0x34')]:_0xa53e11[_0x0792('0x2f')];if(_0x19936e[_0x0792('0x30')][_0x0792('0x40')]){_0xc1a0a2[_0x0792('0x41')]=[{'all':!![]}];}_0xc1a0a2=_['merge']({},_0xc1a0a2,_0x19936e[_0x0792('0x3f')]);return db[_0x0792('0x2a')][_0x0792('0x46')](_0xc1a0a2)[_0x0792('0x24')](handleEntityNotFound(_0x21d9f6,null))[_0x0792('0x24')](respondWithResult(_0x21d9f6,null))[_0x0792('0x44')](handleError(_0x21d9f6,null));};exports[_0x0792('0x47')]=function(_0x1b3b36,_0x3249c4){return db[_0x0792('0x2a')][_0x0792('0x47')](_0x1b3b36[_0x0792('0x48')],{})[_0x0792('0x24')](respondWithResult(_0x3249c4,0xc9))[_0x0792('0x44')](handleError(_0x3249c4,null));};exports['update']=function(_0x310d56,_0x17ad1b){if(_0x310d56[_0x0792('0x48')]['id']){delete _0x310d56[_0x0792('0x48')]['id'];}return db['SquareRecording'][_0x0792('0x46')]({'where':{'id':_0x310d56[_0x0792('0x45')]['id']}})[_0x0792('0x24')](handleEntityNotFound(_0x17ad1b,null))[_0x0792('0x24')](saveUpdates(_0x310d56[_0x0792('0x48')],null))[_0x0792('0x24')](respondWithResult(_0x17ad1b,null))[_0x0792('0x44')](handleError(_0x17ad1b,null));};exports[_0x0792('0x49')]=function(_0x2e7c23,_0x464bc9,_0x48c1e5){var _0xf24269=require(_0x0792('0x4a'));var _0x388d94=![];var _0x4a5bc4={};if(_0x2e7c23[_0x0792('0x30')][_0x0792('0x2d')]&&_0x2e7c23['query'][_0x0792('0x2d')]===_0x0792('0x4b')){_0x4a5bc4['uniqueid']=_0x2e7c23[_0x0792('0x45')]['id'];}else{_0x4a5bc4['id']=_0x2e7c23[_0x0792('0x45')]['id'];}return db['SquareRecording'][_0x0792('0x46')]({'where':_0x4a5bc4,'attributes':['id',_0x0792('0x4c'),_0x0792('0x4d')],'raw':!![]})[_0x0792('0x24')](handleEntityNotFound(_0x464bc9,null))[_0x0792('0x24')](function(_0x2a22b7){if(_0x2a22b7){var _0x335160=_0x2a22b7['savePath'];var _0x32db27=util[_0x0792('0x4e')](_0x0792('0x4f'),_0x335160);if(fs[_0x0792('0x50')](_0x32db27)){_0x388d94=!![];return _0xf24269[_0x0792('0x51')](_0x32db27,_0x335160,config[_0x0792('0x52')]['recording'])[_0x0792('0x24')](function(){return _0x2a22b7;});}return _0x2a22b7;}})[_0x0792('0x24')](function(_0x31c464){if(_0x31c464){var _0x2de576=_0x31c464[_0x0792('0x4c')];if(!fs['existsSync'](_0x2de576)){throw new db[(_0x0792('0x53'))][(_0x0792('0x54'))](_0x0792('0x55'));}if(_0x31c464[_0x0792('0x4d')]){return _0x464bc9[_0x0792('0x49')](_0x2de576,_0x31c464[_0x0792('0x4d')]+path[_0x0792('0x56')](_0x2de576),function(){if(_0x388d94){fs[_0x0792('0x57')](_0x2de576);}});}else{return _0x464bc9[_0x0792('0x49')](_0x2de576,function(_0x1dd0f7){if(_0x388d94){fs[_0x0792('0x57')](_0x2de576);}});}}})[_0x0792('0x44')](function(_0x2d0156){if(_0x2d0156[_0x0792('0x58')]==='SquareRecording\x20not\x20found'){_0x464bc9['status'](0x194)[_0x0792('0x28')](_0x0792('0x59'));}else{return handleError(_0x464bc9,null);}});};exports[_0x0792('0x23')]=function(_0x261850,_0x4c5368){return db['SquareRecording'][_0x0792('0x46')]({'where':{'id':_0x261850[_0x0792('0x45')]['id']}})[_0x0792('0x24')](function(_0x396750){if(!_0x396750)throw new ReferenceError(_0x0792('0x5a'));return _0x396750;})[_0x0792('0x24')](function(_0x30765f){var _0x473eb8=_0x30765f['savePath'];logger[_0x0792('0x5b')](_0x0792('0x5c'),_0x473eb8);if(!_[_0x0792('0x5d')](_0x30765f['savePath'])&&fs[_0x0792('0x50')](_0x473eb8)){logger[_0x0792('0x5b')]('File:\x20\x22'+_0x473eb8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0792('0x5e')](_0x473eb8);}_0x473eb8=_0x473eb8+_0x0792('0x5f');if(!_[_0x0792('0x5d')](_0x30765f['savePath'])&&fs[_0x0792('0x50')](_0x473eb8)){logger[_0x0792('0x5b')]('File:\x20\x22'+_0x473eb8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0792('0x5e')](_0x473eb8);}return _0x30765f;})[_0x0792('0x24')](function(_0x18846a){if(!_0x18846a)throw new InternalError();return _0x18846a[_0x0792('0x23')]();})[_0x0792('0x24')](function(){_0x4c5368['status'](0xcc)['end']();})[_0x0792('0x44')](handleError(_0x4c5368,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 6ed5c26..9fa9ef9 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 _0xd4f4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x39c1dd,_0x43e0d2){_0x39c1dd=_0x39c1dd-0x0;var _0x4564b2=_0xd4f4[_0x39c1dd];return _0x4564b2;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var logger=require(_0x4d4f('0x2'))(_0x4d4f('0x3'));var moment=require(_0x4d4f('0x4'));var BPromise=require(_0x4d4f('0x5'));var rp=require(_0x4d4f('0x6'));var fs=require('fs');var path=require(_0x4d4f('0x7'));var rimraf=require(_0x4d4f('0x8'));var config=require(_0x4d4f('0x9'));var attributes=require(_0x4d4f('0xa'));module['exports']=function(_0x5f451b,_0x5e38d2){return _0x5f451b[_0x4d4f('0xb')](_0x4d4f('0xc'),attributes,{'tableName':_0x4d4f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1678=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment'];(function(_0x240978,_0x49ef3a){var _0x566c20=function(_0x19e970){while(--_0x19e970){_0x240978['push'](_0x240978['shift']());}};_0x566c20(++_0x49ef3a);}(_0x1678,0x17b));var _0x8167=function(_0x16b8ea,_0xfc7e77){_0x16b8ea=_0x16b8ea-0x0;var _0x562e17=_0x1678[_0x16b8ea];return _0x562e17;};'use strict';var _=require(_0x8167('0x0'));var util=require(_0x8167('0x1'));var logger=require(_0x8167('0x2'))(_0x8167('0x3'));var moment=require(_0x8167('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8167('0x5'));var rimraf=require(_0x8167('0x6'));var config=require(_0x8167('0x7'));var attributes=require(_0x8167('0x8'));module[_0x8167('0x9')]=function(_0xa9fd75,_0x30f248){return _0xa9fd75['define'](_0x8167('0xa'),attributes,{'tableName':_0x8167('0xb'),'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 e312912..1e7cd79 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 _0xc454=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','catch','create','options','raw','CreateSquareRecording','lodash'];(function(_0x258cc9,_0xe679e7){var _0xd7b614=function(_0x3c1cc7){while(--_0x3c1cc7){_0x258cc9['push'](_0x258cc9['shift']());}};_0xd7b614(++_0xe679e7);}(_0xc454,0x8b));var _0x4c45=function(_0x249338,_0x19df5f){_0x249338=_0x249338-0x0;var _0xd02bb0=_0xc454[_0x249338];return _0xd02bb0;};'use strict';var _=require(_0x4c45('0x0'));var util=require('util');var moment=require(_0x4c45('0x1'));var BPromise=require(_0x4c45('0x2'));var rs=require(_0x4c45('0x3'));var fs=require('fs');var Redis=require(_0x4c45('0x4'));var db=require(_0x4c45('0x5'))['db'];var utils=require(_0x4c45('0x6'));var logger=require(_0x4c45('0x7'))(_0x4c45('0x8'));var config=require('../../config/environment');var jayson=require(_0x4c45('0x9'));var client=jayson[_0x4c45('0xa')][_0x4c45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb2e242,_0x4b79a2,_0x4ed250){return new BPromise(function(_0x4a7c41,_0x1af663){return client[_0x4c45('0xc')](_0xb2e242,_0x4ed250)[_0x4c45('0xd')](function(_0x581596){logger[_0x4c45('0xe')]('SquareRecording,\x20%s,\x20%s',_0x4b79a2,_0x4c45('0xf'));logger[_0x4c45('0x10')](_0x4c45('0x11'),_0x4b79a2,_0x4c45('0xf'),JSON[_0x4c45('0x12')](_0x581596));if(_0x581596[_0x4c45('0x13')]){if(_0x581596['error'][_0x4c45('0x14')]===0x1f4){logger[_0x4c45('0x13')](_0x4c45('0x15'),_0x4b79a2,_0x581596[_0x4c45('0x13')][_0x4c45('0x16')]);return _0x1af663(_0x581596[_0x4c45('0x13')]['message']);}logger[_0x4c45('0x13')](_0x4c45('0x15'),_0x4b79a2,_0x581596[_0x4c45('0x13')][_0x4c45('0x16')]);return _0x4a7c41(_0x581596[_0x4c45('0x13')][_0x4c45('0x16')]);}else{logger[_0x4c45('0xe')](_0x4c45('0x15'),_0x4b79a2,_0x4c45('0xf'));_0x4a7c41(_0x581596['result']['message']);}})[_0x4c45('0x17')](function(_0x4173cc){logger['error'](_0x4c45('0x15'),_0x4b79a2,_0x4173cc);_0x1af663(_0x4173cc);});});}exports['CreateSquareRecording']=function(_0x523b40){var _0xdb2c16=this;return new Promise(function(_0x5b4fda,_0x1b700e){return db['SquareRecording'][_0x4c45('0x18')](_0x523b40['body'],{'raw':_0x523b40[_0x4c45('0x19')]?_0x523b40[_0x4c45('0x19')][_0x4c45('0x1a')]===undefined?!![]:![]:!![]})[_0x4c45('0xd')](function(_0x31ca2c){logger['info'](_0x4c45('0x1b'),_0x523b40);logger['debug'](_0x4c45('0x1b'),_0x523b40,JSON['stringify'](_0x31ca2c));_0x5b4fda(_0x31ca2c);})['catch'](function(_0x3a6c8e){logger['error'](_0x4c45('0x1b'),_0x3a6c8e[_0x4c45('0x16')],_0x523b40);_0x1b700e(_0xdb2c16[_0x4c45('0x13')](0x1f4,_0x3a6c8e[_0x4c45('0x16')]));});});}; \ No newline at end of file +var _0xd128=['client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xd128,0xbb));var _0x8d12=function(_0x44449b,_0x5e16ea){_0x44449b=_0x44449b-0x0;var _0x1dde55=_0xd128[_0x44449b];return _0x1dde55;};'use strict';var _=require('lodash');var util=require(_0x8d12('0x0'));var moment=require(_0x8d12('0x1'));var BPromise=require(_0x8d12('0x2'));var rs=require(_0x8d12('0x3'));var fs=require('fs');var Redis=require(_0x8d12('0x4'));var db=require(_0x8d12('0x5'))['db'];var utils=require(_0x8d12('0x6'));var logger=require(_0x8d12('0x7'))(_0x8d12('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8d12('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52d9da,_0x3a5b7a,_0xbb8b9a){return new BPromise(function(_0x11edb7,_0x10513c){return client[_0x8d12('0xa')](_0x52d9da,_0xbb8b9a)[_0x8d12('0xb')](function(_0x486dd5){logger[_0x8d12('0xc')](_0x8d12('0xd'),_0x3a5b7a,_0x8d12('0xe'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3a5b7a,_0x8d12('0xe'),JSON[_0x8d12('0xf')](_0x486dd5));if(_0x486dd5['error']){if(_0x486dd5['error'][_0x8d12('0x10')]===0x1f4){logger[_0x8d12('0x11')](_0x8d12('0xd'),_0x3a5b7a,_0x486dd5['error'][_0x8d12('0x12')]);return _0x10513c(_0x486dd5['error'][_0x8d12('0x12')]);}logger[_0x8d12('0x11')](_0x8d12('0xd'),_0x3a5b7a,_0x486dd5[_0x8d12('0x11')]['message']);return _0x11edb7(_0x486dd5[_0x8d12('0x11')][_0x8d12('0x12')]);}else{logger[_0x8d12('0xc')]('SquareRecording,\x20%s,\x20%s',_0x3a5b7a,'request\x20sent');_0x11edb7(_0x486dd5[_0x8d12('0x13')][_0x8d12('0x12')]);}})[_0x8d12('0x14')](function(_0x89cfac){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3a5b7a,_0x89cfac);_0x10513c(_0x89cfac);});});}exports['CreateSquareRecording']=function(_0xa957b8){var _0x4401e2=this;return new Promise(function(_0x4a44a8,_0x1f9735){return db[_0x8d12('0x15')][_0x8d12('0x16')](_0xa957b8[_0x8d12('0x17')],{'raw':_0xa957b8[_0x8d12('0x18')]?_0xa957b8[_0x8d12('0x18')][_0x8d12('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x186f64){logger[_0x8d12('0xc')](_0x8d12('0x1a'),_0xa957b8);logger[_0x8d12('0x1b')](_0x8d12('0x1a'),_0xa957b8,JSON['stringify'](_0x186f64));_0x4a44a8(_0x186f64);})[_0x8d12('0x14')](function(_0x1564fc){logger[_0x8d12('0x11')]('CreateSquareRecording',_0x1564fc['message'],_0xa957b8);_0x1f9735(_0x4401e2[_0x8d12('0x11')](0x1f4,_0x1564fc[_0x8d12('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 24a1ad4..0fbf019 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 _0x2ae0=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./squareReport.controller'];(function(_0x5f25a1,_0x195396){var _0x22a24b=function(_0xdc3194){while(--_0xdc3194){_0x5f25a1['push'](_0x5f25a1['shift']());}};_0x22a24b(++_0x195396);}(_0x2ae0,0xd1));var _0x02ae=function(_0x2354a8,_0x18ee8b){_0x2354a8=_0x2354a8-0x0;var _0x2d0bc3=_0x2ae0[_0x2354a8];return _0x2d0bc3;};'use strict';var multer=require(_0x02ae('0x0'));var util=require(_0x02ae('0x1'));var path=require(_0x02ae('0x2'));var timeout=require(_0x02ae('0x3'));var express=require('express');var router=express[_0x02ae('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x02ae('0x5'));var config=require('../../config/environment');var controller=require(_0x02ae('0x6'));router[_0x02ae('0x7')]('/',auth[_0x02ae('0x8')](),controller[_0x02ae('0x9')]);router[_0x02ae('0x7')]('/describe',auth[_0x02ae('0x8')](),controller['describe']);router[_0x02ae('0x7')](_0x02ae('0xa'),auth['isAuthenticated'](),controller[_0x02ae('0xb')]);router[_0x02ae('0xc')]('/',auth[_0x02ae('0x8')](),controller[_0x02ae('0xd')]);router[_0x02ae('0xe')](_0x02ae('0xa'),auth[_0x02ae('0x8')](),controller[_0x02ae('0xf')]);router['delete']('/:id',auth[_0x02ae('0x8')](),controller[_0x02ae('0x10')]);module[_0x02ae('0x11')]=router; \ No newline at end of file +var _0x9bbe=['update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./squareReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x3c9cbe,_0x1a01f9){var _0x1fb30d=function(_0xd8c3a3){while(--_0xd8c3a3){_0x3c9cbe['push'](_0x3c9cbe['shift']());}};_0x1fb30d(++_0x1a01f9);}(_0x9bbe,0xce));var _0xe9bb=function(_0xd3b53e,_0x223052){_0xd3b53e=_0xd3b53e-0x0;var _0x431bcb=_0x9bbe[_0xd3b53e];return _0x431bcb;};'use strict';var multer=require(_0xe9bb('0x0'));var util=require('util');var path=require(_0xe9bb('0x1'));var timeout=require('connect-timeout');var express=require(_0xe9bb('0x2'));var router=express[_0xe9bb('0x3')]();var auth=require(_0xe9bb('0x4'));var interaction=require(_0xe9bb('0x5'));var config=require('../../config/environment');var controller=require(_0xe9bb('0x6'));router[_0xe9bb('0x7')]('/',auth[_0xe9bb('0x8')](),controller[_0xe9bb('0x9')]);router[_0xe9bb('0x7')](_0xe9bb('0xa'),auth[_0xe9bb('0x8')](),controller[_0xe9bb('0xb')]);router[_0xe9bb('0x7')](_0xe9bb('0xc'),auth[_0xe9bb('0x8')](),controller['show']);router[_0xe9bb('0xd')]('/',auth[_0xe9bb('0x8')](),controller[_0xe9bb('0xe')]);router['put'](_0xe9bb('0xc'),auth[_0xe9bb('0x8')](),controller[_0xe9bb('0xf')]);router['delete'](_0xe9bb('0xc'),auth[_0xe9bb('0x8')](),controller[_0xe9bb('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 560a5a0..34d83b7 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 _0x2b9f=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2b9f,0x18e));var _0xf2b9=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x2b9f[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require(_0xf2b9('0x0'));module[_0xf2b9('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf2b9('0x2')]},'type':{'type':Sequelize[_0xf2b9('0x2')]},'uniqueid':{'type':Sequelize[_0xf2b9('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf2b9('0x2')]},'calleridname':{'type':Sequelize[_0xf2b9('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xf2b9('0x2')]},'callington':{'type':Sequelize[_0xf2b9('0x2')]},'callingtns':{'type':Sequelize[_0xf2b9('0x2')]},'dnid':{'type':Sequelize[_0xf2b9('0x2')]},'rdnis':{'type':Sequelize[_0xf2b9('0x2')]},'context':{'type':Sequelize[_0xf2b9('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf2b9('0x2')]},'enhanced':{'type':Sequelize[_0xf2b9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xf2b9('0x2')]},'joinAt':{'type':Sequelize[_0xf2b9('0x3')]},'leaveAt':{'type':Sequelize[_0xf2b9('0x3')]},'bot':{'type':Sequelize[_0xf2b9('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xed9e=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xed9e,0xbf));var _0xeed9=function(_0x2bced3,_0x5e0d41){_0x2bced3=_0x2bced3-0x0;var _0x1ed985=_0xed9e[_0x2bced3];return _0x1ed985;};'use strict';var Sequelize=require(_0xeed9('0x0'));module[_0xeed9('0x1')]={'network':{'type':Sequelize[_0xeed9('0x2')]},'network_script':{'type':Sequelize[_0xeed9('0x2')]},'request':{'type':Sequelize[_0xeed9('0x2')]},'channel':{'type':Sequelize[_0xeed9('0x2')]},'language':{'type':Sequelize[_0xeed9('0x2')]},'type':{'type':Sequelize[_0xeed9('0x2')]},'uniqueid':{'type':Sequelize[_0xeed9('0x2')]},'version':{'type':Sequelize[_0xeed9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xeed9('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xeed9('0x2')]},'rdnis':{'type':Sequelize[_0xeed9('0x2')]},'context':{'type':Sequelize[_0xeed9('0x2')]},'extension':{'type':Sequelize[_0xeed9('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xeed9('0x2')]},'accountcode':{'type':Sequelize[_0xeed9('0x2')]},'threadid':{'type':Sequelize[_0xeed9('0x2')]},'project_name':{'type':Sequelize[_0xeed9('0x2')]},'joinAt':{'type':Sequelize[_0xeed9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xeed9('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 41f682d..6808ad4 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 _0xee8f=['moment','path','sox','to-csv','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','length','include','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x4da8ff,_0xf73399){var _0x264550=function(_0x32e7cf){while(--_0x32e7cf){_0x4da8ff['push'](_0x4da8ff['shift']());}};_0x264550(++_0xf73399);}(_0xee8f,0x1ed));var _0xfee8=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xee8f[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfee8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfee8('0x1'));var jsonpatch=require(_0xfee8('0x2'));var rp=require(_0xfee8('0x3'));var moment=require(_0xfee8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfee8('0x5'));var sox=require(_0xfee8('0x6'));var csv=require(_0xfee8('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfee8('0x8'));var squel=require(_0xfee8('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfee8('0xa'));var toCsv=require(_0xfee8('0x7'));var querystring=require(_0xfee8('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfee8('0xc'));var qs=require(_0xfee8('0xd'));var as=require(_0xfee8('0xe'));var hardwareService=require(_0xfee8('0xf'));var logger=require(_0xfee8('0x10'))(_0xfee8('0x11'));var utils=require(_0xfee8('0x12'));var config=require(_0xfee8('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55023b,_0x3fb040){_0x3fb040=_0x3fb040||0xcc;return function(_0x4493a5){if(_0x4493a5){return _0x55023b[_0xfee8('0x14')](_0x3fb040);}return _0x55023b['status'](_0x3fb040)['end']();};}function respondWithResult(_0x16364d,_0x36230a){_0x36230a=_0x36230a||0xc8;return function(_0x11aeb6){if(_0x11aeb6){return _0x16364d[_0xfee8('0x15')](_0x36230a)[_0xfee8('0x16')](_0x11aeb6);}};}function respondWithFilteredResult(_0x1f85c2,_0x1c285f){return function(_0xc8de11){if(_0xc8de11){var _0x53f517=_0xc8de11['count'],_0x17e244=_0x1c285f['offset'],_0x3e3c76=_0x1c285f[_0xfee8('0x17')]+_0x1c285f[_0xfee8('0x18')],_0x373327;if(_0x3e3c76>=_0x53f517){_0x3e3c76=_0x53f517;_0x373327=0xc8;}else{_0x373327=0xce;}_0x1f85c2['status'](_0x373327);return _0x1f85c2[_0xfee8('0x19')](_0xfee8('0x1a'),_0x17e244+'-'+_0x3e3c76+'/'+_0x53f517)['json'](_0xc8de11);}return null;};}function patchUpdates(_0x45df7b){return function(_0x587c14){try{jsonpatch['apply'](_0x587c14,_0x45df7b,!![]);}catch(_0x2cf4f4){return BPromise[_0xfee8('0x1b')](_0x2cf4f4);}return _0x587c14[_0xfee8('0x1c')]();};}function saveUpdates(_0x10babd,_0x48e051){return function(_0x32f255){if(_0x32f255){return _0x32f255[_0xfee8('0x1d')](_0x10babd)[_0xfee8('0x1e')](function(_0x3a3ffd){return _0x3a3ffd;});}return null;};}function removeEntity(_0x2e9e1b,_0x2401a3){return function(_0xe48425){if(_0xe48425){return _0xe48425[_0xfee8('0x1f')]()[_0xfee8('0x1e')](function(){_0x2e9e1b['status'](0xcc)[_0xfee8('0x20')]();});}};}function handleEntityNotFound(_0x51d263,_0x21d42c){return function(_0x5df4c2){if(!_0x5df4c2){_0x51d263[_0xfee8('0x14')](0x194);}return _0x5df4c2;};}function handleError(_0x45f90e,_0x4f8940){_0x4f8940=_0x4f8940||0x1f4;return function(_0x30e9a0){logger[_0xfee8('0x21')](_0x30e9a0['stack']);if(_0x30e9a0[_0xfee8('0x22')]){delete _0x30e9a0[_0xfee8('0x22')];}_0x45f90e[_0xfee8('0x15')](_0x4f8940)[_0xfee8('0x23')](_0x30e9a0);};}exports[_0xfee8('0x24')]=function(_0x4fbc95,_0x14a335){var _0x42a9e0={},_0x40f658={},_0x3efc69={'count':0x0,'rows':[]};var _0x254304=_[_0xfee8('0x25')](db[_0xfee8('0x26')][_0xfee8('0x27')],function(_0x3f5914){return{'name':_0x3f5914[_0xfee8('0x28')],'type':_0x3f5914[_0xfee8('0x29')][_0xfee8('0x2a')]};});_0x40f658['model']=_[_0xfee8('0x25')](_0x254304,_0xfee8('0x22'));_0x40f658['query']=_[_0xfee8('0x2b')](_0x4fbc95['query']);_0x40f658['filters']=_[_0xfee8('0x2c')](_0x40f658[_0xfee8('0x2d')],_0x40f658[_0xfee8('0x2e')]);_0x42a9e0[_0xfee8('0x2f')]=_[_0xfee8('0x2c')](_0x40f658[_0xfee8('0x2d')],qs['fields'](_0x4fbc95[_0xfee8('0x2e')][_0xfee8('0x30')]));_0x42a9e0[_0xfee8('0x2f')]=_0x42a9e0[_0xfee8('0x2f')]['length']?_0x42a9e0['attributes']:_0x40f658[_0xfee8('0x2d')];if(!_0x4fbc95[_0xfee8('0x2e')][_0xfee8('0x31')](_0xfee8('0x32'))){_0x42a9e0[_0xfee8('0x18')]=qs[_0xfee8('0x18')](_0x4fbc95[_0xfee8('0x2e')][_0xfee8('0x18')]);_0x42a9e0[_0xfee8('0x17')]=qs[_0xfee8('0x17')](_0x4fbc95['query'][_0xfee8('0x17')]);}_0x42a9e0['order']=qs['sort'](_0x4fbc95['query'][_0xfee8('0x33')]);_0x42a9e0[_0xfee8('0x34')]=qs[_0xfee8('0x35')](_[_0xfee8('0x36')](_0x4fbc95['query'],_0x40f658[_0xfee8('0x35')]),_0x254304);if(_0x4fbc95[_0xfee8('0x2e')][_0xfee8('0x37')]){_0x42a9e0[_0xfee8('0x34')]=_[_0xfee8('0x38')](_0x42a9e0[_0xfee8('0x34')],{'$or':_[_0xfee8('0x25')](_0x254304,function(_0x57fe3b){if(_0x57fe3b[_0xfee8('0x29')]!==_0xfee8('0x39')){var _0x372e23={};_0x372e23[_0x57fe3b[_0xfee8('0x22')]]={'$like':'%'+_0x4fbc95[_0xfee8('0x2e')][_0xfee8('0x37')]+'%'};return _0x372e23;}})});}_0x42a9e0=_[_0xfee8('0x38')]({},_0x42a9e0,_0x4fbc95[_0xfee8('0x3a')]);var _0x528666={'where':_0x42a9e0['where']};return db[_0xfee8('0x26')][_0xfee8('0x3b')](_0x528666)[_0xfee8('0x1e')](function(_0x4097d1){_0x3efc69[_0xfee8('0x3b')]=_0x4097d1;if(_0x4fbc95[_0xfee8('0x2e')][_0xfee8('0x3c')]){_0x42a9e0['include']=[{'all':!![]}];}return db['SquareReport'][_0xfee8('0x3d')](_0x42a9e0);})[_0xfee8('0x1e')](function(_0x304e65){_0x3efc69[_0xfee8('0x3e')]=_0x304e65;return _0x3efc69;})[_0xfee8('0x1e')](respondWithFilteredResult(_0x14a335,_0x42a9e0))['catch'](handleError(_0x14a335,null));};exports['show']=function(_0x3d6de0,_0x31c6b3){var _0x63aca7={'raw':!![],'where':{'id':_0x3d6de0[_0xfee8('0x3f')]['id']}},_0x16be93={};_0x16be93[_0xfee8('0x2d')]=_[_0xfee8('0x2b')](db['SquareReport'][_0xfee8('0x27')]);_0x16be93['query']=_[_0xfee8('0x2b')](_0x3d6de0[_0xfee8('0x2e')]);_0x16be93[_0xfee8('0x35')]=_[_0xfee8('0x2c')](_0x16be93[_0xfee8('0x2d')],_0x16be93[_0xfee8('0x2e')]);_0x63aca7[_0xfee8('0x2f')]=_['intersection'](_0x16be93[_0xfee8('0x2d')],qs['fields'](_0x3d6de0[_0xfee8('0x2e')]['fields']));_0x63aca7[_0xfee8('0x2f')]=_0x63aca7[_0xfee8('0x2f')][_0xfee8('0x40')]?_0x63aca7[_0xfee8('0x2f')]:_0x16be93['model'];if(_0x3d6de0[_0xfee8('0x2e')][_0xfee8('0x3c')]){_0x63aca7[_0xfee8('0x41')]=[{'all':!![]}];}_0x63aca7=_[_0xfee8('0x38')]({},_0x63aca7,_0x3d6de0[_0xfee8('0x3a')]);return db['SquareReport'][_0xfee8('0x42')](_0x63aca7)['then'](handleEntityNotFound(_0x31c6b3,null))[_0xfee8('0x1e')](respondWithResult(_0x31c6b3,null))['catch'](handleError(_0x31c6b3,null));};exports[_0xfee8('0x43')]=function(_0x14b9b5,_0x320617){return db[_0xfee8('0x26')][_0xfee8('0x43')](_0x14b9b5[_0xfee8('0x44')],{})[_0xfee8('0x1e')](respondWithResult(_0x320617,0xc9))[_0xfee8('0x45')](handleError(_0x320617,null));};exports[_0xfee8('0x1d')]=function(_0x2c351b,_0x228b9e){if(_0x2c351b[_0xfee8('0x44')]['id']){delete _0x2c351b[_0xfee8('0x44')]['id'];}return db[_0xfee8('0x26')][_0xfee8('0x42')]({'where':{'id':_0x2c351b[_0xfee8('0x3f')]['id']}})[_0xfee8('0x1e')](handleEntityNotFound(_0x228b9e,null))[_0xfee8('0x1e')](saveUpdates(_0x2c351b['body'],null))[_0xfee8('0x1e')](respondWithResult(_0x228b9e,null))[_0xfee8('0x45')](handleError(_0x228b9e,null));};exports['destroy']=function(_0x395011,_0x3c1096){return db[_0xfee8('0x26')][_0xfee8('0x42')]({'where':{'id':_0x395011[_0xfee8('0x3f')]['id']}})[_0xfee8('0x1e')](handleEntityNotFound(_0x3c1096,null))[_0xfee8('0x1e')](removeEntity(_0x3c1096,null))[_0xfee8('0x45')](handleError(_0x3c1096,null));};exports[_0xfee8('0x46')]=function(_0x1159a1,_0xa10241){return db[_0xfee8('0x26')][_0xfee8('0x46')]()['then'](respondWithResult(_0xa10241,null))[_0xfee8('0x45')](handleError(_0xa10241,null));}; \ No newline at end of file +var _0xdded=['findAll','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xdded,0x17a));var _0xddde=function(_0x352377,_0x24f512){_0x352377=_0x352377-0x0;var _0x1d7d9a=_0xdded[_0x352377];return _0x1d7d9a;};'use strict';var pdf=require(_0xddde('0x0'));var emlformat=require(_0xddde('0x1'));var rimraf=require(_0xddde('0x2'));var zipdir=require(_0xddde('0x3'));var jsonpatch=require(_0xddde('0x4'));var rp=require(_0xddde('0x5'));var moment=require('moment');var BPromise=require(_0xddde('0x6'));var Mustache=require(_0xddde('0x7'));var util=require(_0xddde('0x8'));var path=require(_0xddde('0x9'));var sox=require(_0xddde('0xa'));var csv=require(_0xddde('0xb'));var ejs=require(_0xddde('0xc'));var fs=require('fs');var _=require(_0xddde('0xd'));var squel=require(_0xddde('0xe'));var crypto=require(_0xddde('0xf'));var jsforce=require(_0xddde('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xddde('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xddde('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xddde('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddde('0x13'))(_0xddde('0x14'));var utils=require(_0xddde('0x15'));var config=require(_0xddde('0x16'));var licenseUtil=require(_0xddde('0x17'));var db=require(_0xddde('0x18'))['db'];function respondWithStatusCode(_0x25fadc,_0x35172e){_0x35172e=_0x35172e||0xcc;return function(_0x57e121){if(_0x57e121){return _0x25fadc[_0xddde('0x19')](_0x35172e);}return _0x25fadc[_0xddde('0x1a')](_0x35172e)[_0xddde('0x1b')]();};}function respondWithResult(_0x860ff4,_0x7cbcee){_0x7cbcee=_0x7cbcee||0xc8;return function(_0x31c111){if(_0x31c111){return _0x860ff4['status'](_0x7cbcee)[_0xddde('0x1c')](_0x31c111);}};}function respondWithFilteredResult(_0xbe1df5,_0x3698d4){return function(_0x48f602){if(_0x48f602){var _0x5de7ce=_0x48f602[_0xddde('0x1d')],_0xadd497=_0x3698d4[_0xddde('0x1e')],_0x4e98fd=_0x3698d4[_0xddde('0x1e')]+_0x3698d4[_0xddde('0x1f')],_0x30a9da;if(_0x4e98fd>=_0x5de7ce){_0x4e98fd=_0x5de7ce;_0x30a9da=0xc8;}else{_0x30a9da=0xce;}_0xbe1df5['status'](_0x30a9da);return _0xbe1df5[_0xddde('0x20')](_0xddde('0x21'),_0xadd497+'-'+_0x4e98fd+'/'+_0x5de7ce)['json'](_0x48f602);}return null;};}function patchUpdates(_0x221df0){return function(_0x1185f9){try{jsonpatch['apply'](_0x1185f9,_0x221df0,!![]);}catch(_0x5ae808){return BPromise[_0xddde('0x22')](_0x5ae808);}return _0x1185f9['save']();};}function saveUpdates(_0x1ef35a,_0x5175bd){return function(_0x1576ca){if(_0x1576ca){return _0x1576ca[_0xddde('0x23')](_0x1ef35a)['then'](function(_0x4ae0a8){return _0x4ae0a8;});}return null;};}function removeEntity(_0x3cfd91,_0x107bca){return function(_0x97bb0f){if(_0x97bb0f){return _0x97bb0f[_0xddde('0x24')]()[_0xddde('0x25')](function(){_0x3cfd91[_0xddde('0x1a')](0xcc)[_0xddde('0x1b')]();});}};}function handleEntityNotFound(_0x56a33a,_0x59320f){return function(_0x3daa4a){if(!_0x3daa4a){_0x56a33a[_0xddde('0x19')](0x194);}return _0x3daa4a;};}function handleError(_0x40f2d6,_0x306c01){_0x306c01=_0x306c01||0x1f4;return function(_0xdb57ef){logger['error'](_0xdb57ef[_0xddde('0x26')]);if(_0xdb57ef[_0xddde('0x27')]){delete _0xdb57ef['name'];}_0x40f2d6['status'](_0x306c01)[_0xddde('0x28')](_0xdb57ef);};}exports[_0xddde('0x29')]=function(_0x5ddf57,_0x560e28){var _0x45941e={},_0x5328ac={},_0x1d1c3e={'count':0x0,'rows':[]};var _0x41d94b=_[_0xddde('0x2a')](db[_0xddde('0x2b')][_0xddde('0x2c')],function(_0xb5d4b6){return{'name':_0xb5d4b6[_0xddde('0x2d')],'type':_0xb5d4b6[_0xddde('0x2e')][_0xddde('0x2f')]};});_0x5328ac[_0xddde('0x30')]=_[_0xddde('0x2a')](_0x41d94b,_0xddde('0x27'));_0x5328ac[_0xddde('0x31')]=_[_0xddde('0x32')](_0x5ddf57[_0xddde('0x31')]);_0x5328ac[_0xddde('0x33')]=_[_0xddde('0x34')](_0x5328ac[_0xddde('0x30')],_0x5328ac[_0xddde('0x31')]);_0x45941e[_0xddde('0x35')]=_['intersection'](_0x5328ac['model'],qs[_0xddde('0x36')](_0x5ddf57[_0xddde('0x31')][_0xddde('0x36')]));_0x45941e['attributes']=_0x45941e['attributes'][_0xddde('0x37')]?_0x45941e[_0xddde('0x35')]:_0x5328ac[_0xddde('0x30')];if(!_0x5ddf57[_0xddde('0x31')]['hasOwnProperty'](_0xddde('0x38'))){_0x45941e['limit']=qs[_0xddde('0x1f')](_0x5ddf57[_0xddde('0x31')][_0xddde('0x1f')]);_0x45941e[_0xddde('0x1e')]=qs[_0xddde('0x1e')](_0x5ddf57[_0xddde('0x31')][_0xddde('0x1e')]);}_0x45941e[_0xddde('0x39')]=qs[_0xddde('0x3a')](_0x5ddf57[_0xddde('0x31')][_0xddde('0x3a')]);_0x45941e[_0xddde('0x3b')]=qs['filters'](_[_0xddde('0x3c')](_0x5ddf57[_0xddde('0x31')],_0x5328ac['filters']),_0x41d94b);if(_0x5ddf57['query']['filter']){_0x45941e[_0xddde('0x3b')]=_[_0xddde('0x3d')](_0x45941e[_0xddde('0x3b')],{'$or':_[_0xddde('0x2a')](_0x41d94b,function(_0x2825c6){if(_0x2825c6[_0xddde('0x2e')]!==_0xddde('0x3e')){var _0x5d88ac={};_0x5d88ac[_0x2825c6['name']]={'$like':'%'+_0x5ddf57[_0xddde('0x31')]['filter']+'%'};return _0x5d88ac;}})});}_0x45941e=_[_0xddde('0x3d')]({},_0x45941e,_0x5ddf57[_0xddde('0x3f')]);var _0x4c356a={'where':_0x45941e[_0xddde('0x3b')]};return db[_0xddde('0x2b')][_0xddde('0x1d')](_0x4c356a)['then'](function(_0x5cb615){_0x1d1c3e[_0xddde('0x1d')]=_0x5cb615;if(_0x5ddf57['query'][_0xddde('0x40')]){_0x45941e[_0xddde('0x41')]=[{'all':!![]}];}return db[_0xddde('0x2b')][_0xddde('0x42')](_0x45941e);})[_0xddde('0x25')](function(_0x1faf5f){_0x1d1c3e['rows']=_0x1faf5f;return _0x1d1c3e;})[_0xddde('0x25')](respondWithFilteredResult(_0x560e28,_0x45941e))[_0xddde('0x43')](handleError(_0x560e28,null));};exports[_0xddde('0x44')]=function(_0xd490d5,_0x10d9d3){var _0x585b5a={'raw':!![],'where':{'id':_0xd490d5[_0xddde('0x45')]['id']}},_0x1f4ef2={};_0x1f4ef2[_0xddde('0x30')]=_[_0xddde('0x32')](db[_0xddde('0x2b')][_0xddde('0x2c')]);_0x1f4ef2[_0xddde('0x31')]=_[_0xddde('0x32')](_0xd490d5[_0xddde('0x31')]);_0x1f4ef2['filters']=_[_0xddde('0x34')](_0x1f4ef2['model'],_0x1f4ef2[_0xddde('0x31')]);_0x585b5a[_0xddde('0x35')]=_['intersection'](_0x1f4ef2[_0xddde('0x30')],qs[_0xddde('0x36')](_0xd490d5[_0xddde('0x31')]['fields']));_0x585b5a['attributes']=_0x585b5a['attributes'][_0xddde('0x37')]?_0x585b5a[_0xddde('0x35')]:_0x1f4ef2[_0xddde('0x30')];if(_0xd490d5[_0xddde('0x31')]['includeAll']){_0x585b5a[_0xddde('0x41')]=[{'all':!![]}];}_0x585b5a=_[_0xddde('0x3d')]({},_0x585b5a,_0xd490d5[_0xddde('0x3f')]);return db['SquareReport'][_0xddde('0x46')](_0x585b5a)[_0xddde('0x25')](handleEntityNotFound(_0x10d9d3,null))[_0xddde('0x25')](respondWithResult(_0x10d9d3,null))[_0xddde('0x43')](handleError(_0x10d9d3,null));};exports[_0xddde('0x47')]=function(_0x4dbf84,_0x3ac8c3){return db['SquareReport'][_0xddde('0x47')](_0x4dbf84['body'],{})[_0xddde('0x25')](respondWithResult(_0x3ac8c3,0xc9))[_0xddde('0x43')](handleError(_0x3ac8c3,null));};exports[_0xddde('0x23')]=function(_0x83ee21,_0x1cf1d6){if(_0x83ee21[_0xddde('0x48')]['id']){delete _0x83ee21[_0xddde('0x48')]['id'];}return db[_0xddde('0x2b')]['find']({'where':{'id':_0x83ee21[_0xddde('0x45')]['id']}})[_0xddde('0x25')](handleEntityNotFound(_0x1cf1d6,null))[_0xddde('0x25')](saveUpdates(_0x83ee21[_0xddde('0x48')],null))[_0xddde('0x25')](respondWithResult(_0x1cf1d6,null))[_0xddde('0x43')](handleError(_0x1cf1d6,null));};exports['destroy']=function(_0x135d97,_0xb3f972){return db[_0xddde('0x2b')][_0xddde('0x46')]({'where':{'id':_0x135d97[_0xddde('0x45')]['id']}})['then'](handleEntityNotFound(_0xb3f972,null))[_0xddde('0x25')](removeEntity(_0xb3f972,null))[_0xddde('0x43')](handleError(_0xb3f972,null));};exports[_0xddde('0x49')]=function(_0x2ff917,_0x4553ab){return db[_0xddde('0x2b')][_0xddde('0x49')]()[_0xddde('0x25')](respondWithResult(_0x4553ab,null))[_0xddde('0x43')](handleError(_0x4553ab,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 5aaa48c..d4225ef 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 _0xcb3d=['rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5a636f,_0x3fec2b){var _0x6a8cfb=function(_0x20e6ca){while(--_0x20e6ca){_0x5a636f['push'](_0x5a636f['shift']());}};_0x6a8cfb(++_0x3fec2b);}(_0xcb3d,0xad));var _0xdcb3=function(_0x5c2de9,_0x14e858){_0x5c2de9=_0x5c2de9-0x0;var _0x3b52d2=_0xcb3d[_0x5c2de9];return _0x3b52d2;};'use strict';var _=require(_0xdcb3('0x0'));var util=require('util');var logger=require(_0xdcb3('0x1'))(_0xdcb3('0x2'));var moment=require(_0xdcb3('0x3'));var BPromise=require(_0xdcb3('0x4'));var rp=require(_0xdcb3('0x5'));var fs=require('fs');var path=require(_0xdcb3('0x6'));var rimraf=require(_0xdcb3('0x7'));var config=require('../../config/environment');var attributes=require(_0xdcb3('0x8'));module[_0xdcb3('0x9')]=function(_0x119b10,_0x48c76a){return _0x119b10[_0xdcb3('0xa')](_0xdcb3('0xb'),attributes,{'tableName':_0xdcb3('0xc'),'paranoid':![],'indexes':[{'name':_0xdcb3('0xd'),'fields':[_0xdcb3('0xe'),'project_name']},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe078=['project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid'];(function(_0x2e1879,_0x25c62a){var _0x5d2cc3=function(_0x881805){while(--_0x881805){_0x2e1879['push'](_0x2e1879['shift']());}};_0x5d2cc3(++_0x25c62a);}(_0xe078,0x12e));var _0x8e07=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xe078[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x8e07('0x0'));var util=require(_0x8e07('0x1'));var logger=require(_0x8e07('0x2'))(_0x8e07('0x3'));var moment=require(_0x8e07('0x4'));var BPromise=require(_0x8e07('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8e07('0x6'));var attributes=require(_0x8e07('0x7'));module['exports']=function(_0x1a661a,_0xdfc1e0){return _0x1a661a[_0x8e07('0x8')](_0x8e07('0x9'),attributes,{'tableName':_0x8e07('0xa'),'paranoid':![],'indexes':[{'name':_0x8e07('0xb'),'fields':[_0x8e07('0xc'),_0x8e07('0xd')]},{'name':_0x8e07('0xe'),'fields':[_0x8e07('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 3252a1f..c2ce30b 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 _0x8ef6=['UpdateSquareReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','create','body','options','raw','CreateSquareReport'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0x8ef6,0xf2));var _0x68ef=function(_0x107fc1,_0x456be1){_0x107fc1=_0x107fc1-0x0;var _0x313a74=_0x8ef6[_0x107fc1];return _0x313a74;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('SquareReport,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('SquareReport,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['CreateSquareReport']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')](_0x2633c1[_0x68ef('0x1a')],{'raw':_0x2633c1['options']?_0x2633c1[_0x68ef('0x1b')][_0x68ef('0x1c')]===undefined?!![]:![]:!![]})[_0x68ef('0xc')](function(_0x5b246b){logger[_0x68ef('0xd')](_0x68ef('0x1d'),_0x2633c1);logger['debug'](_0x68ef('0x1d'),_0x2633c1,JSON[_0x68ef('0x12')](_0x5b246b));_0x4ade0d(_0x5b246b);})[_0x68ef('0x17')](function(_0x5ddec7){logger['error']('CreateSquareReport',_0x5ddec7[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x5ddec7[_0x68ef('0x15')]));});});};exports[_0x68ef('0x1e')]=function(_0x438b4c){var _0xfe2595=this;return new Promise(function(_0x258cd5,_0x49374f){return db[_0x68ef('0x18')][_0x68ef('0x1f')](_0x438b4c['body'],{'raw':_0x438b4c[_0x68ef('0x1b')]?_0x438b4c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x438b4c['options']?_0x438b4c[_0x68ef('0x1b')][_0x68ef('0x20')]||null:null,'attributes':_0x438b4c[_0x68ef('0x1b')]?_0x438b4c[_0x68ef('0x1b')]['attributes']||null:null,'limit':_0x438b4c['options']?_0x438b4c[_0x68ef('0x1b')][_0x68ef('0x21')]||null:null})[_0x68ef('0xc')](function(_0x263b30){logger[_0x68ef('0xd')](_0x68ef('0x1e'),_0x438b4c);logger[_0x68ef('0x10')](_0x68ef('0x1e'),_0x438b4c,JSON['stringify'](_0x263b30));_0x258cd5(_0x263b30);})[_0x68ef('0x17')](function(_0x4314bd){logger[_0x68ef('0x13')]('UpdateSquareReport',_0x4314bd[_0x68ef('0x15')],_0x438b4c);_0x49374f(_0xfe2595['error'](0x1f4,_0x4314bd[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _0x7da7=['update','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','create','body','options','CreateSquareReport','debug','UpdateSquareReport'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0x7da7,0x10d));var _0x77da=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0x7da7[_0x29ae80];return _0x5d6d71;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77da('0x3'));var db=require(_0x77da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77da('0x5'))(_0x77da('0x6'));var config=require('../../config/environment');var jayson=require(_0x77da('0x7'));var client=jayson[_0x77da('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30afe0,_0x47cf1d,_0x1191de){return new BPromise(function(_0x13992e,_0x37c5ab){return client[_0x77da('0x9')](_0x30afe0,_0x1191de)[_0x77da('0xa')](function(_0x58f3fe){logger[_0x77da('0xb')](_0x77da('0xc'),_0x47cf1d,_0x77da('0xd'));logger['debug'](_0x77da('0xe'),_0x47cf1d,_0x77da('0xd'),JSON[_0x77da('0xf')](_0x58f3fe));if(_0x58f3fe[_0x77da('0x10')]){if(_0x58f3fe['error'][_0x77da('0x11')]===0x1f4){logger[_0x77da('0x10')](_0x77da('0xc'),_0x47cf1d,_0x58f3fe['error']['message']);return _0x37c5ab(_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);}logger['error'](_0x77da('0xc'),_0x47cf1d,_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);return _0x13992e(_0x58f3fe[_0x77da('0x10')]['message']);}else{logger[_0x77da('0xb')]('SquareReport,\x20%s,\x20%s',_0x47cf1d,_0x77da('0xd'));_0x13992e(_0x58f3fe[_0x77da('0x13')][_0x77da('0x12')]);}})[_0x77da('0x14')](function(_0x4ecd98){logger['error']('SquareReport,\x20%s,\x20%s',_0x47cf1d,_0x4ecd98);_0x37c5ab(_0x4ecd98);});});}exports['CreateSquareReport']=function(_0x103e46){var _0x295bef=this;return new Promise(function(_0x289887,_0x335dcb){return db[_0x77da('0x15')][_0x77da('0x16')](_0x103e46[_0x77da('0x17')],{'raw':_0x103e46[_0x77da('0x18')]?_0x103e46['options']['raw']===undefined?!![]:![]:!![]})[_0x77da('0xa')](function(_0x4d1512){logger['info'](_0x77da('0x19'),_0x103e46);logger[_0x77da('0x1a')](_0x77da('0x19'),_0x103e46,JSON['stringify'](_0x4d1512));_0x289887(_0x4d1512);})['catch'](function(_0x3e6cfe){logger['error'](_0x77da('0x19'),_0x3e6cfe[_0x77da('0x12')],_0x103e46);_0x335dcb(_0x295bef[_0x77da('0x10')](0x1f4,_0x3e6cfe[_0x77da('0x12')]));});});};exports[_0x77da('0x1b')]=function(_0x270318){var _0x95b5db=this;return new Promise(function(_0x50799d,_0x4885ec){return db[_0x77da('0x15')][_0x77da('0x1c')](_0x270318[_0x77da('0x17')],{'raw':_0x270318[_0x77da('0x18')]?_0x270318['options'][_0x77da('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x270318[_0x77da('0x18')]?_0x270318[_0x77da('0x18')][_0x77da('0x1e')]||null:null,'attributes':_0x270318[_0x77da('0x18')]?_0x270318['options'][_0x77da('0x1f')]||null:null,'limit':_0x270318[_0x77da('0x18')]?_0x270318[_0x77da('0x18')][_0x77da('0x20')]||null:null})['then'](function(_0x5b4638){logger['info'](_0x77da('0x1b'),_0x270318);logger[_0x77da('0x1a')](_0x77da('0x1b'),_0x270318,JSON[_0x77da('0xf')](_0x5b4638));_0x50799d(_0x5b4638);})[_0x77da('0x14')](function(_0x4eeb99){logger[_0x77da('0x10')](_0x77da('0x1b'),_0x4eeb99[_0x77da('0x12')],_0x270318);_0x4885ec(_0x95b5db[_0x77da('0x10')](0x1f4,_0x4eeb99[_0x77da('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 76527a0..4c6c174 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(_0x563692,_0x428494){var _0x78b79b=function(_0x3e94cf){while(--_0x3e94cf){_0x563692['push'](_0x563692['shift']());}};_0x78b79b(++_0x428494);}(_0x7a54,0x106));var _0x47a5=function(_0x5f058d,_0x5983ef){_0x5f058d=_0x5f058d-0x0;var _0x30d5e5=_0x7a54[_0x5f058d];return _0x30d5e5;};'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(_0x9fc2e6,_0x59cc51){var _0x41aa8b=function(_0x3f8c28){while(--_0x3f8c28){_0x9fc2e6['push'](_0x9fc2e6['shift']());}};_0x41aa8b(++_0x59cc51);}(_0x7a54,0x106));var _0x47a5=function(_0x176fd8,_0x290116){_0x176fd8=_0x176fd8-0x0;var _0x47f201=_0x7a54[_0x176fd8];return _0x47f201;};'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 d770d13..60b9505 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 _0xf007=['TEXT','STRING'];(function(_0x156cd5,_0x14cc5d){var _0x4cbfc2=function(_0x239165){while(--_0x239165){_0x156cd5['push'](_0x156cd5['shift']());}};_0x4cbfc2(++_0x14cc5d);}(_0xf007,0xb7));var _0x7f00=function(_0x165718,_0x49ae0b){_0x165718=_0x165718-0x0;var _0x2e57b2=_0xf007[_0x165718];return _0x2e57b2;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x7f00('0x0')]},'node':{'type':Sequelize[_0x7f00('0x0')]},'application':{'type':Sequelize[_0x7f00('0x0')]},'data':{'type':Sequelize[_0x7f00('0x1')]},'project_name':{'type':Sequelize[_0x7f00('0x0')]},'callerid':{'type':Sequelize[_0x7f00('0x0')]}}; \ No newline at end of file +var _0x1264=['sequelize','STRING','TEXT'];(function(_0x54eace,_0x1ba673){var _0x2f0147=function(_0xfbf7de){while(--_0xfbf7de){_0x54eace['push'](_0x54eace['shift']());}};_0x2f0147(++_0x1ba673);}(_0x1264,0xa5));var _0x4126=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x1264[_0x3f5dca];return _0x5b833a;};'use strict';var Sequelize=require(_0x4126('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4126('0x1')]},'node':{'type':Sequelize[_0x4126('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x4126('0x2')]},'project_name':{'type':Sequelize[_0x4126('0x1')]},'callerid':{'type':Sequelize[_0x4126('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 6f9813a..47a22c8 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 _0x1eba=['findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0x1eba[_0x57da0a];return _0x3145d5;};'use strict';var pdf=require(_0xa1eb('0x0'));var emlformat=require(_0xa1eb('0x1'));var rimraf=require(_0xa1eb('0x2'));var zipdir=require(_0xa1eb('0x3'));var jsonpatch=require(_0xa1eb('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1eb('0x5'));var Mustache=require(_0xa1eb('0x6'));var util=require(_0xa1eb('0x7'));var path=require(_0xa1eb('0x8'));var sox=require(_0xa1eb('0x9'));var csv=require(_0xa1eb('0xa'));var ejs=require(_0xa1eb('0xb'));var fs=require('fs');var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1eb('0x18'))['db'];function respondWithStatusCode(_0x39b4a3,_0x5df92d){_0x5df92d=_0x5df92d||0xcc;return function(_0x16a623){if(_0x16a623){return _0x39b4a3['sendStatus'](_0x5df92d);}return _0x39b4a3['status'](_0x5df92d)[_0xa1eb('0x19')]();};}function respondWithResult(_0x4c7983,_0x25d058){_0x25d058=_0x25d058||0xc8;return function(_0x2178e2){if(_0x2178e2){return _0x4c7983[_0xa1eb('0x1a')](_0x25d058)[_0xa1eb('0x1b')](_0x2178e2);}};}function respondWithFilteredResult(_0x3cd675,_0x44f37d){return function(_0x1c858c){if(_0x1c858c){var _0x45d6dd=_0x1c858c['count'],_0x211e42=_0x44f37d[_0xa1eb('0x1c')],_0x4aa527=_0x44f37d[_0xa1eb('0x1c')]+_0x44f37d[_0xa1eb('0x1d')],_0xbd6a6b;if(_0x4aa527>=_0x45d6dd){_0x4aa527=_0x45d6dd;_0xbd6a6b=0xc8;}else{_0xbd6a6b=0xce;}_0x3cd675[_0xa1eb('0x1a')](_0xbd6a6b);return _0x3cd675['set'](_0xa1eb('0x1e'),_0x211e42+'-'+_0x4aa527+'/'+_0x45d6dd)[_0xa1eb('0x1b')](_0x1c858c);}return null;};}function patchUpdates(_0x83ed15){return function(_0xcf45c1){try{jsonpatch[_0xa1eb('0x1f')](_0xcf45c1,_0x83ed15,!![]);}catch(_0x3b8607){return BPromise[_0xa1eb('0x20')](_0x3b8607);}return _0xcf45c1[_0xa1eb('0x21')]();};}function saveUpdates(_0x4fc14a,_0x137e2c){return function(_0x56653c){if(_0x56653c){return _0x56653c[_0xa1eb('0x22')](_0x4fc14a)[_0xa1eb('0x23')](function(_0x350a08){return _0x350a08;});}return null;};}function removeEntity(_0x250f99,_0x5e7a34){return function(_0x539634){if(_0x539634){return _0x539634[_0xa1eb('0x24')]()[_0xa1eb('0x23')](function(){_0x250f99['status'](0xcc)[_0xa1eb('0x19')]();});}};}function handleEntityNotFound(_0x250728,_0x258d3a){return function(_0xa6b20c){if(!_0xa6b20c){_0x250728[_0xa1eb('0x25')](0x194);}return _0xa6b20c;};}function handleError(_0x1c59e1,_0x33271e){_0x33271e=_0x33271e||0x1f4;return function(_0x364b1c){logger[_0xa1eb('0x26')](_0x364b1c[_0xa1eb('0x27')]);if(_0x364b1c[_0xa1eb('0x28')]){delete _0x364b1c[_0xa1eb('0x28')];}_0x1c59e1['status'](_0x33271e)[_0xa1eb('0x29')](_0x364b1c);};}exports[_0xa1eb('0x2a')]=function(_0x491f37,_0x2680c0){var _0x4e2aa7={},_0x3aae71={},_0x2d31d1={'count':0x0,'rows':[]};var _0x53a890=_[_0xa1eb('0x2b')](db[_0xa1eb('0x2c')][_0xa1eb('0x2d')],function(_0x4f64bb){return{'name':_0x4f64bb[_0xa1eb('0x2e')],'type':_0x4f64bb[_0xa1eb('0x2f')]['key']};});_0x3aae71[_0xa1eb('0x30')]=_[_0xa1eb('0x2b')](_0x53a890,_0xa1eb('0x28'));_0x3aae71[_0xa1eb('0x31')]=_[_0xa1eb('0x32')](_0x491f37['query']);_0x3aae71[_0xa1eb('0x33')]=_[_0xa1eb('0x34')](_0x3aae71[_0xa1eb('0x30')],_0x3aae71[_0xa1eb('0x31')]);_0x4e2aa7[_0xa1eb('0x35')]=_[_0xa1eb('0x34')](_0x3aae71[_0xa1eb('0x30')],qs[_0xa1eb('0x36')](_0x491f37[_0xa1eb('0x31')][_0xa1eb('0x36')]));_0x4e2aa7[_0xa1eb('0x35')]=_0x4e2aa7['attributes']['length']?_0x4e2aa7[_0xa1eb('0x35')]:_0x3aae71[_0xa1eb('0x30')];if(!_0x491f37[_0xa1eb('0x31')][_0xa1eb('0x37')](_0xa1eb('0x38'))){_0x4e2aa7['limit']=qs['limit'](_0x491f37[_0xa1eb('0x31')][_0xa1eb('0x1d')]);_0x4e2aa7['offset']=qs['offset'](_0x491f37[_0xa1eb('0x31')]['offset']);}_0x4e2aa7[_0xa1eb('0x39')]=qs['sort'](_0x491f37[_0xa1eb('0x31')][_0xa1eb('0x3a')]);_0x4e2aa7[_0xa1eb('0x3b')]=qs['filters'](_[_0xa1eb('0x3c')](_0x491f37[_0xa1eb('0x31')],_0x3aae71[_0xa1eb('0x33')]),_0x53a890);if(_0x491f37['query'][_0xa1eb('0x3d')]){_0x4e2aa7[_0xa1eb('0x3b')]=_[_0xa1eb('0x3e')](_0x4e2aa7[_0xa1eb('0x3b')],{'$or':_[_0xa1eb('0x2b')](_0x53a890,function(_0x5912d5){if(_0x5912d5[_0xa1eb('0x2f')]!==_0xa1eb('0x3f')){var _0x46374c={};_0x46374c[_0x5912d5[_0xa1eb('0x28')]]={'$like':'%'+_0x491f37[_0xa1eb('0x31')][_0xa1eb('0x3d')]+'%'};return _0x46374c;}})});}_0x4e2aa7=_[_0xa1eb('0x3e')]({},_0x4e2aa7,_0x491f37[_0xa1eb('0x40')]);var _0x53f251={'where':_0x4e2aa7[_0xa1eb('0x3b')]};return db[_0xa1eb('0x2c')][_0xa1eb('0x41')](_0x53f251)[_0xa1eb('0x23')](function(_0x1c390c){_0x2d31d1['count']=_0x1c390c;if(_0x491f37[_0xa1eb('0x31')][_0xa1eb('0x42')]){_0x4e2aa7[_0xa1eb('0x43')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xa1eb('0x44')](_0x4e2aa7);})[_0xa1eb('0x23')](function(_0x2ae6d8){_0x2d31d1[_0xa1eb('0x45')]=_0x2ae6d8;return _0x2d31d1;})[_0xa1eb('0x23')](respondWithFilteredResult(_0x2680c0,_0x4e2aa7))[_0xa1eb('0x46')](handleError(_0x2680c0,null));};exports[_0xa1eb('0x47')]=function(_0x568617,_0x3c8713){var _0x14c37a={'raw':!![],'where':{'id':_0x568617[_0xa1eb('0x48')]['id']}},_0x5d9d19={};_0x5d9d19['model']=_[_0xa1eb('0x32')](db[_0xa1eb('0x2c')][_0xa1eb('0x2d')]);_0x5d9d19[_0xa1eb('0x31')]=_[_0xa1eb('0x32')](_0x568617[_0xa1eb('0x31')]);_0x5d9d19[_0xa1eb('0x33')]=_[_0xa1eb('0x34')](_0x5d9d19[_0xa1eb('0x30')],_0x5d9d19[_0xa1eb('0x31')]);_0x14c37a[_0xa1eb('0x35')]=_[_0xa1eb('0x34')](_0x5d9d19[_0xa1eb('0x30')],qs[_0xa1eb('0x36')](_0x568617[_0xa1eb('0x31')][_0xa1eb('0x36')]));_0x14c37a['attributes']=_0x14c37a[_0xa1eb('0x35')]['length']?_0x14c37a[_0xa1eb('0x35')]:_0x5d9d19[_0xa1eb('0x30')];if(_0x568617['query']['includeAll']){_0x14c37a[_0xa1eb('0x43')]=[{'all':!![]}];}_0x14c37a=_[_0xa1eb('0x3e')]({},_0x14c37a,_0x568617[_0xa1eb('0x40')]);return db['SquareDetailsReport'][_0xa1eb('0x49')](_0x14c37a)[_0xa1eb('0x23')](handleEntityNotFound(_0x3c8713,null))[_0xa1eb('0x23')](respondWithResult(_0x3c8713,null))[_0xa1eb('0x46')](handleError(_0x3c8713,null));};exports[_0xa1eb('0x4a')]=function(_0x6f47c5,_0x21ce06){return db[_0xa1eb('0x2c')][_0xa1eb('0x4a')](_0x6f47c5[_0xa1eb('0x4b')],{})[_0xa1eb('0x23')](respondWithResult(_0x21ce06,0xc9))[_0xa1eb('0x46')](handleError(_0x21ce06,null));};exports[_0xa1eb('0x22')]=function(_0x10e15a,_0x50df09){if(_0x10e15a[_0xa1eb('0x4b')]['id']){delete _0x10e15a[_0xa1eb('0x4b')]['id'];}return db[_0xa1eb('0x2c')][_0xa1eb('0x49')]({'where':{'id':_0x10e15a[_0xa1eb('0x48')]['id']}})[_0xa1eb('0x23')](handleEntityNotFound(_0x50df09,null))[_0xa1eb('0x23')](saveUpdates(_0x10e15a['body'],null))[_0xa1eb('0x23')](respondWithResult(_0x50df09,null))[_0xa1eb('0x46')](handleError(_0x50df09,null));};exports[_0xa1eb('0x24')]=function(_0x10a6da,_0x8975a1){return db[_0xa1eb('0x2c')][_0xa1eb('0x49')]({'where':{'id':_0x10a6da[_0xa1eb('0x48')]['id']}})[_0xa1eb('0x23')](handleEntityNotFound(_0x8975a1,null))['then'](removeEntity(_0x8975a1,null))[_0xa1eb('0x46')](handleError(_0x8975a1,null));};exports['describe']=function(_0x268b48,_0x495c01){return db[_0xa1eb('0x2c')][_0xa1eb('0x4c')]()[_0xa1eb('0x23')](respondWithResult(_0x495c01,null))['catch'](handleError(_0x495c01,null));}; \ No newline at end of file +var _0x376f=['save','then','destroy','error','stack','name','send','index','SquareDetailsReport','fieldName','key','map','keys','intersection','query','model','fields','attributes','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','rawAttributes','length','catch','create','body','update','find','params','describe','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','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','offset','limit','set','Content-Range','apply','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x376f,0x78));var _0xf376=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x376f[_0x42bdad];return _0x122626;};'use strict';var pdf=require(_0xf376('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf376('0x1'));var jsonpatch=require(_0xf376('0x2'));var rp=require('request-promise');var moment=require(_0xf376('0x3'));var BPromise=require(_0xf376('0x4'));var Mustache=require(_0xf376('0x5'));var util=require(_0xf376('0x6'));var path=require(_0xf376('0x7'));var sox=require(_0xf376('0x8'));var csv=require(_0xf376('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf376('0xa'));var squel=require(_0xf376('0xb'));var crypto=require(_0xf376('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf376('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf376('0xe'));var Papa=require('papaparse');var Redis=require(_0xf376('0xf'));var authService=require(_0xf376('0x10'));var qs=require(_0xf376('0x11'));var as=require(_0xf376('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf376('0x13'))(_0xf376('0x14'));var utils=require(_0xf376('0x15'));var config=require(_0xf376('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf376('0x17'))['db'];function respondWithStatusCode(_0x2b2b37,_0x100295){_0x100295=_0x100295||0xcc;return function(_0x4dca87){if(_0x4dca87){return _0x2b2b37[_0xf376('0x18')](_0x100295);}return _0x2b2b37[_0xf376('0x19')](_0x100295)[_0xf376('0x1a')]();};}function respondWithResult(_0xb133c,_0xd2a05e){_0xd2a05e=_0xd2a05e||0xc8;return function(_0x1688c7){if(_0x1688c7){return _0xb133c[_0xf376('0x19')](_0xd2a05e)[_0xf376('0x1b')](_0x1688c7);}};}function respondWithFilteredResult(_0x54b651,_0x69c83c){return function(_0x56c89f){if(_0x56c89f){var _0x36ed42=_0x56c89f['count'],_0x22e500=_0x69c83c[_0xf376('0x1c')],_0x281527=_0x69c83c['offset']+_0x69c83c[_0xf376('0x1d')],_0x59e4a8;if(_0x281527>=_0x36ed42){_0x281527=_0x36ed42;_0x59e4a8=0xc8;}else{_0x59e4a8=0xce;}_0x54b651[_0xf376('0x19')](_0x59e4a8);return _0x54b651[_0xf376('0x1e')](_0xf376('0x1f'),_0x22e500+'-'+_0x281527+'/'+_0x36ed42)[_0xf376('0x1b')](_0x56c89f);}return null;};}function patchUpdates(_0xbdc8d8){return function(_0x5cbf32){try{jsonpatch[_0xf376('0x20')](_0x5cbf32,_0xbdc8d8,!![]);}catch(_0x4017fe){return BPromise[_0xf376('0x21')](_0x4017fe);}return _0x5cbf32[_0xf376('0x22')]();};}function saveUpdates(_0x5a8286,_0x290659){return function(_0xba9748){if(_0xba9748){return _0xba9748['update'](_0x5a8286)[_0xf376('0x23')](function(_0x1fe1e3){return _0x1fe1e3;});}return null;};}function removeEntity(_0x56a08a,_0x31bb2a){return function(_0x2250d2){if(_0x2250d2){return _0x2250d2[_0xf376('0x24')]()[_0xf376('0x23')](function(){_0x56a08a['status'](0xcc)[_0xf376('0x1a')]();});}};}function handleEntityNotFound(_0x27fbd3,_0x12b6ba){return function(_0x5ef0b8){if(!_0x5ef0b8){_0x27fbd3[_0xf376('0x18')](0x194);}return _0x5ef0b8;};}function handleError(_0xf0a79b,_0x21c7ba){_0x21c7ba=_0x21c7ba||0x1f4;return function(_0x3ade8e){logger[_0xf376('0x25')](_0x3ade8e[_0xf376('0x26')]);if(_0x3ade8e['name']){delete _0x3ade8e[_0xf376('0x27')];}_0xf0a79b[_0xf376('0x19')](_0x21c7ba)[_0xf376('0x28')](_0x3ade8e);};}exports[_0xf376('0x29')]=function(_0xad35c7,_0x14d52a){var _0x2b0904={},_0x3432ac={},_0x19ecc5={'count':0x0,'rows':[]};var _0x154e78=_['map'](db[_0xf376('0x2a')]['rawAttributes'],function(_0x2efa59){return{'name':_0x2efa59[_0xf376('0x2b')],'type':_0x2efa59['type'][_0xf376('0x2c')]};});_0x3432ac['model']=_[_0xf376('0x2d')](_0x154e78,_0xf376('0x27'));_0x3432ac['query']=_[_0xf376('0x2e')](_0xad35c7['query']);_0x3432ac['filters']=_[_0xf376('0x2f')](_0x3432ac['model'],_0x3432ac[_0xf376('0x30')]);_0x2b0904['attributes']=_[_0xf376('0x2f')](_0x3432ac[_0xf376('0x31')],qs[_0xf376('0x32')](_0xad35c7[_0xf376('0x30')][_0xf376('0x32')]));_0x2b0904[_0xf376('0x33')]=_0x2b0904[_0xf376('0x33')]['length']?_0x2b0904[_0xf376('0x33')]:_0x3432ac[_0xf376('0x31')];if(!_0xad35c7['query']['hasOwnProperty']('nolimit')){_0x2b0904[_0xf376('0x1d')]=qs[_0xf376('0x1d')](_0xad35c7[_0xf376('0x30')]['limit']);_0x2b0904[_0xf376('0x1c')]=qs[_0xf376('0x1c')](_0xad35c7[_0xf376('0x30')][_0xf376('0x1c')]);}_0x2b0904[_0xf376('0x34')]=qs[_0xf376('0x35')](_0xad35c7[_0xf376('0x30')][_0xf376('0x35')]);_0x2b0904[_0xf376('0x36')]=qs[_0xf376('0x37')](_[_0xf376('0x38')](_0xad35c7['query'],_0x3432ac[_0xf376('0x37')]),_0x154e78);if(_0xad35c7[_0xf376('0x30')][_0xf376('0x39')]){_0x2b0904[_0xf376('0x36')]=_[_0xf376('0x3a')](_0x2b0904[_0xf376('0x36')],{'$or':_[_0xf376('0x2d')](_0x154e78,function(_0x1bba4a){if(_0x1bba4a[_0xf376('0x3b')]!==_0xf376('0x3c')){var _0x445539={};_0x445539[_0x1bba4a['name']]={'$like':'%'+_0xad35c7['query']['filter']+'%'};return _0x445539;}})});}_0x2b0904=_['merge']({},_0x2b0904,_0xad35c7[_0xf376('0x3d')]);var _0x2eef22={'where':_0x2b0904[_0xf376('0x36')]};return db[_0xf376('0x2a')][_0xf376('0x3e')](_0x2eef22)[_0xf376('0x23')](function(_0xbdf04){_0x19ecc5['count']=_0xbdf04;if(_0xad35c7[_0xf376('0x30')][_0xf376('0x3f')]){_0x2b0904[_0xf376('0x40')]=[{'all':!![]}];}return db[_0xf376('0x2a')][_0xf376('0x41')](_0x2b0904);})['then'](function(_0xcac266){_0x19ecc5[_0xf376('0x42')]=_0xcac266;return _0x19ecc5;})['then'](respondWithFilteredResult(_0x14d52a,_0x2b0904))['catch'](handleError(_0x14d52a,null));};exports[_0xf376('0x43')]=function(_0x5e98ae,_0x2aa9c4){var _0x15e69f={'raw':!![],'where':{'id':_0x5e98ae['params']['id']}},_0xebef3a={};_0xebef3a[_0xf376('0x31')]=_[_0xf376('0x2e')](db['SquareDetailsReport'][_0xf376('0x44')]);_0xebef3a[_0xf376('0x30')]=_[_0xf376('0x2e')](_0x5e98ae['query']);_0xebef3a[_0xf376('0x37')]=_[_0xf376('0x2f')](_0xebef3a[_0xf376('0x31')],_0xebef3a[_0xf376('0x30')]);_0x15e69f[_0xf376('0x33')]=_[_0xf376('0x2f')](_0xebef3a[_0xf376('0x31')],qs[_0xf376('0x32')](_0x5e98ae[_0xf376('0x30')]['fields']));_0x15e69f[_0xf376('0x33')]=_0x15e69f[_0xf376('0x33')][_0xf376('0x45')]?_0x15e69f[_0xf376('0x33')]:_0xebef3a[_0xf376('0x31')];if(_0x5e98ae[_0xf376('0x30')][_0xf376('0x3f')]){_0x15e69f[_0xf376('0x40')]=[{'all':!![]}];}_0x15e69f=_['merge']({},_0x15e69f,_0x5e98ae[_0xf376('0x3d')]);return db[_0xf376('0x2a')]['find'](_0x15e69f)['then'](handleEntityNotFound(_0x2aa9c4,null))[_0xf376('0x23')](respondWithResult(_0x2aa9c4,null))[_0xf376('0x46')](handleError(_0x2aa9c4,null));};exports[_0xf376('0x47')]=function(_0x5a6d74,_0x142fec){return db[_0xf376('0x2a')]['create'](_0x5a6d74[_0xf376('0x48')],{})[_0xf376('0x23')](respondWithResult(_0x142fec,0xc9))['catch'](handleError(_0x142fec,null));};exports[_0xf376('0x49')]=function(_0x2384e8,_0x303c88){if(_0x2384e8[_0xf376('0x48')]['id']){delete _0x2384e8[_0xf376('0x48')]['id'];}return db[_0xf376('0x2a')][_0xf376('0x4a')]({'where':{'id':_0x2384e8[_0xf376('0x4b')]['id']}})[_0xf376('0x23')](handleEntityNotFound(_0x303c88,null))[_0xf376('0x23')](saveUpdates(_0x2384e8[_0xf376('0x48')],null))[_0xf376('0x23')](respondWithResult(_0x303c88,null))[_0xf376('0x46')](handleError(_0x303c88,null));};exports[_0xf376('0x24')]=function(_0x414c09,_0x126bbe){return db[_0xf376('0x2a')][_0xf376('0x4a')]({'where':{'id':_0x414c09['params']['id']}})[_0xf376('0x23')](handleEntityNotFound(_0x126bbe,null))[_0xf376('0x23')](removeEntity(_0x126bbe,null))['catch'](handleError(_0x126bbe,null));};exports[_0xf376('0x4c')]=function(_0x374e81,_0x62e446){return db['SquareDetailsReport'][_0xf376('0x4c')]()['then'](respondWithResult(_0x62e446,null))['catch'](handleError(_0x62e446,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 2aea697..3015075 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 _0xe2fe=['../../config/environment','exports','define','SquareDetailsReport','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd647=['exports','define','SquareDetailsReport','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2e2c4a,_0x3aee9b){var _0x131e89=function(_0x50595d){while(--_0x50595d){_0x2e2c4a['push'](_0x2e2c4a['shift']());}};_0x131e89(++_0x3aee9b);}(_0xd647,0x8f));var _0x7d64=function(_0x407461,_0x1cf61c){_0x407461=_0x407461-0x0;var _0x2b3ffa=_0xd647[_0x407461];return _0x2b3ffa;};'use strict';var _=require('lodash');var util=require(_0x7d64('0x0'));var logger=require(_0x7d64('0x1'))('api');var moment=require(_0x7d64('0x2'));var BPromise=require(_0x7d64('0x3'));var rp=require(_0x7d64('0x4'));var fs=require('fs');var path=require(_0x7d64('0x5'));var rimraf=require('rimraf');var config=require(_0x7d64('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0x7d64('0x7')]=function(_0x32ac11,_0x4c3b07){return _0x32ac11[_0x7d64('0x8')](_0x7d64('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 5d1cd42..6b008ac 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 _0xc103=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','SquareDetailsReport','create','body','then','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x34c920,_0x4e622d){var _0x1b7589=function(_0x23eaad){while(--_0x23eaad){_0x34c920['push'](_0x34c920['shift']());}};_0x1b7589(++_0x4e622d);}(_0xc103,0x1bb));var _0x3c10=function(_0x308185,_0x1c0a41){_0x308185=_0x308185-0x0;var _0x952e8b=_0xc103[_0x308185];return _0x952e8b;};'use strict';var _=require(_0x3c10('0x0'));var util=require(_0x3c10('0x1'));var moment=require(_0x3c10('0x2'));var BPromise=require(_0x3c10('0x3'));var rs=require(_0x3c10('0x4'));var fs=require('fs');var Redis=require(_0x3c10('0x5'));var db=require(_0x3c10('0x6'))['db'];var utils=require(_0x3c10('0x7'));var logger=require(_0x3c10('0x8'))(_0x3c10('0x9'));var config=require(_0x3c10('0xa'));var jayson=require(_0x3c10('0xb'));var client=jayson[_0x3c10('0xc')][_0x3c10('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x9454ba,_0x37c9a1,_0x121ef2){return new BPromise(function(_0x3196da,_0x474640){return client[_0x3c10('0xe')](_0x9454ba,_0x121ef2)['then'](function(_0x1ff549){logger['info'](_0x3c10('0xf'),_0x37c9a1,_0x3c10('0x10'));logger[_0x3c10('0x11')](_0x3c10('0x12'),_0x37c9a1,_0x3c10('0x10'),JSON[_0x3c10('0x13')](_0x1ff549));if(_0x1ff549['error']){if(_0x1ff549[_0x3c10('0x14')][_0x3c10('0x15')]===0x1f4){logger['error'](_0x3c10('0xf'),_0x37c9a1,_0x1ff549['error'][_0x3c10('0x16')]);return _0x474640(_0x1ff549['error']['message']);}logger[_0x3c10('0x14')](_0x3c10('0xf'),_0x37c9a1,_0x1ff549[_0x3c10('0x14')][_0x3c10('0x16')]);return _0x3196da(_0x1ff549[_0x3c10('0x14')][_0x3c10('0x16')]);}else{logger[_0x3c10('0x17')](_0x3c10('0xf'),_0x37c9a1,_0x3c10('0x10'));_0x3196da(_0x1ff549[_0x3c10('0x18')]['message']);}})['catch'](function(_0x53c4ef){logger[_0x3c10('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x37c9a1,_0x53c4ef);_0x474640(_0x53c4ef);});});}exports['CreateSquareDetailsReport']=function(_0x4ed563){var _0x38013b=this;return new Promise(function(_0x7da41,_0x43c586){return db[_0x3c10('0x19')][_0x3c10('0x1a')](_0x4ed563[_0x3c10('0x1b')],{'raw':_0x4ed563['options']?_0x4ed563['options']['raw']===undefined?!![]:![]:!![]})[_0x3c10('0x1c')](function(_0x185ecf){logger[_0x3c10('0x17')](_0x3c10('0x1d'),_0x4ed563);logger[_0x3c10('0x11')](_0x3c10('0x1d'),_0x4ed563,JSON[_0x3c10('0x13')](_0x185ecf));_0x7da41(_0x185ecf);})['catch'](function(_0x951689){logger[_0x3c10('0x14')]('CreateSquareDetailsReport',_0x951689[_0x3c10('0x16')],_0x4ed563);_0x43c586(_0x38013b[_0x3c10('0x14')](0x1f4,_0x951689[_0x3c10('0x16')]));});});}; \ No newline at end of file +var _0x354c=['ioredis','../../config/utils','jayson/promise','http','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','CreateSquareDetailsReport','debug','util','moment','bluebird','randomstring'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x354c,0x173));var _0xc354=function(_0xeb19bc,_0x4eb2ff){_0xeb19bc=_0xeb19bc-0x0;var _0x2c721a=_0x354c[_0xeb19bc];return _0x2c721a;};'use strict';var _=require('lodash');var util=require(_0xc354('0x0'));var moment=require(_0xc354('0x1'));var BPromise=require(_0xc354('0x2'));var rs=require(_0xc354('0x3'));var fs=require('fs');var Redis=require(_0xc354('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc354('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc354('0x6'));var client=jayson['client'][_0xc354('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb1f768,_0x22a0a3,_0x1fe55b){return new BPromise(function(_0x635f0f,_0x48b665){return client['request'](_0xb1f768,_0x1fe55b)[_0xc354('0x8')](function(_0x167cf3){logger[_0xc354('0x9')](_0xc354('0xa'),_0x22a0a3,'request\x20sent');logger['debug'](_0xc354('0xb'),_0x22a0a3,_0xc354('0xc'),JSON[_0xc354('0xd')](_0x167cf3));if(_0x167cf3[_0xc354('0xe')]){if(_0x167cf3[_0xc354('0xe')][_0xc354('0xf')]===0x1f4){logger[_0xc354('0xe')](_0xc354('0xa'),_0x22a0a3,_0x167cf3[_0xc354('0xe')][_0xc354('0x10')]);return _0x48b665(_0x167cf3['error'][_0xc354('0x10')]);}logger[_0xc354('0xe')](_0xc354('0xa'),_0x22a0a3,_0x167cf3[_0xc354('0xe')]['message']);return _0x635f0f(_0x167cf3[_0xc354('0xe')][_0xc354('0x10')]);}else{logger[_0xc354('0x9')](_0xc354('0xa'),_0x22a0a3,_0xc354('0xc'));_0x635f0f(_0x167cf3[_0xc354('0x11')]['message']);}})[_0xc354('0x12')](function(_0x42c945){logger[_0xc354('0xe')](_0xc354('0xa'),_0x22a0a3,_0x42c945);_0x48b665(_0x42c945);});});}exports['CreateSquareDetailsReport']=function(_0x5a60a7){var _0x4d5af1=this;return new Promise(function(_0x321244,_0x127099){return db[_0xc354('0x13')][_0xc354('0x14')](_0x5a60a7[_0xc354('0x15')],{'raw':_0x5a60a7[_0xc354('0x16')]?_0x5a60a7[_0xc354('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xc354('0x8')](function(_0x1a9263){logger[_0xc354('0x9')](_0xc354('0x17'),_0x5a60a7);logger[_0xc354('0x18')]('CreateSquareDetailsReport',_0x5a60a7,JSON['stringify'](_0x1a9263));_0x321244(_0x1a9263);})[_0xc354('0x12')](function(_0x40b6ff){logger['error'](_0xc354('0x17'),_0x40b6ff[_0xc354('0x10')],_0x5a60a7);_0x127099(_0x4d5af1[_0xc354('0xe')](0x1f4,_0x40b6ff[_0xc354('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index c0ce8a1..32873e9 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 _0xf8a8=['killProcess','exports','express','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x587ca5,_0x3fb506){var _0x23c86a=function(_0x2664fb){while(--_0x2664fb){_0x587ca5['push'](_0x587ca5['shift']());}};_0x23c86a(++_0x3fb506);}(_0xf8a8,0x14f));var _0x8f8a=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xf8a8[_0x543084];return _0x306a57;};'use strict';var express=require(_0x8f8a('0x0'));var router=express['Router']();var auth=require(_0x8f8a('0x1'));var controller=require(_0x8f8a('0x2'));router[_0x8f8a('0x3')]('/',auth[_0x8f8a('0x4')](),controller[_0x8f8a('0x5')]);router[_0x8f8a('0x3')](_0x8f8a('0x6'),auth[_0x8f8a('0x4')](),controller[_0x8f8a('0x7')]);module[_0x8f8a('0x8')]=router; \ No newline at end of file +var _0xb6c6=['killProcess','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x26f081,_0x4277f3){var _0x4bf032=function(_0x1e49d8){while(--_0x1e49d8){_0x26f081['push'](_0x26f081['shift']());}};_0x4bf032(++_0x4277f3);}(_0xb6c6,0xeb));var _0x6b6c=function(_0x437f44,_0x5ee92c){_0x437f44=_0x437f44-0x0;var _0x2f93bb=_0xb6c6[_0x437f44];return _0x2f93bb;};'use strict';var express=require(_0x6b6c('0x0'));var router=express[_0x6b6c('0x1')]();var auth=require(_0x6b6c('0x2'));var controller=require(_0x6b6c('0x3'));router[_0x6b6c('0x4')]('/',auth[_0x6b6c('0x5')](),controller[_0x6b6c('0x6')]);router[_0x6b6c('0x4')](_0x6b6c('0x7'),auth['isAuthenticated'](),controller[_0x6b6c('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index c7ecdce..26e13ca 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 _0x508a=['then','json','catch','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','kill','SIGINT','killProcess','systeminformation','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0xa508('0x0'));var exec=require('child_process')[_0xa508('0x1')];var logger=require(_0xa508('0x2'))(_0xa508('0x3'));var util=require(_0xa508('0x4'));var BPromise=require(_0xa508('0x5'));var _=require('lodash');function handleError(_0x8f1c7a,_0x40f2f0,_0x2e26ae){_0x40f2f0=_0x40f2f0||0x1f4;return function(_0x4edcdf){logger[_0xa508('0x6')](_0xa508('0x7'),_0x2e26ae,_0x40f2f0,util[_0xa508('0x8')](_0x4edcdf,{'showHidden':![],'depth':null}));delete _0x4edcdf['name'];_0x8f1c7a[_0xa508('0x9')](_0x40f2f0)[_0xa508('0xa')](_0x4edcdf);};}exports['index']=function(_0x2ef948,_0x34508f){return info['getAllData']()[_0xa508('0xb')](function(_0x1dddf6){return _0x34508f[_0xa508('0x9')](0xc8)[_0xa508('0xc')](_0x1dddf6);})[_0xa508('0xd')](function(_0x53e069){return _0x34508f[_0xa508('0x9')](0x1f4)[_0xa508('0xc')](_0x53e069);});};exports['killProcess']=function(_0x26a2a2,_0x262e8a){var _0x2012d6=['components/import/cm'];return new BPromise(function(_0xc0511c,_0x56901e){return exec(util[_0xa508('0xe')](_0xa508('0xf'),_0x26a2a2[_0xa508('0x10')][_0xa508('0x11')]),function(_0x5cd0ce,_0xf68d,_0x45a0bc){if(_0x5cd0ce){return _0x56901e(_0x5cd0ce);}return _0xc0511c(_0xf68d);});})[_0xa508('0xb')](function(_0xb8b8f5){var _0x5e2d7d=![];var _0x15b852=_0xb8b8f5[_0xa508('0x12')](/\n/);for(var _0x23fbe6=0x0,_0xb76bf=_0x2012d6['length'];_0x23fbe6<_0xb76bf,_0x5e2d7d===![];_0x23fbe6+=0x1){if(_0xb8b8f5[_0xa508('0x13')](_0x2012d6[_0x23fbe6])>=0x0){_0x5e2d7d=!![];}}if(!_0x5e2d7d){throw new Error(util[_0xa508('0xe')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x26a2a2['params'][_0xa508('0x11')]));}process[_0xa508('0x14')](_0x26a2a2[_0xa508('0x10')][_0xa508('0x11')],_0xa508('0x15'));return _0x262e8a[_0xa508('0x9')](0xc8)[_0xa508('0xc')]({'message':util[_0xa508('0xe')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x26a2a2[_0xa508('0x10')][_0xa508('0x11')])});})[_0xa508('0xd')](handleError(_0x262e8a,null,_0xa508('0x16')));}; \ No newline at end of file +var _0x339d=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','format'];(function(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0x339d,0x14c));var _0xd339=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x339d[_0x5eb22e];return _0x27fed5;};'use strict';var info=require('systeminformation');var exec=require(_0xd339('0x0'))[_0xd339('0x1')];var logger=require(_0xd339('0x2'))(_0xd339('0x3'));var util=require('util');var BPromise=require(_0xd339('0x4'));var _=require(_0xd339('0x5'));function handleError(_0xd0c398,_0x4202b6,_0x3a4180){_0x4202b6=_0x4202b6||0x1f4;return function(_0x12b7ba){logger[_0xd339('0x6')](_0xd339('0x7'),_0x3a4180,_0x4202b6,util[_0xd339('0x8')](_0x12b7ba,{'showHidden':![],'depth':null}));delete _0x12b7ba[_0xd339('0x9')];_0xd0c398[_0xd339('0xa')](_0x4202b6)[_0xd339('0xb')](_0x12b7ba);};}exports[_0xd339('0xc')]=function(_0x133697,_0x4c6a08){return info[_0xd339('0xd')]()[_0xd339('0xe')](function(_0x24e7bc){return _0x4c6a08['status'](0xc8)[_0xd339('0xf')](_0x24e7bc);})[_0xd339('0x10')](function(_0xdb7d08){return _0x4c6a08[_0xd339('0xa')](0x1f4)[_0xd339('0xf')](_0xdb7d08);});};exports[_0xd339('0x11')]=function(_0x4898e1,_0x43404a){var _0x4f8d4e=['components/import/cm'];return new BPromise(function(_0x5a8e87,_0x36c761){return exec(util[_0xd339('0x12')](_0xd339('0x13'),_0x4898e1[_0xd339('0x14')][_0xd339('0x15')]),function(_0x401d81,_0x38968c,_0x573606){if(_0x401d81){return _0x36c761(_0x401d81);}return _0x5a8e87(_0x38968c);});})[_0xd339('0xe')](function(_0x2f86e5){var _0x11292d=![];var _0x50e4ad=_0x2f86e5[_0xd339('0x16')](/\n/);for(var _0x5ab49f=0x0,_0x6031c1=_0x4f8d4e[_0xd339('0x17')];_0x5ab49f<_0x6031c1,_0x11292d===![];_0x5ab49f+=0x1){if(_0x2f86e5[_0xd339('0x18')](_0x4f8d4e[_0x5ab49f])>=0x0){_0x11292d=!![];}}if(!_0x11292d){throw new Error(util['format'](_0xd339('0x19'),_0x4898e1[_0xd339('0x14')][_0xd339('0x15')]));}process[_0xd339('0x1a')](_0x4898e1[_0xd339('0x14')]['pid'],'SIGINT');return _0x43404a[_0xd339('0xa')](0xc8)[_0xd339('0xf')]({'message':util[_0xd339('0x12')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4898e1[_0xd339('0x14')][_0xd339('0x15')])});})['catch'](handleError(_0x43404a,null,_0xd339('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 2834bf8..0749e8b 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 _0x9a19=['create','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9a19,0x114));var _0x99a1=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0x9a19[_0x2132a3];return _0x21890c;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var auth=require(_0x99a1('0x5'));var interaction=require(_0x99a1('0x6'));var config=require(_0x99a1('0x7'));var controller=require(_0x99a1('0x8'));router[_0x99a1('0x9')]('/',auth[_0x99a1('0xa')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x9')](_0x99a1('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x99a1('0xa')](),controller[_0x99a1('0xd')]);router['put']('/:id',auth[_0x99a1('0xa')](),controller[_0x99a1('0xe')]);router[_0x99a1('0xf')](_0x99a1('0xc'),auth[_0x99a1('0xa')](),controller['destroy']);module[_0x99a1('0x10')]=router; \ No newline at end of file +var _0xf4eb=['../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','Router'];(function(_0x5b6333,_0x33317d){var _0x19c0ad=function(_0x46e53b){while(--_0x46e53b){_0x5b6333['push'](_0x5b6333['shift']());}};_0x19c0ad(++_0x33317d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x463dad,_0x4072dc){_0x463dad=_0x463dad-0x0;var _0x32d3bb=_0xf4eb[_0x463dad];return _0x32d3bb;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf4e('0x2'));var controller=require(_0xbf4e('0x3'));router[_0xbf4e('0x4')]('/',auth[_0xbf4e('0x5')](),controller[_0xbf4e('0x6')]);router[_0xbf4e('0x4')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller[_0xbf4e('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0xa')](_0xbf4e('0x7'),auth[_0xbf4e('0x5')](),controller[_0xbf4e('0xb')]);router[_0xbf4e('0xc')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xbf4e('0xd')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 376fe35..b6dd28b 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 _0x4fc2=['STRING','name','#0091EA','sequelize','exports'];(function(_0x18b000,_0x513c1b){var _0xfb7686=function(_0x1f2bb9){while(--_0x1f2bb9){_0x18b000['push'](_0x18b000['shift']());}};_0xfb7686(++_0x513c1b);}(_0x4fc2,0x111));var _0x24fc=function(_0x46a00a,_0x1ebb84){_0x46a00a=_0x46a00a-0x0;var _0x2fc495=_0x4fc2[_0x46a00a];return _0x2fc495;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'name':{'type':Sequelize[_0x24fc('0x2')],'unique':_0x24fc('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x24fc('0x4')},'description':{'type':Sequelize[_0x24fc('0x2')]}}; \ No newline at end of file +var _0xdd4f=['sequelize','STRING','#0091EA'];(function(_0x9eccd9,_0x5bd044){var _0xd5f487=function(_0x1e667c){while(--_0x1e667c){_0x9eccd9['push'](_0x9eccd9['shift']());}};_0xd5f487(++_0x5bd044);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x3e586a,_0xea7489){_0x3e586a=_0x3e586a-0x0;var _0x597c32=_0xdd4f[_0x3e586a];return _0x597c32;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xfdd4('0x1')],'defaultValue':_0xfdd4('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index d866501..f642adf 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 _0xc1fd=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','map','Tag','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x341b01,_0x45413f){var _0x33c111=function(_0x391026){while(--_0x391026){_0x341b01['push'](_0x341b01['shift']());}};_0x33c111(++_0x45413f);}(_0xc1fd,0x139));var _0xdc1f=function(_0x575c7a,_0x48c0a8){_0x575c7a=_0x575c7a-0x0;var _0x144f5e=_0xc1fd[_0x575c7a];return _0x144f5e;};'use strict';var pdf=require(_0xdc1f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdc1f('0x1'));var zipdir=require(_0xdc1f('0x2'));var jsonpatch=require(_0xdc1f('0x3'));var rp=require(_0xdc1f('0x4'));var moment=require(_0xdc1f('0x5'));var BPromise=require(_0xdc1f('0x6'));var Mustache=require(_0xdc1f('0x7'));var util=require('util');var path=require(_0xdc1f('0x8'));var sox=require(_0xdc1f('0x9'));var csv=require('to-csv');var ejs=require(_0xdc1f('0xa'));var fs=require('fs');var _=require(_0xdc1f('0xb'));var squel=require(_0xdc1f('0xc'));var crypto=require(_0xdc1f('0xd'));var jsforce=require(_0xdc1f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdc1f('0xf'));var Papa=require(_0xdc1f('0x10'));var Redis=require(_0xdc1f('0x11'));var authService=require(_0xdc1f('0x12'));var qs=require(_0xdc1f('0x13'));var as=require(_0xdc1f('0x14'));var hardwareService=require(_0xdc1f('0x15'));var logger=require(_0xdc1f('0x16'))(_0xdc1f('0x17'));var utils=require(_0xdc1f('0x18'));var config=require(_0xdc1f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc1f('0x1a'))['db'];function respondWithStatusCode(_0x43facd,_0x1de4f0){_0x1de4f0=_0x1de4f0||0xcc;return function(_0x4689b7){if(_0x4689b7){return _0x43facd[_0xdc1f('0x1b')](_0x1de4f0);}return _0x43facd[_0xdc1f('0x1c')](_0x1de4f0)[_0xdc1f('0x1d')]();};}function respondWithResult(_0x44fcd7,_0x40f322){_0x40f322=_0x40f322||0xc8;return function(_0x21d02a){if(_0x21d02a){return _0x44fcd7[_0xdc1f('0x1c')](_0x40f322)[_0xdc1f('0x1e')](_0x21d02a);}};}function respondWithFilteredResult(_0x231eca,_0x2eb628){return function(_0x4a1c62){if(_0x4a1c62){var _0xd64f8a=_0x4a1c62[_0xdc1f('0x1f')],_0x2d566c=_0x2eb628[_0xdc1f('0x20')],_0x5909ab=_0x2eb628[_0xdc1f('0x20')]+_0x2eb628[_0xdc1f('0x21')],_0x32146a;if(_0x5909ab>=_0xd64f8a){_0x5909ab=_0xd64f8a;_0x32146a=0xc8;}else{_0x32146a=0xce;}_0x231eca[_0xdc1f('0x1c')](_0x32146a);return _0x231eca['set']('Content-Range',_0x2d566c+'-'+_0x5909ab+'/'+_0xd64f8a)['json'](_0x4a1c62);}return null;};}function patchUpdates(_0x1b3b2b){return function(_0xc593fb){try{jsonpatch[_0xdc1f('0x22')](_0xc593fb,_0x1b3b2b,!![]);}catch(_0x7bd933){return BPromise[_0xdc1f('0x23')](_0x7bd933);}return _0xc593fb[_0xdc1f('0x24')]();};}function saveUpdates(_0x35a905,_0x40f060){return function(_0x7dfa36){if(_0x7dfa36){return _0x7dfa36[_0xdc1f('0x25')](_0x35a905)[_0xdc1f('0x26')](function(_0x59c338){return _0x59c338;});}return null;};}function removeEntity(_0x40ca75,_0x2ee669){return function(_0x3391da){if(_0x3391da){return _0x3391da['destroy']()[_0xdc1f('0x26')](function(){var _0x1d21ca=_0x3391da[_0xdc1f('0x27')]({'plain':!![]});var _0x31e74e=_0xdc1f('0x28');return db[_0xdc1f('0x29')][_0xdc1f('0x2a')]({'where':{'type':_0x31e74e,'resourceId':_0x1d21ca['id']}})[_0xdc1f('0x26')](function(){return _0x3391da;});})[_0xdc1f('0x26')](function(){_0x40ca75['status'](0xcc)[_0xdc1f('0x1d')]();});}};}function handleEntityNotFound(_0x53ef2c,_0x5456aa){return function(_0x34c8e8){if(!_0x34c8e8){_0x53ef2c[_0xdc1f('0x1b')](0x194);}return _0x34c8e8;};}function handleError(_0x328c4b,_0x4c6b56){_0x4c6b56=_0x4c6b56||0x1f4;return function(_0x280297){logger[_0xdc1f('0x2b')](_0x280297[_0xdc1f('0x2c')]);if(_0x280297['name']){delete _0x280297[_0xdc1f('0x2d')];}_0x328c4b[_0xdc1f('0x1c')](_0x4c6b56)[_0xdc1f('0x2e')](_0x280297);};}exports['index']=function(_0x1d036e,_0x3cf24e){var _0x1d903b={},_0x2eec69={},_0x39505d={'count':0x0,'rows':[]};var _0x1ed945=_[_0xdc1f('0x2f')](db[_0xdc1f('0x30')]['rawAttributes'],function(_0x51eb8a){return{'name':_0x51eb8a['fieldName'],'type':_0x51eb8a[_0xdc1f('0x31')][_0xdc1f('0x32')]};});_0x2eec69[_0xdc1f('0x33')]=_['map'](_0x1ed945,_0xdc1f('0x2d'));_0x2eec69[_0xdc1f('0x34')]=_['keys'](_0x1d036e[_0xdc1f('0x34')]);_0x2eec69[_0xdc1f('0x35')]=_['intersection'](_0x2eec69[_0xdc1f('0x33')],_0x2eec69[_0xdc1f('0x34')]);_0x1d903b[_0xdc1f('0x36')]=_[_0xdc1f('0x37')](_0x2eec69[_0xdc1f('0x33')],qs[_0xdc1f('0x38')](_0x1d036e[_0xdc1f('0x34')][_0xdc1f('0x38')]));_0x1d903b[_0xdc1f('0x36')]=_0x1d903b[_0xdc1f('0x36')][_0xdc1f('0x39')]?_0x1d903b[_0xdc1f('0x36')]:_0x2eec69[_0xdc1f('0x33')];if(!_0x1d036e[_0xdc1f('0x34')][_0xdc1f('0x3a')](_0xdc1f('0x3b'))){_0x1d903b['limit']=qs[_0xdc1f('0x21')](_0x1d036e[_0xdc1f('0x34')]['limit']);_0x1d903b[_0xdc1f('0x20')]=qs[_0xdc1f('0x20')](_0x1d036e[_0xdc1f('0x34')][_0xdc1f('0x20')]);}_0x1d903b['order']=qs[_0xdc1f('0x3c')](_0x1d036e['query'][_0xdc1f('0x3c')]);_0x1d903b[_0xdc1f('0x3d')]=qs[_0xdc1f('0x35')](_[_0xdc1f('0x3e')](_0x1d036e['query'],_0x2eec69['filters']),_0x1ed945);if(_0x1d036e['query'][_0xdc1f('0x3f')]){_0x1d903b[_0xdc1f('0x3d')]=_[_0xdc1f('0x40')](_0x1d903b[_0xdc1f('0x3d')],{'$or':_[_0xdc1f('0x2f')](_0x1ed945,function(_0x5de21d){if(_0x5de21d[_0xdc1f('0x31')]!==_0xdc1f('0x41')){var _0x2acbfe={};_0x2acbfe[_0x5de21d['name']]={'$like':'%'+_0x1d036e[_0xdc1f('0x34')][_0xdc1f('0x3f')]+'%'};return _0x2acbfe;}})});}_0x1d903b=_[_0xdc1f('0x40')]({},_0x1d903b,_0x1d036e['options']);var _0x537899={'where':_0x1d903b[_0xdc1f('0x3d')]};return db[_0xdc1f('0x30')][_0xdc1f('0x1f')](_0x537899)['then'](function(_0x2b952c){_0x39505d[_0xdc1f('0x1f')]=_0x2b952c;if(_0x1d036e[_0xdc1f('0x34')][_0xdc1f('0x42')]){_0x1d903b[_0xdc1f('0x43')]=[{'all':!![]}];}return db['Tag'][_0xdc1f('0x44')](_0x1d903b);})['then'](function(_0x4493f8){_0x39505d[_0xdc1f('0x45')]=_0x4493f8;return _0x39505d;})[_0xdc1f('0x26')](respondWithFilteredResult(_0x3cf24e,_0x1d903b))[_0xdc1f('0x46')](handleError(_0x3cf24e,null));};exports['show']=function(_0x4a5cc0,_0x5b5394){var _0x2be91a={'raw':!![],'where':{'id':_0x4a5cc0[_0xdc1f('0x47')]['id']}},_0x1bd8ab={};_0x1bd8ab['model']=_[_0xdc1f('0x48')](db[_0xdc1f('0x30')][_0xdc1f('0x49')]);_0x1bd8ab['query']=_[_0xdc1f('0x48')](_0x4a5cc0['query']);_0x1bd8ab[_0xdc1f('0x35')]=_[_0xdc1f('0x37')](_0x1bd8ab[_0xdc1f('0x33')],_0x1bd8ab[_0xdc1f('0x34')]);_0x2be91a[_0xdc1f('0x36')]=_['intersection'](_0x1bd8ab[_0xdc1f('0x33')],qs[_0xdc1f('0x38')](_0x4a5cc0[_0xdc1f('0x34')][_0xdc1f('0x38')]));_0x2be91a[_0xdc1f('0x36')]=_0x2be91a[_0xdc1f('0x36')][_0xdc1f('0x39')]?_0x2be91a[_0xdc1f('0x36')]:_0x1bd8ab['model'];if(_0x4a5cc0[_0xdc1f('0x34')][_0xdc1f('0x42')]){_0x2be91a[_0xdc1f('0x43')]=[{'all':!![]}];}_0x2be91a=_[_0xdc1f('0x40')]({},_0x2be91a,_0x4a5cc0['options']);return db[_0xdc1f('0x30')][_0xdc1f('0x4a')](_0x2be91a)[_0xdc1f('0x26')](handleEntityNotFound(_0x5b5394,null))['then'](respondWithResult(_0x5b5394,null))['catch'](handleError(_0x5b5394,null));};exports[_0xdc1f('0x4b')]=function(_0x3f92a5,_0x16d585){return db[_0xdc1f('0x30')][_0xdc1f('0x4b')](_0x3f92a5['body'],{})['then'](function(_0x37b099){var _0x273b24=_0x3f92a5[_0xdc1f('0x4c')][_0xdc1f('0x27')]({'plain':!![]});if(!_0x273b24)throw new Error(_0xdc1f('0x4d'));if(_0x273b24['role']==='user'){var _0x16efba=_0x37b099[_0xdc1f('0x27')]({'plain':!![]});var _0x12f32d=_0xdc1f('0x28');return db[_0xdc1f('0x4e')]['find']({'where':{'name':_0x12f32d,'userProfileId':_0x273b24[_0xdc1f('0x4f')]},'raw':!![]})[_0xdc1f('0x26')](function(_0xf2536f){if(_0xf2536f&&_0xf2536f[_0xdc1f('0x50')]===0x0){return db[_0xdc1f('0x29')]['create']({'name':_0x16efba[_0xdc1f('0x2d')],'resourceId':_0x16efba['id'],'type':_0xf2536f[_0xdc1f('0x2d')],'sectionId':_0xf2536f['id']},{})[_0xdc1f('0x26')](function(){return _0x37b099;});}else{return _0x37b099;}})['catch'](function(_0x5563cc){logger[_0xdc1f('0x2b')](_0xdc1f('0x51'),_0x5563cc);throw _0x5563cc;});}return _0x37b099;})[_0xdc1f('0x26')](respondWithResult(_0x16d585,0xc9))[_0xdc1f('0x46')](handleError(_0x16d585,null));};exports[_0xdc1f('0x25')]=function(_0x38d243,_0x195d0a){if(_0x38d243[_0xdc1f('0x52')]['id']){delete _0x38d243['body']['id'];}return db[_0xdc1f('0x30')][_0xdc1f('0x4a')]({'where':{'id':_0x38d243['params']['id']}})[_0xdc1f('0x26')](handleEntityNotFound(_0x195d0a,null))[_0xdc1f('0x26')](saveUpdates(_0x38d243[_0xdc1f('0x52')],null))['then'](respondWithResult(_0x195d0a,null))[_0xdc1f('0x46')](handleError(_0x195d0a,null));};exports[_0xdc1f('0x2a')]=function(_0x56bd1d,_0x3aeee8){return db[_0xdc1f('0x30')][_0xdc1f('0x4a')]({'where':{'id':_0x56bd1d[_0xdc1f('0x47')]['id']}})[_0xdc1f('0x26')](handleEntityNotFound(_0x3aeee8,null))[_0xdc1f('0x26')](removeEntity(_0x3aeee8,null))[_0xdc1f('0x46')](handleError(_0x3aeee8,null));}; \ No newline at end of file +var _0x6276=['path','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','limit','set','Content-Range','apply','reject','save','then','Tags','UserProfileResource','destroy','error','name','send','index','Tag','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6276,0x18d));var _0x6627=function(_0x5dc4c8,_0x5b8f28){_0x5dc4c8=_0x5dc4c8-0x0;var _0x455d2a=_0x6276[_0x5dc4c8];return _0x455d2a;};'use strict';var pdf=require(_0x6627('0x0'));var emlformat=require(_0x6627('0x1'));var rimraf=require(_0x6627('0x2'));var zipdir=require(_0x6627('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6627('0x4'));var moment=require(_0x6627('0x5'));var BPromise=require(_0x6627('0x6'));var Mustache=require(_0x6627('0x7'));var util=require('util');var path=require(_0x6627('0x8'));var sox=require('sox');var csv=require(_0x6627('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6627('0xa'));var squel=require('squel');var crypto=require(_0x6627('0xb'));var jsforce=require(_0x6627('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6627('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6627('0xd'));var authService=require(_0x6627('0xe'));var qs=require(_0x6627('0xf'));var as=require(_0x6627('0x10'));var hardwareService=require(_0x6627('0x11'));var logger=require(_0x6627('0x12'))(_0x6627('0x13'));var utils=require(_0x6627('0x14'));var config=require(_0x6627('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x156e79,_0x194f52){_0x194f52=_0x194f52||0xcc;return function(_0x1771fc){if(_0x1771fc){return _0x156e79['sendStatus'](_0x194f52);}return _0x156e79[_0x6627('0x16')](_0x194f52)['end']();};}function respondWithResult(_0x58ff1a,_0x22d85e){_0x22d85e=_0x22d85e||0xc8;return function(_0x4fcf2a){if(_0x4fcf2a){return _0x58ff1a['status'](_0x22d85e)[_0x6627('0x17')](_0x4fcf2a);}};}function respondWithFilteredResult(_0x4a71cc,_0x53c2bc){return function(_0x2525e5){if(_0x2525e5){var _0x18ce8e=_0x2525e5['count'],_0x449edd=_0x53c2bc['offset'],_0x416cd1=_0x53c2bc[_0x6627('0x18')]+_0x53c2bc[_0x6627('0x19')],_0x1f9e59;if(_0x416cd1>=_0x18ce8e){_0x416cd1=_0x18ce8e;_0x1f9e59=0xc8;}else{_0x1f9e59=0xce;}_0x4a71cc[_0x6627('0x16')](_0x1f9e59);return _0x4a71cc[_0x6627('0x1a')](_0x6627('0x1b'),_0x449edd+'-'+_0x416cd1+'/'+_0x18ce8e)['json'](_0x2525e5);}return null;};}function patchUpdates(_0x5dc463){return function(_0x4da1){try{jsonpatch[_0x6627('0x1c')](_0x4da1,_0x5dc463,!![]);}catch(_0x2adc08){return BPromise[_0x6627('0x1d')](_0x2adc08);}return _0x4da1[_0x6627('0x1e')]();};}function saveUpdates(_0x58280e,_0x1f5124){return function(_0xbf4645){if(_0xbf4645){return _0xbf4645['update'](_0x58280e)[_0x6627('0x1f')](function(_0x8e18af){return _0x8e18af;});}return null;};}function removeEntity(_0x59dfac,_0xfd3bc){return function(_0x425eae){if(_0x425eae){return _0x425eae['destroy']()[_0x6627('0x1f')](function(){var _0x2940c8=_0x425eae['get']({'plain':!![]});var _0x313ad8=_0x6627('0x20');return db[_0x6627('0x21')][_0x6627('0x22')]({'where':{'type':_0x313ad8,'resourceId':_0x2940c8['id']}})[_0x6627('0x1f')](function(){return _0x425eae;});})[_0x6627('0x1f')](function(){_0x59dfac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15024c,_0x223855){return function(_0x3026ef){if(!_0x3026ef){_0x15024c['sendStatus'](0x194);}return _0x3026ef;};}function handleError(_0xca64bd,_0x68793a){_0x68793a=_0x68793a||0x1f4;return function(_0x26f98e){logger[_0x6627('0x23')](_0x26f98e['stack']);if(_0x26f98e[_0x6627('0x24')]){delete _0x26f98e[_0x6627('0x24')];}_0xca64bd[_0x6627('0x16')](_0x68793a)[_0x6627('0x25')](_0x26f98e);};}exports[_0x6627('0x26')]=function(_0x17c46a,_0x18af74){var _0x118197={},_0x3324b2={},_0x562895={'count':0x0,'rows':[]};var _0x91ac4c=_['map'](db[_0x6627('0x27')]['rawAttributes'],function(_0x47877e){return{'name':_0x47877e[_0x6627('0x28')],'type':_0x47877e[_0x6627('0x29')][_0x6627('0x2a')]};});_0x3324b2['model']=_[_0x6627('0x2b')](_0x91ac4c,_0x6627('0x24'));_0x3324b2[_0x6627('0x2c')]=_[_0x6627('0x2d')](_0x17c46a[_0x6627('0x2c')]);_0x3324b2[_0x6627('0x2e')]=_[_0x6627('0x2f')](_0x3324b2[_0x6627('0x30')],_0x3324b2[_0x6627('0x2c')]);_0x118197[_0x6627('0x31')]=_[_0x6627('0x2f')](_0x3324b2[_0x6627('0x30')],qs[_0x6627('0x32')](_0x17c46a[_0x6627('0x2c')][_0x6627('0x32')]));_0x118197[_0x6627('0x31')]=_0x118197['attributes']['length']?_0x118197[_0x6627('0x31')]:_0x3324b2[_0x6627('0x30')];if(!_0x17c46a[_0x6627('0x2c')][_0x6627('0x33')](_0x6627('0x34'))){_0x118197['limit']=qs[_0x6627('0x19')](_0x17c46a[_0x6627('0x2c')][_0x6627('0x19')]);_0x118197[_0x6627('0x18')]=qs[_0x6627('0x18')](_0x17c46a[_0x6627('0x2c')][_0x6627('0x18')]);}_0x118197['order']=qs['sort'](_0x17c46a[_0x6627('0x2c')][_0x6627('0x35')]);_0x118197[_0x6627('0x36')]=qs[_0x6627('0x2e')](_[_0x6627('0x37')](_0x17c46a['query'],_0x3324b2[_0x6627('0x2e')]),_0x91ac4c);if(_0x17c46a[_0x6627('0x2c')][_0x6627('0x38')]){_0x118197[_0x6627('0x36')]=_['merge'](_0x118197[_0x6627('0x36')],{'$or':_[_0x6627('0x2b')](_0x91ac4c,function(_0x1415ae){if(_0x1415ae[_0x6627('0x29')]!==_0x6627('0x39')){var _0x37c2b1={};_0x37c2b1[_0x1415ae[_0x6627('0x24')]]={'$like':'%'+_0x17c46a[_0x6627('0x2c')][_0x6627('0x38')]+'%'};return _0x37c2b1;}})});}_0x118197=_[_0x6627('0x3a')]({},_0x118197,_0x17c46a[_0x6627('0x3b')]);var _0x199bf1={'where':_0x118197[_0x6627('0x36')]};return db['Tag'][_0x6627('0x3c')](_0x199bf1)[_0x6627('0x1f')](function(_0x2323f8){_0x562895[_0x6627('0x3c')]=_0x2323f8;if(_0x17c46a[_0x6627('0x2c')][_0x6627('0x3d')]){_0x118197[_0x6627('0x3e')]=[{'all':!![]}];}return db[_0x6627('0x27')][_0x6627('0x3f')](_0x118197);})[_0x6627('0x1f')](function(_0x34137c){_0x562895[_0x6627('0x40')]=_0x34137c;return _0x562895;})[_0x6627('0x1f')](respondWithFilteredResult(_0x18af74,_0x118197))[_0x6627('0x41')](handleError(_0x18af74,null));};exports[_0x6627('0x42')]=function(_0x1003fe,_0x1d177f){var _0x286931={'raw':!![],'where':{'id':_0x1003fe[_0x6627('0x43')]['id']}},_0x104294={};_0x104294[_0x6627('0x30')]=_['keys'](db['Tag'][_0x6627('0x44')]);_0x104294[_0x6627('0x2c')]=_['keys'](_0x1003fe[_0x6627('0x2c')]);_0x104294['filters']=_[_0x6627('0x2f')](_0x104294[_0x6627('0x30')],_0x104294[_0x6627('0x2c')]);_0x286931[_0x6627('0x31')]=_[_0x6627('0x2f')](_0x104294['model'],qs[_0x6627('0x32')](_0x1003fe['query'][_0x6627('0x32')]));_0x286931['attributes']=_0x286931[_0x6627('0x31')][_0x6627('0x45')]?_0x286931[_0x6627('0x31')]:_0x104294[_0x6627('0x30')];if(_0x1003fe[_0x6627('0x2c')][_0x6627('0x3d')]){_0x286931[_0x6627('0x3e')]=[{'all':!![]}];}_0x286931=_[_0x6627('0x3a')]({},_0x286931,_0x1003fe[_0x6627('0x3b')]);return db['Tag']['find'](_0x286931)['then'](handleEntityNotFound(_0x1d177f,null))[_0x6627('0x1f')](respondWithResult(_0x1d177f,null))[_0x6627('0x41')](handleError(_0x1d177f,null));};exports[_0x6627('0x46')]=function(_0x2963fc,_0x2959f4){return db[_0x6627('0x27')][_0x6627('0x46')](_0x2963fc[_0x6627('0x47')],{})['then'](function(_0x509fd5){var _0x378c98=_0x2963fc[_0x6627('0x48')]['get']({'plain':!![]});if(!_0x378c98)throw new Error(_0x6627('0x49'));if(_0x378c98[_0x6627('0x4a')]===_0x6627('0x48')){var _0x3acc39=_0x509fd5[_0x6627('0x4b')]({'plain':!![]});var _0x1d781c='Tags';return db[_0x6627('0x4c')][_0x6627('0x4d')]({'where':{'name':_0x1d781c,'userProfileId':_0x378c98[_0x6627('0x4e')]},'raw':!![]})[_0x6627('0x1f')](function(_0x246d30){if(_0x246d30&&_0x246d30['autoAssociation']===0x0){return db[_0x6627('0x21')][_0x6627('0x46')]({'name':_0x3acc39['name'],'resourceId':_0x3acc39['id'],'type':_0x246d30[_0x6627('0x24')],'sectionId':_0x246d30['id']},{})[_0x6627('0x1f')](function(){return _0x509fd5;});}else{return _0x509fd5;}})[_0x6627('0x41')](function(_0x47f094){logger[_0x6627('0x23')](_0x6627('0x4f'),_0x47f094);throw _0x47f094;});}return _0x509fd5;})[_0x6627('0x1f')](respondWithResult(_0x2959f4,0xc9))[_0x6627('0x41')](handleError(_0x2959f4,null));};exports[_0x6627('0x50')]=function(_0x529b8f,_0x19c53c){if(_0x529b8f[_0x6627('0x47')]['id']){delete _0x529b8f[_0x6627('0x47')]['id'];}return db[_0x6627('0x27')][_0x6627('0x4d')]({'where':{'id':_0x529b8f['params']['id']}})['then'](handleEntityNotFound(_0x19c53c,null))[_0x6627('0x1f')](saveUpdates(_0x529b8f['body'],null))[_0x6627('0x1f')](respondWithResult(_0x19c53c,null))[_0x6627('0x41')](handleError(_0x19c53c,null));};exports[_0x6627('0x22')]=function(_0x4c6d05,_0x1c8228){return db[_0x6627('0x27')][_0x6627('0x4d')]({'where':{'id':_0x4c6d05['params']['id']}})[_0x6627('0x1f')](handleEntityNotFound(_0x1c8228,null))['then'](removeEntity(_0x1c8228,null))[_0x6627('0x41')](handleError(_0x1c8228,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 73182b1..4dc1cf6 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 _0x0149=['define','Tag','tools_tags','lodash','util','../../config/logger','api','bluebird','request-promise','path','exports'];(function(_0x4d9b91,_0x117239){var _0x259cd2=function(_0x26ba34){while(--_0x26ba34){_0x4d9b91['push'](_0x4d9b91['shift']());}};_0x259cd2(++_0x117239);}(_0x0149,0x92));var _0x9014=function(_0x19457a,_0x2e65c7){_0x19457a=_0x19457a-0x0;var _0x112be0=_0x0149[_0x19457a];return _0x112be0;};'use strict';var _=require(_0x9014('0x0'));var util=require(_0x9014('0x1'));var logger=require(_0x9014('0x2'))(_0x9014('0x3'));var moment=require('moment');var BPromise=require(_0x9014('0x4'));var rp=require(_0x9014('0x5'));var fs=require('fs');var path=require(_0x9014('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x9014('0x7')]=function(_0x2a31bf,_0x9baaaf){return _0x2a31bf[_0x9014('0x8')](_0x9014('0x9'),attributes,{'tableName':_0x9014('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbee0=['../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x21d64b,_0x11af62){var _0x50b1b4=function(_0x27bf05){while(--_0x27bf05){_0x21d64b['push'](_0x21d64b['shift']());}};_0x50b1b4(++_0x11af62);}(_0xbee0,0xae));var _0x0bee=function(_0x536a73,_0x264f29){_0x536a73=_0x536a73-0x0;var _0x4699fa=_0xbee0[_0x536a73];return _0x4699fa;};'use strict';var _=require(_0x0bee('0x0'));var util=require(_0x0bee('0x1'));var logger=require(_0x0bee('0x2'))(_0x0bee('0x3'));var moment=require(_0x0bee('0x4'));var BPromise=require(_0x0bee('0x5'));var rp=require(_0x0bee('0x6'));var fs=require('fs');var path=require(_0x0bee('0x7'));var rimraf=require('rimraf');var config=require(_0x0bee('0x8'));var attributes=require(_0x0bee('0x9'));module[_0x0bee('0xa')]=function(_0x465e1b,_0x3644e9){return _0x465e1b['define'](_0x0bee('0xb'),attributes,{'tableName':_0x0bee('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 a0fc9b7..3012fec 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 _0x57f8=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xbfee3b,_0x241517){var _0x32675e=function(_0x83e3cc){while(--_0x83e3cc){_0xbfee3b['push'](_0xbfee3b['shift']());}};_0x32675e(++_0x241517);}(_0x57f8,0x198));var _0x857f=function(_0x50a864,_0x3303e2){_0x50a864=_0x50a864-0x0;var _0x2fb82f=_0x57f8[_0x50a864];return _0x2fb82f;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var moment=require(_0x857f('0x1'));var BPromise=require(_0x857f('0x2'));var rs=require(_0x857f('0x3'));var fs=require('fs');var Redis=require(_0x857f('0x4'));var db=require(_0x857f('0x5'))['db'];var utils=require(_0x857f('0x6'));var logger=require(_0x857f('0x7'))(_0x857f('0x8'));var config=require(_0x857f('0x9'));var jayson=require(_0x857f('0xa'));var client=jayson[_0x857f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8380e8,_0x197098,_0x1aaeea){return new BPromise(function(_0x577fc3,_0x5f6a66){return client[_0x857f('0xc')](_0x8380e8,_0x1aaeea)[_0x857f('0xd')](function(_0x4f2b09){logger[_0x857f('0xe')](_0x857f('0xf'),_0x197098,_0x857f('0x10'));logger['debug'](_0x857f('0x11'),_0x197098,_0x857f('0x10'),JSON[_0x857f('0x12')](_0x4f2b09));if(_0x4f2b09[_0x857f('0x13')]){if(_0x4f2b09[_0x857f('0x13')][_0x857f('0x14')]===0x1f4){logger[_0x857f('0x13')]('Tag,\x20%s,\x20%s',_0x197098,_0x4f2b09[_0x857f('0x13')][_0x857f('0x15')]);return _0x5f6a66(_0x4f2b09[_0x857f('0x13')][_0x857f('0x15')]);}logger[_0x857f('0x13')]('Tag,\x20%s,\x20%s',_0x197098,_0x4f2b09['error'][_0x857f('0x15')]);return _0x577fc3(_0x4f2b09['error'][_0x857f('0x15')]);}else{logger['info'](_0x857f('0xf'),_0x197098,_0x857f('0x10'));_0x577fc3(_0x4f2b09['result'][_0x857f('0x15')]);}})[_0x857f('0x16')](function(_0xdf14fe){logger[_0x857f('0x13')](_0x857f('0xf'),_0x197098,_0xdf14fe);_0x5f6a66(_0xdf14fe);});});} \ No newline at end of file +var _0xca66=['http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0xbb03ed,_0x5bed48){var _0x275d6c=function(_0xcb200b){while(--_0xcb200b){_0xbb03ed['push'](_0xbb03ed['shift']());}};_0x275d6c(++_0x5bed48);}(_0xca66,0x8b));var _0x6ca6=function(_0x589240,_0x50a00f){_0x589240=_0x589240-0x0;var _0x2fcbd3=_0xca66[_0x589240];return _0x2fcbd3;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ca6('0x1'));var rs=require(_0x6ca6('0x2'));var fs=require('fs');var Redis=require(_0x6ca6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ca6('0x4'));var logger=require('../../config/logger')(_0x6ca6('0x5'));var config=require('../../config/environment');var jayson=require(_0x6ca6('0x6'));var client=jayson[_0x6ca6('0x7')][_0x6ca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44019c,_0x407e66,_0x27a210){return new BPromise(function(_0x27d280,_0x4f5651){return client[_0x6ca6('0x9')](_0x44019c,_0x27a210)[_0x6ca6('0xa')](function(_0x34b71b){logger[_0x6ca6('0xb')](_0x6ca6('0xc'),_0x407e66,_0x6ca6('0xd'));logger[_0x6ca6('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'),JSON[_0x6ca6('0xf')](_0x34b71b));if(_0x34b71b[_0x6ca6('0x10')]){if(_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x11')]===0x1f4){logger[_0x6ca6('0x10')]('Tag,\x20%s,\x20%s',_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x4f5651(_0x34b71b['error'][_0x6ca6('0x12')]);}logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x27d280(_0x34b71b[_0x6ca6('0x10')]['message']);}else{logger['info']('Tag,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'));_0x27d280(_0x34b71b[_0x6ca6('0x13')][_0x6ca6('0x12')]);}})[_0x6ca6('0x14')](function(_0x2c4a5c){logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x2c4a5c);_0x4f5651(_0x2c4a5c);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 119e289..bbb5531 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 _0x767e=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','show','/:id/users','getAgents','post','create','addAgents','put','/:id','update','delete','/:id/queues','removeQueues','removeAgents'];(function(_0x30a35a,_0x74985f){var _0x5a9c74=function(_0x1ef14c){while(--_0x1ef14c){_0x30a35a['push'](_0x30a35a['shift']());}};_0x5a9c74(++_0x74985f);}(_0x767e,0x186));var _0xe767=function(_0x18d307,_0x3dd486){_0x18d307=_0x18d307-0x0;var _0x3b8d06=_0x767e[_0x18d307];return _0x3b8d06;};'use strict';var multer=require(_0xe767('0x0'));var util=require(_0xe767('0x1'));var path=require(_0xe767('0x2'));var timeout=require(_0xe767('0x3'));var express=require(_0xe767('0x4'));var router=express[_0xe767('0x5')]();var auth=require(_0xe767('0x6'));var interaction=require(_0xe767('0x7'));var config=require(_0xe767('0x8'));var controller=require(_0xe767('0x9'));router[_0xe767('0xa')]('/',auth[_0xe767('0xb')](),controller[_0xe767('0xc')]);router['get']('/:id',auth[_0xe767('0xb')](),controller[_0xe767('0xd')]);router['get']('/:id/queues',auth[_0xe767('0xb')](),controller['getQueues']);router[_0xe767('0xa')](_0xe767('0xe'),auth[_0xe767('0xb')](),controller[_0xe767('0xf')]);router[_0xe767('0x10')]('/',auth[_0xe767('0xb')](),controller[_0xe767('0x11')]);router[_0xe767('0x10')]('/:id/queues',auth[_0xe767('0xb')](),controller['addQueues']);router[_0xe767('0x10')]('/:id/users',auth[_0xe767('0xb')](),controller[_0xe767('0x12')]);router[_0xe767('0x13')](_0xe767('0x14'),auth['isAuthenticated'](),controller[_0xe767('0x15')]);router[_0xe767('0x16')](_0xe767('0x14'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xe767('0x17'),auth[_0xe767('0xb')](),controller[_0xe767('0x18')]);router['delete'](_0xe767('0xe'),auth[_0xe767('0xb')](),controller[_0xe767('0x19')]);module['exports']=router; \ No newline at end of file +var _0x6843=['multer','path','connect-timeout','../../components/auth/service','./team.controller','get','isAuthenticated','index','show','/:id/queues','getAgents','post','addQueues','/:id/users','addAgents','put','/:id','update','destroy','delete','removeQueues','removeAgents','exports'];(function(_0x5e76b4,_0x24d325){var _0x14e2be=function(_0x4f45ff){while(--_0x4f45ff){_0x5e76b4['push'](_0x5e76b4['shift']());}};_0x14e2be(++_0x24d325);}(_0x6843,0x1b5));var _0x3684=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0x6843[_0x3dc68d];return _0xdf7f94;};'use strict';var multer=require(_0x3684('0x0'));var util=require('util');var path=require(_0x3684('0x1'));var timeout=require(_0x3684('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3684('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3684('0x4'));router[_0x3684('0x5')]('/',auth[_0x3684('0x6')](),controller[_0x3684('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3684('0x8')]);router[_0x3684('0x5')](_0x3684('0x9'),auth[_0x3684('0x6')](),controller['getQueues']);router[_0x3684('0x5')]('/:id/users',auth[_0x3684('0x6')](),controller[_0x3684('0xa')]);router[_0x3684('0xb')]('/',auth[_0x3684('0x6')](),controller['create']);router[_0x3684('0xb')](_0x3684('0x9'),auth[_0x3684('0x6')](),controller[_0x3684('0xc')]);router[_0x3684('0xb')](_0x3684('0xd'),auth[_0x3684('0x6')](),controller[_0x3684('0xe')]);router[_0x3684('0xf')](_0x3684('0x10'),auth[_0x3684('0x6')](),controller[_0x3684('0x11')]);router['delete'](_0x3684('0x10'),auth[_0x3684('0x6')](),controller[_0x3684('0x12')]);router[_0x3684('0x13')]('/:id/queues',auth[_0x3684('0x6')](),controller[_0x3684('0x14')]);router['delete'](_0x3684('0xd'),auth[_0x3684('0x6')](),controller[_0x3684('0x15')]);module[_0x3684('0x16')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index ffc5410..6a161bb 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 _0xbc42=['exports','name','STRING','sequelize'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xbc42,0x7b));var _0x2bc4=function(_0x44e886,_0x5b3822){_0x44e886=_0x44e886-0x0;var _0x155106=_0xbc42[_0x44e886];return _0x155106;};'use strict';var Sequelize=require(_0x2bc4('0x0'));module[_0x2bc4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2bc4('0x2')},'description':{'type':Sequelize[_0x2bc4('0x3')]}}; \ No newline at end of file +var _0xfb16=['STRING','exports'];(function(_0x2053aa,_0x3df40e){var _0x30f5bb=function(_0x1b3f36){while(--_0x1b3f36){_0x2053aa['push'](_0x2053aa['shift']());}};_0x30f5bb(++_0x3df40e);}(_0xfb16,0x13d));var _0x6fb1=function(_0x36917a,_0x1c21d1){_0x36917a=_0x36917a-0x0;var _0x556166=_0xfb16[_0x36917a];return _0x556166;};'use strict';var Sequelize=require('sequelize');module[_0x6fb1('0x0')]={'name':{'type':Sequelize[_0x6fb1('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 87d9718..996536f 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 _0xb8cb=['destroy','error','stack','name','send','index','map','Team','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','intersection','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','getQueues','findOne','isValidChannel','Sequelize','Unknown\x20channel','capitalize','channel','toLowerCase','Queue','addQueues','ValidationError','add','Queues','ids','removeQueues','addAgents','Voice','Mail','Sms','Openchannel','Whatsapp','transaction','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','user','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','format','all','removeAgents','Chat','Fax','parse','Queue:remove','nolimit','getAgents','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','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','update','then'];(function(_0x4847e1,_0x2fb732){var _0x5afb23=function(_0x32f752){while(--_0x32f752){_0x4847e1['push'](_0x4847e1['shift']());}};_0x5afb23(++_0x2fb732);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x463035,_0x2e1b59){_0x463035=_0x463035-0x0;var _0x474b8d=_0xb8cb[_0x463035];return _0x474b8d;};'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 licenseUtil=require(_0xbb8c('0x19'));var db=require(_0xbb8c('0x1a'))['db'];config[_0xbb8c('0x1b')]=_['defaults'](config[_0xbb8c('0x1b')],{'host':_0xbb8c('0x1c'),'port':0x18eb});var socket=require(_0xbb8c('0x1d'))(new Redis(config[_0xbb8c('0x1b')]));require(_0xbb8c('0x1e'))[_0xbb8c('0x1f')](socket);function respondWithStatusCode(_0x1de932,_0x47c7c2){_0x47c7c2=_0x47c7c2||0xcc;return function(_0x9d06b6){if(_0x9d06b6){return _0x1de932[_0xbb8c('0x20')](_0x47c7c2);}return _0x1de932[_0xbb8c('0x21')](_0x47c7c2)[_0xbb8c('0x22')]();};}function respondWithResult(_0x2cc079,_0x3a695d){_0x3a695d=_0x3a695d||0xc8;return function(_0x2c04d1){if(_0x2c04d1){return _0x2cc079[_0xbb8c('0x21')](_0x3a695d)[_0xbb8c('0x23')](_0x2c04d1);}};}function respondWithFilteredResult(_0x187ee5,_0x4d19c7){return function(_0x67712e){if(_0x67712e){var _0x394ab7=_0x67712e[_0xbb8c('0x24')],_0x2a02c9=_0x4d19c7['offset'],_0x171cd8=_0x4d19c7[_0xbb8c('0x25')]+_0x4d19c7[_0xbb8c('0x26')],_0x3bdaca;if(_0x171cd8>=_0x394ab7){_0x171cd8=_0x394ab7;_0x3bdaca=0xc8;}else{_0x3bdaca=0xce;}_0x187ee5['status'](_0x3bdaca);return _0x187ee5[_0xbb8c('0x27')]('Content-Range',_0x2a02c9+'-'+_0x171cd8+'/'+_0x394ab7)[_0xbb8c('0x23')](_0x67712e);}return null;};}function patchUpdates(_0x570c0b){return function(_0x32b961){try{jsonpatch[_0xbb8c('0x28')](_0x32b961,_0x570c0b,!![]);}catch(_0x1e2539){return BPromise['reject'](_0x1e2539);}return _0x32b961['save']();};}function saveUpdates(_0x10f265,_0x54459d){return function(_0x171530){if(_0x171530){return _0x171530[_0xbb8c('0x29')](_0x10f265)[_0xbb8c('0x2a')](function(_0xec7fb5){return _0xec7fb5;});}return null;};}function removeEntity(_0x362a2f,_0x582c05){return function(_0xf5a529){if(_0xf5a529){return _0xf5a529['destroy']()[_0xbb8c('0x2a')](function(){var _0x5f4f96=_0xf5a529['get']({'plain':!![]});var _0xe7475d='Teams';return db['UserProfileResource'][_0xbb8c('0x2b')]({'where':{'type':_0xe7475d,'resourceId':_0x5f4f96['id']}})[_0xbb8c('0x2a')](function(){return _0xf5a529;});})[_0xbb8c('0x2a')](function(){_0x362a2f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17576b,_0x2aed0b){return function(_0x4cb223){if(!_0x4cb223){_0x17576b[_0xbb8c('0x20')](0x194);}return _0x4cb223;};}function handleError(_0x23bf3d,_0x292f11){_0x292f11=_0x292f11||0x1f4;return function(_0x4f0f13){logger[_0xbb8c('0x2c')](_0x4f0f13[_0xbb8c('0x2d')]);if(_0x4f0f13[_0xbb8c('0x2e')]){delete _0x4f0f13[_0xbb8c('0x2e')];}_0x23bf3d[_0xbb8c('0x21')](_0x292f11)[_0xbb8c('0x2f')](_0x4f0f13);};}exports[_0xbb8c('0x30')]=function(_0xb8a3df,_0x3b4bac){var _0x7b5b0d={},_0x4cb494={},_0x5d465b={'count':0x0,'rows':[]};var _0x1ee36d=_[_0xbb8c('0x31')](db[_0xbb8c('0x32')][_0xbb8c('0x33')],function(_0x3f60fc){return{'name':_0x3f60fc['fieldName'],'type':_0x3f60fc[_0xbb8c('0x34')][_0xbb8c('0x35')]};});_0x4cb494[_0xbb8c('0x36')]=_[_0xbb8c('0x31')](_0x1ee36d,_0xbb8c('0x2e'));_0x4cb494[_0xbb8c('0x37')]=_[_0xbb8c('0x38')](_0xb8a3df[_0xbb8c('0x37')]);_0x4cb494[_0xbb8c('0x39')]=_['intersection'](_0x4cb494[_0xbb8c('0x36')],_0x4cb494[_0xbb8c('0x37')]);_0x7b5b0d[_0xbb8c('0x3a')]=_['intersection'](_0x4cb494['model'],qs[_0xbb8c('0x3b')](_0xb8a3df[_0xbb8c('0x37')][_0xbb8c('0x3b')]));_0x7b5b0d[_0xbb8c('0x3a')]=_0x7b5b0d['attributes'][_0xbb8c('0x3c')]?_0x7b5b0d[_0xbb8c('0x3a')]:_0x4cb494[_0xbb8c('0x36')];if(!_0xb8a3df[_0xbb8c('0x37')][_0xbb8c('0x3d')]('nolimit')){_0x7b5b0d[_0xbb8c('0x26')]=qs[_0xbb8c('0x26')](_0xb8a3df[_0xbb8c('0x37')][_0xbb8c('0x26')]);_0x7b5b0d['offset']=qs[_0xbb8c('0x25')](_0xb8a3df[_0xbb8c('0x37')][_0xbb8c('0x25')]);}_0x7b5b0d[_0xbb8c('0x3e')]=qs[_0xbb8c('0x3f')](_0xb8a3df[_0xbb8c('0x37')][_0xbb8c('0x3f')]);_0x7b5b0d[_0xbb8c('0x40')]=qs[_0xbb8c('0x39')](_[_0xbb8c('0x41')](_0xb8a3df[_0xbb8c('0x37')],_0x4cb494[_0xbb8c('0x39')]),_0x1ee36d);if(_0xb8a3df['query'][_0xbb8c('0x42')]){_0x7b5b0d[_0xbb8c('0x40')]=_[_0xbb8c('0x43')](_0x7b5b0d[_0xbb8c('0x40')],{'$or':_['map'](_0x1ee36d,function(_0x3ca105){if(_0x3ca105['type']!=='VIRTUAL'){var _0x234f1f={};_0x234f1f[_0x3ca105[_0xbb8c('0x2e')]]={'$like':'%'+_0xb8a3df[_0xbb8c('0x37')]['filter']+'%'};return _0x234f1f;}})});}_0x7b5b0d=_[_0xbb8c('0x43')]({},_0x7b5b0d,_0xb8a3df[_0xbb8c('0x44')]);var _0x4c8165={'where':_0x7b5b0d[_0xbb8c('0x40')]};return db[_0xbb8c('0x32')][_0xbb8c('0x24')](_0x4c8165)[_0xbb8c('0x2a')](function(_0x4800a3){_0x5d465b[_0xbb8c('0x24')]=_0x4800a3;if(_0xb8a3df[_0xbb8c('0x37')][_0xbb8c('0x45')]){_0x7b5b0d['include']=[{'all':!![]}];}return db[_0xbb8c('0x32')][_0xbb8c('0x46')](_0x7b5b0d);})['then'](function(_0x4b6861){_0x5d465b[_0xbb8c('0x47')]=_0x4b6861;return _0x5d465b;})[_0xbb8c('0x2a')](respondWithFilteredResult(_0x3b4bac,_0x7b5b0d))['catch'](handleError(_0x3b4bac,null));};exports['show']=function(_0x2f9034,_0x5d83ff){var _0x405241={'raw':![],'where':{'id':_0x2f9034[_0xbb8c('0x48')]['id']}},_0x558dee={};_0x558dee['model']=_[_0xbb8c('0x38')](db[_0xbb8c('0x32')][_0xbb8c('0x33')]);_0x558dee[_0xbb8c('0x37')]=_[_0xbb8c('0x38')](_0x2f9034[_0xbb8c('0x37')]);_0x558dee['filters']=_[_0xbb8c('0x49')](_0x558dee['model'],_0x558dee[_0xbb8c('0x37')]);_0x405241[_0xbb8c('0x3a')]=_[_0xbb8c('0x49')](_0x558dee[_0xbb8c('0x36')],qs[_0xbb8c('0x3b')](_0x2f9034[_0xbb8c('0x37')]['fields']));_0x405241['attributes']=_0x405241[_0xbb8c('0x3a')][_0xbb8c('0x3c')]?_0x405241['attributes']:_0x558dee[_0xbb8c('0x36')];if(_0x2f9034[_0xbb8c('0x37')][_0xbb8c('0x45')]){_0x405241['include']=[{'all':!![]}];}_0x405241=_[_0xbb8c('0x43')]({},_0x405241,_0x2f9034['options']);return db[_0xbb8c('0x32')][_0xbb8c('0x4a')](_0x405241)[_0xbb8c('0x2a')](handleEntityNotFound(_0x5d83ff,null))['then'](respondWithResult(_0x5d83ff,null))[_0xbb8c('0x4b')](handleError(_0x5d83ff,null));};exports[_0xbb8c('0x4c')]=function(_0x32f054,_0x118565){return db[_0xbb8c('0x32')][_0xbb8c('0x4c')](_0x32f054[_0xbb8c('0x4d')],{})[_0xbb8c('0x2a')](function(_0x83b509){var _0x415374=_0x32f054['user'][_0xbb8c('0x4e')]({'plain':!![]});if(!_0x415374)throw new Error(_0xbb8c('0x4f'));if(_0x415374[_0xbb8c('0x50')]==='user'){var _0x4320a0=_0x83b509[_0xbb8c('0x4e')]({'plain':!![]});var _0x83c1f9=_0xbb8c('0x51');return db[_0xbb8c('0x52')][_0xbb8c('0x4a')]({'where':{'name':_0x83c1f9,'userProfileId':_0x415374[_0xbb8c('0x53')]},'raw':!![]})[_0xbb8c('0x2a')](function(_0x1d08f0){if(_0x1d08f0&&_0x1d08f0[_0xbb8c('0x54')]===0x0){return db['UserProfileResource'][_0xbb8c('0x4c')]({'name':_0x4320a0['name'],'resourceId':_0x4320a0['id'],'type':_0x1d08f0[_0xbb8c('0x2e')],'sectionId':_0x1d08f0['id']},{})[_0xbb8c('0x2a')](function(){return _0x83b509;});}else{return _0x83b509;}})[_0xbb8c('0x4b')](function(_0x37d391){logger[_0xbb8c('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37d391);throw _0x37d391;});}return _0x83b509;})[_0xbb8c('0x2a')](respondWithResult(_0x118565,0xc9))['catch'](handleError(_0x118565,null));};exports[_0xbb8c('0x29')]=function(_0x1ff96f,_0x2c7516){if(_0x1ff96f['body']['id']){delete _0x1ff96f[_0xbb8c('0x4d')]['id'];}return db[_0xbb8c('0x32')][_0xbb8c('0x4a')]({'where':{'id':_0x1ff96f[_0xbb8c('0x48')]['id']}})[_0xbb8c('0x2a')](handleEntityNotFound(_0x2c7516,null))[_0xbb8c('0x2a')](saveUpdates(_0x1ff96f[_0xbb8c('0x4d')],null))[_0xbb8c('0x2a')](respondWithResult(_0x2c7516,null))[_0xbb8c('0x4b')](handleError(_0x2c7516,null));};exports[_0xbb8c('0x2b')]=function(_0x34ba09,_0x1f52c0){return db[_0xbb8c('0x32')]['find']({'where':{'id':_0x34ba09['params']['id']}})[_0xbb8c('0x2a')](handleEntityNotFound(_0x1f52c0,null))[_0xbb8c('0x2a')](removeEntity(_0x1f52c0,null))['catch'](handleError(_0x1f52c0,null));};exports[_0xbb8c('0x55')]=function(_0x4244cf,_0x5e8832,_0x4503b8){return db['Team'][_0xbb8c('0x56')]({'where':{'id':_0x4244cf[_0xbb8c('0x48')]['id']}})[_0xbb8c('0x2a')](handleEntityNotFound(_0x5e8832,null))[_0xbb8c('0x2a')](function(_0x4e812d){if(!_0x4244cf[_0xbb8c('0x37')]['channel']||!utils[_0xbb8c('0x57')](_0x4244cf['query']['channel'])){throw new db[(_0xbb8c('0x58'))]['ValidationError'](_0xbb8c('0x59'));}var _0x241bf0={};var _0x11864c={};_0x11864c[_0xbb8c('0x36')]=_[_0xbb8c('0x38')](db[_[_0xbb8c('0x5a')](_0x4244cf[_0xbb8c('0x37')][_0xbb8c('0x5b')][_0xbb8c('0x5c')]())+_0xbb8c('0x5d')][_0xbb8c('0x33')]);_0x11864c[_0xbb8c('0x37')]=_[_0xbb8c('0x38')](_0x4244cf[_0xbb8c('0x37')]);_0x11864c[_0xbb8c('0x39')]=_[_0xbb8c('0x49')](_0x11864c['model'],_0x11864c[_0xbb8c('0x37')]);_0x241bf0['attributes']=_[_0xbb8c('0x49')](_0x11864c[_0xbb8c('0x36')],qs[_0xbb8c('0x3b')](_0x4244cf['query'][_0xbb8c('0x3b')]));_0x241bf0[_0xbb8c('0x3a')]=_0x241bf0['attributes'][_0xbb8c('0x3c')]?_0x241bf0['attributes']:_0x11864c['model'];_0x241bf0[_0xbb8c('0x26')]=qs['limit'](_0x4244cf[_0xbb8c('0x37')]['limit']);_0x241bf0[_0xbb8c('0x25')]=qs['offset'](_0x4244cf[_0xbb8c('0x37')][_0xbb8c('0x25')]);_0x241bf0['order']=qs[_0xbb8c('0x3f')](_0x4244cf[_0xbb8c('0x37')][_0xbb8c('0x3f')]);_0x241bf0[_0xbb8c('0x40')]=qs[_0xbb8c('0x39')](_['pick'](_0x4244cf[_0xbb8c('0x37')],_0x11864c[_0xbb8c('0x39')]));_0x241bf0=_['merge']({},_0x241bf0,_0x4244cf[_0xbb8c('0x44')]);return _0x4e812d[_0xbb8c('0x4e')+_['capitalize'](_0x4244cf[_0xbb8c('0x37')][_0xbb8c('0x5b')][_0xbb8c('0x5c')]())+'Queues'](_0x241bf0);})[_0xbb8c('0x2a')](respondWithResult(_0x5e8832,null))[_0xbb8c('0x4b')](handleError(_0x5e8832,null));};exports[_0xbb8c('0x5e')]=function(_0xede1f3,_0x2b0e5f,_0x30d8a6){return db[_0xbb8c('0x32')][_0xbb8c('0x56')]({'where':{'id':_0xede1f3[_0xbb8c('0x48')]['id']}})['then'](function(_0x3178e6){if(_0x3178e6){if(!_0xede1f3[_0xbb8c('0x4d')]['channel']||!utils[_0xbb8c('0x57')](_0xede1f3[_0xbb8c('0x4d')][_0xbb8c('0x5b')])){throw new db[(_0xbb8c('0x58'))][(_0xbb8c('0x5f'))](_0xbb8c('0x59'));}return _0x3178e6[_0xbb8c('0x60')+_[_0xbb8c('0x5a')](_0xede1f3[_0xbb8c('0x4d')]['channel'][_0xbb8c('0x5c')]())+_0xbb8c('0x61')](_0xede1f3[_0xbb8c('0x4d')][_0xbb8c('0x62')]);}return null;})[_0xbb8c('0x2a')](handleEntityNotFound(_0x2b0e5f,null))['then'](respondWithStatusCode(_0x2b0e5f,null))['catch'](handleError(_0x2b0e5f,null));};exports[_0xbb8c('0x63')]=function(_0x24c8f7,_0x39e83e,_0xb88bd8){return db[_0xbb8c('0x32')][_0xbb8c('0x56')]({'where':{'id':_0x24c8f7[_0xbb8c('0x48')]['id']}})[_0xbb8c('0x2a')](function(_0x5b77bf){if(_0x5b77bf){if(!_0x24c8f7[_0xbb8c('0x37')]['channel']||!utils[_0xbb8c('0x57')](_0x24c8f7[_0xbb8c('0x37')]['channel'])){throw new db['Sequelize'][(_0xbb8c('0x5f'))]('Unknown\x20channel');}return _0x5b77bf['remove'+_[_0xbb8c('0x5a')](_0x24c8f7[_0xbb8c('0x37')][_0xbb8c('0x5b')][_0xbb8c('0x5c')]())+_0xbb8c('0x61')](_0x24c8f7[_0xbb8c('0x37')][_0xbb8c('0x62')]);}return null;})[_0xbb8c('0x2a')](handleEntityNotFound(_0x39e83e,null))[_0xbb8c('0x2a')](respondWithStatusCode(_0x39e83e,null))[_0xbb8c('0x4b')](handleError(_0x39e83e,null));};exports[_0xbb8c('0x64')]=function(_0x5273aa,_0x1a84a5){return db[_0xbb8c('0x32')][_0xbb8c('0x4a')]({'where':{'id':_0x5273aa[_0xbb8c('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a84a5,null))['then'](function(_0x355ba0){if(_0x355ba0){var _0x2d42cd=[_0xbb8c('0x65'),'Chat',_0xbb8c('0x66'),_0xbb8c('0x67'),'Fax',_0xbb8c('0x68'),_0xbb8c('0x69')];return db['sequelize'][_0xbb8c('0x6a')](function(_0x24e709){var _0x156500=_[_0xbb8c('0x31')](_0x2d42cd,function(_0x2ca881){var _0x4c0637={'attributes':['id','name']};if(_0x2ca881===_0xbb8c('0x65')){_0x4c0637[_0xbb8c('0x6b')]={'attributes':[_0xbb8c('0x6c')]};}return _0x355ba0[_0xbb8c('0x4e')+_0x2ca881+_0xbb8c('0x61')](_0x4c0637)[_0xbb8c('0x2a')](function(_0xa12e32){var _0x1cebba=_['map'](_0xa12e32,function(_0xf2ddf4){var _0x1b56de=_[_0xbb8c('0x31')](_0x5273aa[_0xbb8c('0x4d')][_0xbb8c('0x62')],function(_0x14e8fb){var _0x23f823={'where':{'UserId':_0x14e8fb,[_0x2ca881+_0xbb8c('0x6d')]:_0xf2ddf4['id']},'transaction':_0x24e709};if(_0x2ca881===_0xbb8c('0x65')){_0x23f823['defaults']={'penalty':_0xf2ddf4[_0xbb8c('0x6e')][_0xbb8c('0x6c')]};}return db[_0xbb8c('0x6f')+_0x2ca881+'Queue'][_0xbb8c('0x70')](_0x23f823)[_0xbb8c('0x2a')](function(){socket[_0xbb8c('0x71')](_0xbb8c('0x72')+_0x2ca881+_0xbb8c('0x73'),{'UserId':_0x14e8fb,[_0x2ca881+_0xbb8c('0x6d')]:_0xf2ddf4['id']});if(_0x2ca881!==_0xbb8c('0x65'))return;return db[_0xbb8c('0x6f')][_0xbb8c('0x46')]({'where':{'id':_0x5273aa[_0xbb8c('0x4d')][_0xbb8c('0x62')],'online':0x1},'attributes':['id',_0xbb8c('0x2e'),_0xbb8c('0x74'),_0xbb8c('0x75'),_0xbb8c('0x76')],'raw':!![]})[_0xbb8c('0x2a')](function(_0x24bb3f){var _0x509662=_[_0xbb8c('0x31')](_0x24bb3f,function(_0x41ccac){return db[_0xbb8c('0x77')][_0xbb8c('0x78')]({'membername':_0x41ccac[_0xbb8c('0x2e')],'UserId':_0x41ccac['id'],'queue_name':_0xf2ddf4['name'],'VoiceQueueId':_0xf2ddf4['id'],'interface':_['isNil'](_0x41ccac[_0xbb8c('0x76')])?util[_0xbb8c('0x79')]('SIP/%s',_0x41ccac[_0xbb8c('0x2e')]):_0x41ccac[_0xbb8c('0x76')],'paused':_0x41ccac[_0xbb8c('0x75')]||![],'penalty':_0xf2ddf4[_0xbb8c('0x6e')]['penalty']},{'transaction':_0x24e709});});return Promise[_0xbb8c('0x7a')](_0x509662);});});});return Promise[_0xbb8c('0x7a')](_0x1b56de);});return Promise[_0xbb8c('0x7a')](_0x1cebba);});});return Promise[_0xbb8c('0x7a')](_0x156500)[_0xbb8c('0x2a')](function(){return _0x355ba0[_0xbb8c('0x64')](_0x5273aa['body'][_0xbb8c('0x62')],{'transaction':_0x24e709})['spread'](function(_0x5ccf52){return _0x5ccf52;});});});}})['then'](respondWithResult(_0x1a84a5,null))['catch'](handleError(_0x1a84a5,null));};exports[_0xbb8c('0x7b')]=function(_0x118abc,_0x26ff67){return db[_0xbb8c('0x32')]['find']({'where':{'id':_0x118abc[_0xbb8c('0x48')]['id']}})['then'](handleEntityNotFound(_0x26ff67,null))[_0xbb8c('0x2a')](function(_0x117e41){if(_0x117e41){var _0x377c21=[_0xbb8c('0x65'),_0xbb8c('0x7c'),_0xbb8c('0x66'),_0xbb8c('0x67'),_0xbb8c('0x7d'),_0xbb8c('0x68'),_0xbb8c('0x69')];return db['sequelize'][_0xbb8c('0x6a')](function(_0x12d24f){var _0x36b0b8=_[_0xbb8c('0x31')](_0x377c21,function(_0x445bfd){var _0x391061={'attributes':['id',_0xbb8c('0x2e')]};return _0x117e41[_0xbb8c('0x4e')+_0x445bfd+_0xbb8c('0x61')](_0x391061)[_0xbb8c('0x2a')](function(_0x3ea60d){var _0x38d72e=_[_0xbb8c('0x31')](_0x3ea60d,function(_0xa274c9){return _0xa274c9[_0xbb8c('0x7b')](_0x118abc[_0xbb8c('0x37')]['ids'],{'transaction':_0x12d24f})[_0xbb8c('0x2a')](function(){var _0x2e6f27=JSON[_0xbb8c('0x7e')]('['+_0x118abc[_0xbb8c('0x37')][_0xbb8c('0x62')]+']');var _0x1e22ec=_[_0xbb8c('0x31')](_0x2e6f27,function(_0x525c48){socket[_0xbb8c('0x71')](_0xbb8c('0x72')+_0x445bfd+_0xbb8c('0x7f'),{'UserId':Number(_0x525c48),[_0x445bfd+'QueueId']:_0xa274c9['id']});if(_0x445bfd!==_0xbb8c('0x65'))return;return db[_0xbb8c('0x77')][_0xbb8c('0x2b')]({'where':{'VoiceQueueId':_0xa274c9['id'],'UserId':_0x525c48},'transaction':_0x12d24f});});return Promise['all'](_0x1e22ec);});});return Promise[_0xbb8c('0x7a')](_0x38d72e);});});return Promise['all'](_0x36b0b8)['then'](function(){return _0x117e41[_0xbb8c('0x7b')](_0x118abc[_0xbb8c('0x37')][_0xbb8c('0x62')],{'transaction':_0x12d24f});});});}})[_0xbb8c('0x2a')](respondWithStatusCode(_0x26ff67,null))[_0xbb8c('0x4b')](handleError(_0x26ff67,null));};exports['getAgents']=function(_0xd8e065,_0x2a58bb,_0x204791){var _0x122742={};var _0x4edf85={};var _0x4da481;var _0xe78d22;return db[_0xbb8c('0x32')][_0xbb8c('0x56')]({'where':{'id':_0xd8e065[_0xbb8c('0x48')]['id']}})[_0xbb8c('0x2a')](handleEntityNotFound(_0x2a58bb,null))[_0xbb8c('0x2a')](function(_0x3cd339){if(_0x3cd339){_0x4da481=_0x3cd339;_0x4edf85[_0xbb8c('0x36')]=_[_0xbb8c('0x38')](db[_0xbb8c('0x6f')][_0xbb8c('0x33')]);_0x4edf85['query']=_[_0xbb8c('0x38')](_0xd8e065['query']);_0x4edf85['filters']=_[_0xbb8c('0x49')](_0x4edf85[_0xbb8c('0x36')],_0x4edf85[_0xbb8c('0x37')]);_0x122742['attributes']=_['intersection'](_0x4edf85[_0xbb8c('0x36')],qs['fields'](_0xd8e065[_0xbb8c('0x37')][_0xbb8c('0x3b')]));_0x122742[_0xbb8c('0x3a')]=_0x122742[_0xbb8c('0x3a')][_0xbb8c('0x3c')]?_0x122742['attributes']:_0x4edf85[_0xbb8c('0x36')];_0x122742[_0xbb8c('0x3e')]=qs[_0xbb8c('0x3f')](_0xd8e065[_0xbb8c('0x37')][_0xbb8c('0x3f')]);_0x122742[_0xbb8c('0x40')]=qs[_0xbb8c('0x39')](_[_0xbb8c('0x41')](_0xd8e065['query'],_0x4edf85['filters']));if(_0xd8e065['query'][_0xbb8c('0x42')]){_0x122742['where']=_['merge'](_0x122742[_0xbb8c('0x40')],{'$or':_[_0xbb8c('0x31')](_0x122742[_0xbb8c('0x3a')],function(_0x10efc6){var _0x5ace52={};_0x5ace52[_0x10efc6]={'$like':'%'+_0xd8e065[_0xbb8c('0x37')]['filter']+'%'};return _0x5ace52;})});}_0x122742=_[_0xbb8c('0x43')]({},_0x122742,_0xd8e065['options']);return _0x4da481['getAgents'](_0x122742);}})['then'](function(_0x55a0c8){if(_0x55a0c8){_0xe78d22=_0x55a0c8['length'];if(!_0xd8e065[_0xbb8c('0x37')][_0xbb8c('0x3d')](_0xbb8c('0x80'))){_0x122742[_0xbb8c('0x26')]=qs['limit'](_0xd8e065[_0xbb8c('0x37')]['limit']);_0x122742[_0xbb8c('0x25')]=qs[_0xbb8c('0x25')](_0xd8e065[_0xbb8c('0x37')][_0xbb8c('0x25')]);}return _0x4da481[_0xbb8c('0x81')](_0x122742);}})[_0xbb8c('0x2a')](function(_0x54a45f){if(_0x54a45f){return _0x54a45f?{'count':_0xe78d22,'rows':_0x54a45f}:null;}})[_0xbb8c('0x2a')](respondWithResult(_0x2a58bb,null))[_0xbb8c('0x4b')](handleError(_0x2a58bb,null));}; \ No newline at end of file +var _0xffc0=['rows','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','Queues','addQueues','ids','removeQueues','remove','addAgents','Voice','Mail','Sms','Openchannel','sequelize','transaction','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','voicePause','interface','UserVoiceQueueRt','format','SIP/%s','all','spread','removeAgents','Chat','Whatsapp','parse','emit','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','sendStatus','end','json','count','offset','status','apply','reject','update','then','get','Teams','UserProfileResource','destroy','name','send','index','map','Team','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x38ce2a,_0x281734){_0x38ce2a=_0x38ce2a-0x0;var _0x1a0071=_0xffc0[_0x38ce2a];return _0x1a0071;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0ffc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ffc('0x1'));var jsonpatch=require(_0x0ffc('0x2'));var rp=require(_0x0ffc('0x3'));var moment=require(_0x0ffc('0x4'));var BPromise=require(_0x0ffc('0x5'));var Mustache=require(_0x0ffc('0x6'));var util=require(_0x0ffc('0x7'));var path=require('path');var sox=require(_0x0ffc('0x8'));var csv=require(_0x0ffc('0x9'));var ejs=require(_0x0ffc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0ffc('0xb'));var jsforce=require(_0x0ffc('0xc'));var deskjs=require(_0x0ffc('0xd'));var toCsv=require(_0x0ffc('0x9'));var querystring=require('querystring');var Papa=require(_0x0ffc('0xe'));var Redis=require(_0x0ffc('0xf'));var authService=require(_0x0ffc('0x10'));var qs=require(_0x0ffc('0x11'));var as=require(_0x0ffc('0x12'));var hardwareService=require(_0x0ffc('0x13'));var logger=require(_0x0ffc('0x14'))(_0x0ffc('0x15'));var utils=require('../../config/utils');var config=require(_0x0ffc('0x16'));var licenseUtil=require(_0x0ffc('0x17'));var db=require('../../mysqldb')['db'];config[_0x0ffc('0x18')]=_[_0x0ffc('0x19')](config[_0x0ffc('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ffc('0x1a'))(new Redis(config[_0x0ffc('0x18')]));require('./team.socket')[_0x0ffc('0x1b')](socket);function respondWithStatusCode(_0x137908,_0x1e32b4){_0x1e32b4=_0x1e32b4||0xcc;return function(_0x11a5ee){if(_0x11a5ee){return _0x137908[_0x0ffc('0x1c')](_0x1e32b4);}return _0x137908['status'](_0x1e32b4)[_0x0ffc('0x1d')]();};}function respondWithResult(_0x565921,_0x7f401){_0x7f401=_0x7f401||0xc8;return function(_0xc2bb7e){if(_0xc2bb7e){return _0x565921['status'](_0x7f401)[_0x0ffc('0x1e')](_0xc2bb7e);}};}function respondWithFilteredResult(_0x577e89,_0x52ca5a){return function(_0x5b0018){if(_0x5b0018){var _0x4e8e65=_0x5b0018[_0x0ffc('0x1f')],_0x314dab=_0x52ca5a[_0x0ffc('0x20')],_0x117d50=_0x52ca5a['offset']+_0x52ca5a['limit'],_0x3fb92b;if(_0x117d50>=_0x4e8e65){_0x117d50=_0x4e8e65;_0x3fb92b=0xc8;}else{_0x3fb92b=0xce;}_0x577e89[_0x0ffc('0x21')](_0x3fb92b);return _0x577e89['set']('Content-Range',_0x314dab+'-'+_0x117d50+'/'+_0x4e8e65)[_0x0ffc('0x1e')](_0x5b0018);}return null;};}function patchUpdates(_0x126f09){return function(_0x49faaa){try{jsonpatch[_0x0ffc('0x22')](_0x49faaa,_0x126f09,!![]);}catch(_0x18bc34){return BPromise[_0x0ffc('0x23')](_0x18bc34);}return _0x49faaa['save']();};}function saveUpdates(_0x4ffd80,_0x15fd93){return function(_0x2721b6){if(_0x2721b6){return _0x2721b6[_0x0ffc('0x24')](_0x4ffd80)[_0x0ffc('0x25')](function(_0x46b4e6){return _0x46b4e6;});}return null;};}function removeEntity(_0x4d4294,_0x501c0c){return function(_0x3e1180){if(_0x3e1180){return _0x3e1180['destroy']()[_0x0ffc('0x25')](function(){var _0x5ad1b4=_0x3e1180[_0x0ffc('0x26')]({'plain':!![]});var _0x136b0a=_0x0ffc('0x27');return db[_0x0ffc('0x28')][_0x0ffc('0x29')]({'where':{'type':_0x136b0a,'resourceId':_0x5ad1b4['id']}})[_0x0ffc('0x25')](function(){return _0x3e1180;});})[_0x0ffc('0x25')](function(){_0x4d4294[_0x0ffc('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x637c33,_0x195033){return function(_0x59afc9){if(!_0x59afc9){_0x637c33['sendStatus'](0x194);}return _0x59afc9;};}function handleError(_0x40166f,_0x5f3a01){_0x5f3a01=_0x5f3a01||0x1f4;return function(_0x13c425){logger['error'](_0x13c425['stack']);if(_0x13c425[_0x0ffc('0x2a')]){delete _0x13c425['name'];}_0x40166f[_0x0ffc('0x21')](_0x5f3a01)[_0x0ffc('0x2b')](_0x13c425);};}exports[_0x0ffc('0x2c')]=function(_0x4e813f,_0x29f0cf){var _0x2c87d0={},_0x11f4e2={},_0x10e86d={'count':0x0,'rows':[]};var _0x51c673=_[_0x0ffc('0x2d')](db[_0x0ffc('0x2e')][_0x0ffc('0x2f')],function(_0x5a1d7e){return{'name':_0x5a1d7e[_0x0ffc('0x30')],'type':_0x5a1d7e['type'][_0x0ffc('0x31')]};});_0x11f4e2['model']=_[_0x0ffc('0x2d')](_0x51c673,_0x0ffc('0x2a'));_0x11f4e2['query']=_[_0x0ffc('0x32')](_0x4e813f[_0x0ffc('0x33')]);_0x11f4e2[_0x0ffc('0x34')]=_[_0x0ffc('0x35')](_0x11f4e2['model'],_0x11f4e2[_0x0ffc('0x33')]);_0x2c87d0[_0x0ffc('0x36')]=_[_0x0ffc('0x35')](_0x11f4e2[_0x0ffc('0x37')],qs[_0x0ffc('0x38')](_0x4e813f[_0x0ffc('0x33')][_0x0ffc('0x38')]));_0x2c87d0['attributes']=_0x2c87d0[_0x0ffc('0x36')][_0x0ffc('0x39')]?_0x2c87d0[_0x0ffc('0x36')]:_0x11f4e2[_0x0ffc('0x37')];if(!_0x4e813f['query'][_0x0ffc('0x3a')](_0x0ffc('0x3b'))){_0x2c87d0[_0x0ffc('0x3c')]=qs[_0x0ffc('0x3c')](_0x4e813f['query'][_0x0ffc('0x3c')]);_0x2c87d0[_0x0ffc('0x20')]=qs[_0x0ffc('0x20')](_0x4e813f[_0x0ffc('0x33')][_0x0ffc('0x20')]);}_0x2c87d0[_0x0ffc('0x3d')]=qs[_0x0ffc('0x3e')](_0x4e813f[_0x0ffc('0x33')][_0x0ffc('0x3e')]);_0x2c87d0['where']=qs[_0x0ffc('0x34')](_[_0x0ffc('0x3f')](_0x4e813f[_0x0ffc('0x33')],_0x11f4e2[_0x0ffc('0x34')]),_0x51c673);if(_0x4e813f['query'][_0x0ffc('0x40')]){_0x2c87d0[_0x0ffc('0x41')]=_[_0x0ffc('0x42')](_0x2c87d0[_0x0ffc('0x41')],{'$or':_[_0x0ffc('0x2d')](_0x51c673,function(_0x1cb8c3){if(_0x1cb8c3[_0x0ffc('0x43')]!==_0x0ffc('0x44')){var _0x25676f={};_0x25676f[_0x1cb8c3['name']]={'$like':'%'+_0x4e813f[_0x0ffc('0x33')][_0x0ffc('0x40')]+'%'};return _0x25676f;}})});}_0x2c87d0=_[_0x0ffc('0x42')]({},_0x2c87d0,_0x4e813f[_0x0ffc('0x45')]);var _0x5c778c={'where':_0x2c87d0['where']};return db['Team'][_0x0ffc('0x1f')](_0x5c778c)['then'](function(_0x20b7e0){_0x10e86d['count']=_0x20b7e0;if(_0x4e813f[_0x0ffc('0x33')][_0x0ffc('0x46')]){_0x2c87d0['include']=[{'all':!![]}];}return db['Team'][_0x0ffc('0x47')](_0x2c87d0);})[_0x0ffc('0x25')](function(_0x483e95){_0x10e86d[_0x0ffc('0x48')]=_0x483e95;return _0x10e86d;})[_0x0ffc('0x25')](respondWithFilteredResult(_0x29f0cf,_0x2c87d0))['catch'](handleError(_0x29f0cf,null));};exports['show']=function(_0x31b36f,_0x4e9c32){var _0x19ce54={'raw':![],'where':{'id':_0x31b36f['params']['id']}},_0x4928ef={};_0x4928ef['model']=_[_0x0ffc('0x32')](db['Team'][_0x0ffc('0x2f')]);_0x4928ef[_0x0ffc('0x33')]=_[_0x0ffc('0x32')](_0x31b36f['query']);_0x4928ef[_0x0ffc('0x34')]=_[_0x0ffc('0x35')](_0x4928ef[_0x0ffc('0x37')],_0x4928ef[_0x0ffc('0x33')]);_0x19ce54[_0x0ffc('0x36')]=_[_0x0ffc('0x35')](_0x4928ef[_0x0ffc('0x37')],qs[_0x0ffc('0x38')](_0x31b36f['query'][_0x0ffc('0x38')]));_0x19ce54[_0x0ffc('0x36')]=_0x19ce54[_0x0ffc('0x36')]['length']?_0x19ce54[_0x0ffc('0x36')]:_0x4928ef[_0x0ffc('0x37')];if(_0x31b36f[_0x0ffc('0x33')][_0x0ffc('0x46')]){_0x19ce54['include']=[{'all':!![]}];}_0x19ce54=_[_0x0ffc('0x42')]({},_0x19ce54,_0x31b36f[_0x0ffc('0x45')]);return db['Team'][_0x0ffc('0x49')](_0x19ce54)[_0x0ffc('0x25')](handleEntityNotFound(_0x4e9c32,null))['then'](respondWithResult(_0x4e9c32,null))['catch'](handleError(_0x4e9c32,null));};exports[_0x0ffc('0x4a')]=function(_0x34e244,_0x3ca3cd){return db['Team']['create'](_0x34e244[_0x0ffc('0x4b')],{})['then'](function(_0x43cb16){var _0xb3f160=_0x34e244[_0x0ffc('0x4c')][_0x0ffc('0x26')]({'plain':!![]});if(!_0xb3f160)throw new Error(_0x0ffc('0x4d'));if(_0xb3f160['role']===_0x0ffc('0x4c')){var _0x39ba1f=_0x43cb16[_0x0ffc('0x26')]({'plain':!![]});var _0x4a2ae6='Teams';return db['UserProfileSection'][_0x0ffc('0x49')]({'where':{'name':_0x4a2ae6,'userProfileId':_0xb3f160['userProfileId']},'raw':!![]})[_0x0ffc('0x25')](function(_0x4456f5){if(_0x4456f5&&_0x4456f5['autoAssociation']===0x0){return db['UserProfileResource'][_0x0ffc('0x4a')]({'name':_0x39ba1f[_0x0ffc('0x2a')],'resourceId':_0x39ba1f['id'],'type':_0x4456f5['name'],'sectionId':_0x4456f5['id']},{})[_0x0ffc('0x25')](function(){return _0x43cb16;});}else{return _0x43cb16;}})[_0x0ffc('0x4e')](function(_0x265b8d){logger[_0x0ffc('0x4f')](_0x0ffc('0x50'),_0x265b8d);throw _0x265b8d;});}return _0x43cb16;})[_0x0ffc('0x25')](respondWithResult(_0x3ca3cd,0xc9))[_0x0ffc('0x4e')](handleError(_0x3ca3cd,null));};exports['update']=function(_0x52bacc,_0x73c1e6){if(_0x52bacc[_0x0ffc('0x4b')]['id']){delete _0x52bacc['body']['id'];}return db[_0x0ffc('0x2e')][_0x0ffc('0x49')]({'where':{'id':_0x52bacc[_0x0ffc('0x51')]['id']}})['then'](handleEntityNotFound(_0x73c1e6,null))[_0x0ffc('0x25')](saveUpdates(_0x52bacc['body'],null))['then'](respondWithResult(_0x73c1e6,null))[_0x0ffc('0x4e')](handleError(_0x73c1e6,null));};exports['destroy']=function(_0x4fec77,_0x3fe9f2){return db[_0x0ffc('0x2e')][_0x0ffc('0x49')]({'where':{'id':_0x4fec77['params']['id']}})[_0x0ffc('0x25')](handleEntityNotFound(_0x3fe9f2,null))[_0x0ffc('0x25')](removeEntity(_0x3fe9f2,null))['catch'](handleError(_0x3fe9f2,null));};exports['getQueues']=function(_0x2a4b66,_0x30629d,_0x38b7f5){return db[_0x0ffc('0x2e')][_0x0ffc('0x52')]({'where':{'id':_0x2a4b66['params']['id']}})[_0x0ffc('0x25')](handleEntityNotFound(_0x30629d,null))['then'](function(_0x54a573){if(!_0x2a4b66[_0x0ffc('0x33')][_0x0ffc('0x53')]||!utils[_0x0ffc('0x54')](_0x2a4b66['query']['channel'])){throw new db['Sequelize'][(_0x0ffc('0x55'))](_0x0ffc('0x56'));}var _0x525186={};var _0xa1f817={};_0xa1f817[_0x0ffc('0x37')]=_['keys'](db[_[_0x0ffc('0x57')](_0x2a4b66[_0x0ffc('0x33')][_0x0ffc('0x53')]['toLowerCase']())+_0x0ffc('0x58')][_0x0ffc('0x2f')]);_0xa1f817[_0x0ffc('0x33')]=_[_0x0ffc('0x32')](_0x2a4b66['query']);_0xa1f817['filters']=_[_0x0ffc('0x35')](_0xa1f817['model'],_0xa1f817[_0x0ffc('0x33')]);_0x525186[_0x0ffc('0x36')]=_['intersection'](_0xa1f817[_0x0ffc('0x37')],qs['fields'](_0x2a4b66[_0x0ffc('0x33')][_0x0ffc('0x38')]));_0x525186['attributes']=_0x525186['attributes'][_0x0ffc('0x39')]?_0x525186[_0x0ffc('0x36')]:_0xa1f817[_0x0ffc('0x37')];_0x525186[_0x0ffc('0x3c')]=qs[_0x0ffc('0x3c')](_0x2a4b66[_0x0ffc('0x33')]['limit']);_0x525186['offset']=qs[_0x0ffc('0x20')](_0x2a4b66[_0x0ffc('0x33')][_0x0ffc('0x20')]);_0x525186[_0x0ffc('0x3d')]=qs[_0x0ffc('0x3e')](_0x2a4b66['query']['sort']);_0x525186[_0x0ffc('0x41')]=qs[_0x0ffc('0x34')](_[_0x0ffc('0x3f')](_0x2a4b66['query'],_0xa1f817[_0x0ffc('0x34')]));_0x525186=_[_0x0ffc('0x42')]({},_0x525186,_0x2a4b66[_0x0ffc('0x45')]);return _0x54a573[_0x0ffc('0x26')+_[_0x0ffc('0x57')](_0x2a4b66['query'][_0x0ffc('0x53')][_0x0ffc('0x59')]())+_0x0ffc('0x5a')](_0x525186);})[_0x0ffc('0x25')](respondWithResult(_0x30629d,null))['catch'](handleError(_0x30629d,null));};exports[_0x0ffc('0x5b')]=function(_0x463132,_0x5db7ba,_0x24dd64){return db['Team'][_0x0ffc('0x52')]({'where':{'id':_0x463132[_0x0ffc('0x51')]['id']}})[_0x0ffc('0x25')](function(_0x1adfb6){if(_0x1adfb6){if(!_0x463132[_0x0ffc('0x4b')][_0x0ffc('0x53')]||!utils[_0x0ffc('0x54')](_0x463132['body'][_0x0ffc('0x53')])){throw new db['Sequelize'][(_0x0ffc('0x55'))](_0x0ffc('0x56'));}return _0x1adfb6['add'+_[_0x0ffc('0x57')](_0x463132[_0x0ffc('0x4b')][_0x0ffc('0x53')][_0x0ffc('0x59')]())+_0x0ffc('0x5a')](_0x463132[_0x0ffc('0x4b')][_0x0ffc('0x5c')]);}return null;})[_0x0ffc('0x25')](handleEntityNotFound(_0x5db7ba,null))['then'](respondWithStatusCode(_0x5db7ba,null))[_0x0ffc('0x4e')](handleError(_0x5db7ba,null));};exports[_0x0ffc('0x5d')]=function(_0x155c6a,_0x390bb1,_0x1e0d65){return db[_0x0ffc('0x2e')][_0x0ffc('0x52')]({'where':{'id':_0x155c6a[_0x0ffc('0x51')]['id']}})['then'](function(_0x350d70){if(_0x350d70){if(!_0x155c6a[_0x0ffc('0x33')]['channel']||!utils[_0x0ffc('0x54')](_0x155c6a['query'][_0x0ffc('0x53')])){throw new db['Sequelize'][(_0x0ffc('0x55'))]('Unknown\x20channel');}return _0x350d70[_0x0ffc('0x5e')+_[_0x0ffc('0x57')](_0x155c6a[_0x0ffc('0x33')]['channel']['toLowerCase']())+_0x0ffc('0x5a')](_0x155c6a['query']['ids']);}return null;})[_0x0ffc('0x25')](handleEntityNotFound(_0x390bb1,null))[_0x0ffc('0x25')](respondWithStatusCode(_0x390bb1,null))['catch'](handleError(_0x390bb1,null));};exports[_0x0ffc('0x5f')]=function(_0x489c4a,_0x237b82){return db[_0x0ffc('0x2e')][_0x0ffc('0x49')]({'where':{'id':_0x489c4a['params']['id']}})[_0x0ffc('0x25')](handleEntityNotFound(_0x237b82,null))[_0x0ffc('0x25')](function(_0x5eff33){if(_0x5eff33){var _0x18345b=[_0x0ffc('0x60'),'Chat',_0x0ffc('0x61'),_0x0ffc('0x62'),'Fax',_0x0ffc('0x63'),'Whatsapp'];return db[_0x0ffc('0x64')][_0x0ffc('0x65')](function(_0x26c098){var _0x2bedd3=_[_0x0ffc('0x2d')](_0x18345b,function(_0x3314be){var _0x5956a0={'attributes':['id',_0x0ffc('0x2a')]};if(_0x3314be===_0x0ffc('0x60')){_0x5956a0['through']={'attributes':[_0x0ffc('0x66')]};}return _0x5eff33[_0x0ffc('0x26')+_0x3314be+_0x0ffc('0x5a')](_0x5956a0)[_0x0ffc('0x25')](function(_0x986169){var _0x37c15d=_[_0x0ffc('0x2d')](_0x986169,function(_0x2fbe10){var _0x4cb541=_[_0x0ffc('0x2d')](_0x489c4a['body']['ids'],function(_0x55e9e4){var _0x22196e={'where':{'UserId':_0x55e9e4,[_0x3314be+_0x0ffc('0x67')]:_0x2fbe10['id']},'transaction':_0x26c098};if(_0x3314be===_0x0ffc('0x60')){_0x22196e[_0x0ffc('0x19')]={'penalty':_0x2fbe10[_0x0ffc('0x68')]['penalty']};}return db[_0x0ffc('0x69')+_0x3314be+_0x0ffc('0x58')][_0x0ffc('0x6a')](_0x22196e)[_0x0ffc('0x25')](function(){socket['emit'](_0x0ffc('0x4c')+_0x3314be+_0x0ffc('0x6b'),{'UserId':_0x55e9e4,[_0x3314be+_0x0ffc('0x67')]:_0x2fbe10['id']});if(_0x3314be!==_0x0ffc('0x60'))return;return db[_0x0ffc('0x69')][_0x0ffc('0x47')]({'where':{'id':_0x489c4a[_0x0ffc('0x4b')][_0x0ffc('0x5c')],'online':0x1},'attributes':['id',_0x0ffc('0x2a'),'online',_0x0ffc('0x6c'),_0x0ffc('0x6d')],'raw':!![]})['then'](function(_0x2eb982){var _0x46287e=_[_0x0ffc('0x2d')](_0x2eb982,function(_0x464766){return db[_0x0ffc('0x6e')]['upsert']({'membername':_0x464766[_0x0ffc('0x2a')],'UserId':_0x464766['id'],'queue_name':_0x2fbe10[_0x0ffc('0x2a')],'VoiceQueueId':_0x2fbe10['id'],'interface':_['isNil'](_0x464766['interface'])?util[_0x0ffc('0x6f')](_0x0ffc('0x70'),_0x464766['name']):_0x464766['interface'],'paused':_0x464766[_0x0ffc('0x6c')]||![],'penalty':_0x2fbe10[_0x0ffc('0x68')][_0x0ffc('0x66')]},{'transaction':_0x26c098});});return Promise[_0x0ffc('0x71')](_0x46287e);});});});return Promise['all'](_0x4cb541);});return Promise[_0x0ffc('0x71')](_0x37c15d);});});return Promise[_0x0ffc('0x71')](_0x2bedd3)[_0x0ffc('0x25')](function(){return _0x5eff33['addAgents'](_0x489c4a[_0x0ffc('0x4b')]['ids'],{'transaction':_0x26c098})[_0x0ffc('0x72')](function(_0x417db0){return _0x417db0;});});});}})[_0x0ffc('0x25')](respondWithResult(_0x237b82,null))[_0x0ffc('0x4e')](handleError(_0x237b82,null));};exports[_0x0ffc('0x73')]=function(_0x59cb48,_0x228aba){return db[_0x0ffc('0x2e')][_0x0ffc('0x49')]({'where':{'id':_0x59cb48[_0x0ffc('0x51')]['id']}})['then'](handleEntityNotFound(_0x228aba,null))[_0x0ffc('0x25')](function(_0x5488c9){if(_0x5488c9){var _0x3910fe=[_0x0ffc('0x60'),_0x0ffc('0x74'),_0x0ffc('0x61'),'Sms','Fax','Openchannel',_0x0ffc('0x75')];return db[_0x0ffc('0x64')]['transaction'](function(_0x883575){var _0x5b2ce3=_[_0x0ffc('0x2d')](_0x3910fe,function(_0x5a2ae7){var _0x218b23={'attributes':['id',_0x0ffc('0x2a')]};return _0x5488c9[_0x0ffc('0x26')+_0x5a2ae7+_0x0ffc('0x5a')](_0x218b23)['then'](function(_0x2f1e97){var _0x1a2d22=_[_0x0ffc('0x2d')](_0x2f1e97,function(_0x113668){return _0x113668[_0x0ffc('0x73')](_0x59cb48[_0x0ffc('0x33')][_0x0ffc('0x5c')],{'transaction':_0x883575})[_0x0ffc('0x25')](function(){var _0x413c64=JSON[_0x0ffc('0x76')]('['+_0x59cb48[_0x0ffc('0x33')]['ids']+']');var _0x5951c4=_['map'](_0x413c64,function(_0x289aeb){socket[_0x0ffc('0x77')](_0x0ffc('0x4c')+_0x5a2ae7+_0x0ffc('0x78'),{'UserId':Number(_0x289aeb),[_0x5a2ae7+'QueueId']:_0x113668['id']});if(_0x5a2ae7!==_0x0ffc('0x60'))return;return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x113668['id'],'UserId':_0x289aeb},'transaction':_0x883575});});return Promise[_0x0ffc('0x71')](_0x5951c4);});});return Promise[_0x0ffc('0x71')](_0x1a2d22);});});return Promise[_0x0ffc('0x71')](_0x5b2ce3)['then'](function(){return _0x5488c9[_0x0ffc('0x73')](_0x59cb48[_0x0ffc('0x33')]['ids'],{'transaction':_0x883575});});});}})[_0x0ffc('0x25')](respondWithStatusCode(_0x228aba,null))[_0x0ffc('0x4e')](handleError(_0x228aba,null));};exports[_0x0ffc('0x79')]=function(_0xb3796f,_0x5e2582,_0x399b8e){var _0x5715ee={};var _0xf7f324={};var _0x3b2433;var _0x151e9f;return db[_0x0ffc('0x2e')][_0x0ffc('0x52')]({'where':{'id':_0xb3796f[_0x0ffc('0x51')]['id']}})[_0x0ffc('0x25')](handleEntityNotFound(_0x5e2582,null))[_0x0ffc('0x25')](function(_0x167bef){if(_0x167bef){_0x3b2433=_0x167bef;_0xf7f324[_0x0ffc('0x37')]=_[_0x0ffc('0x32')](db['User']['rawAttributes']);_0xf7f324['query']=_['keys'](_0xb3796f['query']);_0xf7f324['filters']=_[_0x0ffc('0x35')](_0xf7f324[_0x0ffc('0x37')],_0xf7f324[_0x0ffc('0x33')]);_0x5715ee[_0x0ffc('0x36')]=_[_0x0ffc('0x35')](_0xf7f324['model'],qs[_0x0ffc('0x38')](_0xb3796f[_0x0ffc('0x33')][_0x0ffc('0x38')]));_0x5715ee['attributes']=_0x5715ee[_0x0ffc('0x36')][_0x0ffc('0x39')]?_0x5715ee[_0x0ffc('0x36')]:_0xf7f324[_0x0ffc('0x37')];_0x5715ee[_0x0ffc('0x3d')]=qs[_0x0ffc('0x3e')](_0xb3796f[_0x0ffc('0x33')]['sort']);_0x5715ee[_0x0ffc('0x41')]=qs[_0x0ffc('0x34')](_[_0x0ffc('0x3f')](_0xb3796f['query'],_0xf7f324[_0x0ffc('0x34')]));if(_0xb3796f['query'][_0x0ffc('0x40')]){_0x5715ee['where']=_[_0x0ffc('0x42')](_0x5715ee['where'],{'$or':_[_0x0ffc('0x2d')](_0x5715ee[_0x0ffc('0x36')],function(_0xd89a50){var _0x242e89={};_0x242e89[_0xd89a50]={'$like':'%'+_0xb3796f['query'][_0x0ffc('0x40')]+'%'};return _0x242e89;})});}_0x5715ee=_[_0x0ffc('0x42')]({},_0x5715ee,_0xb3796f[_0x0ffc('0x45')]);return _0x3b2433[_0x0ffc('0x79')](_0x5715ee);}})[_0x0ffc('0x25')](function(_0x2adcec){if(_0x2adcec){_0x151e9f=_0x2adcec['length'];if(!_0xb3796f[_0x0ffc('0x33')]['hasOwnProperty'](_0x0ffc('0x3b'))){_0x5715ee['limit']=qs[_0x0ffc('0x3c')](_0xb3796f['query'][_0x0ffc('0x3c')]);_0x5715ee[_0x0ffc('0x20')]=qs[_0x0ffc('0x20')](_0xb3796f[_0x0ffc('0x33')][_0x0ffc('0x20')]);}return _0x3b2433[_0x0ffc('0x79')](_0x5715ee);}})[_0x0ffc('0x25')](function(_0x1cf79f){if(_0x1cf79f){return _0x1cf79f?{'count':_0x151e9f,'rows':_0x1cf79f}:null;}})[_0x0ffc('0x25')](respondWithResult(_0x5e2582,null))[_0x0ffc('0x4e')](handleError(_0x5e2582,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 485efd2..b92cc75 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 _0x648a=['../../mysqldb','Team','setMaxListeners','update','emit','hook','exports'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x648a,0x70));var _0xa648=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x648a[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var Team=require(_0xa648('0x0'))['db'][_0xa648('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xa648('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa648('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5ae436){return function(_0x640eba,_0x1c0a2f,_0x3ca203){TeamEvents[_0xa648('0x4')](_0x5ae436+':'+_0x640eba['id'],_0x640eba);TeamEvents['emit'](_0x5ae436,_0x640eba);_0x3ca203(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xa648('0x5')](e,emitEvent(event));}}module[_0xa648('0x6')]=TeamEvents; \ No newline at end of file +var _0x0062=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x29ade3,_0x2c02e7){var _0x254cc0=function(_0x3d566e){while(--_0x3d566e){_0x29ade3['push'](_0x29ade3['shift']());}};_0x254cc0(++_0x2c02e7);}(_0x0062,0x12e));var _0x2006=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x0062[_0xf79bae];return _0x5d2cb7;};'use strict';var EventEmitter=require(_0x2006('0x0'));var Team=require(_0x2006('0x1'))['db'][_0x2006('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x2006('0x3')](0x0);var events={'afterCreate':_0x2006('0x4'),'afterUpdate':_0x2006('0x5'),'afterDestroy':_0x2006('0x6')};function emitEvent(_0x366eeb){return function(_0x2cd06b,_0x4a82b6,_0x12ebff){TeamEvents['emit'](_0x366eeb+':'+_0x2cd06b['id'],_0x2cd06b);TeamEvents[_0x2006('0x7')](_0x366eeb,_0x2cd06b);_0x12ebff(null);};}for(var e in events){if(events[_0x2006('0x8')](e)){var event=events[e];Team[_0x2006('0x9')](e,emitEvent(event));}}module[_0x2006('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index ae3714b..3c907b6 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 _0xaf8c=['./team.attributes','exports','define','Team','teams','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x510c24,_0x113f28){var _0xaff09=function(_0x56fb0a){while(--_0x56fb0a){_0x510c24['push'](_0x510c24['shift']());}};_0xaff09(++_0x113f28);}(_0xaf8c,0x164));var _0xcaf8=function(_0x7603e1,_0x5780f1){_0x7603e1=_0x7603e1-0x0;var _0x5895ac=_0xaf8c[_0x7603e1];return _0x5895ac;};'use strict';var _=require('lodash');var util=require(_0xcaf8('0x0'));var logger=require('../../config/logger')(_0xcaf8('0x1'));var moment=require(_0xcaf8('0x2'));var BPromise=require(_0xcaf8('0x3'));var rp=require(_0xcaf8('0x4'));var fs=require('fs');var path=require(_0xcaf8('0x5'));var rimraf=require(_0xcaf8('0x6'));var config=require(_0xcaf8('0x7'));var attributes=require(_0xcaf8('0x8'));module[_0xcaf8('0x9')]=function(_0x36d61,_0x20e0ec){return _0x36d61[_0xcaf8('0xa')](_0xcaf8('0xb'),attributes,{'tableName':_0xcaf8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13de=['../../config/environment','define','Team','teams','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x329eab,_0x577919){var _0x58c855=function(_0x516588){while(--_0x516588){_0x329eab['push'](_0x329eab['shift']());}};_0x58c855(++_0x577919);}(_0x13de,0x163));var _0xe13d=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x13de[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe13d('0x0'))(_0xe13d('0x1'));var moment=require(_0xe13d('0x2'));var BPromise=require('bluebird');var rp=require(_0xe13d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe13d('0x4'));var config=require(_0xe13d('0x5'));var attributes=require('./team.attributes');module['exports']=function(_0x5253b2,_0x4524a5){return _0x5253b2[_0xe13d('0x6')](_0xe13d('0x7'),attributes,{'tableName':_0xe13d('0x8'),'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 4d46b85..9eb4f80 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 _0xace6=['socket.io-emitter','./team.socket','register','then','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost'];(function(_0x2acedf,_0x4c54aa){var _0x4b1d94=function(_0x536d62){while(--_0x536d62){_0x2acedf['push'](_0x2acedf['shift']());}};_0x4b1d94(++_0x4c54aa);}(_0xace6,0x1be));var _0x6ace=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xace6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6ace('0x0'));var util=require('util');var moment=require(_0x6ace('0x1'));var BPromise=require(_0x6ace('0x2'));var rs=require(_0x6ace('0x3'));var fs=require('fs');var Redis=require(_0x6ace('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ace('0x5'));var logger=require(_0x6ace('0x6'))(_0x6ace('0x7'));var config=require('../../config/environment');var jayson=require(_0x6ace('0x8'));var client=jayson['client'][_0x6ace('0x9')]({'port':0x232a});config['redis']=_[_0x6ace('0xa')](config[_0x6ace('0xb')],{'host':_0x6ace('0xc'),'port':0x18eb});var socket=require(_0x6ace('0xd'))(new Redis(config['redis']));require(_0x6ace('0xe'))[_0x6ace('0xf')](socket);function respondWithRpcPromise(_0xb1eae9,_0x255be8,_0x2ad851){return new BPromise(function(_0x56af00,_0x1ca2f1){return client['request'](_0xb1eae9,_0x2ad851)[_0x6ace('0x10')](function(_0x3dc91f){logger['info'](_0x6ace('0x11'),_0x255be8,_0x6ace('0x12'));logger[_0x6ace('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x255be8,_0x6ace('0x12'),JSON[_0x6ace('0x14')](_0x3dc91f));if(_0x3dc91f['error']){if(_0x3dc91f[_0x6ace('0x15')][_0x6ace('0x16')]===0x1f4){logger[_0x6ace('0x15')]('Team,\x20%s,\x20%s',_0x255be8,_0x3dc91f[_0x6ace('0x15')][_0x6ace('0x17')]);return _0x1ca2f1(_0x3dc91f['error'][_0x6ace('0x17')]);}logger[_0x6ace('0x15')](_0x6ace('0x11'),_0x255be8,_0x3dc91f[_0x6ace('0x15')][_0x6ace('0x17')]);return _0x56af00(_0x3dc91f[_0x6ace('0x15')][_0x6ace('0x17')]);}else{logger[_0x6ace('0x18')](_0x6ace('0x11'),_0x255be8,_0x6ace('0x12'));_0x56af00(_0x3dc91f[_0x6ace('0x19')][_0x6ace('0x17')]);}})[_0x6ace('0x1a')](function(_0x368405){logger['error'](_0x6ace('0x11'),_0x255be8,_0x368405);_0x1ca2f1(_0x368405);});});} \ No newline at end of file +var _0xf769=['localhost','socket.io-emitter','./team.socket','register','request','Team,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','defaults','redis'];(function(_0x315f1f,_0x116c19){var _0x396f30=function(_0x25dc05){while(--_0x25dc05){_0x315f1f['push'](_0x315f1f['shift']());}};_0x396f30(++_0x116c19);}(_0xf769,0x112));var _0x9f76=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0xf769[_0xd299c3];return _0x376574;};'use strict';var _=require(_0x9f76('0x0'));var util=require('util');var moment=require(_0x9f76('0x1'));var BPromise=require(_0x9f76('0x2'));var rs=require(_0x9f76('0x3'));var fs=require('fs');var Redis=require(_0x9f76('0x4'));var db=require(_0x9f76('0x5'))['db'];var utils=require(_0x9f76('0x6'));var logger=require(_0x9f76('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9f76('0x8'));var client=jayson[_0x9f76('0x9')]['http']({'port':0x232a});config['redis']=_[_0x9f76('0xa')](config[_0x9f76('0xb')],{'host':_0x9f76('0xc'),'port':0x18eb});var socket=require(_0x9f76('0xd'))(new Redis(config['redis']));require(_0x9f76('0xe'))[_0x9f76('0xf')](socket);function respondWithRpcPromise(_0x4952a1,_0x82b6d7,_0x3c9c5e){return new BPromise(function(_0x3c761f,_0x3e6d3a){return client[_0x9f76('0x10')](_0x4952a1,_0x3c9c5e)['then'](function(_0x2be2d1){logger['info'](_0x9f76('0x11'),_0x82b6d7,'request\x20sent');logger[_0x9f76('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x82b6d7,_0x9f76('0x13'),JSON[_0x9f76('0x14')](_0x2be2d1));if(_0x2be2d1['error']){if(_0x2be2d1[_0x9f76('0x15')]['code']===0x1f4){logger[_0x9f76('0x15')](_0x9f76('0x11'),_0x82b6d7,_0x2be2d1[_0x9f76('0x15')][_0x9f76('0x16')]);return _0x3e6d3a(_0x2be2d1[_0x9f76('0x15')][_0x9f76('0x16')]);}logger[_0x9f76('0x15')](_0x9f76('0x11'),_0x82b6d7,_0x2be2d1[_0x9f76('0x15')]['message']);return _0x3c761f(_0x2be2d1[_0x9f76('0x15')][_0x9f76('0x16')]);}else{logger[_0x9f76('0x17')](_0x9f76('0x11'),_0x82b6d7,_0x9f76('0x13'));_0x3c761f(_0x2be2d1[_0x9f76('0x18')]['message']);}})[_0x9f76('0x19')](function(_0x51280d){logger[_0x9f76('0x15')](_0x9f76('0x11'),_0x82b6d7,_0x51280d);_0x3e6d3a(_0x51280d);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index c93b19a..dfb0a3c 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 _0x287e=['removeListener','register','team:','./team.events','save','remove','update','emit'];(function(_0x309c01,_0x11eb6a){var _0x49139a=function(_0x5421e7){while(--_0x5421e7){_0x309c01['push'](_0x309c01['shift']());}};_0x49139a(++_0x11eb6a);}(_0x287e,0x1e3));var _0xe287=function(_0xcbb5aa,_0x80418f){_0xcbb5aa=_0xcbb5aa-0x0;var _0x430fbd=_0x287e[_0xcbb5aa];return _0x430fbd;};'use strict';var TeamEvents=require(_0xe287('0x0'));var events=[_0xe287('0x1'),_0xe287('0x2'),_0xe287('0x3')];function createListener(_0x43ac68,_0xf00cd7){return function(_0x33e26a){_0xf00cd7[_0xe287('0x4')](_0x43ac68,_0x33e26a);};}function removeListener(_0x16d2d7,_0x5f34d6){return function(){TeamEvents[_0xe287('0x5')](_0x16d2d7,_0x5f34d6);};}exports[_0xe287('0x6')]=function(_0x5af7ce){for(var _0x4b3807=0x0,_0x38bd18=events['length'];_0x4b3807<_0x38bd18;_0x4b3807++){var _0x4f3cf1=events[_0x4b3807];var _0x4cd1f4=createListener(_0xe287('0x7')+_0x4f3cf1,_0x5af7ce);TeamEvents['on'](_0x4f3cf1,_0x4cd1f4);}}; \ No newline at end of file +var _0x0967=['emit','register','length','team:','./team.events','remove','update'];(function(_0x1dc16d,_0x1ee482){var _0x2f82ba=function(_0x2325a0){while(--_0x2325a0){_0x1dc16d['push'](_0x1dc16d['shift']());}};_0x2f82ba(++_0x1ee482);}(_0x0967,0x100));var _0x7096=function(_0x49c744,_0x477d2e){_0x49c744=_0x49c744-0x0;var _0x5c23d9=_0x0967[_0x49c744];return _0x5c23d9;};'use strict';var TeamEvents=require(_0x7096('0x0'));var events=['save',_0x7096('0x1'),_0x7096('0x2')];function createListener(_0x29b2ba,_0xc0c6b1){return function(_0x31f0b1){_0xc0c6b1[_0x7096('0x3')](_0x29b2ba,_0x31f0b1);};}function removeListener(_0x4106a2,_0x2a50e2){return function(){TeamEvents['removeListener'](_0x4106a2,_0x2a50e2);};}exports[_0x7096('0x4')]=function(_0x10181c){for(var _0xadd502=0x0,_0x1344c3=events[_0x7096('0x5')];_0xadd502<_0x1344c3;_0xadd502++){var _0x20f7ef=events[_0xadd502];var _0x2832fc=createListener(_0x7096('0x6')+_0x20f7ef,_0x10181c);TeamEvents['on'](_0x20f7ef,_0x2832fc);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index fd9dc4c..746b63c 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8f2=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x133fc0,_0x1edda8){var _0x4ce619=function(_0x308be5){while(--_0x308be5){_0x133fc0['push'](_0x133fc0['shift']());}};_0x4ce619(++_0x1edda8);}(_0xb8f2,0x104));var _0x2b8f=function(_0x449746,_0x16fda7){_0x449746=_0x449746-0x0;var _0x5be1de=_0xb8f2[_0x449746];return _0x5be1de;};'use strict';var multer=require(_0x2b8f('0x0'));var util=require(_0x2b8f('0x1'));var path=require('path');var timeout=require(_0x2b8f('0x2'));var express=require(_0x2b8f('0x3'));var router=express[_0x2b8f('0x4')]();var auth=require(_0x2b8f('0x5'));var interaction=require(_0x2b8f('0x6'));var config=require(_0x2b8f('0x7'));module[_0x2b8f('0x8')]=router; \ No newline at end of file +var _0x3710=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','connect-timeout','express'];(function(_0x21140e,_0x5245f4){var _0x6154d4=function(_0x437547){while(--_0x437547){_0x21140e['push'](_0x21140e['shift']());}};_0x6154d4(++_0x5245f4);}(_0x3710,0x17e));var _0x0371=function(_0x5b3d92,_0x14fa39){_0x5b3d92=_0x5b3d92-0x0;var _0x35a23c=_0x3710[_0x5b3d92];return _0x35a23c;};'use strict';var multer=require(_0x0371('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0371('0x1'));var express=require(_0x0371('0x2'));var router=express['Router']();var auth=require(_0x0371('0x3'));var interaction=require(_0x0371('0x4'));var config=require(_0x0371('0x5'));module[_0x0371('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 02df88e..20881f1 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x4fa50b,_0x5929c1){var _0x3f3f14=function(_0x2a9de3){while(--_0x2a9de3){_0x4fa50b['push'](_0x4fa50b['shift']());}};_0x3f3f14(++_0x5929c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x8da1c2,_0x218ccf){var _0x3b8a26=function(_0x502321){while(--_0x502321){_0x8da1c2['push'](_0x8da1c2['shift']());}};_0x3b8a26(++_0x218ccf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index adb5859..d16faa3 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0ec=['define','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5d0ef0,_0x1afa61){var _0x4d1913=function(_0x491be4){while(--_0x491be4){_0x5d0ef0['push'](_0x5d0ef0['shift']());}};_0x4d1913(++_0x1afa61);}(_0xb0ec,0x153));var _0xcb0e=function(_0x287e0c,_0x4383f4){_0x287e0c=_0x287e0c-0x0;var _0x5e5e39=_0xb0ec[_0x287e0c];return _0x5e5e39;};'use strict';var _=require('lodash');var util=require(_0xcb0e('0x0'));var logger=require(_0xcb0e('0x1'))(_0xcb0e('0x2'));var moment=require(_0xcb0e('0x3'));var BPromise=require('bluebird');var rp=require(_0xcb0e('0x4'));var fs=require('fs');var path=require(_0xcb0e('0x5'));var rimraf=require(_0xcb0e('0x6'));var config=require(_0xcb0e('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0xcb0e('0x8')]=function(_0x195fc5,_0x279880){return _0x195fc5[_0xcb0e('0x9')](_0xcb0e('0xa'),attributes,{'tableName':_0xcb0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb64=['exports','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x5b7b22,_0x5bc479){var _0x53dc9d=function(_0x5108c0){while(--_0x5108c0){_0x5b7b22['push'](_0x5b7b22['shift']());}};_0x53dc9d(++_0x5bc479);}(_0xfb64,0x107));var _0x4fb6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfb64[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x4fb6('0x0'));var logger=require(_0x4fb6('0x1'))(_0x4fb6('0x2'));var moment=require(_0x4fb6('0x3'));var BPromise=require(_0x4fb6('0x4'));var rp=require(_0x4fb6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4fb6('0x6'));var attributes=require('./teamVoiceQueue.attributes');module[_0x4fb6('0x7')]=function(_0x2b859c,_0x37954d){return _0x2b859c['define'](_0x4fb6('0x8'),attributes,{'tableName':_0x4fb6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 5ae6c67..9043321 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9f2=['debug','error','code','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9f2,0x15a));var _0x2e9f=function(_0x494867,_0x41eaa7){_0x494867=_0x494867-0x0;var _0xa9382e=_0xe9f2[_0x494867];return _0xa9382e;};'use strict';var _=require('lodash');var util=require(_0x2e9f('0x0'));var moment=require(_0x2e9f('0x1'));var BPromise=require(_0x2e9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e9f('0x3'));var db=require(_0x2e9f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e9f('0x5'))(_0x2e9f('0x6'));var config=require(_0x2e9f('0x7'));var jayson=require(_0x2e9f('0x8'));var client=jayson[_0x2e9f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33b534,_0xe223dd,_0x440f7f){return new BPromise(function(_0x54bfd9,_0x51a831){return client[_0x2e9f('0xa')](_0x33b534,_0x440f7f)[_0x2e9f('0xb')](function(_0xa2877e){logger['info'](_0x2e9f('0xc'),_0xe223dd,_0x2e9f('0xd'));logger[_0x2e9f('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0xe223dd,_0x2e9f('0xd'),JSON['stringify'](_0xa2877e));if(_0xa2877e['error']){if(_0xa2877e[_0x2e9f('0xf')][_0x2e9f('0x10')]===0x1f4){logger[_0x2e9f('0xf')](_0x2e9f('0xc'),_0xe223dd,_0xa2877e[_0x2e9f('0xf')][_0x2e9f('0x11')]);return _0x51a831(_0xa2877e['error'][_0x2e9f('0x11')]);}logger['error'](_0x2e9f('0xc'),_0xe223dd,_0xa2877e[_0x2e9f('0xf')][_0x2e9f('0x11')]);return _0x54bfd9(_0xa2877e['error'][_0x2e9f('0x11')]);}else{logger[_0x2e9f('0x12')](_0x2e9f('0xc'),_0xe223dd,_0x2e9f('0xd'));_0x54bfd9(_0xa2877e[_0x2e9f('0x13')][_0x2e9f('0x11')]);}})['catch'](function(_0x208c83){logger[_0x2e9f('0xf')](_0x2e9f('0xc'),_0xe223dd,_0x208c83);_0x51a831(_0x208c83);});});} \ No newline at end of file +var _0xbe49=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x55cc84,_0x14d491){var _0x213644=function(_0x5f5157){while(--_0x5f5157){_0x55cc84['push'](_0x55cc84['shift']());}};_0x213644(++_0x14d491);}(_0xbe49,0x161));var _0x9be4=function(_0x56924e,_0x5906f3){_0x56924e=_0x56924e-0x0;var _0x268fa2=_0xbe49[_0x56924e];return _0x268fa2;};'use strict';var _=require(_0x9be4('0x0'));var util=require(_0x9be4('0x1'));var moment=require(_0x9be4('0x2'));var BPromise=require(_0x9be4('0x3'));var rs=require(_0x9be4('0x4'));var fs=require('fs');var Redis=require(_0x9be4('0x5'));var db=require(_0x9be4('0x6'))['db'];var utils=require(_0x9be4('0x7'));var logger=require(_0x9be4('0x8'))(_0x9be4('0x9'));var config=require('../../config/environment');var jayson=require(_0x9be4('0xa'));var client=jayson['client'][_0x9be4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29164f,_0x12661a,_0x982038){return new BPromise(function(_0x2da102,_0x10eb20){return client['request'](_0x29164f,_0x982038)[_0x9be4('0xc')](function(_0x240bae){logger[_0x9be4('0xd')](_0x9be4('0xe'),_0x12661a,_0x9be4('0xf'));logger[_0x9be4('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x12661a,_0x9be4('0xf'),JSON['stringify'](_0x240bae));if(_0x240bae[_0x9be4('0x11')]){if(_0x240bae[_0x9be4('0x11')][_0x9be4('0x12')]===0x1f4){logger[_0x9be4('0x11')](_0x9be4('0xe'),_0x12661a,_0x240bae[_0x9be4('0x11')][_0x9be4('0x13')]);return _0x10eb20(_0x240bae[_0x9be4('0x11')][_0x9be4('0x13')]);}logger[_0x9be4('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x12661a,_0x240bae[_0x9be4('0x11')][_0x9be4('0x13')]);return _0x2da102(_0x240bae['error'][_0x9be4('0x13')]);}else{logger[_0x9be4('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x12661a,_0x9be4('0xf'));_0x2da102(_0x240bae[_0x9be4('0x14')][_0x9be4('0x13')]);}})[_0x9be4('0x15')](function(_0x800231){logger[_0x9be4('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x12661a,_0x800231);_0x10eb20(_0x800231);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 122ddda..6db14a0 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 _0x2964=['exports','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','/:id'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x2964,0x153));var _0x4296=function(_0x36e2a1,_0x580385){_0x36e2a1=_0x36e2a1-0x0;var _0x4b1477=_0x2964[_0x36e2a1];return _0x4b1477;};'use strict';var multer=require(_0x4296('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4296('0x1'));var router=express['Router']();var auth=require(_0x4296('0x2'));var interaction=require(_0x4296('0x3'));var config=require(_0x4296('0x4'));var controller=require('./template.controller');router[_0x4296('0x5')]('/',auth[_0x4296('0x6')](),controller[_0x4296('0x7')]);router[_0x4296('0x5')]('/:id',auth[_0x4296('0x6')](),controller[_0x4296('0x8')]);router['post']('/',auth[_0x4296('0x6')](),controller[_0x4296('0x9')]);router[_0x4296('0xa')](_0x4296('0xb'),auth[_0x4296('0x6')](),controller['update']);router['delete'](_0x4296('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4296('0xc')]=router; \ No newline at end of file +var _0x3717=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x3717,0xe0));var _0x7371=function(_0x4931de,_0x243a04){_0x4931de=_0x4931de-0x0;var _0x32d1a9=_0x3717[_0x4931de];return _0x32d1a9;};'use strict';var multer=require(_0x7371('0x0'));var util=require(_0x7371('0x1'));var path=require(_0x7371('0x2'));var timeout=require('connect-timeout');var express=require(_0x7371('0x3'));var router=express[_0x7371('0x4')]();var auth=require(_0x7371('0x5'));var interaction=require(_0x7371('0x6'));var config=require(_0x7371('0x7'));var controller=require(_0x7371('0x8'));router[_0x7371('0x9')]('/',auth[_0x7371('0xa')](),controller['index']);router[_0x7371('0x9')]('/:id',auth[_0x7371('0xa')](),controller['show']);router[_0x7371('0xb')]('/',auth['isAuthenticated'](),controller[_0x7371('0xc')]);router[_0x7371('0xd')](_0x7371('0xe'),auth[_0x7371('0xa')](),controller[_0x7371('0xf')]);router[_0x7371('0x10')](_0x7371('0xe'),auth['isAuthenticated'](),controller[_0x7371('0x11')]);module[_0x7371('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 861d81c..c19db78 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 _0x0e4e=['STRING','TEXT','sequelize'];(function(_0x4bead3,_0xbec9e5){var _0x3c1c77=function(_0x290e1e){while(--_0x290e1e){_0x4bead3['push'](_0x4bead3['shift']());}};_0x3c1c77(++_0xbec9e5);}(_0x0e4e,0xc8));var _0xe0e4=function(_0x40b0f,_0x3783e5){_0x40b0f=_0x40b0f-0x0;var _0x39a923=_0x0e4e[_0x40b0f];return _0x39a923;};'use strict';var Sequelize=require(_0xe0e4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe0e4('0x1')]},'html':{'type':Sequelize[_0xe0e4('0x2')]}}; \ No newline at end of file +var _0x7881=['STRING','sequelize','exports'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x7881,0x1d2));var _0x1788=function(_0x35a4ed,_0x13c67b){_0x35a4ed=_0x35a4ed-0x0;var _0x2051c6=_0x7881[_0x35a4ed];return _0x2051c6;};'use strict';var Sequelize=require(_0x1788('0x0'));module[_0x1788('0x1')]={'name':{'type':Sequelize[_0x1788('0x2')]},'description':{'type':Sequelize[_0x1788('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index f0873c5..cb9cf89 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 _0xc4aa=['send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','filter','options','Template','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name'];(function(_0x208d26,_0x3e1f40){var _0x106789=function(_0x455d7c){while(--_0x455d7c){_0x208d26['push'](_0x208d26['shift']());}};_0x106789(++_0x3e1f40);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'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 licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=_0x26dbb8[_0xac4a('0x1b')],_0x402fff=_0x11e101[_0xac4a('0x1c')],_0x34d797=_0x11e101[_0xac4a('0x1c')]+_0x11e101[_0xac4a('0x1d')],_0x23eb66;if(_0x34d797>=_0x4a2119){_0x34d797=_0x4a2119;_0x23eb66=0xc8;}else{_0x23eb66=0xce;}_0x42c7fc[_0xac4a('0x18')](_0x23eb66);return _0x42c7fc['set']('Content-Range',_0x402fff+'-'+_0x34d797+'/'+_0x4a2119)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x13c8eb){return function(_0x39b691){try{jsonpatch['apply'](_0x39b691,_0x13c8eb,!![]);}catch(_0x39e83e){return BPromise[_0xac4a('0x1e')](_0x39e83e);}return _0x39b691[_0xac4a('0x1f')]();};}function saveUpdates(_0x3a3cdb,_0x123694){return function(_0x3e829c){if(_0x3e829c){return _0x3e829c[_0xac4a('0x20')](_0x3a3cdb)[_0xac4a('0x21')](function(_0x534092){return _0x534092;});}return null;};}function removeEntity(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x22')]()[_0xac4a('0x21')](function(){var _0x3eacd3=_0x599787[_0xac4a('0x23')]({'plain':!![]});var _0x4d2d6c=_0xac4a('0x24');return db[_0xac4a('0x25')][_0xac4a('0x22')]({'where':{'type':_0x4d2d6c,'resourceId':_0x3eacd3['id']}})[_0xac4a('0x21')](function(){return _0x599787;});})[_0xac4a('0x21')](function(){_0x3d8f0a[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x36054a,_0x3e2c69){return function(_0x3bc318){if(!_0x3bc318){_0x36054a[_0xac4a('0x17')](0x194);}return _0x3bc318;};}function handleError(_0x215a31,_0x14832b){_0x14832b=_0x14832b||0x1f4;return function(_0x472c57){logger[_0xac4a('0x26')](_0x472c57[_0xac4a('0x27')]);if(_0x472c57['name']){delete _0x472c57[_0xac4a('0x28')];}_0x215a31[_0xac4a('0x18')](_0x14832b)[_0xac4a('0x29')](_0x472c57);};}exports[_0xac4a('0x2a')]=function(_0x116700,_0x4a5a9e){var _0x47f49c={},_0xdb7e={},_0x7a948b={'count':0x0,'rows':[]};var _0x1f12d5=_['map'](db['Template'][_0xac4a('0x2b')],function(_0x2896bc){return{'name':_0x2896bc[_0xac4a('0x2c')],'type':_0x2896bc[_0xac4a('0x2d')][_0xac4a('0x2e')]};});_0xdb7e['model']=_[_0xac4a('0x2f')](_0x1f12d5,'name');_0xdb7e[_0xac4a('0x30')]=_['keys'](_0x116700[_0xac4a('0x30')]);_0xdb7e[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0xdb7e[_0xac4a('0x33')],_0xdb7e[_0xac4a('0x30')]);_0x47f49c[_0xac4a('0x34')]=_[_0xac4a('0x32')](_0xdb7e[_0xac4a('0x33')],qs[_0xac4a('0x35')](_0x116700[_0xac4a('0x30')][_0xac4a('0x35')]));_0x47f49c[_0xac4a('0x34')]=_0x47f49c[_0xac4a('0x34')][_0xac4a('0x36')]?_0x47f49c['attributes']:_0xdb7e[_0xac4a('0x33')];if(!_0x116700[_0xac4a('0x30')]['hasOwnProperty'](_0xac4a('0x37'))){_0x47f49c[_0xac4a('0x1d')]=qs['limit'](_0x116700['query'][_0xac4a('0x1d')]);_0x47f49c[_0xac4a('0x1c')]=qs[_0xac4a('0x1c')](_0x116700[_0xac4a('0x30')]['offset']);}_0x47f49c[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x116700['query'][_0xac4a('0x39')]);_0x47f49c[_0xac4a('0x3a')]=qs[_0xac4a('0x31')](_['pick'](_0x116700[_0xac4a('0x30')],_0xdb7e[_0xac4a('0x31')]),_0x1f12d5);if(_0x116700[_0xac4a('0x30')]['filter']){_0x47f49c[_0xac4a('0x3a')]=_[_0xac4a('0x3b')](_0x47f49c['where'],{'$or':_['map'](_0x1f12d5,function(_0x4319a1){if(_0x4319a1['type']!=='VIRTUAL'){var _0x5f0af0={};_0x5f0af0[_0x4319a1['name']]={'$like':'%'+_0x116700[_0xac4a('0x30')][_0xac4a('0x3c')]+'%'};return _0x5f0af0;}})});}_0x47f49c=_[_0xac4a('0x3b')]({},_0x47f49c,_0x116700[_0xac4a('0x3d')]);var _0x2bdb21={'where':_0x47f49c[_0xac4a('0x3a')]};return db[_0xac4a('0x3e')][_0xac4a('0x1b')](_0x2bdb21)[_0xac4a('0x21')](function(_0x1f7721){_0x7a948b[_0xac4a('0x1b')]=_0x1f7721;if(_0x116700[_0xac4a('0x30')]['includeAll']){_0x47f49c['include']=[{'all':!![]}];}return db['Template'][_0xac4a('0x3f')](_0x47f49c);})[_0xac4a('0x21')](function(_0x14e80b){_0x7a948b[_0xac4a('0x40')]=_0x14e80b;return _0x7a948b;})[_0xac4a('0x21')](respondWithFilteredResult(_0x4a5a9e,_0x47f49c))[_0xac4a('0x41')](handleError(_0x4a5a9e,null));};exports[_0xac4a('0x42')]=function(_0x3441f2,_0x3e9973){var _0x3edb19={'raw':!![],'where':{'id':_0x3441f2[_0xac4a('0x43')]['id']}},_0x561cb7={};_0x561cb7[_0xac4a('0x33')]=_[_0xac4a('0x44')](db[_0xac4a('0x3e')][_0xac4a('0x2b')]);_0x561cb7['query']=_[_0xac4a('0x44')](_0x3441f2[_0xac4a('0x30')]);_0x561cb7['filters']=_[_0xac4a('0x32')](_0x561cb7['model'],_0x561cb7[_0xac4a('0x30')]);_0x3edb19[_0xac4a('0x34')]=_[_0xac4a('0x32')](_0x561cb7[_0xac4a('0x33')],qs[_0xac4a('0x35')](_0x3441f2[_0xac4a('0x30')][_0xac4a('0x35')]));_0x3edb19[_0xac4a('0x34')]=_0x3edb19[_0xac4a('0x34')][_0xac4a('0x36')]?_0x3edb19[_0xac4a('0x34')]:_0x561cb7[_0xac4a('0x33')];if(_0x3441f2['query'][_0xac4a('0x45')]){_0x3edb19[_0xac4a('0x46')]=[{'all':!![]}];}_0x3edb19=_[_0xac4a('0x3b')]({},_0x3edb19,_0x3441f2['options']);return db[_0xac4a('0x3e')][_0xac4a('0x47')](_0x3edb19)['then'](handleEntityNotFound(_0x3e9973,null))[_0xac4a('0x21')](respondWithResult(_0x3e9973,null))['catch'](handleError(_0x3e9973,null));};exports[_0xac4a('0x48')]=function(_0xe620f6,_0x136a65){return db['Template']['create'](_0xe620f6[_0xac4a('0x49')],{})['then'](function(_0x18ae96){var _0x566258=_0xe620f6[_0xac4a('0x4a')]['get']({'plain':!![]});if(!_0x566258)throw new Error(_0xac4a('0x4b'));if(_0x566258[_0xac4a('0x4c')]===_0xac4a('0x4a')){var _0x1c8c39=_0x18ae96['get']({'plain':!![]});var _0x31c794=_0xac4a('0x24');return db[_0xac4a('0x4d')][_0xac4a('0x47')]({'where':{'name':_0x31c794,'userProfileId':_0x566258[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x21')](function(_0x187306){if(_0x187306&&_0x187306['autoAssociation']===0x0){return db[_0xac4a('0x25')][_0xac4a('0x48')]({'name':_0x1c8c39['name'],'resourceId':_0x1c8c39['id'],'type':_0x187306[_0xac4a('0x28')],'sectionId':_0x187306['id']},{})[_0xac4a('0x21')](function(){return _0x18ae96;});}else{return _0x18ae96;}})[_0xac4a('0x41')](function(_0x3ac36e){logger['error'](_0xac4a('0x4f'),_0x3ac36e);throw _0x3ac36e;});}return _0x18ae96;})[_0xac4a('0x21')](respondWithResult(_0x136a65,0xc9))[_0xac4a('0x41')](handleError(_0x136a65,null));};exports[_0xac4a('0x20')]=function(_0x890910,_0x49fbc3){if(_0x890910[_0xac4a('0x49')]['id']){delete _0x890910['body']['id'];}return db[_0xac4a('0x3e')][_0xac4a('0x47')]({'where':{'id':_0x890910['params']['id']}})['then'](handleEntityNotFound(_0x49fbc3,null))[_0xac4a('0x21')](saveUpdates(_0x890910[_0xac4a('0x49')],null))['then'](respondWithResult(_0x49fbc3,null))[_0xac4a('0x41')](handleError(_0x49fbc3,null));};exports[_0xac4a('0x22')]=function(_0x26b582,_0x103d05){return db['Template'][_0xac4a('0x47')]({'where':{'id':_0x26b582[_0xac4a('0x43')]['id']}})[_0xac4a('0x21')](handleEntityNotFound(_0x103d05,null))[_0xac4a('0x21')](removeEntity(_0x103d05,null))[_0xac4a('0x41')](handleError(_0x103d05,null));}; \ No newline at end of file +var _0x814b=['filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','Template','includeAll','include','rows','catch','keys','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','index','map','rawAttributes','type','model','query'];(function(_0x41dc9d,_0xaf4102){var _0x48291c=function(_0x11b988){while(--_0x11b988){_0x41dc9d['push'](_0x41dc9d['shift']());}};_0x48291c(++_0xaf4102);}(_0x814b,0x1a2));var _0xb814=function(_0x18ea99,_0x5d0dc6){_0x18ea99=_0x18ea99-0x0;var _0x4e1a63=_0x814b[_0x18ea99];return _0x4e1a63;};'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 licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){var _0x594470=_0x27352e[_0xb814('0x26')]({'plain':!![]});var _0x52b7a3=_0xb814('0x27');return db[_0xb814('0x28')][_0xb814('0x25')]({'where':{'type':_0x52b7a3,'resourceId':_0x594470['id']}})[_0xb814('0x24')](function(){return _0x27352e;});})[_0xb814('0x24')](function(){_0x3b267e[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x5755ea,_0x392222){return function(_0xc0ef66){if(!_0xc0ef66){_0x5755ea[_0xb814('0x1b')](0x194);}return _0xc0ef66;};}function handleError(_0x349394,_0x32ed56){_0x32ed56=_0x32ed56||0x1f4;return function(_0x1d5965){logger[_0xb814('0x29')](_0x1d5965[_0xb814('0x2a')]);if(_0x1d5965['name']){delete _0x1d5965[_0xb814('0x2b')];}_0x349394[_0xb814('0x1c')](_0x32ed56)['send'](_0x1d5965);};}exports[_0xb814('0x2c')]=function(_0x37d24d,_0x530744){var _0x499f22={},_0x20577b={},_0x2051d0={'count':0x0,'rows':[]};var _0x58c3ca=_[_0xb814('0x2d')](db['Template'][_0xb814('0x2e')],function(_0x5f3e9b){return{'name':_0x5f3e9b['fieldName'],'type':_0x5f3e9b[_0xb814('0x2f')]['key']};});_0x20577b[_0xb814('0x30')]=_[_0xb814('0x2d')](_0x58c3ca,_0xb814('0x2b'));_0x20577b['query']=_['keys'](_0x37d24d[_0xb814('0x31')]);_0x20577b[_0xb814('0x32')]=_['intersection'](_0x20577b[_0xb814('0x30')],_0x20577b[_0xb814('0x31')]);_0x499f22[_0xb814('0x33')]=_[_0xb814('0x34')](_0x20577b[_0xb814('0x30')],qs[_0xb814('0x35')](_0x37d24d[_0xb814('0x31')]['fields']));_0x499f22[_0xb814('0x33')]=_0x499f22[_0xb814('0x33')][_0xb814('0x36')]?_0x499f22[_0xb814('0x33')]:_0x20577b[_0xb814('0x30')];if(!_0x37d24d['query'][_0xb814('0x37')]('nolimit')){_0x499f22[_0xb814('0x38')]=qs[_0xb814('0x38')](_0x37d24d[_0xb814('0x31')]['limit']);_0x499f22[_0xb814('0x20')]=qs[_0xb814('0x20')](_0x37d24d['query'][_0xb814('0x20')]);}_0x499f22[_0xb814('0x39')]=qs[_0xb814('0x3a')](_0x37d24d[_0xb814('0x31')][_0xb814('0x3a')]);_0x499f22[_0xb814('0x3b')]=qs['filters'](_[_0xb814('0x3c')](_0x37d24d['query'],_0x20577b[_0xb814('0x32')]),_0x58c3ca);if(_0x37d24d['query'][_0xb814('0x3d')]){_0x499f22['where']=_[_0xb814('0x3e')](_0x499f22[_0xb814('0x3b')],{'$or':_['map'](_0x58c3ca,function(_0x4d308a){if(_0x4d308a['type']!=='VIRTUAL'){var _0x17549e={};_0x17549e[_0x4d308a[_0xb814('0x2b')]]={'$like':'%'+_0x37d24d[_0xb814('0x31')][_0xb814('0x3d')]+'%'};return _0x17549e;}})});}_0x499f22=_['merge']({},_0x499f22,_0x37d24d['options']);var _0x6f15d3={'where':_0x499f22['where']};return db[_0xb814('0x3f')][_0xb814('0x1f')](_0x6f15d3)[_0xb814('0x24')](function(_0x3063bf){_0x2051d0[_0xb814('0x1f')]=_0x3063bf;if(_0x37d24d[_0xb814('0x31')][_0xb814('0x40')]){_0x499f22[_0xb814('0x41')]=[{'all':!![]}];}return db[_0xb814('0x3f')]['findAll'](_0x499f22);})['then'](function(_0x5d26be){_0x2051d0[_0xb814('0x42')]=_0x5d26be;return _0x2051d0;})['then'](respondWithFilteredResult(_0x530744,_0x499f22))[_0xb814('0x43')](handleError(_0x530744,null));};exports['show']=function(_0x411723,_0x44ff56){var _0x9ef639={'raw':!![],'where':{'id':_0x411723['params']['id']}},_0x2e97cc={};_0x2e97cc[_0xb814('0x30')]=_[_0xb814('0x44')](db[_0xb814('0x3f')][_0xb814('0x2e')]);_0x2e97cc[_0xb814('0x31')]=_[_0xb814('0x44')](_0x411723['query']);_0x2e97cc[_0xb814('0x32')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],_0x2e97cc[_0xb814('0x31')]);_0x9ef639[_0xb814('0x33')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],qs['fields'](_0x411723['query'][_0xb814('0x35')]));_0x9ef639[_0xb814('0x33')]=_0x9ef639[_0xb814('0x33')][_0xb814('0x36')]?_0x9ef639[_0xb814('0x33')]:_0x2e97cc[_0xb814('0x30')];if(_0x411723[_0xb814('0x31')][_0xb814('0x40')]){_0x9ef639[_0xb814('0x41')]=[{'all':!![]}];}_0x9ef639=_[_0xb814('0x3e')]({},_0x9ef639,_0x411723[_0xb814('0x45')]);return db['Template'][_0xb814('0x46')](_0x9ef639)[_0xb814('0x24')](handleEntityNotFound(_0x44ff56,null))['then'](respondWithResult(_0x44ff56,null))[_0xb814('0x43')](handleError(_0x44ff56,null));};exports['create']=function(_0x2fb0f7,_0x37866f){return db[_0xb814('0x3f')][_0xb814('0x47')](_0x2fb0f7[_0xb814('0x48')],{})[_0xb814('0x24')](function(_0x2cc806){var _0x45480e=_0x2fb0f7[_0xb814('0x49')][_0xb814('0x26')]({'plain':!![]});if(!_0x45480e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45480e['role']===_0xb814('0x49')){var _0x30f07b=_0x2cc806[_0xb814('0x26')]({'plain':!![]});var _0x3f8e29=_0xb814('0x27');return db[_0xb814('0x4a')][_0xb814('0x46')]({'where':{'name':_0x3f8e29,'userProfileId':_0x45480e['userProfileId']},'raw':!![]})[_0xb814('0x24')](function(_0x388324){if(_0x388324&&_0x388324[_0xb814('0x4b')]===0x0){return db['UserProfileResource'][_0xb814('0x47')]({'name':_0x30f07b['name'],'resourceId':_0x30f07b['id'],'type':_0x388324[_0xb814('0x2b')],'sectionId':_0x388324['id']},{})['then'](function(){return _0x2cc806;});}else{return _0x2cc806;}})[_0xb814('0x43')](function(_0x3cf8f8){logger['error'](_0xb814('0x4c'),_0x3cf8f8);throw _0x3cf8f8;});}return _0x2cc806;})[_0xb814('0x24')](respondWithResult(_0x37866f,0xc9))[_0xb814('0x43')](handleError(_0x37866f,null));};exports['update']=function(_0x3da050,_0x5f0e58){if(_0x3da050[_0xb814('0x48')]['id']){delete _0x3da050[_0xb814('0x48')]['id'];}return db['Template'][_0xb814('0x46')]({'where':{'id':_0x3da050['params']['id']}})['then'](handleEntityNotFound(_0x5f0e58,null))[_0xb814('0x24')](saveUpdates(_0x3da050[_0xb814('0x48')],null))[_0xb814('0x24')](respondWithResult(_0x5f0e58,null))['catch'](handleError(_0x5f0e58,null));};exports[_0xb814('0x25')]=function(_0x538b0f,_0xf88d23){return db[_0xb814('0x3f')]['find']({'where':{'id':_0x538b0f[_0xb814('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf88d23,null))[_0xb814('0x24')](removeEntity(_0xf88d23,null))[_0xb814('0x43')](handleError(_0xf88d23,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index db7f62e..5ccb163 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 _0x1f9e=['lodash','util','api','moment','request-promise','path','rimraf','./template.attributes','exports','Template','tools_templates'];(function(_0x2a6802,_0x50bf12){var _0x1eb158=function(_0x3d3822){while(--_0x3d3822){_0x2a6802['push'](_0x2a6802['shift']());}};_0x1eb158(++_0x50bf12);}(_0x1f9e,0x1d9));var _0xe1f9=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x1f9e[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0xe1f9('0x0'));var util=require(_0xe1f9('0x1'));var logger=require('../../config/logger')(_0xe1f9('0x2'));var moment=require(_0xe1f9('0x3'));var BPromise=require('bluebird');var rp=require(_0xe1f9('0x4'));var fs=require('fs');var path=require(_0xe1f9('0x5'));var rimraf=require(_0xe1f9('0x6'));var config=require('../../config/environment');var attributes=require(_0xe1f9('0x7'));module[_0xe1f9('0x8')]=function(_0x58ac9f,_0x139998){return _0x58ac9f['define'](_0xe1f9('0x9'),attributes,{'tableName':_0xe1f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc05f=['bluebird','request-promise','path','../../config/environment','exports','define','tools_templates','lodash','util','api','moment'];(function(_0x58f57f,_0x23028c){var _0x318b7f=function(_0x1f239b){while(--_0x1f239b){_0x58f57f['push'](_0x58f57f['shift']());}};_0x318b7f(++_0x23028c);}(_0xc05f,0x151));var _0xfc05=function(_0x26f926,_0x3530b0){_0x26f926=_0x26f926-0x0;var _0x569d96=_0xc05f[_0x26f926];return _0x569d96;};'use strict';var _=require(_0xfc05('0x0'));var util=require(_0xfc05('0x1'));var logger=require('../../config/logger')(_0xfc05('0x2'));var moment=require(_0xfc05('0x3'));var BPromise=require(_0xfc05('0x4'));var rp=require(_0xfc05('0x5'));var fs=require('fs');var path=require(_0xfc05('0x6'));var rimraf=require('rimraf');var config=require(_0xfc05('0x7'));var attributes=require('./template.attributes');module[_0xfc05('0x8')]=function(_0xdbad2c,_0x1de150){return _0xdbad2c[_0xfc05('0x9')]('Template',attributes,{'tableName':_0xfc05('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index a389f74..866583d 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 _0xde62=['../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','findAll','options','raw','where','attributes','limit','map','include','model','catch','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0x1770fe,_0x1ac6d6){var _0x70d939=function(_0x5eba7c){while(--_0x5eba7c){_0x1770fe['push'](_0x1770fe['shift']());}};_0x70d939(++_0x1ac6d6);}(_0xde62,0x164));var _0x2de6=function(_0x9435f2,_0x137fbd){_0x9435f2=_0x9435f2-0x0;var _0x5e3463=_0xde62[_0x9435f2];return _0x5e3463;};'use strict';var _=require(_0x2de6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2de6('0x1'));var db=require(_0x2de6('0x2'))['db'];var utils=require(_0x2de6('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x2de6('0x4'));var jayson=require(_0x2de6('0x5'));var client=jayson[_0x2de6('0x6')][_0x2de6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1dd20b,_0x11d5db,_0x1e4cc9){return new BPromise(function(_0x3e6648,_0x12a055){return client[_0x2de6('0x8')](_0x1dd20b,_0x1e4cc9)['then'](function(_0x37bcdb){logger['info']('Template,\x20%s,\x20%s',_0x11d5db,_0x2de6('0x9'));logger[_0x2de6('0xa')](_0x2de6('0xb'),_0x11d5db,'request\x20sent',JSON[_0x2de6('0xc')](_0x37bcdb));if(_0x37bcdb[_0x2de6('0xd')]){if(_0x37bcdb[_0x2de6('0xd')][_0x2de6('0xe')]===0x1f4){logger[_0x2de6('0xd')](_0x2de6('0xf'),_0x11d5db,_0x37bcdb['error']['message']);return _0x12a055(_0x37bcdb['error'][_0x2de6('0x10')]);}logger[_0x2de6('0xd')](_0x2de6('0xf'),_0x11d5db,_0x37bcdb['error'][_0x2de6('0x10')]);return _0x3e6648(_0x37bcdb[_0x2de6('0xd')][_0x2de6('0x10')]);}else{logger['info'](_0x2de6('0xf'),_0x11d5db,'request\x20sent');_0x3e6648(_0x37bcdb[_0x2de6('0x11')][_0x2de6('0x10')]);}})['catch'](function(_0x4645a4){logger[_0x2de6('0xd')](_0x2de6('0xf'),_0x11d5db,_0x4645a4);_0x12a055(_0x4645a4);});});}exports[_0x2de6('0x12')]=function(_0x25c49a){var _0x1b7d11=this;return new Promise(function(_0xfcac16,_0x265fdf){return db[_0x2de6('0x13')][_0x2de6('0x14')]({'raw':_0x25c49a[_0x2de6('0x15')]?_0x25c49a[_0x2de6('0x15')][_0x2de6('0x16')]===undefined?!![]:![]:!![],'where':_0x25c49a[_0x2de6('0x15')]?_0x25c49a['options'][_0x2de6('0x17')]||null:null,'attributes':_0x25c49a[_0x2de6('0x15')]?_0x25c49a[_0x2de6('0x15')][_0x2de6('0x18')]||null:null,'limit':_0x25c49a['options']?_0x25c49a[_0x2de6('0x15')][_0x2de6('0x19')]||null:null,'include':_0x25c49a[_0x2de6('0x15')]?_0x25c49a[_0x2de6('0x15')]['include']?_[_0x2de6('0x1a')](_0x25c49a[_0x2de6('0x15')][_0x2de6('0x1b')],function(_0x1f1a80){return{'model':db[_0x1f1a80['model']],'as':_0x1f1a80['as'],'attributes':_0x1f1a80[_0x2de6('0x18')],'include':_0x1f1a80['include']?_[_0x2de6('0x1a')](_0x1f1a80['include'],function(_0x58cdde){return{'model':db[_0x58cdde[_0x2de6('0x1c')]],'as':_0x58cdde['as'],'attributes':_0x58cdde['attributes'],'include':_0x58cdde[_0x2de6('0x1b')]?_[_0x2de6('0x1a')](_0x58cdde[_0x2de6('0x1b')],function(_0xda81f){return{'model':db[_0xda81f[_0x2de6('0x1c')]],'as':_0xda81f['as'],'attributes':_0xda81f[_0x2de6('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1aeb62){logger['info'](_0x2de6('0x12'),_0x25c49a);logger['debug'](_0x2de6('0x12'),_0x25c49a,JSON['stringify'](_0x1aeb62));_0xfcac16(_0x1aeb62);})[_0x2de6('0x1d')](function(_0x220ad6){logger[_0x2de6('0xd')](_0x2de6('0x12'),_0x220ad6['message'],_0x25c49a);_0x265fdf(_0x1b7d11[_0x2de6('0xd')](0x1f4,_0x220ad6['message']));});});}; \ No newline at end of file +var _0x39ec=['Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','Template','findAll','options','raw','attributes','limit','include','model','map','GetTemplate','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','debug'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x39ec,0xb6));var _0xc39e=function(_0x18ce70,_0x14d8da){_0x18ce70=_0x18ce70-0x0;var _0x55f028=_0x39ec[_0x18ce70];return _0x55f028;};'use strict';var _=require(_0xc39e('0x0'));var util=require(_0xc39e('0x1'));var moment=require('moment');var BPromise=require(_0xc39e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc39e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc39e('0x4'));var logger=require(_0xc39e('0x5'))(_0xc39e('0x6'));var config=require(_0xc39e('0x7'));var jayson=require(_0xc39e('0x8'));var client=jayson[_0xc39e('0x9')][_0xc39e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1efecf,_0x3f1ba6,_0x39d010){return new BPromise(function(_0x12ff9a,_0xc78944){return client[_0xc39e('0xb')](_0x1efecf,_0x39d010)[_0xc39e('0xc')](function(_0x42032f){logger[_0xc39e('0xd')](_0xc39e('0xe'),_0x3f1ba6,'request\x20sent');logger[_0xc39e('0xf')](_0xc39e('0x10'),_0x3f1ba6,_0xc39e('0x11'),JSON[_0xc39e('0x12')](_0x42032f));if(_0x42032f[_0xc39e('0x13')]){if(_0x42032f['error']['code']===0x1f4){logger['error'](_0xc39e('0xe'),_0x3f1ba6,_0x42032f[_0xc39e('0x13')][_0xc39e('0x14')]);return _0xc78944(_0x42032f[_0xc39e('0x13')][_0xc39e('0x14')]);}logger[_0xc39e('0x13')](_0xc39e('0xe'),_0x3f1ba6,_0x42032f[_0xc39e('0x13')][_0xc39e('0x14')]);return _0x12ff9a(_0x42032f[_0xc39e('0x13')][_0xc39e('0x14')]);}else{logger['info'](_0xc39e('0xe'),_0x3f1ba6,_0xc39e('0x11'));_0x12ff9a(_0x42032f[_0xc39e('0x15')][_0xc39e('0x14')]);}})[_0xc39e('0x16')](function(_0xb08f7e){logger[_0xc39e('0x13')](_0xc39e('0xe'),_0x3f1ba6,_0xb08f7e);_0xc78944(_0xb08f7e);});});}exports['GetTemplate']=function(_0x1f867a){var _0x26054d=this;return new Promise(function(_0x10b459,_0x336479){return db[_0xc39e('0x17')][_0xc39e('0x18')]({'raw':_0x1f867a[_0xc39e('0x19')]?_0x1f867a[_0xc39e('0x19')][_0xc39e('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f867a[_0xc39e('0x19')]?_0x1f867a[_0xc39e('0x19')]['where']||null:null,'attributes':_0x1f867a[_0xc39e('0x19')]?_0x1f867a[_0xc39e('0x19')][_0xc39e('0x1b')]||null:null,'limit':_0x1f867a[_0xc39e('0x19')]?_0x1f867a['options'][_0xc39e('0x1c')]||null:null,'include':_0x1f867a[_0xc39e('0x19')]?_0x1f867a['options'][_0xc39e('0x1d')]?_['map'](_0x1f867a[_0xc39e('0x19')][_0xc39e('0x1d')],function(_0x18ec2c){return{'model':db[_0x18ec2c[_0xc39e('0x1e')]],'as':_0x18ec2c['as'],'attributes':_0x18ec2c[_0xc39e('0x1b')],'include':_0x18ec2c[_0xc39e('0x1d')]?_[_0xc39e('0x1f')](_0x18ec2c[_0xc39e('0x1d')],function(_0x591693){return{'model':db[_0x591693[_0xc39e('0x1e')]],'as':_0x591693['as'],'attributes':_0x591693[_0xc39e('0x1b')],'include':_0x591693[_0xc39e('0x1d')]?_[_0xc39e('0x1f')](_0x591693[_0xc39e('0x1d')],function(_0x3f756c){return{'model':db[_0x3f756c['model']],'as':_0x3f756c['as'],'attributes':_0x3f756c[_0xc39e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc39e('0xc')](function(_0x4baf42){logger['info'](_0xc39e('0x20'),_0x1f867a);logger['debug'](_0xc39e('0x20'),_0x1f867a,JSON[_0xc39e('0x12')](_0x4baf42));_0x10b459(_0x4baf42);})[_0xc39e('0x16')](function(_0x1b750f){logger[_0xc39e('0x13')](_0xc39e('0x20'),_0x1b750f[_0xc39e('0x14')],_0x1f867a);_0x336479(_0x26054d[_0xc39e('0x13')](0x1f4,_0x1b750f['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 6059703..2fac9be 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 _0xacdf=['getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','multer','path','express','Router','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','getAllConditions','/:id/any_conditions'];(function(_0x2b978a,_0x50110e){var _0x20fdc5=function(_0x2e74c5){while(--_0x2e74c5){_0x2b978a['push'](_0x2b978a['shift']());}};_0x20fdc5(++_0x50110e);}(_0xacdf,0x12b));var _0xfacd=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xacdf[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xfacd('0x0'));var util=require('util');var path=require(_0xfacd('0x1'));var timeout=require('connect-timeout');var express=require(_0xfacd('0x2'));var router=express[_0xfacd('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfacd('0x4'));var controller=require(_0xfacd('0x5'));router[_0xfacd('0x6')]('/',auth[_0xfacd('0x7')](),controller[_0xfacd('0x8')]);router[_0xfacd('0x6')]('/:id',auth[_0xfacd('0x7')](),controller[_0xfacd('0x9')]);router[_0xfacd('0x6')](_0xfacd('0xa'),auth[_0xfacd('0x7')](),controller[_0xfacd('0xb')]);router[_0xfacd('0x6')](_0xfacd('0xc'),auth[_0xfacd('0x7')](),controller[_0xfacd('0xd')]);router[_0xfacd('0x6')](_0xfacd('0xe'),auth['isAuthenticated'](),controller[_0xfacd('0xf')]);router[_0xfacd('0x10')]('/',auth[_0xfacd('0x7')](),controller[_0xfacd('0x11')]);router[_0xfacd('0x10')](_0xfacd('0xa'),auth[_0xfacd('0x7')](),controller[_0xfacd('0x12')]);router[_0xfacd('0x10')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xfacd('0x13')]);router[_0xfacd('0x10')](_0xfacd('0xe'),auth[_0xfacd('0x7')](),controller[_0xfacd('0x14')]);router[_0xfacd('0x15')](_0xfacd('0x16'),auth[_0xfacd('0x7')](),controller[_0xfacd('0x17')]);router[_0xfacd('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xfacd('0x19')]);module['exports']=router; \ No newline at end of file +var _0x700f=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','show','getAllConditions','/:id/any_conditions','isAuthenticated','getAnyConditions','/:id/actions','getActions','post','/:id/all_conditions','addAllCondition','put'];(function(_0x2d6f9c,_0x2bf013){var _0x2ed6a5=function(_0x36bd74){while(--_0x36bd74){_0x2d6f9c['push'](_0x2d6f9c['shift']());}};_0x2ed6a5(++_0x2bf013);}(_0x700f,0xf7));var _0xf700=function(_0x5b2b52,_0x2887c3){_0x5b2b52=_0x5b2b52-0x0;var _0x1d432f=_0x700f[_0x5b2b52];return _0x1d432f;};'use strict';var multer=require(_0xf700('0x0'));var util=require(_0xf700('0x1'));var path=require('path');var timeout=require(_0xf700('0x2'));var express=require(_0xf700('0x3'));var router=express[_0xf700('0x4')]();var auth=require(_0xf700('0x5'));var interaction=require(_0xf700('0x6'));var config=require(_0xf700('0x7'));var controller=require(_0xf700('0x8'));router[_0xf700('0x9')]('/',auth['isAuthenticated'](),controller[_0xf700('0xa')]);router[_0xf700('0x9')](_0xf700('0xb'),auth['isAuthenticated'](),controller[_0xf700('0xc')]);router[_0xf700('0x9')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xf700('0xd')]);router[_0xf700('0x9')](_0xf700('0xe'),auth[_0xf700('0xf')](),controller[_0xf700('0x10')]);router[_0xf700('0x9')](_0xf700('0x11'),auth['isAuthenticated'](),controller[_0xf700('0x12')]);router[_0xf700('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf700('0x13')](_0xf700('0x14'),auth[_0xf700('0xf')](),controller[_0xf700('0x15')]);router[_0xf700('0x13')](_0xf700('0xe'),auth[_0xf700('0xf')](),controller['addAnyCondition']);router[_0xf700('0x13')](_0xf700('0x11'),auth['isAuthenticated'](),controller['addAction']);router[_0xf700('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf700('0x17')]);router[_0xf700('0x18')](_0xf700('0xb'),auth[_0xf700('0xf')](),controller[_0xf700('0x19')]);module[_0xf700('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 92fce99..f3d63e8 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 _0x62e2=['exports','STRING','BOOLEAN','sequelize'];(function(_0x322a04,_0x24f8cc){var _0x5edd65=function(_0x39ffc8){while(--_0x39ffc8){_0x322a04['push'](_0x322a04['shift']());}};_0x5edd65(++_0x24f8cc);}(_0x62e2,0x16f));var _0x262e=function(_0x1a7947,_0x340330){_0x1a7947=_0x1a7947-0x0;var _0x30e9fb=_0x62e2[_0x1a7947];return _0x30e9fb;};'use strict';var Sequelize=require(_0x262e('0x0'));module[_0x262e('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x262e('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x262e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd6d4=['BOOLEAN','exports','STRING'];(function(_0x1bf614,_0x255851){var _0x5ed15c=function(_0x5051f6){while(--_0x5051f6){_0x1bf614['push'](_0x1bf614['shift']());}};_0x5ed15c(++_0x255851);}(_0xd6d4,0x1c6));var _0x4d6d=function(_0x5261b7,_0x3a4168){_0x5261b7=_0x5261b7-0x0;var _0x243145=_0xd6d4[_0x5261b7];return _0x243145;};'use strict';var Sequelize=require('sequelize');module[_0x4d6d('0x0')]={'name':{'type':Sequelize[_0x4d6d('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4d6d('0x1')]},'status':{'type':Sequelize[_0x4d6d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index cfdcb9b..3e95ed1 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 _0x616c=['desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Triggers','stack','name','send','map','Trigger','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','limit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','order','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x616c,0x1b6));var _0xc616=function(_0x1bf71b,_0x49143a){_0x1bf71b=_0x1bf71b-0x0;var _0xd2e9e1=_0x616c[_0x1bf71b];return _0xd2e9e1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc616('0x0'));var rimraf=require(_0xc616('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc616('0x2'));var rp=require(_0xc616('0x3'));var moment=require(_0xc616('0x4'));var BPromise=require(_0xc616('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc616('0x6'));var sox=require(_0xc616('0x7'));var csv=require(_0xc616('0x8'));var ejs=require(_0xc616('0x9'));var fs=require('fs');var _=require(_0xc616('0xa'));var squel=require(_0xc616('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc616('0xc'));var toCsv=require(_0xc616('0x8'));var querystring=require('querystring');var Papa=require(_0xc616('0xd'));var Redis=require('ioredis');var authService=require(_0xc616('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc616('0xf'));var logger=require(_0xc616('0x10'))(_0xc616('0x11'));var utils=require('../../config/utils');var config=require(_0xc616('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc616('0x13'))['db'];function respondWithStatusCode(_0xb8de2a,_0x1fb7a1){_0x1fb7a1=_0x1fb7a1||0xcc;return function(_0x633d6a){if(_0x633d6a){return _0xb8de2a[_0xc616('0x14')](_0x1fb7a1);}return _0xb8de2a['status'](_0x1fb7a1)[_0xc616('0x15')]();};}function respondWithResult(_0x5e1993,_0x17e829){_0x17e829=_0x17e829||0xc8;return function(_0x3958e9){if(_0x3958e9){return _0x5e1993[_0xc616('0x16')](_0x17e829)[_0xc616('0x17')](_0x3958e9);}};}function respondWithFilteredResult(_0x3c0307,_0x5a5393){return function(_0xa07335){if(_0xa07335){var _0x1738ff=_0xa07335[_0xc616('0x18')],_0x3ace46=_0x5a5393['offset'],_0x739a74=_0x5a5393[_0xc616('0x19')]+_0x5a5393['limit'],_0x180482;if(_0x739a74>=_0x1738ff){_0x739a74=_0x1738ff;_0x180482=0xc8;}else{_0x180482=0xce;}_0x3c0307[_0xc616('0x16')](_0x180482);return _0x3c0307[_0xc616('0x1a')](_0xc616('0x1b'),_0x3ace46+'-'+_0x739a74+'/'+_0x1738ff)[_0xc616('0x17')](_0xa07335);}return null;};}function patchUpdates(_0x51c773){return function(_0xadc71a){try{jsonpatch['apply'](_0xadc71a,_0x51c773,!![]);}catch(_0x4a237f){return BPromise[_0xc616('0x1c')](_0x4a237f);}return _0xadc71a[_0xc616('0x1d')]();};}function saveUpdates(_0x4756e4,_0xf51b1c){return function(_0x3e6053){if(_0x3e6053){return _0x3e6053[_0xc616('0x1e')](_0x4756e4)[_0xc616('0x1f')](function(_0x35a024){return _0x35a024;});}return null;};}function removeEntity(_0x1ae9da,_0x461e40){return function(_0x47ccd6){if(_0x47ccd6){return _0x47ccd6[_0xc616('0x20')]()['then'](function(){var _0x3322f3=_0x47ccd6[_0xc616('0x21')]({'plain':!![]});var _0x1828f3=_0xc616('0x22');return db['UserProfileResource'][_0xc616('0x20')]({'where':{'type':_0x1828f3,'resourceId':_0x3322f3['id']}})[_0xc616('0x1f')](function(){return _0x47ccd6;});})[_0xc616('0x1f')](function(){_0x1ae9da[_0xc616('0x16')](0xcc)[_0xc616('0x15')]();});}};}function handleEntityNotFound(_0x4c15ee,_0x28f9b1){return function(_0x4e5979){if(!_0x4e5979){_0x4c15ee[_0xc616('0x14')](0x194);}return _0x4e5979;};}function handleError(_0x5d10ff,_0x246a98){_0x246a98=_0x246a98||0x1f4;return function(_0x44c71a){logger['error'](_0x44c71a[_0xc616('0x23')]);if(_0x44c71a[_0xc616('0x24')]){delete _0x44c71a[_0xc616('0x24')];}_0x5d10ff['status'](_0x246a98)[_0xc616('0x25')](_0x44c71a);};}exports['index']=function(_0xb1e98a,_0x2935e6){var _0x25cecd={},_0x2bc0a0={},_0x43786e={'count':0x0,'rows':[]};var _0xa47ae4=_[_0xc616('0x26')](db[_0xc616('0x27')][_0xc616('0x28')],function(_0x58686c){return{'name':_0x58686c[_0xc616('0x29')],'type':_0x58686c[_0xc616('0x2a')]['key']};});_0x2bc0a0[_0xc616('0x2b')]=_[_0xc616('0x26')](_0xa47ae4,_0xc616('0x24'));_0x2bc0a0[_0xc616('0x2c')]=_['keys'](_0xb1e98a[_0xc616('0x2c')]);_0x2bc0a0['filters']=_['intersection'](_0x2bc0a0['model'],_0x2bc0a0['query']);_0x25cecd[_0xc616('0x2d')]=_[_0xc616('0x2e')](_0x2bc0a0[_0xc616('0x2b')],qs[_0xc616('0x2f')](_0xb1e98a[_0xc616('0x2c')][_0xc616('0x2f')]));_0x25cecd[_0xc616('0x2d')]=_0x25cecd[_0xc616('0x2d')][_0xc616('0x30')]?_0x25cecd[_0xc616('0x2d')]:_0x2bc0a0[_0xc616('0x2b')];if(!_0xb1e98a[_0xc616('0x2c')][_0xc616('0x31')]('nolimit')){_0x25cecd['limit']=qs[_0xc616('0x32')](_0xb1e98a[_0xc616('0x2c')]['limit']);_0x25cecd['offset']=qs[_0xc616('0x19')](_0xb1e98a['query']['offset']);}_0x25cecd['order']=qs[_0xc616('0x33')](_0xb1e98a[_0xc616('0x2c')]['sort']);_0x25cecd['where']=qs[_0xc616('0x34')](_[_0xc616('0x35')](_0xb1e98a[_0xc616('0x2c')],_0x2bc0a0[_0xc616('0x34')]),_0xa47ae4);if(_0xb1e98a['query'][_0xc616('0x36')]){_0x25cecd[_0xc616('0x37')]=_['merge'](_0x25cecd[_0xc616('0x37')],{'$or':_[_0xc616('0x26')](_0xa47ae4,function(_0x3e4bc3){if(_0x3e4bc3['type']!==_0xc616('0x38')){var _0x352af0={};_0x352af0[_0x3e4bc3[_0xc616('0x24')]]={'$like':'%'+_0xb1e98a[_0xc616('0x2c')][_0xc616('0x36')]+'%'};return _0x352af0;}})});}_0x25cecd=_[_0xc616('0x39')]({},_0x25cecd,_0xb1e98a[_0xc616('0x3a')]);var _0x44f0e4={'where':_0x25cecd[_0xc616('0x37')]};return db[_0xc616('0x27')][_0xc616('0x18')](_0x44f0e4)[_0xc616('0x1f')](function(_0x27db2e){_0x43786e[_0xc616('0x18')]=_0x27db2e;if(_0xb1e98a[_0xc616('0x2c')][_0xc616('0x3b')]){_0x25cecd['include']=[{'all':!![]}];}return db['Trigger'][_0xc616('0x3c')](_0x25cecd);})[_0xc616('0x1f')](function(_0x10235e){_0x43786e[_0xc616('0x3d')]=_0x10235e;return _0x43786e;})[_0xc616('0x1f')](respondWithFilteredResult(_0x2935e6,_0x25cecd))[_0xc616('0x3e')](handleError(_0x2935e6,null));};exports[_0xc616('0x3f')]=function(_0x11edc6,_0x39c59f){var _0xd132a9={'raw':![],'where':{'id':_0x11edc6['params']['id']}},_0xa034a9={};_0xa034a9[_0xc616('0x2b')]=_[_0xc616('0x40')](db['Trigger'][_0xc616('0x28')]);_0xa034a9[_0xc616('0x2c')]=_[_0xc616('0x40')](_0x11edc6[_0xc616('0x2c')]);_0xa034a9[_0xc616('0x34')]=_[_0xc616('0x2e')](_0xa034a9['model'],_0xa034a9['query']);_0xd132a9[_0xc616('0x2d')]=_[_0xc616('0x2e')](_0xa034a9[_0xc616('0x2b')],qs['fields'](_0x11edc6[_0xc616('0x2c')][_0xc616('0x2f')]));_0xd132a9['attributes']=_0xd132a9['attributes'][_0xc616('0x30')]?_0xd132a9[_0xc616('0x2d')]:_0xa034a9[_0xc616('0x2b')];if(_0x11edc6['query'][_0xc616('0x3b')]){_0xd132a9[_0xc616('0x41')]=[{'all':!![]}];}_0xd132a9=_[_0xc616('0x39')]({},_0xd132a9,_0x11edc6['options']);return db['Trigger']['find'](_0xd132a9)['then'](handleEntityNotFound(_0x39c59f,null))[_0xc616('0x1f')](respondWithResult(_0x39c59f,null))[_0xc616('0x3e')](handleError(_0x39c59f,null));};exports[_0xc616('0x42')]=function(_0x54fff1,_0x2479a5){return db['Trigger']['create'](_0x54fff1[_0xc616('0x43')],{})[_0xc616('0x1f')](function(_0x501d2a){var _0x7bd030=_0x54fff1[_0xc616('0x44')][_0xc616('0x21')]({'plain':!![]});if(!_0x7bd030)throw new Error(_0xc616('0x45'));if(_0x7bd030[_0xc616('0x46')]==='user'){var _0x2fd069=_0x501d2a[_0xc616('0x21')]({'plain':!![]});var _0x14ea76=_0xc616('0x22');return db['UserProfileSection'][_0xc616('0x47')]({'where':{'name':_0x14ea76,'userProfileId':_0x7bd030[_0xc616('0x48')]},'raw':!![]})[_0xc616('0x1f')](function(_0x41e9e9){if(_0x41e9e9&&_0x41e9e9['autoAssociation']===0x0){return db[_0xc616('0x49')][_0xc616('0x42')]({'name':_0x2fd069[_0xc616('0x24')],'resourceId':_0x2fd069['id'],'type':_0x41e9e9[_0xc616('0x24')],'sectionId':_0x41e9e9['id']},{})[_0xc616('0x1f')](function(){return _0x501d2a;});}else{return _0x501d2a;}})[_0xc616('0x3e')](function(_0x23ef4b){logger[_0xc616('0x4a')](_0xc616('0x4b'),_0x23ef4b);throw _0x23ef4b;});}return _0x501d2a;})['then'](respondWithResult(_0x2479a5,0xc9))['catch'](handleError(_0x2479a5,null));};exports[_0xc616('0x1e')]=function(_0x5512d8,_0x927554){if(_0x5512d8[_0xc616('0x43')]['id']){delete _0x5512d8[_0xc616('0x43')]['id'];}return db[_0xc616('0x27')][_0xc616('0x47')]({'where':{'id':_0x5512d8['params']['id']}})[_0xc616('0x1f')](handleEntityNotFound(_0x927554,null))['then'](saveUpdates(_0x5512d8[_0xc616('0x43')],null))[_0xc616('0x1f')](respondWithResult(_0x927554,null))[_0xc616('0x3e')](handleError(_0x927554,null));};exports[_0xc616('0x20')]=function(_0x3e49a5,_0x299121){return db[_0xc616('0x27')]['find']({'where':{'id':_0x3e49a5[_0xc616('0x4c')]['id']}})[_0xc616('0x1f')](handleEntityNotFound(_0x299121,null))['then'](removeEntity(_0x299121,null))[_0xc616('0x3e')](handleError(_0x299121,null));};exports[_0xc616('0x4d')]=function(_0x4afe53,_0x51ccb2,_0x4cda49){if(_0x4afe53[_0xc616('0x43')]['id']){delete _0x4afe53[_0xc616('0x43')]['id'];}return db[_0xc616('0x27')][_0xc616('0x47')]({'where':{'id':_0x4afe53[_0xc616('0x4c')]['id']}})[_0xc616('0x1f')](handleEntityNotFound(_0x51ccb2,null))['then'](function(_0x4a6afc){if(_0x4a6afc){_0x4afe53[_0xc616('0x43')]['TriggerAllId']=_0x4a6afc['id'];return db[_0xc616('0x4e')][_0xc616('0x42')](_0x4afe53['body']);}})['then'](respondWithResult(_0x51ccb2,null))[_0xc616('0x3e')](handleError(_0x51ccb2,null));};exports[_0xc616('0x4f')]=function(_0x154369,_0x5ac2b7,_0x59b3e9){if(_0x154369['body']['id']){delete _0x154369[_0xc616('0x43')]['id'];}return db[_0xc616('0x27')][_0xc616('0x47')]({'where':{'id':_0x154369[_0xc616('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ac2b7,null))[_0xc616('0x1f')](function(_0x4d130c){if(_0x4d130c){_0x154369['body'][_0xc616('0x50')]=_0x4d130c['id'];return db[_0xc616('0x4e')][_0xc616('0x42')](_0x154369[_0xc616('0x43')]);}})[_0xc616('0x1f')](respondWithResult(_0x5ac2b7,null))[_0xc616('0x3e')](handleError(_0x5ac2b7,null));};exports[_0xc616('0x51')]=function(_0x48a206,_0x297b66,_0xd06aca){var _0x3d37be={};var _0x41f277={};var _0x4b6cbd;var _0x1c8520;return db[_0xc616('0x27')]['findOne']({'where':{'id':_0x48a206[_0xc616('0x4c')]['id']}})[_0xc616('0x1f')](handleEntityNotFound(_0x297b66,null))[_0xc616('0x1f')](function(_0x1338c5){if(_0x1338c5){_0x4b6cbd=_0x1338c5;_0x41f277[_0xc616('0x2b')]=_[_0xc616('0x40')](db['Condition'][_0xc616('0x28')]);_0x41f277['query']=_[_0xc616('0x40')](_0x48a206[_0xc616('0x2c')]);_0x41f277[_0xc616('0x34')]=_[_0xc616('0x2e')](_0x41f277[_0xc616('0x2b')],_0x41f277[_0xc616('0x2c')]);_0x3d37be['attributes']=_['intersection'](_0x41f277[_0xc616('0x2b')],qs[_0xc616('0x2f')](_0x48a206[_0xc616('0x2c')]['fields']));_0x3d37be[_0xc616('0x2d')]=_0x3d37be[_0xc616('0x2d')][_0xc616('0x30')]?_0x3d37be[_0xc616('0x2d')]:_0x41f277[_0xc616('0x2b')];_0x3d37be[_0xc616('0x52')]=qs[_0xc616('0x33')](_0x48a206['query'][_0xc616('0x33')]);_0x3d37be[_0xc616('0x37')]=qs[_0xc616('0x34')](_[_0xc616('0x35')](_0x48a206[_0xc616('0x2c')],_0x41f277['filters']));if(_0x48a206[_0xc616('0x2c')][_0xc616('0x36')]){_0x3d37be[_0xc616('0x37')]=_[_0xc616('0x39')](_0x3d37be[_0xc616('0x37')],{'$or':_[_0xc616('0x26')](_0x3d37be['attributes'],function(_0x62c3e8){var _0x392270={};_0x392270[_0x62c3e8]={'$like':'%'+_0x48a206[_0xc616('0x2c')][_0xc616('0x36')]+'%'};return _0x392270;})});}_0x3d37be=_['merge']({},_0x3d37be,_0x48a206['options']);return _0x4b6cbd[_0xc616('0x51')](_0x3d37be);}})[_0xc616('0x1f')](function(_0x4b91d8){if(_0x4b91d8){_0x1c8520=_0x4b91d8[_0xc616('0x30')];if(!_0x48a206[_0xc616('0x2c')]['hasOwnProperty'](_0xc616('0x53'))){_0x3d37be[_0xc616('0x32')]=qs['limit'](_0x48a206[_0xc616('0x2c')][_0xc616('0x32')]);_0x3d37be[_0xc616('0x19')]=qs[_0xc616('0x19')](_0x48a206[_0xc616('0x2c')][_0xc616('0x19')]);}return _0x4b6cbd['getAllConditions'](_0x3d37be);}})[_0xc616('0x1f')](function(_0x229403){if(_0x229403){return _0x229403?{'count':_0x1c8520,'rows':_0x229403}:null;}})[_0xc616('0x1f')](respondWithResult(_0x297b66,null))[_0xc616('0x3e')](handleError(_0x297b66,null));};exports[_0xc616('0x54')]=function(_0x4106d2,_0x5c7654,_0x4588ac){var _0x4ebd12={};var _0x446a87={};var _0x1df988;var _0x2fe49b;return db['Trigger']['findOne']({'where':{'id':_0x4106d2['params']['id']}})['then'](handleEntityNotFound(_0x5c7654,null))[_0xc616('0x1f')](function(_0x516b01){if(_0x516b01){_0x1df988=_0x516b01;_0x446a87[_0xc616('0x2b')]=_[_0xc616('0x40')](db[_0xc616('0x4e')][_0xc616('0x28')]);_0x446a87[_0xc616('0x2c')]=_[_0xc616('0x40')](_0x4106d2[_0xc616('0x2c')]);_0x446a87['filters']=_['intersection'](_0x446a87[_0xc616('0x2b')],_0x446a87[_0xc616('0x2c')]);_0x4ebd12['attributes']=_[_0xc616('0x2e')](_0x446a87['model'],qs[_0xc616('0x2f')](_0x4106d2['query']['fields']));_0x4ebd12[_0xc616('0x2d')]=_0x4ebd12[_0xc616('0x2d')]['length']?_0x4ebd12['attributes']:_0x446a87[_0xc616('0x2b')];_0x4ebd12[_0xc616('0x52')]=qs['sort'](_0x4106d2[_0xc616('0x2c')]['sort']);_0x4ebd12[_0xc616('0x37')]=qs[_0xc616('0x34')](_[_0xc616('0x35')](_0x4106d2[_0xc616('0x2c')],_0x446a87[_0xc616('0x34')]));if(_0x4106d2[_0xc616('0x2c')][_0xc616('0x36')]){_0x4ebd12[_0xc616('0x37')]=_[_0xc616('0x39')](_0x4ebd12[_0xc616('0x37')],{'$or':_[_0xc616('0x26')](_0x4ebd12['attributes'],function(_0x3628e0){var _0x3bca2a={};_0x3bca2a[_0x3628e0]={'$like':'%'+_0x4106d2['query'][_0xc616('0x36')]+'%'};return _0x3bca2a;})});}_0x4ebd12=_[_0xc616('0x39')]({},_0x4ebd12,_0x4106d2['options']);return _0x1df988[_0xc616('0x54')](_0x4ebd12);}})[_0xc616('0x1f')](function(_0x4c322a){if(_0x4c322a){_0x2fe49b=_0x4c322a[_0xc616('0x30')];if(!_0x4106d2['query'][_0xc616('0x31')]('nolimit')){_0x4ebd12['limit']=qs[_0xc616('0x32')](_0x4106d2['query']['limit']);_0x4ebd12[_0xc616('0x19')]=qs[_0xc616('0x19')](_0x4106d2[_0xc616('0x2c')][_0xc616('0x19')]);}return _0x1df988['getAnyConditions'](_0x4ebd12);}})['then'](function(_0x3527f2){if(_0x3527f2){return _0x3527f2?{'count':_0x2fe49b,'rows':_0x3527f2}:null;}})['then'](respondWithResult(_0x5c7654,null))[_0xc616('0x3e')](handleError(_0x5c7654,null));};exports[_0xc616('0x55')]=function(_0x4a7e3a,_0x21e43e,_0x2db2ea){if(_0x4a7e3a[_0xc616('0x43')]['id']){delete _0x4a7e3a[_0xc616('0x43')]['id'];}return db[_0xc616('0x27')][_0xc616('0x47')]({'where':{'id':_0x4a7e3a[_0xc616('0x4c')]['id']}})[_0xc616('0x1f')](handleEntityNotFound(_0x21e43e,null))['then'](function(_0x23cdb6){if(_0x23cdb6){_0x4a7e3a[_0xc616('0x43')][_0xc616('0x56')]=_0x23cdb6['id'];return db[_0xc616('0x57')]['create'](_0x4a7e3a[_0xc616('0x43')]);}})[_0xc616('0x1f')](respondWithResult(_0x21e43e,null))[_0xc616('0x3e')](handleError(_0x21e43e,null));};exports[_0xc616('0x58')]=function(_0x2dd05a,_0x5bbc1e,_0x3199c1){var _0x439044={};var _0x2d4283={};var _0x3ae30e;var _0x4ecd5d;return db['Trigger'][_0xc616('0x59')]({'where':{'id':_0x2dd05a[_0xc616('0x4c')]['id']}})[_0xc616('0x1f')](handleEntityNotFound(_0x5bbc1e,null))[_0xc616('0x1f')](function(_0xb030df){if(_0xb030df){_0x3ae30e=_0xb030df;_0x2d4283[_0xc616('0x2b')]=_[_0xc616('0x40')](db[_0xc616('0x57')]['rawAttributes']);_0x2d4283[_0xc616('0x2c')]=_[_0xc616('0x40')](_0x2dd05a['query']);_0x2d4283[_0xc616('0x34')]=_[_0xc616('0x2e')](_0x2d4283[_0xc616('0x2b')],_0x2d4283[_0xc616('0x2c')]);_0x439044[_0xc616('0x2d')]=_[_0xc616('0x2e')](_0x2d4283[_0xc616('0x2b')],qs[_0xc616('0x2f')](_0x2dd05a[_0xc616('0x2c')][_0xc616('0x2f')]));_0x439044[_0xc616('0x2d')]=_0x439044['attributes']['length']?_0x439044[_0xc616('0x2d')]:_0x2d4283[_0xc616('0x2b')];_0x439044[_0xc616('0x52')]=qs[_0xc616('0x33')](_0x2dd05a[_0xc616('0x2c')]['sort']);_0x439044['where']=qs[_0xc616('0x34')](_[_0xc616('0x35')](_0x2dd05a[_0xc616('0x2c')],_0x2d4283[_0xc616('0x34')]));if(_0x2dd05a['query'][_0xc616('0x36')]){_0x439044[_0xc616('0x37')]=_[_0xc616('0x39')](_0x439044[_0xc616('0x37')],{'$or':_[_0xc616('0x26')](_0x439044[_0xc616('0x2d')],function(_0x535c44){var _0x3a2258={};_0x3a2258[_0x535c44]={'$like':'%'+_0x2dd05a['query'][_0xc616('0x36')]+'%'};return _0x3a2258;})});}_0x439044=_[_0xc616('0x39')]({},_0x439044,_0x2dd05a['options']);return _0x3ae30e[_0xc616('0x58')](_0x439044);}})[_0xc616('0x1f')](function(_0x198486){if(_0x198486){_0x4ecd5d=_0x198486[_0xc616('0x30')];if(!_0x2dd05a['query'][_0xc616('0x31')](_0xc616('0x53'))){_0x439044['limit']=qs[_0xc616('0x32')](_0x2dd05a['query'][_0xc616('0x32')]);_0x439044['offset']=qs[_0xc616('0x19')](_0x2dd05a[_0xc616('0x2c')][_0xc616('0x19')]);}return _0x3ae30e[_0xc616('0x58')](_0x439044);}})[_0xc616('0x1f')](function(_0x5be938){if(_0x5be938){return _0x5be938?{'count':_0x4ecd5d,'rows':_0x5be938}:null;}})[_0xc616('0x1f')](respondWithResult(_0x5bbc1e,null))['catch'](handleError(_0x5bbc1e,null));}; \ No newline at end of file +var _0x36bb=['filter','where','merge','VIRTUAL','Trigger','includeAll','include','findAll','rows','catch','intersection','options','create','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','addAllCondition','TriggerAllId','Condition','getAllConditions','findOne','length','getAnyConditions','addAction','TriggerId','Action','getActions','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','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick'];(function(_0x2f9fff,_0x234894){var _0x259aa8=function(_0x3dcd61){while(--_0x3dcd61){_0x2f9fff['push'](_0x2f9fff['shift']());}};_0x259aa8(++_0x234894);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb36b('0x0'));var emlformat=require(_0xb36b('0x1'));var rimraf=require(_0xb36b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb36b('0x3'));var rp=require(_0xb36b('0x4'));var moment=require(_0xb36b('0x5'));var BPromise=require(_0xb36b('0x6'));var Mustache=require(_0xb36b('0x7'));var util=require(_0xb36b('0x8'));var path=require(_0xb36b('0x9'));var sox=require(_0xb36b('0xa'));var csv=require(_0xb36b('0xb'));var ejs=require(_0xb36b('0xc'));var fs=require('fs');var _=require(_0xb36b('0xd'));var squel=require(_0xb36b('0xe'));var crypto=require(_0xb36b('0xf'));var jsforce=require(_0xb36b('0x10'));var deskjs=require(_0xb36b('0x11'));var toCsv=require(_0xb36b('0xb'));var querystring=require(_0xb36b('0x12'));var Papa=require(_0xb36b('0x13'));var Redis=require(_0xb36b('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xb36b('0x15'));var as=require(_0xb36b('0x16'));var hardwareService=require(_0xb36b('0x17'));var logger=require('../../config/logger')(_0xb36b('0x18'));var utils=require(_0xb36b('0x19'));var config=require(_0xb36b('0x1a'));var licenseUtil=require(_0xb36b('0x1b'));var db=require(_0xb36b('0x1c'))['db'];function respondWithStatusCode(_0x11f775,_0x1ad623){_0x1ad623=_0x1ad623||0xcc;return function(_0x1c266a){if(_0x1c266a){return _0x11f775[_0xb36b('0x1d')](_0x1ad623);}return _0x11f775[_0xb36b('0x1e')](_0x1ad623)[_0xb36b('0x1f')]();};}function respondWithResult(_0x59af21,_0x1aef0b){_0x1aef0b=_0x1aef0b||0xc8;return function(_0x4c2c46){if(_0x4c2c46){return _0x59af21['status'](_0x1aef0b)[_0xb36b('0x20')](_0x4c2c46);}};}function respondWithFilteredResult(_0x329f60,_0x23e960){return function(_0x4b74f1){if(_0x4b74f1){var _0x5c7255=_0x4b74f1[_0xb36b('0x21')],_0x2b6dca=_0x23e960[_0xb36b('0x22')],_0x5ad8c8=_0x23e960[_0xb36b('0x22')]+_0x23e960['limit'],_0x12f119;if(_0x5ad8c8>=_0x5c7255){_0x5ad8c8=_0x5c7255;_0x12f119=0xc8;}else{_0x12f119=0xce;}_0x329f60[_0xb36b('0x1e')](_0x12f119);return _0x329f60[_0xb36b('0x23')](_0xb36b('0x24'),_0x2b6dca+'-'+_0x5ad8c8+'/'+_0x5c7255)['json'](_0x4b74f1);}return null;};}function patchUpdates(_0x42df8c){return function(_0x572d88){try{jsonpatch[_0xb36b('0x25')](_0x572d88,_0x42df8c,!![]);}catch(_0xac85bd){return BPromise[_0xb36b('0x26')](_0xac85bd);}return _0x572d88[_0xb36b('0x27')]();};}function saveUpdates(_0x4049fa,_0x5f6648){return function(_0x207d7f){if(_0x207d7f){return _0x207d7f['update'](_0x4049fa)[_0xb36b('0x28')](function(_0x530ecc){return _0x530ecc;});}return null;};}function removeEntity(_0x218995,_0x52b74f){return function(_0x3b8030){if(_0x3b8030){return _0x3b8030[_0xb36b('0x29')]()[_0xb36b('0x28')](function(){var _0x174795=_0x3b8030[_0xb36b('0x2a')]({'plain':!![]});var _0x5f4a25=_0xb36b('0x2b');return db[_0xb36b('0x2c')][_0xb36b('0x29')]({'where':{'type':_0x5f4a25,'resourceId':_0x174795['id']}})['then'](function(){return _0x3b8030;});})[_0xb36b('0x28')](function(){_0x218995['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50e8e4,_0x9a9cd8){return function(_0x1d904e){if(!_0x1d904e){_0x50e8e4[_0xb36b('0x1d')](0x194);}return _0x1d904e;};}function handleError(_0x5c4aee,_0x455d35){_0x455d35=_0x455d35||0x1f4;return function(_0x46dfc){logger[_0xb36b('0x2d')](_0x46dfc[_0xb36b('0x2e')]);if(_0x46dfc['name']){delete _0x46dfc['name'];}_0x5c4aee[_0xb36b('0x1e')](_0x455d35)[_0xb36b('0x2f')](_0x46dfc);};}exports[_0xb36b('0x30')]=function(_0x138f74,_0x4aabf5){var _0x492a96={},_0x14d3f1={},_0x4daf37={'count':0x0,'rows':[]};var _0x3e376f=_[_0xb36b('0x31')](db['Trigger'][_0xb36b('0x32')],function(_0x24f8bc){return{'name':_0x24f8bc[_0xb36b('0x33')],'type':_0x24f8bc[_0xb36b('0x34')][_0xb36b('0x35')]};});_0x14d3f1[_0xb36b('0x36')]=_[_0xb36b('0x31')](_0x3e376f,_0xb36b('0x37'));_0x14d3f1[_0xb36b('0x38')]=_[_0xb36b('0x39')](_0x138f74[_0xb36b('0x38')]);_0x14d3f1[_0xb36b('0x3a')]=_['intersection'](_0x14d3f1['model'],_0x14d3f1[_0xb36b('0x38')]);_0x492a96[_0xb36b('0x3b')]=_['intersection'](_0x14d3f1[_0xb36b('0x36')],qs['fields'](_0x138f74['query'][_0xb36b('0x3c')]));_0x492a96[_0xb36b('0x3b')]=_0x492a96[_0xb36b('0x3b')]['length']?_0x492a96['attributes']:_0x14d3f1[_0xb36b('0x36')];if(!_0x138f74[_0xb36b('0x38')][_0xb36b('0x3d')](_0xb36b('0x3e'))){_0x492a96[_0xb36b('0x3f')]=qs[_0xb36b('0x3f')](_0x138f74['query'][_0xb36b('0x3f')]);_0x492a96[_0xb36b('0x22')]=qs[_0xb36b('0x22')](_0x138f74[_0xb36b('0x38')][_0xb36b('0x22')]);}_0x492a96[_0xb36b('0x40')]=qs[_0xb36b('0x41')](_0x138f74[_0xb36b('0x38')][_0xb36b('0x41')]);_0x492a96['where']=qs[_0xb36b('0x3a')](_[_0xb36b('0x42')](_0x138f74[_0xb36b('0x38')],_0x14d3f1['filters']),_0x3e376f);if(_0x138f74[_0xb36b('0x38')][_0xb36b('0x43')]){_0x492a96[_0xb36b('0x44')]=_[_0xb36b('0x45')](_0x492a96['where'],{'$or':_['map'](_0x3e376f,function(_0x101a0c){if(_0x101a0c[_0xb36b('0x34')]!==_0xb36b('0x46')){var _0x15cc46={};_0x15cc46[_0x101a0c[_0xb36b('0x37')]]={'$like':'%'+_0x138f74[_0xb36b('0x38')][_0xb36b('0x43')]+'%'};return _0x15cc46;}})});}_0x492a96=_['merge']({},_0x492a96,_0x138f74['options']);var _0x4a9946={'where':_0x492a96[_0xb36b('0x44')]};return db[_0xb36b('0x47')][_0xb36b('0x21')](_0x4a9946)['then'](function(_0x29f426){_0x4daf37[_0xb36b('0x21')]=_0x29f426;if(_0x138f74[_0xb36b('0x38')][_0xb36b('0x48')]){_0x492a96[_0xb36b('0x49')]=[{'all':!![]}];}return db[_0xb36b('0x47')][_0xb36b('0x4a')](_0x492a96);})[_0xb36b('0x28')](function(_0xd1aaae){_0x4daf37[_0xb36b('0x4b')]=_0xd1aaae;return _0x4daf37;})['then'](respondWithFilteredResult(_0x4aabf5,_0x492a96))[_0xb36b('0x4c')](handleError(_0x4aabf5,null));};exports['show']=function(_0x4dd8e2,_0x107c41){var _0x1b70a4={'raw':![],'where':{'id':_0x4dd8e2['params']['id']}},_0x4e65f2={};_0x4e65f2[_0xb36b('0x36')]=_['keys'](db[_0xb36b('0x47')][_0xb36b('0x32')]);_0x4e65f2[_0xb36b('0x38')]=_[_0xb36b('0x39')](_0x4dd8e2[_0xb36b('0x38')]);_0x4e65f2['filters']=_[_0xb36b('0x4d')](_0x4e65f2[_0xb36b('0x36')],_0x4e65f2['query']);_0x1b70a4['attributes']=_['intersection'](_0x4e65f2[_0xb36b('0x36')],qs[_0xb36b('0x3c')](_0x4dd8e2[_0xb36b('0x38')][_0xb36b('0x3c')]));_0x1b70a4[_0xb36b('0x3b')]=_0x1b70a4['attributes']['length']?_0x1b70a4[_0xb36b('0x3b')]:_0x4e65f2['model'];if(_0x4dd8e2[_0xb36b('0x38')][_0xb36b('0x48')]){_0x1b70a4[_0xb36b('0x49')]=[{'all':!![]}];}_0x1b70a4=_[_0xb36b('0x45')]({},_0x1b70a4,_0x4dd8e2[_0xb36b('0x4e')]);return db[_0xb36b('0x47')]['find'](_0x1b70a4)[_0xb36b('0x28')](handleEntityNotFound(_0x107c41,null))[_0xb36b('0x28')](respondWithResult(_0x107c41,null))[_0xb36b('0x4c')](handleError(_0x107c41,null));};exports[_0xb36b('0x4f')]=function(_0x463328,_0x45d226){return db[_0xb36b('0x47')][_0xb36b('0x4f')](_0x463328['body'],{})[_0xb36b('0x28')](function(_0x453516){var _0x433257=_0x463328[_0xb36b('0x50')]['get']({'plain':!![]});if(!_0x433257)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x433257['role']===_0xb36b('0x50')){var _0xdc9a68=_0x453516[_0xb36b('0x2a')]({'plain':!![]});var _0x42b380=_0xb36b('0x2b');return db['UserProfileSection'][_0xb36b('0x51')]({'where':{'name':_0x42b380,'userProfileId':_0x433257[_0xb36b('0x52')]},'raw':!![]})[_0xb36b('0x28')](function(_0x46d2f8){if(_0x46d2f8&&_0x46d2f8[_0xb36b('0x53')]===0x0){return db['UserProfileResource'][_0xb36b('0x4f')]({'name':_0xdc9a68[_0xb36b('0x37')],'resourceId':_0xdc9a68['id'],'type':_0x46d2f8[_0xb36b('0x37')],'sectionId':_0x46d2f8['id']},{})[_0xb36b('0x28')](function(){return _0x453516;});}else{return _0x453516;}})[_0xb36b('0x4c')](function(_0x4a1c70){logger['error'](_0xb36b('0x54'),_0x4a1c70);throw _0x4a1c70;});}return _0x453516;})[_0xb36b('0x28')](respondWithResult(_0x45d226,0xc9))[_0xb36b('0x4c')](handleError(_0x45d226,null));};exports[_0xb36b('0x55')]=function(_0x19c765,_0x371bf3){if(_0x19c765[_0xb36b('0x56')]['id']){delete _0x19c765[_0xb36b('0x56')]['id'];}return db[_0xb36b('0x47')][_0xb36b('0x51')]({'where':{'id':_0x19c765[_0xb36b('0x57')]['id']}})['then'](handleEntityNotFound(_0x371bf3,null))[_0xb36b('0x28')](saveUpdates(_0x19c765[_0xb36b('0x56')],null))[_0xb36b('0x28')](respondWithResult(_0x371bf3,null))[_0xb36b('0x4c')](handleError(_0x371bf3,null));};exports[_0xb36b('0x29')]=function(_0x4026f9,_0x2d25ad){return db[_0xb36b('0x47')][_0xb36b('0x51')]({'where':{'id':_0x4026f9[_0xb36b('0x57')]['id']}})[_0xb36b('0x28')](handleEntityNotFound(_0x2d25ad,null))['then'](removeEntity(_0x2d25ad,null))[_0xb36b('0x4c')](handleError(_0x2d25ad,null));};exports[_0xb36b('0x58')]=function(_0x427860,_0x2267d6,_0x2ce68f){if(_0x427860[_0xb36b('0x56')]['id']){delete _0x427860['body']['id'];}return db[_0xb36b('0x47')][_0xb36b('0x51')]({'where':{'id':_0x427860[_0xb36b('0x57')]['id']}})[_0xb36b('0x28')](handleEntityNotFound(_0x2267d6,null))['then'](function(_0xf777c6){if(_0xf777c6){_0x427860[_0xb36b('0x56')][_0xb36b('0x59')]=_0xf777c6['id'];return db[_0xb36b('0x5a')][_0xb36b('0x4f')](_0x427860[_0xb36b('0x56')]);}})['then'](respondWithResult(_0x2267d6,null))['catch'](handleError(_0x2267d6,null));};exports['addAnyCondition']=function(_0x43204f,_0x2d01bf,_0x889c8d){if(_0x43204f['body']['id']){delete _0x43204f[_0xb36b('0x56')]['id'];}return db[_0xb36b('0x47')][_0xb36b('0x51')]({'where':{'id':_0x43204f[_0xb36b('0x57')]['id']}})[_0xb36b('0x28')](handleEntityNotFound(_0x2d01bf,null))[_0xb36b('0x28')](function(_0x5280ff){if(_0x5280ff){_0x43204f[_0xb36b('0x56')]['TriggerAnyId']=_0x5280ff['id'];return db['Condition'][_0xb36b('0x4f')](_0x43204f[_0xb36b('0x56')]);}})[_0xb36b('0x28')](respondWithResult(_0x2d01bf,null))['catch'](handleError(_0x2d01bf,null));};exports[_0xb36b('0x5b')]=function(_0x4e599f,_0x57f994,_0x4db0df){var _0x22dc63={};var _0x31c6b5={};var _0xf196c4;var _0x220d95;return db[_0xb36b('0x47')][_0xb36b('0x5c')]({'where':{'id':_0x4e599f[_0xb36b('0x57')]['id']}})[_0xb36b('0x28')](handleEntityNotFound(_0x57f994,null))['then'](function(_0x57a680){if(_0x57a680){_0xf196c4=_0x57a680;_0x31c6b5[_0xb36b('0x36')]=_['keys'](db['Condition'][_0xb36b('0x32')]);_0x31c6b5['query']=_[_0xb36b('0x39')](_0x4e599f[_0xb36b('0x38')]);_0x31c6b5[_0xb36b('0x3a')]=_[_0xb36b('0x4d')](_0x31c6b5[_0xb36b('0x36')],_0x31c6b5['query']);_0x22dc63[_0xb36b('0x3b')]=_[_0xb36b('0x4d')](_0x31c6b5[_0xb36b('0x36')],qs[_0xb36b('0x3c')](_0x4e599f[_0xb36b('0x38')][_0xb36b('0x3c')]));_0x22dc63['attributes']=_0x22dc63[_0xb36b('0x3b')]['length']?_0x22dc63[_0xb36b('0x3b')]:_0x31c6b5['model'];_0x22dc63[_0xb36b('0x40')]=qs[_0xb36b('0x41')](_0x4e599f[_0xb36b('0x38')][_0xb36b('0x41')]);_0x22dc63[_0xb36b('0x44')]=qs['filters'](_[_0xb36b('0x42')](_0x4e599f[_0xb36b('0x38')],_0x31c6b5['filters']));if(_0x4e599f[_0xb36b('0x38')]['filter']){_0x22dc63[_0xb36b('0x44')]=_[_0xb36b('0x45')](_0x22dc63[_0xb36b('0x44')],{'$or':_[_0xb36b('0x31')](_0x22dc63[_0xb36b('0x3b')],function(_0x294324){var _0x221860={};_0x221860[_0x294324]={'$like':'%'+_0x4e599f[_0xb36b('0x38')]['filter']+'%'};return _0x221860;})});}_0x22dc63=_[_0xb36b('0x45')]({},_0x22dc63,_0x4e599f[_0xb36b('0x4e')]);return _0xf196c4['getAllConditions'](_0x22dc63);}})['then'](function(_0x2c1817){if(_0x2c1817){_0x220d95=_0x2c1817[_0xb36b('0x5d')];if(!_0x4e599f[_0xb36b('0x38')][_0xb36b('0x3d')]('nolimit')){_0x22dc63[_0xb36b('0x3f')]=qs[_0xb36b('0x3f')](_0x4e599f['query'][_0xb36b('0x3f')]);_0x22dc63[_0xb36b('0x22')]=qs[_0xb36b('0x22')](_0x4e599f[_0xb36b('0x38')][_0xb36b('0x22')]);}return _0xf196c4['getAllConditions'](_0x22dc63);}})[_0xb36b('0x28')](function(_0x9b1c6e){if(_0x9b1c6e){return _0x9b1c6e?{'count':_0x220d95,'rows':_0x9b1c6e}:null;}})[_0xb36b('0x28')](respondWithResult(_0x57f994,null))['catch'](handleError(_0x57f994,null));};exports['getAnyConditions']=function(_0x3aa06b,_0x37391f,_0x126cc2){var _0x25216e={};var _0x199f9e={};var _0x339e44;var _0xac6918;return db[_0xb36b('0x47')][_0xb36b('0x5c')]({'where':{'id':_0x3aa06b['params']['id']}})[_0xb36b('0x28')](handleEntityNotFound(_0x37391f,null))[_0xb36b('0x28')](function(_0x15755e){if(_0x15755e){_0x339e44=_0x15755e;_0x199f9e[_0xb36b('0x36')]=_[_0xb36b('0x39')](db[_0xb36b('0x5a')]['rawAttributes']);_0x199f9e[_0xb36b('0x38')]=_['keys'](_0x3aa06b[_0xb36b('0x38')]);_0x199f9e[_0xb36b('0x3a')]=_[_0xb36b('0x4d')](_0x199f9e[_0xb36b('0x36')],_0x199f9e['query']);_0x25216e[_0xb36b('0x3b')]=_['intersection'](_0x199f9e['model'],qs['fields'](_0x3aa06b[_0xb36b('0x38')][_0xb36b('0x3c')]));_0x25216e[_0xb36b('0x3b')]=_0x25216e[_0xb36b('0x3b')][_0xb36b('0x5d')]?_0x25216e[_0xb36b('0x3b')]:_0x199f9e[_0xb36b('0x36')];_0x25216e['order']=qs['sort'](_0x3aa06b[_0xb36b('0x38')][_0xb36b('0x41')]);_0x25216e[_0xb36b('0x44')]=qs[_0xb36b('0x3a')](_[_0xb36b('0x42')](_0x3aa06b[_0xb36b('0x38')],_0x199f9e['filters']));if(_0x3aa06b[_0xb36b('0x38')]['filter']){_0x25216e[_0xb36b('0x44')]=_[_0xb36b('0x45')](_0x25216e[_0xb36b('0x44')],{'$or':_[_0xb36b('0x31')](_0x25216e[_0xb36b('0x3b')],function(_0x57348f){var _0x25482c={};_0x25482c[_0x57348f]={'$like':'%'+_0x3aa06b[_0xb36b('0x38')]['filter']+'%'};return _0x25482c;})});}_0x25216e=_['merge']({},_0x25216e,_0x3aa06b[_0xb36b('0x4e')]);return _0x339e44['getAnyConditions'](_0x25216e);}})[_0xb36b('0x28')](function(_0x4a4854){if(_0x4a4854){_0xac6918=_0x4a4854[_0xb36b('0x5d')];if(!_0x3aa06b[_0xb36b('0x38')][_0xb36b('0x3d')](_0xb36b('0x3e'))){_0x25216e['limit']=qs[_0xb36b('0x3f')](_0x3aa06b[_0xb36b('0x38')]['limit']);_0x25216e[_0xb36b('0x22')]=qs[_0xb36b('0x22')](_0x3aa06b['query']['offset']);}return _0x339e44[_0xb36b('0x5e')](_0x25216e);}})[_0xb36b('0x28')](function(_0x1df9cf){if(_0x1df9cf){return _0x1df9cf?{'count':_0xac6918,'rows':_0x1df9cf}:null;}})[_0xb36b('0x28')](respondWithResult(_0x37391f,null))[_0xb36b('0x4c')](handleError(_0x37391f,null));};exports[_0xb36b('0x5f')]=function(_0x477cf8,_0x459e21,_0x1db57e){if(_0x477cf8[_0xb36b('0x56')]['id']){delete _0x477cf8['body']['id'];}return db[_0xb36b('0x47')][_0xb36b('0x51')]({'where':{'id':_0x477cf8[_0xb36b('0x57')]['id']}})[_0xb36b('0x28')](handleEntityNotFound(_0x459e21,null))['then'](function(_0x18c7a7){if(_0x18c7a7){_0x477cf8[_0xb36b('0x56')][_0xb36b('0x60')]=_0x18c7a7['id'];return db[_0xb36b('0x61')][_0xb36b('0x4f')](_0x477cf8[_0xb36b('0x56')]);}})[_0xb36b('0x28')](respondWithResult(_0x459e21,null))[_0xb36b('0x4c')](handleError(_0x459e21,null));};exports['getActions']=function(_0x46edcd,_0x3ac795,_0x26e104){var _0x45f725={};var _0x97a6ef={};var _0x5b5d9a;var _0xafdd6b;return db[_0xb36b('0x47')][_0xb36b('0x5c')]({'where':{'id':_0x46edcd[_0xb36b('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ac795,null))[_0xb36b('0x28')](function(_0x2a0f9f){if(_0x2a0f9f){_0x5b5d9a=_0x2a0f9f;_0x97a6ef[_0xb36b('0x36')]=_[_0xb36b('0x39')](db[_0xb36b('0x61')][_0xb36b('0x32')]);_0x97a6ef[_0xb36b('0x38')]=_[_0xb36b('0x39')](_0x46edcd[_0xb36b('0x38')]);_0x97a6ef[_0xb36b('0x3a')]=_[_0xb36b('0x4d')](_0x97a6ef[_0xb36b('0x36')],_0x97a6ef[_0xb36b('0x38')]);_0x45f725[_0xb36b('0x3b')]=_['intersection'](_0x97a6ef[_0xb36b('0x36')],qs[_0xb36b('0x3c')](_0x46edcd[_0xb36b('0x38')][_0xb36b('0x3c')]));_0x45f725[_0xb36b('0x3b')]=_0x45f725['attributes'][_0xb36b('0x5d')]?_0x45f725['attributes']:_0x97a6ef[_0xb36b('0x36')];_0x45f725[_0xb36b('0x40')]=qs[_0xb36b('0x41')](_0x46edcd[_0xb36b('0x38')][_0xb36b('0x41')]);_0x45f725['where']=qs[_0xb36b('0x3a')](_[_0xb36b('0x42')](_0x46edcd['query'],_0x97a6ef[_0xb36b('0x3a')]));if(_0x46edcd[_0xb36b('0x38')][_0xb36b('0x43')]){_0x45f725[_0xb36b('0x44')]=_[_0xb36b('0x45')](_0x45f725[_0xb36b('0x44')],{'$or':_[_0xb36b('0x31')](_0x45f725[_0xb36b('0x3b')],function(_0x13d51a){var _0x2dd036={};_0x2dd036[_0x13d51a]={'$like':'%'+_0x46edcd[_0xb36b('0x38')][_0xb36b('0x43')]+'%'};return _0x2dd036;})});}_0x45f725=_['merge']({},_0x45f725,_0x46edcd['options']);return _0x5b5d9a[_0xb36b('0x62')](_0x45f725);}})['then'](function(_0x28d636){if(_0x28d636){_0xafdd6b=_0x28d636['length'];if(!_0x46edcd[_0xb36b('0x38')][_0xb36b('0x3d')](_0xb36b('0x3e'))){_0x45f725[_0xb36b('0x3f')]=qs[_0xb36b('0x3f')](_0x46edcd[_0xb36b('0x38')][_0xb36b('0x3f')]);_0x45f725[_0xb36b('0x22')]=qs[_0xb36b('0x22')](_0x46edcd[_0xb36b('0x38')][_0xb36b('0x22')]);}return _0x5b5d9a[_0xb36b('0x62')](_0x45f725);}})['then'](function(_0x20d95d){if(_0x20d95d){return _0x20d95d?{'count':_0xafdd6b,'rows':_0x20d95d}:null;}})[_0xb36b('0x28')](respondWithResult(_0x3ac795,null))[_0xb36b('0x4c')](handleError(_0x3ac795,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index a1e107b..99608b1 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 _0xc3b4=['moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util','../../config/logger'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0xc3b4,0x1b9));var _0x4c3b=function(_0xab58e1,_0x5d47ce){_0xab58e1=_0xab58e1-0x0;var _0x295351=_0xc3b4[_0xab58e1];return _0x295351;};'use strict';var _=require(_0x4c3b('0x0'));var util=require(_0x4c3b('0x1'));var logger=require(_0x4c3b('0x2'))('api');var moment=require(_0x4c3b('0x3'));var BPromise=require(_0x4c3b('0x4'));var rp=require(_0x4c3b('0x5'));var fs=require('fs');var path=require(_0x4c3b('0x6'));var rimraf=require('rimraf');var config=require(_0x4c3b('0x7'));var attributes=require(_0x4c3b('0x8'));module[_0x4c3b('0x9')]=function(_0x36f87c,_0x5e0497){return _0x36f87c['define'](_0x4c3b('0xa'),attributes,{'tableName':_0x4c3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9766=['exports','define','Trigger','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x222371,_0x1793ed){var _0x37f8cf=function(_0x10d559){while(--_0x10d559){_0x222371['push'](_0x222371['shift']());}};_0x37f8cf(++_0x1793ed);}(_0x9766,0x10b));var _0x6976=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x9766[_0x3b96cf];return _0x2e315a;};'use strict';var _=require(_0x6976('0x0'));var util=require(_0x6976('0x1'));var logger=require(_0x6976('0x2'))(_0x6976('0x3'));var moment=require(_0x6976('0x4'));var BPromise=require(_0x6976('0x5'));var rp=require(_0x6976('0x6'));var fs=require('fs');var path=require(_0x6976('0x7'));var rimraf=require('rimraf');var config=require(_0x6976('0x8'));var attributes=require('./trigger.attributes');module[_0x6976('0x9')]=function(_0x561f1b,_0x4ca417){return _0x561f1b[_0x6976('0xa')](_0x6976('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 0409cc1..cc8c459 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 _0xb62e=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','options','raw','where','limit','include','model','map','attributes','then','find','ShowTrigger','lodash','util','moment'];(function(_0x14f89e,_0x139fce){var _0x26092d=function(_0x2bdc20){while(--_0x2bdc20){_0x14f89e['push'](_0x14f89e['shift']());}};_0x26092d(++_0x139fce);}(_0xb62e,0x1de));var _0xeb62=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb62e[_0x397e5f];return _0x5302b8;};'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')]('Trigger,\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')]['findAll']({'raw':_0x39b138[_0xeb62('0x1a')]?_0x39b138[_0xeb62('0x1a')][_0xeb62('0x1b')]===undefined?!![]:![]:!![],'where':_0x39b138[_0xeb62('0x1a')]?_0x39b138[_0xeb62('0x1a')][_0xeb62('0x1c')]||null:null,'attributes':_0x39b138[_0xeb62('0x1a')]?_0x39b138['options']['attributes']||null:null,'limit':_0x39b138[_0xeb62('0x1a')]?_0x39b138[_0xeb62('0x1a')][_0xeb62('0x1d')]||null:null,'include':_0x39b138[_0xeb62('0x1a')]?_0x39b138[_0xeb62('0x1a')]['include']?_['map'](_0x39b138[_0xeb62('0x1a')][_0xeb62('0x1e')],function(_0x182781){return{'model':db[_0x182781[_0xeb62('0x1f')]],'as':_0x182781['as'],'attributes':_0x182781['attributes'],'include':_0x182781['include']?_[_0xeb62('0x20')](_0x182781['include'],function(_0x448327){return{'model':db[_0x448327['model']],'as':_0x448327['as'],'attributes':_0x448327[_0xeb62('0x21')],'include':_0x448327['include']?_[_0xeb62('0x20')](_0x448327[_0xeb62('0x1e')],function(_0x46d1bb){return{'model':db[_0x46d1bb['model']],'as':_0x46d1bb['as'],'attributes':_0x46d1bb[_0xeb62('0x21')]};}):[]};}):[]};}):[]:[]})[_0xeb62('0x22')](function(_0x5222f4){logger[_0xeb62('0xd')](_0xeb62('0x18'),_0x39b138);logger[_0xeb62('0x10')]('GetTrigger',_0x39b138,JSON[_0xeb62('0x12')](_0x5222f4));_0x27efc8(_0x5222f4);})[_0xeb62('0x17')](function(_0x57169a){logger[_0xeb62('0x13')](_0xeb62('0x18'),_0x57169a[_0xeb62('0x15')],_0x39b138);_0x11d516(_0x27fd84[_0xeb62('0x13')](0x1f4,_0x57169a[_0xeb62('0x15')]));});});};exports['ShowTrigger']=function(_0x4b58af){var _0x1248bb=this;return new Promise(function(_0x357cf4,_0x1607ef){return db[_0xeb62('0x19')][_0xeb62('0x23')]({'raw':_0x4b58af[_0xeb62('0x1a')]?_0x4b58af[_0xeb62('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4b58af[_0xeb62('0x1a')]?_0x4b58af['options']['where']||null:null,'attributes':_0x4b58af[_0xeb62('0x1a')]?_0x4b58af[_0xeb62('0x1a')]['attributes']||null:null,'include':_0x4b58af[_0xeb62('0x1a')]?_0x4b58af['options'][_0xeb62('0x1e')]?_[_0xeb62('0x20')](_0x4b58af['options'][_0xeb62('0x1e')],function(_0xe2589){return{'model':db[_0xe2589['model']],'as':_0xe2589['as'],'attributes':_0xe2589[_0xeb62('0x21')],'include':_0xe2589[_0xeb62('0x1e')]?_[_0xeb62('0x20')](_0xe2589[_0xeb62('0x1e')],function(_0x513dd8){return{'model':db[_0x513dd8[_0xeb62('0x1f')]],'as':_0x513dd8['as'],'attributes':_0x513dd8[_0xeb62('0x21')],'include':_0x513dd8['include']?_['map'](_0x513dd8[_0xeb62('0x1e')],function(_0x117d8c){return{'model':db[_0x117d8c['model']],'as':_0x117d8c['as'],'attributes':_0x117d8c[_0xeb62('0x21')]};}):[]};}):[]};}):[]:[]})[_0xeb62('0x22')](function(_0x11eadb){logger[_0xeb62('0xd')](_0xeb62('0x24'),_0x4b58af);logger[_0xeb62('0x10')](_0xeb62('0x24'),_0x4b58af,JSON['stringify'](_0x11eadb));_0x357cf4(_0x11eadb);})['catch'](function(_0x3306e3){logger[_0xeb62('0x13')](_0xeb62('0x24'),_0x3306e3[_0xeb62('0x15')],_0x4b58af);_0x1607ef(_0x1248bb['error'](0x1f4,_0x3306e3[_0xeb62('0x15')]));});});}; \ No newline at end of file +var _0x282b=['map','model','ShowTrigger','Trigger','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTrigger','findAll','options','raw','where','attributes','include'];(function(_0x59f271,_0x11196a){var _0xc66ca3=function(_0x48db05){while(--_0x48db05){_0x59f271['push'](_0x59f271['shift']());}};_0xc66ca3(++_0x11196a);}(_0x282b,0xec));var _0xb282=function(_0x458240,_0x3e5664){_0x458240=_0x458240-0x0;var _0xf6ad29=_0x282b[_0x458240];return _0xf6ad29;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33635f,_0x4f0410,_0x4a0d28){return new BPromise(function(_0x17fba1,_0x436eaa){return client['request'](_0x33635f,_0x4a0d28)[_0xb282('0xb')](function(_0x20f517){logger[_0xb282('0xc')](_0xb282('0xd'),_0x4f0410,'request\x20sent');logger['debug'](_0xb282('0xe'),_0x4f0410,_0xb282('0xf'),JSON[_0xb282('0x10')](_0x20f517));if(_0x20f517[_0xb282('0x11')]){if(_0x20f517[_0xb282('0x11')]['code']===0x1f4){logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);return _0x436eaa(_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);}logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517['error'][_0xb282('0x12')]);return _0x17fba1(_0x20f517[_0xb282('0x11')]['message']);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x4f0410,_0xb282('0xf'));_0x17fba1(_0x20f517[_0xb282('0x13')][_0xb282('0x12')]);}})[_0xb282('0x14')](function(_0x438a05){logger['error'](_0xb282('0xd'),_0x4f0410,_0x438a05);_0x436eaa(_0x438a05);});});}exports[_0xb282('0x15')]=function(_0xca5f12){var _0x45b070=this;return new Promise(function(_0x3f8a3f,_0x492d20){return db['Trigger'][_0xb282('0x16')]({'raw':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x19')]||null:null,'attributes':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x1a')]||null:null,'limit':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')]['limit']||null:null,'include':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x1b')]?_[_0xb282('0x1c')](_0xca5f12[_0xb282('0x17')]['include'],function(_0x4d624f){return{'model':db[_0x4d624f[_0xb282('0x1d')]],'as':_0x4d624f['as'],'attributes':_0x4d624f[_0xb282('0x1a')],'include':_0x4d624f['include']?_['map'](_0x4d624f[_0xb282('0x1b')],function(_0x114f77){return{'model':db[_0x114f77[_0xb282('0x1d')]],'as':_0x114f77['as'],'attributes':_0x114f77[_0xb282('0x1a')],'include':_0x114f77[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x114f77['include'],function(_0xa0d7fb){return{'model':db[_0xa0d7fb[_0xb282('0x1d')]],'as':_0xa0d7fb['as'],'attributes':_0xa0d7fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xb282('0xb')](function(_0x38a1f8){logger[_0xb282('0xc')](_0xb282('0x15'),_0xca5f12);logger['debug'](_0xb282('0x15'),_0xca5f12,JSON[_0xb282('0x10')](_0x38a1f8));_0x3f8a3f(_0x38a1f8);})[_0xb282('0x14')](function(_0x433ad5){logger[_0xb282('0x11')](_0xb282('0x15'),_0x433ad5[_0xb282('0x12')],_0xca5f12);_0x492d20(_0x45b070['error'](0x1f4,_0x433ad5[_0xb282('0x12')]));});});};exports[_0xb282('0x1e')]=function(_0x3eb294){var _0xd8780b=this;return new Promise(function(_0x42ef75,_0x5f3ddf){return db[_0xb282('0x1f')]['find']({'raw':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0x3eb294['options']?_0x3eb294[_0xb282('0x17')]['where']||null:null,'attributes':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1a')]||null:null,'include':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')]?_['map'](_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')],function(_0x4ede9d){return{'model':db[_0x4ede9d['model']],'as':_0x4ede9d['as'],'attributes':_0x4ede9d[_0xb282('0x1a')],'include':_0x4ede9d[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4ede9d['include'],function(_0x4a76ce){return{'model':db[_0x4a76ce['model']],'as':_0x4a76ce['as'],'attributes':_0x4a76ce[_0xb282('0x1a')],'include':_0x4a76ce[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4a76ce[_0xb282('0x1b')],function(_0x17c1e4){return{'model':db[_0x17c1e4[_0xb282('0x1d')]],'as':_0x17c1e4['as'],'attributes':_0x17c1e4[_0xb282('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dc171){logger['info'](_0xb282('0x1e'),_0x3eb294);logger[_0xb282('0x20')](_0xb282('0x1e'),_0x3eb294,JSON['stringify'](_0x3dc171));_0x42ef75(_0x3dc171);})[_0xb282('0x14')](function(_0x4beef2){logger[_0xb282('0x11')](_0xb282('0x1e'),_0x4beef2[_0xb282('0x12')],_0x3eb294);_0x5f3ddf(_0xd8780b[_0xb282('0x11')](0x1f4,_0x4beef2['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index d894227..5ab9879 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(_0x31b9bf,_0x265aeb){var _0x599eff=function(_0x25dbf3){while(--_0x25dbf3){_0x31b9bf['push'](_0x31b9bf['shift']());}};_0x599eff(++_0x265aeb);}(_0x00bb,0x1d8));var _0xb00b=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x00bb[_0x28947d];return _0x12d2ee;};'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 _0x34e8=['create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','show','post','/:id/clone','clone'];(function(_0xfbe13,_0x3be551){var _0x283b82=function(_0x26e74d){while(--_0x26e74d){_0xfbe13['push'](_0xfbe13['shift']());}};_0x283b82(++_0x3be551);}(_0x34e8,0x12c));var _0x834e=function(_0xb73709,_0x57d47a){_0xb73709=_0xb73709-0x0;var _0xbcec52=_0x34e8[_0xb73709];return _0xbcec52;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0xc')](_0x834e('0xd'),auth[_0x834e('0xa')](),controller[_0x834e('0xe')]);router[_0x834e('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x10')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 7d1cab3..7128c0a 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 _0xd92a=['name','ENUM','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','split','rfc2833','info','shortinfo','auto','yes','nonat','update','force_rport,comedia','nat','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','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','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','BOOLEAN'];(function(_0x4d4f61,_0x56d7a7){var _0x297414=function(_0x30d055){while(--_0x30d055){_0x4d4f61['push'](_0x4d4f61['shift']());}};_0x297414(++_0x56d7a7);}(_0xd92a,0x12c));var _0xad92=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd92a[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xad92('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x2'),_0xad92('0x3'),_0xad92('0x4')),'allowNull':![],'defaultValue':_0xad92('0x2')},'context':{'type':Sequelize[_0xad92('0x5')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x6'),_0xad92('0x7'),_0xad92('0x8'),_0xad92('0x9'),'PROHIB_NOT_SCREENED',_0xad92('0xa'),_0xad92('0xb'),_0xad92('0xc'))},'deny':{'type':Sequelize[_0xad92('0x5')]},'permit':{'type':Sequelize[_0xad92('0x5')]},'secret':{'type':Sequelize[_0xad92('0x5')]},'md5secret':{'type':Sequelize[_0xad92('0x5')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xad92('0x5')],'defaultValue':_0xad92('0xd'),'set':function(_0x36c3e4){this[_0xad92('0xe')]('transport',_0x36c3e4?_0x36c3e4['join'](','):null);},'get':function(){return this['getDataValue'](_0xad92('0xf'))?this['getDataValue'](_0xad92('0xf'))[_0xad92('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x11'),_0xad92('0x12'),_0xad92('0x13'),'inband',_0xad92('0x14')),'defaultValue':_0xad92('0x11')},'directmedia':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no',_0xad92('0x16'),_0xad92('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xad92('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xad92('0x5')]},'nat':{'type':Sequelize[_0xad92('0x5')],'defaultValue':_0xad92('0x18'),'set':function(_0x16e763){this[_0xad92('0xe')](_0xad92('0x19'),_0x16e763?_0x16e763[_0xad92('0x1a')](','):null);},'get':function(){return this[_0xad92('0x1b')](_0xad92('0x19'))?this[_0xad92('0x1b')](_0xad92('0x19'))[_0xad92('0x10')](','):null;},'comment':_0xad92('0x1c')},'callgroup':{'type':Sequelize[_0xad92('0x5')]},'namedcallgroup':{'type':Sequelize[_0xad92('0x5')]},'pickupgroup':{'type':Sequelize[_0xad92('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xad92('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xad92('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xad92('0x5')],'defaultValue':_0xad92('0x1d')},'allow':{'type':Sequelize[_0xad92('0x5')],'allowNull':![],'defaultValue':_0xad92('0x1e'),'set':function(_0xaa2592){this[_0xad92('0xe')](_0xad92('0x1f'),_0xaa2592?_0xaa2592[_0xad92('0x1a')](';'):_0xad92('0x1e'));},'get':function(){return this[_0xad92('0x1b')]('allow')?this[_0xad92('0x1b')](_0xad92('0x1f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xad92('0x1')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xad92('0x20'),'set':function(_0xa7862e){this[_0xad92('0xe')]('insecure',_0xa7862e?_0xa7862e[_0xad92('0x1a')](','):null);},'get':function(){return this[_0xad92('0x1b')](_0xad92('0x21'))?this[_0xad92('0x1b')]('insecure')[_0xad92('0x10')](','):null;},'comment':_0xad92('0x22')},'trustrpid':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no',_0xad92('0x23'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xad92('0x5')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xad92('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xad92('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xad92('0x1')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0xad92('0x1')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xad92('0x5')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no',_0xad92('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xad92('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x27'),_0xad92('0x28'),'originate')},'session_expires':{'type':Sequelize[_0xad92('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xad92('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x29'),_0xad92('0x2a')),'defaultValue':_0xad92('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xad92('0x5')]},'regexten':{'type':Sequelize[_0xad92('0x5')]},'fromdomain':{'type':Sequelize[_0xad92('0x5')]},'fromuser':{'type':Sequelize[_0xad92('0x5')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xad92('0x15'),'no'),'defaultValue':_0xad92('0x15')},'keepalive':{'type':Sequelize[_0xad92('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xad92('0x5')]},'defaultuser':{'type':Sequelize[_0xad92('0x5')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xad92('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xad92('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xad92('0x15'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xad92('0x5')]},'timert1':{'type':Sequelize[_0xad92('0x25')](0xb)},'timerb':{'type':Sequelize[_0xad92('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xad92('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xad92('0x5')]},'contactdeny':{'type':Sequelize[_0xad92('0x5')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xad92('0x5')]},'use_q850_reason':{'type':Sequelize[_0xad92('0x5')]},'maxforwards':{'type':Sequelize[_0xad92('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xad92('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no')},'force_avp':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no')},'icesupport':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no',_0xad92('0x2b'),_0xad92('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xad92('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xad92('0x5')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xad92('0x5')]},'dtlscafile':{'type':Sequelize[_0xad92('0x5')]},'dtlscapath':{'type':Sequelize[_0xad92('0x5')]},'dtlssetup':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x2d'),_0xad92('0x2e'),_0xad92('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xad92('0x5')]},'recordofffeature':{'type':Sequelize[_0xad92('0x5')]},'call_limit':{'type':Sequelize[_0xad92('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xad92('0x1')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no')},'vmexten':{'type':Sequelize[_0xad92('0x5')]},'mohinterpret':{'type':Sequelize[_0xad92('0x5')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xad92('0x5')]},'description':{'type':Sequelize[_0xad92('0x5')]},'host':{'type':Sequelize[_0xad92('0x5')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xad92('0x1')](_0xad92('0x15'),'no','nonat',_0xad92('0x17'),_0xad92('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xad92('0x5')]},'otherFields':{'type':Sequelize[_0xad92('0x5')]},'active':{'type':Sequelize[_0xad92('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xad92('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0xf50c=['PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','STRING','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','ENUM','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uas','fingerprint','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','name','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x2a5042,_0x307d04){var _0x4bc22f=function(_0x2ef928){while(--_0x2ef928){_0x2a5042['push'](_0x2a5042['shift']());}};_0x4bc22f(++_0x307d04);}(_0xf50c,0x12d));var _0xcf50=function(_0x9e9322,_0x3e4dbb){_0x9e9322=_0x9e9322-0x0;var _0x46061f=_0xf50c[_0x9e9322];return _0x46061f;};'use strict';var Sequelize=require(_0xcf50('0x0'));module[_0xcf50('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcf50('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xcf50('0x3'),_0xcf50('0x4'),_0xcf50('0x5')),'allowNull':![],'defaultValue':_0xcf50('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xcf50('0x6'),_0xcf50('0x7'),_0xcf50('0x8'),_0xcf50('0x9'),_0xcf50('0xa'),_0xcf50('0xb'),_0xcf50('0xc'),_0xcf50('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xcf50('0xe')]},'secret':{'type':Sequelize[_0xcf50('0xe')]},'md5secret':{'type':Sequelize[_0xcf50('0xe')]},'remotesecret':{'type':Sequelize[_0xcf50('0xe')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xcf50('0xf'),'set':function(_0x565657){this[_0xcf50('0x10')](_0xcf50('0x11'),_0x565657?_0x565657[_0xcf50('0x12')](','):null);},'get':function(){return this[_0xcf50('0x13')](_0xcf50('0x11'))?this[_0xcf50('0x13')]('transport')[_0xcf50('0x14')](','):null;},'comment':_0xcf50('0x15')},'dtmfmode':{'type':Sequelize['ENUM'](_0xcf50('0x16'),'info',_0xcf50('0x17'),_0xcf50('0x18'),_0xcf50('0x19')),'defaultValue':_0xcf50('0x16')},'directmedia':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no',_0xcf50('0x1c'),'update',_0xcf50('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcf50('0xe')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xcf50('0x1e'),'set':function(_0x38b4f8){this[_0xcf50('0x10')](_0xcf50('0x1f'),_0x38b4f8?_0x38b4f8['join'](','):null);},'get':function(){return this['getDataValue'](_0xcf50('0x1f'))?this['getDataValue'](_0xcf50('0x1f'))['split'](','):null;},'comment':_0xcf50('0x20')},'callgroup':{'type':Sequelize[_0xcf50('0xe')]},'namedcallgroup':{'type':Sequelize[_0xcf50('0xe')]},'pickupgroup':{'type':Sequelize[_0xcf50('0xe')]},'namedpickupgroup':{'type':Sequelize[_0xcf50('0xe')]},'language':{'type':Sequelize[_0xcf50('0xe')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcf50('0xe')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xcf50('0xe')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xcf50('0xe')],'allowNull':![],'defaultValue':_0xcf50('0x21'),'set':function(_0x3f3370){this[_0xcf50('0x10')](_0xcf50('0x22'),_0x3f3370?_0x3f3370[_0xcf50('0x12')](';'):_0xcf50('0x21'));},'get':function(){return this[_0xcf50('0x13')](_0xcf50('0x22'))?this[_0xcf50('0x13')](_0xcf50('0x22'))['split'](';'):null;},'comment':_0xcf50('0x23')},'autoframing':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'insecure':{'type':Sequelize[_0xcf50('0xe')],'defaultValue':_0xcf50('0x24'),'set':function(_0x40d3b8){this[_0xcf50('0x10')](_0xcf50('0x25'),_0x40d3b8?_0x40d3b8[_0xcf50('0x12')](','):null);},'get':function(){return this[_0xcf50('0x13')](_0xcf50('0x25'))?this[_0xcf50('0x13')](_0xcf50('0x25'))['split'](','):null;},'comment':_0xcf50('0x26')},'trustrpid':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcf50('0x1a')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no',_0xcf50('0x27'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xcf50('0x1a')]('yes','no')},'accountcode':{'type':Sequelize[_0xcf50('0x28')](0xb)},'setvar':{'type':Sequelize[_0xcf50('0xe')]},'callerid':{'type':Sequelize[_0xcf50('0xe')],'defaultValue':_0xcf50('0x29')},'amaflags':{'type':Sequelize[_0xcf50('0xe')]},'callcounter':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no'),'defaultValue':_0xcf50('0x1b')},'busylevel':{'type':Sequelize[_0xcf50('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0xcf50('0x1a')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0xcf50('0xe')]},'template':{'type':Sequelize[_0xcf50('0xe')]},'videosupport':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no',_0xcf50('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcf50('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xcf50('0xe')]},'session_timers':{'type':Sequelize[_0xcf50('0x1a')]('accept',_0xcf50('0x2b'),_0xcf50('0x2c'))},'session_expires':{'type':Sequelize[_0xcf50('0x28')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xcf50('0x1a')]('uac',_0xcf50('0x2d')),'defaultValue':_0xcf50('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0xcf50('0xe')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xcf50('0x1a')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xcf50('0x28')](0xb)},'defaultip':{'type':Sequelize[_0xcf50('0xe')]},'defaultuser':{'type':Sequelize[_0xcf50('0xe')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xcf50('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xcf50('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcf50('0xe')]},'callbackextension':{'type':Sequelize[_0xcf50('0xe')]},'timert1':{'type':Sequelize[_0xcf50('0x28')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xcf50('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0xcf50('0xe')]},'contactdeny':{'type':Sequelize[_0xcf50('0xe')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xcf50('0xe')]},'use_q850_reason':{'type':Sequelize[_0xcf50('0xe')]},'maxforwards':{'type':Sequelize[_0xcf50('0x28')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no')},'force_avp':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'icesupport':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0xcf50('0x1a')]('yes','no',_0xcf50('0x2e'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xcf50('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0xcf50('0xe')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xcf50('0xe')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xcf50('0xe')]},'dtlssetup':{'type':Sequelize[_0xcf50('0x1a')]('active','passive',_0xcf50('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcf50('0xe')]},'usereqphone':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcf50('0xe')]},'recordofffeature':{'type':Sequelize[_0xcf50('0xe')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'vmexten':{'type':Sequelize[_0xcf50('0xe')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xcf50('0xe')]},'parkinglot':{'type':Sequelize[_0xcf50('0xe')]},'description':{'type':Sequelize[_0xcf50('0xe')]},'host':{'type':Sequelize[_0xcf50('0xe')],'defaultValue':_0xcf50('0x30')},'canreinvite':{'type':Sequelize[_0xcf50('0x1a')]('yes','no',_0xcf50('0x1c'),_0xcf50('0x31'),_0xcf50('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xcf50('0xe')]},'otherFields':{'type':Sequelize[_0xcf50('0xe')]},'active':{'type':Sequelize[_0xcf50('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xcf50('0xe')],'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 db0978f..7ffbcbc 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 _0xbf13=['stack','name','send','index','map','Trunk','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','params','length','include','options','find','clone','omit','createdAt','updatedAt','body','create','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','utf8','readFileSync','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','server/files/templates/trunk.ejs','/etc/asterisk/sip_xcally_registers.conf','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','save','update','destroy','get','Trunks','UserProfileResource'];(function(_0x3658e5,_0x148efa){var _0x56cc07=function(_0x5c45aa){while(--_0x5c45aa){_0x3658e5['push'](_0x3658e5['shift']());}};_0x56cc07(++_0x148efa);}(_0xbf13,0x114));var _0x3bf1=function(_0x1f8aca,_0x294fe3){_0x1f8aca=_0x1f8aca-0x0;var _0x2c1e69=_0xbf13[_0x1f8aca];return _0x2c1e69;};'use strict';var pdf=require(_0x3bf1('0x0'));var emlformat=require(_0x3bf1('0x1'));var rimraf=require(_0x3bf1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3bf1('0x3'));var rp=require(_0x3bf1('0x4'));var moment=require('moment');var BPromise=require(_0x3bf1('0x5'));var Mustache=require(_0x3bf1('0x6'));var util=require(_0x3bf1('0x7'));var path=require(_0x3bf1('0x8'));var sox=require(_0x3bf1('0x9'));var csv=require(_0x3bf1('0xa'));var ejs=require(_0x3bf1('0xb'));var fs=require('fs');var _=require(_0x3bf1('0xc'));var squel=require(_0x3bf1('0xd'));var crypto=require(_0x3bf1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3bf1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3bf1('0x10'));var Papa=require(_0x3bf1('0x11'));var Redis=require(_0x3bf1('0x12'));var authService=require(_0x3bf1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3bf1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3bf1('0x15'));var utils=require(_0x3bf1('0x16'));var config=require(_0x3bf1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bf1('0x18'))['db'];var jayson=require(_0x3bf1('0x19'));var client=jayson['client'][_0x3bf1('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2e1a4f,_0x1f1a7c,_0x5e8815,_0x5bd52f){return new BPromise(function(_0x57e65a,_0x2f166e){var _0x3d643e=_0x5bd52f||client;return _0x3d643e['request'](_0x2e1a4f,_0x5e8815)[_0x3bf1('0x1b')](function(_0x40290f){logger[_0x3bf1('0x1c')]('Trunk,\x20%s,\x20%s',_0x1f1a7c,_0x3bf1('0x1d'));logger[_0x3bf1('0x1e')]('Trunk,\x20%s,\x20%s,\x20%s',_0x1f1a7c,_0x3bf1('0x1d'),JSON[_0x3bf1('0x1f')](_0x40290f));if(_0x40290f[_0x3bf1('0x20')]){if(_0x40290f[_0x3bf1('0x20')][_0x3bf1('0x21')]===0x1f4){logger[_0x3bf1('0x20')]('Trunk,\x20%s,\x20%s',_0x1f1a7c,_0x40290f[_0x3bf1('0x20')][_0x3bf1('0x22')]);return _0x2f166e(_0x40290f['error'][_0x3bf1('0x22')]);}logger[_0x3bf1('0x20')]('Trunk,\x20%s,\x20%s',_0x1f1a7c,_0x40290f['error'][_0x3bf1('0x22')]);return _0x57e65a(_0x40290f['error'][_0x3bf1('0x22')]);}else{logger[_0x3bf1('0x1c')](_0x3bf1('0x23'),_0x1f1a7c,_0x3bf1('0x1d'));_0x57e65a(_0x40290f[_0x3bf1('0x24')][_0x3bf1('0x22')]);}})[_0x3bf1('0x25')](function(_0x489dd8){logger['error'](_0x3bf1('0x23'),_0x1f1a7c,_0x489dd8);_0x2f166e(_0x489dd8);});});}function respondWithStatusCode(_0x106da4,_0x3c2a10){_0x3c2a10=_0x3c2a10||0xcc;return function(_0x1ccbfd){if(_0x1ccbfd){return _0x106da4[_0x3bf1('0x26')](_0x3c2a10);}return _0x106da4[_0x3bf1('0x27')](_0x3c2a10)['end']();};}function respondWithResult(_0x23feef,_0xd7dc3a){_0xd7dc3a=_0xd7dc3a||0xc8;return function(_0x5181c4){if(_0x5181c4){return _0x23feef[_0x3bf1('0x27')](_0xd7dc3a)[_0x3bf1('0x28')](_0x5181c4);}};}function respondWithFilteredResult(_0x24400b,_0x53bd8a){return function(_0x3d2462){if(_0x3d2462){var _0x545957=_0x3d2462[_0x3bf1('0x29')],_0x366b60=_0x53bd8a['offset'],_0x5f1c88=_0x53bd8a[_0x3bf1('0x2a')]+_0x53bd8a[_0x3bf1('0x2b')],_0x3f7bc2;if(_0x5f1c88>=_0x545957){_0x5f1c88=_0x545957;_0x3f7bc2=0xc8;}else{_0x3f7bc2=0xce;}_0x24400b['status'](_0x3f7bc2);return _0x24400b['set'](_0x3bf1('0x2c'),_0x366b60+'-'+_0x5f1c88+'/'+_0x545957)[_0x3bf1('0x28')](_0x3d2462);}return null;};}function patchUpdates(_0x3ff602){return function(_0x7e47e1){try{jsonpatch['apply'](_0x7e47e1,_0x3ff602,!![]);}catch(_0x1cad21){return BPromise['reject'](_0x1cad21);}return _0x7e47e1[_0x3bf1('0x2d')]();};}function saveUpdates(_0xaa3c0e,_0x3fdda1){return function(_0x303e10){if(_0x303e10){return _0x303e10[_0x3bf1('0x2e')](_0xaa3c0e)[_0x3bf1('0x1b')](function(_0x50e560){return _0x50e560;});}return null;};}function removeEntity(_0x2737d2,_0x2cd447){return function(_0x4aa485){if(_0x4aa485){return _0x4aa485[_0x3bf1('0x2f')]()[_0x3bf1('0x1b')](function(){var _0x3cfbdf=_0x4aa485[_0x3bf1('0x30')]({'plain':!![]});var _0x288b97=_0x3bf1('0x31');return db[_0x3bf1('0x32')][_0x3bf1('0x2f')]({'where':{'type':_0x288b97,'resourceId':_0x3cfbdf['id']}})[_0x3bf1('0x1b')](function(){return _0x4aa485;});})[_0x3bf1('0x1b')](function(){_0x2737d2[_0x3bf1('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x409abb,_0x494307){return function(_0x5856a9){if(!_0x5856a9){_0x409abb[_0x3bf1('0x26')](0x194);}return _0x5856a9;};}function handleError(_0x287d3c,_0x3d40dc){_0x3d40dc=_0x3d40dc||0x1f4;return function(_0x476f34){logger[_0x3bf1('0x20')](_0x476f34[_0x3bf1('0x33')]);if(_0x476f34[_0x3bf1('0x34')]){delete _0x476f34[_0x3bf1('0x34')];}_0x287d3c[_0x3bf1('0x27')](_0x3d40dc)[_0x3bf1('0x35')](_0x476f34);};}exports[_0x3bf1('0x36')]=function(_0x38be26,_0xdd83c6){var _0xe63fbb={},_0x247ad2={},_0x55a6be={'count':0x0,'rows':[]};var _0x1c1b12=_[_0x3bf1('0x37')](db[_0x3bf1('0x38')][_0x3bf1('0x39')],function(_0x5a7356){return{'name':_0x5a7356[_0x3bf1('0x3a')],'type':_0x5a7356['type'][_0x3bf1('0x3b')]};});_0x247ad2[_0x3bf1('0x3c')]=_['map'](_0x1c1b12,_0x3bf1('0x34'));_0x247ad2[_0x3bf1('0x3d')]=_[_0x3bf1('0x3e')](_0x38be26[_0x3bf1('0x3d')]);_0x247ad2[_0x3bf1('0x3f')]=_['intersection'](_0x247ad2['model'],_0x247ad2['query']);_0xe63fbb[_0x3bf1('0x40')]=_[_0x3bf1('0x41')](_0x247ad2['model'],qs[_0x3bf1('0x42')](_0x38be26['query'][_0x3bf1('0x42')]));_0xe63fbb[_0x3bf1('0x40')]=_0xe63fbb['attributes']['length']?_0xe63fbb[_0x3bf1('0x40')]:_0x247ad2[_0x3bf1('0x3c')];if(!_0x38be26['query'][_0x3bf1('0x43')](_0x3bf1('0x44'))){_0xe63fbb['limit']=qs['limit'](_0x38be26[_0x3bf1('0x3d')][_0x3bf1('0x2b')]);_0xe63fbb[_0x3bf1('0x2a')]=qs[_0x3bf1('0x2a')](_0x38be26[_0x3bf1('0x3d')][_0x3bf1('0x2a')]);}_0xe63fbb[_0x3bf1('0x45')]=qs[_0x3bf1('0x46')](_0x38be26[_0x3bf1('0x3d')]['sort']);_0xe63fbb[_0x3bf1('0x47')]=qs[_0x3bf1('0x3f')](_[_0x3bf1('0x48')](_0x38be26['query'],_0x247ad2['filters']),_0x1c1b12);if(_0x38be26[_0x3bf1('0x3d')][_0x3bf1('0x49')]){_0xe63fbb[_0x3bf1('0x47')]=_['merge'](_0xe63fbb[_0x3bf1('0x47')],{'$or':_[_0x3bf1('0x37')](_0x1c1b12,function(_0x392bb9){if(_0x392bb9['type']!==_0x3bf1('0x4a')){var _0x401d10={};_0x401d10[_0x392bb9[_0x3bf1('0x34')]]={'$like':'%'+_0x38be26[_0x3bf1('0x3d')]['filter']+'%'};return _0x401d10;}})});}_0xe63fbb=_[_0x3bf1('0x4b')]({},_0xe63fbb,_0x38be26['options']);var _0x289ddb={'where':_0xe63fbb[_0x3bf1('0x47')]};return db['Trunk'][_0x3bf1('0x29')](_0x289ddb)[_0x3bf1('0x1b')](function(_0x10c387){_0x55a6be[_0x3bf1('0x29')]=_0x10c387;if(_0x38be26['query'][_0x3bf1('0x4c')]){_0xe63fbb['include']=[{'all':!![]}];}return db[_0x3bf1('0x38')][_0x3bf1('0x4d')](_0xe63fbb);})['then'](function(_0x42b2ff){_0x55a6be[_0x3bf1('0x4e')]=_0x42b2ff;return _0x55a6be;})['then'](respondWithFilteredResult(_0xdd83c6,_0xe63fbb))[_0x3bf1('0x25')](handleError(_0xdd83c6,null));};exports['show']=function(_0xa8410,_0x3cadcc){var _0x170c34={'raw':![],'where':{'id':_0xa8410[_0x3bf1('0x4f')]['id']}},_0x55764a={};_0x55764a[_0x3bf1('0x3c')]=_[_0x3bf1('0x3e')](db[_0x3bf1('0x38')][_0x3bf1('0x39')]);_0x55764a[_0x3bf1('0x3d')]=_[_0x3bf1('0x3e')](_0xa8410['query']);_0x55764a[_0x3bf1('0x3f')]=_[_0x3bf1('0x41')](_0x55764a[_0x3bf1('0x3c')],_0x55764a[_0x3bf1('0x3d')]);_0x170c34['attributes']=_['intersection'](_0x55764a[_0x3bf1('0x3c')],qs['fields'](_0xa8410[_0x3bf1('0x3d')][_0x3bf1('0x42')]));_0x170c34[_0x3bf1('0x40')]=_0x170c34[_0x3bf1('0x40')][_0x3bf1('0x50')]?_0x170c34[_0x3bf1('0x40')]:_0x55764a[_0x3bf1('0x3c')];if(_0xa8410[_0x3bf1('0x3d')][_0x3bf1('0x4c')]){_0x170c34[_0x3bf1('0x51')]=[{'all':!![]}];}_0x170c34=_[_0x3bf1('0x4b')]({},_0x170c34,_0xa8410[_0x3bf1('0x52')]);return db[_0x3bf1('0x38')][_0x3bf1('0x53')](_0x170c34)['then'](handleEntityNotFound(_0x3cadcc,null))[_0x3bf1('0x1b')](respondWithResult(_0x3cadcc,null))['catch'](handleError(_0x3cadcc,null));};exports[_0x3bf1('0x54')]=function(_0x412ba5,_0x1bffb3){var _0x2d56c7={'where':{'id':_0x412ba5[_0x3bf1('0x4f')]['id']}},_0x5b9039={};_0x5b9039[_0x3bf1('0x3c')]=_[_0x3bf1('0x3e')](db[_0x3bf1('0x38')][_0x3bf1('0x39')]);_0x2d56c7[_0x3bf1('0x40')]=_[_0x3bf1('0x41')](_0x5b9039[_0x3bf1('0x3c')],qs['fields'](_0x412ba5['query'][_0x3bf1('0x42')]));_0x2d56c7[_0x3bf1('0x40')]=_0x2d56c7[_0x3bf1('0x40')][_0x3bf1('0x50')]?_0x2d56c7[_0x3bf1('0x40')]:_0x5b9039[_0x3bf1('0x3c')];if(_0x412ba5[_0x3bf1('0x3d')]['includeAll']){_0x2d56c7[_0x3bf1('0x51')]=[{'all':!![]}];}_0x2d56c7=_['merge']({},_0x2d56c7,_0x412ba5[_0x3bf1('0x52')]);return db['Trunk'][_0x3bf1('0x53')](_0x2d56c7)[_0x3bf1('0x1b')](handleEntityNotFound(_0x1bffb3,null))[_0x3bf1('0x1b')](function(_0x1ad90a){if(_0x1ad90a){var _0x142757=_0x1ad90a[_0x3bf1('0x30')]({'plain':!![]});_0x142757=qs[_0x3bf1('0x55')](_0x142757,['id',_0x3bf1('0x56'),_0x3bf1('0x57')]);_0x412ba5[_0x3bf1('0x58')]=_[_0x3bf1('0x55')](_0x412ba5[_0x3bf1('0x58')],['id','createdAt',_0x3bf1('0x57')]);return db['Trunk'][_0x3bf1('0x59')](_[_0x3bf1('0x4b')](_0x142757,_0x412ba5[_0x3bf1('0x58')]),{'include':_0x412ba5[_0x3bf1('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0x3bf1('0x1b')](function(_0x416fd5){var _0x44f010=_0x412ba5['user'][_0x3bf1('0x30')]({'plain':!![]});if(!_0x44f010)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44f010['role']==='user'){var _0x1c10d6=_0x416fd5[_0x3bf1('0x30')]({'plain':!![]});var _0x3b680d=_0x3bf1('0x31');return db['UserProfileSection'][_0x3bf1('0x53')]({'where':{'name':_0x3b680d,'userProfileId':_0x44f010['userProfileId']},'raw':!![]})[_0x3bf1('0x1b')](function(_0x4ebb53){if(_0x4ebb53&&_0x4ebb53[_0x3bf1('0x5a')]===0x0){return db[_0x3bf1('0x32')][_0x3bf1('0x59')]({'name':_0x1c10d6['name'],'resourceId':_0x1c10d6['id'],'type':_0x4ebb53['name'],'sectionId':_0x4ebb53['id']},{})[_0x3bf1('0x1b')](function(){return _0x416fd5;});}else{return _0x416fd5;}})[_0x3bf1('0x25')](function(_0x45fbd7){logger[_0x3bf1('0x20')](_0x3bf1('0x5b'),_0x45fbd7);throw _0x45fbd7;});}return _0x416fd5;});}})[_0x3bf1('0x1b')](respondWithResult(_0x1bffb3,0xc9))[_0x3bf1('0x25')](handleError(_0x1bffb3,null));};exports[_0x3bf1('0x59')]=function(_0x2e78ee,_0x377834,_0x1354b7){var _0x1f1676;return db['Trunk'][_0x3bf1('0x59')](_0x2e78ee['body'],{'raw':!![]})['then'](function(_0x3b360a){_0x1f1676=_0x3b360a;return db[_0x3bf1('0x38')][_0x3bf1('0x4d')]({'raw':!![]});})['then'](function(_0x190d23){var _0x39b001=fs['readFileSync'](path[_0x3bf1('0x5c')](config[_0x3bf1('0x5d')],'server/files/templates/trunk.ejs'),_0x3bf1('0x5e'));var _0x24fb96=fs[_0x3bf1('0x5f')](path[_0x3bf1('0x5c')](config[_0x3bf1('0x5d')],_0x3bf1('0x60')),_0x3bf1('0x5e'));var _0x2eb34e=ejs[_0x3bf1('0x61')](_0x39b001,{'trunks':_0x190d23||[]});fs[_0x3bf1('0x62')](_0x3bf1('0x63'),_0x2eb34e);if(_0x1f1676[_0x3bf1('0x64')]){var _0x39f120=ejs['render'](_0x24fb96,{'trunks':_0x190d23||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x39f120);}})[_0x3bf1('0x1b')](function(){return respondWithRpcPromise(_0x3bf1('0x65'),_0x3bf1('0x59'),{'module':_0x3bf1('0x66')});})[_0x3bf1('0x1b')](function(){var _0xdfd5d9=_0x2e78ee[_0x3bf1('0x67')][_0x3bf1('0x30')]({'plain':!![]});if(!_0xdfd5d9)throw new Error(_0x3bf1('0x68'));if(_0xdfd5d9[_0x3bf1('0x69')]===_0x3bf1('0x67')){var _0x177b6f=_0x1f1676[_0x3bf1('0x30')]({'plain':!![]});return db['UserProfileSection'][_0x3bf1('0x53')]({'where':{'name':_0x3bf1('0x31'),'userProfileId':_0xdfd5d9[_0x3bf1('0x6a')]},'raw':!![]})[_0x3bf1('0x1b')](function(_0x5601d2){if(_0x5601d2&&_0x5601d2[_0x3bf1('0x5a')]===0x0){return db[_0x3bf1('0x32')]['create']({'name':_0x177b6f['name'],'resourceId':_0x177b6f['id'],'type':_0x5601d2[_0x3bf1('0x34')],'sectionId':_0x5601d2['id']},{})['then'](function(){return _0x1f1676;});}else{return _0x1f1676;}})[_0x3bf1('0x25')](function(_0xc8cbf8){logger[_0x3bf1('0x20')](_0x3bf1('0x5b'),_0xc8cbf8);throw _0xc8cbf8;});}return _0x1f1676;})[_0x3bf1('0x1b')](respondWithResult(_0x377834,0xc9))[_0x3bf1('0x25')](handleError(_0x377834,null));};exports[_0x3bf1('0x2e')]=function(_0x538d9a,_0x558677,_0x166015){var _0x47499b;return db['Trunk']['find']({'where':{'id':_0x538d9a['params']['id']}})[_0x3bf1('0x1b')](handleEntityNotFound(_0x558677,null))[_0x3bf1('0x1b')](saveUpdates(_0x538d9a[_0x3bf1('0x58')],null))['then'](function(_0x44a4f4){if(_0x44a4f4){_0x47499b=_0x44a4f4;return db[_0x3bf1('0x38')][_0x3bf1('0x4d')]({'raw':!![]});}})[_0x3bf1('0x1b')](function(_0x1404b3){if(_0x1404b3){var _0xbe6876=fs[_0x3bf1('0x5f')](path[_0x3bf1('0x5c')](config['root'],_0x3bf1('0x6b')),_0x3bf1('0x5e'));var _0x2045c3=fs[_0x3bf1('0x5f')](path[_0x3bf1('0x5c')](config[_0x3bf1('0x5d')],_0x3bf1('0x60')),_0x3bf1('0x5e'));var _0x44a999=ejs[_0x3bf1('0x61')](_0xbe6876,{'trunks':_0x1404b3||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x44a999);var _0x2bb04a=ejs[_0x3bf1('0x61')](_0x2045c3,{'trunks':_0x1404b3||[]});fs[_0x3bf1('0x62')](_0x3bf1('0x6c'),_0x2bb04a);return respondWithRpcPromise(_0x3bf1('0x65'),_0x3bf1('0x2e'),{'module':_0x3bf1('0x66')});}return null;})[_0x3bf1('0x1b')](function(_0x4fa820){if(_0x4fa820){return _0x47499b;}})[_0x3bf1('0x1b')](respondWithResult(_0x558677,null))[_0x3bf1('0x25')](handleError(_0x558677,null));};exports[_0x3bf1('0x2f')]=function(_0x30ec6d,_0x4962c2,_0x3502ef){var _0x24e6b9;return db[_0x3bf1('0x38')][_0x3bf1('0x53')]({'where':{'id':_0x30ec6d[_0x3bf1('0x4f')]['id']}})[_0x3bf1('0x1b')](handleEntityNotFound(_0x4962c2,null))[_0x3bf1('0x1b')](removeEntity(_0x4962c2,null))[_0x3bf1('0x1b')](function(){return db[_0x3bf1('0x38')][_0x3bf1('0x4d')]({'raw':!![]});})[_0x3bf1('0x1b')](function(_0x2434f2){var _0x25335c=fs[_0x3bf1('0x5f')](path[_0x3bf1('0x5c')](config['root'],_0x3bf1('0x6b')),_0x3bf1('0x5e'));var _0x47d119=fs[_0x3bf1('0x5f')](path[_0x3bf1('0x5c')](config[_0x3bf1('0x5d')],_0x3bf1('0x60')),_0x3bf1('0x5e'));var _0x52a7f7=ejs[_0x3bf1('0x61')](_0x25335c,{'trunks':_0x2434f2});var _0x46a207=ejs[_0x3bf1('0x61')](_0x47d119,{'trunks':_0x2434f2});fs[_0x3bf1('0x62')](_0x3bf1('0x63'),_0x52a7f7);fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x46a207);return respondWithRpcPromise(_0x3bf1('0x65'),_0x3bf1('0x2f'),{'module':_0x3bf1('0x66')});})[_0x3bf1('0x25')](handleError(_0x4962c2,null));}; \ No newline at end of file +var _0x3e49=['then','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','root','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','userProfileId','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','count','limit','set','Content-Range','save','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3e49,0x183));var _0x93e4=function(_0x44646e,_0x5ee8f1){_0x44646e=_0x44646e-0x0;var _0x507efa=_0x3e49[_0x44646e];return _0x507efa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x93e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x93e4('0x1'));var jsonpatch=require(_0x93e4('0x2'));var rp=require(_0x93e4('0x3'));var moment=require('moment');var BPromise=require(_0x93e4('0x4'));var Mustache=require(_0x93e4('0x5'));var util=require(_0x93e4('0x6'));var path=require(_0x93e4('0x7'));var sox=require(_0x93e4('0x8'));var csv=require(_0x93e4('0x9'));var ejs=require(_0x93e4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x93e4('0xb'));var crypto=require(_0x93e4('0xc'));var jsforce=require(_0x93e4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x93e4('0x9'));var querystring=require(_0x93e4('0xe'));var Papa=require('papaparse');var Redis=require(_0x93e4('0xf'));var authService=require(_0x93e4('0x10'));var qs=require(_0x93e4('0x11'));var as=require(_0x93e4('0x12'));var hardwareService=require(_0x93e4('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x93e4('0x14'));var db=require(_0x93e4('0x15'))['db'];var jayson=require(_0x93e4('0x16'));var client=jayson[_0x93e4('0x17')][_0x93e4('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5d1653,_0x22f7f4,_0x1f9816,_0x50b848){return new BPromise(function(_0x2be61b,_0x3c2bfd){var _0x41bc08=_0x50b848||client;return _0x41bc08[_0x93e4('0x19')](_0x5d1653,_0x1f9816)['then'](function(_0x2bcc3b){logger[_0x93e4('0x1a')](_0x93e4('0x1b'),_0x22f7f4,'request\x20sent');logger[_0x93e4('0x1c')](_0x93e4('0x1d'),_0x22f7f4,_0x93e4('0x1e'),JSON['stringify'](_0x2bcc3b));if(_0x2bcc3b[_0x93e4('0x1f')]){if(_0x2bcc3b['error'][_0x93e4('0x20')]===0x1f4){logger[_0x93e4('0x1f')](_0x93e4('0x1b'),_0x22f7f4,_0x2bcc3b['error']['message']);return _0x3c2bfd(_0x2bcc3b[_0x93e4('0x1f')]['message']);}logger[_0x93e4('0x1f')]('Trunk,\x20%s,\x20%s',_0x22f7f4,_0x2bcc3b[_0x93e4('0x1f')][_0x93e4('0x21')]);return _0x2be61b(_0x2bcc3b[_0x93e4('0x1f')]['message']);}else{logger[_0x93e4('0x1a')](_0x93e4('0x1b'),_0x22f7f4,_0x93e4('0x1e'));_0x2be61b(_0x2bcc3b[_0x93e4('0x22')][_0x93e4('0x21')]);}})[_0x93e4('0x23')](function(_0x4f1d11){logger['error'](_0x93e4('0x1b'),_0x22f7f4,_0x4f1d11);_0x3c2bfd(_0x4f1d11);});});}function respondWithStatusCode(_0x5b464a,_0x589213){_0x589213=_0x589213||0xcc;return function(_0x474681){if(_0x474681){return _0x5b464a[_0x93e4('0x24')](_0x589213);}return _0x5b464a[_0x93e4('0x25')](_0x589213)[_0x93e4('0x26')]();};}function respondWithResult(_0xcd8a81,_0x42251c){_0x42251c=_0x42251c||0xc8;return function(_0x1ee657){if(_0x1ee657){return _0xcd8a81[_0x93e4('0x25')](_0x42251c)['json'](_0x1ee657);}};}function respondWithFilteredResult(_0x15666f,_0x3ebe74){return function(_0x3f9148){if(_0x3f9148){var _0x39e37b=_0x3f9148[_0x93e4('0x27')],_0x5ce5bb=_0x3ebe74['offset'],_0x4cafac=_0x3ebe74['offset']+_0x3ebe74[_0x93e4('0x28')],_0x143147;if(_0x4cafac>=_0x39e37b){_0x4cafac=_0x39e37b;_0x143147=0xc8;}else{_0x143147=0xce;}_0x15666f['status'](_0x143147);return _0x15666f[_0x93e4('0x29')](_0x93e4('0x2a'),_0x5ce5bb+'-'+_0x4cafac+'/'+_0x39e37b)['json'](_0x3f9148);}return null;};}function patchUpdates(_0x2fe39e){return function(_0x357c50){try{jsonpatch['apply'](_0x357c50,_0x2fe39e,!![]);}catch(_0x4ac680){return BPromise['reject'](_0x4ac680);}return _0x357c50[_0x93e4('0x2b')]();};}function saveUpdates(_0x43ff6d,_0x22ef86){return function(_0x4ca94b){if(_0x4ca94b){return _0x4ca94b[_0x93e4('0x2c')](_0x43ff6d)[_0x93e4('0x2d')](function(_0xfbf885){return _0xfbf885;});}return null;};}function removeEntity(_0xbdeb6a,_0xd39a35){return function(_0x2e4643){if(_0x2e4643){return _0x2e4643[_0x93e4('0x2e')]()[_0x93e4('0x2d')](function(){var _0x21726b=_0x2e4643['get']({'plain':!![]});var _0x219a96=_0x93e4('0x2f');return db[_0x93e4('0x30')]['destroy']({'where':{'type':_0x219a96,'resourceId':_0x21726b['id']}})[_0x93e4('0x2d')](function(){return _0x2e4643;});})[_0x93e4('0x2d')](function(){_0xbdeb6a[_0x93e4('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b11f,_0x1823c0){return function(_0x54bdff){if(!_0x54bdff){_0x15b11f[_0x93e4('0x24')](0x194);}return _0x54bdff;};}function handleError(_0x2898ec,_0x268ea5){_0x268ea5=_0x268ea5||0x1f4;return function(_0x43b993){logger[_0x93e4('0x1f')](_0x43b993[_0x93e4('0x31')]);if(_0x43b993[_0x93e4('0x32')]){delete _0x43b993['name'];}_0x2898ec['status'](_0x268ea5)[_0x93e4('0x33')](_0x43b993);};}exports[_0x93e4('0x34')]=function(_0x930736,_0x30c409){var _0x5db179={},_0x3bfd84={},_0x6e4b4c={'count':0x0,'rows':[]};var _0x2ddbb7=_['map'](db[_0x93e4('0x35')]['rawAttributes'],function(_0x5a4006){return{'name':_0x5a4006[_0x93e4('0x36')],'type':_0x5a4006[_0x93e4('0x37')][_0x93e4('0x38')]};});_0x3bfd84[_0x93e4('0x39')]=_[_0x93e4('0x3a')](_0x2ddbb7,_0x93e4('0x32'));_0x3bfd84[_0x93e4('0x3b')]=_[_0x93e4('0x3c')](_0x930736[_0x93e4('0x3b')]);_0x3bfd84['filters']=_[_0x93e4('0x3d')](_0x3bfd84[_0x93e4('0x39')],_0x3bfd84[_0x93e4('0x3b')]);_0x5db179['attributes']=_['intersection'](_0x3bfd84['model'],qs[_0x93e4('0x3e')](_0x930736['query'][_0x93e4('0x3e')]));_0x5db179['attributes']=_0x5db179[_0x93e4('0x3f')][_0x93e4('0x40')]?_0x5db179[_0x93e4('0x3f')]:_0x3bfd84[_0x93e4('0x39')];if(!_0x930736[_0x93e4('0x3b')]['hasOwnProperty']('nolimit')){_0x5db179['limit']=qs[_0x93e4('0x28')](_0x930736[_0x93e4('0x3b')]['limit']);_0x5db179[_0x93e4('0x41')]=qs['offset'](_0x930736['query'][_0x93e4('0x41')]);}_0x5db179[_0x93e4('0x42')]=qs[_0x93e4('0x43')](_0x930736[_0x93e4('0x3b')][_0x93e4('0x43')]);_0x5db179[_0x93e4('0x44')]=qs[_0x93e4('0x45')](_[_0x93e4('0x46')](_0x930736['query'],_0x3bfd84[_0x93e4('0x45')]),_0x2ddbb7);if(_0x930736[_0x93e4('0x3b')][_0x93e4('0x47')]){_0x5db179[_0x93e4('0x44')]=_[_0x93e4('0x48')](_0x5db179['where'],{'$or':_[_0x93e4('0x3a')](_0x2ddbb7,function(_0x355254){if(_0x355254[_0x93e4('0x37')]!==_0x93e4('0x49')){var _0x3c7204={};_0x3c7204[_0x355254['name']]={'$like':'%'+_0x930736[_0x93e4('0x3b')][_0x93e4('0x47')]+'%'};return _0x3c7204;}})});}_0x5db179=_[_0x93e4('0x48')]({},_0x5db179,_0x930736[_0x93e4('0x4a')]);var _0x36d850={'where':_0x5db179[_0x93e4('0x44')]};return db[_0x93e4('0x35')][_0x93e4('0x27')](_0x36d850)[_0x93e4('0x2d')](function(_0x1d6786){_0x6e4b4c[_0x93e4('0x27')]=_0x1d6786;if(_0x930736[_0x93e4('0x3b')][_0x93e4('0x4b')]){_0x5db179[_0x93e4('0x4c')]=[{'all':!![]}];}return db[_0x93e4('0x35')]['findAll'](_0x5db179);})['then'](function(_0x25cf01){_0x6e4b4c[_0x93e4('0x4d')]=_0x25cf01;return _0x6e4b4c;})['then'](respondWithFilteredResult(_0x30c409,_0x5db179))['catch'](handleError(_0x30c409,null));};exports[_0x93e4('0x4e')]=function(_0x2b2b1b,_0x332784){var _0x191e42={'raw':![],'where':{'id':_0x2b2b1b[_0x93e4('0x4f')]['id']}},_0x4d5f15={};_0x4d5f15[_0x93e4('0x39')]=_[_0x93e4('0x3c')](db[_0x93e4('0x35')]['rawAttributes']);_0x4d5f15[_0x93e4('0x3b')]=_[_0x93e4('0x3c')](_0x2b2b1b[_0x93e4('0x3b')]);_0x4d5f15[_0x93e4('0x45')]=_[_0x93e4('0x3d')](_0x4d5f15[_0x93e4('0x39')],_0x4d5f15[_0x93e4('0x3b')]);_0x191e42[_0x93e4('0x3f')]=_[_0x93e4('0x3d')](_0x4d5f15[_0x93e4('0x39')],qs[_0x93e4('0x3e')](_0x2b2b1b[_0x93e4('0x3b')][_0x93e4('0x3e')]));_0x191e42[_0x93e4('0x3f')]=_0x191e42[_0x93e4('0x3f')][_0x93e4('0x40')]?_0x191e42[_0x93e4('0x3f')]:_0x4d5f15[_0x93e4('0x39')];if(_0x2b2b1b['query'][_0x93e4('0x4b')]){_0x191e42[_0x93e4('0x4c')]=[{'all':!![]}];}_0x191e42=_[_0x93e4('0x48')]({},_0x191e42,_0x2b2b1b[_0x93e4('0x4a')]);return db[_0x93e4('0x35')][_0x93e4('0x50')](_0x191e42)[_0x93e4('0x2d')](handleEntityNotFound(_0x332784,null))[_0x93e4('0x2d')](respondWithResult(_0x332784,null))['catch'](handleError(_0x332784,null));};exports['clone']=function(_0x5011cc,_0x2ff565){var _0x5b5406={'where':{'id':_0x5011cc[_0x93e4('0x4f')]['id']}},_0x44e207={};_0x44e207[_0x93e4('0x39')]=_[_0x93e4('0x3c')](db[_0x93e4('0x35')]['rawAttributes']);_0x5b5406['attributes']=_[_0x93e4('0x3d')](_0x44e207[_0x93e4('0x39')],qs[_0x93e4('0x3e')](_0x5011cc[_0x93e4('0x3b')][_0x93e4('0x3e')]));_0x5b5406[_0x93e4('0x3f')]=_0x5b5406[_0x93e4('0x3f')][_0x93e4('0x40')]?_0x5b5406['attributes']:_0x44e207[_0x93e4('0x39')];if(_0x5011cc[_0x93e4('0x3b')][_0x93e4('0x4b')]){_0x5b5406[_0x93e4('0x4c')]=[{'all':!![]}];}_0x5b5406=_[_0x93e4('0x48')]({},_0x5b5406,_0x5011cc['options']);return db[_0x93e4('0x35')][_0x93e4('0x50')](_0x5b5406)[_0x93e4('0x2d')](handleEntityNotFound(_0x2ff565,null))[_0x93e4('0x2d')](function(_0x2f386e){if(_0x2f386e){var _0x50b731=_0x2f386e[_0x93e4('0x51')]({'plain':!![]});_0x50b731=qs[_0x93e4('0x52')](_0x50b731,['id',_0x93e4('0x53'),_0x93e4('0x54')]);_0x5011cc[_0x93e4('0x55')]=_[_0x93e4('0x52')](_0x5011cc[_0x93e4('0x55')],['id',_0x93e4('0x53'),_0x93e4('0x54')]);return db[_0x93e4('0x35')][_0x93e4('0x56')](_[_0x93e4('0x48')](_0x50b731,_0x5011cc['body']),{'include':_0x5011cc[_0x93e4('0x3b')][_0x93e4('0x4b')]?[{'all':!![]}]:undefined})[_0x93e4('0x2d')](function(_0x4da8a3){var _0x4804ad=_0x5011cc[_0x93e4('0x57')][_0x93e4('0x51')]({'plain':!![]});if(!_0x4804ad)throw new Error(_0x93e4('0x58'));if(_0x4804ad['role']==='user'){var _0x4c7eec=_0x4da8a3['get']({'plain':!![]});var _0xc13650=_0x93e4('0x2f');return db[_0x93e4('0x59')]['find']({'where':{'name':_0xc13650,'userProfileId':_0x4804ad['userProfileId']},'raw':!![]})['then'](function(_0x2db77d){if(_0x2db77d&&_0x2db77d[_0x93e4('0x5a')]===0x0){return db[_0x93e4('0x30')]['create']({'name':_0x4c7eec['name'],'resourceId':_0x4c7eec['id'],'type':_0x2db77d[_0x93e4('0x32')],'sectionId':_0x2db77d['id']},{})['then'](function(){return _0x4da8a3;});}else{return _0x4da8a3;}})[_0x93e4('0x23')](function(_0x54c4ff){logger['error'](_0x93e4('0x5b'),_0x54c4ff);throw _0x54c4ff;});}return _0x4da8a3;});}})[_0x93e4('0x2d')](respondWithResult(_0x2ff565,0xc9))[_0x93e4('0x23')](handleError(_0x2ff565,null));};exports['create']=function(_0x5a3c08,_0x402fef,_0xfed0ff){var _0x5a378a;return db['Trunk'][_0x93e4('0x56')](_0x5a3c08[_0x93e4('0x55')],{'raw':!![]})[_0x93e4('0x2d')](function(_0x4e065f){_0x5a378a=_0x4e065f;return db[_0x93e4('0x35')][_0x93e4('0x5c')]({'raw':!![]});})[_0x93e4('0x2d')](function(_0x418f9a){var _0x35082a=fs[_0x93e4('0x5d')](path['join'](config[_0x93e4('0x5e')],_0x93e4('0x5f')),_0x93e4('0x60'));var _0x3c6a2a=fs[_0x93e4('0x5d')](path[_0x93e4('0x61')](config[_0x93e4('0x5e')],_0x93e4('0x62')),'utf8');var _0x134be4=ejs[_0x93e4('0x63')](_0x35082a,{'trunks':_0x418f9a||[]});fs[_0x93e4('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x134be4);if(_0x5a378a[_0x93e4('0x65')]){var _0x17761b=ejs[_0x93e4('0x63')](_0x3c6a2a,{'trunks':_0x418f9a||[]});fs[_0x93e4('0x64')](_0x93e4('0x66'),_0x17761b);}})[_0x93e4('0x2d')](function(){return respondWithRpcPromise(_0x93e4('0x67'),'create',{'module':_0x93e4('0x68')});})[_0x93e4('0x2d')](function(){var _0x514612=_0x5a3c08['user'][_0x93e4('0x51')]({'plain':!![]});if(!_0x514612)throw new Error(_0x93e4('0x58'));if(_0x514612[_0x93e4('0x69')]===_0x93e4('0x57')){var _0x39fb0d=_0x5a378a[_0x93e4('0x51')]({'plain':!![]});return db[_0x93e4('0x59')][_0x93e4('0x50')]({'where':{'name':_0x93e4('0x2f'),'userProfileId':_0x514612[_0x93e4('0x6a')]},'raw':!![]})[_0x93e4('0x2d')](function(_0x2e679e){if(_0x2e679e&&_0x2e679e[_0x93e4('0x5a')]===0x0){return db[_0x93e4('0x30')][_0x93e4('0x56')]({'name':_0x39fb0d[_0x93e4('0x32')],'resourceId':_0x39fb0d['id'],'type':_0x2e679e[_0x93e4('0x32')],'sectionId':_0x2e679e['id']},{})['then'](function(){return _0x5a378a;});}else{return _0x5a378a;}})['catch'](function(_0x4fbdc4){logger[_0x93e4('0x1f')](_0x93e4('0x5b'),_0x4fbdc4);throw _0x4fbdc4;});}return _0x5a378a;})[_0x93e4('0x2d')](respondWithResult(_0x402fef,0xc9))[_0x93e4('0x23')](handleError(_0x402fef,null));};exports[_0x93e4('0x2c')]=function(_0x90000f,_0x392feb,_0x2b53d1){var _0x4ab5c4;return db[_0x93e4('0x35')][_0x93e4('0x50')]({'where':{'id':_0x90000f['params']['id']}})['then'](handleEntityNotFound(_0x392feb,null))[_0x93e4('0x2d')](saveUpdates(_0x90000f[_0x93e4('0x55')],null))[_0x93e4('0x2d')](function(_0x31072a){if(_0x31072a){_0x4ab5c4=_0x31072a;return db[_0x93e4('0x35')][_0x93e4('0x5c')]({'raw':!![]});}})['then'](function(_0x51f16c){if(_0x51f16c){var _0x3d3c03=fs['readFileSync'](path[_0x93e4('0x61')](config[_0x93e4('0x5e')],_0x93e4('0x5f')),_0x93e4('0x60'));var _0x176c29=fs[_0x93e4('0x5d')](path[_0x93e4('0x61')](config[_0x93e4('0x5e')],'server/files/templates/registry.ejs'),'utf8');var _0x97f57c=ejs[_0x93e4('0x63')](_0x3d3c03,{'trunks':_0x51f16c||[]});fs[_0x93e4('0x64')](_0x93e4('0x6b'),_0x97f57c);var _0x5a8e1a=ejs[_0x93e4('0x63')](_0x176c29,{'trunks':_0x51f16c||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x5a8e1a);return respondWithRpcPromise(_0x93e4('0x67'),_0x93e4('0x2c'),{'module':_0x93e4('0x68')});}return null;})[_0x93e4('0x2d')](function(_0x26b3e8){if(_0x26b3e8){return _0x4ab5c4;}})[_0x93e4('0x2d')](respondWithResult(_0x392feb,null))[_0x93e4('0x23')](handleError(_0x392feb,null));};exports[_0x93e4('0x2e')]=function(_0x3dcade,_0x3d09ed,_0x26a2f1){var _0x32c09a;return db[_0x93e4('0x35')][_0x93e4('0x50')]({'where':{'id':_0x3dcade[_0x93e4('0x4f')]['id']}})[_0x93e4('0x2d')](handleEntityNotFound(_0x3d09ed,null))[_0x93e4('0x2d')](removeEntity(_0x3d09ed,null))[_0x93e4('0x2d')](function(){return db[_0x93e4('0x35')][_0x93e4('0x5c')]({'raw':!![]});})[_0x93e4('0x2d')](function(_0x2bf09f){var _0x445c0b=fs[_0x93e4('0x5d')](path['join'](config[_0x93e4('0x5e')],'server/files/templates/trunk.ejs'),_0x93e4('0x60'));var _0x32acbb=fs['readFileSync'](path[_0x93e4('0x61')](config['root'],_0x93e4('0x62')),_0x93e4('0x60'));var _0x1faf09=ejs[_0x93e4('0x63')](_0x445c0b,{'trunks':_0x2bf09f});var _0x195a5a=ejs[_0x93e4('0x63')](_0x32acbb,{'trunks':_0x2bf09f});fs[_0x93e4('0x64')](_0x93e4('0x6b'),_0x1faf09);fs['writeFileSync'](_0x93e4('0x66'),_0x195a5a);return respondWithRpcPromise(_0x93e4('0x67'),_0x93e4('0x2e'),{'module':_0x93e4('0x68')});})[_0x93e4('0x23')](handleError(_0x3d09ed,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index be13a90..1a311bd 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 _0x1717=['path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','util','../../config/logger','bluebird','request-promise'];(function(_0x4d3147,_0x314169){var _0xd957e1=function(_0x12285d){while(--_0x12285d){_0x4d3147['push'](_0x4d3147['shift']());}};_0xd957e1(++_0x314169);}(_0x1717,0x15a));var _0x7171=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0x1717[_0x214a25];return _0x405988;};'use strict';var _=require('lodash');var util=require(_0x7171('0x0'));var logger=require(_0x7171('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7171('0x2'));var rp=require(_0x7171('0x3'));var fs=require('fs');var path=require(_0x7171('0x4'));var rimraf=require(_0x7171('0x5'));var config=require(_0x7171('0x6'));var attributes=require(_0x7171('0x7'));module['exports']=function(_0x47815c,_0x392e72){return _0x47815c[_0x7171('0x8')](_0x7171('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcc5=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4b36bd,_0x25a84a){var _0xb4a41f=function(_0x51b264){while(--_0x51b264){_0x4b36bd['push'](_0x4b36bd['shift']());}};_0xb4a41f(++_0x25a84a);}(_0xbcc5,0x1e6));var _0x5bcc=function(_0xb662bc,_0x32d3d9){_0xb662bc=_0xb662bc-0x0;var _0x4efa69=_0xbcc5[_0xb662bc];return _0x4efa69;};'use strict';var _=require(_0x5bcc('0x0'));var util=require('util');var logger=require(_0x5bcc('0x1'))(_0x5bcc('0x2'));var moment=require(_0x5bcc('0x3'));var BPromise=require(_0x5bcc('0x4'));var rp=require(_0x5bcc('0x5'));var fs=require('fs');var path=require(_0x5bcc('0x6'));var rimraf=require('rimraf');var config=require(_0x5bcc('0x7'));var attributes=require(_0x5bcc('0x8'));module[_0x5bcc('0x9')]=function(_0x579467,_0x2a6821){return _0x579467[_0x5bcc('0xa')](_0x5bcc('0xb'),attributes,{'tableName':_0x5bcc('0xc'),'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 68faf00..d734be9 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 _0x1a85=['info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','options','raw','where','limit','include','model','map','attributes','then','ShowTrunk','find','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x1a85,0x178));var _0x51a8=function(_0x4271f1,_0xdbdc80){_0x4271f1=_0x4271f1-0x0;var _0x1bc9c9=_0x1a85[_0x4271f1];return _0x1bc9c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Trunk,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['findAll']({'raw':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x16')]===undefined?!![]:![]:!![],'where':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x17')]||null:null,'attributes':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')]['attributes']||null:null,'limit':_0x45a433[_0x51a8('0x15')]?_0x45a433['options'][_0x51a8('0x18')]||null:null,'include':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x19')]?_['map'](_0x45a433[_0x51a8('0x15')]['include'],function(_0x47f063){return{'model':db[_0x47f063[_0x51a8('0x1a')]],'as':_0x47f063['as'],'attributes':_0x47f063['attributes'],'include':_0x47f063[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x47f063[_0x51a8('0x19')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1a')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1a')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x1c150d){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger[_0x51a8('0xb')](_0x51a8('0x13'),_0x45a433,JSON[_0x51a8('0xd')](_0x1c150d));_0x23539e(_0x1c150d);})[_0x51a8('0x12')](function(_0x347a02){logger['error'](_0x51a8('0x13'),_0x347a02['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x347a02[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1e')]=function(_0x41df56){var _0x2136b4=this;return new Promise(function(_0x4ea271,_0x10c19b){return db['Trunk'][_0x51a8('0x1f')]({'raw':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x17')]||null:null,'attributes':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')][_0x51a8('0x1c')]||null:null,'include':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x19')]?_['map'](_0x41df56[_0x51a8('0x15')][_0x51a8('0x19')],function(_0x41561a){return{'model':db[_0x41561a['model']],'as':_0x41561a['as'],'attributes':_0x41561a[_0x51a8('0x1c')],'include':_0x41561a[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x41561a[_0x51a8('0x19')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1b')](_0x41c020[_0x51a8('0x19')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1a')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes']};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x38aa25){logger[_0x51a8('0x8')](_0x51a8('0x1e'),_0x41df56);logger[_0x51a8('0xb')](_0x51a8('0x1e'),_0x41df56,JSON['stringify'](_0x38aa25));_0x4ea271(_0x38aa25);})['catch'](function(_0x377b4c){logger['error']('ShowTrunk',_0x377b4c['message'],_0x41df56);_0x10c19b(_0x2136b4[_0x51a8('0xe')](0x1f4,_0x377b4c[_0x51a8('0x10')]));});});}; \ No newline at end of file +var _0x14a0=['limit','include','model','map','find','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x1fa2ed,_0x3bc5b1){var _0x4fbd07=function(_0x4f14ae){while(--_0x4f14ae){_0x1fa2ed['push'](_0x1fa2ed['shift']());}};_0x4fbd07(++_0x3bc5b1);}(_0x14a0,0x8e));var _0x014a=function(_0x1a71cb,_0x5ca695){_0x1a71cb=_0x1a71cb-0x0;var _0x4fb562=_0x14a0[_0x1a71cb];return _0x4fb562;};'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']('Trunk,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Trunk,\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')]('Trunk,\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')]({'raw':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x12d339['options']?_0x12d339[_0x014a('0x18')][_0x014a('0x1a')]||null:null,'attributes':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'limit':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1c')]||null:null,'include':_0x12d339[_0x014a('0x18')]?_0x12d339['options'][_0x014a('0x1d')]?_['map'](_0x12d339[_0x014a('0x18')][_0x014a('0x1d')],function(_0x44d921){return{'model':db[_0x44d921[_0x014a('0x1e')]],'as':_0x44d921['as'],'attributes':_0x44d921[_0x014a('0x1b')],'include':_0x44d921[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x44d921[_0x014a('0x1d')],function(_0x165a42){return{'model':db[_0x165a42['model']],'as':_0x165a42['as'],'attributes':_0x165a42[_0x014a('0x1b')],'include':_0x165a42['include']?_[_0x014a('0x1f')](_0x165a42[_0x014a('0x1d')],function(_0x4f1c44){return{'model':db[_0x4f1c44['model']],'as':_0x4f1c44['as'],'attributes':_0x4f1c44[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x014a('0xa')](function(_0x143346){logger['info'](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')]('GetTrunk',_0x12d339,JSON[_0x014a('0xd')](_0x143346));_0x263b07(_0x143346);})[_0x014a('0x14')](function(_0x496040){logger['error'](_0x014a('0x15'),_0x496040[_0x014a('0x11')],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x496040[_0x014a('0x11')]));});});};exports['ShowTrunk']=function(_0x434038){var _0x147e7e=this;return new Promise(function(_0x15af07,_0x402d3b){return db[_0x014a('0x16')][_0x014a('0x20')]({'raw':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')]['where']||null:null,'attributes':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'include':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x434038['options'][_0x014a('0x1d')],function(_0x325b3c){return{'model':db[_0x325b3c['model']],'as':_0x325b3c['as'],'attributes':_0x325b3c[_0x014a('0x1b')],'include':_0x325b3c[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x325b3c[_0x014a('0x1d')],function(_0x329136){return{'model':db[_0x329136[_0x014a('0x1e')]],'as':_0x329136['as'],'attributes':_0x329136[_0x014a('0x1b')],'include':_0x329136[_0x014a('0x1d')]?_['map'](_0x329136[_0x014a('0x1d')],function(_0x1dfe6e){return{'model':db[_0x1dfe6e[_0x014a('0x1e')]],'as':_0x1dfe6e['as'],'attributes':_0x1dfe6e[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427c7a){logger[_0x014a('0x12')](_0x014a('0x21'),_0x434038);logger[_0x014a('0xb')](_0x014a('0x21'),_0x434038,JSON[_0x014a('0xd')](_0x427c7a));_0x15af07(_0x427c7a);})[_0x014a('0x14')](function(_0x36187b){logger[_0x014a('0xe')]('ShowTrunk',_0x36187b[_0x014a('0x11')],_0x434038);_0x402d3b(_0x147e7e['error'](0x1f4,_0x36187b[_0x014a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index bef0dbe..5fce969 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 _0x23f3=['login','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','join','root','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','/:id/login'];(function(_0x18a949,_0x1ca155){var _0x163531=function(_0x417448){while(--_0x417448){_0x18a949['push'](_0x18a949['shift']());}};_0x163531(++_0x1ca155);}(_0x23f3,0xa1));var _0x323f=function(_0x59336,_0x34df89){_0x59336=_0x59336-0x0;var _0x3fd116=_0x23f3[_0x59336];return _0x3fd116;};'use strict';var multer=require(_0x323f('0x0'));var util=require('util');var path=require(_0x323f('0x1'));var timeout=require('connect-timeout');var express=require(_0x323f('0x2'));var router=express[_0x323f('0x3')]();var auth=require(_0x323f('0x4'));var interaction=require(_0x323f('0x5'));var config=require(_0x323f('0x6'));var controller=require('./user.controller');router['get']('/',auth[_0x323f('0x7')](),controller[_0x323f('0x8')]);router[_0x323f('0x9')](_0x323f('0xa'),auth['isAuthenticated'](),controller[_0x323f('0xb')]);router['get'](_0x323f('0xc'),auth['isAuthenticated'](),controller[_0x323f('0xd')]);router['get'](_0x323f('0xe'),auth[_0x323f('0x7')](),controller[_0x323f('0xf')]);router[_0x323f('0x9')](_0x323f('0x10'),auth[_0x323f('0x7')](),controller[_0x323f('0x11')]);router['get'](_0x323f('0x12'),controller[_0x323f('0x13')]);router[_0x323f('0x9')](_0x323f('0x14'),auth[_0x323f('0x7')](),controller[_0x323f('0x15')]);router[_0x323f('0x9')](_0x323f('0x16'),auth[_0x323f('0x7')](),controller[_0x323f('0x17')]);router[_0x323f('0x9')](_0x323f('0x18'),auth[_0x323f('0x7')](),controller['getVoiceQueuesRt']);router[_0x323f('0x9')]('/:id/groups',auth['isAuthenticated'](),controller[_0x323f('0x19')]);router[_0x323f('0x9')](_0x323f('0x1a'),auth['isAuthenticated'](),controller[_0x323f('0x1b')]);router['get'](_0x323f('0x1c'),auth[_0x323f('0x7')](),controller[_0x323f('0x1d')]);router[_0x323f('0x9')](_0x323f('0x1e'),auth[_0x323f('0x7')](),controller[_0x323f('0x1f')]);router[_0x323f('0x9')](_0x323f('0x20'),auth[_0x323f('0x7')](),controller['getOpenchannelInteractions']);router[_0x323f('0x9')](_0x323f('0x21'),auth[_0x323f('0x7')](),controller[_0x323f('0x22')]);router['get'](_0x323f('0x23'),auth[_0x323f('0x7')](),controller['getSmsInteractions']);router[_0x323f('0x9')](_0x323f('0x24'),auth[_0x323f('0x7')](),controller[_0x323f('0x25')]);router['get'](_0x323f('0x26'),auth['isAuthenticated'](),controller[_0x323f('0x27')]);router[_0x323f('0x9')](_0x323f('0x28'),auth[_0x323f('0x7')](),controller[_0x323f('0x29')]);router['get'](_0x323f('0x2a'),auth['isAuthenticated'](),controller[_0x323f('0x2b')]);router[_0x323f('0x9')]('/:id/agents',auth[_0x323f('0x7')](),controller[_0x323f('0x2c')]);router[_0x323f('0x9')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x323f('0x2d')]);router[_0x323f('0x9')](_0x323f('0x2e'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0x323f('0x9')](_0x323f('0x2f'),auth[_0x323f('0x7')](),controller[_0x323f('0x30')]);router[_0x323f('0x9')](_0x323f('0x31'),auth['isAuthenticated'](),controller[_0x323f('0x32')]);router['get'](_0x323f('0x33'),auth[_0x323f('0x7')](),controller['getSmsAccounts']);router[_0x323f('0x9')](_0x323f('0x34'),auth[_0x323f('0x7')](),controller[_0x323f('0x35')]);router[_0x323f('0x9')](_0x323f('0x36'),auth[_0x323f('0x7')](),controller['getWhatsappAccounts']);router[_0x323f('0x9')](_0x323f('0x37'),auth[_0x323f('0x7')](),controller[_0x323f('0x38')]);router['get'](_0x323f('0x39'),auth[_0x323f('0x7')](),controller[_0x323f('0x3a')]);router['get'](_0x323f('0x3b'),auth['isAuthenticated'](),controller[_0x323f('0x3c')]);router[_0x323f('0x3d')](_0x323f('0x14'),auth[_0x323f('0x7')](),controller[_0x323f('0x3e')]);router[_0x323f('0x3d')]('/',auth[_0x323f('0x7')](),controller[_0x323f('0x3f')]);router[_0x323f('0x3d')](_0x323f('0x40'),auth[_0x323f('0x7')](),controller[_0x323f('0x41')]);router[_0x323f('0x3d')](_0x323f('0x16'),auth[_0x323f('0x7')](),controller[_0x323f('0x42')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d06e2,_0x4872f5,_0x5a4340){_0x5a4340(null,path[_0x323f('0x43')](config[_0x323f('0x44')],_0x323f('0x45')));},'filename':function(_0x584b14,_0x572b4d,_0x2d6c83){_0x2d6c83(null,util[_0x323f('0x46')](_0x323f('0x47'),Date['now'](),_0x572b4d[_0x323f('0x48')]));}})});router[_0x323f('0x3d')]('/:id/avatar',upload[_0x323f('0x49')](_0x323f('0x4a')),controller[_0x323f('0x4b')]);router[_0x323f('0x3d')](_0x323f('0x4c'),auth[_0x323f('0x7')](),controller[_0x323f('0x4d')]);router['post']('/:id/logout',auth['isAuthenticated'](),controller[_0x323f('0x4e')]);router[_0x323f('0x3d')]('/:id/pause',auth[_0x323f('0x7')](),controller[_0x323f('0x4f')]);router[_0x323f('0x3d')](_0x323f('0x50'),auth[_0x323f('0x7')](),controller[_0x323f('0x51')]);router['post'](_0x323f('0x28'),auth[_0x323f('0x7')](),controller[_0x323f('0x52')]);router[_0x323f('0x3d')](_0x323f('0x53'),auth[_0x323f('0x7')](),controller['addChatInteractions']);router[_0x323f('0x3d')](_0x323f('0x54'),auth[_0x323f('0x7')](),controller[_0x323f('0x55')]);router['post'](_0x323f('0x56'),auth[_0x323f('0x7')](),controller[_0x323f('0x57')]);router[_0x323f('0x3d')](_0x323f('0x58'),auth[_0x323f('0x7')](),controller[_0x323f('0x59')]);router[_0x323f('0x3d')](_0x323f('0x5a'),auth[_0x323f('0x7')](),controller[_0x323f('0x5b')]);router['post'](_0x323f('0x5c'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router['post'](_0x323f('0x2e'),auth[_0x323f('0x7')](),controller['addFaxAccounts']);router['post'](_0x323f('0x2f'),auth[_0x323f('0x7')](),controller[_0x323f('0x5d')]);router[_0x323f('0x3d')](_0x323f('0x31'),auth[_0x323f('0x7')](),controller[_0x323f('0x5e')]);router['post'](_0x323f('0x33'),auth[_0x323f('0x7')](),controller[_0x323f('0x5f')]);router[_0x323f('0x3d')](_0x323f('0x34'),auth[_0x323f('0x7')](),controller[_0x323f('0x60')]);router[_0x323f('0x3d')](_0x323f('0x36'),auth[_0x323f('0x7')](),controller['addWhatsappAccounts']);router[_0x323f('0x3d')]('/:id/square_projects',auth[_0x323f('0x7')](),controller[_0x323f('0x61')]);router[_0x323f('0x3d')](_0x323f('0x3b'),auth[_0x323f('0x7')](),controller[_0x323f('0x62')]);router[_0x323f('0x63')](_0x323f('0x10'),auth[_0x323f('0x7')](),controller[_0x323f('0x64')]);router['put'](_0x323f('0x65'),auth[_0x323f('0x7')](),controller[_0x323f('0x66')]);router[_0x323f('0x67')](_0x323f('0x16'),auth['isAuthenticated'](),controller[_0x323f('0x68')]);router['delete'](_0x323f('0x28'),auth[_0x323f('0x7')](),controller[_0x323f('0x69')]);router[_0x323f('0x67')](_0x323f('0x10'),auth[_0x323f('0x7')](),controller[_0x323f('0x6a')]);router['delete'](_0x323f('0x53'),auth[_0x323f('0x7')](),controller[_0x323f('0x6b')]);router['delete']('/:id/mail_interactions',auth[_0x323f('0x7')](),controller[_0x323f('0x6c')]);router[_0x323f('0x67')](_0x323f('0x56'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router['delete'](_0x323f('0x58'),auth[_0x323f('0x7')](),controller[_0x323f('0x6d')]);router[_0x323f('0x67')](_0x323f('0x5a'),auth[_0x323f('0x7')](),controller[_0x323f('0x6e')]);router['delete'](_0x323f('0x5c'),auth['isAuthenticated'](),controller[_0x323f('0x6f')]);router[_0x323f('0x67')](_0x323f('0x2e'),auth[_0x323f('0x7')](),controller[_0x323f('0x70')]);router[_0x323f('0x67')](_0x323f('0x2f'),auth['isAuthenticated'](),controller[_0x323f('0x71')]);router[_0x323f('0x67')](_0x323f('0x31'),auth[_0x323f('0x7')](),controller[_0x323f('0x72')]);router[_0x323f('0x67')](_0x323f('0x33'),auth['isAuthenticated'](),controller[_0x323f('0x73')]);router[_0x323f('0x67')]('/:id/chat_websites',auth[_0x323f('0x7')](),controller['removeChatWebsites']);router['delete']('/:id/whatsapp_accounts',auth[_0x323f('0x7')](),controller[_0x323f('0x74')]);router['delete'](_0x323f('0x37'),auth[_0x323f('0x7')](),controller[_0x323f('0x75')]);router[_0x323f('0x67')](_0x323f('0x3b'),auth[_0x323f('0x7')](),controller[_0x323f('0x76')]);module['exports']=router; \ No newline at end of file +var _0x0288=['/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','put','/:id','update','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','whoami','/presence','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','getQueues','getVoiceQueuesRt','getGroups','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','post','addContacts','create','bulkCreate','/:id/queues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams'];(function(_0x4a7449,_0x1b2dd6){var _0x2a5224=function(_0x3d503c){while(--_0x3d503c){_0x4a7449['push'](_0x4a7449['shift']());}};_0x2a5224(++_0x1b2dd6);}(_0x0288,0x109));var _0x8028=function(_0xbd4254,_0x31c08b){_0xbd4254=_0xbd4254-0x0;var _0x46c0f3=_0x0288[_0xbd4254];return _0x46c0f3;};'use strict';var multer=require(_0x8028('0x0'));var util=require(_0x8028('0x1'));var path=require(_0x8028('0x2'));var timeout=require(_0x8028('0x3'));var express=require(_0x8028('0x4'));var router=express[_0x8028('0x5')]();var auth=require(_0x8028('0x6'));var interaction=require(_0x8028('0x7'));var config=require(_0x8028('0x8'));var controller=require(_0x8028('0x9'));router[_0x8028('0xa')]('/',auth[_0x8028('0xb')](),controller['index']);router['get'](_0x8028('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x8028('0xa')]('/whoami',auth[_0x8028('0xb')](),controller[_0x8028('0xd')]);router[_0x8028('0xa')](_0x8028('0xe'),auth[_0x8028('0xb')](),controller['getPresence']);router[_0x8028('0xa')]('/:id',auth[_0x8028('0xb')](),controller[_0x8028('0xf')]);router[_0x8028('0xa')](_0x8028('0x10'),controller[_0x8028('0x11')]);router['get'](_0x8028('0x12'),auth['isAuthenticated'](),controller[_0x8028('0x13')]);router[_0x8028('0xa')]('/:id/queues',auth[_0x8028('0xb')](),controller[_0x8028('0x14')]);router[_0x8028('0xa')]('/:id/queues_rt',auth[_0x8028('0xb')](),controller[_0x8028('0x15')]);router[_0x8028('0xa')]('/:id/groups',auth[_0x8028('0xb')](),controller[_0x8028('0x16')]);router[_0x8028('0xa')]('/:id/recordings',auth[_0x8028('0xb')](),controller['getRecordings']);router[_0x8028('0xa')](_0x8028('0x17'),auth[_0x8028('0xb')](),controller['getScreenRecordings']);router[_0x8028('0xa')](_0x8028('0x18'),auth['isAuthenticated'](),controller[_0x8028('0x19')]);router['get']('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x8028('0x1a')]);router[_0x8028('0xa')](_0x8028('0x1b'),auth[_0x8028('0xb')](),controller['getMailInteractions']);router['get'](_0x8028('0x1c'),auth['isAuthenticated'](),controller[_0x8028('0x1d')]);router[_0x8028('0xa')](_0x8028('0x1e'),auth[_0x8028('0xb')](),controller[_0x8028('0x1f')]);router[_0x8028('0xa')](_0x8028('0x20'),auth[_0x8028('0xb')](),controller[_0x8028('0x21')]);router[_0x8028('0xa')](_0x8028('0x22'),auth[_0x8028('0xb')](),controller[_0x8028('0x23')]);router['get'](_0x8028('0x24'),auth[_0x8028('0xb')](),controller[_0x8028('0x25')]);router[_0x8028('0xa')](_0x8028('0x26'),auth[_0x8028('0xb')](),controller['getAgents']);router['get'](_0x8028('0x27'),auth['isAuthenticated'](),controller[_0x8028('0x28')]);router[_0x8028('0xa')](_0x8028('0x29'),auth[_0x8028('0xb')](),controller[_0x8028('0x2a')]);router[_0x8028('0xa')](_0x8028('0x2b'),auth['isAuthenticated'](),controller[_0x8028('0x2c')]);router[_0x8028('0xa')](_0x8028('0x2d'),auth[_0x8028('0xb')](),controller[_0x8028('0x2e')]);router['get'](_0x8028('0x2f'),auth[_0x8028('0xb')](),controller[_0x8028('0x30')]);router[_0x8028('0xa')](_0x8028('0x31'),auth[_0x8028('0xb')](),controller[_0x8028('0x32')]);router[_0x8028('0xa')]('/:id/whatsapp_accounts',auth[_0x8028('0xb')](),controller[_0x8028('0x33')]);router[_0x8028('0xa')](_0x8028('0x34'),auth['isAuthenticated'](),controller[_0x8028('0x35')]);router[_0x8028('0xa')]('/:id/scheduled_calls',auth[_0x8028('0xb')](),controller['getScheduledCalls']);router[_0x8028('0xa')]('/:id/api_key',auth[_0x8028('0xb')](),controller['getApiKey']);router[_0x8028('0x36')]('/:id/contacts',auth[_0x8028('0xb')](),controller[_0x8028('0x37')]);router[_0x8028('0x36')]('/',auth[_0x8028('0xb')](),controller[_0x8028('0x38')]);router[_0x8028('0x36')]('/create_many',auth[_0x8028('0xb')](),controller[_0x8028('0x39')]);router['post'](_0x8028('0x3a'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x8028('0x3b')]({'destination':function(_0x569f44,_0x2dbfcd,_0x30c6e7){_0x30c6e7(null,path[_0x8028('0x3c')](config[_0x8028('0x3d')],_0x8028('0x3e')));},'filename':function(_0x46bf24,_0x467add,_0x12d4c6){_0x12d4c6(null,util[_0x8028('0x3f')](_0x8028('0x40'),Date[_0x8028('0x41')](),_0x467add['originalname']));}})});router[_0x8028('0x36')](_0x8028('0x10'),upload[_0x8028('0x42')](_0x8028('0x43')),controller[_0x8028('0x44')]);router[_0x8028('0x36')](_0x8028('0x45'),auth[_0x8028('0xb')](),controller[_0x8028('0x46')]);router[_0x8028('0x36')](_0x8028('0x47'),auth[_0x8028('0xb')](),controller['logout']);router['post'](_0x8028('0x48'),auth[_0x8028('0xb')](),controller[_0x8028('0x49')]);router[_0x8028('0x36')](_0x8028('0x4a'),auth['isAuthenticated'](),controller[_0x8028('0x4b')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x8028('0x4c')]);router[_0x8028('0x36')](_0x8028('0x4d'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x8028('0x36')](_0x8028('0x4e'),auth[_0x8028('0xb')](),controller[_0x8028('0x4f')]);router[_0x8028('0x36')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x8028('0x50')]);router[_0x8028('0x36')]('/:id/sms_interactions',auth[_0x8028('0xb')](),controller['addSmsInteractions']);router['post'](_0x8028('0x51'),auth[_0x8028('0xb')](),controller[_0x8028('0x52')]);router[_0x8028('0x36')](_0x8028('0x53'),auth[_0x8028('0xb')](),controller[_0x8028('0x54')]);router[_0x8028('0x36')](_0x8028('0x29'),auth[_0x8028('0xb')](),controller[_0x8028('0x55')]);router[_0x8028('0x36')](_0x8028('0x2b'),auth[_0x8028('0xb')](),controller[_0x8028('0x56')]);router[_0x8028('0x36')](_0x8028('0x2d'),auth['isAuthenticated'](),controller[_0x8028('0x57')]);router[_0x8028('0x36')](_0x8028('0x2f'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x8028('0x36')](_0x8028('0x31'),auth[_0x8028('0xb')](),controller[_0x8028('0x58')]);router[_0x8028('0x36')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x8028('0x59')]);router[_0x8028('0x36')]('/:id/square_projects',auth[_0x8028('0xb')](),controller['addSquareProjects']);router[_0x8028('0x36')](_0x8028('0x5a'),auth[_0x8028('0xb')](),controller[_0x8028('0x5b')]);router[_0x8028('0x5c')](_0x8028('0x5d'),auth['isAuthenticated'](),controller[_0x8028('0x5e')]);router[_0x8028('0x5c')](_0x8028('0x5f'),auth['isAuthenticated'](),controller['changePassword']);router[_0x8028('0x60')]('/:id/queues',auth[_0x8028('0xb')](),controller[_0x8028('0x61')]);router[_0x8028('0x60')](_0x8028('0x22'),auth[_0x8028('0xb')](),controller[_0x8028('0x62')]);router['delete']('/:id',auth[_0x8028('0xb')](),controller[_0x8028('0x63')]);router[_0x8028('0x60')](_0x8028('0x4d'),auth['isAuthenticated'](),controller[_0x8028('0x64')]);router['delete'](_0x8028('0x4e'),auth[_0x8028('0xb')](),controller[_0x8028('0x65')]);router[_0x8028('0x60')](_0x8028('0x66'),auth[_0x8028('0xb')](),controller[_0x8028('0x67')]);router['delete']('/:id/sms_interactions',auth[_0x8028('0xb')](),controller['removeSmsInteractions']);router[_0x8028('0x60')](_0x8028('0x51'),auth[_0x8028('0xb')](),controller[_0x8028('0x68')]);router[_0x8028('0x60')]('/:id/whatsapp_interactions',auth[_0x8028('0xb')](),controller[_0x8028('0x69')]);router[_0x8028('0x60')](_0x8028('0x29'),auth[_0x8028('0xb')](),controller[_0x8028('0x6a')]);router['delete'](_0x8028('0x2b'),auth['isAuthenticated'](),controller[_0x8028('0x6b')]);router[_0x8028('0x60')](_0x8028('0x2d'),auth[_0x8028('0xb')](),controller[_0x8028('0x6c')]);router[_0x8028('0x60')](_0x8028('0x2f'),auth[_0x8028('0xb')](),controller[_0x8028('0x6d')]);router[_0x8028('0x60')](_0x8028('0x31'),auth[_0x8028('0xb')](),controller[_0x8028('0x6e')]);router[_0x8028('0x60')](_0x8028('0x6f'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router['delete'](_0x8028('0x34'),auth[_0x8028('0xb')](),controller['removeSquareProjects']);router['delete'](_0x8028('0x5a'),auth[_0x8028('0xb')](),controller[_0x8028('0x70')]);module[_0x8028('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 69c461c..4c8e83a 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 _0x1caa=['permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','lodash','exports','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','email','toLowerCase','ENUM','admin','user','agent','telephone','accountcode','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','rfc2833','info','shortinfo','inband','auto','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','refuse','originate','uac','certificate','active','passive','nonat','update,nonat','showWebBar','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT'];(function(_0x4d2c26,_0x2701f9){var _0x5bf9b4=function(_0x52edc6){while(--_0x52edc6){_0x4d2c26['push'](_0x4d2c26['shift']());}};_0x5bf9b4(++_0x2701f9);}(_0x1caa,0x16e));var _0xa1ca=function(_0x38ac3a,_0x2ce202){_0x38ac3a=_0x38ac3a-0x0;var _0x3ab9a0=_0x1caa[_0x38ac3a];return _0x3ab9a0;};'use strict';var Sequelize=require(_0xa1ca('0x0'));var moment=require(_0xa1ca('0x1'));var util=require('util');var _=require(_0xa1ca('0x2'));module[_0xa1ca('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa1ca('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x55885c){this['setDataValue'](_0xa1ca('0x4'),_0x55885c);this[_0xa1ca('0x5')]('defaultuser',_0x55885c);},'comment':_0xa1ca('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x15f26b){this['setDataValue'](_0xa1ca('0x7'),_0x15f26b);this[_0xa1ca('0x5')](_0xa1ca('0x8'),util['format'](_0xa1ca('0x9'),_0x15f26b,this[_0xa1ca('0xa')](_0xa1ca('0xb'))));}},'alias':{'type':Sequelize[_0xa1ca('0xc')]},'email':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':![],'unique':_0xa1ca('0xd'),'validate':{'isEmail':!![]},'set':function(_0x230bea){if(_0x230bea){this[_0xa1ca('0x5')]('email',_0x230bea[_0xa1ca('0xe')]());}}},'role':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x10'),_0xa1ca('0x11'),_0xa1ca('0x12'),_0xa1ca('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xa1ca('0xb'),'set':function(_0x2a7a9c){this[_0xa1ca('0x5')](_0xa1ca('0xb'),_0x2a7a9c);this['setDataValue'](_0xa1ca('0x14'),_0x2a7a9c);this[_0xa1ca('0x5')](_0xa1ca('0x8'),util[_0xa1ca('0x15')](_0xa1ca('0x9'),this[_0xa1ca('0xa')]('fullname'),_0x2a7a9c));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xa1ca('0xc')]},'zipcode':{'type':Sequelize[_0xa1ca('0xc')]},'userpic':{'type':Sequelize[_0xa1ca('0xc')]},'city':{'type':Sequelize[_0xa1ca('0xc')]},'country':{'type':Sequelize[_0xa1ca('0xc')]},'online':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa1ca('0x17')]},'voicePause':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa1ca('0xc')],'defaultValue':_0xa1ca('0x18')},'lastPauseAt':{'type':Sequelize[_0xa1ca('0x17')]},'chatCapacity':{'type':Sequelize[_0xa1ca('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa1ca('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa1ca('0x19')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xa1ca('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa1ca('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa1ca('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa1ca('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'host':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![],'defaultValue':_0xa1ca('0x1a')},'ipaddr':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x1b'),'user',_0xa1ca('0x1c')),'allowNull':!![],'defaultValue':_0xa1ca('0x1b')},'context':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xa1ca('0xf')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xa1ca('0x1d'),_0xa1ca('0x1e'),_0xa1ca('0x1f'),_0xa1ca('0x20'),_0xa1ca('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![],'defaultValue':_0xa1ca('0x22'),'set':function(_0x3ff66c){this['setDataValue'](_0xa1ca('0x23'),_0x3ff66c?_0x3ff66c[_0xa1ca('0x24')](','):null);},'get':function(){return this[_0xa1ca('0xa')](_0xa1ca('0x23'))?this[_0xa1ca('0xa')](_0xa1ca('0x23'))[_0xa1ca('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x26'),_0xa1ca('0x27'),_0xa1ca('0x28'),_0xa1ca('0x29'),_0xa1ca('0x2a')),'allowNull':!![],'defaultValue':_0xa1ca('0x26')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0xa1ca('0x2b'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa1ca('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![],'defaultValue':_0xa1ca('0x2c'),'set':function(_0x1d4b32){this[_0xa1ca('0x5')](_0xa1ca('0x2d'),_0x1d4b32?_0x1d4b32[_0xa1ca('0x24')](','):null);},'get':function(){return this[_0xa1ca('0xa')](_0xa1ca('0x2d'))?this[_0xa1ca('0xa')](_0xa1ca('0x2d'))[_0xa1ca('0x25')](','):null;},'comment':_0xa1ca('0x2e')},'callgroup':{'type':Sequelize[_0xa1ca('0xc')]},'namedcallgroup':{'type':Sequelize[_0xa1ca('0xc')]},'pickupgroup':{'type':Sequelize[_0xa1ca('0xc')]},'namedpickupgroup':{'type':Sequelize[_0xa1ca('0xc')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa1ca('0xc')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa1ca('0x2f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa1ca('0x30'),'set':function(_0x5ae24e){this[_0xa1ca('0x5')](_0xa1ca('0x31'),_0x5ae24e?_0x5ae24e[_0xa1ca('0x24')](';'):_0xa1ca('0x30'));},'get':function(){return this['getDataValue'](_0xa1ca('0x31'))?this[_0xa1ca('0xa')](_0xa1ca('0x31'))[_0xa1ca('0x25')](';'):null;},'comment':_0xa1ca('0x32')},'autoframing':{'type':Sequelize['ENUM'](_0xa1ca('0x33'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![],'set':function(_0x10b825){this[_0xa1ca('0x5')](_0xa1ca('0x34'),_0x10b825?_0x10b825[_0xa1ca('0x24')](','):null);},'get':function(){return this[_0xa1ca('0xa')](_0xa1ca('0x34'))?this[_0xa1ca('0xa')]('insecure')[_0xa1ca('0x25')](','):null;},'comment':_0xa1ca('0x35')},'trustrpid':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa1ca('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xa1ca('0x33'),'no',_0xa1ca('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![],'defaultValue':_0xa1ca('0x37')},'amaflags':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![],'defaultValue':_0xa1ca('0x33')},'busylevel':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'template':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xa1ca('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x38'),_0xa1ca('0x39'),_0xa1ca('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x3b'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![],'defaultValue':_0xa1ca('0x33')},'keepalive':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa1ca('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa1ca('0xf')]('yes','no','fingerprint',_0xa1ca('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xa1ca('0x3d'),_0xa1ca('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xa1ca('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no',_0xa1ca('0x3f'),_0xa1ca('0x2b'),_0xa1ca('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa1ca('0xc')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xa1ca('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xa1ca('0xc')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x105bbb){this['setDataValue'](_0xa1ca('0x41'),_0x105bbb);var _0x2b8e63=this['get']({'plain':!![]});switch(_0x105bbb){case 0x0:case 0x1:var _0xe126d5=_0x2b8e63['transport']?_[_0xa1ca('0x42')](_0x2b8e63[_0xa1ca('0x23')])?_0x2b8e63[_0xa1ca('0x23')][_0xa1ca('0x24')]():_0x2b8e63[_0xa1ca('0x23')]:_0xa1ca('0x22');if(_0xe126d5===_0xa1ca('0x43')){_0xe126d5=_0xa1ca('0x22');}this['setDataValue'](_0xa1ca('0x23'),_0xe126d5);this[_0xa1ca('0x5')](_0xa1ca('0x44'),'no');this[_0xa1ca('0x5')](_0xa1ca('0x45'),null);this['setDataValue'](_0xa1ca('0x46'),null);this[_0xa1ca('0x5')](_0xa1ca('0x47'),null);this['setDataValue'](_0xa1ca('0x48'),null);this['setDataValue'](_0xa1ca('0x49'),null);this[_0xa1ca('0x5')](_0xa1ca('0x4a'),null);this[_0xa1ca('0x5')](_0xa1ca('0x4b'),null);this[_0xa1ca('0x5')](_0xa1ca('0x4c'),null);this[_0xa1ca('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0xa1ca('0x23'),_0xa1ca('0x43'));this[_0xa1ca('0x5')]('encryption','yes');this['setDataValue'](_0xa1ca('0x45'),_0xa1ca('0x33'));this[_0xa1ca('0x5')](_0xa1ca('0x46'),_0xa1ca('0x33'));this[_0xa1ca('0x5')]('icesupport','yes');this[_0xa1ca('0x5')](_0xa1ca('0x48'),_0xa1ca('0x33'));this['setDataValue'](_0xa1ca('0x49'),'no');this[_0xa1ca('0x5')](_0xa1ca('0x4a'),'actpass');this[_0xa1ca('0x5')]('dtlscertfile',_0x2b8e63[_0xa1ca('0x4b')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0xa1ca('0x4c'),_0x2b8e63['dtlsprivatekey']||_0xa1ca('0x4d'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0xa1ca('0x4e')],'set':function(_0x5d6d09){this[_0xa1ca('0x5')]('permissions',_0x5d6d09?_0x5d6d09[_0xa1ca('0x24')](','):[]);},'get':function(){return this[_0xa1ca('0xa')](_0xa1ca('0x4f'))?_[_0xa1ca('0x50')](this[_0xa1ca('0xa')]('permissions')['split'](','),function(_0x44bf2e){return parseInt(_0x44bf2e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa1ca('0xc')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xa1ca('0xc')]},'phoneBarBusyNumber':{'type':Sequelize[_0xa1ca('0xc')]},'phoneBarUnconditional':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xa1ca('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xa1ca('0xc')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa1ca('0xf')](_0xa1ca('0x33'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa1ca('0xc')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa1ca('0x51')],'get':function(){return this[_0xa1ca('0xa')](_0xa1ca('0x52'))?this[_0xa1ca('0xa')](_0xa1ca('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa1ca('0xc')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xa1ca('0xc')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![],'set':function(_0x24a1fa){if(typeof _0x24a1fa===_0xa1ca('0x53')){var _0x557697=_0x24a1fa==='1'?!![]:_0x24a1fa==='0'?![]:_0x24a1fa==='true'?!![]:_0x24a1fa===_0xa1ca('0x54')?![]:![];this['setDataValue'](_0xa1ca('0x55'),_0x557697);}else{this[_0xa1ca('0x5')](_0xa1ca('0x55'),_0x24a1fa);}}},'blocked':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![],'set':function(_0xf885ae){this['setDataValue'](_0xa1ca('0x56'),_0xf885ae);if(_0xf885ae===!![]){this['setDataValue'](_0xa1ca('0x57'),moment());this[_0xa1ca('0x5')](_0xa1ca('0x58'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xa1ca('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xa1ca('0x16')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0e98=['shortinfo','auto','rfc2833','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','showWebBar','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsverify','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','loginAttempts','sequelize','moment','util','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info'];(function(_0x4a9d82,_0x25f076){var _0x91b408=function(_0x18ca37){while(--_0x18ca37){_0x4a9d82['push'](_0x4a9d82['shift']());}};_0x91b408(++_0x25f076);}(_0x0e98,0xe6));var _0x80e9=function(_0x57fe69,_0x41098d){_0x57fe69=_0x57fe69-0x0;var _0x31565d=_0x0e98[_0x57fe69];return _0x31565d;};'use strict';var Sequelize=require(_0x80e9('0x0'));var moment=require(_0x80e9('0x1'));var util=require(_0x80e9('0x2'));var _=require('lodash');module[_0x80e9('0x3')]={'name':{'type':Sequelize[_0x80e9('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x58d9da){this[_0x80e9('0x5')](_0x80e9('0x6'),_0x58d9da);this['setDataValue'](_0x80e9('0x7'),_0x58d9da);},'comment':_0x80e9('0x8')},'fullname':{'type':Sequelize[_0x80e9('0x4')],'allowNull':![],'set':function(_0x590961){this['setDataValue'](_0x80e9('0x9'),_0x590961);this['setDataValue'](_0x80e9('0xa'),util[_0x80e9('0xb')](_0x80e9('0xc'),_0x590961,this[_0x80e9('0xd')](_0x80e9('0xe'))));}},'alias':{'type':Sequelize[_0x80e9('0x4')]},'email':{'type':Sequelize[_0x80e9('0x4')],'allowNull':![],'unique':_0x80e9('0xf'),'validate':{'isEmail':!![]},'set':function(_0x506a71){if(_0x506a71){this[_0x80e9('0x5')](_0x80e9('0xf'),_0x506a71[_0x80e9('0x10')]());}}},'role':{'type':Sequelize[_0x80e9('0x11')]('admin',_0x80e9('0x12'),_0x80e9('0x13'),_0x80e9('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x80e9('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x80e9('0x15')},'internal':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':![],'unique':_0x80e9('0xe'),'set':function(_0x34f100){this[_0x80e9('0x5')](_0x80e9('0xe'),_0x34f100);this[_0x80e9('0x5')](_0x80e9('0x17'),_0x34f100);this[_0x80e9('0x5')](_0x80e9('0xa'),util[_0x80e9('0xb')](_0x80e9('0xc'),this[_0x80e9('0xd')](_0x80e9('0x9')),_0x34f100));}},'salt':{'type':Sequelize[_0x80e9('0x4')]},'phone':{'type':Sequelize[_0x80e9('0x4')]},'mobile':{'type':Sequelize[_0x80e9('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x80e9('0x4')]},'city':{'type':Sequelize[_0x80e9('0x4')]},'country':{'type':Sequelize[_0x80e9('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x80e9('0x18')]},'voicePause':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x80e9('0x4')],'defaultValue':_0x80e9('0x1a')},'lastPauseAt':{'type':Sequelize[_0x80e9('0x18')]},'chatCapacity':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x80e9('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x80e9('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'description':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![],'defaultValue':_0x80e9('0x1b')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x80e9('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0x80e9('0x12'),_0x80e9('0x1c')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x80e9('0x1d')},'callingpres':{'type':Sequelize['ENUM'](_0x80e9('0x1e'),_0x80e9('0x1f'),_0x80e9('0x20'),_0x80e9('0x21'),'PROHIB_NOT_SCREENED',_0x80e9('0x22'),_0x80e9('0x23'),_0x80e9('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![],'defaultValue':_0x80e9('0x25'),'set':function(_0x228fcb){this[_0x80e9('0x5')](_0x80e9('0x26'),_0x228fcb?_0x228fcb[_0x80e9('0x27')](','):null);},'get':function(){return this[_0x80e9('0xd')]('transport')?this['getDataValue'](_0x80e9('0x26'))[_0x80e9('0x28')](','):null;},'comment':_0x80e9('0x29')},'dtmfmode':{'type':Sequelize[_0x80e9('0x11')]('rfc2833',_0x80e9('0x2a'),_0x80e9('0x2b'),'inband',_0x80e9('0x2c')),'allowNull':!![],'defaultValue':_0x80e9('0x2d')},'directmedia':{'type':Sequelize['ENUM'](_0x80e9('0x2e'),'no',_0x80e9('0x2f'),_0x80e9('0x30'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x1f04d8){this[_0x80e9('0x5')](_0x80e9('0x31'),_0x1f04d8?_0x1f04d8[_0x80e9('0x27')](','):null);},'get':function(){return this[_0x80e9('0xd')]('nat')?this[_0x80e9('0xd')](_0x80e9('0x31'))[_0x80e9('0x28')](','):null;},'comment':_0x80e9('0x32')},'callgroup':{'type':Sequelize[_0x80e9('0x4')]},'namedcallgroup':{'type':Sequelize[_0x80e9('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x80e9('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x80e9('0x4')]},'disallow':{'type':Sequelize[_0x80e9('0x4')],'allowNull':![],'defaultValue':_0x80e9('0x33')},'allow':{'type':Sequelize[_0x80e9('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x36b174){this[_0x80e9('0x5')](_0x80e9('0x34'),_0x36b174?_0x36b174[_0x80e9('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x80e9('0xd')](_0x80e9('0x34'))?this[_0x80e9('0xd')](_0x80e9('0x34'))[_0x80e9('0x28')](';'):null;},'comment':_0x80e9('0x35')},'autoframing':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![],'set':function(_0x2c3373){this['setDataValue'](_0x80e9('0x36'),_0x2c3373?_0x2c3373[_0x80e9('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x80e9('0x36'))?this[_0x80e9('0xd')](_0x80e9('0x36'))[_0x80e9('0x28')](','):null;},'comment':_0x80e9('0x37')},'trustrpid':{'type':Sequelize['ENUM'](_0x80e9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x80e9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no',_0x80e9('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![],'defaultValue':_0x80e9('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x80e9('0x2e'),'no',_0x80e9('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x80e9('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x3a'),_0x80e9('0x3b'),_0x80e9('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x3d'),_0x80e9('0x3e')),'allowNull':!![],'defaultValue':_0x80e9('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x80e9('0x2e')},'keepalive':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x80e9('0x2e'),'no',_0x80e9('0x3f'),_0x80e9('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x80e9('0x41'),'passive',_0x80e9('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x80e9('0x11')]('yes','no',_0x80e9('0x2f'),_0x80e9('0x30'),_0x80e9('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x80e9('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x80e9('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x80e9('0x4')]},'showWebBar':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0,'set':function(_0x4ade57){this['setDataValue'](_0x80e9('0x44'),_0x4ade57);var _0x123601=this['get']({'plain':!![]});switch(_0x4ade57){case 0x0:case 0x1:var _0x421a40=_0x123601[_0x80e9('0x26')]?_[_0x80e9('0x45')](_0x123601['transport'])?_0x123601[_0x80e9('0x26')][_0x80e9('0x27')]():_0x123601[_0x80e9('0x26')]:'udp';if(_0x421a40===_0x80e9('0x46')){_0x421a40='udp';}this[_0x80e9('0x5')](_0x80e9('0x26'),_0x421a40);this[_0x80e9('0x5')](_0x80e9('0x47'),'no');this[_0x80e9('0x5')](_0x80e9('0x48'),null);this['setDataValue'](_0x80e9('0x49'),null);this['setDataValue'](_0x80e9('0x4a'),null);this['setDataValue'](_0x80e9('0x4b'),null);this[_0x80e9('0x5')]('dtlsverify',null);this['setDataValue'](_0x80e9('0x4c'),null);this['setDataValue'](_0x80e9('0x4d'),null);this[_0x80e9('0x5')](_0x80e9('0x4e'),null);this[_0x80e9('0x5')](_0x80e9('0x4f'),'no');break;case 0x2:this[_0x80e9('0x5')](_0x80e9('0x26'),'wss');this[_0x80e9('0x5')]('encryption','yes');this[_0x80e9('0x5')]('avpf','yes');this[_0x80e9('0x5')](_0x80e9('0x49'),_0x80e9('0x2e'));this[_0x80e9('0x5')](_0x80e9('0x4a'),_0x80e9('0x2e'));this[_0x80e9('0x5')](_0x80e9('0x4b'),_0x80e9('0x2e'));this[_0x80e9('0x5')](_0x80e9('0x50'),'no');this[_0x80e9('0x5')](_0x80e9('0x4c'),_0x80e9('0x42'));this[_0x80e9('0x5')](_0x80e9('0x4d'),_0x123601[_0x80e9('0x4d')]||_0x80e9('0x51'));this[_0x80e9('0x5')](_0x80e9('0x4e'),_0x123601[_0x80e9('0x4e')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x80e9('0x4f'),_0x80e9('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0x80e9('0x52')],'set':function(_0x538ee5){this[_0x80e9('0x5')](_0x80e9('0x53'),_0x538ee5?_0x538ee5['join'](','):[]);},'get':function(){return this[_0x80e9('0xd')](_0x80e9('0x53'))?_[_0x80e9('0x54')](this[_0x80e9('0xd')]('permissions')['split'](','),function(_0x32cb12){return parseInt(_0x32cb12,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x80e9('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x80e9('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x80e9('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x80e9('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x80e9('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x80e9('0x55')],'get':function(){return this[_0x80e9('0xd')]('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0x80e9('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'interface':{'type':Sequelize[_0x80e9('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![],'set':function(_0x191da5){if(typeof _0x191da5===_0x80e9('0x57')){var _0x499089=_0x191da5==='1'?!![]:_0x191da5==='0'?![]:_0x191da5===_0x80e9('0x58')?!![]:_0x191da5==='false'?![]:![];this[_0x80e9('0x5')](_0x80e9('0x59'),_0x499089);}else{this[_0x80e9('0x5')](_0x80e9('0x59'),_0x191da5);}}},'blocked':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![],'set':function(_0x46608a){this[_0x80e9('0x5')]('blocked',_0x46608a);if(_0x46608a===!![]){this[_0x80e9('0x5')]('blockedAt',moment());this[_0x80e9('0x5')](_0x80e9('0x5a'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x80e9('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index d991023..a2c06b2 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 _0x17c4=['some','push','all','each','UserProfileSection','findAll','isEmpty','includes','changePassword','oldPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','updatePasswordsHistory','addQueues','channel','online','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','format','SIP/%s','voicePause','UserVoiceQueueRt','removeQueues','remove','toLowerCase','Queue:remove','addAvatar','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','join','order','getContacts','CmList','List','Tag','Tags','color','tag','getQueues','Queue','getVoiceQueuesRt','getGroups','ChatGroup','VoiceRecording','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','UserId','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','whatsapppause','pauseType','lastPauseAt','manual','chat','fax','sms','whatsapp','openchannel','Pause','getTeams','addTeams','omit','Team','getChatQueues','setDataValue','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','getDataValue','Voice','removeTeams','Chat','Whatsapp','getFaxQueues','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','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','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$notLike','$notILike','$like','$overlap','$contains','$contained','$any','firstName','lastName','CmContact','dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','teams','queues','asc','desc','substring','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./user.socket','register','client','http','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','set','Content-Range','apply','save','get','role','admin','Users','user','Agents','agent','Telephones','telephone','map','value','UserProfileResource','destroy','end','stack','name','send','index','User','rawAttributes','fieldName','type','key','model','differenceBy','password','salt','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','sequelize','lower','col','options','count','include','rows','show','includeAll','update','body','find','params','describe','addContacts','ids','findById','securePassword','internal','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','VoiceMail','fullname','email','permissions','101','102','113','110','104','105','106','107','108','109','100','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','userProfileId','autoAssociation','bulkCreate'];(function(_0x4112ae,_0x114cf1){var _0x9e9196=function(_0x7230cb){while(--_0x7230cb){_0x4112ae['push'](_0x4112ae['shift']());}};_0x9e9196(++_0x114cf1);}(_0x17c4,0x102));var _0x417c=function(_0x42fd32,_0x12d3ae){_0x42fd32=_0x42fd32-0x0;var _0x328b6f=_0x17c4[_0x42fd32];return _0x328b6f;};'use strict';var pdf=require(_0x417c('0x0'));var emlformat=require(_0x417c('0x1'));var rimraf=require(_0x417c('0x2'));var zipdir=require(_0x417c('0x3'));var jsonpatch=require(_0x417c('0x4'));var rp=require(_0x417c('0x5'));var moment=require(_0x417c('0x6'));var BPromise=require(_0x417c('0x7'));var Mustache=require(_0x417c('0x8'));var util=require(_0x417c('0x9'));var path=require(_0x417c('0xa'));var sox=require('sox');var csv=require(_0x417c('0xb'));var ejs=require(_0x417c('0xc'));var fs=require('fs');var _=require(_0x417c('0xd'));var squel=require(_0x417c('0xe'));var crypto=require(_0x417c('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x417c('0xb'));var querystring=require(_0x417c('0x10'));var Papa=require(_0x417c('0x11'));var Redis=require(_0x417c('0x12'));var authService=require(_0x417c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x417c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x417c('0x15'))(_0x417c('0x16'));var utils=require(_0x417c('0x17'));var config=require(_0x417c('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x417c('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x417c('0x1a'))(new Redis(config['redis']));require(_0x417c('0x1b'))[_0x417c('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x417c('0x1d')][_0x417c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3feb87,_0x4416c6,_0x509fce,_0x56d121){return new BPromise(function(_0x28bd1d,_0x467999){var _0x3f6058=_0x56d121||client;return _0x3f6058['request'](_0x3feb87,_0x509fce)[_0x417c('0x1f')](function(_0x1f4824){logger[_0x417c('0x20')](_0x417c('0x21'),_0x4416c6,_0x417c('0x22'));logger[_0x417c('0x23')](_0x417c('0x24'),_0x4416c6,_0x417c('0x22'),JSON[_0x417c('0x25')](_0x1f4824));if(_0x1f4824[_0x417c('0x26')]){if(_0x1f4824[_0x417c('0x26')][_0x417c('0x27')]===0x1f4){logger[_0x417c('0x26')](_0x417c('0x21'),_0x4416c6,_0x1f4824[_0x417c('0x26')][_0x417c('0x28')]);return _0x467999(_0x1f4824[_0x417c('0x26')][_0x417c('0x28')]);}logger[_0x417c('0x26')](_0x417c('0x21'),_0x4416c6,_0x1f4824[_0x417c('0x26')][_0x417c('0x28')]);return _0x28bd1d(_0x1f4824['error']['message']);}else{logger[_0x417c('0x20')](_0x417c('0x21'),_0x4416c6,_0x417c('0x22'));_0x28bd1d(_0x1f4824[_0x417c('0x29')][_0x417c('0x28')]);}})[_0x417c('0x2a')](function(_0x1a8a70){logger[_0x417c('0x26')](_0x417c('0x21'),_0x4416c6,_0x1a8a70);_0x467999(_0x1a8a70);});});}function respondWithStatusCode(_0x482b3f,_0x243066){_0x243066=_0x243066||0xcc;return function(_0x428480){if(_0x428480){return _0x482b3f['sendStatus'](_0x243066);}return _0x482b3f['status'](_0x243066)['end']();};}function respondWithResult(_0x632a77,_0x484ba1){_0x484ba1=_0x484ba1||0xc8;return function(_0x1c3e00){if(_0x1c3e00){return _0x632a77[_0x417c('0x2b')](_0x484ba1)[_0x417c('0x2c')](_0x1c3e00);}};}function respondWithFilteredResult(_0x42d71b,_0x109034){return function(_0xa9435f){if(_0xa9435f){var _0x1f0805=_0xa9435f['count'],_0x3fb31c=_0x109034[_0x417c('0x2d')],_0x9685fd=_0x109034[_0x417c('0x2d')]+_0x109034[_0x417c('0x2e')],_0x17128b;if(_0x9685fd>=_0x1f0805){_0x9685fd=_0x1f0805;_0x17128b=0xc8;}else{_0x17128b=0xce;}_0x42d71b[_0x417c('0x2b')](_0x17128b);return _0x42d71b[_0x417c('0x2f')](_0x417c('0x30'),_0x3fb31c+'-'+_0x9685fd+'/'+_0x1f0805)[_0x417c('0x2c')](_0xa9435f);}return null;};}function patchUpdates(_0x3f91d9){return function(_0x40bd58){try{jsonpatch[_0x417c('0x31')](_0x40bd58,_0x3f91d9,!![]);}catch(_0x4131db){return BPromise['reject'](_0x4131db);}return _0x40bd58[_0x417c('0x32')]();};}function saveUpdates(_0x57ca04,_0x5b1920){return function(_0x170b73){if(_0x170b73){return _0x170b73['update'](_0x57ca04)['then'](function(_0x5ca5bb){return _0x5ca5bb;});}return null;};}function removeEntity(_0x5f4ca4,_0x390606){return function(_0x1dda3c){if(_0x1dda3c){return _0x1dda3c['destroy']()[_0x417c('0x1f')](function(){var _0x5cee79=_0x1dda3c[_0x417c('0x33')]({'plain':!![]});if(_0x5cee79[_0x417c('0x34')]===_0x417c('0x35'))return;var _0x594c84=[{'name':_0x417c('0x36'),'value':_0x417c('0x37'),'ignore':!![]},{'name':_0x417c('0x38'),'value':_0x417c('0x39'),'ignore':![]},{'name':_0x417c('0x3a'),'value':_0x417c('0x3b'),'ignore':![]}];var _0x21c8c2=_(_0x594c84)['filter']('ignore')[_0x417c('0x3c')](_0x417c('0x3d'))['value']();if(_['includes'](_0x21c8c2,_0x5cee79[_0x417c('0x34')])){return;}var _0x17093f=_['find'](_0x594c84,['value',_0x5cee79[_0x417c('0x34')]])['name'];return db[_0x417c('0x3e')][_0x417c('0x3f')]({'where':{'type':_0x17093f,'resourceId':_0x5cee79['id']}})['then'](function(){return _0x1dda3c;});})['then'](function(){_0x5f4ca4[_0x417c('0x2b')](0xcc)[_0x417c('0x40')]();});}};}function handleEntityNotFound(_0x3ddcc6,_0x2181aa){return function(_0x432f61){if(!_0x432f61){_0x3ddcc6['sendStatus'](0x194);}return _0x432f61;};}function handleError(_0x53aa85,_0x27755a){_0x27755a=_0x27755a||0x1f4;return function(_0x30a10e){logger['error'](_0x30a10e[_0x417c('0x41')]);if(_0x30a10e[_0x417c('0x42')]){delete _0x30a10e[_0x417c('0x42')];}_0x53aa85[_0x417c('0x2b')](_0x27755a)[_0x417c('0x43')](_0x30a10e);};}exports[_0x417c('0x44')]=function(_0x54a86f,_0x4edefd){var _0x214a75={},_0x298bdb={},_0x245132={'count':0x0,'rows':[]};var _0xb93b87=_['map'](db[_0x417c('0x45')][_0x417c('0x46')],function(_0x195ba0){return{'name':_0x195ba0[_0x417c('0x47')],'type':_0x195ba0[_0x417c('0x48')][_0x417c('0x49')]};});_0x298bdb[_0x417c('0x4a')]=_[_0x417c('0x4b')](_[_0x417c('0x3c')](_0xb93b87,_0x417c('0x42')),[_0x417c('0x4c'),_0x417c('0x4d')]);_0x298bdb[_0x417c('0x4e')]=_[_0x417c('0x4f')](_0x54a86f[_0x417c('0x4e')]);_0x298bdb[_0x417c('0x50')]=_['intersection'](_0x298bdb[_0x417c('0x4a')],_0x298bdb[_0x417c('0x4e')]);_0x214a75['attributes']=_[_0x417c('0x51')](_0x298bdb[_0x417c('0x4a')],qs[_0x417c('0x52')](_0x54a86f[_0x417c('0x4e')][_0x417c('0x52')]));_0x214a75[_0x417c('0x53')]=_0x214a75[_0x417c('0x53')][_0x417c('0x54')]?_0x214a75[_0x417c('0x53')]:_0x298bdb['model'];if(!_0x54a86f['query'][_0x417c('0x55')](_0x417c('0x56'))){_0x214a75[_0x417c('0x2e')]=qs[_0x417c('0x2e')](_0x54a86f[_0x417c('0x4e')][_0x417c('0x2e')]);_0x214a75[_0x417c('0x2d')]=qs['offset'](_0x54a86f[_0x417c('0x4e')]['offset']);}_0x214a75['order']=qs['sort'](_0x54a86f['query'][_0x417c('0x57')]);_0x214a75[_0x417c('0x58')]=qs[_0x417c('0x50')](_[_0x417c('0x59')](_0x54a86f[_0x417c('0x4e')],_0x298bdb[_0x417c('0x50')]),_0xb93b87);if(_0x54a86f[_0x417c('0x4e')][_0x417c('0x5a')]){_0x214a75[_0x417c('0x58')]=_[_0x417c('0x5b')](_0x214a75[_0x417c('0x58')],{'$or':_['map'](_0xb93b87,function(_0x9a4a6f){if(_0x9a4a6f['type']!==_0x417c('0x5c')){return db[_0x417c('0x5d')][_0x417c('0x58')](db[_0x417c('0x5d')]['fn'](_0x417c('0x5e'),db[_0x417c('0x5d')][_0x417c('0x5f')](_0x9a4a6f[_0x417c('0x42')])),{'$like':db['sequelize']['fn']('lower','%'+_0x54a86f[_0x417c('0x4e')]['filter']+'%')});}})});}_0x214a75=_[_0x417c('0x5b')]({},_0x214a75,_0x54a86f[_0x417c('0x60')]);var _0x41b516={'where':_0x214a75[_0x417c('0x58')]};return db[_0x417c('0x45')][_0x417c('0x61')](_0x41b516)[_0x417c('0x1f')](function(_0x4cc021){_0x245132[_0x417c('0x61')]=_0x4cc021;if(_0x54a86f['query']['includeAll']){_0x214a75[_0x417c('0x62')]=[{'all':!![]}];}return db[_0x417c('0x45')]['findAll'](_0x214a75);})[_0x417c('0x1f')](function(_0x355152){_0x245132[_0x417c('0x63')]=_0x355152;return _0x245132;})[_0x417c('0x1f')](respondWithFilteredResult(_0x4edefd,_0x214a75))[_0x417c('0x2a')](handleError(_0x4edefd,null));};exports[_0x417c('0x64')]=function(_0x166cd4,_0x48e6f2){var _0x1af1a5={'raw':![],'where':{'id':_0x166cd4['params']['id']}},_0x27114e={};_0x27114e[_0x417c('0x4a')]=_[_0x417c('0x4b')](_[_0x417c('0x4f')](db['User']['rawAttributes']),[_0x417c('0x4c'),_0x417c('0x4d')]);_0x27114e[_0x417c('0x4e')]=_[_0x417c('0x4f')](_0x166cd4[_0x417c('0x4e')]);_0x27114e['filters']=_[_0x417c('0x51')](_0x27114e[_0x417c('0x4a')],_0x27114e['query']);_0x1af1a5['attributes']=_[_0x417c('0x51')](_0x27114e['model'],qs['fields'](_0x166cd4[_0x417c('0x4e')][_0x417c('0x52')]));_0x1af1a5[_0x417c('0x53')]=_0x1af1a5[_0x417c('0x53')][_0x417c('0x54')]?_0x1af1a5[_0x417c('0x53')]:_0x27114e[_0x417c('0x4a')];if(_0x166cd4[_0x417c('0x4e')][_0x417c('0x65')]){_0x1af1a5[_0x417c('0x62')]=[{'all':!![]}];}_0x1af1a5=_[_0x417c('0x5b')]({},_0x1af1a5,_0x166cd4[_0x417c('0x60')]);return db[_0x417c('0x45')]['find'](_0x1af1a5)[_0x417c('0x1f')](handleEntityNotFound(_0x48e6f2,null))['then'](respondWithResult(_0x48e6f2,null))[_0x417c('0x2a')](handleError(_0x48e6f2,null));};exports[_0x417c('0x66')]=function(_0x3857d0,_0x280182){if(_0x3857d0[_0x417c('0x67')]['id']){delete _0x3857d0['body']['id'];}delete _0x3857d0[_0x417c('0x67')][_0x417c('0x34')];return db[_0x417c('0x45')][_0x417c('0x68')]({'where':{'id':_0x3857d0[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x280182,null))[_0x417c('0x1f')](saveUpdates(_0x3857d0[_0x417c('0x67')],null))[_0x417c('0x1f')](respondWithResult(_0x280182,null))['catch'](handleError(_0x280182,null));};exports[_0x417c('0x6a')]=function(_0x34269f,_0x5e8d89){return db[_0x417c('0x45')][_0x417c('0x6a')]()[_0x417c('0x1f')](respondWithResult(_0x5e8d89,null))['catch'](handleError(_0x5e8d89,null));};exports[_0x417c('0x6b')]=function(_0x3bf069,_0x1250b8,_0xc61c72){return db['User'][_0x417c('0x68')]({'where':{'id':_0x3bf069[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x1250b8,null))[_0x417c('0x1f')](function(_0x1bc85a){if(_0x1bc85a){return _0x1bc85a[_0x417c('0x6b')](_0x3bf069[_0x417c('0x67')][_0x417c('0x6c')],_['omit'](_0x3bf069['body'],[_0x417c('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x1250b8,null))[_0x417c('0x2a')](handleError(_0x1250b8,null));};function validateUser(_0x1cabb5){return new BPromise(function(_0x269d86,_0x2001e5){if(_0x1cabb5['internal'])return _0x269d86(_0x1cabb5);return db['Setting'][_0x417c('0x6d')](0x1)[_0x417c('0x1f')](function(_0xca32bc){if(_0xca32bc[_0x417c('0x6e')])authService['validatePasswordPattern'](_0x1cabb5[_0x417c('0x4c')]);db[_0x417c('0x45')]['max'](_0x417c('0x6f'))['then'](function(_0x52d1d1){if(_[_0x417c('0x70')](_0x52d1d1)){_0x1cabb5[_0x417c('0x6f')]=_0xca32bc[_0x417c('0x71')]||0x1;return;}if(_[_0x417c('0x70')](_0xca32bc[_0x417c('0x71')])||_0xca32bc[_0x417c('0x71')]===_0x52d1d1){_0x1cabb5['internal']=_0x52d1d1+0x1;return;}if(_0xca32bc[_0x417c('0x71')]>_0x52d1d1){_0x1cabb5[_0x417c('0x6f')]=_0xca32bc[_0x417c('0x71')];return;}return db['sequelize'][_0x417c('0x4e')](_0x417c('0x72'),{'type':db['sequelize']['QueryTypes'][_0x417c('0x73')]})[_0x417c('0x1f')](function(_0x1add12){if(_0x1add12&&_0x1add12[_0x417c('0x54')]){for(var _0x407444=0x0,_0x21c384=_0x1add12[_0x417c('0x54')];_0x407444<_0x21c384&&_[_0x417c('0x70')](_0x1cabb5[_0x417c('0x6f')]);_0x407444++){if(_0xca32bc[_0x417c('0x71')]<=_0x1add12[_0x407444][_0x417c('0x74')]){_0x1cabb5['internal']=_0x1add12[_0x407444][_0x417c('0x74')];}else if(_0xca32bc[_0x417c('0x71')]>_0x1add12[_0x407444]['from']&&_0xca32bc[_0x417c('0x71')]<=_0x1add12[_0x407444]['to']){_0x1cabb5[_0x417c('0x6f')]=_0xca32bc[_0x417c('0x71')];}}}if(_[_0x417c('0x70')](_0x1cabb5[_0x417c('0x6f')])){_0x1cabb5['internal']=_0x52d1d1+0x1;}return _0x269d86(_0x1cabb5);});});})[_0x417c('0x2a')](function(_0x161fb0){_0x2001e5(_0x161fb0);});});}function updateUser(_0x5dc33d){return new BPromise(function(_0x444bba,_0x366b48){try{if(_0x5dc33d[_0x417c('0x75')]){_0x5dc33d['mailbox']=_0x5dc33d[_0x417c('0x6f')];_0x5dc33d[_0x417c('0x76')]={'mailbox':_0x5dc33d[_0x417c('0x6f')],'password':_0x5dc33d[_0x417c('0x4c')],'fullname':_0x5dc33d[_0x417c('0x77')],'email':_0x5dc33d[_0x417c('0x78')]};}if(_0x5dc33d[_0x417c('0x34')]===_0x417c('0x39')){if(!_0x5dc33d[_0x417c('0x79')])_0x5dc33d[_0x417c('0x79')]=[_0x417c('0x7a'),_0x417c('0x7b'),'103',_0x417c('0x7c'),_0x417c('0x7d'),_0x417c('0x7e'),_0x417c('0x7f'),_0x417c('0x80'),_0x417c('0x81'),_0x417c('0x82'),_0x417c('0x83'),_0x417c('0x84'),_0x417c('0x85'),_0x417c('0x86'),_0x417c('0x87')];}_0x444bba(_0x5dc33d);}catch(_0x400235){_0x366b48(_0x400235);}});}exports[_0x417c('0x88')]=function(_0x2d276f,_0x24f136){if(_0x2d276f[_0x417c('0x37')][_0x417c('0x34')]===_0x417c('0x39'))throw new Error('Unauthorized');if(_0x2d276f[_0x417c('0x67')][_0x417c('0x34')]===_0x417c('0x37')&&_0x2d276f[_0x417c('0x37')][_0x417c('0x34')]!==_0x417c('0x35')){throw new Error(_0x417c('0x89'));}if(_0x2d276f[_0x417c('0x67')][_0x417c('0x34')]===_0x417c('0x35')&&_0x2d276f[_0x417c('0x37')][_0x417c('0x34')]!==_0x417c('0x35')){throw new Error(_0x417c('0x8a'));}return licenseUtil[_0x417c('0x8b')]([_0x2d276f[_0x417c('0x67')]])[_0x417c('0x1f')](function(){return validateUser(_0x2d276f[_0x417c('0x67')]);})[_0x417c('0x1f')](function(_0xad5a2e){return updateUser(_0xad5a2e)[_0x417c('0x1f')](function(_0x471deb){if(_0x471deb[_0x417c('0x34')]===_0x417c('0x35')){_0x471deb['settingsEnabled']=_0x2d276f[_0x417c('0x37')]['settingsEnabled'];delete _0x471deb[_0x417c('0x8c')];}return _0x471deb;});})['then'](function(_0x94e6c0){return db[_0x417c('0x45')][_0x417c('0x88')](_0x94e6c0,{'include':[{'model':db[_0x417c('0x76')],'as':'VoiceMail'}]});})['then'](function(_0x20aafe){if(_0x2d276f[_0x417c('0x67')]['role']===_0x417c('0x37'))return _0x20aafe;if(_0x2d276f[_0x417c('0x37')][_0x417c('0x34')]!==_0x417c('0x37'))return _0x20aafe;return db['UserProfileSection']['find']({'where':{'name':_0x20aafe[_0x417c('0x34')]==='agent'?_0x417c('0x38'):'Telephones','userProfileId':_0x2d276f[_0x417c('0x37')]['userProfileId']},'raw':!![]})[_0x417c('0x1f')](function(_0x2717f5){if(!_0x2717f5||_0x2717f5[_0x417c('0x8d')]!=0x0)return _0x20aafe;return db['UserProfileResource'][_0x417c('0x88')]({'name':_0x20aafe['name'],'resourceId':_0x20aafe['id'],'type':_0x2717f5[_0x417c('0x42')],'sectionId':_0x2717f5['id']},{})[_0x417c('0x1f')](function(){return _0x20aafe;});})[_0x417c('0x2a')](function(_0x4763b5){logger[_0x417c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4763b5);throw _0x4763b5;});})['then'](respondWithResult(_0x24f136,0xc9))[_0x417c('0x2a')](handleError(_0x24f136,null));};exports[_0x417c('0x8e')]=function(_0xaf13d3,_0x4937c1){var _0xa48c0a=_0xaf13d3['body'];var _0x372a85=[];if(_0xaf13d3[_0x417c('0x37')][_0x417c('0x34')]==='agent')throw new Error('Unauthorized');if(_[_0x417c('0x8f')](_0xa48c0a,[_0x417c('0x34'),_0x417c('0x37')])&&_0xaf13d3[_0x417c('0x37')]['role']!==_0x417c('0x35')){throw new Error(_0x417c('0x89'));}if(_['some'](_0xa48c0a,[_0x417c('0x34'),_0x417c('0x35')])&&_0xaf13d3['user'][_0x417c('0x34')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x417c('0x8b')](_0xa48c0a)[_0x417c('0x1f')](function(){return validateUser(_0xa48c0a[0x0]);})[_0x417c('0x1f')](function(){for(var _0x2eb816=0x1;_0x2eb816<_0xa48c0a[_0x417c('0x54')];_0x2eb816++){var _0x529ff3=_0xa48c0a[_0x2eb816-0x1][_0x417c('0x6f')];if(!_0xa48c0a[_0x2eb816]['internal'])_0xa48c0a[_0x2eb816][_0x417c('0x6f')]=_0x529ff3+0x1;_0x372a85[_0x417c('0x90')](validateUser(_0xa48c0a[_0x2eb816]));}return BPromise[_0x417c('0x91')](_0x372a85);})[_0x417c('0x1f')](function(){_0x372a85=[];for(var _0x40bb96=0x0;_0x40bb96<_0xa48c0a[_0x417c('0x54')];_0x40bb96++){_0x372a85['push'](updateUser(_0xa48c0a[_0x40bb96]));}return BPromise[_0x417c('0x91')](_0x372a85);})[_0x417c('0x1f')](function(){return BPromise[_0x417c('0x92')](_0xa48c0a,function(_0x4cdcdc){return db['User'][_0x417c('0x88')](_0x4cdcdc,{'include':[{'model':db[_0x417c('0x76')],'as':'VoiceMail'}]})[_0x417c('0x1f')](function(_0x1482e1){_0x4cdcdc['id']=_0x1482e1['id'];return _0x4cdcdc;});});})[_0x417c('0x1f')](function(_0x371e60){if(_0xaf13d3[_0x417c('0x67')]['role']===_0x417c('0x37'))return _0x371e60;if(_0xaf13d3[_0x417c('0x37')][_0x417c('0x34')]!=='user')return _0x371e60;var _0x5dcd24=_[_0x417c('0x8f')](_0x371e60,function(_0x2af204){return _0x2af204[_0x417c('0x34')]===_0x417c('0x39')||_0x2af204['role']===_0x417c('0x3b');});if(!_0x5dcd24)return _0x371e60;return db[_0x417c('0x93')][_0x417c('0x94')]({'where':{'name':{'$or':[_0x417c('0x38'),_0x417c('0x3a')]},'userProfileId':_0xaf13d3[_0x417c('0x37')]['userProfileId']},'raw':!![]})['then'](function(_0x4357c4){if(_[_0x417c('0x95')](_0x4357c4)||!_[_0x417c('0x8f')](_0x4357c4,['autoAssociation',0x0]))return _0x371e60;_0x372a85=[];var _0x19ea09=_(_0x4357c4)[_0x417c('0x3c')](function(_0x5ba4fb){if(_0x5ba4fb['autoAssociation']===0x1)return;return _0x5ba4fb[_0x417c('0x42')]===_0x417c('0x38')?_0x417c('0x39'):_0x417c('0x3b');})['compact']()[_0x417c('0x3d')]();for(var _0x4c356d=0x0;_0x4c356d<_0x371e60['length'];_0x4c356d++){if(!_[_0x417c('0x96')](_0x19ea09,_0x371e60[_0x4c356d]['role']))return;var _0x5779f5=_0x371e60[_0x4c356d]['role']===_0x417c('0x39')?_0x417c('0x38'):_0x417c('0x3a');_0x372a85[_0x417c('0x90')](db[_0x417c('0x3e')][_0x417c('0x88')]({'name':_0x371e60[_0x4c356d][_0x417c('0x42')],'resourceId':_0x371e60[_0x4c356d]['id'],'type':_0x5779f5,'sectionId':_[_0x417c('0x68')](_0x4357c4,[_0x417c('0x42'),_0x5779f5])['id']},{}));}return BPromise[_0x417c('0x91')](_0x372a85);});})[_0x417c('0x1f')](respondWithResult(_0x4937c1,0xc9))[_0x417c('0x2a')](handleError(_0x4937c1,null));};exports[_0x417c('0x97')]=function(_0xb6fa0d,_0x39b0d1,_0x3201e1){if(_0xb6fa0d[_0x417c('0x67')]['id']){delete _0xb6fa0d[_0x417c('0x67')]['id'];}return db[_0x417c('0x45')]['find']({'where':{'id':_0xb6fa0d[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](function(_0x1bc6a2){if(!_0x1bc6a2)return null;if(_0x1bc6a2['id']===_0xb6fa0d[_0x417c('0x37')]['id']){if(!_0xb6fa0d['body'][_0x417c('0x98')]||!_0xb6fa0d[_0x417c('0x67')]['newPassword']){throw new db[(_0x417c('0x99'))]['ValidationError'](_0x417c('0x9a'));}if(!_0x1bc6a2[_0x417c('0x9b')](_0xb6fa0d[_0x417c('0x67')]['oldPassword'])){throw new db[(_0x417c('0x99'))][(_0x417c('0x9c'))](_0x417c('0x9d'));}if(_0xb6fa0d[_0x417c('0x67')][_0x417c('0x98')]===_0xb6fa0d['body'][_0x417c('0x9e')]){throw new db['Sequelize'][(_0x417c('0x9c'))](_0x417c('0x9f'));}}else if(_0xb6fa0d['user'][_0x417c('0x34')]===_0x417c('0x35')){if(!_0xb6fa0d[_0x417c('0x67')][_0x417c('0x9e')]){throw new db[(_0x417c('0x99'))][(_0x417c('0x9c'))](_0x417c('0xa0'));}}else if(_0xb6fa0d[_0x417c('0x37')][_0x417c('0x34')]==='user'){if(!_0xb6fa0d['body'][_0x417c('0x9e')]){throw new db[(_0x417c('0x99'))][(_0x417c('0x9c'))](_0x417c('0xa0'));}if(_0x1bc6a2[_0x417c('0x34')]!==_0x417c('0x39')){throw new db['Sequelize'][(_0x417c('0x9c'))](_0x417c('0xa1'));}}else{throw new db[(_0x417c('0x99'))][(_0x417c('0x9c'))](_0x417c('0xa1'));}return _0x1bc6a2;})['then'](handleEntityNotFound(_0x39b0d1,null))[_0x417c('0x1f')](function(_0x3c6c00){return db['Setting'][_0x417c('0xa2')]({'attributes':['id',_0x417c('0x6e'),_0x417c('0xa3'),_0x417c('0xa4')]})[_0x417c('0x1f')](function(_0x3c01ae){if(_0x3c01ae['securePassword'])authService[_0x417c('0xa5')](_0xb6fa0d['body'][_0x417c('0x9e')]);if(!_0x3c01ae[_0x417c('0xa3')]||!_0x3c6c00[_0x417c('0xa6')])return _0x3c6c00;authService['validatePasswordHistory'](_0xb6fa0d[_0x417c('0x67')][_0x417c('0x9e')],_0x3c6c00[_0x417c('0xa6')],_0x3c01ae[_0x417c('0xa4')]);return _0x3c6c00;})[_0x417c('0x1f')](saveUpdates({'password':_0xb6fa0d[_0x417c('0x67')][_0x417c('0x9e')],'passwordResetAt':_0xb6fa0d[_0x417c('0x37')]['id']==_0xb6fa0d[_0x417c('0x69')]['id']?moment():null,'previousPasswords':authService[_0x417c('0xa7')](_0xb6fa0d[_0x417c('0x67')][_0x417c('0x9e')],_0x3c6c00['previousPasswords'])},null));})['then'](respondWithResult(_0x39b0d1,null))[_0x417c('0x2a')](handleError(_0x39b0d1,null));};exports[_0x417c('0xa8')]=function(_0x5648c4,_0x29ac56,_0x4ff50c){var _0x369c40=_0x5648c4[_0x417c('0x67')][_0x417c('0xa9')];return db[_0x417c('0x45')]['find']({'where':{'id':_0x5648c4[_0x417c('0x69')]['id']},'attributes':['id',_0x417c('0x42'),_0x417c('0x34'),_0x417c('0xaa'),'loginInPause','voicePause',_0x417c('0xab')]})[_0x417c('0x1f')](handleEntityNotFound(_0x29ac56,null))[_0x417c('0x1f')](function(_0x48f215){if(_0x48f215){if(!utils[_0x417c('0xac')](_0x369c40)){throw new db[(_0x417c('0x99'))][(_0x417c('0x9c'))](_0x417c('0xad'));}return _0x48f215[_0x417c('0xae')+_[_0x417c('0xaf')](_0x369c40['toLowerCase']())+_0x417c('0xb0')](_0x5648c4[_0x417c('0x67')][_0x417c('0x6c')],{'penalty':_0x5648c4[_0x417c('0x67')][_0x417c('0xb1')]||0x0})[_0x417c('0xb2')](function(_0x5cf9e2){for(var _0x479bab=0x0;_0x479bab<_0x5648c4[_0x417c('0x67')][_0x417c('0x6c')][_0x417c('0x54')];_0x479bab+=0x1){var _0x1a8c96={'UserId':_0x5648c4[_0x417c('0x69')]['id']};_0x1a8c96[_['capitalize'](_0x369c40['toLowerCase']())+_0x417c('0xb3')]=_0x5648c4[_0x417c('0x67')][_0x417c('0x6c')][_0x479bab];socket[_0x417c('0xb4')]('user'+_[_0x417c('0xaf')](_0x369c40['toLowerCase']())+_0x417c('0xb5'),_0x1a8c96);}return _0x5cf9e2;})[_0x417c('0x1f')](function(){if(_0x369c40===_0x417c('0xb6')){return db[_0x417c('0xb7')][_0x417c('0x94')]({'where':{'id':_0x5648c4[_0x417c('0x67')][_0x417c('0x6c')]||[]},'raw':!![],'attributes':['id',_0x417c('0x42')]});}})[_0x417c('0x1f')](function(_0xe99e5f){var _0x38d48c=_0x48f215[_0x417c('0x33')]({'plain':!![]});var _0x2e54f6=[];if(_0x369c40===_0x417c('0xb6')&&_0x38d48c[_0x417c('0x34')]===_0x417c('0x39')&&_0x38d48c[_0x417c('0xaa')]){for(var _0x1c9bfb=0x0;_0x1c9bfb<_0xe99e5f[_0x417c('0x54')];_0x1c9bfb+=0x1){_0x2e54f6['push']({'membername':_0x38d48c[_0x417c('0x42')],'UserId':_0x38d48c['id'],'queue_name':_0xe99e5f[_0x1c9bfb]['name'],'VoiceQueueId':_0xe99e5f[_0x1c9bfb]['id'],'interface':_[_0x417c('0x70')](_0x38d48c[_0x417c('0xab')])?util[_0x417c('0xb8')](_0x417c('0xb9'),_0x38d48c[_0x417c('0x42')]):_0x38d48c['interface'],'paused':_0x38d48c[_0x417c('0xba')]||![],'penalty':_0x5648c4[_0x417c('0x67')][_0x417c('0xb1')]||0x0});}return BPromise[_0x417c('0x92')](_0x2e54f6,function(_0x585465){return db[_0x417c('0xbb')]['upsert'](_0x585465);});}return _0x48f215;});}})[_0x417c('0x1f')](respondWithStatusCode(_0x29ac56,null))[_0x417c('0x2a')](handleError(_0x29ac56,null));};exports[_0x417c('0xbc')]=function(_0x28b5b5,_0x2f620a,_0x435f67){var _0x1f155a;return db[_0x417c('0x45')][_0x417c('0x68')]({'where':{'id':_0x28b5b5[_0x417c('0x69')]['id']},'attributes':['id',_0x417c('0x42'),'role']})['then'](handleEntityNotFound(_0x2f620a,null))[_0x417c('0x1f')](function(_0x109d8b){if(_0x109d8b){_0x1f155a=_0x109d8b;if(!_0x28b5b5[_0x417c('0x4e')][_0x417c('0xa9')]||!utils[_0x417c('0xac')](_0x28b5b5[_0x417c('0x4e')][_0x417c('0xa9')])){throw new db['Sequelize']['ValidationError'](_0x417c('0xad'));}return _0x109d8b[_0x417c('0xbd')+_[_0x417c('0xaf')](_0x28b5b5['query']['channel'][_0x417c('0xbe')]())+'Queues'](_0x28b5b5[_0x417c('0x4e')][_0x417c('0x6c')]);}})[_0x417c('0x1f')](function(_0x315454){for(var _0x3a8e15=0x0;_0x3a8e15<_0x28b5b5['query']['ids'][_0x417c('0x54')];_0x3a8e15+=0x1){var _0xe2525b={'UserId':_0x28b5b5[_0x417c('0x69')]['id']};_0xe2525b[_[_0x417c('0xaf')](_0x28b5b5[_0x417c('0x4e')]['channel'][_0x417c('0xbe')]())+_0x417c('0xb3')]=_0x28b5b5[_0x417c('0x4e')][_0x417c('0x6c')][_0x3a8e15];socket[_0x417c('0xb4')]('user'+_[_0x417c('0xaf')](_0x28b5b5[_0x417c('0x4e')][_0x417c('0xa9')][_0x417c('0xbe')]())+_0x417c('0xbf'),_0xe2525b);}return _0x315454;})[_0x417c('0x1f')](function(){if(_0x28b5b5[_0x417c('0x4e')][_0x417c('0xa9')]===_0x417c('0xb6')){return db[_0x417c('0xbb')]['destroy']({'where':{'UserId':_0x28b5b5[_0x417c('0x69')]['id'],'VoiceQueueId':_0x28b5b5[_0x417c('0x4e')][_0x417c('0x6c')]},'individualHooks':!![]})['then'](function(){return _0x1f155a;});}return _0x1f155a;})[_0x417c('0x1f')](respondWithStatusCode(_0x2f620a,null))['catch'](handleError(_0x2f620a,null));};exports[_0x417c('0xc0')]=function(_0x531f2e,_0x27ee27,_0x5bf320){_0x531f2e[_0x417c('0x67')]['userpic']=_0x531f2e[_0x417c('0xc1')][_0x417c('0xc2')];return db['User'][_0x417c('0x68')]({'where':{'id':_0x531f2e[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x27ee27,null))[_0x417c('0x1f')](saveUpdates(_0x531f2e[_0x417c('0x67')],null))['then'](respondWithResult(_0x27ee27,null))[_0x417c('0x2a')](handleError(_0x27ee27,null));};exports[_0x417c('0xc3')]=function(_0x16d2a9,_0x54e2fe,_0x517ece){var _0x5be032=path['join'](config[_0x417c('0xc4')],_0x417c('0xc5'));return db['User'][_0x417c('0x68')]({'where':{'id':_0x16d2a9['params']['id']},'attributes':['id',_0x417c('0xc6')],'raw':!![]})[_0x417c('0x1f')](handleEntityNotFound(_0x54e2fe,null))['then'](function(_0x3eb4c1){if(_0x3eb4c1){if(_[_0x417c('0x70')](_0x3eb4c1[_0x417c('0xc6')])){return _0x54e2fe[_0x417c('0xc7')](_0x5be032);}else{if(!fs[_0x417c('0xc8')](path[_0x417c('0xc9')](config[_0x417c('0xc4')],'server/files/images/',_0x3eb4c1[_0x417c('0xc6')]))){return _0x54e2fe[_0x417c('0xc7')](_0x5be032);}return _0x54e2fe[_0x417c('0xc7')](path[_0x417c('0xc9')](config[_0x417c('0xc4')],'server/files/images/',_0x3eb4c1['userpic']));}}})[_0x417c('0x2a')](handleError(_0x54e2fe,null));};exports['getContacts']=function(_0x42085d,_0x2e8f8d,_0x198c6e){var _0x7ada24={};var _0x4191e7={};var _0xa79f30;var _0x10aaad;return db[_0x417c('0x45')][_0x417c('0xa2')]({'where':{'id':_0x42085d[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x2e8f8d,null))['then'](function(_0x5e3898){if(_0x5e3898){_0xa79f30=_0x5e3898;_0x4191e7[_0x417c('0x4a')]=_[_0x417c('0x4f')](db['CmContact'][_0x417c('0x46')]);_0x4191e7[_0x417c('0x4e')]=_[_0x417c('0x4f')](_0x42085d[_0x417c('0x4e')]);_0x4191e7['filters']=_['intersection'](_0x4191e7['model'],_0x4191e7[_0x417c('0x4e')]);_0x7ada24[_0x417c('0x53')]=_[_0x417c('0x51')](_0x4191e7['model'],qs['fields'](_0x42085d[_0x417c('0x4e')][_0x417c('0x52')]));_0x7ada24['attributes']=_0x7ada24[_0x417c('0x53')][_0x417c('0x54')]?_0x7ada24[_0x417c('0x53')]:_0x4191e7[_0x417c('0x4a')];_0x7ada24[_0x417c('0xca')]=qs[_0x417c('0x57')](_0x42085d[_0x417c('0x4e')][_0x417c('0x57')]);_0x7ada24['where']=qs['filters'](_[_0x417c('0x59')](_0x42085d['query'],_0x4191e7[_0x417c('0x50')]));if(_0x42085d[_0x417c('0x4e')]['filter']){_0x7ada24[_0x417c('0x58')]=_['merge'](_0x7ada24[_0x417c('0x58')],{'$or':_['map'](_0x7ada24[_0x417c('0x53')],function(_0x48b324){var _0x5a22cf={};_0x5a22cf[_0x48b324]={'$like':'%'+_0x42085d[_0x417c('0x4e')]['filter']+'%'};return _0x5a22cf;})});}_0x7ada24=_[_0x417c('0x5b')]({},_0x7ada24,_0x42085d[_0x417c('0x60')]);return _0xa79f30[_0x417c('0xcb')](_0x7ada24);}})[_0x417c('0x1f')](function(_0x3e2f21){if(_0x3e2f21){_0x10aaad=_0x3e2f21[_0x417c('0x54')];if(_0x42085d['query'][_0x417c('0x55')](_0x417c('0x65'))){_0x7ada24[_0x417c('0x62')]=[{'model':db[_0x417c('0xcc')],'as':_0x417c('0xcd'),'required':![]},{'model':db[_0x417c('0xce')],'as':_0x417c('0xcf'),'attributes':['id','name',_0x417c('0xd0')],'where':_0x42085d['query'][_0x417c('0xd1')]?{'id':_0x42085d[_0x417c('0x4e')][_0x417c('0xd1')]}:undefined,'required':_0x42085d[_0x417c('0x4e')][_0x417c('0xd1')]?!![]:![]}];}if(!_0x42085d['query']['hasOwnProperty'](_0x417c('0x56'))){_0x7ada24['limit']=qs[_0x417c('0x2e')](_0x42085d[_0x417c('0x4e')][_0x417c('0x2e')]);_0x7ada24[_0x417c('0x2d')]=qs[_0x417c('0x2d')](_0x42085d[_0x417c('0x4e')][_0x417c('0x2d')]);}return _0xa79f30['getContacts'](_0x7ada24);}})[_0x417c('0x1f')](function(_0x2a752d){if(_0x2a752d){return _0x2a752d?{'count':_0x10aaad,'rows':_0x2a752d}:null;}})[_0x417c('0x1f')](respondWithResult(_0x2e8f8d,null))[_0x417c('0x2a')](handleError(_0x2e8f8d,null));};exports[_0x417c('0xd2')]=function(_0x903362,_0x481088,_0x3709eb){var _0x2f4d45;var _0x55128e;var _0x370bfb={};var _0x4bf967;return db[_0x417c('0x45')]['findOne']({'where':{'id':_0x903362[_0x417c('0x69')]['id']},'attributes':['id',_0x417c('0x42'),'role']})['then'](handleEntityNotFound(_0x481088,null))[_0x417c('0x1f')](function(_0x17cbd1){if(!utils[_0x417c('0xac')](_0x903362[_0x417c('0x4e')][_0x417c('0xa9')])){throw new db[(_0x417c('0x99'))]['ValidationError'](_0x417c('0xad'));}_0x2f4d45=_0x17cbd1;var _0x3d4375={};_0x3d4375[_0x417c('0x4a')]=_[_0x417c('0x4f')](db[_[_0x417c('0xaf')](_0x903362[_0x417c('0x4e')][_0x417c('0xa9')])+_0x417c('0xd3')][_0x417c('0x46')]);_0x3d4375['query']=_[_0x417c('0x4f')](_0x903362[_0x417c('0x4e')]);_0x3d4375[_0x417c('0x50')]=_[_0x417c('0x51')](_0x3d4375[_0x417c('0x4a')],_0x3d4375['query']);_0x370bfb[_0x417c('0x53')]=_[_0x417c('0x51')](_0x3d4375['model'],qs['fields'](_0x903362[_0x417c('0x4e')][_0x417c('0x52')]));_0x370bfb[_0x417c('0x53')]=_0x370bfb['attributes'][_0x417c('0x54')]?_0x370bfb[_0x417c('0x53')]:_0x3d4375[_0x417c('0x4a')];_0x370bfb[_0x417c('0xca')]=qs['sort'](_0x903362[_0x417c('0x4e')][_0x417c('0x57')]);_0x370bfb[_0x417c('0x58')]=qs[_0x417c('0x50')](_[_0x417c('0x59')](_0x903362[_0x417c('0x4e')],_0x3d4375[_0x417c('0x50')]));if(_0x903362[_0x417c('0x4e')][_0x417c('0x5a')]){_0x370bfb[_0x417c('0x58')]=_[_0x417c('0x5b')](_0x370bfb[_0x417c('0x58')],{'$or':_[_0x417c('0x3c')](_0x370bfb[_0x417c('0x53')],function(_0x2762de){var _0xe8fbbb={};_0xe8fbbb[_0x2762de]={'$like':'%'+_0x903362[_0x417c('0x4e')]['filter']+'%'};return _0xe8fbbb;})});}_0x370bfb=_[_0x417c('0x5b')]({},_0x370bfb,_0x903362['options']);switch(_0x2f4d45[_0x417c('0x34')]){case _0x417c('0x35'):return db[_['capitalize'](_0x903362[_0x417c('0x4e')]['channel'])+_0x417c('0xd3')][_0x417c('0x94')](_0x370bfb);case'user':case _0x417c('0x39'):return _0x2f4d45[_0x417c('0x33')+_[_0x417c('0xaf')](_0x903362[_0x417c('0x4e')][_0x417c('0xa9')])+_0x417c('0xb0')](_0x370bfb);default:throw new db['Sequelize'][(_0x417c('0x9c'))]('Unknown\x20role');}})[_0x417c('0x1f')](function(_0x293544){_0x4bf967=_0x293544[_0x417c('0x54')];if(!_0x903362['query'][_0x417c('0x55')](_0x417c('0x56'))){_0x370bfb[_0x417c('0x2e')]=qs[_0x417c('0x2e')](_0x903362[_0x417c('0x4e')][_0x417c('0x2e')]);_0x370bfb[_0x417c('0x2d')]=qs[_0x417c('0x2d')](_0x903362[_0x417c('0x4e')]['offset']);}switch(_0x2f4d45['role']){case'admin':return db[_[_0x417c('0xaf')](_0x903362['query'][_0x417c('0xa9')])+_0x417c('0xd3')][_0x417c('0x94')](_0x370bfb);case _0x417c('0x37'):case _0x417c('0x39'):return _0x2f4d45['get'+_['capitalize'](_0x903362[_0x417c('0x4e')][_0x417c('0xa9')])+_0x417c('0xb0')](_0x370bfb);}})['then'](function(_0x13d1cd){return{'count':_0x4bf967,'rows':_0x13d1cd};})[_0x417c('0x1f')](respondWithResult(_0x481088,null))[_0x417c('0x2a')](handleError(_0x481088,null));};exports[_0x417c('0xd4')]=function(_0x15b11d,_0x1a8a9c,_0x1ee047){var _0x520343={};var _0x3b57ba={};var _0x4a1637;var _0x51b580;return db['User']['findOne']({'where':{'id':_0x15b11d[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x1a8a9c,null))['then'](function(_0x401750){if(_0x401750){_0x4a1637=_0x401750;_0x3b57ba[_0x417c('0x4a')]=_[_0x417c('0x4f')](db[_0x417c('0xbb')][_0x417c('0x46')]);_0x3b57ba[_0x417c('0x4e')]=_['keys'](_0x15b11d['query']);_0x3b57ba['filters']=_[_0x417c('0x51')](_0x3b57ba[_0x417c('0x4a')],_0x3b57ba[_0x417c('0x4e')]);_0x520343[_0x417c('0x53')]=_[_0x417c('0x51')](_0x3b57ba['model'],qs[_0x417c('0x52')](_0x15b11d[_0x417c('0x4e')][_0x417c('0x52')]));_0x520343[_0x417c('0x53')]=_0x520343[_0x417c('0x53')]['length']?_0x520343[_0x417c('0x53')]:_0x3b57ba['model'];_0x520343['order']=qs[_0x417c('0x57')](_0x15b11d[_0x417c('0x4e')][_0x417c('0x57')]);_0x520343[_0x417c('0x58')]=qs['filters'](_[_0x417c('0x59')](_0x15b11d[_0x417c('0x4e')],_0x3b57ba[_0x417c('0x50')]));if(_0x15b11d[_0x417c('0x4e')][_0x417c('0x5a')]){_0x520343[_0x417c('0x58')]=_[_0x417c('0x5b')](_0x520343['where'],{'$or':_['map'](_0x520343[_0x417c('0x53')],function(_0x53f2a2){var _0x59b6d1={};_0x59b6d1[_0x53f2a2]={'$like':'%'+_0x15b11d[_0x417c('0x4e')][_0x417c('0x5a')]+'%'};return _0x59b6d1;})});}_0x520343=_[_0x417c('0x5b')]({},_0x520343,_0x15b11d[_0x417c('0x60')]);return _0x4a1637[_0x417c('0xd4')](_0x520343);}})[_0x417c('0x1f')](function(_0x2302fd){if(_0x2302fd){_0x51b580=_0x2302fd[_0x417c('0x54')];if(!_0x15b11d[_0x417c('0x4e')][_0x417c('0x55')](_0x417c('0x56'))){_0x520343['limit']=qs[_0x417c('0x2e')](_0x15b11d[_0x417c('0x4e')][_0x417c('0x2e')]);_0x520343[_0x417c('0x2d')]=qs[_0x417c('0x2d')](_0x15b11d[_0x417c('0x4e')][_0x417c('0x2d')]);}return _0x4a1637[_0x417c('0xd4')](_0x520343);}})['then'](function(_0x3a46fe){if(_0x3a46fe){return _0x3a46fe?{'count':_0x51b580,'rows':_0x3a46fe}:null;}})[_0x417c('0x1f')](respondWithResult(_0x1a8a9c,null))[_0x417c('0x2a')](handleError(_0x1a8a9c,null));};exports[_0x417c('0xd5')]=function(_0xacf71a,_0x8ebed1,_0x3f56e1){var _0x6646c2={};var _0xd51fdf={};var _0x5cb4fa;var _0x1a9069;return db[_0x417c('0x45')][_0x417c('0xa2')]({'where':{'id':_0xacf71a[_0x417c('0x69')]['id']}})['then'](handleEntityNotFound(_0x8ebed1,null))[_0x417c('0x1f')](function(_0x38d715){if(_0x38d715){_0x5cb4fa=_0x38d715;_0xd51fdf[_0x417c('0x4a')]=_[_0x417c('0x4f')](db[_0x417c('0xd6')][_0x417c('0x46')]);_0xd51fdf[_0x417c('0x4e')]=_[_0x417c('0x4f')](_0xacf71a['query']);_0xd51fdf[_0x417c('0x50')]=_[_0x417c('0x51')](_0xd51fdf[_0x417c('0x4a')],_0xd51fdf['query']);_0x6646c2[_0x417c('0x53')]=_[_0x417c('0x51')](_0xd51fdf[_0x417c('0x4a')],qs[_0x417c('0x52')](_0xacf71a['query'][_0x417c('0x52')]));_0x6646c2[_0x417c('0x53')]=_0x6646c2[_0x417c('0x53')][_0x417c('0x54')]?_0x6646c2[_0x417c('0x53')]:_0xd51fdf[_0x417c('0x4a')];_0x6646c2['order']=qs['sort'](_0xacf71a[_0x417c('0x4e')][_0x417c('0x57')]);_0x6646c2[_0x417c('0x58')]=qs[_0x417c('0x50')](_['pick'](_0xacf71a[_0x417c('0x4e')],_0xd51fdf['filters']));if(_0xacf71a[_0x417c('0x4e')]['filter']){_0x6646c2[_0x417c('0x58')]=_[_0x417c('0x5b')](_0x6646c2[_0x417c('0x58')],{'$or':_[_0x417c('0x3c')](_0x6646c2['attributes'],function(_0x22b4af){var _0x1d883c={};_0x1d883c[_0x22b4af]={'$like':'%'+_0xacf71a['query'][_0x417c('0x5a')]+'%'};return _0x1d883c;})});}_0x6646c2=_['merge']({},_0x6646c2,_0xacf71a['options']);return _0x5cb4fa[_0x417c('0xd5')](_0x6646c2);}})[_0x417c('0x1f')](function(_0x331406){if(_0x331406){_0x1a9069=_0x331406['length'];if(!_0xacf71a[_0x417c('0x4e')][_0x417c('0x55')]('nolimit')){_0x6646c2[_0x417c('0x2e')]=qs[_0x417c('0x2e')](_0xacf71a[_0x417c('0x4e')][_0x417c('0x2e')]);_0x6646c2[_0x417c('0x2d')]=qs[_0x417c('0x2d')](_0xacf71a[_0x417c('0x4e')][_0x417c('0x2d')]);}return _0x5cb4fa[_0x417c('0xd5')](_0x6646c2);}})[_0x417c('0x1f')](function(_0x4b2ba1){if(_0x4b2ba1){return _0x4b2ba1?{'count':_0x1a9069,'rows':_0x4b2ba1}:null;}})['then'](respondWithResult(_0x8ebed1,null))[_0x417c('0x2a')](handleError(_0x8ebed1,null));};exports['getRecordings']=function(_0x109d8c,_0x58f1e1,_0x164f5b){var _0x27255d={'raw':!![],'where':{}};var _0x3d9931={};var _0x230b98={'count':0x0,'rows':[]};return db[_0x417c('0x45')][_0x417c('0xa2')]({'where':{'id':_0x109d8c['params']['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x58f1e1,null))[_0x417c('0x1f')](function(_0x4966e6){if(_0x4966e6){_0x3d9931[_0x417c('0x4a')]=_[_0x417c('0x4f')](db['VoiceRecording'][_0x417c('0x46')]);_0x3d9931[_0x417c('0x4e')]=_[_0x417c('0x4f')](_0x109d8c['query']);_0x3d9931[_0x417c('0x50')]=_['intersection'](_0x3d9931[_0x417c('0x4a')],_0x3d9931[_0x417c('0x4e')]);_0x27255d[_0x417c('0x53')]=_[_0x417c('0x51')](_0x3d9931[_0x417c('0x4a')],qs[_0x417c('0x52')](_0x109d8c[_0x417c('0x4e')][_0x417c('0x52')]));_0x27255d[_0x417c('0x53')]=_0x27255d['attributes'][_0x417c('0x54')]?_0x27255d['attributes']:_0x3d9931['model'];if(!_0x109d8c['query'][_0x417c('0x55')](_0x417c('0x56'))){_0x27255d[_0x417c('0x2e')]=qs[_0x417c('0x2e')](_0x109d8c[_0x417c('0x4e')][_0x417c('0x2e')]);_0x27255d[_0x417c('0x2d')]=qs[_0x417c('0x2d')](_0x109d8c[_0x417c('0x4e')][_0x417c('0x2d')]);}_0x27255d['order']=qs[_0x417c('0x57')](_0x109d8c['query']['sort']);_0x27255d[_0x417c('0x58')]=qs[_0x417c('0x50')](_[_0x417c('0x59')](_0x109d8c['query'],_0x3d9931['filters']));_0x27255d[_0x417c('0x58')]['UserId']=_0x4966e6['id'];if(_0x109d8c[_0x417c('0x4e')][_0x417c('0x5a')]){_0x27255d[_0x417c('0x58')]=_[_0x417c('0x5b')](_0x27255d[_0x417c('0x58')],{'$or':_[_0x417c('0x3c')](_0x27255d[_0x417c('0x53')],function(_0x3a0a7b){var _0x4f318a={};_0x4f318a[_0x3a0a7b]={'$like':'%'+_0x109d8c[_0x417c('0x4e')][_0x417c('0x5a')]+'%'};return _0x4f318a;})});}_0x27255d=_['merge']({},_0x27255d,_0x109d8c[_0x417c('0x60')]);return db[_0x417c('0xd7')][_0x417c('0x61')]({'where':_0x27255d[_0x417c('0x58')]})[_0x417c('0x1f')](function(_0x1debd8){_0x230b98[_0x417c('0x61')]=_0x1debd8;if(_0x109d8c[_0x417c('0x4e')][_0x417c('0x65')]){_0x27255d['include']=[{'all':!![]}];}return db[_0x417c('0xd7')]['findAll'](_0x27255d);})['then'](function(_0x46479d){_0x230b98[_0x417c('0x63')]=_0x46479d;return _0x230b98;});}})[_0x417c('0x1f')](respondWithFilteredResult(_0x58f1e1,_0x27255d))[_0x417c('0x2a')](handleError(_0x58f1e1,null));};exports[_0x417c('0xd8')]=function(_0x77d6d0,_0x3ccd9c,_0x3e153e){var _0x30b9da={'raw':!![],'where':{}};var _0x5d94dc={};var _0x45ef4b={'count':0x0,'rows':[]};return db[_0x417c('0x45')]['findOne']({'where':{'id':_0x77d6d0[_0x417c('0x69')]['id']}})['then'](handleEntityNotFound(_0x3ccd9c,null))[_0x417c('0x1f')](function(_0x224efa){if(_0x224efa){_0x5d94dc[_0x417c('0x4a')]=_[_0x417c('0x4f')](db[_0x417c('0xd9')]['rawAttributes']);_0x5d94dc[_0x417c('0x4e')]=_['keys'](_0x77d6d0[_0x417c('0x4e')]);_0x5d94dc[_0x417c('0x50')]=_[_0x417c('0x51')](_0x5d94dc[_0x417c('0x4a')],_0x5d94dc['query']);_0x30b9da[_0x417c('0x53')]=_[_0x417c('0x51')](_0x5d94dc[_0x417c('0x4a')],qs[_0x417c('0x52')](_0x77d6d0[_0x417c('0x4e')]['fields']));_0x30b9da[_0x417c('0x53')]=_0x30b9da[_0x417c('0x53')]['length']?_0x30b9da[_0x417c('0x53')]:_0x5d94dc['model'];if(!_0x77d6d0[_0x417c('0x4e')]['hasOwnProperty'](_0x417c('0x56'))){_0x30b9da[_0x417c('0x2e')]=qs[_0x417c('0x2e')](_0x77d6d0['query'][_0x417c('0x2e')]);_0x30b9da[_0x417c('0x2d')]=qs[_0x417c('0x2d')](_0x77d6d0[_0x417c('0x4e')][_0x417c('0x2d')]);}_0x30b9da[_0x417c('0xca')]=qs['sort'](_0x77d6d0[_0x417c('0x4e')]['sort']);_0x30b9da[_0x417c('0x58')]=qs['filters'](_[_0x417c('0x59')](_0x77d6d0[_0x417c('0x4e')],_0x5d94dc[_0x417c('0x50')]));_0x30b9da['where']['UserId']=_0x224efa['id'];if(_0x77d6d0['query'][_0x417c('0x5a')]){_0x30b9da[_0x417c('0x58')]=_[_0x417c('0x5b')](_0x30b9da[_0x417c('0x58')],{'$or':_[_0x417c('0x3c')](_0x30b9da[_0x417c('0x53')],function(_0x31b7f6){var _0x1e6782={};_0x1e6782[_0x31b7f6]={'$like':'%'+_0x77d6d0[_0x417c('0x4e')][_0x417c('0x5a')]+'%'};return _0x1e6782;})});}_0x30b9da=_['merge']({},_0x30b9da,_0x77d6d0[_0x417c('0x60')]);return db[_0x417c('0xd9')][_0x417c('0x61')]({'where':_0x30b9da[_0x417c('0x58')]})[_0x417c('0x1f')](function(_0x1e0371){_0x45ef4b[_0x417c('0x61')]=_0x1e0371;if(_0x77d6d0[_0x417c('0x4e')]['includeAll']){_0x30b9da[_0x417c('0x62')]=[{'all':!![]}];}return db[_0x417c('0xd9')]['findAll'](_0x30b9da);})[_0x417c('0x1f')](function(_0x225d1a){_0x45ef4b[_0x417c('0x63')]=_0x225d1a;return _0x45ef4b;});}})[_0x417c('0x1f')](respondWithFilteredResult(_0x3ccd9c,_0x30b9da))[_0x417c('0x2a')](handleError(_0x3ccd9c,null));};exports['getChatInteractions']=function(_0x2f9c5e,_0xc7414a,_0x57a0e4){var _0x5a4e05={};var _0x3f96df={};var _0x3ce689;var _0x4af92f;return db[_0x417c('0x45')][_0x417c('0xa2')]({'where':{'id':_0x2f9c5e[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0xc7414a,null))[_0x417c('0x1f')](function(_0x17e26e){if(_0x17e26e){_0x3ce689=_0x17e26e;_0x3f96df[_0x417c('0x4a')]=_[_0x417c('0x4f')](db[_0x417c('0xda')][_0x417c('0x46')]);_0x3f96df['query']=_[_0x417c('0x4f')](_0x2f9c5e['query']);_0x3f96df[_0x417c('0x50')]=_['intersection'](_0x3f96df[_0x417c('0x4a')],_0x3f96df[_0x417c('0x4e')]);_0x5a4e05[_0x417c('0x53')]=_['intersection'](_0x3f96df['model'],qs[_0x417c('0x52')](_0x2f9c5e[_0x417c('0x4e')][_0x417c('0x52')]));_0x5a4e05[_0x417c('0x53')]=_0x5a4e05[_0x417c('0x53')][_0x417c('0x54')]?_0x5a4e05['attributes']:_0x3f96df[_0x417c('0x4a')];_0x5a4e05[_0x417c('0xca')]=qs[_0x417c('0x57')](_0x2f9c5e[_0x417c('0x4e')][_0x417c('0x57')]);_0x5a4e05[_0x417c('0x58')]=qs['filters'](_['pick'](_0x2f9c5e['query'],_0x3f96df[_0x417c('0x50')]));if(_0x2f9c5e['query'][_0x417c('0x5a')]){_0x5a4e05[_0x417c('0x58')]=_[_0x417c('0x5b')](_0x5a4e05[_0x417c('0x58')],{'$or':_[_0x417c('0x3c')](_0x5a4e05[_0x417c('0x53')],function(_0x43256c){var _0x2be1d6={};_0x2be1d6[_0x43256c]={'$like':'%'+_0x2f9c5e[_0x417c('0x4e')][_0x417c('0x5a')]+'%'};return _0x2be1d6;})});}_0x5a4e05=_[_0x417c('0x5b')]({},_0x5a4e05,_0x2f9c5e[_0x417c('0x60')]);return _0x3ce689[_0x417c('0xdb')](_0x5a4e05);}})[_0x417c('0x1f')](function(_0x55c123){if(_0x55c123){_0x4af92f=_0x55c123[_0x417c('0x54')];if(!_0x2f9c5e['query'][_0x417c('0x55')]('nolimit')){_0x5a4e05[_0x417c('0x2e')]=qs[_0x417c('0x2e')](_0x2f9c5e[_0x417c('0x4e')][_0x417c('0x2e')]);_0x5a4e05[_0x417c('0x2d')]=qs[_0x417c('0x2d')](_0x2f9c5e['query'][_0x417c('0x2d')]);}return _0x3ce689[_0x417c('0xdb')](_0x5a4e05);}})[_0x417c('0x1f')](function(_0x2aeb56){if(_0x2aeb56){return _0x2aeb56?{'count':_0x4af92f,'rows':_0x2aeb56}:null;}})[_0x417c('0x1f')](respondWithResult(_0xc7414a,null))['catch'](handleError(_0xc7414a,null));};exports[_0x417c('0xdc')]=function(_0x42ad83,_0x428237,_0x1725c1){var _0x2da230={};var _0x2b53e2={};var _0x19bb6b;var _0x5c0525;return db[_0x417c('0x45')][_0x417c('0xa2')]({'where':{'id':_0x42ad83[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x428237,null))['then'](function(_0x3685c0){if(_0x3685c0){_0x19bb6b=_0x3685c0;_0x2b53e2[_0x417c('0x4a')]=_[_0x417c('0x4f')](db[_0x417c('0xdd')][_0x417c('0x46')]);_0x2b53e2[_0x417c('0x4e')]=_[_0x417c('0x4f')](_0x42ad83[_0x417c('0x4e')]);_0x2b53e2[_0x417c('0x50')]=_[_0x417c('0x51')](_0x2b53e2[_0x417c('0x4a')],_0x2b53e2[_0x417c('0x4e')]);_0x2da230[_0x417c('0x53')]=_['intersection'](_0x2b53e2[_0x417c('0x4a')],qs[_0x417c('0x52')](_0x42ad83['query'][_0x417c('0x52')]));_0x2da230[_0x417c('0x53')]=_0x2da230[_0x417c('0x53')]['length']?_0x2da230[_0x417c('0x53')]:_0x2b53e2['model'];_0x2da230[_0x417c('0xca')]=qs[_0x417c('0x57')](_0x42ad83[_0x417c('0x4e')][_0x417c('0x57')]);_0x2da230[_0x417c('0x58')]=qs['filters'](_['pick'](_0x42ad83[_0x417c('0x4e')],_0x2b53e2[_0x417c('0x50')]));if(_0x42ad83[_0x417c('0x4e')][_0x417c('0x5a')]){_0x2da230[_0x417c('0x58')]=_[_0x417c('0x5b')](_0x2da230['where'],{'$or':_[_0x417c('0x3c')](_0x2da230['attributes'],function(_0x4928d7){var _0x4d3aac={};_0x4d3aac[_0x4928d7]={'$like':'%'+_0x42ad83[_0x417c('0x4e')][_0x417c('0x5a')]+'%'};return _0x4d3aac;})});}_0x2da230=_[_0x417c('0x5b')]({},_0x2da230,_0x42ad83['options']);return _0x19bb6b[_0x417c('0xdc')](_0x2da230);}})[_0x417c('0x1f')](function(_0x571210){if(_0x571210){_0x5c0525=_0x571210[_0x417c('0x54')];if(!_0x42ad83[_0x417c('0x4e')][_0x417c('0x55')]('nolimit')){_0x2da230['limit']=qs['limit'](_0x42ad83[_0x417c('0x4e')][_0x417c('0x2e')]);_0x2da230['offset']=qs[_0x417c('0x2d')](_0x42ad83[_0x417c('0x4e')][_0x417c('0x2d')]);}return _0x19bb6b[_0x417c('0xdc')](_0x2da230);}})['then'](function(_0x4cadfd){if(_0x4cadfd){return _0x4cadfd?{'count':_0x5c0525,'rows':_0x4cadfd}:null;}})[_0x417c('0x1f')](respondWithResult(_0x428237,null))[_0x417c('0x2a')](handleError(_0x428237,null));};exports[_0x417c('0xde')]=function(_0x1cceb9,_0x38eaee,_0x4ef875){var _0x80f927={'raw':!![],'where':{}};var _0x47e2db={};var _0x226d5b={'count':0x0,'rows':[]};return db['User'][_0x417c('0xa2')]({'where':{'id':_0x1cceb9[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x38eaee,null))[_0x417c('0x1f')](function(_0x2bc6f4){if(_0x2bc6f4){_0x47e2db['model']=_[_0x417c('0x4f')](db[_0x417c('0xdf')][_0x417c('0x46')]);_0x47e2db[_0x417c('0x4e')]=_[_0x417c('0x4f')](_0x1cceb9[_0x417c('0x4e')]);_0x47e2db[_0x417c('0x50')]=_[_0x417c('0x51')](_0x47e2db[_0x417c('0x4a')],_0x47e2db[_0x417c('0x4e')]);_0x80f927['attributes']=_['intersection'](_0x47e2db[_0x417c('0x4a')],qs[_0x417c('0x52')](_0x1cceb9['query'][_0x417c('0x52')]));_0x80f927[_0x417c('0x53')]=_0x80f927['attributes'][_0x417c('0x54')]?_0x80f927[_0x417c('0x53')]:_0x47e2db[_0x417c('0x4a')];if(!_0x1cceb9['query'][_0x417c('0x55')](_0x417c('0x56'))){_0x80f927['limit']=qs['limit'](_0x1cceb9[_0x417c('0x4e')]['limit']);_0x80f927[_0x417c('0x2d')]=qs[_0x417c('0x2d')](_0x1cceb9[_0x417c('0x4e')][_0x417c('0x2d')]);}_0x80f927[_0x417c('0xca')]=qs[_0x417c('0x57')](_0x1cceb9[_0x417c('0x4e')][_0x417c('0x57')]);_0x80f927[_0x417c('0x58')]=qs[_0x417c('0x50')](_[_0x417c('0x59')](_0x1cceb9[_0x417c('0x4e')],_0x47e2db[_0x417c('0x50')]));_0x80f927[_0x417c('0x58')][_0x417c('0xe0')]=_0x2bc6f4['id'];if(_0x1cceb9[_0x417c('0x4e')]['filter']){_0x80f927[_0x417c('0x58')]=_[_0x417c('0x5b')](_0x80f927['where'],{'$or':_[_0x417c('0x3c')](_0x80f927['attributes'],function(_0x4725fa){var _0x2a12dd={};_0x2a12dd[_0x4725fa]={'$like':'%'+_0x1cceb9['query'][_0x417c('0x5a')]+'%'};return _0x2a12dd;})});}_0x80f927=_[_0x417c('0x5b')]({},_0x80f927,_0x1cceb9['options']);return db[_0x417c('0xdf')][_0x417c('0x61')]({'where':_0x80f927[_0x417c('0x58')]})[_0x417c('0x1f')](function(_0x5bb193){_0x226d5b[_0x417c('0x61')]=_0x5bb193;if(_0x1cceb9['query'][_0x417c('0x65')]){_0x80f927['include']=[{'all':!![]}];}return db[_0x417c('0xdf')]['findAll'](_0x80f927);})[_0x417c('0x1f')](function(_0x233534){_0x226d5b[_0x417c('0x63')]=_0x233534;return _0x226d5b;});}})[_0x417c('0x1f')](respondWithFilteredResult(_0x38eaee,_0x80f927))[_0x417c('0x2a')](handleError(_0x38eaee,null));};exports[_0x417c('0xe1')]=function(_0x4035be,_0x507701,_0x1bbf99){var _0x51e8ae={};var _0x280209={};var _0x3304cb;var _0x1d3e31;return db['User']['findOne']({'where':{'id':_0x4035be[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x507701,null))[_0x417c('0x1f')](function(_0x5f23c1){if(_0x5f23c1){_0x3304cb=_0x5f23c1;_0x280209['model']=_[_0x417c('0x4f')](db['SmsInteraction'][_0x417c('0x46')]);_0x280209[_0x417c('0x4e')]=_[_0x417c('0x4f')](_0x4035be[_0x417c('0x4e')]);_0x280209[_0x417c('0x50')]=_[_0x417c('0x51')](_0x280209[_0x417c('0x4a')],_0x280209[_0x417c('0x4e')]);_0x51e8ae[_0x417c('0x53')]=_[_0x417c('0x51')](_0x280209[_0x417c('0x4a')],qs['fields'](_0x4035be['query']['fields']));_0x51e8ae[_0x417c('0x53')]=_0x51e8ae[_0x417c('0x53')][_0x417c('0x54')]?_0x51e8ae[_0x417c('0x53')]:_0x280209['model'];_0x51e8ae[_0x417c('0xca')]=qs[_0x417c('0x57')](_0x4035be['query'][_0x417c('0x57')]);_0x51e8ae[_0x417c('0x58')]=qs[_0x417c('0x50')](_['pick'](_0x4035be[_0x417c('0x4e')],_0x280209[_0x417c('0x50')]));if(_0x4035be[_0x417c('0x4e')][_0x417c('0x5a')]){_0x51e8ae[_0x417c('0x58')]=_['merge'](_0x51e8ae[_0x417c('0x58')],{'$or':_['map'](_0x51e8ae[_0x417c('0x53')],function(_0x27525c){var _0x4fef5c={};_0x4fef5c[_0x27525c]={'$like':'%'+_0x4035be[_0x417c('0x4e')][_0x417c('0x5a')]+'%'};return _0x4fef5c;})});}_0x51e8ae=_[_0x417c('0x5b')]({},_0x51e8ae,_0x4035be[_0x417c('0x60')]);return _0x3304cb[_0x417c('0xe1')](_0x51e8ae);}})[_0x417c('0x1f')](function(_0x1d4c61){if(_0x1d4c61){_0x1d3e31=_0x1d4c61['length'];if(!_0x4035be[_0x417c('0x4e')][_0x417c('0x55')]('nolimit')){_0x51e8ae[_0x417c('0x2e')]=qs[_0x417c('0x2e')](_0x4035be[_0x417c('0x4e')]['limit']);_0x51e8ae[_0x417c('0x2d')]=qs['offset'](_0x4035be[_0x417c('0x4e')][_0x417c('0x2d')]);}return _0x3304cb[_0x417c('0xe1')](_0x51e8ae);}})[_0x417c('0x1f')](function(_0x1e4d78){if(_0x1e4d78){return _0x1e4d78?{'count':_0x1d3e31,'rows':_0x1e4d78}:null;}})[_0x417c('0x1f')](respondWithResult(_0x507701,null))['catch'](handleError(_0x507701,null));};exports['getFaxInteractions']=function(_0x19ba0e,_0x3fae88,_0x4064fb){var _0x1f5302={};var _0x3ba2b2={};var _0x36644f;var _0x5b1569;return db['User'][_0x417c('0xa2')]({'where':{'id':_0x19ba0e[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x3fae88,null))[_0x417c('0x1f')](function(_0x457324){if(_0x457324){_0x36644f=_0x457324;_0x3ba2b2[_0x417c('0x4a')]=_[_0x417c('0x4f')](db['FaxInteraction'][_0x417c('0x46')]);_0x3ba2b2['query']=_[_0x417c('0x4f')](_0x19ba0e[_0x417c('0x4e')]);_0x3ba2b2[_0x417c('0x50')]=_[_0x417c('0x51')](_0x3ba2b2[_0x417c('0x4a')],_0x3ba2b2['query']);_0x1f5302[_0x417c('0x53')]=_[_0x417c('0x51')](_0x3ba2b2['model'],qs[_0x417c('0x52')](_0x19ba0e[_0x417c('0x4e')][_0x417c('0x52')]));_0x1f5302[_0x417c('0x53')]=_0x1f5302[_0x417c('0x53')][_0x417c('0x54')]?_0x1f5302[_0x417c('0x53')]:_0x3ba2b2['model'];_0x1f5302[_0x417c('0xca')]=qs[_0x417c('0x57')](_0x19ba0e['query'][_0x417c('0x57')]);_0x1f5302[_0x417c('0x58')]=qs[_0x417c('0x50')](_[_0x417c('0x59')](_0x19ba0e['query'],_0x3ba2b2['filters']));if(_0x19ba0e[_0x417c('0x4e')]['filter']){_0x1f5302[_0x417c('0x58')]=_['merge'](_0x1f5302[_0x417c('0x58')],{'$or':_['map'](_0x1f5302[_0x417c('0x53')],function(_0x354357){var _0x3049b5={};_0x3049b5[_0x354357]={'$like':'%'+_0x19ba0e[_0x417c('0x4e')][_0x417c('0x5a')]+'%'};return _0x3049b5;})});}_0x1f5302=_['merge']({},_0x1f5302,_0x19ba0e[_0x417c('0x60')]);return _0x36644f[_0x417c('0xe2')](_0x1f5302);}})[_0x417c('0x1f')](function(_0x3c5eb0){if(_0x3c5eb0){_0x5b1569=_0x3c5eb0[_0x417c('0x54')];if(!_0x19ba0e[_0x417c('0x4e')][_0x417c('0x55')]('nolimit')){_0x1f5302[_0x417c('0x2e')]=qs[_0x417c('0x2e')](_0x19ba0e[_0x417c('0x4e')]['limit']);_0x1f5302[_0x417c('0x2d')]=qs['offset'](_0x19ba0e[_0x417c('0x4e')]['offset']);}return _0x36644f['getFaxInteractions'](_0x1f5302);}})['then'](function(_0x53ad5f){if(_0x53ad5f){return _0x53ad5f?{'count':_0x5b1569,'rows':_0x53ad5f}:null;}})[_0x417c('0x1f')](respondWithResult(_0x3fae88,null))[_0x417c('0x2a')](handleError(_0x3fae88,null));};exports['getWhatsappInteractions']=function(_0x2f405f,_0x1eef53,_0x297963){var _0x46d83a={};var _0x4088e2={};var _0x134cac;var _0x460561;return db[_0x417c('0x45')][_0x417c('0xa2')]({'where':{'id':_0x2f405f[_0x417c('0x69')]['id']}})['then'](handleEntityNotFound(_0x1eef53,null))[_0x417c('0x1f')](function(_0x2e7a68){if(_0x2e7a68){_0x134cac=_0x2e7a68;_0x4088e2[_0x417c('0x4a')]=_[_0x417c('0x4f')](db['WhatsappInteraction'][_0x417c('0x46')]);_0x4088e2[_0x417c('0x4e')]=_['keys'](_0x2f405f[_0x417c('0x4e')]);_0x4088e2['filters']=_[_0x417c('0x51')](_0x4088e2[_0x417c('0x4a')],_0x4088e2[_0x417c('0x4e')]);_0x46d83a[_0x417c('0x53')]=_[_0x417c('0x51')](_0x4088e2['model'],qs[_0x417c('0x52')](_0x2f405f[_0x417c('0x4e')][_0x417c('0x52')]));_0x46d83a['attributes']=_0x46d83a['attributes'][_0x417c('0x54')]?_0x46d83a[_0x417c('0x53')]:_0x4088e2[_0x417c('0x4a')];_0x46d83a[_0x417c('0xca')]=qs[_0x417c('0x57')](_0x2f405f[_0x417c('0x4e')][_0x417c('0x57')]);_0x46d83a['where']=qs[_0x417c('0x50')](_['pick'](_0x2f405f[_0x417c('0x4e')],_0x4088e2[_0x417c('0x50')]));if(_0x2f405f[_0x417c('0x4e')][_0x417c('0x5a')]){_0x46d83a[_0x417c('0x58')]=_[_0x417c('0x5b')](_0x46d83a[_0x417c('0x58')],{'$or':_[_0x417c('0x3c')](_0x46d83a[_0x417c('0x53')],function(_0xab026a){var _0x19792b={};_0x19792b[_0xab026a]={'$like':'%'+_0x2f405f[_0x417c('0x4e')][_0x417c('0x5a')]+'%'};return _0x19792b;})});}_0x46d83a=_[_0x417c('0x5b')]({},_0x46d83a,_0x2f405f[_0x417c('0x60')]);return _0x134cac[_0x417c('0xe3')](_0x46d83a);}})['then'](function(_0x204fb4){if(_0x204fb4){_0x460561=_0x204fb4[_0x417c('0x54')];if(!_0x2f405f['query']['hasOwnProperty'](_0x417c('0x56'))){_0x46d83a[_0x417c('0x2e')]=qs[_0x417c('0x2e')](_0x2f405f[_0x417c('0x4e')]['limit']);_0x46d83a[_0x417c('0x2d')]=qs['offset'](_0x2f405f[_0x417c('0x4e')][_0x417c('0x2d')]);}return _0x134cac[_0x417c('0xe3')](_0x46d83a);}})[_0x417c('0x1f')](function(_0x5619f7){if(_0x5619f7){return _0x5619f7?{'count':_0x460561,'rows':_0x5619f7}:null;}})[_0x417c('0x1f')](respondWithResult(_0x1eef53,null))[_0x417c('0x2a')](handleError(_0x1eef53,null));};exports[_0x417c('0xe4')]=function(_0x10f904,_0x49d3b7,_0x298c42){var _0xba2d36;var _0x21d3bc;var _0x10d67a;var _0x187fe3=!_[_0x417c('0x70')](_0x10f904[_0x417c('0x69')]['id'])?_0x10f904[_0x417c('0x69')]['id']:!_['isNil'](_0x10f904[_0x417c('0x37')]['id'])?_0x10f904[_0x417c('0x37')]['id']:null;return db[_0x417c('0x45')][_0x417c('0x68')]({'where':{'id':_0x187fe3,'role':{'$or':[_0x417c('0x35'),_0x417c('0x37'),_0x417c('0x39')]}},'attributes':['id',_0x417c('0x42'),_0x417c('0xe5'),_0x417c('0xe6'),_0x417c('0x34'),_0x417c('0x6f'),'loginInPause']})[_0x417c('0x1f')](function(_0x42949b){if(_0x42949b){if(_0x42949b[_0x417c('0x34')]===_0x417c('0x39')){_0xba2d36=_0x42949b;if(_0x10f904[_0x417c('0x67')]['interface']){_0x10d67a=util['format'](_0x417c('0xe7'),_0xba2d36[_0x10f904[_0x417c('0x67')][_0x417c('0xab')]]);}else if(_0x10f904[_0x417c('0x67')][_0x417c('0xe8')]){_0x10d67a=util[_0x417c('0xb8')](_0x417c('0xb9'),_0x10f904[_0x417c('0x67')][_0x417c('0xe8')]);}else{_0x10d67a=util[_0x417c('0xb8')](_0x417c('0xb9'),_0xba2d36['name']);}socket['to'](util['format'](_0x417c('0xe9'),_0xba2d36[_0x417c('0x42')]))[_0x417c('0xb4')](_0x417c('0xea'),{'user':{'id':_0xba2d36['id'],'name':_0xba2d36[_0x417c('0x42')]},'ip':_0x10f904['headers']['x-forwarded-for']||_0x10f904[_0x417c('0xeb')][_0x417c('0xec')]||_0x10f904['socket'][_0x417c('0xec')]||_0x10f904[_0x417c('0xeb')][_0x417c('0xed')][_0x417c('0xec')]});return db[_0x417c('0xbb')]['destroy']({'where':{'membername':_0xba2d36[_0x417c('0x42')]},'individualHooks':!![]});}}else{throw new db[(_0x417c('0x99'))][(_0x417c('0x9c'))](_0x417c('0xee'));}})['then'](function(){if(_0xba2d36){return _0xba2d36[_0x417c('0xef')]({'raw':!![]});}})['then'](function(_0x504bee){if(_0xba2d36){var _0x24b369=[];if(_0x504bee){_0x21d3bc=_0x504bee;if(_0x21d3bc[_0x417c('0x54')]){for(var _0xa3b46e=0x0;_0xa3b46e<_0x21d3bc['length'];_0xa3b46e++){_0x24b369[_0x417c('0x90')]({'membername':_0xba2d36[_0x417c('0x42')],'UserId':_0xba2d36['id'],'queue_name':_0x21d3bc[_0xa3b46e][_0x417c('0x42')],'VoiceQueueId':_0x21d3bc[_0xa3b46e]['id'],'interface':_0x10d67a,'paused':_0xba2d36[_0x417c('0xf0')]||![],'penalty':_0x21d3bc[_0xa3b46e][_0x417c('0xf1')]||0x0});}return BPromise[_0x417c('0x92')](_0x24b369,function(_0x3b8c92){return db['UserVoiceQueueRt'][_0x417c('0xf2')](_0x3b8c92);});}}}})['then'](function(){if(_0xba2d36){return db[_0x417c('0xf3')][_0x417c('0x94')]({'where':{'membername':_0xba2d36[_0x417c('0x42')],'exitAt':null}});}})[_0x417c('0x1f')](function(_0x2a04d2){if(_0xba2d36){var _0x438fd1=[];_0x2a04d2[_0x417c('0xf4')](function(_0x1917a4){_0x438fd1[_0x417c('0x90')](_0x1917a4[_0x417c('0x66')]({'exitAt':moment()['format'](_0x417c('0xf5'))}));});return BPromise[_0x417c('0x91')](_0x438fd1);}})[_0x417c('0x1f')](function(){if(_0xba2d36){var _0x30ebab=[];var _0x48e280=[];var _0x1591ea=utils[_0x417c('0xf6')]();var _0x4db455={'membername':_0xba2d36[_0x417c('0x42')],'interface':_0x10d67a,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xba2d36[_0x417c('0x34')],'internal':_0xba2d36[_0x417c('0x6f')]};_0x1591ea['forEach'](function(_0x42c9c3){_0x30ebab['push'](_['merge']({'channel':_0x42c9c3,'type':_0x417c('0xf7'),'data1':_0x10f904[_0x417c('0x67')][_0x417c('0xf8')],'data2':_0x10d67a},_0x4db455));if(_0xba2d36[_0x417c('0xf0')]){_0x48e280[_0x417c('0x90')](_[_0x417c('0x5b')]({'channel':_0x42c9c3,'type':_0x417c('0xf9'),'data1':_0x417c('0xfa')},_0x4db455));}});return db[_0x417c('0xf3')][_0x417c('0x8e')](_0x30ebab[_0x417c('0xfb')](_0x48e280),{'individualHooks':!![]});}})[_0x417c('0x1f')](function(){if(_0xba2d36){return _0xba2d36[_0x417c('0x66')]({'online':!![],'lastLoginAt':moment()[_0x417c('0xb8')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xba2d36[_0x417c('0xf0')]||![],'mailPause':_0xba2d36[_0x417c('0xf0')]||![],'chatPause':_0xba2d36[_0x417c('0xf0')]||![],'faxPause':_0xba2d36['loginInPause']||![],'smsPause':_0xba2d36[_0x417c('0xf0')]||![],'openchannelPause':_0xba2d36[_0x417c('0xf0')]||![],'whatsappPause':_0xba2d36[_0x417c('0xf0')]||![],'pauseType':_0xba2d36[_0x417c('0xf0')]?_0x417c('0xfa'):null,'interface':_0x10d67a,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x417c('0x1f')](function(_0x24bea6){if(_0x10f904[_0x417c('0xfc')]){return _0x298c42();}else{return BPromise['resolve'](_0x24bea6)[_0x417c('0x1f')](respondWithResult(_0x49d3b7,null));}})['catch'](handleError(_0x49d3b7,null));};exports[_0x417c('0xfd')]=function(_0x15b722,_0x10b440,_0x32bc25){var _0x9b59f6;return db[_0x417c('0x45')][_0x417c('0x68')]({'where':{'id':_0x15b722[_0x417c('0x69')]['id'],'role':_0x417c('0x39')},'attributes':['id',_0x417c('0x42'),'role']})[_0x417c('0x1f')](handleEntityNotFound(_0x10b440,null))[_0x417c('0x1f')](function(_0x9af106){if(_0x9af106){_0x9b59f6=_0x9af106;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x9b59f6[_0x417c('0x42')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport'][_0x417c('0x94')]({'where':{'membername':_0x9b59f6[_0x417c('0x42')],'exitAt':null}});})[_0x417c('0x1f')](function(_0xc7e9f2){var _0x303e3e=[];_0xc7e9f2[_0x417c('0xf4')](function(_0x344cc1){_0x303e3e['push'](_0x344cc1[_0x417c('0x66')]({'exitAt':moment()['format'](_0x417c('0xf5'))}));});return BPromise[_0x417c('0x91')](_0x303e3e);})[_0x417c('0x1f')](function(){return _0x9b59f6[_0x417c('0x66')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x10b440,null))[_0x417c('0x2a')](handleError(_0x10b440,null));};exports[_0x417c('0xfe')]=function(_0xe25358,_0x2ac6dd,_0x1248ee){var _0xd421dd;return db[_0x417c('0xbb')][_0x417c('0x66')]({'paused':0x1},{'where':{'UserId':_0xe25358[_0x417c('0x69')]['id']},'individualHooks':!![]})[_0x417c('0x1f')](function(){return db['User'][_0x417c('0x68')]({'where':{'id':_0xe25358[_0x417c('0x69')]['id'],'role':_0x417c('0x39')},'attributes':['id',_0x417c('0x42'),'role','internal',_0x417c('0xab')]});})['then'](handleEntityNotFound(_0x2ac6dd,null))['then'](function(_0xc4ab27){if(_0xc4ab27){_0xd421dd=_0xc4ab27;return respondWithRpcPromise(_0x417c('0xff'),_0x417c('0xfe'),{'id':_0xd421dd['id'],'name':_0xd421dd[_0x417c('0x42')],'pause':!![]});}})[_0x417c('0x1f')](function(){if(_0xd421dd){return db[_0x417c('0xf3')]['findAll']({'where':{'membername':_0xd421dd[_0x417c('0x42')],'type':_0x417c('0xf9'),'exitAt':null}});}})['then'](function(_0x825ead){if(_0x825ead[_0x417c('0x54')]){var _0x304caa=moment()[_0x417c('0xb8')](_0x417c('0xf5'));for(var _0x57f832=0x0,_0x34c491=_0x825ead['length'];_0x57f832<_0x34c491;_0x57f832++){_0x825ead[_0x57f832]['updateAttributes']({'exitAt':_0x304caa});}}})[_0x417c('0x1f')](function(){var _0x2c31dd=[];var _0x112764=utils[_0x417c('0xf6')]();_0x112764['forEach'](function(_0x4e2882){_0x2c31dd['push']({'channel':_0x4e2882,'membername':_0xd421dd['name'],'interface':_[_0x417c('0x70')](_0xd421dd[_0x417c('0xab')])?util[_0x417c('0xb8')]('SIP/%s',_0xd421dd[_0x417c('0x42')]):_0xd421dd[_0x417c('0xab')],'type':_0x417c('0xf9'),'enterAt':moment()[_0x417c('0xb8')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0xe25358[_0x417c('0x67')][_0x417c('0x48')]||_0x417c('0x100'),'role':_0xd421dd[_0x417c('0x34')],'internal':_0xd421dd[_0x417c('0x6f')]});});return db['MemberReport']['bulkCreate'](_0x2c31dd,{'individualHooks':!![]});})['then'](function(){return _0xd421dd['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xe25358[_0x417c('0x67')][_0x417c('0x48')]||_0x417c('0x100'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x2ac6dd,null))['catch'](handleError(_0x2ac6dd,null));};exports[_0x417c('0x101')]=function(_0x5a412d,_0x13522a,_0x432b2a){var _0x5821b6;return db[_0x417c('0x45')][_0x417c('0x68')]({'where':{'id':_0x5a412d['params']['id']},'attributes':['id',_0x417c('0x42'),_0x417c('0x34'),_0x417c('0xba'),'mailPause',_0x417c('0x102'),_0x417c('0x103'),_0x417c('0x104'),'smsPause',_0x417c('0x105'),_0x417c('0x106'),_0x417c('0x107')]})[_0x417c('0x1f')](handleEntityNotFound(_0x13522a,null))[_0x417c('0x1f')](function(_0x51c988){if(_0x51c988){_0x5821b6=_0x51c988;if(_0x5a412d['body']['channel']&&!utils[_0x417c('0xac')](_0x5a412d[_0x417c('0x67')]['channel'])){throw new db[(_0x417c('0x99'))][(_0x417c('0x9c'))]('Unknown\x20channel');}switch(_0x5a412d[_0x417c('0x67')]['channel']){case _0x417c('0xb6'):return respondWithRpcPromise(_0x417c('0xff'),'unpause',{'id':_0x5821b6['id'],'name':_0x5821b6['name'],'pause':![]})['then'](function(){return db[_0x417c('0xbb')][_0x417c('0x66')]({'paused':0x0},{'where':{'UserId':_0x5821b6['id']},'individualHooks':!![]});})['then'](function(){return db[_0x417c('0xf3')][_0x417c('0x68')]({'where':{'channel':_0x5a412d[_0x417c('0x67')]['channel'],'membername':_0x5821b6[_0x417c('0x42')],'type':_0x417c('0xf9'),'exitAt':null}});})['then'](function(_0xbd2c1a){if(_0xbd2c1a){return _0xbd2c1a['update']({'exitAt':moment()['format'](_0x417c('0xf5')),'data2':_0x417c('0x108')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x5821b6[_0x417c('0x66')]({'voicePause':![]});});case'mail':case _0x417c('0x109'):case _0x417c('0x10a'):case _0x417c('0x10b'):case _0x417c('0x10c'):case _0x417c('0x10d'):return db[_0x417c('0xf3')]['find']({'where':{'channel':_0x5a412d[_0x417c('0x67')][_0x417c('0xa9')],'membername':_0x5821b6[_0x417c('0x42')],'type':_0x417c('0xf9'),'exitAt':null}})[_0x417c('0x1f')](function(_0x42370f){if(_0x42370f){return _0x42370f[_0x417c('0x66')]({'exitAt':moment()[_0x417c('0xb8')](_0x417c('0xf5')),'data2':_0x417c('0x108')},{'individualHooks':!![]});}return null;})[_0x417c('0x1f')](function(){var _0x1af1d5={};_[_0x417c('0x2f')](_0x1af1d5,util[_0x417c('0xb8')]('%s%s',_0x5a412d['body'][_0x417c('0xa9')],_0x417c('0x10e')),![]);return _0x5821b6[_0x417c('0x66')](_0x1af1d5);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0x5821b6['id'],'name':_0x5821b6[_0x417c('0x42')],'pause':![]})[_0x417c('0x1f')](function(){return db[_0x417c('0xbb')][_0x417c('0x66')]({'paused':0x0},{'where':{'UserId':_0x5821b6['id']}});})[_0x417c('0x1f')](function(){return db[_0x417c('0xf3')]['findAll']({'where':{'membername':_0x5821b6[_0x417c('0x42')],'type':_0x417c('0xf9'),'exitAt':null}});})[_0x417c('0x1f')](function(_0xf47fbe){var _0x53ee81=[];_0xf47fbe[_0x417c('0xf4')](function(_0x55ca73){_0x53ee81[_0x417c('0x90')](_0x55ca73[_0x417c('0x66')]({'exitAt':moment()[_0x417c('0xb8')](_0x417c('0xf5')),'data2':'manual'}));});return BPromise['all'](_0x53ee81);})[_0x417c('0x1f')](function(){return _0x5821b6['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x417c('0x1f')](respondWithResult(_0x13522a,null))['catch'](handleError(_0x13522a,null));};exports['getTeams']=function(_0xe03858,_0x516e7f,_0x157bb2){var _0x4515d1={};var _0x1289b2={};var _0x4311ad;var _0x119b85;return db[_0x417c('0x45')]['findOne']({'where':{'id':_0xe03858[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x516e7f,null))[_0x417c('0x1f')](function(_0x4f2520){if(_0x4f2520){_0x4311ad=_0x4f2520;_0x1289b2[_0x417c('0x4a')]=_[_0x417c('0x4f')](db['Team'][_0x417c('0x46')]);_0x1289b2[_0x417c('0x4e')]=_[_0x417c('0x4f')](_0xe03858[_0x417c('0x4e')]);_0x1289b2[_0x417c('0x50')]=_[_0x417c('0x51')](_0x1289b2['model'],_0x1289b2[_0x417c('0x4e')]);_0x4515d1[_0x417c('0x53')]=_[_0x417c('0x51')](_0x1289b2['model'],qs[_0x417c('0x52')](_0xe03858[_0x417c('0x4e')][_0x417c('0x52')]));_0x4515d1['attributes']=_0x4515d1[_0x417c('0x53')][_0x417c('0x54')]?_0x4515d1['attributes']:_0x1289b2['model'];_0x4515d1[_0x417c('0xca')]=qs[_0x417c('0x57')](_0xe03858[_0x417c('0x4e')][_0x417c('0x57')]);_0x4515d1['where']=qs[_0x417c('0x50')](_[_0x417c('0x59')](_0xe03858[_0x417c('0x4e')],_0x1289b2['filters']));if(_0xe03858[_0x417c('0x4e')]['filter']){_0x4515d1[_0x417c('0x58')]=_[_0x417c('0x5b')](_0x4515d1['where'],{'$or':_[_0x417c('0x3c')](_0x4515d1[_0x417c('0x53')],function(_0x5280c9){var _0x9b5208={};_0x9b5208[_0x5280c9]={'$like':'%'+_0xe03858[_0x417c('0x4e')][_0x417c('0x5a')]+'%'};return _0x9b5208;})});}_0x4515d1=_[_0x417c('0x5b')]({},_0x4515d1,_0xe03858[_0x417c('0x60')]);return _0x4311ad[_0x417c('0x10f')](_0x4515d1);}})[_0x417c('0x1f')](function(_0x1a6b2a){if(_0x1a6b2a){_0x119b85=_0x1a6b2a['length'];if(!_0xe03858['query']['hasOwnProperty'](_0x417c('0x56'))){_0x4515d1['limit']=qs['limit'](_0xe03858[_0x417c('0x4e')][_0x417c('0x2e')]);_0x4515d1['offset']=qs[_0x417c('0x2d')](_0xe03858[_0x417c('0x4e')][_0x417c('0x2d')]);}return _0x4311ad[_0x417c('0x10f')](_0x4515d1);}})[_0x417c('0x1f')](function(_0x34a9b9){if(_0x34a9b9){return _0x34a9b9?{'count':_0x119b85,'rows':_0x34a9b9}:null;}})[_0x417c('0x1f')](respondWithResult(_0x516e7f,null))[_0x417c('0x2a')](handleError(_0x516e7f,null));};exports[_0x417c('0x110')]=function(_0x1b7633,_0xacf6e3){return db[_0x417c('0x45')][_0x417c('0x68')]({'where':{'id':_0x1b7633['params']['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0xacf6e3,null))[_0x417c('0x1f')](function(_0x3d38a7){if(_0x3d38a7){var _0x159c1f=_0x3d38a7['get']({'plain':!![]});return _0x3d38a7[_0x417c('0x110')](_0x1b7633['body'][_0x417c('0x6c')],_[_0x417c('0x111')](_0x1b7633[_0x417c('0x67')],[_0x417c('0x6c'),'id'])||{})[_0x417c('0x1f')](function(){for(var _0x4e2d6c=0x0;_0x4e2d6c<_0x1b7633[_0x417c('0x67')][_0x417c('0x6c')][_0x417c('0x54')];_0x4e2d6c++){var _0x33c1ac=[];db[_0x417c('0x112')][_0x417c('0xa2')]({'where':{'id':_0x1b7633[_0x417c('0x67')][_0x417c('0x6c')][_0x4e2d6c]}})['then'](function(_0x295b2a){_0x33c1ac[_0x417c('0x90')](_0x295b2a[_0x417c('0xef')]()[_0x417c('0x1f')](function(_0x4678b4){for(var _0x239972=0x0;_0x239972<_0x4678b4[_0x417c('0x54')];_0x239972++){_0x4678b4[_0x239972]['setDataValue']('channel','Voice');}return _0x4678b4;}));_0x33c1ac[_0x417c('0x90')](_0x295b2a[_0x417c('0x113')]()[_0x417c('0x1f')](function(_0x5a92dc){for(var _0x54f9fb=0x0;_0x54f9fb<_0x5a92dc[_0x417c('0x54')];_0x54f9fb++){_0x5a92dc[_0x54f9fb][_0x417c('0x114')](_0x417c('0xa9'),'Chat');}return _0x5a92dc;}));_0x33c1ac[_0x417c('0x90')](_0x295b2a[_0x417c('0x115')]()[_0x417c('0x1f')](function(_0x4b9c8d){for(var _0x380156=0x0;_0x380156<_0x4b9c8d[_0x417c('0x54')];_0x380156++){_0x4b9c8d[_0x380156]['setDataValue'](_0x417c('0xa9'),_0x417c('0x116'));}return _0x4b9c8d;}));_0x33c1ac['push'](_0x295b2a[_0x417c('0x117')]()['then'](function(_0x121dd2){for(var _0x32eb80=0x0;_0x32eb80<_0x121dd2[_0x417c('0x54')];_0x32eb80++){_0x121dd2[_0x32eb80]['setDataValue'](_0x417c('0xa9'),_0x417c('0x118'));}return _0x121dd2;}));_0x33c1ac[_0x417c('0x90')](_0x295b2a[_0x417c('0x119')]()[_0x417c('0x1f')](function(_0x4f91d1){for(var _0x3771d9=0x0;_0x3771d9<_0x4f91d1[_0x417c('0x54')];_0x3771d9++){_0x4f91d1[_0x3771d9][_0x417c('0x114')](_0x417c('0xa9'),'Whatsapp');}return _0x4f91d1;}));_0x33c1ac[_0x417c('0x90')](_0x295b2a['getFaxQueues']()[_0x417c('0x1f')](function(_0x1a76ef){for(var _0x573217=0x0;_0x573217<_0x1a76ef[_0x417c('0x54')];_0x573217++){_0x1a76ef[_0x573217][_0x417c('0x114')](_0x417c('0xa9'),_0x417c('0x11a'));}return _0x1a76ef;}));_0x33c1ac['push'](_0x295b2a[_0x417c('0x11b')]()[_0x417c('0x1f')](function(_0x436f98){for(var _0x4c0311=0x0;_0x4c0311<_0x436f98[_0x417c('0x54')];_0x4c0311++){_0x436f98[_0x4c0311]['setDataValue']('channel',_0x417c('0x11c'));}return _0x436f98;}));return BPromise[_0x417c('0x91')](_0x33c1ac);})['then'](function(_0x29deca){var _0x54d44d=_[_0x417c('0x11d')](_0x29deca);_0x33c1ac=[];return db['sequelize'][_0x417c('0x11e')](function(_0x42832a){for(var _0x4e2965=0x0;_0x4e2965<_0x54d44d[_0x417c('0x54')];_0x4e2965++){_0x33c1ac['push'](_0x54d44d[_0x4e2965]['addAgent'](_0x159c1f['id']),{'transaction':_0x42832a});}return BPromise[_0x417c('0x91')](_0x33c1ac)[_0x417c('0x1f')](function(){if(_0x159c1f[_0x417c('0xaa')]){return BPromise[_0x417c('0x92')](_[_0x417c('0x5a')](_0x54d44d,function(_0x260861){return _0x260861[_0x417c('0x11f')]('channel')===_0x417c('0x120');}),function(_0x15f27a){return db['UserVoiceQueueRt'][_0x417c('0xf2')]({'membername':_0x159c1f[_0x417c('0x42')],'UserId':_0x159c1f['id'],'queue_name':_0x15f27a['name'],'VoiceQueueId':_0x15f27a['id'],'interface':_[_0x417c('0x70')](_0x159c1f[_0x417c('0xab')])?util['format'](_0x417c('0xb9'),_0x159c1f['name']):_0x159c1f[_0x417c('0xab')],'paused':_0x159c1f[_0x417c('0xba')]||![],'penalty':_0x159c1f[_0x417c('0xb1')]},{'transaction':_0x42832a});});}else{return;}})[_0x417c('0x1f')](function(){for(var _0x39c49d=0x0;_0x39c49d<_0x54d44d[_0x417c('0x54')];_0x39c49d++){var _0x324842=_0x54d44d[_0x39c49d][_0x417c('0x11f')](_0x417c('0xa9'));var _0x1ca91b=_0x324842+_0x417c('0xb3');socket[_0x417c('0xb4')](_0x417c('0x37')+_0x324842+_0x417c('0xb5'),{'UserId':_0x159c1f['id'],['queueField']:_0x54d44d[_0x39c49d]['id']});}});});});}});}})[_0x417c('0x1f')](respondWithStatusCode(_0xacf6e3,null))['catch'](handleError(_0xacf6e3,null));};exports[_0x417c('0x121')]=function(_0x376655,_0x2bb26a){return db['User'][_0x417c('0xa2')]({'where':{'id':_0x376655[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x2bb26a,null))[_0x417c('0x1f')](function(_0x680310){if(_0x680310){var _0x1f1484=_0x680310[_0x417c('0x33')]({'plain':!![]});var _0xefe3d4=_0x376655[_0x417c('0x4e')][_0x417c('0x6c')];return _0x680310['removeTeams'](_0xefe3d4)[_0x417c('0x1f')](function(){for(var _0xd8b71e=0x0;_0xd8b71e<_0xefe3d4['length'];_0xd8b71e++){var _0x529003=[];db[_0x417c('0x112')][_0x417c('0xa2')]({'where':{'id':_0xefe3d4[_0xd8b71e]}})['then'](function(_0x595c5a){_0x529003['push'](_0x595c5a[_0x417c('0xef')]()[_0x417c('0x1f')](function(_0x9b3382){for(var _0x29a3c1=0x0;_0x29a3c1<_0x9b3382['length'];_0x29a3c1++){_0x9b3382[_0x29a3c1][_0x417c('0x114')](_0x417c('0xa9'),_0x417c('0x120'));}return _0x9b3382;}));_0x529003[_0x417c('0x90')](_0x595c5a[_0x417c('0x113')]()[_0x417c('0x1f')](function(_0x1cdace){for(var _0x368b3a=0x0;_0x368b3a<_0x1cdace[_0x417c('0x54')];_0x368b3a++){_0x1cdace[_0x368b3a]['setDataValue'](_0x417c('0xa9'),_0x417c('0x122'));}return _0x1cdace;}));_0x529003['push'](_0x595c5a['getMailQueues']()[_0x417c('0x1f')](function(_0x59c6a1){for(var _0x3a04b3=0x0;_0x3a04b3<_0x59c6a1['length'];_0x3a04b3++){_0x59c6a1[_0x3a04b3][_0x417c('0x114')](_0x417c('0xa9'),_0x417c('0x116'));}return _0x59c6a1;}));_0x529003[_0x417c('0x90')](_0x595c5a[_0x417c('0x117')]()[_0x417c('0x1f')](function(_0x38e7ca){for(var _0xa33e22=0x0;_0xa33e22<_0x38e7ca['length'];_0xa33e22++){_0x38e7ca[_0xa33e22]['setDataValue'](_0x417c('0xa9'),_0x417c('0x118'));}return _0x38e7ca;}));_0x529003['push'](_0x595c5a[_0x417c('0x119')]()[_0x417c('0x1f')](function(_0x57b983){for(var _0x2668a9=0x0;_0x2668a9<_0x57b983['length'];_0x2668a9++){_0x57b983[_0x2668a9]['setDataValue'](_0x417c('0xa9'),_0x417c('0x123'));}return _0x57b983;}));_0x529003[_0x417c('0x90')](_0x595c5a[_0x417c('0x124')]()[_0x417c('0x1f')](function(_0x3b7bd5){for(var _0xc83ba4=0x0;_0xc83ba4<_0x3b7bd5[_0x417c('0x54')];_0xc83ba4++){_0x3b7bd5[_0xc83ba4][_0x417c('0x114')]('channel',_0x417c('0x11a'));}return _0x3b7bd5;}));_0x529003[_0x417c('0x90')](_0x595c5a['getOpenchannelQueues']()[_0x417c('0x1f')](function(_0x119836){for(var _0x4053f3=0x0;_0x4053f3<_0x119836[_0x417c('0x54')];_0x4053f3++){_0x119836[_0x4053f3][_0x417c('0x114')]('channel',_0x417c('0x11c'));}return _0x119836;}));return BPromise[_0x417c('0x91')](_0x529003);})[_0x417c('0x1f')](function(_0xfce3da){var _0x3b4f48=_['flatten'](_0xfce3da);_0x529003=[];return db['sequelize'][_0x417c('0x11e')](function(_0x21387b){for(var _0xe7305f=0x0;_0xe7305f<_0x3b4f48['length'];_0xe7305f++){_0x529003['push'](_0x3b4f48[_0xe7305f][_0x417c('0x125')](_0x1f1484['id']),{'transaction':_0x21387b});}return BPromise['all'](_0x529003)[_0x417c('0x1f')](function(){if(_0x1f1484[_0x417c('0xaa')]){return BPromise[_0x417c('0x92')](_['filter'](_0x3b4f48,function(_0x105009){return _0x105009['getDataValue'](_0x417c('0xa9'))==='Voice';}),function(_0x50e463){return db[_0x417c('0xbb')][_0x417c('0x3f')]({'where':{'VoiceQueueId':_0x50e463['id'],'UserId':_0x1f1484['id']},'transaction':_0x21387b});});}else{return;}})['then'](function(){for(var _0x6d7c72=0x0;_0x6d7c72<_0x3b4f48[_0x417c('0x54')];_0x6d7c72++){var _0x3fab68=_0x3b4f48[_0x6d7c72]['getDataValue'](_0x417c('0xa9'));var _0x475c0f=_0x3fab68+_0x417c('0xb3');socket[_0x417c('0xb4')](_0x417c('0x37')+_0x3fab68+_0x417c('0xbf'),{'UserId':_0x1f1484['id'],['queueField']:_0x3b4f48[_0x6d7c72]['id']});}});});});}});}})[_0x417c('0x1f')](respondWithStatusCode(_0x2bb26a,null))[_0x417c('0x2a')](handleError(_0x2bb26a,null));};exports[_0x417c('0x126')]=function(_0x35bf4a,_0x5d1c36,_0x5a50ec){var _0x57feda={};var _0x2a4de8={};var _0x329b84;var _0xee6df8;return db[_0x417c('0x45')][_0x417c('0xa2')]({'where':{'id':_0x35bf4a[_0x417c('0x69')]['id']}})['then'](handleEntityNotFound(_0x5d1c36,null))[_0x417c('0x1f')](function(_0x5cde8a){if(_0x5cde8a){_0x329b84=_0x5cde8a;_0x2a4de8['model']=_[_0x417c('0x4f')](db[_0x417c('0xcc')][_0x417c('0x46')]);_0x2a4de8[_0x417c('0x4e')]=_[_0x417c('0x4f')](_0x35bf4a['query']);_0x2a4de8[_0x417c('0x50')]=_[_0x417c('0x51')](_0x2a4de8[_0x417c('0x4a')],_0x2a4de8['query']);_0x57feda['attributes']=_['intersection'](_0x2a4de8[_0x417c('0x4a')],qs[_0x417c('0x52')](_0x35bf4a[_0x417c('0x4e')][_0x417c('0x52')]));_0x57feda[_0x417c('0x53')]=_0x57feda[_0x417c('0x53')][_0x417c('0x54')]?_0x57feda[_0x417c('0x53')]:_0x2a4de8[_0x417c('0x4a')];_0x57feda[_0x417c('0xca')]=qs[_0x417c('0x57')](_0x35bf4a[_0x417c('0x4e')]['sort']);_0x57feda[_0x417c('0x58')]=qs['filters'](_[_0x417c('0x59')](_0x35bf4a[_0x417c('0x4e')],_0x2a4de8[_0x417c('0x50')]));if(_0x35bf4a[_0x417c('0x4e')][_0x417c('0x5a')]){_0x57feda['where']=_[_0x417c('0x5b')](_0x57feda[_0x417c('0x58')],{'$or':_[_0x417c('0x3c')](_0x57feda[_0x417c('0x53')],function(_0xe20831){var _0x5e70c0={};_0x5e70c0[_0xe20831]={'$like':'%'+_0x35bf4a[_0x417c('0x4e')][_0x417c('0x5a')]+'%'};return _0x5e70c0;})});}_0x57feda=_[_0x417c('0x5b')]({},_0x57feda,_0x35bf4a[_0x417c('0x60')]);return _0x329b84[_0x417c('0x126')](_0x57feda);}})['then'](function(_0x2d8dd6){if(_0x2d8dd6){_0xee6df8=_0x2d8dd6[_0x417c('0x54')];if(!_0x35bf4a[_0x417c('0x4e')][_0x417c('0x55')](_0x417c('0x56'))){_0x57feda[_0x417c('0x2e')]=qs[_0x417c('0x2e')](_0x35bf4a[_0x417c('0x4e')][_0x417c('0x2e')]);_0x57feda['offset']=qs[_0x417c('0x2d')](_0x35bf4a[_0x417c('0x4e')][_0x417c('0x2d')]);}return _0x329b84[_0x417c('0x126')](_0x57feda);}})[_0x417c('0x1f')](function(_0x483aa1){if(_0x483aa1){return _0x483aa1?{'count':_0xee6df8,'rows':_0x483aa1}:null;}})[_0x417c('0x1f')](respondWithResult(_0x5d1c36,null))[_0x417c('0x2a')](handleError(_0x5d1c36,null));};exports[_0x417c('0x127')]=function(_0x18b095,_0x454a41,_0x86444a){var _0x5f3f87={};var _0x40a99a={};var _0x595a74;var _0x2e218a;return db[_0x417c('0x45')][_0x417c('0xa2')]({'where':{'id':_0x18b095[_0x417c('0x69')]['id']}})[_0x417c('0x1f')](handleEntityNotFound(_0x454a41,null))[_0x417c('0x1f')](function(_0x5d1761){if(_0x5d1761){_0x595a74=_0x5d1761;_0x40a99a['model']=_[_0x417c('0x4f')](db[_0x417c('0x45')][_0x417c('0x46')]);_0x40a99a[_0x417c('0x4e')]=_[_0x417c('0x4f')](_0x18b095[_0x417c('0x4e')]);_0x40a99a[_0x417c('0x50')]=_[_0x417c('0x51')](_0x40a99a[_0x417c('0x4a')],_0x40a99a['query']);_0x5f3f87[_0x417c('0x53')]=_[_0x417c('0x51')](_0x40a99a[_0x417c('0x4a')],qs[_0x417c('0x52')](_0x18b095['query'][_0x417c('0x52')]));_0x5f3f87[_0x417c('0x53')]=_0x5f3f87[_0x417c('0x53')][_0x417c('0x54')]?_0x5f3f87[_0x417c('0x53')]:_0x40a99a[_0x417c('0x4a')];_0x5f3f87[_0x417c('0xca')]=qs['sort'](_0x18b095[_0x417c('0x4e')][_0x417c('0x57')]);_0x5f3f87[_0x417c('0x58')]=qs[_0x417c('0x50')](_[_0x417c('0x59')](_0x18b095['query'],_0x40a99a[_0x417c('0x50')]));if(_0x18b095[_0x417c('0x4e')][_0x417c('0x5a')]){_0x5f3f87['where']=_[_0x417c('0x5b')](_0x5f3f87[_0x417c('0x58')],{'$or':_[_0x417c('0x3c')](_0x5f3f87[_0x417c('0x53')],function(_0x4f5222){var _0x314313={};_0x314313[_0x4f5222]={'$like':'%'+_0x18b095['query'][_0x417c('0x5a')]+'%'};return _0x314313;})});}_0x5f3f87[_0x417c('0x4a')]=db[_0x417c('0x45')];_0x5f3f87['as']=_0x417c('0x38');_0x5f3f87=_['merge']({},_0x5f3f87,_0x18b095[_0x417c('0x60')]);return _0x595a74[_0x417c('0xef')]({'include':[_0x5f3f87]});}})[_0x417c('0x1f')](function(_0x36d5fd){if(_0x36d5fd){var _0x35e8c1={},_0x5f8a42=[],_0x11da3d=0x0;for(var _0x1be062=0x0;_0x1be062<_0x36d5fd['length'];_0x1be062+=0x1){for(var _0x2d028c=0x0,_0x3b3acd;_0x2d028c<_0x36d5fd[_0x1be062][_0x417c('0x38')]['length'];_0x2d028c+=0x1){_0x3b3acd=_0x36d5fd[_0x1be062][_0x417c('0x38')][_0x2d028c][_0x417c('0x33')]({'plain':!![]});_0x35e8c1[_0x3b3acd['id']]=_0x3b3acd;}}_0x35e8c1=_[_0x417c('0x128')](_0x35e8c1);for(var _0x55f0ae=qs['offset'](_0x18b095['query'][_0x417c('0x2d')]);_0x55f0ae<_0x35e8c1['length']&&_0x5f8a42[_0x417c('0x54')]=_0x2aa656){_0x213130=_0x2aa656;_0x28fc60=0xc8;}else{_0x28fc60=0xce;}_0x27148d['status'](_0x28fc60);return _0x27148d[_0x9b8a('0x31')](_0x9b8a('0x32'),_0x31e770+'-'+_0x213130+'/'+_0x2aa656)[_0x9b8a('0x2e')](_0x640d1b);}return null;};}function patchUpdates(_0x8e9afc){return function(_0x3d32a1){try{jsonpatch[_0x9b8a('0x33')](_0x3d32a1,_0x8e9afc,!![]);}catch(_0xecfa5f){return BPromise[_0x9b8a('0x34')](_0xecfa5f);}return _0x3d32a1[_0x9b8a('0x35')]();};}function saveUpdates(_0x33950f,_0x1c4160){return function(_0x4ad683){if(_0x4ad683){return _0x4ad683[_0x9b8a('0x36')](_0x33950f)[_0x9b8a('0x37')](function(_0x16ab42){return _0x16ab42;});}return null;};}function removeEntity(_0x27b497,_0x5998bc){return function(_0x17d3fb){if(_0x17d3fb){return _0x17d3fb['destroy']()[_0x9b8a('0x37')](function(){var _0x155700=_0x17d3fb[_0x9b8a('0x38')]({'plain':!![]});if(_0x155700[_0x9b8a('0x39')]===_0x9b8a('0x3a'))return;var _0xa32f4b=[{'name':_0x9b8a('0x3b'),'value':_0x9b8a('0x3c'),'ignore':!![]},{'name':_0x9b8a('0x3d'),'value':_0x9b8a('0x3e'),'ignore':![]},{'name':_0x9b8a('0x3f'),'value':_0x9b8a('0x40'),'ignore':![]}];var _0x470a2a=_(_0xa32f4b)[_0x9b8a('0x41')](_0x9b8a('0x42'))['map'](_0x9b8a('0x43'))[_0x9b8a('0x43')]();if(_[_0x9b8a('0x44')](_0x470a2a,_0x155700['role'])){return;}var _0x1922fd=_[_0x9b8a('0x45')](_0xa32f4b,['value',_0x155700['role']])[_0x9b8a('0x46')];return db['UserProfileResource'][_0x9b8a('0x47')]({'where':{'type':_0x1922fd,'resourceId':_0x155700['id']}})['then'](function(){return _0x17d3fb;});})['then'](function(){_0x27b497[_0x9b8a('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x526352,_0x2b84d7){return function(_0x35033f){if(!_0x35033f){_0x526352['sendStatus'](0x194);}return _0x35033f;};}function handleError(_0xac8295,_0x307475){_0x307475=_0x307475||0x1f4;return function(_0x3963ca){logger[_0x9b8a('0x28')](_0x3963ca[_0x9b8a('0x48')]);if(_0x3963ca[_0x9b8a('0x46')]){delete _0x3963ca['name'];}_0xac8295[_0x9b8a('0x2c')](_0x307475)[_0x9b8a('0x49')](_0x3963ca);};}exports['index']=function(_0x4f5895,_0x3498db){var _0x7ea593={},_0x491a00={},_0x41f2a4={'count':0x0,'rows':[]};var _0x105305=_[_0x9b8a('0x4a')](db[_0x9b8a('0x4b')][_0x9b8a('0x4c')],function(_0x309890){return{'name':_0x309890['fieldName'],'type':_0x309890['type'][_0x9b8a('0x4d')]};});_0x491a00[_0x9b8a('0x4e')]=_[_0x9b8a('0x4f')](_[_0x9b8a('0x4a')](_0x105305,_0x9b8a('0x46')),[_0x9b8a('0x50'),_0x9b8a('0x51')]);_0x491a00[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x4f5895[_0x9b8a('0x52')]);_0x491a00[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x491a00[_0x9b8a('0x4e')],_0x491a00[_0x9b8a('0x52')]);_0x7ea593[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x491a00[_0x9b8a('0x4e')],qs[_0x9b8a('0x57')](_0x4f5895[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x7ea593['attributes']=_0x7ea593['attributes'][_0x9b8a('0x58')]?_0x7ea593['attributes']:_0x491a00[_0x9b8a('0x4e')];if(!_0x4f5895[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x7ea593[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x4f5895[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x7ea593['offset']=qs[_0x9b8a('0x2f')](_0x4f5895[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}_0x7ea593[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x4f5895[_0x9b8a('0x52')]['sort']);_0x7ea593[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x4f5895['query'],_0x491a00[_0x9b8a('0x54')]),_0x105305);if(_0x4f5895[_0x9b8a('0x52')]['filter']){_0x7ea593['where']=_[_0x9b8a('0x5f')](_0x7ea593[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x105305,function(_0x562ec6){if(_0x562ec6[_0x9b8a('0x60')]!==_0x9b8a('0x61')){return db[_0x9b8a('0x62')][_0x9b8a('0x5d')](db['sequelize']['fn'](_0x9b8a('0x63'),db[_0x9b8a('0x62')][_0x9b8a('0x64')](_0x562ec6[_0x9b8a('0x46')])),{'$like':db[_0x9b8a('0x62')]['fn'](_0x9b8a('0x63'),'%'+_0x4f5895[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%')});}})});}_0x7ea593=_[_0x9b8a('0x5f')]({},_0x7ea593,_0x4f5895['options']);var _0x513455={'where':_0x7ea593[_0x9b8a('0x5d')]};return db[_0x9b8a('0x4b')][_0x9b8a('0x65')](_0x513455)[_0x9b8a('0x37')](function(_0xe04338){_0x41f2a4[_0x9b8a('0x65')]=_0xe04338;if(_0x4f5895[_0x9b8a('0x52')]['includeAll']){_0x7ea593[_0x9b8a('0x66')]=[{'all':!![]}];}return db[_0x9b8a('0x4b')][_0x9b8a('0x67')](_0x7ea593);})[_0x9b8a('0x37')](function(_0x2e9ba3){_0x41f2a4[_0x9b8a('0x68')]=_0x2e9ba3;return _0x41f2a4;})[_0x9b8a('0x37')](respondWithFilteredResult(_0x3498db,_0x7ea593))['catch'](handleError(_0x3498db,null));};exports[_0x9b8a('0x69')]=function(_0x128e6d,_0x5e1402){var _0x440dc6={'raw':![],'where':{'id':_0x128e6d[_0x9b8a('0x6a')]['id']}},_0x3fae1d={};_0x3fae1d['model']=_['differenceBy'](_['keys'](db[_0x9b8a('0x4b')][_0x9b8a('0x4c')]),[_0x9b8a('0x50'),_0x9b8a('0x51')]);_0x3fae1d[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x128e6d['query']);_0x3fae1d[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x3fae1d[_0x9b8a('0x4e')],_0x3fae1d[_0x9b8a('0x52')]);_0x440dc6['attributes']=_[_0x9b8a('0x55')](_0x3fae1d[_0x9b8a('0x4e')],qs['fields'](_0x128e6d[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x440dc6[_0x9b8a('0x56')]=_0x440dc6[_0x9b8a('0x56')]['length']?_0x440dc6['attributes']:_0x3fae1d[_0x9b8a('0x4e')];if(_0x128e6d[_0x9b8a('0x52')][_0x9b8a('0x6b')]){_0x440dc6[_0x9b8a('0x66')]=[{'all':!![]}];}_0x440dc6=_['merge']({},_0x440dc6,_0x128e6d[_0x9b8a('0x6c')]);return db[_0x9b8a('0x4b')]['find'](_0x440dc6)[_0x9b8a('0x37')](handleEntityNotFound(_0x5e1402,null))[_0x9b8a('0x37')](respondWithResult(_0x5e1402,null))[_0x9b8a('0x2b')](handleError(_0x5e1402,null));};exports['update']=function(_0x538ac5,_0x1348fc){if(_0x538ac5['body']['id']){delete _0x538ac5[_0x9b8a('0x6d')]['id'];}delete _0x538ac5['body'][_0x9b8a('0x39')];return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x538ac5[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x1348fc,null))[_0x9b8a('0x37')](saveUpdates(_0x538ac5[_0x9b8a('0x6d')],null))[_0x9b8a('0x37')](respondWithResult(_0x1348fc,null))['catch'](handleError(_0x1348fc,null));};exports[_0x9b8a('0x6e')]=function(_0x44e78b,_0x38f41c){return db[_0x9b8a('0x4b')]['describe']()['then'](respondWithResult(_0x38f41c,null))[_0x9b8a('0x2b')](handleError(_0x38f41c,null));};exports[_0x9b8a('0x6f')]=function(_0x18c91e,_0x2a5acd,_0x2f5b3b){return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x18c91e[_0x9b8a('0x6a')]['id']}})['then'](handleEntityNotFound(_0x2a5acd,null))[_0x9b8a('0x37')](function(_0x1223ec){if(_0x1223ec){return _0x1223ec[_0x9b8a('0x6f')](_0x18c91e[_0x9b8a('0x6d')][_0x9b8a('0x70')],_[_0x9b8a('0x71')](_0x18c91e[_0x9b8a('0x6d')],['ids','id'])||{});}})['then'](respondWithResult(_0x2a5acd,null))[_0x9b8a('0x2b')](handleError(_0x2a5acd,null));};function validateUser(_0x46d346){return new BPromise(function(_0x563c70,_0x1802ad){if(_0x46d346[_0x9b8a('0x72')])return _0x563c70(_0x46d346);return db[_0x9b8a('0x73')][_0x9b8a('0x74')](0x1)[_0x9b8a('0x37')](function(_0x2059f1){if(_0x2059f1['securePassword'])authService[_0x9b8a('0x75')](_0x46d346['password']);db[_0x9b8a('0x4b')]['max'](_0x9b8a('0x72'))[_0x9b8a('0x37')](function(_0x119b64){if(_['isNil'](_0x119b64)){_0x46d346[_0x9b8a('0x72')]=_0x2059f1['min_internal']||0x1;return;}if(_['isNil'](_0x2059f1[_0x9b8a('0x76')])||_0x2059f1[_0x9b8a('0x76')]===_0x119b64){_0x46d346['internal']=_0x119b64+0x1;return;}if(_0x2059f1[_0x9b8a('0x76')]>_0x119b64){_0x46d346['internal']=_0x2059f1[_0x9b8a('0x76')];return;}return db[_0x9b8a('0x62')][_0x9b8a('0x52')](_0x9b8a('0x77'),{'type':db[_0x9b8a('0x62')][_0x9b8a('0x78')]['SELECT']})['then'](function(_0x23c4b5){if(_0x23c4b5&&_0x23c4b5[_0x9b8a('0x58')]){for(var _0x28965c=0x0,_0x51e87b=_0x23c4b5[_0x9b8a('0x58')];_0x28965c<_0x51e87b&&_[_0x9b8a('0x79')](_0x46d346[_0x9b8a('0x72')]);_0x28965c++){if(_0x2059f1[_0x9b8a('0x76')]<=_0x23c4b5[_0x28965c]['from']){_0x46d346[_0x9b8a('0x72')]=_0x23c4b5[_0x28965c][_0x9b8a('0x7a')];}else if(_0x2059f1[_0x9b8a('0x76')]>_0x23c4b5[_0x28965c][_0x9b8a('0x7a')]&&_0x2059f1[_0x9b8a('0x76')]<=_0x23c4b5[_0x28965c]['to']){_0x46d346['internal']=_0x2059f1[_0x9b8a('0x76')];}}}if(_[_0x9b8a('0x79')](_0x46d346[_0x9b8a('0x72')])){_0x46d346[_0x9b8a('0x72')]=_0x119b64+0x1;}return _0x563c70(_0x46d346);});});})[_0x9b8a('0x2b')](function(_0x96c9ab){_0x1802ad(_0x96c9ab);});});}function updateUser(_0x363df7){return new BPromise(function(_0x415f1d,_0x4076b3){try{if(_0x363df7['voicemail']){_0x363df7[_0x9b8a('0x7b')]=_0x363df7[_0x9b8a('0x72')];_0x363df7['VoiceMail']={'mailbox':_0x363df7[_0x9b8a('0x72')],'password':_0x363df7['password'],'fullname':_0x363df7[_0x9b8a('0x7c')],'email':_0x363df7[_0x9b8a('0x7d')]};}if(_0x363df7[_0x9b8a('0x39')]===_0x9b8a('0x3e')){if(!_0x363df7[_0x9b8a('0x7e')])_0x363df7['permissions']=['101',_0x9b8a('0x7f'),_0x9b8a('0x80'),_0x9b8a('0x81'),_0x9b8a('0x82'),_0x9b8a('0x83'),_0x9b8a('0x84'),_0x9b8a('0x85'),'107',_0x9b8a('0x86'),_0x9b8a('0x87'),'100',_0x9b8a('0x88'),_0x9b8a('0x89'),_0x9b8a('0x8a')];}_0x415f1d(_0x363df7);}catch(_0x846fb){_0x4076b3(_0x846fb);}});}exports[_0x9b8a('0x8b')]=function(_0x2e5027,_0xd0d79a){if(_0x2e5027[_0x9b8a('0x3c')][_0x9b8a('0x39')]===_0x9b8a('0x3e'))throw new Error(_0x9b8a('0x8c'));if(_0x2e5027[_0x9b8a('0x6d')][_0x9b8a('0x39')]===_0x9b8a('0x3c')&&_0x2e5027[_0x9b8a('0x3c')]['role']!==_0x9b8a('0x3a')){throw new Error(_0x9b8a('0x8d'));}if(_0x2e5027['body']['role']===_0x9b8a('0x3a')&&_0x2e5027[_0x9b8a('0x3c')][_0x9b8a('0x39')]!=='admin'){throw new Error(_0x9b8a('0x8e'));}return licenseUtil['checkUserLimits']([_0x2e5027[_0x9b8a('0x6d')]])['then'](function(){return validateUser(_0x2e5027['body']);})[_0x9b8a('0x37')](function(_0x197d92){return updateUser(_0x197d92)[_0x9b8a('0x37')](function(_0x326ecc){if(_0x326ecc[_0x9b8a('0x39')]===_0x9b8a('0x3a')){_0x326ecc['settingsEnabled']=_0x2e5027['user'][_0x9b8a('0x8f')];delete _0x326ecc[_0x9b8a('0x90')];}return _0x326ecc;});})[_0x9b8a('0x37')](function(_0x3db787){return db[_0x9b8a('0x4b')][_0x9b8a('0x8b')](_0x3db787,{'include':[{'model':db[_0x9b8a('0x91')],'as':_0x9b8a('0x91')}]});})[_0x9b8a('0x37')](function(_0xe5678e){if(_0x2e5027['body'][_0x9b8a('0x39')]===_0x9b8a('0x3c'))return _0xe5678e;if(_0x2e5027[_0x9b8a('0x3c')][_0x9b8a('0x39')]!==_0x9b8a('0x3c'))return _0xe5678e;return db[_0x9b8a('0x92')][_0x9b8a('0x45')]({'where':{'name':_0xe5678e[_0x9b8a('0x39')]===_0x9b8a('0x3e')?_0x9b8a('0x3d'):_0x9b8a('0x3f'),'userProfileId':_0x2e5027['user']['userProfileId']},'raw':!![]})['then'](function(_0x7adfc1){if(!_0x7adfc1||_0x7adfc1['autoAssociation']!=0x0)return _0xe5678e;return db[_0x9b8a('0x93')][_0x9b8a('0x8b')]({'name':_0xe5678e[_0x9b8a('0x46')],'resourceId':_0xe5678e['id'],'type':_0x7adfc1[_0x9b8a('0x46')],'sectionId':_0x7adfc1['id']},{})[_0x9b8a('0x37')](function(){return _0xe5678e;});})[_0x9b8a('0x2b')](function(_0x54951a){logger[_0x9b8a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54951a);throw _0x54951a;});})[_0x9b8a('0x37')](respondWithResult(_0xd0d79a,0xc9))['catch'](handleError(_0xd0d79a,null));};exports[_0x9b8a('0x94')]=function(_0x26a815,_0x30bff2){var _0x5dbb07=_0x26a815[_0x9b8a('0x6d')];var _0x35984e=[];if(_0x26a815[_0x9b8a('0x3c')][_0x9b8a('0x39')]===_0x9b8a('0x3e'))throw new Error(_0x9b8a('0x8c'));if(_[_0x9b8a('0x95')](_0x5dbb07,[_0x9b8a('0x39'),_0x9b8a('0x3c')])&&_0x26a815[_0x9b8a('0x3c')][_0x9b8a('0x39')]!=='admin'){throw new Error(_0x9b8a('0x8d'));}if(_[_0x9b8a('0x95')](_0x5dbb07,[_0x9b8a('0x39'),'admin'])&&_0x26a815[_0x9b8a('0x3c')][_0x9b8a('0x39')]!=='admin'){throw new Error(_0x9b8a('0x96'));}return licenseUtil[_0x9b8a('0x97')](_0x5dbb07)['then'](function(){return validateUser(_0x5dbb07[0x0]);})[_0x9b8a('0x37')](function(){for(var _0x918a7d=0x1;_0x918a7d<_0x5dbb07[_0x9b8a('0x58')];_0x918a7d++){var _0x3c2f0d=_0x5dbb07[_0x918a7d-0x1]['internal'];if(!_0x5dbb07[_0x918a7d]['internal'])_0x5dbb07[_0x918a7d][_0x9b8a('0x72')]=_0x3c2f0d+0x1;_0x35984e[_0x9b8a('0x98')](validateUser(_0x5dbb07[_0x918a7d]));}return BPromise[_0x9b8a('0x99')](_0x35984e);})[_0x9b8a('0x37')](function(){_0x35984e=[];for(var _0x415353=0x0;_0x415353<_0x5dbb07[_0x9b8a('0x58')];_0x415353++){_0x35984e['push'](updateUser(_0x5dbb07[_0x415353]));}return BPromise[_0x9b8a('0x99')](_0x35984e);})[_0x9b8a('0x37')](function(){return BPromise[_0x9b8a('0x9a')](_0x5dbb07,function(_0x3a64b1){return db['User'][_0x9b8a('0x8b')](_0x3a64b1,{'include':[{'model':db[_0x9b8a('0x91')],'as':_0x9b8a('0x91')}]})[_0x9b8a('0x37')](function(_0x377197){_0x3a64b1['id']=_0x377197['id'];return _0x3a64b1;});});})[_0x9b8a('0x37')](function(_0x301294){if(_0x26a815[_0x9b8a('0x6d')]['role']===_0x9b8a('0x3c'))return _0x301294;if(_0x26a815[_0x9b8a('0x3c')][_0x9b8a('0x39')]!==_0x9b8a('0x3c'))return _0x301294;var _0x100499=_[_0x9b8a('0x95')](_0x301294,function(_0xaed79e){return _0xaed79e['role']===_0x9b8a('0x3e')||_0xaed79e[_0x9b8a('0x39')]===_0x9b8a('0x40');});if(!_0x100499)return _0x301294;return db[_0x9b8a('0x92')][_0x9b8a('0x67')]({'where':{'name':{'$or':[_0x9b8a('0x3d'),_0x9b8a('0x3f')]},'userProfileId':_0x26a815['user'][_0x9b8a('0x90')]},'raw':!![]})[_0x9b8a('0x37')](function(_0x4b0703){if(_[_0x9b8a('0x9b')](_0x4b0703)||!_['some'](_0x4b0703,[_0x9b8a('0x9c'),0x0]))return _0x301294;_0x35984e=[];var _0x1eab0d=_(_0x4b0703)[_0x9b8a('0x4a')](function(_0x178d16){if(_0x178d16['autoAssociation']===0x1)return;return _0x178d16[_0x9b8a('0x46')]==='Agents'?_0x9b8a('0x3e'):_0x9b8a('0x40');})[_0x9b8a('0x9d')]()['value']();for(var _0x5775f6=0x0;_0x5775f6<_0x301294[_0x9b8a('0x58')];_0x5775f6++){if(!_[_0x9b8a('0x44')](_0x1eab0d,_0x301294[_0x5775f6][_0x9b8a('0x39')]))return;var _0x5578b5=_0x301294[_0x5775f6][_0x9b8a('0x39')]===_0x9b8a('0x3e')?'Agents':_0x9b8a('0x3f');_0x35984e['push'](db['UserProfileResource'][_0x9b8a('0x8b')]({'name':_0x301294[_0x5775f6][_0x9b8a('0x46')],'resourceId':_0x301294[_0x5775f6]['id'],'type':_0x5578b5,'sectionId':_['find'](_0x4b0703,['name',_0x5578b5])['id']},{}));}return BPromise['all'](_0x35984e);});})[_0x9b8a('0x37')](respondWithResult(_0x30bff2,0xc9))[_0x9b8a('0x2b')](handleError(_0x30bff2,null));};exports[_0x9b8a('0x9e')]=function(_0x1068a1,_0xdb24a6,_0x3620d7){if(_0x1068a1[_0x9b8a('0x6d')]['id']){delete _0x1068a1[_0x9b8a('0x6d')]['id'];}return db['User'][_0x9b8a('0x45')]({'where':{'id':_0x1068a1['params']['id']}})['then'](function(_0x21485d){if(!_0x21485d)return null;if(_0x21485d['id']===_0x1068a1[_0x9b8a('0x3c')]['id']){if(!_0x1068a1[_0x9b8a('0x6d')][_0x9b8a('0x9f')]||!_0x1068a1[_0x9b8a('0x6d')][_0x9b8a('0xa0')]){throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))](_0x9b8a('0xa3'));}if(!_0x21485d[_0x9b8a('0xa4')](_0x1068a1[_0x9b8a('0x6d')][_0x9b8a('0x9f')])){throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))](_0x9b8a('0xa5'));}if(_0x1068a1['body'][_0x9b8a('0x9f')]===_0x1068a1['body'][_0x9b8a('0xa0')]){throw new db[(_0x9b8a('0xa1'))]['ValidationError'](_0x9b8a('0xa6'));}}else if(_0x1068a1['user'][_0x9b8a('0x39')]===_0x9b8a('0x3a')){if(!_0x1068a1[_0x9b8a('0x6d')][_0x9b8a('0xa0')]){throw new db[(_0x9b8a('0xa1'))]['ValidationError'](_0x9b8a('0xa7'));}}else if(_0x1068a1[_0x9b8a('0x3c')][_0x9b8a('0x39')]==='user'){if(!_0x1068a1['body'][_0x9b8a('0xa0')]){throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x21485d[_0x9b8a('0x39')]!=='agent'){throw new db['Sequelize']['ValidationError'](_0x9b8a('0x8c'));}}else{throw new db[(_0x9b8a('0xa1'))]['ValidationError']('Unauthorized');}return _0x21485d;})[_0x9b8a('0x37')](handleEntityNotFound(_0xdb24a6,null))[_0x9b8a('0x37')](function(_0x2eacab){return db[_0x9b8a('0x73')][_0x9b8a('0xa8')]({'attributes':['id',_0x9b8a('0xa9'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x9b8a('0x37')](function(_0x1fc6b1){if(_0x1fc6b1['securePassword'])authService[_0x9b8a('0x75')](_0x1068a1[_0x9b8a('0x6d')]['newPassword']);if(!_0x1fc6b1['enforcePasswordHistory']||!_0x2eacab['previousPasswords'])return _0x2eacab;authService['validatePasswordHistory'](_0x1068a1[_0x9b8a('0x6d')][_0x9b8a('0xa0')],_0x2eacab[_0x9b8a('0xaa')],_0x1fc6b1[_0x9b8a('0xab')]);return _0x2eacab;})['then'](saveUpdates({'password':_0x1068a1[_0x9b8a('0x6d')]['newPassword'],'passwordResetAt':_0x1068a1[_0x9b8a('0x3c')]['id']==_0x1068a1['params']['id']?moment():null,'previousPasswords':authService[_0x9b8a('0xac')](_0x1068a1['body'][_0x9b8a('0xa0')],_0x2eacab[_0x9b8a('0xaa')])},null));})[_0x9b8a('0x37')](respondWithResult(_0xdb24a6,null))['catch'](handleError(_0xdb24a6,null));};exports[_0x9b8a('0xad')]=function(_0x1ff8fd,_0x2f0df1,_0x1a61e7){var _0x1c4905=_0x1ff8fd['body'][_0x9b8a('0xae')];return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x1ff8fd[_0x9b8a('0x6a')]['id']},'attributes':['id',_0x9b8a('0x46'),_0x9b8a('0x39'),_0x9b8a('0xaf'),_0x9b8a('0xb0'),_0x9b8a('0xb1'),'interface']})[_0x9b8a('0x37')](handleEntityNotFound(_0x2f0df1,null))[_0x9b8a('0x37')](function(_0x44b45b){if(_0x44b45b){if(!utils[_0x9b8a('0xb2')](_0x1c4905)){throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))](_0x9b8a('0xb3'));}return _0x44b45b[_0x9b8a('0xb4')+_[_0x9b8a('0xb5')](_0x1c4905[_0x9b8a('0xb6')]())+_0x9b8a('0xb7')](_0x1ff8fd[_0x9b8a('0x6d')][_0x9b8a('0x70')],{'penalty':_0x1ff8fd[_0x9b8a('0x6d')][_0x9b8a('0xb8')]||0x0})[_0x9b8a('0xb9')](function(_0x4610db){for(var _0xe2ff24=0x0;_0xe2ff24<_0x1ff8fd[_0x9b8a('0x6d')][_0x9b8a('0x70')][_0x9b8a('0x58')];_0xe2ff24+=0x1){var _0x193e2d={'UserId':_0x1ff8fd[_0x9b8a('0x6a')]['id']};_0x193e2d[_[_0x9b8a('0xb5')](_0x1c4905[_0x9b8a('0xb6')]())+'QueueId']=_0x1ff8fd[_0x9b8a('0x6d')][_0x9b8a('0x70')][_0xe2ff24];socket[_0x9b8a('0xba')](_0x9b8a('0x3c')+_[_0x9b8a('0xb5')](_0x1c4905[_0x9b8a('0xb6')]())+'Queue:save',_0x193e2d);}return _0x4610db;})[_0x9b8a('0x37')](function(){if(_0x1c4905===_0x9b8a('0xbb')){return db[_0x9b8a('0xbc')][_0x9b8a('0x67')]({'where':{'id':_0x1ff8fd[_0x9b8a('0x6d')][_0x9b8a('0x70')]||[]},'raw':!![],'attributes':['id',_0x9b8a('0x46')]});}})['then'](function(_0x1abf00){var _0x53962a=_0x44b45b[_0x9b8a('0x38')]({'plain':!![]});var _0x305511=[];if(_0x1c4905===_0x9b8a('0xbb')&&_0x53962a['role']===_0x9b8a('0x3e')&&_0x53962a[_0x9b8a('0xaf')]){for(var _0x47fb73=0x0;_0x47fb73<_0x1abf00[_0x9b8a('0x58')];_0x47fb73+=0x1){_0x305511[_0x9b8a('0x98')]({'membername':_0x53962a['name'],'UserId':_0x53962a['id'],'queue_name':_0x1abf00[_0x47fb73][_0x9b8a('0x46')],'VoiceQueueId':_0x1abf00[_0x47fb73]['id'],'interface':_[_0x9b8a('0x79')](_0x53962a[_0x9b8a('0xbd')])?util[_0x9b8a('0xbe')]('SIP/%s',_0x53962a[_0x9b8a('0x46')]):_0x53962a[_0x9b8a('0xbd')],'paused':_0x53962a[_0x9b8a('0xb1')]||![],'penalty':_0x1ff8fd['body']['penalty']||0x0});}return BPromise[_0x9b8a('0x9a')](_0x305511,function(_0xfbe58){return db['UserVoiceQueueRt'][_0x9b8a('0xbf')](_0xfbe58);});}return _0x44b45b;});}})[_0x9b8a('0x37')](respondWithStatusCode(_0x2f0df1,null))['catch'](handleError(_0x2f0df1,null));};exports[_0x9b8a('0xc0')]=function(_0x12e196,_0x430bf5,_0x5c4797){var _0xee6594;return db[_0x9b8a('0x4b')]['find']({'where':{'id':_0x12e196['params']['id']},'attributes':['id','name',_0x9b8a('0x39')]})[_0x9b8a('0x37')](handleEntityNotFound(_0x430bf5,null))[_0x9b8a('0x37')](function(_0x2e84d8){if(_0x2e84d8){_0xee6594=_0x2e84d8;if(!_0x12e196[_0x9b8a('0x52')]['channel']||!utils[_0x9b8a('0xb2')](_0x12e196[_0x9b8a('0x52')][_0x9b8a('0xae')])){throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))](_0x9b8a('0xb3'));}return _0x2e84d8['remove'+_[_0x9b8a('0xb5')](_0x12e196[_0x9b8a('0x52')]['channel'][_0x9b8a('0xb6')]())+_0x9b8a('0xb7')](_0x12e196[_0x9b8a('0x52')][_0x9b8a('0x70')]);}})[_0x9b8a('0x37')](function(_0x44a340){for(var _0x167e5c=0x0;_0x167e5c<_0x12e196[_0x9b8a('0x52')][_0x9b8a('0x70')][_0x9b8a('0x58')];_0x167e5c+=0x1){var _0x5b4043={'UserId':_0x12e196['params']['id']};_0x5b4043[_['capitalize'](_0x12e196[_0x9b8a('0x52')][_0x9b8a('0xae')][_0x9b8a('0xb6')]())+'QueueId']=_0x12e196['query'][_0x9b8a('0x70')][_0x167e5c];socket[_0x9b8a('0xba')](_0x9b8a('0x3c')+_[_0x9b8a('0xb5')](_0x12e196[_0x9b8a('0x52')][_0x9b8a('0xae')][_0x9b8a('0xb6')]())+_0x9b8a('0xc1'),_0x5b4043);}return _0x44a340;})[_0x9b8a('0x37')](function(){if(_0x12e196['query'][_0x9b8a('0xae')]===_0x9b8a('0xbb')){return db[_0x9b8a('0xc2')][_0x9b8a('0x47')]({'where':{'UserId':_0x12e196[_0x9b8a('0x6a')]['id'],'VoiceQueueId':_0x12e196[_0x9b8a('0x52')][_0x9b8a('0x70')]},'individualHooks':!![]})['then'](function(){return _0xee6594;});}return _0xee6594;})[_0x9b8a('0x37')](respondWithStatusCode(_0x430bf5,null))[_0x9b8a('0x2b')](handleError(_0x430bf5,null));};exports[_0x9b8a('0xc3')]=function(_0x108a50,_0x4e54f9,_0x177ebf){_0x108a50['body'][_0x9b8a('0xc4')]=_0x108a50['file'][_0x9b8a('0xc5')];return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x108a50[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x4e54f9,null))[_0x9b8a('0x37')](saveUpdates(_0x108a50['body'],null))['then'](respondWithResult(_0x4e54f9,null))[_0x9b8a('0x2b')](handleError(_0x4e54f9,null));};exports[_0x9b8a('0xc6')]=function(_0x3c6a1c,_0x2b5224,_0x39ee25){var _0x52740e=path[_0x9b8a('0xc7')](config['root'],_0x9b8a('0xc8'));return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x3c6a1c[_0x9b8a('0x6a')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x9b8a('0x37')](handleEntityNotFound(_0x2b5224,null))[_0x9b8a('0x37')](function(_0x5b9e48){if(_0x5b9e48){if(_['isNil'](_0x5b9e48[_0x9b8a('0xc4')])){return _0x2b5224[_0x9b8a('0xc9')](_0x52740e);}else{if(!fs[_0x9b8a('0xca')](path['join'](config[_0x9b8a('0xcb')],_0x9b8a('0xcc'),_0x5b9e48[_0x9b8a('0xc4')]))){return _0x2b5224[_0x9b8a('0xc9')](_0x52740e);}return _0x2b5224[_0x9b8a('0xc9')](path[_0x9b8a('0xc7')](config[_0x9b8a('0xcb')],'server/files/images/',_0x5b9e48[_0x9b8a('0xc4')]));}}})[_0x9b8a('0x2b')](handleError(_0x2b5224,null));};exports[_0x9b8a('0xcd')]=function(_0x1f143f,_0x57e4de,_0x4806e0){var _0x43416c={};var _0x40df53={};var _0x2194a9;var _0xeebe79;return db[_0x9b8a('0x4b')]['findOne']({'where':{'id':_0x1f143f[_0x9b8a('0x6a')]['id']}})['then'](handleEntityNotFound(_0x57e4de,null))[_0x9b8a('0x37')](function(_0x16d887){if(_0x16d887){_0x2194a9=_0x16d887;_0x40df53[_0x9b8a('0x4e')]=_['keys'](db[_0x9b8a('0xce')][_0x9b8a('0x4c')]);_0x40df53[_0x9b8a('0x52')]=_['keys'](_0x1f143f[_0x9b8a('0x52')]);_0x40df53[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x40df53['model'],_0x40df53['query']);_0x43416c[_0x9b8a('0x56')]=_['intersection'](_0x40df53['model'],qs[_0x9b8a('0x57')](_0x1f143f['query'][_0x9b8a('0x57')]));_0x43416c[_0x9b8a('0x56')]=_0x43416c[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0x43416c[_0x9b8a('0x56')]:_0x40df53[_0x9b8a('0x4e')];_0x43416c[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x1f143f[_0x9b8a('0x52')][_0x9b8a('0x5c')]);_0x43416c[_0x9b8a('0x5d')]=qs['filters'](_[_0x9b8a('0x5e')](_0x1f143f[_0x9b8a('0x52')],_0x40df53[_0x9b8a('0x54')]));if(_0x1f143f['query'][_0x9b8a('0x41')]){_0x43416c[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x43416c[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x43416c[_0x9b8a('0x56')],function(_0x3d40c3){var _0x5ed02e={};_0x5ed02e[_0x3d40c3]={'$like':'%'+_0x1f143f['query'][_0x9b8a('0x41')]+'%'};return _0x5ed02e;})});}_0x43416c=_[_0x9b8a('0x5f')]({},_0x43416c,_0x1f143f[_0x9b8a('0x6c')]);return _0x2194a9[_0x9b8a('0xcd')](_0x43416c);}})[_0x9b8a('0x37')](function(_0x110033){if(_0x110033){_0xeebe79=_0x110033[_0x9b8a('0x58')];if(_0x1f143f[_0x9b8a('0x52')][_0x9b8a('0x59')]('includeAll')){_0x43416c[_0x9b8a('0x66')]=[{'model':db[_0x9b8a('0xcf')],'as':'List','required':![]},{'model':db['Tag'],'as':_0x9b8a('0xd0'),'attributes':['id',_0x9b8a('0x46'),_0x9b8a('0xd1')],'where':_0x1f143f['query'][_0x9b8a('0xd2')]?{'id':_0x1f143f[_0x9b8a('0x52')][_0x9b8a('0xd2')]}:undefined,'required':_0x1f143f['query'][_0x9b8a('0xd2')]?!![]:![]}];}if(!_0x1f143f[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x43416c[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x1f143f[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x43416c[_0x9b8a('0x2f')]=qs['offset'](_0x1f143f[_0x9b8a('0x52')]['offset']);}return _0x2194a9[_0x9b8a('0xcd')](_0x43416c);}})[_0x9b8a('0x37')](function(_0x4b6c24){if(_0x4b6c24){return _0x4b6c24?{'count':_0xeebe79,'rows':_0x4b6c24}:null;}})['then'](respondWithResult(_0x57e4de,null))[_0x9b8a('0x2b')](handleError(_0x57e4de,null));};exports['getQueues']=function(_0x3e74ba,_0x54b87f,_0x4c8e23){var _0x1d0721;var _0x1fae86;var _0x8f579a={};var _0x3b03af;return db[_0x9b8a('0x4b')]['findOne']({'where':{'id':_0x3e74ba[_0x9b8a('0x6a')]['id']},'attributes':['id',_0x9b8a('0x46'),_0x9b8a('0x39')]})['then'](handleEntityNotFound(_0x54b87f,null))[_0x9b8a('0x37')](function(_0x34d454){if(!utils['isValidChannel'](_0x3e74ba[_0x9b8a('0x52')][_0x9b8a('0xae')])){throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))](_0x9b8a('0xb3'));}_0x1d0721=_0x34d454;var _0x491939={};_0x491939['model']=_[_0x9b8a('0x53')](db[_[_0x9b8a('0xb5')](_0x3e74ba['query'][_0x9b8a('0xae')])+'Queue'][_0x9b8a('0x4c')]);_0x491939[_0x9b8a('0x52')]=_['keys'](_0x3e74ba[_0x9b8a('0x52')]);_0x491939[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x491939[_0x9b8a('0x4e')],_0x491939[_0x9b8a('0x52')]);_0x8f579a[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x491939['model'],qs[_0x9b8a('0x57')](_0x3e74ba[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x8f579a[_0x9b8a('0x56')]=_0x8f579a[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0x8f579a[_0x9b8a('0x56')]:_0x491939['model'];_0x8f579a[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x3e74ba[_0x9b8a('0x52')]['sort']);_0x8f579a['where']=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x3e74ba['query'],_0x491939[_0x9b8a('0x54')]));if(_0x3e74ba['query'][_0x9b8a('0x41')]){_0x8f579a[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x8f579a[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x8f579a['attributes'],function(_0xb5531c){var _0x32b589={};_0x32b589[_0xb5531c]={'$like':'%'+_0x3e74ba['query'][_0x9b8a('0x41')]+'%'};return _0x32b589;})});}_0x8f579a=_[_0x9b8a('0x5f')]({},_0x8f579a,_0x3e74ba['options']);switch(_0x1d0721[_0x9b8a('0x39')]){case'admin':return db[_[_0x9b8a('0xb5')](_0x3e74ba[_0x9b8a('0x52')]['channel'])+'Queue'][_0x9b8a('0x67')](_0x8f579a);case _0x9b8a('0x3c'):case _0x9b8a('0x3e'):return _0x1d0721[_0x9b8a('0x38')+_['capitalize'](_0x3e74ba[_0x9b8a('0x52')][_0x9b8a('0xae')])+'Queues'](_0x8f579a);default:throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))](_0x9b8a('0xd3'));}})[_0x9b8a('0x37')](function(_0x8f4942){_0x3b03af=_0x8f4942[_0x9b8a('0x58')];if(!_0x3e74ba[_0x9b8a('0x52')]['hasOwnProperty'](_0x9b8a('0x5a'))){_0x8f579a[_0x9b8a('0x30')]=qs['limit'](_0x3e74ba['query']['limit']);_0x8f579a['offset']=qs['offset'](_0x3e74ba[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}switch(_0x1d0721[_0x9b8a('0x39')]){case _0x9b8a('0x3a'):return db[_[_0x9b8a('0xb5')](_0x3e74ba['query'][_0x9b8a('0xae')])+'Queue'][_0x9b8a('0x67')](_0x8f579a);case'user':case _0x9b8a('0x3e'):return _0x1d0721[_0x9b8a('0x38')+_[_0x9b8a('0xb5')](_0x3e74ba['query']['channel'])+_0x9b8a('0xb7')](_0x8f579a);}})[_0x9b8a('0x37')](function(_0x8244c){return{'count':_0x3b03af,'rows':_0x8244c};})['then'](respondWithResult(_0x54b87f,null))[_0x9b8a('0x2b')](handleError(_0x54b87f,null));};exports[_0x9b8a('0xd4')]=function(_0x1bbe3e,_0x1625e2,_0x5ec321){var _0x25b3ed={};var _0x41623e={};var _0x6e2e6;var _0x48b458;return db['User'][_0x9b8a('0xa8')]({'where':{'id':_0x1bbe3e[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x1625e2,null))[_0x9b8a('0x37')](function(_0x3a56c1){if(_0x3a56c1){_0x6e2e6=_0x3a56c1;_0x41623e[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xc2')][_0x9b8a('0x4c')]);_0x41623e[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x1bbe3e[_0x9b8a('0x52')]);_0x41623e[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x41623e[_0x9b8a('0x4e')],_0x41623e['query']);_0x25b3ed[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x41623e['model'],qs[_0x9b8a('0x57')](_0x1bbe3e[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x25b3ed['attributes']=_0x25b3ed['attributes'][_0x9b8a('0x58')]?_0x25b3ed[_0x9b8a('0x56')]:_0x41623e['model'];_0x25b3ed[_0x9b8a('0x5b')]=qs['sort'](_0x1bbe3e[_0x9b8a('0x52')]['sort']);_0x25b3ed[_0x9b8a('0x5d')]=qs['filters'](_['pick'](_0x1bbe3e[_0x9b8a('0x52')],_0x41623e[_0x9b8a('0x54')]));if(_0x1bbe3e['query'][_0x9b8a('0x41')]){_0x25b3ed['where']=_[_0x9b8a('0x5f')](_0x25b3ed[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x25b3ed['attributes'],function(_0x3afee1){var _0x41673f={};_0x41673f[_0x3afee1]={'$like':'%'+_0x1bbe3e[_0x9b8a('0x52')]['filter']+'%'};return _0x41673f;})});}_0x25b3ed=_[_0x9b8a('0x5f')]({},_0x25b3ed,_0x1bbe3e[_0x9b8a('0x6c')]);return _0x6e2e6['getVoiceQueuesRt'](_0x25b3ed);}})[_0x9b8a('0x37')](function(_0x4553fa){if(_0x4553fa){_0x48b458=_0x4553fa[_0x9b8a('0x58')];if(!_0x1bbe3e['query']['hasOwnProperty'](_0x9b8a('0x5a'))){_0x25b3ed[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x1bbe3e[_0x9b8a('0x52')]['limit']);_0x25b3ed[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x1bbe3e[_0x9b8a('0x52')]['offset']);}return _0x6e2e6[_0x9b8a('0xd4')](_0x25b3ed);}})[_0x9b8a('0x37')](function(_0x3f1523){if(_0x3f1523){return _0x3f1523?{'count':_0x48b458,'rows':_0x3f1523}:null;}})['then'](respondWithResult(_0x1625e2,null))[_0x9b8a('0x2b')](handleError(_0x1625e2,null));};exports['getGroups']=function(_0x58e5b9,_0x3433c4,_0x5288f4){var _0x195020={};var _0xe06d13={};var _0x6a2562;var _0xe16a72;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x58e5b9[_0x9b8a('0x6a')]['id']}})['then'](handleEntityNotFound(_0x3433c4,null))[_0x9b8a('0x37')](function(_0x5b5f5b){if(_0x5b5f5b){_0x6a2562=_0x5b5f5b;_0xe06d13[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xd5')][_0x9b8a('0x4c')]);_0xe06d13['query']=_[_0x9b8a('0x53')](_0x58e5b9[_0x9b8a('0x52')]);_0xe06d13[_0x9b8a('0x54')]=_['intersection'](_0xe06d13['model'],_0xe06d13[_0x9b8a('0x52')]);_0x195020[_0x9b8a('0x56')]=_['intersection'](_0xe06d13['model'],qs[_0x9b8a('0x57')](_0x58e5b9['query'][_0x9b8a('0x57')]));_0x195020[_0x9b8a('0x56')]=_0x195020['attributes'][_0x9b8a('0x58')]?_0x195020[_0x9b8a('0x56')]:_0xe06d13[_0x9b8a('0x4e')];_0x195020[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x58e5b9[_0x9b8a('0x52')][_0x9b8a('0x5c')]);_0x195020[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x58e5b9[_0x9b8a('0x52')],_0xe06d13[_0x9b8a('0x54')]));if(_0x58e5b9['query'][_0x9b8a('0x41')]){_0x195020[_0x9b8a('0x5d')]=_['merge'](_0x195020[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x195020[_0x9b8a('0x56')],function(_0x45c16d){var _0x3efd14={};_0x3efd14[_0x45c16d]={'$like':'%'+_0x58e5b9['query'][_0x9b8a('0x41')]+'%'};return _0x3efd14;})});}_0x195020=_[_0x9b8a('0x5f')]({},_0x195020,_0x58e5b9['options']);return _0x6a2562['getGroups'](_0x195020);}})[_0x9b8a('0x37')](function(_0x2f5b5a){if(_0x2f5b5a){_0xe16a72=_0x2f5b5a['length'];if(!_0x58e5b9[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x195020[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x58e5b9[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x195020[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x58e5b9[_0x9b8a('0x52')]['offset']);}return _0x6a2562['getGroups'](_0x195020);}})[_0x9b8a('0x37')](function(_0x397f19){if(_0x397f19){return _0x397f19?{'count':_0xe16a72,'rows':_0x397f19}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x3433c4,null))[_0x9b8a('0x2b')](handleError(_0x3433c4,null));};exports[_0x9b8a('0xd6')]=function(_0x4edde3,_0x578193,_0xcd4b99){var _0xf9e0fe={'raw':!![],'where':{}};var _0x26ca77={};var _0x498006={'count':0x0,'rows':[]};return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x4edde3['params']['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x578193,null))[_0x9b8a('0x37')](function(_0x579dc2){if(_0x579dc2){_0x26ca77[_0x9b8a('0x4e')]=_['keys'](db[_0x9b8a('0xd7')][_0x9b8a('0x4c')]);_0x26ca77[_0x9b8a('0x52')]=_['keys'](_0x4edde3['query']);_0x26ca77['filters']=_[_0x9b8a('0x55')](_0x26ca77[_0x9b8a('0x4e')],_0x26ca77['query']);_0xf9e0fe['attributes']=_[_0x9b8a('0x55')](_0x26ca77['model'],qs[_0x9b8a('0x57')](_0x4edde3[_0x9b8a('0x52')]['fields']));_0xf9e0fe[_0x9b8a('0x56')]=_0xf9e0fe[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0xf9e0fe[_0x9b8a('0x56')]:_0x26ca77[_0x9b8a('0x4e')];if(!_0x4edde3[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0xf9e0fe['limit']=qs[_0x9b8a('0x30')](_0x4edde3['query']['limit']);_0xf9e0fe[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x4edde3[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}_0xf9e0fe[_0x9b8a('0x5b')]=qs['sort'](_0x4edde3[_0x9b8a('0x52')]['sort']);_0xf9e0fe[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x4edde3['query'],_0x26ca77[_0x9b8a('0x54')]));_0xf9e0fe[_0x9b8a('0x5d')][_0x9b8a('0xd8')]=_0x579dc2['id'];if(_0x4edde3[_0x9b8a('0x52')][_0x9b8a('0x41')]){_0xf9e0fe[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0xf9e0fe[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0xf9e0fe[_0x9b8a('0x56')],function(_0x35d8a5){var _0x34b7fc={};_0x34b7fc[_0x35d8a5]={'$like':'%'+_0x4edde3['query'][_0x9b8a('0x41')]+'%'};return _0x34b7fc;})});}_0xf9e0fe=_[_0x9b8a('0x5f')]({},_0xf9e0fe,_0x4edde3[_0x9b8a('0x6c')]);return db[_0x9b8a('0xd7')]['count']({'where':_0xf9e0fe[_0x9b8a('0x5d')]})[_0x9b8a('0x37')](function(_0x5923f8){_0x498006[_0x9b8a('0x65')]=_0x5923f8;if(_0x4edde3['query'][_0x9b8a('0x6b')]){_0xf9e0fe[_0x9b8a('0x66')]=[{'all':!![]}];}return db[_0x9b8a('0xd7')][_0x9b8a('0x67')](_0xf9e0fe);})[_0x9b8a('0x37')](function(_0x306d93){_0x498006['rows']=_0x306d93;return _0x498006;});}})[_0x9b8a('0x37')](respondWithFilteredResult(_0x578193,_0xf9e0fe))[_0x9b8a('0x2b')](handleError(_0x578193,null));};exports['getScreenRecordings']=function(_0x3a8e49,_0x4764e5,_0x372c5b){var _0x4cb7fb={'raw':!![],'where':{}};var _0x2aabce={};var _0xc89353={'count':0x0,'rows':[]};return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x3a8e49['params']['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x4764e5,null))[_0x9b8a('0x37')](function(_0x4c4715){if(_0x4c4715){_0x2aabce[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xd9')]['rawAttributes']);_0x2aabce[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x3a8e49['query']);_0x2aabce[_0x9b8a('0x54')]=_['intersection'](_0x2aabce[_0x9b8a('0x4e')],_0x2aabce[_0x9b8a('0x52')]);_0x4cb7fb[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x2aabce['model'],qs[_0x9b8a('0x57')](_0x3a8e49[_0x9b8a('0x52')]['fields']));_0x4cb7fb[_0x9b8a('0x56')]=_0x4cb7fb['attributes'][_0x9b8a('0x58')]?_0x4cb7fb[_0x9b8a('0x56')]:_0x2aabce[_0x9b8a('0x4e')];if(!_0x3a8e49[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x4cb7fb[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x3a8e49[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x4cb7fb['offset']=qs['offset'](_0x3a8e49[_0x9b8a('0x52')]['offset']);}_0x4cb7fb[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x3a8e49['query'][_0x9b8a('0x5c')]);_0x4cb7fb[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x3a8e49[_0x9b8a('0x52')],_0x2aabce[_0x9b8a('0x54')]));_0x4cb7fb['where'][_0x9b8a('0xd8')]=_0x4c4715['id'];if(_0x3a8e49['query'][_0x9b8a('0x41')]){_0x4cb7fb[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x4cb7fb[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x4cb7fb['attributes'],function(_0x3f3693){var _0x33a20a={};_0x33a20a[_0x3f3693]={'$like':'%'+_0x3a8e49[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x33a20a;})});}_0x4cb7fb=_[_0x9b8a('0x5f')]({},_0x4cb7fb,_0x3a8e49[_0x9b8a('0x6c')]);return db[_0x9b8a('0xd9')][_0x9b8a('0x65')]({'where':_0x4cb7fb[_0x9b8a('0x5d')]})[_0x9b8a('0x37')](function(_0x4a4eec){_0xc89353['count']=_0x4a4eec;if(_0x3a8e49[_0x9b8a('0x52')][_0x9b8a('0x6b')]){_0x4cb7fb[_0x9b8a('0x66')]=[{'all':!![]}];}return db[_0x9b8a('0xd9')][_0x9b8a('0x67')](_0x4cb7fb);})[_0x9b8a('0x37')](function(_0x52eee5){_0xc89353[_0x9b8a('0x68')]=_0x52eee5;return _0xc89353;});}})[_0x9b8a('0x37')](respondWithFilteredResult(_0x4764e5,_0x4cb7fb))[_0x9b8a('0x2b')](handleError(_0x4764e5,null));};exports[_0x9b8a('0xda')]=function(_0x36657c,_0x470371,_0x4eff06){var _0x283496={};var _0x5ddc57={};var _0x9527e3;var _0x1e0b75;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x36657c[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x470371,null))[_0x9b8a('0x37')](function(_0x51bc89){if(_0x51bc89){_0x9527e3=_0x51bc89;_0x5ddc57[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xdb')]['rawAttributes']);_0x5ddc57[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x36657c[_0x9b8a('0x52')]);_0x5ddc57[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x5ddc57['model'],_0x5ddc57['query']);_0x283496[_0x9b8a('0x56')]=_['intersection'](_0x5ddc57['model'],qs['fields'](_0x36657c[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x283496[_0x9b8a('0x56')]=_0x283496[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0x283496[_0x9b8a('0x56')]:_0x5ddc57[_0x9b8a('0x4e')];_0x283496['order']=qs[_0x9b8a('0x5c')](_0x36657c['query']['sort']);_0x283496[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x36657c[_0x9b8a('0x52')],_0x5ddc57[_0x9b8a('0x54')]));if(_0x36657c['query'][_0x9b8a('0x41')]){_0x283496[_0x9b8a('0x5d')]=_['merge'](_0x283496['where'],{'$or':_[_0x9b8a('0x4a')](_0x283496[_0x9b8a('0x56')],function(_0x3e6405){var _0x34e009={};_0x34e009[_0x3e6405]={'$like':'%'+_0x36657c[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x34e009;})});}_0x283496=_['merge']({},_0x283496,_0x36657c[_0x9b8a('0x6c')]);return _0x9527e3['getChatInteractions'](_0x283496);}})['then'](function(_0x1eca59){if(_0x1eca59){_0x1e0b75=_0x1eca59[_0x9b8a('0x58')];if(!_0x36657c[_0x9b8a('0x52')][_0x9b8a('0x59')]('nolimit')){_0x283496[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x36657c[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x283496[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x36657c[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}return _0x9527e3['getChatInteractions'](_0x283496);}})[_0x9b8a('0x37')](function(_0x154b6d){if(_0x154b6d){return _0x154b6d?{'count':_0x1e0b75,'rows':_0x154b6d}:null;}})['then'](respondWithResult(_0x470371,null))['catch'](handleError(_0x470371,null));};exports[_0x9b8a('0xdc')]=function(_0x3cddcf,_0x3cce7b,_0x667b19){var _0x12c30a={};var _0x18d9be={};var _0x5618fc;var _0x526083;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x3cddcf['params']['id']}})['then'](handleEntityNotFound(_0x3cce7b,null))['then'](function(_0x830573){if(_0x830573){_0x5618fc=_0x830573;_0x18d9be[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xdd')][_0x9b8a('0x4c')]);_0x18d9be[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x3cddcf[_0x9b8a('0x52')]);_0x18d9be[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x18d9be[_0x9b8a('0x4e')],_0x18d9be[_0x9b8a('0x52')]);_0x12c30a[_0x9b8a('0x56')]=_['intersection'](_0x18d9be[_0x9b8a('0x4e')],qs['fields'](_0x3cddcf[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x12c30a['attributes']=_0x12c30a[_0x9b8a('0x56')]['length']?_0x12c30a[_0x9b8a('0x56')]:_0x18d9be[_0x9b8a('0x4e')];_0x12c30a[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x3cddcf['query']['sort']);_0x12c30a['where']=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x3cddcf['query'],_0x18d9be['filters']));if(_0x3cddcf[_0x9b8a('0x52')][_0x9b8a('0x41')]){_0x12c30a[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x12c30a[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x12c30a[_0x9b8a('0x56')],function(_0x3f4ca8){var _0x21d217={};_0x21d217[_0x3f4ca8]={'$like':'%'+_0x3cddcf[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x21d217;})});}_0x12c30a=_[_0x9b8a('0x5f')]({},_0x12c30a,_0x3cddcf[_0x9b8a('0x6c')]);return _0x5618fc['getOpenchannelInteractions'](_0x12c30a);}})['then'](function(_0x47c5c8){if(_0x47c5c8){_0x526083=_0x47c5c8[_0x9b8a('0x58')];if(!_0x3cddcf['query'][_0x9b8a('0x59')]('nolimit')){_0x12c30a[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x3cddcf['query'][_0x9b8a('0x30')]);_0x12c30a[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x3cddcf['query']['offset']);}return _0x5618fc['getOpenchannelInteractions'](_0x12c30a);}})['then'](function(_0x5c951b){if(_0x5c951b){return _0x5c951b?{'count':_0x526083,'rows':_0x5c951b}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x3cce7b,null))[_0x9b8a('0x2b')](handleError(_0x3cce7b,null));};exports[_0x9b8a('0xde')]=function(_0x167de3,_0x5ddb4e,_0x4bc891){var _0x24f2c0={'raw':!![],'where':{}};var _0x1c8d41={};var _0x25525e={'count':0x0,'rows':[]};return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x167de3[_0x9b8a('0x6a')]['id']}})['then'](handleEntityNotFound(_0x5ddb4e,null))[_0x9b8a('0x37')](function(_0x4947cc){if(_0x4947cc){_0x1c8d41[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xdf')]['rawAttributes']);_0x1c8d41[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x167de3['query']);_0x1c8d41[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x1c8d41[_0x9b8a('0x4e')],_0x1c8d41[_0x9b8a('0x52')]);_0x24f2c0['attributes']=_['intersection'](_0x1c8d41[_0x9b8a('0x4e')],qs['fields'](_0x167de3[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x24f2c0[_0x9b8a('0x56')]=_0x24f2c0[_0x9b8a('0x56')]['length']?_0x24f2c0[_0x9b8a('0x56')]:_0x1c8d41[_0x9b8a('0x4e')];if(!_0x167de3['query']['hasOwnProperty'](_0x9b8a('0x5a'))){_0x24f2c0['limit']=qs[_0x9b8a('0x30')](_0x167de3[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x24f2c0[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x167de3[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}_0x24f2c0[_0x9b8a('0x5b')]=qs['sort'](_0x167de3[_0x9b8a('0x52')][_0x9b8a('0x5c')]);_0x24f2c0[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_['pick'](_0x167de3['query'],_0x1c8d41['filters']));_0x24f2c0['where'][_0x9b8a('0xd8')]=_0x4947cc['id'];if(_0x167de3[_0x9b8a('0x52')]['filter']){_0x24f2c0[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x24f2c0[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x24f2c0[_0x9b8a('0x56')],function(_0x11c98e){var _0x3b1e5e={};_0x3b1e5e[_0x11c98e]={'$like':'%'+_0x167de3[_0x9b8a('0x52')]['filter']+'%'};return _0x3b1e5e;})});}_0x24f2c0=_[_0x9b8a('0x5f')]({},_0x24f2c0,_0x167de3[_0x9b8a('0x6c')]);return db[_0x9b8a('0xdf')][_0x9b8a('0x65')]({'where':_0x24f2c0[_0x9b8a('0x5d')]})[_0x9b8a('0x37')](function(_0x4c7621){_0x25525e[_0x9b8a('0x65')]=_0x4c7621;if(_0x167de3[_0x9b8a('0x52')][_0x9b8a('0x6b')]){_0x24f2c0[_0x9b8a('0x66')]=[{'all':!![]}];}return db[_0x9b8a('0xdf')][_0x9b8a('0x67')](_0x24f2c0);})[_0x9b8a('0x37')](function(_0x446f62){_0x25525e[_0x9b8a('0x68')]=_0x446f62;return _0x25525e;});}})[_0x9b8a('0x37')](respondWithFilteredResult(_0x5ddb4e,_0x24f2c0))[_0x9b8a('0x2b')](handleError(_0x5ddb4e,null));};exports[_0x9b8a('0xe0')]=function(_0xe8b64a,_0x270662,_0x44cff7){var _0x1c8c47={};var _0x2fced2={};var _0x2b4345;var _0x2a6560;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0xe8b64a[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x270662,null))[_0x9b8a('0x37')](function(_0x4d08c0){if(_0x4d08c0){_0x2b4345=_0x4d08c0;_0x2fced2[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xe1')][_0x9b8a('0x4c')]);_0x2fced2[_0x9b8a('0x52')]=_['keys'](_0xe8b64a[_0x9b8a('0x52')]);_0x2fced2['filters']=_[_0x9b8a('0x55')](_0x2fced2[_0x9b8a('0x4e')],_0x2fced2[_0x9b8a('0x52')]);_0x1c8c47[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x2fced2['model'],qs[_0x9b8a('0x57')](_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x1c8c47[_0x9b8a('0x56')]=_0x1c8c47[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0x1c8c47[_0x9b8a('0x56')]:_0x2fced2[_0x9b8a('0x4e')];_0x1c8c47[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x5c')]);_0x1c8c47[_0x9b8a('0x5d')]=qs['filters'](_[_0x9b8a('0x5e')](_0xe8b64a[_0x9b8a('0x52')],_0x2fced2['filters']));if(_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x41')]){_0x1c8c47[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x1c8c47[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x1c8c47[_0x9b8a('0x56')],function(_0x372115){var _0x393e53={};_0x393e53[_0x372115]={'$like':'%'+_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x393e53;})});}_0x1c8c47=_['merge']({},_0x1c8c47,_0xe8b64a['options']);return _0x2b4345['getSmsInteractions'](_0x1c8c47);}})[_0x9b8a('0x37')](function(_0x41c72a){if(_0x41c72a){_0x2a6560=_0x41c72a['length'];if(!_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x1c8c47[_0x9b8a('0x30')]=qs['limit'](_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x1c8c47[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}return _0x2b4345[_0x9b8a('0xe0')](_0x1c8c47);}})[_0x9b8a('0x37')](function(_0x444349){if(_0x444349){return _0x444349?{'count':_0x2a6560,'rows':_0x444349}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x270662,null))['catch'](handleError(_0x270662,null));};exports['getFaxInteractions']=function(_0x525b34,_0x9dda9b,_0x3b62cd){var _0x4c4890={};var _0x44c01e={};var _0x198fd5;var _0x4b6218;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x525b34['params']['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x9dda9b,null))['then'](function(_0x2e416c){if(_0x2e416c){_0x198fd5=_0x2e416c;_0x44c01e[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db['FaxInteraction']['rawAttributes']);_0x44c01e['query']=_[_0x9b8a('0x53')](_0x525b34[_0x9b8a('0x52')]);_0x44c01e[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x44c01e[_0x9b8a('0x4e')],_0x44c01e['query']);_0x4c4890['attributes']=_[_0x9b8a('0x55')](_0x44c01e['model'],qs[_0x9b8a('0x57')](_0x525b34[_0x9b8a('0x52')]['fields']));_0x4c4890[_0x9b8a('0x56')]=_0x4c4890['attributes'][_0x9b8a('0x58')]?_0x4c4890[_0x9b8a('0x56')]:_0x44c01e[_0x9b8a('0x4e')];_0x4c4890[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x525b34['query'][_0x9b8a('0x5c')]);_0x4c4890[_0x9b8a('0x5d')]=qs['filters'](_[_0x9b8a('0x5e')](_0x525b34[_0x9b8a('0x52')],_0x44c01e[_0x9b8a('0x54')]));if(_0x525b34[_0x9b8a('0x52')][_0x9b8a('0x41')]){_0x4c4890[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x4c4890['where'],{'$or':_['map'](_0x4c4890[_0x9b8a('0x56')],function(_0x32de04){var _0x1a9662={};_0x1a9662[_0x32de04]={'$like':'%'+_0x525b34[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x1a9662;})});}_0x4c4890=_[_0x9b8a('0x5f')]({},_0x4c4890,_0x525b34[_0x9b8a('0x6c')]);return _0x198fd5['getFaxInteractions'](_0x4c4890);}})[_0x9b8a('0x37')](function(_0x3b4f78){if(_0x3b4f78){_0x4b6218=_0x3b4f78[_0x9b8a('0x58')];if(!_0x525b34['query'][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x4c4890[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x525b34[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x4c4890[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x525b34[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}return _0x198fd5[_0x9b8a('0xe2')](_0x4c4890);}})[_0x9b8a('0x37')](function(_0x576e9e){if(_0x576e9e){return _0x576e9e?{'count':_0x4b6218,'rows':_0x576e9e}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x9dda9b,null))[_0x9b8a('0x2b')](handleError(_0x9dda9b,null));};exports['getWhatsappInteractions']=function(_0x3be2ec,_0x4af8f1,_0x3008bf){var _0x24a656={};var _0x71e090={};var _0x40f6ec;var _0x5b6db4;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x3be2ec['params']['id']}})['then'](handleEntityNotFound(_0x4af8f1,null))[_0x9b8a('0x37')](function(_0x1ec50b){if(_0x1ec50b){_0x40f6ec=_0x1ec50b;_0x71e090[_0x9b8a('0x4e')]=_['keys'](db['WhatsappInteraction'][_0x9b8a('0x4c')]);_0x71e090['query']=_['keys'](_0x3be2ec[_0x9b8a('0x52')]);_0x71e090[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x71e090[_0x9b8a('0x4e')],_0x71e090[_0x9b8a('0x52')]);_0x24a656[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x71e090[_0x9b8a('0x4e')],qs[_0x9b8a('0x57')](_0x3be2ec[_0x9b8a('0x52')]['fields']));_0x24a656['attributes']=_0x24a656[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0x24a656['attributes']:_0x71e090[_0x9b8a('0x4e')];_0x24a656[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x3be2ec[_0x9b8a('0x52')][_0x9b8a('0x5c')]);_0x24a656[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x3be2ec[_0x9b8a('0x52')],_0x71e090[_0x9b8a('0x54')]));if(_0x3be2ec['query']['filter']){_0x24a656['where']=_[_0x9b8a('0x5f')](_0x24a656[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x24a656[_0x9b8a('0x56')],function(_0x1f4106){var _0x86d5c0={};_0x86d5c0[_0x1f4106]={'$like':'%'+_0x3be2ec['query']['filter']+'%'};return _0x86d5c0;})});}_0x24a656=_[_0x9b8a('0x5f')]({},_0x24a656,_0x3be2ec[_0x9b8a('0x6c')]);return _0x40f6ec[_0x9b8a('0xe3')](_0x24a656);}})[_0x9b8a('0x37')](function(_0x2da3be){if(_0x2da3be){_0x5b6db4=_0x2da3be[_0x9b8a('0x58')];if(!_0x3be2ec['query'][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x24a656[_0x9b8a('0x30')]=qs['limit'](_0x3be2ec[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x24a656[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x3be2ec[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}return _0x40f6ec[_0x9b8a('0xe3')](_0x24a656);}})[_0x9b8a('0x37')](function(_0x215f56){if(_0x215f56){return _0x215f56?{'count':_0x5b6db4,'rows':_0x215f56}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x4af8f1,null))[_0x9b8a('0x2b')](handleError(_0x4af8f1,null));};exports['login']=function(_0x18ecb3,_0x14d0ac,_0x33a97b){var _0x1b328d;var _0x3636d5;var _0x18e332;var _0x5f50a8=!_[_0x9b8a('0x79')](_0x18ecb3[_0x9b8a('0x6a')]['id'])?_0x18ecb3['params']['id']:!_[_0x9b8a('0x79')](_0x18ecb3[_0x9b8a('0x3c')]['id'])?_0x18ecb3[_0x9b8a('0x3c')]['id']:null;return db[_0x9b8a('0x4b')]['find']({'where':{'id':_0x5f50a8,'role':{'$or':[_0x9b8a('0x3a'),_0x9b8a('0x3c'),_0x9b8a('0x3e')]}},'attributes':['id','name',_0x9b8a('0xe4'),_0x9b8a('0xe5'),'role',_0x9b8a('0x72'),_0x9b8a('0xb0')]})[_0x9b8a('0x37')](function(_0x339c38){if(_0x339c38){if(_0x339c38[_0x9b8a('0x39')]===_0x9b8a('0x3e')){_0x1b328d=_0x339c38;if(_0x18ecb3[_0x9b8a('0x6d')][_0x9b8a('0xbd')]){_0x18e332=util[_0x9b8a('0xbe')](_0x9b8a('0xe6'),_0x1b328d[_0x18ecb3[_0x9b8a('0x6d')][_0x9b8a('0xbd')]]);}else if(_0x18ecb3[_0x9b8a('0x6d')][_0x9b8a('0xe7')]){_0x18e332=util[_0x9b8a('0xbe')](_0x9b8a('0xe8'),_0x18ecb3['body'][_0x9b8a('0xe7')]);}else{_0x18e332=util[_0x9b8a('0xbe')](_0x9b8a('0xe8'),_0x1b328d[_0x9b8a('0x46')]);}socket['to'](util['format'](_0x9b8a('0xe9'),_0x1b328d[_0x9b8a('0x46')]))[_0x9b8a('0xba')](_0x9b8a('0xea'),{'user':{'id':_0x1b328d['id'],'name':_0x1b328d[_0x9b8a('0x46')]},'ip':_0x18ecb3['headers'][_0x9b8a('0xeb')]||_0x18ecb3[_0x9b8a('0xec')][_0x9b8a('0xed')]||_0x18ecb3[_0x9b8a('0xee')][_0x9b8a('0xed')]||_0x18ecb3['connection']['socket'][_0x9b8a('0xed')]});return db[_0x9b8a('0xc2')][_0x9b8a('0x47')]({'where':{'membername':_0x1b328d[_0x9b8a('0x46')]},'individualHooks':!![]});}}else{throw new db[(_0x9b8a('0xa1'))]['ValidationError'](_0x9b8a('0xef'));}})[_0x9b8a('0x37')](function(){if(_0x1b328d){return _0x1b328d[_0x9b8a('0xf0')]({'raw':!![]});}})['then'](function(_0x5cebf2){if(_0x1b328d){var _0x54b776=[];if(_0x5cebf2){_0x3636d5=_0x5cebf2;if(_0x3636d5[_0x9b8a('0x58')]){for(var _0x15841c=0x0;_0x15841c<_0x3636d5[_0x9b8a('0x58')];_0x15841c++){_0x54b776[_0x9b8a('0x98')]({'membername':_0x1b328d['name'],'UserId':_0x1b328d['id'],'queue_name':_0x3636d5[_0x15841c]['name'],'VoiceQueueId':_0x3636d5[_0x15841c]['id'],'interface':_0x18e332,'paused':_0x1b328d[_0x9b8a('0xb0')]||![],'penalty':_0x3636d5[_0x15841c][_0x9b8a('0xf1')]||0x0});}return BPromise[_0x9b8a('0x9a')](_0x54b776,function(_0x5ba556){return db[_0x9b8a('0xc2')][_0x9b8a('0xbf')](_0x5ba556);});}}}})[_0x9b8a('0x37')](function(){if(_0x1b328d){return db['MemberReport'][_0x9b8a('0x67')]({'where':{'membername':_0x1b328d[_0x9b8a('0x46')],'exitAt':null}});}})[_0x9b8a('0x37')](function(_0x1ec4d0){if(_0x1b328d){var _0x3e04a7=[];_0x1ec4d0[_0x9b8a('0xf2')](function(_0x573277){_0x3e04a7['push'](_0x573277[_0x9b8a('0x36')]({'exitAt':moment()['format'](_0x9b8a('0xf3'))}));});return BPromise['all'](_0x3e04a7);}})[_0x9b8a('0x37')](function(){if(_0x1b328d){var _0x1946e3=[];var _0x1bbeca=[];var _0x49fdf2=utils[_0x9b8a('0xf4')]();var _0x3dbb99={'membername':_0x1b328d[_0x9b8a('0x46')],'interface':_0x18e332,'enterAt':moment()[_0x9b8a('0xbe')](_0x9b8a('0xf3')),'role':_0x1b328d[_0x9b8a('0x39')],'internal':_0x1b328d[_0x9b8a('0x72')]};_0x49fdf2[_0x9b8a('0xf2')](function(_0x39ef6d){_0x1946e3[_0x9b8a('0x98')](_[_0x9b8a('0x5f')]({'channel':_0x39ef6d,'type':'LOGIN','data1':_0x18ecb3[_0x9b8a('0x6d')][_0x9b8a('0xf5')],'data2':_0x18e332},_0x3dbb99));if(_0x1b328d[_0x9b8a('0xb0')]){_0x1bbeca[_0x9b8a('0x98')](_[_0x9b8a('0x5f')]({'channel':_0x39ef6d,'type':_0x9b8a('0xf6'),'data1':_0x9b8a('0xf7')},_0x3dbb99));}});return db[_0x9b8a('0xf8')][_0x9b8a('0x94')](_0x1946e3[_0x9b8a('0xf9')](_0x1bbeca),{'individualHooks':!![]});}})[_0x9b8a('0x37')](function(){if(_0x1b328d){return _0x1b328d['update']({'online':!![],'lastLoginAt':moment()[_0x9b8a('0xbe')](_0x9b8a('0xf3')),'voicePause':_0x1b328d[_0x9b8a('0xb0')]||![],'mailPause':_0x1b328d[_0x9b8a('0xb0')]||![],'chatPause':_0x1b328d['loginInPause']||![],'faxPause':_0x1b328d[_0x9b8a('0xb0')]||![],'smsPause':_0x1b328d['loginInPause']||![],'openchannelPause':_0x1b328d[_0x9b8a('0xb0')]||![],'whatsappPause':_0x1b328d[_0x9b8a('0xb0')]||![],'pauseType':_0x1b328d[_0x9b8a('0xb0')]?_0x9b8a('0xf7'):null,'interface':_0x18e332,'lastPauseAt':moment()['format'](_0x9b8a('0xf3'))});}})[_0x9b8a('0x37')](function(_0x4a51a9){if(_0x18ecb3[_0x9b8a('0xfa')]){return _0x33a97b();}else{return BPromise[_0x9b8a('0xfb')](_0x4a51a9)[_0x9b8a('0x37')](respondWithResult(_0x14d0ac,null));}})['catch'](handleError(_0x14d0ac,null));};exports[_0x9b8a('0xfc')]=function(_0x3b76a2,_0x6824d2,_0x1c04aa){var _0x10d0bd;return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x3b76a2[_0x9b8a('0x6a')]['id'],'role':_0x9b8a('0x3e')},'attributes':['id','name',_0x9b8a('0x39')]})['then'](handleEntityNotFound(_0x6824d2,null))[_0x9b8a('0x37')](function(_0x796a3c){if(_0x796a3c){_0x10d0bd=_0x796a3c;return db[_0x9b8a('0xc2')][_0x9b8a('0x47')]({'where':{'membername':_0x10d0bd[_0x9b8a('0x46')]},'individualHooks':!![]});}})[_0x9b8a('0x37')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x10d0bd['name'],'exitAt':null}});})[_0x9b8a('0x37')](function(_0x230ef1){var _0x2298c2=[];_0x230ef1['forEach'](function(_0x5b22c4){_0x2298c2[_0x9b8a('0x98')](_0x5b22c4[_0x9b8a('0x36')]({'exitAt':moment()[_0x9b8a('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x2298c2);})[_0x9b8a('0x37')](function(){return _0x10d0bd[_0x9b8a('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9b8a('0x37')](respondWithResult(_0x6824d2,null))[_0x9b8a('0x2b')](handleError(_0x6824d2,null));};exports[_0x9b8a('0xfd')]=function(_0x46201b,_0x23709c,_0x222082){var _0xb6ddb8;return db[_0x9b8a('0xc2')][_0x9b8a('0x36')]({'paused':0x1},{'where':{'UserId':_0x46201b[_0x9b8a('0x6a')]['id']},'individualHooks':!![]})[_0x9b8a('0x37')](function(){return db['User']['find']({'where':{'id':_0x46201b[_0x9b8a('0x6a')]['id'],'role':'agent'},'attributes':['id','name',_0x9b8a('0x39'),_0x9b8a('0x72'),_0x9b8a('0xbd')]});})[_0x9b8a('0x37')](handleEntityNotFound(_0x23709c,null))[_0x9b8a('0x37')](function(_0x4f6cd4){if(_0x4f6cd4){_0xb6ddb8=_0x4f6cd4;return respondWithRpcPromise('QueuePause',_0x9b8a('0xfd'),{'id':_0xb6ddb8['id'],'name':_0xb6ddb8[_0x9b8a('0x46')],'pause':!![]});}})[_0x9b8a('0x37')](function(){if(_0xb6ddb8){return db['MemberReport'][_0x9b8a('0x67')]({'where':{'membername':_0xb6ddb8[_0x9b8a('0x46')],'type':'PAUSE','exitAt':null}});}})[_0x9b8a('0x37')](function(_0x4ee595){if(_0x4ee595[_0x9b8a('0x58')]){var _0x27bfe2=moment()[_0x9b8a('0xbe')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x126f84=0x0,_0x20289=_0x4ee595['length'];_0x126f84<_0x20289;_0x126f84++){_0x4ee595[_0x126f84][_0x9b8a('0xfe')]({'exitAt':_0x27bfe2});}}})['then'](function(){var _0x4abc38=[];var _0x3c4c29=utils['getChannels']();_0x3c4c29[_0x9b8a('0xf2')](function(_0xd9580f){_0x4abc38[_0x9b8a('0x98')]({'channel':_0xd9580f,'membername':_0xb6ddb8[_0x9b8a('0x46')],'interface':_['isNil'](_0xb6ddb8[_0x9b8a('0xbd')])?util[_0x9b8a('0xbe')]('SIP/%s',_0xb6ddb8[_0x9b8a('0x46')]):_0xb6ddb8[_0x9b8a('0xbd')],'type':_0x9b8a('0xf6'),'enterAt':moment()[_0x9b8a('0xbe')](_0x9b8a('0xf3')),'data1':_0x46201b[_0x9b8a('0x6d')][_0x9b8a('0x60')]||'DEFAULT\x20PAUSE','role':_0xb6ddb8['role'],'internal':_0xb6ddb8[_0x9b8a('0x72')]});});return db[_0x9b8a('0xf8')]['bulkCreate'](_0x4abc38,{'individualHooks':!![]});})['then'](function(){return _0xb6ddb8[_0x9b8a('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x46201b['body'][_0x9b8a('0x60')]||_0x9b8a('0xff'),'lastPauseAt':moment()[_0x9b8a('0xbe')](_0x9b8a('0xf3'))});})[_0x9b8a('0x37')](respondWithResult(_0x23709c,null))[_0x9b8a('0x2b')](handleError(_0x23709c,null));};exports[_0x9b8a('0x100')]=function(_0x1f05cd,_0xba31e2,_0x539f83){var _0x3da542;return db[_0x9b8a('0x4b')]['find']({'where':{'id':_0x1f05cd[_0x9b8a('0x6a')]['id']},'attributes':['id',_0x9b8a('0x46'),_0x9b8a('0x39'),'voicePause',_0x9b8a('0x101'),_0x9b8a('0x102'),_0x9b8a('0x103'),'openchannelPause',_0x9b8a('0x104'),'whatsapppause',_0x9b8a('0x105'),_0x9b8a('0x106')]})[_0x9b8a('0x37')](handleEntityNotFound(_0xba31e2,null))[_0x9b8a('0x37')](function(_0x430411){if(_0x430411){_0x3da542=_0x430411;if(_0x1f05cd[_0x9b8a('0x6d')][_0x9b8a('0xae')]&&!utils[_0x9b8a('0xb2')](_0x1f05cd[_0x9b8a('0x6d')][_0x9b8a('0xae')])){throw new db['Sequelize'][(_0x9b8a('0xa2'))](_0x9b8a('0xb3'));}switch(_0x1f05cd['body'][_0x9b8a('0xae')]){case'voice':return respondWithRpcPromise(_0x9b8a('0x107'),_0x9b8a('0x100'),{'id':_0x3da542['id'],'name':_0x3da542[_0x9b8a('0x46')],'pause':![]})['then'](function(){return db[_0x9b8a('0xc2')][_0x9b8a('0x36')]({'paused':0x0},{'where':{'UserId':_0x3da542['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport'][_0x9b8a('0x45')]({'where':{'channel':_0x1f05cd[_0x9b8a('0x6d')][_0x9b8a('0xae')],'membername':_0x3da542[_0x9b8a('0x46')],'type':'PAUSE','exitAt':null}});})[_0x9b8a('0x37')](function(_0x28c25b){if(_0x28c25b){return _0x28c25b[_0x9b8a('0x36')]({'exitAt':moment()[_0x9b8a('0xbe')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9b8a('0x108')},{'individualHooks':!![]});}return null;})[_0x9b8a('0x37')](function(){return _0x3da542[_0x9b8a('0x36')]({'voicePause':![]});});case _0x9b8a('0x109'):case _0x9b8a('0x10a'):case'fax':case _0x9b8a('0x10b'):case _0x9b8a('0x10c'):case'openchannel':return db[_0x9b8a('0xf8')]['find']({'where':{'channel':_0x1f05cd['body'][_0x9b8a('0xae')],'membername':_0x3da542[_0x9b8a('0x46')],'type':_0x9b8a('0xf6'),'exitAt':null}})['then'](function(_0x57d91d){if(_0x57d91d){return _0x57d91d['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9b8a('0x108')},{'individualHooks':!![]});}return null;})[_0x9b8a('0x37')](function(){var _0x628e64={};_[_0x9b8a('0x31')](_0x628e64,util[_0x9b8a('0xbe')](_0x9b8a('0x10d'),_0x1f05cd[_0x9b8a('0x6d')][_0x9b8a('0xae')],_0x9b8a('0x10e')),![]);return _0x3da542[_0x9b8a('0x36')](_0x628e64);});default:return respondWithRpcPromise(_0x9b8a('0x107'),_0x9b8a('0x100'),{'id':_0x3da542['id'],'name':_0x3da542[_0x9b8a('0x46')],'pause':![]})[_0x9b8a('0x37')](function(){return db[_0x9b8a('0xc2')][_0x9b8a('0x36')]({'paused':0x0},{'where':{'UserId':_0x3da542['id']}});})['then'](function(){return db['MemberReport'][_0x9b8a('0x67')]({'where':{'membername':_0x3da542[_0x9b8a('0x46')],'type':_0x9b8a('0xf6'),'exitAt':null}});})[_0x9b8a('0x37')](function(_0x236bb8){var _0x4d0734=[];_0x236bb8[_0x9b8a('0xf2')](function(_0x21d156){_0x4d0734[_0x9b8a('0x98')](_0x21d156[_0x9b8a('0x36')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9b8a('0x108')}));});return BPromise[_0x9b8a('0x99')](_0x4d0734);})[_0x9b8a('0x37')](function(){return _0x3da542[_0x9b8a('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x9b8a('0x37')](respondWithResult(_0xba31e2,null))['catch'](handleError(_0xba31e2,null));};exports[_0x9b8a('0x10f')]=function(_0x31fe95,_0x5b8873,_0x503472){var _0x2fd6e3={};var _0xaae511={};var _0x284889;var _0x5e18d2;return db['User'][_0x9b8a('0xa8')]({'where':{'id':_0x31fe95[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x5b8873,null))[_0x9b8a('0x37')](function(_0x15ab3e){if(_0x15ab3e){_0x284889=_0x15ab3e;_0xaae511['model']=_['keys'](db[_0x9b8a('0x110')][_0x9b8a('0x4c')]);_0xaae511[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x31fe95['query']);_0xaae511[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0xaae511[_0x9b8a('0x4e')],_0xaae511[_0x9b8a('0x52')]);_0x2fd6e3[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0xaae511[_0x9b8a('0x4e')],qs[_0x9b8a('0x57')](_0x31fe95[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x2fd6e3[_0x9b8a('0x56')]=_0x2fd6e3[_0x9b8a('0x56')]['length']?_0x2fd6e3['attributes']:_0xaae511[_0x9b8a('0x4e')];_0x2fd6e3['order']=qs[_0x9b8a('0x5c')](_0x31fe95['query'][_0x9b8a('0x5c')]);_0x2fd6e3[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_['pick'](_0x31fe95[_0x9b8a('0x52')],_0xaae511[_0x9b8a('0x54')]));if(_0x31fe95[_0x9b8a('0x52')]['filter']){_0x2fd6e3[_0x9b8a('0x5d')]=_['merge'](_0x2fd6e3['where'],{'$or':_[_0x9b8a('0x4a')](_0x2fd6e3[_0x9b8a('0x56')],function(_0x103b93){var _0x29378e={};_0x29378e[_0x103b93]={'$like':'%'+_0x31fe95[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x29378e;})});}_0x2fd6e3=_[_0x9b8a('0x5f')]({},_0x2fd6e3,_0x31fe95[_0x9b8a('0x6c')]);return _0x284889[_0x9b8a('0x10f')](_0x2fd6e3);}})[_0x9b8a('0x37')](function(_0x490b1b){if(_0x490b1b){_0x5e18d2=_0x490b1b[_0x9b8a('0x58')];if(!_0x31fe95['query'][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x2fd6e3[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x31fe95[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x2fd6e3[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x31fe95[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}return _0x284889['getTeams'](_0x2fd6e3);}})['then'](function(_0x377d92){if(_0x377d92){return _0x377d92?{'count':_0x5e18d2,'rows':_0x377d92}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x5b8873,null))[_0x9b8a('0x2b')](handleError(_0x5b8873,null));};exports[_0x9b8a('0x111')]=function(_0x196f16,_0x5502ab){return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x196f16['params']['id']}})['then'](handleEntityNotFound(_0x5502ab,null))['then'](function(_0x127530){if(_0x127530){var _0x44b2e7=_0x127530[_0x9b8a('0x38')]({'plain':!![]});return _0x127530[_0x9b8a('0x111')](_0x196f16[_0x9b8a('0x6d')]['ids'],_[_0x9b8a('0x71')](_0x196f16[_0x9b8a('0x6d')],['ids','id'])||{})[_0x9b8a('0x37')](function(){for(var _0x3d0fbe=0x0;_0x3d0fbe<_0x196f16['body'][_0x9b8a('0x70')]['length'];_0x3d0fbe++){var _0xc26875=[];db[_0x9b8a('0x110')][_0x9b8a('0xa8')]({'where':{'id':_0x196f16['body']['ids'][_0x3d0fbe]}})[_0x9b8a('0x37')](function(_0x51b261){_0xc26875[_0x9b8a('0x98')](_0x51b261[_0x9b8a('0xf0')]()[_0x9b8a('0x37')](function(_0x5a70c7){for(var _0x3fb665=0x0;_0x3fb665<_0x5a70c7[_0x9b8a('0x58')];_0x3fb665++){_0x5a70c7[_0x3fb665]['setDataValue'](_0x9b8a('0xae'),_0x9b8a('0x112'));}return _0x5a70c7;}));_0xc26875[_0x9b8a('0x98')](_0x51b261[_0x9b8a('0x113')]()[_0x9b8a('0x37')](function(_0x3f5b92){for(var _0x11c552=0x0;_0x11c552<_0x3f5b92['length'];_0x11c552++){_0x3f5b92[_0x11c552]['setDataValue']('channel',_0x9b8a('0x114'));}return _0x3f5b92;}));_0xc26875[_0x9b8a('0x98')](_0x51b261[_0x9b8a('0x115')]()['then'](function(_0x402e70){for(var _0x1adc15=0x0;_0x1adc15<_0x402e70[_0x9b8a('0x58')];_0x1adc15++){_0x402e70[_0x1adc15][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x117'));}return _0x402e70;}));_0xc26875[_0x9b8a('0x98')](_0x51b261['getSmsQueues']()['then'](function(_0x20e754){for(var _0x23903b=0x0;_0x23903b<_0x20e754[_0x9b8a('0x58')];_0x23903b++){_0x20e754[_0x23903b][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x118'));}return _0x20e754;}));_0xc26875[_0x9b8a('0x98')](_0x51b261[_0x9b8a('0x119')]()[_0x9b8a('0x37')](function(_0x3afcc0){for(var _0x3b816c=0x0;_0x3b816c<_0x3afcc0[_0x9b8a('0x58')];_0x3b816c++){_0x3afcc0[_0x3b816c][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x11a'));}return _0x3afcc0;}));_0xc26875[_0x9b8a('0x98')](_0x51b261[_0x9b8a('0x11b')]()[_0x9b8a('0x37')](function(_0x5b87f0){for(var _0x43fc59=0x0;_0x43fc59<_0x5b87f0[_0x9b8a('0x58')];_0x43fc59++){_0x5b87f0[_0x43fc59]['setDataValue'](_0x9b8a('0xae'),'Fax');}return _0x5b87f0;}));_0xc26875[_0x9b8a('0x98')](_0x51b261['getOpenchannelQueues']()[_0x9b8a('0x37')](function(_0x60bba3){for(var _0x1cd682=0x0;_0x1cd682<_0x60bba3[_0x9b8a('0x58')];_0x1cd682++){_0x60bba3[_0x1cd682][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x11c'));}return _0x60bba3;}));return BPromise[_0x9b8a('0x99')](_0xc26875);})[_0x9b8a('0x37')](function(_0x5943da){var _0x1b1550=_[_0x9b8a('0x11d')](_0x5943da);_0xc26875=[];return db[_0x9b8a('0x62')][_0x9b8a('0x11e')](function(_0x3cccfd){for(var _0x473eca=0x0;_0x473eca<_0x1b1550[_0x9b8a('0x58')];_0x473eca++){_0xc26875[_0x9b8a('0x98')](_0x1b1550[_0x473eca][_0x9b8a('0x11f')](_0x44b2e7['id']),{'transaction':_0x3cccfd});}return BPromise[_0x9b8a('0x99')](_0xc26875)[_0x9b8a('0x37')](function(){if(_0x44b2e7['online']){return BPromise[_0x9b8a('0x9a')](_[_0x9b8a('0x41')](_0x1b1550,function(_0x498927){return _0x498927[_0x9b8a('0x120')]('channel')===_0x9b8a('0x112');}),function(_0x3f59e2){return db['UserVoiceQueueRt']['upsert']({'membername':_0x44b2e7[_0x9b8a('0x46')],'UserId':_0x44b2e7['id'],'queue_name':_0x3f59e2['name'],'VoiceQueueId':_0x3f59e2['id'],'interface':_['isNil'](_0x44b2e7[_0x9b8a('0xbd')])?util['format'](_0x9b8a('0xe8'),_0x44b2e7['name']):_0x44b2e7[_0x9b8a('0xbd')],'paused':_0x44b2e7[_0x9b8a('0xb1')]||![],'penalty':_0x44b2e7['penalty']},{'transaction':_0x3cccfd});});}else{return;}})[_0x9b8a('0x37')](function(){for(var _0x21be21=0x0;_0x21be21<_0x1b1550[_0x9b8a('0x58')];_0x21be21++){var _0x4dc9dd=_0x1b1550[_0x21be21]['getDataValue'](_0x9b8a('0xae'));var _0x4cd4ff=_0x4dc9dd+_0x9b8a('0x121');socket[_0x9b8a('0xba')]('user'+_0x4dc9dd+'Queue:save',{'UserId':_0x44b2e7['id'],['queueField']:_0x1b1550[_0x21be21]['id']});}});});});}});}})[_0x9b8a('0x37')](respondWithStatusCode(_0x5502ab,null))[_0x9b8a('0x2b')](handleError(_0x5502ab,null));};exports[_0x9b8a('0x122')]=function(_0x5a89a5,_0x30800e){return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x5a89a5[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x30800e,null))[_0x9b8a('0x37')](function(_0x2ccf95){if(_0x2ccf95){var _0xf177f4=_0x2ccf95[_0x9b8a('0x38')]({'plain':!![]});var _0x367cd0=_0x5a89a5[_0x9b8a('0x52')][_0x9b8a('0x70')];return _0x2ccf95[_0x9b8a('0x122')](_0x367cd0)[_0x9b8a('0x37')](function(){for(var _0x510043=0x0;_0x510043<_0x367cd0[_0x9b8a('0x58')];_0x510043++){var _0x570fb6=[];db[_0x9b8a('0x110')][_0x9b8a('0xa8')]({'where':{'id':_0x367cd0[_0x510043]}})[_0x9b8a('0x37')](function(_0x47c108){_0x570fb6[_0x9b8a('0x98')](_0x47c108[_0x9b8a('0xf0')]()[_0x9b8a('0x37')](function(_0x254755){for(var _0x351bc8=0x0;_0x351bc8<_0x254755[_0x9b8a('0x58')];_0x351bc8++){_0x254755[_0x351bc8][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x112'));}return _0x254755;}));_0x570fb6[_0x9b8a('0x98')](_0x47c108[_0x9b8a('0x113')]()['then'](function(_0x40f4cf){for(var _0x22fe37=0x0;_0x22fe37<_0x40f4cf['length'];_0x22fe37++){_0x40f4cf[_0x22fe37][_0x9b8a('0x116')]('channel',_0x9b8a('0x114'));}return _0x40f4cf;}));_0x570fb6['push'](_0x47c108[_0x9b8a('0x115')]()[_0x9b8a('0x37')](function(_0x37fdb7){for(var _0x87e8f8=0x0;_0x87e8f8<_0x37fdb7[_0x9b8a('0x58')];_0x87e8f8++){_0x37fdb7[_0x87e8f8][_0x9b8a('0x116')]('channel',_0x9b8a('0x117'));}return _0x37fdb7;}));_0x570fb6[_0x9b8a('0x98')](_0x47c108['getSmsQueues']()[_0x9b8a('0x37')](function(_0x2e5bcb){for(var _0x17ed98=0x0;_0x17ed98<_0x2e5bcb[_0x9b8a('0x58')];_0x17ed98++){_0x2e5bcb[_0x17ed98][_0x9b8a('0x116')](_0x9b8a('0xae'),'Sms');}return _0x2e5bcb;}));_0x570fb6[_0x9b8a('0x98')](_0x47c108[_0x9b8a('0x119')]()[_0x9b8a('0x37')](function(_0xc353b0){for(var _0x1e8d8e=0x0;_0x1e8d8e<_0xc353b0[_0x9b8a('0x58')];_0x1e8d8e++){_0xc353b0[_0x1e8d8e][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x11a'));}return _0xc353b0;}));_0x570fb6[_0x9b8a('0x98')](_0x47c108['getFaxQueues']()[_0x9b8a('0x37')](function(_0x2295b1){for(var _0x302dc7=0x0;_0x302dc7<_0x2295b1['length'];_0x302dc7++){_0x2295b1[_0x302dc7][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x123'));}return _0x2295b1;}));_0x570fb6['push'](_0x47c108[_0x9b8a('0x124')]()[_0x9b8a('0x37')](function(_0x3d14d6){for(var _0x297b6d=0x0;_0x297b6d<_0x3d14d6[_0x9b8a('0x58')];_0x297b6d++){_0x3d14d6[_0x297b6d][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x11c'));}return _0x3d14d6;}));return BPromise[_0x9b8a('0x99')](_0x570fb6);})[_0x9b8a('0x37')](function(_0x535ea1){var _0x143687=_[_0x9b8a('0x11d')](_0x535ea1);_0x570fb6=[];return db[_0x9b8a('0x62')][_0x9b8a('0x11e')](function(_0x1b7438){for(var _0xd084fa=0x0;_0xd084fa<_0x143687[_0x9b8a('0x58')];_0xd084fa++){_0x570fb6[_0x9b8a('0x98')](_0x143687[_0xd084fa][_0x9b8a('0x125')](_0xf177f4['id']),{'transaction':_0x1b7438});}return BPromise[_0x9b8a('0x99')](_0x570fb6)[_0x9b8a('0x37')](function(){if(_0xf177f4[_0x9b8a('0xaf')]){return BPromise['each'](_[_0x9b8a('0x41')](_0x143687,function(_0x2b7a9e){return _0x2b7a9e[_0x9b8a('0x120')](_0x9b8a('0xae'))==='Voice';}),function(_0x44679e){return db[_0x9b8a('0xc2')][_0x9b8a('0x47')]({'where':{'VoiceQueueId':_0x44679e['id'],'UserId':_0xf177f4['id']},'transaction':_0x1b7438});});}else{return;}})['then'](function(){for(var _0x4498bc=0x0;_0x4498bc<_0x143687[_0x9b8a('0x58')];_0x4498bc++){var _0x2636ef=_0x143687[_0x4498bc][_0x9b8a('0x120')]('channel');var _0x2018f5=_0x2636ef+_0x9b8a('0x121');socket[_0x9b8a('0xba')](_0x9b8a('0x3c')+_0x2636ef+_0x9b8a('0xc1'),{'UserId':_0xf177f4['id'],['queueField']:_0x143687[_0x4498bc]['id']});}});});});}});}})[_0x9b8a('0x37')](respondWithStatusCode(_0x30800e,null))['catch'](handleError(_0x30800e,null));};exports['getLists']=function(_0xef540f,_0x293cf8,_0x2efb77){var _0x5071ac={};var _0x132841={};var _0x197fdf;var _0x2447ec;return db[_0x9b8a('0x4b')]['findOne']({'where':{'id':_0xef540f['params']['id']}})['then'](handleEntityNotFound(_0x293cf8,null))[_0x9b8a('0x37')](function(_0x83f4d7){if(_0x83f4d7){_0x197fdf=_0x83f4d7;_0x132841['model']=_[_0x9b8a('0x53')](db[_0x9b8a('0xcf')][_0x9b8a('0x4c')]);_0x132841[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0xef540f[_0x9b8a('0x52')]);_0x132841[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x132841[_0x9b8a('0x4e')],_0x132841[_0x9b8a('0x52')]);_0x5071ac[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x132841[_0x9b8a('0x4e')],qs[_0x9b8a('0x57')](_0xef540f[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x5071ac[_0x9b8a('0x56')]=_0x5071ac[_0x9b8a('0x56')]['length']?_0x5071ac[_0x9b8a('0x56')]:_0x132841['model'];_0x5071ac[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0xef540f[_0x9b8a('0x52')]['sort']);_0x5071ac[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0xef540f[_0x9b8a('0x52')],_0x132841[_0x9b8a('0x54')]));if(_0xef540f[_0x9b8a('0x52')][_0x9b8a('0x41')]){_0x5071ac['where']=_['merge'](_0x5071ac[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x5071ac[_0x9b8a('0x56')],function(_0x540ba4){var _0x129fca={};_0x129fca[_0x540ba4]={'$like':'%'+_0xef540f['query']['filter']+'%'};return _0x129fca;})});}_0x5071ac=_['merge']({},_0x5071ac,_0xef540f[_0x9b8a('0x6c')]);return _0x197fdf[_0x9b8a('0x126')](_0x5071ac);}})[_0x9b8a('0x37')](function(_0x3fee41){if(_0x3fee41){_0x2447ec=_0x3fee41[_0x9b8a('0x58')];if(!_0xef540f[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x5071ac[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0xef540f[_0x9b8a('0x52')]['limit']);_0x5071ac[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0xef540f[_0x9b8a('0x52')]['offset']);}return _0x197fdf['getLists'](_0x5071ac);}})['then'](function(_0x5bedd0){if(_0x5bedd0){return _0x5bedd0?{'count':_0x2447ec,'rows':_0x5bedd0}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x293cf8,null))[_0x9b8a('0x2b')](handleError(_0x293cf8,null));};exports[_0x9b8a('0x127')]=function(_0x1138a7,_0x1bb448,_0x4a89e0){var _0x31fa72={};var _0x1f0a4f={};var _0x1cbb84;var _0x370b22;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x1138a7[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x1bb448,null))[_0x9b8a('0x37')](function(_0x5bca15){if(_0x5bca15){_0x1cbb84=_0x5bca15;_0x1f0a4f['model']=_[_0x9b8a('0x53')](db[_0x9b8a('0x4b')]['rawAttributes']);_0x1f0a4f['query']=_[_0x9b8a('0x53')](_0x1138a7[_0x9b8a('0x52')]);_0x1f0a4f['filters']=_[_0x9b8a('0x55')](_0x1f0a4f[_0x9b8a('0x4e')],_0x1f0a4f[_0x9b8a('0x52')]);_0x31fa72[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x1f0a4f[_0x9b8a('0x4e')],qs[_0x9b8a('0x57')](_0x1138a7[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x31fa72['attributes']=_0x31fa72[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0x31fa72[_0x9b8a('0x56')]:_0x1f0a4f[_0x9b8a('0x4e')];_0x31fa72[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x1138a7[_0x9b8a('0x52')][_0x9b8a('0x5c')]);_0x31fa72['where']=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x1138a7[_0x9b8a('0x52')],_0x1f0a4f[_0x9b8a('0x54')]));if(_0x1138a7['query']['filter']){_0x31fa72[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x31fa72['where'],{'$or':_[_0x9b8a('0x4a')](_0x31fa72[_0x9b8a('0x56')],function(_0x18c184){var _0x293ed3={};_0x293ed3[_0x18c184]={'$like':'%'+_0x1138a7[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x293ed3;})});}_0x31fa72[_0x9b8a('0x4e')]=db[_0x9b8a('0x4b')];_0x31fa72['as']=_0x9b8a('0x3d');_0x31fa72=_[_0x9b8a('0x5f')]({},_0x31fa72,_0x1138a7[_0x9b8a('0x6c')]);return _0x1cbb84[_0x9b8a('0xf0')]({'include':[_0x31fa72]});}})[_0x9b8a('0x37')](function(_0x335086){if(_0x335086){var _0x1015b7={},_0xa1768e=[],_0x6e9fc5=0x0;for(var _0xa66df6=0x0;_0xa66df6<_0x335086[_0x9b8a('0x58')];_0xa66df6+=0x1){for(var _0xbbbc59=0x0,_0x4c7c22;_0xbbbc59<_0x335086[_0xa66df6][_0x9b8a('0x3d')][_0x9b8a('0x58')];_0xbbbc59+=0x1){_0x4c7c22=_0x335086[_0xa66df6]['Agents'][_0xbbbc59][_0x9b8a('0x38')]({'plain':!![]});_0x1015b7[_0x4c7c22['id']]=_0x4c7c22;}}_0x1015b7=_[_0x9b8a('0x128')](_0x1015b7);for(var _0x4e8131=qs[_0x9b8a('0x2f')](_0x1138a7['query'][_0x9b8a('0x2f')]);_0x4e8131<_0x1015b7['length']&&_0xa1768e[_0x9b8a('0x58')]=_0x283324[_0x6f5b('0x53')]){throw new Error(_0x6f5b('0x54'));}})['then'](function(){if(_0x1a8b78){return db[_0x6f5b('0x29')][_0x6f5b('0x55')]({'where':{'membername':_0x1a8b78[_0x6f5b('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x1a8b78){return _0x1a8b78['getVoiceQueues']({'raw':!![]});}})[_0x6f5b('0xe')](function(_0x569eb7){if(_0x1a8b78){if(_0x569eb7){var _0x3ef319=[];_0x5506be=_0x569eb7;if(_0x5506be[_0x6f5b('0x2c')]){for(var _0x290f51=0x0;_0x290f51<_0x5506be[_0x6f5b('0x2c')];_0x290f51++){_0x3ef319[_0x6f5b('0x48')](db[_0x6f5b('0x29')][_0x6f5b('0x56')]({'membername':_0x1a8b78['name'],'UserId':_0x1a8b78['id'],'queue_name':_0x5506be[_0x290f51]['name'],'VoiceQueueId':_0x5506be[_0x290f51]['id'],'interface':_0xf7ef6f,'paused':_0x1a8b78[_0x6f5b('0x4e')]||![],'penalty':_0x5506be[_0x290f51]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x6f5b('0x4a')](_0x3ef319);}}}})[_0x6f5b('0xe')](function(){if(_0x1a8b78){return db[_0x6f5b('0x37')]['findAll']({'where':{'membername':_0x1a8b78[_0x6f5b('0x27')],'exitAt':null}});}})['then'](function(_0x20be06){if(_0x1a8b78){if(_0x20be06&&_0x20be06[_0x6f5b('0x2c')]){var _0x2926e5=[];_0x20be06[_0x6f5b('0x31')](function(_0x242cdf){_0x2926e5[_0x6f5b('0x48')](_0x242cdf['update']({'exitAt':moment()[_0x6f5b('0x2d')](_0x6f5b('0x2e'))}));});return BPromise[_0x6f5b('0x4a')](_0x2926e5);}}})[_0x6f5b('0xe')](function(_0x290131){if(_0x1a8b78){var _0x3df41b=[];var _0x1bd62c=[];var _0xd0a290=utils['getChannels']();var _0xf25b46={'membername':_0x1a8b78[_0x6f5b('0x27')],'interface':_0xf7ef6f,'enterAt':moment()[_0x6f5b('0x2d')](_0x6f5b('0x2e')),'role':_0x1a8b78[_0x6f5b('0x28')],'internal':_0x1a8b78['internal']};_0xd0a290[_0x6f5b('0x31')](function(_0x6d9e42){_0x3df41b['push'](_['merge']({'channel':_0x6d9e42,'type':'LOGIN','data1':_0x6f5b('0x57'),'data2':_0xf7ef6f},_0xf25b46));if(_0x1a8b78[_0x6f5b('0x4e')]){_0x1bd62c[_0x6f5b('0x48')](_[_0x6f5b('0x58')]({'channel':_0x6d9e42,'type':_0x6f5b('0x2b'),'data1':_0x6f5b('0x59')},_0xf25b46));}});return db[_0x6f5b('0x37')][_0x6f5b('0x38')](_0x3df41b[_0x6f5b('0x5a')](_0x1bd62c),{'individualHooks':!![]});}})['then'](function(){if(_0x1a8b78){return _0x1a8b78[_0x6f5b('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x6f5b('0x2d')](_0x6f5b('0x2e')),'voicePause':_0x1a8b78[_0x6f5b('0x4e')]||![],'mailPause':_0x1a8b78[_0x6f5b('0x4e')]||![],'chatPause':_0x1a8b78[_0x6f5b('0x4e')]||![],'faxPause':_0x1a8b78['loginInPause']||![],'smsPause':_0x1a8b78[_0x6f5b('0x4e')]||![],'openchannelPause':_0x1a8b78[_0x6f5b('0x4e')]||![],'pauseType':_0x1a8b78['loginInPause']?_0x6f5b('0x59'):null,'lastPauseAt':moment()[_0x6f5b('0x2d')](_0x6f5b('0x2e')),'interface':_0xf7ef6f});}})[_0x6f5b('0xe')](function(_0x4089d7){_0x2ec16f(_0x4089d7);})['catch'](function(_0xbc0c11){_0x18bd05(_0x237c3a[_0x6f5b('0x13')](0x1f4,_0xbc0c11[_0x6f5b('0x15')]));});});}; \ No newline at end of file +var _0xb982=['result','findAll','options','raw','attributes','limit','include','map','model','GetUser','ShowUser','User','find','where','catch','PauseUser','name','role','internal','interface','UserVoiceQueueRt','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','update','type','isValidChannel','channel','Unknown\x20channel','voice','system','mail','chat','openchannel','whatsapp','set','%s%s','all','LogoutUser','findOne','destroy','mobile','phone','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','forEach','merge','LOGIN','LOGININPAUSE','concat','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','then','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x171285,_0x51a294){var _0x458e6b=function(_0x2c1e2e){while(--_0x2c1e2e){_0x171285['push'](_0x171285['shift']());}};_0x458e6b(++_0x51a294);}(_0xb982,0x15e));var _0x2b98=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb982[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2b98('0x0'));var BPromise=require(_0x2b98('0x1'));var rs=require(_0x2b98('0x2'));var fs=require('fs');var Redis=require(_0x2b98('0x3'));var db=require(_0x2b98('0x4'))['db'];var utils=require(_0x2b98('0x5'));var logger=require(_0x2b98('0x6'))(_0x2b98('0x7'));var config=require(_0x2b98('0x8'));var jayson=require(_0x2b98('0x9'));var client=jayson['client'][_0x2b98('0xa')]({'port':0x232a});config[_0x2b98('0xb')]=_[_0x2b98('0xc')](config[_0x2b98('0xb')],{'host':_0x2b98('0xd'),'port':0x18eb});var socket=require(_0x2b98('0xe'))(new Redis(config['redis']));require(_0x2b98('0xf'))[_0x2b98('0x10')](socket);function respondWithRpcPromise(_0x4c5377,_0x8e30c5,_0x51ad2e){return new BPromise(function(_0x3f8ef6,_0x17d985){return client[_0x2b98('0x11')](_0x4c5377,_0x51ad2e)[_0x2b98('0x12')](function(_0xbb4274){logger['info'](_0x2b98('0x13'),_0x8e30c5,'request\x20sent');logger[_0x2b98('0x14')](_0x2b98('0x15'),_0x8e30c5,_0x2b98('0x16'),JSON[_0x2b98('0x17')](_0xbb4274));if(_0xbb4274[_0x2b98('0x18')]){if(_0xbb4274[_0x2b98('0x18')]['code']===0x1f4){logger[_0x2b98('0x18')](_0x2b98('0x13'),_0x8e30c5,_0xbb4274[_0x2b98('0x18')][_0x2b98('0x19')]);return _0x17d985(_0xbb4274[_0x2b98('0x18')][_0x2b98('0x19')]);}logger[_0x2b98('0x18')]('User,\x20%s,\x20%s',_0x8e30c5,_0xbb4274[_0x2b98('0x18')][_0x2b98('0x19')]);return _0x3f8ef6(_0xbb4274['error'][_0x2b98('0x19')]);}else{logger['info'](_0x2b98('0x13'),_0x8e30c5,_0x2b98('0x16'));_0x3f8ef6(_0xbb4274[_0x2b98('0x1a')]['message']);}})['catch'](function(_0x5d5cb1){logger[_0x2b98('0x18')](_0x2b98('0x13'),_0x8e30c5,_0x5d5cb1);_0x17d985(_0x5d5cb1);});});}exports['GetUser']=function(_0x5c293d){var _0x1e92e4=this;return new Promise(function(_0x15c747,_0x41c7de){return db['User'][_0x2b98('0x1b')]({'raw':_0x5c293d[_0x2b98('0x1c')]?_0x5c293d[_0x2b98('0x1c')][_0x2b98('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c293d[_0x2b98('0x1c')]?_0x5c293d[_0x2b98('0x1c')]['where']||null:null,'attributes':_0x5c293d['options']?_0x5c293d[_0x2b98('0x1c')][_0x2b98('0x1e')]||null:null,'limit':_0x5c293d[_0x2b98('0x1c')]?_0x5c293d[_0x2b98('0x1c')][_0x2b98('0x1f')]||null:null,'include':_0x5c293d[_0x2b98('0x1c')]?_0x5c293d[_0x2b98('0x1c')][_0x2b98('0x20')]?_[_0x2b98('0x21')](_0x5c293d[_0x2b98('0x1c')][_0x2b98('0x20')],function(_0x112d71){return{'model':db[_0x112d71[_0x2b98('0x22')]],'as':_0x112d71['as'],'attributes':_0x112d71['attributes'],'include':_0x112d71[_0x2b98('0x20')]?_['map'](_0x112d71['include'],function(_0x27811d){return{'model':db[_0x27811d['model']],'as':_0x27811d['as'],'attributes':_0x27811d[_0x2b98('0x1e')],'include':_0x27811d[_0x2b98('0x20')]?_[_0x2b98('0x21')](_0x27811d['include'],function(_0x5467a4){return{'model':db[_0x5467a4[_0x2b98('0x22')]],'as':_0x5467a4['as'],'attributes':_0x5467a4[_0x2b98('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2b98('0x12')](function(_0x8cf049){logger['info']('GetUser',_0x5c293d);logger[_0x2b98('0x14')]('GetUser',_0x5c293d,JSON[_0x2b98('0x17')](_0x8cf049));_0x15c747(_0x8cf049);})['catch'](function(_0x53be37){logger[_0x2b98('0x18')](_0x2b98('0x23'),_0x53be37[_0x2b98('0x19')],_0x5c293d);_0x41c7de(_0x1e92e4[_0x2b98('0x18')](0x1f4,_0x53be37['message']));});});};exports[_0x2b98('0x24')]=function(_0x6c3dec){var _0x2de1a6=this;return new Promise(function(_0x3c349a,_0x42bb4c){return db[_0x2b98('0x25')][_0x2b98('0x26')]({'raw':_0x6c3dec[_0x2b98('0x1c')]?_0x6c3dec[_0x2b98('0x1c')][_0x2b98('0x1d')]===undefined?!![]:![]:!![],'where':_0x6c3dec[_0x2b98('0x1c')]?_0x6c3dec['options'][_0x2b98('0x27')]||null:null,'attributes':_0x6c3dec['options']?_0x6c3dec[_0x2b98('0x1c')][_0x2b98('0x1e')]||null:null,'include':_0x6c3dec[_0x2b98('0x1c')]?_0x6c3dec[_0x2b98('0x1c')][_0x2b98('0x20')]?_[_0x2b98('0x21')](_0x6c3dec['options'][_0x2b98('0x20')],function(_0x5bc473){return{'model':db[_0x5bc473[_0x2b98('0x22')]],'as':_0x5bc473['as'],'attributes':_0x5bc473[_0x2b98('0x1e')],'include':_0x5bc473[_0x2b98('0x20')]?_[_0x2b98('0x21')](_0x5bc473[_0x2b98('0x20')],function(_0x3b4023){return{'model':db[_0x3b4023[_0x2b98('0x22')]],'as':_0x3b4023['as'],'attributes':_0x3b4023[_0x2b98('0x1e')],'include':_0x3b4023['include']?_['map'](_0x3b4023[_0x2b98('0x20')],function(_0x4339b5){return{'model':db[_0x4339b5[_0x2b98('0x22')]],'as':_0x4339b5['as'],'attributes':_0x4339b5[_0x2b98('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2b98('0x12')](function(_0x278b2f){logger['info'](_0x2b98('0x24'),_0x6c3dec);logger[_0x2b98('0x14')](_0x2b98('0x24'),_0x6c3dec,JSON[_0x2b98('0x17')](_0x278b2f));_0x3c349a(_0x278b2f);})[_0x2b98('0x28')](function(_0x4c26d6){logger[_0x2b98('0x18')](_0x2b98('0x24'),_0x4c26d6[_0x2b98('0x19')],_0x6c3dec);_0x42bb4c(_0x2de1a6['error'](0x1f4,_0x4c26d6[_0x2b98('0x19')]));});});};exports[_0x2b98('0x29')]=function(_0x44857a){var _0x4366f3=this;return new Promise(function(_0x54e3d1,_0x92a92d){var _0x4e9cc3;return db[_0x2b98('0x25')][_0x2b98('0x26')]({'where':_0x44857a['options']['where']||{},'attributes':['id',_0x2b98('0x2a'),_0x2b98('0x2b'),_0x2b98('0x2c'),_0x2b98('0x2d')]})[_0x2b98('0x12')](function(_0x1c7e8c){if(_0x1c7e8c){_0x4e9cc3=_0x1c7e8c;return db[_0x2b98('0x2e')]['update']({'paused':0x1},{'where':{'UserId':_0x4e9cc3['id']},'individualHooks':!![]});}})[_0x2b98('0x12')](function(){if(_0x4e9cc3){return db[_0x2b98('0x2f')]['findAll']({'where':{'membername':_0x4e9cc3['name'],'type':_0x2b98('0x30'),'exitAt':null}});}})[_0x2b98('0x12')](function(_0x560edb){if(_0x4e9cc3){if(_0x560edb&&_0x560edb[_0x2b98('0x31')]){var _0x1ae7e7=moment()[_0x2b98('0x32')](_0x2b98('0x33'));for(var _0x4e14a7=0x0,_0x1c77da=_0x560edb[_0x2b98('0x31')];_0x4e14a7<_0x1c77da;_0x4e14a7++){_0x560edb[_0x4e14a7][_0x2b98('0x34')]({'exitAt':_0x1ae7e7});}}}})[_0x2b98('0x12')](function(){if(_0x4e9cc3){var _0x1000f9=[];var _0x3408e3=utils[_0x2b98('0x35')]();_0x3408e3['forEach'](function(_0x3766ef){_0x1000f9[_0x2b98('0x36')]({'channel':_0x3766ef,'membername':_0x4e9cc3['name'],'interface':_[_0x2b98('0x37')](_0x4e9cc3[_0x2b98('0x2d')])?util['format'](_0x2b98('0x38'),_0x4e9cc3['name']):_0x4e9cc3['interface'],'type':_0x2b98('0x30'),'enterAt':moment()[_0x2b98('0x32')](_0x2b98('0x33')),'data1':_0x44857a[_0x2b98('0x39')]['type']||_0x2b98('0x3a'),'role':_0x4e9cc3['role'],'internal':_0x4e9cc3[_0x2b98('0x2c')],'uniqueid':_0x44857a[_0x2b98('0x39')][_0x2b98('0x3b')]||null});});return db[_0x2b98('0x2f')][_0x2b98('0x3c')](_0x1000f9,{'individualHooks':!![]});}})[_0x2b98('0x12')](function(){if(_0x4e9cc3){return _0x4e9cc3[_0x2b98('0x3d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x44857a[_0x2b98('0x39')][_0x2b98('0x3e')]||_0x2b98('0x3a'),'lastPauseAt':moment()[_0x2b98('0x32')](_0x2b98('0x33'))});}})[_0x2b98('0x12')](function(_0x4f6628){_0x54e3d1(_0x4f6628);})['catch'](function(_0x40b095){_0x92a92d(_0x4366f3[_0x2b98('0x18')](0x1f4,_0x40b095[_0x2b98('0x19')]));});});};exports['UnpauseUser']=function(_0x3502ab){var _0x9496f6=this;return new Promise(function(_0x976e57,_0x3228f2){var _0x24a997;return db[_0x2b98('0x25')]['findOne']({'where':_0x3502ab['options'][_0x2b98('0x27')]||{},'attributes':['id',_0x2b98('0x2a')]})[_0x2b98('0x12')](function(_0x12dc53){if(_0x12dc53){_0x24a997=_0x12dc53;if(_0x3502ab[_0x2b98('0x39')]['channel']&&!utils[_0x2b98('0x3f')](_0x3502ab[_0x2b98('0x39')][_0x2b98('0x40')])){throw new Error(_0x2b98('0x41'));}switch(_0x3502ab[_0x2b98('0x39')][_0x2b98('0x40')]){case _0x2b98('0x42'):return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x24a997['id']}})[_0x2b98('0x12')](function(){return db['MemberReport'][_0x2b98('0x26')]({'where':{'channel':_0x3502ab['body']['channel'],'membername':_0x24a997['name'],'type':'PAUSE','exitAt':null}});})[_0x2b98('0x12')](function(_0x460b67){if(_0x460b67){return _0x460b67[_0x2b98('0x3d')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2b98('0x43')},{'individualHooks':!![]});}return null;})[_0x2b98('0x12')](function(){return _0x24a997[_0x2b98('0x3d')]({'voicePause':![]});});case _0x2b98('0x44'):case _0x2b98('0x45'):case'fax':case'sms':case _0x2b98('0x46'):case _0x2b98('0x47'):return db['MemberReport'][_0x2b98('0x26')]({'where':{'channel':_0x3502ab[_0x2b98('0x39')][_0x2b98('0x40')],'membername':_0x24a997[_0x2b98('0x2a')],'type':'PAUSE','exitAt':null}})[_0x2b98('0x12')](function(_0x120846){return _0x120846[_0x2b98('0x3d')]({'exitAt':moment()[_0x2b98('0x32')](_0x2b98('0x33')),'data2':'system'},{'individualHooks':!![]});})[_0x2b98('0x12')](function(){var _0x1ede5f={};_[_0x2b98('0x48')](_0x1ede5f,util['format'](_0x2b98('0x49'),_0x3502ab[_0x2b98('0x39')]['channel'],'Pause'),![]);return _0x24a997[_0x2b98('0x3d')](_0x1ede5f);});default:return db['UserVoiceQueueRt'][_0x2b98('0x3d')]({'paused':0x0},{'where':{'UserId':_0x24a997['id']}})[_0x2b98('0x12')](function(){return db['MemberReport'][_0x2b98('0x1b')]({'where':{'membername':_0x24a997[_0x2b98('0x2a')],'type':_0x2b98('0x30'),'exitAt':null}});})[_0x2b98('0x12')](function(_0x5a6f62){var _0x4dee4f=[];_0x5a6f62['forEach'](function(_0x46d2ba){_0x4dee4f['push'](_0x46d2ba[_0x2b98('0x3d')]({'exitAt':moment()['format'](_0x2b98('0x33')),'data2':_0x2b98('0x43')}));});return BPromise[_0x2b98('0x4a')](_0x4dee4f);})[_0x2b98('0x12')](function(){return _0x24a997[_0x2b98('0x3d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x2b98('0x12')](function(_0x5b06d0){_0x976e57(_0x5b06d0);})[_0x2b98('0x28')](function(_0x3f72ed){_0x3228f2(_0x9496f6[_0x2b98('0x18')](0x1f4,_0x3f72ed[_0x2b98('0x19')]));});});};exports[_0x2b98('0x4b')]=function(_0x236a4d){var _0x5d9e8f=this;return new Promise(function(_0x31319d,_0x456917){var _0x147b72;return db['User'][_0x2b98('0x4c')]({'where':_0x236a4d['options'][_0x2b98('0x27')]||{},'attributes':['id','name']})['then'](function(_0x36624c){if(_0x36624c){_0x147b72=_0x36624c;return db[_0x2b98('0x2e')][_0x2b98('0x4d')]({'where':{'membername':_0x147b72[_0x2b98('0x2a')]},'individualHooks':!![]});}})[_0x2b98('0x12')](function(){if(_0x147b72){return db[_0x2b98('0x2f')][_0x2b98('0x1b')]({'where':{'membername':_0x147b72['name'],'exitAt':null}});}})[_0x2b98('0x12')](function(_0x105ede){if(_0x147b72){if(_0x105ede&&_0x105ede[_0x2b98('0x31')]){var _0x414fb4=[];_0x105ede['forEach'](function(_0x52f7ce){_0x414fb4[_0x2b98('0x36')](_0x52f7ce[_0x2b98('0x3d')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2b98('0x4a')](_0x414fb4);}}})[_0x2b98('0x12')](function(){if(_0x147b72){return _0x147b72[_0x2b98('0x3d')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x2b98('0x12')](function(_0x1e072e){_0x31319d(_0x1e072e);})[_0x2b98('0x28')](function(_0x3ea623){_0x456917(_0x5d9e8f[_0x2b98('0x18')](0x1f4,_0x3ea623[_0x2b98('0x19')]));});});};exports['LoginUser']=function(_0x166ff1){var _0x48532d=this;return new Promise(function(_0x238dab,_0x97e33f){var _0xc59ac9;var _0x30f140;var _0x5461a8;var _0x55b229;return db[_0x2b98('0x25')][_0x2b98('0x4c')]({'where':_0x166ff1[_0x2b98('0x1c')][_0x2b98('0x27')]||{},'attributes':['id',_0x2b98('0x2a'),'role',_0x2b98('0x4e'),_0x2b98('0x4f'),_0x2b98('0x2c'),'loginInPause','interface']})['then'](function(_0x4b49b1){if(_0x4b49b1){_0xc59ac9=_0x4b49b1;_0x55b229=_0x166ff1['body']['interface']?_0x166ff1[_0x2b98('0x39')]['interface']:util[_0x2b98('0x32')](_0x2b98('0x38'),_0xc59ac9[_0x2b98('0x2a')]);return db[_0x2b98('0x25')][_0x2b98('0x50')]({'where':{'role':_0x2b98('0x51'),'online':!![],'id':{'$ne':_0xc59ac9['id']}}});}})['then'](function(_0x55fe32){if(_0x55fe32){_0x5461a8=_0x55fe32;return require(_0x2b98('0x52'))[_0x2b98('0x53')]();}})[_0x2b98('0x12')](function(_0x1d4d6f){if(_0x1d4d6f&&_0x1d4d6f[_0x2b98('0x54')]&&_0x5461a8>=_0x1d4d6f[_0x2b98('0x54')]){throw new Error(_0x2b98('0x55'));}})['then'](function(){if(_0xc59ac9){return db[_0x2b98('0x2e')][_0x2b98('0x4d')]({'where':{'membername':_0xc59ac9[_0x2b98('0x2a')]},'individualHooks':!![]});}})[_0x2b98('0x12')](function(){if(_0xc59ac9){return _0xc59ac9[_0x2b98('0x56')]({'raw':!![]});}})[_0x2b98('0x12')](function(_0x247dc3){if(_0xc59ac9){if(_0x247dc3){var _0x17ba8f=[];_0x30f140=_0x247dc3;if(_0x30f140[_0x2b98('0x31')]){for(var _0x3b83ca=0x0;_0x3b83ca<_0x30f140[_0x2b98('0x31')];_0x3b83ca++){_0x17ba8f['push'](db[_0x2b98('0x2e')][_0x2b98('0x57')]({'membername':_0xc59ac9[_0x2b98('0x2a')],'UserId':_0xc59ac9['id'],'queue_name':_0x30f140[_0x3b83ca][_0x2b98('0x2a')],'VoiceQueueId':_0x30f140[_0x3b83ca]['id'],'interface':_0x55b229,'paused':_0xc59ac9[_0x2b98('0x58')]||![],'penalty':_0x30f140[_0x3b83ca]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x2b98('0x4a')](_0x17ba8f);}}}})[_0x2b98('0x12')](function(){if(_0xc59ac9){return db[_0x2b98('0x2f')][_0x2b98('0x1b')]({'where':{'membername':_0xc59ac9[_0x2b98('0x2a')],'exitAt':null}});}})[_0x2b98('0x12')](function(_0x29dd3d){if(_0xc59ac9){if(_0x29dd3d&&_0x29dd3d['length']){var _0x1a33cf=[];_0x29dd3d[_0x2b98('0x59')](function(_0x12ed0b){_0x1a33cf['push'](_0x12ed0b[_0x2b98('0x3d')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x1a33cf);}}})[_0x2b98('0x12')](function(_0x31bf06){if(_0xc59ac9){var _0x3499d6=[];var _0x2cea79=[];var _0x4af093=utils['getChannels']();var _0x3f1ab7={'membername':_0xc59ac9[_0x2b98('0x2a')],'interface':_0x55b229,'enterAt':moment()[_0x2b98('0x32')](_0x2b98('0x33')),'role':_0xc59ac9[_0x2b98('0x2b')],'internal':_0xc59ac9[_0x2b98('0x2c')]};_0x4af093[_0x2b98('0x59')](function(_0x1c4543){_0x3499d6[_0x2b98('0x36')](_[_0x2b98('0x5a')]({'channel':_0x1c4543,'type':_0x2b98('0x5b'),'data1':'callysquare','data2':_0x55b229},_0x3f1ab7));if(_0xc59ac9['loginInPause']){_0x2cea79['push'](_[_0x2b98('0x5a')]({'channel':_0x1c4543,'type':'PAUSE','data1':_0x2b98('0x5c')},_0x3f1ab7));}});return db[_0x2b98('0x2f')]['bulkCreate'](_0x3499d6[_0x2b98('0x5d')](_0x2cea79),{'individualHooks':!![]});}})[_0x2b98('0x12')](function(){if(_0xc59ac9){return _0xc59ac9[_0x2b98('0x3d')]({'online':!![],'lastLoginAt':moment()[_0x2b98('0x32')](_0x2b98('0x33')),'voicePause':_0xc59ac9[_0x2b98('0x58')]||![],'mailPause':_0xc59ac9[_0x2b98('0x58')]||![],'chatPause':_0xc59ac9['loginInPause']||![],'faxPause':_0xc59ac9['loginInPause']||![],'smsPause':_0xc59ac9[_0x2b98('0x58')]||![],'openchannelPause':_0xc59ac9[_0x2b98('0x58')]||![],'pauseType':_0xc59ac9[_0x2b98('0x58')]?_0x2b98('0x5c'):null,'lastPauseAt':moment()[_0x2b98('0x32')](_0x2b98('0x33')),'interface':_0x55b229});}})[_0x2b98('0x12')](function(_0x24a572){_0x238dab(_0x24a572);})['catch'](function(_0x3481da){_0x97e33f(_0x48532d[_0x2b98('0x18')](0x1f4,_0x3481da['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 23c4a5b..7955a1b 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 _0xcd78=['save','remove','emit','removeListener','register','./user.events'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xcd78,0x77));var _0x8cd7=function(_0x4d778f,_0x1d4a49){_0x4d778f=_0x4d778f-0x0;var _0x100d48=_0xcd78[_0x4d778f];return _0x100d48;};'use strict';var UserEvents=require(_0x8cd7('0x0'));var events=[_0x8cd7('0x1'),_0x8cd7('0x2'),'update'];function createListener(_0x1d7669,_0x46fc35){return function(_0x18ecdc){_0x46fc35[_0x8cd7('0x3')](_0x1d7669,_0x18ecdc);};}function removeListener(_0x1e3a8d,_0x5a16c1){return function(){UserEvents[_0x8cd7('0x4')](_0x1e3a8d,_0x5a16c1);};}exports[_0x8cd7('0x5')]=function(_0x5a33cc){for(var _0x5e1d3f=0x0,_0x4dd446=events['length'];_0x5e1d3f<_0x4dd446;_0x5e1d3f++){var _0x2de643=events[_0x5e1d3f];var _0x1df02a=createListener('user:'+_0x2de643,_0x5a33cc);UserEvents['on'](_0x2de643,_0x1df02a);}}; \ No newline at end of file +var _0xc251=['length','user:','./user.events','save','remove','removeListener','register'];(function(_0xd7a53e,_0x10a35a){var _0x18810e=function(_0x69b148){while(--_0x69b148){_0xd7a53e['push'](_0xd7a53e['shift']());}};_0x18810e(++_0x10a35a);}(_0xc251,0x128));var _0x1c25=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xc251[_0x17406a];return _0x1501ff;};'use strict';var UserEvents=require(_0x1c25('0x0'));var events=[_0x1c25('0x1'),_0x1c25('0x2'),'update'];function createListener(_0x573fb1,_0x67d930){return function(_0x12917d){_0x67d930['emit'](_0x573fb1,_0x12917d);};}function removeListener(_0x2bd709,_0x2a0524){return function(){UserEvents[_0x1c25('0x3')](_0x2bd709,_0x2a0524);};}exports[_0x1c25('0x4')]=function(_0x68dd0e){for(var _0x1db3f8=0x0,_0x515340=events[_0x1c25('0x5')];_0x1db3f8<_0x515340;_0x1db3f8++){var _0x1fd9d0=events[_0x1db3f8];var _0x339659=createListener(_0x1c25('0x6')+_0x1fd9d0,_0x68dd0e);UserEvents['on'](_0x1fd9d0,_0x339659);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f90a8f9..528ebc6 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 _0xfb32=['exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x42efbb,_0xa2eaef){var _0x5d3d47=function(_0x5e9bd8){while(--_0x5e9bd8){_0x42efbb['push'](_0x42efbb['shift']());}};_0x5d3d47(++_0xa2eaef);}(_0xfb32,0x133));var _0x2fb3=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xfb32[_0x35b18a];return _0x4db1bd;};'use strict';var multer=require(_0x2fb3('0x0'));var util=require(_0x2fb3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2fb3('0x2'));var interaction=require(_0x2fb3('0x3'));var config=require(_0x2fb3('0x4'));module[_0x2fb3('0x5')]=router; \ No newline at end of file +var _0xa1e5=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','multer','util','path'];(function(_0x257924,_0x5c6f3c){var _0x1a530b=function(_0x3c6f32){while(--_0x3c6f32){_0x257924['push'](_0x257924['shift']());}};_0x1a530b(++_0x5c6f3c);}(_0xa1e5,0x135));var _0x5a1e=function(_0x448509,_0x47ed60){_0x448509=_0x448509-0x0;var _0x12311b=_0xa1e5[_0x448509];return _0x12311b;};'use strict';var multer=require(_0x5a1e('0x0'));var util=require(_0x5a1e('0x1'));var path=require(_0x5a1e('0x2'));var timeout=require(_0x5a1e('0x3'));var express=require(_0x5a1e('0x4'));var router=express[_0x5a1e('0x5')]();var auth=require(_0x5a1e('0x6'));var interaction=require(_0x5a1e('0x7'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 3d82505..f6e7592 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x40f7d9,_0x2a9053){var _0x4c4326=function(_0x3d7014){while(--_0x3d7014){_0x40f7d9['push'](_0x40f7d9['shift']());}};_0x4c4326(++_0x2a9053);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index d611644..18ffcf5 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 _0x2551=['api','request-promise','rimraf','define','UserChatQueue','user_has_chat_queues','lodash','util'];(function(_0x39f7eb,_0x2d3e4f){var _0x33ede0=function(_0x428414){while(--_0x428414){_0x39f7eb['push'](_0x39f7eb['shift']());}};_0x33ede0(++_0x2d3e4f);}(_0x2551,0x1c6));var _0x1255=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x2551[_0x4d21ff];return _0x22b554;};'use strict';var _=require(_0x1255('0x0'));var util=require(_0x1255('0x1'));var logger=require('../../config/logger')(_0x1255('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1255('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1255('0x4'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x3e5a49,_0x6af3f7){return _0x3e5a49[_0x1255('0x5')](_0x1255('0x6'),attributes,{'tableName':_0x1255('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a15=['request-promise','path','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','util','../../config/logger','moment','bluebird'];(function(_0x13d6d7,_0x298462){var _0x4de1cc=function(_0x15f754){while(--_0x15f754){_0x13d6d7['push'](_0x13d6d7['shift']());}};_0x4de1cc(++_0x298462);}(_0x1a15,0x103));var _0x51a1=function(_0x4fec16,_0x306138){_0x4fec16=_0x4fec16-0x0;var _0x19cb59=_0x1a15[_0x4fec16];return _0x19cb59;};'use strict';var _=require(_0x51a1('0x0'));var util=require(_0x51a1('0x1'));var logger=require(_0x51a1('0x2'))('api');var moment=require(_0x51a1('0x3'));var BPromise=require(_0x51a1('0x4'));var rp=require(_0x51a1('0x5'));var fs=require('fs');var path=require(_0x51a1('0x6'));var rimraf=require(_0x51a1('0x7'));var config=require('../../config/environment');var attributes=require(_0x51a1('0x8'));module[_0x51a1('0x9')]=function(_0x37d1e6,_0x4d8db0){return _0x37d1e6[_0x51a1('0xa')](_0x51a1('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 260a7e4..de34e82 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 _0xf8f6=['jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0x49f8c2,_0x5166b7){var _0x3e63ec=function(_0x575c26){while(--_0x575c26){_0x49f8c2['push'](_0x49f8c2['shift']());}};_0x3e63ec(++_0x5166b7);}(_0xf8f6,0x120));var _0x6f8f=function(_0x3ce233,_0x58abd8){_0x3ce233=_0x3ce233-0x0;var _0x48c0cc=_0xf8f6[_0x3ce233];return _0x48c0cc;};'use strict';var _=require(_0x6f8f('0x0'));var util=require(_0x6f8f('0x1'));var moment=require('moment');var BPromise=require(_0x6f8f('0x2'));var rs=require(_0x6f8f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6f8f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f8f('0x5'));var jayson=require(_0x6f8f('0x6'));var client=jayson[_0x6f8f('0x7')][_0x6f8f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35fc64,_0xdc6377,_0x53ec28){return new BPromise(function(_0x3a1967,_0x3915e6){return client[_0x6f8f('0x9')](_0x35fc64,_0x53ec28)[_0x6f8f('0xa')](function(_0x1f0ce9){logger[_0x6f8f('0xb')](_0x6f8f('0xc'),_0xdc6377,_0x6f8f('0xd'));logger[_0x6f8f('0xe')](_0x6f8f('0xf'),_0xdc6377,_0x6f8f('0xd'),JSON['stringify'](_0x1f0ce9));if(_0x1f0ce9[_0x6f8f('0x10')]){if(_0x1f0ce9['error'][_0x6f8f('0x11')]===0x1f4){logger[_0x6f8f('0x10')](_0x6f8f('0xc'),_0xdc6377,_0x1f0ce9['error'][_0x6f8f('0x12')]);return _0x3915e6(_0x1f0ce9['error'][_0x6f8f('0x12')]);}logger[_0x6f8f('0x10')](_0x6f8f('0xc'),_0xdc6377,_0x1f0ce9[_0x6f8f('0x10')][_0x6f8f('0x12')]);return _0x3a1967(_0x1f0ce9[_0x6f8f('0x10')][_0x6f8f('0x12')]);}else{logger[_0x6f8f('0xb')](_0x6f8f('0xc'),_0xdc6377,'request\x20sent');_0x3a1967(_0x1f0ce9[_0x6f8f('0x13')]['message']);}})[_0x6f8f('0x14')](function(_0x17cdc4){logger[_0x6f8f('0x10')](_0x6f8f('0xc'),_0xdc6377,_0x17cdc4);_0x3915e6(_0x17cdc4);});});} \ No newline at end of file +var _0xa494=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x1a52bc,_0x49fe85){var _0x2f2109=function(_0x2c5619){while(--_0x2c5619){_0x1a52bc['push'](_0x1a52bc['shift']());}};_0x2f2109(++_0x49fe85);}(_0xa494,0x1ca));var _0x4a49=function(_0x30c106,_0x4eafa9){_0x30c106=_0x30c106-0x0;var _0xfbcc47=_0xa494[_0x30c106];return _0xfbcc47;};'use strict';var _=require('lodash');var util=require(_0x4a49('0x0'));var moment=require(_0x4a49('0x1'));var BPromise=require(_0x4a49('0x2'));var rs=require(_0x4a49('0x3'));var fs=require('fs');var Redis=require(_0x4a49('0x4'));var db=require(_0x4a49('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a49('0x6'))(_0x4a49('0x7'));var config=require(_0x4a49('0x8'));var jayson=require(_0x4a49('0x9'));var client=jayson['client'][_0x4a49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54732a,_0x527af1,_0x5391e9){return new BPromise(function(_0x4f8174,_0x90c7a){return client[_0x4a49('0xb')](_0x54732a,_0x5391e9)['then'](function(_0x47325d){logger['info'](_0x4a49('0xc'),_0x527af1,_0x4a49('0xd'));logger[_0x4a49('0xe')](_0x4a49('0xf'),_0x527af1,_0x4a49('0xd'),JSON[_0x4a49('0x10')](_0x47325d));if(_0x47325d[_0x4a49('0x11')]){if(_0x47325d[_0x4a49('0x11')][_0x4a49('0x12')]===0x1f4){logger['error'](_0x4a49('0xc'),_0x527af1,_0x47325d[_0x4a49('0x11')][_0x4a49('0x13')]);return _0x90c7a(_0x47325d['error'][_0x4a49('0x13')]);}logger['error'](_0x4a49('0xc'),_0x527af1,_0x47325d[_0x4a49('0x11')][_0x4a49('0x13')]);return _0x4f8174(_0x47325d[_0x4a49('0x11')][_0x4a49('0x13')]);}else{logger[_0x4a49('0x14')](_0x4a49('0xc'),_0x527af1,'request\x20sent');_0x4f8174(_0x47325d[_0x4a49('0x15')][_0x4a49('0x13')]);}})[_0x4a49('0x16')](function(_0x1b6afb){logger[_0x4a49('0x11')](_0x4a49('0xc'),_0x527af1,_0x1b6afb);_0x90c7a(_0x1b6afb);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 171ecf3..d87eca9 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 _0xe0e6=['express','Router','../../components/auth/service','../../components/interaction/service','exports','util','path','connect-timeout'];(function(_0x52a9a4,_0x1ac24f){var _0x332246=function(_0x10ba4e){while(--_0x10ba4e){_0x52a9a4['push'](_0x52a9a4['shift']());}};_0x332246(++_0x1ac24f);}(_0xe0e6,0x1bd));var _0x6e0e=function(_0x37236d,_0x3e8445){_0x37236d=_0x37236d-0x0;var _0x5ea146=_0xe0e6[_0x37236d];return _0x5ea146;};'use strict';var multer=require('multer');var util=require(_0x6e0e('0x0'));var path=require(_0x6e0e('0x1'));var timeout=require(_0x6e0e('0x2'));var express=require(_0x6e0e('0x3'));var router=express[_0x6e0e('0x4')]();var auth=require(_0x6e0e('0x5'));var interaction=require(_0x6e0e('0x6'));var config=require('../../config/environment');module[_0x6e0e('0x7')]=router; \ No newline at end of file +var _0x233c=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x233c,0x14d));var _0xc233=function(_0x16e385,_0x4e8db2){_0x16e385=_0x16e385-0x0;var _0x78c03e=_0x233c[_0x16e385];return _0x78c03e;};'use strict';var multer=require(_0xc233('0x0'));var util=require(_0xc233('0x1'));var path=require(_0xc233('0x2'));var timeout=require(_0xc233('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc233('0x4'));var interaction=require(_0xc233('0x5'));var config=require(_0xc233('0x6'));module[_0xc233('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index a4b4539..d1d3647 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 _0xf4f4=['exports','INTEGER','STRING','sequelize'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x3d9503,_0x45bc72){_0x3d9503=_0x3d9503-0x0;var _0x337b6c=_0xf4f4[_0x3d9503];return _0x337b6c;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4f4f('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4f4f('0x3')]}}; \ No newline at end of file +var _0xe511=['INTEGER','sequelize','exports'];(function(_0x31c87a,_0x11b9f5){var _0x10366e=function(_0x56f96b){while(--_0x56f96b){_0x31c87a['push'](_0x31c87a['shift']());}};_0x10366e(++_0x11b9f5);}(_0xe511,0x16f));var _0x1e51=function(_0x586ec4,_0x5d1f1c){_0x586ec4=_0x586ec4-0x0;var _0x17267e=_0xe511[_0x586ec4];return _0x17267e;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1e51('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 f16dbc4..e8dff83 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 _0x0e9e=['define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./userFaxQueue.attributes'];(function(_0x26431d,_0x2cff4f){var _0x452066=function(_0x1ad494){while(--_0x1ad494){_0x26431d['push'](_0x26431d['shift']());}};_0x452066(++_0x2cff4f);}(_0x0e9e,0x19a));var _0xe0e9=function(_0x5cb0ec,_0x45ece5){_0x5cb0ec=_0x5cb0ec-0x0;var _0x13cbfe=_0x0e9e[_0x5cb0ec];return _0x13cbfe;};'use strict';var _=require(_0xe0e9('0x0'));var util=require(_0xe0e9('0x1'));var logger=require(_0xe0e9('0x2'))(_0xe0e9('0x3'));var moment=require('moment');var BPromise=require(_0xe0e9('0x4'));var rp=require(_0xe0e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0e9('0x6'));var config=require('../../config/environment');var attributes=require(_0xe0e9('0x7'));module['exports']=function(_0x5965c6,_0x3ebf3d){return _0x5965c6[_0xe0e9('0x8')](_0xe0e9('0x9'),attributes,{'tableName':_0xe0e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33f8=['path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','api','moment','request-promise'];(function(_0x10e4a5,_0x57c63d){var _0x1d53a9=function(_0xb893e9){while(--_0xb893e9){_0x10e4a5['push'](_0x10e4a5['shift']());}};_0x1d53a9(++_0x57c63d);}(_0x33f8,0x1f4));var _0x833f=function(_0x55962d,_0x119503){_0x55962d=_0x55962d-0x0;var _0x307b4d=_0x33f8[_0x55962d];return _0x307b4d;};'use strict';var _=require(_0x833f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x833f('0x1'));var moment=require(_0x833f('0x2'));var BPromise=require('bluebird');var rp=require(_0x833f('0x3'));var fs=require('fs');var path=require(_0x833f('0x4'));var rimraf=require(_0x833f('0x5'));var config=require(_0x833f('0x6'));var attributes=require(_0x833f('0x7'));module[_0x833f('0x8')]=function(_0x3bd816,_0x5f345f){return _0x3bd816[_0x833f('0x9')](_0x833f('0xa'),attributes,{'tableName':_0x833f('0xb'),'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 670d445..18df931 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 _0xbe27=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','util'];(function(_0x807b20,_0x2c0e5e){var _0xe0fe11=function(_0x508ef9){while(--_0x508ef9){_0x807b20['push'](_0x807b20['shift']());}};_0xe0fe11(++_0x2c0e5e);}(_0xbe27,0x92));var _0x7be2=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbe27[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x7be2('0x0'));var moment=require(_0x7be2('0x1'));var BPromise=require(_0x7be2('0x2'));var rs=require(_0x7be2('0x3'));var fs=require('fs');var Redis=require(_0x7be2('0x4'));var db=require(_0x7be2('0x5'))['db'];var utils=require(_0x7be2('0x6'));var logger=require(_0x7be2('0x7'))('rpc');var config=require(_0x7be2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7be2('0x9')][_0x7be2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bcbc4,_0x5dc1dd,_0x5f1497){return new BPromise(function(_0x2c4af4,_0xb4703e){return client[_0x7be2('0xb')](_0x1bcbc4,_0x5f1497)[_0x7be2('0xc')](function(_0xf47d5e){logger['info'](_0x7be2('0xd'),_0x5dc1dd,_0x7be2('0xe'));logger[_0x7be2('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5dc1dd,'request\x20sent',JSON[_0x7be2('0x10')](_0xf47d5e));if(_0xf47d5e[_0x7be2('0x11')]){if(_0xf47d5e['error'][_0x7be2('0x12')]===0x1f4){logger['error'](_0x7be2('0xd'),_0x5dc1dd,_0xf47d5e[_0x7be2('0x11')][_0x7be2('0x13')]);return _0xb4703e(_0xf47d5e[_0x7be2('0x11')][_0x7be2('0x13')]);}logger['error'](_0x7be2('0xd'),_0x5dc1dd,_0xf47d5e['error']['message']);return _0x2c4af4(_0xf47d5e['error'][_0x7be2('0x13')]);}else{logger[_0x7be2('0x14')](_0x7be2('0xd'),_0x5dc1dd,_0x7be2('0xe'));_0x2c4af4(_0xf47d5e['result'][_0x7be2('0x13')]);}})['catch'](function(_0x556e27){logger[_0x7be2('0x11')](_0x7be2('0xd'),_0x5dc1dd,_0x556e27);_0xb4703e(_0x556e27);});});} \ No newline at end of file +var _0xacf5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0xacf5,0x110));var _0x5acf=function(_0x1e70a1,_0x688d0f){_0x1e70a1=_0x1e70a1-0x0;var _0xdb752c=_0xacf5[_0x1e70a1];return _0xdb752c;};'use strict';var _=require(_0x5acf('0x0'));var util=require(_0x5acf('0x1'));var moment=require(_0x5acf('0x2'));var BPromise=require(_0x5acf('0x3'));var rs=require(_0x5acf('0x4'));var fs=require('fs');var Redis=require(_0x5acf('0x5'));var db=require(_0x5acf('0x6'))['db'];var utils=require(_0x5acf('0x7'));var logger=require(_0x5acf('0x8'))(_0x5acf('0x9'));var config=require('../../config/environment');var jayson=require(_0x5acf('0xa'));var client=jayson[_0x5acf('0xb')][_0x5acf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21c7dd,_0x766711,_0x53b20f){return new BPromise(function(_0x555953,_0x5f12f0){return client[_0x5acf('0xd')](_0x21c7dd,_0x53b20f)[_0x5acf('0xe')](function(_0x57e2da){logger[_0x5acf('0xf')](_0x5acf('0x10'),_0x766711,_0x5acf('0x11'));logger[_0x5acf('0x12')](_0x5acf('0x13'),_0x766711,_0x5acf('0x11'),JSON[_0x5acf('0x14')](_0x57e2da));if(_0x57e2da[_0x5acf('0x15')]){if(_0x57e2da[_0x5acf('0x15')][_0x5acf('0x16')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x766711,_0x57e2da['error'][_0x5acf('0x17')]);return _0x5f12f0(_0x57e2da[_0x5acf('0x15')]['message']);}logger['error'](_0x5acf('0x10'),_0x766711,_0x57e2da[_0x5acf('0x15')][_0x5acf('0x17')]);return _0x555953(_0x57e2da['error'][_0x5acf('0x17')]);}else{logger[_0x5acf('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x766711,_0x5acf('0x11'));_0x555953(_0x57e2da['result'][_0x5acf('0x17')]);}})[_0x5acf('0x18')](function(_0x27373f){logger[_0x5acf('0x15')](_0x5acf('0x10'),_0x766711,_0x27373f);_0x5f12f0(_0x27373f);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 7a90d3b..cf679c1 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 _0xf6b4=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','connect-timeout','express','Router'];(function(_0x5c13d5,_0x38a129){var _0x361eb9=function(_0x33e1aa){while(--_0x33e1aa){_0x5c13d5['push'](_0x5c13d5['shift']());}};_0x361eb9(++_0x38a129);}(_0xf6b4,0xb4));var _0x4f6b=function(_0x48a24a,_0x3cb63c){_0x48a24a=_0x48a24a-0x0;var _0x5e35d8=_0xf6b4[_0x48a24a];return _0x5e35d8;};'use strict';var multer=require(_0x4f6b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f6b('0x1'));var express=require(_0x4f6b('0x2'));var router=express[_0x4f6b('0x3')]();var auth=require(_0x4f6b('0x4'));var interaction=require(_0x4f6b('0x5'));var config=require(_0x4f6b('0x6'));module[_0x4f6b('0x7')]=router; \ No newline at end of file +var _0xb3e4=['../../config/environment','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xb3e4,0x18a));var _0x4b3e=function(_0x53f11c,_0x16669f){_0x53f11c=_0x53f11c-0x0;var _0x11a862=_0xb3e4[_0x53f11c];return _0x11a862;};'use strict';var multer=require(_0x4b3e('0x0'));var util=require('util');var path=require(_0x4b3e('0x1'));var timeout=require(_0x4b3e('0x2'));var express=require('express');var router=express[_0x4b3e('0x3')]();var auth=require(_0x4b3e('0x4'));var interaction=require(_0x4b3e('0x5'));var config=require(_0x4b3e('0x6'));module[_0x4b3e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 370cf85..c994a13 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x13cc47,_0x245c3d){var _0x4044ae=function(_0x103167){while(--_0x103167){_0x13cc47['push'](_0x13cc47['shift']());}};_0x4044ae(++_0x245c3d);}(_0xe706,0xa3));var _0x6e70=function(_0x47b7c9,_0x3848b2){_0x47b7c9=_0x47b7c9-0x0;var _0x435aaf=_0xe706[_0x47b7c9];return _0x435aaf;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 4c6fb12..39abf03 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 _0x2032=['user_has_mail_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x57312a,_0x142d63){var _0x3c5ba0=function(_0x45ca2b){while(--_0x45ca2b){_0x57312a['push'](_0x57312a['shift']());}};_0x3c5ba0(++_0x142d63);}(_0x2032,0xd9));var _0x2203=function(_0x543df3,_0x5347d4){_0x543df3=_0x543df3-0x0;var _0x4c1616=_0x2032[_0x543df3];return _0x4c1616;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0xb10b,0x12a));var _0xbb10=function(_0x1bf57f,_0x255df4){_0x1bf57f=_0x1bf57f-0x0;var _0x23a86b=_0xb10b[_0x1bf57f];return _0x23a86b;};'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 diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index d64b622..226a09d 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 _0xc2a5=['client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0xc2a5,0x14e));var _0x5c2a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc2a5[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x5c2a('0x0'));var util=require(_0x5c2a('0x1'));var moment=require(_0x5c2a('0x2'));var BPromise=require(_0x5c2a('0x3'));var rs=require(_0x5c2a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c2a('0x5'))['db'];var utils=require(_0x5c2a('0x6'));var logger=require(_0x5c2a('0x7'))(_0x5c2a('0x8'));var config=require(_0x5c2a('0x9'));var jayson=require(_0x5c2a('0xa'));var client=jayson[_0x5c2a('0xb')][_0x5c2a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x503c46,_0x454d25,_0x31cbcd){return new BPromise(function(_0x184d2e,_0x34d952){return client['request'](_0x503c46,_0x31cbcd)[_0x5c2a('0xd')](function(_0xebbc5b){logger[_0x5c2a('0xe')](_0x5c2a('0xf'),_0x454d25,_0x5c2a('0x10'));logger[_0x5c2a('0x11')](_0x5c2a('0x12'),_0x454d25,'request\x20sent',JSON['stringify'](_0xebbc5b));if(_0xebbc5b[_0x5c2a('0x13')]){if(_0xebbc5b[_0x5c2a('0x13')]['code']===0x1f4){logger['error'](_0x5c2a('0xf'),_0x454d25,_0xebbc5b[_0x5c2a('0x13')]['message']);return _0x34d952(_0xebbc5b[_0x5c2a('0x13')]['message']);}logger[_0x5c2a('0x13')](_0x5c2a('0xf'),_0x454d25,_0xebbc5b['error']['message']);return _0x184d2e(_0xebbc5b[_0x5c2a('0x13')][_0x5c2a('0x14')]);}else{logger['info'](_0x5c2a('0xf'),_0x454d25,'request\x20sent');_0x184d2e(_0xebbc5b[_0x5c2a('0x15')]['message']);}})[_0x5c2a('0x16')](function(_0x5ad956){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x454d25,_0x5ad956);_0x34d952(_0x5ad956);});});} \ No newline at end of file +var _0xd43e=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x39e7ed,_0x599328){var _0x8f9820=function(_0x14a653){while(--_0x14a653){_0x39e7ed['push'](_0x39e7ed['shift']());}};_0x8f9820(++_0x599328);}(_0xd43e,0x88));var _0xed43=function(_0x122a15,_0x1e539a){_0x122a15=_0x122a15-0x0;var _0x44330b=_0xd43e[_0x122a15];return _0x44330b;};'use strict';var _=require(_0xed43('0x0'));var util=require('util');var moment=require(_0xed43('0x1'));var BPromise=require(_0xed43('0x2'));var rs=require(_0xed43('0x3'));var fs=require('fs');var Redis=require(_0xed43('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xed43('0x5'))(_0xed43('0x6'));var config=require(_0xed43('0x7'));var jayson=require(_0xed43('0x8'));var client=jayson['client'][_0xed43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x463645,_0x4875eb,_0x4c3697){return new BPromise(function(_0x58b2b0,_0x3d603f){return client[_0xed43('0xa')](_0x463645,_0x4c3697)[_0xed43('0xb')](function(_0xd39ac0){logger[_0xed43('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x4875eb,_0xed43('0xd'));logger[_0xed43('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x4875eb,_0xed43('0xd'),JSON[_0xed43('0xf')](_0xd39ac0));if(_0xd39ac0[_0xed43('0x10')]){if(_0xd39ac0['error']['code']===0x1f4){logger[_0xed43('0x10')](_0xed43('0x11'),_0x4875eb,_0xd39ac0['error'][_0xed43('0x12')]);return _0x3d603f(_0xd39ac0[_0xed43('0x10')][_0xed43('0x12')]);}logger[_0xed43('0x10')](_0xed43('0x11'),_0x4875eb,_0xd39ac0[_0xed43('0x10')]['message']);return _0x58b2b0(_0xd39ac0[_0xed43('0x10')]['message']);}else{logger[_0xed43('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x4875eb,_0xed43('0xd'));_0x58b2b0(_0xd39ac0['result']['message']);}})[_0xed43('0x13')](function(_0x572df2){logger[_0xed43('0x10')](_0xed43('0x11'),_0x4875eb,_0x572df2);_0x3d603f(_0x572df2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 8943a7b..eb37a55 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3efc=['sendUserNotification','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated'];(function(_0x4e24a4,_0x500913){var _0x420df8=function(_0x48b2dc){while(--_0x48b2dc){_0x4e24a4['push'](_0x4e24a4['shift']());}};_0x420df8(++_0x500913);}(_0x3efc,0xda));var _0xc3ef=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3efc[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xc3ef('0x0'));var util=require(_0xc3ef('0x1'));var path=require(_0xc3ef('0x2'));var timeout=require(_0xc3ef('0x3'));var express=require('express');var router=express[_0xc3ef('0x4')]();var auth=require(_0xc3ef('0x5'));var interaction=require(_0xc3ef('0x6'));var config=require(_0xc3ef('0x7'));var controller=require(_0xc3ef('0x8'));router['post']('/',auth[_0xc3ef('0x9')](),controller[_0xc3ef('0xa')]);module[_0xc3ef('0xb')]=router; \ No newline at end of file +var _0xa899=['post','isAuthenticated','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2394be,_0x3a0629){var _0x3cba02=function(_0x2592d8){while(--_0x2592d8){_0x2394be['push'](_0x2394be['shift']());}};_0x3cba02(++_0x3a0629);}(_0xa899,0xdf));var _0x9a89=function(_0x386b03,_0x5d0000){_0x386b03=_0x386b03-0x0;var _0xd3d524=_0xa899[_0x386b03];return _0xd3d524;};'use strict';var multer=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var path=require(_0x9a89('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a89('0x3'));var router=express[_0x9a89('0x4')]();var auth=require(_0x9a89('0x5'));var interaction=require(_0x9a89('0x6'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0x9a89('0x7')]('/',auth[_0x9a89('0x8')](),controller['sendUserNotification']);module[_0x9a89('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 04d5ab3..992ab2f 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30cc=['exports','TEXT','STRING'];(function(_0x109b1d,_0x1c7bd0){var _0x4f0732=function(_0x18099d){while(--_0x18099d){_0x109b1d['push'](_0x109b1d['shift']());}};_0x4f0732(++_0x1c7bd0);}(_0x30cc,0x1b3));var _0xc30c=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x30cc[_0x3305de];return _0x3b5a84;};'use strict';var Sequelize=require('sequelize');module[_0xc30c('0x0')]={'body':{'type':Sequelize[_0xc30c('0x1')]},'senderName':{'type':Sequelize[_0xc30c('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xc30c('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xc3d1=['sequelize','exports','TEXT','STRING'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0xc3d1,0x128));var _0x1c3d=function(_0x166dcd,_0x1ba118){_0x166dcd=_0x166dcd-0x0;var _0x1731d4=_0xc3d1[_0x166dcd];return _0x1731d4;};'use strict';var Sequelize=require(_0x1c3d('0x0'));module[_0x1c3d('0x1')]={'body':{'type':Sequelize[_0x1c3d('0x2')]},'senderName':{'type':Sequelize[_0x1c3d('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x1c3d('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 8f54e00..a6ec48f 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x323f=['redis','defaults','socket.io-emitter','./userNotification.socket','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','Sequelize','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','create','forEach','recipient','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','toLowerCase','User','union','replace','queue','Queue','ids','flatten','getAgents','map','eml-format','rimraf','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x5de147,_0x355799){var _0x4ba688=function(_0x125ed4){while(--_0x125ed4){_0x5de147['push'](_0x5de147['shift']());}};_0x4ba688(++_0x355799);}(_0x323f,0xff));var _0xf323=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x323f[_0x46aff0];return _0x9d78cf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf323('0x0'));var rimraf=require(_0xf323('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf323('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf323('0x3'));var csv=require(_0xf323('0x4'));var ejs=require(_0xf323('0x5'));var fs=require('fs');var _=require(_0xf323('0x6'));var squel=require(_0xf323('0x7'));var crypto=require(_0xf323('0x8'));var jsforce=require(_0xf323('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf323('0x4'));var querystring=require('querystring');var Papa=require(_0xf323('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(_0xf323('0xb'));var logger=require(_0xf323('0xc'))('api');var utils=require(_0xf323('0xd'));var config=require(_0xf323('0xe'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf323('0xf')]=_[_0xf323('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf323('0x11'))(new Redis(config[_0xf323('0xf')]));require(_0xf323('0x12'))['register'](socket);function respondWithStatusCode(_0x4c73e8,_0x124303){_0x124303=_0x124303||0xcc;return function(_0x2c18eb){if(_0x2c18eb){return _0x4c73e8[_0xf323('0x13')](_0x124303);}return _0x4c73e8[_0xf323('0x14')](_0x124303)[_0xf323('0x15')]();};}function respondWithResult(_0xa5a6c5,_0x40206f){_0x40206f=_0x40206f||0xc8;return function(_0x3860fb){if(_0x3860fb){return _0xa5a6c5[_0xf323('0x14')](_0x40206f)['json'](_0x3860fb);}};}function respondWithFilteredResult(_0xf00a7c,_0x4e9060){return function(_0x4f3808){if(_0x4f3808){var _0x37c087=_0x4f3808[_0xf323('0x16')],_0x4e5334=_0x4e9060[_0xf323('0x17')],_0x112c47=_0x4e9060[_0xf323('0x17')]+_0x4e9060[_0xf323('0x18')],_0xaaad79;if(_0x112c47>=_0x37c087){_0x112c47=_0x37c087;_0xaaad79=0xc8;}else{_0xaaad79=0xce;}_0xf00a7c[_0xf323('0x14')](_0xaaad79);return _0xf00a7c[_0xf323('0x19')](_0xf323('0x1a'),_0x4e5334+'-'+_0x112c47+'/'+_0x37c087)[_0xf323('0x1b')](_0x4f3808);}return null;};}function patchUpdates(_0xf28d2){return function(_0x30f2e3){try{jsonpatch[_0xf323('0x1c')](_0x30f2e3,_0xf28d2,!![]);}catch(_0x57ab73){return BPromise['reject'](_0x57ab73);}return _0x30f2e3['save']();};}function saveUpdates(_0x3038c6,_0xc21dd){return function(_0x707588){if(_0x707588){return _0x707588[_0xf323('0x1d')](_0x3038c6)[_0xf323('0x1e')](function(_0x45b98c){return _0x45b98c;});}return null;};}function removeEntity(_0x25b63c,_0x56b397){return function(_0x15572b){if(_0x15572b){return _0x15572b[_0xf323('0x1f')]()[_0xf323('0x1e')](function(){_0x25b63c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c7c4e,_0x564267){return function(_0x55ab1b){if(!_0x55ab1b){_0x5c7c4e[_0xf323('0x13')](0x194);}return _0x55ab1b;};}function handleError(_0x3e0de0,_0x5045fc){_0x5045fc=_0x5045fc||0x1f4;return function(_0x50ea3e){logger[_0xf323('0x20')](_0x50ea3e[_0xf323('0x21')]);if(_0x50ea3e[_0xf323('0x22')]){delete _0x50ea3e['name'];}_0x3e0de0[_0xf323('0x14')](_0x5045fc)[_0xf323('0x23')](_0x50ea3e);};}exports[_0xf323('0x24')]=function(_0x5728b4,_0x11c63b,_0x440413){if(!_0x5728b4[_0xf323('0x25')][_0xf323('0x26')]('text')&&!_0x5728b4[_0xf323('0x25')][_0xf323('0x26')]('TemplateId')){throw new db[(_0xf323('0x27'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x5728b4['body']['hasOwnProperty'](_0xf323('0x28'))&&!_0x5728b4[_0xf323('0x25')][_0xf323('0x26')](_0xf323('0x29'))){throw new db[(_0xf323('0x27'))]['ValidationError'](_0xf323('0x2a'));}if(!_0x5728b4[_0xf323('0x25')][_0xf323('0x26')](_0xf323('0x2b'))){throw new db[(_0xf323('0x27'))][(_0xf323('0x2c'))](_0xf323('0x2d'));}else{try{var _0x3491fc=JSON[_0xf323('0x2e')](_0x5728b4[_0xf323('0x25')][_0xf323('0x2b')]);}catch(_0x4a03a1){logger[_0xf323('0x20')](_0x4a03a1);throw new db['Sequelize'][(_0xf323('0x2c'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x56ff8b=[_0xf323('0x2f'),_0xf323('0x30'),_0xf323('0x31'),_0xf323('0x32'),'smsqueue',_0xf323('0x33'),_0xf323('0x34'),_0xf323('0x35'),_0xf323('0x36')];if(_[_0xf323('0x37')](_0x3491fc,function(_0x21fa3c){return!_[_0xf323('0x38')](_0x56ff8b,_0x21fa3c[_0xf323('0x39')]['toLowerCase']());})){throw new db[(_0xf323('0x27'))]['ValidationError'](_0xf323('0x3a'));}}}var _0x537ae2={};_0x537ae2['senderName']=_0x5728b4[_0xf323('0x25')][_0xf323('0x26')](_0xf323('0x3b'))?_0x5728b4[_0xf323('0x25')]['senderName']:_0x5728b4[_0xf323('0x36')][_0xf323('0x3c')];_0x537ae2['recipientsDescription']=_[_0xf323('0x3d')](_0x5728b4[_0xf323('0x25')][_0xf323('0x3e')])?null:_0x5728b4[_0xf323('0x25')][_0xf323('0x3e')];_0x537ae2['beep']=_0x5728b4[_0xf323('0x25')][_0xf323('0x3f')]||![];_0x537ae2[_0xf323('0x40')]=_0x5728b4[_0xf323('0x36')]['id'];return getContent(_0x5728b4[_0xf323('0x25')])[_0xf323('0x1e')](function(_0x3d3c8c){_0x537ae2[_0xf323('0x25')]=_0x3d3c8c;return getRecipients(_0x3491fc);})[_0xf323('0x1e')](function(_0x526e0a){_0x537ae2['recipientsId']=_[_0xf323('0x41')](_0x526e0a)[_0xf323('0x42')](',');return db[_0xf323('0x43')][_0xf323('0x44')](function(_0x266e28){return db['UserNotification'][_0xf323('0x45')](_0x537ae2,{'raw':!![],'transaction':_0x266e28})[_0xf323('0x1e')](function(_0x2a40d9){var _0x1ac15c={'sender':_0x537ae2['senderName'],'description':_0x537ae2['recipientsDescription'],'content':_0x537ae2['body'],'beep':_0x537ae2[_0xf323('0x3f')]};_0x526e0a[_0xf323('0x46')](function(_0x29edde){_0x1ac15c[_0xf323('0x47')]=_0x29edde;socket['emit'](_0xf323('0x48'),_0x1ac15c);});return _0x2a40d9;});});})[_0xf323('0x1e')](respondWithResult(_0x11c63b,0xc9))['catch'](handleError(_0x11c63b,null));};function getContent(_0x348dc1){return new BPromise(function(_0x26ebdc,_0x11bf37){if(_0x348dc1[_0xf323('0x49')]){_0x26ebdc(_0x348dc1['text']);return;}return db[_0xf323('0x4a')][_0xf323('0x4b')]({'attributes':[_0xf323('0x4c')],'where':{'id':_0x348dc1[_0xf323('0x28')]},'raw':!![]})[_0xf323('0x1e')](function(_0x3c5f6d){if(!_0x3c5f6d)throw new db[(_0xf323('0x27'))][(_0xf323('0x2c'))](_0xf323('0x4d'));var _0x2bf0a8=Mustache[_0xf323('0x4e')](_0x3c5f6d['html'],_0x348dc1[_0xf323('0x29')]);_0x26ebdc(_0x2bf0a8);})[_0xf323('0x4f')](function(_0x35c75a){_0x11bf37(_0x35c75a);});});}function getRecipients(_0xf966d4){return new BPromise(function(_0xcafe2a,_0x1011f0){var _0x1e61a3=[];var _0x2bb41d=[];_0xf966d4[_0xf323('0x46')](function(_0xb1042b){var _0x2a15cd=_['startCase'](_0xb1042b[_0xf323('0x39')][_0xf323('0x50')]());if(_0x2a15cd===_0xf323('0x51')){_0x1e61a3=_[_0xf323('0x52')](_0x1e61a3,_0xb1042b['ids']);}else{if(_[_0xf323('0x38')](_0x2a15cd,'queue'))_0x2a15cd=_0x2a15cd[_0xf323('0x53')](_0xf323('0x54'),_0xf323('0x55'));_0xb1042b[_0xf323('0x56')][_0xf323('0x46')](function(_0x49465c){_0x2bb41d['push'](getAgents(_0x2a15cd,_0x49465c));});}});return BPromise['all'](_0x2bb41d)[_0xf323('0x1e')](function(_0x24b013){_0x1e61a3=_[_0xf323('0x52')](_0x1e61a3,_[_0xf323('0x57')](_0x24b013));_0xcafe2a(_0x1e61a3);})[_0xf323('0x4f')](function(_0x40f39b){_0x1011f0(_0x40f39b);});});}function getAgents(_0x12776e,_0x45e69b){return new BPromise(function(_0x182a34,_0x4e18be){return db[_0x12776e][_0xf323('0x4b')]({'where':{'id':_0x45e69b}})[_0xf323('0x1e')](function(_0x3ee53a){return _0x3ee53a[_0xf323('0x58')]({'attributes':['id'],'raw':!![]})['then'](function(_0x33af05){var _0x4c43da=_[_0xf323('0x59')](_0x33af05,'id');_0x182a34(_0x4c43da);});})[_0xf323('0x4f')](function(_0x22d204){_0x4e18be(_0x22d204);});});} \ No newline at end of file +var _0x3880=['Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','join','sequelize','UserNotification','create','forEach','recipient','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','User','union','ids','replace','queue','Queue','push','all','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userNotification.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','view'];(function(_0x282490,_0x1667d6){var _0x5e7f1a=function(_0x37bf58){while(--_0x37bf58){_0x282490['push'](_0x282490['shift']());}};_0x5e7f1a(++_0x1667d6);}(_0x3880,0x14a));var _0x0388=function(_0x3371c4,_0x165ec2){_0x3371c4=_0x3371c4-0x0;var _0x53dc75=_0x3880[_0x3371c4];return _0x53dc75;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0388('0x0'));var rimraf=require(_0x0388('0x1'));var zipdir=require(_0x0388('0x2'));var jsonpatch=require(_0x0388('0x3'));var rp=require(_0x0388('0x4'));var moment=require(_0x0388('0x5'));var BPromise=require(_0x0388('0x6'));var Mustache=require(_0x0388('0x7'));var util=require(_0x0388('0x8'));var path=require(_0x0388('0x9'));var sox=require(_0x0388('0xa'));var csv=require(_0x0388('0xb'));var ejs=require(_0x0388('0xc'));var fs=require('fs');var _=require(_0x0388('0xd'));var squel=require(_0x0388('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0388('0xf'));var toCsv=require(_0x0388('0xb'));var querystring=require(_0x0388('0x10'));var Papa=require(_0x0388('0x11'));var Redis=require(_0x0388('0x12'));var authService=require(_0x0388('0x13'));var qs=require(_0x0388('0x14'));var as=require(_0x0388('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0388('0x16'));var utils=require(_0x0388('0x17'));var config=require(_0x0388('0x18'));var licenseUtil=require(_0x0388('0x19'));var db=require('../../mysqldb')['db'];config[_0x0388('0x1a')]=_[_0x0388('0x1b')](config[_0x0388('0x1a')],{'host':_0x0388('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0388('0x1a')]));require(_0x0388('0x1d'))[_0x0388('0x1e')](socket);function respondWithStatusCode(_0x3c7fa5,_0x529474){_0x529474=_0x529474||0xcc;return function(_0x3f0475){if(_0x3f0475){return _0x3c7fa5[_0x0388('0x1f')](_0x529474);}return _0x3c7fa5[_0x0388('0x20')](_0x529474)['end']();};}function respondWithResult(_0x51ec1e,_0x2d1116){_0x2d1116=_0x2d1116||0xc8;return function(_0x422d1c){if(_0x422d1c){return _0x51ec1e[_0x0388('0x20')](_0x2d1116)[_0x0388('0x21')](_0x422d1c);}};}function respondWithFilteredResult(_0x287942,_0x4c614f){return function(_0x360e11){if(_0x360e11){var _0x106655=_0x360e11[_0x0388('0x22')],_0x6d5285=_0x4c614f[_0x0388('0x23')],_0x337944=_0x4c614f['offset']+_0x4c614f[_0x0388('0x24')],_0x685a17;if(_0x337944>=_0x106655){_0x337944=_0x106655;_0x685a17=0xc8;}else{_0x685a17=0xce;}_0x287942[_0x0388('0x20')](_0x685a17);return _0x287942[_0x0388('0x25')](_0x0388('0x26'),_0x6d5285+'-'+_0x337944+'/'+_0x106655)[_0x0388('0x21')](_0x360e11);}return null;};}function patchUpdates(_0x2906ad){return function(_0x9eab1c){try{jsonpatch[_0x0388('0x27')](_0x9eab1c,_0x2906ad,!![]);}catch(_0xd48f4b){return BPromise[_0x0388('0x28')](_0xd48f4b);}return _0x9eab1c[_0x0388('0x29')]();};}function saveUpdates(_0x1dd0fd,_0x151f4f){return function(_0x1a8199){if(_0x1a8199){return _0x1a8199['update'](_0x1dd0fd)[_0x0388('0x2a')](function(_0x228c04){return _0x228c04;});}return null;};}function removeEntity(_0x11c3f0,_0x1e6c48){return function(_0x36b903){if(_0x36b903){return _0x36b903[_0x0388('0x2b')]()[_0x0388('0x2a')](function(){_0x11c3f0[_0x0388('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x215145,_0x46d323){return function(_0x36070a){if(!_0x36070a){_0x215145['sendStatus'](0x194);}return _0x36070a;};}function handleError(_0x4b6874,_0x4a79d7){_0x4a79d7=_0x4a79d7||0x1f4;return function(_0x3c0e6d){logger[_0x0388('0x2c')](_0x3c0e6d['stack']);if(_0x3c0e6d[_0x0388('0x2d')]){delete _0x3c0e6d[_0x0388('0x2d')];}_0x4b6874[_0x0388('0x20')](_0x4a79d7)[_0x0388('0x2e')](_0x3c0e6d);};}exports['sendUserNotification']=function(_0x5f34a4,_0xadb1af,_0x2e68fd){if(!_0x5f34a4[_0x0388('0x2f')]['hasOwnProperty'](_0x0388('0x30'))&&!_0x5f34a4[_0x0388('0x2f')][_0x0388('0x31')](_0x0388('0x32'))){throw new db[(_0x0388('0x33'))][(_0x0388('0x34'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x5f34a4['body']['hasOwnProperty']('TemplateId')&&!_0x5f34a4[_0x0388('0x2f')]['hasOwnProperty'](_0x0388('0x35'))){throw new db[(_0x0388('0x33'))][(_0x0388('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x5f34a4[_0x0388('0x2f')][_0x0388('0x31')]('recipients')){throw new db[(_0x0388('0x33'))][(_0x0388('0x34'))](_0x0388('0x36'));}else{try{var _0x29d08e=JSON[_0x0388('0x37')](_0x5f34a4[_0x0388('0x2f')]['recipients']);}catch(_0x181e27){logger[_0x0388('0x2c')](_0x181e27);throw new db[(_0x0388('0x33'))]['ValidationError'](_0x0388('0x38'));}var _0x1a90c5=['chatqueue','faxqueue',_0x0388('0x39'),_0x0388('0x3a'),'smsqueue',_0x0388('0x3b'),_0x0388('0x3c'),_0x0388('0x3d'),_0x0388('0x3e')];if(_['some'](_0x29d08e,function(_0x16ac47){return!_[_0x0388('0x3f')](_0x1a90c5,_0x16ac47[_0x0388('0x40')][_0x0388('0x41')]());})){throw new db[(_0x0388('0x33'))]['ValidationError'](_0x0388('0x42'));}}}var _0x4be091={};_0x4be091[_0x0388('0x43')]=_0x5f34a4[_0x0388('0x2f')][_0x0388('0x31')]('senderName')?_0x5f34a4[_0x0388('0x2f')]['senderName']:_0x5f34a4[_0x0388('0x3e')][_0x0388('0x44')];_0x4be091[_0x0388('0x45')]=_[_0x0388('0x46')](_0x5f34a4[_0x0388('0x2f')][_0x0388('0x45')])?null:_0x5f34a4[_0x0388('0x2f')][_0x0388('0x45')];_0x4be091[_0x0388('0x47')]=_0x5f34a4['body'][_0x0388('0x47')]||![];_0x4be091['SenderId']=_0x5f34a4[_0x0388('0x3e')]['id'];return getContent(_0x5f34a4[_0x0388('0x2f')])[_0x0388('0x2a')](function(_0x56c03f){_0x4be091[_0x0388('0x2f')]=_0x56c03f;return getRecipients(_0x29d08e);})[_0x0388('0x2a')](function(_0x265ea4){_0x4be091[_0x0388('0x48')]=_['sortBy'](_0x265ea4)[_0x0388('0x49')](',');return db[_0x0388('0x4a')]['transaction'](function(_0x26dbbf){return db[_0x0388('0x4b')][_0x0388('0x4c')](_0x4be091,{'raw':!![],'transaction':_0x26dbbf})[_0x0388('0x2a')](function(_0x43a488){var _0x1d2bd7={'sender':_0x4be091[_0x0388('0x43')],'description':_0x4be091[_0x0388('0x45')],'content':_0x4be091['body'],'beep':_0x4be091[_0x0388('0x47')]};_0x265ea4[_0x0388('0x4d')](function(_0x178dee){_0x1d2bd7[_0x0388('0x4e')]=_0x178dee;socket['emit'](_0x0388('0x4f'),_0x1d2bd7);});return _0x43a488;});});})[_0x0388('0x2a')](respondWithResult(_0xadb1af,0xc9))[_0x0388('0x50')](handleError(_0xadb1af,null));};function getContent(_0x238c75){return new BPromise(function(_0x13d750,_0x3dbd61){if(_0x238c75[_0x0388('0x30')]){_0x13d750(_0x238c75['text']);return;}return db[_0x0388('0x51')][_0x0388('0x52')]({'attributes':['html'],'where':{'id':_0x238c75[_0x0388('0x32')]},'raw':!![]})['then'](function(_0x42b828){if(!_0x42b828)throw new db[(_0x0388('0x33'))][(_0x0388('0x34'))](_0x0388('0x53'));var _0x32748d=Mustache[_0x0388('0x54')](_0x42b828[_0x0388('0x55')],_0x238c75['view']);_0x13d750(_0x32748d);})[_0x0388('0x50')](function(_0x339c48){_0x3dbd61(_0x339c48);});});}function getRecipients(_0x219548){return new BPromise(function(_0x16a13f,_0x105947){var _0xd3a595=[];var _0x46b624=[];_0x219548['forEach'](function(_0x38de26){var _0x415908=_['startCase'](_0x38de26[_0x0388('0x40')]['toLowerCase']());if(_0x415908===_0x0388('0x56')){_0xd3a595=_[_0x0388('0x57')](_0xd3a595,_0x38de26[_0x0388('0x58')]);}else{if(_[_0x0388('0x3f')](_0x415908,'queue'))_0x415908=_0x415908[_0x0388('0x59')](_0x0388('0x5a'),_0x0388('0x5b'));_0x38de26[_0x0388('0x58')]['forEach'](function(_0x5ea7b2){_0x46b624[_0x0388('0x5c')](getAgents(_0x415908,_0x5ea7b2));});}});return BPromise[_0x0388('0x5d')](_0x46b624)[_0x0388('0x2a')](function(_0x4ff75d){_0xd3a595=_[_0x0388('0x57')](_0xd3a595,_['flatten'](_0x4ff75d));_0x16a13f(_0xd3a595);})['catch'](function(_0x55557b){_0x105947(_0x55557b);});});}function getAgents(_0x44770d,_0xa068ab){return new BPromise(function(_0xb52363,_0x293207){return db[_0x44770d][_0x0388('0x52')]({'where':{'id':_0xa068ab}})[_0x0388('0x2a')](function(_0x13bd36){return _0x13bd36[_0x0388('0x5e')]({'attributes':['id'],'raw':!![]})[_0x0388('0x2a')](function(_0x356dea){var _0x36c1c1=_[_0x0388('0x5f')](_0x356dea,'id');_0xb52363(_0x36c1c1);});})['catch'](function(_0x4e416f){_0x293207(_0x4e416f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index fc8419f..dc51347 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bc3=['emit','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x3f2a82,_0x2ebec1){var _0x3ff073=function(_0x30d9df){while(--_0x30d9df){_0x3f2a82['push'](_0x3f2a82['shift']());}};_0x3ff073(++_0x2ebec1);}(_0x4bc3,0x16e));var _0x34bc=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x4bc3[_0x5c2e3e];return _0x53f64a;};'use strict';var EventEmitter=require(_0x34bc('0x0'));var UserNotification=require(_0x34bc('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x34bc('0x2')](0x0);var events={'afterCreate':_0x34bc('0x3'),'afterUpdate':'update','afterDestroy':_0x34bc('0x4')};function emitEvent(_0x616014){return function(_0x3ce1c3,_0x2e043e,_0x232f40){UserNotificationEvents[_0x34bc('0x5')](_0x616014+':'+_0x3ce1c3['id'],_0x3ce1c3);UserNotificationEvents[_0x34bc('0x5')](_0x616014,_0x3ce1c3);_0x232f40(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x34bc('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x5ad3=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x24a445,_0xd33d2){var _0x426c5d=function(_0x190c2c){while(--_0x190c2c){_0x24a445['push'](_0x24a445['shift']());}};_0x426c5d(++_0xd33d2);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5ad3[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x35ad('0x0'));var UserNotification=require(_0x35ad('0x1'))['db'][_0x35ad('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x35ad('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35ad('0x4'),'afterDestroy':_0x35ad('0x5')};function emitEvent(_0xc77352){return function(_0x69a0b3,_0x450f55,_0x1fed0d){UserNotificationEvents[_0x35ad('0x6')](_0xc77352+':'+_0x69a0b3['id'],_0x69a0b3);UserNotificationEvents[_0x35ad('0x6')](_0xc77352,_0x69a0b3);_0x1fed0d(null);};}for(var e in events){if(events[_0x35ad('0x7')](e)){var event=events[e];UserNotification[_0x35ad('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index b019537..d74bc5f 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x878f=['path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc1bf8d,_0x5305ed){var _0x4ae572=function(_0x1df57a){while(--_0x1df57a){_0xc1bf8d['push'](_0xc1bf8d['shift']());}};_0x4ae572(++_0x5305ed);}(_0x878f,0x173));var _0xf878=function(_0x5f072f,_0x29e613){_0x5f072f=_0x5f072f-0x0;var _0xa9baa3=_0x878f[_0x5f072f];return _0xa9baa3;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var BPromise=require(_0xf878('0x4'));var rp=require(_0xf878('0x5'));var fs=require('fs');var path=require(_0xf878('0x6'));var rimraf=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var attributes=require(_0xf878('0x9'));module[_0xf878('0xa')]=function(_0x4bc9aa,_0x4ac8d8){return _0x4bc9aa[_0xf878('0xb')](_0xf878('0xc'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1cc3=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x1cc3,0x11b));var _0x31cc=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1cc3[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x31cc('0x0'));var util=require(_0x31cc('0x1'));var logger=require('../../config/logger')(_0x31cc('0x2'));var moment=require('moment');var BPromise=require(_0x31cc('0x3'));var rp=require(_0x31cc('0x4'));var fs=require('fs');var path=require(_0x31cc('0x5'));var rimraf=require('rimraf');var config=require(_0x31cc('0x6'));var attributes=require(_0x31cc('0x7'));module[_0x31cc('0x8')]=function(_0x541da0,_0xc7ae44){return _0x541da0[_0x31cc('0x9')](_0x31cc('0xa'),attributes,{'tableName':_0x31cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x31cc('0xc'),'collate':_0x31cc('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index f5ff8a1..799f25d 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe703=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment','bluebird','randomstring'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xe703,0x1e9));var _0x3e70=function(_0x48f1db,_0x554c57){_0x48f1db=_0x48f1db-0x0;var _0x27de48=_0xe703[_0x48f1db];return _0x27de48;};'use strict';var _=require(_0x3e70('0x0'));var util=require('util');var moment=require(_0x3e70('0x1'));var BPromise=require(_0x3e70('0x2'));var rs=require(_0x3e70('0x3'));var fs=require('fs');var Redis=require(_0x3e70('0x4'));var db=require(_0x3e70('0x5'))['db'];var utils=require(_0x3e70('0x6'));var logger=require(_0x3e70('0x7'))(_0x3e70('0x8'));var config=require(_0x3e70('0x9'));var jayson=require(_0x3e70('0xa'));var client=jayson[_0x3e70('0xb')][_0x3e70('0xc')]({'port':0x232a});config[_0x3e70('0xd')]=_[_0x3e70('0xe')](config[_0x3e70('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e70('0xf'))(new Redis(config[_0x3e70('0xd')]));require(_0x3e70('0x10'))[_0x3e70('0x11')](socket);function respondWithRpcPromise(_0x38dfc3,_0x4b5fd4,_0x2ecfe9){return new BPromise(function(_0xa60173,_0x3db940){return client[_0x3e70('0x12')](_0x38dfc3,_0x2ecfe9)[_0x3e70('0x13')](function(_0x116dec){logger[_0x3e70('0x14')](_0x3e70('0x15'),_0x4b5fd4,'request\x20sent');logger[_0x3e70('0x16')](_0x3e70('0x17'),_0x4b5fd4,_0x3e70('0x18'),JSON[_0x3e70('0x19')](_0x116dec));if(_0x116dec[_0x3e70('0x1a')]){if(_0x116dec['error']['code']===0x1f4){logger[_0x3e70('0x1a')](_0x3e70('0x15'),_0x4b5fd4,_0x116dec[_0x3e70('0x1a')][_0x3e70('0x1b')]);return _0x3db940(_0x116dec[_0x3e70('0x1a')]['message']);}logger[_0x3e70('0x1a')](_0x3e70('0x15'),_0x4b5fd4,_0x116dec['error'][_0x3e70('0x1b')]);return _0xa60173(_0x116dec['error'][_0x3e70('0x1b')]);}else{logger[_0x3e70('0x14')](_0x3e70('0x15'),_0x4b5fd4,_0x3e70('0x18'));_0xa60173(_0x116dec[_0x3e70('0x1c')][_0x3e70('0x1b')]);}})['catch'](function(_0x17a82f){logger[_0x3e70('0x1a')](_0x3e70('0x15'),_0x4b5fd4,_0x17a82f);_0x3db940(_0x17a82f);});});} \ No newline at end of file +var _0x8def=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x98cb08,_0x3212b4){var _0x23473c=function(_0x4074f1){while(--_0x4074f1){_0x98cb08['push'](_0x98cb08['shift']());}};_0x23473c(++_0x3212b4);}(_0x8def,0x17a));var _0xf8de=function(_0xe5e2a2,_0x351da6){_0xe5e2a2=_0xe5e2a2-0x0;var _0x29f668=_0x8def[_0xe5e2a2];return _0x29f668;};'use strict';var _=require(_0xf8de('0x0'));var util=require(_0xf8de('0x1'));var moment=require(_0xf8de('0x2'));var BPromise=require(_0xf8de('0x3'));var rs=require(_0xf8de('0x4'));var fs=require('fs');var Redis=require(_0xf8de('0x5'));var db=require(_0xf8de('0x6'))['db'];var utils=require(_0xf8de('0x7'));var logger=require(_0xf8de('0x8'))(_0xf8de('0x9'));var config=require(_0xf8de('0xa'));var jayson=require(_0xf8de('0xb'));var client=jayson['client'][_0xf8de('0xc')]({'port':0x232a});config[_0xf8de('0xd')]=_[_0xf8de('0xe')](config[_0xf8de('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf8de('0xf'))(new Redis(config[_0xf8de('0xd')]));require('./userNotification.socket')[_0xf8de('0x10')](socket);function respondWithRpcPromise(_0x3126d2,_0x542968,_0x79606d){return new BPromise(function(_0x1009f0,_0x4529ee){return client[_0xf8de('0x11')](_0x3126d2,_0x79606d)[_0xf8de('0x12')](function(_0x543b13){logger[_0xf8de('0x13')](_0xf8de('0x14'),_0x542968,_0xf8de('0x15'));logger[_0xf8de('0x16')](_0xf8de('0x17'),_0x542968,'request\x20sent',JSON[_0xf8de('0x18')](_0x543b13));if(_0x543b13[_0xf8de('0x19')]){if(_0x543b13[_0xf8de('0x19')][_0xf8de('0x1a')]===0x1f4){logger[_0xf8de('0x19')](_0xf8de('0x14'),_0x542968,_0x543b13[_0xf8de('0x19')][_0xf8de('0x1b')]);return _0x4529ee(_0x543b13['error'][_0xf8de('0x1b')]);}logger[_0xf8de('0x19')]('UserNotification,\x20%s,\x20%s',_0x542968,_0x543b13[_0xf8de('0x19')][_0xf8de('0x1b')]);return _0x1009f0(_0x543b13[_0xf8de('0x19')][_0xf8de('0x1b')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x542968,_0xf8de('0x15'));_0x1009f0(_0x543b13[_0xf8de('0x1c')][_0xf8de('0x1b')]);}})['catch'](function(_0x4b14b8){logger[_0xf8de('0x19')](_0xf8de('0x14'),_0x542968,_0x4b14b8);_0x4529ee(_0x4b14b8);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 6bfda19..1c21918 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39c7=['update','removeListener','userNotification:','save','remove'];(function(_0x29a3e7,_0x27c4f5){var _0x5137c0=function(_0x31b254){while(--_0x31b254){_0x29a3e7['push'](_0x29a3e7['shift']());}};_0x5137c0(++_0x27c4f5);}(_0x39c7,0x85));var _0x739c=function(_0x542d87,_0x3f1428){_0x542d87=_0x542d87-0x0;var _0x18f154=_0x39c7[_0x542d87];return _0x18f154;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x739c('0x0'),_0x739c('0x1'),_0x739c('0x2')];function createListener(_0x25fdf5,_0xfadce8){return function(_0x18d787){_0xfadce8['emit'](_0x25fdf5,_0x18d787);};}function removeListener(_0x11c0a6,_0xff8215){return function(){UserNotificationEvents[_0x739c('0x3')](_0x11c0a6,_0xff8215);};}exports['register']=function(_0x4c5030){for(var _0x1923d9=0x0,_0x3c0af1=events['length'];_0x1923d9<_0x3c0af1;_0x1923d9++){var _0x480159=events[_0x1923d9];var _0x27c5a4=createListener(_0x739c('0x4')+_0x480159,_0x4c5030);UserNotificationEvents['on'](_0x480159,_0x27c5a4);}}; \ No newline at end of file +var _0xf966=['remove','removeListener','length','userNotification:','./userNotification.events','save'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xf966,0x184));var _0x6f96=function(_0x4f09b2,_0x175cd2){_0x4f09b2=_0x4f09b2-0x0;var _0x10233e=_0xf966[_0x4f09b2];return _0x10233e;};'use strict';var UserNotificationEvents=require(_0x6f96('0x0'));var events=[_0x6f96('0x1'),_0x6f96('0x2'),'update'];function createListener(_0x452aad,_0x154716){return function(_0x22fbb3){_0x154716['emit'](_0x452aad,_0x22fbb3);};}function removeListener(_0x1820d1,_0x33a4e6){return function(){UserNotificationEvents[_0x6f96('0x3')](_0x1820d1,_0x33a4e6);};}exports['register']=function(_0x19f355){for(var _0x34284f=0x0,_0x652db3=events[_0x6f96('0x4')];_0x34284f<_0x652db3;_0x34284f++){var _0x2e62e6=events[_0x34284f];var _0x663c1f=createListener(_0x6f96('0x5')+_0x2e62e6,_0x19f355);UserNotificationEvents['on'](_0x2e62e6,_0x663c1f);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 71c617b..a5d8f96 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 _0x9fda=['Router','../../config/environment','exports','path','connect-timeout','express'];(function(_0x5a7bb6,_0x412e93){var _0x30ab63=function(_0x1f9768){while(--_0x1f9768){_0x5a7bb6['push'](_0x5a7bb6['shift']());}};_0x30ab63(++_0x412e93);}(_0x9fda,0x135));var _0xa9fd=function(_0xc223cf,_0xd8d638){_0xc223cf=_0xc223cf-0x0;var _0x2afa4a=_0x9fda[_0xc223cf];return _0x2afa4a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa9fd('0x0'));var timeout=require(_0xa9fd('0x1'));var express=require(_0xa9fd('0x2'));var router=express[_0xa9fd('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa9fd('0x4'));module[_0xa9fd('0x5')]=router; \ No newline at end of file +var _0x4e75=['../../components/interaction/service','multer','express','Router','../../components/auth/service'];(function(_0x460386,_0x553ec4){var _0x326666=function(_0x1bb173){while(--_0x1bb173){_0x460386['push'](_0x460386['shift']());}};_0x326666(++_0x553ec4);}(_0x4e75,0xc9));var _0x54e7=function(_0x1bbce9,_0x42c497){_0x1bbce9=_0x1bbce9-0x0;var _0x471f42=_0x4e75[_0x1bbce9];return _0x471f42;};'use strict';var multer=require(_0x54e7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x54e7('0x1'));var router=express[_0x54e7('0x2')]();var auth=require(_0x54e7('0x3'));var interaction=require(_0x54e7('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index a2350ed..5502784 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(_0x4e7920,_0x25c606){var _0x38d50a=function(_0x3cc371){while(--_0x3cc371){_0x4e7920['push'](_0x4e7920['shift']());}};_0x38d50a(++_0x25c606);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x224c11,_0x4a94c7){var _0x2e8835=function(_0x4335e4){while(--_0x4335e4){_0x224c11['push'](_0x224c11['shift']());}};_0x2e8835(++_0x4a94c7);}(_0xe706,0xa3));var _0x6e70=function(_0x1fb9d2,_0x57a208){_0x1fb9d2=_0x1fb9d2-0x0;var _0x4a8916=_0xe706[_0x1fb9d2];return _0x4a8916;};'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/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index c55fb40..31903bf 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 _0xd9c7=['path','rimraf','../../config/environment','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x105386,_0x1e95b9){var _0x2cc279=function(_0xc31a36){while(--_0xc31a36){_0x105386['push'](_0x105386['shift']());}};_0x2cc279(++_0x1e95b9);}(_0xd9c7,0xd2));var _0x7d9c=function(_0x495756,_0x2418ea){_0x495756=_0x495756-0x0;var _0x51987c=_0xd9c7[_0x495756];return _0x51987c;};'use strict';var _=require(_0x7d9c('0x0'));var util=require(_0x7d9c('0x1'));var logger=require(_0x7d9c('0x2'))(_0x7d9c('0x3'));var moment=require('moment');var BPromise=require(_0x7d9c('0x4'));var rp=require(_0x7d9c('0x5'));var fs=require('fs');var path=require(_0x7d9c('0x6'));var rimraf=require(_0x7d9c('0x7'));var config=require(_0x7d9c('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x7d9c('0x9')]=function(_0x48c80f,_0x386294){return _0x48c80f['define'](_0x7d9c('0xa'),attributes,{'tableName':_0x7d9c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d7c=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','util'];(function(_0x5f0ff7,_0x7c04c1){var _0x40c25e=function(_0x356de9){while(--_0x356de9){_0x5f0ff7['push'](_0x5f0ff7['shift']());}};_0x40c25e(++_0x7c04c1);}(_0x1d7c,0x166));var _0xc1d7=function(_0x2d259a,_0x31068e){_0x2d259a=_0x2d259a-0x0;var _0x16f9d5=_0x1d7c[_0x2d259a];return _0x16f9d5;};'use strict';var _=require(_0xc1d7('0x0'));var util=require(_0xc1d7('0x1'));var logger=require(_0xc1d7('0x2'))('api');var moment=require(_0xc1d7('0x3'));var BPromise=require(_0xc1d7('0x4'));var rp=require(_0xc1d7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1d7('0x6'));var config=require(_0xc1d7('0x7'));var attributes=require(_0xc1d7('0x8'));module[_0xc1d7('0x9')]=function(_0xda5f67,_0x125799){return _0xda5f67[_0xc1d7('0xa')](_0xc1d7('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index c0b0a1b..bdbeb77 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 _0xf34d=['debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xf34d,0xbb));var _0xdf34=function(_0x44f6a8,_0x27f23e){_0x44f6a8=_0x44f6a8-0x0;var _0x3fce19=_0xf34d[_0x44f6a8];return _0x3fce19;};'use strict';var _=require(_0xdf34('0x0'));var util=require('util');var moment=require(_0xdf34('0x1'));var BPromise=require(_0xdf34('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf34('0x3'))['db'];var utils=require(_0xdf34('0x4'));var logger=require(_0xdf34('0x5'))('rpc');var config=require(_0xdf34('0x6'));var jayson=require(_0xdf34('0x7'));var client=jayson[_0xdf34('0x8')][_0xdf34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe5d007,_0x5b158b,_0x52f44d){return new BPromise(function(_0x591ced,_0x454f68){return client['request'](_0xe5d007,_0x52f44d)[_0xdf34('0xa')](function(_0x1fadbc){logger[_0xdf34('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5b158b,_0xdf34('0xc'));logger[_0xdf34('0xd')](_0xdf34('0xe'),_0x5b158b,'request\x20sent',JSON[_0xdf34('0xf')](_0x1fadbc));if(_0x1fadbc[_0xdf34('0x10')]){if(_0x1fadbc['error']['code']===0x1f4){logger['error'](_0xdf34('0x11'),_0x5b158b,_0x1fadbc[_0xdf34('0x10')][_0xdf34('0x12')]);return _0x454f68(_0x1fadbc[_0xdf34('0x10')][_0xdf34('0x12')]);}logger['error'](_0xdf34('0x11'),_0x5b158b,_0x1fadbc[_0xdf34('0x10')][_0xdf34('0x12')]);return _0x591ced(_0x1fadbc[_0xdf34('0x10')][_0xdf34('0x12')]);}else{logger[_0xdf34('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5b158b,'request\x20sent');_0x591ced(_0x1fadbc['result'][_0xdf34('0x12')]);}})[_0xdf34('0x13')](function(_0x162e2b){logger[_0xdf34('0x10')](_0xdf34('0x11'),_0x5b158b,_0x162e2b);_0x454f68(_0x162e2b);});});} \ No newline at end of file +var _0xddca=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','info','catch','lodash','util','moment'];(function(_0x302a84,_0xfaf37c){var _0x28ef60=function(_0x3981e8){while(--_0x3981e8){_0x302a84['push'](_0x302a84['shift']());}};_0x28ef60(++_0xfaf37c);}(_0xddca,0x18c));var _0xaddc=function(_0x58cf87,_0x3d57cb){_0x58cf87=_0x58cf87-0x0;var _0x5f2e3f=_0xddca[_0x58cf87];return _0x5f2e3f;};'use strict';var _=require(_0xaddc('0x0'));var util=require(_0xaddc('0x1'));var moment=require(_0xaddc('0x2'));var BPromise=require(_0xaddc('0x3'));var rs=require(_0xaddc('0x4'));var fs=require('fs');var Redis=require(_0xaddc('0x5'));var db=require(_0xaddc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaddc('0x7'))(_0xaddc('0x8'));var config=require('../../config/environment');var jayson=require(_0xaddc('0x9'));var client=jayson[_0xaddc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50a22d,_0x3dea47,_0x4aac15){return new BPromise(function(_0x28afac,_0x2fd0e6){return client['request'](_0x50a22d,_0x4aac15)[_0xaddc('0xb')](function(_0x2a243e){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x3dea47,_0xaddc('0xc'));logger['debug'](_0xaddc('0xd'),_0x3dea47,'request\x20sent',JSON[_0xaddc('0xe')](_0x2a243e));if(_0x2a243e['error']){if(_0x2a243e[_0xaddc('0xf')][_0xaddc('0x10')]===0x1f4){logger['error'](_0xaddc('0x11'),_0x3dea47,_0x2a243e[_0xaddc('0xf')][_0xaddc('0x12')]);return _0x2fd0e6(_0x2a243e['error']['message']);}logger[_0xaddc('0xf')](_0xaddc('0x11'),_0x3dea47,_0x2a243e[_0xaddc('0xf')][_0xaddc('0x12')]);return _0x28afac(_0x2a243e['error'][_0xaddc('0x12')]);}else{logger[_0xaddc('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3dea47,'request\x20sent');_0x28afac(_0x2a243e['result'][_0xaddc('0x12')]);}})[_0xaddc('0x14')](function(_0x18c90a){logger['error'](_0xaddc('0x11'),_0x3dea47,_0x18c90a);_0x2fd0e6(_0x18c90a);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 697b299..4a7cde8 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 _0x338d=['index','/:id','show','/:id/sections','/:id/resources','getResources','create','clone','post','addResources','put','destroy','delete','removeSections','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x338d,0x6b));var _0xd338=function(_0x12f842,_0x1aa202){_0x12f842=_0x12f842-0x0;var _0x2fd3ac=_0x338d[_0x12f842];return _0x2fd3ac;};'use strict';var multer=require(_0xd338('0x0'));var util=require(_0xd338('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd338('0x2'));var router=express[_0xd338('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd338('0x4'));var config=require(_0xd338('0x5'));var controller=require('./userProfile.controller');router[_0xd338('0x6')]('/',auth[_0xd338('0x7')](),controller[_0xd338('0x8')]);router[_0xd338('0x6')]('/describe',auth[_0xd338('0x7')](),controller['describe']);router[_0xd338('0x6')](_0xd338('0x9'),auth[_0xd338('0x7')](),controller[_0xd338('0xa')]);router[_0xd338('0x6')](_0xd338('0xb'),auth[_0xd338('0x7')](),controller['getSections']);router[_0xd338('0x6')](_0xd338('0xc'),auth[_0xd338('0x7')](),controller[_0xd338('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd338('0xe')]);router['post']('/:id/clone',auth[_0xd338('0x7')](),controller[_0xd338('0xf')]);router[_0xd338('0x10')](_0xd338('0xb'),auth[_0xd338('0x7')](),controller['addSections']);router[_0xd338('0x10')](_0xd338('0xc'),auth[_0xd338('0x7')](),controller[_0xd338('0x11')]);router[_0xd338('0x12')]('/:id',auth[_0xd338('0x7')](),controller['update']);router['delete'](_0xd338('0x9'),auth[_0xd338('0x7')](),controller[_0xd338('0x13')]);router[_0xd338('0x14')](_0xd338('0xb'),auth[_0xd338('0x7')](),controller[_0xd338('0x15')]);router[_0xd338('0x14')](_0xd338('0xc'),auth[_0xd338('0x7')](),controller['removeResources']);module[_0xd338('0x16')]=router; \ No newline at end of file +var _0x23f9=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','put','update','delete','destroy','removeResources','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x23f9,0x196));var _0x923f=function(_0x1b87cf,_0x9b5f31){_0x1b87cf=_0x1b87cf-0x0;var _0x48ac68=_0x23f9[_0x1b87cf];return _0x48ac68;};'use strict';var multer=require(_0x923f('0x0'));var util=require('util');var path=require(_0x923f('0x1'));var timeout=require(_0x923f('0x2'));var express=require(_0x923f('0x3'));var router=express[_0x923f('0x4')]();var auth=require(_0x923f('0x5'));var interaction=require(_0x923f('0x6'));var config=require('../../config/environment');var controller=require(_0x923f('0x7'));router[_0x923f('0x8')]('/',auth[_0x923f('0x9')](),controller[_0x923f('0xa')]);router[_0x923f('0x8')](_0x923f('0xb'),auth[_0x923f('0x9')](),controller['describe']);router['get'](_0x923f('0xc'),auth[_0x923f('0x9')](),controller[_0x923f('0xd')]);router['get'](_0x923f('0xe'),auth['isAuthenticated'](),controller[_0x923f('0xf')]);router[_0x923f('0x8')](_0x923f('0x10'),auth[_0x923f('0x9')](),controller[_0x923f('0x11')]);router[_0x923f('0x12')]('/',auth[_0x923f('0x9')](),controller[_0x923f('0x13')]);router['post'](_0x923f('0x14'),auth[_0x923f('0x9')](),controller['clone']);router[_0x923f('0x12')](_0x923f('0xe'),auth[_0x923f('0x9')](),controller[_0x923f('0x15')]);router[_0x923f('0x12')](_0x923f('0x10'),auth[_0x923f('0x9')](),controller[_0x923f('0x16')]);router[_0x923f('0x17')]('/:id',auth[_0x923f('0x9')](),controller[_0x923f('0x18')]);router[_0x923f('0x19')](_0x923f('0xc'),auth['isAuthenticated'](),controller[_0x923f('0x1a')]);router[_0x923f('0x19')](_0x923f('0xe'),auth[_0x923f('0x9')](),controller['removeSections']);router[_0x923f('0x19')](_0x923f('0x10'),auth[_0x923f('0x9')](),controller[_0x923f('0x1b')]);module[_0x923f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 0861fc8..7a5baa4 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 _0x662c=['split','exports','STRING','name','setDataValue','getDataValue','crudPermissions'];(function(_0x330c9b,_0x5f59c4){var _0x5bdbf7=function(_0x32dd52){while(--_0x32dd52){_0x330c9b['push'](_0x330c9b['shift']());}};_0x5bdbf7(++_0x5f59c4);}(_0x662c,0x1e4));var _0xc662=function(_0x6d61fe,_0x23787b){_0x6d61fe=_0x6d61fe-0x0;var _0x4fbbe8=_0x662c[_0x6d61fe];return _0x4fbbe8;};'use strict';var Sequelize=require('sequelize');module[_0xc662('0x0')]={'name':{'type':Sequelize[_0xc662('0x1')],'allowNull':![],'unique':_0xc662('0x2')},'crudPermissions':{'type':Sequelize[_0xc662('0x1')],'set':function(_0x39effa){this[_0xc662('0x3')]('crudPermissions',_0x39effa?_0x39effa['join'](''):[]);},'get':function(){return this[_0xc662('0x4')](_0xc662('0x5'))?this['getDataValue'](_0xc662('0x5'))[_0xc662('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x6124=['sequelize','exports','STRING','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x3d17ae,_0x452be3){var _0x54fac8=function(_0x480bec){while(--_0x480bec){_0x3d17ae['push'](_0x3d17ae['shift']());}};_0x54fac8(++_0x452be3);}(_0x6124,0x140));var _0x4612=function(_0x14d8d1,_0x3e4e33){_0x14d8d1=_0x14d8d1-0x0;var _0x44bbb5=_0x6124[_0x14d8d1];return _0x44bbb5;};'use strict';var Sequelize=require(_0x4612('0x0'));module[_0x4612('0x1')]={'name':{'type':Sequelize[_0x4612('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x4612('0x2')],'set':function(_0x75f2e){this[_0x4612('0x3')](_0x4612('0x4'),_0x75f2e?_0x75f2e[_0x4612('0x5')](''):[]);},'get':function(){return this[_0x4612('0x6')](_0x4612('0x4'))?this['getDataValue'](_0x4612('0x4'))[_0x4612('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4612('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 8f7b85f..38b816e 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 _0x09d8=['transaction','each','autoAssociation','UserProfileResource','userProfileId','UserProfileSection','Resources','destroy','addSections','sectionId','push','removeSections','getSections','isEmpty','includes','subsections','enabled','forEach','Plugin','addResources','sequelize','bulkCreate','removeResources','getResources','section','ValidationError','mergeResources','undefined','Sequelize','parentSections','findOne','all','ignore','union','childModel','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','rows','CmContact','Tag','Tags','color','tag','ThroughTags','value','resourceId','toLowerCase','squareprojects','SquareProject','SquareOdbc','squarerecordings','JscriptyProject','contacts','ListId','lists','CmList','globalcustomfields','CmCustomField','chatqueues','FaxQueue','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','Schedule','sounds','tags','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','error','stack','name','send','index','map','UserProfile','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','catch','show','include','options','create','clone','params','length','find','get','updatedAt','crudPermissions','body','omit','createdAt'];(function(_0x569542,_0x54cf78){var _0x44b783=function(_0x1ab6d4){while(--_0x1ab6d4){_0x569542['push'](_0x569542['shift']());}};_0x44b783(++_0x54cf78);}(_0x09d8,0x91));var _0x809d=function(_0x52aaaa,_0x3724a5){_0x52aaaa=_0x52aaaa-0x0;var _0x495270=_0x09d8[_0x52aaaa];return _0x495270;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x809d('0x0'));var rimraf=require(_0x809d('0x1'));var zipdir=require(_0x809d('0x2'));var jsonpatch=require(_0x809d('0x3'));var rp=require(_0x809d('0x4'));var moment=require(_0x809d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x809d('0x6'));var util=require(_0x809d('0x7'));var path=require('path');var sox=require(_0x809d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x809d('0x9'));var squel=require(_0x809d('0xa'));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(_0x809d('0xb'));var authService=require(_0x809d('0xc'));var qs=require(_0x809d('0xd'));var as=require(_0x809d('0xe'));var hardwareService=require(_0x809d('0xf'));var logger=require('../../config/logger')(_0x809d('0x10'));var utils=require(_0x809d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x809d('0x12'));var db=require(_0x809d('0x13'))['db'];config['redis']=_[_0x809d('0x14')](config[_0x809d('0x15')],{'host':_0x809d('0x16'),'port':0x18eb});var socket=require(_0x809d('0x17'))(new Redis(config[_0x809d('0x15')]));require('./userProfile.socket')[_0x809d('0x18')](socket);function respondWithStatusCode(_0x5086e2,_0x55cdce){_0x55cdce=_0x55cdce||0xcc;return function(_0x5c74e5){if(_0x5c74e5){return _0x5086e2[_0x809d('0x19')](_0x55cdce);}return _0x5086e2[_0x809d('0x1a')](_0x55cdce)[_0x809d('0x1b')]();};}function respondWithResult(_0x41c9cf,_0x4ca28c){_0x4ca28c=_0x4ca28c||0xc8;return function(_0xd77122){if(_0xd77122){return _0x41c9cf['status'](_0x4ca28c)[_0x809d('0x1c')](_0xd77122);}};}function respondWithFilteredResult(_0x106dcd,_0x2410e1){return function(_0x2ad04f){if(_0x2ad04f){var _0x25c969=_0x2ad04f[_0x809d('0x1d')],_0x42463e=_0x2410e1[_0x809d('0x1e')],_0x1c315c=_0x2410e1['offset']+_0x2410e1[_0x809d('0x1f')],_0x3a45c7;if(_0x1c315c>=_0x25c969){_0x1c315c=_0x25c969;_0x3a45c7=0xc8;}else{_0x3a45c7=0xce;}_0x106dcd['status'](_0x3a45c7);return _0x106dcd['set'](_0x809d('0x20'),_0x42463e+'-'+_0x1c315c+'/'+_0x25c969)[_0x809d('0x1c')](_0x2ad04f);}return null;};}function patchUpdates(_0x4e6f12){return function(_0x572800){try{jsonpatch[_0x809d('0x21')](_0x572800,_0x4e6f12,!![]);}catch(_0xc20600){return BPromise['reject'](_0xc20600);}return _0x572800['save']();};}function saveUpdates(_0x34caef,_0x5ae597){return function(_0x1dc352){if(_0x1dc352){return _0x1dc352[_0x809d('0x22')](_0x34caef)[_0x809d('0x23')](function(_0x538e65){return _0x538e65;});}return null;};}function removeEntity(_0x44eab4,_0x20d752){return function(_0x549144){if(_0x549144){return _0x549144['destroy']()[_0x809d('0x23')](function(){_0x44eab4[_0x809d('0x1a')](0xcc)[_0x809d('0x1b')]();});}};}function handleEntityNotFound(_0x55b8fe,_0x27a57e){return function(_0x3a3de5){if(!_0x3a3de5){_0x55b8fe[_0x809d('0x19')](0x194);}return _0x3a3de5;};}function handleError(_0x2b16c4,_0x3bbd0f){_0x3bbd0f=_0x3bbd0f||0x1f4;return function(_0x483ad8){logger[_0x809d('0x24')](_0x483ad8[_0x809d('0x25')]);if(_0x483ad8[_0x809d('0x26')]){delete _0x483ad8['name'];}_0x2b16c4[_0x809d('0x1a')](_0x3bbd0f)[_0x809d('0x27')](_0x483ad8);};}exports[_0x809d('0x28')]=function(_0x15d58a,_0x25ada7){var _0x4625fd={},_0x46d28a={},_0x2a4a03={'count':0x0,'rows':[]};var _0x34e128=_[_0x809d('0x29')](db[_0x809d('0x2a')][_0x809d('0x2b')],function(_0x2dd596){return{'name':_0x2dd596['fieldName'],'type':_0x2dd596[_0x809d('0x2c')][_0x809d('0x2d')]};});_0x46d28a[_0x809d('0x2e')]=_[_0x809d('0x29')](_0x34e128,_0x809d('0x26'));_0x46d28a['query']=_[_0x809d('0x2f')](_0x15d58a[_0x809d('0x30')]);_0x46d28a['filters']=_[_0x809d('0x31')](_0x46d28a[_0x809d('0x2e')],_0x46d28a[_0x809d('0x30')]);_0x4625fd['attributes']=_[_0x809d('0x31')](_0x46d28a['model'],qs[_0x809d('0x32')](_0x15d58a[_0x809d('0x30')]['fields']));_0x4625fd[_0x809d('0x33')]=_0x4625fd[_0x809d('0x33')]['length']?_0x4625fd[_0x809d('0x33')]:_0x46d28a['model'];if(!_0x15d58a[_0x809d('0x30')][_0x809d('0x34')](_0x809d('0x35'))){_0x4625fd['limit']=qs['limit'](_0x15d58a[_0x809d('0x30')][_0x809d('0x1f')]);_0x4625fd[_0x809d('0x1e')]=qs[_0x809d('0x1e')](_0x15d58a[_0x809d('0x30')][_0x809d('0x1e')]);}_0x4625fd[_0x809d('0x36')]=qs[_0x809d('0x37')](_0x15d58a[_0x809d('0x30')]['sort']);_0x4625fd[_0x809d('0x38')]=qs['filters'](_['pick'](_0x15d58a[_0x809d('0x30')],_0x46d28a[_0x809d('0x39')]),_0x34e128);if(_0x15d58a['query'][_0x809d('0x3a')]){_0x4625fd['where']=_[_0x809d('0x3b')](_0x4625fd[_0x809d('0x38')],{'$or':_[_0x809d('0x29')](_0x34e128,function(_0x1bd54f){if(_0x1bd54f[_0x809d('0x2c')]!==_0x809d('0x3c')){var _0x37572c={};_0x37572c[_0x1bd54f[_0x809d('0x26')]]={'$like':'%'+_0x15d58a[_0x809d('0x30')][_0x809d('0x3a')]+'%'};return _0x37572c;}})});}_0x4625fd=_[_0x809d('0x3b')]({},_0x4625fd,_0x15d58a['options']);var _0x450476={'where':_0x4625fd[_0x809d('0x38')]};return db[_0x809d('0x2a')][_0x809d('0x1d')](_0x450476)[_0x809d('0x23')](function(_0x5e3b2c){_0x2a4a03[_0x809d('0x1d')]=_0x5e3b2c;if(_0x15d58a[_0x809d('0x30')][_0x809d('0x3d')]){_0x4625fd['include']=[{'all':!![]}];}return db[_0x809d('0x2a')][_0x809d('0x3e')](_0x4625fd);})[_0x809d('0x23')](function(_0x2c6b89){_0x2a4a03['rows']=_0x2c6b89;return _0x2a4a03;})[_0x809d('0x23')](respondWithFilteredResult(_0x25ada7,_0x4625fd))[_0x809d('0x3f')](handleError(_0x25ada7,null));};exports[_0x809d('0x40')]=function(_0xff63b0,_0xeba272){var _0x516736={'raw':![],'where':{'id':_0xff63b0['params']['id']}},_0x28bb72={};_0x28bb72[_0x809d('0x2e')]=_[_0x809d('0x2f')](db[_0x809d('0x2a')]['rawAttributes']);_0x28bb72[_0x809d('0x30')]=_['keys'](_0xff63b0[_0x809d('0x30')]);_0x28bb72[_0x809d('0x39')]=_[_0x809d('0x31')](_0x28bb72[_0x809d('0x2e')],_0x28bb72[_0x809d('0x30')]);_0x516736['attributes']=_[_0x809d('0x31')](_0x28bb72[_0x809d('0x2e')],qs[_0x809d('0x32')](_0xff63b0[_0x809d('0x30')][_0x809d('0x32')]));_0x516736[_0x809d('0x33')]=_0x516736[_0x809d('0x33')]['length']?_0x516736[_0x809d('0x33')]:_0x28bb72['model'];if(_0xff63b0[_0x809d('0x30')][_0x809d('0x3d')]){_0x516736[_0x809d('0x41')]=[{'all':!![]}];}_0x516736=_[_0x809d('0x3b')]({},_0x516736,_0xff63b0[_0x809d('0x42')]);return db['UserProfile']['find'](_0x516736)[_0x809d('0x23')](handleEntityNotFound(_0xeba272,null))[_0x809d('0x23')](respondWithResult(_0xeba272,null))['catch'](handleError(_0xeba272,null));};exports[_0x809d('0x43')]=function(_0x275207,_0x108b37){return db['UserProfile'][_0x809d('0x43')](_0x275207['body'],{})[_0x809d('0x23')](respondWithResult(_0x108b37,0xc9))[_0x809d('0x3f')](handleError(_0x108b37,null));};exports[_0x809d('0x44')]=function(_0x10e4cf,_0x57523f){var _0x409b77={'where':{'id':_0x10e4cf[_0x809d('0x45')]['id']}},_0x2df25f={};_0x2df25f[_0x809d('0x2e')]=_[_0x809d('0x2f')](db[_0x809d('0x2a')]['rawAttributes']);_0x409b77[_0x809d('0x33')]=_[_0x809d('0x31')](_0x2df25f[_0x809d('0x2e')],qs[_0x809d('0x32')](_0x10e4cf[_0x809d('0x30')]['fields']));_0x409b77[_0x809d('0x33')]=_0x409b77[_0x809d('0x33')][_0x809d('0x46')]?_0x409b77[_0x809d('0x33')]:_0x2df25f[_0x809d('0x2e')];if(_0x10e4cf['query'][_0x809d('0x3d')]){_0x409b77['include']=[{'all':!![]}];}_0x409b77=_['merge']({},_0x409b77,_0x10e4cf[_0x809d('0x42')]);return db[_0x809d('0x2a')][_0x809d('0x47')](_0x409b77)['then'](handleEntityNotFound(_0x57523f,null))[_0x809d('0x23')](function(_0xf2f96f){if(_0xf2f96f){var _0x35b2b3=_0xf2f96f[_0x809d('0x48')]({'plain':!![]});_0x35b2b3=qs['omit'](_0x35b2b3,['id','createdAt',_0x809d('0x49'),_0x809d('0x4a')]);_0x10e4cf[_0x809d('0x4b')]=_[_0x809d('0x4c')](_0x10e4cf[_0x809d('0x4b')],['id',_0x809d('0x4d'),_0x809d('0x49')]);return db['sequelize'][_0x809d('0x4e')](function(_0x370d7b){return db['UserProfile'][_0x809d('0x43')](_[_0x809d('0x3b')](_0x35b2b3,_0x10e4cf['body']),{'include':_0x10e4cf['query'][_0x809d('0x3d')]?[{'all':!![]}]:undefined,'transaction':_0x370d7b})[_0x809d('0x23')](function(_0x11315f){var _0x55ac71=_0x11315f[_0x809d('0x48')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x10e4cf[_0x809d('0x45')]['id']},'raw':!![]})[_0x809d('0x23')](function(_0xb10cec){if(_0xb10cec){return BPromise[_0x809d('0x4f')](_0xb10cec,function(_0x9b3399){return new BPromise(function(_0x1cd9fd,_0x323440){if(_0x9b3399[_0x809d('0x50')]===null||_0x9b3399[_0x809d('0x50')]===0x1)_0x1cd9fd(null);return db[_0x809d('0x51')][_0x809d('0x3e')]({'where':{'sectionId':_0x9b3399['id']},'raw':!![]})[_0x809d('0x23')](function(_0x2d45f2){var _0x4df338=_[_0x809d('0x29')](_0x2d45f2,function(_0x3cd265){return qs[_0x809d('0x4c')](_0x3cd265,['id','createdAt',_0x809d('0x49'),'sectionId']);});_0x1cd9fd(_0x4df338);})['catch'](function(_0x3220a0){_0x323440(_0x3220a0);});})[_0x809d('0x23')](function(_0x4f8e2b){var _0x12d663=qs['omit'](_0x9b3399,['id',_0x809d('0x4d'),_0x809d('0x49')]);_0x12d663[_0x809d('0x52')]=_0x55ac71['id'];if(_0x4f8e2b)_0x12d663['Resources']=_0x4f8e2b;return _0x12d663;})[_0x809d('0x23')](function(_0x35886c){return db[_0x809d('0x53')]['create'](_0x35886c,{'include':[{'model':db['UserProfileResource'],'as':_0x809d('0x54')}],'raw':!![],'transaction':_0x370d7b});});})['then'](function(){return _0x55ac71;});}});});});}})[_0x809d('0x23')](respondWithResult(_0x57523f,0xc9))[_0x809d('0x3f')](handleError(_0x57523f,null));};exports[_0x809d('0x22')]=function(_0x405377,_0x3f3b28){if(_0x405377[_0x809d('0x4b')]['id']){delete _0x405377[_0x809d('0x4b')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x405377['params']['id']}})[_0x809d('0x23')](handleEntityNotFound(_0x3f3b28,null))[_0x809d('0x23')](saveUpdates(_0x405377[_0x809d('0x4b')],null))[_0x809d('0x23')](respondWithResult(_0x3f3b28,null))['catch'](handleError(_0x3f3b28,null));};exports[_0x809d('0x55')]=function(_0x17c845,_0x4c4096){return db[_0x809d('0x2a')]['find']({'where':{'id':_0x17c845[_0x809d('0x45')]['id']}})[_0x809d('0x23')](handleEntityNotFound(_0x4c4096,null))[_0x809d('0x23')](removeEntity(_0x4c4096,null))[_0x809d('0x3f')](handleError(_0x4c4096,null));};exports['describe']=function(_0x1a9e2d,_0x139810){return db[_0x809d('0x2a')]['describe']()[_0x809d('0x23')](respondWithResult(_0x139810,null))[_0x809d('0x3f')](handleError(_0x139810,null));};exports[_0x809d('0x56')]=function(_0x5eeb40,_0xcedba3){var _0x177e3b=_0x5eeb40[_0x809d('0x4b')];return db[_0x809d('0x2a')]['find']({'where':{'id':_0x5eeb40[_0x809d('0x45')]['id']}})['then'](handleEntityNotFound(_0xcedba3,null))['then'](function(_0x15bcce){if(_0x15bcce){return db['sequelize'][_0x809d('0x4e')](function(_0xc3eb88){return db['UserProfileSection'][_0x809d('0x55')]({'where':{'userProfileId':_0x5eeb40['params']['id'],'sectionId':_['map'](_0x177e3b,function(_0x3b06c6){return _0x3b06c6[_0x809d('0x57')];})},'transaction':_0xc3eb88})['then'](function(){var _0x5e2eb2=_[_0x809d('0x29')](_0x177e3b,function(_0x4cf0c2){_0x4cf0c2[_0x809d('0x52')]=_0x5eeb40[_0x809d('0x45')]['id'];return _0x4cf0c2;});var _0xd8fd86=[];return BPromise[_0x809d('0x4f')](_0x5e2eb2,function(_0x2869ec){return db['UserProfileSection'][_0x809d('0x43')](_0x2869ec,{'include':[{'model':db[_0x809d('0x51')],'as':'Resources'}],'raw':!![],'transaction':_0xc3eb88})['then'](function(_0x499ddd){_0xd8fd86[_0x809d('0x58')](_0x499ddd[_0x809d('0x48')]({'plain':!![]}));});})['then'](function(){return _0xd8fd86;});});});}})[_0x809d('0x23')](function(_0x464b7d){return _0x464b7d;})[_0x809d('0x23')](respondWithResult(_0xcedba3,null))['catch'](handleError(_0xcedba3,null));};exports[_0x809d('0x59')]=function(_0x47b406,_0x376bcb){var _0x29471f;return db[_0x809d('0x2a')][_0x809d('0x47')]({'where':{'id':_0x47b406['params']['id']},'attributes':['id',_0x809d('0x26')]})['then'](handleEntityNotFound(_0x376bcb,null))[_0x809d('0x23')](function(_0x1759d0){if(_0x1759d0){_0x29471f=_0x1759d0;return db[_0x809d('0x53')][_0x809d('0x55')]({'where':{'userProfileId':_0x47b406[_0x809d('0x45')]['id'],'sectionId':_0x47b406[_0x809d('0x30')]['ids']}});}})[_0x809d('0x23')](function(){return _0x29471f;})['then'](respondWithStatusCode(_0x376bcb,null))[_0x809d('0x3f')](handleError(_0x376bcb,null));};exports[_0x809d('0x5a')]=function(_0x15769b,_0x18bc1b){var _0x1b84d2=[];var _0x715c7c=[];return db[_0x809d('0x53')]['findAll']({'where':{'userProfileId':_0x15769b[_0x809d('0x45')]['id']},'raw':!![]})[_0x809d('0x23')](function(_0x874ac9){_0x1b84d2=_['filter'](_0x874ac9,function(_0x1de3ca){return _0x1de3ca['enabled']===0x1||_['includes']([0x3eb,0x709],_0x1de3ca['sectionId']);});if(!_[_0x809d('0x5b')](_0x1b84d2)){return _[_0x809d('0x29')](_0x1b84d2,function(_0x32388f){return _0x32388f[_0x809d('0x57')];});}else{return;}})['then'](function(_0x138fc4){if(_0x138fc4)_0x715c7c=_0x138fc4;if(_[_0x809d('0x5c')](_0x715c7c,0x64)){var _0x256c70=_['find'](_0x1b84d2,{'sectionId':0x64});return hasDefaultDashboard(_0x256c70)[_0x809d('0x23')](function(_0xa46abb){return _['map'](_0x1b84d2,function(_0x518c32){if(_0x518c32['sectionId']===0x64){_0x518c32[_0x809d('0x5d')]=_0xa46abb;}return _0x518c32;});});}else{return;}})[_0x809d('0x23')](function(_0x6d4eab){if(_0x6d4eab)_0x1b84d2=_0x6d4eab;if(_[_0x809d('0x5c')](_0x715c7c,0x3eb)){var _0x5e0bf8=_[_0x809d('0x47')](_0x1b84d2,{'sectionId':0x3eb});return getCustomDashboards(_0x5e0bf8)[_0x809d('0x23')](function(_0x758f1){return _[_0x809d('0x29')](_0x1b84d2,function(_0x1f7693){if(_0x5e0bf8[_0x809d('0x5e')]){if(_0x1f7693['sectionId']===0x3eb){_0x1f7693['subsections']=_0x758f1;}}else{if(_0x1f7693[_0x809d('0x57')]===0x64){_0x1f7693[_0x809d('0x5d')]=_0x758f1;}}return _0x1f7693;});});}else{return;}})[_0x809d('0x23')](function(_0x328dde){if(_0x328dde)_0x1b84d2=_0x328dde;if(_[_0x809d('0x5c')](_0x715c7c,0x709)){var _0x25a98a=_[_0x809d('0x47')](_0x1b84d2,{'sectionId':0x709});return getPlugins(_0x25a98a)['then'](function(_0x4bb598){if(_0x25a98a[_0x809d('0x5e')]){return _['map'](_0x1b84d2,function(_0x1f3941){if(_0x1f3941[_0x809d('0x57')]===0x709){_0x1f3941[_0x809d('0x5d')]=_0x4bb598;}return _0x1f3941;});}else{var _0x22f66f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4bb598};var _0x1b5ae6=_['map'](_0x1b84d2);_0x1b5ae6['push'](_0x22f66f);return _0x1b5ae6;}});}else{return;}})['then'](function(_0x239179){if(_0x239179)_0x1b84d2=_0x239179;return _['filter'](_0x1b84d2,[_0x809d('0x5e'),0x1]);})[_0x809d('0x23')](respondWithResult(_0x18bc1b,null))['catch'](handleError(_0x18bc1b,null));};function hasDefaultDashboard(_0x41688a){var _0x3a22e2=[0x65];return new BPromise(function(_0x2b2418,_0x530e64){try{if(_0x41688a['autoAssociation']){_0x2b2418(_0x3a22e2);}else{return db[_0x809d('0x51')]['findOne']({'where':{'sectionId':_0x41688a['id']},'raw':!![]})[_0x809d('0x23')](function(_0x158f7a){_0x158f7a?_0x2b2418(_0x3a22e2):_0x2b2418();});}}catch(_0x96c382){_0x530e64(_0x96c382);}});}function getCustomDashboards(_0x4c778c){var _0x122d6f=[];return new BPromise(function(_0x1613ef,_0x55b717){try{if(_0x4c778c[_0x809d('0x50')]){return db['Dashboard'][_0x809d('0x3e')]({'raw':!![]})[_0x809d('0x23')](function(_0x4590ea){_0x4590ea[_0x809d('0x5f')](function(_0x240205){_0x122d6f['push'](_0x240205['id']+0x1869f);});_0x1613ef(_0x122d6f);});}else{return db[_0x809d('0x51')][_0x809d('0x3e')]({'where':{'sectionId':_0x4c778c['id']},'raw':!![]})[_0x809d('0x23')](function(_0x3d9789){_0x3d9789['forEach'](function(_0x3afa17){_0x122d6f['push'](_0x3afa17['resourceId']+0x1869f);});_0x1613ef(_0x122d6f);});}}catch(_0x3887e3){_0x55b717(_0x3887e3);}});}function getPlugins(_0xfb24dc){var _0x1ec36e=[];return new BPromise(function(_0x4bef14,_0x129ce2){try{if(_0xfb24dc['autoAssociation']){return db[_0x809d('0x60')]['findAll']({'raw':!![]})[_0x809d('0x23')](function(_0x200ca7){_0x200ca7[_0x809d('0x5f')](function(_0x3e08ff){_0x1ec36e[_0x809d('0x58')](_0x3e08ff['id']+0x15b38);});_0x4bef14(_0x1ec36e);});}else{return db[_0x809d('0x51')][_0x809d('0x3e')]({'where':{'sectionId':_0xfb24dc['id']},'raw':!![]})[_0x809d('0x23')](function(_0x2a0f80){_0x2a0f80[_0x809d('0x5f')](function(_0x40c125){_0x1ec36e[_0x809d('0x58')](_0x40c125['resourceId']+0x15b38);});_0x4bef14(_0x1ec36e);});}}catch(_0x135df7){_0x129ce2(_0x135df7);}});}exports[_0x809d('0x61')]=function(_0x4382aa,_0x245ad2){return db[_0x809d('0x2a')][_0x809d('0x47')]({'where':{'id':_0x4382aa[_0x809d('0x45')]['id']}})[_0x809d('0x23')](handleEntityNotFound(_0x245ad2,null))[_0x809d('0x23')](function(_0x416893){if(_0x416893){return db[_0x809d('0x62')][_0x809d('0x4e')](function(_0x2a7f3f){return db[_0x809d('0x53')][_0x809d('0x3e')]({'where':{'userProfileId':_0x4382aa[_0x809d('0x45')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x3fafac){if(_0x3fafac){return db[_0x809d('0x53')][_0x809d('0x55')]({'where':{'userProfileId':_0x4382aa[_0x809d('0x45')]['id'],'id':_[_0x809d('0x29')](_0x3fafac,function(_0x512897){return _0x512897['id'];})},'transaction':_0x2a7f3f});}})[_0x809d('0x23')](function(_0x7f536c){var _0x16b216=_['map'](_0x4382aa[_0x809d('0x4b')],function(_0x4de6eb){_0x4de6eb[_0x809d('0x52')]=_0x4382aa[_0x809d('0x45')]['id'];return _0x4de6eb;});return db[_0x809d('0x53')][_0x809d('0x63')](_0x16b216,{'raw':!![],'transaction':_0x2a7f3f});})[_0x809d('0x23')](function(_0x1946f3){var _0x24af72=_[_0x809d('0x3a')](_['map'](_0x1946f3,function(_0x123961){return _0x123961[_0x809d('0x48')]({'plain':!![]});}),{'includeAll':![]});if(_0x24af72){return db[_0x809d('0x53')][_0x809d('0x3e')]({'where':{'userProfileId':_0x4382aa['params']['id'],'sectionId':_[_0x809d('0x29')](_0x24af72,function(_0x341b3e){return _0x341b3e[_0x809d('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x809d('0x23')](function(_0x4a8ac2){var _0x14353c=_[_0x809d('0x29')](_0x4382aa['body'],function(_0x596983){_0x596983[_0x809d('0x52')]=_0x4382aa[_0x809d('0x45')]['id'];return _0x596983;});return db[_0x809d('0x51')]['bulkCreate'](_0x14353c,{'raw':!![],'transaction':_0x2a7f3f});});}})[_0x809d('0x3f')](handleError(_0x245ad2,null));});}})[_0x809d('0x23')](function(_0x430e00){var _0x49c80a=_[_0x809d('0x29')](_0x430e00,function(_0x33fc9e){return _0x33fc9e[_0x809d('0x48')]({'plain':!![]});});})[_0x809d('0x23')](respondWithResult(_0x245ad2,null))[_0x809d('0x3f')](handleError(_0x245ad2,null));};exports[_0x809d('0x64')]=function(_0x4d68e1,_0x200e64,_0x2d3101){return db[_0x809d('0x2a')][_0x809d('0x47')]({'where':{'id':_0x4d68e1[_0x809d('0x45')]['id']}})['then'](handleEntityNotFound(_0x200e64,null))[_0x809d('0x23')](function(_0x34ad37){if(_0x34ad37){return _0x34ad37['removeResources'](_0x4d68e1['query']['ids']);}})[_0x809d('0x23')](respondWithStatusCode(_0x200e64,null))[_0x809d('0x3f')](handleError(_0x200e64,null));};exports[_0x809d('0x65')]=function(_0x565dc0,_0x3fbb87){var _0x84abc6={'raw':![],'where':{}};var _0x285d03={};var _0x323193={'count':0x0,'rows':[]};var _0x5d42d5=_0x565dc0[_0x809d('0x30')][_0x809d('0x66')];if(typeof _0x5d42d5==='undefined'){throw new db['Sequelize'][(_0x809d('0x67'))]('Unknown\x20section');}var _0x1c3e19=_0x565dc0[_0x809d('0x30')][_0x809d('0x68')]||![];var _0x3b843e=getQueryModels(_0x5d42d5,_0x1c3e19);if(typeof _0x3b843e['childModel']===_0x809d('0x69')){throw new db[(_0x809d('0x6a'))][(_0x809d('0x67'))]('Invalid\x20section\x20\x27'+_0x5d42d5+'\x27');}var _0x82e5d8=[];if(!_[_0x809d('0x5b')](_0x3b843e[_0x809d('0x6b')])){_0x82e5d8=_0x3b843e[_0x809d('0x6b')];}else{_0x82e5d8=[{'name':_0x5d42d5}];}return db[_0x809d('0x2a')][_0x809d('0x6c')]({'where':{'id':_0x565dc0[_0x809d('0x45')]['id']}})[_0x809d('0x23')](handleEntityNotFound(_0x3fbb87,null))[_0x809d('0x23')](function(_0x226a4b){if(_0x226a4b){var _0x3c7e42=[];for(var _0x42cbb4=0x0;_0x42cbb4<_0x82e5d8[_0x809d('0x46')];_0x42cbb4++){_0x3c7e42[_0x809d('0x58')](db[_0x809d('0x53')][_0x809d('0x6c')]({'where':{'userProfileId':_0x226a4b['id'],'name':_0x82e5d8[_0x42cbb4]['name']},'raw':!![]}));}return BPromise[_0x809d('0x6d')](_0x3c7e42);}})[_0x809d('0x23')](function(_0x2c4e71){var _0xd5c043=_[_0x809d('0x3a')](_0x2c4e71,function(_0x453ab3){return _0x453ab3?_0x453ab3:undefined;});var _0x48e4d1=_[_0x809d('0x3a')](_0x82e5d8,[_0x809d('0x6e'),!![]]);var _0x1297d7=_[_0x809d('0x5b')](_0xd5c043)&&_[_0x809d('0x5b')](_0x48e4d1)?null:_[_0x809d('0x6f')](_0x48e4d1,_0xd5c043);if(_0x1297d7){var _0x46202f=[];for(var _0x29cc05=0x0;_0x29cc05<_0x1297d7[_0x809d('0x46')];_0x29cc05++){var _0x5a0c03=_['find'](_0x82e5d8,function(_0x24c671){return _0x1297d7[_0x29cc05]?_0x24c671[_0x809d('0x26')]===_0x1297d7[_0x29cc05][_0x809d('0x26')]:null;});if(_0x5a0c03){if(_0x1297d7[_0x29cc05]['ignore']){_0x46202f['push'](getAllResources(_0x3b843e[_0x809d('0x70')],_0x1297d7[_0x29cc05]));}else{if(!_0x1297d7[_0x29cc05][_0x809d('0x50')]){_0x46202f[_0x809d('0x58')](getAllowedResources(_0x5a0c03,_0x1297d7[_0x29cc05],_0x3b843e[_0x809d('0x70')]));}else{if(_0x5a0c03['model']){_0x46202f['push'](getAllFilteredResources(_0x5a0c03,_0x1297d7[_0x29cc05]));}}}}}return BPromise[_0x809d('0x6d')](_0x46202f);}else{return null;}})[_0x809d('0x23')](function(_0x513479){var _0x3964ec=_0x513479;var _0x8e699e=null;if(_0x3964ec){_0x8e699e=_0x3964ec['length']===0x1?_0x3964ec[0x0]:null;}if(_0x8e699e||_0x3964ec){var _0xcd1a13=db[_0x3b843e[_0x809d('0x70')]][_0x809d('0x2b')];_0x285d03[_0x809d('0x2e')]=_[_0x809d('0x2f')](_0xcd1a13);_0x285d03[_0x809d('0x30')]=_['keys'](_0x565dc0[_0x809d('0x30')]);_0x285d03[_0x809d('0x39')]=_[_0x809d('0x31')](_0x285d03[_0x809d('0x2e')],_0x285d03[_0x809d('0x30')]);_0x84abc6[_0x809d('0x33')]=_[_0x809d('0x31')](_0x285d03[_0x809d('0x2e')],qs[_0x809d('0x32')](_0x565dc0[_0x809d('0x30')][_0x809d('0x32')]));_0x84abc6['attributes']=_0x84abc6[_0x809d('0x33')][_0x809d('0x46')]?_0x84abc6['attributes']:_0x285d03['model'];if(!_0x565dc0[_0x809d('0x30')][_0x809d('0x34')]('nolimit')){_0x84abc6[_0x809d('0x1f')]=qs[_0x809d('0x1f')](_0x565dc0[_0x809d('0x30')][_0x809d('0x1f')]);_0x84abc6[_0x809d('0x1e')]=qs[_0x809d('0x1e')](_0x565dc0[_0x809d('0x30')][_0x809d('0x1e')]);}_0x84abc6[_0x809d('0x36')]=qs['sort'](_0x565dc0[_0x809d('0x30')][_0x809d('0x37')]);_0x84abc6['where']=qs[_0x809d('0x39')](_[_0x809d('0x71')](_0x565dc0[_0x809d('0x30')],_0x285d03['filters']));if(_0x565dc0[_0x809d('0x30')]['filter']){_0x84abc6['where']=_[_0x809d('0x3b')](_0x84abc6[_0x809d('0x38')],{'$or':_['map'](_0xcd1a13,function(_0x3edd74){if(_0x3edd74['type'][_0x809d('0x2d')]!==_0x809d('0x3c')){var _0x4860fe={};_0x4860fe[_0x3edd74['field']]={'$like':'%'+_0x565dc0[_0x809d('0x30')][_0x809d('0x3a')]+'%'};return _0x4860fe;}})});}var _0x3d0e23=[];if(_0x8e699e){var _0xfafe22=_[_0x809d('0x47')](_0x82e5d8,['name',_0x8e699e['name']]);if(_0xfafe22[_0x809d('0x72')]){var _0xa6c5bc={};if(_0x3b843e[_0x809d('0x70')]===_0x809d('0x73')){_0xa6c5bc[_0xfafe22[_0x809d('0x74')]]=_['map'](_0x8e699e['associatedResources'],'id');}else{_0xa6c5bc[_0xfafe22[_0x809d('0x74')]]=_0x8e699e[_0x809d('0x75')];}_0x3d0e23[_0x809d('0x58')](_0xa6c5bc);}else{_0x84abc6[_0x809d('0x38')]['id']=_0x8e699e[_0x809d('0x75')];}}else{for(var _0x5e59c0=0x0;_0x5e59c0<_0x3964ec[_0x809d('0x46')];_0x5e59c0++){var _0xfafe22=_['find'](_0x82e5d8,[_0x809d('0x26'),_0x3964ec[_0x5e59c0][_0x809d('0x26')]]);if(_0xfafe22[_0x809d('0x72')]){var _0xa6c5bc={};_0xa6c5bc[_0xfafe22['foreignKey']]=_0x3964ec[_0x5e59c0][_0x809d('0x75')];_0x3d0e23['push'](_0xa6c5bc);}else{if(!_0x84abc6[_0x809d('0x38')]['id'])_0x84abc6[_0x809d('0x38')]['id']=[];_0x3964ec[_0x5e59c0]['associatedResources']['forEach'](function(_0x2191c8){_0x84abc6[_0x809d('0x38')]['id'][_0x809d('0x58')](_0x2191c8);});}}}if(!_['isEmpty'](_0x3d0e23)){_0x84abc6[_0x809d('0x38')]=_['merge'](_0x84abc6[_0x809d('0x38')],{'$and':{'$or':_0x3d0e23}});}_0x84abc6=_[_0x809d('0x3b')]({},_0x84abc6,_0x565dc0['options']);if(_0x8e699e&&!_0x8e699e['autoAssociation']&&_0x3b843e[_0x809d('0x70')]===_0x809d('0x73')){if(_0x565dc0[_0x809d('0x30')]['includeAll']){_0x84abc6[_0x809d('0x41')]=[{'all':!![]}];}return db[_0x3b843e[_0x809d('0x70')]][_0x809d('0x3e')](_0x84abc6)['then'](function(_0xdd6d34){var _0x7c1c21=[];_0xdd6d34[_0x809d('0x5f')](function(_0x11c763){var _0x2f17b8;switch(_0x11c763[_0x809d('0x76')]){case _0x809d('0x77'):_0x2f17b8=_['find'](_0x8e699e[_0x809d('0x75')],function(_0x3f9f42){return _0x3f9f42['id']===_0x11c763[_0x809d('0x78')]&&_0x3f9f42[_0x809d('0x2c')]===_0x809d('0x79');});break;case'custom':_0x2f17b8=_[_0x809d('0x47')](_0x8e699e[_0x809d('0x75')],function(_0x294c97){return _0x294c97['id']===_0x11c763[_0x809d('0x78')]&&_0x294c97['type']==='CustomReports';});break;}if(_0x2f17b8)_0x7c1c21[_0x809d('0x58')](_0x11c763);});_0x323193[_0x809d('0x1d')]=_0x7c1c21[_0x809d('0x46')];_0x323193[_0x809d('0x7a')]=_0x7c1c21;return _0x323193;});}else{return db[_0x3b843e[_0x809d('0x70')]][_0x809d('0x1d')]({'where':_0x84abc6[_0x809d('0x38')]})['then'](function(_0x4b63fc){_0x323193[_0x809d('0x1d')]=_0x4b63fc;if(_0x565dc0['query'][_0x809d('0x3d')]){if(_0x3b843e[_0x809d('0x70')]===_0x809d('0x7b')){_0x84abc6['include']=[{'model':db[_0x809d('0x7c')],'as':_0x809d('0x7d'),'attributes':['id',_0x809d('0x26'),_0x809d('0x7e')],'required':_0x565dc0[_0x809d('0x30')][_0x809d('0x7f')]?!![]:![]},{'model':db[_0x809d('0x7c')],'as':_0x809d('0x80'),'attributes':['id',_0x809d('0x26'),'color'],'through':_0x565dc0[_0x809d('0x30')][_0x809d('0x7f')]?{'attributes':[],'where':{'TagId':_0x565dc0[_0x809d('0x30')][_0x809d('0x7f')]||undefined}}:{},'required':_0x565dc0[_0x809d('0x30')][_0x809d('0x7f')]?!![]:![]}];}else{_0x84abc6['include']=[{'all':!![]}];}}return db[_0x3b843e['childModel']][_0x809d('0x3e')](_0x84abc6);})['then'](function(_0x1d2152){_0x323193[_0x809d('0x7a')]=_0x1d2152;return _0x323193;});}}else{return _0x323193;}})['then'](respondWithFilteredResult(_0x3fbb87,_0x84abc6))[_0x809d('0x3f')](handleError(_0x3fbb87,null));};function getAllResources(_0x154d01,_0x48151e){return new BPromise(function(_0x45ed9e,_0x96b92d){if(_0x48151e){var _0x117d04=_0x48151e[_0x809d('0x3a')]?{[_0x48151e[_0x809d('0x3a')]['field']]:_0x48151e[_0x809d('0x3a')]['value']}:undefined;return db[_0x154d01]['findAll']({'where':_0x117d04,'raw':!![]})[_0x809d('0x23')](function(_0x27a8cf){_0x48151e['associatedResources']=_['map'](_0x27a8cf,'id');_0x45ed9e(_0x48151e);})[_0x809d('0x3f')](function(_0x335675){_0x96b92d(_0x335675);});}else{_0x45ed9e(null);}});}function getAllFilteredResources(_0x475163,_0x1c6876){return new BPromise(function(_0x362bdf,_0x9d8cf7){var _0x4f59cf=_0x475163['filter']?{[_0x475163[_0x809d('0x3a')][_0x809d('0x72')]]:_0x475163[_0x809d('0x3a')][_0x809d('0x81')]}:undefined;return db[_0x475163[_0x809d('0x2e')]][_0x809d('0x3e')]({'where':_0x4f59cf,'raw':!![]})[_0x809d('0x23')](function(_0x1e9354){_0x1c6876['associatedResources']=_[_0x809d('0x29')](_0x1e9354,function(_0x240124){return _0x240124['name'];});_0x362bdf(_0x1c6876);})[_0x809d('0x3f')](function(_0x4aad5c){_0x9d8cf7(_0x4aad5c);});});}function getAllowedResources(_0x4b61b1,_0x88e8ef,_0x25f37c){return new BPromise(function(_0x583b8b,_0x1be580){if(_0x88e8ef){return db[_0x809d('0x51')]['findAll']({'where':{'sectionId':_0x88e8ef['id']},'raw':!![]})[_0x809d('0x23')](function(_0xd38406){if(_0x4b61b1[_0x809d('0x72')]&&_0x4b61b1[_0x809d('0x72')]!=='id'){_0x88e8ef[_0x809d('0x75')]=_[_0x809d('0x29')](_0xd38406,function(_0x483725){return _0x483725[_0x4b61b1[_0x809d('0x72')]];});}else{if(_0x25f37c===_0x809d('0x73')){_0x88e8ef[_0x809d('0x75')]=_[_0x809d('0x29')](_0xd38406,function(_0x3e694f){return{'id':_0x3e694f[_0x809d('0x82')],'type':_0x3e694f[_0x809d('0x2c')]};});}else{_0x88e8ef[_0x809d('0x75')]=_['map'](_0xd38406,function(_0x1f9d3f){return _0x1f9d3f[_0x809d('0x82')];});}}_0x583b8b(_0x88e8ef);})[_0x809d('0x3f')](function(_0x36ea40){_0x1be580(_0x36ea40);});}else{_0x583b8b(null);}});}function getQueryModels(_0x216f39,_0x1dcafc){var _0x1751cc=_0x216f39[_0x809d('0x83')]();var _0x47be8f={'childModel':undefined,'parentSections':[]};switch(_0x1751cc){case _0x809d('0x84'):_0x47be8f[_0x809d('0x70')]=_0x809d('0x85');break;case'odbc':_0x47be8f['childModel']=_0x809d('0x86');break;case _0x809d('0x87'):_0x47be8f[_0x809d('0x70')]='SquareRecording';_0x47be8f['parentSections']=[{'name':'SquareProjects','field':_0x809d('0x26'),'foreignKey':'projectName'}];break;case'projects':_0x47be8f[_0x809d('0x70')]=_0x809d('0x88');break;case _0x809d('0x89'):_0x47be8f[_0x809d('0x70')]=_0x809d('0x7b');_0x47be8f['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x809d('0x8a')}];break;case _0x809d('0x8b'):_0x47be8f['childModel']=_0x809d('0x8c');break;case'companies':_0x47be8f[_0x809d('0x70')]='CmCompany';break;case _0x809d('0x8d'):_0x47be8f[_0x809d('0x70')]=_0x809d('0x8e');break;case _0x809d('0x8f'):_0x47be8f[_0x809d('0x70')]='ChatQueue';break;case'chatwebsites':_0x47be8f[_0x809d('0x70')]='ChatWebsite';break;case'faxqueues':_0x47be8f[_0x809d('0x70')]=_0x809d('0x90');break;case'faxaccounts':_0x47be8f[_0x809d('0x70')]='FaxAccount';break;case _0x809d('0x91'):case _0x809d('0x92'):case _0x809d('0x93'):_0x47be8f['childModel']=_0x809d('0x94');break;case _0x809d('0x95'):_0x47be8f[_0x809d('0x70')]=_0x809d('0x96');break;case'voicemails':_0x47be8f[_0x809d('0x70')]=_0x809d('0x97');break;case _0x809d('0x98'):_0x47be8f['childModel']='VoiceRecording';_0x47be8f[_0x809d('0x6b')]=[{'name':_0x809d('0x99'),'field':_0x809d('0x26'),'foreignKey':'membername','model':_0x809d('0x9a'),'filter':{'field':_0x809d('0x9b'),'value':[_0x809d('0x9c')]}},{'name':_0x809d('0x9d'),'field':_0x809d('0x26'),'foreignKey':_0x809d('0x9e'),'model':'User','filter':{'field':_0x809d('0x9b'),'value':[_0x809d('0x9f')]}},{'name':_0x809d('0xa0'),'field':_0x809d('0x26'),'foreignKey':'queue','model':_0x809d('0xa1'),'filter':{'field':_0x809d('0x2c'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0x809d('0x26'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x809d('0x2c'),'value':[_0x809d('0xa2')]}}];break;case _0x809d('0xa3'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xa4');break;case'chanspies':_0x47be8f['childModel']=_0x809d('0xa5');break;case _0x809d('0xa6'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xa7');break;case _0x809d('0xa8'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xa9');break;case _0x809d('0xaa'):_0x47be8f[_0x809d('0x70')]='MailQueue';break;case _0x809d('0xab'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xac');break;case'mailsubstatuses':_0x47be8f[_0x809d('0x70')]=_0x809d('0xad');break;case _0x809d('0xae'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xaf');break;case _0x809d('0xb0'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xb1');break;case _0x809d('0xb2'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xb3');break;case _0x809d('0xb4'):_0x47be8f[_0x809d('0x70')]='SmsAccount';break;case _0x809d('0xb5'):_0x47be8f[_0x809d('0x70')]='WhatsappQueue';break;case _0x809d('0xb6'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xb7');break;case _0x809d('0xb8'):_0x47be8f[_0x809d('0x70')]='Team';break;case _0x809d('0xb9'):case _0x809d('0xba'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xa1');if(_0x1dcafc){_0x47be8f[_0x809d('0x6b')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x809d('0xbb'):case'agents':case _0x809d('0xbc'):_0x47be8f[_0x809d('0x70')]=_0x809d('0x9a');if(_0x1dcafc){_0x47be8f['parentSections']=[{'name':_0x809d('0xbd'),'filter':{'field':'role','value':[_0x809d('0xbe'),_0x809d('0xbf')]},'ignore':!![]},{'name':_0x809d('0x99')},{'name':_0x809d('0x9d')}];}break;case _0x809d('0xc0'):_0x47be8f['childModel']=_0x809d('0xc1');break;case _0x809d('0xc2'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xc3');break;case'freshdeskaccounts':_0x47be8f['childModel']=_0x809d('0xc4');break;case _0x809d('0xc5'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xc6');break;case'deskaccounts':_0x47be8f[_0x809d('0x70')]=_0x809d('0xc7');break;case _0x809d('0xc8'):_0x47be8f[_0x809d('0x70')]='ZohoAccount';break;case'vtigeraccounts':_0x47be8f[_0x809d('0x70')]='User';break;case'cannedanswers':_0x47be8f[_0x809d('0x70')]='CannedAnswer';break;case _0x809d('0xc9'):_0x47be8f['childModel']=_0x809d('0xca');break;case _0x809d('0xcb'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xcc');break;case _0x809d('0xcd'):_0x47be8f[_0x809d('0x70')]='Interval';break;case _0x809d('0xce'):_0x47be8f['childModel']=_0x809d('0xcf');break;case _0x809d('0xd0'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xd1');break;case _0x809d('0xd2'):_0x47be8f[_0x809d('0x70')]='Sound';break;case _0x809d('0xd3'):_0x47be8f[_0x809d('0x70')]='Tag';break;case'templates':_0x47be8f[_0x809d('0x70')]='Template';break;case _0x809d('0xd4'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xd5');break;case _0x809d('0xd6'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xd7');break;case _0x809d('0xd8'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xd9');break;case _0x809d('0xda'):_0x47be8f['childModel']=_0x809d('0x60');break;case _0x809d('0xdb'):_0x47be8f[_0x809d('0x70')]=_0x809d('0x73');_0x47be8f[_0x809d('0x6b')]=[{'name':_0x809d('0xdc'),'field':'id','foreignKey':_0x809d('0x78')}];break;case _0x809d('0xdd'):_0x47be8f[_0x809d('0x70')]=_0x809d('0xde');break;case'whatsappaccounts':_0x47be8f['childModel']=_0x809d('0xb7');break;default:return _0x47be8f;}return _0x47be8f;} \ No newline at end of file +var _0xd70e=['rows','show','params','length','includeAll','merge','find','create','body','catch','clone','omit','createdAt','updatedAt','crudPermissions','sequelize','get','UserProfileSection','each','autoAssociation','sectionId','Resources','update','describe','userProfileId','UserProfileResource','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','forEach','resourceId','Plugin','addResources','transaction','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','Invalid\x20section\x20\x27','parentSections','findOne','all','ignore','union','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','CustomReports','CmContact','Tag','Tags','tag','ThroughTags','value','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','smsqueues','SmsQueue','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','tags','templates','Trigger','trunks','Trunk','variables','Variable','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','include','findAll'];(function(_0x1089fb,_0x2a412d){var _0x5deb2a=function(_0x4c3b10){while(--_0x4c3b10){_0x1089fb['push'](_0x1089fb['shift']());}};_0x5deb2a(++_0x2a412d);}(_0xd70e,0x1a2));var _0xed70=function(_0x32abfe,_0x1f5bae){_0x32abfe=_0x32abfe-0x0;var _0x22f64f=_0xd70e[_0x32abfe];return _0x22f64f;};'use strict';var pdf=require(_0xed70('0x0'));var emlformat=require(_0xed70('0x1'));var rimraf=require(_0xed70('0x2'));var zipdir=require(_0xed70('0x3'));var jsonpatch=require(_0xed70('0x4'));var rp=require('request-promise');var moment=require(_0xed70('0x5'));var BPromise=require(_0xed70('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xed70('0x7'));var sox=require(_0xed70('0x8'));var csv=require(_0xed70('0x9'));var ejs=require(_0xed70('0xa'));var fs=require('fs');var _=require(_0xed70('0xb'));var squel=require(_0xed70('0xc'));var crypto=require(_0xed70('0xd'));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(_0xed70('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xed70('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed70('0x10'));var logger=require(_0xed70('0x11'))(_0xed70('0x12'));var utils=require(_0xed70('0x13'));var config=require(_0xed70('0x14'));var licenseUtil=require(_0xed70('0x15'));var db=require(_0xed70('0x16'))['db'];config[_0xed70('0x17')]=_[_0xed70('0x18')](config['redis'],{'host':_0xed70('0x19'),'port':0x18eb});var socket=require(_0xed70('0x1a'))(new Redis(config[_0xed70('0x17')]));require(_0xed70('0x1b'))[_0xed70('0x1c')](socket);function respondWithStatusCode(_0x4d14c4,_0x25acc3){_0x25acc3=_0x25acc3||0xcc;return function(_0xc701df){if(_0xc701df){return _0x4d14c4[_0xed70('0x1d')](_0x25acc3);}return _0x4d14c4['status'](_0x25acc3)[_0xed70('0x1e')]();};}function respondWithResult(_0x2618a0,_0x550371){_0x550371=_0x550371||0xc8;return function(_0x5170ca){if(_0x5170ca){return _0x2618a0[_0xed70('0x1f')](_0x550371)[_0xed70('0x20')](_0x5170ca);}};}function respondWithFilteredResult(_0x5c585c,_0x1af5a1){return function(_0x43d495){if(_0x43d495){var _0x3eef39=_0x43d495[_0xed70('0x21')],_0xb1e0b7=_0x1af5a1[_0xed70('0x22')],_0xd9c7e3=_0x1af5a1[_0xed70('0x22')]+_0x1af5a1[_0xed70('0x23')],_0x5a549a;if(_0xd9c7e3>=_0x3eef39){_0xd9c7e3=_0x3eef39;_0x5a549a=0xc8;}else{_0x5a549a=0xce;}_0x5c585c['status'](_0x5a549a);return _0x5c585c[_0xed70('0x24')](_0xed70('0x25'),_0xb1e0b7+'-'+_0xd9c7e3+'/'+_0x3eef39)[_0xed70('0x20')](_0x43d495);}return null;};}function patchUpdates(_0x3548c4){return function(_0x2b6b39){try{jsonpatch[_0xed70('0x26')](_0x2b6b39,_0x3548c4,!![]);}catch(_0x36f8ed){return BPromise['reject'](_0x36f8ed);}return _0x2b6b39[_0xed70('0x27')]();};}function saveUpdates(_0x2245eb,_0x4ac09){return function(_0x19391f){if(_0x19391f){return _0x19391f['update'](_0x2245eb)[_0xed70('0x28')](function(_0x2e4f6f){return _0x2e4f6f;});}return null;};}function removeEntity(_0x4325ae,_0x27c7c7){return function(_0x5ce834){if(_0x5ce834){return _0x5ce834[_0xed70('0x29')]()[_0xed70('0x28')](function(){_0x4325ae['status'](0xcc)[_0xed70('0x1e')]();});}};}function handleEntityNotFound(_0x1a9934,_0x1b844f){return function(_0x43d960){if(!_0x43d960){_0x1a9934[_0xed70('0x1d')](0x194);}return _0x43d960;};}function handleError(_0x30ca9d,_0x4909e7){_0x4909e7=_0x4909e7||0x1f4;return function(_0x3df30a){logger[_0xed70('0x2a')](_0x3df30a[_0xed70('0x2b')]);if(_0x3df30a[_0xed70('0x2c')]){delete _0x3df30a[_0xed70('0x2c')];}_0x30ca9d[_0xed70('0x1f')](_0x4909e7)[_0xed70('0x2d')](_0x3df30a);};}exports[_0xed70('0x2e')]=function(_0x35ff51,_0x40acad){var _0xe12f8a={},_0x484bf0={},_0xf7aaf={'count':0x0,'rows':[]};var _0x18ca12=_[_0xed70('0x2f')](db[_0xed70('0x30')][_0xed70('0x31')],function(_0x5a1498){return{'name':_0x5a1498[_0xed70('0x32')],'type':_0x5a1498[_0xed70('0x33')][_0xed70('0x34')]};});_0x484bf0[_0xed70('0x35')]=_['map'](_0x18ca12,'name');_0x484bf0['query']=_[_0xed70('0x36')](_0x35ff51[_0xed70('0x37')]);_0x484bf0['filters']=_[_0xed70('0x38')](_0x484bf0['model'],_0x484bf0[_0xed70('0x37')]);_0xe12f8a['attributes']=_[_0xed70('0x38')](_0x484bf0[_0xed70('0x35')],qs[_0xed70('0x39')](_0x35ff51[_0xed70('0x37')][_0xed70('0x39')]));_0xe12f8a['attributes']=_0xe12f8a[_0xed70('0x3a')]['length']?_0xe12f8a[_0xed70('0x3a')]:_0x484bf0[_0xed70('0x35')];if(!_0x35ff51[_0xed70('0x37')][_0xed70('0x3b')](_0xed70('0x3c'))){_0xe12f8a[_0xed70('0x23')]=qs[_0xed70('0x23')](_0x35ff51[_0xed70('0x37')][_0xed70('0x23')]);_0xe12f8a['offset']=qs[_0xed70('0x22')](_0x35ff51[_0xed70('0x37')][_0xed70('0x22')]);}_0xe12f8a[_0xed70('0x3d')]=qs[_0xed70('0x3e')](_0x35ff51[_0xed70('0x37')][_0xed70('0x3e')]);_0xe12f8a[_0xed70('0x3f')]=qs[_0xed70('0x40')](_['pick'](_0x35ff51[_0xed70('0x37')],_0x484bf0['filters']),_0x18ca12);if(_0x35ff51[_0xed70('0x37')][_0xed70('0x41')]){_0xe12f8a['where']=_['merge'](_0xe12f8a[_0xed70('0x3f')],{'$or':_[_0xed70('0x2f')](_0x18ca12,function(_0x2a31d4){if(_0x2a31d4[_0xed70('0x33')]!==_0xed70('0x42')){var _0x574837={};_0x574837[_0x2a31d4[_0xed70('0x2c')]]={'$like':'%'+_0x35ff51['query'][_0xed70('0x41')]+'%'};return _0x574837;}})});}_0xe12f8a=_['merge']({},_0xe12f8a,_0x35ff51[_0xed70('0x43')]);var _0x3d23e5={'where':_0xe12f8a[_0xed70('0x3f')]};return db['UserProfile'][_0xed70('0x21')](_0x3d23e5)[_0xed70('0x28')](function(_0x48a037){_0xf7aaf['count']=_0x48a037;if(_0x35ff51[_0xed70('0x37')]['includeAll']){_0xe12f8a[_0xed70('0x44')]=[{'all':!![]}];}return db[_0xed70('0x30')][_0xed70('0x45')](_0xe12f8a);})[_0xed70('0x28')](function(_0x551bfe){_0xf7aaf[_0xed70('0x46')]=_0x551bfe;return _0xf7aaf;})[_0xed70('0x28')](respondWithFilteredResult(_0x40acad,_0xe12f8a))['catch'](handleError(_0x40acad,null));};exports[_0xed70('0x47')]=function(_0x6dc40,_0x188b55){var _0x9acfcf={'raw':![],'where':{'id':_0x6dc40[_0xed70('0x48')]['id']}},_0x13e5fe={};_0x13e5fe[_0xed70('0x35')]=_[_0xed70('0x36')](db[_0xed70('0x30')][_0xed70('0x31')]);_0x13e5fe[_0xed70('0x37')]=_[_0xed70('0x36')](_0x6dc40[_0xed70('0x37')]);_0x13e5fe[_0xed70('0x40')]=_[_0xed70('0x38')](_0x13e5fe[_0xed70('0x35')],_0x13e5fe[_0xed70('0x37')]);_0x9acfcf['attributes']=_['intersection'](_0x13e5fe['model'],qs[_0xed70('0x39')](_0x6dc40[_0xed70('0x37')][_0xed70('0x39')]));_0x9acfcf[_0xed70('0x3a')]=_0x9acfcf[_0xed70('0x3a')][_0xed70('0x49')]?_0x9acfcf[_0xed70('0x3a')]:_0x13e5fe[_0xed70('0x35')];if(_0x6dc40[_0xed70('0x37')][_0xed70('0x4a')]){_0x9acfcf[_0xed70('0x44')]=[{'all':!![]}];}_0x9acfcf=_[_0xed70('0x4b')]({},_0x9acfcf,_0x6dc40[_0xed70('0x43')]);return db[_0xed70('0x30')][_0xed70('0x4c')](_0x9acfcf)[_0xed70('0x28')](handleEntityNotFound(_0x188b55,null))['then'](respondWithResult(_0x188b55,null))['catch'](handleError(_0x188b55,null));};exports[_0xed70('0x4d')]=function(_0x547b2a,_0x2cf002){return db[_0xed70('0x30')][_0xed70('0x4d')](_0x547b2a[_0xed70('0x4e')],{})[_0xed70('0x28')](respondWithResult(_0x2cf002,0xc9))[_0xed70('0x4f')](handleError(_0x2cf002,null));};exports[_0xed70('0x50')]=function(_0x5621ce,_0x301e8c){var _0x561b85={'where':{'id':_0x5621ce[_0xed70('0x48')]['id']}},_0x1b9e56={};_0x1b9e56[_0xed70('0x35')]=_['keys'](db[_0xed70('0x30')]['rawAttributes']);_0x561b85[_0xed70('0x3a')]=_[_0xed70('0x38')](_0x1b9e56[_0xed70('0x35')],qs[_0xed70('0x39')](_0x5621ce['query'][_0xed70('0x39')]));_0x561b85[_0xed70('0x3a')]=_0x561b85[_0xed70('0x3a')][_0xed70('0x49')]?_0x561b85[_0xed70('0x3a')]:_0x1b9e56['model'];if(_0x5621ce['query'][_0xed70('0x4a')]){_0x561b85[_0xed70('0x44')]=[{'all':!![]}];}_0x561b85=_['merge']({},_0x561b85,_0x5621ce[_0xed70('0x43')]);return db[_0xed70('0x30')][_0xed70('0x4c')](_0x561b85)[_0xed70('0x28')](handleEntityNotFound(_0x301e8c,null))[_0xed70('0x28')](function(_0x1be80f){if(_0x1be80f){var _0x4f8dd6=_0x1be80f['get']({'plain':!![]});_0x4f8dd6=qs[_0xed70('0x51')](_0x4f8dd6,['id',_0xed70('0x52'),_0xed70('0x53'),_0xed70('0x54')]);_0x5621ce['body']=_[_0xed70('0x51')](_0x5621ce[_0xed70('0x4e')],['id','createdAt',_0xed70('0x53')]);return db[_0xed70('0x55')]['transaction'](function(_0x53705a){return db[_0xed70('0x30')][_0xed70('0x4d')](_[_0xed70('0x4b')](_0x4f8dd6,_0x5621ce['body']),{'include':_0x5621ce['query'][_0xed70('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0x53705a})[_0xed70('0x28')](function(_0x206803){var _0x2082e4=_0x206803[_0xed70('0x56')]({'plain':!![]});return db[_0xed70('0x57')][_0xed70('0x45')]({'where':{'userProfileId':_0x5621ce['params']['id']},'raw':!![]})[_0xed70('0x28')](function(_0x4ed45e){if(_0x4ed45e){return BPromise[_0xed70('0x58')](_0x4ed45e,function(_0x212363){return new BPromise(function(_0x1270ec,_0x2a6c8e){if(_0x212363[_0xed70('0x59')]===null||_0x212363['autoAssociation']===0x1)_0x1270ec(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x212363['id']},'raw':!![]})[_0xed70('0x28')](function(_0x5d03bf){var _0x505d01=_['map'](_0x5d03bf,function(_0x4545c1){return qs[_0xed70('0x51')](_0x4545c1,['id',_0xed70('0x52'),_0xed70('0x53'),_0xed70('0x5a')]);});_0x1270ec(_0x505d01);})['catch'](function(_0xbfaf59){_0x2a6c8e(_0xbfaf59);});})[_0xed70('0x28')](function(_0x531f88){var _0x29b130=qs['omit'](_0x212363,['id',_0xed70('0x52'),_0xed70('0x53')]);_0x29b130['userProfileId']=_0x2082e4['id'];if(_0x531f88)_0x29b130[_0xed70('0x5b')]=_0x531f88;return _0x29b130;})['then'](function(_0x4cd817){return db[_0xed70('0x57')][_0xed70('0x4d')](_0x4cd817,{'include':[{'model':db['UserProfileResource'],'as':_0xed70('0x5b')}],'raw':!![],'transaction':_0x53705a});});})['then'](function(){return _0x2082e4;});}});});});}})[_0xed70('0x28')](respondWithResult(_0x301e8c,0xc9))[_0xed70('0x4f')](handleError(_0x301e8c,null));};exports[_0xed70('0x5c')]=function(_0xd2b6fb,_0x1dd970){if(_0xd2b6fb[_0xed70('0x4e')]['id']){delete _0xd2b6fb[_0xed70('0x4e')]['id'];}return db[_0xed70('0x30')][_0xed70('0x4c')]({'where':{'id':_0xd2b6fb[_0xed70('0x48')]['id']}})[_0xed70('0x28')](handleEntityNotFound(_0x1dd970,null))[_0xed70('0x28')](saveUpdates(_0xd2b6fb[_0xed70('0x4e')],null))[_0xed70('0x28')](respondWithResult(_0x1dd970,null))[_0xed70('0x4f')](handleError(_0x1dd970,null));};exports[_0xed70('0x29')]=function(_0x5e1ce7,_0x2b7b07){return db[_0xed70('0x30')][_0xed70('0x4c')]({'where':{'id':_0x5e1ce7[_0xed70('0x48')]['id']}})[_0xed70('0x28')](handleEntityNotFound(_0x2b7b07,null))[_0xed70('0x28')](removeEntity(_0x2b7b07,null))[_0xed70('0x4f')](handleError(_0x2b7b07,null));};exports[_0xed70('0x5d')]=function(_0x39ef74,_0x6a7dc8){return db[_0xed70('0x30')][_0xed70('0x5d')]()[_0xed70('0x28')](respondWithResult(_0x6a7dc8,null))[_0xed70('0x4f')](handleError(_0x6a7dc8,null));};exports['addSections']=function(_0x72bc5d,_0x1cd73c){var _0x38c2b4=_0x72bc5d[_0xed70('0x4e')];return db[_0xed70('0x30')][_0xed70('0x4c')]({'where':{'id':_0x72bc5d[_0xed70('0x48')]['id']}})[_0xed70('0x28')](handleEntityNotFound(_0x1cd73c,null))[_0xed70('0x28')](function(_0x71ebfa){if(_0x71ebfa){return db[_0xed70('0x55')]['transaction'](function(_0x39a4eb){return db['UserProfileSection'][_0xed70('0x29')]({'where':{'userProfileId':_0x72bc5d[_0xed70('0x48')]['id'],'sectionId':_[_0xed70('0x2f')](_0x38c2b4,function(_0x26427f){return _0x26427f['sectionId'];})},'transaction':_0x39a4eb})[_0xed70('0x28')](function(){var _0x3b83c4=_['map'](_0x38c2b4,function(_0x24176e){_0x24176e[_0xed70('0x5e')]=_0x72bc5d[_0xed70('0x48')]['id'];return _0x24176e;});var _0x5d23ad=[];return BPromise['each'](_0x3b83c4,function(_0xd16978){return db[_0xed70('0x57')][_0xed70('0x4d')](_0xd16978,{'include':[{'model':db[_0xed70('0x5f')],'as':'Resources'}],'raw':!![],'transaction':_0x39a4eb})[_0xed70('0x28')](function(_0x3b27fa){_0x5d23ad['push'](_0x3b27fa[_0xed70('0x56')]({'plain':!![]}));});})['then'](function(){return _0x5d23ad;});});});}})[_0xed70('0x28')](function(_0x598d7f){return _0x598d7f;})[_0xed70('0x28')](respondWithResult(_0x1cd73c,null))[_0xed70('0x4f')](handleError(_0x1cd73c,null));};exports[_0xed70('0x60')]=function(_0x1ec805,_0xfea19b){var _0x18d3f2;return db['UserProfile'][_0xed70('0x4c')]({'where':{'id':_0x1ec805[_0xed70('0x48')]['id']},'attributes':['id','name']})[_0xed70('0x28')](handleEntityNotFound(_0xfea19b,null))[_0xed70('0x28')](function(_0xc217f1){if(_0xc217f1){_0x18d3f2=_0xc217f1;return db[_0xed70('0x57')][_0xed70('0x29')]({'where':{'userProfileId':_0x1ec805[_0xed70('0x48')]['id'],'sectionId':_0x1ec805[_0xed70('0x37')][_0xed70('0x61')]}});}})[_0xed70('0x28')](function(){return _0x18d3f2;})[_0xed70('0x28')](respondWithStatusCode(_0xfea19b,null))[_0xed70('0x4f')](handleError(_0xfea19b,null));};exports[_0xed70('0x62')]=function(_0x3ce86b,_0xb8a729){var _0x198dfb=[];var _0x5779df=[];return db[_0xed70('0x57')]['findAll']({'where':{'userProfileId':_0x3ce86b['params']['id']},'raw':!![]})[_0xed70('0x28')](function(_0x1685a7){_0x198dfb=_['filter'](_0x1685a7,function(_0xdf164d){return _0xdf164d[_0xed70('0x63')]===0x1||_[_0xed70('0x64')]([0x3eb,0x709],_0xdf164d['sectionId']);});if(!_[_0xed70('0x65')](_0x198dfb)){return _[_0xed70('0x2f')](_0x198dfb,function(_0xb35b87){return _0xb35b87['sectionId'];});}else{return;}})['then'](function(_0x40d245){if(_0x40d245)_0x5779df=_0x40d245;if(_['includes'](_0x5779df,0x64)){var _0xce85c9=_[_0xed70('0x4c')](_0x198dfb,{'sectionId':0x64});return hasDefaultDashboard(_0xce85c9)['then'](function(_0x36b365){return _[_0xed70('0x2f')](_0x198dfb,function(_0x449183){if(_0x449183[_0xed70('0x5a')]===0x64){_0x449183[_0xed70('0x66')]=_0x36b365;}return _0x449183;});});}else{return;}})[_0xed70('0x28')](function(_0x2ebe4f){if(_0x2ebe4f)_0x198dfb=_0x2ebe4f;if(_[_0xed70('0x64')](_0x5779df,0x3eb)){var _0x46b04c=_[_0xed70('0x4c')](_0x198dfb,{'sectionId':0x3eb});return getCustomDashboards(_0x46b04c)[_0xed70('0x28')](function(_0x421580){return _[_0xed70('0x2f')](_0x198dfb,function(_0x844ec6){if(_0x46b04c[_0xed70('0x63')]){if(_0x844ec6['sectionId']===0x3eb){_0x844ec6['subsections']=_0x421580;}}else{if(_0x844ec6[_0xed70('0x5a')]===0x64){_0x844ec6['subsections']=_0x421580;}}return _0x844ec6;});});}else{return;}})[_0xed70('0x28')](function(_0x38c181){if(_0x38c181)_0x198dfb=_0x38c181;if(_[_0xed70('0x64')](_0x5779df,0x709)){var _0x1cb0ae=_['find'](_0x198dfb,{'sectionId':0x709});return getPlugins(_0x1cb0ae)[_0xed70('0x28')](function(_0x42f880){if(_0x1cb0ae[_0xed70('0x63')]){return _[_0xed70('0x2f')](_0x198dfb,function(_0x296289){if(_0x296289[_0xed70('0x5a')]===0x709){_0x296289['subsections']=_0x42f880;}return _0x296289;});}else{var _0x1343b8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x42f880};var _0x21f14f=_[_0xed70('0x2f')](_0x198dfb);_0x21f14f[_0xed70('0x67')](_0x1343b8);return _0x21f14f;}});}else{return;}})[_0xed70('0x28')](function(_0x7f92a){if(_0x7f92a)_0x198dfb=_0x7f92a;return _[_0xed70('0x41')](_0x198dfb,[_0xed70('0x63'),0x1]);})['then'](respondWithResult(_0xb8a729,null))['catch'](handleError(_0xb8a729,null));};function hasDefaultDashboard(_0x773a8c){var _0x5311c7=[0x65];return new BPromise(function(_0x3d456c,_0x32493d){try{if(_0x773a8c[_0xed70('0x59')]){_0x3d456c(_0x5311c7);}else{return db[_0xed70('0x5f')]['findOne']({'where':{'sectionId':_0x773a8c['id']},'raw':!![]})[_0xed70('0x28')](function(_0x58d990){_0x58d990?_0x3d456c(_0x5311c7):_0x3d456c();});}}catch(_0x2e08c0){_0x32493d(_0x2e08c0);}});}function getCustomDashboards(_0x20dd58){var _0xcf807e=[];return new BPromise(function(_0xfdce76,_0x110891){try{if(_0x20dd58['autoAssociation']){return db['Dashboard'][_0xed70('0x45')]({'raw':!![]})[_0xed70('0x28')](function(_0xc38b95){_0xc38b95[_0xed70('0x68')](function(_0x4b683a){_0xcf807e[_0xed70('0x67')](_0x4b683a['id']+0x1869f);});_0xfdce76(_0xcf807e);});}else{return db[_0xed70('0x5f')][_0xed70('0x45')]({'where':{'sectionId':_0x20dd58['id']},'raw':!![]})['then'](function(_0x32e3e6){_0x32e3e6[_0xed70('0x68')](function(_0x43e824){_0xcf807e[_0xed70('0x67')](_0x43e824[_0xed70('0x69')]+0x1869f);});_0xfdce76(_0xcf807e);});}}catch(_0x1c5ba6){_0x110891(_0x1c5ba6);}});}function getPlugins(_0x220b69){var _0x12124d=[];return new BPromise(function(_0x2869fe,_0x115784){try{if(_0x220b69[_0xed70('0x59')]){return db[_0xed70('0x6a')][_0xed70('0x45')]({'raw':!![]})['then'](function(_0x546b2f){_0x546b2f[_0xed70('0x68')](function(_0x566b5f){_0x12124d[_0xed70('0x67')](_0x566b5f['id']+0x15b38);});_0x2869fe(_0x12124d);});}else{return db[_0xed70('0x5f')]['findAll']({'where':{'sectionId':_0x220b69['id']},'raw':!![]})[_0xed70('0x28')](function(_0x21751c){_0x21751c[_0xed70('0x68')](function(_0x22f2f0){_0x12124d[_0xed70('0x67')](_0x22f2f0[_0xed70('0x69')]+0x15b38);});_0x2869fe(_0x12124d);});}}catch(_0x5da7f4){_0x115784(_0x5da7f4);}});}exports[_0xed70('0x6b')]=function(_0x376acd,_0x5225c2){return db[_0xed70('0x30')][_0xed70('0x4c')]({'where':{'id':_0x376acd[_0xed70('0x48')]['id']}})[_0xed70('0x28')](handleEntityNotFound(_0x5225c2,null))['then'](function(_0x3cbaad){if(_0x3cbaad){return db['sequelize'][_0xed70('0x6c')](function(_0xd6be9c){return db[_0xed70('0x57')][_0xed70('0x45')]({'where':{'userProfileId':_0x376acd['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x26060d){if(_0x26060d){return db[_0xed70('0x57')]['destroy']({'where':{'userProfileId':_0x376acd['params']['id'],'id':_[_0xed70('0x2f')](_0x26060d,function(_0x2d8ec7){return _0x2d8ec7['id'];})},'transaction':_0xd6be9c});}})[_0xed70('0x28')](function(_0x2040b7){var _0x4dc686=_[_0xed70('0x2f')](_0x376acd['body'],function(_0x11981e){_0x11981e[_0xed70('0x5e')]=_0x376acd[_0xed70('0x48')]['id'];return _0x11981e;});return db[_0xed70('0x57')]['bulkCreate'](_0x4dc686,{'raw':!![],'transaction':_0xd6be9c});})[_0xed70('0x28')](function(_0x179f2f){var _0x50f0ec=_[_0xed70('0x41')](_[_0xed70('0x2f')](_0x179f2f,function(_0x105646){return _0x105646['get']({'plain':!![]});}),{'includeAll':![]});if(_0x50f0ec){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x376acd['params']['id'],'sectionId':_[_0xed70('0x2f')](_0x50f0ec,function(_0x50bf3d){return _0x50bf3d[_0xed70('0x5a')];})},'attributes':['id',_0xed70('0x5a')],'raw':!![]})['then'](function(_0x11a22a){var _0x40f019=_[_0xed70('0x2f')](_0x376acd[_0xed70('0x4e')],function(_0x436bd8){_0x436bd8[_0xed70('0x5e')]=_0x376acd[_0xed70('0x48')]['id'];return _0x436bd8;});return db[_0xed70('0x5f')][_0xed70('0x6d')](_0x40f019,{'raw':!![],'transaction':_0xd6be9c});});}})[_0xed70('0x4f')](handleError(_0x5225c2,null));});}})[_0xed70('0x28')](function(_0x32768e){var _0x229070=_['map'](_0x32768e,function(_0x30444a){return _0x30444a['get']({'plain':!![]});});})[_0xed70('0x28')](respondWithResult(_0x5225c2,null))['catch'](handleError(_0x5225c2,null));};exports[_0xed70('0x6e')]=function(_0x3382a5,_0xadf196,_0x49a4cc){return db['UserProfile'][_0xed70('0x4c')]({'where':{'id':_0x3382a5['params']['id']}})[_0xed70('0x28')](handleEntityNotFound(_0xadf196,null))[_0xed70('0x28')](function(_0x4402cb){if(_0x4402cb){return _0x4402cb['removeResources'](_0x3382a5[_0xed70('0x37')][_0xed70('0x61')]);}})[_0xed70('0x28')](respondWithStatusCode(_0xadf196,null))[_0xed70('0x4f')](handleError(_0xadf196,null));};exports[_0xed70('0x6f')]=function(_0x2ab7e1,_0x567f54){var _0xea0df0={'raw':![],'where':{}};var _0x187035={};var _0x254568={'count':0x0,'rows':[]};var _0x3345a8=_0x2ab7e1[_0xed70('0x37')][_0xed70('0x70')];if(typeof _0x3345a8==='undefined'){throw new db[(_0xed70('0x71'))][(_0xed70('0x72'))](_0xed70('0x73'));}var _0x3750ba=_0x2ab7e1[_0xed70('0x37')][_0xed70('0x74')]||![];var _0x315170=getQueryModels(_0x3345a8,_0x3750ba);if(typeof _0x315170[_0xed70('0x75')]===_0xed70('0x76')){throw new db['Sequelize'][(_0xed70('0x72'))](_0xed70('0x77')+_0x3345a8+'\x27');}var _0x3d3ee8=[];if(!_[_0xed70('0x65')](_0x315170[_0xed70('0x78')])){_0x3d3ee8=_0x315170[_0xed70('0x78')];}else{_0x3d3ee8=[{'name':_0x3345a8}];}return db[_0xed70('0x30')][_0xed70('0x79')]({'where':{'id':_0x2ab7e1['params']['id']}})[_0xed70('0x28')](handleEntityNotFound(_0x567f54,null))[_0xed70('0x28')](function(_0x30dd2){if(_0x30dd2){var _0x54ed15=[];for(var _0x5923c1=0x0;_0x5923c1<_0x3d3ee8['length'];_0x5923c1++){_0x54ed15[_0xed70('0x67')](db[_0xed70('0x57')][_0xed70('0x79')]({'where':{'userProfileId':_0x30dd2['id'],'name':_0x3d3ee8[_0x5923c1][_0xed70('0x2c')]},'raw':!![]}));}return BPromise[_0xed70('0x7a')](_0x54ed15);}})['then'](function(_0x3935b6){var _0x1ea511=_[_0xed70('0x41')](_0x3935b6,function(_0xeec3d){return _0xeec3d?_0xeec3d:undefined;});var _0xdfa6b=_[_0xed70('0x41')](_0x3d3ee8,[_0xed70('0x7b'),!![]]);var _0x138ead=_[_0xed70('0x65')](_0x1ea511)&&_['isEmpty'](_0xdfa6b)?null:_[_0xed70('0x7c')](_0xdfa6b,_0x1ea511);if(_0x138ead){var _0x333017=[];for(var _0x260c80=0x0;_0x260c80<_0x138ead[_0xed70('0x49')];_0x260c80++){var _0x471827=_[_0xed70('0x4c')](_0x3d3ee8,function(_0x5cbf21){return _0x138ead[_0x260c80]?_0x5cbf21[_0xed70('0x2c')]===_0x138ead[_0x260c80][_0xed70('0x2c')]:null;});if(_0x471827){if(_0x138ead[_0x260c80][_0xed70('0x7b')]){_0x333017['push'](getAllResources(_0x315170[_0xed70('0x75')],_0x138ead[_0x260c80]));}else{if(!_0x138ead[_0x260c80][_0xed70('0x59')]){_0x333017[_0xed70('0x67')](getAllowedResources(_0x471827,_0x138ead[_0x260c80],_0x315170[_0xed70('0x75')]));}else{if(_0x471827['model']){_0x333017['push'](getAllFilteredResources(_0x471827,_0x138ead[_0x260c80]));}}}}}return BPromise[_0xed70('0x7a')](_0x333017);}else{return null;}})[_0xed70('0x28')](function(_0x23e011){var _0x1c1972=_0x23e011;var _0x2f7049=null;if(_0x1c1972){_0x2f7049=_0x1c1972[_0xed70('0x49')]===0x1?_0x1c1972[0x0]:null;}if(_0x2f7049||_0x1c1972){var _0x33bee1=db[_0x315170[_0xed70('0x75')]][_0xed70('0x31')];_0x187035[_0xed70('0x35')]=_[_0xed70('0x36')](_0x33bee1);_0x187035[_0xed70('0x37')]=_[_0xed70('0x36')](_0x2ab7e1['query']);_0x187035['filters']=_[_0xed70('0x38')](_0x187035[_0xed70('0x35')],_0x187035[_0xed70('0x37')]);_0xea0df0['attributes']=_['intersection'](_0x187035[_0xed70('0x35')],qs[_0xed70('0x39')](_0x2ab7e1['query'][_0xed70('0x39')]));_0xea0df0[_0xed70('0x3a')]=_0xea0df0[_0xed70('0x3a')]['length']?_0xea0df0[_0xed70('0x3a')]:_0x187035[_0xed70('0x35')];if(!_0x2ab7e1['query'][_0xed70('0x3b')](_0xed70('0x3c'))){_0xea0df0[_0xed70('0x23')]=qs[_0xed70('0x23')](_0x2ab7e1[_0xed70('0x37')][_0xed70('0x23')]);_0xea0df0['offset']=qs[_0xed70('0x22')](_0x2ab7e1[_0xed70('0x37')][_0xed70('0x22')]);}_0xea0df0[_0xed70('0x3d')]=qs[_0xed70('0x3e')](_0x2ab7e1[_0xed70('0x37')]['sort']);_0xea0df0['where']=qs['filters'](_[_0xed70('0x7d')](_0x2ab7e1[_0xed70('0x37')],_0x187035[_0xed70('0x40')]));if(_0x2ab7e1[_0xed70('0x37')][_0xed70('0x41')]){_0xea0df0['where']=_['merge'](_0xea0df0[_0xed70('0x3f')],{'$or':_[_0xed70('0x2f')](_0x33bee1,function(_0x5a58f4){if(_0x5a58f4[_0xed70('0x33')][_0xed70('0x34')]!=='VIRTUAL'){var _0x21bcaa={};_0x21bcaa[_0x5a58f4['field']]={'$like':'%'+_0x2ab7e1['query'][_0xed70('0x41')]+'%'};return _0x21bcaa;}})});}var _0x36ec20=[];if(_0x2f7049){var _0x19c56d=_[_0xed70('0x4c')](_0x3d3ee8,[_0xed70('0x2c'),_0x2f7049[_0xed70('0x2c')]]);if(_0x19c56d[_0xed70('0x7e')]){var _0x248905={};if(_0x315170['childModel']===_0xed70('0x7f')){_0x248905[_0x19c56d[_0xed70('0x80')]]=_['map'](_0x2f7049['associatedResources'],'id');}else{_0x248905[_0x19c56d[_0xed70('0x80')]]=_0x2f7049['associatedResources'];}_0x36ec20[_0xed70('0x67')](_0x248905);}else{_0xea0df0[_0xed70('0x3f')]['id']=_0x2f7049[_0xed70('0x81')];}}else{for(var _0x3ee986=0x0;_0x3ee986<_0x1c1972['length'];_0x3ee986++){var _0x19c56d=_['find'](_0x3d3ee8,['name',_0x1c1972[_0x3ee986][_0xed70('0x2c')]]);if(_0x19c56d[_0xed70('0x7e')]){var _0x248905={};_0x248905[_0x19c56d[_0xed70('0x80')]]=_0x1c1972[_0x3ee986][_0xed70('0x81')];_0x36ec20[_0xed70('0x67')](_0x248905);}else{if(!_0xea0df0[_0xed70('0x3f')]['id'])_0xea0df0[_0xed70('0x3f')]['id']=[];_0x1c1972[_0x3ee986][_0xed70('0x81')][_0xed70('0x68')](function(_0x40769f){_0xea0df0['where']['id'][_0xed70('0x67')](_0x40769f);});}}}if(!_[_0xed70('0x65')](_0x36ec20)){_0xea0df0[_0xed70('0x3f')]=_['merge'](_0xea0df0[_0xed70('0x3f')],{'$and':{'$or':_0x36ec20}});}_0xea0df0=_[_0xed70('0x4b')]({},_0xea0df0,_0x2ab7e1['options']);if(_0x2f7049&&!_0x2f7049[_0xed70('0x59')]&&_0x315170[_0xed70('0x75')]===_0xed70('0x7f')){if(_0x2ab7e1['query'][_0xed70('0x4a')]){_0xea0df0[_0xed70('0x44')]=[{'all':!![]}];}return db[_0x315170[_0xed70('0x75')]][_0xed70('0x45')](_0xea0df0)['then'](function(_0x4dc3c2){var _0x5ce275=[];_0x4dc3c2['forEach'](function(_0x20d67e){var _0xe47060;switch(_0x20d67e[_0xed70('0x82')]){case _0xed70('0x83'):_0xe47060=_['find'](_0x2f7049['associatedResources'],function(_0x12c366){return _0x12c366['id']===_0x20d67e[_0xed70('0x84')]&&_0x12c366['type']===_0xed70('0x85');});break;case'custom':_0xe47060=_[_0xed70('0x4c')](_0x2f7049['associatedResources'],function(_0x416018){return _0x416018['id']===_0x20d67e[_0xed70('0x84')]&&_0x416018[_0xed70('0x33')]===_0xed70('0x86');});break;}if(_0xe47060)_0x5ce275[_0xed70('0x67')](_0x20d67e);});_0x254568[_0xed70('0x21')]=_0x5ce275['length'];_0x254568[_0xed70('0x46')]=_0x5ce275;return _0x254568;});}else{return db[_0x315170[_0xed70('0x75')]]['count']({'where':_0xea0df0['where']})['then'](function(_0x27a75a){_0x254568[_0xed70('0x21')]=_0x27a75a;if(_0x2ab7e1[_0xed70('0x37')]['includeAll']){if(_0x315170[_0xed70('0x75')]===_0xed70('0x87')){_0xea0df0[_0xed70('0x44')]=[{'model':db[_0xed70('0x88')],'as':_0xed70('0x89'),'attributes':['id',_0xed70('0x2c'),'color'],'required':_0x2ab7e1[_0xed70('0x37')][_0xed70('0x8a')]?!![]:![]},{'model':db[_0xed70('0x88')],'as':_0xed70('0x8b'),'attributes':['id',_0xed70('0x2c'),'color'],'through':_0x2ab7e1[_0xed70('0x37')][_0xed70('0x8a')]?{'attributes':[],'where':{'TagId':_0x2ab7e1[_0xed70('0x37')][_0xed70('0x8a')]||undefined}}:{},'required':_0x2ab7e1[_0xed70('0x37')][_0xed70('0x8a')]?!![]:![]}];}else{_0xea0df0[_0xed70('0x44')]=[{'all':!![]}];}}return db[_0x315170[_0xed70('0x75')]][_0xed70('0x45')](_0xea0df0);})[_0xed70('0x28')](function(_0x326d4a){_0x254568[_0xed70('0x46')]=_0x326d4a;return _0x254568;});}}else{return _0x254568;}})[_0xed70('0x28')](respondWithFilteredResult(_0x567f54,_0xea0df0))[_0xed70('0x4f')](handleError(_0x567f54,null));};function getAllResources(_0xf660cd,_0x58aab6){return new BPromise(function(_0x4aa5df,_0x49e66a){if(_0x58aab6){var _0xb07407=_0x58aab6[_0xed70('0x41')]?{[_0x58aab6[_0xed70('0x41')]['field']]:_0x58aab6[_0xed70('0x41')][_0xed70('0x8c')]}:undefined;return db[_0xf660cd][_0xed70('0x45')]({'where':_0xb07407,'raw':!![]})[_0xed70('0x28')](function(_0x2ca838){_0x58aab6['associatedResources']=_[_0xed70('0x2f')](_0x2ca838,'id');_0x4aa5df(_0x58aab6);})[_0xed70('0x4f')](function(_0x2a2cd2){_0x49e66a(_0x2a2cd2);});}else{_0x4aa5df(null);}});}function getAllFilteredResources(_0x4ac5be,_0x1b8f5c){return new BPromise(function(_0x15aabd,_0x29720c){var _0x30b574=_0x4ac5be[_0xed70('0x41')]?{[_0x4ac5be[_0xed70('0x41')][_0xed70('0x7e')]]:_0x4ac5be['filter'][_0xed70('0x8c')]}:undefined;return db[_0x4ac5be[_0xed70('0x35')]][_0xed70('0x45')]({'where':_0x30b574,'raw':!![]})[_0xed70('0x28')](function(_0x4526a2){_0x1b8f5c[_0xed70('0x81')]=_[_0xed70('0x2f')](_0x4526a2,function(_0x3d8997){return _0x3d8997['name'];});_0x15aabd(_0x1b8f5c);})['catch'](function(_0x357265){_0x29720c(_0x357265);});});}function getAllowedResources(_0x3b34fe,_0x9e24d7,_0x335a47){return new BPromise(function(_0x129bd0,_0x4a0b66){if(_0x9e24d7){return db[_0xed70('0x5f')]['findAll']({'where':{'sectionId':_0x9e24d7['id']},'raw':!![]})[_0xed70('0x28')](function(_0x47e246){if(_0x3b34fe[_0xed70('0x7e')]&&_0x3b34fe[_0xed70('0x7e')]!=='id'){_0x9e24d7[_0xed70('0x81')]=_['map'](_0x47e246,function(_0x484e73){return _0x484e73[_0x3b34fe[_0xed70('0x7e')]];});}else{if(_0x335a47==='AnalyticExtractedReport'){_0x9e24d7[_0xed70('0x81')]=_['map'](_0x47e246,function(_0x278621){return{'id':_0x278621[_0xed70('0x69')],'type':_0x278621[_0xed70('0x33')]};});}else{_0x9e24d7['associatedResources']=_[_0xed70('0x2f')](_0x47e246,function(_0x239b00){return _0x239b00[_0xed70('0x69')];});}}_0x129bd0(_0x9e24d7);})[_0xed70('0x4f')](function(_0x3c353e){_0x4a0b66(_0x3c353e);});}else{_0x129bd0(null);}});}function getQueryModels(_0x5481de,_0x417788){var _0x15890e=_0x5481de['toLowerCase']();var _0x35e596={'childModel':undefined,'parentSections':[]};switch(_0x15890e){case _0xed70('0x8d'):_0x35e596[_0xed70('0x75')]=_0xed70('0x8e');break;case _0xed70('0x8f'):_0x35e596[_0xed70('0x75')]=_0xed70('0x90');break;case _0xed70('0x91'):_0x35e596['childModel']=_0xed70('0x92');_0x35e596[_0xed70('0x78')]=[{'name':_0xed70('0x93'),'field':'name','foreignKey':_0xed70('0x94')}];break;case'projects':_0x35e596[_0xed70('0x75')]=_0xed70('0x95');break;case _0xed70('0x96'):_0x35e596['childModel']=_0xed70('0x87');_0x35e596[_0xed70('0x78')]=[{'name':_0xed70('0x97'),'field':'id','foreignKey':'ListId'}];break;case _0xed70('0x98'):_0x35e596['childModel']=_0xed70('0x99');break;case _0xed70('0x9a'):_0x35e596['childModel']='CmCompany';break;case'globalcustomfields':_0x35e596[_0xed70('0x75')]=_0xed70('0x9b');break;case _0xed70('0x9c'):_0x35e596['childModel']=_0xed70('0x9d');break;case _0xed70('0x9e'):_0x35e596[_0xed70('0x75')]='ChatWebsite';break;case _0xed70('0x9f'):_0x35e596[_0xed70('0x75')]=_0xed70('0xa0');break;case'faxaccounts':_0x35e596[_0xed70('0x75')]=_0xed70('0xa1');break;case'inboundroutes':case _0xed70('0xa2'):case _0xed70('0xa3'):_0x35e596['childModel']=_0xed70('0xa4');break;case _0xed70('0xa5'):_0x35e596[_0xed70('0x75')]='VoiceContext';break;case _0xed70('0xa6'):_0x35e596[_0xed70('0x75')]=_0xed70('0xa7');break;case _0xed70('0xa8'):_0x35e596[_0xed70('0x75')]=_0xed70('0xa9');_0x35e596['parentSections']=[{'name':_0xed70('0xaa'),'field':_0xed70('0x2c'),'foreignKey':_0xed70('0xab'),'model':'User','filter':{'field':_0xed70('0xac'),'value':['agent']}},{'name':_0xed70('0xad'),'field':'name','foreignKey':_0xed70('0xab'),'model':_0xed70('0xae'),'filter':{'field':_0xed70('0xac'),'value':[_0xed70('0xaf')]}},{'name':_0xed70('0xb0'),'field':'name','foreignKey':_0xed70('0xb1'),'model':_0xed70('0xb2'),'filter':{'field':_0xed70('0x33'),'value':[_0xed70('0xb3')]}},{'name':_0xed70('0xb4'),'field':_0xed70('0x2c'),'foreignKey':'queue','model':_0xed70('0xb2'),'filter':{'field':_0xed70('0x33'),'value':[_0xed70('0xb5')]}}];break;case _0xed70('0xb6'):_0x35e596[_0xed70('0x75')]=_0xed70('0xb7');break;case _0xed70('0xb8'):_0x35e596[_0xed70('0x75')]=_0xed70('0xb9');break;case _0xed70('0xba'):_0x35e596[_0xed70('0x75')]=_0xed70('0xbb');break;case _0xed70('0xbc'):_0x35e596[_0xed70('0x75')]=_0xed70('0xbd');break;case'mailqueues':_0x35e596['childModel']=_0xed70('0xbe');break;case _0xed70('0xbf'):_0x35e596['childModel']='MailAccount';break;case _0xed70('0xc0'):_0x35e596[_0xed70('0x75')]=_0xed70('0xc1');break;case _0xed70('0xc2'):_0x35e596['childModel']='OpenchannelQueue';break;case _0xed70('0xc3'):_0x35e596[_0xed70('0x75')]='OpenchannelAccount';break;case _0xed70('0xc4'):_0x35e596[_0xed70('0x75')]=_0xed70('0xc5');break;case'smsaccounts':_0x35e596[_0xed70('0x75')]='SmsAccount';break;case _0xed70('0xc6'):_0x35e596['childModel']=_0xed70('0xc7');break;case _0xed70('0xc8'):_0x35e596[_0xed70('0x75')]=_0xed70('0xc9');break;case'teams':_0x35e596['childModel']=_0xed70('0xca');break;case _0xed70('0xcb'):case'queuecampaigns':_0x35e596[_0xed70('0x75')]='VoiceQueue';if(_0x417788){_0x35e596[_0xed70('0x78')]=[{'name':_0xed70('0xb0')},{'name':_0xed70('0xb4')}];}break;case _0xed70('0xcc'):case _0xed70('0xcd'):case _0xed70('0xce'):_0x35e596[_0xed70('0x75')]=_0xed70('0xae');if(_0x417788){_0x35e596[_0xed70('0x78')]=[{'name':_0xed70('0xcf'),'filter':{'field':_0xed70('0xac'),'value':[_0xed70('0xd0'),_0xed70('0xd1')]},'ignore':!![]},{'name':_0xed70('0xaa')},{'name':_0xed70('0xad')}];}break;case _0xed70('0xd2'):_0x35e596[_0xed70('0x75')]=_0xed70('0xd3');break;case _0xed70('0xd4'):_0x35e596[_0xed70('0x75')]=_0xed70('0xd5');break;case'freshdeskaccounts':_0x35e596[_0xed70('0x75')]='FreshdeskAccount';break;case _0xed70('0xd6'):_0x35e596[_0xed70('0x75')]=_0xed70('0xd7');break;case _0xed70('0xd8'):_0x35e596[_0xed70('0x75')]=_0xed70('0xd9');break;case _0xed70('0xda'):_0x35e596[_0xed70('0x75')]=_0xed70('0xdb');break;case _0xed70('0xdc'):_0x35e596['childModel']='User';break;case _0xed70('0xdd'):_0x35e596[_0xed70('0x75')]=_0xed70('0xde');break;case _0xed70('0xdf'):_0x35e596[_0xed70('0x75')]=_0xed70('0xe0');break;case _0xed70('0xe1'):_0x35e596[_0xed70('0x75')]=_0xed70('0xe2');break;case _0xed70('0xe3'):_0x35e596['childModel']=_0xed70('0xe4');break;case'pauses':_0x35e596[_0xed70('0x75')]=_0xed70('0xe5');break;case _0xed70('0xe6'):_0x35e596[_0xed70('0x75')]=_0xed70('0xe7');break;case _0xed70('0xe8'):_0x35e596[_0xed70('0x75')]='Sound';break;case _0xed70('0xe9'):_0x35e596['childModel']='Tag';break;case _0xed70('0xea'):_0x35e596[_0xed70('0x75')]='Template';break;case'triggers':_0x35e596[_0xed70('0x75')]=_0xed70('0xeb');break;case _0xed70('0xec'):_0x35e596[_0xed70('0x75')]=_0xed70('0xed');break;case _0xed70('0xee'):_0x35e596[_0xed70('0x75')]=_0xed70('0xef');break;case'plugins':_0x35e596[_0xed70('0x75')]=_0xed70('0x6a');break;case _0xed70('0xf0'):_0x35e596[_0xed70('0x75')]=_0xed70('0x7f');_0x35e596[_0xed70('0x78')]=[{'name':_0xed70('0xf1'),'field':'id','foreignKey':_0xed70('0x84')}];break;case _0xed70('0xf2'):_0x35e596[_0xed70('0x75')]=_0xed70('0xf3');break;case _0xed70('0xc8'):_0x35e596[_0xed70('0x75')]=_0xed70('0xc9');break;default:return _0x35e596;}return _0x35e596;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e984b0f..9127667 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 _0x2e65=['events','setMaxListeners','save','emit','hook','exports'];(function(_0xeb133b,_0x4abb92){var _0x5718bd=function(_0x298455){while(--_0x298455){_0xeb133b['push'](_0xeb133b['shift']());}};_0x5718bd(++_0x4abb92);}(_0x2e65,0xde));var _0x52e6=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x2e65[_0x2601b4];return _0x3e3661;};'use strict';var EventEmitter=require(_0x52e6('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x52e6('0x1')](0x0);var events={'afterCreate':_0x52e6('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x13dacd){return function(_0x4b67a9,_0x3c6665,_0x3c73c1){UserProfileEvents[_0x52e6('0x3')](_0x13dacd+':'+_0x4b67a9['id'],_0x4b67a9);UserProfileEvents[_0x52e6('0x3')](_0x13dacd,_0x4b67a9);_0x3c73c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x52e6('0x4')](e,emitEvent(event));}}module[_0x52e6('0x5')]=UserProfileEvents; \ No newline at end of file +var _0xe69c=['emit','hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners','save','update','remove'];(function(_0x2445b3,_0x80f4ce){var _0x5a6d7d=function(_0x278051){while(--_0x278051){_0x2445b3['push'](_0x2445b3['shift']());}};_0x5a6d7d(++_0x80f4ce);}(_0xe69c,0x112));var _0xce69=function(_0x5c6923,_0x43d0ec){_0x5c6923=_0x5c6923-0x0;var _0x3483c8=_0xe69c[_0x5c6923];return _0x3483c8;};'use strict';var EventEmitter=require(_0xce69('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xce69('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xce69('0x2')](0x0);var events={'afterCreate':_0xce69('0x3'),'afterUpdate':_0xce69('0x4'),'afterDestroy':_0xce69('0x5')};function emitEvent(_0xda573d){return function(_0x3bcca5,_0x2cb355,_0x13bed9){UserProfileEvents['emit'](_0xda573d+':'+_0x3bcca5['id'],_0x3bcca5);UserProfileEvents[_0xce69('0x6')](_0xda573d,_0x3bcca5);_0x13bed9(null);};}for(var e in events){if(events[_0xce69('0x7')](e)){var event=events[e];UserProfile[_0xce69('0x8')](e,emitEvent(event));}}module[_0xce69('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 0b90230..69fc774 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 _0x71d3=['request-promise','../../config/environment','exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api','bluebird'];(function(_0x810bf7,_0x5b794b){var _0x39865f=function(_0x31b075){while(--_0x31b075){_0x810bf7['push'](_0x810bf7['shift']());}};_0x39865f(++_0x5b794b);}(_0x71d3,0x74));var _0x371d=function(_0x4fdc67,_0x438bee){_0x4fdc67=_0x4fdc67-0x0;var _0x2c4988=_0x71d3[_0x4fdc67];return _0x2c4988;};'use strict';var _=require(_0x371d('0x0'));var util=require(_0x371d('0x1'));var logger=require(_0x371d('0x2'))(_0x371d('0x3'));var moment=require('moment');var BPromise=require(_0x371d('0x4'));var rp=require(_0x371d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x371d('0x6'));var attributes=require('./userProfile.attributes');module[_0x371d('0x7')]=function(_0x50acac,_0x305c9b){return _0x50acac[_0x371d('0x8')](_0x371d('0x9'),attributes,{'tableName':_0x371d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed9d=['lodash','util','api','bluebird','request-promise','path','rimraf','exports','define','UserProfile'];(function(_0x1fc3e3,_0x5778db){var _0x502b11=function(_0x23b623){while(--_0x23b623){_0x1fc3e3['push'](_0x1fc3e3['shift']());}};_0x502b11(++_0x5778db);}(_0xed9d,0x14a));var _0xded9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xed9d[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xded9('0x0'));var util=require(_0xded9('0x1'));var logger=require('../../config/logger')(_0xded9('0x2'));var moment=require('moment');var BPromise=require(_0xded9('0x3'));var rp=require(_0xded9('0x4'));var fs=require('fs');var path=require(_0xded9('0x5'));var rimraf=require(_0xded9('0x6'));var config=require('../../config/environment');var attributes=require('./userProfile.attributes');module[_0xded9('0x7')]=function(_0x401c87,_0x40edfa){return _0x401c87[_0xded9('0x8')](_0xded9('0x9'),attributes,{'tableName':'user_profiles','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 22bbd87..1c6c3b3 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 _0xae24=['info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xae24,0x182));var _0x4ae2=function(_0x178f85,_0x2e13f3){_0x178f85=_0x178f85-0x0;var _0x4476c9=_0xae24[_0x178f85];return _0x4476c9;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var moment=require(_0x4ae2('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ae2('0x2'));var fs=require('fs');var Redis=require(_0x4ae2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ae2('0x4'))('rpc');var config=require(_0x4ae2('0x5'));var jayson=require(_0x4ae2('0x6'));var client=jayson[_0x4ae2('0x7')][_0x4ae2('0x8')]({'port':0x232a});config[_0x4ae2('0x9')]=_[_0x4ae2('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ae2('0xb'))(new Redis(config['redis']));require('./userProfile.socket')[_0x4ae2('0xc')](socket);function respondWithRpcPromise(_0xb01e8e,_0x5c32b7,_0x3b3acc){return new BPromise(function(_0x449e1a,_0x171449){return client[_0x4ae2('0xd')](_0xb01e8e,_0x3b3acc)['then'](function(_0x19b222){logger[_0x4ae2('0xe')](_0x4ae2('0xf'),_0x5c32b7,'request\x20sent');logger[_0x4ae2('0x10')](_0x4ae2('0x11'),_0x5c32b7,_0x4ae2('0x12'),JSON[_0x4ae2('0x13')](_0x19b222));if(_0x19b222[_0x4ae2('0x14')]){if(_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x15')]===0x1f4){logger[_0x4ae2('0x14')](_0x4ae2('0xf'),_0x5c32b7,_0x19b222['error']['message']);return _0x171449(_0x19b222['error'][_0x4ae2('0x16')]);}logger[_0x4ae2('0x14')]('UserProfile,\x20%s,\x20%s',_0x5c32b7,_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x16')]);return _0x449e1a(_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x16')]);}else{logger[_0x4ae2('0xe')](_0x4ae2('0xf'),_0x5c32b7,_0x4ae2('0x12'));_0x449e1a(_0x19b222[_0x4ae2('0x17')][_0x4ae2('0x16')]);}})[_0x4ae2('0x18')](function(_0x4d5071){logger['error'](_0x4ae2('0xf'),_0x5c32b7,_0x4d5071);_0x171449(_0x4d5071);});});} \ No newline at end of file +var _0x98a8=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./userProfile.socket','register','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','UserProfile,\x20%s,\x20%s'];(function(_0x619753,_0x31dbc4){var _0x14a1bc=function(_0x23ad0e){while(--_0x23ad0e){_0x619753['push'](_0x619753['shift']());}};_0x14a1bc(++_0x31dbc4);}(_0x98a8,0x12c));var _0x898a=function(_0x27a7e7,_0x506c03){_0x27a7e7=_0x27a7e7-0x0;var _0x134061=_0x98a8[_0x27a7e7];return _0x134061;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});config[_0x898a('0xc')]=_['defaults'](config[_0x898a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x898a('0xd'))(new Redis(config[_0x898a('0xc')]));require(_0x898a('0xe'))[_0x898a('0xf')](socket);function respondWithRpcPromise(_0x3150df,_0x388a47,_0x42faa4){return new BPromise(function(_0x1a92de,_0x3806cb){return client['request'](_0x3150df,_0x42faa4)[_0x898a('0x10')](function(_0x502e95){logger[_0x898a('0x11')]('UserProfile,\x20%s,\x20%s',_0x388a47,_0x898a('0x12'));logger[_0x898a('0x13')](_0x898a('0x14'),_0x388a47,'request\x20sent',JSON['stringify'](_0x502e95));if(_0x502e95['error']){if(_0x502e95[_0x898a('0x15')][_0x898a('0x16')]===0x1f4){logger[_0x898a('0x15')](_0x898a('0x17'),_0x388a47,_0x502e95[_0x898a('0x15')][_0x898a('0x18')]);return _0x3806cb(_0x502e95['error'][_0x898a('0x18')]);}logger['error'](_0x898a('0x17'),_0x388a47,_0x502e95['error'][_0x898a('0x18')]);return _0x1a92de(_0x502e95['error'][_0x898a('0x18')]);}else{logger['info'](_0x898a('0x17'),_0x388a47,_0x898a('0x12'));_0x1a92de(_0x502e95[_0x898a('0x19')]['message']);}})[_0x898a('0x1a')](function(_0x5960e0){logger['error'](_0x898a('0x17'),_0x388a47,_0x5960e0);_0x3806cb(_0x5960e0);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 8989e0a..9cb60fa 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 _0xf245=['save','update','emit','register','length','userProfile:','./userProfile.events'];(function(_0x5f1f27,_0x473279){var _0x13caf8=function(_0x23b17f){while(--_0x23b17f){_0x5f1f27['push'](_0x5f1f27['shift']());}};_0x13caf8(++_0x473279);}(_0xf245,0x1db));var _0x5f24=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xf245[_0xaa0309];return _0x5de7ce;};'use strict';var UserProfileEvents=require(_0x5f24('0x0'));var events=[_0x5f24('0x1'),'remove',_0x5f24('0x2')];function createListener(_0x389025,_0x35966d){return function(_0x4fcbf9){_0x35966d[_0x5f24('0x3')](_0x389025,_0x4fcbf9);};}function removeListener(_0xf8186a,_0x57cb19){return function(){UserProfileEvents['removeListener'](_0xf8186a,_0x57cb19);};}exports[_0x5f24('0x4')]=function(_0x4aa16d){for(var _0x4380c5=0x0,_0x3b9070=events[_0x5f24('0x5')];_0x4380c5<_0x3b9070;_0x4380c5++){var _0x376584=events[_0x4380c5];var _0x5edd20=createListener(_0x5f24('0x6')+_0x376584,_0x4aa16d);UserProfileEvents['on'](_0x376584,_0x5edd20);}}; \ No newline at end of file +var _0x2d10=['save','remove','update','emit','removeListener','register','userProfile:','./userProfile.events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2d10,0x15f));var _0x02d1=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x2d10[_0x46e363];return _0x3fb059;};'use strict';var UserProfileEvents=require(_0x02d1('0x0'));var events=[_0x02d1('0x1'),_0x02d1('0x2'),_0x02d1('0x3')];function createListener(_0x33532e,_0x2c01e3){return function(_0x2f355a){_0x2c01e3[_0x02d1('0x4')](_0x33532e,_0x2f355a);};}function removeListener(_0x26068c,_0x145ea6){return function(){UserProfileEvents[_0x02d1('0x5')](_0x26068c,_0x145ea6);};}exports[_0x02d1('0x6')]=function(_0x404db5){for(var _0x2b1050=0x0,_0x1e822d=events['length'];_0x2b1050<_0x1e822d;_0x2b1050++){var _0x3093bf=events[_0x2b1050];var _0x39d5e2=createListener(_0x02d1('0x7')+_0x3093bf,_0x404db5);UserProfileEvents['on'](_0x3093bf,_0x39d5e2);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 79d5ebd..645b794 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 _0x370f=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','/describe','get','/:id','post','create','put','update','delete'];(function(_0x2daf22,_0x52ce2a){var _0x5f44fc=function(_0x4fa4f4){while(--_0x4fa4f4){_0x2daf22['push'](_0x2daf22['shift']());}};_0x5f44fc(++_0x52ce2a);}(_0x370f,0x132));var _0xf370=function(_0x13ae3b,_0x4ddd7c){_0x13ae3b=_0x13ae3b-0x0;var _0x145764=_0x370f[_0x13ae3b];return _0x145764;};'use strict';var multer=require(_0xf370('0x0'));var util=require(_0xf370('0x1'));var path=require(_0xf370('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf370('0x3')]();var auth=require(_0xf370('0x4'));var interaction=require(_0xf370('0x5'));var config=require(_0xf370('0x6'));var controller=require(_0xf370('0x7'));router['get']('/',auth[_0xf370('0x8')](),controller['index']);router['get'](_0xf370('0x9'),auth[_0xf370('0x8')](),controller['describe']);router[_0xf370('0xa')](_0xf370('0xb'),auth[_0xf370('0x8')](),controller['show']);router[_0xf370('0xc')]('/',auth[_0xf370('0x8')](),controller[_0xf370('0xd')]);router[_0xf370('0xe')](_0xf370('0xb'),auth['isAuthenticated'](),controller[_0xf370('0xf')]);router[_0xf370('0x10')](_0xf370('0xb'),auth['isAuthenticated'](),controller[_0xf370('0x11')]);module[_0xf370('0x12')]=router; \ No newline at end of file +var _0xedd0=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xedd0,0x6c));var _0x0edd=function(_0xc902a3,_0x35d2df){_0xc902a3=_0xc902a3-0x0;var _0x20745b=_0xedd0[_0xc902a3];return _0x20745b;};'use strict';var multer=require(_0x0edd('0x0'));var util=require(_0x0edd('0x1'));var path=require(_0x0edd('0x2'));var timeout=require('connect-timeout');var express=require(_0x0edd('0x3'));var router=express[_0x0edd('0x4')]();var auth=require(_0x0edd('0x5'));var interaction=require(_0x0edd('0x6'));var config=require(_0x0edd('0x7'));var controller=require(_0x0edd('0x8'));router[_0x0edd('0x9')]('/',auth[_0x0edd('0xa')](),controller[_0x0edd('0xb')]);router[_0x0edd('0x9')](_0x0edd('0xc'),auth['isAuthenticated'](),controller[_0x0edd('0xd')]);router['get'](_0x0edd('0xe'),auth[_0x0edd('0xa')](),controller[_0x0edd('0xf')]);router['post']('/',auth[_0x0edd('0xa')](),controller[_0x0edd('0x10')]);router[_0x0edd('0x11')]('/:id',auth[_0x0edd('0xa')](),controller[_0x0edd('0x12')]);router[_0x0edd('0x13')](_0x0edd('0xe'),auth[_0x0edd('0xa')](),controller[_0x0edd('0x14')]);module[_0x0edd('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index db93f24..94a499b 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 _0x356e=['INTEGER','sequelize','exports','STRING'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x356e,0x85));var _0xe356=function(_0x43a65b,_0xf6f770){_0x43a65b=_0x43a65b-0x0;var _0x201e50=_0x356e[_0x43a65b];return _0x201e50;};'use strict';var Sequelize=require(_0xe356('0x0'));module[_0xe356('0x1')]={'name':{'type':Sequelize[_0xe356('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe356('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe356('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xca3e=['STRING','sequelize','INTEGER'];(function(_0x3b2b8e,_0x1a52c2){var _0x213c00=function(_0x1cd27a){while(--_0x1cd27a){_0x3b2b8e['push'](_0x3b2b8e['shift']());}};_0x213c00(++_0x1a52c2);}(_0xca3e,0x103));var _0xeca3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xca3e[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xeca3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xeca3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xeca3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 791d0de..ea0899a 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 _0x53ec=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','merge','VIRTUAL','filter','options','UserProfileResource','includeAll','rows','catch','rawAttributes','keys','find','body','destroy','describe'];(function(_0x56c604,_0x1424eb){var _0x3ae577=function(_0x4957d1){while(--_0x4957d1){_0x56c604['push'](_0x56c604['shift']());}};_0x3ae577(++_0x1424eb);}(_0x53ec,0x192));var _0xc53e=function(_0x465b0c,_0x569d90){_0x465b0c=_0x465b0c-0x0;var _0x502ff0=_0x53ec[_0x465b0c];return _0x502ff0;};'use strict';var pdf=require(_0xc53e('0x0'));var emlformat=require(_0xc53e('0x1'));var rimraf=require(_0xc53e('0x2'));var zipdir=require(_0xc53e('0x3'));var jsonpatch=require(_0xc53e('0x4'));var rp=require(_0xc53e('0x5'));var moment=require('moment');var BPromise=require(_0xc53e('0x6'));var Mustache=require('mustache');var util=require(_0xc53e('0x7'));var path=require(_0xc53e('0x8'));var sox=require('sox');var csv=require(_0xc53e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0xe'));var Papa=require(_0xc53e('0xf'));var Redis=require(_0xc53e('0x10'));var authService=require(_0xc53e('0x11'));var qs=require(_0xc53e('0x12'));var as=require(_0xc53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x15'));var db=require(_0xc53e('0x16'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x17')](_0x4203aa)[_0xc53e('0x18')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x17')](_0x3d2e17)[_0xc53e('0x19')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=_0x2ad6eb[_0xc53e('0x1a')],_0x8a522e=_0x455e4d[_0xc53e('0x1b')],_0x191567=_0x455e4d[_0xc53e('0x1b')]+_0x455e4d[_0xc53e('0x1c')],_0x535cd4;if(_0x191567>=_0x5b0a88){_0x191567=_0x5b0a88;_0x535cd4=0xc8;}else{_0x535cd4=0xce;}_0x19c0d1[_0xc53e('0x17')](_0x535cd4);return _0x19c0d1[_0xc53e('0x1d')]('Content-Range',_0x8a522e+'-'+_0x191567+'/'+_0x5b0a88)['json'](_0x2ad6eb);}return null;};}function patchUpdates(_0x35b7b2){return function(_0x2a5bac){try{jsonpatch[_0xc53e('0x1e')](_0x2a5bac,_0x35b7b2,!![]);}catch(_0x2e85df){return BPromise[_0xc53e('0x1f')](_0x2e85df);}return _0x2a5bac[_0xc53e('0x20')]();};}function saveUpdates(_0x15a015,_0x25702b){return function(_0x364c80){if(_0x364c80){return _0x364c80[_0xc53e('0x21')](_0x15a015)[_0xc53e('0x22')](function(_0x44fd93){return _0x44fd93;});}return null;};}function removeEntity(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['destroy']()[_0xc53e('0x22')](function(){_0x426467[_0xc53e('0x17')](0xcc)[_0xc53e('0x18')]();});}};}function handleEntityNotFound(_0x4015c8,_0x180811){return function(_0x5009e1){if(!_0x5009e1){_0x4015c8['sendStatus'](0x194);}return _0x5009e1;};}function handleError(_0xe06e42,_0x496167){_0x496167=_0x496167||0x1f4;return function(_0x1ae55e){logger[_0xc53e('0x23')](_0x1ae55e[_0xc53e('0x24')]);if(_0x1ae55e[_0xc53e('0x25')]){delete _0x1ae55e[_0xc53e('0x25')];}_0xe06e42['status'](_0x496167)[_0xc53e('0x26')](_0x1ae55e);};}exports['index']=function(_0x4d9a68,_0x5c65d3){var _0x3c5056={},_0x57a1f5={},_0x28240a={'count':0x0,'rows':[]};var _0x4f203d=_[_0xc53e('0x27')](db['UserProfileResource']['rawAttributes'],function(_0x8f0ee6){return{'name':_0x8f0ee6[_0xc53e('0x28')],'type':_0x8f0ee6[_0xc53e('0x29')][_0xc53e('0x2a')]};});_0x57a1f5[_0xc53e('0x2b')]=_[_0xc53e('0x27')](_0x4f203d,_0xc53e('0x25'));_0x57a1f5[_0xc53e('0x2c')]=_['keys'](_0x4d9a68[_0xc53e('0x2c')]);_0x57a1f5[_0xc53e('0x2d')]=_[_0xc53e('0x2e')](_0x57a1f5['model'],_0x57a1f5[_0xc53e('0x2c')]);_0x3c5056['attributes']=_[_0xc53e('0x2e')](_0x57a1f5[_0xc53e('0x2b')],qs['fields'](_0x4d9a68['query'][_0xc53e('0x2f')]));_0x3c5056[_0xc53e('0x30')]=_0x3c5056[_0xc53e('0x30')][_0xc53e('0x31')]?_0x3c5056[_0xc53e('0x30')]:_0x57a1f5[_0xc53e('0x2b')];if(!_0x4d9a68[_0xc53e('0x2c')][_0xc53e('0x32')]('nolimit')){_0x3c5056[_0xc53e('0x1c')]=qs[_0xc53e('0x1c')](_0x4d9a68[_0xc53e('0x2c')][_0xc53e('0x1c')]);_0x3c5056[_0xc53e('0x1b')]=qs[_0xc53e('0x1b')](_0x4d9a68[_0xc53e('0x2c')][_0xc53e('0x1b')]);}_0x3c5056[_0xc53e('0x33')]=qs['sort'](_0x4d9a68[_0xc53e('0x2c')]['sort']);_0x3c5056[_0xc53e('0x34')]=qs[_0xc53e('0x2d')](_['pick'](_0x4d9a68[_0xc53e('0x2c')],_0x57a1f5[_0xc53e('0x2d')]),_0x4f203d);if(_0x4d9a68[_0xc53e('0x2c')]['filter']){_0x3c5056[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x3c5056[_0xc53e('0x34')],{'$or':_[_0xc53e('0x27')](_0x4f203d,function(_0xeaec72){if(_0xeaec72[_0xc53e('0x29')]!==_0xc53e('0x36')){var _0x482085={};_0x482085[_0xeaec72[_0xc53e('0x25')]]={'$like':'%'+_0x4d9a68[_0xc53e('0x2c')][_0xc53e('0x37')]+'%'};return _0x482085;}})});}_0x3c5056=_['merge']({},_0x3c5056,_0x4d9a68[_0xc53e('0x38')]);var _0x5e8ab7={'where':_0x3c5056[_0xc53e('0x34')]};return db[_0xc53e('0x39')][_0xc53e('0x1a')](_0x5e8ab7)[_0xc53e('0x22')](function(_0x3036e7){_0x28240a['count']=_0x3036e7;if(_0x4d9a68[_0xc53e('0x2c')][_0xc53e('0x3a')]){_0x3c5056['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x3c5056);})['then'](function(_0x1e2ea3){_0x28240a[_0xc53e('0x3b')]=_0x1e2ea3;return _0x28240a;})['then'](respondWithFilteredResult(_0x5c65d3,_0x3c5056))[_0xc53e('0x3c')](handleError(_0x5c65d3,null));};exports['show']=function(_0x55d07d,_0x53447e){var _0x255794={'raw':![],'where':{'id':_0x55d07d['params']['id']}},_0x4ba96f={};_0x4ba96f[_0xc53e('0x2b')]=_['keys'](db[_0xc53e('0x39')][_0xc53e('0x3d')]);_0x4ba96f['query']=_[_0xc53e('0x3e')](_0x55d07d[_0xc53e('0x2c')]);_0x4ba96f['filters']=_[_0xc53e('0x2e')](_0x4ba96f['model'],_0x4ba96f['query']);_0x255794['attributes']=_['intersection'](_0x4ba96f[_0xc53e('0x2b')],qs[_0xc53e('0x2f')](_0x55d07d[_0xc53e('0x2c')]['fields']));_0x255794[_0xc53e('0x30')]=_0x255794[_0xc53e('0x30')]['length']?_0x255794['attributes']:_0x4ba96f[_0xc53e('0x2b')];if(_0x55d07d[_0xc53e('0x2c')][_0xc53e('0x3a')]){_0x255794['include']=[{'all':!![]}];}_0x255794=_[_0xc53e('0x35')]({},_0x255794,_0x55d07d[_0xc53e('0x38')]);return db[_0xc53e('0x39')][_0xc53e('0x3f')](_0x255794)[_0xc53e('0x22')](handleEntityNotFound(_0x53447e,null))[_0xc53e('0x22')](respondWithResult(_0x53447e,null))[_0xc53e('0x3c')](handleError(_0x53447e,null));};exports['create']=function(_0xed757e,_0x39c467){return db[_0xc53e('0x39')]['create'](_0xed757e[_0xc53e('0x40')],{})[_0xc53e('0x22')](respondWithResult(_0x39c467,0xc9))[_0xc53e('0x3c')](handleError(_0x39c467,null));};exports[_0xc53e('0x21')]=function(_0xa7d256,_0x17cea5){if(_0xa7d256['body']['id']){delete _0xa7d256[_0xc53e('0x40')]['id'];}return db[_0xc53e('0x39')][_0xc53e('0x3f')]({'where':{'id':_0xa7d256['params']['id']}})[_0xc53e('0x22')](handleEntityNotFound(_0x17cea5,null))[_0xc53e('0x22')](saveUpdates(_0xa7d256[_0xc53e('0x40')],null))[_0xc53e('0x22')](respondWithResult(_0x17cea5,null))[_0xc53e('0x3c')](handleError(_0x17cea5,null));};exports[_0xc53e('0x41')]=function(_0x1a5a8f,_0x2ba2b4){return db[_0xc53e('0x39')][_0xc53e('0x3f')]({'where':{'id':_0x1a5a8f['params']['id']}})[_0xc53e('0x22')](handleEntityNotFound(_0x2ba2b4,null))[_0xc53e('0x22')](removeEntity(_0x2ba2b4,null))[_0xc53e('0x3c')](handleError(_0x2ba2b4,null));};exports[_0xc53e('0x42')]=function(_0x136544,_0x52dac7){return db['UserProfileResource'][_0xc53e('0x42')]()['then'](respondWithResult(_0x52dac7,null))[_0xc53e('0x3c')](handleError(_0x52dac7,null));}; \ No newline at end of file +var _0x814b=['../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','error','name','send','index','UserProfileResource','rawAttributes','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','keys','intersection','include','options','find','create','body','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','../../config/license/util'];(function(_0x378fd3,_0x3299ec){var _0x200d6f=function(_0x1c6b17){while(--_0x1c6b17){_0x378fd3['push'](_0x378fd3['shift']());}};_0x200d6f(++_0x3299ec);}(_0x814b,0x1a2));var _0xb814=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0x814b[_0x17823f];return _0x51fc21;};'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 licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){_0x3b267e['status'](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(!_0x457dac){_0x52b7a3[_0xb814('0x1b')](0x194);}return _0x457dac;};}function handleError(_0x208927,_0x1c8a2e){_0x1c8a2e=_0x1c8a2e||0x1f4;return function(_0xb9e57d){logger[_0xb814('0x26')](_0xb9e57d['stack']);if(_0xb9e57d[_0xb814('0x27')]){delete _0xb9e57d[_0xb814('0x27')];}_0x208927[_0xb814('0x1c')](_0x1c8a2e)[_0xb814('0x28')](_0xb9e57d);};}exports[_0xb814('0x29')]=function(_0x1d5965,_0x3f0150){var _0x1e4e89={},_0x5a6291={},_0x271aa8={'count':0x0,'rows':[]};var _0x328a08=_['map'](db[_0xb814('0x2a')][_0xb814('0x2b')],function(_0x530744){return{'name':_0x530744['fieldName'],'type':_0x530744[_0xb814('0x2c')][_0xb814('0x2d')]};});_0x5a6291['model']=_[_0xb814('0x2e')](_0x328a08,'name');_0x5a6291[_0xb814('0x2f')]=_['keys'](_0x1d5965['query']);_0x5a6291[_0xb814('0x30')]=_['intersection'](_0x5a6291[_0xb814('0x31')],_0x5a6291[_0xb814('0x2f')]);_0x1e4e89[_0xb814('0x32')]=_['intersection'](_0x5a6291['model'],qs[_0xb814('0x33')](_0x1d5965[_0xb814('0x2f')]['fields']));_0x1e4e89[_0xb814('0x32')]=_0x1e4e89[_0xb814('0x32')][_0xb814('0x34')]?_0x1e4e89[_0xb814('0x32')]:_0x5a6291[_0xb814('0x31')];if(!_0x1d5965[_0xb814('0x2f')][_0xb814('0x35')]('nolimit')){_0x1e4e89[_0xb814('0x36')]=qs[_0xb814('0x36')](_0x1d5965[_0xb814('0x2f')][_0xb814('0x36')]);_0x1e4e89[_0xb814('0x20')]=qs['offset'](_0x1d5965[_0xb814('0x2f')]['offset']);}_0x1e4e89[_0xb814('0x37')]=qs[_0xb814('0x38')](_0x1d5965[_0xb814('0x2f')]['sort']);_0x1e4e89[_0xb814('0x39')]=qs[_0xb814('0x30')](_['pick'](_0x1d5965[_0xb814('0x2f')],_0x5a6291[_0xb814('0x30')]),_0x328a08);if(_0x1d5965[_0xb814('0x2f')][_0xb814('0x3a')]){_0x1e4e89[_0xb814('0x39')]=_[_0xb814('0x3b')](_0x1e4e89['where'],{'$or':_[_0xb814('0x2e')](_0x328a08,function(_0x4e4684){if(_0x4e4684[_0xb814('0x2c')]!=='VIRTUAL'){var _0x4492ef={};_0x4492ef[_0x4e4684['name']]={'$like':'%'+_0x1d5965[_0xb814('0x2f')][_0xb814('0x3a')]+'%'};return _0x4492ef;}})});}_0x1e4e89=_['merge']({},_0x1e4e89,_0x1d5965['options']);var _0x5dd6bc={'where':_0x1e4e89['where']};return db[_0xb814('0x2a')][_0xb814('0x1f')](_0x5dd6bc)[_0xb814('0x24')](function(_0x42c2ed){_0x271aa8['count']=_0x42c2ed;if(_0x1d5965['query'][_0xb814('0x3c')]){_0x1e4e89['include']=[{'all':!![]}];}return db[_0xb814('0x2a')][_0xb814('0x3d')](_0x1e4e89);})[_0xb814('0x24')](function(_0x3063bf){_0x271aa8[_0xb814('0x3e')]=_0x3063bf;return _0x271aa8;})[_0xb814('0x24')](respondWithFilteredResult(_0x3f0150,_0x1e4e89))[_0xb814('0x3f')](handleError(_0x3f0150,null));};exports[_0xb814('0x40')]=function(_0x31989d,_0x4b6ff8){var _0x544d36={'raw':![],'where':{'id':_0x31989d[_0xb814('0x41')]['id']}},_0x5d26be={};_0x5d26be['model']=_[_0xb814('0x42')](db['UserProfileResource'][_0xb814('0x2b')]);_0x5d26be[_0xb814('0x2f')]=_[_0xb814('0x42')](_0x31989d[_0xb814('0x2f')]);_0x5d26be['filters']=_[_0xb814('0x43')](_0x5d26be[_0xb814('0x31')],_0x5d26be[_0xb814('0x2f')]);_0x544d36[_0xb814('0x32')]=_[_0xb814('0x43')](_0x5d26be[_0xb814('0x31')],qs['fields'](_0x31989d[_0xb814('0x2f')][_0xb814('0x33')]));_0x544d36[_0xb814('0x32')]=_0x544d36[_0xb814('0x32')][_0xb814('0x34')]?_0x544d36[_0xb814('0x32')]:_0x5d26be[_0xb814('0x31')];if(_0x31989d['query']['includeAll']){_0x544d36[_0xb814('0x44')]=[{'all':!![]}];}_0x544d36=_[_0xb814('0x3b')]({},_0x544d36,_0x31989d[_0xb814('0x45')]);return db[_0xb814('0x2a')][_0xb814('0x46')](_0x544d36)[_0xb814('0x24')](handleEntityNotFound(_0x4b6ff8,null))[_0xb814('0x24')](respondWithResult(_0x4b6ff8,null))[_0xb814('0x3f')](handleError(_0x4b6ff8,null));};exports[_0xb814('0x47')]=function(_0x344198,_0xe73300){return db['UserProfileResource'][_0xb814('0x47')](_0x344198[_0xb814('0x48')],{})['then'](respondWithResult(_0xe73300,0xc9))[_0xb814('0x3f')](handleError(_0xe73300,null));};exports['update']=function(_0x2fb0f7,_0x37866f){if(_0x2fb0f7[_0xb814('0x48')]['id']){delete _0x2fb0f7[_0xb814('0x48')]['id'];}return db[_0xb814('0x2a')][_0xb814('0x46')]({'where':{'id':_0x2fb0f7[_0xb814('0x41')]['id']}})[_0xb814('0x24')](handleEntityNotFound(_0x37866f,null))[_0xb814('0x24')](saveUpdates(_0x2fb0f7[_0xb814('0x48')],null))['then'](respondWithResult(_0x37866f,null))['catch'](handleError(_0x37866f,null));};exports[_0xb814('0x25')]=function(_0x30f07b,_0x4156d8){return db[_0xb814('0x2a')][_0xb814('0x46')]({'where':{'id':_0x30f07b[_0xb814('0x41')]['id']}})[_0xb814('0x24')](handleEntityNotFound(_0x4156d8,null))['then'](removeEntity(_0x4156d8,null))[_0xb814('0x3f')](handleError(_0x4156d8,null));};exports[_0xb814('0x49')]=function(_0xf27a6e,_0x5a916d){return db[_0xb814('0x2a')]['describe']()[_0xb814('0x24')](respondWithResult(_0x5a916d,null))['catch'](handleError(_0x5a916d,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 0ec0c0f..3f34249 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 _0x2a66=['request-promise','path','rimraf','./userProfileResource.attributes','exports','user_profile_has_resources','sectionId','util','bluebird'];(function(_0x23116c,_0x116877){var _0x403b6f=function(_0x348cec){while(--_0x348cec){_0x23116c['push'](_0x23116c['shift']());}};_0x403b6f(++_0x116877);}(_0x2a66,0x8e));var _0x62a6=function(_0x1ed579,_0x206ebc){_0x1ed579=_0x1ed579-0x0;var _0x793273=_0x2a66[_0x1ed579];return _0x793273;};'use strict';var _=require('lodash');var util=require(_0x62a6('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x62a6('0x1'));var rp=require(_0x62a6('0x2'));var fs=require('fs');var path=require(_0x62a6('0x3'));var rimraf=require(_0x62a6('0x4'));var config=require('../../config/environment');var attributes=require(_0x62a6('0x5'));module[_0x62a6('0x6')]=function(_0x3ee48d,_0x14e845){return _0x3ee48d['define']('UserProfileResource',attributes,{'tableName':_0x62a6('0x7'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x62a6('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xec93=['define','user_profile_has_resources','resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./userProfileResource.attributes'];(function(_0x5cc5bb,_0x52ec59){var _0x3b7cd2=function(_0x2dacd5){while(--_0x2dacd5){_0x5cc5bb['push'](_0x5cc5bb['shift']());}};_0x3b7cd2(++_0x52ec59);}(_0xec93,0x178));var _0x3ec9=function(_0x206808,_0x5b142d){_0x206808=_0x206808-0x0;var _0xac4488=_0xec93[_0x206808];return _0xac4488;};'use strict';var _=require(_0x3ec9('0x0'));var util=require('util');var logger=require(_0x3ec9('0x1'))(_0x3ec9('0x2'));var moment=require(_0x3ec9('0x3'));var BPromise=require(_0x3ec9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ec9('0x5'));var rimraf=require(_0x3ec9('0x6'));var config=require('../../config/environment');var attributes=require(_0x3ec9('0x7'));module['exports']=function(_0x2db922,_0x4fc763){return _0x2db922[_0x3ec9('0x8')]('UserProfileResource',attributes,{'tableName':_0x3ec9('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x3ec9('0xa'),_0x3ec9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index f0f9edb..51f8a62 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 _0x09ce=['stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','request\x20sent'];(function(_0xe66395,_0x458f1c){var _0x309080=function(_0x24f892){while(--_0x24f892){_0xe66395['push'](_0xe66395['shift']());}};_0x309080(++_0x458f1c);}(_0x09ce,0x1f4));var _0xe09c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x09ce[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xe09c('0x0'));var util=require('util');var moment=require(_0xe09c('0x1'));var BPromise=require('bluebird');var rs=require(_0xe09c('0x2'));var fs=require('fs');var Redis=require(_0xe09c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe09c('0x4'))(_0xe09c('0x5'));var config=require(_0xe09c('0x6'));var jayson=require(_0xe09c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fb828,_0x1da5ba,_0x19ee63){return new BPromise(function(_0x345246,_0x4e6dfa){return client[_0xe09c('0x8')](_0x2fb828,_0x19ee63)[_0xe09c('0x9')](function(_0x5b9b0d){logger[_0xe09c('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x1da5ba,'request\x20sent');logger[_0xe09c('0xb')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x1da5ba,_0xe09c('0xc'),JSON[_0xe09c('0xd')](_0x5b9b0d));if(_0x5b9b0d[_0xe09c('0xe')]){if(_0x5b9b0d[_0xe09c('0xe')][_0xe09c('0xf')]===0x1f4){logger['error'](_0xe09c('0x10'),_0x1da5ba,_0x5b9b0d[_0xe09c('0xe')][_0xe09c('0x11')]);return _0x4e6dfa(_0x5b9b0d['error']['message']);}logger[_0xe09c('0xe')](_0xe09c('0x10'),_0x1da5ba,_0x5b9b0d[_0xe09c('0xe')][_0xe09c('0x11')]);return _0x345246(_0x5b9b0d[_0xe09c('0xe')][_0xe09c('0x11')]);}else{logger['info'](_0xe09c('0x10'),_0x1da5ba,_0xe09c('0xc'));_0x345246(_0x5b9b0d['result']['message']);}})[_0xe09c('0x12')](function(_0x303a02){logger[_0xe09c('0xe')](_0xe09c('0x10'),_0x1da5ba,_0x303a02);_0x4e6dfa(_0x303a02);});});} \ No newline at end of file +var _0x5446=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment'];(function(_0x3d4ef1,_0x5a957c){var _0x409423=function(_0x1ab129){while(--_0x1ab129){_0x3d4ef1['push'](_0x3d4ef1['shift']());}};_0x409423(++_0x5a957c);}(_0x5446,0x132));var _0x6544=function(_0x3bfce7,_0xdfbb6b){_0x3bfce7=_0x3bfce7-0x0;var _0x380ba4=_0x5446[_0x3bfce7];return _0x380ba4;};'use strict';var _=require('lodash');var util=require(_0x6544('0x0'));var moment=require(_0x6544('0x1'));var BPromise=require(_0x6544('0x2'));var rs=require(_0x6544('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6544('0x4'));var logger=require(_0x6544('0x5'))(_0x6544('0x6'));var config=require(_0x6544('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6544('0x8')][_0x6544('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4351e8,_0x1ead1d,_0x4adb42){return new BPromise(function(_0x4a75a4,_0x47e05e){return client[_0x6544('0xa')](_0x4351e8,_0x4adb42)[_0x6544('0xb')](function(_0x27ff0b){logger['info'](_0x6544('0xc'),_0x1ead1d,_0x6544('0xd'));logger[_0x6544('0xe')](_0x6544('0xf'),_0x1ead1d,_0x6544('0xd'),JSON[_0x6544('0x10')](_0x27ff0b));if(_0x27ff0b['error']){if(_0x27ff0b[_0x6544('0x11')][_0x6544('0x12')]===0x1f4){logger[_0x6544('0x11')](_0x6544('0xc'),_0x1ead1d,_0x27ff0b[_0x6544('0x11')][_0x6544('0x13')]);return _0x47e05e(_0x27ff0b[_0x6544('0x11')]['message']);}logger['error'](_0x6544('0xc'),_0x1ead1d,_0x27ff0b[_0x6544('0x11')]['message']);return _0x4a75a4(_0x27ff0b[_0x6544('0x11')]['message']);}else{logger[_0x6544('0x14')](_0x6544('0xc'),_0x1ead1d,_0x6544('0xd'));_0x4a75a4(_0x27ff0b['result'][_0x6544('0x13')]);}})[_0x6544('0x15')](function(_0xb527e4){logger[_0x6544('0x11')](_0x6544('0xc'),_0x1ead1d,_0xb527e4);_0x47e05e(_0xb527e4);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 139ee27..662c20d 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 _0x27c7=['express','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','show','put','delete','destroy','multer','util','path'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x27c7,0x10d));var _0x727c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x27c7[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x727c('0x0'));var util=require(_0x727c('0x1'));var path=require(_0x727c('0x2'));var timeout=require('connect-timeout');var express=require(_0x727c('0x3'));var router=express[_0x727c('0x4')]();var auth=require(_0x727c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x727c('0x6'));var controller=require(_0x727c('0x7'));router[_0x727c('0x8')]('/',auth[_0x727c('0x9')](),controller['index']);router[_0x727c('0x8')](_0x727c('0xa'),auth[_0x727c('0x9')](),controller[_0x727c('0xb')]);router['get'](_0x727c('0xc'),auth[_0x727c('0x9')](),controller[_0x727c('0xd')]);router['post']('/',auth[_0x727c('0x9')](),controller['create']);router[_0x727c('0xe')](_0x727c('0xc'),auth[_0x727c('0x9')](),controller['update']);router[_0x727c('0xf')](_0x727c('0xc'),auth[_0x727c('0x9')](),controller[_0x727c('0x10')]);module['exports']=router; \ No newline at end of file +var _0xba92=['../../components/interaction/service','./userProfileSection.controller','index','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0xba92,0xe9));var _0x2ba9=function(_0x9406ef,_0x487114){_0x9406ef=_0x9406ef-0x0;var _0x187d54=_0xba92[_0x9406ef];return _0x187d54;};'use strict';var multer=require(_0x2ba9('0x0'));var util=require(_0x2ba9('0x1'));var path=require(_0x2ba9('0x2'));var timeout=require(_0x2ba9('0x3'));var express=require(_0x2ba9('0x4'));var router=express[_0x2ba9('0x5')]();var auth=require(_0x2ba9('0x6'));var interaction=require(_0x2ba9('0x7'));var config=require('../../config/environment');var controller=require(_0x2ba9('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2ba9('0x9')]);router[_0x2ba9('0xa')](_0x2ba9('0xb'),auth[_0x2ba9('0xc')](),controller['describe']);router[_0x2ba9('0xa')](_0x2ba9('0xd'),auth[_0x2ba9('0xc')](),controller[_0x2ba9('0xe')]);router[_0x2ba9('0xf')]('/',auth[_0x2ba9('0xc')](),controller[_0x2ba9('0x10')]);router[_0x2ba9('0x11')](_0x2ba9('0xd'),auth[_0x2ba9('0xc')](),controller[_0x2ba9('0x12')]);router[_0x2ba9('0x13')](_0x2ba9('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index b7bb750..cbfd38c 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 _0x975f=['getDataValue','sequelize','exports','INTEGER','BOOLEAN','STRING','setDataValue','crudPermissions'];(function(_0xe00bc3,_0x3fda98){var _0x244b89=function(_0x1466fe){while(--_0x1466fe){_0xe00bc3['push'](_0xe00bc3['shift']());}};_0x244b89(++_0x3fda98);}(_0x975f,0x109));var _0xf975=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0x975f[_0x35ef6b];return _0x3ad145;};'use strict';var Sequelize=require(_0xf975('0x0'));module[_0xf975('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xf975('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xf975('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xf975('0x4')],'set':function(_0x2d047c){this[_0xf975('0x5')](_0xf975('0x6'),_0x2d047c?_0x2d047c['join'](''):[]);},'get':function(){return this[_0xf975('0x7')](_0xf975('0x6'))?this[_0xf975('0x7')](_0xf975('0x6'))['split'](''):[];}}}; \ No newline at end of file +var _0x217b=['join','crudPermissions','getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x1867e3,_0x589b2d){var _0x4b22aa=function(_0x36a685){while(--_0x36a685){_0x1867e3['push'](_0x1867e3['shift']());}};_0x4b22aa(++_0x589b2d);}(_0x217b,0x199));var _0xb217=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x217b[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require('sequelize');module[_0xb217('0x0')]={'name':{'type':Sequelize[_0xb217('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb217('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xb217('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb217('0x1')],'set':function(_0x2741be){this[_0xb217('0x4')]('crudPermissions',_0x2741be?_0x2741be[_0xb217('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xb217('0x6'))?this[_0xb217('0x7')]('crudPermissions')[_0xb217('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 3ba9eff..87e430a 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 _0x7974=['html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','error','name','index','map','UserProfileSection','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','update','body','describe'];(function(_0x3f6af9,_0x553094){var _0x6cc311=function(_0x11a9a4){while(--_0x11a9a4){_0x3f6af9['push'](_0x3f6af9['shift']());}};_0x6cc311(++_0x553094);}(_0x7974,0x177));var _0x4797=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x7974[_0x409353];return _0x4f4b59;};'use strict';var pdf=require(_0x4797('0x0'));var emlformat=require(_0x4797('0x1'));var rimraf=require(_0x4797('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4797('0x3'));var rp=require(_0x4797('0x4'));var moment=require(_0x4797('0x5'));var BPromise=require(_0x4797('0x6'));var Mustache=require(_0x4797('0x7'));var util=require(_0x4797('0x8'));var path=require('path');var sox=require(_0x4797('0x9'));var csv=require(_0x4797('0xa'));var ejs=require(_0x4797('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4797('0xc'));var crypto=require(_0x4797('0xd'));var jsforce=require(_0x4797('0xe'));var deskjs=require(_0x4797('0xf'));var toCsv=require(_0x4797('0xa'));var querystring=require(_0x4797('0x10'));var Papa=require(_0x4797('0x11'));var Redis=require('ioredis');var authService=require(_0x4797('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4797('0x13'));var hardwareService=require(_0x4797('0x14'));var logger=require(_0x4797('0x15'))(_0x4797('0x16'));var utils=require(_0x4797('0x17'));var config=require(_0x4797('0x18'));var licenseUtil=require(_0x4797('0x19'));var db=require(_0x4797('0x1a'))['db'];function respondWithStatusCode(_0x525fe2,_0x8701ff){_0x8701ff=_0x8701ff||0xcc;return function(_0x114584){if(_0x114584){return _0x525fe2[_0x4797('0x1b')](_0x8701ff);}return _0x525fe2['status'](_0x8701ff)[_0x4797('0x1c')]();};}function respondWithResult(_0x290835,_0x51088d){_0x51088d=_0x51088d||0xc8;return function(_0x21d6c1){if(_0x21d6c1){return _0x290835[_0x4797('0x1d')](_0x51088d)[_0x4797('0x1e')](_0x21d6c1);}};}function respondWithFilteredResult(_0x4ebd08,_0x5ca7a4){return function(_0x26ba86){if(_0x26ba86){var _0x4009d8=_0x26ba86[_0x4797('0x1f')],_0x2a65f1=_0x5ca7a4[_0x4797('0x20')],_0x3d651c=_0x5ca7a4[_0x4797('0x20')]+_0x5ca7a4[_0x4797('0x21')],_0x3d7350;if(_0x3d651c>=_0x4009d8){_0x3d651c=_0x4009d8;_0x3d7350=0xc8;}else{_0x3d7350=0xce;}_0x4ebd08['status'](_0x3d7350);return _0x4ebd08['set'](_0x4797('0x22'),_0x2a65f1+'-'+_0x3d651c+'/'+_0x4009d8)[_0x4797('0x1e')](_0x26ba86);}return null;};}function patchUpdates(_0x484787){return function(_0x17c847){try{jsonpatch[_0x4797('0x23')](_0x17c847,_0x484787,!![]);}catch(_0x592fe3){return BPromise['reject'](_0x592fe3);}return _0x17c847[_0x4797('0x24')]();};}function saveUpdates(_0x4d1e93,_0x2483e2){return function(_0x5dc8f1){if(_0x5dc8f1){return _0x5dc8f1['update'](_0x4d1e93)[_0x4797('0x25')](function(_0x3286ce){return _0x3286ce;});}return null;};}function removeEntity(_0x5eae91,_0x55d3ce){return function(_0x275af3){if(_0x275af3){return _0x275af3[_0x4797('0x26')]()[_0x4797('0x25')](function(){_0x5eae91[_0x4797('0x1d')](0xcc)[_0x4797('0x1c')]();});}};}function handleEntityNotFound(_0x80b629,_0xab2839){return function(_0xd899e0){if(!_0xd899e0){_0x80b629['sendStatus'](0x194);}return _0xd899e0;};}function handleError(_0x2d2fb7,_0x566d46){_0x566d46=_0x566d46||0x1f4;return function(_0x1804a4){logger[_0x4797('0x27')](_0x1804a4['stack']);if(_0x1804a4[_0x4797('0x28')]){delete _0x1804a4[_0x4797('0x28')];}_0x2d2fb7[_0x4797('0x1d')](_0x566d46)['send'](_0x1804a4);};}exports[_0x4797('0x29')]=function(_0x248466,_0x42de78){var _0x5ede4b={},_0xf57dff={},_0x3a685b={'count':0x0,'rows':[]};var _0x2428b5=_[_0x4797('0x2a')](db[_0x4797('0x2b')][_0x4797('0x2c')],function(_0x4286df){return{'name':_0x4286df['fieldName'],'type':_0x4286df[_0x4797('0x2d')]['key']};});_0xf57dff[_0x4797('0x2e')]=_['map'](_0x2428b5,'name');_0xf57dff[_0x4797('0x2f')]=_[_0x4797('0x30')](_0x248466['query']);_0xf57dff[_0x4797('0x31')]=_[_0x4797('0x32')](_0xf57dff['model'],_0xf57dff[_0x4797('0x2f')]);_0x5ede4b[_0x4797('0x33')]=_[_0x4797('0x32')](_0xf57dff['model'],qs[_0x4797('0x34')](_0x248466['query'][_0x4797('0x34')]));_0x5ede4b[_0x4797('0x33')]=_0x5ede4b[_0x4797('0x33')][_0x4797('0x35')]?_0x5ede4b[_0x4797('0x33')]:_0xf57dff[_0x4797('0x2e')];if(!_0x248466[_0x4797('0x2f')][_0x4797('0x36')]('nolimit')){_0x5ede4b['limit']=qs['limit'](_0x248466[_0x4797('0x2f')]['limit']);_0x5ede4b[_0x4797('0x20')]=qs[_0x4797('0x20')](_0x248466[_0x4797('0x2f')][_0x4797('0x20')]);}_0x5ede4b[_0x4797('0x37')]=qs[_0x4797('0x38')](_0x248466[_0x4797('0x2f')]['sort']);_0x5ede4b[_0x4797('0x39')]=qs[_0x4797('0x31')](_[_0x4797('0x3a')](_0x248466[_0x4797('0x2f')],_0xf57dff[_0x4797('0x31')]),_0x2428b5);if(_0x248466['query'][_0x4797('0x3b')]){_0x5ede4b[_0x4797('0x39')]=_['merge'](_0x5ede4b[_0x4797('0x39')],{'$or':_[_0x4797('0x2a')](_0x2428b5,function(_0x28be2b){if(_0x28be2b[_0x4797('0x2d')]!==_0x4797('0x3c')){var _0x3ef000={};_0x3ef000[_0x28be2b[_0x4797('0x28')]]={'$like':'%'+_0x248466['query']['filter']+'%'};return _0x3ef000;}})});}_0x5ede4b=_['merge']({},_0x5ede4b,_0x248466[_0x4797('0x3d')]);var _0x3caf8f={'where':_0x5ede4b['where']};return db[_0x4797('0x2b')]['count'](_0x3caf8f)[_0x4797('0x25')](function(_0x296255){_0x3a685b[_0x4797('0x1f')]=_0x296255;if(_0x248466[_0x4797('0x2f')][_0x4797('0x3e')]){_0x5ede4b[_0x4797('0x3f')]=[{'all':!![]}];}return db[_0x4797('0x2b')][_0x4797('0x40')](_0x5ede4b);})[_0x4797('0x25')](function(_0x2aee13){_0x3a685b[_0x4797('0x41')]=_0x2aee13;return _0x3a685b;})['then'](respondWithFilteredResult(_0x42de78,_0x5ede4b))['catch'](handleError(_0x42de78,null));};exports[_0x4797('0x42')]=function(_0x15c9a7,_0x22fb99){var _0x229286={'raw':![],'where':{'id':_0x15c9a7[_0x4797('0x43')]['id']}},_0x163d65={};_0x163d65[_0x4797('0x2e')]=_['keys'](db[_0x4797('0x2b')][_0x4797('0x2c')]);_0x163d65[_0x4797('0x2f')]=_['keys'](_0x15c9a7['query']);_0x163d65[_0x4797('0x31')]=_['intersection'](_0x163d65[_0x4797('0x2e')],_0x163d65[_0x4797('0x2f')]);_0x229286['attributes']=_[_0x4797('0x32')](_0x163d65['model'],qs[_0x4797('0x34')](_0x15c9a7[_0x4797('0x2f')]['fields']));_0x229286[_0x4797('0x33')]=_0x229286[_0x4797('0x33')]['length']?_0x229286['attributes']:_0x163d65['model'];if(_0x15c9a7['query'][_0x4797('0x3e')]){_0x229286[_0x4797('0x3f')]=[{'all':!![]}];}_0x229286=_[_0x4797('0x44')]({},_0x229286,_0x15c9a7[_0x4797('0x3d')]);return db[_0x4797('0x2b')][_0x4797('0x45')](_0x229286)[_0x4797('0x25')](handleEntityNotFound(_0x22fb99,null))['then'](respondWithResult(_0x22fb99,null))[_0x4797('0x46')](handleError(_0x22fb99,null));};exports[_0x4797('0x47')]=function(_0x1a3f88,_0x3ad9b3){return db['UserProfileSection'][_0x4797('0x47')](_0x1a3f88['body'],{})[_0x4797('0x25')](respondWithResult(_0x3ad9b3,0xc9))['catch'](handleError(_0x3ad9b3,null));};exports[_0x4797('0x48')]=function(_0x5973cb,_0x3be0a2){if(_0x5973cb[_0x4797('0x49')]['id']){delete _0x5973cb['body']['id'];}return db[_0x4797('0x2b')][_0x4797('0x45')]({'where':{'id':_0x5973cb[_0x4797('0x43')]['id']}})['then'](handleEntityNotFound(_0x3be0a2,null))[_0x4797('0x25')](saveUpdates(_0x5973cb[_0x4797('0x49')],null))['then'](respondWithResult(_0x3be0a2,null))['catch'](handleError(_0x3be0a2,null));};exports[_0x4797('0x26')]=function(_0x40a8d4,_0x3b76cd){return db['UserProfileSection'][_0x4797('0x45')]({'where':{'id':_0x40a8d4[_0x4797('0x43')]['id']}})[_0x4797('0x25')](handleEntityNotFound(_0x3b76cd,null))[_0x4797('0x25')](removeEntity(_0x3b76cd,null))[_0x4797('0x46')](handleError(_0x3b76cd,null));};exports[_0x4797('0x4a')]=function(_0x371a75,_0x300bc1){return db[_0x4797('0x2b')][_0x4797('0x4a')]()['then'](respondWithResult(_0x300bc1,null))[_0x4797('0x46')](handleError(_0x300bc1,null));}; \ No newline at end of file +var _0xe8fc=['to-csv','ejs','lodash','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','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','UserProfileSection','rawAttributes','model','query','filters','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0xe8fc,0x16e));var _0xce8f=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0xe8fc[_0x11f249];return _0x5c3656;};'use strict';var pdf=require(_0xce8f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xce8f('0x1'));var zipdir=require(_0xce8f('0x2'));var jsonpatch=require(_0xce8f('0x3'));var rp=require('request-promise');var moment=require(_0xce8f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce8f('0x5'));var util=require(_0xce8f('0x6'));var path=require(_0xce8f('0x7'));var sox=require(_0xce8f('0x8'));var csv=require(_0xce8f('0x9'));var ejs=require(_0xce8f('0xa'));var fs=require('fs');var _=require(_0xce8f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xce8f('0xc'));var deskjs=require(_0xce8f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xce8f('0xe'));var Papa=require(_0xce8f('0xf'));var Redis=require(_0xce8f('0x10'));var authService=require(_0xce8f('0x11'));var qs=require(_0xce8f('0x12'));var as=require(_0xce8f('0x13'));var hardwareService=require(_0xce8f('0x14'));var logger=require('../../config/logger')(_0xce8f('0x15'));var utils=require(_0xce8f('0x16'));var config=require(_0xce8f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xce8f('0x18'))['db'];function respondWithStatusCode(_0x5ee92f,_0x251c3e){_0x251c3e=_0x251c3e||0xcc;return function(_0x36e9d3){if(_0x36e9d3){return _0x5ee92f[_0xce8f('0x19')](_0x251c3e);}return _0x5ee92f['status'](_0x251c3e)[_0xce8f('0x1a')]();};}function respondWithResult(_0x325b23,_0x4bc81c){_0x4bc81c=_0x4bc81c||0xc8;return function(_0x15335d){if(_0x15335d){return _0x325b23[_0xce8f('0x1b')](_0x4bc81c)[_0xce8f('0x1c')](_0x15335d);}};}function respondWithFilteredResult(_0x21d63a,_0x1d0340){return function(_0x1d74c3){if(_0x1d74c3){var _0x31ea21=_0x1d74c3[_0xce8f('0x1d')],_0xb5c05f=_0x1d0340[_0xce8f('0x1e')],_0x284022=_0x1d0340[_0xce8f('0x1e')]+_0x1d0340['limit'],_0x1e0341;if(_0x284022>=_0x31ea21){_0x284022=_0x31ea21;_0x1e0341=0xc8;}else{_0x1e0341=0xce;}_0x21d63a['status'](_0x1e0341);return _0x21d63a[_0xce8f('0x1f')](_0xce8f('0x20'),_0xb5c05f+'-'+_0x284022+'/'+_0x31ea21)[_0xce8f('0x1c')](_0x1d74c3);}return null;};}function patchUpdates(_0x1b59f2){return function(_0x148531){try{jsonpatch[_0xce8f('0x21')](_0x148531,_0x1b59f2,!![]);}catch(_0x109cc1){return BPromise[_0xce8f('0x22')](_0x109cc1);}return _0x148531[_0xce8f('0x23')]();};}function saveUpdates(_0x5d791f,_0xe7b498){return function(_0x3154fa){if(_0x3154fa){return _0x3154fa[_0xce8f('0x24')](_0x5d791f)[_0xce8f('0x25')](function(_0x114f3a){return _0x114f3a;});}return null;};}function removeEntity(_0x1541bd,_0x568724){return function(_0x4ebc31){if(_0x4ebc31){return _0x4ebc31[_0xce8f('0x26')]()[_0xce8f('0x25')](function(){_0x1541bd[_0xce8f('0x1b')](0xcc)[_0xce8f('0x1a')]();});}};}function handleEntityNotFound(_0x53d888,_0x5e61e8){return function(_0x7baad7){if(!_0x7baad7){_0x53d888['sendStatus'](0x194);}return _0x7baad7;};}function handleError(_0x1dd289,_0x397326){_0x397326=_0x397326||0x1f4;return function(_0x1f07a3){logger[_0xce8f('0x27')](_0x1f07a3[_0xce8f('0x28')]);if(_0x1f07a3[_0xce8f('0x29')]){delete _0x1f07a3[_0xce8f('0x29')];}_0x1dd289['status'](_0x397326)['send'](_0x1f07a3);};}exports[_0xce8f('0x2a')]=function(_0x33c659,_0x5d3d6b){var _0x2a4862={},_0x47a6c6={},_0x4f8837={'count':0x0,'rows':[]};var _0x1643aa=_[_0xce8f('0x2b')](db[_0xce8f('0x2c')][_0xce8f('0x2d')],function(_0x30f359){return{'name':_0x30f359['fieldName'],'type':_0x30f359['type']['key']};});_0x47a6c6[_0xce8f('0x2e')]=_[_0xce8f('0x2b')](_0x1643aa,_0xce8f('0x29'));_0x47a6c6['query']=_['keys'](_0x33c659[_0xce8f('0x2f')]);_0x47a6c6[_0xce8f('0x30')]=_['intersection'](_0x47a6c6[_0xce8f('0x2e')],_0x47a6c6[_0xce8f('0x2f')]);_0x2a4862[_0xce8f('0x31')]=_[_0xce8f('0x32')](_0x47a6c6[_0xce8f('0x2e')],qs['fields'](_0x33c659[_0xce8f('0x2f')][_0xce8f('0x33')]));_0x2a4862['attributes']=_0x2a4862[_0xce8f('0x31')][_0xce8f('0x34')]?_0x2a4862[_0xce8f('0x31')]:_0x47a6c6[_0xce8f('0x2e')];if(!_0x33c659[_0xce8f('0x2f')]['hasOwnProperty'](_0xce8f('0x35'))){_0x2a4862['limit']=qs[_0xce8f('0x36')](_0x33c659[_0xce8f('0x2f')][_0xce8f('0x36')]);_0x2a4862[_0xce8f('0x1e')]=qs[_0xce8f('0x1e')](_0x33c659[_0xce8f('0x2f')]['offset']);}_0x2a4862['order']=qs[_0xce8f('0x37')](_0x33c659[_0xce8f('0x2f')][_0xce8f('0x37')]);_0x2a4862[_0xce8f('0x38')]=qs[_0xce8f('0x30')](_[_0xce8f('0x39')](_0x33c659[_0xce8f('0x2f')],_0x47a6c6[_0xce8f('0x30')]),_0x1643aa);if(_0x33c659['query'][_0xce8f('0x3a')]){_0x2a4862['where']=_[_0xce8f('0x3b')](_0x2a4862[_0xce8f('0x38')],{'$or':_[_0xce8f('0x2b')](_0x1643aa,function(_0x4626e1){if(_0x4626e1[_0xce8f('0x3c')]!==_0xce8f('0x3d')){var _0x2b9f80={};_0x2b9f80[_0x4626e1[_0xce8f('0x29')]]={'$like':'%'+_0x33c659['query']['filter']+'%'};return _0x2b9f80;}})});}_0x2a4862=_[_0xce8f('0x3b')]({},_0x2a4862,_0x33c659[_0xce8f('0x3e')]);var _0x9a572b={'where':_0x2a4862['where']};return db[_0xce8f('0x2c')][_0xce8f('0x1d')](_0x9a572b)[_0xce8f('0x25')](function(_0x720a45){_0x4f8837[_0xce8f('0x1d')]=_0x720a45;if(_0x33c659[_0xce8f('0x2f')][_0xce8f('0x3f')]){_0x2a4862[_0xce8f('0x40')]=[{'all':!![]}];}return db['UserProfileSection'][_0xce8f('0x41')](_0x2a4862);})[_0xce8f('0x25')](function(_0x286e91){_0x4f8837[_0xce8f('0x42')]=_0x286e91;return _0x4f8837;})[_0xce8f('0x25')](respondWithFilteredResult(_0x5d3d6b,_0x2a4862))[_0xce8f('0x43')](handleError(_0x5d3d6b,null));};exports[_0xce8f('0x44')]=function(_0x5e389d,_0xeb3da9){var _0x441525={'raw':![],'where':{'id':_0x5e389d[_0xce8f('0x45')]['id']}},_0x538834={};_0x538834[_0xce8f('0x2e')]=_['keys'](db[_0xce8f('0x2c')][_0xce8f('0x2d')]);_0x538834[_0xce8f('0x2f')]=_[_0xce8f('0x46')](_0x5e389d[_0xce8f('0x2f')]);_0x538834['filters']=_[_0xce8f('0x32')](_0x538834[_0xce8f('0x2e')],_0x538834[_0xce8f('0x2f')]);_0x441525[_0xce8f('0x31')]=_[_0xce8f('0x32')](_0x538834[_0xce8f('0x2e')],qs[_0xce8f('0x33')](_0x5e389d[_0xce8f('0x2f')][_0xce8f('0x33')]));_0x441525[_0xce8f('0x31')]=_0x441525[_0xce8f('0x31')]['length']?_0x441525[_0xce8f('0x31')]:_0x538834['model'];if(_0x5e389d['query'][_0xce8f('0x3f')]){_0x441525[_0xce8f('0x40')]=[{'all':!![]}];}_0x441525=_[_0xce8f('0x3b')]({},_0x441525,_0x5e389d[_0xce8f('0x3e')]);return db[_0xce8f('0x2c')][_0xce8f('0x47')](_0x441525)[_0xce8f('0x25')](handleEntityNotFound(_0xeb3da9,null))[_0xce8f('0x25')](respondWithResult(_0xeb3da9,null))[_0xce8f('0x43')](handleError(_0xeb3da9,null));};exports[_0xce8f('0x48')]=function(_0x2d2840,_0x5afd4e){return db[_0xce8f('0x2c')][_0xce8f('0x48')](_0x2d2840[_0xce8f('0x49')],{})[_0xce8f('0x25')](respondWithResult(_0x5afd4e,0xc9))['catch'](handleError(_0x5afd4e,null));};exports[_0xce8f('0x24')]=function(_0x20f725,_0x5bd063){if(_0x20f725[_0xce8f('0x49')]['id']){delete _0x20f725[_0xce8f('0x49')]['id'];}return db[_0xce8f('0x2c')][_0xce8f('0x47')]({'where':{'id':_0x20f725[_0xce8f('0x45')]['id']}})[_0xce8f('0x25')](handleEntityNotFound(_0x5bd063,null))[_0xce8f('0x25')](saveUpdates(_0x20f725[_0xce8f('0x49')],null))[_0xce8f('0x25')](respondWithResult(_0x5bd063,null))['catch'](handleError(_0x5bd063,null));};exports[_0xce8f('0x26')]=function(_0x32a6e7,_0x3c5a16){return db[_0xce8f('0x2c')][_0xce8f('0x47')]({'where':{'id':_0x32a6e7['params']['id']}})[_0xce8f('0x25')](handleEntityNotFound(_0x3c5a16,null))[_0xce8f('0x25')](removeEntity(_0x3c5a16,null))['catch'](handleError(_0x3c5a16,null));};exports[_0xce8f('0x4a')]=function(_0x7b487a,_0x58dea0){return db[_0xce8f('0x2c')][_0xce8f('0x4a')]()[_0xce8f('0x25')](respondWithResult(_0x58dea0,null))[_0xce8f('0x43')](handleError(_0x58dea0,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 4c7ddb5..2256db0 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 _0x6831=['define','sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./userProfileSection.attributes','exports'];(function(_0x8534c5,_0x27feda){var _0x57d3af=function(_0x1774d5){while(--_0x1774d5){_0x8534c5['push'](_0x8534c5['shift']());}};_0x57d3af(++_0x27feda);}(_0x6831,0xff));var _0x1683=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6831[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1683('0x0'));var util=require(_0x1683('0x1'));var logger=require(_0x1683('0x2'))(_0x1683('0x3'));var moment=require('moment');var BPromise=require(_0x1683('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1683('0x5'));var config=require(_0x1683('0x6'));var attributes=require(_0x1683('0x7'));module[_0x1683('0x8')]=function(_0x5bec39,_0x29b5ae){return _0x5bec39[_0x1683('0x9')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x1683('0xa'),_0x1683('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f6f=['user_profile_has_sections','userProfileId','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./userProfileSection.attributes','define'];(function(_0x27763f,_0xc292f6){var _0x5da79a=function(_0xd40c88){while(--_0xd40c88){_0x27763f['push'](_0x27763f['shift']());}};_0x5da79a(++_0xc292f6);}(_0x4f6f,0x157));var _0xf4f6=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x4f6f[_0x3b150c];return _0x5cd414;};'use strict';var _=require(_0xf4f6('0x0'));var util=require(_0xf4f6('0x1'));var logger=require(_0xf4f6('0x2'))('api');var moment=require(_0xf4f6('0x3'));var BPromise=require('bluebird');var rp=require(_0xf4f6('0x4'));var fs=require('fs');var path=require(_0xf4f6('0x5'));var rimraf=require('rimraf');var config=require(_0xf4f6('0x6'));var attributes=require(_0xf4f6('0x7'));module['exports']=function(_0x31ecb6,_0x1172a6){return _0x31ecb6[_0xf4f6('0x8')]('UserProfileSection',attributes,{'tableName':_0xf4f6('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0xf4f6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 1674104..6932064 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 _0x0ae1=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2c3bd9,_0x45f815){var _0x112e55=function(_0x22de25){while(--_0x22de25){_0x2c3bd9['push'](_0x2c3bd9['shift']());}};_0x112e55(++_0x45f815);}(_0x0ae1,0xac));var _0x10ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ae1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x10ae('0x0'));var util=require(_0x10ae('0x1'));var moment=require(_0x10ae('0x2'));var BPromise=require(_0x10ae('0x3'));var rs=require(_0x10ae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10ae('0x5'))['db'];var utils=require(_0x10ae('0x6'));var logger=require(_0x10ae('0x7'))('rpc');var config=require(_0x10ae('0x8'));var jayson=require(_0x10ae('0x9'));var client=jayson[_0x10ae('0xa')][_0x10ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe5a0c3,_0x117f72,_0x3b4f0d){return new BPromise(function(_0x21affb,_0xc336b6){return client[_0x10ae('0xc')](_0xe5a0c3,_0x3b4f0d)[_0x10ae('0xd')](function(_0x15c0b2){logger[_0x10ae('0xe')](_0x10ae('0xf'),_0x117f72,_0x10ae('0x10'));logger[_0x10ae('0x11')](_0x10ae('0x12'),_0x117f72,_0x10ae('0x10'),JSON[_0x10ae('0x13')](_0x15c0b2));if(_0x15c0b2['error']){if(_0x15c0b2[_0x10ae('0x14')][_0x10ae('0x15')]===0x1f4){logger[_0x10ae('0x14')](_0x10ae('0xf'),_0x117f72,_0x15c0b2[_0x10ae('0x14')][_0x10ae('0x16')]);return _0xc336b6(_0x15c0b2[_0x10ae('0x14')][_0x10ae('0x16')]);}logger[_0x10ae('0x14')](_0x10ae('0xf'),_0x117f72,_0x15c0b2[_0x10ae('0x14')][_0x10ae('0x16')]);return _0x21affb(_0x15c0b2[_0x10ae('0x14')][_0x10ae('0x16')]);}else{logger['info'](_0x10ae('0xf'),_0x117f72,_0x10ae('0x10'));_0x21affb(_0x15c0b2[_0x10ae('0x17')][_0x10ae('0x16')]);}})[_0x10ae('0x18')](function(_0x3ff545){logger[_0x10ae('0x14')](_0x10ae('0xf'),_0x117f72,_0x3ff545);_0xc336b6(_0x3ff545);});});} \ No newline at end of file +var _0xb111=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb111,0x189));var _0x1b11=function(_0x242027,_0x13f270){_0x242027=_0x242027-0x0;var _0xc00b6f=_0xb111[_0x242027];return _0xc00b6f;};'use strict';var _=require(_0x1b11('0x0'));var util=require(_0x1b11('0x1'));var moment=require('moment');var BPromise=require(_0x1b11('0x2'));var rs=require(_0x1b11('0x3'));var fs=require('fs');var Redis=require(_0x1b11('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b11('0x5'));var logger=require(_0x1b11('0x6'))('rpc');var config=require(_0x1b11('0x7'));var jayson=require(_0x1b11('0x8'));var client=jayson[_0x1b11('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18c2dd,_0x1376b1,_0x458870){return new BPromise(function(_0x3dd455,_0x4790ce){return client[_0x1b11('0xa')](_0x18c2dd,_0x458870)[_0x1b11('0xb')](function(_0x19afca){logger[_0x1b11('0xc')](_0x1b11('0xd'),_0x1376b1,_0x1b11('0xe'));logger[_0x1b11('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x1376b1,_0x1b11('0xe'),JSON[_0x1b11('0x10')](_0x19afca));if(_0x19afca['error']){if(_0x19afca[_0x1b11('0x11')][_0x1b11('0x12')]===0x1f4){logger[_0x1b11('0x11')](_0x1b11('0xd'),_0x1376b1,_0x19afca[_0x1b11('0x11')][_0x1b11('0x13')]);return _0x4790ce(_0x19afca[_0x1b11('0x11')][_0x1b11('0x13')]);}logger[_0x1b11('0x11')](_0x1b11('0xd'),_0x1376b1,_0x19afca[_0x1b11('0x11')][_0x1b11('0x13')]);return _0x3dd455(_0x19afca['error'][_0x1b11('0x13')]);}else{logger[_0x1b11('0xc')](_0x1b11('0xd'),_0x1376b1,_0x1b11('0xe'));_0x3dd455(_0x19afca[_0x1b11('0x14')][_0x1b11('0x13')]);}})[_0x1b11('0x15')](function(_0x516798){logger['error'](_0x1b11('0xd'),_0x1376b1,_0x516798);_0x4790ce(_0x516798);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 95f167d..f3e9649 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 _0xbb49=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x404eed,_0x5390c5){var _0xd45887=function(_0x1ee42b){while(--_0x1ee42b){_0x404eed['push'](_0x404eed['shift']());}};_0xd45887(++_0x5390c5);}(_0xbb49,0xbd));var _0x9bb4=function(_0x2082a8,_0x451225){_0x2082a8=_0x2082a8-0x0;var _0x53100b=_0xbb49[_0x2082a8];return _0x53100b;};'use strict';var multer=require(_0x9bb4('0x0'));var util=require('util');var path=require(_0x9bb4('0x1'));var timeout=require(_0x9bb4('0x2'));var express=require(_0x9bb4('0x3'));var router=express[_0x9bb4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9bb4('0x5'));var config=require(_0x9bb4('0x6'));module['exports']=router; \ No newline at end of file +var _0x57f7=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x371366,_0x56f675){var _0xe895b6=function(_0x2200c4){while(--_0x2200c4){_0x371366['push'](_0x371366['shift']());}};_0xe895b6(++_0x56f675);}(_0x57f7,0x1b0));var _0x757f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x57f7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x757f('0x0'));var util=require('util');var path=require(_0x757f('0x1'));var timeout=require(_0x757f('0x2'));var express=require(_0x757f('0x3'));var router=express[_0x757f('0x4')]();var auth=require(_0x757f('0x5'));var interaction=require(_0x757f('0x6'));var config=require(_0x757f('0x7'));module[_0x757f('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index f072c68..c9f1aa6 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x3f9ac2,_0x1b670b){var _0xe6a436=function(_0x1f3ea5){while(--_0x1f3ea5){_0x3f9ac2['push'](_0x3f9ac2['shift']());}};_0xe6a436(++_0x1b670b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'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 7b81fb4..6dade61 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 _0x423a=['./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x29312c,_0x319d81){var _0x4a2f3f=function(_0x5a5dd2){while(--_0x5a5dd2){_0x29312c['push'](_0x29312c['shift']());}};_0x4a2f3f(++_0x319d81);}(_0x423a,0xf3));var _0xa423=function(_0x1f88f6,_0x10cc67){_0x1f88f6=_0x1f88f6-0x0;var _0x181881=_0x423a[_0x1f88f6];return _0x181881;};'use strict';var _=require(_0xa423('0x0'));var util=require(_0xa423('0x1'));var logger=require(_0xa423('0x2'))(_0xa423('0x3'));var moment=require(_0xa423('0x4'));var BPromise=require(_0xa423('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa423('0x6'));var rimraf=require(_0xa423('0x7'));var config=require(_0xa423('0x8'));var attributes=require(_0xa423('0x9'));module[_0xa423('0xa')]=function(_0xff5f29,_0x3f006f){return _0xff5f29[_0xa423('0xb')](_0xa423('0xc'),attributes,{'tableName':_0xa423('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0639=['exports','define','UserSmsQueue','user_has_sms_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xe58ae2,_0x30a065){var _0x369b69=function(_0xa6a029){while(--_0xa6a029){_0xe58ae2['push'](_0xe58ae2['shift']());}};_0x369b69(++_0x30a065);}(_0x0639,0x184));var _0x9063=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x0639[_0x22b8a3];return _0x199a0c;};'use strict';var _=require(_0x9063('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9063('0x1'));var moment=require(_0x9063('0x2'));var BPromise=require(_0x9063('0x3'));var rp=require(_0x9063('0x4'));var fs=require('fs');var path=require(_0x9063('0x5'));var rimraf=require(_0x9063('0x6'));var config=require(_0x9063('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0x9063('0x8')]=function(_0x24a610,_0x3a7a7f){return _0x24a610[_0x9063('0x9')](_0x9063('0xa'),attributes,{'tableName':_0x9063('0xb'),'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 7dbd93d..ba595c1 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 _0x3f3a=['debug','error','UserSmsQueue,\x20%s,\x20%s','message','request\x20sent','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x59fa77,_0x50af9e){var _0x543498=function(_0x2a50b2){while(--_0x2a50b2){_0x59fa77['push'](_0x59fa77['shift']());}};_0x543498(++_0x50af9e);}(_0x3f3a,0xf5));var _0xa3f3=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x3f3a[_0x42bc91];return _0x3f5507;};'use strict';var _=require('lodash');var util=require(_0xa3f3('0x0'));var moment=require(_0xa3f3('0x1'));var BPromise=require(_0xa3f3('0x2'));var rs=require(_0xa3f3('0x3'));var fs=require('fs');var Redis=require(_0xa3f3('0x4'));var db=require(_0xa3f3('0x5'))['db'];var utils=require(_0xa3f3('0x6'));var logger=require(_0xa3f3('0x7'))(_0xa3f3('0x8'));var config=require(_0xa3f3('0x9'));var jayson=require(_0xa3f3('0xa'));var client=jayson[_0xa3f3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x65332e,_0x3b3fe0,_0x2bebcc){return new BPromise(function(_0x23d3b3,_0xcb8212){return client[_0xa3f3('0xc')](_0x65332e,_0x2bebcc)[_0xa3f3('0xd')](function(_0xdeb47b){logger[_0xa3f3('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x3b3fe0,'request\x20sent');logger[_0xa3f3('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x3b3fe0,'request\x20sent',JSON['stringify'](_0xdeb47b));if(_0xdeb47b[_0xa3f3('0x10')]){if(_0xdeb47b[_0xa3f3('0x10')]['code']===0x1f4){logger['error'](_0xa3f3('0x11'),_0x3b3fe0,_0xdeb47b['error'][_0xa3f3('0x12')]);return _0xcb8212(_0xdeb47b[_0xa3f3('0x10')]['message']);}logger[_0xa3f3('0x10')](_0xa3f3('0x11'),_0x3b3fe0,_0xdeb47b[_0xa3f3('0x10')]['message']);return _0x23d3b3(_0xdeb47b[_0xa3f3('0x10')][_0xa3f3('0x12')]);}else{logger['info'](_0xa3f3('0x11'),_0x3b3fe0,_0xa3f3('0x13'));_0x23d3b3(_0xdeb47b['result']['message']);}})['catch'](function(_0x3628aa){logger[_0xa3f3('0x10')](_0xa3f3('0x11'),_0x3b3fe0,_0x3628aa);_0xcb8212(_0x3628aa);});});} \ No newline at end of file +var _0xcad8=['client','http','request','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x140202,_0x4245c7){var _0x3037c2=function(_0x525d19){while(--_0x525d19){_0x140202['push'](_0x140202['shift']());}};_0x3037c2(++_0x4245c7);}(_0xcad8,0x108));var _0x8cad=function(_0x4d843f,_0x4a4401){_0x4d843f=_0x4d843f-0x0;var _0x58a99e=_0xcad8[_0x4d843f];return _0x58a99e;};'use strict';var _=require(_0x8cad('0x0'));var util=require(_0x8cad('0x1'));var moment=require('moment');var BPromise=require(_0x8cad('0x2'));var rs=require(_0x8cad('0x3'));var fs=require('fs');var Redis=require(_0x8cad('0x4'));var db=require(_0x8cad('0x5'))['db'];var utils=require(_0x8cad('0x6'));var logger=require(_0x8cad('0x7'))(_0x8cad('0x8'));var config=require(_0x8cad('0x9'));var jayson=require(_0x8cad('0xa'));var client=jayson[_0x8cad('0xb')][_0x8cad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21b88e,_0x597dfe,_0x3b0e51){return new BPromise(function(_0xfbd49d,_0x4aff9a){return client[_0x8cad('0xd')](_0x21b88e,_0x3b0e51)['then'](function(_0x2fa70f){logger[_0x8cad('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x597dfe,'request\x20sent');logger[_0x8cad('0xf')](_0x8cad('0x10'),_0x597dfe,'request\x20sent',JSON[_0x8cad('0x11')](_0x2fa70f));if(_0x2fa70f[_0x8cad('0x12')]){if(_0x2fa70f[_0x8cad('0x12')][_0x8cad('0x13')]===0x1f4){logger[_0x8cad('0x12')](_0x8cad('0x14'),_0x597dfe,_0x2fa70f[_0x8cad('0x12')][_0x8cad('0x15')]);return _0x4aff9a(_0x2fa70f[_0x8cad('0x12')][_0x8cad('0x15')]);}logger[_0x8cad('0x12')](_0x8cad('0x14'),_0x597dfe,_0x2fa70f[_0x8cad('0x12')][_0x8cad('0x15')]);return _0xfbd49d(_0x2fa70f[_0x8cad('0x12')]['message']);}else{logger[_0x8cad('0xe')](_0x8cad('0x14'),_0x597dfe,_0x8cad('0x16'));_0xfbd49d(_0x2fa70f[_0x8cad('0x17')]['message']);}})[_0x8cad('0x18')](function(_0x2e3bb8){logger[_0x8cad('0x12')](_0x8cad('0x14'),_0x597dfe,_0x2e3bb8);_0x4aff9a(_0x2e3bb8);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index dd706b7..540f21d 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 _0x7cf3=['../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4f72ff,_0x5a607c){var _0x34a2cf=function(_0x27a6d8){while(--_0x27a6d8){_0x4f72ff['push'](_0x4f72ff['shift']());}};_0x34a2cf(++_0x5a607c);}(_0x7cf3,0xd2));var _0x37cf=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x7cf3[_0x5f0089];return _0x193892;};'use strict';var multer=require('multer');var util=require(_0x37cf('0x0'));var path=require(_0x37cf('0x1'));var timeout=require(_0x37cf('0x2'));var express=require(_0x37cf('0x3'));var router=express[_0x37cf('0x4')]();var auth=require(_0x37cf('0x5'));var interaction=require(_0x37cf('0x6'));var config=require(_0x37cf('0x7'));module[_0x37cf('0x8')]=router; \ No newline at end of file +var _0x9b8a=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xdbcda0,_0x4ac4e4){var _0x3bdc2b=function(_0x3281c3){while(--_0x3281c3){_0xdbcda0['push'](_0xdbcda0['shift']());}};_0x3bdc2b(++_0x4ac4e4);}(_0x9b8a,0xc4));var _0xa9b8=function(_0x529a0f,_0x328763){_0x529a0f=_0x529a0f-0x0;var _0x187a88=_0x9b8a[_0x529a0f];return _0x187a88;};'use strict';var multer=require('multer');var util=require(_0xa9b8('0x0'));var path=require(_0xa9b8('0x1'));var timeout=require(_0xa9b8('0x2'));var express=require(_0xa9b8('0x3'));var router=express[_0xa9b8('0x4')]();var auth=require(_0xa9b8('0x5'));var interaction=require(_0xa9b8('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 454764c..63fcda3 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 _0xd8b0=['exports','sequelize'];(function(_0x1d61de,_0x2a303d){var _0x446d8f=function(_0xee1c0d){while(--_0xee1c0d){_0x1d61de['push'](_0x1d61de['shift']());}};_0x446d8f(++_0x2a303d);}(_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(_0x5098d3,_0x245091){var _0x285389=function(_0x2a32c9){while(--_0x2a32c9){_0x5098d3['push'](_0x5098d3['shift']());}};_0x285389(++_0x245091);}(_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 diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 4893ddb..91b61c2 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 _0x4fdb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues'];(function(_0x36d296,_0xf631c0){var _0x5a9295=function(_0x1882af){while(--_0x1882af){_0x36d296['push'](_0x36d296['shift']());}};_0x5a9295(++_0xf631c0);}(_0x4fdb,0x9c));var _0xb4fd=function(_0xd9fad9,_0x5b7479){_0xd9fad9=_0xd9fad9-0x0;var _0x4dba3d=_0x4fdb[_0xd9fad9];return _0x4dba3d;};'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':!![]});}; \ No newline at end of file +var _0x0b78=['util','api','moment','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b78,0x1ad));var _0x80b7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0b78[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var logger=require('../../config/logger')(_0x80b7('0x2'));var moment=require(_0x80b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x80b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var attributes=require(_0x80b7('0x7'));module['exports']=function(_0x49bc7f,_0x167ddd){return _0x49bc7f['define'](_0x80b7('0x8'),attributes,{'tableName':_0x80b7('0x9'),'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 dcf10fc..2c28738 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 _0x8b42=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1c67ab,_0x6d320e){var _0x3b176c=function(_0x46f501){while(--_0x46f501){_0x1c67ab['push'](_0x1c67ab['shift']());}};_0x3b176c(++_0x6d320e);}(_0x8b42,0x13f));var _0x28b4=function(_0xbc1199,_0x5c23a3){_0xbc1199=_0xbc1199-0x0;var _0x4da96f=_0x8b42[_0xbc1199];return _0x4da96f;};'use strict';var _=require(_0x28b4('0x0'));var util=require('util');var moment=require(_0x28b4('0x1'));var BPromise=require(_0x28b4('0x2'));var rs=require(_0x28b4('0x3'));var fs=require('fs');var Redis=require(_0x28b4('0x4'));var db=require(_0x28b4('0x5'))['db'];var utils=require(_0x28b4('0x6'));var logger=require('../../config/logger')(_0x28b4('0x7'));var config=require(_0x28b4('0x8'));var jayson=require(_0x28b4('0x9'));var client=jayson['client'][_0x28b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x245b44,_0x4051f0,_0x3c0bf0){return new BPromise(function(_0x371010,_0x390a9c){return client[_0x28b4('0xb')](_0x245b44,_0x3c0bf0)[_0x28b4('0xc')](function(_0x12d130){logger[_0x28b4('0xd')](_0x28b4('0xe'),_0x4051f0,_0x28b4('0xf'));logger[_0x28b4('0x10')](_0x28b4('0x11'),_0x4051f0,_0x28b4('0xf'),JSON[_0x28b4('0x12')](_0x12d130));if(_0x12d130['error']){if(_0x12d130[_0x28b4('0x13')][_0x28b4('0x14')]===0x1f4){logger[_0x28b4('0x13')](_0x28b4('0xe'),_0x4051f0,_0x12d130[_0x28b4('0x13')]['message']);return _0x390a9c(_0x12d130[_0x28b4('0x13')]['message']);}logger[_0x28b4('0x13')](_0x28b4('0xe'),_0x4051f0,_0x12d130[_0x28b4('0x13')][_0x28b4('0x15')]);return _0x371010(_0x12d130[_0x28b4('0x13')]['message']);}else{logger[_0x28b4('0xd')](_0x28b4('0xe'),_0x4051f0,_0x28b4('0xf'));_0x371010(_0x12d130[_0x28b4('0x16')][_0x28b4('0x15')]);}})[_0x28b4('0x17')](function(_0x230181){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4051f0,_0x230181);_0x390a9c(_0x230181);});});} \ No newline at end of file +var _0xf01c=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1f590f,_0x10ed81){var _0x9b4f0c=function(_0x2e1967){while(--_0x2e1967){_0x1f590f['push'](_0x1f590f['shift']());}};_0x9b4f0c(++_0x10ed81);}(_0xf01c,0x165));var _0xcf01=function(_0x1cf714,_0x139a56){_0x1cf714=_0x1cf714-0x0;var _0x2d5fed=_0xf01c[_0x1cf714];return _0x2d5fed;};'use strict';var _=require(_0xcf01('0x0'));var util=require(_0xcf01('0x1'));var moment=require(_0xcf01('0x2'));var BPromise=require(_0xcf01('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf01('0x4'));var db=require(_0xcf01('0x5'))['db'];var utils=require(_0xcf01('0x6'));var logger=require('../../config/logger')(_0xcf01('0x7'));var config=require(_0xcf01('0x8'));var jayson=require(_0xcf01('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x309f6b,_0x347986,_0x468fe9){return new BPromise(function(_0x560eda,_0x1f1257){return client['request'](_0x309f6b,_0x468fe9)['then'](function(_0xbe78fb){logger[_0xcf01('0xa')](_0xcf01('0xb'),_0x347986,'request\x20sent');logger[_0xcf01('0xc')](_0xcf01('0xd'),_0x347986,_0xcf01('0xe'),JSON[_0xcf01('0xf')](_0xbe78fb));if(_0xbe78fb[_0xcf01('0x10')]){if(_0xbe78fb[_0xcf01('0x10')][_0xcf01('0x11')]===0x1f4){logger[_0xcf01('0x10')](_0xcf01('0xb'),_0x347986,_0xbe78fb['error'][_0xcf01('0x12')]);return _0x1f1257(_0xbe78fb[_0xcf01('0x10')][_0xcf01('0x12')]);}logger[_0xcf01('0x10')](_0xcf01('0xb'),_0x347986,_0xbe78fb[_0xcf01('0x10')][_0xcf01('0x12')]);return _0x560eda(_0xbe78fb[_0xcf01('0x10')][_0xcf01('0x12')]);}else{logger[_0xcf01('0xa')](_0xcf01('0xb'),_0x347986,'request\x20sent');_0x560eda(_0xbe78fb[_0xcf01('0x13')]['message']);}})[_0xcf01('0x14')](function(_0x209c31){logger[_0xcf01('0x10')](_0xcf01('0xb'),_0x347986,_0x209c31);_0x1f1257(_0x209c31);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 3e832bd..9830691 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 _0xeb09=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x31bbf7,_0x292c9a){var _0x1469f3=function(_0x58ca15){while(--_0x58ca15){_0x31bbf7['push'](_0x31bbf7['shift']());}};_0x1469f3(++_0x292c9a);}(_0xeb09,0x1cf));var _0x9eb0=function(_0x1954ee,_0x4b55f5){_0x1954ee=_0x1954ee-0x0;var _0x54cb5a=_0xeb09[_0x1954ee];return _0x54cb5a;};'use strict';var multer=require(_0x9eb0('0x0'));var util=require(_0x9eb0('0x1'));var path=require('path');var timeout=require(_0x9eb0('0x2'));var express=require(_0x9eb0('0x3'));var router=express[_0x9eb0('0x4')]();var auth=require(_0x9eb0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9eb0('0x6'));module[_0x9eb0('0x7')]=router; \ No newline at end of file +var _0x6f3b=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','Router'];(function(_0xe3468d,_0x41d361){var _0x2ff28a=function(_0x1f58b0){while(--_0x1f58b0){_0xe3468d['push'](_0xe3468d['shift']());}};_0x2ff28a(++_0x41d361);}(_0x6f3b,0x9c));var _0xb6f3=function(_0x59db37,_0x14464c){_0x59db37=_0x59db37-0x0;var _0x3a4d97=_0x6f3b[_0x59db37];return _0x3a4d97;};'use strict';var multer=require('multer');var util=require(_0xb6f3('0x0'));var path=require(_0xb6f3('0x1'));var timeout=require(_0xb6f3('0x2'));var express=require('express');var router=express[_0xb6f3('0x3')]();var auth=require(_0xb6f3('0x4'));var interaction=require(_0xb6f3('0x5'));var config=require(_0xb6f3('0x6'));module[_0xb6f3('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 660d7ab..ff1a60b 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 _0x45e2=['STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports','INTEGER'];(function(_0x5e2be7,_0x54d69c){var _0x18997a=function(_0x3ba363){while(--_0x3ba363){_0x5e2be7['push'](_0x5e2be7['shift']());}};_0x18997a(++_0x54d69c);}(_0x45e2,0xb1));var _0x245e=function(_0x589d91,_0x569e7c){_0x589d91=_0x589d91-0x0;var _0x76210e=_0x45e2[_0x589d91];return _0x76210e;};'use strict';var Sequelize=require(_0x245e('0x0'));module[_0x245e('0x1')]={'uniqueid':{'type':Sequelize[_0x245e('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x245e('0x3')],'allowNull':![],'comment':_0x245e('0x4')},'UserId':{'type':Sequelize[_0x245e('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x245e('0x3')],'allowNull':![],'unique':_0x245e('0x5'),'comment':_0x245e('0x4')},'VoiceQueueId':{'type':Sequelize[_0x245e('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x245e('0x3')],'allowNull':![],'unique':_0x245e('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x245e('0x2')](0xb),'defaultValue':0x0,'comment':_0x245e('0x4')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x245e('0x4')}}; \ No newline at end of file +var _0xe95e=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0xab7c07,_0x1cf6ae){var _0x3fbb13=function(_0x3c20b7){while(--_0x3c20b7){_0xab7c07['push'](_0xab7c07['shift']());}};_0x3fbb13(++_0x1cf6ae);}(_0xe95e,0x156));var _0xee95=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0xe95e[_0x9edfd5];return _0x330738;};'use strict';var Sequelize=require('sequelize');module[_0xee95('0x0')]={'uniqueid':{'type':Sequelize[_0xee95('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xee95('0x2')},'membername':{'type':Sequelize[_0xee95('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xee95('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xee95('0x3')],'allowNull':![],'unique':_0xee95('0x4'),'comment':_0xee95('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xee95('0x3')],'allowNull':![],'unique':_0xee95('0x4'),'comment':_0xee95('0x2')},'penalty':{'type':Sequelize[_0xee95('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xee95('0x1')](0xb),'defaultValue':0x0,'comment':_0xee95('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 725aa8f..12619c6 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 _0xcc4a=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x56ccea,_0x453ace){var _0xb83fcf=function(_0x518ac7){while(--_0x518ac7){_0x56ccea['push'](_0x56ccea['shift']());}};_0xb83fcf(++_0x453ace);}(_0xcc4a,0x1d1));var _0xacc4=function(_0x35522d,_0x36d5a1){_0x35522d=_0x35522d-0x0;var _0x3e7e04=_0xcc4a[_0x35522d];return _0x3e7e04;};'use strict';var EventEmitter=require(_0xacc4('0x0'));var UserVoiceQueueRt=require(_0xacc4('0x1'))['db'][_0xacc4('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xacc4('0x3'),'afterUpdate':_0xacc4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3fb2ce){return function(_0x4352a8,_0xd4a22b,_0x4a5457){UserVoiceQueueRtEvents[_0xacc4('0x5')](_0x3fb2ce+':'+_0x4352a8['id'],_0x4352a8);UserVoiceQueueRtEvents[_0xacc4('0x5')](_0x3fb2ce,_0x4352a8);_0x4a5457(null);};}for(var e in events){if(events[_0xacc4('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xacc4('0x7')](e,emitEvent(event));}}module[_0xacc4('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x721f=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x1d84b1,_0x599872){var _0x54fa39=function(_0x48ef05){while(--_0x48ef05){_0x1d84b1['push'](_0x1d84b1['shift']());}};_0x54fa39(++_0x599872);}(_0x721f,0x193));var _0xf721=function(_0x4d22a9,_0x2aacdc){_0x4d22a9=_0x4d22a9-0x0;var _0x2a1929=_0x721f[_0x4d22a9];return _0x2a1929;};'use strict';var EventEmitter=require(_0xf721('0x0'));var UserVoiceQueueRt=require(_0xf721('0x1'))['db'][_0xf721('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf721('0x3')](0x0);var events={'afterCreate':_0xf721('0x4'),'afterUpdate':_0xf721('0x5'),'afterDestroy':_0xf721('0x6')};function emitEvent(_0x1ac514){return function(_0xd17712,_0x1ec648,_0x30e162){UserVoiceQueueRtEvents[_0xf721('0x7')](_0x1ac514+':'+_0xd17712['id'],_0xd17712);UserVoiceQueueRtEvents[_0xf721('0x7')](_0x1ac514,_0xd17712);_0x30e162(null);};}for(var e in events){if(events[_0xf721('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xf721('0x9')](e,emitEvent(event));}}module[_0xf721('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index c431a9c..3eda29f 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 _0x5d49=['moment','request-promise','path','rimraf','../../config/environment','define','user_has_voice_queues_rt','lodash','api'];(function(_0x258338,_0x17ba47){var _0x10b574=function(_0x58bca6){while(--_0x58bca6){_0x258338['push'](_0x258338['shift']());}};_0x10b574(++_0x17ba47);}(_0x5d49,0x6a));var _0x95d4=function(_0x271f4f,_0x4087f5){_0x271f4f=_0x271f4f-0x0;var _0x59394d=_0x5d49[_0x271f4f];return _0x59394d;};'use strict';var _=require(_0x95d4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x95d4('0x1'));var moment=require(_0x95d4('0x2'));var BPromise=require('bluebird');var rp=require(_0x95d4('0x3'));var fs=require('fs');var path=require(_0x95d4('0x4'));var rimraf=require(_0x95d4('0x5'));var config=require(_0x95d4('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x48ee7a,_0x2e73f8){return _0x48ee7a[_0x95d4('0x7')]('UserVoiceQueueRt',attributes,{'tableName':_0x95d4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb277=['user_has_voice_queues_rt','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xb277,0x114));var _0x7b27=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xb277[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x7b27('0x0'));var util=require('util');var logger=require(_0x7b27('0x1'))(_0x7b27('0x2'));var moment=require('moment');var BPromise=require(_0x7b27('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b27('0x4'));var rimraf=require(_0x7b27('0x5'));var config=require(_0x7b27('0x6'));var attributes=require(_0x7b27('0x7'));module[_0x7b27('0x8')]=function(_0x5013c3,_0x1adc4b){return _0x5013c3[_0x7b27('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0x7b27('0xa'),'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 0a5c088..cd6cdbc 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 _0xfcf9=['error','message','result','catch','GetVoiceQueueRtPauses','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','request','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x2a5cc0,_0x535ba0){var _0x2e5430=function(_0x1efd95){while(--_0x1efd95){_0x2a5cc0['push'](_0x2a5cc0['shift']());}};_0x2e5430(++_0x535ba0);}(_0xfcf9,0xfb));var _0x9fcf=function(_0x2b3fbc,_0x5a0c3e){_0x2b3fbc=_0x2b3fbc-0x0;var _0x126686=_0xfcf9[_0x2b3fbc];return _0x126686;};'use strict';var _=require(_0x9fcf('0x0'));var util=require(_0x9fcf('0x1'));var moment=require(_0x9fcf('0x2'));var BPromise=require('bluebird');var rs=require(_0x9fcf('0x3'));var fs=require('fs');var Redis=require(_0x9fcf('0x4'));var db=require(_0x9fcf('0x5'))['db'];var utils=require(_0x9fcf('0x6'));var logger=require(_0x9fcf('0x7'))(_0x9fcf('0x8'));var config=require(_0x9fcf('0x9'));var jayson=require(_0x9fcf('0xa'));var client=jayson[_0x9fcf('0xb')]['http']({'port':0x232a});config['redis']=_[_0x9fcf('0xc')](config[_0x9fcf('0xd')],{'host':_0x9fcf('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9fcf('0xd')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x225a56,_0x3d18f7,_0x21db14){return new BPromise(function(_0x5c33da,_0x5eebf4){return client[_0x9fcf('0xf')](_0x225a56,_0x21db14)['then'](function(_0x2692b7){logger[_0x9fcf('0x10')](_0x9fcf('0x11'),_0x3d18f7,'request\x20sent');logger[_0x9fcf('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x3d18f7,_0x9fcf('0x13'),JSON[_0x9fcf('0x14')](_0x2692b7));if(_0x2692b7[_0x9fcf('0x15')]){if(_0x2692b7[_0x9fcf('0x15')]['code']===0x1f4){logger[_0x9fcf('0x15')](_0x9fcf('0x11'),_0x3d18f7,_0x2692b7[_0x9fcf('0x15')]['message']);return _0x5eebf4(_0x2692b7[_0x9fcf('0x15')][_0x9fcf('0x16')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3d18f7,_0x2692b7[_0x9fcf('0x15')][_0x9fcf('0x16')]);return _0x5c33da(_0x2692b7['error'][_0x9fcf('0x16')]);}else{logger[_0x9fcf('0x10')](_0x9fcf('0x11'),_0x3d18f7,_0x9fcf('0x13'));_0x5c33da(_0x2692b7[_0x9fcf('0x17')]['message']);}})[_0x9fcf('0x18')](function(_0x17f22f){logger[_0x9fcf('0x15')](_0x9fcf('0x11'),_0x3d18f7,_0x17f22f);_0x5eebf4(_0x17f22f);});});}exports[_0x9fcf('0x19')]=function(_0x3a524f){var _0x3936e2=this;return new Promise(function(_0x585658,_0x3e6765){return db['UserVoiceQueueRt'][_0x9fcf('0x1a')]({'raw':_0x3a524f['options']?_0x3a524f[_0x9fcf('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3a524f[_0x9fcf('0x1b')]?_0x3a524f[_0x9fcf('0x1b')][_0x9fcf('0x1c')]||null:null,'attributes':[[db[_0x9fcf('0x1d')]['fn'](_0x9fcf('0x1e'),db[_0x9fcf('0x1d')]['fn']('IF',db[_0x9fcf('0x1d')][_0x9fcf('0x1f')](_0x9fcf('0x20')))),_0x9fcf('0x21')]]})['then'](function(_0x2bbf62){logger[_0x9fcf('0x10')]('GetVoiceQueueRtPauses',_0x3a524f);logger[_0x9fcf('0x12')]('GetVoiceQueueRtPauses',_0x3a524f,JSON[_0x9fcf('0x14')](_0x2bbf62));_0x585658(_0x2bbf62);})[_0x9fcf('0x18')](function(_0x3f39d5){logger['error']('GetVoiceQueueRtPauses',_0x3f39d5[_0x9fcf('0x16')],_0x3a524f);_0x3e6765(_0x3936e2['error'](0x1f4,_0x3f39d5['message']));});});}; \ No newline at end of file +var _0xfcf3=['jayson/promise','client','http','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UserVoiceQueueRt','findAll','options','raw','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfcf3,0xab));var _0x3fcf=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xfcf3[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x3fcf('0x0'));var util=require(_0x3fcf('0x1'));var moment=require(_0x3fcf('0x2'));var BPromise=require(_0x3fcf('0x3'));var rs=require(_0x3fcf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3fcf('0x5'));var logger=require(_0x3fcf('0x6'))(_0x3fcf('0x7'));var config=require(_0x3fcf('0x8'));var jayson=require(_0x3fcf('0x9'));var client=jayson[_0x3fcf('0xa')][_0x3fcf('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3fcf('0xc'),'port':0x18eb});var socket=require(_0x3fcf('0xd'))(new Redis(config[_0x3fcf('0xe')]));require(_0x3fcf('0xf'))[_0x3fcf('0x10')](socket);function respondWithRpcPromise(_0xed5065,_0x5e71e7,_0x4bb7ad){return new BPromise(function(_0x3b70c4,_0x39dc4f){return client[_0x3fcf('0x11')](_0xed5065,_0x4bb7ad)[_0x3fcf('0x12')](function(_0x5b2e38){logger['info'](_0x3fcf('0x13'),_0x5e71e7,'request\x20sent');logger[_0x3fcf('0x14')](_0x3fcf('0x15'),_0x5e71e7,_0x3fcf('0x16'),JSON[_0x3fcf('0x17')](_0x5b2e38));if(_0x5b2e38[_0x3fcf('0x18')]){if(_0x5b2e38[_0x3fcf('0x18')][_0x3fcf('0x19')]===0x1f4){logger[_0x3fcf('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5e71e7,_0x5b2e38[_0x3fcf('0x18')][_0x3fcf('0x1a')]);return _0x39dc4f(_0x5b2e38[_0x3fcf('0x18')][_0x3fcf('0x1a')]);}logger[_0x3fcf('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5e71e7,_0x5b2e38['error'][_0x3fcf('0x1a')]);return _0x3b70c4(_0x5b2e38[_0x3fcf('0x18')]['message']);}else{logger[_0x3fcf('0x1b')](_0x3fcf('0x13'),_0x5e71e7,_0x3fcf('0x16'));_0x3b70c4(_0x5b2e38[_0x3fcf('0x1c')][_0x3fcf('0x1a')]);}})[_0x3fcf('0x1d')](function(_0x361692){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5e71e7,_0x361692);_0x39dc4f(_0x361692);});});}exports['GetVoiceQueueRtPauses']=function(_0x3d0fd5){var _0x16d759=this;return new Promise(function(_0x1f2250,_0x5474bb){return db[_0x3fcf('0x1e')][_0x3fcf('0x1f')]({'raw':_0x3d0fd5[_0x3fcf('0x20')]?_0x3d0fd5[_0x3fcf('0x20')][_0x3fcf('0x21')]===undefined?!![]:![]:!![],'where':_0x3d0fd5[_0x3fcf('0x20')]?_0x3d0fd5[_0x3fcf('0x20')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x3fcf('0x22')]]})[_0x3fcf('0x12')](function(_0xca233d){logger[_0x3fcf('0x1b')](_0x3fcf('0x23'),_0x3d0fd5);logger['debug'](_0x3fcf('0x23'),_0x3d0fd5,JSON['stringify'](_0xca233d));_0x1f2250(_0xca233d);})[_0x3fcf('0x1d')](function(_0x57d5be){logger['error'](_0x3fcf('0x23'),_0x57d5be[_0x3fcf('0x1a')],_0x3d0fd5);_0x5474bb(_0x16d759[_0x3fcf('0x18')](0x1f4,_0x57d5be['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index a927f9b..a2205a9 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 _0xae1d=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','userVoiceQueueRt:'];(function(_0x381aaa,_0x430bed){var _0x2f1035=function(_0x54eea2){while(--_0x54eea2){_0x381aaa['push'](_0x381aaa['shift']());}};_0x2f1035(++_0x430bed);}(_0xae1d,0x149));var _0xdae1=function(_0x50576c,_0x502d9c){_0x50576c=_0x50576c-0x0;var _0x22c1ef=_0xae1d[_0x50576c];return _0x22c1ef;};'use strict';var UserVoiceQueueRtEvents=require(_0xdae1('0x0'));var events=[_0xdae1('0x1'),_0xdae1('0x2'),_0xdae1('0x3')];function createListener(_0x1c446d,_0x555809){return function(_0x55267f){_0x555809[_0xdae1('0x4')](_0x1c446d,_0x55267f);};}function removeListener(_0x2b89d9,_0x1bf2d0){return function(){UserVoiceQueueRtEvents[_0xdae1('0x5')](_0x2b89d9,_0x1bf2d0);};}exports['register']=function(_0x53a234){for(var _0x2a921c=0x0,_0x4dd4de=events['length'];_0x2a921c<_0x4dd4de;_0x2a921c++){var _0x45e4c8=events[_0x2a921c];var _0x324372=createListener(_0xdae1('0x6')+_0x45e4c8,_0x53a234);UserVoiceQueueRtEvents['on'](_0x45e4c8,_0x324372);}}; \ No newline at end of file +var _0x439e=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','removeListener'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x439e,0x147));var _0xe439=function(_0x4c5087,_0x85f2be){_0x4c5087=_0x4c5087-0x0;var _0x2093c4=_0x439e[_0x4c5087];return _0x2093c4;};'use strict';var UserVoiceQueueRtEvents=require(_0xe439('0x0'));var events=['save',_0xe439('0x1'),'update'];function createListener(_0x5d7fcc,_0x574721){return function(_0x3a1cbf){_0x574721['emit'](_0x5d7fcc,_0x3a1cbf);};}function removeListener(_0x32a470,_0x3c0bbd){return function(){UserVoiceQueueRtEvents[_0xe439('0x2')](_0x32a470,_0x3c0bbd);};}exports[_0xe439('0x3')]=function(_0x4cc238){for(var _0xa3bae3=0x0,_0x595efe=events[_0xe439('0x4')];_0xa3bae3<_0x595efe;_0xa3bae3++){var _0x468a56=events[_0xa3bae3];var _0x28c829=createListener(_0xe439('0x5')+_0x468a56,_0x4cc238);UserVoiceQueueRtEvents['on'](_0x468a56,_0x28c829);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 48e4cde..67b45d3 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 _0xd7b9=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x301416,_0x4d6210){var _0x264741=function(_0xbe88b4){while(--_0xbe88b4){_0x301416['push'](_0x301416['shift']());}};_0x264741(++_0x4d6210);}(_0xd7b9,0x11d));var _0x9d7b=function(_0xf0e391,_0x5433d4){_0xf0e391=_0xf0e391-0x0;var _0x1c126d=_0xd7b9[_0xf0e391];return _0x1c126d;};'use strict';var multer=require(_0x9d7b('0x0'));var util=require(_0x9d7b('0x1'));var path=require(_0x9d7b('0x2'));var timeout=require(_0x9d7b('0x3'));var express=require(_0x9d7b('0x4'));var router=express[_0x9d7b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9d7b('0x6'));var config=require(_0x9d7b('0x7'));module[_0x9d7b('0x8')]=router; \ No newline at end of file +var _0xc70a=['Router','../../components/interaction/service','../../config/environment','exports','multer','util','path','express'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0xc70a,0x1ec));var _0xac70=function(_0x55c77a,_0x43ee3d){_0x55c77a=_0x55c77a-0x0;var _0x1c7d13=_0xc70a[_0x55c77a];return _0x1c7d13;};'use strict';var multer=require(_0xac70('0x0'));var util=require(_0xac70('0x1'));var path=require(_0xac70('0x2'));var timeout=require('connect-timeout');var express=require(_0xac70('0x3'));var router=express[_0xac70('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xac70('0x5'));var config=require(_0xac70('0x6'));module[_0xac70('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 145cbce..9c9bce2 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 _0xbaf0=['exports','INTEGER'];(function(_0x2e2104,_0x11287d){var _0x1280c5=function(_0x533646){while(--_0x533646){_0x2e2104['push'](_0x2e2104['shift']());}};_0x1280c5(++_0x11287d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 1050ba1..e0e6e0d 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 _0xaebd=['moment','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','../../config/logger','api'];(function(_0x16f6f7,_0x78b29b){var _0x124803=function(_0x3000){while(--_0x3000){_0x16f6f7['push'](_0x16f6f7['shift']());}};_0x124803(++_0x78b29b);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x4d7027,_0x2f95f2){_0x4d7027=_0x4d7027-0x0;var _0x2d718e=_0xaebd[_0x4d7027];return _0x2d718e;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var logger=require(_0xdaeb('0x1'))(_0xdaeb('0x2'));var moment=require(_0xdaeb('0x3'));var BPromise=require(_0xdaeb('0x4'));var rp=require(_0xdaeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaeb('0x6'));var config=require(_0xdaeb('0x7'));var attributes=require(_0xdaeb('0x8'));module[_0xdaeb('0x9')]=function(_0xee94f9,_0x4b7255){return _0xee94f9[_0xdaeb('0xa')](_0xdaeb('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fc2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0x4fc2,0x111));var _0x24fc=function(_0x427214,_0xaa01af){_0x427214=_0x427214-0x0;var _0x4a9fe0=_0x4fc2[_0x427214];return _0x4a9fe0;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'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 0af860d..c97eaed 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(_0x4b04cc,_0x15b0e8){var _0x36355d=function(_0x2333ae){while(--_0x2333ae){_0x4b04cc['push'](_0x4b04cc['shift']());}};_0x36355d(++_0x15b0e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x299b1e,_0x360b92){var _0x238c94=function(_0x284d87){while(--_0x284d87){_0x299b1e['push'](_0x299b1e['shift']());}};_0x238c94(++_0x360b92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 02aa53e..0c4a379 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 _0x75c8=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy','exports','util','path'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x75c8,0x76));var _0x875c=function(_0x27380c,_0x2f5b0d){_0x27380c=_0x27380c-0x0;var _0x8a0b7f=_0x75c8[_0x27380c];return _0x8a0b7f;};'use strict';var multer=require('multer');var util=require(_0x875c('0x0'));var path=require(_0x875c('0x1'));var timeout=require(_0x875c('0x2'));var express=require(_0x875c('0x3'));var router=express[_0x875c('0x4')]();var auth=require(_0x875c('0x5'));var interaction=require(_0x875c('0x6'));var config=require(_0x875c('0x7'));var controller=require(_0x875c('0x8'));router[_0x875c('0x9')]('/',auth[_0x875c('0xa')](),controller[_0x875c('0xb')]);router[_0x875c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x875c('0xc')]);router[_0x875c('0xd')]('/',auth['isAuthenticated'](),controller[_0x875c('0xe')]);router[_0x875c('0xf')]('/:id',auth[_0x875c('0xa')](),controller['update']);router[_0x875c('0x10')](_0x875c('0x11'),auth['isAuthenticated'](),controller[_0x875c('0x12')]);module[_0x875c('0x13')]=router; \ No newline at end of file +var _0xcafa=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x14f7c2,_0x4276a1){var _0x1df82a=function(_0x5509ca){while(--_0x5509ca){_0x14f7c2['push'](_0x14f7c2['shift']());}};_0x1df82a(++_0x4276a1);}(_0xcafa,0x19e));var _0xacaf=function(_0x12784b,_0x2d1534){_0x12784b=_0x12784b-0x0;var _0x272084=_0xcafa[_0x12784b];return _0x272084;};'use strict';var multer=require(_0xacaf('0x0'));var util=require(_0xacaf('0x1'));var path=require(_0xacaf('0x2'));var timeout=require(_0xacaf('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xacaf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xacaf('0x5'));var controller=require('./variable.controller');router['get']('/',auth[_0xacaf('0x6')](),controller['index']);router['get'](_0xacaf('0x7'),auth[_0xacaf('0x6')](),controller[_0xacaf('0x8')]);router[_0xacaf('0x9')]('/',auth['isAuthenticated'](),controller[_0xacaf('0xa')]);router[_0xacaf('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xacaf('0xc')]);router[_0xacaf('0xd')](_0xacaf('0x7'),auth[_0xacaf('0x6')](),controller[_0xacaf('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index f5dfbb9..0da59a0 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 _0x5e03=['sequelize','exports','STRING','name'];(function(_0x1c3b6a,_0x41b0d6){var _0x322d19=function(_0x1151cf){while(--_0x1151cf){_0x1c3b6a['push'](_0x1c3b6a['shift']());}};_0x322d19(++_0x41b0d6);}(_0x5e03,0x178));var _0x35e0=function(_0x2614b1,_0x337872){_0x2614b1=_0x2614b1-0x0;var _0x4a7cc7=_0x5e03[_0x2614b1];return _0x4a7cc7;};'use strict';var Sequelize=require(_0x35e0('0x0'));module[_0x35e0('0x1')]={'name':{'type':Sequelize[_0x35e0('0x2')],'unique':_0x35e0('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x35e0('0x2')]}}; \ No newline at end of file +var _0x714b=['name','exports','STRING'];(function(_0x12ae90,_0x1a48e0){var _0x1a11d7=function(_0x557bb4){while(--_0x557bb4){_0x12ae90['push'](_0x12ae90['shift']());}};_0x1a11d7(++_0x1a48e0);}(_0x714b,0x1d8));var _0xb714=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x714b[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0xb714('0x0')]={'name':{'type':Sequelize[_0xb714('0x1')],'unique':_0xb714('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 7694a5f..02372b9 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 _0x3ba5=['Variables','UserProfileResource','error','stack','name','send','map','Variable','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','include','rows','catch','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3ba5,0x111));var _0x53ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ba5[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x53ba('0x0'));var emlformat=require(_0x53ba('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x53ba('0x2'));var jsonpatch=require(_0x53ba('0x3'));var rp=require(_0x53ba('0x4'));var moment=require(_0x53ba('0x5'));var BPromise=require(_0x53ba('0x6'));var Mustache=require(_0x53ba('0x7'));var util=require(_0x53ba('0x8'));var path=require(_0x53ba('0x9'));var sox=require(_0x53ba('0xa'));var csv=require(_0x53ba('0xb'));var ejs=require(_0x53ba('0xc'));var fs=require('fs');var _=require(_0x53ba('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x53ba('0xe'));var deskjs=require(_0x53ba('0xf'));var toCsv=require(_0x53ba('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x53ba('0x10'));var authService=require(_0x53ba('0x11'));var qs=require(_0x53ba('0x12'));var as=require(_0x53ba('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53ba('0x14'))('api');var utils=require(_0x53ba('0x15'));var config=require(_0x53ba('0x16'));var licenseUtil=require(_0x53ba('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc412e7,_0x14fc6f){_0x14fc6f=_0x14fc6f||0xcc;return function(_0x37d2cc){if(_0x37d2cc){return _0xc412e7[_0x53ba('0x18')](_0x14fc6f);}return _0xc412e7['status'](_0x14fc6f)[_0x53ba('0x19')]();};}function respondWithResult(_0x38005b,_0x16bec2){_0x16bec2=_0x16bec2||0xc8;return function(_0x3ff174){if(_0x3ff174){return _0x38005b[_0x53ba('0x1a')](_0x16bec2)[_0x53ba('0x1b')](_0x3ff174);}};}function respondWithFilteredResult(_0x228535,_0x1b2d60){return function(_0x5e3de7){if(_0x5e3de7){var _0x4fcb60=_0x5e3de7[_0x53ba('0x1c')],_0x3e9d4a=_0x1b2d60['offset'],_0x11e155=_0x1b2d60[_0x53ba('0x1d')]+_0x1b2d60[_0x53ba('0x1e')],_0x337619;if(_0x11e155>=_0x4fcb60){_0x11e155=_0x4fcb60;_0x337619=0xc8;}else{_0x337619=0xce;}_0x228535[_0x53ba('0x1a')](_0x337619);return _0x228535[_0x53ba('0x1f')](_0x53ba('0x20'),_0x3e9d4a+'-'+_0x11e155+'/'+_0x4fcb60)[_0x53ba('0x1b')](_0x5e3de7);}return null;};}function patchUpdates(_0x276880){return function(_0x14e177){try{jsonpatch[_0x53ba('0x21')](_0x14e177,_0x276880,!![]);}catch(_0x3013e6){return BPromise[_0x53ba('0x22')](_0x3013e6);}return _0x14e177['save']();};}function saveUpdates(_0x337d8b,_0x376e48){return function(_0x3435c7){if(_0x3435c7){return _0x3435c7[_0x53ba('0x23')](_0x337d8b)[_0x53ba('0x24')](function(_0x224be5){return _0x224be5;});}return null;};}function removeEntity(_0x322aa4,_0x461a4){return function(_0x13db44){if(_0x13db44){return _0x13db44[_0x53ba('0x25')]()[_0x53ba('0x24')](function(){var _0xe88252=_0x13db44[_0x53ba('0x26')]({'plain':!![]});var _0x30bcbf=_0x53ba('0x27');return db[_0x53ba('0x28')][_0x53ba('0x25')]({'where':{'type':_0x30bcbf,'resourceId':_0xe88252['id']}})[_0x53ba('0x24')](function(){return _0x13db44;});})['then'](function(){_0x322aa4[_0x53ba('0x1a')](0xcc)[_0x53ba('0x19')]();});}};}function handleEntityNotFound(_0x1faa5f,_0x1e768f){return function(_0x106903){if(!_0x106903){_0x1faa5f[_0x53ba('0x18')](0x194);}return _0x106903;};}function handleError(_0x9005c6,_0x400b9e){_0x400b9e=_0x400b9e||0x1f4;return function(_0x247a27){logger[_0x53ba('0x29')](_0x247a27[_0x53ba('0x2a')]);if(_0x247a27[_0x53ba('0x2b')]){delete _0x247a27[_0x53ba('0x2b')];}_0x9005c6[_0x53ba('0x1a')](_0x400b9e)[_0x53ba('0x2c')](_0x247a27);};}exports['index']=function(_0x541e97,_0x382c3b){var _0x5738e0={},_0x1a8df5={},_0x51713a={'count':0x0,'rows':[]};var _0x25d7bf=_[_0x53ba('0x2d')](db[_0x53ba('0x2e')]['rawAttributes'],function(_0x2ac00d){return{'name':_0x2ac00d['fieldName'],'type':_0x2ac00d[_0x53ba('0x2f')][_0x53ba('0x30')]};});_0x1a8df5['model']=_[_0x53ba('0x2d')](_0x25d7bf,_0x53ba('0x2b'));_0x1a8df5[_0x53ba('0x31')]=_[_0x53ba('0x32')](_0x541e97['query']);_0x1a8df5['filters']=_[_0x53ba('0x33')](_0x1a8df5[_0x53ba('0x34')],_0x1a8df5[_0x53ba('0x31')]);_0x5738e0['attributes']=_[_0x53ba('0x33')](_0x1a8df5[_0x53ba('0x34')],qs['fields'](_0x541e97[_0x53ba('0x31')][_0x53ba('0x35')]));_0x5738e0['attributes']=_0x5738e0[_0x53ba('0x36')][_0x53ba('0x37')]?_0x5738e0[_0x53ba('0x36')]:_0x1a8df5[_0x53ba('0x34')];if(!_0x541e97[_0x53ba('0x31')][_0x53ba('0x38')]('nolimit')){_0x5738e0[_0x53ba('0x1e')]=qs[_0x53ba('0x1e')](_0x541e97[_0x53ba('0x31')][_0x53ba('0x1e')]);_0x5738e0[_0x53ba('0x1d')]=qs[_0x53ba('0x1d')](_0x541e97[_0x53ba('0x31')][_0x53ba('0x1d')]);}_0x5738e0[_0x53ba('0x39')]=qs[_0x53ba('0x3a')](_0x541e97['query'][_0x53ba('0x3a')]);_0x5738e0[_0x53ba('0x3b')]=qs[_0x53ba('0x3c')](_[_0x53ba('0x3d')](_0x541e97[_0x53ba('0x31')],_0x1a8df5['filters']),_0x25d7bf);if(_0x541e97[_0x53ba('0x31')]['filter']){_0x5738e0[_0x53ba('0x3b')]=_[_0x53ba('0x3e')](_0x5738e0[_0x53ba('0x3b')],{'$or':_[_0x53ba('0x2d')](_0x25d7bf,function(_0x4f0eb8){if(_0x4f0eb8[_0x53ba('0x2f')]!=='VIRTUAL'){var _0x335846={};_0x335846[_0x4f0eb8[_0x53ba('0x2b')]]={'$like':'%'+_0x541e97[_0x53ba('0x31')][_0x53ba('0x3f')]+'%'};return _0x335846;}})});}_0x5738e0=_[_0x53ba('0x3e')]({},_0x5738e0,_0x541e97[_0x53ba('0x40')]);var _0x54089b={'where':_0x5738e0[_0x53ba('0x3b')]};return db[_0x53ba('0x2e')][_0x53ba('0x1c')](_0x54089b)[_0x53ba('0x24')](function(_0x32bfd4){_0x51713a[_0x53ba('0x1c')]=_0x32bfd4;if(_0x541e97[_0x53ba('0x31')]['includeAll']){_0x5738e0[_0x53ba('0x41')]=[{'all':!![]}];}return db[_0x53ba('0x2e')]['findAll'](_0x5738e0);})[_0x53ba('0x24')](function(_0x436981){_0x51713a[_0x53ba('0x42')]=_0x436981;return _0x51713a;})[_0x53ba('0x24')](respondWithFilteredResult(_0x382c3b,_0x5738e0))[_0x53ba('0x43')](handleError(_0x382c3b,null));};exports['show']=function(_0x463765,_0x8dee99){var _0x646c36={'raw':!![],'where':{'id':_0x463765['params']['id']}},_0x6c2854={};_0x6c2854['model']=_[_0x53ba('0x32')](db[_0x53ba('0x2e')][_0x53ba('0x44')]);_0x6c2854[_0x53ba('0x31')]=_[_0x53ba('0x32')](_0x463765[_0x53ba('0x31')]);_0x6c2854[_0x53ba('0x3c')]=_[_0x53ba('0x33')](_0x6c2854[_0x53ba('0x34')],_0x6c2854[_0x53ba('0x31')]);_0x646c36[_0x53ba('0x36')]=_[_0x53ba('0x33')](_0x6c2854[_0x53ba('0x34')],qs[_0x53ba('0x35')](_0x463765['query'][_0x53ba('0x35')]));_0x646c36[_0x53ba('0x36')]=_0x646c36[_0x53ba('0x36')]['length']?_0x646c36[_0x53ba('0x36')]:_0x6c2854['model'];if(_0x463765[_0x53ba('0x31')][_0x53ba('0x45')]){_0x646c36[_0x53ba('0x41')]=[{'all':!![]}];}_0x646c36=_['merge']({},_0x646c36,_0x463765[_0x53ba('0x40')]);return db[_0x53ba('0x2e')][_0x53ba('0x46')](_0x646c36)[_0x53ba('0x24')](handleEntityNotFound(_0x8dee99,null))['then'](respondWithResult(_0x8dee99,null))[_0x53ba('0x43')](handleError(_0x8dee99,null));};exports[_0x53ba('0x47')]=function(_0x298575,_0xf3c79){return db['Variable'][_0x53ba('0x47')](_0x298575['body'],{})[_0x53ba('0x24')](function(_0x12901c){var _0x3d6d9f=_0x298575['user'][_0x53ba('0x26')]({'plain':!![]});if(!_0x3d6d9f)throw new Error(_0x53ba('0x48'));if(_0x3d6d9f[_0x53ba('0x49')]==='user'){var _0x59f32d=_0x12901c['get']({'plain':!![]});var _0x4d770c='Variables';return db[_0x53ba('0x4a')][_0x53ba('0x46')]({'where':{'name':_0x4d770c,'userProfileId':_0x3d6d9f['userProfileId']},'raw':!![]})[_0x53ba('0x24')](function(_0x29abe9){if(_0x29abe9&&_0x29abe9['autoAssociation']===0x0){return db[_0x53ba('0x28')][_0x53ba('0x47')]({'name':_0x59f32d[_0x53ba('0x2b')],'resourceId':_0x59f32d['id'],'type':_0x29abe9['name'],'sectionId':_0x29abe9['id']},{})[_0x53ba('0x24')](function(){return _0x12901c;});}else{return _0x12901c;}})[_0x53ba('0x43')](function(_0x2f4b55){logger['error'](_0x53ba('0x4b'),_0x2f4b55);throw _0x2f4b55;});}return _0x12901c;})['then'](respondWithResult(_0xf3c79,0xc9))[_0x53ba('0x43')](handleError(_0xf3c79,null));};exports[_0x53ba('0x23')]=function(_0x4c94e1,_0x52b52e){if(_0x4c94e1[_0x53ba('0x4c')]['id']){delete _0x4c94e1[_0x53ba('0x4c')]['id'];}return db[_0x53ba('0x2e')][_0x53ba('0x46')]({'where':{'id':_0x4c94e1[_0x53ba('0x4d')]['id']}})[_0x53ba('0x24')](handleEntityNotFound(_0x52b52e,null))[_0x53ba('0x24')](saveUpdates(_0x4c94e1[_0x53ba('0x4c')],null))[_0x53ba('0x24')](respondWithResult(_0x52b52e,null))[_0x53ba('0x43')](handleError(_0x52b52e,null));};exports['destroy']=function(_0x57495f,_0x357441){return db[_0x53ba('0x2e')][_0x53ba('0x46')]({'where':{'id':_0x57495f[_0x53ba('0x4d')]['id']}})[_0x53ba('0x24')](handleEntityNotFound(_0x357441,null))[_0x53ba('0x24')](removeEntity(_0x357441,null))[_0x53ba('0x43')](handleError(_0x357441,null));}; \ No newline at end of file +var _0xb524=['where','includeAll','include','Variable','findAll','rows','catch','show','fields','create','body','user','role','Variables','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge'];(function(_0x2529ac,_0x1ca6a5){var _0x448be3=function(_0x3584d1){while(--_0x3584d1){_0x2529ac['push'](_0x2529ac['shift']());}};_0x448be3(++_0x1ca6a5);}(_0xb524,0x194));var _0x4b52=function(_0x13833a,_0x3a3101){_0x13833a=_0x13833a-0x0;var _0xf8b53c=_0xb524[_0x13833a];return _0xf8b53c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4b52('0x0'));var rimraf=require(_0x4b52('0x1'));var zipdir=require(_0x4b52('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b52('0x3'));var moment=require(_0x4b52('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4b52('0x5'));var util=require(_0x4b52('0x6'));var path=require(_0x4b52('0x7'));var sox=require(_0x4b52('0x8'));var csv=require('to-csv');var ejs=require(_0x4b52('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4b52('0xa'));var jsforce=require(_0x4b52('0xb'));var deskjs=require(_0x4b52('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4b52('0xd'));var Papa=require(_0x4b52('0xe'));var Redis=require(_0x4b52('0xf'));var authService=require(_0x4b52('0x10'));var qs=require(_0x4b52('0x11'));var as=require(_0x4b52('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4b52('0x13'));var utils=require('../../config/utils');var config=require(_0x4b52('0x14'));var licenseUtil=require(_0x4b52('0x15'));var db=require(_0x4b52('0x16'))['db'];function respondWithStatusCode(_0x516ce0,_0x435d98){_0x435d98=_0x435d98||0xcc;return function(_0x5aed23){if(_0x5aed23){return _0x516ce0[_0x4b52('0x17')](_0x435d98);}return _0x516ce0[_0x4b52('0x18')](_0x435d98)[_0x4b52('0x19')]();};}function respondWithResult(_0x1a040d,_0x21895a){_0x21895a=_0x21895a||0xc8;return function(_0x1f5f65){if(_0x1f5f65){return _0x1a040d[_0x4b52('0x18')](_0x21895a)[_0x4b52('0x1a')](_0x1f5f65);}};}function respondWithFilteredResult(_0x48f641,_0x4d133a){return function(_0xb5dd09){if(_0xb5dd09){var _0x88cbb=_0xb5dd09[_0x4b52('0x1b')],_0x312b5d=_0x4d133a[_0x4b52('0x1c')],_0x12b9a6=_0x4d133a['offset']+_0x4d133a[_0x4b52('0x1d')],_0xb7f105;if(_0x12b9a6>=_0x88cbb){_0x12b9a6=_0x88cbb;_0xb7f105=0xc8;}else{_0xb7f105=0xce;}_0x48f641[_0x4b52('0x18')](_0xb7f105);return _0x48f641[_0x4b52('0x1e')](_0x4b52('0x1f'),_0x312b5d+'-'+_0x12b9a6+'/'+_0x88cbb)[_0x4b52('0x1a')](_0xb5dd09);}return null;};}function patchUpdates(_0x39167f){return function(_0x49d762){try{jsonpatch['apply'](_0x49d762,_0x39167f,!![]);}catch(_0x1dab72){return BPromise[_0x4b52('0x20')](_0x1dab72);}return _0x49d762[_0x4b52('0x21')]();};}function saveUpdates(_0x5ed5ee,_0x1211c9){return function(_0x11e122){if(_0x11e122){return _0x11e122[_0x4b52('0x22')](_0x5ed5ee)[_0x4b52('0x23')](function(_0x321299){return _0x321299;});}return null;};}function removeEntity(_0x1be7a3,_0xf43cd2){return function(_0x11502e){if(_0x11502e){return _0x11502e[_0x4b52('0x24')]()['then'](function(){var _0x5142d6=_0x11502e[_0x4b52('0x25')]({'plain':!![]});var _0x4c18a4='Variables';return db[_0x4b52('0x26')][_0x4b52('0x24')]({'where':{'type':_0x4c18a4,'resourceId':_0x5142d6['id']}})[_0x4b52('0x23')](function(){return _0x11502e;});})['then'](function(){_0x1be7a3[_0x4b52('0x18')](0xcc)[_0x4b52('0x19')]();});}};}function handleEntityNotFound(_0x32cb23,_0x453755){return function(_0xcb59b5){if(!_0xcb59b5){_0x32cb23[_0x4b52('0x17')](0x194);}return _0xcb59b5;};}function handleError(_0x378222,_0x1109a8){_0x1109a8=_0x1109a8||0x1f4;return function(_0x39688c){logger[_0x4b52('0x27')](_0x39688c['stack']);if(_0x39688c[_0x4b52('0x28')]){delete _0x39688c[_0x4b52('0x28')];}_0x378222[_0x4b52('0x18')](_0x1109a8)['send'](_0x39688c);};}exports['index']=function(_0xc08f1d,_0x14e21e){var _0xf336c6={},_0x22a4b3={},_0x5efe59={'count':0x0,'rows':[]};var _0x2b2fc2=_[_0x4b52('0x29')](db['Variable']['rawAttributes'],function(_0x1be5d7){return{'name':_0x1be5d7[_0x4b52('0x2a')],'type':_0x1be5d7[_0x4b52('0x2b')][_0x4b52('0x2c')]};});_0x22a4b3[_0x4b52('0x2d')]=_[_0x4b52('0x29')](_0x2b2fc2,_0x4b52('0x28'));_0x22a4b3[_0x4b52('0x2e')]=_[_0x4b52('0x2f')](_0xc08f1d[_0x4b52('0x2e')]);_0x22a4b3[_0x4b52('0x30')]=_[_0x4b52('0x31')](_0x22a4b3[_0x4b52('0x2d')],_0x22a4b3[_0x4b52('0x2e')]);_0xf336c6['attributes']=_[_0x4b52('0x31')](_0x22a4b3[_0x4b52('0x2d')],qs['fields'](_0xc08f1d[_0x4b52('0x2e')]['fields']));_0xf336c6[_0x4b52('0x32')]=_0xf336c6[_0x4b52('0x32')][_0x4b52('0x33')]?_0xf336c6['attributes']:_0x22a4b3[_0x4b52('0x2d')];if(!_0xc08f1d[_0x4b52('0x2e')][_0x4b52('0x34')](_0x4b52('0x35'))){_0xf336c6[_0x4b52('0x1d')]=qs[_0x4b52('0x1d')](_0xc08f1d[_0x4b52('0x2e')]['limit']);_0xf336c6[_0x4b52('0x1c')]=qs['offset'](_0xc08f1d[_0x4b52('0x2e')][_0x4b52('0x1c')]);}_0xf336c6['order']=qs['sort'](_0xc08f1d[_0x4b52('0x2e')][_0x4b52('0x36')]);_0xf336c6['where']=qs[_0x4b52('0x30')](_[_0x4b52('0x37')](_0xc08f1d[_0x4b52('0x2e')],_0x22a4b3[_0x4b52('0x30')]),_0x2b2fc2);if(_0xc08f1d[_0x4b52('0x2e')][_0x4b52('0x38')]){_0xf336c6['where']=_[_0x4b52('0x39')](_0xf336c6[_0x4b52('0x3a')],{'$or':_[_0x4b52('0x29')](_0x2b2fc2,function(_0x749d22){if(_0x749d22[_0x4b52('0x2b')]!=='VIRTUAL'){var _0x48397f={};_0x48397f[_0x749d22['name']]={'$like':'%'+_0xc08f1d[_0x4b52('0x2e')][_0x4b52('0x38')]+'%'};return _0x48397f;}})});}_0xf336c6=_[_0x4b52('0x39')]({},_0xf336c6,_0xc08f1d['options']);var _0x1f06d8={'where':_0xf336c6[_0x4b52('0x3a')]};return db['Variable'][_0x4b52('0x1b')](_0x1f06d8)[_0x4b52('0x23')](function(_0x26f5ac){_0x5efe59[_0x4b52('0x1b')]=_0x26f5ac;if(_0xc08f1d[_0x4b52('0x2e')][_0x4b52('0x3b')]){_0xf336c6[_0x4b52('0x3c')]=[{'all':!![]}];}return db[_0x4b52('0x3d')][_0x4b52('0x3e')](_0xf336c6);})[_0x4b52('0x23')](function(_0x11b10f){_0x5efe59[_0x4b52('0x3f')]=_0x11b10f;return _0x5efe59;})[_0x4b52('0x23')](respondWithFilteredResult(_0x14e21e,_0xf336c6))[_0x4b52('0x40')](handleError(_0x14e21e,null));};exports[_0x4b52('0x41')]=function(_0x1312ba,_0x2314ba){var _0x988e8b={'raw':!![],'where':{'id':_0x1312ba['params']['id']}},_0x5f5383={};_0x5f5383['model']=_['keys'](db[_0x4b52('0x3d')]['rawAttributes']);_0x5f5383[_0x4b52('0x2e')]=_[_0x4b52('0x2f')](_0x1312ba[_0x4b52('0x2e')]);_0x5f5383['filters']=_['intersection'](_0x5f5383['model'],_0x5f5383[_0x4b52('0x2e')]);_0x988e8b[_0x4b52('0x32')]=_[_0x4b52('0x31')](_0x5f5383['model'],qs[_0x4b52('0x42')](_0x1312ba[_0x4b52('0x2e')][_0x4b52('0x42')]));_0x988e8b['attributes']=_0x988e8b[_0x4b52('0x32')][_0x4b52('0x33')]?_0x988e8b[_0x4b52('0x32')]:_0x5f5383['model'];if(_0x1312ba[_0x4b52('0x2e')][_0x4b52('0x3b')]){_0x988e8b[_0x4b52('0x3c')]=[{'all':!![]}];}_0x988e8b=_[_0x4b52('0x39')]({},_0x988e8b,_0x1312ba['options']);return db[_0x4b52('0x3d')]['find'](_0x988e8b)[_0x4b52('0x23')](handleEntityNotFound(_0x2314ba,null))[_0x4b52('0x23')](respondWithResult(_0x2314ba,null))['catch'](handleError(_0x2314ba,null));};exports['create']=function(_0x3b8555,_0xb4fd4b){return db['Variable'][_0x4b52('0x43')](_0x3b8555[_0x4b52('0x44')],{})['then'](function(_0x6d69d){var _0x36c502=_0x3b8555[_0x4b52('0x45')][_0x4b52('0x25')]({'plain':!![]});if(!_0x36c502)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36c502[_0x4b52('0x46')]===_0x4b52('0x45')){var _0x3decad=_0x6d69d[_0x4b52('0x25')]({'plain':!![]});var _0x30bc97=_0x4b52('0x47');return db[_0x4b52('0x48')][_0x4b52('0x49')]({'where':{'name':_0x30bc97,'userProfileId':_0x36c502[_0x4b52('0x4a')]},'raw':!![]})[_0x4b52('0x23')](function(_0x4890fc){if(_0x4890fc&&_0x4890fc['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3decad['name'],'resourceId':_0x3decad['id'],'type':_0x4890fc['name'],'sectionId':_0x4890fc['id']},{})[_0x4b52('0x23')](function(){return _0x6d69d;});}else{return _0x6d69d;}})[_0x4b52('0x40')](function(_0x5e4272){logger[_0x4b52('0x27')](_0x4b52('0x4b'),_0x5e4272);throw _0x5e4272;});}return _0x6d69d;})['then'](respondWithResult(_0xb4fd4b,0xc9))[_0x4b52('0x40')](handleError(_0xb4fd4b,null));};exports[_0x4b52('0x22')]=function(_0xe7476f,_0x12ed21){if(_0xe7476f['body']['id']){delete _0xe7476f['body']['id'];}return db[_0x4b52('0x3d')][_0x4b52('0x49')]({'where':{'id':_0xe7476f[_0x4b52('0x4c')]['id']}})[_0x4b52('0x23')](handleEntityNotFound(_0x12ed21,null))['then'](saveUpdates(_0xe7476f['body'],null))['then'](respondWithResult(_0x12ed21,null))[_0x4b52('0x40')](handleError(_0x12ed21,null));};exports[_0x4b52('0x24')]=function(_0x33150a,_0x50a89b){return db[_0x4b52('0x3d')][_0x4b52('0x49')]({'where':{'id':_0x33150a[_0x4b52('0x4c')]['id']}})['then'](handleEntityNotFound(_0x50a89b,null))[_0x4b52('0x23')](removeEntity(_0x50a89b,null))[_0x4b52('0x40')](handleError(_0x50a89b,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index e717267..fbcdd88 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 _0x25b0=['bluebird','request-promise','path','rimraf','../../config/environment','exports','Variable','tools_variables','lodash','util','../../config/logger','api','moment'];(function(_0xd15c26,_0x5cb1b1){var _0x362ddd=function(_0x32628b){while(--_0x32628b){_0xd15c26['push'](_0xd15c26['shift']());}};_0x362ddd(++_0x5cb1b1);}(_0x25b0,0x140));var _0x025b=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0x25b0[_0x2b152a];return _0x2ad4c7;};'use strict';var _=require(_0x025b('0x0'));var util=require(_0x025b('0x1'));var logger=require(_0x025b('0x2'))(_0x025b('0x3'));var moment=require(_0x025b('0x4'));var BPromise=require(_0x025b('0x5'));var rp=require(_0x025b('0x6'));var fs=require('fs');var path=require(_0x025b('0x7'));var rimraf=require(_0x025b('0x8'));var config=require(_0x025b('0x9'));var attributes=require('./variable.attributes');module[_0x025b('0xa')]=function(_0x41b88b,_0x41d8a4){return _0x41b88b['define'](_0x025b('0xb'),attributes,{'tableName':_0x025b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc288=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','tools_variables','lodash'];(function(_0x3ff3c2,_0x43def2){var _0x3b99c1=function(_0xb4c504){while(--_0xb4c504){_0x3ff3c2['push'](_0x3ff3c2['shift']());}};_0x3b99c1(++_0x43def2);}(_0xc288,0x18b));var _0x8c28=function(_0x3bbbee,_0x17c90f){_0x3bbbee=_0x3bbbee-0x0;var _0x56c9ce=_0xc288[_0x3bbbee];return _0x56c9ce;};'use strict';var _=require(_0x8c28('0x0'));var util=require('util');var logger=require(_0x8c28('0x1'))(_0x8c28('0x2'));var moment=require(_0x8c28('0x3'));var BPromise=require(_0x8c28('0x4'));var rp=require(_0x8c28('0x5'));var fs=require('fs');var path=require(_0x8c28('0x6'));var rimraf=require(_0x8c28('0x7'));var config=require(_0x8c28('0x8'));var attributes=require(_0x8c28('0x9'));module[_0x8c28('0xa')]=function(_0x572d7b,_0x3d5973){return _0x572d7b['define']('Variable',attributes,{'tableName':_0x8c28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 44563ba..2cbd4d8 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 _0x858d=['Variable','find','raw','options','attributes','include','map','model','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowVariable'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x858d,0x17d));var _0xd858=function(_0x583873,_0x4149ed){_0x583873=_0x583873-0x0;var _0x5d395b=_0x858d[_0x583873];return _0x5d395b;};'use strict';var _=require(_0xd858('0x0'));var util=require(_0xd858('0x1'));var moment=require(_0xd858('0x2'));var BPromise=require('bluebird');var rs=require(_0xd858('0x3'));var fs=require('fs');var Redis=require(_0xd858('0x4'));var db=require(_0xd858('0x5'))['db'];var utils=require(_0xd858('0x6'));var logger=require(_0xd858('0x7'))('rpc');var config=require(_0xd858('0x8'));var jayson=require(_0xd858('0x9'));var client=jayson['client'][_0xd858('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eb434,_0x2d8a48,_0x2ab1c4){return new BPromise(function(_0x4220ad,_0x5800ed){return client['request'](_0x5eb434,_0x2ab1c4)[_0xd858('0xb')](function(_0x5dec8a){logger[_0xd858('0xc')](_0xd858('0xd'),_0x2d8a48,'request\x20sent');logger[_0xd858('0xe')](_0xd858('0xf'),_0x2d8a48,_0xd858('0x10'),JSON[_0xd858('0x11')](_0x5dec8a));if(_0x5dec8a['error']){if(_0x5dec8a[_0xd858('0x12')]['code']===0x1f4){logger[_0xd858('0x12')](_0xd858('0xd'),_0x2d8a48,_0x5dec8a['error'][_0xd858('0x13')]);return _0x5800ed(_0x5dec8a['error'][_0xd858('0x13')]);}logger[_0xd858('0x12')](_0xd858('0xd'),_0x2d8a48,_0x5dec8a['error'][_0xd858('0x13')]);return _0x4220ad(_0x5dec8a['error']['message']);}else{logger['info'](_0xd858('0xd'),_0x2d8a48,'request\x20sent');_0x4220ad(_0x5dec8a[_0xd858('0x14')][_0xd858('0x13')]);}})['catch'](function(_0x2f2a9b){logger[_0xd858('0x12')](_0xd858('0xd'),_0x2d8a48,_0x2f2a9b);_0x5800ed(_0x2f2a9b);});});}exports[_0xd858('0x15')]=function(_0x34246f){var _0x12f52b=this;return new Promise(function(_0x487acf,_0x214845){return db[_0xd858('0x16')][_0xd858('0x17')]({'raw':_0x34246f['options']?_0x34246f['options'][_0xd858('0x18')]===undefined?!![]:![]:!![],'where':_0x34246f[_0xd858('0x19')]?_0x34246f[_0xd858('0x19')]['where']||null:null,'attributes':_0x34246f[_0xd858('0x19')]?_0x34246f[_0xd858('0x19')][_0xd858('0x1a')]||null:null,'include':_0x34246f['options']?_0x34246f[_0xd858('0x19')]['include']?_['map'](_0x34246f['options']['include'],function(_0x5b95cb){return{'model':db[_0x5b95cb['model']],'as':_0x5b95cb['as'],'attributes':_0x5b95cb[_0xd858('0x1a')],'include':_0x5b95cb[_0xd858('0x1b')]?_[_0xd858('0x1c')](_0x5b95cb[_0xd858('0x1b')],function(_0x1df9fb){return{'model':db[_0x1df9fb['model']],'as':_0x1df9fb['as'],'attributes':_0x1df9fb[_0xd858('0x1a')],'include':_0x1df9fb[_0xd858('0x1b')]?_['map'](_0x1df9fb['include'],function(_0x1391be){return{'model':db[_0x1391be[_0xd858('0x1d')]],'as':_0x1391be['as'],'attributes':_0x1391be[_0xd858('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd858('0xb')](function(_0x5c3d99){logger[_0xd858('0xc')](_0xd858('0x15'),_0x34246f);logger[_0xd858('0xe')](_0xd858('0x15'),_0x34246f,JSON[_0xd858('0x11')](_0x5c3d99));_0x487acf(_0x5c3d99);})[_0xd858('0x1e')](function(_0x639a90){logger[_0xd858('0x12')]('ShowVariable',_0x639a90[_0xd858('0x13')],_0x34246f);_0x214845(_0x12f52b[_0xd858('0x12')](0x1f4,_0x639a90[_0xd858('0x13')]));});});}; \ No newline at end of file +var _0xa425=['stringify','error','code','message','info','catch','ShowVariable','Variable','options','raw','where','attributes','map','include','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa425,0x145));var _0x5a42=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xa425[_0x54d4a8];return _0x3b321b;};'use strict';var _=require('lodash');var util=require(_0x5a42('0x0'));var moment=require(_0x5a42('0x1'));var BPromise=require(_0x5a42('0x2'));var rs=require(_0x5a42('0x3'));var fs=require('fs');var Redis=require(_0x5a42('0x4'));var db=require(_0x5a42('0x5'))['db'];var utils=require(_0x5a42('0x6'));var logger=require(_0x5a42('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5a42('0x8'));var client=jayson['client'][_0x5a42('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f8361,_0x16ebaf,_0x4d849c){return new BPromise(function(_0x578bae,_0x3d2589){return client[_0x5a42('0xa')](_0x4f8361,_0x4d849c)[_0x5a42('0xb')](function(_0x311053){logger['info'](_0x5a42('0xc'),_0x16ebaf,_0x5a42('0xd'));logger[_0x5a42('0xe')](_0x5a42('0xf'),_0x16ebaf,_0x5a42('0xd'),JSON[_0x5a42('0x10')](_0x311053));if(_0x311053['error']){if(_0x311053[_0x5a42('0x11')][_0x5a42('0x12')]===0x1f4){logger[_0x5a42('0x11')]('Variable,\x20%s,\x20%s',_0x16ebaf,_0x311053[_0x5a42('0x11')][_0x5a42('0x13')]);return _0x3d2589(_0x311053[_0x5a42('0x11')][_0x5a42('0x13')]);}logger['error'](_0x5a42('0xc'),_0x16ebaf,_0x311053[_0x5a42('0x11')][_0x5a42('0x13')]);return _0x578bae(_0x311053['error'][_0x5a42('0x13')]);}else{logger[_0x5a42('0x14')](_0x5a42('0xc'),_0x16ebaf,_0x5a42('0xd'));_0x578bae(_0x311053['result']['message']);}})[_0x5a42('0x15')](function(_0x39fd1c){logger[_0x5a42('0x11')](_0x5a42('0xc'),_0x16ebaf,_0x39fd1c);_0x3d2589(_0x39fd1c);});});}exports[_0x5a42('0x16')]=function(_0x58386b){var _0x52bd60=this;return new Promise(function(_0x19494a,_0x153c2f){return db[_0x5a42('0x17')]['find']({'raw':_0x58386b[_0x5a42('0x18')]?_0x58386b[_0x5a42('0x18')][_0x5a42('0x19')]===undefined?!![]:![]:!![],'where':_0x58386b[_0x5a42('0x18')]?_0x58386b[_0x5a42('0x18')][_0x5a42('0x1a')]||null:null,'attributes':_0x58386b['options']?_0x58386b[_0x5a42('0x18')][_0x5a42('0x1b')]||null:null,'include':_0x58386b['options']?_0x58386b[_0x5a42('0x18')]['include']?_[_0x5a42('0x1c')](_0x58386b[_0x5a42('0x18')][_0x5a42('0x1d')],function(_0x3763ed){return{'model':db[_0x3763ed[_0x5a42('0x1e')]],'as':_0x3763ed['as'],'attributes':_0x3763ed['attributes'],'include':_0x3763ed['include']?_[_0x5a42('0x1c')](_0x3763ed['include'],function(_0x4eb5f0){return{'model':db[_0x4eb5f0[_0x5a42('0x1e')]],'as':_0x4eb5f0['as'],'attributes':_0x4eb5f0[_0x5a42('0x1b')],'include':_0x4eb5f0[_0x5a42('0x1d')]?_[_0x5a42('0x1c')](_0x4eb5f0[_0x5a42('0x1d')],function(_0x43234b){return{'model':db[_0x43234b['model']],'as':_0x43234b['as'],'attributes':_0x43234b['attributes']};}):[]};}):[]};}):[]:[]})[_0x5a42('0xb')](function(_0x5a75cb){logger['info'](_0x5a42('0x16'),_0x58386b);logger[_0x5a42('0xe')]('ShowVariable',_0x58386b,JSON[_0x5a42('0x10')](_0x5a75cb));_0x19494a(_0x5a75cb);})['catch'](function(_0x2676a4){logger['error'](_0x5a42('0x16'),_0x2676a4['message'],_0x58386b);_0x153c2f(_0x52bd60[_0x5a42('0x11')](0x1f4,_0x2676a4['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index a604d64..a6cffd9 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 _0x976c=['index','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','/pull','pull','/restart','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','get'];(function(_0x476445,_0x65e094){var _0x212187=function(_0x164f09){while(--_0x164f09){_0x476445['push'](_0x476445['shift']());}};_0x212187(++_0x65e094);}(_0x976c,0x175));var _0xc976=function(_0x5a7e91,_0x47982f){_0x5a7e91=_0x5a7e91-0x0;var _0xac2170=_0x976c[_0x5a7e91];return _0xac2170;};'use strict';var express=require(_0xc976('0x0'));var router=express[_0xc976('0x1')]();var auth=require(_0xc976('0x2'));var controller=require(_0xc976('0x3'));router[_0xc976('0x4')]('/',controller[_0xc976('0x5')]);router['get'](_0xc976('0x6'),auth['isAuthenticated'](),auth[_0xc976('0x7')](),controller[_0xc976('0x8')]);router[_0xc976('0x4')](_0xc976('0x9'),auth[_0xc976('0xa')](),auth[_0xc976('0x7')](),controller[_0xc976('0xb')]);router[_0xc976('0x4')](_0xc976('0xc'),auth[_0xc976('0xa')](),auth[_0xc976('0x7')](),controller[_0xc976('0xd')]);router[_0xc976('0x4')](_0xc976('0xe'),auth['isAuthenticated'](),controller[_0xc976('0xf')]);router[_0xc976('0x4')]('/migrations',controller[_0xc976('0x10')]);module[_0xc976('0x11')]=router; \ No newline at end of file +var _0x6273=['../../components/auth/service','./version.controller','index','get','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','Router'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x6273,0x12f));var _0x3627=function(_0x29bef8,_0x27833d){_0x29bef8=_0x29bef8-0x0;var _0x9cc8d8=_0x6273[_0x29bef8];return _0x9cc8d8;};'use strict';var express=require('express');var router=express[_0x3627('0x0')]();var auth=require(_0x3627('0x1'));var controller=require(_0x3627('0x2'));router['get']('/',controller[_0x3627('0x3')]);router[_0x3627('0x4')]('/fetch',auth[_0x3627('0x5')](),auth[_0x3627('0x6')](),controller[_0x3627('0x7')]);router[_0x3627('0x4')](_0x3627('0x8'),auth['isAuthenticated'](),auth[_0x3627('0x6')](),controller[_0x3627('0x9')]);router[_0x3627('0x4')](_0x3627('0xa'),auth[_0x3627('0x5')](),auth[_0x3627('0x6')](),controller[_0x3627('0xb')]);router[_0x3627('0x4')](_0x3627('0xc'),auth[_0x3627('0x5')](),controller[_0x3627('0xd')]);router[_0x3627('0x4')](_0x3627('0xe'),controller[_0x3627('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 7d12e5d..2ad6b17 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 _0x97ce=['pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','exports','push','sort','sequelize','Migration','constructor','server','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','version','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch','reset','--hard','git\x20reset\x20--hard'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x97ce,0x151));var _0xe97c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x97ce[_0x413feb];return _0x40ee88;};'use strict';var Umzug=require(_0xe97c('0x0'));var path=require(_0xe97c('0x1'));var fs=require('fs');var _=require(_0xe97c('0x2'));var pkginfo=require(_0xe97c('0x3'))(module,'version');var compareVersions=require(_0xe97c('0x4'));var exec=require('child_process')[_0xe97c('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0xe97c('0x6'));var pm2=require(_0xe97c('0x7'));var logger=require(_0xe97c('0x8'))(_0xe97c('0x9'));var git=require(_0xe97c('0xa'))(config[_0xe97c('0xb')]);exports['index']=function(_0x3bf4ef,_0x9c1b00){var _0x9ce6d={'current':module['exports'][_0xe97c('0xc')],'phonebar':0x2};if(_0x3bf4ef['query']&&_0x3bf4ef[_0xe97c('0xd')][_0xe97c('0xe')]){return git[_0xe97c('0xf')]()[_0xe97c('0x10')](function(_0x43e557,_0x3aa2a5){_0x9ce6d[_0xe97c('0xe')]=(_0x43e557?module['exports'][_0xe97c('0xc')]:_0x3aa2a5[_0xe97c('0xe')])||_0xe97c('0x11');return _0x9c1b00[_0xe97c('0x12')](0xc8)[_0xe97c('0x13')](_0x9ce6d);});}else{return _0x9c1b00[_0xe97c('0x12')](0xc8)[_0xe97c('0x13')](_0x9ce6d);}};exports[_0xe97c('0xf')]=function(_0x2665c0,_0x578ffc){return git['fetch']([_0xe97c('0x14'),'master'],function(_0x3d4dd2){if(_0x3d4dd2){logger[_0xe97c('0x15')](_0x3d4dd2);return _0x578ffc['status'](0x1f4)['json'](_0x3d4dd2);}logger[_0xe97c('0x16')](_0xe97c('0x17'));return _0x578ffc[_0xe97c('0x12')](0xc8)[_0xe97c('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x52f63d,_0x42d95c){return git[_0xe97c('0x18')]([_0xe97c('0x19'),'FETCH_HEAD'],function(_0x3bdf2e){if(_0x3bdf2e){logger[_0xe97c('0x15')](_0x3bdf2e);return _0x42d95c[_0xe97c('0x12')](0x1f4)[_0xe97c('0x13')](_0x3bdf2e);}logger[_0xe97c('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x42d95c[_0xe97c('0x12')](0xc8)[_0xe97c('0x13')]({'output':_0xe97c('0x1a')});});};exports[_0xe97c('0x1b')]=function(_0x32eb7a,_0x44c334){exec(_0xe97c('0x1c'),function(_0x1061e1,_0xc1be51,_0x2f2840){logger[_0xe97c('0x16')](_0xc1be51);logger[_0xe97c('0x16')](_0x2f2840);if(_0x1061e1){logger[_0xe97c('0x15')](_0x1061e1);return _0x44c334[_0xe97c('0x12')](0x1f4)[_0xe97c('0x13')](_0x1061e1);}return _0x44c334[_0xe97c('0x12')](0xc8)[_0xe97c('0x13')]({'output':_0xc1be51});});};exports[_0xe97c('0x1d')]=function(_0x22a78d,_0x49b81f){return pm2[_0xe97c('0x1d')](_0xe97c('0x1e'))[_0xe97c('0x1f')](function(_0x30914a){logger[_0xe97c('0x16')](_0xe97c('0x20'),_0x30914a);return _0x49b81f[_0xe97c('0x12')](0xc8)[_0xe97c('0x13')]({'output':_0xe97c('0x21')});})[_0xe97c('0x22')](function(_0x1684d3){logger[_0xe97c('0x15')](_0x1684d3);return _0x49b81f['status'](0x1f4)['json'](_0x1684d3);});};exports[_0xe97c('0x23')]=function(_0x1a3f69,_0x1273a2){var _0x27cfae=fs[_0xe97c('0x24')](path[_0xe97c('0x25')](config[_0xe97c('0xb')],'server','migrations'));var _0x35938e=[];for(var _0x36536c=0x0;_0x36536c<_0x27cfae[_0xe97c('0x26')];_0x36536c++){var _0x2a21a9=_0x27cfae[_0x36536c]['replace']('.js','');if(compareVersions(module[_0xe97c('0x27')][_0xe97c('0xc')],_0x2a21a9)===-0x1){_0x35938e[_0xe97c('0x28')](_0x2a21a9);}}if(_0x35938e['length']){var _0x5d6645=_0x35938e[_0xe97c('0x29')](compareVersions);var _0x12103b=new Umzug({'storage':_0xe97c('0x2a'),'storageOptions':{'model':db[_0xe97c('0x2b')],'modelName':_0xe97c('0x2b'),'columnName':_0xe97c('0xc')},'migrations':{'params':[db[_0xe97c('0x2a')]['getQueryInterface'](),db[_0xe97c('0x2a')][_0xe97c('0x2c')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xe97c('0x25')](config[_0xe97c('0xb')],_0xe97c('0x2d'),_0xe97c('0x23')),'pattern':/\.js$/}});_0x12103b['up']({'migrations':_[_0xe97c('0x2e')](_0x5d6645,function(_0x3fe177){return _0x3fe177+_0xe97c('0x2f');})})[_0xe97c('0x1f')](function(){return _0x1273a2['status'](0xc8)['json']({'output':_0xe97c('0x30')+module[_0xe97c('0x27')][_0xe97c('0xc')]+_0xe97c('0x31')+_['last'](_0x5d6645),'migrations':_[_0xe97c('0x25')](_0x5d6645)});})['catch'](function(_0x43dadf){if(_0x43dadf instanceof db[_0xe97c('0x2a')][_0xe97c('0x32')]){return _0x1273a2['status'](0xc8)[_0xe97c('0x13')]({'output':_0xe97c('0x33')});}else{return _0x1273a2[_0xe97c('0x12')](0x1f4)[_0xe97c('0x13')](_0x43dadf);}});}else{return _0x1273a2[_0xe97c('0x12')](0xc8)['json']({'output':_0xe97c('0x33')});}}; \ No newline at end of file +var _0x195f=['umzug','path','pkginfo','version','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','tags','2.0.0','json','status','fetch','origin','master','error','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','info','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','replace','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','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date'];(function(_0x30dfa6,_0x582c8d){var _0xecedc4=function(_0x4c2df8){while(--_0x4c2df8){_0x30dfa6['push'](_0x30dfa6['shift']());}};_0xecedc4(++_0x582c8d);}(_0x195f,0x113));var _0xf195=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0x195f[_0x322522];return _0x293bcf;};'use strict';var Umzug=require(_0xf195('0x0'));var path=require(_0xf195('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xf195('0x2'))(module,_0xf195('0x3'));var compareVersions=require('compare-versions');var exec=require(_0xf195('0x4'))['exec'];var db=require(_0xf195('0x5'))['db'];var config=require(_0xf195('0x6'));var pm2=require(_0xf195('0x7'));var logger=require(_0xf195('0x8'))(_0xf195('0x9'));var git=require(_0xf195('0xa'))(config[_0xf195('0xb')]);exports['index']=function(_0x5eac33,_0x327cc3){var _0x15d465={'current':module[_0xf195('0xc')][_0xf195('0x3')],'phonebar':0x2};if(_0x5eac33[_0xf195('0xd')]&&_0x5eac33[_0xf195('0xd')][_0xf195('0xe')]){return git['fetch']()[_0xf195('0xf')](function(_0x384680,_0x15ee9e){_0x15d465['latest']=(_0x384680?module[_0xf195('0xc')][_0xf195('0x3')]:_0x15ee9e[_0xf195('0xe')])||_0xf195('0x10');return _0x327cc3['status'](0xc8)[_0xf195('0x11')](_0x15d465);});}else{return _0x327cc3[_0xf195('0x12')](0xc8)['json'](_0x15d465);}};exports[_0xf195('0x13')]=function(_0x5db10b,_0x3d06cc){return git[_0xf195('0x13')]([_0xf195('0x14'),_0xf195('0x15')],function(_0x27ac95){if(_0x27ac95){logger[_0xf195('0x16')](_0x27ac95);return _0x3d06cc[_0xf195('0x12')](0x1f4)[_0xf195('0x11')](_0x27ac95);}logger['info']('git\x20fetch');return _0x3d06cc[_0xf195('0x12')](0xc8)[_0xf195('0x11')]({'output':_0xf195('0x17')});});};exports[_0xf195('0x18')]=function(_0x52b7c1,_0x374fc6){return git[_0xf195('0x18')](['--hard',_0xf195('0x19')],function(_0x2c6bfd){if(_0x2c6bfd){logger['error'](_0x2c6bfd);return _0x374fc6[_0xf195('0x12')](0x1f4)[_0xf195('0x11')](_0x2c6bfd);}logger['info'](_0xf195('0x1a'));return _0x374fc6[_0xf195('0x12')](0xc8)[_0xf195('0x11')]({'output':_0xf195('0x1b')});});};exports['pull']=function(_0x5933f0,_0x5cfc82){exec(_0xf195('0x1c'),function(_0x1b2821,_0x388c36,_0x785aae){logger[_0xf195('0x1d')](_0x388c36);logger[_0xf195('0x1d')](_0x785aae);if(_0x1b2821){logger[_0xf195('0x16')](_0x1b2821);return _0x5cfc82[_0xf195('0x12')](0x1f4)[_0xf195('0x11')](_0x1b2821);}return _0x5cfc82[_0xf195('0x12')](0xc8)[_0xf195('0x11')]({'output':_0x388c36});});};exports[_0xf195('0x1e')]=function(_0x4fc393,_0x3a0ad3){return pm2[_0xf195('0x1e')](_0xf195('0x1f'))[_0xf195('0x20')](function(_0x221439){logger[_0xf195('0x1d')](_0xf195('0x21'),_0x221439);return _0x3a0ad3[_0xf195('0x12')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xf195('0x22')](function(_0x37d9e9){logger[_0xf195('0x16')](_0x37d9e9);return _0x3a0ad3[_0xf195('0x12')](0x1f4)[_0xf195('0x11')](_0x37d9e9);});};exports[_0xf195('0x23')]=function(_0x408e3b,_0x3c592e){var _0x5dbca=fs[_0xf195('0x24')](path[_0xf195('0x25')](config[_0xf195('0xb')],_0xf195('0x26'),_0xf195('0x23')));var _0xdb8e93=[];for(var _0x245a06=0x0;_0x245a06<_0x5dbca[_0xf195('0x27')];_0x245a06++){var _0x26f511=_0x5dbca[_0x245a06][_0xf195('0x28')]('.js','');if(compareVersions(module[_0xf195('0xc')][_0xf195('0x3')],_0x26f511)===-0x1){_0xdb8e93[_0xf195('0x29')](_0x26f511);}}if(_0xdb8e93[_0xf195('0x27')]){var _0x31c7ca=_0xdb8e93[_0xf195('0x2a')](compareVersions);var _0x12b169=new Umzug({'storage':_0xf195('0x2b'),'storageOptions':{'model':db[_0xf195('0x2c')],'modelName':_0xf195('0x2c'),'columnName':_0xf195('0x3')},'migrations':{'params':[db[_0xf195('0x2b')][_0xf195('0x2d')](),db[_0xf195('0x2b')][_0xf195('0x2e')],function(){throw new Error(_0xf195('0x2f'));}],'path':path[_0xf195('0x25')](config['root'],_0xf195('0x26'),_0xf195('0x23')),'pattern':/\.js$/}});_0x12b169['up']({'migrations':_[_0xf195('0x30')](_0x31c7ca,function(_0xc0a617){return _0xc0a617+_0xf195('0x31');})})['then'](function(){return _0x3c592e[_0xf195('0x12')](0xc8)[_0xf195('0x11')]({'output':_0xf195('0x32')+module['exports']['version']+_0xf195('0x33')+_[_0xf195('0x34')](_0x31c7ca),'migrations':_[_0xf195('0x25')](_0x31c7ca)});})[_0xf195('0x22')](function(_0x1bb7a3){if(_0x1bb7a3 instanceof db[_0xf195('0x2b')][_0xf195('0x35')]){return _0x3c592e[_0xf195('0x12')](0xc8)[_0xf195('0x11')]({'output':_0xf195('0x36')});}else{return _0x3c592e['status'](0x1f4)['json'](_0x1bb7a3);}});}else{return _0x3c592e[_0xf195('0x12')](0xc8)[_0xf195('0x11')]({'output':_0xf195('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 58b6be1..732cc7f 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 _0x2038=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x215719,_0x382905){var _0x2ea1b6=function(_0x5c91d7){while(--_0x5c91d7){_0x215719['push'](_0x215719['shift']());}};_0x2ea1b6(++_0x382905);}(_0x2038,0xbc));var _0x8203=function(_0x1708c5,_0x3ed4a9){_0x1708c5=_0x1708c5-0x0;var _0x4080c8=_0x2038[_0x1708c5];return _0x4080c8;};'use strict';var multer=require(_0x8203('0x0'));var util=require(_0x8203('0x1'));var path=require('path');var timeout=require(_0x8203('0x2'));var express=require(_0x8203('0x3'));var router=express[_0x8203('0x4')]();var auth=require(_0x8203('0x5'));var interaction=require(_0x8203('0x6'));var config=require(_0x8203('0x7'));var controller=require(_0x8203('0x8'));router[_0x8203('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8203('0x9')](_0x8203('0xa'),auth[_0x8203('0xb')](),controller[_0x8203('0xc')]);router[_0x8203('0x9')](_0x8203('0xd'),auth[_0x8203('0xb')](),controller[_0x8203('0xe')]);router[_0x8203('0xf')]('/',auth[_0x8203('0xb')](),controller[_0x8203('0x10')]);router[_0x8203('0x11')](_0x8203('0xd'),auth[_0x8203('0xb')](),controller['update']);router[_0x8203('0x12')](_0x8203('0xd'),auth[_0x8203('0xb')](),controller[_0x8203('0x13')]);module[_0x8203('0x14')]=router; \ No newline at end of file +var _0xb4b1=['describe','/:id','show','post','create','put','update','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x40e12a,_0x18c356){var _0x731ec9=function(_0x5b745f){while(--_0x5b745f){_0x40e12a['push'](_0x40e12a['shift']());}};_0x731ec9(++_0x18c356);}(_0xb4b1,0x128));var _0x1b4b=function(_0x40a51a,_0x1451c8){_0x40a51a=_0x40a51a-0x0;var _0x2adeb3=_0xb4b1[_0x40a51a];return _0x2adeb3;};'use strict';var multer=require(_0x1b4b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1b4b('0x1'));var express=require(_0x1b4b('0x2'));var router=express[_0x1b4b('0x3')]();var auth=require(_0x1b4b('0x4'));var interaction=require(_0x1b4b('0x5'));var config=require('../../config/environment');var controller=require(_0x1b4b('0x6'));router[_0x1b4b('0x7')]('/',auth[_0x1b4b('0x8')](),controller[_0x1b4b('0x9')]);router[_0x1b4b('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x1b4b('0xa')]);router[_0x1b4b('0x7')](_0x1b4b('0xb'),auth[_0x1b4b('0x8')](),controller[_0x1b4b('0xc')]);router[_0x1b4b('0xd')]('/',auth[_0x1b4b('0x8')](),controller[_0x1b4b('0xe')]);router[_0x1b4b('0xf')]('/:id',auth[_0x1b4b('0x8')](),controller[_0x1b4b('0x10')]);router['delete'](_0x1b4b('0xb'),auth[_0x1b4b('0x8')](),controller['destroy']);module[_0x1b4b('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 0819a40..1a2f92d 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 _0x6aa7=['BOOLEAN','sequelize','STRING','DATE','INTEGER'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6aa7,0x178));var _0x76aa=function(_0x52f8f2,_0x4656e0){_0x52f8f2=_0x52f8f2-0x0;var _0x20b88c=_0x6aa7[_0x52f8f2];return _0x20b88c;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'type':{'type':Sequelize[_0x76aa('0x1')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize[_0x76aa('0x1')]},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x76aa('0x1')]},'membername':{'type':Sequelize[_0x76aa('0x1')]},'agentcalledAt':{'type':Sequelize[_0x76aa('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x76aa('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x76aa('0x3')]},'agentcomplete':{'type':Sequelize[_0x76aa('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x76aa('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x76aa('0x3')]},'agentacw':{'type':Sequelize[_0x76aa('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x76aa('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x3')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize[_0x76aa('0x1')]},'accountcode':{'type':Sequelize[_0x76aa('0x1')]},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize[_0x76aa('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x76aa('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x76aa('0x1')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x76aa('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x76aa('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x76aa('0x1')]},'transferuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'agententerreason':{'type':Sequelize[_0x76aa('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb4c7=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0xe7d07d,_0x52e4e3){var _0x229e46=function(_0x376839){while(--_0x376839){_0xe7d07d['push'](_0xe7d07d['shift']());}};_0x229e46(++_0x52e4e3);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x318ee7,_0x496097){_0x318ee7=_0x318ee7-0x0;var _0x363574=_0xb4c7[_0x318ee7];return _0x363574;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'type':{'type':Sequelize[_0x7b4c('0x2')]},'uniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'calleridnum':{'type':Sequelize[_0x7b4c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7b4c('0x2')]},'interface':{'type':Sequelize[_0x7b4c('0x2')]},'membername':{'type':Sequelize[_0x7b4c('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7b4c('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7b4c('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x7b4c('0x3')]},'agentdumpAt':{'type':Sequelize[_0x7b4c('0x3')]},'holdtime':{'type':Sequelize[_0x7b4c('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7b4c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7b4c('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x7b4c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7b4c('0x4')]},'reason':{'type':Sequelize[_0x7b4c('0x2')]},'lastevent':{'type':Sequelize[_0x7b4c('0x2')]},'channel':{'type':Sequelize[_0x7b4c('0x2')]},'channelstate':{'type':Sequelize[_0x7b4c('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7b4c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b4c('0x2')]},'connectedlinename':{'type':Sequelize[_0x7b4c('0x2')]},'language':{'type':Sequelize[_0x7b4c('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7b4c('0x2')]},'priority':{'type':Sequelize[_0x7b4c('0x2')]},'destchannel':{'type':Sequelize[_0x7b4c('0x2')]},'destchannelstate':{'type':Sequelize[_0x7b4c('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7b4c('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7b4c('0x2')]},'destcalleridname':{'type':Sequelize[_0x7b4c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7b4c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7b4c('0x2')]},'destlanguage':{'type':Sequelize[_0x7b4c('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x7b4c('0x2')]},'destexten':{'type':Sequelize[_0x7b4c('0x2')]},'destpriority':{'type':Sequelize[_0x7b4c('0x2')]},'destuniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7b4c('0x2')]},'transfer':{'type':Sequelize[_0x7b4c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7b4c('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7b4c('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'agententerreason':{'type':Sequelize[_0x7b4c('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 24d4cf7..6b5386c 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 _0xd73a=['stack','name','send','map','VoiceAgentReport','rawAttributes','fieldName','type','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','end','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd73a,0xb6));var _0xad73=function(_0x2f3fd7,_0x5aeb1b){_0x2f3fd7=_0x2f3fd7-0x0;var _0x44bbb9=_0xd73a[_0x2f3fd7];return _0x44bbb9;};'use strict';var pdf=require(_0xad73('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xad73('0x1'));var zipdir=require(_0xad73('0x2'));var jsonpatch=require(_0xad73('0x3'));var rp=require(_0xad73('0x4'));var moment=require('moment');var BPromise=require(_0xad73('0x5'));var Mustache=require(_0xad73('0x6'));var util=require(_0xad73('0x7'));var path=require('path');var sox=require(_0xad73('0x8'));var csv=require(_0xad73('0x9'));var ejs=require(_0xad73('0xa'));var fs=require('fs');var _=require(_0xad73('0xb'));var squel=require('squel');var crypto=require(_0xad73('0xc'));var jsforce=require(_0xad73('0xd'));var deskjs=require(_0xad73('0xe'));var toCsv=require(_0xad73('0x9'));var querystring=require(_0xad73('0xf'));var Papa=require(_0xad73('0x10'));var Redis=require(_0xad73('0x11'));var authService=require(_0xad73('0x12'));var qs=require(_0xad73('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad73('0x14'));var logger=require(_0xad73('0x15'))(_0xad73('0x16'));var utils=require(_0xad73('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad73('0x18'))['db'];function respondWithStatusCode(_0x3ebf32,_0x5021e8){_0x5021e8=_0x5021e8||0xcc;return function(_0x3e92f2){if(_0x3e92f2){return _0x3ebf32[_0xad73('0x19')](_0x5021e8);}return _0x3ebf32[_0xad73('0x1a')](_0x5021e8)['end']();};}function respondWithResult(_0xc04f07,_0x3fc06c){_0x3fc06c=_0x3fc06c||0xc8;return function(_0x432b29){if(_0x432b29){return _0xc04f07[_0xad73('0x1a')](_0x3fc06c)['json'](_0x432b29);}};}function respondWithFilteredResult(_0x931fd6,_0x54aa4e){return function(_0x34b1e5){if(_0x34b1e5){var _0x5393b6=_0x34b1e5[_0xad73('0x1b')],_0xdfa67f=_0x54aa4e[_0xad73('0x1c')],_0x3432b8=_0x54aa4e['offset']+_0x54aa4e[_0xad73('0x1d')],_0x479bc2;if(_0x3432b8>=_0x5393b6){_0x3432b8=_0x5393b6;_0x479bc2=0xc8;}else{_0x479bc2=0xce;}_0x931fd6[_0xad73('0x1a')](_0x479bc2);return _0x931fd6[_0xad73('0x1e')](_0xad73('0x1f'),_0xdfa67f+'-'+_0x3432b8+'/'+_0x5393b6)[_0xad73('0x20')](_0x34b1e5);}return null;};}function patchUpdates(_0x408ae2){return function(_0x356fd9){try{jsonpatch[_0xad73('0x21')](_0x356fd9,_0x408ae2,!![]);}catch(_0x11b671){return BPromise[_0xad73('0x22')](_0x11b671);}return _0x356fd9['save']();};}function saveUpdates(_0x3c2619,_0x440b68){return function(_0x503ed1){if(_0x503ed1){return _0x503ed1[_0xad73('0x23')](_0x3c2619)[_0xad73('0x24')](function(_0x1439cf){return _0x1439cf;});}return null;};}function removeEntity(_0x31c594,_0x5ad2dd){return function(_0x399dce){if(_0x399dce){return _0x399dce[_0xad73('0x25')]()[_0xad73('0x24')](function(){_0x31c594[_0xad73('0x1a')](0xcc)[_0xad73('0x26')]();});}};}function handleEntityNotFound(_0x1c3a82,_0x2d7cea){return function(_0x260cac){if(!_0x260cac){_0x1c3a82[_0xad73('0x19')](0x194);}return _0x260cac;};}function handleError(_0x5e20e5,_0x102956){_0x102956=_0x102956||0x1f4;return function(_0x21b4ac){logger[_0xad73('0x27')](_0x21b4ac[_0xad73('0x28')]);if(_0x21b4ac['name']){delete _0x21b4ac[_0xad73('0x29')];}_0x5e20e5[_0xad73('0x1a')](_0x102956)[_0xad73('0x2a')](_0x21b4ac);};}exports['index']=function(_0x4125b2,_0x1dec85){var _0x1a850b={},_0x21eb62={},_0x5383de={'count':0x0,'rows':[]};var _0x31aa36=_[_0xad73('0x2b')](db[_0xad73('0x2c')][_0xad73('0x2d')],function(_0x5e7297){return{'name':_0x5e7297[_0xad73('0x2e')],'type':_0x5e7297[_0xad73('0x2f')]['key']};});_0x21eb62['model']=_[_0xad73('0x2b')](_0x31aa36,_0xad73('0x29'));_0x21eb62['query']=_[_0xad73('0x30')](_0x4125b2[_0xad73('0x31')]);_0x21eb62['filters']=_[_0xad73('0x32')](_0x21eb62['model'],_0x21eb62[_0xad73('0x31')]);_0x1a850b[_0xad73('0x33')]=_[_0xad73('0x32')](_0x21eb62[_0xad73('0x34')],qs[_0xad73('0x35')](_0x4125b2[_0xad73('0x31')][_0xad73('0x35')]));_0x1a850b[_0xad73('0x33')]=_0x1a850b['attributes'][_0xad73('0x36')]?_0x1a850b[_0xad73('0x33')]:_0x21eb62[_0xad73('0x34')];if(!_0x4125b2[_0xad73('0x31')][_0xad73('0x37')](_0xad73('0x38'))){_0x1a850b['limit']=qs['limit'](_0x4125b2[_0xad73('0x31')][_0xad73('0x1d')]);_0x1a850b[_0xad73('0x1c')]=qs['offset'](_0x4125b2['query'][_0xad73('0x1c')]);}_0x1a850b[_0xad73('0x39')]=qs[_0xad73('0x3a')](_0x4125b2['query'][_0xad73('0x3a')]);_0x1a850b[_0xad73('0x3b')]=qs['filters'](_['pick'](_0x4125b2[_0xad73('0x31')],_0x21eb62[_0xad73('0x3c')]),_0x31aa36);if(_0x4125b2[_0xad73('0x31')]['filter']){_0x1a850b[_0xad73('0x3b')]=_[_0xad73('0x3d')](_0x1a850b[_0xad73('0x3b')],{'$or':_[_0xad73('0x2b')](_0x31aa36,function(_0x1da12a){if(_0x1da12a[_0xad73('0x2f')]!==_0xad73('0x3e')){var _0x43b56c={};_0x43b56c[_0x1da12a[_0xad73('0x29')]]={'$like':'%'+_0x4125b2[_0xad73('0x31')][_0xad73('0x3f')]+'%'};return _0x43b56c;}})});}_0x1a850b=_[_0xad73('0x3d')]({},_0x1a850b,_0x4125b2['options']);var _0x53c1af={'where':_0x1a850b['where']};return db[_0xad73('0x2c')][_0xad73('0x1b')](_0x53c1af)[_0xad73('0x24')](function(_0x38301c){_0x5383de[_0xad73('0x1b')]=_0x38301c;if(_0x4125b2['query'][_0xad73('0x40')]){_0x1a850b[_0xad73('0x41')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0xad73('0x42')](_0x1a850b);})['then'](function(_0x46c9a6){_0x5383de['rows']=_0x46c9a6;return _0x5383de;})['then'](respondWithFilteredResult(_0x1dec85,_0x1a850b))[_0xad73('0x43')](handleError(_0x1dec85,null));};exports[_0xad73('0x44')]=function(_0x15d271,_0x282f2c){var _0x246ca2={'raw':![],'where':{'id':_0x15d271[_0xad73('0x45')]['id']}},_0x5d4e1f={};_0x5d4e1f[_0xad73('0x34')]=_[_0xad73('0x30')](db[_0xad73('0x2c')][_0xad73('0x2d')]);_0x5d4e1f[_0xad73('0x31')]=_[_0xad73('0x30')](_0x15d271['query']);_0x5d4e1f[_0xad73('0x3c')]=_[_0xad73('0x32')](_0x5d4e1f[_0xad73('0x34')],_0x5d4e1f[_0xad73('0x31')]);_0x246ca2['attributes']=_[_0xad73('0x32')](_0x5d4e1f[_0xad73('0x34')],qs[_0xad73('0x35')](_0x15d271[_0xad73('0x31')][_0xad73('0x35')]));_0x246ca2[_0xad73('0x33')]=_0x246ca2['attributes'][_0xad73('0x36')]?_0x246ca2[_0xad73('0x33')]:_0x5d4e1f['model'];if(_0x15d271[_0xad73('0x31')][_0xad73('0x40')]){_0x246ca2[_0xad73('0x41')]=[{'all':!![]}];}_0x246ca2=_[_0xad73('0x3d')]({},_0x246ca2,_0x15d271['options']);return db[_0xad73('0x2c')][_0xad73('0x46')](_0x246ca2)['then'](handleEntityNotFound(_0x282f2c,null))[_0xad73('0x24')](respondWithResult(_0x282f2c,null))[_0xad73('0x43')](handleError(_0x282f2c,null));};exports[_0xad73('0x47')]=function(_0x372665,_0x3b7f90){return db['VoiceAgentReport'][_0xad73('0x47')](_0x372665[_0xad73('0x48')],{})[_0xad73('0x24')](respondWithResult(_0x3b7f90,0xc9))['catch'](handleError(_0x3b7f90,null));};exports[_0xad73('0x23')]=function(_0x8b276,_0x18cee4){if(_0x8b276[_0xad73('0x48')]['id']){delete _0x8b276['body']['id'];}return db[_0xad73('0x2c')]['find']({'where':{'id':_0x8b276[_0xad73('0x45')]['id']}})[_0xad73('0x24')](handleEntityNotFound(_0x18cee4,null))[_0xad73('0x24')](saveUpdates(_0x8b276[_0xad73('0x48')],null))[_0xad73('0x24')](respondWithResult(_0x18cee4,null))['catch'](handleError(_0x18cee4,null));};exports[_0xad73('0x25')]=function(_0x6204b1,_0x5820e4){return db[_0xad73('0x2c')][_0xad73('0x46')]({'where':{'id':_0x6204b1[_0xad73('0x45')]['id']}})[_0xad73('0x24')](handleEntityNotFound(_0x5820e4,null))[_0xad73('0x24')](removeEntity(_0x5820e4,null))[_0xad73('0x43')](handleError(_0x5820e4,null));};exports[_0xad73('0x49')]=function(_0x99289d,_0x148c5c){return db['VoiceAgentReport'][_0xad73('0x49')]()[_0xad73('0x24')](respondWithResult(_0x148c5c,null))[_0xad73('0x43')](handleError(_0x148c5c,null));}; \ No newline at end of file +var _0x8e58=['moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','VoiceAgentReport','rows','show','params','keys','includeAll','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise'];(function(_0x5c5d9f,_0x2603cb){var _0xfb5de9=function(_0x8e829a){while(--_0x8e829a){_0x5c5d9f['push'](_0x5c5d9f['shift']());}};_0xfb5de9(++_0x2603cb);}(_0x8e58,0x1b2));var _0x88e5=function(_0x5c8441,_0x330f9f){_0x5c8441=_0x5c8441-0x0;var _0x5e4c90=_0x8e58[_0x5c8441];return _0x5e4c90;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x88e5('0x0'));var rimraf=require(_0x88e5('0x1'));var zipdir=require(_0x88e5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x88e5('0x3'));var moment=require(_0x88e5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x88e5('0x5'));var path=require(_0x88e5('0x6'));var sox=require(_0x88e5('0x7'));var csv=require(_0x88e5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x88e5('0x9'));var squel=require(_0x88e5('0xa'));var crypto=require(_0x88e5('0xb'));var jsforce=require(_0x88e5('0xc'));var deskjs=require(_0x88e5('0xd'));var toCsv=require(_0x88e5('0x8'));var querystring=require('querystring');var Papa=require(_0x88e5('0xe'));var Redis=require(_0x88e5('0xf'));var authService=require(_0x88e5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88e5('0x11'));var logger=require(_0x88e5('0x12'))('api');var utils=require(_0x88e5('0x13'));var config=require(_0x88e5('0x14'));var licenseUtil=require(_0x88e5('0x15'));var db=require(_0x88e5('0x16'))['db'];function respondWithStatusCode(_0x3da634,_0x12b15a){_0x12b15a=_0x12b15a||0xcc;return function(_0x382f2d){if(_0x382f2d){return _0x3da634[_0x88e5('0x17')](_0x12b15a);}return _0x3da634[_0x88e5('0x18')](_0x12b15a)[_0x88e5('0x19')]();};}function respondWithResult(_0x82150f,_0x12b629){_0x12b629=_0x12b629||0xc8;return function(_0x3c3aab){if(_0x3c3aab){return _0x82150f['status'](_0x12b629)['json'](_0x3c3aab);}};}function respondWithFilteredResult(_0x1eb0da,_0x5ca20b){return function(_0x23e769){if(_0x23e769){var _0x218e54=_0x23e769[_0x88e5('0x1a')],_0x4f7023=_0x5ca20b[_0x88e5('0x1b')],_0x21bf23=_0x5ca20b['offset']+_0x5ca20b[_0x88e5('0x1c')],_0x8c6470;if(_0x21bf23>=_0x218e54){_0x21bf23=_0x218e54;_0x8c6470=0xc8;}else{_0x8c6470=0xce;}_0x1eb0da[_0x88e5('0x18')](_0x8c6470);return _0x1eb0da[_0x88e5('0x1d')]('Content-Range',_0x4f7023+'-'+_0x21bf23+'/'+_0x218e54)[_0x88e5('0x1e')](_0x23e769);}return null;};}function patchUpdates(_0x1cbdd8){return function(_0x30e947){try{jsonpatch[_0x88e5('0x1f')](_0x30e947,_0x1cbdd8,!![]);}catch(_0x517ea1){return BPromise[_0x88e5('0x20')](_0x517ea1);}return _0x30e947['save']();};}function saveUpdates(_0x30dce2,_0x1c1f6c){return function(_0xca8305){if(_0xca8305){return _0xca8305[_0x88e5('0x21')](_0x30dce2)[_0x88e5('0x22')](function(_0x1e1eb1){return _0x1e1eb1;});}return null;};}function removeEntity(_0x58f444,_0x54e7e6){return function(_0x5ee4d3){if(_0x5ee4d3){return _0x5ee4d3[_0x88e5('0x23')]()['then'](function(){_0x58f444[_0x88e5('0x18')](0xcc)[_0x88e5('0x19')]();});}};}function handleEntityNotFound(_0x2f2043,_0x347af7){return function(_0x267d43){if(!_0x267d43){_0x2f2043[_0x88e5('0x17')](0x194);}return _0x267d43;};}function handleError(_0x147a5a,_0x212174){_0x212174=_0x212174||0x1f4;return function(_0x41eedb){logger[_0x88e5('0x24')](_0x41eedb[_0x88e5('0x25')]);if(_0x41eedb[_0x88e5('0x26')]){delete _0x41eedb['name'];}_0x147a5a[_0x88e5('0x18')](_0x212174)[_0x88e5('0x27')](_0x41eedb);};}exports[_0x88e5('0x28')]=function(_0x42273b,_0x46eb2c){var _0xf72cd5={},_0x3e30ca={},_0x291b39={'count':0x0,'rows':[]};var _0x1f3d9d=_[_0x88e5('0x29')](db['VoiceAgentReport'][_0x88e5('0x2a')],function(_0xe6642a){return{'name':_0xe6642a['fieldName'],'type':_0xe6642a[_0x88e5('0x2b')][_0x88e5('0x2c')]};});_0x3e30ca['model']=_[_0x88e5('0x29')](_0x1f3d9d,_0x88e5('0x26'));_0x3e30ca[_0x88e5('0x2d')]=_['keys'](_0x42273b[_0x88e5('0x2d')]);_0x3e30ca['filters']=_[_0x88e5('0x2e')](_0x3e30ca[_0x88e5('0x2f')],_0x3e30ca['query']);_0xf72cd5[_0x88e5('0x30')]=_['intersection'](_0x3e30ca[_0x88e5('0x2f')],qs[_0x88e5('0x31')](_0x42273b[_0x88e5('0x2d')][_0x88e5('0x31')]));_0xf72cd5['attributes']=_0xf72cd5[_0x88e5('0x30')][_0x88e5('0x32')]?_0xf72cd5[_0x88e5('0x30')]:_0x3e30ca[_0x88e5('0x2f')];if(!_0x42273b[_0x88e5('0x2d')][_0x88e5('0x33')](_0x88e5('0x34'))){_0xf72cd5[_0x88e5('0x1c')]=qs[_0x88e5('0x1c')](_0x42273b[_0x88e5('0x2d')][_0x88e5('0x1c')]);_0xf72cd5[_0x88e5('0x1b')]=qs['offset'](_0x42273b[_0x88e5('0x2d')][_0x88e5('0x1b')]);}_0xf72cd5[_0x88e5('0x35')]=qs[_0x88e5('0x36')](_0x42273b[_0x88e5('0x2d')][_0x88e5('0x36')]);_0xf72cd5[_0x88e5('0x37')]=qs[_0x88e5('0x38')](_[_0x88e5('0x39')](_0x42273b[_0x88e5('0x2d')],_0x3e30ca[_0x88e5('0x38')]),_0x1f3d9d);if(_0x42273b[_0x88e5('0x2d')][_0x88e5('0x3a')]){_0xf72cd5[_0x88e5('0x37')]=_[_0x88e5('0x3b')](_0xf72cd5[_0x88e5('0x37')],{'$or':_[_0x88e5('0x29')](_0x1f3d9d,function(_0x319664){if(_0x319664['type']!=='VIRTUAL'){var _0x1e000c={};_0x1e000c[_0x319664[_0x88e5('0x26')]]={'$like':'%'+_0x42273b[_0x88e5('0x2d')]['filter']+'%'};return _0x1e000c;}})});}_0xf72cd5=_[_0x88e5('0x3b')]({},_0xf72cd5,_0x42273b[_0x88e5('0x3c')]);var _0x2b0782={'where':_0xf72cd5['where']};return db[_0x88e5('0x3d')][_0x88e5('0x1a')](_0x2b0782)['then'](function(_0x69c39e){_0x291b39['count']=_0x69c39e;if(_0x42273b[_0x88e5('0x2d')]['includeAll']){_0xf72cd5['include']=[{'all':!![]}];}return db[_0x88e5('0x3d')]['findAll'](_0xf72cd5);})[_0x88e5('0x22')](function(_0x3505ba){_0x291b39[_0x88e5('0x3e')]=_0x3505ba;return _0x291b39;})[_0x88e5('0x22')](respondWithFilteredResult(_0x46eb2c,_0xf72cd5))['catch'](handleError(_0x46eb2c,null));};exports[_0x88e5('0x3f')]=function(_0x32f20d,_0x5fed4f){var _0x11736b={'raw':![],'where':{'id':_0x32f20d[_0x88e5('0x40')]['id']}},_0x5e36b2={};_0x5e36b2[_0x88e5('0x2f')]=_[_0x88e5('0x41')](db[_0x88e5('0x3d')]['rawAttributes']);_0x5e36b2[_0x88e5('0x2d')]=_['keys'](_0x32f20d[_0x88e5('0x2d')]);_0x5e36b2['filters']=_[_0x88e5('0x2e')](_0x5e36b2['model'],_0x5e36b2[_0x88e5('0x2d')]);_0x11736b[_0x88e5('0x30')]=_[_0x88e5('0x2e')](_0x5e36b2[_0x88e5('0x2f')],qs[_0x88e5('0x31')](_0x32f20d[_0x88e5('0x2d')][_0x88e5('0x31')]));_0x11736b[_0x88e5('0x30')]=_0x11736b[_0x88e5('0x30')][_0x88e5('0x32')]?_0x11736b['attributes']:_0x5e36b2[_0x88e5('0x2f')];if(_0x32f20d[_0x88e5('0x2d')][_0x88e5('0x42')]){_0x11736b[_0x88e5('0x43')]=[{'all':!![]}];}_0x11736b=_[_0x88e5('0x3b')]({},_0x11736b,_0x32f20d['options']);return db[_0x88e5('0x3d')][_0x88e5('0x44')](_0x11736b)[_0x88e5('0x22')](handleEntityNotFound(_0x5fed4f,null))[_0x88e5('0x22')](respondWithResult(_0x5fed4f,null))[_0x88e5('0x45')](handleError(_0x5fed4f,null));};exports[_0x88e5('0x46')]=function(_0xc63e8b,_0x149098){return db[_0x88e5('0x3d')][_0x88e5('0x46')](_0xc63e8b['body'],{})[_0x88e5('0x22')](respondWithResult(_0x149098,0xc9))[_0x88e5('0x45')](handleError(_0x149098,null));};exports[_0x88e5('0x21')]=function(_0xc4e361,_0x469acd){if(_0xc4e361['body']['id']){delete _0xc4e361[_0x88e5('0x47')]['id'];}return db[_0x88e5('0x3d')][_0x88e5('0x44')]({'where':{'id':_0xc4e361[_0x88e5('0x40')]['id']}})[_0x88e5('0x22')](handleEntityNotFound(_0x469acd,null))[_0x88e5('0x22')](saveUpdates(_0xc4e361[_0x88e5('0x47')],null))[_0x88e5('0x22')](respondWithResult(_0x469acd,null))['catch'](handleError(_0x469acd,null));};exports[_0x88e5('0x23')]=function(_0x42ad61,_0xb09fc7){return db[_0x88e5('0x3d')][_0x88e5('0x44')]({'where':{'id':_0x42ad61[_0x88e5('0x40')]['id']}})['then'](handleEntityNotFound(_0xb09fc7,null))[_0x88e5('0x22')](removeEntity(_0xb09fc7,null))[_0x88e5('0x45')](handleError(_0xb09fc7,null));};exports['describe']=function(_0x1f63d9,_0x2495a3){return db[_0x88e5('0x3d')][_0x88e5('0x48')]()[_0x88e5('0x22')](respondWithResult(_0x2495a3,null))[_0x88e5('0x45')](handleError(_0x2495a3,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index f8f1d70..e19aa06 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 _0x6bfc=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x44d965,_0x7ecd85){var _0x5b40ab=function(_0x40853b){while(--_0x40853b){_0x44d965['push'](_0x44d965['shift']());}};_0x5b40ab(++_0x7ecd85);}(_0x6bfc,0x159));var _0xc6bf=function(_0x2bc9c1,_0x402d7b){_0x2bc9c1=_0x2bc9c1-0x0;var _0x597ac9=_0x6bfc[_0x2bc9c1];return _0x597ac9;};'use strict';var _=require('lodash');var util=require(_0xc6bf('0x0'));var logger=require(_0xc6bf('0x1'))(_0xc6bf('0x2'));var moment=require('moment');var BPromise=require(_0xc6bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6bf('0x4'));var rimraf=require('rimraf');var config=require(_0xc6bf('0x5'));var attributes=require(_0xc6bf('0x6'));module[_0xc6bf('0x7')]=function(_0x4a999e,_0x27a5d9){return _0x4a999e[_0xc6bf('0x8')](_0xc6bf('0x9'),attributes,{'tableName':_0xc6bf('0xa'),'paranoid':![],'indexes':[{'fields':[_0xc6bf('0xb'),_0xc6bf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe397=['define','VoiceAgentReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1b6563,_0x3bf0f1){var _0xdea7b8=function(_0x49e6c6){while(--_0x49e6c6){_0x1b6563['push'](_0x1b6563['shift']());}};_0xdea7b8(++_0x3bf0f1);}(_0xe397,0xac));var _0x7e39=function(_0xddeac9,_0x2ebf8c){_0xddeac9=_0xddeac9-0x0;var _0x65fa72=_0xe397[_0xddeac9];return _0x65fa72;};'use strict';var _=require(_0x7e39('0x0'));var util=require(_0x7e39('0x1'));var logger=require(_0x7e39('0x2'))('api');var moment=require(_0x7e39('0x3'));var BPromise=require(_0x7e39('0x4'));var rp=require(_0x7e39('0x5'));var fs=require('fs');var path=require(_0x7e39('0x6'));var rimraf=require(_0x7e39('0x7'));var config=require(_0x7e39('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x7e39('0x9')]=function(_0x55b365,_0x21e4df){return _0x55b365[_0x7e39('0xa')](_0x7e39('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x7e39('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 3f34a83..ce45dfa 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 _0x1c77=['info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','debug','UpdateVoiceAgentReport','update','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x1c77,0xb9));var _0x71c7=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x1c77[_0x284807];return _0x50c774;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x71c7('0x0'));var BPromise=require(_0x71c7('0x1'));var rs=require(_0x71c7('0x2'));var fs=require('fs');var Redis=require(_0x71c7('0x3'));var db=require(_0x71c7('0x4'))['db'];var utils=require(_0x71c7('0x5'));var logger=require(_0x71c7('0x6'))(_0x71c7('0x7'));var config=require(_0x71c7('0x8'));var jayson=require(_0x71c7('0x9'));var client=jayson[_0x71c7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x504b96,_0x2beaad,_0xbb45e6){return new BPromise(function(_0x24a723,_0x2627cd){return client[_0x71c7('0xb')](_0x504b96,_0xbb45e6)[_0x71c7('0xc')](function(_0x1119a0){logger[_0x71c7('0xd')](_0x71c7('0xe'),_0x2beaad,_0x71c7('0xf'));logger['debug'](_0x71c7('0x10'),_0x2beaad,_0x71c7('0xf'),JSON[_0x71c7('0x11')](_0x1119a0));if(_0x1119a0[_0x71c7('0x12')]){if(_0x1119a0[_0x71c7('0x12')]['code']===0x1f4){logger[_0x71c7('0x12')](_0x71c7('0xe'),_0x2beaad,_0x1119a0[_0x71c7('0x12')][_0x71c7('0x13')]);return _0x2627cd(_0x1119a0[_0x71c7('0x12')][_0x71c7('0x13')]);}logger[_0x71c7('0x12')](_0x71c7('0xe'),_0x2beaad,_0x1119a0[_0x71c7('0x12')][_0x71c7('0x13')]);return _0x24a723(_0x1119a0[_0x71c7('0x12')][_0x71c7('0x13')]);}else{logger[_0x71c7('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x2beaad,'request\x20sent');_0x24a723(_0x1119a0[_0x71c7('0x14')][_0x71c7('0x13')]);}})[_0x71c7('0x15')](function(_0x5c8701){logger[_0x71c7('0x12')](_0x71c7('0xe'),_0x2beaad,_0x5c8701);_0x2627cd(_0x5c8701);});});}exports[_0x71c7('0x16')]=function(_0x3f3cc7){var _0x26eca7=this;return new Promise(function(_0x516c3a,_0x79c2e1){return db[_0x71c7('0x17')][_0x71c7('0x18')](_0x3f3cc7['body'],{'raw':_0x3f3cc7[_0x71c7('0x19')]?_0x3f3cc7[_0x71c7('0x19')][_0x71c7('0x1a')]===undefined?!![]:![]:!![]})[_0x71c7('0xc')](function(_0x27e312){logger[_0x71c7('0xd')](_0x71c7('0x16'),_0x3f3cc7);logger[_0x71c7('0x1b')](_0x71c7('0x16'),_0x3f3cc7,JSON[_0x71c7('0x11')](_0x27e312));_0x516c3a(_0x27e312);})[_0x71c7('0x15')](function(_0x5250a3){logger['error'](_0x71c7('0x16'),_0x5250a3[_0x71c7('0x13')],_0x3f3cc7);_0x79c2e1(_0x26eca7[_0x71c7('0x12')](0x1f4,_0x5250a3[_0x71c7('0x13')]));});});};exports[_0x71c7('0x1c')]=function(_0x2811fe){var _0x52d56f=this;return new Promise(function(_0x1412a5,_0x27da40){return db['VoiceAgentReport'][_0x71c7('0x1d')](_0x2811fe['body'],{'raw':_0x2811fe[_0x71c7('0x19')]?_0x2811fe[_0x71c7('0x19')][_0x71c7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2811fe[_0x71c7('0x19')]?_0x2811fe[_0x71c7('0x19')][_0x71c7('0x1e')]||null:null,'attributes':_0x2811fe[_0x71c7('0x19')]?_0x2811fe['options'][_0x71c7('0x1f')]||null:null,'limit':_0x2811fe[_0x71c7('0x19')]?_0x2811fe[_0x71c7('0x19')][_0x71c7('0x20')]||null:null})[_0x71c7('0xc')](function(_0x1dbf90){logger['info'](_0x71c7('0x1c'),_0x2811fe);logger[_0x71c7('0x1b')]('UpdateVoiceAgentReport',_0x2811fe,JSON['stringify'](_0x1dbf90));_0x1412a5(_0x1dbf90);})[_0x71c7('0x15')](function(_0x324a78){logger['error']('UpdateVoiceAgentReport',_0x324a78[_0x71c7('0x13')],_0x2811fe);_0x27da40(_0x52d56f['error'](0x1f4,_0x324a78[_0x71c7('0x13')]));});});}; \ No newline at end of file +var _0xbb41=['create','body','options','raw','UpdateVoiceAgentReport','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0xbb41,0x1e3));var _0x1bb4=function(_0x3becd2,_0x4a8124){_0x3becd2=_0x3becd2-0x0;var _0x347cd8=_0xbb41[_0x3becd2];return _0x347cd8;};'use strict';var _=require(_0x1bb4('0x0'));var util=require(_0x1bb4('0x1'));var moment=require(_0x1bb4('0x2'));var BPromise=require('bluebird');var rs=require(_0x1bb4('0x3'));var fs=require('fs');var Redis=require(_0x1bb4('0x4'));var db=require(_0x1bb4('0x5'))['db'];var utils=require(_0x1bb4('0x6'));var logger=require(_0x1bb4('0x7'))(_0x1bb4('0x8'));var config=require('../../config/environment');var jayson=require(_0x1bb4('0x9'));var client=jayson[_0x1bb4('0xa')][_0x1bb4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48efd3,_0xd0b04,_0x4dbc1c){return new BPromise(function(_0x1abd6d,_0x1d59e4){return client[_0x1bb4('0xc')](_0x48efd3,_0x4dbc1c)[_0x1bb4('0xd')](function(_0x21770c){logger[_0x1bb4('0xe')](_0x1bb4('0xf'),_0xd0b04,_0x1bb4('0x10'));logger[_0x1bb4('0x11')](_0x1bb4('0x12'),_0xd0b04,_0x1bb4('0x10'),JSON[_0x1bb4('0x13')](_0x21770c));if(_0x21770c[_0x1bb4('0x14')]){if(_0x21770c['error'][_0x1bb4('0x15')]===0x1f4){logger[_0x1bb4('0x14')](_0x1bb4('0xf'),_0xd0b04,_0x21770c[_0x1bb4('0x14')]['message']);return _0x1d59e4(_0x21770c[_0x1bb4('0x14')][_0x1bb4('0x16')]);}logger['error'](_0x1bb4('0xf'),_0xd0b04,_0x21770c[_0x1bb4('0x14')][_0x1bb4('0x16')]);return _0x1abd6d(_0x21770c[_0x1bb4('0x14')][_0x1bb4('0x16')]);}else{logger[_0x1bb4('0xe')](_0x1bb4('0xf'),_0xd0b04,_0x1bb4('0x10'));_0x1abd6d(_0x21770c[_0x1bb4('0x17')]['message']);}})[_0x1bb4('0x18')](function(_0x55e43b){logger[_0x1bb4('0x14')](_0x1bb4('0xf'),_0xd0b04,_0x55e43b);_0x1d59e4(_0x55e43b);});});}exports[_0x1bb4('0x19')]=function(_0x448aa4){var _0x3119dc=this;return new Promise(function(_0x5b08d6,_0x51148e){return db[_0x1bb4('0x1a')][_0x1bb4('0x1b')](_0x448aa4[_0x1bb4('0x1c')],{'raw':_0x448aa4['options']?_0x448aa4[_0x1bb4('0x1d')][_0x1bb4('0x1e')]===undefined?!![]:![]:!![]})[_0x1bb4('0xd')](function(_0x235e14){logger[_0x1bb4('0xe')](_0x1bb4('0x19'),_0x448aa4);logger['debug']('CreateVoiceAgentReport',_0x448aa4,JSON[_0x1bb4('0x13')](_0x235e14));_0x5b08d6(_0x235e14);})['catch'](function(_0x1f4c86){logger[_0x1bb4('0x14')](_0x1bb4('0x19'),_0x1f4c86[_0x1bb4('0x16')],_0x448aa4);_0x51148e(_0x3119dc['error'](0x1f4,_0x1f4c86[_0x1bb4('0x16')]));});});};exports[_0x1bb4('0x1f')]=function(_0x4ab48b){var _0x5eef39=this;return new Promise(function(_0xc1d312,_0x24a10a){return db[_0x1bb4('0x1a')]['update'](_0x4ab48b[_0x1bb4('0x1c')],{'raw':_0x4ab48b[_0x1bb4('0x1d')]?_0x4ab48b[_0x1bb4('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ab48b[_0x1bb4('0x1d')]?_0x4ab48b['options'][_0x1bb4('0x20')]||null:null,'attributes':_0x4ab48b[_0x1bb4('0x1d')]?_0x4ab48b[_0x1bb4('0x1d')][_0x1bb4('0x21')]||null:null,'limit':_0x4ab48b[_0x1bb4('0x1d')]?_0x4ab48b[_0x1bb4('0x1d')]['limit']||null:null})[_0x1bb4('0xd')](function(_0x386b80){logger['info'](_0x1bb4('0x1f'),_0x4ab48b);logger[_0x1bb4('0x11')](_0x1bb4('0x1f'),_0x4ab48b,JSON[_0x1bb4('0x13')](_0x386b80));_0xc1d312(_0x386b80);})['catch'](function(_0xfb9317){logger['error'](_0x1bb4('0x1f'),_0xfb9317[_0x1bb4('0x16')],_0x4ab48b);_0x24a10a(_0x5eef39[_0x1bb4('0x14')](0x1f4,_0xfb9317[_0x1bb4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 6a6119f..a1b94b4 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 _0xd8ed=['get','/describe','describe','/:id','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xd8ed,0x138));var _0xdd8e=function(_0x3743a9,_0x4f7a18){_0x3743a9=_0x3743a9-0x0;var _0x27f95a=_0xd8ed[_0x3743a9];return _0x27f95a;};'use strict';var multer=require(_0xdd8e('0x0'));var util=require(_0xdd8e('0x1'));var path=require(_0xdd8e('0x2'));var timeout=require(_0xdd8e('0x3'));var express=require(_0xdd8e('0x4'));var router=express[_0xdd8e('0x5')]();var auth=require(_0xdd8e('0x6'));var interaction=require(_0xdd8e('0x7'));var config=require(_0xdd8e('0x8'));var controller=require(_0xdd8e('0x9'));router['get']('/',auth[_0xdd8e('0xa')](),controller['index']);router[_0xdd8e('0xb')](_0xdd8e('0xc'),auth[_0xdd8e('0xa')](),controller[_0xdd8e('0xd')]);router[_0xdd8e('0xb')](_0xdd8e('0xe'),auth[_0xdd8e('0xa')](),controller['show']);router[_0xdd8e('0xf')]('/',auth[_0xdd8e('0xa')](),controller['create']);router[_0xdd8e('0x10')](_0xdd8e('0xe'),auth[_0xdd8e('0xa')](),controller[_0xdd8e('0x11')]);router['delete'](_0xdd8e('0xe'),auth[_0xdd8e('0xa')](),controller[_0xdd8e('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe355=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','destroy','exports','multer'];(function(_0x2a6e19,_0x417f92){var _0x2377ea=function(_0x49979c){while(--_0x49979c){_0x2a6e19['push'](_0x2a6e19['shift']());}};_0x2377ea(++_0x417f92);}(_0xe355,0xd0));var _0x5e35=function(_0x43b5a8,_0x27eeaa){_0x43b5a8=_0x43b5a8-0x0;var _0x48c4d4=_0xe355[_0x43b5a8];return _0x48c4d4;};'use strict';var multer=require(_0x5e35('0x0'));var util=require(_0x5e35('0x1'));var path=require('path');var timeout=require(_0x5e35('0x2'));var express=require(_0x5e35('0x3'));var router=express[_0x5e35('0x4')]();var auth=require(_0x5e35('0x5'));var interaction=require(_0x5e35('0x6'));var config=require(_0x5e35('0x7'));var controller=require(_0x5e35('0x8'));router[_0x5e35('0x9')]('/',auth[_0x5e35('0xa')](),controller[_0x5e35('0xb')]);router[_0x5e35('0x9')]('/describe',auth[_0x5e35('0xa')](),controller[_0x5e35('0xc')]);router[_0x5e35('0x9')](_0x5e35('0xd'),auth[_0x5e35('0xa')](),controller[_0x5e35('0xe')]);router['post']('/',auth[_0x5e35('0xa')](),controller[_0x5e35('0xf')]);router[_0x5e35('0x10')](_0x5e35('0xd'),auth[_0x5e35('0xa')](),controller['update']);router['delete'](_0x5e35('0xd'),auth['isAuthenticated'](),controller[_0x5e35('0x11')]);module[_0x5e35('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6cf6255..ba3bec7 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 _0xcca7=['outbound','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x91ed5c,_0xdb6b34){var _0x2387d8=function(_0x1a9d15){while(--_0x1a9d15){_0x91ed5c['push'](_0x91ed5c['shift']());}};_0x2387d8(++_0xdb6b34);}(_0xcca7,0x1aa));var _0x7cca=function(_0x1979d3,_0x7b9cb1){_0x1979d3=_0x1979d3-0x0;var _0x524cdf=_0xcca7[_0x1979d3];return _0x524cdf;};'use strict';var Sequelize=require(_0x7cca('0x0'));module[_0x7cca('0x1')]={'uniqueid':{'type':Sequelize[_0x7cca('0x2')]},'type':{'type':Sequelize[_0x7cca('0x3')]('inbound','internal',_0x7cca('0x4'),'inbound-fax',_0x7cca('0x5'),_0x7cca('0x6'))},'tag':{'type':Sequelize[_0x7cca('0x2')]},'accountcode':{'type':Sequelize[_0x7cca('0x2')]},'source':{'type':Sequelize[_0x7cca('0x2')]},'destination':{'type':Sequelize[_0x7cca('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7cca('0x2')]},'destinationchannel':{'type':Sequelize[_0x7cca('0x2')]},'lastapplication':{'type':Sequelize[_0x7cca('0x2')]},'lastdata':{'type':Sequelize[_0x7cca('0x7')]},'starttime':{'type':Sequelize[_0x7cca('0x8')]},'systemanswertime':{'type':Sequelize[_0x7cca('0x8')]},'answertime':{'type':Sequelize[_0x7cca('0x8')]},'endtime':{'type':Sequelize[_0x7cca('0x8')]},'duration':{'type':Sequelize[_0x7cca('0x9')]},'billableseconds':{'type':Sequelize[_0x7cca('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7cca('0x2')]},'amaflags':{'type':Sequelize[_0x7cca('0x2')]},'userfield':{'type':Sequelize[_0x7cca('0x2')]},'userDisposition':{'type':Sequelize[_0x7cca('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x7cca('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7cca('0x2')]},'prefix':{'type':Sequelize[_0x7cca('0x2')]},'routeid':{'type':Sequelize[_0x7cca('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x277c=['TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer'];(function(_0x274852,_0x262c01){var _0x128e5d=function(_0x3e637d){while(--_0x3e637d){_0x274852['push'](_0x274852['shift']());}};_0x128e5d(++_0x262c01);}(_0x277c,0x153));var _0xc277=function(_0x5b0847,_0x3e4b9f){_0x5b0847=_0x5b0847-0x0;var _0x279b7a=_0x277c[_0x5b0847];return _0x279b7a;};'use strict';var Sequelize=require(_0xc277('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc277('0x1')]},'type':{'type':Sequelize[_0xc277('0x2')](_0xc277('0x3'),_0xc277('0x4'),_0xc277('0x5'),_0xc277('0x6'),_0xc277('0x7'),_0xc277('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xc277('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xc277('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc277('0x1')]},'destinationchannel':{'type':Sequelize[_0xc277('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc277('0x9')]},'starttime':{'type':Sequelize[_0xc277('0xa')]},'systemanswertime':{'type':Sequelize[_0xc277('0xa')]},'answertime':{'type':Sequelize[_0xc277('0xa')]},'endtime':{'type':Sequelize[_0xc277('0xa')]},'duration':{'type':Sequelize[_0xc277('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc277('0x1')]},'amaflags':{'type':Sequelize[_0xc277('0x1')]},'userfield':{'type':Sequelize[_0xc277('0x1')]},'userDisposition':{'type':Sequelize[_0xc277('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc277('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xc277('0x1')]},'routeid':{'type':Sequelize[_0xc277('0xb')]},'sipcallid':{'type':Sequelize[_0xc277('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 5e2fa70..421d1fe 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 _0xa9e0=['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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0xa9e0=['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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 363277e..490d07d 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 _0x48f5=['path','rimraf','./voiceCallReport.attributes','exports','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x48f5,0x68));var _0x548f=function(_0x48b392,_0x23914c){_0x48b392=_0x48b392-0x0;var _0x8d4c72=_0x48f5[_0x48b392];return _0x8d4c72;};'use strict';var _=require(_0x548f('0x0'));var util=require(_0x548f('0x1'));var logger=require(_0x548f('0x2'))(_0x548f('0x3'));var moment=require(_0x548f('0x4'));var BPromise=require('bluebird');var rp=require(_0x548f('0x5'));var fs=require('fs');var path=require(_0x548f('0x6'));var rimraf=require(_0x548f('0x7'));var config=require('../../config/environment');var attributes=require(_0x548f('0x8'));module[_0x548f('0x9')]=function(_0x5dba39,_0x5478d8){return _0x5dba39['define']('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x548f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x880c=['VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','define'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x880c,0x114));var _0xc880=function(_0xce145a,_0x93108e){_0xce145a=_0xce145a-0x0;var _0x1bb0f6=_0x880c[_0xce145a];return _0x1bb0f6;};'use strict';var _=require(_0xc880('0x0'));var util=require(_0xc880('0x1'));var logger=require(_0xc880('0x2'))(_0xc880('0x3'));var moment=require(_0xc880('0x4'));var BPromise=require('bluebird');var rp=require(_0xc880('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc880('0x6'));var config=require(_0xc880('0x7'));var attributes=require(_0xc880('0x8'));module['exports']=function(_0x21a083,_0x5e4e3f){return _0x21a083[_0xc880('0x9')](_0xc880('0xa'),attributes,{'tableName':_0xc880('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc880('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index bc69fe3..818d9ec 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 _0xe71e=['../../config/environment','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetVoiceCallReport','options','raw','where','attributes','limit','include','map','model','VoiceCallReport','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x16e5d1,_0x9cf085){var _0x3f72e6=function(_0x26c06a){while(--_0x26c06a){_0x16e5d1['push'](_0x16e5d1['shift']());}};_0x3f72e6(++_0x9cf085);}(_0xe71e,0x1a9));var _0xee71=function(_0x475b7d,_0x3e1f95){_0x475b7d=_0x475b7d-0x0;var _0x2ad527=_0xe71e[_0x475b7d];return _0x2ad527;};'use strict';var _=require(_0xee71('0x0'));var util=require(_0xee71('0x1'));var moment=require(_0xee71('0x2'));var BPromise=require('bluebird');var rs=require(_0xee71('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee71('0x4'));var logger=require(_0xee71('0x5'))(_0xee71('0x6'));var config=require(_0xee71('0x7'));var jayson=require(_0xee71('0x8'));var client=jayson[_0xee71('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1521bb,_0x4463cc,_0x336e89){return new BPromise(function(_0x303a11,_0x31fce5){return client[_0xee71('0xa')](_0x1521bb,_0x336e89)[_0xee71('0xb')](function(_0x1ce344){logger[_0xee71('0xc')](_0xee71('0xd'),_0x4463cc,'request\x20sent');logger[_0xee71('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x4463cc,_0xee71('0xf'),JSON[_0xee71('0x10')](_0x1ce344));if(_0x1ce344[_0xee71('0x11')]){if(_0x1ce344[_0xee71('0x11')][_0xee71('0x12')]===0x1f4){logger[_0xee71('0x11')](_0xee71('0xd'),_0x4463cc,_0x1ce344['error'][_0xee71('0x13')]);return _0x31fce5(_0x1ce344[_0xee71('0x11')]['message']);}logger['error'](_0xee71('0xd'),_0x4463cc,_0x1ce344[_0xee71('0x11')][_0xee71('0x13')]);return _0x303a11(_0x1ce344[_0xee71('0x11')][_0xee71('0x13')]);}else{logger[_0xee71('0xc')](_0xee71('0xd'),_0x4463cc,_0xee71('0xf'));_0x303a11(_0x1ce344['result']['message']);}})[_0xee71('0x14')](function(_0x5254fa){logger['error'](_0xee71('0xd'),_0x4463cc,_0x5254fa);_0x31fce5(_0x5254fa);});});}exports[_0xee71('0x15')]=function(_0x35310f){var _0x2adcc0=this;return new Promise(function(_0x5b6c6c,_0x29ac8e){return db['VoiceCallReport']['findAll']({'raw':_0x35310f[_0xee71('0x16')]?_0x35310f[_0xee71('0x16')][_0xee71('0x17')]===undefined?!![]:![]:!![],'where':_0x35310f[_0xee71('0x16')]?_0x35310f[_0xee71('0x16')][_0xee71('0x18')]||null:null,'attributes':_0x35310f[_0xee71('0x16')]?_0x35310f['options'][_0xee71('0x19')]||null:null,'limit':_0x35310f[_0xee71('0x16')]?_0x35310f[_0xee71('0x16')][_0xee71('0x1a')]||null:null,'include':_0x35310f[_0xee71('0x16')]?_0x35310f[_0xee71('0x16')][_0xee71('0x1b')]?_[_0xee71('0x1c')](_0x35310f['options'][_0xee71('0x1b')],function(_0x2b77f6){return{'model':db[_0x2b77f6[_0xee71('0x1d')]],'as':_0x2b77f6['as'],'attributes':_0x2b77f6[_0xee71('0x19')],'include':_0x2b77f6[_0xee71('0x1b')]?_[_0xee71('0x1c')](_0x2b77f6[_0xee71('0x1b')],function(_0x3aa5ff){return{'model':db[_0x3aa5ff[_0xee71('0x1d')]],'as':_0x3aa5ff['as'],'attributes':_0x3aa5ff[_0xee71('0x19')],'include':_0x3aa5ff[_0xee71('0x1b')]?_[_0xee71('0x1c')](_0x3aa5ff[_0xee71('0x1b')],function(_0x4068fd){return{'model':db[_0x4068fd[_0xee71('0x1d')]],'as':_0x4068fd['as'],'attributes':_0x4068fd[_0xee71('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49bbdd){logger[_0xee71('0xc')](_0xee71('0x15'),_0x35310f);logger['debug'](_0xee71('0x15'),_0x35310f,JSON['stringify'](_0x49bbdd));_0x5b6c6c(_0x49bbdd);})[_0xee71('0x14')](function(_0x5e28b7){logger['error']('GetVoiceCallReport',_0x5e28b7['message'],_0x35310f);_0x29ac8e(_0x2adcc0['error'](0x1f4,_0x5e28b7[_0xee71('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x459d80){var _0x27de6b=this;return new Promise(function(_0x2a16c8,_0x2727f9){return db[_0xee71('0x1e')][_0xee71('0x1f')](_0x459d80[_0xee71('0x20')],{'raw':_0x459d80[_0xee71('0x16')]?_0x459d80[_0xee71('0x16')][_0xee71('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x19657f){logger[_0xee71('0xc')](_0xee71('0x21'),_0x459d80);logger[_0xee71('0xe')](_0xee71('0x21'),_0x459d80,JSON[_0xee71('0x10')](_0x19657f));_0x2a16c8(_0x19657f);})[_0xee71('0x14')](function(_0x3a9101){logger[_0xee71('0x11')](_0xee71('0x21'),_0x3a9101[_0xee71('0x13')],_0x459d80);_0x2727f9(_0x27de6b[_0xee71('0x11')](0x1f4,_0x3a9101[_0xee71('0x13')]));});});};exports[_0xee71('0x22')]=function(_0x448720){var _0x5eea9e=this;return new Promise(function(_0x26d908,_0x2be26b){return db[_0xee71('0x1e')][_0xee71('0x23')](_0x448720[_0xee71('0x20')],{'raw':_0x448720['options']?_0x448720[_0xee71('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x448720[_0xee71('0x16')]?_0x448720[_0xee71('0x16')][_0xee71('0x18')]||null:null,'attributes':_0x448720['options']?_0x448720[_0xee71('0x16')][_0xee71('0x19')]||null:null,'limit':_0x448720[_0xee71('0x16')]?_0x448720[_0xee71('0x16')][_0xee71('0x1a')]||null:null})[_0xee71('0xb')](function(_0x39de8f){logger['info']('UpdateVoiceCallReport',_0x448720);logger[_0xee71('0xe')](_0xee71('0x22'),_0x448720,JSON[_0xee71('0x10')](_0x39de8f));_0x26d908(_0x39de8f);})[_0xee71('0x14')](function(_0x506884){logger[_0xee71('0x11')]('UpdateVoiceCallReport',_0x506884['message'],_0x448720);_0x2be26b(_0x5eea9e[_0xee71('0x11')](0x1f4,_0x506884[_0xee71('0x13')]));});});}; \ No newline at end of file +var _0x699f=['VoiceCallReport','create','update','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','options','raw','where','attributes','limit','include','model','map','GetVoiceCallReport','CreateVoiceCallReport'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0x699f,0xc3));var _0xf699=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x699f[_0x507c81];return _0x368a25;};'use strict';var _=require(_0xf699('0x0'));var util=require(_0xf699('0x1'));var moment=require(_0xf699('0x2'));var BPromise=require(_0xf699('0x3'));var rs=require(_0xf699('0x4'));var fs=require('fs');var Redis=require(_0xf699('0x5'));var db=require(_0xf699('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf699('0x7'))(_0xf699('0x8'));var config=require(_0xf699('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf699('0xa')][_0xf699('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29f037,_0xeaf4c3,_0x4137ca){return new BPromise(function(_0x44f6db,_0x5a8b2e){return client['request'](_0x29f037,_0x4137ca)[_0xf699('0xc')](function(_0x381000){logger[_0xf699('0xd')](_0xf699('0xe'),_0xeaf4c3,_0xf699('0xf'));logger[_0xf699('0x10')](_0xf699('0x11'),_0xeaf4c3,_0xf699('0xf'),JSON[_0xf699('0x12')](_0x381000));if(_0x381000[_0xf699('0x13')]){if(_0x381000[_0xf699('0x13')][_0xf699('0x14')]===0x1f4){logger[_0xf699('0x13')](_0xf699('0xe'),_0xeaf4c3,_0x381000[_0xf699('0x13')][_0xf699('0x15')]);return _0x5a8b2e(_0x381000['error'][_0xf699('0x15')]);}logger[_0xf699('0x13')](_0xf699('0xe'),_0xeaf4c3,_0x381000[_0xf699('0x13')][_0xf699('0x15')]);return _0x44f6db(_0x381000[_0xf699('0x13')][_0xf699('0x15')]);}else{logger[_0xf699('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0xeaf4c3,_0xf699('0xf'));_0x44f6db(_0x381000['result'][_0xf699('0x15')]);}})[_0xf699('0x16')](function(_0x3a9bcd){logger['error'](_0xf699('0xe'),_0xeaf4c3,_0x3a9bcd);_0x5a8b2e(_0x3a9bcd);});});}exports['GetVoiceCallReport']=function(_0x2dd549){var _0x498dc4=this;return new Promise(function(_0x5bc632,_0x2f38dc){return db['VoiceCallReport']['findAll']({'raw':_0x2dd549['options']?_0x2dd549[_0xf699('0x17')][_0xf699('0x18')]===undefined?!![]:![]:!![],'where':_0x2dd549['options']?_0x2dd549[_0xf699('0x17')][_0xf699('0x19')]||null:null,'attributes':_0x2dd549[_0xf699('0x17')]?_0x2dd549[_0xf699('0x17')][_0xf699('0x1a')]||null:null,'limit':_0x2dd549['options']?_0x2dd549['options'][_0xf699('0x1b')]||null:null,'include':_0x2dd549['options']?_0x2dd549[_0xf699('0x17')][_0xf699('0x1c')]?_['map'](_0x2dd549[_0xf699('0x17')][_0xf699('0x1c')],function(_0x565024){return{'model':db[_0x565024[_0xf699('0x1d')]],'as':_0x565024['as'],'attributes':_0x565024[_0xf699('0x1a')],'include':_0x565024[_0xf699('0x1c')]?_[_0xf699('0x1e')](_0x565024['include'],function(_0x214eec){return{'model':db[_0x214eec['model']],'as':_0x214eec['as'],'attributes':_0x214eec[_0xf699('0x1a')],'include':_0x214eec[_0xf699('0x1c')]?_[_0xf699('0x1e')](_0x214eec['include'],function(_0x89c316){return{'model':db[_0x89c316[_0xf699('0x1d')]],'as':_0x89c316['as'],'attributes':_0x89c316[_0xf699('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37ac5f){logger[_0xf699('0xd')](_0xf699('0x1f'),_0x2dd549);logger[_0xf699('0x10')]('GetVoiceCallReport',_0x2dd549,JSON[_0xf699('0x12')](_0x37ac5f));_0x5bc632(_0x37ac5f);})['catch'](function(_0x26cfbc){logger['error']('GetVoiceCallReport',_0x26cfbc[_0xf699('0x15')],_0x2dd549);_0x2f38dc(_0x498dc4[_0xf699('0x13')](0x1f4,_0x26cfbc['message']));});});};exports[_0xf699('0x20')]=function(_0x399572){var _0x1e2a2a=this;return new Promise(function(_0x65d139,_0x3d11c3){return db[_0xf699('0x21')][_0xf699('0x22')](_0x399572['body'],{'raw':_0x399572[_0xf699('0x17')]?_0x399572[_0xf699('0x17')][_0xf699('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1e6c79){logger[_0xf699('0xd')](_0xf699('0x20'),_0x399572);logger['debug'](_0xf699('0x20'),_0x399572,JSON['stringify'](_0x1e6c79));_0x65d139(_0x1e6c79);})[_0xf699('0x16')](function(_0x53974a){logger[_0xf699('0x13')](_0xf699('0x20'),_0x53974a['message'],_0x399572);_0x3d11c3(_0x1e2a2a[_0xf699('0x13')](0x1f4,_0x53974a[_0xf699('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x45da02){var _0x410ba0=this;return new Promise(function(_0x378f3c,_0x182922){return db[_0xf699('0x21')][_0xf699('0x23')](_0x45da02[_0xf699('0x24')],{'raw':_0x45da02[_0xf699('0x17')]?_0x45da02['options'][_0xf699('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45da02['options']?_0x45da02['options'][_0xf699('0x19')]||null:null,'attributes':_0x45da02[_0xf699('0x17')]?_0x45da02[_0xf699('0x17')]['attributes']||null:null,'limit':_0x45da02[_0xf699('0x17')]?_0x45da02['options'][_0xf699('0x1b')]||null:null})['then'](function(_0x5bace0){logger[_0xf699('0xd')]('UpdateVoiceCallReport',_0x45da02);logger[_0xf699('0x10')](_0xf699('0x25'),_0x45da02,JSON[_0xf699('0x12')](_0x5bace0));_0x378f3c(_0x5bace0);})[_0xf699('0x16')](function(_0x1ee655){logger[_0xf699('0x13')](_0xf699('0x25'),_0x1ee655[_0xf699('0x15')],_0x45da02);_0x182922(_0x410ba0['error'](0x1f4,_0x1ee655[_0xf699('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9d13629..947ef4b 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 _0xacc1=['destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xacc1,0x187));var _0x1acc=function(_0xe45b6d,_0x443cac){_0xe45b6d=_0xe45b6d-0x0;var _0x4d6f47=_0xacc1[_0xe45b6d];return _0x4d6f47;};'use strict';var multer=require(_0x1acc('0x0'));var util=require(_0x1acc('0x1'));var path=require(_0x1acc('0x2'));var timeout=require(_0x1acc('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x1acc('0x4'));var interaction=require(_0x1acc('0x5'));var config=require(_0x1acc('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x1acc('0x7')]('/',auth[_0x1acc('0x8')](),controller['index']);router[_0x1acc('0x7')](_0x1acc('0x9'),auth['isAuthenticated'](),controller[_0x1acc('0xa')]);router['post']('/',auth[_0x1acc('0x8')](),controller[_0x1acc('0xb')]);router[_0x1acc('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1acc('0xd')]);router['delete'](_0x1acc('0x9'),auth['isAuthenticated'](),controller[_0x1acc('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd094=['util','path','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','post','create','put','update','destroy','exports'];(function(_0x456f8f,_0x2e3ef6){var _0x94831d=function(_0x2402e4){while(--_0x2402e4){_0x456f8f['push'](_0x456f8f['shift']());}};_0x94831d(++_0x2e3ef6);}(_0xd094,0x96));var _0x4d09=function(_0x48d811,_0x350513){_0x48d811=_0x48d811-0x0;var _0x3852cc=_0xd094[_0x48d811];return _0x3852cc;};'use strict';var multer=require('multer');var util=require(_0x4d09('0x0'));var path=require(_0x4d09('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x4d09('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x4d09('0x3'));var controller=require(_0x4d09('0x4'));router[_0x4d09('0x5')]('/',auth['isAuthenticated'](),controller[_0x4d09('0x6')]);router[_0x4d09('0x5')](_0x4d09('0x7'),auth[_0x4d09('0x8')](),controller['show']);router[_0x4d09('0x9')]('/',auth['isAuthenticated'](),controller[_0x4d09('0xa')]);router[_0x4d09('0xb')](_0x4d09('0x7'),auth[_0x4d09('0x8')](),controller[_0x4d09('0xc')]);router['delete'](_0x4d09('0x7'),auth[_0x4d09('0x8')](),controller[_0x4d09('0xd')]);module[_0x4d09('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 b746b6d..66a38ec 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 _0x6e12=['sequelize','exports','STRING','name','setDataValue','options','join','getDataValue','BOOLEAN'];(function(_0x1f37e1,_0x1b42ea){var _0x329f45=function(_0x1fa98c){while(--_0x1fa98c){_0x1f37e1['push'](_0x1f37e1['shift']());}};_0x329f45(++_0x1b42ea);}(_0x6e12,0x129));var _0x26e1=function(_0x2bce50,_0x262ea8){_0x2bce50=_0x2bce50-0x0;var _0x280f7a=_0x6e12[_0x2bce50];return _0x280f7a;};'use strict';var Sequelize=require(_0x26e1('0x0'));module[_0x26e1('0x1')]={'name':{'type':Sequelize[_0x26e1('0x2')]},'prefix':{'type':Sequelize[_0x26e1('0x2')],'unique':_0x26e1('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x26e1('0x2')],'set':function(_0xbfbfdd){this[_0x26e1('0x4')](_0x26e1('0x5'),_0xbfbfdd?_0xbfbfdd[_0x26e1('0x6')](''):[]);},'get':function(){return this[_0x26e1('0x7')](_0x26e1('0x5'))?this[_0x26e1('0x7')](_0x26e1('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x26e1('0x2')]},'record':{'type':Sequelize[_0x26e1('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x26e1('0x2')]},'description':{'type':Sequelize[_0x26e1('0x2')]}}; \ No newline at end of file +var _0xc13d=['STRING','setDataValue','options','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x3b45d7,_0xbc2848){var _0x4690e8=function(_0x209c3b){while(--_0x209c3b){_0x3b45d7['push'](_0x3b45d7['shift']());}};_0x4690e8(++_0xbc2848);}(_0xc13d,0x166));var _0xdc13=function(_0x444d83,_0x54c255){_0x444d83=_0x444d83-0x0;var _0x20574b=_0xc13d[_0x444d83];return _0x20574b;};'use strict';var Sequelize=require(_0xdc13('0x0'));module[_0xdc13('0x1')]={'name':{'type':Sequelize[_0xdc13('0x2')]},'prefix':{'type':Sequelize[_0xdc13('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2fc861){this[_0xdc13('0x3')](_0xdc13('0x4'),_0x2fc861?_0x2fc861['join'](''):[]);},'get':function(){return this['getDataValue'](_0xdc13('0x4'))?this[_0xdc13('0x5')](_0xdc13('0x4'))[_0xdc13('0x6')](''):[];}},'auth':{'type':Sequelize[_0xdc13('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xdc13('0x2')]},'record':{'type':Sequelize[_0xdc13('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xdc13('0x2')]},'description':{'type':Sequelize[_0xdc13('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 91ce640..a9a43e6 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 _0x07c0=['util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','end','error','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','options','includeAll','findAll','rows','catch','show','keys','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','rimraf','moment','bluebird','mustache'];(function(_0x18e434,_0x4f047c){var _0x200988=function(_0x216388){while(--_0x216388){_0x18e434['push'](_0x18e434['shift']());}};_0x200988(++_0x4f047c);}(_0x07c0,0xa4));var _0x007c=function(_0x239a39,_0x5b787d){_0x239a39=_0x239a39-0x0;var _0x5bdc07=_0x07c0[_0x239a39];return _0x5bdc07;};'use strict';var pdf=require(_0x007c('0x0'));var emlformat=require(_0x007c('0x1'));var rimraf=require(_0x007c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x007c('0x3'));var BPromise=require(_0x007c('0x4'));var Mustache=require(_0x007c('0x5'));var util=require(_0x007c('0x6'));var path=require(_0x007c('0x7'));var sox=require(_0x007c('0x8'));var csv=require(_0x007c('0x9'));var ejs=require(_0x007c('0xa'));var fs=require('fs');var _=require(_0x007c('0xb'));var squel=require('squel');var crypto=require(_0x007c('0xc'));var jsforce=require(_0x007c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x007c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x007c('0xe'));var authService=require(_0x007c('0xf'));var qs=require(_0x007c('0x10'));var as=require(_0x007c('0x11'));var hardwareService=require(_0x007c('0x12'));var logger=require(_0x007c('0x13'))('api');var utils=require(_0x007c('0x14'));var config=require(_0x007c('0x15'));var licenseUtil=require(_0x007c('0x16'));var db=require(_0x007c('0x17'))['db'];function respondWithStatusCode(_0x165e47,_0x1b2754){_0x1b2754=_0x1b2754||0xcc;return function(_0x5c5b07){if(_0x5c5b07){return _0x165e47['sendStatus'](_0x1b2754);}return _0x165e47[_0x007c('0x18')](_0x1b2754)['end']();};}function respondWithResult(_0x437bf4,_0x179e91){_0x179e91=_0x179e91||0xc8;return function(_0x4220f3){if(_0x4220f3){return _0x437bf4[_0x007c('0x18')](_0x179e91)[_0x007c('0x19')](_0x4220f3);}};}function respondWithFilteredResult(_0x55b366,_0x1a6b5c){return function(_0xeb2cb4){if(_0xeb2cb4){var _0x570b91=_0xeb2cb4[_0x007c('0x1a')],_0x437c15=_0x1a6b5c[_0x007c('0x1b')],_0x16709a=_0x1a6b5c[_0x007c('0x1b')]+_0x1a6b5c['limit'],_0x504421;if(_0x16709a>=_0x570b91){_0x16709a=_0x570b91;_0x504421=0xc8;}else{_0x504421=0xce;}_0x55b366['status'](_0x504421);return _0x55b366[_0x007c('0x1c')](_0x007c('0x1d'),_0x437c15+'-'+_0x16709a+'/'+_0x570b91)[_0x007c('0x19')](_0xeb2cb4);}return null;};}function patchUpdates(_0x5de12e){return function(_0x42980f){try{jsonpatch[_0x007c('0x1e')](_0x42980f,_0x5de12e,!![]);}catch(_0x4151e6){return BPromise[_0x007c('0x1f')](_0x4151e6);}return _0x42980f[_0x007c('0x20')]();};}function saveUpdates(_0x30a0ef,_0x59bc60){return function(_0x555673){if(_0x555673){return _0x555673[_0x007c('0x21')](_0x30a0ef)[_0x007c('0x22')](function(_0x593a14){return _0x593a14;});}return null;};}function removeEntity(_0x35ee26,_0x4352b2){return function(_0x58db97){if(_0x58db97){return _0x58db97[_0x007c('0x23')]()[_0x007c('0x22')](function(){var _0x58ba4a=_0x58db97[_0x007c('0x24')]({'plain':!![]});var _0x11fd14=_0x007c('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x11fd14,'resourceId':_0x58ba4a['id']}})['then'](function(){return _0x58db97;});})[_0x007c('0x22')](function(){_0x35ee26[_0x007c('0x18')](0xcc)[_0x007c('0x26')]();});}};}function handleEntityNotFound(_0x5b58f6,_0x14b264){return function(_0xeb4353){if(!_0xeb4353){_0x5b58f6['sendStatus'](0x194);}return _0xeb4353;};}function handleError(_0x36ae12,_0x5fc7f0){_0x5fc7f0=_0x5fc7f0||0x1f4;return function(_0x55b9b6){logger[_0x007c('0x27')](_0x55b9b6[_0x007c('0x28')]);if(_0x55b9b6[_0x007c('0x29')]){delete _0x55b9b6[_0x007c('0x29')];}_0x36ae12['status'](_0x5fc7f0)[_0x007c('0x2a')](_0x55b9b6);};}exports[_0x007c('0x2b')]=function(_0x2dd983,_0x2966f6){var _0x26893a={},_0x28477a={},_0x3c10b1={'count':0x0,'rows':[]};var _0x431f11=_[_0x007c('0x2c')](db[_0x007c('0x2d')]['rawAttributes'],function(_0x36537c){return{'name':_0x36537c[_0x007c('0x2e')],'type':_0x36537c[_0x007c('0x2f')][_0x007c('0x30')]};});_0x28477a[_0x007c('0x31')]=_[_0x007c('0x2c')](_0x431f11,_0x007c('0x29'));_0x28477a[_0x007c('0x32')]=_['keys'](_0x2dd983[_0x007c('0x32')]);_0x28477a[_0x007c('0x33')]=_[_0x007c('0x34')](_0x28477a[_0x007c('0x31')],_0x28477a['query']);_0x26893a[_0x007c('0x35')]=_['intersection'](_0x28477a[_0x007c('0x31')],qs['fields'](_0x2dd983[_0x007c('0x32')]['fields']));_0x26893a[_0x007c('0x35')]=_0x26893a['attributes'][_0x007c('0x36')]?_0x26893a['attributes']:_0x28477a[_0x007c('0x31')];if(!_0x2dd983['query'][_0x007c('0x37')](_0x007c('0x38'))){_0x26893a[_0x007c('0x39')]=qs[_0x007c('0x39')](_0x2dd983[_0x007c('0x32')]['limit']);_0x26893a['offset']=qs['offset'](_0x2dd983[_0x007c('0x32')][_0x007c('0x1b')]);}_0x26893a[_0x007c('0x3a')]=qs[_0x007c('0x3b')](_0x2dd983['query'][_0x007c('0x3b')]);_0x26893a['where']=qs['filters'](_[_0x007c('0x3c')](_0x2dd983[_0x007c('0x32')],_0x28477a[_0x007c('0x33')]),_0x431f11);if(_0x2dd983[_0x007c('0x32')][_0x007c('0x3d')]){_0x26893a['where']=_[_0x007c('0x3e')](_0x26893a[_0x007c('0x3f')],{'$or':_[_0x007c('0x2c')](_0x431f11,function(_0x32eb87){if(_0x32eb87[_0x007c('0x2f')]!=='VIRTUAL'){var _0x504cf8={};_0x504cf8[_0x32eb87[_0x007c('0x29')]]={'$like':'%'+_0x2dd983[_0x007c('0x32')][_0x007c('0x3d')]+'%'};return _0x504cf8;}})});}_0x26893a=_['merge']({},_0x26893a,_0x2dd983[_0x007c('0x40')]);var _0x3ca986={'where':_0x26893a['where']};return db['VoiceChanSpy'][_0x007c('0x1a')](_0x3ca986)[_0x007c('0x22')](function(_0x201145){_0x3c10b1['count']=_0x201145;if(_0x2dd983[_0x007c('0x32')][_0x007c('0x41')]){_0x26893a['include']=[{'all':!![]}];}return db[_0x007c('0x2d')][_0x007c('0x42')](_0x26893a);})[_0x007c('0x22')](function(_0x438aa0){_0x3c10b1[_0x007c('0x43')]=_0x438aa0;return _0x3c10b1;})['then'](respondWithFilteredResult(_0x2966f6,_0x26893a))[_0x007c('0x44')](handleError(_0x2966f6,null));};exports[_0x007c('0x45')]=function(_0x4b623f,_0x7d6533){var _0x961321={'raw':![],'where':{'id':_0x4b623f['params']['id']}},_0x19fc91={};_0x19fc91['model']=_[_0x007c('0x46')](db[_0x007c('0x2d')]['rawAttributes']);_0x19fc91[_0x007c('0x32')]=_[_0x007c('0x46')](_0x4b623f[_0x007c('0x32')]);_0x19fc91[_0x007c('0x33')]=_[_0x007c('0x34')](_0x19fc91[_0x007c('0x31')],_0x19fc91[_0x007c('0x32')]);_0x961321[_0x007c('0x35')]=_[_0x007c('0x34')](_0x19fc91[_0x007c('0x31')],qs[_0x007c('0x47')](_0x4b623f[_0x007c('0x32')][_0x007c('0x47')]));_0x961321[_0x007c('0x35')]=_0x961321[_0x007c('0x35')]['length']?_0x961321[_0x007c('0x35')]:_0x19fc91[_0x007c('0x31')];if(_0x4b623f[_0x007c('0x32')]['includeAll']){_0x961321[_0x007c('0x48')]=[{'all':!![]}];}_0x961321=_[_0x007c('0x3e')]({},_0x961321,_0x4b623f[_0x007c('0x40')]);return db[_0x007c('0x2d')][_0x007c('0x49')](_0x961321)[_0x007c('0x22')](handleEntityNotFound(_0x7d6533,null))[_0x007c('0x22')](respondWithResult(_0x7d6533,null))[_0x007c('0x44')](handleError(_0x7d6533,null));};exports['create']=function(_0x479720,_0x25f02b){return db[_0x007c('0x2d')][_0x007c('0x4a')](_0x479720['body'],{})['then'](function(_0x44a5c1){var _0x195fa1=_0x479720[_0x007c('0x4b')][_0x007c('0x24')]({'plain':!![]});if(!_0x195fa1)throw new Error(_0x007c('0x4c'));if(_0x195fa1[_0x007c('0x4d')]==='user'){var _0x1e2d94=_0x44a5c1[_0x007c('0x24')]({'plain':!![]});var _0x216de6=_0x007c('0x25');return db[_0x007c('0x4e')][_0x007c('0x49')]({'where':{'name':_0x216de6,'userProfileId':_0x195fa1[_0x007c('0x4f')]},'raw':!![]})[_0x007c('0x22')](function(_0x3a6b28){if(_0x3a6b28&&_0x3a6b28[_0x007c('0x50')]===0x0){return db[_0x007c('0x51')][_0x007c('0x4a')]({'name':_0x1e2d94[_0x007c('0x29')],'resourceId':_0x1e2d94['id'],'type':_0x3a6b28[_0x007c('0x29')],'sectionId':_0x3a6b28['id']},{})[_0x007c('0x22')](function(){return _0x44a5c1;});}else{return _0x44a5c1;}})[_0x007c('0x44')](function(_0x4f0894){logger[_0x007c('0x27')](_0x007c('0x52'),_0x4f0894);throw _0x4f0894;});}return _0x44a5c1;})[_0x007c('0x22')](respondWithResult(_0x25f02b,0xc9))[_0x007c('0x44')](handleError(_0x25f02b,null));};exports[_0x007c('0x21')]=function(_0x3ed276,_0x5ca436){if(_0x3ed276[_0x007c('0x53')]['id']){delete _0x3ed276['body']['id'];}return db['VoiceChanSpy'][_0x007c('0x49')]({'where':{'id':_0x3ed276[_0x007c('0x54')]['id']}})[_0x007c('0x22')](handleEntityNotFound(_0x5ca436,null))[_0x007c('0x22')](saveUpdates(_0x3ed276[_0x007c('0x53')],null))[_0x007c('0x22')](respondWithResult(_0x5ca436,null))['catch'](handleError(_0x5ca436,null));};exports[_0x007c('0x23')]=function(_0x30ec44,_0x4e8a58){return db[_0x007c('0x2d')][_0x007c('0x49')]({'where':{'id':_0x30ec44[_0x007c('0x54')]['id']}})[_0x007c('0x22')](handleEntityNotFound(_0x4e8a58,null))[_0x007c('0x22')](removeEntity(_0x4e8a58,null))[_0x007c('0x44')](handleError(_0x4e8a58,null));}; \ No newline at end of file +var _0xeb9f=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','index','map','VoiceChanSpy','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0xeb9f,0x1eb));var _0xfeb9=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xeb9f[_0x1b6186];return _0x186121;};'use strict';var pdf=require(_0xfeb9('0x0'));var emlformat=require(_0xfeb9('0x1'));var rimraf=require(_0xfeb9('0x2'));var zipdir=require(_0xfeb9('0x3'));var jsonpatch=require(_0xfeb9('0x4'));var rp=require(_0xfeb9('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfeb9('0x6'));var util=require(_0xfeb9('0x7'));var path=require(_0xfeb9('0x8'));var sox=require(_0xfeb9('0x9'));var csv=require(_0xfeb9('0xa'));var ejs=require(_0xfeb9('0xb'));var fs=require('fs');var _=require(_0xfeb9('0xc'));var squel=require(_0xfeb9('0xd'));var crypto=require(_0xfeb9('0xe'));var jsforce=require(_0xfeb9('0xf'));var deskjs=require(_0xfeb9('0x10'));var toCsv=require(_0xfeb9('0xa'));var querystring=require(_0xfeb9('0x11'));var Papa=require('papaparse');var Redis=require(_0xfeb9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfeb9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfeb9('0x14'));var logger=require(_0xfeb9('0x15'))('api');var utils=require(_0xfeb9('0x16'));var config=require(_0xfeb9('0x17'));var licenseUtil=require(_0xfeb9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x214fc6,_0x31e7c3){_0x31e7c3=_0x31e7c3||0xcc;return function(_0x11da46){if(_0x11da46){return _0x214fc6[_0xfeb9('0x19')](_0x31e7c3);}return _0x214fc6[_0xfeb9('0x1a')](_0x31e7c3)[_0xfeb9('0x1b')]();};}function respondWithResult(_0x554c13,_0x582caf){_0x582caf=_0x582caf||0xc8;return function(_0x2c85fb){if(_0x2c85fb){return _0x554c13['status'](_0x582caf)[_0xfeb9('0x1c')](_0x2c85fb);}};}function respondWithFilteredResult(_0x28e35f,_0x184208){return function(_0x3b87ef){if(_0x3b87ef){var _0x159519=_0x3b87ef[_0xfeb9('0x1d')],_0x4d1f81=_0x184208[_0xfeb9('0x1e')],_0x59d152=_0x184208['offset']+_0x184208[_0xfeb9('0x1f')],_0x39df43;if(_0x59d152>=_0x159519){_0x59d152=_0x159519;_0x39df43=0xc8;}else{_0x39df43=0xce;}_0x28e35f[_0xfeb9('0x1a')](_0x39df43);return _0x28e35f[_0xfeb9('0x20')](_0xfeb9('0x21'),_0x4d1f81+'-'+_0x59d152+'/'+_0x159519)[_0xfeb9('0x1c')](_0x3b87ef);}return null;};}function patchUpdates(_0xf657cd){return function(_0x2c12a5){try{jsonpatch[_0xfeb9('0x22')](_0x2c12a5,_0xf657cd,!![]);}catch(_0x52be12){return BPromise[_0xfeb9('0x23')](_0x52be12);}return _0x2c12a5[_0xfeb9('0x24')]();};}function saveUpdates(_0x30c0c7,_0x4aa49d){return function(_0x1d79bd){if(_0x1d79bd){return _0x1d79bd[_0xfeb9('0x25')](_0x30c0c7)[_0xfeb9('0x26')](function(_0xeedae2){return _0xeedae2;});}return null;};}function removeEntity(_0x4f764b,_0x3a40f5){return function(_0x5ebc1d){if(_0x5ebc1d){return _0x5ebc1d['destroy']()[_0xfeb9('0x26')](function(){var _0x637ece=_0x5ebc1d[_0xfeb9('0x27')]({'plain':!![]});var _0xcc5196='ChanSpies';return db[_0xfeb9('0x28')][_0xfeb9('0x29')]({'where':{'type':_0xcc5196,'resourceId':_0x637ece['id']}})['then'](function(){return _0x5ebc1d;});})[_0xfeb9('0x26')](function(){_0x4f764b[_0xfeb9('0x1a')](0xcc)[_0xfeb9('0x1b')]();});}};}function handleEntityNotFound(_0x304b6d,_0x264523){return function(_0x586a95){if(!_0x586a95){_0x304b6d[_0xfeb9('0x19')](0x194);}return _0x586a95;};}function handleError(_0x4beb5e,_0x3e2772){_0x3e2772=_0x3e2772||0x1f4;return function(_0x8f90e){logger[_0xfeb9('0x2a')](_0x8f90e[_0xfeb9('0x2b')]);if(_0x8f90e['name']){delete _0x8f90e[_0xfeb9('0x2c')];}_0x4beb5e['status'](_0x3e2772)['send'](_0x8f90e);};}exports[_0xfeb9('0x2d')]=function(_0x5c806c,_0x295d64){var _0x3ffd01={},_0x3c3c7c={},_0x1728e9={'count':0x0,'rows':[]};var _0x1928de=_[_0xfeb9('0x2e')](db[_0xfeb9('0x2f')][_0xfeb9('0x30')],function(_0x301b2f){return{'name':_0x301b2f['fieldName'],'type':_0x301b2f[_0xfeb9('0x31')][_0xfeb9('0x32')]};});_0x3c3c7c['model']=_[_0xfeb9('0x2e')](_0x1928de,_0xfeb9('0x2c'));_0x3c3c7c[_0xfeb9('0x33')]=_[_0xfeb9('0x34')](_0x5c806c['query']);_0x3c3c7c[_0xfeb9('0x35')]=_['intersection'](_0x3c3c7c[_0xfeb9('0x36')],_0x3c3c7c[_0xfeb9('0x33')]);_0x3ffd01[_0xfeb9('0x37')]=_[_0xfeb9('0x38')](_0x3c3c7c[_0xfeb9('0x36')],qs['fields'](_0x5c806c[_0xfeb9('0x33')][_0xfeb9('0x39')]));_0x3ffd01[_0xfeb9('0x37')]=_0x3ffd01[_0xfeb9('0x37')][_0xfeb9('0x3a')]?_0x3ffd01[_0xfeb9('0x37')]:_0x3c3c7c['model'];if(!_0x5c806c[_0xfeb9('0x33')][_0xfeb9('0x3b')](_0xfeb9('0x3c'))){_0x3ffd01[_0xfeb9('0x1f')]=qs[_0xfeb9('0x1f')](_0x5c806c[_0xfeb9('0x33')][_0xfeb9('0x1f')]);_0x3ffd01[_0xfeb9('0x1e')]=qs[_0xfeb9('0x1e')](_0x5c806c[_0xfeb9('0x33')]['offset']);}_0x3ffd01['order']=qs[_0xfeb9('0x3d')](_0x5c806c[_0xfeb9('0x33')][_0xfeb9('0x3d')]);_0x3ffd01['where']=qs['filters'](_[_0xfeb9('0x3e')](_0x5c806c['query'],_0x3c3c7c[_0xfeb9('0x35')]),_0x1928de);if(_0x5c806c['query']['filter']){_0x3ffd01[_0xfeb9('0x3f')]=_[_0xfeb9('0x40')](_0x3ffd01[_0xfeb9('0x3f')],{'$or':_[_0xfeb9('0x2e')](_0x1928de,function(_0x41de3){if(_0x41de3['type']!==_0xfeb9('0x41')){var _0xb12c17={};_0xb12c17[_0x41de3['name']]={'$like':'%'+_0x5c806c[_0xfeb9('0x33')][_0xfeb9('0x42')]+'%'};return _0xb12c17;}})});}_0x3ffd01=_[_0xfeb9('0x40')]({},_0x3ffd01,_0x5c806c[_0xfeb9('0x43')]);var _0x8a8d1a={'where':_0x3ffd01[_0xfeb9('0x3f')]};return db[_0xfeb9('0x2f')]['count'](_0x8a8d1a)[_0xfeb9('0x26')](function(_0x31392b){_0x1728e9[_0xfeb9('0x1d')]=_0x31392b;if(_0x5c806c[_0xfeb9('0x33')][_0xfeb9('0x44')]){_0x3ffd01[_0xfeb9('0x45')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xfeb9('0x46')](_0x3ffd01);})['then'](function(_0x300aae){_0x1728e9[_0xfeb9('0x47')]=_0x300aae;return _0x1728e9;})['then'](respondWithFilteredResult(_0x295d64,_0x3ffd01))[_0xfeb9('0x48')](handleError(_0x295d64,null));};exports[_0xfeb9('0x49')]=function(_0x263a87,_0x548290){var _0x4bae2e={'raw':![],'where':{'id':_0x263a87['params']['id']}},_0x1dae4b={};_0x1dae4b[_0xfeb9('0x36')]=_['keys'](db[_0xfeb9('0x2f')][_0xfeb9('0x30')]);_0x1dae4b['query']=_[_0xfeb9('0x34')](_0x263a87['query']);_0x1dae4b[_0xfeb9('0x35')]=_[_0xfeb9('0x38')](_0x1dae4b[_0xfeb9('0x36')],_0x1dae4b[_0xfeb9('0x33')]);_0x4bae2e['attributes']=_[_0xfeb9('0x38')](_0x1dae4b[_0xfeb9('0x36')],qs[_0xfeb9('0x39')](_0x263a87[_0xfeb9('0x33')]['fields']));_0x4bae2e['attributes']=_0x4bae2e[_0xfeb9('0x37')]['length']?_0x4bae2e['attributes']:_0x1dae4b['model'];if(_0x263a87['query'][_0xfeb9('0x44')]){_0x4bae2e[_0xfeb9('0x45')]=[{'all':!![]}];}_0x4bae2e=_[_0xfeb9('0x40')]({},_0x4bae2e,_0x263a87['options']);return db[_0xfeb9('0x2f')]['find'](_0x4bae2e)['then'](handleEntityNotFound(_0x548290,null))['then'](respondWithResult(_0x548290,null))[_0xfeb9('0x48')](handleError(_0x548290,null));};exports['create']=function(_0x1edc62,_0x54d6af){return db['VoiceChanSpy'][_0xfeb9('0x4a')](_0x1edc62['body'],{})['then'](function(_0x1f092f){var _0x2c95b2=_0x1edc62[_0xfeb9('0x4b')]['get']({'plain':!![]});if(!_0x2c95b2)throw new Error(_0xfeb9('0x4c'));if(_0x2c95b2[_0xfeb9('0x4d')]===_0xfeb9('0x4b')){var _0x448c43=_0x1f092f[_0xfeb9('0x27')]({'plain':!![]});var _0x25d727='ChanSpies';return db[_0xfeb9('0x4e')][_0xfeb9('0x4f')]({'where':{'name':_0x25d727,'userProfileId':_0x2c95b2['userProfileId']},'raw':!![]})[_0xfeb9('0x26')](function(_0x5f5197){if(_0x5f5197&&_0x5f5197[_0xfeb9('0x50')]===0x0){return db[_0xfeb9('0x28')][_0xfeb9('0x4a')]({'name':_0x448c43[_0xfeb9('0x2c')],'resourceId':_0x448c43['id'],'type':_0x5f5197[_0xfeb9('0x2c')],'sectionId':_0x5f5197['id']},{})['then'](function(){return _0x1f092f;});}else{return _0x1f092f;}})['catch'](function(_0x4b9466){logger[_0xfeb9('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b9466);throw _0x4b9466;});}return _0x1f092f;})[_0xfeb9('0x26')](respondWithResult(_0x54d6af,0xc9))[_0xfeb9('0x48')](handleError(_0x54d6af,null));};exports[_0xfeb9('0x25')]=function(_0x469ca2,_0x295f27){if(_0x469ca2[_0xfeb9('0x51')]['id']){delete _0x469ca2['body']['id'];}return db[_0xfeb9('0x2f')][_0xfeb9('0x4f')]({'where':{'id':_0x469ca2[_0xfeb9('0x52')]['id']}})[_0xfeb9('0x26')](handleEntityNotFound(_0x295f27,null))[_0xfeb9('0x26')](saveUpdates(_0x469ca2[_0xfeb9('0x51')],null))[_0xfeb9('0x26')](respondWithResult(_0x295f27,null))[_0xfeb9('0x48')](handleError(_0x295f27,null));};exports['destroy']=function(_0x39149f,_0x90626d){return db['VoiceChanSpy']['find']({'where':{'id':_0x39149f[_0xfeb9('0x52')]['id']}})[_0xfeb9('0x26')](handleEntityNotFound(_0x90626d,null))[_0xfeb9('0x26')](removeEntity(_0x90626d,null))[_0xfeb9('0x48')](handleError(_0x90626d,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index dd4abf7..fe2caf0 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 _0xb6b1=['push','Set','CDR(type)=%s','chanspy','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','record','length','concat','internal','User','findAll','agent','then','catch','exports','define','VoiceExtension','bulkCreate','destroy','lodash','bluebird','context','from-sip','format','prefix'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0xb6b1[_0x1911ed];return _0x11edaa;};'use strict';var _=require(_0x1b6b('0x0'));var util=require('util');var BPromise=require(_0x1b6b('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0xede124,_0x29651a,_0x59b931){var _0x3f12e2=0x1;var _0x5100e5=[];var _0x2a2c45={'context':_0x29651a[_0x1b6b('0x2')]||_0x1b6b('0x3'),'exten':util[_0x1b6b('0x4')]('%s%s',_0xede124[_0x1b6b('0x5')],_0x59b931),'type':'system','isApp':![],'ChanSpyId':_0xede124['id'],'UserId':_0x29651a['id']};_0x5100e5[_0x1b6b('0x6')](_['merge']({'app':_0x1b6b('0x7'),'appdata':util[_0x1b6b('0x4')](_0x1b6b('0x8'),_0x1b6b('0x9')),'priority':_0x3f12e2++},_0x2a2c45));if(_0xede124['record']){_0x5100e5['push'](_[_0x1b6b('0xa')]({'app':_0x1b6b('0xb'),'appdata':util[_0x1b6b('0x4')](_0x1b6b('0xc'),_0xede124[_0x1b6b('0xd')]),'priority':_0x3f12e2++},_0x2a2c45));}if(_0xede124[_0x1b6b('0xe')]){_0x5100e5[_0x1b6b('0x6')](_['merge']({'app':_0x1b6b('0xf'),'appdata':_0xede124[_0x1b6b('0x10')],'priority':_0x3f12e2++},_0x2a2c45));}_0x5100e5[_0x1b6b('0x6')](_['merge']({'app':_0x1b6b('0x11'),'appdata':util['format']('SIP/%s,%s',_0x29651a[_0x1b6b('0x12')],_0xede124[_0x1b6b('0x13')]?_0xede124[_0x1b6b('0x13')][_0x1b6b('0x14')](''):''),'priority':_0x3f12e2++},_0x2a2c45));if(_0xede124[_0x1b6b('0x15')]){_0x5100e5[_0x1b6b('0x6')](_[_0x1b6b('0xa')]({'app':'StopMixMonitor','priority':_0x3f12e2++},_0x2a2c45));}return _0x5100e5;};var getChanSpyApplications=function(_0x1069a4,_0x251821){var _0x10af08=[];for(var _0x33dc7e=0x0,_0x56a4d1=0x1;_0x33dc7e<_0x251821[_0x1b6b('0x16')];_0x33dc7e++,_0x56a4d1=0x1){_0x10af08=_0x10af08[_0x1b6b('0x17')](getUserApplications(_0x1069a4,_0x251821[_0x33dc7e],_0x251821[_0x33dc7e][_0x1b6b('0x18')]));if(_0x251821[_0x33dc7e]['internal']!=_0x251821[_0x33dc7e][_0x1b6b('0x12')]){_0x10af08=_0x10af08[_0x1b6b('0x17')](getUserApplications(_0x1069a4,_0x251821[_0x33dc7e],_0x251821[_0x33dc7e][_0x1b6b('0x12')]));}}return _0x10af08;};var getChanSpyPromise=function(_0xcbac62,_0xacd21b){return new BPromise(function(_0xe720e7,_0x1b8a7e){return _0xcbac62[_0x1b6b('0x19')][_0x1b6b('0x1a')]({'attributes':['id',_0x1b6b('0x12'),'internal'],'where':{'role':_0x1b6b('0x1b'),'chanspy':!![]},'raw':!![]})[_0x1b6b('0x1c')](function(_0x3b427d){if(_0x3b427d){return _0xe720e7(getChanSpyApplications(_0xacd21b,_0x3b427d));}return _0xe720e7([]);})[_0x1b6b('0x1d')](function(_0x27974f){_0x1b8a7e(_0x27974f);});});};module[_0x1b6b('0x1e')]=function(_0x3d4ec2,_0xa12ff8){var _0x22f0b7=_0x3d4ec2['models'];return _0x3d4ec2[_0x1b6b('0x1f')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4cb089,_0x11449b,_0xc9554d){return getChanSpyPromise(_0x22f0b7,_0x4cb089)['then'](function(_0x6a317c){if(_0x6a317c&&_0x6a317c['length']){return _0x22f0b7[_0x1b6b('0x20')][_0x1b6b('0x21')](_0x6a317c);}})[_0x1b6b('0x1c')](function(){_0xc9554d();})[_0x1b6b('0x1d')](function(_0xd41b04){_0xc9554d(_0xd41b04);});},'afterUpdate':function(_0x2aa755,_0x5d0a0a,_0xe8b7b5){return _0x22f0b7[_0x1b6b('0x20')][_0x1b6b('0x22')]({'where':{'ChanSpyId':_0x2aa755['id']}})[_0x1b6b('0x1c')](function(){return getChanSpyPromise(_0x22f0b7,_0x2aa755);})['then'](function(_0x23dac4){if(_0x23dac4&&_0x23dac4['length']){return _0x22f0b7['VoiceExtension'][_0x1b6b('0x21')](_0x23dac4);}})['then'](function(){_0xe8b7b5();})[_0x1b6b('0x1d')](function(_0x5c6faa){_0xe8b7b5(_0x5c6faa);});},'afterDestroy':function(_0x4f89a9,_0x4c42a9,_0x36878c){return _0x22f0b7[_0x1b6b('0x20')]['destroy']({'where':{'ChanSpyId':_0x4f89a9['id']}})['then'](function(){_0x36878c();})[_0x1b6b('0x1d')](function(_0x1b407f){_0x36878c(_0x1b407f);});}}});}; \ No newline at end of file +var _0x86dd=['SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','models','VoiceChanSpy','voice_chanspy','then','VoiceExtension','destroy','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x86dd,0x1ee));var _0xd86d=function(_0x867c05,_0x1aebcc){_0x867c05=_0x867c05-0x0;var _0x342687=_0x86dd[_0x867c05];return _0x342687;};'use strict';var _=require('lodash');var util=require(_0xd86d('0x0'));var BPromise=require('bluebird');var attributes=require(_0xd86d('0x1'));var getUserApplications=function(_0x2cb4b4,_0x287d1d,_0x217373){var _0x17237d=0x1;var _0x30a31c=[];var _0x2e82a9={'context':_0x287d1d[_0xd86d('0x2')]||_0xd86d('0x3'),'exten':util[_0xd86d('0x4')](_0xd86d('0x5'),_0x2cb4b4[_0xd86d('0x6')],_0x217373),'type':'system','isApp':![],'ChanSpyId':_0x2cb4b4['id'],'UserId':_0x287d1d['id']};_0x30a31c[_0xd86d('0x7')](_[_0xd86d('0x8')]({'app':'Set','appdata':util[_0xd86d('0x4')](_0xd86d('0x9'),_0xd86d('0xa')),'priority':_0x17237d++},_0x2e82a9));if(_0x2cb4b4[_0xd86d('0xb')]){_0x30a31c['push'](_[_0xd86d('0x8')]({'app':_0xd86d('0xc'),'appdata':util[_0xd86d('0x4')](_0xd86d('0xd'),_0x2cb4b4['recordingFormat']),'priority':_0x17237d++},_0x2e82a9));}if(_0x2cb4b4['auth']){_0x30a31c[_0xd86d('0x7')](_[_0xd86d('0x8')]({'app':_0xd86d('0xe'),'appdata':_0x2cb4b4[_0xd86d('0xf')],'priority':_0x17237d++},_0x2e82a9));}_0x30a31c[_0xd86d('0x7')](_['merge']({'app':'ChanSpy','appdata':util['format'](_0xd86d('0x10'),_0x287d1d[_0xd86d('0x11')],_0x2cb4b4[_0xd86d('0x12')]?_0x2cb4b4[_0xd86d('0x12')][_0xd86d('0x13')](''):''),'priority':_0x17237d++},_0x2e82a9));if(_0x2cb4b4[_0xd86d('0xb')]){_0x30a31c[_0xd86d('0x7')](_['merge']({'app':_0xd86d('0x14'),'priority':_0x17237d++},_0x2e82a9));}return _0x30a31c;};var getChanSpyApplications=function(_0x2cc4d9,_0x38dc37){var _0x413fb8=[];for(var _0x34ee10=0x0,_0x26f3c4=0x1;_0x34ee10<_0x38dc37[_0xd86d('0x15')];_0x34ee10++,_0x26f3c4=0x1){_0x413fb8=_0x413fb8[_0xd86d('0x16')](getUserApplications(_0x2cc4d9,_0x38dc37[_0x34ee10],_0x38dc37[_0x34ee10][_0xd86d('0x17')]));if(_0x38dc37[_0x34ee10][_0xd86d('0x17')]!=_0x38dc37[_0x34ee10]['name']){_0x413fb8=_0x413fb8['concat'](getUserApplications(_0x2cc4d9,_0x38dc37[_0x34ee10],_0x38dc37[_0x34ee10][_0xd86d('0x11')]));}}return _0x413fb8;};var getChanSpyPromise=function(_0x1966e3,_0xb74a5f){return new BPromise(function(_0x573556,_0x32e816){return _0x1966e3[_0xd86d('0x18')][_0xd86d('0x19')]({'attributes':['id','name',_0xd86d('0x17')],'where':{'role':_0xd86d('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x384bb3){if(_0x384bb3){return _0x573556(getChanSpyApplications(_0xb74a5f,_0x384bb3));}return _0x573556([]);})[_0xd86d('0x1b')](function(_0x74f57e){_0x32e816(_0x74f57e);});});};module['exports']=function(_0x2faef6,_0x30c0f1){var _0xdc92c1=_0x2faef6[_0xd86d('0x1c')];return _0x2faef6['define'](_0xd86d('0x1d'),attributes,{'tableName':_0xd86d('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e1ea3,_0x59f60e,_0x5497e5){return getChanSpyPromise(_0xdc92c1,_0x5e1ea3)[_0xd86d('0x1f')](function(_0x5d0e0c){if(_0x5d0e0c&&_0x5d0e0c[_0xd86d('0x15')]){return _0xdc92c1['VoiceExtension']['bulkCreate'](_0x5d0e0c);}})[_0xd86d('0x1f')](function(){_0x5497e5();})[_0xd86d('0x1b')](function(_0x48dd45){_0x5497e5(_0x48dd45);});},'afterUpdate':function(_0x1da491,_0x4ce504,_0x38e4b3){return _0xdc92c1['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x1da491['id']}})['then'](function(){return getChanSpyPromise(_0xdc92c1,_0x1da491);})['then'](function(_0x345bb7){if(_0x345bb7&&_0x345bb7['length']){return _0xdc92c1[_0xd86d('0x20')]['bulkCreate'](_0x345bb7);}})[_0xd86d('0x1f')](function(){_0x38e4b3();})[_0xd86d('0x1b')](function(_0x2626d6){_0x38e4b3(_0x2626d6);});},'afterDestroy':function(_0x320cfa,_0x5e02a9,_0x2be14e){return _0xdc92c1[_0xd86d('0x20')][_0xd86d('0x21')]({'where':{'ChanSpyId':_0x320cfa['id']}})[_0xd86d('0x1f')](function(){_0x2be14e();})[_0xd86d('0x1b')](function(_0x15cbe0){_0x2be14e(_0x15cbe0);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 28b8f3c..660d38f 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 _0x4d6d=['util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','http','then','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash'];(function(_0x17479d,_0x46cec2){var _0x17bd4b=function(_0xcdde4d){while(--_0xcdde4d){_0x17479d['push'](_0x17479d['shift']());}};_0x17bd4b(++_0x46cec2);}(_0x4d6d,0x97));var _0xd4d6=function(_0x1fa44e,_0x5d3bc3){_0x1fa44e=_0x1fa44e-0x0;var _0x2c0611=_0x4d6d[_0x1fa44e];return _0x2c0611;};'use strict';var _=require(_0xd4d6('0x0'));var util=require(_0xd4d6('0x1'));var moment=require(_0xd4d6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4d6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4d6('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xd4d6('0x5'));var jayson=require(_0xd4d6('0x6'));var client=jayson['client'][_0xd4d6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe6a7b,_0x40cf00,_0x59aec1){return new BPromise(function(_0x133d52,_0x4f8b9c){return client['request'](_0xe6a7b,_0x59aec1)[_0xd4d6('0x8')](function(_0x513575){logger['info'](_0xd4d6('0x9'),_0x40cf00,'request\x20sent');logger[_0xd4d6('0xa')](_0xd4d6('0xb'),_0x40cf00,_0xd4d6('0xc'),JSON['stringify'](_0x513575));if(_0x513575[_0xd4d6('0xd')]){if(_0x513575[_0xd4d6('0xd')][_0xd4d6('0xe')]===0x1f4){logger['error'](_0xd4d6('0x9'),_0x40cf00,_0x513575['error'][_0xd4d6('0xf')]);return _0x4f8b9c(_0x513575[_0xd4d6('0xd')][_0xd4d6('0xf')]);}logger[_0xd4d6('0xd')](_0xd4d6('0x9'),_0x40cf00,_0x513575['error'][_0xd4d6('0xf')]);return _0x133d52(_0x513575['error']['message']);}else{logger[_0xd4d6('0x10')](_0xd4d6('0x9'),_0x40cf00,_0xd4d6('0xc'));_0x133d52(_0x513575[_0xd4d6('0x11')][_0xd4d6('0xf')]);}})[_0xd4d6('0x12')](function(_0x21c592){logger['error'](_0xd4d6('0x9'),_0x40cf00,_0x21c592);_0x4f8b9c(_0x21c592);});});} \ No newline at end of file +var _0x8129=['request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x310000,_0x27c276){var _0xdef369=function(_0x368c6a){while(--_0x368c6a){_0x310000['push'](_0x310000['shift']());}};_0xdef369(++_0x27c276);}(_0x8129,0x171));var _0x9812=function(_0x53cd4b,_0x23a05d){_0x53cd4b=_0x53cd4b-0x0;var _0x554659=_0x8129[_0x53cd4b];return _0x554659;};'use strict';var _=require('lodash');var util=require(_0x9812('0x0'));var moment=require('moment');var BPromise=require(_0x9812('0x1'));var rs=require(_0x9812('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9812('0x3'))['db'];var utils=require(_0x9812('0x4'));var logger=require(_0x9812('0x5'))('rpc');var config=require(_0x9812('0x6'));var jayson=require(_0x9812('0x7'));var client=jayson[_0x9812('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a3c3a,_0x1adc73,_0x30f891){return new BPromise(function(_0x28ca42,_0x4ef567){return client['request'](_0x4a3c3a,_0x30f891)[_0x9812('0x9')](function(_0x228b45){logger['info'](_0x9812('0xa'),_0x1adc73,_0x9812('0xb'));logger[_0x9812('0xc')](_0x9812('0xd'),_0x1adc73,_0x9812('0xb'),JSON[_0x9812('0xe')](_0x228b45));if(_0x228b45[_0x9812('0xf')]){if(_0x228b45[_0x9812('0xf')][_0x9812('0x10')]===0x1f4){logger[_0x9812('0xf')](_0x9812('0xa'),_0x1adc73,_0x228b45[_0x9812('0xf')][_0x9812('0x11')]);return _0x4ef567(_0x228b45[_0x9812('0xf')][_0x9812('0x11')]);}logger[_0x9812('0xf')](_0x9812('0xa'),_0x1adc73,_0x228b45[_0x9812('0xf')]['message']);return _0x28ca42(_0x228b45[_0x9812('0xf')][_0x9812('0x11')]);}else{logger[_0x9812('0x12')](_0x9812('0xa'),_0x1adc73,_0x9812('0xb'));_0x28ca42(_0x228b45['result'][_0x9812('0x11')]);}})[_0x9812('0x13')](function(_0x1e777d){logger[_0x9812('0xf')](_0x9812('0xa'),_0x1adc73,_0x1e777d);_0x4ef567(_0x1e777d);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 3e309dd..91e2d26 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 _0x373e=['Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports','multer','util','express'];(function(_0xd79ee7,_0x21a851){var _0x4cee30=function(_0x7abac2){while(--_0x7abac2){_0xd79ee7['push'](_0xd79ee7['shift']());}};_0x4cee30(++_0x21a851);}(_0x373e,0x1d9));var _0xe373=function(_0x32010b,_0x318a31){_0x32010b=_0x32010b-0x0;var _0x22b7bc=_0x373e[_0x32010b];return _0x22b7bc;};'use strict';var multer=require(_0xe373('0x0'));var util=require(_0xe373('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe373('0x2'));var router=express[_0xe373('0x3')]();var auth=require(_0xe373('0x4'));var interaction=require(_0xe373('0x5'));var config=require('../../config/environment');var controller=require(_0xe373('0x6'));router['get']('/',auth[_0xe373('0x7')](),controller['index']);router[_0xe373('0x8')](_0xe373('0x9'),auth['isAuthenticated'](),controller[_0xe373('0xa')]);router[_0xe373('0xb')]('/',auth['isAuthenticated'](),controller[_0xe373('0xc')]);router[_0xe373('0xd')](_0xe373('0x9'),auth['isAuthenticated'](),controller[_0xe373('0xe')]);router['delete'](_0xe373('0x9'),auth[_0xe373('0x7')](),controller[_0xe373('0xf')]);module[_0xe373('0x10')]=router; \ No newline at end of file +var _0x0c46=['update','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','get','/:id','show','post','put'];(function(_0x1fa410,_0x236d6a){var _0x1ad4a5=function(_0x1c0f81){while(--_0x1c0f81){_0x1fa410['push'](_0x1fa410['shift']());}};_0x1ad4a5(++_0x236d6a);}(_0x0c46,0x1d0));var _0x60c4=function(_0x1bff18,_0x384e39){_0x1bff18=_0x1bff18-0x0;var _0x24521e=_0x0c46[_0x1bff18];return _0x24521e;};'use strict';var multer=require(_0x60c4('0x0'));var util=require(_0x60c4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x60c4('0x2'));var interaction=require(_0x60c4('0x3'));var config=require(_0x60c4('0x4'));var controller=require(_0x60c4('0x5'));router['get']('/',auth[_0x60c4('0x6')](),controller['index']);router[_0x60c4('0x7')](_0x60c4('0x8'),auth[_0x60c4('0x6')](),controller[_0x60c4('0x9')]);router[_0x60c4('0xa')]('/',auth[_0x60c4('0x6')](),controller['create']);router[_0x60c4('0xb')](_0x60c4('0x8'),auth['isAuthenticated'](),controller[_0x60c4('0xc')]);router['delete'](_0x60c4('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x60c4('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 1efb0cd..d2484f4 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(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0x3e74,0x175));var _0x43e7=function(_0x56ab66,_0x237423){_0x56ab66=_0x56ab66-0x0;var _0x36bcd1=_0x3e74[_0x56ab66];return _0x36bcd1;};'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 _0x9c44=['BOOLEAN','STRING','name'];(function(_0x53584f,_0x3f8215){var _0x24507d=function(_0x1cf14a){while(--_0x1cf14a){_0x53584f['push'](_0x53584f['shift']());}};_0x24507d(++_0x3f8215);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1')},'description':{'type':Sequelize[_0x49c4('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x49c4('0x2')],'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 d1ae718..cbad3cf 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 _0x593e=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','offset','limit','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','VoiceContext','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','count','includeAll','include','findAll','rows','show','keys','fields','merge','options','find','catch','create','body','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readFileSync','chan_sip.so','/etc/asterisk/extensions_xcally_contexts.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x1be300,_0x399dd7){var _0x4fb74b=function(_0xac528b){while(--_0xac528b){_0x1be300['push'](_0x1be300['shift']());}};_0x4fb74b(++_0x399dd7);}(_0x593e,0xcb));var _0xe593=function(_0x323209,_0x2f86d7){_0x323209=_0x323209-0x0;var _0xf2b3a3=_0x593e[_0x323209];return _0xf2b3a3;};'use strict';var pdf=require(_0xe593('0x0'));var emlformat=require(_0xe593('0x1'));var rimraf=require(_0xe593('0x2'));var zipdir=require(_0xe593('0x3'));var jsonpatch=require(_0xe593('0x4'));var rp=require(_0xe593('0x5'));var moment=require(_0xe593('0x6'));var BPromise=require(_0xe593('0x7'));var Mustache=require('mustache');var util=require(_0xe593('0x8'));var path=require(_0xe593('0x9'));var sox=require(_0xe593('0xa'));var csv=require(_0xe593('0xb'));var ejs=require(_0xe593('0xc'));var fs=require('fs');var _=require(_0xe593('0xd'));var squel=require(_0xe593('0xe'));var crypto=require(_0xe593('0xf'));var jsforce=require(_0xe593('0x10'));var deskjs=require(_0xe593('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe593('0x12'));var Papa=require(_0xe593('0x13'));var Redis=require(_0xe593('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe593('0x15'));var hardwareService=require(_0xe593('0x16'));var logger=require(_0xe593('0x17'))('api');var utils=require(_0xe593('0x18'));var config=require(_0xe593('0x19'));var licenseUtil=require(_0xe593('0x1a'));var db=require(_0xe593('0x1b'))['db'];var jayson=require(_0xe593('0x1c'));var client=jayson[_0xe593('0x1d')][_0xe593('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xa4d5e9,_0x328a5a,_0x15813c,_0x499819){return new BPromise(function(_0x2907e4,_0x1de391){var _0x59f7c4=_0x499819||client;return _0x59f7c4[_0xe593('0x1f')](_0xa4d5e9,_0x15813c)[_0xe593('0x20')](function(_0x5d4c6a){logger[_0xe593('0x21')](_0xe593('0x22'),_0x328a5a,_0xe593('0x23'));logger[_0xe593('0x24')](_0xe593('0x25'),_0x328a5a,_0xe593('0x23'),JSON['stringify'](_0x5d4c6a));if(_0x5d4c6a[_0xe593('0x26')]){if(_0x5d4c6a[_0xe593('0x26')]['code']===0x1f4){logger[_0xe593('0x26')](_0xe593('0x22'),_0x328a5a,_0x5d4c6a['error'][_0xe593('0x27')]);return _0x1de391(_0x5d4c6a[_0xe593('0x26')][_0xe593('0x27')]);}logger[_0xe593('0x26')](_0xe593('0x22'),_0x328a5a,_0x5d4c6a[_0xe593('0x26')][_0xe593('0x27')]);return _0x2907e4(_0x5d4c6a['error']['message']);}else{logger[_0xe593('0x21')]('VoiceContext,\x20%s,\x20%s',_0x328a5a,'request\x20sent');_0x2907e4(_0x5d4c6a[_0xe593('0x28')][_0xe593('0x27')]);}})['catch'](function(_0xf57cc4){logger['error'](_0xe593('0x22'),_0x328a5a,_0xf57cc4);_0x1de391(_0xf57cc4);});});}function respondWithStatusCode(_0x2c191f,_0x185cea){_0x185cea=_0x185cea||0xcc;return function(_0x44d997){if(_0x44d997){return _0x2c191f[_0xe593('0x29')](_0x185cea);}return _0x2c191f[_0xe593('0x2a')](_0x185cea)[_0xe593('0x2b')]();};}function respondWithResult(_0xb7636c,_0x4fc483){_0x4fc483=_0x4fc483||0xc8;return function(_0x47aea){if(_0x47aea){return _0xb7636c[_0xe593('0x2a')](_0x4fc483)['json'](_0x47aea);}};}function respondWithFilteredResult(_0x59bd4c,_0xf8d492){return function(_0x25238f){if(_0x25238f){var _0x21eefc=_0x25238f['count'],_0x43699d=_0xf8d492[_0xe593('0x2c')],_0x3b66bc=_0xf8d492['offset']+_0xf8d492[_0xe593('0x2d')],_0x27a3d2;if(_0x3b66bc>=_0x21eefc){_0x3b66bc=_0x21eefc;_0x27a3d2=0xc8;}else{_0x27a3d2=0xce;}_0x59bd4c[_0xe593('0x2a')](_0x27a3d2);return _0x59bd4c['set'](_0xe593('0x2e'),_0x43699d+'-'+_0x3b66bc+'/'+_0x21eefc)['json'](_0x25238f);}return null;};}function patchUpdates(_0x44a68c){return function(_0x1c147b){try{jsonpatch[_0xe593('0x2f')](_0x1c147b,_0x44a68c,!![]);}catch(_0x501e54){return BPromise[_0xe593('0x30')](_0x501e54);}return _0x1c147b[_0xe593('0x31')]();};}function saveUpdates(_0x3066ed,_0x338222){return function(_0x2588be){if(_0x2588be){return _0x2588be[_0xe593('0x32')](_0x3066ed)[_0xe593('0x20')](function(_0x4efc93){return _0x4efc93;});}return null;};}function removeEntity(_0x4098a9,_0xc23a2f){return function(_0x4e8448){if(_0x4e8448){return _0x4e8448[_0xe593('0x33')]()['then'](function(){var _0x11a643=_0x4e8448[_0xe593('0x34')]({'plain':!![]});var _0x1a84b7=_0xe593('0x35');return db[_0xe593('0x36')][_0xe593('0x33')]({'where':{'type':_0x1a84b7,'resourceId':_0x11a643['id']}})[_0xe593('0x20')](function(){return _0x4e8448;});})[_0xe593('0x20')](function(){_0x4098a9[_0xe593('0x2a')](0xcc)[_0xe593('0x2b')]();});}};}function handleEntityNotFound(_0x4d3fab,_0x27a563){return function(_0x2c0a30){if(!_0x2c0a30){_0x4d3fab[_0xe593('0x29')](0x194);}return _0x2c0a30;};}function handleError(_0x5a55c0,_0x4fefb3){_0x4fefb3=_0x4fefb3||0x1f4;return function(_0x3e3453){logger['error'](_0x3e3453[_0xe593('0x37')]);if(_0x3e3453[_0xe593('0x38')]){delete _0x3e3453[_0xe593('0x38')];}_0x5a55c0[_0xe593('0x2a')](_0x4fefb3)[_0xe593('0x39')](_0x3e3453);};}exports[_0xe593('0x3a')]=function(_0xd0d282,_0x4889cc){var _0x5112c1={},_0x8c6ea5={},_0x4cf9e8={'count':0x0,'rows':[]};var _0x32bc16=_['map'](db[_0xe593('0x3b')]['rawAttributes'],function(_0x5b31d1){return{'name':_0x5b31d1[_0xe593('0x3c')],'type':_0x5b31d1[_0xe593('0x3d')][_0xe593('0x3e')]};});_0x8c6ea5['model']=_['map'](_0x32bc16,'name');_0x8c6ea5[_0xe593('0x3f')]=_['keys'](_0xd0d282[_0xe593('0x3f')]);_0x8c6ea5[_0xe593('0x40')]=_[_0xe593('0x41')](_0x8c6ea5[_0xe593('0x42')],_0x8c6ea5['query']);_0x5112c1[_0xe593('0x43')]=_['intersection'](_0x8c6ea5[_0xe593('0x42')],qs['fields'](_0xd0d282['query']['fields']));_0x5112c1[_0xe593('0x43')]=_0x5112c1['attributes'][_0xe593('0x44')]?_0x5112c1[_0xe593('0x43')]:_0x8c6ea5[_0xe593('0x42')];if(!_0xd0d282['query'][_0xe593('0x45')](_0xe593('0x46'))){_0x5112c1[_0xe593('0x2d')]=qs[_0xe593('0x2d')](_0xd0d282[_0xe593('0x3f')][_0xe593('0x2d')]);_0x5112c1[_0xe593('0x2c')]=qs[_0xe593('0x2c')](_0xd0d282['query'][_0xe593('0x2c')]);}_0x5112c1[_0xe593('0x47')]=qs[_0xe593('0x48')](_0xd0d282[_0xe593('0x3f')][_0xe593('0x48')]);_0x5112c1['where']=qs['filters'](_[_0xe593('0x49')](_0xd0d282[_0xe593('0x3f')],_0x8c6ea5[_0xe593('0x40')]),_0x32bc16);if(_0xd0d282['query'][_0xe593('0x4a')]){_0x5112c1[_0xe593('0x4b')]=_['merge'](_0x5112c1['where'],{'$or':_[_0xe593('0x4c')](_0x32bc16,function(_0x245eea){if(_0x245eea[_0xe593('0x3d')]!=='VIRTUAL'){var _0x2e88bf={};_0x2e88bf[_0x245eea[_0xe593('0x38')]]={'$like':'%'+_0xd0d282[_0xe593('0x3f')][_0xe593('0x4a')]+'%'};return _0x2e88bf;}})});}_0x5112c1=_['merge']({},_0x5112c1,_0xd0d282['options']);var _0x4a7434={'where':_0x5112c1['where']};return db[_0xe593('0x3b')]['count'](_0x4a7434)[_0xe593('0x20')](function(_0xd016b3){_0x4cf9e8[_0xe593('0x4d')]=_0xd016b3;if(_0xd0d282[_0xe593('0x3f')][_0xe593('0x4e')]){_0x5112c1[_0xe593('0x4f')]=[{'all':!![]}];}return db[_0xe593('0x3b')][_0xe593('0x50')](_0x5112c1);})['then'](function(_0x3dbb46){_0x4cf9e8[_0xe593('0x51')]=_0x3dbb46;return _0x4cf9e8;})[_0xe593('0x20')](respondWithFilteredResult(_0x4889cc,_0x5112c1))['catch'](handleError(_0x4889cc,null));};exports[_0xe593('0x52')]=function(_0x5dfdb1,_0x39ec9e){var _0x14d846={'raw':![],'where':{'id':_0x5dfdb1['params']['id']}},_0x238181={};_0x238181['model']=_[_0xe593('0x53')](db[_0xe593('0x3b')]['rawAttributes']);_0x238181['query']=_['keys'](_0x5dfdb1['query']);_0x238181['filters']=_[_0xe593('0x41')](_0x238181[_0xe593('0x42')],_0x238181[_0xe593('0x3f')]);_0x14d846[_0xe593('0x43')]=_[_0xe593('0x41')](_0x238181[_0xe593('0x42')],qs[_0xe593('0x54')](_0x5dfdb1[_0xe593('0x3f')][_0xe593('0x54')]));_0x14d846[_0xe593('0x43')]=_0x14d846[_0xe593('0x43')][_0xe593('0x44')]?_0x14d846[_0xe593('0x43')]:_0x238181[_0xe593('0x42')];if(_0x5dfdb1[_0xe593('0x3f')][_0xe593('0x4e')]){_0x14d846['include']=[{'all':!![]}];}_0x14d846=_[_0xe593('0x55')]({},_0x14d846,_0x5dfdb1[_0xe593('0x56')]);return db[_0xe593('0x3b')][_0xe593('0x57')](_0x14d846)[_0xe593('0x20')](handleEntityNotFound(_0x39ec9e,null))[_0xe593('0x20')](respondWithResult(_0x39ec9e,null))[_0xe593('0x58')](handleError(_0x39ec9e,null));};exports[_0xe593('0x59')]=function(_0x2cf746,_0x355feb,_0x37373c){var _0x41ad5d;return db[_0xe593('0x3b')][_0xe593('0x59')](_0x2cf746[_0xe593('0x5a')],{'raw':!![]})['then'](function(_0x11bf50){_0x41ad5d=_0x11bf50;return db[_0xe593('0x3b')][_0xe593('0x50')]({'raw':!![]});})[_0xe593('0x20')](function(_0x3d6ed8){var _0x5e1972=fs['readFileSync'](path[_0xe593('0x5b')](config[_0xe593('0x5c')],_0xe593('0x5d')),_0xe593('0x5e'));var _0x1b5643=ejs[_0xe593('0x5f')](_0x5e1972,{'contexts':_0x3d6ed8||[]});fs[_0xe593('0x60')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1b5643);})['then'](function(){return respondWithRpcPromise(_0xe593('0x61'),_0xe593('0x59'),{'module':'chan_sip.so'});})[_0xe593('0x20')](function(){var _0xf8ed1d=_0x2cf746[_0xe593('0x62')][_0xe593('0x34')]({'plain':!![]});if(!_0xf8ed1d)throw new Error(_0xe593('0x63'));if(_0xf8ed1d[_0xe593('0x64')]===_0xe593('0x62')){var _0x3b8b19=_0x41ad5d[_0xe593('0x34')]({'plain':!![]});return db[_0xe593('0x65')]['find']({'where':{'name':_0xe593('0x35'),'userProfileId':_0xf8ed1d[_0xe593('0x66')]},'raw':!![]})[_0xe593('0x20')](function(_0x1f1096){if(_0x1f1096&&_0x1f1096[_0xe593('0x67')]===0x0){return db[_0xe593('0x36')][_0xe593('0x59')]({'name':_0x3b8b19['name'],'resourceId':_0x3b8b19['id'],'type':_0x1f1096[_0xe593('0x38')],'sectionId':_0x1f1096['id']},{})[_0xe593('0x20')](function(){return _0x41ad5d;});}else{return _0x41ad5d;}})[_0xe593('0x58')](function(_0x14f8e1){logger['error'](_0xe593('0x68'),_0x14f8e1);throw _0x14f8e1;});}return _0x41ad5d;})[_0xe593('0x20')](respondWithResult(_0x355feb,0xc9))[_0xe593('0x58')](handleError(_0x355feb,null));};exports[_0xe593('0x32')]=function(_0x377137,_0x54a89d,_0x366dec){var _0x2cca0b;return db[_0xe593('0x3b')][_0xe593('0x57')]({'where':{'id':_0x377137[_0xe593('0x69')]['id']}})[_0xe593('0x20')](handleEntityNotFound(_0x54a89d,null))[_0xe593('0x20')](saveUpdates(_0x377137[_0xe593('0x5a')],null))['then'](function(_0x2145c0){if(_0x2145c0){_0x2cca0b=_0x2145c0;return db[_0xe593('0x3b')][_0xe593('0x50')]({'raw':!![]});}})[_0xe593('0x20')](function(_0x42edd2){var _0x9f1813=fs[_0xe593('0x6a')](path[_0xe593('0x5b')](config[_0xe593('0x5c')],_0xe593('0x5d')),'utf8');var _0x190e90=ejs[_0xe593('0x5f')](_0x9f1813,{'contexts':_0x42edd2||[]});fs[_0xe593('0x60')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x190e90);})[_0xe593('0x20')](function(){return respondWithRpcPromise(_0xe593('0x61'),_0xe593('0x32'),{'module':_0xe593('0x6b')});})[_0xe593('0x20')](function(){return _0x2cca0b;})['then'](respondWithResult(_0x54a89d,null))[_0xe593('0x58')](handleError(_0x54a89d,null));};exports[_0xe593('0x33')]=function(_0x4c652e,_0x1fb621,_0x344804){var _0x19b360;return db[_0xe593('0x3b')]['find']({'where':{'id':_0x4c652e[_0xe593('0x69')]['id']}})[_0xe593('0x20')](handleEntityNotFound(_0x1fb621,null))[_0xe593('0x20')](removeEntity(_0x1fb621,null))['then'](function(){return db[_0xe593('0x3b')][_0xe593('0x50')]({'raw':!![]});})[_0xe593('0x20')](function(_0x5bbf3d){var _0xb6846a=fs[_0xe593('0x6a')](path[_0xe593('0x5b')](config[_0xe593('0x5c')],_0xe593('0x5d')),'utf8');var _0x2f81d2=ejs[_0xe593('0x5f')](_0xb6846a,{'contexts':_0x5bbf3d});fs[_0xe593('0x60')](_0xe593('0x6c'),_0x2f81d2);return respondWithRpcPromise(_0xe593('0x61'),_0xe593('0x33'),{'module':_0xe593('0x6b')});})[_0xe593('0x58')](handleError(_0x1fb621,null));}; \ No newline at end of file +var _0x4517=['code','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','destroy','Contexts','UserProfileResource','stack','name','send','VoiceContext','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','length','find','catch','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','writeFileSync','eml-format','rimraf','fast-json-patch','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/license/hardware','../../config/logger','api','../../config/license/util','jayson/promise','client','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4517,0x112));var _0x7451=function(_0x44ab81,_0x42e1c7){_0x44ab81=_0x44ab81-0x0;var _0x3e69b9=_0x4517[_0x44ab81];return _0x3e69b9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7451('0x0'));var rimraf=require(_0x7451('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7451('0x2'));var rp=require(_0x7451('0x3'));var moment=require(_0x7451('0x4'));var BPromise=require(_0x7451('0x5'));var Mustache=require(_0x7451('0x6'));var util=require(_0x7451('0x7'));var path=require(_0x7451('0x8'));var sox=require(_0x7451('0x9'));var csv=require(_0x7451('0xa'));var ejs=require(_0x7451('0xb'));var fs=require('fs');var _=require(_0x7451('0xc'));var squel=require(_0x7451('0xd'));var crypto=require(_0x7451('0xe'));var jsforce=require(_0x7451('0xf'));var deskjs=require(_0x7451('0x10'));var toCsv=require(_0x7451('0xa'));var querystring=require(_0x7451('0x11'));var Papa=require('papaparse');var Redis=require(_0x7451('0x12'));var authService=require(_0x7451('0x13'));var qs=require(_0x7451('0x14'));var as=require(_0x7451('0x15'));var hardwareService=require(_0x7451('0x16'));var logger=require(_0x7451('0x17'))(_0x7451('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7451('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7451('0x1a'));var client=jayson[_0x7451('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7cb990,_0x38129d,_0x4dbe5b,_0x46811e){return new BPromise(function(_0x282128,_0x110ed6){var _0x187e87=_0x46811e||client;return _0x187e87['request'](_0x7cb990,_0x4dbe5b)[_0x7451('0x1c')](function(_0x313385){logger[_0x7451('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x38129d,'request\x20sent');logger[_0x7451('0x1e')](_0x7451('0x1f'),_0x38129d,_0x7451('0x20'),JSON[_0x7451('0x21')](_0x313385));if(_0x313385[_0x7451('0x22')]){if(_0x313385[_0x7451('0x22')][_0x7451('0x23')]===0x1f4){logger[_0x7451('0x22')](_0x7451('0x24'),_0x38129d,_0x313385['error'][_0x7451('0x25')]);return _0x110ed6(_0x313385[_0x7451('0x22')][_0x7451('0x25')]);}logger['error'](_0x7451('0x24'),_0x38129d,_0x313385[_0x7451('0x22')][_0x7451('0x25')]);return _0x282128(_0x313385[_0x7451('0x22')][_0x7451('0x25')]);}else{logger[_0x7451('0x1d')](_0x7451('0x24'),_0x38129d,'request\x20sent');_0x282128(_0x313385[_0x7451('0x26')][_0x7451('0x25')]);}})['catch'](function(_0x406b03){logger[_0x7451('0x22')](_0x7451('0x24'),_0x38129d,_0x406b03);_0x110ed6(_0x406b03);});});}function respondWithStatusCode(_0x57cc15,_0x19e33b){_0x19e33b=_0x19e33b||0xcc;return function(_0x21dd67){if(_0x21dd67){return _0x57cc15[_0x7451('0x27')](_0x19e33b);}return _0x57cc15[_0x7451('0x28')](_0x19e33b)[_0x7451('0x29')]();};}function respondWithResult(_0x4650a5,_0x3c56f1){_0x3c56f1=_0x3c56f1||0xc8;return function(_0xdfc7d1){if(_0xdfc7d1){return _0x4650a5[_0x7451('0x28')](_0x3c56f1)['json'](_0xdfc7d1);}};}function respondWithFilteredResult(_0x328d0b,_0x2b8a8b){return function(_0x5df311){if(_0x5df311){var _0x54bef8=_0x5df311[_0x7451('0x2a')],_0xcc793e=_0x2b8a8b[_0x7451('0x2b')],_0x1edcf2=_0x2b8a8b[_0x7451('0x2b')]+_0x2b8a8b['limit'],_0x248d83;if(_0x1edcf2>=_0x54bef8){_0x1edcf2=_0x54bef8;_0x248d83=0xc8;}else{_0x248d83=0xce;}_0x328d0b[_0x7451('0x28')](_0x248d83);return _0x328d0b['set'](_0x7451('0x2c'),_0xcc793e+'-'+_0x1edcf2+'/'+_0x54bef8)[_0x7451('0x2d')](_0x5df311);}return null;};}function patchUpdates(_0x4d99f3){return function(_0x7da05a){try{jsonpatch[_0x7451('0x2e')](_0x7da05a,_0x4d99f3,!![]);}catch(_0x40b6c3){return BPromise[_0x7451('0x2f')](_0x40b6c3);}return _0x7da05a[_0x7451('0x30')]();};}function saveUpdates(_0x4e24f7,_0x2071e5){return function(_0x43d305){if(_0x43d305){return _0x43d305[_0x7451('0x31')](_0x4e24f7)['then'](function(_0x2be408){return _0x2be408;});}return null;};}function removeEntity(_0x4654e7,_0x5dfc5e){return function(_0x4caef4){if(_0x4caef4){return _0x4caef4[_0x7451('0x32')]()[_0x7451('0x1c')](function(){var _0x55a458=_0x4caef4['get']({'plain':!![]});var _0x295a1e=_0x7451('0x33');return db[_0x7451('0x34')][_0x7451('0x32')]({'where':{'type':_0x295a1e,'resourceId':_0x55a458['id']}})[_0x7451('0x1c')](function(){return _0x4caef4;});})[_0x7451('0x1c')](function(){_0x4654e7[_0x7451('0x28')](0xcc)[_0x7451('0x29')]();});}};}function handleEntityNotFound(_0x48f29a,_0x33f1fe){return function(_0x11aead){if(!_0x11aead){_0x48f29a['sendStatus'](0x194);}return _0x11aead;};}function handleError(_0x2f5328,_0x1ee26b){_0x1ee26b=_0x1ee26b||0x1f4;return function(_0x463708){logger[_0x7451('0x22')](_0x463708[_0x7451('0x35')]);if(_0x463708[_0x7451('0x36')]){delete _0x463708['name'];}_0x2f5328[_0x7451('0x28')](_0x1ee26b)[_0x7451('0x37')](_0x463708);};}exports['index']=function(_0x1313e7,_0x143e82){var _0x4e761d={},_0x5820e2={},_0x59393b={'count':0x0,'rows':[]};var _0x54b60f=_['map'](db[_0x7451('0x38')][_0x7451('0x39')],function(_0x3647f8){return{'name':_0x3647f8[_0x7451('0x3a')],'type':_0x3647f8[_0x7451('0x3b')]['key']};});_0x5820e2['model']=_['map'](_0x54b60f,'name');_0x5820e2['query']=_[_0x7451('0x3c')](_0x1313e7[_0x7451('0x3d')]);_0x5820e2[_0x7451('0x3e')]=_[_0x7451('0x3f')](_0x5820e2[_0x7451('0x40')],_0x5820e2[_0x7451('0x3d')]);_0x4e761d[_0x7451('0x41')]=_[_0x7451('0x3f')](_0x5820e2[_0x7451('0x40')],qs[_0x7451('0x42')](_0x1313e7[_0x7451('0x3d')]['fields']));_0x4e761d['attributes']=_0x4e761d[_0x7451('0x41')]['length']?_0x4e761d[_0x7451('0x41')]:_0x5820e2[_0x7451('0x40')];if(!_0x1313e7['query']['hasOwnProperty'](_0x7451('0x43'))){_0x4e761d['limit']=qs[_0x7451('0x44')](_0x1313e7['query'][_0x7451('0x44')]);_0x4e761d[_0x7451('0x2b')]=qs['offset'](_0x1313e7[_0x7451('0x3d')]['offset']);}_0x4e761d[_0x7451('0x45')]=qs[_0x7451('0x46')](_0x1313e7[_0x7451('0x3d')][_0x7451('0x46')]);_0x4e761d[_0x7451('0x47')]=qs[_0x7451('0x3e')](_[_0x7451('0x48')](_0x1313e7[_0x7451('0x3d')],_0x5820e2[_0x7451('0x3e')]),_0x54b60f);if(_0x1313e7[_0x7451('0x3d')][_0x7451('0x49')]){_0x4e761d[_0x7451('0x47')]=_[_0x7451('0x4a')](_0x4e761d[_0x7451('0x47')],{'$or':_['map'](_0x54b60f,function(_0x437f9c){if(_0x437f9c[_0x7451('0x3b')]!==_0x7451('0x4b')){var _0x6aa375={};_0x6aa375[_0x437f9c['name']]={'$like':'%'+_0x1313e7[_0x7451('0x3d')]['filter']+'%'};return _0x6aa375;}})});}_0x4e761d=_['merge']({},_0x4e761d,_0x1313e7['options']);var _0x545685={'where':_0x4e761d['where']};return db[_0x7451('0x38')][_0x7451('0x2a')](_0x545685)[_0x7451('0x1c')](function(_0x489d7d){_0x59393b[_0x7451('0x2a')]=_0x489d7d;if(_0x1313e7[_0x7451('0x3d')][_0x7451('0x4c')]){_0x4e761d[_0x7451('0x4d')]=[{'all':!![]}];}return db[_0x7451('0x38')][_0x7451('0x4e')](_0x4e761d);})[_0x7451('0x1c')](function(_0x875a40){_0x59393b[_0x7451('0x4f')]=_0x875a40;return _0x59393b;})['then'](respondWithFilteredResult(_0x143e82,_0x4e761d))['catch'](handleError(_0x143e82,null));};exports['show']=function(_0xd26beb,_0x3acf1d){var _0x1d4c05={'raw':![],'where':{'id':_0xd26beb['params']['id']}},_0x4c9d33={};_0x4c9d33['model']=_[_0x7451('0x3c')](db['VoiceContext']['rawAttributes']);_0x4c9d33[_0x7451('0x3d')]=_[_0x7451('0x3c')](_0xd26beb[_0x7451('0x3d')]);_0x4c9d33[_0x7451('0x3e')]=_[_0x7451('0x3f')](_0x4c9d33['model'],_0x4c9d33[_0x7451('0x3d')]);_0x1d4c05['attributes']=_[_0x7451('0x3f')](_0x4c9d33[_0x7451('0x40')],qs[_0x7451('0x42')](_0xd26beb[_0x7451('0x3d')][_0x7451('0x42')]));_0x1d4c05[_0x7451('0x41')]=_0x1d4c05[_0x7451('0x41')][_0x7451('0x50')]?_0x1d4c05[_0x7451('0x41')]:_0x4c9d33['model'];if(_0xd26beb['query'][_0x7451('0x4c')]){_0x1d4c05[_0x7451('0x4d')]=[{'all':!![]}];}_0x1d4c05=_['merge']({},_0x1d4c05,_0xd26beb['options']);return db['VoiceContext'][_0x7451('0x51')](_0x1d4c05)[_0x7451('0x1c')](handleEntityNotFound(_0x3acf1d,null))[_0x7451('0x1c')](respondWithResult(_0x3acf1d,null))[_0x7451('0x52')](handleError(_0x3acf1d,null));};exports[_0x7451('0x53')]=function(_0x9f5737,_0x5acbab,_0x1f0886){var _0x4f14e6;return db['VoiceContext']['create'](_0x9f5737[_0x7451('0x54')],{'raw':!![]})[_0x7451('0x1c')](function(_0x2548be){_0x4f14e6=_0x2548be;return db[_0x7451('0x38')][_0x7451('0x4e')]({'raw':!![]});})[_0x7451('0x1c')](function(_0x36add5){var _0x49f320=fs[_0x7451('0x55')](path[_0x7451('0x56')](config[_0x7451('0x57')],_0x7451('0x58')),_0x7451('0x59'));var _0xd943e3=ejs[_0x7451('0x5a')](_0x49f320,{'contexts':_0x36add5||[]});fs['writeFileSync'](_0x7451('0x5b'),_0xd943e3);})[_0x7451('0x1c')](function(){return respondWithRpcPromise(_0x7451('0x5c'),_0x7451('0x53'),{'module':_0x7451('0x5d')});})[_0x7451('0x1c')](function(){var _0x53db81=_0x9f5737[_0x7451('0x5e')]['get']({'plain':!![]});if(!_0x53db81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53db81[_0x7451('0x5f')]===_0x7451('0x5e')){var _0xf71422=_0x4f14e6[_0x7451('0x60')]({'plain':!![]});return db[_0x7451('0x61')][_0x7451('0x51')]({'where':{'name':'Contexts','userProfileId':_0x53db81[_0x7451('0x62')]},'raw':!![]})['then'](function(_0x31df11){if(_0x31df11&&_0x31df11[_0x7451('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0xf71422['name'],'resourceId':_0xf71422['id'],'type':_0x31df11['name'],'sectionId':_0x31df11['id']},{})[_0x7451('0x1c')](function(){return _0x4f14e6;});}else{return _0x4f14e6;}})[_0x7451('0x52')](function(_0x1a78d8){logger[_0x7451('0x22')](_0x7451('0x64'),_0x1a78d8);throw _0x1a78d8;});}return _0x4f14e6;})[_0x7451('0x1c')](respondWithResult(_0x5acbab,0xc9))['catch'](handleError(_0x5acbab,null));};exports[_0x7451('0x31')]=function(_0x49a1c9,_0x3b4548,_0x407e3e){var _0x184574;return db['VoiceContext']['find']({'where':{'id':_0x49a1c9[_0x7451('0x65')]['id']}})[_0x7451('0x1c')](handleEntityNotFound(_0x3b4548,null))[_0x7451('0x1c')](saveUpdates(_0x49a1c9[_0x7451('0x54')],null))[_0x7451('0x1c')](function(_0xefb808){if(_0xefb808){_0x184574=_0xefb808;return db[_0x7451('0x38')][_0x7451('0x4e')]({'raw':!![]});}})[_0x7451('0x1c')](function(_0xe02d16){var _0x491d3a=fs['readFileSync'](path[_0x7451('0x56')](config[_0x7451('0x57')],_0x7451('0x58')),'utf8');var _0x34f507=ejs[_0x7451('0x5a')](_0x491d3a,{'contexts':_0xe02d16||[]});fs[_0x7451('0x66')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x34f507);})[_0x7451('0x1c')](function(){return respondWithRpcPromise(_0x7451('0x5c'),'update',{'module':'chan_sip.so'});})[_0x7451('0x1c')](function(){return _0x184574;})[_0x7451('0x1c')](respondWithResult(_0x3b4548,null))['catch'](handleError(_0x3b4548,null));};exports[_0x7451('0x32')]=function(_0x2870ed,_0x4bb953,_0x574b12){var _0x53e12a;return db[_0x7451('0x38')][_0x7451('0x51')]({'where':{'id':_0x2870ed[_0x7451('0x65')]['id']}})[_0x7451('0x1c')](handleEntityNotFound(_0x4bb953,null))[_0x7451('0x1c')](removeEntity(_0x4bb953,null))[_0x7451('0x1c')](function(){return db[_0x7451('0x38')][_0x7451('0x4e')]({'raw':!![]});})[_0x7451('0x1c')](function(_0x44e656){var _0x2550d4=fs[_0x7451('0x55')](path[_0x7451('0x56')](config['root'],_0x7451('0x58')),_0x7451('0x59'));var _0x212a47=ejs[_0x7451('0x5a')](_0x2550d4,{'contexts':_0x44e656});fs['writeFileSync'](_0x7451('0x5b'),_0x212a47);return respondWithRpcPromise('Reload','destroy',{'module':_0x7451('0x5d')});})[_0x7451('0x52')](handleError(_0x4bb953,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 0ce412e..337e8af 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 _0xfa7a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash'];(function(_0x3cbcd1,_0x43d6bd){var _0x479abd=function(_0x29813a){while(--_0x29813a){_0x3cbcd1['push'](_0x3cbcd1['shift']());}};_0x479abd(++_0x43d6bd);}(_0xfa7a,0x6f));var _0xafa7=function(_0x5f37a1,_0x414d5c){_0x5f37a1=_0x5f37a1-0x0;var _0x409100=_0xfa7a[_0x5f37a1];return _0x409100;};'use strict';var _=require(_0xafa7('0x0'));var util=require(_0xafa7('0x1'));var logger=require(_0xafa7('0x2'))(_0xafa7('0x3'));var moment=require(_0xafa7('0x4'));var BPromise=require(_0xafa7('0x5'));var rp=require(_0xafa7('0x6'));var fs=require('fs');var path=require(_0xafa7('0x7'));var rimraf=require(_0xafa7('0x8'));var config=require('../../config/environment');var attributes=require(_0xafa7('0x9'));module[_0xafa7('0xa')]=function(_0x3e87f3,_0x1eef0b){return _0x3e87f3[_0xafa7('0xb')](_0xafa7('0xc'),attributes,{'tableName':_0xafa7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66d2=['VoiceContext','voice_contexts','lodash','util','../../config/logger','moment','../../config/environment','exports','define'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0x66d2,0x107));var _0x266d=function(_0x2471df,_0x1d255f){_0x2471df=_0x2471df-0x0;var _0x58af9a=_0x66d2[_0x2471df];return _0x58af9a;};'use strict';var _=require(_0x266d('0x0'));var util=require(_0x266d('0x1'));var logger=require(_0x266d('0x2'))('api');var moment=require(_0x266d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x266d('0x4'));var attributes=require('./voiceContext.attributes');module[_0x266d('0x5')]=function(_0x424c36,_0x17856a){return _0x424c36[_0x266d('0x6')](_0x266d('0x7'),attributes,{'tableName':_0x266d('0x8'),'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 033bac1..0bea649 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 _0x73bd=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x243522,_0x823d90){var _0x39df0a=function(_0x214a53){while(--_0x214a53){_0x243522['push'](_0x243522['shift']());}};_0x39df0a(++_0x823d90);}(_0x73bd,0x1f0));var _0xd73b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x73bd[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xd73b('0x0'));var util=require(_0xd73b('0x1'));var moment=require('moment');var BPromise=require(_0xd73b('0x2'));var rs=require(_0xd73b('0x3'));var fs=require('fs');var Redis=require(_0xd73b('0x4'));var db=require(_0xd73b('0x5'))['db'];var utils=require(_0xd73b('0x6'));var logger=require('../../config/logger')(_0xd73b('0x7'));var config=require(_0xd73b('0x8'));var jayson=require(_0xd73b('0x9'));var client=jayson[_0xd73b('0xa')][_0xd73b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5980d7,_0x5a3a57,_0x3d545c){return new BPromise(function(_0x2efe69,_0x1a7d12){return client[_0xd73b('0xc')](_0x5980d7,_0x3d545c)[_0xd73b('0xd')](function(_0x1ad73f){logger['info']('VoiceContext,\x20%s,\x20%s',_0x5a3a57,_0xd73b('0xe'));logger['debug'](_0xd73b('0xf'),_0x5a3a57,_0xd73b('0xe'),JSON[_0xd73b('0x10')](_0x1ad73f));if(_0x1ad73f[_0xd73b('0x11')]){if(_0x1ad73f[_0xd73b('0x11')][_0xd73b('0x12')]===0x1f4){logger[_0xd73b('0x11')](_0xd73b('0x13'),_0x5a3a57,_0x1ad73f[_0xd73b('0x11')][_0xd73b('0x14')]);return _0x1a7d12(_0x1ad73f[_0xd73b('0x11')][_0xd73b('0x14')]);}logger[_0xd73b('0x11')](_0xd73b('0x13'),_0x5a3a57,_0x1ad73f[_0xd73b('0x11')][_0xd73b('0x14')]);return _0x2efe69(_0x1ad73f[_0xd73b('0x11')]['message']);}else{logger[_0xd73b('0x15')](_0xd73b('0x13'),_0x5a3a57,'request\x20sent');_0x2efe69(_0x1ad73f[_0xd73b('0x16')]['message']);}})[_0xd73b('0x17')](function(_0x30b97c){logger['error'](_0xd73b('0x13'),_0x5a3a57,_0x30b97c);_0x1a7d12(_0x30b97c);});});} \ No newline at end of file +var _0x88b5=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x30d04c,_0x5bd2a7){var _0x131ae7=function(_0x39c739){while(--_0x39c739){_0x30d04c['push'](_0x30d04c['shift']());}};_0x131ae7(++_0x5bd2a7);}(_0x88b5,0x17a));var _0x588b=function(_0x5c886a,_0x4e7410){_0x5c886a=_0x5c886a-0x0;var _0x12c5eb=_0x88b5[_0x5c886a];return _0x12c5eb;};'use strict';var _=require(_0x588b('0x0'));var util=require('util');var moment=require(_0x588b('0x1'));var BPromise=require(_0x588b('0x2'));var rs=require(_0x588b('0x3'));var fs=require('fs');var Redis=require(_0x588b('0x4'));var db=require(_0x588b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x588b('0x6'))('rpc');var config=require(_0x588b('0x7'));var jayson=require(_0x588b('0x8'));var client=jayson[_0x588b('0x9')][_0x588b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x534125,_0x173ba,_0x437497){return new BPromise(function(_0x5457b6,_0x57e352){return client[_0x588b('0xb')](_0x534125,_0x437497)['then'](function(_0x24fe7b){logger[_0x588b('0xc')](_0x588b('0xd'),_0x173ba,_0x588b('0xe'));logger[_0x588b('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x173ba,'request\x20sent',JSON[_0x588b('0x10')](_0x24fe7b));if(_0x24fe7b[_0x588b('0x11')]){if(_0x24fe7b['error'][_0x588b('0x12')]===0x1f4){logger['error'](_0x588b('0xd'),_0x173ba,_0x24fe7b[_0x588b('0x11')]['message']);return _0x57e352(_0x24fe7b['error']['message']);}logger[_0x588b('0x11')](_0x588b('0xd'),_0x173ba,_0x24fe7b['error'][_0x588b('0x13')]);return _0x5457b6(_0x24fe7b[_0x588b('0x11')][_0x588b('0x13')]);}else{logger[_0x588b('0xc')](_0x588b('0xd'),_0x173ba,_0x588b('0xe'));_0x5457b6(_0x24fe7b['result'][_0x588b('0x13')]);}})[_0x588b('0x14')](function(_0x1cd47a){logger[_0x588b('0x11')](_0x588b('0xd'),_0x173ba,_0x1cd47a);_0x57e352(_0x1cd47a);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 81b5be5..f9a5b3d 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 _0xae96=['show','post','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0xbdedcd,_0x4064d8){var _0x32d3d1=function(_0x5059fe){while(--_0x5059fe){_0xbdedcd['push'](_0xbdedcd['shift']());}};_0x32d3d1(++_0x4064d8);}(_0xae96,0xe3));var _0x6ae9=function(_0x43636d,_0x28c626){_0x43636d=_0x43636d-0x0;var _0x43584f=_0xae96[_0x43636d];return _0x43584f;};'use strict';var multer=require(_0x6ae9('0x0'));var util=require(_0x6ae9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6ae9('0x2'));var router=express[_0x6ae9('0x3')]();var auth=require(_0x6ae9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6ae9('0x5'));var controller=require(_0x6ae9('0x6'));router[_0x6ae9('0x7')]('/',auth[_0x6ae9('0x8')](),controller[_0x6ae9('0x9')]);router[_0x6ae9('0x7')](_0x6ae9('0xa'),auth['isAuthenticated'](),controller[_0x6ae9('0xb')]);router['get'](_0x6ae9('0xc'),auth['isAuthenticated'](),controller[_0x6ae9('0xd')]);router[_0x6ae9('0xe')]('/',auth['isAuthenticated'](),controller[_0x6ae9('0xf')]);router['put'](_0x6ae9('0xc'),auth[_0x6ae9('0x8')](),controller[_0x6ae9('0x10')]);router[_0x6ae9('0x11')](_0x6ae9('0xc'),auth[_0x6ae9('0x8')](),controller[_0x6ae9('0x12')]);module[_0x6ae9('0x13')]=router; \ No newline at end of file +var _0x87f4=['exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','/describe','describe','get','show','create','put','/:id','update','delete','destroy'];(function(_0x5ca705,_0x1d603d){var _0x34658b=function(_0x10c49f){while(--_0x10c49f){_0x5ca705['push'](_0x5ca705['shift']());}};_0x34658b(++_0x1d603d);}(_0x87f4,0x1a5));var _0x487f=function(_0x19df8e,_0xc8482){_0x19df8e=_0x19df8e-0x0;var _0x378598=_0x87f4[_0x19df8e];return _0x378598;};'use strict';var multer=require(_0x487f('0x0'));var util=require('util');var path=require(_0x487f('0x1'));var timeout=require('connect-timeout');var express=require(_0x487f('0x2'));var router=express[_0x487f('0x3')]();var auth=require(_0x487f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x487f('0x5'));var controller=require(_0x487f('0x6'));router['get']('/',auth[_0x487f('0x7')](),controller[_0x487f('0x8')]);router['get'](_0x487f('0x9'),auth[_0x487f('0x7')](),controller[_0x487f('0xa')]);router[_0x487f('0xb')]('/:id',auth[_0x487f('0x7')](),controller[_0x487f('0xc')]);router['post']('/',auth[_0x487f('0x7')](),controller[_0x487f('0xd')]);router[_0x487f('0xe')](_0x487f('0xf'),auth[_0x487f('0x7')](),controller[_0x487f('0x10')]);router[_0x487f('0x11')](_0x487f('0xf'),auth[_0x487f('0x7')](),controller[_0x487f('0x12')]);module[_0x487f('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 3faa93b..b8f5094 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 _0xbbbc=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xbbbc,0x1c7));var _0xcbbb=function(_0x301df1,_0x3088ad){_0x301df1=_0x301df1-0x0;var _0x12e408=_0xbbbc[_0x301df1];return _0x12e408;};'use strict';var Sequelize=require(_0xcbbb('0x0'));module[_0xcbbb('0x1')]={'privilege':{'type':Sequelize[_0xcbbb('0x2')]},'channel':{'type':Sequelize[_0xcbbb('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xcbbb('0x2')]},'calleridnum':{'type':Sequelize[_0xcbbb('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xcbbb('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xcbbb('0x2')]},'accountcode':{'type':Sequelize[_0xcbbb('0x2')]},'context':{'type':Sequelize[_0xcbbb('0x2')]},'exten':{'type':Sequelize[_0xcbbb('0x2')]},'priority':{'type':Sequelize[_0xcbbb('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xcbbb('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xcbbb('0x2')]},'destcalleridnum':{'type':Sequelize[_0xcbbb('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xcbbb('0x2')]},'destaccountcode':{'type':Sequelize[_0xcbbb('0x2')]},'destcontext':{'type':Sequelize[_0xcbbb('0x2')]},'destexten':{'type':Sequelize[_0xcbbb('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xcbbb('0x2')]},'destlinkedid':{'type':Sequelize[_0xcbbb('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xcbbb('0x4')]},'answertime':{'type':Sequelize[_0xcbbb('0x4')]},'endtime':{'type':Sequelize[_0xcbbb('0x4')]},'lastevent':{'type':Sequelize[_0xcbbb('0x2')],'comment':_0xcbbb('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xcbbb('0x3')]},'holdtime':{'type':Sequelize[_0xcbbb('0x3')]},'billableseconds':{'type':Sequelize[_0xcbbb('0x3')]}}; \ No newline at end of file +var _0xabce=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x47ce6c,_0x5d347a){var _0x20bf52=function(_0x259c3b){while(--_0x259c3b){_0x47ce6c['push'](_0x47ce6c['shift']());}};_0x20bf52(++_0x5d347a);}(_0xabce,0x68));var _0xeabc=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xabce[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'privilege':{'type':Sequelize[_0xeabc('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xeabc('0x3')]},'channelstatedesc':{'type':Sequelize[_0xeabc('0x2')]},'calleridnum':{'type':Sequelize[_0xeabc('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xeabc('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xeabc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xeabc('0x2')]},'exten':{'type':Sequelize[_0xeabc('0x2')]},'priority':{'type':Sequelize[_0xeabc('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xeabc('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xeabc('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xeabc('0x2')]},'destcalleridnum':{'type':Sequelize[_0xeabc('0x2')]},'destcalleridname':{'type':Sequelize[_0xeabc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xeabc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xeabc('0x2')]},'destlanguage':{'type':Sequelize[_0xeabc('0x2')]},'destaccountcode':{'type':Sequelize[_0xeabc('0x2')]},'destcontext':{'type':Sequelize[_0xeabc('0x2')]},'destexten':{'type':Sequelize[_0xeabc('0x2')]},'destpriority':{'type':Sequelize[_0xeabc('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xeabc('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xeabc('0x4')]},'answertime':{'type':Sequelize[_0xeabc('0x4')]},'endtime':{'type':Sequelize[_0xeabc('0x4')]},'lastevent':{'type':Sequelize[_0xeabc('0x2')],'comment':_0xeabc('0x5')},'routeId':{'type':Sequelize[_0xeabc('0x3')]},'duration':{'type':Sequelize[_0xeabc('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 92ad446..1f99e12 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 _0xf291=['keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','find','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','send','index','map','VoiceDialReport','fieldName','key','name','query'];(function(_0xc0c370,_0x11f465){var _0x367a77=function(_0x331e0a){while(--_0x331e0a){_0xc0c370['push'](_0xc0c370['shift']());}};_0x367a77(++_0x11f465);}(_0xf291,0x6a));var _0x1f29=function(_0x1ca373,_0x2c03b9){_0x1ca373=_0x1ca373-0x0;var _0x3779c6=_0xf291[_0x1ca373];return _0x3779c6;};'use strict';var pdf=require(_0x1f29('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1f29('0x1'));var jsonpatch=require(_0x1f29('0x2'));var rp=require(_0x1f29('0x3'));var moment=require(_0x1f29('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1f29('0x5'));var util=require(_0x1f29('0x6'));var path=require('path');var sox=require(_0x1f29('0x7'));var csv=require(_0x1f29('0x8'));var ejs=require(_0x1f29('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1f29('0xa'));var crypto=require(_0x1f29('0xb'));var jsforce=require(_0x1f29('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1f29('0x8'));var querystring=require(_0x1f29('0xd'));var Papa=require(_0x1f29('0xe'));var Redis=require(_0x1f29('0xf'));var authService=require(_0x1f29('0x10'));var qs=require(_0x1f29('0x11'));var as=require(_0x1f29('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1f29('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1f29('0x14'));var db=require(_0x1f29('0x15'))['db'];function respondWithStatusCode(_0x3ff979,_0x858a1c){_0x858a1c=_0x858a1c||0xcc;return function(_0x2eaae4){if(_0x2eaae4){return _0x3ff979[_0x1f29('0x16')](_0x858a1c);}return _0x3ff979[_0x1f29('0x17')](_0x858a1c)[_0x1f29('0x18')]();};}function respondWithResult(_0x139a0b,_0x411a95){_0x411a95=_0x411a95||0xc8;return function(_0x2b3977){if(_0x2b3977){return _0x139a0b[_0x1f29('0x17')](_0x411a95)['json'](_0x2b3977);}};}function respondWithFilteredResult(_0x4ff67d,_0xc98995){return function(_0x20f5f4){if(_0x20f5f4){var _0x336583=_0x20f5f4['count'],_0x2110ef=_0xc98995[_0x1f29('0x19')],_0x321573=_0xc98995[_0x1f29('0x19')]+_0xc98995['limit'],_0x4b518d;if(_0x321573>=_0x336583){_0x321573=_0x336583;_0x4b518d=0xc8;}else{_0x4b518d=0xce;}_0x4ff67d[_0x1f29('0x17')](_0x4b518d);return _0x4ff67d[_0x1f29('0x1a')](_0x1f29('0x1b'),_0x2110ef+'-'+_0x321573+'/'+_0x336583)[_0x1f29('0x1c')](_0x20f5f4);}return null;};}function patchUpdates(_0x30368d){return function(_0x4ccac0){try{jsonpatch[_0x1f29('0x1d')](_0x4ccac0,_0x30368d,!![]);}catch(_0x16eec1){return BPromise['reject'](_0x16eec1);}return _0x4ccac0[_0x1f29('0x1e')]();};}function saveUpdates(_0x3399a7,_0x33e1f5){return function(_0x573fb2){if(_0x573fb2){return _0x573fb2[_0x1f29('0x1f')](_0x3399a7)[_0x1f29('0x20')](function(_0x10937e){return _0x10937e;});}return null;};}function removeEntity(_0x54e432,_0x1e6e12){return function(_0x21dccd){if(_0x21dccd){return _0x21dccd[_0x1f29('0x21')]()[_0x1f29('0x20')](function(){_0x54e432['status'](0xcc)[_0x1f29('0x18')]();});}};}function handleEntityNotFound(_0xe44779,_0x1c788c){return function(_0x5386dd){if(!_0x5386dd){_0xe44779['sendStatus'](0x194);}return _0x5386dd;};}function handleError(_0x5bd252,_0x726538){_0x726538=_0x726538||0x1f4;return function(_0x59a3d9){logger[_0x1f29('0x22')](_0x59a3d9[_0x1f29('0x23')]);if(_0x59a3d9['name']){delete _0x59a3d9['name'];}_0x5bd252[_0x1f29('0x17')](_0x726538)[_0x1f29('0x24')](_0x59a3d9);};}exports[_0x1f29('0x25')]=function(_0x1db474,_0x504b70){var _0x363dec={},_0x34af9d={},_0x3b5851={'count':0x0,'rows':[]};var _0x1a35b5=_[_0x1f29('0x26')](db[_0x1f29('0x27')]['rawAttributes'],function(_0x4ad390){return{'name':_0x4ad390[_0x1f29('0x28')],'type':_0x4ad390['type'][_0x1f29('0x29')]};});_0x34af9d['model']=_[_0x1f29('0x26')](_0x1a35b5,_0x1f29('0x2a'));_0x34af9d[_0x1f29('0x2b')]=_[_0x1f29('0x2c')](_0x1db474[_0x1f29('0x2b')]);_0x34af9d[_0x1f29('0x2d')]=_[_0x1f29('0x2e')](_0x34af9d[_0x1f29('0x2f')],_0x34af9d[_0x1f29('0x2b')]);_0x363dec[_0x1f29('0x30')]=_[_0x1f29('0x2e')](_0x34af9d[_0x1f29('0x2f')],qs[_0x1f29('0x31')](_0x1db474[_0x1f29('0x2b')][_0x1f29('0x31')]));_0x363dec[_0x1f29('0x30')]=_0x363dec['attributes'][_0x1f29('0x32')]?_0x363dec[_0x1f29('0x30')]:_0x34af9d[_0x1f29('0x2f')];if(!_0x1db474['query'][_0x1f29('0x33')](_0x1f29('0x34'))){_0x363dec[_0x1f29('0x35')]=qs[_0x1f29('0x35')](_0x1db474[_0x1f29('0x2b')][_0x1f29('0x35')]);_0x363dec[_0x1f29('0x19')]=qs[_0x1f29('0x19')](_0x1db474['query'][_0x1f29('0x19')]);}_0x363dec['order']=qs[_0x1f29('0x36')](_0x1db474['query']['sort']);_0x363dec[_0x1f29('0x37')]=qs[_0x1f29('0x2d')](_[_0x1f29('0x38')](_0x1db474[_0x1f29('0x2b')],_0x34af9d[_0x1f29('0x2d')]),_0x1a35b5);if(_0x1db474[_0x1f29('0x2b')][_0x1f29('0x39')]){_0x363dec[_0x1f29('0x37')]=_[_0x1f29('0x3a')](_0x363dec['where'],{'$or':_[_0x1f29('0x26')](_0x1a35b5,function(_0x166076){if(_0x166076[_0x1f29('0x3b')]!==_0x1f29('0x3c')){var _0x100a53={};_0x100a53[_0x166076[_0x1f29('0x2a')]]={'$like':'%'+_0x1db474[_0x1f29('0x2b')][_0x1f29('0x39')]+'%'};return _0x100a53;}})});}_0x363dec=_['merge']({},_0x363dec,_0x1db474[_0x1f29('0x3d')]);var _0x272afc={'where':_0x363dec[_0x1f29('0x37')]};return db[_0x1f29('0x27')][_0x1f29('0x3e')](_0x272afc)[_0x1f29('0x20')](function(_0xc7839c){_0x3b5851[_0x1f29('0x3e')]=_0xc7839c;if(_0x1db474[_0x1f29('0x2b')][_0x1f29('0x3f')]){_0x363dec[_0x1f29('0x40')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x1f29('0x41')](_0x363dec);})[_0x1f29('0x20')](function(_0x159361){_0x3b5851[_0x1f29('0x42')]=_0x159361;return _0x3b5851;})['then'](respondWithFilteredResult(_0x504b70,_0x363dec))['catch'](handleError(_0x504b70,null));};exports[_0x1f29('0x43')]=function(_0x3d845f,_0x2d7552){var _0x2350af={'raw':!![],'where':{'id':_0x3d845f[_0x1f29('0x44')]['id']}},_0x3a8831={};_0x3a8831[_0x1f29('0x2f')]=_[_0x1f29('0x2c')](db[_0x1f29('0x27')][_0x1f29('0x45')]);_0x3a8831[_0x1f29('0x2b')]=_[_0x1f29('0x2c')](_0x3d845f[_0x1f29('0x2b')]);_0x3a8831[_0x1f29('0x2d')]=_[_0x1f29('0x2e')](_0x3a8831['model'],_0x3a8831[_0x1f29('0x2b')]);_0x2350af[_0x1f29('0x30')]=_[_0x1f29('0x2e')](_0x3a8831['model'],qs[_0x1f29('0x31')](_0x3d845f[_0x1f29('0x2b')][_0x1f29('0x31')]));_0x2350af[_0x1f29('0x30')]=_0x2350af[_0x1f29('0x30')][_0x1f29('0x32')]?_0x2350af['attributes']:_0x3a8831['model'];if(_0x3d845f['query'][_0x1f29('0x3f')]){_0x2350af[_0x1f29('0x40')]=[{'all':!![]}];}_0x2350af=_[_0x1f29('0x3a')]({},_0x2350af,_0x3d845f[_0x1f29('0x3d')]);return db['VoiceDialReport']['find'](_0x2350af)[_0x1f29('0x20')](handleEntityNotFound(_0x2d7552,null))['then'](respondWithResult(_0x2d7552,null))[_0x1f29('0x46')](handleError(_0x2d7552,null));};exports[_0x1f29('0x47')]=function(_0x456534,_0x2b95bb){return db[_0x1f29('0x27')][_0x1f29('0x47')](_0x456534['body'],{})['then'](respondWithResult(_0x2b95bb,0xc9))[_0x1f29('0x46')](handleError(_0x2b95bb,null));};exports[_0x1f29('0x1f')]=function(_0x3e140e,_0x5e524b){if(_0x3e140e[_0x1f29('0x48')]['id']){delete _0x3e140e[_0x1f29('0x48')]['id'];}return db['VoiceDialReport'][_0x1f29('0x49')]({'where':{'id':_0x3e140e[_0x1f29('0x44')]['id']}})[_0x1f29('0x20')](handleEntityNotFound(_0x5e524b,null))[_0x1f29('0x20')](saveUpdates(_0x3e140e[_0x1f29('0x48')],null))[_0x1f29('0x20')](respondWithResult(_0x5e524b,null))[_0x1f29('0x46')](handleError(_0x5e524b,null));};exports[_0x1f29('0x21')]=function(_0x3d751c,_0x47d853){return db[_0x1f29('0x27')][_0x1f29('0x49')]({'where':{'id':_0x3d751c[_0x1f29('0x44')]['id']}})[_0x1f29('0x20')](handleEntityNotFound(_0x47d853,null))[_0x1f29('0x20')](removeEntity(_0x47d853,null))[_0x1f29('0x46')](handleError(_0x47d853,null));};exports[_0x1f29('0x4a')]=function(_0x46b5b3,_0x2f53cf){return db[_0x1f29('0x27')][_0x1f29('0x4a')]()[_0x1f29('0x20')](respondWithResult(_0x2f53cf,null))['catch'](handleError(_0x2f53cf,null));}; \ No newline at end of file +var _0x3c70=['VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','then','include','findAll','show','params','options','find','catch','create','update','body','html-pdf','eml-format','rimraf','request-promise','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','save','destroy','sendStatus','error','stack','name','send','index','map'];(function(_0x2ab857,_0x31e9b6){var _0x46270e=function(_0x122978){while(--_0x122978){_0x2ab857['push'](_0x2ab857['shift']());}};_0x46270e(++_0x31e9b6);}(_0x3c70,0xf0));var _0x03c7=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x3c70[_0x376b45];return _0x2341b3;};'use strict';var pdf=require(_0x03c7('0x0'));var emlformat=require(_0x03c7('0x1'));var rimraf=require(_0x03c7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x03c7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x03c7('0x4'));var path=require('path');var sox=require(_0x03c7('0x5'));var csv=require(_0x03c7('0x6'));var ejs=require(_0x03c7('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x03c7('0x8'));var crypto=require('crypto');var jsforce=require(_0x03c7('0x9'));var deskjs=require(_0x03c7('0xa'));var toCsv=require(_0x03c7('0x6'));var querystring=require(_0x03c7('0xb'));var Papa=require(_0x03c7('0xc'));var Redis=require('ioredis');var authService=require(_0x03c7('0xd'));var qs=require(_0x03c7('0xe'));var as=require(_0x03c7('0xf'));var hardwareService=require(_0x03c7('0x10'));var logger=require(_0x03c7('0x11'))('api');var utils=require(_0x03c7('0x12'));var config=require(_0x03c7('0x13'));var licenseUtil=require(_0x03c7('0x14'));var db=require(_0x03c7('0x15'))['db'];function respondWithStatusCode(_0xd1fbd8,_0x335d15){_0x335d15=_0x335d15||0xcc;return function(_0x370337){if(_0x370337){return _0xd1fbd8['sendStatus'](_0x335d15);}return _0xd1fbd8[_0x03c7('0x16')](_0x335d15)[_0x03c7('0x17')]();};}function respondWithResult(_0x4ccd0d,_0x57aefa){_0x57aefa=_0x57aefa||0xc8;return function(_0x3ccea4){if(_0x3ccea4){return _0x4ccd0d[_0x03c7('0x16')](_0x57aefa)['json'](_0x3ccea4);}};}function respondWithFilteredResult(_0x5646e1,_0x4db03a){return function(_0x1d6325){if(_0x1d6325){var _0x1ba2d4=_0x1d6325[_0x03c7('0x18')],_0x30e3cb=_0x4db03a[_0x03c7('0x19')],_0x453261=_0x4db03a[_0x03c7('0x19')]+_0x4db03a[_0x03c7('0x1a')],_0x575512;if(_0x453261>=_0x1ba2d4){_0x453261=_0x1ba2d4;_0x575512=0xc8;}else{_0x575512=0xce;}_0x5646e1[_0x03c7('0x16')](_0x575512);return _0x5646e1[_0x03c7('0x1b')](_0x03c7('0x1c'),_0x30e3cb+'-'+_0x453261+'/'+_0x1ba2d4)[_0x03c7('0x1d')](_0x1d6325);}return null;};}function patchUpdates(_0xd4fa66){return function(_0xf090f2){try{jsonpatch[_0x03c7('0x1e')](_0xf090f2,_0xd4fa66,!![]);}catch(_0x310709){return BPromise['reject'](_0x310709);}return _0xf090f2[_0x03c7('0x1f')]();};}function saveUpdates(_0xedbbcd,_0x30b855){return function(_0xe85bdc){if(_0xe85bdc){return _0xe85bdc['update'](_0xedbbcd)['then'](function(_0x3670a0){return _0x3670a0;});}return null;};}function removeEntity(_0x4a1de5,_0xa4a14d){return function(_0x41d7f2){if(_0x41d7f2){return _0x41d7f2[_0x03c7('0x20')]()['then'](function(){_0x4a1de5['status'](0xcc)[_0x03c7('0x17')]();});}};}function handleEntityNotFound(_0x538db2,_0xf4696c){return function(_0x1285a1){if(!_0x1285a1){_0x538db2[_0x03c7('0x21')](0x194);}return _0x1285a1;};}function handleError(_0x4601d1,_0x1db4f1){_0x1db4f1=_0x1db4f1||0x1f4;return function(_0x72b267){logger[_0x03c7('0x22')](_0x72b267[_0x03c7('0x23')]);if(_0x72b267['name']){delete _0x72b267[_0x03c7('0x24')];}_0x4601d1[_0x03c7('0x16')](_0x1db4f1)[_0x03c7('0x25')](_0x72b267);};}exports[_0x03c7('0x26')]=function(_0x3dd313,_0x282ea9){var _0x311c3a={},_0x280155={},_0x5b187c={'count':0x0,'rows':[]};var _0xff70b4=_[_0x03c7('0x27')](db[_0x03c7('0x28')][_0x03c7('0x29')],function(_0x476fe7){return{'name':_0x476fe7[_0x03c7('0x2a')],'type':_0x476fe7['type'][_0x03c7('0x2b')]};});_0x280155[_0x03c7('0x2c')]=_['map'](_0xff70b4,'name');_0x280155[_0x03c7('0x2d')]=_[_0x03c7('0x2e')](_0x3dd313[_0x03c7('0x2d')]);_0x280155[_0x03c7('0x2f')]=_[_0x03c7('0x30')](_0x280155[_0x03c7('0x2c')],_0x280155['query']);_0x311c3a[_0x03c7('0x31')]=_[_0x03c7('0x30')](_0x280155[_0x03c7('0x2c')],qs['fields'](_0x3dd313[_0x03c7('0x2d')][_0x03c7('0x32')]));_0x311c3a['attributes']=_0x311c3a[_0x03c7('0x31')][_0x03c7('0x33')]?_0x311c3a[_0x03c7('0x31')]:_0x280155[_0x03c7('0x2c')];if(!_0x3dd313[_0x03c7('0x2d')]['hasOwnProperty']('nolimit')){_0x311c3a['limit']=qs[_0x03c7('0x1a')](_0x3dd313['query'][_0x03c7('0x1a')]);_0x311c3a['offset']=qs[_0x03c7('0x19')](_0x3dd313[_0x03c7('0x2d')][_0x03c7('0x19')]);}_0x311c3a['order']=qs[_0x03c7('0x34')](_0x3dd313[_0x03c7('0x2d')][_0x03c7('0x34')]);_0x311c3a[_0x03c7('0x35')]=qs[_0x03c7('0x2f')](_[_0x03c7('0x36')](_0x3dd313[_0x03c7('0x2d')],_0x280155['filters']),_0xff70b4);if(_0x3dd313[_0x03c7('0x2d')][_0x03c7('0x37')]){_0x311c3a[_0x03c7('0x35')]=_[_0x03c7('0x38')](_0x311c3a[_0x03c7('0x35')],{'$or':_[_0x03c7('0x27')](_0xff70b4,function(_0x176168){if(_0x176168[_0x03c7('0x39')]!==_0x03c7('0x3a')){var _0x478f80={};_0x478f80[_0x176168[_0x03c7('0x24')]]={'$like':'%'+_0x3dd313['query'][_0x03c7('0x37')]+'%'};return _0x478f80;}})});}_0x311c3a=_[_0x03c7('0x38')]({},_0x311c3a,_0x3dd313['options']);var _0x509b2a={'where':_0x311c3a['where']};return db[_0x03c7('0x28')][_0x03c7('0x18')](_0x509b2a)[_0x03c7('0x3b')](function(_0x1000ab){_0x5b187c[_0x03c7('0x18')]=_0x1000ab;if(_0x3dd313[_0x03c7('0x2d')]['includeAll']){_0x311c3a[_0x03c7('0x3c')]=[{'all':!![]}];}return db[_0x03c7('0x28')][_0x03c7('0x3d')](_0x311c3a);})[_0x03c7('0x3b')](function(_0x51f8b4){_0x5b187c['rows']=_0x51f8b4;return _0x5b187c;})[_0x03c7('0x3b')](respondWithFilteredResult(_0x282ea9,_0x311c3a))['catch'](handleError(_0x282ea9,null));};exports[_0x03c7('0x3e')]=function(_0x511ac3,_0x571f52){var _0x4b4903={'raw':!![],'where':{'id':_0x511ac3[_0x03c7('0x3f')]['id']}},_0x5f02f4={};_0x5f02f4[_0x03c7('0x2c')]=_[_0x03c7('0x2e')](db[_0x03c7('0x28')][_0x03c7('0x29')]);_0x5f02f4[_0x03c7('0x2d')]=_[_0x03c7('0x2e')](_0x511ac3[_0x03c7('0x2d')]);_0x5f02f4[_0x03c7('0x2f')]=_[_0x03c7('0x30')](_0x5f02f4[_0x03c7('0x2c')],_0x5f02f4[_0x03c7('0x2d')]);_0x4b4903['attributes']=_[_0x03c7('0x30')](_0x5f02f4[_0x03c7('0x2c')],qs[_0x03c7('0x32')](_0x511ac3[_0x03c7('0x2d')]['fields']));_0x4b4903[_0x03c7('0x31')]=_0x4b4903[_0x03c7('0x31')][_0x03c7('0x33')]?_0x4b4903[_0x03c7('0x31')]:_0x5f02f4[_0x03c7('0x2c')];if(_0x511ac3[_0x03c7('0x2d')]['includeAll']){_0x4b4903[_0x03c7('0x3c')]=[{'all':!![]}];}_0x4b4903=_[_0x03c7('0x38')]({},_0x4b4903,_0x511ac3[_0x03c7('0x40')]);return db[_0x03c7('0x28')][_0x03c7('0x41')](_0x4b4903)['then'](handleEntityNotFound(_0x571f52,null))[_0x03c7('0x3b')](respondWithResult(_0x571f52,null))[_0x03c7('0x42')](handleError(_0x571f52,null));};exports[_0x03c7('0x43')]=function(_0x187bae,_0x5810f0){return db[_0x03c7('0x28')][_0x03c7('0x43')](_0x187bae['body'],{})[_0x03c7('0x3b')](respondWithResult(_0x5810f0,0xc9))[_0x03c7('0x42')](handleError(_0x5810f0,null));};exports[_0x03c7('0x44')]=function(_0x44c976,_0x50ea0b){if(_0x44c976[_0x03c7('0x45')]['id']){delete _0x44c976['body']['id'];}return db[_0x03c7('0x28')][_0x03c7('0x41')]({'where':{'id':_0x44c976['params']['id']}})[_0x03c7('0x3b')](handleEntityNotFound(_0x50ea0b,null))[_0x03c7('0x3b')](saveUpdates(_0x44c976[_0x03c7('0x45')],null))[_0x03c7('0x3b')](respondWithResult(_0x50ea0b,null))['catch'](handleError(_0x50ea0b,null));};exports[_0x03c7('0x20')]=function(_0x2f6922,_0x1bb89d){return db[_0x03c7('0x28')][_0x03c7('0x41')]({'where':{'id':_0x2f6922[_0x03c7('0x3f')]['id']}})[_0x03c7('0x3b')](handleEntityNotFound(_0x1bb89d,null))[_0x03c7('0x3b')](removeEntity(_0x1bb89d,null))['catch'](handleError(_0x1bb89d,null));};exports['describe']=function(_0x453d88,_0x2f503b){return db[_0x03c7('0x28')]['describe']()[_0x03c7('0x3b')](respondWithResult(_0x2f503b,null))['catch'](handleError(_0x2f503b,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index fe364f2..36660f8 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 _0x3d54=['util','../../config/logger','moment','request-promise','rimraf','./voiceDialReport.attributes','define','VoiceDialReport','uniqueid','lodash'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0x3d54,0x185));var _0x43d5=function(_0x2b8ddd,_0x19ae6a){_0x2b8ddd=_0x2b8ddd-0x0;var _0x29a4f6=_0x3d54[_0x2b8ddd];return _0x29a4f6;};'use strict';var _=require(_0x43d5('0x0'));var util=require(_0x43d5('0x1'));var logger=require(_0x43d5('0x2'))('api');var moment=require(_0x43d5('0x3'));var BPromise=require('bluebird');var rp=require(_0x43d5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43d5('0x5'));var config=require('../../config/environment');var attributes=require(_0x43d5('0x6'));module['exports']=function(_0x269c14,_0x4ead82){return _0x269c14[_0x43d5('0x7')](_0x43d5('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x43d5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3cc9=['moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api'];(function(_0x5dc5a3,_0x379165){var _0x2e8b59=function(_0x144508){while(--_0x144508){_0x5dc5a3['push'](_0x5dc5a3['shift']());}};_0x2e8b59(++_0x379165);}(_0x3cc9,0x96));var _0x93cc=function(_0x46dc9e,_0xa1ef5e){_0x46dc9e=_0x46dc9e-0x0;var _0x45fff5=_0x3cc9[_0x46dc9e];return _0x45fff5;};'use strict';var _=require(_0x93cc('0x0'));var util=require(_0x93cc('0x1'));var logger=require(_0x93cc('0x2'))(_0x93cc('0x3'));var moment=require(_0x93cc('0x4'));var BPromise=require(_0x93cc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x93cc('0x6'));var rimraf=require(_0x93cc('0x7'));var config=require(_0x93cc('0x8'));var attributes=require(_0x93cc('0x9'));module['exports']=function(_0x504c98,_0x1b9b5d){return _0x504c98[_0x93cc('0xa')](_0x93cc('0xb'),attributes,{'tableName':_0x93cc('0xc'),'paranoid':![],'indexes':[{'fields':[_0x93cc('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 4e15184..6f833ab 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 _0x3347=['rpc','../../config/environment','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceDialReport','options','raw','then','catch','UpdateVoiceDialReport','VoiceDialReport','update','body','where','attributes','limit','lodash','util','bluebird','../../config/utils','../../config/logger'];(function(_0x27a3cb,_0x4af597){var _0x54ff38=function(_0x3a82d2){while(--_0x3a82d2){_0x27a3cb['push'](_0x27a3cb['shift']());}};_0x54ff38(++_0x4af597);}(_0x3347,0x9b));var _0x7334=function(_0x51ad28,_0x54b716){_0x51ad28=_0x51ad28-0x0;var _0x5eda50=_0x3347[_0x51ad28];return _0x5eda50;};'use strict';var _=require(_0x7334('0x0'));var util=require(_0x7334('0x1'));var moment=require('moment');var BPromise=require(_0x7334('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7334('0x3'));var logger=require(_0x7334('0x4'))(_0x7334('0x5'));var config=require(_0x7334('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7334('0x7')][_0x7334('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69d1ff,_0x4edb95,_0x21086f){return new BPromise(function(_0x5c2536,_0x576bce){return client[_0x7334('0x9')](_0x69d1ff,_0x21086f)['then'](function(_0x7b7955){logger[_0x7334('0xa')](_0x7334('0xb'),_0x4edb95,_0x7334('0xc'));logger[_0x7334('0xd')](_0x7334('0xe'),_0x4edb95,'request\x20sent',JSON[_0x7334('0xf')](_0x7b7955));if(_0x7b7955[_0x7334('0x10')]){if(_0x7b7955[_0x7334('0x10')][_0x7334('0x11')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x4edb95,_0x7b7955[_0x7334('0x10')]['message']);return _0x576bce(_0x7b7955['error'][_0x7334('0x12')]);}logger[_0x7334('0x10')](_0x7334('0xb'),_0x4edb95,_0x7b7955[_0x7334('0x10')]['message']);return _0x5c2536(_0x7b7955[_0x7334('0x10')][_0x7334('0x12')]);}else{logger[_0x7334('0xa')](_0x7334('0xb'),_0x4edb95,_0x7334('0xc'));_0x5c2536(_0x7b7955[_0x7334('0x13')][_0x7334('0x12')]);}})['catch'](function(_0x135186){logger[_0x7334('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x4edb95,_0x135186);_0x576bce(_0x135186);});});}exports[_0x7334('0x14')]=function(_0x10b51b){var _0xec05a8=this;return new Promise(function(_0x405db0,_0x4b1b6f){return db['VoiceDialReport']['create'](_0x10b51b['body'],{'raw':_0x10b51b[_0x7334('0x15')]?_0x10b51b[_0x7334('0x15')][_0x7334('0x16')]===undefined?!![]:![]:!![]})[_0x7334('0x17')](function(_0x5190de){logger['info'](_0x7334('0x14'),_0x10b51b);logger['debug'](_0x7334('0x14'),_0x10b51b,JSON[_0x7334('0xf')](_0x5190de));_0x405db0(_0x5190de);})[_0x7334('0x18')](function(_0x398928){logger[_0x7334('0x10')](_0x7334('0x14'),_0x398928['message'],_0x10b51b);_0x4b1b6f(_0xec05a8[_0x7334('0x10')](0x1f4,_0x398928[_0x7334('0x12')]));});});};exports[_0x7334('0x19')]=function(_0xe42887){var _0x29d64b=this;return new Promise(function(_0x142c5,_0x1bfde2){return db[_0x7334('0x1a')][_0x7334('0x1b')](_0xe42887[_0x7334('0x1c')],{'raw':_0xe42887['options']?_0xe42887['options'][_0x7334('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe42887[_0x7334('0x15')]?_0xe42887[_0x7334('0x15')][_0x7334('0x1d')]||null:null,'attributes':_0xe42887[_0x7334('0x15')]?_0xe42887[_0x7334('0x15')][_0x7334('0x1e')]||null:null,'limit':_0xe42887['options']?_0xe42887[_0x7334('0x15')][_0x7334('0x1f')]||null:null})[_0x7334('0x17')](function(_0x180453){logger[_0x7334('0xa')](_0x7334('0x19'),_0xe42887);logger[_0x7334('0xd')](_0x7334('0x19'),_0xe42887,JSON[_0x7334('0xf')](_0x180453));_0x142c5(_0x180453);})[_0x7334('0x18')](function(_0x4b1bdf){logger[_0x7334('0x10')](_0x7334('0x19'),_0x4b1bdf[_0x7334('0x12')],_0xe42887);_0x1bfde2(_0x29d64b[_0x7334('0x10')](0x1f4,_0x4b1bdf[_0x7334('0x12')]));});});}; \ No newline at end of file +var _0xb0b1=['http','request','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','then','UpdateVoiceDialReport','update','raw','where','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x371f28,_0x315fc9){var _0x3b690f=function(_0x4a657a){while(--_0x4a657a){_0x371f28['push'](_0x371f28['shift']());}};_0x3b690f(++_0x315fc9);}(_0xb0b1,0xee));var _0x1b0b=function(_0x53d648,_0x1f877e){_0x53d648=_0x53d648-0x0;var _0x1553c6=_0xb0b1[_0x53d648];return _0x1553c6;};'use strict';var _=require('lodash');var util=require(_0x1b0b('0x0'));var moment=require('moment');var BPromise=require(_0x1b0b('0x1'));var rs=require(_0x1b0b('0x2'));var fs=require('fs');var Redis=require(_0x1b0b('0x3'));var db=require(_0x1b0b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b0b('0x5'))(_0x1b0b('0x6'));var config=require(_0x1b0b('0x7'));var jayson=require(_0x1b0b('0x8'));var client=jayson[_0x1b0b('0x9')][_0x1b0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b8365,_0x10dd0c,_0x733cbf){return new BPromise(function(_0x599038,_0x3fe61e){return client[_0x1b0b('0xb')](_0x2b8365,_0x733cbf)['then'](function(_0x5f1a62){logger['info'](_0x1b0b('0xc'),_0x10dd0c,'request\x20sent');logger[_0x1b0b('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x10dd0c,_0x1b0b('0xe'),JSON[_0x1b0b('0xf')](_0x5f1a62));if(_0x5f1a62[_0x1b0b('0x10')]){if(_0x5f1a62['error']['code']===0x1f4){logger[_0x1b0b('0x10')](_0x1b0b('0xc'),_0x10dd0c,_0x5f1a62[_0x1b0b('0x10')][_0x1b0b('0x11')]);return _0x3fe61e(_0x5f1a62[_0x1b0b('0x10')][_0x1b0b('0x11')]);}logger[_0x1b0b('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x10dd0c,_0x5f1a62[_0x1b0b('0x10')][_0x1b0b('0x11')]);return _0x599038(_0x5f1a62[_0x1b0b('0x10')][_0x1b0b('0x11')]);}else{logger[_0x1b0b('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x10dd0c,'request\x20sent');_0x599038(_0x5f1a62[_0x1b0b('0x13')][_0x1b0b('0x11')]);}})[_0x1b0b('0x14')](function(_0x34eb72){logger['error'](_0x1b0b('0xc'),_0x10dd0c,_0x34eb72);_0x3fe61e(_0x34eb72);});});}exports[_0x1b0b('0x15')]=function(_0x4030b1){var _0x137687=this;return new Promise(function(_0x1dcdb0,_0xcb9eff){return db[_0x1b0b('0x16')][_0x1b0b('0x17')](_0x4030b1['body'],{'raw':_0x4030b1['options']?_0x4030b1[_0x1b0b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x1b0b('0x19')](function(_0x3858c3){logger[_0x1b0b('0x12')](_0x1b0b('0x15'),_0x4030b1);logger[_0x1b0b('0xd')](_0x1b0b('0x15'),_0x4030b1,JSON[_0x1b0b('0xf')](_0x3858c3));_0x1dcdb0(_0x3858c3);})['catch'](function(_0x1377c3){logger[_0x1b0b('0x10')](_0x1b0b('0x15'),_0x1377c3[_0x1b0b('0x11')],_0x4030b1);_0xcb9eff(_0x137687[_0x1b0b('0x10')](0x1f4,_0x1377c3[_0x1b0b('0x11')]));});});};exports[_0x1b0b('0x1a')]=function(_0x35f7bb){var _0x341b60=this;return new Promise(function(_0x1ef6b9,_0x14ece5){return db[_0x1b0b('0x16')][_0x1b0b('0x1b')](_0x35f7bb['body'],{'raw':_0x35f7bb[_0x1b0b('0x18')]?_0x35f7bb[_0x1b0b('0x18')][_0x1b0b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35f7bb['options']?_0x35f7bb[_0x1b0b('0x18')][_0x1b0b('0x1d')]||null:null,'attributes':_0x35f7bb['options']?_0x35f7bb['options'][_0x1b0b('0x1e')]||null:null,'limit':_0x35f7bb[_0x1b0b('0x18')]?_0x35f7bb[_0x1b0b('0x18')]['limit']||null:null})[_0x1b0b('0x19')](function(_0x525ef4){logger[_0x1b0b('0x12')](_0x1b0b('0x1a'),_0x35f7bb);logger[_0x1b0b('0xd')](_0x1b0b('0x1a'),_0x35f7bb,JSON['stringify'](_0x525ef4));_0x1ef6b9(_0x525ef4);})['catch'](function(_0xe3c691){logger[_0x1b0b('0x10')](_0x1b0b('0x1a'),_0xe3c691[_0x1b0b('0x11')],_0x35f7bb);_0x14ece5(_0x341b60[_0x1b0b('0x10')](0x1f4,_0xe3c691[_0x1b0b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5bac094..0f6663a 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 _0xb1ad=['./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2c4ceb,_0x551d35){var _0xeb8a8a=function(_0xaaf829){while(--_0xaaf829){_0x2c4ceb['push'](_0x2c4ceb['shift']());}};_0xeb8a8a(++_0x551d35);}(_0xb1ad,0x184));var _0xdb1a=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xb1ad[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0xdb1a('0x0'));var util=require(_0xdb1a('0x1'));var path=require(_0xdb1a('0x2'));var timeout=require(_0xdb1a('0x3'));var express=require(_0xdb1a('0x4'));var router=express[_0xdb1a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdb1a('0x6'));var config=require(_0xdb1a('0x7'));var controller=require(_0xdb1a('0x8'));router[_0xdb1a('0x9')]('/',auth[_0xdb1a('0xa')](),controller[_0xdb1a('0xb')]);router[_0xdb1a('0x9')](_0xdb1a('0xc'),auth[_0xdb1a('0xa')](),controller[_0xdb1a('0xd')]);router[_0xdb1a('0xe')]('/',auth[_0xdb1a('0xa')](),controller[_0xdb1a('0xf')]);router[_0xdb1a('0xe')](_0xdb1a('0x10'),auth['isAuthenticated'](),controller[_0xdb1a('0x11')]);router[_0xdb1a('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdb1a('0x13')](_0xdb1a('0xc'),auth[_0xdb1a('0xa')](),controller[_0xdb1a('0x14')]);module[_0xdb1a('0x15')]=router; \ No newline at end of file +var _0x5210=['put','update','delete','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications'];(function(_0x31d6c2,_0x422dcd){var _0x295dd0=function(_0x2b5dd1){while(--_0x2b5dd1){_0x31d6c2['push'](_0x31d6c2['shift']());}};_0x295dd0(++_0x422dcd);}(_0x5210,0x1a1));var _0x0521=function(_0x4cc49b,_0x59264d){_0x4cc49b=_0x4cc49b-0x0;var _0x1d8202=_0x5210[_0x4cc49b];return _0x1d8202;};'use strict';var multer=require(_0x0521('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0521('0x1'));var express=require(_0x0521('0x2'));var router=express[_0x0521('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0521('0x4'));var config=require(_0x0521('0x5'));var controller=require(_0x0521('0x6'));router[_0x0521('0x7')]('/',auth[_0x0521('0x8')](),controller[_0x0521('0x9')]);router[_0x0521('0x7')](_0x0521('0xa'),auth[_0x0521('0x8')](),controller[_0x0521('0xb')]);router[_0x0521('0xc')]('/',auth[_0x0521('0x8')](),controller['create']);router[_0x0521('0xc')](_0x0521('0xd'),auth[_0x0521('0x8')](),controller[_0x0521('0xe')]);router[_0x0521('0xf')](_0x0521('0xa'),auth[_0x0521('0x8')](),controller[_0x0521('0x10')]);router[_0x0521('0x11')](_0x0521('0xa'),auth[_0x0521('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index aed68b6..47ca82c 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(_0x3b595f,_0x2c98e0){var _0x57b592=function(_0x83f4b4){while(--_0x83f4b4){_0x3b595f['push'](_0x3b595f['shift']());}};_0x57b592(++_0x2c98e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0xc38ca1,_0x1f3af1){var _0x4bda81=function(_0x1f76d1){while(--_0x1f76d1){_0xc38ca1['push'](_0xc38ca1['shift']());}};_0x4bda81(++_0x1f3af1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 46165f0..07df783 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 _0x9575=['limit','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','intersection','body','concat','exten','create','role','user','InboundRoutes','OutboundRoutes','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','then','get','inbound','outbound','internal','filter','ignore','map','value','includes','type','find','UserProfileResource','error','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x59ad7f,_0x43a45c){var _0x190e4f=function(_0x2762a4){while(--_0x2762a4){_0x59ad7f['push'](_0x59ad7f['shift']());}};_0x190e4f(++_0x43a45c);}(_0x9575,0x94));var _0x5957=function(_0x20473b,_0x1989c6){_0x20473b=_0x20473b-0x0;var _0x163e4d=_0x9575[_0x20473b];return _0x163e4d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5957('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5957('0x1'));var jsonpatch=require(_0x5957('0x2'));var rp=require(_0x5957('0x3'));var moment=require('moment');var BPromise=require(_0x5957('0x4'));var Mustache=require('mustache');var util=require(_0x5957('0x5'));var path=require(_0x5957('0x6'));var sox=require(_0x5957('0x7'));var csv=require(_0x5957('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5957('0x9'));var squel=require(_0x5957('0xa'));var crypto=require('crypto');var jsforce=require(_0x5957('0xb'));var deskjs=require(_0x5957('0xc'));var toCsv=require(_0x5957('0x8'));var querystring=require(_0x5957('0xd'));var Papa=require(_0x5957('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5957('0xf'));var hardwareService=require(_0x5957('0x10'));var logger=require(_0x5957('0x11'))(_0x5957('0x12'));var utils=require(_0x5957('0x13'));var config=require(_0x5957('0x14'));var licenseUtil=require(_0x5957('0x15'));var db=require(_0x5957('0x16'))['db'];config[_0x5957('0x17')]=_[_0x5957('0x18')](config[_0x5957('0x17')],{'host':_0x5957('0x19'),'port':0x18eb});var socket=require(_0x5957('0x1a'))(new Redis(config['redis']));require(_0x5957('0x1b'))[_0x5957('0x1c')](socket);function respondWithStatusCode(_0xa1ed15,_0x42bb57){_0x42bb57=_0x42bb57||0xcc;return function(_0x488e67){if(_0x488e67){return _0xa1ed15[_0x5957('0x1d')](_0x42bb57);}return _0xa1ed15['status'](_0x42bb57)[_0x5957('0x1e')]();};}function respondWithResult(_0x3a483e,_0x2d892b){_0x2d892b=_0x2d892b||0xc8;return function(_0x3b327c){if(_0x3b327c){return _0x3a483e[_0x5957('0x1f')](_0x2d892b)[_0x5957('0x20')](_0x3b327c);}};}function respondWithFilteredResult(_0x380e2d,_0x5e71a0){return function(_0x25f122){if(_0x25f122){var _0x46d245=_0x25f122[_0x5957('0x21')],_0x47b154=_0x5e71a0[_0x5957('0x22')],_0x3df6cc=_0x5e71a0[_0x5957('0x22')]+_0x5e71a0['limit'],_0xfb8407;if(_0x3df6cc>=_0x46d245){_0x3df6cc=_0x46d245;_0xfb8407=0xc8;}else{_0xfb8407=0xce;}_0x380e2d[_0x5957('0x1f')](_0xfb8407);return _0x380e2d['set'](_0x5957('0x23'),_0x47b154+'-'+_0x3df6cc+'/'+_0x46d245)['json'](_0x25f122);}return null;};}function patchUpdates(_0x45a619){return function(_0xe144be){try{jsonpatch[_0x5957('0x24')](_0xe144be,_0x45a619,!![]);}catch(_0x3cf437){return BPromise[_0x5957('0x25')](_0x3cf437);}return _0xe144be[_0x5957('0x26')]();};}function saveUpdates(_0x4c320c,_0x22f9e2){return function(_0x4e9f85){if(_0x4e9f85){return _0x4e9f85[_0x5957('0x27')](_0x4c320c)['then'](function(_0x46d392){return _0x46d392;});}return null;};}function removeEntity(_0x422fb7,_0x425e5a){return function(_0x6b936e){if(_0x6b936e){return _0x6b936e[_0x5957('0x28')]()[_0x5957('0x29')](function(){var _0x3653b2=_0x6b936e[_0x5957('0x2a')]({'plain':!![]});var _0x402d47=[{'name':'InboundRoutes','value':_0x5957('0x2b'),'ignore':![]},{'name':'OutboundRoutes','value':_0x5957('0x2c'),'ignore':![]},{'name':'InternalRoutes','value':_0x5957('0x2d'),'ignore':![]}];var _0x9b035b=_(_0x402d47)[_0x5957('0x2e')](_0x5957('0x2f'))[_0x5957('0x30')](_0x5957('0x31'))[_0x5957('0x31')]();if(_[_0x5957('0x32')](_0x9b035b,_0x3653b2[_0x5957('0x33')])){return;}var _0x5dda59=_[_0x5957('0x34')](_0x402d47,[_0x5957('0x31'),_0x3653b2['type']])['name'];return db[_0x5957('0x35')][_0x5957('0x28')]({'where':{'type':_0x5dda59,'resourceId':_0x3653b2['id']}})['then'](function(){return _0x6b936e;});})[_0x5957('0x29')](function(){_0x422fb7[_0x5957('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x699e23,_0x1eb402){return function(_0x1c5a10){if(!_0x1c5a10){_0x699e23['sendStatus'](0x194);}return _0x1c5a10;};}function handleError(_0x1aaebc,_0x155157){_0x155157=_0x155157||0x1f4;return function(_0x5b3091){logger[_0x5957('0x36')](_0x5b3091['stack']);if(_0x5b3091[_0x5957('0x37')]){delete _0x5b3091[_0x5957('0x37')];}_0x1aaebc[_0x5957('0x1f')](_0x155157)[_0x5957('0x38')](_0x5b3091);};}exports[_0x5957('0x39')]=function(_0x436ca2,_0x1909d3){var _0x273807={},_0x2f13f8={},_0x24d9af={'count':0x0,'rows':[]};var _0x106bcf=_['map'](db['VoiceExtension'][_0x5957('0x3a')],function(_0xdb4f77){return{'name':_0xdb4f77[_0x5957('0x3b')],'type':_0xdb4f77[_0x5957('0x33')][_0x5957('0x3c')]};});_0x2f13f8[_0x5957('0x3d')]=_[_0x5957('0x30')](_0x106bcf,_0x5957('0x37'));_0x2f13f8[_0x5957('0x3e')]=_[_0x5957('0x3f')](_0x436ca2[_0x5957('0x3e')]);_0x2f13f8[_0x5957('0x40')]=_['intersection'](_0x2f13f8[_0x5957('0x3d')],_0x2f13f8[_0x5957('0x3e')]);_0x273807[_0x5957('0x41')]=_['intersection'](_0x2f13f8[_0x5957('0x3d')],qs[_0x5957('0x42')](_0x436ca2[_0x5957('0x3e')]['fields']));_0x273807[_0x5957('0x41')]=_0x273807['attributes'][_0x5957('0x43')]?_0x273807[_0x5957('0x41')]:_0x2f13f8[_0x5957('0x3d')];if(!_0x436ca2[_0x5957('0x3e')][_0x5957('0x44')](_0x5957('0x45'))){_0x273807[_0x5957('0x46')]=qs['limit'](_0x436ca2[_0x5957('0x3e')][_0x5957('0x46')]);_0x273807[_0x5957('0x22')]=qs[_0x5957('0x22')](_0x436ca2['query'][_0x5957('0x22')]);}_0x273807['order']=qs[_0x5957('0x47')](_0x436ca2[_0x5957('0x3e')][_0x5957('0x47')]);_0x273807[_0x5957('0x48')]=qs['filters'](_[_0x5957('0x49')](_0x436ca2[_0x5957('0x3e')],_0x2f13f8[_0x5957('0x40')]),_0x106bcf);if(_0x436ca2[_0x5957('0x3e')][_0x5957('0x2e')]){_0x273807[_0x5957('0x48')]=_[_0x5957('0x4a')](_0x273807[_0x5957('0x48')],{'$or':_[_0x5957('0x30')](_0x106bcf,function(_0x58143d){if(_0x58143d[_0x5957('0x33')]!==_0x5957('0x4b')){var _0x375e97={};_0x375e97[_0x58143d['name']]={'$like':'%'+_0x436ca2[_0x5957('0x3e')][_0x5957('0x2e')]+'%'};return _0x375e97;}})});}_0x273807=_['merge']({},_0x273807,_0x436ca2[_0x5957('0x4c')]);var _0x18cd24={'where':_0x273807[_0x5957('0x48')]};return db[_0x5957('0x4d')]['count'](_0x18cd24)[_0x5957('0x29')](function(_0x4eeb13){_0x24d9af['count']=_0x4eeb13;if(_0x436ca2[_0x5957('0x3e')][_0x5957('0x4e')]){_0x273807[_0x5957('0x4f')]=[{'all':!![]}];}return db[_0x5957('0x4d')][_0x5957('0x50')](_0x273807);})[_0x5957('0x29')](function(_0x143ae0){_0x24d9af[_0x5957('0x51')]=_0x143ae0;return _0x24d9af;})[_0x5957('0x29')](respondWithFilteredResult(_0x1909d3,_0x273807))[_0x5957('0x52')](handleError(_0x1909d3,null));};exports[_0x5957('0x53')]=function(_0x52e7f0,_0x19018b){var _0x269b19={'raw':![],'where':{'id':_0x52e7f0[_0x5957('0x54')]['id']}},_0x5b363b={};_0x5b363b['model']=_[_0x5957('0x3f')](db[_0x5957('0x4d')]['rawAttributes']);_0x5b363b[_0x5957('0x3e')]=_[_0x5957('0x3f')](_0x52e7f0[_0x5957('0x3e')]);_0x5b363b['filters']=_[_0x5957('0x55')](_0x5b363b['model'],_0x5b363b[_0x5957('0x3e')]);_0x269b19[_0x5957('0x41')]=_['intersection'](_0x5b363b[_0x5957('0x3d')],qs['fields'](_0x52e7f0[_0x5957('0x3e')][_0x5957('0x42')]));_0x269b19[_0x5957('0x41')]=_0x269b19['attributes'][_0x5957('0x43')]?_0x269b19[_0x5957('0x41')]:_0x5b363b[_0x5957('0x3d')];if(_0x52e7f0[_0x5957('0x3e')][_0x5957('0x4e')]){_0x269b19[_0x5957('0x4f')]=[{'all':!![]}];}_0x269b19=_[_0x5957('0x4a')]({},_0x269b19,_0x52e7f0['options']);return db[_0x5957('0x4d')][_0x5957('0x34')](_0x269b19)[_0x5957('0x29')](handleEntityNotFound(_0x19018b,null))[_0x5957('0x29')](respondWithResult(_0x19018b,null))[_0x5957('0x52')](handleError(_0x19018b,null));};exports[_0x5957('0x28')]=function(_0x3dfe9a,_0x293e7b){return db['VoiceExtension'][_0x5957('0x34')]({'where':{'id':_0x3dfe9a['params']['id']}})['then'](handleEntityNotFound(_0x293e7b,null))['then'](removeEntity(_0x293e7b,null))[_0x5957('0x52')](handleError(_0x293e7b,null));};exports['create']=function(_0x2d730c,_0x1ce536){if(_0x2d730c[_0x5957('0x56')][_0x5957('0x33')]===_0x5957('0x2c')&&!_['startsWith'](_0x2d730c[_0x5957('0x56')]['exten'],'_')){_0x2d730c[_0x5957('0x56')]['exten']='_'[_0x5957('0x57')](_0x2d730c[_0x5957('0x56')][_0x5957('0x58')]);}return db[_0x5957('0x4d')][_0x5957('0x59')](_0x2d730c['body'],{'raw':![]})[_0x5957('0x29')](function(_0x166ef0){var _0x3cc984=_0x2d730c['user']['get']({'plain':!![]});if(!_0x3cc984)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cc984[_0x5957('0x5a')]===_0x5957('0x5b')){var _0x3732eb=_0x166ef0[_0x5957('0x2a')]({'plain':!![]});var _0x27fee0=[{'name':_0x5957('0x5c'),'value':_0x5957('0x2b')},{'name':_0x5957('0x5d'),'value':'outbound'},{'name':_0x5957('0x5e'),'value':_0x5957('0x2d')}];var _0x536c18=_[_0x5957('0x34')](_0x27fee0,[_0x5957('0x31'),_0x3732eb['type']])['name'];return db[_0x5957('0x5f')][_0x5957('0x34')]({'where':{'name':_0x536c18,'userProfileId':_0x3cc984[_0x5957('0x60')]},'raw':!![]})[_0x5957('0x29')](function(_0x3499f5){if(_0x3499f5&&_0x3499f5[_0x5957('0x61')]===0x0){return db[_0x5957('0x35')][_0x5957('0x59')]({'name':_0x3732eb[_0x5957('0x37')],'resourceId':_0x3732eb['id'],'type':_0x3499f5[_0x5957('0x37')],'sectionId':_0x3499f5['id']},{})[_0x5957('0x29')](function(){return _0x166ef0;});}else{return _0x166ef0;}})[_0x5957('0x52')](function(_0x23aa82){logger['error'](_0x5957('0x62'),_0x23aa82);throw _0x23aa82;});}return _0x166ef0;})[_0x5957('0x29')](respondWithResult(_0x1ce536,0xc9))[_0x5957('0x52')](handleError(_0x1ce536,null));};exports[_0x5957('0x27')]=function(_0xf5e7d4,_0x5aeade){if(_0xf5e7d4[_0x5957('0x56')]['id']){delete _0xf5e7d4['body']['id'];}return db[_0x5957('0x4d')][_0x5957('0x34')]({'where':{'id':_0xf5e7d4[_0x5957('0x54')]['id']}})[_0x5957('0x29')](handleEntityNotFound(_0x5aeade,null))['then'](function(_0x22f40f){if(_0x22f40f){return db[_0x5957('0x4d')][_0x5957('0x27')](_[_0x5957('0x49')](_0xf5e7d4['body'],[_0x5957('0x58'),_0x5957('0x63'),_0x5957('0x64'),'recordingFormat',_0x5957('0x65'),_0x5957('0x66')]),{'where':{'context':_0x22f40f[_0x5957('0x63')],'exten':_0x22f40f[_0x5957('0x58')]},'individualHooks':!![]})['then'](function(_0x4801d1){return _0x4801d1;});}return null;})[_0x5957('0x29')](respondWithStatusCode(_0x5aeade,null))[_0x5957('0x52')](handleError(_0x5aeade,null));};exports[_0x5957('0x67')]=function(_0x1a3cab,_0x4bbf4f,_0x314f6f){return db[_0x5957('0x4d')][_0x5957('0x68')]({'where':{'id':_0x1a3cab[_0x5957('0x54')]['id']}})[_0x5957('0x29')](handleEntityNotFound(_0x4bbf4f,null))[_0x5957('0x29')](function(_0x1f8cde){if(_0x1f8cde){return db[_0x5957('0x69')]['transaction'](function(_0x5047e1){return db[_0x5957('0x4d')][_0x5957('0x28')]({'where':{'VoiceExtensionId':_0x1a3cab[_0x5957('0x54')]['id']},'transaction':_0x5047e1})[_0x5957('0x29')](function(_0x204f74){var _0x446cfe=_[_0x5957('0x30')](_0x1a3cab['body'],function(_0x524f38){_0x524f38['VoiceExtensionId']=_0x1a3cab[_0x5957('0x54')]['id'];return _0x524f38;});return db[_0x5957('0x4d')][_0x5957('0x6a')](_0x446cfe,{'transaction':_0x5047e1});});})[_0x5957('0x29')](function(){return db['VoiceExtension'][_0x5957('0x6b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1a3cab[_0x5957('0x54')]['id']},'order':_0x5957('0x6c')});});}})[_0x5957('0x29')](respondWithResult(_0x4bbf4f,null))[_0x5957('0x52')](handleError(_0x4bbf4f,null));}; \ No newline at end of file +var _0xc718=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','recordingFormat','mandatoryDisposition','addApplications','findOne','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','ignore','value','find','type','name','UserProfileResource','end','stack','send','index','VoiceExtension','fieldName','key','model','map','query','keys','intersection','attributes','fields','length'];(function(_0x44b7bb,_0x460592){var _0x370e81=function(_0x1c5d02){while(--_0x1c5d02){_0x44b7bb['push'](_0x44b7bb['shift']());}};_0x370e81(++_0x460592);}(_0xc718,0x164));var _0x8c71=function(_0x4b7c00,_0x57dd1a){_0x4b7c00=_0x4b7c00-0x0;var _0x235868=_0xc718[_0x4b7c00];return _0x235868;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8c71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c71('0x1'));var jsonpatch=require(_0x8c71('0x2'));var rp=require(_0x8c71('0x3'));var moment=require(_0x8c71('0x4'));var BPromise=require(_0x8c71('0x5'));var Mustache=require('mustache');var util=require(_0x8c71('0x6'));var path=require(_0x8c71('0x7'));var sox=require('sox');var csv=require(_0x8c71('0x8'));var ejs=require(_0x8c71('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8c71('0xa'));var crypto=require('crypto');var jsforce=require(_0x8c71('0xb'));var deskjs=require(_0x8c71('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8c71('0xd'));var Papa=require(_0x8c71('0xe'));var Redis=require(_0x8c71('0xf'));var authService=require(_0x8c71('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c71('0x11'));var logger=require(_0x8c71('0x12'))(_0x8c71('0x13'));var utils=require('../../config/utils');var config=require(_0x8c71('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c71('0x15'))['db'];config[_0x8c71('0x16')]=_[_0x8c71('0x17')](config[_0x8c71('0x16')],{'host':_0x8c71('0x18'),'port':0x18eb});var socket=require(_0x8c71('0x19'))(new Redis(config['redis']));require(_0x8c71('0x1a'))[_0x8c71('0x1b')](socket);function respondWithStatusCode(_0x58e397,_0x27cc28){_0x27cc28=_0x27cc28||0xcc;return function(_0x3c3068){if(_0x3c3068){return _0x58e397['sendStatus'](_0x27cc28);}return _0x58e397[_0x8c71('0x1c')](_0x27cc28)['end']();};}function respondWithResult(_0x10c679,_0x2dd532){_0x2dd532=_0x2dd532||0xc8;return function(_0x5d39e6){if(_0x5d39e6){return _0x10c679[_0x8c71('0x1c')](_0x2dd532)['json'](_0x5d39e6);}};}function respondWithFilteredResult(_0x61d6c0,_0x5c9460){return function(_0x5dd2d7){if(_0x5dd2d7){var _0x3aaefd=_0x5dd2d7[_0x8c71('0x1d')],_0x2a6ebb=_0x5c9460[_0x8c71('0x1e')],_0xf543a3=_0x5c9460[_0x8c71('0x1e')]+_0x5c9460[_0x8c71('0x1f')],_0x53e763;if(_0xf543a3>=_0x3aaefd){_0xf543a3=_0x3aaefd;_0x53e763=0xc8;}else{_0x53e763=0xce;}_0x61d6c0[_0x8c71('0x1c')](_0x53e763);return _0x61d6c0[_0x8c71('0x20')](_0x8c71('0x21'),_0x2a6ebb+'-'+_0xf543a3+'/'+_0x3aaefd)[_0x8c71('0x22')](_0x5dd2d7);}return null;};}function patchUpdates(_0x408868){return function(_0x548b49){try{jsonpatch[_0x8c71('0x23')](_0x548b49,_0x408868,!![]);}catch(_0x5ec404){return BPromise[_0x8c71('0x24')](_0x5ec404);}return _0x548b49[_0x8c71('0x25')]();};}function saveUpdates(_0x5bc12f,_0x126cb4){return function(_0x2dd01d){if(_0x2dd01d){return _0x2dd01d[_0x8c71('0x26')](_0x5bc12f)[_0x8c71('0x27')](function(_0x4a7471){return _0x4a7471;});}return null;};}function removeEntity(_0x221b7d,_0x17bd6e){return function(_0x13a95b){if(_0x13a95b){return _0x13a95b[_0x8c71('0x28')]()[_0x8c71('0x27')](function(){var _0x40c9f5=_0x13a95b[_0x8c71('0x29')]({'plain':!![]});var _0x31faa0=[{'name':_0x8c71('0x2a'),'value':'inbound','ignore':![]},{'name':_0x8c71('0x2b'),'value':_0x8c71('0x2c'),'ignore':![]},{'name':_0x8c71('0x2d'),'value':_0x8c71('0x2e'),'ignore':![]}];var _0x1beade=_(_0x31faa0)['filter'](_0x8c71('0x2f'))['map'](_0x8c71('0x30'))['value']();if(_['includes'](_0x1beade,_0x40c9f5['type'])){return;}var _0x57bd90=_[_0x8c71('0x31')](_0x31faa0,[_0x8c71('0x30'),_0x40c9f5[_0x8c71('0x32')]])[_0x8c71('0x33')];return db[_0x8c71('0x34')]['destroy']({'where':{'type':_0x57bd90,'resourceId':_0x40c9f5['id']}})[_0x8c71('0x27')](function(){return _0x13a95b;});})[_0x8c71('0x27')](function(){_0x221b7d[_0x8c71('0x1c')](0xcc)[_0x8c71('0x35')]();});}};}function handleEntityNotFound(_0x7c93f8,_0x3a8823){return function(_0x581149){if(!_0x581149){_0x7c93f8['sendStatus'](0x194);}return _0x581149;};}function handleError(_0x35b045,_0x24a24f){_0x24a24f=_0x24a24f||0x1f4;return function(_0xc612d7){logger['error'](_0xc612d7[_0x8c71('0x36')]);if(_0xc612d7['name']){delete _0xc612d7[_0x8c71('0x33')];}_0x35b045[_0x8c71('0x1c')](_0x24a24f)[_0x8c71('0x37')](_0xc612d7);};}exports[_0x8c71('0x38')]=function(_0x2e015c,_0x530a2e){var _0x133f58={},_0x5129c5={},_0x203ce0={'count':0x0,'rows':[]};var _0x2572ec=_['map'](db[_0x8c71('0x39')]['rawAttributes'],function(_0x303045){return{'name':_0x303045[_0x8c71('0x3a')],'type':_0x303045[_0x8c71('0x32')][_0x8c71('0x3b')]};});_0x5129c5[_0x8c71('0x3c')]=_[_0x8c71('0x3d')](_0x2572ec,_0x8c71('0x33'));_0x5129c5[_0x8c71('0x3e')]=_[_0x8c71('0x3f')](_0x2e015c[_0x8c71('0x3e')]);_0x5129c5['filters']=_[_0x8c71('0x40')](_0x5129c5[_0x8c71('0x3c')],_0x5129c5[_0x8c71('0x3e')]);_0x133f58[_0x8c71('0x41')]=_[_0x8c71('0x40')](_0x5129c5['model'],qs[_0x8c71('0x42')](_0x2e015c[_0x8c71('0x3e')][_0x8c71('0x42')]));_0x133f58[_0x8c71('0x41')]=_0x133f58['attributes'][_0x8c71('0x43')]?_0x133f58['attributes']:_0x5129c5[_0x8c71('0x3c')];if(!_0x2e015c[_0x8c71('0x3e')][_0x8c71('0x44')](_0x8c71('0x45'))){_0x133f58[_0x8c71('0x1f')]=qs['limit'](_0x2e015c[_0x8c71('0x3e')][_0x8c71('0x1f')]);_0x133f58[_0x8c71('0x1e')]=qs[_0x8c71('0x1e')](_0x2e015c['query'][_0x8c71('0x1e')]);}_0x133f58[_0x8c71('0x46')]=qs[_0x8c71('0x47')](_0x2e015c[_0x8c71('0x3e')][_0x8c71('0x47')]);_0x133f58[_0x8c71('0x48')]=qs[_0x8c71('0x49')](_[_0x8c71('0x4a')](_0x2e015c[_0x8c71('0x3e')],_0x5129c5[_0x8c71('0x49')]),_0x2572ec);if(_0x2e015c['query'][_0x8c71('0x4b')]){_0x133f58[_0x8c71('0x48')]=_['merge'](_0x133f58[_0x8c71('0x48')],{'$or':_[_0x8c71('0x3d')](_0x2572ec,function(_0xe472d9){if(_0xe472d9['type']!=='VIRTUAL'){var _0x3979fd={};_0x3979fd[_0xe472d9['name']]={'$like':'%'+_0x2e015c[_0x8c71('0x3e')][_0x8c71('0x4b')]+'%'};return _0x3979fd;}})});}_0x133f58=_[_0x8c71('0x4c')]({},_0x133f58,_0x2e015c[_0x8c71('0x4d')]);var _0x1ab52c={'where':_0x133f58['where']};return db['VoiceExtension'][_0x8c71('0x1d')](_0x1ab52c)[_0x8c71('0x27')](function(_0x19bdf6){_0x203ce0[_0x8c71('0x1d')]=_0x19bdf6;if(_0x2e015c[_0x8c71('0x3e')][_0x8c71('0x4e')]){_0x133f58[_0x8c71('0x4f')]=[{'all':!![]}];}return db[_0x8c71('0x39')][_0x8c71('0x50')](_0x133f58);})[_0x8c71('0x27')](function(_0x391329){_0x203ce0[_0x8c71('0x51')]=_0x391329;return _0x203ce0;})[_0x8c71('0x27')](respondWithFilteredResult(_0x530a2e,_0x133f58))[_0x8c71('0x52')](handleError(_0x530a2e,null));};exports[_0x8c71('0x53')]=function(_0x1a2724,_0x144975){var _0x43a656={'raw':![],'where':{'id':_0x1a2724['params']['id']}},_0x58b969={};_0x58b969[_0x8c71('0x3c')]=_['keys'](db[_0x8c71('0x39')][_0x8c71('0x54')]);_0x58b969[_0x8c71('0x3e')]=_[_0x8c71('0x3f')](_0x1a2724['query']);_0x58b969['filters']=_[_0x8c71('0x40')](_0x58b969[_0x8c71('0x3c')],_0x58b969['query']);_0x43a656[_0x8c71('0x41')]=_['intersection'](_0x58b969[_0x8c71('0x3c')],qs['fields'](_0x1a2724['query'][_0x8c71('0x42')]));_0x43a656[_0x8c71('0x41')]=_0x43a656['attributes']['length']?_0x43a656[_0x8c71('0x41')]:_0x58b969[_0x8c71('0x3c')];if(_0x1a2724['query'][_0x8c71('0x4e')]){_0x43a656['include']=[{'all':!![]}];}_0x43a656=_[_0x8c71('0x4c')]({},_0x43a656,_0x1a2724['options']);return db[_0x8c71('0x39')][_0x8c71('0x31')](_0x43a656)[_0x8c71('0x27')](handleEntityNotFound(_0x144975,null))[_0x8c71('0x27')](respondWithResult(_0x144975,null))['catch'](handleError(_0x144975,null));};exports[_0x8c71('0x28')]=function(_0x548d6b,_0x7a0541){return db[_0x8c71('0x39')][_0x8c71('0x31')]({'where':{'id':_0x548d6b['params']['id']}})[_0x8c71('0x27')](handleEntityNotFound(_0x7a0541,null))[_0x8c71('0x27')](removeEntity(_0x7a0541,null))[_0x8c71('0x52')](handleError(_0x7a0541,null));};exports[_0x8c71('0x55')]=function(_0x238901,_0x341285){if(_0x238901[_0x8c71('0x56')][_0x8c71('0x32')]==='outbound'&&!_[_0x8c71('0x57')](_0x238901[_0x8c71('0x56')]['exten'],'_')){_0x238901['body'][_0x8c71('0x58')]='_'['concat'](_0x238901[_0x8c71('0x56')][_0x8c71('0x58')]);}return db[_0x8c71('0x39')]['create'](_0x238901['body'],{'raw':![]})['then'](function(_0x279189){var _0x7d1878=_0x238901[_0x8c71('0x59')]['get']({'plain':!![]});if(!_0x7d1878)throw new Error(_0x8c71('0x5a'));if(_0x7d1878[_0x8c71('0x5b')]===_0x8c71('0x59')){var _0x501981=_0x279189['get']({'plain':!![]});var _0x15614e=[{'name':_0x8c71('0x2a'),'value':'inbound'},{'name':_0x8c71('0x2b'),'value':_0x8c71('0x2c')},{'name':_0x8c71('0x2d'),'value':'internal'}];var _0x3de349=_[_0x8c71('0x31')](_0x15614e,[_0x8c71('0x30'),_0x501981[_0x8c71('0x32')]])[_0x8c71('0x33')];return db[_0x8c71('0x5c')][_0x8c71('0x31')]({'where':{'name':_0x3de349,'userProfileId':_0x7d1878[_0x8c71('0x5d')]},'raw':!![]})[_0x8c71('0x27')](function(_0xe4d641){if(_0xe4d641&&_0xe4d641[_0x8c71('0x5e')]===0x0){return db[_0x8c71('0x34')][_0x8c71('0x55')]({'name':_0x501981[_0x8c71('0x33')],'resourceId':_0x501981['id'],'type':_0xe4d641[_0x8c71('0x33')],'sectionId':_0xe4d641['id']},{})[_0x8c71('0x27')](function(){return _0x279189;});}else{return _0x279189;}})[_0x8c71('0x52')](function(_0x5d67c4){logger[_0x8c71('0x5f')](_0x8c71('0x60'),_0x5d67c4);throw _0x5d67c4;});}return _0x279189;})['then'](respondWithResult(_0x341285,0xc9))[_0x8c71('0x52')](handleError(_0x341285,null));};exports['update']=function(_0x53534f,_0x5c4402){if(_0x53534f[_0x8c71('0x56')]['id']){delete _0x53534f['body']['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x53534f[_0x8c71('0x61')]['id']}})[_0x8c71('0x27')](handleEntityNotFound(_0x5c4402,null))[_0x8c71('0x27')](function(_0x4ab54d){if(_0x4ab54d){return db[_0x8c71('0x39')]['update'](_[_0x8c71('0x4a')](_0x53534f['body'],['exten','context','description',_0x8c71('0x62'),'cutdigits',_0x8c71('0x63')]),{'where':{'context':_0x4ab54d['context'],'exten':_0x4ab54d[_0x8c71('0x58')]},'individualHooks':!![]})[_0x8c71('0x27')](function(_0x29f31c){return _0x29f31c;});}return null;})[_0x8c71('0x27')](respondWithStatusCode(_0x5c4402,null))[_0x8c71('0x52')](handleError(_0x5c4402,null));};exports[_0x8c71('0x64')]=function(_0x233a6e,_0x11a396,_0x5d9847){return db[_0x8c71('0x39')][_0x8c71('0x65')]({'where':{'id':_0x233a6e[_0x8c71('0x61')]['id']}})['then'](handleEntityNotFound(_0x11a396,null))[_0x8c71('0x27')](function(_0x571a40){if(_0x571a40){return db['sequelize']['transaction'](function(_0x2733b0){return db[_0x8c71('0x39')][_0x8c71('0x28')]({'where':{'VoiceExtensionId':_0x233a6e[_0x8c71('0x61')]['id']},'transaction':_0x2733b0})[_0x8c71('0x27')](function(_0x3cde1e){var _0x2cdc2c=_[_0x8c71('0x3d')](_0x233a6e[_0x8c71('0x56')],function(_0x432ddc){_0x432ddc[_0x8c71('0x66')]=_0x233a6e[_0x8c71('0x61')]['id'];return _0x432ddc;});return db[_0x8c71('0x39')][_0x8c71('0x67')](_0x2cdc2c,{'transaction':_0x2733b0});});})[_0x8c71('0x27')](function(){return db[_0x8c71('0x39')][_0x8c71('0x68')]({'where':{'isApp':!![],'VoiceExtensionId':_0x233a6e[_0x8c71('0x61')]['id']},'order':_0x8c71('0x69')});});}})[_0x8c71('0x27')](respondWithResult(_0x11a396,null))[_0x8c71('0x52')](handleError(_0x11a396,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 23dd7ae..3a14f8a 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 _0xc593=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','save'];(function(_0x28fd11,_0xb7b5ca){var _0x51caa0=function(_0x39ffeb){while(--_0x39ffeb){_0x28fd11['push'](_0x28fd11['shift']());}};_0x51caa0(++_0xb7b5ca);}(_0xc593,0xfd));var _0x3c59=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc593[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x3c59('0x0'));var VoiceExtension=require(_0x3c59('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3c59('0x2'),'afterUpdate':_0x3c59('0x3'),'afterDestroy':_0x3c59('0x4')};function emitEvent(_0x5ef3d2){return function(_0x1df0c7,_0x81cfb6,_0x14e4fb){VoiceExtensionEvents['emit'](_0x5ef3d2+':'+_0x1df0c7['id'],_0x1df0c7);VoiceExtensionEvents[_0x3c59('0x5')](_0x5ef3d2,_0x1df0c7);_0x14e4fb(null);};}for(var e in events){if(events[_0x3c59('0x6')](e)){var event=events[e];VoiceExtension[_0x3c59('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xf619=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x557f81,_0x4f27ca){var _0x412209=function(_0x55b481){while(--_0x55b481){_0x557f81['push'](_0x557f81['shift']());}};_0x412209(++_0x4f27ca);}(_0xf619,0x17a));var _0x9f61=function(_0x1e3272,_0x3a8398){_0x1e3272=_0x1e3272-0x0;var _0x4c4154=_0xf619[_0x1e3272];return _0x4c4154;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x9f61('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9f61('0x1')](0x0);var events={'afterCreate':_0x9f61('0x2'),'afterUpdate':_0x9f61('0x3'),'afterDestroy':_0x9f61('0x4')};function emitEvent(_0x5a697c){return function(_0x53a007,_0x3fdaff,_0xcdb370){VoiceExtensionEvents[_0x9f61('0x5')](_0x5a697c+':'+_0x53a007['id'],_0x53a007);VoiceExtensionEvents[_0x9f61('0x5')](_0x5a697c,_0x53a007);_0xcdb370(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x9f61('0x6')](e,emitEvent(event));}}module[_0x9f61('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index dfe82cf..0391239 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 _0x94d9=['define','VoiceExtension','voice_extensions','lodash','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x5e6eb0,_0x256385){var _0x343f70=function(_0x311c69){while(--_0x311c69){_0x5e6eb0['push'](_0x5e6eb0['shift']());}};_0x343f70(++_0x256385);}(_0x94d9,0x12c));var _0x994d=function(_0x2ce76f,_0x3b7df0){_0x2ce76f=_0x2ce76f-0x0;var _0x1186c0=_0x94d9[_0x2ce76f];return _0x1186c0;};'use strict';var _=require(_0x994d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x994d('0x1'));var moment=require(_0x994d('0x2'));var BPromise=require(_0x994d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x994d('0x4'));var rimraf=require(_0x994d('0x5'));var config=require(_0x994d('0x6'));var attributes=require('./voiceExtension.attributes');module[_0x994d('0x7')]=function(_0x4bfe07,_0x42c6fb){return _0x4bfe07[_0x994d('0x8')](_0x994d('0x9'),attributes,{'tableName':_0x994d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2afe=['path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','voice_extensions','lodash','../../config/logger','request-promise'];(function(_0x469c0b,_0x3f26c3){var _0x462d58=function(_0x418fd3){while(--_0x418fd3){_0x469c0b['push'](_0x469c0b['shift']());}};_0x462d58(++_0x3f26c3);}(_0x2afe,0x15b));var _0xe2af=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2afe[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xe2af('0x0'));var util=require('util');var logger=require(_0xe2af('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe2af('0x2'));var fs=require('fs');var path=require(_0xe2af('0x3'));var rimraf=require(_0xe2af('0x4'));var config=require(_0xe2af('0x5'));var attributes=require(_0xe2af('0x6'));module[_0xe2af('0x7')]=function(_0x1ad46d,_0x4105b5){return _0x1ad46d[_0xe2af('0x8')]('VoiceExtension',attributes,{'tableName':_0xe2af('0x9'),'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 ff1f190..6859392 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 _0x7e2d=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','findAll','options','where','attributes','limit','include','model','map','debug','lodash','moment','../../mysqldb'];(function(_0x5182f9,_0x4acf0c){var _0x4c9fad=function(_0x453b0e){while(--_0x453b0e){_0x5182f9['push'](_0x5182f9['shift']());}};_0x4c9fad(++_0x4acf0c);}(_0x7e2d,0x141));var _0xd7e2=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7e2d[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xd7e2('0x0'));var util=require('util');var moment=require(_0xd7e2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7e2('0x2'))['db'];var utils=require(_0xd7e2('0x3'));var logger=require(_0xd7e2('0x4'))('rpc');var config=require(_0xd7e2('0x5'));var jayson=require(_0xd7e2('0x6'));var client=jayson[_0xd7e2('0x7')][_0xd7e2('0x8')]({'port':0x232a});config[_0xd7e2('0x9')]=_[_0xd7e2('0xa')](config[_0xd7e2('0x9')],{'host':_0xd7e2('0xb'),'port':0x18eb});var socket=require(_0xd7e2('0xc'))(new Redis(config[_0xd7e2('0x9')]));require(_0xd7e2('0xd'))[_0xd7e2('0xe')](socket);function respondWithRpcPromise(_0x1a8885,_0x5bbf19,_0x23f26e){return new BPromise(function(_0x1ee2fa,_0x2b61ed){return client['request'](_0x1a8885,_0x23f26e)[_0xd7e2('0xf')](function(_0x523664){logger[_0xd7e2('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x5bbf19,_0xd7e2('0x11'));logger['debug'](_0xd7e2('0x12'),_0x5bbf19,_0xd7e2('0x11'),JSON[_0xd7e2('0x13')](_0x523664));if(_0x523664[_0xd7e2('0x14')]){if(_0x523664[_0xd7e2('0x14')][_0xd7e2('0x15')]===0x1f4){logger[_0xd7e2('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x5bbf19,_0x523664['error']['message']);return _0x2b61ed(_0x523664[_0xd7e2('0x14')]['message']);}logger[_0xd7e2('0x14')](_0xd7e2('0x16'),_0x5bbf19,_0x523664[_0xd7e2('0x14')]['message']);return _0x1ee2fa(_0x523664[_0xd7e2('0x14')][_0xd7e2('0x17')]);}else{logger[_0xd7e2('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x5bbf19,'request\x20sent');_0x1ee2fa(_0x523664[_0xd7e2('0x18')][_0xd7e2('0x17')]);}})[_0xd7e2('0x19')](function(_0x4e81a6){logger[_0xd7e2('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x5bbf19,_0x4e81a6);_0x2b61ed(_0x4e81a6);});});}exports[_0xd7e2('0x1a')]=function(_0x505558){var _0x228a26=this;return new Promise(function(_0x4ede1d,_0x127932){return db['VoiceExtension'][_0xd7e2('0x1b')]({'raw':_0x505558['options']?_0x505558[_0xd7e2('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x505558[_0xd7e2('0x1c')]?_0x505558[_0xd7e2('0x1c')][_0xd7e2('0x1d')]||null:null,'attributes':_0x505558['options']?_0x505558[_0xd7e2('0x1c')][_0xd7e2('0x1e')]||null:null,'limit':_0x505558['options']?_0x505558[_0xd7e2('0x1c')][_0xd7e2('0x1f')]||null:null,'include':_0x505558[_0xd7e2('0x1c')]?_0x505558[_0xd7e2('0x1c')][_0xd7e2('0x20')]?_['map'](_0x505558[_0xd7e2('0x1c')]['include'],function(_0x3a10bc){return{'model':db[_0x3a10bc[_0xd7e2('0x21')]],'as':_0x3a10bc['as'],'attributes':_0x3a10bc[_0xd7e2('0x1e')],'include':_0x3a10bc[_0xd7e2('0x20')]?_[_0xd7e2('0x22')](_0x3a10bc[_0xd7e2('0x20')],function(_0x42cc64){return{'model':db[_0x42cc64['model']],'as':_0x42cc64['as'],'attributes':_0x42cc64['attributes'],'include':_0x42cc64[_0xd7e2('0x20')]?_[_0xd7e2('0x22')](_0x42cc64[_0xd7e2('0x20')],function(_0x2748c3){return{'model':db[_0x2748c3[_0xd7e2('0x21')]],'as':_0x2748c3['as'],'attributes':_0x2748c3[_0xd7e2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd7e2('0xf')](function(_0x20ab91){logger['info']('GetVoiceExtension',_0x505558);logger[_0xd7e2('0x23')](_0xd7e2('0x1a'),_0x505558,JSON[_0xd7e2('0x13')](_0x20ab91));_0x4ede1d(_0x20ab91);})[_0xd7e2('0x19')](function(_0xfca096){logger['error']('GetVoiceExtension',_0xfca096[_0xd7e2('0x17')],_0x505558);_0x127932(_0x228a26['error'](0x1f4,_0xfca096[_0xd7e2('0x17')]));});});}; \ No newline at end of file +var _0x261c=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','message','error','result','catch','VoiceExtension','findAll','options','where','attributes','limit','map','include','model','GetVoiceExtension','lodash','util','moment','randomstring','ioredis'];(function(_0x5c35ae,_0xd56d7c){var _0x88a731=function(_0x2733c9){while(--_0x2733c9){_0x5c35ae['push'](_0x5c35ae['shift']());}};_0x88a731(++_0xd56d7c);}(_0x261c,0x136));var _0xc261=function(_0x3a4838,_0x5eb63c){_0x3a4838=_0x3a4838-0x0;var _0x10fc53=_0x261c[_0x3a4838];return _0x10fc53;};'use strict';var _=require(_0xc261('0x0'));var util=require(_0xc261('0x1'));var moment=require(_0xc261('0x2'));var BPromise=require('bluebird');var rs=require(_0xc261('0x3'));var fs=require('fs');var Redis=require(_0xc261('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc261('0x5'))(_0xc261('0x6'));var config=require(_0xc261('0x7'));var jayson=require(_0xc261('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xc261('0x9')]=_[_0xc261('0xa')](config[_0xc261('0x9')],{'host':_0xc261('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc261('0x9')]));require(_0xc261('0xc'))[_0xc261('0xd')](socket);function respondWithRpcPromise(_0x555573,_0x34aa55,_0x32d357){return new BPromise(function(_0x3fef17,_0x4d7e92){return client[_0xc261('0xe')](_0x555573,_0x32d357)[_0xc261('0xf')](function(_0x19eb0e){logger[_0xc261('0x10')](_0xc261('0x11'),_0x34aa55,_0xc261('0x12'));logger[_0xc261('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x34aa55,'request\x20sent',JSON[_0xc261('0x14')](_0x19eb0e));if(_0x19eb0e['error']){if(_0x19eb0e['error']['code']===0x1f4){logger['error'](_0xc261('0x11'),_0x34aa55,_0x19eb0e['error'][_0xc261('0x15')]);return _0x4d7e92(_0x19eb0e[_0xc261('0x16')][_0xc261('0x15')]);}logger[_0xc261('0x16')](_0xc261('0x11'),_0x34aa55,_0x19eb0e['error'][_0xc261('0x15')]);return _0x3fef17(_0x19eb0e[_0xc261('0x16')][_0xc261('0x15')]);}else{logger[_0xc261('0x10')](_0xc261('0x11'),_0x34aa55,_0xc261('0x12'));_0x3fef17(_0x19eb0e[_0xc261('0x17')][_0xc261('0x15')]);}})[_0xc261('0x18')](function(_0x22af5a){logger['error'](_0xc261('0x11'),_0x34aa55,_0x22af5a);_0x4d7e92(_0x22af5a);});});}exports['GetVoiceExtension']=function(_0x3a0524){var _0x51d053=this;return new Promise(function(_0x4352cc,_0xa5ed70){return db[_0xc261('0x19')][_0xc261('0x1a')]({'raw':_0x3a0524['options']?_0x3a0524[_0xc261('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3a0524[_0xc261('0x1b')]?_0x3a0524[_0xc261('0x1b')][_0xc261('0x1c')]||null:null,'attributes':_0x3a0524[_0xc261('0x1b')]?_0x3a0524['options'][_0xc261('0x1d')]||null:null,'limit':_0x3a0524[_0xc261('0x1b')]?_0x3a0524[_0xc261('0x1b')][_0xc261('0x1e')]||null:null,'include':_0x3a0524[_0xc261('0x1b')]?_0x3a0524[_0xc261('0x1b')]['include']?_[_0xc261('0x1f')](_0x3a0524[_0xc261('0x1b')][_0xc261('0x20')],function(_0x2e12f9){return{'model':db[_0x2e12f9[_0xc261('0x21')]],'as':_0x2e12f9['as'],'attributes':_0x2e12f9[_0xc261('0x1d')],'include':_0x2e12f9['include']?_[_0xc261('0x1f')](_0x2e12f9[_0xc261('0x20')],function(_0x232ba8){return{'model':db[_0x232ba8[_0xc261('0x21')]],'as':_0x232ba8['as'],'attributes':_0x232ba8[_0xc261('0x1d')],'include':_0x232ba8[_0xc261('0x20')]?_['map'](_0x232ba8[_0xc261('0x20')],function(_0x15ade4){return{'model':db[_0x15ade4[_0xc261('0x21')]],'as':_0x15ade4['as'],'attributes':_0x15ade4[_0xc261('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc261('0xf')](function(_0x18eefb){logger[_0xc261('0x10')]('GetVoiceExtension',_0x3a0524);logger[_0xc261('0x13')](_0xc261('0x22'),_0x3a0524,JSON[_0xc261('0x14')](_0x18eefb));_0x4352cc(_0x18eefb);})[_0xc261('0x18')](function(_0x591961){logger['error'](_0xc261('0x22'),_0x591961[_0xc261('0x15')],_0x3a0524);_0xa5ed70(_0x51d053['error'](0x1f4,_0x591961[_0xc261('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index b75f2d5..bb98962 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 _0x775e=['update','removeListener','register','length','save'];(function(_0x2f3b86,_0x1fffad){var _0x9741a0=function(_0x654b64){while(--_0x654b64){_0x2f3b86['push'](_0x2f3b86['shift']());}};_0x9741a0(++_0x1fffad);}(_0x775e,0x7c));var _0xe775=function(_0x458ccc,_0x162b59){_0x458ccc=_0x458ccc-0x0;var _0x2bcf2c=_0x775e[_0x458ccc];return _0x2bcf2c;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0xe775('0x0'),'remove',_0xe775('0x1')];function createListener(_0x1cd4aa,_0x25958e){return function(_0x47d93e){_0x25958e['emit'](_0x1cd4aa,_0x47d93e);};}function removeListener(_0x28715e,_0x4779ba){return function(){VoiceExtensionEvents[_0xe775('0x2')](_0x28715e,_0x4779ba);};}exports[_0xe775('0x3')]=function(_0x441fdd){for(var _0x238d1d=0x0,_0x40f89f=events[_0xe775('0x4')];_0x238d1d<_0x40f89f;_0x238d1d++){var _0x63d148=events[_0x238d1d];var _0x3c0f7e=createListener('voiceExtension:'+_0x63d148,_0x441fdd);VoiceExtensionEvents['on'](_0x63d148,_0x3c0f7e);}}; \ No newline at end of file +var _0x055c=['removeListener','register','length','./voiceExtension.events','save','remove','update'];(function(_0x1857b4,_0x1b6ff0){var _0x19100e=function(_0x322e93){while(--_0x322e93){_0x1857b4['push'](_0x1857b4['shift']());}};_0x19100e(++_0x1b6ff0);}(_0x055c,0x1c3));var _0xc055=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x055c[_0x164af1];return _0x5d81a2;};'use strict';var VoiceExtensionEvents=require(_0xc055('0x0'));var events=[_0xc055('0x1'),_0xc055('0x2'),_0xc055('0x3')];function createListener(_0x2dfd1f,_0x5e00a8){return function(_0x225b5a){_0x5e00a8['emit'](_0x2dfd1f,_0x225b5a);};}function removeListener(_0x48bc02,_0x2a9fe6){return function(){VoiceExtensionEvents[_0xc055('0x4')](_0x48bc02,_0x2a9fe6);};}exports[_0xc055('0x5')]=function(_0x403364){for(var _0x75bbc3=0x0,_0x1d8baa=events[_0xc055('0x6')];_0x75bbc3<_0x1d8baa;_0x75bbc3++){var _0x2c989f=events[_0x75bbc3];var _0x43c60=createListener('voiceExtension:'+_0x2c989f,_0x403364);VoiceExtensionEvents['on'](_0x2c989f,_0x43c60);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 58f5eca..f87a687 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 _0x8105=['show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x8105,0x107));var _0x5810=function(_0x5287f2,_0x2c017d){_0x5287f2=_0x5287f2-0x0;var _0x1cc418=_0x8105[_0x5287f2];return _0x1cc418;};'use strict';var multer=require(_0x5810('0x0'));var util=require(_0x5810('0x1'));var path=require(_0x5810('0x2'));var timeout=require(_0x5810('0x3'));var express=require(_0x5810('0x4'));var router=express[_0x5810('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5810('0x6'));var config=require(_0x5810('0x7'));var controller=require(_0x5810('0x8'));router[_0x5810('0x9')]('/',auth[_0x5810('0xa')](),controller[_0x5810('0xb')]);router[_0x5810('0x9')](_0x5810('0xc'),auth[_0x5810('0xa')](),controller[_0x5810('0xd')]);router[_0x5810('0x9')](_0x5810('0xe'),auth[_0x5810('0xa')](),controller[_0x5810('0xf')]);router[_0x5810('0x10')]('/',auth[_0x5810('0xa')](),controller[_0x5810('0x11')]);router[_0x5810('0x12')](_0x5810('0xc'),auth['isAuthenticated'](),controller[_0x5810('0x13')]);router[_0x5810('0x14')](_0x5810('0xc'),auth[_0x5810('0xa')](),controller[_0x5810('0x15')]);module[_0x5810('0x16')]=router; \ No newline at end of file +var _0x6e80=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy','exports','multer'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6e80,0x1cd));var _0x06e8=function(_0x274acb,_0x47715b){_0x274acb=_0x274acb-0x0;var _0x13e2b3=_0x6e80[_0x274acb];return _0x13e2b3;};'use strict';var multer=require(_0x06e8('0x0'));var util=require(_0x06e8('0x1'));var path=require(_0x06e8('0x2'));var timeout=require(_0x06e8('0x3'));var express=require(_0x06e8('0x4'));var router=express['Router']();var auth=require(_0x06e8('0x5'));var interaction=require(_0x06e8('0x6'));var config=require(_0x06e8('0x7'));var controller=require('./voiceMail.controller');router[_0x06e8('0x8')]('/',auth[_0x06e8('0x9')](),controller[_0x06e8('0xa')]);router[_0x06e8('0x8')](_0x06e8('0xb'),auth[_0x06e8('0x9')](),controller[_0x06e8('0xc')]);router['get'](_0x06e8('0xd'),auth[_0x06e8('0x9')](),controller[_0x06e8('0xe')]);router[_0x06e8('0xf')]('/',auth['isAuthenticated'](),controller[_0x06e8('0x10')]);router['put'](_0x06e8('0xb'),auth['isAuthenticated'](),controller[_0x06e8('0x11')]);router[_0x06e8('0x12')](_0x06e8('0xb'),auth['isAuthenticated'](),controller[_0x06e8('0x13')]);module[_0x06e8('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 725c207..0d5f98e 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 _0x4483=['email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x1de400,_0x393e2d){var _0x2846b5=function(_0x220876){while(--_0x220876){_0x1de400['push'](_0x1de400['shift']());}};_0x2846b5(++_0x393e2d);}(_0x4483,0x1a3));var _0x3448=function(_0x109567,_0x30dd09){_0x109567=_0x109567-0x0;var _0x4a1655=_0x4483[_0x109567];return _0x4a1655;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'customer_id':{'type':Sequelize[_0x3448('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x3448('0x3'),'unique':_0x3448('0x4')},'mailbox':{'type':Sequelize[_0x3448('0x2')],'defaultValue':'','allowNull':![],'unique':_0x3448('0x4')},'password':{'type':Sequelize[_0x3448('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3448('0x2')],'validate':{'isEmail':!![]},'set':function(_0x6a89b){this[_0x3448('0x5')](_0x3448('0x6'),typeof _0x6a89b===_0x3448('0x7')&&_0x6a89b[_0x3448('0x8')]()?_0x6a89b[_0x3448('0x8')]():null);}},'pager':{'type':Sequelize[_0x3448('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x3448('0x9')](_0x3448('0xa'),'no'),'defaultValue':_0x3448('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3448('0x9')](_0x3448('0xa'),'no'),'defaultValue':_0x3448('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3448('0x2')]},'callback':{'type':Sequelize[_0x3448('0x2')]},'review':{'type':Sequelize[_0x3448('0x9')](_0x3448('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3448('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x3448('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3448('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3448('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3448('0x9')](_0x3448('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x3448('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3448('0x9')]('yes','no'),'defaultValue':_0x3448('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3448('0x9')](_0x3448('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x3448('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3448('0x9')](_0x3448('0xa'),'no'),'defaultValue':_0x3448('0xa'),'allowNull':![]},'stamp':{'type':_0x3448('0xc')},'emailsubject':{'type':Sequelize[_0x3448('0x2')]},'emailbody':{'type':Sequelize[_0x3448('0x2')]},'maxsecs':{'type':Sequelize[_0x3448('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3448('0xe')],'get':function(){return this['getDataValue']('fullname')+'\x20-\x20'+this[_0x3448('0xf')](_0x3448('0x10'));}}}; \ No newline at end of file +var _0xe5b5=['setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x152999,_0x1dd83b){var _0x32ef67=function(_0xe8dc18){while(--_0xe8dc18){_0x152999['push'](_0x152999['shift']());}};_0x32ef67(++_0x1dd83b);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0xe5b5[_0x57b432];return _0x2edf2a;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'customer_id':{'type':Sequelize[_0x5e5b('0x2')]},'context':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':_0x5e5b('0x3'),'unique':_0x5e5b('0x4')},'mailbox':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':'','allowNull':![],'unique':_0x5e5b('0x4')},'password':{'type':Sequelize[_0x5e5b('0x2')]},'fullname':{'type':Sequelize[_0x5e5b('0x2')]},'email':{'type':Sequelize[_0x5e5b('0x2')],'validate':{'isEmail':!![]},'set':function(_0x40bc5b){this[_0x5e5b('0x5')](_0x5e5b('0x6'),typeof _0x40bc5b===_0x5e5b('0x7')&&_0x40bc5b[_0x5e5b('0x8')]()?_0x40bc5b[_0x5e5b('0x8')]():null);}},'pager':{'type':Sequelize[_0x5e5b('0x2')]},'tz':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':_0x5e5b('0x9')},'attach':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':_0x5e5b('0xb'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x5e5b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x5e5b('0x2')]},'callback':{'type':Sequelize[_0x5e5b('0x2')]},'review':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5e5b('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5e5b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x5e5b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x5e5b('0xd')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x5e5b('0x2')]},'maxsecs':{'type':Sequelize[_0x5e5b('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5e5b('0xf')],'get':function(){return this[_0x5e5b('0x10')](_0x5e5b('0x11'))+'\x20-\x20'+this[_0x5e5b('0x10')](_0x5e5b('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index c95cad5..52226aa 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 _0x81b7=['eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','then','destroy','Voicemails','UserProfileResource','error','name','send','index','VoiceMail','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','filters','mailbox','findAndCountAll'];(function(_0x134edc,_0x1f4890){var _0x4fa860=function(_0x43ae8a){while(--_0x43ae8a){_0x134edc['push'](_0x134edc['shift']());}};_0x4fa860(++_0x1f4890);}(_0x81b7,0x1f2));var _0x781b=function(_0x405187,_0x5cd6be){_0x405187=_0x405187-0x0;var _0x453abe=_0x81b7[_0x405187];return _0x453abe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x781b('0x0'));var rimraf=require(_0x781b('0x1'));var zipdir=require(_0x781b('0x2'));var jsonpatch=require(_0x781b('0x3'));var rp=require('request-promise');var moment=require(_0x781b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x781b('0x5'));var util=require(_0x781b('0x6'));var path=require(_0x781b('0x7'));var sox=require(_0x781b('0x8'));var csv=require('to-csv');var ejs=require(_0x781b('0x9'));var fs=require('fs');var _=require(_0x781b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x781b('0xb'));var deskjs=require(_0x781b('0xc'));var toCsv=require(_0x781b('0xd'));var querystring=require(_0x781b('0xe'));var Papa=require('papaparse');var Redis=require(_0x781b('0xf'));var authService=require(_0x781b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x781b('0x11'));var logger=require('../../config/logger')(_0x781b('0x12'));var utils=require('../../config/utils');var config=require(_0x781b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x781b('0x14'))['db'];function respondWithStatusCode(_0x5d1dcb,_0xfb736f){_0xfb736f=_0xfb736f||0xcc;return function(_0x17242f){if(_0x17242f){return _0x5d1dcb[_0x781b('0x15')](_0xfb736f);}return _0x5d1dcb[_0x781b('0x16')](_0xfb736f)[_0x781b('0x17')]();};}function respondWithResult(_0x52bbe4,_0x2bca7f){_0x2bca7f=_0x2bca7f||0xc8;return function(_0x335e7b){if(_0x335e7b){return _0x52bbe4[_0x781b('0x16')](_0x2bca7f)[_0x781b('0x18')](_0x335e7b);}};}function respondWithFilteredResult(_0x587d56,_0x35503a){return function(_0x533377){if(_0x533377){var _0x176e91=_0x533377[_0x781b('0x19')],_0x40a6ea=_0x35503a['offset'],_0x1d0282=_0x35503a['offset']+_0x35503a[_0x781b('0x1a')],_0x4ac48a;if(_0x1d0282>=_0x176e91){_0x1d0282=_0x176e91;_0x4ac48a=0xc8;}else{_0x4ac48a=0xce;}_0x587d56[_0x781b('0x16')](_0x4ac48a);return _0x587d56[_0x781b('0x1b')](_0x781b('0x1c'),_0x40a6ea+'-'+_0x1d0282+'/'+_0x176e91)[_0x781b('0x18')](_0x533377);}return null;};}function patchUpdates(_0x54c1e0){return function(_0x58b961){try{jsonpatch['apply'](_0x58b961,_0x54c1e0,!![]);}catch(_0x2bc30a){return BPromise[_0x781b('0x1d')](_0x2bc30a);}return _0x58b961[_0x781b('0x1e')]();};}function saveUpdates(_0x23c239,_0x2aaa43){return function(_0x49a80e){if(_0x49a80e){return _0x49a80e['update'](_0x23c239)[_0x781b('0x1f')](function(_0x3f7800){return _0x3f7800;});}return null;};}function removeEntity(_0xce8565,_0x4ab3c4){return function(_0x13d2e4){if(_0x13d2e4){return _0x13d2e4[_0x781b('0x20')]()[_0x781b('0x1f')](function(){var _0x882cff=_0x13d2e4['get']({'plain':!![]});var _0x28dcfc=_0x781b('0x21');return db[_0x781b('0x22')][_0x781b('0x20')]({'where':{'type':_0x28dcfc,'resourceId':_0x882cff['id']}})[_0x781b('0x1f')](function(){return _0x13d2e4;});})['then'](function(){_0xce8565[_0x781b('0x16')](0xcc)[_0x781b('0x17')]();});}};}function handleEntityNotFound(_0x31795d,_0x22cdc0){return function(_0x38ba8f){if(!_0x38ba8f){_0x31795d[_0x781b('0x15')](0x194);}return _0x38ba8f;};}function handleError(_0x48624d,_0x4e7037){_0x4e7037=_0x4e7037||0x1f4;return function(_0x33d73d){logger[_0x781b('0x23')](_0x33d73d['stack']);if(_0x33d73d[_0x781b('0x24')]){delete _0x33d73d[_0x781b('0x24')];}_0x48624d[_0x781b('0x16')](_0x4e7037)[_0x781b('0x25')](_0x33d73d);};}exports[_0x781b('0x26')]=function(_0x3d3d4c,_0x1957c4){var _0x1cd983={},_0x416c75={},_0x322947={'count':0x0,'rows':[]};var _0x7df379=_['map'](db[_0x781b('0x27')][_0x781b('0x28')],function(_0x588f91){return{'name':_0x588f91['fieldName'],'type':_0x588f91[_0x781b('0x29')][_0x781b('0x2a')]};});_0x416c75[_0x781b('0x2b')]=_[_0x781b('0x2c')](_0x7df379,_0x781b('0x24'));_0x416c75[_0x781b('0x2d')]=_[_0x781b('0x2e')](_0x3d3d4c[_0x781b('0x2d')]);_0x416c75['filters']=_[_0x781b('0x2f')](_0x416c75['model'],_0x416c75[_0x781b('0x2d')]);_0x1cd983['attributes']=_[_0x781b('0x2f')](_0x416c75[_0x781b('0x2b')],qs['fields'](_0x3d3d4c[_0x781b('0x2d')][_0x781b('0x30')]));_0x1cd983[_0x781b('0x31')]=_0x1cd983[_0x781b('0x31')][_0x781b('0x32')]?_0x1cd983[_0x781b('0x31')]:_0x416c75['model'];if(!_0x3d3d4c[_0x781b('0x2d')][_0x781b('0x33')](_0x781b('0x34'))){_0x1cd983[_0x781b('0x1a')]=qs[_0x781b('0x1a')](_0x3d3d4c[_0x781b('0x2d')][_0x781b('0x1a')]);_0x1cd983[_0x781b('0x35')]=qs[_0x781b('0x35')](_0x3d3d4c[_0x781b('0x2d')][_0x781b('0x35')]);}_0x1cd983[_0x781b('0x36')]=qs['sort'](_0x3d3d4c[_0x781b('0x2d')][_0x781b('0x37')]);_0x1cd983[_0x781b('0x38')]=qs['filters'](_[_0x781b('0x39')](_0x3d3d4c['query'],_0x416c75['filters']),_0x7df379);if(_0x3d3d4c[_0x781b('0x2d')][_0x781b('0x3a')]){_0x1cd983[_0x781b('0x38')]=_['merge'](_0x1cd983[_0x781b('0x38')],{'$or':_['map'](_0x7df379,function(_0xc2a62){if(_0xc2a62[_0x781b('0x29')]!==_0x781b('0x3b')){var _0x170c1d={};_0x170c1d[_0xc2a62[_0x781b('0x24')]]={'$like':'%'+_0x3d3d4c['query']['filter']+'%'};return _0x170c1d;}})});}_0x1cd983=_[_0x781b('0x3c')]({},_0x1cd983,_0x3d3d4c['options']);var _0x104b4c={'where':_0x1cd983['where']};return db[_0x781b('0x27')]['count'](_0x104b4c)[_0x781b('0x1f')](function(_0x2e0212){_0x322947[_0x781b('0x19')]=_0x2e0212;if(_0x3d3d4c[_0x781b('0x2d')][_0x781b('0x3d')]){_0x1cd983[_0x781b('0x3e')]=[{'all':!![]}];}return db['VoiceMail'][_0x781b('0x3f')](_0x1cd983);})[_0x781b('0x1f')](function(_0x1aa034){_0x322947['rows']=_0x1aa034;return _0x322947;})[_0x781b('0x1f')](respondWithFilteredResult(_0x1957c4,_0x1cd983))[_0x781b('0x40')](handleError(_0x1957c4,null));};exports['show']=function(_0x4de160,_0x16f520){var _0x566313={'raw':!![],'where':{'id':_0x4de160['params']['id']}},_0x5ad663={};_0x5ad663[_0x781b('0x2b')]=_[_0x781b('0x2e')](db[_0x781b('0x27')][_0x781b('0x28')]);_0x5ad663[_0x781b('0x2d')]=_[_0x781b('0x2e')](_0x4de160[_0x781b('0x2d')]);_0x5ad663['filters']=_[_0x781b('0x2f')](_0x5ad663['model'],_0x5ad663[_0x781b('0x2d')]);_0x566313['attributes']=_[_0x781b('0x2f')](_0x5ad663['model'],qs[_0x781b('0x30')](_0x4de160[_0x781b('0x2d')][_0x781b('0x30')]));_0x566313[_0x781b('0x31')]=_0x566313[_0x781b('0x31')][_0x781b('0x32')]?_0x566313[_0x781b('0x31')]:_0x5ad663[_0x781b('0x2b')];if(_0x4de160[_0x781b('0x2d')][_0x781b('0x3d')]){_0x566313[_0x781b('0x3e')]=[{'all':!![]}];}_0x566313=_['merge']({},_0x566313,_0x4de160[_0x781b('0x41')]);return db[_0x781b('0x27')][_0x781b('0x42')](_0x566313)[_0x781b('0x1f')](handleEntityNotFound(_0x16f520,null))[_0x781b('0x1f')](respondWithResult(_0x16f520,null))[_0x781b('0x40')](handleError(_0x16f520,null));};exports['create']=function(_0x4deea3,_0x5ddb43){return db['VoiceMail'][_0x781b('0x43')](_0x4deea3[_0x781b('0x44')],{})[_0x781b('0x1f')](function(_0x1caa51){var _0x53522b=_0x4deea3[_0x781b('0x45')][_0x781b('0x46')]({'plain':!![]});if(!_0x53522b)throw new Error(_0x781b('0x47'));if(_0x53522b['role']===_0x781b('0x45')){var _0x4d1350=_0x1caa51[_0x781b('0x46')]({'plain':!![]});var _0x459038=_0x781b('0x21');return db[_0x781b('0x48')][_0x781b('0x42')]({'where':{'name':_0x459038,'userProfileId':_0x53522b[_0x781b('0x49')]},'raw':!![]})[_0x781b('0x1f')](function(_0x1d74ff){if(_0x1d74ff&&_0x1d74ff[_0x781b('0x4a')]===0x0){return db[_0x781b('0x22')][_0x781b('0x43')]({'name':_0x4d1350['name'],'resourceId':_0x4d1350['id'],'type':_0x1d74ff['name'],'sectionId':_0x1d74ff['id']},{})['then'](function(){return _0x1caa51;});}else{return _0x1caa51;}})[_0x781b('0x40')](function(_0x4e0af3){logger[_0x781b('0x23')](_0x781b('0x4b'),_0x4e0af3);throw _0x4e0af3;});}return _0x1caa51;})[_0x781b('0x1f')](respondWithResult(_0x5ddb43,0xc9))['catch'](handleError(_0x5ddb43,null));};exports['update']=function(_0x25a5ea,_0x307545){if(_0x25a5ea[_0x781b('0x44')]['id']){delete _0x25a5ea[_0x781b('0x44')]['id'];}return db[_0x781b('0x27')]['find']({'where':{'id':_0x25a5ea[_0x781b('0x4c')]['id']}})[_0x781b('0x1f')](handleEntityNotFound(_0x307545,null))[_0x781b('0x1f')](saveUpdates(_0x25a5ea['body'],null))[_0x781b('0x1f')](respondWithResult(_0x307545,null))[_0x781b('0x40')](handleError(_0x307545,null));};exports[_0x781b('0x20')]=function(_0x312471,_0x58508f){return db['VoiceMail'][_0x781b('0x42')]({'where':{'id':_0x312471[_0x781b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x58508f,null))[_0x781b('0x1f')](removeEntity(_0x58508f,null))[_0x781b('0x40')](handleError(_0x58508f,null));};exports[_0x781b('0x4d')]=function(_0x45c24a,_0x3ae38a,_0x432747){return db[_0x781b('0x27')][_0x781b('0x4e')]({'where':{'id':_0x45c24a[_0x781b('0x4c')]['id']}})[_0x781b('0x1f')](handleEntityNotFound(_0x3ae38a,null))['then'](function(_0xc82a63){var _0x4278eb;var _0x4ce011={},_0x338c9b={};_0x338c9b['model']=_[_0x781b('0x2e')](db[_0x781b('0x4f')]['rawAttributes']);_0x338c9b['query']=_[_0x781b('0x2e')](_0x45c24a[_0x781b('0x2d')]);_0x338c9b[_0x781b('0x50')]=_[_0x781b('0x2f')](_0x338c9b['model'],_0x338c9b['query']);_0x4ce011['attributes']=_['intersection'](_0x338c9b[_0x781b('0x2b')],qs[_0x781b('0x30')](_0x45c24a['query'][_0x781b('0x30')]));_0x4ce011[_0x781b('0x31')]=_0x4ce011['attributes'][_0x781b('0x32')]?_0x4ce011[_0x781b('0x31')]:_0x338c9b[_0x781b('0x2b')];if(!_0x45c24a[_0x781b('0x2d')]['hasOwnProperty'](_0x781b('0x34'))){_0x4ce011['limit']=qs['limit'](_0x45c24a[_0x781b('0x2d')][_0x781b('0x1a')]);_0x4ce011['offset']=qs[_0x781b('0x35')](_0x45c24a['query'][_0x781b('0x35')]);}_0x4ce011[_0x781b('0x36')]=qs['sort'](_0x45c24a[_0x781b('0x2d')][_0x781b('0x37')]);_0x4ce011[_0x781b('0x38')]=qs[_0x781b('0x50')](_['pick'](_0x45c24a[_0x781b('0x2d')],_0x338c9b['filters']));if(_0x45c24a[_0x781b('0x2d')][_0x781b('0x3a')]){_0x4ce011[_0x781b('0x38')]=_[_0x781b('0x3c')](_0x4ce011[_0x781b('0x38')],{'$or':_['map'](_0x4ce011[_0x781b('0x31')],function(_0x1d1f81){var _0x3aa2a9={};_0x3aa2a9[_0x1d1f81]={'$like':'%'+_0x45c24a[_0x781b('0x2d')][_0x781b('0x3a')]+'%'};return _0x3aa2a9;})});}_0x4ce011[_0x781b('0x38')]=_['merge'](_0x4ce011[_0x781b('0x38')],{'mailboxuser':_0xc82a63[_0x781b('0x51')]});_0x4ce011=_[_0x781b('0x3c')]({},_0x4ce011,_0x45c24a[_0x781b('0x41')]);return db[_0x781b('0x4f')][_0x781b('0x52')](_0x4ce011)[_0x781b('0x1f')](respondWithFilteredResult(_0x3ae38a,_0x4ce011));})[_0x781b('0x40')](handleError(_0x3ae38a,null));}; \ No newline at end of file +var _0x4639=['VoiceMail','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','pick','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','filter','where','merge','type','VIRTUAL','options'];(function(_0x51bfa7,_0x51c8e0){var _0x1cf7ae=function(_0x5e5625){while(--_0x5e5625){_0x51bfa7['push'](_0x51bfa7['shift']());}};_0x1cf7ae(++_0x51c8e0);}(_0x4639,0x115));var _0x9463=function(_0x3a3f6d,_0x42965a){_0x3a3f6d=_0x3a3f6d-0x0;var _0x324bbe=_0x4639[_0x3a3f6d];return _0x324bbe;};'use strict';var pdf=require(_0x9463('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9463('0x1'));var jsonpatch=require(_0x9463('0x2'));var rp=require(_0x9463('0x3'));var moment=require(_0x9463('0x4'));var BPromise=require(_0x9463('0x5'));var Mustache=require(_0x9463('0x6'));var util=require(_0x9463('0x7'));var path=require('path');var sox=require(_0x9463('0x8'));var csv=require(_0x9463('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9463('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9463('0xb'));var toCsv=require(_0x9463('0x9'));var querystring=require(_0x9463('0xc'));var Papa=require('papaparse');var Redis=require(_0x9463('0xd'));var authService=require(_0x9463('0xe'));var qs=require(_0x9463('0xf'));var as=require(_0x9463('0x10'));var hardwareService=require(_0x9463('0x11'));var logger=require(_0x9463('0x12'))(_0x9463('0x13'));var utils=require(_0x9463('0x14'));var config=require(_0x9463('0x15'));var licenseUtil=require(_0x9463('0x16'));var db=require(_0x9463('0x17'))['db'];function respondWithStatusCode(_0x3b9c65,_0x180cfd){_0x180cfd=_0x180cfd||0xcc;return function(_0x3bb684){if(_0x3bb684){return _0x3b9c65[_0x9463('0x18')](_0x180cfd);}return _0x3b9c65[_0x9463('0x19')](_0x180cfd)[_0x9463('0x1a')]();};}function respondWithResult(_0x24b1ec,_0x14a5e5){_0x14a5e5=_0x14a5e5||0xc8;return function(_0x4a0cd4){if(_0x4a0cd4){return _0x24b1ec[_0x9463('0x19')](_0x14a5e5)['json'](_0x4a0cd4);}};}function respondWithFilteredResult(_0x19259c,_0x281237){return function(_0x1915e5){if(_0x1915e5){var _0x2054a3=_0x1915e5[_0x9463('0x1b')],_0x20c285=_0x281237[_0x9463('0x1c')],_0x5a9e0d=_0x281237['offset']+_0x281237['limit'],_0x3d5a81;if(_0x5a9e0d>=_0x2054a3){_0x5a9e0d=_0x2054a3;_0x3d5a81=0xc8;}else{_0x3d5a81=0xce;}_0x19259c[_0x9463('0x19')](_0x3d5a81);return _0x19259c[_0x9463('0x1d')](_0x9463('0x1e'),_0x20c285+'-'+_0x5a9e0d+'/'+_0x2054a3)[_0x9463('0x1f')](_0x1915e5);}return null;};}function patchUpdates(_0x3655d0){return function(_0x3a6ac2){try{jsonpatch[_0x9463('0x20')](_0x3a6ac2,_0x3655d0,!![]);}catch(_0x77df85){return BPromise[_0x9463('0x21')](_0x77df85);}return _0x3a6ac2[_0x9463('0x22')]();};}function saveUpdates(_0x3d26e4,_0x58d79c){return function(_0x2b9e21){if(_0x2b9e21){return _0x2b9e21[_0x9463('0x23')](_0x3d26e4)[_0x9463('0x24')](function(_0x3aa225){return _0x3aa225;});}return null;};}function removeEntity(_0x545c48,_0x24f85a){return function(_0x44e03d){if(_0x44e03d){return _0x44e03d[_0x9463('0x25')]()[_0x9463('0x24')](function(){var _0x6f0db1=_0x44e03d[_0x9463('0x26')]({'plain':!![]});var _0x214f7e=_0x9463('0x27');return db[_0x9463('0x28')][_0x9463('0x25')]({'where':{'type':_0x214f7e,'resourceId':_0x6f0db1['id']}})[_0x9463('0x24')](function(){return _0x44e03d;});})[_0x9463('0x24')](function(){_0x545c48[_0x9463('0x19')](0xcc)[_0x9463('0x1a')]();});}};}function handleEntityNotFound(_0x62286d,_0x20f9db){return function(_0x41716a){if(!_0x41716a){_0x62286d[_0x9463('0x18')](0x194);}return _0x41716a;};}function handleError(_0x505207,_0x41f190){_0x41f190=_0x41f190||0x1f4;return function(_0x1293fa){logger[_0x9463('0x29')](_0x1293fa[_0x9463('0x2a')]);if(_0x1293fa[_0x9463('0x2b')]){delete _0x1293fa['name'];}_0x505207[_0x9463('0x19')](_0x41f190)['send'](_0x1293fa);};}exports[_0x9463('0x2c')]=function(_0x18723a,_0x1777f7){var _0xb39a03={},_0x196c0b={},_0x26b6a5={'count':0x0,'rows':[]};var _0x18db64=_['map'](db['VoiceMail'][_0x9463('0x2d')],function(_0x23a13f){return{'name':_0x23a13f[_0x9463('0x2e')],'type':_0x23a13f['type'][_0x9463('0x2f')]};});_0x196c0b[_0x9463('0x30')]=_[_0x9463('0x31')](_0x18db64,_0x9463('0x2b'));_0x196c0b[_0x9463('0x32')]=_[_0x9463('0x33')](_0x18723a[_0x9463('0x32')]);_0x196c0b[_0x9463('0x34')]=_[_0x9463('0x35')](_0x196c0b[_0x9463('0x30')],_0x196c0b[_0x9463('0x32')]);_0xb39a03[_0x9463('0x36')]=_[_0x9463('0x35')](_0x196c0b[_0x9463('0x30')],qs[_0x9463('0x37')](_0x18723a[_0x9463('0x32')][_0x9463('0x37')]));_0xb39a03[_0x9463('0x36')]=_0xb39a03[_0x9463('0x36')][_0x9463('0x38')]?_0xb39a03[_0x9463('0x36')]:_0x196c0b['model'];if(!_0x18723a['query']['hasOwnProperty'](_0x9463('0x39'))){_0xb39a03[_0x9463('0x3a')]=qs[_0x9463('0x3a')](_0x18723a[_0x9463('0x32')][_0x9463('0x3a')]);_0xb39a03[_0x9463('0x1c')]=qs[_0x9463('0x1c')](_0x18723a[_0x9463('0x32')][_0x9463('0x1c')]);}_0xb39a03[_0x9463('0x3b')]=qs[_0x9463('0x3c')](_0x18723a[_0x9463('0x32')][_0x9463('0x3c')]);_0xb39a03['where']=qs[_0x9463('0x34')](_['pick'](_0x18723a[_0x9463('0x32')],_0x196c0b['filters']),_0x18db64);if(_0x18723a[_0x9463('0x32')][_0x9463('0x3d')]){_0xb39a03[_0x9463('0x3e')]=_[_0x9463('0x3f')](_0xb39a03[_0x9463('0x3e')],{'$or':_[_0x9463('0x31')](_0x18db64,function(_0x520582){if(_0x520582[_0x9463('0x40')]!==_0x9463('0x41')){var _0x8c74e4={};_0x8c74e4[_0x520582[_0x9463('0x2b')]]={'$like':'%'+_0x18723a[_0x9463('0x32')][_0x9463('0x3d')]+'%'};return _0x8c74e4;}})});}_0xb39a03=_[_0x9463('0x3f')]({},_0xb39a03,_0x18723a[_0x9463('0x42')]);var _0x12f412={'where':_0xb39a03[_0x9463('0x3e')]};return db[_0x9463('0x43')][_0x9463('0x1b')](_0x12f412)[_0x9463('0x24')](function(_0x329e8d){_0x26b6a5[_0x9463('0x1b')]=_0x329e8d;if(_0x18723a[_0x9463('0x32')][_0x9463('0x44')]){_0xb39a03[_0x9463('0x45')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0xb39a03);})[_0x9463('0x24')](function(_0x193958){_0x26b6a5[_0x9463('0x46')]=_0x193958;return _0x26b6a5;})[_0x9463('0x24')](respondWithFilteredResult(_0x1777f7,_0xb39a03))['catch'](handleError(_0x1777f7,null));};exports[_0x9463('0x47')]=function(_0x529283,_0x196621){var _0x5aa9c2={'raw':!![],'where':{'id':_0x529283[_0x9463('0x48')]['id']}},_0x3c1d5d={};_0x3c1d5d['model']=_[_0x9463('0x33')](db[_0x9463('0x43')]['rawAttributes']);_0x3c1d5d[_0x9463('0x32')]=_[_0x9463('0x33')](_0x529283[_0x9463('0x32')]);_0x3c1d5d[_0x9463('0x34')]=_[_0x9463('0x35')](_0x3c1d5d[_0x9463('0x30')],_0x3c1d5d[_0x9463('0x32')]);_0x5aa9c2[_0x9463('0x36')]=_[_0x9463('0x35')](_0x3c1d5d[_0x9463('0x30')],qs[_0x9463('0x37')](_0x529283[_0x9463('0x32')][_0x9463('0x37')]));_0x5aa9c2['attributes']=_0x5aa9c2[_0x9463('0x36')]['length']?_0x5aa9c2[_0x9463('0x36')]:_0x3c1d5d[_0x9463('0x30')];if(_0x529283['query']['includeAll']){_0x5aa9c2['include']=[{'all':!![]}];}_0x5aa9c2=_[_0x9463('0x3f')]({},_0x5aa9c2,_0x529283['options']);return db['VoiceMail'][_0x9463('0x49')](_0x5aa9c2)[_0x9463('0x24')](handleEntityNotFound(_0x196621,null))[_0x9463('0x24')](respondWithResult(_0x196621,null))[_0x9463('0x4a')](handleError(_0x196621,null));};exports['create']=function(_0x4b375f,_0x3dd231){return db[_0x9463('0x43')][_0x9463('0x4b')](_0x4b375f[_0x9463('0x4c')],{})[_0x9463('0x24')](function(_0x2b6277){var _0xf6a53e=_0x4b375f[_0x9463('0x4d')][_0x9463('0x26')]({'plain':!![]});if(!_0xf6a53e)throw new Error(_0x9463('0x4e'));if(_0xf6a53e['role']===_0x9463('0x4d')){var _0x465f68=_0x2b6277['get']({'plain':!![]});var _0x400485=_0x9463('0x27');return db[_0x9463('0x4f')]['find']({'where':{'name':_0x400485,'userProfileId':_0xf6a53e[_0x9463('0x50')]},'raw':!![]})[_0x9463('0x24')](function(_0x25385e){if(_0x25385e&&_0x25385e['autoAssociation']===0x0){return db[_0x9463('0x28')][_0x9463('0x4b')]({'name':_0x465f68[_0x9463('0x2b')],'resourceId':_0x465f68['id'],'type':_0x25385e[_0x9463('0x2b')],'sectionId':_0x25385e['id']},{})['then'](function(){return _0x2b6277;});}else{return _0x2b6277;}})[_0x9463('0x4a')](function(_0x1f84f3){logger[_0x9463('0x29')](_0x9463('0x51'),_0x1f84f3);throw _0x1f84f3;});}return _0x2b6277;})[_0x9463('0x24')](respondWithResult(_0x3dd231,0xc9))['catch'](handleError(_0x3dd231,null));};exports[_0x9463('0x23')]=function(_0x1fdc0c,_0x12c50a){if(_0x1fdc0c['body']['id']){delete _0x1fdc0c[_0x9463('0x4c')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x1fdc0c[_0x9463('0x48')]['id']}})[_0x9463('0x24')](handleEntityNotFound(_0x12c50a,null))['then'](saveUpdates(_0x1fdc0c[_0x9463('0x4c')],null))[_0x9463('0x24')](respondWithResult(_0x12c50a,null))[_0x9463('0x4a')](handleError(_0x12c50a,null));};exports[_0x9463('0x25')]=function(_0x4cc7bb,_0x2b1204){return db[_0x9463('0x43')][_0x9463('0x49')]({'where':{'id':_0x4cc7bb[_0x9463('0x48')]['id']}})[_0x9463('0x24')](handleEntityNotFound(_0x2b1204,null))[_0x9463('0x24')](removeEntity(_0x2b1204,null))['catch'](handleError(_0x2b1204,null));};exports[_0x9463('0x52')]=function(_0x2373bd,_0x248da6,_0x4f0cf2){return db[_0x9463('0x43')][_0x9463('0x53')]({'where':{'id':_0x2373bd[_0x9463('0x48')]['id']}})[_0x9463('0x24')](handleEntityNotFound(_0x248da6,null))['then'](function(_0x52d69b){var _0x5eae1d;var _0x104218={},_0x505e96={};_0x505e96[_0x9463('0x30')]=_[_0x9463('0x33')](db[_0x9463('0x54')]['rawAttributes']);_0x505e96[_0x9463('0x32')]=_[_0x9463('0x33')](_0x2373bd['query']);_0x505e96[_0x9463('0x34')]=_[_0x9463('0x35')](_0x505e96[_0x9463('0x30')],_0x505e96[_0x9463('0x32')]);_0x104218[_0x9463('0x36')]=_[_0x9463('0x35')](_0x505e96[_0x9463('0x30')],qs[_0x9463('0x37')](_0x2373bd['query'][_0x9463('0x37')]));_0x104218[_0x9463('0x36')]=_0x104218[_0x9463('0x36')][_0x9463('0x38')]?_0x104218[_0x9463('0x36')]:_0x505e96['model'];if(!_0x2373bd[_0x9463('0x32')]['hasOwnProperty']('nolimit')){_0x104218[_0x9463('0x3a')]=qs[_0x9463('0x3a')](_0x2373bd[_0x9463('0x32')][_0x9463('0x3a')]);_0x104218[_0x9463('0x1c')]=qs[_0x9463('0x1c')](_0x2373bd[_0x9463('0x32')][_0x9463('0x1c')]);}_0x104218[_0x9463('0x3b')]=qs[_0x9463('0x3c')](_0x2373bd[_0x9463('0x32')][_0x9463('0x3c')]);_0x104218[_0x9463('0x3e')]=qs[_0x9463('0x34')](_[_0x9463('0x55')](_0x2373bd[_0x9463('0x32')],_0x505e96[_0x9463('0x34')]));if(_0x2373bd[_0x9463('0x32')][_0x9463('0x3d')]){_0x104218['where']=_[_0x9463('0x3f')](_0x104218[_0x9463('0x3e')],{'$or':_[_0x9463('0x31')](_0x104218[_0x9463('0x36')],function(_0x1af8ab){var _0x1c76bb={};_0x1c76bb[_0x1af8ab]={'$like':'%'+_0x2373bd[_0x9463('0x32')][_0x9463('0x3d')]+'%'};return _0x1c76bb;})});}_0x104218[_0x9463('0x3e')]=_[_0x9463('0x3f')](_0x104218['where'],{'mailboxuser':_0x52d69b['mailbox']});_0x104218=_[_0x9463('0x3f')]({},_0x104218,_0x2373bd[_0x9463('0x42')]);return db[_0x9463('0x54')]['findAndCountAll'](_0x104218)[_0x9463('0x24')](respondWithFilteredResult(_0x248da6,_0x104218));})[_0x9463('0x4a')](handleError(_0x248da6,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index ac40b3d..8ed5a3d 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 _0x2faf=['rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x349a9e,_0x473cb8){var _0x24c207=function(_0x22f148){while(--_0x22f148){_0x349a9e['push'](_0x349a9e['shift']());}};_0x24c207(++_0x473cb8);}(_0x2faf,0xb0));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf2fa('0x0'));var util=require(_0xf2fa('0x1'));var logger=require(_0xf2fa('0x2'))('api');var moment=require(_0xf2fa('0x3'));var BPromise=require(_0xf2fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2fa('0x5'));var rimraf=require(_0xf2fa('0x6'));var config=require(_0xf2fa('0x7'));var attributes=require(_0xf2fa('0x8'));module[_0xf2fa('0x9')]=function(_0x33c832,_0x44d406){return _0x33c832['define'](_0xf2fa('0xa'),attributes,{'tableName':_0xf2fa('0xb'),'paranoid':![],'indexes':[{'name':_0xf2fa('0xc'),'fields':[_0xf2fa('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9d6=['mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context'];(function(_0x1e6a22,_0x203deb){var _0x3cc6aa=function(_0x2d5cc9){while(--_0x2d5cc9){_0x1e6a22['push'](_0x1e6a22['shift']());}};_0x3cc6aa(++_0x203deb);}(_0xa9d6,0x1ef));var _0x6a9d=function(_0x5cd821,_0x1c58b2){_0x5cd821=_0x5cd821-0x0;var _0x5765e3=_0xa9d6[_0x5cd821];return _0x5765e3;};'use strict';var _=require(_0x6a9d('0x0'));var util=require(_0x6a9d('0x1'));var logger=require(_0x6a9d('0x2'))(_0x6a9d('0x3'));var moment=require(_0x6a9d('0x4'));var BPromise=require(_0x6a9d('0x5'));var rp=require(_0x6a9d('0x6'));var fs=require('fs');var path=require(_0x6a9d('0x7'));var rimraf=require(_0x6a9d('0x8'));var config=require(_0x6a9d('0x9'));var attributes=require(_0x6a9d('0xa'));module[_0x6a9d('0xb')]=function(_0x51b14c,_0x1615aa){return _0x51b14c[_0x6a9d('0xc')](_0x6a9d('0xd'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x6a9d('0xe'),'fields':[_0x6a9d('0xf'),_0x6a9d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a5d43b0..1c0b064 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 _0x2c74=['VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x413e47,_0x1da6ae){var _0x77c062=function(_0x412dc6){while(--_0x412dc6){_0x413e47['push'](_0x413e47['shift']());}};_0x77c062(++_0x1da6ae);}(_0x2c74,0xb0));var _0x42c7=function(_0x4579dc,_0xff67f8){_0x4579dc=_0x4579dc-0x0;var _0x458962=_0x2c74[_0x4579dc];return _0x458962;};'use strict';var _=require(_0x42c7('0x0'));var util=require(_0x42c7('0x1'));var moment=require(_0x42c7('0x2'));var BPromise=require(_0x42c7('0x3'));var rs=require(_0x42c7('0x4'));var fs=require('fs');var Redis=require(_0x42c7('0x5'));var db=require(_0x42c7('0x6'))['db'];var utils=require(_0x42c7('0x7'));var logger=require(_0x42c7('0x8'))(_0x42c7('0x9'));var config=require(_0x42c7('0xa'));var jayson=require(_0x42c7('0xb'));var client=jayson[_0x42c7('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14c97b,_0xd132b3,_0x7089b5){return new BPromise(function(_0x323b11,_0x4d4e07){return client[_0x42c7('0xd')](_0x14c97b,_0x7089b5)[_0x42c7('0xe')](function(_0x3cb0a4){logger[_0x42c7('0xf')](_0x42c7('0x10'),_0xd132b3,'request\x20sent');logger['debug'](_0x42c7('0x11'),_0xd132b3,_0x42c7('0x12'),JSON['stringify'](_0x3cb0a4));if(_0x3cb0a4[_0x42c7('0x13')]){if(_0x3cb0a4[_0x42c7('0x13')][_0x42c7('0x14')]===0x1f4){logger[_0x42c7('0x13')](_0x42c7('0x10'),_0xd132b3,_0x3cb0a4[_0x42c7('0x13')]['message']);return _0x4d4e07(_0x3cb0a4[_0x42c7('0x13')][_0x42c7('0x15')]);}logger[_0x42c7('0x13')](_0x42c7('0x10'),_0xd132b3,_0x3cb0a4['error'][_0x42c7('0x15')]);return _0x323b11(_0x3cb0a4[_0x42c7('0x13')]['message']);}else{logger[_0x42c7('0xf')](_0x42c7('0x10'),_0xd132b3,_0x42c7('0x12'));_0x323b11(_0x3cb0a4[_0x42c7('0x16')][_0x42c7('0x15')]);}})[_0x42c7('0x17')](function(_0x168836){logger[_0x42c7('0x13')](_0x42c7('0x10'),_0xd132b3,_0x168836);_0x4d4e07(_0x168836);});});} \ No newline at end of file +var _0xd85b=['error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd85b,0x7b));var _0xbd85=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd85b[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xbd85('0x0'));var util=require(_0xbd85('0x1'));var moment=require(_0xbd85('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd85('0x3'));var fs=require('fs');var Redis=require(_0xbd85('0x4'));var db=require(_0xbd85('0x5'))['db'];var utils=require(_0xbd85('0x6'));var logger=require(_0xbd85('0x7'))(_0xbd85('0x8'));var config=require(_0xbd85('0x9'));var jayson=require(_0xbd85('0xa'));var client=jayson[_0xbd85('0xb')][_0xbd85('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10595e,_0x51c3e5,_0x494a9f){return new BPromise(function(_0x23684a,_0x3d0bab){return client[_0xbd85('0xd')](_0x10595e,_0x494a9f)[_0xbd85('0xe')](function(_0x5445b0){logger[_0xbd85('0xf')](_0xbd85('0x10'),_0x51c3e5,_0xbd85('0x11'));logger[_0xbd85('0x12')](_0xbd85('0x13'),_0x51c3e5,'request\x20sent',JSON[_0xbd85('0x14')](_0x5445b0));if(_0x5445b0['error']){if(_0x5445b0[_0xbd85('0x15')][_0xbd85('0x16')]===0x1f4){logger[_0xbd85('0x15')](_0xbd85('0x10'),_0x51c3e5,_0x5445b0[_0xbd85('0x15')][_0xbd85('0x17')]);return _0x3d0bab(_0x5445b0[_0xbd85('0x15')][_0xbd85('0x17')]);}logger[_0xbd85('0x15')]('VoiceMail,\x20%s,\x20%s',_0x51c3e5,_0x5445b0[_0xbd85('0x15')]['message']);return _0x23684a(_0x5445b0['error'][_0xbd85('0x17')]);}else{logger[_0xbd85('0xf')](_0xbd85('0x10'),_0x51c3e5,_0xbd85('0x11'));_0x23684a(_0x5445b0['result'][_0xbd85('0x17')]);}})['catch'](function(_0x11a39f){logger['error'](_0xbd85('0x10'),_0x51c3e5,_0x11a39f);_0x3d0bab(_0x11a39f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 4fa8048..fc50946 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 _0x328b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','download','create','put','update','delete','/:id','destroy','exports','path','connect-timeout','express'];(function(_0x350277,_0x25d306){var _0x5e418b=function(_0x19c176){while(--_0x19c176){_0x350277['push'](_0x350277['shift']());}};_0x5e418b(++_0x25d306);}(_0x328b,0x138));var _0xb328=function(_0x32f193,_0x612afc){_0x32f193=_0x32f193-0x0;var _0x5bb92e=_0x328b[_0x32f193];return _0x5bb92e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb328('0x0'));var timeout=require(_0xb328('0x1'));var express=require(_0xb328('0x2'));var router=express[_0xb328('0x3')]();var auth=require(_0xb328('0x4'));var interaction=require(_0xb328('0x5'));var config=require(_0xb328('0x6'));var controller=require(_0xb328('0x7'));router[_0xb328('0x8')]('/',auth[_0xb328('0x9')](),controller[_0xb328('0xa')]);router[_0xb328('0x8')]('/:id',auth[_0xb328('0x9')](),controller[_0xb328('0xb')]);router[_0xb328('0x8')](_0xb328('0xc'),auth[_0xb328('0x9')](),controller[_0xb328('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb328('0xe')]);router[_0xb328('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb328('0x10')]);router[_0xb328('0x11')](_0xb328('0x12'),auth[_0xb328('0x9')](),controller[_0xb328('0x13')]);module[_0xb328('0x14')]=router; \ No newline at end of file +var _0xc49d=['express','Router','../../components/auth/service','./voiceMailMessage.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','util','connect-timeout'];(function(_0x40e114,_0x278b52){var _0x2e9542=function(_0x36b70){while(--_0x36b70){_0x40e114['push'](_0x40e114['shift']());}};_0x2e9542(++_0x278b52);}(_0xc49d,0x7e));var _0xdc49=function(_0x439e23,_0x10c26c){_0x439e23=_0x439e23-0x0;var _0x393695=_0xc49d[_0x439e23];return _0x393695;};'use strict';var multer=require('multer');var util=require(_0xdc49('0x0'));var path=require('path');var timeout=require(_0xdc49('0x1'));var express=require(_0xdc49('0x2'));var router=express[_0xdc49('0x3')]();var auth=require(_0xdc49('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdc49('0x5'));router[_0xdc49('0x6')]('/',auth[_0xdc49('0x7')](),controller['index']);router[_0xdc49('0x6')]('/:id',auth[_0xdc49('0x7')](),controller[_0xdc49('0x8')]);router['get']('/:id/download',auth[_0xdc49('0x7')](),controller['download']);router[_0xdc49('0x9')]('/',auth[_0xdc49('0x7')](),controller[_0xdc49('0xa')]);router[_0xdc49('0xb')](_0xdc49('0xc'),auth[_0xdc49('0x7')](),controller[_0xdc49('0xd')]);router[_0xdc49('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xdc49('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 4a691c0..0850a34 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 _0xc50f=['literal','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP'];(function(_0x4f1697,_0x44dc8e){var _0x58d34b=function(_0x3d42de){while(--_0x3d42de){_0x4f1697['push'](_0x4f1697['shift']());}};_0x58d34b(++_0x44dc8e);}(_0xc50f,0x99));var _0xfc50=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc50f[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0xfc50('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc50('0x1')],'get':function(_0xcc90bf){return this[_0xfc50('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xfc50('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xfc50('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xfc50('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xfc50('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xfc50('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xfc50('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xfc50('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xfc50('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xfc50('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xfc50('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xfc50('0x4')],'defaultValue':''},'stamp':{'type':_0xfc50('0x6'),'defaultValue':Sequelize[_0xfc50('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xba3e=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','STRING','BLOB'];(function(_0xc0cf48,_0x4c588d){var _0x1314d8=function(_0x1cebb7){while(--_0x1cebb7){_0xc0cf48['push'](_0xc0cf48['shift']());}};_0x1314d8(++_0x4c588d);}(_0xba3e,0x114));var _0xeba3=function(_0x366d70,_0x147ff8){_0x366d70=_0x366d70-0x0;var _0x1c7be0=_0xba3e[_0x366d70];return _0x1c7be0;};'use strict';var Sequelize=require('sequelize');module[_0xeba3('0x0')]={'name':{'type':Sequelize[_0xeba3('0x1')],'get':function(_0x467a84){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xeba3('0x3')](_0xeba3('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'stamp':{'type':_0xeba3('0x5'),'defaultValue':Sequelize[_0xeba3('0x6')](_0xeba3('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 0eba50f..2cc03d9 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 _0x43b3=['VIRTUAL','options','count','include','findAll','catch','params','keys','includeAll','find','create','body','update','download','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','.wav\x22','recording','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','apply','reject','save','then','destroy','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','where','pick','filter','merge'];(function(_0x5ee98a,_0x46ff06){var _0x2102b8=function(_0x3bd8d4){while(--_0x3bd8d4){_0x5ee98a['push'](_0x5ee98a['shift']());}};_0x2102b8(++_0x46ff06);}(_0x43b3,0x161));var _0x343b=function(_0x4b6830,_0x3fa2c5){_0x4b6830=_0x4b6830-0x0;var _0x3fbc3f=_0x43b3[_0x4b6830];return _0x3fbc3f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x343b('0x0'));var rimraf=require(_0x343b('0x1'));var zipdir=require(_0x343b('0x2'));var jsonpatch=require(_0x343b('0x3'));var rp=require('request-promise');var moment=require(_0x343b('0x4'));var BPromise=require(_0x343b('0x5'));var Mustache=require(_0x343b('0x6'));var util=require(_0x343b('0x7'));var path=require('path');var sox=require(_0x343b('0x8'));var csv=require('to-csv');var ejs=require(_0x343b('0x9'));var fs=require('fs');var _=require(_0x343b('0xa'));var squel=require(_0x343b('0xb'));var crypto=require(_0x343b('0xc'));var jsforce=require(_0x343b('0xd'));var deskjs=require(_0x343b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x343b('0xf'));var Papa=require(_0x343b('0x10'));var Redis=require('ioredis');var authService=require(_0x343b('0x11'));var qs=require(_0x343b('0x12'));var as=require(_0x343b('0x13'));var hardwareService=require(_0x343b('0x14'));var logger=require(_0x343b('0x15'))(_0x343b('0x16'));var utils=require(_0x343b('0x17'));var config=require(_0x343b('0x18'));var licenseUtil=require(_0x343b('0x19'));var db=require(_0x343b('0x1a'))['db'];function respondWithStatusCode(_0x1a8ca7,_0x430b9e){_0x430b9e=_0x430b9e||0xcc;return function(_0x2b9aa9){if(_0x2b9aa9){return _0x1a8ca7[_0x343b('0x1b')](_0x430b9e);}return _0x1a8ca7[_0x343b('0x1c')](_0x430b9e)[_0x343b('0x1d')]();};}function respondWithResult(_0x145f2c,_0x2628fe){_0x2628fe=_0x2628fe||0xc8;return function(_0x4e04a0){if(_0x4e04a0){return _0x145f2c[_0x343b('0x1c')](_0x2628fe)['json'](_0x4e04a0);}};}function respondWithFilteredResult(_0x348156,_0x5cd48e){return function(_0x613c5){if(_0x613c5){var _0x155147=_0x613c5['count'],_0x285bdc=_0x5cd48e[_0x343b('0x1e')],_0x20e66e=_0x5cd48e[_0x343b('0x1e')]+_0x5cd48e[_0x343b('0x1f')],_0x35733f;if(_0x20e66e>=_0x155147){_0x20e66e=_0x155147;_0x35733f=0xc8;}else{_0x35733f=0xce;}_0x348156[_0x343b('0x1c')](_0x35733f);return _0x348156[_0x343b('0x20')]('Content-Range',_0x285bdc+'-'+_0x20e66e+'/'+_0x155147)['json'](_0x613c5);}return null;};}function patchUpdates(_0x5e6b7f){return function(_0x1fe819){try{jsonpatch[_0x343b('0x21')](_0x1fe819,_0x5e6b7f,!![]);}catch(_0x4dae64){return BPromise[_0x343b('0x22')](_0x4dae64);}return _0x1fe819[_0x343b('0x23')]();};}function saveUpdates(_0x5b4b6c,_0x4c95c9){return function(_0x469e26){if(_0x469e26){return _0x469e26['update'](_0x5b4b6c)[_0x343b('0x24')](function(_0x351bae){return _0x351bae;});}return null;};}function removeEntity(_0xbea3c9,_0x3ad823){return function(_0x4d12e7){if(_0x4d12e7){return _0x4d12e7[_0x343b('0x25')]()[_0x343b('0x24')](function(){_0xbea3c9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x578658,_0x3f4100){return function(_0x51bdfa){if(!_0x51bdfa){_0x578658[_0x343b('0x1b')](0x194);}return _0x51bdfa;};}function handleError(_0x85b032,_0x1bebdd){_0x1bebdd=_0x1bebdd||0x1f4;return function(_0x21cdd5){logger['error'](_0x21cdd5[_0x343b('0x26')]);if(_0x21cdd5[_0x343b('0x27')]){delete _0x21cdd5[_0x343b('0x27')];}_0x85b032[_0x343b('0x1c')](_0x1bebdd)[_0x343b('0x28')](_0x21cdd5);};}exports[_0x343b('0x29')]=function(_0x2a7f9f,_0x25b6fb){var _0x4452ae={},_0x7f84a={},_0x3742a4={'count':0x0,'rows':[]};var _0x5f2d4e=_['map'](db[_0x343b('0x2a')][_0x343b('0x2b')],function(_0x509362){return{'name':_0x509362[_0x343b('0x2c')],'type':_0x509362[_0x343b('0x2d')][_0x343b('0x2e')]};});_0x7f84a['model']=_[_0x343b('0x2f')](_[_0x343b('0x30')](_0x5f2d4e,_0x343b('0x27')),[_0x343b('0x27')]);_0x7f84a[_0x343b('0x31')]=_['keys'](_0x2a7f9f['query']);_0x7f84a[_0x343b('0x32')]=_[_0x343b('0x33')](_0x7f84a[_0x343b('0x34')],_0x7f84a[_0x343b('0x31')]);_0x4452ae[_0x343b('0x35')]=_['intersection'](_0x7f84a[_0x343b('0x34')],qs[_0x343b('0x36')](_0x2a7f9f['query']['fields']));_0x4452ae[_0x343b('0x35')]=_0x4452ae[_0x343b('0x35')][_0x343b('0x37')]?_0x4452ae[_0x343b('0x35')]:_0x7f84a[_0x343b('0x34')];if(!_0x2a7f9f[_0x343b('0x31')]['hasOwnProperty'](_0x343b('0x38'))){_0x4452ae[_0x343b('0x1f')]=qs[_0x343b('0x1f')](_0x2a7f9f[_0x343b('0x31')][_0x343b('0x1f')]);_0x4452ae[_0x343b('0x1e')]=qs['offset'](_0x2a7f9f[_0x343b('0x31')][_0x343b('0x1e')]);}_0x4452ae[_0x343b('0x39')]=qs['sort'](_0x2a7f9f[_0x343b('0x31')]['sort']);_0x4452ae[_0x343b('0x3a')]=qs['filters'](_[_0x343b('0x3b')](_0x2a7f9f[_0x343b('0x31')],_0x7f84a[_0x343b('0x32')]),_0x5f2d4e);if(_0x2a7f9f[_0x343b('0x31')][_0x343b('0x3c')]){_0x4452ae['where']=_[_0x343b('0x3d')](_0x4452ae[_0x343b('0x3a')],{'$or':_[_0x343b('0x30')](_0x5f2d4e,function(_0x385852){if(_0x385852[_0x343b('0x2d')]!==_0x343b('0x3e')){var _0x1a4a89={};_0x1a4a89[_0x385852['name']]={'$like':'%'+_0x2a7f9f[_0x343b('0x31')][_0x343b('0x3c')]+'%'};return _0x1a4a89;}})});}_0x4452ae=_['merge']({},_0x4452ae,_0x2a7f9f[_0x343b('0x3f')]);var _0x1f4020={'where':_0x4452ae['where']};return db[_0x343b('0x2a')][_0x343b('0x40')](_0x1f4020)[_0x343b('0x24')](function(_0x287265){_0x3742a4[_0x343b('0x40')]=_0x287265;if(_0x2a7f9f[_0x343b('0x31')]['includeAll']){_0x4452ae[_0x343b('0x41')]=[{'all':!![]}];}return db[_0x343b('0x2a')][_0x343b('0x42')](_0x4452ae);})[_0x343b('0x24')](function(_0x16ddd6){_0x3742a4['rows']=_0x16ddd6;return _0x3742a4;})['then'](respondWithFilteredResult(_0x25b6fb,_0x4452ae))[_0x343b('0x43')](handleError(_0x25b6fb,null));};exports['show']=function(_0x1dd689,_0x4d29ed){var _0x32575d={'raw':!![],'where':{'id':_0x1dd689[_0x343b('0x44')]['id']}},_0x1c83ee={};_0x1c83ee['model']=_['keys'](db[_0x343b('0x2a')][_0x343b('0x2b')]);_0x1c83ee[_0x343b('0x31')]=_[_0x343b('0x45')](_0x1dd689[_0x343b('0x31')]);_0x1c83ee[_0x343b('0x32')]=_[_0x343b('0x33')](_0x1c83ee[_0x343b('0x34')],_0x1c83ee['query']);_0x32575d[_0x343b('0x35')]=_['intersection'](_0x1c83ee[_0x343b('0x34')],qs[_0x343b('0x36')](_0x1dd689[_0x343b('0x31')][_0x343b('0x36')]));_0x32575d[_0x343b('0x35')]=_0x32575d[_0x343b('0x35')][_0x343b('0x37')]?_0x32575d[_0x343b('0x35')]:_0x1c83ee[_0x343b('0x34')];if(_0x1dd689[_0x343b('0x31')][_0x343b('0x46')]){_0x32575d[_0x343b('0x41')]=[{'all':!![]}];}_0x32575d=_[_0x343b('0x3d')]({},_0x32575d,_0x1dd689[_0x343b('0x3f')]);return db[_0x343b('0x2a')][_0x343b('0x47')](_0x32575d)[_0x343b('0x24')](handleEntityNotFound(_0x4d29ed,null))[_0x343b('0x24')](respondWithResult(_0x4d29ed,null))['catch'](handleError(_0x4d29ed,null));};exports[_0x343b('0x48')]=function(_0x10482a,_0x3c286c){return db[_0x343b('0x2a')][_0x343b('0x48')](_0x10482a[_0x343b('0x49')],{})[_0x343b('0x24')](respondWithResult(_0x3c286c,0xc9))['catch'](handleError(_0x3c286c,null));};exports[_0x343b('0x4a')]=function(_0x35e8e6,_0x2da699){if(_0x35e8e6[_0x343b('0x49')]['id']){delete _0x35e8e6['body']['id'];}return db[_0x343b('0x2a')][_0x343b('0x47')]({'where':{'id':_0x35e8e6['params']['id']}})[_0x343b('0x24')](handleEntityNotFound(_0x2da699,null))['then'](saveUpdates(_0x35e8e6['body'],null))[_0x343b('0x24')](respondWithResult(_0x2da699,null))['catch'](handleError(_0x2da699,null));};exports['destroy']=function(_0x50ffc3,_0x2f2726){return db[_0x343b('0x2a')][_0x343b('0x47')]({'where':{'id':_0x50ffc3[_0x343b('0x44')]['id']}})[_0x343b('0x24')](handleEntityNotFound(_0x2f2726,null))['then'](removeEntity(_0x2f2726,null))[_0x343b('0x43')](handleError(_0x2f2726,null));};exports[_0x343b('0x4b')]=function(_0x1b4c8d,_0x2a1c94,_0x1909a9){return db[_0x343b('0x2a')][_0x343b('0x47')]({'where':{'id':_0x1b4c8d['params']['id']},'attributes':['id','recording',_0x343b('0x4c')]})[_0x343b('0x24')](handleEntityNotFound(_0x2a1c94,null))[_0x343b('0x24')](function(_0x54a3b7){if(_0x54a3b7){if(!_0x54a3b7['recording']){throw new db[(_0x343b('0x4d'))][(_0x343b('0x4e'))](_0x343b('0x4f'));}var _0x5ac8d2={'Content-Type':_0x343b('0x50'),'Content-Disposition':'attachment'};if(_0x54a3b7['msg_id']){_0x5ac8d2['Content-Disposition']='attachment;\x20filename=\x22'+_0x54a3b7[_0x343b('0x4c')]+_0x343b('0x51');}_0x2a1c94[_0x343b('0x20')](_0x5ac8d2);return _0x2a1c94[_0x343b('0x28')](new Buffer(_0x54a3b7[_0x343b('0x52')]));}})[_0x343b('0x43')](handleError(_0x2a1c94,null));}; \ No newline at end of file +var _0x9738=['rawAttributes','keys','include','find','create','body','params','download','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','.wav\x22','recording','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','fieldName','type','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','VoiceMailMessage','findAll','rows','catch'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9738,0x18b));var _0x8973=function(_0x255ae4,_0x5f51e7){_0x255ae4=_0x255ae4-0x0;var _0x12b51c=_0x9738[_0x255ae4];return _0x12b51c;};'use strict';var pdf=require(_0x8973('0x0'));var emlformat=require(_0x8973('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8973('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8973('0x3'));var moment=require('moment');var BPromise=require(_0x8973('0x4'));var Mustache=require(_0x8973('0x5'));var util=require('util');var path=require(_0x8973('0x6'));var sox=require('sox');var csv=require(_0x8973('0x7'));var ejs=require(_0x8973('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8973('0x9'));var crypto=require(_0x8973('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8973('0xb'));var toCsv=require(_0x8973('0x7'));var querystring=require('querystring');var Papa=require(_0x8973('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8973('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8973('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x8973('0xf'));var config=require(_0x8973('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x8973('0x11'))['db'];function respondWithStatusCode(_0x4695e8,_0x370efe){_0x370efe=_0x370efe||0xcc;return function(_0x4b8e69){if(_0x4b8e69){return _0x4695e8[_0x8973('0x12')](_0x370efe);}return _0x4695e8[_0x8973('0x13')](_0x370efe)[_0x8973('0x14')]();};}function respondWithResult(_0x423290,_0x5eb756){_0x5eb756=_0x5eb756||0xc8;return function(_0x1cad6e){if(_0x1cad6e){return _0x423290[_0x8973('0x13')](_0x5eb756)[_0x8973('0x15')](_0x1cad6e);}};}function respondWithFilteredResult(_0x94b278,_0x52eca7){return function(_0x383ac0){if(_0x383ac0){var _0x2aaf29=_0x383ac0[_0x8973('0x16')],_0x432051=_0x52eca7[_0x8973('0x17')],_0x4a490a=_0x52eca7[_0x8973('0x17')]+_0x52eca7[_0x8973('0x18')],_0x39f6f8;if(_0x4a490a>=_0x2aaf29){_0x4a490a=_0x2aaf29;_0x39f6f8=0xc8;}else{_0x39f6f8=0xce;}_0x94b278[_0x8973('0x13')](_0x39f6f8);return _0x94b278[_0x8973('0x19')](_0x8973('0x1a'),_0x432051+'-'+_0x4a490a+'/'+_0x2aaf29)[_0x8973('0x15')](_0x383ac0);}return null;};}function patchUpdates(_0x2d35de){return function(_0x307410){try{jsonpatch['apply'](_0x307410,_0x2d35de,!![]);}catch(_0x576e68){return BPromise['reject'](_0x576e68);}return _0x307410[_0x8973('0x1b')]();};}function saveUpdates(_0x4fbfed,_0x1fc294){return function(_0x255432){if(_0x255432){return _0x255432[_0x8973('0x1c')](_0x4fbfed)['then'](function(_0x2926da){return _0x2926da;});}return null;};}function removeEntity(_0x4f3aee,_0x2c8605){return function(_0x56b6da){if(_0x56b6da){return _0x56b6da[_0x8973('0x1d')]()[_0x8973('0x1e')](function(){_0x4f3aee[_0x8973('0x13')](0xcc)[_0x8973('0x14')]();});}};}function handleEntityNotFound(_0x5db971,_0x27adf2){return function(_0x3cb876){if(!_0x3cb876){_0x5db971['sendStatus'](0x194);}return _0x3cb876;};}function handleError(_0x5b8c99,_0x2c5b3d){_0x2c5b3d=_0x2c5b3d||0x1f4;return function(_0x36d3a6){logger[_0x8973('0x1f')](_0x36d3a6[_0x8973('0x20')]);if(_0x36d3a6['name']){delete _0x36d3a6[_0x8973('0x21')];}_0x5b8c99['status'](_0x2c5b3d)[_0x8973('0x22')](_0x36d3a6);};}exports[_0x8973('0x23')]=function(_0x32d36c,_0x21fc8d){var _0x4111a8={},_0x19ea54={},_0x273052={'count':0x0,'rows':[]};var _0x3e9d62=_[_0x8973('0x24')](db['VoiceMailMessage']['rawAttributes'],function(_0xe8d280){return{'name':_0xe8d280[_0x8973('0x25')],'type':_0xe8d280[_0x8973('0x26')]['key']};});_0x19ea54['model']=_[_0x8973('0x27')](_[_0x8973('0x24')](_0x3e9d62,_0x8973('0x21')),[_0x8973('0x21')]);_0x19ea54[_0x8973('0x28')]=_['keys'](_0x32d36c[_0x8973('0x28')]);_0x19ea54[_0x8973('0x29')]=_[_0x8973('0x2a')](_0x19ea54[_0x8973('0x2b')],_0x19ea54[_0x8973('0x28')]);_0x4111a8[_0x8973('0x2c')]=_[_0x8973('0x2a')](_0x19ea54[_0x8973('0x2b')],qs[_0x8973('0x2d')](_0x32d36c[_0x8973('0x28')][_0x8973('0x2d')]));_0x4111a8['attributes']=_0x4111a8['attributes'][_0x8973('0x2e')]?_0x4111a8[_0x8973('0x2c')]:_0x19ea54['model'];if(!_0x32d36c[_0x8973('0x28')][_0x8973('0x2f')]('nolimit')){_0x4111a8[_0x8973('0x18')]=qs[_0x8973('0x18')](_0x32d36c[_0x8973('0x28')][_0x8973('0x18')]);_0x4111a8[_0x8973('0x17')]=qs[_0x8973('0x17')](_0x32d36c[_0x8973('0x28')][_0x8973('0x17')]);}_0x4111a8[_0x8973('0x30')]=qs[_0x8973('0x31')](_0x32d36c[_0x8973('0x28')]['sort']);_0x4111a8[_0x8973('0x32')]=qs['filters'](_[_0x8973('0x33')](_0x32d36c[_0x8973('0x28')],_0x19ea54[_0x8973('0x29')]),_0x3e9d62);if(_0x32d36c['query']['filter']){_0x4111a8[_0x8973('0x32')]=_[_0x8973('0x34')](_0x4111a8[_0x8973('0x32')],{'$or':_[_0x8973('0x24')](_0x3e9d62,function(_0x54654d){if(_0x54654d['type']!==_0x8973('0x35')){var _0xa6f97c={};_0xa6f97c[_0x54654d[_0x8973('0x21')]]={'$like':'%'+_0x32d36c[_0x8973('0x28')][_0x8973('0x36')]+'%'};return _0xa6f97c;}})});}_0x4111a8=_['merge']({},_0x4111a8,_0x32d36c[_0x8973('0x37')]);var _0x58534b={'where':_0x4111a8[_0x8973('0x32')]};return db['VoiceMailMessage'][_0x8973('0x16')](_0x58534b)[_0x8973('0x1e')](function(_0x225da4){_0x273052[_0x8973('0x16')]=_0x225da4;if(_0x32d36c[_0x8973('0x28')][_0x8973('0x38')]){_0x4111a8['include']=[{'all':!![]}];}return db[_0x8973('0x39')][_0x8973('0x3a')](_0x4111a8);})[_0x8973('0x1e')](function(_0x11fc36){_0x273052[_0x8973('0x3b')]=_0x11fc36;return _0x273052;})[_0x8973('0x1e')](respondWithFilteredResult(_0x21fc8d,_0x4111a8))[_0x8973('0x3c')](handleError(_0x21fc8d,null));};exports['show']=function(_0x42dbcd,_0x5cc40c){var _0x39877a={'raw':!![],'where':{'id':_0x42dbcd['params']['id']}},_0x17d4d0={};_0x17d4d0['model']=_['keys'](db[_0x8973('0x39')][_0x8973('0x3d')]);_0x17d4d0[_0x8973('0x28')]=_[_0x8973('0x3e')](_0x42dbcd[_0x8973('0x28')]);_0x17d4d0[_0x8973('0x29')]=_[_0x8973('0x2a')](_0x17d4d0[_0x8973('0x2b')],_0x17d4d0[_0x8973('0x28')]);_0x39877a[_0x8973('0x2c')]=_[_0x8973('0x2a')](_0x17d4d0[_0x8973('0x2b')],qs[_0x8973('0x2d')](_0x42dbcd[_0x8973('0x28')][_0x8973('0x2d')]));_0x39877a[_0x8973('0x2c')]=_0x39877a['attributes']['length']?_0x39877a[_0x8973('0x2c')]:_0x17d4d0[_0x8973('0x2b')];if(_0x42dbcd[_0x8973('0x28')][_0x8973('0x38')]){_0x39877a[_0x8973('0x3f')]=[{'all':!![]}];}_0x39877a=_[_0x8973('0x34')]({},_0x39877a,_0x42dbcd['options']);return db[_0x8973('0x39')][_0x8973('0x40')](_0x39877a)['then'](handleEntityNotFound(_0x5cc40c,null))[_0x8973('0x1e')](respondWithResult(_0x5cc40c,null))['catch'](handleError(_0x5cc40c,null));};exports['create']=function(_0xfdfd53,_0x122229){return db[_0x8973('0x39')][_0x8973('0x41')](_0xfdfd53[_0x8973('0x42')],{})[_0x8973('0x1e')](respondWithResult(_0x122229,0xc9))[_0x8973('0x3c')](handleError(_0x122229,null));};exports['update']=function(_0x143915,_0x3c9912){if(_0x143915['body']['id']){delete _0x143915[_0x8973('0x42')]['id'];}return db[_0x8973('0x39')][_0x8973('0x40')]({'where':{'id':_0x143915[_0x8973('0x43')]['id']}})[_0x8973('0x1e')](handleEntityNotFound(_0x3c9912,null))[_0x8973('0x1e')](saveUpdates(_0x143915[_0x8973('0x42')],null))[_0x8973('0x1e')](respondWithResult(_0x3c9912,null))[_0x8973('0x3c')](handleError(_0x3c9912,null));};exports[_0x8973('0x1d')]=function(_0x4fba90,_0xb0174c){return db['VoiceMailMessage'][_0x8973('0x40')]({'where':{'id':_0x4fba90[_0x8973('0x43')]['id']}})[_0x8973('0x1e')](handleEntityNotFound(_0xb0174c,null))[_0x8973('0x1e')](removeEntity(_0xb0174c,null))[_0x8973('0x3c')](handleError(_0xb0174c,null));};exports[_0x8973('0x44')]=function(_0x4441f8,_0x1b74f5,_0xf15e31){return db['VoiceMailMessage'][_0x8973('0x40')]({'where':{'id':_0x4441f8[_0x8973('0x43')]['id']},'attributes':['id','recording',_0x8973('0x45')]})[_0x8973('0x1e')](handleEntityNotFound(_0x1b74f5,null))[_0x8973('0x1e')](function(_0x291295){if(_0x291295){if(!_0x291295['recording']){throw new db['Sequelize'][(_0x8973('0x46'))](_0x8973('0x47'));}var _0x1ee1e4={'Content-Type':_0x8973('0x48'),'Content-Disposition':_0x8973('0x49')};if(_0x291295[_0x8973('0x45')]){_0x1ee1e4['Content-Disposition']='attachment;\x20filename=\x22'+_0x291295['msg_id']+_0x8973('0x4a');}_0x1b74f5['set'](_0x1ee1e4);return _0x1b74f5[_0x8973('0x22')](new Buffer(_0x291295[_0x8973('0x4b')]));}})[_0x8973('0x3c')](handleError(_0x1b74f5,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index da77a9c..8807521 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 _0xfd2f=['../../config/logger','api','moment','path','rimraf','./voiceMailMessage.attributes','define','dir','util'];(function(_0x4bbc5b,_0x2fd313){var _0x4ab6bc=function(_0x1aee0f){while(--_0x1aee0f){_0x4bbc5b['push'](_0x4bbc5b['shift']());}};_0x4ab6bc(++_0x2fd313);}(_0xfd2f,0x1e5));var _0xffd2=function(_0xa38ef9,_0x4503cd){_0xa38ef9=_0xa38ef9-0x0;var _0x3546ab=_0xfd2f[_0xa38ef9];return _0x3546ab;};'use strict';var _=require('lodash');var util=require(_0xffd2('0x0'));var logger=require(_0xffd2('0x1'))(_0xffd2('0x2'));var moment=require(_0xffd2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xffd2('0x4'));var rimraf=require(_0xffd2('0x5'));var config=require('../../config/environment');var attributes=require(_0xffd2('0x6'));module['exports']=function(_0x26cc79,_0x1504be){return _0x26cc79[_0xffd2('0x7')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0xffd2('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5c41=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x5c41,0x121));var _0x15c4=function(_0x4cf15f,_0x3f11c7){_0x4cf15f=_0x4cf15f-0x0;var _0x11da5d=_0x5c41[_0x4cf15f];return _0x11da5d;};'use strict';var _=require(_0x15c4('0x0'));var util=require(_0x15c4('0x1'));var logger=require(_0x15c4('0x2'))(_0x15c4('0x3'));var moment=require(_0x15c4('0x4'));var BPromise=require(_0x15c4('0x5'));var rp=require(_0x15c4('0x6'));var fs=require('fs');var path=require(_0x15c4('0x7'));var rimraf=require(_0x15c4('0x8'));var config=require(_0x15c4('0x9'));var attributes=require('./voiceMailMessage.attributes');module[_0x15c4('0xa')]=function(_0x3c793a,_0x309372){return _0x3c793a[_0x15c4('0xb')]('VoiceMailMessage',attributes,{'tableName':_0x15c4('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x15c4('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index ecc431f..9ec41fa 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 _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x26502b,_0x4427a0){var _0x418513=function(_0x53eff4){while(--_0x53eff4){_0x26502b['push'](_0x26502b['shift']());}};_0x418513(++_0x4427a0);}(_0x57ca,0x108));var _0xa57c=function(_0x1ea751,_0x54de21){_0x1ea751=_0x1ea751-0x0;var _0x294335=_0x57ca[_0x1ea751];return _0x294335;};'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});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x5dacdf,_0x21f07f){var _0x238605=function(_0x425afd){while(--_0x425afd){_0x5dacdf['push'](_0x5dacdf['shift']());}};_0x238605(++_0x21f07f);}(_0x1a85,0x178));var _0x51a8=function(_0x7709d5,_0x3a0bc4){_0x7709d5=_0x7709d5-0x0;var _0x36e23c=_0x1a85[_0x7709d5];return _0x36e23c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5b55de8..aebaf1e 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 _0x38ae=['delete','destroy','/:id/sounds/:id2','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','/:id/sounds','post','create','addSound','put','update'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0x38ae,0x6d));var _0xe38a=function(_0x48c612,_0x432076){_0x48c612=_0x48c612-0x0;var _0x5f0583=_0x38ae[_0x48c612];return _0x5f0583;};'use strict';var multer=require(_0xe38a('0x0'));var util=require('util');var path=require(_0xe38a('0x1'));var timeout=require(_0xe38a('0x2'));var express=require(_0xe38a('0x3'));var router=express['Router']();var auth=require(_0xe38a('0x4'));var interaction=require(_0xe38a('0x5'));var config=require(_0xe38a('0x6'));var controller=require(_0xe38a('0x7'));router[_0xe38a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe38a('0x9'),auth[_0xe38a('0xa')](),controller['show']);router[_0xe38a('0x8')](_0xe38a('0xb'),auth[_0xe38a('0xa')](),controller['getSounds']);router[_0xe38a('0xc')]('/',auth['isAuthenticated'](),controller[_0xe38a('0xd')]);router[_0xe38a('0xc')](_0xe38a('0xb'),auth[_0xe38a('0xa')](),controller[_0xe38a('0xe')]);router[_0xe38a('0xf')](_0xe38a('0x9'),auth[_0xe38a('0xa')](),controller[_0xe38a('0x10')]);router[_0xe38a('0x11')](_0xe38a('0x9'),auth[_0xe38a('0xa')](),controller[_0xe38a('0x12')]);router[_0xe38a('0x11')](_0xe38a('0x13'),auth[_0xe38a('0xa')](),controller['removeSound']);module[_0xe38a('0x14')]=router; \ No newline at end of file +var _0x4172=['Router','../../components/auth/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','post','/:id/sounds','addSound','put','delete','destroy','removeSound','exports','multer','util','path','connect-timeout','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4172,0x145));var _0x2417=function(_0x2f2465,_0x54d379){_0x2f2465=_0x2f2465-0x0;var _0x10c3e7=_0x4172[_0x2f2465];return _0x10c3e7;};'use strict';var multer=require(_0x2417('0x0'));var util=require(_0x2417('0x1'));var path=require(_0x2417('0x2'));var timeout=require(_0x2417('0x3'));var express=require(_0x2417('0x4'));var router=express[_0x2417('0x5')]();var auth=require(_0x2417('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2417('0x7'));router[_0x2417('0x8')]('/',auth[_0x2417('0x9')](),controller[_0x2417('0xa')]);router['get'](_0x2417('0xb'),auth[_0x2417('0x9')](),controller[_0x2417('0xc')]);router['get']('/:id/sounds',auth[_0x2417('0x9')](),controller[_0x2417('0xd')]);router[_0x2417('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2417('0xf'),auth[_0x2417('0x9')](),controller[_0x2417('0x10')]);router[_0x2417('0x11')](_0x2417('0xb'),auth[_0x2417('0x9')](),controller['update']);router[_0x2417('0x12')](_0x2417('0xb'),auth[_0x2417('0x9')](),controller[_0x2417('0x13')]);router[_0x2417('0x12')]('/:id/sounds/:id2',auth[_0x2417('0x9')](),controller[_0x2417('0x14')]);module[_0x2417('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 ed7e196..6cbbc2e 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 _0x3315=['quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name','custom','quietmp3nb'];(function(_0x467133,_0x35fc7d){var _0x3e74fc=function(_0x49837d){while(--_0x49837d){_0x467133['push'](_0x467133['shift']());}};_0x3e74fc(++_0x35fc7d);}(_0x3315,0xf8));var _0x5331=function(_0x16b86d,_0x41ff79){_0x16b86d=_0x16b86d-0x0;var _0x2cc271=_0x3315[_0x16b86d];return _0x2cc271;};'use strict';var Sequelize=require(_0x5331('0x0'));module['exports']={'name':{'type':Sequelize[_0x5331('0x1')],'allowNull':![],'unique':_0x5331('0x2')},'mode':{'type':Sequelize['ENUM'](_0x5331('0x3'),'files','mp3nb',_0x5331('0x4'),_0x5331('0x5'),_0x5331('0x6')),'allowNull':!![],'defaultValue':_0x5331('0x7')},'directory':{'type':Sequelize[_0x5331('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x5331('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x5331('0x1')],'allowNull':!![],'defaultValue':_0x5331('0x8')},'format':{'type':Sequelize[_0x5331('0x1')],'allowNull':!![]},'stamp':{'type':_0x5331('0x9')},'defaultEntry':{'type':Sequelize[_0x5331('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x500d=['custom','files','quietmp3nb','quietmp3','mp3','alpha','sequelize','STRING','name','ENUM'];(function(_0x1b0ed4,_0x53b4d5){var _0x272710=function(_0x137557){while(--_0x137557){_0x1b0ed4['push'](_0x1b0ed4['shift']());}};_0x272710(++_0x53b4d5);}(_0x500d,0x146));var _0xd500=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0x500d[_0x1d2bbb];return _0x38082b;};'use strict';var Sequelize=require(_0xd500('0x0'));module['exports']={'name':{'type':Sequelize[_0xd500('0x1')],'allowNull':![],'unique':_0xd500('0x2')},'mode':{'type':Sequelize[_0xd500('0x3')](_0xd500('0x4'),_0xd500('0x5'),'mp3nb',_0xd500('0x6'),_0xd500('0x7'),_0xd500('0x8')),'allowNull':!![],'defaultValue':_0xd500('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xd500('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd500('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd500('0x1')],'allowNull':!![],'defaultValue':_0xd500('0x9')},'format':{'type':Sequelize['STRING'],'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 3d3c0db..16af799 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 _0xe1e3=['request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','Content-Range','apply','reject','update','then','get','MusicOnHolds','sendStatus','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','merge','VIRTUAL','filter','includeAll','include','rows','show','keys','options','catch','body','find','sequelize','mode','files','join','server/files/moh','create','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','destroy','params','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','save_name','converted_format','root','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','ValidationError','removeSound','findOne','id2','createdAt','getSounds','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4f1b87,_0x260834){var _0x74718e=function(_0x24c7c2){while(--_0x24c7c2){_0x4f1b87['push'](_0x4f1b87['shift']());}};_0x74718e(++_0x260834);}(_0xe1e3,0x14e));var _0x3e1e=function(_0x122f0f,_0x8ef8d3){_0x122f0f=_0x122f0f-0x0;var _0x4fbe79=_0xe1e3[_0x122f0f];return _0x4fbe79;};'use strict';var pdf=require(_0x3e1e('0x0'));var emlformat=require(_0x3e1e('0x1'));var rimraf=require(_0x3e1e('0x2'));var zipdir=require(_0x3e1e('0x3'));var jsonpatch=require(_0x3e1e('0x4'));var rp=require(_0x3e1e('0x5'));var moment=require(_0x3e1e('0x6'));var BPromise=require(_0x3e1e('0x7'));var Mustache=require(_0x3e1e('0x8'));var util=require('util');var path=require(_0x3e1e('0x9'));var sox=require(_0x3e1e('0xa'));var csv=require('to-csv');var ejs=require(_0x3e1e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3e1e('0xc'));var crypto=require(_0x3e1e('0xd'));var jsforce=require(_0x3e1e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3e1e('0xf'));var querystring=require(_0x3e1e('0x10'));var Papa=require(_0x3e1e('0x11'));var Redis=require('ioredis');var authService=require(_0x3e1e('0x12'));var qs=require(_0x3e1e('0x13'));var as=require(_0x3e1e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e1e('0x15'))(_0x3e1e('0x16'));var utils=require(_0x3e1e('0x17'));var config=require(_0x3e1e('0x18'));var licenseUtil=require(_0x3e1e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33270b,_0x1c4bf3){_0x1c4bf3=_0x1c4bf3||0xcc;return function(_0x4e1334){if(_0x4e1334){return _0x33270b['sendStatus'](_0x1c4bf3);}return _0x33270b[_0x3e1e('0x1a')](_0x1c4bf3)[_0x3e1e('0x1b')]();};}function respondWithResult(_0x165537,_0x16a66b){_0x16a66b=_0x16a66b||0xc8;return function(_0xf173a){if(_0xf173a){return _0x165537['status'](_0x16a66b)[_0x3e1e('0x1c')](_0xf173a);}};}function respondWithFilteredResult(_0x26cea8,_0x8ed2aa){return function(_0x2aab55){if(_0x2aab55){var _0x4eeb65=_0x2aab55[_0x3e1e('0x1d')],_0x4de745=_0x8ed2aa[_0x3e1e('0x1e')],_0x51b855=_0x8ed2aa[_0x3e1e('0x1e')]+_0x8ed2aa['limit'],_0x3f70fb;if(_0x51b855>=_0x4eeb65){_0x51b855=_0x4eeb65;_0x3f70fb=0xc8;}else{_0x3f70fb=0xce;}_0x26cea8['status'](_0x3f70fb);return _0x26cea8['set'](_0x3e1e('0x1f'),_0x4de745+'-'+_0x51b855+'/'+_0x4eeb65)[_0x3e1e('0x1c')](_0x2aab55);}return null;};}function patchUpdates(_0x245b34){return function(_0x4df6aa){try{jsonpatch[_0x3e1e('0x20')](_0x4df6aa,_0x245b34,!![]);}catch(_0x181405){return BPromise[_0x3e1e('0x21')](_0x181405);}return _0x4df6aa['save']();};}function saveUpdates(_0xc7a1c7,_0x7167bb){return function(_0x4cc3fd){if(_0x4cc3fd){return _0x4cc3fd[_0x3e1e('0x22')](_0xc7a1c7)[_0x3e1e('0x23')](function(_0x26f369){return _0x26f369;});}return null;};}function removeEntity(_0x47edcd,_0x4ee5bc){return function(_0x2b9834){if(_0x2b9834){return _0x2b9834['destroy']()[_0x3e1e('0x23')](function(){var _0x26da53=_0x2b9834[_0x3e1e('0x24')]({'plain':!![]});var _0x51223f=_0x3e1e('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x51223f,'resourceId':_0x26da53['id']}})['then'](function(){return _0x2b9834;});})[_0x3e1e('0x23')](function(){_0x47edcd['status'](0xcc)[_0x3e1e('0x1b')]();});}};}function handleEntityNotFound(_0x1bf7cd,_0x372a91){return function(_0x34e02d){if(!_0x34e02d){_0x1bf7cd[_0x3e1e('0x26')](0x194);}return _0x34e02d;};}function handleError(_0x4193d1,_0x33caa8){_0x33caa8=_0x33caa8||0x1f4;return function(_0x2c7444){logger['error'](_0x2c7444[_0x3e1e('0x27')]);if(_0x2c7444[_0x3e1e('0x28')]){delete _0x2c7444[_0x3e1e('0x28')];}_0x4193d1[_0x3e1e('0x1a')](_0x33caa8)[_0x3e1e('0x29')](_0x2c7444);};}exports[_0x3e1e('0x2a')]=function(_0x386a2a,_0x4e08aa){var _0x56ea98={},_0x47d77f={},_0xf92ec4={'count':0x0,'rows':[]};var _0x34a1aa=_['map'](db[_0x3e1e('0x2b')][_0x3e1e('0x2c')],function(_0x446d1a){return{'name':_0x446d1a[_0x3e1e('0x2d')],'type':_0x446d1a[_0x3e1e('0x2e')][_0x3e1e('0x2f')]};});_0x47d77f[_0x3e1e('0x30')]=_[_0x3e1e('0x31')](_0x34a1aa,_0x3e1e('0x28'));_0x47d77f[_0x3e1e('0x32')]=_['keys'](_0x386a2a[_0x3e1e('0x32')]);_0x47d77f[_0x3e1e('0x33')]=_[_0x3e1e('0x34')](_0x47d77f['model'],_0x47d77f[_0x3e1e('0x32')]);_0x56ea98[_0x3e1e('0x35')]=_[_0x3e1e('0x34')](_0x47d77f[_0x3e1e('0x30')],qs[_0x3e1e('0x36')](_0x386a2a[_0x3e1e('0x32')]['fields']));_0x56ea98[_0x3e1e('0x35')]=_0x56ea98['attributes'][_0x3e1e('0x37')]?_0x56ea98['attributes']:_0x47d77f[_0x3e1e('0x30')];if(!_0x386a2a[_0x3e1e('0x32')][_0x3e1e('0x38')](_0x3e1e('0x39'))){_0x56ea98[_0x3e1e('0x3a')]=qs[_0x3e1e('0x3a')](_0x386a2a[_0x3e1e('0x32')][_0x3e1e('0x3a')]);_0x56ea98[_0x3e1e('0x1e')]=qs[_0x3e1e('0x1e')](_0x386a2a[_0x3e1e('0x32')]['offset']);}_0x56ea98[_0x3e1e('0x3b')]=qs['sort'](_0x386a2a['query']['sort']);_0x56ea98['where']=qs['filters'](_['pick'](_0x386a2a[_0x3e1e('0x32')],_0x47d77f[_0x3e1e('0x33')]),_0x34a1aa);if(_0x386a2a[_0x3e1e('0x32')]['filter']){_0x56ea98[_0x3e1e('0x3c')]=_[_0x3e1e('0x3d')](_0x56ea98[_0x3e1e('0x3c')],{'$or':_['map'](_0x34a1aa,function(_0x526159){if(_0x526159['type']!==_0x3e1e('0x3e')){var _0x55ee4b={};_0x55ee4b[_0x526159[_0x3e1e('0x28')]]={'$like':'%'+_0x386a2a[_0x3e1e('0x32')][_0x3e1e('0x3f')]+'%'};return _0x55ee4b;}})});}_0x56ea98=_['merge']({},_0x56ea98,_0x386a2a['options']);var _0x1df01a={'where':_0x56ea98['where']};return db[_0x3e1e('0x2b')][_0x3e1e('0x1d')](_0x1df01a)['then'](function(_0x1f9d2a){_0xf92ec4['count']=_0x1f9d2a;if(_0x386a2a[_0x3e1e('0x32')][_0x3e1e('0x40')]){_0x56ea98[_0x3e1e('0x41')]=[{'all':!![]}];}return db[_0x3e1e('0x2b')]['findAll'](_0x56ea98);})['then'](function(_0x2f5808){_0xf92ec4[_0x3e1e('0x42')]=_0x2f5808;return _0xf92ec4;})[_0x3e1e('0x23')](respondWithFilteredResult(_0x4e08aa,_0x56ea98))['catch'](handleError(_0x4e08aa,null));};exports[_0x3e1e('0x43')]=function(_0x306a38,_0x3256bf){var _0x1a5531={'raw':![],'where':{'id':_0x306a38['params']['id']}},_0x4462a9={};_0x4462a9[_0x3e1e('0x30')]=_[_0x3e1e('0x44')](db[_0x3e1e('0x2b')][_0x3e1e('0x2c')]);_0x4462a9[_0x3e1e('0x32')]=_[_0x3e1e('0x44')](_0x306a38[_0x3e1e('0x32')]);_0x4462a9[_0x3e1e('0x33')]=_[_0x3e1e('0x34')](_0x4462a9[_0x3e1e('0x30')],_0x4462a9['query']);_0x1a5531[_0x3e1e('0x35')]=_[_0x3e1e('0x34')](_0x4462a9['model'],qs[_0x3e1e('0x36')](_0x306a38[_0x3e1e('0x32')]['fields']));_0x1a5531[_0x3e1e('0x35')]=_0x1a5531[_0x3e1e('0x35')][_0x3e1e('0x37')]?_0x1a5531[_0x3e1e('0x35')]:_0x4462a9[_0x3e1e('0x30')];if(_0x306a38['query']['includeAll']){_0x1a5531[_0x3e1e('0x41')]=[{'all':!![]}];}_0x1a5531=_[_0x3e1e('0x3d')]({},_0x1a5531,_0x306a38[_0x3e1e('0x45')]);return db[_0x3e1e('0x2b')]['find'](_0x1a5531)[_0x3e1e('0x23')](handleEntityNotFound(_0x3256bf,null))[_0x3e1e('0x23')](respondWithResult(_0x3256bf,null))[_0x3e1e('0x46')](handleError(_0x3256bf,null));};exports[_0x3e1e('0x22')]=function(_0x5f183c,_0x38879c){if(_0x5f183c[_0x3e1e('0x47')]['id']){delete _0x5f183c[_0x3e1e('0x47')]['id'];}return db['VoiceMusicOnHold'][_0x3e1e('0x48')]({'where':{'id':_0x5f183c['params']['id']}})[_0x3e1e('0x23')](handleEntityNotFound(_0x38879c,null))[_0x3e1e('0x23')](saveUpdates(_0x5f183c[_0x3e1e('0x47')],null))[_0x3e1e('0x23')](respondWithResult(_0x38879c,null))[_0x3e1e('0x46')](handleError(_0x38879c,null));};exports['create']=function(_0x8eac07,_0x211970,_0x262f24){return db[_0x3e1e('0x49')]['transaction'](function(_0x11119c){if(_0x8eac07[_0x3e1e('0x47')][_0x3e1e('0x4a')]===_0x3e1e('0x4b')){_0x8eac07[_0x3e1e('0x47')]['directory']=path[_0x3e1e('0x4c')](config['root'],_0x3e1e('0x4d'),_0x8eac07[_0x3e1e('0x47')][_0x3e1e('0x28')]);}return db[_0x3e1e('0x2b')][_0x3e1e('0x4e')](_0x8eac07[_0x3e1e('0x47')],{'transaction':_0x11119c})[_0x3e1e('0x23')](function(_0x2cc7e5){if(_0x8eac07[_0x3e1e('0x47')][_0x3e1e('0x4a')]==='files'){fs['mkdirSync'](_0x2cc7e5[_0x3e1e('0x4f')],parseInt(_0x3e1e('0x50'),0x8));}var _0x180eae=_0x8eac07[_0x3e1e('0x51')][_0x3e1e('0x24')]({'plain':!![]});if(!_0x180eae)throw new Error(_0x3e1e('0x52'));if(_0x180eae[_0x3e1e('0x53')]===_0x3e1e('0x51')){var _0x48584d=_0x2cc7e5[_0x3e1e('0x24')]({'plain':!![]});return db[_0x3e1e('0x54')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x180eae[_0x3e1e('0x55')]},'raw':!![]})[_0x3e1e('0x23')](function(_0x3b8b14){if(_0x3b8b14&&_0x3b8b14['autoAssociation']===0x0){return db[_0x3e1e('0x56')][_0x3e1e('0x4e')]({'name':_0x48584d[_0x3e1e('0x28')],'resourceId':_0x48584d['id'],'type':_0x3b8b14[_0x3e1e('0x28')],'sectionId':_0x3b8b14['id']},{})[_0x3e1e('0x23')](function(){return _0x2cc7e5;});}else{return _0x2cc7e5;}})['catch'](function(_0x59835a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59835a);});}return _0x2cc7e5;});})[_0x3e1e('0x23')](respondWithResult(_0x211970,0xc9))[_0x3e1e('0x46')](handleError(_0x211970,null));};exports[_0x3e1e('0x57')]=function(_0x5b5ac4,_0x5b871a,_0xda460f){var _0x92c498;return db[_0x3e1e('0x2b')][_0x3e1e('0x48')]({'where':{'id':_0x5b5ac4[_0x3e1e('0x58')]['id']}})[_0x3e1e('0x23')](function(_0x53f2fc){if(_0x53f2fc){return db[_0x3e1e('0x49')][_0x3e1e('0x59')](function(_0x376971){return _0x53f2fc[_0x3e1e('0x57')]({'transaction':_0x376971,'raw':!![]})['then'](function(_0x23b505){if(_0x23b505[_0x3e1e('0x4f')]){fs[_0x3e1e('0x5a')](_0x23b505['directory'])[_0x3e1e('0x5b')](function(_0x59f10f){fs[_0x3e1e('0x5c')](path['join'](_0x23b505[_0x3e1e('0x4f')],_0x59f10f));});fs[_0x3e1e('0x5d')](_0x23b505[_0x3e1e('0x4f')]);}return _0x23b505;});})[_0x3e1e('0x46')](function(_0x2a6b04){throw new db[(_0x3e1e('0x5e'))]['ValidationError'](_0x2a6b04[_0x3e1e('0x5f')]);});}})[_0x3e1e('0x23')](handleEntityNotFound(_0x5b871a,null))['then'](removeEntity(_0x5b871a,null))[_0x3e1e('0x46')](handleError(_0x5b871a,null));};exports['addSound']=function(_0x4a6136,_0x4f9506,_0x598a02){return db[_0x3e1e('0x49')][_0x3e1e('0x59')](function(_0x455a25){var _0x191f77;return db[_0x3e1e('0x2b')][_0x3e1e('0x48')]({'where':{'id':_0x4a6136[_0x3e1e('0x58')]['id']}})[_0x3e1e('0x23')](function(_0x17f363){if(_0x17f363){_0x191f77=_0x17f363;return _0x17f363[_0x3e1e('0x60')](_0x4a6136[_0x3e1e('0x47')]['id'],{'transaction':_0x455a25});}})[_0x3e1e('0x23')](function(_0x48e06b){if(_0x48e06b){return db[_0x3e1e('0x61')]['findOne']({'where':{'id':_0x4a6136[_0x3e1e('0x47')]['id']},'attributes':['id',_0x3e1e('0x28'),_0x3e1e('0x62'),_0x3e1e('0x63'),'createdAt'],'raw':!![]});}})[_0x3e1e('0x23')](function(_0x555c31){if(_0x555c31){var _0x3772e9=path[_0x3e1e('0x4c')](config[_0x3e1e('0x64')],_0x3e1e('0x65'),util[_0x3e1e('0x66')](_0x3e1e('0x67'),path['basename'](_0x555c31[_0x3e1e('0x62')],path[_0x3e1e('0x68')](_0x555c31[_0x3e1e('0x62')])),_0x555c31[_0x3e1e('0x63')]));var _0x4c2454=path[_0x3e1e('0x4c')](config[_0x3e1e('0x64')],_0x3e1e('0x4d'),_0x191f77['name'],util[_0x3e1e('0x66')](_0x3e1e('0x67'),_0x555c31[_0x3e1e('0x28')],_0x555c31['converted_format']));fs[_0x3e1e('0x69')](_0x3772e9,_0x4c2454);return _0x555c31;}})[_0x3e1e('0x46')](function(_0x420cce){throw new db['Sequelize'][(_0x3e1e('0x6a'))](_0x420cce[_0x3e1e('0x5f')]);});})[_0x3e1e('0x23')](handleEntityNotFound(_0x4f9506,null))[_0x3e1e('0x23')](respondWithResult(_0x4f9506,0xc9))[_0x3e1e('0x46')](handleError(_0x4f9506,null));};exports[_0x3e1e('0x6b')]=function(_0x27facc,_0x2b44c4,_0x54c506){return db[_0x3e1e('0x49')][_0x3e1e('0x59')](function(_0x288095){var _0x5af219;return db[_0x3e1e('0x2b')][_0x3e1e('0x6c')]({'where':{'id':_0x27facc['params']['id']}})[_0x3e1e('0x23')](handleEntityNotFound(_0x2b44c4,null))[_0x3e1e('0x23')](function(_0x266ada){if(_0x266ada){_0x5af219=_0x266ada;return _0x266ada[_0x3e1e('0x6b')](_0x27facc[_0x3e1e('0x58')][_0x3e1e('0x6d')]);}})[_0x3e1e('0x23')](function(_0x12f32){if(_0x12f32){return db[_0x3e1e('0x61')][_0x3e1e('0x6c')]({'where':{'id':_0x27facc[_0x3e1e('0x58')][_0x3e1e('0x6d')]},'attributes':['id',_0x3e1e('0x28'),_0x3e1e('0x62'),_0x3e1e('0x63'),_0x3e1e('0x6e')],'raw':!![]});}})[_0x3e1e('0x23')](function(_0x12e27a){if(_0x12e27a){fs[_0x3e1e('0x5c')](path[_0x3e1e('0x4c')](_0x5af219['directory'],util[_0x3e1e('0x66')](_0x3e1e('0x67'),_0x12e27a[_0x3e1e('0x28')],_0x12e27a[_0x3e1e('0x63')])));return _0x12e27a;}})[_0x3e1e('0x46')](function(_0x40111a){throw new db[(_0x3e1e('0x5e'))][(_0x3e1e('0x6a'))](_0x40111a['message']);});})[_0x3e1e('0x23')](handleEntityNotFound(_0x2b44c4,null))[_0x3e1e('0x23')](respondWithStatusCode(_0x2b44c4,0xcc))['catch'](handleError(_0x2b44c4,null));};exports[_0x3e1e('0x6f')]=function(_0x2a1003,_0x36a6d8,_0x2980c4){var _0xf30154={};var _0x313a56={};var _0x1ef0bd;var _0x35e596;return db[_0x3e1e('0x2b')][_0x3e1e('0x6c')]({'where':{'id':_0x2a1003[_0x3e1e('0x58')]['id']}})['then'](handleEntityNotFound(_0x36a6d8,null))[_0x3e1e('0x23')](function(_0x16bccf){if(_0x16bccf){_0x1ef0bd=_0x16bccf;_0x313a56[_0x3e1e('0x30')]=_[_0x3e1e('0x44')](db[_0x3e1e('0x61')][_0x3e1e('0x2c')]);_0x313a56['query']=_['keys'](_0x2a1003['query']);_0x313a56[_0x3e1e('0x33')]=_[_0x3e1e('0x34')](_0x313a56[_0x3e1e('0x30')],_0x313a56[_0x3e1e('0x32')]);_0xf30154[_0x3e1e('0x35')]=_[_0x3e1e('0x34')](_0x313a56[_0x3e1e('0x30')],qs[_0x3e1e('0x36')](_0x2a1003[_0x3e1e('0x32')][_0x3e1e('0x36')]));_0xf30154['attributes']=_0xf30154[_0x3e1e('0x35')][_0x3e1e('0x37')]?_0xf30154[_0x3e1e('0x35')]:_0x313a56['model'];_0xf30154['order']=qs['sort'](_0x2a1003[_0x3e1e('0x32')]['sort']);_0xf30154[_0x3e1e('0x3c')]=qs[_0x3e1e('0x33')](_[_0x3e1e('0x70')](_0x2a1003[_0x3e1e('0x32')],_0x313a56['filters']));if(_0x2a1003[_0x3e1e('0x32')][_0x3e1e('0x3f')]){_0xf30154[_0x3e1e('0x3c')]=_[_0x3e1e('0x3d')](_0xf30154[_0x3e1e('0x3c')],{'$or':_[_0x3e1e('0x31')](_0xf30154['attributes'],function(_0x49f98e){var _0x93e161={};_0x93e161[_0x49f98e]={'$like':'%'+_0x2a1003[_0x3e1e('0x32')][_0x3e1e('0x3f')]+'%'};return _0x93e161;})});}_0xf30154=_['merge']({},_0xf30154,_0x2a1003[_0x3e1e('0x45')]);return _0x1ef0bd['getSounds'](_0xf30154);}})[_0x3e1e('0x23')](function(_0x52574a){if(_0x52574a){_0x35e596=_0x52574a['length'];if(!_0x2a1003[_0x3e1e('0x32')]['hasOwnProperty'](_0x3e1e('0x39'))){_0xf30154['limit']=qs[_0x3e1e('0x3a')](_0x2a1003['query'][_0x3e1e('0x3a')]);_0xf30154[_0x3e1e('0x1e')]=qs['offset'](_0x2a1003[_0x3e1e('0x32')]['offset']);}return _0x1ef0bd['getSounds'](_0xf30154);}})['then'](function(_0x4b804e){if(_0x4b804e){return _0x4b804e?{'count':_0x35e596,'rows':_0x4b804e}:null;}})[_0x3e1e('0x23')](respondWithResult(_0x36a6d8,null))[_0x3e1e('0x46')](handleError(_0x36a6d8,null));}; \ No newline at end of file +var _0xf87e=['sequelize','transaction','mode','files','root','server/files/moh','mkdirSync','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','readdirSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','removeSound','id2','Sound','unlinkSync','getSounds','order','nolimit','html-pdf','zip-dir','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','UserProfileResource','destroy','error','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','include','findAll','catch','show','params','keys','includeAll','options','update','body','find','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf87e,0x172));var _0xef87=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xf87e[_0x2642cb];return _0xe6e41;};'use strict';var pdf=require(_0xef87('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xef87('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xef87('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xef87('0x3'));var sox=require(_0xef87('0x4'));var csv=require('to-csv');var ejs=require(_0xef87('0x5'));var fs=require('fs');var _=require(_0xef87('0x6'));var squel=require(_0xef87('0x7'));var crypto=require(_0xef87('0x8'));var jsforce=require(_0xef87('0x9'));var deskjs=require(_0xef87('0xa'));var toCsv=require(_0xef87('0xb'));var querystring=require('querystring');var Papa=require(_0xef87('0xc'));var Redis=require('ioredis');var authService=require(_0xef87('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xef87('0xe'));var hardwareService=require(_0xef87('0xf'));var logger=require(_0xef87('0x10'))(_0xef87('0x11'));var utils=require(_0xef87('0x12'));var config=require(_0xef87('0x13'));var licenseUtil=require(_0xef87('0x14'));var db=require(_0xef87('0x15'))['db'];function respondWithStatusCode(_0x226df4,_0x53c1f2){_0x53c1f2=_0x53c1f2||0xcc;return function(_0x3a4d06){if(_0x3a4d06){return _0x226df4[_0xef87('0x16')](_0x53c1f2);}return _0x226df4[_0xef87('0x17')](_0x53c1f2)[_0xef87('0x18')]();};}function respondWithResult(_0x5ebbb3,_0x1436d8){_0x1436d8=_0x1436d8||0xc8;return function(_0x5c4501){if(_0x5c4501){return _0x5ebbb3[_0xef87('0x17')](_0x1436d8)[_0xef87('0x19')](_0x5c4501);}};}function respondWithFilteredResult(_0x3ad8f2,_0x165815){return function(_0x33fe42){if(_0x33fe42){var _0x166b10=_0x33fe42[_0xef87('0x1a')],_0x1a5497=_0x165815[_0xef87('0x1b')],_0x4a5ed6=_0x165815[_0xef87('0x1b')]+_0x165815[_0xef87('0x1c')],_0x4096ef;if(_0x4a5ed6>=_0x166b10){_0x4a5ed6=_0x166b10;_0x4096ef=0xc8;}else{_0x4096ef=0xce;}_0x3ad8f2[_0xef87('0x17')](_0x4096ef);return _0x3ad8f2['set'](_0xef87('0x1d'),_0x1a5497+'-'+_0x4a5ed6+'/'+_0x166b10)[_0xef87('0x19')](_0x33fe42);}return null;};}function patchUpdates(_0x23830e){return function(_0x2cc32d){try{jsonpatch[_0xef87('0x1e')](_0x2cc32d,_0x23830e,!![]);}catch(_0x336a50){return BPromise[_0xef87('0x1f')](_0x336a50);}return _0x2cc32d[_0xef87('0x20')]();};}function saveUpdates(_0x58bd51,_0x4952c6){return function(_0x498442){if(_0x498442){return _0x498442['update'](_0x58bd51)[_0xef87('0x21')](function(_0x37e3b1){return _0x37e3b1;});}return null;};}function removeEntity(_0x446ac3,_0x49ab36){return function(_0x18770d){if(_0x18770d){return _0x18770d['destroy']()[_0xef87('0x21')](function(){var _0xd1c70b=_0x18770d['get']({'plain':!![]});var _0x2f9843='MusicOnHolds';return db[_0xef87('0x22')][_0xef87('0x23')]({'where':{'type':_0x2f9843,'resourceId':_0xd1c70b['id']}})['then'](function(){return _0x18770d;});})[_0xef87('0x21')](function(){_0x446ac3[_0xef87('0x17')](0xcc)[_0xef87('0x18')]();});}};}function handleEntityNotFound(_0x45b73b,_0x5a55ef){return function(_0x44ff9c){if(!_0x44ff9c){_0x45b73b[_0xef87('0x16')](0x194);}return _0x44ff9c;};}function handleError(_0x2b7f5e,_0x791e75){_0x791e75=_0x791e75||0x1f4;return function(_0x4307a0){logger[_0xef87('0x24')](_0x4307a0['stack']);if(_0x4307a0[_0xef87('0x25')]){delete _0x4307a0[_0xef87('0x25')];}_0x2b7f5e[_0xef87('0x17')](_0x791e75)[_0xef87('0x26')](_0x4307a0);};}exports['index']=function(_0x54e5ea,_0x300784){var _0x4ec85a={},_0x4e8445={},_0x4cdae1={'count':0x0,'rows':[]};var _0x41b3c0=_[_0xef87('0x27')](db[_0xef87('0x28')][_0xef87('0x29')],function(_0x1331e0){return{'name':_0x1331e0[_0xef87('0x2a')],'type':_0x1331e0[_0xef87('0x2b')][_0xef87('0x2c')]};});_0x4e8445['model']=_[_0xef87('0x27')](_0x41b3c0,'name');_0x4e8445[_0xef87('0x2d')]=_['keys'](_0x54e5ea['query']);_0x4e8445[_0xef87('0x2e')]=_[_0xef87('0x2f')](_0x4e8445[_0xef87('0x30')],_0x4e8445[_0xef87('0x2d')]);_0x4ec85a[_0xef87('0x31')]=_[_0xef87('0x2f')](_0x4e8445['model'],qs[_0xef87('0x32')](_0x54e5ea[_0xef87('0x2d')][_0xef87('0x32')]));_0x4ec85a['attributes']=_0x4ec85a[_0xef87('0x31')][_0xef87('0x33')]?_0x4ec85a[_0xef87('0x31')]:_0x4e8445[_0xef87('0x30')];if(!_0x54e5ea[_0xef87('0x2d')][_0xef87('0x34')]('nolimit')){_0x4ec85a[_0xef87('0x1c')]=qs['limit'](_0x54e5ea[_0xef87('0x2d')][_0xef87('0x1c')]);_0x4ec85a[_0xef87('0x1b')]=qs['offset'](_0x54e5ea[_0xef87('0x2d')][_0xef87('0x1b')]);}_0x4ec85a['order']=qs[_0xef87('0x35')](_0x54e5ea[_0xef87('0x2d')][_0xef87('0x35')]);_0x4ec85a['where']=qs[_0xef87('0x2e')](_[_0xef87('0x36')](_0x54e5ea[_0xef87('0x2d')],_0x4e8445[_0xef87('0x2e')]),_0x41b3c0);if(_0x54e5ea[_0xef87('0x2d')][_0xef87('0x37')]){_0x4ec85a[_0xef87('0x38')]=_['merge'](_0x4ec85a[_0xef87('0x38')],{'$or':_[_0xef87('0x27')](_0x41b3c0,function(_0x249052){if(_0x249052[_0xef87('0x2b')]!=='VIRTUAL'){var _0x5995f4={};_0x5995f4[_0x249052[_0xef87('0x25')]]={'$like':'%'+_0x54e5ea['query'][_0xef87('0x37')]+'%'};return _0x5995f4;}})});}_0x4ec85a=_[_0xef87('0x39')]({},_0x4ec85a,_0x54e5ea['options']);var _0x5ef01b={'where':_0x4ec85a[_0xef87('0x38')]};return db['VoiceMusicOnHold'][_0xef87('0x1a')](_0x5ef01b)['then'](function(_0x295692){_0x4cdae1[_0xef87('0x1a')]=_0x295692;if(_0x54e5ea[_0xef87('0x2d')]['includeAll']){_0x4ec85a[_0xef87('0x3a')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xef87('0x3b')](_0x4ec85a);})['then'](function(_0x5bcae7){_0x4cdae1['rows']=_0x5bcae7;return _0x4cdae1;})[_0xef87('0x21')](respondWithFilteredResult(_0x300784,_0x4ec85a))[_0xef87('0x3c')](handleError(_0x300784,null));};exports[_0xef87('0x3d')]=function(_0x18f39c,_0x5ca690){var _0x5b3c94={'raw':![],'where':{'id':_0x18f39c[_0xef87('0x3e')]['id']}},_0x51489d={};_0x51489d[_0xef87('0x30')]=_[_0xef87('0x3f')](db[_0xef87('0x28')]['rawAttributes']);_0x51489d['query']=_[_0xef87('0x3f')](_0x18f39c['query']);_0x51489d[_0xef87('0x2e')]=_[_0xef87('0x2f')](_0x51489d[_0xef87('0x30')],_0x51489d['query']);_0x5b3c94['attributes']=_[_0xef87('0x2f')](_0x51489d['model'],qs[_0xef87('0x32')](_0x18f39c[_0xef87('0x2d')]['fields']));_0x5b3c94[_0xef87('0x31')]=_0x5b3c94[_0xef87('0x31')][_0xef87('0x33')]?_0x5b3c94[_0xef87('0x31')]:_0x51489d[_0xef87('0x30')];if(_0x18f39c[_0xef87('0x2d')][_0xef87('0x40')]){_0x5b3c94[_0xef87('0x3a')]=[{'all':!![]}];}_0x5b3c94=_[_0xef87('0x39')]({},_0x5b3c94,_0x18f39c[_0xef87('0x41')]);return db[_0xef87('0x28')]['find'](_0x5b3c94)[_0xef87('0x21')](handleEntityNotFound(_0x5ca690,null))[_0xef87('0x21')](respondWithResult(_0x5ca690,null))[_0xef87('0x3c')](handleError(_0x5ca690,null));};exports[_0xef87('0x42')]=function(_0x4bee85,_0x1d42e7){if(_0x4bee85[_0xef87('0x43')]['id']){delete _0x4bee85[_0xef87('0x43')]['id'];}return db['VoiceMusicOnHold'][_0xef87('0x44')]({'where':{'id':_0x4bee85[_0xef87('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1d42e7,null))[_0xef87('0x21')](saveUpdates(_0x4bee85[_0xef87('0x43')],null))['then'](respondWithResult(_0x1d42e7,null))[_0xef87('0x3c')](handleError(_0x1d42e7,null));};exports[_0xef87('0x45')]=function(_0x151db6,_0x397f47,_0x26d6d3){return db[_0xef87('0x46')][_0xef87('0x47')](function(_0x9aa416){if(_0x151db6[_0xef87('0x43')][_0xef87('0x48')]===_0xef87('0x49')){_0x151db6['body']['directory']=path['join'](config[_0xef87('0x4a')],_0xef87('0x4b'),_0x151db6['body']['name']);}return db[_0xef87('0x28')][_0xef87('0x45')](_0x151db6[_0xef87('0x43')],{'transaction':_0x9aa416})[_0xef87('0x21')](function(_0xc45507){if(_0x151db6[_0xef87('0x43')][_0xef87('0x48')]===_0xef87('0x49')){fs[_0xef87('0x4c')](_0xc45507[_0xef87('0x4d')],parseInt(_0xef87('0x4e'),0x8));}var _0x1ae51a=_0x151db6[_0xef87('0x4f')][_0xef87('0x50')]({'plain':!![]});if(!_0x1ae51a)throw new Error(_0xef87('0x51'));if(_0x1ae51a[_0xef87('0x52')]===_0xef87('0x4f')){var _0x488229=_0xc45507[_0xef87('0x50')]({'plain':!![]});return db[_0xef87('0x53')][_0xef87('0x44')]({'where':{'name':_0xef87('0x54'),'userProfileId':_0x1ae51a[_0xef87('0x55')]},'raw':!![]})['then'](function(_0x4cfc58){if(_0x4cfc58&&_0x4cfc58[_0xef87('0x56')]===0x0){return db['UserProfileResource'][_0xef87('0x45')]({'name':_0x488229[_0xef87('0x25')],'resourceId':_0x488229['id'],'type':_0x4cfc58[_0xef87('0x25')],'sectionId':_0x4cfc58['id']},{})[_0xef87('0x21')](function(){return _0xc45507;});}else{return _0xc45507;}})[_0xef87('0x3c')](function(_0x118b6d){logger[_0xef87('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x118b6d);});}return _0xc45507;});})[_0xef87('0x21')](respondWithResult(_0x397f47,0xc9))[_0xef87('0x3c')](handleError(_0x397f47,null));};exports['destroy']=function(_0x59db1a,_0x471597,_0x220b3e){var _0x59f643;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x59db1a[_0xef87('0x3e')]['id']}})[_0xef87('0x21')](function(_0x3f3921){if(_0x3f3921){return db[_0xef87('0x46')]['transaction'](function(_0xe6070b){return _0x3f3921['destroy']({'transaction':_0xe6070b,'raw':!![]})[_0xef87('0x21')](function(_0x578d0a){if(_0x578d0a['directory']){fs[_0xef87('0x57')](_0x578d0a[_0xef87('0x4d')])['forEach'](function(_0x30aaf2){fs['unlinkSync'](path[_0xef87('0x58')](_0x578d0a[_0xef87('0x4d')],_0x30aaf2));});fs[_0xef87('0x59')](_0x578d0a['directory']);}return _0x578d0a;});})['catch'](function(_0x36234d){throw new db[(_0xef87('0x5a'))][(_0xef87('0x5b'))](_0x36234d[_0xef87('0x5c')]);});}})[_0xef87('0x21')](handleEntityNotFound(_0x471597,null))[_0xef87('0x21')](removeEntity(_0x471597,null))['catch'](handleError(_0x471597,null));};exports[_0xef87('0x5d')]=function(_0x5b720f,_0x40edb9,_0x187ad1){return db[_0xef87('0x46')][_0xef87('0x47')](function(_0x1ad34c){var _0x240821;return db[_0xef87('0x28')]['find']({'where':{'id':_0x5b720f['params']['id']}})['then'](function(_0x5b2243){if(_0x5b2243){_0x240821=_0x5b2243;return _0x5b2243[_0xef87('0x5d')](_0x5b720f[_0xef87('0x43')]['id'],{'transaction':_0x1ad34c});}})[_0xef87('0x21')](function(_0x18be8a){if(_0x18be8a){return db['Sound'][_0xef87('0x5e')]({'where':{'id':_0x5b720f[_0xef87('0x43')]['id']},'attributes':['id',_0xef87('0x25'),_0xef87('0x5f'),_0xef87('0x60'),_0xef87('0x61')],'raw':!![]});}})[_0xef87('0x21')](function(_0x21cef9){if(_0x21cef9){var _0x2a3813=path[_0xef87('0x58')](config[_0xef87('0x4a')],_0xef87('0x62'),util[_0xef87('0x63')](_0xef87('0x64'),path[_0xef87('0x65')](_0x21cef9['save_name'],path['extname'](_0x21cef9[_0xef87('0x5f')])),_0x21cef9[_0xef87('0x60')]));var _0x192b48=path[_0xef87('0x58')](config[_0xef87('0x4a')],_0xef87('0x4b'),_0x240821[_0xef87('0x25')],util['format'](_0xef87('0x64'),_0x21cef9[_0xef87('0x25')],_0x21cef9[_0xef87('0x60')]));fs[_0xef87('0x66')](_0x2a3813,_0x192b48);return _0x21cef9;}})[_0xef87('0x3c')](function(_0x2b0aa1){throw new db[(_0xef87('0x5a'))][(_0xef87('0x5b'))](_0x2b0aa1[_0xef87('0x5c')]);});})[_0xef87('0x21')](handleEntityNotFound(_0x40edb9,null))['then'](respondWithResult(_0x40edb9,0xc9))[_0xef87('0x3c')](handleError(_0x40edb9,null));};exports[_0xef87('0x67')]=function(_0x20738c,_0x22fff6,_0x342d35){return db[_0xef87('0x46')][_0xef87('0x47')](function(_0x892fbe){var _0x338872;return db[_0xef87('0x28')][_0xef87('0x5e')]({'where':{'id':_0x20738c['params']['id']}})[_0xef87('0x21')](handleEntityNotFound(_0x22fff6,null))[_0xef87('0x21')](function(_0x354a9c){if(_0x354a9c){_0x338872=_0x354a9c;return _0x354a9c[_0xef87('0x67')](_0x20738c['params'][_0xef87('0x68')]);}})[_0xef87('0x21')](function(_0x145fc2){if(_0x145fc2){return db[_0xef87('0x69')][_0xef87('0x5e')]({'where':{'id':_0x20738c[_0xef87('0x3e')][_0xef87('0x68')]},'attributes':['id',_0xef87('0x25'),'save_name',_0xef87('0x60'),_0xef87('0x61')],'raw':!![]});}})[_0xef87('0x21')](function(_0x31b779){if(_0x31b779){fs[_0xef87('0x6a')](path[_0xef87('0x58')](_0x338872[_0xef87('0x4d')],util['format'](_0xef87('0x64'),_0x31b779[_0xef87('0x25')],_0x31b779[_0xef87('0x60')])));return _0x31b779;}})[_0xef87('0x3c')](function(_0x2ebba4){throw new db[(_0xef87('0x5a'))][(_0xef87('0x5b'))](_0x2ebba4[_0xef87('0x5c')]);});})[_0xef87('0x21')](handleEntityNotFound(_0x22fff6,null))[_0xef87('0x21')](respondWithStatusCode(_0x22fff6,0xcc))[_0xef87('0x3c')](handleError(_0x22fff6,null));};exports[_0xef87('0x6b')]=function(_0x49ea70,_0x1d8c9f,_0x290261){var _0x2577c2={};var _0x468db8={};var _0x5356c7;var _0x95589f;return db[_0xef87('0x28')]['findOne']({'where':{'id':_0x49ea70['params']['id']}})['then'](handleEntityNotFound(_0x1d8c9f,null))[_0xef87('0x21')](function(_0x28ff02){if(_0x28ff02){_0x5356c7=_0x28ff02;_0x468db8['model']=_[_0xef87('0x3f')](db[_0xef87('0x69')][_0xef87('0x29')]);_0x468db8['query']=_[_0xef87('0x3f')](_0x49ea70[_0xef87('0x2d')]);_0x468db8[_0xef87('0x2e')]=_['intersection'](_0x468db8[_0xef87('0x30')],_0x468db8[_0xef87('0x2d')]);_0x2577c2['attributes']=_['intersection'](_0x468db8[_0xef87('0x30')],qs['fields'](_0x49ea70[_0xef87('0x2d')][_0xef87('0x32')]));_0x2577c2['attributes']=_0x2577c2['attributes'][_0xef87('0x33')]?_0x2577c2[_0xef87('0x31')]:_0x468db8[_0xef87('0x30')];_0x2577c2[_0xef87('0x6c')]=qs[_0xef87('0x35')](_0x49ea70[_0xef87('0x2d')]['sort']);_0x2577c2[_0xef87('0x38')]=qs[_0xef87('0x2e')](_[_0xef87('0x36')](_0x49ea70[_0xef87('0x2d')],_0x468db8[_0xef87('0x2e')]));if(_0x49ea70[_0xef87('0x2d')][_0xef87('0x37')]){_0x2577c2[_0xef87('0x38')]=_[_0xef87('0x39')](_0x2577c2[_0xef87('0x38')],{'$or':_[_0xef87('0x27')](_0x2577c2[_0xef87('0x31')],function(_0x3e5e8d){var _0x17d899={};_0x17d899[_0x3e5e8d]={'$like':'%'+_0x49ea70[_0xef87('0x2d')][_0xef87('0x37')]+'%'};return _0x17d899;})});}_0x2577c2=_['merge']({},_0x2577c2,_0x49ea70[_0xef87('0x41')]);return _0x5356c7[_0xef87('0x6b')](_0x2577c2);}})[_0xef87('0x21')](function(_0x8cf29){if(_0x8cf29){_0x95589f=_0x8cf29[_0xef87('0x33')];if(!_0x49ea70[_0xef87('0x2d')][_0xef87('0x34')](_0xef87('0x6d'))){_0x2577c2[_0xef87('0x1c')]=qs[_0xef87('0x1c')](_0x49ea70['query'][_0xef87('0x1c')]);_0x2577c2[_0xef87('0x1b')]=qs['offset'](_0x49ea70['query'][_0xef87('0x1b')]);}return _0x5356c7[_0xef87('0x6b')](_0x2577c2);}})[_0xef87('0x21')](function(_0x503738){if(_0x503738){return _0x503738?{'count':_0x95589f,'rows':_0x503738}:null;}})[_0xef87('0x21')](respondWithResult(_0x1d8c9f,null))[_0xef87('0x3c')](handleError(_0x1d8c9f,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 97a4e69..b551be0 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 _0xae48=['../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0xe614a9,_0x32c3fd){var _0xd12b12=function(_0x468bc8){while(--_0x468bc8){_0xe614a9['push'](_0xe614a9['shift']());}};_0xd12b12(++_0x32c3fd);}(_0xae48,0x10e));var _0x8ae4=function(_0x162246,_0x4e5038){_0x162246=_0x162246-0x0;var _0x32ac95=_0xae48[_0x162246];return _0x32ac95;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8ae4('0x0'))(_0x8ae4('0x1'));var moment=require(_0x8ae4('0x2'));var BPromise=require(_0x8ae4('0x3'));var rp=require(_0x8ae4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ae4('0x5'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0x8ae4('0x6')]=function(_0x2a2131,_0x240ebc){return _0x2a2131[_0x8ae4('0x7')](_0x8ae4('0x8'),attributes,{'tableName':_0x8ae4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07db=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','lodash','util'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x07db,0xcf));var _0xb07d=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0x07db[_0x5e6bec];return _0x5dc5cf;};'use strict';var _=require(_0xb07d('0x0'));var util=require(_0xb07d('0x1'));var logger=require(_0xb07d('0x2'))(_0xb07d('0x3'));var moment=require(_0xb07d('0x4'));var BPromise=require(_0xb07d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb07d('0x6'));var rimraf=require(_0xb07d('0x7'));var config=require(_0xb07d('0x8'));var attributes=require(_0xb07d('0x9'));module['exports']=function(_0xa33cc0,_0x1a1142){return _0xa33cc0[_0xb07d('0xa')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 879cf21..cb82cc2 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 _0x974e=['../../config/environment','jayson/promise','http','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2aaa0a,_0x36f63a){var _0x326d4b=function(_0x4a4089){while(--_0x4a4089){_0x2aaa0a['push'](_0x2aaa0a['shift']());}};_0x326d4b(++_0x36f63a);}(_0x974e,0xb7));var _0xe974=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x974e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe974('0x0'));var util=require(_0xe974('0x1'));var moment=require('moment');var BPromise=require(_0xe974('0x2'));var rs=require(_0xe974('0x3'));var fs=require('fs');var Redis=require(_0xe974('0x4'));var db=require(_0xe974('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe974('0x6'))('rpc');var config=require(_0xe974('0x7'));var jayson=require(_0xe974('0x8'));var client=jayson['client'][_0xe974('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2affd0,_0x544789,_0x2ff057){return new BPromise(function(_0x5d5f43,_0x485448){return client['request'](_0x2affd0,_0x2ff057)[_0xe974('0xa')](function(_0x27b1f4){logger[_0xe974('0xb')](_0xe974('0xc'),_0x544789,_0xe974('0xd'));logger['debug']('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x544789,_0xe974('0xd'),JSON['stringify'](_0x27b1f4));if(_0x27b1f4[_0xe974('0xe')]){if(_0x27b1f4['error'][_0xe974('0xf')]===0x1f4){logger[_0xe974('0xe')](_0xe974('0xc'),_0x544789,_0x27b1f4[_0xe974('0xe')][_0xe974('0x10')]);return _0x485448(_0x27b1f4[_0xe974('0xe')]['message']);}logger[_0xe974('0xe')](_0xe974('0xc'),_0x544789,_0x27b1f4[_0xe974('0xe')][_0xe974('0x10')]);return _0x5d5f43(_0x27b1f4[_0xe974('0xe')][_0xe974('0x10')]);}else{logger[_0xe974('0xb')](_0xe974('0xc'),_0x544789,'request\x20sent');_0x5d5f43(_0x27b1f4[_0xe974('0x11')][_0xe974('0x10')]);}})[_0xe974('0x12')](function(_0x4254ae){logger[_0xe974('0xe')](_0xe974('0xc'),_0x544789,_0x4254ae);_0x485448(_0x4254ae);});});} \ No newline at end of file +var _0x9310=['jayson/promise','client','http','request','then','info','request\x20sent','debug','error','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../config/logger'];(function(_0x8357df,_0x118d2c){var _0x345f33=function(_0xeeeb9d){while(--_0xeeeb9d){_0x8357df['push'](_0x8357df['shift']());}};_0x345f33(++_0x118d2c);}(_0x9310,0x10b));var _0x0931=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x9310[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require(_0x0931('0x0'));var util=require('util');var moment=require(_0x0931('0x1'));var BPromise=require(_0x0931('0x2'));var rs=require(_0x0931('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0931('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0931('0x5'));var client=jayson[_0x0931('0x6')][_0x0931('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x197d09,_0x282517,_0x4abbc1){return new BPromise(function(_0x3e5f64,_0x4d3e3b){return client[_0x0931('0x8')](_0x197d09,_0x4abbc1)[_0x0931('0x9')](function(_0x1dd30c){logger[_0x0931('0xa')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x282517,_0x0931('0xb'));logger[_0x0931('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x282517,_0x0931('0xb'),JSON['stringify'](_0x1dd30c));if(_0x1dd30c[_0x0931('0xd')]){if(_0x1dd30c[_0x0931('0xd')]['code']===0x1f4){logger[_0x0931('0xd')](_0x0931('0xe'),_0x282517,_0x1dd30c[_0x0931('0xd')]['message']);return _0x4d3e3b(_0x1dd30c[_0x0931('0xd')][_0x0931('0xf')]);}logger[_0x0931('0xd')](_0x0931('0xe'),_0x282517,_0x1dd30c[_0x0931('0xd')]['message']);return _0x3e5f64(_0x1dd30c[_0x0931('0xd')]['message']);}else{logger[_0x0931('0xa')](_0x0931('0xe'),_0x282517,'request\x20sent');_0x3e5f64(_0x1dd30c['result'][_0x0931('0xf')]);}})[_0x0931('0x10')](function(_0x4fccc0){logger[_0x0931('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x282517,_0x4fccc0);_0x4d3e3b(_0x4fccc0);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 888ec26..ed566b9 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 _0x5a19=['update','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','/describe','describe','get','/:id','show','/:id/users','getAgents','post','addAgents'];(function(_0x192f41,_0xe347f5){var _0xf10d82=function(_0x2e38ec){while(--_0x2e38ec){_0x192f41['push'](_0x192f41['shift']());}};_0xf10d82(++_0xe347f5);}(_0x5a19,0x1a7));var _0x95a1=function(_0x44166f,_0x3e71e2){_0x44166f=_0x44166f-0x0;var _0x5f390a=_0x5a19[_0x44166f];return _0x5f390a;};'use strict';var multer=require(_0x95a1('0x0'));var util=require(_0x95a1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x95a1('0x2'));var router=express[_0x95a1('0x3')]();var auth=require(_0x95a1('0x4'));var interaction=require(_0x95a1('0x5'));var config=require(_0x95a1('0x6'));var controller=require(_0x95a1('0x7'));router['get']('/',auth[_0x95a1('0x8')](),controller['index']);router['get'](_0x95a1('0x9'),auth[_0x95a1('0x8')](),controller[_0x95a1('0xa')]);router[_0x95a1('0xb')](_0x95a1('0xc'),auth[_0x95a1('0x8')](),controller[_0x95a1('0xd')]);router[_0x95a1('0xb')](_0x95a1('0xe'),auth[_0x95a1('0x8')](),controller[_0x95a1('0xf')]);router[_0x95a1('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x95a1('0x10')](_0x95a1('0xe'),auth[_0x95a1('0x8')](),controller[_0x95a1('0x11')]);router['put']('/:id',auth[_0x95a1('0x8')](),controller[_0x95a1('0x12')]);router[_0x95a1('0x13')](_0x95a1('0xc'),auth['isAuthenticated'](),controller[_0x95a1('0x14')]);router['delete'](_0x95a1('0xe'),auth[_0x95a1('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xd415=['getAgents','post','/:id','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./voicePrefix.controller','get','index','isAuthenticated','show','/:id/users'];(function(_0x82f586,_0x382c19){var _0x591ec8=function(_0xe5a055){while(--_0xe5a055){_0x82f586['push'](_0x82f586['shift']());}};_0x591ec8(++_0x382c19);}(_0xd415,0x1e2));var _0x5d41=function(_0xef9322,_0x1597ba){_0xef9322=_0xef9322-0x0;var _0x1632d8=_0xd415[_0xef9322];return _0x1632d8;};'use strict';var multer=require('multer');var util=require(_0x5d41('0x0'));var path=require(_0x5d41('0x1'));var timeout=require(_0x5d41('0x2'));var express=require(_0x5d41('0x3'));var router=express[_0x5d41('0x4')]();var auth=require(_0x5d41('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5d41('0x6'));router[_0x5d41('0x7')]('/',auth['isAuthenticated'](),controller[_0x5d41('0x8')]);router[_0x5d41('0x7')]('/describe',auth[_0x5d41('0x9')](),controller['describe']);router[_0x5d41('0x7')]('/:id',auth[_0x5d41('0x9')](),controller[_0x5d41('0xa')]);router[_0x5d41('0x7')](_0x5d41('0xb'),auth['isAuthenticated'](),controller[_0x5d41('0xc')]);router[_0x5d41('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5d41('0xd')](_0x5d41('0xb'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x5d41('0xe'),auth[_0x5d41('0x9')](),controller['update']);router[_0x5d41('0xf')](_0x5d41('0xe'),auth[_0x5d41('0x9')](),controller[_0x5d41('0x10')]);router[_0x5d41('0xf')]('/:id/users',auth[_0x5d41('0x9')](),controller[_0x5d41('0x11')]);module[_0x5d41('0x12')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 28058e8..347b727 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 _0x2297=['STRING','name','VIRTUAL','system-','getDataValue','sequelize'];(function(_0x2ff315,_0x44acbb){var _0x4ca22b=function(_0x51663b){while(--_0x51663b){_0x2ff315['push'](_0x2ff315['shift']());}};_0x4ca22b(++_0x44acbb);}(_0x2297,0x101));var _0x7229=function(_0x8e7564,_0x1cf4f0){_0x8e7564=_0x8e7564-0x0;var _0x1385ee=_0x2297[_0x8e7564];return _0x1385ee;};'use strict';var Sequelize=require(_0x7229('0x0'));module['exports']={'name':{'type':Sequelize[_0x7229('0x1')],'allowNull':![],'unique':_0x7229('0x2')},'prefix':{'type':Sequelize[_0x7229('0x3')],'get':function(_0xa966b4){return _0x7229('0x4')+this[_0x7229('0x5')](_0x7229('0x2'))+'-';}},'description':{'type':Sequelize[_0x7229('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd52a=['getDataValue','STRING','exports','name','VIRTUAL'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd52a,0xca));var _0xad52=function(_0x2a5167,_0x430d85){_0x2a5167=_0x2a5167-0x0;var _0x706982=_0xd52a[_0x2a5167];return _0x706982;};'use strict';var Sequelize=require('sequelize');module[_0xad52('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xad52('0x1')},'prefix':{'type':Sequelize[_0xad52('0x2')],'get':function(_0x30b335){return'system-'+this[_0xad52('0x3')](_0xad52('0x1'))+'-';}},'description':{'type':Sequelize[_0xad52('0x4')]},'callerIdAll':{'type':Sequelize[_0xad52('0x4')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c13257b..a536762 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 _0x15ef=['system-','transaction','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','getAgents','User','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','get','VoicePrefixes','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','destroy','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','NoOp','Voice\x20Prefix','bulkCreate','prefix','callerIdAll','push','goto','charAt'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x15ef,0x80));var _0xf15e=function(_0x5ebc7f,_0x74ab0d){_0x5ebc7f=_0x5ebc7f-0x0;var _0x3d0960=_0x15ef[_0x5ebc7f];return _0x3d0960;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf15e('0x0'));var rimraf=require(_0xf15e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf15e('0x2'));var rp=require(_0xf15e('0x3'));var moment=require(_0xf15e('0x4'));var BPromise=require(_0xf15e('0x5'));var Mustache=require(_0xf15e('0x6'));var util=require('util');var path=require(_0xf15e('0x7'));var sox=require(_0xf15e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf15e('0x9'));var squel=require(_0xf15e('0xa'));var crypto=require('crypto');var jsforce=require(_0xf15e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf15e('0xc'));var querystring=require(_0xf15e('0xd'));var Papa=require(_0xf15e('0xe'));var Redis=require(_0xf15e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15e('0x10'));var logger=require(_0xf15e('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf15e('0x12'));var db=require(_0xf15e('0x13'))['db'];config[_0xf15e('0x14')]=_['defaults'](config[_0xf15e('0x14')],{'host':_0xf15e('0x15'),'port':0x18eb});var socket=require(_0xf15e('0x16'))(new Redis(config['redis']));require(_0xf15e('0x17'))[_0xf15e('0x18')](socket);function respondWithStatusCode(_0x3e1b34,_0x280b78){_0x280b78=_0x280b78||0xcc;return function(_0x2861ee){if(_0x2861ee){return _0x3e1b34[_0xf15e('0x19')](_0x280b78);}return _0x3e1b34[_0xf15e('0x1a')](_0x280b78)[_0xf15e('0x1b')]();};}function respondWithResult(_0x54b94c,_0x11866c){_0x11866c=_0x11866c||0xc8;return function(_0x29a3bd){if(_0x29a3bd){return _0x54b94c['status'](_0x11866c)[_0xf15e('0x1c')](_0x29a3bd);}};}function respondWithFilteredResult(_0x4356ca,_0x45e418){return function(_0x487018){if(_0x487018){var _0x5c00fe=_0x487018[_0xf15e('0x1d')],_0x3ad067=_0x45e418[_0xf15e('0x1e')],_0x18a2a1=_0x45e418[_0xf15e('0x1e')]+_0x45e418['limit'],_0x503df0;if(_0x18a2a1>=_0x5c00fe){_0x18a2a1=_0x5c00fe;_0x503df0=0xc8;}else{_0x503df0=0xce;}_0x4356ca['status'](_0x503df0);return _0x4356ca[_0xf15e('0x1f')](_0xf15e('0x20'),_0x3ad067+'-'+_0x18a2a1+'/'+_0x5c00fe)['json'](_0x487018);}return null;};}function patchUpdates(_0x1012ea){return function(_0x56e8c9){try{jsonpatch['apply'](_0x56e8c9,_0x1012ea,!![]);}catch(_0x301616){return BPromise[_0xf15e('0x21')](_0x301616);}return _0x56e8c9[_0xf15e('0x22')]();};}function saveUpdates(_0x9ece34,_0x4900cd){return function(_0x2b9d85){if(_0x2b9d85){return _0x2b9d85[_0xf15e('0x23')](_0x9ece34)[_0xf15e('0x24')](function(_0x51c06a){return _0x51c06a;});}return null;};}function removeEntity(_0x248c4b,_0x43f8f2){return function(_0x548e59){if(_0x548e59){return _0x548e59['destroy']()[_0xf15e('0x24')](function(){var _0xb36af=_0x548e59[_0xf15e('0x25')]({'plain':!![]});var _0x471079=_0xf15e('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x471079,'resourceId':_0xb36af['id']}})[_0xf15e('0x24')](function(){return _0x548e59;});})[_0xf15e('0x24')](function(){_0x248c4b['status'](0xcc)[_0xf15e('0x1b')]();});}};}function handleEntityNotFound(_0x44ccd8,_0x2cb1e8){return function(_0x31d516){if(!_0x31d516){_0x44ccd8[_0xf15e('0x19')](0x194);}return _0x31d516;};}function handleError(_0xff4c07,_0x1e6a63){_0x1e6a63=_0x1e6a63||0x1f4;return function(_0x40321a){logger['error'](_0x40321a[_0xf15e('0x27')]);if(_0x40321a[_0xf15e('0x28')]){delete _0x40321a[_0xf15e('0x28')];}_0xff4c07['status'](_0x1e6a63)[_0xf15e('0x29')](_0x40321a);};}exports[_0xf15e('0x2a')]=function(_0x575d77,_0x17bbd2){var _0x398553={},_0x2ef2b6={},_0x501afe={'count':0x0,'rows':[]};var _0x143f29=_[_0xf15e('0x2b')](db[_0xf15e('0x2c')][_0xf15e('0x2d')],function(_0x4b7425){return{'name':_0x4b7425[_0xf15e('0x2e')],'type':_0x4b7425[_0xf15e('0x2f')]['key']};});_0x2ef2b6[_0xf15e('0x30')]=_[_0xf15e('0x2b')](_0x143f29,_0xf15e('0x28'));_0x2ef2b6['query']=_[_0xf15e('0x31')](_0x575d77[_0xf15e('0x32')]);_0x2ef2b6['filters']=_[_0xf15e('0x33')](_0x2ef2b6['model'],_0x2ef2b6[_0xf15e('0x32')]);_0x398553[_0xf15e('0x34')]=_['intersection'](_0x2ef2b6['model'],qs[_0xf15e('0x35')](_0x575d77[_0xf15e('0x32')]['fields']));_0x398553[_0xf15e('0x34')]=_0x398553[_0xf15e('0x34')][_0xf15e('0x36')]?_0x398553[_0xf15e('0x34')]:_0x2ef2b6[_0xf15e('0x30')];if(!_0x575d77[_0xf15e('0x32')]['hasOwnProperty'](_0xf15e('0x37'))){_0x398553[_0xf15e('0x38')]=qs[_0xf15e('0x38')](_0x575d77[_0xf15e('0x32')][_0xf15e('0x38')]);_0x398553[_0xf15e('0x1e')]=qs[_0xf15e('0x1e')](_0x575d77[_0xf15e('0x32')]['offset']);}_0x398553[_0xf15e('0x39')]=qs['sort'](_0x575d77[_0xf15e('0x32')][_0xf15e('0x3a')]);_0x398553[_0xf15e('0x3b')]=qs[_0xf15e('0x3c')](_[_0xf15e('0x3d')](_0x575d77[_0xf15e('0x32')],_0x2ef2b6['filters']),_0x143f29);if(_0x575d77[_0xf15e('0x32')][_0xf15e('0x3e')]){_0x398553[_0xf15e('0x3b')]=_[_0xf15e('0x3f')](_0x398553['where'],{'$or':_['map'](_0x143f29,function(_0x20ac33){if(_0x20ac33[_0xf15e('0x2f')]!==_0xf15e('0x40')){var _0x5cb0a6={};_0x5cb0a6[_0x20ac33['name']]={'$like':'%'+_0x575d77['query']['filter']+'%'};return _0x5cb0a6;}})});}_0x398553=_['merge']({},_0x398553,_0x575d77[_0xf15e('0x41')]);var _0x2986cf={'where':_0x398553[_0xf15e('0x3b')]};return db['VoicePrefix'][_0xf15e('0x1d')](_0x2986cf)['then'](function(_0x1cb880){_0x501afe[_0xf15e('0x1d')]=_0x1cb880;if(_0x575d77[_0xf15e('0x32')][_0xf15e('0x42')]){_0x398553['include']=[{'all':!![]}];}return db[_0xf15e('0x2c')][_0xf15e('0x43')](_0x398553);})[_0xf15e('0x24')](function(_0x3f4cf4){_0x501afe[_0xf15e('0x44')]=_0x3f4cf4;return _0x501afe;})['then'](respondWithFilteredResult(_0x17bbd2,_0x398553))[_0xf15e('0x45')](handleError(_0x17bbd2,null));};exports[_0xf15e('0x46')]=function(_0x21f048,_0x3f687e){var _0x38adab={'raw':![],'where':{'id':_0x21f048[_0xf15e('0x47')]['id']}},_0x670aa6={};_0x670aa6['model']=_[_0xf15e('0x31')](db[_0xf15e('0x2c')]['rawAttributes']);_0x670aa6['query']=_[_0xf15e('0x31')](_0x21f048['query']);_0x670aa6['filters']=_[_0xf15e('0x33')](_0x670aa6[_0xf15e('0x30')],_0x670aa6['query']);_0x38adab[_0xf15e('0x34')]=_[_0xf15e('0x33')](_0x670aa6[_0xf15e('0x30')],qs[_0xf15e('0x35')](_0x21f048[_0xf15e('0x32')][_0xf15e('0x35')]));_0x38adab[_0xf15e('0x34')]=_0x38adab[_0xf15e('0x34')][_0xf15e('0x36')]?_0x38adab['attributes']:_0x670aa6[_0xf15e('0x30')];if(_0x21f048[_0xf15e('0x32')][_0xf15e('0x42')]){_0x38adab['include']=[{'all':!![]}];}_0x38adab=_['merge']({},_0x38adab,_0x21f048[_0xf15e('0x41')]);return db[_0xf15e('0x2c')][_0xf15e('0x48')](_0x38adab)[_0xf15e('0x24')](handleEntityNotFound(_0x3f687e,null))[_0xf15e('0x24')](respondWithResult(_0x3f687e,null))[_0xf15e('0x45')](handleError(_0x3f687e,null));};exports[_0xf15e('0x49')]=function(_0x799550,_0x52621c){return db[_0xf15e('0x2c')][_0xf15e('0x48')]({'where':{'id':_0x799550['params']['id']}})[_0xf15e('0x24')](handleEntityNotFound(_0x52621c,null))['then'](removeEntity(_0x52621c,null))[_0xf15e('0x45')](handleError(_0x52621c,null));};exports[_0xf15e('0x4a')]=function(_0x28d1ca,_0x47fb5a){return db[_0xf15e('0x2c')][_0xf15e('0x4a')]()[_0xf15e('0x24')](respondWithResult(_0x47fb5a,null))[_0xf15e('0x45')](handleError(_0x47fb5a,null));};exports[_0xf15e('0x4b')]=function(_0x80c415,_0x1ae4ba){var _0x2507b3;return db[_0xf15e('0x4c')]['transaction'](function(_0x5471d8){return db[_0xf15e('0x2c')][_0xf15e('0x4b')](_0x80c415[_0xf15e('0x4d')],{'transaction':_0x5471d8})[_0xf15e('0x24')](function(_0x48c929){_0x2507b3=_0x48c929[_0xf15e('0x25')]({'plain':!![]});return db[_0xf15e('0x4e')][_0xf15e('0x48')]({'where':{'id':_0x2507b3[_0xf15e('0x4f')]},'raw':!![]})[_0xf15e('0x24')](function(_0x1980c0){return createVoicePrefixExtensions(_0x2507b3,_0x1980c0,_0x5471d8);});});})[_0xf15e('0x24')](function(){var _0x3dc8cc=_0x80c415[_0xf15e('0x50')][_0xf15e('0x25')]({'plain':!![]});if(!_0x3dc8cc)throw new Error(_0xf15e('0x51'));if(_0x3dc8cc[_0xf15e('0x52')]==='user'){var _0x1444f5=_0x2507b3;return db[_0xf15e('0x53')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x3dc8cc[_0xf15e('0x54')]},'raw':!![]})[_0xf15e('0x24')](function(_0x59ba45){if(_0x59ba45&&_0x59ba45['autoAssociation']===0x0){return db[_0xf15e('0x55')][_0xf15e('0x4b')]({'name':_0x1444f5[_0xf15e('0x28')],'resourceId':_0x1444f5['id'],'type':_0x59ba45[_0xf15e('0x28')],'sectionId':_0x59ba45['id']},{})[_0xf15e('0x24')](function(){return _0x2507b3;});}else{return _0x2507b3;}})[_0xf15e('0x45')](function(_0x228dba){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x228dba);throw _0x228dba;});}return _0x2507b3;})[_0xf15e('0x24')](respondWithResult(_0x1ae4ba,null))['catch'](handleError(_0x1ae4ba,null));};function Extension(_0x3c4ebb,_0x1d78c4,_0x34a5bc,_0x5a274a){this[_0xf15e('0x56')]=_0xf15e('0x57');this[_0xf15e('0x58')]=_0x3c4ebb;this[_0xf15e('0x59')]=_0x34a5bc;this['type']='system';this[_0xf15e('0x5a')]=_0xf15e('0x5b');this['priority']=_0x1d78c4;this['appdata']=_0x5a274a;}function createVoicePrefixExtensions(_0xa32ff,_0x1eec69,_0x447d78){return new BPromise(function(_0x1c69fb,_0x49267a){var _0x5c3b5b=new Extension(formatPrefixName(_0xa32ff['prefix']),0x1,_0xf15e('0x5c'),_0xf15e('0x5d'));_0x5c3b5b['VoicePrefixId']=_0xa32ff['id'];return db['VoiceExtension'][_0xf15e('0x4b')](_0x5c3b5b,{'transaction':_0x447d78})['then'](function(_0x584a77){var _0x5154b1=_0x584a77['get']({'plain':!![]});var _0x4b1cd9=_[_0xf15e('0x2b')](addVoicePrefixExtensions(_0xa32ff,_0x1eec69),function(_0x33a33c){_0x33a33c[_0xf15e('0x4f')]=_0x5154b1['id'];_0x33a33c['VoicePrefixId']=_0xa32ff['id'];return _0x33a33c;});return db['VoiceExtension'][_0xf15e('0x5e')](_0x4b1cd9,{'transaction':_0x447d78})[_0xf15e('0x24')](function(_0x5c5e1f){if(!_0x5c5e1f){return _0x49267a('Extensions\x20creation\x20failed');}else{return _0x1c69fb(_0x5c5e1f);}})[_0xf15e('0x45')](function(_0x310cc7){return _0x49267a(_0x310cc7);});});;});};function addVoicePrefixExtensions(_0x25a8c7,_0x532f5b){var _0x4a78f2=[];var _0x37e0b2=formatPrefixName(_0x25a8c7[_0xf15e('0x5f')]);_0x4a78f2['push'](new Extension(_0x37e0b2,0x2,'Set','CDR(prefix)='+_0x25a8c7['name']));if(_0x25a8c7[_0xf15e('0x60')]){_0x4a78f2[_0xf15e('0x61')](new Extension(_0x37e0b2,0x3,'Set','PREFIX-CALLERIDALL='+_0x25a8c7[_0xf15e('0x60')]));}else{_0x4a78f2['push'](new Extension(_0x37e0b2,0x3,_0xf15e('0x5c'),'No\x20callerid\x20available'));}_0x4a78f2[_0xf15e('0x61')](new Extension(_0x37e0b2,0x4,_0xf15e('0x62'),_0x532f5b[_0xf15e('0x56')]+','+'${EXTEN:'+(0x8+_0x25a8c7[_0xf15e('0x28')]['length'])+'}'+','+0x1));return _0x4a78f2;}function formatPrefixName(_0x28125c){var _0x275f34='_';for(var _0x17693d=0x0;_0x17693d<_0x28125c[_0xf15e('0x36')];_0x17693d++){if(_0x28125c[_0xf15e('0x63')](_0x17693d)=='-'){_0x275f34+=_0x28125c[_0xf15e('0x63')](_0x17693d);}else{_0x275f34+='['+_0x28125c[_0xf15e('0x63')](_0x17693d)+']';}}_0x275f34+='.';return _0x275f34;}exports[_0xf15e('0x23')]=function(_0x51a542,_0xea7304,_0x4efb1f){var _0x572889=_0x51a542[_0xf15e('0x4d')];_0x572889['prefix']=_0xf15e('0x64')+_0x572889[_0xf15e('0x28')]+'-';return db[_0xf15e('0x4c')][_0xf15e('0x65')](function(_0x45a25a){return db[_0xf15e('0x2c')][_0xf15e('0x23')](_0x572889,{'where':{'id':_0x572889['id']},'transaction':_0x45a25a})[_0xf15e('0x24')](function(){return db[_0xf15e('0x4e')][_0xf15e('0x49')]({'where':{'VoicePrefixId':_0x572889['id']},'transaction':_0x45a25a})['then'](function(){return db['VoiceExtension'][_0xf15e('0x48')]({'where':{'id':_0x572889['VoiceExtensionId']},'raw':!![]})['then'](function(_0x2bf5d3){return createVoicePrefixExtensions(_0x572889,_0x2bf5d3,_0x45a25a);});});});})[_0xf15e('0x24')](function(){return db['VoicePrefix'][_0xf15e('0x66')](_0x572889['id']);})[_0xf15e('0x24')](respondWithResult(_0xea7304,null))['catch'](handleError(_0xea7304,null));};exports['addAgents']=function(_0x738c45,_0x546388,_0x2b0f5d){return db[_0xf15e('0x2c')][_0xf15e('0x48')]({'where':{'id':_0x738c45[_0xf15e('0x47')]['id']}})[_0xf15e('0x24')](handleEntityNotFound(_0x546388,null))[_0xf15e('0x24')](function(_0x56882f){if(_0x56882f){return _0x56882f[_0xf15e('0x67')](_0x738c45['body']['ids'],_[_0xf15e('0x68')](_0x738c45[_0xf15e('0x4d')],[_0xf15e('0x69'),'id'])||{})[_0xf15e('0x6a')](function(_0x343bef){for(var _0x5a4d8d=0x0;_0x5a4d8d<_0x738c45[_0xf15e('0x4d')][_0xf15e('0x69')][_0xf15e('0x36')];_0x5a4d8d+=0x1){socket[_0xf15e('0x6b')](_0xf15e('0x6c'),{'UserId':_0x738c45['body']['ids'][_0x5a4d8d],'VoicePrefixId':_0x738c45[_0xf15e('0x47')]['id']});}return _0x343bef;});}})[_0xf15e('0x24')](respondWithResult(_0x546388,null))[_0xf15e('0x45')](handleError(_0x546388,null));};exports['removeAgents']=function(_0x4bb03d,_0x8c9288,_0x5129cb){return db[_0xf15e('0x2c')][_0xf15e('0x48')]({'where':{'id':_0x4bb03d['params']['id']}})[_0xf15e('0x24')](handleEntityNotFound(_0x8c9288,null))[_0xf15e('0x24')](function(_0x48ae6c){if(_0x48ae6c){return _0x48ae6c[_0xf15e('0x6d')](_0x4bb03d['query'][_0xf15e('0x69')])[_0xf15e('0x24')](function(){if(_[_0xf15e('0x6e')](_0x4bb03d[_0xf15e('0x32')][_0xf15e('0x69')])){for(var _0x6e3766=0x0;_0x6e3766<_0x4bb03d['query']['ids'][_0xf15e('0x36')];_0x6e3766+=0x1){socket[_0xf15e('0x6b')]('userVoicePrefix:remove',{'UserId':Number(_0x4bb03d['query'][_0xf15e('0x69')][_0x6e3766]),'VoicePrefixId':Number(_0x4bb03d['params']['id'])});}}else{socket[_0xf15e('0x6b')]('userVoicePrefix:remove',{'UserId':Number(_0x4bb03d[_0xf15e('0x32')][_0xf15e('0x69')]),'VoicePrefixId':Number(_0x4bb03d['params']['id'])});}});}})[_0xf15e('0x24')](respondWithStatusCode(_0x8c9288,null))['catch'](handleError(_0x8c9288,null));};exports[_0xf15e('0x6f')]=function(_0x26c648,_0x7dd47a,_0x4bcc17){var _0x40beaf={};var _0x88466b={};var _0x40bb88;var _0x27bad1;return db[_0xf15e('0x2c')]['findOne']({'where':{'id':_0x26c648['params']['id']}})[_0xf15e('0x24')](handleEntityNotFound(_0x7dd47a,null))[_0xf15e('0x24')](function(_0xf4d18f){if(_0xf4d18f){_0x40bb88=_0xf4d18f;_0x88466b['model']=_[_0xf15e('0x31')](db[_0xf15e('0x70')][_0xf15e('0x2d')]);_0x88466b[_0xf15e('0x32')]=_['keys'](_0x26c648[_0xf15e('0x32')]);_0x88466b[_0xf15e('0x3c')]=_[_0xf15e('0x33')](_0x88466b[_0xf15e('0x30')],_0x88466b[_0xf15e('0x32')]);_0x40beaf[_0xf15e('0x34')]=_[_0xf15e('0x33')](_0x88466b[_0xf15e('0x30')],qs[_0xf15e('0x35')](_0x26c648['query'][_0xf15e('0x35')]));_0x40beaf['attributes']=_0x40beaf[_0xf15e('0x34')][_0xf15e('0x36')]?_0x40beaf[_0xf15e('0x34')]:_0x88466b[_0xf15e('0x30')];_0x40beaf['order']=qs['sort'](_0x26c648['query']['sort']);_0x40beaf['where']=qs[_0xf15e('0x3c')](_[_0xf15e('0x3d')](_0x26c648[_0xf15e('0x32')],_0x88466b[_0xf15e('0x3c')]));if(_0x26c648[_0xf15e('0x32')][_0xf15e('0x3e')]){_0x40beaf[_0xf15e('0x3b')]=_[_0xf15e('0x3f')](_0x40beaf[_0xf15e('0x3b')],{'$or':_['map'](_0x40beaf[_0xf15e('0x34')],function(_0x10406e){var _0x4a3a36={};_0x4a3a36[_0x10406e]={'$like':'%'+_0x26c648[_0xf15e('0x32')][_0xf15e('0x3e')]+'%'};return _0x4a3a36;})});}_0x40beaf=_[_0xf15e('0x3f')]({},_0x40beaf,_0x26c648[_0xf15e('0x41')]);return _0x40bb88['getAgents'](_0x40beaf);}})[_0xf15e('0x24')](function(_0x40f151){if(_0x40f151){_0x27bad1=_0x40f151[_0xf15e('0x36')];if(!_0x26c648[_0xf15e('0x32')][_0xf15e('0x71')](_0xf15e('0x37'))){_0x40beaf[_0xf15e('0x38')]=qs['limit'](_0x26c648[_0xf15e('0x32')][_0xf15e('0x38')]);_0x40beaf['offset']=qs[_0xf15e('0x1e')](_0x26c648[_0xf15e('0x32')]['offset']);}return _0x40bb88[_0xf15e('0x6f')](_0x40beaf);}})[_0xf15e('0x24')](function(_0x228a23){if(_0x228a23){return _0x228a23?{'count':_0x27bad1,'rows':_0x228a23}:null;}})['then'](respondWithResult(_0x7dd47a,null))[_0xf15e('0x45')](handleError(_0x7dd47a,null));}; \ No newline at end of file +var _0xcb41=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','destroy','describe','create','sequelize','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','push','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','transaction','findById','addAgents','ids','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','pick','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0xcb41,0x1df));var _0x1cb4=function(_0x3342b8,_0x235581){_0x3342b8=_0x3342b8-0x0;var _0x20703e=_0xcb41[_0x3342b8];return _0x20703e;};'use strict';var pdf=require(_0x1cb4('0x0'));var emlformat=require(_0x1cb4('0x1'));var rimraf=require(_0x1cb4('0x2'));var zipdir=require(_0x1cb4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1cb4('0x4'));var moment=require('moment');var BPromise=require(_0x1cb4('0x5'));var Mustache=require(_0x1cb4('0x6'));var util=require(_0x1cb4('0x7'));var path=require(_0x1cb4('0x8'));var sox=require(_0x1cb4('0x9'));var csv=require(_0x1cb4('0xa'));var ejs=require(_0x1cb4('0xb'));var fs=require('fs');var _=require(_0x1cb4('0xc'));var squel=require('squel');var crypto=require(_0x1cb4('0xd'));var jsforce=require(_0x1cb4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1cb4('0xa'));var querystring=require(_0x1cb4('0xf'));var Papa=require(_0x1cb4('0x10'));var Redis=require('ioredis');var authService=require(_0x1cb4('0x11'));var qs=require(_0x1cb4('0x12'));var as=require(_0x1cb4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1cb4('0x14'));var utils=require('../../config/utils');var config=require(_0x1cb4('0x15'));var licenseUtil=require(_0x1cb4('0x16'));var db=require(_0x1cb4('0x17'))['db'];config[_0x1cb4('0x18')]=_[_0x1cb4('0x19')](config['redis'],{'host':_0x1cb4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cb4('0x18')]));require(_0x1cb4('0x1b'))[_0x1cb4('0x1c')](socket);function respondWithStatusCode(_0xb01aec,_0x147d0e){_0x147d0e=_0x147d0e||0xcc;return function(_0x433cfa){if(_0x433cfa){return _0xb01aec[_0x1cb4('0x1d')](_0x147d0e);}return _0xb01aec[_0x1cb4('0x1e')](_0x147d0e)[_0x1cb4('0x1f')]();};}function respondWithResult(_0x1858f1,_0x521b49){_0x521b49=_0x521b49||0xc8;return function(_0xbc72fd){if(_0xbc72fd){return _0x1858f1['status'](_0x521b49)[_0x1cb4('0x20')](_0xbc72fd);}};}function respondWithFilteredResult(_0x10326c,_0x5384db){return function(_0x56d926){if(_0x56d926){var _0x25b120=_0x56d926[_0x1cb4('0x21')],_0x281d36=_0x5384db[_0x1cb4('0x22')],_0xfc93ad=_0x5384db[_0x1cb4('0x22')]+_0x5384db[_0x1cb4('0x23')],_0x3c4493;if(_0xfc93ad>=_0x25b120){_0xfc93ad=_0x25b120;_0x3c4493=0xc8;}else{_0x3c4493=0xce;}_0x10326c['status'](_0x3c4493);return _0x10326c[_0x1cb4('0x24')](_0x1cb4('0x25'),_0x281d36+'-'+_0xfc93ad+'/'+_0x25b120)['json'](_0x56d926);}return null;};}function patchUpdates(_0x33993b){return function(_0x37aa88){try{jsonpatch[_0x1cb4('0x26')](_0x37aa88,_0x33993b,!![]);}catch(_0x19d342){return BPromise['reject'](_0x19d342);}return _0x37aa88[_0x1cb4('0x27')]();};}function saveUpdates(_0x51fc8d,_0x5ca9b5){return function(_0x20afe0){if(_0x20afe0){return _0x20afe0[_0x1cb4('0x28')](_0x51fc8d)[_0x1cb4('0x29')](function(_0x4d93b9){return _0x4d93b9;});}return null;};}function removeEntity(_0x3533e8,_0x33ec9c){return function(_0x2296d3){if(_0x2296d3){return _0x2296d3['destroy']()[_0x1cb4('0x29')](function(){var _0x1e8d9c=_0x2296d3[_0x1cb4('0x2a')]({'plain':!![]});var _0x8f32fb='VoicePrefixes';return db[_0x1cb4('0x2b')]['destroy']({'where':{'type':_0x8f32fb,'resourceId':_0x1e8d9c['id']}})['then'](function(){return _0x2296d3;});})['then'](function(){_0x3533e8[_0x1cb4('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28ac89,_0x17f4e1){return function(_0x569fff){if(!_0x569fff){_0x28ac89['sendStatus'](0x194);}return _0x569fff;};}function handleError(_0x2eced0,_0x32f6fd){_0x32f6fd=_0x32f6fd||0x1f4;return function(_0x1afda3){logger[_0x1cb4('0x2c')](_0x1afda3[_0x1cb4('0x2d')]);if(_0x1afda3[_0x1cb4('0x2e')]){delete _0x1afda3['name'];}_0x2eced0['status'](_0x32f6fd)['send'](_0x1afda3);};}exports[_0x1cb4('0x2f')]=function(_0x24b709,_0x22d82a){var _0xd97190={},_0x454546={},_0xf9a444={'count':0x0,'rows':[]};var _0x46a356=_[_0x1cb4('0x30')](db[_0x1cb4('0x31')][_0x1cb4('0x32')],function(_0x2e0cdb){return{'name':_0x2e0cdb[_0x1cb4('0x33')],'type':_0x2e0cdb[_0x1cb4('0x34')][_0x1cb4('0x35')]};});_0x454546[_0x1cb4('0x36')]=_[_0x1cb4('0x30')](_0x46a356,_0x1cb4('0x2e'));_0x454546[_0x1cb4('0x37')]=_['keys'](_0x24b709[_0x1cb4('0x37')]);_0x454546[_0x1cb4('0x38')]=_[_0x1cb4('0x39')](_0x454546[_0x1cb4('0x36')],_0x454546[_0x1cb4('0x37')]);_0xd97190['attributes']=_[_0x1cb4('0x39')](_0x454546[_0x1cb4('0x36')],qs[_0x1cb4('0x3a')](_0x24b709[_0x1cb4('0x37')][_0x1cb4('0x3a')]));_0xd97190[_0x1cb4('0x3b')]=_0xd97190[_0x1cb4('0x3b')][_0x1cb4('0x3c')]?_0xd97190[_0x1cb4('0x3b')]:_0x454546['model'];if(!_0x24b709['query'][_0x1cb4('0x3d')]('nolimit')){_0xd97190['limit']=qs[_0x1cb4('0x23')](_0x24b709[_0x1cb4('0x37')][_0x1cb4('0x23')]);_0xd97190[_0x1cb4('0x22')]=qs[_0x1cb4('0x22')](_0x24b709[_0x1cb4('0x37')]['offset']);}_0xd97190[_0x1cb4('0x3e')]=qs[_0x1cb4('0x3f')](_0x24b709[_0x1cb4('0x37')][_0x1cb4('0x3f')]);_0xd97190[_0x1cb4('0x40')]=qs[_0x1cb4('0x38')](_['pick'](_0x24b709[_0x1cb4('0x37')],_0x454546[_0x1cb4('0x38')]),_0x46a356);if(_0x24b709[_0x1cb4('0x37')][_0x1cb4('0x41')]){_0xd97190[_0x1cb4('0x40')]=_[_0x1cb4('0x42')](_0xd97190['where'],{'$or':_[_0x1cb4('0x30')](_0x46a356,function(_0xcafc83){if(_0xcafc83[_0x1cb4('0x34')]!=='VIRTUAL'){var _0x23bbbf={};_0x23bbbf[_0xcafc83['name']]={'$like':'%'+_0x24b709[_0x1cb4('0x37')][_0x1cb4('0x41')]+'%'};return _0x23bbbf;}})});}_0xd97190=_['merge']({},_0xd97190,_0x24b709['options']);var _0x565628={'where':_0xd97190[_0x1cb4('0x40')]};return db[_0x1cb4('0x31')][_0x1cb4('0x21')](_0x565628)[_0x1cb4('0x29')](function(_0x1e4616){_0xf9a444['count']=_0x1e4616;if(_0x24b709['query'][_0x1cb4('0x43')]){_0xd97190[_0x1cb4('0x44')]=[{'all':!![]}];}return db[_0x1cb4('0x31')][_0x1cb4('0x45')](_0xd97190);})[_0x1cb4('0x29')](function(_0x23c5f0){_0xf9a444[_0x1cb4('0x46')]=_0x23c5f0;return _0xf9a444;})[_0x1cb4('0x29')](respondWithFilteredResult(_0x22d82a,_0xd97190))[_0x1cb4('0x47')](handleError(_0x22d82a,null));};exports[_0x1cb4('0x48')]=function(_0x1479db,_0x5c6231){var _0x50a5ee={'raw':![],'where':{'id':_0x1479db[_0x1cb4('0x49')]['id']}},_0x3ce3a0={};_0x3ce3a0['model']=_[_0x1cb4('0x4a')](db[_0x1cb4('0x31')][_0x1cb4('0x32')]);_0x3ce3a0[_0x1cb4('0x37')]=_['keys'](_0x1479db[_0x1cb4('0x37')]);_0x3ce3a0[_0x1cb4('0x38')]=_[_0x1cb4('0x39')](_0x3ce3a0[_0x1cb4('0x36')],_0x3ce3a0['query']);_0x50a5ee[_0x1cb4('0x3b')]=_[_0x1cb4('0x39')](_0x3ce3a0['model'],qs['fields'](_0x1479db[_0x1cb4('0x37')]['fields']));_0x50a5ee['attributes']=_0x50a5ee[_0x1cb4('0x3b')][_0x1cb4('0x3c')]?_0x50a5ee[_0x1cb4('0x3b')]:_0x3ce3a0['model'];if(_0x1479db[_0x1cb4('0x37')][_0x1cb4('0x43')]){_0x50a5ee[_0x1cb4('0x44')]=[{'all':!![]}];}_0x50a5ee=_[_0x1cb4('0x42')]({},_0x50a5ee,_0x1479db[_0x1cb4('0x4b')]);return db['VoicePrefix'][_0x1cb4('0x4c')](_0x50a5ee)[_0x1cb4('0x29')](handleEntityNotFound(_0x5c6231,null))[_0x1cb4('0x29')](respondWithResult(_0x5c6231,null))[_0x1cb4('0x47')](handleError(_0x5c6231,null));};exports[_0x1cb4('0x4d')]=function(_0x5b80af,_0x284b5a){return db[_0x1cb4('0x31')][_0x1cb4('0x4c')]({'where':{'id':_0x5b80af[_0x1cb4('0x49')]['id']}})[_0x1cb4('0x29')](handleEntityNotFound(_0x284b5a,null))[_0x1cb4('0x29')](removeEntity(_0x284b5a,null))[_0x1cb4('0x47')](handleError(_0x284b5a,null));};exports[_0x1cb4('0x4e')]=function(_0x24fcb3,_0x4f0e2f){return db[_0x1cb4('0x31')]['describe']()[_0x1cb4('0x29')](respondWithResult(_0x4f0e2f,null))[_0x1cb4('0x47')](handleError(_0x4f0e2f,null));};exports[_0x1cb4('0x4f')]=function(_0x258866,_0x12573){var _0x2c1fb9;return db[_0x1cb4('0x50')]['transaction'](function(_0x2c2974){return db['VoicePrefix']['create'](_0x258866[_0x1cb4('0x51')],{'transaction':_0x2c2974})[_0x1cb4('0x29')](function(_0x65c3aa){_0x2c1fb9=_0x65c3aa[_0x1cb4('0x2a')]({'plain':!![]});return db['VoiceExtension'][_0x1cb4('0x4c')]({'where':{'id':_0x2c1fb9[_0x1cb4('0x52')]},'raw':!![]})[_0x1cb4('0x29')](function(_0x13f5ab){return createVoicePrefixExtensions(_0x2c1fb9,_0x13f5ab,_0x2c2974);});});})[_0x1cb4('0x29')](function(){var _0x441d5c=_0x258866['user'][_0x1cb4('0x2a')]({'plain':!![]});if(!_0x441d5c)throw new Error(_0x1cb4('0x53'));if(_0x441d5c[_0x1cb4('0x54')]===_0x1cb4('0x55')){var _0x17b079=_0x2c1fb9;return db[_0x1cb4('0x56')][_0x1cb4('0x4c')]({'where':{'name':_0x1cb4('0x57'),'userProfileId':_0x441d5c[_0x1cb4('0x58')]},'raw':!![]})['then'](function(_0x93f90){if(_0x93f90&&_0x93f90[_0x1cb4('0x59')]===0x0){return db[_0x1cb4('0x2b')][_0x1cb4('0x4f')]({'name':_0x17b079[_0x1cb4('0x2e')],'resourceId':_0x17b079['id'],'type':_0x93f90[_0x1cb4('0x2e')],'sectionId':_0x93f90['id']},{})['then'](function(){return _0x2c1fb9;});}else{return _0x2c1fb9;}})[_0x1cb4('0x47')](function(_0x29bace){logger[_0x1cb4('0x2c')](_0x1cb4('0x5a'),_0x29bace);throw _0x29bace;});}return _0x2c1fb9;})[_0x1cb4('0x29')](respondWithResult(_0x12573,null))[_0x1cb4('0x47')](handleError(_0x12573,null));};function Extension(_0x2bab90,_0x5eee5d,_0x3829f1,_0x46c9af){this['context']=_0x1cb4('0x5b');this['exten']=_0x2bab90;this[_0x1cb4('0x5c')]=_0x3829f1;this['type']='system';this[_0x1cb4('0x5d')]=_0x1cb4('0x5e');this[_0x1cb4('0x5f')]=_0x5eee5d;this['appdata']=_0x46c9af;}function createVoicePrefixExtensions(_0x5ae1ec,_0x421431,_0x197f9e){return new BPromise(function(_0x16c56c,_0x51aabf){var _0x4ad2a6=new Extension(formatPrefixName(_0x5ae1ec[_0x1cb4('0x60')]),0x1,_0x1cb4('0x61'),_0x1cb4('0x62'));_0x4ad2a6[_0x1cb4('0x63')]=_0x5ae1ec['id'];return db[_0x1cb4('0x64')][_0x1cb4('0x4f')](_0x4ad2a6,{'transaction':_0x197f9e})[_0x1cb4('0x29')](function(_0xb66bf6){var _0x356a1a=_0xb66bf6[_0x1cb4('0x2a')]({'plain':!![]});var _0x202ad6=_[_0x1cb4('0x30')](addVoicePrefixExtensions(_0x5ae1ec,_0x421431),function(_0xaab86e){_0xaab86e[_0x1cb4('0x52')]=_0x356a1a['id'];_0xaab86e['VoicePrefixId']=_0x5ae1ec['id'];return _0xaab86e;});return db[_0x1cb4('0x64')][_0x1cb4('0x65')](_0x202ad6,{'transaction':_0x197f9e})['then'](function(_0x3a941b){if(!_0x3a941b){return _0x51aabf(_0x1cb4('0x66'));}else{return _0x16c56c(_0x3a941b);}})[_0x1cb4('0x47')](function(_0x1f23da){return _0x51aabf(_0x1f23da);});});;});};function addVoicePrefixExtensions(_0x48abd9,_0x39bee1){var _0x285241=[];var _0x588a3d=formatPrefixName(_0x48abd9[_0x1cb4('0x60')]);_0x285241['push'](new Extension(_0x588a3d,0x2,_0x1cb4('0x67'),_0x1cb4('0x68')+_0x48abd9[_0x1cb4('0x2e')]));if(_0x48abd9[_0x1cb4('0x69')]){_0x285241['push'](new Extension(_0x588a3d,0x3,_0x1cb4('0x67'),_0x1cb4('0x6a')+_0x48abd9[_0x1cb4('0x69')]));}else{_0x285241[_0x1cb4('0x6b')](new Extension(_0x588a3d,0x3,'NoOp',_0x1cb4('0x6c')));}_0x285241[_0x1cb4('0x6b')](new Extension(_0x588a3d,0x4,_0x1cb4('0x6d'),_0x39bee1[_0x1cb4('0x6e')]+','+_0x1cb4('0x6f')+(0x8+_0x48abd9[_0x1cb4('0x2e')]['length'])+'}'+','+0x1));return _0x285241;}function formatPrefixName(_0x23adf6){var _0x4bf18c='_';for(var _0xb8fc5a=0x0;_0xb8fc5a<_0x23adf6[_0x1cb4('0x3c')];_0xb8fc5a++){if(_0x23adf6[_0x1cb4('0x70')](_0xb8fc5a)=='-'){_0x4bf18c+=_0x23adf6[_0x1cb4('0x70')](_0xb8fc5a);}else{_0x4bf18c+='['+_0x23adf6[_0x1cb4('0x70')](_0xb8fc5a)+']';}}_0x4bf18c+='.';return _0x4bf18c;}exports[_0x1cb4('0x28')]=function(_0x24e2c2,_0x4fba36,_0x5670a5){var _0x2ff709=_0x24e2c2[_0x1cb4('0x51')];_0x2ff709[_0x1cb4('0x60')]='system-'+_0x2ff709[_0x1cb4('0x2e')]+'-';return db[_0x1cb4('0x50')][_0x1cb4('0x71')](function(_0x293dd7){return db['VoicePrefix']['update'](_0x2ff709,{'where':{'id':_0x2ff709['id']},'transaction':_0x293dd7})[_0x1cb4('0x29')](function(){return db['VoiceExtension'][_0x1cb4('0x4d')]({'where':{'VoicePrefixId':_0x2ff709['id']},'transaction':_0x293dd7})[_0x1cb4('0x29')](function(){return db['VoiceExtension'][_0x1cb4('0x4c')]({'where':{'id':_0x2ff709[_0x1cb4('0x52')]},'raw':!![]})[_0x1cb4('0x29')](function(_0x1cc632){return createVoicePrefixExtensions(_0x2ff709,_0x1cc632,_0x293dd7);});});});})['then'](function(){return db['VoicePrefix'][_0x1cb4('0x72')](_0x2ff709['id']);})[_0x1cb4('0x29')](respondWithResult(_0x4fba36,null))[_0x1cb4('0x47')](handleError(_0x4fba36,null));};exports[_0x1cb4('0x73')]=function(_0x161058,_0x2572cd,_0x36e218){return db[_0x1cb4('0x31')][_0x1cb4('0x4c')]({'where':{'id':_0x161058[_0x1cb4('0x49')]['id']}})[_0x1cb4('0x29')](handleEntityNotFound(_0x2572cd,null))[_0x1cb4('0x29')](function(_0x2cd4f5){if(_0x2cd4f5){return _0x2cd4f5['addAgents'](_0x161058[_0x1cb4('0x51')]['ids'],_['omit'](_0x161058[_0x1cb4('0x51')],['ids','id'])||{})['spread'](function(_0x26eed0){for(var _0x38562a=0x0;_0x38562a<_0x161058[_0x1cb4('0x51')]['ids'][_0x1cb4('0x3c')];_0x38562a+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x161058['body'][_0x1cb4('0x74')][_0x38562a],'VoicePrefixId':_0x161058[_0x1cb4('0x49')]['id']});}return _0x26eed0;});}})[_0x1cb4('0x29')](respondWithResult(_0x2572cd,null))[_0x1cb4('0x47')](handleError(_0x2572cd,null));};exports[_0x1cb4('0x75')]=function(_0x156366,_0x55ec7f,_0x5ca2fa){return db[_0x1cb4('0x31')][_0x1cb4('0x4c')]({'where':{'id':_0x156366[_0x1cb4('0x49')]['id']}})[_0x1cb4('0x29')](handleEntityNotFound(_0x55ec7f,null))[_0x1cb4('0x29')](function(_0x4a48f7){if(_0x4a48f7){return _0x4a48f7[_0x1cb4('0x75')](_0x156366[_0x1cb4('0x37')][_0x1cb4('0x74')])[_0x1cb4('0x29')](function(){if(_['isArray'](_0x156366[_0x1cb4('0x37')][_0x1cb4('0x74')])){for(var _0x18c371=0x0;_0x18c371<_0x156366['query'][_0x1cb4('0x74')][_0x1cb4('0x3c')];_0x18c371+=0x1){socket[_0x1cb4('0x76')](_0x1cb4('0x77'),{'UserId':Number(_0x156366[_0x1cb4('0x37')][_0x1cb4('0x74')][_0x18c371]),'VoicePrefixId':Number(_0x156366['params']['id'])});}}else{socket['emit'](_0x1cb4('0x77'),{'UserId':Number(_0x156366[_0x1cb4('0x37')][_0x1cb4('0x74')]),'VoicePrefixId':Number(_0x156366[_0x1cb4('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x55ec7f,null))[_0x1cb4('0x47')](handleError(_0x55ec7f,null));};exports[_0x1cb4('0x78')]=function(_0x174f02,_0xe5827b,_0x48af58){var _0x1ce4d7={};var _0x7968f2={};var _0x18c1cc;var _0x4eca1b;return db[_0x1cb4('0x31')][_0x1cb4('0x79')]({'where':{'id':_0x174f02[_0x1cb4('0x49')]['id']}})[_0x1cb4('0x29')](handleEntityNotFound(_0xe5827b,null))[_0x1cb4('0x29')](function(_0x1e624f){if(_0x1e624f){_0x18c1cc=_0x1e624f;_0x7968f2['model']=_[_0x1cb4('0x4a')](db[_0x1cb4('0x7a')][_0x1cb4('0x32')]);_0x7968f2[_0x1cb4('0x37')]=_[_0x1cb4('0x4a')](_0x174f02[_0x1cb4('0x37')]);_0x7968f2[_0x1cb4('0x38')]=_[_0x1cb4('0x39')](_0x7968f2[_0x1cb4('0x36')],_0x7968f2[_0x1cb4('0x37')]);_0x1ce4d7[_0x1cb4('0x3b')]=_[_0x1cb4('0x39')](_0x7968f2[_0x1cb4('0x36')],qs['fields'](_0x174f02['query']['fields']));_0x1ce4d7['attributes']=_0x1ce4d7[_0x1cb4('0x3b')]['length']?_0x1ce4d7['attributes']:_0x7968f2[_0x1cb4('0x36')];_0x1ce4d7[_0x1cb4('0x3e')]=qs[_0x1cb4('0x3f')](_0x174f02[_0x1cb4('0x37')][_0x1cb4('0x3f')]);_0x1ce4d7['where']=qs['filters'](_[_0x1cb4('0x7b')](_0x174f02['query'],_0x7968f2['filters']));if(_0x174f02[_0x1cb4('0x37')][_0x1cb4('0x41')]){_0x1ce4d7[_0x1cb4('0x40')]=_[_0x1cb4('0x42')](_0x1ce4d7[_0x1cb4('0x40')],{'$or':_[_0x1cb4('0x30')](_0x1ce4d7[_0x1cb4('0x3b')],function(_0x1eb17d){var _0x4f8035={};_0x4f8035[_0x1eb17d]={'$like':'%'+_0x174f02[_0x1cb4('0x37')][_0x1cb4('0x41')]+'%'};return _0x4f8035;})});}_0x1ce4d7=_[_0x1cb4('0x42')]({},_0x1ce4d7,_0x174f02[_0x1cb4('0x4b')]);return _0x18c1cc[_0x1cb4('0x78')](_0x1ce4d7);}})['then'](function(_0x2e5d2d){if(_0x2e5d2d){_0x4eca1b=_0x2e5d2d[_0x1cb4('0x3c')];if(!_0x174f02[_0x1cb4('0x37')][_0x1cb4('0x3d')](_0x1cb4('0x7c'))){_0x1ce4d7['limit']=qs[_0x1cb4('0x23')](_0x174f02[_0x1cb4('0x37')][_0x1cb4('0x23')]);_0x1ce4d7[_0x1cb4('0x22')]=qs['offset'](_0x174f02[_0x1cb4('0x37')]['offset']);}return _0x18c1cc[_0x1cb4('0x78')](_0x1ce4d7);}})[_0x1cb4('0x29')](function(_0x31acbe){if(_0x31acbe){return _0x31acbe?{'count':_0x4eca1b,'rows':_0x31acbe}:null;}})['then'](respondWithResult(_0xe5827b,null))[_0x1cb4('0x47')](handleError(_0xe5827b,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 6e00b03..30e7dfa 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 _0xcb91=['save','update','emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners'];(function(_0x3b30bd,_0x498b10){var _0x57e24b=function(_0x2e22a4){while(--_0x2e22a4){_0x3b30bd['push'](_0x3b30bd['shift']());}};_0x57e24b(++_0x498b10);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xcb91[_0x11a220];return _0x20d8fe;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x1cb9('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){VoicePrefixEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);VoicePrefixEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];VoicePrefix[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x2a2d5b,_0x7ac3a5){var _0x503da5=function(_0x5c728e){while(--_0x5c728e){_0x2a2d5b['push'](_0x2a2d5b['shift']());}};_0x503da5(++_0x7ac3a5);}(_0x008c,0x188));var _0xc008=function(_0x28b951,_0x2825b0){_0x28b951=_0x28b951-0x0;var _0x37a82e=_0x008c[_0x28b951];return _0x37a82e;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](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 a76c975..574aef6 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 _0xb9e6=['api','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','define','util','../../config/logger'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0xb9e6,0x181));var _0x6b9e=function(_0x1f75fb,_0x4485a4){_0x1f75fb=_0x1f75fb-0x0;var _0x4e252d=_0xb9e6[_0x1f75fb];return _0x4e252d;};'use strict';var _=require('lodash');var util=require(_0x6b9e('0x0'));var logger=require(_0x6b9e('0x1'))(_0x6b9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6b9e('0x3'));var fs=require('fs');var path=require(_0x6b9e('0x4'));var rimraf=require('rimraf');var config=require(_0x6b9e('0x5'));var attributes=require(_0x6b9e('0x6'));module[_0x6b9e('0x7')]=function(_0x289d0a,_0x2d07d5){return _0x289d0a[_0x6b9e('0x8')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4027=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x5375fe,_0x176970){var _0x1b3ea1=function(_0x3f8ca5){while(--_0x3f8ca5){_0x5375fe['push'](_0x5375fe['shift']());}};_0x1b3ea1(++_0x176970);}(_0x4027,0x1ea));var _0x7402=function(_0xe706c6,_0xb1acff){_0xe706c6=_0xe706c6-0x0;var _0x583296=_0x4027[_0xe706c6];return _0x583296;};'use strict';var _=require('lodash');var util=require(_0x7402('0x0'));var logger=require(_0x7402('0x1'))(_0x7402('0x2'));var moment=require(_0x7402('0x3'));var BPromise=require(_0x7402('0x4'));var rp=require(_0x7402('0x5'));var fs=require('fs');var path=require(_0x7402('0x6'));var rimraf=require(_0x7402('0x7'));var config=require(_0x7402('0x8'));var attributes=require(_0x7402('0x9'));module[_0x7402('0xa')]=function(_0x5bb013,_0x506cd5){return _0x5bb013[_0x7402('0xb')](_0x7402('0xc'),attributes,{'tableName':_0x7402('0xd'),'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 eb7cb31..ea1fe27 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 _0xdb22=['debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x4ac0bd,_0x2e18a4){var _0x35ce80=function(_0xbb8c2){while(--_0xbb8c2){_0x4ac0bd['push'](_0x4ac0bd['shift']());}};_0x35ce80(++_0x2e18a4);}(_0xdb22,0xf8));var _0x2db2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdb22[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x2db2('0x0'));var util=require(_0x2db2('0x1'));var moment=require(_0x2db2('0x2'));var BPromise=require(_0x2db2('0x3'));var rs=require(_0x2db2('0x4'));var fs=require('fs');var Redis=require(_0x2db2('0x5'));var db=require(_0x2db2('0x6'))['db'];var utils=require(_0x2db2('0x7'));var logger=require(_0x2db2('0x8'))(_0x2db2('0x9'));var config=require('../../config/environment');var jayson=require(_0x2db2('0xa'));var client=jayson[_0x2db2('0xb')][_0x2db2('0xc')]({'port':0x232a});config['redis']=_[_0x2db2('0xd')](config['redis'],{'host':_0x2db2('0xe'),'port':0x18eb});var socket=require(_0x2db2('0xf'))(new Redis(config[_0x2db2('0x10')]));require('./voicePrefix.socket')[_0x2db2('0x11')](socket);function respondWithRpcPromise(_0x392744,_0x15ea83,_0x3eb89a){return new BPromise(function(_0x348268,_0x2cff7e){return client['request'](_0x392744,_0x3eb89a)[_0x2db2('0x12')](function(_0x11fd62){logger[_0x2db2('0x13')](_0x2db2('0x14'),_0x15ea83,_0x2db2('0x15'));logger[_0x2db2('0x16')](_0x2db2('0x17'),_0x15ea83,_0x2db2('0x15'),JSON[_0x2db2('0x18')](_0x11fd62));if(_0x11fd62[_0x2db2('0x19')]){if(_0x11fd62['error'][_0x2db2('0x1a')]===0x1f4){logger['error'](_0x2db2('0x14'),_0x15ea83,_0x11fd62['error'][_0x2db2('0x1b')]);return _0x2cff7e(_0x11fd62[_0x2db2('0x19')][_0x2db2('0x1b')]);}logger[_0x2db2('0x19')](_0x2db2('0x14'),_0x15ea83,_0x11fd62[_0x2db2('0x19')][_0x2db2('0x1b')]);return _0x348268(_0x11fd62[_0x2db2('0x19')][_0x2db2('0x1b')]);}else{logger[_0x2db2('0x13')](_0x2db2('0x14'),_0x15ea83,_0x2db2('0x15'));_0x348268(_0x11fd62[_0x2db2('0x1c')][_0x2db2('0x1b')]);}})[_0x2db2('0x1d')](function(_0x86fbee){logger[_0x2db2('0x19')](_0x2db2('0x14'),_0x15ea83,_0x86fbee);_0x2cff7e(_0x86fbee);});});} \ No newline at end of file +var _0x5ff9=['util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x571ed1,_0x1b0f17){var _0x412fae=function(_0x38103c){while(--_0x38103c){_0x571ed1['push'](_0x571ed1['shift']());}};_0x412fae(++_0x1b0f17);}(_0x5ff9,0xa0));var _0x95ff=function(_0x3eac36,_0x47a2d1){_0x3eac36=_0x3eac36-0x0;var _0x4319f6=_0x5ff9[_0x3eac36];return _0x4319f6;};'use strict';var _=require(_0x95ff('0x0'));var util=require(_0x95ff('0x1'));var moment=require('moment');var BPromise=require(_0x95ff('0x2'));var rs=require(_0x95ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95ff('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x95ff('0x5'));var jayson=require(_0x95ff('0x6'));var client=jayson['client'][_0x95ff('0x7')]({'port':0x232a});config['redis']=_[_0x95ff('0x8')](config[_0x95ff('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x95ff('0xa'))(new Redis(config['redis']));require(_0x95ff('0xb'))[_0x95ff('0xc')](socket);function respondWithRpcPromise(_0x4807b6,_0x17b39b,_0x1f3e2d){return new BPromise(function(_0x2a1750,_0x4f5bb9){return client[_0x95ff('0xd')](_0x4807b6,_0x1f3e2d)[_0x95ff('0xe')](function(_0x39d786){logger[_0x95ff('0xf')](_0x95ff('0x10'),_0x17b39b,_0x95ff('0x11'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x17b39b,_0x95ff('0x11'),JSON[_0x95ff('0x12')](_0x39d786));if(_0x39d786[_0x95ff('0x13')]){if(_0x39d786[_0x95ff('0x13')]['code']===0x1f4){logger[_0x95ff('0x13')](_0x95ff('0x10'),_0x17b39b,_0x39d786['error'][_0x95ff('0x14')]);return _0x4f5bb9(_0x39d786[_0x95ff('0x13')]['message']);}logger['error'](_0x95ff('0x10'),_0x17b39b,_0x39d786[_0x95ff('0x13')][_0x95ff('0x14')]);return _0x2a1750(_0x39d786['error'][_0x95ff('0x14')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x17b39b,_0x95ff('0x11'));_0x2a1750(_0x39d786[_0x95ff('0x15')][_0x95ff('0x14')]);}})[_0x95ff('0x16')](function(_0x5e7132){logger[_0x95ff('0x13')](_0x95ff('0x10'),_0x17b39b,_0x5e7132);_0x4f5bb9(_0x5e7132);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index bc6243e..052a6a2 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 _0xe6c1=['./voicePrefix.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2a52ae,_0x5607ed){var _0x1e6e8a=function(_0x1fc07c){while(--_0x1fc07c){_0x2a52ae['push'](_0x2a52ae['shift']());}};_0x1e6e8a(++_0x5607ed);}(_0xe6c1,0xc8));var _0x1e6c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe6c1[_0x321bb2];return _0x9c12ed;};'use strict';var VoicePrefixEvents=require(_0x1e6c('0x0'));var events=[_0x1e6c('0x1'),_0x1e6c('0x2'),_0x1e6c('0x3')];function createListener(_0x31f174,_0x367486){return function(_0x2e1f35){_0x367486[_0x1e6c('0x4')](_0x31f174,_0x2e1f35);};}function removeListener(_0x1e429a,_0xa37bd2){return function(){VoicePrefixEvents[_0x1e6c('0x5')](_0x1e429a,_0xa37bd2);};}exports[_0x1e6c('0x6')]=function(_0x1f475f){for(var _0x1ade5f=0x0,_0x1d7c3d=events[_0x1e6c('0x7')];_0x1ade5f<_0x1d7c3d;_0x1ade5f++){var _0x5cf03e=events[_0x1ade5f];var _0x5153ff=createListener('voicePrefix:'+_0x5cf03e,_0x1f475f);VoicePrefixEvents['on'](_0x5cf03e,_0x5153ff);}}; \ No newline at end of file +var _0x9e77=['./voicePrefix.events','save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x9e77,0x168));var _0x79e7=function(_0x4da271,_0x474c0e){_0x4da271=_0x4da271-0x0;var _0x2db6f6=_0x9e77[_0x4da271];return _0x2db6f6;};'use strict';var VoicePrefixEvents=require(_0x79e7('0x0'));var events=[_0x79e7('0x1'),_0x79e7('0x2'),_0x79e7('0x3')];function createListener(_0x438c62,_0x2da217){return function(_0x3633a1){_0x2da217[_0x79e7('0x4')](_0x438c62,_0x3633a1);};}function removeListener(_0x3f59c5,_0x178a52){return function(){VoicePrefixEvents[_0x79e7('0x5')](_0x3f59c5,_0x178a52);};}exports[_0x79e7('0x6')]=function(_0x4f21c9){for(var _0x2594e9=0x0,_0xe833ed=events[_0x79e7('0x7')];_0x2594e9<_0xe833ed;_0x2594e9++){var _0x598f6b=events[_0x2594e9];var _0x2e26d5=createListener(_0x79e7('0x8')+_0x598f6b,_0x4f21c9);VoicePrefixEvents['on'](_0x598f6b,_0x2e26d5);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 9113c8f..0a5e5cc 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 _0xc667=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addTeams','addAgents','addBlackLists','put','update','delete','removeAgents','removeLists','exports','multer','util','path'];(function(_0x26bff8,_0x299a35){var _0x539ba5=function(_0xf6f9e){while(--_0xf6f9e){_0x26bff8['push'](_0x26bff8['shift']());}};_0x539ba5(++_0x299a35);}(_0xc667,0xf3));var _0x7c66=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc667[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x7c66('0x0'));var util=require(_0x7c66('0x1'));var path=require(_0x7c66('0x2'));var timeout=require(_0x7c66('0x3'));var express=require(_0x7c66('0x4'));var router=express[_0x7c66('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7c66('0x6'));var config=require(_0x7c66('0x7'));var controller=require(_0x7c66('0x8'));router[_0x7c66('0x9')]('/',auth[_0x7c66('0xa')](),controller[_0x7c66('0xb')]);router[_0x7c66('0x9')](_0x7c66('0xc'),auth[_0x7c66('0xa')](),controller['show']);router['get'](_0x7c66('0xd'),auth['isAuthenticated'](),controller[_0x7c66('0xe')]);router['get'](_0x7c66('0xf'),auth['isAuthenticated'](),controller[_0x7c66('0x10')]);router[_0x7c66('0x9')](_0x7c66('0x11'),auth[_0x7c66('0xa')](),controller[_0x7c66('0x12')]);router[_0x7c66('0x9')](_0x7c66('0x13'),auth[_0x7c66('0xa')](),controller[_0x7c66('0x14')]);router[_0x7c66('0x9')](_0x7c66('0x15'),auth[_0x7c66('0xa')](),controller[_0x7c66('0x16')]);router[_0x7c66('0x9')](_0x7c66('0x17'),auth[_0x7c66('0xa')](),controller[_0x7c66('0x18')]);router[_0x7c66('0x9')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x7c66('0x19'),auth['isAuthenticated'](),controller[_0x7c66('0x1a')]);router[_0x7c66('0x9')](_0x7c66('0x1b'),auth[_0x7c66('0xa')](),controller[_0x7c66('0x1c')]);router[_0x7c66('0x1d')]('/',auth[_0x7c66('0xa')](),controller[_0x7c66('0x1e')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x7c66('0x1f')]);router['post'](_0x7c66('0x15'),auth[_0x7c66('0xa')](),controller[_0x7c66('0x20')]);router[_0x7c66('0x1d')](_0x7c66('0x17'),auth['isAuthenticated'](),controller[_0x7c66('0x21')]);router[_0x7c66('0x1d')](_0x7c66('0x19'),auth[_0x7c66('0xa')](),controller['addLists']);router['post'](_0x7c66('0x1b'),auth[_0x7c66('0xa')](),controller[_0x7c66('0x22')]);router[_0x7c66('0x23')](_0x7c66('0xc'),auth[_0x7c66('0xa')](),controller[_0x7c66('0x24')]);router['delete'](_0x7c66('0xc'),auth[_0x7c66('0xa')](),controller['destroy']);router[_0x7c66('0x25')](_0x7c66('0x15'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x7c66('0x25')](_0x7c66('0x17'),auth[_0x7c66('0xa')](),controller[_0x7c66('0x26')]);router[_0x7c66('0x25')]('/:id/lists',auth[_0x7c66('0xa')](),controller[_0x7c66('0x27')]);router[_0x7c66('0x25')]('/:id/blacklists',auth[_0x7c66('0xa')](),controller['removeBlackLists']);module[_0x7c66('0x28')]=router; \ No newline at end of file +var _0xecb7=['addBlackLists','put','/:id','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','multer','util','express','Router','../../components/auth/service','./voiceQueue.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','/:id/blacklists'];(function(_0x4951ca,_0x3146d7){var _0x3bf41e=function(_0xaa0673){while(--_0xaa0673){_0x4951ca['push'](_0x4951ca['shift']());}};_0x3bf41e(++_0x3146d7);}(_0xecb7,0x1a4));var _0x7ecb=function(_0x42a791,_0x16ab08){_0x42a791=_0x42a791-0x0;var _0x28349b=_0xecb7[_0x42a791];return _0x28349b;};'use strict';var multer=require(_0x7ecb('0x0'));var util=require(_0x7ecb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7ecb('0x2'));var router=express[_0x7ecb('0x3')]();var auth=require(_0x7ecb('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7ecb('0x5'));router[_0x7ecb('0x6')]('/',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x8')]);router[_0x7ecb('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x7ecb('0x9')]);router[_0x7ecb('0x6')](_0x7ecb('0xa'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0xb')]);router[_0x7ecb('0x6')]('/:id/hopper_histories',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0xc')]);router[_0x7ecb('0x6')]('/:id/hopper_finals',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0xd')]);router[_0x7ecb('0x6')](_0x7ecb('0xe'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0xf')]);router[_0x7ecb('0x6')](_0x7ecb('0x10'),auth[_0x7ecb('0x7')](),controller['getTeams']);router['get'](_0x7ecb('0x11'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x12')]);router[_0x7ecb('0x6')](_0x7ecb('0x13'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x14')]);router[_0x7ecb('0x6')](_0x7ecb('0x15'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x16')]);router[_0x7ecb('0x6')]('/:id/blacklists',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x17')]);router[_0x7ecb('0x18')]('/',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x19')]);router['post'](_0x7ecb('0x1a'),auth[_0x7ecb('0x7')](),controller['clone']);router[_0x7ecb('0x18')]('/:id/teams',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x1b')]);router[_0x7ecb('0x18')](_0x7ecb('0x11'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x1c')]);router['post']('/:id/lists',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x1d')]);router[_0x7ecb('0x18')](_0x7ecb('0x1e'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x1f')]);router[_0x7ecb('0x20')](_0x7ecb('0x21'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x22')]);router[_0x7ecb('0x23')](_0x7ecb('0x21'),auth['isAuthenticated'](),controller[_0x7ecb('0x24')]);router['delete'](_0x7ecb('0x10'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x25')]);router['delete'](_0x7ecb('0x11'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x26')]);router[_0x7ecb('0x23')](_0x7ecb('0x15'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x27')]);router[_0x7ecb('0x23')](_0x7ecb('0x1e'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index b2d9cc9..6902e96 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(_0x173aa0,_0x2d263c){var _0x176df9=function(_0x1b8842){while(--_0x1b8842){_0x173aa0['push'](_0x173aa0['shift']());}};_0x176df9(++_0x2d263c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x5be956,_0x33900b){var _0x3de158=function(_0x4780ee){while(--_0x4780ee){_0x5be956['push'](_0x5be956['shift']());}};_0x3de158(++_0x33900b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 6b40919..8ab297c 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 _0x028f=['CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','isNil','format','SIP/%s','emit','removeTeams','ids','select','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','all','union','compact','transaction','removeAgents','userVoiceQueue:remove','addAgents','userVoiceQueue:save','isEmpty','isArray','UserVoiceQueueRt','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','field','NOW()','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','into','removeLists','getBlackLists','addBlackLists','spread','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./voiceQueue.socket','register','sendStatus','end','json','count','offset','status','set','apply','save','then','destroy','get','QueueCampaigns','outbound','filter','value','includes','type','find','UserProfileResource','error','stack','name','index','VoiceQueue','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','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','params','omit','updatedAt','update','getHoppers','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x028f,0x1c3));var _0xf028=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x028f[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf028('0x0'));var rimraf=require(_0xf028('0x1'));var zipdir=require(_0xf028('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf028('0x3'));var moment=require(_0xf028('0x4'));var BPromise=require(_0xf028('0x5'));var Mustache=require(_0xf028('0x6'));var util=require(_0xf028('0x7'));var path=require(_0xf028('0x8'));var sox=require(_0xf028('0x9'));var csv=require('to-csv');var ejs=require(_0xf028('0xa'));var fs=require('fs');var _=require(_0xf028('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf028('0xc'));var toCsv=require(_0xf028('0xd'));var querystring=require(_0xf028('0xe'));var Papa=require(_0xf028('0xf'));var Redis=require(_0xf028('0x10'));var authService=require(_0xf028('0x11'));var qs=require(_0xf028('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf028('0x13'));var logger=require(_0xf028('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf028('0x15'));var licenseUtil=require(_0xf028('0x16'));var db=require(_0xf028('0x17'))['db'];config['redis']=_[_0xf028('0x18')](config['redis'],{'host':_0xf028('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf028('0x1a')]));require(_0xf028('0x1b'))[_0xf028('0x1c')](socket);function respondWithStatusCode(_0x5f3235,_0x18bf8d){_0x18bf8d=_0x18bf8d||0xcc;return function(_0x2100dc){if(_0x2100dc){return _0x5f3235[_0xf028('0x1d')](_0x18bf8d);}return _0x5f3235['status'](_0x18bf8d)[_0xf028('0x1e')]();};}function respondWithResult(_0x32843f,_0x368fbc){_0x368fbc=_0x368fbc||0xc8;return function(_0x2e88b9){if(_0x2e88b9){return _0x32843f['status'](_0x368fbc)[_0xf028('0x1f')](_0x2e88b9);}};}function respondWithFilteredResult(_0x2a8326,_0x566c82){return function(_0x541d6a){if(_0x541d6a){var _0x74dd0e=_0x541d6a[_0xf028('0x20')],_0x1a88ae=_0x566c82[_0xf028('0x21')],_0x39a69f=_0x566c82[_0xf028('0x21')]+_0x566c82['limit'],_0x1b16e5;if(_0x39a69f>=_0x74dd0e){_0x39a69f=_0x74dd0e;_0x1b16e5=0xc8;}else{_0x1b16e5=0xce;}_0x2a8326[_0xf028('0x22')](_0x1b16e5);return _0x2a8326[_0xf028('0x23')]('Content-Range',_0x1a88ae+'-'+_0x39a69f+'/'+_0x74dd0e)[_0xf028('0x1f')](_0x541d6a);}return null;};}function patchUpdates(_0x59a60b){return function(_0x4ccd10){try{jsonpatch[_0xf028('0x24')](_0x4ccd10,_0x59a60b,!![]);}catch(_0x4d45bc){return BPromise['reject'](_0x4d45bc);}return _0x4ccd10[_0xf028('0x25')]();};}function saveUpdates(_0x5b79fa,_0x4af9b2){return function(_0xc96ef5){if(_0xc96ef5){return _0xc96ef5['update'](_0x5b79fa)[_0xf028('0x26')](function(_0x2ccdf5){return _0x2ccdf5;});}return null;};}function removeEntity(_0x234e92,_0x3cd8a5){return function(_0x50421c){if(_0x50421c){return _0x50421c[_0xf028('0x27')]()[_0xf028('0x26')](function(){var _0x4fc293=_0x50421c[_0xf028('0x28')]({'plain':!![]});var _0x58ac79=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0xf028('0x29'),'value':_0xf028('0x2a'),'ignore':![]}];var _0x70600c=_(_0x58ac79)[_0xf028('0x2b')]('ignore')['map'](_0xf028('0x2c'))[_0xf028('0x2c')]();if(_[_0xf028('0x2d')](_0x70600c,_0x4fc293[_0xf028('0x2e')])){return;}var _0x17df16=_[_0xf028('0x2f')](_0x58ac79,[_0xf028('0x2c'),_0x4fc293[_0xf028('0x2e')]])['name'];return db[_0xf028('0x30')][_0xf028('0x27')]({'where':{'type':_0x17df16,'resourceId':_0x4fc293['id']}})[_0xf028('0x26')](function(){return _0x50421c;});})[_0xf028('0x26')](function(){_0x234e92[_0xf028('0x22')](0xcc)[_0xf028('0x1e')]();});}};}function handleEntityNotFound(_0x2c8e67,_0x887644){return function(_0x55c863){if(!_0x55c863){_0x2c8e67[_0xf028('0x1d')](0x194);}return _0x55c863;};}function handleError(_0x23260a,_0x6373bf){_0x6373bf=_0x6373bf||0x1f4;return function(_0x54d664){logger[_0xf028('0x31')](_0x54d664[_0xf028('0x32')]);if(_0x54d664[_0xf028('0x33')]){delete _0x54d664[_0xf028('0x33')];}_0x23260a[_0xf028('0x22')](_0x6373bf)['send'](_0x54d664);};}exports[_0xf028('0x34')]=function(_0x10fca4,_0x2b4de6){var _0x984a15={},_0x22d4f4={},_0x9542c5={'count':0x0,'rows':[]};var _0xeea8aa=_['map'](db[_0xf028('0x35')]['rawAttributes'],function(_0x17b860){return{'name':_0x17b860[_0xf028('0x36')],'type':_0x17b860[_0xf028('0x2e')]['key']};});_0x22d4f4[_0xf028('0x37')]=_[_0xf028('0x38')](_0xeea8aa,_0xf028('0x33'));_0x22d4f4[_0xf028('0x39')]=_[_0xf028('0x3a')](_0x10fca4[_0xf028('0x39')]);_0x22d4f4[_0xf028('0x3b')]=_[_0xf028('0x3c')](_0x22d4f4[_0xf028('0x37')],_0x22d4f4[_0xf028('0x39')]);_0x984a15[_0xf028('0x3d')]=_[_0xf028('0x3c')](_0x22d4f4[_0xf028('0x37')],qs[_0xf028('0x3e')](_0x10fca4[_0xf028('0x39')]['fields']));_0x984a15[_0xf028('0x3d')]=_0x984a15[_0xf028('0x3d')][_0xf028('0x3f')]?_0x984a15['attributes']:_0x22d4f4[_0xf028('0x37')];if(!_0x10fca4[_0xf028('0x39')][_0xf028('0x40')](_0xf028('0x41'))){_0x984a15[_0xf028('0x42')]=qs[_0xf028('0x42')](_0x10fca4[_0xf028('0x39')]['limit']);_0x984a15[_0xf028('0x21')]=qs[_0xf028('0x21')](_0x10fca4[_0xf028('0x39')][_0xf028('0x21')]);}_0x984a15[_0xf028('0x43')]=qs[_0xf028('0x44')](_0x10fca4[_0xf028('0x39')][_0xf028('0x44')]);_0x984a15[_0xf028('0x45')]=qs[_0xf028('0x3b')](_[_0xf028('0x46')](_0x10fca4[_0xf028('0x39')],_0x22d4f4['filters']),_0xeea8aa);if(_0x10fca4[_0xf028('0x39')][_0xf028('0x2b')]){_0x984a15['where']=_[_0xf028('0x47')](_0x984a15['where'],{'$or':_[_0xf028('0x38')](_0xeea8aa,function(_0x5a377d){if(_0x5a377d[_0xf028('0x2e')]!==_0xf028('0x48')){var _0x209163={};_0x209163[_0x5a377d[_0xf028('0x33')]]={'$like':'%'+_0x10fca4[_0xf028('0x39')][_0xf028('0x2b')]+'%'};return _0x209163;}})});}_0x984a15=_[_0xf028('0x47')]({},_0x984a15,_0x10fca4[_0xf028('0x49')]);var _0x1b71d2={'where':_0x984a15['where']};return db[_0xf028('0x35')]['count'](_0x1b71d2)[_0xf028('0x26')](function(_0x2cd535){_0x9542c5[_0xf028('0x20')]=_0x2cd535;if(_0x10fca4[_0xf028('0x39')][_0xf028('0x4a')]){_0x984a15['include']=[{'all':!![]}];}return db[_0xf028('0x35')][_0xf028('0x4b')](_0x984a15);})['then'](function(_0x4e2022){_0x9542c5[_0xf028('0x4c')]=_0x4e2022;return _0x9542c5;})[_0xf028('0x26')](respondWithFilteredResult(_0x2b4de6,_0x984a15))[_0xf028('0x4d')](handleError(_0x2b4de6,null));};exports[_0xf028('0x4e')]=function(_0x5d194e,_0x46ddb2){var _0x4cc3e9={'raw':![],'where':{'id':_0x5d194e['params']['id']}},_0x51ca1a={};_0x51ca1a['model']=_[_0xf028('0x3a')](db[_0xf028('0x35')][_0xf028('0x4f')]);_0x51ca1a[_0xf028('0x39')]=_[_0xf028('0x3a')](_0x5d194e[_0xf028('0x39')]);_0x51ca1a['filters']=_[_0xf028('0x3c')](_0x51ca1a[_0xf028('0x37')],_0x51ca1a[_0xf028('0x39')]);_0x4cc3e9[_0xf028('0x3d')]=_[_0xf028('0x3c')](_0x51ca1a[_0xf028('0x37')],qs[_0xf028('0x3e')](_0x5d194e[_0xf028('0x39')][_0xf028('0x3e')]));_0x4cc3e9[_0xf028('0x3d')]=_0x4cc3e9[_0xf028('0x3d')][_0xf028('0x3f')]?_0x4cc3e9[_0xf028('0x3d')]:_0x51ca1a[_0xf028('0x37')];if(_0x5d194e['query']['includeAll']){_0x4cc3e9[_0xf028('0x50')]=[{'all':!![]}];}_0x4cc3e9=_['merge']({},_0x4cc3e9,_0x5d194e[_0xf028('0x49')]);return db[_0xf028('0x35')][_0xf028('0x2f')](_0x4cc3e9)[_0xf028('0x26')](handleEntityNotFound(_0x46ddb2,null))['then'](respondWithResult(_0x46ddb2,null))[_0xf028('0x4d')](handleError(_0x46ddb2,null));};exports[_0xf028('0x51')]=function(_0x1bf89a,_0x3ff8fb){return db[_0xf028('0x35')][_0xf028('0x51')](_0x1bf89a[_0xf028('0x52')],{})[_0xf028('0x26')](function(_0x361739){var _0x26d66c=_0x1bf89a[_0xf028('0x53')]['get']({'plain':!![]});if(!_0x26d66c)throw new Error(_0xf028('0x54'));if(_0x26d66c[_0xf028('0x55')]===_0xf028('0x53')){var _0x3ffc74=_0x361739[_0xf028('0x28')]({'plain':!![]});var _0x33d069=[{'name':_0xf028('0x56'),'value':'inbound'},{'name':_0xf028('0x29'),'value':_0xf028('0x2a')}];var _0x1daefe=_[_0xf028('0x2f')](_0x33d069,[_0xf028('0x2c'),_0x3ffc74['type']])['name'];return db[_0xf028('0x57')]['find']({'where':{'name':_0x1daefe,'userProfileId':_0x26d66c[_0xf028('0x58')]},'raw':!![]})[_0xf028('0x26')](function(_0x11785d){if(_0x11785d&&_0x11785d[_0xf028('0x59')]===0x0){return db[_0xf028('0x30')][_0xf028('0x51')]({'name':_0x3ffc74[_0xf028('0x33')],'resourceId':_0x3ffc74['id'],'type':_0x11785d[_0xf028('0x33')],'sectionId':_0x11785d['id']},{})['then'](function(){return _0x361739;});}else{return _0x361739;}})[_0xf028('0x4d')](function(_0x548560){logger[_0xf028('0x31')](_0xf028('0x5a'),_0x548560);throw _0x548560;});}return _0x361739;})[_0xf028('0x26')](respondWithResult(_0x3ff8fb,0xc9))[_0xf028('0x4d')](handleError(_0x3ff8fb,null));};exports[_0xf028('0x5b')]=function(_0x432443,_0x57a8f1){var _0x4775c9={'where':{'id':_0x432443[_0xf028('0x5c')]['id']}},_0x868ada={};_0x868ada[_0xf028('0x37')]=_[_0xf028('0x3a')](db['VoiceQueue'][_0xf028('0x4f')]);_0x4775c9[_0xf028('0x3d')]=_[_0xf028('0x3c')](_0x868ada[_0xf028('0x37')],qs[_0xf028('0x3e')](_0x432443[_0xf028('0x39')][_0xf028('0x3e')]));_0x4775c9[_0xf028('0x3d')]=_0x4775c9[_0xf028('0x3d')][_0xf028('0x3f')]?_0x4775c9['attributes']:_0x868ada[_0xf028('0x37')];if(_0x432443[_0xf028('0x39')][_0xf028('0x4a')]){_0x4775c9[_0xf028('0x50')]=[{'all':!![]}];}_0x4775c9=_[_0xf028('0x47')]({},_0x4775c9,_0x432443[_0xf028('0x49')]);return db['VoiceQueue'][_0xf028('0x2f')](_0x4775c9)['then'](handleEntityNotFound(_0x57a8f1,null))['then'](function(_0x4f0722){if(_0x4f0722){var _0x3663aa=_0x4f0722[_0xf028('0x28')]({'plain':!![]});_0x3663aa=qs[_0xf028('0x5d')](_0x3663aa,['id','createdAt',_0xf028('0x5e')]);_0x432443[_0xf028('0x52')]=_['omit'](_0x432443[_0xf028('0x52')],['id','createdAt',_0xf028('0x5e')]);return db[_0xf028('0x35')][_0xf028('0x51')](_[_0xf028('0x47')](_0x3663aa,_0x432443[_0xf028('0x52')]),{'include':_0x432443['query']['includeAll']?[{'all':!![]}]:undefined})[_0xf028('0x26')](function(_0x31a819){var _0x3303d9=_0x432443[_0xf028('0x53')][_0xf028('0x28')]({'plain':!![]});if(!_0x3303d9)throw new Error(_0xf028('0x54'));if(_0x3303d9['role']===_0xf028('0x53')){var _0x5d7242=_0x31a819[_0xf028('0x28')]({'plain':!![]});var _0x184bf4=[{'name':_0xf028('0x56'),'value':'inbound'},{'name':_0xf028('0x29'),'value':_0xf028('0x2a')}];var _0x3ca649=_[_0xf028('0x2f')](_0x184bf4,[_0xf028('0x2c'),_0x5d7242['type']])[_0xf028('0x33')];return db[_0xf028('0x57')]['find']({'where':{'name':_0x3ca649,'userProfileId':_0x3303d9[_0xf028('0x58')]},'raw':!![]})['then'](function(_0x34075c){if(_0x34075c&&_0x34075c[_0xf028('0x59')]===0x0){return db[_0xf028('0x30')][_0xf028('0x51')]({'name':_0x5d7242[_0xf028('0x33')],'resourceId':_0x5d7242['id'],'type':_0x34075c[_0xf028('0x33')],'sectionId':_0x34075c['id']},{})[_0xf028('0x26')](function(){return _0x31a819;});}else{return _0x31a819;}})['catch'](function(_0x2da20c){logger[_0xf028('0x31')](_0xf028('0x5a'),_0x2da20c);throw _0x2da20c;});}return _0x31a819;});}})[_0xf028('0x26')](respondWithResult(_0x57a8f1,0xc9))[_0xf028('0x4d')](handleError(_0x57a8f1,null));};exports[_0xf028('0x5f')]=function(_0x3e766c,_0x3cad48){if(_0x3e766c[_0xf028('0x52')]['id']){delete _0x3e766c[_0xf028('0x52')]['id'];}return db[_0xf028('0x35')][_0xf028('0x2f')]({'where':{'id':_0x3e766c[_0xf028('0x5c')]['id']}})[_0xf028('0x26')](handleEntityNotFound(_0x3cad48,null))['then'](saveUpdates(_0x3e766c[_0xf028('0x52')],null))[_0xf028('0x26')](respondWithResult(_0x3cad48,null))[_0xf028('0x4d')](handleError(_0x3cad48,null));};exports[_0xf028('0x27')]=function(_0x4b0cfc,_0x2c17b0){return db['VoiceQueue'][_0xf028('0x2f')]({'where':{'id':_0x4b0cfc[_0xf028('0x5c')]['id']}})[_0xf028('0x26')](handleEntityNotFound(_0x2c17b0,null))[_0xf028('0x26')](removeEntity(_0x2c17b0,null))[_0xf028('0x4d')](handleError(_0x2c17b0,null));};exports[_0xf028('0x60')]=function(_0x248e3e,_0x1eb991,_0xe519dc){var _0x17e7ad={'raw':![],'where':{}};var _0x34d121={};var _0x414fc4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xf028('0x61')]({'where':{'id':_0x248e3e[_0xf028('0x5c')]['id']}})[_0xf028('0x26')](handleEntityNotFound(_0x1eb991,null))[_0xf028('0x26')](function(_0x4a5078){if(_0x4a5078){_0x34d121[_0xf028('0x37')]=_[_0xf028('0x3a')](db[_0xf028('0x62')][_0xf028('0x4f')]);_0x34d121[_0xf028('0x39')]=_[_0xf028('0x3a')](_0x248e3e[_0xf028('0x39')]);_0x34d121[_0xf028('0x3b')]=_[_0xf028('0x3c')](_0x34d121[_0xf028('0x37')],_0x34d121[_0xf028('0x39')]);_0x17e7ad[_0xf028('0x3d')]=_[_0xf028('0x3c')](_0x34d121[_0xf028('0x37')],qs[_0xf028('0x3e')](_0x248e3e[_0xf028('0x39')][_0xf028('0x3e')]));_0x17e7ad[_0xf028('0x3d')]=_0x17e7ad['attributes'][_0xf028('0x3f')]?_0x17e7ad[_0xf028('0x3d')]:_0x34d121['model'];if(!_0x248e3e['query'][_0xf028('0x40')](_0xf028('0x41'))){_0x17e7ad[_0xf028('0x42')]=qs['limit'](_0x248e3e[_0xf028('0x39')][_0xf028('0x42')]);_0x17e7ad[_0xf028('0x21')]=qs[_0xf028('0x21')](_0x248e3e[_0xf028('0x39')][_0xf028('0x21')]);}_0x17e7ad[_0xf028('0x43')]=qs[_0xf028('0x44')](_0x248e3e[_0xf028('0x39')][_0xf028('0x44')]);_0x17e7ad[_0xf028('0x45')]=qs['filters'](_[_0xf028('0x46')](_0x248e3e[_0xf028('0x39')],_0x34d121[_0xf028('0x3b')]));_0x17e7ad['where'][_0xf028('0x63')]=_0x4a5078['id'];if(_0x248e3e[_0xf028('0x39')]['filter']){_0x17e7ad[_0xf028('0x45')]=_[_0xf028('0x47')](_0x17e7ad[_0xf028('0x45')],{'$or':_[_0xf028('0x38')](_0x17e7ad[_0xf028('0x3d')],function(_0x1f2001){var _0x1ccd32={};_0x1ccd32[_0x1f2001]={'$like':'%'+_0x248e3e[_0xf028('0x39')][_0xf028('0x2b')]+'%'};return _0x1ccd32;})});}_0x17e7ad=_['merge']({},_0x17e7ad,_0x248e3e['options']);return db[_0xf028('0x62')][_0xf028('0x20')]({'where':_0x17e7ad[_0xf028('0x45')]})[_0xf028('0x26')](function(_0x30447d){_0x414fc4[_0xf028('0x20')]=_0x30447d;if(_0x248e3e['query']['includeAll']){_0x17e7ad[_0xf028('0x50')]=[{'all':!![]}];}return db[_0xf028('0x62')][_0xf028('0x4b')](_0x17e7ad);})[_0xf028('0x26')](function(_0x3a7fb3){_0x414fc4[_0xf028('0x4c')]=_0x3a7fb3;return _0x414fc4;});}})[_0xf028('0x26')](respondWithFilteredResult(_0x1eb991,_0x17e7ad))[_0xf028('0x4d')](handleError(_0x1eb991,null));};exports[_0xf028('0x64')]=function(_0x3e92d3,_0x179ff5,_0x495c70){var _0x22283f={'raw':!![],'where':{}};var _0x3bf4f4={};var _0x52b351={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xf028('0x61')]({'where':{'id':_0x3e92d3['params']['id']}})[_0xf028('0x26')](handleEntityNotFound(_0x179ff5,null))[_0xf028('0x26')](function(_0x4bd9a3){if(_0x4bd9a3){_0x3bf4f4['model']=_[_0xf028('0x3a')](db[_0xf028('0x65')][_0xf028('0x4f')]);_0x3bf4f4[_0xf028('0x39')]=_[_0xf028('0x3a')](_0x3e92d3['query']);_0x3bf4f4[_0xf028('0x3b')]=_[_0xf028('0x3c')](_0x3bf4f4[_0xf028('0x37')],_0x3bf4f4[_0xf028('0x39')]);_0x22283f[_0xf028('0x3d')]=_['intersection'](_0x3bf4f4['model'],qs[_0xf028('0x3e')](_0x3e92d3[_0xf028('0x39')]['fields']));_0x22283f['attributes']=_0x22283f[_0xf028('0x3d')][_0xf028('0x3f')]?_0x22283f[_0xf028('0x3d')]:_0x3bf4f4[_0xf028('0x37')];if(!_0x3e92d3[_0xf028('0x39')][_0xf028('0x40')](_0xf028('0x41'))){_0x22283f[_0xf028('0x42')]=qs[_0xf028('0x42')](_0x3e92d3[_0xf028('0x39')][_0xf028('0x42')]);_0x22283f[_0xf028('0x21')]=qs[_0xf028('0x21')](_0x3e92d3[_0xf028('0x39')]['offset']);}_0x22283f[_0xf028('0x43')]=qs[_0xf028('0x44')](_0x3e92d3[_0xf028('0x39')][_0xf028('0x44')]);_0x22283f[_0xf028('0x45')]=qs[_0xf028('0x3b')](_[_0xf028('0x46')](_0x3e92d3[_0xf028('0x39')],_0x3bf4f4[_0xf028('0x3b')]));_0x22283f[_0xf028('0x45')][_0xf028('0x63')]=_0x4bd9a3['id'];if(_0x3e92d3['query'][_0xf028('0x2b')]){_0x22283f[_0xf028('0x45')]=_['merge'](_0x22283f[_0xf028('0x45')],{'$or':_['map'](_0x22283f['attributes'],function(_0x10baf5){var _0x23f05b={};_0x23f05b[_0x10baf5]={'$like':'%'+_0x3e92d3[_0xf028('0x39')]['filter']+'%'};return _0x23f05b;})});}_0x22283f=_[_0xf028('0x47')]({},_0x22283f,_0x3e92d3[_0xf028('0x49')]);return db['CmHopperHistory'][_0xf028('0x20')]({'where':_0x22283f[_0xf028('0x45')]})[_0xf028('0x26')](function(_0x211f29){_0x52b351['count']=_0x211f29;if(_0x3e92d3['query']['includeAll']){_0x22283f[_0xf028('0x50')]=[{'all':!![]}];}return db[_0xf028('0x65')][_0xf028('0x4b')](_0x22283f);})[_0xf028('0x26')](function(_0x7698d4){_0x52b351[_0xf028('0x4c')]=_0x7698d4;return _0x52b351;});}})[_0xf028('0x26')](respondWithFilteredResult(_0x179ff5,_0x22283f))[_0xf028('0x4d')](handleError(_0x179ff5,null));};exports[_0xf028('0x66')]=function(_0xfdf507,_0x4d7067,_0x46add5){var _0x17ca28={'raw':!![],'where':{}};var _0x30c683={};var _0x3834e1={'count':0x0,'rows':[]};return db[_0xf028('0x35')][_0xf028('0x61')]({'where':{'id':_0xfdf507['params']['id']}})[_0xf028('0x26')](handleEntityNotFound(_0x4d7067,null))[_0xf028('0x26')](function(_0x140b2c){if(_0x140b2c){_0x30c683[_0xf028('0x37')]=_[_0xf028('0x3a')](db[_0xf028('0x67')][_0xf028('0x4f')]);_0x30c683['query']=_[_0xf028('0x3a')](_0xfdf507[_0xf028('0x39')]);_0x30c683[_0xf028('0x3b')]=_['intersection'](_0x30c683[_0xf028('0x37')],_0x30c683['query']);_0x17ca28[_0xf028('0x3d')]=_[_0xf028('0x3c')](_0x30c683[_0xf028('0x37')],qs['fields'](_0xfdf507[_0xf028('0x39')]['fields']));_0x17ca28[_0xf028('0x3d')]=_0x17ca28['attributes'][_0xf028('0x3f')]?_0x17ca28['attributes']:_0x30c683['model'];if(!_0xfdf507[_0xf028('0x39')][_0xf028('0x40')]('nolimit')){_0x17ca28[_0xf028('0x42')]=qs[_0xf028('0x42')](_0xfdf507['query']['limit']);_0x17ca28['offset']=qs[_0xf028('0x21')](_0xfdf507[_0xf028('0x39')][_0xf028('0x21')]);}_0x17ca28[_0xf028('0x43')]=qs[_0xf028('0x44')](_0xfdf507[_0xf028('0x39')][_0xf028('0x44')]);_0x17ca28[_0xf028('0x45')]=qs['filters'](_[_0xf028('0x46')](_0xfdf507['query'],_0x30c683[_0xf028('0x3b')]));_0x17ca28[_0xf028('0x45')][_0xf028('0x63')]=_0x140b2c['id'];if(_0xfdf507[_0xf028('0x39')][_0xf028('0x2b')]){_0x17ca28[_0xf028('0x45')]=_[_0xf028('0x47')](_0x17ca28[_0xf028('0x45')],{'$or':_[_0xf028('0x38')](_0x17ca28[_0xf028('0x3d')],function(_0x2195b6){var _0x303003={};_0x303003[_0x2195b6]={'$like':'%'+_0xfdf507[_0xf028('0x39')][_0xf028('0x2b')]+'%'};return _0x303003;})});}_0x17ca28=_[_0xf028('0x47')]({},_0x17ca28,_0xfdf507[_0xf028('0x49')]);return db[_0xf028('0x67')][_0xf028('0x20')]({'where':_0x17ca28[_0xf028('0x45')]})[_0xf028('0x26')](function(_0x53c35e){_0x3834e1['count']=_0x53c35e;if(_0xfdf507[_0xf028('0x39')]['includeAll']){_0x17ca28[_0xf028('0x50')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xf028('0x4b')](_0x17ca28);})[_0xf028('0x26')](function(_0x19131){_0x3834e1[_0xf028('0x4c')]=_0x19131;return _0x3834e1;});}})[_0xf028('0x26')](respondWithFilteredResult(_0x4d7067,_0x17ca28))[_0xf028('0x4d')](handleError(_0x4d7067,null));};exports[_0xf028('0x68')]=function(_0x15b809,_0x16787b,_0x40ab15){var _0x37d62b={'raw':!![],'where':{}};var _0x252ae0={};var _0x56b140={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xf028('0x61')]({'where':{'id':_0x15b809[_0xf028('0x5c')]['id']}})['then'](handleEntityNotFound(_0x16787b,null))[_0xf028('0x26')](function(_0x236abb){if(_0x236abb){_0x252ae0[_0xf028('0x37')]=_[_0xf028('0x3a')](db[_0xf028('0x69')][_0xf028('0x4f')]);_0x252ae0[_0xf028('0x39')]=_[_0xf028('0x3a')](_0x15b809[_0xf028('0x39')]);_0x252ae0[_0xf028('0x3b')]=_[_0xf028('0x3c')](_0x252ae0['model'],_0x252ae0[_0xf028('0x39')]);_0x37d62b['attributes']=_[_0xf028('0x3c')](_0x252ae0[_0xf028('0x37')],qs[_0xf028('0x3e')](_0x15b809[_0xf028('0x39')][_0xf028('0x3e')]));_0x37d62b[_0xf028('0x3d')]=_0x37d62b[_0xf028('0x3d')][_0xf028('0x3f')]?_0x37d62b[_0xf028('0x3d')]:_0x252ae0[_0xf028('0x37')];if(!_0x15b809['query'][_0xf028('0x40')](_0xf028('0x41'))){_0x37d62b[_0xf028('0x42')]=qs[_0xf028('0x42')](_0x15b809['query'][_0xf028('0x42')]);_0x37d62b[_0xf028('0x21')]=qs[_0xf028('0x21')](_0x15b809[_0xf028('0x39')][_0xf028('0x21')]);}_0x37d62b[_0xf028('0x43')]=qs[_0xf028('0x44')](_0x15b809[_0xf028('0x39')][_0xf028('0x44')]);_0x37d62b['where']=qs['filters'](_[_0xf028('0x46')](_0x15b809['query'],_0x252ae0['filters']));_0x37d62b[_0xf028('0x45')][_0xf028('0x63')]=_0x236abb['id'];if(_0x15b809['query'][_0xf028('0x2b')]){_0x37d62b[_0xf028('0x45')]=_[_0xf028('0x47')](_0x37d62b['where'],{'$or':_[_0xf028('0x38')](_0x37d62b[_0xf028('0x3d')],function(_0x19b837){var _0x4dc666={};_0x4dc666[_0x19b837]={'$like':'%'+_0x15b809['query']['filter']+'%'};return _0x4dc666;})});}_0x37d62b=_[_0xf028('0x47')]({},_0x37d62b,_0x15b809[_0xf028('0x49')]);return db[_0xf028('0x69')][_0xf028('0x20')]({'where':_0x37d62b['where']})['then'](function(_0x240e2f){_0x56b140['count']=_0x240e2f;if(_0x15b809[_0xf028('0x39')][_0xf028('0x4a')]){_0x37d62b[_0xf028('0x50')]=[{'all':!![]}];}return db[_0xf028('0x69')][_0xf028('0x4b')](_0x37d62b);})[_0xf028('0x26')](function(_0x23df66){_0x56b140[_0xf028('0x4c')]=_0x23df66;return _0x56b140;});}})['then'](respondWithFilteredResult(_0x16787b,_0x37d62b))['catch'](handleError(_0x16787b,null));};exports[_0xf028('0x6a')]=function(_0x55f74d,_0x261034,_0x21dbf7){var _0x590a91={};var _0x15d2c8={};var _0x3296f3;var _0x28c8e3;return db[_0xf028('0x35')][_0xf028('0x61')]({'where':{'id':_0x55f74d[_0xf028('0x5c')]['id']}})[_0xf028('0x26')](handleEntityNotFound(_0x261034,null))[_0xf028('0x26')](function(_0x3ed449){if(_0x3ed449){_0x3296f3=_0x3ed449;_0x15d2c8[_0xf028('0x37')]=_[_0xf028('0x3a')](db[_0xf028('0x6b')][_0xf028('0x4f')]);_0x15d2c8[_0xf028('0x39')]=_[_0xf028('0x3a')](_0x55f74d['query']);_0x15d2c8['filters']=_[_0xf028('0x3c')](_0x15d2c8[_0xf028('0x37')],_0x15d2c8[_0xf028('0x39')]);_0x590a91[_0xf028('0x3d')]=_[_0xf028('0x3c')](_0x15d2c8[_0xf028('0x37')],qs[_0xf028('0x3e')](_0x55f74d['query'][_0xf028('0x3e')]));_0x590a91[_0xf028('0x3d')]=_0x590a91[_0xf028('0x3d')][_0xf028('0x3f')]?_0x590a91[_0xf028('0x3d')]:_0x15d2c8[_0xf028('0x37')];_0x590a91[_0xf028('0x43')]=qs[_0xf028('0x44')](_0x55f74d[_0xf028('0x39')][_0xf028('0x44')]);_0x590a91[_0xf028('0x45')]=qs[_0xf028('0x3b')](_[_0xf028('0x46')](_0x55f74d[_0xf028('0x39')],_0x15d2c8[_0xf028('0x3b')]));if(_0x55f74d['query']['filter']){_0x590a91['where']=_[_0xf028('0x47')](_0x590a91[_0xf028('0x45')],{'$or':_[_0xf028('0x38')](_0x590a91['attributes'],function(_0x424be3){var _0xef0841={};_0xef0841[_0x424be3]={'$like':'%'+_0x55f74d['query'][_0xf028('0x2b')]+'%'};return _0xef0841;})});}_0x590a91=_[_0xf028('0x47')]({},_0x590a91,_0x55f74d[_0xf028('0x49')]);return _0x3296f3['getTeams'](_0x590a91);}})[_0xf028('0x26')](function(_0x1fa849){if(_0x1fa849){_0x28c8e3=_0x1fa849[_0xf028('0x3f')];if(!_0x55f74d[_0xf028('0x39')][_0xf028('0x40')]('nolimit')){_0x590a91[_0xf028('0x42')]=qs[_0xf028('0x42')](_0x55f74d['query'][_0xf028('0x42')]);_0x590a91['offset']=qs[_0xf028('0x21')](_0x55f74d['query'][_0xf028('0x21')]);}return _0x3296f3[_0xf028('0x6a')](_0x590a91);}})[_0xf028('0x26')](function(_0x1c7020){if(_0x1c7020){return _0x1c7020?{'count':_0x28c8e3,'rows':_0x1c7020}:null;}})[_0xf028('0x26')](respondWithResult(_0x261034,null))[_0xf028('0x4d')](handleError(_0x261034,null));};exports[_0xf028('0x6c')]=function(_0x473985,_0x1de097,_0x5ed146){var _0x4a1582=_0x473985[_0xf028('0x52')][_0xf028('0x6d')];var _0x22de1b=_['map'](_0x4a1582,'id');return db[_0xf028('0x6b')][_0xf028('0x4b')]({'where':{'id':_0x22de1b},'attributes':['id'],'include':[{'model':db[_0xf028('0x6e')],'as':_0xf028('0x6f'),'attributes':['id',_0xf028('0x33'),_0xf028('0x70'),_0xf028('0x71'),_0xf028('0x72')],'raw':!![]}]})[_0xf028('0x26')](function(_0x436ede){if(_0x436ede){var _0x469071=_['flatMap'](_0x436ede,function(_0x4557bf){var _0x26dcb6=_0x4557bf['get']({'plain':!![]});_0x26dcb6['Agents'][_0xf028('0x73')](function(_0x4864c3){_0x4864c3[_0xf028('0x74')]=_[_0xf028('0x2f')](_0x4a1582,{'id':_0x26dcb6['id']})['penalty'];});return _0x26dcb6[_0xf028('0x6f')];});return db[_0xf028('0x35')]['find']({'where':{'id':_0x473985[_0xf028('0x5c')]['id']}})[_0xf028('0x26')](function(_0x53876c){return db['sequelize']['transaction'](function(_0x4c9d7b){return _0x53876c[_0xf028('0x6c')](_0x22de1b,{'transaction':_0x4c9d7b})[_0xf028('0x26')](function(){return BPromise[_0xf028('0x75')](_0x4a1582,function(_0x4ca936){return db[_0xf028('0x76')][_0xf028('0x77')]({'TeamId':_0x4ca936['id'],'VoiceQueueId':_0x473985[_0xf028('0x5c')]['id'],'penalty':_0x4ca936[_0xf028('0x74')]},{'transaction':_0x4c9d7b});});})[_0xf028('0x26')](function(){return BPromise[_0xf028('0x75')](_0x469071,function(_0xdf313c){return db[_0xf028('0x78')][_0xf028('0x79')]({'where':{'UserId':_0xdf313c['id'],'VoiceQueueId':_0x473985[_0xf028('0x5c')]['id']},'defaults':{'penalty':_0xdf313c[_0xf028('0x74')]},'transaction':_0x4c9d7b});});})[_0xf028('0x26')](function(){return BPromise[_0xf028('0x75')](_[_0xf028('0x2b')](_0x469071,{'online':!![]}),function(_0x4ae215){return db['UserVoiceQueueRt'][_0xf028('0x77')]({'membername':_0x4ae215[_0xf028('0x33')],'UserId':_0x4ae215['id'],'queue_name':_0x53876c[_0xf028('0x33')],'VoiceQueueId':_0x53876c['id'],'interface':_[_0xf028('0x7a')](_0x4ae215[_0xf028('0x72')])?util[_0xf028('0x7b')](_0xf028('0x7c'),_0x4ae215[_0xf028('0x33')]):_0x4ae215['interface'],'paused':_0x4ae215[_0xf028('0x71')]||![],'penalty':_0x4ae215[_0xf028('0x74')]},{'transaction':_0x4c9d7b});});})['then'](function(){_0x469071['forEach'](function(_0x17869d){socket[_0xf028('0x7d')]('userVoiceQueue:save',{'UserId':_0x17869d['id'],'VoiceQueueId':_0x53876c['id']});});});});});}})[_0xf028('0x26')](respondWithStatusCode(_0x1de097,null))[_0xf028('0x4d')](handleError(_0x1de097,null));};exports[_0xf028('0x7e')]=function(_0x293708,_0x2a8869,_0x326f04){return db[_0xf028('0x6b')][_0xf028('0x4b')]({'where':{'id':_0x293708[_0xf028('0x39')][_0xf028('0x7f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf028('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xf028('0x26')](handleEntityNotFound(_0x2a8869,null))['then'](function(_0x49fffb){var _0x3c70fc=_[_0xf028('0x38')](_0x49fffb,'id');var _0x2baebd=[];var _0x39667b=[];var _0x3848e8=squel[_0xf028('0x80')]();_0x3848e8['field'](_0xf028('0x81'))[_0xf028('0x82')](_0xf028('0x83'),'tq')[_0xf028('0x84')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xf028('0x85'),_0x293708[_0xf028('0x5c')]['id']);for(var _0x3624f8=0x0;_0x3624f8<_0x49fffb[_0xf028('0x3f')];_0x3624f8+=0x1){let _0x338e10=_0x49fffb[_0x3624f8];for(var _0x5acd20=0x0;_0x5acd20<_0x338e10[_0xf028('0x6f')][_0xf028('0x3f')];_0x5acd20+=0x1){let _0x5c34e9=_0x338e10[_0xf028('0x6f')][_0x5acd20];var _0x5ed3a8=_0x3848e8[_0xf028('0x5b')]();_0x5ed3a8[_0xf028('0x45')](_0xf028('0x86'),_0x5c34e9['id']);_0x39667b[_0xf028('0x87')](db[_0xf028('0x88')][_0xf028('0x39')](_0x5ed3a8['toString'](),{'type':db[_0xf028('0x88')][_0xf028('0x89')][_0xf028('0x8a')]})['then'](function(_0x2e5cc0){if(_0x2e5cc0[_0xf028('0x3f')]===0x1){return _0x5c34e9['id'];}else{var _0x251fbf=_['every'](_[_0xf028('0x38')](_0x2e5cc0,'TeamId'),function(_0x36381d){return _['includes'](_0x3c70fc,_0x36381d);});if(_0x251fbf){return _0x5c34e9['id'];}}}));}}return BPromise[_0xf028('0x8b')](_0x39667b)[_0xf028('0x26')](function(_0x1402ec){_0x2baebd=_(_0x2baebd)[_0xf028('0x8c')](_0x1402ec)[_0xf028('0x8d')]()['value']();return db['VoiceQueue'][_0xf028('0x2f')]({'where':{'id':_0x293708[_0xf028('0x5c')]['id']}})[_0xf028('0x26')](function(_0x5ebb2e){return db[_0xf028('0x88')][_0xf028('0x8e')](function(_0x10ab57){return _0x5ebb2e['removeTeams'](_0x293708[_0xf028('0x39')][_0xf028('0x7f')],{'transaction':_0x10ab57})[_0xf028('0x26')](function(){if(!_['isEmpty'](_0x2baebd)){return _0x5ebb2e[_0xf028('0x8f')](_0x2baebd,{'transaction':_0x10ab57})[_0xf028('0x26')](function(){return db['UserVoiceQueueRt'][_0xf028('0x27')]({'where':{'VoiceQueueId':_0x293708[_0xf028('0x5c')]['id'],'UserId':_0x2baebd},'transaction':_0x10ab57});});}})['then'](function(){_0x2baebd[_0xf028('0x73')](function(_0x59a4a9){socket[_0xf028('0x7d')](_0xf028('0x90'),{'UserId':_0x59a4a9,'VoiceQueueId':_0x5ebb2e['id']});});});});});});})['then'](respondWithStatusCode(_0x2a8869,null))['catch'](handleError(_0x2a8869,null));};exports[_0xf028('0x91')]=function(_0x56702c,_0x5890f8,_0x3cbaf5){var _0x2816c9,_0x2e7013;return db[_0xf028('0x35')]['find']({'where':{'id':_0x56702c[_0xf028('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5890f8,null))[_0xf028('0x26')](function(_0x590cec){if(_0x590cec){_0x2e7013=_0x590cec;return _0x590cec[_0xf028('0x91')](_0x56702c[_0xf028('0x52')]['ids'],_['omit'](_0x56702c['body'],['ids','id'])||{})['spread'](function(_0x5937b3){for(var _0x536899=0x0;_0x536899<_0x56702c[_0xf028('0x52')][_0xf028('0x7f')][_0xf028('0x3f')];_0x536899+=0x1){socket[_0xf028('0x7d')](_0xf028('0x92'),{'UserId':_0x56702c[_0xf028('0x52')][_0xf028('0x7f')][_0x536899],'VoiceQueueId':_0x56702c['params']['id']});}return _0x5937b3;});}})[_0xf028('0x26')](function(_0xc9581c){_0x2816c9=_0xc9581c||[];if(_0x2e7013){return db['User'][_0xf028('0x4b')]({'where':{'id':_0x56702c[_0xf028('0x52')][_0xf028('0x7f')]},'attributes':['id',_0xf028('0x33'),'online',_0xf028('0x71'),'interface'],'raw':!![]});}})['then'](function(_0x1aba12){if(!_[_0xf028('0x93')](_0x1aba12)){var _0x40bf59=[];for(var _0x4a4dc9=0x0;_0x4a4dc9<_0x1aba12[_0xf028('0x3f')];_0x4a4dc9++){if(_0x1aba12[_0x4a4dc9][_0xf028('0x70')]){_0x40bf59[_0xf028('0x87')](db['UserVoiceQueueRt'][_0xf028('0x77')]({'membername':_0x1aba12[_0x4a4dc9]['name'],'UserId':_0x1aba12[_0x4a4dc9]['id'],'queue_name':_0x2e7013[_0xf028('0x33')],'VoiceQueueId':_0x2e7013['id'],'interface':_[_0xf028('0x7a')](_0x1aba12[_0x4a4dc9][_0xf028('0x72')])?util[_0xf028('0x7b')](_0xf028('0x7c'),_0x1aba12[_0x4a4dc9][_0xf028('0x33')]):_0x1aba12[_0x4a4dc9]['interface'],'paused':_0x1aba12[_0x4a4dc9]['voicePause']||![],'penalty':_0x56702c[_0xf028('0x52')]['penalty']||0x0}));}}return BPromise[_0xf028('0x8b')](_0x40bf59);}})[_0xf028('0x26')](function(){return _0x2816c9;})[_0xf028('0x26')](respondWithResult(_0x5890f8,null))[_0xf028('0x4d')](handleError(_0x5890f8,null));};exports['removeAgents']=function(_0xe81b6,_0x30ee68,_0x3264b8){return db[_0xf028('0x35')][_0xf028('0x2f')]({'where':{'id':_0xe81b6[_0xf028('0x5c')]['id']}})[_0xf028('0x26')](handleEntityNotFound(_0x30ee68,null))[_0xf028('0x26')](function(_0x1fef2a){if(_0x1fef2a){return _0x1fef2a['removeAgents'](_0xe81b6[_0xf028('0x39')][_0xf028('0x7f')])[_0xf028('0x26')](function(){if(_[_0xf028('0x94')](_0xe81b6[_0xf028('0x39')]['ids'])){for(var _0x689c69=0x0;_0x689c69<_0xe81b6[_0xf028('0x39')]['ids'][_0xf028('0x3f')];_0x689c69+=0x1){socket[_0xf028('0x7d')]('userVoiceQueue:remove',{'UserId':Number(_0xe81b6[_0xf028('0x39')][_0xf028('0x7f')][_0x689c69]),'VoiceQueueId':Number(_0xe81b6[_0xf028('0x5c')]['id'])});}}else{socket[_0xf028('0x7d')](_0xf028('0x90'),{'UserId':Number(_0xe81b6[_0xf028('0x39')][_0xf028('0x7f')]),'VoiceQueueId':Number(_0xe81b6[_0xf028('0x5c')]['id'])});}});}})[_0xf028('0x26')](function(_0x43adbb){return db[_0xf028('0x95')][_0xf028('0x27')]({'where':{'VoiceQueueId':_0xe81b6[_0xf028('0x5c')]['id'],'UserId':_0xe81b6[_0xf028('0x39')]['ids']}})[_0xf028('0x26')](function(){return _0x43adbb;});})[_0xf028('0x26')](respondWithStatusCode(_0x30ee68,null))[_0xf028('0x4d')](handleError(_0x30ee68,null));};exports[_0xf028('0x96')]=function(_0x1d0fd1,_0xc569c8,_0x1b05ac){var _0x3c27c1={};var _0x27f0f5={};var _0x2081eb;var _0xcfa75e;return db[_0xf028('0x35')][_0xf028('0x61')]({'where':{'id':_0x1d0fd1[_0xf028('0x5c')]['id']}})[_0xf028('0x26')](handleEntityNotFound(_0xc569c8,null))[_0xf028('0x26')](function(_0x2da756){if(_0x2da756){_0x2081eb=_0x2da756;_0x27f0f5[_0xf028('0x37')]=_[_0xf028('0x3a')](db['User'][_0xf028('0x4f')]);_0x27f0f5[_0xf028('0x39')]=_[_0xf028('0x3a')](_0x1d0fd1[_0xf028('0x39')]);_0x27f0f5[_0xf028('0x3b')]=_[_0xf028('0x3c')](_0x27f0f5[_0xf028('0x37')],_0x27f0f5['query']);_0x3c27c1[_0xf028('0x3d')]=_['intersection'](_0x27f0f5[_0xf028('0x37')],qs[_0xf028('0x3e')](_0x1d0fd1[_0xf028('0x39')][_0xf028('0x3e')]));_0x3c27c1[_0xf028('0x3d')]=_0x3c27c1[_0xf028('0x3d')][_0xf028('0x3f')]?_0x3c27c1['attributes']:_0x27f0f5[_0xf028('0x37')];_0x3c27c1[_0xf028('0x43')]=qs[_0xf028('0x44')](_0x1d0fd1[_0xf028('0x39')][_0xf028('0x44')]);_0x3c27c1[_0xf028('0x45')]=qs[_0xf028('0x3b')](_[_0xf028('0x46')](_0x1d0fd1['query'],_0x27f0f5['filters']));if(_0x1d0fd1[_0xf028('0x39')]['filter']){_0x3c27c1[_0xf028('0x45')]=_[_0xf028('0x47')](_0x3c27c1[_0xf028('0x45')],{'$or':_[_0xf028('0x38')](_0x3c27c1[_0xf028('0x3d')],function(_0x4cc5e7){var _0x29612c={};_0x29612c[_0x4cc5e7]={'$like':'%'+_0x1d0fd1['query'][_0xf028('0x2b')]+'%'};return _0x29612c;})});}_0x3c27c1=_[_0xf028('0x47')]({},_0x3c27c1,_0x1d0fd1[_0xf028('0x49')]);return _0x2081eb['getAgents'](_0x3c27c1);}})['then'](function(_0x1e5d84){if(_0x1e5d84){_0xcfa75e=_0x1e5d84[_0xf028('0x3f')];if(!_0x1d0fd1[_0xf028('0x39')][_0xf028('0x40')](_0xf028('0x41'))){_0x3c27c1[_0xf028('0x42')]=qs[_0xf028('0x42')](_0x1d0fd1[_0xf028('0x39')]['limit']);_0x3c27c1[_0xf028('0x21')]=qs[_0xf028('0x21')](_0x1d0fd1[_0xf028('0x39')][_0xf028('0x21')]);}return _0x2081eb[_0xf028('0x96')](_0x3c27c1);}})[_0xf028('0x26')](function(_0x2dc9a1){if(_0x2dc9a1){return _0x2dc9a1?{'count':_0xcfa75e,'rows':_0x2dc9a1}:null;}})[_0xf028('0x26')](respondWithResult(_0xc569c8,null))['catch'](handleError(_0xc569c8,null));};exports[_0xf028('0x97')]=function(_0x3a7755,_0x5340c2,_0x57eb71){var _0x404871={};var _0x89a102={};var _0x578b89;var _0x5b9750;return db[_0xf028('0x35')][_0xf028('0x61')]({'where':{'id':_0x3a7755[_0xf028('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5340c2,null))[_0xf028('0x26')](function(_0x8a5d79){if(_0x8a5d79){_0x578b89=_0x8a5d79;_0x89a102[_0xf028('0x37')]=_[_0xf028('0x3a')](db[_0xf028('0x95')][_0xf028('0x4f')]);_0x89a102[_0xf028('0x39')]=_['keys'](_0x3a7755[_0xf028('0x39')]);_0x89a102[_0xf028('0x3b')]=_[_0xf028('0x3c')](_0x89a102[_0xf028('0x37')],_0x89a102['query']);_0x404871[_0xf028('0x3d')]=_[_0xf028('0x3c')](_0x89a102[_0xf028('0x37')],qs[_0xf028('0x3e')](_0x3a7755[_0xf028('0x39')][_0xf028('0x3e')]));_0x404871['attributes']=_0x404871['attributes'][_0xf028('0x3f')]?_0x404871[_0xf028('0x3d')]:_0x89a102[_0xf028('0x37')];_0x404871[_0xf028('0x43')]=qs['sort'](_0x3a7755['query'][_0xf028('0x44')]);_0x404871[_0xf028('0x45')]=qs[_0xf028('0x3b')](_[_0xf028('0x46')](_0x3a7755[_0xf028('0x39')],_0x89a102[_0xf028('0x3b')]));if(_0x3a7755[_0xf028('0x39')][_0xf028('0x2b')]){_0x404871[_0xf028('0x45')]=_[_0xf028('0x47')](_0x404871[_0xf028('0x45')],{'$or':_[_0xf028('0x38')](_0x404871[_0xf028('0x3d')],function(_0x4d79b7){var _0x521cc7={};_0x521cc7[_0x4d79b7]={'$like':'%'+_0x3a7755['query'][_0xf028('0x2b')]+'%'};return _0x521cc7;})});}_0x404871=_[_0xf028('0x47')]({},_0x404871,_0x3a7755[_0xf028('0x49')]);return _0x578b89[_0xf028('0x97')](_0x404871);}})[_0xf028('0x26')](function(_0x30fc3a){if(_0x30fc3a){_0x5b9750=_0x30fc3a[_0xf028('0x3f')];if(!_0x3a7755[_0xf028('0x39')][_0xf028('0x40')]('nolimit')){_0x404871['limit']=qs[_0xf028('0x42')](_0x3a7755['query'][_0xf028('0x42')]);_0x404871[_0xf028('0x21')]=qs[_0xf028('0x21')](_0x3a7755['query']['offset']);}return _0x578b89[_0xf028('0x97')](_0x404871);}})[_0xf028('0x26')](function(_0x5eeb7e){return _0x5eeb7e?{'count':_0x5b9750,'rows':_0x5eeb7e}:null;})['then'](respondWithResult(_0x5340c2,null))[_0xf028('0x4d')](handleError(_0x5340c2,null));};exports[_0xf028('0x98')]=function(_0x4fb4c4,_0x5a844f,_0x6a8a4b){var _0x2f31e7={};var _0x429c65={};var _0x14a3e3;var _0x4dfa84;return db[_0xf028('0x35')]['findOne']({'where':{'id':_0x4fb4c4['params']['id']}})[_0xf028('0x26')](handleEntityNotFound(_0x5a844f,null))[_0xf028('0x26')](function(_0x15fab5){if(_0x15fab5){_0x14a3e3=_0x15fab5;_0x429c65[_0xf028('0x37')]=_['keys'](db[_0xf028('0x99')][_0xf028('0x4f')]);_0x429c65[_0xf028('0x39')]=_[_0xf028('0x3a')](_0x4fb4c4[_0xf028('0x39')]);_0x429c65[_0xf028('0x3b')]=_[_0xf028('0x3c')](_0x429c65[_0xf028('0x37')],_0x429c65['query']);_0x2f31e7['attributes']=_[_0xf028('0x3c')](_0x429c65[_0xf028('0x37')],qs[_0xf028('0x3e')](_0x4fb4c4[_0xf028('0x39')]['fields']));_0x2f31e7['attributes']=_0x2f31e7[_0xf028('0x3d')][_0xf028('0x3f')]?_0x2f31e7[_0xf028('0x3d')]:_0x429c65['model'];_0x2f31e7[_0xf028('0x43')]=qs['sort'](_0x4fb4c4[_0xf028('0x39')][_0xf028('0x44')]);_0x2f31e7[_0xf028('0x45')]=qs[_0xf028('0x3b')](_[_0xf028('0x46')](_0x4fb4c4['query'],_0x429c65[_0xf028('0x3b')]));if(_0x4fb4c4[_0xf028('0x39')][_0xf028('0x2b')]){_0x2f31e7[_0xf028('0x45')]=_['merge'](_0x2f31e7[_0xf028('0x45')],{'$or':_[_0xf028('0x38')](_0x2f31e7['attributes'],function(_0x486ec2){var _0xa551a0={};_0xa551a0[_0x486ec2]={'$like':'%'+_0x4fb4c4[_0xf028('0x39')]['filter']+'%'};return _0xa551a0;})});}_0x2f31e7=_['merge']({},_0x2f31e7,_0x4fb4c4[_0xf028('0x49')]);return _0x14a3e3['getLists'](_0x2f31e7);}})[_0xf028('0x26')](function(_0x101ae2){if(_0x101ae2){_0x4dfa84=_0x101ae2['length'];if(!_0x4fb4c4[_0xf028('0x39')][_0xf028('0x40')](_0xf028('0x41'))){_0x2f31e7['limit']=qs[_0xf028('0x42')](_0x4fb4c4['query']['limit']);_0x2f31e7[_0xf028('0x21')]=qs[_0xf028('0x21')](_0x4fb4c4[_0xf028('0x39')]['offset']);}return _0x14a3e3[_0xf028('0x98')](_0x2f31e7);}})[_0xf028('0x26')](function(_0x3ec6a4){if(_0x3ec6a4){return _0x3ec6a4?{'count':_0x4dfa84,'rows':_0x3ec6a4}:null;}})[_0xf028('0x26')](respondWithResult(_0x5a844f,null))[_0xf028('0x4d')](handleError(_0x5a844f,null));};exports[_0xf028('0x9a')]=function(_0x477b98,_0x213441,_0x1ecaec){var _0x5f5702,_0x58e8ee;return db['VoiceQueue'][_0xf028('0x2f')]({'where':{'id':_0x477b98[_0xf028('0x5c')]['id']}})[_0xf028('0x26')](handleEntityNotFound(_0x213441,null))[_0xf028('0x26')](function(_0x5d8b47){if(_0x5d8b47){_0x58e8ee=_0x5d8b47;return _0x5d8b47[_0xf028('0x9a')](_0x477b98[_0xf028('0x52')][_0xf028('0x7f')],_[_0xf028('0x5d')](_0x477b98['body'],[_0xf028('0x7f'),'id'])||{});}return null;})['spread'](function(_0x24f101){var _0x3c9bbe;_0x5f5702=_0x24f101||[];var _0x4b268c=[];if(_0x24f101){for(var _0x3ccc51=0x0;_0x3ccc51<_0x24f101[_0xf028('0x3f')];_0x3ccc51+=0x1){var _0x2ce22c=_0x24f101[_0x3ccc51][_0xf028('0x28')]({'plain':!![]});_0x58e8ee[_0xf028('0x9b')]=_0x477b98[_0xf028('0x52')][_0xf028('0x9b')]?_0x477b98[_0xf028('0x52')][_0xf028('0x9b')]:_0x58e8ee[_0xf028('0x9b')];switch(_0x58e8ee[_0xf028('0x9b')]){case _0xf028('0x9c'):_0x3c9bbe=squel[_0xf028('0x9d')]()['into'](_0xf028('0x9e'))[_0xf028('0x9f')]([_0xf028('0xa0'),'scheduledAt',_0xf028('0xa1'),_0xf028('0xa2'),_0xf028('0x63'),_0xf028('0xa3'),_0xf028('0x5e')],squel[_0xf028('0x80')]()[_0xf028('0xa4')]('phone','phone')[_0xf028('0xa4')](_0xf028('0xa5'),_0xf028('0xa6'))[_0xf028('0xa4')]('id',_0xf028('0xa1'))[_0xf028('0xa4')](_0x2ce22c[_0xf028('0xa7')]['toString'](),_0xf028('0xa2'))[_0xf028('0xa4')](_0x477b98[_0xf028('0x5c')]['id']['toString'](),_0xf028('0x63'))['field'](_0xf028('0xa5'),'createdAt')[_0xf028('0xa4')]('NOW()',_0xf028('0x5e'))[_0xf028('0x82')](_0xf028('0xa8'))[_0xf028('0x45')](_0xf028('0xa9'))[_0xf028('0x45')]('ListId\x20=\x20?',_0x2ce22c['CmListId'][_0xf028('0xaa')]())['where'](_0xf028('0xab'))[_0xf028('0x45')](_0xf028('0xac'),squel['select']()['field']('COALESCE(calleridnum,\x27\x27)')[_0xf028('0x82')](_0xf028('0xad'))[_0xf028('0x45')]('VoiceQueueId\x20=\x20?',_0x477b98[_0xf028('0x5c')]['id'][_0xf028('0xaa')]()))[_0xf028('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf028('0x80')]()[_0xf028('0xa4')](_0xf028('0xae'))[_0xf028('0x82')]('cm_hopper')[_0xf028('0x45')](_0xf028('0x85'),_0x477b98[_0xf028('0x5c')]['id'][_0xf028('0xaa')]())))[_0xf028('0xaa')]();break;case _0xf028('0xaf'):_0x3c9bbe=squel['insert']()['into']('cm_hopper')[_0xf028('0x9f')](['phone','scheduledAt',_0xf028('0xa1'),'ListId',_0xf028('0x63'),_0xf028('0xa3'),_0xf028('0x5e')],squel[_0xf028('0x80')]()[_0xf028('0xa4')]('phone',_0xf028('0xa0'))['field'](_0xf028('0xa5'),'scheduledAt')['field']('id','ContactId')[_0xf028('0xa4')](_0x2ce22c[_0xf028('0xa7')][_0xf028('0xaa')](),'ListId')[_0xf028('0xa4')](_0x477b98[_0xf028('0x5c')]['id'][_0xf028('0xaa')](),'VoiceQueueId')['field'](_0xf028('0xa5'),_0xf028('0xa3'))['field']('NOW()',_0xf028('0x5e'))[_0xf028('0x82')](_0xf028('0xa8'))[_0xf028('0x45')](_0xf028('0xa9'))[_0xf028('0x45')](_0xf028('0xb0'),_0x2ce22c[_0xf028('0xa7')][_0xf028('0xaa')]())[_0xf028('0x45')](_0xf028('0xab'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xf028('0x80')]()[_0xf028('0xa4')]('COALESCE(phone,\x27\x27)')[_0xf028('0x82')]('cm_hopper')[_0xf028('0x45')]('VoiceQueueId\x20=\x20?',_0x477b98[_0xf028('0x5c')]['id'][_0xf028('0xaa')]())))['toString']();break;default:_0x3c9bbe=squel[_0xf028('0x9d')]()[_0xf028('0xb1')](_0xf028('0x9e'))['fromQuery']([_0xf028('0xa0'),_0xf028('0xa6'),_0xf028('0xa1'),_0xf028('0xa2'),_0xf028('0x63'),_0xf028('0xa3'),'updatedAt'],squel[_0xf028('0x80')]()[_0xf028('0xa4')](_0xf028('0xa0'),_0xf028('0xa0'))[_0xf028('0xa4')](_0xf028('0xa5'),_0xf028('0xa6'))['field']('id',_0xf028('0xa1'))[_0xf028('0xa4')](_0x2ce22c[_0xf028('0xa7')]['toString'](),_0xf028('0xa2'))[_0xf028('0xa4')](_0x477b98[_0xf028('0x5c')]['id'][_0xf028('0xaa')](),_0xf028('0x63'))[_0xf028('0xa4')](_0xf028('0xa5'),_0xf028('0xa3'))['field'](_0xf028('0xa5'),_0xf028('0x5e'))[_0xf028('0x82')](_0xf028('0xa8'))[_0xf028('0x45')](_0xf028('0xa9'))[_0xf028('0x45')](_0xf028('0xb0'),_0x2ce22c['CmListId']['toString']())[_0xf028('0x45')](_0xf028('0xab')))[_0xf028('0xaa')]();}_0x4b268c[_0xf028('0x87')](db[_0xf028('0x88')]['query'](_0x3c9bbe));}return BPromise[_0xf028('0x8b')](_0x4b268c);}})[_0xf028('0x26')](function(){return _0x5f5702;})['then'](respondWithResult(_0x213441,null))['catch'](handleError(_0x213441,null));};exports[_0xf028('0xb2')]=function(_0x3601f1,_0x31f826,_0x2627d4){return db[_0xf028('0x35')][_0xf028('0x2f')]({'where':{'id':_0x3601f1['params']['id']}})['then'](handleEntityNotFound(_0x31f826,null))[_0xf028('0x26')](function(_0x3aa9a2){if(_0x3aa9a2){return _0x3aa9a2[_0xf028('0xb2')](_0x3601f1[_0xf028('0x39')][_0xf028('0x7f')]);}})[_0xf028('0x26')](function(_0x12ee9d){if(_0x12ee9d){return db[_0xf028('0x62')][_0xf028('0x27')]({'where':{'ListId':_0x3601f1[_0xf028('0x39')][_0xf028('0x7f')],'VoiceQueueId':_0x3601f1[_0xf028('0x5c')]['id']}})[_0xf028('0x26')](function(){return _0x12ee9d;});}})[_0xf028('0x26')](respondWithStatusCode(_0x31f826,null))[_0xf028('0x4d')](handleError(_0x31f826,null));};exports['getBlackLists']=function(_0x51bf96,_0x45561c,_0x3de0bb){var _0x40c3f0={};var _0xa31507={};var _0x181088;var _0x166cad;return db[_0xf028('0x35')][_0xf028('0x61')]({'where':{'id':_0x51bf96[_0xf028('0x5c')]['id']}})['then'](handleEntityNotFound(_0x45561c,null))['then'](function(_0x2799b2){if(_0x2799b2){_0x181088=_0x2799b2;_0xa31507[_0xf028('0x37')]=_[_0xf028('0x3a')](db['CmList'][_0xf028('0x4f')]);_0xa31507[_0xf028('0x39')]=_[_0xf028('0x3a')](_0x51bf96[_0xf028('0x39')]);_0xa31507[_0xf028('0x3b')]=_[_0xf028('0x3c')](_0xa31507[_0xf028('0x37')],_0xa31507[_0xf028('0x39')]);_0x40c3f0[_0xf028('0x3d')]=_['intersection'](_0xa31507[_0xf028('0x37')],qs[_0xf028('0x3e')](_0x51bf96[_0xf028('0x39')]['fields']));_0x40c3f0[_0xf028('0x3d')]=_0x40c3f0['attributes'][_0xf028('0x3f')]?_0x40c3f0[_0xf028('0x3d')]:_0xa31507[_0xf028('0x37')];_0x40c3f0['order']=qs['sort'](_0x51bf96[_0xf028('0x39')][_0xf028('0x44')]);_0x40c3f0[_0xf028('0x45')]=qs[_0xf028('0x3b')](_['pick'](_0x51bf96[_0xf028('0x39')],_0xa31507[_0xf028('0x3b')]));if(_0x51bf96[_0xf028('0x39')][_0xf028('0x2b')]){_0x40c3f0[_0xf028('0x45')]=_['merge'](_0x40c3f0[_0xf028('0x45')],{'$or':_[_0xf028('0x38')](_0x40c3f0[_0xf028('0x3d')],function(_0x314242){var _0x170522={};_0x170522[_0x314242]={'$like':'%'+_0x51bf96[_0xf028('0x39')][_0xf028('0x2b')]+'%'};return _0x170522;})});}_0x40c3f0=_[_0xf028('0x47')]({},_0x40c3f0,_0x51bf96['options']);return _0x181088[_0xf028('0xb3')](_0x40c3f0);}})[_0xf028('0x26')](function(_0x3dd14b){if(_0x3dd14b){_0x166cad=_0x3dd14b[_0xf028('0x3f')];if(!_0x51bf96[_0xf028('0x39')][_0xf028('0x40')](_0xf028('0x41'))){_0x40c3f0[_0xf028('0x42')]=qs['limit'](_0x51bf96['query'][_0xf028('0x42')]);_0x40c3f0[_0xf028('0x21')]=qs[_0xf028('0x21')](_0x51bf96[_0xf028('0x39')][_0xf028('0x21')]);}return _0x181088[_0xf028('0xb3')](_0x40c3f0);}})[_0xf028('0x26')](function(_0xa69ea2){if(_0xa69ea2){return _0xa69ea2?{'count':_0x166cad,'rows':_0xa69ea2}:null;}})[_0xf028('0x26')](respondWithResult(_0x45561c,null))[_0xf028('0x4d')](handleError(_0x45561c,null));};exports[_0xf028('0xb4')]=function(_0x42907b,_0x31e0f5,_0x54af26){var _0xcc5c07,_0x355763;return db[_0xf028('0x35')]['find']({'where':{'id':_0x42907b[_0xf028('0x5c')]['id']}})[_0xf028('0x26')](handleEntityNotFound(_0x31e0f5,null))[_0xf028('0x26')](function(_0x4a9157){if(_0x4a9157){_0x355763=_0x4a9157;return _0x4a9157[_0xf028('0xb4')](_0x42907b['body'][_0xf028('0x7f')],_[_0xf028('0x5d')](_0x42907b[_0xf028('0x52')],['ids','id'])||{});}return null;})[_0xf028('0xb5')](function(_0x54c854){var _0x25f177;_0xcc5c07=_0x54c854||[];var _0x7865b=[];if(_0x54c854){for(var _0x181633=0x0;_0x181633<_0x54c854[_0xf028('0x3f')];_0x181633+=0x1){var _0x359662=_0x54c854[_0x181633][_0xf028('0x28')]({'plain':!![]});_0x25f177=squel[_0xf028('0x9d')]()[_0xf028('0xb1')]('cm_hopper_black')['fromQuery']([_0xf028('0xa0'),_0xf028('0xa1'),_0xf028('0xa2'),_0xf028('0x63'),_0xf028('0xa3'),_0xf028('0x5e')],squel[_0xf028('0x80')]()[_0xf028('0xa4')](_0xf028('0xa0'),_0xf028('0xa0'))[_0xf028('0xa4')]('id',_0xf028('0xa1'))[_0xf028('0xa4')](_0x359662[_0xf028('0xa7')][_0xf028('0xaa')](),_0xf028('0xa2'))[_0xf028('0xa4')](_0x42907b[_0xf028('0x5c')]['id'][_0xf028('0xaa')](),_0xf028('0x63'))[_0xf028('0xa4')]('NOW()',_0xf028('0xa3'))[_0xf028('0xa4')](_0xf028('0xa5'),_0xf028('0x5e'))[_0xf028('0x82')]('cm_contacts')[_0xf028('0x45')](_0xf028('0xa9'))[_0xf028('0x45')](_0xf028('0xb0'),_0x359662[_0xf028('0xa7')][_0xf028('0xaa')]())[_0xf028('0x45')](_0xf028('0xab')))[_0xf028('0xaa')]();_0x7865b[_0xf028('0x87')](db['sequelize'][_0xf028('0x39')](_0x25f177));}return BPromise['all'](_0x7865b);}})[_0xf028('0x26')](function(){return _0xcc5c07;})[_0xf028('0x26')](respondWithResult(_0x31e0f5,null))[_0xf028('0x4d')](handleError(_0x31e0f5,null));};exports[_0xf028('0xb6')]=function(_0x2c88c4,_0x1ee5b9,_0x13a510){return db[_0xf028('0x35')]['find']({'where':{'id':_0x2c88c4['params']['id']}})[_0xf028('0x26')](handleEntityNotFound(_0x1ee5b9,null))[_0xf028('0x26')](function(_0x20eb56){if(_0x20eb56){return _0x20eb56[_0xf028('0xb6')](_0x2c88c4[_0xf028('0x39')][_0xf028('0x7f')]);}})['then'](function(_0x21a3d0){if(_0x21a3d0){return db[_0xf028('0x69')][_0xf028('0x27')]({'where':{'ListId':_0x2c88c4[_0xf028('0x39')]['ids'],'VoiceQueueId':_0x2c88c4['params']['id']}})[_0xf028('0x26')](function(){return _0x21a3d0;});}})[_0xf028('0x26')](respondWithStatusCode(_0x1ee5b9,null))[_0xf028('0x4d')](handleError(_0x1ee5b9,null));}; \ No newline at end of file +var _0x5da8=['count','offset','limit','set','json','apply','reject','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','error','stack','index','VoiceQueue','fieldName','query','keys','filters','intersection','model','attributes','fields','length','sort','where','pick','VIRTUAL','merge','options','findAll','rows','params','rawAttributes','includeAll','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','clone','omit','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','hasOwnProperty','nolimit','order','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','Team','getTeams','addTeams','teams','User','voicePause','interface','flatMap','Agents','penalty','sequelize','TeamVoiceQueue','upsert','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','forEach','userVoiceQueue:save','removeTeams','ids','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','transaction','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','online','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','updatedAt','select','NOW()','ContactId','CmListId','createdAt','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','into','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end'];(function(_0x52c604,_0x11af85){var _0x408525=function(_0x1c034e){while(--_0x1c034e){_0x52c604['push'](_0x52c604['shift']());}};_0x408525(++_0x11af85);}(_0x5da8,0x98));var _0x85da=function(_0x1c34a2,_0x5ef5da){_0x1c34a2=_0x1c34a2-0x0;var _0xc003dd=_0x5da8[_0x1c34a2];return _0xc003dd;};'use strict';var pdf=require(_0x85da('0x0'));var emlformat=require(_0x85da('0x1'));var rimraf=require(_0x85da('0x2'));var zipdir=require(_0x85da('0x3'));var jsonpatch=require(_0x85da('0x4'));var rp=require(_0x85da('0x5'));var moment=require(_0x85da('0x6'));var BPromise=require(_0x85da('0x7'));var Mustache=require('mustache');var util=require(_0x85da('0x8'));var path=require(_0x85da('0x9'));var sox=require(_0x85da('0xa'));var csv=require('to-csv');var ejs=require(_0x85da('0xb'));var fs=require('fs');var _=require(_0x85da('0xc'));var squel=require(_0x85da('0xd'));var crypto=require(_0x85da('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x85da('0xf'));var toCsv=require('to-csv');var querystring=require(_0x85da('0x10'));var Papa=require(_0x85da('0x11'));var Redis=require('ioredis');var authService=require(_0x85da('0x12'));var qs=require(_0x85da('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85da('0x14'));var logger=require('../../config/logger')(_0x85da('0x15'));var utils=require(_0x85da('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x85da('0x17'))['db'];config[_0x85da('0x18')]=_[_0x85da('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x85da('0x1a'))(new Redis(config[_0x85da('0x18')]));require('./voiceQueue.socket')[_0x85da('0x1b')](socket);function respondWithStatusCode(_0x26512a,_0x516e70){_0x516e70=_0x516e70||0xcc;return function(_0x177858){if(_0x177858){return _0x26512a[_0x85da('0x1c')](_0x516e70);}return _0x26512a[_0x85da('0x1d')](_0x516e70)[_0x85da('0x1e')]();};}function respondWithResult(_0x4d702c,_0xec8d83){_0xec8d83=_0xec8d83||0xc8;return function(_0x57e49e){if(_0x57e49e){return _0x4d702c['status'](_0xec8d83)['json'](_0x57e49e);}};}function respondWithFilteredResult(_0x3fad0e,_0x255bd5){return function(_0xba93b2){if(_0xba93b2){var _0x21e3f5=_0xba93b2[_0x85da('0x1f')],_0x567513=_0x255bd5[_0x85da('0x20')],_0x5b8f60=_0x255bd5[_0x85da('0x20')]+_0x255bd5[_0x85da('0x21')],_0x4642eb;if(_0x5b8f60>=_0x21e3f5){_0x5b8f60=_0x21e3f5;_0x4642eb=0xc8;}else{_0x4642eb=0xce;}_0x3fad0e['status'](_0x4642eb);return _0x3fad0e[_0x85da('0x22')]('Content-Range',_0x567513+'-'+_0x5b8f60+'/'+_0x21e3f5)[_0x85da('0x23')](_0xba93b2);}return null;};}function patchUpdates(_0x2f587b){return function(_0x487a59){try{jsonpatch[_0x85da('0x24')](_0x487a59,_0x2f587b,!![]);}catch(_0x1b17b1){return BPromise[_0x85da('0x25')](_0x1b17b1);}return _0x487a59[_0x85da('0x26')]();};}function saveUpdates(_0x8e5a50,_0xae01c8){return function(_0x3cd28e){if(_0x3cd28e){return _0x3cd28e[_0x85da('0x27')](_0x8e5a50)[_0x85da('0x28')](function(_0x2cbe4f){return _0x2cbe4f;});}return null;};}function removeEntity(_0x2fe5cf,_0x231e0c){return function(_0x3839d1){if(_0x3839d1){return _0x3839d1[_0x85da('0x29')]()[_0x85da('0x28')](function(){var _0x4b6301=_0x3839d1['get']({'plain':!![]});var _0x3ebf35=[{'name':_0x85da('0x2a'),'value':_0x85da('0x2b'),'ignore':![]},{'name':_0x85da('0x2c'),'value':_0x85da('0x2d'),'ignore':![]}];var _0x3819f6=_(_0x3ebf35)[_0x85da('0x2e')](_0x85da('0x2f'))[_0x85da('0x30')](_0x85da('0x31'))[_0x85da('0x31')]();if(_['includes'](_0x3819f6,_0x4b6301[_0x85da('0x32')])){return;}var _0xf89f7e=_[_0x85da('0x33')](_0x3ebf35,['value',_0x4b6301[_0x85da('0x32')]])[_0x85da('0x34')];return db[_0x85da('0x35')][_0x85da('0x29')]({'where':{'type':_0xf89f7e,'resourceId':_0x4b6301['id']}})[_0x85da('0x28')](function(){return _0x3839d1;});})[_0x85da('0x28')](function(){_0x2fe5cf[_0x85da('0x1d')](0xcc)[_0x85da('0x1e')]();});}};}function handleEntityNotFound(_0x3980a4,_0x1af6b3){return function(_0x5b116b){if(!_0x5b116b){_0x3980a4[_0x85da('0x1c')](0x194);}return _0x5b116b;};}function handleError(_0x231c6f,_0x1490bc){_0x1490bc=_0x1490bc||0x1f4;return function(_0x1656a9){logger[_0x85da('0x36')](_0x1656a9[_0x85da('0x37')]);if(_0x1656a9['name']){delete _0x1656a9[_0x85da('0x34')];}_0x231c6f[_0x85da('0x1d')](_0x1490bc)['send'](_0x1656a9);};}exports[_0x85da('0x38')]=function(_0x4562a8,_0x9378d){var _0x43aa0d={},_0x24e1c4={},_0x8c6f90={'count':0x0,'rows':[]};var _0x3c6924=_[_0x85da('0x30')](db[_0x85da('0x39')]['rawAttributes'],function(_0x3d0ceb){return{'name':_0x3d0ceb[_0x85da('0x3a')],'type':_0x3d0ceb['type']['key']};});_0x24e1c4['model']=_[_0x85da('0x30')](_0x3c6924,_0x85da('0x34'));_0x24e1c4[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x4562a8['query']);_0x24e1c4[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x24e1c4[_0x85da('0x3f')],_0x24e1c4[_0x85da('0x3b')]);_0x43aa0d[_0x85da('0x40')]=_['intersection'](_0x24e1c4[_0x85da('0x3f')],qs[_0x85da('0x41')](_0x4562a8[_0x85da('0x3b')]['fields']));_0x43aa0d[_0x85da('0x40')]=_0x43aa0d['attributes'][_0x85da('0x42')]?_0x43aa0d[_0x85da('0x40')]:_0x24e1c4[_0x85da('0x3f')];if(!_0x4562a8[_0x85da('0x3b')]['hasOwnProperty']('nolimit')){_0x43aa0d[_0x85da('0x21')]=qs[_0x85da('0x21')](_0x4562a8[_0x85da('0x3b')][_0x85da('0x21')]);_0x43aa0d[_0x85da('0x20')]=qs[_0x85da('0x20')](_0x4562a8[_0x85da('0x3b')]['offset']);}_0x43aa0d['order']=qs['sort'](_0x4562a8[_0x85da('0x3b')][_0x85da('0x43')]);_0x43aa0d[_0x85da('0x44')]=qs['filters'](_[_0x85da('0x45')](_0x4562a8[_0x85da('0x3b')],_0x24e1c4[_0x85da('0x3d')]),_0x3c6924);if(_0x4562a8[_0x85da('0x3b')][_0x85da('0x2e')]){_0x43aa0d[_0x85da('0x44')]=_['merge'](_0x43aa0d[_0x85da('0x44')],{'$or':_[_0x85da('0x30')](_0x3c6924,function(_0x5afff9){if(_0x5afff9[_0x85da('0x32')]!==_0x85da('0x46')){var _0x51f7c1={};_0x51f7c1[_0x5afff9[_0x85da('0x34')]]={'$like':'%'+_0x4562a8[_0x85da('0x3b')]['filter']+'%'};return _0x51f7c1;}})});}_0x43aa0d=_[_0x85da('0x47')]({},_0x43aa0d,_0x4562a8[_0x85da('0x48')]);var _0x1b8927={'where':_0x43aa0d[_0x85da('0x44')]};return db['VoiceQueue'][_0x85da('0x1f')](_0x1b8927)[_0x85da('0x28')](function(_0x5af0d1){_0x8c6f90[_0x85da('0x1f')]=_0x5af0d1;if(_0x4562a8['query']['includeAll']){_0x43aa0d['include']=[{'all':!![]}];}return db[_0x85da('0x39')][_0x85da('0x49')](_0x43aa0d);})['then'](function(_0x24cf20){_0x8c6f90[_0x85da('0x4a')]=_0x24cf20;return _0x8c6f90;})[_0x85da('0x28')](respondWithFilteredResult(_0x9378d,_0x43aa0d))['catch'](handleError(_0x9378d,null));};exports['show']=function(_0x1545d2,_0x1d39ec){var _0x291623={'raw':![],'where':{'id':_0x1545d2[_0x85da('0x4b')]['id']}},_0x5011a8={};_0x5011a8[_0x85da('0x3f')]=_[_0x85da('0x3c')](db[_0x85da('0x39')][_0x85da('0x4c')]);_0x5011a8[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x1545d2[_0x85da('0x3b')]);_0x5011a8[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x5011a8[_0x85da('0x3f')],_0x5011a8[_0x85da('0x3b')]);_0x291623['attributes']=_['intersection'](_0x5011a8['model'],qs[_0x85da('0x41')](_0x1545d2[_0x85da('0x3b')][_0x85da('0x41')]));_0x291623[_0x85da('0x40')]=_0x291623[_0x85da('0x40')][_0x85da('0x42')]?_0x291623['attributes']:_0x5011a8[_0x85da('0x3f')];if(_0x1545d2[_0x85da('0x3b')][_0x85da('0x4d')]){_0x291623[_0x85da('0x4e')]=[{'all':!![]}];}_0x291623=_['merge']({},_0x291623,_0x1545d2[_0x85da('0x48')]);return db[_0x85da('0x39')][_0x85da('0x33')](_0x291623)[_0x85da('0x28')](handleEntityNotFound(_0x1d39ec,null))[_0x85da('0x28')](respondWithResult(_0x1d39ec,null))['catch'](handleError(_0x1d39ec,null));};exports[_0x85da('0x4f')]=function(_0x2f2d36,_0x580433){return db['VoiceQueue']['create'](_0x2f2d36[_0x85da('0x50')],{})[_0x85da('0x28')](function(_0xf6ac28){var _0x2d7dd0=_0x2f2d36[_0x85da('0x51')][_0x85da('0x52')]({'plain':!![]});if(!_0x2d7dd0)throw new Error(_0x85da('0x53'));if(_0x2d7dd0['role']===_0x85da('0x51')){var _0x5816dc=_0xf6ac28[_0x85da('0x52')]({'plain':!![]});var _0x2bddbd=[{'name':_0x85da('0x2a'),'value':_0x85da('0x2b')},{'name':_0x85da('0x2c'),'value':_0x85da('0x2d')}];var _0x3921b4=_[_0x85da('0x33')](_0x2bddbd,['value',_0x5816dc[_0x85da('0x32')]])[_0x85da('0x34')];return db['UserProfileSection']['find']({'where':{'name':_0x3921b4,'userProfileId':_0x2d7dd0[_0x85da('0x54')]},'raw':!![]})[_0x85da('0x28')](function(_0x338710){if(_0x338710&&_0x338710[_0x85da('0x55')]===0x0){return db[_0x85da('0x35')]['create']({'name':_0x5816dc[_0x85da('0x34')],'resourceId':_0x5816dc['id'],'type':_0x338710[_0x85da('0x34')],'sectionId':_0x338710['id']},{})['then'](function(){return _0xf6ac28;});}else{return _0xf6ac28;}})['catch'](function(_0x369304){logger[_0x85da('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x369304);throw _0x369304;});}return _0xf6ac28;})['then'](respondWithResult(_0x580433,0xc9))['catch'](handleError(_0x580433,null));};exports[_0x85da('0x56')]=function(_0x334874,_0x1c4caf){var _0x3db759={'where':{'id':_0x334874[_0x85da('0x4b')]['id']}},_0x225596={};_0x225596[_0x85da('0x3f')]=_[_0x85da('0x3c')](db[_0x85da('0x39')]['rawAttributes']);_0x3db759[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x225596['model'],qs[_0x85da('0x41')](_0x334874[_0x85da('0x3b')][_0x85da('0x41')]));_0x3db759[_0x85da('0x40')]=_0x3db759[_0x85da('0x40')][_0x85da('0x42')]?_0x3db759[_0x85da('0x40')]:_0x225596[_0x85da('0x3f')];if(_0x334874['query']['includeAll']){_0x3db759[_0x85da('0x4e')]=[{'all':!![]}];}_0x3db759=_['merge']({},_0x3db759,_0x334874[_0x85da('0x48')]);return db[_0x85da('0x39')][_0x85da('0x33')](_0x3db759)[_0x85da('0x28')](handleEntityNotFound(_0x1c4caf,null))[_0x85da('0x28')](function(_0x7536de){if(_0x7536de){var _0x286913=_0x7536de[_0x85da('0x52')]({'plain':!![]});_0x286913=qs[_0x85da('0x57')](_0x286913,['id','createdAt','updatedAt']);_0x334874[_0x85da('0x50')]=_[_0x85da('0x57')](_0x334874['body'],['id','createdAt','updatedAt']);return db['VoiceQueue'][_0x85da('0x4f')](_[_0x85da('0x47')](_0x286913,_0x334874[_0x85da('0x50')]),{'include':_0x334874[_0x85da('0x3b')][_0x85da('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x3442f0){var _0x4dd46a=_0x334874[_0x85da('0x51')][_0x85da('0x52')]({'plain':!![]});if(!_0x4dd46a)throw new Error(_0x85da('0x53'));if(_0x4dd46a['role']==='user'){var _0x3875e6=_0x3442f0[_0x85da('0x52')]({'plain':!![]});var _0x1f09a8=[{'name':_0x85da('0x2a'),'value':_0x85da('0x2b')},{'name':'QueueCampaigns','value':_0x85da('0x2d')}];var _0x5197fc=_[_0x85da('0x33')](_0x1f09a8,[_0x85da('0x31'),_0x3875e6[_0x85da('0x32')]])['name'];return db['UserProfileSection'][_0x85da('0x33')]({'where':{'name':_0x5197fc,'userProfileId':_0x4dd46a[_0x85da('0x54')]},'raw':!![]})[_0x85da('0x28')](function(_0x1ab1b4){if(_0x1ab1b4&&_0x1ab1b4[_0x85da('0x55')]===0x0){return db[_0x85da('0x35')][_0x85da('0x4f')]({'name':_0x3875e6[_0x85da('0x34')],'resourceId':_0x3875e6['id'],'type':_0x1ab1b4[_0x85da('0x34')],'sectionId':_0x1ab1b4['id']},{})[_0x85da('0x28')](function(){return _0x3442f0;});}else{return _0x3442f0;}})[_0x85da('0x58')](function(_0x47fa92){logger['error'](_0x85da('0x59'),_0x47fa92);throw _0x47fa92;});}return _0x3442f0;});}})[_0x85da('0x28')](respondWithResult(_0x1c4caf,0xc9))['catch'](handleError(_0x1c4caf,null));};exports[_0x85da('0x27')]=function(_0x16c202,_0x1f485c){if(_0x16c202[_0x85da('0x50')]['id']){delete _0x16c202[_0x85da('0x50')]['id'];}return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x16c202['params']['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x1f485c,null))[_0x85da('0x28')](saveUpdates(_0x16c202[_0x85da('0x50')],null))[_0x85da('0x28')](respondWithResult(_0x1f485c,null))['catch'](handleError(_0x1f485c,null));};exports[_0x85da('0x29')]=function(_0x5530dd,_0x48acbf){return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x5530dd[_0x85da('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48acbf,null))[_0x85da('0x28')](removeEntity(_0x48acbf,null))['catch'](handleError(_0x48acbf,null));};exports['getHoppers']=function(_0x363db7,_0x41fea9,_0x2b190e){var _0x3a46b2={'raw':![],'where':{}};var _0x31c5cd={};var _0x7b6d23={'count':0x0,'rows':[]};return db[_0x85da('0x39')][_0x85da('0x5a')]({'where':{'id':_0x363db7['params']['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x41fea9,null))['then'](function(_0x1db68f){if(_0x1db68f){_0x31c5cd[_0x85da('0x3f')]=_['keys'](db[_0x85da('0x5b')][_0x85da('0x4c')]);_0x31c5cd['query']=_[_0x85da('0x3c')](_0x363db7[_0x85da('0x3b')]);_0x31c5cd[_0x85da('0x3d')]=_['intersection'](_0x31c5cd['model'],_0x31c5cd[_0x85da('0x3b')]);_0x3a46b2[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x31c5cd[_0x85da('0x3f')],qs[_0x85da('0x41')](_0x363db7[_0x85da('0x3b')][_0x85da('0x41')]));_0x3a46b2[_0x85da('0x40')]=_0x3a46b2[_0x85da('0x40')][_0x85da('0x42')]?_0x3a46b2['attributes']:_0x31c5cd[_0x85da('0x3f')];if(!_0x363db7[_0x85da('0x3b')][_0x85da('0x5c')](_0x85da('0x5d'))){_0x3a46b2[_0x85da('0x21')]=qs[_0x85da('0x21')](_0x363db7[_0x85da('0x3b')][_0x85da('0x21')]);_0x3a46b2[_0x85da('0x20')]=qs['offset'](_0x363db7[_0x85da('0x3b')][_0x85da('0x20')]);}_0x3a46b2[_0x85da('0x5e')]=qs[_0x85da('0x43')](_0x363db7[_0x85da('0x3b')]['sort']);_0x3a46b2[_0x85da('0x44')]=qs['filters'](_[_0x85da('0x45')](_0x363db7['query'],_0x31c5cd[_0x85da('0x3d')]));_0x3a46b2[_0x85da('0x44')][_0x85da('0x5f')]=_0x1db68f['id'];if(_0x363db7[_0x85da('0x3b')][_0x85da('0x2e')]){_0x3a46b2[_0x85da('0x44')]=_[_0x85da('0x47')](_0x3a46b2[_0x85da('0x44')],{'$or':_['map'](_0x3a46b2[_0x85da('0x40')],function(_0x163a34){var _0x36d823={};_0x36d823[_0x163a34]={'$like':'%'+_0x363db7[_0x85da('0x3b')]['filter']+'%'};return _0x36d823;})});}_0x3a46b2=_[_0x85da('0x47')]({},_0x3a46b2,_0x363db7[_0x85da('0x48')]);return db[_0x85da('0x5b')][_0x85da('0x1f')]({'where':_0x3a46b2[_0x85da('0x44')]})[_0x85da('0x28')](function(_0x37325e){_0x7b6d23['count']=_0x37325e;if(_0x363db7[_0x85da('0x3b')]['includeAll']){_0x3a46b2[_0x85da('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x85da('0x49')](_0x3a46b2);})['then'](function(_0x357884){_0x7b6d23[_0x85da('0x4a')]=_0x357884;return _0x7b6d23;});}})[_0x85da('0x28')](respondWithFilteredResult(_0x41fea9,_0x3a46b2))[_0x85da('0x58')](handleError(_0x41fea9,null));};exports[_0x85da('0x60')]=function(_0x29f5fd,_0x769182,_0xec70d8){var _0x371c1a={'raw':!![],'where':{}};var _0x1105bd={};var _0xfde6d9={'count':0x0,'rows':[]};return db[_0x85da('0x39')]['findOne']({'where':{'id':_0x29f5fd[_0x85da('0x4b')]['id']}})['then'](handleEntityNotFound(_0x769182,null))[_0x85da('0x28')](function(_0x3b8bd3){if(_0x3b8bd3){_0x1105bd[_0x85da('0x3f')]=_[_0x85da('0x3c')](db[_0x85da('0x61')][_0x85da('0x4c')]);_0x1105bd[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x29f5fd[_0x85da('0x3b')]);_0x1105bd[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x1105bd[_0x85da('0x3f')],_0x1105bd['query']);_0x371c1a[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x1105bd[_0x85da('0x3f')],qs[_0x85da('0x41')](_0x29f5fd[_0x85da('0x3b')][_0x85da('0x41')]));_0x371c1a[_0x85da('0x40')]=_0x371c1a[_0x85da('0x40')][_0x85da('0x42')]?_0x371c1a['attributes']:_0x1105bd['model'];if(!_0x29f5fd['query'][_0x85da('0x5c')]('nolimit')){_0x371c1a[_0x85da('0x21')]=qs['limit'](_0x29f5fd[_0x85da('0x3b')][_0x85da('0x21')]);_0x371c1a['offset']=qs[_0x85da('0x20')](_0x29f5fd[_0x85da('0x3b')][_0x85da('0x20')]);}_0x371c1a[_0x85da('0x5e')]=qs[_0x85da('0x43')](_0x29f5fd[_0x85da('0x3b')][_0x85da('0x43')]);_0x371c1a['where']=qs[_0x85da('0x3d')](_[_0x85da('0x45')](_0x29f5fd[_0x85da('0x3b')],_0x1105bd[_0x85da('0x3d')]));_0x371c1a[_0x85da('0x44')]['VoiceQueueId']=_0x3b8bd3['id'];if(_0x29f5fd[_0x85da('0x3b')][_0x85da('0x2e')]){_0x371c1a['where']=_[_0x85da('0x47')](_0x371c1a['where'],{'$or':_['map'](_0x371c1a['attributes'],function(_0x4251c8){var _0x4be232={};_0x4be232[_0x4251c8]={'$like':'%'+_0x29f5fd[_0x85da('0x3b')][_0x85da('0x2e')]+'%'};return _0x4be232;})});}_0x371c1a=_[_0x85da('0x47')]({},_0x371c1a,_0x29f5fd[_0x85da('0x48')]);return db['CmHopperHistory']['count']({'where':_0x371c1a[_0x85da('0x44')]})[_0x85da('0x28')](function(_0x304c01){_0xfde6d9['count']=_0x304c01;if(_0x29f5fd[_0x85da('0x3b')][_0x85da('0x4d')]){_0x371c1a[_0x85da('0x4e')]=[{'all':!![]}];}return db[_0x85da('0x61')][_0x85da('0x49')](_0x371c1a);})[_0x85da('0x28')](function(_0x104457){_0xfde6d9[_0x85da('0x4a')]=_0x104457;return _0xfde6d9;});}})[_0x85da('0x28')](respondWithFilteredResult(_0x769182,_0x371c1a))[_0x85da('0x58')](handleError(_0x769182,null));};exports[_0x85da('0x62')]=function(_0x2e00e3,_0x4ff8dc,_0x486ac8){var _0xe3a031={'raw':!![],'where':{}};var _0x250cb7={};var _0x574be2={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x2e00e3[_0x85da('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4ff8dc,null))[_0x85da('0x28')](function(_0xb7464a){if(_0xb7464a){_0x250cb7[_0x85da('0x3f')]=_[_0x85da('0x3c')](db[_0x85da('0x63')][_0x85da('0x4c')]);_0x250cb7[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x2e00e3['query']);_0x250cb7[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x250cb7['model'],_0x250cb7[_0x85da('0x3b')]);_0xe3a031[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x250cb7[_0x85da('0x3f')],qs['fields'](_0x2e00e3[_0x85da('0x3b')]['fields']));_0xe3a031[_0x85da('0x40')]=_0xe3a031['attributes'][_0x85da('0x42')]?_0xe3a031[_0x85da('0x40')]:_0x250cb7['model'];if(!_0x2e00e3[_0x85da('0x3b')]['hasOwnProperty']('nolimit')){_0xe3a031[_0x85da('0x21')]=qs[_0x85da('0x21')](_0x2e00e3['query'][_0x85da('0x21')]);_0xe3a031['offset']=qs['offset'](_0x2e00e3[_0x85da('0x3b')][_0x85da('0x20')]);}_0xe3a031[_0x85da('0x5e')]=qs[_0x85da('0x43')](_0x2e00e3[_0x85da('0x3b')]['sort']);_0xe3a031[_0x85da('0x44')]=qs[_0x85da('0x3d')](_['pick'](_0x2e00e3['query'],_0x250cb7[_0x85da('0x3d')]));_0xe3a031[_0x85da('0x44')]['VoiceQueueId']=_0xb7464a['id'];if(_0x2e00e3[_0x85da('0x3b')][_0x85da('0x2e')]){_0xe3a031['where']=_['merge'](_0xe3a031['where'],{'$or':_[_0x85da('0x30')](_0xe3a031[_0x85da('0x40')],function(_0x11f670){var _0x2f68d0={};_0x2f68d0[_0x11f670]={'$like':'%'+_0x2e00e3[_0x85da('0x3b')][_0x85da('0x2e')]+'%'};return _0x2f68d0;})});}_0xe3a031=_[_0x85da('0x47')]({},_0xe3a031,_0x2e00e3[_0x85da('0x48')]);return db['CmHopperFinal'][_0x85da('0x1f')]({'where':_0xe3a031[_0x85da('0x44')]})['then'](function(_0x52a0bd){_0x574be2['count']=_0x52a0bd;if(_0x2e00e3['query'][_0x85da('0x4d')]){_0xe3a031['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x85da('0x49')](_0xe3a031);})[_0x85da('0x28')](function(_0x9a24b7){_0x574be2[_0x85da('0x4a')]=_0x9a24b7;return _0x574be2;});}})[_0x85da('0x28')](respondWithFilteredResult(_0x4ff8dc,_0xe3a031))[_0x85da('0x58')](handleError(_0x4ff8dc,null));};exports['getHopperBlacks']=function(_0x329812,_0x2008b9,_0x5d3e66){var _0xa72cfe={'raw':!![],'where':{}};var _0xf272c3={};var _0x167c68={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x85da('0x5a')]({'where':{'id':_0x329812['params']['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x2008b9,null))[_0x85da('0x28')](function(_0x101b1a){if(_0x101b1a){_0xf272c3['model']=_[_0x85da('0x3c')](db[_0x85da('0x64')][_0x85da('0x4c')]);_0xf272c3[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x329812[_0x85da('0x3b')]);_0xf272c3[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0xf272c3[_0x85da('0x3f')],_0xf272c3[_0x85da('0x3b')]);_0xa72cfe[_0x85da('0x40')]=_[_0x85da('0x3e')](_0xf272c3[_0x85da('0x3f')],qs['fields'](_0x329812[_0x85da('0x3b')][_0x85da('0x41')]));_0xa72cfe[_0x85da('0x40')]=_0xa72cfe[_0x85da('0x40')][_0x85da('0x42')]?_0xa72cfe[_0x85da('0x40')]:_0xf272c3[_0x85da('0x3f')];if(!_0x329812['query'][_0x85da('0x5c')]('nolimit')){_0xa72cfe['limit']=qs[_0x85da('0x21')](_0x329812['query'][_0x85da('0x21')]);_0xa72cfe[_0x85da('0x20')]=qs[_0x85da('0x20')](_0x329812[_0x85da('0x3b')][_0x85da('0x20')]);}_0xa72cfe[_0x85da('0x5e')]=qs['sort'](_0x329812['query'][_0x85da('0x43')]);_0xa72cfe['where']=qs['filters'](_[_0x85da('0x45')](_0x329812['query'],_0xf272c3[_0x85da('0x3d')]));_0xa72cfe[_0x85da('0x44')]['VoiceQueueId']=_0x101b1a['id'];if(_0x329812[_0x85da('0x3b')]['filter']){_0xa72cfe['where']=_[_0x85da('0x47')](_0xa72cfe[_0x85da('0x44')],{'$or':_[_0x85da('0x30')](_0xa72cfe['attributes'],function(_0x1c6823){var _0x531aec={};_0x531aec[_0x1c6823]={'$like':'%'+_0x329812[_0x85da('0x3b')][_0x85da('0x2e')]+'%'};return _0x531aec;})});}_0xa72cfe=_[_0x85da('0x47')]({},_0xa72cfe,_0x329812['options']);return db[_0x85da('0x64')]['count']({'where':_0xa72cfe[_0x85da('0x44')]})['then'](function(_0x265d1f){_0x167c68[_0x85da('0x1f')]=_0x265d1f;if(_0x329812['query'][_0x85da('0x4d')]){_0xa72cfe['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x85da('0x49')](_0xa72cfe);})['then'](function(_0x379515){_0x167c68[_0x85da('0x4a')]=_0x379515;return _0x167c68;});}})[_0x85da('0x28')](respondWithFilteredResult(_0x2008b9,_0xa72cfe))['catch'](handleError(_0x2008b9,null));};exports['getTeams']=function(_0x3cf93a,_0x3a196a,_0x4d7d13){var _0x3d9827={};var _0x5deff1={};var _0x1c5a2f;var _0xf0d9c7;return db[_0x85da('0x39')][_0x85da('0x5a')]({'where':{'id':_0x3cf93a[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x3a196a,null))['then'](function(_0x484dc7){if(_0x484dc7){_0x1c5a2f=_0x484dc7;_0x5deff1['model']=_[_0x85da('0x3c')](db[_0x85da('0x65')][_0x85da('0x4c')]);_0x5deff1['query']=_[_0x85da('0x3c')](_0x3cf93a['query']);_0x5deff1[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x5deff1[_0x85da('0x3f')],_0x5deff1[_0x85da('0x3b')]);_0x3d9827[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x5deff1[_0x85da('0x3f')],qs[_0x85da('0x41')](_0x3cf93a['query'][_0x85da('0x41')]));_0x3d9827['attributes']=_0x3d9827[_0x85da('0x40')][_0x85da('0x42')]?_0x3d9827[_0x85da('0x40')]:_0x5deff1['model'];_0x3d9827[_0x85da('0x5e')]=qs[_0x85da('0x43')](_0x3cf93a[_0x85da('0x3b')][_0x85da('0x43')]);_0x3d9827[_0x85da('0x44')]=qs[_0x85da('0x3d')](_[_0x85da('0x45')](_0x3cf93a['query'],_0x5deff1[_0x85da('0x3d')]));if(_0x3cf93a[_0x85da('0x3b')][_0x85da('0x2e')]){_0x3d9827['where']=_[_0x85da('0x47')](_0x3d9827['where'],{'$or':_[_0x85da('0x30')](_0x3d9827['attributes'],function(_0x509f93){var _0x56a3eb={};_0x56a3eb[_0x509f93]={'$like':'%'+_0x3cf93a[_0x85da('0x3b')][_0x85da('0x2e')]+'%'};return _0x56a3eb;})});}_0x3d9827=_['merge']({},_0x3d9827,_0x3cf93a['options']);return _0x1c5a2f['getTeams'](_0x3d9827);}})[_0x85da('0x28')](function(_0x389903){if(_0x389903){_0xf0d9c7=_0x389903[_0x85da('0x42')];if(!_0x3cf93a[_0x85da('0x3b')][_0x85da('0x5c')](_0x85da('0x5d'))){_0x3d9827[_0x85da('0x21')]=qs[_0x85da('0x21')](_0x3cf93a[_0x85da('0x3b')][_0x85da('0x21')]);_0x3d9827[_0x85da('0x20')]=qs[_0x85da('0x20')](_0x3cf93a[_0x85da('0x3b')]['offset']);}return _0x1c5a2f[_0x85da('0x66')](_0x3d9827);}})[_0x85da('0x28')](function(_0x25698d){if(_0x25698d){return _0x25698d?{'count':_0xf0d9c7,'rows':_0x25698d}:null;}})[_0x85da('0x28')](respondWithResult(_0x3a196a,null))['catch'](handleError(_0x3a196a,null));};exports[_0x85da('0x67')]=function(_0x5976e0,_0x6e47c,_0x225583){var _0x15ebce=_0x5976e0[_0x85da('0x50')][_0x85da('0x68')];var _0x41cac2=_['map'](_0x15ebce,'id');return db['Team']['findAll']({'where':{'id':_0x41cac2},'attributes':['id'],'include':[{'model':db[_0x85da('0x69')],'as':'Agents','attributes':['id',_0x85da('0x34'),'online',_0x85da('0x6a'),_0x85da('0x6b')],'raw':!![]}]})[_0x85da('0x28')](function(_0x59f880){if(_0x59f880){var _0x55e070=_[_0x85da('0x6c')](_0x59f880,function(_0x521b9e){var _0x43f36f=_0x521b9e['get']({'plain':!![]});_0x43f36f[_0x85da('0x6d')]['forEach'](function(_0x5adeb7){_0x5adeb7[_0x85da('0x6e')]=_[_0x85da('0x33')](_0x15ebce,{'id':_0x43f36f['id']})['penalty'];});return _0x43f36f[_0x85da('0x6d')];});return db['VoiceQueue'][_0x85da('0x33')]({'where':{'id':_0x5976e0[_0x85da('0x4b')]['id']}})['then'](function(_0x374afc){return db[_0x85da('0x6f')]['transaction'](function(_0x362ffc){return _0x374afc['addTeams'](_0x41cac2,{'transaction':_0x362ffc})[_0x85da('0x28')](function(){return BPromise['each'](_0x15ebce,function(_0x22109a){return db[_0x85da('0x70')][_0x85da('0x71')]({'TeamId':_0x22109a['id'],'VoiceQueueId':_0x5976e0[_0x85da('0x4b')]['id'],'penalty':_0x22109a[_0x85da('0x6e')]},{'transaction':_0x362ffc});});})[_0x85da('0x28')](function(){return BPromise[_0x85da('0x72')](_0x55e070,function(_0x961354){return db[_0x85da('0x73')][_0x85da('0x74')]({'where':{'UserId':_0x961354['id'],'VoiceQueueId':_0x5976e0[_0x85da('0x4b')]['id']},'defaults':{'penalty':_0x961354[_0x85da('0x6e')]},'transaction':_0x362ffc});});})[_0x85da('0x28')](function(){return BPromise[_0x85da('0x72')](_[_0x85da('0x2e')](_0x55e070,{'online':!![]}),function(_0x13e759){return db[_0x85da('0x75')]['upsert']({'membername':_0x13e759[_0x85da('0x34')],'UserId':_0x13e759['id'],'queue_name':_0x374afc[_0x85da('0x34')],'VoiceQueueId':_0x374afc['id'],'interface':_[_0x85da('0x76')](_0x13e759[_0x85da('0x6b')])?util[_0x85da('0x77')](_0x85da('0x78'),_0x13e759[_0x85da('0x34')]):_0x13e759[_0x85da('0x6b')],'paused':_0x13e759[_0x85da('0x6a')]||![],'penalty':_0x13e759[_0x85da('0x6e')]},{'transaction':_0x362ffc});});})['then'](function(){_0x55e070[_0x85da('0x79')](function(_0xe5db93){socket['emit'](_0x85da('0x7a'),{'UserId':_0xe5db93['id'],'VoiceQueueId':_0x374afc['id']});});});});});}})[_0x85da('0x28')](respondWithStatusCode(_0x6e47c,null))[_0x85da('0x58')](handleError(_0x6e47c,null));};exports[_0x85da('0x7b')]=function(_0xf5f86e,_0x5e6a79,_0x3c04a7){return db['Team']['findAll']({'where':{'id':_0xf5f86e[_0x85da('0x3b')][_0x85da('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x85da('0x69')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5e6a79,null))[_0x85da('0x28')](function(_0x27c4bc){var _0xf53081=_[_0x85da('0x30')](_0x27c4bc,'id');var _0x30c787=[];var _0x2d251c=[];var _0x38fd55=squel['select']();_0x38fd55[_0x85da('0x7d')]('tq.TeamId')[_0x85da('0x7e')](_0x85da('0x7f'),'tq')[_0x85da('0x80')](_0x85da('0x81'),'ut',_0x85da('0x82'))[_0x85da('0x44')](_0x85da('0x83'),_0xf5f86e[_0x85da('0x4b')]['id']);for(var _0x3326ed=0x0;_0x3326ed<_0x27c4bc['length'];_0x3326ed+=0x1){let _0x1d339a=_0x27c4bc[_0x3326ed];for(var _0x2ad3dc=0x0;_0x2ad3dc<_0x1d339a[_0x85da('0x6d')][_0x85da('0x42')];_0x2ad3dc+=0x1){let _0x152cb2=_0x1d339a[_0x85da('0x6d')][_0x2ad3dc];var _0x32db8f=_0x38fd55[_0x85da('0x56')]();_0x32db8f[_0x85da('0x44')](_0x85da('0x84'),_0x152cb2['id']);_0x2d251c[_0x85da('0x85')](db['sequelize'][_0x85da('0x3b')](_0x32db8f[_0x85da('0x86')](),{'type':db[_0x85da('0x6f')][_0x85da('0x87')][_0x85da('0x88')]})[_0x85da('0x28')](function(_0x4374b7){if(_0x4374b7['length']===0x1){return _0x152cb2['id'];}else{var _0x5defc2=_[_0x85da('0x89')](_['map'](_0x4374b7,_0x85da('0x8a')),function(_0x4bb437){return _['includes'](_0xf53081,_0x4bb437);});if(_0x5defc2){return _0x152cb2['id'];}}}));}}return BPromise[_0x85da('0x8b')](_0x2d251c)[_0x85da('0x28')](function(_0x4ddc37){_0x30c787=_(_0x30c787)[_0x85da('0x8c')](_0x4ddc37)['compact']()[_0x85da('0x31')]();return db['VoiceQueue']['find']({'where':{'id':_0xf5f86e[_0x85da('0x4b')]['id']}})['then'](function(_0x459a98){return db[_0x85da('0x6f')][_0x85da('0x8d')](function(_0x307ad4){return _0x459a98['removeTeams'](_0xf5f86e[_0x85da('0x3b')][_0x85da('0x7c')],{'transaction':_0x307ad4})[_0x85da('0x28')](function(){if(!_[_0x85da('0x8e')](_0x30c787)){return _0x459a98[_0x85da('0x8f')](_0x30c787,{'transaction':_0x307ad4})[_0x85da('0x28')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xf5f86e[_0x85da('0x4b')]['id'],'UserId':_0x30c787},'transaction':_0x307ad4});});}})[_0x85da('0x28')](function(){_0x30c787[_0x85da('0x79')](function(_0x465447){socket[_0x85da('0x90')](_0x85da('0x91'),{'UserId':_0x465447,'VoiceQueueId':_0x459a98['id']});});});});});});})[_0x85da('0x28')](respondWithStatusCode(_0x5e6a79,null))[_0x85da('0x58')](handleError(_0x5e6a79,null));};exports[_0x85da('0x92')]=function(_0xaa5f9b,_0x563e78,_0x8e7a4e){var _0x2644f9,_0x417ed8;return db['VoiceQueue'][_0x85da('0x33')]({'where':{'id':_0xaa5f9b[_0x85da('0x4b')]['id']}})['then'](handleEntityNotFound(_0x563e78,null))[_0x85da('0x28')](function(_0x339edf){if(_0x339edf){_0x417ed8=_0x339edf;return _0x339edf[_0x85da('0x92')](_0xaa5f9b[_0x85da('0x50')][_0x85da('0x7c')],_[_0x85da('0x57')](_0xaa5f9b[_0x85da('0x50')],[_0x85da('0x7c'),'id'])||{})[_0x85da('0x93')](function(_0x23981a){for(var _0x555cc9=0x0;_0x555cc9<_0xaa5f9b[_0x85da('0x50')][_0x85da('0x7c')]['length'];_0x555cc9+=0x1){socket[_0x85da('0x90')](_0x85da('0x7a'),{'UserId':_0xaa5f9b[_0x85da('0x50')]['ids'][_0x555cc9],'VoiceQueueId':_0xaa5f9b[_0x85da('0x4b')]['id']});}return _0x23981a;});}})['then'](function(_0x13a7f4){_0x2644f9=_0x13a7f4||[];if(_0x417ed8){return db[_0x85da('0x69')][_0x85da('0x49')]({'where':{'id':_0xaa5f9b['body'][_0x85da('0x7c')]},'attributes':['id',_0x85da('0x34'),_0x85da('0x94'),'voicePause',_0x85da('0x6b')],'raw':!![]});}})[_0x85da('0x28')](function(_0x62f248){if(!_[_0x85da('0x8e')](_0x62f248)){var _0x2fcb91=[];for(var _0x431787=0x0;_0x431787<_0x62f248[_0x85da('0x42')];_0x431787++){if(_0x62f248[_0x431787][_0x85da('0x94')]){_0x2fcb91['push'](db[_0x85da('0x75')]['upsert']({'membername':_0x62f248[_0x431787]['name'],'UserId':_0x62f248[_0x431787]['id'],'queue_name':_0x417ed8['name'],'VoiceQueueId':_0x417ed8['id'],'interface':_[_0x85da('0x76')](_0x62f248[_0x431787][_0x85da('0x6b')])?util[_0x85da('0x77')](_0x85da('0x78'),_0x62f248[_0x431787][_0x85da('0x34')]):_0x62f248[_0x431787][_0x85da('0x6b')],'paused':_0x62f248[_0x431787][_0x85da('0x6a')]||![],'penalty':_0xaa5f9b[_0x85da('0x50')]['penalty']||0x0}));}}return BPromise['all'](_0x2fcb91);}})[_0x85da('0x28')](function(){return _0x2644f9;})['then'](respondWithResult(_0x563e78,null))[_0x85da('0x58')](handleError(_0x563e78,null));};exports['removeAgents']=function(_0x2dbe5a,_0xea0b4a,_0x4bbf4a){return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x2dbe5a[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0xea0b4a,null))[_0x85da('0x28')](function(_0x1eb5a2){if(_0x1eb5a2){return _0x1eb5a2[_0x85da('0x8f')](_0x2dbe5a[_0x85da('0x3b')][_0x85da('0x7c')])[_0x85da('0x28')](function(){if(_[_0x85da('0x95')](_0x2dbe5a[_0x85da('0x3b')]['ids'])){for(var _0x398c4b=0x0;_0x398c4b<_0x2dbe5a[_0x85da('0x3b')]['ids'][_0x85da('0x42')];_0x398c4b+=0x1){socket[_0x85da('0x90')]('userVoiceQueue:remove',{'UserId':Number(_0x2dbe5a[_0x85da('0x3b')][_0x85da('0x7c')][_0x398c4b]),'VoiceQueueId':Number(_0x2dbe5a[_0x85da('0x4b')]['id'])});}}else{socket[_0x85da('0x90')](_0x85da('0x91'),{'UserId':Number(_0x2dbe5a[_0x85da('0x3b')][_0x85da('0x7c')]),'VoiceQueueId':Number(_0x2dbe5a[_0x85da('0x4b')]['id'])});}});}})[_0x85da('0x28')](function(_0x55718f){return db[_0x85da('0x75')][_0x85da('0x29')]({'where':{'VoiceQueueId':_0x2dbe5a[_0x85da('0x4b')]['id'],'UserId':_0x2dbe5a[_0x85da('0x3b')][_0x85da('0x7c')]}})[_0x85da('0x28')](function(){return _0x55718f;});})[_0x85da('0x28')](respondWithStatusCode(_0xea0b4a,null))[_0x85da('0x58')](handleError(_0xea0b4a,null));};exports[_0x85da('0x96')]=function(_0x1379b9,_0x5ba69a,_0x4c3900){var _0x56fc06={};var _0x29f6fc={};var _0x332749;var _0x16c02b;return db['VoiceQueue']['findOne']({'where':{'id':_0x1379b9[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x5ba69a,null))[_0x85da('0x28')](function(_0x25b15a){if(_0x25b15a){_0x332749=_0x25b15a;_0x29f6fc['model']=_['keys'](db[_0x85da('0x69')]['rawAttributes']);_0x29f6fc[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x1379b9['query']);_0x29f6fc[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x29f6fc['model'],_0x29f6fc[_0x85da('0x3b')]);_0x56fc06[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x29f6fc[_0x85da('0x3f')],qs['fields'](_0x1379b9['query']['fields']));_0x56fc06[_0x85da('0x40')]=_0x56fc06['attributes'][_0x85da('0x42')]?_0x56fc06['attributes']:_0x29f6fc['model'];_0x56fc06['order']=qs['sort'](_0x1379b9[_0x85da('0x3b')][_0x85da('0x43')]);_0x56fc06[_0x85da('0x44')]=qs[_0x85da('0x3d')](_['pick'](_0x1379b9['query'],_0x29f6fc['filters']));if(_0x1379b9[_0x85da('0x3b')][_0x85da('0x2e')]){_0x56fc06['where']=_[_0x85da('0x47')](_0x56fc06['where'],{'$or':_[_0x85da('0x30')](_0x56fc06[_0x85da('0x40')],function(_0x5bcc16){var _0x3e8675={};_0x3e8675[_0x5bcc16]={'$like':'%'+_0x1379b9['query'][_0x85da('0x2e')]+'%'};return _0x3e8675;})});}_0x56fc06=_[_0x85da('0x47')]({},_0x56fc06,_0x1379b9[_0x85da('0x48')]);return _0x332749[_0x85da('0x96')](_0x56fc06);}})[_0x85da('0x28')](function(_0xfacd7e){if(_0xfacd7e){_0x16c02b=_0xfacd7e[_0x85da('0x42')];if(!_0x1379b9['query'][_0x85da('0x5c')]('nolimit')){_0x56fc06[_0x85da('0x21')]=qs[_0x85da('0x21')](_0x1379b9[_0x85da('0x3b')][_0x85da('0x21')]);_0x56fc06['offset']=qs['offset'](_0x1379b9[_0x85da('0x3b')][_0x85da('0x20')]);}return _0x332749['getAgents'](_0x56fc06);}})[_0x85da('0x28')](function(_0xf818e){if(_0xf818e){return _0xf818e?{'count':_0x16c02b,'rows':_0xf818e}:null;}})['then'](respondWithResult(_0x5ba69a,null))[_0x85da('0x58')](handleError(_0x5ba69a,null));};exports[_0x85da('0x97')]=function(_0x34447a,_0x53245e,_0x26a521){var _0x5276fc={};var _0x485ea6={};var _0x362529;var _0x5569b7;return db[_0x85da('0x39')][_0x85da('0x5a')]({'where':{'id':_0x34447a[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x53245e,null))['then'](function(_0x1ac85e){if(_0x1ac85e){_0x362529=_0x1ac85e;_0x485ea6['model']=_[_0x85da('0x3c')](db[_0x85da('0x75')][_0x85da('0x4c')]);_0x485ea6[_0x85da('0x3b')]=_['keys'](_0x34447a['query']);_0x485ea6[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x485ea6[_0x85da('0x3f')],_0x485ea6[_0x85da('0x3b')]);_0x5276fc[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x485ea6[_0x85da('0x3f')],qs[_0x85da('0x41')](_0x34447a['query'][_0x85da('0x41')]));_0x5276fc[_0x85da('0x40')]=_0x5276fc['attributes'][_0x85da('0x42')]?_0x5276fc[_0x85da('0x40')]:_0x485ea6['model'];_0x5276fc[_0x85da('0x5e')]=qs[_0x85da('0x43')](_0x34447a[_0x85da('0x3b')][_0x85da('0x43')]);_0x5276fc[_0x85da('0x44')]=qs[_0x85da('0x3d')](_[_0x85da('0x45')](_0x34447a[_0x85da('0x3b')],_0x485ea6[_0x85da('0x3d')]));if(_0x34447a['query'][_0x85da('0x2e')]){_0x5276fc['where']=_[_0x85da('0x47')](_0x5276fc['where'],{'$or':_[_0x85da('0x30')](_0x5276fc['attributes'],function(_0x322fcf){var _0x2ba409={};_0x2ba409[_0x322fcf]={'$like':'%'+_0x34447a['query'][_0x85da('0x2e')]+'%'};return _0x2ba409;})});}_0x5276fc=_[_0x85da('0x47')]({},_0x5276fc,_0x34447a['options']);return _0x362529[_0x85da('0x97')](_0x5276fc);}})[_0x85da('0x28')](function(_0x1cd293){if(_0x1cd293){_0x5569b7=_0x1cd293[_0x85da('0x42')];if(!_0x34447a[_0x85da('0x3b')][_0x85da('0x5c')](_0x85da('0x5d'))){_0x5276fc['limit']=qs['limit'](_0x34447a[_0x85da('0x3b')][_0x85da('0x21')]);_0x5276fc[_0x85da('0x20')]=qs[_0x85da('0x20')](_0x34447a[_0x85da('0x3b')]['offset']);}return _0x362529[_0x85da('0x97')](_0x5276fc);}})[_0x85da('0x28')](function(_0x4fe426){return _0x4fe426?{'count':_0x5569b7,'rows':_0x4fe426}:null;})['then'](respondWithResult(_0x53245e,null))[_0x85da('0x58')](handleError(_0x53245e,null));};exports['getLists']=function(_0x55924a,_0x1d1dd5,_0x3ccc2c){var _0x207b3e={};var _0x180674={};var _0x2000db;var _0x1412a8;return db[_0x85da('0x39')][_0x85da('0x5a')]({'where':{'id':_0x55924a[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x1d1dd5,null))[_0x85da('0x28')](function(_0x4df372){if(_0x4df372){_0x2000db=_0x4df372;_0x180674[_0x85da('0x3f')]=_['keys'](db[_0x85da('0x98')][_0x85da('0x4c')]);_0x180674['query']=_['keys'](_0x55924a[_0x85da('0x3b')]);_0x180674['filters']=_[_0x85da('0x3e')](_0x180674[_0x85da('0x3f')],_0x180674['query']);_0x207b3e[_0x85da('0x40')]=_['intersection'](_0x180674['model'],qs[_0x85da('0x41')](_0x55924a[_0x85da('0x3b')][_0x85da('0x41')]));_0x207b3e['attributes']=_0x207b3e[_0x85da('0x40')][_0x85da('0x42')]?_0x207b3e['attributes']:_0x180674[_0x85da('0x3f')];_0x207b3e['order']=qs[_0x85da('0x43')](_0x55924a['query'][_0x85da('0x43')]);_0x207b3e[_0x85da('0x44')]=qs[_0x85da('0x3d')](_[_0x85da('0x45')](_0x55924a[_0x85da('0x3b')],_0x180674[_0x85da('0x3d')]));if(_0x55924a[_0x85da('0x3b')][_0x85da('0x2e')]){_0x207b3e['where']=_[_0x85da('0x47')](_0x207b3e[_0x85da('0x44')],{'$or':_[_0x85da('0x30')](_0x207b3e[_0x85da('0x40')],function(_0x4fc3a5){var _0x1ef426={};_0x1ef426[_0x4fc3a5]={'$like':'%'+_0x55924a[_0x85da('0x3b')]['filter']+'%'};return _0x1ef426;})});}_0x207b3e=_[_0x85da('0x47')]({},_0x207b3e,_0x55924a[_0x85da('0x48')]);return _0x2000db[_0x85da('0x99')](_0x207b3e);}})['then'](function(_0x13c16f){if(_0x13c16f){_0x1412a8=_0x13c16f[_0x85da('0x42')];if(!_0x55924a['query'][_0x85da('0x5c')](_0x85da('0x5d'))){_0x207b3e['limit']=qs[_0x85da('0x21')](_0x55924a[_0x85da('0x3b')][_0x85da('0x21')]);_0x207b3e['offset']=qs[_0x85da('0x20')](_0x55924a['query'][_0x85da('0x20')]);}return _0x2000db[_0x85da('0x99')](_0x207b3e);}})[_0x85da('0x28')](function(_0x438bb7){if(_0x438bb7){return _0x438bb7?{'count':_0x1412a8,'rows':_0x438bb7}:null;}})[_0x85da('0x28')](respondWithResult(_0x1d1dd5,null))['catch'](handleError(_0x1d1dd5,null));};exports[_0x85da('0x9a')]=function(_0x2aeae7,_0x1ec1e7,_0x5b3a5c){var _0xb85c82,_0x14cf8b;return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x2aeae7['params']['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x1ec1e7,null))[_0x85da('0x28')](function(_0x2b9330){if(_0x2b9330){_0x14cf8b=_0x2b9330;return _0x2b9330[_0x85da('0x9a')](_0x2aeae7[_0x85da('0x50')][_0x85da('0x7c')],_[_0x85da('0x57')](_0x2aeae7[_0x85da('0x50')],[_0x85da('0x7c'),'id'])||{});}return null;})['spread'](function(_0x202396){var _0x405468;_0xb85c82=_0x202396||[];var _0x545385=[];if(_0x202396){for(var _0x1dacee=0x0;_0x1dacee<_0x202396[_0x85da('0x42')];_0x1dacee+=0x1){var _0x4281aa=_0x202396[_0x1dacee][_0x85da('0x52')]({'plain':!![]});_0x14cf8b['dialCheckDuplicateType']=_0x2aeae7['body']['dialCheckDuplicateType']?_0x2aeae7['body'][_0x85da('0x9b')]:_0x14cf8b[_0x85da('0x9b')];switch(_0x14cf8b['dialCheckDuplicateType']){case _0x85da('0x9c'):_0x405468=squel[_0x85da('0x9d')]()['into'](_0x85da('0x9e'))[_0x85da('0x9f')]([_0x85da('0xa0'),_0x85da('0xa1'),'ContactId',_0x85da('0xa2'),'VoiceQueueId','createdAt',_0x85da('0xa3')],squel[_0x85da('0xa4')]()[_0x85da('0x7d')]('phone','phone')[_0x85da('0x7d')](_0x85da('0xa5'),'scheduledAt')[_0x85da('0x7d')]('id',_0x85da('0xa6'))[_0x85da('0x7d')](_0x4281aa[_0x85da('0xa7')][_0x85da('0x86')](),_0x85da('0xa2'))[_0x85da('0x7d')](_0x2aeae7[_0x85da('0x4b')]['id'][_0x85da('0x86')](),'VoiceQueueId')[_0x85da('0x7d')](_0x85da('0xa5'),_0x85da('0xa8'))[_0x85da('0x7d')](_0x85da('0xa5'),'updatedAt')[_0x85da('0x7e')](_0x85da('0xa9'))[_0x85da('0x44')](_0x85da('0xaa'))[_0x85da('0x44')](_0x85da('0xab'),_0x4281aa[_0x85da('0xa7')][_0x85da('0x86')]())[_0x85da('0x44')](_0x85da('0xac'))['where'](_0x85da('0xad'),squel['select']()[_0x85da('0x7d')](_0x85da('0xae'))[_0x85da('0x7e')](_0x85da('0xaf'))[_0x85da('0x44')](_0x85da('0x83'),_0x2aeae7[_0x85da('0x4b')]['id'][_0x85da('0x86')]()))[_0x85da('0x44')](_0x85da('0xad'),squel[_0x85da('0xa4')]()[_0x85da('0x7d')]('COALESCE(phone,\x27\x27)')['from'](_0x85da('0x9e'))[_0x85da('0x44')](_0x85da('0x83'),_0x2aeae7['params']['id']['toString']())))[_0x85da('0x86')]();break;case'onlyIfOpen':_0x405468=squel['insert']()[_0x85da('0xb0')](_0x85da('0x9e'))[_0x85da('0x9f')]([_0x85da('0xa0'),_0x85da('0xa1'),_0x85da('0xa6'),_0x85da('0xa2'),_0x85da('0x5f'),_0x85da('0xa8'),_0x85da('0xa3')],squel[_0x85da('0xa4')]()['field']('phone','phone')[_0x85da('0x7d')](_0x85da('0xa5'),'scheduledAt')['field']('id','ContactId')['field'](_0x4281aa['CmListId']['toString'](),_0x85da('0xa2'))['field'](_0x2aeae7[_0x85da('0x4b')]['id']['toString'](),_0x85da('0x5f'))['field'](_0x85da('0xa5'),_0x85da('0xa8'))[_0x85da('0x7d')](_0x85da('0xa5'),_0x85da('0xa3'))['from'](_0x85da('0xa9'))['where'](_0x85da('0xaa'))[_0x85da('0x44')](_0x85da('0xab'),_0x4281aa[_0x85da('0xa7')][_0x85da('0x86')]())[_0x85da('0x44')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x85da('0xad'),squel[_0x85da('0xa4')]()['field'](_0x85da('0xb1'))['from'](_0x85da('0x9e'))[_0x85da('0x44')](_0x85da('0x83'),_0x2aeae7[_0x85da('0x4b')]['id'][_0x85da('0x86')]())))[_0x85da('0x86')]();break;default:_0x405468=squel[_0x85da('0x9d')]()[_0x85da('0xb0')](_0x85da('0x9e'))[_0x85da('0x9f')]([_0x85da('0xa0'),'scheduledAt',_0x85da('0xa6'),_0x85da('0xa2'),_0x85da('0x5f'),'createdAt',_0x85da('0xa3')],squel[_0x85da('0xa4')]()['field']('phone',_0x85da('0xa0'))[_0x85da('0x7d')](_0x85da('0xa5'),'scheduledAt')[_0x85da('0x7d')]('id',_0x85da('0xa6'))[_0x85da('0x7d')](_0x4281aa[_0x85da('0xa7')]['toString'](),_0x85da('0xa2'))[_0x85da('0x7d')](_0x2aeae7[_0x85da('0x4b')]['id'][_0x85da('0x86')](),_0x85da('0x5f'))[_0x85da('0x7d')](_0x85da('0xa5'),_0x85da('0xa8'))[_0x85da('0x7d')](_0x85da('0xa5'),'updatedAt')['from'](_0x85da('0xa9'))[_0x85da('0x44')](_0x85da('0xaa'))[_0x85da('0x44')](_0x85da('0xab'),_0x4281aa[_0x85da('0xa7')][_0x85da('0x86')]())[_0x85da('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x85da('0x86')]();}_0x545385[_0x85da('0x85')](db['sequelize'][_0x85da('0x3b')](_0x405468));}return BPromise[_0x85da('0x8b')](_0x545385);}})['then'](function(){return _0xb85c82;})[_0x85da('0x28')](respondWithResult(_0x1ec1e7,null))[_0x85da('0x58')](handleError(_0x1ec1e7,null));};exports[_0x85da('0xb2')]=function(_0x532bc9,_0x44a285,_0x2cf0c8){return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x532bc9['params']['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x44a285,null))['then'](function(_0xb92395){if(_0xb92395){return _0xb92395[_0x85da('0xb2')](_0x532bc9[_0x85da('0x3b')][_0x85da('0x7c')]);}})['then'](function(_0x1ee068){if(_0x1ee068){return db[_0x85da('0x5b')][_0x85da('0x29')]({'where':{'ListId':_0x532bc9[_0x85da('0x3b')][_0x85da('0x7c')],'VoiceQueueId':_0x532bc9[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](function(){return _0x1ee068;});}})['then'](respondWithStatusCode(_0x44a285,null))[_0x85da('0x58')](handleError(_0x44a285,null));};exports['getBlackLists']=function(_0x2b2137,_0x56ffa1,_0x4d4eb8){var _0x247eac={};var _0x57395b={};var _0x28e454;var _0x5d3d2d;return db[_0x85da('0x39')][_0x85da('0x5a')]({'where':{'id':_0x2b2137[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x56ffa1,null))['then'](function(_0x4bd3e3){if(_0x4bd3e3){_0x28e454=_0x4bd3e3;_0x57395b['model']=_[_0x85da('0x3c')](db[_0x85da('0x98')]['rawAttributes']);_0x57395b[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x2b2137['query']);_0x57395b[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x57395b[_0x85da('0x3f')],_0x57395b[_0x85da('0x3b')]);_0x247eac['attributes']=_[_0x85da('0x3e')](_0x57395b[_0x85da('0x3f')],qs[_0x85da('0x41')](_0x2b2137['query'][_0x85da('0x41')]));_0x247eac[_0x85da('0x40')]=_0x247eac[_0x85da('0x40')]['length']?_0x247eac[_0x85da('0x40')]:_0x57395b[_0x85da('0x3f')];_0x247eac[_0x85da('0x5e')]=qs['sort'](_0x2b2137[_0x85da('0x3b')]['sort']);_0x247eac[_0x85da('0x44')]=qs[_0x85da('0x3d')](_['pick'](_0x2b2137[_0x85da('0x3b')],_0x57395b[_0x85da('0x3d')]));if(_0x2b2137[_0x85da('0x3b')][_0x85da('0x2e')]){_0x247eac[_0x85da('0x44')]=_[_0x85da('0x47')](_0x247eac[_0x85da('0x44')],{'$or':_[_0x85da('0x30')](_0x247eac['attributes'],function(_0x28841c){var _0x263ec8={};_0x263ec8[_0x28841c]={'$like':'%'+_0x2b2137[_0x85da('0x3b')][_0x85da('0x2e')]+'%'};return _0x263ec8;})});}_0x247eac=_[_0x85da('0x47')]({},_0x247eac,_0x2b2137['options']);return _0x28e454[_0x85da('0xb3')](_0x247eac);}})['then'](function(_0x4b63fa){if(_0x4b63fa){_0x5d3d2d=_0x4b63fa[_0x85da('0x42')];if(!_0x2b2137[_0x85da('0x3b')][_0x85da('0x5c')]('nolimit')){_0x247eac[_0x85da('0x21')]=qs[_0x85da('0x21')](_0x2b2137['query'][_0x85da('0x21')]);_0x247eac[_0x85da('0x20')]=qs[_0x85da('0x20')](_0x2b2137[_0x85da('0x3b')][_0x85da('0x20')]);}return _0x28e454[_0x85da('0xb3')](_0x247eac);}})['then'](function(_0x5e3efd){if(_0x5e3efd){return _0x5e3efd?{'count':_0x5d3d2d,'rows':_0x5e3efd}:null;}})[_0x85da('0x28')](respondWithResult(_0x56ffa1,null))[_0x85da('0x58')](handleError(_0x56ffa1,null));};exports['addBlackLists']=function(_0x58d927,_0xdf8d71,_0x131c70){var _0x43cb1d,_0x528cf6;return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x58d927[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0xdf8d71,null))[_0x85da('0x28')](function(_0x43c551){if(_0x43c551){_0x528cf6=_0x43c551;return _0x43c551[_0x85da('0xb4')](_0x58d927[_0x85da('0x50')][_0x85da('0x7c')],_['omit'](_0x58d927[_0x85da('0x50')],[_0x85da('0x7c'),'id'])||{});}return null;})['spread'](function(_0x2fc30c){var _0x1dc7ee;_0x43cb1d=_0x2fc30c||[];var _0x16b514=[];if(_0x2fc30c){for(var _0xc53e8b=0x0;_0xc53e8b<_0x2fc30c[_0x85da('0x42')];_0xc53e8b+=0x1){var _0x16c7e2=_0x2fc30c[_0xc53e8b]['get']({'plain':!![]});_0x1dc7ee=squel[_0x85da('0x9d')]()[_0x85da('0xb0')](_0x85da('0xb5'))[_0x85da('0x9f')]([_0x85da('0xa0'),_0x85da('0xa6'),_0x85da('0xa2'),'VoiceQueueId','createdAt',_0x85da('0xa3')],squel[_0x85da('0xa4')]()[_0x85da('0x7d')](_0x85da('0xa0'),'phone')['field']('id','ContactId')[_0x85da('0x7d')](_0x16c7e2[_0x85da('0xa7')][_0x85da('0x86')](),'ListId')['field'](_0x58d927[_0x85da('0x4b')]['id'][_0x85da('0x86')](),'VoiceQueueId')[_0x85da('0x7d')]('NOW()','createdAt')[_0x85da('0x7d')](_0x85da('0xa5'),_0x85da('0xa3'))[_0x85da('0x7e')]('cm_contacts')[_0x85da('0x44')](_0x85da('0xaa'))['where']('ListId\x20=\x20?',_0x16c7e2['CmListId'][_0x85da('0x86')]())[_0x85da('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x85da('0x86')]();_0x16b514['push'](db['sequelize'][_0x85da('0x3b')](_0x1dc7ee));}return BPromise['all'](_0x16b514);}})['then'](function(){return _0x43cb1d;})[_0x85da('0x28')](respondWithResult(_0xdf8d71,null))[_0x85da('0x58')](handleError(_0xdf8d71,null));};exports[_0x85da('0xb6')]=function(_0x5ab6e6,_0x4d9101,_0x1080b4){return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x5ab6e6['params']['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x4d9101,null))['then'](function(_0x5d9095){if(_0x5d9095){return _0x5d9095['removeBlackLists'](_0x5ab6e6[_0x85da('0x3b')][_0x85da('0x7c')]);}})[_0x85da('0x28')](function(_0x5e57d3){if(_0x5e57d3){return db[_0x85da('0x64')][_0x85da('0x29')]({'where':{'ListId':_0x5ab6e6[_0x85da('0x3b')][_0x85da('0x7c')],'VoiceQueueId':_0x5ab6e6[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](function(){return _0x5e57d3;});}})[_0x85da('0x28')](respondWithStatusCode(_0x4d9101,null))[_0x85da('0x58')](handleError(_0x4d9101,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 5b4a40f..338000c 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 _0x366a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','remove'];(function(_0x22117c,_0x232158){var _0x323cf4=function(_0x2abaec){while(--_0x2abaec){_0x22117c['push'](_0x22117c['shift']());}};_0x323cf4(++_0x232158);}(_0x366a,0x130));var _0xa366=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x366a[_0x5e709a];return _0x57401a;};'use strict';var EventEmitter=require(_0xa366('0x0'));var VoiceQueue=require(_0xa366('0x1'))['db'][_0xa366('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa366('0x3')](0x0);var events={'afterCreate':_0xa366('0x4'),'afterUpdate':'update','afterDestroy':_0xa366('0x5')};function emitEvent(_0x2b2b87){return function(_0x21115b,_0x1a2ba5,_0x35acab){VoiceQueueEvents[_0xa366('0x6')](_0x2b2b87+':'+_0x21115b['id'],_0x21115b);VoiceQueueEvents[_0xa366('0x6')](_0x2b2b87,_0x21115b);_0x35acab(null);};}for(var e in events){if(events[_0xa366('0x7')](e)){var event=events[e];VoiceQueue[_0xa366('0x8')](e,emitEvent(event));}}module[_0xa366('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x29f3=['update','remove','emit','hasOwnProperty','hook','exports','VoiceQueue','setMaxListeners','save'];(function(_0x51bac5,_0x374b6b){var _0x39b0d6=function(_0x36b4d4){while(--_0x36b4d4){_0x51bac5['push'](_0x51bac5['shift']());}};_0x39b0d6(++_0x374b6b);}(_0x29f3,0x1d1));var _0x329f=function(_0x47f063,_0x3f7b29){_0x47f063=_0x47f063-0x0;var _0x31cd21=_0x29f3[_0x47f063];return _0x31cd21;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x329f('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x329f('0x1')](0x0);var events={'afterCreate':_0x329f('0x2'),'afterUpdate':_0x329f('0x3'),'afterDestroy':_0x329f('0x4')};function emitEvent(_0x6df01b){return function(_0x2435b2,_0xa0c829,_0x519b76){VoiceQueueEvents['emit'](_0x6df01b+':'+_0x2435b2['id'],_0x2435b2);VoiceQueueEvents[_0x329f('0x5')](_0x6df01b,_0x2435b2);_0x519b76(null);};}for(var e in events){if(events[_0x329f('0x6')](e)){var event=events[e];VoiceQueue[_0x329f('0x7')](e,emitEvent(event));}}module[_0x329f('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index eae2fea..ce4db4b 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 _0xbca0=['VoiceQueue','voice_queues','lodash','util','api','request-promise','path','rimraf','./voiceQueue.attributes','exports','define'];(function(_0x225c70,_0x462188){var _0x31882c=function(_0x6ed9aa){while(--_0x6ed9aa){_0x225c70['push'](_0x225c70['shift']());}};_0x31882c(++_0x462188);}(_0xbca0,0xc8));var _0x0bca=function(_0x18dc52,_0x13841e){_0x18dc52=_0x18dc52-0x0;var _0x52f417=_0xbca0[_0x18dc52];return _0x52f417;};'use strict';var _=require(_0x0bca('0x0'));var util=require(_0x0bca('0x1'));var logger=require('../../config/logger')(_0x0bca('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0bca('0x3'));var fs=require('fs');var path=require(_0x0bca('0x4'));var rimraf=require(_0x0bca('0x5'));var config=require('../../config/environment');var attributes=require(_0x0bca('0x6'));module[_0x0bca('0x7')]=function(_0xd127f6,_0x2f10c8){return _0xd127f6[_0x0bca('0x8')](_0x0bca('0x9'),attributes,{'tableName':_0x0bca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x522a=['../../config/logger','moment','bluebird','path','rimraf','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash','util'];(function(_0x461719,_0x51d1f3){var _0x3098b5=function(_0x11a389){while(--_0x11a389){_0x461719['push'](_0x461719['shift']());}};_0x3098b5(++_0x51d1f3);}(_0x522a,0x166));var _0xa522=function(_0x1476fb,_0x467d01){_0x1476fb=_0x1476fb-0x0;var _0x44f57e=_0x522a[_0x1476fb];return _0x44f57e;};'use strict';var _=require(_0xa522('0x0'));var util=require(_0xa522('0x1'));var logger=require(_0xa522('0x2'))('api');var moment=require(_0xa522('0x3'));var BPromise=require(_0xa522('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa522('0x5'));var rimraf=require(_0xa522('0x6'));var config=require('../../config/environment');var attributes=require(_0xa522('0x7'));module[_0xa522('0x8')]=function(_0x8eae0e,_0x404285){return _0x8eae0e[_0xa522('0x9')](_0xa522('0xa'),attributes,{'tableName':_0xa522('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 47dff25..af87607 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 _0xfe9c=['model','ShowVoiceQueue','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueue','findAll','options','raw','attributes','limit','include','map','catch','VoiceQueue','find'];(function(_0x2cda55,_0x470473){var _0x263762=function(_0x47c9c9){while(--_0x47c9c9){_0x2cda55['push'](_0x2cda55['shift']());}};_0x263762(++_0x470473);}(_0xfe9c,0x174));var _0xcfe9=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xfe9c[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xcfe9('0x0'));var util=require(_0xcfe9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfe9('0x2'))['db'];var utils=require(_0xcfe9('0x3'));var logger=require('../../config/logger')(_0xcfe9('0x4'));var config=require(_0xcfe9('0x5'));var jayson=require(_0xcfe9('0x6'));var client=jayson[_0xcfe9('0x7')][_0xcfe9('0x8')]({'port':0x232a});config[_0xcfe9('0x9')]=_[_0xcfe9('0xa')](config[_0xcfe9('0x9')],{'host':_0xcfe9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfe9('0x9')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x31b8f6,_0x3865a3,_0x58e271){return new BPromise(function(_0x106010,_0x38028e){return client[_0xcfe9('0xc')](_0x31b8f6,_0x58e271)[_0xcfe9('0xd')](function(_0x7f11db){logger[_0xcfe9('0xe')](_0xcfe9('0xf'),_0x3865a3,_0xcfe9('0x10'));logger[_0xcfe9('0x11')](_0xcfe9('0x12'),_0x3865a3,_0xcfe9('0x10'),JSON[_0xcfe9('0x13')](_0x7f11db));if(_0x7f11db[_0xcfe9('0x14')]){if(_0x7f11db['error'][_0xcfe9('0x15')]===0x1f4){logger[_0xcfe9('0x14')](_0xcfe9('0xf'),_0x3865a3,_0x7f11db[_0xcfe9('0x14')]['message']);return _0x38028e(_0x7f11db[_0xcfe9('0x14')][_0xcfe9('0x16')]);}logger[_0xcfe9('0x14')](_0xcfe9('0xf'),_0x3865a3,_0x7f11db[_0xcfe9('0x14')]['message']);return _0x106010(_0x7f11db['error'][_0xcfe9('0x16')]);}else{logger[_0xcfe9('0xe')](_0xcfe9('0xf'),_0x3865a3,'request\x20sent');_0x106010(_0x7f11db[_0xcfe9('0x17')]['message']);}})['catch'](function(_0x5f0bea){logger['error'](_0xcfe9('0xf'),_0x3865a3,_0x5f0bea);_0x38028e(_0x5f0bea);});});}exports[_0xcfe9('0x18')]=function(_0x4fc263){var _0x219d9f=this;return new Promise(function(_0x4df31e,_0x31b764){return db['VoiceQueue'][_0xcfe9('0x19')]({'raw':_0x4fc263[_0xcfe9('0x1a')]?_0x4fc263[_0xcfe9('0x1a')][_0xcfe9('0x1b')]===undefined?!![]:![]:!![],'where':_0x4fc263[_0xcfe9('0x1a')]?_0x4fc263[_0xcfe9('0x1a')]['where']||null:null,'attributes':_0x4fc263[_0xcfe9('0x1a')]?_0x4fc263[_0xcfe9('0x1a')][_0xcfe9('0x1c')]||null:null,'limit':_0x4fc263[_0xcfe9('0x1a')]?_0x4fc263[_0xcfe9('0x1a')][_0xcfe9('0x1d')]||null:null,'include':_0x4fc263[_0xcfe9('0x1a')]?_0x4fc263[_0xcfe9('0x1a')][_0xcfe9('0x1e')]?_[_0xcfe9('0x1f')](_0x4fc263['options']['include'],function(_0x4946f0){return{'model':db[_0x4946f0['model']],'as':_0x4946f0['as'],'attributes':_0x4946f0['attributes'],'include':_0x4946f0[_0xcfe9('0x1e')]?_[_0xcfe9('0x1f')](_0x4946f0[_0xcfe9('0x1e')],function(_0x355e45){return{'model':db[_0x355e45['model']],'as':_0x355e45['as'],'attributes':_0x355e45[_0xcfe9('0x1c')],'include':_0x355e45['include']?_[_0xcfe9('0x1f')](_0x355e45[_0xcfe9('0x1e')],function(_0x2b0336){return{'model':db[_0x2b0336['model']],'as':_0x2b0336['as'],'attributes':_0x2b0336[_0xcfe9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcfe9('0xd')](function(_0x4a2972){logger[_0xcfe9('0xe')]('GetVoiceQueue',_0x4fc263);logger[_0xcfe9('0x11')](_0xcfe9('0x18'),_0x4fc263,JSON['stringify'](_0x4a2972));_0x4df31e(_0x4a2972);})[_0xcfe9('0x20')](function(_0x1c161e){logger['error']('GetVoiceQueue',_0x1c161e['message'],_0x4fc263);_0x31b764(_0x219d9f['error'](0x1f4,_0x1c161e[_0xcfe9('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x539cf3){var _0x362732=this;return new Promise(function(_0x5c9159,_0x339ea7){return db[_0xcfe9('0x21')][_0xcfe9('0x22')]({'raw':_0x539cf3['options']?_0x539cf3[_0xcfe9('0x1a')][_0xcfe9('0x1b')]===undefined?!![]:![]:!![],'where':_0x539cf3[_0xcfe9('0x1a')]?_0x539cf3[_0xcfe9('0x1a')]['where']||null:null,'attributes':_0x539cf3[_0xcfe9('0x1a')]?_0x539cf3['options']['attributes']||null:null,'include':_0x539cf3['options']?_0x539cf3[_0xcfe9('0x1a')][_0xcfe9('0x1e')]?_[_0xcfe9('0x1f')](_0x539cf3[_0xcfe9('0x1a')][_0xcfe9('0x1e')],function(_0x4f25b4){return{'model':db[_0x4f25b4['model']],'as':_0x4f25b4['as'],'attributes':_0x4f25b4[_0xcfe9('0x1c')],'include':_0x4f25b4[_0xcfe9('0x1e')]?_[_0xcfe9('0x1f')](_0x4f25b4['include'],function(_0x20c3ae){return{'model':db[_0x20c3ae['model']],'as':_0x20c3ae['as'],'attributes':_0x20c3ae[_0xcfe9('0x1c')],'include':_0x20c3ae[_0xcfe9('0x1e')]?_[_0xcfe9('0x1f')](_0x20c3ae[_0xcfe9('0x1e')],function(_0x2ddc6f){return{'model':db[_0x2ddc6f[_0xcfe9('0x23')]],'as':_0x2ddc6f['as'],'attributes':_0x2ddc6f[_0xcfe9('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2160a1){logger[_0xcfe9('0xe')]('ShowVoiceQueue',_0x539cf3);logger[_0xcfe9('0x11')](_0xcfe9('0x24'),_0x539cf3,JSON['stringify'](_0x2160a1));_0x5c9159(_0x2160a1);})[_0xcfe9('0x20')](function(_0x439362){logger[_0xcfe9('0x14')]('ShowVoiceQueue',_0x439362['message'],_0x539cf3);_0x339ea7(_0x362732[_0xcfe9('0x14')](0x1f4,_0x439362[_0xcfe9('0x16')]));});});}; \ No newline at end of file +var _0xf711=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowVoiceQueue','lodash','moment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf711,0xa2));var _0x1f71=function(_0x57bba9,_0x110c12){_0x57bba9=_0x57bba9-0x0;var _0x3e486a=_0xf711[_0x57bba9];return _0x3e486a;};'use strict';var _=require(_0x1f71('0x0'));var util=require('util');var moment=require(_0x1f71('0x1'));var BPromise=require(_0x1f71('0x2'));var rs=require(_0x1f71('0x3'));var fs=require('fs');var Redis=require(_0x1f71('0x4'));var db=require(_0x1f71('0x5'))['db'];var utils=require(_0x1f71('0x6'));var logger=require(_0x1f71('0x7'))(_0x1f71('0x8'));var config=require(_0x1f71('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1f71('0xa')]({'port':0x232a});config[_0x1f71('0xb')]=_[_0x1f71('0xc')](config[_0x1f71('0xb')],{'host':_0x1f71('0xd'),'port':0x18eb});var socket=require(_0x1f71('0xe'))(new Redis(config['redis']));require(_0x1f71('0xf'))[_0x1f71('0x10')](socket);function respondWithRpcPromise(_0x5a9c37,_0x185b61,_0x57ca10){return new BPromise(function(_0x36e959,_0x228b4c){return client[_0x1f71('0x11')](_0x5a9c37,_0x57ca10)['then'](function(_0x372a43){logger[_0x1f71('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x185b61,_0x1f71('0x13'));logger[_0x1f71('0x14')](_0x1f71('0x15'),_0x185b61,'request\x20sent',JSON[_0x1f71('0x16')](_0x372a43));if(_0x372a43[_0x1f71('0x17')]){if(_0x372a43[_0x1f71('0x17')][_0x1f71('0x18')]===0x1f4){logger[_0x1f71('0x17')](_0x1f71('0x19'),_0x185b61,_0x372a43[_0x1f71('0x17')][_0x1f71('0x1a')]);return _0x228b4c(_0x372a43[_0x1f71('0x17')][_0x1f71('0x1a')]);}logger[_0x1f71('0x17')](_0x1f71('0x19'),_0x185b61,_0x372a43[_0x1f71('0x17')]['message']);return _0x36e959(_0x372a43[_0x1f71('0x17')][_0x1f71('0x1a')]);}else{logger[_0x1f71('0x12')](_0x1f71('0x19'),_0x185b61,_0x1f71('0x13'));_0x36e959(_0x372a43['result']['message']);}})['catch'](function(_0x2e2777){logger[_0x1f71('0x17')](_0x1f71('0x19'),_0x185b61,_0x2e2777);_0x228b4c(_0x2e2777);});});}exports[_0x1f71('0x1b')]=function(_0x4c5f5b){var _0x304eed=this;return new Promise(function(_0x1c37c3,_0x217cb0){return db[_0x1f71('0x1c')][_0x1f71('0x1d')]({'raw':_0x4c5f5b[_0x1f71('0x1e')]?_0x4c5f5b[_0x1f71('0x1e')][_0x1f71('0x1f')]===undefined?!![]:![]:!![],'where':_0x4c5f5b[_0x1f71('0x1e')]?_0x4c5f5b[_0x1f71('0x1e')][_0x1f71('0x20')]||null:null,'attributes':_0x4c5f5b[_0x1f71('0x1e')]?_0x4c5f5b[_0x1f71('0x1e')][_0x1f71('0x21')]||null:null,'limit':_0x4c5f5b[_0x1f71('0x1e')]?_0x4c5f5b['options'][_0x1f71('0x22')]||null:null,'include':_0x4c5f5b[_0x1f71('0x1e')]?_0x4c5f5b[_0x1f71('0x1e')][_0x1f71('0x23')]?_[_0x1f71('0x24')](_0x4c5f5b[_0x1f71('0x1e')][_0x1f71('0x23')],function(_0x4c2677){return{'model':db[_0x4c2677['model']],'as':_0x4c2677['as'],'attributes':_0x4c2677['attributes'],'include':_0x4c2677[_0x1f71('0x23')]?_[_0x1f71('0x24')](_0x4c2677[_0x1f71('0x23')],function(_0x10676d){return{'model':db[_0x10676d[_0x1f71('0x25')]],'as':_0x10676d['as'],'attributes':_0x10676d[_0x1f71('0x21')],'include':_0x10676d[_0x1f71('0x23')]?_[_0x1f71('0x24')](_0x10676d['include'],function(_0x2c8b62){return{'model':db[_0x2c8b62[_0x1f71('0x25')]],'as':_0x2c8b62['as'],'attributes':_0x2c8b62[_0x1f71('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1f71('0x26')](function(_0x52cd4d){logger[_0x1f71('0x12')](_0x1f71('0x1b'),_0x4c5f5b);logger[_0x1f71('0x14')](_0x1f71('0x1b'),_0x4c5f5b,JSON[_0x1f71('0x16')](_0x52cd4d));_0x1c37c3(_0x52cd4d);})[_0x1f71('0x27')](function(_0x294482){logger[_0x1f71('0x17')]('GetVoiceQueue',_0x294482[_0x1f71('0x1a')],_0x4c5f5b);_0x217cb0(_0x304eed[_0x1f71('0x17')](0x1f4,_0x294482['message']));});});};exports[_0x1f71('0x28')]=function(_0x107fce){var _0x3ae9d5=this;return new Promise(function(_0x3b9464,_0x567bb6){return db['VoiceQueue']['find']({'raw':_0x107fce[_0x1f71('0x1e')]?_0x107fce[_0x1f71('0x1e')][_0x1f71('0x1f')]===undefined?!![]:![]:!![],'where':_0x107fce[_0x1f71('0x1e')]?_0x107fce[_0x1f71('0x1e')]['where']||null:null,'attributes':_0x107fce[_0x1f71('0x1e')]?_0x107fce[_0x1f71('0x1e')][_0x1f71('0x21')]||null:null,'include':_0x107fce['options']?_0x107fce[_0x1f71('0x1e')][_0x1f71('0x23')]?_['map'](_0x107fce[_0x1f71('0x1e')]['include'],function(_0x29f656){return{'model':db[_0x29f656[_0x1f71('0x25')]],'as':_0x29f656['as'],'attributes':_0x29f656[_0x1f71('0x21')],'include':_0x29f656['include']?_[_0x1f71('0x24')](_0x29f656[_0x1f71('0x23')],function(_0x1aee91){return{'model':db[_0x1aee91[_0x1f71('0x25')]],'as':_0x1aee91['as'],'attributes':_0x1aee91[_0x1f71('0x21')],'include':_0x1aee91[_0x1f71('0x23')]?_[_0x1f71('0x24')](_0x1aee91[_0x1f71('0x23')],function(_0x3c3d4e){return{'model':db[_0x3c3d4e['model']],'as':_0x3c3d4e['as'],'attributes':_0x3c3d4e['attributes']};}):[]};}):[]};}):[]:[]})[_0x1f71('0x26')](function(_0x3fe295){logger[_0x1f71('0x12')](_0x1f71('0x28'),_0x107fce);logger[_0x1f71('0x14')](_0x1f71('0x28'),_0x107fce,JSON[_0x1f71('0x16')](_0x3fe295));_0x3b9464(_0x3fe295);})[_0x1f71('0x27')](function(_0x17bc89){logger[_0x1f71('0x17')](_0x1f71('0x28'),_0x17bc89[_0x1f71('0x1a')],_0x107fce);_0x567bb6(_0x3ae9d5[_0x1f71('0x17')](0x1f4,_0x17bc89['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index e7ee789..7dedae1 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 _0xb6cb=['length','voiceQueue:','./voiceQueue.events','save','remove','update','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6cb,0x152));var _0xbb6c=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0xb6cb[_0x2525f1];return _0x13c1b5;};'use strict';var VoiceQueueEvents=require(_0xbb6c('0x0'));var events=[_0xbb6c('0x1'),_0xbb6c('0x2'),_0xbb6c('0x3')];function createListener(_0x2b18de,_0x2be11f){return function(_0xd908d8){_0x2be11f['emit'](_0x2b18de,_0xd908d8);};}function removeListener(_0x61586d,_0x24f178){return function(){VoiceQueueEvents['removeListener'](_0x61586d,_0x24f178);};}exports[_0xbb6c('0x4')]=function(_0x5b47f1){for(var _0x243fb4=0x0,_0x100d8d=events[_0xbb6c('0x5')];_0x243fb4<_0x100d8d;_0x243fb4++){var _0x5822a7=events[_0x243fb4];var _0x59dcf1=createListener(_0xbb6c('0x6')+_0x5822a7,_0x5b47f1);VoiceQueueEvents['on'](_0x5822a7,_0x59dcf1);}}; \ No newline at end of file +var _0x0f92=['voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener','register'];(function(_0x4e79b3,_0x54e54b){var _0x54b174=function(_0x1b56cf){while(--_0x1b56cf){_0x4e79b3['push'](_0x4e79b3['shift']());}};_0x54b174(++_0x54e54b);}(_0x0f92,0xfd));var _0x20f9=function(_0x2f0a5c,_0x3ad1d2){_0x2f0a5c=_0x2f0a5c-0x0;var _0x35fd12=_0x0f92[_0x2f0a5c];return _0x35fd12;};'use strict';var VoiceQueueEvents=require(_0x20f9('0x0'));var events=[_0x20f9('0x1'),_0x20f9('0x2'),'update'];function createListener(_0x2b91f1,_0x18b239){return function(_0x2fcd18){_0x18b239[_0x20f9('0x3')](_0x2b91f1,_0x2fcd18);};}function removeListener(_0x134dda,_0x253508){return function(){VoiceQueueEvents[_0x20f9('0x4')](_0x134dda,_0x253508);};}exports[_0x20f9('0x5')]=function(_0x5c1025){for(var _0x35eac1=0x0,_0x3801f5=events['length'];_0x35eac1<_0x3801f5;_0x35eac1++){var _0x29b5cc=events[_0x35eac1];var _0x40cfc7=createListener(_0x20f9('0x6')+_0x29b5cc,_0x5c1025);VoiceQueueEvents['on'](_0x29b5cc,_0x40cfc7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 43f307a..dfd2aea 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 _0x71ab=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','create','put','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x375565,_0x28a616){var _0x3ab718=function(_0x5de3f8){while(--_0x5de3f8){_0x375565['push'](_0x375565['shift']());}};_0x3ab718(++_0x28a616);}(_0x71ab,0x64));var _0xb71a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x71ab[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var auth=require(_0xb71a('0x3'));var interaction=require(_0xb71a('0x4'));var config=require(_0xb71a('0x5'));var controller=require(_0xb71a('0x6'));router[_0xb71a('0x7')]('/',auth[_0xb71a('0x8')](),controller[_0xb71a('0x9')]);router[_0xb71a('0x7')](_0xb71a('0xa'),auth[_0xb71a('0x8')](),controller[_0xb71a('0xb')]);router[_0xb71a('0x7')](_0xb71a('0xc'),auth[_0xb71a('0x8')](),controller[_0xb71a('0xd')]);router[_0xb71a('0x7')](_0xb71a('0xe'),auth['isAuthenticated'](),controller[_0xb71a('0xf')]);router['post']('/',auth[_0xb71a('0x8')](),controller[_0xb71a('0x10')]);router[_0xb71a('0x11')]('/:id',auth[_0xb71a('0x8')](),controller['update']);router[_0xb71a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb71a('0x13')]);module[_0xb71a('0x14')]=router; \ No newline at end of file +var _0x15ef=['isAuthenticated','/describe','getVoiceQueuesReport','/:id','create','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xd95342,_0xb75bf6){var _0x54d694=function(_0x1190c1){while(--_0x1190c1){_0xd95342['push'](_0xd95342['shift']());}};_0x54d694(++_0xb75bf6);}(_0x15ef,0x80));var _0xf15e=function(_0x16f0ec,_0x273fa4){_0x16f0ec=_0x16f0ec-0x0;var _0x2a0382=_0x15ef[_0x16f0ec];return _0x2a0382;};'use strict';var multer=require('multer');var util=require(_0xf15e('0x0'));var path=require(_0xf15e('0x1'));var timeout=require('connect-timeout');var express=require(_0xf15e('0x2'));var router=express[_0xf15e('0x3')]();var auth=require(_0xf15e('0x4'));var interaction=require(_0xf15e('0x5'));var config=require(_0xf15e('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xf15e('0x7')]('/',auth[_0xf15e('0x8')](),controller['index']);router['get'](_0xf15e('0x9'),auth[_0xf15e('0x8')](),controller['describe']);router[_0xf15e('0x7')]('/index',auth[_0xf15e('0x8')](),controller[_0xf15e('0xa')]);router[_0xf15e('0x7')](_0xf15e('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf15e('0x8')](),controller[_0xf15e('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf15e('0xd')]);router[_0xf15e('0xe')](_0xf15e('0xb'),auth['isAuthenticated'](),controller[_0xf15e('0xf')]);module[_0xf15e('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index dc7b50e..70019f3 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 _0xcb91=['setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2650e9,_0xb91cc){_0x2650e9=_0x2650e9-0x0;var _0x3511c8=_0xcb91[_0x2650e9];return _0x3511c8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1cb9('0x0')]={'type':{'type':Sequelize[_0x1cb9('0x1')]},'uniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'calleridnum':{'type':Sequelize[_0x1cb9('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x13d5fd){var _0x1b26cd=moment(_0x13d5fd);var _0x53ffbd=moment(this[_0x1cb9('0x3')](_0x1cb9('0x4')))['format'](_0x1cb9('0x5'));var _0x12567c=_0x1b26cd['diff'](_0x53ffbd,_0x1cb9('0x6'));this['setDataValue']('queuecallerleaveAt',_0x13d5fd);this[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x12567c||null);}},'position':{'type':Sequelize[_0x1cb9('0x9')]},'count':{'type':Sequelize[_0x1cb9('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexit':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x1cb9('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1cb9('0x1')]},'connectedlinename':{'type':Sequelize[_0x1cb9('0x1')]},'accountcode':{'type':Sequelize[_0x1cb9('0x1')]},'context':{'type':Sequelize[_0x1cb9('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1cb9('0x1')]},'holdtime':{'type':Sequelize[_0x1cb9('0x9')]},'mohtime':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1cb9('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1cb9('0xb')},'transferexten':{'type':Sequelize[_0x1cb9('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'disposition':{'type':Sequelize[_0x1cb9('0x1')]},'secondDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'thirdDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x16e196,_0xc0c10f){var _0xc7dad8=function(_0x1c4c4a){while(--_0x1c4c4a){_0x16e196['push'](_0x16e196['shift']());}};_0xc7dad8(++_0xc0c10f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index cbb401e..47cc4d0 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 _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x577d0b,_0x1b818f){var _0x5eb142=function(_0x37a137){while(--_0x37a137){_0x577d0b['push'](_0x577d0b['shift']());}};_0x5eb142(++_0x1b818f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);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);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file +var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x25cf26,_0x1a0446){var _0x3aaad7=function(_0x80758d){while(--_0x80758d){_0x25cf26['push'](_0x25cf26['shift']());}};_0x3aaad7(++_0x1a0446);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);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);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 0acddf9..0ae5604 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 _0xdfdf=['events','update','remove','emit','hasOwnProperty','exports'];(function(_0x6adae,_0x192f95){var _0xd80c2a=function(_0x526572){while(--_0x526572){_0x6adae['push'](_0x6adae['shift']());}};_0xd80c2a(++_0x192f95);}(_0xdfdf,0xde));var _0xfdfd=function(_0x225635,_0x2098ec){_0x225635=_0x225635-0x0;var _0x1d4f95=_0xdfdf[_0x225635];return _0x1d4f95;};'use strict';var EventEmitter=require(_0xfdfd('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdfd('0x1'),'afterDestroy':_0xfdfd('0x2')};function emitEvent(_0x450474){return function(_0x45879e,_0x3ff601,_0x21a0c0){VoiceQueueReportEvents[_0xfdfd('0x3')](_0x450474+':'+_0x45879e['id'],_0x45879e);VoiceQueueReportEvents[_0xfdfd('0x3')](_0x450474,_0x45879e);_0x21a0c0(null);};}for(var e in events){if(events[_0xfdfd('0x4')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xfdfd('0x5')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xdd6e=['update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x989aca,_0x152da2){var _0x1ac5db=function(_0x530807){while(--_0x530807){_0x989aca['push'](_0x989aca['shift']());}};_0x1ac5db(++_0x152da2);}(_0xdd6e,0xdd));var _0xedd6=function(_0x13e79d,_0x383675){_0x13e79d=_0x13e79d-0x0;var _0x195b97=_0xdd6e[_0x13e79d];return _0x195b97;};'use strict';var EventEmitter=require(_0xedd6('0x0'));var VoiceQueueReport=require(_0xedd6('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xedd6('0x2')](0x0);var events={'afterCreate':_0xedd6('0x3'),'afterUpdate':_0xedd6('0x4'),'afterDestroy':_0xedd6('0x5')};function emitEvent(_0x33e1c0){return function(_0x1f9a7c,_0x23c274,_0x1405e6){VoiceQueueReportEvents['emit'](_0x33e1c0+':'+_0x1f9a7c['id'],_0x1f9a7c);VoiceQueueReportEvents['emit'](_0x33e1c0,_0x1f9a7c);_0x1405e6(null);};}for(var e in events){if(events[_0xedd6('0x6')](e)){var event=events[e];VoiceQueueReport[_0xedd6('0x7')](e,emitEvent(event));}}module[_0xedd6('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 39adf12..086a721 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 _0xb10b=['define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x37d3f3,_0xca010f){var _0x185c9c=function(_0x5e2bf2){while(--_0x5e2bf2){_0x37d3f3['push'](_0x37d3f3['shift']());}};_0x185c9c(++_0xca010f);}(_0xb10b,0x12a));var _0xbb10=function(_0x4ea971,_0x174234){_0x4ea971=_0x4ea971-0x0;var _0x86b88d=_0xb10b[_0x4ea971];return _0x86b88d;};'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')]('VoiceQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb10('0xc')]},{'fields':[_0xbb10('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0xcebd84,_0x300888){var _0x8b919=function(_0x1c5679){while(--_0x1c5679){_0xcebd84['push'](_0xcebd84['shift']());}};_0x8b919(++_0x300888);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65f6('0xa')]},{'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 530c372..a7a205e 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 _0xe839=['map','model','GetVoiceQueueReport','stringify','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','VoiceQueueReport','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','options','raw','attributes','limit','include'];(function(_0x4c2831,_0x5dec35){var _0x1c4f70=function(_0x51c28f){while(--_0x51c28f){_0x4c2831['push'](_0x4c2831['shift']());}};_0x1c4f70(++_0x5dec35);}(_0xe839,0x1a5));var _0x9e83=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe839[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x9e83('0x0'));var util=require('util');var moment=require(_0x9e83('0x1'));var BPromise=require(_0x9e83('0x2'));var rs=require(_0x9e83('0x3'));var fs=require('fs');var Redis=require(_0x9e83('0x4'));var db=require(_0x9e83('0x5'))['db'];var utils=require(_0x9e83('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9e83('0x7'));var jayson=require(_0x9e83('0x8'));var client=jayson[_0x9e83('0x9')][_0x9e83('0xa')]({'port':0x232a});config[_0x9e83('0xb')]=_[_0x9e83('0xc')](config[_0x9e83('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e83('0xd'))(new Redis(config[_0x9e83('0xb')]));require(_0x9e83('0xe'))['register'](socket);function respondWithRpcPromise(_0x1001d5,_0x5a9f43,_0x380442){return new BPromise(function(_0x1d578f,_0x232862){return client[_0x9e83('0xf')](_0x1001d5,_0x380442)[_0x9e83('0x10')](function(_0x14fa27){logger[_0x9e83('0x11')](_0x9e83('0x12'),_0x5a9f43,'request\x20sent');logger[_0x9e83('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5a9f43,_0x9e83('0x14'),JSON['stringify'](_0x14fa27));if(_0x14fa27[_0x9e83('0x15')]){if(_0x14fa27[_0x9e83('0x15')][_0x9e83('0x16')]===0x1f4){logger[_0x9e83('0x15')](_0x9e83('0x12'),_0x5a9f43,_0x14fa27['error'][_0x9e83('0x17')]);return _0x232862(_0x14fa27[_0x9e83('0x15')][_0x9e83('0x17')]);}logger[_0x9e83('0x15')](_0x9e83('0x12'),_0x5a9f43,_0x14fa27[_0x9e83('0x15')][_0x9e83('0x17')]);return _0x1d578f(_0x14fa27[_0x9e83('0x15')][_0x9e83('0x17')]);}else{logger[_0x9e83('0x11')](_0x9e83('0x12'),_0x5a9f43,_0x9e83('0x14'));_0x1d578f(_0x14fa27[_0x9e83('0x18')][_0x9e83('0x17')]);}})['catch'](function(_0x35c21d){logger[_0x9e83('0x15')](_0x9e83('0x12'),_0x5a9f43,_0x35c21d);_0x232862(_0x35c21d);});});}exports['GetVoiceQueueReport']=function(_0x30137b){var _0xb2dca3=this;return new Promise(function(_0x4ff071,_0x16655c){return db['VoiceQueueReport']['findAll']({'raw':_0x30137b[_0x9e83('0x19')]?_0x30137b[_0x9e83('0x19')][_0x9e83('0x1a')]===undefined?!![]:![]:!![],'where':_0x30137b[_0x9e83('0x19')]?_0x30137b[_0x9e83('0x19')]['where']||null:null,'attributes':_0x30137b[_0x9e83('0x19')]?_0x30137b[_0x9e83('0x19')][_0x9e83('0x1b')]||null:null,'limit':_0x30137b[_0x9e83('0x19')]?_0x30137b[_0x9e83('0x19')][_0x9e83('0x1c')]||null:null,'include':_0x30137b['options']?_0x30137b[_0x9e83('0x19')][_0x9e83('0x1d')]?_[_0x9e83('0x1e')](_0x30137b[_0x9e83('0x19')][_0x9e83('0x1d')],function(_0x6f2e9f){return{'model':db[_0x6f2e9f[_0x9e83('0x1f')]],'as':_0x6f2e9f['as'],'attributes':_0x6f2e9f[_0x9e83('0x1b')],'include':_0x6f2e9f['include']?_[_0x9e83('0x1e')](_0x6f2e9f['include'],function(_0xdaef67){return{'model':db[_0xdaef67[_0x9e83('0x1f')]],'as':_0xdaef67['as'],'attributes':_0xdaef67['attributes'],'include':_0xdaef67[_0x9e83('0x1d')]?_['map'](_0xdaef67[_0x9e83('0x1d')],function(_0x3afb3d){return{'model':db[_0x3afb3d['model']],'as':_0x3afb3d['as'],'attributes':_0x3afb3d[_0x9e83('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9e83('0x10')](function(_0x224b45){logger[_0x9e83('0x11')](_0x9e83('0x20'),_0x30137b);logger[_0x9e83('0x13')](_0x9e83('0x20'),_0x30137b,JSON[_0x9e83('0x21')](_0x224b45));_0x4ff071(_0x224b45);})[_0x9e83('0x22')](function(_0x1e3d50){logger[_0x9e83('0x15')](_0x9e83('0x20'),_0x1e3d50[_0x9e83('0x17')],_0x30137b);_0x16655c(_0xb2dca3['error'](0x1f4,_0x1e3d50['message']));});});};exports[_0x9e83('0x23')]=function(_0x576299){var _0x277baf=this;return new Promise(function(_0x354545,_0x4d94bf){return db['VoiceQueueReport'][_0x9e83('0x24')](_0x576299[_0x9e83('0x25')],{'raw':_0x576299[_0x9e83('0x19')]?_0x576299[_0x9e83('0x19')][_0x9e83('0x1a')]===undefined?!![]:![]:!![]})[_0x9e83('0x10')](function(_0x3fcc2a){logger[_0x9e83('0x11')](_0x9e83('0x23'),_0x576299);logger[_0x9e83('0x13')](_0x9e83('0x23'),_0x576299,JSON['stringify'](_0x3fcc2a));_0x354545(_0x3fcc2a);})['catch'](function(_0x29972a){logger[_0x9e83('0x15')](_0x9e83('0x23'),_0x29972a['message'],_0x576299);_0x4d94bf(_0x277baf[_0x9e83('0x15')](0x1f4,_0x29972a[_0x9e83('0x17')]));});});};exports[_0x9e83('0x26')]=function(_0x456618){var _0x470ee9=this;return new Promise(function(_0x41601a,_0x48bc20){return db[_0x9e83('0x27')]['update'](_0x456618[_0x9e83('0x25')],{'raw':_0x456618['options']?_0x456618[_0x9e83('0x19')][_0x9e83('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456618[_0x9e83('0x19')]?_0x456618[_0x9e83('0x19')][_0x9e83('0x28')]||null:null,'attributes':_0x456618['options']?_0x456618[_0x9e83('0x19')]['attributes']||null:null,'limit':_0x456618['options']?_0x456618[_0x9e83('0x19')][_0x9e83('0x1c')]||null:null})['then'](function(_0x3427ae){logger['info']('UpdateVoiceQueueReport',_0x456618);logger[_0x9e83('0x13')](_0x9e83('0x26'),_0x456618,JSON[_0x9e83('0x21')](_0x3427ae));_0x41601a(_0x3427ae);})[_0x9e83('0x22')](function(_0x4ab238){logger[_0x9e83('0x15')](_0x9e83('0x26'),_0x4ab238['message'],_0x456618);_0x48bc20(_0x470ee9['error'](0x1f4,_0x4ab238[_0x9e83('0x17')]));});});}; \ No newline at end of file +var _0x4bdc=['GetVoiceQueueReport','options','where','attributes','include','map','model','then','CreateVoiceQueueReport','VoiceQueueReport','body','raw','catch','UpdateVoiceQueueReport','update','limit','debug','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x91c951,_0x2988ba){var _0xc454d1=function(_0x1d86e8){while(--_0x1d86e8){_0x91c951['push'](_0x91c951['shift']());}};_0xc454d1(++_0x2988ba);}(_0x4bdc,0x122));var _0xc4bd=function(_0x3ef051,_0x49ea91){_0x3ef051=_0x3ef051-0x0;var _0x5679b3=_0x4bdc[_0x3ef051];return _0x5679b3;};'use strict';var _=require(_0xc4bd('0x0'));var util=require(_0xc4bd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4bd('0x2'));var db=require(_0xc4bd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4bd('0x4'))(_0xc4bd('0x5'));var config=require(_0xc4bd('0x6'));var jayson=require(_0xc4bd('0x7'));var client=jayson[_0xc4bd('0x8')][_0xc4bd('0x9')]({'port':0x232a});config[_0xc4bd('0xa')]=_['defaults'](config[_0xc4bd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc4bd('0xb'))(new Redis(config[_0xc4bd('0xa')]));require(_0xc4bd('0xc'))[_0xc4bd('0xd')](socket);function respondWithRpcPromise(_0xd16bf4,_0x5af469,_0xdd5b33){return new BPromise(function(_0x3dca37,_0x200be5){return client['request'](_0xd16bf4,_0xdd5b33)['then'](function(_0x4e078c){logger['info'](_0xc4bd('0xe'),_0x5af469,_0xc4bd('0xf'));logger['debug'](_0xc4bd('0x10'),_0x5af469,'request\x20sent',JSON[_0xc4bd('0x11')](_0x4e078c));if(_0x4e078c[_0xc4bd('0x12')]){if(_0x4e078c['error'][_0xc4bd('0x13')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x5af469,_0x4e078c[_0xc4bd('0x12')][_0xc4bd('0x14')]);return _0x200be5(_0x4e078c['error'][_0xc4bd('0x14')]);}logger[_0xc4bd('0x12')](_0xc4bd('0xe'),_0x5af469,_0x4e078c[_0xc4bd('0x12')][_0xc4bd('0x14')]);return _0x3dca37(_0x4e078c[_0xc4bd('0x12')][_0xc4bd('0x14')]);}else{logger[_0xc4bd('0x15')](_0xc4bd('0xe'),_0x5af469,_0xc4bd('0xf'));_0x3dca37(_0x4e078c['result']['message']);}})['catch'](function(_0x55e342){logger[_0xc4bd('0x12')](_0xc4bd('0xe'),_0x5af469,_0x55e342);_0x200be5(_0x55e342);});});}exports[_0xc4bd('0x16')]=function(_0x45d2f8){var _0x3597f0=this;return new Promise(function(_0x5c1716,_0x2fa4a0){return db['VoiceQueueReport']['findAll']({'raw':_0x45d2f8['options']?_0x45d2f8[_0xc4bd('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x45d2f8[_0xc4bd('0x17')]?_0x45d2f8[_0xc4bd('0x17')][_0xc4bd('0x18')]||null:null,'attributes':_0x45d2f8['options']?_0x45d2f8['options'][_0xc4bd('0x19')]||null:null,'limit':_0x45d2f8[_0xc4bd('0x17')]?_0x45d2f8[_0xc4bd('0x17')]['limit']||null:null,'include':_0x45d2f8[_0xc4bd('0x17')]?_0x45d2f8[_0xc4bd('0x17')][_0xc4bd('0x1a')]?_[_0xc4bd('0x1b')](_0x45d2f8[_0xc4bd('0x17')][_0xc4bd('0x1a')],function(_0x45685){return{'model':db[_0x45685[_0xc4bd('0x1c')]],'as':_0x45685['as'],'attributes':_0x45685[_0xc4bd('0x19')],'include':_0x45685[_0xc4bd('0x1a')]?_[_0xc4bd('0x1b')](_0x45685[_0xc4bd('0x1a')],function(_0x460783){return{'model':db[_0x460783[_0xc4bd('0x1c')]],'as':_0x460783['as'],'attributes':_0x460783['attributes'],'include':_0x460783['include']?_[_0xc4bd('0x1b')](_0x460783[_0xc4bd('0x1a')],function(_0xa59a2b){return{'model':db[_0xa59a2b['model']],'as':_0xa59a2b['as'],'attributes':_0xa59a2b[_0xc4bd('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc4bd('0x1d')](function(_0x536ca8){logger[_0xc4bd('0x15')](_0xc4bd('0x16'),_0x45d2f8);logger['debug'](_0xc4bd('0x16'),_0x45d2f8,JSON[_0xc4bd('0x11')](_0x536ca8));_0x5c1716(_0x536ca8);})['catch'](function(_0x35e568){logger[_0xc4bd('0x12')](_0xc4bd('0x16'),_0x35e568[_0xc4bd('0x14')],_0x45d2f8);_0x2fa4a0(_0x3597f0[_0xc4bd('0x12')](0x1f4,_0x35e568[_0xc4bd('0x14')]));});});};exports[_0xc4bd('0x1e')]=function(_0x4f2276){var _0x20ee1d=this;return new Promise(function(_0x25f800,_0x2d44f2){return db[_0xc4bd('0x1f')]['create'](_0x4f2276[_0xc4bd('0x20')],{'raw':_0x4f2276[_0xc4bd('0x17')]?_0x4f2276[_0xc4bd('0x17')][_0xc4bd('0x21')]===undefined?!![]:![]:!![]})[_0xc4bd('0x1d')](function(_0x3fd258){logger[_0xc4bd('0x15')](_0xc4bd('0x1e'),_0x4f2276);logger['debug'](_0xc4bd('0x1e'),_0x4f2276,JSON['stringify'](_0x3fd258));_0x25f800(_0x3fd258);})[_0xc4bd('0x22')](function(_0xe9829){logger[_0xc4bd('0x12')](_0xc4bd('0x1e'),_0xe9829[_0xc4bd('0x14')],_0x4f2276);_0x2d44f2(_0x20ee1d[_0xc4bd('0x12')](0x1f4,_0xe9829[_0xc4bd('0x14')]));});});};exports[_0xc4bd('0x23')]=function(_0xb91736){var _0x2d4c15=this;return new Promise(function(_0x1c7c12,_0x29da8d){return db[_0xc4bd('0x1f')][_0xc4bd('0x24')](_0xb91736[_0xc4bd('0x20')],{'raw':_0xb91736['options']?_0xb91736['options'][_0xc4bd('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb91736[_0xc4bd('0x17')]?_0xb91736[_0xc4bd('0x17')][_0xc4bd('0x18')]||null:null,'attributes':_0xb91736[_0xc4bd('0x17')]?_0xb91736['options'][_0xc4bd('0x19')]||null:null,'limit':_0xb91736[_0xc4bd('0x17')]?_0xb91736[_0xc4bd('0x17')][_0xc4bd('0x25')]||null:null})['then'](function(_0x1f6836){logger['info'](_0xc4bd('0x23'),_0xb91736);logger[_0xc4bd('0x26')](_0xc4bd('0x23'),_0xb91736,JSON['stringify'](_0x1f6836));_0x1c7c12(_0x1f6836);})[_0xc4bd('0x22')](function(_0x1192b1){logger['error'](_0xc4bd('0x23'),_0x1192b1[_0xc4bd('0x14')],_0xb91736);_0x29da8d(_0x2d4c15['error'](0x1f4,_0x1192b1[_0xc4bd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index e8aa8b4..b03290b 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 _0x3333=['update','emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x5b77b0,_0x26e192){var _0x103577=function(_0x3b9390){while(--_0x3b9390){_0x5b77b0['push'](_0x5b77b0['shift']());}};_0x103577(++_0x26e192);}(_0x3333,0x1dd));var _0x3333=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x3333[_0x3e3bee];return _0x3ae14c;};'use strict';var VoiceQueueReportEvents=require(_0x3333('0x0'));var events=[_0x3333('0x1'),_0x3333('0x2'),_0x3333('0x3')];function createListener(_0xf272d3,_0x4a74fa){return function(_0x458e5e){_0x4a74fa[_0x3333('0x4')](_0xf272d3,_0x458e5e);};}function removeListener(_0x2593af,_0x16b4cc){return function(){VoiceQueueReportEvents[_0x3333('0x5')](_0x2593af,_0x16b4cc);};}exports['register']=function(_0x5900bd){for(var _0x5e62ba=0x0,_0x37adcf=events[_0x3333('0x6')];_0x5e62ba<_0x37adcf;_0x5e62ba++){var _0x5de749=events[_0x5e62ba];var _0x1870cc=createListener(_0x3333('0x7')+_0x5de749,_0x5900bd);VoiceQueueReportEvents['on'](_0x5de749,_0x1870cc);}}; \ No newline at end of file +var _0x43b6=['length','./voiceQueueReport.events','update','removeListener'];(function(_0x478e72,_0x564ffe){var _0x2dc54b=function(_0x173a52){while(--_0x173a52){_0x478e72['push'](_0x478e72['shift']());}};_0x2dc54b(++_0x564ffe);}(_0x43b6,0x85));var _0x643b=function(_0xa5d9f9,_0x17c6bf){_0xa5d9f9=_0xa5d9f9-0x0;var _0x40e9f6=_0x43b6[_0xa5d9f9];return _0x40e9f6;};'use strict';var VoiceQueueReportEvents=require(_0x643b('0x0'));var events=['save','remove',_0x643b('0x1')];function createListener(_0x36bf4a,_0x389f58){return function(_0x42a7a7){_0x389f58['emit'](_0x36bf4a,_0x42a7a7);};}function removeListener(_0x51a6c9,_0x46a862){return function(){VoiceQueueReportEvents[_0x643b('0x2')](_0x51a6c9,_0x46a862);};}exports['register']=function(_0x5c6afa){for(var _0x54144b=0x0,_0x18aacd=events[_0x643b('0x3')];_0x54144b<_0x18aacd;_0x54144b++){var _0x213fd7=events[_0x54144b];var _0x29fe82=createListener('voiceQueueReport:'+_0x213fd7,_0x5c6afa);VoiceQueueReportEvents['on'](_0x213fd7,_0x29fe82);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 5ba4f6c..4d59392 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 _0x4c07=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4c07,0x18d));var _0x74c0=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0x4c07[_0x296809];return _0x18c0d3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x74c0('0x0'));var timeout=require(_0x74c0('0x1'));var express=require(_0x74c0('0x2'));var router=express[_0x74c0('0x3')]();var auth=require(_0x74c0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x74c0('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0x74c0('0x6')]('/',auth[_0x74c0('0x7')](),controller[_0x74c0('0x8')]);router['get'](_0x74c0('0x9'),auth[_0x74c0('0x7')](),controller[_0x74c0('0xa')]);router[_0x74c0('0xb')]('/',auth[_0x74c0('0x7')](),controller[_0x74c0('0xc')]);router[_0x74c0('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x74c0('0xe')]);router[_0x74c0('0xf')](_0x74c0('0x9'),auth[_0x74c0('0x7')](),controller[_0x74c0('0x10')]);module[_0x74c0('0x11')]=router; \ No newline at end of file +var _0x9a04=['create','/:id','update','delete','destroy','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','isAuthenticated','show','post'];(function(_0x5bc32b,_0x2f1215){var _0x12bd43=function(_0x4d8117){while(--_0x4d8117){_0x5bc32b['push'](_0x5bc32b['shift']());}};_0x12bd43(++_0x2f1215);}(_0x9a04,0x1af));var _0x49a0=function(_0x2da956,_0x16ddff){_0x2da956=_0x2da956-0x0;var _0x461e6d=_0x9a04[_0x2da956];return _0x461e6d;};'use strict';var multer=require('multer');var util=require(_0x49a0('0x0'));var path=require(_0x49a0('0x1'));var timeout=require(_0x49a0('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x49a0('0x3'));var config=require(_0x49a0('0x4'));var controller=require(_0x49a0('0x5'));router[_0x49a0('0x6')]('/',auth['isAuthenticated'](),controller[_0x49a0('0x7')]);router[_0x49a0('0x6')]('/:id',auth[_0x49a0('0x8')](),controller[_0x49a0('0x9')]);router[_0x49a0('0xa')]('/',auth[_0x49a0('0x8')](),controller[_0x49a0('0xb')]);router['put'](_0x49a0('0xc'),auth['isAuthenticated'](),controller[_0x49a0('0xd')]);router[_0x49a0('0xe')](_0x49a0('0xc'),auth[_0x49a0('0x8')](),controller[_0x49a0('0xf')]);module[_0x49a0('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6250642..70057e6 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 _0x4d5c=['moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x47a654,_0x57cc76){var _0x340b0e=function(_0x1bc8ef){while(--_0x1bc8ef){_0x47a654['push'](_0x47a654['shift']());}};_0x340b0e(++_0x57cc76);}(_0x4d5c,0xe9));var _0xc4d5=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4d5c[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0xc4d5('0x0'));var moment=require(_0xc4d5('0x1'));module[_0xc4d5('0x2')]={'time':{'type':Sequelize[_0xc4d5('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc4d5('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc4d5('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc4d5('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc4d5('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc4d5('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc4d5('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc4d5('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc4d5('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc4d5('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xc4d5('0x4')](_0xc4d5('0x5'))}}; \ No newline at end of file +var _0xc641=['exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xc641,0x13c));var _0x1c64=function(_0x567782,_0x532f02){_0x567782=_0x567782-0x0;var _0x445d6c=_0xc641[_0x567782];return _0x445d6c;};'use strict';var Sequelize=require(_0x1c64('0x0'));var moment=require(_0x1c64('0x1'));module[_0x1c64('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x1c64('0x4')](_0x1c64('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a7cafec..112d7e9 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 _0xb049=['mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','VoiceQueuesLog','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','count','include','rows','show','includeAll','create','catch','body','find','params','html-pdf','eml-format','rimraf','request-promise','bluebird'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0xb049,0x8f));var _0x9b04=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb049[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x9b04('0x0'));var emlformat=require(_0x9b04('0x1'));var rimraf=require(_0x9b04('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9b04('0x3'));var moment=require('moment');var BPromise=require(_0x9b04('0x4'));var Mustache=require(_0x9b04('0x5'));var util=require('util');var path=require(_0x9b04('0x6'));var sox=require(_0x9b04('0x7'));var csv=require(_0x9b04('0x8'));var ejs=require(_0x9b04('0x9'));var fs=require('fs');var _=require(_0x9b04('0xa'));var squel=require(_0x9b04('0xb'));var crypto=require(_0x9b04('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9b04('0xd'));var toCsv=require(_0x9b04('0x8'));var querystring=require(_0x9b04('0xe'));var Papa=require(_0x9b04('0xf'));var Redis=require('ioredis');var authService=require(_0x9b04('0x10'));var qs=require(_0x9b04('0x11'));var as=require(_0x9b04('0x12'));var hardwareService=require(_0x9b04('0x13'));var logger=require('../../config/logger')(_0x9b04('0x14'));var utils=require(_0x9b04('0x15'));var config=require(_0x9b04('0x16'));var licenseUtil=require(_0x9b04('0x17'));var db=require(_0x9b04('0x18'))['db'];function respondWithStatusCode(_0x4e6256,_0x2c628b){_0x2c628b=_0x2c628b||0xcc;return function(_0x3b5c3a){if(_0x3b5c3a){return _0x4e6256[_0x9b04('0x19')](_0x2c628b);}return _0x4e6256[_0x9b04('0x1a')](_0x2c628b)[_0x9b04('0x1b')]();};}function respondWithResult(_0x251953,_0x18f916){_0x18f916=_0x18f916||0xc8;return function(_0x31b93c){if(_0x31b93c){return _0x251953['status'](_0x18f916)[_0x9b04('0x1c')](_0x31b93c);}};}function respondWithFilteredResult(_0x483d25,_0xe5edc7){return function(_0x32c3a6){if(_0x32c3a6){var _0x4f57c3=_0x32c3a6['count'],_0x45d4e5=_0xe5edc7[_0x9b04('0x1d')],_0x355980=_0xe5edc7[_0x9b04('0x1d')]+_0xe5edc7[_0x9b04('0x1e')],_0x277647;if(_0x355980>=_0x4f57c3){_0x355980=_0x4f57c3;_0x277647=0xc8;}else{_0x277647=0xce;}_0x483d25[_0x9b04('0x1a')](_0x277647);return _0x483d25['set'](_0x9b04('0x1f'),_0x45d4e5+'-'+_0x355980+'/'+_0x4f57c3)['json'](_0x32c3a6);}return null;};}function patchUpdates(_0x123b0d){return function(_0x3b572e){try{jsonpatch[_0x9b04('0x20')](_0x3b572e,_0x123b0d,!![]);}catch(_0x32b6ed){return BPromise[_0x9b04('0x21')](_0x32b6ed);}return _0x3b572e[_0x9b04('0x22')]();};}function saveUpdates(_0x369954,_0xc91d16){return function(_0x507bc4){if(_0x507bc4){return _0x507bc4[_0x9b04('0x23')](_0x369954)[_0x9b04('0x24')](function(_0x1378ba){return _0x1378ba;});}return null;};}function removeEntity(_0x453d06,_0x26a694){return function(_0xcdd331){if(_0xcdd331){return _0xcdd331[_0x9b04('0x25')]()['then'](function(){_0x453d06[_0x9b04('0x1a')](0xcc)[_0x9b04('0x1b')]();});}};}function handleEntityNotFound(_0xd0ae41,_0x36d94b){return function(_0x5cf37d){if(!_0x5cf37d){_0xd0ae41[_0x9b04('0x19')](0x194);}return _0x5cf37d;};}function handleError(_0x585eb6,_0x9a6bde){_0x9a6bde=_0x9a6bde||0x1f4;return function(_0x57def5){logger[_0x9b04('0x26')](_0x57def5[_0x9b04('0x27')]);if(_0x57def5[_0x9b04('0x28')]){delete _0x57def5[_0x9b04('0x28')];}_0x585eb6['status'](_0x9a6bde)['send'](_0x57def5);};}exports['index']=function(_0x5a5e10,_0x45d80c){var _0x88a1a1={},_0x293223={},_0x3d9282={'count':0x0,'rows':[]};var _0x465afa=_['map'](db[_0x9b04('0x29')][_0x9b04('0x2a')],function(_0x4e8480){return{'name':_0x4e8480[_0x9b04('0x2b')],'type':_0x4e8480['type']['key']};});_0x293223[_0x9b04('0x2c')]=_[_0x9b04('0x2d')](_0x465afa,_0x9b04('0x28'));_0x293223[_0x9b04('0x2e')]=_[_0x9b04('0x2f')](_0x5a5e10['query']);_0x293223['filters']=_[_0x9b04('0x30')](_0x293223[_0x9b04('0x2c')],_0x293223[_0x9b04('0x2e')]);_0x88a1a1[_0x9b04('0x31')]=_['intersection'](_0x293223[_0x9b04('0x2c')],qs[_0x9b04('0x32')](_0x5a5e10[_0x9b04('0x2e')][_0x9b04('0x32')]));_0x88a1a1[_0x9b04('0x31')]=_0x88a1a1[_0x9b04('0x31')][_0x9b04('0x33')]?_0x88a1a1['attributes']:_0x293223['model'];if(!_0x5a5e10['query'][_0x9b04('0x34')](_0x9b04('0x35'))){_0x88a1a1[_0x9b04('0x1e')]=qs[_0x9b04('0x1e')](_0x5a5e10[_0x9b04('0x2e')][_0x9b04('0x1e')]);_0x88a1a1[_0x9b04('0x1d')]=qs[_0x9b04('0x1d')](_0x5a5e10[_0x9b04('0x2e')][_0x9b04('0x1d')]);}_0x88a1a1[_0x9b04('0x36')]=qs[_0x9b04('0x37')](_0x5a5e10['query']['sort']);_0x88a1a1[_0x9b04('0x38')]=qs[_0x9b04('0x39')](_[_0x9b04('0x3a')](_0x5a5e10[_0x9b04('0x2e')],_0x293223[_0x9b04('0x39')]),_0x465afa);if(_0x5a5e10[_0x9b04('0x2e')][_0x9b04('0x3b')]){_0x88a1a1[_0x9b04('0x38')]=_['merge'](_0x88a1a1['where'],{'$or':_[_0x9b04('0x2d')](_0x465afa,function(_0x59a08c){if(_0x59a08c[_0x9b04('0x3c')]!==_0x9b04('0x3d')){var _0x5939f2={};_0x5939f2[_0x59a08c['name']]={'$like':'%'+_0x5a5e10[_0x9b04('0x2e')][_0x9b04('0x3b')]+'%'};return _0x5939f2;}})});}_0x88a1a1=_[_0x9b04('0x3e')]({},_0x88a1a1,_0x5a5e10[_0x9b04('0x3f')]);var _0x584197={'where':_0x88a1a1[_0x9b04('0x38')]};return db['VoiceQueuesLog'][_0x9b04('0x40')](_0x584197)['then'](function(_0x9acb1b){_0x3d9282[_0x9b04('0x40')]=_0x9acb1b;if(_0x5a5e10[_0x9b04('0x2e')]['includeAll']){_0x88a1a1[_0x9b04('0x41')]=[{'all':!![]}];}return db[_0x9b04('0x29')]['findAll'](_0x88a1a1);})[_0x9b04('0x24')](function(_0x510437){_0x3d9282[_0x9b04('0x42')]=_0x510437;return _0x3d9282;})[_0x9b04('0x24')](respondWithFilteredResult(_0x45d80c,_0x88a1a1))['catch'](handleError(_0x45d80c,null));};exports[_0x9b04('0x43')]=function(_0x1a1fcf,_0x54b70e){var _0x346b45={'raw':!![],'where':{'id':_0x1a1fcf['params']['id']}},_0x56d7fd={};_0x56d7fd[_0x9b04('0x2c')]=_['keys'](db['VoiceQueuesLog'][_0x9b04('0x2a')]);_0x56d7fd[_0x9b04('0x2e')]=_[_0x9b04('0x2f')](_0x1a1fcf[_0x9b04('0x2e')]);_0x56d7fd[_0x9b04('0x39')]=_[_0x9b04('0x30')](_0x56d7fd[_0x9b04('0x2c')],_0x56d7fd[_0x9b04('0x2e')]);_0x346b45[_0x9b04('0x31')]=_[_0x9b04('0x30')](_0x56d7fd[_0x9b04('0x2c')],qs[_0x9b04('0x32')](_0x1a1fcf[_0x9b04('0x2e')][_0x9b04('0x32')]));_0x346b45['attributes']=_0x346b45[_0x9b04('0x31')][_0x9b04('0x33')]?_0x346b45[_0x9b04('0x31')]:_0x56d7fd[_0x9b04('0x2c')];if(_0x1a1fcf[_0x9b04('0x2e')][_0x9b04('0x44')]){_0x346b45[_0x9b04('0x41')]=[{'all':!![]}];}_0x346b45=_['merge']({},_0x346b45,_0x1a1fcf[_0x9b04('0x3f')]);return db['VoiceQueuesLog']['find'](_0x346b45)[_0x9b04('0x24')](handleEntityNotFound(_0x54b70e,null))[_0x9b04('0x24')](respondWithResult(_0x54b70e,null))['catch'](handleError(_0x54b70e,null));};exports[_0x9b04('0x45')]=function(_0x19b0a6,_0x2d23a8){return db[_0x9b04('0x29')][_0x9b04('0x45')](_0x19b0a6['body'],{})[_0x9b04('0x24')](respondWithResult(_0x2d23a8,0xc9))[_0x9b04('0x46')](handleError(_0x2d23a8,null));};exports[_0x9b04('0x23')]=function(_0x50e273,_0x5724dc){if(_0x50e273[_0x9b04('0x47')]['id']){delete _0x50e273[_0x9b04('0x47')]['id'];}return db['VoiceQueuesLog'][_0x9b04('0x48')]({'where':{'id':_0x50e273[_0x9b04('0x49')]['id']}})[_0x9b04('0x24')](handleEntityNotFound(_0x5724dc,null))[_0x9b04('0x24')](saveUpdates(_0x50e273[_0x9b04('0x47')],null))[_0x9b04('0x24')](respondWithResult(_0x5724dc,null))[_0x9b04('0x46')](handleError(_0x5724dc,null));};exports['destroy']=function(_0x1cc568,_0x32ef4b){return db['VoiceQueuesLog'][_0x9b04('0x48')]({'where':{'id':_0x1cc568[_0x9b04('0x49')]['id']}})['then'](handleEntityNotFound(_0x32ef4b,null))[_0x9b04('0x24')](removeEntity(_0x32ef4b,null))['catch'](handleError(_0x32ef4b,null));}; \ No newline at end of file +var _0x6753=['json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','where','merge','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x5a7d9e,_0x4ae29e){var _0x1b2361=function(_0x5339ee){while(--_0x5339ee){_0x5a7d9e['push'](_0x5a7d9e['shift']());}};_0x1b2361(++_0x4ae29e);}(_0x6753,0x1a0));var _0x3675=function(_0xed37a0,_0x30ccff){_0xed37a0=_0xed37a0-0x0;var _0x271d9c=_0x6753[_0xed37a0];return _0x271d9c;};'use strict';var pdf=require(_0x3675('0x0'));var emlformat=require(_0x3675('0x1'));var rimraf=require(_0x3675('0x2'));var zipdir=require(_0x3675('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3675('0x4'));var moment=require(_0x3675('0x5'));var BPromise=require(_0x3675('0x6'));var Mustache=require(_0x3675('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3675('0x8'));var csv=require(_0x3675('0x9'));var ejs=require(_0x3675('0xa'));var fs=require('fs');var _=require(_0x3675('0xb'));var squel=require(_0x3675('0xc'));var crypto=require(_0x3675('0xd'));var jsforce=require(_0x3675('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3675('0x9'));var querystring=require(_0x3675('0xf'));var Papa=require(_0x3675('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3675('0x11'));var as=require(_0x3675('0x12'));var hardwareService=require(_0x3675('0x13'));var logger=require(_0x3675('0x14'))(_0x3675('0x15'));var utils=require(_0x3675('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3675('0x17'));var db=require(_0x3675('0x18'))['db'];function respondWithStatusCode(_0x1ea1ad,_0x4f5ef9){_0x4f5ef9=_0x4f5ef9||0xcc;return function(_0x4e84e0){if(_0x4e84e0){return _0x1ea1ad[_0x3675('0x19')](_0x4f5ef9);}return _0x1ea1ad[_0x3675('0x1a')](_0x4f5ef9)[_0x3675('0x1b')]();};}function respondWithResult(_0x4c0afd,_0x1ba1c){_0x1ba1c=_0x1ba1c||0xc8;return function(_0x503afb){if(_0x503afb){return _0x4c0afd[_0x3675('0x1a')](_0x1ba1c)[_0x3675('0x1c')](_0x503afb);}};}function respondWithFilteredResult(_0x152458,_0x18c36a){return function(_0x2408bd){if(_0x2408bd){var _0x16f296=_0x2408bd[_0x3675('0x1d')],_0x3b6d70=_0x18c36a[_0x3675('0x1e')],_0x3af5a4=_0x18c36a['offset']+_0x18c36a['limit'],_0x5b63b8;if(_0x3af5a4>=_0x16f296){_0x3af5a4=_0x16f296;_0x5b63b8=0xc8;}else{_0x5b63b8=0xce;}_0x152458[_0x3675('0x1a')](_0x5b63b8);return _0x152458[_0x3675('0x1f')](_0x3675('0x20'),_0x3b6d70+'-'+_0x3af5a4+'/'+_0x16f296)[_0x3675('0x1c')](_0x2408bd);}return null;};}function patchUpdates(_0x5c1dea){return function(_0x4eda6a){try{jsonpatch[_0x3675('0x21')](_0x4eda6a,_0x5c1dea,!![]);}catch(_0x2d4d90){return BPromise[_0x3675('0x22')](_0x2d4d90);}return _0x4eda6a[_0x3675('0x23')]();};}function saveUpdates(_0x24293d,_0x13ef3b){return function(_0x3e33b0){if(_0x3e33b0){return _0x3e33b0[_0x3675('0x24')](_0x24293d)[_0x3675('0x25')](function(_0xe4751c){return _0xe4751c;});}return null;};}function removeEntity(_0x317238,_0x565f14){return function(_0x2ede8c){if(_0x2ede8c){return _0x2ede8c['destroy']()['then'](function(){_0x317238[_0x3675('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40543f,_0x511696){return function(_0x278849){if(!_0x278849){_0x40543f[_0x3675('0x19')](0x194);}return _0x278849;};}function handleError(_0x4de85a,_0x1b12a6){_0x1b12a6=_0x1b12a6||0x1f4;return function(_0x141594){logger[_0x3675('0x26')](_0x141594[_0x3675('0x27')]);if(_0x141594[_0x3675('0x28')]){delete _0x141594['name'];}_0x4de85a[_0x3675('0x1a')](_0x1b12a6)[_0x3675('0x29')](_0x141594);};}exports[_0x3675('0x2a')]=function(_0x2be788,_0x337c17){var _0x2793c9={},_0x4b9226={},_0x2e66af={'count':0x0,'rows':[]};var _0xa4bba4=_[_0x3675('0x2b')](db[_0x3675('0x2c')][_0x3675('0x2d')],function(_0x231bfc){return{'name':_0x231bfc[_0x3675('0x2e')],'type':_0x231bfc[_0x3675('0x2f')][_0x3675('0x30')]};});_0x4b9226[_0x3675('0x31')]=_[_0x3675('0x2b')](_0xa4bba4,'name');_0x4b9226[_0x3675('0x32')]=_[_0x3675('0x33')](_0x2be788[_0x3675('0x32')]);_0x4b9226[_0x3675('0x34')]=_[_0x3675('0x35')](_0x4b9226[_0x3675('0x31')],_0x4b9226['query']);_0x2793c9[_0x3675('0x36')]=_[_0x3675('0x35')](_0x4b9226[_0x3675('0x31')],qs['fields'](_0x2be788[_0x3675('0x32')][_0x3675('0x37')]));_0x2793c9[_0x3675('0x36')]=_0x2793c9[_0x3675('0x36')][_0x3675('0x38')]?_0x2793c9[_0x3675('0x36')]:_0x4b9226['model'];if(!_0x2be788[_0x3675('0x32')][_0x3675('0x39')](_0x3675('0x3a'))){_0x2793c9[_0x3675('0x3b')]=qs['limit'](_0x2be788[_0x3675('0x32')][_0x3675('0x3b')]);_0x2793c9[_0x3675('0x1e')]=qs[_0x3675('0x1e')](_0x2be788[_0x3675('0x32')][_0x3675('0x1e')]);}_0x2793c9[_0x3675('0x3c')]=qs['sort'](_0x2be788[_0x3675('0x32')]['sort']);_0x2793c9['where']=qs[_0x3675('0x34')](_[_0x3675('0x3d')](_0x2be788[_0x3675('0x32')],_0x4b9226['filters']),_0xa4bba4);if(_0x2be788['query']['filter']){_0x2793c9[_0x3675('0x3e')]=_[_0x3675('0x3f')](_0x2793c9[_0x3675('0x3e')],{'$or':_[_0x3675('0x2b')](_0xa4bba4,function(_0x307f35){if(_0x307f35[_0x3675('0x2f')]!==_0x3675('0x40')){var _0x4b7895={};_0x4b7895[_0x307f35[_0x3675('0x28')]]={'$like':'%'+_0x2be788[_0x3675('0x32')]['filter']+'%'};return _0x4b7895;}})});}_0x2793c9=_[_0x3675('0x3f')]({},_0x2793c9,_0x2be788[_0x3675('0x41')]);var _0x43539e={'where':_0x2793c9[_0x3675('0x3e')]};return db[_0x3675('0x2c')]['count'](_0x43539e)[_0x3675('0x25')](function(_0x443d72){_0x2e66af[_0x3675('0x1d')]=_0x443d72;if(_0x2be788['query'][_0x3675('0x42')]){_0x2793c9['include']=[{'all':!![]}];}return db[_0x3675('0x2c')]['findAll'](_0x2793c9);})[_0x3675('0x25')](function(_0x161593){_0x2e66af['rows']=_0x161593;return _0x2e66af;})[_0x3675('0x25')](respondWithFilteredResult(_0x337c17,_0x2793c9))[_0x3675('0x43')](handleError(_0x337c17,null));};exports[_0x3675('0x44')]=function(_0x303235,_0x1b830a){var _0x478e45={'raw':!![],'where':{'id':_0x303235[_0x3675('0x45')]['id']}},_0x292fff={};_0x292fff[_0x3675('0x31')]=_[_0x3675('0x33')](db[_0x3675('0x2c')][_0x3675('0x2d')]);_0x292fff[_0x3675('0x32')]=_[_0x3675('0x33')](_0x303235[_0x3675('0x32')]);_0x292fff[_0x3675('0x34')]=_[_0x3675('0x35')](_0x292fff[_0x3675('0x31')],_0x292fff[_0x3675('0x32')]);_0x478e45[_0x3675('0x36')]=_[_0x3675('0x35')](_0x292fff['model'],qs[_0x3675('0x37')](_0x303235[_0x3675('0x32')][_0x3675('0x37')]));_0x478e45['attributes']=_0x478e45[_0x3675('0x36')]['length']?_0x478e45[_0x3675('0x36')]:_0x292fff[_0x3675('0x31')];if(_0x303235[_0x3675('0x32')][_0x3675('0x42')]){_0x478e45[_0x3675('0x46')]=[{'all':!![]}];}_0x478e45=_['merge']({},_0x478e45,_0x303235['options']);return db[_0x3675('0x2c')][_0x3675('0x47')](_0x478e45)[_0x3675('0x25')](handleEntityNotFound(_0x1b830a,null))[_0x3675('0x25')](respondWithResult(_0x1b830a,null))[_0x3675('0x43')](handleError(_0x1b830a,null));};exports[_0x3675('0x48')]=function(_0x14cd0d,_0x4d5167){return db[_0x3675('0x2c')][_0x3675('0x48')](_0x14cd0d[_0x3675('0x49')],{})[_0x3675('0x25')](respondWithResult(_0x4d5167,0xc9))[_0x3675('0x43')](handleError(_0x4d5167,null));};exports['update']=function(_0x437c6d,_0x2897cd){if(_0x437c6d[_0x3675('0x49')]['id']){delete _0x437c6d[_0x3675('0x49')]['id'];}return db[_0x3675('0x2c')][_0x3675('0x47')]({'where':{'id':_0x437c6d[_0x3675('0x45')]['id']}})['then'](handleEntityNotFound(_0x2897cd,null))['then'](saveUpdates(_0x437c6d[_0x3675('0x49')],null))['then'](respondWithResult(_0x2897cd,null))[_0x3675('0x43')](handleError(_0x2897cd,null));};exports['destroy']=function(_0x15241a,_0x5463ae){return db['VoiceQueuesLog'][_0x3675('0x47')]({'where':{'id':_0x15241a['params']['id']}})['then'](handleEntityNotFound(_0x5463ae,null))['then'](removeEntity(_0x5463ae,null))[_0x3675('0x43')](handleError(_0x5463ae,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 8f0d7d5..507512a 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 _0x9350=['api','moment','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util','../../config/logger'];(function(_0x2bd88d,_0x2d5dc3){var _0x5516d4=function(_0x1272c8){while(--_0x1272c8){_0x2bd88d['push'](_0x2bd88d['shift']());}};_0x5516d4(++_0x2d5dc3);}(_0x9350,0x19e));var _0x0935=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x9350[_0x3e69ae];return _0x3d7f42;};'use strict';var _=require('lodash');var util=require(_0x0935('0x0'));var logger=require(_0x0935('0x1'))(_0x0935('0x2'));var moment=require(_0x0935('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0935('0x4'));var rimraf=require(_0x0935('0x5'));var config=require(_0x0935('0x6'));var attributes=require(_0x0935('0x7'));module['exports']=function(_0x39bca5,_0x91e440){return _0x39bca5[_0x0935('0x8')](_0x0935('0x9'),attributes,{'tableName':_0x0935('0xa'),'paranoid':![],'indexes':[{'name':_0x0935('0xb'),'fields':['event',_0x0935('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd3c3=['event','dtm','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd3c3,0x182));var _0x3d3c=function(_0x1a31e9,_0x433ac0){_0x1a31e9=_0x1a31e9-0x0;var _0x87e8a0=_0xd3c3[_0x1a31e9];return _0x87e8a0;};'use strict';var _=require(_0x3d3c('0x0'));var util=require('util');var logger=require(_0x3d3c('0x1'))(_0x3d3c('0x2'));var moment=require(_0x3d3c('0x3'));var BPromise=require(_0x3d3c('0x4'));var rp=require(_0x3d3c('0x5'));var fs=require('fs');var path=require(_0x3d3c('0x6'));var rimraf=require(_0x3d3c('0x7'));var config=require('../../config/environment');var attributes=require(_0x3d3c('0x8'));module[_0x3d3c('0x9')]=function(_0x26c044,_0x1df5da){return _0x26c044[_0x3d3c('0xa')](_0x3d3c('0xb'),attributes,{'tableName':_0x3d3c('0xc'),'paranoid':![],'indexes':[{'name':_0x3d3c('0xd'),'fields':[_0x3d3c('0xe'),_0x3d3c('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 0780344..94ed6a6 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 _0xeb74=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x320f67,_0x462994){var _0xc16213=function(_0x25164e){while(--_0x25164e){_0x320f67['push'](_0x320f67['shift']());}};_0xc16213(++_0x462994);}(_0xeb74,0xe3));var _0x4eb7=function(_0x576d28,_0x2794fb){_0x576d28=_0x576d28-0x0;var _0x45068e=_0xeb74[_0x576d28];return _0x45068e;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3986cd,_0x54859c,_0xcac7c5){return new BPromise(function(_0x2cffe7,_0x588a1c){return client['request'](_0x3986cd,_0xcac7c5)[_0x4eb7('0xc')](function(_0x2f8296){logger['info'](_0x4eb7('0xd'),_0x54859c,'request\x20sent');logger[_0x4eb7('0xe')](_0x4eb7('0xf'),_0x54859c,_0x4eb7('0x10'),JSON['stringify'](_0x2f8296));if(_0x2f8296[_0x4eb7('0x11')]){if(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x12')]===0x1f4){logger[_0x4eb7('0x11')](_0x4eb7('0xd'),_0x54859c,_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);return _0x588a1c(_0x2f8296['error']['message']);}logger['error'](_0x4eb7('0xd'),_0x54859c,_0x2f8296['error'][_0x4eb7('0x13')]);return _0x2cffe7(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);}else{logger[_0x4eb7('0x14')](_0x4eb7('0xd'),_0x54859c,_0x4eb7('0x10'));_0x2cffe7(_0x2f8296[_0x4eb7('0x15')][_0x4eb7('0x13')]);}})[_0x4eb7('0x16')](function(_0x17377f){logger['error'](_0x4eb7('0xd'),_0x54859c,_0x17377f);_0x588a1c(_0x17377f);});});} \ No newline at end of file +var _0x84a0=['client','http','request','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x584bcd,_0x59c4b7){var _0x146bc7=function(_0x20b30d){while(--_0x20b30d){_0x584bcd['push'](_0x584bcd['shift']());}};_0x146bc7(++_0x59c4b7);}(_0x84a0,0x66));var _0x084a=function(_0x550c32,_0x38e241){_0x550c32=_0x550c32-0x0;var _0x59e529=_0x84a0[_0x550c32];return _0x59e529;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e6810,_0x373d2,_0x2b30bc){return new BPromise(function(_0x58d419,_0x1051a9){return client[_0x084a('0xa')](_0x2e6810,_0x2b30bc)[_0x084a('0xb')](function(_0x2888e3){logger[_0x084a('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x373d2,'request\x20sent');logger[_0x084a('0xd')](_0x084a('0xe'),_0x373d2,_0x084a('0xf'),JSON[_0x084a('0x10')](_0x2888e3));if(_0x2888e3[_0x084a('0x11')]){if(_0x2888e3['error']['code']===0x1f4){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);return _0x1051a9(_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);}logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3['error'][_0x084a('0x13')]);return _0x58d419(_0x2888e3['error'][_0x084a('0x13')]);}else{logger[_0x084a('0xc')](_0x084a('0x12'),_0x373d2,_0x084a('0xf'));_0x58d419(_0x2888e3[_0x084a('0x14')]['message']);}})[_0x084a('0x15')](function(_0x4abd81){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x4abd81);_0x1051a9(_0x4abd81);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 2fc6184..7876b65 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 _0x3ec0=['describe','/:id','download','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe'];(function(_0x2bbc57,_0x44735f){var _0x356fbc=function(_0x38fb30){while(--_0x38fb30){_0x2bbc57['push'](_0x2bbc57['shift']());}};_0x356fbc(++_0x44735f);}(_0x3ec0,0xad));var _0x03ec=function(_0x1439c4,_0x37f12b){_0x1439c4=_0x1439c4-0x0;var _0x9ed70d=_0x3ec0[_0x1439c4];return _0x9ed70d;};'use strict';var multer=require(_0x03ec('0x0'));var util=require(_0x03ec('0x1'));var path=require(_0x03ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x03ec('0x3'));var router=express[_0x03ec('0x4')]();var auth=require(_0x03ec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x03ec('0x6'));var controller=require(_0x03ec('0x7'));router[_0x03ec('0x8')]('/',auth[_0x03ec('0x9')](),controller['index']);router[_0x03ec('0x8')](_0x03ec('0xa'),auth[_0x03ec('0x9')](),controller[_0x03ec('0xb')]);router[_0x03ec('0x8')](_0x03ec('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x03ec('0xd')]);router[_0x03ec('0x8')]('/:id/downloads',controller[_0x03ec('0xe')]);router[_0x03ec('0x8')](_0x03ec('0xf'),auth[_0x03ec('0x9')](),controller[_0x03ec('0x10')]);router[_0x03ec('0x11')]('/',auth[_0x03ec('0x9')](),controller['create']);router[_0x03ec('0x11')](_0x03ec('0xf'),auth['isAuthenticated'](),controller[_0x03ec('0x12')]);router[_0x03ec('0x13')]('/:id',auth[_0x03ec('0x9')](),controller[_0x03ec('0x14')]);router[_0x03ec('0x15')](_0x03ec('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x03ec('0x16')]=router; \ No newline at end of file +var _0xec94=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','update','delete','destroy','exports','multer','util'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0xec94,0x15c));var _0x4ec9=function(_0x353c02,_0xf0459a){_0x353c02=_0x353c02-0x0;var _0x2ea4cf=_0xec94[_0x353c02];return _0x2ea4cf;};'use strict';var multer=require(_0x4ec9('0x0'));var util=require(_0x4ec9('0x1'));var path=require('path');var timeout=require(_0x4ec9('0x2'));var express=require('express');var router=express[_0x4ec9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4ec9('0x4'));var config=require(_0x4ec9('0x5'));var controller=require(_0x4ec9('0x6'));router[_0x4ec9('0x7')]('/',auth[_0x4ec9('0x8')](),controller[_0x4ec9('0x9')]);router[_0x4ec9('0x7')](_0x4ec9('0xa'),auth[_0x4ec9('0x8')](),controller[_0x4ec9('0xb')]);router['get'](_0x4ec9('0xc'),auth[_0x4ec9('0x8')](),controller[_0x4ec9('0xd')]);router[_0x4ec9('0x7')]('/:id/download',auth[_0x4ec9('0x8')](),controller['download']);router[_0x4ec9('0x7')](_0x4ec9('0xe'),controller[_0x4ec9('0xf')]);router[_0x4ec9('0x7')](_0x4ec9('0x10'),auth[_0x4ec9('0x8')](),controller[_0x4ec9('0x11')]);router[_0x4ec9('0x12')]('/',auth['isAuthenticated'](),controller[_0x4ec9('0x13')]);router[_0x4ec9('0x12')](_0x4ec9('0x10'),auth[_0x4ec9('0x8')](),controller[_0x4ec9('0x14')]);router['put'](_0x4ec9('0xc'),auth['isAuthenticated'](),controller[_0x4ec9('0x15')]);router[_0x4ec9('0x16')](_0x4ec9('0xc'),auth[_0x4ec9('0x8')](),controller[_0x4ec9('0x17')]);module[_0x4ec9('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 2899d95..6378075 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 _0xdd97=['channel','membername','split','NEW','TEXT','FLOAT','BOOLEAN','createdAt','DATE','updatedAt','MM-DD-YYYY\x20HH:mm','toString','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue'];(function(_0x3d259e,_0x1b046a){var _0x418d99=function(_0x13b931){while(--_0x13b931){_0x3d259e['push'](_0x3d259e['shift']());}};_0x418d99(++_0x1b046a);}(_0xdd97,0x171));var _0x7dd9=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xdd97[_0x51b0dc];return _0x13fa89;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7dd9('0x0'));var path=require(_0x7dd9('0x1'));module[_0x7dd9('0x2')]={'format':{'type':Sequelize[_0x7dd9('0x3')],'get':function(){return this[_0x7dd9('0x4')](_0x7dd9('0x5'))?path[_0x7dd9('0x6')](this['getDataValue'](_0x7dd9('0x5'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7dd9('0x7')],'set':function(_0x1da9b3){if(_0x1da9b3){this[_0x7dd9('0x8')](_0x7dd9('0x9'),_0x1da9b3);this[_0x7dd9('0x8')](_0x7dd9('0xa'),_0x1da9b3[_0x7dd9('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x7dd9('0x7')]},'calleridnum':{'type':Sequelize[_0x7dd9('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x7dd9('0x7')]},'connectedlinename':{'type':Sequelize[_0x7dd9('0x7')]},'accountcode':{'type':Sequelize[_0x7dd9('0x7')]},'context':{'type':Sequelize[_0x7dd9('0x7')]},'exten':{'type':Sequelize[_0x7dd9('0x7')]},'value':{'type':Sequelize[_0x7dd9('0x7')]},'type':{'type':Sequelize[_0x7dd9('0x7')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x7dd9('0x7')]},'userDisposition':{'type':Sequelize[_0x7dd9('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x7dd9('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x7dd9('0x7')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0x7dd9('0xc')},'fileUri':{'type':Sequelize[_0x7dd9('0xd')]},'fileText':{'type':Sequelize[_0x7dd9('0xd')]},'failureReason':{'type':Sequelize[_0x7dd9('0xd')]},'sentiment':{'type':Sequelize[_0x7dd9('0x7')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x7dd9('0xe')]},'tempSentiment':{'type':Sequelize[_0x7dd9('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7dd9('0x4')](_0x7dd9('0x10')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x7dd9('0x11')],'get':function(){return moment(this[_0x7dd9('0x4')](_0x7dd9('0x12')))['format'](_0x7dd9('0x13'))[_0x7dd9('0x14')]();}}}; \ No newline at end of file +var _0xaa02=['extname','STRING','setDataValue','channel','split','INTEGER','TEXT','FLOAT','BOOLEAN','DATE','createdAt','format','toString','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','exports','VIRTUAL','getDataValue','value'];(function(_0x1f5eb6,_0x4e9737){var _0x2f37f3=function(_0x1005de){while(--_0x1005de){_0x1f5eb6['push'](_0x1f5eb6['shift']());}};_0x2f37f3(++_0x4e9737);}(_0xaa02,0xbf));var _0x2aa0=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xaa02[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0x2aa0('0x0'));var moment=require(_0x2aa0('0x1'));var path=require(_0x2aa0('0x2'));module[_0x2aa0('0x3')]={'format':{'type':Sequelize[_0x2aa0('0x4')],'get':function(){return this[_0x2aa0('0x5')](_0x2aa0('0x6'))?path[_0x2aa0('0x7')](this[_0x2aa0('0x5')](_0x2aa0('0x6'))):undefined;}},'uniqueid':{'type':Sequelize[_0x2aa0('0x8')]},'channel':{'type':Sequelize[_0x2aa0('0x8')],'set':function(_0x146dfa){if(_0x146dfa){this[_0x2aa0('0x9')](_0x2aa0('0xa'),_0x146dfa);this['setDataValue']('membername',_0x146dfa[_0x2aa0('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2aa0('0x8')]},'connectedlinenum':{'type':Sequelize[_0x2aa0('0x8')]},'connectedlinename':{'type':Sequelize[_0x2aa0('0x8')]},'accountcode':{'type':Sequelize[_0x2aa0('0x8')]},'context':{'type':Sequelize[_0x2aa0('0x8')]},'exten':{'type':Sequelize[_0x2aa0('0x8')]},'value':{'type':Sequelize[_0x2aa0('0x8')]},'type':{'type':Sequelize[_0x2aa0('0x8')]},'rating':{'type':Sequelize[_0x2aa0('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x2aa0('0x8')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x2aa0('0xd')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x2aa0('0x8')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x2aa0('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x2aa0('0x8')]},'sPositive':{'type':Sequelize[_0x2aa0('0xe')]},'sNegative':{'type':Sequelize[_0x2aa0('0xe')]},'sNeutral':{'type':Sequelize[_0x2aa0('0xe')]},'sMixed':{'type':Sequelize[_0x2aa0('0xe')]},'tempSentiment':{'type':Sequelize[_0x2aa0('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x2aa0('0x10')],'get':function(){return moment(this[_0x2aa0('0x5')](_0x2aa0('0x11')))[_0x2aa0('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x2aa0('0x13')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x2aa0('0x14')))[_0x2aa0('0x12')](_0x2aa0('0x15'))[_0x2aa0('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 87c447c..2509221 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 _0x4e13=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','VoiceRecording','length','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','File:\x20\x22','unlinkSync','listBuckets','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','fileText','root','.txt','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','jsforce','to-csv','papaparse','uuid/v4','ioredis'];(function(_0xa31e51,_0x384c20){var _0x1e77cf=function(_0x378522){while(--_0x378522){_0xa31e51['push'](_0xa31e51['shift']());}};_0x1e77cf(++_0x384c20);}(_0x4e13,0x86));var _0x34e1=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x4e13[_0xd336fa];return _0x3370b1;};'use strict';var pdf=require(_0x34e1('0x0'));var emlformat=require(_0x34e1('0x1'));var rimraf=require(_0x34e1('0x2'));var zipdir=require(_0x34e1('0x3'));var jsonpatch=require(_0x34e1('0x4'));var rp=require(_0x34e1('0x5'));var moment=require('moment');var BPromise=require(_0x34e1('0x6'));var Mustache=require(_0x34e1('0x7'));var util=require(_0x34e1('0x8'));var path=require('path');var sox=require(_0x34e1('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x34e1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x34e1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x34e1('0xc'));var querystring=require('querystring');var Papa=require(_0x34e1('0xd'));var AWS=require('aws-sdk');var uuidv4=require(_0x34e1('0xe'));var Redis=require(_0x34e1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x34e1('0x10'));var as=require(_0x34e1('0x11'));var hardwareService=require(_0x34e1('0x12'));var logger=require(_0x34e1('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x34e1('0x14'));var db=require(_0x34e1('0x15'))['db'];function respondWithStatusCode(_0x41cd09,_0x31ede6){_0x31ede6=_0x31ede6||0xcc;return function(_0x463618){if(_0x463618){return _0x41cd09[_0x34e1('0x16')](_0x31ede6);}return _0x41cd09[_0x34e1('0x17')](_0x31ede6)[_0x34e1('0x18')]();};}function respondWithResult(_0x41f778,_0x1464e6){_0x1464e6=_0x1464e6||0xc8;return function(_0x49e4b1){if(_0x49e4b1){return _0x41f778[_0x34e1('0x17')](_0x1464e6)[_0x34e1('0x19')](_0x49e4b1);}};}function respondWithFilteredResult(_0x4285eb,_0x1cf1f8){return function(_0x1e4c19){if(_0x1e4c19){var _0x481b50=_0x1e4c19[_0x34e1('0x1a')],_0x453f52=_0x1cf1f8[_0x34e1('0x1b')],_0x4cc8d4=_0x1cf1f8['offset']+_0x1cf1f8['limit'],_0x422962;if(_0x4cc8d4>=_0x481b50){_0x4cc8d4=_0x481b50;_0x422962=0xc8;}else{_0x422962=0xce;}_0x4285eb[_0x34e1('0x17')](_0x422962);return _0x4285eb[_0x34e1('0x1c')](_0x34e1('0x1d'),_0x453f52+'-'+_0x4cc8d4+'/'+_0x481b50)[_0x34e1('0x19')](_0x1e4c19);}return null;};}function patchUpdates(_0x747292){return function(_0x35e0a6){try{jsonpatch[_0x34e1('0x1e')](_0x35e0a6,_0x747292,!![]);}catch(_0x2bb7f5){return BPromise['reject'](_0x2bb7f5);}return _0x35e0a6[_0x34e1('0x1f')]();};}function saveUpdates(_0x4d2ab3,_0x18e8f3){return function(_0x55f403){if(_0x55f403){return _0x55f403[_0x34e1('0x20')](_0x4d2ab3)[_0x34e1('0x21')](function(_0x2e807b){return _0x2e807b;});}return null;};}function removeEntity(_0x4c96e5,_0x5a999c){return function(_0x31318d){if(_0x31318d){return _0x31318d[_0x34e1('0x22')]()['then'](function(){_0x4c96e5[_0x34e1('0x17')](0xcc)[_0x34e1('0x18')]();});}};}function handleEntityNotFound(_0xa8b6bb,_0x163cc8){return function(_0xfe0426){if(!_0xfe0426){_0xa8b6bb['sendStatus'](0x194);}return _0xfe0426;};}function handleError(_0x38d735,_0x29d28b){_0x29d28b=_0x29d28b||0x1f4;return function(_0x48606a){logger['error'](_0x48606a['stack']);if(_0x48606a['name']){delete _0x48606a[_0x34e1('0x23')];}_0x38d735[_0x34e1('0x17')](_0x29d28b)[_0x34e1('0x24')](_0x48606a);};}exports[_0x34e1('0x25')]=function(_0x3df0a9,_0x1b1ae1){var _0x34db33={},_0x277def={},_0x13aec5={'count':0x0,'rows':[]};var _0xac66c2=_[_0x34e1('0x26')](db['VoiceRecording'][_0x34e1('0x27')],function(_0x5d633d){return{'name':_0x5d633d[_0x34e1('0x28')],'type':_0x5d633d[_0x34e1('0x29')][_0x34e1('0x2a')]};});_0x277def[_0x34e1('0x2b')]=_[_0x34e1('0x2c')](_[_0x34e1('0x26')](_0xac66c2,'name'),[_0x34e1('0x2d')]);_0x277def[_0x34e1('0x2e')]=_[_0x34e1('0x2f')](_0x3df0a9['query']);_0x277def[_0x34e1('0x30')]=_[_0x34e1('0x31')](_0x277def[_0x34e1('0x2b')],_0x277def[_0x34e1('0x2e')]);_0x34db33[_0x34e1('0x32')]=_['intersection'](_0x277def[_0x34e1('0x2b')],qs[_0x34e1('0x33')](_0x3df0a9['query'][_0x34e1('0x33')]));_0x34db33['attributes']=_0x34db33[_0x34e1('0x32')]['length']?_0x34db33['attributes']:_0x277def[_0x34e1('0x2b')];if(!_0x3df0a9['query']['hasOwnProperty']('nolimit')){_0x34db33['limit']=qs['limit'](_0x3df0a9[_0x34e1('0x2e')][_0x34e1('0x34')]);_0x34db33[_0x34e1('0x1b')]=qs[_0x34e1('0x1b')](_0x3df0a9['query'][_0x34e1('0x1b')]);}_0x34db33[_0x34e1('0x35')]=qs[_0x34e1('0x36')](_0x3df0a9['query'][_0x34e1('0x36')]);_0x34db33[_0x34e1('0x37')]=qs[_0x34e1('0x30')](_[_0x34e1('0x38')](_0x3df0a9[_0x34e1('0x2e')],_0x277def[_0x34e1('0x30')]),_0xac66c2);if(_0x3df0a9[_0x34e1('0x2e')][_0x34e1('0x39')]){_0x34db33[_0x34e1('0x37')]=_[_0x34e1('0x3a')](_0x34db33[_0x34e1('0x37')],{'$or':_['map'](_0xac66c2,function(_0x2cddd0){if(_0x2cddd0['type']!==_0x34e1('0x3b')){var _0x4216e9={};_0x4216e9[_0x2cddd0[_0x34e1('0x23')]]={'$like':'%'+_0x3df0a9[_0x34e1('0x2e')][_0x34e1('0x39')]+'%'};return _0x4216e9;}})});}_0x34db33=_[_0x34e1('0x3a')]({},_0x34db33,_0x3df0a9[_0x34e1('0x3c')]);var _0x57b750={'where':_0x34db33[_0x34e1('0x37')]};return db['VoiceRecording']['count'](_0x57b750)[_0x34e1('0x21')](function(_0x5b7f85){_0x13aec5[_0x34e1('0x1a')]=_0x5b7f85;if(_0x3df0a9[_0x34e1('0x2e')][_0x34e1('0x3d')]){_0x34db33[_0x34e1('0x3e')]=[{'all':!![]}];}return db['VoiceRecording'][_0x34e1('0x3f')](_0x34db33);})[_0x34e1('0x21')](function(_0xe9054c){_0x13aec5[_0x34e1('0x40')]=_0xe9054c;return _0x13aec5;})[_0x34e1('0x21')](respondWithFilteredResult(_0x1b1ae1,_0x34db33))[_0x34e1('0x41')](handleError(_0x1b1ae1,null));};exports[_0x34e1('0x42')]=function(_0x33196d,_0x241f2c){var _0x29c0d4={'raw':![],'where':{'id':_0x33196d[_0x34e1('0x43')]['id']}},_0x6b2c2b={};_0x6b2c2b['model']=_[_0x34e1('0x2f')](db[_0x34e1('0x44')][_0x34e1('0x27')]);_0x6b2c2b[_0x34e1('0x2e')]=_[_0x34e1('0x2f')](_0x33196d[_0x34e1('0x2e')]);_0x6b2c2b[_0x34e1('0x30')]=_['intersection'](_0x6b2c2b['model'],_0x6b2c2b['query']);_0x29c0d4[_0x34e1('0x32')]=_[_0x34e1('0x31')](_0x6b2c2b[_0x34e1('0x2b')],qs[_0x34e1('0x33')](_0x33196d[_0x34e1('0x2e')][_0x34e1('0x33')]));_0x29c0d4[_0x34e1('0x32')]=_0x29c0d4['attributes'][_0x34e1('0x45')]?_0x29c0d4[_0x34e1('0x32')]:_0x6b2c2b[_0x34e1('0x2b')];if(_0x33196d[_0x34e1('0x2e')][_0x34e1('0x3d')]){_0x29c0d4['include']=[{'all':!![]}];}_0x29c0d4=_[_0x34e1('0x3a')]({},_0x29c0d4,_0x33196d[_0x34e1('0x3c')]);return db[_0x34e1('0x44')][_0x34e1('0x46')](_0x29c0d4)[_0x34e1('0x21')](handleEntityNotFound(_0x241f2c,null))[_0x34e1('0x21')](respondWithResult(_0x241f2c,null))[_0x34e1('0x41')](handleError(_0x241f2c,null));};exports['create']=function(_0x4bfc1a,_0x3c8bd2){return db[_0x34e1('0x44')][_0x34e1('0x47')](_0x4bfc1a['body'],{})[_0x34e1('0x21')](respondWithResult(_0x3c8bd2,0xc9))[_0x34e1('0x41')](handleError(_0x3c8bd2,null));};exports[_0x34e1('0x20')]=function(_0x37b2fd,_0x3f4375){if(_0x37b2fd[_0x34e1('0x48')]['id']){delete _0x37b2fd[_0x34e1('0x48')]['id'];}return db[_0x34e1('0x44')][_0x34e1('0x46')]({'where':{'id':_0x37b2fd[_0x34e1('0x43')]['id']}})[_0x34e1('0x21')](handleEntityNotFound(_0x3f4375,null))[_0x34e1('0x21')](saveUpdates(_0x37b2fd[_0x34e1('0x48')],null))['then'](respondWithResult(_0x3f4375,null))[_0x34e1('0x41')](handleError(_0x3f4375,null));};exports[_0x34e1('0x49')]=function(_0xb1a9f1,_0x2a4a0f){return db['VoiceRecording'][_0x34e1('0x49')]()[_0x34e1('0x21')](respondWithResult(_0x2a4a0f,null))[_0x34e1('0x41')](handleError(_0x2a4a0f,null));};exports[_0x34e1('0x4a')]=function(_0x39bc1f,_0x5a0090,_0x549771){var _0x36de4c=require(_0x34e1('0x4b'));var _0x3a71b2=![];var _0x229143={};if(_0x39bc1f[_0x34e1('0x2e')][_0x34e1('0x29')]&&_0x39bc1f[_0x34e1('0x2e')][_0x34e1('0x29')]===_0x34e1('0x4c')){_0x229143[_0x34e1('0x4c')]=_0x39bc1f[_0x34e1('0x43')]['id'];}else{_0x229143['id']=_0x39bc1f[_0x34e1('0x43')]['id'];}return db[_0x34e1('0x44')][_0x34e1('0x46')]({'where':_0x229143,'attributes':['id','value'],'raw':!![]})[_0x34e1('0x21')](handleEntityNotFound(_0x5a0090,null))[_0x34e1('0x21')](function(_0x1162b7){if(_0x1162b7){var _0x310a08=_0x1162b7[_0x34e1('0x4d')];var _0x432b1e=util[_0x34e1('0x2d')](_0x34e1('0x4e'),_0x310a08);if(fs[_0x34e1('0x4f')](_0x432b1e)){_0x3a71b2=!![];return _0x36de4c[_0x34e1('0x50')](_0x432b1e,_0x310a08,config[_0x34e1('0x51')][_0x34e1('0x52')])[_0x34e1('0x21')](function(){return _0x1162b7;});}return _0x1162b7;}})[_0x34e1('0x21')](function(_0x421643){if(_0x421643){var _0x42ec2e=_0x421643[_0x34e1('0x4d')];if(!fs['existsSync'](_0x42ec2e)){throw new db[(_0x34e1('0x53'))][(_0x34e1('0x54'))](_0x34e1('0x55'));}if(_0x421643[_0x34e1('0x56')]){return _0x5a0090[_0x34e1('0x4a')](_0x42ec2e,_0x421643[_0x34e1('0x56')]+path[_0x34e1('0x57')](_0x42ec2e),function(){if(_0x3a71b2){fs[_0x34e1('0x58')](_0x42ec2e);}});}else{return _0x5a0090[_0x34e1('0x4a')](_0x42ec2e,function(_0x3310bb){if(_0x3a71b2){fs[_0x34e1('0x58')](_0x42ec2e);}});}}})[_0x34e1('0x41')](function(_0x2cf786){if(_0x2cf786[_0x34e1('0x59')]===_0x34e1('0x55')){_0x5a0090[_0x34e1('0x17')](0x194)[_0x34e1('0x24')](_0x34e1('0x5a'));}else{return handleError(_0x5a0090,null);}});};exports[_0x34e1('0x5b')]=function(_0x3af9c2,_0x5aedf8,_0x81a763){var _0x47e9c2=require('../../components/encryptor');var _0x44402a=![];var _0x1f53a7={'$and':[db[_0x34e1('0x5c')]['where'](db[_0x34e1('0x5c')]['fn'](_0x34e1('0x5d'),db[_0x34e1('0x5c')][_0x34e1('0x5e')](_0x34e1('0x4c'))),_0x3af9c2[_0x34e1('0x2e')][_0x34e1('0x5f')])]};if(_0x3af9c2[_0x34e1('0x2e')]['type']&&_0x3af9c2['query']['type']===_0x34e1('0x4c')){_0x1f53a7[_0x34e1('0x60')]['push']({'uniqueid':_0x3af9c2['params']['id']});}else{_0x1f53a7[_0x34e1('0x60')][_0x34e1('0x61')]({'id':_0x3af9c2['params']['id']});}return db[_0x34e1('0x44')][_0x34e1('0x46')]({'where':_0x1f53a7,'attributes':['id','value'],'raw':!![]})[_0x34e1('0x21')](handleEntityNotFound(_0x5aedf8,null))['then'](function(_0x5823b7){if(_0x5823b7){var _0x187a38=util['format'](_0x34e1('0x4e'),_0x5823b7['value']);if(fs[_0x34e1('0x4f')](_0x187a38)){_0x44402a=!![];return _0x47e9c2[_0x34e1('0x50')](_0x187a38,_0x5823b7[_0x34e1('0x4d')],config['secrets'][_0x34e1('0x52')])[_0x34e1('0x21')](function(){return _0x5823b7;});}return _0x5823b7;}})[_0x34e1('0x21')](function(_0x2a6977){if(_0x2a6977){if(!fs['existsSync'](_0x2a6977['value'])){throw new db[(_0x34e1('0x53'))]['ValidationError'](_0x34e1('0x55'));}if(_0x2a6977[_0x34e1('0x56')]){return _0x5aedf8[_0x34e1('0x4a')](_0x2a6977[_0x34e1('0x4d')],_0x2a6977[_0x34e1('0x56')]+path[_0x34e1('0x57')](_0x2a6977[_0x34e1('0x4d')]),function(){if(_0x44402a){fs[_0x34e1('0x58')](_0x2a6977[_0x34e1('0x4d')]);}});}else{return _0x5aedf8[_0x34e1('0x4a')](_0x2a6977[_0x34e1('0x4d')],function(_0x4abd4c){if(_0x44402a){fs[_0x34e1('0x58')](_0x2a6977[_0x34e1('0x4d')]);}});}}})[_0x34e1('0x41')](handleError(_0x5aedf8,null));};exports[_0x34e1('0x22')]=function(_0x37dba8,_0x30875c){return db[_0x34e1('0x44')][_0x34e1('0x46')]({'where':{'id':_0x37dba8['params']['id']}})[_0x34e1('0x21')](function(_0x3dc2c6){if(!_0x3dc2c6)throw new ReferenceError(_0x34e1('0x62'));return _0x3dc2c6;})['then'](function(_0xa16020){var _0x522e1f=_0xa16020[_0x34e1('0x4d')];logger[_0x34e1('0x63')](_0x34e1('0x64'),_0x522e1f);if(!_['isNil'](_0xa16020[_0x34e1('0x4d')])&&fs[_0x34e1('0x4f')](_0x522e1f)){logger[_0x34e1('0x63')]('File:\x20\x22'+_0x522e1f+_0x34e1('0x65'));fs['unlinkSync'](_0x522e1f);}_0x522e1f=_0x522e1f+_0x34e1('0x66');if(!_[_0x34e1('0x67')](_0xa16020['value'])&&fs['existsSync'](_0x522e1f)){logger[_0x34e1('0x63')](_0x34e1('0x68')+_0x522e1f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x34e1('0x69')](_0x522e1f);}return _0xa16020;})[_0x34e1('0x21')](function(_0x441794){if(!_0x441794)throw new InternalError();return _0x441794[_0x34e1('0x22')]();})[_0x34e1('0x21')](function(){_0x30875c[_0x34e1('0x17')](0xcc)[_0x34e1('0x18')]();})['catch'](handleError(_0x30875c,null));};function getBucketslist(_0xf59381,_0x236446,_0x3cddde){return new Promise(function(_0x394271,_0x254a6a){var _0x17e2e0=new AWS['S3']({'accessKeyId':_0x236446,'secretAccessKey':_0xf59381,'region':_0x3cddde});_0x17e2e0[_0x34e1('0x6a')]({},function(_0x39c9cb,_0x4a8bc2){if(_0x39c9cb){return _0x254a6a(_0x39c9cb);}else{return _0x394271(_0x4a8bc2);}});});}function createBucket(_0x3becae,_0x37a4d3,_0x1cacf3,_0xc9c167){return new Promise(function(_0x35dc16,_0x57d848){var _0x1f6163=new AWS['S3']({'accessKeyId':_0x37a4d3,'secretAccessKey':_0x3becae,'region':_0x1cacf3});_0x1f6163['createBucket']({'Bucket':_0xc9c167},function(_0x7144d0,_0xc0f4b8){if(_0x7144d0){return _0x57d848(_0x7144d0);}else{return _0x35dc16(_0xc0f4b8);}});});}function uploadFile(_0x75428,_0x193ae9,_0x3cff96,_0xb7cfc8,_0x4c279f,_0x4130f3){return new Promise(function(_0x54169e,_0x3d4895){var _0x76ca34=new AWS['S3']({'accessKeyId':_0x193ae9,'secretAccessKey':_0x75428,'region':_0x3cff96});_0x76ca34[_0x34e1('0x6b')]({'Bucket':_0xb7cfc8,'Key':_0x4c279f,'Body':_0x4130f3},function(_0x44d4fd,_0x23dc21){if(_0x44d4fd){return _0x3d4895(_0x44d4fd);}else{return _0x54169e(_0x23dc21);}});});}function startTranscribe(_0xe1c2a6,_0x11e9a5,_0x404a2f,_0x86d311,_0x4aea39,_0x40c3bf){return new Promise(function(_0x247a6f,_0x19c454){var _0x1cd2e8=new AWS['TranscribeService']({'accessKeyId':_0x11e9a5,'secretAccessKey':_0xe1c2a6,'region':_0x404a2f});_0x1cd2e8[_0x34e1('0x6c')]({'TranscriptionJobName':_0x86d311,'LanguageCode':_0x4aea39,'Media':{'MediaFileUri':_0x40c3bf}},function(_0xf0437c,_0x5b51c5){if(_0xf0437c){return _0x19c454(_0xf0437c);}else{return _0x247a6f(_0x5b51c5);}});});}function transcribe(_0x17927,_0x25fd18,_0x28fdc3,_0x3c8ea0,_0x2adf54,_0x45ad29,_0x427624){return new Promise(function(_0x37eed6,_0x1cec7c){var _0x1bf547={};logger['info'](util[_0x34e1('0x2d')](_0x34e1('0x6d'),_0x17927,_0x2adf54));return uploadFile(_0x25fd18,_0x28fdc3,_0x3c8ea0,_0x2adf54,path[_0x34e1('0x6e')](_0x45ad29),fs[_0x34e1('0x6f')](_0x45ad29))['then'](function(_0x1f6952){logger[_0x34e1('0x63')](util[_0x34e1('0x2d')](_0x34e1('0x70'),_0x17927,_0x2adf54,_0x1f6952[_0x34e1('0x71')]));_0x1bf547[_0x34e1('0x72')]=_0x1f6952[_0x34e1('0x73')];_0x1bf547[_0x34e1('0x74')]=_0x1f6952[_0x34e1('0x71')];logger[_0x34e1('0x63')](util[_0x34e1('0x2d')](_0x34e1('0x75'),_0x17927));return startTranscribe(_0x25fd18,_0x28fdc3,_0x3c8ea0,uuidv4(),_0x427624,_0x1f6952[_0x34e1('0x71')]);})[_0x34e1('0x21')](function(_0x4e22be){logger[_0x34e1('0x63')](util[_0x34e1('0x2d')](_0x34e1('0x76'),_0x17927,_0x4e22be[_0x34e1('0x77')][_0x34e1('0x78')]));_0x1bf547[_0x34e1('0x79')]=_0x4e22be[_0x34e1('0x77')]['TranscriptionJobName'];_0x1bf547[_0x34e1('0x7a')]=_0x4e22be[_0x34e1('0x77')][_0x34e1('0x7b')];return _0x37eed6(_0x1bf547);})['catch'](function(_0x36b47d){return _0x1cec7c(_0x36b47d);});});}exports[_0x34e1('0x7c')]=function(_0x364201,_0x3049d7,_0x1a1ef0){var _0xc9acd8;var _0x236c34;var _0x1ceec5;var _0x42f99d=require(_0x34e1('0x4b'));return db[_0x34e1('0x44')][_0x34e1('0x7d')]({'where':{'id':_0x364201['params']['id']}})[_0x34e1('0x21')](function(_0x19bc81){if(_0x19bc81){var _0x23a2b0=util['format'](_0x34e1('0x4e'),_0x19bc81['value']);if(fs[_0x34e1('0x4f')](_0x23a2b0)){cypher=!![];return _0x42f99d[_0x34e1('0x50')](_0x23a2b0,_0x19bc81[_0x34e1('0x4d')],config['secrets'][_0x34e1('0x52')])[_0x34e1('0x21')](function(){return _0x19bc81;});}return _0x19bc81;}})[_0x34e1('0x21')](function(_0xb4a3cd){if(!_0xb4a3cd){throw new db[(_0x34e1('0x53'))][(_0x34e1('0x54'))]('Voice\x20Recording\x20not\x20found');}_0x236c34=_0xb4a3cd;return db[_0x34e1('0x7e')][_0x34e1('0x7d')]({'where':{'id':0x1}});})[_0x34e1('0x21')](handleEntityNotFound(_0x3049d7,null))[_0x34e1('0x21')](function(_0x457875){if(_0x457875){_0xc9acd8=_0x457875;if(!_0xc9acd8[_0x34e1('0x7f')]||!_0xc9acd8[_0x34e1('0x80')]||!_0xc9acd8[_0x34e1('0x81')]||!_0xc9acd8[_0x34e1('0x82')]||!_0xc9acd8[_0x34e1('0x72')]){throw new db[(_0x34e1('0x53'))][(_0x34e1('0x54'))](_0x34e1('0x83'));}if(_0x364201[_0x34e1('0x48')][_0x34e1('0x84')]&&(!_0xc9acd8['sentiment']||!_0xc9acd8[_0x34e1('0x85')]||!_0xc9acd8['sentimentRegion']||!_0xc9acd8[_0x34e1('0x82')]||!_0xc9acd8[_0x34e1('0x72')])){throw new db['Sequelize'][(_0x34e1('0x54'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x34e1('0x7d')]({'where':{'id':_0xc9acd8[_0x34e1('0x80')]}});}})[_0x34e1('0x21')](function(_0x3d99b4){if(!_0x3d99b4){throw new db[(_0x34e1('0x53'))]['ValidationError'](_0x34e1('0x86'));}if(!_0x3d99b4[_0x34e1('0x87')]||!_0x3d99b4[_0x34e1('0x88')]){throw new db[(_0x34e1('0x53'))]['ValidationError'](_0x34e1('0x89'));}_0x1ceec5=_0x3d99b4;return getBucketslist(_0x1ceec5['data1'],_0x1ceec5[_0x34e1('0x88')],_0xc9acd8['transcribeRegion']);})['then'](function(_0x296c40){if(_0x296c40&&_0x296c40[_0x34e1('0x8a')]){var _0x1a378c=_['find'](_0x296c40[_0x34e1('0x8a')],function(_0x2d2cdf){return _0x2d2cdf[_0x34e1('0x8b')]===_0xc9acd8['bucket'];});if(!_0x1a378c){logger[_0x34e1('0x63')](util[_0x34e1('0x2d')](_0x34e1('0x8c'),_0x364201[_0x34e1('0x43')]['id'],_0xc9acd8[_0x34e1('0x72')]));return createBucket(_0x1ceec5[_0x34e1('0x87')],_0x1ceec5[_0x34e1('0x88')],_0xc9acd8[_0x34e1('0x81')],_0xc9acd8[_0x34e1('0x72')]);}logger[_0x34e1('0x63')](util[_0x34e1('0x2d')](_0x34e1('0x8d'),_0x364201[_0x34e1('0x43')]['id'],_0xc9acd8[_0x34e1('0x72')]));return;}})[_0x34e1('0x21')](function(_0xbf263a){if(_0x236c34[_0x34e1('0x7a')]===_0x34e1('0x8e')){return transcribe(_0x364201[_0x34e1('0x43')]['id'],_0x1ceec5['data1'],_0x1ceec5['data2'],_0xc9acd8[_0x34e1('0x81')],_0xc9acd8[_0x34e1('0x72')],_0x236c34[_0x34e1('0x4d')],_0xc9acd8['language']);}else{logger['info'](util[_0x34e1('0x2d')](_0x34e1('0x8f'),_0x364201[_0x34e1('0x43')]['id']));return{'transcribeStatus':_0x34e1('0x90')};}})['then'](function(_0x113bfb){if(_0x113bfb){_0x113bfb['tempSentiment']=_0x364201[_0x34e1('0x48')][_0x34e1('0x84')];return _0x236c34[_0x34e1('0x91')](_0x113bfb);}})[_0x34e1('0x21')](respondWithResult(_0x3049d7,null))[_0x34e1('0x41')](handleError(_0x3049d7,null));};function writeFile(_0x5b6928,_0x578314){return new Promise(function(_0x3cebab,_0x50dd9b){fs[_0x34e1('0x92')](_0x578314,_0x5b6928,function(_0x566f60,_0x29ae1b){if(_0x566f60){return _0x50dd9b(_0x566f60);}else{return _0x3cebab(_0x29ae1b);}});});}exports['downloadTranscribe']=function(_0x4233b0,_0x6a9829,_0x399f86){return db[_0x34e1('0x44')]['findOne']({'where':{'id':_0x4233b0['params']['id']}})[_0x34e1('0x21')](handleEntityNotFound(_0x6a9829))[_0x34e1('0x21')](function(_0x4ef043){if(_0x4ef043&&_0x4ef043['fileText']){var _0x4e5a8b=_0x4ef043[_0x34e1('0x93')];var _0x2c9e2f=config[_0x34e1('0x94')]+'/server/files/transcribes/transcribe_'+_0x4ef043['id']+_0x34e1('0x95');if(fs[_0x34e1('0x4f')](_0x2c9e2f)){return _0x2c9e2f;}return writeFile(_0x4e5a8b,_0x2c9e2f)[_0x34e1('0x21')](function(){return _0x2c9e2f;});}else{throw new db[(_0x34e1('0x53'))][(_0x34e1('0x54'))]('Transcript\x20not\x20available');}})[_0x34e1('0x21')](function(_0x1ca1aa){return _0x6a9829[_0x34e1('0x4a')](_0x1ca1aa);})[_0x34e1('0x41')](handleError(_0x6a9829));}; \ No newline at end of file +var _0x9067=['Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','stack','name','send','map','VoiceRecording','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','secrets','recording','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','push','$and','decryptFile','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','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)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','ValidationError','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets'];(function(_0x4c13b2,_0x371123){var _0x550449=function(_0x343f30){while(--_0x343f30){_0x4c13b2['push'](_0x4c13b2['shift']());}};_0x550449(++_0x371123);}(_0x9067,0x149));var _0x7906=function(_0x68b785,_0x1fdbd3){_0x68b785=_0x68b785-0x0;var _0x11ebd9=_0x9067[_0x68b785];return _0x11ebd9;};'use strict';var pdf=require(_0x7906('0x0'));var emlformat=require(_0x7906('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7906('0x2'));var jsonpatch=require(_0x7906('0x3'));var rp=require(_0x7906('0x4'));var moment=require(_0x7906('0x5'));var BPromise=require(_0x7906('0x6'));var Mustache=require(_0x7906('0x7'));var util=require(_0x7906('0x8'));var path=require(_0x7906('0x9'));var sox=require('sox');var csv=require(_0x7906('0xa'));var ejs=require(_0x7906('0xb'));var fs=require('fs');var _=require(_0x7906('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7906('0xd'));var toCsv=require(_0x7906('0xa'));var querystring=require(_0x7906('0xe'));var Papa=require(_0x7906('0xf'));var AWS=require(_0x7906('0x10'));var uuidv4=require(_0x7906('0x11'));var Redis=require('ioredis');var authService=require(_0x7906('0x12'));var qs=require(_0x7906('0x13'));var as=require(_0x7906('0x14'));var hardwareService=require(_0x7906('0x15'));var logger=require(_0x7906('0x16'))('api');var utils=require(_0x7906('0x17'));var config=require(_0x7906('0x18'));var licenseUtil=require(_0x7906('0x19'));var db=require(_0x7906('0x1a'))['db'];function respondWithStatusCode(_0x5960e7,_0x49bf75){_0x49bf75=_0x49bf75||0xcc;return function(_0xb018){if(_0xb018){return _0x5960e7[_0x7906('0x1b')](_0x49bf75);}return _0x5960e7[_0x7906('0x1c')](_0x49bf75)[_0x7906('0x1d')]();};}function respondWithResult(_0x1f624f,_0x230a1d){_0x230a1d=_0x230a1d||0xc8;return function(_0x11141c){if(_0x11141c){return _0x1f624f[_0x7906('0x1c')](_0x230a1d)[_0x7906('0x1e')](_0x11141c);}};}function respondWithFilteredResult(_0x5e9067,_0x1163d9){return function(_0x27cd84){if(_0x27cd84){var _0x17335e=_0x27cd84[_0x7906('0x1f')],_0x2688f5=_0x1163d9[_0x7906('0x20')],_0x4740fd=_0x1163d9[_0x7906('0x20')]+_0x1163d9[_0x7906('0x21')],_0x35c27d;if(_0x4740fd>=_0x17335e){_0x4740fd=_0x17335e;_0x35c27d=0xc8;}else{_0x35c27d=0xce;}_0x5e9067[_0x7906('0x1c')](_0x35c27d);return _0x5e9067[_0x7906('0x22')]('Content-Range',_0x2688f5+'-'+_0x4740fd+'/'+_0x17335e)[_0x7906('0x1e')](_0x27cd84);}return null;};}function patchUpdates(_0x2bb94e){return function(_0x2acc6f){try{jsonpatch[_0x7906('0x23')](_0x2acc6f,_0x2bb94e,!![]);}catch(_0x4c4d5c){return BPromise[_0x7906('0x24')](_0x4c4d5c);}return _0x2acc6f[_0x7906('0x25')]();};}function saveUpdates(_0x2a9fc0,_0x4bcfb5){return function(_0x19839b){if(_0x19839b){return _0x19839b['update'](_0x2a9fc0)[_0x7906('0x26')](function(_0x4c3820){return _0x4c3820;});}return null;};}function removeEntity(_0xb1ecfa,_0x38c570){return function(_0x5948b1){if(_0x5948b1){return _0x5948b1[_0x7906('0x27')]()['then'](function(){_0xb1ecfa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x191a42,_0x560a94){return function(_0x4c07b4){if(!_0x4c07b4){_0x191a42[_0x7906('0x1b')](0x194);}return _0x4c07b4;};}function handleError(_0x2e9914,_0x5616d1){_0x5616d1=_0x5616d1||0x1f4;return function(_0x454131){logger['error'](_0x454131[_0x7906('0x28')]);if(_0x454131[_0x7906('0x29')]){delete _0x454131[_0x7906('0x29')];}_0x2e9914['status'](_0x5616d1)[_0x7906('0x2a')](_0x454131);};}exports['index']=function(_0x4383e6,_0x46d153){var _0x178a76={},_0x131529={},_0x8da452={'count':0x0,'rows':[]};var _0x3ec6f9=_[_0x7906('0x2b')](db[_0x7906('0x2c')]['rawAttributes'],function(_0x3ddde9){return{'name':_0x3ddde9[_0x7906('0x2d')],'type':_0x3ddde9[_0x7906('0x2e')][_0x7906('0x2f')]};});_0x131529['model']=_[_0x7906('0x30')](_[_0x7906('0x2b')](_0x3ec6f9,_0x7906('0x29')),['format']);_0x131529[_0x7906('0x31')]=_[_0x7906('0x32')](_0x4383e6[_0x7906('0x31')]);_0x131529[_0x7906('0x33')]=_[_0x7906('0x34')](_0x131529[_0x7906('0x35')],_0x131529[_0x7906('0x31')]);_0x178a76['attributes']=_[_0x7906('0x34')](_0x131529[_0x7906('0x35')],qs[_0x7906('0x36')](_0x4383e6[_0x7906('0x31')][_0x7906('0x36')]));_0x178a76['attributes']=_0x178a76['attributes'][_0x7906('0x37')]?_0x178a76[_0x7906('0x38')]:_0x131529[_0x7906('0x35')];if(!_0x4383e6['query'][_0x7906('0x39')](_0x7906('0x3a'))){_0x178a76[_0x7906('0x21')]=qs[_0x7906('0x21')](_0x4383e6['query'][_0x7906('0x21')]);_0x178a76[_0x7906('0x20')]=qs[_0x7906('0x20')](_0x4383e6[_0x7906('0x31')][_0x7906('0x20')]);}_0x178a76[_0x7906('0x3b')]=qs[_0x7906('0x3c')](_0x4383e6['query'][_0x7906('0x3c')]);_0x178a76['where']=qs[_0x7906('0x33')](_[_0x7906('0x3d')](_0x4383e6[_0x7906('0x31')],_0x131529[_0x7906('0x33')]),_0x3ec6f9);if(_0x4383e6['query'][_0x7906('0x3e')]){_0x178a76['where']=_[_0x7906('0x3f')](_0x178a76[_0x7906('0x40')],{'$or':_['map'](_0x3ec6f9,function(_0x520fda){if(_0x520fda[_0x7906('0x2e')]!==_0x7906('0x41')){var _0x3354b3={};_0x3354b3[_0x520fda[_0x7906('0x29')]]={'$like':'%'+_0x4383e6[_0x7906('0x31')][_0x7906('0x3e')]+'%'};return _0x3354b3;}})});}_0x178a76=_['merge']({},_0x178a76,_0x4383e6[_0x7906('0x42')]);var _0x214016={'where':_0x178a76['where']};return db[_0x7906('0x2c')]['count'](_0x214016)[_0x7906('0x26')](function(_0x584273){_0x8da452['count']=_0x584273;if(_0x4383e6['query'][_0x7906('0x43')]){_0x178a76[_0x7906('0x44')]=[{'all':!![]}];}return db[_0x7906('0x2c')]['findAll'](_0x178a76);})[_0x7906('0x26')](function(_0x52d015){_0x8da452[_0x7906('0x45')]=_0x52d015;return _0x8da452;})[_0x7906('0x26')](respondWithFilteredResult(_0x46d153,_0x178a76))[_0x7906('0x46')](handleError(_0x46d153,null));};exports[_0x7906('0x47')]=function(_0x43c4c8,_0x2292d8){var _0x1d4145={'raw':![],'where':{'id':_0x43c4c8['params']['id']}},_0x5c3ecf={};_0x5c3ecf['model']=_['keys'](db['VoiceRecording'][_0x7906('0x48')]);_0x5c3ecf['query']=_[_0x7906('0x32')](_0x43c4c8[_0x7906('0x31')]);_0x5c3ecf['filters']=_['intersection'](_0x5c3ecf[_0x7906('0x35')],_0x5c3ecf[_0x7906('0x31')]);_0x1d4145[_0x7906('0x38')]=_[_0x7906('0x34')](_0x5c3ecf[_0x7906('0x35')],qs[_0x7906('0x36')](_0x43c4c8['query'][_0x7906('0x36')]));_0x1d4145[_0x7906('0x38')]=_0x1d4145[_0x7906('0x38')][_0x7906('0x37')]?_0x1d4145[_0x7906('0x38')]:_0x5c3ecf[_0x7906('0x35')];if(_0x43c4c8[_0x7906('0x31')]['includeAll']){_0x1d4145[_0x7906('0x44')]=[{'all':!![]}];}_0x1d4145=_[_0x7906('0x3f')]({},_0x1d4145,_0x43c4c8[_0x7906('0x42')]);return db[_0x7906('0x2c')][_0x7906('0x49')](_0x1d4145)[_0x7906('0x26')](handleEntityNotFound(_0x2292d8,null))[_0x7906('0x26')](respondWithResult(_0x2292d8,null))[_0x7906('0x46')](handleError(_0x2292d8,null));};exports[_0x7906('0x4a')]=function(_0x4b0554,_0x460a2f){return db[_0x7906('0x2c')][_0x7906('0x4a')](_0x4b0554['body'],{})[_0x7906('0x26')](respondWithResult(_0x460a2f,0xc9))[_0x7906('0x46')](handleError(_0x460a2f,null));};exports['update']=function(_0x61fc48,_0x3e1c87){if(_0x61fc48['body']['id']){delete _0x61fc48[_0x7906('0x4b')]['id'];}return db[_0x7906('0x2c')]['find']({'where':{'id':_0x61fc48[_0x7906('0x4c')]['id']}})[_0x7906('0x26')](handleEntityNotFound(_0x3e1c87,null))[_0x7906('0x26')](saveUpdates(_0x61fc48[_0x7906('0x4b')],null))[_0x7906('0x26')](respondWithResult(_0x3e1c87,null))[_0x7906('0x46')](handleError(_0x3e1c87,null));};exports[_0x7906('0x4d')]=function(_0x3ec92a,_0xcb1975){return db['VoiceRecording'][_0x7906('0x4d')]()[_0x7906('0x26')](respondWithResult(_0xcb1975,null))[_0x7906('0x46')](handleError(_0xcb1975,null));};exports['download']=function(_0x3aac90,_0x336839,_0x94b550){var _0x3b5c7a=require(_0x7906('0x4e'));var _0x45d78f=![];var _0x23c81d={};if(_0x3aac90[_0x7906('0x31')][_0x7906('0x2e')]&&_0x3aac90[_0x7906('0x31')][_0x7906('0x2e')]===_0x7906('0x4f')){_0x23c81d[_0x7906('0x4f')]=_0x3aac90[_0x7906('0x4c')]['id'];}else{_0x23c81d['id']=_0x3aac90[_0x7906('0x4c')]['id'];}return db[_0x7906('0x2c')][_0x7906('0x49')]({'where':_0x23c81d,'attributes':['id',_0x7906('0x50')],'raw':!![]})[_0x7906('0x26')](handleEntityNotFound(_0x336839,null))[_0x7906('0x26')](function(_0x362ef8){if(_0x362ef8){var _0x31b89b=_0x362ef8[_0x7906('0x50')];var _0x378be6=util[_0x7906('0x51')](_0x7906('0x52'),_0x31b89b);if(fs['existsSync'](_0x378be6)){_0x45d78f=!![];return _0x3b5c7a['decryptFile'](_0x378be6,_0x31b89b,config[_0x7906('0x53')][_0x7906('0x54')])['then'](function(){return _0x362ef8;});}return _0x362ef8;}})['then'](function(_0x299c66){if(_0x299c66){var _0x4f372b=_0x299c66[_0x7906('0x50')];if(!fs[_0x7906('0x55')](_0x4f372b)){throw new db[(_0x7906('0x56'))]['ValidationError'](_0x7906('0x57'));}if(_0x299c66[_0x7906('0x58')]){return _0x336839[_0x7906('0x59')](_0x4f372b,_0x299c66[_0x7906('0x58')]+path[_0x7906('0x5a')](_0x4f372b),function(){if(_0x45d78f){fs[_0x7906('0x5b')](_0x4f372b);}});}else{return _0x336839[_0x7906('0x59')](_0x4f372b,function(_0x1914a2){if(_0x45d78f){fs[_0x7906('0x5b')](_0x4f372b);}});}}})[_0x7906('0x46')](function(_0x22998c){if(_0x22998c[_0x7906('0x5c')]===_0x7906('0x57')){_0x336839[_0x7906('0x1c')](0x194)['send'](_0x7906('0x5d'));}else{return handleError(_0x336839,null);}});};exports['downloads']=function(_0xe5e19,_0xca126f,_0x37eb43){var _0x572c08=require('../../components/encryptor');var _0x22758e=![];var _0x2d3ba9={'$and':[db[_0x7906('0x5e')][_0x7906('0x40')](db[_0x7906('0x5e')]['fn'](_0x7906('0x5f'),db[_0x7906('0x5e')][_0x7906('0x60')](_0x7906('0x4f'))),_0xe5e19[_0x7906('0x31')][_0x7906('0x61')])]};if(_0xe5e19[_0x7906('0x31')][_0x7906('0x2e')]&&_0xe5e19[_0x7906('0x31')]['type']===_0x7906('0x4f')){_0x2d3ba9['$and'][_0x7906('0x62')]({'uniqueid':_0xe5e19['params']['id']});}else{_0x2d3ba9[_0x7906('0x63')][_0x7906('0x62')]({'id':_0xe5e19[_0x7906('0x4c')]['id']});}return db[_0x7906('0x2c')][_0x7906('0x49')]({'where':_0x2d3ba9,'attributes':['id',_0x7906('0x50')],'raw':!![]})[_0x7906('0x26')](handleEntityNotFound(_0xca126f,null))['then'](function(_0x460b34){if(_0x460b34){var _0x54c7d0=util['format'](_0x7906('0x52'),_0x460b34[_0x7906('0x50')]);if(fs[_0x7906('0x55')](_0x54c7d0)){_0x22758e=!![];return _0x572c08[_0x7906('0x64')](_0x54c7d0,_0x460b34[_0x7906('0x50')],config['secrets'][_0x7906('0x54')])[_0x7906('0x26')](function(){return _0x460b34;});}return _0x460b34;}})[_0x7906('0x26')](function(_0x44139e){if(_0x44139e){if(!fs[_0x7906('0x55')](_0x44139e['value'])){throw new db['Sequelize']['ValidationError'](_0x7906('0x57'));}if(_0x44139e[_0x7906('0x58')]){return _0xca126f[_0x7906('0x59')](_0x44139e[_0x7906('0x50')],_0x44139e[_0x7906('0x58')]+path['extname'](_0x44139e[_0x7906('0x50')]),function(){if(_0x22758e){fs['unlink'](_0x44139e[_0x7906('0x50')]);}});}else{return _0xca126f['download'](_0x44139e[_0x7906('0x50')],function(_0x2512a3){if(_0x22758e){fs[_0x7906('0x5b')](_0x44139e[_0x7906('0x50')]);}});}}})[_0x7906('0x46')](handleError(_0xca126f,null));};exports[_0x7906('0x27')]=function(_0x74e499,_0x1ef332){return db[_0x7906('0x2c')][_0x7906('0x49')]({'where':{'id':_0x74e499[_0x7906('0x4c')]['id']}})[_0x7906('0x26')](function(_0x4f4ba9){if(!_0x4f4ba9)throw new ReferenceError(_0x7906('0x65'));return _0x4f4ba9;})['then'](function(_0x43be11){var _0x1cf073=_0x43be11['value'];logger[_0x7906('0x66')](_0x7906('0x67'),_0x1cf073);if(!_[_0x7906('0x68')](_0x43be11[_0x7906('0x50')])&&fs[_0x7906('0x55')](_0x1cf073)){logger[_0x7906('0x66')]('File:\x20\x22'+_0x1cf073+_0x7906('0x69'));fs['unlinkSync'](_0x1cf073);}_0x1cf073=_0x1cf073+_0x7906('0x6a');if(!_[_0x7906('0x68')](_0x43be11[_0x7906('0x50')])&&fs[_0x7906('0x55')](_0x1cf073)){logger[_0x7906('0x66')]('File:\x20\x22'+_0x1cf073+_0x7906('0x69'));fs[_0x7906('0x6b')](_0x1cf073);}return _0x43be11;})[_0x7906('0x26')](function(_0x6bccf7){if(!_0x6bccf7)throw new InternalError();return _0x6bccf7[_0x7906('0x27')]();})[_0x7906('0x26')](function(){_0x1ef332[_0x7906('0x1c')](0xcc)[_0x7906('0x1d')]();})[_0x7906('0x46')](handleError(_0x1ef332,null));};function getBucketslist(_0x1016ca,_0x2172c7,_0x26e4ee){return new Promise(function(_0x3b07c8,_0x5ecad1){var _0x2480dc=new AWS['S3']({'accessKeyId':_0x2172c7,'secretAccessKey':_0x1016ca,'region':_0x26e4ee});_0x2480dc[_0x7906('0x6c')]({},function(_0x147911,_0x6979f7){if(_0x147911){return _0x5ecad1(_0x147911);}else{return _0x3b07c8(_0x6979f7);}});});}function createBucket(_0xace48c,_0x5e20f3,_0x26ff6,_0x1b7670){return new Promise(function(_0x277235,_0x2536f9){var _0x5026fb=new AWS['S3']({'accessKeyId':_0x5e20f3,'secretAccessKey':_0xace48c,'region':_0x26ff6});_0x5026fb[_0x7906('0x6d')]({'Bucket':_0x1b7670},function(_0xf43776,_0x52306a){if(_0xf43776){return _0x2536f9(_0xf43776);}else{return _0x277235(_0x52306a);}});});}function uploadFile(_0x3a7715,_0x5c4e98,_0x1fff94,_0x3e0ea0,_0x45181f,_0x1fef19){return new Promise(function(_0x1cc1dd,_0x421805){var _0x2d0ce3=new AWS['S3']({'accessKeyId':_0x5c4e98,'secretAccessKey':_0x3a7715,'region':_0x1fff94});_0x2d0ce3[_0x7906('0x6e')]({'Bucket':_0x3e0ea0,'Key':_0x45181f,'Body':_0x1fef19},function(_0x1e85c4,_0x4efa84){if(_0x1e85c4){return _0x421805(_0x1e85c4);}else{return _0x1cc1dd(_0x4efa84);}});});}function startTranscribe(_0x4d8688,_0x3a6127,_0x273605,_0x112d96,_0xc4cd1f,_0x391f95){return new Promise(function(_0x3e7bf5,_0x4d8b84){var _0x1c47c7=new AWS[(_0x7906('0x6f'))]({'accessKeyId':_0x3a6127,'secretAccessKey':_0x4d8688,'region':_0x273605});_0x1c47c7['startTranscriptionJob']({'TranscriptionJobName':_0x112d96,'LanguageCode':_0xc4cd1f,'Media':{'MediaFileUri':_0x391f95}},function(_0x502cb8,_0x84666d){if(_0x502cb8){return _0x4d8b84(_0x502cb8);}else{return _0x3e7bf5(_0x84666d);}});});}function transcribe(_0x1c3d3b,_0x7bb7ae,_0x4df01b,_0x1d1d24,_0x5c03fd,_0x3e6e45,_0x59791a){return new Promise(function(_0x13d1bb,_0x2b2090){var _0x47cb5b={};logger['info'](util[_0x7906('0x51')](_0x7906('0x70'),_0x1c3d3b,_0x5c03fd));return uploadFile(_0x7bb7ae,_0x4df01b,_0x1d1d24,_0x5c03fd,path[_0x7906('0x71')](_0x3e6e45),fs[_0x7906('0x72')](_0x3e6e45))[_0x7906('0x26')](function(_0x1a78b6){logger[_0x7906('0x66')](util[_0x7906('0x51')](_0x7906('0x73'),_0x1c3d3b,_0x5c03fd,_0x1a78b6[_0x7906('0x74')]));_0x47cb5b[_0x7906('0x75')]=_0x1a78b6[_0x7906('0x76')];_0x47cb5b['location']=_0x1a78b6[_0x7906('0x74')];logger['info'](util['format'](_0x7906('0x77'),_0x1c3d3b));return startTranscribe(_0x7bb7ae,_0x4df01b,_0x1d1d24,uuidv4(),_0x59791a,_0x1a78b6[_0x7906('0x74')]);})[_0x7906('0x26')](function(_0x56edd1){logger[_0x7906('0x66')](util['format'](_0x7906('0x78'),_0x1c3d3b,_0x56edd1[_0x7906('0x79')][_0x7906('0x7a')]));_0x47cb5b[_0x7906('0x7b')]=_0x56edd1[_0x7906('0x79')][_0x7906('0x7a')];_0x47cb5b[_0x7906('0x7c')]=_0x56edd1['TranscriptionJob'][_0x7906('0x7d')];return _0x13d1bb(_0x47cb5b);})['catch'](function(_0xbd07ec){return _0x2b2090(_0xbd07ec);});});}exports[_0x7906('0x7e')]=function(_0x56929f,_0x12cfbf,_0x17ad70){var _0x408d95;var _0x4c2635;var _0x4c9a02;var _0x3735f2=require(_0x7906('0x4e'));return db[_0x7906('0x2c')][_0x7906('0x7f')]({'where':{'id':_0x56929f['params']['id']}})['then'](function(_0x57da1c){if(_0x57da1c){var _0x541531=util[_0x7906('0x51')]('%s.cypher',_0x57da1c[_0x7906('0x50')]);if(fs[_0x7906('0x55')](_0x541531)){cypher=!![];return _0x3735f2[_0x7906('0x64')](_0x541531,_0x57da1c[_0x7906('0x50')],config['secrets']['recording'])[_0x7906('0x26')](function(){return _0x57da1c;});}return _0x57da1c;}})[_0x7906('0x26')](function(_0x976504){if(!_0x976504){throw new db['Sequelize'][(_0x7906('0x80'))](_0x7906('0x81'));}_0x4c2635=_0x976504;return db[_0x7906('0x82')][_0x7906('0x7f')]({'where':{'id':0x1}});})[_0x7906('0x26')](handleEntityNotFound(_0x12cfbf,null))[_0x7906('0x26')](function(_0x4f6583){if(_0x4f6583){_0x408d95=_0x4f6583;if(!_0x408d95[_0x7906('0x83')]||!_0x408d95[_0x7906('0x84')]||!_0x408d95[_0x7906('0x85')]||!_0x408d95[_0x7906('0x86')]||!_0x408d95[_0x7906('0x75')]){throw new db[(_0x7906('0x56'))][(_0x7906('0x80'))]('Transcribe\x20not\x20configured');}if(_0x56929f[_0x7906('0x4b')][_0x7906('0x87')]&&(!_0x408d95['sentiment']||!_0x408d95[_0x7906('0x88')]||!_0x408d95[_0x7906('0x89')]||!_0x408d95['language']||!_0x408d95[_0x7906('0x75')])){throw new db['Sequelize']['ValidationError'](_0x7906('0x8a'));}return db[_0x7906('0x8b')][_0x7906('0x7f')]({'where':{'id':_0x408d95[_0x7906('0x84')]}});}})[_0x7906('0x26')](function(_0xe12186){if(!_0xe12186){throw new db[(_0x7906('0x56'))][(_0x7906('0x80'))](_0x7906('0x8c'));}if(!_0xe12186[_0x7906('0x8d')]||!_0xe12186[_0x7906('0x8e')]){throw new db[(_0x7906('0x56'))][(_0x7906('0x80'))](_0x7906('0x8f'));}_0x4c9a02=_0xe12186;return getBucketslist(_0x4c9a02[_0x7906('0x8d')],_0x4c9a02[_0x7906('0x8e')],_0x408d95[_0x7906('0x85')]);})[_0x7906('0x26')](function(_0x57ad04){if(_0x57ad04&&_0x57ad04[_0x7906('0x90')]){var _0xd01e1=_[_0x7906('0x49')](_0x57ad04[_0x7906('0x90')],function(_0xb2421f){return _0xb2421f[_0x7906('0x91')]===_0x408d95[_0x7906('0x75')];});if(!_0xd01e1){logger[_0x7906('0x66')](util[_0x7906('0x51')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x56929f[_0x7906('0x4c')]['id'],_0x408d95[_0x7906('0x75')]));return createBucket(_0x4c9a02[_0x7906('0x8d')],_0x4c9a02[_0x7906('0x8e')],_0x408d95[_0x7906('0x85')],_0x408d95['bucket']);}logger[_0x7906('0x66')](util['format'](_0x7906('0x92'),_0x56929f[_0x7906('0x4c')]['id'],_0x408d95[_0x7906('0x75')]));return;}})['then'](function(_0x2b1804){if(_0x4c2635[_0x7906('0x7c')]===_0x7906('0x93')){return transcribe(_0x56929f[_0x7906('0x4c')]['id'],_0x4c9a02[_0x7906('0x8d')],_0x4c9a02['data2'],_0x408d95['transcribeRegion'],_0x408d95[_0x7906('0x75')],_0x4c2635[_0x7906('0x50')],_0x408d95[_0x7906('0x86')]);}else{logger[_0x7906('0x66')](util[_0x7906('0x51')](_0x7906('0x94'),_0x56929f[_0x7906('0x4c')]['id']));return{'transcribeStatus':_0x7906('0x95')};}})[_0x7906('0x26')](function(_0x46869e){if(_0x46869e){_0x46869e[_0x7906('0x96')]=_0x56929f['body']['runSentiment'];return _0x4c2635[_0x7906('0x97')](_0x46869e);}})['then'](respondWithResult(_0x12cfbf,null))['catch'](handleError(_0x12cfbf,null));};function writeFile(_0x2d2307,_0x59cf42){return new Promise(function(_0x475910,_0x49683a){fs[_0x7906('0x98')](_0x59cf42,_0x2d2307,function(_0x25d318,_0x144826){if(_0x25d318){return _0x49683a(_0x25d318);}else{return _0x475910(_0x144826);}});});}exports[_0x7906('0x99')]=function(_0x16be28,_0x7ab2e9,_0x271565){return db[_0x7906('0x2c')][_0x7906('0x7f')]({'where':{'id':_0x16be28['params']['id']}})[_0x7906('0x26')](handleEntityNotFound(_0x7ab2e9))[_0x7906('0x26')](function(_0x5e84c4){if(_0x5e84c4&&_0x5e84c4['fileText']){var _0x1bbcc6=_0x5e84c4[_0x7906('0x9a')];var _0x2112b9=config[_0x7906('0x9b')]+'/server/files/transcribes/transcribe_'+_0x5e84c4['id']+_0x7906('0x9c');if(fs[_0x7906('0x55')](_0x2112b9)){return _0x2112b9;}return writeFile(_0x1bbcc6,_0x2112b9)[_0x7906('0x26')](function(){return _0x2112b9;});}else{throw new db[(_0x7906('0x56'))][(_0x7906('0x80'))](_0x7906('0x9d'));}})[_0x7906('0x26')](function(_0x576d0e){return _0x7ab2e9[_0x7906('0x59')](_0x576d0e);})[_0x7906('0x46')](handleError(_0x7ab2e9));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ba492a2..150c297 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 _0x04e6=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','define','VoiceRecording'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x04e6,0x83));var _0x604e=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x04e6[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0x604e('0x0'));var util=require(_0x604e('0x1'));var logger=require(_0x604e('0x2'))(_0x604e('0x3'));var moment=require('moment');var BPromise=require(_0x604e('0x4'));var rp=require(_0x604e('0x5'));var fs=require('fs');var path=require(_0x604e('0x6'));var rimraf=require(_0x604e('0x7'));var config=require(_0x604e('0x8'));var attributes=require(_0x604e('0x9'));module['exports']=function(_0x157db7,_0x14f359){return _0x157db7[_0x604e('0xa')](_0x604e('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x604e('0xc'),'fields':[_0x604e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe447=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe447,0x189));var _0x7e44=function(_0x34533,_0x531aeb){_0x34533=_0x34533-0x0;var _0x5810ff=_0xe447[_0x34533];return _0x5810ff;};'use strict';var _=require(_0x7e44('0x0'));var util=require(_0x7e44('0x1'));var logger=require(_0x7e44('0x2'))(_0x7e44('0x3'));var moment=require('moment');var BPromise=require(_0x7e44('0x4'));var rp=require(_0x7e44('0x5'));var fs=require('fs');var path=require(_0x7e44('0x6'));var rimraf=require(_0x7e44('0x7'));var config=require(_0x7e44('0x8'));var attributes=require(_0x7e44('0x9'));module[_0x7e44('0xa')]=function(_0x4c40b3,_0x5d115b){return _0x4c40b3[_0x7e44('0xb')](_0x7e44('0xc'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x7e44('0xd'),'fields':[_0x7e44('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d90bf04..882085b 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(_0x164467,_0x5df59a){var _0x56529f=function(_0x4ced8f){while(--_0x4ced8f){_0x164467['push'](_0x164467['shift']());}};_0x56529f(++_0x5df59a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['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(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 762d172..8f4898b 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 _0xd1f4=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xd1f4,0x1b1));var _0x4d1f=function(_0x239486,_0x1cf56e){_0x239486=_0x239486-0x0;var _0x1b5391=_0xd1f4[_0x239486];return _0x1b5391;};'use strict';var multer=require(_0x4d1f('0x0'));var util=require(_0x4d1f('0x1'));var path=require(_0x4d1f('0x2'));var timeout=require(_0x4d1f('0x3'));var express=require(_0x4d1f('0x4'));var router=express[_0x4d1f('0x5')]();var auth=require(_0x4d1f('0x6'));var interaction=require(_0x4d1f('0x7'));var config=require(_0x4d1f('0x8'));var controller=require('./voiceTransferReport.controller');router[_0x4d1f('0x9')]('/',auth[_0x4d1f('0xa')](),controller['index']);router['get'](_0x4d1f('0xb'),auth['isAuthenticated'](),controller[_0x4d1f('0xc')]);router[_0x4d1f('0x9')](_0x4d1f('0xd'),auth[_0x4d1f('0xa')](),controller[_0x4d1f('0xe')]);router['post']('/',auth[_0x4d1f('0xa')](),controller[_0x4d1f('0xf')]);router[_0x4d1f('0x10')]('/:id',auth[_0x4d1f('0xa')](),controller[_0x4d1f('0x11')]);router[_0x4d1f('0x12')](_0x4d1f('0xd'),auth['isAuthenticated'](),controller[_0x4d1f('0x13')]);module[_0x4d1f('0x14')]=router; \ No newline at end of file +var _0x8eca=['put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x3fbd1,_0x55e05a){var _0x192053=function(_0x2cefe3){while(--_0x2cefe3){_0x3fbd1['push'](_0x3fbd1['shift']());}};_0x192053(++_0x55e05a);}(_0x8eca,0x193));var _0xa8ec=function(_0x12bd1e,_0x17a330){_0x12bd1e=_0x12bd1e-0x0;var _0x5caaeb=_0x8eca[_0x12bd1e];return _0x5caaeb;};'use strict';var multer=require(_0xa8ec('0x0'));var util=require(_0xa8ec('0x1'));var path=require(_0xa8ec('0x2'));var timeout=require('connect-timeout');var express=require(_0xa8ec('0x3'));var router=express[_0xa8ec('0x4')]();var auth=require(_0xa8ec('0x5'));var interaction=require(_0xa8ec('0x6'));var config=require(_0xa8ec('0x7'));var controller=require(_0xa8ec('0x8'));router[_0xa8ec('0x9')]('/',auth[_0xa8ec('0xa')](),controller['index']);router[_0xa8ec('0x9')](_0xa8ec('0xb'),auth[_0xa8ec('0xa')](),controller[_0xa8ec('0xc')]);router[_0xa8ec('0x9')](_0xa8ec('0xd'),auth[_0xa8ec('0xa')](),controller[_0xa8ec('0xe')]);router[_0xa8ec('0xf')]('/',auth[_0xa8ec('0xa')](),controller[_0xa8ec('0x10')]);router[_0xa8ec('0x11')](_0xa8ec('0xd'),auth[_0xa8ec('0xa')](),controller['update']);router[_0xa8ec('0x12')](_0xa8ec('0xd'),auth['isAuthenticated'](),controller[_0xa8ec('0x13')]);module[_0xa8ec('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index fb2a427..392a854 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 _0xd151=['STRING','sequelize','moment','exports','ENUM','blind','attended'];(function(_0x2920d7,_0x2028a2){var _0xfdce5f=function(_0x1778b0){while(--_0x1778b0){_0x2920d7['push'](_0x2920d7['shift']());}};_0xfdce5f(++_0x2028a2);}(_0xd151,0xef));var _0x1d15=function(_0x5af1ce,_0x318f6e){_0x5af1ce=_0x5af1ce-0x0;var _0x4e7f4f=_0xd151[_0x5af1ce];return _0x4e7f4f;};'use strict';var Sequelize=require(_0x1d15('0x0'));var moment=require(_0x1d15('0x1'));module[_0x1d15('0x2')]={'type':{'type':Sequelize[_0x1d15('0x3')](_0x1d15('0x4'),_0x1d15('0x5'))},'result':{'type':Sequelize[_0x1d15('0x6')]},'transfererchannel':{'type':Sequelize[_0x1d15('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x1d15('0x6')]},'transferercalleridname':{'type':Sequelize[_0x1d15('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1d15('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x1d15('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x1d15('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x1d15('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x1d15('0x6')]},'transfereechannel':{'type':Sequelize[_0x1d15('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x1d15('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x1d15('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x1d15('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x1d15('0x3')]('Yes','No')},'context':{'type':Sequelize[_0x1d15('0x6')]},'extension':{'type':Sequelize[_0x1d15('0x6')]}}; \ No newline at end of file +var _0xdb59=['sequelize','exports','ENUM','attended','STRING','Yes'];(function(_0x47f41a,_0x34eb17){var _0x8487b7=function(_0xcaf108){while(--_0xcaf108){_0x47f41a['push'](_0x47f41a['shift']());}};_0x8487b7(++_0x34eb17);}(_0xdb59,0x7e));var _0x9db5=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0xdb59[_0xe30e17];return _0x2342c9;};'use strict';var Sequelize=require(_0x9db5('0x0'));var moment=require('moment');module[_0x9db5('0x1')]={'type':{'type':Sequelize[_0x9db5('0x2')]('blind',_0x9db5('0x3'))},'result':{'type':Sequelize[_0x9db5('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x9db5('0x4')]},'transferercalleridname':{'type':Sequelize[_0x9db5('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x9db5('0x4')]},'transfererexten':{'type':Sequelize[_0x9db5('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x9db5('0x4')]},'transfereechannel':{'type':Sequelize[_0x9db5('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x9db5('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x9db5('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x9db5('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x9db5('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x9db5('0x4')]},'transfereecontext':{'type':Sequelize[_0x9db5('0x4')]},'transfereeexten':{'type':Sequelize[_0x9db5('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x9db5('0x4')]},'isexternal':{'type':Sequelize[_0x9db5('0x2')](_0x9db5('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9db5('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ed9bad2..55ee470 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 _0x8825=['catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x2ddfa6,_0x3a39bf){var _0x2a1268=function(_0x20a037){while(--_0x20a037){_0x2ddfa6['push'](_0x2ddfa6['shift']());}};_0x2a1268(++_0x3a39bf);}(_0x8825,0x9e));var _0x5882=function(_0x10a60b,_0xacfb13){_0x10a60b=_0x10a60b-0x0;var _0x503e3c=_0x8825[_0x10a60b];return _0x503e3c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5882('0x0'));var rimraf=require(_0x5882('0x1'));var zipdir=require(_0x5882('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5882('0x3'));var moment=require(_0x5882('0x4'));var BPromise=require(_0x5882('0x5'));var Mustache=require(_0x5882('0x6'));var util=require(_0x5882('0x7'));var path=require(_0x5882('0x8'));var sox=require(_0x5882('0x9'));var csv=require(_0x5882('0xa'));var ejs=require(_0x5882('0xb'));var fs=require('fs');var _=require(_0x5882('0xc'));var squel=require(_0x5882('0xd'));var crypto=require(_0x5882('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5882('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5882('0x10'));var Papa=require(_0x5882('0x11'));var Redis=require(_0x5882('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5882('0x13'));var as=require(_0x5882('0x14'));var hardwareService=require(_0x5882('0x15'));var logger=require('../../config/logger')(_0x5882('0x16'));var utils=require('../../config/utils');var config=require(_0x5882('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x140211,_0x33a8d5){_0x33a8d5=_0x33a8d5||0xcc;return function(_0x237f49){if(_0x237f49){return _0x140211[_0x5882('0x18')](_0x33a8d5);}return _0x140211['status'](_0x33a8d5)[_0x5882('0x19')]();};}function respondWithResult(_0x35516d,_0x46851f){_0x46851f=_0x46851f||0xc8;return function(_0x2a9d76){if(_0x2a9d76){return _0x35516d[_0x5882('0x1a')](_0x46851f)[_0x5882('0x1b')](_0x2a9d76);}};}function respondWithFilteredResult(_0x5a9d4b,_0x3981cf){return function(_0x25d1d2){if(_0x25d1d2){var _0x5854a=_0x25d1d2[_0x5882('0x1c')],_0x32826d=_0x3981cf['offset'],_0x487fcf=_0x3981cf[_0x5882('0x1d')]+_0x3981cf[_0x5882('0x1e')],_0x255be3;if(_0x487fcf>=_0x5854a){_0x487fcf=_0x5854a;_0x255be3=0xc8;}else{_0x255be3=0xce;}_0x5a9d4b[_0x5882('0x1a')](_0x255be3);return _0x5a9d4b[_0x5882('0x1f')](_0x5882('0x20'),_0x32826d+'-'+_0x487fcf+'/'+_0x5854a)[_0x5882('0x1b')](_0x25d1d2);}return null;};}function patchUpdates(_0x5201f5){return function(_0x2c4daf){try{jsonpatch[_0x5882('0x21')](_0x2c4daf,_0x5201f5,!![]);}catch(_0x7d40eb){return BPromise[_0x5882('0x22')](_0x7d40eb);}return _0x2c4daf[_0x5882('0x23')]();};}function saveUpdates(_0x282809,_0x1fa32a){return function(_0x128f75){if(_0x128f75){return _0x128f75['update'](_0x282809)[_0x5882('0x24')](function(_0xa8ac24){return _0xa8ac24;});}return null;};}function removeEntity(_0x25c0b5,_0x24d504){return function(_0x5283c9){if(_0x5283c9){return _0x5283c9[_0x5882('0x25')]()[_0x5882('0x24')](function(){_0x25c0b5['status'](0xcc)[_0x5882('0x19')]();});}};}function handleEntityNotFound(_0x96088c,_0x2e1b79){return function(_0xb9cbaa){if(!_0xb9cbaa){_0x96088c[_0x5882('0x18')](0x194);}return _0xb9cbaa;};}function handleError(_0x261569,_0x2f16e8){_0x2f16e8=_0x2f16e8||0x1f4;return function(_0x12cc09){logger['error'](_0x12cc09[_0x5882('0x26')]);if(_0x12cc09[_0x5882('0x27')]){delete _0x12cc09[_0x5882('0x27')];}_0x261569['status'](_0x2f16e8)[_0x5882('0x28')](_0x12cc09);};}exports[_0x5882('0x29')]=function(_0x2166e6,_0x57a6c7){var _0x34eb0b={},_0x56ddd1={},_0x2c9eee={'count':0x0,'rows':[]};var _0x3c21f2=_[_0x5882('0x2a')](db[_0x5882('0x2b')]['rawAttributes'],function(_0x45c424){return{'name':_0x45c424[_0x5882('0x2c')],'type':_0x45c424[_0x5882('0x2d')][_0x5882('0x2e')]};});_0x56ddd1[_0x5882('0x2f')]=_[_0x5882('0x2a')](_0x3c21f2,'name');_0x56ddd1[_0x5882('0x30')]=_[_0x5882('0x31')](_0x2166e6[_0x5882('0x30')]);_0x56ddd1[_0x5882('0x32')]=_['intersection'](_0x56ddd1[_0x5882('0x2f')],_0x56ddd1[_0x5882('0x30')]);_0x34eb0b['attributes']=_[_0x5882('0x33')](_0x56ddd1[_0x5882('0x2f')],qs[_0x5882('0x34')](_0x2166e6[_0x5882('0x30')]['fields']));_0x34eb0b[_0x5882('0x35')]=_0x34eb0b[_0x5882('0x35')][_0x5882('0x36')]?_0x34eb0b['attributes']:_0x56ddd1[_0x5882('0x2f')];if(!_0x2166e6[_0x5882('0x30')][_0x5882('0x37')](_0x5882('0x38'))){_0x34eb0b[_0x5882('0x1e')]=qs['limit'](_0x2166e6[_0x5882('0x30')][_0x5882('0x1e')]);_0x34eb0b[_0x5882('0x1d')]=qs[_0x5882('0x1d')](_0x2166e6[_0x5882('0x30')][_0x5882('0x1d')]);}_0x34eb0b['order']=qs['sort'](_0x2166e6[_0x5882('0x30')][_0x5882('0x39')]);_0x34eb0b[_0x5882('0x3a')]=qs['filters'](_[_0x5882('0x3b')](_0x2166e6['query'],_0x56ddd1[_0x5882('0x32')]),_0x3c21f2);if(_0x2166e6[_0x5882('0x30')][_0x5882('0x3c')]){_0x34eb0b[_0x5882('0x3a')]=_[_0x5882('0x3d')](_0x34eb0b['where'],{'$or':_[_0x5882('0x2a')](_0x3c21f2,function(_0x14d6c3){if(_0x14d6c3['type']!==_0x5882('0x3e')){var _0x33a25a={};_0x33a25a[_0x14d6c3[_0x5882('0x27')]]={'$like':'%'+_0x2166e6[_0x5882('0x30')]['filter']+'%'};return _0x33a25a;}})});}_0x34eb0b=_[_0x5882('0x3d')]({},_0x34eb0b,_0x2166e6[_0x5882('0x3f')]);var _0x4c3364={'where':_0x34eb0b[_0x5882('0x3a')]};return db[_0x5882('0x2b')][_0x5882('0x1c')](_0x4c3364)[_0x5882('0x24')](function(_0x239c59){_0x2c9eee[_0x5882('0x1c')]=_0x239c59;if(_0x2166e6[_0x5882('0x30')][_0x5882('0x40')]){_0x34eb0b['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x5882('0x41')](_0x34eb0b);})[_0x5882('0x24')](function(_0x28a5eb){_0x2c9eee[_0x5882('0x42')]=_0x28a5eb;return _0x2c9eee;})[_0x5882('0x24')](respondWithFilteredResult(_0x57a6c7,_0x34eb0b))[_0x5882('0x43')](handleError(_0x57a6c7,null));};exports[_0x5882('0x44')]=function(_0xcfe8c,_0x1a57bd){var _0x4a1248={'raw':!![],'where':{'id':_0xcfe8c[_0x5882('0x45')]['id']}},_0x4f7505={};_0x4f7505[_0x5882('0x2f')]=_['keys'](db[_0x5882('0x2b')]['rawAttributes']);_0x4f7505['query']=_[_0x5882('0x31')](_0xcfe8c[_0x5882('0x30')]);_0x4f7505[_0x5882('0x32')]=_[_0x5882('0x33')](_0x4f7505['model'],_0x4f7505['query']);_0x4a1248[_0x5882('0x35')]=_[_0x5882('0x33')](_0x4f7505['model'],qs['fields'](_0xcfe8c[_0x5882('0x30')][_0x5882('0x34')]));_0x4a1248[_0x5882('0x35')]=_0x4a1248['attributes'][_0x5882('0x36')]?_0x4a1248[_0x5882('0x35')]:_0x4f7505[_0x5882('0x2f')];if(_0xcfe8c[_0x5882('0x30')][_0x5882('0x40')]){_0x4a1248[_0x5882('0x46')]=[{'all':!![]}];}_0x4a1248=_[_0x5882('0x3d')]({},_0x4a1248,_0xcfe8c['options']);return db[_0x5882('0x2b')][_0x5882('0x47')](_0x4a1248)[_0x5882('0x24')](handleEntityNotFound(_0x1a57bd,null))[_0x5882('0x24')](respondWithResult(_0x1a57bd,null))[_0x5882('0x43')](handleError(_0x1a57bd,null));};exports[_0x5882('0x48')]=function(_0x4f4253,_0x2cb7f9){return db[_0x5882('0x2b')][_0x5882('0x48')](_0x4f4253[_0x5882('0x49')],{})[_0x5882('0x24')](respondWithResult(_0x2cb7f9,0xc9))[_0x5882('0x43')](handleError(_0x2cb7f9,null));};exports['update']=function(_0x1a3fe8,_0x5d5609){if(_0x1a3fe8[_0x5882('0x49')]['id']){delete _0x1a3fe8[_0x5882('0x49')]['id'];}return db[_0x5882('0x2b')][_0x5882('0x47')]({'where':{'id':_0x1a3fe8[_0x5882('0x45')]['id']}})[_0x5882('0x24')](handleEntityNotFound(_0x5d5609,null))[_0x5882('0x24')](saveUpdates(_0x1a3fe8['body'],null))[_0x5882('0x24')](respondWithResult(_0x5d5609,null))[_0x5882('0x43')](handleError(_0x5d5609,null));};exports[_0x5882('0x25')]=function(_0x3356bc,_0x333f34){return db[_0x5882('0x2b')]['find']({'where':{'id':_0x3356bc[_0x5882('0x45')]['id']}})[_0x5882('0x24')](handleEntityNotFound(_0x333f34,null))[_0x5882('0x24')](removeEntity(_0x333f34,null))[_0x5882('0x43')](handleError(_0x333f34,null));};exports[_0x5882('0x4a')]=function(_0x523054,_0x328438){return db[_0x5882('0x2b')][_0x5882('0x4a')]()[_0x5882('0x24')](respondWithResult(_0x328438,null))[_0x5882('0x43')](handleError(_0x328438,null));}; \ No newline at end of file +var _0x6a3e=['send','index','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','filters','length','find','create','body','update','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name'];(function(_0x3a91d7,_0x4c9256){var _0x432921=function(_0x4f120b){while(--_0x4f120b){_0x3a91d7['push'](_0x3a91d7['shift']());}};_0x432921(++_0x4c9256);}(_0x6a3e,0x187));var _0xe6a3=function(_0x5a4187,_0x452e26){_0x5a4187=_0x5a4187-0x0;var _0x535681=_0x6a3e[_0x5a4187];return _0x535681;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe6a3('0x0'));var jsonpatch=require(_0xe6a3('0x1'));var rp=require(_0xe6a3('0x2'));var moment=require('moment');var BPromise=require(_0xe6a3('0x3'));var Mustache=require(_0xe6a3('0x4'));var util=require('util');var path=require(_0xe6a3('0x5'));var sox=require(_0xe6a3('0x6'));var csv=require(_0xe6a3('0x7'));var ejs=require(_0xe6a3('0x8'));var fs=require('fs');var _=require(_0xe6a3('0x9'));var squel=require('squel');var crypto=require(_0xe6a3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe6a3('0xb'));var toCsv=require(_0xe6a3('0x7'));var querystring=require(_0xe6a3('0xc'));var Papa=require(_0xe6a3('0xd'));var Redis=require(_0xe6a3('0xe'));var authService=require(_0xe6a3('0xf'));var qs=require(_0xe6a3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6a3('0x11'));var logger=require(_0xe6a3('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xe6a3('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6a3('0x14'))['db'];function respondWithStatusCode(_0xa5f1ed,_0x483577){_0x483577=_0x483577||0xcc;return function(_0x5005eb){if(_0x5005eb){return _0xa5f1ed['sendStatus'](_0x483577);}return _0xa5f1ed[_0xe6a3('0x15')](_0x483577)[_0xe6a3('0x16')]();};}function respondWithResult(_0x2a2584,_0x16b3db){_0x16b3db=_0x16b3db||0xc8;return function(_0x39112c){if(_0x39112c){return _0x2a2584[_0xe6a3('0x15')](_0x16b3db)['json'](_0x39112c);}};}function respondWithFilteredResult(_0x17d386,_0x1c0ebe){return function(_0x2405a6){if(_0x2405a6){var _0x339ee5=_0x2405a6[_0xe6a3('0x17')],_0x2ebc18=_0x1c0ebe[_0xe6a3('0x18')],_0x3e6665=_0x1c0ebe['offset']+_0x1c0ebe[_0xe6a3('0x19')],_0x18f0d2;if(_0x3e6665>=_0x339ee5){_0x3e6665=_0x339ee5;_0x18f0d2=0xc8;}else{_0x18f0d2=0xce;}_0x17d386[_0xe6a3('0x15')](_0x18f0d2);return _0x17d386[_0xe6a3('0x1a')](_0xe6a3('0x1b'),_0x2ebc18+'-'+_0x3e6665+'/'+_0x339ee5)['json'](_0x2405a6);}return null;};}function patchUpdates(_0x3d99a1){return function(_0x2de773){try{jsonpatch['apply'](_0x2de773,_0x3d99a1,!![]);}catch(_0x569256){return BPromise[_0xe6a3('0x1c')](_0x569256);}return _0x2de773[_0xe6a3('0x1d')]();};}function saveUpdates(_0x316064,_0x4ed636){return function(_0x5322ca){if(_0x5322ca){return _0x5322ca['update'](_0x316064)[_0xe6a3('0x1e')](function(_0x666fe3){return _0x666fe3;});}return null;};}function removeEntity(_0x327a0b,_0x1a8c3e){return function(_0x139959){if(_0x139959){return _0x139959[_0xe6a3('0x1f')]()['then'](function(){_0x327a0b[_0xe6a3('0x15')](0xcc)[_0xe6a3('0x16')]();});}};}function handleEntityNotFound(_0x5c1f1e,_0x2632fb){return function(_0x4b7599){if(!_0x4b7599){_0x5c1f1e[_0xe6a3('0x20')](0x194);}return _0x4b7599;};}function handleError(_0x4c0164,_0x1edcf0){_0x1edcf0=_0x1edcf0||0x1f4;return function(_0x3823d6){logger['error'](_0x3823d6[_0xe6a3('0x21')]);if(_0x3823d6[_0xe6a3('0x22')]){delete _0x3823d6[_0xe6a3('0x22')];}_0x4c0164[_0xe6a3('0x15')](_0x1edcf0)[_0xe6a3('0x23')](_0x3823d6);};}exports[_0xe6a3('0x24')]=function(_0x2e1fd6,_0x2cbdd1){var _0x2e55ec={},_0x2efee7={},_0xd1a280={'count':0x0,'rows':[]};var _0x48ad7b=_[_0xe6a3('0x25')](db['VoiceTransferReport'][_0xe6a3('0x26')],function(_0x583259){return{'name':_0x583259[_0xe6a3('0x27')],'type':_0x583259[_0xe6a3('0x28')]['key']};});_0x2efee7['model']=_[_0xe6a3('0x25')](_0x48ad7b,'name');_0x2efee7[_0xe6a3('0x29')]=_[_0xe6a3('0x2a')](_0x2e1fd6[_0xe6a3('0x29')]);_0x2efee7['filters']=_[_0xe6a3('0x2b')](_0x2efee7[_0xe6a3('0x2c')],_0x2efee7[_0xe6a3('0x29')]);_0x2e55ec[_0xe6a3('0x2d')]=_[_0xe6a3('0x2b')](_0x2efee7[_0xe6a3('0x2c')],qs['fields'](_0x2e1fd6['query'][_0xe6a3('0x2e')]));_0x2e55ec[_0xe6a3('0x2d')]=_0x2e55ec[_0xe6a3('0x2d')]['length']?_0x2e55ec[_0xe6a3('0x2d')]:_0x2efee7[_0xe6a3('0x2c')];if(!_0x2e1fd6['query'][_0xe6a3('0x2f')](_0xe6a3('0x30'))){_0x2e55ec[_0xe6a3('0x19')]=qs[_0xe6a3('0x19')](_0x2e1fd6[_0xe6a3('0x29')][_0xe6a3('0x19')]);_0x2e55ec['offset']=qs[_0xe6a3('0x18')](_0x2e1fd6[_0xe6a3('0x29')][_0xe6a3('0x18')]);}_0x2e55ec[_0xe6a3('0x31')]=qs[_0xe6a3('0x32')](_0x2e1fd6['query'][_0xe6a3('0x32')]);_0x2e55ec['where']=qs['filters'](_[_0xe6a3('0x33')](_0x2e1fd6[_0xe6a3('0x29')],_0x2efee7['filters']),_0x48ad7b);if(_0x2e1fd6[_0xe6a3('0x29')][_0xe6a3('0x34')]){_0x2e55ec[_0xe6a3('0x35')]=_[_0xe6a3('0x36')](_0x2e55ec[_0xe6a3('0x35')],{'$or':_[_0xe6a3('0x25')](_0x48ad7b,function(_0x3aedfd){if(_0x3aedfd[_0xe6a3('0x28')]!==_0xe6a3('0x37')){var _0x4f914a={};_0x4f914a[_0x3aedfd['name']]={'$like':'%'+_0x2e1fd6[_0xe6a3('0x29')][_0xe6a3('0x34')]+'%'};return _0x4f914a;}})});}_0x2e55ec=_['merge']({},_0x2e55ec,_0x2e1fd6[_0xe6a3('0x38')]);var _0x27a4ea={'where':_0x2e55ec[_0xe6a3('0x35')]};return db[_0xe6a3('0x39')][_0xe6a3('0x17')](_0x27a4ea)['then'](function(_0x2b3cdf){_0xd1a280[_0xe6a3('0x17')]=_0x2b3cdf;if(_0x2e1fd6['query'][_0xe6a3('0x3a')]){_0x2e55ec[_0xe6a3('0x3b')]=[{'all':!![]}];}return db[_0xe6a3('0x39')][_0xe6a3('0x3c')](_0x2e55ec);})[_0xe6a3('0x1e')](function(_0x1b6ad4){_0xd1a280[_0xe6a3('0x3d')]=_0x1b6ad4;return _0xd1a280;})[_0xe6a3('0x1e')](respondWithFilteredResult(_0x2cbdd1,_0x2e55ec))[_0xe6a3('0x3e')](handleError(_0x2cbdd1,null));};exports[_0xe6a3('0x3f')]=function(_0x155dab,_0x1a515d){var _0x2a18e3={'raw':!![],'where':{'id':_0x155dab['params']['id']}},_0x43f762={};_0x43f762[_0xe6a3('0x2c')]=_['keys'](db[_0xe6a3('0x39')][_0xe6a3('0x26')]);_0x43f762['query']=_[_0xe6a3('0x2a')](_0x155dab[_0xe6a3('0x29')]);_0x43f762[_0xe6a3('0x40')]=_[_0xe6a3('0x2b')](_0x43f762[_0xe6a3('0x2c')],_0x43f762[_0xe6a3('0x29')]);_0x2a18e3[_0xe6a3('0x2d')]=_[_0xe6a3('0x2b')](_0x43f762[_0xe6a3('0x2c')],qs[_0xe6a3('0x2e')](_0x155dab[_0xe6a3('0x29')]['fields']));_0x2a18e3['attributes']=_0x2a18e3['attributes'][_0xe6a3('0x41')]?_0x2a18e3[_0xe6a3('0x2d')]:_0x43f762[_0xe6a3('0x2c')];if(_0x155dab[_0xe6a3('0x29')]['includeAll']){_0x2a18e3[_0xe6a3('0x3b')]=[{'all':!![]}];}_0x2a18e3=_[_0xe6a3('0x36')]({},_0x2a18e3,_0x155dab[_0xe6a3('0x38')]);return db[_0xe6a3('0x39')][_0xe6a3('0x42')](_0x2a18e3)[_0xe6a3('0x1e')](handleEntityNotFound(_0x1a515d,null))['then'](respondWithResult(_0x1a515d,null))[_0xe6a3('0x3e')](handleError(_0x1a515d,null));};exports[_0xe6a3('0x43')]=function(_0x474a0e,_0x19e214){return db['VoiceTransferReport'][_0xe6a3('0x43')](_0x474a0e[_0xe6a3('0x44')],{})[_0xe6a3('0x1e')](respondWithResult(_0x19e214,0xc9))['catch'](handleError(_0x19e214,null));};exports[_0xe6a3('0x45')]=function(_0x4f729d,_0x10c9b1){if(_0x4f729d[_0xe6a3('0x44')]['id']){delete _0x4f729d[_0xe6a3('0x44')]['id'];}return db['VoiceTransferReport'][_0xe6a3('0x42')]({'where':{'id':_0x4f729d['params']['id']}})[_0xe6a3('0x1e')](handleEntityNotFound(_0x10c9b1,null))[_0xe6a3('0x1e')](saveUpdates(_0x4f729d[_0xe6a3('0x44')],null))[_0xe6a3('0x1e')](respondWithResult(_0x10c9b1,null))[_0xe6a3('0x3e')](handleError(_0x10c9b1,null));};exports[_0xe6a3('0x1f')]=function(_0x1ba6df,_0x11ee16){return db[_0xe6a3('0x39')]['find']({'where':{'id':_0x1ba6df['params']['id']}})['then'](handleEntityNotFound(_0x11ee16,null))[_0xe6a3('0x1e')](removeEntity(_0x11ee16,null))['catch'](handleError(_0x11ee16,null));};exports[_0xe6a3('0x46')]=function(_0x14e949,_0x44503d){return db[_0xe6a3('0x39')][_0xe6a3('0x46')]()[_0xe6a3('0x1e')](respondWithResult(_0x44503d,null))[_0xe6a3('0x3e')](handleError(_0x44503d,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index a8e8e40..d479785 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 _0xc67f=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','define','report_call_transfer','lodash'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0xc67f,0x1d5));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc67('0x0'));var util=require(_0xfc67('0x1'));var logger=require(_0xfc67('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfc67('0x3'));var rp=require(_0xfc67('0x4'));var fs=require('fs');var path=require(_0xfc67('0x5'));var rimraf=require('rimraf');var config=require(_0xfc67('0x6'));var attributes=require(_0xfc67('0x7'));module['exports']=function(_0x2a6f1e,_0x9a5593){return _0x2a6f1e[_0xfc67('0x8')]('VoiceTransferReport',attributes,{'tableName':_0xfc67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8425=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x115621,_0x341cde){var _0x5ef5ce=function(_0x2ca3f2){while(--_0x2ca3f2){_0x115621['push'](_0x115621['shift']());}};_0x5ef5ce(++_0x341cde);}(_0x8425,0x1a5));var _0x5842=function(_0x2b8e48,_0x1d4f1f){_0x2b8e48=_0x2b8e48-0x0;var _0x31f9f0=_0x8425[_0x2b8e48];return _0x31f9f0;};'use strict';var _=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var logger=require('../../config/logger')(_0x5842('0x2'));var moment=require(_0x5842('0x3'));var BPromise=require(_0x5842('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5842('0x5'));var rimraf=require(_0x5842('0x6'));var config=require(_0x5842('0x7'));var attributes=require(_0x5842('0x8'));module[_0x5842('0x9')]=function(_0x24a672,_0x3db420){return _0x24a672[_0x5842('0xa')](_0x5842('0xb'),attributes,{'tableName':_0x5842('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 25cb460..baa23ae 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 _0xa9de=['../../config/environment','client','request','then','VoiceTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','VoiceTransferReport','create','body','raw','info','CreateVoiceTransferReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa9de,0x99));var _0xea9d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xa9de[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xea9d('0x0'));var util=require(_0xea9d('0x1'));var moment=require(_0xea9d('0x2'));var BPromise=require(_0xea9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea9d('0x4'));var db=require(_0xea9d('0x5'))['db'];var utils=require(_0xea9d('0x6'));var logger=require(_0xea9d('0x7'))(_0xea9d('0x8'));var config=require(_0xea9d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xea9d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a1b1d,_0x927407,_0x4299d2){return new BPromise(function(_0xbbacc1,_0x1c4d2d){return client[_0xea9d('0xb')](_0x5a1b1d,_0x4299d2)[_0xea9d('0xc')](function(_0x11d292){logger['info'](_0xea9d('0xd'),_0x927407,'request\x20sent');logger[_0xea9d('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x927407,'request\x20sent',JSON[_0xea9d('0xf')](_0x11d292));if(_0x11d292[_0xea9d('0x10')]){if(_0x11d292['error'][_0xea9d('0x11')]===0x1f4){logger[_0xea9d('0x10')](_0xea9d('0xd'),_0x927407,_0x11d292['error'][_0xea9d('0x12')]);return _0x1c4d2d(_0x11d292['error']['message']);}logger[_0xea9d('0x10')](_0xea9d('0xd'),_0x927407,_0x11d292[_0xea9d('0x10')][_0xea9d('0x12')]);return _0xbbacc1(_0x11d292['error'][_0xea9d('0x12')]);}else{logger['info'](_0xea9d('0xd'),_0x927407,_0xea9d('0x13'));_0xbbacc1(_0x11d292['result'][_0xea9d('0x12')]);}})[_0xea9d('0x14')](function(_0x2ca2ad){logger['error'](_0xea9d('0xd'),_0x927407,_0x2ca2ad);_0x1c4d2d(_0x2ca2ad);});});}exports['CreateVoiceTransferReport']=function(_0x4c4d18){var _0x1742f4=this;return new Promise(function(_0x2142df,_0x4fd249){return db[_0xea9d('0x15')][_0xea9d('0x16')](_0x4c4d18[_0xea9d('0x17')],{'raw':_0x4c4d18['options']?_0x4c4d18['options'][_0xea9d('0x18')]===undefined?!![]:![]:!![]})[_0xea9d('0xc')](function(_0x4c0f26){logger[_0xea9d('0x19')](_0xea9d('0x1a'),_0x4c4d18);logger[_0xea9d('0xe')](_0xea9d('0x1a'),_0x4c4d18,JSON['stringify'](_0x4c0f26));_0x2142df(_0x4c0f26);})[_0xea9d('0x14')](function(_0x58e689){logger[_0xea9d('0x10')](_0xea9d('0x1a'),_0x58e689['message'],_0x4c4d18);_0x4fd249(_0x1742f4['error'](0x1f4,_0x58e689[_0xea9d('0x12')]));});});}; \ No newline at end of file +var _0xffe1=['message','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1af5bb,_0x3640ab){var _0x42a053=function(_0x2c3aff){while(--_0x2c3aff){_0x1af5bb['push'](_0x1af5bb['shift']());}};_0x42a053(++_0x3640ab);}(_0xffe1,0x175));var _0x1ffe=function(_0x1c5f16,_0x23f05f){_0x1c5f16=_0x1c5f16-0x0;var _0x4ced51=_0xffe1[_0x1c5f16];return _0x4ced51;};'use strict';var _=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1ffe('0x2'));var fs=require('fs');var Redis=require(_0x1ffe('0x3'));var db=require(_0x1ffe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ffe('0x5'))(_0x1ffe('0x6'));var config=require(_0x1ffe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1ffe('0x8')][_0x1ffe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6bc1ed,_0x26e370,_0xb34112){return new BPromise(function(_0x8eee2b,_0x4d2a28){return client['request'](_0x6bc1ed,_0xb34112)[_0x1ffe('0xa')](function(_0x13556e){logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');logger[_0x1ffe('0xd')](_0x1ffe('0xe'),_0x26e370,_0x1ffe('0xf'),JSON[_0x1ffe('0x10')](_0x13556e));if(_0x13556e[_0x1ffe('0x11')]){if(_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x12')]===0x1f4){logger[_0x1ffe('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x4d2a28(_0x13556e['error'][_0x1ffe('0x13')]);}logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x8eee2b(_0x13556e['error'][_0x1ffe('0x13')]);}else{logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');_0x8eee2b(_0x13556e[_0x1ffe('0x14')]['message']);}})[_0x1ffe('0x15')](function(_0x565922){logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x565922);_0x4d2a28(_0x565922);});});}exports['CreateVoiceTransferReport']=function(_0x561670){var _0x4dbd7f=this;return new Promise(function(_0x42b92c,_0x21950f){return db[_0x1ffe('0x16')][_0x1ffe('0x17')](_0x561670[_0x1ffe('0x18')],{'raw':_0x561670[_0x1ffe('0x19')]?_0x561670[_0x1ffe('0x19')][_0x1ffe('0x1a')]===undefined?!![]:![]:!![]})[_0x1ffe('0xa')](function(_0x38f189){logger[_0x1ffe('0xb')](_0x1ffe('0x1b'),_0x561670);logger['debug']('CreateVoiceTransferReport',_0x561670,JSON[_0x1ffe('0x10')](_0x38f189));_0x42b92c(_0x38f189);})[_0x1ffe('0x15')](function(_0x95071c){logger['error']('CreateVoiceTransferReport',_0x95071c[_0x1ffe('0x13')],_0x561670);_0x21950f(_0x4dbd7f[_0x1ffe('0x11')](0x1f4,_0x95071c[_0x1ffe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 93a9120..b74a20e 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 _0x2356=['../../components/auth/service','/originate','isAuthenticated','post','canUpdate','hangup','answer','/hold','hold','/unhold','unhold','calls','exports','Router'];(function(_0x3ae461,_0xbede97){var _0x23c221=function(_0x4e630f){while(--_0x4e630f){_0x3ae461['push'](_0x3ae461['shift']());}};_0x23c221(++_0xbede97);}(_0x2356,0x14f));var _0x6235=function(_0x1ced32,_0x1e959a){_0x1ced32=_0x1ced32-0x0;var _0xb6cc84=_0x2356[_0x1ced32];return _0xb6cc84;};'use strict';var express=require('express');var router=express[_0x6235('0x0')]();var auth=require(_0x6235('0x1'));var controller=require('./webbar.controller');router['post'](_0x6235('0x2'),auth[_0x6235('0x3')](),auth['canUpdate'](),controller['originate']);router[_0x6235('0x4')]('/hangup',auth['isAuthenticated'](),auth[_0x6235('0x5')](),controller[_0x6235('0x6')]);router[_0x6235('0x4')]('/answer',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x6235('0x7')]);router['post'](_0x6235('0x8'),auth[_0x6235('0x3')](),auth[_0x6235('0x5')](),controller[_0x6235('0x9')]);router['post'](_0x6235('0xa'),auth[_0x6235('0x3')](),auth[_0x6235('0x5')](),controller[_0x6235('0xb')]);router[_0x6235('0x4')]('/calls',auth[_0x6235('0x3')](),auth[_0x6235('0x5')](),controller[_0x6235('0xc')]);router[_0x6235('0x4')]('/transfer',auth[_0x6235('0x3')](),auth[_0x6235('0x5')](),controller['transfer']);module[_0x6235('0xd')]=router; \ No newline at end of file +var _0x9b67=['/answer','answer','/hold','/unhold','/calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','/hangup','hangup'];(function(_0x314bce,_0x21dc88){var _0x3bfb6c=function(_0x205e92){while(--_0x205e92){_0x314bce['push'](_0x314bce['shift']());}};_0x3bfb6c(++_0x21dc88);}(_0x9b67,0xf6));var _0x79b6=function(_0x44041d,_0x7f04e2){_0x44041d=_0x44041d-0x0;var _0x3c441b=_0x9b67[_0x44041d];return _0x3c441b;};'use strict';var express=require(_0x79b6('0x0'));var router=express[_0x79b6('0x1')]();var auth=require(_0x79b6('0x2'));var controller=require(_0x79b6('0x3'));router[_0x79b6('0x4')]('/originate',auth[_0x79b6('0x5')](),auth[_0x79b6('0x6')](),controller['originate']);router['post'](_0x79b6('0x7'),auth[_0x79b6('0x5')](),auth[_0x79b6('0x6')](),controller[_0x79b6('0x8')]);router[_0x79b6('0x4')](_0x79b6('0x9'),auth[_0x79b6('0x5')](),auth['canUpdate'](),controller[_0x79b6('0xa')]);router[_0x79b6('0x4')](_0x79b6('0xb'),auth[_0x79b6('0x5')](),auth[_0x79b6('0x6')](),controller['hold']);router[_0x79b6('0x4')](_0x79b6('0xc'),auth[_0x79b6('0x5')](),auth[_0x79b6('0x6')](),controller['unhold']);router['post'](_0x79b6('0xd'),auth[_0x79b6('0x5')](),auth[_0x79b6('0x6')](),controller['calls']);router[_0x79b6('0x4')](_0x79b6('0xe'),auth[_0x79b6('0x5')](),auth[_0x79b6('0x6')](),controller[_0x79b6('0xf')]);module[_0x79b6('0x10')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 73291b6..170189d 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 _0xc694=['webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','stringify','emit','log','error','name','status','send','NotFound','request','then','message','result','User','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','info','body','userId','callNumber','callerId','callbackUrl','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','format','webbar:hangup','hangup\x20executed!','catch','answer\x20fired:','webbar:answer','hold\x20fired:','webbar:hold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','bluebird','client','http'];(function(_0x1251fc,_0x4059c8){var _0x1e11a5=function(_0x42a36f){while(--_0x42a36f){_0x1251fc['push'](_0x1251fc['shift']());}};_0x1e11a5(++_0x4059c8);}(_0xc694,0x11e));var _0x4c69=function(_0x5ee244,_0x3cfee0){_0x5ee244=_0x5ee244-0x0;var _0x30f5c8=_0xc694[_0x5ee244];return _0x30f5c8;};'use strict';var path=require(_0x4c69('0x0'));var fs=require('fs');var _=require(_0x4c69('0x1'));var db=require(_0x4c69('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x4c69('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x4c69('0x4')][_0x4c69('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x4c69('0x6'));var Redis=require(_0x4c69('0x7'));config[_0x4c69('0x8')]=_[_0x4c69('0x9')](config[_0x4c69('0x8')],{'host':_0x4c69('0xa'),'port':0x18eb});var io=require(_0x4c69('0xb'))(new Redis(config[_0x4c69('0x8')]));var Schema=require(_0x4c69('0xc'));var originateValidation=new Schema({'userId':{'type':_0x4c69('0xd'),'required':[!![],_0x4c69('0xe')]},'callNumber':{'type':_0x4c69('0xf'),'required':[!![],_0x4c69('0x10')]},'callerId':{'type':_0x4c69('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x4c69('0xd'),'required':[!![],_0x4c69('0xe')]},'sessionId':{'type':_0x4c69('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4c69('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4c69('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4c69('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4c69('0xf'),'required':[!![],_0x4c69('0x11')]},'transferNumber':{'type':_0x4c69('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x4c69('0xd'),'required':[!![],_0x4c69('0xe')]},'sessionId':{'type':_0x4c69('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4c69('0xe')]},'sessionId':{'type':_0x4c69('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x4c69('0xd'),'required':[!![],_0x4c69('0xe')]}});function emit(_0x2444d1,_0x277f8b,_0x8a8ecd){logger['info'](_0x2444d1,_0x277f8b,JSON[_0x4c69('0x12')](_0x8a8ecd));io['to'](_0x2444d1)[_0x4c69('0x13')](_0x277f8b,_0x8a8ecd);}function handleError(_0x2224b6){return function(_0x206ebd){console[_0x4c69('0x14')]('handleError:',_0x206ebd,_0x206ebd instanceof RangeError);logger[_0x4c69('0x15')](_0x206ebd['stack']);if(_0x206ebd instanceof RangeError){if(_0x206ebd['name']){delete _0x206ebd[_0x4c69('0x16')];}_0x2224b6[_0x4c69('0x17')](0x194)[_0x4c69('0x18')](_0x206ebd);}else{if(_0x206ebd[_0x4c69('0x16')]){delete _0x206ebd[_0x4c69('0x16')];}_0x2224b6[_0x4c69('0x17')](0x1f4)['send'](_0x206ebd);}};}function checkError(){return function(_0x2e6ab6){if(!_0x2e6ab6){throw new RangeError(_0x4c69('0x19'));}return _0x2e6ab6;};}function respondWithRpcPromise(_0x45ed4c,_0x1cbf9d){return new BPromise(function(_0x274532,_0x77a5a2){var _0x38e238=amiClient;return _0x38e238[_0x4c69('0x1a')](_0x45ed4c,_0x1cbf9d)[_0x4c69('0x1b')](function(_0x2e0367){if(_0x2e0367[_0x4c69('0x15')]){if(_0x2e0367[_0x4c69('0x15')]['code']===0x1f4){return _0x77a5a2(_0x2e0367['error'][_0x4c69('0x1c')]);}return _0x274532(_0x2e0367[_0x4c69('0x15')][_0x4c69('0x1c')]);}else{_0x274532(_0x2e0367[_0x4c69('0x1d')]);}})['catch'](function(_0x4ca1c3){_0x77a5a2(_0x4ca1c3);});});}function getAgent(_0x21db01){return db[_0x4c69('0x1e')]['findOne']({'where':{'id':_0x21db01,'role':_0x4c69('0x1f')}})[_0x4c69('0x1b')](checkError());}function getAgentCheckSession(_0x570ae8,_0x52c505){return new BPromise(function(_0x3f0390,_0x454ee5){var _0x2a3d3d=respondWithRpcPromise(_0x4c69('0x20'));var _0x2fe4ac=getAgent(_0x570ae8);Promise[_0x4c69('0x21')]([_0x2a3d3d,_0x2fe4ac])['then'](function(_0x2f71ab){var _0x4adbf0=_0x2f71ab[0x0];var _0x41ca53=_0x2f71ab[0x1];var _0xb9eb42=_[_0x4c69('0x22')](_0x4adbf0[_0x4c69('0x23')],function(_0x44f295){return _0x44f295[_0x4c69('0x24')]==_0x41ca53['id']&&_0x44f295[_0x4c69('0x25')]==_0x52c505;});if(_0xb9eb42[_0x4c69('0x26')]==0x1){_0x3f0390(_0x41ca53);}else{_0x454ee5(new RangeError('sessionId\x20'+_0x52c505+_0x4c69('0x27')));}});});}exports[_0x4c69('0x28')]=function(_0x3d54c9,_0x1621c6){logger[_0x4c69('0x29')]('originate\x20fired:',_0x3d54c9[_0x4c69('0x2a')]);var _0x2ddaca=originateValidation[_0x4c69('0xc')](_0x3d54c9[_0x4c69('0x2a')]);if(_0x2ddaca[_0x4c69('0x26')]>0x0){return _0x1621c6[_0x4c69('0x17')](0x190)['json'](_0x2ddaca);}var _0x22f91a=_0x3d54c9[_0x4c69('0x2a')][_0x4c69('0x2b')];var _0x6d465c=_0x3d54c9[_0x4c69('0x2a')][_0x4c69('0x2c')];var _0x127e20=_0x3d54c9[_0x4c69('0x2a')][_0x4c69('0x2d')];var _0x1bd843=_0x3d54c9[_0x4c69('0x2a')][_0x4c69('0x2e')];return getAgent(_0x22f91a)['then'](function(_0x4d1038){logger['info']('entityFound:',_0x4d1038[_0x4c69('0x16')]);emit(util['format'](_0x4c69('0x2f'),_0x4d1038[_0x4c69('0x16')]),_0x4c69('0x30'),{'callNumber':_0x6d465c,'callerId':_0x127e20,'callbackUrl':_0x1bd843});return _0x1621c6[_0x4c69('0x17')](0xc8)[_0x4c69('0x31')]({'error':![],'message':_0x4c69('0x32')});})['catch'](handleError(_0x1621c6));};exports[_0x4c69('0x33')]=function(_0x10993e,_0xab8933){logger['info'](_0x4c69('0x34'),_0x10993e[_0x4c69('0x2a')]);var _0xbeb3e3=hangupValidation[_0x4c69('0xc')](_0x10993e[_0x4c69('0x2a')]);if(_0xbeb3e3[_0x4c69('0x26')]>0x0){return _0xab8933[_0x4c69('0x17')](0x190)['json'](_0xbeb3e3);}var _0x57bb4e=_0x10993e['body']['userId'];var _0x15d13d=_0x10993e['body'][_0x4c69('0x25')];return getAgent(_0x57bb4e)[_0x4c69('0x1b')](function(_0x5327d1){logger['info'](_0x4c69('0x35'),_0x5327d1['name']);emit(util[_0x4c69('0x36')](_0x4c69('0x2f'),_0x5327d1[_0x4c69('0x16')]),_0x4c69('0x37'),{'sessionId':_0x15d13d});return _0xab8933['status'](0xc8)[_0x4c69('0x31')]({'error':![],'message':_0x4c69('0x38')});})[_0x4c69('0x39')](handleError(_0xab8933));};exports['answer']=function(_0x355e2e,_0x1f9576){logger[_0x4c69('0x29')](_0x4c69('0x3a'),_0x355e2e[_0x4c69('0x2a')]);var _0x1721a8=answerValidation[_0x4c69('0xc')](_0x355e2e[_0x4c69('0x2a')]);if(_0x1721a8[_0x4c69('0x26')]>0x0){return _0x1f9576[_0x4c69('0x17')](0x190)[_0x4c69('0x31')](_0x1721a8);}var _0xd1dc85=_0x355e2e[_0x4c69('0x2a')][_0x4c69('0x2b')];var _0x3f5499=_0x355e2e[_0x4c69('0x2a')][_0x4c69('0x25')];return getAgent(_0xd1dc85)['then'](function(_0x34e7ca){logger['info'](_0x4c69('0x35'),_0x34e7ca['name']);emit(util['format'](_0x4c69('0x2f'),_0x34e7ca[_0x4c69('0x16')]),_0x4c69('0x3b'),{'sessionId':_0x3f5499});return _0x1f9576[_0x4c69('0x17')](0xc8)[_0x4c69('0x31')]({'error':![],'message':'answer\x20executed!'});})[_0x4c69('0x39')](handleError(_0x1f9576));};exports['hold']=function(_0x4bbdbb,_0x2e66ad){logger[_0x4c69('0x29')](_0x4c69('0x3c'),_0x4bbdbb[_0x4c69('0x2a')]);var _0x205cca=holdValidation[_0x4c69('0xc')](_0x4bbdbb[_0x4c69('0x2a')]);if(_0x205cca['length']>0x0){return _0x2e66ad[_0x4c69('0x17')](0x190)[_0x4c69('0x31')](_0x205cca);}var _0x1eae37=_0x4bbdbb[_0x4c69('0x2a')][_0x4c69('0x2b')];var _0x597288=_0x4bbdbb[_0x4c69('0x2a')][_0x4c69('0x25')];return getAgent(_0x1eae37)[_0x4c69('0x1b')](function(_0x450582){logger[_0x4c69('0x29')](_0x4c69('0x35'),_0x450582[_0x4c69('0x16')]);emit(util[_0x4c69('0x36')]('user:%s',_0x450582[_0x4c69('0x16')]),_0x4c69('0x3d'),{'sessionId':_0x597288});return _0x2e66ad[_0x4c69('0x17')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x2e66ad));};exports['unhold']=function(_0x49b0df,_0x129b38){logger[_0x4c69('0x29')](_0x4c69('0x3e'),_0x49b0df[_0x4c69('0x2a')]);var _0x3b578f=unholdValidation[_0x4c69('0xc')](_0x49b0df['body']);if(_0x3b578f[_0x4c69('0x26')]>0x0){return _0x129b38[_0x4c69('0x17')](0x190)[_0x4c69('0x31')](_0x3b578f);}var _0x4afd2b=_0x49b0df['body'][_0x4c69('0x2b')];var _0x1320aa=_0x49b0df[_0x4c69('0x2a')][_0x4c69('0x25')];return getAgent(_0x4afd2b)[_0x4c69('0x1b')](function(_0x5770a0){logger[_0x4c69('0x29')](_0x4c69('0x35'),_0x5770a0[_0x4c69('0x16')]);emit(util[_0x4c69('0x36')]('user:%s',_0x5770a0[_0x4c69('0x16')]),_0x4c69('0x3f'),{'sessionId':_0x1320aa});return _0x129b38[_0x4c69('0x17')](0xc8)[_0x4c69('0x31')]({'error':![],'message':_0x4c69('0x40')});})['catch'](handleError(_0x129b38));};exports[_0x4c69('0x41')]=function(_0x20e094,_0x58ef6b){logger[_0x4c69('0x29')](_0x4c69('0x42'),_0x58ef6b[_0x4c69('0x2a')]);var _0x5f032c=callsValidation[_0x4c69('0xc')](_0x20e094[_0x4c69('0x2a')]);if(_0x5f032c['length']>0x0){return _0x58ef6b[_0x4c69('0x17')](0x190)[_0x4c69('0x31')](_0x5f032c);}var _0x271b73=_0x20e094[_0x4c69('0x2a')][_0x4c69('0x2b')];var _0x4c56c0=respondWithRpcPromise(_0x4c69('0x20'));var _0x4c0615=getAgent(_0x271b73);return Promise[_0x4c69('0x21')]([_0x4c56c0,_0x4c0615])[_0x4c69('0x1b')](function(_0x55a0c4){var _0x2b7a0d=_0x55a0c4[0x0];var _0x5042bc=_0x55a0c4[0x1];var _0x11aa12=_[_0x4c69('0x22')](_0x2b7a0d[_0x4c69('0x23')],function(_0x4bddad){return _0x4bddad[_0x4c69('0x24')]==_0x5042bc['id'];});return _0x58ef6b['status'](0xc8)[_0x4c69('0x31')]({'count':_0x11aa12[_0x4c69('0x26')],'rows':_0x11aa12});})[_0x4c69('0x39')](handleError(_0x58ef6b));};exports[_0x4c69('0x43')]=function(_0x258609,_0x1f45f1){logger[_0x4c69('0x29')](_0x4c69('0x44'),_0x258609[_0x4c69('0x2a')]);var _0x2fc921=conferenceValidation['validate'](_0x258609[_0x4c69('0x2a')]);if(_0x2fc921[_0x4c69('0x26')]>0x0){return _0x1f45f1[_0x4c69('0x17')](0x190)[_0x4c69('0x31')](_0x2fc921);}var _0x46fa86=_0x258609[_0x4c69('0x2a')]['userId'];return getAgent(_0x46fa86)['then'](function(_0x1346b0){logger[_0x4c69('0x29')](_0x4c69('0x35'),_0x1346b0['name']);emit(util[_0x4c69('0x36')](_0x4c69('0x2f'),_0x1346b0['name']),'webbar:conference');return _0x1f45f1['status'](0xc8)[_0x4c69('0x31')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x1f45f1));};exports[_0x4c69('0x45')]=function(_0x42ae88,_0x1013d2){logger[_0x4c69('0x29')](_0x4c69('0x46'),_0x42ae88[_0x4c69('0x2a')]);var _0x21ee01=transferValidation[_0x4c69('0xc')](_0x42ae88[_0x4c69('0x2a')]);if(_0x21ee01['length']>0x0){return _0x1013d2[_0x4c69('0x17')](0x190)[_0x4c69('0x31')](_0x21ee01);}var _0x3fa818=_0x42ae88[_0x4c69('0x2a')]['userId'];var _0x3bc170=_0x42ae88['body'][_0x4c69('0x25')];var _0x4e7035=_0x42ae88['body'][_0x4c69('0x47')];return getAgent(_0x3fa818)[_0x4c69('0x1b')](function(_0xd395dc){logger[_0x4c69('0x29')](_0x4c69('0x35'),_0xd395dc[_0x4c69('0x16')]);emit(util[_0x4c69('0x36')](_0x4c69('0x2f'),_0xd395dc[_0x4c69('0x16')]),_0x4c69('0x48'),{'sessionId':_0x3bc170,'transferNumber':_0x4e7035});return _0x1013d2[_0x4c69('0x17')](0xc8)[_0x4c69('0x31')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x1013d2));}; \ No newline at end of file +var _0x38df=['path','lodash','../../mysqldb','../../config/environment','util','bluebird','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber'];(function(_0x1b997f,_0x1c21b8){var _0x195a5d=function(_0x133013){while(--_0x133013){_0x1b997f['push'](_0x1b997f['shift']());}};_0x195a5d(++_0x1c21b8);}(_0x38df,0x144));var _0xf38d=function(_0x29f0d1,_0x329499){_0x29f0d1=_0x29f0d1-0x0;var _0x4560d3=_0x38df[_0x29f0d1];return _0x4560d3;};'use strict';var path=require(_0xf38d('0x0'));var fs=require('fs');var _=require(_0xf38d('0x1'));var db=require(_0xf38d('0x2'))['db'];var config=require(_0xf38d('0x3'));var util=require(_0xf38d('0x4'));var BPromise=require(_0xf38d('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xf38d('0x6')]({'port':0x232a});var logger=require(_0xf38d('0x7'))(_0xf38d('0x8'));var Redis=require('ioredis');config[_0xf38d('0x9')]=_[_0xf38d('0xa')](config[_0xf38d('0x9')],{'host':_0xf38d('0xb'),'port':0x18eb});var io=require(_0xf38d('0xc'))(new Redis(config[_0xf38d('0x9')]));var Schema=require(_0xf38d('0xd'));var originateValidation=new Schema({'userId':{'type':_0xf38d('0xe'),'required':[!![],_0xf38d('0xf')]},'callNumber':{'type':_0xf38d('0x10'),'required':[!![],_0xf38d('0x11')]},'callerId':{'type':_0xf38d('0x10')},'callbackUrl':{'type':_0xf38d('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf38d('0xf')]},'sessionId':{'type':_0xf38d('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf38d('0xe'),'required':[!![],_0xf38d('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf38d('0xf')]},'sessionId':{'type':_0xf38d('0x10'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xf38d('0x10'),'required':[!![],_0xf38d('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xf38d('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf38d('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf38d('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf38d('0xe'),'required':[!![],_0xf38d('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf38d('0xe'),'required':[!![],_0xf38d('0xf')]}});function emit(_0xb42d76,_0x52dffb,_0xef11a2){logger[_0xf38d('0x13')](_0xb42d76,_0x52dffb,JSON[_0xf38d('0x14')](_0xef11a2));io['to'](_0xb42d76)[_0xf38d('0x15')](_0x52dffb,_0xef11a2);}function handleError(_0x299cb6){return function(_0x41fc14){console[_0xf38d('0x16')](_0xf38d('0x17'),_0x41fc14,_0x41fc14 instanceof RangeError);logger[_0xf38d('0x18')](_0x41fc14[_0xf38d('0x19')]);if(_0x41fc14 instanceof RangeError){if(_0x41fc14[_0xf38d('0x1a')]){delete _0x41fc14[_0xf38d('0x1a')];}_0x299cb6[_0xf38d('0x1b')](0x194)[_0xf38d('0x1c')](_0x41fc14);}else{if(_0x41fc14['name']){delete _0x41fc14[_0xf38d('0x1a')];}_0x299cb6[_0xf38d('0x1b')](0x1f4)[_0xf38d('0x1c')](_0x41fc14);}};}function checkError(){return function(_0x362b80){if(!_0x362b80){throw new RangeError(_0xf38d('0x1d'));}return _0x362b80;};}function respondWithRpcPromise(_0x4fad06,_0x4dcbe5){return new BPromise(function(_0x10a45d,_0x581eee){var _0x1269e5=amiClient;return _0x1269e5[_0xf38d('0x1e')](_0x4fad06,_0x4dcbe5)[_0xf38d('0x1f')](function(_0x941f7){if(_0x941f7[_0xf38d('0x18')]){if(_0x941f7[_0xf38d('0x18')][_0xf38d('0x20')]===0x1f4){return _0x581eee(_0x941f7[_0xf38d('0x18')][_0xf38d('0x21')]);}return _0x10a45d(_0x941f7['error']['message']);}else{_0x10a45d(_0x941f7[_0xf38d('0x22')]);}})[_0xf38d('0x23')](function(_0x872ee7){_0x581eee(_0x872ee7);});});}function getAgent(_0x1b2ade){return db[_0xf38d('0x24')][_0xf38d('0x25')]({'where':{'id':_0x1b2ade,'role':_0xf38d('0x26')}})[_0xf38d('0x1f')](checkError());}function getAgentCheckSession(_0x220cbf,_0x57d6b1){return new BPromise(function(_0x1168c8,_0x2eb126){var _0xab53ae=respondWithRpcPromise('VoiceChannels');var _0x32c032=getAgent(_0x220cbf);Promise['all']([_0xab53ae,_0x32c032])[_0xf38d('0x1f')](function(_0x3972a1){var _0x174f0f=_0x3972a1[0x0];var _0x81e997=_0x3972a1[0x1];var _0x52d387=_[_0xf38d('0x27')](_0x174f0f[_0xf38d('0x28')],function(_0x324ec7){return _0x324ec7[_0xf38d('0x29')]==_0x81e997['id']&&_0x324ec7[_0xf38d('0x2a')]==_0x57d6b1;});if(_0x52d387[_0xf38d('0x2b')]==0x1){_0x1168c8(_0x81e997);}else{_0x2eb126(new RangeError(_0xf38d('0x2c')+_0x57d6b1+_0xf38d('0x2d')));}});});}exports[_0xf38d('0x2e')]=function(_0x3447d1,_0x1f0a21){logger[_0xf38d('0x13')](_0xf38d('0x2f'),_0x3447d1[_0xf38d('0x30')]);var _0x558d58=originateValidation[_0xf38d('0xd')](_0x3447d1['body']);if(_0x558d58[_0xf38d('0x2b')]>0x0){return _0x1f0a21[_0xf38d('0x1b')](0x190)[_0xf38d('0x31')](_0x558d58);}var _0x3bc21a=_0x3447d1[_0xf38d('0x30')][_0xf38d('0x32')];var _0x265319=_0x3447d1[_0xf38d('0x30')][_0xf38d('0x33')];var _0x5497fc=_0x3447d1[_0xf38d('0x30')][_0xf38d('0x34')];var _0x44e5ac=_0x3447d1[_0xf38d('0x30')][_0xf38d('0x35')];return getAgent(_0x3bc21a)['then'](function(_0x2795e8){logger[_0xf38d('0x13')](_0xf38d('0x36'),_0x2795e8[_0xf38d('0x1a')]);emit(util['format'](_0xf38d('0x37'),_0x2795e8[_0xf38d('0x1a')]),_0xf38d('0x38'),{'callNumber':_0x265319,'callerId':_0x5497fc,'callbackUrl':_0x44e5ac});return _0x1f0a21['status'](0xc8)[_0xf38d('0x31')]({'error':![],'message':_0xf38d('0x39')});})[_0xf38d('0x23')](handleError(_0x1f0a21));};exports[_0xf38d('0x3a')]=function(_0x404831,_0x32e3c3){logger['info'](_0xf38d('0x3b'),_0x404831['body']);var _0x588ab8=hangupValidation[_0xf38d('0xd')](_0x404831[_0xf38d('0x30')]);if(_0x588ab8[_0xf38d('0x2b')]>0x0){return _0x32e3c3[_0xf38d('0x1b')](0x190)[_0xf38d('0x31')](_0x588ab8);}var _0x1f0a04=_0x404831['body'][_0xf38d('0x32')];var _0x3aa3b3=_0x404831['body'][_0xf38d('0x2a')];return getAgent(_0x1f0a04)[_0xf38d('0x1f')](function(_0x225d7d){logger[_0xf38d('0x13')]('entityFound:',_0x225d7d[_0xf38d('0x1a')]);emit(util[_0xf38d('0x3c')](_0xf38d('0x37'),_0x225d7d['name']),_0xf38d('0x3d'),{'sessionId':_0x3aa3b3});return _0x32e3c3['status'](0xc8)['json']({'error':![],'message':_0xf38d('0x3e')});})[_0xf38d('0x23')](handleError(_0x32e3c3));};exports[_0xf38d('0x3f')]=function(_0x46ae08,_0x3ecdca){logger[_0xf38d('0x13')](_0xf38d('0x40'),_0x46ae08[_0xf38d('0x30')]);var _0x1592b8=answerValidation[_0xf38d('0xd')](_0x46ae08[_0xf38d('0x30')]);if(_0x1592b8[_0xf38d('0x2b')]>0x0){return _0x3ecdca[_0xf38d('0x1b')](0x190)[_0xf38d('0x31')](_0x1592b8);}var _0x33dacb=_0x46ae08['body']['userId'];var _0x261361=_0x46ae08[_0xf38d('0x30')]['sessionId'];return getAgent(_0x33dacb)[_0xf38d('0x1f')](function(_0x1c3326){logger[_0xf38d('0x13')]('entityFound:',_0x1c3326[_0xf38d('0x1a')]);emit(util[_0xf38d('0x3c')](_0xf38d('0x37'),_0x1c3326[_0xf38d('0x1a')]),'webbar:answer',{'sessionId':_0x261361});return _0x3ecdca[_0xf38d('0x1b')](0xc8)[_0xf38d('0x31')]({'error':![],'message':_0xf38d('0x41')});})[_0xf38d('0x23')](handleError(_0x3ecdca));};exports['hold']=function(_0xd43a41,_0x1199a3){logger[_0xf38d('0x13')](_0xf38d('0x42'),_0xd43a41[_0xf38d('0x30')]);var _0x196745=holdValidation[_0xf38d('0xd')](_0xd43a41[_0xf38d('0x30')]);if(_0x196745['length']>0x0){return _0x1199a3['status'](0x190)[_0xf38d('0x31')](_0x196745);}var _0x19d703=_0xd43a41[_0xf38d('0x30')][_0xf38d('0x32')];var _0x11b3b7=_0xd43a41[_0xf38d('0x30')]['sessionId'];return getAgent(_0x19d703)['then'](function(_0x2672e4){logger['info']('entityFound:',_0x2672e4[_0xf38d('0x1a')]);emit(util[_0xf38d('0x3c')](_0xf38d('0x37'),_0x2672e4['name']),_0xf38d('0x43'),{'sessionId':_0x11b3b7});return _0x1199a3[_0xf38d('0x1b')](0xc8)[_0xf38d('0x31')]({'error':![],'message':_0xf38d('0x44')});})[_0xf38d('0x23')](handleError(_0x1199a3));};exports[_0xf38d('0x45')]=function(_0x11ac95,_0x20b803){logger['info']('unhold\x20fired:',_0x11ac95['body']);var _0x4c7123=unholdValidation[_0xf38d('0xd')](_0x11ac95[_0xf38d('0x30')]);if(_0x4c7123[_0xf38d('0x2b')]>0x0){return _0x20b803[_0xf38d('0x1b')](0x190)[_0xf38d('0x31')](_0x4c7123);}var _0x5a26e7=_0x11ac95[_0xf38d('0x30')][_0xf38d('0x32')];var _0x3b319c=_0x11ac95['body'][_0xf38d('0x2a')];return getAgent(_0x5a26e7)['then'](function(_0x15d07b){logger[_0xf38d('0x13')](_0xf38d('0x36'),_0x15d07b[_0xf38d('0x1a')]);emit(util[_0xf38d('0x3c')](_0xf38d('0x37'),_0x15d07b[_0xf38d('0x1a')]),_0xf38d('0x46'),{'sessionId':_0x3b319c});return _0x20b803[_0xf38d('0x1b')](0xc8)[_0xf38d('0x31')]({'error':![],'message':_0xf38d('0x47')});})['catch'](handleError(_0x20b803));};exports[_0xf38d('0x48')]=function(_0x5577b5,_0x23bc78){logger['info'](_0xf38d('0x49'),_0x23bc78[_0xf38d('0x30')]);var _0x1f2ec9=callsValidation[_0xf38d('0xd')](_0x5577b5[_0xf38d('0x30')]);if(_0x1f2ec9[_0xf38d('0x2b')]>0x0){return _0x23bc78[_0xf38d('0x1b')](0x190)[_0xf38d('0x31')](_0x1f2ec9);}var _0x10df7c=_0x5577b5['body'][_0xf38d('0x32')];var _0x6257a=respondWithRpcPromise('VoiceChannels');var _0x12f2ef=getAgent(_0x10df7c);return Promise[_0xf38d('0x4a')]([_0x6257a,_0x12f2ef])['then'](function(_0xbaf3d4){var _0x42c6b7=_0xbaf3d4[0x0];var _0x2bbe32=_0xbaf3d4[0x1];var _0x44a0d5=_[_0xf38d('0x27')](_0x42c6b7[_0xf38d('0x28')],function(_0x3b9195){return _0x3b9195[_0xf38d('0x29')]==_0x2bbe32['id'];});return _0x23bc78[_0xf38d('0x1b')](0xc8)[_0xf38d('0x31')]({'count':_0x44a0d5[_0xf38d('0x2b')],'rows':_0x44a0d5});})[_0xf38d('0x23')](handleError(_0x23bc78));};exports[_0xf38d('0x4b')]=function(_0x47b9be,_0x5c782c){logger[_0xf38d('0x13')](_0xf38d('0x4c'),_0x47b9be['body']);var _0x5c928a=conferenceValidation[_0xf38d('0xd')](_0x47b9be[_0xf38d('0x30')]);if(_0x5c928a[_0xf38d('0x2b')]>0x0){return _0x5c782c[_0xf38d('0x1b')](0x190)['json'](_0x5c928a);}var _0x473481=_0x47b9be[_0xf38d('0x30')][_0xf38d('0x32')];return getAgent(_0x473481)[_0xf38d('0x1f')](function(_0x975bb5){logger[_0xf38d('0x13')]('entityFound:',_0x975bb5[_0xf38d('0x1a')]);emit(util['format'](_0xf38d('0x37'),_0x975bb5[_0xf38d('0x1a')]),_0xf38d('0x4d'));return _0x5c782c[_0xf38d('0x1b')](0xc8)[_0xf38d('0x31')]({'error':![],'message':_0xf38d('0x4e')});})[_0xf38d('0x23')](handleError(_0x5c782c));};exports['transfer']=function(_0xf9ce71,_0x1fbc6d){logger[_0xf38d('0x13')](_0xf38d('0x4f'),_0xf9ce71['body']);var _0x50b7ba=transferValidation[_0xf38d('0xd')](_0xf9ce71[_0xf38d('0x30')]);if(_0x50b7ba[_0xf38d('0x2b')]>0x0){return _0x1fbc6d[_0xf38d('0x1b')](0x190)['json'](_0x50b7ba);}var _0x50017a=_0xf9ce71[_0xf38d('0x30')][_0xf38d('0x32')];var _0x2936da=_0xf9ce71[_0xf38d('0x30')]['sessionId'];var _0x2ef92d=_0xf9ce71[_0xf38d('0x30')][_0xf38d('0x50')];return getAgent(_0x50017a)[_0xf38d('0x1f')](function(_0x268976){logger['info'](_0xf38d('0x36'),_0x268976[_0xf38d('0x1a')]);emit(util[_0xf38d('0x3c')](_0xf38d('0x37'),_0x268976['name']),'webbar:transfer',{'sessionId':_0x2936da,'transferNumber':_0x2ef92d});return _0x1fbc6d['status'](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0xf38d('0x23')](handleError(_0x1fbc6d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 4327e04..36c3d69 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 _0x3423=['put','update','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getAnswers','/:id/applications','getApplications','post','create','/:id/dispositions','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','send'];(function(_0x14861c,_0x8c8686){var _0xf7918e=function(_0x4d89a6){while(--_0x4d89a6){_0x14861c['push'](_0x14861c['shift']());}};_0xf7918e(++_0x8c8686);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var auth=require(_0x3342('0x4'));var interaction=require(_0x3342('0x5'));var config=require(_0x3342('0x6'));var controller=require(_0x3342('0x7'));router[_0x3342('0x8')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xa')]);router[_0x3342('0x8')](_0x3342('0xb'),auth[_0x3342('0x9')](),controller[_0x3342('0xc')]);router[_0x3342('0x8')](_0x3342('0xd'),auth[_0x3342('0x9')](),controller[_0x3342('0xe')]);router['get']('/:id/dispositions',auth[_0x3342('0x9')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3342('0xf')]);router[_0x3342('0x8')]('/:id/users',auth[_0x3342('0x9')](),controller['getAgents']);router[_0x3342('0x8')](_0x3342('0x10'),auth['isAuthenticated'](),controller[_0x3342('0x11')]);router[_0x3342('0x12')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0x13')]);router[_0x3342('0x12')](_0x3342('0x14'),auth[_0x3342('0x9')](),controller['addDisposition']);router[_0x3342('0x12')](_0x3342('0x15'),auth['isAuthenticated'](),controller[_0x3342('0x16')]);router[_0x3342('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x3342('0x17')]);router[_0x3342('0x12')](_0x3342('0x10'),auth[_0x3342('0x9')](),controller[_0x3342('0x18')]);router[_0x3342('0x12')](_0x3342('0x19'),controller[_0x3342('0x1a')]);router[_0x3342('0x12')]('/:id/send',auth[_0x3342('0x9')](),controller[_0x3342('0x1b')]);router[_0x3342('0x1c')]('/:id',auth[_0x3342('0x9')](),controller[_0x3342('0x1d')]);router['delete'](_0x3342('0xd'),auth[_0x3342('0x9')](),controller['destroy']);router[_0x3342('0x1e')]('/:id/dispositions',auth[_0x3342('0x9')](),controller[_0x3342('0x1f')]);router[_0x3342('0x1e')](_0x3342('0x15'),auth[_0x3342('0x9')](),controller[_0x3342('0x20')]);router[_0x3342('0x1e')](_0x3342('0x21'),auth['isAuthenticated'](),controller[_0x3342('0x22')]);module['exports']=router; \ No newline at end of file +var _0x6cb4=['/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','post','create','addDisposition','/:id/canned_answers','addAnswer'];(function(_0x2cfeca,_0x41b47c){var _0x3ff1e9=function(_0x148e24){while(--_0x148e24){_0x2cfeca['push'](_0x2cfeca['shift']());}};_0x3ff1e9(++_0x41b47c);}(_0x6cb4,0xff));var _0x46cb=function(_0x58ad95,_0x490059){_0x58ad95=_0x58ad95-0x0;var _0x2330f2=_0x6cb4[_0x58ad95];return _0x2330f2;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var auth=require(_0x46cb('0x6'));var interaction=require(_0x46cb('0x7'));var config=require(_0x46cb('0x8'));var controller=require('./whatsappAccount.controller');router[_0x46cb('0x9')]('/',auth['isAuthenticated'](),controller[_0x46cb('0xa')]);router['get'](_0x46cb('0xb'),auth[_0x46cb('0xc')](),controller[_0x46cb('0xd')]);router[_0x46cb('0x9')](_0x46cb('0xe'),auth[_0x46cb('0xc')](),controller['show']);router[_0x46cb('0x9')](_0x46cb('0xf'),auth['isAuthenticated'](),controller[_0x46cb('0x10')]);router[_0x46cb('0x9')]('/:id/canned_answers',auth[_0x46cb('0xc')](),controller[_0x46cb('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x46cb('0x12')]);router[_0x46cb('0x9')](_0x46cb('0x13'),auth[_0x46cb('0xc')](),controller['getApplications']);router[_0x46cb('0x14')]('/',auth[_0x46cb('0xc')](),controller[_0x46cb('0x15')]);router[_0x46cb('0x14')](_0x46cb('0xf'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x16')]);router[_0x46cb('0x14')](_0x46cb('0x17'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x18')]);router['post'](_0x46cb('0x19'),auth['isAuthenticated'](),controller[_0x46cb('0x1a')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x46cb('0x1b')]);router[_0x46cb('0x14')](_0x46cb('0x1c'),controller[_0x46cb('0x1d')]);router[_0x46cb('0x14')](_0x46cb('0x1e'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x1f')]);router[_0x46cb('0x20')](_0x46cb('0xe'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x21')]);router[_0x46cb('0x22')](_0x46cb('0xe'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x23')]);router[_0x46cb('0x22')](_0x46cb('0xf'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x24')]);router[_0x46cb('0x22')](_0x46cb('0x17'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x25')]);router[_0x46cb('0x22')]('/:id/users',auth['isAuthenticated'](),controller[_0x46cb('0x26')]);module[_0x46cb('0x27')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 3b29b77..4e3baab 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 _0x3391=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x53056c,_0x1d56a9){var _0x5cec88=function(_0x2ad06b){while(--_0x2ad06b){_0x53056c['push'](_0x53056c['shift']());}};_0x5cec88(++_0x1d56a9);}(_0x3391,0x6c));var _0x1339=function(_0x25d912,_0x4fd1b4){_0x25d912=_0x25d912-0x0;var _0x1b120b=_0x3391[_0x25d912];return _0x1b120b;};'use strict';var Sequelize=require(_0x1339('0x0'));var rs=require(_0x1339('0x1'));module[_0x1339('0x2')]={'name':{'type':Sequelize[_0x1339('0x3')],'unique':_0x1339('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x1339('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x1339('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x1339('0x3')],'defaultValue':function(){return rs[_0x1339('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x1339('0x6'))},'accountSid':{'type':Sequelize[_0x1339('0x3')]},'authToken':{'type':Sequelize[_0x1339('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1339('0x7')],'defaultValue':function(){return _0x1339('0x8');}},'notificationSound':{'type':Sequelize[_0x1339('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1339('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1339('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1339('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1339('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1339('0x9')],'defaultValue':![],'comment':_0x1339('0xb'),'set':function(_0x1caf18){if(!_0x1caf18){this[_0x1339('0xc')](_0x1339('0xd'),null);}this[_0x1339('0xc')](_0x1339('0xe'),_0x1caf18);}},'description':{'type':Sequelize[_0x1339('0x3')]}}; \ No newline at end of file +var _0xc346=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x2f5665,_0x311ba8){var _0x5027c8=function(_0x72a2f3){while(--_0x72a2f3){_0x2f5665['push'](_0x2f5665['shift']());}};_0x5027c8(++_0x311ba8);}(_0xc346,0x1b8));var _0x6c34=function(_0x5b309e,_0x182513){_0x5b309e=_0x5b309e-0x0;var _0xef06a5=_0xc346[_0x5b309e];return _0xef06a5;};'use strict';var Sequelize=require(_0x6c34('0x0'));var rs=require(_0x6c34('0x1'));module[_0x6c34('0x2')]={'name':{'type':Sequelize[_0x6c34('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x6c34('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x6c34('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6c34('0x4')]();}},'phone':{'type':Sequelize[_0x6c34('0x3')]},'type':{'type':Sequelize[_0x6c34('0x5')](_0x6c34('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6c34('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6c34('0x7');}},'notificationSound':{'type':Sequelize[_0x6c34('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6c34('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6c34('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6c34('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6c34('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6c34('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c34('0x9')],'comment':_0x6c34('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x6c34('0x8')],'defaultValue':![],'comment':_0x6c34('0xb'),'set':function(_0x102896){if(!_0x102896){this['setDataValue'](_0x6c34('0xc'),null);}this[_0x6c34('0xd')](_0x6c34('0xe'),_0x102896);}},'description':{'type':Sequelize[_0x6c34('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index e2204ba..83c34b5 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 _0xfce9=['hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','show','params','Pause','mandatoryDispositionPause','rawAttributes','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','order','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addAgents','userWhatsappAccount:save','removeAgents','isArray','emit','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','account','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','mobile','twilio','From','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','omit','from','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','to\x20is\x20mandatory','List','DESC','defaults','out','Messages','dataValues','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','WhatsappAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x2e529a,_0x16669c){var _0x595da4=function(_0x206b1f){while(--_0x206b1f){_0x2e529a['push'](_0x2e529a['shift']());}};_0x595da4(++_0x16669c);}(_0xfce9,0x139));var _0x9fce=function(_0x1c2230,_0x823fa7){_0x1c2230=_0x1c2230-0x0;var _0x454241=_0xfce9[_0x1c2230];return _0x454241;};'use strict';var pdf=require(_0x9fce('0x0'));var emlformat=require(_0x9fce('0x1'));var rimraf=require(_0x9fce('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9fce('0x3'));var moment=require(_0x9fce('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9fce('0x5'));var util=require(_0x9fce('0x6'));var path=require(_0x9fce('0x7'));var sox=require(_0x9fce('0x8'));var csv=require('to-csv');var ejs=require(_0x9fce('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9fce('0xa'));var crypto=require(_0x9fce('0xb'));var jsforce=require(_0x9fce('0xc'));var deskjs=require(_0x9fce('0xd'));var toCsv=require(_0x9fce('0xe'));var querystring=require(_0x9fce('0xf'));var Papa=require(_0x9fce('0x10'));var Redis=require(_0x9fce('0x11'));var authService=require(_0x9fce('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fce('0x13'));var logger=require(_0x9fce('0x14'))(_0x9fce('0x15'));var utils=require('../../config/utils');var config=require(_0x9fce('0x16'));var licenseUtil=require(_0x9fce('0x17'));var db=require(_0x9fce('0x18'))['db'];config[_0x9fce('0x19')]=_['defaults'](config[_0x9fce('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9fce('0x1a'))(new Redis(config[_0x9fce('0x19')]));require(_0x9fce('0x1b'))[_0x9fce('0x1c')](socket);var jayson=require(_0x9fce('0x1d'));var client=jayson[_0x9fce('0x1e')][_0x9fce('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x4ad5ef,_0x5c89ac,_0x5296c4,_0x57d05b){return new BPromise(function(_0x5b43a3,_0x2d7d1f){var _0x329ea8=_0x57d05b||client;return _0x329ea8[_0x9fce('0x20')](_0x4ad5ef,_0x5296c4)[_0x9fce('0x21')](function(_0x493514){logger[_0x9fce('0x22')](_0x9fce('0x23'),_0x5c89ac,'request\x20sent');logger[_0x9fce('0x24')](_0x9fce('0x25'),_0x5c89ac,_0x9fce('0x26'),JSON[_0x9fce('0x27')](_0x493514));if(_0x493514[_0x9fce('0x28')]){if(_0x493514[_0x9fce('0x28')][_0x9fce('0x29')]===0x1f4){logger[_0x9fce('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x5c89ac,_0x493514[_0x9fce('0x28')][_0x9fce('0x2a')]);return _0x2d7d1f(_0x493514[_0x9fce('0x28')]['message']);}logger[_0x9fce('0x28')](_0x9fce('0x23'),_0x5c89ac,_0x493514[_0x9fce('0x28')][_0x9fce('0x2a')]);return _0x5b43a3(_0x493514[_0x9fce('0x28')][_0x9fce('0x2a')]);}else{logger['info'](_0x9fce('0x23'),_0x5c89ac,_0x9fce('0x26'));_0x5b43a3(_0x493514[_0x9fce('0x2b')]['message']);}})['catch'](function(_0x5244a5){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5c89ac,_0x5244a5);_0x2d7d1f(_0x5244a5);});});}function respondWithStatusCode(_0x866607,_0x1c7de5){_0x1c7de5=_0x1c7de5||0xcc;return function(_0xbee764){if(_0xbee764){return _0x866607[_0x9fce('0x2c')](_0x1c7de5);}return _0x866607[_0x9fce('0x2d')](_0x1c7de5)[_0x9fce('0x2e')]();};}function respondWithResult(_0x2088ab,_0x17c089){_0x17c089=_0x17c089||0xc8;return function(_0x451789){if(_0x451789){return _0x2088ab[_0x9fce('0x2d')](_0x17c089)[_0x9fce('0x2f')](_0x451789);}};}function respondWithFilteredResult(_0x10a1a2,_0x3871b1){return function(_0x14808f){if(_0x14808f){var _0x51dca0=_0x14808f[_0x9fce('0x30')],_0x532d3c=_0x3871b1[_0x9fce('0x31')],_0x33e548=_0x3871b1[_0x9fce('0x31')]+_0x3871b1[_0x9fce('0x32')],_0x1d2022;if(_0x33e548>=_0x51dca0){_0x33e548=_0x51dca0;_0x1d2022=0xc8;}else{_0x1d2022=0xce;}_0x10a1a2[_0x9fce('0x2d')](_0x1d2022);return _0x10a1a2[_0x9fce('0x33')](_0x9fce('0x34'),_0x532d3c+'-'+_0x33e548+'/'+_0x51dca0)['json'](_0x14808f);}return null;};}function patchUpdates(_0x4c371d){return function(_0x1b19f3){try{jsonpatch[_0x9fce('0x35')](_0x1b19f3,_0x4c371d,!![]);}catch(_0x40149b){return BPromise[_0x9fce('0x36')](_0x40149b);}return _0x1b19f3[_0x9fce('0x37')]();};}function saveUpdates(_0x5a2bc9,_0x1ebf8c){return function(_0x1f745a){if(_0x1f745a){return _0x1f745a[_0x9fce('0x38')](_0x5a2bc9)[_0x9fce('0x21')](function(_0x55f01c){return _0x55f01c;});}return null;};}function removeEntity(_0x2ddfa4,_0x15f094){return function(_0x2c63fe){if(_0x2c63fe){return _0x2c63fe[_0x9fce('0x39')]()[_0x9fce('0x21')](function(){var _0x1fa359=_0x2c63fe['get']({'plain':!![]});var _0x51b678='WhatsappAccounts';return db['UserProfileResource'][_0x9fce('0x39')]({'where':{'type':_0x51b678,'resourceId':_0x1fa359['id']}})[_0x9fce('0x21')](function(){return _0x2c63fe;});})[_0x9fce('0x21')](function(){_0x2ddfa4[_0x9fce('0x2d')](0xcc)[_0x9fce('0x2e')]();});}};}function handleEntityNotFound(_0x5f422a,_0x232785){return function(_0x4712b5){if(!_0x4712b5){_0x5f422a[_0x9fce('0x2c')](0x194);}return _0x4712b5;};}function handleError(_0x3f5749,_0xef601f){_0xef601f=_0xef601f||0x1f4;return function(_0x5a1456){logger[_0x9fce('0x28')](_0x5a1456[_0x9fce('0x3a')]);if(_0x5a1456['name']){delete _0x5a1456[_0x9fce('0x3b')];}_0x3f5749[_0x9fce('0x2d')](_0xef601f)[_0x9fce('0x3c')](_0x5a1456);};}exports[_0x9fce('0x3d')]=function(_0x158bea,_0x108d3f){var _0xca5761={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3ff013={},_0xd1c64c={'count':0x0,'rows':[]};var _0x31541b=_['map'](db[_0x9fce('0x3e')]['rawAttributes'],function(_0x5b9755){return{'name':_0x5b9755[_0x9fce('0x3f')],'type':_0x5b9755[_0x9fce('0x40')][_0x9fce('0x41')]};});_0x3ff013[_0x9fce('0x42')]=_['map'](_0x31541b,_0x9fce('0x3b'));_0x3ff013[_0x9fce('0x43')]=_[_0x9fce('0x44')](_0x158bea['query']);_0x3ff013[_0x9fce('0x45')]=_[_0x9fce('0x46')](_0x3ff013['model'],_0x3ff013[_0x9fce('0x43')]);_0xca5761[_0x9fce('0x47')]=_[_0x9fce('0x46')](_0x3ff013['model'],qs[_0x9fce('0x48')](_0x158bea[_0x9fce('0x43')][_0x9fce('0x48')]));_0xca5761[_0x9fce('0x47')]=_0xca5761['attributes']['length']?_0xca5761[_0x9fce('0x47')]:_0x3ff013['model'];if(!_0x158bea[_0x9fce('0x43')][_0x9fce('0x49')](_0x9fce('0x4a'))){_0xca5761[_0x9fce('0x32')]=qs[_0x9fce('0x32')](_0x158bea[_0x9fce('0x43')][_0x9fce('0x32')]);_0xca5761[_0x9fce('0x31')]=qs[_0x9fce('0x31')](_0x158bea[_0x9fce('0x43')]['offset']);}_0xca5761['order']=qs['sort'](_0x158bea[_0x9fce('0x43')][_0x9fce('0x4b')]);_0xca5761['where']=qs[_0x9fce('0x45')](_[_0x9fce('0x4c')](_0x158bea[_0x9fce('0x43')],_0x3ff013[_0x9fce('0x45')]),_0x31541b);if(_0x158bea[_0x9fce('0x43')][_0x9fce('0x4d')]){_0xca5761[_0x9fce('0x4e')]=_[_0x9fce('0x4f')](_0xca5761[_0x9fce('0x4e')],{'$or':_[_0x9fce('0x50')](_0x31541b,function(_0x14fb01){if(_0x14fb01[_0x9fce('0x40')]!=='VIRTUAL'){var _0x192fb4={};_0x192fb4[_0x14fb01[_0x9fce('0x3b')]]={'$like':'%'+_0x158bea['query'][_0x9fce('0x4d')]+'%'};return _0x192fb4;}})});}_0xca5761=_[_0x9fce('0x4f')]({},_0xca5761,_0x158bea[_0x9fce('0x51')]);var _0x44653a={'where':_0xca5761[_0x9fce('0x4e')]};return db[_0x9fce('0x3e')][_0x9fce('0x30')](_0x44653a)[_0x9fce('0x21')](function(_0x464451){_0xd1c64c[_0x9fce('0x30')]=_0x464451;if(_0x158bea[_0x9fce('0x43')][_0x9fce('0x52')]){_0xca5761[_0x9fce('0x53')]=[{'all':!![]}];}return db[_0x9fce('0x3e')][_0x9fce('0x54')](_0xca5761);})[_0x9fce('0x21')](function(_0x2cd4c1){_0xd1c64c[_0x9fce('0x55')]=_0x2cd4c1;return _0xd1c64c;})[_0x9fce('0x21')](respondWithFilteredResult(_0x108d3f,_0xca5761))[_0x9fce('0x56')](handleError(_0x108d3f,null));};exports[_0x9fce('0x57')]=function(_0x3fa06f,_0x509a98){var _0xff1712={'raw':![],'where':{'id':_0x3fa06f[_0x9fce('0x58')]['id']},'include':[{'model':db[_0x9fce('0x59')],'as':_0x9fce('0x5a')}]},_0x46e574={};_0x46e574[_0x9fce('0x42')]=_['keys'](db[_0x9fce('0x3e')][_0x9fce('0x5b')]);_0x46e574['query']=_['keys'](_0x3fa06f['query']);_0x46e574[_0x9fce('0x45')]=_[_0x9fce('0x46')](_0x46e574[_0x9fce('0x42')],_0x46e574[_0x9fce('0x43')]);_0xff1712[_0x9fce('0x47')]=_[_0x9fce('0x46')](_0x46e574[_0x9fce('0x42')],qs['fields'](_0x3fa06f['query']['fields']));_0xff1712['attributes']=_0xff1712[_0x9fce('0x47')][_0x9fce('0x5c')]?_0xff1712['attributes']:_0x46e574[_0x9fce('0x42')];if(_0x3fa06f[_0x9fce('0x43')]['includeAll']){_0xff1712[_0x9fce('0x53')]=[{'all':!![]}];}_0xff1712=_[_0x9fce('0x4f')]({},_0xff1712,_0x3fa06f[_0x9fce('0x51')]);return db[_0x9fce('0x3e')]['find'](_0xff1712)[_0x9fce('0x21')](handleEntityNotFound(_0x509a98,null))[_0x9fce('0x21')](respondWithResult(_0x509a98,null))[_0x9fce('0x56')](handleError(_0x509a98,null));};exports['create']=function(_0x331304,_0x118ed0){return db[_0x9fce('0x3e')][_0x9fce('0x5d')](_0x331304[_0x9fce('0x5e')],{})['then'](function(_0xc876f){var _0x263732=_0x331304[_0x9fce('0x5f')][_0x9fce('0x60')]({'plain':!![]});if(!_0x263732)throw new Error(_0x9fce('0x61'));if(_0x263732[_0x9fce('0x62')]===_0x9fce('0x5f')){var _0x1d1033=_0xc876f['get']({'plain':!![]});var _0x4b1df8=_0x9fce('0x63');return db[_0x9fce('0x64')][_0x9fce('0x65')]({'where':{'name':_0x4b1df8,'userProfileId':_0x263732[_0x9fce('0x66')]},'raw':!![]})[_0x9fce('0x21')](function(_0x1169ab){if(_0x1169ab&&_0x1169ab[_0x9fce('0x67')]===0x0){return db[_0x9fce('0x68')][_0x9fce('0x5d')]({'name':_0x1d1033[_0x9fce('0x3b')],'resourceId':_0x1d1033['id'],'type':_0x1169ab['name'],'sectionId':_0x1169ab['id']},{})[_0x9fce('0x21')](function(){return _0xc876f;});}else{return _0xc876f;}})[_0x9fce('0x56')](function(_0x651558){logger[_0x9fce('0x28')](_0x9fce('0x69'),_0x651558);throw _0x651558;});}return _0xc876f;})[_0x9fce('0x21')](respondWithResult(_0x118ed0,0xc9))[_0x9fce('0x56')](handleError(_0x118ed0,null));};exports[_0x9fce('0x38')]=function(_0x3b9d22,_0x4dca68){if(_0x3b9d22[_0x9fce('0x5e')]['id']){delete _0x3b9d22['body']['id'];}return db[_0x9fce('0x3e')][_0x9fce('0x65')]({'where':{'id':_0x3b9d22[_0x9fce('0x58')]['id']},'include':[{'model':db[_0x9fce('0x59')],'as':_0x9fce('0x5a')}]})[_0x9fce('0x21')](handleEntityNotFound(_0x4dca68,null))[_0x9fce('0x21')](saveUpdates(_0x3b9d22[_0x9fce('0x5e')],null))['then'](respondWithResult(_0x4dca68,null))['catch'](handleError(_0x4dca68,null));};exports[_0x9fce('0x39')]=function(_0x487f32,_0x4cf78d){return db[_0x9fce('0x3e')]['find']({'where':{'id':_0x487f32[_0x9fce('0x58')]['id']}})['then'](handleEntityNotFound(_0x4cf78d,null))[_0x9fce('0x21')](removeEntity(_0x4cf78d,null))[_0x9fce('0x56')](handleError(_0x4cf78d,null));};exports[_0x9fce('0x6a')]=function(_0x189a0e,_0x3d1b15){return db['WhatsappAccount'][_0x9fce('0x6a')]()['then'](respondWithResult(_0x3d1b15,null))[_0x9fce('0x56')](handleError(_0x3d1b15,null));};exports[_0x9fce('0x6b')]=function(_0x4afdca,_0x342e76,_0x247a80){if(_0x4afdca['body']['id']){delete _0x4afdca[_0x9fce('0x5e')]['id'];}return db[_0x9fce('0x3e')][_0x9fce('0x65')]({'where':{'id':_0x4afdca[_0x9fce('0x58')]['id']}})[_0x9fce('0x21')](handleEntityNotFound(_0x342e76,null))['then'](function(_0x324216){if(_0x324216){_0x4afdca['body'][_0x9fce('0x6c')]=_0x324216['id'];return db[_0x9fce('0x6d')][_0x9fce('0x5d')](_0x4afdca[_0x9fce('0x5e')]);}})[_0x9fce('0x21')](respondWithResult(_0x342e76,null))[_0x9fce('0x56')](handleError(_0x342e76,null));};exports[_0x9fce('0x6e')]=function(_0x5abe9a,_0x8bebf5,_0x4d1cf7){var _0x549e25={'raw':![],'where':{}};var _0x3937a4={};var _0x1764e1={'count':0x0,'rows':[]};return db[_0x9fce('0x3e')]['findOne']({'where':{'id':_0x5abe9a[_0x9fce('0x58')]['id']}})['then'](handleEntityNotFound(_0x8bebf5,null))[_0x9fce('0x21')](function(_0x38ab63){if(_0x38ab63){_0x3937a4['model']=_[_0x9fce('0x44')](db[_0x9fce('0x6d')][_0x9fce('0x5b')]);_0x3937a4[_0x9fce('0x43')]=_['keys'](_0x5abe9a[_0x9fce('0x43')]);_0x3937a4[_0x9fce('0x45')]=_['intersection'](_0x3937a4[_0x9fce('0x42')],_0x3937a4[_0x9fce('0x43')]);_0x549e25[_0x9fce('0x47')]=_['intersection'](_0x3937a4[_0x9fce('0x42')],qs['fields'](_0x5abe9a[_0x9fce('0x43')][_0x9fce('0x48')]));_0x549e25[_0x9fce('0x47')]=_0x549e25[_0x9fce('0x47')]['length']?_0x549e25['attributes']:_0x3937a4['model'];if(!_0x5abe9a['query'][_0x9fce('0x49')](_0x9fce('0x4a'))){_0x549e25[_0x9fce('0x32')]=qs['limit'](_0x5abe9a[_0x9fce('0x43')][_0x9fce('0x32')]);_0x549e25[_0x9fce('0x31')]=qs[_0x9fce('0x31')](_0x5abe9a[_0x9fce('0x43')]['offset']);}_0x549e25[_0x9fce('0x6f')]=qs[_0x9fce('0x4b')](_0x5abe9a[_0x9fce('0x43')][_0x9fce('0x4b')]);_0x549e25[_0x9fce('0x4e')]=qs[_0x9fce('0x45')](_[_0x9fce('0x4c')](_0x5abe9a[_0x9fce('0x43')],_0x3937a4[_0x9fce('0x45')]));_0x549e25[_0x9fce('0x4e')]['WhatsappAccountId']=_0x38ab63['id'];if(_0x5abe9a[_0x9fce('0x43')][_0x9fce('0x4d')]){_0x549e25['where']=_[_0x9fce('0x4f')](_0x549e25[_0x9fce('0x4e')],{'$or':_['map'](_0x549e25['attributes'],function(_0x1a376a){var _0x700658={};_0x700658[_0x1a376a]={'$like':'%'+_0x5abe9a[_0x9fce('0x43')][_0x9fce('0x4d')]+'%'};return _0x700658;})});}_0x549e25=_[_0x9fce('0x4f')]({},_0x549e25,_0x5abe9a[_0x9fce('0x51')]);return db[_0x9fce('0x6d')]['count']({'where':_0x549e25[_0x9fce('0x4e')]})[_0x9fce('0x21')](function(_0xf27e03){_0x1764e1[_0x9fce('0x30')]=_0xf27e03;if(_0x5abe9a[_0x9fce('0x43')][_0x9fce('0x52')]){_0x549e25[_0x9fce('0x53')]=[{'all':!![]}];}return db[_0x9fce('0x6d')][_0x9fce('0x54')](_0x549e25);})[_0x9fce('0x21')](function(_0x36fe9b){_0x1764e1[_0x9fce('0x55')]=_0x36fe9b;return _0x1764e1;});}})['then'](respondWithFilteredResult(_0x8bebf5,_0x549e25))[_0x9fce('0x56')](handleError(_0x8bebf5,null));};exports[_0x9fce('0x70')]=function(_0x4b340b,_0x1ae0e3,_0x3bf400){return db[_0x9fce('0x3e')]['find']({'where':{'id':_0x4b340b['params']['id']}})[_0x9fce('0x21')](handleEntityNotFound(_0x1ae0e3,null))['then'](function(_0x532140){if(_0x532140){return _0x532140[_0x9fce('0x70')](_0x4b340b['query'][_0x9fce('0x71')]);}})[_0x9fce('0x21')](respondWithStatusCode(_0x1ae0e3,null))['catch'](handleError(_0x1ae0e3,null));};exports[_0x9fce('0x72')]=function(_0x53a028,_0x505d90,_0x46fe15){if(_0x53a028[_0x9fce('0x5e')]['id']){delete _0x53a028[_0x9fce('0x5e')]['id'];}return db['WhatsappAccount'][_0x9fce('0x65')]({'where':{'id':_0x53a028[_0x9fce('0x58')]['id']}})[_0x9fce('0x21')](handleEntityNotFound(_0x505d90,null))[_0x9fce('0x21')](function(_0x49831a){if(_0x49831a){_0x53a028['body'][_0x9fce('0x6c')]=_0x49831a['id'];return db['CannedAnswer'][_0x9fce('0x5d')](_0x53a028[_0x9fce('0x5e')]);}})[_0x9fce('0x21')](respondWithResult(_0x505d90,null))[_0x9fce('0x56')](handleError(_0x505d90,null));};exports[_0x9fce('0x73')]=function(_0x2a1a24,_0x3b6666,_0x3c910f){var _0x3d250b={'raw':![],'where':{}};var _0x385ebe={};var _0x5be0c6={'count':0x0,'rows':[]};return db[_0x9fce('0x3e')][_0x9fce('0x74')]({'where':{'id':_0x2a1a24[_0x9fce('0x58')]['id']}})['then'](handleEntityNotFound(_0x3b6666,null))[_0x9fce('0x21')](function(_0x3ac196){if(_0x3ac196){_0x385ebe[_0x9fce('0x42')]=_[_0x9fce('0x44')](db[_0x9fce('0x75')][_0x9fce('0x5b')]);_0x385ebe[_0x9fce('0x43')]=_['keys'](_0x2a1a24['query']);_0x385ebe[_0x9fce('0x45')]=_[_0x9fce('0x46')](_0x385ebe[_0x9fce('0x42')],_0x385ebe[_0x9fce('0x43')]);_0x3d250b[_0x9fce('0x47')]=_['intersection'](_0x385ebe[_0x9fce('0x42')],qs['fields'](_0x2a1a24['query']['fields']));_0x3d250b[_0x9fce('0x47')]=_0x3d250b['attributes'][_0x9fce('0x5c')]?_0x3d250b['attributes']:_0x385ebe[_0x9fce('0x42')];if(!_0x2a1a24[_0x9fce('0x43')][_0x9fce('0x49')]('nolimit')){_0x3d250b[_0x9fce('0x32')]=qs[_0x9fce('0x32')](_0x2a1a24[_0x9fce('0x43')][_0x9fce('0x32')]);_0x3d250b['offset']=qs[_0x9fce('0x31')](_0x2a1a24[_0x9fce('0x43')][_0x9fce('0x31')]);}_0x3d250b[_0x9fce('0x6f')]=qs[_0x9fce('0x4b')](_0x2a1a24[_0x9fce('0x43')]['sort']);_0x3d250b[_0x9fce('0x4e')]=qs['filters'](_[_0x9fce('0x4c')](_0x2a1a24[_0x9fce('0x43')],_0x385ebe[_0x9fce('0x45')]));_0x3d250b[_0x9fce('0x4e')][_0x9fce('0x6c')]=_0x3ac196['id'];if(_0x2a1a24[_0x9fce('0x43')][_0x9fce('0x4d')]){_0x3d250b[_0x9fce('0x4e')]=_['merge'](_0x3d250b[_0x9fce('0x4e')],{'$or':_['map'](_0x3d250b['attributes'],function(_0x510e77){var _0x5e23dd={};_0x5e23dd[_0x510e77]={'$like':'%'+_0x2a1a24[_0x9fce('0x43')][_0x9fce('0x4d')]+'%'};return _0x5e23dd;})});}_0x3d250b=_[_0x9fce('0x4f')]({},_0x3d250b,_0x2a1a24[_0x9fce('0x51')]);return db[_0x9fce('0x75')][_0x9fce('0x30')]({'where':_0x3d250b[_0x9fce('0x4e')]})[_0x9fce('0x21')](function(_0xde94b3){_0x5be0c6[_0x9fce('0x30')]=_0xde94b3;if(_0x2a1a24[_0x9fce('0x43')]['includeAll']){_0x3d250b[_0x9fce('0x53')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3d250b);})['then'](function(_0xee27bb){_0x5be0c6[_0x9fce('0x55')]=_0xee27bb;return _0x5be0c6;});}})[_0x9fce('0x21')](respondWithFilteredResult(_0x3b6666,_0x3d250b))['catch'](handleError(_0x3b6666,null));};exports[_0x9fce('0x76')]=function(_0x9920c8,_0x1ab77f,_0x23a86f){return db['WhatsappAccount'][_0x9fce('0x65')]({'where':{'id':_0x9920c8[_0x9fce('0x58')]['id']}})[_0x9fce('0x21')](handleEntityNotFound(_0x1ab77f,null))[_0x9fce('0x21')](function(_0x58f27d){if(_0x58f27d){return _0x58f27d['removeAnswers'](_0x9920c8['query'][_0x9fce('0x71')]);}})[_0x9fce('0x21')](respondWithStatusCode(_0x1ab77f,null))[_0x9fce('0x56')](handleError(_0x1ab77f,null));};exports[_0x9fce('0x77')]=function(_0x446b27,_0x2116d1,_0x4354cc){return db[_0x9fce('0x3e')]['find']({'where':{'id':_0x446b27[_0x9fce('0x58')]['id']}})[_0x9fce('0x21')](handleEntityNotFound(_0x2116d1,null))[_0x9fce('0x21')](function(_0x51fc02){if(_0x51fc02){return _0x51fc02[_0x9fce('0x77')](_0x446b27[_0x9fce('0x5e')][_0x9fce('0x71')],_['omit'](_0x446b27[_0x9fce('0x5e')],[_0x9fce('0x71'),'id'])||{})['spread'](function(_0x46e40d){for(var _0x193bc9=0x0;_0x193bc9<_0x446b27[_0x9fce('0x5e')][_0x9fce('0x71')][_0x9fce('0x5c')];_0x193bc9+=0x1){socket['emit'](_0x9fce('0x78'),{'UserId':_0x446b27['body'][_0x9fce('0x71')][_0x193bc9],'WhatsappAccountId':_0x446b27[_0x9fce('0x58')]['id']});}return _0x46e40d;});}})[_0x9fce('0x21')](respondWithResult(_0x2116d1,null))[_0x9fce('0x56')](handleError(_0x2116d1,null));};exports[_0x9fce('0x79')]=function(_0x5d8224,_0x37eaa6,_0x53e445){return db[_0x9fce('0x3e')]['find']({'where':{'id':_0x5d8224[_0x9fce('0x58')]['id']}})['then'](handleEntityNotFound(_0x37eaa6,null))[_0x9fce('0x21')](function(_0x21a2c2){if(_0x21a2c2){return _0x21a2c2[_0x9fce('0x79')](_0x5d8224['query'][_0x9fce('0x71')])[_0x9fce('0x21')](function(){if(_[_0x9fce('0x7a')](_0x5d8224[_0x9fce('0x43')][_0x9fce('0x71')])){for(var _0x487205=0x0;_0x487205<_0x5d8224[_0x9fce('0x43')][_0x9fce('0x71')]['length'];_0x487205+=0x1){socket[_0x9fce('0x7b')]('userWhatsappAccount:remove',{'UserId':Number(_0x5d8224[_0x9fce('0x43')]['ids'][_0x487205]),'WhatsappAccountId':Number(_0x5d8224[_0x9fce('0x58')]['id'])});}}else{socket[_0x9fce('0x7b')]('userWhatsappAccount:remove',{'UserId':Number(_0x5d8224[_0x9fce('0x43')]['ids']),'WhatsappAccountId':Number(_0x5d8224[_0x9fce('0x58')]['id'])});}});}})[_0x9fce('0x21')](respondWithStatusCode(_0x37eaa6,null))[_0x9fce('0x56')](handleError(_0x37eaa6,null));};exports[_0x9fce('0x7c')]=function(_0x461cc3,_0x56d561,_0x47399b){var _0x555be5={};var _0x322d2a={};var _0x6eef9b;var _0x5015de;return db[_0x9fce('0x3e')]['findOne']({'where':{'id':_0x461cc3[_0x9fce('0x58')]['id']}})[_0x9fce('0x21')](handleEntityNotFound(_0x56d561,null))[_0x9fce('0x21')](function(_0x225ba8){if(_0x225ba8){_0x6eef9b=_0x225ba8;_0x322d2a[_0x9fce('0x42')]=_['keys'](db['User'][_0x9fce('0x5b')]);_0x322d2a[_0x9fce('0x43')]=_['keys'](_0x461cc3[_0x9fce('0x43')]);_0x322d2a['filters']=_[_0x9fce('0x46')](_0x322d2a[_0x9fce('0x42')],_0x322d2a[_0x9fce('0x43')]);_0x555be5[_0x9fce('0x47')]=_[_0x9fce('0x46')](_0x322d2a[_0x9fce('0x42')],qs[_0x9fce('0x48')](_0x461cc3[_0x9fce('0x43')][_0x9fce('0x48')]));_0x555be5['attributes']=_0x555be5[_0x9fce('0x47')][_0x9fce('0x5c')]?_0x555be5[_0x9fce('0x47')]:_0x322d2a[_0x9fce('0x42')];_0x555be5[_0x9fce('0x6f')]=qs[_0x9fce('0x4b')](_0x461cc3[_0x9fce('0x43')][_0x9fce('0x4b')]);_0x555be5[_0x9fce('0x4e')]=qs['filters'](_[_0x9fce('0x4c')](_0x461cc3['query'],_0x322d2a[_0x9fce('0x45')]));if(_0x461cc3['query'][_0x9fce('0x4d')]){_0x555be5[_0x9fce('0x4e')]=_['merge'](_0x555be5[_0x9fce('0x4e')],{'$or':_[_0x9fce('0x50')](_0x555be5[_0x9fce('0x47')],function(_0x4769ac){var _0x51098f={};_0x51098f[_0x4769ac]={'$like':'%'+_0x461cc3[_0x9fce('0x43')][_0x9fce('0x4d')]+'%'};return _0x51098f;})});}_0x555be5=_[_0x9fce('0x4f')]({},_0x555be5,_0x461cc3[_0x9fce('0x51')]);return _0x6eef9b[_0x9fce('0x7c')](_0x555be5);}})[_0x9fce('0x21')](function(_0x4e12ac){if(_0x4e12ac){_0x5015de=_0x4e12ac['length'];if(!_0x461cc3['query'][_0x9fce('0x49')]('nolimit')){_0x555be5[_0x9fce('0x32')]=qs[_0x9fce('0x32')](_0x461cc3[_0x9fce('0x43')][_0x9fce('0x32')]);_0x555be5[_0x9fce('0x31')]=qs[_0x9fce('0x31')](_0x461cc3['query']['offset']);}return _0x6eef9b['getAgents'](_0x555be5);}})['then'](function(_0x3a56a9){if(_0x3a56a9){return _0x3a56a9?{'count':_0x5015de,'rows':_0x3a56a9}:null;}})[_0x9fce('0x21')](respondWithResult(_0x56d561,null))[_0x9fce('0x56')](handleError(_0x56d561,null));};exports[_0x9fce('0x7d')]=function(_0x48cb1e,_0x262569,_0x28f5b1){return db[_0x9fce('0x3e')][_0x9fce('0x74')]({'where':{'id':_0x48cb1e['params']['id']}})[_0x9fce('0x21')](handleEntityNotFound(_0x262569,null))[_0x9fce('0x21')](function(_0x4b755f){if(_0x4b755f){return db[_0x9fce('0x7e')][_0x9fce('0x7f')](function(_0x3b2128){return db[_0x9fce('0x80')][_0x9fce('0x39')]({'where':{'WhatsappAccountId':_0x48cb1e[_0x9fce('0x58')]['id']},'transaction':_0x3b2128})[_0x9fce('0x21')](function(_0x4ceacc){var _0x4f1947=_['map'](_0x48cb1e[_0x9fce('0x5e')],function(_0x3b43b1){_0x3b43b1[_0x9fce('0x6c')]=_0x48cb1e[_0x9fce('0x58')]['id'];return _0x3b43b1;});return db['WhatsappApplication']['bulkCreate'](_0x4f1947,{'transaction':_0x3b2128});});})[_0x9fce('0x21')](function(){return db[_0x9fce('0x80')][_0x9fce('0x81')]({'where':{'WhatsappAccountId':_0x48cb1e[_0x9fce('0x58')]['id']},'order':_0x9fce('0x82')});});}})[_0x9fce('0x21')](respondWithResult(_0x262569,null))['catch'](handleError(_0x262569,null));};exports[_0x9fce('0x83')]=function(_0x201ac5,_0x1e9489,_0xc3d95c){var _0x1d374a={};var _0x1b3498={};var _0x1dbc5b;var _0x32a0f8;return db[_0x9fce('0x3e')][_0x9fce('0x74')]({'where':{'id':_0x201ac5['params']['id']}})[_0x9fce('0x21')](handleEntityNotFound(_0x1e9489,null))['then'](function(_0x4992ec){if(_0x4992ec){_0x1dbc5b=_0x4992ec;_0x1b3498[_0x9fce('0x42')]=_[_0x9fce('0x44')](db[_0x9fce('0x80')][_0x9fce('0x5b')]);_0x1b3498[_0x9fce('0x43')]=_[_0x9fce('0x44')](_0x201ac5[_0x9fce('0x43')]);_0x1b3498[_0x9fce('0x45')]=_[_0x9fce('0x46')](_0x1b3498[_0x9fce('0x42')],_0x1b3498[_0x9fce('0x43')]);_0x1d374a[_0x9fce('0x47')]=_['intersection'](_0x1b3498['model'],qs[_0x9fce('0x48')](_0x201ac5['query'][_0x9fce('0x48')]));_0x1d374a[_0x9fce('0x47')]=_0x1d374a[_0x9fce('0x47')][_0x9fce('0x5c')]?_0x1d374a['attributes']:_0x1b3498[_0x9fce('0x42')];_0x1d374a[_0x9fce('0x6f')]=qs[_0x9fce('0x4b')](_0x201ac5[_0x9fce('0x43')][_0x9fce('0x4b')]);_0x1d374a[_0x9fce('0x4e')]=qs['filters'](_[_0x9fce('0x4c')](_0x201ac5[_0x9fce('0x43')],_0x1b3498[_0x9fce('0x45')]));if(_0x201ac5['query'][_0x9fce('0x4d')]){_0x1d374a[_0x9fce('0x4e')]=_[_0x9fce('0x4f')](_0x1d374a[_0x9fce('0x4e')],{'$or':_[_0x9fce('0x50')](_0x1d374a[_0x9fce('0x47')],function(_0x3cd1c4){var _0x5adb86={};_0x5adb86[_0x3cd1c4]={'$like':'%'+_0x201ac5[_0x9fce('0x43')][_0x9fce('0x4d')]+'%'};return _0x5adb86;})});}_0x1d374a=_[_0x9fce('0x4f')]({},_0x1d374a,_0x201ac5[_0x9fce('0x51')]);return _0x1dbc5b[_0x9fce('0x83')](_0x1d374a);}})['then'](function(_0x37817b){if(_0x37817b){_0x32a0f8=_0x37817b['length'];if(!_0x201ac5[_0x9fce('0x43')]['hasOwnProperty'](_0x9fce('0x4a'))){_0x1d374a['limit']=qs[_0x9fce('0x32')](_0x201ac5[_0x9fce('0x43')][_0x9fce('0x32')]);_0x1d374a['offset']=qs[_0x9fce('0x31')](_0x201ac5['query'][_0x9fce('0x31')]);}return _0x1dbc5b['getApplications'](_0x1d374a);}})[_0x9fce('0x21')](function(_0x2505fa){if(_0x2505fa){return _0x2505fa?{'count':_0x32a0f8,'rows':_0x2505fa}:null;}})['then'](respondWithResult(_0x1e9489,null))['catch'](handleError(_0x1e9489,null));};exports[_0x9fce('0x84')]=function(_0x48ea1d,_0x19d665,_0x2372b4){var _0x10d4d2={'channel':_0x9fce('0x85')};var _0x49382f=[];var _0x2a2e3f=[];var _0x5ca934={};return db[_0x9fce('0x3e')][_0x9fce('0x65')]({'where':{'id':_0x48ea1d[_0x9fce('0x58')]['id']},'include':[{'model':db[_0x9fce('0x80')],'as':'Applications'}]})[_0x9fce('0x21')](handleEntityNotFound(_0x19d665,null))[_0x9fce('0x21')](function(_0x1b3aef){_0x10d4d2[_0x9fce('0x86')]=_0x1b3aef;_0x10d4d2[_0x9fce('0x87')]=_[_0x9fce('0x88')](_0x1b3aef[_0x9fce('0x89')],[_0x9fce('0x82')],[_0x9fce('0x8a')]);if(_0x10d4d2[_0x9fce('0x86')][_0x9fce('0x89')]){delete _0x10d4d2['account']['Applications'];}return db[_0x9fce('0x8b')]['describe']();})['then'](function(_0x34718f){if(!_0x34718f){throw new db[(_0x9fce('0x8c'))][(_0x9fce('0x8d'))]('no\x20available\x20attributes');}_0x49382f=_[_0x9fce('0x8e')](_[_0x9fce('0x44')](_0x34718f),[_0x9fce('0x8f'),'updatedAt']);_0x2a2e3f=_[_0x9fce('0x8e')](_['keys'](_0x34718f),[_0x9fce('0x8f'),_0x9fce('0x90'),_0x9fce('0x91'),'ListId']);_0x10d4d2[_0x9fce('0x5e')]={'mapKey':_0x9fce('0x92')};if(_0x10d4d2[_0x9fce('0x86')][_0x9fce('0x40')]&&_0x10d4d2['account'][_0x9fce('0x40')]===_0x9fce('0x93')){_0x10d4d2[_0x9fce('0x5e')]['from']=_0x48ea1d[_0x9fce('0x5e')][_0x9fce('0x94')]['replace'](_0x9fce('0x95'),'');_0x10d4d2[_0x9fce('0x5e')]['body']=_0x48ea1d[_0x9fce('0x5e')][_0x9fce('0x96')];_0x10d4d2[_0x9fce('0x5e')][_0x9fce('0x97')]=_0x48ea1d[_0x9fce('0x5e')][_0x9fce('0x98')];}if(_0x10d4d2[_0x9fce('0x5e')]['id']){delete _0x10d4d2[_0x9fce('0x5e')]['id'];}if(_[_0x9fce('0x99')](_0x10d4d2[_0x9fce('0x5e')]['from'])){throw new db[(_0x9fce('0x8c'))]['ValidationError'](_0x9fce('0x9a'));}if(_[_0x9fce('0x99')](_0x10d4d2[_0x9fce('0x5e')]['body'])||_0x10d4d2[_0x9fce('0x5e')][_0x9fce('0x5e')]===''){throw new db[(_0x9fce('0x8c'))][(_0x9fce('0x8d'))](_0x9fce('0x9b'));}if(_[_0x9fce('0x99')](_0x10d4d2[_0x9fce('0x5e')][_0x9fce('0x9c')])){throw new db[(_0x9fce('0x8c'))][(_0x9fce('0x8d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a2e3f);}if(!_[_0x9fce('0x9d')](_0x2a2e3f,_0x10d4d2[_0x9fce('0x5e')][_0x9fce('0x9c')])){throw new db[(_0x9fce('0x8c'))][(_0x9fce('0x8d'))](_0x9fce('0x9e')+_0x2a2e3f);}_0x5ca934[_0x10d4d2['body'][_0x9fce('0x9c')]]=_0x10d4d2['body']['from'];return db[_0x9fce('0x9f')][_0x9fce('0x65')]({'where':{'id':_0x10d4d2[_0x9fce('0x86')][_0x9fce('0xa0')]},'include':[{'model':db['CmContact'],'as':_0x9fce('0xa1'),'where':_0x5ca934,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x19d665,null))[_0x9fce('0x21')](function(_0x5b71f6){if(_0x5b71f6){_0x10d4d2[_0x9fce('0xa2')]=_[_0x9fce('0xa3')](_0x5b71f6,[_0x9fce('0xa1')]);if(_0x5b71f6[_0x9fce('0xa1')][_0x9fce('0x5c')]){return _0x5b71f6[_0x9fce('0xa1')][0x0];}var _0x25080c=_['defaults'](_0x10d4d2[_0x9fce('0x5e')],{'firstName':_0x10d4d2['body'][_0x9fce('0xa4')],'ListId':_0x5b71f6['id']});_0x25080c[_0x10d4d2['body'][_0x9fce('0x9c')]]=_0x10d4d2['body'][_0x9fce('0xa4')];return db[_0x9fce('0x8b')][_0x9fce('0x5d')](_0x25080c,{'fields':_0x49382f,'raw':!![]});}})[_0x9fce('0x21')](handleEntityNotFound(_0x19d665,null))['then'](function(_0x44ef5d){if(_0x44ef5d){_0x10d4d2[_0x9fce('0xa5')]=_0x44ef5d;var _0x3054be={'ContactId':_0x44ef5d['id'],'phone':_0x10d4d2[_0x9fce('0x5e')][_0x9fce('0xa4')],'WhatsappAccountId':_0x48ea1d['params']['id']};var _0x472963={'ContactId':_0x44ef5d['id'],'WhatsappAccountId':_0x48ea1d['params']['id'],'closed':![]};return db[_0x9fce('0xa6')][_0x9fce('0x65')]({'where':_0x472963})[_0x9fce('0x21')](function(_0x4d50f3){if(_0x4d50f3){return[_0x4d50f3,![]];}return db[_0x9fce('0xa6')]['create'](_0x3054be)[_0x9fce('0x21')](function(_0x41472c){return[_0x41472c,!![]];});});}})[_0x9fce('0xa7')](function(_0x53842a,_0x2ec99e){_0x10d4d2[_0x9fce('0xa8')]=_0x53842a['get']({'plain':!![]});_0x10d4d2[_0x9fce('0xa8')][_0x9fce('0xa9')]=![];if(_0x2ec99e){if(_0x10d4d2[_0x9fce('0x86')][_0x9fce('0xaa')]){_0x10d4d2[_0x9fce('0x87')][_0x9fce('0xab')]({'id':0x0,'priority':_0x10d4d2[_0x9fce('0x87')][_0x9fce('0x5c')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x9fce('0xac')});}_0x10d4d2['interaction']['created']=!![];}return db[_0x9fce('0xad')][_0x9fce('0x5d')]({'phone':_0x10d4d2['body'][_0x9fce('0xa4')],'messageId':_0x10d4d2['body']['messageId'],'body':_0x10d4d2[_0x9fce('0x5e')][_0x9fce('0x5e')],'WhatsappAccountId':_0x48ea1d[_0x9fce('0x58')]['id'],'WhatsappInteractionId':_0x53842a['id'],'direction':'in','ContactId':_0x53842a[_0x9fce('0xae')],'AttachmentId':_0x10d4d2[_0x9fce('0x5e')][_0x9fce('0xaf')]});})[_0x9fce('0x21')](function(_0x4ff3d3){_0x10d4d2['message']=_0x4ff3d3;if(_0x10d4d2[_0x9fce('0xa8')][_0x9fce('0xb0')]){return db['User'][_0x9fce('0x65')]({'attributes':['id',_0x9fce('0x3b')],'where':{'id':_0x10d4d2['interaction'][_0x9fce('0xb0')]}})[_0x9fce('0x21')](function(_0x43531c){if(_0x43531c){_0x10d4d2[_0x9fce('0x87')][_0x9fce('0xb1')]({'id':0x0,'priority':0x0,'app':_0x9fce('0xb2'),'appdata':_0x43531c[_0x9fce('0x3b')]+','+(_0x10d4d2['account'][_0x9fce('0xb3')]||0xa),'interval':_0x9fce('0xac')});}return respondWithRpcPromise('Start',_0x9fce('0xb4'),_0x10d4d2);});}return respondWithRpcPromise(_0x9fce('0xb5'),_0x9fce('0xb4'),_0x10d4d2);})['then'](function(_0x1dd1f0){if(_0x1dd1f0){var _0x69b913=0xc8;var _0x70e75b=_0x9fce('0xb6');logger[_0x9fce('0x22')](_0x9fce('0x25'),_0x70e75b,_0x69b913,_0x9fce('0xb7'));logger[_0x9fce('0x24')](_0x9fce('0xb8'),_0x70e75b,_0x69b913,'entity\x20found',JSON['stringify'](_0x1dd1f0));if(_0x10d4d2[_0x9fce('0x86')][_0x9fce('0x40')]===_0x9fce('0x93')){return _0x19d665['status'](_0x69b913)['set']('Content-Type',_0x9fce('0xb9'))[_0x9fce('0x3c')]('\x0a');}else{return _0x19d665['status'](_0x69b913)['json'](_0x1dd1f0);}}})[_0x9fce('0x56')](handleError(_0x19d665,null));};exports[_0x9fce('0x3c')]=function(_0x48581e,_0x580344,_0x58d380){var _0x469328,_0x4ca1fc,_0x39383c;if(_[_0x9fce('0x99')](_0x48581e[_0x9fce('0x5e')][_0x9fce('0x5e')])||_0x48581e['body'][_0x9fce('0x5e')]===''){throw new db[(_0x9fce('0x8c'))][(_0x9fce('0x8d'))](_0x9fce('0x9b'));}if(_[_0x9fce('0x99')](_0x48581e[_0x9fce('0x5e')]['to'])){throw new db['Sequelize'][(_0x9fce('0x8d'))](_0x9fce('0xba'));}_0x469328=_0x48581e[_0x9fce('0x5e')]['to'];return db[_0x9fce('0x3e')]['find']({'where':{'id':_0x48581e[_0x9fce('0x58')]['id']},'include':[{'model':db[_0x9fce('0x9f')],'as':_0x9fce('0xbb'),'include':[{'model':db[_0x9fce('0x8b')],'as':_0x9fce('0xa1'),'where':{'mobile':_0x469328},'limit':0x1,'order':[[_0x9fce('0x90'),_0x9fce('0xbc')]]}]}]})[_0x9fce('0x21')](handleEntityNotFound(_0x580344,null))[_0x9fce('0x21')](function(_0x50a1d5){if(_0x50a1d5&&_0x50a1d5['List']){_0x4ca1fc=_0x50a1d5[_0x9fce('0x60')]({'plain':!![]});if(_0x4ca1fc[_0x9fce('0xbb')]&&_0x4ca1fc[_0x9fce('0xbb')][_0x9fce('0xa1')]['length']){return _0x4ca1fc[_0x9fce('0xbb')][_0x9fce('0xa1')][0x0];}return db[_0x9fce('0x8b')][_0x9fce('0x5d')](_[_0x9fce('0xbd')](_0x48581e[_0x9fce('0x5e')],{'firstName':_0x469328,'mobile':_0x469328,'phone':_0x469328,'ListId':_0x4ca1fc[_0x9fce('0xa0')]}));}})[_0x9fce('0x21')](handleEntityNotFound(_0x580344,null))[_0x9fce('0x21')](function(_0x376702){if(_0x376702){_0x39383c=_0x376702;return db[_0x9fce('0xa6')][_0x9fce('0x65')]({'where':{'ContactId':_0x39383c['id'],'closed':![],'WhatsappAccountId':_0x4ca1fc['id']}})[_0x9fce('0x21')](function(_0x1817c1){if(_0x1817c1){return[_0x1817c1,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x48581e[_0x9fce('0x5f')]['id'],'ContactId':_0x39383c['id'],'WhatsappAccountId':_0x4ca1fc['id'],'phone':_0x469328,'firstMsgDirection':_0x9fce('0xbe'),'Messages':[_[_0x9fce('0x4f')](_0x48581e['body'],{'read':![],'body':_0x48581e['body'][_0x9fce('0x5e')],'phone':_0x469328,'WhatsappAccountId':_0x4ca1fc['id'],'UserId':_0x48581e['user']['id'],'ContactId':_0x39383c['id']})]},{'include':[{'model':db[_0x9fce('0xad')],'as':_0x9fce('0xbf')}]})[_0x9fce('0x21')](function(_0x1c62fa){return[_0x1c62fa,!![]];});});}})[_0x9fce('0xa7')](function(_0x5dd15b,_0x5d4831){if(_0x5d4831){return _0x5dd15b;}return db[_0x9fce('0xad')]['create'](_[_0x9fce('0x4f')](_0x48581e[_0x9fce('0x5e')],{'read':![],'body':_0x48581e[_0x9fce('0x5e')][_0x9fce('0x5e')],'phone':_0x469328,'WhatsappAccountId':_0x4ca1fc['id'],'WhatsappInteractionId':_0x5dd15b['id'],'UserId':_0x48581e[_0x9fce('0x5f')]['id'],'ContactId':_0x39383c['id']}))[_0x9fce('0x21')](function(_0x11cf67){_0x5dd15b['dataValues'][_0x9fce('0xbf')]=[];_0x5dd15b[_0x9fce('0xc0')][_0x9fce('0xbf')]['push'](_0x11cf67['dataValues']);return _0x5dd15b;});})[_0x9fce('0x21')](respondWithResult(_0x580344,null))[_0x9fce('0x56')](handleError(_0x580344,null));}; \ No newline at end of file +var _0x69f1=['hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','keys','fields','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','pick','filter','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','Contacts','defaults','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','waitForTheAssignedAgent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','send','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./whatsappAccount.socket','register','client','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','WhatsappAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection'];(function(_0x15c23e,_0x162305){var _0x4ed7d1=function(_0x3d65e7){while(--_0x3d65e7){_0x15c23e['push'](_0x15c23e['shift']());}};_0x4ed7d1(++_0x162305);}(_0x69f1,0x79));var _0x169f=function(_0x5d1813,_0x546944){_0x5d1813=_0x5d1813-0x0;var _0x4f6c64=_0x69f1[_0x5d1813];return _0x4f6c64;};'use strict';var pdf=require(_0x169f('0x0'));var emlformat=require(_0x169f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x169f('0x2'));var jsonpatch=require(_0x169f('0x3'));var rp=require(_0x169f('0x4'));var moment=require('moment');var BPromise=require(_0x169f('0x5'));var Mustache=require(_0x169f('0x6'));var util=require(_0x169f('0x7'));var path=require(_0x169f('0x8'));var sox=require(_0x169f('0x9'));var csv=require(_0x169f('0xa'));var ejs=require(_0x169f('0xb'));var fs=require('fs');var _=require(_0x169f('0xc'));var squel=require(_0x169f('0xd'));var crypto=require(_0x169f('0xe'));var jsforce=require(_0x169f('0xf'));var deskjs=require(_0x169f('0x10'));var toCsv=require(_0x169f('0xa'));var querystring=require(_0x169f('0x11'));var Papa=require('papaparse');var Redis=require(_0x169f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x169f('0x13'));var as=require(_0x169f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x169f('0x15'))(_0x169f('0x16'));var utils=require(_0x169f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x169f('0x18'));var db=require(_0x169f('0x19'))['db'];config[_0x169f('0x1a')]=_['defaults'](config[_0x169f('0x1a')],{'host':_0x169f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x169f('0x1a')]));require(_0x169f('0x1c'))[_0x169f('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x169f('0x1e')][_0x169f('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x376098,_0x2ad920,_0x3b5227,_0x2c6df2){return new BPromise(function(_0x494566,_0x3b09a8){var _0xe4b30f=_0x2c6df2||client;return _0xe4b30f[_0x169f('0x20')](_0x376098,_0x3b5227)[_0x169f('0x21')](function(_0x4bf484){logger[_0x169f('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x2ad920,_0x169f('0x23'));logger[_0x169f('0x24')](_0x169f('0x25'),_0x2ad920,'request\x20sent',JSON[_0x169f('0x26')](_0x4bf484));if(_0x4bf484[_0x169f('0x27')]){if(_0x4bf484[_0x169f('0x27')][_0x169f('0x28')]===0x1f4){logger[_0x169f('0x27')](_0x169f('0x29'),_0x2ad920,_0x4bf484[_0x169f('0x27')][_0x169f('0x2a')]);return _0x3b09a8(_0x4bf484[_0x169f('0x27')][_0x169f('0x2a')]);}logger[_0x169f('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x2ad920,_0x4bf484[_0x169f('0x27')][_0x169f('0x2a')]);return _0x494566(_0x4bf484[_0x169f('0x27')][_0x169f('0x2a')]);}else{logger[_0x169f('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x2ad920,_0x169f('0x23'));_0x494566(_0x4bf484[_0x169f('0x2b')]['message']);}})[_0x169f('0x2c')](function(_0x3d4eda){logger[_0x169f('0x27')](_0x169f('0x29'),_0x2ad920,_0x3d4eda);_0x3b09a8(_0x3d4eda);});});}function respondWithStatusCode(_0x2ff684,_0x256f68){_0x256f68=_0x256f68||0xcc;return function(_0x178ca5){if(_0x178ca5){return _0x2ff684[_0x169f('0x2d')](_0x256f68);}return _0x2ff684[_0x169f('0x2e')](_0x256f68)[_0x169f('0x2f')]();};}function respondWithResult(_0x49e778,_0x1ebb03){_0x1ebb03=_0x1ebb03||0xc8;return function(_0x408a94){if(_0x408a94){return _0x49e778['status'](_0x1ebb03)[_0x169f('0x30')](_0x408a94);}};}function respondWithFilteredResult(_0x3acf0c,_0x2a0e44){return function(_0x45f6c5){if(_0x45f6c5){var _0x682e43=_0x45f6c5[_0x169f('0x31')],_0x277277=_0x2a0e44['offset'],_0x492f26=_0x2a0e44[_0x169f('0x32')]+_0x2a0e44[_0x169f('0x33')],_0xe6cf0e;if(_0x492f26>=_0x682e43){_0x492f26=_0x682e43;_0xe6cf0e=0xc8;}else{_0xe6cf0e=0xce;}_0x3acf0c[_0x169f('0x2e')](_0xe6cf0e);return _0x3acf0c[_0x169f('0x34')]('Content-Range',_0x277277+'-'+_0x492f26+'/'+_0x682e43)[_0x169f('0x30')](_0x45f6c5);}return null;};}function patchUpdates(_0x524041){return function(_0x4f0761){try{jsonpatch[_0x169f('0x35')](_0x4f0761,_0x524041,!![]);}catch(_0x41d3e2){return BPromise[_0x169f('0x36')](_0x41d3e2);}return _0x4f0761[_0x169f('0x37')]();};}function saveUpdates(_0x22729e,_0x3352b9){return function(_0x18d534){if(_0x18d534){return _0x18d534[_0x169f('0x38')](_0x22729e)['then'](function(_0x154a50){return _0x154a50;});}return null;};}function removeEntity(_0x9d924e,_0x35ee8f){return function(_0x58ef11){if(_0x58ef11){return _0x58ef11[_0x169f('0x39')]()[_0x169f('0x21')](function(){var _0x3dac33=_0x58ef11['get']({'plain':!![]});var _0x25b19b=_0x169f('0x3a');return db['UserProfileResource'][_0x169f('0x39')]({'where':{'type':_0x25b19b,'resourceId':_0x3dac33['id']}})[_0x169f('0x21')](function(){return _0x58ef11;});})['then'](function(){_0x9d924e[_0x169f('0x2e')](0xcc)[_0x169f('0x2f')]();});}};}function handleEntityNotFound(_0x51ef2b,_0x48726d){return function(_0x12c575){if(!_0x12c575){_0x51ef2b[_0x169f('0x2d')](0x194);}return _0x12c575;};}function handleError(_0x4ee6e9,_0x547a55){_0x547a55=_0x547a55||0x1f4;return function(_0x42955c){logger[_0x169f('0x27')](_0x42955c[_0x169f('0x3b')]);if(_0x42955c['name']){delete _0x42955c[_0x169f('0x3c')];}_0x4ee6e9[_0x169f('0x2e')](_0x547a55)['send'](_0x42955c);};}exports[_0x169f('0x3d')]=function(_0x3b4145,_0x39b709){var _0xbffffc={'include':[{'model':db[_0x169f('0x3e')],'as':_0x169f('0x3f')}]},_0xea5ee5={},_0x416473={'count':0x0,'rows':[]};var _0x59752d=_[_0x169f('0x40')](db['WhatsappAccount'][_0x169f('0x41')],function(_0x4cc0cd){return{'name':_0x4cc0cd[_0x169f('0x42')],'type':_0x4cc0cd['type'][_0x169f('0x43')]};});_0xea5ee5[_0x169f('0x44')]=_[_0x169f('0x40')](_0x59752d,_0x169f('0x3c'));_0xea5ee5[_0x169f('0x45')]=_['keys'](_0x3b4145[_0x169f('0x45')]);_0xea5ee5[_0x169f('0x46')]=_['intersection'](_0xea5ee5['model'],_0xea5ee5[_0x169f('0x45')]);_0xbffffc[_0x169f('0x47')]=_[_0x169f('0x48')](_0xea5ee5[_0x169f('0x44')],qs['fields'](_0x3b4145[_0x169f('0x45')]['fields']));_0xbffffc['attributes']=_0xbffffc['attributes']['length']?_0xbffffc[_0x169f('0x47')]:_0xea5ee5[_0x169f('0x44')];if(!_0x3b4145['query'][_0x169f('0x49')](_0x169f('0x4a'))){_0xbffffc[_0x169f('0x33')]=qs[_0x169f('0x33')](_0x3b4145[_0x169f('0x45')][_0x169f('0x33')]);_0xbffffc[_0x169f('0x32')]=qs[_0x169f('0x32')](_0x3b4145['query']['offset']);}_0xbffffc[_0x169f('0x4b')]=qs[_0x169f('0x4c')](_0x3b4145[_0x169f('0x45')][_0x169f('0x4c')]);_0xbffffc[_0x169f('0x4d')]=qs[_0x169f('0x46')](_['pick'](_0x3b4145['query'],_0xea5ee5[_0x169f('0x46')]),_0x59752d);if(_0x3b4145['query']['filter']){_0xbffffc[_0x169f('0x4d')]=_[_0x169f('0x4e')](_0xbffffc[_0x169f('0x4d')],{'$or':_['map'](_0x59752d,function(_0x94c114){if(_0x94c114[_0x169f('0x4f')]!==_0x169f('0x50')){var _0x1e5401={};_0x1e5401[_0x94c114['name']]={'$like':'%'+_0x3b4145['query']['filter']+'%'};return _0x1e5401;}})});}_0xbffffc=_[_0x169f('0x4e')]({},_0xbffffc,_0x3b4145[_0x169f('0x51')]);var _0x5da674={'where':_0xbffffc['where']};return db[_0x169f('0x52')][_0x169f('0x31')](_0x5da674)[_0x169f('0x21')](function(_0x3dde75){_0x416473['count']=_0x3dde75;if(_0x3b4145[_0x169f('0x45')][_0x169f('0x53')]){_0xbffffc[_0x169f('0x54')]=[{'all':!![]}];}return db[_0x169f('0x52')][_0x169f('0x55')](_0xbffffc);})[_0x169f('0x21')](function(_0x2b99e0){_0x416473[_0x169f('0x56')]=_0x2b99e0;return _0x416473;})[_0x169f('0x21')](respondWithFilteredResult(_0x39b709,_0xbffffc))[_0x169f('0x2c')](handleError(_0x39b709,null));};exports[_0x169f('0x57')]=function(_0x32384d,_0xcb0cb2){var _0x3e44b8={'raw':![],'where':{'id':_0x32384d['params']['id']},'include':[{'model':db[_0x169f('0x3e')],'as':_0x169f('0x3f')}]},_0x3968ae={};_0x3968ae[_0x169f('0x44')]=_[_0x169f('0x58')](db['WhatsappAccount'][_0x169f('0x41')]);_0x3968ae[_0x169f('0x45')]=_[_0x169f('0x58')](_0x32384d[_0x169f('0x45')]);_0x3968ae['filters']=_[_0x169f('0x48')](_0x3968ae['model'],_0x3968ae['query']);_0x3e44b8['attributes']=_[_0x169f('0x48')](_0x3968ae['model'],qs[_0x169f('0x59')](_0x32384d[_0x169f('0x45')][_0x169f('0x59')]));_0x3e44b8[_0x169f('0x47')]=_0x3e44b8[_0x169f('0x47')][_0x169f('0x5a')]?_0x3e44b8['attributes']:_0x3968ae[_0x169f('0x44')];if(_0x32384d[_0x169f('0x45')]['includeAll']){_0x3e44b8[_0x169f('0x54')]=[{'all':!![]}];}_0x3e44b8=_[_0x169f('0x4e')]({},_0x3e44b8,_0x32384d[_0x169f('0x51')]);return db[_0x169f('0x52')][_0x169f('0x5b')](_0x3e44b8)[_0x169f('0x21')](handleEntityNotFound(_0xcb0cb2,null))[_0x169f('0x21')](respondWithResult(_0xcb0cb2,null))[_0x169f('0x2c')](handleError(_0xcb0cb2,null));};exports[_0x169f('0x5c')]=function(_0x27702c,_0x5aa270){return db[_0x169f('0x52')][_0x169f('0x5c')](_0x27702c['body'],{})[_0x169f('0x21')](function(_0x519249){var _0x48d38c=_0x27702c[_0x169f('0x5d')]['get']({'plain':!![]});if(!_0x48d38c)throw new Error(_0x169f('0x5e'));if(_0x48d38c[_0x169f('0x5f')]===_0x169f('0x5d')){var _0x493847=_0x519249[_0x169f('0x60')]({'plain':!![]});var _0x10e9af=_0x169f('0x3a');return db[_0x169f('0x61')][_0x169f('0x5b')]({'where':{'name':_0x10e9af,'userProfileId':_0x48d38c[_0x169f('0x62')]},'raw':!![]})[_0x169f('0x21')](function(_0x30cc6b){if(_0x30cc6b&&_0x30cc6b[_0x169f('0x63')]===0x0){return db[_0x169f('0x64')][_0x169f('0x5c')]({'name':_0x493847[_0x169f('0x3c')],'resourceId':_0x493847['id'],'type':_0x30cc6b[_0x169f('0x3c')],'sectionId':_0x30cc6b['id']},{})[_0x169f('0x21')](function(){return _0x519249;});}else{return _0x519249;}})[_0x169f('0x2c')](function(_0x3a13a0){logger['error'](_0x169f('0x65'),_0x3a13a0);throw _0x3a13a0;});}return _0x519249;})[_0x169f('0x21')](respondWithResult(_0x5aa270,0xc9))[_0x169f('0x2c')](handleError(_0x5aa270,null));};exports[_0x169f('0x38')]=function(_0x3c3f47,_0x2d69f7){if(_0x3c3f47[_0x169f('0x66')]['id']){delete _0x3c3f47['body']['id'];}return db[_0x169f('0x52')][_0x169f('0x5b')]({'where':{'id':_0x3c3f47[_0x169f('0x67')]['id']},'include':[{'model':db[_0x169f('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x169f('0x21')](handleEntityNotFound(_0x2d69f7,null))[_0x169f('0x21')](saveUpdates(_0x3c3f47[_0x169f('0x66')],null))[_0x169f('0x21')](respondWithResult(_0x2d69f7,null))[_0x169f('0x2c')](handleError(_0x2d69f7,null));};exports[_0x169f('0x39')]=function(_0xed05bf,_0x3bde8e){return db[_0x169f('0x52')][_0x169f('0x5b')]({'where':{'id':_0xed05bf[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x3bde8e,null))[_0x169f('0x21')](removeEntity(_0x3bde8e,null))['catch'](handleError(_0x3bde8e,null));};exports[_0x169f('0x68')]=function(_0x2c5271,_0x2f25e4){return db[_0x169f('0x52')][_0x169f('0x68')]()[_0x169f('0x21')](respondWithResult(_0x2f25e4,null))[_0x169f('0x2c')](handleError(_0x2f25e4,null));};exports[_0x169f('0x69')]=function(_0x1f4dfb,_0x3edf9c,_0x1b14f7){if(_0x1f4dfb[_0x169f('0x66')]['id']){delete _0x1f4dfb[_0x169f('0x66')]['id'];}return db[_0x169f('0x52')][_0x169f('0x5b')]({'where':{'id':_0x1f4dfb['params']['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x3edf9c,null))[_0x169f('0x21')](function(_0x1053fa){if(_0x1053fa){_0x1f4dfb['body'][_0x169f('0x6a')]=_0x1053fa['id'];return db[_0x169f('0x6b')][_0x169f('0x5c')](_0x1f4dfb['body']);}})[_0x169f('0x21')](respondWithResult(_0x3edf9c,null))[_0x169f('0x2c')](handleError(_0x3edf9c,null));};exports[_0x169f('0x6c')]=function(_0x1307e1,_0x14ba5c,_0xd81144){var _0x28ccce={'raw':![],'where':{}};var _0x6e4c6c={};var _0x496e40={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x169f('0x6d')]({'where':{'id':_0x1307e1[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x14ba5c,null))[_0x169f('0x21')](function(_0x2efd82){if(_0x2efd82){_0x6e4c6c[_0x169f('0x44')]=_[_0x169f('0x58')](db[_0x169f('0x6b')]['rawAttributes']);_0x6e4c6c[_0x169f('0x45')]=_[_0x169f('0x58')](_0x1307e1[_0x169f('0x45')]);_0x6e4c6c[_0x169f('0x46')]=_[_0x169f('0x48')](_0x6e4c6c[_0x169f('0x44')],_0x6e4c6c['query']);_0x28ccce['attributes']=_[_0x169f('0x48')](_0x6e4c6c['model'],qs[_0x169f('0x59')](_0x1307e1['query']['fields']));_0x28ccce[_0x169f('0x47')]=_0x28ccce[_0x169f('0x47')][_0x169f('0x5a')]?_0x28ccce[_0x169f('0x47')]:_0x6e4c6c[_0x169f('0x44')];if(!_0x1307e1[_0x169f('0x45')][_0x169f('0x49')](_0x169f('0x4a'))){_0x28ccce['limit']=qs[_0x169f('0x33')](_0x1307e1[_0x169f('0x45')][_0x169f('0x33')]);_0x28ccce['offset']=qs[_0x169f('0x32')](_0x1307e1['query']['offset']);}_0x28ccce['order']=qs[_0x169f('0x4c')](_0x1307e1[_0x169f('0x45')][_0x169f('0x4c')]);_0x28ccce[_0x169f('0x4d')]=qs[_0x169f('0x46')](_[_0x169f('0x6e')](_0x1307e1[_0x169f('0x45')],_0x6e4c6c['filters']));_0x28ccce[_0x169f('0x4d')]['WhatsappAccountId']=_0x2efd82['id'];if(_0x1307e1[_0x169f('0x45')][_0x169f('0x6f')]){_0x28ccce[_0x169f('0x4d')]=_[_0x169f('0x4e')](_0x28ccce[_0x169f('0x4d')],{'$or':_['map'](_0x28ccce[_0x169f('0x47')],function(_0x2fd4e6){var _0x400657={};_0x400657[_0x2fd4e6]={'$like':'%'+_0x1307e1[_0x169f('0x45')][_0x169f('0x6f')]+'%'};return _0x400657;})});}_0x28ccce=_['merge']({},_0x28ccce,_0x1307e1['options']);return db[_0x169f('0x6b')][_0x169f('0x31')]({'where':_0x28ccce[_0x169f('0x4d')]})[_0x169f('0x21')](function(_0x5e1c35){_0x496e40[_0x169f('0x31')]=_0x5e1c35;if(_0x1307e1['query'][_0x169f('0x53')]){_0x28ccce['include']=[{'all':!![]}];}return db['Disposition'][_0x169f('0x55')](_0x28ccce);})[_0x169f('0x21')](function(_0x11ac91){_0x496e40[_0x169f('0x56')]=_0x11ac91;return _0x496e40;});}})[_0x169f('0x21')](respondWithFilteredResult(_0x14ba5c,_0x28ccce))[_0x169f('0x2c')](handleError(_0x14ba5c,null));};exports[_0x169f('0x70')]=function(_0x18131e,_0x49258c,_0x27c7ce){return db[_0x169f('0x52')][_0x169f('0x5b')]({'where':{'id':_0x18131e[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x49258c,null))[_0x169f('0x21')](function(_0x213807){if(_0x213807){return _0x213807[_0x169f('0x70')](_0x18131e[_0x169f('0x45')][_0x169f('0x71')]);}})[_0x169f('0x21')](respondWithStatusCode(_0x49258c,null))['catch'](handleError(_0x49258c,null));};exports[_0x169f('0x72')]=function(_0x430c9f,_0x2fd8e7,_0x2f70a9){if(_0x430c9f[_0x169f('0x66')]['id']){delete _0x430c9f[_0x169f('0x66')]['id'];}return db[_0x169f('0x52')][_0x169f('0x5b')]({'where':{'id':_0x430c9f[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x2fd8e7,null))[_0x169f('0x21')](function(_0x1f2fa6){if(_0x1f2fa6){_0x430c9f[_0x169f('0x66')][_0x169f('0x6a')]=_0x1f2fa6['id'];return db['CannedAnswer']['create'](_0x430c9f['body']);}})[_0x169f('0x21')](respondWithResult(_0x2fd8e7,null))['catch'](handleError(_0x2fd8e7,null));};exports[_0x169f('0x73')]=function(_0x3cbef7,_0x46a103,_0x3bd297){var _0x3673ff={'raw':![],'where':{}};var _0x3ab6f2={};var _0x1d8694={'count':0x0,'rows':[]};return db[_0x169f('0x52')][_0x169f('0x6d')]({'where':{'id':_0x3cbef7[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x46a103,null))[_0x169f('0x21')](function(_0x4eba2a){if(_0x4eba2a){_0x3ab6f2['model']=_[_0x169f('0x58')](db['CannedAnswer'][_0x169f('0x41')]);_0x3ab6f2[_0x169f('0x45')]=_[_0x169f('0x58')](_0x3cbef7[_0x169f('0x45')]);_0x3ab6f2[_0x169f('0x46')]=_['intersection'](_0x3ab6f2[_0x169f('0x44')],_0x3ab6f2['query']);_0x3673ff['attributes']=_['intersection'](_0x3ab6f2[_0x169f('0x44')],qs[_0x169f('0x59')](_0x3cbef7['query'][_0x169f('0x59')]));_0x3673ff[_0x169f('0x47')]=_0x3673ff['attributes'][_0x169f('0x5a')]?_0x3673ff[_0x169f('0x47')]:_0x3ab6f2[_0x169f('0x44')];if(!_0x3cbef7['query'][_0x169f('0x49')]('nolimit')){_0x3673ff[_0x169f('0x33')]=qs[_0x169f('0x33')](_0x3cbef7[_0x169f('0x45')][_0x169f('0x33')]);_0x3673ff[_0x169f('0x32')]=qs[_0x169f('0x32')](_0x3cbef7[_0x169f('0x45')]['offset']);}_0x3673ff['order']=qs[_0x169f('0x4c')](_0x3cbef7[_0x169f('0x45')][_0x169f('0x4c')]);_0x3673ff[_0x169f('0x4d')]=qs['filters'](_[_0x169f('0x6e')](_0x3cbef7[_0x169f('0x45')],_0x3ab6f2['filters']));_0x3673ff['where'][_0x169f('0x6a')]=_0x4eba2a['id'];if(_0x3cbef7[_0x169f('0x45')][_0x169f('0x6f')]){_0x3673ff[_0x169f('0x4d')]=_[_0x169f('0x4e')](_0x3673ff[_0x169f('0x4d')],{'$or':_[_0x169f('0x40')](_0x3673ff[_0x169f('0x47')],function(_0x259146){var _0x4f6a6d={};_0x4f6a6d[_0x259146]={'$like':'%'+_0x3cbef7[_0x169f('0x45')][_0x169f('0x6f')]+'%'};return _0x4f6a6d;})});}_0x3673ff=_['merge']({},_0x3673ff,_0x3cbef7['options']);return db['CannedAnswer'][_0x169f('0x31')]({'where':_0x3673ff[_0x169f('0x4d')]})[_0x169f('0x21')](function(_0x11cb87){_0x1d8694[_0x169f('0x31')]=_0x11cb87;if(_0x3cbef7['query'][_0x169f('0x53')]){_0x3673ff[_0x169f('0x54')]=[{'all':!![]}];}return db[_0x169f('0x74')][_0x169f('0x55')](_0x3673ff);})['then'](function(_0x36bf1f){_0x1d8694['rows']=_0x36bf1f;return _0x1d8694;});}})[_0x169f('0x21')](respondWithFilteredResult(_0x46a103,_0x3673ff))[_0x169f('0x2c')](handleError(_0x46a103,null));};exports[_0x169f('0x75')]=function(_0x556b18,_0x4f01b2,_0x36fa05){return db['WhatsappAccount'][_0x169f('0x5b')]({'where':{'id':_0x556b18['params']['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x4f01b2,null))['then'](function(_0x180503){if(_0x180503){return _0x180503['removeAnswers'](_0x556b18[_0x169f('0x45')]['ids']);}})[_0x169f('0x21')](respondWithStatusCode(_0x4f01b2,null))[_0x169f('0x2c')](handleError(_0x4f01b2,null));};exports[_0x169f('0x76')]=function(_0x3c7b64,_0x4b069d,_0x232d7e){return db['WhatsappAccount'][_0x169f('0x5b')]({'where':{'id':_0x3c7b64['params']['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x4b069d,null))[_0x169f('0x21')](function(_0x1b628c){if(_0x1b628c){return _0x1b628c['addAgents'](_0x3c7b64[_0x169f('0x66')][_0x169f('0x71')],_[_0x169f('0x77')](_0x3c7b64[_0x169f('0x66')],[_0x169f('0x71'),'id'])||{})['spread'](function(_0xfbb2df){for(var _0x5a7fca=0x0;_0x5a7fca<_0x3c7b64[_0x169f('0x66')][_0x169f('0x71')][_0x169f('0x5a')];_0x5a7fca+=0x1){socket[_0x169f('0x78')](_0x169f('0x79'),{'UserId':_0x3c7b64['body'][_0x169f('0x71')][_0x5a7fca],'WhatsappAccountId':_0x3c7b64[_0x169f('0x67')]['id']});}return _0xfbb2df;});}})[_0x169f('0x21')](respondWithResult(_0x4b069d,null))[_0x169f('0x2c')](handleError(_0x4b069d,null));};exports[_0x169f('0x7a')]=function(_0x1bf2e7,_0x486bf1,_0x394c76){return db[_0x169f('0x52')][_0x169f('0x5b')]({'where':{'id':_0x1bf2e7[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x486bf1,null))[_0x169f('0x21')](function(_0x4fa91a){if(_0x4fa91a){return _0x4fa91a[_0x169f('0x7a')](_0x1bf2e7[_0x169f('0x45')][_0x169f('0x71')])[_0x169f('0x21')](function(){if(_['isArray'](_0x1bf2e7[_0x169f('0x45')][_0x169f('0x71')])){for(var _0x3ce0c1=0x0;_0x3ce0c1<_0x1bf2e7[_0x169f('0x45')][_0x169f('0x71')]['length'];_0x3ce0c1+=0x1){socket[_0x169f('0x78')](_0x169f('0x7b'),{'UserId':Number(_0x1bf2e7[_0x169f('0x45')][_0x169f('0x71')][_0x3ce0c1]),'WhatsappAccountId':Number(_0x1bf2e7['params']['id'])});}}else{socket[_0x169f('0x78')]('userWhatsappAccount:remove',{'UserId':Number(_0x1bf2e7[_0x169f('0x45')]['ids']),'WhatsappAccountId':Number(_0x1bf2e7['params']['id'])});}});}})[_0x169f('0x21')](respondWithStatusCode(_0x486bf1,null))['catch'](handleError(_0x486bf1,null));};exports['getAgents']=function(_0x245f79,_0x522e41,_0x12dab6){var _0x134815={};var _0x141b04={};var _0x4a1aff;var _0x4b16fe;return db[_0x169f('0x52')][_0x169f('0x6d')]({'where':{'id':_0x245f79[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x522e41,null))[_0x169f('0x21')](function(_0x44c244){if(_0x44c244){_0x4a1aff=_0x44c244;_0x141b04[_0x169f('0x44')]=_[_0x169f('0x58')](db[_0x169f('0x7c')][_0x169f('0x41')]);_0x141b04[_0x169f('0x45')]=_[_0x169f('0x58')](_0x245f79[_0x169f('0x45')]);_0x141b04['filters']=_[_0x169f('0x48')](_0x141b04[_0x169f('0x44')],_0x141b04['query']);_0x134815[_0x169f('0x47')]=_['intersection'](_0x141b04[_0x169f('0x44')],qs[_0x169f('0x59')](_0x245f79[_0x169f('0x45')][_0x169f('0x59')]));_0x134815[_0x169f('0x47')]=_0x134815[_0x169f('0x47')][_0x169f('0x5a')]?_0x134815[_0x169f('0x47')]:_0x141b04[_0x169f('0x44')];_0x134815['order']=qs[_0x169f('0x4c')](_0x245f79[_0x169f('0x45')][_0x169f('0x4c')]);_0x134815[_0x169f('0x4d')]=qs[_0x169f('0x46')](_[_0x169f('0x6e')](_0x245f79[_0x169f('0x45')],_0x141b04[_0x169f('0x46')]));if(_0x245f79['query']['filter']){_0x134815[_0x169f('0x4d')]=_[_0x169f('0x4e')](_0x134815['where'],{'$or':_[_0x169f('0x40')](_0x134815[_0x169f('0x47')],function(_0x3de677){var _0x21677a={};_0x21677a[_0x3de677]={'$like':'%'+_0x245f79['query'][_0x169f('0x6f')]+'%'};return _0x21677a;})});}_0x134815=_[_0x169f('0x4e')]({},_0x134815,_0x245f79[_0x169f('0x51')]);return _0x4a1aff[_0x169f('0x7d')](_0x134815);}})[_0x169f('0x21')](function(_0x58f3b5){if(_0x58f3b5){_0x4b16fe=_0x58f3b5[_0x169f('0x5a')];if(!_0x245f79[_0x169f('0x45')]['hasOwnProperty'](_0x169f('0x4a'))){_0x134815[_0x169f('0x33')]=qs[_0x169f('0x33')](_0x245f79[_0x169f('0x45')][_0x169f('0x33')]);_0x134815['offset']=qs[_0x169f('0x32')](_0x245f79['query'][_0x169f('0x32')]);}return _0x4a1aff[_0x169f('0x7d')](_0x134815);}})[_0x169f('0x21')](function(_0x54b5fd){if(_0x54b5fd){return _0x54b5fd?{'count':_0x4b16fe,'rows':_0x54b5fd}:null;}})[_0x169f('0x21')](respondWithResult(_0x522e41,null))[_0x169f('0x2c')](handleError(_0x522e41,null));};exports[_0x169f('0x7e')]=function(_0x1dedf1,_0x5a9d2d,_0x1d7f00){return db['WhatsappAccount'][_0x169f('0x6d')]({'where':{'id':_0x1dedf1['params']['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x5a9d2d,null))[_0x169f('0x21')](function(_0x5bd455){if(_0x5bd455){return db[_0x169f('0x7f')][_0x169f('0x80')](function(_0x1bbed3){return db[_0x169f('0x81')]['destroy']({'where':{'WhatsappAccountId':_0x1dedf1[_0x169f('0x67')]['id']},'transaction':_0x1bbed3})[_0x169f('0x21')](function(_0x50ff0b){var _0x5fe4d8=_[_0x169f('0x40')](_0x1dedf1['body'],function(_0x1a11bb){_0x1a11bb[_0x169f('0x6a')]=_0x1dedf1[_0x169f('0x67')]['id'];return _0x1a11bb;});return db['WhatsappApplication'][_0x169f('0x82')](_0x5fe4d8,{'transaction':_0x1bbed3});});})['then'](function(){return db[_0x169f('0x81')][_0x169f('0x83')]({'where':{'WhatsappAccountId':_0x1dedf1[_0x169f('0x67')]['id']},'order':_0x169f('0x84')});});}})[_0x169f('0x21')](respondWithResult(_0x5a9d2d,null))['catch'](handleError(_0x5a9d2d,null));};exports['getApplications']=function(_0x105802,_0x253091,_0x20f7a6){var _0x5ff4ca={};var _0x3c7181={};var _0x4a743c;var _0x558043;return db[_0x169f('0x52')][_0x169f('0x6d')]({'where':{'id':_0x105802[_0x169f('0x67')]['id']}})['then'](handleEntityNotFound(_0x253091,null))['then'](function(_0x25ce84){if(_0x25ce84){_0x4a743c=_0x25ce84;_0x3c7181[_0x169f('0x44')]=_[_0x169f('0x58')](db[_0x169f('0x81')][_0x169f('0x41')]);_0x3c7181['query']=_[_0x169f('0x58')](_0x105802[_0x169f('0x45')]);_0x3c7181[_0x169f('0x46')]=_[_0x169f('0x48')](_0x3c7181[_0x169f('0x44')],_0x3c7181['query']);_0x5ff4ca[_0x169f('0x47')]=_[_0x169f('0x48')](_0x3c7181[_0x169f('0x44')],qs[_0x169f('0x59')](_0x105802[_0x169f('0x45')][_0x169f('0x59')]));_0x5ff4ca[_0x169f('0x47')]=_0x5ff4ca[_0x169f('0x47')][_0x169f('0x5a')]?_0x5ff4ca['attributes']:_0x3c7181[_0x169f('0x44')];_0x5ff4ca[_0x169f('0x4b')]=qs[_0x169f('0x4c')](_0x105802[_0x169f('0x45')][_0x169f('0x4c')]);_0x5ff4ca[_0x169f('0x4d')]=qs['filters'](_[_0x169f('0x6e')](_0x105802[_0x169f('0x45')],_0x3c7181[_0x169f('0x46')]));if(_0x105802['query'][_0x169f('0x6f')]){_0x5ff4ca[_0x169f('0x4d')]=_[_0x169f('0x4e')](_0x5ff4ca[_0x169f('0x4d')],{'$or':_[_0x169f('0x40')](_0x5ff4ca[_0x169f('0x47')],function(_0x4038cc){var _0x2defe3={};_0x2defe3[_0x4038cc]={'$like':'%'+_0x105802[_0x169f('0x45')]['filter']+'%'};return _0x2defe3;})});}_0x5ff4ca=_[_0x169f('0x4e')]({},_0x5ff4ca,_0x105802['options']);return _0x4a743c[_0x169f('0x85')](_0x5ff4ca);}})[_0x169f('0x21')](function(_0x564d5b){if(_0x564d5b){_0x558043=_0x564d5b['length'];if(!_0x105802[_0x169f('0x45')][_0x169f('0x49')](_0x169f('0x4a'))){_0x5ff4ca[_0x169f('0x33')]=qs[_0x169f('0x33')](_0x105802[_0x169f('0x45')][_0x169f('0x33')]);_0x5ff4ca['offset']=qs['offset'](_0x105802[_0x169f('0x45')][_0x169f('0x32')]);}return _0x4a743c['getApplications'](_0x5ff4ca);}})['then'](function(_0x384b9e){if(_0x384b9e){return _0x384b9e?{'count':_0x558043,'rows':_0x384b9e}:null;}})[_0x169f('0x21')](respondWithResult(_0x253091,null))[_0x169f('0x2c')](handleError(_0x253091,null));};exports[_0x169f('0x86')]=function(_0x12ab87,_0x202084,_0x30d26a){var _0x3dca4f={'channel':_0x169f('0x87')};var _0x7e544a=[];var _0x40fc43=[];var _0x12219e={};return db['WhatsappAccount']['find']({'where':{'id':_0x12ab87[_0x169f('0x67')]['id']},'include':[{'model':db[_0x169f('0x81')],'as':_0x169f('0x88')}]})[_0x169f('0x21')](handleEntityNotFound(_0x202084,null))[_0x169f('0x21')](function(_0x46d811){_0x3dca4f[_0x169f('0x89')]=_0x46d811;_0x3dca4f[_0x169f('0x8a')]=_['orderBy'](_0x46d811[_0x169f('0x88')],['priority'],[_0x169f('0x8b')]);if(_0x3dca4f[_0x169f('0x89')]['Applications']){delete _0x3dca4f['account'][_0x169f('0x88')];}return db[_0x169f('0x8c')][_0x169f('0x68')]();})[_0x169f('0x21')](function(_0x481c1f){if(!_0x481c1f){throw new db[(_0x169f('0x8d'))][(_0x169f('0x8e'))]('no\x20available\x20attributes');}_0x7e544a=_[_0x169f('0x8f')](_['keys'](_0x481c1f),[_0x169f('0x90'),_0x169f('0x91')]);_0x40fc43=_[_0x169f('0x8f')](_[_0x169f('0x58')](_0x481c1f),[_0x169f('0x90'),_0x169f('0x91'),_0x169f('0x92'),_0x169f('0x93')]);_0x3dca4f['body']={'mapKey':_0x169f('0x94')};if(_0x3dca4f[_0x169f('0x89')][_0x169f('0x4f')]&&_0x3dca4f[_0x169f('0x89')]['type']===_0x169f('0x95')){_0x3dca4f['body'][_0x169f('0x96')]=_0x12ab87[_0x169f('0x66')][_0x169f('0x97')][_0x169f('0x98')](_0x169f('0x99'),'');_0x3dca4f['body']['body']=_0x12ab87[_0x169f('0x66')][_0x169f('0x9a')];_0x3dca4f[_0x169f('0x66')][_0x169f('0x9b')]=_0x12ab87[_0x169f('0x66')][_0x169f('0x9c')];}if(_0x3dca4f['body']['id']){delete _0x3dca4f['body']['id'];}if(_['isNil'](_0x3dca4f[_0x169f('0x66')][_0x169f('0x96')])){throw new db[(_0x169f('0x8d'))][(_0x169f('0x8e'))](_0x169f('0x9d'));}if(_[_0x169f('0x9e')](_0x3dca4f[_0x169f('0x66')][_0x169f('0x66')])||_0x3dca4f[_0x169f('0x66')][_0x169f('0x66')]===''){throw new db[(_0x169f('0x8d'))][(_0x169f('0x8e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x169f('0x9e')](_0x3dca4f['body'][_0x169f('0x9f')])){throw new db[(_0x169f('0x8d'))][(_0x169f('0x8e'))](_0x169f('0xa0')+_0x40fc43);}if(!_[_0x169f('0xa1')](_0x40fc43,_0x3dca4f[_0x169f('0x66')][_0x169f('0x9f')])){throw new db[(_0x169f('0x8d'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x40fc43);}_0x12219e[_0x3dca4f[_0x169f('0x66')][_0x169f('0x9f')]]=_0x3dca4f[_0x169f('0x66')][_0x169f('0x96')];return db[_0x169f('0xa2')][_0x169f('0x5b')]({'where':{'id':_0x3dca4f['account'][_0x169f('0x93')]},'include':[{'model':db[_0x169f('0x8c')],'as':'Contacts','where':_0x12219e,'limit':0x1,'order':[['updatedAt',_0x169f('0xa3')]]}]});})['then'](handleEntityNotFound(_0x202084,null))['then'](function(_0x26b2e5){if(_0x26b2e5){_0x3dca4f['list']=_[_0x169f('0x77')](_0x26b2e5,[_0x169f('0xa4')]);if(_0x26b2e5[_0x169f('0xa4')][_0x169f('0x5a')]){return _0x26b2e5['Contacts'][0x0];}var _0x618d0a=_[_0x169f('0xa5')](_0x3dca4f[_0x169f('0x66')],{'firstName':_0x3dca4f[_0x169f('0x66')][_0x169f('0x96')],'ListId':_0x26b2e5['id']});_0x618d0a[_0x3dca4f[_0x169f('0x66')][_0x169f('0x9f')]]=_0x3dca4f[_0x169f('0x66')][_0x169f('0x96')];return db[_0x169f('0x8c')][_0x169f('0x5c')](_0x618d0a,{'fields':_0x7e544a,'raw':!![]});}})['then'](handleEntityNotFound(_0x202084,null))[_0x169f('0x21')](function(_0x429f83){if(_0x429f83){_0x3dca4f[_0x169f('0xa6')]=_0x429f83;var _0x580cf0={'ContactId':_0x429f83['id'],'phone':_0x3dca4f[_0x169f('0x66')][_0x169f('0x96')],'WhatsappAccountId':_0x12ab87[_0x169f('0x67')]['id']};var _0x3c1fac={'ContactId':_0x429f83['id'],'WhatsappAccountId':_0x12ab87[_0x169f('0x67')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x3c1fac})[_0x169f('0x21')](function(_0x4cc5ac){if(_0x4cc5ac){return[_0x4cc5ac,![]];}return db[_0x169f('0xa7')]['create'](_0x580cf0)['then'](function(_0x5d6730){return[_0x5d6730,!![]];});});}})[_0x169f('0xa8')](function(_0x118e61,_0x163712){_0x3dca4f[_0x169f('0xa9')]=_0x118e61[_0x169f('0x60')]({'plain':!![]});_0x3dca4f[_0x169f('0xa9')][_0x169f('0xaa')]=![];if(_0x163712){if(_0x3dca4f['account'][_0x169f('0xab')]){_0x3dca4f[_0x169f('0x8a')][_0x169f('0xac')]({'id':0x0,'priority':_0x3dca4f[_0x169f('0x8a')][_0x169f('0x5a')]+0x1,'app':_0x169f('0xad'),'appdata':'unmanaged','interval':_0x169f('0xae')});}_0x3dca4f[_0x169f('0xa9')][_0x169f('0xaa')]=!![];}return db[_0x169f('0xaf')][_0x169f('0x5c')]({'phone':_0x3dca4f[_0x169f('0x66')]['from'],'messageId':_0x3dca4f[_0x169f('0x66')][_0x169f('0x9b')],'body':_0x3dca4f[_0x169f('0x66')][_0x169f('0x66')],'WhatsappAccountId':_0x12ab87[_0x169f('0x67')]['id'],'WhatsappInteractionId':_0x118e61['id'],'direction':'in','ContactId':_0x118e61[_0x169f('0xb0')],'AttachmentId':_0x3dca4f['body'][_0x169f('0xb1')]});})[_0x169f('0x21')](function(_0x526b0d){_0x3dca4f[_0x169f('0x2a')]=_0x526b0d;if(_0x3dca4f['interaction']['UserId']){return db[_0x169f('0x7c')][_0x169f('0x5b')]({'attributes':['id',_0x169f('0x3c')],'where':{'id':_0x3dca4f[_0x169f('0xa9')][_0x169f('0xb2')]}})[_0x169f('0x21')](function(_0x42c678){if(_0x42c678){_0x3dca4f[_0x169f('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x42c678['name']+','+(_0x3dca4f[_0x169f('0x89')][_0x169f('0xb3')]||0xa),'interval':_0x169f('0xae')});}return respondWithRpcPromise(_0x169f('0xb4'),_0x169f('0xb5'),_0x3dca4f);});}return respondWithRpcPromise(_0x169f('0xb4'),_0x169f('0xb5'),_0x3dca4f);})[_0x169f('0x21')](function(_0xd4bca0){if(_0xd4bca0){var _0x2e6e0a=0xc8;var _0x152c1d='receiveMessage';logger[_0x169f('0x22')](_0x169f('0x25'),_0x152c1d,_0x2e6e0a,'entity\x20found');logger[_0x169f('0x24')](_0x169f('0xb6'),_0x152c1d,_0x2e6e0a,_0x169f('0xb7'),JSON[_0x169f('0x26')](_0xd4bca0));if(_0x3dca4f[_0x169f('0x89')][_0x169f('0x4f')]===_0x169f('0x95')){return _0x202084[_0x169f('0x2e')](_0x2e6e0a)[_0x169f('0x34')](_0x169f('0xb8'),_0x169f('0xb9'))[_0x169f('0xba')](_0x169f('0xbb'));}else{return _0x202084['status'](_0x2e6e0a)[_0x169f('0x30')](_0xd4bca0);}}})[_0x169f('0x2c')](handleError(_0x202084,null));};exports[_0x169f('0xba')]=function(_0x4205ea,_0x32bed5,_0x3fa8cc){var _0x3ebdd3,_0x797702,_0x3275b4;if(_[_0x169f('0x9e')](_0x4205ea['body']['body'])||_0x4205ea[_0x169f('0x66')]['body']===''){throw new db[(_0x169f('0x8d'))][(_0x169f('0x8e'))](_0x169f('0xbc'));}if(_['isNil'](_0x4205ea[_0x169f('0x66')]['to'])){throw new db[(_0x169f('0x8d'))]['ValidationError'](_0x169f('0xbd'));}_0x3ebdd3=_0x4205ea['body']['to'];return db['WhatsappAccount'][_0x169f('0x5b')]({'where':{'id':_0x4205ea[_0x169f('0x67')]['id']},'include':[{'model':db[_0x169f('0xa2')],'as':_0x169f('0xbe'),'include':[{'model':db[_0x169f('0x8c')],'as':_0x169f('0xa4'),'where':{'mobile':_0x3ebdd3},'limit':0x1,'order':[['updatedAt',_0x169f('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x32bed5,null))[_0x169f('0x21')](function(_0x3449aa){if(_0x3449aa&&_0x3449aa['List']){_0x797702=_0x3449aa['get']({'plain':!![]});if(_0x797702['List']&&_0x797702[_0x169f('0xbe')][_0x169f('0xa4')][_0x169f('0x5a')]){return _0x797702[_0x169f('0xbe')][_0x169f('0xa4')][0x0];}return db['CmContact'][_0x169f('0x5c')](_[_0x169f('0xa5')](_0x4205ea[_0x169f('0x66')],{'firstName':_0x3ebdd3,'mobile':_0x3ebdd3,'phone':_0x3ebdd3,'ListId':_0x797702[_0x169f('0x93')]}));}})['then'](handleEntityNotFound(_0x32bed5,null))[_0x169f('0x21')](function(_0x38997a){if(_0x38997a){_0x3275b4=_0x38997a;return db[_0x169f('0xa7')]['find']({'where':{'ContactId':_0x3275b4['id'],'closed':![],'WhatsappAccountId':_0x797702['id']}})[_0x169f('0x21')](function(_0x854140){if(_0x854140){return[_0x854140,![]];}return db[_0x169f('0xa7')][_0x169f('0x5c')]({'UserId':_0x4205ea[_0x169f('0x5d')]['id'],'ContactId':_0x3275b4['id'],'WhatsappAccountId':_0x797702['id'],'phone':_0x3ebdd3,'firstMsgDirection':_0x169f('0xbf'),'Messages':[_[_0x169f('0x4e')](_0x4205ea[_0x169f('0x66')],{'read':![],'body':_0x4205ea[_0x169f('0x66')][_0x169f('0x66')],'phone':_0x3ebdd3,'WhatsappAccountId':_0x797702['id'],'UserId':_0x4205ea[_0x169f('0x5d')]['id'],'ContactId':_0x3275b4['id']})]},{'include':[{'model':db[_0x169f('0xaf')],'as':_0x169f('0xc0')}]})[_0x169f('0x21')](function(_0x1dfd48){return[_0x1dfd48,!![]];});});}})[_0x169f('0xa8')](function(_0x11aaff,_0x29026d){if(_0x29026d){return _0x11aaff;}return db['WhatsappMessage']['create'](_[_0x169f('0x4e')](_0x4205ea[_0x169f('0x66')],{'read':![],'body':_0x4205ea[_0x169f('0x66')][_0x169f('0x66')],'phone':_0x3ebdd3,'WhatsappAccountId':_0x797702['id'],'WhatsappInteractionId':_0x11aaff['id'],'UserId':_0x4205ea[_0x169f('0x5d')]['id'],'ContactId':_0x3275b4['id']}))[_0x169f('0x21')](function(_0x23968c){_0x11aaff[_0x169f('0xc1')][_0x169f('0xc0')]=[];_0x11aaff['dataValues'][_0x169f('0xc0')][_0x169f('0xac')](_0x23968c[_0x169f('0xc1')]);return _0x11aaff;});})[_0x169f('0x21')](respondWithResult(_0x32bed5,null))[_0x169f('0x2c')](handleError(_0x32bed5,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 4142aff..1a1d7a1 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 _0x41d0=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','update'];(function(_0x5545c9,_0x42fa27){var _0x5848eb=function(_0x68d730){while(--_0x68d730){_0x5545c9['push'](_0x5545c9['shift']());}};_0x5848eb(++_0x42fa27);}(_0x41d0,0x1c6));var _0x041d=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x41d0[_0xea8947];return _0x2455e9;};'use strict';var EventEmitter=require(_0x041d('0x0'));var WhatsappAccount=require(_0x041d('0x1'))['db'][_0x041d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x041d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x041d('0x4'),'afterDestroy':_0x041d('0x5')};function emitEvent(_0x12e55d){return function(_0x397dad,_0x41e587,_0x3a22a4){WhatsappAccountEvents[_0x041d('0x6')](_0x12e55d+':'+_0x397dad['id'],_0x397dad);WhatsappAccountEvents[_0x041d('0x6')](_0x12e55d,_0x397dad);_0x3a22a4(null);};}for(var e in events){if(events[_0x041d('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x041d('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xef17=['update','remove','emit','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x2128e0,_0x385126){var _0x3ded3f=function(_0x31b239){while(--_0x31b239){_0x2128e0['push'](_0x2128e0['shift']());}};_0x3ded3f(++_0x385126);}(_0xef17,0x136));var _0x7ef1=function(_0x58351d,_0x27d107){_0x58351d=_0x58351d-0x0;var _0x4c3eff=_0xef17[_0x58351d];return _0x4c3eff;};'use strict';var EventEmitter=require(_0x7ef1('0x0'));var WhatsappAccount=require(_0x7ef1('0x1'))['db'][_0x7ef1('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7ef1('0x3')](0x0);var events={'afterCreate':_0x7ef1('0x4'),'afterUpdate':_0x7ef1('0x5'),'afterDestroy':_0x7ef1('0x6')};function emitEvent(_0x19a10d){return function(_0x2daaa6,_0x538a0a,_0x1d2f83){WhatsappAccountEvents['emit'](_0x19a10d+':'+_0x2daaa6['id'],_0x2daaa6);WhatsappAccountEvents[_0x7ef1('0x7')](_0x19a10d,_0x2daaa6);_0x1d2f83(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x7ef1('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 8c07bc1..560be81 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 _0xab31=['../../config/logger','api','path','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x2504ff,_0x1a6b3b){var _0x292d2d=function(_0x4510cb){while(--_0x4510cb){_0x2504ff['push'](_0x2504ff['shift']());}};_0x292d2d(++_0x1a6b3b);}(_0xab31,0x115));var _0x1ab3=function(_0x2215c6,_0x380a85){_0x2215c6=_0x2215c6-0x0;var _0x4630ca=_0xab31[_0x2215c6];return _0x4630ca;};'use strict';var _=require(_0x1ab3('0x0'));var util=require(_0x1ab3('0x1'));var logger=require(_0x1ab3('0x2'))(_0x1ab3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ab3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ab3('0x5'));module[_0x1ab3('0x6')]=function(_0x10cabe,_0x34450e){return _0x10cabe['define'](_0x1ab3('0x7'),attributes,{'tableName':_0x1ab3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e42=['util','../../config/logger','api','moment','request-promise','rimraf','./whatsappAccount.attributes','exports','define','lodash'];(function(_0x470b53,_0x43aba1){var _0x34d21b=function(_0x56bb31){while(--_0x56bb31){_0x470b53['push'](_0x470b53['shift']());}};_0x34d21b(++_0x43aba1);}(_0x0e42,0xa9));var _0x20e4=function(_0x8de604,_0x2fe19a){_0x8de604=_0x8de604-0x0;var _0x585490=_0x0e42[_0x8de604];return _0x585490;};'use strict';var _=require(_0x20e4('0x0'));var util=require(_0x20e4('0x1'));var logger=require(_0x20e4('0x2'))(_0x20e4('0x3'));var moment=require(_0x20e4('0x4'));var BPromise=require('bluebird');var rp=require(_0x20e4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20e4('0x6'));var config=require('../../config/environment');var attributes=require(_0x20e4('0x7'));module[_0x20e4('0x8')]=function(_0x1bc5b9,_0x3a35b8){return _0x1bc5b9[_0x20e4('0x9')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 0a8237d..544b0a9 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 _0x0cf3=['WhatsappAccount','find','options','raw','attributes','include','model','map','ShowWhatsappAccount','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch'];(function(_0x34559b,_0x42b8ed){var _0x517ca8=function(_0x4b92a7){while(--_0x4b92a7){_0x34559b['push'](_0x34559b['shift']());}};_0x517ca8(++_0x42b8ed);}(_0x0cf3,0x95));var _0x30cf=function(_0x5d4135,_0x3868b6){_0x5d4135=_0x5d4135-0x0;var _0x4d93f5=_0x0cf3[_0x5d4135];return _0x4d93f5;};'use strict';var _=require(_0x30cf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x30cf('0x1'));var fs=require('fs');var Redis=require(_0x30cf('0x2'));var db=require(_0x30cf('0x3'))['db'];var utils=require(_0x30cf('0x4'));var logger=require(_0x30cf('0x5'))('rpc');var config=require(_0x30cf('0x6'));var jayson=require(_0x30cf('0x7'));var client=jayson['client'][_0x30cf('0x8')]({'port':0x232a});config['redis']=_[_0x30cf('0x9')](config[_0x30cf('0xa')],{'host':_0x30cf('0xb'),'port':0x18eb});var socket=require(_0x30cf('0xc'))(new Redis(config[_0x30cf('0xa')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4af99f,_0x3825be,_0x34c1d4){return new BPromise(function(_0x39db12,_0xe41dbb){return client[_0x30cf('0xd')](_0x4af99f,_0x34c1d4)[_0x30cf('0xe')](function(_0x15edf1){logger[_0x30cf('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x3825be,_0x30cf('0x10'));logger[_0x30cf('0x11')](_0x30cf('0x12'),_0x3825be,_0x30cf('0x10'),JSON[_0x30cf('0x13')](_0x15edf1));if(_0x15edf1[_0x30cf('0x14')]){if(_0x15edf1['error'][_0x30cf('0x15')]===0x1f4){logger[_0x30cf('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x3825be,_0x15edf1[_0x30cf('0x14')]['message']);return _0xe41dbb(_0x15edf1[_0x30cf('0x14')][_0x30cf('0x16')]);}logger[_0x30cf('0x14')](_0x30cf('0x17'),_0x3825be,_0x15edf1[_0x30cf('0x14')][_0x30cf('0x16')]);return _0x39db12(_0x15edf1[_0x30cf('0x14')][_0x30cf('0x16')]);}else{logger[_0x30cf('0xf')](_0x30cf('0x17'),_0x3825be,_0x30cf('0x10'));_0x39db12(_0x15edf1[_0x30cf('0x18')][_0x30cf('0x16')]);}})[_0x30cf('0x19')](function(_0x1a8f19){logger[_0x30cf('0x14')](_0x30cf('0x17'),_0x3825be,_0x1a8f19);_0xe41dbb(_0x1a8f19);});});}exports['ShowWhatsappAccount']=function(_0x4b4423){var _0x12ae58=this;return new Promise(function(_0xdacd,_0x4912f8){return db[_0x30cf('0x1a')][_0x30cf('0x1b')]({'raw':_0x4b4423[_0x30cf('0x1c')]?_0x4b4423[_0x30cf('0x1c')][_0x30cf('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b4423['options']?_0x4b4423['options']['where']||null:null,'attributes':_0x4b4423['options']?_0x4b4423[_0x30cf('0x1c')][_0x30cf('0x1e')]||null:null,'include':_0x4b4423[_0x30cf('0x1c')]?_0x4b4423[_0x30cf('0x1c')][_0x30cf('0x1f')]?_['map'](_0x4b4423[_0x30cf('0x1c')][_0x30cf('0x1f')],function(_0x2823e1){return{'model':db[_0x2823e1[_0x30cf('0x20')]],'as':_0x2823e1['as'],'attributes':_0x2823e1[_0x30cf('0x1e')],'include':_0x2823e1['include']?_['map'](_0x2823e1[_0x30cf('0x1f')],function(_0x9e17e6){return{'model':db[_0x9e17e6[_0x30cf('0x20')]],'as':_0x9e17e6['as'],'attributes':_0x9e17e6[_0x30cf('0x1e')],'include':_0x9e17e6[_0x30cf('0x1f')]?_[_0x30cf('0x21')](_0x9e17e6[_0x30cf('0x1f')],function(_0x2b0c2e){return{'model':db[_0x2b0c2e[_0x30cf('0x20')]],'as':_0x2b0c2e['as'],'attributes':_0x2b0c2e[_0x30cf('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x30cf('0xe')](function(_0x2629e4){logger[_0x30cf('0xf')](_0x30cf('0x22'),_0x4b4423);logger[_0x30cf('0x11')]('ShowWhatsappAccount',_0x4b4423,JSON[_0x30cf('0x13')](_0x2629e4));_0xdacd(_0x2629e4);})[_0x30cf('0x19')](function(_0x56222e){logger['error'](_0x30cf('0x22'),_0x56222e['message'],_0x4b4423);_0x4912f8(_0x12ae58[_0x30cf('0x14')](0x1f4,_0x56222e[_0x30cf('0x16')]));});});}; \ No newline at end of file +var _0x9483=['attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','raw','options','where'];(function(_0x586197,_0x2c087b){var _0x2f3ceb=function(_0x186ec3){while(--_0x186ec3){_0x586197['push'](_0x586197['shift']());}};_0x2f3ceb(++_0x2c087b);}(_0x9483,0xc3));var _0x3948=function(_0x3da42f,_0x52d8f3){_0x3da42f=_0x3da42f-0x0;var _0x2ae7c7=_0x9483[_0x3da42f];return _0x2ae7c7;};'use strict';var _=require(_0x3948('0x0'));var util=require(_0x3948('0x1'));var moment=require(_0x3948('0x2'));var BPromise=require(_0x3948('0x3'));var rs=require(_0x3948('0x4'));var fs=require('fs');var Redis=require(_0x3948('0x5'));var db=require(_0x3948('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3948('0x7'))(_0x3948('0x8'));var config=require(_0x3948('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3948('0xa')][_0x3948('0xb')]({'port':0x232a});config[_0x3948('0xc')]=_[_0x3948('0xd')](config[_0x3948('0xc')],{'host':_0x3948('0xe'),'port':0x18eb});var socket=require(_0x3948('0xf'))(new Redis(config[_0x3948('0xc')]));require(_0x3948('0x10'))[_0x3948('0x11')](socket);function respondWithRpcPromise(_0x2b1f44,_0x3a5aeb,_0x471c75){return new BPromise(function(_0x16e15f,_0x5440a8){return client['request'](_0x2b1f44,_0x471c75)[_0x3948('0x12')](function(_0x50e427){logger[_0x3948('0x13')](_0x3948('0x14'),_0x3a5aeb,_0x3948('0x15'));logger['debug'](_0x3948('0x16'),_0x3a5aeb,_0x3948('0x15'),JSON['stringify'](_0x50e427));if(_0x50e427[_0x3948('0x17')]){if(_0x50e427[_0x3948('0x17')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3a5aeb,_0x50e427[_0x3948('0x17')][_0x3948('0x18')]);return _0x5440a8(_0x50e427[_0x3948('0x17')][_0x3948('0x18')]);}logger[_0x3948('0x17')](_0x3948('0x14'),_0x3a5aeb,_0x50e427[_0x3948('0x17')][_0x3948('0x18')]);return _0x16e15f(_0x50e427[_0x3948('0x17')][_0x3948('0x18')]);}else{logger[_0x3948('0x13')](_0x3948('0x14'),_0x3a5aeb,_0x3948('0x15'));_0x16e15f(_0x50e427[_0x3948('0x19')][_0x3948('0x18')]);}})[_0x3948('0x1a')](function(_0x40e92d){logger[_0x3948('0x17')](_0x3948('0x14'),_0x3a5aeb,_0x40e92d);_0x5440a8(_0x40e92d);});});}exports[_0x3948('0x1b')]=function(_0x4026a2){var _0x3a3ed5=this;return new Promise(function(_0x1b4429,_0x3faac1){return db[_0x3948('0x1c')][_0x3948('0x1d')]({'raw':_0x4026a2['options']?_0x4026a2['options'][_0x3948('0x1e')]===undefined?!![]:![]:!![],'where':_0x4026a2[_0x3948('0x1f')]?_0x4026a2['options'][_0x3948('0x20')]||null:null,'attributes':_0x4026a2[_0x3948('0x1f')]?_0x4026a2[_0x3948('0x1f')][_0x3948('0x21')]||null:null,'include':_0x4026a2['options']?_0x4026a2[_0x3948('0x1f')][_0x3948('0x22')]?_[_0x3948('0x23')](_0x4026a2[_0x3948('0x1f')]['include'],function(_0x131645){return{'model':db[_0x131645[_0x3948('0x24')]],'as':_0x131645['as'],'attributes':_0x131645[_0x3948('0x21')],'include':_0x131645[_0x3948('0x22')]?_['map'](_0x131645[_0x3948('0x22')],function(_0x3e3df6){return{'model':db[_0x3e3df6[_0x3948('0x24')]],'as':_0x3e3df6['as'],'attributes':_0x3e3df6[_0x3948('0x21')],'include':_0x3e3df6[_0x3948('0x22')]?_[_0x3948('0x23')](_0x3e3df6[_0x3948('0x22')],function(_0x3ffa8b){return{'model':db[_0x3ffa8b[_0x3948('0x24')]],'as':_0x3ffa8b['as'],'attributes':_0x3ffa8b[_0x3948('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3948('0x12')](function(_0x174c72){logger['info'](_0x3948('0x1b'),_0x4026a2);logger[_0x3948('0x25')]('ShowWhatsappAccount',_0x4026a2,JSON['stringify'](_0x174c72));_0x1b4429(_0x174c72);})['catch'](function(_0x580c43){logger[_0x3948('0x17')](_0x3948('0x1b'),_0x580c43[_0x3948('0x18')],_0x4026a2);_0x3faac1(_0x3a3ed5[_0x3948('0x17')](0x1f4,_0x580c43['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index c41cda2..fd80642 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 _0x43d4=['./whatsappAccount.events','save','remove','emit','register','length','whatsappAccount:'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x43d4,0x1dc));var _0x443d=function(_0x84e446,_0x2f3316){_0x84e446=_0x84e446-0x0;var _0x35d849=_0x43d4[_0x84e446];return _0x35d849;};'use strict';var WhatsappAccountEvents=require(_0x443d('0x0'));var events=[_0x443d('0x1'),_0x443d('0x2'),'update'];function createListener(_0x2b5d62,_0x12e633){return function(_0x52fcce){_0x12e633[_0x443d('0x3')](_0x2b5d62,_0x52fcce);};}function removeListener(_0x2da105,_0x35f997){return function(){WhatsappAccountEvents['removeListener'](_0x2da105,_0x35f997);};}exports[_0x443d('0x4')]=function(_0x44b6e6){for(var _0x5d55b0=0x0,_0x4bc26c=events[_0x443d('0x5')];_0x5d55b0<_0x4bc26c;_0x5d55b0++){var _0x4b0435=events[_0x5d55b0];var _0x484ecd=createListener(_0x443d('0x6')+_0x4b0435,_0x44b6e6);WhatsappAccountEvents['on'](_0x4b0435,_0x484ecd);}}; \ No newline at end of file +var _0xa048=['removeListener','length','whatsappAccount:','./whatsappAccount.events','remove','update'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0xa048,0x16b));var _0x8a04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa048[_0x20a584];return _0x4b41a8;};'use strict';var WhatsappAccountEvents=require(_0x8a04('0x0'));var events=['save',_0x8a04('0x1'),_0x8a04('0x2')];function createListener(_0x38f7cd,_0x5761ee){return function(_0x407b7f){_0x5761ee['emit'](_0x38f7cd,_0x407b7f);};}function removeListener(_0x2d3e97,_0x34940c){return function(){WhatsappAccountEvents[_0x8a04('0x3')](_0x2d3e97,_0x34940c);};}exports['register']=function(_0x54205b){for(var _0xea2fd8=0x0,_0x10b3e1=events[_0x8a04('0x4')];_0xea2fd8<_0x10b3e1;_0xea2fd8++){var _0x4a2604=events[_0xea2fd8];var _0x59f4c4=createListener(_0x8a04('0x5')+_0x4a2604,_0x54205b);WhatsappAccountEvents['on'](_0x4a2604,_0x59f4c4);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 9483a1d..b5b5917 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 _0x4a8a=['isAuthenticated','index','/:id','show','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get'];(function(_0x31a881,_0x5de859){var _0x419048=function(_0x46d1bf){while(--_0x46d1bf){_0x31a881['push'](_0x31a881['shift']());}};_0x419048(++_0x5de859);}(_0x4a8a,0x15b));var _0xa4a8=function(_0x1aab74,_0x38a57b){_0x1aab74=_0x1aab74-0x0;var _0x396af2=_0x4a8a[_0x1aab74];return _0x396af2;};'use strict';var multer=require(_0xa4a8('0x0'));var util=require(_0xa4a8('0x1'));var path=require(_0xa4a8('0x2'));var timeout=require(_0xa4a8('0x3'));var express=require(_0xa4a8('0x4'));var router=express['Router']();var auth=require(_0xa4a8('0x5'));var interaction=require(_0xa4a8('0x6'));var config=require(_0xa4a8('0x7'));var controller=require(_0xa4a8('0x8'));router[_0xa4a8('0x9')]('/',auth[_0xa4a8('0xa')](),controller[_0xa4a8('0xb')]);router['get'](_0xa4a8('0xc'),auth[_0xa4a8('0xa')](),controller[_0xa4a8('0xd')]);router['post']('/',auth[_0xa4a8('0xa')](),controller['create']);router['put'](_0xa4a8('0xc'),auth['isAuthenticated'](),controller[_0xa4a8('0xe')]);router['delete'](_0xa4a8('0xc'),auth[_0xa4a8('0xa')](),controller[_0xa4a8('0xf')]);module[_0xa4a8('0x10')]=router; \ No newline at end of file +var _0x0e87=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x17022b,_0xd36714){var _0xd620d1=function(_0x1b7b88){while(--_0x1b7b88){_0x17022b['push'](_0x17022b['shift']());}};_0xd620d1(++_0xd36714);}(_0x0e87,0x7c));var _0x70e8=function(_0x5c1866,_0x1fa128){_0x5c1866=_0x5c1866-0x0;var _0x4daff7=_0x0e87[_0x5c1866];return _0x4daff7;};'use strict';var multer=require(_0x70e8('0x0'));var util=require(_0x70e8('0x1'));var path=require(_0x70e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x70e8('0x3'));var router=express[_0x70e8('0x4')]();var auth=require(_0x70e8('0x5'));var interaction=require(_0x70e8('0x6'));var config=require(_0x70e8('0x7'));var controller=require(_0x70e8('0x8'));router[_0x70e8('0x9')]('/',auth[_0x70e8('0xa')](),controller[_0x70e8('0xb')]);router['get'](_0x70e8('0xc'),auth['isAuthenticated'](),controller[_0x70e8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x70e8('0xe')]);router[_0x70e8('0xf')](_0x70e8('0xc'),auth[_0x70e8('0xa')](),controller[_0x70e8('0x10')]);router[_0x70e8('0x11')](_0x70e8('0xc'),auth[_0x70e8('0xa')](),controller[_0x70e8('0x12')]);module[_0x70e8('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 7b7620a..9f3c1c7 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 _0x7a03=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x458f3b,_0x55e4f4){var _0x473b46=function(_0x1c116d){while(--_0x1c116d){_0x458f3b['push'](_0x458f3b['shift']());}};_0x473b46(++_0x55e4f4);}(_0x7a03,0x1b7));var _0x37a0=function(_0x2fca37,_0x29b128){_0x2fca37=_0x2fca37-0x0;var _0x5ca4ad=_0x7a03[_0x2fca37];return _0x5ca4ad;};'use strict';var Sequelize=require(_0x37a0('0x0'));module[_0x37a0('0x1')]={'priority':{'type':Sequelize[_0x37a0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x37a0('0x3')],'allowNull':![],'defaultValue':_0x37a0('0x4')},'appdata':{'type':Sequelize[_0x37a0('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x37a0('0x3')],'defaultValue':_0x37a0('0x6')}}; \ No newline at end of file +var _0xeaf0=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0xfd24a8,_0x215709){var _0x22c695=function(_0x4dbc41){while(--_0x4dbc41){_0xfd24a8['push'](_0xfd24a8['shift']());}};_0x22c695(++_0x215709);}(_0xeaf0,0xfd));var _0x0eaf=function(_0x5e1c8a,_0x572954){_0x5e1c8a=_0x5e1c8a-0x0;var _0x5817b6=_0xeaf0[_0x5e1c8a];return _0x5817b6;};'use strict';var Sequelize=require(_0x0eaf('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0eaf('0x1')],'allowNull':![],'defaultValue':_0x0eaf('0x2')},'appdata':{'type':Sequelize[_0x0eaf('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0eaf('0x1')],'defaultValue':_0x0eaf('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 175daea..f9b110e 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 _0x729e=['type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','include','find','catch','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','apply','reject','then','destroy','error','stack','name','send','map','WhatsappApplication','rawAttributes','fieldName'];(function(_0x722360,_0x217e4f){var _0x39590f=function(_0x1aa9f8){while(--_0x1aa9f8){_0x722360['push'](_0x722360['shift']());}};_0x39590f(++_0x217e4f);}(_0x729e,0xf8));var _0xe729=function(_0x525e12,_0x4db7fd){_0x525e12=_0x525e12-0x0;var _0x3598e1=_0x729e[_0x525e12];return _0x3598e1;};'use strict';var pdf=require(_0xe729('0x0'));var emlformat=require(_0xe729('0x1'));var rimraf=require(_0xe729('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe729('0x3'));var rp=require(_0xe729('0x4'));var moment=require(_0xe729('0x5'));var BPromise=require(_0xe729('0x6'));var Mustache=require(_0xe729('0x7'));var util=require(_0xe729('0x8'));var path=require(_0xe729('0x9'));var sox=require('sox');var csv=require(_0xe729('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe729('0xb'));var squel=require(_0xe729('0xc'));var crypto=require(_0xe729('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe729('0xe'));var toCsv=require(_0xe729('0xa'));var querystring=require(_0xe729('0xf'));var Papa=require(_0xe729('0x10'));var Redis=require(_0xe729('0x11'));var authService=require(_0xe729('0x12'));var qs=require(_0xe729('0x13'));var as=require(_0xe729('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe729('0x15'))(_0xe729('0x16'));var utils=require(_0xe729('0x17'));var config=require(_0xe729('0x18'));var licenseUtil=require(_0xe729('0x19'));var db=require(_0xe729('0x1a'))['db'];function respondWithStatusCode(_0xa5c473,_0x42d62d){_0x42d62d=_0x42d62d||0xcc;return function(_0x163ac7){if(_0x163ac7){return _0xa5c473[_0xe729('0x1b')](_0x42d62d);}return _0xa5c473[_0xe729('0x1c')](_0x42d62d)[_0xe729('0x1d')]();};}function respondWithResult(_0x1d8401,_0x1f3bc0){_0x1f3bc0=_0x1f3bc0||0xc8;return function(_0x29311d){if(_0x29311d){return _0x1d8401[_0xe729('0x1c')](_0x1f3bc0)[_0xe729('0x1e')](_0x29311d);}};}function respondWithFilteredResult(_0x1ddbca,_0x2d48dc){return function(_0x151ae8){if(_0x151ae8){var _0x329105=_0x151ae8[_0xe729('0x1f')],_0x882e3b=_0x2d48dc['offset'],_0x898550=_0x2d48dc['offset']+_0x2d48dc['limit'],_0xdeb32f;if(_0x898550>=_0x329105){_0x898550=_0x329105;_0xdeb32f=0xc8;}else{_0xdeb32f=0xce;}_0x1ddbca['status'](_0xdeb32f);return _0x1ddbca['set']('Content-Range',_0x882e3b+'-'+_0x898550+'/'+_0x329105)['json'](_0x151ae8);}return null;};}function patchUpdates(_0x46ee39){return function(_0x92e4d1){try{jsonpatch[_0xe729('0x20')](_0x92e4d1,_0x46ee39,!![]);}catch(_0x49ebbc){return BPromise[_0xe729('0x21')](_0x49ebbc);}return _0x92e4d1['save']();};}function saveUpdates(_0x1a6991,_0x4c7c90){return function(_0x18af67){if(_0x18af67){return _0x18af67['update'](_0x1a6991)[_0xe729('0x22')](function(_0x264b9c){return _0x264b9c;});}return null;};}function removeEntity(_0x1e6a4d,_0xa06f5c){return function(_0x336564){if(_0x336564){return _0x336564[_0xe729('0x23')]()[_0xe729('0x22')](function(){_0x1e6a4d[_0xe729('0x1c')](0xcc)[_0xe729('0x1d')]();});}};}function handleEntityNotFound(_0x22162e,_0x3cd7cf){return function(_0x335074){if(!_0x335074){_0x22162e[_0xe729('0x1b')](0x194);}return _0x335074;};}function handleError(_0x170bb1,_0x51e806){_0x51e806=_0x51e806||0x1f4;return function(_0x3fbe5a){logger[_0xe729('0x24')](_0x3fbe5a[_0xe729('0x25')]);if(_0x3fbe5a[_0xe729('0x26')]){delete _0x3fbe5a[_0xe729('0x26')];}_0x170bb1['status'](_0x51e806)[_0xe729('0x27')](_0x3fbe5a);};}exports['index']=function(_0x4b1232,_0xf9e0d0){var _0x42e919={},_0x248873={},_0x44f387={'count':0x0,'rows':[]};var _0x4a7249=_[_0xe729('0x28')](db[_0xe729('0x29')][_0xe729('0x2a')],function(_0x17024d){return{'name':_0x17024d[_0xe729('0x2b')],'type':_0x17024d[_0xe729('0x2c')][_0xe729('0x2d')]};});_0x248873[_0xe729('0x2e')]=_[_0xe729('0x28')](_0x4a7249,'name');_0x248873[_0xe729('0x2f')]=_[_0xe729('0x30')](_0x4b1232[_0xe729('0x2f')]);_0x248873['filters']=_[_0xe729('0x31')](_0x248873['model'],_0x248873['query']);_0x42e919[_0xe729('0x32')]=_['intersection'](_0x248873[_0xe729('0x2e')],qs['fields'](_0x4b1232['query'][_0xe729('0x33')]));_0x42e919[_0xe729('0x32')]=_0x42e919[_0xe729('0x32')][_0xe729('0x34')]?_0x42e919['attributes']:_0x248873[_0xe729('0x2e')];if(!_0x4b1232[_0xe729('0x2f')][_0xe729('0x35')](_0xe729('0x36'))){_0x42e919[_0xe729('0x37')]=qs[_0xe729('0x37')](_0x4b1232[_0xe729('0x2f')][_0xe729('0x37')]);_0x42e919[_0xe729('0x38')]=qs['offset'](_0x4b1232[_0xe729('0x2f')][_0xe729('0x38')]);}_0x42e919['order']=qs[_0xe729('0x39')](_0x4b1232[_0xe729('0x2f')][_0xe729('0x39')]);_0x42e919[_0xe729('0x3a')]=qs['filters'](_[_0xe729('0x3b')](_0x4b1232[_0xe729('0x2f')],_0x248873['filters']),_0x4a7249);if(_0x4b1232[_0xe729('0x2f')][_0xe729('0x3c')]){_0x42e919[_0xe729('0x3a')]=_[_0xe729('0x3d')](_0x42e919[_0xe729('0x3a')],{'$or':_[_0xe729('0x28')](_0x4a7249,function(_0x1ccc02){if(_0x1ccc02[_0xe729('0x2c')]!==_0xe729('0x3e')){var _0xdbb78a={};_0xdbb78a[_0x1ccc02[_0xe729('0x26')]]={'$like':'%'+_0x4b1232[_0xe729('0x2f')]['filter']+'%'};return _0xdbb78a;}})});}_0x42e919=_['merge']({},_0x42e919,_0x4b1232[_0xe729('0x3f')]);var _0x56b62a={'where':_0x42e919[_0xe729('0x3a')]};return db[_0xe729('0x29')][_0xe729('0x1f')](_0x56b62a)[_0xe729('0x22')](function(_0x19a183){_0x44f387[_0xe729('0x1f')]=_0x19a183;if(_0x4b1232[_0xe729('0x2f')]['includeAll']){_0x42e919['include']=[{'all':!![]}];}return db[_0xe729('0x29')][_0xe729('0x40')](_0x42e919);})[_0xe729('0x22')](function(_0x38e915){_0x44f387[_0xe729('0x41')]=_0x38e915;return _0x44f387;})[_0xe729('0x22')](respondWithFilteredResult(_0xf9e0d0,_0x42e919))['catch'](handleError(_0xf9e0d0,null));};exports[_0xe729('0x42')]=function(_0xe85723,_0x27e84a){var _0x52c46b={'raw':!![],'where':{'id':_0xe85723['params']['id']}},_0x200153={};_0x200153[_0xe729('0x2e')]=_['keys'](db[_0xe729('0x29')]['rawAttributes']);_0x200153[_0xe729('0x2f')]=_[_0xe729('0x30')](_0xe85723[_0xe729('0x2f')]);_0x200153['filters']=_[_0xe729('0x31')](_0x200153[_0xe729('0x2e')],_0x200153[_0xe729('0x2f')]);_0x52c46b[_0xe729('0x32')]=_['intersection'](_0x200153[_0xe729('0x2e')],qs[_0xe729('0x33')](_0xe85723['query'][_0xe729('0x33')]));_0x52c46b[_0xe729('0x32')]=_0x52c46b[_0xe729('0x32')]['length']?_0x52c46b[_0xe729('0x32')]:_0x200153['model'];if(_0xe85723[_0xe729('0x2f')]['includeAll']){_0x52c46b[_0xe729('0x43')]=[{'all':!![]}];}_0x52c46b=_[_0xe729('0x3d')]({},_0x52c46b,_0xe85723[_0xe729('0x3f')]);return db[_0xe729('0x29')][_0xe729('0x44')](_0x52c46b)[_0xe729('0x22')](handleEntityNotFound(_0x27e84a,null))[_0xe729('0x22')](respondWithResult(_0x27e84a,null))[_0xe729('0x45')](handleError(_0x27e84a,null));};exports[_0xe729('0x46')]=function(_0x2fb99a,_0x4e8cea){return db[_0xe729('0x29')]['create'](_0x2fb99a[_0xe729('0x47')],{})[_0xe729('0x22')](respondWithResult(_0x4e8cea,0xc9))['catch'](handleError(_0x4e8cea,null));};exports['update']=function(_0x4aa44a,_0x1e9ab8){if(_0x4aa44a[_0xe729('0x47')]['id']){delete _0x4aa44a[_0xe729('0x47')]['id'];}return db['WhatsappApplication'][_0xe729('0x44')]({'where':{'id':_0x4aa44a['params']['id']}})[_0xe729('0x22')](handleEntityNotFound(_0x1e9ab8,null))[_0xe729('0x22')](saveUpdates(_0x4aa44a[_0xe729('0x47')],null))[_0xe729('0x22')](respondWithResult(_0x1e9ab8,null))[_0xe729('0x45')](handleError(_0x1e9ab8,null));};exports[_0xe729('0x23')]=function(_0x3edf5a,_0x32280e){return db['WhatsappApplication'][_0xe729('0x44')]({'where':{'id':_0x3edf5a[_0xe729('0x48')]['id']}})[_0xe729('0x22')](handleEntityNotFound(_0x32280e,null))[_0xe729('0x22')](removeEntity(_0x32280e,null))['catch'](handleError(_0x32280e,null));}; \ No newline at end of file +var _0x11f1=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','end','json','count','offset','limit','status','Content-Range','apply','reject','update','then','sendStatus','error','name','send','WhatsappApplication','fieldName','type','key','model','map','query','filters','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','include','options'];(function(_0x55f867,_0x378f00){var _0x4742e3=function(_0x2dae7e){while(--_0x2dae7e){_0x55f867['push'](_0x55f867['shift']());}};_0x4742e3(++_0x378f00);}(_0x11f1,0x157));var _0x111f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x11f1[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x111f('0x0'));var rimraf=require(_0x111f('0x1'));var zipdir=require(_0x111f('0x2'));var jsonpatch=require(_0x111f('0x3'));var rp=require(_0x111f('0x4'));var moment=require(_0x111f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x111f('0x6'));var util=require(_0x111f('0x7'));var path=require(_0x111f('0x8'));var sox=require(_0x111f('0x9'));var csv=require(_0x111f('0xa'));var ejs=require(_0x111f('0xb'));var fs=require('fs');var _=require(_0x111f('0xc'));var squel=require(_0x111f('0xd'));var crypto=require(_0x111f('0xe'));var jsforce=require(_0x111f('0xf'));var deskjs=require(_0x111f('0x10'));var toCsv=require(_0x111f('0xa'));var querystring=require(_0x111f('0x11'));var Papa=require(_0x111f('0x12'));var Redis=require(_0x111f('0x13'));var authService=require(_0x111f('0x14'));var qs=require(_0x111f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x111f('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x111f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x556f20,_0x50e81f){_0x50e81f=_0x50e81f||0xcc;return function(_0x8b7e1d){if(_0x8b7e1d){return _0x556f20['sendStatus'](_0x50e81f);}return _0x556f20['status'](_0x50e81f)[_0x111f('0x18')]();};}function respondWithResult(_0x2edeb6,_0x4c78b8){_0x4c78b8=_0x4c78b8||0xc8;return function(_0x373da0){if(_0x373da0){return _0x2edeb6['status'](_0x4c78b8)[_0x111f('0x19')](_0x373da0);}};}function respondWithFilteredResult(_0x56ed22,_0x1437a5){return function(_0x111da0){if(_0x111da0){var _0x4513ca=_0x111da0[_0x111f('0x1a')],_0xa0a199=_0x1437a5[_0x111f('0x1b')],_0x2013f0=_0x1437a5['offset']+_0x1437a5[_0x111f('0x1c')],_0x4a359f;if(_0x2013f0>=_0x4513ca){_0x2013f0=_0x4513ca;_0x4a359f=0xc8;}else{_0x4a359f=0xce;}_0x56ed22[_0x111f('0x1d')](_0x4a359f);return _0x56ed22['set'](_0x111f('0x1e'),_0xa0a199+'-'+_0x2013f0+'/'+_0x4513ca)[_0x111f('0x19')](_0x111da0);}return null;};}function patchUpdates(_0x110474){return function(_0x100105){try{jsonpatch[_0x111f('0x1f')](_0x100105,_0x110474,!![]);}catch(_0x1542ee){return BPromise[_0x111f('0x20')](_0x1542ee);}return _0x100105['save']();};}function saveUpdates(_0x306401,_0x50607b){return function(_0x45ccd8){if(_0x45ccd8){return _0x45ccd8[_0x111f('0x21')](_0x306401)['then'](function(_0x918e21){return _0x918e21;});}return null;};}function removeEntity(_0x46358b,_0xbf8d2e){return function(_0x1dd701){if(_0x1dd701){return _0x1dd701['destroy']()[_0x111f('0x22')](function(){_0x46358b[_0x111f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58b085,_0x2fd51a){return function(_0x5c33b0){if(!_0x5c33b0){_0x58b085[_0x111f('0x23')](0x194);}return _0x5c33b0;};}function handleError(_0x9baaf1,_0x4b2b49){_0x4b2b49=_0x4b2b49||0x1f4;return function(_0x55f7f9){logger[_0x111f('0x24')](_0x55f7f9['stack']);if(_0x55f7f9[_0x111f('0x25')]){delete _0x55f7f9[_0x111f('0x25')];}_0x9baaf1[_0x111f('0x1d')](_0x4b2b49)[_0x111f('0x26')](_0x55f7f9);};}exports['index']=function(_0x5549f4,_0x116bfd){var _0x5689f3={},_0x5a7842={},_0x2589fe={'count':0x0,'rows':[]};var _0x334f65=_['map'](db[_0x111f('0x27')]['rawAttributes'],function(_0x1c3498){return{'name':_0x1c3498[_0x111f('0x28')],'type':_0x1c3498[_0x111f('0x29')][_0x111f('0x2a')]};});_0x5a7842[_0x111f('0x2b')]=_[_0x111f('0x2c')](_0x334f65,'name');_0x5a7842[_0x111f('0x2d')]=_['keys'](_0x5549f4['query']);_0x5a7842[_0x111f('0x2e')]=_['intersection'](_0x5a7842[_0x111f('0x2b')],_0x5a7842['query']);_0x5689f3[_0x111f('0x2f')]=_['intersection'](_0x5a7842[_0x111f('0x2b')],qs[_0x111f('0x30')](_0x5549f4[_0x111f('0x2d')][_0x111f('0x30')]));_0x5689f3[_0x111f('0x2f')]=_0x5689f3[_0x111f('0x2f')][_0x111f('0x31')]?_0x5689f3[_0x111f('0x2f')]:_0x5a7842[_0x111f('0x2b')];if(!_0x5549f4['query']['hasOwnProperty'](_0x111f('0x32'))){_0x5689f3['limit']=qs[_0x111f('0x1c')](_0x5549f4[_0x111f('0x2d')][_0x111f('0x1c')]);_0x5689f3[_0x111f('0x1b')]=qs[_0x111f('0x1b')](_0x5549f4[_0x111f('0x2d')][_0x111f('0x1b')]);}_0x5689f3[_0x111f('0x33')]=qs[_0x111f('0x34')](_0x5549f4['query'][_0x111f('0x34')]);_0x5689f3['where']=qs['filters'](_['pick'](_0x5549f4[_0x111f('0x2d')],_0x5a7842[_0x111f('0x2e')]),_0x334f65);if(_0x5549f4[_0x111f('0x2d')]['filter']){_0x5689f3[_0x111f('0x35')]=_[_0x111f('0x36')](_0x5689f3[_0x111f('0x35')],{'$or':_[_0x111f('0x2c')](_0x334f65,function(_0x747fb3){if(_0x747fb3[_0x111f('0x29')]!==_0x111f('0x37')){var _0x5d6868={};_0x5d6868[_0x747fb3[_0x111f('0x25')]]={'$like':'%'+_0x5549f4[_0x111f('0x2d')]['filter']+'%'};return _0x5d6868;}})});}_0x5689f3=_['merge']({},_0x5689f3,_0x5549f4['options']);var _0x5787ba={'where':_0x5689f3[_0x111f('0x35')]};return db[_0x111f('0x27')][_0x111f('0x1a')](_0x5787ba)[_0x111f('0x22')](function(_0x325a55){_0x2589fe[_0x111f('0x1a')]=_0x325a55;if(_0x5549f4[_0x111f('0x2d')][_0x111f('0x38')]){_0x5689f3['include']=[{'all':!![]}];}return db[_0x111f('0x27')][_0x111f('0x39')](_0x5689f3);})[_0x111f('0x22')](function(_0x1e356b){_0x2589fe[_0x111f('0x3a')]=_0x1e356b;return _0x2589fe;})['then'](respondWithFilteredResult(_0x116bfd,_0x5689f3))[_0x111f('0x3b')](handleError(_0x116bfd,null));};exports[_0x111f('0x3c')]=function(_0x1bf62b,_0xb23f6b){var _0x5f2f7a={'raw':!![],'where':{'id':_0x1bf62b[_0x111f('0x3d')]['id']}},_0x5f3cad={};_0x5f3cad[_0x111f('0x2b')]=_[_0x111f('0x3e')](db[_0x111f('0x27')]['rawAttributes']);_0x5f3cad[_0x111f('0x2d')]=_['keys'](_0x1bf62b[_0x111f('0x2d')]);_0x5f3cad['filters']=_['intersection'](_0x5f3cad['model'],_0x5f3cad[_0x111f('0x2d')]);_0x5f2f7a[_0x111f('0x2f')]=_['intersection'](_0x5f3cad[_0x111f('0x2b')],qs[_0x111f('0x30')](_0x1bf62b[_0x111f('0x2d')][_0x111f('0x30')]));_0x5f2f7a[_0x111f('0x2f')]=_0x5f2f7a[_0x111f('0x2f')][_0x111f('0x31')]?_0x5f2f7a[_0x111f('0x2f')]:_0x5f3cad[_0x111f('0x2b')];if(_0x1bf62b[_0x111f('0x2d')][_0x111f('0x38')]){_0x5f2f7a[_0x111f('0x3f')]=[{'all':!![]}];}_0x5f2f7a=_[_0x111f('0x36')]({},_0x5f2f7a,_0x1bf62b[_0x111f('0x40')]);return db['WhatsappApplication'][_0x111f('0x41')](_0x5f2f7a)[_0x111f('0x22')](handleEntityNotFound(_0xb23f6b,null))[_0x111f('0x22')](respondWithResult(_0xb23f6b,null))[_0x111f('0x3b')](handleError(_0xb23f6b,null));};exports[_0x111f('0x42')]=function(_0x5564ba,_0x52de9d){return db['WhatsappApplication'][_0x111f('0x42')](_0x5564ba[_0x111f('0x43')],{})[_0x111f('0x22')](respondWithResult(_0x52de9d,0xc9))[_0x111f('0x3b')](handleError(_0x52de9d,null));};exports['update']=function(_0x4e49be,_0x280a3c){if(_0x4e49be[_0x111f('0x43')]['id']){delete _0x4e49be['body']['id'];}return db['WhatsappApplication'][_0x111f('0x41')]({'where':{'id':_0x4e49be[_0x111f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x280a3c,null))[_0x111f('0x22')](saveUpdates(_0x4e49be[_0x111f('0x43')],null))[_0x111f('0x22')](respondWithResult(_0x280a3c,null))[_0x111f('0x3b')](handleError(_0x280a3c,null));};exports['destroy']=function(_0x303850,_0x58b08f){return db['WhatsappApplication'][_0x111f('0x41')]({'where':{'id':_0x303850[_0x111f('0x3d')]['id']}})[_0x111f('0x22')](handleEntityNotFound(_0x58b08f,null))[_0x111f('0x22')](removeEntity(_0x58b08f,null))[_0x111f('0x3b')](handleError(_0x58b08f,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index dd137f7..6463947 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 _0xe184=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports','WhatsappApplication'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0xe184,0xc7));var _0x4e18=function(_0x153fb1,_0x24c9fb){_0x153fb1=_0x153fb1-0x0;var _0x5e2b92=_0xe184[_0x153fb1];return _0x5e2b92;};'use strict';var _=require(_0x4e18('0x0'));var util=require(_0x4e18('0x1'));var logger=require('../../config/logger')(_0x4e18('0x2'));var moment=require(_0x4e18('0x3'));var BPromise=require(_0x4e18('0x4'));var rp=require(_0x4e18('0x5'));var fs=require('fs');var path=require(_0x4e18('0x6'));var rimraf=require(_0x4e18('0x7'));var config=require('../../config/environment');var attributes=require(_0x4e18('0x8'));module[_0x4e18('0x9')]=function(_0x28dc1c,_0x238235){return _0x28dc1c['define'](_0x4e18('0xa'),attributes,{'tableName':_0x4e18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4e18('0xc'),'collate':_0x4e18('0xd')});}; \ No newline at end of file +var _0x69c4=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x353995,_0x1c8b51){var _0x21fe70=function(_0x3cf31d){while(--_0x3cf31d){_0x353995['push'](_0x353995['shift']());}};_0x21fe70(++_0x1c8b51);}(_0x69c4,0x6e));var _0x469c=function(_0x235bfd,_0x341c83){_0x235bfd=_0x235bfd-0x0;var _0x4b234a=_0x69c4[_0x235bfd];return _0x4b234a;};'use strict';var _=require(_0x469c('0x0'));var util=require(_0x469c('0x1'));var logger=require(_0x469c('0x2'))(_0x469c('0x3'));var moment=require(_0x469c('0x4'));var BPromise=require(_0x469c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x469c('0x6'));var config=require(_0x469c('0x7'));var attributes=require(_0x469c('0x8'));module[_0x469c('0x9')]=function(_0x285f2e,_0x1bb9af){return _0x285f2e[_0x469c('0xa')](_0x469c('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x469c('0xc'),'collate':_0x469c('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 067c247..43e7756 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 _0x14f5=['WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2b0f30,_0x43201f){var _0x2f41c2=function(_0x4d552d){while(--_0x4d552d){_0x2b0f30['push'](_0x2b0f30['shift']());}};_0x2f41c2(++_0x43201f);}(_0x14f5,0xae));var _0x514f=function(_0x25c879,_0x4e2b80){_0x25c879=_0x25c879-0x0;var _0x3d3ec6=_0x14f5[_0x25c879];return _0x3d3ec6;};'use strict';var _=require('lodash');var util=require(_0x514f('0x0'));var moment=require('moment');var BPromise=require(_0x514f('0x1'));var rs=require(_0x514f('0x2'));var fs=require('fs');var Redis=require(_0x514f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x514f('0x4'));var logger=require(_0x514f('0x5'))('rpc');var config=require(_0x514f('0x6'));var jayson=require(_0x514f('0x7'));var client=jayson[_0x514f('0x8')][_0x514f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x463985,_0x43ec42,_0xdb9614){return new BPromise(function(_0x4a5497,_0x203b02){return client['request'](_0x463985,_0xdb9614)[_0x514f('0xa')](function(_0x1e3fa7){logger[_0x514f('0xb')](_0x514f('0xc'),_0x43ec42,_0x514f('0xd'));logger[_0x514f('0xe')](_0x514f('0xf'),_0x43ec42,'request\x20sent',JSON['stringify'](_0x1e3fa7));if(_0x1e3fa7['error']){if(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x11')]===0x1f4){logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);return _0x203b02(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);}logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);return _0x4a5497(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);}else{logger[_0x514f('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x43ec42,_0x514f('0xd'));_0x4a5497(_0x1e3fa7[_0x514f('0x13')]['message']);}})[_0x514f('0x14')](function(_0x53851d){logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x53851d);_0x203b02(_0x53851d);});});} \ No newline at end of file +var _0x979e=['info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x979e,0x195));var _0xe979=function(_0x15dafa,_0xec8caa){_0x15dafa=_0x15dafa-0x0;var _0x41e2e0=_0x979e[_0x15dafa];return _0x41e2e0;};'use strict';var _=require(_0xe979('0x0'));var util=require(_0xe979('0x1'));var moment=require(_0xe979('0x2'));var BPromise=require(_0xe979('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe979('0x4'));var db=require(_0xe979('0x5'))['db'];var utils=require(_0xe979('0x6'));var logger=require(_0xe979('0x7'))(_0xe979('0x8'));var config=require('../../config/environment');var jayson=require(_0xe979('0x9'));var client=jayson['client'][_0xe979('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13a9ee,_0x441ffe,_0xc63524){return new BPromise(function(_0xc79c06,_0x3bbc32){return client[_0xe979('0xb')](_0x13a9ee,_0xc63524)[_0xe979('0xc')](function(_0x431a91){logger[_0xe979('0xd')](_0xe979('0xe'),_0x441ffe,'request\x20sent');logger[_0xe979('0xf')](_0xe979('0x10'),_0x441ffe,_0xe979('0x11'),JSON['stringify'](_0x431a91));if(_0x431a91[_0xe979('0x12')]){if(_0x431a91[_0xe979('0x12')][_0xe979('0x13')]===0x1f4){logger[_0xe979('0x12')](_0xe979('0xe'),_0x441ffe,_0x431a91[_0xe979('0x12')][_0xe979('0x14')]);return _0x3bbc32(_0x431a91[_0xe979('0x12')]['message']);}logger[_0xe979('0x12')](_0xe979('0xe'),_0x441ffe,_0x431a91[_0xe979('0x12')]['message']);return _0xc79c06(_0x431a91['error'][_0xe979('0x14')]);}else{logger[_0xe979('0xd')](_0xe979('0xe'),_0x441ffe,_0xe979('0x11'));_0xc79c06(_0x431a91['result'][_0xe979('0x14')]);}})[_0xe979('0x15')](function(_0xcb7fa1){logger[_0xe979('0x12')](_0xe979('0xe'),_0x441ffe,_0xcb7fa1);_0x3bbc32(_0xcb7fa1);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f189d50..dd321ff 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 _0x91e7=['update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x262b53,_0x5b8dd3){var _0x1d774c=function(_0x44a0eb){while(--_0x44a0eb){_0x262b53['push'](_0x262b53['shift']());}};_0x1d774c(++_0x5b8dd3);}(_0x91e7,0x150));var _0x791e=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x91e7[_0x264545];return _0x114d10;};'use strict';var multer=require(_0x791e('0x0'));var util=require(_0x791e('0x1'));var path=require(_0x791e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x791e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x791e('0x4'));var controller=require(_0x791e('0x5'));router[_0x791e('0x6')]('/',auth[_0x791e('0x7')](),controller['index']);router[_0x791e('0x6')](_0x791e('0x8'),auth[_0x791e('0x7')](),controller['describe']);router['get'](_0x791e('0x9'),auth[_0x791e('0x7')](),controller[_0x791e('0xa')]);router['get'](_0x791e('0xb'),auth['isAuthenticated'](),controller[_0x791e('0xc')]);router[_0x791e('0x6')](_0x791e('0xd'),auth['isAuthenticated'](),controller[_0x791e('0xe')]);router['post']('/',auth[_0x791e('0x7')](),controller[_0x791e('0xf')]);router[_0x791e('0x10')](_0x791e('0xb'),auth[_0x791e('0x7')](),controller[_0x791e('0x11')]);router['post']('/:id/tags',auth[_0x791e('0x7')](),interaction[_0x791e('0x12')](_0x791e('0x13'),_0x791e('0x14')),controller[_0x791e('0x15')]);router[_0x791e('0x16')](_0x791e('0x9'),auth['isAuthenticated'](),interaction['tracked'](_0x791e('0x13'),_0x791e('0x17')),controller[_0x791e('0x18')]);router[_0x791e('0x19')](_0x791e('0x9'),auth[_0x791e('0x7')](),interaction[_0x791e('0x12')](_0x791e('0x13'),_0x791e('0x1a')),controller[_0x791e('0x1b')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x791e('0x1c')]);module[_0x791e('0x1d')]=router; \ No newline at end of file +var _0x5e78=['multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','/:id','whatsappinteraction:destroy','destroy','delete','exports'];(function(_0x3a06dd,_0x26115c){var _0x5a36a6=function(_0xadc344){while(--_0xadc344){_0x3a06dd['push'](_0x3a06dd['shift']());}};_0x5a36a6(++_0x26115c);}(_0x5e78,0x91));var _0x85e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e78[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x85e7('0x0'));var util=require(_0x85e7('0x1'));var path=require('path');var timeout=require(_0x85e7('0x2'));var express=require(_0x85e7('0x3'));var router=express['Router']();var auth=require(_0x85e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x85e7('0x5'));var controller=require(_0x85e7('0x6'));router[_0x85e7('0x7')]('/',auth[_0x85e7('0x8')](),controller[_0x85e7('0x9')]);router[_0x85e7('0x7')](_0x85e7('0xa'),auth[_0x85e7('0x8')](),controller[_0x85e7('0xb')]);router['get']('/:id',auth[_0x85e7('0x8')](),controller[_0x85e7('0xc')]);router['get']('/:id/messages',auth[_0x85e7('0x8')](),controller['getMessages']);router[_0x85e7('0x7')](_0x85e7('0xd'),auth['isAuthenticated'](),controller[_0x85e7('0xe')]);router[_0x85e7('0xf')]('/',auth[_0x85e7('0x8')](),controller['create']);router[_0x85e7('0xf')]('/:id/messages',auth[_0x85e7('0x8')](),controller[_0x85e7('0x10')]);router[_0x85e7('0xf')](_0x85e7('0x11'),auth[_0x85e7('0x8')](),interaction[_0x85e7('0x12')](_0x85e7('0x13'),_0x85e7('0x14')),controller['addTags']);router[_0x85e7('0x15')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x85e7('0x13'),_0x85e7('0x16')),controller[_0x85e7('0x17')]);router['delete'](_0x85e7('0x18'),auth['isAuthenticated'](),interaction[_0x85e7('0x12')](_0x85e7('0x13'),_0x85e7('0x19')),controller[_0x85e7('0x1a')]);router[_0x85e7('0x1b')](_0x85e7('0x11'),auth[_0x85e7('0x8')](),controller['removeTags']);module[_0x85e7('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 1ea2410..821fd30 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 _0xc5c0=['DATE','ENUM','out','sequelize','moment','exports','STRING'];(function(_0x41a5b3,_0x1eff7e){var _0x40b41e=function(_0x2e4d80){while(--_0x2e4d80){_0x41a5b3['push'](_0x41a5b3['shift']());}};_0x40b41e(++_0x1eff7e);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x297d33,_0x3af10c){_0x297d33=_0x297d33-0x0;var _0x2944c6=_0xc5c0[_0x297d33];return _0x2944c6;};'use strict';var Sequelize=require(_0x0c5c('0x0'));var moment=require(_0x0c5c('0x1'));module[_0x0c5c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0c5c('0x3')]},'secondDisposition':{'type':Sequelize[_0x0c5c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0c5c('0x3')]},'phone':{'type':Sequelize[_0x0c5c('0x3')]},'read1stAt':{'type':Sequelize[_0x0c5c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0c5c('0x5')]('in',_0x0c5c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0c5c('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x0c5c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xdcb9=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x10b364,_0x425c77){var _0x194772=function(_0x4847a3){while(--_0x4847a3){_0x10b364['push'](_0x10b364['shift']());}};_0x194772(++_0x425c77);}(_0xdcb9,0xa7));var _0x9dcb=function(_0x74a268,_0x1c07d6){_0x74a268=_0x74a268-0x0;var _0x3ad88e=_0xdcb9[_0x74a268];return _0x3ad88e;};'use strict';var Sequelize=require(_0x9dcb('0x0'));var moment=require('moment');module[_0x9dcb('0x1')]={'closed':{'type':Sequelize[_0x9dcb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9dcb('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9dcb('0x3')]},'read1stAt':{'type':Sequelize[_0x9dcb('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9dcb('0x5')]('in',_0x9dcb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9dcb('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 1984bee..ddd2e39 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 _0x7a54=['N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Messages','existsSync','createWriteStream','out','System','firstName','basename','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','count','offset','limit','Content-Range','json','apply','save','then','destroy','sendStatus','error','stack','name','send','Users','TagIds','Tags','index','WhatsappInteraction','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','field','from','tools_tags','u.id','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','length','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','body','start','some','compact','forEach','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','toString','keyBy','merge','unreadMessages','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','sequelize','WhatsappInteractionId','push','all','catch','show','params','include','create','describe','addMessage','WhatsappMessage','ids','omit','findOne','format','options','includeAll','findAll','rows','addTags','setTags','color','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','fullname','lastName','Attachment','direction','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','YYYY-MM-DD','Account'];(function(_0x4a6f60,_0x1f3d95){var _0x5579cf=function(_0x14cdb1){while(--_0x14cdb1){_0x4a6f60['push'](_0x4a6f60['shift']());}};_0x5579cf(++_0x1f3d95);}(_0x7a54,0x106));var _0x47a5=function(_0x2905fd,_0x3ec7a1){_0x2905fd=_0x2905fd-0x0;var _0x5273ca=_0x7a54[_0x2905fd];return _0x5273ca;};'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 licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];config[_0x47a5('0x16')]=_[_0x47a5('0x17')](config['redis'],{'host':_0x47a5('0x18'),'port':0x18eb});var socket=require(_0x47a5('0x19'))(new Redis(config[_0x47a5('0x16')]));require(_0x47a5('0x1a'))[_0x47a5('0x1b')](socket);function respondWithStatusCode(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xcc;return function(_0x190faa){if(_0x190faa){return _0x620ee9['sendStatus'](_0x3c6c46);}return _0x620ee9[_0x47a5('0x1c')](_0x3c6c46)[_0x47a5('0x1d')]();};}function respondWithResult(_0x3b001e,_0x2a2cbb){_0x2a2cbb=_0x2a2cbb||0xc8;return function(_0x1ef44c){if(_0x1ef44c){return _0x3b001e['status'](_0x2a2cbb)['json'](_0x1ef44c);}};}function respondWithFilteredResult(_0x138bc0,_0x4b966e){return function(_0x5247fd){if(_0x5247fd){var _0x423a81=_0x5247fd[_0x47a5('0x1e')],_0xaf70a6=_0x4b966e[_0x47a5('0x1f')],_0x2ce454=_0x4b966e[_0x47a5('0x1f')]+_0x4b966e[_0x47a5('0x20')],_0x1ef371;if(_0x2ce454>=_0x423a81){_0x2ce454=_0x423a81;_0x1ef371=0xc8;}else{_0x1ef371=0xce;}_0x138bc0[_0x47a5('0x1c')](_0x1ef371);return _0x138bc0['set'](_0x47a5('0x21'),_0xaf70a6+'-'+_0x2ce454+'/'+_0x423a81)[_0x47a5('0x22')](_0x5247fd);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x23')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x24')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x25')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x26')]()[_0x47a5('0x25')](function(){_0x513981[_0x47a5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53078a,_0x136745){return function(_0x5686db){if(!_0x5686db){_0x53078a[_0x47a5('0x27')](0x194);}return _0x5686db;};}function handleError(_0x5b6c4e,_0x23cb77){_0x23cb77=_0x23cb77||0x1f4;return function(_0x378208){logger[_0x47a5('0x28')](_0x378208[_0x47a5('0x29')]);if(_0x378208[_0x47a5('0x2a')]){delete _0x378208[_0x47a5('0x2a')];}_0x5b6c4e[_0x47a5('0x1c')](_0x23cb77)[_0x47a5('0x2b')](_0x378208);};}function getInteractionUsers(_0x16631f,_0x361bfa){return new BPromise(function(_0x1127f8,_0x11a4fa){try{if(_0x361bfa[_0x16631f['id']]){_0x16631f[_0x47a5('0x2c')]=_['map'](_0x361bfa[_0x16631f['id']],function(_0x243210){return{'id':_0x243210['id'],'fullname':_0x243210['fullname']};});}}catch(_0x2ef875){_0x11a4fa(_0x2ef875);}_0x1127f8(_0x16631f);});}function getInteractionTags(_0x9ac908,_0x16901f){return new BPromise(function(_0x4d6b57,_0x256650){try{if(_0x9ac908[_0x47a5('0x2d')]){_0x9ac908[_0x47a5('0x2e')]=[];_0x9ac908[_0x47a5('0x2d')]['split'](',')['forEach'](function(_0x6f9a12){_0x9ac908[_0x47a5('0x2e')]['push'](_0x16901f[_0x6f9a12]);});}delete _0x9ac908['TagIds'];}catch(_0x836303){_0x256650(_0x836303);}_0x4d6b57(_0x9ac908);});}function updateWhatsappInteraction(_0x51544e,_0x57bff6,_0x42f70c){return new BPromise(function(_0x53119b,_0x122ed6){return getInteractionUsers(_0x51544e,_0x42f70c)[_0x47a5('0x25')](function(_0x5c5162){return getInteractionTags(_0x5c5162,_0x57bff6);})['then'](function(_0x274e34){_0x53119b(_0x274e34);})['catch'](function(_0x403028){_0x122ed6(_0x403028);});});}exports[_0x47a5('0x2f')]=function(_0xf269a8,_0x52749b){var _0x18f7e9={},_0x50c086={},_0x53c754={'count':0x0,'rows':[]};var _0x65542e=_['map'](db[_0x47a5('0x30')]['rawAttributes'],function(_0x21ad34){return{'name':_0x21ad34[_0x47a5('0x31')],'type':_0x21ad34[_0x47a5('0x32')][_0x47a5('0x33')]};});_0x50c086[_0x47a5('0x34')]=_[_0x47a5('0x35')](_0x65542e,_0x47a5('0x2a'));_0x50c086[_0x47a5('0x36')]=_[_0x47a5('0x37')](_0xf269a8['query']);_0x50c086[_0x47a5('0x38')]=_[_0x47a5('0x39')](_0x50c086['model'],_0x50c086[_0x47a5('0x36')]);_0x18f7e9[_0x47a5('0x3a')]=_[_0x47a5('0x39')](_0x50c086['model'],qs[_0x47a5('0x3b')](_0xf269a8[_0x47a5('0x36')]['fields']));_0x18f7e9[_0x47a5('0x3a')]=_0x18f7e9[_0x47a5('0x3a')]['length']?_0x18f7e9['attributes']:_0x50c086['model'];if(!_0xf269a8[_0x47a5('0x36')]['hasOwnProperty'](_0x47a5('0x3c'))){_0x18f7e9[_0x47a5('0x20')]=qs[_0x47a5('0x20')](_0xf269a8[_0x47a5('0x36')][_0x47a5('0x20')]);_0x18f7e9[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0xf269a8[_0x47a5('0x36')][_0x47a5('0x1f')]);}_0x18f7e9[_0x47a5('0x3d')]=qs[_0x47a5('0x3e')](_0xf269a8[_0x47a5('0x36')][_0x47a5('0x3e')]);_0x18f7e9['where']=qs[_0x47a5('0x38')](_[_0x47a5('0x3f')](_0xf269a8[_0x47a5('0x36')],_0x50c086[_0x47a5('0x38')]),_0x65542e);var _0x586f4f=[];var _0x7de536=squel['select']()['field']('id')['field']('name')[_0x47a5('0x40')]('color')[_0x47a5('0x41')](_0x47a5('0x42'));var _0x448610=squel['select']()[_0x47a5('0x40')](_0x47a5('0x43'))['field']('u.fullname')[_0x47a5('0x40')]('ui.WhatsappInteractionId')[_0x47a5('0x41')](_0x47a5('0x44'),'ui')[_0x47a5('0x45')](_0x47a5('0x46'),'u',_0x47a5('0x47'));var _0xf0edbb=squel[_0x47a5('0x48')]()[_0x47a5('0x41')](_0x47a5('0x49'),'i')[_0x47a5('0x45')](_0x47a5('0x4a'),'c',_0x47a5('0x4b'))[_0x47a5('0x45')](_0x47a5('0x46'),'o',_0x47a5('0x4c'))[_0x47a5('0x45')]('whatsapp_accounts','a',_0x47a5('0x4d'))[_0x47a5('0x45')]('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x45')]('whatsapp_interaction_has_tags','it',_0x47a5('0x4e'))[_0x47a5('0x45')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3d85cc=squel['expr']();var _0x2d147c=[];var _0x1d1039=squel[_0x47a5('0x4f')]();var _0x3e12a7;if(_0xf269a8[_0x47a5('0x36')][_0x47a5('0x50')]){_0x3e12a7=as[_0x47a5('0x51')](_0xf269a8['query']['search']);var _0x2dd1db=_0x3e12a7[_0x47a5('0x52')];for(var _0x1163e3=0x0;_0x1163e3<_0x3e12a7[_0x47a5('0x53')][_0x47a5('0x54')];_0x1163e3++){var _0x2c0c86=_0x3e12a7[_0x47a5('0x53')][_0x1163e3];var _0x492cf7='i';var _0x45cca5=_[_0x47a5('0x55')](_0x65542e,[_0x47a5('0x2a'),_0x2c0c86['field']]);if(!_0x45cca5){switch(_0x2c0c86[_0x47a5('0x40')]){case'unreadMessages':if(_0x2c0c86[_0x47a5('0x56')]==0x1){_0xf0edbb[_0x47a5('0x57')]('`'+_0x2c0c86[_0x47a5('0x40')]+_0x47a5('0x58'));}else{_0xf0edbb['having']('`'+_0x2c0c86[_0x47a5('0x40')]+_0x47a5('0x59'));}break;case _0x47a5('0x5a'):if(_0x2c0c86[_0x47a5('0x5b')]===_0x47a5('0x5c')){if(_0x2c0c86[_0x47a5('0x56')][_0x47a5('0x5d')]('\x20')['length']>0x1){_0x3d85cc[_0x2dd1db](_0x47a5('0x5e'),qs[_0x47a5('0x5f')](_0x2c0c86[_0x47a5('0x56')]),null);}else{var _0x8da9fb='%'+_0x2c0c86[_0x47a5('0x56')]+'%';_0x3d85cc[_0x2dd1db](_0x47a5('0x60'),_0x8da9fb,_0x8da9fb,_0x8da9fb);}}else{_0x45cca5=_['find'](_0x65542e,[_0x47a5('0x2a'),_0x47a5('0x61')]);_0x2c0c86[_0x47a5('0x40')]='ContactId';_0x5eb150=as[_0x47a5('0x62')](_0x492cf7,_0x45cca5[_0x47a5('0x32')],_0x2c0c86);_0x3d85cc[_0x2dd1db](_0x5eb150[_0x47a5('0x63')],_0x5eb150['value']['start'],_0x5eb150[_0x47a5('0x56')][_0x47a5('0x1d')]);}break;case'Tag':var _0x4cf792=_0x2c0c86[_0x47a5('0x56')]['split'](',')[_0x47a5('0x35')](function(_0x5d383d){return Number(_0x5d383d);});_0x4cf792['forEach'](function(_0x389ed9){_0x1d1039['or'](_0x47a5('0x64'),'%,'+_0x389ed9+',%');});_0x2d147c=_['union'](_0x2d147c,_0x4cf792);break;case _0x47a5('0x65'):if(_0x2c0c86[_0x47a5('0x5b')]==='$substring'){_0x3d85cc[_0x2dd1db]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c0c86[_0x47a5('0x56')]+'%',null);}else{_0x45cca5=_[_0x47a5('0x55')](_0x65542e,[_0x47a5('0x2a'),_0x47a5('0x66')]);_0x2c0c86['field']=_0x47a5('0x66');_0x5eb150=as[_0x47a5('0x62')](_0x492cf7,_0x45cca5[_0x47a5('0x32')],_0x2c0c86);_0x3d85cc[_0x2dd1db](_0x5eb150['text'],_0x5eb150[_0x47a5('0x56')]['start'],_0x5eb150[_0x47a5('0x56')][_0x47a5('0x1d')]);}break;case _0x47a5('0x67'):_0x5eb150=as[_0x47a5('0x62')]('me',null,_0x2c0c86);_0x3d85cc[_0x2dd1db](_0x5eb150[_0x47a5('0x63')],_0x5eb150['value'][_0x47a5('0x68')],_0x5eb150['value']['end']);break;}}else{var _0x5eb150=as['buildExpression'](_0x492cf7,_0x45cca5[_0x47a5('0x32')],_0x2c0c86);_0x3d85cc[_0x2dd1db](_0x5eb150[_0x47a5('0x63')],_0x5eb150[_0x47a5('0x56')]['start'],_0x5eb150['value'][_0x47a5('0x1d')]);}}}else{var _0x23020b=_(_0xf269a8[_0x47a5('0x36')])[_0x47a5('0x37')]()[_0x47a5('0x35')](function(_0x4b5d0c){return _[_0x47a5('0x69')](_0x65542e,['name',_0x4b5d0c])?_0x4b5d0c:undefined;})[_0x47a5('0x6a')]()[_0x47a5('0x56')]();if(!_['isEmpty'](_0x23020b)){_0x23020b[_0x47a5('0x6b')](function(_0x345104){if(_0x345104===_0x47a5('0x6c')){_0xf0edbb[_0x47a5('0x6d')](_0x47a5('0x6e'),[][_0x47a5('0x6f')](_0xf269a8[_0x47a5('0x36')][_0x345104]));}else if(_0x345104===_0x47a5('0x70')){var _0x57ed0a=JSON[_0x47a5('0x71')](_0xf269a8[_0x47a5('0x36')][_0x345104])[_0x47a5('0x72')];var _0x26e7fc=JSON[_0x47a5('0x71')](_0xf269a8['query'][_0x345104])[_0x47a5('0x73')];_0xf0edbb[_0x47a5('0x6d')](_0x47a5('0x74'),_0x57ed0a,_0x26e7fc);}else{if(_0xf269a8[_0x47a5('0x36')][_0x345104]===_0x47a5('0x75')){_0xf0edbb[_0x47a5('0x6d')]('i.'+_0x345104+_0x47a5('0x76'));}else{_0xf0edbb[_0x47a5('0x6d')]('i.'+_0x345104+_0x47a5('0x77'),_0xf269a8[_0x47a5('0x36')][_0x345104]);}}});}if(_0xf269a8[_0x47a5('0x36')][_0x47a5('0x78')]){if(_0xf269a8[_0x47a5('0x36')][_0x47a5('0x78')]==0x1){_0xf0edbb[_0x47a5('0x57')]('`unreadMessages`\x20=\x200');}else{_0xf0edbb[_0x47a5('0x57')](_0x47a5('0x79'));}}if(_0xf269a8[_0x47a5('0x36')]['tag']){_0x2d147c=_[_0x47a5('0x7a')](_0xf269a8[_0x47a5('0x36')][_0x47a5('0x7b')])?_0xf269a8[_0x47a5('0x36')]['tag']:new Array(_0xf269a8[_0x47a5('0x36')]['tag']);_0x2d147c[_0x47a5('0x6b')](function(_0x487e21){_0x1d1039['or'](_0x47a5('0x64'),'%,'+_0x487e21+',%');});}if(_0xf269a8['query'][_0x47a5('0x7c')]){var _0x2f27c3=_0xf269a8[_0x47a5('0x36')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x47a5('0x7d')](_0x2f27c3)){_0x3d85cc['or'](_0x47a5('0x7e'),_0x2f27c3+'%')['or'](_0x47a5('0x7f'),_0x2f27c3+'%');}else{_0x3d85cc['or'](_0x47a5('0x80'),qs['getFullTextValue'](_0x2f27c3))['or'](_0x47a5('0x81'),_0x2f27c3+'%');}}}_0xf0edbb[_0x47a5('0x6d')](_0x3d85cc);_0xf0edbb[_0x47a5('0x82')](_0x47a5('0x83'));var _0x308c9a={'type':db[_0x47a5('0x84')][_0x47a5('0x85')][_0x47a5('0x86')],'raw':!![]};var _0x4618a0=_0xf0edbb[_0x47a5('0x87')]();_0x4618a0[_0x47a5('0x40')](_0x47a5('0x83'));_0x4618a0['field'](_0x47a5('0x88'),'unreadMessages');if(_0x18f7e9[_0x47a5('0x3d')]){_0x18f7e9[_0x47a5('0x3d')][_0x47a5('0x6b')](function(_0x12fec9){var _0x40e584=_0x12fec9[0x0]===_0x47a5('0x89')?_0x12fec9[0x0]:'i.'+_0x12fec9[0x0];_0xf0edbb[_0x47a5('0x3d')](_0x40e584,_0x12fec9[0x1]===_0x47a5('0x8a')?![]:!![]);});}if(!_[_0x47a5('0x8b')](_0x2d147c)){_0xf0edbb[_0x47a5('0x57')](_0x1d1039);_0x4618a0[_0x47a5('0x6d')](_0x47a5('0x8c'),_0x2d147c);}BPromise[_0x47a5('0x8d')]()[_0x47a5('0x25')](function(){if(!_0x3e12a7){if(_0xf269a8[_0x47a5('0x36')]['WhatsappAccountId'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0xf0edbb['where'](_0x47a5('0x8e'));return;}if(_0xf269a8[_0x47a5('0x8f')]['role']!==_0x47a5('0x90'))return;return _0xf269a8[_0x47a5('0x8f')][_0x47a5('0x91')]({'attributes':['id'],'raw':!![]})[_0x47a5('0x25')](function(_0x3cd335){if(_[_0x47a5('0x8b')](_0x3cd335)){_0x4618a0[_0x47a5('0x6d')](_0x47a5('0x92'));_0xf0edbb[_0x47a5('0x6d')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x6d')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x35')](_0x3cd335,'id'));_0xf0edbb[_0x47a5('0x6d')](_0x47a5('0x6e'),_['map'](_0x3cd335,'id'));}});})[_0x47a5('0x25')](function(){if(_0xf269a8[_0x47a5('0x8f')][_0x47a5('0x93')]==='agent'&&!_0x3e12a7&&!_0xf269a8[_0x47a5('0x36')]['WhatsappAccountId'])return[];return db['sequelize'][_0x47a5('0x36')](_0x4618a0[_0x47a5('0x94')](),_0x308c9a);})[_0x47a5('0x25')](function(_0x27333e){_0x53c754[_0x47a5('0x1e')]=_0x27333e[_0x47a5('0x54')];if(_0x53c754['count']===0x0)return[];return db['sequelize'][_0x47a5('0x36')](_0x7de536['toString'](),_0x308c9a)[_0x47a5('0x25')](function(_0x3fffd1){_0x586f4f=_[_0x47a5('0x95')](_0x3fffd1,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xf269a8[_0x47a5('0x36')]['fields']){_0x18f7e9['attributes'][_0x47a5('0x6b')](function(_0x391f8e){_0xf0edbb['field']('i.'+_0x391f8e);});}else{_0xf0edbb[_0x47a5('0x40')](_0x47a5('0x88'),_0x47a5('0x97'));_0xf0edbb['field'](_0x47a5('0x98'),'Account.key');_0xf0edbb[_0x47a5('0x40')](_0x47a5('0x99'),_0x47a5('0x9a'));_0xf0edbb['field'](_0x47a5('0x9b'),_0x47a5('0x89'));_0xf0edbb[_0x47a5('0x40')]('i.*');_0xf0edbb[_0x47a5('0x40')]('c.firstName',_0x47a5('0x9c'));_0xf0edbb['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0xf0edbb[_0x47a5('0x40')](_0x47a5('0x9f'),'Contact.email');_0xf0edbb[_0x47a5('0x40')](_0x47a5('0xa0'),_0x47a5('0xa1'));_0xf0edbb[_0x47a5('0x40')](_0x47a5('0xa2'),'Contact.mobile');_0xf0edbb['field'](_0x47a5('0xa3'),'Contact.fax');_0xf0edbb[_0x47a5('0x40')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0xf0edbb['field'](_0x47a5('0xa6'),_0x47a5('0xa7'));_0xf0edbb['field'](_0x47a5('0xa8'),_0x47a5('0x2d'));}if(_0x18f7e9[_0x47a5('0x20')])_0xf0edbb[_0x47a5('0x20')](_0x18f7e9['limit']);if(_0x18f7e9['offset'])_0xf0edbb[_0x47a5('0x1f')](_0x18f7e9[_0x47a5('0x1f')]);return db['sequelize'][_0x47a5('0x36')](_0xf0edbb[_0x47a5('0x94')](),_0x308c9a);})['then'](function(_0x309a92){_0x448610[_0x47a5('0x6d')](_0x47a5('0xa9'),_['map'](_0x309a92,'id'));return db[_0x47a5('0xaa')]['query'](_0x448610[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x243c8b){var _0x3c620e=_['groupBy'](_0x243c8b,_0x47a5('0xab'));var _0x597cb2=[];_0x309a92[_0x47a5('0x6b')](function(_0x36f619){_0x597cb2[_0x47a5('0xac')](updateWhatsappInteraction(_0x36f619,_0x586f4f,_0x3c620e));});return BPromise[_0x47a5('0xad')](_0x597cb2);});});})['then'](function(_0x3eb5c1){_0x53c754['rows']=_0x3eb5c1;return _0x53c754;})['then'](respondWithFilteredResult(_0x52749b,_0x18f7e9))[_0x47a5('0xae')](handleError(_0x52749b,null));};exports[_0x47a5('0xaf')]=function(_0x352238,_0x96fb22){var _0x380c8b={'raw':![],'where':{'id':_0x352238[_0x47a5('0xb0')]['id']}},_0x5b1f5e={};_0x5b1f5e[_0x47a5('0x34')]=_[_0x47a5('0x37')](db[_0x47a5('0x30')]['rawAttributes']);_0x5b1f5e[_0x47a5('0x36')]=_['keys'](_0x352238[_0x47a5('0x36')]);_0x5b1f5e[_0x47a5('0x38')]=_[_0x47a5('0x39')](_0x5b1f5e[_0x47a5('0x34')],_0x5b1f5e[_0x47a5('0x36')]);_0x380c8b[_0x47a5('0x3a')]=_[_0x47a5('0x39')](_0x5b1f5e[_0x47a5('0x34')],qs[_0x47a5('0x3b')](_0x352238['query'][_0x47a5('0x3b')]));_0x380c8b[_0x47a5('0x3a')]=_0x380c8b['attributes'][_0x47a5('0x54')]?_0x380c8b[_0x47a5('0x3a')]:_0x5b1f5e[_0x47a5('0x34')];if(_0x352238['query']['includeAll']){_0x380c8b[_0x47a5('0xb1')]=[{'all':!![]}];}_0x380c8b=_[_0x47a5('0x96')]({},_0x380c8b,_0x352238['options']);return db['WhatsappInteraction'][_0x47a5('0x55')](_0x380c8b)[_0x47a5('0x25')](handleEntityNotFound(_0x96fb22,null))['then'](respondWithResult(_0x96fb22,null))[_0x47a5('0xae')](handleError(_0x96fb22,null));};exports[_0x47a5('0xb2')]=function(_0x4c9e6a,_0x16097e){return db[_0x47a5('0x30')][_0x47a5('0xb2')](_0x4c9e6a[_0x47a5('0x67')],{})[_0x47a5('0x25')](respondWithResult(_0x16097e,0xc9))[_0x47a5('0xae')](handleError(_0x16097e,null));};exports['update']=function(_0x4c9894,_0x5bd86e){if(_0x4c9894[_0x47a5('0x67')]['id']){delete _0x4c9894[_0x47a5('0x67')]['id'];}return db['WhatsappInteraction'][_0x47a5('0x55')]({'where':{'id':_0x4c9894[_0x47a5('0xb0')]['id']}})[_0x47a5('0x25')](handleEntityNotFound(_0x5bd86e,null))[_0x47a5('0x25')](saveUpdates(_0x4c9894[_0x47a5('0x67')],null))['then'](respondWithResult(_0x5bd86e,null))[_0x47a5('0xae')](handleError(_0x5bd86e,null));};exports['destroy']=function(_0x4eb534,_0x5db0ed){return db[_0x47a5('0x30')]['find']({'where':{'id':_0x4eb534[_0x47a5('0xb0')]['id']}})[_0x47a5('0x25')](handleEntityNotFound(_0x5db0ed,null))[_0x47a5('0x25')](removeEntity(_0x5db0ed,null))['catch'](handleError(_0x5db0ed,null));};exports[_0x47a5('0xb3')]=function(_0x461d32,_0x35bf37){return db[_0x47a5('0x30')][_0x47a5('0xb3')]()['then'](respondWithResult(_0x35bf37,null))[_0x47a5('0xae')](handleError(_0x35bf37,null));};exports[_0x47a5('0xb4')]=function(_0x519f0a,_0x42ba59,_0x419870){return db[_0x47a5('0xb5')][_0x47a5('0x55')]({'where':{'id':_0x519f0a[_0x47a5('0xb0')]['id']}})[_0x47a5('0x25')](handleEntityNotFound(_0x42ba59,null))['then'](function(_0x6a8174){if(_0x6a8174){return _0x6a8174[_0x47a5('0xb4')](_0x519f0a['body'][_0x47a5('0xb6')],_[_0x47a5('0xb7')](_0x519f0a[_0x47a5('0x67')],[_0x47a5('0xb6'),'id'])||{});}})['then'](respondWithResult(_0x42ba59,null))['catch'](handleError(_0x42ba59,null));};exports['getMessages']=function(_0x4eee99,_0x1946c6,_0x27793e){var _0x2c5785={'raw':![],'where':{}};var _0x30def7={};var _0x31f896={'count':0x0,'rows':[]};return db[_0x47a5('0x30')][_0x47a5('0xb8')]({'where':{'id':_0x4eee99[_0x47a5('0xb0')]['id']}})['then'](handleEntityNotFound(_0x1946c6,null))[_0x47a5('0x25')](function(_0x24e39a){if(_0x24e39a){_0x30def7[_0x47a5('0x34')]=_[_0x47a5('0x37')](db['WhatsappMessage']['rawAttributes']);_0x30def7[_0x47a5('0x36')]=_['keys'](_0x4eee99['query']);_0x30def7[_0x47a5('0x38')]=_[_0x47a5('0x39')](_0x30def7['model'],_0x30def7[_0x47a5('0x36')]);_0x2c5785[_0x47a5('0x3a')]=_[_0x47a5('0x39')](_0x30def7['model'],qs[_0x47a5('0x3b')](_0x4eee99[_0x47a5('0x36')]['fields']));_0x2c5785[_0x47a5('0x3a')]=_0x2c5785[_0x47a5('0x3a')][_0x47a5('0x54')]?_0x2c5785[_0x47a5('0x3a')]:_0x30def7[_0x47a5('0x34')];if(!_0x4eee99[_0x47a5('0x36')]['hasOwnProperty'](_0x47a5('0x3c'))){_0x2c5785['limit']=qs[_0x47a5('0x20')](_0x4eee99[_0x47a5('0x36')][_0x47a5('0x20')]);_0x2c5785[_0x47a5('0x1f')]=qs['offset'](_0x4eee99[_0x47a5('0x36')][_0x47a5('0x1f')]);}_0x2c5785[_0x47a5('0x3d')]=qs[_0x47a5('0x3e')](_0x4eee99[_0x47a5('0x36')][_0x47a5('0x3e')]);_0x2c5785[_0x47a5('0x6d')]=qs[_0x47a5('0x38')](_[_0x47a5('0x3f')](_0x4eee99[_0x47a5('0x36')],_0x30def7[_0x47a5('0x38')]));_0x2c5785[_0x47a5('0x6d')]['WhatsappInteractionId']=_0x24e39a['id'];if(_0x4eee99[_0x47a5('0x36')][_0x47a5('0x7c')]){_0x2c5785['where']=_[_0x47a5('0x96')](_0x2c5785[_0x47a5('0x6d')],{'$or':_[_0x47a5('0x35')](_0x2c5785[_0x47a5('0x3a')],function(_0x2ff467){var _0x58fac0={};_0x58fac0[_0x2ff467]={'$like':'%'+_0x4eee99[_0x47a5('0x36')][_0x47a5('0x7c')]+'%'};return _0x58fac0;})});}if(_0x4eee99[_0x47a5('0x36')][_0x47a5('0x72')]){var _0x343214=_0x4eee99[_0x47a5('0x36')][_0x47a5('0x72')]['split'](',');var _0x596562={};_0x596562[_0x343214[0x0]]={'$gte':moment(_0x343214[0x1])[_0x47a5('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2c5785[_0x47a5('0x6d')]=_['merge'](_0x2c5785[_0x47a5('0x6d')],_0x596562);}_0x2c5785=_[_0x47a5('0x96')]({},_0x2c5785,_0x4eee99[_0x47a5('0xba')]);return db[_0x47a5('0xb5')]['count']({'where':_0x2c5785[_0x47a5('0x6d')]})[_0x47a5('0x25')](function(_0xaca12c){_0x31f896['count']=_0xaca12c;if(_0x4eee99['query'][_0x47a5('0xbb')]){_0x2c5785[_0x47a5('0xb1')]=[{'all':!![]}];}return db[_0x47a5('0xb5')][_0x47a5('0xbc')](_0x2c5785);})[_0x47a5('0x25')](function(_0x402bba){_0x31f896[_0x47a5('0xbd')]=_0x402bba;return _0x31f896;});}})[_0x47a5('0x25')](respondWithFilteredResult(_0x1946c6,_0x2c5785))['catch'](handleError(_0x1946c6,null));};exports[_0x47a5('0xbe')]=function(_0x4d333b,_0x346322,_0xc3b5e1){return db['WhatsappInteraction']['find']({'where':{'id':_0x4d333b[_0x47a5('0xb0')]['id']}})[_0x47a5('0x25')](handleEntityNotFound(_0x346322,null))['then'](function(_0x4420fa){if(_0x4420fa){return _0x4420fa[_0x47a5('0xbf')](_0x4d333b[_0x47a5('0x67')][_0x47a5('0xb6')],_['omit'](_0x4d333b[_0x47a5('0x67')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x47a5('0xbc')]({'attributes':['id','name',_0x47a5('0xc0')],'where':{'id':_0x4d333b[_0x47a5('0x67')][_0x47a5('0xb6')]}});})[_0x47a5('0x25')](function(_0x267d40){socket[_0x47a5('0xc1')](_0x47a5('0xc2'),{'id':Number(_0x4d333b[_0x47a5('0xb0')]['id']),'tags':_0x267d40||[]});return{'id':Number(_0x4d333b[_0x47a5('0xb0')]['id']),'tags':_0x267d40||[]};});}})[_0x47a5('0x25')](respondWithResult(_0x346322,null))[_0x47a5('0xae')](handleError(_0x346322,null));};exports[_0x47a5('0xc3')]=function(_0x328faa,_0x1bfa3b,_0xff64fb){return db['WhatsappInteraction'][_0x47a5('0x55')]({'where':{'id':_0x328faa[_0x47a5('0xb0')]['id']}})[_0x47a5('0x25')](handleEntityNotFound(_0x1bfa3b,null))[_0x47a5('0x25')](function(_0x515580){if(_0x515580){return _0x515580[_0x47a5('0xc3')](_0x328faa['query'][_0x47a5('0xb6')]);}})['then'](respondWithStatusCode(_0x1bfa3b,null))[_0x47a5('0xae')](handleError(_0x1bfa3b,null));};exports[_0x47a5('0xc4')]=function(_0x3b894d,_0x5c20aa){var _0x35f735=moment()[_0x47a5('0xc5')]()[_0x47a5('0x94')]();var _0x4ac804=path['join'](config[_0x47a5('0xc6')],_0x47a5('0xc7'),_0x47a5('0xc8'),_0x47a5('0xc9'));var _0x204bd6=path['join'](config[_0x47a5('0xc6')],'server',_0x47a5('0xc8'),_0x47a5('0xca'));var _0x46647f=path[_0x47a5('0xcb')](_0x4ac804,_0x35f735);var _0x5b18a2=util['format'](_0x47a5('0xcc'),_0x3b894d[_0x47a5('0xb0')]['id'],_0x35f735);var _0x291383=path[_0x47a5('0xcb')](_0x4ac804,_0x5b18a2);var _0x259088=[];_0x259088[_0x47a5('0xac')]({'model':db[_0x47a5('0x65')],'as':_0x47a5('0x65'),'attributes':['id',_0x47a5('0xcd')],'raw':!![]});_0x259088['push']({'model':db['CmContact'],'as':_0x47a5('0x5a'),'attributes':['id','firstName',_0x47a5('0xce')],'raw':!![]});if(_0x3b894d[_0x47a5('0x36')][_0x47a5('0xca')]){_0x259088['push']({'model':db[_0x47a5('0xcf')],'as':_0x47a5('0xcf'),'raw':!![]});}var _0x4842c5=[{'model':db[_0x47a5('0xb5')],'as':'Messages','attributes':['id',_0x47a5('0x67'),_0x47a5('0x70'),_0x47a5('0xd0'),'secret','read'],'include':_0x259088}];_0x4842c5['push']({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x47a5('0x2a')]});_0x4842c5['push']({'model':db[_0x47a5('0x65')],'as':_0x47a5('0xd1'),'attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0x3b894d[_0x47a5('0xb0')]['id']},'include':_0x4842c5})['then'](handleEntityNotFound(_0x5c20aa,null))['then'](function(_0x5d17dc){if(_0x5d17dc){var _0x45947c=_0x5d17dc[_0x47a5('0xd2')]({'plain':!![]});fs[_0x47a5('0xd3')](_0x46647f);var _0xdb9128={'format':'A4','border':'10px','header':{'height':_0x47a5('0xd4'),'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':_0x47a5('0xd5'),'contents':{'default':util['format'](_0x47a5('0xd6'),util[_0x47a5('0xb9')](_0x47a5('0xd7'),'Whatsapp',_0x45947c['id']),moment()[_0x47a5('0xb9')](_0x47a5('0xd8'))[_0x47a5('0x94')]())}}};var _0x31100e={'channel':'Whatsapp','account':_0x45947c[_0x47a5('0xd9')][_0x47a5('0x2a')],'agent':_0x45947c[_0x47a5('0xd1')]?_0x45947c[_0x47a5('0xd1')][_0x47a5('0xcd')]:_0x47a5('0xda'),'createdAt':moment(_0x45947c['createdAt'])[_0x47a5('0xb9')](_0x47a5('0xdb'))[_0x47a5('0x94')](),'closedAt':_0x45947c[_0x47a5('0xdc')]?moment(_0x45947c[_0x47a5('0xdd')])[_0x47a5('0xb9')](_0x47a5('0xdb'))[_0x47a5('0x94')]():'','disposition':_0x45947c[_0x47a5('0xde')],'messages':_(_0x45947c[_0x47a5('0xdf')])[_0x47a5('0x7c')]({'secret':![]})[_0x47a5('0x35')](function(_0x40dab1){if(_0x40dab1[_0x47a5('0xcf')]){var _0x29b926=path[_0x47a5('0xcb')](_0x204bd6,_0x40dab1[_0x47a5('0xcf')]['basename']);if(fs[_0x47a5('0xe0')](_0x29b926)){fs['createReadStream'](_0x29b926)['pipe'](fs[_0x47a5('0xe1')](path[_0x47a5('0xcb')](_0x46647f,_0x40dab1[_0x47a5('0xcf')]['basename'])));}}return{'date':moment(_0x40dab1[_0x47a5('0x70')])[_0x47a5('0xb9')](_0x47a5('0xdb'))[_0x47a5('0x94')](),'sender':_0x40dab1[_0x47a5('0xd0')]===_0x47a5('0xe2')?_0x40dab1[_0x47a5('0x65')]?_0x40dab1[_0x47a5('0x65')][_0x47a5('0xcd')]:_0x47a5('0xe3'):_0x40dab1[_0x47a5('0x5a')][_0x47a5('0xe4')]+(_0x40dab1[_0x47a5('0x5a')]['lastName']?'\x20'+_0x40dab1['Contact'][_0x47a5('0xce')]:''),'body':_0x40dab1['Attachment']?_0x40dab1[_0x47a5('0xcf')][_0x47a5('0xe5')]:_0x40dab1[_0x47a5('0x67')],'direction':_0x40dab1[_0x47a5('0xd0')]===_0x47a5('0xe2')?'A':'C','secret':_0x40dab1[_0x47a5('0xe6')],'read':_0x40dab1['read'],'attachment':_0x40dab1[_0x47a5('0xcf')]};})[_0x47a5('0x56')]()};return ejs[_0x47a5('0xe7')](path['join'](config[_0x47a5('0xc6')],_0x47a5('0xc7'),_0x47a5('0xe8'),_0x47a5('0xe9')),{'interaction':_0x31100e})[_0x47a5('0x25')](function(_0x23e649){return new BPromise(function(_0x35e20f,_0x46615a){pdf[_0x47a5('0xb2')](_0x23e649,_0xdb9128)[_0x47a5('0xea')](path[_0x47a5('0xcb')](_0x46647f,_0x47a5('0xeb')+_0x45947c['id']+'-'+_0x35f735+_0x47a5('0xec')),function(_0x2ac386,_0x578983){if(_0x2ac386)return _0x46615a(_0x2ac386);_0x35e20f(_0x578983);});});})[_0x47a5('0x25')](function(){return new BPromise(function(_0x272cd0,_0x150cff){zipdir(_0x46647f,{'saveTo':_0x291383},function(_0x2ee27c,_0x25ce6b){if(_0x2ee27c)return _0x150cff(_0x2ee27c);return _0x272cd0(_0x25ce6b);});})[_0x47a5('0x25')](function(){return new BPromise(function(_0x29ef50,_0x49692d){rimraf(_0x46647f,function(_0x185104){if(_0x185104)_0x49692d(_0x185104);return _0x29ef50();});});})['then'](function(){return _0x5c20aa[_0x47a5('0xc4')](_0x291383,_0x5b18a2,function(_0xf465a8){if(_0xf465a8){console[_0x47a5('0xed')](_0x47a5('0xee'),_0xf465a8);}else{fs[_0x47a5('0xef')](_0x291383);}});});});}else{return _0x5c20aa[_0x47a5('0x27')](0xc8);}})[_0x47a5('0xae')](handleError(_0x5c20aa,null));}; \ No newline at end of file +var _0x524e=['\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','all','rows','params','includeAll','include','options','create','update','describe','addMessage','WhatsappMessage','omit','findOne','WhatsappInteractionId','merge','findAll','addTags','setTags','ids','spread','whatsappInteractionTags:save','removeTags','unix','join','root','files','tmp','server','attachments','format','transcript-%d-%s.zip','firstName','lastName','Messages','direction','secret','Account','User','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','YYYY-MM-DD\x20HH:mm:ss','disposition','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','toFile','transcript-','.pdf','download','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','Users','map','fullname','Tags','split','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','from','user_has_whatsapp_interactions','users','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','t.id\x20=\x20it.TagId','search','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','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?','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x524e,0x15e));var _0xe524=function(_0x57d822,_0x548911){_0x57d822=_0x57d822-0x0;var _0x2ef50f=_0x524e[_0x57d822];return _0x2ef50f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe524('0x0'));var zipdir=require(_0xe524('0x1'));var jsonpatch=require(_0xe524('0x2'));var rp=require(_0xe524('0x3'));var moment=require(_0xe524('0x4'));var BPromise=require(_0xe524('0x5'));var Mustache=require(_0xe524('0x6'));var util=require(_0xe524('0x7'));var path=require(_0xe524('0x8'));var sox=require(_0xe524('0x9'));var csv=require('to-csv');var ejs=require(_0xe524('0xa'));var fs=require('fs');var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0xf'));var querystring=require(_0xe524('0x10'));var Papa=require(_0xe524('0x11'));var Redis=require(_0xe524('0x12'));var authService=require(_0xe524('0x13'));var qs=require(_0xe524('0x14'));var as=require(_0xe524('0x15'));var hardwareService=require(_0xe524('0x16'));var logger=require(_0xe524('0x17'))(_0xe524('0x18'));var utils=require(_0xe524('0x19'));var config=require(_0xe524('0x1a'));var licenseUtil=require(_0xe524('0x1b'));var db=require(_0xe524('0x1c'))['db'];config['redis']=_['defaults'](config[_0xe524('0x1d')],{'host':_0xe524('0x1e'),'port':0x18eb});var socket=require(_0xe524('0x1f'))(new Redis(config[_0xe524('0x1d')]));require(_0xe524('0x20'))['register'](socket);function respondWithStatusCode(_0x12ff75,_0x51e9fe){_0x51e9fe=_0x51e9fe||0xcc;return function(_0x19f013){if(_0x19f013){return _0x12ff75[_0xe524('0x21')](_0x51e9fe);}return _0x12ff75['status'](_0x51e9fe)[_0xe524('0x22')]();};}function respondWithResult(_0x488fce,_0x109795){_0x109795=_0x109795||0xc8;return function(_0x538754){if(_0x538754){return _0x488fce[_0xe524('0x23')](_0x109795)['json'](_0x538754);}};}function respondWithFilteredResult(_0x5c8736,_0x5a5c0d){return function(_0x3a4027){if(_0x3a4027){var _0x4f1dfb=_0x3a4027[_0xe524('0x24')],_0x11b2a1=_0x5a5c0d['offset'],_0x238f8f=_0x5a5c0d[_0xe524('0x25')]+_0x5a5c0d[_0xe524('0x26')],_0x278de9;if(_0x238f8f>=_0x4f1dfb){_0x238f8f=_0x4f1dfb;_0x278de9=0xc8;}else{_0x278de9=0xce;}_0x5c8736['status'](_0x278de9);return _0x5c8736[_0xe524('0x27')](_0xe524('0x28'),_0x11b2a1+'-'+_0x238f8f+'/'+_0x4f1dfb)[_0xe524('0x29')](_0x3a4027);}return null;};}function patchUpdates(_0x1dcc0f){return function(_0x1c4194){try{jsonpatch[_0xe524('0x2a')](_0x1c4194,_0x1dcc0f,!![]);}catch(_0xbf059b){return BPromise[_0xe524('0x2b')](_0xbf059b);}return _0x1c4194[_0xe524('0x2c')]();};}function saveUpdates(_0x5c4d21,_0x7d1f92){return function(_0x5bb00b){if(_0x5bb00b){return _0x5bb00b['update'](_0x5c4d21)[_0xe524('0x2d')](function(_0x23df5e){return _0x23df5e;});}return null;};}function removeEntity(_0x1ad106,_0x85fc51){return function(_0x599d5d){if(_0x599d5d){return _0x599d5d[_0xe524('0x2e')]()['then'](function(){_0x1ad106[_0xe524('0x23')](0xcc)[_0xe524('0x22')]();});}};}function handleEntityNotFound(_0xd62772,_0x3cd922){return function(_0x4102d9){if(!_0x4102d9){_0xd62772[_0xe524('0x21')](0x194);}return _0x4102d9;};}function handleError(_0x2141db,_0x583cc3){_0x583cc3=_0x583cc3||0x1f4;return function(_0x58a896){logger[_0xe524('0x2f')](_0x58a896[_0xe524('0x30')]);if(_0x58a896[_0xe524('0x31')]){delete _0x58a896[_0xe524('0x31')];}_0x2141db[_0xe524('0x23')](_0x583cc3)['send'](_0x58a896);};}function getInteractionUsers(_0x52f140,_0x4b1ff){return new BPromise(function(_0x25e7a7,_0x3aedd9){try{if(_0x4b1ff[_0x52f140['id']]){_0x52f140[_0xe524('0x32')]=_[_0xe524('0x33')](_0x4b1ff[_0x52f140['id']],function(_0x517fa0){return{'id':_0x517fa0['id'],'fullname':_0x517fa0[_0xe524('0x34')]};});}}catch(_0x9a7e98){_0x3aedd9(_0x9a7e98);}_0x25e7a7(_0x52f140);});}function getInteractionTags(_0x4a4e15,_0x5b7ded){return new BPromise(function(_0x20688e,_0x376324){try{if(_0x4a4e15['TagIds']){_0x4a4e15[_0xe524('0x35')]=[];_0x4a4e15['TagIds'][_0xe524('0x36')](',')['forEach'](function(_0x315e56){_0x4a4e15[_0xe524('0x35')][_0xe524('0x37')](_0x5b7ded[_0x315e56]);});}delete _0x4a4e15['TagIds'];}catch(_0x2e26d9){_0x376324(_0x2e26d9);}_0x20688e(_0x4a4e15);});}function updateWhatsappInteraction(_0x5238c9,_0xdbdf53,_0x16eff9){return new BPromise(function(_0x276343,_0x502256){return getInteractionUsers(_0x5238c9,_0x16eff9)[_0xe524('0x2d')](function(_0x119cc3){return getInteractionTags(_0x119cc3,_0xdbdf53);})['then'](function(_0x27817e){_0x276343(_0x27817e);})[_0xe524('0x38')](function(_0x10408e){_0x502256(_0x10408e);});});}exports[_0xe524('0x39')]=function(_0x53560d,_0x415450){var _0xcf8060={},_0x615b5e={},_0x13cda8={'count':0x0,'rows':[]};var _0x2522cd=_[_0xe524('0x33')](db[_0xe524('0x3a')][_0xe524('0x3b')],function(_0x4db4b7){return{'name':_0x4db4b7[_0xe524('0x3c')],'type':_0x4db4b7['type'][_0xe524('0x3d')]};});_0x615b5e[_0xe524('0x3e')]=_['map'](_0x2522cd,_0xe524('0x31'));_0x615b5e['query']=_[_0xe524('0x3f')](_0x53560d[_0xe524('0x40')]);_0x615b5e[_0xe524('0x41')]=_[_0xe524('0x42')](_0x615b5e[_0xe524('0x3e')],_0x615b5e[_0xe524('0x40')]);_0xcf8060[_0xe524('0x43')]=_[_0xe524('0x42')](_0x615b5e['model'],qs[_0xe524('0x44')](_0x53560d[_0xe524('0x40')][_0xe524('0x44')]));_0xcf8060[_0xe524('0x43')]=_0xcf8060[_0xe524('0x43')][_0xe524('0x45')]?_0xcf8060[_0xe524('0x43')]:_0x615b5e[_0xe524('0x3e')];if(!_0x53560d['query'][_0xe524('0x46')](_0xe524('0x47'))){_0xcf8060[_0xe524('0x26')]=qs['limit'](_0x53560d[_0xe524('0x40')]['limit']);_0xcf8060[_0xe524('0x25')]=qs[_0xe524('0x25')](_0x53560d[_0xe524('0x40')][_0xe524('0x25')]);}_0xcf8060[_0xe524('0x48')]=qs[_0xe524('0x49')](_0x53560d[_0xe524('0x40')]['sort']);_0xcf8060[_0xe524('0x4a')]=qs[_0xe524('0x41')](_[_0xe524('0x4b')](_0x53560d[_0xe524('0x40')],_0x615b5e[_0xe524('0x41')]),_0x2522cd);var _0x1ae283=[];var _0x4a4a16=squel[_0xe524('0x4c')]()[_0xe524('0x4d')]('id')[_0xe524('0x4d')]('name')[_0xe524('0x4d')]('color')['from'](_0xe524('0x4e'));var _0x33906d=squel['select']()[_0xe524('0x4d')](_0xe524('0x4f'))[_0xe524('0x4d')](_0xe524('0x50'))['field']('ui.WhatsappInteractionId')[_0xe524('0x51')](_0xe524('0x52'),'ui')['left_join'](_0xe524('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x472519=squel[_0xe524('0x4c')]()[_0xe524('0x51')](_0xe524('0x54'),'i')[_0xe524('0x55')](_0xe524('0x56'),'c',_0xe524('0x57'))[_0xe524('0x55')](_0xe524('0x53'),'o',_0xe524('0x58'))[_0xe524('0x55')](_0xe524('0x59'),'a',_0xe524('0x5a'))[_0xe524('0x55')](_0xe524('0x5b'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xe524('0x55')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xe524('0x55')]('tools_tags','t',_0xe524('0x5c'));var _0x15d7ee=squel['expr']();var _0x20753e=[];var _0x5c1655=squel['expr']();var _0x2fa574;if(_0x53560d[_0xe524('0x40')][_0xe524('0x5d')]){_0x2fa574=as['parseSearch'](_0x53560d['query']['search']);var _0x4e9c3b=_0x2fa574['sqlOperator'];for(var _0x5477ca=0x0;_0x5477ca<_0x2fa574[_0xe524('0x5e')][_0xe524('0x45')];_0x5477ca++){var _0x4f5059=_0x2fa574[_0xe524('0x5e')][_0x5477ca];var _0x40b871='i';var _0x254168=_[_0xe524('0x5f')](_0x2522cd,[_0xe524('0x31'),_0x4f5059['field']]);if(!_0x254168){switch(_0x4f5059[_0xe524('0x4d')]){case _0xe524('0x60'):if(_0x4f5059[_0xe524('0x61')]==0x1){_0x472519['having']('`'+_0x4f5059[_0xe524('0x4d')]+'`\x20=\x200');}else{_0x472519[_0xe524('0x62')]('`'+_0x4f5059[_0xe524('0x4d')]+_0xe524('0x63'));}break;case _0xe524('0x64'):if(_0x4f5059[_0xe524('0x65')]===_0xe524('0x66')){if(_0x4f5059[_0xe524('0x61')][_0xe524('0x36')]('\x20')[_0xe524('0x45')]>0x1){_0x15d7ee[_0x4e9c3b](_0xe524('0x67'),qs[_0xe524('0x68')](_0x4f5059[_0xe524('0x61')]),null);}else{var _0x55a855='%'+_0x4f5059['value']+'%';_0x15d7ee[_0x4e9c3b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x55a855,_0x55a855,_0x55a855);}}else{_0x254168=_[_0xe524('0x5f')](_0x2522cd,[_0xe524('0x31'),_0xe524('0x69')]);_0x4f5059[_0xe524('0x4d')]=_0xe524('0x69');_0x5343b3=as[_0xe524('0x6a')](_0x40b871,_0x254168[_0xe524('0x6b')],_0x4f5059);_0x15d7ee[_0x4e9c3b](_0x5343b3[_0xe524('0x6c')],_0x5343b3[_0xe524('0x61')][_0xe524('0x6d')],_0x5343b3[_0xe524('0x61')]['end']);}break;case _0xe524('0x6e'):var _0x1f0567=_0x4f5059['value']['split'](',')['map'](function(_0x5c4056){return Number(_0x5c4056);});_0x1f0567[_0xe524('0x6f')](function(_0x12dfce){_0x5c1655['or'](_0xe524('0x70'),'%,'+_0x12dfce+',%');});_0x20753e=_[_0xe524('0x71')](_0x20753e,_0x1f0567);break;case'User':if(_0x4f5059[_0xe524('0x65')]===_0xe524('0x66')){_0x15d7ee[_0x4e9c3b](_0xe524('0x72'),'%'+_0x4f5059[_0xe524('0x61')]+'%',null);}else{_0x254168=_['find'](_0x2522cd,['name','UserId']);_0x4f5059[_0xe524('0x4d')]='UserId';_0x5343b3=as[_0xe524('0x6a')](_0x40b871,_0x254168[_0xe524('0x6b')],_0x4f5059);_0x15d7ee[_0x4e9c3b](_0x5343b3[_0xe524('0x6c')],_0x5343b3[_0xe524('0x61')][_0xe524('0x6d')],_0x5343b3['value']['end']);}break;case _0xe524('0x73'):_0x5343b3=as[_0xe524('0x6a')]('me',null,_0x4f5059);_0x15d7ee[_0x4e9c3b](_0x5343b3[_0xe524('0x6c')],_0x5343b3[_0xe524('0x61')][_0xe524('0x6d')],_0x5343b3[_0xe524('0x61')]['end']);break;}}else{var _0x5343b3=as[_0xe524('0x6a')](_0x40b871,_0x254168[_0xe524('0x6b')],_0x4f5059);_0x15d7ee[_0x4e9c3b](_0x5343b3['text'],_0x5343b3[_0xe524('0x61')][_0xe524('0x6d')],_0x5343b3[_0xe524('0x61')]['end']);}}}else{var _0x4d5c19=_(_0x53560d[_0xe524('0x40')])[_0xe524('0x3f')]()[_0xe524('0x33')](function(_0x428b9d){return _[_0xe524('0x74')](_0x2522cd,['name',_0x428b9d])?_0x428b9d:undefined;})[_0xe524('0x75')]()[_0xe524('0x61')]();if(!_[_0xe524('0x76')](_0x4d5c19)){_0x4d5c19[_0xe524('0x6f')](function(_0x3ce098){if(_0x3ce098===_0xe524('0x77')){_0x472519[_0xe524('0x4a')](_0xe524('0x78'),[][_0xe524('0x79')](_0x53560d[_0xe524('0x40')][_0x3ce098]));}else if(_0x3ce098===_0xe524('0x7a')){var _0x4c69e2=JSON[_0xe524('0x7b')](_0x53560d[_0xe524('0x40')][_0x3ce098])[_0xe524('0x7c')];var _0xfed246=JSON[_0xe524('0x7b')](_0x53560d['query'][_0x3ce098])[_0xe524('0x7d')];_0x472519[_0xe524('0x4a')](_0xe524('0x7e'),_0x4c69e2,_0xfed246);}else{if(_0x53560d[_0xe524('0x40')][_0x3ce098]===_0xe524('0x7f')){_0x472519[_0xe524('0x4a')]('i.'+_0x3ce098+_0xe524('0x80'));}else{_0x472519['where']('i.'+_0x3ce098+_0xe524('0x81'),_0x53560d[_0xe524('0x40')][_0x3ce098]);}}});}if(_0x53560d[_0xe524('0x40')][_0xe524('0x82')]){if(_0x53560d['query'][_0xe524('0x82')]==0x1){_0x472519['having'](_0xe524('0x83'));}else{_0x472519[_0xe524('0x62')](_0xe524('0x84'));}}if(_0x53560d['query'][_0xe524('0x85')]){_0x20753e=_[_0xe524('0x86')](_0x53560d[_0xe524('0x40')][_0xe524('0x85')])?_0x53560d[_0xe524('0x40')]['tag']:new Array(_0x53560d[_0xe524('0x40')][_0xe524('0x85')]);_0x20753e[_0xe524('0x6f')](function(_0x116891){_0x5c1655['or'](_0xe524('0x70'),'%,'+_0x116891+',%');});}if(_0x53560d['query'][_0xe524('0x87')]){var _0x629baa=_0x53560d[_0xe524('0x40')][_0xe524('0x87')][_0xe524('0x88')]('\x5c','\x5c\x5c')[_0xe524('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x629baa)){_0x15d7ee['or'](_0xe524('0x89'),_0x629baa+'%')['or'](_0xe524('0x8a'),_0x629baa+'%');}else{_0x15d7ee['or'](_0xe524('0x8b'),qs['getFullTextValue'](_0x629baa))['or'](_0xe524('0x8c'),_0x629baa+'%');}}}_0x472519[_0xe524('0x4a')](_0x15d7ee);_0x472519['group'](_0xe524('0x8d'));var _0x1c8e57={'type':db[_0xe524('0x8e')][_0xe524('0x8f')][_0xe524('0x90')],'raw':!![]};var _0xf6934=_0x472519['clone']();_0xf6934[_0xe524('0x4d')](_0xe524('0x8d'));_0xf6934[_0xe524('0x4d')](_0xe524('0x91'),_0xe524('0x60'));if(_0xcf8060[_0xe524('0x48')]){_0xcf8060[_0xe524('0x48')][_0xe524('0x6f')](function(_0x465c3d){var _0x16893f=_0x465c3d[0x0]===_0xe524('0x92')?_0x465c3d[0x0]:'i.'+_0x465c3d[0x0];_0x472519[_0xe524('0x48')](_0x16893f,_0x465c3d[0x1]===_0xe524('0x93')?![]:!![]);});}if(!_[_0xe524('0x76')](_0x20753e)){_0x472519[_0xe524('0x62')](_0x5c1655);_0xf6934['where'](_0xe524('0x94'),_0x20753e);}BPromise[_0xe524('0x95')]()[_0xe524('0x2d')](function(){if(!_0x2fa574){if(_0x53560d['query'][_0xe524('0x77')])return;_0xf6934[_0xe524('0x4a')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x472519['where'](_0xe524('0x96'));return;}if(_0x53560d['user'][_0xe524('0x97')]!=='agent')return;return _0x53560d[_0xe524('0x98')][_0xe524('0x99')]({'attributes':['id'],'raw':!![]})[_0xe524('0x2d')](function(_0xaa9af1){if(_['isEmpty'](_0xaa9af1)){_0xf6934['where'](_0xe524('0x9a'));_0x472519[_0xe524('0x4a')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0xf6934[_0xe524('0x4a')](_0xe524('0x78'),_[_0xe524('0x33')](_0xaa9af1,'id'));_0x472519['where'](_0xe524('0x78'),_[_0xe524('0x33')](_0xaa9af1,'id'));}});})[_0xe524('0x2d')](function(){if(_0x53560d[_0xe524('0x98')][_0xe524('0x97')]===_0xe524('0x9b')&&!_0x2fa574&&!_0x53560d['query']['WhatsappAccountId'])return[];return db[_0xe524('0x9c')]['query'](_0xf6934[_0xe524('0x9d')](),_0x1c8e57);})[_0xe524('0x2d')](function(_0x11bbda){_0x13cda8['count']=_0x11bbda[_0xe524('0x45')];if(_0x13cda8['count']===0x0)return[];return db[_0xe524('0x9c')][_0xe524('0x40')](_0x4a4a16[_0xe524('0x9d')](),_0x1c8e57)[_0xe524('0x2d')](function(_0x382ecc){_0x1ae283=_[_0xe524('0x9e')](_0x382ecc,'id');_0x1c8e57=_['merge'](_0x1c8e57,{'model':db[_0xe524('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x53560d[_0xe524('0x40')][_0xe524('0x44')]){_0xcf8060['attributes'][_0xe524('0x6f')](function(_0x3bdc0f){_0x472519['field']('i.'+_0x3bdc0f);});}else{_0x472519[_0xe524('0x4d')](_0xe524('0x91'),_0xe524('0x60'));_0x472519[_0xe524('0x4d')]('a.key',_0xe524('0x9f'));_0x472519[_0xe524('0x4d')](_0xe524('0xa0'),'Account.mandatoryDisposition');_0x472519[_0xe524('0x4d')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xe524('0x92'));_0x472519[_0xe524('0x4d')](_0xe524('0xa1'));_0x472519['field'](_0xe524('0xa2'),_0xe524('0xa3'));_0x472519[_0xe524('0x4d')]('c.lastName','Contact.lastName');_0x472519[_0xe524('0x4d')]('c.email',_0xe524('0xa4'));_0x472519['field'](_0xe524('0xa5'),_0xe524('0xa6'));_0x472519['field'](_0xe524('0xa7'),_0xe524('0xa8'));_0x472519['field']('c.fax',_0xe524('0xa9'));_0x472519[_0xe524('0x4d')](_0xe524('0xaa'),'Owner.fullname');_0x472519[_0xe524('0x4d')](_0xe524('0xab'),_0xe524('0xac'));_0x472519[_0xe524('0x4d')](_0xe524('0xad'),_0xe524('0xae'));}if(_0xcf8060['limit'])_0x472519[_0xe524('0x26')](_0xcf8060[_0xe524('0x26')]);if(_0xcf8060['offset'])_0x472519['offset'](_0xcf8060[_0xe524('0x25')]);return db[_0xe524('0x9c')][_0xe524('0x40')](_0x472519[_0xe524('0x9d')](),_0x1c8e57);})['then'](function(_0x1584a7){_0x33906d[_0xe524('0x4a')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x1584a7,'id'));return db[_0xe524('0x9c')][_0xe524('0x40')](_0x33906d[_0xe524('0x9d')](),_0x1c8e57)[_0xe524('0x2d')](function(_0x2a8b4e){var _0x262991=_['groupBy'](_0x2a8b4e,'WhatsappInteractionId');var _0x46883b=[];_0x1584a7[_0xe524('0x6f')](function(_0x589aef){_0x46883b['push'](updateWhatsappInteraction(_0x589aef,_0x1ae283,_0x262991));});return BPromise[_0xe524('0xaf')](_0x46883b);});});})[_0xe524('0x2d')](function(_0x30fa81){_0x13cda8[_0xe524('0xb0')]=_0x30fa81;return _0x13cda8;})[_0xe524('0x2d')](respondWithFilteredResult(_0x415450,_0xcf8060))[_0xe524('0x38')](handleError(_0x415450,null));};exports['show']=function(_0x555801,_0x3e8668){var _0x390093={'raw':![],'where':{'id':_0x555801[_0xe524('0xb1')]['id']}},_0x21b60a={};_0x21b60a[_0xe524('0x3e')]=_[_0xe524('0x3f')](db[_0xe524('0x3a')][_0xe524('0x3b')]);_0x21b60a['query']=_[_0xe524('0x3f')](_0x555801[_0xe524('0x40')]);_0x21b60a[_0xe524('0x41')]=_['intersection'](_0x21b60a['model'],_0x21b60a[_0xe524('0x40')]);_0x390093[_0xe524('0x43')]=_[_0xe524('0x42')](_0x21b60a[_0xe524('0x3e')],qs['fields'](_0x555801[_0xe524('0x40')][_0xe524('0x44')]));_0x390093[_0xe524('0x43')]=_0x390093[_0xe524('0x43')][_0xe524('0x45')]?_0x390093['attributes']:_0x21b60a[_0xe524('0x3e')];if(_0x555801['query'][_0xe524('0xb2')]){_0x390093[_0xe524('0xb3')]=[{'all':!![]}];}_0x390093=_['merge']({},_0x390093,_0x555801[_0xe524('0xb4')]);return db[_0xe524('0x3a')]['find'](_0x390093)[_0xe524('0x2d')](handleEntityNotFound(_0x3e8668,null))['then'](respondWithResult(_0x3e8668,null))[_0xe524('0x38')](handleError(_0x3e8668,null));};exports[_0xe524('0xb5')]=function(_0x1be681,_0x328f84){return db[_0xe524('0x3a')][_0xe524('0xb5')](_0x1be681[_0xe524('0x73')],{})[_0xe524('0x2d')](respondWithResult(_0x328f84,0xc9))['catch'](handleError(_0x328f84,null));};exports[_0xe524('0xb6')]=function(_0x5a5789,_0x4f7bf1){if(_0x5a5789[_0xe524('0x73')]['id']){delete _0x5a5789['body']['id'];}return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0x5a5789[_0xe524('0xb1')]['id']}})[_0xe524('0x2d')](handleEntityNotFound(_0x4f7bf1,null))[_0xe524('0x2d')](saveUpdates(_0x5a5789[_0xe524('0x73')],null))['then'](respondWithResult(_0x4f7bf1,null))['catch'](handleError(_0x4f7bf1,null));};exports[_0xe524('0x2e')]=function(_0x1b4f38,_0x2fbdb7){return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0x1b4f38[_0xe524('0xb1')]['id']}})[_0xe524('0x2d')](handleEntityNotFound(_0x2fbdb7,null))[_0xe524('0x2d')](removeEntity(_0x2fbdb7,null))[_0xe524('0x38')](handleError(_0x2fbdb7,null));};exports[_0xe524('0xb7')]=function(_0x5c5ef4,_0x2431b5){return db[_0xe524('0x3a')][_0xe524('0xb7')]()[_0xe524('0x2d')](respondWithResult(_0x2431b5,null))[_0xe524('0x38')](handleError(_0x2431b5,null));};exports[_0xe524('0xb8')]=function(_0x58c1e3,_0x1cc750,_0x43f3bf){return db[_0xe524('0xb9')][_0xe524('0x5f')]({'where':{'id':_0x58c1e3[_0xe524('0xb1')]['id']}})[_0xe524('0x2d')](handleEntityNotFound(_0x1cc750,null))[_0xe524('0x2d')](function(_0x524e9e){if(_0x524e9e){return _0x524e9e['addMessage'](_0x58c1e3['body']['ids'],_[_0xe524('0xba')](_0x58c1e3[_0xe524('0x73')],['ids','id'])||{});}})[_0xe524('0x2d')](respondWithResult(_0x1cc750,null))[_0xe524('0x38')](handleError(_0x1cc750,null));};exports['getMessages']=function(_0x1529ea,_0xf63d29,_0x4ed1a6){var _0x1b3c48={'raw':![],'where':{}};var _0x16f5bc={};var _0x39bc6f={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xe524('0xbb')]({'where':{'id':_0x1529ea[_0xe524('0xb1')]['id']}})[_0xe524('0x2d')](handleEntityNotFound(_0xf63d29,null))['then'](function(_0x1aaeca){if(_0x1aaeca){_0x16f5bc[_0xe524('0x3e')]=_[_0xe524('0x3f')](db[_0xe524('0xb9')]['rawAttributes']);_0x16f5bc['query']=_[_0xe524('0x3f')](_0x1529ea[_0xe524('0x40')]);_0x16f5bc[_0xe524('0x41')]=_[_0xe524('0x42')](_0x16f5bc[_0xe524('0x3e')],_0x16f5bc[_0xe524('0x40')]);_0x1b3c48[_0xe524('0x43')]=_[_0xe524('0x42')](_0x16f5bc[_0xe524('0x3e')],qs[_0xe524('0x44')](_0x1529ea[_0xe524('0x40')][_0xe524('0x44')]));_0x1b3c48[_0xe524('0x43')]=_0x1b3c48['attributes'][_0xe524('0x45')]?_0x1b3c48[_0xe524('0x43')]:_0x16f5bc[_0xe524('0x3e')];if(!_0x1529ea[_0xe524('0x40')][_0xe524('0x46')](_0xe524('0x47'))){_0x1b3c48['limit']=qs['limit'](_0x1529ea[_0xe524('0x40')]['limit']);_0x1b3c48[_0xe524('0x25')]=qs[_0xe524('0x25')](_0x1529ea[_0xe524('0x40')][_0xe524('0x25')]);}_0x1b3c48[_0xe524('0x48')]=qs[_0xe524('0x49')](_0x1529ea[_0xe524('0x40')]['sort']);_0x1b3c48[_0xe524('0x4a')]=qs[_0xe524('0x41')](_[_0xe524('0x4b')](_0x1529ea[_0xe524('0x40')],_0x16f5bc['filters']));_0x1b3c48[_0xe524('0x4a')][_0xe524('0xbc')]=_0x1aaeca['id'];if(_0x1529ea['query'][_0xe524('0x87')]){_0x1b3c48[_0xe524('0x4a')]=_['merge'](_0x1b3c48['where'],{'$or':_[_0xe524('0x33')](_0x1b3c48[_0xe524('0x43')],function(_0x575c14){var _0x5d2a54={};_0x5d2a54[_0x575c14]={'$like':'%'+_0x1529ea[_0xe524('0x40')]['filter']+'%'};return _0x5d2a54;})});}if(_0x1529ea['query']['$gte']){var _0x337e25=_0x1529ea[_0xe524('0x40')][_0xe524('0x7c')][_0xe524('0x36')](',');var _0x5718a6={};_0x5718a6[_0x337e25[0x0]]={'$gte':moment(_0x337e25[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1b3c48[_0xe524('0x4a')]=_[_0xe524('0xbd')](_0x1b3c48[_0xe524('0x4a')],_0x5718a6);}_0x1b3c48=_[_0xe524('0xbd')]({},_0x1b3c48,_0x1529ea[_0xe524('0xb4')]);return db[_0xe524('0xb9')][_0xe524('0x24')]({'where':_0x1b3c48[_0xe524('0x4a')]})['then'](function(_0x1d57f6){_0x39bc6f[_0xe524('0x24')]=_0x1d57f6;if(_0x1529ea[_0xe524('0x40')][_0xe524('0xb2')]){_0x1b3c48[_0xe524('0xb3')]=[{'all':!![]}];}return db[_0xe524('0xb9')][_0xe524('0xbe')](_0x1b3c48);})[_0xe524('0x2d')](function(_0x117120){_0x39bc6f[_0xe524('0xb0')]=_0x117120;return _0x39bc6f;});}})['then'](respondWithFilteredResult(_0xf63d29,_0x1b3c48))[_0xe524('0x38')](handleError(_0xf63d29,null));};exports[_0xe524('0xbf')]=function(_0xb499ea,_0x188b33,_0x1c59b9){return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0xb499ea[_0xe524('0xb1')]['id']}})['then'](handleEntityNotFound(_0x188b33,null))[_0xe524('0x2d')](function(_0xbf41a2){if(_0xbf41a2){return _0xbf41a2[_0xe524('0xc0')](_0xb499ea[_0xe524('0x73')][_0xe524('0xc1')],_[_0xe524('0xba')](_0xb499ea[_0xe524('0x73')],[_0xe524('0xc1'),'id'])||{})[_0xe524('0xc2')](function(){return db[_0xe524('0x6e')][_0xe524('0xbe')]({'attributes':['id',_0xe524('0x31'),'color'],'where':{'id':_0xb499ea[_0xe524('0x73')][_0xe524('0xc1')]}});})[_0xe524('0x2d')](function(_0x526082){socket['emit'](_0xe524('0xc3'),{'id':Number(_0xb499ea[_0xe524('0xb1')]['id']),'tags':_0x526082||[]});return{'id':Number(_0xb499ea[_0xe524('0xb1')]['id']),'tags':_0x526082||[]};});}})['then'](respondWithResult(_0x188b33,null))[_0xe524('0x38')](handleError(_0x188b33,null));};exports[_0xe524('0xc4')]=function(_0x339572,_0x541b33,_0x4952b9){return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0x339572[_0xe524('0xb1')]['id']}})['then'](handleEntityNotFound(_0x541b33,null))[_0xe524('0x2d')](function(_0x37f1ad){if(_0x37f1ad){return _0x37f1ad[_0xe524('0xc4')](_0x339572[_0xe524('0x40')][_0xe524('0xc1')]);}})[_0xe524('0x2d')](respondWithStatusCode(_0x541b33,null))[_0xe524('0x38')](handleError(_0x541b33,null));};exports['download']=function(_0x38a6df,_0x2c2eb2){var _0x20baec=moment()[_0xe524('0xc5')]()[_0xe524('0x9d')]();var _0x4d44a6=path[_0xe524('0xc6')](config[_0xe524('0xc7')],'server',_0xe524('0xc8'),_0xe524('0xc9'));var _0x1013f2=path[_0xe524('0xc6')](config[_0xe524('0xc7')],_0xe524('0xca'),_0xe524('0xc8'),_0xe524('0xcb'));var _0x44e73e=path['join'](_0x4d44a6,_0x20baec);var _0x53eb8d=util[_0xe524('0xcc')](_0xe524('0xcd'),_0x38a6df[_0xe524('0xb1')]['id'],_0x20baec);var _0x2f6b8=path[_0xe524('0xc6')](_0x4d44a6,_0x53eb8d);var _0x427752=[];_0x427752[_0xe524('0x37')]({'model':db['User'],'as':'User','attributes':['id',_0xe524('0x34')],'raw':!![]});_0x427752['push']({'model':db['CmContact'],'as':_0xe524('0x64'),'attributes':['id',_0xe524('0xce'),_0xe524('0xcf')],'raw':!![]});if(_0x38a6df[_0xe524('0x40')][_0xe524('0xcb')]){_0x427752[_0xe524('0x37')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x46e4d8=[{'model':db[_0xe524('0xb9')],'as':_0xe524('0xd0'),'attributes':['id','body',_0xe524('0x7a'),_0xe524('0xd1'),_0xe524('0xd2'),_0xe524('0x82')],'include':_0x427752}];_0x46e4d8['push']({'model':db['WhatsappAccount'],'as':_0xe524('0xd3'),'attributes':['id','name']});_0x46e4d8[_0xe524('0x37')]({'model':db[_0xe524('0xd4')],'as':_0xe524('0xd5'),'attributes':['id',_0xe524('0x34')]});return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0x38a6df[_0xe524('0xb1')]['id']},'include':_0x46e4d8})[_0xe524('0x2d')](handleEntityNotFound(_0x2c2eb2,null))[_0xe524('0x2d')](function(_0x165241){if(_0x165241){var _0x5f0baa=_0x165241[_0xe524('0xd6')]({'plain':!![]});fs[_0xe524('0xd7')](_0x44e73e);var _0x3a78fe={'format':'A4','border':'10px','header':{'height':_0xe524('0xd8'),'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':_0xe524('0xd9'),'contents':{'default':util['format'](_0xe524('0xda'),util['format'](_0xe524('0xdb'),'Whatsapp',_0x5f0baa['id']),moment()[_0xe524('0xcc')]('YYYY-MM-DD')['toString']())}}};var _0x5da172={'channel':'Whatsapp','account':_0x5f0baa[_0xe524('0xd3')][_0xe524('0x31')],'agent':_0x5f0baa[_0xe524('0xd5')]?_0x5f0baa['Owner'][_0xe524('0x34')]:'N.A.','createdAt':moment(_0x5f0baa[_0xe524('0x7a')])[_0xe524('0xcc')](_0xe524('0xdc'))[_0xe524('0x9d')](),'closedAt':_0x5f0baa['closed']?moment(_0x5f0baa['closedAt'])[_0xe524('0xcc')](_0xe524('0xdc'))[_0xe524('0x9d')]():'','disposition':_0x5f0baa[_0xe524('0xdd')],'messages':_(_0x5f0baa[_0xe524('0xd0')])['filter']({'secret':![]})[_0xe524('0x33')](function(_0x3340fa){if(_0x3340fa['Attachment']){var _0x320b6b=path[_0xe524('0xc6')](_0x1013f2,_0x3340fa[_0xe524('0xde')][_0xe524('0xdf')]);if(fs[_0xe524('0xe0')](_0x320b6b)){fs[_0xe524('0xe1')](_0x320b6b)[_0xe524('0xe2')](fs[_0xe524('0xe3')](path[_0xe524('0xc6')](_0x44e73e,_0x3340fa[_0xe524('0xde')][_0xe524('0xdf')])));}}return{'date':moment(_0x3340fa[_0xe524('0x7a')])[_0xe524('0xcc')](_0xe524('0xdc'))['toString'](),'sender':_0x3340fa[_0xe524('0xd1')]===_0xe524('0xe4')?_0x3340fa['User']?_0x3340fa[_0xe524('0xd4')][_0xe524('0x34')]:_0xe524('0xe5'):_0x3340fa[_0xe524('0x64')][_0xe524('0xce')]+(_0x3340fa[_0xe524('0x64')][_0xe524('0xcf')]?'\x20'+_0x3340fa[_0xe524('0x64')]['lastName']:''),'body':_0x3340fa['Attachment']?_0x3340fa[_0xe524('0xde')][_0xe524('0xdf')]:_0x3340fa['body'],'direction':_0x3340fa[_0xe524('0xd1')]===_0xe524('0xe4')?'A':'C','secret':_0x3340fa[_0xe524('0xd2')],'read':_0x3340fa['read'],'attachment':_0x3340fa['Attachment']};})['value']()};return ejs[_0xe524('0xe6')](path[_0xe524('0xc6')](config[_0xe524('0xc7')],'server',_0xe524('0xe7'),'downloadInteraction.html'),{'interaction':_0x5da172})[_0xe524('0x2d')](function(_0x2667bc){return new BPromise(function(_0x4f4cfd,_0x1c8e99){pdf[_0xe524('0xb5')](_0x2667bc,_0x3a78fe)[_0xe524('0xe8')](path[_0xe524('0xc6')](_0x44e73e,_0xe524('0xe9')+_0x5f0baa['id']+'-'+_0x20baec+_0xe524('0xea')),function(_0x2cd25d,_0x4c8cac){if(_0x2cd25d)return _0x1c8e99(_0x2cd25d);_0x4f4cfd(_0x4c8cac);});});})['then'](function(){return new BPromise(function(_0x551b0b,_0x49baca){zipdir(_0x44e73e,{'saveTo':_0x2f6b8},function(_0x297446,_0x1208c4){if(_0x297446)return _0x49baca(_0x297446);return _0x551b0b(_0x1208c4);});})[_0xe524('0x2d')](function(){return new BPromise(function(_0x2288a8,_0x3d56dd){rimraf(_0x44e73e,function(_0x293bed){if(_0x293bed)_0x3d56dd(_0x293bed);return _0x2288a8();});});})['then'](function(){return _0x2c2eb2[_0xe524('0xeb')](_0x2f6b8,_0x53eb8d,function(_0x59cb98){if(_0x59cb98){console[_0xe524('0xec')](_0xe524('0xed'),_0x59cb98);}else{fs[_0xe524('0xee')](_0x2f6b8);}});});});}else{return _0x2c2eb2['sendStatus'](0xc8);}})[_0xe524('0x38')](handleError(_0x2c2eb2,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index b2f098f..6f176b4 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 _0x40bc=['WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','../../mysqldb'];(function(_0xa490d4,_0x5627a3){var _0x367ad9=function(_0x317b29){while(--_0x317b29){_0xa490d4['push'](_0xa490d4['shift']());}};_0x367ad9(++_0x5627a3);}(_0x40bc,0x1db));var _0xc40b=function(_0x138a65,_0x4c5aa6){_0x138a65=_0x138a65-0x0;var _0x331250=_0x40bc[_0x138a65];return _0x331250;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xc40b('0x0'))['db'][_0xc40b('0x1')];var WhatsappMessage=require(_0xc40b('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc40b('0x2')](0x0);var events={'afterCreate':_0xc40b('0x3'),'afterUpdate':_0xc40b('0x4'),'afterDestroy':_0xc40b('0x5')};function emitEvent(_0x38814b){return function(_0x672c94,_0x281711,_0x1ea5b2){_0x672c94[_0xc40b('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1bca8e){_0x672c94[_0xc40b('0x7')](_0xc40b('0x8'),_0x1bca8e[_0xc40b('0x9')](function(_0x428a61){return{'id':_0x428a61['id']};}));return WhatsappMessage[_0xc40b('0xa')]({'where':{'WhatsappInteractionId':_0x672c94['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc40b('0xb')](function(_0x4284fe){_0x672c94['setDataValue'](_0xc40b('0xc'),_0x4284fe[_0xc40b('0xd')]);WhatsappInteractionEvents[_0xc40b('0xe')](_0x38814b+':'+_0x672c94['id'],_0x672c94);WhatsappInteractionEvents[_0xc40b('0xe')](_0x38814b,_0x672c94);_0x1ea5b2(null);})[_0xc40b('0xf')](_0x1ea5b2(null));};}for(var e in events){if(events[_0xc40b('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x3ee7=['events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0x3ee7,0xe1));var _0x73ee=function(_0x1e6a20,_0x493dbb){_0x1e6a20=_0x1e6a20-0x0;var _0xfdea1e=_0x3ee7[_0x1e6a20];return _0xfdea1e;};'use strict';var EventEmitter=require(_0x73ee('0x0'));var WhatsappInteraction=require(_0x73ee('0x1'))['db'][_0x73ee('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x73ee('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x73ee('0x4')](0x0);var events={'afterCreate':_0x73ee('0x5'),'afterUpdate':'update','afterDestroy':_0x73ee('0x6')};function emitEvent(_0x5427ef){return function(_0x2bfb20,_0x23d233,_0x302ca1){_0x2bfb20[_0x73ee('0x7')]({'attributes':['id'],'raw':!![]})[_0x73ee('0x8')](function(_0x32d107){_0x2bfb20['setDataValue']('Users',_0x32d107['map'](function(_0x27f40a){return{'id':_0x27f40a['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2bfb20['id'],'direction':'in','read':![]},'raw':!![]});})[_0x73ee('0x8')](function(_0xc418a){_0x2bfb20[_0x73ee('0x9')](_0x73ee('0xa'),_0xc418a[_0x73ee('0xb')]);WhatsappInteractionEvents[_0x73ee('0xc')](_0x5427ef+':'+_0x2bfb20['id'],_0x2bfb20);WhatsappInteractionEvents[_0x73ee('0xc')](_0x5427ef,_0x2bfb20);_0x302ca1(null);})['catch'](_0x302ca1(null));};}for(var e in events){if(events[_0x73ee('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x73ee('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 5038d3b..0e36b10 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 _0xc76c=['api','moment','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x50e30b,_0x216368){var _0x4b7300=function(_0x8f06d7){while(--_0x8f06d7){_0x50e30b['push'](_0x50e30b['shift']());}};_0x4b7300(++_0x216368);}(_0xc76c,0x1ed));var _0xcc76=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc76c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcc76('0x0'));var util=require(_0xcc76('0x1'));var logger=require('../../config/logger')(_0xcc76('0x2'));var moment=require(_0xcc76('0x3'));var BPromise=require(_0xcc76('0x4'));var rp=require(_0xcc76('0x5'));var fs=require('fs');var path=require(_0xcc76('0x6'));var rimraf=require(_0xcc76('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc76('0x8'));module[_0xcc76('0x9')]=function(_0xbd7091,_0x13f225){return _0xbd7091[_0xcc76('0xa')]('WhatsappInteraction',attributes,{'tableName':_0xcc76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c0fde,_0x5c81ed,_0x445370){if(_0x1c0fde[_0xcc76('0xc')]('closed')){_0x1c0fde[_0xcc76('0xd')]=moment()['format'](_0xcc76('0xe'));}_0x445370(null,_0x1c0fde);}}});}; \ No newline at end of file +var _0xe78a=['bluebird','request-promise','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xe78a,0x173));var _0xae78=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe78a[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xae78('0x0'));var logger=require(_0xae78('0x1'))(_0xae78('0x2'));var moment=require(_0xae78('0x3'));var BPromise=require(_0xae78('0x4'));var rp=require(_0xae78('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xae78('0x6'));module[_0xae78('0x7')]=function(_0xfec8ba,_0x3cc22b){return _0xfec8ba[_0xae78('0x8')](_0xae78('0x9'),attributes,{'tableName':_0xae78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f2717,_0x461790,_0xd98322){if(_0x3f2717[_0xae78('0xb')](_0xae78('0xc'))){_0x3f2717[_0xae78('0xd')]=moment()['format'](_0xae78('0xe'));}_0xd98322(null,_0x3f2717);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e307c3b..3079f77 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 _0xc597=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','localhost','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappInteraction','update','body','options','raw','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring'];(function(_0x3b0075,_0x1952c8){var _0x2202cc=function(_0x186e03){while(--_0x186e03){_0x3b0075['push'](_0x3b0075['shift']());}};_0x2202cc(++_0x1952c8);}(_0xc597,0x76));var _0x7c59=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0xc597[_0x1b51ea];return _0x18bbdc;};'use strict';var _=require(_0x7c59('0x0'));var util=require(_0x7c59('0x1'));var moment=require(_0x7c59('0x2'));var BPromise=require(_0x7c59('0x3'));var rs=require(_0x7c59('0x4'));var fs=require('fs');var Redis=require(_0x7c59('0x5'));var db=require(_0x7c59('0x6'))['db'];var utils=require(_0x7c59('0x7'));var logger=require(_0x7c59('0x8'))(_0x7c59('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7c59('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7c59('0xb')],{'host':_0x7c59('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c59('0xb')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x959c72,_0x4be257,_0x833afe){return new BPromise(function(_0x30c718,_0x12cb75){return client[_0x7c59('0xd')](_0x959c72,_0x833afe)[_0x7c59('0xe')](function(_0x3558a5){logger[_0x7c59('0xf')](_0x7c59('0x10'),_0x4be257,'request\x20sent');logger[_0x7c59('0x11')](_0x7c59('0x12'),_0x4be257,_0x7c59('0x13'),JSON[_0x7c59('0x14')](_0x3558a5));if(_0x3558a5[_0x7c59('0x15')]){if(_0x3558a5[_0x7c59('0x15')][_0x7c59('0x16')]===0x1f4){logger[_0x7c59('0x15')](_0x7c59('0x10'),_0x4be257,_0x3558a5[_0x7c59('0x15')]['message']);return _0x12cb75(_0x3558a5[_0x7c59('0x15')]['message']);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x4be257,_0x3558a5[_0x7c59('0x15')][_0x7c59('0x17')]);return _0x30c718(_0x3558a5[_0x7c59('0x15')][_0x7c59('0x17')]);}else{logger[_0x7c59('0xf')](_0x7c59('0x10'),_0x4be257,'request\x20sent');_0x30c718(_0x3558a5[_0x7c59('0x18')][_0x7c59('0x17')]);}})[_0x7c59('0x19')](function(_0x16eff7){logger[_0x7c59('0x15')](_0x7c59('0x10'),_0x4be257,_0x16eff7);_0x12cb75(_0x16eff7);});});}exports['UpdateWhatsappInteraction']=function(_0x4b1750){var _0x4e0fa0=this;return new Promise(function(_0x1ab2b5,_0x2453a8){return db[_0x7c59('0x1a')][_0x7c59('0x1b')](_0x4b1750[_0x7c59('0x1c')],{'raw':_0x4b1750['options']?_0x4b1750[_0x7c59('0x1d')][_0x7c59('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1750[_0x7c59('0x1d')]?_0x4b1750['options']['where']||null:null,'attributes':_0x4b1750[_0x7c59('0x1d')]?_0x4b1750['options'][_0x7c59('0x1f')]||null:null,'limit':_0x4b1750[_0x7c59('0x1d')]?_0x4b1750[_0x7c59('0x1d')][_0x7c59('0x20')]||null:null})[_0x7c59('0xe')](function(_0x59097f){logger['info'](_0x7c59('0x21'),_0x4b1750);logger[_0x7c59('0x11')](_0x7c59('0x21'),_0x4b1750,JSON[_0x7c59('0x14')](_0x59097f));_0x1ab2b5(_0x59097f);})[_0x7c59('0x19')](function(_0x7cb3de){logger[_0x7c59('0x15')]('UpdateWhatsappInteraction',_0x7cb3de[_0x7c59('0x17')],_0x4b1750);_0x2453a8(_0x4e0fa0[_0x7c59('0x15')](0x1f4,_0x7cb3de[_0x7c59('0x17')]));});});};exports[_0x7c59('0x22')]=function(_0x90aa01){return new Promise(function(_0x1a241f,_0x41ba87){return db[_0x7c59('0x1a')]['find']({'where':_0x90aa01['options']?_0x90aa01[_0x7c59('0x1d')][_0x7c59('0x23')]||null:null})[_0x7c59('0xe')](function(_0x53ff00){if(_0x53ff00){return _0x53ff00[_0x7c59('0x24')](_0x90aa01[_0x7c59('0x1c')]['ids'],_[_0x7c59('0x25')](_0x90aa01[_0x7c59('0x1c')],[_0x7c59('0x26'),'id'])||{});}})[_0x7c59('0x27')](function(_0x2c0ffe){logger[_0x7c59('0xf')](_0x7c59('0x28'),_0x90aa01);logger['debug']('AddTags',_0x90aa01,JSON[_0x7c59('0x14')](_0x2c0ffe));_0x1a241f(_0x2c0ffe);})['catch'](function(_0x3d7dce){logger[_0x7c59('0x15')](_0x7c59('0x28'),_0x3d7dce[_0x7c59('0x17')],_0x90aa01);_0x41ba87(_this['error'](0x1f4,_0x3d7dce['message']));});});}; \ No newline at end of file +var _0xb2e5=['error','code','message','info','result','WhatsappInteraction','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','catch','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f4791,_0x8fe6c5){var _0x3b82e1=function(_0x57c6f1){while(--_0x57c6f1){_0x2f4791['push'](_0x2f4791['shift']());}};_0x3b82e1(++_0x8fe6c5);}(_0xb2e5,0x1bc));var _0x5b2e=function(_0x27f82e,_0x2259d7){_0x27f82e=_0x27f82e-0x0;var _0x1e36ef=_0xb2e5[_0x27f82e];return _0x1e36ef;};'use strict';var _=require(_0x5b2e('0x0'));var util=require(_0x5b2e('0x1'));var moment=require(_0x5b2e('0x2'));var BPromise=require(_0x5b2e('0x3'));var rs=require(_0x5b2e('0x4'));var fs=require('fs');var Redis=require(_0x5b2e('0x5'));var db=require(_0x5b2e('0x6'))['db'];var utils=require(_0x5b2e('0x7'));var logger=require('../../config/logger')(_0x5b2e('0x8'));var config=require(_0x5b2e('0x9'));var jayson=require(_0x5b2e('0xa'));var client=jayson[_0x5b2e('0xb')][_0x5b2e('0xc')]({'port':0x232a});config[_0x5b2e('0xd')]=_[_0x5b2e('0xe')](config[_0x5b2e('0xd')],{'host':_0x5b2e('0xf'),'port':0x18eb});var socket=require(_0x5b2e('0x10'))(new Redis(config[_0x5b2e('0xd')]));require(_0x5b2e('0x11'))[_0x5b2e('0x12')](socket);function respondWithRpcPromise(_0x47e838,_0xfcab5,_0x448dd6){return new BPromise(function(_0x16cc6e,_0xa6e5ea){return client[_0x5b2e('0x13')](_0x47e838,_0x448dd6)[_0x5b2e('0x14')](function(_0x577095){logger['info'](_0x5b2e('0x15'),_0xfcab5,_0x5b2e('0x16'));logger[_0x5b2e('0x17')](_0x5b2e('0x18'),_0xfcab5,_0x5b2e('0x16'),JSON[_0x5b2e('0x19')](_0x577095));if(_0x577095[_0x5b2e('0x1a')]){if(_0x577095[_0x5b2e('0x1a')][_0x5b2e('0x1b')]===0x1f4){logger[_0x5b2e('0x1a')](_0x5b2e('0x15'),_0xfcab5,_0x577095[_0x5b2e('0x1a')][_0x5b2e('0x1c')]);return _0xa6e5ea(_0x577095[_0x5b2e('0x1a')][_0x5b2e('0x1c')]);}logger[_0x5b2e('0x1a')](_0x5b2e('0x15'),_0xfcab5,_0x577095['error'][_0x5b2e('0x1c')]);return _0x16cc6e(_0x577095[_0x5b2e('0x1a')][_0x5b2e('0x1c')]);}else{logger[_0x5b2e('0x1d')]('WhatsappInteraction,\x20%s,\x20%s',_0xfcab5,_0x5b2e('0x16'));_0x16cc6e(_0x577095[_0x5b2e('0x1e')][_0x5b2e('0x1c')]);}})['catch'](function(_0x38b457){logger[_0x5b2e('0x1a')]('WhatsappInteraction,\x20%s,\x20%s',_0xfcab5,_0x38b457);_0xa6e5ea(_0x38b457);});});}exports['UpdateWhatsappInteraction']=function(_0x492459){var _0x4cb722=this;return new Promise(function(_0xb76300,_0x1035a6){return db[_0x5b2e('0x1f')][_0x5b2e('0x20')](_0x492459[_0x5b2e('0x21')],{'raw':_0x492459['options']?_0x492459[_0x5b2e('0x22')][_0x5b2e('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x492459[_0x5b2e('0x22')]?_0x492459[_0x5b2e('0x22')][_0x5b2e('0x24')]||null:null,'attributes':_0x492459[_0x5b2e('0x22')]?_0x492459[_0x5b2e('0x22')][_0x5b2e('0x25')]||null:null,'limit':_0x492459['options']?_0x492459['options'][_0x5b2e('0x26')]||null:null})[_0x5b2e('0x14')](function(_0x20cd88){logger['info'](_0x5b2e('0x27'),_0x492459);logger[_0x5b2e('0x17')](_0x5b2e('0x27'),_0x492459,JSON['stringify'](_0x20cd88));_0xb76300(_0x20cd88);})[_0x5b2e('0x28')](function(_0x477a6c){logger[_0x5b2e('0x1a')](_0x5b2e('0x27'),_0x477a6c[_0x5b2e('0x1c')],_0x492459);_0x1035a6(_0x4cb722[_0x5b2e('0x1a')](0x1f4,_0x477a6c[_0x5b2e('0x1c')]));});});};exports[_0x5b2e('0x29')]=function(_0x39fafd){return new Promise(function(_0xa69b50,_0x36a183){return db[_0x5b2e('0x1f')][_0x5b2e('0x2a')]({'where':_0x39fafd[_0x5b2e('0x22')]?_0x39fafd[_0x5b2e('0x22')][_0x5b2e('0x24')]||null:null})[_0x5b2e('0x14')](function(_0x4d756a){if(_0x4d756a){return _0x4d756a[_0x5b2e('0x2b')](_0x39fafd['body']['ids'],_['omit'](_0x39fafd[_0x5b2e('0x21')],[_0x5b2e('0x2c'),'id'])||{});}})[_0x5b2e('0x2d')](function(_0x2885a1){logger[_0x5b2e('0x1d')](_0x5b2e('0x2e'),_0x39fafd);logger[_0x5b2e('0x17')](_0x5b2e('0x2e'),_0x39fafd,JSON[_0x5b2e('0x19')](_0x2885a1));_0xa69b50(_0x2885a1);})[_0x5b2e('0x28')](function(_0x3d30e0){logger['error'](_0x5b2e('0x2e'),_0x3d30e0[_0x5b2e('0x1c')],_0x39fafd);_0x36a183(_this[_0x5b2e('0x1a')](0x1f4,_0x3d30e0[_0x5b2e('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 8d882c1..6267de7 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 _0xc7bf=['length','whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','removeListener','register'];(function(_0x477c1b,_0x2f3273){var _0x5cb6b4=function(_0x262dcf){while(--_0x262dcf){_0x477c1b['push'](_0x477c1b['shift']());}};_0x5cb6b4(++_0x2f3273);}(_0xc7bf,0xf2));var _0xfc7b=function(_0x27937c,_0x5ad860){_0x27937c=_0x27937c-0x0;var _0x196da6=_0xc7bf[_0x27937c];return _0x196da6;};'use strict';var WhatsappInteractionEvents=require(_0xfc7b('0x0'));var events=['save',_0xfc7b('0x1'),_0xfc7b('0x2')];function createListener(_0x21ae26,_0x2b2c2a){return function(_0x2de138){_0x2b2c2a[_0xfc7b('0x3')](_0x21ae26,_0x2de138);};}function removeListener(_0x47b2b2,_0x375400){return function(){WhatsappInteractionEvents[_0xfc7b('0x4')](_0x47b2b2,_0x375400);};}exports[_0xfc7b('0x5')]=function(_0x229e7c){for(var _0x4f752e=0x0,_0x16a5e6=events[_0xfc7b('0x6')];_0x4f752e<_0x16a5e6;_0x4f752e++){var _0x4f5409=events[_0x4f752e];var _0x1ca07b=createListener(_0xfc7b('0x7')+_0x4f5409,_0x229e7c);WhatsappInteractionEvents['on'](_0x4f5409,_0x1ca07b);}}; \ No newline at end of file +var _0xf93f=['remove','update','register','save'];(function(_0x1231d3,_0x2ea4f8){var _0x92313c=function(_0xbf128e){while(--_0xbf128e){_0x1231d3['push'](_0x1231d3['shift']());}};_0x92313c(++_0x2ea4f8);}(_0xf93f,0x12f));var _0xff93=function(_0x153840,_0x4f7893){_0x153840=_0x153840-0x0;var _0x1ddf7f=_0xf93f[_0x153840];return _0x1ddf7f;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xff93('0x0'),_0xff93('0x1'),_0xff93('0x2')];function createListener(_0x280172,_0x2b4f24){return function(_0x292703){_0x2b4f24['emit'](_0x280172,_0x292703);};}function removeListener(_0x4a09c5,_0x3e8fd3){return function(){WhatsappInteractionEvents['removeListener'](_0x4a09c5,_0x3e8fd3);};}exports[_0xff93('0x3')]=function(_0x259bf1){for(var _0x3b0a28=0x0,_0x30d8fc=events['length'];_0x3b0a28<_0x30d8fc;_0x3b0a28++){var _0x4e3da6=events[_0x3b0a28];var _0x1b4818=createListener('whatsappInteraction:'+_0x4e3da6,_0x259bf1);WhatsappInteractionEvents['on'](_0x4e3da6,_0x1b4818);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 96133b8..089a333 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 _0xb1b0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','post','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','express'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0xb1b0,0x100));var _0x0b1b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb1b0[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x0b1b('0x0'));var util=require(_0x0b1b('0x1'));var path=require(_0x0b1b('0x2'));var timeout=require(_0x0b1b('0x3'));var express=require(_0x0b1b('0x4'));var router=express[_0x0b1b('0x5')]();var auth=require(_0x0b1b('0x6'));var interaction=require(_0x0b1b('0x7'));var config=require(_0x0b1b('0x8'));var controller=require(_0x0b1b('0x9'));router[_0x0b1b('0xa')]('/',auth[_0x0b1b('0xb')](),controller[_0x0b1b('0xc')]);router['get'](_0x0b1b('0xd'),auth[_0x0b1b('0xb')](),controller[_0x0b1b('0xe')]);router[_0x0b1b('0xa')](_0x0b1b('0xf'),auth[_0x0b1b('0xb')](),controller[_0x0b1b('0x10')]);router['post']('/',auth[_0x0b1b('0xb')](),interaction[_0x0b1b('0x11')](_0x0b1b('0x12'),_0x0b1b('0x13')),controller['create']);router[_0x0b1b('0x14')](_0x0b1b('0x15'),controller[_0x0b1b('0x16')]);router[_0x0b1b('0x17')](_0x0b1b('0xf'),auth[_0x0b1b('0xb')](),controller['update']);router[_0x0b1b('0x17')](_0x0b1b('0x18'),auth[_0x0b1b('0xb')](),controller[_0x0b1b('0x19')]);router[_0x0b1b('0x17')](_0x0b1b('0x1a'),auth[_0x0b1b('0xb')](),controller[_0x0b1b('0x1b')]);router[_0x0b1b('0x1c')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xabf2=['post','/:id/status','update','put','/:id/accept','accept','/:id/reject','reject','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','index','get','/describe','describe','/:id','isAuthenticated','tracked','create'];(function(_0x1bd5f2,_0x10740c){var _0x242c9a=function(_0x67ca9e){while(--_0x67ca9e){_0x1bd5f2['push'](_0x1bd5f2['shift']());}};_0x242c9a(++_0x10740c);}(_0xabf2,0x8a));var _0x2abf=function(_0x43f3e3,_0x299b71){_0x43f3e3=_0x43f3e3-0x0;var _0x143d4d=_0xabf2[_0x43f3e3];return _0x143d4d;};'use strict';var multer=require(_0x2abf('0x0'));var util=require(_0x2abf('0x1'));var path=require(_0x2abf('0x2'));var timeout=require(_0x2abf('0x3'));var express=require(_0x2abf('0x4'));var router=express[_0x2abf('0x5')]();var auth=require(_0x2abf('0x6'));var interaction=require(_0x2abf('0x7'));var config=require(_0x2abf('0x8'));var controller=require(_0x2abf('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2abf('0xa')]);router[_0x2abf('0xb')](_0x2abf('0xc'),auth['isAuthenticated'](),controller[_0x2abf('0xd')]);router[_0x2abf('0xb')](_0x2abf('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2abf('0xf')](),interaction[_0x2abf('0x10')]('whatsapp','whatsappmessage:create'),controller[_0x2abf('0x11')]);router[_0x2abf('0x12')](_0x2abf('0x13'),controller['status']);router['put']('/:id',auth[_0x2abf('0xf')](),controller[_0x2abf('0x14')]);router[_0x2abf('0x15')](_0x2abf('0x16'),auth[_0x2abf('0xf')](),controller[_0x2abf('0x17')]);router[_0x2abf('0x15')](_0x2abf('0x18'),auth[_0x2abf('0xf')](),controller[_0x2abf('0x19')]);router['delete'](_0x2abf('0xe'),auth[_0x2abf('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 851040e..7b9ae48 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 _0x6d66=['medium','BOOLEAN','out','STRING','DATE','TEXT','exports'];(function(_0x46d84e,_0x552373){var _0x49085d=function(_0x28796d){while(--_0x28796d){_0x46d84e['push'](_0x46d84e['shift']());}};_0x49085d(++_0x552373);}(_0x6d66,0x1b8));var _0x66d6=function(_0x3893cb,_0x238307){_0x3893cb=_0x3893cb-0x0;var _0x134045=_0x6d66[_0x3893cb];return _0x134045;};'use strict';var Sequelize=require('sequelize');module[_0x66d6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x66d6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x66d6('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x66d6('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x66d6('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x66d6('0x5')]},'secret':{'type':Sequelize[_0x66d6('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x66d6('0x4')]},'providerResponse':{'type':Sequelize[_0x66d6('0x6')]}}; \ No newline at end of file +var _0x0b2d=['BOOLEAN','ENUM','out','STRING','TEXT','medium'];(function(_0x424497,_0xacd414){var _0x2877bc=function(_0x20f599){while(--_0x20f599){_0x424497['push'](_0x424497['shift']());}};_0x2877bc(++_0xacd414);}(_0x0b2d,0x130));var _0xd0b2=function(_0x1f5f4a,_0x2d432e){_0x1f5f4a=_0x1f5f4a-0x0;var _0x136cc2=_0x0b2d[_0x1f5f4a];return _0x136cc2;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd0b2('0x0')](_0xd0b2('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xd0b2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd0b2('0x3')]('in',_0xd0b2('0x4')),'defaultValue':_0xd0b2('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd0b2('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xd0b2('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd0b2('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index c1d4cd4..27a13d6 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 _0x2deb=['catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','then','destroy','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','params','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','format','UserId','user','agent','Contact','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','manual','interface','event','EventManager','acceptmessage','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','channel','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb2de('0x0'));var emlformat=require(_0xb2de('0x1'));var rimraf=require(_0xb2de('0x2'));var zipdir=require(_0xb2de('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb2de('0x4'));var BPromise=require(_0xb2de('0x5'));var Mustache=require(_0xb2de('0x6'));var util=require(_0xb2de('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb2de('0x8'));var ejs=require(_0xb2de('0x9'));var fs=require('fs');var _=require(_0xb2de('0xa'));var squel=require('squel');var crypto=require(_0xb2de('0xb'));var jsforce=require(_0xb2de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb2de('0x8'));var querystring=require(_0xb2de('0xd'));var Papa=require(_0xb2de('0xe'));var Redis=require('ioredis');var authService=require(_0xb2de('0xf'));var qs=require(_0xb2de('0x10'));var as=require(_0xb2de('0x11'));var hardwareService=require(_0xb2de('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xb2de('0x13'));var config=require(_0xb2de('0x14'));var licenseUtil=require(_0xb2de('0x15'));var db=require('../../mysqldb')['db'];config[_0xb2de('0x16')]=_[_0xb2de('0x17')](config[_0xb2de('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xb2de('0x18'))(new Redis(config['redis']));require(_0xb2de('0x19'))['register'](socket);var jayson=require(_0xb2de('0x1a'));var client=jayson[_0xb2de('0x1b')][_0xb2de('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xb2de('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x40f29d,_0x2dc98f,_0x1413f6,_0x317528){return new BPromise(function(_0x2dc15c,_0x1d4a41){var _0x2db287=_0x317528||client;return _0x2db287[_0xb2de('0x1d')](_0x40f29d,_0x1413f6)['then'](function(_0x2a7e89){logger['info'](_0xb2de('0x1e'),_0x2dc98f,_0xb2de('0x1f'));logger['debug'](_0xb2de('0x20'),_0x2dc98f,_0xb2de('0x1f'),JSON['stringify'](_0x2a7e89));if(_0x2a7e89[_0xb2de('0x21')]){if(_0x2a7e89[_0xb2de('0x21')][_0xb2de('0x22')]===0x1f4){logger[_0xb2de('0x21')](_0xb2de('0x1e'),_0x2dc98f,_0x2a7e89[_0xb2de('0x21')][_0xb2de('0x23')]);return _0x1d4a41(_0x2a7e89[_0xb2de('0x21')][_0xb2de('0x23')]);}logger['error'](_0xb2de('0x1e'),_0x2dc98f,_0x2a7e89[_0xb2de('0x21')][_0xb2de('0x23')]);return _0x2dc15c(_0x2a7e89[_0xb2de('0x21')]['message']);}else{logger['info'](_0xb2de('0x1e'),_0x2dc98f,_0xb2de('0x1f'));_0x2dc15c(_0x2a7e89[_0xb2de('0x24')]['message']);}})[_0xb2de('0x25')](function(_0x1cc2db){logger['error'](_0xb2de('0x1e'),_0x2dc98f,_0x1cc2db);_0x1d4a41(_0x1cc2db);});});}function respondWithStatusCode(_0x5b7c2f,_0x2d9fd1){_0x2d9fd1=_0x2d9fd1||0xcc;return function(_0xd6693f){if(_0xd6693f){return _0x5b7c2f[_0xb2de('0x26')](_0x2d9fd1);}return _0x5b7c2f[_0xb2de('0x27')](_0x2d9fd1)[_0xb2de('0x28')]();};}function respondWithResult(_0x1ad5a2,_0x48675d){_0x48675d=_0x48675d||0xc8;return function(_0x391bc7){if(_0x391bc7){return _0x1ad5a2['status'](_0x48675d)[_0xb2de('0x29')](_0x391bc7);}};}function respondWithFilteredResult(_0x5c74e6,_0x579d6c){return function(_0x3ed36e){if(_0x3ed36e){var _0x4269ab=_0x3ed36e[_0xb2de('0x2a')],_0x345e20=_0x579d6c[_0xb2de('0x2b')],_0x1b6c37=_0x579d6c[_0xb2de('0x2b')]+_0x579d6c[_0xb2de('0x2c')],_0xd60c6f;if(_0x1b6c37>=_0x4269ab){_0x1b6c37=_0x4269ab;_0xd60c6f=0xc8;}else{_0xd60c6f=0xce;}_0x5c74e6[_0xb2de('0x27')](_0xd60c6f);return _0x5c74e6[_0xb2de('0x2d')](_0xb2de('0x2e'),_0x345e20+'-'+_0x1b6c37+'/'+_0x4269ab)['json'](_0x3ed36e);}return null;};}function patchUpdates(_0x8b8ba2){return function(_0x15864f){try{jsonpatch['apply'](_0x15864f,_0x8b8ba2,!![]);}catch(_0x16b4b8){return BPromise[_0xb2de('0x2f')](_0x16b4b8);}return _0x15864f['save']();};}function saveUpdates(_0x3b9444,_0x4725c4){return function(_0x288177){if(_0x288177){return _0x288177['update'](_0x3b9444)[_0xb2de('0x30')](function(_0x1c24ec){return _0x1c24ec;});}return null;};}function removeEntity(_0x41bd24,_0x4674a6){return function(_0x24afd8){if(_0x24afd8){return _0x24afd8[_0xb2de('0x31')]()[_0xb2de('0x30')](function(){_0x41bd24[_0xb2de('0x27')](0xcc)[_0xb2de('0x28')]();});}};}function handleEntityNotFound(_0x13dc24,_0xf3e60){return function(_0x478be8){if(!_0x478be8){_0x13dc24[_0xb2de('0x26')](0x194);}return _0x478be8;};}function handleError(_0x6d3d3a,_0x8c5564){_0x8c5564=_0x8c5564||0x1f4;return function(_0x1cd4ef){logger[_0xb2de('0x21')](_0x1cd4ef[_0xb2de('0x32')]);if(_0x1cd4ef[_0xb2de('0x33')]){delete _0x1cd4ef[_0xb2de('0x33')];}_0x6d3d3a[_0xb2de('0x27')](_0x8c5564)[_0xb2de('0x34')](_0x1cd4ef);};}exports[_0xb2de('0x35')]=function(_0x3293d1,_0x43ead4){var _0x29ad6c={},_0x104f3c={},_0x5320d9={'count':0x0,'rows':[]};var _0x1e26a7=_['map'](db[_0xb2de('0x36')][_0xb2de('0x37')],function(_0x3e5747){return{'name':_0x3e5747[_0xb2de('0x38')],'type':_0x3e5747[_0xb2de('0x39')][_0xb2de('0x3a')]};});_0x104f3c[_0xb2de('0x3b')]=_[_0xb2de('0x3c')](_0x1e26a7,_0xb2de('0x33'));_0x104f3c[_0xb2de('0x3d')]=_[_0xb2de('0x3e')](_0x3293d1[_0xb2de('0x3d')]);_0x104f3c[_0xb2de('0x3f')]=_[_0xb2de('0x40')](_0x104f3c[_0xb2de('0x3b')],_0x104f3c['query']);_0x29ad6c[_0xb2de('0x41')]=_[_0xb2de('0x40')](_0x104f3c['model'],qs[_0xb2de('0x42')](_0x3293d1[_0xb2de('0x3d')][_0xb2de('0x42')]));_0x29ad6c[_0xb2de('0x41')]=_0x29ad6c['attributes'][_0xb2de('0x43')]?_0x29ad6c[_0xb2de('0x41')]:_0x104f3c['model'];if(!_0x3293d1[_0xb2de('0x3d')][_0xb2de('0x44')]('nolimit')){_0x29ad6c[_0xb2de('0x2c')]=qs['limit'](_0x3293d1['query'][_0xb2de('0x2c')]);_0x29ad6c['offset']=qs['offset'](_0x3293d1[_0xb2de('0x3d')][_0xb2de('0x2b')]);}_0x29ad6c['order']=qs[_0xb2de('0x45')](_0x3293d1[_0xb2de('0x3d')][_0xb2de('0x45')]);_0x29ad6c[_0xb2de('0x46')]=qs['filters'](_[_0xb2de('0x47')](_0x3293d1[_0xb2de('0x3d')],_0x104f3c[_0xb2de('0x3f')]),_0x1e26a7);if(_0x3293d1[_0xb2de('0x3d')][_0xb2de('0x48')]){_0x29ad6c[_0xb2de('0x46')]=_[_0xb2de('0x49')](_0x29ad6c['where'],{'$or':_[_0xb2de('0x3c')](_0x1e26a7,function(_0x153fd4){if(_0x153fd4[_0xb2de('0x39')]!=='VIRTUAL'){var _0x34cf6d={};_0x34cf6d[_0x153fd4['name']]={'$like':'%'+_0x3293d1[_0xb2de('0x3d')][_0xb2de('0x48')]+'%'};return _0x34cf6d;}})});}_0x29ad6c=_[_0xb2de('0x49')]({},_0x29ad6c,_0x3293d1[_0xb2de('0x4a')]);var _0x55a67a={'where':_0x29ad6c[_0xb2de('0x46')]};return db[_0xb2de('0x36')]['count'](_0x55a67a)['then'](function(_0x158d5a){_0x5320d9[_0xb2de('0x2a')]=_0x158d5a;if(_0x3293d1[_0xb2de('0x3d')][_0xb2de('0x4b')]){_0x29ad6c[_0xb2de('0x4c')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xb2de('0x4d')](_0x29ad6c);})['then'](function(_0x277659){_0x5320d9['rows']=_0x277659;return _0x5320d9;})[_0xb2de('0x30')](respondWithFilteredResult(_0x43ead4,_0x29ad6c))[_0xb2de('0x25')](handleError(_0x43ead4,null));};exports['show']=function(_0x2321b1,_0x48f3e6){var _0x411e18={'raw':!![],'where':{'id':_0x2321b1[_0xb2de('0x4e')]['id']}},_0x4688e5={};_0x4688e5[_0xb2de('0x3b')]=_['keys'](db[_0xb2de('0x36')][_0xb2de('0x37')]);_0x4688e5[_0xb2de('0x3d')]=_[_0xb2de('0x3e')](_0x2321b1[_0xb2de('0x3d')]);_0x4688e5['filters']=_[_0xb2de('0x40')](_0x4688e5[_0xb2de('0x3b')],_0x4688e5[_0xb2de('0x3d')]);_0x411e18[_0xb2de('0x41')]=_[_0xb2de('0x40')](_0x4688e5['model'],qs[_0xb2de('0x42')](_0x2321b1[_0xb2de('0x3d')]['fields']));_0x411e18[_0xb2de('0x41')]=_0x411e18['attributes'][_0xb2de('0x43')]?_0x411e18[_0xb2de('0x41')]:_0x4688e5[_0xb2de('0x3b')];if(_0x2321b1[_0xb2de('0x3d')]['includeAll']){_0x411e18[_0xb2de('0x4c')]=[{'all':!![]}];}_0x411e18=_[_0xb2de('0x49')]({},_0x411e18,_0x2321b1['options']);return db['WhatsappMessage'][_0xb2de('0x4f')](_0x411e18)[_0xb2de('0x30')](handleEntityNotFound(_0x48f3e6,null))[_0xb2de('0x30')](respondWithResult(_0x48f3e6,null))[_0xb2de('0x25')](handleError(_0x48f3e6,null));};exports[_0xb2de('0x50')]=function(_0x3320fb,_0x26614a){return db[_0xb2de('0x36')][_0xb2de('0x50')](_0x3320fb[_0xb2de('0x51')],{})[_0xb2de('0x30')](respondWithResult(_0x26614a,0xc9))['catch'](handleError(_0x26614a,null));};exports['update']=function(_0x203884,_0x3f2348){if(_0x203884[_0xb2de('0x51')]['id']){delete _0x203884[_0xb2de('0x51')]['id'];}return db[_0xb2de('0x36')][_0xb2de('0x4f')]({'where':{'id':_0x203884[_0xb2de('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f2348,null))['then'](saveUpdates(_0x203884[_0xb2de('0x51')],null))[_0xb2de('0x30')](respondWithResult(_0x3f2348,null))[_0xb2de('0x25')](handleError(_0x3f2348,null));};exports[_0xb2de('0x31')]=function(_0x5b1ab2,_0x5b47ba){return db[_0xb2de('0x36')][_0xb2de('0x4f')]({'where':{'id':_0x5b1ab2[_0xb2de('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5b47ba,null))[_0xb2de('0x30')](removeEntity(_0x5b47ba,null))[_0xb2de('0x25')](handleError(_0x5b47ba,null));};exports[_0xb2de('0x52')]=function(_0x41ed6a,_0x1a5eba){return db[_0xb2de('0x36')]['describe']()[_0xb2de('0x30')](respondWithResult(_0x1a5eba,null))[_0xb2de('0x25')](handleError(_0x1a5eba,null));};var interaction_log=require(_0xb2de('0x53'))(_0xb2de('0x54'));exports[_0xb2de('0x55')]=function(_0xfce2d5,_0x5cd39f,_0x33b99c){var _0x5c683e={'agent':{},'channel':_0xb2de('0x56')};if(_0xfce2d5[_0xb2de('0x51')]['id']){delete _0xfce2d5['body']['id'];}_0xfce2d5[_0xb2de('0x51')]['read']=!![];_0xfce2d5['body']['readAt']=moment()[_0xb2de('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0xfce2d5['body']['UserId']=_0xfce2d5[_0xb2de('0x51')][_0xb2de('0x58')]||_0xfce2d5[_0xb2de('0x59')]['id'];_0x5c683e[_0xb2de('0x5a')]['id']=_0xfce2d5[_0xb2de('0x51')][_0xb2de('0x58')];return db[_0xb2de('0x36')][_0xb2de('0x4f')]({'where':{'id':_0xfce2d5['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xb2de('0x5b')}]})['then'](handleEntityNotFound(_0x5cd39f,null))['then'](saveUpdates(_0xfce2d5[_0xb2de('0x51')],null))['then'](function(_0xd6c590){if(_0xd6c590){_0x5c683e['message']=_0xd6c590['get']({'plain':!![]});return db[_0xb2de('0x5c')]['find']({'where':{'id':_0xd6c590[_0xb2de('0x5d')]}});}return null;})[_0xb2de('0x30')](handleEntityNotFound(_0x5cd39f,null))[_0xb2de('0x30')](function(_0x116e74){if(_0x116e74){return _0x116e74[_0xb2de('0x5e')]({'UserId':_0xfce2d5[_0xb2de('0x51')][_0xb2de('0x58')],'read1stAt':_[_0xb2de('0x5f')](_0x116e74[_0xb2de('0x60')])?moment()[_0xb2de('0x57')](_0xb2de('0x61')):undefined});}return null;})[_0xb2de('0x30')](function(_0x14a730){if(_0x14a730){_0x5c683e[_0xb2de('0x62')]=_0x14a730['get']({'plain':!![]});interaction_log[_0xb2de('0x63')](_0xb2de('0x64'),_0xfce2d5[_0xb2de('0x59')]['id'],_0xfce2d5[_0xb2de('0x59')][_0xb2de('0x33')],_0xfce2d5[_0xb2de('0x59')][_0xb2de('0x65')],_0x5c683e[_0xb2de('0x62')]['id'],_0xfce2d5['body']?JSON[_0xb2de('0x66')](_0xfce2d5[_0xb2de('0x51')]):_0xb2de('0x67'));return respondWithRpcPromise(_0xb2de('0x68'),_0xb2de('0x69'),_0x5c683e);}return null;})[_0xb2de('0x30')](function(_0x3d9844){if(_0x3d9844){if(_0xfce2d5[_0xb2de('0x51')][_0xb2de('0x6a')]){_0x5c683e[_0xb2de('0x23')][_0xb2de('0x6b')]=util[_0xb2de('0x57')]('SIP/%s',_0xfce2d5[_0xb2de('0x59')][_0xb2de('0x33')]);_0x5c683e[_0xb2de('0x23')]['channel']=_0x5c683e['channel'];_0x5c683e[_0xb2de('0x23')][_0xb2de('0x6c')]=_0xb2de('0x55');return respondWithRpcPromise('EventManager',_0xb2de('0x6d'),{'event':_0xb2de('0x6e'),'message':_0x5c683e[_0xb2de('0x23')]},client9002)[_0xb2de('0x30')](function(){return _0x5c683e;});}return _0x5c683e;}return null;})[_0xb2de('0x30')](respondWithResult(_0x5cd39f,null))[_0xb2de('0x25')](handleError(_0x5cd39f,null));};var interaction_log=require(_0xb2de('0x53'))(_0xb2de('0x54'));exports[_0xb2de('0x2f')]=function(_0x1557a1,_0x588245,_0x563bdb){var _0x357ee5={'agent':{},'channel':_0xb2de('0x56')};if(_0x1557a1['body']['id']){delete _0x1557a1[_0xb2de('0x51')]['id'];}_0x1557a1[_0xb2de('0x51')][_0xb2de('0x58')]=_0x1557a1[_0xb2de('0x51')]['UserId']||_0x1557a1[_0xb2de('0x59')]['id'];_0x357ee5[_0xb2de('0x5a')]['id']=_0x1557a1['body'][_0xb2de('0x58')];return db[_0xb2de('0x36')][_0xb2de('0x4f')]({'where':{'id':_0x1557a1[_0xb2de('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x588245,null))['then'](function(_0x2f9c2b){if(_0x2f9c2b){_0x357ee5[_0xb2de('0x23')]=_0x2f9c2b[_0xb2de('0x6f')]({'plain':!![]});return db[_0xb2de('0x5c')][_0xb2de('0x4f')]({'where':{'id':_0x2f9c2b[_0xb2de('0x5d')]}});}return null;})['then'](handleEntityNotFound(_0x588245,null))['then'](function(_0x79de58){if(_0x79de58){_0x357ee5[_0xb2de('0x62')]=_0x79de58[_0xb2de('0x6f')]({'plain':!![]});interaction_log[_0xb2de('0x63')](_0xb2de('0x70'),_0x1557a1[_0xb2de('0x59')]['id'],_0x1557a1[_0xb2de('0x59')]['name'],_0x1557a1['user']['role'],_0x357ee5[_0xb2de('0x62')]['id'],_0x1557a1[_0xb2de('0x51')]?JSON[_0xb2de('0x66')](_0x1557a1[_0xb2de('0x51')]):_0xb2de('0x67'));return respondWithRpcPromise(_0xb2de('0x71'),_0xb2de('0x72'),_0x357ee5);}return null;})[_0xb2de('0x30')](function(_0x35a9f4){if(_0x35a9f4){_0x35a9f4[_0xb2de('0x23')][_0xb2de('0x6b')]=util[_0xb2de('0x57')](_0xb2de('0x73'),_0x1557a1[_0xb2de('0x59')][_0xb2de('0x33')]);_0x35a9f4[_0xb2de('0x23')][_0xb2de('0x74')]=_0x357ee5['channel'];_0x35a9f4['message'][_0xb2de('0x6c')]=_0xb2de('0x2f');respondWithRpcPromise(_0xb2de('0x6d'),'EventManager',{'event':_0xb2de('0x75'),'message':_0x35a9f4['message']},client9002);return _0x357ee5;}return null;})[_0xb2de('0x30')](respondWithResult(_0x588245,null))[_0xb2de('0x25')](handleError(_0x588245,null));};exports[_0xb2de('0x27')]=function(_0x1787cd,_0x387d19,_0x4d14de){if(_0x1787cd[_0xb2de('0x51')]['id']){delete _0x1787cd[_0xb2de('0x51')]['id'];}var _0x544015;return db[_0xb2de('0x36')]['find']({'where':{'id':_0x1787cd[_0xb2de('0x4e')]['id']}})[_0xb2de('0x30')](handleEntityNotFound(_0x387d19,null))[_0xb2de('0x30')](function(_0x37de79){if(_0x37de79){_0x544015=_0x37de79;return db[_0xb2de('0x76')][_0xb2de('0x4f')]({'where':{'id':_0x37de79[_0xb2de('0x77')]}});}})[_0xb2de('0x30')](handleEntityNotFound(_0x387d19,null))[_0xb2de('0x30')](function(_0x571ef2){if(_0x571ef2){logger['debug'](_0xb2de('0x78'),_0xb2de('0x27'),'received\x20delivery\x20report\x20from',_0x571ef2['type'],util[_0xb2de('0x79')](_0x1787cd[_0xb2de('0x51')],{'showHidden':![],'depth':null}));switch(_0x571ef2['type']){case _0xb2de('0x7a'):if(_0x1787cd[_0xb2de('0x51')]['MessageSid']&&_0x1787cd['body'][_0xb2de('0x7b')]===_0x544015[_0xb2de('0x7c')]&&_0x1787cd[_0xb2de('0x51')][_0xb2de('0x7d')]&&_0x1787cd['body'][_0xb2de('0x7d')]===_0xb2de('0x7e')){return _0x544015[_0xb2de('0x5e')]({'read':!![]});}else{logger[_0xb2de('0x21')](_0xb2de('0x7f'),_0xb2de('0x27'),'twilio',util['inspect'](_0x1787cd[_0xb2de('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x544015;}})[_0xb2de('0x30')](respondWithResult(_0x387d19,null))[_0xb2de('0x25')](handleError(_0x387d19,null));}; \ No newline at end of file +var _0xd4a2=['localhost','socket.io-emitter','jayson/promise','http','client','request','then','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','WhatsappMessage','findAll','rows','show','params','length','includeAll','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','MessageStatus','twilio','html-pdf','zip-dir','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/utils','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xd4a2,0x173));var _0x2d4a=function(_0x534996,_0x29c83e){_0x534996=_0x534996-0x0;var _0x111bbc=_0xd4a2[_0x534996];return _0x111bbc;};'use strict';var pdf=require(_0x2d4a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d4a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d4a('0x2'));var moment=require('moment');var BPromise=require(_0x2d4a('0x3'));var Mustache=require('mustache');var util=require(_0x2d4a('0x4'));var path=require(_0x2d4a('0x5'));var sox=require(_0x2d4a('0x6'));var csv=require(_0x2d4a('0x7'));var ejs=require(_0x2d4a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x7'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];config[_0x2d4a('0x17')]=_[_0x2d4a('0x18')](config[_0x2d4a('0x17')],{'host':_0x2d4a('0x19'),'port':0x18eb});var socket=require(_0x2d4a('0x1a'))(new Redis(config[_0x2d4a('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x2d4a('0x1b'));var client=jayson['client'][_0x2d4a('0x1c')]({'port':0x232c});var client9002=jayson[_0x2d4a('0x1d')][_0x2d4a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3a3156,_0x4c5287,_0x5f825d,_0x5a6378){return new BPromise(function(_0x2838fa,_0x4802f0){var _0x435687=_0x5a6378||client;return _0x435687[_0x2d4a('0x1e')](_0x3a3156,_0x5f825d)[_0x2d4a('0x1f')](function(_0x388371){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4c5287,'request\x20sent');logger[_0x2d4a('0x20')](_0x2d4a('0x21'),_0x4c5287,_0x2d4a('0x22'),JSON[_0x2d4a('0x23')](_0x388371));if(_0x388371[_0x2d4a('0x24')]){if(_0x388371[_0x2d4a('0x24')]['code']===0x1f4){logger['error'](_0x2d4a('0x25'),_0x4c5287,_0x388371[_0x2d4a('0x24')][_0x2d4a('0x26')]);return _0x4802f0(_0x388371[_0x2d4a('0x24')][_0x2d4a('0x26')]);}logger[_0x2d4a('0x24')](_0x2d4a('0x25'),_0x4c5287,_0x388371[_0x2d4a('0x24')]['message']);return _0x2838fa(_0x388371[_0x2d4a('0x24')][_0x2d4a('0x26')]);}else{logger[_0x2d4a('0x27')](_0x2d4a('0x25'),_0x4c5287,_0x2d4a('0x22'));_0x2838fa(_0x388371[_0x2d4a('0x28')][_0x2d4a('0x26')]);}})[_0x2d4a('0x29')](function(_0x54c910){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4c5287,_0x54c910);_0x4802f0(_0x54c910);});});}function respondWithStatusCode(_0x2bb9f0,_0x5029f3){_0x5029f3=_0x5029f3||0xcc;return function(_0x410f7d){if(_0x410f7d){return _0x2bb9f0[_0x2d4a('0x2a')](_0x5029f3);}return _0x2bb9f0[_0x2d4a('0x2b')](_0x5029f3)[_0x2d4a('0x2c')]();};}function respondWithResult(_0x13e769,_0x326c38){_0x326c38=_0x326c38||0xc8;return function(_0x21a473){if(_0x21a473){return _0x13e769[_0x2d4a('0x2b')](_0x326c38)['json'](_0x21a473);}};}function respondWithFilteredResult(_0x436f53,_0x5ce262){return function(_0x221602){if(_0x221602){var _0x9bac28=_0x221602[_0x2d4a('0x2d')],_0xc497ce=_0x5ce262[_0x2d4a('0x2e')],_0x20b87d=_0x5ce262[_0x2d4a('0x2e')]+_0x5ce262['limit'],_0x101382;if(_0x20b87d>=_0x9bac28){_0x20b87d=_0x9bac28;_0x101382=0xc8;}else{_0x101382=0xce;}_0x436f53[_0x2d4a('0x2b')](_0x101382);return _0x436f53[_0x2d4a('0x2f')](_0x2d4a('0x30'),_0xc497ce+'-'+_0x20b87d+'/'+_0x9bac28)[_0x2d4a('0x31')](_0x221602);}return null;};}function patchUpdates(_0x2b66af){return function(_0x57bf71){try{jsonpatch[_0x2d4a('0x32')](_0x57bf71,_0x2b66af,!![]);}catch(_0x31d8ae){return BPromise[_0x2d4a('0x33')](_0x31d8ae);}return _0x57bf71[_0x2d4a('0x34')]();};}function saveUpdates(_0x2bb93d,_0x555317){return function(_0x4d7bc7){if(_0x4d7bc7){return _0x4d7bc7[_0x2d4a('0x35')](_0x2bb93d)[_0x2d4a('0x1f')](function(_0x76e966){return _0x76e966;});}return null;};}function removeEntity(_0x4399a,_0x2d51d1){return function(_0x5801a8){if(_0x5801a8){return _0x5801a8[_0x2d4a('0x36')]()[_0x2d4a('0x1f')](function(){_0x4399a[_0x2d4a('0x2b')](0xcc)[_0x2d4a('0x2c')]();});}};}function handleEntityNotFound(_0x3486c9,_0x4b20e4){return function(_0x1a421c){if(!_0x1a421c){_0x3486c9[_0x2d4a('0x2a')](0x194);}return _0x1a421c;};}function handleError(_0x54d652,_0x2b3093){_0x2b3093=_0x2b3093||0x1f4;return function(_0x1d6313){logger[_0x2d4a('0x24')](_0x1d6313[_0x2d4a('0x37')]);if(_0x1d6313[_0x2d4a('0x38')]){delete _0x1d6313[_0x2d4a('0x38')];}_0x54d652['status'](_0x2b3093)[_0x2d4a('0x39')](_0x1d6313);};}exports[_0x2d4a('0x3a')]=function(_0x3e3256,_0x13f120){var _0x103558={},_0x145f21={},_0x5b49f9={'count':0x0,'rows':[]};var _0x5883f5=_[_0x2d4a('0x3b')](db['WhatsappMessage'][_0x2d4a('0x3c')],function(_0x309e33){return{'name':_0x309e33['fieldName'],'type':_0x309e33[_0x2d4a('0x3d')][_0x2d4a('0x3e')]};});_0x145f21[_0x2d4a('0x3f')]=_[_0x2d4a('0x3b')](_0x5883f5,_0x2d4a('0x38'));_0x145f21[_0x2d4a('0x40')]=_[_0x2d4a('0x41')](_0x3e3256[_0x2d4a('0x40')]);_0x145f21[_0x2d4a('0x42')]=_[_0x2d4a('0x43')](_0x145f21[_0x2d4a('0x3f')],_0x145f21['query']);_0x103558[_0x2d4a('0x44')]=_[_0x2d4a('0x43')](_0x145f21[_0x2d4a('0x3f')],qs[_0x2d4a('0x45')](_0x3e3256[_0x2d4a('0x40')]['fields']));_0x103558['attributes']=_0x103558['attributes']['length']?_0x103558[_0x2d4a('0x44')]:_0x145f21[_0x2d4a('0x3f')];if(!_0x3e3256[_0x2d4a('0x40')][_0x2d4a('0x46')]('nolimit')){_0x103558[_0x2d4a('0x47')]=qs[_0x2d4a('0x47')](_0x3e3256['query'][_0x2d4a('0x47')]);_0x103558[_0x2d4a('0x2e')]=qs[_0x2d4a('0x2e')](_0x3e3256[_0x2d4a('0x40')][_0x2d4a('0x2e')]);}_0x103558[_0x2d4a('0x48')]=qs['sort'](_0x3e3256[_0x2d4a('0x40')][_0x2d4a('0x49')]);_0x103558[_0x2d4a('0x4a')]=qs[_0x2d4a('0x42')](_[_0x2d4a('0x4b')](_0x3e3256[_0x2d4a('0x40')],_0x145f21['filters']),_0x5883f5);if(_0x3e3256[_0x2d4a('0x40')][_0x2d4a('0x4c')]){_0x103558[_0x2d4a('0x4a')]=_['merge'](_0x103558[_0x2d4a('0x4a')],{'$or':_['map'](_0x5883f5,function(_0x41015d){if(_0x41015d[_0x2d4a('0x3d')]!==_0x2d4a('0x4d')){var _0x1bd674={};_0x1bd674[_0x41015d[_0x2d4a('0x38')]]={'$like':'%'+_0x3e3256['query']['filter']+'%'};return _0x1bd674;}})});}_0x103558=_[_0x2d4a('0x4e')]({},_0x103558,_0x3e3256[_0x2d4a('0x4f')]);var _0x56fd62={'where':_0x103558[_0x2d4a('0x4a')]};return db['WhatsappMessage'][_0x2d4a('0x2d')](_0x56fd62)[_0x2d4a('0x1f')](function(_0x43aea1){_0x5b49f9['count']=_0x43aea1;if(_0x3e3256[_0x2d4a('0x40')]['includeAll']){_0x103558[_0x2d4a('0x50')]=[{'all':!![]}];}return db[_0x2d4a('0x51')][_0x2d4a('0x52')](_0x103558);})[_0x2d4a('0x1f')](function(_0x1325ea){_0x5b49f9[_0x2d4a('0x53')]=_0x1325ea;return _0x5b49f9;})[_0x2d4a('0x1f')](respondWithFilteredResult(_0x13f120,_0x103558))[_0x2d4a('0x29')](handleError(_0x13f120,null));};exports[_0x2d4a('0x54')]=function(_0x2a94ff,_0x299065){var _0x5e2f07={'raw':!![],'where':{'id':_0x2a94ff[_0x2d4a('0x55')]['id']}},_0x225a9c={};_0x225a9c[_0x2d4a('0x3f')]=_[_0x2d4a('0x41')](db[_0x2d4a('0x51')]['rawAttributes']);_0x225a9c[_0x2d4a('0x40')]=_[_0x2d4a('0x41')](_0x2a94ff[_0x2d4a('0x40')]);_0x225a9c[_0x2d4a('0x42')]=_[_0x2d4a('0x43')](_0x225a9c['model'],_0x225a9c['query']);_0x5e2f07[_0x2d4a('0x44')]=_[_0x2d4a('0x43')](_0x225a9c['model'],qs[_0x2d4a('0x45')](_0x2a94ff[_0x2d4a('0x40')][_0x2d4a('0x45')]));_0x5e2f07[_0x2d4a('0x44')]=_0x5e2f07['attributes'][_0x2d4a('0x56')]?_0x5e2f07['attributes']:_0x225a9c[_0x2d4a('0x3f')];if(_0x2a94ff[_0x2d4a('0x40')][_0x2d4a('0x57')]){_0x5e2f07[_0x2d4a('0x50')]=[{'all':!![]}];}_0x5e2f07=_[_0x2d4a('0x4e')]({},_0x5e2f07,_0x2a94ff[_0x2d4a('0x4f')]);return db[_0x2d4a('0x51')][_0x2d4a('0x58')](_0x5e2f07)['then'](handleEntityNotFound(_0x299065,null))[_0x2d4a('0x1f')](respondWithResult(_0x299065,null))[_0x2d4a('0x29')](handleError(_0x299065,null));};exports[_0x2d4a('0x59')]=function(_0x67ddff,_0x3e3925){return db[_0x2d4a('0x51')][_0x2d4a('0x59')](_0x67ddff[_0x2d4a('0x5a')],{})[_0x2d4a('0x1f')](respondWithResult(_0x3e3925,0xc9))[_0x2d4a('0x29')](handleError(_0x3e3925,null));};exports[_0x2d4a('0x35')]=function(_0x113bc4,_0x1b4ae7){if(_0x113bc4[_0x2d4a('0x5a')]['id']){delete _0x113bc4[_0x2d4a('0x5a')]['id'];}return db[_0x2d4a('0x51')][_0x2d4a('0x58')]({'where':{'id':_0x113bc4['params']['id']}})[_0x2d4a('0x1f')](handleEntityNotFound(_0x1b4ae7,null))[_0x2d4a('0x1f')](saveUpdates(_0x113bc4['body'],null))[_0x2d4a('0x1f')](respondWithResult(_0x1b4ae7,null))[_0x2d4a('0x29')](handleError(_0x1b4ae7,null));};exports[_0x2d4a('0x36')]=function(_0x228741,_0x165c00){return db[_0x2d4a('0x51')][_0x2d4a('0x58')]({'where':{'id':_0x228741[_0x2d4a('0x55')]['id']}})[_0x2d4a('0x1f')](handleEntityNotFound(_0x165c00,null))[_0x2d4a('0x1f')](removeEntity(_0x165c00,null))[_0x2d4a('0x29')](handleError(_0x165c00,null));};exports[_0x2d4a('0x5b')]=function(_0x5c7cf9,_0x1e6661){return db[_0x2d4a('0x51')]['describe']()[_0x2d4a('0x1f')](respondWithResult(_0x1e6661,null))[_0x2d4a('0x29')](handleError(_0x1e6661,null));};var interaction_log=require(_0x2d4a('0x5c'))(_0x2d4a('0x5d'));exports[_0x2d4a('0x5e')]=function(_0x1e86c3,_0x35fb34,_0x43e6a6){var _0x1034d2={'agent':{},'channel':_0x2d4a('0x5f')};if(_0x1e86c3['body']['id']){delete _0x1e86c3[_0x2d4a('0x5a')]['id'];}_0x1e86c3[_0x2d4a('0x5a')][_0x2d4a('0x60')]=!![];_0x1e86c3['body'][_0x2d4a('0x61')]=moment()[_0x2d4a('0x62')](_0x2d4a('0x63'));_0x1e86c3[_0x2d4a('0x5a')][_0x2d4a('0x64')]=_0x1e86c3[_0x2d4a('0x5a')][_0x2d4a('0x64')]||_0x1e86c3[_0x2d4a('0x65')]['id'];_0x1034d2[_0x2d4a('0x66')]['id']=_0x1e86c3['body'][_0x2d4a('0x64')];return db[_0x2d4a('0x51')][_0x2d4a('0x58')]({'where':{'id':_0x1e86c3[_0x2d4a('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x2d4a('0x67')],'as':_0x2d4a('0x68')}]})['then'](handleEntityNotFound(_0x35fb34,null))[_0x2d4a('0x1f')](saveUpdates(_0x1e86c3[_0x2d4a('0x5a')],null))[_0x2d4a('0x1f')](function(_0x4809af){if(_0x4809af){_0x1034d2[_0x2d4a('0x26')]=_0x4809af[_0x2d4a('0x69')]({'plain':!![]});return db['WhatsappInteraction'][_0x2d4a('0x58')]({'where':{'id':_0x4809af[_0x2d4a('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x35fb34,null))[_0x2d4a('0x1f')](function(_0x5ad7f6){if(_0x5ad7f6){return _0x5ad7f6['update']({'UserId':_0x1e86c3[_0x2d4a('0x5a')][_0x2d4a('0x64')],'read1stAt':_[_0x2d4a('0x6b')](_0x5ad7f6[_0x2d4a('0x6c')])?moment()['format'](_0x2d4a('0x63')):undefined});}return null;})[_0x2d4a('0x1f')](function(_0x25ee37){if(_0x25ee37){_0x1034d2[_0x2d4a('0x6d')]=_0x25ee37['get']({'plain':!![]});interaction_log['info'](_0x2d4a('0x6e'),_0x1e86c3[_0x2d4a('0x65')]['id'],_0x1e86c3[_0x2d4a('0x65')][_0x2d4a('0x38')],_0x1e86c3[_0x2d4a('0x65')][_0x2d4a('0x6f')],_0x1034d2[_0x2d4a('0x6d')]['id'],_0x1e86c3['body']?JSON[_0x2d4a('0x23')](_0x1e86c3[_0x2d4a('0x5a')]):_0x2d4a('0x70'));return respondWithRpcPromise(_0x2d4a('0x71'),'acceptMessage',_0x1034d2);}return null;})[_0x2d4a('0x1f')](function(_0x7e2b34){if(_0x7e2b34){if(_0x1e86c3[_0x2d4a('0x5a')][_0x2d4a('0x72')]){_0x1034d2['message'][_0x2d4a('0x73')]=util[_0x2d4a('0x62')]('SIP/%s',_0x1e86c3[_0x2d4a('0x65')][_0x2d4a('0x38')]);_0x1034d2[_0x2d4a('0x26')]['channel']=_0x1034d2[_0x2d4a('0x74')];_0x1034d2[_0x2d4a('0x26')][_0x2d4a('0x75')]=_0x2d4a('0x5e');return respondWithRpcPromise(_0x2d4a('0x76'),_0x2d4a('0x76'),{'event':_0x2d4a('0x77'),'message':_0x1034d2['message']},client9002)[_0x2d4a('0x1f')](function(){return _0x1034d2;});}return _0x1034d2;}return null;})[_0x2d4a('0x1f')](respondWithResult(_0x35fb34,null))[_0x2d4a('0x29')](handleError(_0x35fb34,null));};var interaction_log=require(_0x2d4a('0x5c'))(_0x2d4a('0x5d'));exports['reject']=function(_0x38e623,_0x5aead3,_0x3a2aab){var _0x3b6117={'agent':{},'channel':_0x2d4a('0x5f')};if(_0x38e623[_0x2d4a('0x5a')]['id']){delete _0x38e623[_0x2d4a('0x5a')]['id'];}_0x38e623[_0x2d4a('0x5a')][_0x2d4a('0x64')]=_0x38e623[_0x2d4a('0x5a')][_0x2d4a('0x64')]||_0x38e623[_0x2d4a('0x65')]['id'];_0x3b6117['agent']['id']=_0x38e623[_0x2d4a('0x5a')]['UserId'];return db[_0x2d4a('0x51')][_0x2d4a('0x58')]({'where':{'id':_0x38e623[_0x2d4a('0x55')]['id'],'UserId':null}})[_0x2d4a('0x1f')](handleEntityNotFound(_0x5aead3,null))[_0x2d4a('0x1f')](function(_0x43a2b3){if(_0x43a2b3){_0x3b6117[_0x2d4a('0x26')]=_0x43a2b3[_0x2d4a('0x69')]({'plain':!![]});return db[_0x2d4a('0x78')]['find']({'where':{'id':_0x43a2b3[_0x2d4a('0x6a')]}});}return null;})[_0x2d4a('0x1f')](handleEntityNotFound(_0x5aead3,null))[_0x2d4a('0x1f')](function(_0xcdf787){if(_0xcdf787){_0x3b6117['interaction']=_0xcdf787[_0x2d4a('0x69')]({'plain':!![]});interaction_log[_0x2d4a('0x27')](_0x2d4a('0x79'),_0x38e623[_0x2d4a('0x65')]['id'],_0x38e623[_0x2d4a('0x65')][_0x2d4a('0x38')],_0x38e623['user'][_0x2d4a('0x6f')],_0x3b6117[_0x2d4a('0x6d')]['id'],_0x38e623['body']?JSON[_0x2d4a('0x23')](_0x38e623[_0x2d4a('0x5a')]):_0x2d4a('0x70'));return respondWithRpcPromise(_0x2d4a('0x7a'),_0x2d4a('0x7b'),_0x3b6117);}return null;})[_0x2d4a('0x1f')](function(_0x110a9f){if(_0x110a9f){_0x110a9f[_0x2d4a('0x26')][_0x2d4a('0x73')]=util[_0x2d4a('0x62')]('SIP/%s',_0x38e623[_0x2d4a('0x65')]['name']);_0x110a9f[_0x2d4a('0x26')][_0x2d4a('0x74')]=_0x3b6117[_0x2d4a('0x74')];_0x110a9f[_0x2d4a('0x26')][_0x2d4a('0x75')]=_0x2d4a('0x33');respondWithRpcPromise(_0x2d4a('0x76'),'EventManager',{'event':_0x2d4a('0x7c'),'message':_0x110a9f[_0x2d4a('0x26')]},client9002);return _0x3b6117;}return null;})[_0x2d4a('0x1f')](respondWithResult(_0x5aead3,null))[_0x2d4a('0x29')](handleError(_0x5aead3,null));};exports[_0x2d4a('0x2b')]=function(_0x5e7f23,_0x4ebda1,_0x49b2f3){if(_0x5e7f23[_0x2d4a('0x5a')]['id']){delete _0x5e7f23[_0x2d4a('0x5a')]['id'];}var _0x42b42e;return db['WhatsappMessage'][_0x2d4a('0x58')]({'where':{'id':_0x5e7f23[_0x2d4a('0x55')]['id']}})[_0x2d4a('0x1f')](handleEntityNotFound(_0x4ebda1,null))[_0x2d4a('0x1f')](function(_0x3373ff){if(_0x3373ff){_0x42b42e=_0x3373ff;return db[_0x2d4a('0x7d')]['find']({'where':{'id':_0x3373ff[_0x2d4a('0x7e')]}});}})['then'](handleEntityNotFound(_0x4ebda1,null))[_0x2d4a('0x1f')](function(_0xf76da6){if(_0xf76da6){logger['debug'](_0x2d4a('0x7f'),'status','received\x20delivery\x20report\x20from',_0xf76da6['type'],util[_0x2d4a('0x80')](_0x5e7f23[_0x2d4a('0x5a')],{'showHidden':![],'depth':null}));switch(_0xf76da6[_0x2d4a('0x3d')]){case'twilio':if(_0x5e7f23[_0x2d4a('0x5a')][_0x2d4a('0x81')]&&_0x5e7f23[_0x2d4a('0x5a')][_0x2d4a('0x81')]===_0x42b42e['messageId']&&_0x5e7f23[_0x2d4a('0x5a')][_0x2d4a('0x82')]&&_0x5e7f23['body'][_0x2d4a('0x82')]===_0x2d4a('0x60')){return _0x42b42e['update']({'read':!![]});}else{logger[_0x2d4a('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x2d4a('0x83'),util['inspect'](_0x5e7f23[_0x2d4a('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x42b42e;}})[_0x2d4a('0x1f')](respondWithResult(_0x4ebda1,null))[_0x2d4a('0x29')](handleError(_0x4ebda1,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index e294c6b..c703f57 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x3b6943,_0x3cc96b){var _0xb9b979=function(_0x469fd1){while(--_0x469fd1){_0x3b6943['push'](_0x3b6943['shift']());}};_0xb9b979(++_0x3cc96b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x38a413,_0x2122cd){_0x38a413=_0x38a413-0x0;var _0x1b3517=_0x5f2f[_0x38a413];return _0x1b3517;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x1738d0,_0x4c1488){var _0x366507=function(_0x2b6820){while(--_0x2b6820){_0x1738d0['push'](_0x1738d0['shift']());}};_0x366507(++_0x4c1488);}(_0x5f2f,0x73));var _0xf5f2=function(_0x301b7a,_0x55fdd0){_0x301b7a=_0x301b7a-0x0;var _0x1e2fab=_0x5f2f[_0x301b7a];return _0x1e2fab;};'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 9e8b73e..ce34744 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 _0x43ac=['out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error'];(function(_0x303633,_0x4672f4){var _0x1e6a92=function(_0x305d02){while(--_0x305d02){_0x303633['push'](_0x303633['shift']());}};_0x1e6a92(++_0x4672f4);}(_0x43ac,0x1c6));var _0xc43a=function(_0x410836,_0x54527d){_0x410836=_0x410836-0x0;var _0x2c7506=_0x43ac[_0x410836];return _0x2c7506;};'use strict';var _=require(_0xc43a('0x0'));var util=require('util');var logger=require(_0xc43a('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc43a('0x2'));var rp=require(_0xc43a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc43a('0x4'));var config=require(_0xc43a('0x5'));var attributes=require(_0xc43a('0x6'));module[_0xc43a('0x7')]=function(_0x28e40b,_0x26128d){return _0x28e40b[_0xc43a('0x8')]('WhatsappMessage',attributes,{'tableName':_0xc43a('0x9'),'paranoid':![],'indexes':[{'name':_0xc43a('0xa'),'fields':[_0xc43a('0xa')]},{'name':_0xc43a('0xb'),'fields':[_0xc43a('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x346527,_0x30788a,_0x2784fa){var _0x382f0c=_0x28e40b[_0xc43a('0xd')];var _0x27242b=_0x346527[_0xc43a('0xe')]({'plain':!![]});if(_0x27242b[_0xc43a('0xf')]['toLowerCase']()==='in'||_0x27242b[_0xc43a('0xf')][_0xc43a('0x10')]()==='out'&&!_0x27242b[_0xc43a('0x11')]&&!_[_0xc43a('0x12')](_0x27242b['UserId'])){_0x382f0c[_0xc43a('0x13')][_0xc43a('0x14')]({'where':{'id':_0x27242b[_0xc43a('0x15')]}})[_0xc43a('0x16')](function(_0x748a4b){if(_0x748a4b){_0x748a4b[_0xc43a('0x17')]({'lastMsgAt':_0x27242b[_0xc43a('0x18')],'lastMsgDirection':_0x27242b[_0xc43a('0xf')][_0xc43a('0x10')]()});}})['catch'](function(_0x326f50){console[_0xc43a('0x19')](_0x326f50);});}if(_0x27242b[_0xc43a('0xf')]===_0xc43a('0x1a')&&!_0x27242b[_0xc43a('0x11')]){var _0x2e36d3;_0x382f0c[_0xc43a('0x1b')][_0xc43a('0x1c')]({'where':{'id':_0x27242b[_0xc43a('0x1d')]},'raw':!![]})[_0xc43a('0x16')](function(_0x2b2f7c){_0x2e36d3=_0x2b2f7c;if(_0x2e36d3&&_0x2e36d3[_0xc43a('0x1e')]){switch(_0x2e36d3[_0xc43a('0x1e')]){case _0xc43a('0x1f'):var _0x749566=require('twilio');if(_0x2e36d3[_0xc43a('0x20')]&&_0x2e36d3['authToken']&&_0x2e36d3[_0xc43a('0x21')]){var _0x2eaeff=new _0x749566(_0x2e36d3[_0xc43a('0x20')],_0x2e36d3[_0xc43a('0x22')]);_0x2eaeff[_0xc43a('0x23')][_0xc43a('0x24')]({'body':_0x27242b[_0xc43a('0xc')],'to':_0xc43a('0x25')+_0x27242b[_0xc43a('0x21')],'from':_0xc43a('0x25')+_0x2e36d3['phone'],'statusCallback':_0x2e36d3[_0xc43a('0x26')]+_0xc43a('0x27')+_0x27242b['id']+_0xc43a('0x28')+_0x2e36d3['token']})['then'](function(_0x386c6d){if(_0x386c6d[_0xc43a('0x29')]){return _0x346527[_0xc43a('0x17')]({'messageId':_0x386c6d[_0xc43a('0x29')]});}})[_0xc43a('0x2a')](function(_0x1ad5ce){logger[_0xc43a('0x19')](_0xc43a('0x2b'),'afterCreate',_0xc43a('0x1f'),util['inspect'](_0x1ad5ce,{'showHidden':![],'depth':null}));});}else{logger[_0xc43a('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc43a('0x2c'),_0xc43a('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0xc43a('0x2d')](function(){_0x2784fa();});}else{_0x2784fa();}}},'charset':_0xc43a('0x2e'),'collate':_0xc43a('0x2f')});}; \ No newline at end of file +var _0x5cf8=['FULLTEXT','models','toLowerCase','direction','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages'];(function(_0x30108c,_0x1895a3){var _0x1af0e1=function(_0x14aaca){while(--_0x14aaca){_0x30108c['push'](_0x30108c['shift']());}};_0x1af0e1(++_0x1895a3);}(_0x5cf8,0xbb));var _0x85cf=function(_0xe56fcb,_0x42f237){_0xe56fcb=_0xe56fcb-0x0;var _0x6037c7=_0x5cf8[_0xe56fcb];return _0x6037c7;};'use strict';var _=require(_0x85cf('0x0'));var util=require('util');var logger=require(_0x85cf('0x1'))(_0x85cf('0x2'));var moment=require(_0x85cf('0x3'));var BPromise=require(_0x85cf('0x4'));var rp=require(_0x85cf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85cf('0x6'));var config=require(_0x85cf('0x7'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x4016f4,_0x1f7729){return _0x4016f4[_0x85cf('0x8')](_0x85cf('0x9'),attributes,{'tableName':_0x85cf('0xa'),'paranoid':![],'indexes':[{'name':_0x85cf('0xb'),'fields':[_0x85cf('0xb')]},{'name':_0x85cf('0xc'),'fields':['body'],'type':_0x85cf('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40e4ce,_0x5cd65c,_0x1116a6){var _0x1a17a4=_0x4016f4[_0x85cf('0xe')];var _0x5448a0=_0x40e4ce['get']({'plain':!![]});if(_0x5448a0['direction'][_0x85cf('0xf')]()==='in'||_0x5448a0[_0x85cf('0x10')][_0x85cf('0xf')]()==='out'&&!_0x5448a0[_0x85cf('0x11')]&&!_['isNil'](_0x5448a0[_0x85cf('0x12')])){_0x1a17a4[_0x85cf('0x13')][_0x85cf('0x14')]({'where':{'id':_0x5448a0[_0x85cf('0x15')]}})[_0x85cf('0x16')](function(_0x347108){if(_0x347108){_0x347108[_0x85cf('0x17')]({'lastMsgAt':_0x5448a0[_0x85cf('0x18')],'lastMsgDirection':_0x5448a0[_0x85cf('0x10')][_0x85cf('0xf')]()});}})[_0x85cf('0x19')](function(_0x4b7788){console[_0x85cf('0x1a')](_0x4b7788);});}if(_0x5448a0[_0x85cf('0x10')]===_0x85cf('0x1b')&&!_0x5448a0[_0x85cf('0x11')]){var _0x6b5e18;_0x1a17a4[_0x85cf('0x1c')][_0x85cf('0x1d')]({'where':{'id':_0x5448a0[_0x85cf('0x1e')]},'raw':!![]})['then'](function(_0xb55c20){_0x6b5e18=_0xb55c20;if(_0x6b5e18&&_0x6b5e18[_0x85cf('0x1f')]){switch(_0x6b5e18[_0x85cf('0x1f')]){case _0x85cf('0x20'):var _0x5a23e1=require(_0x85cf('0x20'));if(_0x6b5e18[_0x85cf('0x21')]&&_0x6b5e18[_0x85cf('0x22')]&&_0x6b5e18[_0x85cf('0x23')]){var _0x838e8a=new _0x5a23e1(_0x6b5e18[_0x85cf('0x21')],_0x6b5e18[_0x85cf('0x22')]);_0x838e8a[_0x85cf('0x24')][_0x85cf('0x25')]({'body':_0x5448a0[_0x85cf('0x26')],'to':_0x85cf('0x27')+_0x5448a0['phone'],'from':_0x85cf('0x27')+_0x6b5e18[_0x85cf('0x23')],'statusCallback':_0x6b5e18[_0x85cf('0x28')]+_0x85cf('0x29')+_0x5448a0['id']+_0x85cf('0x2a')+_0x6b5e18[_0x85cf('0x2b')]})[_0x85cf('0x16')](function(_0xdc6996){if(_0xdc6996['sid']){return _0x40e4ce[_0x85cf('0x17')]({'messageId':_0xdc6996[_0x85cf('0x2c')]});}})[_0x85cf('0x19')](function(_0x104822){logger[_0x85cf('0x1a')](_0x85cf('0x2d'),_0x85cf('0x2e'),_0x85cf('0x20'),util['inspect'](_0x104822,{'showHidden':![],'depth':null}));});}else{logger[_0x85cf('0x1a')](_0x85cf('0x2d'),_0x85cf('0x2e'),_0x85cf('0x20'),_0x85cf('0x2f'));}break;}}})['finally'](function(){_0x1116a6();});}else{_0x1116a6();}}},'charset':_0x85cf('0x30'),'collate':_0x85cf('0x31')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 62e5433..38bea20 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 _0x64a3=['code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','options','raw','lodash','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4d521e,_0x58ba39){var _0x3beb42=function(_0x1a7bd2){while(--_0x1a7bd2){_0x4d521e['push'](_0x4d521e['shift']());}};_0x3beb42(++_0x58ba39);}(_0x64a3,0x1a8));var _0x364a=function(_0x4e42bc,_0x481b66){_0x4e42bc=_0x4e42bc-0x0;var _0x184ca8=_0x64a3[_0x4e42bc];return _0x184ca8;};'use strict';var _=require(_0x364a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x364a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x364a('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x364a('0x3'));var jayson=require(_0x364a('0x4'));var client=jayson[_0x364a('0x5')]['http']({'port':0x232a});config[_0x364a('0x6')]=_[_0x364a('0x7')](config[_0x364a('0x6')],{'host':_0x364a('0x8'),'port':0x18eb});var socket=require(_0x364a('0x9'))(new Redis(config[_0x364a('0x6')]));require(_0x364a('0xa'))[_0x364a('0xb')](socket);function respondWithRpcPromise(_0x4f11fa,_0xd93e5f,_0x5df5a0){return new BPromise(function(_0x3bb4f5,_0xa977c8){return client['request'](_0x4f11fa,_0x5df5a0)[_0x364a('0xc')](function(_0x13cc0e){logger[_0x364a('0xd')](_0x364a('0xe'),_0xd93e5f,_0x364a('0xf'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xd93e5f,_0x364a('0xf'),JSON[_0x364a('0x10')](_0x13cc0e));if(_0x13cc0e[_0x364a('0x11')]){if(_0x13cc0e[_0x364a('0x11')][_0x364a('0x12')]===0x1f4){logger[_0x364a('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0xd93e5f,_0x13cc0e['error']['message']);return _0xa977c8(_0x13cc0e[_0x364a('0x11')][_0x364a('0x13')]);}logger[_0x364a('0x11')](_0x364a('0xe'),_0xd93e5f,_0x13cc0e[_0x364a('0x11')][_0x364a('0x13')]);return _0x3bb4f5(_0x13cc0e[_0x364a('0x11')][_0x364a('0x13')]);}else{logger[_0x364a('0xd')](_0x364a('0xe'),_0xd93e5f,_0x364a('0xf'));_0x3bb4f5(_0x13cc0e[_0x364a('0x14')][_0x364a('0x13')]);}})[_0x364a('0x15')](function(_0x505591){logger[_0x364a('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0xd93e5f,_0x505591);_0xa977c8(_0x505591);});});}exports[_0x364a('0x16')]=function(_0xbc6852){var _0x3ec799=this;return new Promise(function(_0x1b43a7,_0xbce3bd){return db[_0x364a('0x17')]['create'](_0xbc6852['body'],{'raw':_0xbc6852[_0x364a('0x18')]?_0xbc6852[_0x364a('0x18')][_0x364a('0x19')]===undefined?!![]:![]:!![]})[_0x364a('0xc')](function(_0x41ae4b){logger['info'](_0x364a('0x16'),_0xbc6852);logger['debug'](_0x364a('0x16'),_0xbc6852,JSON[_0x364a('0x10')](_0x41ae4b));_0x1b43a7(_0x41ae4b);})[_0x364a('0x15')](function(_0x1a8a1b){logger[_0x364a('0x11')](_0x364a('0x16'),_0x1a8a1b['message'],_0xbc6852);_0xbce3bd(_0x3ec799['error'](0x1f4,_0x1a8a1b['message']));});});}; \ No newline at end of file +var _0x0e56=['catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','then','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x87e0bf,_0x492e55){var _0x3189a6=function(_0x42407f){while(--_0x42407f){_0x87e0bf['push'](_0x87e0bf['shift']());}};_0x3189a6(++_0x492e55);}(_0x0e56,0x1e7));var _0x60e5=function(_0x4cee82,_0x208e67){_0x4cee82=_0x4cee82-0x0;var _0x200c1d=_0x0e56[_0x4cee82];return _0x200c1d;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var moment=require(_0x60e5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60e5('0x3'));var db=require(_0x60e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x60e5('0x5'))(_0x60e5('0x6'));var config=require(_0x60e5('0x7'));var jayson=require(_0x60e5('0x8'));var client=jayson[_0x60e5('0x9')]['http']({'port':0x232a});config[_0x60e5('0xa')]=_['defaults'](config['redis'],{'host':_0x60e5('0xb'),'port':0x18eb});var socket=require(_0x60e5('0xc'))(new Redis(config['redis']));require(_0x60e5('0xd'))[_0x60e5('0xe')](socket);function respondWithRpcPromise(_0x449db3,_0x372dc3,_0x3dafb4){return new BPromise(function(_0x39a1b7,_0x4469a9){return client['request'](_0x449db3,_0x3dafb4)['then'](function(_0x2c4747){logger[_0x60e5('0xf')](_0x60e5('0x10'),_0x372dc3,_0x60e5('0x11'));logger[_0x60e5('0x12')](_0x60e5('0x13'),_0x372dc3,_0x60e5('0x11'),JSON[_0x60e5('0x14')](_0x2c4747));if(_0x2c4747[_0x60e5('0x15')]){if(_0x2c4747['error'][_0x60e5('0x16')]===0x1f4){logger[_0x60e5('0x15')](_0x60e5('0x10'),_0x372dc3,_0x2c4747['error'][_0x60e5('0x17')]);return _0x4469a9(_0x2c4747[_0x60e5('0x15')][_0x60e5('0x17')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x372dc3,_0x2c4747[_0x60e5('0x15')]['message']);return _0x39a1b7(_0x2c4747[_0x60e5('0x15')]['message']);}else{logger[_0x60e5('0xf')](_0x60e5('0x10'),_0x372dc3,_0x60e5('0x11'));_0x39a1b7(_0x2c4747[_0x60e5('0x18')][_0x60e5('0x17')]);}})[_0x60e5('0x19')](function(_0x55e6c3){logger[_0x60e5('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x372dc3,_0x55e6c3);_0x4469a9(_0x55e6c3);});});}exports[_0x60e5('0x1a')]=function(_0x41b25a){var _0x19b913=this;return new Promise(function(_0x52ebf2,_0x48059f){return db[_0x60e5('0x1b')][_0x60e5('0x1c')](_0x41b25a[_0x60e5('0x1d')],{'raw':_0x41b25a[_0x60e5('0x1e')]?_0x41b25a['options']['raw']===undefined?!![]:![]:!![]})[_0x60e5('0x1f')](function(_0x3f6349){logger[_0x60e5('0xf')]('CreateWhatsappMessage',_0x41b25a);logger[_0x60e5('0x12')](_0x60e5('0x1a'),_0x41b25a,JSON[_0x60e5('0x14')](_0x3f6349));_0x52ebf2(_0x3f6349);})[_0x60e5('0x19')](function(_0x414bb0){logger[_0x60e5('0x15')](_0x60e5('0x1a'),_0x414bb0[_0x60e5('0x17')],_0x41b25a);_0x48059f(_0x19b913[_0x60e5('0x15')](0x1f4,_0x414bb0[_0x60e5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 7be72ca..3bb65ed 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 _0x2c46=['remove','update','emit','removeListener','register','length','save'];(function(_0x318ba4,_0x2cfbd6){var _0x2c3512=function(_0x3b4832){while(--_0x3b4832){_0x318ba4['push'](_0x318ba4['shift']());}};_0x2c3512(++_0x2cfbd6);}(_0x2c46,0x6f));var _0x62c4=function(_0x111164,_0x48487f){_0x111164=_0x111164-0x0;var _0x532f6e=_0x2c46[_0x111164];return _0x532f6e;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x62c4('0x0'),_0x62c4('0x1'),_0x62c4('0x2')];function createListener(_0x35cc9a,_0x40e803){return function(_0x2ae983){_0x40e803[_0x62c4('0x3')](_0x35cc9a,_0x2ae983);};}function removeListener(_0x65976c,_0x357b91){return function(){WhatsappMessageEvents[_0x62c4('0x4')](_0x65976c,_0x357b91);};}exports[_0x62c4('0x5')]=function(_0x400057){for(var _0x2a719e=0x0,_0x2bfa72=events[_0x62c4('0x6')];_0x2a719e<_0x2bfa72;_0x2a719e++){var _0x46eacc=events[_0x2a719e];var _0xa171ec=createListener('whatsappMessage:'+_0x46eacc,_0x400057);WhatsappMessageEvents['on'](_0x46eacc,_0xa171ec);}}; \ No newline at end of file +var _0x87fc=['update','emit','removeListener','length','whatsappMessage:'];(function(_0x30c489,_0x27541f){var _0x26e41f=function(_0x4c9193){while(--_0x4c9193){_0x30c489['push'](_0x30c489['shift']());}};_0x26e41f(++_0x27541f);}(_0x87fc,0xaa));var _0xc87f=function(_0x436982,_0x3879db){_0x436982=_0x436982-0x0;var _0x266746=_0x87fc[_0x436982];return _0x266746;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save','remove',_0xc87f('0x0')];function createListener(_0xa69499,_0x3ade05){return function(_0x55dcd4){_0x3ade05[_0xc87f('0x1')](_0xa69499,_0x55dcd4);};}function removeListener(_0x186d07,_0x9c074d){return function(){WhatsappMessageEvents[_0xc87f('0x2')](_0x186d07,_0x9c074d);};}exports['register']=function(_0x4074d2){for(var _0x1c6f26=0x0,_0x5013ad=events[_0xc87f('0x3')];_0x1c6f26<_0x5013ad;_0x1c6f26++){var _0x90fdfc=events[_0x1c6f26];var _0x17f020=createListener(_0xc87f('0x4')+_0x90fdfc,_0x4074d2);WhatsappMessageEvents['on'](_0x90fdfc,_0x17f020);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 83fcf2e..e1015de 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 _0x71c9=['/:id','show','/:id/members','getMembers','/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','describe'];(function(_0x315815,_0x48f606){var _0x2bbc51=function(_0x356b38){while(--_0x356b38){_0x315815['push'](_0x315815['shift']());}};_0x2bbc51(++_0x48f606);}(_0x71c9,0xbd));var _0x971c=function(_0xeae2aa,_0x6eb61a){_0xeae2aa=_0xeae2aa-0x0;var _0x301fa6=_0x71c9[_0xeae2aa];return _0x301fa6;};'use strict';var multer=require(_0x971c('0x0'));var util=require(_0x971c('0x1'));var path=require(_0x971c('0x2'));var timeout=require(_0x971c('0x3'));var express=require('express');var router=express[_0x971c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x971c('0x5'));var config=require('../../config/environment');var controller=require(_0x971c('0x6'));router[_0x971c('0x7')]('/',auth[_0x971c('0x8')](),controller[_0x971c('0x9')]);router[_0x971c('0x7')]('/describe',auth[_0x971c('0x8')](),controller[_0x971c('0xa')]);router[_0x971c('0x7')](_0x971c('0xb'),auth[_0x971c('0x8')](),controller[_0x971c('0xc')]);router[_0x971c('0x7')](_0x971c('0xd'),auth['isAuthenticated'](),controller[_0x971c('0xe')]);router['get']('/:id/teams',auth[_0x971c('0x8')](),controller['getTeams']);router['get'](_0x971c('0xf'),auth[_0x971c('0x8')](),controller[_0x971c('0x10')]);router['post']('/',auth[_0x971c('0x8')](),controller[_0x971c('0x11')]);router[_0x971c('0x12')](_0x971c('0x13'),auth[_0x971c('0x8')](),controller[_0x971c('0x14')]);router[_0x971c('0x12')](_0x971c('0xf'),auth[_0x971c('0x8')](),controller[_0x971c('0x15')]);router[_0x971c('0x16')](_0x971c('0xb'),auth[_0x971c('0x8')](),controller['update']);router[_0x971c('0x17')](_0x971c('0xb'),auth['isAuthenticated'](),controller[_0x971c('0x18')]);router[_0x971c('0x17')](_0x971c('0x13'),auth[_0x971c('0x8')](),controller['removeTeams']);router['delete'](_0x971c('0xf'),auth[_0x971c('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x1b5a=['update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service','./whatsappQueue.controller','get','index','isAuthenticated','describe','/:id','show','getTeams','post','create','/:id/teams','addTeams','/:id/users','addAgents','put'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0x1b5a,0x17c));var _0xa1b5=function(_0x320608,_0x1b8c25){_0x320608=_0x320608-0x0;var _0x101b9e=_0x1b5a[_0x320608];return _0x101b9e;};'use strict';var multer=require(_0xa1b5('0x0'));var util=require(_0xa1b5('0x1'));var path=require('path');var timeout=require(_0xa1b5('0x2'));var express=require('express');var router=express[_0xa1b5('0x3')]();var auth=require(_0xa1b5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa1b5('0x5'));router[_0xa1b5('0x6')]('/',auth['isAuthenticated'](),controller[_0xa1b5('0x7')]);router[_0xa1b5('0x6')]('/describe',auth[_0xa1b5('0x8')](),controller[_0xa1b5('0x9')]);router[_0xa1b5('0x6')](_0xa1b5('0xa'),auth['isAuthenticated'](),controller[_0xa1b5('0xb')]);router[_0xa1b5('0x6')]('/:id/members',auth[_0xa1b5('0x8')](),controller['getMembers']);router[_0xa1b5('0x6')]('/:id/teams',auth[_0xa1b5('0x8')](),controller[_0xa1b5('0xc')]);router[_0xa1b5('0x6')]('/:id/users',auth[_0xa1b5('0x8')](),controller['getAgents']);router[_0xa1b5('0xd')]('/',auth[_0xa1b5('0x8')](),controller[_0xa1b5('0xe')]);router[_0xa1b5('0xd')](_0xa1b5('0xf'),auth[_0xa1b5('0x8')](),controller[_0xa1b5('0x10')]);router[_0xa1b5('0xd')](_0xa1b5('0x11'),auth[_0xa1b5('0x8')](),controller[_0xa1b5('0x12')]);router[_0xa1b5('0x13')](_0xa1b5('0xa'),auth[_0xa1b5('0x8')](),controller[_0xa1b5('0x14')]);router[_0xa1b5('0x15')](_0xa1b5('0xa'),auth[_0xa1b5('0x8')](),controller[_0xa1b5('0x16')]);router[_0xa1b5('0x15')](_0xa1b5('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0xa1b5('0x8')](),controller[_0xa1b5('0x17')]);module[_0xa1b5('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index c04ac74..5f85080 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 _0xc12f=['sequelize','exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x859156,_0x2168d6){var _0xfc06f9=function(_0xc7afa4){while(--_0xc7afa4){_0x859156['push'](_0x859156['shift']());}};_0xfc06f9(++_0x2168d6);}(_0xc12f,0xe8));var _0xfc12=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0xc12f[_0x396466];return _0x5e9ab4;};'use strict';var Sequelize=require(_0xfc12('0x0'));module[_0xfc12('0x1')]={'name':{'type':Sequelize[_0xfc12('0x2')],'unique':_0xfc12('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xfc12('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xfc12('0x5'),_0xfc12('0x6'),_0xfc12('0x7'))},'description':{'type':Sequelize[_0xfc12('0x2')]}}; \ No newline at end of file +var _0x102a=['STRING','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x5af8a8,_0x62425b){var _0x9eba8c=function(_0x4a8ab7){while(--_0x4a8ab7){_0x5af8a8['push'](_0x5af8a8['shift']());}};_0x9eba8c(++_0x62425b);}(_0x102a,0x6d));var _0xa102=function(_0x2b4749,_0x23761b){_0x2b4749=_0x2b4749-0x0;var _0x14f7b1=_0x102a[_0x2b4749];return _0x14f7b1;};'use strict';var Sequelize=require(_0xa102('0x0'));module['exports']={'name':{'type':Sequelize[_0xa102('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa102('0x2')](_0xa102('0x3'),'beepall',_0xa102('0x4'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 96e083a..dd7d394 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 _0x4930=['TeamId','includes','all','union','compact','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','WhatsappQueues','stack','name','send','index','map','WhatsappQueue','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','where','filters','merge','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','body','describe','getMembers','findOne','UserWhatsappQueue','nolimit','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','sort','pick','ids','online','voicePause','flatMap','Agents','sequelize','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','join','ut.TeamId\x20=\x20tq.TeamId','push','toString','SELECT','every'];(function(_0x2012c1,_0x50c151){var _0x3a8eb1=function(_0x116ba8){while(--_0x116ba8){_0x2012c1['push'](_0x2012c1['shift']());}};_0x3a8eb1(++_0x50c151);}(_0x4930,0x1b1));var _0x0493=function(_0x42da55,_0x229bc2){_0x42da55=_0x42da55-0x0;var _0x226ff1=_0x4930[_0x42da55];return _0x226ff1;};'use strict';var pdf=require(_0x0493('0x0'));var emlformat=require(_0x0493('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0493('0x2'));var jsonpatch=require(_0x0493('0x3'));var rp=require(_0x0493('0x4'));var moment=require(_0x0493('0x5'));var BPromise=require(_0x0493('0x6'));var Mustache=require(_0x0493('0x7'));var util=require(_0x0493('0x8'));var path=require(_0x0493('0x9'));var sox=require(_0x0493('0xa'));var csv=require(_0x0493('0xb'));var ejs=require(_0x0493('0xc'));var fs=require('fs');var _=require(_0x0493('0xd'));var squel=require('squel');var crypto=require(_0x0493('0xe'));var jsforce=require(_0x0493('0xf'));var deskjs=require(_0x0493('0x10'));var toCsv=require(_0x0493('0xb'));var querystring=require(_0x0493('0x11'));var Papa=require(_0x0493('0x12'));var Redis=require(_0x0493('0x13'));var authService=require(_0x0493('0x14'));var qs=require(_0x0493('0x15'));var as=require(_0x0493('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0493('0x17'));var utils=require(_0x0493('0x18'));var config=require(_0x0493('0x19'));var licenseUtil=require(_0x0493('0x1a'));var db=require('../../mysqldb')['db'];config[_0x0493('0x1b')]=_[_0x0493('0x1c')](config[_0x0493('0x1b')],{'host':_0x0493('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0493('0x1b')]));require(_0x0493('0x1e'))[_0x0493('0x1f')](socket);function respondWithStatusCode(_0xa8280f,_0x5026a8){_0x5026a8=_0x5026a8||0xcc;return function(_0x51b869){if(_0x51b869){return _0xa8280f[_0x0493('0x20')](_0x5026a8);}return _0xa8280f[_0x0493('0x21')](_0x5026a8)[_0x0493('0x22')]();};}function respondWithResult(_0x128546,_0x2e189f){_0x2e189f=_0x2e189f||0xc8;return function(_0x4fc418){if(_0x4fc418){return _0x128546[_0x0493('0x21')](_0x2e189f)[_0x0493('0x23')](_0x4fc418);}};}function respondWithFilteredResult(_0x1955d9,_0x1d78c6){return function(_0x565e3c){if(_0x565e3c){var _0x3acc00=_0x565e3c[_0x0493('0x24')],_0x3148f4=_0x1d78c6['offset'],_0x418ed1=_0x1d78c6[_0x0493('0x25')]+_0x1d78c6[_0x0493('0x26')],_0x320721;if(_0x418ed1>=_0x3acc00){_0x418ed1=_0x3acc00;_0x320721=0xc8;}else{_0x320721=0xce;}_0x1955d9[_0x0493('0x21')](_0x320721);return _0x1955d9[_0x0493('0x27')]('Content-Range',_0x3148f4+'-'+_0x418ed1+'/'+_0x3acc00)['json'](_0x565e3c);}return null;};}function patchUpdates(_0x4046a2){return function(_0x324e9c){try{jsonpatch[_0x0493('0x28')](_0x324e9c,_0x4046a2,!![]);}catch(_0x109a2a){return BPromise['reject'](_0x109a2a);}return _0x324e9c[_0x0493('0x29')]();};}function saveUpdates(_0x5514c5,_0x350122){return function(_0xc4e670){if(_0xc4e670){return _0xc4e670['update'](_0x5514c5)[_0x0493('0x2a')](function(_0x4fc155){return _0x4fc155;});}return null;};}function removeEntity(_0x177d8f,_0x31e022){return function(_0x5d61e4){if(_0x5d61e4){return _0x5d61e4[_0x0493('0x2b')]()['then'](function(){var _0x5407a5=_0x5d61e4['get']({'plain':!![]});var _0xd490f=_0x0493('0x2c');return db['UserProfileResource'][_0x0493('0x2b')]({'where':{'type':_0xd490f,'resourceId':_0x5407a5['id']}})[_0x0493('0x2a')](function(){return _0x5d61e4;});})[_0x0493('0x2a')](function(){_0x177d8f[_0x0493('0x21')](0xcc)[_0x0493('0x22')]();});}};}function handleEntityNotFound(_0x510a8a,_0x2cb1ef){return function(_0x52ea8a){if(!_0x52ea8a){_0x510a8a[_0x0493('0x20')](0x194);}return _0x52ea8a;};}function handleError(_0xbcb4ab,_0x2ca685){_0x2ca685=_0x2ca685||0x1f4;return function(_0x590679){logger['error'](_0x590679[_0x0493('0x2d')]);if(_0x590679[_0x0493('0x2e')]){delete _0x590679[_0x0493('0x2e')];}_0xbcb4ab[_0x0493('0x21')](_0x2ca685)[_0x0493('0x2f')](_0x590679);};}exports[_0x0493('0x30')]=function(_0x1194b5,_0x51ece7){var _0x306e12={},_0x1a2f5e={},_0x2ba3cb={'count':0x0,'rows':[]};var _0x49e8a4=_[_0x0493('0x31')](db[_0x0493('0x32')]['rawAttributes'],function(_0x18755f){return{'name':_0x18755f['fieldName'],'type':_0x18755f['type']['key']};});_0x1a2f5e[_0x0493('0x33')]=_[_0x0493('0x31')](_0x49e8a4,'name');_0x1a2f5e['query']=_[_0x0493('0x34')](_0x1194b5[_0x0493('0x35')]);_0x1a2f5e['filters']=_['intersection'](_0x1a2f5e[_0x0493('0x33')],_0x1a2f5e['query']);_0x306e12[_0x0493('0x36')]=_[_0x0493('0x37')](_0x1a2f5e[_0x0493('0x33')],qs[_0x0493('0x38')](_0x1194b5[_0x0493('0x35')][_0x0493('0x38')]));_0x306e12['attributes']=_0x306e12[_0x0493('0x36')][_0x0493('0x39')]?_0x306e12[_0x0493('0x36')]:_0x1a2f5e[_0x0493('0x33')];if(!_0x1194b5[_0x0493('0x35')][_0x0493('0x3a')]('nolimit')){_0x306e12[_0x0493('0x26')]=qs[_0x0493('0x26')](_0x1194b5[_0x0493('0x35')]['limit']);_0x306e12[_0x0493('0x25')]=qs[_0x0493('0x25')](_0x1194b5['query']['offset']);}_0x306e12[_0x0493('0x3b')]=qs['sort'](_0x1194b5[_0x0493('0x35')]['sort']);_0x306e12[_0x0493('0x3c')]=qs[_0x0493('0x3d')](_['pick'](_0x1194b5[_0x0493('0x35')],_0x1a2f5e[_0x0493('0x3d')]),_0x49e8a4);if(_0x1194b5[_0x0493('0x35')]['filter']){_0x306e12[_0x0493('0x3c')]=_[_0x0493('0x3e')](_0x306e12[_0x0493('0x3c')],{'$or':_[_0x0493('0x31')](_0x49e8a4,function(_0x415e34){if(_0x415e34['type']!=='VIRTUAL'){var _0x29c042={};_0x29c042[_0x415e34[_0x0493('0x2e')]]={'$like':'%'+_0x1194b5[_0x0493('0x35')][_0x0493('0x3f')]+'%'};return _0x29c042;}})});}_0x306e12=_['merge']({},_0x306e12,_0x1194b5[_0x0493('0x40')]);var _0xa167f7={'where':_0x306e12[_0x0493('0x3c')]};return db['WhatsappQueue'][_0x0493('0x24')](_0xa167f7)[_0x0493('0x2a')](function(_0x57fde4){_0x2ba3cb[_0x0493('0x24')]=_0x57fde4;if(_0x1194b5[_0x0493('0x35')][_0x0493('0x41')]){_0x306e12[_0x0493('0x42')]=[{'all':!![]}];}return db[_0x0493('0x32')][_0x0493('0x43')](_0x306e12);})['then'](function(_0x47c25d){_0x2ba3cb[_0x0493('0x44')]=_0x47c25d;return _0x2ba3cb;})[_0x0493('0x2a')](respondWithFilteredResult(_0x51ece7,_0x306e12))[_0x0493('0x45')](handleError(_0x51ece7,null));};exports[_0x0493('0x46')]=function(_0x187a36,_0x4ac4c3){var _0x3698f0={'raw':!![],'where':{'id':_0x187a36['params']['id']}},_0x104276={};_0x104276[_0x0493('0x33')]=_[_0x0493('0x34')](db[_0x0493('0x32')][_0x0493('0x47')]);_0x104276['query']=_[_0x0493('0x34')](_0x187a36[_0x0493('0x35')]);_0x104276['filters']=_[_0x0493('0x37')](_0x104276[_0x0493('0x33')],_0x104276['query']);_0x3698f0[_0x0493('0x36')]=_[_0x0493('0x37')](_0x104276[_0x0493('0x33')],qs[_0x0493('0x38')](_0x187a36['query']['fields']));_0x3698f0[_0x0493('0x36')]=_0x3698f0[_0x0493('0x36')][_0x0493('0x39')]?_0x3698f0[_0x0493('0x36')]:_0x104276[_0x0493('0x33')];if(_0x187a36['query'][_0x0493('0x41')]){_0x3698f0['include']=[{'all':!![]}];}_0x3698f0=_[_0x0493('0x3e')]({},_0x3698f0,_0x187a36[_0x0493('0x40')]);return db[_0x0493('0x32')][_0x0493('0x48')](_0x3698f0)[_0x0493('0x2a')](handleEntityNotFound(_0x4ac4c3,null))[_0x0493('0x2a')](respondWithResult(_0x4ac4c3,null))['catch'](handleError(_0x4ac4c3,null));};exports[_0x0493('0x49')]=function(_0x2d3109,_0x186d4c){return db[_0x0493('0x32')][_0x0493('0x49')](_0x2d3109['body'],{})[_0x0493('0x2a')](function(_0x2dd738){var _0x43baca=_0x2d3109[_0x0493('0x4a')][_0x0493('0x4b')]({'plain':!![]});if(!_0x43baca)throw new Error(_0x0493('0x4c'));if(_0x43baca[_0x0493('0x4d')]==='user'){var _0xd9b085=_0x2dd738[_0x0493('0x4b')]({'plain':!![]});var _0x421ca3=_0x0493('0x2c');return db['UserProfileSection'][_0x0493('0x48')]({'where':{'name':_0x421ca3,'userProfileId':_0x43baca[_0x0493('0x4e')]},'raw':!![]})[_0x0493('0x2a')](function(_0x418d9d){if(_0x418d9d&&_0x418d9d[_0x0493('0x4f')]===0x0){return db[_0x0493('0x50')][_0x0493('0x49')]({'name':_0xd9b085[_0x0493('0x2e')],'resourceId':_0xd9b085['id'],'type':_0x418d9d[_0x0493('0x2e')],'sectionId':_0x418d9d['id']},{})[_0x0493('0x2a')](function(){return _0x2dd738;});}else{return _0x2dd738;}})[_0x0493('0x45')](function(_0x486e04){logger[_0x0493('0x51')](_0x0493('0x52'),_0x486e04);throw _0x486e04;});}return _0x2dd738;})[_0x0493('0x2a')](respondWithResult(_0x186d4c,0xc9))[_0x0493('0x45')](handleError(_0x186d4c,null));};exports[_0x0493('0x53')]=function(_0x1af400,_0x11a7bb){if(_0x1af400['body']['id']){delete _0x1af400['body']['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x1af400[_0x0493('0x54')]['id']}})[_0x0493('0x2a')](handleEntityNotFound(_0x11a7bb,null))['then'](saveUpdates(_0x1af400[_0x0493('0x55')],null))[_0x0493('0x2a')](respondWithResult(_0x11a7bb,null))[_0x0493('0x45')](handleError(_0x11a7bb,null));};exports[_0x0493('0x2b')]=function(_0x192320,_0x42c218){return db['WhatsappQueue'][_0x0493('0x48')]({'where':{'id':_0x192320['params']['id']}})[_0x0493('0x2a')](handleEntityNotFound(_0x42c218,null))[_0x0493('0x2a')](removeEntity(_0x42c218,null))[_0x0493('0x45')](handleError(_0x42c218,null));};exports[_0x0493('0x56')]=function(_0x3f068a,_0x360ed5){return db[_0x0493('0x32')][_0x0493('0x56')]()[_0x0493('0x2a')](respondWithResult(_0x360ed5,null))[_0x0493('0x45')](handleError(_0x360ed5,null));};exports[_0x0493('0x57')]=function(_0x1f7338,_0x5492cc,_0x3f43ba){var _0x49eda4={'raw':!![],'where':{}},_0x1f6856={},_0x2fe480;return db[_0x0493('0x32')][_0x0493('0x58')]({'where':{'id':_0x1f7338[_0x0493('0x54')]['id']}})['then'](handleEntityNotFound(_0x5492cc,null))['then'](function(_0x3b07db){if(_0x3b07db){_0x2fe480=_0x3b07db['get']({'plain':!![]});_0x1f6856[_0x0493('0x33')]=_[_0x0493('0x34')](db[_0x0493('0x59')][_0x0493('0x47')]);_0x1f6856[_0x0493('0x35')]=_[_0x0493('0x34')](_0x1f7338[_0x0493('0x35')]);_0x1f6856['filters']=_[_0x0493('0x37')](_0x1f6856[_0x0493('0x33')],_0x1f6856['query']);_0x49eda4[_0x0493('0x36')]=_[_0x0493('0x37')](_0x1f6856[_0x0493('0x33')],qs[_0x0493('0x38')](_0x1f7338['query'][_0x0493('0x38')]));_0x49eda4[_0x0493('0x36')]=_0x49eda4[_0x0493('0x36')][_0x0493('0x39')]?_0x49eda4['attributes']:_0x1f6856['model'];if(!_0x1f7338[_0x0493('0x35')][_0x0493('0x3a')](_0x0493('0x5a'))){_0x49eda4[_0x0493('0x26')]=qs[_0x0493('0x26')](_0x1f7338[_0x0493('0x35')]['limit']);_0x49eda4[_0x0493('0x25')]=qs[_0x0493('0x25')](_0x1f7338[_0x0493('0x35')][_0x0493('0x25')]);}_0x49eda4['order']=qs['sort'](_0x1f7338[_0x0493('0x35')]['sort']);_0x49eda4[_0x0493('0x3c')]=qs['filters'](_['pick'](_0x1f7338[_0x0493('0x35')],_0x1f6856[_0x0493('0x3d')]));_0x49eda4[_0x0493('0x3c')]['WhatsappQueueId']=_0x3b07db['id'];if(_0x1f7338[_0x0493('0x35')][_0x0493('0x3f')]){_0x49eda4[_0x0493('0x3c')]=_[_0x0493('0x3e')](_0x49eda4[_0x0493('0x3c')],{'$or':_[_0x0493('0x31')](_0x49eda4[_0x0493('0x36')],function(_0x2023ec){var _0x380824={};_0x380824[_0x2023ec]={'$like':'%'+_0x1f7338[_0x0493('0x35')][_0x0493('0x3f')]+'%'};return _0x380824;})});}_0x49eda4=_[_0x0493('0x3e')]({},_0x49eda4,_0x1f7338['options']);return db[_0x0493('0x59')][_0x0493('0x43')](_0x49eda4);}})[_0x0493('0x2a')](function(_0x160891){if(_0x160891){return db[_0x0493('0x5b')][_0x0493('0x5c')]({'where':{'id':_['map'](_0x160891,_0x0493('0x5d')),'role':_0x0493('0x5e')},'attributes':['id',_0x0493('0x2e'),_0x0493('0x5f'),_0x0493('0x60'),_0x0493('0x61')]});}})[_0x0493('0x2a')](function(_0x251998){if(_0x251998){return{'count':_0x251998[_0x0493('0x24')],'rows':_[_0x0493('0x31')](_0x251998[_0x0493('0x44')],function(_0x4075aa){return{'membername':_0x4075aa[_0x0493('0x2e')],'UserId':_0x4075aa['id'],'queue_name':_0x2fe480[_0x0493('0x2e')],'WhatsappQueueId':_0x2fe480['id'],'interface':util[_0x0493('0x62')](_0x0493('0x63'),_0x0493('0x64'),_0x4075aa['name']),'penalty':0x0,'paused':_0x4075aa['whatsappPause'],'createdAt':_0x4075aa[_0x0493('0x61')],'updatedAt':_0x4075aa['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5492cc,_0x49eda4))['catch'](handleError(_0x5492cc,null));};exports[_0x0493('0x65')]=function(_0x4c4f92,_0x1ed621,_0x1bc231){var _0x185ad4={};var _0x26245f={};var _0x45ff8f;var _0x21d99d;return db['WhatsappQueue'][_0x0493('0x58')]({'where':{'id':_0x4c4f92[_0x0493('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ed621,null))['then'](function(_0x2503cc){if(_0x2503cc){_0x45ff8f=_0x2503cc;_0x26245f[_0x0493('0x33')]=_[_0x0493('0x34')](db[_0x0493('0x66')]['rawAttributes']);_0x26245f[_0x0493('0x35')]=_[_0x0493('0x34')](_0x4c4f92[_0x0493('0x35')]);_0x26245f['filters']=_[_0x0493('0x37')](_0x26245f[_0x0493('0x33')],_0x26245f['query']);_0x185ad4[_0x0493('0x36')]=_[_0x0493('0x37')](_0x26245f[_0x0493('0x33')],qs[_0x0493('0x38')](_0x4c4f92[_0x0493('0x35')][_0x0493('0x38')]));_0x185ad4['attributes']=_0x185ad4[_0x0493('0x36')][_0x0493('0x39')]?_0x185ad4['attributes']:_0x26245f[_0x0493('0x33')];_0x185ad4['order']=qs[_0x0493('0x67')](_0x4c4f92[_0x0493('0x35')][_0x0493('0x67')]);_0x185ad4[_0x0493('0x3c')]=qs[_0x0493('0x3d')](_[_0x0493('0x68')](_0x4c4f92[_0x0493('0x35')],_0x26245f['filters']));if(_0x4c4f92[_0x0493('0x35')][_0x0493('0x3f')]){_0x185ad4[_0x0493('0x3c')]=_[_0x0493('0x3e')](_0x185ad4['where'],{'$or':_[_0x0493('0x31')](_0x185ad4[_0x0493('0x36')],function(_0x5b3996){var _0x1ecb81={};_0x1ecb81[_0x5b3996]={'$like':'%'+_0x4c4f92[_0x0493('0x35')][_0x0493('0x3f')]+'%'};return _0x1ecb81;})});}_0x185ad4=_['merge']({},_0x185ad4,_0x4c4f92[_0x0493('0x40')]);return _0x45ff8f[_0x0493('0x65')](_0x185ad4);}})[_0x0493('0x2a')](function(_0x197a10){if(_0x197a10){_0x21d99d=_0x197a10[_0x0493('0x39')];if(!_0x4c4f92[_0x0493('0x35')]['hasOwnProperty'](_0x0493('0x5a'))){_0x185ad4[_0x0493('0x26')]=qs['limit'](_0x4c4f92['query'][_0x0493('0x26')]);_0x185ad4[_0x0493('0x25')]=qs[_0x0493('0x25')](_0x4c4f92[_0x0493('0x35')][_0x0493('0x25')]);}return _0x45ff8f[_0x0493('0x65')](_0x185ad4);}})[_0x0493('0x2a')](function(_0xbcb48){if(_0xbcb48){return _0xbcb48?{'count':_0x21d99d,'rows':_0xbcb48}:null;}})[_0x0493('0x2a')](respondWithResult(_0x1ed621,null))[_0x0493('0x45')](handleError(_0x1ed621,null));};exports['addTeams']=function(_0x4380a9,_0xedc567,_0x5b5e00){var _0x4d6efb=_0x4380a9[_0x0493('0x55')][_0x0493('0x69')];return db[_0x0493('0x66')][_0x0493('0x43')]({'where':{'id':_0x4d6efb},'attributes':['id'],'include':[{'model':db[_0x0493('0x5b')],'as':'Agents','attributes':['id',_0x0493('0x2e'),_0x0493('0x6a'),_0x0493('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x40df94){if(_0x40df94){var _0x1c94e8=_[_0x0493('0x6c')](_0x40df94,function(_0x3a5076){var _0x56f73e=_0x3a5076[_0x0493('0x4b')]({'plain':!![]});return _0x56f73e[_0x0493('0x6d')];});return db[_0x0493('0x32')][_0x0493('0x48')]({'where':{'id':_0x4380a9[_0x0493('0x54')]['id']}})['then'](function(_0x3c7355){return db[_0x0493('0x6e')]['transaction'](function(_0x4b4cbd){return _0x3c7355[_0x0493('0x6f')](_0x4d6efb,{'transaction':_0x4b4cbd})[_0x0493('0x2a')](function(){return BPromise[_0x0493('0x70')](_0x1c94e8,function(_0x3a372b){return db[_0x0493('0x59')][_0x0493('0x71')]({'where':{'UserId':_0x3a372b['id'],'WhatsappQueueId':_0x4380a9[_0x0493('0x54')]['id']},'transaction':_0x4b4cbd});});})['then'](function(){_0x1c94e8[_0x0493('0x72')](function(_0x274c33){socket[_0x0493('0x73')](_0x0493('0x74'),{'UserId':_0x274c33['id'],'WhatsappQueueId':_0x3c7355['id']});});});});});}})[_0x0493('0x2a')](respondWithStatusCode(_0xedc567,null))[_0x0493('0x45')](handleError(_0xedc567,null));};exports[_0x0493('0x75')]=function(_0x4b43ef,_0x753de,_0x4a1aaa){return db[_0x0493('0x66')][_0x0493('0x43')]({'where':{'id':_0x4b43ef[_0x0493('0x35')][_0x0493('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0493('0x2a')](handleEntityNotFound(_0x753de,null))[_0x0493('0x2a')](function(_0x481fbc){var _0x436a72=_[_0x0493('0x31')](_0x481fbc,'id');var _0x419277=[];var _0x1f6e66=[];var _0x48ad90=squel[_0x0493('0x76')]();_0x48ad90[_0x0493('0x77')]('tq.TeamId')[_0x0493('0x78')]('team_has_whatsapp_queues','tq')[_0x0493('0x79')]('user_has_teams','ut',_0x0493('0x7a'))[_0x0493('0x3c')]('WhatsappQueueId\x20=\x20?',_0x4b43ef['params']['id']);for(var _0xcd0b29=0x0;_0xcd0b29<_0x481fbc[_0x0493('0x39')];_0xcd0b29+=0x1){let _0x282d18=_0x481fbc[_0xcd0b29];for(var _0x5a99d3=0x0;_0x5a99d3<_0x282d18[_0x0493('0x6d')][_0x0493('0x39')];_0x5a99d3+=0x1){let _0xf8da21=_0x282d18[_0x0493('0x6d')][_0x5a99d3];var _0x22f207=_0x48ad90['clone']();_0x22f207[_0x0493('0x3c')]('ut.UserId\x20=\x20?',_0xf8da21['id']);_0x1f6e66[_0x0493('0x7b')](db['sequelize']['query'](_0x22f207[_0x0493('0x7c')](),{'type':db[_0x0493('0x6e')]['QueryTypes'][_0x0493('0x7d')]})[_0x0493('0x2a')](function(_0x618822){if(_0x618822[_0x0493('0x39')]===0x1){return _0xf8da21['id'];}else{var _0x28b7fc=_[_0x0493('0x7e')](_[_0x0493('0x31')](_0x618822,_0x0493('0x7f')),function(_0x401b07){return _[_0x0493('0x80')](_0x436a72,_0x401b07);});if(_0x28b7fc){return _0xf8da21['id'];}}}));}}return BPromise[_0x0493('0x81')](_0x1f6e66)[_0x0493('0x2a')](function(_0x1786dc){_0x419277=_(_0x419277)[_0x0493('0x82')](_0x1786dc)[_0x0493('0x83')]()[_0x0493('0x84')]();return db[_0x0493('0x32')][_0x0493('0x48')]({'where':{'id':_0x4b43ef['params']['id']}})[_0x0493('0x2a')](function(_0x4b4d84){return db[_0x0493('0x6e')]['transaction'](function(_0x2a30a2){return _0x4b4d84['removeTeams'](_0x4b43ef['query']['ids'],{'transaction':_0x2a30a2})['then'](function(){if(!_['isEmpty'](_0x419277)){return _0x4b4d84[_0x0493('0x85')](_0x419277,{'transaction':_0x2a30a2});}})[_0x0493('0x2a')](function(){_0x419277['forEach'](function(_0x354df5){socket[_0x0493('0x73')](_0x0493('0x86'),{'UserId':_0x354df5,'WhatsappQueueId':_0x4b4d84['id']});});});});});});})[_0x0493('0x2a')](respondWithStatusCode(_0x753de,null))[_0x0493('0x45')](handleError(_0x753de,null));};exports[_0x0493('0x87')]=function(_0x5241f0,_0x2ce230,_0x5fb3f5){return db['WhatsappQueue'][_0x0493('0x48')]({'where':{'id':_0x5241f0[_0x0493('0x54')]['id']}})['then'](handleEntityNotFound(_0x2ce230,null))[_0x0493('0x2a')](function(_0x3985c6){if(_0x3985c6){return _0x3985c6['addAgents'](_0x5241f0[_0x0493('0x55')]['ids'],_[_0x0493('0x88')](_0x5241f0[_0x0493('0x55')],[_0x0493('0x69'),'id'])||{})[_0x0493('0x89')](function(_0x443734){for(var _0xe7dc8=0x0;_0xe7dc8<_0x5241f0['body'][_0x0493('0x69')]['length'];_0xe7dc8+=0x1){socket[_0x0493('0x73')](_0x0493('0x74'),{'UserId':_0x5241f0[_0x0493('0x55')]['ids'][_0xe7dc8],'WhatsappQueueId':_0x5241f0[_0x0493('0x54')]['id']});}return _0x443734;});}})[_0x0493('0x2a')](respondWithResult(_0x2ce230,null))[_0x0493('0x45')](handleError(_0x2ce230,null));};exports[_0x0493('0x85')]=function(_0x46b849,_0x1cf228,_0x7cfe97){return db['WhatsappQueue'][_0x0493('0x48')]({'where':{'id':_0x46b849['params']['id']}})[_0x0493('0x2a')](handleEntityNotFound(_0x1cf228,null))[_0x0493('0x2a')](function(_0x12630c){if(_0x12630c){return _0x12630c[_0x0493('0x85')](_0x46b849[_0x0493('0x35')][_0x0493('0x69')])[_0x0493('0x2a')](function(){if(_[_0x0493('0x8a')](_0x46b849[_0x0493('0x35')][_0x0493('0x69')])){for(var _0x12152e=0x0;_0x12152e<_0x46b849['query'][_0x0493('0x69')]['length'];_0x12152e+=0x1){socket[_0x0493('0x73')](_0x0493('0x86'),{'UserId':Number(_0x46b849[_0x0493('0x35')][_0x0493('0x69')][_0x12152e]),'WhatsappQueueId':Number(_0x46b849[_0x0493('0x54')]['id'])});}}else{socket[_0x0493('0x73')](_0x0493('0x86'),{'UserId':Number(_0x46b849[_0x0493('0x35')][_0x0493('0x69')]),'WhatsappQueueId':Number(_0x46b849['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1cf228,null))[_0x0493('0x45')](handleError(_0x1cf228,null));};exports[_0x0493('0x8b')]=function(_0x3af29c,_0x3f4cc4,_0x50e6b6){var _0x4a31ad={};var _0x1da70b={};var _0x2d2846;var _0x59ea0a;return db[_0x0493('0x32')][_0x0493('0x58')]({'where':{'id':_0x3af29c['params']['id']}})[_0x0493('0x2a')](handleEntityNotFound(_0x3f4cc4,null))[_0x0493('0x2a')](function(_0x5b14ac){if(_0x5b14ac){_0x2d2846=_0x5b14ac;_0x1da70b[_0x0493('0x33')]=_[_0x0493('0x34')](db['User'][_0x0493('0x47')]);_0x1da70b['query']=_[_0x0493('0x34')](_0x3af29c[_0x0493('0x35')]);_0x1da70b['filters']=_[_0x0493('0x37')](_0x1da70b[_0x0493('0x33')],_0x1da70b[_0x0493('0x35')]);_0x4a31ad['attributes']=_['intersection'](_0x1da70b['model'],qs[_0x0493('0x38')](_0x3af29c[_0x0493('0x35')]['fields']));_0x4a31ad[_0x0493('0x36')]=_0x4a31ad[_0x0493('0x36')][_0x0493('0x39')]?_0x4a31ad[_0x0493('0x36')]:_0x1da70b[_0x0493('0x33')];_0x4a31ad[_0x0493('0x3b')]=qs['sort'](_0x3af29c['query'][_0x0493('0x67')]);_0x4a31ad['where']=qs['filters'](_['pick'](_0x3af29c['query'],_0x1da70b[_0x0493('0x3d')]));if(_0x3af29c[_0x0493('0x35')][_0x0493('0x3f')]){_0x4a31ad[_0x0493('0x3c')]=_['merge'](_0x4a31ad[_0x0493('0x3c')],{'$or':_[_0x0493('0x31')](_0x4a31ad[_0x0493('0x36')],function(_0x2b2eba){var _0x1e5a3b={};_0x1e5a3b[_0x2b2eba]={'$like':'%'+_0x3af29c[_0x0493('0x35')]['filter']+'%'};return _0x1e5a3b;})});}_0x4a31ad=_[_0x0493('0x3e')]({},_0x4a31ad,_0x3af29c[_0x0493('0x40')]);return _0x2d2846['getAgents'](_0x4a31ad);}})[_0x0493('0x2a')](function(_0x5585a0){if(_0x5585a0){_0x59ea0a=_0x5585a0[_0x0493('0x39')];if(!_0x3af29c['query'][_0x0493('0x3a')](_0x0493('0x5a'))){_0x4a31ad[_0x0493('0x26')]=qs[_0x0493('0x26')](_0x3af29c['query'][_0x0493('0x26')]);_0x4a31ad['offset']=qs[_0x0493('0x25')](_0x3af29c[_0x0493('0x35')]['offset']);}return _0x2d2846[_0x0493('0x8b')](_0x4a31ad);}})[_0x0493('0x2a')](function(_0x9e21e8){if(_0x9e21e8){return _0x9e21e8?{'count':_0x59ea0a,'rows':_0x9e21e8}:null;}})[_0x0493('0x2a')](respondWithResult(_0x3f4cc4,null))[_0x0493('0x45')](handleError(_0x3f4cc4,null));}; \ No newline at end of file +var _0x743d=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','status','end','json','count','offset','set','reject','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','WhatsappQueue','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','pick','User','findAndCountAll','map','UserId','agent','whatsappPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','nolimit','addTeams','online','voicePause','Agents','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','sequelize','toString','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x743d,0x74));var _0xd743=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x743d[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd743('0x0'));var rimraf=require(_0xd743('0x1'));var zipdir=require(_0xd743('0x2'));var jsonpatch=require(_0xd743('0x3'));var rp=require(_0xd743('0x4'));var moment=require(_0xd743('0x5'));var BPromise=require(_0xd743('0x6'));var Mustache=require('mustache');var util=require(_0xd743('0x7'));var path=require(_0xd743('0x8'));var sox=require(_0xd743('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd743('0xa'));var squel=require(_0xd743('0xb'));var crypto=require(_0xd743('0xc'));var jsforce=require(_0xd743('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd743('0xe'));var querystring=require(_0xd743('0xf'));var Papa=require(_0xd743('0x10'));var Redis=require(_0xd743('0x11'));var authService=require(_0xd743('0x12'));var qs=require(_0xd743('0x13'));var as=require(_0xd743('0x14'));var hardwareService=require(_0xd743('0x15'));var logger=require(_0xd743('0x16'))(_0xd743('0x17'));var utils=require(_0xd743('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd743('0x19'))['db'];config[_0xd743('0x1a')]=_[_0xd743('0x1b')](config[_0xd743('0x1a')],{'host':_0xd743('0x1c'),'port':0x18eb});var socket=require(_0xd743('0x1d'))(new Redis(config[_0xd743('0x1a')]));require(_0xd743('0x1e'))['register'](socket);function respondWithStatusCode(_0x71489f,_0x1c6c69){_0x1c6c69=_0x1c6c69||0xcc;return function(_0x4c16d2){if(_0x4c16d2){return _0x71489f['sendStatus'](_0x1c6c69);}return _0x71489f[_0xd743('0x1f')](_0x1c6c69)[_0xd743('0x20')]();};}function respondWithResult(_0x237ee3,_0x43c01e){_0x43c01e=_0x43c01e||0xc8;return function(_0x147920){if(_0x147920){return _0x237ee3[_0xd743('0x1f')](_0x43c01e)[_0xd743('0x21')](_0x147920);}};}function respondWithFilteredResult(_0x33e91e,_0x10f2f9){return function(_0x5373f7){if(_0x5373f7){var _0x27b767=_0x5373f7[_0xd743('0x22')],_0xbf92ef=_0x10f2f9[_0xd743('0x23')],_0xb2c98c=_0x10f2f9[_0xd743('0x23')]+_0x10f2f9['limit'],_0x41e6a5;if(_0xb2c98c>=_0x27b767){_0xb2c98c=_0x27b767;_0x41e6a5=0xc8;}else{_0x41e6a5=0xce;}_0x33e91e[_0xd743('0x1f')](_0x41e6a5);return _0x33e91e[_0xd743('0x24')]('Content-Range',_0xbf92ef+'-'+_0xb2c98c+'/'+_0x27b767)[_0xd743('0x21')](_0x5373f7);}return null;};}function patchUpdates(_0x515240){return function(_0x1e2369){try{jsonpatch['apply'](_0x1e2369,_0x515240,!![]);}catch(_0x158d41){return BPromise[_0xd743('0x25')](_0x158d41);}return _0x1e2369['save']();};}function saveUpdates(_0x2e84de,_0x459dc2){return function(_0x430f0f){if(_0x430f0f){return _0x430f0f['update'](_0x2e84de)[_0xd743('0x26')](function(_0x19c89b){return _0x19c89b;});}return null;};}function removeEntity(_0x3b1193,_0x8e2f){return function(_0x2f5b28){if(_0x2f5b28){return _0x2f5b28[_0xd743('0x27')]()[_0xd743('0x26')](function(){var _0x2dc0e0=_0x2f5b28['get']({'plain':!![]});var _0x2ff343='WhatsappQueues';return db[_0xd743('0x28')][_0xd743('0x27')]({'where':{'type':_0x2ff343,'resourceId':_0x2dc0e0['id']}})[_0xd743('0x26')](function(){return _0x2f5b28;});})[_0xd743('0x26')](function(){_0x3b1193[_0xd743('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c7b22,_0x203602){return function(_0x3af6cd){if(!_0x3af6cd){_0x5c7b22[_0xd743('0x29')](0x194);}return _0x3af6cd;};}function handleError(_0x4d7910,_0x588bdd){_0x588bdd=_0x588bdd||0x1f4;return function(_0x264eba){logger[_0xd743('0x2a')](_0x264eba[_0xd743('0x2b')]);if(_0x264eba['name']){delete _0x264eba[_0xd743('0x2c')];}_0x4d7910[_0xd743('0x1f')](_0x588bdd)[_0xd743('0x2d')](_0x264eba);};}exports['index']=function(_0x370339,_0x5541b9){var _0x1c51b8={},_0x1f2f71={},_0x391bf5={'count':0x0,'rows':[]};var _0x346320=_['map'](db[_0xd743('0x2e')][_0xd743('0x2f')],function(_0x268059){return{'name':_0x268059['fieldName'],'type':_0x268059['type']['key']};});_0x1f2f71['model']=_['map'](_0x346320,'name');_0x1f2f71[_0xd743('0x30')]=_[_0xd743('0x31')](_0x370339['query']);_0x1f2f71[_0xd743('0x32')]=_[_0xd743('0x33')](_0x1f2f71['model'],_0x1f2f71['query']);_0x1c51b8['attributes']=_['intersection'](_0x1f2f71[_0xd743('0x34')],qs['fields'](_0x370339[_0xd743('0x30')][_0xd743('0x35')]));_0x1c51b8[_0xd743('0x36')]=_0x1c51b8[_0xd743('0x36')][_0xd743('0x37')]?_0x1c51b8[_0xd743('0x36')]:_0x1f2f71['model'];if(!_0x370339[_0xd743('0x30')][_0xd743('0x38')]('nolimit')){_0x1c51b8[_0xd743('0x39')]=qs[_0xd743('0x39')](_0x370339[_0xd743('0x30')][_0xd743('0x39')]);_0x1c51b8[_0xd743('0x23')]=qs[_0xd743('0x23')](_0x370339['query'][_0xd743('0x23')]);}_0x1c51b8[_0xd743('0x3a')]=qs[_0xd743('0x3b')](_0x370339[_0xd743('0x30')][_0xd743('0x3b')]);_0x1c51b8[_0xd743('0x3c')]=qs[_0xd743('0x32')](_['pick'](_0x370339[_0xd743('0x30')],_0x1f2f71[_0xd743('0x32')]),_0x346320);if(_0x370339[_0xd743('0x30')][_0xd743('0x3d')]){_0x1c51b8[_0xd743('0x3c')]=_['merge'](_0x1c51b8[_0xd743('0x3c')],{'$or':_['map'](_0x346320,function(_0x265fda){if(_0x265fda[_0xd743('0x3e')]!==_0xd743('0x3f')){var _0x32a49c={};_0x32a49c[_0x265fda['name']]={'$like':'%'+_0x370339[_0xd743('0x30')][_0xd743('0x3d')]+'%'};return _0x32a49c;}})});}_0x1c51b8=_['merge']({},_0x1c51b8,_0x370339[_0xd743('0x40')]);var _0x494458={'where':_0x1c51b8[_0xd743('0x3c')]};return db[_0xd743('0x2e')][_0xd743('0x22')](_0x494458)[_0xd743('0x26')](function(_0x159c88){_0x391bf5[_0xd743('0x22')]=_0x159c88;if(_0x370339['query'][_0xd743('0x41')]){_0x1c51b8[_0xd743('0x42')]=[{'all':!![]}];}return db[_0xd743('0x2e')][_0xd743('0x43')](_0x1c51b8);})[_0xd743('0x26')](function(_0x487617){_0x391bf5[_0xd743('0x44')]=_0x487617;return _0x391bf5;})[_0xd743('0x26')](respondWithFilteredResult(_0x5541b9,_0x1c51b8))[_0xd743('0x45')](handleError(_0x5541b9,null));};exports[_0xd743('0x46')]=function(_0x372bd2,_0x457932){var _0x61d49={'raw':!![],'where':{'id':_0x372bd2[_0xd743('0x47')]['id']}},_0x4c227e={};_0x4c227e[_0xd743('0x34')]=_['keys'](db['WhatsappQueue'][_0xd743('0x2f')]);_0x4c227e[_0xd743('0x30')]=_[_0xd743('0x31')](_0x372bd2[_0xd743('0x30')]);_0x4c227e[_0xd743('0x32')]=_[_0xd743('0x33')](_0x4c227e[_0xd743('0x34')],_0x4c227e[_0xd743('0x30')]);_0x61d49[_0xd743('0x36')]=_[_0xd743('0x33')](_0x4c227e[_0xd743('0x34')],qs[_0xd743('0x35')](_0x372bd2['query'][_0xd743('0x35')]));_0x61d49['attributes']=_0x61d49[_0xd743('0x36')][_0xd743('0x37')]?_0x61d49[_0xd743('0x36')]:_0x4c227e[_0xd743('0x34')];if(_0x372bd2[_0xd743('0x30')][_0xd743('0x41')]){_0x61d49[_0xd743('0x42')]=[{'all':!![]}];}_0x61d49=_[_0xd743('0x48')]({},_0x61d49,_0x372bd2['options']);return db[_0xd743('0x2e')][_0xd743('0x49')](_0x61d49)[_0xd743('0x26')](handleEntityNotFound(_0x457932,null))[_0xd743('0x26')](respondWithResult(_0x457932,null))[_0xd743('0x45')](handleError(_0x457932,null));};exports['create']=function(_0x4e7922,_0xa9de91){return db[_0xd743('0x2e')]['create'](_0x4e7922[_0xd743('0x4a')],{})[_0xd743('0x26')](function(_0x1aec10){var _0x1f505f=_0x4e7922[_0xd743('0x4b')][_0xd743('0x4c')]({'plain':!![]});if(!_0x1f505f)throw new Error(_0xd743('0x4d'));if(_0x1f505f[_0xd743('0x4e')]===_0xd743('0x4b')){var _0x36fcf2=_0x1aec10[_0xd743('0x4c')]({'plain':!![]});var _0x4c1560=_0xd743('0x4f');return db['UserProfileSection'][_0xd743('0x49')]({'where':{'name':_0x4c1560,'userProfileId':_0x1f505f[_0xd743('0x50')]},'raw':!![]})[_0xd743('0x26')](function(_0x48737d){if(_0x48737d&&_0x48737d[_0xd743('0x51')]===0x0){return db[_0xd743('0x28')][_0xd743('0x52')]({'name':_0x36fcf2[_0xd743('0x2c')],'resourceId':_0x36fcf2['id'],'type':_0x48737d['name'],'sectionId':_0x48737d['id']},{})['then'](function(){return _0x1aec10;});}else{return _0x1aec10;}})['catch'](function(_0x3c89ff){logger[_0xd743('0x2a')](_0xd743('0x53'),_0x3c89ff);throw _0x3c89ff;});}return _0x1aec10;})[_0xd743('0x26')](respondWithResult(_0xa9de91,0xc9))[_0xd743('0x45')](handleError(_0xa9de91,null));};exports[_0xd743('0x54')]=function(_0xdd6263,_0xdebff2){if(_0xdd6263[_0xd743('0x4a')]['id']){delete _0xdd6263['body']['id'];}return db[_0xd743('0x2e')][_0xd743('0x49')]({'where':{'id':_0xdd6263[_0xd743('0x47')]['id']}})[_0xd743('0x26')](handleEntityNotFound(_0xdebff2,null))[_0xd743('0x26')](saveUpdates(_0xdd6263[_0xd743('0x4a')],null))[_0xd743('0x26')](respondWithResult(_0xdebff2,null))['catch'](handleError(_0xdebff2,null));};exports[_0xd743('0x27')]=function(_0x55ba0c,_0x1186ec){return db[_0xd743('0x2e')]['find']({'where':{'id':_0x55ba0c['params']['id']}})['then'](handleEntityNotFound(_0x1186ec,null))[_0xd743('0x26')](removeEntity(_0x1186ec,null))[_0xd743('0x45')](handleError(_0x1186ec,null));};exports[_0xd743('0x55')]=function(_0x240ddc,_0x2cb3cf){return db[_0xd743('0x2e')][_0xd743('0x55')]()[_0xd743('0x26')](respondWithResult(_0x2cb3cf,null))[_0xd743('0x45')](handleError(_0x2cb3cf,null));};exports[_0xd743('0x56')]=function(_0xb29c21,_0x264889,_0x2a30c9){var _0xac1ca9={'raw':!![],'where':{}},_0x317d43={},_0x413be7;return db['WhatsappQueue'][_0xd743('0x57')]({'where':{'id':_0xb29c21[_0xd743('0x47')]['id']}})[_0xd743('0x26')](handleEntityNotFound(_0x264889,null))[_0xd743('0x26')](function(_0x5cd8df){if(_0x5cd8df){_0x413be7=_0x5cd8df[_0xd743('0x4c')]({'plain':!![]});_0x317d43[_0xd743('0x34')]=_[_0xd743('0x31')](db[_0xd743('0x58')]['rawAttributes']);_0x317d43[_0xd743('0x30')]=_['keys'](_0xb29c21[_0xd743('0x30')]);_0x317d43[_0xd743('0x32')]=_[_0xd743('0x33')](_0x317d43[_0xd743('0x34')],_0x317d43['query']);_0xac1ca9[_0xd743('0x36')]=_[_0xd743('0x33')](_0x317d43[_0xd743('0x34')],qs['fields'](_0xb29c21[_0xd743('0x30')][_0xd743('0x35')]));_0xac1ca9[_0xd743('0x36')]=_0xac1ca9[_0xd743('0x36')][_0xd743('0x37')]?_0xac1ca9[_0xd743('0x36')]:_0x317d43[_0xd743('0x34')];if(!_0xb29c21['query'][_0xd743('0x38')]('nolimit')){_0xac1ca9[_0xd743('0x39')]=qs[_0xd743('0x39')](_0xb29c21[_0xd743('0x30')][_0xd743('0x39')]);_0xac1ca9['offset']=qs[_0xd743('0x23')](_0xb29c21[_0xd743('0x30')][_0xd743('0x23')]);}_0xac1ca9[_0xd743('0x3a')]=qs[_0xd743('0x3b')](_0xb29c21[_0xd743('0x30')]['sort']);_0xac1ca9[_0xd743('0x3c')]=qs[_0xd743('0x32')](_[_0xd743('0x59')](_0xb29c21['query'],_0x317d43[_0xd743('0x32')]));_0xac1ca9[_0xd743('0x3c')]['WhatsappQueueId']=_0x5cd8df['id'];if(_0xb29c21['query'][_0xd743('0x3d')]){_0xac1ca9['where']=_['merge'](_0xac1ca9['where'],{'$or':_['map'](_0xac1ca9[_0xd743('0x36')],function(_0xfcb91b){var _0x129377={};_0x129377[_0xfcb91b]={'$like':'%'+_0xb29c21[_0xd743('0x30')][_0xd743('0x3d')]+'%'};return _0x129377;})});}_0xac1ca9=_[_0xd743('0x48')]({},_0xac1ca9,_0xb29c21[_0xd743('0x40')]);return db[_0xd743('0x58')][_0xd743('0x43')](_0xac1ca9);}})[_0xd743('0x26')](function(_0x1a7ec4){if(_0x1a7ec4){return db[_0xd743('0x5a')][_0xd743('0x5b')]({'where':{'id':_[_0xd743('0x5c')](_0x1a7ec4,_0xd743('0x5d')),'role':_0xd743('0x5e')},'attributes':['id','name',_0xd743('0x5f'),_0xd743('0x60'),'createdAt']});}})[_0xd743('0x26')](function(_0x531a5b){if(_0x531a5b){return{'count':_0x531a5b[_0xd743('0x22')],'rows':_[_0xd743('0x5c')](_0x531a5b['rows'],function(_0x33b048){return{'membername':_0x33b048[_0xd743('0x2c')],'UserId':_0x33b048['id'],'queue_name':_0x413be7[_0xd743('0x2c')],'WhatsappQueueId':_0x413be7['id'],'interface':util[_0xd743('0x61')](_0xd743('0x62'),'SIP',_0x33b048[_0xd743('0x2c')]),'penalty':0x0,'paused':_0x33b048['whatsappPause'],'createdAt':_0x33b048[_0xd743('0x63')],'updatedAt':_0x33b048['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd743('0x26')](respondWithFilteredResult(_0x264889,_0xac1ca9))['catch'](handleError(_0x264889,null));};exports[_0xd743('0x64')]=function(_0x1fc99b,_0x3fffc0,_0x1d85a1){var _0x41630a={};var _0x159153={};var _0x22cfab;var _0x4aea4c;return db[_0xd743('0x2e')][_0xd743('0x57')]({'where':{'id':_0x1fc99b[_0xd743('0x47')]['id']}})[_0xd743('0x26')](handleEntityNotFound(_0x3fffc0,null))['then'](function(_0x2f4eaa){if(_0x2f4eaa){_0x22cfab=_0x2f4eaa;_0x159153[_0xd743('0x34')]=_[_0xd743('0x31')](db[_0xd743('0x65')][_0xd743('0x2f')]);_0x159153[_0xd743('0x30')]=_['keys'](_0x1fc99b[_0xd743('0x30')]);_0x159153[_0xd743('0x32')]=_['intersection'](_0x159153[_0xd743('0x34')],_0x159153[_0xd743('0x30')]);_0x41630a[_0xd743('0x36')]=_['intersection'](_0x159153[_0xd743('0x34')],qs['fields'](_0x1fc99b['query'][_0xd743('0x35')]));_0x41630a['attributes']=_0x41630a[_0xd743('0x36')][_0xd743('0x37')]?_0x41630a['attributes']:_0x159153['model'];_0x41630a[_0xd743('0x3a')]=qs['sort'](_0x1fc99b['query'][_0xd743('0x3b')]);_0x41630a[_0xd743('0x3c')]=qs[_0xd743('0x32')](_[_0xd743('0x59')](_0x1fc99b[_0xd743('0x30')],_0x159153[_0xd743('0x32')]));if(_0x1fc99b[_0xd743('0x30')]['filter']){_0x41630a[_0xd743('0x3c')]=_[_0xd743('0x48')](_0x41630a[_0xd743('0x3c')],{'$or':_[_0xd743('0x5c')](_0x41630a[_0xd743('0x36')],function(_0x2188de){var _0x4da900={};_0x4da900[_0x2188de]={'$like':'%'+_0x1fc99b['query']['filter']+'%'};return _0x4da900;})});}_0x41630a=_[_0xd743('0x48')]({},_0x41630a,_0x1fc99b[_0xd743('0x40')]);return _0x22cfab['getTeams'](_0x41630a);}})[_0xd743('0x26')](function(_0x449cb2){if(_0x449cb2){_0x4aea4c=_0x449cb2[_0xd743('0x37')];if(!_0x1fc99b['query']['hasOwnProperty'](_0xd743('0x66'))){_0x41630a[_0xd743('0x39')]=qs[_0xd743('0x39')](_0x1fc99b[_0xd743('0x30')]['limit']);_0x41630a['offset']=qs[_0xd743('0x23')](_0x1fc99b[_0xd743('0x30')][_0xd743('0x23')]);}return _0x22cfab[_0xd743('0x64')](_0x41630a);}})[_0xd743('0x26')](function(_0xe14be5){if(_0xe14be5){return _0xe14be5?{'count':_0x4aea4c,'rows':_0xe14be5}:null;}})['then'](respondWithResult(_0x3fffc0,null))[_0xd743('0x45')](handleError(_0x3fffc0,null));};exports[_0xd743('0x67')]=function(_0x4fa601,_0x46f38d,_0x4891a0){var _0x5cf0ef=_0x4fa601['body']['ids'];return db[_0xd743('0x65')]['findAll']({'where':{'id':_0x5cf0ef},'attributes':['id'],'include':[{'model':db[_0xd743('0x5a')],'as':'Agents','attributes':['id',_0xd743('0x2c'),_0xd743('0x68'),_0xd743('0x69'),'interface'],'raw':!![]}]})[_0xd743('0x26')](function(_0x1708d8){if(_0x1708d8){var _0x3f83a6=_['flatMap'](_0x1708d8,function(_0x22bd6b){var _0x1a70ee=_0x22bd6b['get']({'plain':!![]});return _0x1a70ee[_0xd743('0x6a')];});return db[_0xd743('0x2e')][_0xd743('0x49')]({'where':{'id':_0x4fa601[_0xd743('0x47')]['id']}})[_0xd743('0x26')](function(_0x26452d){return db['sequelize'][_0xd743('0x6b')](function(_0x2f3c54){return _0x26452d['addTeams'](_0x5cf0ef,{'transaction':_0x2f3c54})['then'](function(){return BPromise[_0xd743('0x6c')](_0x3f83a6,function(_0x54f9ba){return db[_0xd743('0x58')]['findOrCreate']({'where':{'UserId':_0x54f9ba['id'],'WhatsappQueueId':_0x4fa601['params']['id']},'transaction':_0x2f3c54});});})[_0xd743('0x26')](function(){_0x3f83a6[_0xd743('0x6d')](function(_0x39d538){socket[_0xd743('0x6e')](_0xd743('0x6f'),{'UserId':_0x39d538['id'],'WhatsappQueueId':_0x26452d['id']});});});});});}})[_0xd743('0x26')](respondWithStatusCode(_0x46f38d,null))[_0xd743('0x45')](handleError(_0x46f38d,null));};exports[_0xd743('0x70')]=function(_0x2b813d,_0x4c17f5,_0x11beb3){return db['Team'][_0xd743('0x43')]({'where':{'id':_0x2b813d[_0xd743('0x30')][_0xd743('0x71')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4c17f5,null))[_0xd743('0x26')](function(_0xce359a){var _0x2bb299=_['map'](_0xce359a,'id');var _0x874c14=[];var _0x3e930b=[];var _0x2f5bbb=squel[_0xd743('0x72')]();_0x2f5bbb[_0xd743('0x73')](_0xd743('0x74'))[_0xd743('0x75')]('team_has_whatsapp_queues','tq')[_0xd743('0x76')]('user_has_teams','ut',_0xd743('0x77'))[_0xd743('0x3c')](_0xd743('0x78'),_0x2b813d['params']['id']);for(var _0x566514=0x0;_0x566514<_0xce359a[_0xd743('0x37')];_0x566514+=0x1){let _0x4e2969=_0xce359a[_0x566514];for(var _0x5f455b=0x0;_0x5f455b<_0x4e2969[_0xd743('0x6a')]['length'];_0x5f455b+=0x1){let _0x575781=_0x4e2969[_0xd743('0x6a')][_0x5f455b];var _0x14fd36=_0x2f5bbb[_0xd743('0x79')]();_0x14fd36[_0xd743('0x3c')]('ut.UserId\x20=\x20?',_0x575781['id']);_0x3e930b['push'](db[_0xd743('0x7a')][_0xd743('0x30')](_0x14fd36[_0xd743('0x7b')](),{'type':db[_0xd743('0x7a')]['QueryTypes'][_0xd743('0x7c')]})[_0xd743('0x26')](function(_0x42f1f9){if(_0x42f1f9[_0xd743('0x37')]===0x1){return _0x575781['id'];}else{var _0x489c0b=_[_0xd743('0x7d')](_[_0xd743('0x5c')](_0x42f1f9,'TeamId'),function(_0x3ed8e7){return _[_0xd743('0x7e')](_0x2bb299,_0x3ed8e7);});if(_0x489c0b){return _0x575781['id'];}}}));}}return BPromise[_0xd743('0x7f')](_0x3e930b)[_0xd743('0x26')](function(_0x2e26c3){_0x874c14=_(_0x874c14)[_0xd743('0x80')](_0x2e26c3)[_0xd743('0x81')]()['value']();return db[_0xd743('0x2e')][_0xd743('0x49')]({'where':{'id':_0x2b813d['params']['id']}})[_0xd743('0x26')](function(_0x37cf7a){return db['sequelize'][_0xd743('0x6b')](function(_0x2880b9){return _0x37cf7a[_0xd743('0x70')](_0x2b813d[_0xd743('0x30')][_0xd743('0x71')],{'transaction':_0x2880b9})[_0xd743('0x26')](function(){if(!_[_0xd743('0x82')](_0x874c14)){return _0x37cf7a[_0xd743('0x83')](_0x874c14,{'transaction':_0x2880b9});}})[_0xd743('0x26')](function(){_0x874c14[_0xd743('0x6d')](function(_0x39d7d8){socket[_0xd743('0x6e')](_0xd743('0x84'),{'UserId':_0x39d7d8,'WhatsappQueueId':_0x37cf7a['id']});});});});});});})[_0xd743('0x26')](respondWithStatusCode(_0x4c17f5,null))[_0xd743('0x45')](handleError(_0x4c17f5,null));};exports[_0xd743('0x85')]=function(_0x26ac5d,_0x24dcff,_0x7f2ac2){return db[_0xd743('0x2e')][_0xd743('0x49')]({'where':{'id':_0x26ac5d[_0xd743('0x47')]['id']}})[_0xd743('0x26')](handleEntityNotFound(_0x24dcff,null))[_0xd743('0x26')](function(_0x1b76e){if(_0x1b76e){return _0x1b76e[_0xd743('0x85')](_0x26ac5d['body']['ids'],_[_0xd743('0x86')](_0x26ac5d[_0xd743('0x4a')],[_0xd743('0x71'),'id'])||{})[_0xd743('0x87')](function(_0x5d6e5d){for(var _0x5d3b56=0x0;_0x5d3b56<_0x26ac5d[_0xd743('0x4a')]['ids'][_0xd743('0x37')];_0x5d3b56+=0x1){socket[_0xd743('0x6e')]('userWhatsappQueue:save',{'UserId':_0x26ac5d[_0xd743('0x4a')][_0xd743('0x71')][_0x5d3b56],'WhatsappQueueId':_0x26ac5d[_0xd743('0x47')]['id']});}return _0x5d6e5d;});}})[_0xd743('0x26')](respondWithResult(_0x24dcff,null))[_0xd743('0x45')](handleError(_0x24dcff,null));};exports[_0xd743('0x83')]=function(_0x176d3f,_0x3c304f,_0x11658b){return db[_0xd743('0x2e')][_0xd743('0x49')]({'where':{'id':_0x176d3f['params']['id']}})['then'](handleEntityNotFound(_0x3c304f,null))['then'](function(_0x565a15){if(_0x565a15){return _0x565a15[_0xd743('0x83')](_0x176d3f[_0xd743('0x30')][_0xd743('0x71')])[_0xd743('0x26')](function(){if(_['isArray'](_0x176d3f[_0xd743('0x30')][_0xd743('0x71')])){for(var _0x4b488d=0x0;_0x4b488d<_0x176d3f[_0xd743('0x30')][_0xd743('0x71')]['length'];_0x4b488d+=0x1){socket[_0xd743('0x6e')](_0xd743('0x84'),{'UserId':Number(_0x176d3f[_0xd743('0x30')][_0xd743('0x71')][_0x4b488d]),'WhatsappQueueId':Number(_0x176d3f[_0xd743('0x47')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x176d3f[_0xd743('0x30')][_0xd743('0x71')]),'WhatsappQueueId':Number(_0x176d3f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3c304f,null))['catch'](handleError(_0x3c304f,null));};exports[_0xd743('0x88')]=function(_0x492306,_0x2bce78,_0x22a774){var _0x1d1a13={};var _0x733490={};var _0x581c8e;var _0x3a8ac9;return db[_0xd743('0x2e')]['findOne']({'where':{'id':_0x492306[_0xd743('0x47')]['id']}})[_0xd743('0x26')](handleEntityNotFound(_0x2bce78,null))[_0xd743('0x26')](function(_0x20ce8b){if(_0x20ce8b){_0x581c8e=_0x20ce8b;_0x733490[_0xd743('0x34')]=_[_0xd743('0x31')](db[_0xd743('0x5a')][_0xd743('0x2f')]);_0x733490[_0xd743('0x30')]=_['keys'](_0x492306[_0xd743('0x30')]);_0x733490[_0xd743('0x32')]=_[_0xd743('0x33')](_0x733490[_0xd743('0x34')],_0x733490[_0xd743('0x30')]);_0x1d1a13[_0xd743('0x36')]=_[_0xd743('0x33')](_0x733490[_0xd743('0x34')],qs[_0xd743('0x35')](_0x492306[_0xd743('0x30')]['fields']));_0x1d1a13[_0xd743('0x36')]=_0x1d1a13[_0xd743('0x36')][_0xd743('0x37')]?_0x1d1a13[_0xd743('0x36')]:_0x733490[_0xd743('0x34')];_0x1d1a13['order']=qs['sort'](_0x492306[_0xd743('0x30')]['sort']);_0x1d1a13[_0xd743('0x3c')]=qs[_0xd743('0x32')](_[_0xd743('0x59')](_0x492306[_0xd743('0x30')],_0x733490[_0xd743('0x32')]));if(_0x492306[_0xd743('0x30')][_0xd743('0x3d')]){_0x1d1a13['where']=_['merge'](_0x1d1a13[_0xd743('0x3c')],{'$or':_[_0xd743('0x5c')](_0x1d1a13[_0xd743('0x36')],function(_0x10b3c8){var _0x390cb2={};_0x390cb2[_0x10b3c8]={'$like':'%'+_0x492306[_0xd743('0x30')][_0xd743('0x3d')]+'%'};return _0x390cb2;})});}_0x1d1a13=_[_0xd743('0x48')]({},_0x1d1a13,_0x492306[_0xd743('0x40')]);return _0x581c8e['getAgents'](_0x1d1a13);}})[_0xd743('0x26')](function(_0x1bc40b){if(_0x1bc40b){_0x3a8ac9=_0x1bc40b['length'];if(!_0x492306[_0xd743('0x30')][_0xd743('0x38')](_0xd743('0x66'))){_0x1d1a13['limit']=qs[_0xd743('0x39')](_0x492306[_0xd743('0x30')][_0xd743('0x39')]);_0x1d1a13[_0xd743('0x23')]=qs[_0xd743('0x23')](_0x492306[_0xd743('0x30')][_0xd743('0x23')]);}return _0x581c8e['getAgents'](_0x1d1a13);}})[_0xd743('0x26')](function(_0x25ba3a){if(_0x25ba3a){return _0x25ba3a?{'count':_0x3a8ac9,'rows':_0x25ba3a}:null;}})[_0xd743('0x26')](respondWithResult(_0x2bce78,null))[_0xd743('0x45')](handleError(_0x2bce78,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index f7bc8d8..18bd599 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 _0xfb6f=['hook','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x520a0d,_0x2f27d2){var _0xc48f14=function(_0x5b97da){while(--_0x5b97da){_0x520a0d['push'](_0x520a0d['shift']());}};_0xc48f14(++_0x2f27d2);}(_0xfb6f,0xe9));var _0xffb6=function(_0x53f893,_0xea4207){_0x53f893=_0x53f893-0x0;var _0x3dc4e9=_0xfb6f[_0x53f893];return _0x3dc4e9;};'use strict';var EventEmitter=require(_0xffb6('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xffb6('0x1')](0x0);var events={'afterCreate':_0xffb6('0x2'),'afterUpdate':_0xffb6('0x3'),'afterDestroy':_0xffb6('0x4')};function emitEvent(_0x44ba5c){return function(_0x4dafc2,_0x3c3c91,_0x47be84){WhatsappQueueEvents[_0xffb6('0x5')](_0x44ba5c+':'+_0x4dafc2['id'],_0x4dafc2);WhatsappQueueEvents['emit'](_0x44ba5c,_0x4dafc2);_0x47be84(null);};}for(var e in events){if(events[_0xffb6('0x6')](e)){var event=events[e];WhatsappQueue[_0xffb6('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xbfca=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xbfca,0x1a0));var _0xabfc=function(_0x1b9bc2,_0x15952b){_0x1b9bc2=_0x1b9bc2-0x0;var _0x3ee566=_0xbfca[_0x1b9bc2];return _0x3ee566;};'use strict';var EventEmitter=require(_0xabfc('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xabfc('0x1')](0x0);var events={'afterCreate':_0xabfc('0x2'),'afterUpdate':_0xabfc('0x3'),'afterDestroy':_0xabfc('0x4')};function emitEvent(_0x3fe4b9){return function(_0x4f3eff,_0x56328f,_0x4711b4){WhatsappQueueEvents[_0xabfc('0x5')](_0x3fe4b9+':'+_0x4f3eff['id'],_0x4f3eff);WhatsappQueueEvents[_0xabfc('0x5')](_0x3fe4b9,_0x4f3eff);_0x4711b4(null);};}for(var e in events){if(events[_0xabfc('0x6')](e)){var event=events[e];WhatsappQueue[_0xabfc('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 7001078..ed43b9b 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 _0xde42=['moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','util','../../config/logger'];(function(_0x5723bd,_0x166035){var _0x5d7909=function(_0x4e815f){while(--_0x4e815f){_0x5723bd['push'](_0x5723bd['shift']());}};_0x5d7909(++_0x166035);}(_0xde42,0x1c5));var _0x2de4=function(_0x3ccdb0,_0x4adc30){_0x3ccdb0=_0x3ccdb0-0x0;var _0x58aa5b=_0xde42[_0x3ccdb0];return _0x58aa5b;};'use strict';var _=require(_0x2de4('0x0'));var util=require(_0x2de4('0x1'));var logger=require(_0x2de4('0x2'))('api');var moment=require(_0x2de4('0x3'));var BPromise=require(_0x2de4('0x4'));var rp=require(_0x2de4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2de4('0x6'));var config=require(_0x2de4('0x7'));var attributes=require(_0x2de4('0x8'));module[_0x2de4('0x9')]=function(_0x9b97f4,_0x3728aa){return _0x9b97f4[_0x2de4('0xa')]('WhatsappQueue',attributes,{'tableName':_0x2de4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe43=['define','WhatsappQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0x55ffc8,_0x30aa4e){var _0x58d83d=function(_0x2d7e6e){while(--_0x2d7e6e){_0x55ffc8['push'](_0x55ffc8['shift']());}};_0x58d83d(++_0x30aa4e);}(_0xbe43,0x174));var _0x3be4=function(_0x554e26,_0x54b5d1){_0x554e26=_0x554e26-0x0;var _0x18fdc9=_0xbe43[_0x554e26];return _0x18fdc9;};'use strict';var _=require('lodash');var util=require(_0x3be4('0x0'));var logger=require(_0x3be4('0x1'))(_0x3be4('0x2'));var moment=require(_0x3be4('0x3'));var BPromise=require(_0x3be4('0x4'));var rp=require(_0x3be4('0x5'));var fs=require('fs');var path=require(_0x3be4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x3be4('0x7')]=function(_0x6dc5c5,_0x4e19a1){return _0x6dc5c5[_0x3be4('0x8')](_0x3be4('0x9'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index e1bdac0..cbe2d89 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 _0xe40f=['options','raw','include','model','attributes','map','then','debug','find','where','ShowWhatsappQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe40f,0x1d3));var _0xfe40=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe40f[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfe40('0x0'));var BPromise=require(_0xfe40('0x1'));var rs=require(_0xfe40('0x2'));var fs=require('fs');var Redis=require(_0xfe40('0x3'));var db=require(_0xfe40('0x4'))['db'];var utils=require(_0xfe40('0x5'));var logger=require('../../config/logger')(_0xfe40('0x6'));var config=require(_0xfe40('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfe40('0x8')]({'port':0x232a});config[_0xfe40('0x9')]=_[_0xfe40('0xa')](config[_0xfe40('0x9')],{'host':_0xfe40('0xb'),'port':0x18eb});var socket=require(_0xfe40('0xc'))(new Redis(config['redis']));require(_0xfe40('0xd'))[_0xfe40('0xe')](socket);function respondWithRpcPromise(_0x35745d,_0x22ecb3,_0x5cd968){return new BPromise(function(_0x51c577,_0x4922c2){return client['request'](_0x35745d,_0x5cd968)['then'](function(_0x30c9c3){logger[_0xfe40('0xf')](_0xfe40('0x10'),_0x22ecb3,_0xfe40('0x11'));logger['debug'](_0xfe40('0x12'),_0x22ecb3,_0xfe40('0x11'),JSON[_0xfe40('0x13')](_0x30c9c3));if(_0x30c9c3[_0xfe40('0x14')]){if(_0x30c9c3[_0xfe40('0x14')][_0xfe40('0x15')]===0x1f4){logger[_0xfe40('0x14')](_0xfe40('0x10'),_0x22ecb3,_0x30c9c3['error'][_0xfe40('0x16')]);return _0x4922c2(_0x30c9c3[_0xfe40('0x14')][_0xfe40('0x16')]);}logger[_0xfe40('0x14')](_0xfe40('0x10'),_0x22ecb3,_0x30c9c3[_0xfe40('0x14')][_0xfe40('0x16')]);return _0x51c577(_0x30c9c3[_0xfe40('0x14')]['message']);}else{logger[_0xfe40('0xf')](_0xfe40('0x10'),_0x22ecb3,_0xfe40('0x11'));_0x51c577(_0x30c9c3[_0xfe40('0x17')][_0xfe40('0x16')]);}})[_0xfe40('0x18')](function(_0x5d4a1f){logger[_0xfe40('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x22ecb3,_0x5d4a1f);_0x4922c2(_0x5d4a1f);});});}exports[_0xfe40('0x19')]=function(_0xa0bf0c){var _0x4afb3c=this;return new Promise(function(_0x48b951,_0x509364){return db['WhatsappQueue'][_0xfe40('0x1a')]({'raw':_0xa0bf0c['options']?_0xa0bf0c[_0xfe40('0x1b')][_0xfe40('0x1c')]===undefined?!![]:![]:!![],'where':_0xa0bf0c['options']?_0xa0bf0c[_0xfe40('0x1b')]['where']||null:null,'attributes':_0xa0bf0c[_0xfe40('0x1b')]?_0xa0bf0c[_0xfe40('0x1b')]['attributes']||null:null,'limit':_0xa0bf0c[_0xfe40('0x1b')]?_0xa0bf0c[_0xfe40('0x1b')]['limit']||null:null,'include':_0xa0bf0c[_0xfe40('0x1b')]?_0xa0bf0c[_0xfe40('0x1b')][_0xfe40('0x1d')]?_['map'](_0xa0bf0c[_0xfe40('0x1b')]['include'],function(_0x1788be){return{'model':db[_0x1788be[_0xfe40('0x1e')]],'as':_0x1788be['as'],'attributes':_0x1788be[_0xfe40('0x1f')],'include':_0x1788be['include']?_['map'](_0x1788be['include'],function(_0x307e75){return{'model':db[_0x307e75['model']],'as':_0x307e75['as'],'attributes':_0x307e75[_0xfe40('0x1f')],'include':_0x307e75[_0xfe40('0x1d')]?_[_0xfe40('0x20')](_0x307e75[_0xfe40('0x1d')],function(_0x3989fd){return{'model':db[_0x3989fd[_0xfe40('0x1e')]],'as':_0x3989fd['as'],'attributes':_0x3989fd[_0xfe40('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfe40('0x21')](function(_0x4edfd7){logger[_0xfe40('0xf')](_0xfe40('0x19'),_0xa0bf0c);logger[_0xfe40('0x22')](_0xfe40('0x19'),_0xa0bf0c,JSON[_0xfe40('0x13')](_0x4edfd7));_0x48b951(_0x4edfd7);})['catch'](function(_0x5ab377){logger[_0xfe40('0x14')](_0xfe40('0x19'),_0x5ab377[_0xfe40('0x16')],_0xa0bf0c);_0x509364(_0x4afb3c[_0xfe40('0x14')](0x1f4,_0x5ab377[_0xfe40('0x16')]));});});};exports['ShowWhatsappQueue']=function(_0x1cfe65){var _0x1dbc72=this;return new Promise(function(_0x39fe,_0x161ca5){return db['WhatsappQueue'][_0xfe40('0x23')]({'raw':_0x1cfe65[_0xfe40('0x1b')]?_0x1cfe65[_0xfe40('0x1b')][_0xfe40('0x1c')]===undefined?!![]:![]:!![],'where':_0x1cfe65['options']?_0x1cfe65[_0xfe40('0x1b')][_0xfe40('0x24')]||null:null,'attributes':_0x1cfe65['options']?_0x1cfe65['options']['attributes']||null:null,'include':_0x1cfe65[_0xfe40('0x1b')]?_0x1cfe65[_0xfe40('0x1b')][_0xfe40('0x1d')]?_[_0xfe40('0x20')](_0x1cfe65[_0xfe40('0x1b')][_0xfe40('0x1d')],function(_0x6507f3){return{'model':db[_0x6507f3['model']],'as':_0x6507f3['as'],'attributes':_0x6507f3[_0xfe40('0x1f')],'include':_0x6507f3[_0xfe40('0x1d')]?_[_0xfe40('0x20')](_0x6507f3[_0xfe40('0x1d')],function(_0xb05dfb){return{'model':db[_0xb05dfb[_0xfe40('0x1e')]],'as':_0xb05dfb['as'],'attributes':_0xb05dfb[_0xfe40('0x1f')],'include':_0xb05dfb['include']?_[_0xfe40('0x20')](_0xb05dfb[_0xfe40('0x1d')],function(_0x3e99e6){return{'model':db[_0x3e99e6['model']],'as':_0x3e99e6['as'],'attributes':_0x3e99e6[_0xfe40('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4836c4){logger['info']('ShowWhatsappQueue',_0x1cfe65);logger[_0xfe40('0x22')](_0xfe40('0x25'),_0x1cfe65,JSON[_0xfe40('0x13')](_0x4836c4));_0x39fe(_0x4836c4);})['catch'](function(_0x1ffee8){logger[_0xfe40('0x14')](_0xfe40('0x25'),_0x1ffee8['message'],_0x1cfe65);_0x161ca5(_0x1dbc72['error'](0x1f4,_0x1ffee8[_0xfe40('0x16')]));});});}; \ No newline at end of file +var _0xdfa1=['rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','WhatsappQueue,\x20%s,\x20%s','result','catch','GetWhatsappQueue','raw','options','attributes','limit','map','model','include','then','ShowWhatsappQueue','WhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0xdfa1,0x161));var _0x1dfa=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xdfa1[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x1dfa('0x0'));var util=require(_0x1dfa('0x1'));var moment=require(_0x1dfa('0x2'));var BPromise=require(_0x1dfa('0x3'));var rs=require(_0x1dfa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dfa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1dfa('0x6'))(_0x1dfa('0x7'));var config=require(_0x1dfa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1dfa('0x9')][_0x1dfa('0xa')]({'port':0x232a});config[_0x1dfa('0xb')]=_['defaults'](config[_0x1dfa('0xb')],{'host':_0x1dfa('0xc'),'port':0x18eb});var socket=require(_0x1dfa('0xd'))(new Redis(config[_0x1dfa('0xb')]));require(_0x1dfa('0xe'))[_0x1dfa('0xf')](socket);function respondWithRpcPromise(_0x48df8c,_0x43c097,_0x3182aa){return new BPromise(function(_0x53b068,_0x1dd611){return client[_0x1dfa('0x10')](_0x48df8c,_0x3182aa)['then'](function(_0x8ae84a){logger[_0x1dfa('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x43c097,'request\x20sent');logger[_0x1dfa('0x12')](_0x1dfa('0x13'),_0x43c097,_0x1dfa('0x14'),JSON[_0x1dfa('0x15')](_0x8ae84a));if(_0x8ae84a['error']){if(_0x8ae84a[_0x1dfa('0x16')]['code']===0x1f4){logger[_0x1dfa('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x43c097,_0x8ae84a[_0x1dfa('0x16')][_0x1dfa('0x17')]);return _0x1dd611(_0x8ae84a[_0x1dfa('0x16')][_0x1dfa('0x17')]);}logger[_0x1dfa('0x16')](_0x1dfa('0x18'),_0x43c097,_0x8ae84a[_0x1dfa('0x16')][_0x1dfa('0x17')]);return _0x53b068(_0x8ae84a[_0x1dfa('0x16')][_0x1dfa('0x17')]);}else{logger[_0x1dfa('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x43c097,_0x1dfa('0x14'));_0x53b068(_0x8ae84a[_0x1dfa('0x19')][_0x1dfa('0x17')]);}})[_0x1dfa('0x1a')](function(_0x13e16c){logger[_0x1dfa('0x16')](_0x1dfa('0x18'),_0x43c097,_0x13e16c);_0x1dd611(_0x13e16c);});});}exports[_0x1dfa('0x1b')]=function(_0x4dd0c9){var _0x4f0304=this;return new Promise(function(_0x241287,_0x256c5f){return db['WhatsappQueue']['findAll']({'raw':_0x4dd0c9['options']?_0x4dd0c9['options'][_0x1dfa('0x1c')]===undefined?!![]:![]:!![],'where':_0x4dd0c9['options']?_0x4dd0c9[_0x1dfa('0x1d')]['where']||null:null,'attributes':_0x4dd0c9['options']?_0x4dd0c9[_0x1dfa('0x1d')][_0x1dfa('0x1e')]||null:null,'limit':_0x4dd0c9[_0x1dfa('0x1d')]?_0x4dd0c9[_0x1dfa('0x1d')][_0x1dfa('0x1f')]||null:null,'include':_0x4dd0c9[_0x1dfa('0x1d')]?_0x4dd0c9['options']['include']?_[_0x1dfa('0x20')](_0x4dd0c9['options']['include'],function(_0x47172c){return{'model':db[_0x47172c[_0x1dfa('0x21')]],'as':_0x47172c['as'],'attributes':_0x47172c['attributes'],'include':_0x47172c[_0x1dfa('0x22')]?_['map'](_0x47172c['include'],function(_0x971421){return{'model':db[_0x971421['model']],'as':_0x971421['as'],'attributes':_0x971421[_0x1dfa('0x1e')],'include':_0x971421[_0x1dfa('0x22')]?_['map'](_0x971421[_0x1dfa('0x22')],function(_0x2d1ca9){return{'model':db[_0x2d1ca9[_0x1dfa('0x21')]],'as':_0x2d1ca9['as'],'attributes':_0x2d1ca9['attributes']};}):[]};}):[]};}):[]:[]})[_0x1dfa('0x23')](function(_0xcc8aa5){logger['info'](_0x1dfa('0x1b'),_0x4dd0c9);logger[_0x1dfa('0x12')](_0x1dfa('0x1b'),_0x4dd0c9,JSON[_0x1dfa('0x15')](_0xcc8aa5));_0x241287(_0xcc8aa5);})['catch'](function(_0x889db9){logger[_0x1dfa('0x16')](_0x1dfa('0x1b'),_0x889db9[_0x1dfa('0x17')],_0x4dd0c9);_0x256c5f(_0x4f0304['error'](0x1f4,_0x889db9[_0x1dfa('0x17')]));});});};exports[_0x1dfa('0x24')]=function(_0xd55104){var _0x173a9e=this;return new Promise(function(_0x52879c,_0x58e9aa){return db[_0x1dfa('0x25')][_0x1dfa('0x26')]({'raw':_0xd55104[_0x1dfa('0x1d')]?_0xd55104['options'][_0x1dfa('0x1c')]===undefined?!![]:![]:!![],'where':_0xd55104[_0x1dfa('0x1d')]?_0xd55104[_0x1dfa('0x1d')][_0x1dfa('0x27')]||null:null,'attributes':_0xd55104['options']?_0xd55104['options']['attributes']||null:null,'include':_0xd55104[_0x1dfa('0x1d')]?_0xd55104[_0x1dfa('0x1d')][_0x1dfa('0x22')]?_['map'](_0xd55104[_0x1dfa('0x1d')][_0x1dfa('0x22')],function(_0x369168){return{'model':db[_0x369168[_0x1dfa('0x21')]],'as':_0x369168['as'],'attributes':_0x369168[_0x1dfa('0x1e')],'include':_0x369168[_0x1dfa('0x22')]?_['map'](_0x369168[_0x1dfa('0x22')],function(_0x394b30){return{'model':db[_0x394b30['model']],'as':_0x394b30['as'],'attributes':_0x394b30['attributes'],'include':_0x394b30[_0x1dfa('0x22')]?_[_0x1dfa('0x20')](_0x394b30[_0x1dfa('0x22')],function(_0x549f31){return{'model':db[_0x549f31['model']],'as':_0x549f31['as'],'attributes':_0x549f31['attributes']};}):[]};}):[]};}):[]:[]})[_0x1dfa('0x23')](function(_0x287c9d){logger['info']('ShowWhatsappQueue',_0xd55104);logger[_0x1dfa('0x12')](_0x1dfa('0x24'),_0xd55104,JSON[_0x1dfa('0x15')](_0x287c9d));_0x52879c(_0x287c9d);})[_0x1dfa('0x1a')](function(_0x36f37d){logger[_0x1dfa('0x16')](_0x1dfa('0x24'),_0x36f37d[_0x1dfa('0x17')],_0xd55104);_0x58e9aa(_0x173a9e[_0x1dfa('0x16')](0x1f4,_0x36f37d[_0x1dfa('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 9d9e31b..fb4a1cf 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 _0x3f29=['whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener','length'];(function(_0x2c39bb,_0x25a3f3){var _0x2ffe42=function(_0x119580){while(--_0x119580){_0x2c39bb['push'](_0x2c39bb['shift']());}};_0x2ffe42(++_0x25a3f3);}(_0x3f29,0x119));var _0x93f2=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3f29[_0x3947c9];return _0x2e7871;};'use strict';var WhatsappQueueEvents=require(_0x93f2('0x0'));var events=[_0x93f2('0x1'),_0x93f2('0x2'),_0x93f2('0x3')];function createListener(_0x4ae7d4,_0x1ec827){return function(_0x437157){_0x1ec827[_0x93f2('0x4')](_0x4ae7d4,_0x437157);};}function removeListener(_0xf329f6,_0x140e4f){return function(){WhatsappQueueEvents[_0x93f2('0x5')](_0xf329f6,_0x140e4f);};}exports['register']=function(_0x3d614d){for(var _0x52ba14=0x0,_0x3a3655=events[_0x93f2('0x6')];_0x52ba14<_0x3a3655;_0x52ba14++){var _0x205eab=events[_0x52ba14];var _0x1add16=createListener(_0x93f2('0x7')+_0x205eab,_0x3d614d);WhatsappQueueEvents['on'](_0x205eab,_0x1add16);}}; \ No newline at end of file +var _0x4cdd=['whatsappQueue:','./whatsappQueue.events','save','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4cdd,0x1a5));var _0xd4cd=function(_0x132d06,_0x314aad){_0x132d06=_0x132d06-0x0;var _0x3490a4=_0x4cdd[_0x132d06];return _0x3490a4;};'use strict';var WhatsappQueueEvents=require(_0xd4cd('0x0'));var events=[_0xd4cd('0x1'),'remove','update'];function createListener(_0xbbbcd6,_0x29caca){return function(_0x22e410){_0x29caca[_0xd4cd('0x2')](_0xbbbcd6,_0x22e410);};}function removeListener(_0x3ca9af,_0x22249a){return function(){WhatsappQueueEvents[_0xd4cd('0x3')](_0x3ca9af,_0x22249a);};}exports['register']=function(_0x480dbc){for(var _0x558d53=0x0,_0x3c3065=events['length'];_0x558d53<_0x3c3065;_0x558d53++){var _0x24db75=events[_0x558d53];var _0x4a0e74=createListener(_0xd4cd('0x4')+_0x24db75,_0x480dbc);WhatsappQueueEvents['on'](_0x24db75,_0x4a0e74);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 556dbed..dcae6b1 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 _0x2613=['../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x242eb0,_0x3bb8a0){var _0x3c60e8=function(_0x1c5df8){while(--_0x1c5df8){_0x242eb0['push'](_0x242eb0['shift']());}};_0x3c60e8(++_0x3bb8a0);}(_0x2613,0xc0));var _0x3261=function(_0x401a4d,_0x4bb835){_0x401a4d=_0x401a4d-0x0;var _0x1faaff=_0x2613[_0x401a4d];return _0x1faaff;};'use strict';var multer=require('multer');var util=require(_0x3261('0x0'));var path=require(_0x3261('0x1'));var timeout=require(_0x3261('0x2'));var express=require(_0x3261('0x3'));var router=express[_0x3261('0x4')]();var auth=require(_0x3261('0x5'));var interaction=require(_0x3261('0x6'));var config=require(_0x3261('0x7'));var controller=require(_0x3261('0x8'));router[_0x3261('0x9')]('/',auth[_0x3261('0xa')](),controller[_0x3261('0xb')]);router['get'](_0x3261('0xc'),auth[_0x3261('0xa')](),controller[_0x3261('0xd')]);router[_0x3261('0x9')](_0x3261('0xe'),auth[_0x3261('0xa')](),controller[_0x3261('0xf')]);router['post']('/',auth[_0x3261('0xa')](),controller[_0x3261('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3261('0xe'),auth[_0x3261('0xa')](),controller['destroy']);module[_0x3261('0x11')]=router; \ No newline at end of file +var _0xb6a1=['./whatsappQueueReport.controller','isAuthenticated','index','get','/:id','post','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x48ec4c,_0x543fbb){var _0x43cfc1=function(_0xa3830b){while(--_0xa3830b){_0x48ec4c['push'](_0x48ec4c['shift']());}};_0x43cfc1(++_0x543fbb);}(_0xb6a1,0x14d));var _0x1b6a=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb6a1[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x1b6a('0x0'));var util=require(_0x1b6a('0x1'));var path=require(_0x1b6a('0x2'));var timeout=require(_0x1b6a('0x3'));var express=require('express');var router=express[_0x1b6a('0x4')]();var auth=require(_0x1b6a('0x5'));var interaction=require(_0x1b6a('0x6'));var config=require('../../config/environment');var controller=require(_0x1b6a('0x7'));router['get']('/',auth[_0x1b6a('0x8')](),controller[_0x1b6a('0x9')]);router[_0x1b6a('0xa')]('/describe',auth[_0x1b6a('0x8')](),controller['describe']);router[_0x1b6a('0xa')](_0x1b6a('0xb'),auth[_0x1b6a('0x8')](),controller['show']);router[_0x1b6a('0xc')]('/',auth[_0x1b6a('0x8')](),controller['create']);router['put'](_0x1b6a('0xb'),auth['isAuthenticated'](),controller[_0x1b6a('0xd')]);router[_0x1b6a('0xe')](_0x1b6a('0xb'),auth['isAuthenticated'](),controller[_0x1b6a('0xf')]);module[_0x1b6a('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 10a0152..b6bcc50 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 _0x008c=['sequelize','exports','STRING','DATE'];(function(_0x495509,_0x36cc6c){var _0x13d387=function(_0x48ad1d){while(--_0x48ad1d){_0x495509['push'](_0x495509['shift']());}};_0x13d387(++_0x36cc6c);}(_0x008c,0x188));var _0xc008=function(_0x4a055e,_0x59b80a){_0x4a055e=_0x4a055e-0x0;var _0x328a29=_0x008c[_0x4a055e];return _0x328a29;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'uniqueid':{'type':Sequelize[_0xc008('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc008('0x2')]},'joinAt':{'type':Sequelize[_0xc008('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc008('0x3')]},'exitAt':{'type':Sequelize[_0xc008('0x3')]},'reason':{'type':Sequelize[_0xc008('0x2')]}}; \ No newline at end of file +var _0xf3cd=['STRING','DATE','sequelize','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x74745d,_0x177606){_0x74745d=_0x74745d-0x0;var _0x174ab3=_0xf3cd[_0x74745d];return _0x174ab3;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf3c('0x2')]},'joinAt':{'type':Sequelize[_0xdf3c('0x3')]},'leaveAt':{'type':Sequelize[_0xdf3c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdf3c('0x3')]},'reason':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 2a24b37..9c2f176 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 _0x98bf=['find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','query','keys','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body'];(function(_0x2ec379,_0xe61b19){var _0x4d2207=function(_0x1dfcce){while(--_0x1dfcce){_0x2ec379['push'](_0x2ec379['shift']());}};_0x4d2207(++_0xe61b19);}(_0x98bf,0x142));var _0xf98b=function(_0x3bae28,_0x5ca4f5){_0x3bae28=_0x3bae28-0x0;var _0xb431b=_0x98bf[_0x3bae28];return _0xb431b;};'use strict';var pdf=require(_0xf98b('0x0'));var emlformat=require(_0xf98b('0x1'));var rimraf=require(_0xf98b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf98b('0x3'));var rp=require(_0xf98b('0x4'));var moment=require(_0xf98b('0x5'));var BPromise=require(_0xf98b('0x6'));var Mustache=require(_0xf98b('0x7'));var util=require(_0xf98b('0x8'));var path=require(_0xf98b('0x9'));var sox=require(_0xf98b('0xa'));var csv=require(_0xf98b('0xb'));var ejs=require(_0xf98b('0xc'));var fs=require('fs');var _=require(_0xf98b('0xd'));var squel=require('squel');var crypto=require(_0xf98b('0xe'));var jsforce=require(_0xf98b('0xf'));var deskjs=require(_0xf98b('0x10'));var toCsv=require(_0xf98b('0xb'));var querystring=require(_0xf98b('0x11'));var Papa=require(_0xf98b('0x12'));var Redis=require(_0xf98b('0x13'));var authService=require(_0xf98b('0x14'));var qs=require(_0xf98b('0x15'));var as=require(_0xf98b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf98b('0x17'))('api');var utils=require(_0xf98b('0x18'));var config=require(_0xf98b('0x19'));var licenseUtil=require(_0xf98b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15d41a,_0x10d851){_0x10d851=_0x10d851||0xcc;return function(_0x3f5a7d){if(_0x3f5a7d){return _0x15d41a[_0xf98b('0x1b')](_0x10d851);}return _0x15d41a[_0xf98b('0x1c')](_0x10d851)['end']();};}function respondWithResult(_0x383284,_0x18e9fb){_0x18e9fb=_0x18e9fb||0xc8;return function(_0x2b9782){if(_0x2b9782){return _0x383284[_0xf98b('0x1c')](_0x18e9fb)[_0xf98b('0x1d')](_0x2b9782);}};}function respondWithFilteredResult(_0x109719,_0x355091){return function(_0x5dcf61){if(_0x5dcf61){var _0x5638cf=_0x5dcf61[_0xf98b('0x1e')],_0x14eed9=_0x355091[_0xf98b('0x1f')],_0xf0d3da=_0x355091['offset']+_0x355091[_0xf98b('0x20')],_0x184137;if(_0xf0d3da>=_0x5638cf){_0xf0d3da=_0x5638cf;_0x184137=0xc8;}else{_0x184137=0xce;}_0x109719[_0xf98b('0x1c')](_0x184137);return _0x109719[_0xf98b('0x21')](_0xf98b('0x22'),_0x14eed9+'-'+_0xf0d3da+'/'+_0x5638cf)[_0xf98b('0x1d')](_0x5dcf61);}return null;};}function patchUpdates(_0x2d821e){return function(_0xada3b1){try{jsonpatch[_0xf98b('0x23')](_0xada3b1,_0x2d821e,!![]);}catch(_0x2443ca){return BPromise[_0xf98b('0x24')](_0x2443ca);}return _0xada3b1[_0xf98b('0x25')]();};}function saveUpdates(_0x3b844f,_0x2bff84){return function(_0x19f4a2){if(_0x19f4a2){return _0x19f4a2[_0xf98b('0x26')](_0x3b844f)[_0xf98b('0x27')](function(_0x3d8aaf){return _0x3d8aaf;});}return null;};}function removeEntity(_0x38b83d,_0x3670fc){return function(_0x37b087){if(_0x37b087){return _0x37b087[_0xf98b('0x28')]()['then'](function(){_0x38b83d[_0xf98b('0x1c')](0xcc)[_0xf98b('0x29')]();});}};}function handleEntityNotFound(_0x3eda96,_0x7a9555){return function(_0x1ffde1){if(!_0x1ffde1){_0x3eda96[_0xf98b('0x1b')](0x194);}return _0x1ffde1;};}function handleError(_0x2b2afc,_0x12cb24){_0x12cb24=_0x12cb24||0x1f4;return function(_0x468855){logger[_0xf98b('0x2a')](_0x468855[_0xf98b('0x2b')]);if(_0x468855['name']){delete _0x468855[_0xf98b('0x2c')];}_0x2b2afc[_0xf98b('0x1c')](_0x12cb24)['send'](_0x468855);};}exports[_0xf98b('0x2d')]=function(_0x3b81cf,_0x308a98){var _0x1b8feb={},_0x282996={},_0x29840f={'count':0x0,'rows':[]};var _0x48c6ff=_[_0xf98b('0x2e')](db[_0xf98b('0x2f')][_0xf98b('0x30')],function(_0x19fdad){return{'name':_0x19fdad[_0xf98b('0x31')],'type':_0x19fdad[_0xf98b('0x32')][_0xf98b('0x33')]};});_0x282996['model']=_['map'](_0x48c6ff,'name');_0x282996[_0xf98b('0x34')]=_[_0xf98b('0x35')](_0x3b81cf[_0xf98b('0x34')]);_0x282996['filters']=_[_0xf98b('0x36')](_0x282996['model'],_0x282996[_0xf98b('0x34')]);_0x1b8feb['attributes']=_[_0xf98b('0x36')](_0x282996['model'],qs[_0xf98b('0x37')](_0x3b81cf[_0xf98b('0x34')]['fields']));_0x1b8feb[_0xf98b('0x38')]=_0x1b8feb[_0xf98b('0x38')][_0xf98b('0x39')]?_0x1b8feb[_0xf98b('0x38')]:_0x282996[_0xf98b('0x3a')];if(!_0x3b81cf['query'][_0xf98b('0x3b')]('nolimit')){_0x1b8feb[_0xf98b('0x20')]=qs['limit'](_0x3b81cf[_0xf98b('0x34')][_0xf98b('0x20')]);_0x1b8feb['offset']=qs[_0xf98b('0x1f')](_0x3b81cf[_0xf98b('0x34')]['offset']);}_0x1b8feb[_0xf98b('0x3c')]=qs[_0xf98b('0x3d')](_0x3b81cf[_0xf98b('0x34')][_0xf98b('0x3d')]);_0x1b8feb[_0xf98b('0x3e')]=qs[_0xf98b('0x3f')](_[_0xf98b('0x40')](_0x3b81cf[_0xf98b('0x34')],_0x282996[_0xf98b('0x3f')]),_0x48c6ff);if(_0x3b81cf[_0xf98b('0x34')][_0xf98b('0x41')]){_0x1b8feb['where']=_[_0xf98b('0x42')](_0x1b8feb[_0xf98b('0x3e')],{'$or':_['map'](_0x48c6ff,function(_0x4762eb){if(_0x4762eb[_0xf98b('0x32')]!==_0xf98b('0x43')){var _0x1b7589={};_0x1b7589[_0x4762eb[_0xf98b('0x2c')]]={'$like':'%'+_0x3b81cf[_0xf98b('0x34')][_0xf98b('0x41')]+'%'};return _0x1b7589;}})});}_0x1b8feb=_[_0xf98b('0x42')]({},_0x1b8feb,_0x3b81cf[_0xf98b('0x44')]);var _0x48d43a={'where':_0x1b8feb[_0xf98b('0x3e')]};return db[_0xf98b('0x2f')][_0xf98b('0x1e')](_0x48d43a)['then'](function(_0x5c94a7){_0x29840f[_0xf98b('0x1e')]=_0x5c94a7;if(_0x3b81cf['query'][_0xf98b('0x45')]){_0x1b8feb[_0xf98b('0x46')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xf98b('0x47')](_0x1b8feb);})['then'](function(_0x3cbc91){_0x29840f[_0xf98b('0x48')]=_0x3cbc91;return _0x29840f;})[_0xf98b('0x27')](respondWithFilteredResult(_0x308a98,_0x1b8feb))[_0xf98b('0x49')](handleError(_0x308a98,null));};exports[_0xf98b('0x4a')]=function(_0x386b76,_0x2037af){var _0x4eeb71={'raw':!![],'where':{'id':_0x386b76[_0xf98b('0x4b')]['id']}},_0x34eb98={};_0x34eb98[_0xf98b('0x3a')]=_['keys'](db[_0xf98b('0x2f')][_0xf98b('0x30')]);_0x34eb98[_0xf98b('0x34')]=_[_0xf98b('0x35')](_0x386b76[_0xf98b('0x34')]);_0x34eb98['filters']=_[_0xf98b('0x36')](_0x34eb98[_0xf98b('0x3a')],_0x34eb98[_0xf98b('0x34')]);_0x4eeb71[_0xf98b('0x38')]=_[_0xf98b('0x36')](_0x34eb98['model'],qs['fields'](_0x386b76[_0xf98b('0x34')][_0xf98b('0x37')]));_0x4eeb71[_0xf98b('0x38')]=_0x4eeb71['attributes'][_0xf98b('0x39')]?_0x4eeb71['attributes']:_0x34eb98['model'];if(_0x386b76['query'][_0xf98b('0x45')]){_0x4eeb71[_0xf98b('0x46')]=[{'all':!![]}];}_0x4eeb71=_[_0xf98b('0x42')]({},_0x4eeb71,_0x386b76[_0xf98b('0x44')]);return db[_0xf98b('0x2f')]['find'](_0x4eeb71)[_0xf98b('0x27')](handleEntityNotFound(_0x2037af,null))['then'](respondWithResult(_0x2037af,null))['catch'](handleError(_0x2037af,null));};exports['create']=function(_0x523f3e,_0x2b56c6){return db[_0xf98b('0x2f')][_0xf98b('0x4c')](_0x523f3e[_0xf98b('0x4d')],{})['then'](respondWithResult(_0x2b56c6,0xc9))[_0xf98b('0x49')](handleError(_0x2b56c6,null));};exports[_0xf98b('0x26')]=function(_0x204a29,_0x14820f){if(_0x204a29['body']['id']){delete _0x204a29[_0xf98b('0x4d')]['id'];}return db[_0xf98b('0x2f')][_0xf98b('0x4e')]({'where':{'id':_0x204a29[_0xf98b('0x4b')]['id']}})[_0xf98b('0x27')](handleEntityNotFound(_0x14820f,null))[_0xf98b('0x27')](saveUpdates(_0x204a29[_0xf98b('0x4d')],null))[_0xf98b('0x27')](respondWithResult(_0x14820f,null))['catch'](handleError(_0x14820f,null));};exports[_0xf98b('0x28')]=function(_0x233b8e,_0x4752e8){return db[_0xf98b('0x2f')]['find']({'where':{'id':_0x233b8e[_0xf98b('0x4b')]['id']}})[_0xf98b('0x27')](handleEntityNotFound(_0x4752e8,null))[_0xf98b('0x27')](removeEntity(_0x4752e8,null))[_0xf98b('0x49')](handleError(_0x4752e8,null));};exports[_0xf98b('0x4f')]=function(_0x1e86f0,_0x5265f9){return db[_0xf98b('0x2f')]['describe']()['then'](respondWithResult(_0x5265f9,null))[_0xf98b('0x49')](handleError(_0x5265f9,null));}; \ No newline at end of file +var _0x4fed=['options','create','update','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','include'];(function(_0x31fa29,_0x44d9a3){var _0x446a06=function(_0x17ecfc){while(--_0x17ecfc){_0x31fa29['push'](_0x31fa29['shift']());}};_0x446a06(++_0x44d9a3);}(_0x4fed,0x1c8));var _0xd4fe=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x4fed[_0x27beea];return _0x122645;};'use strict';var pdf=require(_0xd4fe('0x0'));var emlformat=require(_0xd4fe('0x1'));var rimraf=require(_0xd4fe('0x2'));var zipdir=require(_0xd4fe('0x3'));var jsonpatch=require(_0xd4fe('0x4'));var rp=require('request-promise');var moment=require(_0xd4fe('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd4fe('0x6'));var util=require(_0xd4fe('0x7'));var path=require(_0xd4fe('0x8'));var sox=require(_0xd4fe('0x9'));var csv=require(_0xd4fe('0xa'));var ejs=require(_0xd4fe('0xb'));var fs=require('fs');var _=require(_0xd4fe('0xc'));var squel=require(_0xd4fe('0xd'));var crypto=require('crypto');var jsforce=require(_0xd4fe('0xe'));var deskjs=require(_0xd4fe('0xf'));var toCsv=require(_0xd4fe('0xa'));var querystring=require(_0xd4fe('0x10'));var Papa=require(_0xd4fe('0x11'));var Redis=require(_0xd4fe('0x12'));var authService=require(_0xd4fe('0x13'));var qs=require(_0xd4fe('0x14'));var as=require(_0xd4fe('0x15'));var hardwareService=require(_0xd4fe('0x16'));var logger=require(_0xd4fe('0x17'))(_0xd4fe('0x18'));var utils=require('../../config/utils');var config=require(_0xd4fe('0x19'));var licenseUtil=require(_0xd4fe('0x1a'));var db=require(_0xd4fe('0x1b'))['db'];function respondWithStatusCode(_0x2a95c8,_0x6c8799){_0x6c8799=_0x6c8799||0xcc;return function(_0x387484){if(_0x387484){return _0x2a95c8[_0xd4fe('0x1c')](_0x6c8799);}return _0x2a95c8[_0xd4fe('0x1d')](_0x6c8799)[_0xd4fe('0x1e')]();};}function respondWithResult(_0x3bc19c,_0x33b49e){_0x33b49e=_0x33b49e||0xc8;return function(_0x346b07){if(_0x346b07){return _0x3bc19c[_0xd4fe('0x1d')](_0x33b49e)[_0xd4fe('0x1f')](_0x346b07);}};}function respondWithFilteredResult(_0x48906b,_0xa45502){return function(_0x419b48){if(_0x419b48){var _0x4a99a6=_0x419b48[_0xd4fe('0x20')],_0x42c1ee=_0xa45502['offset'],_0x3e0898=_0xa45502[_0xd4fe('0x21')]+_0xa45502[_0xd4fe('0x22')],_0x41d7f2;if(_0x3e0898>=_0x4a99a6){_0x3e0898=_0x4a99a6;_0x41d7f2=0xc8;}else{_0x41d7f2=0xce;}_0x48906b[_0xd4fe('0x1d')](_0x41d7f2);return _0x48906b['set']('Content-Range',_0x42c1ee+'-'+_0x3e0898+'/'+_0x4a99a6)[_0xd4fe('0x1f')](_0x419b48);}return null;};}function patchUpdates(_0x1a090c){return function(_0x499c0){try{jsonpatch['apply'](_0x499c0,_0x1a090c,!![]);}catch(_0x4bbc6e){return BPromise[_0xd4fe('0x23')](_0x4bbc6e);}return _0x499c0['save']();};}function saveUpdates(_0x485fa7,_0x39311a){return function(_0x16ea57){if(_0x16ea57){return _0x16ea57['update'](_0x485fa7)[_0xd4fe('0x24')](function(_0x2dd180){return _0x2dd180;});}return null;};}function removeEntity(_0x52abbe,_0x27111e){return function(_0x20c264){if(_0x20c264){return _0x20c264[_0xd4fe('0x25')]()[_0xd4fe('0x24')](function(){_0x52abbe[_0xd4fe('0x1d')](0xcc)[_0xd4fe('0x1e')]();});}};}function handleEntityNotFound(_0x8a0ffd,_0x50ccb3){return function(_0x13ac6e){if(!_0x13ac6e){_0x8a0ffd[_0xd4fe('0x1c')](0x194);}return _0x13ac6e;};}function handleError(_0x5e4de0,_0x3eff27){_0x3eff27=_0x3eff27||0x1f4;return function(_0x3c09c6){logger[_0xd4fe('0x26')](_0x3c09c6[_0xd4fe('0x27')]);if(_0x3c09c6[_0xd4fe('0x28')]){delete _0x3c09c6[_0xd4fe('0x28')];}_0x5e4de0['status'](_0x3eff27)[_0xd4fe('0x29')](_0x3c09c6);};}exports[_0xd4fe('0x2a')]=function(_0x5854a6,_0x400773){var _0x471739={},_0x3e6bb0={},_0x5e4500={'count':0x0,'rows':[]};var _0x5a32c1=_[_0xd4fe('0x2b')](db[_0xd4fe('0x2c')][_0xd4fe('0x2d')],function(_0xf5897f){return{'name':_0xf5897f[_0xd4fe('0x2e')],'type':_0xf5897f['type']['key']};});_0x3e6bb0[_0xd4fe('0x2f')]=_[_0xd4fe('0x2b')](_0x5a32c1,_0xd4fe('0x28'));_0x3e6bb0['query']=_[_0xd4fe('0x30')](_0x5854a6[_0xd4fe('0x31')]);_0x3e6bb0['filters']=_[_0xd4fe('0x32')](_0x3e6bb0[_0xd4fe('0x2f')],_0x3e6bb0[_0xd4fe('0x31')]);_0x471739[_0xd4fe('0x33')]=_['intersection'](_0x3e6bb0[_0xd4fe('0x2f')],qs[_0xd4fe('0x34')](_0x5854a6['query']['fields']));_0x471739['attributes']=_0x471739['attributes']['length']?_0x471739[_0xd4fe('0x33')]:_0x3e6bb0[_0xd4fe('0x2f')];if(!_0x5854a6[_0xd4fe('0x31')][_0xd4fe('0x35')]('nolimit')){_0x471739[_0xd4fe('0x22')]=qs[_0xd4fe('0x22')](_0x5854a6['query'][_0xd4fe('0x22')]);_0x471739['offset']=qs[_0xd4fe('0x21')](_0x5854a6[_0xd4fe('0x31')]['offset']);}_0x471739[_0xd4fe('0x36')]=qs[_0xd4fe('0x37')](_0x5854a6[_0xd4fe('0x31')][_0xd4fe('0x37')]);_0x471739[_0xd4fe('0x38')]=qs['filters'](_[_0xd4fe('0x39')](_0x5854a6['query'],_0x3e6bb0[_0xd4fe('0x3a')]),_0x5a32c1);if(_0x5854a6[_0xd4fe('0x31')][_0xd4fe('0x3b')]){_0x471739[_0xd4fe('0x38')]=_[_0xd4fe('0x3c')](_0x471739[_0xd4fe('0x38')],{'$or':_[_0xd4fe('0x2b')](_0x5a32c1,function(_0x1493d0){if(_0x1493d0[_0xd4fe('0x3d')]!==_0xd4fe('0x3e')){var _0x598998={};_0x598998[_0x1493d0[_0xd4fe('0x28')]]={'$like':'%'+_0x5854a6[_0xd4fe('0x31')][_0xd4fe('0x3b')]+'%'};return _0x598998;}})});}_0x471739=_[_0xd4fe('0x3c')]({},_0x471739,_0x5854a6['options']);var _0x576028={'where':_0x471739['where']};return db[_0xd4fe('0x2c')][_0xd4fe('0x20')](_0x576028)[_0xd4fe('0x24')](function(_0x28c1f0){_0x5e4500[_0xd4fe('0x20')]=_0x28c1f0;if(_0x5854a6[_0xd4fe('0x31')][_0xd4fe('0x3f')]){_0x471739['include']=[{'all':!![]}];}return db[_0xd4fe('0x2c')][_0xd4fe('0x40')](_0x471739);})['then'](function(_0x10f804){_0x5e4500['rows']=_0x10f804;return _0x5e4500;})['then'](respondWithFilteredResult(_0x400773,_0x471739))[_0xd4fe('0x41')](handleError(_0x400773,null));};exports[_0xd4fe('0x42')]=function(_0x5cd355,_0x2c9082){var _0x3a96f9={'raw':!![],'where':{'id':_0x5cd355[_0xd4fe('0x43')]['id']}},_0xd46199={};_0xd46199[_0xd4fe('0x2f')]=_['keys'](db['WhatsappQueueReport'][_0xd4fe('0x2d')]);_0xd46199[_0xd4fe('0x31')]=_[_0xd4fe('0x30')](_0x5cd355[_0xd4fe('0x31')]);_0xd46199[_0xd4fe('0x3a')]=_[_0xd4fe('0x32')](_0xd46199[_0xd4fe('0x2f')],_0xd46199[_0xd4fe('0x31')]);_0x3a96f9['attributes']=_[_0xd4fe('0x32')](_0xd46199[_0xd4fe('0x2f')],qs['fields'](_0x5cd355[_0xd4fe('0x31')]['fields']));_0x3a96f9[_0xd4fe('0x33')]=_0x3a96f9[_0xd4fe('0x33')]['length']?_0x3a96f9[_0xd4fe('0x33')]:_0xd46199[_0xd4fe('0x2f')];if(_0x5cd355[_0xd4fe('0x31')]['includeAll']){_0x3a96f9[_0xd4fe('0x44')]=[{'all':!![]}];}_0x3a96f9=_[_0xd4fe('0x3c')]({},_0x3a96f9,_0x5cd355[_0xd4fe('0x45')]);return db['WhatsappQueueReport']['find'](_0x3a96f9)['then'](handleEntityNotFound(_0x2c9082,null))[_0xd4fe('0x24')](respondWithResult(_0x2c9082,null))[_0xd4fe('0x41')](handleError(_0x2c9082,null));};exports[_0xd4fe('0x46')]=function(_0x5c99c5,_0x5b7620){return db[_0xd4fe('0x2c')][_0xd4fe('0x46')](_0x5c99c5['body'],{})['then'](respondWithResult(_0x5b7620,0xc9))[_0xd4fe('0x41')](handleError(_0x5b7620,null));};exports[_0xd4fe('0x47')]=function(_0x3a6b5d,_0x36b860){if(_0x3a6b5d['body']['id']){delete _0x3a6b5d[_0xd4fe('0x48')]['id'];}return db[_0xd4fe('0x2c')][_0xd4fe('0x49')]({'where':{'id':_0x3a6b5d[_0xd4fe('0x43')]['id']}})[_0xd4fe('0x24')](handleEntityNotFound(_0x36b860,null))[_0xd4fe('0x24')](saveUpdates(_0x3a6b5d[_0xd4fe('0x48')],null))[_0xd4fe('0x24')](respondWithResult(_0x36b860,null))['catch'](handleError(_0x36b860,null));};exports[_0xd4fe('0x25')]=function(_0x385a1e,_0x26da96){return db[_0xd4fe('0x2c')][_0xd4fe('0x49')]({'where':{'id':_0x385a1e['params']['id']}})[_0xd4fe('0x24')](handleEntityNotFound(_0x26da96,null))[_0xd4fe('0x24')](removeEntity(_0x26da96,null))['catch'](handleError(_0x26da96,null));};exports[_0xd4fe('0x4a')]=function(_0x5a4cd6,_0x536669){return db[_0xd4fe('0x2c')][_0xd4fe('0x4a')]()[_0xd4fe('0x24')](respondWithResult(_0x536669,null))['catch'](handleError(_0x536669,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3b2ba00..ae5e0ba 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 _0x6232=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','lodash','util','../../config/logger','moment','bluebird'];(function(_0x59db30,_0x1d6b22){var _0x2e8738=function(_0x1fbf30){while(--_0x1fbf30){_0x59db30['push'](_0x59db30['shift']());}};_0x2e8738(++_0x1d6b22);}(_0x6232,0xb1));var _0x2623=function(_0x6ad87,_0x1cf4cf){_0x6ad87=_0x6ad87-0x0;var _0xad0466=_0x6232[_0x6ad87];return _0xad0466;};'use strict';var _=require(_0x2623('0x0'));var util=require(_0x2623('0x1'));var logger=require(_0x2623('0x2'))('api');var moment=require(_0x2623('0x3'));var BPromise=require(_0x2623('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2623('0x5'));var rimraf=require(_0x2623('0x6'));var config=require(_0x2623('0x7'));var attributes=require(_0x2623('0x8'));module[_0x2623('0x9')]=function(_0x1cc602,_0x2448c8){return _0x1cc602[_0x2623('0xa')](_0x2623('0xb'),attributes,{'tableName':_0x2623('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x445a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x14b635,_0x4f2bae){var _0x3f881e=function(_0x416dfe){while(--_0x416dfe){_0x14b635['push'](_0x14b635['shift']());}};_0x3f881e(++_0x4f2bae);}(_0x445a,0x16a));var _0xa445=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x445a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xa445('0x0'));var util=require('util');var logger=require(_0xa445('0x1'))(_0xa445('0x2'));var moment=require(_0xa445('0x3'));var BPromise=require(_0xa445('0x4'));var rp=require(_0xa445('0x5'));var fs=require('fs');var path=require(_0xa445('0x6'));var rimraf=require(_0xa445('0x7'));var config=require(_0xa445('0x8'));var attributes=require(_0xa445('0x9'));module[_0xa445('0xa')]=function(_0x121621,_0x1a1989){return _0x121621['define'](_0xa445('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xa445('0xc'),'fields':[_0xa445('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 0dd2f9c..a7d99c9 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 _0x3fa7=['client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','body','attributes','limit','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x477c0c,_0x48b400){var _0x37d540=function(_0x2d95e2){while(--_0x2d95e2){_0x477c0c['push'](_0x477c0c['shift']());}};_0x37d540(++_0x48b400);}(_0x3fa7,0x79));var _0x73fa=function(_0x38923c,_0x5e27f3){_0x38923c=_0x38923c-0x0;var _0x4e3a8b=_0x3fa7[_0x38923c];return _0x4e3a8b;};'use strict';var _=require('lodash');var util=require(_0x73fa('0x0'));var moment=require('moment');var BPromise=require(_0x73fa('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73fa('0x2'));var db=require(_0x73fa('0x3'))['db'];var utils=require(_0x73fa('0x4'));var logger=require('../../config/logger')(_0x73fa('0x5'));var config=require('../../config/environment');var jayson=require(_0x73fa('0x6'));var client=jayson[_0x73fa('0x7')][_0x73fa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59fc84,_0x387c92,_0x2cc64c){return new BPromise(function(_0x33a112,_0x2431ca){return client[_0x73fa('0x9')](_0x59fc84,_0x2cc64c)[_0x73fa('0xa')](function(_0x1ca011){logger[_0x73fa('0xb')](_0x73fa('0xc'),_0x387c92,'request\x20sent');logger[_0x73fa('0xd')](_0x73fa('0xe'),_0x387c92,_0x73fa('0xf'),JSON[_0x73fa('0x10')](_0x1ca011));if(_0x1ca011[_0x73fa('0x11')]){if(_0x1ca011[_0x73fa('0x11')][_0x73fa('0x12')]===0x1f4){logger[_0x73fa('0x11')](_0x73fa('0xc'),_0x387c92,_0x1ca011[_0x73fa('0x11')][_0x73fa('0x13')]);return _0x2431ca(_0x1ca011['error'][_0x73fa('0x13')]);}logger[_0x73fa('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x387c92,_0x1ca011[_0x73fa('0x11')][_0x73fa('0x13')]);return _0x33a112(_0x1ca011[_0x73fa('0x11')][_0x73fa('0x13')]);}else{logger[_0x73fa('0xb')](_0x73fa('0xc'),_0x387c92,_0x73fa('0xf'));_0x33a112(_0x1ca011[_0x73fa('0x14')][_0x73fa('0x13')]);}})[_0x73fa('0x15')](function(_0x220e0a){logger['error'](_0x73fa('0xc'),_0x387c92,_0x220e0a);_0x2431ca(_0x220e0a);});});}exports[_0x73fa('0x16')]=function(_0x37ff81){var _0x27e903=this;return new Promise(function(_0x406b6a,_0x11d7de){return db[_0x73fa('0x17')][_0x73fa('0x18')](_0x37ff81['body'],{'raw':_0x37ff81[_0x73fa('0x19')]?_0x37ff81[_0x73fa('0x19')][_0x73fa('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x481c8d){logger[_0x73fa('0xb')]('CreateWhatsappQueueReport',_0x37ff81);logger[_0x73fa('0xd')](_0x73fa('0x16'),_0x37ff81,JSON['stringify'](_0x481c8d));_0x406b6a(_0x481c8d);})[_0x73fa('0x15')](function(_0x378a80){logger[_0x73fa('0x11')](_0x73fa('0x16'),_0x378a80[_0x73fa('0x13')],_0x37ff81);_0x11d7de(_0x27e903['error'](0x1f4,_0x378a80['message']));});});};exports[_0x73fa('0x1b')]=function(_0x207fa8){var _0x330af9=this;return new Promise(function(_0x52de8a,_0x589298){return db[_0x73fa('0x17')][_0x73fa('0x1c')](_0x207fa8[_0x73fa('0x1d')],{'raw':_0x207fa8[_0x73fa('0x19')]?_0x207fa8[_0x73fa('0x19')][_0x73fa('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x207fa8['options']?_0x207fa8[_0x73fa('0x19')]['where']||null:null,'attributes':_0x207fa8[_0x73fa('0x19')]?_0x207fa8[_0x73fa('0x19')][_0x73fa('0x1e')]||null:null,'limit':_0x207fa8[_0x73fa('0x19')]?_0x207fa8[_0x73fa('0x19')][_0x73fa('0x1f')]||null:null})[_0x73fa('0xa')](function(_0x37decf){logger[_0x73fa('0xb')]('UpdateWhatsappQueueReport',_0x207fa8);logger[_0x73fa('0xd')](_0x73fa('0x1b'),_0x207fa8,JSON[_0x73fa('0x10')](_0x37decf));_0x52de8a(_0x37decf);})[_0x73fa('0x15')](function(_0x4b6ae3){logger['error'](_0x73fa('0x1b'),_0x4b6ae3['message'],_0x207fa8);_0x589298(_0x330af9[_0x73fa('0x11')](0x1f4,_0x4b6ae3[_0x73fa('0x13')]));});});}; \ No newline at end of file +var _0x7f0c=['request\x20sent','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','result','CreateWhatsappQueueReport','body','options','raw','catch','UpdateWhatsappQueueReport','update','where','limit','debug','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x7f0c,0x179));var _0xc7f0=function(_0x25bb4c,_0x1a0b53){_0x25bb4c=_0x25bb4c-0x0;var _0x4c78b2=_0x7f0c[_0x25bb4c];return _0x4c78b2;};'use strict';var _=require(_0xc7f0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc7f0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7f0('0x2'));var db=require(_0xc7f0('0x3'))['db'];var utils=require(_0xc7f0('0x4'));var logger=require(_0xc7f0('0x5'))(_0xc7f0('0x6'));var config=require(_0xc7f0('0x7'));var jayson=require(_0xc7f0('0x8'));var client=jayson[_0xc7f0('0x9')][_0xc7f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x103df4,_0x331ea5,_0x81364e){return new BPromise(function(_0x113527,_0xd48f92){return client['request'](_0x103df4,_0x81364e)[_0xc7f0('0xb')](function(_0xeabdc1){logger[_0xc7f0('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x331ea5,_0xc7f0('0xd'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x331ea5,_0xc7f0('0xd'),JSON[_0xc7f0('0xe')](_0xeabdc1));if(_0xeabdc1[_0xc7f0('0xf')]){if(_0xeabdc1[_0xc7f0('0xf')][_0xc7f0('0x10')]===0x1f4){logger[_0xc7f0('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x331ea5,_0xeabdc1[_0xc7f0('0xf')][_0xc7f0('0x11')]);return _0xd48f92(_0xeabdc1[_0xc7f0('0xf')]['message']);}logger['error'](_0xc7f0('0x12'),_0x331ea5,_0xeabdc1[_0xc7f0('0xf')][_0xc7f0('0x11')]);return _0x113527(_0xeabdc1[_0xc7f0('0xf')][_0xc7f0('0x11')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x331ea5,'request\x20sent');_0x113527(_0xeabdc1[_0xc7f0('0x13')]['message']);}})['catch'](function(_0x4d822f){logger[_0xc7f0('0xf')](_0xc7f0('0x12'),_0x331ea5,_0x4d822f);_0xd48f92(_0x4d822f);});});}exports[_0xc7f0('0x14')]=function(_0x469e8b){var _0x15aa8f=this;return new Promise(function(_0xcd8c5,_0x2b3f99){return db['WhatsappQueueReport']['create'](_0x469e8b[_0xc7f0('0x15')],{'raw':_0x469e8b[_0xc7f0('0x16')]?_0x469e8b[_0xc7f0('0x16')][_0xc7f0('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x35ece0){logger[_0xc7f0('0xc')](_0xc7f0('0x14'),_0x469e8b);logger['debug']('CreateWhatsappQueueReport',_0x469e8b,JSON[_0xc7f0('0xe')](_0x35ece0));_0xcd8c5(_0x35ece0);})[_0xc7f0('0x18')](function(_0x15e64b){logger['error'](_0xc7f0('0x14'),_0x15e64b[_0xc7f0('0x11')],_0x469e8b);_0x2b3f99(_0x15aa8f[_0xc7f0('0xf')](0x1f4,_0x15e64b[_0xc7f0('0x11')]));});});};exports[_0xc7f0('0x19')]=function(_0x1ac32a){var _0x2f78e6=this;return new Promise(function(_0x4552c4,_0x58caba){return db['WhatsappQueueReport'][_0xc7f0('0x1a')](_0x1ac32a[_0xc7f0('0x15')],{'raw':_0x1ac32a[_0xc7f0('0x16')]?_0x1ac32a[_0xc7f0('0x16')][_0xc7f0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ac32a[_0xc7f0('0x16')]?_0x1ac32a[_0xc7f0('0x16')][_0xc7f0('0x1b')]||null:null,'attributes':_0x1ac32a[_0xc7f0('0x16')]?_0x1ac32a[_0xc7f0('0x16')]['attributes']||null:null,'limit':_0x1ac32a[_0xc7f0('0x16')]?_0x1ac32a['options'][_0xc7f0('0x1c')]||null:null})[_0xc7f0('0xb')](function(_0x10567c){logger[_0xc7f0('0xc')](_0xc7f0('0x19'),_0x1ac32a);logger[_0xc7f0('0x1d')]('UpdateWhatsappQueueReport',_0x1ac32a,JSON[_0xc7f0('0xe')](_0x10567c));_0x4552c4(_0x10567c);})[_0xc7f0('0x18')](function(_0x2bb07c){logger[_0xc7f0('0xf')]('UpdateWhatsappQueueReport',_0x2bb07c[_0xc7f0('0x11')],_0x1ac32a);_0x58caba(_0x2f78e6[_0xc7f0('0xf')](0x1f4,_0x2bb07c[_0xc7f0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 7b8eb26..66d9af8 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 _0x685d=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x34c8ff,_0x674110){var _0x42601c=function(_0x3e2ce5){while(--_0x3e2ce5){_0x34c8ff['push'](_0x34c8ff['shift']());}};_0x42601c(++_0x674110);}(_0x685d,0x143));var _0xd685=function(_0x56bb57,_0x3cd3c7){_0x56bb57=_0x56bb57-0x0;var _0x4de118=_0x685d[_0x56bb57];return _0x4de118;};'use strict';var multer=require(_0xd685('0x0'));var util=require(_0xd685('0x1'));var path=require(_0xd685('0x2'));var timeout=require(_0xd685('0x3'));var express=require(_0xd685('0x4'));var router=express[_0xd685('0x5')]();var auth=require(_0xd685('0x6'));var interaction=require(_0xd685('0x7'));var config=require(_0xd685('0x8'));var controller=require(_0xd685('0x9'));router[_0xd685('0xa')]('/',auth[_0xd685('0xb')](),controller[_0xd685('0xc')]);router[_0xd685('0xa')](_0xd685('0xd'),auth['isAuthenticated'](),controller[_0xd685('0xe')]);router[_0xd685('0xa')](_0xd685('0xf'),auth['isAuthenticated'](),controller[_0xd685('0x10')]);router[_0xd685('0x11')]('/',auth[_0xd685('0xb')](),controller[_0xd685('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd685('0x13')]);router[_0xd685('0x14')](_0xd685('0xf'),auth[_0xd685('0xb')](),controller[_0xd685('0x15')]);module[_0xd685('0x16')]=router; \ No newline at end of file +var _0x4a81=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete'];(function(_0x53671e,_0x493c5e){var _0x55f65d=function(_0x3c1185){while(--_0x3c1185){_0x53671e['push'](_0x53671e['shift']());}};_0x55f65d(++_0x493c5e);}(_0x4a81,0x1e1));var _0x14a8=function(_0x3e1418,_0x3feb88){_0x3e1418=_0x3e1418-0x0;var _0x4e7447=_0x4a81[_0x3e1418];return _0x4e7447;};'use strict';var multer=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var path=require(_0x14a8('0x2'));var timeout=require(_0x14a8('0x3'));var express=require(_0x14a8('0x4'));var router=express['Router']();var auth=require(_0x14a8('0x5'));var interaction=require(_0x14a8('0x6'));var config=require(_0x14a8('0x7'));var controller=require(_0x14a8('0x8'));router[_0x14a8('0x9')]('/',auth[_0x14a8('0xa')](),controller[_0x14a8('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x14a8('0xc')]);router[_0x14a8('0x9')](_0x14a8('0xd'),auth[_0x14a8('0xa')](),controller[_0x14a8('0xe')]);router['post']('/',auth[_0x14a8('0xa')](),controller[_0x14a8('0xf')]);router[_0x14a8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x14a8('0x11')]);router[_0x14a8('0x12')](_0x14a8('0xd'),auth[_0x14a8('0xa')](),controller['destroy']);module[_0x14a8('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index d18660c..f6c6dcb 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 _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x1631ad,_0xf298c1){var _0x2453d9=function(_0x159af5){while(--_0x159af5){_0x1631ad['push'](_0x1631ad['shift']());}};_0x2453d9(++_0xf298c1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb7e7[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x757a=['queue','DATE','exports','STRING'];(function(_0x122cc1,_0x5c956e){var _0x1e33af=function(_0x949b75){while(--_0x949b75){_0x122cc1['push'](_0x122cc1['shift']());}};_0x1e33af(++_0x5c956e);}(_0x757a,0xde));var _0xa757=function(_0x52d833,_0x268e88){_0x52d833=_0x52d833-0x0;var _0x54f37b=_0x757a[_0x52d833];return _0x54f37b;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'uniqueid':{'type':Sequelize[_0xa757('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0xa757('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa757('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 25fd1af..a0f9e20 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 _0x8f73=['then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update'];(function(_0x45f890,_0x4baefe){var _0x39b8f5=function(_0xa61f2){while(--_0xa61f2){_0x45f890['push'](_0x45f890['shift']());}};_0x39b8f5(++_0x4baefe);}(_0x8f73,0x79));var _0x38f7=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8f73[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x38f7('0x0'));var emlformat=require(_0x38f7('0x1'));var rimraf=require(_0x38f7('0x2'));var zipdir=require(_0x38f7('0x3'));var jsonpatch=require(_0x38f7('0x4'));var rp=require(_0x38f7('0x5'));var moment=require(_0x38f7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x38f7('0x7'));var util=require(_0x38f7('0x8'));var path=require(_0x38f7('0x9'));var sox=require(_0x38f7('0xa'));var csv=require(_0x38f7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x38f7('0xc'));var squel=require(_0x38f7('0xd'));var crypto=require('crypto');var jsforce=require(_0x38f7('0xe'));var deskjs=require(_0x38f7('0xf'));var toCsv=require(_0x38f7('0xb'));var querystring=require(_0x38f7('0x10'));var Papa=require('papaparse');var Redis=require(_0x38f7('0x11'));var authService=require(_0x38f7('0x12'));var qs=require(_0x38f7('0x13'));var as=require(_0x38f7('0x14'));var hardwareService=require(_0x38f7('0x15'));var logger=require('../../config/logger')(_0x38f7('0x16'));var utils=require(_0x38f7('0x17'));var config=require(_0x38f7('0x18'));var licenseUtil=require(_0x38f7('0x19'));var db=require(_0x38f7('0x1a'))['db'];function respondWithStatusCode(_0x552524,_0x11b8d5){_0x11b8d5=_0x11b8d5||0xcc;return function(_0x1d4af2){if(_0x1d4af2){return _0x552524[_0x38f7('0x1b')](_0x11b8d5);}return _0x552524[_0x38f7('0x1c')](_0x11b8d5)[_0x38f7('0x1d')]();};}function respondWithResult(_0x451160,_0x482f43){_0x482f43=_0x482f43||0xc8;return function(_0x5581a5){if(_0x5581a5){return _0x451160[_0x38f7('0x1c')](_0x482f43)['json'](_0x5581a5);}};}function respondWithFilteredResult(_0xa918d2,_0x52279c){return function(_0xd6f54b){if(_0xd6f54b){var _0x173a44=_0xd6f54b[_0x38f7('0x1e')],_0x4e6b9f=_0x52279c[_0x38f7('0x1f')],_0x9f807d=_0x52279c[_0x38f7('0x1f')]+_0x52279c[_0x38f7('0x20')],_0x399af2;if(_0x9f807d>=_0x173a44){_0x9f807d=_0x173a44;_0x399af2=0xc8;}else{_0x399af2=0xce;}_0xa918d2['status'](_0x399af2);return _0xa918d2[_0x38f7('0x21')](_0x38f7('0x22'),_0x4e6b9f+'-'+_0x9f807d+'/'+_0x173a44)[_0x38f7('0x23')](_0xd6f54b);}return null;};}function patchUpdates(_0xfbccb4){return function(_0x37d05d){try{jsonpatch['apply'](_0x37d05d,_0xfbccb4,!![]);}catch(_0x530ed4){return BPromise[_0x38f7('0x24')](_0x530ed4);}return _0x37d05d[_0x38f7('0x25')]();};}function saveUpdates(_0x259379,_0x56d320){return function(_0x23c399){if(_0x23c399){return _0x23c399[_0x38f7('0x26')](_0x259379)[_0x38f7('0x27')](function(_0x258207){return _0x258207;});}return null;};}function removeEntity(_0x17177e,_0x5c9421){return function(_0x28cbbe){if(_0x28cbbe){return _0x28cbbe[_0x38f7('0x28')]()[_0x38f7('0x27')](function(){_0x17177e[_0x38f7('0x1c')](0xcc)[_0x38f7('0x1d')]();});}};}function handleEntityNotFound(_0x26d0e6,_0x45bb89){return function(_0x3d4f7d){if(!_0x3d4f7d){_0x26d0e6[_0x38f7('0x1b')](0x194);}return _0x3d4f7d;};}function handleError(_0x4c7e37,_0x4a3cc5){_0x4a3cc5=_0x4a3cc5||0x1f4;return function(_0x37c09e){logger[_0x38f7('0x29')](_0x37c09e[_0x38f7('0x2a')]);if(_0x37c09e['name']){delete _0x37c09e[_0x38f7('0x2b')];}_0x4c7e37[_0x38f7('0x1c')](_0x4a3cc5)[_0x38f7('0x2c')](_0x37c09e);};}exports[_0x38f7('0x2d')]=function(_0x57518b,_0x40efbd){var _0x5b41df={},_0x16154a={},_0x55a645={'count':0x0,'rows':[]};var _0xab82e7=_[_0x38f7('0x2e')](db[_0x38f7('0x2f')][_0x38f7('0x30')],function(_0x426314){return{'name':_0x426314[_0x38f7('0x31')],'type':_0x426314[_0x38f7('0x32')][_0x38f7('0x33')]};});_0x16154a[_0x38f7('0x34')]=_[_0x38f7('0x2e')](_0xab82e7,_0x38f7('0x2b'));_0x16154a[_0x38f7('0x35')]=_[_0x38f7('0x36')](_0x57518b[_0x38f7('0x35')]);_0x16154a[_0x38f7('0x37')]=_['intersection'](_0x16154a[_0x38f7('0x34')],_0x16154a[_0x38f7('0x35')]);_0x5b41df[_0x38f7('0x38')]=_[_0x38f7('0x39')](_0x16154a[_0x38f7('0x34')],qs[_0x38f7('0x3a')](_0x57518b[_0x38f7('0x35')]['fields']));_0x5b41df[_0x38f7('0x38')]=_0x5b41df[_0x38f7('0x38')][_0x38f7('0x3b')]?_0x5b41df[_0x38f7('0x38')]:_0x16154a[_0x38f7('0x34')];if(!_0x57518b['query'][_0x38f7('0x3c')](_0x38f7('0x3d'))){_0x5b41df[_0x38f7('0x20')]=qs[_0x38f7('0x20')](_0x57518b[_0x38f7('0x35')]['limit']);_0x5b41df[_0x38f7('0x1f')]=qs[_0x38f7('0x1f')](_0x57518b[_0x38f7('0x35')][_0x38f7('0x1f')]);}_0x5b41df[_0x38f7('0x3e')]=qs['sort'](_0x57518b['query'][_0x38f7('0x3f')]);_0x5b41df[_0x38f7('0x40')]=qs['filters'](_[_0x38f7('0x41')](_0x57518b[_0x38f7('0x35')],_0x16154a['filters']),_0xab82e7);if(_0x57518b[_0x38f7('0x35')]['filter']){_0x5b41df['where']=_[_0x38f7('0x42')](_0x5b41df[_0x38f7('0x40')],{'$or':_[_0x38f7('0x2e')](_0xab82e7,function(_0x2fde77){if(_0x2fde77[_0x38f7('0x32')]!==_0x38f7('0x43')){var _0x2a66a6={};_0x2a66a6[_0x2fde77[_0x38f7('0x2b')]]={'$like':'%'+_0x57518b['query'][_0x38f7('0x44')]+'%'};return _0x2a66a6;}})});}_0x5b41df=_['merge']({},_0x5b41df,_0x57518b[_0x38f7('0x45')]);var _0x80be35={'where':_0x5b41df[_0x38f7('0x40')]};return db['WhatsappTransferReport']['count'](_0x80be35)[_0x38f7('0x27')](function(_0x41630){_0x55a645['count']=_0x41630;if(_0x57518b[_0x38f7('0x35')]['includeAll']){_0x5b41df[_0x38f7('0x46')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x38f7('0x47')](_0x5b41df);})[_0x38f7('0x27')](function(_0x5a2109){_0x55a645['rows']=_0x5a2109;return _0x55a645;})[_0x38f7('0x27')](respondWithFilteredResult(_0x40efbd,_0x5b41df))[_0x38f7('0x48')](handleError(_0x40efbd,null));};exports[_0x38f7('0x49')]=function(_0x401373,_0xffa89b){var _0x4a0134={'raw':!![],'where':{'id':_0x401373[_0x38f7('0x4a')]['id']}},_0x38c638={};_0x38c638[_0x38f7('0x34')]=_[_0x38f7('0x36')](db['WhatsappTransferReport'][_0x38f7('0x30')]);_0x38c638['query']=_[_0x38f7('0x36')](_0x401373['query']);_0x38c638[_0x38f7('0x37')]=_[_0x38f7('0x39')](_0x38c638[_0x38f7('0x34')],_0x38c638['query']);_0x4a0134[_0x38f7('0x38')]=_[_0x38f7('0x39')](_0x38c638[_0x38f7('0x34')],qs[_0x38f7('0x3a')](_0x401373[_0x38f7('0x35')][_0x38f7('0x3a')]));_0x4a0134[_0x38f7('0x38')]=_0x4a0134[_0x38f7('0x38')][_0x38f7('0x3b')]?_0x4a0134['attributes']:_0x38c638[_0x38f7('0x34')];if(_0x401373['query'][_0x38f7('0x4b')]){_0x4a0134[_0x38f7('0x46')]=[{'all':!![]}];}_0x4a0134=_['merge']({},_0x4a0134,_0x401373[_0x38f7('0x45')]);return db['WhatsappTransferReport'][_0x38f7('0x4c')](_0x4a0134)[_0x38f7('0x27')](handleEntityNotFound(_0xffa89b,null))[_0x38f7('0x27')](respondWithResult(_0xffa89b,null))[_0x38f7('0x48')](handleError(_0xffa89b,null));};exports[_0x38f7('0x4d')]=function(_0x11c136,_0x7a996a){return db[_0x38f7('0x2f')][_0x38f7('0x4d')](_0x11c136[_0x38f7('0x4e')],{})[_0x38f7('0x27')](respondWithResult(_0x7a996a,0xc9))[_0x38f7('0x48')](handleError(_0x7a996a,null));};exports['update']=function(_0x512f0c,_0x3f3223){if(_0x512f0c['body']['id']){delete _0x512f0c[_0x38f7('0x4e')]['id'];}return db[_0x38f7('0x2f')]['find']({'where':{'id':_0x512f0c[_0x38f7('0x4a')]['id']}})[_0x38f7('0x27')](handleEntityNotFound(_0x3f3223,null))[_0x38f7('0x27')](saveUpdates(_0x512f0c['body'],null))[_0x38f7('0x27')](respondWithResult(_0x3f3223,null))[_0x38f7('0x48')](handleError(_0x3f3223,null));};exports['destroy']=function(_0x507d8c,_0x13d6ad){return db[_0x38f7('0x2f')][_0x38f7('0x4c')]({'where':{'id':_0x507d8c[_0x38f7('0x4a')]['id']}})[_0x38f7('0x27')](handleEntityNotFound(_0x13d6ad,null))['then'](removeEntity(_0x13d6ad,null))[_0x38f7('0x48')](handleError(_0x13d6ad,null));};exports[_0x38f7('0x4f')]=function(_0x175bb0,_0xd96eed){return db[_0x38f7('0x2f')]['describe']()[_0x38f7('0x27')](respondWithResult(_0xd96eed,null))['catch'](handleError(_0xd96eed,null));}; \ No newline at end of file +var _0x932e=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','include','show','params','includeAll','find','catch','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes'];(function(_0x1d8f20,_0x33486a){var _0xb27b30=function(_0x45b930){while(--_0x45b930){_0x1d8f20['push'](_0x1d8f20['shift']());}};_0xb27b30(++_0x33486a);}(_0x932e,0xfc));var _0xe932=function(_0x21f4cf,_0x1e061e){_0x21f4cf=_0x21f4cf-0x0;var _0x4deb27=_0x932e[_0x21f4cf];return _0x4deb27;};'use strict';var pdf=require(_0xe932('0x0'));var emlformat=require(_0xe932('0x1'));var rimraf=require(_0xe932('0x2'));var zipdir=require(_0xe932('0x3'));var jsonpatch=require(_0xe932('0x4'));var rp=require(_0xe932('0x5'));var moment=require('moment');var BPromise=require(_0xe932('0x6'));var Mustache=require(_0xe932('0x7'));var util=require(_0xe932('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xe932('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe932('0xa'));var squel=require(_0xe932('0xb'));var crypto=require(_0xe932('0xc'));var jsforce=require(_0xe932('0xd'));var deskjs=require(_0xe932('0xe'));var toCsv=require(_0xe932('0x9'));var querystring=require(_0xe932('0xf'));var Papa=require(_0xe932('0x10'));var Redis=require(_0xe932('0x11'));var authService=require(_0xe932('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe932('0x13'));var logger=require(_0xe932('0x14'))('api');var utils=require(_0xe932('0x15'));var config=require(_0xe932('0x16'));var licenseUtil=require(_0xe932('0x17'));var db=require(_0xe932('0x18'))['db'];function respondWithStatusCode(_0x44f40e,_0x300b9e){_0x300b9e=_0x300b9e||0xcc;return function(_0x4db054){if(_0x4db054){return _0x44f40e[_0xe932('0x19')](_0x300b9e);}return _0x44f40e[_0xe932('0x1a')](_0x300b9e)[_0xe932('0x1b')]();};}function respondWithResult(_0xbbe10,_0x17c184){_0x17c184=_0x17c184||0xc8;return function(_0x3b0e00){if(_0x3b0e00){return _0xbbe10[_0xe932('0x1a')](_0x17c184)['json'](_0x3b0e00);}};}function respondWithFilteredResult(_0x33fcd3,_0x3d3d20){return function(_0x2c6bbb){if(_0x2c6bbb){var _0x515961=_0x2c6bbb[_0xe932('0x1c')],_0x3f7cf1=_0x3d3d20[_0xe932('0x1d')],_0x2fe75b=_0x3d3d20[_0xe932('0x1d')]+_0x3d3d20[_0xe932('0x1e')],_0x28c91a;if(_0x2fe75b>=_0x515961){_0x2fe75b=_0x515961;_0x28c91a=0xc8;}else{_0x28c91a=0xce;}_0x33fcd3[_0xe932('0x1a')](_0x28c91a);return _0x33fcd3[_0xe932('0x1f')]('Content-Range',_0x3f7cf1+'-'+_0x2fe75b+'/'+_0x515961)[_0xe932('0x20')](_0x2c6bbb);}return null;};}function patchUpdates(_0x43f71c){return function(_0x47fdff){try{jsonpatch[_0xe932('0x21')](_0x47fdff,_0x43f71c,!![]);}catch(_0x1de74d){return BPromise[_0xe932('0x22')](_0x1de74d);}return _0x47fdff[_0xe932('0x23')]();};}function saveUpdates(_0x13564e,_0x3a3815){return function(_0x512e5e){if(_0x512e5e){return _0x512e5e['update'](_0x13564e)['then'](function(_0x387c19){return _0x387c19;});}return null;};}function removeEntity(_0x416e5c,_0x386d3d){return function(_0x58dc55){if(_0x58dc55){return _0x58dc55[_0xe932('0x24')]()['then'](function(){_0x416e5c[_0xe932('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x70eda8,_0x5d2bfd){return function(_0x57a740){if(!_0x57a740){_0x70eda8[_0xe932('0x19')](0x194);}return _0x57a740;};}function handleError(_0x2dcee1,_0x16000e){_0x16000e=_0x16000e||0x1f4;return function(_0x46de90){logger['error'](_0x46de90[_0xe932('0x25')]);if(_0x46de90[_0xe932('0x26')]){delete _0x46de90[_0xe932('0x26')];}_0x2dcee1[_0xe932('0x1a')](_0x16000e)[_0xe932('0x27')](_0x46de90);};}exports[_0xe932('0x28')]=function(_0x245dcd,_0x38bb02){var _0x1fc235={},_0x342a2a={},_0xf3129d={'count':0x0,'rows':[]};var _0x18e3c7=_[_0xe932('0x29')](db[_0xe932('0x2a')][_0xe932('0x2b')],function(_0x31b1ae){return{'name':_0x31b1ae['fieldName'],'type':_0x31b1ae['type'][_0xe932('0x2c')]};});_0x342a2a[_0xe932('0x2d')]=_[_0xe932('0x29')](_0x18e3c7,_0xe932('0x26'));_0x342a2a[_0xe932('0x2e')]=_[_0xe932('0x2f')](_0x245dcd[_0xe932('0x2e')]);_0x342a2a[_0xe932('0x30')]=_[_0xe932('0x31')](_0x342a2a['model'],_0x342a2a[_0xe932('0x2e')]);_0x1fc235[_0xe932('0x32')]=_['intersection'](_0x342a2a[_0xe932('0x2d')],qs[_0xe932('0x33')](_0x245dcd['query'][_0xe932('0x33')]));_0x1fc235[_0xe932('0x32')]=_0x1fc235['attributes'][_0xe932('0x34')]?_0x1fc235[_0xe932('0x32')]:_0x342a2a[_0xe932('0x2d')];if(!_0x245dcd[_0xe932('0x2e')][_0xe932('0x35')]('nolimit')){_0x1fc235['limit']=qs[_0xe932('0x1e')](_0x245dcd['query'][_0xe932('0x1e')]);_0x1fc235[_0xe932('0x1d')]=qs['offset'](_0x245dcd['query'][_0xe932('0x1d')]);}_0x1fc235[_0xe932('0x36')]=qs['sort'](_0x245dcd[_0xe932('0x2e')][_0xe932('0x37')]);_0x1fc235[_0xe932('0x38')]=qs[_0xe932('0x30')](_[_0xe932('0x39')](_0x245dcd[_0xe932('0x2e')],_0x342a2a['filters']),_0x18e3c7);if(_0x245dcd[_0xe932('0x2e')][_0xe932('0x3a')]){_0x1fc235['where']=_[_0xe932('0x3b')](_0x1fc235['where'],{'$or':_['map'](_0x18e3c7,function(_0x1defa8){if(_0x1defa8[_0xe932('0x3c')]!==_0xe932('0x3d')){var _0x384af={};_0x384af[_0x1defa8['name']]={'$like':'%'+_0x245dcd[_0xe932('0x2e')]['filter']+'%'};return _0x384af;}})});}_0x1fc235=_['merge']({},_0x1fc235,_0x245dcd[_0xe932('0x3e')]);var _0x2f38f4={'where':_0x1fc235['where']};return db['WhatsappTransferReport']['count'](_0x2f38f4)[_0xe932('0x3f')](function(_0x3eb4d9){_0xf3129d[_0xe932('0x1c')]=_0x3eb4d9;if(_0x245dcd['query']['includeAll']){_0x1fc235[_0xe932('0x40')]=[{'all':!![]}];}return db[_0xe932('0x2a')]['findAll'](_0x1fc235);})[_0xe932('0x3f')](function(_0x598131){_0xf3129d['rows']=_0x598131;return _0xf3129d;})['then'](respondWithFilteredResult(_0x38bb02,_0x1fc235))['catch'](handleError(_0x38bb02,null));};exports[_0xe932('0x41')]=function(_0x399dda,_0x2072c6){var _0x11908a={'raw':!![],'where':{'id':_0x399dda[_0xe932('0x42')]['id']}},_0x5eb910={};_0x5eb910[_0xe932('0x2d')]=_[_0xe932('0x2f')](db[_0xe932('0x2a')][_0xe932('0x2b')]);_0x5eb910[_0xe932('0x2e')]=_[_0xe932('0x2f')](_0x399dda[_0xe932('0x2e')]);_0x5eb910[_0xe932('0x30')]=_[_0xe932('0x31')](_0x5eb910[_0xe932('0x2d')],_0x5eb910['query']);_0x11908a[_0xe932('0x32')]=_[_0xe932('0x31')](_0x5eb910[_0xe932('0x2d')],qs[_0xe932('0x33')](_0x399dda['query']['fields']));_0x11908a['attributes']=_0x11908a['attributes']['length']?_0x11908a[_0xe932('0x32')]:_0x5eb910[_0xe932('0x2d')];if(_0x399dda[_0xe932('0x2e')][_0xe932('0x43')]){_0x11908a['include']=[{'all':!![]}];}_0x11908a=_[_0xe932('0x3b')]({},_0x11908a,_0x399dda[_0xe932('0x3e')]);return db[_0xe932('0x2a')][_0xe932('0x44')](_0x11908a)['then'](handleEntityNotFound(_0x2072c6,null))[_0xe932('0x3f')](respondWithResult(_0x2072c6,null))[_0xe932('0x45')](handleError(_0x2072c6,null));};exports['create']=function(_0x1a4edb,_0x1b58e2){return db[_0xe932('0x2a')][_0xe932('0x46')](_0x1a4edb['body'],{})['then'](respondWithResult(_0x1b58e2,0xc9))[_0xe932('0x45')](handleError(_0x1b58e2,null));};exports[_0xe932('0x47')]=function(_0x59e5fe,_0x3a1d87){if(_0x59e5fe[_0xe932('0x48')]['id']){delete _0x59e5fe['body']['id'];}return db[_0xe932('0x2a')]['find']({'where':{'id':_0x59e5fe[_0xe932('0x42')]['id']}})[_0xe932('0x3f')](handleEntityNotFound(_0x3a1d87,null))[_0xe932('0x3f')](saveUpdates(_0x59e5fe[_0xe932('0x48')],null))['then'](respondWithResult(_0x3a1d87,null))[_0xe932('0x45')](handleError(_0x3a1d87,null));};exports[_0xe932('0x24')]=function(_0x419781,_0x365c0c){return db[_0xe932('0x2a')][_0xe932('0x44')]({'where':{'id':_0x419781['params']['id']}})[_0xe932('0x3f')](handleEntityNotFound(_0x365c0c,null))[_0xe932('0x3f')](removeEntity(_0x365c0c,null))[_0xe932('0x45')](handleError(_0x365c0c,null));};exports[_0xe932('0x49')]=function(_0x2eb331,_0x2a9a50){return db[_0xe932('0x2a')]['describe']()[_0xe932('0x3f')](respondWithResult(_0x2a9a50,null))['catch'](handleError(_0x2a9a50,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 08bb10b..38108c9 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 _0xe874=['define','WhatsappTransferReport','uniqueid','lodash','util','moment','bluebird','path','../../config/environment','./whatsappTransferReport.attributes','exports'];(function(_0x349349,_0x1aa913){var _0x48d984=function(_0xdbe558){while(--_0xdbe558){_0x349349['push'](_0x349349['shift']());}};_0x48d984(++_0x1aa913);}(_0xe874,0x163));var _0x4e87=function(_0x37fa4f,_0x379eb2){_0x37fa4f=_0x37fa4f-0x0;var _0x17133f=_0xe874[_0x37fa4f];return _0x17133f;};'use strict';var _=require(_0x4e87('0x0'));var util=require(_0x4e87('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4e87('0x2'));var BPromise=require(_0x4e87('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e87('0x4'));var rimraf=require('rimraf');var config=require(_0x4e87('0x5'));var attributes=require(_0x4e87('0x6'));module[_0x4e87('0x7')]=function(_0x36b1d7,_0x4600f2){return _0x36b1d7[_0x4e87('0x8')](_0x4e87('0x9'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x4e87('0xa'),'fields':[_0x4e87('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2178=['../../config/logger','api','moment','bluebird','path','./whatsappTransferReport.attributes','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x465b0c,_0x569d90){var _0x502ff0=function(_0x221757){while(--_0x221757){_0x465b0c['push'](_0x465b0c['shift']());}};_0x502ff0(++_0x569d90);}(_0x2178,0x1ab));var _0x8217=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x2178[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0x8217('0x0'));var util=require(_0x8217('0x1'));var logger=require(_0x8217('0x2'))(_0x8217('0x3'));var moment=require(_0x8217('0x4'));var BPromise=require(_0x8217('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8217('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8217('0x7'));module['exports']=function(_0x53c71b,_0x575e4c){return _0x53c71b['define'](_0x8217('0x8'),attributes,{'tableName':_0x8217('0x9'),'paranoid':![],'indexes':[{'name':_0x8217('0xa'),'fields':[_0x8217('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 87156a8..66ab0a3 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(_0x2f61a6,_0x56ce3b){var _0x28694e=function(_0x76f7e1){while(--_0x76f7e1){_0x2f61a6['push'](_0x2f61a6['shift']());}};_0x28694e(++_0x56ce3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x18dbae,_0x4db149){var _0x49add9=function(_0x385631){while(--_0x385631){_0x18dbae['push'](_0x18dbae['shift']());}};_0x49add9(++_0x4db149);}(_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 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 8ab6837..7a79627 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['./config/license','default','error','exit','lodash','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','listen','start','info','Online\x20apps:','map','filter','online','name','status','join','None','./config/seedDB'];(function(_0x4dd71c,_0x23a24e){var _0x8e4e36=function(_0x5c0e){while(--_0x5c0e){_0x4dd71c['push'](_0x4dd71c['shift']());}};_0x8e4e36(++_0x23a24e);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require(_0xee2f('0x1'));var logger=require('./config/logger')(_0xee2f('0x2'));var pm2=require(_0xee2f('0x3'));var pm2Config=require(_0xee2f('0x4'));var schedule=require(_0xee2f('0x5'));var chat=require(_0xee2f('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xee2f('0x7'));function main(){return mysqldb['db'][_0xee2f('0x8')]['sync']()[_0xee2f('0x9')](function(){return rpc[_0xee2f('0xa')]();})['then'](function(_0x3c4095){logger['info'](_0x3c4095);return chat[_0xee2f('0xb')]();})[_0xee2f('0x9')](function(){return whatsapp['start']();})[_0xee2f('0x9')](function(){return schedule[_0xee2f('0xb')]();})['then'](function(){return transcribe['start']();})['then'](function(_0x56bbea){logger[_0xee2f('0xc')](_0x56bbea);return pm2['start'](pm2Config);})['then'](function(_0x53047d){logger[_0xee2f('0xc')](_0xee2f('0xd'),_[_0xee2f('0xe')](_[_0xee2f('0xf')](_0x53047d,{'status':_0xee2f('0x10')}),_0xee2f('0x11'))['join']());logger[_0xee2f('0xc')]('Offline\x20apps:',_[_0xee2f('0xe')](_[_0xee2f('0xf')](_0x53047d,function(_0x48b30c){return _0x48b30c[_0xee2f('0x12')]!==_0xee2f('0x10');}),_0xee2f('0x11'))[_0xee2f('0x13')]()||_0xee2f('0x14'));config['seedDB']&&require(_0xee2f('0x15'))['default']();require(_0xee2f('0x16'))[_0xee2f('0x17')]();})['catch'](function(_0x550da7){logger[_0xee2f('0x18')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x550da7);process[_0xee2f('0x19')](0x1);});}main(); \ No newline at end of file +var _0x0adf=['join','seedDB','./config/seedDB','default','./config/license','error','exit','lodash','./mysqldb','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','then','listen','info','start','Online\x20apps:','map','online','name','status'];(function(_0x2e1d7c,_0x1742f0){var _0x4508b9=function(_0x1e6442){while(--_0x1e6442){_0x2e1d7c['push'](_0x2e1d7c['shift']());}};_0x4508b9(++_0x1742f0);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x42bba9,_0x5aff7c){_0x42bba9=_0x42bba9-0x0;var _0x2074d3=_0x0adf[_0x42bba9];return _0x2074d3;};'use strict';var _=require(_0xf0ad('0x0'));var mysqldb=require(_0xf0ad('0x1'));var rpc=require(_0xf0ad('0x2'));var config=require('./config/environment');var logger=require(_0xf0ad('0x3'))(_0xf0ad('0x4'));var pm2=require(_0xf0ad('0x5'));var pm2Config=require(_0xf0ad('0x6'));var schedule=require(_0xf0ad('0x7'));var chat=require(_0xf0ad('0x8'));var whatsapp=require(_0xf0ad('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xf0ad('0xa')]['sync']()[_0xf0ad('0xb')](function(){return rpc[_0xf0ad('0xc')]();})[_0xf0ad('0xb')](function(_0x41c99d){logger[_0xf0ad('0xd')](_0x41c99d);return chat[_0xf0ad('0xe')]();})[_0xf0ad('0xb')](function(){return whatsapp['start']();})[_0xf0ad('0xb')](function(){return schedule['start']();})[_0xf0ad('0xb')](function(){return transcribe[_0xf0ad('0xe')]();})[_0xf0ad('0xb')](function(_0x2a5d0e){logger[_0xf0ad('0xd')](_0x2a5d0e);return pm2['start'](pm2Config);})['then'](function(_0x13ed94){logger[_0xf0ad('0xd')](_0xf0ad('0xf'),_[_0xf0ad('0x10')](_['filter'](_0x13ed94,{'status':_0xf0ad('0x11')}),_0xf0ad('0x12'))['join']());logger['info']('Offline\x20apps:',_[_0xf0ad('0x10')](_['filter'](_0x13ed94,function(_0x1dad7b){return _0x1dad7b[_0xf0ad('0x13')]!==_0xf0ad('0x11');}),_0xf0ad('0x12'))[_0xf0ad('0x14')]()||'None');config[_0xf0ad('0x15')]&&require(_0xf0ad('0x16'))[_0xf0ad('0x17')]();require(_0xf0ad('0x18'))['default']();})['catch'](function(_0x2466e8){logger[_0xf0ad('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x2466e8);process[_0xf0ad('0x1a')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 3acd8f6..cd6653f 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 _0x8d7b=['blocked','blockDuration','blockedAt','minutes','find','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','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~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','ValidationError','split','splice','unshift','encryptString','promisify','sign','secret','verify','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../encryptor','lodash','jsonwebtoken','express-jwt','bluebird','secrets','session','role','fullname','name','internal','email','permissions','md5secret','voicePause','chatPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','user','params','then','closed','status','disposition','json','unmanaged','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','Basic','User','authenticate','pass','Wrong\x20credentials.','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key'];(function(_0x1d2195,_0x4b8096){var _0x4962cd=function(_0x301f5a){while(--_0x301f5a){_0x1d2195['push'](_0x1d2195['shift']());}};_0x4962cd(++_0x4b8096);}(_0x8d7b,0x10c));var _0xb8d7=function(_0x1ece42,_0x10c542){_0x1ece42=_0x1ece42-0x0;var _0x31c9c0=_0x8d7b[_0x1ece42];return _0x31c9c0;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xb8d7('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0xb8d7('0x1'));var _=require(_0xb8d7('0x2'));var jwt=require(_0xb8d7('0x3'));var expressJwt=require(_0xb8d7('0x4'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0xb8d7('0x5'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb8d7('0x6')][_0xb8d7('0x7')]});var userAttributes=['id',_0xb8d7('0x8'),_0xb8d7('0x9'),_0xb8d7('0xa'),_0xb8d7('0xb'),_0xb8d7('0xc'),'userpic',_0xb8d7('0xd'),_0xb8d7('0xe'),_0xb8d7('0xf'),_0xb8d7('0x10'),'mailPause','faxPause','smsPause','openchannelPause',_0xb8d7('0x11'),_0xb8d7('0x12'),_0xb8d7('0x13'),_0xb8d7('0x14'),_0xb8d7('0x15'),_0xb8d7('0x16'),_0xb8d7('0x17'),'alias',_0xb8d7('0x18'),_0xb8d7('0x19'),_0xb8d7('0x1a'),'phoneBarEnableRecording',_0xb8d7('0x1b'),'phoneBarEnableSettings',_0xb8d7('0x1c'),_0xb8d7('0x1d'),'phoneBarRemoteControl',_0xb8d7('0x1e'),_0xb8d7('0x1f'),'interface',_0xb8d7('0x20'),_0xb8d7('0x21')];exports[_0xb8d7('0x22')]=function(){return this[_0xb8d7('0x23')](!![])['use'](function(_0x14145b,_0x2054b7,_0x1a71d9){if(_0x14145b[_0xb8d7('0x24')]){_0x1a71d9();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x14145b[_0xb8d7('0x25')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xb8d7('0x26')](function(_0x23570c){if(_0x23570c&&_0x23570c[_0xb8d7('0x27')]){return _0x2054b7[_0xb8d7('0x28')](_0x23570c[_0xb8d7('0x29')]==='unmanaged'?0x195:0x193)[_0xb8d7('0x2a')]({'message':_0x23570c[_0xb8d7('0x29')]===_0xb8d7('0x2b')?_0xb8d7('0x2c'):_0xb8d7('0x2d')});}else{_0x1a71d9();}})[_0xb8d7('0x2e')](function(_0x37838f){_0x1a71d9(_0x37838f);});}});};exports['isAuthenticated']=function isAuthenticated(_0x4ad1f3){return compose()[_0xb8d7('0x2f')](function(_0x1d4f63,_0x1c1dab,_0xbd8b66){var _0x3651d8;if(_0x1d4f63[_0xb8d7('0x30')][_0xb8d7('0x31')]){if(_[_0xb8d7('0x32')](_0x1d4f63[_0xb8d7('0x30')][_0xb8d7('0x31')],_0xb8d7('0x33'))){var _0x1653bc=basicAuth(_0x1d4f63);db[_0xb8d7('0x34')]['find']({'where':{'name':_0x1653bc['name']}})[_0xb8d7('0x26')](function(_0x5522a7){if(!_0x5522a7||!_0x5522a7[_0xb8d7('0x35')](_0x1653bc[_0xb8d7('0x36')])){return _0x1c1dab[_0xb8d7('0x28')](0x191)[_0xb8d7('0x2a')]({'message':_0xb8d7('0x37')});}_0x1d4f63['user']={'id':_0x5522a7['id']};_0xbd8b66();})[_0xb8d7('0x2e')](function(_0x95ce8){_0xbd8b66(_0x95ce8);});}else if(_['startsWith'](_0x1d4f63[_0xb8d7('0x30')][_0xb8d7('0x31')],'Bearer')){validateJwt(_0x1d4f63,_0x1c1dab,_0xbd8b66);}else{if(_0x4ad1f3){_0xbd8b66();}else{return _0x1c1dab[_0xb8d7('0x28')](0x193)[_0xb8d7('0x2a')]({'message':_0xb8d7('0x38')});}}}else if(_0x1d4f63['query'][_0xb8d7('0x39')]){try{var _0x6f11d6={'audience':hardwareConf[_0xb8d7('0x3a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x1d4f63[_0xb8d7('0x3b')][_0xb8d7('0x39')],_0x6f11d6)['then'](function(_0x23aa51){return db[_0xb8d7('0x34')]['find']({'where':{'id':_0x23aa51[_0xb8d7('0x3c')]}})[_0xb8d7('0x26')](function(_0x4d71e2){_0x3651d8=_0x4d71e2;return db[_0xb8d7('0x3d')]['findOne']({'where':{'id':0x1},'attributes':[_0xb8d7('0x3e'),'blockDuration'],'raw':!![]});})[_0xb8d7('0x26')](function(_0x33a10f){if(!_0x3651d8||!_[_0xb8d7('0x3f')](_0x3651d8[_0xb8d7('0x40')],_0x23aa51[_0xb8d7('0x41')])){return _0x1c1dab[_0xb8d7('0x28')](0x191)[_0xb8d7('0x2a')]({'message':_0xb8d7('0x42')});}if(_0x3651d8['disabled']){return _0x1c1dab[_0xb8d7('0x28')](0x191)[_0xb8d7('0x2a')]({'message':_0xb8d7('0x43')});}if(_0x3651d8[_0xb8d7('0x44')]){if(_0x33a10f[_0xb8d7('0x45')]>0x0){if(moment(_0x3651d8[_0xb8d7('0x46')])['add'](_0x33a10f[_0xb8d7('0x45')],_0xb8d7('0x47'))>moment()){return _0x1c1dab[_0xb8d7('0x28')](0x191)[_0xb8d7('0x2a')]({'message':_0xb8d7('0x43')});}}else{return _0x1c1dab['status'](0x191)['json']({'message':_0xb8d7('0x43')});}}_0x1d4f63['user']={'id':_0x3651d8['id']};_0xbd8b66();});})[_0xb8d7('0x2e')](function(){return _0x1c1dab['status'](0x191)[_0xb8d7('0x2a')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x532816){_0xbd8b66(_0x532816);}}else if(_0x4ad1f3){_0xbd8b66();}else{return _0x1c1dab[_0xb8d7('0x28')](0x193)['json']({'message':_0xb8d7('0x38')});}})[_0xb8d7('0x2f')](function(_0x417e50,_0x51fc80,_0x21980a){if(_0x417e50['user']){db[_0xb8d7('0x34')][_0xb8d7('0x48')]({'where':{'id':_0x417e50[_0xb8d7('0x24')]['id']},'attributes':userAttributes})[_0xb8d7('0x26')](function(_0x5597db){if(!_0x5597db){return _0x51fc80[_0xb8d7('0x28')](0x194)[_0xb8d7('0x2a')]({'message':'User\x20not\x20found.'});}_0x417e50[_0xb8d7('0x24')]=_0x5597db;_0x21980a();})[_0xb8d7('0x2e')](function(_0x3d6d88){_0x21980a(_0x3d6d88);});}else if(_0x4ad1f3){_0x21980a();}else{return _0x51fc80['status'](0x194)[_0xb8d7('0x2a')]({'message':_0xb8d7('0x49')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xb8d7('0x2f')](function(_0x46f2c0,_0x25d00f,_0x2a58de){return licenseUtil[_0xb8d7('0x4a')]()[_0xb8d7('0x26')](function(_0x6b5c3c){if(_0x6b5c3c[_0xb8d7('0x4b')]){_0x2a58de();}else{return _0x25d00f[_0xb8d7('0x28')](0x193)[_0xb8d7('0x2a')]({'message':_0xb8d7('0x4c')});}})['catch'](function(_0x342547){_0x2a58de(_0x342547);});});};exports[_0xb8d7('0x4d')]=function(_0x59a5de,_0x37434e,_0x422dcc){_0x59a5de[_0xb8d7('0x4d')]=!![];return _0x422dcc();};exports[_0xb8d7('0x4e')]=function signToken(_0x421e24){return signJwt(_0x421e24);};exports[_0xb8d7('0x4f')]=function(_0x28fc6a,_0x38d84d){if(!_0x28fc6a[_0xb8d7('0x24')]){return _0x38d84d[_0xb8d7('0x28')](0x194)[_0xb8d7('0x2a')]({'message':_0xb8d7('0x50')});}var _0x58f24f={'payload':{'id':_0x28fc6a['user']['id'],'role':_0x28fc6a['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x58f24f)[_0xb8d7('0x26')](function(_0x556b34){_0x38d84d[_0xb8d7('0x51')]('motion.token',_0x556b34);_0x38d84d[_0xb8d7('0x52')]('/dashboards/general');})[_0xb8d7('0x2e')](function(_0x130329){return _0x38d84d[_0xb8d7('0x28')](0x1f4)[_0xb8d7('0x53')](_0x130329);});};exports[_0xb8d7('0x54')]=function(_0x51f068){if(_[_0xb8d7('0x55')](_0x51f068[_0xb8d7('0x40')])||_[_0xb8d7('0x55')](_0x51f068[_0xb8d7('0x56')])){return null;}else{return createJwt(_0x51f068);}};exports[_0xb8d7('0x57')]=function(_0x157a64){_0x157a64['apiKeyNonce']=generateNonce();_0x157a64[_0xb8d7('0x56')]=generateIssuedAt();return createJwt(_0x157a64);};exports[_0xb8d7('0x58')]=function(_0x43524b,_0x5998e6){var _0x3b1ebc=_0x43524b['query'][_0xb8d7('0x39')];if(_0x3b1ebc){var _0x382891={'nonce':_0x5998e6[_0xb8d7('0x40')],'iat':_0x5998e6[_0xb8d7('0x56')],'audience':hardwareConf[_0xb8d7('0x3a')](),'issuer':hardwareConf[_0xb8d7('0x3a')]()};return verifyJwt(_0x3b1ebc,_0x382891)[_0xb8d7('0x26')](function(){return generateApiKey(_0x5998e6);});}else{throw{'message':_0xb8d7('0x59')};}};exports['validatePasswordPattern']=function(_0x42bd5d){var _0x3486df=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3486df[_0xb8d7('0x5a')](_0x42bd5d))throw new db[(_0xb8d7('0x5b'))]['ValidationError'](_0xb8d7('0x5c'));return;};exports[_0xb8d7('0x5d')]=function(_0x243e38,_0x44d649,_0x27b792){var _0x437024=encryptor[_0xb8d7('0x5e')](_0x44d649)['split'](',');for(var _0x4b9a62=0x0;_0x4b9a62<_0x27b792;_0x4b9a62++){if(!_0x437024[_0x4b9a62])break;if(_0x243e38[_0xb8d7('0x5f')]()===_0x437024[_0x4b9a62]['toLowerCase']()){var _0x2c46e5=util[_0xb8d7('0x60')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x27b792);if(_0x27b792===0x1){_0x2c46e5='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xb8d7('0x5b'))][(_0xb8d7('0x61'))](_0x2c46e5);}}return;};exports['updatePasswordsHistory']=function(_0x5adcf4,_0x82fae1){var _0x1cd7cc=_0x82fae1?encryptor[_0xb8d7('0x5e')](_0x82fae1)[_0xb8d7('0x62')](','):[];if(_0x1cd7cc['length']===0x5){_0x1cd7cc[_0xb8d7('0x63')](-0x1,0x1);}_0x1cd7cc[_0xb8d7('0x64')](_0x5adcf4);return encryptor[_0xb8d7('0x65')](_0x1cd7cc['join'](','));};function signJwt(_0x444f6e){var _0x29bed3=BPromise[_0xb8d7('0x66')](jwt[_0xb8d7('0x67')],{'context':jwt});var _0x3f81ab=_0x444f6e[_0xb8d7('0x68')]||config[_0xb8d7('0x6')][_0xb8d7('0x7')];return new BPromise(function(_0x4a7f85,_0x3f6cc3){_0x29bed3(_0x444f6e['payload'],_0x3f81ab,_0x444f6e['options'])[_0xb8d7('0x26')](function(_0x588b77){_0x4a7f85(_0x588b77);})[_0xb8d7('0x2e')](function(_0x598bdb){_0x3f6cc3(_0x598bdb);});});}function verifyJwt(_0x23f7a6,_0x3c70e,_0x45e7d5){var _0x3a0434=BPromise[_0xb8d7('0x66')](jwt[_0xb8d7('0x69')],{'context':jwt});var _0x2a9f91=_0x45e7d5||config[_0xb8d7('0x6')][_0xb8d7('0x7')];return new BPromise(function(_0x37263f,_0x46dc4b){_0x3a0434(_0x23f7a6,_0x2a9f91,_0x3c70e)['then'](function(_0x484ec7){_0x37263f(_0x484ec7);})[_0xb8d7('0x2e')](function(_0x5e8666){_0x46dc4b(_0x5e8666);});});}function generateNonce(){return crypto[_0xb8d7('0x6a')](0x10)[_0xb8d7('0x6b')](_0xb8d7('0x6c'));}function generateIssuedAt(){return Math[_0xb8d7('0x6d')](Date[_0xb8d7('0x6e')]()/0x3e8)[_0xb8d7('0x6b')]();}function createJwt(_0x2d44c0){var _0x10d7a8={'payload':{'iat':_0x2d44c0[_0xb8d7('0x56')],'nonce':_0x2d44c0['apiKeyNonce']},'options':{'algorithm':_0xb8d7('0x6f'),'subject':_0x2d44c0['id'][_0xb8d7('0x6b')](),'issuer':hardwareConf[_0xb8d7('0x3a')](),'audience':hardwareConf[_0xb8d7('0x3a')]()}};return signJwt(_0x10d7a8)[_0xb8d7('0x26')](function(_0x2c27c6){return{'iat':_0x2d44c0['apiKeyIat'],'nonce':_0x2d44c0[_0xb8d7('0x40')],'token':_0x2c27c6};});} \ No newline at end of file +var _0xdaf1=['isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','length','splice','unshift','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','internal','email','userpic','md5secret','voicePause','chatPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','user','findOne','params','closed','then','status','disposition','unmanaged','Forbidden.','catch','use','headers','authorization','startsWith','Basic','name','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','getUuid','query','apikey','User','find','sub','allowedLoginAttempts','blockDuration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdaf1,0x125));var _0x1daf=function(_0x47f7ba,_0x426b54){_0x47f7ba=_0x47f7ba-0x0;var _0xc8e7c1=_0xdaf1[_0x47f7ba];return _0xc8e7c1;};'use strict';var db=require(_0x1daf('0x0'))['db'];var config=require(_0x1daf('0x1'));var hardwareConf=require(_0x1daf('0x2'));var licenseUtil=require(_0x1daf('0x3'));var encryptor=require(_0x1daf('0x4'));var _=require(_0x1daf('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x1daf('0x6'));var compose=require(_0x1daf('0x7'));var basicAuth=require(_0x1daf('0x8'));var crypto=require('crypto');var BPromise=require(_0x1daf('0x9'));var util=require(_0x1daf('0xa'));var moment=require(_0x1daf('0xb'));var validateJwt=expressJwt({'secret':config[_0x1daf('0xc')][_0x1daf('0xd')]});var userAttributes=['id',_0x1daf('0xe'),_0x1daf('0xf'),'name',_0x1daf('0x10'),_0x1daf('0x11'),_0x1daf('0x12'),'permissions',_0x1daf('0x13'),_0x1daf('0x14'),_0x1daf('0x15'),'mailPause',_0x1daf('0x16'),'smsPause',_0x1daf('0x17'),_0x1daf('0x18'),_0x1daf('0x19'),_0x1daf('0x1a'),'lastPauseAt','crudPermissions',_0x1daf('0x1b'),'passwordResetAt',_0x1daf('0x1c'),_0x1daf('0x1d'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0x1daf('0x1e'),_0x1daf('0x1f'),_0x1daf('0x20'),_0x1daf('0x21'),_0x1daf('0x22'),_0x1daf('0x23'),_0x1daf('0x24'),_0x1daf('0x25'),'interface',_0x1daf('0x26'),_0x1daf('0x27')];exports[_0x1daf('0x28')]=function(){return this[_0x1daf('0x29')](!![])['use'](function(_0x2a0e01,_0xaadf9c,_0x5b8930){if(_0x2a0e01[_0x1daf('0x2a')]){_0x5b8930();}else{return db['ChatInteraction'][_0x1daf('0x2b')]({'where':{'id':_0x2a0e01[_0x1daf('0x2c')]['id']},'attributes':['id',_0x1daf('0x2d'),'disposition'],'raw':!![]})[_0x1daf('0x2e')](function(_0x1c83d1){if(_0x1c83d1&&_0x1c83d1[_0x1daf('0x2d')]){return _0xaadf9c[_0x1daf('0x2f')](_0x1c83d1[_0x1daf('0x30')]===_0x1daf('0x31')?0x195:0x193)['json']({'message':_0x1c83d1[_0x1daf('0x30')]===_0x1daf('0x31')?'Unmanaged.':_0x1daf('0x32')});}else{_0x5b8930();}})[_0x1daf('0x33')](function(_0x204987){_0x5b8930(_0x204987);});}});};exports[_0x1daf('0x29')]=function isAuthenticated(_0x328d77){return compose()[_0x1daf('0x34')](function(_0x2723e4,_0x4e6699,_0x23bc72){var _0x1b3acc;if(_0x2723e4[_0x1daf('0x35')][_0x1daf('0x36')]){if(_[_0x1daf('0x37')](_0x2723e4[_0x1daf('0x35')]['authorization'],_0x1daf('0x38'))){var _0xb22170=basicAuth(_0x2723e4);db['User']['find']({'where':{'name':_0xb22170[_0x1daf('0x39')]}})['then'](function(_0xe0df6a){if(!_0xe0df6a||!_0xe0df6a['authenticate'](_0xb22170['pass'])){return _0x4e6699[_0x1daf('0x2f')](0x191)['json']({'message':_0x1daf('0x3a')});}_0x2723e4[_0x1daf('0x2a')]={'id':_0xe0df6a['id']};_0x23bc72();})[_0x1daf('0x33')](function(_0x5818bf){_0x23bc72(_0x5818bf);});}else if(_[_0x1daf('0x37')](_0x2723e4[_0x1daf('0x35')][_0x1daf('0x36')],_0x1daf('0x3b'))){validateJwt(_0x2723e4,_0x4e6699,_0x23bc72);}else{if(_0x328d77){_0x23bc72();}else{return _0x4e6699['status'](0x193)[_0x1daf('0x3c')]({'message':_0x1daf('0x3d')});}}}else if(_0x2723e4['query']['apikey']){try{var _0xf0950b={'audience':hardwareConf[_0x1daf('0x3e')](),'issuer':hardwareConf[_0x1daf('0x3e')]()};verifyJwt(_0x2723e4[_0x1daf('0x3f')][_0x1daf('0x40')],_0xf0950b)[_0x1daf('0x2e')](function(_0x59a40a){return db[_0x1daf('0x41')][_0x1daf('0x42')]({'where':{'id':_0x59a40a[_0x1daf('0x43')]}})[_0x1daf('0x2e')](function(_0x4f0ad1){_0x1b3acc=_0x4f0ad1;return db['Setting'][_0x1daf('0x2b')]({'where':{'id':0x1},'attributes':[_0x1daf('0x44'),_0x1daf('0x45')],'raw':!![]});})[_0x1daf('0x2e')](function(_0x34e2b9){if(!_0x1b3acc||!_[_0x1daf('0x46')](_0x1b3acc[_0x1daf('0x47')],_0x59a40a[_0x1daf('0x48')])){return _0x4e6699[_0x1daf('0x2f')](0x191)[_0x1daf('0x3c')]({'message':_0x1daf('0x49')});}if(_0x1b3acc['disabled']){return _0x4e6699[_0x1daf('0x2f')](0x191)[_0x1daf('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1b3acc[_0x1daf('0x4a')]){if(_0x34e2b9[_0x1daf('0x45')]>0x0){if(moment(_0x1b3acc['blockedAt'])[_0x1daf('0x4b')](_0x34e2b9[_0x1daf('0x45')],_0x1daf('0x4c'))>moment()){return _0x4e6699[_0x1daf('0x2f')](0x191)['json']({'message':_0x1daf('0x4d')});}}else{return _0x4e6699[_0x1daf('0x2f')](0x191)[_0x1daf('0x3c')]({'message':_0x1daf('0x4d')});}}_0x2723e4[_0x1daf('0x2a')]={'id':_0x1b3acc['id']};_0x23bc72();});})['catch'](function(){return _0x4e6699['status'](0x191)[_0x1daf('0x3c')]({'message':_0x1daf('0x4d')});});}catch(_0x55aeff){_0x23bc72(_0x55aeff);}}else if(_0x328d77){_0x23bc72();}else{return _0x4e6699['status'](0x193)[_0x1daf('0x3c')]({'message':_0x1daf('0x3d')});}})['use'](function(_0x500f30,_0x15adf2,_0xeed018){if(_0x500f30[_0x1daf('0x2a')]){db[_0x1daf('0x41')][_0x1daf('0x42')]({'where':{'id':_0x500f30['user']['id']},'attributes':userAttributes})[_0x1daf('0x2e')](function(_0x4f95d4){if(!_0x4f95d4){return _0x15adf2[_0x1daf('0x2f')](0x194)[_0x1daf('0x3c')]({'message':_0x1daf('0x4e')});}_0x500f30[_0x1daf('0x2a')]=_0x4f95d4;_0xeed018();})[_0x1daf('0x33')](function(_0x159728){_0xeed018(_0x159728);});}else if(_0x328d77){_0xeed018();}else{return _0x15adf2[_0x1daf('0x2f')](0x194)[_0x1daf('0x3c')]({'message':_0x1daf('0x4f')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x1daf('0x34')](function(_0x16d5ab,_0x3fefe1,_0x3770c4){return licenseUtil['getLicense']()[_0x1daf('0x2e')](function(_0x4523ba){if(_0x4523ba['update']){_0x3770c4();}else{return _0x3fefe1['status'](0x193)[_0x1daf('0x3c')]({'message':_0x1daf('0x50')});}})[_0x1daf('0x33')](function(_0x24c36d){_0x3770c4(_0x24c36d);});});};exports[_0x1daf('0x51')]=function(_0x337be2,_0x1ee332,_0xbf1ced){_0x337be2[_0x1daf('0x51')]=!![];return _0xbf1ced();};exports[_0x1daf('0x52')]=function signToken(_0x569538){return signJwt(_0x569538);};exports[_0x1daf('0x53')]=function(_0x14a164,_0x5a1e94){if(!_0x14a164[_0x1daf('0x2a')]){return _0x5a1e94[_0x1daf('0x2f')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x55cfd0={'payload':{'id':_0x14a164[_0x1daf('0x2a')]['id'],'role':_0x14a164[_0x1daf('0x2a')][_0x1daf('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x55cfd0)['then'](function(_0x3d37c0){_0x5a1e94[_0x1daf('0x54')](_0x1daf('0x55'),_0x3d37c0);_0x5a1e94[_0x1daf('0x56')](_0x1daf('0x57'));})[_0x1daf('0x33')](function(_0x486f9f){return _0x5a1e94['status'](0x1f4)[_0x1daf('0x58')](_0x486f9f);});};exports[_0x1daf('0x59')]=function(_0x4286b1){if(_[_0x1daf('0x5a')](_0x4286b1[_0x1daf('0x47')])||_[_0x1daf('0x5a')](_0x4286b1['apiKeyIat'])){return null;}else{return createJwt(_0x4286b1);}};exports['generateApiKey']=function(_0x41b7f4){_0x41b7f4[_0x1daf('0x47')]=generateNonce();_0x41b7f4[_0x1daf('0x5b')]=generateIssuedAt();return createJwt(_0x41b7f4);};exports[_0x1daf('0x5c')]=function(_0x10504a,_0x19dc09){var _0x1d2f7d=_0x10504a[_0x1daf('0x3f')][_0x1daf('0x40')];if(_0x1d2f7d){var _0x3219ae={'nonce':_0x19dc09[_0x1daf('0x47')],'iat':_0x19dc09['apiKeyIat'],'audience':hardwareConf[_0x1daf('0x3e')](),'issuer':hardwareConf[_0x1daf('0x3e')]()};return verifyJwt(_0x1d2f7d,_0x3219ae)[_0x1daf('0x2e')](function(){return generateApiKey(_0x19dc09);});}else{throw{'message':_0x1daf('0x5d')};}};exports[_0x1daf('0x5e')]=function(_0x922ec2){var _0x4affc8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4affc8[_0x1daf('0x5f')](_0x922ec2))throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x1daf('0x60')]=function(_0x2f4300,_0x4ba7c9,_0x284e94){var _0x2ce79b=encryptor[_0x1daf('0x61')](_0x4ba7c9)[_0x1daf('0x62')](',');for(var _0x3c0ae2=0x0;_0x3c0ae2<_0x284e94;_0x3c0ae2++){if(!_0x2ce79b[_0x3c0ae2])break;if(_0x2f4300[_0x1daf('0x63')]()===_0x2ce79b[_0x3c0ae2][_0x1daf('0x63')]()){var _0x4a00b7=util[_0x1daf('0x64')](_0x1daf('0x65'),_0x284e94);if(_0x284e94===0x1){_0x4a00b7=_0x1daf('0x66');}throw new db[(_0x1daf('0x67'))][(_0x1daf('0x68'))](_0x4a00b7);}}return;};exports['updatePasswordsHistory']=function(_0x23f58f,_0x510ecb){var _0x4d2405=_0x510ecb?encryptor['decryptString'](_0x510ecb)['split'](','):[];if(_0x4d2405[_0x1daf('0x69')]===0x5){_0x4d2405[_0x1daf('0x6a')](-0x1,0x1);}_0x4d2405[_0x1daf('0x6b')](_0x23f58f);return encryptor['encryptString'](_0x4d2405[_0x1daf('0x6c')](','));};function signJwt(_0x296bb2){var _0x179cf7=BPromise[_0x1daf('0x6d')](jwt[_0x1daf('0x6e')],{'context':jwt});var _0x229c36=_0x296bb2[_0x1daf('0x6f')]||config[_0x1daf('0xc')]['session'];return new BPromise(function(_0x3d9ec5,_0x28b5c4){_0x179cf7(_0x296bb2[_0x1daf('0x70')],_0x229c36,_0x296bb2[_0x1daf('0x71')])[_0x1daf('0x2e')](function(_0x504afb){_0x3d9ec5(_0x504afb);})['catch'](function(_0x192fb6){_0x28b5c4(_0x192fb6);});});}function verifyJwt(_0x17c141,_0x3f1785,_0x1dce22){var _0x2b1a30=BPromise[_0x1daf('0x6d')](jwt[_0x1daf('0x72')],{'context':jwt});var _0xc4f022=_0x1dce22||config[_0x1daf('0xc')][_0x1daf('0xd')];return new BPromise(function(_0xb92ed1,_0x47c3c4){_0x2b1a30(_0x17c141,_0xc4f022,_0x3f1785)[_0x1daf('0x2e')](function(_0xf0fedb){_0xb92ed1(_0xf0fedb);})[_0x1daf('0x33')](function(_0x53dbf1){_0x47c3c4(_0x53dbf1);});});}function generateNonce(){return crypto[_0x1daf('0x73')](0x10)[_0x1daf('0x74')](_0x1daf('0x75'));}function generateIssuedAt(){return Math[_0x1daf('0x76')](Date[_0x1daf('0x77')]()/0x3e8)[_0x1daf('0x74')]();}function createJwt(_0x4e20a6){var _0x4a44b2={'payload':{'iat':_0x4e20a6[_0x1daf('0x5b')],'nonce':_0x4e20a6[_0x1daf('0x47')]},'options':{'algorithm':_0x1daf('0x78'),'subject':_0x4e20a6['id'][_0x1daf('0x74')](),'issuer':hardwareConf[_0x1daf('0x3e')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x4a44b2)[_0x1daf('0x2e')](function(_0x5679f9){return{'iat':_0x4e20a6[_0x1daf('0x5b')],'nonce':_0x4e20a6[_0x1daf('0x47')],'token':_0x5679f9};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index d810676..263892a 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 _0x84e7=['encryptString','utf8','base64','secret','bluebird','../../config/environment','session','aes-256-ctr','hasOwnProperty','createReadStream','createCipher','algorithm','data','update','binary','write','end','close','unlink','decryptFile','createWriteStream','final'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x84e7,0x122));var _0x784e=function(_0x471e34,_0x36d5cb){_0x471e34=_0x471e34-0x0;var _0x5d3509=_0x84e7[_0x471e34];return _0x5d3509;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x784e('0x0'));var config=require(_0x784e('0x1'));const stringOptions={'secret':config['secrets'][_0x784e('0x2')],'algorithm':_0x784e('0x3')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x45e3ad){var _0x14cee2={};for(var _0x205619 in fileOptions){if(fileOptions[_0x784e('0x4')](_0x205619)){_0x14cee2[_0x205619]=fileOptions[_0x205619];}}if(_0x45e3ad){for(var _0x42993b in _0x45e3ad){if(_0x45e3ad[_0x784e('0x4')](_0x42993b)){_0x14cee2[_0x42993b]=_0x45e3ad[_0x42993b];}}}return _0x14cee2;}exports['encryptFile']=function(_0x3cbdd1,_0x5d5595,_0xfaa170,_0x24654d){return new BPromise(function(_0x59a97d,_0x18be55){_0x24654d=combineOptions(_0x24654d);var _0x46fda9=new Buffer(_0xfaa170);var _0x237b5e=fs[_0x784e('0x5')](_0x3cbdd1);var _0x4ac061=fs['createWriteStream'](_0x5d5595);var _0x19b153=crypto[_0x784e('0x6')](_0x24654d[_0x784e('0x7')],_0x46fda9);_0x237b5e['on'](_0x784e('0x8'),function(_0x5389cd){var _0x285924=new Buffer(_0x19b153[_0x784e('0x9')](_0x5389cd),_0x784e('0xa'));_0x4ac061[_0x784e('0xb')](_0x285924);});_0x237b5e['on'](_0x784e('0xc'),function(){try{var _0x208d24=new Buffer(_0x19b153['final'](_0x784e('0xa')),'binary');_0x4ac061[_0x784e('0xb')](_0x208d24);_0x4ac061[_0x784e('0xc')]();_0x4ac061['on'](_0x784e('0xd'),function(){return _0x59a97d(_0x5d5595);});}catch(_0x21e844){fs[_0x784e('0xe')](_0x5d5595);return _0x18be55(_0x21e844);}});});};exports[_0x784e('0xf')]=function(_0x947397,_0x39abb5,_0x8a90cf,_0x567eb9){return new BPromise(function(_0x519059,_0x112ba1){_0x567eb9=combineOptions(_0x567eb9);var _0x3a01e3=new Buffer(_0x8a90cf);var _0x3b7d6a=fs[_0x784e('0x5')](_0x947397);var _0x3ac83=fs[_0x784e('0x10')](_0x39abb5);var _0x1dc568=crypto['createDecipher'](_0x567eb9[_0x784e('0x7')],_0x3a01e3);_0x3b7d6a['on'](_0x784e('0x8'),function(_0x8e437a){var _0xa417c2=new Buffer(_0x1dc568[_0x784e('0x9')](_0x8e437a),_0x784e('0xa'));_0x3ac83[_0x784e('0xb')](_0xa417c2);});_0x3b7d6a['on']('end',function(){try{var _0x5add8f=new Buffer(_0x1dc568[_0x784e('0x11')]('binary'),_0x784e('0xa'));_0x3ac83[_0x784e('0xb')](_0x5add8f);_0x3ac83['end']();_0x3ac83['on']('close',function(){return _0x519059(_0x39abb5);});}catch(_0x2d1d08){fs[_0x784e('0xe')](_0x39abb5);return _0x112ba1(_0x2d1d08);}});});};exports[_0x784e('0x12')]=function(_0xfc37fb,_0x51f452,_0x4fab06){var _0x4dc85f=_0x4fab06||stringOptions[_0x784e('0x7')];var _0x12134f=_0x51f452||stringOptions['secret'];var _0xc225cf=crypto['createCipher'](_0x4dc85f,_0x12134f);var _0x2d6f18=_0xc225cf['update'](_0xfc37fb,_0x784e('0x13'),_0x784e('0x14'));_0x2d6f18+=_0xc225cf[_0x784e('0x11')](_0x784e('0x14'));return _0x2d6f18;};exports['decryptString']=function(_0x3668ed,_0x2242e6,_0x12a246){var _0x2def08=_0x12a246||stringOptions['algorithm'];var _0x243e42=_0x2242e6||stringOptions[_0x784e('0x15')];var _0x5f3da2=crypto['createDecipher'](_0x2def08,_0x243e42);var _0x3c30b7=_0x5f3da2[_0x784e('0x9')](_0x3668ed,_0x784e('0x14'),_0x784e('0x13'));_0x3c30b7+=_0x5f3da2[_0x784e('0x11')](_0x784e('0x13'));return _0x3c30b7;}; \ No newline at end of file +var _0xdc97=['utf8','base64','decryptString','crypto','bluebird','../../config/environment','session','aes192','hasOwnProperty','createWriteStream','createCipher','algorithm','data','end','binary','write','close','decryptFile','createDecipher','update','final','unlink','encryptString','secret'];(function(_0x226ad1,_0x2858e2){var _0x16b625=function(_0x4dc555){while(--_0x4dc555){_0x226ad1['push'](_0x226ad1['shift']());}};_0x16b625(++_0x2858e2);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1bac43,_0x41c983){_0x1bac43=_0x1bac43-0x0;var _0x245ba6=_0xdc97[_0x1bac43];return _0x245ba6;};'use strict';var crypto=require(_0x7dc9('0x0'));var fs=require('fs');var BPromise=require(_0x7dc9('0x1'));var config=require(_0x7dc9('0x2'));const stringOptions={'secret':config['secrets'][_0x7dc9('0x3')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x7dc9('0x4')};function combineOptions(_0x2b86da){var _0x478a95={};for(var _0x2a77c1 in fileOptions){if(fileOptions[_0x7dc9('0x5')](_0x2a77c1)){_0x478a95[_0x2a77c1]=fileOptions[_0x2a77c1];}}if(_0x2b86da){for(var _0xb15a0b in _0x2b86da){if(_0x2b86da[_0x7dc9('0x5')](_0xb15a0b)){_0x478a95[_0xb15a0b]=_0x2b86da[_0xb15a0b];}}}return _0x478a95;}exports['encryptFile']=function(_0x2636ef,_0x4f91c7,_0x4b3229,_0x2ff923){return new BPromise(function(_0x23737d,_0x3318ea){_0x2ff923=combineOptions(_0x2ff923);var _0x42ec7c=new Buffer(_0x4b3229);var _0x3dd07e=fs['createReadStream'](_0x2636ef);var _0xb2fa2a=fs[_0x7dc9('0x6')](_0x4f91c7);var _0x37dfc=crypto[_0x7dc9('0x7')](_0x2ff923[_0x7dc9('0x8')],_0x42ec7c);_0x3dd07e['on'](_0x7dc9('0x9'),function(_0x1e336a){var _0x4e8e65=new Buffer(_0x37dfc['update'](_0x1e336a),'binary');_0xb2fa2a['write'](_0x4e8e65);});_0x3dd07e['on'](_0x7dc9('0xa'),function(){try{var _0x14e5db=new Buffer(_0x37dfc['final'](_0x7dc9('0xb')),_0x7dc9('0xb'));_0xb2fa2a[_0x7dc9('0xc')](_0x14e5db);_0xb2fa2a[_0x7dc9('0xa')]();_0xb2fa2a['on'](_0x7dc9('0xd'),function(){return _0x23737d(_0x4f91c7);});}catch(_0x11af93){fs['unlink'](_0x4f91c7);return _0x3318ea(_0x11af93);}});});};exports[_0x7dc9('0xe')]=function(_0x278191,_0x1b0aa1,_0x442819,_0x11606f){return new BPromise(function(_0xbe0437,_0x45698c){_0x11606f=combineOptions(_0x11606f);var _0x389d36=new Buffer(_0x442819);var _0x4778d5=fs['createReadStream'](_0x278191);var _0x22577e=fs['createWriteStream'](_0x1b0aa1);var _0x1f5906=crypto[_0x7dc9('0xf')](_0x11606f['algorithm'],_0x389d36);_0x4778d5['on'](_0x7dc9('0x9'),function(_0x3b738a){var _0x12f08d=new Buffer(_0x1f5906[_0x7dc9('0x10')](_0x3b738a),_0x7dc9('0xb'));_0x22577e[_0x7dc9('0xc')](_0x12f08d);});_0x4778d5['on'](_0x7dc9('0xa'),function(){try{var _0x2895f5=new Buffer(_0x1f5906[_0x7dc9('0x11')](_0x7dc9('0xb')),'binary');_0x22577e['write'](_0x2895f5);_0x22577e[_0x7dc9('0xa')]();_0x22577e['on'](_0x7dc9('0xd'),function(){return _0xbe0437(_0x1b0aa1);});}catch(_0x596e0f){fs[_0x7dc9('0x12')](_0x1b0aa1);return _0x45698c(_0x596e0f);}});});};exports[_0x7dc9('0x13')]=function(_0x5e9525,_0xffc080,_0x43d31f){var _0x41110a=_0x43d31f||stringOptions['algorithm'];var _0x424763=_0xffc080||stringOptions[_0x7dc9('0x14')];var _0xf95336=crypto['createCipher'](_0x41110a,_0x424763);var _0x48c6bc=_0xf95336['update'](_0x5e9525,_0x7dc9('0x15'),_0x7dc9('0x16'));_0x48c6bc+=_0xf95336['final']('base64');return _0x48c6bc;};exports[_0x7dc9('0x17')]=function(_0x5afb7d,_0x2d22eb,_0x1c690b){var _0x3a74a0=_0x1c690b||stringOptions[_0x7dc9('0x8')];var _0xa2aaa9=_0x2d22eb||stringOptions[_0x7dc9('0x14')];var _0x236d42=crypto[_0x7dc9('0xf')](_0x3a74a0,_0xa2aaa9);var _0x1fcf0e=_0x236d42[_0x7dc9('0x10')](_0x5afb7d,_0x7dc9('0x16'),_0x7dc9('0x15'));_0x1fcf0e+=_0x236d42['final']('utf8');return _0x1fcf0e;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index e0c1b53..2197928 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 _0xbd50=['Failed','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0x23a7aa,_0x51647e){var _0x5a6172=function(_0x21b1d9){while(--_0x21b1d9){_0x23a7aa['push'](_0x23a7aa['shift']());}};_0x5a6172(++_0x51647e);}(_0xbd50,0x196));var _0x0bd5=function(_0x58e8eb,_0x2ac0c7){_0x58e8eb=_0x58e8eb-0x0;var _0x168540=_0xbd50[_0x58e8eb];return _0x168540;};'use strict';var util=require(_0x0bd5('0x0'));var path=require(_0x0bd5('0x1'));var _=require(_0x0bd5('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x0bd5('0x3'));var zipdir=require(_0x0bd5('0x4'));var rimraf=require(_0x0bd5('0x5'));var db=require(_0x0bd5('0x6'))['db'];var dbH=require(_0x0bd5('0x6'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x0bd5('0x7')][0x2]);var QUERY=process[_0x0bd5('0x7')][0x3];var PATH=process[_0x0bd5('0x7')][0x4];function analyticExtractedReport(_0x2c0db1,_0x1b99f3){var _0x5ebe64={'status':_0x2c0db1};var _0x47e78d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b99f3){_0x5ebe64[_0x0bd5('0x8')]=_0x1b99f3;}return db[_0x0bd5('0x9')][_0x0bd5('0xa')](_0x5ebe64,_0x47e78d);}function main(){var _0x5f5a0c=0x1388;var _0xa98f54;logger[_0x0bd5('0xb')](util['format'](_0x0bd5('0xc'),EXTRACTED_REPORT_ID,_0x0bd5('0xd')));return db['Setting'][_0x0bd5('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0bd5('0xf'),_0x0bd5('0x10')]})['then'](function(_0x2f7a0c){if(_0x2f7a0c){_0xa98f54=_0x2f7a0c;_0x5f5a0c=_0xa98f54[_0x0bd5('0x10')]||0x1388;}})[_0x0bd5('0x11')](function(){return dbH[_0x0bd5('0x12')][_0x0bd5('0x13')](util[_0x0bd5('0x14')](_0x0bd5('0x15'),QUERY),{'type':dbH[_0x0bd5('0x12')]['QueryTypes'][_0x0bd5('0x16')]});})[_0x0bd5('0x11')](function(_0x574315){if(!_0x574315[0x0][_0x0bd5('0x17')]){return analyticExtractedReport(_0x0bd5('0x18'));}var _0x3a34e4=[];var _0xc22553=0x0;var _0x55d565=!![];if(_0x574315&&_0x574315[_0x0bd5('0x19')]){var _0x2e4f36=_0x574315[0x0][_0x0bd5('0x17')]%(_0xc22553+_0x5f5a0c);if(_0xa98f54[_0x0bd5('0xf')]){for(;_0x55d565;_0xc22553+=_0x5f5a0c,_0x2e4f36=_0x574315[0x0][_0x0bd5('0x17')]%(_0xc22553+_0x5f5a0c)){if(_0x2e4f36==0x0||_0x2e4f36==_0x574315[0x0][_0x0bd5('0x17')]){_0x55d565=![];}_0x3a34e4[_0x0bd5('0x1a')](dbH[_0x0bd5('0x12')][_0x0bd5('0x13')](util[_0x0bd5('0x14')](_0x0bd5('0x1b'),QUERY,_0x5f5a0c,_0xc22553),{'type':dbH[_0x0bd5('0x12')][_0x0bd5('0x1c')][_0x0bd5('0x16')]}));}}else{_0x3a34e4['push'](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x0bd5('0x16')]}));}}var _0x86381d=path[_0x0bd5('0x1d')](PATH);var _0x4a6910=path[_0x0bd5('0x1e')](PATH,'.csv');var _0x440f85=_0xa98f54[_0x0bd5('0xf')]&&_0x3a34e4[_0x0bd5('0x19')]>0x1;var _0x5a8139=[];if(!fs[_0x0bd5('0x1f')](path['join'](_0x86381d,_0x4a6910))&&_0x440f85){fs['mkdirSync'](path[_0x0bd5('0x20')](_0x86381d,_0x4a6910));}return BPromise[_0x0bd5('0x21')](_0x3a34e4,function(_0x184db3){_0x5a8139['push'](_0x184db3);})[_0x0bd5('0x11')](function(){for(var _0x5eab3e=0x0;_0x5eab3e<_0x5a8139[_0x0bd5('0x19')];_0x5eab3e+=0x1){var _0x3ffb08;var _0x18cec3=_0x5a8139[_0x5eab3e];if(_0x440f85){_0x3ffb08=path[_0x0bd5('0x20')](_0x86381d,_0x4a6910,util[_0x0bd5('0x14')](_0x0bd5('0x22'),_0x4a6910,_0x5eab3e,_0x0bd5('0x23')));}else{_0x3ffb08=path[_0x0bd5('0x20')](_0x86381d,util[_0x0bd5('0x14')](_0x0bd5('0x24'),_0x4a6910,_0x0bd5('0x23')));}fs[_0x0bd5('0x25')](_0x3ffb08,csv(_0x18cec3));}})[_0x0bd5('0x11')](function(){if(_0x440f85){zipdir(path[_0x0bd5('0x20')](_0x86381d,_0x4a6910),{'saveTo':path['join'](_0x86381d,util[_0x0bd5('0x14')](_0x0bd5('0x24'),_0x4a6910,'zip'))},function(_0x20e6c3,_0x8eccc9){});rimraf(path['join'](_0x86381d,_0x4a6910),function(){});}})[_0x0bd5('0x11')](function(){logger[_0x0bd5('0xb')](util[_0x0bd5('0x14')](_0x0bd5('0x26'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x0bd5('0x27'),_0x440f85?util[_0x0bd5('0x14')](_0x0bd5('0x24'),_0x4a6910,_0x440f85?_0x0bd5('0x28'):_0x0bd5('0x23')):null);});})[_0x0bd5('0x29')](function(_0x58de46){logger[_0x0bd5('0xb')](util['format'](_0x0bd5('0x2a'),EXTRACTED_REPORT_ID,_0x0bd5('0xd')),util[_0x0bd5('0x2b')](_0x58de46,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0bd5('0x2c'));});}main(); \ No newline at end of file +var _0xb4e6=['splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','length','existsSync','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','CSV','inspect','Failed','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find'];(function(_0x41ed0b,_0x224822){var _0x4737dd=function(_0x41978a){while(--_0x41978a){_0x41ed0b['push'](_0x41ed0b['shift']());}};_0x4737dd(++_0x224822);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x34b87f,_0x28aef2){_0x34b87f=_0x34b87f-0x0;var _0x449805=_0xb4e6[_0x34b87f];return _0x449805;};'use strict';var util=require(_0x6b4e('0x0'));var path=require('path');var _=require(_0x6b4e('0x1'));var csv=require(_0x6b4e('0x2'));var fs=require('fs');var BPromise=require(_0x6b4e('0x3'));var zipdir=require(_0x6b4e('0x4'));var rimraf=require(_0x6b4e('0x5'));var db=require(_0x6b4e('0x6'))['db'];var dbH=require(_0x6b4e('0x6'))['dbH'];var logger=require(_0x6b4e('0x7'))(_0x6b4e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x6b4e('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6b4e('0x9')][0x4];function analyticExtractedReport(_0x570346,_0x4f00be){var _0x2311d9={'status':_0x570346};var _0x48c870={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f00be){_0x2311d9['savename']=_0x4f00be;}return db[_0x6b4e('0xa')][_0x6b4e('0xb')](_0x2311d9,_0x48c870);}function main(){var _0x1e3bf6=0x1388;var _0x39ed74;logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')](_0x6b4e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x6b4e('0xf')][_0x6b4e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6b4e('0x11')]})[_0x6b4e('0x12')](function(_0x432399){if(_0x432399){_0x39ed74=_0x432399;_0x1e3bf6=_0x39ed74[_0x6b4e('0x11')]||0x1388;}})[_0x6b4e('0x12')](function(){return dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](util['format'](_0x6b4e('0x15'),QUERY),{'type':dbH[_0x6b4e('0x13')]['QueryTypes'][_0x6b4e('0x16')]});})['then'](function(_0x355f10){if(!_0x355f10[0x0][_0x6b4e('0x17')]){return analyticExtractedReport(_0x6b4e('0x18'));}var _0x42e265=[];var _0x28c3ba=0x0;var _0x135568=!![];if(_0x355f10&&_0x355f10['length']){var _0x5775f4=_0x355f10[0x0][_0x6b4e('0x17')]%(_0x28c3ba+_0x1e3bf6);if(_0x39ed74[_0x6b4e('0x19')]){for(;_0x135568;_0x28c3ba+=_0x1e3bf6,_0x5775f4=_0x355f10[0x0][_0x6b4e('0x17')]%(_0x28c3ba+_0x1e3bf6)){if(_0x5775f4==0x0||_0x5775f4==_0x355f10[0x0][_0x6b4e('0x17')]){_0x135568=![];}_0x42e265[_0x6b4e('0x1a')](dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](util[_0x6b4e('0xd')](_0x6b4e('0x1b'),QUERY,_0x1e3bf6,_0x28c3ba),{'type':dbH[_0x6b4e('0x13')][_0x6b4e('0x1c')]['SELECT']}));}}else{_0x42e265[_0x6b4e('0x1a')](dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](QUERY,{'type':dbH[_0x6b4e('0x13')]['QueryTypes'][_0x6b4e('0x16')]}));}}var _0x507703=path[_0x6b4e('0x1d')](PATH);var _0x163dea=path[_0x6b4e('0x1e')](PATH,_0x6b4e('0x1f'));var _0xa06ccd=_0x39ed74[_0x6b4e('0x19')]&&_0x42e265[_0x6b4e('0x20')]>0x1;var _0x5c33be=[];if(!fs[_0x6b4e('0x21')](path['join'](_0x507703,_0x163dea))&&_0xa06ccd){fs[_0x6b4e('0x22')](path[_0x6b4e('0x23')](_0x507703,_0x163dea));}return BPromise[_0x6b4e('0x24')](_0x42e265,function(_0xdba4fe){_0x5c33be['push'](_0xdba4fe);})[_0x6b4e('0x12')](function(){for(var _0x3f72d7=0x0;_0x3f72d7<_0x5c33be['length'];_0x3f72d7+=0x1){var _0x32102f;var _0x381ff0=_0x5c33be[_0x3f72d7];if(_0xa06ccd){_0x32102f=path[_0x6b4e('0x23')](_0x507703,_0x163dea,util[_0x6b4e('0xd')]('%s%d.%s',_0x163dea,_0x3f72d7,_0x6b4e('0x25')));}else{_0x32102f=path[_0x6b4e('0x23')](_0x507703,util['format'](_0x6b4e('0x26'),_0x163dea,_0x6b4e('0x25')));}fs[_0x6b4e('0x27')](_0x32102f,csv(_0x381ff0));}})[_0x6b4e('0x12')](function(){if(_0xa06ccd){zipdir(path['join'](_0x507703,_0x163dea),{'saveTo':path[_0x6b4e('0x23')](_0x507703,util[_0x6b4e('0xd')]('%s.%s',_0x163dea,_0x6b4e('0x28')))},function(_0x3f9868,_0x37b636){});rimraf(path['join'](_0x507703,_0x163dea),function(){});}})['then'](function(){logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')](_0x6b4e('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x6b4e('0x2a'),_0xa06ccd?util[_0x6b4e('0xd')](_0x6b4e('0x26'),_0x163dea,_0xa06ccd?'zip':'csv'):null);});})[_0x6b4e('0x2b')](function(_0x4952ef){logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6b4e('0x2c')),util[_0x6b4e('0x2d')](_0x4952ef,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6b4e('0x2e'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index aeae148..0984a4c 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(_0x5d1466,_0x4d013c){var _0x48d11d=function(_0xc8f9ba){while(--_0xc8f9ba){_0x5d1466['push'](_0x5d1466['shift']());}};_0x48d11d(++_0x4d013c);}(_0xb10b,0x12a));var _0xbb10=function(_0x17efa3,_0x39ef4b){_0x17efa3=_0x17efa3-0x0;var _0x5caced=_0xb10b[_0x17efa3];return _0x5caced;};'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 _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x402675,_0x4fa7fb){var _0x1b176f=function(_0x73ee8b){while(--_0x73ee8b){_0x402675['push'](_0x402675['shift']());}};_0x1b176f(++_0x4fa7fb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 53a9c65..8fd4862 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 _0x47a9=['mkdirSync','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','info','format','XLSX','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','Empty','num','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','join'];(function(_0x10be87,_0x46f2ea){var _0x5c6f93=function(_0x2e7d1e){while(--_0x2e7d1e){_0x10be87['push'](_0x10be87['shift']());}};_0x5c6f93(++_0x46f2ea);}(_0x47a9,0x1e3));var _0x947a=function(_0xe5c902,_0x42b078){_0xe5c902=_0xe5c902-0x0;var _0x1be63c=_0x47a9[_0xe5c902];return _0x1be63c;};'use strict';var util=require(_0x947a('0x0'));var path=require(_0x947a('0x1'));var _=require(_0x947a('0x2'));var fs=require('fs');var json2xls=require(_0x947a('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x947a('0x4'));var rimraf=require(_0x947a('0x5'));var db=require(_0x947a('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x947a('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x947a('0x8')][0x2]);var QUERY=process[_0x947a('0x8')][0x3];var PATH=process[_0x947a('0x8')][0x4];function analyticExtractedReport(_0x4dacfa,_0x1cf7c6){var _0x56cd4a={'status':_0x4dacfa};var _0x3fe5dc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1cf7c6){_0x56cd4a[_0x947a('0x9')]=_0x1cf7c6;}return db[_0x947a('0xa')]['update'](_0x56cd4a,_0x3fe5dc);}function main(){var _0x335a06=0x1388;var _0x543800;logger[_0x947a('0xb')](util[_0x947a('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x947a('0xd')));return db[_0x947a('0xe')][_0x947a('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x947a('0x10'),_0x947a('0x11')]})[_0x947a('0x12')](function(_0x191249){if(_0x191249){_0x543800=_0x191249;_0x335a06=_0x543800[_0x947a('0x11')]||0x1388;}})[_0x947a('0x12')](function(){return dbH['sequelize'][_0x947a('0x13')](util[_0x947a('0xc')](_0x947a('0x14'),QUERY),{'type':dbH[_0x947a('0x15')][_0x947a('0x16')][_0x947a('0x17')]});})[_0x947a('0x12')](function(_0x4753be){if(!_0x4753be[0x0]['num']){return analyticExtractedReport(_0x947a('0x18'));}var _0x5c9b9c=[];var _0xb2d25e=0x0;var _0x4b88fa=!![];if(_0x543800['split']){if(_0x4753be&&_0x4753be['length']){var _0x28317b=_0x4753be[0x0][_0x947a('0x19')]%(_0xb2d25e+_0x335a06);for(;_0x4b88fa;_0xb2d25e+=_0x335a06,_0x28317b=_0x4753be[0x0][_0x947a('0x19')]%(_0xb2d25e+_0x335a06)){if(_0x28317b==0x0||_0x28317b==_0x4753be[0x0][_0x947a('0x19')]){_0x4b88fa=![];}_0x5c9b9c['push'](dbH[_0x947a('0x15')]['query'](util[_0x947a('0xc')](_0x947a('0x1a'),QUERY,_0x335a06,_0xb2d25e),{'type':dbH[_0x947a('0x15')][_0x947a('0x16')][_0x947a('0x17')]}));}}}else{_0x5c9b9c['push'](dbH[_0x947a('0x15')][_0x947a('0x13')](QUERY,{'type':dbH[_0x947a('0x15')][_0x947a('0x16')][_0x947a('0x17')]}));}var _0x2d9f4d=path[_0x947a('0x1b')](PATH);var _0x825e8=path[_0x947a('0x1c')](PATH,_0x947a('0x1d'));var _0x41c689=_0x543800['split']&&_0x5c9b9c[_0x947a('0x1e')]>0x1;var _0x5c81d1=[];if(!fs[_0x947a('0x1f')](path[_0x947a('0x20')](_0x2d9f4d,_0x825e8))&&_0x41c689){fs[_0x947a('0x21')](path[_0x947a('0x20')](_0x2d9f4d,_0x825e8));}return BPromise['each'](_0x5c9b9c,function(_0x1fd204){_0x5c81d1['push'](_0x1fd204);})['then'](function(){for(var _0xc53db3=0x0;_0xc53db3<_0x5c81d1['length'];_0xc53db3+=0x1){var _0x5751b3;var _0x45159c=_0x5c81d1[_0xc53db3];if(_0x41c689){_0x5751b3=path[_0x947a('0x20')](_0x2d9f4d,_0x825e8,util[_0x947a('0xc')]('%s%d.%s',_0x825e8,_0xc53db3,_0x947a('0x22')));}else{_0x5751b3=path[_0x947a('0x20')](_0x2d9f4d,util[_0x947a('0xc')](_0x947a('0x23'),_0x825e8,_0x947a('0x22')));}fs[_0x947a('0x24')](_0x5751b3,json2xls(_0x45159c),_0x947a('0x25'));}})[_0x947a('0x12')](function(){if(_0x41c689){zipdir(path['join'](_0x2d9f4d,_0x825e8),{'saveTo':path[_0x947a('0x20')](_0x2d9f4d,util[_0x947a('0xc')](_0x947a('0x23'),_0x825e8,_0x947a('0x26')))},function(_0x3e6aab,_0xf9bd3d){});rimraf(path[_0x947a('0x20')](_0x2d9f4d,_0x825e8),function(){});}})[_0x947a('0x12')](function(){logger[_0x947a('0xb')](util[_0x947a('0xc')](_0x947a('0x27'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x947a('0x28'),_0x41c689?util[_0x947a('0xc')]('%s.%s',_0x825e8,_0x41c689?_0x947a('0x26'):_0x947a('0x22')):null);});})[_0x947a('0x29')](function(_0x5dd46d){logger[_0x947a('0xb')](util[_0x947a('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x5dd46d,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x947a('0x2a'));});}main(); \ No newline at end of file +var _0x3a20=['binary','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','path','json2xls','zip-dir','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push','.xlsx','length','existsSync','mkdirSync','join','%s%d.%s','xlsx'];(function(_0xfbc3f6,_0x1bc879){var _0xf94268=function(_0x59aeb9){while(--_0x59aeb9){_0xfbc3f6['push'](_0xfbc3f6['shift']());}};_0xf94268(++_0x1bc879);}(_0x3a20,0xd0));var _0x03a2=function(_0x13c5f8,_0x19c801){_0x13c5f8=_0x13c5f8-0x0;var _0x86fa64=_0x3a20[_0x13c5f8];return _0x86fa64;};'use strict';var util=require('util');var path=require(_0x03a2('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x03a2('0x1'));var BPromise=require('bluebird');var zipdir=require(_0x03a2('0x2'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x03a2('0x3')];var logger=require('../../config/logger')(_0x03a2('0x4'));var EXTRACTED_REPORT_ID=Number(process[_0x03a2('0x5')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x03a2('0x5')][0x4];function analyticExtractedReport(_0x5cd7e5,_0x1e43c1){var _0x1e1a86={'status':_0x5cd7e5};var _0x28a6fe={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1e43c1){_0x1e1a86[_0x03a2('0x6')]=_0x1e43c1;}return db[_0x03a2('0x7')][_0x03a2('0x8')](_0x1e1a86,_0x28a6fe);}function main(){var _0x27a2e8=0x1388;var _0x23d23a;logger[_0x03a2('0x9')](util[_0x03a2('0xa')](_0x03a2('0xb'),EXTRACTED_REPORT_ID,_0x03a2('0xc')));return db[_0x03a2('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x03a2('0xe'),_0x03a2('0xf')]})[_0x03a2('0x10')](function(_0x5e58db){if(_0x5e58db){_0x23d23a=_0x5e58db;_0x27a2e8=_0x23d23a[_0x03a2('0xf')]||0x1388;}})[_0x03a2('0x10')](function(){return dbH[_0x03a2('0x11')][_0x03a2('0x12')](util[_0x03a2('0xa')](_0x03a2('0x13'),QUERY),{'type':dbH[_0x03a2('0x11')][_0x03a2('0x14')][_0x03a2('0x15')]});})['then'](function(_0x2e9bb9){if(!_0x2e9bb9[0x0]['num']){return analyticExtractedReport('Empty');}var _0x388272=[];var _0x4dff43=0x0;var _0x5e137b=!![];if(_0x23d23a['split']){if(_0x2e9bb9&&_0x2e9bb9['length']){var _0x13aa3e=_0x2e9bb9[0x0][_0x03a2('0x16')]%(_0x4dff43+_0x27a2e8);for(;_0x5e137b;_0x4dff43+=_0x27a2e8,_0x13aa3e=_0x2e9bb9[0x0]['num']%(_0x4dff43+_0x27a2e8)){if(_0x13aa3e==0x0||_0x13aa3e==_0x2e9bb9[0x0][_0x03a2('0x16')]){_0x5e137b=![];}_0x388272['push'](dbH[_0x03a2('0x11')][_0x03a2('0x12')](util['format'](_0x03a2('0x17'),QUERY,_0x27a2e8,_0x4dff43),{'type':dbH['sequelize'][_0x03a2('0x14')][_0x03a2('0x15')]}));}}}else{_0x388272[_0x03a2('0x18')](dbH[_0x03a2('0x11')][_0x03a2('0x12')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x03a2('0x15')]}));}var _0x1eb2a2=path['dirname'](PATH);var _0x563770=path['basename'](PATH,_0x03a2('0x19'));var _0x1afc90=_0x23d23a[_0x03a2('0xe')]&&_0x388272[_0x03a2('0x1a')]>0x1;var _0x11d0e2=[];if(!fs[_0x03a2('0x1b')](path['join'](_0x1eb2a2,_0x563770))&&_0x1afc90){fs[_0x03a2('0x1c')](path[_0x03a2('0x1d')](_0x1eb2a2,_0x563770));}return BPromise['each'](_0x388272,function(_0x12b95c){_0x11d0e2[_0x03a2('0x18')](_0x12b95c);})[_0x03a2('0x10')](function(){for(var _0x2cc5a2=0x0;_0x2cc5a2<_0x11d0e2[_0x03a2('0x1a')];_0x2cc5a2+=0x1){var _0x189484;var _0x46233a=_0x11d0e2[_0x2cc5a2];if(_0x1afc90){_0x189484=path[_0x03a2('0x1d')](_0x1eb2a2,_0x563770,util[_0x03a2('0xa')](_0x03a2('0x1e'),_0x563770,_0x2cc5a2,'xlsx'));}else{_0x189484=path[_0x03a2('0x1d')](_0x1eb2a2,util['format']('%s.%s',_0x563770,_0x03a2('0x1f')));}fs['writeFileSync'](_0x189484,json2xls(_0x46233a),_0x03a2('0x20'));}})[_0x03a2('0x10')](function(){if(_0x1afc90){zipdir(path['join'](_0x1eb2a2,_0x563770),{'saveTo':path[_0x03a2('0x1d')](_0x1eb2a2,util[_0x03a2('0xa')](_0x03a2('0x21'),_0x563770,'zip'))},function(_0x63273b,_0xbf4109){});rimraf(path['join'](_0x1eb2a2,_0x563770),function(){});}})[_0x03a2('0x10')](function(){logger[_0x03a2('0x9')](util[_0x03a2('0xa')](_0x03a2('0x22'),EXTRACTED_REPORT_ID,_0x03a2('0xc')));return analyticExtractedReport(_0x03a2('0x23'),_0x1afc90?util['format'](_0x03a2('0x21'),_0x563770,_0x1afc90?_0x03a2('0x24'):'xlsx'):null);});})[_0x03a2('0x25')](function(_0xc17e40){logger[_0x03a2('0x9')](util[_0x03a2('0xa')](_0x03a2('0x26'),EXTRACTED_REPORT_ID,_0x03a2('0xc')),util['inspect'](_0xc17e40,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x03a2('0x27'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d5f43ae..c8e587f 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 _0x8144=['interval','*,*,*,*','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','Hangup','concat','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','type','Set','CDR(type)=%s','VoiceExtensionId','push','CDR(destination)=','cutdigits','CDR(routeid)=','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt'];(function(_0x3cf0e1,_0x1b14b6){var _0x8f6b8c=function(_0x33f5f5){while(--_0x33f5f5){_0x3cf0e1['push'](_0x3cf0e1['shift']());}};_0x8f6b8c(++_0x1b14b6);}(_0x8144,0xf5));var _0x4814=function(_0x1bc41f,_0x2e6cd7){_0x1bc41f=_0x1bc41f-0x0;var _0x1f7025=_0x8144[_0x1bc41f];return _0x1f7025;};'use strict';var _=require(_0x4814('0x0'));var util=require(_0x4814('0x1'));function rewrite(_0x5a0fcc,_0x2d340d){var _0x4561ea=this;return _0x5a0fcc['models'][_0x4814('0x2')][_0x4814('0x3')]({'raw':!![]})[_0x4814('0x4')](function(_0x15cd8){_0x4561ea[_0x4814('0x5')]=_0x15cd8;return _0x5a0fcc[_0x4814('0x6')][_0x4814('0x7')]['findAll']({'where':{'IntervalId':_0x2d340d[_0x4814('0x8')]},'raw':!![]});})[_0x4814('0x4')](function(_0x4a73b6){return _0x5a0fcc[_0x4814('0x6')]['VoiceExtension'][_0x4814('0x3')]({'where':{'exten':{'$in':_[_0x4814('0x9')](_[_0x4814('0xa')](_0x4a73b6,_0x4814('0xb')))}},'order':[{'raw':_0x4814('0xc')}],'raw':!![]});})[_0x4814('0x4')](function(_0x13ec1f){var _0x2286c5=_[_0x4814('0xd')](_0x13ec1f,{'priority':'1'});var _0x168024=_[_0x4814('0xd')](_0x13ec1f,{'isApp':0x1});var _0x352126=_[_0x4814('0xe')](_0x168024,_0x4814('0xb'));var _0x5a60ec=[_0x4814('0xf'),_0x4814('0x10')];var _0x105395=[];var _0x54ddcb=[];for(var _0x1e165c in _0x352126){if(_0x352126['hasOwnProperty'](_0x1e165c)){_0x4561ea[_0x4814('0x11')]=0x2;_0x4561ea[_0x4814('0x12')]=[];_0x4561ea[_0x4814('0x13')]=_[_0x4814('0x14')](_0x2286c5,{'exten':_0x352126[_0x1e165c][0x0][_0x4814('0xb')]});_0x4561ea['extensions']['push']({'type':_0x352126[_0x1e165c][0x0][_0x4814('0x15')],'app':_0x4814('0x16'),'appdata':util['format'](_0x4814('0x17'),_0x352126[_0x1e165c][0x0][_0x4814('0x15')]),'context':_0x352126[_0x1e165c][0x0]['context'],'exten':_0x352126[_0x1e165c][0x0][_0x4814('0xb')],'priority':_0x4561ea[_0x4814('0x11')]++,'VoiceExtensionId':_0x352126[_0x1e165c][0x0][_0x4814('0x18')]});if(_0x352126[_0x1e165c][0x0][_0x4814('0x15')]==='outbound'){if(_0x4561ea[_0x4814('0x13')]){_0x4561ea[_0x4814('0x12')][_0x4814('0x19')]({'type':_0x352126[_0x1e165c][0x0][_0x4814('0x15')],'app':_0x4814('0x16'),'appdata':_0x4814('0x1a')+(_0x4561ea[_0x4814('0x13')][_0x4814('0x1b')]?'${EXTEN:'+_0x4561ea[_0x4814('0x13')]['cutdigits']+'}':'${EXTEN}'),'context':_0x352126[_0x1e165c][0x0]['context'],'exten':_0x352126[_0x1e165c][0x0][_0x4814('0xb')],'priority':_0x4561ea[_0x4814('0x11')]++,'VoiceExtensionId':_0x352126[_0x1e165c][0x0][_0x4814('0x18')]});}_0x4561ea['extensions'][_0x4814('0x19')]({'type':_0x352126[_0x1e165c][0x0][_0x4814('0x15')],'app':_0x4814('0x16'),'appdata':_0x4814('0x1c')+_0x352126[_0x1e165c][0x0]['VoiceExtensionId'],'context':_0x352126[_0x1e165c][0x0][_0x4814('0x1d')],'exten':_0x352126[_0x1e165c][0x0][_0x4814('0xb')],'priority':_0x4561ea['priority']++,'VoiceExtensionId':_0x352126[_0x1e165c][0x0][_0x4814('0x18')]});var _0x50b10f=_0x4561ea[_0x4814('0x11')]++;_0x4561ea[_0x4814('0x12')][_0x4814('0x19')]({'type':_0x352126[_0x1e165c][0x0][_0x4814('0x15')],'app':_0x4814('0x1e'),'appdata':_0x4814('0x1f')+(_0x50b10f+0x2)+_0x4814('0x20')+(_0x50b10f+0x1)+')','context':_0x352126[_0x1e165c][0x0][_0x4814('0x1d')],'exten':_0x352126[_0x1e165c][0x0][_0x4814('0xb')],'priority':_0x50b10f,'VoiceExtensionId':_0x352126[_0x1e165c][0x0]['VoiceExtensionId']});if(_0x4561ea['extension']){_0x4561ea[_0x4814('0x12')][_0x4814('0x19')]({'type':_0x352126[_0x1e165c][0x0][_0x4814('0x15')],'app':_0x4814('0x16'),'appdata':_0x4561ea[_0x4814('0x13')][_0x4814('0x1b')]?_0x4814('0x21')+_0x4561ea['extension'][_0x4814('0x1b')]+'}':_0x4814('0x22'),'context':_0x352126[_0x1e165c][0x0]['context'],'exten':_0x352126[_0x1e165c][0x0][_0x4814('0xb')],'priority':_0x4561ea[_0x4814('0x11')]++,'VoiceExtensionId':_0x352126[_0x1e165c][0x0]['VoiceExtensionId']});}_0x4561ea[_0x4814('0x12')]['push']({'type':_0x352126[_0x1e165c][0x0][_0x4814('0x15')],'app':_0x4814('0x16'),'appdata':_0x4814('0x23')+_0x352126[_0x1e165c][0x0][_0x4814('0x18')],'context':_0x352126[_0x1e165c][0x0]['context'],'exten':_0x352126[_0x1e165c][0x0][_0x4814('0xb')],'priority':_0x4561ea[_0x4814('0x11')]++,'VoiceExtensionId':_0x352126[_0x1e165c][0x0][_0x4814('0x18')]});if(_0x4561ea[_0x4814('0x13')]&&_0x4561ea['extension'][_0x4814('0x24')](_0x4814('0x25'))&&_0x4561ea[_0x4814('0x13')][_0x4814('0x25')]!==_0x4814('0x26')){_0x4561ea[_0x4814('0x12')][_0x4814('0x19')]({'type':_0x352126[_0x1e165c][0x0][_0x4814('0x15')],'app':_0x4814('0x16'),'appdata':_0x4814('0x27'),'context':_0x352126[_0x1e165c][0x0][_0x4814('0x1d')],'exten':_0x352126[_0x1e165c][0x0][_0x4814('0xb')],'priority':_0x4561ea[_0x4814('0x11')]++,'VoiceExtensionId':_0x352126[_0x1e165c][0x0][_0x4814('0x18')]});_0x4561ea[_0x4814('0x12')][_0x4814('0x19')]({'type':_0x352126[_0x1e165c][0x0]['type'],'app':_0x4814('0x16'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4561ea['extension'][_0x4814('0x25')]||_0x4814('0x28'),'context':_0x352126[_0x1e165c][0x0][_0x4814('0x1d')],'exten':_0x352126[_0x1e165c][0x0][_0x4814('0xb')],'priority':_0x4561ea[_0x4814('0x11')]++,'VoiceExtensionId':_0x352126[_0x1e165c][0x0][_0x4814('0x18')]});}}_0x4561ea[_0x4814('0x12')][_0x4814('0x19')]({'type':_0x352126[_0x1e165c][0x0][_0x4814('0x15')],'app':'Set','appdata':_0x4814('0x29'),'context':_0x352126[_0x1e165c][0x0][_0x4814('0x1d')],'exten':_0x352126[_0x1e165c][0x0]['exten'],'priority':_0x4561ea[_0x4814('0x11')]++,'VoiceExtensionId':_0x352126[_0x1e165c][0x0][_0x4814('0x18')]});_0x4561ea['extensions'][_0x4814('0x19')]({'type':_0x352126[_0x1e165c][0x0][_0x4814('0x15')],'app':_0x4814('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x352126[_0x1e165c][0x0][_0x4814('0x1d')],'exten':_0x352126[_0x1e165c][0x0][_0x4814('0xb')],'priority':_0x4561ea[_0x4814('0x11')]++,'VoiceExtensionId':_0x352126[_0x1e165c][0x0][_0x4814('0x18')]});_0x4561ea[_0x4814('0x12')][_0x4814('0x19')]({'type':_0x352126[_0x1e165c][0x0][_0x4814('0x15')],'app':_0x4814('0x16'),'appdata':_0x4814('0x2a'),'context':_0x352126[_0x1e165c][0x0][_0x4814('0x1d')],'exten':_0x352126[_0x1e165c][0x0]['exten'],'priority':_0x4561ea[_0x4814('0x11')]++,'VoiceExtensionId':_0x352126[_0x1e165c][0x0][_0x4814('0x18')]});for(var _0x33eca5=0x0,_0xbd7457=0x0;_0x33eca5<_0x352126[_0x1e165c][_0x4814('0x2b')];_0x33eca5+=0x1,_0xbd7457=0x0){var _0x5f472e=_0x352126[_0x1e165c][_0x33eca5];if(_0x5f472e['type']){_0x5f472e['type']=_0x5f472e[_0x4814('0x15')][_0x4814('0x2c')]();}var _0x3f0b2d=[];var _0x3e10f0=[];delete _0x5f472e['id'];delete _0x5f472e[_0x4814('0x2d')];delete _0x5f472e[_0x4814('0x2e')];var _0x5d8868=_0x5f472e[_0x4814('0x2f')]!==_0x4814('0x30')?[_0x5f472e[_0x4814('0x2f')]]:_0x5f472e[_0x4814('0x8')]?_[_0x4814('0xa')](_[_0x4814('0xd')](_0x4561ea[_0x4814('0x5')],{'IntervalId':_0x5f472e[_0x4814('0x8')]}),_0x4814('0x2f')):[];if(_0x5f472e['hasOwnProperty'](_0x4814('0x31'))){if(_0x5f472e[_0x4814('0x31')]&&_0x5f472e[_0x4814('0x31')]!=='--'){_0x3f0b2d[_0x4814('0x19')]({'type':_0x5f472e[_0x4814('0x15')],'app':_0x4814('0x16'),'appdata':_0x4814('0x32')+_0x5f472e[_0x4814('0x31')],'context':_0x5f472e['context'],'exten':_0x5f472e[_0x4814('0xb')],'priority':_0x5d8868[_0x4814('0x2b')]+_0x4561ea[_0x4814('0x11')]+_0xbd7457++,'VoiceExtensionId':_0x5f472e[_0x4814('0x18')]});}}if(_0x5f472e[_0x4814('0x15')]===_0x4814('0x33')&&_0x5f472e[_0x4814('0x24')](_0x4814('0x34'))){if(_0x5f472e[_0x4814('0x34')]){_0x3f0b2d['push']({'type':_0x5f472e[_0x4814('0x15')],'app':_0x4814('0x1e'),'appdata':_0x4814('0x35')+_0x5f472e[_0x4814('0x34')]+')','context':_0x5f472e[_0x4814('0x1d')],'exten':_0x5f472e[_0x4814('0xb')],'priority':_0x5d8868[_0x4814('0x2b')]+_0x4561ea[_0x4814('0x11')]+_0xbd7457++,'VoiceExtensionId':_0x5f472e[_0x4814('0x18')]});}else{_0x3f0b2d[_0x4814('0x19')]({'type':_0x5f472e['type'],'app':_0x4814('0x1e'),'appdata':_0x4814('0x36'),'context':_0x5f472e[_0x4814('0x1d')],'exten':_0x5f472e[_0x4814('0xb')],'priority':_0x5d8868['length']+_0x4561ea[_0x4814('0x11')]+_0xbd7457++,'VoiceExtensionId':_0x5f472e[_0x4814('0x18')]});}}if(_0x5f472e[_0x4814('0x24')](_0x4814('0x37'))){if(_0x5a60ec['indexOf'](_0x5f472e[_0x4814('0x38')]['toLowerCase']())>=0x0&&_0x5f472e[_0x4814('0x39')]!==_0x4814('0x3a')){if(_0x5f472e[_0x4814('0x37')]){_0x3f0b2d[_0x4814('0x19')]({'type':_0x5f472e[_0x4814('0x15')],'app':_0x4814('0x1e'),'appdata':_0x4814('0x3b'),'context':_0x5f472e['context'],'exten':_0x5f472e[_0x4814('0xb')],'priority':_0x5d8868[_0x4814('0x2b')]+_0x4561ea[_0x4814('0x11')]+_0xbd7457++,'VoiceExtensionId':_0x5f472e['VoiceExtensionId']});_0x3f0b2d['push']({'type':_0x5f472e[_0x4814('0x15')],'app':_0x4814('0x16'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5f472e[_0x4814('0x1d')],'exten':_0x5f472e[_0x4814('0xb')],'priority':_0x5d8868[_0x4814('0x2b')]+_0x4561ea[_0x4814('0x11')]+_0xbd7457++,'VoiceExtensionId':_0x5f472e[_0x4814('0x18')]});}else{_0x3f0b2d[_0x4814('0x19')]({'type':_0x5f472e[_0x4814('0x15')],'app':_0x4814('0x1e'),'appdata':_0x4814('0x3c'),'context':_0x5f472e[_0x4814('0x1d')],'exten':_0x5f472e['exten'],'priority':_0x5d8868[_0x4814('0x2b')]+_0x4561ea['priority']+_0xbd7457++,'VoiceExtensionId':_0x5f472e[_0x4814('0x18')]});_0x3f0b2d[_0x4814('0x19')]({'type':_0x5f472e[_0x4814('0x15')],'app':_0x4814('0x16'),'appdata':_0x4814('0x3d'),'context':_0x5f472e[_0x4814('0x1d')],'exten':_0x5f472e['exten'],'priority':_0x5d8868[_0x4814('0x2b')]+_0x4561ea[_0x4814('0x11')]+_0xbd7457++,'VoiceExtensionId':_0x5f472e[_0x4814('0x18')]});}}}for(var _0x42f271=0x0;_0x42f271<_0x5d8868[_0x4814('0x2b')];_0x42f271+=0x1){var _0x2c0efc=_0x4561ea['priority']+_0x5d8868[_0x4814('0x2b')];var _0x31ad6a=_0x42f271===_0x5d8868[_0x4814('0x2b')]-0x1?_0x4561ea['priority']+_0x3f0b2d[_0x4814('0x2b')]+_0x3e10f0[_0x4814('0x2b')]+0x2:_0x4561ea['priority']+_0x42f271+0x1;_0x3f0b2d[_0x4814('0x3e')](_0x42f271,0x0,{'type':_0x5f472e[_0x4814('0x15')],'app':_0x4814('0x3f'),'appdata':_0x5d8868[_0x42f271]+'?'+_0x5f472e[_0x4814('0x1d')]+',${EXTEN},'+_0x2c0efc+':'+_0x5f472e['context']+',${EXTEN},'+_0x31ad6a,'exten':_0x5f472e[_0x4814('0xb')],'context':_0x5f472e['context'],'priority':_0x4561ea['priority']+_0x42f271,'VoiceExtensionId':_0x352126[_0x1e165c][0x0]['VoiceExtensionId']});}_0x5f472e['priority']=_0x3f0b2d[_0x4814('0x2b')]?_[_0x4814('0x40')](_0x3f0b2d)['priority']+0x1:_0x4561ea[_0x4814('0x11')];_0x4561ea['priority']=(_0x3e10f0[_0x4814('0x2b')]?_[_0x4814('0x40')](_0x3e10f0)[_0x4814('0x11')]:_0x5f472e['priority'])+0x1;_0x4561ea[_0x4814('0x12')]=_['concat'](_0x4561ea[_0x4814('0x12')],_0x3f0b2d,[_0x5f472e],_0x3e10f0);}_0x4561ea['extensions'][_0x4814('0x19')]({'type':_0x352126[_0x1e165c][0x0][_0x4814('0x15')],'app':_0x4814('0x41'),'exten':_0x352126[_0x1e165c][0x0][_0x4814('0xb')],'context':_0x352126[_0x1e165c][0x0]['context'],'priority':_0x4561ea[_0x4814('0x11')],'VoiceExtensionId':_0x352126[_0x1e165c][0x0][_0x4814('0x18')]});_0x105395[_0x4814('0x19')](_0x352126[_0x1e165c][0x0]['VoiceExtensionId']);_0x54ddcb=_[_0x4814('0x42')](_0x54ddcb,_0x4561ea['extensions']);}}return _0x5a0fcc[_0x4814('0x43')](function(_0x4cd2d5){return _0x5a0fcc['models'][_0x4814('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x105395}},'transaction':_0x4cd2d5})[_0x4814('0x4')](function(_0x163024){return _0x5a0fcc[_0x4814('0x6')][_0x4814('0x7')][_0x4814('0x44')](_[_0x4814('0x45')](_0x54ddcb,'priority'),{'transaction':_0x4cd2d5});});});})[_0x4814('0x46')](function(_0x2b72ab){console[_0x4814('0x47')](_0x2b72ab);});}exports[_0x4814('0x48')]=rewrite; \ No newline at end of file +var _0x9965=['cutdigits','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','length','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','error','rewrite','lodash','util','Interval','findAll','then','intervals','models','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','find','push','type','Set','CDR(type)=%s','context','priority','VoiceExtensionId','extension','extensions','CDR(destination)='];(function(_0x25c6f7,_0x16570d){var _0x40572c=function(_0x594c81){while(--_0x594c81){_0x25c6f7['push'](_0x25c6f7['shift']());}};_0x40572c(++_0x16570d);}(_0x9965,0xf4));var _0x5996=function(_0x315e2d,_0x2ae61e){_0x315e2d=_0x315e2d-0x0;var _0x24b5bc=_0x9965[_0x315e2d];return _0x24b5bc;};'use strict';var _=require(_0x5996('0x0'));var util=require(_0x5996('0x1'));function rewrite(_0xd24d63,_0x24fc61){var _0x2bbab2=this;return _0xd24d63['models'][_0x5996('0x2')][_0x5996('0x3')]({'raw':!![]})[_0x5996('0x4')](function(_0x1ed436){_0x2bbab2[_0x5996('0x5')]=_0x1ed436;return _0xd24d63[_0x5996('0x6')]['VoiceExtension'][_0x5996('0x3')]({'where':{'IntervalId':_0x24fc61[_0x5996('0x7')]},'raw':!![]});})[_0x5996('0x4')](function(_0x20491b){return _0xd24d63[_0x5996('0x6')][_0x5996('0x8')][_0x5996('0x3')]({'where':{'exten':{'$in':_[_0x5996('0x9')](_[_0x5996('0xa')](_0x20491b,_0x5996('0xb')))}},'order':[{'raw':_0x5996('0xc')}],'raw':!![]});})['then'](function(_0x1c39ee){var _0x31c7a9=_[_0x5996('0xd')](_0x1c39ee,{'priority':'1'});var _0xde731f=_[_0x5996('0xd')](_0x1c39ee,{'isApp':0x1});var _0x1422b0=_[_0x5996('0xe')](_0xde731f,_0x5996('0xb'));var _0x2e83c9=['queue',_0x5996('0xf')];var _0x25fb76=[];var _0x202d6a=[];for(var _0x1af162 in _0x1422b0){if(_0x1422b0[_0x5996('0x10')](_0x1af162)){_0x2bbab2['priority']=0x2;_0x2bbab2['extensions']=[];_0x2bbab2['extension']=_[_0x5996('0x11')](_0x31c7a9,{'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')]});_0x2bbab2['extensions'][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':util['format'](_0x5996('0x15'),_0x1422b0[_0x1af162][0x0]['type']),'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2[_0x5996('0x17')]++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});if(_0x1422b0[_0x1af162][0x0][_0x5996('0x13')]==='outbound'){if(_0x2bbab2[_0x5996('0x19')]){_0x2bbab2[_0x5996('0x1a')]['push']({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':_0x5996('0x1b')+(_0x2bbab2[_0x5996('0x19')][_0x5996('0x1c')]?'${EXTEN:'+_0x2bbab2[_0x5996('0x19')][_0x5996('0x1c')]+'}':'${EXTEN}'),'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0]['exten'],'priority':_0x2bbab2[_0x5996('0x17')]++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});}_0x2bbab2[_0x5996('0x1a')]['push']({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':_0x5996('0x1d')+_0x1422b0[_0x1af162][0x0][_0x5996('0x18')],'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2['priority']++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});var _0x10c7b5=_0x2bbab2[_0x5996('0x17')]++;_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x10c7b5+0x2)+_0x5996('0x1f')+(_0x10c7b5+0x1)+')','context':_0x1422b0[_0x1af162][0x0]['context'],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x10c7b5,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});if(_0x2bbab2[_0x5996('0x19')]){_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':_0x2bbab2[_0x5996('0x19')][_0x5996('0x1c')]?_0x5996('0x20')+_0x2bbab2[_0x5996('0x19')]['cutdigits']+'}':_0x5996('0x21'),'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2['priority']++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});}_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':'Set','appdata':_0x5996('0x22')+_0x1422b0[_0x1af162][0x0][_0x5996('0x18')],'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0]['exten'],'priority':_0x2bbab2['priority']++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});if(_0x2bbab2[_0x5996('0x19')]&&_0x2bbab2[_0x5996('0x19')][_0x5996('0x10')]('recordingFormat')&&_0x2bbab2[_0x5996('0x19')][_0x5996('0x23')]!==_0x5996('0x24')){_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':_0x5996('0x25'),'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2['priority']++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2bbab2[_0x5996('0x19')][_0x5996('0x23')]||_0x5996('0x26'),'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2['priority']++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});}}_0x2bbab2['extensions'][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':_0x5996('0x27'),'context':_0x1422b0[_0x1af162][0x0]['context'],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2[_0x5996('0x17')]++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2['priority']++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});_0x2bbab2['extensions']['push']({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':_0x5996('0x28'),'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2[_0x5996('0x17')]++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});for(var _0x200b30=0x0,_0x2c9a0e=0x0;_0x200b30<_0x1422b0[_0x1af162]['length'];_0x200b30+=0x1,_0x2c9a0e=0x0){var _0x23ec71=_0x1422b0[_0x1af162][_0x200b30];if(_0x23ec71['type']){_0x23ec71[_0x5996('0x13')]=_0x23ec71[_0x5996('0x13')][_0x5996('0x29')]();}var _0xf018b0=[];var _0x43c8e0=[];delete _0x23ec71['id'];delete _0x23ec71[_0x5996('0x2a')];delete _0x23ec71[_0x5996('0x2b')];var _0x3adcdc=_0x23ec71[_0x5996('0x2c')]!=='*,*,*,*'?[_0x23ec71[_0x5996('0x2c')]]:_0x23ec71[_0x5996('0x7')]?_['map'](_[_0x5996('0xd')](_0x2bbab2['intervals'],{'IntervalId':_0x23ec71[_0x5996('0x7')]}),_0x5996('0x2c')):[];if(_0x23ec71[_0x5996('0x10')](_0x5996('0x2d'))){if(_0x23ec71[_0x5996('0x2d')]&&_0x23ec71[_0x5996('0x2d')]!=='--'){_0xf018b0[_0x5996('0x12')]({'type':_0x23ec71['type'],'app':'Set','appdata':_0x5996('0x2e')+_0x23ec71[_0x5996('0x2d')],'context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71[_0x5996('0xb')],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2['priority']+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71[_0x5996('0x18')]});}}if(_0x23ec71['type']===_0x5996('0x30')&&_0x23ec71[_0x5996('0x10')](_0x5996('0x31'))){if(_0x23ec71['callerID']){_0xf018b0[_0x5996('0x12')]({'type':_0x23ec71['type'],'app':_0x5996('0x1e'),'appdata':_0x5996('0x32')+_0x23ec71[_0x5996('0x31')]+')','context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71[_0x5996('0xb')],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2['priority']+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71[_0x5996('0x18')]});}else{_0xf018b0[_0x5996('0x12')]({'type':_0x23ec71['type'],'app':_0x5996('0x1e'),'appdata':_0x5996('0x33'),'context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71[_0x5996('0xb')],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2['priority']+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71['VoiceExtensionId']});}}if(_0x23ec71[_0x5996('0x10')](_0x5996('0x34'))){if(_0x2e83c9['indexOf'](_0x23ec71[_0x5996('0x35')][_0x5996('0x29')]())>=0x0&&_0x23ec71[_0x5996('0x36')]!==_0x5996('0x37')){if(_0x23ec71[_0x5996('0x34')]){_0xf018b0[_0x5996('0x12')]({'type':_0x23ec71[_0x5996('0x13')],'app':_0x5996('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71[_0x5996('0xb')],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2[_0x5996('0x17')]+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71[_0x5996('0x18')]});_0xf018b0[_0x5996('0x12')]({'type':_0x23ec71[_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71['exten'],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2[_0x5996('0x17')]+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71[_0x5996('0x18')]});}else{_0xf018b0['push']({'type':_0x23ec71[_0x5996('0x13')],'app':_0x5996('0x1e'),'appdata':_0x5996('0x38'),'context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71['exten'],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2[_0x5996('0x17')]+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71[_0x5996('0x18')]});_0xf018b0[_0x5996('0x12')]({'type':_0x23ec71['type'],'app':_0x5996('0x14'),'appdata':_0x5996('0x39'),'context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71['exten'],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2[_0x5996('0x17')]+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71[_0x5996('0x18')]});}}}for(var _0x1ebb66=0x0;_0x1ebb66<_0x3adcdc[_0x5996('0x2f')];_0x1ebb66+=0x1){var _0x429f7d=_0x2bbab2['priority']+_0x3adcdc[_0x5996('0x2f')];var _0x56851a=_0x1ebb66===_0x3adcdc['length']-0x1?_0x2bbab2[_0x5996('0x17')]+_0xf018b0['length']+_0x43c8e0[_0x5996('0x2f')]+0x2:_0x2bbab2[_0x5996('0x17')]+_0x1ebb66+0x1;_0xf018b0[_0x5996('0x3a')](_0x1ebb66,0x0,{'type':_0x23ec71['type'],'app':_0x5996('0x3b'),'appdata':_0x3adcdc[_0x1ebb66]+'?'+_0x23ec71['context']+_0x5996('0x3c')+_0x429f7d+':'+_0x23ec71[_0x5996('0x16')]+_0x5996('0x3c')+_0x56851a,'exten':_0x23ec71[_0x5996('0xb')],'context':_0x23ec71['context'],'priority':_0x2bbab2[_0x5996('0x17')]+_0x1ebb66,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0]['VoiceExtensionId']});}_0x23ec71[_0x5996('0x17')]=_0xf018b0[_0x5996('0x2f')]?_[_0x5996('0x3d')](_0xf018b0)[_0x5996('0x17')]+0x1:_0x2bbab2[_0x5996('0x17')];_0x2bbab2[_0x5996('0x17')]=(_0x43c8e0[_0x5996('0x2f')]?_[_0x5996('0x3d')](_0x43c8e0)[_0x5996('0x17')]:_0x23ec71[_0x5996('0x17')])+0x1;_0x2bbab2[_0x5996('0x1a')]=_['concat'](_0x2bbab2['extensions'],_0xf018b0,[_0x23ec71],_0x43c8e0);}_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x3e'),'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'priority':_0x2bbab2[_0x5996('0x17')],'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});_0x25fb76[_0x5996('0x12')](_0x1422b0[_0x1af162][0x0]['VoiceExtensionId']);_0x202d6a=_[_0x5996('0x3f')](_0x202d6a,_0x2bbab2['extensions']);}}return _0xd24d63['transaction'](function(_0x493ff0){return _0xd24d63['models'][_0x5996('0x8')][_0x5996('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x25fb76}},'transaction':_0x493ff0})['then'](function(_0x37d342){return _0xd24d63[_0x5996('0x6')][_0x5996('0x8')][_0x5996('0x41')](_['sortBy'](_0x202d6a,_0x5996('0x17')),{'transaction':_0x493ff0});});});})['catch'](function(_0x220489){console[_0x5996('0x42')](_0x220489);});}exports[_0x5996('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index eb6cef5..6227822 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 _0xe706=['toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','insert','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','VoiceQueueId','catch','onlyIfOpen','query','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','split','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()'];(function(_0x186c13,_0x4e0065){var _0x2df80e=function(_0x15e1f0){while(--_0x15e1f0){_0x186c13['push'](_0x186c13['shift']());}};_0x2df80e(++_0x4e0065);}(_0xe706,0xa3));var _0x6e70=function(_0x5c65ee,_0x57b017){_0x5c65ee=_0x5c65ee-0x0;var _0x4b8689=_0xe706[_0x5c65ee];return _0x4b8689;};'use strict';var BPromise=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var socket=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));require(_0x6e70('0xd'))[_0x6e70('0xe')](socket);try{if(!process[_0x6e70('0xf')][0x2]||process[_0x6e70('0xf')][0x2]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x2]===_0x6e70('0x11')){throw new Error(_0x6e70('0x12'));}var FILEPATH=process[_0x6e70('0xf')][0x2];if(!process[_0x6e70('0xf')][0x3]||process[_0x6e70('0xf')][0x3]===_0x6e70('0x10')||process['argv'][0x3]==='null'||!process[_0x6e70('0xf')][0x4]||process[_0x6e70('0xf')][0x4]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x4]===_0x6e70('0x11')){throw new Error(_0x6e70('0x13'));}var FIELDS=_[_0x6e70('0x14')](process[_0x6e70('0xf')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x6e70('0xf')][0x5]||process['argv'][0x5]==='undefined'||process[_0x6e70('0xf')][0x5]===_0x6e70('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x6e70('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x6e70('0xf')][0x6]!==_0x6e70('0x10')&&process['argv'][0x6]!=='null'?process[_0x6e70('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x6e70('0xf')][0x7]!==_0x6e70('0x10')&&process['argv'][0x7]!=='null'?process[_0x6e70('0xf')][0x7]:null;if(!process[_0x6e70('0xf')][0x8]||process[_0x6e70('0xf')][0x8]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x8]===_0x6e70('0x11')){throw new Error(_0x6e70('0x15'));}var SOCKET_TIMESTAMP=process[_0x6e70('0xf')][0x8];}catch(_0x29326f){logger[_0x6e70('0x16')](_0x29326f);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(_0x4a0cfe,_0x228350,_0x344b65,_0x27b294){var _0x502b2d={'message':_0x228350};_0x502b2d[_0x4a0cfe]=!![];if(_0x344b65){_0x502b2d[_0x6e70('0x17')]=_0x344b65;}if(_0x27b294){_0x502b2d[_0x6e70('0x18')]=_0x27b294;}return _0x502b2d;}function isEmail(_0x3337a6){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'](_0x3337a6);}function checkRow(_0x10fc91,_0x538b9c,_0x50aec2){return new BPromise(function(_0x4e97c7,_0x41e352){if(_[_0x6e70('0x19')](_0x10fc91)){return _0x41e352(handleCheckRowError('error',_0x6e70('0x1a'),null,_0x50aec2));}if(_0x10fc91[_0x6e70('0x1b')]&&_0x10fc91['errors'][_0x6e70('0x1c')]){var _0x67fb43=_[_0x6e70('0x1d')](_0x10fc91['errors'],'message')[_0x6e70('0x1e')](';');return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x67fb43,null,_0x50aec2));}var _0x83c836={};for(var _0x114344 in FIELDS){if(FIELDS[_0x6e70('0x1f')](_0x114344)&&FIELDS[_0x114344]){_0x83c836[_0x114344]=_0x10fc91['data'][0x0][FIELDS[_0x114344]]||_0x10fc91[_0x6e70('0x20')][0x0]['\ufeff'+FIELDS[_0x114344]];}}if(!_0x83c836[_0x6e70('0x21')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x22'),null,_0x50aec2));}if(!_0x83c836[_0x6e70('0x23')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x24'),null,_0x50aec2));}if(_0x83c836[_0x6e70('0x25')]){var _0x3a0821=moment(_0x83c836[_0x6e70('0x25')],'YYYY-MM-DD');if(!_0x3a0821[_0x6e70('0x26')]()){return _0x41e352(handleCheckRowError('error',_0x6e70('0x27'),null,_0x50aec2));}}if(_0x83c836['email']){if(!isEmail(_0x83c836[_0x6e70('0x28')])){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x29'),null,_0x50aec2));}}_0x83c836['ListId']=LISTID;_0x83c836[_0x6e70('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){var _0x5780a1={};for(var _0x13d673=0x0,_0x154925=DUPLICATES['length'];_0x13d673<_0x154925;_0x13d673+=0x1){_0x5780a1[DUPLICATES[_0x13d673]]=_0x83c836[DUPLICATES[_0x13d673]];}var _0x10d8f6=_[_0x6e70('0x2b')](_0x538b9c,_0x5780a1);if(_0x10d8f6){return _0x41e352(handleCheckRowError(_0x6e70('0x2c'),_0x6e70('0x2d'),_0x10d8f6,_0x50aec2));}}return db[_0x6e70('0x2e')][_0x6e70('0x2f')](_0x83c836,{'raw':!![],'hooks':![],'fields':_[_0x6e70('0x30')](_0x83c836)})[_0x6e70('0x31')](function(_0xf146fd){if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){_0x538b9c['push'](_[_0x6e70('0x32')](_0x83c836,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf146fd['id'];return _0x4e97c7();})['catch'](function(_0x23cd1a){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x33')+(_0x23cd1a[_0x6e70('0x34')]||JSON[_0x6e70('0x35')](_0x23cd1a)),null,_0x50aec2));});});}function checkHopper(){function _0x989b80(){return function(_0x2440be){logger[_0x6e70('0x16')](_0x6e70('0x36'),_0x6e70('0x37'),util[_0x6e70('0x38')](_0x2440be,{'showHidden':![],'depth':null}));};}var _0x23d5e2=function(_0x5594d3,_0x501b53){var _0x5446a2=squel['insert']()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),'ListId',_0x501b53,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x5594d3['id'][_0x6e70('0x43')](),_0x501b53)['field']('NOW()','createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6e70('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x501b53+'\x20=\x20?',_0x5594d3['id'][_0x6e70('0x43')]())))[_0x6e70('0x43')]();return _0x5446a2;};var _0x2dafb5=function(_0x3478e2,_0x5bbc3a){var _0x291de6=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),'ContactId',_0x6e70('0x44'),_0x5bbc3a,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))['field'](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))['field'](LISTID['toString'](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x3478e2['id'][_0x6e70('0x43')](),_0x5bbc3a)['field']('NOW()',_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b'))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()['field'](_0x6e70('0x4d'))[_0x6e70('0x45')](_0x6e70('0x4e'))[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']()))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']())))[_0x6e70('0x43')]();return _0x291de6;};function _0xebe5f7(_0x54efdf,_0x3cfaa9){var _0xb3f06c=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))['fromQuery']([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),_0x6e70('0x44'),_0x3cfaa9,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3c'))[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x54efdf['id'][_0x6e70('0x43')](),_0x3cfaa9)['field'](_0x6e70('0x42'),_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')]('cm_contacts')[_0x6e70('0x48')](_0x6e70('0x47'))['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0xb3f06c;}function _0x41a861(_0x10d299,_0x739946){var _0x30cd88=squel['insert']()['into'](_0x6e70('0x50'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3d'),'ListId',_0x739946,'createdAt',_0x6e70('0x3f')],squel[_0x6e70('0x40')]()['field']('phone',_0x6e70('0x23'))['field']('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x10d299['id'][_0x6e70('0x43')](),_0x739946)[_0x6e70('0x41')](_0x6e70('0x42'),'createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0x30cd88;}return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x55'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x82a9a){var _0x515c0c=[];if(_0x82a9a){var _0xce964b;for(var _0x531097=0x0,_0x5b4046;_0x531097<_0x82a9a[_0x6e70('0x1c')];_0x531097+=0x1){_0x5b4046=_0x82a9a[_0x531097][_0x6e70('0x56')]({'plain':!![]});switch(_0x5b4046[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')]['query'](_0x2dafb5(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;default:_0x515c0c['push'](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x5b4046,_0x6e70('0x5b')))['then'](function(){})['catch'](_0x989b80()));}}}return _0x515c0c;})[_0x6e70('0x5f')]()[_0x6e70('0x31')](function(){return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x241a21){var _0x56d4d9=[];if(_0x241a21){var _0x58666a;for(var _0x1c7c5f=0x0,_0xf7a034;_0x1c7c5f<_0x241a21[_0x6e70('0x1c')];_0x1c7c5f+=0x1){_0xf7a034=_0x241a21[_0x1c7c5f][_0x6e70('0x56')]({'plain':!![]});_0x56d4d9[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x41a861(_0xf7a034,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}return _0x56d4d9;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':'Lists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x4b2d40){var _0x5b5471=[];if(_0x4b2d40){for(var _0x402f6f=0x0,_0x48e04b;_0x402f6f<_0x4b2d40['length'];_0x402f6f+=0x1){_0x48e04b=_0x4b2d40[_0x402f6f][_0x6e70('0x56')]({'plain':!![]});switch(_0x48e04b[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x5b5471['push'](db['sequelize']['query'](_0x2dafb5(_0x48e04b,_0x6e70('0x61')))['then'](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x48e04b,_0x6e70('0x61')))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));break;default:_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x48e04b,'CampaignId'))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}}return _0x5b5471;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')][_0x6e70('0x52')]({'attributes':['id'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x62'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x48f6fd){var _0x463eed=[];if(_0x48f6fd){for(var _0x39e6db=0x0,_0x53acc8;_0x39e6db<_0x48f6fd[_0x6e70('0x1c')];_0x39e6db+=0x1){_0x53acc8=_0x48f6fd[_0x39e6db][_0x6e70('0x56')]({'plain':!![]});_0x463eed['push'](db['sequelize'][_0x6e70('0x5e')](_0x41a861(_0x53acc8,'CampaignId'))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));}}return _0x463eed;})[_0x6e70('0x5f')]();})[_0x6e70('0x5c')](function(_0x106f32){logger[_0x6e70('0x16')](_0x6e70('0x63'),_0x6e70('0x64'),_0x106f32[_0x6e70('0x34')]);});}var processPromises=function(_0x5afbf5){return BPromise['all'](promises)[_0x6e70('0x31')](function(_0x4bf451){})[_0x6e70('0x5c')](function(_0xa2a4d5){logger[_0x6e70('0x16')](_0x6e70('0x65'),JSON['stringify'](_0xa2a4d5));})[_0x6e70('0x66')](function(){socket['emit'](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5afbf5){return _0x5afbf5[_0x6e70('0x68')]();}});};var endCsv=function(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x6e70('0x31')](function(){socket[_0x6e70('0x6a')](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1d6acf){logger['error'](_0x6e70('0x6b'),JSON['stringify'](_0x1d6acf));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x6e70('0x6c')](_0x6e70('0x6d'));endCsv();});function main(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6e70('0x6e')](',');return db['CmContact'][_0x6e70('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6e70('0x31')](function(_0x48c30c){var _0x3c2d33=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6e70('0x6f')](_0x3c2d33,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d0585,_0x4a87e2){total+=0x1;var _0x25f60c=total;promises[_0x6e70('0x59')](checkRow(_0x5d0585,_0x48c30c,_0x25f60c)[_0x6e70('0x31')](function(){success+=0x1;})[_0x6e70('0x5c')](function(_0x3e6661){if(_0x3e6661[_0x6e70('0x16')]){errors+=0x1;delete _0x3e6661[_0x6e70('0x16')];}else if(_0x3e6661['duplicate']){duplicates+=0x1;delete _0x3e6661[_0x6e70('0x2c')];}rows['push'](_0x3e6661);}));if(total%0xc8===0x0){_0x4a87e2[_0x6e70('0x70')]();return processPromises(_0x4a87e2);}},'complete':function(){return processPromises()[_0x6e70('0x31')](function(){logger[_0x6e70('0x6c')](_0x6e70('0x71'));endCsv();});},'error':function(_0x4764d5,_0x41b7de){logger[_0x6e70('0x6c')]('CSV\x20parse\x20error',JSON[_0x6e70('0x35')](_0x4764d5));endCsv();}});})['catch'](function(_0x27bdf2){logger[_0x6e70('0x16')](_0x6e70('0x72'),JSON[_0x6e70('0x35')](_0x27bdf2));});}main(); \ No newline at end of file +var _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);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(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){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'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 99340be..3bca80e 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 _0x5370=['file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','binding','firstName\x20is\x20mandatory','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','lodash','papaparse','bluebird','squel','../../../mysqldb','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','fromQuery','cm_contacts','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','error','errors','sequelize','query','spread','push','catch','message','main','stringify','start','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','data','length','rows','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','then','finish','affectedRows','unlink','exit','complete','argv'];(function(_0x1392a8,_0x38edba){var _0x5194b0=function(_0x2e8bcd){while(--_0x2e8bcd){_0x1392a8['push'](_0x1392a8['shift']());}};_0x5194b0(++_0x38edba);}(_0x5370,0x10d));var _0x0537=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x5370[_0xbca1b1];return _0x4e1686;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x0537('0x0'));var Papa=require(_0x0537('0x1'));var util=require('util');var BPromise=require(_0x0537('0x2'));var moment=require('moment');var squel=require(_0x0537('0x3'));var Redis=require('ioredis');var db=require(_0x0537('0x4'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('import');config[_0x0537('0x5')]=_['defaults'](config[_0x0537('0x5')],{'host':_0x0537('0x6'),'port':0x18eb});var socket=require(_0x0537('0x7'))(new Redis(config[_0x0537('0x5')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x0537('0x8')](_0x0537('0x9'));function isEmail(_0x2f9e11){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))*$/[_0x0537('0xa')](_0x2f9e11);}function selectNotIn(_0x240bc6,_0xe64cb7,_0x198562,_0x53ba9a,_0x5b22a9){return squel[_0x0537('0xb')]()[_0x0537('0xc')](_0x0537('0xd'))[_0x0537('0xe')](_0x53ba9a)['join'](_0xe64cb7,null,_0xe64cb7+_0x0537('0xf')+_0x53ba9a+'.'+_0x198562)[_0x0537('0x10')](_0x53ba9a+'.'+_0x198562+_0x0537('0x11')+_0x240bc6+'.'+_0x198562)[_0x0537('0x10')](_0xe64cb7+_0x0537('0x12')+_0x5b22a9[_0x0537('0x13')]()+')');}function insertCmHopper(_0x3966ad,_0x41e935,_0x2ec6b2,_0x5bee49,_0x52e2b9){var _0x2e31ff=[_0x0537('0x14'),_0x0537('0x15'),_0x0537('0x16'),_0x0537('0x17'),_0x41e935+'.'+_0x5bee49,_0x0537('0x18'),_0x0537('0x19'),_0x0537('0x1a'),_0x0537('0x1b'),'\x22'+_0x52e2b9+'\x22'];return squel[_0x0537('0x1c')]()[_0x0537('0x1d')](_0x0537('0x1e'))['fromQuery']([_0x0537('0xd'),_0x0537('0x1f'),_0x0537('0x20'),_0x0537('0x21'),_0x5bee49,_0x0537('0x22'),_0x0537('0x23'),_0x0537('0x24'),'UserId',_0x0537('0x25')],squel[_0x0537('0xb')]()[_0x0537('0x26')](_0x2e31ff)[_0x0537('0xe')](_0x41e935)[_0x0537('0x13')]('cm_contacts',null,_0x0537('0x27')+_0x41e935+_0x0537('0x28'))[_0x0537('0x13')](_0x2ec6b2,null,_0x2ec6b2+'.id\x20=\x20'+_0x41e935+'.'+_0x5bee49)['where'](_0x41e935+'.CmListId\x20=\x20?',_0x3966ad)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x41e935,_0x2ec6b2,_0x5bee49,_0x0537('0x1e'),['\x22always\x22',_0x0537('0x29')]))['where'](_0x0537('0x2a'),selectNotIn(_0x41e935,_0x2ec6b2,_0x5bee49,_0x0537('0x1e'),[_0x0537('0x2b')])))[_0x0537('0x2c')]();}function insertCmHopperBlack(_0x2e7958,_0x54b967,_0x24a5e6,_0xe9346a){var _0x59c92f=[_0x0537('0x14'),_0x0537('0x16'),_0x0537('0x17'),_0x54b967+'.'+_0xe9346a,_0x0537('0x18'),_0x0537('0x19')];return squel[_0x0537('0x1c')]()[_0x0537('0x1d')](_0x0537('0x2d'))[_0x0537('0x2e')]([_0x0537('0xd'),_0x0537('0x20'),'ListId',_0xe9346a,_0x0537('0x22'),_0x0537('0x23')],squel[_0x0537('0xb')]()[_0x0537('0x26')](_0x59c92f)[_0x0537('0xe')](_0x54b967)[_0x0537('0x13')](_0x0537('0x2f'),null,_0x0537('0x27')+_0x54b967+'.CmListId')['join'](_0x24a5e6,null,_0x24a5e6+'.id\x20=\x20'+_0x54b967+'.'+_0xe9346a)[_0x0537('0x10')](_0x54b967+'.CmListId\x20=\x20?',_0x2e7958)[_0x0537('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0537('0x10')](_0x0537('0x2a'),squel[_0x0537('0xb')]()[_0x0537('0xc')](_0x0537('0xd'))['from'](_0x0537('0x2d'))[_0x0537('0x10')](_0x0537('0x30'),_0x2e7958)[_0x0537('0x10')](_0xe9346a+'\x20=\x20?',_0x54b967+'.'+_0xe9346a)))['toString']();}function insertCmContact(_0x986f6e,_0x3f32e3,_0x315450,_0x4a5078){var _0x1d6584=_[_0x0537('0x31')](_[_0x0537('0x32')](_0x4a5078),[_0x0537('0x21'),_0x0537('0x33'),_0x0537('0x22'),_0x0537('0x23')]);return squel['insert']()[_0x0537('0x1d')]('cm_contacts')[_0x0537('0x2e')](_0x1d6584,squel['select']()[_0x0537('0x26')](_0x1d6584)[_0x0537('0xe')](_0x3f32e3)['where']('('+_0x315450['join'](',')+_0x0537('0x34'),squel[_0x0537('0xb')]()['fields'](_0x315450)[_0x0537('0xe')]('cm_contacts')['where'](_0x0537('0x30'),_0x986f6e)[_0x0537('0x10')](_0x0537('0x35')))[_0x0537('0x10')](_0x0537('0x36'),squel[_0x0537('0xb')]()[_0x0537('0xc')]('MIN(id)',_0x0537('0x37'))[_0x0537('0xe')](_0x3f32e3)[_0x0537('0x38')](_0x315450[_0x0537('0x13')](','))))['toString']();}function handleStop(){logger[_0x0537('0x39')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3bc50c){logger[_0x0537('0x3a')](_0x3bc50c['message']);process['exit'](0x1);}function handleError(_0x554d28,_0x20b591){stats[_0x0537('0x3b')]['push']({'name':_0x20b591['code'],'message':_0x20b591['message'],'row':_0x554d28});}function handleQuery(_0x2c8515){logger[_0x0537('0x39')](_0x2c8515);return db[_0x0537('0x3c')][_0x0537('0x3d')](_0x2c8515)[_0x0537('0x3e')](function(_0x2e8716){results[_0x0537('0x3f')](_0x2e8716);})[_0x0537('0x40')](function(_0x3ef01a){logger[_0x0537('0x3a')](_0x3ef01a[_0x0537('0x41')]);});}function main(_0x12849f,_0x3b2a67,_0x1f0670,_0x3af061){logger[_0x0537('0x39')](_0x0537('0x42'),_0x12849f,JSON[_0x0537('0x43')](_0x3b2a67));process['send'](_0x0537('0x44'));var _0x52a758=_0x3b2a67['binding'];var _0x573446=_0x3b2a67['socket_timestamp'];var _0x424167=path[_0x0537('0x13')](config[_0x0537('0x45')],_0x0537('0x46'),_0x573446+_0x0537('0x47'));var _0x39cae4=_[_0x0537('0x32')](_0x52a758)[_0x0537('0x13')]();logger['info'](_0x0537('0x48'),_0x39cae4);fs[_0x0537('0x49')](_0x424167,_0x39cae4+'\x0a');Papa['parse'](fs[_0x0537('0x4a')](_0x12849f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x240109,_0x6803fa){try{for(var _0x1687b7=0x0,_0x49c12a=[];_0x1687b7<_0x240109[_0x0537('0x4b')][_0x0537('0x4c')];_0x1687b7++){stats[_0x0537('0x4d')]+=0x1;if(_0x240109['errors'][_0x1687b7]){handleError(_0x240109[_0x0537('0x4b')][_0x1687b7],_0x240109[_0x0537('0x3b')][_0x1687b7]);}else{var _0x295673=[];for(var _0x1fd345 in _0x52a758){if(_0x52a758['hasOwnProperty'](_0x1fd345)){if(_0x240109[_0x0537('0x4b')][_0x1687b7][_0x52a758[_0x1fd345]]){var _0x5605be=_[_0x0537('0x4e')](_0x240109['data'][_0x1687b7][_0x52a758[_0x1fd345]][_0x0537('0x4f')](/"/g,'\x27'));switch(_0x1fd345){case'scheduledat':var _0x17a672=moment(_0x5605be,_0x0537('0x9'),!![]);if(_0x17a672[_0x0537('0x50')]()){_0x49c12a[_0x0537('0x3f')]('\x22'+_0x5605be+'\x22');}else{_0x295673['push'](_0x0537('0x51'));}break;case _0x0537('0x24'):var _0x1c531c=parseInt(_0x5605be);_0x5605be=_['isNaN'](_0x1c531c)||_0x1c531c<0x0||_0x1c531c>0x4?_0x3af061?0x3:0x2:_0x1c531c;_0x49c12a[_0x0537('0x3f')]('\x22'+_0x5605be+'\x22');break;case'UserId':var _0x55d19c=parseInt(_0x5605be);if(_[_0x0537('0x52')](_0x55d19c)&&_[_0x0537('0x53')](_0x1f0670,_0x55d19c)){_0x49c12a[_0x0537('0x3f')]('\x22'+_0x55d19c+'\x22');}else{_0x295673[_0x0537('0x3f')](_0x0537('0x54'));}break;case _0x0537('0x55'):if(isEmail(_0x5605be)){_0x49c12a[_0x0537('0x3f')]('\x22'+_0x5605be+'\x22');}else{_0x295673[_0x0537('0x3f')](_0x0537('0x56'));}break;case'dateOfBirth':var _0x1ce5b9=moment(_0x5605be,'YYYY-MM-DD',!![]);if(_0x1ce5b9[_0x0537('0x50')]()){_0x49c12a[_0x0537('0x3f')]('\x22'+_0x5605be+'\x22');}else{_0x295673[_0x0537('0x3f')](_0x0537('0x57'));}break;default:_0x49c12a[_0x0537('0x3f')]('\x22'+_0x5605be+'\x22');}}else{switch(_0x1fd345){case _0x0537('0x58'):case _0x0537('0xd'):_0x295673[_0x0537('0x3f')](_0x1fd345+_0x0537('0x59'));break;default:_0x49c12a[_0x0537('0x3f')]('\x22\x22');}}}}if(_0x295673[_0x0537('0x4c')]){handleError(_0x240109[_0x0537('0x4b')][_0x1687b7],{'code':'SystemRow','message':_0x295673[_0x0537('0x13')]()});}else{fs['appendFileSync'](_0x424167,_0x49c12a[_0x0537('0x13')]()+'\x0a');}_0x49c12a=[];}if(!(stats['rows']%0xc8)){socket[_0x0537('0x5a')](_0x0537('0x5b')+_0x573446,stats);stats[_0x0537('0x3b')]=[];}}if(stopped){logger['info'](_0x0537('0x5c'));_0x6803fa[_0x0537('0x5d')]();}}catch(_0xcb4d64){handleError(_0x240109[_0x0537('0x4b')][_0x1687b7],{'code':_0x0537('0x5e'),'message':_0xcb4d64[_0x0537('0x41')]});logger[_0x0537('0x3a')]('step',_0xcb4d64['message']);}},'complete':function(){try{var _0x519b2f=[];var _0x2f299c='cm_contacts';if(_0x3b2a67[_0x0537('0x5f')]&&_0x3b2a67[_0x0537('0x5f')]['length']){_0x2f299c=_0x0537('0x60')+_0x573446;_0x519b2f[_0x0537('0x3f')](_0x0537('0x61')+_0x2f299c+_0x0537('0x62'));}var _0x5706bd=util['format'](_0x0537('0x63'),_0x424167,_0x2f299c,_0x39cae4,_0x3b2a67[_0x0537('0x21')],_0x3b2a67[_0x0537('0x33')]||null,NOW,NOW);if(_[_0x0537('0x64')](_0x52a758[_0x0537('0x1f')])){_0x5706bd+=',\x20scheduledAt\x20=\x20NOW()';}_0x519b2f[_0x0537('0x3f')](_0x5706bd);if(_0x3b2a67[_0x0537('0x5f')]&&_0x3b2a67[_0x0537('0x5f')][_0x0537('0x4c')]){_0x519b2f[_0x0537('0x3f')](insertCmContact(_0x3b2a67['ListId'],_0x2f299c,_0x3b2a67['duplicates'],_0x52a758));_0x519b2f[_0x0537('0x3f')](_0x0537('0x65')+_0x2f299c+';');}_0x519b2f[_0x0537('0x3f')](insertCmHopper(_0x3b2a67[_0x0537('0x21')],_0x0537('0x66'),_0x0537('0x67'),_0x0537('0x68'),_0x3af061));_0x519b2f[_0x0537('0x3f')](insertCmHopperBlack(_0x3b2a67[_0x0537('0x21')],_0x0537('0x69'),_0x0537('0x67'),_0x0537('0x68')));_0x519b2f['push'](insertCmHopper(_0x3b2a67[_0x0537('0x21')],_0x0537('0x6a'),'campaigns',_0x0537('0x6b'),_0x3af061));_0x519b2f[_0x0537('0x3f')](insertCmHopperBlack(_0x3b2a67[_0x0537('0x21')],_0x0537('0x6c'),_0x0537('0x6d'),_0x0537('0x6b')));BPromise[_0x0537('0x6e')](_0x519b2f,handleQuery)[_0x0537('0x6f')](function(_0x16e7d4){stats[_0x0537('0x70')]=!![];stats['affectedRows']=_0x3b2a67['duplicates']&&_0x3b2a67[_0x0537('0x5f')]['length']?results[0x2][_0x0537('0x71')]:results[0x0]['affectedRows'];socket[_0x0537('0x5a')]('contact:import:'+_0x573446,stats);fs['unlink'](_0x12849f);fs[_0x0537('0x72')](_0x424167);process[_0x0537('0x73')](0x0);})[_0x0537('0x40')](function(_0x7c418e){logger['error'](_0x7c418e[_0x0537('0x41')]);process[_0x0537('0x73')](0x1);});}catch(_0x11701f){logger[_0x0537('0x3a')](_0x0537('0x74'),_0x11701f[_0x0537('0x41')]);process[_0x0537('0x73')](0x1);}},'error':function(_0x378a8e,_0x69652b,_0x14ae2d,_0x57a4d8){throw new Error(_0x57a4d8);}});}function validate(){if(process[_0x0537('0x75')]&&process[_0x0537('0x75')]['length']<0x4){throw new Error('arguments\x20\x20\x20');}var _0x1cd034=path[_0x0537('0x13')](config[_0x0537('0x45')],_0x0537('0x46'),process[_0x0537('0x75')][0x2]);if(!fs['existsSync'](_0x1cd034)){throw new Error(_0x0537('0x76'));}var _0x1da996={};try{_0x1da996=JSON[_0x0537('0x77')](process[_0x0537('0x75')][0x3]);if(!_0x1da996['binding']){throw new Error(_0x0537('0x78'));}if(!_0x1da996['binding'][_0x0537('0xd')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x1da996[_0x0537('0x79')][_0x0537('0x58')]){throw new Error(_0x0537('0x7a'));}var _0x30acf5=0x0;if(_0x1da996[_0x0537('0x79')][_0x0537('0x7b')]){_0x30acf5=0x1;}if(!_0x1da996[_0x0537('0x21')]){throw new Error(_0x0537('0x7c'));}}catch(_0x5da0bc){throw new Error(_0x0537('0x7d'));}var _0x37a16e=[];try{_0x37a16e=_[_0x0537('0x7e')](JSON[_0x0537('0x77')](process[_0x0537('0x75')][0x4]),'id');}catch(_0x506d11){logger[_0x0537('0x39')](_0x0537('0x7f'));}main(_0x1cd034,_0x1da996,_0x37a16e,_0x30acf5);}validate();process['on']('SIGINT',handleStop);process['on'](_0x0537('0x80'),handleUncaughtException); \ No newline at end of file +var _0x7ee4=['\x20not\x20specified','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','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','isNil','scheduledat',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','finish','affectedRows','unlink','catch','complete','argv','arguments\x20\x20\x20','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','phone','ContactId','ListId','createdAt','updatedAt','UserId','recallme','select','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.phone','cm_contacts.createdAt','cm_hopper_black','fromQuery','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','field','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','sequelize','query','spread','push','main','stringify','send','start','binding','root','server/files/tmp','.csv','parse','length','hasOwnProperty','data','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','includes','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName'];(function(_0x27662c,_0x2a1fb8){var _0x404352=function(_0x2bae35){while(--_0x2bae35){_0x27662c['push'](_0x27662c['shift']());}};_0x404352(++_0x2a1fb8);}(_0x7ee4,0xac));var _0x47ee=function(_0x552203,_0x530526){_0x552203=_0x552203-0x0;var _0x3dab1e=_0x7ee4[_0x552203];return _0x3dab1e;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x47ee('0x0'));var Papa=require(_0x47ee('0x1'));var util=require('util');var BPromise=require(_0x47ee('0x2'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x47ee('0x3'));var db=require(_0x47ee('0x4'))['db'];var config=require(_0x47ee('0x5'));var logger=require(_0x47ee('0x6'))(_0x47ee('0x7'));config['redis']=_['defaults'](config[_0x47ee('0x8')],{'host':_0x47ee('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47ee('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x47ee('0xa')](_0x47ee('0xb'));function isEmail(_0x39f6dc){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))*$/[_0x47ee('0xc')](_0x39f6dc);}function selectNotIn(_0x45906a,_0x547b9d,_0x253944,_0x4cb1ee,_0x6ea246){return squel['select']()['field']('phone')[_0x47ee('0xd')](_0x4cb1ee)[_0x47ee('0xe')](_0x547b9d,null,_0x547b9d+_0x47ee('0xf')+_0x4cb1ee+'.'+_0x253944)[_0x47ee('0x10')](_0x4cb1ee+'.'+_0x253944+_0x47ee('0x11')+_0x45906a+'.'+_0x253944)['where'](_0x547b9d+_0x47ee('0x12')+_0x6ea246[_0x47ee('0xe')]()+')');}function insertCmHopper(_0x412ebb,_0x5213bf,_0x112d46,_0x57680b,_0x1667f7){var _0x50489a=['cm_contacts.phone',_0x47ee('0x13'),_0x47ee('0x14'),_0x47ee('0x15'),_0x5213bf+'.'+_0x57680b,'cm_contacts.createdAt',_0x47ee('0x16'),'cm_contacts.priority',_0x47ee('0x17'),'\x22'+_0x1667f7+'\x22'];return squel[_0x47ee('0x18')]()[_0x47ee('0x19')](_0x47ee('0x1a'))['fromQuery']([_0x47ee('0x1b'),'scheduledat',_0x47ee('0x1c'),_0x47ee('0x1d'),_0x57680b,_0x47ee('0x1e'),_0x47ee('0x1f'),'priority',_0x47ee('0x20'),_0x47ee('0x21')],squel[_0x47ee('0x22')]()[_0x47ee('0x23')](_0x50489a)[_0x47ee('0xd')](_0x5213bf)[_0x47ee('0xe')](_0x47ee('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x5213bf+_0x47ee('0x25'))[_0x47ee('0xe')](_0x112d46,null,_0x112d46+_0x47ee('0xf')+_0x5213bf+'.'+_0x57680b)[_0x47ee('0x10')](_0x5213bf+_0x47ee('0x26'),_0x412ebb)['where'](_0x47ee('0x27'),NOW)[_0x47ee('0x10')](_0x47ee('0x28'),selectNotIn(_0x5213bf,_0x112d46,_0x57680b,'cm_hopper',[_0x47ee('0x29'),'\x22onlyIfOpen\x22']))[_0x47ee('0x10')](_0x47ee('0x28'),selectNotIn(_0x5213bf,_0x112d46,_0x57680b,_0x47ee('0x1a'),[_0x47ee('0x29')])))[_0x47ee('0x2a')]();}function insertCmHopperBlack(_0x1defe9,_0x29054d,_0x2a8c01,_0x1411c0){var _0x2c4262=[_0x47ee('0x2b'),_0x47ee('0x14'),_0x47ee('0x15'),_0x29054d+'.'+_0x1411c0,_0x47ee('0x2c'),_0x47ee('0x16')];return squel[_0x47ee('0x18')]()[_0x47ee('0x19')](_0x47ee('0x2d'))[_0x47ee('0x2e')]([_0x47ee('0x1b'),_0x47ee('0x1c'),_0x47ee('0x1d'),_0x1411c0,_0x47ee('0x1e'),_0x47ee('0x1f')],squel[_0x47ee('0x22')]()[_0x47ee('0x23')](_0x2c4262)[_0x47ee('0xd')](_0x29054d)[_0x47ee('0xe')]('cm_contacts',null,_0x47ee('0x2f')+_0x29054d+_0x47ee('0x25'))[_0x47ee('0xe')](_0x2a8c01,null,_0x2a8c01+_0x47ee('0xf')+_0x29054d+'.'+_0x1411c0)[_0x47ee('0x10')](_0x29054d+_0x47ee('0x26'),_0x1defe9)[_0x47ee('0x10')](_0x47ee('0x27'),NOW)[_0x47ee('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x47ee('0x22')]()['field'](_0x47ee('0x1b'))['from'](_0x47ee('0x2d'))[_0x47ee('0x10')](_0x47ee('0x30'),_0x1defe9)[_0x47ee('0x10')](_0x1411c0+'\x20=\x20?',_0x29054d+'.'+_0x1411c0)))[_0x47ee('0x2a')]();}function insertCmContact(_0x507ddb,_0x3b0ee6,_0x13cad8,_0x2c5530){var _0x5e97bf=_[_0x47ee('0x31')](_[_0x47ee('0x32')](_0x2c5530),[_0x47ee('0x1d'),_0x47ee('0x33'),_0x47ee('0x1e'),_0x47ee('0x1f')]);return squel[_0x47ee('0x18')]()['into'](_0x47ee('0x24'))['fromQuery'](_0x5e97bf,squel[_0x47ee('0x22')]()[_0x47ee('0x23')](_0x5e97bf)[_0x47ee('0xd')](_0x3b0ee6)[_0x47ee('0x10')]('('+_0x13cad8[_0x47ee('0xe')](',')+_0x47ee('0x34'),squel['select']()[_0x47ee('0x23')](_0x13cad8)[_0x47ee('0xd')]('cm_contacts')[_0x47ee('0x10')](_0x47ee('0x30'),_0x507ddb)[_0x47ee('0x10')](_0x47ee('0x35')))['where'](_0x47ee('0x36'),squel[_0x47ee('0x22')]()[_0x47ee('0x37')](_0x47ee('0x38'),_0x47ee('0x39'))[_0x47ee('0xd')](_0x3b0ee6)[_0x47ee('0x3a')](_0x13cad8[_0x47ee('0xe')](','))))[_0x47ee('0x2a')]();}function handleStop(){logger[_0x47ee('0x3b')](_0x47ee('0x3c'));stopped=!![];}function handleUncaughtException(_0x1b4392){logger[_0x47ee('0x3d')](_0x1b4392[_0x47ee('0x3e')]);process[_0x47ee('0x3f')](0x1);}function handleError(_0x5ab98a,_0x3ae2c9){stats[_0x47ee('0x40')]['push']({'name':_0x3ae2c9['code'],'message':_0x3ae2c9[_0x47ee('0x3e')],'row':_0x5ab98a});}function handleQuery(_0x4ca492){logger[_0x47ee('0x3b')](_0x4ca492);return db[_0x47ee('0x41')][_0x47ee('0x42')](_0x4ca492)[_0x47ee('0x43')](function(_0x467778){results[_0x47ee('0x44')](_0x467778);})['catch'](function(_0x1b9ad1){logger[_0x47ee('0x3d')](_0x1b9ad1[_0x47ee('0x3e')]);});}function main(_0x1093ee,_0x2f0ca5,_0xa54ee0,_0x149a36){logger[_0x47ee('0x3b')](_0x47ee('0x45'),_0x1093ee,JSON[_0x47ee('0x46')](_0x2f0ca5));process[_0x47ee('0x47')](_0x47ee('0x48'));var _0x3fc5c5=_0x2f0ca5[_0x47ee('0x49')];var _0x4610ee=_0x2f0ca5['socket_timestamp'];var _0x4c95b4=path[_0x47ee('0xe')](config[_0x47ee('0x4a')],_0x47ee('0x4b'),_0x4610ee+_0x47ee('0x4c'));var _0x53dc0b=_[_0x47ee('0x32')](_0x3fc5c5)[_0x47ee('0xe')]();logger['info']('header',_0x53dc0b);fs['writeFileSync'](_0x4c95b4,_0x53dc0b+'\x0a');Papa[_0x47ee('0x4d')](fs['createReadStream'](_0x1093ee),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2278d8,_0x534168){try{for(var _0x4f9757=0x0,_0x9141e1=[];_0x4f9757<_0x2278d8['data'][_0x47ee('0x4e')];_0x4f9757++){stats['rows']+=0x1;if(_0x2278d8[_0x47ee('0x40')][_0x4f9757]){handleError(_0x2278d8['data'][_0x4f9757],_0x2278d8[_0x47ee('0x40')][_0x4f9757]);}else{var _0x2c4b09=[];for(var _0x37b866 in _0x3fc5c5){if(_0x3fc5c5[_0x47ee('0x4f')](_0x37b866)){if(_0x2278d8[_0x47ee('0x50')][_0x4f9757][_0x3fc5c5[_0x37b866]]){var _0x554978=_[_0x47ee('0x51')](_0x2278d8[_0x47ee('0x50')][_0x4f9757][_0x3fc5c5[_0x37b866]]['replace'](/"/g,'\x27'));switch(_0x37b866){case'scheduledat':var _0x306c11=moment(_0x554978,_0x47ee('0xb'),!![]);if(_0x306c11[_0x47ee('0x52')]()){_0x9141e1[_0x47ee('0x44')]('\x22'+_0x554978+'\x22');}else{_0x2c4b09[_0x47ee('0x44')](_0x47ee('0x53'));}break;case _0x47ee('0x54'):var _0x25935e=parseInt(_0x554978);_0x554978=_['isNaN'](_0x25935e)||_0x25935e<0x0||_0x25935e>0x4?_0x149a36?0x3:0x2:_0x25935e;_0x9141e1[_0x47ee('0x44')]('\x22'+_0x554978+'\x22');break;case _0x47ee('0x20'):var _0x3b7454=parseInt(_0x554978);if(_[_0x47ee('0x55')](_0x3b7454)&&_[_0x47ee('0x56')](_0xa54ee0,_0x3b7454)){_0x9141e1[_0x47ee('0x44')]('\x22'+_0x3b7454+'\x22');}else{_0x2c4b09[_0x47ee('0x44')]('agent\x20not\x20exists');}break;case _0x47ee('0x57'):if(isEmail(_0x554978)){_0x9141e1[_0x47ee('0x44')]('\x22'+_0x554978+'\x22');}else{_0x2c4b09[_0x47ee('0x44')]('email\x20wrong\x20format');}break;case _0x47ee('0x58'):var _0x5186d8=moment(_0x554978,_0x47ee('0x59'),!![]);if(_0x5186d8[_0x47ee('0x52')]()){_0x9141e1['push']('\x22'+_0x554978+'\x22');}else{_0x2c4b09[_0x47ee('0x44')](_0x47ee('0x5a'));}break;default:_0x9141e1[_0x47ee('0x44')]('\x22'+_0x554978+'\x22');}}else{switch(_0x37b866){case _0x47ee('0x5b'):case _0x47ee('0x1b'):_0x2c4b09[_0x47ee('0x44')](_0x37b866+_0x47ee('0x5c'));break;default:_0x9141e1[_0x47ee('0x44')]('\x22\x22');}}}}if(_0x2c4b09['length']){handleError(_0x2278d8[_0x47ee('0x50')][_0x4f9757],{'code':_0x47ee('0x5d'),'message':_0x2c4b09[_0x47ee('0xe')]()});}else{fs[_0x47ee('0x5e')](_0x4c95b4,_0x9141e1[_0x47ee('0xe')]()+'\x0a');}_0x9141e1=[];}if(!(stats[_0x47ee('0x5f')]%0xc8)){socket[_0x47ee('0x60')](_0x47ee('0x61')+_0x4610ee,stats);stats[_0x47ee('0x40')]=[];}}if(stopped){logger['info'](_0x47ee('0x62'));_0x534168[_0x47ee('0x63')]();}}catch(_0x21ed82){handleError(_0x2278d8[_0x47ee('0x50')][_0x4f9757],{'code':_0x47ee('0x64'),'message':_0x21ed82[_0x47ee('0x3e')]});logger[_0x47ee('0x3d')](_0x47ee('0x65'),_0x21ed82[_0x47ee('0x3e')]);}},'complete':function(){try{var _0x3399ef=[];var _0x2b1bcc=_0x47ee('0x24');if(_0x2f0ca5['duplicates']&&_0x2f0ca5[_0x47ee('0x66')][_0x47ee('0x4e')]){_0x2b1bcc=_0x47ee('0x67')+_0x4610ee;_0x3399ef[_0x47ee('0x44')](_0x47ee('0x68')+_0x2b1bcc+'\x20LIKE\x20cm_contacts;');}var _0x35c3f5=util['format'](_0x47ee('0x69'),_0x4c95b4,_0x2b1bcc,_0x53dc0b,_0x2f0ca5[_0x47ee('0x1d')],_0x2f0ca5[_0x47ee('0x33')]||null,NOW,NOW);if(_[_0x47ee('0x6a')](_0x3fc5c5[_0x47ee('0x6b')])){_0x35c3f5+=_0x47ee('0x6c');}_0x3399ef[_0x47ee('0x44')](_0x35c3f5);if(_0x2f0ca5[_0x47ee('0x66')]&&_0x2f0ca5[_0x47ee('0x66')]['length']){_0x3399ef[_0x47ee('0x44')](insertCmContact(_0x2f0ca5[_0x47ee('0x1d')],_0x2b1bcc,_0x2f0ca5[_0x47ee('0x66')],_0x3fc5c5));_0x3399ef[_0x47ee('0x44')](_0x47ee('0x6d')+_0x2b1bcc+';');}_0x3399ef[_0x47ee('0x44')](insertCmHopper(_0x2f0ca5[_0x47ee('0x1d')],_0x47ee('0x6e'),_0x47ee('0x6f'),_0x47ee('0x70'),_0x149a36));_0x3399ef[_0x47ee('0x44')](insertCmHopperBlack(_0x2f0ca5[_0x47ee('0x1d')],_0x47ee('0x71'),_0x47ee('0x6f'),_0x47ee('0x70')));_0x3399ef[_0x47ee('0x44')](insertCmHopper(_0x2f0ca5['ListId'],'campaigns_has_cm_lists','campaigns',_0x47ee('0x72'),_0x149a36));_0x3399ef[_0x47ee('0x44')](insertCmHopperBlack(_0x2f0ca5['ListId'],_0x47ee('0x73'),_0x47ee('0x74'),_0x47ee('0x72')));BPromise[_0x47ee('0x75')](_0x3399ef,handleQuery)['then'](function(_0x4e1e80){stats[_0x47ee('0x76')]=!![];stats[_0x47ee('0x77')]=_0x2f0ca5[_0x47ee('0x66')]&&_0x2f0ca5[_0x47ee('0x66')][_0x47ee('0x4e')]?results[0x2][_0x47ee('0x77')]:results[0x0][_0x47ee('0x77')];socket[_0x47ee('0x60')](_0x47ee('0x61')+_0x4610ee,stats);fs[_0x47ee('0x78')](_0x1093ee);fs[_0x47ee('0x78')](_0x4c95b4);process['exit'](0x0);})[_0x47ee('0x79')](function(_0x229529){logger[_0x47ee('0x3d')](_0x229529[_0x47ee('0x3e')]);process[_0x47ee('0x3f')](0x1);});}catch(_0x321bdc){logger[_0x47ee('0x3d')](_0x47ee('0x7a'),_0x321bdc['message']);process[_0x47ee('0x3f')](0x1);}},'error':function(_0x3be462,_0x583471,_0x34dabc,_0x3d9225){throw new Error(_0x3d9225);}});}function validate(){if(process[_0x47ee('0x7b')]&&process[_0x47ee('0x7b')][_0x47ee('0x4e')]<0x4){throw new Error(_0x47ee('0x7c'));}var _0x554376=path[_0x47ee('0xe')](config[_0x47ee('0x4a')],'server/files/tmp',process[_0x47ee('0x7b')][0x2]);if(!fs['existsSync'](_0x554376)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x1770fe={};try{_0x1770fe=JSON['parse'](process['argv'][0x3]);if(!_0x1770fe[_0x47ee('0x49')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x1770fe['binding'][_0x47ee('0x1b')]){throw new Error(_0x47ee('0x7d'));}if(!_0x1770fe['binding'][_0x47ee('0x5b')]){throw new Error(_0x47ee('0x7e'));}var _0x54c942=0x0;if(_0x1770fe['binding'][_0x47ee('0x20')]){_0x54c942=0x1;}if(!_0x1770fe[_0x47ee('0x1d')]){throw new Error(_0x47ee('0x7f'));}}catch(_0x997427){throw new Error(_0x47ee('0x80'));}var _0x347498=[];try{_0x347498=_[_0x47ee('0x81')](JSON['parse'](process[_0x47ee('0x7b')][0x4]),'id');}catch(_0x23a12a){logger[_0x47ee('0x3b')]('No\x20agent\x20available');}main(_0x554376,_0x1770fe,_0x347498,_0x54c942);}validate();process['on'](_0x47ee('0x82'),handleStop);process['on'](_0x47ee('0x83'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 5d13d11..3654d23 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 _0xfcbb=['keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','queue','push','variable','calleridnum','outbound','string','destcalleridnum','***\x20Call\x20Info\x20***'];(function(_0x5634c8,_0x52ffcd){var _0x174d5b=function(_0x953679){while(--_0x953679){_0x5634c8['push'](_0x5634c8['shift']());}};_0x174d5b(++_0x52ffcd);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x55e28c,_0xefffbc){_0x55e28c=_0x55e28c-0x0;var _0x10f3a0=_0xfcbb[_0x55e28c];return _0x10f3a0;};'use strict';exports[_0xbfcb('0x0')]=function(_0x38081d,_0x112f37){var _0x5a1002=[{'type':'string','content':_0xbfcb('0x1'),'variableName':null}];switch(_0x38081d[_0xbfcb('0x2')]()){case _0xbfcb('0x3'):switch(_0x112f37[_0xbfcb('0x2')]()){case _0xbfcb('0x4'):_0x5a1002['push']({'type':'variable','content':'','variableName':_0xbfcb('0x5')});_0x5a1002[_0xbfcb('0x6')]({'type':_0xbfcb('0x7'),'content':'','variableName':_0xbfcb('0x8')});break;case _0xbfcb('0x9'):_0x5a1002[_0xbfcb('0x6')]({'type':_0xbfcb('0xa'),'content':'Outbound\x20Call','variableName':null});_0x5a1002[_0xbfcb('0x6')]({'type':_0xbfcb('0x7'),'content':'','variableName':_0xbfcb('0xb')});break;}}return _0x5a1002;};exports['getDescriptions']=function(_0x2c72f3,_0x3d01fa){var _0x3e735a=[];switch(_0x2c72f3[_0xbfcb('0x2')]()){case _0xbfcb('0x3'):switch(_0x3d01fa[_0xbfcb('0x2')]()){case'inbound':_0x3e735a=[{'type':_0xbfcb('0xa'),'content':_0xbfcb('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0xe'),'keyType':'variable','variableName':_0xbfcb('0x8')},{'type':'keyValue','content':'','key':_0xbfcb('0xf'),'keyType':_0xbfcb('0x7'),'variableName':_0xbfcb('0x10')},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0x11'),'keyType':_0xbfcb('0x7'),'variableName':_0xbfcb('0x12')},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0x13'),'keyType':_0xbfcb('0x7'),'variableName':_0xbfcb('0x5')},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0x14'),'keyType':_0xbfcb('0x7'),'variableName':_0xbfcb('0x15')},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0x16'),'keyType':_0xbfcb('0x7'),'variableName':_0xbfcb('0x17')},{'type':_0xbfcb('0xa'),'content':_0xbfcb('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xbfcb('0xd'),'content':'','key':'Agent\x20Name','keyType':_0xbfcb('0x7'),'variableName':_0xbfcb('0x19')},{'type':'keyValue','content':'','key':_0xbfcb('0x1a'),'keyType':_0xbfcb('0x7'),'variableName':'destcalleridnum'},{'type':'string','content':_0xbfcb('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0x1c'),'keyType':_0xbfcb('0x7'),'variableName':_0xbfcb('0x17')},{'type':'keyValue','content':'','key':_0xbfcb('0x1d'),'keyType':_0xbfcb('0x7'),'variableName':_0xbfcb('0x1e')},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0x1f'),'keyType':_0xbfcb('0x7'),'variableName':_0xbfcb('0x20')},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0x21'),'keyType':_0xbfcb('0x7'),'variableName':_0xbfcb('0x22')},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0x23'),'keyType':_0xbfcb('0x7'),'variableName':_0xbfcb('0x24')}];break;case _0xbfcb('0x9'):_0x3e735a=[{'type':'string','content':_0xbfcb('0xc'),'variableName':null},{'type':_0xbfcb('0xd'),'content':'','key':'Called\x20Number','keyType':_0xbfcb('0x7'),'keyContent':'','variableName':_0xbfcb('0xb')},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0x25'),'keyType':_0xbfcb('0x7'),'keyContent':'','variableName':_0xbfcb('0x26')},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0x14'),'keyType':_0xbfcb('0x7'),'keyContent':'','variableName':_0xbfcb('0x15')},{'type':'keyValue','content':'','key':_0xbfcb('0x16'),'keyType':_0xbfcb('0x7'),'keyContent':'','variableName':_0xbfcb('0x27')},{'type':_0xbfcb('0xa'),'content':_0xbfcb('0x1b')},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0x28'),'keyType':_0xbfcb('0x7'),'keyContent':'','variableName':_0xbfcb('0x29')},{'type':'keyValue','content':'','key':_0xbfcb('0x2a'),'keyType':_0xbfcb('0x7'),'keyContent':'','variableName':_0xbfcb('0x2b')},{'type':_0xbfcb('0xd'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0xbfcb('0x2c')},{'type':_0xbfcb('0xd'),'content':'','key':_0xbfcb('0x2d'),'keyType':_0xbfcb('0x7'),'keyContent':'','variableName':_0xbfcb('0x2e')}];break;}}return _0x3e735a;}; \ No newline at end of file +var _0xfff0=['agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','destcalleridnum','Member\x20Name','membername','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','outbound','string','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','UniqueId','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect'];(function(_0x2eea9a,_0x368daf){var _0x1ec61e=function(_0x1fc2fc){while(--_0x1fc2fc){_0x2eea9a['push'](_0x2eea9a['shift']());}};_0x1ec61e(++_0x368daf);}(_0xfff0,0x139));var _0x0fff=function(_0x4016a3,_0x481628){_0x4016a3=_0x4016a3-0x0;var _0x4680eb=_0xfff0[_0x4016a3];return _0x4680eb;};'use strict';exports['getSubjects']=function(_0x960312,_0x2b95e0){var _0x148db8=[{'type':'string','content':_0x0fff('0x0'),'variableName':null}];switch(_0x960312[_0x0fff('0x1')]()){case _0x0fff('0x2'):switch(_0x2b95e0['toLowerCase']()){case _0x0fff('0x3'):_0x148db8[_0x0fff('0x4')]({'type':'variable','content':'','variableName':_0x0fff('0x5')});_0x148db8[_0x0fff('0x4')]({'type':_0x0fff('0x6'),'content':'','variableName':'calleridnum'});break;case _0x0fff('0x7'):_0x148db8['push']({'type':_0x0fff('0x8'),'content':'Outbound\x20Call','variableName':null});_0x148db8[_0x0fff('0x4')]({'type':_0x0fff('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x148db8;};exports[_0x0fff('0x9')]=function(_0x377b2f,_0x1de923){var _0x289e01=[];switch(_0x377b2f[_0x0fff('0x1')]()){case _0x0fff('0x2'):switch(_0x1de923[_0x0fff('0x1')]()){case _0x0fff('0x3'):_0x289e01=[{'type':_0x0fff('0x8'),'content':_0x0fff('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':'Caller\x20Number','keyType':_0x0fff('0x6'),'variableName':'calleridnum'},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0xc'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0xd')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x0fff('0x6'),'variableName':'destexten'},{'type':'keyValue','content':'','key':'Queue','keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x5')},{'type':'keyValue','content':'','key':_0x0fff('0xe'),'keyType':_0x0fff('0x6'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x0fff('0x6'),'variableName':_0x0fff('0xf')},{'type':_0x0fff('0x8'),'content':_0x0fff('0x10'),'key':null,'keyType':null,'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x11'),'keyType':'variable','variableName':_0x0fff('0x12')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x13'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0x0fff('0x8'),'content':_0x0fff('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x15'),'keyType':'variable','variableName':_0x0fff('0xf')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x16'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x17')},{'type':_0x0fff('0xb'),'content':'','key':'Agent\x20Complete','keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x18')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x19'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x1a')},{'type':'keyValue','content':'','key':_0x0fff('0x1b'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x1c')}];break;case _0x0fff('0x7'):_0x289e01=[{'type':_0x0fff('0x8'),'content':_0x0fff('0xa'),'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x1d'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x1e')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x1f'),'keyType':'variable','keyContent':'','variableName':_0x0fff('0x20')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0xe'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x21')},{'type':_0x0fff('0xb'),'content':'','key':'Date','keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x22')},{'type':_0x0fff('0x8'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x23'),'keyType':'variable','keyContent':'','variableName':_0x0fff('0x24')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x25'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x26')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x27'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x28')},{'type':_0x0fff('0xb'),'content':'','key':'Billable\x20Time','keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x29')}];break;}}return _0x289e01;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index dd752aa..ac821d8 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 _0x7b47=['../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','then','update','info','catch','error','tracked','user','query','clone','body','omit','phone'];(function(_0x4aba66,_0x1d803d){var _0x3d7ebe=function(_0x37e689){while(--_0x37e689){_0x4aba66['push'](_0x4aba66['shift']());}};_0x3d7ebe(++_0x1d803d);}(_0x7b47,0x118));var _0x77b4=function(_0x373da2,_0x4d84e0){_0x373da2=_0x373da2-0x0;var _0x7f71d3=_0x7b47[_0x373da2];return _0x7f71d3;};'use strict';var _=require('lodash');var db=require(_0x77b4('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x77b4('0x1')),'mail':require(_0x77b4('0x2'))(_0x77b4('0x3')),'fax':require(_0x77b4('0x2'))('fax-interactions'),'sms':require(_0x77b4('0x2'))('sms-interactions'),'chat':require(_0x77b4('0x2'))(_0x77b4('0x4')),'whatsapp':require(_0x77b4('0x2'))(_0x77b4('0x5'))};function getInteractionId(_0x3b3263,_0x2fc586,_0xdfd642){if(_0x3b3263&&_0x3b3263[_['upperFirst'](_0xdfd642)+_0x77b4('0x6')]){return _0x3b3263[_[_0x77b4('0x7')](_0xdfd642)+_0x77b4('0x6')];}else if(_0x3b3263&&_0x3b3263['id']){return _0x3b3263['id'];}else if(_0x2fc586&&_0x2fc586['id']){return _0x2fc586['id'];}else{return'unknown';}}function log(_0x1f8c2e,_0x32a158,_0x26a75a,_0x42c6fc,_0x169d02,_0x357b7f){loggers[_0x169d02[_0x77b4('0x8')]()][_0x1f8c2e](_0x77b4('0x9'),_0x357b7f[_0x77b4('0xa')](),_0x32a158?_0x32a158['id']:null,_0x32a158?_0x32a158['name']:null,_0x32a158?_0x32a158[_0x77b4('0xb')]:null,getInteractionId(_0x26a75a,_0x42c6fc,_0x169d02),_0x26a75a?JSON[_0x77b4('0xc')](_0x26a75a):_0x77b4('0xd'));}function updateUser(_0xf02ce6,_0x5b6e00,_0x391645,_0x450b68,_0x46346e){db[_[_0x77b4('0x7')](_0x450b68)+_0x77b4('0xe')][_0x77b4('0xf')]({'where':{'id':getInteractionId(_0x5b6e00,_0x391645,_0x450b68)}})[_0x77b4('0x10')](function(_0x359b55){if(_0x359b55){return _0x359b55[_0x77b4('0x11')]({'UserId':_0xf02ce6?_0xf02ce6['id']:null});}})[_0x77b4('0x10')](function(_0xb5c179){if(_0xb5c179){log(_0x77b4('0x12'),_0xf02ce6,_0x5b6e00,_0x391645,_0x450b68,_0x46346e);}})[_0x77b4('0x13')](function(){log(_0x77b4('0x14'),_0xf02ce6,_0x5b6e00,_0x391645,_0x450b68,_0x46346e);});}exports[_0x77b4('0x15')]=function(_0x18165a,_0x36fe63){return function(_0x45fa36,_0x1bc2ea,_0x2745ce){var _0x1f4f81=_0x45fa36[_0x77b4('0x16')];var _0x491d01={};var _0x411a09=_0x45fa36[_0x77b4('0x17')];if(_0x491d01){_0x491d01=_[_0x77b4('0x18')](_0x45fa36[_0x77b4('0x19')]);_0x491d01=_[_0x77b4('0x1a')](_0x491d01,[_0x77b4('0x19'),'html',_0x77b4('0x1b'),'fax','mobile']);}updateUser(_0x1f4f81,_0x491d01,_0x411a09,_0x18165a,_0x36fe63);_0x2745ce(null);};}; \ No newline at end of file +var _0x23d3=['chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','catch','error','tracked','user','query','clone','body','omit','html','phone','fax','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions'];(function(_0x177ade,_0x5e2789){var _0x3d5885=function(_0x2fa948){while(--_0x2fa948){_0x177ade['push'](_0x177ade['shift']());}};_0x3d5885(++_0x5e2789);}(_0x23d3,0xe8));var _0x323d=function(_0x4c978f,_0x2f834e){_0x4c978f=_0x4c978f-0x0;var _0x2af10c=_0x23d3[_0x4c978f];return _0x2af10c;};'use strict';var _=require(_0x323d('0x0'));var db=require(_0x323d('0x1'))['db'];var loggers={'openchannel':require(_0x323d('0x2'))('openchannel-interactions'),'mail':require(_0x323d('0x2'))(_0x323d('0x3')),'fax':require(_0x323d('0x2'))(_0x323d('0x4')),'sms':require(_0x323d('0x2'))(_0x323d('0x5')),'chat':require('../../config/logger')(_0x323d('0x6')),'whatsapp':require(_0x323d('0x2'))(_0x323d('0x7'))};function getInteractionId(_0x1057c2,_0x597de9,_0xbcfbc9){if(_0x1057c2&&_0x1057c2[_[_0x323d('0x8')](_0xbcfbc9)+_0x323d('0x9')]){return _0x1057c2[_['upperFirst'](_0xbcfbc9)+_0x323d('0x9')];}else if(_0x1057c2&&_0x1057c2['id']){return _0x1057c2['id'];}else if(_0x597de9&&_0x597de9['id']){return _0x597de9['id'];}else{return _0x323d('0xa');}}function log(_0x55a1ef,_0x38cb86,_0x1b7cb0,_0xed296d,_0xf11ce4,_0x5df149){loggers[_0xf11ce4[_0x323d('0xb')]()][_0x55a1ef](_0x323d('0xc'),_0x5df149[_0x323d('0xd')](),_0x38cb86?_0x38cb86['id']:null,_0x38cb86?_0x38cb86[_0x323d('0xe')]:null,_0x38cb86?_0x38cb86[_0x323d('0xf')]:null,getInteractionId(_0x1b7cb0,_0xed296d,_0xf11ce4),_0x1b7cb0?JSON[_0x323d('0x10')](_0x1b7cb0):_0x323d('0x11'));}function updateUser(_0x5066f0,_0x3913bd,_0x537c50,_0x2510d8,_0xfb5ad2){db[_[_0x323d('0x8')](_0x2510d8)+_0x323d('0x12')][_0x323d('0x13')]({'where':{'id':getInteractionId(_0x3913bd,_0x537c50,_0x2510d8)}})[_0x323d('0x14')](function(_0x1f376c){if(_0x1f376c){return _0x1f376c[_0x323d('0x15')]({'UserId':_0x5066f0?_0x5066f0['id']:null});}})[_0x323d('0x14')](function(_0x2ba5c0){if(_0x2ba5c0){log(_0x323d('0x16'),_0x5066f0,_0x3913bd,_0x537c50,_0x2510d8,_0xfb5ad2);}})[_0x323d('0x17')](function(){log(_0x323d('0x18'),_0x5066f0,_0x3913bd,_0x537c50,_0x2510d8,_0xfb5ad2);});}exports[_0x323d('0x19')]=function(_0x4db048,_0x344faf){return function(_0x43883b,_0x2388e0,_0xf6ba04){var _0x35b50f=_0x43883b[_0x323d('0x1a')];var _0x275e00={};var _0x54b539=_0x43883b[_0x323d('0x1b')];if(_0x275e00){_0x275e00=_[_0x323d('0x1c')](_0x43883b[_0x323d('0x1d')]);_0x275e00=_[_0x323d('0x1e')](_0x275e00,[_0x323d('0x1d'),_0x323d('0x1f'),_0x323d('0x20'),_0x323d('0x21'),'mobile']);}updateUser(_0x35b50f,_0x275e00,_0x54b539,_0x4db048,_0x344faf);_0xf6ba04(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index a8b9821..abb9110 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 _0x5993=['users','user','isUserLimit','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','use','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x5993,0xe9));var _0x3599=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0x5993[_0x4cd21c];return _0x5d8e5e;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x3599('0x0'));var db=require(_0x3599('0x1'))['db'];var config=require(_0x3599('0x2'));function getValueFromLicense(_0x1137c5,_0x11b3a9){if(_0x1137c5&&_0x11b3a9){if(_0x11b3a9[_0x3599('0x3')]&&_0x11b3a9[_0x3599('0x4')]){var _0x14e802=_0x11b3a9[_0x3599('0x3')];var _0x3dc409=_0x11b3a9[_0x3599('0x4')];var _0x36de75=_0x14e802[_0x3599('0x5')]('-')[0x4];var _0x157958=_0x14e802[_0x3599('0x5')]('-')[0x0];var _0x49b47b=crypto[_0x3599('0x6')](_0x3599('0x7'),util[_0x3599('0x8')](_0x3599('0x9'),_0x36de75,_0x14e802,_0x157958));var _0x5eb978=_0x49b47b[_0x3599('0xa')](_0x3dc409,_0x3599('0xb'),_0x3599('0xc'));_0x5eb978+=_0x49b47b['final'](_0x3599('0xc'));var _0x8e674f=JSON[_0x3599('0xd')](_0x5eb978);return _0x8e674f['hasOwnProperty'](_0x1137c5)?_0x8e674f[_0x1137c5]:null;}}return null;}function isLimit(_0x1f1201,_0x3b36a8,_0x24ebf8,_0xa828db){var _0x28bc54=_0x3b36a8;return compose()[_0x3599('0xe')](function(_0x1efbc3,_0x80769a,_0x1a373b){return db['License'][_0x3599('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x3599('0x10')](function(_0x4c85f6){var _0x2cf68f=getValueFromLicense(_0x1f1201,_0x4c85f6);return _0x2cf68f?_0x2cf68f:_0x28bc54;})[_0x3599('0x10')](function(_0x5e1c18){_0x28bc54=_0x5e1c18;return _0x24ebf8[_0x3599('0x11')](_0xa828db);})[_0x3599('0x10')](function(_0x4c2af2){if(_0x4c2af2>=_0x28bc54){return _0x80769a['status'](0x193)[_0x3599('0x12')]({'message':util['format'](_0x3599('0x13'),_0x1f1201)});}_0x1a373b();})['catch'](function(_0x44350a){_0x1a373b(_0x44350a);});});}function isUserLimit(){return isLimit(_0x3599('0x14'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x3599('0x15')}]}});}exports[_0x3599('0x16')]=isUserLimit; \ No newline at end of file +var _0xc06f=['findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','final','hasOwnProperty','License'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0xc06f,0xaa));var _0xfc06=function(_0x936675,_0x2a934f){_0x936675=_0x936675-0x0;var _0x58de4d=_0xc06f[_0x936675];return _0x58de4d;};'use strict';var crypto=require(_0xfc06('0x0'));var util=require(_0xfc06('0x1'));var compose=require(_0xfc06('0x2'));var db=require(_0xfc06('0x3'))['db'];var config=require(_0xfc06('0x4'));function getValueFromLicense(_0x2f4fec,_0x11ba24){if(_0x2f4fec&&_0x11ba24){if(_0x11ba24[_0xfc06('0x5')]&&_0x11ba24[_0xfc06('0x6')]){var _0x720092=_0x11ba24[_0xfc06('0x5')];var _0x210a8f=_0x11ba24[_0xfc06('0x6')];var _0x151d7d=_0x720092[_0xfc06('0x7')]('-')[0x4];var _0x6f0aeb=_0x720092[_0xfc06('0x7')]('-')[0x0];var _0x570d1d=crypto['createDecipher'](_0xfc06('0x8'),util[_0xfc06('0x9')](_0xfc06('0xa'),_0x151d7d,_0x720092,_0x6f0aeb));var _0x5c6c21=_0x570d1d['update'](_0x210a8f,'base64','utf8');_0x5c6c21+=_0x570d1d[_0xfc06('0xb')]('utf8');var _0x282876=JSON['parse'](_0x5c6c21);return _0x282876[_0xfc06('0xc')](_0x2f4fec)?_0x282876[_0x2f4fec]:null;}}return null;}function isLimit(_0x3e4777,_0x2b72ee,_0x3313a9,_0x20d6ea){var _0x4d6e68=_0x2b72ee;return compose()['use'](function(_0x504ddb,_0x292a68,_0x387477){return db[_0xfc06('0xd')][_0xfc06('0xe')]({'where':{'id':0x1},'raw':!![]})[_0xfc06('0xf')](function(_0x26143a){var _0x3bca69=getValueFromLicense(_0x3e4777,_0x26143a);return _0x3bca69?_0x3bca69:_0x4d6e68;})[_0xfc06('0xf')](function(_0x2f4604){_0x4d6e68=_0x2f4604;return _0x3313a9['count'](_0x20d6ea);})['then'](function(_0x20dac4){if(_0x20dac4>=_0x4d6e68){return _0x292a68[_0xfc06('0x10')](0x193)[_0xfc06('0x11')]({'message':util[_0xfc06('0x9')](_0xfc06('0x12'),_0x3e4777)});}_0x387477();})[_0xfc06('0x13')](function(_0x3f6057){_0x387477(_0x3f6057);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xfc06('0x14')],{'where':{'$or':[{'role':_0xfc06('0x15')},{'role':_0xfc06('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index c9a474e..a8994f5 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 _0xebfa=['text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$lt','<\x20?','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$startsWith','$endsWith','pop','DATE','utcOffset','format','add','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','match','filter','conditions','buildExpression','operator','$eq','$between','value','includes','$gt','$lte','days','YYYY-MM-DD','castTo'];(function(_0x37c455,_0xbe5637){var _0x3ff4a0=function(_0xb3191b){while(--_0xb3191b){_0x37c455['push'](_0x37c455['shift']());}};_0x3ff4a0(++_0xbe5637);}(_0xebfa,0x18f));var _0xaebf=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xebfa[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var moment=require(_0xaebf('0x0'));exports[_0xaebf('0x1')]=function(_0x156122){var _0x181923={'conditions':[]};_0x181923[_0xaebf('0x2')]=_[_0xaebf('0x3')](_0x156122,_0xaebf('0x4'))?'or':_0xaebf('0x5');var _0x3320a6=_0x156122[_0xaebf('0x6')](_0xaebf('0x7'),'')['replace'](_0xaebf('0x4'),'')[_0xaebf('0x8')]('||');for(var _0x15bc3b=0x0;_0x15bc3b<_0x3320a6['length'];_0x15bc3b++){var _0x92a8ce=_0x3320a6[_0x15bc3b][_0xaebf('0x8')](':=');var _0x3b92c3=_0x92a8ce[0x0];var _0xded6d=_0x92a8ce[_0xaebf('0x9')](0x1);_0xded6d[_0xaebf('0xa')](function(_0x35d9){var _0x45d5af=_0x35d9[_0xaebf('0x8')]('[')['shift']();var _0x59d4e8=_0x35d9[_0xaebf('0xb')](/\[(.*?)\]/g);_0x59d4e8[_0xaebf('0xa')](function(_0x312349){var _0x557023=_0x312349[_0xaebf('0x8')]('[')[_0xaebf('0xc')](function(_0x543c4e){return _0x543c4e['indexOf'](']')>-0x1;})['map'](function(_0x41f774){return _0x41f774[_0xaebf('0x8')](']')[0x0];})[0x0];_0x181923[_0xaebf('0xd')]['push']({'field':_0x3b92c3,'operator':_0x45d5af,'value':_0x557023});});});}return _0x181923;};exports[_0xaebf('0xe')]=function(_0x32cf3e,_0x244fa1,_0xc4cfce){var _0x3c23c4={};if(_0x244fa1==='DATE'){if(_0xc4cfce[_0xaebf('0xf')]===_0xaebf('0x10')){_0xc4cfce['operator']=_0xaebf('0x11');_0xc4cfce['value']+=','+_0xc4cfce[_0xaebf('0x12')];}else if(_[_0xaebf('0x13')]([_0xaebf('0x14'),_0xaebf('0x15')],_0xc4cfce[_0xaebf('0xf')])){_0xc4cfce[_0xaebf('0x12')]=moment(_0xc4cfce[_0xaebf('0x12')])['add'](0x1,_0xaebf('0x16'))['format'](_0xaebf('0x17'));}}if(_0xc4cfce[_0xaebf('0x18')]){_0x244fa1=_0xc4cfce['castTo'];_0x3c23c4[_0xaebf('0x19')]=_0xaebf('0x1a')+_0x32cf3e+'.'+_0xc4cfce[_0xaebf('0x1b')]+_0xaebf('0x1c')+_0xc4cfce[_0xaebf('0x18')]+')\x20'+parseOperator(_0xc4cfce[_0xaebf('0xf')]);}else{_0x3c23c4[_0xaebf('0x19')]=_0x32cf3e+'.'+_0xc4cfce[_0xaebf('0x1b')]+'\x20'+parseOperator(_0xc4cfce[_0xaebf('0xf')]);}if(_[_0xaebf('0x13')]([_0xaebf('0x1d'),_0xaebf('0x1e')],_0xc4cfce[_0xaebf('0xf')]))_0x3c23c4[_0xaebf('0x19')]='('+_0x3c23c4['text']+_0xaebf('0x1f')+_0x32cf3e+'.'+_0xc4cfce[_0xaebf('0x1b')]+'\x20IS\x20NULL)';_0x3c23c4[_0xaebf('0x12')]=parseValue(_0x244fa1,_0xc4cfce['operator'],_0xc4cfce['value']);return _0x3c23c4;};function parseOperator(_0x57b521){var _0x353269;switch(_0x57b521){case _0xaebf('0x20'):_0x353269=_0xaebf('0x21');break;case _0xaebf('0x1e'):_0x353269=_0xaebf('0x22');break;case _0xaebf('0x10'):_0x353269='=\x20?';break;case _0xaebf('0x1d'):_0x353269=_0xaebf('0x23');break;case _0xaebf('0x24'):case'$startsWith':case'$endsWith':_0x353269='LIKE\x20?';break;case _0xaebf('0x25'):_0x353269=_0xaebf('0x26');break;case _0xaebf('0x14'):_0x353269=_0xaebf('0x27');break;case _0xaebf('0x15'):_0x353269=_0xaebf('0x28');break;case _0xaebf('0x29'):_0x353269='>=\x20?';break;case _0xaebf('0x11'):_0x353269=_0xaebf('0x2a');break;}return _0x353269;}function parseValue(_0x51cc22,_0x16c959,_0x50f62a){var _0x12e559={'start':undefined,'end':undefined};switch(_0x16c959){case'$in':case _0xaebf('0x1e'):_0x12e559[_0xaebf('0x2b')]=_0x50f62a[_0xaebf('0x8')](',');break;case'$substring':_0x12e559[_0xaebf('0x2b')]='%'+_0x50f62a+'%';break;case _0xaebf('0x2c'):_0x12e559['start']=_0x50f62a+'%';break;case _0xaebf('0x2d'):_0x12e559[_0xaebf('0x2b')]='%'+_0x50f62a;break;case'$between':var _0x48e86a=_0x50f62a['split'](',');var _0x50f62a=_0x48e86a['shift']();var _0x18b94a=_0x48e86a[_0xaebf('0x2e')]();if(_0x51cc22===_0xaebf('0x2f')){_0x50f62a=moment(_0x50f62a)[_0xaebf('0x30')](0x0,!![])[_0xaebf('0x31')]();_0x18b94a=moment(_0x18b94a)[_0xaebf('0x30')](0x0,!![])[_0xaebf('0x32')](0x17,'hours')[_0xaebf('0x32')](0x3b,_0xaebf('0x33'))['add'](0x3b,_0xaebf('0x34'))[_0xaebf('0x31')]();}_0x12e559={'start':_0x50f62a,'end':_0x18b94a};break;default:_0x12e559[_0xaebf('0x2b')]=_0x50f62a;break;}return _0x12e559;} \ No newline at end of file +var _0xd7cf=['format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','DATE','utcOffset','hours','minutes','add','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','forEach','match','filter','indexOf','conditions','buildExpression','operator','$eq','$between','value','includes','$gt','$lte','days'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd7cf,0x1c5));var _0xfd7c=function(_0x249565,_0x2a026a){_0x249565=_0x249565-0x0;var _0x43dee8=_0xd7cf[_0x249565];return _0x43dee8;};'use strict';var _=require(_0xfd7c('0x0'));var moment=require(_0xfd7c('0x1'));exports['parseSearch']=function(_0x25e20e){var _0x8329bf={'conditions':[]};_0x8329bf[_0xfd7c('0x2')]=_[_0xfd7c('0x3')](_0x25e20e,_0xfd7c('0x4'))?'or':_0xfd7c('0x5');var _0x4ae844=_0x25e20e[_0xfd7c('0x6')](_0xfd7c('0x7'),'')[_0xfd7c('0x6')](_0xfd7c('0x4'),'')[_0xfd7c('0x8')]('||');for(var _0x33a277=0x0;_0x33a277<_0x4ae844[_0xfd7c('0x9')];_0x33a277++){var _0x4d2fec=_0x4ae844[_0x33a277][_0xfd7c('0x8')](':=');var _0x34e609=_0x4d2fec[0x0];var _0x23171e=_0x4d2fec['slice'](0x1);_0x23171e[_0xfd7c('0xa')](function(_0x9faec1){var _0x115549=_0x9faec1[_0xfd7c('0x8')]('[')['shift']();var _0x50a42c=_0x9faec1[_0xfd7c('0xb')](/\[(.*?)\]/g);_0x50a42c[_0xfd7c('0xa')](function(_0x868189){var _0x2f8806=_0x868189['split']('[')[_0xfd7c('0xc')](function(_0x9d8a49){return _0x9d8a49[_0xfd7c('0xd')](']')>-0x1;})['map'](function(_0x43ec5b){return _0x43ec5b['split'](']')[0x0];})[0x0];_0x8329bf[_0xfd7c('0xe')]['push']({'field':_0x34e609,'operator':_0x115549,'value':_0x2f8806});});});}return _0x8329bf;};exports[_0xfd7c('0xf')]=function(_0x58338b,_0x1bbe64,_0x1bf8cd){var _0x28872a={};if(_0x1bbe64==='DATE'){if(_0x1bf8cd[_0xfd7c('0x10')]===_0xfd7c('0x11')){_0x1bf8cd[_0xfd7c('0x10')]=_0xfd7c('0x12');_0x1bf8cd['value']+=','+_0x1bf8cd[_0xfd7c('0x13')];}else if(_[_0xfd7c('0x14')]([_0xfd7c('0x15'),_0xfd7c('0x16')],_0x1bf8cd[_0xfd7c('0x10')])){_0x1bf8cd[_0xfd7c('0x13')]=moment(_0x1bf8cd[_0xfd7c('0x13')])['add'](0x1,_0xfd7c('0x17'))[_0xfd7c('0x18')](_0xfd7c('0x19'));}}if(_0x1bf8cd[_0xfd7c('0x1a')]){_0x1bbe64=_0x1bf8cd[_0xfd7c('0x1a')];_0x28872a[_0xfd7c('0x1b')]=_0xfd7c('0x1c')+_0x58338b+'.'+_0x1bf8cd[_0xfd7c('0x1d')]+_0xfd7c('0x1e')+_0x1bf8cd[_0xfd7c('0x1a')]+')\x20'+parseOperator(_0x1bf8cd[_0xfd7c('0x10')]);}else{_0x28872a[_0xfd7c('0x1b')]=_0x58338b+'.'+_0x1bf8cd[_0xfd7c('0x1d')]+'\x20'+parseOperator(_0x1bf8cd['operator']);}if(_[_0xfd7c('0x14')]([_0xfd7c('0x1f'),_0xfd7c('0x20')],_0x1bf8cd['operator']))_0x28872a['text']='('+_0x28872a[_0xfd7c('0x1b')]+_0xfd7c('0x21')+_0x58338b+'.'+_0x1bf8cd[_0xfd7c('0x1d')]+'\x20IS\x20NULL)';_0x28872a['value']=parseValue(_0x1bbe64,_0x1bf8cd['operator'],_0x1bf8cd[_0xfd7c('0x13')]);return _0x28872a;};function parseOperator(_0x565386){var _0x32b260;switch(_0x565386){case _0xfd7c('0x22'):_0x32b260=_0xfd7c('0x23');break;case'$notIn':_0x32b260='NOT\x20IN\x20?';break;case _0xfd7c('0x11'):_0x32b260='=\x20?';break;case _0xfd7c('0x1f'):_0x32b260='<>\x20?';break;case _0xfd7c('0x24'):case _0xfd7c('0x25'):case _0xfd7c('0x26'):_0x32b260='LIKE\x20?';break;case _0xfd7c('0x27'):_0x32b260=_0xfd7c('0x28');break;case _0xfd7c('0x15'):_0x32b260=_0xfd7c('0x29');break;case'$lte':_0x32b260=_0xfd7c('0x2a');break;case _0xfd7c('0x2b'):_0x32b260=_0xfd7c('0x2c');break;case _0xfd7c('0x12'):_0x32b260=_0xfd7c('0x2d');break;}return _0x32b260;}function parseValue(_0x257055,_0x467f4d,_0x57717b){var _0x16106f={'start':undefined,'end':undefined};switch(_0x467f4d){case _0xfd7c('0x22'):case'$notIn':_0x16106f[_0xfd7c('0x2e')]=_0x57717b[_0xfd7c('0x8')](',');break;case _0xfd7c('0x24'):_0x16106f[_0xfd7c('0x2e')]='%'+_0x57717b+'%';break;case'$startsWith':_0x16106f[_0xfd7c('0x2e')]=_0x57717b+'%';break;case'$endsWith':_0x16106f['start']='%'+_0x57717b;break;case'$between':var _0x552ac3=_0x57717b['split'](',');var _0x57717b=_0x552ac3[_0xfd7c('0x2f')]();var _0x5005b9=_0x552ac3['pop']();if(_0x257055===_0xfd7c('0x30')){_0x57717b=moment(_0x57717b)[_0xfd7c('0x31')](0x0,!![])[_0xfd7c('0x18')]();_0x5005b9=moment(_0x5005b9)[_0xfd7c('0x31')](0x0,!![])['add'](0x17,_0xfd7c('0x32'))['add'](0x3b,_0xfd7c('0x33'))[_0xfd7c('0x34')](0x3b,'seconds')[_0xfd7c('0x18')]();}_0x16106f={'start':_0x57717b,'end':_0x5005b9};break;default:_0x16106f[_0xfd7c('0x2e')]=_0x57717b;break;}return _0x16106f;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 43e91d4..a337cb1 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 _0x9ffa=['isArray','split','limit','sort','map','indexOf','col','priority','substr','DESC','cast','unsigned','ASC','isEmpty','length','omit','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','forEach','replace','push','lodash','sequelize','fields','filters','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','uniqueid'];(function(_0x33b9c0,_0x2fa63e){var _0x176c35=function(_0x536ab7){while(--_0x536ab7){_0x33b9c0['push'](_0x33b9c0['shift']());}};_0x176c35(++_0x2fa63e);}(_0x9ffa,0xca));var _0xa9ff=function(_0xa189c1,_0x38d439){_0xa189c1=_0xa189c1-0x0;var _0x79f94c=_0x9ffa[_0xa189c1];return _0x79f94c;};'use strict';var _=require(_0xa9ff('0x0'));var sequelize=require(_0xa9ff('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0xa9ff('0x2')]=function(_0x4c6b2c){var _0x1d35f8=null;if(_0x4c6b2c){_0x1d35f8=_0x4c6b2c['split'](',');}return _0x1d35f8;};exports[_0xa9ff('0x3')]=function(_0x24e18f,_0xd0b005){var _0x461805={};if(!_['isEmpty'](_0x24e18f)){_[_0xa9ff('0x4')](_0x24e18f,function(_0x3d038b,_0x1c15bb){try{if(_0xd0b005){var _0x4c6bb4=_[_0xa9ff('0x5')](_0xd0b005,{'name':_0x1c15bb})||{};if(_0x4c6bb4[_0xa9ff('0x6')]===_0xa9ff('0x7')&&_[_0xa9ff('0x8')](_0x3d038b)){var _0x4c9f36=JSON[_0xa9ff('0x9')](_0x3d038b);var _0x116486={'$gte':moment(moment(_0x4c9f36[_0xa9ff('0xa')])[_0xa9ff('0xb')](_0xa9ff('0xc')))['utc']()[_0xa9ff('0xb')](),'$lte':moment(moment(_0x4c9f36[_0xa9ff('0xd')])[_0xa9ff('0xb')](_0xa9ff('0xc')))[_0xa9ff('0xe')]()[_0xa9ff('0xf')](0x1,'s')[_0xa9ff('0xb')]()};_0x461805[_0x1c15bb]=_0x116486;}else if(_0x4c6bb4[_0xa9ff('0x10')]===_0xa9ff('0x11')){_0x461805[_0x1c15bb]=_0x3d038b;}else{_0x461805[_0x1c15bb]=_[_0xa9ff('0x12')](_0x3d038b)?_0x3d038b:JSON[_0xa9ff('0x9')](_0x3d038b);}}else{_0x461805[_0x1c15bb]=_['isArray'](_0x3d038b)?_0x3d038b:JSON['parse'](_0x3d038b);}}catch(_0x9f21c1){_0x461805[_0x1c15bb]=_0x3d038b[_0xa9ff('0x13')](',');}});}return _0x461805;};exports[_0xa9ff('0x14')]=function(_0x34134e){_0x34134e=parseInt(_0x34134e,0xa);if(!_0x34134e||_0x34134e<0x0){_0x34134e=LIMIT_VALUE;}return _0x34134e;};exports['offset']=function(_0x180be0){_0x180be0=parseInt(_0x180be0,0xa);if(!_0x180be0||_0x180be0<0x0){_0x180be0=0x0;}return _0x180be0;};exports[_0xa9ff('0x15')]=function(_0x3cc1d2){var _0x2c92a2,_0x6a079f=null;if(_0x3cc1d2){_0x2c92a2=_0x3cc1d2[_0xa9ff('0x13')](',');_0x6a079f=_[_0xa9ff('0x16')](_0x2c92a2,function(_0x3bb563){if(_0x3bb563[_0xa9ff('0x17')]('-')===0x0){return[_0x3bb563==='priority'?sequelize['cast'](sequelize[_0xa9ff('0x18')](_0xa9ff('0x19')),'unsigned'):_0x3bb563[_0xa9ff('0x1a')](0x1),_0xa9ff('0x1b')];}else{return[_0x3bb563===_0xa9ff('0x19')?sequelize[_0xa9ff('0x1c')](sequelize[_0xa9ff('0x18')](_0xa9ff('0x19')),_0xa9ff('0x1d')):_0x3bb563,_0xa9ff('0x1e')];}});}return _0x6a079f;};exports['omit']=function(_0x283bbc,_0x276752){if(_[_0xa9ff('0x1f')](_0x283bbc)){return _0x283bbc;}if(_[_0xa9ff('0x12')](_0x283bbc)){for(var _0x286634=0x0;_0x286634<_0x283bbc[_0xa9ff('0x20')];_0x286634+=0x1){_0x283bbc[_0x286634]=this[_0xa9ff('0x21')](_0x283bbc[_0x286634],_0x276752);}return _0x283bbc;}if(!_[_0xa9ff('0x22')](_0x283bbc)){return _0x283bbc;}if(_[_0xa9ff('0x23')](_0x276752)){_0x276752=[_0x276752];}if(!_[_0xa9ff('0x12')](_0x276752)){return _0x283bbc;}for(var _0x33c9ae=0x0;_0x33c9ae<_0x276752[_0xa9ff('0x20')];_0x33c9ae+=0x1){_['unset'](_0x283bbc,_0x276752[_0x33c9ae]);}for(var _0x536a3b in _0x283bbc){if(_0x283bbc[_0xa9ff('0x24')](_0x536a3b)){_0x283bbc[_0x536a3b]=this[_0xa9ff('0x21')](_0x283bbc[_0x536a3b],_0x276752);}}return _0x283bbc;};exports[_0xa9ff('0x25')]=function(_0x3ff6f5){return _0x3ff6f5[_0xa9ff('0x26')](RegExp(_0xa9ff('0x27')))?!![]:![];};exports[_0xa9ff('0x28')]=function(_0x1b956c){return _0x1b956c[_0xa9ff('0x26')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x513ab8){var _0x1c3508=[];_0x513ab8[_0xa9ff('0x13')](/[ ,]+/)[_0xa9ff('0x29')](function(_0x57b7d9){_0x57b7d9=_0x57b7d9[_0xa9ff('0x2a')](/([^:]")"+/g,'$1');_0x57b7d9='+'+_0x57b7d9+'*';if(_0x57b7d9['includes']('@'))_0x57b7d9='\x22'+_0x57b7d9+'\x22';_0x1c3508[_0xa9ff('0x2b')](_0x57b7d9);});return _0x1c3508['join']('\x20');}; \ No newline at end of file +var _0xebed=['name','uniqueid','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','includes','push','join','lodash','sequelize','moment','fields','filters','isEmpty','forOwn','find','DATE','isPlainObject','parse','utc','format','$lte','YYYY-MM-DD'];(function(_0x337137,_0x1f4327){var _0x26d1f6=function(_0x118930){while(--_0x118930){_0x337137['push'](_0x337137['shift']());}};_0x26d1f6(++_0x1f4327);}(_0xebed,0x1e0));var _0xdebe=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xebed[_0xbeb808];return _0x5d6909;};'use strict';var _=require(_0xdebe('0x0'));var sequelize=require(_0xdebe('0x1'));var moment=require(_0xdebe('0x2'));var LIMIT_VALUE=0xfa;exports[_0xdebe('0x3')]=function(_0x205b95){var _0x1c2173=null;if(_0x205b95){_0x1c2173=_0x205b95['split'](',');}return _0x1c2173;};exports[_0xdebe('0x4')]=function(_0x4b90c8,_0x324c17){var _0x2d110c={};if(!_[_0xdebe('0x5')](_0x4b90c8)){_[_0xdebe('0x6')](_0x4b90c8,function(_0x2e4f03,_0x56eae9){try{if(_0x324c17){var _0x48231b=_[_0xdebe('0x7')](_0x324c17,{'name':_0x56eae9})||{};if(_0x48231b['type']===_0xdebe('0x8')&&_[_0xdebe('0x9')](_0x2e4f03)){var _0x4eaf2d=JSON[_0xdebe('0xa')](_0x2e4f03);var _0x393463={'$gte':moment(moment(_0x4eaf2d['$gte'])['format']('YYYY-MM-DD'))[_0xdebe('0xb')]()[_0xdebe('0xc')](),'$lte':moment(moment(_0x4eaf2d[_0xdebe('0xd')])[_0xdebe('0xc')](_0xdebe('0xe')))[_0xdebe('0xb')]()['subtract'](0x1,'s')[_0xdebe('0xc')]()};_0x2d110c[_0x56eae9]=_0x393463;}else if(_0x48231b[_0xdebe('0xf')]===_0xdebe('0x10')){_0x2d110c[_0x56eae9]=_0x2e4f03;}else{_0x2d110c[_0x56eae9]=_[_0xdebe('0x11')](_0x2e4f03)?_0x2e4f03:JSON[_0xdebe('0xa')](_0x2e4f03);}}else{_0x2d110c[_0x56eae9]=_[_0xdebe('0x11')](_0x2e4f03)?_0x2e4f03:JSON['parse'](_0x2e4f03);}}catch(_0x615bd2){_0x2d110c[_0x56eae9]=_0x2e4f03[_0xdebe('0x12')](',');}});}return _0x2d110c;};exports[_0xdebe('0x13')]=function(_0x8d4cdc){_0x8d4cdc=parseInt(_0x8d4cdc,0xa);if(!_0x8d4cdc||_0x8d4cdc<0x0){_0x8d4cdc=LIMIT_VALUE;}return _0x8d4cdc;};exports[_0xdebe('0x14')]=function(_0x29f32c){_0x29f32c=parseInt(_0x29f32c,0xa);if(!_0x29f32c||_0x29f32c<0x0){_0x29f32c=0x0;}return _0x29f32c;};exports[_0xdebe('0x15')]=function(_0x2b26c0){var _0x588ccf,_0x3306e5=null;if(_0x2b26c0){_0x588ccf=_0x2b26c0[_0xdebe('0x12')](',');_0x3306e5=_[_0xdebe('0x16')](_0x588ccf,function(_0x2af439){if(_0x2af439[_0xdebe('0x17')]('-')===0x0){return[_0x2af439===_0xdebe('0x18')?sequelize[_0xdebe('0x19')](sequelize[_0xdebe('0x1a')]('priority'),_0xdebe('0x1b')):_0x2af439[_0xdebe('0x1c')](0x1),'DESC'];}else{return[_0x2af439===_0xdebe('0x18')?sequelize['cast'](sequelize['col'](_0xdebe('0x18')),_0xdebe('0x1b')):_0x2af439,'ASC'];}});}return _0x3306e5;};exports[_0xdebe('0x1d')]=function(_0x555abd,_0x531842){if(_['isEmpty'](_0x555abd)){return _0x555abd;}if(_[_0xdebe('0x11')](_0x555abd)){for(var _0x29c4ce=0x0;_0x29c4ce<_0x555abd[_0xdebe('0x1e')];_0x29c4ce+=0x1){_0x555abd[_0x29c4ce]=this[_0xdebe('0x1d')](_0x555abd[_0x29c4ce],_0x531842);}return _0x555abd;}if(!_[_0xdebe('0x1f')](_0x555abd)){return _0x555abd;}if(_[_0xdebe('0x20')](_0x531842)){_0x531842=[_0x531842];}if(!_['isArray'](_0x531842)){return _0x555abd;}for(var _0x47c452=0x0;_0x47c452<_0x531842[_0xdebe('0x1e')];_0x47c452+=0x1){_[_0xdebe('0x21')](_0x555abd,_0x531842[_0x47c452]);}for(var _0x4b3643 in _0x555abd){if(_0x555abd[_0xdebe('0x22')](_0x4b3643)){_0x555abd[_0x4b3643]=this[_0xdebe('0x1d')](_0x555abd[_0x4b3643],_0x531842);}}return _0x555abd;};exports[_0xdebe('0x23')]=function(_0x3d0dbb){return _0x3d0dbb[_0xdebe('0x24')](RegExp(_0xdebe('0x25')))?!![]:![];};exports[_0xdebe('0x26')]=function(_0x2555f2){return _0x2555f2['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xdebe('0x27')]=function(_0x42fbe4){var _0x4c6913=[];_0x42fbe4[_0xdebe('0x12')](/[ ,]+/)[_0xdebe('0x28')](function(_0x9e568d){_0x9e568d=_0x9e568d[_0xdebe('0x29')](/([^:]")"+/g,'$1');_0x9e568d='+'+_0x9e568d+'*';if(_0x9e568d[_0xdebe('0x2a')]('@'))_0x9e568d='\x22'+_0x9e568d+'\x22';_0x4c6913[_0xdebe('0x2b')](_0x9e568d);});return _0x4c6913[_0xdebe('0x2c')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 9b7918c..08f71fe 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa125=['method-override','errorhandler','moment','./environment','../mysqldb','default','appPath','root','development','test','set','join','client','use','json\x20replacer','toISOString','get','engine','ejs','renderFile','view\x20engine','50mb','json','initialize','express','serve-favicon','body-parser'];(function(_0x216972,_0x3670ff){var _0x14ff66=function(_0x1014ba){while(--_0x1014ba){_0x216972['push'](_0x216972['shift']());}};_0x14ff66(++_0x3670ff);}(_0xa125,0x141));var _0x5a12=function(_0x4b53ee,_0x25d24c){_0x4b53ee=_0x4b53ee-0x0;var _0x5f31b9=_0xa125[_0x4b53ee];return _0x5f31b9;};'use strict';var express=require(_0x5a12('0x0'));var favicon=require(_0x5a12('0x1'));var bodyParser=require(_0x5a12('0x2'));var methodOverride=require(_0x5a12('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x5a12('0x4'));var path=require('path');var passport=require('passport');var cors=require('cors');var moment=require(_0x5a12('0x5'));var config=require(_0x5a12('0x6'));var db=require(_0x5a12('0x7'))['db'];exports[_0x5a12('0x8')]=function(_0x20b561){var _0x46b598=_0x20b561['get']('env');if(_0x46b598==='production'){_0x20b561['set'](_0x5a12('0x9'),path['join'](config[_0x5a12('0xa')],'public'));}if(_0x46b598===_0x5a12('0xb')||_0x46b598===_0x5a12('0xc')){_0x20b561[_0x5a12('0xd')](_0x5a12('0x9'),path[_0x5a12('0xe')](config[_0x5a12('0xa')],_0x5a12('0xf')));_0x20b561[_0x5a12('0x10')](errorHandler());}_0x20b561[_0x5a12('0xd')](_0x5a12('0x11'),function(_0x4abd71,_0x15aaf3){if(this[_0x4abd71]instanceof Date){_0x15aaf3=this[_0x4abd71][_0x5a12('0x12')]()['split']('.')[0x0]+'Z';}return _0x15aaf3;});_0x20b561[_0x5a12('0x10')](express['static'](_0x20b561[_0x5a12('0x13')](_0x5a12('0x9'))));_0x20b561[_0x5a12('0xd')]('views',config[_0x5a12('0xa')]+'/server/views');_0x20b561[_0x5a12('0x14')]('html',require(_0x5a12('0x15'))[_0x5a12('0x16')]);_0x20b561[_0x5a12('0xd')](_0x5a12('0x17'),'html');_0x20b561[_0x5a12('0x10')](bodyParser['urlencoded']({'limit':_0x5a12('0x18'),'extended':!![]}));_0x20b561['use'](bodyParser[_0x5a12('0x19')]({'limit':_0x5a12('0x18')}));_0x20b561[_0x5a12('0x10')](cors());_0x20b561[_0x5a12('0x10')](methodOverride());_0x20b561[_0x5a12('0x10')](cookieParser());_0x20b561[_0x5a12('0x10')](passport[_0x5a12('0x1a')]());}; \ No newline at end of file +var _0x3ad8=['initialize','express','body-parser','method-override','errorhandler','path','passport','cors','./environment','../mysqldb','get','env','set','appPath','join','root','test','toISOString','split','use','static','views','/server/views','engine','html','ejs','renderFile','50mb','json'];(function(_0x3ef2d8,_0x4fdf2e){var _0x5c86a5=function(_0x29b702){while(--_0x29b702){_0x3ef2d8['push'](_0x3ef2d8['shift']());}};_0x5c86a5(++_0x4fdf2e);}(_0x3ad8,0x1b4));var _0x83ad=function(_0x1aa2a3,_0x1b5f47){_0x1aa2a3=_0x1aa2a3-0x0;var _0x2ec4a7=_0x3ad8[_0x1aa2a3];return _0x2ec4a7;};'use strict';var express=require(_0x83ad('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x83ad('0x1'));var methodOverride=require(_0x83ad('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x83ad('0x3'));var path=require(_0x83ad('0x4'));var passport=require(_0x83ad('0x5'));var cors=require(_0x83ad('0x6'));var moment=require('moment');var config=require(_0x83ad('0x7'));var db=require(_0x83ad('0x8'))['db'];exports['default']=function(_0xfbbb3d){var _0x36afda=_0xfbbb3d[_0x83ad('0x9')](_0x83ad('0xa'));if(_0x36afda==='production'){_0xfbbb3d[_0x83ad('0xb')](_0x83ad('0xc'),path[_0x83ad('0xd')](config[_0x83ad('0xe')],'public'));}if(_0x36afda==='development'||_0x36afda===_0x83ad('0xf')){_0xfbbb3d['set'](_0x83ad('0xc'),path['join'](config[_0x83ad('0xe')],'client'));_0xfbbb3d['use'](errorHandler());}_0xfbbb3d['set']('json\x20replacer',function(_0x4d2445,_0x2fd14e){if(this[_0x4d2445]instanceof Date){_0x2fd14e=this[_0x4d2445][_0x83ad('0x10')]()[_0x83ad('0x11')]('.')[0x0]+'Z';}return _0x2fd14e;});_0xfbbb3d[_0x83ad('0x12')](express[_0x83ad('0x13')](_0xfbbb3d['get'](_0x83ad('0xc'))));_0xfbbb3d['set'](_0x83ad('0x14'),config['root']+_0x83ad('0x15'));_0xfbbb3d[_0x83ad('0x16')](_0x83ad('0x17'),require(_0x83ad('0x18'))[_0x83ad('0x19')]);_0xfbbb3d[_0x83ad('0xb')]('view\x20engine',_0x83ad('0x17'));_0xfbbb3d['use'](bodyParser['urlencoded']({'limit':_0x83ad('0x1a'),'extended':!![]}));_0xfbbb3d[_0x83ad('0x12')](bodyParser[_0x83ad('0x1b')]({'limit':_0x83ad('0x1a')}));_0xfbbb3d[_0x83ad('0x12')](cors());_0xfbbb3d[_0x83ad('0x12')](methodOverride());_0xfbbb3d[_0x83ad('0x12')](cookieParser());_0xfbbb3d[_0x83ad('0x12')](passport[_0x83ad('0x1c')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index aa6b133..9387afd 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 _0x0f80=['md5','digest','substring','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','length','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','join','createHash','update','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','replace','macAddress','ipAddress'];(function(_0x112db5,_0x38a06d){var _0x1d7d06=function(_0x44571e){while(--_0x44571e){_0x112db5['push'](_0x112db5['shift']());}};_0x1d7d06(++_0x38a06d);}(_0x0f80,0x108));var _0x00f8=function(_0x27ccd2,_0x459db9){_0x27ccd2=_0x27ccd2-0x0;var _0x23cfe6=_0x0f80[_0x27ccd2];return _0x23cfe6;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x00f8('0x0'));var machine=require(_0x00f8('0x1'));var exec=require(_0x00f8('0x2'))[_0x00f8('0x3')];function getInterfaces(){var _0x1c5899=[];var _0x54a0b3=os[_0x00f8('0x4')]();var _0x1921a1=_[_0x00f8('0x5')](_['keys'](_0x54a0b3));for(var _0x21a599=0x0;_0x21a599<_0x1921a1[_0x00f8('0x6')];_0x21a599++){var _0x38a533=_0x54a0b3[_0x1921a1[_0x21a599]][_0x00f8('0x7')](function(_0x110015){return _0x110015[_0x00f8('0x8')]===_0x00f8('0x9')&&_0x110015['internal']===![];});_0x1c5899=_0x1c5899[_0x00f8('0xa')](_0x38a533);}return _0x1c5899;}function getFirstInterface(){var _0x44c46b=_[_0x00f8('0xb')](getInterfaces());return{'macAddress':_0x44c46b&&_0x44c46b['mac']?_0x44c46b[_0x00f8('0xc')]:_0x00f8('0xd'),'ipAddress':_0x44c46b&&_0x44c46b[_0x00f8('0xe')]?_0x44c46b[_0x00f8('0xe')]:_0x00f8('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x59f90a=_[_0x00f8('0x5')](os['cpus']()['map'](function(_0x2fd828){return _0x2fd828['model'];}))[_0x00f8('0x10')](':');return crypto[_0x00f8('0x11')]('md5')[_0x00f8('0x12')](_0x59f90a)['digest']('hex');}exports[_0x00f8('0x13')]=function(){switch(os[_0x00f8('0x14')]()){case _0x00f8('0x15'):return exec(_0x00f8('0x16'),{'encoding':'utf8'})[_0x00f8('0x17')]('\x0d\x0a','');default:var _0x44ebf0=getFirstInterface();var _0x1dd277=getCPUhash();var _0x44b718=_0x1dd277+'|'+os['hostname']()+'|'+_0x44ebf0[_0x00f8('0x18')]+'|'+_0x44ebf0[_0x00f8('0x19')];var _0x476f79=crypto[_0x00f8('0x11')](_0x00f8('0x1a'))[_0x00f8('0x12')](_0x44b718)[_0x00f8('0x1b')]('hex');return _0x476f79['substring'](0x0,0x8)+'-'+_0x476f79[_0x00f8('0x1c')](0x8,0xc)+'-'+_0x476f79['substring'](0xc,0x10)+'-'+_0x476f79[_0x00f8('0x1c')](0x10,0x14)+'-'+_0x476f79[_0x00f8('0x1c')](0x14);}}; \ No newline at end of file +var _0x1224=['cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface'];(function(_0x50b2ff,_0x46ca56){var _0x143efc=function(_0x56bae9){while(--_0x56bae9){_0x50b2ff['push'](_0x50b2ff['shift']());}};_0x143efc(++_0x46ca56);}(_0x1224,0x10d));var _0x4122=function(_0x208c3b,_0x3481c0){_0x208c3b=_0x208c3b-0x0;var _0x1ea841=_0x1224[_0x208c3b];return _0x1ea841;};'use strict';var _=require(_0x4122('0x0'));var os=require('os');var crypto=require(_0x4122('0x1'));var machine=require(_0x4122('0x2'));var exec=require(_0x4122('0x3'))[_0x4122('0x4')];function getInterfaces(){var _0x3d42a9=[];var _0x51632b=os[_0x4122('0x5')]();var _0x1f1533=_[_0x4122('0x6')](_['keys'](_0x51632b));for(var _0x1d39a5=0x0;_0x1d39a5<_0x1f1533[_0x4122('0x7')];_0x1d39a5++){var _0xc6dfaf=_0x51632b[_0x1f1533[_0x1d39a5]][_0x4122('0x8')](function(_0x2a952c){return _0x2a952c[_0x4122('0x9')]===_0x4122('0xa')&&_0x2a952c[_0x4122('0xb')]===![];});_0x3d42a9=_0x3d42a9[_0x4122('0xc')](_0xc6dfaf);}return _0x3d42a9;}function getFirstInterface(){var _0x3e812e=_[_0x4122('0xd')](getInterfaces());return{'macAddress':_0x3e812e&&_0x3e812e[_0x4122('0xe')]?_0x3e812e[_0x4122('0xe')]:_0x4122('0xf'),'ipAddress':_0x3e812e&&_0x3e812e[_0x4122('0x10')]?_0x3e812e[_0x4122('0x10')]:_0x4122('0x11')};}exports[_0x4122('0x12')]=getFirstInterface;function getCPUhash(){var _0x476ed2=_[_0x4122('0x6')](os[_0x4122('0x13')]()[_0x4122('0x14')](function(_0x440ff0){return _0x440ff0[_0x4122('0x15')];}))[_0x4122('0x16')](':');return crypto[_0x4122('0x17')](_0x4122('0x18'))[_0x4122('0x19')](_0x476ed2)[_0x4122('0x1a')](_0x4122('0x1b'));}exports[_0x4122('0x1c')]=function(){switch(os['platform']()){case _0x4122('0x1d'):return exec(_0x4122('0x1e'),{'encoding':_0x4122('0x1f')})[_0x4122('0x20')]('\x0d\x0a','');default:var _0x520300=getFirstInterface();var _0x2e33cf=getCPUhash();var _0x19684e=_0x2e33cf+'|'+os['hostname']()+'|'+_0x520300[_0x4122('0x21')]+'|'+_0x520300[_0x4122('0x22')];var _0x399003=crypto[_0x4122('0x17')](_0x4122('0x18'))[_0x4122('0x19')](_0x19684e)[_0x4122('0x1a')]('hex');return _0x399003['substring'](0x0,0x8)+'-'+_0x399003['substring'](0x8,0xc)+'-'+_0x399003[_0x4122('0x23')](0xc,0x10)+'-'+_0x399003[_0x4122('0x23')](0x10,0x14)+'-'+_0x399003[_0x4122('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 4e0f9be..b4afa9a 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 _0xf3c1=['GET','get','data1','data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','format','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','then','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports'];(function(_0x396910,_0x397bda){var _0x217d81=function(_0x1e6ab9){while(--_0x1e6ab9){_0x396910['push'](_0x396910['shift']());}};_0x217d81(++_0x397bda);}(_0xf3c1,0x75));var _0x1f3c=function(_0x1acde2,_0x4cd189){_0x1acde2=_0x1acde2-0x0;var _0x4ccd31=_0xf3c1[_0x1acde2];return _0x4ccd31;};'use strict';var util=require(_0x1f3c('0x0'));var moment=require(_0x1f3c('0x1'));var rp=require(_0x1f3c('0x2'));var BPromise=require(_0x1f3c('0x3'));var pkginfo=require(_0x1f3c('0x4'))(module,_0x1f3c('0x5'));var db=require(_0x1f3c('0x6'))['db'];var encryptor=require(_0x1f3c('0x7'));var hardware=require(_0x1f3c('0x8'));var logger=require('../logger')('license');var HOST=_0x1f3c('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x254a87){return new BPromise(function(_0x49c55d,_0x595de2){var _0x36703d=util['format'](_0x1f3c('0xa'),HOST,_0x254a87,module['exports'][_0x1f3c('0x5')]);if(oldToken){_0x36703d=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x254a87,module[_0x1f3c('0xb')][_0x1f3c('0x5')],oldToken);}var _0x3e37fb={'uri':_0x36703d,'method':_0x1f3c('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x3e37fb)['then'](function(_0x10d8ac){_0x49c55d(_0x10d8ac);})['catch'](function(_0x76ec73){_0x595de2(_0x76ec73);});});}function manageLicense(_0x3a7a61,_0x4de2f1){var _0x21d88c=_0x4de2f1[_0x1f3c('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x21d88c[_0x1f3c('0xe')]!==_0x3a7a61&&!_0x21d88c[_0x1f3c('0xf')]){oldToken=_0x21d88c[_0x1f3c('0xe')];}httpRequest(_0x3a7a61)['then'](function(_0xf62d33){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xf62d33[_0x1f3c('0x10')]){isOldTokenSent=![];if(!_0x21d88c[_0x1f3c('0x11')]&&_0x21d88c[_0x1f3c('0x11')]!=_0xf62d33['license']||_0x21d88c[_0x1f3c('0x11')]&&_0x21d88c[_0x1f3c('0xf')]){logger[_0x1f3c('0x12')](_0x1f3c('0x13'));}if(_0x21d88c['license']&&!_0x21d88c['data2']&&_0x21d88c[_0x1f3c('0x11')]!=_0xf62d33[_0x1f3c('0x11')]){logger[_0x1f3c('0x12')](_0x1f3c('0x14'));}if(_0x21d88c[_0x1f3c('0x11')]&&!_0x21d88c[_0x1f3c('0xf')]&&_0x21d88c['license']==_0xf62d33[_0x1f3c('0x11')]){return _0x4de2f1;}return _0x4de2f1[_0x1f3c('0x15')]({'data1':_0x3a7a61,'data2':null,'license':_0xf62d33[_0x1f3c('0x11')]});}else{if(_0xf62d33[_0x1f3c('0x11')]||_0x21d88c[_0x1f3c('0x11')]){if(!_0x21d88c['data2']){if(_0x21d88c[_0x1f3c('0xe')]==_0x3a7a61){GRAY_PERIOD_REASON=_0x1f3c('0x16');logger['info'](_0x1f3c('0x17'));}else{GRAY_PERIOD_REASON=_0x1f3c('0x18');logger['info'](_0x1f3c('0x19'),_0x21d88c['data1'],_0x3a7a61);}logger['info'](_0x1f3c('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x1f3c('0x1b')]('YYYY-MM-DD\x20HH:mm'));return _0x4de2f1[_0x1f3c('0x15')]({'data2':encryptor['encryptString'](moment()[_0x1f3c('0x1b')](_0x1f3c('0x1c')))});}else{if(moment()[_0x1f3c('0x1d')](encryptor['decryptString'](_0x21d88c[_0x1f3c('0xf')]),_0x1f3c('0x1e'))>DAYS){logger[_0x1f3c('0x12')](_0x1f3c('0x1f'),moment()['format'](_0x1f3c('0x1c')));isOldTokenSent=![];return _0x4de2f1[_0x1f3c('0x15')]({'data1':_0x3a7a61,'data2':null,'license':null});}}}else{if(_0x21d88c[_0x1f3c('0xe')]!=_0x3a7a61){logger[_0x1f3c('0x12')](_0x1f3c('0x19'),_0x21d88c['data1'],_0x3a7a61);return _0x4de2f1[_0x1f3c('0x15')]({'data1':_0x3a7a61,'data2':null,'license':null});}}}return _0x4de2f1;})[_0x1f3c('0x20')](function(_0x4db440){_0x4de2f1=_0x4db440;})[_0x1f3c('0x21')](function(_0x218d91){logger[_0x1f3c('0x22')](_0x218d91[_0x1f3c('0x23')]);})[_0x1f3c('0x24')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x4de2f1);},TIME);});}function defaultLicense(){var _0x4f3ea5=hardware[_0x1f3c('0x25')]();if(_0x4f3ea5){return db[_0x1f3c('0x26')][_0x1f3c('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x4f3ea5}})[_0x1f3c('0x28')](function(_0x2ea03d,_0xd936b5){logger[_0x1f3c('0x12')](_0x1f3c('0x29'),_0x4f3ea5);manageLicense(_0x4f3ea5,_0x2ea03d);})[_0x1f3c('0x21')](function(_0x4ad7c0){logger[_0x1f3c('0x22')](_0x4ad7c0[_0x1f3c('0x23')]);});}}exports[_0x1f3c('0x2a')]=defaultLicense; \ No newline at end of file +var _0xfe9f=['active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','update','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','get','data1','then'];(function(_0x46aecf,_0x41fb9a){var _0x162300=function(_0x3a8ca3){while(--_0x3a8ca3){_0x46aecf['push'](_0x46aecf['shift']());}};_0x162300(++_0x41fb9a);}(_0xfe9f,0xe5));var _0xffe9=function(_0x2ca4ea,_0x1878d9){_0x2ca4ea=_0x2ca4ea-0x0;var _0x1b2d77=_0xfe9f[_0x2ca4ea];return _0x1b2d77;};'use strict';var util=require(_0xffe9('0x0'));var moment=require(_0xffe9('0x1'));var rp=require(_0xffe9('0x2'));var BPromise=require(_0xffe9('0x3'));var pkginfo=require(_0xffe9('0x4'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0xffe9('0x5'));var hardware=require('./hardware');var logger=require(_0xffe9('0x6'))(_0xffe9('0x7'));var HOST=_0xffe9('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x38e9d0){return new BPromise(function(_0x332747,_0x4095fd){var _0x4831e3=util[_0xffe9('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x38e9d0,module[_0xffe9('0xa')][_0xffe9('0xb')]);if(oldToken){_0x4831e3=util[_0xffe9('0x9')](_0xffe9('0xc'),HOST,_0x38e9d0,module[_0xffe9('0xa')][_0xffe9('0xb')],oldToken);}var _0x2159fb={'uri':_0x4831e3,'method':_0xffe9('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x2159fb)['then'](function(_0x115ebf){_0x332747(_0x115ebf);})['catch'](function(_0x5bda8d){_0x4095fd(_0x5bda8d);});});}function manageLicense(_0x288fb0,_0x2ecb94){var _0x51678c=_0x2ecb94[_0xffe9('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x51678c[_0xffe9('0xf')]!==_0x288fb0&&!_0x51678c['data2']){oldToken=_0x51678c[_0xffe9('0xf')];}httpRequest(_0x288fb0)[_0xffe9('0x10')](function(_0x4ff8f5){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4ff8f5[_0xffe9('0x11')]){isOldTokenSent=![];if(!_0x51678c[_0xffe9('0x7')]&&_0x51678c[_0xffe9('0x7')]!=_0x4ff8f5[_0xffe9('0x7')]||_0x51678c[_0xffe9('0x7')]&&_0x51678c['data2']){logger[_0xffe9('0x12')](_0xffe9('0x13'));}if(_0x51678c[_0xffe9('0x7')]&&!_0x51678c[_0xffe9('0x14')]&&_0x51678c[_0xffe9('0x7')]!=_0x4ff8f5[_0xffe9('0x7')]){logger[_0xffe9('0x12')](_0xffe9('0x15'));}if(_0x51678c[_0xffe9('0x7')]&&!_0x51678c[_0xffe9('0x14')]&&_0x51678c['license']==_0x4ff8f5[_0xffe9('0x7')]){return _0x2ecb94;}return _0x2ecb94['update']({'data1':_0x288fb0,'data2':null,'license':_0x4ff8f5[_0xffe9('0x7')]});}else{if(_0x4ff8f5[_0xffe9('0x7')]||_0x51678c['license']){if(!_0x51678c['data2']){if(_0x51678c[_0xffe9('0xf')]==_0x288fb0){GRAY_PERIOD_REASON='Disabled';logger['info'](_0xffe9('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x51678c[_0xffe9('0xf')],_0x288fb0);}logger[_0xffe9('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xffe9('0x17')](),moment()[_0xffe9('0x9')](_0xffe9('0x18')));return _0x2ecb94['update']({'data2':encryptor[_0xffe9('0x19')](moment()[_0xffe9('0x9')](_0xffe9('0x18')))});}else{if(moment()[_0xffe9('0x1a')](encryptor[_0xffe9('0x1b')](_0x51678c[_0xffe9('0x14')]),'days')>DAYS){logger['info'](_0xffe9('0x1c'),moment()[_0xffe9('0x9')](_0xffe9('0x18')));isOldTokenSent=![];return _0x2ecb94[_0xffe9('0x1d')]({'data1':_0x288fb0,'data2':null,'license':null});}}}else{if(_0x51678c[_0xffe9('0xf')]!=_0x288fb0){logger[_0xffe9('0x12')](_0xffe9('0x1e'),_0x51678c['data1'],_0x288fb0);return _0x2ecb94[_0xffe9('0x1d')]({'data1':_0x288fb0,'data2':null,'license':null});}}}return _0x2ecb94;})['then'](function(_0x4c83f3){_0x2ecb94=_0x4c83f3;})[_0xffe9('0x1f')](function(_0x186f6f){logger[_0xffe9('0x20')](_0x186f6f[_0xffe9('0x21')]);})[_0xffe9('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xffe9('0x23')](),_0x2ecb94);},TIME);});}function defaultLicense(){var _0xc057de=hardware['getUuid']();if(_0xc057de){return db[_0xffe9('0x24')][_0xffe9('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0xc057de}})[_0xffe9('0x26')](function(_0x25b5b9,_0x4eabed){logger[_0xffe9('0x12')](_0xffe9('0x27'),_0xc057de);manageLicense(_0xc057de,_0x25b5b9);})[_0xffe9('0x1f')](function(_0x4ef179){logger[_0xffe9('0x20')](_0x4ef179[_0xffe9('0x21')]);});}}exports[_0xffe9('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 08897fb..62484da 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 _0xeaef=['lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','uuid','machineUuid','gray','add','grayReason','changed','disabled','message','User','findAll','role','COUNT','sequelize','count','admin','user','users','telephones','forEach','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports'];(function(_0x3f7394,_0x1eada1){var _0x1bf1d4=function(_0x392498){while(--_0x392498){_0x3f7394['push'](_0x3f7394['shift']());}};_0x1bf1d4(++_0x1eada1);}(_0xeaef,0x1b0));var _0xfeae=function(_0x3110e2,_0x1c2eb1){_0x3110e2=_0x3110e2-0x0;var _0x2a6deb=_0xeaef[_0x3110e2];return _0x2a6deb;};'use strict';var util=require('util');var _=require(_0xfeae('0x0'));var moment=require(_0xfeae('0x1'));var BPromise=require(_0xfeae('0x2'));var hardware=require(_0xfeae('0x3'));var encryptor=require(_0xfeae('0x4'));var db=require(_0xfeae('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xfeae('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xfeae('0x7'),'machineUuid':hardware[_0xfeae('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xfeae('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xfeae('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x474c4e){return new BPromise(function(_0x39c11d,_0x47efc4){return db[_0xfeae('0xa')]['find'](_['defaults'](_0x474c4e,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x585839){return checkLicense(_0x585839,null);})[_0xfeae('0xb')](function(_0x3b30cb){_0x39c11d(_0x3b30cb);return;})[_0xfeae('0xc')](function(_0x1252ab){_0x47efc4(_0x1252ab);});});}function checkLicense(_0x279ae7,_0x29e536){if(!_0x279ae7){demoLicense['uuid']=_0x279ae7[_0xfeae('0xd')];return demoLicense;}try{var _0x200041=_0x29e536||_0x279ae7[_0xfeae('0xe')];if(_[_0xfeae('0xf')](_0x200041)){throw new Error(_0xfeae('0x10'));}var _0x28d130=_0x279ae7[_0xfeae('0xd')];var _0x3d1ba5=_0x279ae7[_0xfeae('0x11')];var _0x580fda=_0x28d130[_0xfeae('0x12')]('-')[0x4];var _0x4e2e77=_0x28d130[_0xfeae('0x12')]('-')[0x0];var _0x4021ed=encryptor[_0xfeae('0x13')](_0x200041,util['format'](_0xfeae('0x14'),_0x580fda,_0x28d130,_0x4e2e77));var _0x25afc7=JSON[_0xfeae('0x15')](_0x4021ed);_0x25afc7[_0xfeae('0x16')]=![];_0x25afc7[_0xfeae('0x17')]=_0x28d130;_0x25afc7[_0xfeae('0x18')]=hardware['getUuid']();if(_0x3d1ba5){var _0x380fcf=encryptor['decryptString'](_0x3d1ba5);_0x25afc7[_0xfeae('0x19')]=_0x380fcf;_0x25afc7['deadline']=moment(_0x380fcf)[_0xfeae('0x1a')](0x7,'days')['format']();_0x25afc7[_0xfeae('0x1b')]=_0x25afc7[_0xfeae('0x17')]!=_0x25afc7[_0xfeae('0x18')]?_0xfeae('0x1c'):_0xfeae('0x1d');}return _0x25afc7;}catch(_0x1d6567){breakingLicense[_0xfeae('0x17')]=_0x279ae7[_0xfeae('0xd')];breakingLicense[_0xfeae('0x1e')]=_0x1d6567[_0xfeae('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5e77b2,_0x115c85){getLicense()[_0xfeae('0xb')](function(_0x5d8e45){return db[_0xfeae('0x1f')][_0xfeae('0x20')]({'attributes':[_0xfeae('0x21'),[db['sequelize']['fn'](_0xfeae('0x22'),db[_0xfeae('0x23')]['col'](_0xfeae('0x21'))),_0xfeae('0x24')]],'group':_0xfeae('0x21'),'where':{'role':{'$or':[_0xfeae('0x25'),_0xfeae('0x26'),'telephone']}},'raw':!![]})[_0xfeae('0xb')](function(_0x3eca62){var _0x52326c={'user':_0x5d8e45[_0xfeae('0x27')]||0x0,'telephone':_0x5d8e45[_0xfeae('0x28')]||0x0};_0x3eca62[_0xfeae('0x29')](function(_0x8d5f24){var _0xf0b9da=_0x8d5f24[_0xfeae('0x21')]===_0xfeae('0x25')?_0xfeae('0x26'):_0x8d5f24[_0xfeae('0x21')];_0x52326c[_0xf0b9da]-=_0x8d5f24['count'];if(_0x52326c[_0xf0b9da]<0x0)_0x52326c[_0xf0b9da]=0x0;});_0x5e77b2(_0x52326c);return;});})['catch'](function(_0x5cdc69){_0x115c85(_0x5cdc69);});});}function checkUserLimits(_0x46f95a){return new BPromise(function(_0x1b0940,_0x1b8af9){getLimits()['then'](function(_0x17839a){var _0x20788b=_[_0xfeae('0x2a')](_[_0xfeae('0x2b')](_0x46f95a,_0xfeae('0x21')),[_0xfeae('0x25'),_0xfeae('0x26'),_0xfeae('0x2c')]);var _0x4d48f2=(_0x20788b['admin']||0x0)+(_0x20788b['user']||0x0);var _0x535039=_0x20788b['telephone']||0x0;if(_0x4d48f2>_0x17839a[_0xfeae('0x26')])return _0x1b8af9(_0xfeae('0x2d'));if(_0x535039>_0x17839a[_0xfeae('0x2c')])return _0x1b8af9(_0xfeae('0x2e'));return _0x1b0940();})['catch'](function(_0x25372c){_0x1b8af9(_0x25372c);});});}module[_0xfeae('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x97e0=['parse','demo','gray','add','days','grayReason','machineUuid','changed','then','User','findAll','role','sequelize','col','count','admin','user','telephone','users','telephones','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','format'];(function(_0x2ae54b,_0x37fb45){var _0xacef56=function(_0x498d67){while(--_0x498d67){_0x2ae54b['push'](_0x2ae54b['shift']());}};_0xacef56(++_0x37fb45);}(_0x97e0,0x145));var _0x097e=function(_0x4498ac,_0x30e301){_0x4498ac=_0x4498ac-0x0;var _0x4bf1b6=_0x97e0[_0x4498ac];return _0x4bf1b6;};'use strict';var util=require(_0x097e('0x0'));var _=require('lodash');var moment=require(_0x097e('0x1'));var BPromise=require(_0x097e('0x2'));var hardware=require('./hardware');var encryptor=require(_0x097e('0x3'));var db=require(_0x097e('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x097e('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x097e('0x6'),'machineUuid':hardware[_0x097e('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x097e('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x097e('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x13d7b0){return new BPromise(function(_0x385890,_0x4f63b3){return db[_0x097e('0x8')][_0x097e('0x9')](_[_0x097e('0xa')](_0x13d7b0,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x126565){return checkLicense(_0x126565,null);})['then'](function(_0x29352d){_0x385890(_0x29352d);return;})[_0x097e('0xb')](function(_0x2ba814){_0x4f63b3(_0x2ba814);});});}function checkLicense(_0x1ad888,_0x2af5f3){if(!_0x1ad888){demoLicense[_0x097e('0xc')]=_0x1ad888[_0x097e('0xd')];return demoLicense;}try{var _0x36f3c6=_0x2af5f3||_0x1ad888[_0x097e('0xe')];if(_[_0x097e('0xf')](_0x36f3c6)){throw new Error(_0x097e('0x10'));}var _0x53bbc2=_0x1ad888[_0x097e('0xd')];var _0x27d10d=_0x1ad888['data2'];var _0x5d3282=_0x53bbc2[_0x097e('0x11')]('-')[0x4];var _0x1a4e31=_0x53bbc2[_0x097e('0x11')]('-')[0x0];var _0x25d0b3=encryptor['decryptString'](_0x36f3c6,util[_0x097e('0x12')]('%s:%s:%s',_0x5d3282,_0x53bbc2,_0x1a4e31));var _0x19a084=JSON[_0x097e('0x13')](_0x25d0b3);_0x19a084[_0x097e('0x14')]=![];_0x19a084[_0x097e('0xc')]=_0x53bbc2;_0x19a084['machineUuid']=hardware[_0x097e('0x7')]();if(_0x27d10d){var _0x236c6b=encryptor['decryptString'](_0x27d10d);_0x19a084[_0x097e('0x15')]=_0x236c6b;_0x19a084['deadline']=moment(_0x236c6b)[_0x097e('0x16')](0x7,_0x097e('0x17'))['format']();_0x19a084[_0x097e('0x18')]=_0x19a084['uuid']!=_0x19a084[_0x097e('0x19')]?_0x097e('0x1a'):'disabled';}return _0x19a084;}catch(_0x4668b5){breakingLicense[_0x097e('0xc')]=_0x1ad888[_0x097e('0xd')];breakingLicense['message']=_0x4668b5['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x58aaf5,_0x3c17c3){getLicense()[_0x097e('0x1b')](function(_0xe61433){return db[_0x097e('0x1c')][_0x097e('0x1d')]({'attributes':[_0x097e('0x1e'),[db[_0x097e('0x1f')]['fn']('COUNT',db[_0x097e('0x1f')][_0x097e('0x20')](_0x097e('0x1e'))),_0x097e('0x21')]],'group':_0x097e('0x1e'),'where':{'role':{'$or':[_0x097e('0x22'),_0x097e('0x23'),_0x097e('0x24')]}},'raw':!![]})[_0x097e('0x1b')](function(_0xd74f57){var _0x123ce1={'user':_0xe61433[_0x097e('0x25')]||0x0,'telephone':_0xe61433[_0x097e('0x26')]||0x0};_0xd74f57['forEach'](function(_0x109940){var _0x182554=_0x109940['role']===_0x097e('0x22')?_0x097e('0x23'):_0x109940[_0x097e('0x1e')];_0x123ce1[_0x182554]-=_0x109940[_0x097e('0x21')];if(_0x123ce1[_0x182554]<0x0)_0x123ce1[_0x182554]=0x0;});_0x58aaf5(_0x123ce1);return;});})['catch'](function(_0x282604){_0x3c17c3(_0x282604);});});}function checkUserLimits(_0x182107){return new BPromise(function(_0x210e05,_0x658c3a){getLimits()['then'](function(_0x444bd3){var _0x43393f=_[_0x097e('0x27')](_['countBy'](_0x182107,'role'),[_0x097e('0x22'),_0x097e('0x23'),_0x097e('0x24')]);var _0x1b9435=(_0x43393f[_0x097e('0x22')]||0x0)+(_0x43393f[_0x097e('0x23')]||0x0);var _0x3c9708=_0x43393f[_0x097e('0x24')]||0x0;if(_0x1b9435>_0x444bd3[_0x097e('0x23')])return _0x658c3a(_0x097e('0x28'));if(_0x3c9708>_0x444bd3[_0x097e('0x24')])return _0x658c3a(_0x097e('0x29'));return _0x210e05();})[_0x097e('0xb')](function(_0x56957c){_0x658c3a(_0x56957c);});});}module[_0x097e('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 5aa1508..379cf23 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 _0x3e01=['myappanuglar-secret','secret','exports','http://localhost:9000'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x3e01,0x92));var _0x13e0=function(_0x56b429,_0x4750eb){_0x56b429=_0x56b429-0x0;var _0x11c33f=_0x3e01[_0x56b429];return _0x11c33f;};'use strict';module[_0x13e0('0x0')]={'DOMAIN':_0x13e0('0x1'),'SESSION_SECRET':_0x13e0('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x13e0('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x4797=['http://localhost:9000','secret'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0x4797,0x150));var _0x7479=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4797[_0x321bb2];return _0x9c12ed;};'use strict';module['exports']={'DOMAIN':_0x7479('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x7479('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 08c40df..ecdcfff 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x061e=['%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','util','path','/var','log','format'];(function(_0x5a8939,_0x21a057){var _0x18aa18=function(_0x13a246){while(--_0x13a246){_0x5a8939['push'](_0x5a8939['shift']());}};_0x18aa18(++_0x21a057);}(_0x061e,0x83));var _0xe061=function(_0x49a27d,_0x49121b){_0x49a27d=_0x49a27d-0x0;var _0x4a1e9b=_0x061e[_0x49a27d];return _0x4a1e9b;};'use strict';var moment=require(_0xe061('0x0'));var winston=require(_0xe061('0x1'));var util=require(_0xe061('0x2'));var path=require(_0xe061('0x3'));var debugLevel='INFO';function filename(_0x1d20e2,_0x4deacb){return path['join'](_0xe061('0x4'),_0xe061('0x5'),'xcally',util[_0xe061('0x6')](_0xe061('0x7'),_0x1d20e2,_0x4deacb));}function formatter(_0x174b0f,_0x28ea95){_0x28ea95[_0xe061('0x8')]=_0x28ea95[_0xe061('0x8')][_0xe061('0x9')](/@@{/g,'{{{')[_0xe061('0x9')](/}@@/g,_0xe061('0xa'))[_0xe061('0x9')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xe061('0x6')](_0xe061('0xb'),moment()[_0xe061('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),_0x28ea95[_0xe061('0xc')][_0xe061('0xd')](),_0x174b0f,_0x28ea95['message']);}module['exports']=function(_0x496d2a){return new winston[(_0xe061('0xe'))]({'transports':[new winston[(_0xe061('0xf'))][(_0xe061('0x10'))]({'name':util['format'](_0xe061('0x11'),_0x496d2a,'error'),'filename':filename(_0x496d2a,'error'),'level':_0xe061('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x20fbed){return formatter(_0x496d2a,_0x20fbed);}}),new winston['transports'][(_0xe061('0x10'))]({'name':util['format'](_0xe061('0x11'),_0x496d2a,_0xe061('0x13')),'filename':filename(_0x496d2a,_0xe061('0x13')),'level':_0xe061('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x12d1e7){return formatter(_0x496d2a,_0x12d1e7);}}),new winston[(_0xe061('0xf'))][(_0xe061('0x14'))]({'level':process[_0xe061('0x15')][_0xe061('0x16')]||debugLevel,'json':![],'formatter':function(_0x26705d){return formatter(_0x496d2a,_0x26705d);}})]});}; \ No newline at end of file +var _0x8989=['}}}','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File','%s-%s','error','info','Console','env','moment','winston','util','path','INFO','/var','log','xcally','format','message','{{{'];(function(_0x53b133,_0x176261){var _0x5647e0=function(_0x4c62b0){while(--_0x4c62b0){_0x53b133['push'](_0x53b133['shift']());}};_0x5647e0(++_0x176261);}(_0x8989,0x72));var _0x9898=function(_0x1a70e0,_0x5cd0f7){_0x1a70e0=_0x1a70e0-0x0;var _0x4548d3=_0x8989[_0x1a70e0];return _0x4548d3;};'use strict';var moment=require(_0x9898('0x0'));var winston=require(_0x9898('0x1'));var util=require(_0x9898('0x2'));var path=require(_0x9898('0x3'));var debugLevel=_0x9898('0x4');function filename(_0x388a94,_0xfda48){return path['join'](_0x9898('0x5'),_0x9898('0x6'),_0x9898('0x7'),util[_0x9898('0x8')]('%s-%s.log',_0x388a94,_0xfda48));}function formatter(_0x2d2be6,_0x51c09a){_0x51c09a[_0x9898('0x9')]=_0x51c09a[_0x9898('0x9')]['replace'](/@@{/g,_0x9898('0xa'))['replace'](/}@@/g,_0x9898('0xb'))[_0x9898('0xc')](/@{/g,'{{')[_0x9898('0xc')](/}@/g,'}}');return util[_0x9898('0x8')](_0x9898('0xd'),moment()[_0x9898('0x8')](_0x9898('0xe')),_0x51c09a[_0x9898('0xf')][_0x9898('0x10')](),_0x2d2be6,_0x51c09a[_0x9898('0x9')]);}module['exports']=function(_0x1f1b83){return new winston[(_0x9898('0x11'))]({'transports':[new winston[(_0x9898('0x12'))][(_0x9898('0x13'))]({'name':util['format'](_0x9898('0x14'),_0x1f1b83,_0x9898('0x15')),'filename':filename(_0x1f1b83,_0x9898('0x15')),'level':_0x9898('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5cb2){return formatter(_0x1f1b83,_0x5cb2);}}),new winston[(_0x9898('0x12'))][(_0x9898('0x13'))]({'name':util[_0x9898('0x8')]('%s-%s',_0x1f1b83,_0x9898('0x16')),'filename':filename(_0x1f1b83,_0x9898('0x16')),'level':_0x9898('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48cca0){return formatter(_0x1f1b83,_0x48cca0);}}),new winston['transports'][(_0x9898('0x17'))]({'level':process[_0x9898('0x18')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x64e843){return formatter(_0x1f1b83,_0x64e843);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index ddade5b..9dcc298 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 _0x2c46=['../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x120fa0,_0x1ff367){var _0xc1136b=function(_0x3ea26f){while(--_0x3ea26f){_0x120fa0['push'](_0x120fa0['shift']());}};_0xc1136b(++_0x1ff367);}(_0x2c46,0x6f));var _0x62c4=function(_0x292f3d,_0x3c5809){_0x292f3d=_0x292f3d-0x0;var _0x34d172=_0x2c46[_0x292f3d];return _0x34d172;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x62c4('0x0'),'script':path[_0x62c4('0x1')](__dirname,_0x62c4('0x2'))},{'name':_0x62c4('0x3'),'script':path[_0x62c4('0x1')](__dirname,_0x62c4('0x4'))},{'name':_0x62c4('0x5'),'script':path[_0x62c4('0x1')](__dirname,_0x62c4('0x6'))},{'name':_0x62c4('0x7'),'script':path[_0x62c4('0x1')](__dirname,_0x62c4('0x8'))},{'name':_0x62c4('0x9'),'script':path[_0x62c4('0x1')](__dirname,_0x62c4('0xa'))},{'name':_0x62c4('0xb'),'script':path[_0x62c4('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0x62c4('0xc')]=config; \ No newline at end of file +var _0x9d5b=['exports','path','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x9d5b,0x71));var _0xb9d5=function(_0x2e1f57,_0x5e6ed8){_0x2e1f57=_0x2e1f57-0x0;var _0x313a58=_0x9d5b[_0x2e1f57];return _0x313a58;};'use strict';var path=require(_0xb9d5('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xb9d5('0x1')](__dirname,_0xb9d5('0x2'))},{'name':_0xb9d5('0x3'),'script':path['join'](__dirname,_0xb9d5('0x4'))},{'name':_0xb9d5('0x5'),'script':path['join'](__dirname,_0xb9d5('0x6'))},{'name':_0xb9d5('0x7'),'script':path[_0xb9d5('0x1')](__dirname,_0xb9d5('0x8'))},{'name':_0xb9d5('0x9'),'script':path[_0xb9d5('0x1')](__dirname,_0xb9d5('0xa'))},{'name':_0xb9d5('0xb'),'script':path['join'](__dirname,_0xb9d5('0xc'))}]};module[_0xb9d5('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 61226ec..2d9029e 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 _0x83ed=['connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config'];(function(_0x3c47de,_0x2a1568){var _0x3e1bae=function(_0x2f6e25){while(--_0x2f6e25){_0x3c47de['push'](_0x3c47de['shift']());}};_0x3e1bae(++_0x2a1568);}(_0x83ed,0x66));var _0xd83e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x83ed[_0xbe200f];return _0x192597;};'use strict';var pm2=require(_0xd83e('0x0'));var BPromise=require('bluebird');var config=require(_0xd83e('0x1'));function connect(){return new BPromise(function(_0xb8af9d,_0x7b0e4){return pm2['connect'](function(_0x234756){if(_0x234756){return _0x7b0e4(_0x234756);}return _0xb8af9d(_0xd83e('0x2'));});});};exports[_0xd83e('0x3')]=function(_0x1e2576){return connect()[_0xd83e('0x4')](function(){return new BPromise(function(_0x17960f,_0x3d9e5f){return pm2[_0xd83e('0x3')](_0x1e2576,function(_0x9c6ae,_0x542197){if(_0x9c6ae){return _0x3d9e5f(_0x9c6ae);}pm2[_0xd83e('0x5')]();return _0x17960f(_0x542197);});});});};exports[_0xd83e('0x6')]=function(_0x47d268){return connect()[_0xd83e('0x4')](function(){return new BPromise(function(_0x166299,_0x2348cb){return pm2['stop'](_0x47d268,function(_0x43e440,_0x594ee2){if(_0x43e440){return _0x2348cb(_0x43e440);}pm2[_0xd83e('0x5')]();return _0x166299(_0x594ee2);});});});};exports['restart']=function(_0x456f54){return connect()[_0xd83e('0x4')](function(){return new BPromise(function(_0x5c211d,_0xdbde60){return pm2[_0xd83e('0x7')](_0x456f54,function(_0x5ccc96,_0x53ce8b){if(_0x5ccc96){return _0xdbde60(_0x5ccc96);}pm2[_0xd83e('0x5')]();return _0x5c211d(_0x53ce8b);});});});};exports[_0xd83e('0x8')]=function(){return connect()[_0xd83e('0x4')](function(){return new BPromise(function(_0x2042c1,_0x131938){return pm2[_0xd83e('0x8')](function(_0x4739b3,_0x23c5cc){if(_0x4739b3){return _0x131938(_0x4739b3);}pm2[_0xd83e('0x5')]();return _0x2042c1(_0x23c5cc);});});});};exports[_0xd83e('0x9')]=function(_0x4129c5){return connect()[_0xd83e('0x4')](function(){return new BPromise(function(_0x8b7347,_0x5b9373){return pm2['describe'](_0x4129c5,function(_0x3fc147,_0x4bfb10){if(_0x3fc147){return _0x5b9373(_0x3fc147);}pm2[_0xd83e('0x5')]();return _0x8b7347(_0x4bfb10);});});});};exports['delete']=function(_0x5cf9aa){return connect()[_0xd83e('0x4')](function(){return new BPromise(function(_0x570c31,_0x585b74){return pm2[_0xd83e('0xa')](_0x5cf9aa,function(_0x1b161f,_0x3dcddd){if(_0x1b161f){return _0x585b74(_0x1b161f);}pm2[_0xd83e('0x5')]();return _0x570c31(_0x3dcddd);});});});};exports[_0xd83e('0xb')]=function(){return connect()[_0xd83e('0x4')](function(){return new BPromise(function(_0x22f18e,_0x3815b6){return pm2[_0xd83e('0xb')](function(_0x505514){if(_0x505514){return _0x3815b6(_0x505514);}return _0x22f18e(_0xd83e('0xc'));});});});}; \ No newline at end of file +var _0x3d94=['./config','connect','then','stop','disconnect','restart','list','describe','delete','dump','saved','bluebird'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3d94,0xd7));var _0x43d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d94[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require('pm2');var BPromise=require(_0x43d9('0x0'));var config=require(_0x43d9('0x1'));function connect(){return new BPromise(function(_0x3efe3e,_0x596d57){return pm2[_0x43d9('0x2')](function(_0x1a4e73){if(_0x1a4e73){return _0x596d57(_0x1a4e73);}return _0x3efe3e('connected');});});};exports['start']=function(_0x11d27c){return connect()[_0x43d9('0x3')](function(){return new BPromise(function(_0x4a72f4,_0xc6dd85){return pm2['start'](_0x11d27c,function(_0x1301ae,_0x33f4a7){if(_0x1301ae){return _0xc6dd85(_0x1301ae);}pm2['disconnect']();return _0x4a72f4(_0x33f4a7);});});});};exports[_0x43d9('0x4')]=function(_0x30953b){return connect()[_0x43d9('0x3')](function(){return new BPromise(function(_0x355c4a,_0x39e73e){return pm2['stop'](_0x30953b,function(_0x567085,_0x3451c2){if(_0x567085){return _0x39e73e(_0x567085);}pm2[_0x43d9('0x5')]();return _0x355c4a(_0x3451c2);});});});};exports[_0x43d9('0x6')]=function(_0x3534e7){return connect()[_0x43d9('0x3')](function(){return new BPromise(function(_0x38dd5f,_0x1bff1a){return pm2[_0x43d9('0x6')](_0x3534e7,function(_0x1db7f0,_0x57ca24){if(_0x1db7f0){return _0x1bff1a(_0x1db7f0);}pm2[_0x43d9('0x5')]();return _0x38dd5f(_0x57ca24);});});});};exports[_0x43d9('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2a5d6b,_0xbce76){return pm2[_0x43d9('0x7')](function(_0x37b52b,_0x468439){if(_0x37b52b){return _0xbce76(_0x37b52b);}pm2[_0x43d9('0x5')]();return _0x2a5d6b(_0x468439);});});});};exports[_0x43d9('0x8')]=function(_0x1601cb){return connect()['then'](function(){return new BPromise(function(_0x3ce5e6,_0xd562b8){return pm2[_0x43d9('0x8')](_0x1601cb,function(_0x392704,_0x50c605){if(_0x392704){return _0xd562b8(_0x392704);}pm2[_0x43d9('0x5')]();return _0x3ce5e6(_0x50c605);});});});};exports[_0x43d9('0x9')]=function(_0x3367db){return connect()[_0x43d9('0x3')](function(){return new BPromise(function(_0x2da646,_0x2738d2){return pm2[_0x43d9('0x9')](_0x3367db,function(_0x121d7c,_0x530421){if(_0x121d7c){return _0x2738d2(_0x121d7c);}pm2[_0x43d9('0x5')]();return _0x2da646(_0x530421);});});});};exports[_0x43d9('0xa')]=function(){return connect()[_0x43d9('0x3')](function(){return new BPromise(function(_0x12ea96,_0xc39da0){return pm2[_0x43d9('0xa')](function(_0x41fc1b){if(_0x41fc1b){return _0xc39da0(_0x41fc1b);}return _0x12ea96(_0x43d9('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c06c160..8273e3b 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 _0xab59=['ChatInteraction','lastMsgAt','subtract','minutes','length','map','join','update','system','then','info','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','../../config/environment','../../mysqldb','../logger','schedule','redis','socket.io-emitter','Setting','find','chatTimeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xab59,0x12e));var _0x9ab5=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0xab59[_0x178856];return _0x3c7fe7;};'use strict';var _=require(_0x9ab5('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require('util');var config=require(_0x9ab5('0x1'));var db=require(_0x9ab5('0x2'))['db'];var logger=require(_0x9ab5('0x3'))(_0x9ab5('0x4'));config[_0x9ab5('0x5')]=_['defaults'](config[_0x9ab5('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9ab5('0x6'))(new Redis(config[_0x9ab5('0x5')]));function closeInteractions(){var _0x445a45=0x0;var _0x2803c8=[];return db[_0x9ab5('0x7')][_0x9ab5('0x8')]({'raw':!![],'attributes':['id',_0x9ab5('0x9')],'where':{'id':0x1}})['then'](function(_0x214b44){_0x445a45=_0x214b44[_0x9ab5('0x9')];if(_0x445a45){return db[_0x9ab5('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x9ab5('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x9ab5('0xc')](_0x214b44[_0x9ab5('0x9')],_0x9ab5('0xd'))}}});}else{return[];}})['then'](function(_0x537cbf){if(_0x537cbf&&_0x537cbf[_0x9ab5('0xe')]){_0x2803c8=_[_0x9ab5('0xf')](_0x537cbf||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x2803c8[_0x9ab5('0x10')]());return db['ChatInteraction'][_0x9ab5('0x11')]({'closeReason':_0x9ab5('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2803c8}});}})[_0x9ab5('0x13')](function(){if(_0x2803c8&&_0x2803c8['length']){logger[_0x9ab5('0x14')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2803c8['join']());for(var _0x3efc20=0x0;_0x3efc20<_0x2803c8[_0x9ab5('0xe')];_0x3efc20++){io['emit']('chatInteraction:update',{'id':_0x2803c8[_0x3efc20],'closed':!![]});}}})[_0x9ab5('0x15')](function(_0x2912c0){logger[_0x9ab5('0x16')](_0x9ab5('0x17'),_0x2912c0?util[_0x9ab5('0x18')](_0x2912c0,{'showHidden':![],'depth':null}):'');});}exports[_0x9ab5('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa95c=['ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','map','[CHAT]\x20Interactions\x20to\x20close:','update','system','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment'];(function(_0x328497,_0x308472){var _0x13e1f0=function(_0x163b4b){while(--_0x163b4b){_0x328497['push'](_0x328497['shift']());}};_0x13e1f0(++_0x308472);}(_0xa95c,0x1cf));var _0xca95=function(_0x10bcf9,_0x347b2c){_0x10bcf9=_0x10bcf9-0x0;var _0x22c37c=_0xa95c[_0x10bcf9];return _0x22c37c;};'use strict';var _=require(_0xca95('0x0'));var moment=require(_0xca95('0x1'));var Redis=require(_0xca95('0x2'));var util=require(_0xca95('0x3'));var config=require(_0xca95('0x4'));var db=require(_0xca95('0x5'))['db'];var logger=require(_0xca95('0x6'))(_0xca95('0x7'));config[_0xca95('0x8')]=_[_0xca95('0x9')](config[_0xca95('0x8')],{'host':_0xca95('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xca95('0x8')]));function closeInteractions(){var _0x3d72fc=0x0;var _0xabded1=[];return db['Setting'][_0xca95('0xb')]({'raw':!![],'attributes':['id',_0xca95('0xc')],'where':{'id':0x1}})[_0xca95('0xd')](function(_0x3ecefa){_0x3d72fc=_0x3ecefa[_0xca95('0xc')];if(_0x3d72fc){return db[_0xca95('0xe')][_0xca95('0xf')]({'raw':!![],'attributes':['id',_0xca95('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xca95('0x11')](_0x3ecefa[_0xca95('0xc')],'minutes')}}});}else{return[];}})[_0xca95('0xd')](function(_0x3a1ffe){if(_0x3a1ffe&&_0x3a1ffe[_0xca95('0x12')]){_0xabded1=_[_0xca95('0x13')](_0x3a1ffe||[],'id');logger['info'](_0xca95('0x14'),_0xabded1['join']());return db['ChatInteraction'][_0xca95('0x15')]({'closeReason':_0xca95('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xca95('0x17'))},{'where':{'id':_0xabded1}});}})[_0xca95('0xd')](function(){if(_0xabded1&&_0xabded1[_0xca95('0x12')]){logger['info'](_0xca95('0x18'),_0xabded1[_0xca95('0x19')]());for(var _0x829a94=0x0;_0x829a94<_0xabded1[_0xca95('0x12')];_0x829a94++){io[_0xca95('0x1a')](_0xca95('0x1b'),{'id':_0xabded1[_0x829a94],'closed':!![]});}}})['catch'](function(_0xf73b1){logger['error'](_0xca95('0x1c'),_0xf73b1?util[_0xca95('0x1d')](_0xf73b1,{'showHidden':![],'depth':null}):'');});}exports[_0xca95('0x1e')]=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 53f0832..e180ab2 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 _0xec7d=['schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','\x22%s\x22\x20<%s>','name','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','%s.%s','basename','extname','savename','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','keys','jobs','map','toString','difference','stop','deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron','active','add','add\x20cron','exists','length','startAt','endAt','update','update\x20cron','stop\x20cron','start','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger'];(function(_0x237649,_0x47e04a){var _0x794604=function(_0x3e2ac7){while(--_0x3e2ac7){_0x237649['push'](_0x237649['shift']());}};_0x794604(++_0x47e04a);}(_0xec7d,0xb1));var _0xdec7=function(_0x5b14d7,_0x10b373){_0x5b14d7=_0x5b14d7-0x0;var _0x1eb341=_0xec7d[_0x5b14d7];return _0x1eb341;};'use strict';var fs=require('fs');var util=require(_0xdec7('0x0'));var path=require(_0xdec7('0x1'));var _=require(_0xdec7('0x2'));var moment=require('moment');var CronJobManager=require(_0xdec7('0x3'));var jayson=require(_0xdec7('0x4'));var BPromise=require(_0xdec7('0x5'));var logger=require(_0xdec7('0x6'))(_0xdec7('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xdec7('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xdec7('0x9')][_0xdec7('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x287372,_0x42d585){return function(){logger[_0xdec7('0xb')](_0xdec7('0xc'),_0x287372[_0xdec7('0xd')]);var _0x54e949=!![];var _0x21b31c={'tls':{'rejectUnauthorized':![]}};if(_0x287372['MailAccount'][_0xdec7('0xe')][_0xdec7('0xf')]){_0x21b31c['service']=_0x287372[_0xdec7('0x10')]['Smtp'][_0xdec7('0xf')];}else{_0x21b31c[_0xdec7('0x11')]=_0x287372[_0xdec7('0x10')]['Smtp']['host'];_0x21b31c[_0xdec7('0x12')]=_0x287372['MailAccount'][_0xdec7('0xe')][_0xdec7('0x12')];_0x21b31c['secure']=_0x287372[_0xdec7('0x10')][_0xdec7('0xe')][_0xdec7('0x13')];}if(_0x287372[_0xdec7('0x10')]['Smtp'][_0xdec7('0x14')]){_0x21b31c[_0xdec7('0x15')]={'user':_0x287372[_0xdec7('0x10')][_0xdec7('0xe')][_0xdec7('0x16')],'pass':_0x287372['MailAccount'][_0xdec7('0xe')]['pass']};}var _0x25a036={'account':_0x21b31c,'message':{'from':util['format'](_0xdec7('0x17'),_0x287372[_0xdec7('0x10')][_0xdec7('0x18')],_0x287372[_0xdec7('0x10')]['email']||_0x287372[_0xdec7('0x10')]['Smtp'][_0xdec7('0x16')]),'to':_0x287372[_0xdec7('0xd')],'cc':_0x287372['cc'],'bcc':_0x287372[_0xdec7('0x19')],'subject':util[_0xdec7('0x1a')](_0xdec7('0x1b'),_0x42d585[_0xdec7('0x18')],_0x287372[_0xdec7('0x1c')],_0x287372['subtractUnit'])}};var _0x3fc652=path[_0xdec7('0x1d')](__dirname,_0xdec7('0x1e'));var _0x5b6d5f=_0x42d585['savename'];var _0x2a5319=util['format'](_0xdec7('0x1f'),path[_0xdec7('0x20')](_0x42d585['savename'],path[_0xdec7('0x21')](_0x42d585[_0xdec7('0x22')])),'zip');var _0x3daac8=path[_0xdec7('0x1d')](_0x3fc652,_0x5b6d5f);var _0x3e33b2=path[_0xdec7('0x1d')](_0x3fc652,_0x2a5319);if(fs[_0xdec7('0x23')](_0x3daac8)){_0x42d585[_0xdec7('0x24')]=_0xdec7('0x25');_0x25a036[_0xdec7('0x26')][_0xdec7('0x27')]=[{'filename':_0x5b6d5f,'path':_0x3daac8}];_0x25a036[_0xdec7('0x26')][_0xdec7('0x28')]=util[_0xdec7('0x1a')](_0xdec7('0x29'),JSON[_0xdec7('0x2a')](_0x42d585,null,0x2));}else if(fs[_0xdec7('0x23')](_0x3e33b2)){_0x42d585[_0xdec7('0x24')]=_0xdec7('0x25');_0x25a036[_0xdec7('0x26')][_0xdec7('0x27')]=[{'filename':_0x2a5319,'path':_0x3e33b2}];}else{_0x25a036[_0xdec7('0x26')][_0xdec7('0x28')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x287372[_0xdec7('0x2b')]){_0x54e949=![];logger[_0xdec7('0xb')](_0xdec7('0x2c'));}}if(_0x54e949){return client[_0xdec7('0x2d')](_0xdec7('0x2e'),_0x25a036)[_0xdec7('0x2f')](function(_0x255acd){if(_0x255acd['error']){return logger[_0xdec7('0x30')](_0xdec7('0x31'),JSON[_0xdec7('0x2a')](_0x255acd));}return logger['info'](_0xdec7('0x32'));})['catch'](function(_0x184cf5){return logger[_0xdec7('0x30')](_0xdec7('0x31'),JSON[_0xdec7('0x2a')](_0x184cf5));});}};}function handleError(){return function(_0x44609f){return logger[_0xdec7('0x30')](JSON['stringify'](_0x44609f));};}function handleResult(_0x560d91){return function(_0x3366ea){logger[_0xdec7('0xb')](_0xdec7('0x33'),JSON['stringify'](_0x3366ea));if(_0x560d91[_0xdec7('0x10')]&&_0x560d91['MailAccount'][_0xdec7('0xe')]&&!_['isNil'](_0x560d91[_0xdec7('0xd')])){setTimeout(handleSendEmail(_0x560d91,_0x3366ea),0x3c*0x3e8);}};}function handleJob(_0x46c7e0){return function(){try{if(_[_0xdec7('0x34')](_0x46c7e0[_0xdec7('0x1c')])){return logger[_0xdec7('0xb')](_0xdec7('0x35'));}if(_[_0xdec7('0x34')](_0x46c7e0[_0xdec7('0x36')])){return logger[_0xdec7('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x5b85a9={'startDate':moment()[_0xdec7('0x37')](_0x46c7e0[_0xdec7('0x1c')],_0x46c7e0[_0xdec7('0x36')])[_0xdec7('0x1a')](_0xdec7('0x38')),'endDate':moment()[_0xdec7('0x1a')](_0xdec7('0x38')),'type':_0xdec7('0x39'),'output':_0x46c7e0[_0xdec7('0x3a')],'name':_0x46c7e0[_0xdec7('0x18')]};if(!_[_0xdec7('0x34')](_0x46c7e0[_0xdec7('0x3b')])){logger[_0xdec7('0xb')](_0xdec7('0x3c'),_0x46c7e0[_0xdec7('0x3b')]);return analyticDefaultReportController['runReport']({'id':_0x46c7e0[_0xdec7('0x3b')]},_0x5b85a9)[_0xdec7('0x2f')](handleResult(_0x46c7e0))[_0xdec7('0x3d')](handleError());}if(!_[_0xdec7('0x34')](_0x46c7e0[_0xdec7('0x3e')])){logger[_0xdec7('0xb')](_0xdec7('0x3f'),_0x46c7e0[_0xdec7('0x3e')]);return analyticCustomReportController[_0xdec7('0x40')]({'id':_0x46c7e0['CustomReportId']},_0x5b85a9)[_0xdec7('0x2f')](handleResult(_0x46c7e0))['catch'](handleError());}}catch(_0x29b2cd){logger['error'](JSON[_0xdec7('0x2a')](_0x29b2cd));}return logger[_0xdec7('0xb')](_0xdec7('0x41'));};}function getJobs(_0x40742c){var _0x46e321={};if(_0x40742c){_0x46e321['id']=_0x40742c;}return db[_0xdec7('0x42')][_0xdec7('0x43')]({'where':_0x46e321,'include':[{'model':db[_0xdec7('0x10')],'attributes':['id',_0xdec7('0x18'),_0xdec7('0xd')],'include':[{'model':db['MailServerOut'],'as':_0xdec7('0xe')}]}]})['then'](function(_0x2eb107){var _0x2e5715=_[_0xdec7('0x44')](manager[_0xdec7('0x45')]);var _0x4412ea=_[_0xdec7('0x46')](_0x2eb107,function(_0x1d9e92){return _0x1d9e92['id']['toString']();});var _0x3fd952=_['keyBy'](_0x2eb107,function(_0x4b4e58){return _0x4b4e58['id'][_0xdec7('0x47')]();});var _0x142460=_0x40742c?_0x4412ea:_[_0xdec7('0x48')](_0x4412ea,_0x2e5715);var _0x3cf555=_['intersection'](_0x4412ea,_0x2e5715);var _0x348f9f=_[_0xdec7('0x48')](_0x2e5715,_0x4412ea);var _0x29e412;var _0x305272;for(_0x29e412=0x0;_0x29e412<_0x348f9f['length']&&!_0x40742c;_0x29e412+=0x1){_0x305272=_0x348f9f[_0x29e412]['toString']();if(manager['exists'](_0x305272)){manager[_0xdec7('0x49')](_0x305272);manager[_0xdec7('0x4a')](_0x305272);logger[_0xdec7('0xb')](_0xdec7('0x4b'),_0x305272);}}logger['info'](_0xdec7('0x4c'),JSON[_0xdec7('0x2a')](_0x142460));for(_0x29e412=0x0;_0x29e412<_0x142460['length'];_0x29e412+=0x1){_0x305272=_0x142460[_0x29e412][_0xdec7('0x47')]();logger[_0xdec7('0xb')](_0xdec7('0x4d'),_0x305272);if(_0x40742c){logger[_0xdec7('0xb')]('my\x20id',_0x40742c);logger[_0xdec7('0xb')](JSON['stringify'](_0x3fd952[_0x305272]));BPromise[_0xdec7('0x4e')]()['then'](handleJob(_0x3fd952[_0x305272]));logger['info'](_0xdec7('0x4f'),_0x3fd952[_0x305272][_0xdec7('0x18')],_0x3fd952[_0x305272][_0xdec7('0x50')]);}else if(_0x3fd952[_0x305272]['cron']&&_0x3fd952[_0x305272][_0xdec7('0x51')]&&moment()['isBetween'](_0x3fd952[_0x305272]['startAt'],_0x3fd952[_0x305272]['endAt'])){manager[_0xdec7('0x52')](_0x305272,_0x3fd952[_0x305272]['cron'],handleJob(_0x3fd952[_0x305272]));manager['start'](_0x305272);logger[_0xdec7('0xb')](_0xdec7('0x53'),_0x3fd952[_0x305272]['name'],_0x3fd952[_0x305272][_0xdec7('0x50')]);}else if(manager[_0xdec7('0x54')](_0x305272)){manager[_0xdec7('0x49')](_0x305272);manager[_0xdec7('0x4a')](_0x305272);logger[_0xdec7('0xb')]('stop\x20cron',_0x3fd952[_0x305272][_0xdec7('0x18')],_0x3fd952[_0x305272][_0xdec7('0x50')]);}}for(_0x29e412=0x0,_0x305272;_0x29e412<_0x3cf555[_0xdec7('0x55')]&&!_0x40742c;_0x29e412+=0x1){_0x305272=_0x3cf555[_0x29e412]['toString']();if(manager[_0xdec7('0x54')](_0x305272)){if(_0x3fd952[_0x305272][_0xdec7('0x50')]&&_0x3fd952[_0x305272][_0xdec7('0x51')]&&moment()['isBetween'](_0x3fd952[_0x305272][_0xdec7('0x56')],_0x3fd952[_0x305272][_0xdec7('0x57')])){manager[_0xdec7('0x58')](_0x305272,_0x3fd952[_0x305272][_0xdec7('0x50')],handleJob(_0x3fd952[_0x305272]));logger['info'](_0xdec7('0x59'),_0x3fd952[_0x305272][_0xdec7('0x18')],_0x3fd952[_0x305272][_0xdec7('0x50')]);}else{manager[_0xdec7('0x49')](_0x305272);manager[_0xdec7('0x4a')](_0x305272);logger[_0xdec7('0xb')](_0xdec7('0x5a'),_0x3fd952[_0x305272][_0xdec7('0x18')],_0x3fd952[_0x305272][_0xdec7('0x50')]);}}}})[_0xdec7('0x3d')](function(_0x1831c0){logger[_0xdec7('0x30')](JSON[_0xdec7('0x2a')](_0x1831c0));});}exports['run']=function(_0x114d04){return getJobs(_0x114d04);};exports[_0xdec7('0x5b')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xb92e=['run\x20job','cron','active','isBetween','endAt','add\x20cron','stop\x20cron','startAt','update','update\x20cron','run','start','util','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','email\x20sent','catch','error','error\x20mail','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','jobs','map','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id'];(function(_0x510360,_0x490625){var _0x2fd7a6=function(_0x57f32f){while(--_0x57f32f){_0x510360['push'](_0x510360['shift']());}};_0x2fd7a6(++_0x490625);}(_0xb92e,0x1ba));var _0xeb92=function(_0x1d56fd,_0x36c2d4){_0x1d56fd=_0x1d56fd-0x0;var _0x1f9f71=_0xb92e[_0x1d56fd];return _0x1f9f71;};'use strict';var fs=require('fs');var util=require(_0xeb92('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0xeb92('0x1'));var CronJobManager=require(_0xeb92('0x2'));var jayson=require(_0xeb92('0x3'));var BPromise=require(_0xeb92('0x4'));var logger=require(_0xeb92('0x5'))(_0xeb92('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xeb92('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xeb92('0x8')][_0xeb92('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2f4c47,_0x1fd9c3){return function(){logger[_0xeb92('0xa')](_0xeb92('0xb'),_0x2f4c47[_0xeb92('0xc')]);var _0x1d3b27=!![];var _0xaf47b1={'tls':{'rejectUnauthorized':![]}};if(_0x2f4c47[_0xeb92('0xd')]['Smtp'][_0xeb92('0xe')]){_0xaf47b1[_0xeb92('0xe')]=_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xf')][_0xeb92('0xe')];}else{_0xaf47b1[_0xeb92('0x10')]=_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xf')][_0xeb92('0x10')];_0xaf47b1[_0xeb92('0x11')]=_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xf')][_0xeb92('0x11')];_0xaf47b1[_0xeb92('0x12')]=_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xf')][_0xeb92('0x12')];}if(_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xf')][_0xeb92('0x13')]){_0xaf47b1[_0xeb92('0x14')]={'user':_0x2f4c47['MailAccount'][_0xeb92('0xf')]['user'],'pass':_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xf')][_0xeb92('0x15')]};}var _0x20ed3c={'account':_0xaf47b1,'message':{'from':util[_0xeb92('0x16')](_0xeb92('0x17'),_0x2f4c47[_0xeb92('0xd')][_0xeb92('0x18')],_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xc')]||_0x2f4c47['MailAccount'][_0xeb92('0xf')]['user']),'to':_0x2f4c47['email'],'cc':_0x2f4c47['cc'],'bcc':_0x2f4c47['bcc'],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x1fd9c3[_0xeb92('0x18')],_0x2f4c47[_0xeb92('0x19')],_0x2f4c47[_0xeb92('0x1a')])}};var _0x71f3a5=path[_0xeb92('0x1b')](__dirname,_0xeb92('0x1c'));var _0x2de421=_0x1fd9c3[_0xeb92('0x1d')];var _0x53950c=util[_0xeb92('0x16')](_0xeb92('0x1e'),path['basename'](_0x1fd9c3['savename'],path[_0xeb92('0x1f')](_0x1fd9c3[_0xeb92('0x1d')])),_0xeb92('0x20'));var _0x9b88de=path[_0xeb92('0x1b')](_0x71f3a5,_0x2de421);var _0x1b27cb=path['join'](_0x71f3a5,_0x53950c);if(fs['existsSync'](_0x9b88de)){_0x1fd9c3[_0xeb92('0x21')]=_0xeb92('0x22');_0x20ed3c['message'][_0xeb92('0x23')]=[{'filename':_0x2de421,'path':_0x9b88de}];_0x20ed3c[_0xeb92('0x24')][_0xeb92('0x25')]=util['format'](_0xeb92('0x26'),JSON[_0xeb92('0x27')](_0x1fd9c3,null,0x2));}else if(fs[_0xeb92('0x28')](_0x1b27cb)){_0x1fd9c3[_0xeb92('0x21')]=_0xeb92('0x22');_0x20ed3c[_0xeb92('0x24')][_0xeb92('0x23')]=[{'filename':_0x53950c,'path':_0x1b27cb}];}else{_0x20ed3c[_0xeb92('0x24')][_0xeb92('0x25')]=_0xeb92('0x29');if(!_0x2f4c47['sendIfEmpty']){_0x1d3b27=![];logger[_0xeb92('0xa')](_0xeb92('0x2a'));}}if(_0x1d3b27){return client[_0xeb92('0x2b')](_0xeb92('0x2c'),_0x20ed3c)[_0xeb92('0x2d')](function(_0x4dbf62){if(_0x4dbf62['error']){return logger['error']('error\x20mail',JSON[_0xeb92('0x27')](_0x4dbf62));}return logger['info'](_0xeb92('0x2e'));})[_0xeb92('0x2f')](function(_0xc62752){return logger[_0xeb92('0x30')](_0xeb92('0x31'),JSON[_0xeb92('0x27')](_0xc62752));});}};}function handleError(){return function(_0x1fe282){return logger[_0xeb92('0x30')](JSON[_0xeb92('0x27')](_0x1fe282));};}function handleResult(_0x2f500d){return function(_0xfe1dbf){logger[_0xeb92('0xa')]('data',JSON[_0xeb92('0x27')](_0xfe1dbf));if(_0x2f500d['MailAccount']&&_0x2f500d[_0xeb92('0xd')][_0xeb92('0xf')]&&!_[_0xeb92('0x32')](_0x2f500d[_0xeb92('0xc')])){setTimeout(handleSendEmail(_0x2f500d,_0xfe1dbf),0x3c*0x3e8);}};}function handleJob(_0x276b86){return function(){try{if(_[_0xeb92('0x32')](_0x276b86[_0xeb92('0x19')])){return logger[_0xeb92('0xa')](_0xeb92('0x33'));}if(_['isNil'](_0x276b86[_0xeb92('0x1a')])){return logger[_0xeb92('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x321c52={'startDate':moment()[_0xeb92('0x34')](_0x276b86['subtractNumber'],_0x276b86['subtractUnit'])[_0xeb92('0x16')](_0xeb92('0x35')),'endDate':moment()[_0xeb92('0x16')](_0xeb92('0x35')),'type':'scheduled','output':_0x276b86[_0xeb92('0x36')],'name':_0x276b86[_0xeb92('0x18')]};if(!_[_0xeb92('0x32')](_0x276b86['DefaultReportId'])){logger['info'](_0xeb92('0x37'),_0x276b86['DefaultReportId']);return analyticDefaultReportController[_0xeb92('0x38')]({'id':_0x276b86[_0xeb92('0x39')]},_0x321c52)[_0xeb92('0x2d')](handleResult(_0x276b86))['catch'](handleError());}if(!_[_0xeb92('0x32')](_0x276b86[_0xeb92('0x3a')])){logger[_0xeb92('0xa')](_0xeb92('0x3b'),_0x276b86['CustomReportId']);return analyticCustomReportController[_0xeb92('0x38')]({'id':_0x276b86[_0xeb92('0x3a')]},_0x321c52)[_0xeb92('0x2d')](handleResult(_0x276b86))['catch'](handleError());}}catch(_0xe2ef22){logger[_0xeb92('0x30')](JSON[_0xeb92('0x27')](_0xe2ef22));}return logger[_0xeb92('0xa')](_0xeb92('0x3c'));};}function getJobs(_0x16b9b5){var _0x52eb95={};if(_0x16b9b5){_0x52eb95['id']=_0x16b9b5;}return db['Schedule'][_0xeb92('0x3d')]({'where':_0x52eb95,'include':[{'model':db[_0xeb92('0xd')],'attributes':['id',_0xeb92('0x18'),_0xeb92('0xc')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})[_0xeb92('0x2d')](function(_0x55648){var _0x37fc41=_['keys'](manager[_0xeb92('0x3e')]);var _0x58ab06=_[_0xeb92('0x3f')](_0x55648,function(_0x2cc2d0){return _0x2cc2d0['id'][_0xeb92('0x40')]();});var _0x5f4a9a=_[_0xeb92('0x41')](_0x55648,function(_0x2656de){return _0x2656de['id'][_0xeb92('0x40')]();});var _0x19bcd3=_0x16b9b5?_0x58ab06:_[_0xeb92('0x42')](_0x58ab06,_0x37fc41);var _0x4b6856=_['intersection'](_0x58ab06,_0x37fc41);var _0x3ccea2=_[_0xeb92('0x42')](_0x37fc41,_0x58ab06);var _0x336329;var _0x5f5b8b;for(_0x336329=0x0;_0x336329<_0x3ccea2[_0xeb92('0x43')]&&!_0x16b9b5;_0x336329+=0x1){_0x5f5b8b=_0x3ccea2[_0x336329][_0xeb92('0x40')]();if(manager[_0xeb92('0x44')](_0x5f5b8b)){manager[_0xeb92('0x45')](_0x5f5b8b);manager[_0xeb92('0x46')](_0x5f5b8b);logger[_0xeb92('0xa')](_0xeb92('0x47'),_0x5f5b8b);}}logger[_0xeb92('0xa')](_0xeb92('0x48'),JSON[_0xeb92('0x27')](_0x19bcd3));for(_0x336329=0x0;_0x336329<_0x19bcd3['length'];_0x336329+=0x1){_0x5f5b8b=_0x19bcd3[_0x336329]['toString']();logger[_0xeb92('0xa')]('index',_0x5f5b8b);if(_0x16b9b5){logger[_0xeb92('0xa')](_0xeb92('0x49'),_0x16b9b5);logger[_0xeb92('0xa')](JSON[_0xeb92('0x27')](_0x5f4a9a[_0x5f5b8b]));BPromise['resolve']()['then'](handleJob(_0x5f4a9a[_0x5f5b8b]));logger[_0xeb92('0xa')](_0xeb92('0x4a'),_0x5f4a9a[_0x5f5b8b][_0xeb92('0x18')],_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')]);}else if(_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')]&&_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4c')]&&moment()[_0xeb92('0x4d')](_0x5f4a9a[_0x5f5b8b]['startAt'],_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4e')])){manager['add'](_0x5f5b8b,_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')],handleJob(_0x5f4a9a[_0x5f5b8b]));manager['start'](_0x5f5b8b);logger[_0xeb92('0xa')](_0xeb92('0x4f'),_0x5f4a9a[_0x5f5b8b][_0xeb92('0x18')],_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')]);}else if(manager[_0xeb92('0x44')](_0x5f5b8b)){manager['stop'](_0x5f5b8b);manager['deleteJob'](_0x5f5b8b);logger[_0xeb92('0xa')](_0xeb92('0x50'),_0x5f4a9a[_0x5f5b8b][_0xeb92('0x18')],_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')]);}}for(_0x336329=0x0,_0x5f5b8b;_0x336329<_0x4b6856['length']&&!_0x16b9b5;_0x336329+=0x1){_0x5f5b8b=_0x4b6856[_0x336329][_0xeb92('0x40')]();if(manager[_0xeb92('0x44')](_0x5f5b8b)){if(_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')]&&_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4c')]&&moment()[_0xeb92('0x4d')](_0x5f4a9a[_0x5f5b8b][_0xeb92('0x51')],_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4e')])){manager[_0xeb92('0x52')](_0x5f5b8b,_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')],handleJob(_0x5f4a9a[_0x5f5b8b]));logger[_0xeb92('0xa')](_0xeb92('0x53'),_0x5f4a9a[_0x5f5b8b]['name'],_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')]);}else{manager['stop'](_0x5f5b8b);manager[_0xeb92('0x46')](_0x5f5b8b);logger['info'](_0xeb92('0x50'),_0x5f4a9a[_0x5f5b8b][_0xeb92('0x18')],_0x5f4a9a[_0x5f5b8b]['cron']);}}}})['catch'](function(_0x685cf6){logger[_0xeb92('0x30')](JSON[_0xeb92('0x27')](_0x685cf6));});}exports[_0xeb92('0x54')]=function(_0x2c487e){return getJobs(_0x2c487e);};exports[_0xeb92('0x55')]=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 4dac087..7ff462f 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 _0x81ef=['format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','error','start','lodash','aws-sdk','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info'];(function(_0x207ff4,_0x3aef8f){var _0x273da7=function(_0x35df0f){while(--_0x35df0f){_0x207ff4['push'](_0x207ff4['shift']());}};_0x273da7(++_0x3aef8f);}(_0x81ef,0x1f3));var _0xf81e=function(_0x489c6a,_0x2a487d){_0x489c6a=_0x489c6a-0x0;var _0x4fabe1=_0x81ef[_0x489c6a];return _0x4fabe1;};var _=require(_0xf81e('0x0'));var AWS=require(_0xf81e('0x1'));var rp=require('request-promise');var util=require(_0xf81e('0x2'));var BPromise=require('bluebird');var db=require(_0xf81e('0x3'))['db'];var logger=require(_0xf81e('0x4'))(_0xf81e('0x5'));function getTranscriptionJob(_0x42796e,_0x418c00,_0x1731a9,_0x157ec9){return new Promise(function(_0x56fa6b,_0x7dfacf){var _0x3cbd9f=new AWS[(_0xf81e('0x6'))]({'accessKeyId':_0x418c00,'secretAccessKey':_0x42796e,'region':_0x1731a9});_0x3cbd9f[_0xf81e('0x7')]({'TranscriptionJobName':_0x157ec9},function(_0x3bd62c,_0x482ba){if(_0x3bd62c){return _0x7dfacf(_0x3bd62c);}else{return _0x56fa6b(_0x482ba);}});});}function sentiment(_0x37d676,_0xd68d8,_0x44729a,_0x469775,_0x445855){return new Promise(function(_0x3646f6,_0x2fccf7){var _0x554092=new AWS[(_0xf81e('0x8'))]({'accessKeyId':_0xd68d8,'secretAccessKey':_0x37d676,'region':_0x44729a});_0x554092[_0xf81e('0x9')]({'Text':_0x469775,'LanguageCode':_0x445855[_0xf81e('0xa')](0x0,0x2)},function(_0x5cc636,_0x33a881){if(_0x5cc636){return _0x2fccf7(_0x5cc636);}else{return _0x3646f6(_0x33a881);}});});}function checkTranscribeJob(_0x40e4a8,_0x463923,_0x3b9d78){var _0x757c58;return new BPromise(function(_0x560214,_0x324377){logger[_0xf81e('0xb')](util[_0xf81e('0xc')](_0xf81e('0xd'),_0x40e4a8['id'],_0x40e4a8[_0xf81e('0xe')]));return getTranscriptionJob(_0x3b9d78[_0xf81e('0xf')],_0x3b9d78['data2'],_0x463923[_0xf81e('0x10')],_0x40e4a8['transcribeName'])[_0xf81e('0x11')](function(_0x32637f){logger[_0xf81e('0xb')](util['format'](_0xf81e('0x12'),_0x40e4a8['id'],_0x40e4a8[_0xf81e('0xe')],_0x32637f[_0xf81e('0x13')]['TranscriptionJobStatus']));if(!_0x40e4a8[_0xf81e('0x14')]){switch(_0x32637f[_0xf81e('0x13')][_0xf81e('0x15')]){case _0xf81e('0x16'):var _0x142024={'transcribeStatus':_0x32637f[_0xf81e('0x13')][_0xf81e('0x15')],'fileUri':_0x32637f[_0xf81e('0x13')]['Transcript'][_0xf81e('0x17')]};logger[_0xf81e('0xb')](util['format'](_0xf81e('0x18'),_0x40e4a8['id']));return rp({'uri':_0x32637f[_0xf81e('0x13')][_0xf81e('0x19')][_0xf81e('0x17')],'json':!![]})['then'](function(_0x5115b3){logger[_0xf81e('0xb')](util[_0xf81e('0xc')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x40e4a8['id']));if(_0x5115b3&&_0x5115b3['results']&&_0x5115b3[_0xf81e('0x1a')][_0xf81e('0x1b')]&&_0x5115b3[_0xf81e('0x1a')][_0xf81e('0x1b')][_0xf81e('0x1c')]){_0x142024['fileText']='';for(var _0x5e7df3=0x0;_0x5e7df3<_0x5115b3['results'][_0xf81e('0x1b')][_0xf81e('0x1c')];_0x5e7df3++){_0x142024[_0xf81e('0x14')]+=_0x5115b3[_0xf81e('0x1a')][_0xf81e('0x1b')][_0x5e7df3][_0xf81e('0x1d')]+'';}}return _0x40e4a8['update'](_0x142024);})[_0xf81e('0x11')](function(){logger[_0xf81e('0xb')](util[_0xf81e('0xc')](_0xf81e('0x1e'),_0x40e4a8['id']));if(!_0x40e4a8[_0xf81e('0x1f')]){throw new db[(_0xf81e('0x20'))][(_0xf81e('0x21'))](_0xf81e('0x22'));}if(!_0x463923[_0xf81e('0x23')]||!_0x463923[_0xf81e('0x24')]||!_0x463923['sentimentRegion']||!_0x463923[_0xf81e('0x25')]||!_0x463923[_0xf81e('0x26')]){throw new db[(_0xf81e('0x20'))][(_0xf81e('0x21'))](_0xf81e('0x27'));}if(!_0x142024['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x463923[_0xf81e('0x24')]===_0x3b9d78['id']){return _0x3b9d78;}else{return db[_0xf81e('0x28')][_0xf81e('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf81e('0x11')](function(_0x1acc98){if(!_0x1acc98){throw new db[(_0xf81e('0x20'))][(_0xf81e('0x21'))](_0xf81e('0x2a'));}if(!_0x1acc98[_0xf81e('0xf')]||!_0x1acc98['data2']){throw new db[(_0xf81e('0x20'))]['ValidationError'](_0xf81e('0x2b'));}_0x757c58=_0x1acc98;logger[_0xf81e('0xb')](util[_0xf81e('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x40e4a8['id']));return sentiment(_0x757c58['data1'],_0x757c58['data2'],_0x463923[_0xf81e('0x2c')],_0x142024['fileText'],_0x463923[_0xf81e('0x25')]);})['then'](function(_0x44bc4b){logger[_0xf81e('0xb')](util['format'](_0xf81e('0x2d'),_0x40e4a8['id']));return _0x40e4a8[_0xf81e('0x2e')]({'sentiment':_0x44bc4b[_0xf81e('0x2f')],'sPositive':_0x44bc4b['SentimentScore'][_0xf81e('0x30')],'sNegative':_0x44bc4b[_0xf81e('0x31')][_0xf81e('0x32')],'sMixed':_0x44bc4b[_0xf81e('0x31')][_0xf81e('0x33')],'sNeutral':_0x44bc4b[_0xf81e('0x31')][_0xf81e('0x34')]});})[_0xf81e('0x11')](function(){logger[_0xf81e('0xb')](util['format'](_0xf81e('0x1e'),_0x40e4a8['id']));_0x560214();});case'FAILED':return _0x40e4a8[_0xf81e('0x2e')]({'transcribeStatus':_0xf81e('0x35'),'failureReason':_0x32637f['TranscriptionJob'][_0xf81e('0x36')]})[_0xf81e('0x11')](function(){logger[_0xf81e('0xb')](util[_0xf81e('0xc')](_0xf81e('0x1e'),_0x40e4a8['id']));_0x560214();});default:logger['info'](util['format'](_0xf81e('0x37'),_0x40e4a8['id']));break;}}else{return BPromise[_0xf81e('0x38')]()[_0xf81e('0x11')](function(){if(!_0x40e4a8[_0xf81e('0x1f')]){throw new db['Sequelize'][(_0xf81e('0x21'))](_0xf81e('0x22'));}if(!_0x463923[_0xf81e('0x23')]||!_0x463923['sentimentAccountId']||!_0x463923[_0xf81e('0x2c')]||!_0x463923[_0xf81e('0x25')]||!_0x463923[_0xf81e('0x26')]){throw new db['Sequelize'][(_0xf81e('0x21'))](_0xf81e('0x27'));}if(!_0x40e4a8[_0xf81e('0x14')]){throw new Error(_0xf81e('0x39'));}if(_0x463923['sentimentAccountId']===_0x3b9d78['id']){return _0x3b9d78;}else{return db[_0xf81e('0x28')][_0xf81e('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf81e('0x11')](function(_0x276c29){if(!_0x276c29){throw new db[(_0xf81e('0x20'))][(_0xf81e('0x21'))](_0xf81e('0x2a'));}if(!_0x276c29[_0xf81e('0xf')]||!_0x276c29['data2']){throw new db['Sequelize'][(_0xf81e('0x21'))](_0xf81e('0x2b'));}_0x757c58=_0x276c29;logger[_0xf81e('0xb')](util[_0xf81e('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x40e4a8['id']));return sentiment(_0x757c58[_0xf81e('0xf')],_0x757c58['data2'],_0x463923['sentimentRegion'],_0x40e4a8['fileText'],_0x463923['language']);})[_0xf81e('0x11')](function(_0x43ee83){logger[_0xf81e('0xb')](util[_0xf81e('0xc')](_0xf81e('0x2d'),_0x40e4a8['id']));return _0x40e4a8[_0xf81e('0x2e')]({'sentiment':_0x43ee83[_0xf81e('0x2f')],'sPositive':_0x43ee83[_0xf81e('0x31')][_0xf81e('0x30')],'sNegative':_0x43ee83[_0xf81e('0x31')][_0xf81e('0x32')],'sMixed':_0x43ee83[_0xf81e('0x31')][_0xf81e('0x33')],'sNeutral':_0x43ee83['SentimentScore']['Neutral'],'transcribeStatus':_0xf81e('0x16')});})[_0xf81e('0x11')](function(){logger[_0xf81e('0xb')](util['format'](_0xf81e('0x1e'),_0x40e4a8['id']));_0x560214();});}})[_0xf81e('0x3a')](function(_0x20ddfe){if(_0x20ddfe){if(!_0x20ddfe['name']||_0x20ddfe[_0xf81e('0x3b')]!==_0xf81e('0x3c')){logger['error'](util[_0xf81e('0xc')](_0xf81e('0x3d'),_0x40e4a8['id']),util[_0xf81e('0x3e')](_0x20ddfe,{'showHidden':![],'depth':null}));}}_0x560214();});});}function checkTranscribe(){var _0xd47f5f;var _0x2de10d;var _0x2c228f;return db[_0xf81e('0x3f')][_0xf81e('0x40')]({'where':{'transcribeStatus':_0xf81e('0x41')}})[_0xf81e('0x11')](function(_0x40f0f6){if(!_0x40f0f6||!_0x40f0f6[_0xf81e('0x1c')]){throw new db[(_0xf81e('0x20'))]['ValidationError'](_0xf81e('0x42'));}_0xd47f5f=_0x40f0f6;return db[_0xf81e('0x43')][_0xf81e('0x29')]({'where':{'id':0x1}});})[_0xf81e('0x11')](function(_0x13615e){if(!_0x13615e){throw new db[(_0xf81e('0x20'))][(_0xf81e('0x21'))](_0xf81e('0x44'));}_0x2de10d=_0x13615e;if(!_0x2de10d[_0xf81e('0x5')]||!_0x2de10d[_0xf81e('0x45')]||!_0x2de10d['transcribeRegion']||!_0x2de10d[_0xf81e('0x25')]||!_0x2de10d[_0xf81e('0x26')]){throw new db[(_0xf81e('0x20'))][(_0xf81e('0x21'))](_0xf81e('0x46'));}return db[_0xf81e('0x28')][_0xf81e('0x29')]({'where':{'id':_0x2de10d[_0xf81e('0x45')]}});})['then'](function(_0x56e827){if(!_0x56e827){throw new db['Sequelize'][(_0xf81e('0x21'))](_0xf81e('0x2a'));}if(!_0x56e827['data1']||!_0x56e827['data2']){throw new db['Sequelize'][(_0xf81e('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x2c228f=_0x56e827;var _0x554246=[];_0xd47f5f['forEach'](function(_0x4c899b){_0x554246['push'](checkTranscribeJob(_0x4c899b,_0x2de10d,_0x2c228f));});return BPromise['all'](_0x554246);})[_0xf81e('0x3a')](function(_0x58bf0d){if(_0x58bf0d){if(!_0x58bf0d[_0xf81e('0x3b')]||_0x58bf0d['name']!==_0xf81e('0x3c')){logger[_0xf81e('0x47')](util[_0xf81e('0x3e')](_0x58bf0d,{'showHidden':![],'depth':null}));}}});}exports[_0xf81e('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xc31e=['inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeRegion','transcribeAccountId','forEach','push','all','error','start','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','findOne','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x3a0052,_0x16b700){var _0xb381a4=function(_0x1aeaba){while(--_0x1aeaba){_0x3a0052['push'](_0x3a0052['shift']());}};_0xb381a4(++_0x16b700);}(_0xc31e,0x180));var _0xec31=function(_0x1dbecb,_0x3d1c9a){_0x1dbecb=_0x1dbecb-0x0;var _0x4bcef5=_0xc31e[_0x1dbecb];return _0x4bcef5;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xec31('0x0'));var util=require('util');var BPromise=require(_0xec31('0x1'));var db=require(_0xec31('0x2'))['db'];var logger=require(_0xec31('0x3'))(_0xec31('0x4'));function getTranscriptionJob(_0x460080,_0xc8b5d7,_0x5577fa,_0x30c1cf){return new Promise(function(_0x172a5c,_0x2b9dc1){var _0x4367ec=new AWS['TranscribeService']({'accessKeyId':_0xc8b5d7,'secretAccessKey':_0x460080,'region':_0x5577fa});_0x4367ec[_0xec31('0x5')]({'TranscriptionJobName':_0x30c1cf},function(_0x1ce7e4,_0x5bd402){if(_0x1ce7e4){return _0x2b9dc1(_0x1ce7e4);}else{return _0x172a5c(_0x5bd402);}});});}function sentiment(_0x419c93,_0x5d2f6f,_0x30f614,_0x16da3d,_0x650cdf){return new Promise(function(_0x352037,_0x3ec71a){var _0x58810d=new AWS[(_0xec31('0x6'))]({'accessKeyId':_0x5d2f6f,'secretAccessKey':_0x419c93,'region':_0x30f614});_0x58810d[_0xec31('0x7')]({'Text':_0x16da3d,'LanguageCode':_0x650cdf[_0xec31('0x8')](0x0,0x2)},function(_0x41d72b,_0x2c0301){if(_0x41d72b){return _0x3ec71a(_0x41d72b);}else{return _0x352037(_0x2c0301);}});});}function checkTranscribeJob(_0x5ba3c0,_0x888e88,_0x57dced){var _0xd7a982;return new BPromise(function(_0x1a9403,_0xc4735e){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0xb'),_0x5ba3c0['id'],_0x5ba3c0['transcribeName']));return getTranscriptionJob(_0x57dced['data1'],_0x57dced[_0xec31('0xc')],_0x888e88['transcribeRegion'],_0x5ba3c0[_0xec31('0xd')])[_0xec31('0xe')](function(_0xc7473d){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0xf'),_0x5ba3c0['id'],_0x5ba3c0[_0xec31('0xd')],_0xc7473d[_0xec31('0x10')][_0xec31('0x11')]));if(!_0x5ba3c0[_0xec31('0x12')]){switch(_0xc7473d[_0xec31('0x10')]['TranscriptionJobStatus']){case _0xec31('0x13'):var _0x5c3023={'transcribeStatus':_0xc7473d[_0xec31('0x10')]['TranscriptionJobStatus'],'fileUri':_0xc7473d[_0xec31('0x10')][_0xec31('0x14')]['TranscriptFileUri']};logger['info'](util[_0xec31('0xa')](_0xec31('0x15'),_0x5ba3c0['id']));return rp({'uri':_0xc7473d[_0xec31('0x10')][_0xec31('0x14')][_0xec31('0x16')],'json':!![]})[_0xec31('0xe')](function(_0x4b35a9){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0x17'),_0x5ba3c0['id']));if(_0x4b35a9&&_0x4b35a9[_0xec31('0x18')]&&_0x4b35a9['results'][_0xec31('0x19')]&&_0x4b35a9[_0xec31('0x18')][_0xec31('0x19')][_0xec31('0x1a')]){_0x5c3023['fileText']='';for(var _0x877426=0x0;_0x877426<_0x4b35a9['results']['transcripts']['length'];_0x877426++){_0x5c3023[_0xec31('0x12')]+=_0x4b35a9[_0xec31('0x18')][_0xec31('0x19')][_0x877426][_0xec31('0x1b')]+'';}}return _0x5ba3c0['update'](_0x5c3023);})[_0xec31('0xe')](function(){logger['info'](util['format'](_0xec31('0x1c'),_0x5ba3c0['id']));if(!_0x5ba3c0[_0xec31('0x1d')]){throw new db[(_0xec31('0x1e'))][(_0xec31('0x1f'))](_0xec31('0x20'));}if(!_0x888e88[_0xec31('0x21')]||!_0x888e88['sentimentAccountId']||!_0x888e88[_0xec31('0x22')]||!_0x888e88['language']||!_0x888e88['bucket']){throw new db[(_0xec31('0x1e'))]['ValidationError'](_0xec31('0x23'));}if(!_0x5c3023[_0xec31('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x888e88[_0xec31('0x24')]===_0x57dced['id']){return _0x57dced;}else{return db[_0xec31('0x25')]['findOne']({'where':{'id':_settings[_0xec31('0x24')]}});}})[_0xec31('0xe')](function(_0x4bffce){if(!_0x4bffce){throw new db[(_0xec31('0x1e'))][(_0xec31('0x1f'))](_0xec31('0x26'));}if(!_0x4bffce['data1']||!_0x4bffce[_0xec31('0xc')]){throw new db[(_0xec31('0x1e'))]['ValidationError'](_0xec31('0x27'));}_0xd7a982=_0x4bffce;logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0x28'),_0x5ba3c0['id']));return sentiment(_0xd7a982[_0xec31('0x29')],_0xd7a982['data2'],_0x888e88[_0xec31('0x22')],_0x5c3023[_0xec31('0x12')],_0x888e88[_0xec31('0x2a')]);})[_0xec31('0xe')](function(_0x4551ba){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0x2b'),_0x5ba3c0['id']));return _0x5ba3c0[_0xec31('0x2c')]({'sentiment':_0x4551ba['Sentiment'],'sPositive':_0x4551ba[_0xec31('0x2d')][_0xec31('0x2e')],'sNegative':_0x4551ba[_0xec31('0x2d')][_0xec31('0x2f')],'sMixed':_0x4551ba['SentimentScore'][_0xec31('0x30')],'sNeutral':_0x4551ba[_0xec31('0x2d')][_0xec31('0x31')]});})[_0xec31('0xe')](function(){logger[_0xec31('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5ba3c0['id']));_0x1a9403();});case _0xec31('0x32'):return _0x5ba3c0['update']({'transcribeStatus':_0xec31('0x32'),'failureReason':_0xc7473d[_0xec31('0x10')][_0xec31('0x33')]})[_0xec31('0xe')](function(){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0x1c'),_0x5ba3c0['id']));_0x1a9403();});default:logger[_0xec31('0x9')](util['format'](_0xec31('0x34'),_0x5ba3c0['id']));break;}}else{return BPromise[_0xec31('0x35')]()['then'](function(){if(!_0x5ba3c0[_0xec31('0x1d')]){throw new db[(_0xec31('0x1e'))][(_0xec31('0x1f'))](_0xec31('0x20'));}if(!_0x888e88[_0xec31('0x21')]||!_0x888e88[_0xec31('0x24')]||!_0x888e88['sentimentRegion']||!_0x888e88[_0xec31('0x2a')]||!_0x888e88[_0xec31('0x36')]){throw new db[(_0xec31('0x1e'))][(_0xec31('0x1f'))](_0xec31('0x23'));}if(!_0x5ba3c0[_0xec31('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x888e88[_0xec31('0x24')]===_0x57dced['id']){return _0x57dced;}else{return db[_0xec31('0x25')][_0xec31('0x37')]({'where':{'id':_settings[_0xec31('0x24')]}});}})[_0xec31('0xe')](function(_0x264ed1){if(!_0x264ed1){throw new db['Sequelize']['ValidationError'](_0xec31('0x26'));}if(!_0x264ed1['data1']||!_0x264ed1['data2']){throw new db[(_0xec31('0x1e'))][(_0xec31('0x1f'))](_0xec31('0x27'));}_0xd7a982=_0x264ed1;logger['info'](util[_0xec31('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5ba3c0['id']));return sentiment(_0xd7a982['data1'],_0xd7a982[_0xec31('0xc')],_0x888e88[_0xec31('0x22')],_0x5ba3c0[_0xec31('0x12')],_0x888e88[_0xec31('0x2a')]);})[_0xec31('0xe')](function(_0x2ad10d){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0x2b'),_0x5ba3c0['id']));return _0x5ba3c0['update']({'sentiment':_0x2ad10d['Sentiment'],'sPositive':_0x2ad10d[_0xec31('0x2d')]['Positive'],'sNegative':_0x2ad10d[_0xec31('0x2d')]['Negative'],'sMixed':_0x2ad10d[_0xec31('0x2d')][_0xec31('0x30')],'sNeutral':_0x2ad10d[_0xec31('0x2d')]['Neutral'],'transcribeStatus':_0xec31('0x13')});})[_0xec31('0xe')](function(){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0x1c'),_0x5ba3c0['id']));_0x1a9403();});}})[_0xec31('0x38')](function(_0x3b0cd7){if(_0x3b0cd7){if(!_0x3b0cd7[_0xec31('0x39')]||_0x3b0cd7[_0xec31('0x39')]!==_0xec31('0x3a')){logger['error'](util[_0xec31('0xa')](_0xec31('0x3b'),_0x5ba3c0['id']),util[_0xec31('0x3c')](_0x3b0cd7,{'showHidden':![],'depth':null}));}}_0x1a9403();});});}function checkTranscribe(){var _0x6a7dca;var _0xfbba96;var _0x1e9a81;return db[_0xec31('0x3d')][_0xec31('0x3e')]({'where':{'transcribeStatus':_0xec31('0x3f')}})[_0xec31('0xe')](function(_0x234270){if(!_0x234270||!_0x234270['length']){throw new db['Sequelize'][(_0xec31('0x1f'))](_0xec31('0x40'));}_0x6a7dca=_0x234270;return db[_0xec31('0x41')][_0xec31('0x37')]({'where':{'id':0x1}});})[_0xec31('0xe')](function(_0x4d61ba){if(!_0x4d61ba){throw new db[(_0xec31('0x1e'))]['ValidationError'](_0xec31('0x42'));}_0xfbba96=_0x4d61ba;if(!_0xfbba96['transcribe']||!_0xfbba96['transcribeAccountId']||!_0xfbba96[_0xec31('0x43')]||!_0xfbba96['language']||!_0xfbba96[_0xec31('0x36')]){throw new db[(_0xec31('0x1e'))][(_0xec31('0x1f'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0xec31('0x37')]({'where':{'id':_0xfbba96[_0xec31('0x44')]}});})[_0xec31('0xe')](function(_0x125ff0){if(!_0x125ff0){throw new db[(_0xec31('0x1e'))]['ValidationError'](_0xec31('0x26'));}if(!_0x125ff0[_0xec31('0x29')]||!_0x125ff0[_0xec31('0xc')]){throw new db[(_0xec31('0x1e'))]['ValidationError'](_0xec31('0x27'));}_0x1e9a81=_0x125ff0;var _0x3f9fc5=[];_0x6a7dca[_0xec31('0x45')](function(_0x3d95ef){_0x3f9fc5[_0xec31('0x46')](checkTranscribeJob(_0x3d95ef,_0xfbba96,_0x1e9a81));});return BPromise[_0xec31('0x47')](_0x3f9fc5);})[_0xec31('0x38')](function(_0x535d46){if(_0x535d46){if(!_0x535d46['name']||_0x535d46[_0xec31('0x39')]!==_0xec31('0x3a')){logger[_0xec31('0x48')](util[_0xec31('0x3c')](_0x535d46,{'showHidden':![],'depth':null}));}}});}exports[_0xec31('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 55b775f..88f5d5c 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58ab=['map','info','join','WhatsappInteraction','update','system','format','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','util','../../mysqldb','schedule','redis','defaults','socket.io-emitter','findAll','lastMsgAt','subtract','hours','length'];(function(_0xe5ab93,_0x4609a6){var _0x55c0b2=function(_0x17bd7c){while(--_0x17bd7c){_0xe5ab93['push'](_0xe5ab93['shift']());}};_0x55c0b2(++_0x4609a6);}(_0x58ab,0x10c));var _0xb58a=function(_0x517626,_0x1e3aee){_0x517626=_0x517626-0x0;var _0x275823=_0x58ab[_0x517626];return _0x275823;};'use strict';var _=require(_0xb58a('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xb58a('0x1'));var config=require('../../config/environment');var db=require(_0xb58a('0x2'))['db'];var logger=require('../logger')(_0xb58a('0x3'));config[_0xb58a('0x4')]=_[_0xb58a('0x5')](config[_0xb58a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xb58a('0x6'))(new Redis(config[_0xb58a('0x4')]));function closeInteractions(){var _0x5b3ba9=[];return db['WhatsappInteraction'][_0xb58a('0x7')]({'raw':!![],'attributes':['id',_0xb58a('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb58a('0x9')](0x18,_0xb58a('0xa'))}}})['then'](function(_0x515e06){if(_0x515e06&&_0x515e06[_0xb58a('0xb')]){_0x5b3ba9=_[_0xb58a('0xc')](_0x515e06||[],'id');logger[_0xb58a('0xd')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x5b3ba9[_0xb58a('0xe')]());return db[_0xb58a('0xf')][_0xb58a('0x10')]({'closeReason':_0xb58a('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xb58a('0x12')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x5b3ba9}});}})[_0xb58a('0x13')](function(){if(_0x5b3ba9&&_0x5b3ba9['length']){logger[_0xb58a('0xd')](_0xb58a('0x14'),_0x5b3ba9['join']());for(var _0x38bdba=0x0;_0x38bdba<_0x5b3ba9[_0xb58a('0xb')];_0x38bdba++){io[_0xb58a('0x15')](_0xb58a('0x16'),{'id':_0x5b3ba9[_0x38bdba],'closed':!![]});}}})[_0xb58a('0x17')](function(_0x3e11d5){logger[_0xb58a('0x18')](_0xb58a('0x19'),_0x3e11d5?util[_0xb58a('0x1a')](_0x3e11d5,{'showHidden':![],'depth':null}):'');});}exports[_0xb58a('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1825=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','util','../../config/environment','../../mysqldb','schedule','defaults','localhost','socket.io-emitter','redis','WhatsappInteraction','lastMsgAt','hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system'];(function(_0x7a0a4e,_0x5880d2){var _0x13507a=function(_0x1e4713){while(--_0x1e4713){_0x7a0a4e['push'](_0x7a0a4e['shift']());}};_0x13507a(++_0x5880d2);}(_0x1825,0x7e));var _0x5182=function(_0x10463a,_0x1734d9){_0x10463a=_0x10463a-0x0;var _0x45bf8d=_0x1825[_0x10463a];return _0x45bf8d;};'use strict';var _=require(_0x5182('0x0'));var moment=require(_0x5182('0x1'));var Redis=require('ioredis');var util=require(_0x5182('0x2'));var config=require(_0x5182('0x3'));var db=require(_0x5182('0x4'))['db'];var logger=require('../logger')(_0x5182('0x5'));config['redis']=_[_0x5182('0x6')](config['redis'],{'host':_0x5182('0x7'),'port':0x18eb});var io=require(_0x5182('0x8'))(new Redis(config[_0x5182('0x9')]));function closeInteractions(){var _0x594ece=[];return db[_0x5182('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x5182('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x5182('0xc'))}}})[_0x5182('0xd')](function(_0x388380){if(_0x388380&&_0x388380[_0x5182('0xe')]){_0x594ece=_['map'](_0x388380||[],'id');logger['info'](_0x5182('0xf'),_0x594ece[_0x5182('0x10')]());return db[_0x5182('0xa')][_0x5182('0x11')]({'closeReason':_0x5182('0x12'),'disposition':_0x5182('0x13'),'closed':!![],'closedAt':moment()[_0x5182('0x14')](_0x5182('0x15'))},{'where':{'id':_0x594ece}});}})[_0x5182('0xd')](function(){if(_0x594ece&&_0x594ece[_0x5182('0xe')]){logger[_0x5182('0x16')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x594ece[_0x5182('0x10')]());for(var _0x3bac73=0x0;_0x3bac73<_0x594ece[_0x5182('0xe')];_0x3bac73++){io[_0x5182('0x17')](_0x5182('0x18'),{'id':_0x594ece[_0x3bac73],'closed':!![]});}}})[_0x5182('0x19')](function(_0x351785){logger[_0x5182('0x1a')](_0x5182('0x1b'),_0x351785?util['inspect'](_0x351785,{'showHidden':![],'depth':null}):'');});}exports[_0x5182('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 4d7ba85..947c822 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dec=['CmHopper','finished\x20populating','hopper1','contacts2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','contacts1'];(function(_0x2278e8,_0x4b7c9f){var _0x1af62a=function(_0x9fd9d5){while(--_0x9fd9d5){_0x2278e8['push'](_0x2278e8['shift']());}};_0x1af62a(++_0x4b7c9f);}(_0x6dec,0xcb));var _0xc6de=function(_0x4e1410,_0x1bf693){_0x4e1410=_0x4e1410-0x0;var _0x53cbdd=_0x6dec[_0x4e1410];return _0x53cbdd;};'use strict';var util=require('util');var db=require(_0xc6de('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc6de('0x1')]({'id':i,'firstName':_0xc6de('0x2')+i,'lastName':_0xc6de('0x3')+i,'phone':0xf879fb460+i,'email':_0xc6de('0x4')+i+_0xc6de('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc6de('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xc6de('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc6de('0x6')](),'updatedAt':Date[_0xc6de('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc6de('0x1')]({'id':i,'firstName':_0xc6de('0x2')+i,'lastName':_0xc6de('0x3')+i,'phone':0xf879fb460+i,'email':_0xc6de('0x4')+i+_0xc6de('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc6de('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc6de('0x6')](),'updatedAt':Date[_0xc6de('0x6')]()});}db[_0xc6de('0x7')][_0xc6de('0x8')]({'where':{}})[_0xc6de('0x9')](function(){return db[_0xc6de('0x7')][_0xc6de('0xa')](contacts);})['then'](function(){console[_0xc6de('0xb')]('finished\x20populating',_0xc6de('0xc'));return db[_0xc6de('0xd')][_0xc6de('0x8')]({'where':{}});})['then'](function(){return db[_0xc6de('0xd')][_0xc6de('0xa')](hopper);})[_0xc6de('0x9')](function(){console[_0xc6de('0xb')](_0xc6de('0xe'),_0xc6de('0xf'));return db['CmContact'][_0xc6de('0xa')](contacts2);})[_0xc6de('0x9')](function(){console['log'](_0xc6de('0xe'),_0xc6de('0x10'));return db['CmHopper'][_0xc6de('0xa')](hopper2);})[_0xc6de('0x9')](function(){console['log'](_0xc6de('0xe'),'hopper2');})[_0xc6de('0x11')](function(_0x1dccd5){console[_0xc6de('0xb')](_0x1dccd5);}); \ No newline at end of file +var _0x7463=['contacts2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log'];(function(_0x3476c6,_0x249238){var _0x8aa8b3=function(_0x504f2a){while(--_0x504f2a){_0x3476c6['push'](_0x3476c6['shift']());}};_0x8aa8b3(++_0x249238);}(_0x7463,0x92));var _0x3746=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x7463[_0x4191af];return _0x27bebf;};'use strict';var util=require(_0x3746('0x0'));var db=require(_0x3746('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x3746('0x2')+i,'lastName':_0x3746('0x3')+i,'phone':0xf879fb460+i,'email':_0x3746('0x4')+i+_0x3746('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3746('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x3746('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3746('0x7')](),'updatedAt':Date[_0x3746('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x3746('0x6')]({'id':i,'firstName':_0x3746('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x3746('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3746('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3746('0x7')](),'updatedAt':Date[_0x3746('0x7')]()});}db[_0x3746('0x8')][_0x3746('0x9')]({'where':{}})[_0x3746('0xa')](function(){return db[_0x3746('0x8')][_0x3746('0xb')](contacts);})[_0x3746('0xa')](function(){console['log'](_0x3746('0xc'),_0x3746('0xd'));return db[_0x3746('0xe')][_0x3746('0x9')]({'where':{}});})['then'](function(){return db[_0x3746('0xe')][_0x3746('0xb')](hopper);})[_0x3746('0xa')](function(){console['log']('finished\x20populating','hopper1');return db[_0x3746('0x8')]['bulkCreate'](contacts2);})['then'](function(){console[_0x3746('0xf')]('finished\x20populating',_0x3746('0x10'));return db[_0x3746('0xe')][_0x3746('0xb')](hopper2);})[_0x3746('0xa')](function(){console['log'](_0x3746('0xc'),'hopper2');})[_0x3746('0x11')](function(_0xe3c4b6){console['log'](_0xe3c4b6);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index de59c02..3011961 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4fa=['yes','/etc/pki/tls/private/motion.key','User','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all','ulaw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4fa,0x1a9));var _0xad4f=function(_0x28f922,_0x1302f8){_0x28f922=_0x28f922-0x0;var _0x4eceac=_0xd4fa[_0x28f922];return _0x4eceac;};'use strict';var util=require(_0xad4f('0x0'));var db=require(_0xad4f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xad4f('0x2')]({'name':util[_0xad4f('0x3')](_0xad4f('0x4'),_0xad4f('0x5'),i),'fullname':util['format'](_0xad4f('0x4'),_0xad4f('0x5'),i),'email':util[_0xad4f('0x3')](_0xad4f('0x6'),'agent',i),'role':_0xad4f('0x5'),'password':_0xad4f('0x7'),'internal':0xfa0+i,'type':_0xad4f('0x8'),'transport':['udp','ws',_0xad4f('0x9')],'disallow':[_0xad4f('0xa')],'allow':[_0xad4f('0xb')],'defaultuser':util[_0xad4f('0x3')]('%s%s',_0xad4f('0x5'),i),'encryption':_0xad4f('0xc'),'avpf':_0xad4f('0xc'),'force_avp':_0xad4f('0xc'),'icesupport':_0xad4f('0xc'),'dtlsenable':_0xad4f('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xad4f('0xd'),'dtlssetup':'actpass','callerid':util['format']('\x22%s\x22\x20<%s>',util[_0xad4f('0x3')](_0xad4f('0x4'),_0xad4f('0x5'),i),0xfa0+i)});}db[_0xad4f('0xe')]['bulkCreate'](users)[_0xad4f('0xf')](function(){console[_0xad4f('0x10')](_0xad4f('0x11'));})[_0xad4f('0x12')](function(_0xac9e2d){console['log'](_0xac9e2d);}); \ No newline at end of file +var _0xf211=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss'];(function(_0x2df6bc,_0x40d11c){var _0x1a7616=function(_0xe9e7a9){while(--_0xe9e7a9){_0x2df6bc['push'](_0x2df6bc['shift']());}};_0x1a7616(++_0x40d11c);}(_0xf211,0x1af));var _0x1f21=function(_0xbd3556,_0xe38bfa){_0xbd3556=_0xbd3556-0x0;var _0x4a2e2d=_0xf211[_0xbd3556];return _0x4a2e2d;};'use strict';var util=require(_0x1f21('0x0'));var db=require(_0x1f21('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x1f21('0x2')](_0x1f21('0x3'),'agent',i),'fullname':util['format'](_0x1f21('0x3'),_0x1f21('0x4'),i),'email':util[_0x1f21('0x2')](_0x1f21('0x5'),_0x1f21('0x4'),i),'role':_0x1f21('0x4'),'password':_0x1f21('0x6'),'internal':0xfa0+i,'type':_0x1f21('0x7'),'transport':[_0x1f21('0x8'),'ws',_0x1f21('0x9')],'disallow':['all'],'allow':[_0x1f21('0xa')],'defaultuser':util[_0x1f21('0x2')](_0x1f21('0x3'),'agent',i),'encryption':_0x1f21('0xb'),'avpf':_0x1f21('0xb'),'force_avp':_0x1f21('0xb'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x1f21('0xc'),'dtlsprivatekey':_0x1f21('0xd'),'dtlssetup':_0x1f21('0xe'),'callerid':util[_0x1f21('0x2')](_0x1f21('0xf'),util[_0x1f21('0x2')]('%s%s',_0x1f21('0x4'),i),0xfa0+i)});}db['User'][_0x1f21('0x10')](users)[_0x1f21('0x11')](function(){console[_0x1f21('0x12')](_0x1f21('0x13'));})[_0x1f21('0x14')](function(_0x179e2c){console['log'](_0x179e2c);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3caf577..98bb4ae 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x417b=['ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','user','voice:inbound','voice:outbound','WhatsappQueue','Trunk','getVoiceQueues','getChatQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','chat','fax','sms','mail','openchannel','trunk:%s','campaign:%s:%s','type','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','leave','map','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_openchannel_interactions:remove','WhatsappInteractions','join','default','connection','request','remotePort','log','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','telephone','agent','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','resourceId','then','Campaign','where','format','%s:queue:%s','Agents','user:%s','handshake','query','find','role','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','hasOwnProperty','include','push','VoiceQueue'];(function(_0x1486ce,_0x233c7f){var _0x10a7b2=function(_0xd96f47){while(--_0xd96f47){_0x1486ce['push'](_0x1486ce['shift']());}};_0x10a7b2(++_0x233c7f);}(_0x417b,0x1ab));var _0xb417=function(_0x261de5,_0xfb29d3){_0x261de5=_0x261de5-0x0;var _0x52d23b=_0x417b[_0x261de5];return _0x52d23b;};'use strict';var _=require(_0xb417('0x0'));var util=require(_0xb417('0x1'));var BPromise=require(_0xb417('0x2'));var db=require(_0xb417('0x3'))['db'];var config=require(_0xb417('0x4'));var queryQueues={'attributes':['id',_0xb417('0x5')],'include':[{'as':'Agents','model':db[_0xb417('0x6')],'attributes':['id',_0xb417('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb417('0x5')],'where':{'role':_0xb417('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb417('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xb417('0x5')],'where':{'role':_0xb417('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb417('0x5'),'type'],'where':{'type':_0xb417('0x9')}};function getAssociatedResources(_0x178770,_0x5a16a9,_0x549e23){return db[_0xb417('0xa')][_0xb417('0xb')]({'where':{'name':_0x178770,'userProfileId':_0x5a16a9},'raw':!![]})['then'](function(_0x5353c3){if(_0x5353c3){if(_0x5353c3[_0xb417('0xc')]){switch(_0x178770){case _0xb417('0xd'):case _0xb417('0xe'):case _0xb417('0xf'):case _0xb417('0x10'):case _0xb417('0x11'):case _0xb417('0x12'):case _0xb417('0x13'):return db[_0x549e23][_0xb417('0x14')](queryQueues);case'Telephones':return db[_0x549e23][_0xb417('0x14')](queryTelephones);case _0xb417('0x15'):return db[_0x549e23]['findAll'](queryTrunks);case _0xb417('0x16'):return db[_0x549e23][_0xb417('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0xb417('0x14')]({'attributes':[_0xb417('0x17')],'where':{'sectionId':_0x5353c3['id']},'raw':!![]})[_0xb417('0x18')](function(_0x27aac3){if(_0x27aac3){var _0x19498={'where':{'id':_['map'](_0x27aac3,_0xb417('0x17'))},'raw':!![]};switch(_0x549e23){case _0xb417('0x6'):_0x19498['where']['role']='telephone';break;case _0xb417('0x19'):_0x19498[_0xb417('0x1a')]['type']=_0xb417('0x9');break;}return db[_0x549e23][_0xb417('0x14')](_0x19498);}else{return[];}});}}else{return[];}})['then'](function(_0x4a8730){return _0x4a8730;});}function joinOrLeaveQueues(_0x113940,_0x2891fe,_0x5ee428,_0xba1328){_0x113940[_0x2891fe](util[_0xb417('0x1b')](_0xb417('0x1c'),_0x5ee428,_0xba1328[_0xb417('0x5')]));if(_0xba1328[_0xb417('0x1d')]){for(var _0xc23217=0x0;_0xc23217<_0xba1328[_0xb417('0x1d')]['length'];_0xc23217+=0x1){_0x113940[_0x2891fe](util[_0xb417('0x1b')](_0xb417('0x1e'),_0xba1328['Agents'][_0xc23217][_0xb417('0x5')]));}}}function joinOrLeave(_0x1c8ec7,_0xcbbe45,_0x3470bf){var _0x128d7d;if(_0x1c8ec7[_0xb417('0x1f')][_0xb417('0x20')]['id']){db[_0xb417('0x6')][_0xb417('0x21')]({'attributes':['id',_0xb417('0x5'),_0xb417('0x22'),_0xb417('0x23')],'where':{'id':_0x1c8ec7['handshake'][_0xb417('0x20')]['id']},'include':[{'model':db[_0xb417('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb417('0x25')],'as':_0xb417('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xb417('0x27'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xb417('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xb417('0x29')],'as':_0xb417('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xb417('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xb417('0x18')](function(_0x64f3b7){if(_0x64f3b7){_0x128d7d=_0x64f3b7;_0x1c8ec7[_0xcbbe45](util[_0xb417('0x1b')](_0xb417('0x1e'),_0x64f3b7[_0xb417('0x5')]));var _0x42ff77=[];switch(_0x64f3b7['role']){case'admin':_0x1c8ec7[_0xcbbe45]('voice:inbound');_0x1c8ec7[_0xcbbe45]('voice:outbound');if(queryQueues[_0xb417('0x2c')](_0xb417('0x2d'))){delete queryQueues[_0xb417('0x2d')];}_0x42ff77[_0xb417('0x2e')](db[_0xb417('0x2f')][_0xb417('0x14')](queryQueues));_0x42ff77['push'](db[_0xb417('0x30')][_0xb417('0x14')](queryQueues));_0x42ff77['push'](db[_0xb417('0x31')][_0xb417('0x14')](queryQueues));_0x42ff77['push'](db[_0xb417('0x32')][_0xb417('0x14')](queryQueues));_0x42ff77[_0xb417('0x2e')](db['MailQueue'][_0xb417('0x14')](queryQueues));_0x42ff77['push'](db[_0xb417('0x33')]['findAll'](queryQueues));_0x42ff77['push'](db['WhatsappQueue']['findAll'](queryQueues));_0x42ff77[_0xb417('0x2e')](db[_0xb417('0x6')]['findAll'](queryTelephones));_0x42ff77[_0xb417('0x2e')](db['Trunk']['findAll'](queryTrunks));_0x42ff77['push'](db[_0xb417('0x19')][_0xb417('0x14')](queryCampaigns));_0x42ff77['push'](db[_0xb417('0x6')]['findAll'](queryAgents));break;case _0xb417('0x34'):_0x1c8ec7[_0xcbbe45](_0xb417('0x35'));_0x1c8ec7[_0xcbbe45](_0xb417('0x36'));_0x42ff77['push'](getAssociatedResources(_0xb417('0xd'),_0x64f3b7[_0xb417('0x23')],_0xb417('0x2f')));_0x42ff77['push'](getAssociatedResources('ChatQueues',_0x64f3b7['userProfileId'],_0xb417('0x30')));_0x42ff77['push'](getAssociatedResources(_0xb417('0xf'),_0x64f3b7[_0xb417('0x23')],_0xb417('0x31')));_0x42ff77[_0xb417('0x2e')](getAssociatedResources(_0xb417('0x10'),_0x64f3b7[_0xb417('0x23')],'SmsQueue'));_0x42ff77[_0xb417('0x2e')](getAssociatedResources(_0xb417('0x11'),_0x64f3b7[_0xb417('0x23')],'MailQueue'));_0x42ff77['push'](getAssociatedResources('OpenchannelQueues',_0x64f3b7[_0xb417('0x23')],_0xb417('0x33')));_0x42ff77['push'](getAssociatedResources('WhatsappQueues',_0x64f3b7[_0xb417('0x23')],_0xb417('0x37')));_0x42ff77[_0xb417('0x2e')](getAssociatedResources('Telephones',_0x64f3b7[_0xb417('0x23')],_0xb417('0x6')));_0x42ff77[_0xb417('0x2e')](getAssociatedResources(_0xb417('0x15'),_0x64f3b7[_0xb417('0x23')],_0xb417('0x38')));_0x42ff77[_0xb417('0x2e')](getAssociatedResources('IvrCampaigns',_0x64f3b7['userProfileId'],_0xb417('0x19')));_0x42ff77['push'](db[_0xb417('0x6')][_0xb417('0x14')](queryAgents));break;case _0xb417('0x8'):_0x1c8ec7[_0xcbbe45](_0xb417('0x35'));_0x1c8ec7[_0xcbbe45]('voice:outbound');_0x42ff77[_0xb417('0x2e')](_0x64f3b7[_0xb417('0x39')]({'attributes':['id',_0xb417('0x5')]}));_0x42ff77['push'](_0x64f3b7[_0xb417('0x3a')]({'attributes':['id','name']}));_0x42ff77['push'](_0x64f3b7['getFaxQueues']({'attributes':['id',_0xb417('0x5')]}));_0x42ff77[_0xb417('0x2e')](_0x64f3b7['getSmsQueues']({'attributes':['id',_0xb417('0x5')]}));_0x42ff77[_0xb417('0x2e')](_0x64f3b7['getMailQueues']({'attributes':['id',_0xb417('0x5')]}));_0x42ff77[_0xb417('0x2e')](_0x64f3b7[_0xb417('0x3b')]({'attributes':['id',_0xb417('0x5')]}));_0x42ff77[_0xb417('0x2e')](_0x64f3b7[_0xb417('0x3c')]({'attributes':['id',_0xb417('0x5')]}));break;}return BPromise['all'](_0x42ff77);}})[_0xb417('0x18')](function(_0x5b9621){if(_0x5b9621&&_0x5b9621[_0xb417('0x3d')]){for(var _0x4c716c=0x0;_0x4c716c<_0x5b9621[_0xb417('0x3d')];_0x4c716c+=0x1){for(var _0x3db8b0=0x0;_0x3db8b0<_0x5b9621[_0x4c716c][_0xb417('0x3d')];_0x3db8b0+=0x1){switch(_0x4c716c){case 0x0:joinOrLeaveQueues(_0x1c8ec7,_0xcbbe45,_0xb417('0x3e'),_0x5b9621[_0x4c716c][_0x3db8b0]);break;case 0x1:joinOrLeaveQueues(_0x1c8ec7,_0xcbbe45,_0xb417('0x3f'),_0x5b9621[_0x4c716c][_0x3db8b0]);break;case 0x2:joinOrLeaveQueues(_0x1c8ec7,_0xcbbe45,_0xb417('0x40'),_0x5b9621[_0x4c716c][_0x3db8b0]);break;case 0x3:joinOrLeaveQueues(_0x1c8ec7,_0xcbbe45,_0xb417('0x41'),_0x5b9621[_0x4c716c][_0x3db8b0]);break;case 0x4:joinOrLeaveQueues(_0x1c8ec7,_0xcbbe45,_0xb417('0x42'),_0x5b9621[_0x4c716c][_0x3db8b0]);break;case 0x5:joinOrLeaveQueues(_0x1c8ec7,_0xcbbe45,_0xb417('0x43'),_0x5b9621[_0x4c716c][_0x3db8b0]);break;case 0x6:joinOrLeaveQueues(_0x1c8ec7,_0xcbbe45,'whatsapp',_0x5b9621[_0x4c716c][_0x3db8b0]);break;case 0x7:if(_0x128d7d['role']!=='agent')_0x1c8ec7[_0xcbbe45](util[_0xb417('0x1b')]('telephone:%s',_0x5b9621[_0x4c716c][_0x3db8b0][_0xb417('0x5')]));break;case 0x8:if(_0x128d7d[_0xb417('0x22')]!==_0xb417('0x8'))_0x1c8ec7[_0xcbbe45](util[_0xb417('0x1b')](_0xb417('0x44'),_0x5b9621[_0x4c716c][_0x3db8b0][_0xb417('0x5')]));break;case 0x9:if(_0x128d7d['role']!==_0xb417('0x8'))_0x1c8ec7[_0xcbbe45](util[_0xb417('0x1b')](_0xb417('0x45'),_0x5b9621[_0x4c716c][_0x3db8b0][_0xb417('0x46')],_0x5b9621[_0x4c716c][_0x3db8b0][_0xb417('0x5')]));break;case 0xa:_0x1c8ec7[_0xcbbe45](util[_0xb417('0x1b')]('user:%s',_0x5b9621[_0x4c716c][_0x3db8b0]['name']));break;}}}}})[_0xb417('0x18')](function(){if(_0xcbbe45==='leave'){var _0x4013a6=_['map'](_0x128d7d[_0xb417('0x47')],'id');return _0x128d7d[_0xb417('0x48')](_0x4013a6)[_0xb417('0x18')](function(){for(var _0x492997=0x0;_0x492997<_0x4013a6[_0xb417('0x3d')];_0x492997+=0x1){_0x3470bf['emit'](_0xb417('0x49'),{'ChatInteractionId':Number(_0x4013a6[_0x492997]),'UserId':Number(_0x128d7d['id'])});}});}})['then'](function(){if(_0xcbbe45===_0xb417('0x4a')){var _0x5be856=_[_0xb417('0x4b')](_0x128d7d[_0xb417('0x26')],'id');return _0x128d7d[_0xb417('0x4c')](_0x5be856)['then'](function(){for(var _0x4ec569=0x0;_0x4ec569<_0x5be856[_0xb417('0x3d')];_0x4ec569+=0x1){_0x3470bf[_0xb417('0x4d')](_0xb417('0x4e'),{'MailInteractionId':Number(_0x5be856[_0x4ec569]),'UserId':Number(_0x128d7d['id'])});}});}})[_0xb417('0x18')](function(){if(_0xcbbe45==='leave'){var _0x185550=_['map'](_0x128d7d[_0xb417('0x27')],'id');return _0x128d7d[_0xb417('0x4f')](_0x185550)['then'](function(){for(var _0x7f8bc0=0x0;_0x7f8bc0<_0x185550[_0xb417('0x3d')];_0x7f8bc0+=0x1){_0x3470bf[_0xb417('0x4d')](_0xb417('0x50'),{'FaxInteractionId':Number(_0x185550[_0x7f8bc0]),'UserId':Number(_0x128d7d['id'])});}});}})['then'](function(){if(_0xcbbe45===_0xb417('0x4a')){var _0x3de460=_['map'](_0x128d7d[_0xb417('0x28')],'id');return _0x128d7d['removeSmsInteractions'](_0x3de460)[_0xb417('0x18')](function(){for(var _0x1259d4=0x0;_0x1259d4<_0x3de460[_0xb417('0x3d')];_0x1259d4+=0x1){_0x3470bf[_0xb417('0x4d')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3de460[_0x1259d4]),'UserId':Number(_0x128d7d['id'])});}});}})['then'](function(){if(_0xcbbe45===_0xb417('0x4a')){var _0x32bdd5=_['map'](_0x128d7d[_0xb417('0x2a')],'id');return _0x128d7d['removeOpenchannelInteractions'](_0x32bdd5)[_0xb417('0x18')](function(){for(var _0x392fcf=0x0;_0x392fcf<_0x32bdd5[_0xb417('0x3d')];_0x392fcf+=0x1){_0x3470bf[_0xb417('0x4d')](_0xb417('0x51'),{'OpenchannelInteractionId':Number(_0x32bdd5[_0x392fcf]),'UserId':Number(_0x128d7d['id'])});}});}})['then'](function(){if(_0xcbbe45==='leave'){var _0x53b1a1=_['map'](_0x128d7d[_0xb417('0x52')],'id');return _0x128d7d['removeWhatsappInteractions'](_0x53b1a1)[_0xb417('0x18')](function(){for(var _0x374d2b=0x0;_0x374d2b<_0x53b1a1[_0xb417('0x3d')];_0x374d2b+=0x1){_0x3470bf['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x53b1a1[_0x374d2b]),'UserId':Number(_0x128d7d['id'])});}});}})['catch'](function(_0x2dfbf4){_0x1c8ec7['log'](_0x2dfbf4);});}}function onDisconnect(_0x315e54,_0xa1360a){joinOrLeave(_0x315e54,'leave',_0xa1360a);}function onConnect(_0x19f25f){joinOrLeave(_0x19f25f,_0xb417('0x53'));}exports[_0xb417('0x54')]=function(_0x33b7bb){_0x33b7bb['on'](_0xb417('0x55'),function(_0x2818c1){_0x2818c1['setMaxListeners'](0x0);_0x2818c1['address']=_0x2818c1[_0xb417('0x56')][_0xb417('0x55')]['remoteAddress']+':'+_0x2818c1[_0xb417('0x56')]['connection'][_0xb417('0x57')];_0x2818c1['connectedAt']=new Date();_0x2818c1['log']=function(_0x1655ba){console[_0xb417('0x58')](_0xb417('0x59')+_0x2818c1[_0xb417('0x5a')][_0xb417('0x5')]+'['+_0x2818c1[_0xb417('0x5b')]+']',_0x1655ba);};_0x2818c1['on'](_0xb417('0x5c'),function(){onDisconnect(_0x2818c1,_0x33b7bb);_0x2818c1['log'](_0xb417('0x5d'));});onConnect(_0x2818c1);_0x2818c1[_0xb417('0x58')](_0xb417('0x5e'));});}; \ No newline at end of file +var _0xcdec=['query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','include','push','VoiceQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','voice:outbound','ChatQueue','FaxQueues','FaxQueue','OpenchannelQueue','getVoiceQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','Agents','User','name','agent','telephone','type','ivr','UserProfileSection','findOne','then','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','role','Campaign','format','%s:queue:%s','length','handshake'];(function(_0x4b2b11,_0x7507cd){var _0x23ebd7=function(_0x22d0c0){while(--_0x22d0c0){_0x4b2b11['push'](_0x4b2b11['shift']());}};_0x23ebd7(++_0x7507cd);}(_0xcdec,0x173));var _0xccde=function(_0x324cd1,_0x388d74){_0x324cd1=_0x324cd1-0x0;var _0x46329d=_0xcdec[_0x324cd1];return _0x46329d;};'use strict';var _=require(_0xccde('0x0'));var util=require(_0xccde('0x1'));var BPromise=require(_0xccde('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xccde('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xccde('0x4'),'model':db[_0xccde('0x5')],'attributes':['id',_0xccde('0x6'),'role'],'raw':!![],'where':{'role':_0xccde('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xccde('0x6')],'where':{'role':_0xccde('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xccde('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0xccde('0x6')],'where':{'role':_0xccde('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xccde('0x6'),_0xccde('0x9')],'where':{'type':_0xccde('0xa')}};function getAssociatedResources(_0x54c835,_0x452586,_0x4a7d74){return db[_0xccde('0xb')][_0xccde('0xc')]({'where':{'name':_0x54c835,'userProfileId':_0x452586},'raw':!![]})[_0xccde('0xd')](function(_0x3a4a32){if(_0x3a4a32){if(_0x3a4a32['autoAssociation']){switch(_0x54c835){case'VoiceQueues':case _0xccde('0xe'):case'FaxQueues':case _0xccde('0xf'):case _0xccde('0x10'):case _0xccde('0x11'):case _0xccde('0x12'):return db[_0x4a7d74][_0xccde('0x13')](queryQueues);case _0xccde('0x14'):return db[_0x4a7d74][_0xccde('0x13')](queryTelephones);case _0xccde('0x15'):return db[_0x4a7d74]['findAll'](queryTrunks);case _0xccde('0x16'):return db[_0x4a7d74][_0xccde('0x13')](queryCampaigns);}}else{return db[_0xccde('0x17')][_0xccde('0x13')]({'attributes':[_0xccde('0x18')],'where':{'sectionId':_0x3a4a32['id']},'raw':!![]})[_0xccde('0xd')](function(_0x355516){if(_0x355516){var _0x448d11={'where':{'id':_[_0xccde('0x19')](_0x355516,_0xccde('0x18'))},'raw':!![]};switch(_0x4a7d74){case _0xccde('0x5'):_0x448d11[_0xccde('0x1a')][_0xccde('0x1b')]=_0xccde('0x8');break;case _0xccde('0x1c'):_0x448d11['where'][_0xccde('0x9')]=_0xccde('0xa');break;}return db[_0x4a7d74][_0xccde('0x13')](_0x448d11);}else{return[];}});}}else{return[];}})[_0xccde('0xd')](function(_0xfbef9a){return _0xfbef9a;});}function joinOrLeaveQueues(_0x93282e,_0x2910d6,_0x309188,_0xc9ee93){_0x93282e[_0x2910d6](util[_0xccde('0x1d')](_0xccde('0x1e'),_0x309188,_0xc9ee93[_0xccde('0x6')]));if(_0xc9ee93[_0xccde('0x4')]){for(var _0x461be9=0x0;_0x461be9<_0xc9ee93[_0xccde('0x4')][_0xccde('0x1f')];_0x461be9+=0x1){_0x93282e[_0x2910d6](util[_0xccde('0x1d')]('user:%s',_0xc9ee93[_0xccde('0x4')][_0x461be9][_0xccde('0x6')]));}}}function joinOrLeave(_0x111d12,_0x1dd4a9,_0x3e2f7a){var _0x1dcc19;if(_0x111d12[_0xccde('0x20')][_0xccde('0x21')]['id']){db['User'][_0xccde('0x22')]({'attributes':['id','name','role',_0xccde('0x23')],'where':{'id':_0x111d12[_0xccde('0x20')][_0xccde('0x21')]['id']},'include':[{'model':db[_0xccde('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xccde('0x25')],'as':_0xccde('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xccde('0x27')],'as':_0xccde('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xccde('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xccde('0x2a')],'as':_0xccde('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xccde('0x2c')],'as':_0xccde('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xccde('0xd')](function(_0x6443bf){if(_0x6443bf){_0x1dcc19=_0x6443bf;_0x111d12[_0x1dd4a9](util[_0xccde('0x1d')]('user:%s',_0x6443bf[_0xccde('0x6')]));var _0x3e9334=[];switch(_0x6443bf[_0xccde('0x1b')]){case _0xccde('0x2e'):_0x111d12[_0x1dd4a9](_0xccde('0x2f'));_0x111d12[_0x1dd4a9]('voice:outbound');if(queryQueues['hasOwnProperty'](_0xccde('0x30'))){delete queryQueues[_0xccde('0x30')];}_0x3e9334[_0xccde('0x31')](db[_0xccde('0x32')][_0xccde('0x13')](queryQueues));_0x3e9334[_0xccde('0x31')](db['ChatQueue'][_0xccde('0x13')](queryQueues));_0x3e9334[_0xccde('0x31')](db['FaxQueue'][_0xccde('0x13')](queryQueues));_0x3e9334['push'](db[_0xccde('0x33')][_0xccde('0x13')](queryQueues));_0x3e9334[_0xccde('0x31')](db[_0xccde('0x34')][_0xccde('0x13')](queryQueues));_0x3e9334[_0xccde('0x31')](db['OpenchannelQueue'][_0xccde('0x13')](queryQueues));_0x3e9334[_0xccde('0x31')](db[_0xccde('0x35')][_0xccde('0x13')](queryQueues));_0x3e9334[_0xccde('0x31')](db[_0xccde('0x5')][_0xccde('0x13')](queryTelephones));_0x3e9334[_0xccde('0x31')](db[_0xccde('0x36')][_0xccde('0x13')](queryTrunks));_0x3e9334[_0xccde('0x31')](db['Campaign'][_0xccde('0x13')](queryCampaigns));_0x3e9334[_0xccde('0x31')](db['User'][_0xccde('0x13')](queryAgents));break;case _0xccde('0x37'):_0x111d12[_0x1dd4a9](_0xccde('0x2f'));_0x111d12[_0x1dd4a9](_0xccde('0x38'));_0x3e9334[_0xccde('0x31')](getAssociatedResources('VoiceQueues',_0x6443bf[_0xccde('0x23')],'VoiceQueue'));_0x3e9334['push'](getAssociatedResources(_0xccde('0xe'),_0x6443bf['userProfileId'],_0xccde('0x39')));_0x3e9334['push'](getAssociatedResources(_0xccde('0x3a'),_0x6443bf[_0xccde('0x23')],_0xccde('0x3b')));_0x3e9334[_0xccde('0x31')](getAssociatedResources('SmsQueues',_0x6443bf[_0xccde('0x23')],'SmsQueue'));_0x3e9334['push'](getAssociatedResources('MailQueues',_0x6443bf[_0xccde('0x23')],_0xccde('0x34')));_0x3e9334[_0xccde('0x31')](getAssociatedResources(_0xccde('0x11'),_0x6443bf['userProfileId'],_0xccde('0x3c')));_0x3e9334[_0xccde('0x31')](getAssociatedResources(_0xccde('0x12'),_0x6443bf[_0xccde('0x23')],_0xccde('0x35')));_0x3e9334['push'](getAssociatedResources(_0xccde('0x14'),_0x6443bf[_0xccde('0x23')],_0xccde('0x5')));_0x3e9334[_0xccde('0x31')](getAssociatedResources(_0xccde('0x15'),_0x6443bf[_0xccde('0x23')],_0xccde('0x36')));_0x3e9334['push'](getAssociatedResources(_0xccde('0x16'),_0x6443bf['userProfileId'],'Campaign'));_0x3e9334[_0xccde('0x31')](db[_0xccde('0x5')]['findAll'](queryAgents));break;case _0xccde('0x7'):_0x111d12[_0x1dd4a9](_0xccde('0x2f'));_0x111d12[_0x1dd4a9](_0xccde('0x38'));_0x3e9334[_0xccde('0x31')](_0x6443bf[_0xccde('0x3d')]({'attributes':['id',_0xccde('0x6')]}));_0x3e9334[_0xccde('0x31')](_0x6443bf['getChatQueues']({'attributes':['id',_0xccde('0x6')]}));_0x3e9334['push'](_0x6443bf['getFaxQueues']({'attributes':['id','name']}));_0x3e9334[_0xccde('0x31')](_0x6443bf[_0xccde('0x3e')]({'attributes':['id',_0xccde('0x6')]}));_0x3e9334[_0xccde('0x31')](_0x6443bf[_0xccde('0x3f')]({'attributes':['id',_0xccde('0x6')]}));_0x3e9334[_0xccde('0x31')](_0x6443bf[_0xccde('0x40')]({'attributes':['id',_0xccde('0x6')]}));_0x3e9334[_0xccde('0x31')](_0x6443bf[_0xccde('0x41')]({'attributes':['id',_0xccde('0x6')]}));break;}return BPromise[_0xccde('0x42')](_0x3e9334);}})[_0xccde('0xd')](function(_0x1dbf03){if(_0x1dbf03&&_0x1dbf03['length']){for(var _0x2a3bdf=0x0;_0x2a3bdf<_0x1dbf03[_0xccde('0x1f')];_0x2a3bdf+=0x1){for(var _0x5d3d07=0x0;_0x5d3d07<_0x1dbf03[_0x2a3bdf][_0xccde('0x1f')];_0x5d3d07+=0x1){switch(_0x2a3bdf){case 0x0:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,_0xccde('0x43'),_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x1:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,_0xccde('0x44'),_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x2:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,_0xccde('0x45'),_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x3:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,_0xccde('0x46'),_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x4:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,'mail',_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x5:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,_0xccde('0x47'),_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x6:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,_0xccde('0x48'),_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x7:if(_0x1dcc19[_0xccde('0x1b')]!==_0xccde('0x7'))_0x111d12[_0x1dd4a9](util[_0xccde('0x1d')](_0xccde('0x49'),_0x1dbf03[_0x2a3bdf][_0x5d3d07][_0xccde('0x6')]));break;case 0x8:if(_0x1dcc19['role']!==_0xccde('0x7'))_0x111d12[_0x1dd4a9](util[_0xccde('0x1d')](_0xccde('0x4a'),_0x1dbf03[_0x2a3bdf][_0x5d3d07][_0xccde('0x6')]));break;case 0x9:if(_0x1dcc19[_0xccde('0x1b')]!==_0xccde('0x7'))_0x111d12[_0x1dd4a9](util[_0xccde('0x1d')](_0xccde('0x4b'),_0x1dbf03[_0x2a3bdf][_0x5d3d07][_0xccde('0x9')],_0x1dbf03[_0x2a3bdf][_0x5d3d07]['name']));break;case 0xa:_0x111d12[_0x1dd4a9](util[_0xccde('0x1d')](_0xccde('0x4c'),_0x1dbf03[_0x2a3bdf][_0x5d3d07][_0xccde('0x6')]));break;}}}}})[_0xccde('0xd')](function(){if(_0x1dd4a9===_0xccde('0x4d')){var _0x4a01d0=_['map'](_0x1dcc19[_0xccde('0x4e')],'id');return _0x1dcc19[_0xccde('0x4f')](_0x4a01d0)[_0xccde('0xd')](function(){for(var _0x4488a4=0x0;_0x4488a4<_0x4a01d0[_0xccde('0x1f')];_0x4488a4+=0x1){_0x3e2f7a[_0xccde('0x50')](_0xccde('0x51'),{'ChatInteractionId':Number(_0x4a01d0[_0x4488a4]),'UserId':Number(_0x1dcc19['id'])});}});}})['then'](function(){if(_0x1dd4a9===_0xccde('0x4d')){var _0x3f6507=_['map'](_0x1dcc19[_0xccde('0x26')],'id');return _0x1dcc19[_0xccde('0x52')](_0x3f6507)[_0xccde('0xd')](function(){for(var _0x535115=0x0;_0x535115<_0x3f6507[_0xccde('0x1f')];_0x535115+=0x1){_0x3e2f7a['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x3f6507[_0x535115]),'UserId':Number(_0x1dcc19['id'])});}});}})[_0xccde('0xd')](function(){if(_0x1dd4a9===_0xccde('0x4d')){var _0x695d71=_[_0xccde('0x19')](_0x1dcc19[_0xccde('0x28')],'id');return _0x1dcc19['removeFaxInteractions'](_0x695d71)[_0xccde('0xd')](function(){for(var _0x316768=0x0;_0x316768<_0x695d71[_0xccde('0x1f')];_0x316768+=0x1){_0x3e2f7a[_0xccde('0x50')](_0xccde('0x53'),{'FaxInteractionId':Number(_0x695d71[_0x316768]),'UserId':Number(_0x1dcc19['id'])});}});}})[_0xccde('0xd')](function(){if(_0x1dd4a9===_0xccde('0x4d')){var _0x3d7ab3=_[_0xccde('0x19')](_0x1dcc19['SmsInteractions'],'id');return _0x1dcc19['removeSmsInteractions'](_0x3d7ab3)[_0xccde('0xd')](function(){for(var _0x38c05c=0x0;_0x38c05c<_0x3d7ab3['length'];_0x38c05c+=0x1){_0x3e2f7a['emit'](_0xccde('0x54'),{'SmsInteractionId':Number(_0x3d7ab3[_0x38c05c]),'UserId':Number(_0x1dcc19['id'])});}});}})[_0xccde('0xd')](function(){if(_0x1dd4a9===_0xccde('0x4d')){var _0x5da2e0=_[_0xccde('0x19')](_0x1dcc19[_0xccde('0x2b')],'id');return _0x1dcc19['removeOpenchannelInteractions'](_0x5da2e0)[_0xccde('0xd')](function(){for(var _0x5d1667=0x0;_0x5d1667<_0x5da2e0[_0xccde('0x1f')];_0x5d1667+=0x1){_0x3e2f7a[_0xccde('0x50')](_0xccde('0x55'),{'OpenchannelInteractionId':Number(_0x5da2e0[_0x5d1667]),'UserId':Number(_0x1dcc19['id'])});}});}})[_0xccde('0xd')](function(){if(_0x1dd4a9==='leave'){var _0x427874=_[_0xccde('0x19')](_0x1dcc19[_0xccde('0x2d')],'id');return _0x1dcc19[_0xccde('0x56')](_0x427874)['then'](function(){for(var _0xca1299=0x0;_0xca1299<_0x427874[_0xccde('0x1f')];_0xca1299+=0x1){_0x3e2f7a[_0xccde('0x50')](_0xccde('0x57'),{'WhatsappInteractionId':Number(_0x427874[_0xca1299]),'UserId':Number(_0x1dcc19['id'])});}});}})[_0xccde('0x58')](function(_0x444abe){_0x111d12[_0xccde('0x59')](_0x444abe);});}}function onDisconnect(_0xc6dded,_0x3a6f95){joinOrLeave(_0xc6dded,'leave',_0x3a6f95);}function onConnect(_0x29ee52){joinOrLeave(_0x29ee52,_0xccde('0x5a'));}exports['default']=function(_0x3e5d73){_0x3e5d73['on'](_0xccde('0x5b'),function(_0x6a92a7){_0x6a92a7['setMaxListeners'](0x0);_0x6a92a7[_0xccde('0x5c')]=_0x6a92a7[_0xccde('0x5d')]['connection'][_0xccde('0x5e')]+':'+_0x6a92a7['request'][_0xccde('0x5b')][_0xccde('0x5f')];_0x6a92a7['connectedAt']=new Date();_0x6a92a7[_0xccde('0x59')]=function(_0x25e68c){console[_0xccde('0x59')](_0xccde('0x60')+_0x6a92a7[_0xccde('0x61')][_0xccde('0x6')]+'['+_0x6a92a7[_0xccde('0x5c')]+']',_0x25e68c);};_0x6a92a7['on'](_0xccde('0x62'),function(){onDisconnect(_0x6a92a7,_0x3e5d73);_0x6a92a7['log'](_0xccde('0x63'));});onConnect(_0x6a92a7);_0x6a92a7['log'](_0xccde('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index b79887e..04eb31b 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 _0xbf54=['afterCreate','newinteraction','Chat','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','error','code','catch','channel','event','UserId','User','find','then','interface','name','incomingmessage','outgoingmessage','opened','changed','closed','get','format','SIP/%s','default','length','model','condition','../../mysqldb','client','http'];(function(_0x296427,_0x120868){var _0x12ef4d=function(_0x4f8ee8){while(--_0x4f8ee8){_0x296427['push'](_0x296427['shift']());}};_0x12ef4d(++_0x120868);}(_0xbf54,0x1d1));var _0x4bf5=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0xbf54[_0x102ff9];return _0x24fa97;};'use strict';var util=require('util');var db=require(_0x4bf5('0x0'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')('triggers');var client=jayson[_0x4bf5('0x1')][_0x4bf5('0x2')]({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':_0x4bf5('0x3'),'condition':_0x4bf5('0x4'),'callback':afterCreate},{'channel':_0x4bf5('0x5'),'model':_0x4bf5('0x6'),'event':_0x4bf5('0x7'),'condition':_0x4bf5('0x8'),'callback':afterUpdate},{'channel':'Chat','model':_0x4bf5('0x9'),'event':_0x4bf5('0x3'),'condition':_0x4bf5('0xa'),'callback':afterCreateMessage},{'channel':_0x4bf5('0xb'),'model':_0x4bf5('0xc'),'event':_0x4bf5('0x3'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x4bf5('0xb'),'model':'SmsInteraction','event':_0x4bf5('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x4bf5('0xb'),'model':'SmsMessage','event':_0x4bf5('0x3'),'condition':_0x4bf5('0xa'),'callback':afterCreateMessage},{'channel':_0x4bf5('0xd'),'model':_0x4bf5('0xe'),'event':_0x4bf5('0x3'),'condition':_0x4bf5('0x4'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x4bf5('0xe'),'event':_0x4bf5('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':_0x4bf5('0xf'),'event':_0x4bf5('0x3'),'condition':_0x4bf5('0xa'),'callback':afterCreateMessage},{'channel':_0x4bf5('0x10'),'model':_0x4bf5('0x11'),'event':'afterCreate','condition':_0x4bf5('0x4'),'callback':afterCreate},{'channel':_0x4bf5('0x10'),'model':'FaxInteraction','event':'afterUpdate','condition':_0x4bf5('0x8'),'callback':afterUpdate},{'channel':_0x4bf5('0x10'),'model':_0x4bf5('0x12'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x4bf5('0x13'),'model':_0x4bf5('0x14'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x4bf5('0x13'),'model':_0x4bf5('0x14'),'event':_0x4bf5('0x7'),'condition':_0x4bf5('0x8'),'callback':afterUpdate},{'channel':'Mail','model':_0x4bf5('0x15'),'event':'afterCreate','condition':_0x4bf5('0xa'),'callback':afterCreateMessage},{'channel':_0x4bf5('0x16'),'model':_0x4bf5('0x17'),'event':'afterCreate','condition':_0x4bf5('0x4'),'callback':afterCreate},{'channel':_0x4bf5('0x16'),'model':_0x4bf5('0x17'),'event':_0x4bf5('0x7'),'condition':_0x4bf5('0x8'),'callback':afterUpdate},{'channel':_0x4bf5('0x16'),'model':_0x4bf5('0x18'),'event':_0x4bf5('0x3'),'condition':_0x4bf5('0xa'),'callback':afterCreateMessage}];function request(_0x66aebe){return client[_0x4bf5('0x19')](_0x4bf5('0x1a'),_0x66aebe)['then'](function(_0x41daf0){logger[_0x4bf5('0x1b')](_0x4bf5('0x1c'),_0x4bf5('0x1a'),_0x41daf0);if(_0x41daf0[_0x4bf5('0x1d')]){if(_0x41daf0['error'][_0x4bf5('0x1e')]===0x1f4){logger[_0x4bf5('0x1d')](_0x4bf5('0x1c'),_0x4bf5('0x1a'),_0x41daf0['error']);}}})[_0x4bf5('0x1f')](function(_0x5f4535){logger[_0x4bf5('0x1d')]('Trigger,\x20%s',_0x4bf5('0x1a'),_0x5f4535);});}function afterCreateMessage(_0x427be4,_0x16dee5){return function(_0x143921,_0x337d05){_0x143921=_0x143921['get']({'plain':!![]});_0x143921[_0x4bf5('0x20')]=_0x427be4;_0x143921[_0x4bf5('0x21')]=_0x143921['direction'];if(_0x143921[_0x4bf5('0x22')]){return db[_0x4bf5('0x23')][_0x4bf5('0x24')]({'where':{'id':_0x143921[_0x4bf5('0x22')]},'attributes':['id','name'],'raw':!![]})[_0x4bf5('0x25')](function(_0x1daab1){_0x143921[_0x4bf5('0x26')]=util['format']('SIP/%s',_0x1daab1[_0x4bf5('0x27')]);_0x143921[_0x4bf5('0x20')]=_0x427be4;return request({'event':_0x4bf5('0x28'),'message':_0x143921});})[_0x4bf5('0x1f')](function(_0x29fcea){console[_0x4bf5('0x1d')](_0x29fcea);});}else{return request({'event':_0x4bf5('0x29'),'message':_0x143921});}};}function afterCreate(_0x59cfd3,_0x1661a2){return function(_0x370ca8,_0x3a7d7a){_0x370ca8=_0x370ca8['get']({'plain':!![]});_0x370ca8[_0x4bf5('0x20')]=_0x59cfd3;_0x370ca8[_0x4bf5('0x21')]=_0x4bf5('0x2a');return request({'event':_0x1661a2,'message':_0x370ca8});};}function afterUpdate(_0x31a7ff,_0x36d144){return function(_0x39d5c1,_0x1c5c42){if(_0x39d5c1[_0x4bf5('0x2b')](_0x4bf5('0x2c'))&&_0x39d5c1[_0x4bf5('0x2c')]){_0x39d5c1=_0x39d5c1[_0x4bf5('0x2d')]({'plain':!![]});_0x39d5c1[_0x4bf5('0x20')]=_0x31a7ff;_0x39d5c1[_0x4bf5('0x21')]=_0x4bf5('0x2c');if(_0x39d5c1[_0x4bf5('0x22')]){return db['User'][_0x4bf5('0x24')]({'where':{'id':_0x39d5c1[_0x4bf5('0x22')]},'attributes':['id',_0x4bf5('0x27')],'raw':!![]})[_0x4bf5('0x25')](function(_0x2b8375){_0x39d5c1[_0x4bf5('0x26')]=util[_0x4bf5('0x2e')](_0x4bf5('0x2f'),_0x2b8375[_0x4bf5('0x27')]);return request({'event':_0x36d144,'message':_0x39d5c1});})['catch'](function(_0x5a0a64){console[_0x4bf5('0x1d')](_0x5a0a64);});}else{return request({'event':_0x36d144,'message':_0x39d5c1});}}};}exports[_0x4bf5('0x30')]=function(){for(var _0x225bcd=0x0;_0x225bcd=_0x15ef3b[_0x0ca6('0x13')]){throw Error(_0x0ca6('0x14'));}_0xabcf33(_0x297c9e);})[_0x0ca6('0x15')](function(_0x1d1684){_0x59ef38(_0x1d1684);});});}; \ No newline at end of file +var _0x2687=['count','then','getLicense','agents','catch','bluebird','../mysqldb','./license/util','voice','chat','fax','sms','whatsapp','openchannel','getChannels','toLowerCase','includes','clearBlockUser','blockedAt','updateAttributes','agent','User'];(function(_0x1cc0b9,_0x4e5d25){var _0x5db28a=function(_0x2f543e){while(--_0x2f543e){_0x1cc0b9['push'](_0x1cc0b9['shift']());}};_0x5db28a(++_0x4e5d25);}(_0x2687,0xe1));var _0x7268=function(_0x4f1676,_0x37289e){_0x4f1676=_0x4f1676-0x0;var _0x25d0a1=_0x2687[_0x4f1676];return _0x25d0a1;};'use strict';var _=require('lodash');var BPromise=require(_0x7268('0x0'));var db=require(_0x7268('0x1'))['db'];var util=require(_0x7268('0x2'));var channels=[_0x7268('0x3'),'mail',_0x7268('0x4'),_0x7268('0x5'),_0x7268('0x6'),_0x7268('0x7'),_0x7268('0x8')];exports[_0x7268('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0x1840f3){_0x1840f3=_0x1840f3[_0x7268('0xa')]();return _[_0x7268('0xb')](channels,_0x1840f3);};exports[_0x7268('0xc')]=function(_0x33ed63,_0x35d07d,_0x3bef70,_0x202df3){var _0x46ec65={'loginAttempts':_0x35d07d,'blocked':_0x3bef70};if(!_['isUndefined'](_0x202df3)){_0x46ec65[_0x7268('0xd')]=_0x202df3;}return _0x33ed63[_0x7268('0xe')](_0x46ec65);};exports['getLicense']=function(_0x1310db){return new BPromise(function(_0x57ffbb,_0x4b6d2b){var _0x1e1cdd=0x0;if(_0x1310db['role']!==_0x7268('0xf')){_0x57ffbb(_0x1310db);}db[_0x7268('0x10')][_0x7268('0x11')]({'where':{'role':_0x7268('0xf'),'online':!![],'id':{'$ne':_0x1310db['id']}}})[_0x7268('0x12')](function(_0x37bfc6){_0x1e1cdd=_0x37bfc6;return util[_0x7268('0x13')]();})[_0x7268('0x12')](function(_0x503bf2){if(_0x503bf2&&_0x503bf2['agents']&&_0x1e1cdd>=_0x503bf2[_0x7268('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x57ffbb(_0x1310db);})[_0x7268('0x15')](function(_0x5357bb){_0x4b6d2b(_0x5357bb);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 9c9742d..2da51f1 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a7c=['json','send','exports','404','status','render'];(function(_0x5d68fc,_0x32ed3b){var _0xa38ebd=function(_0xdc1a3e){while(--_0xdc1a3e){_0x5d68fc['push'](_0x5d68fc['shift']());}};_0xa38ebd(++_0x32ed3b);}(_0x3a7c,0x11c));var _0xc3a7=function(_0x44e5f6,_0x1cdb43){_0x44e5f6=_0x44e5f6-0x0;var _0x350e0e=_0x3a7c[_0x44e5f6];return _0x350e0e;};'use strict';module[_0xc3a7('0x0')][0x194]=function pageNotFound(_0x5818b8,_0x289f54){var _0x30f5dd=_0xc3a7('0x1');var _0x1338fd=0x194;var _0x1cdbaa={'status':_0x1338fd};_0x289f54[_0xc3a7('0x2')](_0x1cdbaa[_0xc3a7('0x2')]);_0x289f54[_0xc3a7('0x3')](_0x30f5dd,{},function(_0x1066a3,_0x5a2f38){if(_0x1066a3){return _0x289f54['status'](_0x1cdbaa[_0xc3a7('0x2')])[_0xc3a7('0x4')](_0x1cdbaa);}_0x289f54[_0xc3a7('0x5')](_0x5a2f38);});}; \ No newline at end of file +var _0xc260=['json','status','render'];(function(_0x543fb4,_0x24b026){var _0x356714=function(_0x3a8ac9){while(--_0x3a8ac9){_0x543fb4['push'](_0x543fb4['shift']());}};_0x356714(++_0x24b026);}(_0xc260,0x14e));var _0x0c26=function(_0x1d63eb,_0x1617c0){_0x1d63eb=_0x1d63eb-0x0;var _0x6542ce=_0xc260[_0x1d63eb];return _0x6542ce;};'use strict';module['exports'][0x194]=function pageNotFound(_0x260f71,_0x4b9b6e){var _0x538acd='404';var _0xb5e7f6=0x194;var _0x311812={'status':_0xb5e7f6};_0x4b9b6e[_0x0c26('0x0')](_0x311812[_0x0c26('0x0')]);_0x4b9b6e[_0x0c26('0x1')](_0x538acd,{},function(_0x64742d,_0x4c34ab){if(_0x64742d){return _0x4b9b6e[_0x0c26('0x0')](_0x311812[_0x0c26('0x0')])[_0x0c26('0x2')](_0x311812);}_0x4b9b6e['send'](_0x4c34ab);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 6fd5500..8644952 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9370=['../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','SenderId','belongsTo','belongsToMany','Groups','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueue','ChatQueues','FaxQueue','FaxQueues','UserFaxQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','VoicePrefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','ScreenRecording','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','Contact','ContactId','Smtp','Disposition','Dispositions','MailAccountId','Answers','Messages','Interactions','List','ListId','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','Attachments','restrict','TagId','Dashboard','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Tags','Interaction','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','user_has_sms_accounts','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','ChatWebsiteId','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','user_has_chat_interactions','team_has_chat_queues','ChatGroupId','CompanyId','HopperHistories','MailInteractions','Company','cm_contact_has_tags','CampaignId','OwnerId','Condition','All','AutomationAllId','OneAny','AutomationAnyId','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','chat_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','AnalyticFieldReport','Fields','MetricId','AccountId','SubjectId','Descriptions','FieldId','Subject','Description','Configurations','SugarcrmField','Subjects','DescriptionId','Field','VariableId','int_desk_configuration_has_tags','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','ServicenowField','ServicenowAccount','ChatQueueReport','ToId','SessionId','ProjectId','JscriptyAnswerReport','SquareProject','SmsQueues','team_has_openchannel_queues','team_has_whatsapp_queues','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','Extensions','UserProfileSections','userProfileId','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','lodash','jstz','determine','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x9370,0x158));var _0x0937=function(_0x974cd5,_0x2c6498){_0x974cd5=_0x974cd5-0x0;var _0x18899b=_0x9370[_0x974cd5];return _0x18899b;};'use strict';var path=require('path');var config=require(_0x0937('0x0'));var Sequelize=require('sequelize');var _=require(_0x0937('0x1'));var jstz=require(_0x0937('0x2'));var timezone=jstz[_0x0937('0x3')]();config['sequelize']=_[_0x0937('0x4')](config[_0x0937('0x5')],{'database':_0x0937('0x6'),'username':_0x0937('0x7'),'password':_0x0937('0x8'),'options':{'host':_0x0937('0x9'),'port':0xcea,'dialect':_0x0937('0xa'),'dialectOptions':{'charset':_0x0937('0xb')},'logging':![],'timezone':timezone[_0x0937('0xc')](),'define':{'charset':_0x0937('0xd'),'collate':_0x0937('0xe')}}});config[_0x0937('0xf')]=_[_0x0937('0x4')](config[_0x0937('0xf')],{'database':_0x0937('0x6'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x0937('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0937('0xb')},'logging':![],'timezone':timezone[_0x0937('0xc')](),'define':{'charset':_0x0937('0xd'),'collate':_0x0937('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x0937('0x5')][_0x0937('0x10')],config[_0x0937('0x5')][_0x0937('0x11')],config['sequelize']['password'],config[_0x0937('0x5')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x0937('0xf')][_0x0937('0x10')],config[_0x0937('0xf')][_0x0937('0x11')],config['sequelizeHistory'][_0x0937('0x12')],config['sequelizeHistory'][_0x0937('0x13')])};db[_0x0937('0x14')]=db['sequelize']['import']('../api/user/user.model');db['VoiceChanSpy']=db['sequelize'][_0x0937('0x15')](_0x0937('0x16'));db['VoiceContext']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x17'));db[_0x0937('0x18')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x19'));db[_0x0937('0x1a')]=db[_0x0937('0x5')]['import'](_0x0937('0x1b'));db[_0x0937('0x1c')]=db[_0x0937('0x5')]['import'](_0x0937('0x1d'));db[_0x0937('0x1e')]=db['sequelize'][_0x0937('0x15')](_0x0937('0x1f'));db['ScreenRecording']=db[_0x0937('0x5')]['import'](_0x0937('0x20'));db[_0x0937('0x21')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x22'));db[_0x0937('0x23')]=db['sequelize'][_0x0937('0x15')](_0x0937('0x24'));db[_0x0937('0x25')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x0937('0x5')]['import'](_0x0937('0x26'));db[_0x0937('0x27')]=db['sequelize'][_0x0937('0x15')](_0x0937('0x28'));db[_0x0937('0x29')]=db[_0x0937('0x5')]['import'](_0x0937('0x2a'));db['Trunk']=db[_0x0937('0x5')]['import']('../api/trunk/trunk.model');db[_0x0937('0x2b')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x2c'));db[_0x0937('0x2d')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x0937('0x2e')]=db[_0x0937('0x5')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x0937('0x2f')]=db['sequelize']['import']('../api/userChatQueue/userChatQueue.model');db[_0x0937('0x30')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x31'));db['UserFaxQueue']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x32'));db[_0x0937('0x33')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x34'));db['UserOpenchannelQueue']=db[_0x0937('0x5')]['import'](_0x0937('0x35'));db[_0x0937('0x36')]=db['sequelize'][_0x0937('0x15')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x0937('0x37')]=db[_0x0937('0x5')]['import'](_0x0937('0x38'));db[_0x0937('0x39')]=db['sequelize'][_0x0937('0x15')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db['sequelize'][_0x0937('0x15')](_0x0937('0x3a'));db[_0x0937('0x3b')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x3c'));db[_0x0937('0x3d')]=db[_0x0937('0x5')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x0937('0x3e')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/mailInteraction/mailInteraction.model');db[_0x0937('0x3f')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x40'));db[_0x0937('0x41')]=db['sequelize']['import'](_0x0937('0x42'));db[_0x0937('0x43')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x44'));db['Dashboard']=db['sequelize'][_0x0937('0x15')](_0x0937('0x45'));db[_0x0937('0x46')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x47'));db[_0x0937('0x48')]=db[_0x0937('0x5')]['import']('../api/faxAccount/faxAccount.model');db[_0x0937('0x49')]=db['sequelize'][_0x0937('0x15')](_0x0937('0x4a'));db[_0x0937('0x4b')]=db['sequelize'][_0x0937('0x15')](_0x0937('0x4c'));db[_0x0937('0x4d')]=db['sequelize'][_0x0937('0x15')](_0x0937('0x4e'));db['FaxQueue']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x4f'));db['FaxQueueReport']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x50'));db[_0x0937('0x51')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x52'));db[_0x0937('0x53')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x54'));db['SmsInteraction']=db['sequelize'][_0x0937('0x15')](_0x0937('0x55'));db[_0x0937('0x56')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x57'));db[_0x0937('0x58')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x59'));db[_0x0937('0x5a')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0x0937('0x5b')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x5c'));db[_0x0937('0x5d')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x5e'));db[_0x0937('0x5f')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0x0937('0x60')]=db[_0x0937('0x5')]['import'](_0x0937('0x61'));db[_0x0937('0x62')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/chatWebsite/chatWebsite.model');db[_0x0937('0x63')]=db['sequelize']['import'](_0x0937('0x64'));db[_0x0937('0x65')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x66'));db['ChatInteraction']=db['sequelize'][_0x0937('0x15')](_0x0937('0x67'));db[_0x0937('0x68')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x69'));db[_0x0937('0x6a')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x6b'));db['ChatQueue']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x6c'));db[_0x0937('0x6d')]=db[_0x0937('0x5')]['import'](_0x0937('0x6e'));db['ChatProactiveAction']=db[_0x0937('0x5')]['import'](_0x0937('0x6f'));db[_0x0937('0x70')]=db[_0x0937('0x5')]['import'](_0x0937('0x71'));db[_0x0937('0x72')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x73'));db[_0x0937('0x74')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/cmHopper/cmHopper.model');db[_0x0937('0x75')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x0937('0x76')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x77'));db[_0x0937('0x78')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x79'));db[_0x0937('0x7a')]=db[_0x0937('0x5')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x0937('0x7b')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x7c'));db[_0x0937('0x7d')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/action/action.model');db[_0x0937('0x7e')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x7f'));db[_0x0937('0x80')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x81'));db['Disposition']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x82'));db['Condition']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x83'));db['Interval']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x84'));db[_0x0937('0x85')]=db[_0x0937('0x5')]['import'](_0x0937('0x86'));db[_0x0937('0x87')]=db['sequelize'][_0x0937('0x15')](_0x0937('0x88'));db['VoiceQueuesLog']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x89'));db[_0x0937('0x8a')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x8b'));db['Sound']=db[_0x0937('0x5')][_0x0937('0x15')]('../api/sound/sound.model');db[_0x0937('0x8c')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x8d'));db[_0x0937('0x8e')]=db['sequelize'][_0x0937('0x15')](_0x0937('0x8f'));db[_0x0937('0x90')]=db['sequelize'][_0x0937('0x15')](_0x0937('0x91'));db[_0x0937('0x92')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/variable/variable.model');db['Integration']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x93'));db[_0x0937('0x94')]=db['sequelize'][_0x0937('0x15')](_0x0937('0x95'));db[_0x0937('0x96')]=db[_0x0937('0x5')]['import'](_0x0937('0x97'));db[_0x0937('0x98')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x0937('0x99')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x9a'));db[_0x0937('0x9b')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x9c'));db['AnalyticFieldReport']=db[_0x0937('0x5')]['import'](_0x0937('0x9d'));db[_0x0937('0x9e')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x9f'));db[_0x0937('0xa0')]=db['sequelize'][_0x0937('0x15')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x0937('0xa1')]=db['sequelize'][_0x0937('0x15')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x0937('0xa2')]=db['sequelize'][_0x0937('0x15')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x0937('0x5')]['import'](_0x0937('0xa3'));db[_0x0937('0xa4')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db['sequelize'][_0x0937('0x15')](_0x0937('0xa5'));db[_0x0937('0xa6')]=db['sequelize'][_0x0937('0x15')](_0x0937('0xa7'));db[_0x0937('0xa8')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x0937('0xa9')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xaa'));db[_0x0937('0xab')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/intZohoAccount/intZohoAccount.model');db[_0x0937('0xac')]=db['sequelize']['import'](_0x0937('0xad'));db['ZohoField']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xae'));db['ZendeskAccount']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xaf'));db[_0x0937('0xb0')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xb1'));db[_0x0937('0xb2')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xb3'));db[_0x0937('0xb4')]=db[_0x0937('0x5')][_0x0937('0x15')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0x0937('0x5')][_0x0937('0x15')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xb5'));db[_0x0937('0xb6')]=db['sequelize'][_0x0937('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x0937('0xb7')]=db[_0x0937('0x5')]['import'](_0x0937('0xb8'));db[_0x0937('0xb9')]=db['sequelize'][_0x0937('0x15')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0x0937('0x5')]['import'](_0x0937('0xba'));db[_0x0937('0xbb')]=db[_0x0937('0x5')]['import'](_0x0937('0xbc'));db['ServicenowField']=db['sequelize'][_0x0937('0x15')]('../api/intServicenowField/intServicenowField.model');db[_0x0937('0xbd')]=db[_0x0937('0x5')]['import'](_0x0937('0xbe'));db[_0x0937('0xbf')]=db['sequelize']['import'](_0x0937('0xc0'));db[_0x0937('0xc1')]=db[_0x0937('0x5')]['import'](_0x0937('0xc2'));db[_0x0937('0xc3')]=db[_0x0937('0x5')]['import'](_0x0937('0xc4'));db[_0x0937('0xc5')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xc6'));db[_0x0937('0xc7')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xc8'));db['Integration']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x93'));db[_0x0937('0xc9')]=db[_0x0937('0x5')]['import'](_0x0937('0xca'));db['ChatQueueReport']=db[_0x0937('0x5')]['import']('../api/chatQueueReport/chatQueueReport.model');db[_0x0937('0xcb')]=db[_0x0937('0x5')]['import'](_0x0937('0xcc'));db['JscriptyAnswerReport']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xcd'));db[_0x0937('0xce')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xcf'));db[_0x0937('0xd0')]=db['sequelize'][_0x0937('0x15')](_0x0937('0xd1'));db[_0x0937('0xd2')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xd3'));db[_0x0937('0xd4')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xd5'));db[_0x0937('0xd6')]=db[_0x0937('0x5')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0x0937('0xd7')]=db[_0x0937('0x5')]['import'](_0x0937('0xd8'));db['Setting']=db[_0x0937('0x5')]['import'](_0x0937('0xd9'));db[_0x0937('0xda')]=db[_0x0937('0x5')]['import'](_0x0937('0xdb'));db['SquareProject']=db['sequelize'][_0x0937('0x15')](_0x0937('0xdc'));db[_0x0937('0xdd')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xde'));db[_0x0937('0xdf')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xe0'));db[_0x0937('0xe1')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xe2'));db[_0x0937('0xe3')]=db[_0x0937('0x5')]['import'](_0x0937('0xe4'));db[_0x0937('0xe5')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xe6'));db['Migration']=db[_0x0937('0x5')]['import'](_0x0937('0xe7'));db[_0x0937('0xe8')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xe9'));db[_0x0937('0xea')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xeb'));db['MailTransferReport']=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xec'));db[_0x0937('0xed')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xee'));db[_0x0937('0xef')]=db[_0x0937('0x5')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x0937('0xf0')]=db['sequelize'][_0x0937('0x15')](_0x0937('0xf1'));db[_0x0937('0xf2')]=db['sequelize'][_0x0937('0x15')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x0937('0x5')]['import'](_0x0937('0xf3'));db[_0x0937('0xf4')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xf5'));db[_0x0937('0xf6')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xf7'));db[_0x0937('0xf8')]=db[_0x0937('0x5')]['import'](_0x0937('0xf9'));db[_0x0937('0xfa')]=db['sequelize']['import'](_0x0937('0xfb'));db[_0x0937('0xfc')]=db[_0x0937('0x5')]['import']('../api/userNotification/userNotification.model');db[_0x0937('0xfd')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0xfe'));db[_0x0937('0xff')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x100'));db[_0x0937('0x101')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x102'));db[_0x0937('0x103')]=db['sequelize'][_0x0937('0x15')](_0x0937('0x104'));db['WhatsappQueueReport']=db['sequelize'][_0x0937('0x15')](_0x0937('0x105'));db[_0x0937('0x106')]=db[_0x0937('0x5')]['import'](_0x0937('0x107'));db[_0x0937('0x108')]=db[_0x0937('0x5')][_0x0937('0x15')](_0x0937('0x109'));db[_0x0937('0x10a')]=db[_0x0937('0x5')]['import']('../api/cloudProvider/cloudProvider.model');db[_0x0937('0x10b')]=db['sequelize']['import'](_0x0937('0x10c'));db[_0x0937('0x14')][_0x0937('0x10d')](db[_0x0937('0x21')],{'as':'VoiceMail','onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x10f')});db[_0x0937('0x14')][_0x0937('0x110')](db[_0x0937('0x1e')],{'as':'Recordings','foreignKey':'UserId'});db[_0x0937('0x14')][_0x0937('0x110')](db[_0x0937('0x2d')],{'as':_0x0937('0x111'),'foreignKey':'UserId'});db[_0x0937('0x14')][_0x0937('0x110')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x0937('0x10e'),'hooks':!![]});db[_0x0937('0x14')][_0x0937('0x110')](db[_0x0937('0x76')],{'as':'HopperFinals','foreignKey':_0x0937('0x10f')});db[_0x0937('0x14')][_0x0937('0x110')](db[_0x0937('0x78')],{'as':_0x0937('0x112'),'foreignKey':_0x0937('0x10f')});db[_0x0937('0x14')]['hasMany'](db[_0x0937('0x7a')],{'as':_0x0937('0x7a'),'foreignKey':_0x0937('0x10f')});db[_0x0937('0x14')][_0x0937('0x110')](db[_0x0937('0x5d')],{'as':_0x0937('0x113'),'foreignKey':_0x0937('0x10f')});db['User'][_0x0937('0x110')](db[_0x0937('0x114')],{'as':_0x0937('0x115'),'foreignKey':'UserId'});db[_0x0937('0x14')][_0x0937('0x110')](db['SmsInteraction'],{'as':_0x0937('0x116'),'foreignKey':_0x0937('0x10f')});db['User']['hasMany'](db[_0x0937('0x4b')],{'as':_0x0937('0x117'),'foreignKey':_0x0937('0x10f')});db[_0x0937('0x14')][_0x0937('0x110')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'UserId'});db['User']['hasMany'](db[_0x0937('0x101')],{'as':_0x0937('0x118'),'foreignKey':_0x0937('0x10f')});db[_0x0937('0x14')][_0x0937('0x110')](db[_0x0937('0xfc')],{'as':'UserNotifications','foreignKey':_0x0937('0x119')});db[_0x0937('0x14')][_0x0937('0x11a')](db[_0x0937('0xf6')],{'as':_0x0937('0xf6'),'foreignKey':'userProfileId'});db[_0x0937('0x14')][_0x0937('0x11b')](db['ChatGroup'],{'as':_0x0937('0x11c'),'through':'chat_group_has_users'});db[_0x0937('0x14')][_0x0937('0x11b')](db['CmContact'],{'as':_0x0937('0x11d'),'through':_0x0937('0x11e')});db[_0x0937('0x14')][_0x0937('0x11b')](db[_0x0937('0x11f')],{'as':_0x0937('0x120'),'through':_0x0937('0x121')});db['User'][_0x0937('0x11b')](db[_0x0937('0xe1')],{'through':_0x0937('0x122')});db['User'][_0x0937('0x11b')](db[_0x0937('0x3e')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x0937('0x14')][_0x0937('0x11b')](db[_0x0937('0x114')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0x0937('0x14')][_0x0937('0x11b')](db[_0x0937('0x4b')],{'as':'FaxInteractions','through':_0x0937('0x123')});db[_0x0937('0x14')][_0x0937('0x11b')](db[_0x0937('0x124')],{'as':_0x0937('0x116'),'through':_0x0937('0x125')});db[_0x0937('0x14')][_0x0937('0x11b')](db[_0x0937('0x5d')],{'as':_0x0937('0x113'),'through':_0x0937('0x126')});db['User']['belongsToMany'](db[_0x0937('0x101')],{'as':_0x0937('0x118'),'through':'user_has_whatsapp_interactions'});db[_0x0937('0x14')]['belongsToMany'](db[_0x0937('0x1c')],{'as':_0x0937('0x127'),'through':'UserVoiceQueue','required':![]});db[_0x0937('0x14')][_0x0937('0x11b')](db['MailQueue'],{'as':_0x0937('0x128'),'through':_0x0937('0x30'),'required':![]});db[_0x0937('0x14')][_0x0937('0x11b')](db[_0x0937('0x129')],{'as':_0x0937('0x12a'),'through':_0x0937('0x2f'),'required':![],'hooks':!![]});db[_0x0937('0x14')]['belongsToMany'](db[_0x0937('0x12b')],{'as':_0x0937('0x12c'),'through':_0x0937('0x12d'),'required':![]});db['User'][_0x0937('0x11b')](db[_0x0937('0x58')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x0937('0x14')][_0x0937('0x11b')](db['OpenchannelQueue'],{'as':_0x0937('0x12e'),'through':_0x0937('0x12f'),'required':![]});db[_0x0937('0x14')][_0x0937('0x11b')](db[_0x0937('0x108')],{'as':_0x0937('0x130'),'through':_0x0937('0x36'),'required':![]});db['User'][_0x0937('0x11b')](db[_0x0937('0x11f')],{'through':_0x0937('0x121')});db[_0x0937('0x14')]['belongsToMany'](db['VoicePrefix'],{'as':_0x0937('0x131'),'through':'user_has_voice_prefixes','required':![]});db[_0x0937('0x14')][_0x0937('0x11b')](db['ChatWebsite'],{'as':_0x0937('0x132'),'through':_0x0937('0x133')});db[_0x0937('0x14')][_0x0937('0x11b')](db['FaxAccount'],{'as':_0x0937('0x134'),'through':_0x0937('0x135')});db[_0x0937('0x14')][_0x0937('0x11b')](db[_0x0937('0x136')],{'as':_0x0937('0x137'),'through':_0x0937('0x138')});db['User']['belongsToMany'](db[_0x0937('0x5a')],{'as':_0x0937('0x139'),'through':_0x0937('0x13a')});db[_0x0937('0x14')][_0x0937('0x11b')](db[_0x0937('0x51')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0x0937('0x14')][_0x0937('0x11b')](db[_0x0937('0xfd')],{'as':_0x0937('0x13b'),'through':_0x0937('0x13c')});db[_0x0937('0x14')][_0x0937('0x11b')](db['SquareProject'],{'as':_0x0937('0x13d'),'through':_0x0937('0x13e')});db[_0x0937('0x13f')][_0x0937('0x110')](db[_0x0937('0x18')],{'as':_0x0937('0x140'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x141')});db['VoiceContext'][_0x0937('0x110')](db[_0x0937('0x18')],{'onDelete':_0x0937('0x10e')});db[_0x0937('0x18')][_0x0937('0x110')](db[_0x0937('0x18')],{'as':_0x0937('0x142'),'onDelete':_0x0937('0x10e')});db[_0x0937('0x1a')][_0x0937('0x11b')](db[_0x0937('0x143')],{'as':_0x0937('0x144'),'through':_0x0937('0x145')});db[_0x0937('0x1c')]['hasMany'](db[_0x0937('0x2d')],{'as':_0x0937('0x146'),'foreignKey':_0x0937('0x147')});db[_0x0937('0x1c')][_0x0937('0x110')](db[_0x0937('0x74')],{'as':_0x0937('0x148'),'foreignKey':_0x0937('0x147')});db[_0x0937('0x1c')][_0x0937('0x110')](db[_0x0937('0x76')],{'as':_0x0937('0x149'),'foreignKey':_0x0937('0x147')});db[_0x0937('0x1c')][_0x0937('0x110')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x0937('0x147')});db[_0x0937('0x1c')][_0x0937('0x110')](db['ReportAgentPreview'],{'as':_0x0937('0x7a'),'foreignKey':_0x0937('0x147')});db[_0x0937('0x1c')][_0x0937('0x110')](db[_0x0937('0x75')],{'as':_0x0937('0x14a'),'foreignKey':_0x0937('0x147')});db['VoiceQueue'][_0x0937('0x110')](db[_0x0937('0xd0')],{'as':_0x0937('0x14b'),'foreignKey':_0x0937('0x147')});db[_0x0937('0x1c')][_0x0937('0x11a')](db[_0x0937('0x14c')],{'as':'Trunk','foreignKey':_0x0937('0x14d')});db[_0x0937('0x1c')][_0x0937('0x11a')](db[_0x0937('0x14c')],{'as':_0x0937('0x14e'),'foreignKey':_0x0937('0x14f')});db['VoiceQueue']['belongsTo'](db[_0x0937('0x150')],{'as':'Interval','foreignKey':_0x0937('0x151')});db[_0x0937('0x1c')][_0x0937('0x11a')](db[_0x0937('0x85')],{'as':_0x0937('0x152'),'foreignKey':_0x0937('0x153')});db[_0x0937('0x1c')][_0x0937('0x11b')](db['CmList'],{'as':_0x0937('0x120'),'through':_0x0937('0x154')});db[_0x0937('0x1c')][_0x0937('0x11b')](db['User'],{'as':'Agents','through':_0x0937('0x2e')});db[_0x0937('0x1c')][_0x0937('0x11b')](db[_0x0937('0xe1')],{'as':_0x0937('0x155'),'through':_0x0937('0x10b')});db['VoiceQueue'][_0x0937('0x11b')](db[_0x0937('0x11f')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x0937('0x1e')][_0x0937('0x11a')](db[_0x0937('0x14')],{'as':'User','foreignKey':_0x0937('0x10f')});db[_0x0937('0x156')]['belongsTo'](db[_0x0937('0x14')],{'as':'User','foreignKey':_0x0937('0x10f')});db[_0x0937('0x21')]['hasMany'](db[_0x0937('0x157')],{'as':'Messages','onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x158'),'sourceKey':'mailbox'});db[_0x0937('0x157')][_0x0937('0x11a')](db[_0x0937('0x21')],{'foreignKey':_0x0937('0x158'),'targetKey':_0x0937('0x159')});db[_0x0937('0x23')][_0x0937('0x110')](db[_0x0937('0x27')],{'as':_0x0937('0x15a'),'foreignKey':_0x0937('0x15b'),'constraints':![]});db[_0x0937('0x23')][_0x0937('0x110')](db[_0x0937('0x15c')],{'as':'AgentReports','foreignKey':_0x0937('0x15b'),'constraints':![]});db[_0x0937('0x23')][_0x0937('0x11a')](db[_0x0937('0x14')],{'as':_0x0937('0x14'),'foreignKey':_0x0937('0x10f')});db['VoiceCallReport'][_0x0937('0x11a')](db[_0x0937('0x72')],{'as':_0x0937('0x15d'),'foreignKey':_0x0937('0x15e')});db[_0x0937('0x37')][_0x0937('0x11a')](db['MailAccount'],{'as':_0x0937('0x136'),'foreignKey':'MailAccountId'});db['MailServerOut'][_0x0937('0x11a')](db['MailAccount'],{'as':_0x0937('0x136'),'foreignKey':'MailAccountId'});db[_0x0937('0x136')][_0x0937('0x10d')](db[_0x0937('0x37')],{'as':'Imap','onDelete':'cascade'});db[_0x0937('0x136')][_0x0937('0x10d')](db[_0x0937('0x39')],{'as':_0x0937('0x15f'),'onDelete':_0x0937('0x10e')});db[_0x0937('0x136')][_0x0937('0x110')](db[_0x0937('0x160')],{'as':_0x0937('0x161'),'foreignKey':_0x0937('0x162')});db[_0x0937('0x136')]['hasMany'](db[_0x0937('0x80')],{'as':_0x0937('0x163'),'foreignKey':_0x0937('0x162')});db[_0x0937('0x136')]['hasMany'](db[_0x0937('0x3f')],{'as':_0x0937('0x164'),'foreignKey':_0x0937('0x162')});db[_0x0937('0x136')][_0x0937('0x110')](db[_0x0937('0x3e')],{'as':_0x0937('0x165')});db[_0x0937('0x136')][_0x0937('0x110')](db[_0x0937('0x41')],{'as':_0x0937('0x142')});db['MailAccount'][_0x0937('0x11a')](db['CmList'],{'as':_0x0937('0x166'),'foreignKey':_0x0937('0x167')});db[_0x0937('0x136')]['belongsTo'](db[_0x0937('0x8e')],{'as':_0x0937('0x8e'),'foreignKey':_0x0937('0x168')});db[_0x0937('0x136')][_0x0937('0x11a')](db[_0x0937('0x85')],{'as':_0x0937('0x152'),'foreignKey':_0x0937('0x153')});db['MailAccount']['belongsToMany'](db[_0x0937('0x14')],{'as':_0x0937('0x169'),'through':'user_has_mail_accounts'});db[_0x0937('0x3b')][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x169'),'through':_0x0937('0x30')});db[_0x0937('0x3b')][_0x0937('0x11b')](db[_0x0937('0xe1')],{'through':_0x0937('0x16a'),'as':'Teams'});db['MailInteraction'][_0x0937('0x110')](db[_0x0937('0x3f')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0937('0x16b')});db[_0x0937('0x3e')][_0x0937('0x11a')](db[_0x0937('0x136')],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x162')});db['MailInteraction'][_0x0937('0x11a')](db['CmContact'],{'as':'Contact','foreignKey':_0x0937('0x15e')});db['MailInteraction'][_0x0937('0x11a')](db[_0x0937('0x14')],{'as':_0x0937('0x16d'),'foreignKey':'UserId'});db[_0x0937('0x3e')][_0x0937('0x11b')](db[_0x0937('0x8c')],{'through':_0x0937('0x16e'),'as':'Tags'});db[_0x0937('0x3e')][_0x0937('0x11b')](db['Tag'],{'through':_0x0937('0x16e'),'as':_0x0937('0x16f')});db[_0x0937('0x3e')][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x170'),'through':_0x0937('0x171'),'foreignKey':_0x0937('0x16b')});db['MailMessage']['hasMany'](db['Attachment'],{'as':_0x0937('0x172'),'onDelete':_0x0937('0x10e')});db[_0x0937('0x3f')]['belongsTo'](db[_0x0937('0x14')],{'as':_0x0937('0x14')});db[_0x0937('0x3f')][_0x0937('0x11a')](db[_0x0937('0x72')],{'onDelete':_0x0937('0x10e'),'as':'Contact'});db['MailMessage']['belongsTo'](db[_0x0937('0x3e')],{'as':'Interaction','foreignKey':_0x0937('0x16b')});db[_0x0937('0x3f')][_0x0937('0x11a')](db[_0x0937('0x136')],{'as':_0x0937('0x16c'),'foreignKey':'MailAccountId'});db[_0x0937('0x3f')][_0x0937('0x11a')](db[_0x0937('0x62')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0x0937('0x3f')][_0x0937('0x11a')](db['ChatOfflineMessage'],{'as':_0x0937('0x6a'),'foreignKey':'ChatOfflineMessageId'});db[_0x0937('0x41')][_0x0937('0x11a')](db[_0x0937('0x14')],{'onDelete':'restrict'});db[_0x0937('0x41')][_0x0937('0x11a')](db[_0x0937('0x3b')],{'onDelete':_0x0937('0x173')});db[_0x0937('0x41')]['belongsTo'](db[_0x0937('0x136')],{'onDelete':_0x0937('0x173')});db['MailApplication']['belongsTo'](db[_0x0937('0x150')],{'onDelete':_0x0937('0x173'),'foreignKey':_0x0937('0x151')});db[_0x0937('0x41')]['belongsTo'](db['Tag'],{'onDelete':_0x0937('0x173'),'foreignKey':_0x0937('0x174')});db[_0x0937('0x43')][_0x0937('0x11a')](db[_0x0937('0x136')],{});db[_0x0937('0x43')][_0x0937('0x11a')](db['CmList'],{'as':_0x0937('0x166'),'foreignKey':'ListId'});db[_0x0937('0x43')]['belongsTo'](db[_0x0937('0x72')],{'as':_0x0937('0x15d'),'foreignKey':_0x0937('0x15e')});db[_0x0937('0x43')][_0x0937('0x11a')](db[_0x0937('0x3e')],{});db[_0x0937('0x43')]['belongsTo'](db[_0x0937('0x3f')],{});db[_0x0937('0x43')][_0x0937('0x11a')](db[_0x0937('0x14')],{});db[_0x0937('0x43')]['belongsTo'](db[_0x0937('0x3b')],{});db[_0x0937('0x175')][_0x0937('0x110')](db[_0x0937('0x46')],{'as':_0x0937('0x176'),'onDelete':_0x0937('0x10e')});db[_0x0937('0x48')][_0x0937('0x110')](db[_0x0937('0x160')],{'as':'Dispositions','foreignKey':_0x0937('0x177')});db['FaxAccount'][_0x0937('0x110')](db[_0x0937('0x80')],{'as':_0x0937('0x163'),'foreignKey':'FaxAccountId'});db[_0x0937('0x48')][_0x0937('0x110')](db[_0x0937('0x4b')],{'as':_0x0937('0x165')});db['FaxAccount'][_0x0937('0x110')](db[_0x0937('0x49')],{'as':_0x0937('0x142')});db['FaxAccount'][_0x0937('0x110')](db[_0x0937('0x18')],{'as':_0x0937('0x178'),'onDelete':_0x0937('0x10e')});db['FaxAccount']['hasMany'](db['FaxMessage'],{'as':'Messages'});db[_0x0937('0x48')]['belongsTo'](db[_0x0937('0x14c')],{'as':_0x0937('0x14c')});db[_0x0937('0x48')][_0x0937('0x11a')](db[_0x0937('0x11f')],{'as':'List','foreignKey':_0x0937('0x167')});db[_0x0937('0x48')][_0x0937('0x11a')](db[_0x0937('0x85')],{'as':_0x0937('0x152'),'foreignKey':_0x0937('0x153')});db[_0x0937('0x48')][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':'Agents','through':_0x0937('0x135')});db[_0x0937('0x49')][_0x0937('0x11a')](db['User'],{'onDelete':_0x0937('0x173')});db[_0x0937('0x49')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x0937('0x173')});db[_0x0937('0x49')][_0x0937('0x11a')](db[_0x0937('0x48')],{'onDelete':_0x0937('0x173')});db[_0x0937('0x49')][_0x0937('0x11a')](db['Tag'],{'onDelete':_0x0937('0x173'),'foreignKey':_0x0937('0x174')});db['FaxInteraction'][_0x0937('0x110')](db[_0x0937('0x4d')],{'as':_0x0937('0x164'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x179')});db[_0x0937('0x4b')][_0x0937('0x11a')](db[_0x0937('0x48')],{'as':_0x0937('0x16c'),'foreignKey':'FaxAccountId'});db[_0x0937('0x4b')][_0x0937('0x11a')](db[_0x0937('0x72')],{'as':_0x0937('0x15d'),'foreignKey':_0x0937('0x15e')});db[_0x0937('0x4b')][_0x0937('0x11a')](db['User'],{'as':_0x0937('0x16d'),'foreignKey':'UserId'});db[_0x0937('0x4b')][_0x0937('0x11b')](db[_0x0937('0x8c')],{'through':_0x0937('0x17a'),'as':_0x0937('0x17b')});db[_0x0937('0x4b')][_0x0937('0x11b')](db[_0x0937('0x8c')],{'through':_0x0937('0x17a'),'as':_0x0937('0x16f')});db['FaxInteraction'][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x170'),'through':_0x0937('0x123'),'foreignKey':'FaxInteractionId'});db[_0x0937('0x4d')][_0x0937('0x11a')](db[_0x0937('0x14')],{'onDelete':_0x0937('0x10e'),'as':_0x0937('0x14')});db[_0x0937('0x4d')][_0x0937('0x11a')](db[_0x0937('0x4b')],{'as':_0x0937('0x17c'),'foreignKey':_0x0937('0x179')});db['FaxMessage'][_0x0937('0x11a')](db[_0x0937('0x72')],{'onDelete':'cascade','as':_0x0937('0x15d')});db[_0x0937('0x4d')][_0x0937('0x11a')](db[_0x0937('0xe8')],{'as':_0x0937('0xe8'),'foreignKey':_0x0937('0x17d')});db[_0x0937('0x4d')][_0x0937('0x11a')](db[_0x0937('0x48')],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x177')});db[_0x0937('0x12b')][_0x0937('0x11b')](db['User'],{'as':_0x0937('0x169'),'through':'UserFaxQueue'});db[_0x0937('0x12b')][_0x0937('0x11b')](db[_0x0937('0xe1')],{'through':_0x0937('0x17e'),'as':_0x0937('0x155')});db[_0x0937('0x17f')][_0x0937('0x11a')](db[_0x0937('0x48')],{});db[_0x0937('0x17f')][_0x0937('0x11a')](db[_0x0937('0x11f')],{'as':_0x0937('0x166'),'foreignKey':_0x0937('0x167')});db['FaxQueueReport'][_0x0937('0x11a')](db[_0x0937('0x72')],{'as':_0x0937('0x15d'),'foreignKey':'ContactId'});db[_0x0937('0x17f')]['belongsTo'](db[_0x0937('0x4b')],{});db['FaxQueueReport'][_0x0937('0x11a')](db['FaxMessage'],{});db[_0x0937('0x17f')][_0x0937('0x11a')](db['User'],{});db['FaxQueueReport'][_0x0937('0x11a')](db[_0x0937('0x12b')],{});db[_0x0937('0x51')][_0x0937('0x110')](db[_0x0937('0x160')],{'as':'Dispositions','foreignKey':'SmsAccountId'});db[_0x0937('0x51')]['hasMany'](db[_0x0937('0x80')],{'as':_0x0937('0x163'),'foreignKey':_0x0937('0x180')});db['SmsAccount'][_0x0937('0x110')](db[_0x0937('0x56')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x0937('0x51')][_0x0937('0x110')](db['SmsInteraction'],{'as':_0x0937('0x165')});db[_0x0937('0x51')]['hasMany'](db[_0x0937('0x53')],{'as':_0x0937('0x142')});db[_0x0937('0x51')][_0x0937('0x11a')](db[_0x0937('0x11f')],{'as':_0x0937('0x166'),'foreignKey':'ListId'});db[_0x0937('0x51')][_0x0937('0x11a')](db[_0x0937('0x85')],{'as':_0x0937('0x152'),'foreignKey':_0x0937('0x153')});db['SmsAccount']['belongsToMany'](db[_0x0937('0x14')],{'as':_0x0937('0x169'),'through':_0x0937('0x181')});db[_0x0937('0x53')][_0x0937('0x11a')](db['User'],{'onDelete':'restrict'});db[_0x0937('0x53')][_0x0937('0x11a')](db[_0x0937('0x58')],{'onDelete':_0x0937('0x173')});db['SmsApplication'][_0x0937('0x11a')](db[_0x0937('0x51')],{'onDelete':_0x0937('0x173')});db[_0x0937('0x53')][_0x0937('0x11a')](db['Interval'],{'onDelete':_0x0937('0x173'),'foreignKey':_0x0937('0x151')});db[_0x0937('0x53')]['belongsTo'](db[_0x0937('0x8c')],{'onDelete':_0x0937('0x173'),'foreignKey':_0x0937('0x174')});db['SmsInteraction']['hasMany'](db[_0x0937('0x56')],{'as':_0x0937('0x164'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x182')});db[_0x0937('0x124')][_0x0937('0x11a')](db['SmsAccount'],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x180')});db[_0x0937('0x124')][_0x0937('0x11a')](db[_0x0937('0x72')],{'as':_0x0937('0x15d'),'foreignKey':_0x0937('0x15e')});db[_0x0937('0x124')][_0x0937('0x11a')](db['User'],{'as':_0x0937('0x16d'),'foreignKey':'UserId'});db['SmsInteraction'][_0x0937('0x11b')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x0937('0x17b')});db[_0x0937('0x124')][_0x0937('0x11b')](db[_0x0937('0x8c')],{'through':'sms_interaction_has_tags','as':_0x0937('0x16f')});db['SmsInteraction']['belongsToMany'](db[_0x0937('0x14')],{'as':_0x0937('0x170'),'through':_0x0937('0x125'),'foreignKey':_0x0937('0x182')});db['SmsMessage'][_0x0937('0x11a')](db[_0x0937('0x14')],{'as':_0x0937('0x14')});db[_0x0937('0x56')][_0x0937('0x11a')](db[_0x0937('0x72')],{'onDelete':_0x0937('0x10e'),'as':_0x0937('0x15d')});db['SmsMessage'][_0x0937('0x11a')](db[_0x0937('0x124')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0937('0x182')});db[_0x0937('0x56')][_0x0937('0x11a')](db[_0x0937('0x51')],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x180')});db[_0x0937('0x58')][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':'Agents','through':_0x0937('0x33'),'foreignKey':_0x0937('0x183')});db[_0x0937('0x58')][_0x0937('0x11b')](db[_0x0937('0xe1')],{'through':'team_has_sms_queues','as':'Teams'});db['OpenchannelAccount'][_0x0937('0x110')](db['Disposition'],{'as':_0x0937('0x161'),'foreignKey':_0x0937('0x184')});db[_0x0937('0x5a')][_0x0937('0x110')](db['CannedAnswer'],{'as':_0x0937('0x163'),'foreignKey':_0x0937('0x184')});db[_0x0937('0x5a')]['hasMany'](db[_0x0937('0x5d')],{'as':'Interactions','foreignKey':_0x0937('0x184')});db['OpenchannelAccount'][_0x0937('0x110')](db[_0x0937('0x5f')],{'as':_0x0937('0x164'),'foreignKey':_0x0937('0x184')});db[_0x0937('0x5a')][_0x0937('0x110')](db[_0x0937('0x5b')],{'as':_0x0937('0x142'),'foreignKey':_0x0937('0x184')});db[_0x0937('0x5a')][_0x0937('0x11a')](db[_0x0937('0x11f')],{'as':_0x0937('0x166'),'foreignKey':'ListId'});db[_0x0937('0x5a')][_0x0937('0x11a')](db[_0x0937('0x85')],{'as':_0x0937('0x152'),'foreignKey':_0x0937('0x153')});db[_0x0937('0x5a')][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x169'),'through':_0x0937('0x13a')});db[_0x0937('0x5b')]['belongsTo'](db[_0x0937('0x14')],{'onDelete':'restrict'});db[_0x0937('0x5b')]['belongsTo'](db[_0x0937('0x60')],{'onDelete':_0x0937('0x173'),'foreignKey':'OpenchannelQueueId'});db[_0x0937('0x5b')][_0x0937('0x11a')](db[_0x0937('0x5a')],{'onDelete':'restrict','foreignKey':_0x0937('0x184')});db['OpenchannelApplication'][_0x0937('0x11a')](db[_0x0937('0x150')],{'onDelete':'restrict','foreignKey':_0x0937('0x151')});db[_0x0937('0x5b')]['belongsTo'](db[_0x0937('0x8c')],{'onDelete':_0x0937('0x173'),'foreignKey':'TagId'});db['OpenchannelInteraction'][_0x0937('0x110')](db[_0x0937('0x5f')],{'as':_0x0937('0x164'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x185')});db[_0x0937('0x5d')][_0x0937('0x11a')](db[_0x0937('0x5a')],{'as':'Account','foreignKey':_0x0937('0x184')});db['OpenchannelInteraction']['belongsTo'](db[_0x0937('0x72')],{'as':_0x0937('0x15d'),'foreignKey':'ContactId'});db[_0x0937('0x5d')]['belongsTo'](db[_0x0937('0x14')],{'as':_0x0937('0x16d'),'foreignKey':_0x0937('0x10f')});db[_0x0937('0x5d')]['belongsToMany'](db[_0x0937('0x8c')],{'through':_0x0937('0x186'),'as':_0x0937('0x17b')});db[_0x0937('0x5d')]['belongsToMany'](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x0937('0x5d')][_0x0937('0x11b')](db['User'],{'as':_0x0937('0x170'),'through':_0x0937('0x126'),'foreignKey':'OpenchannelInteractionId'});db[_0x0937('0x5f')][_0x0937('0x11a')](db[_0x0937('0x14')],{'onDelete':_0x0937('0x10e'),'as':_0x0937('0x14')});db[_0x0937('0x5f')]['belongsTo'](db['CmContact'],{'onDelete':_0x0937('0x10e'),'as':_0x0937('0x15d')});db['OpenchannelMessage']['belongsTo'](db[_0x0937('0x5d')],{'onDelete':_0x0937('0x10e'),'as':_0x0937('0x17c'),'foreignKey':_0x0937('0x185')});db['OpenchannelMessage']['belongsTo'](db['Attachment'],{'as':_0x0937('0xe8'),'foreignKey':'AttachmentId'});db[_0x0937('0x5f')][_0x0937('0x11a')](db[_0x0937('0x5a')],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x184')});db[_0x0937('0x60')][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':'Agents','through':_0x0937('0x12f'),'foreignKey':_0x0937('0x187')});db[_0x0937('0x60')][_0x0937('0x11b')](db['Team'],{'through':'team_has_openchannel_queues','as':_0x0937('0x155')});db['ChatWebsite'][_0x0937('0x110')](db['Disposition'],{'as':_0x0937('0x161'),'foreignKey':_0x0937('0x188')});db[_0x0937('0x62')][_0x0937('0x110')](db[_0x0937('0x80')],{'as':_0x0937('0x163'),'foreignKey':_0x0937('0x188')});db['ChatWebsite'][_0x0937('0x110')](db[_0x0937('0x189')],{'as':_0x0937('0x18a')});db[_0x0937('0x62')][_0x0937('0x110')](db['ChatInteraction'],{'as':_0x0937('0x165')});db['ChatWebsite'][_0x0937('0x110')](db[_0x0937('0x65')],{'as':'Applications'});db['ChatWebsite'][_0x0937('0x110')](db[_0x0937('0x68')],{'as':'Messages'});db[_0x0937('0x62')][_0x0937('0x11a')](db['CmList'],{'as':_0x0937('0x166'),'foreignKey':_0x0937('0x167')});db['ChatWebsite'][_0x0937('0x11a')](db[_0x0937('0x150')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x0937('0x62')][_0x0937('0x11a')](db[_0x0937('0x136')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x0937('0x62')]['belongsTo'](db['Pause'],{'as':_0x0937('0x152'),'foreignKey':_0x0937('0x153')});db[_0x0937('0x62')][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x169'),'through':_0x0937('0x133')});db[_0x0937('0x63')][_0x0937('0x11a')](db[_0x0937('0x5a')],{});db[_0x0937('0x63')]['belongsTo'](db[_0x0937('0x11f')],{'as':'List','foreignKey':'ListId'});db[_0x0937('0x63')][_0x0937('0x11a')](db['CmContact'],{'as':'Contact','foreignKey':_0x0937('0x15e')});db[_0x0937('0x63')][_0x0937('0x11a')](db['OpenchannelInteraction'],{});db[_0x0937('0x63')][_0x0937('0x11a')](db[_0x0937('0x5f')],{});db[_0x0937('0x63')][_0x0937('0x11a')](db[_0x0937('0x14')],{});db[_0x0937('0x63')][_0x0937('0x11a')](db['OpenchannelQueue'],{});db[_0x0937('0x65')][_0x0937('0x11a')](db[_0x0937('0x14')],{'as':_0x0937('0x18b'),'foreignKey':_0x0937('0x10f'),'onDelete':_0x0937('0x173')});db['ChatApplication']['belongsTo'](db[_0x0937('0x129')],{'as':_0x0937('0x18c'),'foreignKey':_0x0937('0x18d'),'onDelete':_0x0937('0x173')});db[_0x0937('0x65')]['belongsTo'](db[_0x0937('0x62')],{'as':_0x0937('0x18e'),'foreignKey':_0x0937('0x188'),'onDelete':_0x0937('0x173')});db[_0x0937('0x65')]['belongsTo'](db[_0x0937('0x8c')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x0937('0x114')]['hasMany'](db[_0x0937('0x68')],{'as':_0x0937('0x164'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x0937('0x114')][_0x0937('0x11a')](db[_0x0937('0x62')],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x188')});db[_0x0937('0x114')][_0x0937('0x11a')](db[_0x0937('0x72')],{'as':_0x0937('0x15d'),'foreignKey':_0x0937('0x15e')});db[_0x0937('0x114')][_0x0937('0x11a')](db['User'],{'as':_0x0937('0x16d'),'foreignKey':'UserId'});db[_0x0937('0x114')][_0x0937('0x11b')](db[_0x0937('0x8c')],{'through':'chat_interaction_has_tags','as':_0x0937('0x17b')});db[_0x0937('0x114')][_0x0937('0x11b')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x0937('0x16f')});db[_0x0937('0x114')][_0x0937('0x11b')](db['User'],{'as':'Users','through':_0x0937('0x18f'),'foreignKey':'ChatInteractionId'});db[_0x0937('0x68')]['belongsTo'](db[_0x0937('0x14')],{'onDelete':_0x0937('0x10e'),'as':'User'});db[_0x0937('0x68')][_0x0937('0x11a')](db[_0x0937('0x72')],{'onDelete':_0x0937('0x10e'),'as':_0x0937('0x15d'),'foreignKey':_0x0937('0x15e')});db[_0x0937('0x68')][_0x0937('0x11a')](db[_0x0937('0x114')],{'onDelete':_0x0937('0x10e'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x0937('0x68')]['belongsTo'](db[_0x0937('0xe8')],{'as':_0x0937('0xe8'),'foreignKey':_0x0937('0x17d')});db['ChatMessage'][_0x0937('0x11a')](db[_0x0937('0x62')],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x188')});db['ChatOfflineMessage'][_0x0937('0x11a')](db['CmContact'],{'onDelete':_0x0937('0x10e'),'as':_0x0937('0x15d'),'foreignKey':_0x0937('0x15e')});db[_0x0937('0x6a')][_0x0937('0x11a')](db[_0x0937('0x62')],{'as':_0x0937('0x16c'),'foreignKey':'ChatWebsiteId'});db[_0x0937('0x129')][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x169'),'through':_0x0937('0x2f'),'hooks':!![]});db['ChatQueue'][_0x0937('0x11b')](db[_0x0937('0xe1')],{'through':_0x0937('0x190'),'as':_0x0937('0x155')});db[_0x0937('0x6d')][_0x0937('0x110')](db[_0x0937('0xcb')],{'as':'Messages','foreignKey':_0x0937('0x191'),'onDelete':_0x0937('0x10e')});db[_0x0937('0x6d')]['belongsToMany'](db[_0x0937('0x14')],{'as':_0x0937('0x146'),'through':'chat_group_has_users'});db[_0x0937('0x189')][_0x0937('0x11a')](db[_0x0937('0x62')],{'as':'Website','foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0937('0x110')](db[_0x0937('0x72')],{'as':_0x0937('0x11d'),'foreignKey':_0x0937('0x192')});db[_0x0937('0x72')]['hasMany'](db[_0x0937('0x74')],{'as':_0x0937('0x148'),'foreignKey':_0x0937('0x15e')});db[_0x0937('0x72')][_0x0937('0x110')](db[_0x0937('0x76')],{'as':_0x0937('0x149'),'foreignKey':_0x0937('0x15e')});db['CmContact'][_0x0937('0x110')](db[_0x0937('0x78')],{'as':_0x0937('0x193'),'foreignKey':_0x0937('0x15e')});db[_0x0937('0x72')][_0x0937('0x110')](db[_0x0937('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0x0937('0x15e')});db[_0x0937('0x72')]['hasMany'](db[_0x0937('0xd0')],{'as':_0x0937('0x14b'),'foreignKey':_0x0937('0x15e')});db[_0x0937('0x72')][_0x0937('0x110')](db[_0x0937('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db['CmContact']['hasMany'](db['ChatInteraction'],{'as':_0x0937('0x115'),'foreignKey':_0x0937('0x15e'),'onDelete':_0x0937('0x173')});db[_0x0937('0x72')][_0x0937('0x110')](db[_0x0937('0x124')],{'as':_0x0937('0x116'),'foreignKey':'ContactId','onDelete':_0x0937('0x173')});db[_0x0937('0x72')][_0x0937('0x110')](db[_0x0937('0x4b')],{'as':'FaxInteractions','foreignKey':_0x0937('0x15e'),'onDelete':_0x0937('0x173')});db[_0x0937('0x72')][_0x0937('0x110')](db[_0x0937('0x3e')],{'as':_0x0937('0x194'),'foreignKey':_0x0937('0x15e'),'onDelete':_0x0937('0x173')});db[_0x0937('0x72')][_0x0937('0x11a')](db[_0x0937('0x70')],{'as':_0x0937('0x195'),'foreignKey':_0x0937('0x192')});db[_0x0937('0x72')]['belongsTo'](db[_0x0937('0x11f')],{'as':'List','foreignKey':_0x0937('0x167'),'onDelete':'cascade'});db[_0x0937('0x72')][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x170'),'through':_0x0937('0x11e')});db[_0x0937('0x72')][_0x0937('0x11b')](db[_0x0937('0x8c')],{'as':_0x0937('0x17b'),'through':_0x0937('0x196')});db['CmContact'][_0x0937('0x11b')](db['Tag'],{'through':_0x0937('0x196'),'as':_0x0937('0x16f')});db[_0x0937('0x74')][_0x0937('0x11a')](db['CmContact'],{'as':'Contact','foreignKey':_0x0937('0x15e'),'onDelete':_0x0937('0x10e')});db[_0x0937('0x74')][_0x0937('0x11a')](db['CmList'],{'as':_0x0937('0x166'),'foreignKey':'ListId','onDelete':_0x0937('0x10e')});db[_0x0937('0x74')][_0x0937('0x11a')](db[_0x0937('0x14')],{'as':'Agent','foreignKey':_0x0937('0x10f')});db[_0x0937('0x74')]['belongsTo'](db['VoiceQueue'],{'as':_0x0937('0x18c'),'foreignKey':_0x0937('0x147'),'onDelete':_0x0937('0x10e')});db[_0x0937('0x74')][_0x0937('0x11a')](db[_0x0937('0xe5')],{'as':'Campaign','foreignKey':_0x0937('0x197'),'onDelete':_0x0937('0x10e')});db[_0x0937('0x74')][_0x0937('0x11a')](db[_0x0937('0x14')],{'as':_0x0937('0x16d'),'foreignKey':_0x0937('0x198')});db[_0x0937('0x75')][_0x0937('0x11a')](db[_0x0937('0x72')],{'as':_0x0937('0x15d'),'foreignKey':_0x0937('0x15e'),'onDelete':_0x0937('0x10e')});db[_0x0937('0x75')]['belongsTo'](db[_0x0937('0x11f')],{'as':_0x0937('0x166'),'foreignKey':_0x0937('0x167'),'onDelete':_0x0937('0x10e')});db['CmHopperBlack'][_0x0937('0x11a')](db[_0x0937('0x1c')],{'as':'Queue','foreignKey':_0x0937('0x147'),'onDelete':_0x0937('0x10e')});db[_0x0937('0x75')][_0x0937('0x11a')](db['Campaign'],{'as':_0x0937('0xe5'),'foreignKey':_0x0937('0x197'),'onDelete':'cascade'});db[_0x0937('0x7e')][_0x0937('0x110')](db[_0x0937('0x199')],{'as':{'plural':_0x0937('0x19a'),'singular':'OneAll'},'foreignKey':_0x0937('0x19b'),'onDelete':_0x0937('0x10e'),'hooks':!![]});db[_0x0937('0x7e')]['hasMany'](db[_0x0937('0x199')],{'as':{'plural':'Any','singular':_0x0937('0x19c')},'foreignKey':_0x0937('0x19d'),'onDelete':_0x0937('0x10e'),'hooks':!![]});db[_0x0937('0x7e')][_0x0937('0x110')](db[_0x0937('0x7d')],{'as':'Actions','foreignKey':_0x0937('0x19e'),'onDelete':_0x0937('0x10e'),'hooks':!![]});db[_0x0937('0x160')][_0x0937('0x110')](db[_0x0937('0x160')],{'as':_0x0937('0x161'),'foreignKey':_0x0937('0x19f'),'onDelete':_0x0937('0x10e')});db[_0x0937('0x150')]['hasMany'](db[_0x0937('0x150')],{'as':_0x0937('0x1a0'),'foreignKey':_0x0937('0x151'),'onDelete':_0x0937('0x10e'),'hooks':!![],'required':![]});db['Interval'][_0x0937('0x110')](db[_0x0937('0x18')],{'as':'Extensions','foreignKey':_0x0937('0x151'),'onDelete':_0x0937('0x173')});db[_0x0937('0x150')][_0x0937('0x110')](db[_0x0937('0x41')],{'as':_0x0937('0x1a1'),'foreignKey':'IntervalId'});db[_0x0937('0x150')][_0x0937('0x110')](db['ChatApplication'],{'as':_0x0937('0x1a2'),'foreignKey':_0x0937('0x151')});db[_0x0937('0x150')][_0x0937('0x110')](db[_0x0937('0x49')],{'as':_0x0937('0x1a3'),'foreignKey':_0x0937('0x151')});db[_0x0937('0x150')][_0x0937('0x110')](db[_0x0937('0x53')],{'as':'SmsApplications','foreignKey':_0x0937('0x151')});db['Schedule'][_0x0937('0x11a')](db[_0x0937('0x136')],{});db['Schedule'][_0x0937('0x11a')](db[_0x0937('0x98')],{'foreignKey':_0x0937('0x1a4')});db['Schedule'][_0x0937('0x11a')](db[_0x0937('0x96')],{'foreignKey':_0x0937('0x1a5')});db[_0x0937('0x143')]['belongsToMany'](db[_0x0937('0x1a')],{'as':_0x0937('0x1a6'),'through':_0x0937('0x145'),'onDelete':_0x0937('0x173')});db['Tag']['belongsToMany'](db[_0x0937('0x72')],{'through':_0x0937('0x196')});db[_0x0937('0x8c')][_0x0937('0x11b')](db[_0x0937('0x114')],{'through':_0x0937('0x1a7')});db['Tag'][_0x0937('0x11b')](db[_0x0937('0x3e')],{'through':_0x0937('0x16e')});db[_0x0937('0x8c')][_0x0937('0x11b')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x0937('0x8c')][_0x0937('0x11b')](db[_0x0937('0x4b')],{'through':_0x0937('0x17a')});db[_0x0937('0x8c')][_0x0937('0x11b')](db[_0x0937('0x5d')],{'through':_0x0937('0x186')});db[_0x0937('0x8c')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x0937('0x1a8')});db[_0x0937('0x90')][_0x0937('0x110')](db[_0x0937('0x199')],{'as':{'plural':_0x0937('0x1a9'),'singular':_0x0937('0x1aa')},'foreignKey':_0x0937('0x1ab'),'onDelete':_0x0937('0x10e'),'hooks':!![]});db[_0x0937('0x90')][_0x0937('0x110')](db[_0x0937('0x199')],{'as':{'plural':_0x0937('0x1ac'),'singular':_0x0937('0x1ad')},'foreignKey':_0x0937('0x1ae'),'onDelete':_0x0937('0x10e'),'hooks':!![]});db[_0x0937('0x90')][_0x0937('0x110')](db['Action'],{'as':_0x0937('0x1af'),'foreignKey':'TriggerId','onDelete':_0x0937('0x10e'),'hooks':!![]});db['AnalyticCustomReport'][_0x0937('0x110')](db[_0x0937('0x1b0')],{'as':_0x0937('0x1b1'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1a5'),'hooks':!![]});db[_0x0937('0x98')][_0x0937('0x110')](db[_0x0937('0x1b0')],{'as':_0x0937('0x1b1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0x0937('0x110')](db[_0x0937('0x1b0')],{'as':_0x0937('0x1b1'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1b2')});db['AnalyticFieldReport'][_0x0937('0x11a')](db[_0x0937('0x9b')],{'foreignKey':'MetricId'});db[_0x0937('0xa0')][_0x0937('0x110')](db[_0x0937('0xa1')],{'as':'Configurations','onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1b3')});db[_0x0937('0xa1')][_0x0937('0x110')](db[_0x0937('0xa2')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x0937('0x1b4')});db[_0x0937('0xa1')][_0x0937('0x110')](db[_0x0937('0xa2')],{'as':_0x0937('0x1b5'),'onDelete':_0x0937('0x10e'),'foreignKey':'DescriptionId'});db[_0x0937('0xa1')][_0x0937('0x110')](db['SalesforceField'],{'as':_0x0937('0x1b1'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1b6')});db[_0x0937('0xa1')][_0x0937('0x11a')](db['SalesforceAccount'],{'as':'Account','foreignKey':_0x0937('0x1b3')});db[_0x0937('0xa2')]['hasMany'](db[_0x0937('0xa2')],{'as':_0x0937('0x1b7'),'foreignKey':_0x0937('0x1b4')});db[_0x0937('0xa2')]['hasMany'](db[_0x0937('0xa2')],{'as':_0x0937('0x1b8'),'foreignKey':'DescriptionId'});db['SalesforceField']['hasMany'](db[_0x0937('0xa2')],{'as':'Field','foreignKey':_0x0937('0x1b6')});db[_0x0937('0xa2')][_0x0937('0x11a')](db['Variable'],{'as':_0x0937('0x92'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x0937('0x110')](db['SugarcrmConfiguration'],{'as':_0x0937('0x1b9'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1b3')});db['SugarcrmConfiguration'][_0x0937('0x110')](db[_0x0937('0x1ba')],{'as':_0x0937('0x1bb'),'onDelete':_0x0937('0x10e'),'foreignKey':'SubjectId'});db[_0x0937('0xa4')][_0x0937('0x110')](db['SugarcrmField'],{'as':_0x0937('0x1b5'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1bc')});db['SugarcrmConfiguration'][_0x0937('0x110')](db[_0x0937('0x1ba')],{'as':_0x0937('0x1b1'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1b6')});db[_0x0937('0xa4')][_0x0937('0x11a')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0x0937('0x1b3')});db[_0x0937('0x1ba')]['hasMany'](db[_0x0937('0x1ba')],{'as':'Subject','foreignKey':_0x0937('0x1b4')});db[_0x0937('0x1ba')][_0x0937('0x110')](db['SugarcrmField'],{'as':_0x0937('0x1b8'),'foreignKey':_0x0937('0x1bc')});db[_0x0937('0x1ba')]['hasMany'](db[_0x0937('0x1ba')],{'as':_0x0937('0x1bd'),'foreignKey':_0x0937('0x1b6')});db['SugarcrmField'][_0x0937('0x11a')](db[_0x0937('0x92')],{'as':_0x0937('0x92'),'foreignKey':_0x0937('0x1be')});db[_0x0937('0xa6')]['hasMany'](db[_0x0937('0xa8')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x0937('0x1b3')});db[_0x0937('0xa8')][_0x0937('0x110')](db[_0x0937('0xa9')],{'as':_0x0937('0x1bb'),'onDelete':_0x0937('0x10e'),'foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db[_0x0937('0xa9')],{'as':'Descriptions','onDelete':_0x0937('0x10e'),'foreignKey':'DescriptionId'});db[_0x0937('0xa8')][_0x0937('0x110')](db[_0x0937('0xa9')],{'as':_0x0937('0x1b1'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1b6')});db['DeskConfiguration'][_0x0937('0x11a')](db[_0x0937('0xa6')],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x1b3')});db[_0x0937('0xa8')][_0x0937('0x11b')](db['Tag'],{'through':_0x0937('0x1bf')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0x0937('0x1b7'),'foreignKey':_0x0937('0x1b4')});db[_0x0937('0xa9')][_0x0937('0x110')](db['DeskField'],{'as':_0x0937('0x1b8'),'foreignKey':'DescriptionId'});db[_0x0937('0xa9')][_0x0937('0x110')](db['DeskField'],{'as':_0x0937('0x1bd'),'foreignKey':_0x0937('0x1b6')});db[_0x0937('0xa9')][_0x0937('0x11a')](db['Variable'],{'as':_0x0937('0x92'),'foreignKey':_0x0937('0x1be')});db[_0x0937('0xab')][_0x0937('0x110')](db[_0x0937('0xac')],{'as':_0x0937('0x1b9'),'onDelete':'cascade','foreignKey':_0x0937('0x1b3')});db[_0x0937('0xac')][_0x0937('0x110')](db[_0x0937('0x1c0')],{'as':_0x0937('0x1bb'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1b4')});db[_0x0937('0xac')]['hasMany'](db[_0x0937('0x1c0')],{'as':_0x0937('0x1b5'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1bc')});db[_0x0937('0xac')][_0x0937('0x110')](db[_0x0937('0x1c0')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x0937('0xac')][_0x0937('0x11a')](db[_0x0937('0xab')],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x1b3')});db[_0x0937('0x1c0')][_0x0937('0x110')](db[_0x0937('0x1c0')],{'as':_0x0937('0x1b7'),'foreignKey':_0x0937('0x1b4')});db['ZohoField'][_0x0937('0x110')](db[_0x0937('0x1c0')],{'as':_0x0937('0x1b8'),'foreignKey':_0x0937('0x1bc')});db[_0x0937('0x1c0')][_0x0937('0x110')](db['ZohoField'],{'as':_0x0937('0x1bd'),'foreignKey':_0x0937('0x1b6')});db[_0x0937('0x1c0')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x0937('0x1be')});db['ZendeskAccount'][_0x0937('0x110')](db[_0x0937('0xb0')],{'as':_0x0937('0x1b9'),'onDelete':'cascade','foreignKey':_0x0937('0x1b3')});db[_0x0937('0xb0')][_0x0937('0x110')](db[_0x0937('0xb2')],{'as':'Subjects','foreignKey':_0x0937('0x1b4')});db[_0x0937('0xb0')][_0x0937('0x110')](db[_0x0937('0xb2')],{'as':_0x0937('0x1b5'),'foreignKey':_0x0937('0x1bc')});db['ZendeskConfiguration'][_0x0937('0x110')](db[_0x0937('0xb2')],{'as':'Fields','foreignKey':_0x0937('0x1b6')});db[_0x0937('0xb0')][_0x0937('0x11a')](db[_0x0937('0x1c1')],{'as':'Account','foreignKey':'AccountId'});db[_0x0937('0xb0')]['belongsToMany'](db[_0x0937('0x8c')],{'through':_0x0937('0x1c2')});db[_0x0937('0xb2')]['hasMany'](db[_0x0937('0xb2')],{'as':_0x0937('0x1b7'),'foreignKey':'SubjectId'});db[_0x0937('0xb2')][_0x0937('0x110')](db[_0x0937('0xb2')],{'as':_0x0937('0x1b8'),'foreignKey':'DescriptionId'});db['ZendeskField']['hasMany'](db[_0x0937('0xb2')],{'as':'Field','foreignKey':_0x0937('0x1b6')});db[_0x0937('0xb2')]['belongsTo'](db[_0x0937('0x92')],{'as':'Variable','foreignKey':_0x0937('0x1be')});db[_0x0937('0xb4')][_0x0937('0x110')](db[_0x0937('0x1c3')],{'as':_0x0937('0x1b9'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1b3')});db[_0x0937('0x1c3')]['hasMany'](db[_0x0937('0x1c4')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0937('0x1c3')][_0x0937('0x110')](db[_0x0937('0x1c4')],{'as':_0x0937('0x1b5'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1bc')});db[_0x0937('0x1c3')][_0x0937('0x110')](db[_0x0937('0x1c4')],{'as':_0x0937('0x1b1'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1b6')});db['FreshdeskConfiguration'][_0x0937('0x11a')](db[_0x0937('0xb4')],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x1b3')});db[_0x0937('0x1c3')][_0x0937('0x11b')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0x0937('0x1c4')][_0x0937('0x110')](db[_0x0937('0x1c4')],{'as':'Subject','foreignKey':_0x0937('0x1b4')});db[_0x0937('0x1c4')]['hasMany'](db[_0x0937('0x1c4')],{'as':_0x0937('0x1b8'),'foreignKey':'DescriptionId'});db[_0x0937('0x1c4')][_0x0937('0x110')](db[_0x0937('0x1c4')],{'as':_0x0937('0x1bd'),'foreignKey':_0x0937('0x1b6')});db['FreshdeskField'][_0x0937('0x11a')](db[_0x0937('0x92')],{'as':_0x0937('0x92'),'foreignKey':'VariableId'});db[_0x0937('0xb6')][_0x0937('0x110')](db['VtigerConfiguration'],{'as':_0x0937('0x1b9'),'onDelete':'cascade','foreignKey':_0x0937('0x1b3')});db[_0x0937('0xb7')]['hasMany'](db['VtigerField'],{'as':_0x0937('0x1bb'),'foreignKey':'SubjectId'});db[_0x0937('0xb7')][_0x0937('0x110')](db[_0x0937('0xb9')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x0937('0xb7')]['hasMany'](db[_0x0937('0xb9')],{'as':_0x0937('0x1b1'),'foreignKey':'FieldId'});db[_0x0937('0xb7')][_0x0937('0x11a')](db[_0x0937('0xb6')],{'as':'Account','foreignKey':'AccountId'});db['VtigerField'][_0x0937('0x110')](db['VtigerField'],{'as':'Subject','foreignKey':_0x0937('0x1b4')});db[_0x0937('0xb9')]['hasMany'](db['VtigerField'],{'as':_0x0937('0x1b8'),'foreignKey':'DescriptionId'});db[_0x0937('0xb9')][_0x0937('0x110')](db[_0x0937('0xb9')],{'as':_0x0937('0x1bd'),'foreignKey':_0x0937('0x1b6')});db[_0x0937('0xb9')][_0x0937('0x11a')](db[_0x0937('0x92')],{'as':_0x0937('0x92'),'foreignKey':_0x0937('0x1be')});db['ServicenowAccount']['hasMany'](db[_0x0937('0xbb')],{'as':_0x0937('0x1b9'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1b3')});db[_0x0937('0xbb')]['hasMany'](db['ServicenowField'],{'as':_0x0937('0x1bb'),'foreignKey':'SubjectId'});db[_0x0937('0xbb')][_0x0937('0x110')](db['ServicenowField'],{'as':_0x0937('0x1b5'),'foreignKey':_0x0937('0x1bc')});db[_0x0937('0xbb')]['hasMany'](db[_0x0937('0x1c5')],{'as':_0x0937('0x1b1'),'foreignKey':_0x0937('0x1b6')});db['ServicenowConfiguration'][_0x0937('0x11a')](db[_0x0937('0x1c6')],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x1b3')});db['ServicenowField']['hasMany'](db[_0x0937('0x1c5')],{'as':_0x0937('0x1b7'),'foreignKey':_0x0937('0x1b4')});db[_0x0937('0x1c5')]['hasMany'](db[_0x0937('0x1c5')],{'as':'Description','foreignKey':_0x0937('0x1bc')});db['ServicenowField'][_0x0937('0x110')](db[_0x0937('0x1c5')],{'as':_0x0937('0x1bd'),'foreignKey':'FieldId'});db[_0x0937('0x1c5')][_0x0937('0x11a')](db[_0x0937('0x92')],{'as':_0x0937('0x92'),'foreignKey':'VariableId'});db[_0x0937('0xbd')][_0x0937('0x110')](db[_0x0937('0xbf')],{'as':_0x0937('0x1b9'),'onDelete':'cascade','foreignKey':_0x0937('0x1b3')});db[_0x0937('0xbf')][_0x0937('0x110')](db[_0x0937('0xc1')],{'as':_0x0937('0x1bb'),'onDelete':'cascade','foreignKey':_0x0937('0x1b4')});db[_0x0937('0xbf')][_0x0937('0x110')](db['Dynamics365Field'],{'as':_0x0937('0x1b5'),'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1bc')});db[_0x0937('0xbf')][_0x0937('0x110')](db[_0x0937('0xc1')],{'as':_0x0937('0x1b1'),'onDelete':'cascade','foreignKey':_0x0937('0x1b6')});db[_0x0937('0xbf')][_0x0937('0x11a')](db['Dynamics365Account'],{'as':'Account','foreignKey':'AccountId'});db[_0x0937('0xc1')][_0x0937('0x110')](db[_0x0937('0xc1')],{'as':_0x0937('0x1b7'),'foreignKey':'SubjectId'});db[_0x0937('0xc1')][_0x0937('0x110')](db[_0x0937('0xc1')],{'as':'Description','foreignKey':_0x0937('0x1bc')});db[_0x0937('0xc1')][_0x0937('0x110')](db['Dynamics365Field'],{'as':_0x0937('0x1bd'),'foreignKey':_0x0937('0x1b6')});db['Dynamics365Field'][_0x0937('0x11a')](db[_0x0937('0x92')],{'as':'Variable','foreignKey':_0x0937('0x1be')});db[_0x0937('0xc3')][_0x0937('0x110')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x0937('0x10e'),'foreignKey':'AccountId'});db[_0x0937('0xc5')][_0x0937('0x110')](db[_0x0937('0xc7')],{'as':_0x0937('0x1bb'),'foreignKey':_0x0937('0x1b4')});db[_0x0937('0xc5')][_0x0937('0x110')](db[_0x0937('0xc7')],{'as':_0x0937('0x1b5'),'foreignKey':'DescriptionId'});db[_0x0937('0xc5')][_0x0937('0x110')](db[_0x0937('0xc7')],{'as':'Fields','foreignKey':_0x0937('0x1b6')});db[_0x0937('0xc5')][_0x0937('0x11a')](db['FreshsalesAccount'],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x1b3')});db[_0x0937('0xc7')][_0x0937('0x110')](db[_0x0937('0xc7')],{'as':_0x0937('0x1b7'),'foreignKey':_0x0937('0x1b4')});db['FreshsalesField'][_0x0937('0x110')](db[_0x0937('0xc7')],{'as':_0x0937('0x1b8'),'foreignKey':_0x0937('0x1bc')});db['FreshsalesField'][_0x0937('0x110')](db['FreshsalesField'],{'as':'Field','foreignKey':_0x0937('0x1b6')});db['FreshsalesField'][_0x0937('0x11a')](db[_0x0937('0x92')],{'as':_0x0937('0x92'),'foreignKey':_0x0937('0x1be')});db[_0x0937('0x1c7')][_0x0937('0x11a')](db['ChatWebsite'],{});db[_0x0937('0x1c7')][_0x0937('0x11a')](db[_0x0937('0x11f')],{'as':_0x0937('0x166'),'foreignKey':_0x0937('0x167')});db[_0x0937('0x1c7')][_0x0937('0x11a')](db[_0x0937('0x72')],{'as':_0x0937('0x15d'),'foreignKey':_0x0937('0x15e')});db[_0x0937('0x1c7')][_0x0937('0x11a')](db['ChatInteraction'],{});db[_0x0937('0x1c7')][_0x0937('0x11a')](db[_0x0937('0x68')],{});db['ChatQueueReport'][_0x0937('0x11a')](db[_0x0937('0x14')],{});db[_0x0937('0x1c7')][_0x0937('0x11a')](db['ChatQueue'],{});db[_0x0937('0xcb')][_0x0937('0x11a')](db['User'],{'onDelete':_0x0937('0x10e'),'foreignKey':'FromId'});db[_0x0937('0xcb')][_0x0937('0x11a')](db[_0x0937('0x14')],{'onDelete':_0x0937('0x10e'),'foreignKey':_0x0937('0x1c8')});db[_0x0937('0xd0')][_0x0937('0x110')](db[_0x0937('0xce')],{'foreignKey':'SessionId','onDelete':_0x0937('0x10e')});db['JscriptySessionReport'][_0x0937('0x110')](db['JscriptyAnswerReport'],{'foreignKey':_0x0937('0x1c9'),'onDelete':'cascade'});db[_0x0937('0xd2')]['belongsTo'](db[_0x0937('0x51')],{});db['SmsQueueReport']['belongsTo'](db[_0x0937('0x11f')],{'as':_0x0937('0x166'),'foreignKey':_0x0937('0x167')});db[_0x0937('0xd2')][_0x0937('0x11a')](db['CmContact'],{'as':'Contact','foreignKey':_0x0937('0x15e')});db[_0x0937('0xd2')][_0x0937('0x11a')](db[_0x0937('0x124')],{});db[_0x0937('0xd2')][_0x0937('0x11a')](db['SmsMessage'],{});db['SmsQueueReport'][_0x0937('0x11a')](db[_0x0937('0x14')],{});db[_0x0937('0xd2')]['belongsTo'](db[_0x0937('0x58')],{});db[_0x0937('0xd7')]['hasMany'](db[_0x0937('0xd0')],{'foreignKey':_0x0937('0x1ca')});db[_0x0937('0xd7')][_0x0937('0x110')](db[_0x0937('0xce')],{'foreignKey':_0x0937('0x1ca')});db['JscriptyProject'][_0x0937('0x110')](db[_0x0937('0x1cb')],{'foreignKey':_0x0937('0x1ca')});db[_0x0937('0x1cc')][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x170'),'through':_0x0937('0x13e')});db[_0x0937('0xe1')][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x169'),'through':_0x0937('0x122')});db[_0x0937('0xe1')][_0x0937('0x11b')](db[_0x0937('0x1c')],{'through':'TeamVoiceQueue','as':_0x0937('0x127')});db[_0x0937('0xe1')]['belongsToMany'](db[_0x0937('0x3b')],{'through':_0x0937('0x16a'),'as':'MailQueues'});db['Team']['belongsToMany'](db[_0x0937('0x129')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x0937('0xe1')][_0x0937('0x11b')](db['FaxQueue'],{'through':_0x0937('0x17e'),'as':'FaxQueues'});db['Team']['belongsToMany'](db[_0x0937('0x58')],{'through':'team_has_sms_queues','as':_0x0937('0x1cd')});db[_0x0937('0xe1')][_0x0937('0x11b')](db['OpenchannelQueue'],{'through':_0x0937('0x1ce'),'as':_0x0937('0x12e')});db['Team'][_0x0937('0x11b')](db['WhatsappQueue'],{'through':_0x0937('0x1cf'),'as':_0x0937('0x130')});db[_0x0937('0xe5')][_0x0937('0x110')](db[_0x0937('0x74')],{'as':_0x0937('0x148'),'foreignKey':_0x0937('0x197')});db[_0x0937('0xe5')][_0x0937('0x110')](db[_0x0937('0x76')],{'as':'HopperFinals','foreignKey':_0x0937('0x197')});db[_0x0937('0xe5')][_0x0937('0x110')](db[_0x0937('0x78')],{'as':_0x0937('0x193'),'foreignKey':'CampaignId'});db[_0x0937('0xe5')][_0x0937('0x110')](db['CmHopperBlack'],{'as':_0x0937('0x14a'),'foreignKey':'CampaignId'});db[_0x0937('0xe5')]['belongsTo'](db[_0x0937('0x14c')],{'as':_0x0937('0x14c'),'foreignKey':_0x0937('0x14d')});db[_0x0937('0xe5')][_0x0937('0x11a')](db[_0x0937('0x14c')],{'as':_0x0937('0x14e'),'foreignKey':'TrunkBackupId'});db['Campaign']['belongsTo'](db[_0x0937('0x150')],{'as':_0x0937('0x150'),'foreignKey':_0x0937('0x151')});db[_0x0937('0xe5')][_0x0937('0x11a')](db['SquareProject'],{'as':_0x0937('0x1cc'),'foreignKey':'SquareProjectId'});db['Campaign']['belongsToMany'](db['CmList'],{'as':_0x0937('0x120'),'through':_0x0937('0x1d0')});db[_0x0937('0xe5')][_0x0937('0x11b')](db[_0x0937('0x11f')],{'as':_0x0937('0x1d1'),'through':_0x0937('0x1d2')});db[_0x0937('0x1d3')][_0x0937('0x11a')](db[_0x0937('0x3f')],{});db[_0x0937('0x1d3')]['belongsTo'](db[_0x0937('0x3e')],{});db[_0x0937('0x1d3')][_0x0937('0x11a')](db[_0x0937('0x136')],{'foreignKey':_0x0937('0x1d4'),'as':_0x0937('0x1d5')});db[_0x0937('0x1d3')][_0x0937('0x11a')](db[_0x0937('0x14')],{'foreignKey':_0x0937('0x1d6'),'as':_0x0937('0x1d7')});db['MailTransferReport']['belongsTo'](db[_0x0937('0x14')],{'foreignKey':_0x0937('0x1d8'),'as':_0x0937('0x1d9')});db[_0x0937('0x1d3')][_0x0937('0x11a')](db[_0x0937('0x3b')],{'foreignKey':'ToMailQueueId','as':_0x0937('0x1da')});db[_0x0937('0x1d3')][_0x0937('0x11a')](db[_0x0937('0x136')],{'foreignKey':_0x0937('0x1db'),'as':_0x0937('0x1dc')});db[_0x0937('0xed')][_0x0937('0x11a')](db[_0x0937('0x68')],{});db['ChatTransferReport'][_0x0937('0x11a')](db['ChatInteraction'],{});db[_0x0937('0xed')][_0x0937('0x11a')](db[_0x0937('0x62')],{'foreignKey':_0x0937('0x1dd'),'as':'FromAccount'});db[_0x0937('0xed')][_0x0937('0x11a')](db[_0x0937('0x14')],{'foreignKey':_0x0937('0x1d6'),'as':_0x0937('0x1d7')});db[_0x0937('0xed')][_0x0937('0x11a')](db[_0x0937('0x14')],{'foreignKey':_0x0937('0x1d8'),'as':_0x0937('0x1d9')});db[_0x0937('0xed')][_0x0937('0x11a')](db[_0x0937('0x129')],{'foreignKey':_0x0937('0x1de'),'as':'ToQueue'});db['ChatTransferReport'][_0x0937('0x11a')](db[_0x0937('0x62')],{'foreignKey':_0x0937('0x1df'),'as':_0x0937('0x1dc')});db['FaxTransferReport'][_0x0937('0x11a')](db[_0x0937('0x4d')],{});db['FaxTransferReport'][_0x0937('0x11a')](db[_0x0937('0x4b')],{});db[_0x0937('0xef')]['belongsTo'](db[_0x0937('0x48')],{'foreignKey':_0x0937('0x1e0'),'as':_0x0937('0x1d5')});db[_0x0937('0xef')][_0x0937('0x11a')](db[_0x0937('0x14')],{'foreignKey':_0x0937('0x1d6'),'as':_0x0937('0x1d7')});db[_0x0937('0xef')][_0x0937('0x11a')](db[_0x0937('0x14')],{'foreignKey':'ToUserId','as':_0x0937('0x1d9')});db[_0x0937('0xef')][_0x0937('0x11a')](db[_0x0937('0x12b')],{'foreignKey':'ToFaxQueueId','as':_0x0937('0x1da')});db[_0x0937('0xef')][_0x0937('0x11a')](db['FaxAccount'],{'foreignKey':_0x0937('0x1e1'),'as':'ToAccount'});db[_0x0937('0xf0')][_0x0937('0x11a')](db[_0x0937('0x5f')],{});db[_0x0937('0xf0')]['belongsTo'](db[_0x0937('0x5d')],{});db[_0x0937('0xf0')]['belongsTo'](db[_0x0937('0x5a')],{'foreignKey':'FromOpenchannelAccountId','as':_0x0937('0x1d5')});db['OpenchannelTransferReport'][_0x0937('0x11a')](db['User'],{'foreignKey':_0x0937('0x1d6'),'as':_0x0937('0x1d7')});db[_0x0937('0xf0')][_0x0937('0x11a')](db[_0x0937('0x14')],{'foreignKey':_0x0937('0x1d8'),'as':_0x0937('0x1d9')});db[_0x0937('0xf0')][_0x0937('0x11a')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x0937('0x1da')});db[_0x0937('0xf0')][_0x0937('0x11a')](db[_0x0937('0x5a')],{'foreignKey':'ToOpenchannelAccountId','as':_0x0937('0x1dc')});db[_0x0937('0xf2')][_0x0937('0x11a')](db[_0x0937('0x56')],{});db['SmsTransferReport'][_0x0937('0x11a')](db[_0x0937('0x124')],{});db[_0x0937('0xf2')][_0x0937('0x11a')](db[_0x0937('0x51')],{'foreignKey':_0x0937('0x1e2'),'as':_0x0937('0x1d5')});db[_0x0937('0xf2')][_0x0937('0x11a')](db[_0x0937('0x14')],{'foreignKey':_0x0937('0x1d6'),'as':'FromAgent'});db[_0x0937('0xf2')][_0x0937('0x11a')](db[_0x0937('0x14')],{'foreignKey':'ToUserId','as':_0x0937('0x1d9')});db[_0x0937('0xf2')]['belongsTo'](db[_0x0937('0x58')],{'foreignKey':_0x0937('0x1e3'),'as':_0x0937('0x1da')});db['SmsTransferReport'][_0x0937('0x11a')](db[_0x0937('0x51')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList'][_0x0937('0x110')](db[_0x0937('0x160')],{'as':_0x0937('0x161'),'foreignKey':_0x0937('0x167')});db[_0x0937('0x11f')][_0x0937('0x110')](db[_0x0937('0x7b')],{'as':_0x0937('0x1e4'),'foreignKey':_0x0937('0x167')});db[_0x0937('0x11f')][_0x0937('0x110')](db[_0x0937('0x72')],{'as':_0x0937('0x11d'),'onDelete':_0x0937('0x10e'),'foreignKey':'ListId'});db[_0x0937('0x11f')][_0x0937('0x110')](db['CmHopperFinal'],{'as':_0x0937('0x149'),'foreignKey':'ListId'});db[_0x0937('0x11f')][_0x0937('0x110')](db[_0x0937('0x78')],{'as':'HopperHistory','foreignKey':_0x0937('0x167')});db[_0x0937('0x11f')][_0x0937('0x110')](db[_0x0937('0x7a')],{'as':_0x0937('0x7a'),'foreignKey':_0x0937('0x167')});db[_0x0937('0x11f')][_0x0937('0x11b')](db[_0x0937('0x1c')],{'as':_0x0937('0x1e5'),'through':_0x0937('0x154')});db['CmList']['belongsToMany'](db[_0x0937('0x14')],{'as':_0x0937('0x169'),'through':_0x0937('0x121')});db[_0x0937('0xf4')][_0x0937('0x110')](db[_0x0937('0x18')],{'as':_0x0937('0x1e6'),'onDelete':_0x0937('0x10e')});db['VoicePrefix'][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x169'),'through':'user_has_voice_prefixes'});db[_0x0937('0xf6')][_0x0937('0x110')](db['User'],{'as':_0x0937('0x170'),'foreignKey':'userProfileId'});db[_0x0937('0xf6')][_0x0937('0x110')](db[_0x0937('0xf8')],{'as':_0x0937('0x1e7'),'foreignKey':_0x0937('0x1e8'),'onDelete':_0x0937('0x10e')});db[_0x0937('0xf8')][_0x0937('0x110')](db[_0x0937('0xfa')],{'as':'Resources','foreignKey':_0x0937('0x1e9'),'onDelete':_0x0937('0x10e')});db[_0x0937('0xfd')]['hasMany'](db[_0x0937('0x160')],{'as':'Dispositions','foreignKey':'WhatsappAccountId'});db[_0x0937('0xfd')][_0x0937('0x110')](db['CannedAnswer'],{'as':_0x0937('0x163'),'foreignKey':'WhatsappAccountId'});db[_0x0937('0xfd')][_0x0937('0x110')](db[_0x0937('0x103')],{'as':_0x0937('0x164'),'foreignKey':_0x0937('0x1ea')});db[_0x0937('0xfd')][_0x0937('0x110')](db[_0x0937('0x101')],{'as':_0x0937('0x165')});db[_0x0937('0xfd')]['hasMany'](db['WhatsappApplication'],{'as':_0x0937('0x142')});db[_0x0937('0xfd')][_0x0937('0x11a')](db[_0x0937('0x11f')],{'as':_0x0937('0x166'),'foreignKey':_0x0937('0x167')});db[_0x0937('0xfd')][_0x0937('0x11a')](db[_0x0937('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0x0937('0x153')});db['WhatsappAccount'][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x169'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x0937('0x11a')](db[_0x0937('0x14')],{'onDelete':_0x0937('0x173')});db[_0x0937('0xff')][_0x0937('0x11a')](db[_0x0937('0x108')],{'onDelete':_0x0937('0x173')});db[_0x0937('0xff')][_0x0937('0x11a')](db['WhatsappAccount'],{'onDelete':'restrict'});db['WhatsappApplication'][_0x0937('0x11a')](db['Interval'],{'onDelete':_0x0937('0x173'),'foreignKey':_0x0937('0x151')});db['WhatsappApplication']['belongsTo'](db[_0x0937('0x8c')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x0937('0x101')][_0x0937('0x110')](db[_0x0937('0x103')],{'as':_0x0937('0x164'),'onDelete':_0x0937('0x10e'),'foreignKey':'WhatsappInteractionId'});db[_0x0937('0x101')][_0x0937('0x11a')](db['WhatsappAccount'],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x1ea')});db[_0x0937('0x101')][_0x0937('0x11a')](db[_0x0937('0x72')],{'as':_0x0937('0x15d'),'foreignKey':_0x0937('0x15e')});db[_0x0937('0x101')][_0x0937('0x11a')](db[_0x0937('0x14')],{'as':_0x0937('0x16d'),'foreignKey':_0x0937('0x10f')});db[_0x0937('0x101')][_0x0937('0x11b')](db['Tag'],{'through':_0x0937('0x1a8'),'as':_0x0937('0x17b')});db[_0x0937('0x101')]['belongsToMany'](db['Tag'],{'through':_0x0937('0x1a8'),'as':_0x0937('0x16f')});db['WhatsappInteraction'][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x170'),'through':'user_has_whatsapp_interactions','foreignKey':_0x0937('0x1eb')});db['WhatsappMessage'][_0x0937('0x11a')](db['User'],{'as':_0x0937('0x14')});db[_0x0937('0x103')][_0x0937('0x11a')](db[_0x0937('0x72')],{'onDelete':_0x0937('0x10e'),'as':_0x0937('0x15d')});db[_0x0937('0x103')][_0x0937('0x11a')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0937('0x17c'),'foreignKey':_0x0937('0x1eb')});db[_0x0937('0x103')][_0x0937('0x11a')](db[_0x0937('0xfd')],{'as':_0x0937('0x16c'),'foreignKey':_0x0937('0x1ea')});db[_0x0937('0x1ec')][_0x0937('0x11a')](db[_0x0937('0xfd')],{});db[_0x0937('0x1ec')][_0x0937('0x11a')](db[_0x0937('0x11f')],{'as':_0x0937('0x166'),'foreignKey':_0x0937('0x167')});db[_0x0937('0x1ec')]['belongsTo'](db['CmContact'],{'as':_0x0937('0x15d'),'foreignKey':'ContactId'});db['WhatsappQueueReport'][_0x0937('0x11a')](db[_0x0937('0x101')],{});db[_0x0937('0x1ec')][_0x0937('0x11a')](db[_0x0937('0x108')],{});db[_0x0937('0x1ec')][_0x0937('0x11a')](db['WhatsappMessage'],{});db[_0x0937('0x1ec')][_0x0937('0x11a')](db[_0x0937('0x14')],{});db[_0x0937('0x106')][_0x0937('0x11a')](db['WhatsappMessage'],{});db[_0x0937('0x106')][_0x0937('0x11a')](db[_0x0937('0x101')],{});db[_0x0937('0x106')][_0x0937('0x11a')](db['WhatsappAccount'],{'foreignKey':_0x0937('0x1ed'),'as':'FromAccount'});db['WhatsappTransferReport'][_0x0937('0x11a')](db[_0x0937('0xfd')],{'foreignKey':_0x0937('0x1ee'),'as':_0x0937('0x1dc')});db['WhatsappTransferReport'][_0x0937('0x11a')](db['WhatsappQueue'],{'foreignKey':_0x0937('0x1ef'),'as':_0x0937('0x1da')});db[_0x0937('0x106')][_0x0937('0x11a')](db[_0x0937('0x14')],{'foreignKey':_0x0937('0x1d6'),'as':_0x0937('0x1d7')});db[_0x0937('0x106')][_0x0937('0x11a')](db['User'],{'foreignKey':_0x0937('0x1d8'),'as':_0x0937('0x1d9')});db[_0x0937('0x108')][_0x0937('0x11b')](db[_0x0937('0x14')],{'as':_0x0937('0x169'),'through':_0x0937('0x36'),'foreignKey':_0x0937('0x1f0')});db[_0x0937('0x108')][_0x0937('0x11b')](db[_0x0937('0xe1')],{'through':_0x0937('0x1cf'),'as':_0x0937('0x155')});module[_0x0937('0x1f1')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x9876=['../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','cascade','HopperFinals','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','MailQueues','ChatQueues','FaxQueue','FaxQueues','OpenchannelQueues','WhatsappQueue','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','Sounds','VoiceQueue','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','MailServerOut','Smtp','Dispositions','Answers','MailApplication','Applications','List','ListId','TemplateId','mandatoryDispositionPause','MailMessage','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','Items','Interactions','Exntensions','FaxMessage','FaxInteractionId','FaxAccountId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatMessage','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Contacts','CompanyId','ChatInteractions','Company','cm_contact_has_tags','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyCondition','Actions','TriggerId','Fields','MetricId','SalesforceConfiguration','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','AccountId','Description','Field','FieldId','Variable','VariableId','SugarcrmConfiguration','Subject','ZohoAccount','ZohoField','FreshdeskAccount','FreshdeskConfiguration','ServicenowField','Dynamics365Account','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','JscriptyProject','VoiceQueues','team_has_mail_queues','team_has_chat_queues','SmsQueues','team_has_whatsapp_queues','WhatsappQueues','TrunkBackup','Lists','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','HopperHistory','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_interactions','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','name','utf8_general_ci','sequelizeHistory','xcall','mysql','database','password','options','username','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','Interval','../api/interval/interval.model','Pause','Cdr','VoiceQueuesLog','Schedule','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport'];(function(_0x34b6e0,_0x229982){var _0x518f9b=function(_0x49064b){while(--_0x49064b){_0x34b6e0['push'](_0x34b6e0['shift']());}};_0x518f9b(++_0x229982);}(_0x9876,0x159));var _0x6987=function(_0x512661,_0xaea976){_0x512661=_0x512661-0x0;var _0x3803e3=_0x9876[_0x512661];return _0x3803e3;};'use strict';var path=require(_0x6987('0x0'));var config=require(_0x6987('0x1'));var Sequelize=require(_0x6987('0x2'));var _=require(_0x6987('0x3'));var jstz=require(_0x6987('0x4'));var timezone=jstz[_0x6987('0x5')]();config[_0x6987('0x2')]=_[_0x6987('0x6')](config[_0x6987('0x2')],{'database':_0x6987('0x7'),'username':'xcall','password':_0x6987('0x8'),'options':{'host':_0x6987('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x6987('0xa')](),'define':{'charset':'utf8','collate':_0x6987('0xb')}}});config[_0x6987('0xc')]=_[_0x6987('0x6')](config[_0x6987('0xc')],{'database':_0x6987('0x7'),'username':_0x6987('0xd'),'password':_0x6987('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x6987('0xe'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x6987('0xa')](),'define':{'charset':'utf8','collate':_0x6987('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x6987('0xf')],config[_0x6987('0x2')]['username'],config[_0x6987('0x2')][_0x6987('0x10')],config[_0x6987('0x2')][_0x6987('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6987('0xc')]['database'],config[_0x6987('0xc')][_0x6987('0x12')],config[_0x6987('0xc')]['password'],config[_0x6987('0xc')][_0x6987('0x11')])};db[_0x6987('0x13')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x15'));db['VoiceChanSpy']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x16'));db[_0x6987('0x17')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x18'));db['VoiceExtension']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x19'));db[_0x6987('0x1a')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x1b'));db['VoiceQueue']=db[_0x6987('0x2')][_0x6987('0x14')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db['sequelize']['import'](_0x6987('0x1c'));db[_0x6987('0x1d')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x1e'));db[_0x6987('0x1f')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x20'));db[_0x6987('0x21')]=db[_0x6987('0x2')]['import'](_0x6987('0x22'));db['VoiceCallReport']=db[_0x6987('0x2')]['import'](_0x6987('0x23'));db[_0x6987('0x24')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x25'));db[_0x6987('0x26')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x27'));db[_0x6987('0x28')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x29'));db[_0x6987('0x2a')]=db[_0x6987('0x2')]['import'](_0x6987('0x2b'));db[_0x6987('0x2c')]=db['sequelize']['import'](_0x6987('0x2d'));db['VoiceTransferReport']=db[_0x6987('0x2')]['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0x6987('0x2e')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x6987('0x2f')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x30'));db[_0x6987('0x31')]=db[_0x6987('0x2')]['import'](_0x6987('0x32'));db[_0x6987('0x33')]=db[_0x6987('0x2')]['import'](_0x6987('0x34'));db[_0x6987('0x35')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x36'));db[_0x6987('0x37')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x38'));db[_0x6987('0x39')]=db['sequelize']['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x6987('0x3a')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x3b'));db[_0x6987('0x3c')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x3d'));db['MailServerOut']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x3e'));db['MailAccount']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x3f'));db[_0x6987('0x40')]=db[_0x6987('0x2')]['import'](_0x6987('0x41'));db[_0x6987('0x42')]=db[_0x6987('0x2')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x6987('0x43')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x44'));db['MailMessage']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x45'));db['MailApplication']=db['sequelize'][_0x6987('0x14')]('../api/mailApplication/mailApplication.model');db[_0x6987('0x46')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x47'));db[_0x6987('0x48')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x49'));db[_0x6987('0x4a')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x4b'));db['FaxAccount']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x4c'));db[_0x6987('0x4d')]=db['sequelize']['import'](_0x6987('0x4e'));db[_0x6987('0x4f')]=db[_0x6987('0x2')]['import']('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x50'));db['FaxQueue']=db[_0x6987('0x2')][_0x6987('0x14')]('../api/faxQueue/faxQueue.model');db[_0x6987('0x51')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x52'));db[_0x6987('0x53')]=db[_0x6987('0x2')]['import'](_0x6987('0x54'));db[_0x6987('0x55')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/smsApplication/smsApplication.model');db[_0x6987('0x56')]=db[_0x6987('0x2')]['import']('../api/smsInteraction/smsInteraction.model');db[_0x6987('0x57')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x58'));db[_0x6987('0x59')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x5a'));db[_0x6987('0x5b')]=db[_0x6987('0x2')]['import'](_0x6987('0x5c'));db[_0x6987('0x5d')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x5e'));db[_0x6987('0x5f')]=db[_0x6987('0x2')]['import'](_0x6987('0x60'));db['OpenchannelMessage']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x61'));db[_0x6987('0x62')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x63'));db[_0x6987('0x64')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x65'));db[_0x6987('0x66')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x6987('0x67')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x68'));db[_0x6987('0x69')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x6a'));db['ChatMessage']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x6b'));db[_0x6987('0x6c')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x6d'));db[_0x6987('0x6e')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/chatQueue/chatQueue.model');db[_0x6987('0x6f')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x70'));db[_0x6987('0x71')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x72'));db[_0x6987('0x73')]=db[_0x6987('0x2')]['import']('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x74'));db[_0x6987('0x75')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/cmHopper/cmHopper.model');db[_0x6987('0x76')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x6987('0x77')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x78'));db[_0x6987('0x79')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x7a'));db[_0x6987('0x7b')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x7c'));db[_0x6987('0x7d')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x7e'));db[_0x6987('0x7f')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x80'));db[_0x6987('0x81')]=db['sequelize'][_0x6987('0x14')]('../api/automation/automation.model');db[_0x6987('0x82')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x83'));db[_0x6987('0x84')]=db[_0x6987('0x2')]['import']('../api/disposition/disposition.model');db[_0x6987('0x85')]=db[_0x6987('0x2')]['import']('../api/condition/condition.model');db[_0x6987('0x86')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x87'));db[_0x6987('0x88')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/pause/pause.model');db[_0x6987('0x89')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/cdr/cdr.model');db[_0x6987('0x8a')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x6987('0x8b')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/schedule/schedule.model');db[_0x6987('0x8c')]=db[_0x6987('0x2')]['import']('../api/sound/sound.model');db[_0x6987('0x8d')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x8e'));db[_0x6987('0x8f')]=db[_0x6987('0x2')]['import'](_0x6987('0x90'));db[_0x6987('0x91')]=db['sequelize'][_0x6987('0x14')]('../api/trigger/trigger.model');db['Variable']=db[_0x6987('0x2')]['import'](_0x6987('0x92'));db[_0x6987('0x93')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x94'));db[_0x6987('0x95')]=db[_0x6987('0x2')]['import'](_0x6987('0x96'));db[_0x6987('0x97')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x98'));db[_0x6987('0x99')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x9a'));db[_0x6987('0x9b')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x9c'));db[_0x6987('0x9d')]=db[_0x6987('0x2')]['import'](_0x6987('0x9e'));db[_0x6987('0x9f')]=db[_0x6987('0x2')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x6987('0xa0')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x6987('0xa1')]=db['sequelize'][_0x6987('0x14')](_0x6987('0xa2'));db['SalesforceConfiguration']=db['sequelize']['import'](_0x6987('0xa3'));db[_0x6987('0xa4')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0x6987('0xa5')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xa6'));db['SugarcrmConfiguration']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xa7'));db[_0x6987('0xa8')]=db[_0x6987('0x2')]['import'](_0x6987('0xa9'));db[_0x6987('0xaa')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xab'));db[_0x6987('0xac')]=db['sequelize'][_0x6987('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x6987('0xad')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xae'));db['ZohoAccount']=db[_0x6987('0x2')][_0x6987('0x14')]('../api/intZohoAccount/intZohoAccount.model');db[_0x6987('0xaf')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xb0'));db['ZohoField']=db[_0x6987('0x2')][_0x6987('0x14')]('../api/intZohoField/intZohoField.model');db[_0x6987('0xb1')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xb2'));db[_0x6987('0xb3')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xb4'));db[_0x6987('0xb5')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xb6'));db['FreshdeskAccount']=db['sequelize'][_0x6987('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xb7'));db[_0x6987('0xb8')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xb9'));db[_0x6987('0xba')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xbb'));db[_0x6987('0xbc')]=db['sequelize']['import'](_0x6987('0xbd'));db[_0x6987('0xbe')]=db['sequelize'][_0x6987('0x14')](_0x6987('0xbf'));db[_0x6987('0xc0')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xc1'));db[_0x6987('0xc2')]=db[_0x6987('0x2')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db['sequelize'][_0x6987('0x14')](_0x6987('0xc3'));db['Dynamics365Account']=db['sequelize'][_0x6987('0x14')](_0x6987('0xc4'));db[_0x6987('0xc5')]=db[_0x6987('0x2')]['import'](_0x6987('0xc6'));db[_0x6987('0xc7')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xc8'));db[_0x6987('0xc9')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xca'));db[_0x6987('0xcb')]=db['sequelize'][_0x6987('0x14')](_0x6987('0xcc'));db['FreshsalesField']=db['sequelize'][_0x6987('0x14')](_0x6987('0xcd'));db[_0x6987('0x93')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x94'));db[_0x6987('0xce')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xcf'));db[_0x6987('0xd0')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0x6987('0xd1')]=db['sequelize'][_0x6987('0x14')](_0x6987('0xd2'));db[_0x6987('0xd3')]=db[_0x6987('0x2')]['import'](_0x6987('0xd4'));db['JscriptyQuestionReport']=db['sequelize'][_0x6987('0x14')](_0x6987('0xd5'));db[_0x6987('0xd6')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xd7'));db['SmsQueueReport']=db['sequelize'][_0x6987('0x14')](_0x6987('0xd8'));db[_0x6987('0xd9')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/squareReport/squareReport.model');db[_0x6987('0xda')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db['sequelize'][_0x6987('0x14')](_0x6987('0xdb'));db[_0x6987('0xdc')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/setting/setting.model');db['SquareOdbc']=db['sequelize'][_0x6987('0x14')](_0x6987('0xdd'));db[_0x6987('0xde')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xdf'));db['SquareRecording']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xe0'));db[_0x6987('0xe1')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xe2'));db[_0x6987('0xe3')]=db['sequelize'][_0x6987('0x14')](_0x6987('0xe4'));db[_0x6987('0xe5')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/license/license.model');db[_0x6987('0xe6')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xe7'));db['Migration']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xe8'));db['Attachment']=db[_0x6987('0x2')]['import'](_0x6987('0xe9'));db['Plugin']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xea'));db['MailTransferReport']=db['sequelize'][_0x6987('0x14')](_0x6987('0xeb'));db['ChatTransferReport']=db[_0x6987('0x2')]['import']('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xec'));db[_0x6987('0xed')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xee'));db['SmsTransferReport']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xef'));db[_0x6987('0xf0')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xf1'));db['VoicePrefix']=db[_0x6987('0x2')]['import'](_0x6987('0xf2'));db[_0x6987('0xf3')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/userProfile/userProfile.model');db[_0x6987('0xf4')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xf5'));db['UserProfileResource']=db['sequelize'][_0x6987('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x6987('0xf6')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xf7'));db[_0x6987('0xf8')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0x6987('0xf9')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xfa'));db[_0x6987('0xfb')]=db['sequelize']['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x6987('0xfc')]=db['sequelize'][_0x6987('0x14')](_0x6987('0xfd'));db[_0x6987('0xfe')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xff'));db['WhatsappQueue']=db['sequelize'][_0x6987('0x14')](_0x6987('0x100'));db[_0x6987('0x101')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/cloudProvider/cloudProvider.model');db[_0x6987('0x102')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x103'));db[_0x6987('0x13')][_0x6987('0x104')](db['VoiceMail'],{'as':_0x6987('0x1f'),'onDelete':'cascade','foreignKey':_0x6987('0x105')});db['User'][_0x6987('0x106')](db[_0x6987('0x107')],{'as':_0x6987('0x108'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x2e')],{'as':_0x6987('0x109'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x10a')],{'as':_0x6987('0x10b'),'onDelete':_0x6987('0x10c'),'hooks':!![]});db[_0x6987('0x13')]['hasMany'](db['CmHopperFinal'],{'as':_0x6987('0x10d'),'foreignKey':'UserId'});db['User'][_0x6987('0x106')](db[_0x6987('0x79')],{'as':'HopperHistory','foreignKey':_0x6987('0x105')});db['User'][_0x6987('0x106')](db[_0x6987('0x7b')],{'as':_0x6987('0x7b'),'foreignKey':'UserId'});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x5f')],{'as':_0x6987('0x10e'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x69')],{'as':'ChatInteractions','foreignKey':_0x6987('0x105')});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x56')],{'as':_0x6987('0x10f'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x4f')],{'as':_0x6987('0x110'),'foreignKey':_0x6987('0x105')});db['User'][_0x6987('0x106')](db['MailInteraction'],{'as':_0x6987('0x111'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x112')],{'as':_0x6987('0x113'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x13')]['hasMany'](db[_0x6987('0xf6')],{'as':_0x6987('0x114'),'foreignKey':_0x6987('0x115')});db[_0x6987('0x13')][_0x6987('0x116')](db['UserProfile'],{'as':_0x6987('0xf3'),'foreignKey':_0x6987('0x117')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x6f')],{'as':_0x6987('0x119'),'through':_0x6987('0x11a')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x11b')],{'as':'Contacts','through':_0x6987('0x11c')});db[_0x6987('0x13')][_0x6987('0x118')](db['CmList'],{'as':'Lists','through':_0x6987('0x11d')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0xe3')],{'through':_0x6987('0x11e')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x43')],{'as':_0x6987('0x111'),'through':_0x6987('0x11f')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x69')],{'as':'ChatInteractions','through':_0x6987('0x120')});db[_0x6987('0x13')]['belongsToMany'](db['FaxInteraction'],{'as':_0x6987('0x110'),'through':_0x6987('0x121')});db[_0x6987('0x13')]['belongsToMany'](db[_0x6987('0x56')],{'as':_0x6987('0x10f'),'through':_0x6987('0x122')});db['User']['belongsToMany'](db[_0x6987('0x5f')],{'as':_0x6987('0x10e'),'through':'user_has_openchannel_interactions'});db['User'][_0x6987('0x118')](db[_0x6987('0x112')],{'as':_0x6987('0x113'),'through':'user_has_whatsapp_interactions'});db[_0x6987('0x13')]['belongsToMany'](db['VoiceQueue'],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0x6987('0x13')][_0x6987('0x118')](db['MailQueue'],{'as':_0x6987('0x123'),'through':_0x6987('0x33'),'required':![]});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x6e')],{'as':_0x6987('0x124'),'through':_0x6987('0x31'),'required':![],'hooks':!![]});db[_0x6987('0x13')]['belongsToMany'](db[_0x6987('0x125')],{'as':_0x6987('0x126'),'through':'UserFaxQueue','required':![]});db[_0x6987('0x13')][_0x6987('0x118')](db['SmsQueue'],{'as':'SmsQueues','through':_0x6987('0x37'),'required':![]});db['User'][_0x6987('0x118')](db[_0x6987('0x62')],{'as':_0x6987('0x127'),'through':_0x6987('0x39'),'required':![]});db[_0x6987('0x13')]['belongsToMany'](db[_0x6987('0x128')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0xf0')],{'through':_0x6987('0x11d')});db['User'][_0x6987('0x118')](db[_0x6987('0x129')],{'as':_0x6987('0x12a'),'through':_0x6987('0x12b'),'required':![]});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x64')],{'as':_0x6987('0x12c'),'through':_0x6987('0x12d')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x12e')],{'as':'FaxAccounts','through':_0x6987('0x12f')});db[_0x6987('0x13')]['belongsToMany'](db[_0x6987('0x130')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x5b')],{'as':_0x6987('0x131'),'through':_0x6987('0x132')});db['User'][_0x6987('0x118')](db[_0x6987('0x53')],{'as':_0x6987('0x133'),'through':'user_has_sms_accounts'});db[_0x6987('0x13')]['belongsToMany'](db[_0x6987('0xf8')],{'as':'WhatsappAccounts','through':_0x6987('0x134')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0xde')],{'as':_0x6987('0x135'),'through':_0x6987('0x136')});db[_0x6987('0x137')][_0x6987('0x106')](db[_0x6987('0x10a')],{'as':_0x6987('0x138'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x6987('0x17')][_0x6987('0x106')](db[_0x6987('0x10a')],{'onDelete':_0x6987('0x10c')});db[_0x6987('0x10a')][_0x6987('0x106')](db['VoiceExtension'],{'as':'Applications','onDelete':_0x6987('0x10c')});db['VoiceMusicOnHold'][_0x6987('0x118')](db['Sound'],{'as':_0x6987('0x139'),'through':'moh_has_sounds'});db[_0x6987('0x13a')][_0x6987('0x106')](db[_0x6987('0x2e')],{'as':_0x6987('0x13b'),'foreignKey':_0x6987('0x13c')});db[_0x6987('0x13a')][_0x6987('0x106')](db[_0x6987('0x75')],{'as':_0x6987('0x13d'),'foreignKey':_0x6987('0x13c')});db[_0x6987('0x13a')][_0x6987('0x106')](db['CmHopperFinal'],{'as':_0x6987('0x10d'),'foreignKey':_0x6987('0x13c')});db[_0x6987('0x13a')][_0x6987('0x106')](db['CmHopperHistory'],{'as':_0x6987('0x13e'),'foreignKey':'VoiceQueueId'});db[_0x6987('0x13a')][_0x6987('0x106')](db[_0x6987('0x7b')],{'as':_0x6987('0x7b'),'foreignKey':_0x6987('0x13c')});db[_0x6987('0x13a')]['hasMany'](db['CmHopperBlack'],{'as':_0x6987('0x13f'),'foreignKey':_0x6987('0x13c')});db['VoiceQueue']['hasMany'](db[_0x6987('0xd6')],{'as':_0x6987('0x140'),'foreignKey':_0x6987('0x13c')});db['VoiceQueue'][_0x6987('0x116')](db[_0x6987('0x2c')],{'as':'Trunk','foreignKey':_0x6987('0x141')});db[_0x6987('0x13a')][_0x6987('0x116')](db[_0x6987('0x2c')],{'as':'TrunkBackup','foreignKey':_0x6987('0x142')});db[_0x6987('0x13a')][_0x6987('0x116')](db[_0x6987('0x86')],{'as':'Interval','foreignKey':_0x6987('0x143')});db[_0x6987('0x13a')][_0x6987('0x116')](db[_0x6987('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x6987('0x144')});db[_0x6987('0x13a')][_0x6987('0x118')](db[_0x6987('0xf0')],{'as':'Lists','through':_0x6987('0x145')});db[_0x6987('0x13a')]['belongsToMany'](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':_0x6987('0x2f')});db[_0x6987('0x13a')][_0x6987('0x118')](db[_0x6987('0xe3')],{'as':_0x6987('0x147'),'through':_0x6987('0x102')});db[_0x6987('0x13a')]['belongsToMany'](db['CmList'],{'as':_0x6987('0x148'),'through':_0x6987('0x149')});db[_0x6987('0x107')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x13'),'foreignKey':'UserId'});db[_0x6987('0x1d')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x13'),'foreignKey':'UserId'});db[_0x6987('0x1f')][_0x6987('0x106')](db[_0x6987('0x21')],{'as':_0x6987('0x14a'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x14b'),'sourceKey':_0x6987('0x14c')});db[_0x6987('0x21')]['belongsTo'](db[_0x6987('0x1f')],{'foreignKey':_0x6987('0x14b'),'targetKey':_0x6987('0x14c')});db[_0x6987('0x14d')][_0x6987('0x106')](db[_0x6987('0x28')],{'as':_0x6987('0x14e'),'foreignKey':_0x6987('0x14f'),'constraints':![]});db[_0x6987('0x14d')][_0x6987('0x106')](db[_0x6987('0x26')],{'as':'AgentReports','foreignKey':_0x6987('0x14f'),'constraints':![]});db[_0x6987('0x14d')][_0x6987('0x116')](db['User'],{'as':_0x6987('0x13'),'foreignKey':'UserId'});db[_0x6987('0x14d')]['belongsTo'](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x3c')][_0x6987('0x116')](db[_0x6987('0x130')],{'as':_0x6987('0x130'),'foreignKey':_0x6987('0x152')});db['MailServerOut'][_0x6987('0x116')](db[_0x6987('0x130')],{'as':_0x6987('0x130'),'foreignKey':_0x6987('0x152')});db[_0x6987('0x130')][_0x6987('0x104')](db['MailServerIn'],{'as':'Imap','onDelete':_0x6987('0x10c')});db[_0x6987('0x130')][_0x6987('0x104')](db[_0x6987('0x153')],{'as':_0x6987('0x154'),'onDelete':'cascade'});db['MailAccount'][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':_0x6987('0x152')});db[_0x6987('0x130')][_0x6987('0x106')](db[_0x6987('0x82')],{'as':_0x6987('0x156'),'foreignKey':'MailAccountId'});db[_0x6987('0x130')][_0x6987('0x106')](db['MailMessage'],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x6987('0x130')][_0x6987('0x106')](db[_0x6987('0x43')],{'as':'Interactions'});db[_0x6987('0x130')][_0x6987('0x106')](db[_0x6987('0x157')],{'as':_0x6987('0x158')});db['MailAccount']['belongsTo'](db[_0x6987('0xf0')],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a')});db[_0x6987('0x130')][_0x6987('0x116')](db[_0x6987('0x8f')],{'as':_0x6987('0x8f'),'foreignKey':_0x6987('0x15b')});db['MailAccount'][_0x6987('0x116')](db[_0x6987('0x88')],{'as':_0x6987('0x15c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6987('0x130')][_0x6987('0x118')](db['User'],{'as':_0x6987('0x146'),'through':'user_has_mail_accounts'});db[_0x6987('0x40')]['belongsToMany'](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':'UserMailQueue'});db['MailQueue'][_0x6987('0x118')](db[_0x6987('0xe3')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x6987('0x43')][_0x6987('0x106')](db[_0x6987('0x15d')],{'as':_0x6987('0x14a'),'onDelete':_0x6987('0x10c'),'foreignKey':'MailInteractionId'});db[_0x6987('0x43')][_0x6987('0x116')](db['MailAccount'],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x152')});db[_0x6987('0x43')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x43')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x15f'),'foreignKey':_0x6987('0x105')});db['MailInteraction']['belongsToMany'](db[_0x6987('0x8d')],{'through':_0x6987('0x160'),'as':_0x6987('0x161')});db[_0x6987('0x43')]['belongsToMany'](db['Tag'],{'through':_0x6987('0x160'),'as':_0x6987('0x162')});db[_0x6987('0x43')][_0x6987('0x118')](db['User'],{'as':_0x6987('0x163'),'through':_0x6987('0x11f'),'foreignKey':_0x6987('0x164')});db['MailMessage']['hasMany'](db[_0x6987('0x165')],{'as':_0x6987('0x166'),'onDelete':_0x6987('0x10c')});db[_0x6987('0x15d')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x13')});db[_0x6987('0x15d')]['belongsTo'](db[_0x6987('0x11b')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x150')});db[_0x6987('0x15d')][_0x6987('0x116')](db[_0x6987('0x43')],{'as':_0x6987('0x167'),'foreignKey':'MailInteractionId'});db[_0x6987('0x15d')][_0x6987('0x116')](db[_0x6987('0x130')],{'as':_0x6987('0x15e'),'foreignKey':'MailAccountId'});db[_0x6987('0x15d')][_0x6987('0x116')](db[_0x6987('0x64')],{'as':_0x6987('0x64'),'foreignKey':_0x6987('0x168')});db[_0x6987('0x15d')][_0x6987('0x116')](db['ChatOfflineMessage'],{'as':_0x6987('0x6c'),'foreignKey':_0x6987('0x169')});db['MailApplication']['belongsTo'](db[_0x6987('0x13')],{'onDelete':_0x6987('0x16a')});db[_0x6987('0x157')][_0x6987('0x116')](db['MailQueue'],{'onDelete':_0x6987('0x16a')});db[_0x6987('0x157')][_0x6987('0x116')](db[_0x6987('0x130')],{'onDelete':_0x6987('0x16a')});db[_0x6987('0x157')]['belongsTo'](db[_0x6987('0x86')],{'onDelete':_0x6987('0x16a'),'foreignKey':_0x6987('0x143')});db['MailApplication']['belongsTo'](db[_0x6987('0x8d')],{'onDelete':_0x6987('0x16a'),'foreignKey':_0x6987('0x16b')});db[_0x6987('0x46')][_0x6987('0x116')](db[_0x6987('0x130')],{});db[_0x6987('0x46')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':'List','foreignKey':_0x6987('0x15a')});db[_0x6987('0x46')]['belongsTo'](db['CmContact'],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x46')][_0x6987('0x116')](db[_0x6987('0x43')],{});db[_0x6987('0x46')][_0x6987('0x116')](db[_0x6987('0x15d')],{});db[_0x6987('0x46')]['belongsTo'](db['User'],{});db[_0x6987('0x46')][_0x6987('0x116')](db[_0x6987('0x40')],{});db[_0x6987('0x48')][_0x6987('0x106')](db['DashboardItem'],{'as':_0x6987('0x16c'),'onDelete':_0x6987('0x10c')});db['FaxAccount'][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':'FaxAccountId'});db[_0x6987('0x12e')][_0x6987('0x106')](db['CannedAnswer'],{'as':_0x6987('0x156'),'foreignKey':'FaxAccountId'});db[_0x6987('0x12e')]['hasMany'](db[_0x6987('0x4f')],{'as':_0x6987('0x16d')});db['FaxAccount'][_0x6987('0x106')](db[_0x6987('0x4d')],{'as':_0x6987('0x158')});db['FaxAccount'][_0x6987('0x106')](db[_0x6987('0x10a')],{'as':_0x6987('0x16e'),'onDelete':'cascade'});db[_0x6987('0x12e')]['hasMany'](db['FaxMessage'],{'as':'Messages'});db[_0x6987('0x12e')][_0x6987('0x116')](db[_0x6987('0x2c')],{'as':_0x6987('0x2c')});db[_0x6987('0x12e')][_0x6987('0x116')](db['CmList'],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a')});db[_0x6987('0x12e')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x6987('0x144')});db[_0x6987('0x12e')]['belongsToMany'](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':'user_has_fax_accounts'});db[_0x6987('0x4d')][_0x6987('0x116')](db[_0x6987('0x13')],{'onDelete':_0x6987('0x16a')});db[_0x6987('0x4d')][_0x6987('0x116')](db[_0x6987('0x125')],{'onDelete':'restrict'});db[_0x6987('0x4d')]['belongsTo'](db[_0x6987('0x12e')],{'onDelete':_0x6987('0x16a')});db[_0x6987('0x4d')]['belongsTo'](db[_0x6987('0x8d')],{'onDelete':'restrict','foreignKey':_0x6987('0x16b')});db[_0x6987('0x4f')]['hasMany'](db[_0x6987('0x16f')],{'as':_0x6987('0x14a'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x170')});db[_0x6987('0x4f')][_0x6987('0x116')](db['FaxAccount'],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x171')});db['FaxInteraction'][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':'Contact','foreignKey':_0x6987('0x151')});db['FaxInteraction'][_0x6987('0x116')](db[_0x6987('0x13')],{'as':'Owner','foreignKey':_0x6987('0x105')});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':_0x6987('0x172'),'as':'Tags'});db[_0x6987('0x4f')][_0x6987('0x118')](db[_0x6987('0x8d')],{'through':_0x6987('0x172'),'as':_0x6987('0x162')});db['FaxInteraction'][_0x6987('0x118')](db['User'],{'as':_0x6987('0x163'),'through':'user_has_fax_interactions','foreignKey':_0x6987('0x170')});db['FaxMessage'][_0x6987('0x116')](db[_0x6987('0x13')],{'onDelete':_0x6987('0x10c'),'as':'User'});db[_0x6987('0x16f')][_0x6987('0x116')](db[_0x6987('0x4f')],{'as':'Interaction','foreignKey':_0x6987('0x170')});db[_0x6987('0x16f')][_0x6987('0x116')](db[_0x6987('0x11b')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x150')});db[_0x6987('0x16f')][_0x6987('0x116')](db['Attachment'],{'as':_0x6987('0x165'),'foreignKey':_0x6987('0x173')});db[_0x6987('0x16f')]['belongsTo'](db['FaxAccount'],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x171')});db[_0x6987('0x125')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':'UserFaxQueue'});db[_0x6987('0x125')][_0x6987('0x118')](db[_0x6987('0xe3')],{'through':_0x6987('0x174'),'as':'Teams'});db[_0x6987('0x51')]['belongsTo'](db[_0x6987('0x12e')],{});db[_0x6987('0x51')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a')});db['FaxQueueReport'][_0x6987('0x116')](db['CmContact'],{'as':_0x6987('0x150'),'foreignKey':'ContactId'});db[_0x6987('0x51')]['belongsTo'](db['FaxInteraction'],{});db[_0x6987('0x51')]['belongsTo'](db[_0x6987('0x16f')],{});db['FaxQueueReport'][_0x6987('0x116')](db['User'],{});db[_0x6987('0x51')][_0x6987('0x116')](db[_0x6987('0x125')],{});db[_0x6987('0x53')][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x6987('0x106')](db[_0x6987('0x82')],{'as':'Answers','foreignKey':_0x6987('0x175')});db[_0x6987('0x53')][_0x6987('0x106')](db['SmsMessage'],{'as':_0x6987('0x14a'),'foreignKey':_0x6987('0x175')});db[_0x6987('0x53')][_0x6987('0x106')](db['SmsInteraction'],{'as':_0x6987('0x16d')});db['SmsAccount'][_0x6987('0x106')](db[_0x6987('0x55')],{'as':_0x6987('0x158')});db[_0x6987('0x53')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':_0x6987('0x159'),'foreignKey':'ListId'});db['SmsAccount'][_0x6987('0x116')](db[_0x6987('0x88')],{'as':_0x6987('0x15c'),'foreignKey':_0x6987('0x144')});db[_0x6987('0x53')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_sms_accounts'});db['SmsApplication'][_0x6987('0x116')](db['User'],{'onDelete':_0x6987('0x16a')});db[_0x6987('0x55')]['belongsTo'](db['SmsQueue'],{'onDelete':'restrict'});db[_0x6987('0x55')][_0x6987('0x116')](db[_0x6987('0x53')],{'onDelete':_0x6987('0x16a')});db['SmsApplication'][_0x6987('0x116')](db[_0x6987('0x86')],{'onDelete':_0x6987('0x16a'),'foreignKey':_0x6987('0x143')});db[_0x6987('0x55')][_0x6987('0x116')](db[_0x6987('0x8d')],{'onDelete':_0x6987('0x16a'),'foreignKey':_0x6987('0x16b')});db[_0x6987('0x56')][_0x6987('0x106')](db['SmsMessage'],{'as':_0x6987('0x14a'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x176')});db['SmsInteraction'][_0x6987('0x116')](db[_0x6987('0x53')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x175')});db[_0x6987('0x56')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x56')]['belongsTo'](db[_0x6987('0x13')],{'as':_0x6987('0x15f'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x56')][_0x6987('0x118')](db['Tag'],{'through':_0x6987('0x177'),'as':_0x6987('0x161')});db[_0x6987('0x56')][_0x6987('0x118')](db['Tag'],{'through':_0x6987('0x177'),'as':_0x6987('0x162')});db[_0x6987('0x56')][_0x6987('0x118')](db['User'],{'as':_0x6987('0x163'),'through':_0x6987('0x122'),'foreignKey':_0x6987('0x176')});db[_0x6987('0x57')][_0x6987('0x116')](db['User'],{'as':_0x6987('0x13')});db[_0x6987('0x57')][_0x6987('0x116')](db[_0x6987('0x11b')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x150')});db['SmsMessage'][_0x6987('0x116')](db[_0x6987('0x56')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x167'),'foreignKey':_0x6987('0x176')});db[_0x6987('0x57')][_0x6987('0x116')](db['SmsAccount'],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x175')});db[_0x6987('0x59')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':_0x6987('0x37'),'foreignKey':_0x6987('0x178')});db[_0x6987('0x59')][_0x6987('0x118')](db[_0x6987('0xe3')],{'through':_0x6987('0x179'),'as':_0x6987('0x147')});db[_0x6987('0x5b')][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':_0x6987('0x17a')});db['OpenchannelAccount'][_0x6987('0x106')](db[_0x6987('0x82')],{'as':_0x6987('0x156'),'foreignKey':'OpenchannelAccountId'});db[_0x6987('0x5b')][_0x6987('0x106')](db['OpenchannelInteraction'],{'as':_0x6987('0x16d'),'foreignKey':_0x6987('0x17a')});db[_0x6987('0x5b')][_0x6987('0x106')](db[_0x6987('0x17b')],{'as':'Messages','foreignKey':_0x6987('0x17a')});db[_0x6987('0x5b')][_0x6987('0x106')](db[_0x6987('0x5d')],{'as':_0x6987('0x158'),'foreignKey':_0x6987('0x17a')});db['OpenchannelAccount'][_0x6987('0x116')](db['CmList'],{'as':_0x6987('0x159'),'foreignKey':'ListId'});db[_0x6987('0x5b')][_0x6987('0x116')](db[_0x6987('0x88')],{'as':_0x6987('0x15c'),'foreignKey':_0x6987('0x144')});db[_0x6987('0x5b')][_0x6987('0x118')](db['User'],{'as':'Agents','through':_0x6987('0x132')});db[_0x6987('0x5d')][_0x6987('0x116')](db[_0x6987('0x13')],{'onDelete':'restrict'});db['OpenchannelApplication']['belongsTo'](db[_0x6987('0x62')],{'onDelete':'restrict','foreignKey':_0x6987('0x17c')});db['OpenchannelApplication']['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x6987('0x16a'),'foreignKey':_0x6987('0x17a')});db[_0x6987('0x5d')]['belongsTo'](db[_0x6987('0x86')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x6987('0x116')](db[_0x6987('0x8d')],{'onDelete':'restrict','foreignKey':'TagId'});db['OpenchannelInteraction'][_0x6987('0x106')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x17d')});db[_0x6987('0x5f')][_0x6987('0x116')](db[_0x6987('0x5b')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x17a')});db[_0x6987('0x5f')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x5f')][_0x6987('0x116')](db['User'],{'as':_0x6987('0x15f'),'foreignKey':'UserId'});db[_0x6987('0x5f')]['belongsToMany'](db[_0x6987('0x8d')],{'through':_0x6987('0x17e'),'as':_0x6987('0x161')});db[_0x6987('0x5f')]['belongsToMany'](db['Tag'],{'through':_0x6987('0x17e'),'as':_0x6987('0x162')});db[_0x6987('0x5f')]['belongsToMany'](db['User'],{'as':_0x6987('0x163'),'through':_0x6987('0x17f'),'foreignKey':_0x6987('0x17d')});db[_0x6987('0x17b')][_0x6987('0x116')](db[_0x6987('0x13')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x13')});db[_0x6987('0x17b')][_0x6987('0x116')](db[_0x6987('0x11b')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x150')});db[_0x6987('0x17b')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x6987('0x10c'),'as':'Interaction','foreignKey':_0x6987('0x17d')});db['OpenchannelMessage'][_0x6987('0x116')](db[_0x6987('0x165')],{'as':_0x6987('0x165'),'foreignKey':'AttachmentId'});db['OpenchannelMessage']['belongsTo'](db[_0x6987('0x5b')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x17a')});db[_0x6987('0x62')]['belongsToMany'](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':_0x6987('0x39'),'foreignKey':'OpenchannelQueueId'});db[_0x6987('0x62')]['belongsToMany'](db[_0x6987('0xe3')],{'through':_0x6987('0x180'),'as':'Teams'});db[_0x6987('0x64')][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x6987('0x106')](db[_0x6987('0x82')],{'as':_0x6987('0x156'),'foreignKey':_0x6987('0x168')});db['ChatWebsite']['hasMany'](db[_0x6987('0x71')],{'as':_0x6987('0x181')});db[_0x6987('0x64')][_0x6987('0x106')](db['ChatInteraction'],{'as':_0x6987('0x16d')});db[_0x6987('0x64')][_0x6987('0x106')](db[_0x6987('0x67')],{'as':_0x6987('0x158')});db[_0x6987('0x64')][_0x6987('0x106')](db['ChatMessage'],{'as':_0x6987('0x14a')});db[_0x6987('0x64')]['belongsTo'](db[_0x6987('0xf0')],{'as':_0x6987('0x159'),'foreignKey':'ListId'});db[_0x6987('0x64')]['belongsTo'](db['Interval'],{'as':_0x6987('0x86'),'foreignKey':_0x6987('0x143')});db[_0x6987('0x64')][_0x6987('0x116')](db['MailAccount'],{'as':_0x6987('0x130'),'foreignKey':_0x6987('0x152')});db[_0x6987('0x64')]['belongsTo'](db[_0x6987('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x6987('0x144')});db[_0x6987('0x64')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x6987('0x66')][_0x6987('0x116')](db['OpenchannelAccount'],{});db[_0x6987('0x66')]['belongsTo'](db['CmList'],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a')});db[_0x6987('0x66')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':'Contact','foreignKey':_0x6987('0x151')});db['OpenchannelQueueReport']['belongsTo'](db[_0x6987('0x5f')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x6987('0x17b')],{});db[_0x6987('0x66')][_0x6987('0x116')](db[_0x6987('0x13')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelQueue'],{});db[_0x6987('0x67')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x182'),'foreignKey':'UserId','onDelete':_0x6987('0x16a')});db[_0x6987('0x67')][_0x6987('0x116')](db[_0x6987('0x6e')],{'as':_0x6987('0x183'),'foreignKey':_0x6987('0x184'),'onDelete':_0x6987('0x16a')});db[_0x6987('0x67')][_0x6987('0x116')](db[_0x6987('0x64')],{'as':_0x6987('0x185'),'foreignKey':_0x6987('0x168'),'onDelete':'restrict'});db[_0x6987('0x67')][_0x6987('0x116')](db[_0x6987('0x8d')],{'onDelete':_0x6987('0x16a'),'foreignKey':_0x6987('0x16b')});db['ChatInteraction'][_0x6987('0x106')](db[_0x6987('0x186')],{'as':'Messages','onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x187')});db[_0x6987('0x69')][_0x6987('0x116')](db[_0x6987('0x64')],{'as':_0x6987('0x15e'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x6987('0x116')](db['CmContact'],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x69')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x6987('0x69')][_0x6987('0x118')](db[_0x6987('0x8d')],{'through':_0x6987('0x188'),'as':_0x6987('0x161')});db[_0x6987('0x69')][_0x6987('0x118')](db[_0x6987('0x8d')],{'through':_0x6987('0x188'),'as':_0x6987('0x162')});db[_0x6987('0x69')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x163'),'through':_0x6987('0x120'),'foreignKey':_0x6987('0x187')});db[_0x6987('0x186')]['belongsTo'](db[_0x6987('0x13')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x13')});db[_0x6987('0x186')][_0x6987('0x116')](db[_0x6987('0x11b')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db['ChatMessage'][_0x6987('0x116')](db[_0x6987('0x69')],{'onDelete':'cascade','as':_0x6987('0x167'),'foreignKey':_0x6987('0x187')});db[_0x6987('0x186')][_0x6987('0x116')](db[_0x6987('0x165')],{'as':_0x6987('0x165'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0x6987('0x116')](db[_0x6987('0x64')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x168')});db[_0x6987('0x6c')]['belongsTo'](db[_0x6987('0x11b')],{'onDelete':_0x6987('0x10c'),'as':'Contact','foreignKey':_0x6987('0x151')});db[_0x6987('0x6c')][_0x6987('0x116')](db[_0x6987('0x64')],{'as':_0x6987('0x15e'),'foreignKey':'ChatWebsiteId'});db[_0x6987('0x6e')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':'Agents','through':_0x6987('0x31'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0x6987('0xe3')],{'through':'team_has_chat_queues','as':_0x6987('0x147')});db['ChatGroup'][_0x6987('0x106')](db[_0x6987('0xd1')],{'as':_0x6987('0x14a'),'foreignKey':_0x6987('0x189'),'onDelete':'cascade'});db['ChatGroup'][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x13b'),'through':_0x6987('0x11a')});db[_0x6987('0x71')]['belongsTo'](db[_0x6987('0x64')],{'as':_0x6987('0x185'),'foreignKey':_0x6987('0x168')});db[_0x6987('0x73')][_0x6987('0x106')](db[_0x6987('0x11b')],{'as':_0x6987('0x18a'),'foreignKey':_0x6987('0x18b')});db['CmContact'][_0x6987('0x106')](db[_0x6987('0x75')],{'as':_0x6987('0x13d'),'foreignKey':_0x6987('0x151')});db['CmContact']['hasMany'](db[_0x6987('0x77')],{'as':_0x6987('0x10d'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x11b')][_0x6987('0x106')](db[_0x6987('0x79')],{'as':_0x6987('0x13e'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x11b')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0x6987('0x11b')][_0x6987('0x106')](db[_0x6987('0xd6')],{'as':_0x6987('0x140'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x11b')]['hasMany'](db[_0x6987('0x5f')],{'as':_0x6987('0x10e'),'foreignKey':_0x6987('0x151'),'onDelete':_0x6987('0x16a')});db['CmContact'][_0x6987('0x106')](db[_0x6987('0x69')],{'as':_0x6987('0x18c'),'foreignKey':'ContactId','onDelete':_0x6987('0x16a')});db[_0x6987('0x11b')][_0x6987('0x106')](db[_0x6987('0x56')],{'as':_0x6987('0x10f'),'foreignKey':_0x6987('0x151'),'onDelete':_0x6987('0x16a')});db[_0x6987('0x11b')]['hasMany'](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x6987('0x151'),'onDelete':_0x6987('0x16a')});db[_0x6987('0x11b')][_0x6987('0x106')](db[_0x6987('0x43')],{'as':_0x6987('0x111'),'foreignKey':_0x6987('0x151'),'onDelete':_0x6987('0x16a')});db[_0x6987('0x11b')][_0x6987('0x116')](db[_0x6987('0x73')],{'as':_0x6987('0x18d'),'foreignKey':_0x6987('0x18b')});db[_0x6987('0x11b')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a'),'onDelete':_0x6987('0x10c')});db[_0x6987('0x11b')][_0x6987('0x118')](db['User'],{'as':_0x6987('0x163'),'through':'cm_user_has_contacts'});db[_0x6987('0x11b')][_0x6987('0x118')](db[_0x6987('0x8d')],{'as':_0x6987('0x161'),'through':_0x6987('0x18e')});db['CmContact'][_0x6987('0x118')](db['Tag'],{'through':_0x6987('0x18e'),'as':_0x6987('0x162')});db[_0x6987('0x75')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151'),'onDelete':_0x6987('0x10c')});db['CmHopper'][_0x6987('0x116')](db['CmList'],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a'),'onDelete':'cascade'});db[_0x6987('0x75')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x182'),'foreignKey':'UserId'});db[_0x6987('0x75')][_0x6987('0x116')](db[_0x6987('0x13a')],{'as':_0x6987('0x183'),'foreignKey':_0x6987('0x13c'),'onDelete':'cascade'});db['CmHopper'][_0x6987('0x116')](db[_0x6987('0xe6')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':'cascade'});db[_0x6987('0x75')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x15f'),'foreignKey':'OwnerId'});db[_0x6987('0x76')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151'),'onDelete':_0x6987('0x10c')});db[_0x6987('0x76')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':_0x6987('0x159'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x6987('0x76')][_0x6987('0x116')](db['VoiceQueue'],{'as':_0x6987('0x183'),'foreignKey':_0x6987('0x13c'),'onDelete':_0x6987('0x10c')});db[_0x6987('0x76')]['belongsTo'](db['Campaign'],{'as':'Campaign','foreignKey':_0x6987('0x18f'),'onDelete':_0x6987('0x10c')});db[_0x6987('0x81')][_0x6987('0x106')](db['Condition'],{'as':{'plural':_0x6987('0x190'),'singular':_0x6987('0x191')},'foreignKey':_0x6987('0x192'),'onDelete':_0x6987('0x10c'),'hooks':!![]});db['Automation'][_0x6987('0x106')](db['Condition'],{'as':{'plural':_0x6987('0x193'),'singular':_0x6987('0x194')},'foreignKey':_0x6987('0x195'),'onDelete':_0x6987('0x10c'),'hooks':!![]});db['Automation'][_0x6987('0x106')](db[_0x6987('0x7f')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x6987('0x10c'),'hooks':!![]});db[_0x6987('0x84')][_0x6987('0x106')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6987('0x196'),'onDelete':_0x6987('0x10c')});db['Interval'][_0x6987('0x106')](db[_0x6987('0x86')],{'as':_0x6987('0x197'),'foreignKey':_0x6987('0x143'),'onDelete':_0x6987('0x10c'),'hooks':!![],'required':![]});db[_0x6987('0x86')]['hasMany'](db[_0x6987('0x10a')],{'as':'Extensions','foreignKey':_0x6987('0x143'),'onDelete':'restrict'});db[_0x6987('0x86')][_0x6987('0x106')](db[_0x6987('0x157')],{'as':_0x6987('0x198'),'foreignKey':_0x6987('0x143')});db[_0x6987('0x86')][_0x6987('0x106')](db['ChatApplication'],{'as':_0x6987('0x199'),'foreignKey':_0x6987('0x143')});db[_0x6987('0x86')][_0x6987('0x106')](db[_0x6987('0x4d')],{'as':_0x6987('0x19a'),'foreignKey':_0x6987('0x143')});db[_0x6987('0x86')][_0x6987('0x106')](db[_0x6987('0x55')],{'as':'SmsApplications','foreignKey':_0x6987('0x143')});db[_0x6987('0x8b')]['belongsTo'](db['MailAccount'],{});db[_0x6987('0x8b')][_0x6987('0x116')](db['AnalyticDefaultReport'],{'foreignKey':_0x6987('0x19b')});db[_0x6987('0x8b')]['belongsTo'](db[_0x6987('0x97')],{'foreignKey':_0x6987('0x19c')});db['Sound'][_0x6987('0x118')](db[_0x6987('0x1a')],{'as':_0x6987('0x19d'),'through':_0x6987('0x19e'),'onDelete':_0x6987('0x16a')});db[_0x6987('0x8d')][_0x6987('0x118')](db[_0x6987('0x11b')],{'through':_0x6987('0x18e')});db[_0x6987('0x8d')][_0x6987('0x118')](db[_0x6987('0x69')],{'through':_0x6987('0x188')});db[_0x6987('0x8d')][_0x6987('0x118')](db[_0x6987('0x43')],{'through':_0x6987('0x160')});db[_0x6987('0x8d')]['belongsToMany'](db['SmsInteraction'],{'through':_0x6987('0x177')});db['Tag'][_0x6987('0x118')](db[_0x6987('0x4f')],{'through':_0x6987('0x172')});db['Tag'][_0x6987('0x118')](db[_0x6987('0x5f')],{'through':_0x6987('0x17e')});db['Tag'][_0x6987('0x118')](db['WhatsappInteraction'],{'through':_0x6987('0x19f')});db['Trigger']['hasMany'](db[_0x6987('0x85')],{'as':{'plural':'AllConditions','singular':_0x6987('0x1a0')},'foreignKey':_0x6987('0x1a1'),'onDelete':_0x6987('0x10c'),'hooks':!![]});db[_0x6987('0x91')][_0x6987('0x106')](db[_0x6987('0x85')],{'as':{'plural':'AnyConditions','singular':_0x6987('0x1a2')},'foreignKey':'TriggerAnyId','onDelete':_0x6987('0x10c'),'hooks':!![]});db[_0x6987('0x91')][_0x6987('0x106')](db[_0x6987('0x7f')],{'as':_0x6987('0x1a3'),'foreignKey':_0x6987('0x1a4'),'onDelete':_0x6987('0x10c'),'hooks':!![]});db[_0x6987('0x97')][_0x6987('0x106')](db[_0x6987('0x9f')],{'as':_0x6987('0x1a5'),'onDelete':'cascade','foreignKey':_0x6987('0x19c'),'hooks':!![]});db[_0x6987('0x99')]['hasMany'](db[_0x6987('0x9f')],{'as':_0x6987('0x1a5'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x19b')});db[_0x6987('0x9d')]['hasMany'](db[_0x6987('0x9f')],{'as':_0x6987('0x1a5'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1a6')});db[_0x6987('0x9f')]['belongsTo'](db[_0x6987('0x9d')],{'foreignKey':'MetricId'});db[_0x6987('0xa1')][_0x6987('0x106')](db[_0x6987('0x1a7')],{'as':_0x6987('0x1a8'),'onDelete':_0x6987('0x10c'),'foreignKey':'AccountId'});db[_0x6987('0x1a7')][_0x6987('0x106')](db['SalesforceField'],{'as':_0x6987('0x1a9'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0x1a7')][_0x6987('0x106')](db['SalesforceField'],{'as':_0x6987('0x1ab'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0x1a7')][_0x6987('0x106')](db[_0x6987('0xa4')],{'as':'Fields','onDelete':_0x6987('0x10c'),'foreignKey':'FieldId'});db['SalesforceConfiguration']['belongsTo'](db[_0x6987('0xa1')],{'as':'Account','foreignKey':_0x6987('0x1ad')});db['SalesforceField'][_0x6987('0x106')](db[_0x6987('0xa4')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6987('0xa4')]['hasMany'](db['SalesforceField'],{'as':_0x6987('0x1ae'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0xa4')][_0x6987('0x106')](db[_0x6987('0xa4')],{'as':_0x6987('0x1af'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xa4')][_0x6987('0x116')](db[_0x6987('0x1b1')],{'as':'Variable','foreignKey':_0x6987('0x1b2')});db[_0x6987('0xa5')][_0x6987('0x106')](db[_0x6987('0x1b3')],{'as':_0x6987('0x1a8'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0x1b3')][_0x6987('0x106')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0x1b3')]['hasMany'](db[_0x6987('0xa8')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x6987('0x1ac')});db[_0x6987('0x1b3')]['hasMany'](db['SugarcrmField'],{'as':'Fields','onDelete':_0x6987('0x10c'),'foreignKey':'FieldId'});db[_0x6987('0x1b3')][_0x6987('0x116')](db[_0x6987('0xa5')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xa8')][_0x6987('0x106')](db[_0x6987('0xa8')],{'as':_0x6987('0x1b4'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xa8')][_0x6987('0x106')](db['SugarcrmField'],{'as':_0x6987('0x1ae'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0xa8')][_0x6987('0x106')](db['SugarcrmField'],{'as':_0x6987('0x1af'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xa8')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x6987('0x1b2')});db[_0x6987('0xaa')]['hasMany'](db[_0x6987('0xac')],{'as':_0x6987('0x1a8'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xac')]['hasMany'](db['DeskField'],{'as':_0x6987('0x1a9'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xac')][_0x6987('0x106')](db[_0x6987('0xad')],{'as':_0x6987('0x1ab'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x6987('0xac')]['hasMany'](db[_0x6987('0xad')],{'as':_0x6987('0x1a5'),'onDelete':'cascade','foreignKey':_0x6987('0x1b0')});db[_0x6987('0xac')][_0x6987('0x116')](db[_0x6987('0xaa')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db['DeskConfiguration'][_0x6987('0x118')](db[_0x6987('0x8d')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x6987('0x106')](db[_0x6987('0xad')],{'as':_0x6987('0x1b4'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xad')][_0x6987('0x106')](db[_0x6987('0xad')],{'as':_0x6987('0x1ae'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0xad')][_0x6987('0x106')](db[_0x6987('0xad')],{'as':'Field','foreignKey':_0x6987('0x1b0')});db[_0x6987('0xad')]['belongsTo'](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':_0x6987('0x1b2')});db[_0x6987('0x1b5')][_0x6987('0x106')](db[_0x6987('0xaf')],{'as':_0x6987('0x1a8'),'onDelete':'cascade','foreignKey':_0x6987('0x1ad')});db[_0x6987('0xaf')][_0x6987('0x106')](db[_0x6987('0x1b6')],{'as':_0x6987('0x1a9'),'onDelete':'cascade','foreignKey':_0x6987('0x1aa')});db[_0x6987('0xaf')]['hasMany'](db[_0x6987('0x1b6')],{'as':_0x6987('0x1ab'),'onDelete':'cascade','foreignKey':_0x6987('0x1ac')});db[_0x6987('0xaf')][_0x6987('0x106')](db['ZohoField'],{'as':_0x6987('0x1a5'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xaf')][_0x6987('0x116')](db['ZohoAccount'],{'as':_0x6987('0x15e'),'foreignKey':'AccountId'});db[_0x6987('0x1b6')][_0x6987('0x106')](db['ZohoField'],{'as':_0x6987('0x1b4'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0x1b6')][_0x6987('0x106')](db[_0x6987('0x1b6')],{'as':_0x6987('0x1ae'),'foreignKey':'DescriptionId'});db[_0x6987('0x1b6')][_0x6987('0x106')](db[_0x6987('0x1b6')],{'as':'Field','foreignKey':_0x6987('0x1b0')});db[_0x6987('0x1b6')][_0x6987('0x116')](db[_0x6987('0x1b1')],{'as':'Variable','foreignKey':_0x6987('0x1b2')});db[_0x6987('0xb1')]['hasMany'](db[_0x6987('0xb3')],{'as':'Configurations','onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xb3')][_0x6987('0x106')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x6987('0x1aa')});db[_0x6987('0xb3')][_0x6987('0x106')](db[_0x6987('0xb5')],{'as':_0x6987('0x1ab'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0xb3')][_0x6987('0x106')](db[_0x6987('0xb5')],{'as':_0x6987('0x1a5'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x6987('0x116')](db['ZendeskAccount'],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xb3')]['belongsToMany'](db[_0x6987('0x8d')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x6987('0x106')](db[_0x6987('0xb5')],{'as':'Subject','foreignKey':_0x6987('0x1aa')});db[_0x6987('0xb5')]['hasMany'](db[_0x6987('0xb5')],{'as':_0x6987('0x1ae'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0xb5')][_0x6987('0x106')](db[_0x6987('0xb5')],{'as':_0x6987('0x1af'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xb5')][_0x6987('0x116')](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':_0x6987('0x1b2')});db[_0x6987('0x1b7')][_0x6987('0x106')](db['FreshdeskConfiguration'],{'as':_0x6987('0x1a8'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0x1b8')][_0x6987('0x106')](db[_0x6987('0xb8')],{'as':_0x6987('0x1a9'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0x1b8')][_0x6987('0x106')](db[_0x6987('0xb8')],{'as':_0x6987('0x1ab'),'onDelete':_0x6987('0x10c'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x6987('0x106')](db['FreshdeskField'],{'as':_0x6987('0x1a5'),'onDelete':'cascade','foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0x6987('0x116')](db[_0x6987('0x1b7')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db['FreshdeskConfiguration'][_0x6987('0x118')](db[_0x6987('0x8d')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x6987('0xb8')][_0x6987('0x106')](db[_0x6987('0xb8')],{'as':'Subject','foreignKey':_0x6987('0x1aa')});db[_0x6987('0xb8')]['hasMany'](db[_0x6987('0xb8')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x6987('0xb8')]['hasMany'](db[_0x6987('0xb8')],{'as':_0x6987('0x1af'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xb8')]['belongsTo'](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':'VariableId'});db['VtigerAccount'][_0x6987('0x106')](db[_0x6987('0xbc')],{'as':_0x6987('0x1a8'),'onDelete':'cascade','foreignKey':_0x6987('0x1ad')});db[_0x6987('0xbc')]['hasMany'](db[_0x6987('0xbe')],{'as':_0x6987('0x1a9'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xbc')][_0x6987('0x106')](db['VtigerField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x6987('0xbc')][_0x6987('0x106')](db[_0x6987('0xbe')],{'as':'Fields','foreignKey':_0x6987('0x1b0')});db[_0x6987('0xbc')][_0x6987('0x116')](db[_0x6987('0xba')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xbe')][_0x6987('0x106')](db[_0x6987('0xbe')],{'as':_0x6987('0x1b4'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xbe')][_0x6987('0x106')](db[_0x6987('0xbe')],{'as':'Description','foreignKey':'DescriptionId'});db['VtigerField'][_0x6987('0x106')](db[_0x6987('0xbe')],{'as':_0x6987('0x1af'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xbe')]['belongsTo'](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':_0x6987('0x1b2')});db[_0x6987('0xc0')][_0x6987('0x106')](db[_0x6987('0xc2')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x6987('0xc2')][_0x6987('0x106')](db[_0x6987('0x1b9')],{'as':_0x6987('0x1a9'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xc2')][_0x6987('0x106')](db[_0x6987('0x1b9')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x6987('0xc2')][_0x6987('0x106')](db[_0x6987('0x1b9')],{'as':_0x6987('0x1a5'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xc2')][_0x6987('0x116')](db[_0x6987('0xc0')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0x1b9')][_0x6987('0x106')](db[_0x6987('0x1b9')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6987('0x1b9')][_0x6987('0x106')](db[_0x6987('0x1b9')],{'as':_0x6987('0x1ae'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0x1b9')][_0x6987('0x106')](db[_0x6987('0x1b9')],{'as':_0x6987('0x1af'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0x1b9')][_0x6987('0x116')](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':_0x6987('0x1b2')});db['Dynamics365Account'][_0x6987('0x106')](db[_0x6987('0xc5')],{'as':_0x6987('0x1a8'),'onDelete':'cascade','foreignKey':_0x6987('0x1ad')});db[_0x6987('0xc5')][_0x6987('0x106')](db['Dynamics365Field'],{'as':_0x6987('0x1a9'),'onDelete':_0x6987('0x10c'),'foreignKey':'SubjectId'});db[_0x6987('0xc5')][_0x6987('0x106')](db[_0x6987('0xc7')],{'as':'Descriptions','onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0xc5')][_0x6987('0x106')](db[_0x6987('0xc7')],{'as':_0x6987('0x1a5'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1b0')});db['Dynamics365Configuration'][_0x6987('0x116')](db[_0x6987('0x1ba')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xc7')][_0x6987('0x106')](db['Dynamics365Field'],{'as':_0x6987('0x1b4'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xc7')][_0x6987('0x106')](db[_0x6987('0xc7')],{'as':'Description','foreignKey':_0x6987('0x1ac')});db[_0x6987('0xc7')]['hasMany'](db['Dynamics365Field'],{'as':_0x6987('0x1af'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0x6987('0x116')](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':'VariableId'});db[_0x6987('0xc9')][_0x6987('0x106')](db[_0x6987('0xcb')],{'as':_0x6987('0x1a8'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xcb')]['hasMany'](db[_0x6987('0x1bb')],{'as':_0x6987('0x1a9'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xcb')][_0x6987('0x106')](db[_0x6987('0x1bb')],{'as':_0x6987('0x1ab'),'foreignKey':_0x6987('0x1ac')});db['FreshsalesConfiguration'][_0x6987('0x106')](db[_0x6987('0x1bb')],{'as':'Fields','foreignKey':_0x6987('0x1b0')});db[_0x6987('0xcb')][_0x6987('0x116')](db[_0x6987('0xc9')],{'as':_0x6987('0x15e'),'foreignKey':'AccountId'});db[_0x6987('0x1bb')][_0x6987('0x106')](db[_0x6987('0x1bb')],{'as':_0x6987('0x1b4'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0x1bb')][_0x6987('0x106')](db[_0x6987('0x1bb')],{'as':_0x6987('0x1ae'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0x1bb')][_0x6987('0x106')](db[_0x6987('0x1bb')],{'as':_0x6987('0x1af'),'foreignKey':'FieldId'});db[_0x6987('0x1bb')]['belongsTo'](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':_0x6987('0x1b2')});db[_0x6987('0xd0')]['belongsTo'](db['ChatWebsite'],{});db[_0x6987('0xd0')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':'List','foreignKey':_0x6987('0x15a')});db[_0x6987('0xd0')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0xd0')][_0x6987('0x116')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x6987('0x116')](db[_0x6987('0x186')],{});db[_0x6987('0xd0')]['belongsTo'](db['User'],{});db['ChatQueueReport'][_0x6987('0x116')](db[_0x6987('0x6e')],{});db['ChatInternalMessage'][_0x6987('0x116')](db['User'],{'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1bc')});db[_0x6987('0xd1')][_0x6987('0x116')](db[_0x6987('0x13')],{'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1bd')});db['JscriptySessionReport']['hasMany'](db[_0x6987('0x1be')],{'foreignKey':_0x6987('0x1bf'),'onDelete':_0x6987('0x10c')});db[_0x6987('0xd6')][_0x6987('0x106')](db[_0x6987('0xd3')],{'foreignKey':'SessionId','onDelete':_0x6987('0x10c')});db[_0x6987('0x1c0')][_0x6987('0x116')](db[_0x6987('0x53')],{});db['SmsQueueReport'][_0x6987('0x116')](db['CmList'],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a')});db[_0x6987('0x1c0')][_0x6987('0x116')](db['CmContact'],{'as':_0x6987('0x150'),'foreignKey':'ContactId'});db[_0x6987('0x1c0')][_0x6987('0x116')](db[_0x6987('0x56')],{});db[_0x6987('0x1c0')][_0x6987('0x116')](db[_0x6987('0x57')],{});db[_0x6987('0x1c0')][_0x6987('0x116')](db[_0x6987('0x13')],{});db[_0x6987('0x1c0')][_0x6987('0x116')](db[_0x6987('0x59')],{});db['JscriptyProject'][_0x6987('0x106')](db[_0x6987('0xd6')],{'foreignKey':_0x6987('0x1c1')});db[_0x6987('0x1c2')][_0x6987('0x106')](db['JscriptyQuestionReport'],{'foreignKey':_0x6987('0x1c1')});db['JscriptyProject'][_0x6987('0x106')](db[_0x6987('0xd3')],{'foreignKey':_0x6987('0x1c1')});db[_0x6987('0xde')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x163'),'through':_0x6987('0x136')});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':'Agents','through':_0x6987('0x11e')});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x13a')],{'through':_0x6987('0x102'),'as':_0x6987('0x1c3')});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x40')],{'through':_0x6987('0x1c4'),'as':_0x6987('0x123')});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x6e')],{'through':_0x6987('0x1c5'),'as':'ChatQueues'});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x125')],{'through':_0x6987('0x174'),'as':_0x6987('0x126')});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x59')],{'through':_0x6987('0x179'),'as':_0x6987('0x1c6')});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x62')],{'through':_0x6987('0x180'),'as':_0x6987('0x127')});db[_0x6987('0xe3')][_0x6987('0x118')](db['WhatsappQueue'],{'through':_0x6987('0x1c7'),'as':_0x6987('0x1c8')});db[_0x6987('0xe6')][_0x6987('0x106')](db['CmHopper'],{'as':_0x6987('0x13d'),'foreignKey':'CampaignId'});db[_0x6987('0xe6')][_0x6987('0x106')](db[_0x6987('0x77')],{'as':_0x6987('0x10d'),'foreignKey':_0x6987('0x18f')});db[_0x6987('0xe6')][_0x6987('0x106')](db[_0x6987('0x79')],{'as':_0x6987('0x13e'),'foreignKey':_0x6987('0x18f')});db['Campaign'][_0x6987('0x106')](db[_0x6987('0x76')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x6987('0xe6')][_0x6987('0x116')](db[_0x6987('0x2c')],{'as':_0x6987('0x2c'),'foreignKey':_0x6987('0x141')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0x6987('0x1c9'),'foreignKey':_0x6987('0x142')});db['Campaign'][_0x6987('0x116')](db['Interval'],{'as':'Interval','foreignKey':_0x6987('0x143')});db[_0x6987('0xe6')][_0x6987('0x116')](db[_0x6987('0xde')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x6987('0xe6')]['belongsToMany'](db[_0x6987('0xf0')],{'as':_0x6987('0x1ca'),'through':_0x6987('0x1cb')});db[_0x6987('0xe6')][_0x6987('0x118')](db[_0x6987('0xf0')],{'as':_0x6987('0x148'),'through':'campaigns_has_cm_blacklists'});db[_0x6987('0x1cc')][_0x6987('0x116')](db[_0x6987('0x15d')],{});db[_0x6987('0x1cc')]['belongsTo'](db[_0x6987('0x43')],{});db[_0x6987('0x1cc')][_0x6987('0x116')](db[_0x6987('0x130')],{'foreignKey':_0x6987('0x1cd'),'as':_0x6987('0x1ce')});db[_0x6987('0x1cc')]['belongsTo'](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1cf'),'as':_0x6987('0x1d0')});db[_0x6987('0x1cc')][_0x6987('0x116')](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1d1'),'as':_0x6987('0x1d2')});db['MailTransferReport']['belongsTo'](db[_0x6987('0x40')],{'foreignKey':_0x6987('0x1d3'),'as':_0x6987('0x1d4')});db['MailTransferReport'][_0x6987('0x116')](db[_0x6987('0x130')],{'foreignKey':_0x6987('0x1d5'),'as':'ToAccount'});db[_0x6987('0x1d6')][_0x6987('0x116')](db[_0x6987('0x186')],{});db[_0x6987('0x1d6')][_0x6987('0x116')](db[_0x6987('0x69')],{});db[_0x6987('0x1d6')][_0x6987('0x116')](db[_0x6987('0x64')],{'foreignKey':_0x6987('0x1d7'),'as':_0x6987('0x1ce')});db['ChatTransferReport']['belongsTo'](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1cf'),'as':_0x6987('0x1d0')});db[_0x6987('0x1d6')]['belongsTo'](db['User'],{'foreignKey':_0x6987('0x1d1'),'as':_0x6987('0x1d2')});db[_0x6987('0x1d6')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x6987('0x1d8'),'as':_0x6987('0x1d4')});db[_0x6987('0x1d6')]['belongsTo'](db[_0x6987('0x64')],{'foreignKey':_0x6987('0x1d9'),'as':_0x6987('0x1da')});db[_0x6987('0x1db')]['belongsTo'](db[_0x6987('0x16f')],{});db[_0x6987('0x1db')][_0x6987('0x116')](db[_0x6987('0x4f')],{});db['FaxTransferReport'][_0x6987('0x116')](db[_0x6987('0x12e')],{'foreignKey':_0x6987('0x1dc'),'as':_0x6987('0x1ce')});db[_0x6987('0x1db')][_0x6987('0x116')](db['User'],{'foreignKey':_0x6987('0x1cf'),'as':_0x6987('0x1d0')});db[_0x6987('0x1db')][_0x6987('0x116')](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1d1'),'as':_0x6987('0x1d2')});db[_0x6987('0x1db')][_0x6987('0x116')](db[_0x6987('0x125')],{'foreignKey':_0x6987('0x1dd'),'as':_0x6987('0x1d4')});db[_0x6987('0x1db')][_0x6987('0x116')](db[_0x6987('0x12e')],{'foreignKey':_0x6987('0x1de'),'as':_0x6987('0x1da')});db['OpenchannelTransferReport']['belongsTo'](db[_0x6987('0x17b')],{});db[_0x6987('0xed')][_0x6987('0x116')](db[_0x6987('0x5f')],{});db['OpenchannelTransferReport'][_0x6987('0x116')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0x6987('0xed')]['belongsTo'](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1cf'),'as':_0x6987('0x1d0')});db['OpenchannelTransferReport'][_0x6987('0x116')](db[_0x6987('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x6987('0xed')][_0x6987('0x116')](db[_0x6987('0x62')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x6987('0xed')][_0x6987('0x116')](db[_0x6987('0x5b')],{'foreignKey':_0x6987('0x1df'),'as':_0x6987('0x1da')});db[_0x6987('0x1e0')][_0x6987('0x116')](db[_0x6987('0x57')],{});db[_0x6987('0x1e0')][_0x6987('0x116')](db[_0x6987('0x56')],{});db[_0x6987('0x1e0')][_0x6987('0x116')](db['SmsAccount'],{'foreignKey':_0x6987('0x1e1'),'as':_0x6987('0x1ce')});db[_0x6987('0x1e0')][_0x6987('0x116')](db['User'],{'foreignKey':_0x6987('0x1cf'),'as':_0x6987('0x1d0')});db[_0x6987('0x1e0')][_0x6987('0x116')](db['User'],{'foreignKey':_0x6987('0x1d1'),'as':_0x6987('0x1d2')});db['SmsTransferReport']['belongsTo'](db[_0x6987('0x59')],{'foreignKey':_0x6987('0x1e2'),'as':_0x6987('0x1d4')});db[_0x6987('0x1e0')][_0x6987('0x116')](db[_0x6987('0x53')],{'foreignKey':_0x6987('0x1e3'),'as':_0x6987('0x1da')});db[_0x6987('0xf0')][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':'ListId'});db['CmList'][_0x6987('0x106')](db[_0x6987('0x7d')],{'as':'CustomFields','foreignKey':'ListId'});db[_0x6987('0xf0')][_0x6987('0x106')](db[_0x6987('0x11b')],{'as':_0x6987('0x18a'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x15a')});db['CmList']['hasMany'](db[_0x6987('0x77')],{'as':'HopperFinals','foreignKey':_0x6987('0x15a')});db['CmList'][_0x6987('0x106')](db[_0x6987('0x79')],{'as':_0x6987('0x1e4'),'foreignKey':_0x6987('0x15a')});db[_0x6987('0xf0')][_0x6987('0x106')](db[_0x6987('0x7b')],{'as':_0x6987('0x7b'),'foreignKey':_0x6987('0x15a')});db[_0x6987('0xf0')]['belongsToMany'](db[_0x6987('0x13a')],{'as':_0x6987('0x1e5'),'through':_0x6987('0x145')});db[_0x6987('0xf0')][_0x6987('0x118')](db['User'],{'as':'Agents','through':_0x6987('0x11d')});db[_0x6987('0x129')][_0x6987('0x106')](db[_0x6987('0x10a')],{'as':_0x6987('0x10b'),'onDelete':'cascade'});db[_0x6987('0x129')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x6987('0x12b')});db[_0x6987('0xf3')][_0x6987('0x106')](db[_0x6987('0x13')],{'as':_0x6987('0x163'),'foreignKey':_0x6987('0x117')});db[_0x6987('0xf3')][_0x6987('0x106')](db[_0x6987('0xf4')],{'as':_0x6987('0x1e6'),'foreignKey':_0x6987('0x117'),'onDelete':_0x6987('0x10c')});db[_0x6987('0xf4')]['hasMany'](db['UserProfileResource'],{'as':_0x6987('0x1e7'),'foreignKey':_0x6987('0x1e8'),'onDelete':'cascade'});db['WhatsappAccount'][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':_0x6987('0x1e9')});db[_0x6987('0xf8')][_0x6987('0x106')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x6987('0x1e9')});db[_0x6987('0xf8')][_0x6987('0x106')](db[_0x6987('0xfb')],{'as':_0x6987('0x14a'),'foreignKey':_0x6987('0x1e9')});db['WhatsappAccount'][_0x6987('0x106')](db[_0x6987('0x112')],{'as':_0x6987('0x16d')});db[_0x6987('0xf8')]['hasMany'](db['WhatsappApplication'],{'as':_0x6987('0x158')});db[_0x6987('0xf8')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':'List','foreignKey':_0x6987('0x15a')});db['WhatsappAccount'][_0x6987('0x116')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x6987('0xf8')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':'user_has_whatsapp_accounts'});db[_0x6987('0xf9')][_0x6987('0x116')](db[_0x6987('0x13')],{'onDelete':_0x6987('0x16a')});db[_0x6987('0xf9')][_0x6987('0x116')](db[_0x6987('0x128')],{'onDelete':_0x6987('0x16a')});db[_0x6987('0xf9')][_0x6987('0x116')](db[_0x6987('0xf8')],{'onDelete':'restrict'});db[_0x6987('0xf9')][_0x6987('0x116')](db[_0x6987('0x86')],{'onDelete':_0x6987('0x16a'),'foreignKey':'IntervalId'});db[_0x6987('0xf9')][_0x6987('0x116')](db[_0x6987('0x8d')],{'onDelete':'restrict','foreignKey':'TagId'});db['WhatsappInteraction'][_0x6987('0x106')](db[_0x6987('0xfb')],{'as':_0x6987('0x14a'),'onDelete':_0x6987('0x10c'),'foreignKey':'WhatsappInteractionId'});db[_0x6987('0x112')][_0x6987('0x116')](db[_0x6987('0xf8')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1e9')});db[_0x6987('0x112')][_0x6987('0x116')](db['CmContact'],{'as':_0x6987('0x150'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x6987('0x116')](db['User'],{'as':_0x6987('0x15f'),'foreignKey':_0x6987('0x105')});db['WhatsappInteraction'][_0x6987('0x118')](db['Tag'],{'through':_0x6987('0x19f'),'as':'Tags'});db[_0x6987('0x112')][_0x6987('0x118')](db[_0x6987('0x8d')],{'through':_0x6987('0x19f'),'as':_0x6987('0x162')});db[_0x6987('0x112')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x163'),'through':_0x6987('0x1ea'),'foreignKey':_0x6987('0x1eb')});db[_0x6987('0xfb')]['belongsTo'](db[_0x6987('0x13')],{'as':_0x6987('0x13')});db['WhatsappMessage'][_0x6987('0x116')](db[_0x6987('0x11b')],{'onDelete':'cascade','as':_0x6987('0x150')});db[_0x6987('0xfb')]['belongsTo'](db[_0x6987('0x112')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x167'),'foreignKey':_0x6987('0x1eb')});db[_0x6987('0xfb')][_0x6987('0x116')](db['WhatsappAccount'],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1e9')});db[_0x6987('0xfc')]['belongsTo'](db[_0x6987('0xf8')],{});db[_0x6987('0xfc')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':'List','foreignKey':_0x6987('0x15a')});db['WhatsappQueueReport'][_0x6987('0x116')](db['CmContact'],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0xfc')][_0x6987('0x116')](db[_0x6987('0x112')],{});db[_0x6987('0xfc')][_0x6987('0x116')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x6987('0x116')](db[_0x6987('0xfb')],{});db['WhatsappQueueReport'][_0x6987('0x116')](db[_0x6987('0x13')],{});db[_0x6987('0xfe')][_0x6987('0x116')](db[_0x6987('0xfb')],{});db[_0x6987('0xfe')]['belongsTo'](db[_0x6987('0x112')],{});db[_0x6987('0xfe')][_0x6987('0x116')](db[_0x6987('0xf8')],{'foreignKey':_0x6987('0x1ec'),'as':_0x6987('0x1ce')});db['WhatsappTransferReport']['belongsTo'](db[_0x6987('0xf8')],{'foreignKey':_0x6987('0x1ed'),'as':_0x6987('0x1da')});db[_0x6987('0xfe')]['belongsTo'](db[_0x6987('0x128')],{'foreignKey':_0x6987('0x1ee'),'as':_0x6987('0x1d4')});db[_0x6987('0xfe')][_0x6987('0x116')](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1cf'),'as':'FromAgent'});db[_0x6987('0xfe')][_0x6987('0x116')](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1d1'),'as':'ToAgent'});db['WhatsappQueue']['belongsToMany'](db['User'],{'as':_0x6987('0x146'),'through':'UserWhatsappQueue','foreignKey':_0x6987('0x1ef')});db[_0x6987('0x128')][_0x6987('0x118')](db[_0x6987('0xe3')],{'through':_0x6987('0x1c7'),'as':_0x6987('0x147')});module[_0x6987('0x1f0')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 08ff66e..e4f18ba 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8af=['/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/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','/api/auth/google','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','/api/webbar','/apidoc','static','root','/www','/demo','join','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','username','password','apiKey','firstName','lastName','phone','mobile','fax','email','clientId','code','accessKey','token','channelSecret','accessToken','accessTokenSecret','authToken','membername','calleridname','calleridnum','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','includes','lodash','express','express-winston','util','./errors','./config/logger','api','auth','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','headers','remoteAddress','url','statusCode','responseTime','user','name','logger','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','role','device','other','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/tag','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount'];(function(_0x3c5ef7,_0x55467e){var _0x5e24ed=function(_0x1e0c26){while(--_0x1e0c26){_0x3c5ef7['push'](_0x3c5ef7['shift']());}};_0x5e24ed(++_0x55467e);}(_0xf8af,0x8b));var _0xff8a=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xf8af[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xff8a('0x0'));var path=require('path');var express=require(_0xff8a('0x1'));var ewinston=require(_0xff8a('0x2'));var util=require(_0xff8a('0x3'));var errors=require(_0xff8a('0x4'));var config=require('./config/environment');var logger=require(_0xff8a('0x5'))(_0xff8a('0x6'));var authLogger=require(_0xff8a('0x5'))(_0xff8a('0x7'));exports['default']=function(_0x5a4a51){_0x5a4a51[_0xff8a('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1a1251,_0x406e06){var _0x46e262=_0xff8a('0x9');if(!_[_0xff8a('0xa')](_0x1a1251[_0xff8a('0xb')])){_0x46e262+=_0xff8a('0xc');var _0x7442d6=_0x1a1251[_0xff8a('0xb')];maskSensitiveData(_0x7442d6);}return util[_0xff8a('0xd')](_0x46e262,_0x1a1251[_0xff8a('0xe')],_0x1a1251['headers'][_0xff8a('0xf')]?_0x1a1251[_0xff8a('0x10')][_0xff8a('0xf')]:_0x1a1251['connection'][_0xff8a('0x11')]||_0x1a1251['ip'],_0x1a1251[_0xff8a('0x12')],_0x406e06[_0xff8a('0x13')],_0x406e06[_0xff8a('0x14')],_0x1a1251[_0xff8a('0x15')]?_0x1a1251['user']['id']:null,_0x1a1251[_0xff8a('0x15')]?_0x1a1251[_0xff8a('0x15')][_0xff8a('0x16')]:null,_0x1a1251[_0xff8a('0x15')]?_0x1a1251['user']['role']:null,_0x7442d6?util['inspect'](_0x7442d6,![],null):'');}}));_0x5a4a51['use'](ewinston[_0xff8a('0x17')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x569b15,_0x279441){var _0x2917a7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x569b15[_0xff8a('0xb')]&&_0x569b15['body']['device']&&_0x569b15[_0xff8a('0xb')][_0xff8a('0x18')]){_0x2917a7=_0xff8a('0x19');}return util['format'](_0x2917a7,_0x569b15[_0xff8a('0xe')],_0x569b15['headers'][_0xff8a('0xf')]?_0x569b15['headers'][_0xff8a('0xf')]:_0x569b15[_0xff8a('0x1a')][_0xff8a('0x11')]||_0x569b15['ip'],_0x569b15[_0xff8a('0x12')],_0x279441[_0xff8a('0x13')],_0x279441[_0xff8a('0x14')],_0x569b15[_0xff8a('0x15')]?_0x569b15[_0xff8a('0x15')]['id']:null,_0x569b15[_0xff8a('0x15')]?_0x569b15[_0xff8a('0x15')][_0xff8a('0x16')]:null,_0x569b15[_0xff8a('0x15')]?_0x569b15[_0xff8a('0x15')][_0xff8a('0x1b')]:null,_0x569b15[_0xff8a('0xb')]&&_0x569b15['body'][_0xff8a('0x1c')]?_0x569b15[_0xff8a('0xb')][_0xff8a('0x1c')]:_0xff8a('0x1d'),_0x569b15['body']&&_0x569b15[_0xff8a('0xb')]['agent_id']?_0x569b15[_0xff8a('0xb')][_0xff8a('0x18')]:'',_0x569b15[_0xff8a('0xb')]&&_0x569b15[_0xff8a('0xb')][_0xff8a('0x1e')]?_0x569b15['body'][_0xff8a('0x1e')]:'');},'ignoreRoute':function(_0x178f73){var _0x3063b1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3063b1['test'](_0x178f73[_0xff8a('0x12')]);}}));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x1f'),require(_0xff8a('0x20')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x21'),require(_0xff8a('0x22')));_0x5a4a51['use']('/api/voice/contexts',require(_0xff8a('0x23')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x24'),require(_0xff8a('0x25')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x26'),require('./api/voiceMusicOnHold'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x27'),require('./api/voiceQueue'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x28'),require(_0xff8a('0x29')));_0x5a4a51['use'](_0xff8a('0x2a'),require(_0xff8a('0x2b')));_0x5a4a51['use'](_0xff8a('0x2c'),require(_0xff8a('0x2d')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x2e'),require(_0xff8a('0x2f')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x30'),require(_0xff8a('0x31')));_0x5a4a51[_0xff8a('0x8')]('/api/voice/dials/reports',require(_0xff8a('0x32')));_0x5a4a51[_0xff8a('0x8')]('/api/voice/agents/reports',require(_0xff8a('0x33')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x34'),require(_0xff8a('0x35')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x36'),require(_0xff8a('0x37')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x38'),require('./api/trunk'));_0x5a4a51['use'](_0xff8a('0x39'),require(_0xff8a('0x3a')));_0x5a4a51['use'](_0xff8a('0x3b'),require(_0xff8a('0x3c')));_0x5a4a51['use']('/api/mail/accounts',require('./api/mailAccount'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x3d'),require('./api/mailQueue'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x3e'),require(_0xff8a('0x3f')));_0x5a4a51['use'](_0xff8a('0x40'),require('./api/mailInteraction'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x41'),require('./api/mailMessage'));_0x5a4a51[_0xff8a('0x8')]('/api/mail/applications',require('./api/mailApplication'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x42'),require(_0xff8a('0x43')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x44'),require('./api/dashboard'));_0x5a4a51[_0xff8a('0x8')]('/api/dashboards/items',require(_0xff8a('0x45')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x46'),require(_0xff8a('0x47')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x48'),require(_0xff8a('0x49')));_0x5a4a51['use'](_0xff8a('0x4a'),require(_0xff8a('0x4b')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x4c'),require(_0xff8a('0x4d')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x4e'),require(_0xff8a('0x4f')));_0x5a4a51[_0xff8a('0x8')]('/api/fax/reports/queue',require(_0xff8a('0x50')));_0x5a4a51['use'](_0xff8a('0x51'),require(_0xff8a('0x52')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x53'),require(_0xff8a('0x54')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x55'),require(_0xff8a('0x56')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x57'),require(_0xff8a('0x58')));_0x5a4a51['use'](_0xff8a('0x59'),require(_0xff8a('0x5a')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x5b'),require(_0xff8a('0x5c')));_0x5a4a51['use'](_0xff8a('0x5d'),require(_0xff8a('0x5e')));_0x5a4a51[_0xff8a('0x8')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x5f'),require(_0xff8a('0x60')));_0x5a4a51[_0xff8a('0x8')]('/api/openchannel/queues',require(_0xff8a('0x61')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x62'),require(_0xff8a('0x63')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x64'),require(_0xff8a('0x65')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x66'),require(_0xff8a('0x67')));_0x5a4a51[_0xff8a('0x8')]('/api/chat/interactions',require(_0xff8a('0x68')));_0x5a4a51[_0xff8a('0x8')]('/api/chat/messages',require(_0xff8a('0x69')));_0x5a4a51[_0xff8a('0x8')]('/api/chat/offline_messages',require(_0xff8a('0x6a')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x6b'),require(_0xff8a('0x6c')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x6d'),require(_0xff8a('0x6e')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x6f'),require(_0xff8a('0x70')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x71'),require(_0xff8a('0x72')));_0x5a4a51[_0xff8a('0x8')]('/api/cm/contacts',require(_0xff8a('0x73')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x74'),require('./api/cmHopper'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x75'),require(_0xff8a('0x76')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x77'),require(_0xff8a('0x78')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x79'),require(_0xff8a('0x7a')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x7b'),require('./api/cmCustomField'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x7c'),require(_0xff8a('0x7d')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x7e'),require(_0xff8a('0x7f')));_0x5a4a51[_0xff8a('0x8')]('/api/canned_answers',require(_0xff8a('0x80')));_0x5a4a51[_0xff8a('0x8')]('/api/dispositions',require(_0xff8a('0x81')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x82'),require(_0xff8a('0x83')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x84'),require(_0xff8a('0x85')));_0x5a4a51['use'](_0xff8a('0x86'),require('./api/pause'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x87'),require(_0xff8a('0x88')));_0x5a4a51['use'](_0xff8a('0x89'),require(_0xff8a('0x8a')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x8b'),require(_0xff8a('0x8c')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x8d'),require('./api/sound'));_0x5a4a51[_0xff8a('0x8')]('/api/tags',require(_0xff8a('0x8e')));_0x5a4a51[_0xff8a('0x8')]('/api/templates',require('./api/template'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x8f'),require(_0xff8a('0x90')));_0x5a4a51['use'](_0xff8a('0x91'),require('./api/variable'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x92'),require(_0xff8a('0x93')));_0x5a4a51['use']('/api/integrations/reports',require(_0xff8a('0x94')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x95'),require(_0xff8a('0x96')));_0x5a4a51['use'](_0xff8a('0x97'),require(_0xff8a('0x98')));_0x5a4a51['use'](_0xff8a('0x99'),require('./api/analyticExtractedReport'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x9a'),require(_0xff8a('0x9b')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x9c'),require('./api/analyticFieldReport'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x9d'),require('./api/analyticTreeReport'));_0x5a4a51['use'](_0xff8a('0x9e'),require(_0xff8a('0x9f')));_0x5a4a51['use']('/api/integrations/salesforce/configurations',require(_0xff8a('0xa0')));_0x5a4a51['use'](_0xff8a('0xa1'),require(_0xff8a('0xa2')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xa3'),require(_0xff8a('0xa4')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xa5'),require(_0xff8a('0xa6')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xa7'),require(_0xff8a('0xa8')));_0x5a4a51['use'](_0xff8a('0xa9'),require(_0xff8a('0xaa')));_0x5a4a51[_0xff8a('0x8')]('/api/integrations/desk/configurations',require(_0xff8a('0xab')));_0x5a4a51[_0xff8a('0x8')]('/api/integrations/desk/fields',require(_0xff8a('0xac')));_0x5a4a51['use'](_0xff8a('0xad'),require(_0xff8a('0xae')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xaf'),require(_0xff8a('0xb0')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xb1'),require(_0xff8a('0xb2')));_0x5a4a51[_0xff8a('0x8')]('/api/integrations/zendesk/accounts',require(_0xff8a('0xb3')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xb4'),require(_0xff8a('0xb5')));_0x5a4a51['use'](_0xff8a('0xb6'),require(_0xff8a('0xb7')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xb8'),require(_0xff8a('0xb9')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xba'),require(_0xff8a('0xbb')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xbc'),require(_0xff8a('0xbd')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xbe'),require(_0xff8a('0xbf')));_0x5a4a51['use']('/api/integrations/vtiger/configurations',require(_0xff8a('0xc0')));_0x5a4a51[_0xff8a('0x8')]('/api/integrations/vtiger/fields',require(_0xff8a('0xc1')));_0x5a4a51[_0xff8a('0x8')]('/api/integrations/servicenow/accounts',require(_0xff8a('0xc2')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xc3'),require(_0xff8a('0xc4')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xc5'),require(_0xff8a('0xc6')));_0x5a4a51['use'](_0xff8a('0xc7'),require(_0xff8a('0xc8')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xc9'),require(_0xff8a('0xca')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xcb'),require(_0xff8a('0xcc')));_0x5a4a51['use']('/api/integrations/freshsales/accounts',require(_0xff8a('0xcd')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xce'),require(_0xff8a('0xcf')));_0x5a4a51['use'](_0xff8a('0xd0'),require(_0xff8a('0xd1')));_0x5a4a51['use']('/api/networks',require('./api/network'));_0x5a4a51[_0xff8a('0x8')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xd2'),require('./api/chatInternalMessage'));_0x5a4a51['use'](_0xff8a('0xd3'),require(_0xff8a('0xd4')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xd5'),require('./api/jscriptyQuestionReport'));_0x5a4a51[_0xff8a('0x8')]('/api/jscripty/sessions/reports',require(_0xff8a('0xd6')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xd7'),require(_0xff8a('0xd8')));_0x5a4a51[_0xff8a('0x8')]('/api/square/reports',require(_0xff8a('0xd9')));_0x5a4a51['use']('/api/square/details/reports',require(_0xff8a('0xda')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xdb'),require(_0xff8a('0xdc')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xdd'),require(_0xff8a('0xde')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xdf'),require(_0xff8a('0xe0')));_0x5a4a51['use']('/api/square/projects',require(_0xff8a('0xe1')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xe2'),require(_0xff8a('0xe3')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xe4'),require(_0xff8a('0xe5')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xe6'),require('./api/team'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xe7'),require(_0xff8a('0xe8')));_0x5a4a51[_0xff8a('0x8')]('/api/campaigns',require('./api/campaign'));_0x5a4a51[_0xff8a('0x8')]('/api/migrations',require(_0xff8a('0xe9')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xea'),require(_0xff8a('0xeb')));_0x5a4a51['use'](_0xff8a('0xec'),require(_0xff8a('0xed')));_0x5a4a51['use']('/api/mail/reports/transfer',require(_0xff8a('0xee')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xef'),require(_0xff8a('0xf0')));_0x5a4a51['use'](_0xff8a('0xf1'),require(_0xff8a('0xf2')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xf3'),require(_0xff8a('0xf4')));_0x5a4a51['use'](_0xff8a('0xf5'),require(_0xff8a('0xf6')));_0x5a4a51[_0xff8a('0x8')]('/api/cm/lists',require(_0xff8a('0xf7')));_0x5a4a51[_0xff8a('0x8')]('/api/voice/prefixes',require(_0xff8a('0xf8')));_0x5a4a51['use'](_0xff8a('0xf9'),require(_0xff8a('0xfa')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xfb'),require(_0xff8a('0xfc')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xfd'),require(_0xff8a('0xfe')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0xff'),require(_0xff8a('0x100')));_0x5a4a51['use']('/api/whatsapp/accounts',require(_0xff8a('0x101')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x102'),require(_0xff8a('0x103')));_0x5a4a51['use'](_0xff8a('0x104'),require('./api/whatsappInteraction'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x105'),require(_0xff8a('0x106')));_0x5a4a51['use'](_0xff8a('0x107'),require('./api/whatsappQueueReport'));_0x5a4a51[_0xff8a('0x8')]('/api/whatsapp/reports/transfer',require(_0xff8a('0x108')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x109'),require(_0xff8a('0x10a')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x10b'),require(_0xff8a('0x10c')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x10d'),require('./api/authLocal'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x10e'),require('./api/authGoogle'));_0x5a4a51[_0xff8a('0x8')]('/api/jira',require(_0xff8a('0x10f')));_0x5a4a51['use'](_0xff8a('0x110'),require(_0xff8a('0x111')));_0x5a4a51['use'](_0xff8a('0x112'),require(_0xff8a('0x113')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x114'),require('./api/system'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x115'),require('./api/pm2'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x116'),require('./api/webbar'));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x117'),express[_0xff8a('0x118')](path['join'](config[_0xff8a('0x119')],'/apidoc')));_0x5a4a51['use'](_0xff8a('0x11a'),express[_0xff8a('0x118')](path['join'](config['root'],'/www')));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x11b'),express[_0xff8a('0x118')](path[_0xff8a('0x11c')](config[_0xff8a('0x119')],_0xff8a('0x11b'))));_0x5a4a51[_0xff8a('0x8')](_0xff8a('0x11d'),express['static'](path[_0xff8a('0x11c')](config[_0xff8a('0x119')],_0xff8a('0x11e'),_0xff8a('0x11f'))));_0x5a4a51['use'](_0xff8a('0x120'),express[_0xff8a('0x118')](path['join'](config[_0xff8a('0x119')],_0xff8a('0x121'))));_0x5a4a51[_0xff8a('0x122')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xff8a('0x123')](errors[0x194]);_0x5a4a51[_0xff8a('0x122')]('/*')['get'](function(_0x2701de,_0x3d4fca){_0x3d4fca[_0xff8a('0x124')](path[_0xff8a('0x125')](_0x5a4a51[_0xff8a('0x123')](_0xff8a('0x126'))+'/index.html'));});};var sensitiveFields=[_0xff8a('0x127'),_0xff8a('0x128'),'newPassword',_0xff8a('0x129'),_0xff8a('0x12a'),_0xff8a('0x12b'),'street',_0xff8a('0x12c'),_0xff8a('0x12d'),_0xff8a('0x12e'),_0xff8a('0x12f'),_0xff8a('0x130'),'clientSecret','securityToken',_0xff8a('0x131'),_0xff8a('0x132'),'tenantId',_0xff8a('0x133'),_0xff8a('0x134'),_0xff8a('0x135'),_0xff8a('0x136'),_0xff8a('0x137'),'consumerKey','consumerSecret',_0xff8a('0x138'),_0xff8a('0x139'),_0xff8a('0x13a'),_0xff8a('0x13b'),_0xff8a('0x13c'),'clientEmail',_0xff8a('0x13d'),_0xff8a('0x13e'),_0xff8a('0x13f'),_0xff8a('0x140'),_0xff8a('0x15'),_0xff8a('0x141'),_0xff8a('0x142'),_0xff8a('0x143'),_0xff8a('0x144'),_0xff8a('0x145'),_0xff8a('0x146'),_0xff8a('0x147')];function maskSensitiveData(_0x483094){var _0x3ed9fd=/(?!^)[\s\S](?!$)/g;if(!_[_0xff8a('0x148')](_0x483094))return;for(var _0x19ded6 in _0x483094){if(_[_0xff8a('0x149')](_0x483094[_0x19ded6])){for(var _0x1c6234=0x0;_0x1c6234<_0x483094[_0x19ded6][_0xff8a('0x14a')];_0x1c6234++){maskSensitiveData(_0x483094[_0x19ded6][_0x1c6234]);}}else if(_[_0xff8a('0x148')](_0x483094[_0x19ded6])){maskSensitiveData(_0x483094[_0x19ded6]);}else if(_[_0xff8a('0x14b')](_0x483094[_0x19ded6])){_0x483094[_0x19ded6]=_0x483094[_0x19ded6][_0xff8a('0x14c')](/{{{/g,'@@{')[_0xff8a('0x14c')](/}}}/g,'}@@')[_0xff8a('0x14c')](/{{/g,'@{')[_0xff8a('0x14c')](/}}/g,'}@');if(_[_0xff8a('0x14d')](sensitiveFields,_0x19ded6)){_0x483094[_0x19ded6]=_0x483094[_0x19ded6][_0xff8a('0x14c')](_0x3ed9fd,'*');}}}} \ No newline at end of file +var _0xbb1f=['/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','static','/demo','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','password','apiKey','firstName','lastName','street','phone','fax','clientId','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','registry','isArray','isPlainObject','isString','@@{','replace','includes','lodash','path','express','express-winston','util','./errors','api','./config/logger','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','user','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','name','other','agent_name','test','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/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/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/templates','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/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/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc'];(function(_0x1e7b2e,_0x400f3e){var _0x4e3afd=function(_0x5d69e4){while(--_0x5d69e4){_0x1e7b2e['push'](_0x1e7b2e['shift']());}};_0x4e3afd(++_0x400f3e);}(_0xbb1f,0x68));var _0xfbb1=function(_0x3145af,_0x53a1d5){_0x3145af=_0x3145af-0x0;var _0x37758a=_0xbb1f[_0x3145af];return _0x37758a;};'use strict';var _=require(_0xfbb1('0x0'));var path=require(_0xfbb1('0x1'));var express=require(_0xfbb1('0x2'));var ewinston=require(_0xfbb1('0x3'));var util=require(_0xfbb1('0x4'));var errors=require(_0xfbb1('0x5'));var config=require('./config/environment');var logger=require('./config/logger')(_0xfbb1('0x6'));var authLogger=require(_0xfbb1('0x7'))('auth');exports[_0xfbb1('0x8')]=function(_0x211722){_0x211722['use'](ewinston[_0xfbb1('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5f4878,_0x1bd9e1){var _0x59b36a=_0xfbb1('0xa');if(!_[_0xfbb1('0xb')](_0x5f4878[_0xfbb1('0xc')])){_0x59b36a+=_0xfbb1('0xd');var _0x401f5c=_0x5f4878[_0xfbb1('0xc')];maskSensitiveData(_0x401f5c);}return util['format'](_0x59b36a,_0x5f4878[_0xfbb1('0xe')],_0x5f4878['headers'][_0xfbb1('0xf')]?_0x5f4878[_0xfbb1('0x10')][_0xfbb1('0xf')]:_0x5f4878[_0xfbb1('0x11')][_0xfbb1('0x12')]||_0x5f4878['ip'],_0x5f4878[_0xfbb1('0x13')],_0x1bd9e1[_0xfbb1('0x14')],_0x1bd9e1[_0xfbb1('0x15')],_0x5f4878[_0xfbb1('0x16')]?_0x5f4878['user']['id']:null,_0x5f4878[_0xfbb1('0x16')]?_0x5f4878[_0xfbb1('0x16')]['name']:null,_0x5f4878[_0xfbb1('0x16')]?_0x5f4878[_0xfbb1('0x16')][_0xfbb1('0x17')]:null,_0x401f5c?util['inspect'](_0x401f5c,![],null):'');}}));_0x211722['use'](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x18ab61,_0x24e9c4){var _0x56475b=_0xfbb1('0x18');if(_0x18ab61[_0xfbb1('0xc')]&&_0x18ab61['body'][_0xfbb1('0x19')]&&_0x18ab61[_0xfbb1('0xc')][_0xfbb1('0x1a')]){_0x56475b=_0xfbb1('0x1b');}return util[_0xfbb1('0x1c')](_0x56475b,_0x18ab61['method'],_0x18ab61['headers'][_0xfbb1('0xf')]?_0x18ab61[_0xfbb1('0x10')][_0xfbb1('0xf')]:_0x18ab61['connection'][_0xfbb1('0x12')]||_0x18ab61['ip'],_0x18ab61[_0xfbb1('0x13')],_0x24e9c4[_0xfbb1('0x14')],_0x24e9c4[_0xfbb1('0x15')],_0x18ab61[_0xfbb1('0x16')]?_0x18ab61[_0xfbb1('0x16')]['id']:null,_0x18ab61[_0xfbb1('0x16')]?_0x18ab61['user'][_0xfbb1('0x1d')]:null,_0x18ab61['user']?_0x18ab61[_0xfbb1('0x16')][_0xfbb1('0x17')]:null,_0x18ab61[_0xfbb1('0xc')]&&_0x18ab61[_0xfbb1('0xc')][_0xfbb1('0x19')]?_0x18ab61[_0xfbb1('0xc')]['device']:_0xfbb1('0x1e'),_0x18ab61[_0xfbb1('0xc')]&&_0x18ab61[_0xfbb1('0xc')][_0xfbb1('0x1a')]?_0x18ab61[_0xfbb1('0xc')][_0xfbb1('0x1a')]:'',_0x18ab61[_0xfbb1('0xc')]&&_0x18ab61[_0xfbb1('0xc')][_0xfbb1('0x1f')]?_0x18ab61[_0xfbb1('0xc')][_0xfbb1('0x1f')]:'');},'ignoreRoute':function(_0x3971fc){var _0x2e1cbb=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2e1cbb[_0xfbb1('0x20')](_0x3971fc['url']);}}));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x22'),require(_0xfbb1('0x23')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x24'),require(_0xfbb1('0x25')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x26'),require(_0xfbb1('0x27')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x28'),require('./api/voiceExtension'));_0x211722['use']('/api/voice/mohs',require(_0xfbb1('0x29')));_0x211722['use']('/api/voice/queues',require(_0xfbb1('0x2a')));_0x211722[_0xfbb1('0x21')]('/api/voice/recordings',require(_0xfbb1('0x2b')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x2c'),require(_0xfbb1('0x2d')));_0x211722['use'](_0xfbb1('0x2e'),require('./api/voiceMail'));_0x211722[_0xfbb1('0x21')]('/api/voice/mails/messages',require(_0xfbb1('0x2f')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x30'),require(_0xfbb1('0x31')));_0x211722['use']('/api/voice/dials/reports',require(_0xfbb1('0x32')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x33'),require(_0xfbb1('0x34')));_0x211722[_0xfbb1('0x21')]('/api/voice/queues/reports',require(_0xfbb1('0x35')));_0x211722[_0xfbb1('0x21')]('/api/members/reports',require('./api/memberReport'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x36'),require(_0xfbb1('0x37')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x38'),require('./api/voiceTransferReport'));_0x211722[_0xfbb1('0x21')]('/api/mail/out_servers',require(_0xfbb1('0x39')));_0x211722['use']('/api/mail/accounts',require(_0xfbb1('0x3a')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x3b'),require(_0xfbb1('0x3c')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x3d'),require(_0xfbb1('0x3e')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x3f'),require('./api/mailInteraction'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x40'),require('./api/mailMessage'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x41'),require(_0xfbb1('0x42')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x43'),require(_0xfbb1('0x44')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x45'),require(_0xfbb1('0x46')));_0x211722[_0xfbb1('0x21')]('/api/dashboards/items',require(_0xfbb1('0x47')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x48'),require(_0xfbb1('0x49')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x4a'),require(_0xfbb1('0x4b')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x4c'),require(_0xfbb1('0x4d')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x4e'),require(_0xfbb1('0x4f')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x50'),require(_0xfbb1('0x51')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x52'),require(_0xfbb1('0x53')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x54'),require(_0xfbb1('0x55')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x56'),require(_0xfbb1('0x57')));_0x211722['use'](_0xfbb1('0x58'),require(_0xfbb1('0x59')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x5a'),require(_0xfbb1('0x5b')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x5c'),require('./api/smsQueue'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x5d'),require('./api/openchannelAccount'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x5e'),require(_0xfbb1('0x5f')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x60'),require('./api/openchannelInteraction'));_0x211722['use'](_0xfbb1('0x61'),require(_0xfbb1('0x62')));_0x211722['use'](_0xfbb1('0x63'),require(_0xfbb1('0x64')));_0x211722[_0xfbb1('0x21')]('/api/chat/websites',require(_0xfbb1('0x65')));_0x211722['use']('/api/openchannel/reports/queue',require(_0xfbb1('0x66')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x67'),require(_0xfbb1('0x68')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x69'),require(_0xfbb1('0x6a')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x6b'),require(_0xfbb1('0x6c')));_0x211722['use'](_0xfbb1('0x6d'),require(_0xfbb1('0x6e')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x6f'),require(_0xfbb1('0x70')));_0x211722['use'](_0xfbb1('0x71'),require(_0xfbb1('0x72')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x73'),require(_0xfbb1('0x74')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x75'),require(_0xfbb1('0x76')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x77'),require(_0xfbb1('0x78')));_0x211722['use'](_0xfbb1('0x79'),require(_0xfbb1('0x7a')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x7b'),require(_0xfbb1('0x7c')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x7d'),require(_0xfbb1('0x7e')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x7f'),require(_0xfbb1('0x80')));_0x211722[_0xfbb1('0x21')]('/api/cm/custom_fields',require(_0xfbb1('0x81')));_0x211722['use'](_0xfbb1('0x82'),require(_0xfbb1('0x83')));_0x211722['use']('/api/automations',require('./api/automation'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x84'),require('./api/cannedAnswer'));_0x211722['use'](_0xfbb1('0x85'),require(_0xfbb1('0x86')));_0x211722['use'](_0xfbb1('0x87'),require(_0xfbb1('0x88')));_0x211722['use']('/api/intervals',require(_0xfbb1('0x89')));_0x211722['use'](_0xfbb1('0x8a'),require(_0xfbb1('0x8b')));_0x211722[_0xfbb1('0x21')]('/api/cdr',require('./api/cdr'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x8c'),require(_0xfbb1('0x8d')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x8e'),require(_0xfbb1('0x8f')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x90'),require(_0xfbb1('0x91')));_0x211722['use']('/api/tags',require(_0xfbb1('0x92')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x93'),require('./api/template'));_0x211722[_0xfbb1('0x21')]('/api/triggers',require('./api/trigger'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x94'),require(_0xfbb1('0x95')));_0x211722['use'](_0xfbb1('0x96'),require('./api/integration'));_0x211722['use'](_0xfbb1('0x97'),require(_0xfbb1('0x98')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x99'),require(_0xfbb1('0x9a')));_0x211722[_0xfbb1('0x21')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x9b'),require(_0xfbb1('0x9c')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x9d'),require(_0xfbb1('0x9e')));_0x211722[_0xfbb1('0x21')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x9f'),require(_0xfbb1('0xa0')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xa1'),require(_0xfbb1('0xa2')));_0x211722[_0xfbb1('0x21')]('/api/integrations/salesforce/configurations',require(_0xfbb1('0xa3')));_0x211722['use']('/api/integrations/salesforce/fields',require(_0xfbb1('0xa4')));_0x211722['use'](_0xfbb1('0xa5'),require(_0xfbb1('0xa6')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xa7'),require(_0xfbb1('0xa8')));_0x211722['use'](_0xfbb1('0xa9'),require(_0xfbb1('0xaa')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xab'),require('./api/intDeskAccount'));_0x211722[_0xfbb1('0x21')]('/api/integrations/desk/configurations',require(_0xfbb1('0xac')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xad'),require(_0xfbb1('0xae')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xaf'),require('./api/intZohoAccount'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xb0'),require(_0xfbb1('0xb1')));_0x211722[_0xfbb1('0x21')]('/api/integrations/zoho/fields',require(_0xfbb1('0xb2')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xb3'),require(_0xfbb1('0xb4')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xb5'),require(_0xfbb1('0xb6')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xb7'),require('./api/intZendeskField'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xb8'),require(_0xfbb1('0xb9')));_0x211722[_0xfbb1('0x21')]('/api/integrations/freshdesk/configurations',require(_0xfbb1('0xba')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xbb'),require(_0xfbb1('0xbc')));_0x211722[_0xfbb1('0x21')]('/api/integrations/vtiger/accounts',require(_0xfbb1('0xbd')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xbe'),require(_0xfbb1('0xbf')));_0x211722[_0xfbb1('0x21')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xc0'),require('./api/intServicenowAccount'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xc1'),require(_0xfbb1('0xc2')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xc3'),require('./api/intServicenowField'));_0x211722['use']('/api/integrations/dynamics365/accounts',require(_0xfbb1('0xc4')));_0x211722[_0xfbb1('0x21')]('/api/integrations/dynamics365/configurations',require(_0xfbb1('0xc5')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xc6'),require(_0xfbb1('0xc7')));_0x211722['use'](_0xfbb1('0xc8'),require('./api/intFreshsalesAccount'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xc9'),require(_0xfbb1('0xca')));_0x211722['use'](_0xfbb1('0xcb'),require('./api/intFreshsalesField'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xcc'),require(_0xfbb1('0xcd')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xce'),require(_0xfbb1('0xcf')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xd0'),require(_0xfbb1('0xd1')));_0x211722['use'](_0xfbb1('0xd2'),require('./api/jscriptyAnswerReport'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xd3'),require(_0xfbb1('0xd4')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xd5'),require(_0xfbb1('0xd6')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xd7'),require(_0xfbb1('0xd8')));_0x211722['use'](_0xfbb1('0xd9'),require(_0xfbb1('0xda')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xdb'),require('./api/squareReportDetail'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xdc'),require(_0xfbb1('0xdd')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xde'),require(_0xfbb1('0xdf')));_0x211722['use'](_0xfbb1('0xe0'),require('./api/squareOdbc'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xe1'),require(_0xfbb1('0xe2')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xe3'),require(_0xfbb1('0xe4')));_0x211722['use'](_0xfbb1('0xe5'),require('./api/squareMessage'));_0x211722['use'](_0xfbb1('0xe6'),require('./api/team'));_0x211722[_0xfbb1('0x21')]('/api/license',require(_0xfbb1('0xe7')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xe8'),require(_0xfbb1('0xe9')));_0x211722[_0xfbb1('0x21')]('/api/migrations',require(_0xfbb1('0xea')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xeb'),require('./api/attachment'));_0x211722['use'](_0xfbb1('0xec'),require(_0xfbb1('0xed')));_0x211722['use']('/api/mail/reports/transfer',require(_0xfbb1('0xee')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xef'),require(_0xfbb1('0xf0')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xf1'),require('./api/faxTransferReport'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xf2'),require('./api/openchannelTransferReport'));_0x211722[_0xfbb1('0x21')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x211722[_0xfbb1('0x21')]('/api/cm/lists',require('./api/cmList'));_0x211722[_0xfbb1('0x21')]('/api/voice/prefixes',require(_0xfbb1('0xf3')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xf4'),require(_0xfbb1('0xf5')));_0x211722['use']('/api/userProfile/sections',require(_0xfbb1('0xf6')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xf7'),require(_0xfbb1('0xf8')));_0x211722[_0xfbb1('0x21')]('/api/userNotifications',require(_0xfbb1('0xf9')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xfa'),require('./api/whatsappAccount'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xfb'),require(_0xfbb1('0xfc')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xfd'),require(_0xfbb1('0xfe')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xff'),require(_0xfbb1('0x100')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x101'),require(_0xfbb1('0x102')));_0x211722[_0xfbb1('0x21')]('/api/whatsapp/reports/transfer',require(_0xfbb1('0x103')));_0x211722['use'](_0xfbb1('0x104'),require('./api/whatsappQueue'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x105'),require(_0xfbb1('0x106')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x107'),require('./api/authLocal'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x108'),require(_0xfbb1('0x109')));_0x211722['use'](_0xfbb1('0x10a'),require(_0xfbb1('0x10b')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x10c'),require(_0xfbb1('0x10d')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x10e'),require(_0xfbb1('0x10f')));_0x211722[_0xfbb1('0x21')]('/api/system',require(_0xfbb1('0x110')));_0x211722['use'](_0xfbb1('0x111'),require(_0xfbb1('0x112')));_0x211722['use'](_0xfbb1('0x113'),require(_0xfbb1('0x114')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x115'),express['static'](path[_0xfbb1('0x116')](config[_0xfbb1('0x117')],'/apidoc')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x118'),express[_0xfbb1('0x119')](path[_0xfbb1('0x116')](config[_0xfbb1('0x117')],_0xfbb1('0x118'))));_0x211722[_0xfbb1('0x21')]('/demo',express[_0xfbb1('0x119')](path[_0xfbb1('0x116')](config[_0xfbb1('0x117')],_0xfbb1('0x11a'))));_0x211722[_0xfbb1('0x21')]('/snippet',express['static'](path['join'](config[_0xfbb1('0x117')],_0xfbb1('0x11b'),_0xfbb1('0x11c'))));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x11d'),express[_0xfbb1('0x119')](path['join'](config[_0xfbb1('0x117')],_0xfbb1('0x11e'))));_0x211722[_0xfbb1('0x11f')](_0xfbb1('0x120'))[_0xfbb1('0x121')](errors[0x194]);_0x211722[_0xfbb1('0x11f')]('/*')[_0xfbb1('0x121')](function(_0x10c27a,_0x145d28){_0x145d28[_0xfbb1('0x122')](path[_0xfbb1('0x123')](_0x211722[_0xfbb1('0x121')](_0xfbb1('0x124'))+_0xfbb1('0x125')));});};var sensitiveFields=['username',_0xfbb1('0x126'),'newPassword',_0xfbb1('0x127'),_0xfbb1('0x128'),_0xfbb1('0x129'),_0xfbb1('0x12a'),_0xfbb1('0x12b'),'mobile',_0xfbb1('0x12c'),'email',_0xfbb1('0x12d'),_0xfbb1('0x12e'),'securityToken',_0xfbb1('0x12f'),_0xfbb1('0x130'),_0xfbb1('0x131'),'token',_0xfbb1('0x132'),'accessToken',_0xfbb1('0x133'),'authToken',_0xfbb1('0x134'),_0xfbb1('0x135'),_0xfbb1('0x136'),_0xfbb1('0x137'),_0xfbb1('0x138'),'exten',_0xfbb1('0x139'),_0xfbb1('0x13a'),'privateKey',_0xfbb1('0x13b'),_0xfbb1('0x13c'),_0xfbb1('0x13d'),_0xfbb1('0x16'),_0xfbb1('0x13e'),_0xfbb1('0x13f'),_0xfbb1('0x140'),_0xfbb1('0x141'),'secret',_0xfbb1('0x142'),'oldPassword'];function maskSensitiveData(_0x2c8feb){var _0x18e570=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x2c8feb))return;for(var _0x5e1015 in _0x2c8feb){if(_[_0xfbb1('0x143')](_0x2c8feb[_0x5e1015])){for(var _0xfa8d0=0x0;_0xfa8d0<_0x2c8feb[_0x5e1015]['length'];_0xfa8d0++){maskSensitiveData(_0x2c8feb[_0x5e1015][_0xfa8d0]);}}else if(_[_0xfbb1('0x144')](_0x2c8feb[_0x5e1015])){maskSensitiveData(_0x2c8feb[_0x5e1015]);}else if(_[_0xfbb1('0x145')](_0x2c8feb[_0x5e1015])){_0x2c8feb[_0x5e1015]=_0x2c8feb[_0x5e1015]['replace'](/{{{/g,_0xfbb1('0x146'))[_0xfbb1('0x147')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xfbb1('0x147')](/}}/g,'}@');if(_[_0xfbb1('0x148')](sensitiveFields,_0x5e1015)){_0x2c8feb[_0x5e1015]=_0x2c8feb[_0x5e1015]['replace'](_0x18e570,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index d4ac4f5..be65406 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7502=['../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/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/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc'];(function(_0x26ea4d,_0x89894f){var _0x1bfadc=function(_0x233602){while(--_0x233602){_0x26ea4d['push'](_0x26ea4d['shift']());}};_0x1bfadc(++_0x89894f);}(_0x7502,0x16d));var _0x2750=function(_0x1640a6,_0x4f84e4){_0x1640a6=_0x1640a6-0x0;var _0x3daa6c=_0x7502[_0x1640a6];return _0x3daa6c;};'use strict';var jayson=require(_0x2750('0x0'));var BPromise=require(_0x2750('0x1'));var _=require(_0x2750('0x2'));var config=require(_0x2750('0x3'));exports[_0x2750('0x4')]=function(){return new BPromise(function(_0x4c921d,_0x59447c){var _0x4cb431={};_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require('../api/user/user.rpc'));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x6')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x7')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x8')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x9')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0xa')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0xb')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0xc')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require('../api/memberReport/memberReport.rpc'));_0x4cb431=_['merge'](_0x4cb431,require('../api/trunk/trunk.rpc'));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0xd')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0xe')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0xf')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x10')));_0x4cb431=_['merge'](_0x4cb431,require('../api/mailQueue/mailQueue.rpc'));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require('../api/mailInteraction/mailInteraction.rpc'));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x11')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x12')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x13')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require('../api/faxAccount/faxAccount.rpc'));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x14')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x15')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x16')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x17')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x18')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x19')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x1a')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x1b')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x1c')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x1d')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x1e')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x1f')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x20')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x21')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x22')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x23')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x24')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x25')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x26')));_0x4cb431=_['merge'](_0x4cb431,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x27')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x28')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x29')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x2a')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require('../api/sound/sound.rpc'));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x2b')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x2c')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x2d')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x2e')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x2f')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x30')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x31')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x32')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x33')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x34')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x35')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x36')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x37')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x38')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x39')));_0x4cb431=_['merge'](_0x4cb431,require(_0x2750('0x3a')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require('../api/squareOdbc/squareOdbc.rpc'));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x3b')));_0x4cb431=_['merge'](_0x4cb431,require('../api/squareRecording/squareRecording.rpc'));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x3c')));_0x4cb431=_['merge'](_0x4cb431,require('../api/campaign/campaign.rpc'));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x3d')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require('../api/plugin/plugin.rpc'));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x3e')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x3f')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x40')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x41')));_0x4cb431=_[_0x2750('0x5')](_0x4cb431,require(_0x2750('0x42')));var _0x5547a4=jayson[_0x2750('0x43')](_0x4cb431)[_0x2750('0x44')]();var _0x89a9c=config[_0x2750('0x45')][_0x2750('0x46')]||config['port']+0x1;var _0x482b99=config['rpc']['ip']||_0x2750('0x47');_0x5547a4['on'](_0x2750('0x48'),function(_0x2799f2){return _0x59447c(_0x2799f2);});_0x5547a4[_0x2750('0x4')](_0x89a9c,_0x482b99,function(){console[_0x2750('0x49')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x482b99,_0x89a9c);require('../config/triggers')[_0x2750('0x4a')]();return _0x4c921d(_0x2750('0x4b')+_0x482b99+':'+_0x89a9c);});});}; \ No newline at end of file +var _0x01eb=['server','http','rpc','port','localhost','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc'];(function(_0x57978b,_0x8e259b){var _0x578535=function(_0x314e8c){while(--_0x314e8c){_0x57978b['push'](_0x57978b['shift']());}};_0x578535(++_0x8e259b);}(_0x01eb,0x101));var _0xb01e=function(_0xf64500,_0x410815){_0xf64500=_0xf64500-0x0;var _0x58a6e0=_0x01eb[_0xf64500];return _0x58a6e0;};'use strict';var jayson=require(_0xb01e('0x0'));var BPromise=require(_0xb01e('0x1'));var _=require(_0xb01e('0x2'));var config=require(_0xb01e('0x3'));exports[_0xb01e('0x4')]=function(){return new BPromise(function(_0x14eb9b,_0x4034c7){var _0x39c3a3={};_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/user/user.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/voiceExtension/voiceExtension.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x6')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x7')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x8')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x9')));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0xa')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0xb')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/trunk/trunk.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0xc')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/mailServerIn/mailServerIn.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0xd')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/mailQueue/mailQueue.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0xe')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/mailMessage/mailMessage.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0xf')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x10')));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/faxAccount/faxAccount.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x11')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x12')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/faxMessage/faxMessage.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x13')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x14')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/smsAccount/smsAccount.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x15')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x16')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x17')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x18')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x19')));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x1a')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/chatInteraction/chatInteraction.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x1b')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x1c')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/cmContact/cmContact.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/cmHopper/cmHopper.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x1d')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x1e')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x1f')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/pause/pause.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/sound/sound.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x20')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x21')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x22')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x23')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x24')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x25')));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x26')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x27')));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x28')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x29')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x2a')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x2b')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/squareOdbc/squareOdbc.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/squareProject/squareProject.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x2c')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x2d')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x2e')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x2f')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x30')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x31')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x32')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x33')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x34')));var _0x1614da=jayson[_0xb01e('0x35')](_0x39c3a3)[_0xb01e('0x36')]();var _0x3ecb77=config[_0xb01e('0x37')][_0xb01e('0x38')]||config[_0xb01e('0x38')]+0x1;var _0x2a400e=config[_0xb01e('0x37')]['ip']||_0xb01e('0x39');_0x1614da['on']('error',function(_0x8d3f8a){return _0x4034c7(_0x8d3f8a);});_0x1614da['listen'](_0x3ecb77,_0x2a400e,function(){console[_0xb01e('0x3a')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x2a400e,_0x3ecb77);require(_0xb01e('0x3b'))[_0xb01e('0x3c')]();return _0x14eb9b(_0xb01e('0x3d')+_0x2a400e+':'+_0x3ecb77);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 2cbbf94..90daf6a 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 _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x12918b,_0x15b2f5){var _0x1ac580=function(_0x7a3b5a){while(--_0x7a3b5a){_0x12918b['push'](_0x12918b['shift']());}};_0x1ac580(++_0x15b2f5);}(_0x70e0,0x17b));var _0x070e=function(_0x5e356a,_0x468734){_0x5e356a=_0x5e356a-0x0;var _0x4db137=_0x70e0[_0x5e356a];return _0x4db137;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file +var _0xedd9=['getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','exec','isArray','EXEC\x20%s\x20%s','join','setContext','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','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xedd9,0xfc));var _0x9edd=function(_0x25fa82,_0xb1dfd7){_0x25fa82=_0x25fa82-0x0;var _0x475404=_0xedd9[_0x25fa82];return _0x475404;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var EventEmitter=require(_0x9edd('0x1'))[_0x9edd('0x2')];var AGIReply=require(_0x9edd('0x3'));var AGIError=require(_0x9edd('0x4'));function AGIChannel(_0x127cbe){var _0x3e6d3a=this,_0x36b53f=new AGIReply(),_0x5943b3=![],_0x33679f={};EventEmitter[_0x9edd('0x5')](_0x3e6d3a);_0x127cbe[_0x9edd('0x6')](_0x9edd('0x7'));_0x127cbe['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x36b53f[_0x9edd('0x6')]('utf8');_0x36b53f['on'](_0x9edd('0x8'),function(_0x190185){for(var _0x1355be in _0x190185){_0x3e6d3a[_0x1355be]=_0x190185[_0x1355be];}_0x3e6d3a[_0x9edd('0x9')]('ready');});_0x36b53f['on'](_0x9edd('0xa'),function(_0x5d2f90){if(_0x5d2f90[_0x9edd('0xb')]()==_0x9edd('0xc')){_0x3e6d3a['emit'](_0x9edd('0xc'));return;}if(_0x5d2f90[_0x9edd('0xd')](0x0,0xb)=='520-Invalid'){_0x5943b3=!![];}if(_0x5943b3){_0x33679f['rx']+=_0x5d2f90+'\x0a';if(_0x5d2f90[_0x9edd('0xe')](_0x9edd('0xf'))!=-0x1){_0x5943b3=![];}}else{_0x33679f['rx']=_0x5d2f90;}if(_0x5943b3){return;}if(typeof _0x33679f['cb']==_0x9edd('0x10')){var _0xfd544a=_0x33679f['rx'][_0x9edd('0xd')](0x0,0x3),_0x287ddd=null,_0x3a7b84=null;_0xfd544a=parseInt(_0xfd544a);if(isNaN(_0xfd544a)){_0x33679f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9edd('0x11')});return;}if(_0xfd544a!=0xc8){_0x33679f['cb'](null,{'code':_0xfd544a,'result':-0x1,'extra':'KO'});return;}_0x287ddd=_0x33679f['rx']['substring'](0x4)[_0x9edd('0x12')](_0x9edd('0x13'),'');if(_0x287ddd[_0x9edd('0x14')]('\x20')!=-0x1){_0x287ddd=_0x287ddd[_0x9edd('0x15')](0x0,_0x287ddd[_0x9edd('0x14')]('\x20'));}if(_[_0x9edd('0x16')](_0x287ddd,'-1')){_0x287ddd=parseInt(_0x287ddd);}_0x3a7b84=_0x33679f['rx'][_0x9edd('0x17')]('\x20');if(_0x3a7b84[_0x9edd('0x18')]==0x3){_0x3a7b84=_0x3a7b84[0x2]['substring'](0x1,_0x3a7b84[0x2][_0x9edd('0x18')]-0x1);}else if(_0x3a7b84[_0x9edd('0x18')]>0x3){var _0x449cee=/\((.+)\)/;var _0x5acf65=_0x33679f['rx'][_0x9edd('0x19')](_0x449cee);if(_0x5acf65){_0x3a7b84=_0x5acf65[0x1];}else{_0x3a7b84=null;}}else{_0x3a7b84=null;}_0x33679f['cb'](null,{'code':_0xfd544a,'result':_0x287ddd,'extra':_0x3a7b84});}});_0x127cbe['on'](_0x9edd('0x1a'),function(_0x40ba32){_0x3e6d3a['emit'](_0x9edd('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x40ba32[_0x9edd('0x1b')]));});_0x127cbe['on'](_0x9edd('0x1c'),function(){_0x3e6d3a['emit']('close',new AGIError(_0x9edd('0x1d')));});_0x127cbe['on']('timeout',function(){_0x3e6d3a[_0x9edd('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x127cbe[_0x9edd('0x1e')]();});_0x127cbe[_0x9edd('0x1f')](_0x36b53f);this['command']=function(_0x5823bc,_0x341d67){var _0x5823bc=_0x5823bc||'',_0x341d67=typeof _0x341d67=='function'?_0x341d67:new Function();_0x33679f={'tx':_0x5823bc,'rx':'','cb':_0x341d67};_0x127cbe[_0x9edd('0x20')](_0x5823bc+'\x0a');},this[_0x9edd('0x1c')]=function(){_0x127cbe[_0x9edd('0x1e')]();};}util[_0x9edd('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x9edd('0x22')]['sendRequest']=function(_0x46c383){return this[_0x9edd('0x23')][_0x9edd('0x24')](this,_0x46c383);};AGIChannel[_0x9edd('0x22')][_0x9edd('0x25')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x9edd('0x22')][_0x9edd('0x26')]=function(_0x8d67aa,_0x25e135,_0x3c2227){_0x8d67aa=_0x8d67aa===undefined?'beep':_0x8d67aa;_0x25e135=_0x25e135===undefined?'5':_0x25e135;_0x3c2227=_0x3c2227===undefined?'1':_0x3c2227;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x28'),_0x8d67aa,_0x25e135*0x3e8,_0x3c2227));};AGIChannel[_0x9edd('0x22')]['noop']=function(_0x238b22){_0x238b22=_0x238b22||_0x9edd('0x29');return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('VERBOSE\x20\x22%s\x22',_0x238b22));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2b')]=function(_0xbe87e1,_0x12c1bc){if(_[_0x9edd('0x2c')](_0x12c1bc)){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc[_0x9edd('0x2e')](',')));}return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2f')]=function(_0x1a6c23){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x30'),_0x1a6c23));};AGIChannel[_0x9edd('0x22')]['setExtension']=function(_0x2d2f88){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x31'),_0x2d2f88));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x32')]=function(_0x473068){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x33'),_0x473068));};AGIChannel[_0x9edd('0x22')][_0x9edd('0xc')]=function(){return this[_0x9edd('0x2a')](_0x9edd('0x34'));};AGIChannel['prototype'][_0x9edd('0x35')]=function(_0x5ed62d,_0x968303){var _0x148630=_[_0x9edd('0x36')](_0x968303)||_[_0x9edd('0x37')](_0x968303)?_0x968303[_0x9edd('0x38')]():_0x968303;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x39'),_0x5ed62d,_0x148630?_0x148630[_0x9edd('0x38')]()[_0x9edd('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3a')]=function(_0x5c0627,_0x1cbbac){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x5c0627,_0x1cbbac));};AGIChannel[_0x9edd('0x22')]['sayDigits']=function(_0x3ef1d5,_0x5658d6){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x3b'),_0x3ef1d5,_0x5658d6));};AGIChannel['prototype'][_0x9edd('0x3c')]=function(_0xcbd0ef,_0x2f8f61){return this['sendRequest'](util[_0x9edd('0x27')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xcbd0ef,_0x2f8f61));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3d')]=function(_0x50be2c,_0x315f52,_0x40fdfb){_0x315f52=_0x315f52||this[_0x9edd('0x3e')];_0x40fdfb=_0x40fdfb||0x1;this[_0x9edd('0x2f')](_0x50be2c);this['setExtension'](_0x315f52);this[_0x9edd('0x32')](_0x40fdfb);return this['noop'](util[_0x9edd('0x27')](_0x9edd('0x3f'),_0x50be2c,_0x315f52,_0x40fdfb));};AGIChannel['prototype'][_0x9edd('0x40')]=function(_0x49a128){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x41'),_0x49a128));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x42')]=function(_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x18c149,_0x2b081a){_0x4737ae=_0x4737ae||_0x9edd('0x43');_0x3ff512=_0x3ff512||'';_0x75efbe=_0x75efbe===undefined?-0x1:_0x75efbe==='-1'?-0x1:_0x75efbe*0x3e8;_0x18c149=_0x18c149===undefined?'':'s='+_0x18c149;_0x2b081a=_0x2b081a?_0x9edd('0x44'):'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x45'),_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x2b081a,_0x18c149));};AGIChannel['prototype'][_0x9edd('0x46')]=function(_0x2570e3,_0x2231c1){_0x2231c1=_0x2231c1||'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x47'),_0x2570e3,_0x2231c1));};AGIChannel[_0x9edd('0x22')]['agi']=function(_0x4a4656){return this['exec'](_0x9edd('0x48'),_0x4a4656);};AGIChannel['prototype'][_0x9edd('0x49')]=function(_0x19b56b){return this[_0x9edd('0x2b')](_0x9edd('0x4a'),_0x19b56b);};AGIChannel[_0x9edd('0x22')]['error']=function(_0x387fb8,_0x35e63c){this[_0x9edd('0x4b')](util['format'](_0x9edd('0x4c'),_0x387fb8['id'],_0x387fb8[_0x9edd('0x4d')],_0x35e63c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9edd('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 1326084..e296428 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 _0x1979=['Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','message','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Empty\x20command.'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x1979,0xa2));var _0x9197=function(_0x3f8743,_0x33973f){_0x3f8743=_0x3f8743-0x0;var _0x1f844c=_0x1979[_0x3f8743];return _0x1f844c;};'use strict';var util=require(_0x9197('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x9197('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x9197('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x9197('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x9197('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x9197('0x5'),'E_AGI_COMMAND_EMPTY':_0x9197('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x9197('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3620f7){var _0x3620f7=_0x3620f7||null,_0x2de293=_0x2de293||[],_0x2f9aed=0x1,_0x384180='';if(!error[_0x3620f7]){_0x3620f7=_0x9197('0x8');}_0x2de293[_0x9197('0x9')](error[_0x3620f7]);while(arguments[_0x2f9aed]){_0x2de293[_0x9197('0x9')](arguments[_0x2f9aed]);_0x2f9aed++;}_0x384180=util[_0x9197('0xa')]['apply'](util,_0x2de293);this[_0x9197('0xb')]=_0x384180;this['name']=_0x3620f7;}module[_0x9197('0xc')]=AGIError; \ No newline at end of file +var _0x5a52=['E_AGI_UNDEFINED','push','message','name','exports','util','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x5a52,0x18d));var _0x25a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a52[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x25a5('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x25a5('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x25a5('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x25a5('0x3'),'E_AGI_SOCKET_ERROR':_0x25a5('0x4'),'E_AGI_SOCKET_CLOSE':_0x25a5('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x25a5('0x6'),'E_AGI_COMMAND_EMPTY':_0x25a5('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x25a5('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2c210a){var _0x2c210a=_0x2c210a||null,_0x2c4b31=_0x2c4b31||[],_0x2d8920=0x1,_0x31a0a='';if(!error[_0x2c210a]){_0x2c210a=_0x25a5('0x9');}_0x2c4b31[_0x25a5('0xa')](error[_0x2c210a]);while(arguments[_0x2d8920]){_0x2c4b31[_0x25a5('0xa')](arguments[_0x2d8920]);_0x2d8920++;}_0x31a0a=util['format']['apply'](util,_0x2c4b31);this[_0x25a5('0xb')]=_0x31a0a;this[_0x25a5('0xc')]=_0x2c210a;}module[_0x25a5('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 24f3e1d..0b72cd4 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 _0x705f=['no\x20vertex\x20found','info','length','no\x20edge/s\x20available','condition','agicommand','target','menu','invalid','vswitch','includes','max\x20retry\x20reach','condition\x20not\x20found','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','push','size','relations','getVertex','traverseBFS'];(function(_0x40d0a8,_0x44c90e){var _0x43d6ff=function(_0x2321b8){while(--_0x2321b8){_0x40d0a8['push'](_0x40d0a8['shift']());}};_0x43d6ff(++_0x44c90e);}(_0x705f,0x75));var _0xf705=function(_0x221a0f,_0x3970f6){_0x221a0f=_0x221a0f-0x0;var _0x30309e=_0x705f[_0x221a0f];return _0x30309e;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0xf705('0x0'));var verticesWithRetry=['menu',_0xf705('0x1'),_0xf705('0x2')];var Graph=function(){this[_0xf705('0x3')]={};this[_0xf705('0x4')]={};this[_0xf705('0x5')]=0x0;};Graph[_0xf705('0x6')][_0xf705('0x7')]=function(_0x240742){this[_0xf705('0x3')][_0x240742['id']]=_0x240742;this[_0xf705('0x4')][_0x240742['id']]=[];};Graph[_0xf705('0x6')]['addEdge']=function(_0x51fda8,_0xc244e3,_0x58cae9){this[_0xf705('0x4')][_0x51fda8][_0xf705('0x8')]({'target':_0xc244e3,'condition':_0x58cae9});this['numberOfEdges']+=0x1;};Graph['prototype'][_0xf705('0x9')]=function(){return _[_0xf705('0x9')](this[_0xf705('0x3')]);};Graph[_0xf705('0x6')][_0xf705('0xa')]=function(){return this[_0xf705('0x5')];};Graph[_0xf705('0x6')][_0xf705('0xb')]=function(_0x4a92bb){return this[_0xf705('0x3')][_0x4a92bb];};Graph[_0xf705('0x6')][_0xf705('0xc')]=function(_0xf625da,_0x31e6f5){if(!this['vertices'][_0xf625da]){return logger['info'](_0xf705('0xd'));}var _0x10763f=_0x31e6f5(this[_0xf705('0x3')][_0xf625da]);if(!_0x10763f){return logger[_0xf705('0xe')]('stop\x20traverse');}if(this[_0xf705('0x4')][_0xf625da][_0xf705('0xf')]===0x0){return logger[_0xf705('0xe')](_0xf705('0x10'));}for(var _0x572efc=0x0,_0x11dcbc=[],_0x479b31=![];_0x572efc\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','info','[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','uniqueid','evtHangup','mxGraphModel','root','hasOwnProperty','retry','addVertex','omit','length','target','addEdge','source','value','getSquareProject','catch','createSquareReport','then','indexOf','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','debug','vertex','gotoc','context','extension','priority','response','isUndefined','result','toString','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','clear','agicommand','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','lodash','util','moment','../../config/environment','../../config/logger'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x5fc3,0xa8));var _0x35fc=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x5fc3[_0xdc37a1];return _0x99b4fe;};'use strict';var parser=require(_0x35fc('0x0'));var _=require(_0x35fc('0x1'));var syncho=require('syncho');var util=require(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var config=require(_0x35fc('0x4'));var logger=require(_0x35fc('0x5'))(_0x35fc('0x6'));var utilLicense=require('../../config/license/util');var rpc=require(_0x35fc('0x7'));var mailRpc=require(_0x35fc('0x8'));var Graph=require(_0x35fc('0x9'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x35fc('0xa')](config['agi'],{'ip':_0x35fc('0xb'),'port':0x11dd});function connectionHandler(_0x27524f){process[_0x35fc('0xc')](function(){syncho(function(){try{setChannelVariables(_0x27524f);agiHandler(_0x27524f);}catch(_0x1e5f90){logger[_0x35fc('0xd')](_0x1e5f90[_0x35fc('0xe')]);}});});}function listeningHandler(){console[_0x35fc('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x35fc('0x6')][_0x35fc('0x10')]);logger['info'](util[_0x35fc('0x11')](_0x35fc('0x12'),config['agi']['ip'],config[_0x35fc('0x6')][_0x35fc('0x10')]));}function errorHandler(_0x5469f5){if(_0x5469f5&&_0x5469f5['name']&&_0x5469f5[_0x35fc('0x13')]){logger['error'](util[_0x35fc('0x11')](_0x35fc('0x14'),_0x5469f5[_0x35fc('0x15')],_0x5469f5[_0x35fc('0x13')]));}else{logger[_0x35fc('0xd')](util['format']('[ERROR]\x20%s',_0x5469f5['stack']));}}function closeHandler(){logger['info'](util[_0x35fc('0x11')](_0x35fc('0x16'),this[_0x35fc('0x17')],this[_0x35fc('0x18')],this[_0x35fc('0x19')],this[_0x35fc('0x1a')],this['uniqueid']));try{createSquareReport(this);}catch(_0x26ba54){logger[_0x35fc('0xd')](_0x26ba54['stack']);}}function timeoutHandler(){logger[_0x35fc('0x1b')](util[_0x35fc('0x11')](_0x35fc('0x1c'),this['arg_1'],this[_0x35fc('0x18')],this[_0x35fc('0x19')],this[_0x35fc('0x1a')],this['uniqueid']));}function hangupHandler(){logger[_0x35fc('0x1b')](util[_0x35fc('0x11')](_0x35fc('0x1d'),this[_0x35fc('0x17')],this[_0x35fc('0x18')],this[_0x35fc('0x19')],this[_0x35fc('0x1a')],this[_0x35fc('0x1e')]));this[_0x35fc('0x1f')]=!![];}function getRoot(_0x427eae){return parser['toJson'](_0x427eae,{'object':!![]})[_0x35fc('0x20')][_0x35fc('0x21')];}function addVertex(_0x257719,_0x2d8183,_0x3b4743){_0x2d8183['agicommand']=_0x3b4743;if(_0x2d8183[_0x35fc('0x22')](_0x35fc('0x23'))){_0x2d8183['maxRetry']=parseInt(_0x2d8183[_0x35fc('0x23')],0xa);}_0x257719[_0x35fc('0x24')](_[_0x35fc('0x25')](_0x2d8183,'mxCell'));}function initGraph(_0x4086e9,_0x598d7a){var _0x1bf180=new Graph();for(var _0xdfab9f in _0x4086e9){if(_0x4086e9['hasOwnProperty'](_0xdfab9f)){if(_['isArray'](_0x4086e9[_0xdfab9f])){for(var _0x47774c=0x0;_0x47774c<_0x4086e9[_0xdfab9f]['length'];_0x47774c+=0x1){addVertex(_0x1bf180,_0x4086e9[_0xdfab9f][_0x47774c],_0xdfab9f);}}else{addVertex(_0x1bf180,_0x4086e9[_0xdfab9f],_0xdfab9f);}}}for(var _0x274208=0x0;_0x274208<_0x598d7a[_0x35fc('0x26')];_0x274208+=0x1){if(_0x598d7a[_0x274208]['source']&&_0x598d7a[_0x274208][_0x35fc('0x27')]){_0x1bf180[_0x35fc('0x28')](_0x598d7a[_0x274208][_0x35fc('0x29')],_0x598d7a[_0x274208][_0x35fc('0x27')],_0x598d7a[_0x274208][_0x35fc('0x2a')]);}}return _0x1bf180;}function getSquareProject(_0x134dfa,_0x11ccdb){rpc[_0x35fc('0x2b')](_0x134dfa)['then'](function(_0x1cd1ae){_0x11ccdb(null,_0x1cd1ae);})[_0x35fc('0x2c')](function(_0x22af18){_0x11ccdb(null,_0x22af18);});}function createSquareReport(_0x52acc5,_0xe79f52){rpc[_0x35fc('0x2d')](_0x52acc5)[_0x35fc('0x2e')](function(_0xe6e4ba){if(_0xe79f52){_0xe79f52(null,_0xe6e4ba);}})[_0x35fc('0x2c')](function(_0x103181){if(_0xe79f52){_0xe79f52(null,_0x103181);}});}function setChannelVariables(_0x222ddb){for(var _0x37b435 in _0x222ddb){if(_0x222ddb[_0x35fc('0x22')](_0x37b435)){if(_0x37b435[_0x35fc('0x2f')]('agi_')===0x0){_0x222ddb[_0x37b435['substring'](0x4)]=_0x222ddb[_0x37b435];delete _0x222ddb[_0x37b435];}}}}function getLogFromObject(_0x114bc1){return util['inspect'](_0x114bc1,{'showHidden':![],'depth':null});}function agiHandler(_0x37b394){var _0x39454e,_0x1c4b8b,_0x227471,_0x271ba9,_0x12e78f;logger['debug'](_0x35fc('0x30'),JSON[_0x35fc('0x31')](_0x37b394,null,0x2));logger[_0x35fc('0x1b')](util[_0x35fc('0x11')](_0x35fc('0x32'),_0x37b394[_0x35fc('0x17')],_0x37b394['calleridname'],_0x37b394[_0x35fc('0x19')],_0x37b394[_0x35fc('0x1a')],_0x37b394[_0x35fc('0x1e')]));_0x37b394['on']('error',errorHandler);_0x37b394['on'](_0x35fc('0x33'),closeHandler);_0x37b394['on']('timeout',timeoutHandler);_0x37b394[_0x35fc('0x1f')]=![];_0x37b394['on'](_0x35fc('0x34'),hangupHandler);var _0x266a11=getSquareProject[_0x35fc('0x35')](null,_0x37b394['arg_1']);if(_0x266a11){if(_0x266a11['production']){_0x39454e=getRoot(_0x266a11['production']);if(_0x39454e&&_0x39454e[_0x35fc('0x36')]){logger['debug'](_0x35fc('0x21'),JSON['stringify'](_0x39454e,null,0x2));_0x37b394[_0x35fc('0x37')]=moment()[_0x35fc('0x11')](_0x35fc('0x38'));_0x1c4b8b=initGraph(_[_0x35fc('0x25')](_0x39454e,_0x35fc('0x39')),_0x39454e[_0x35fc('0x39')]);_0x227471=new Vertices(_0x37b394,rpc,mailRpc);logger[_0x35fc('0x1b')](util['format'](_0x35fc('0x3a'),_0x37b394[_0x35fc('0x17')],_0x37b394['calleridname'],_0x37b394[_0x35fc('0x19')],_0x37b394[_0x35fc('0x1a')],_0x37b394[_0x35fc('0x1e')]));_0x1c4b8b[_0x35fc('0x3b')](_0x39454e[_0x35fc('0x36')]['id'],function(_0x31d926){try{_0x31d926=_0x227471['clear'](_0x31d926);logger[_0x35fc('0x3c')](_0x35fc('0x3d'),JSON[_0x35fc('0x31')](_0x31d926,null,0x2));if(_0x31d926['agicommand']===_0x35fc('0x3e')){logger[_0x35fc('0x1b')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x37b394[_0x35fc('0x3f')]=_0x31d926[_0x35fc('0x3f')]||_0x37b394[_0x35fc('0x3f')];_0x37b394[_0x35fc('0x40')]=_0x31d926[_0x35fc('0x40')];_0x37b394[_0x35fc('0x41')]=_0x31d926[_0x35fc('0x41')]?_0x31d926[_0x35fc('0x41')]-0x1:0x1;return null;}else if(_0x31d926&&_0x227471[_0x31d926['agicommand']]){_0x12e78f=_0x227471[_0x31d926['agicommand']](_0x31d926);logger[_0x35fc('0x1b')](_0x35fc('0x42'),JSON['stringify'](_0x12e78f,null,0x2));if(_0x12e78f&&_0x12e78f['code']===AGI_CODE_SUCCESS&&_0x12e78f['result']!==AGI_RESULT_ERROR&&!_0x37b394[_0x35fc('0x1f')]){logger[_0x35fc('0x3c')]('response',getLogFromObject(_0x12e78f));return _[_0x35fc('0x43')](_0x12e78f[_0x35fc('0x44')])?null:_0x12e78f[_0x35fc('0x44')][_0x35fc('0x45')]();}else{logger['error']('response',getLogFromObject(_0x12e78f));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x56bdb9){logger[_0x35fc('0xd')](_0x56bdb9[_0x35fc('0xe')]);return null;}});if(_0x39454e['finally']){logger[_0x35fc('0x1b')](util['format'](_0x35fc('0x46'),_0x37b394[_0x35fc('0x17')],_0x37b394[_0x35fc('0x18')],_0x37b394[_0x35fc('0x19')],_0x37b394[_0x35fc('0x1a')],_0x37b394['uniqueid']));_0x1c4b8b[_0x35fc('0x3b')](_0x39454e[_0x35fc('0x47')]['id'],function(_0x4fd3d8){try{_0x4fd3d8=_0x227471[_0x35fc('0x48')](_0x4fd3d8);logger[_0x35fc('0x3c')](_0x35fc('0x3d'),JSON[_0x35fc('0x31')](_0x4fd3d8,null,0x2));if(_0x4fd3d8&&_0x227471[_0x4fd3d8['agicommand']]){_0x12e78f=_0x227471[_0x4fd3d8[_0x35fc('0x49')]](_0x4fd3d8);if(_0x12e78f){logger['debug']('response',getLogFromObject(_0x12e78f));return _[_0x35fc('0x43')](_0x12e78f[_0x35fc('0x44')])?null:_0x12e78f[_0x35fc('0x44')][_0x35fc('0x45')]();}else{logger[_0x35fc('0xd')](_0x35fc('0x42'),getLogFromObject(_0x12e78f));return null;}}else{logger[_0x35fc('0xd')](_0x35fc('0x4a'));return null;}}catch(_0x4f555f){logger[_0x35fc('0xd')](_0x4f555f[_0x35fc('0xe')]);return null;}});}logger[_0x35fc('0x1b')](util[_0x35fc('0x11')](_0x35fc('0x4b'),_0x37b394[_0x35fc('0x17')],_0x37b394[_0x35fc('0x18')],_0x37b394[_0x35fc('0x19')],_0x37b394[_0x35fc('0x1a')],_0x37b394[_0x35fc('0x1e')]));logger[_0x35fc('0x1b')](util[_0x35fc('0x11')](_0x35fc('0x4c'),_0x37b394[_0x35fc('0x3f')],_0x37b394['extension'],parseInt(_0x37b394['priority'],0xa)+0x1));_0x37b394[_0x35fc('0x4d')](_0x37b394[_0x35fc('0x3f')],_0x37b394[_0x35fc('0x40')],parseInt(_0x37b394[_0x35fc('0x41')],0xa)+0x1);_0x37b394[_0x35fc('0x33')]();}}else{logger[_0x35fc('0xd')](util['format']('Project\x20%s\x20not\x20published',_0x37b394[_0x35fc('0x17')]));_0x37b394[_0x35fc('0x4d')](_0x37b394[_0x35fc('0x3f')],_0x37b394[_0x35fc('0x40')],parseInt(_0x37b394['priority'],0xa)+0x1);_0x37b394[_0x35fc('0x33')]();}}else{logger[_0x35fc('0xd')](util['format'](_0x35fc('0x4e'),_0x37b394[_0x35fc('0x17')]));_0x37b394['continueAt'](_0x37b394[_0x35fc('0x3f')],_0x37b394[_0x35fc('0x40')],parseInt(_0x37b394[_0x35fc('0x41')],0xa)+0x1);_0x37b394[_0x35fc('0x33')]();}}function main(){var _0x5e4018;return utilLicense['getLicense']()['then'](function(_0x240338){if(_0x240338){if(_0x240338[_0x35fc('0x4f')]){if(_0x240338['callysquare']&&_0x240338[_0x35fc('0x50')]>0x0){logger[_0x35fc('0x1b')](util[_0x35fc('0x11')](_0x35fc('0x51'),_0x240338[_0x35fc('0x50')]));_0x5e4018=_0x240338['callysquare'];}else{logger[_0x35fc('0x1b')](_0x35fc('0x52'));}}else{logger[_0x35fc('0x1b')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x5e4018=-0x1;}}})[_0x35fc('0x2c')](function(_0x1dbf5a){logger['error'](_0x35fc('0x53'),_0x1dbf5a[_0x35fc('0xe')]);})[_0x35fc('0x47')](function(){var _0x1c4c33=require(_0x35fc('0x54'))(config[_0x35fc('0x6')][_0x35fc('0x10')],config[_0x35fc('0x6')]['ip'],_0x5e4018);_0x1c4c33['on']('error',errorHandler);_0x1c4c33['on'](_0x35fc('0x55'),listeningHandler);_0x1c4c33['on'](_0x35fc('0x56'),connectionHandler);_0x1c4c33['on'](_0x35fc('0x33'),closeHandler);});}main(); \ No newline at end of file +var _0x5178=['callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/license/util','./rpc','./graph','agi','defaults','127.0.0.1','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','error','[%s]\x20%s','name','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','mxCell','isArray','source','target','addEdge','value','then','catch','createSquareReport','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','hangup','production','start','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense'];(function(_0x1c9c51,_0x5b5acf){var _0x34fd64=function(_0x557106){while(--_0x557106){_0x1c9c51['push'](_0x1c9c51['shift']());}};_0x34fd64(++_0x5b5acf);}(_0x5178,0x171));var _0x8517=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5178[_0x2dafbe];return _0x58a45a;};'use strict';var parser=require('xml2json');var _=require(_0x8517('0x0'));var syncho=require(_0x8517('0x1'));var util=require(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var config=require(_0x8517('0x4'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x8517('0x5'));var rpc=require(_0x8517('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0x8517('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x8517('0x8')]=_[_0x8517('0x9')](config[_0x8517('0x8')],{'ip':_0x8517('0xa'),'port':0x11dd});function connectionHandler(_0x25146d){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x25146d);agiHandler(_0x25146d);}catch(_0x46f6aa){logger['error'](_0x46f6aa['stack']);}});});}function listeningHandler(){console[_0x8517('0xb')](_0x8517('0xc'),config['agi'][_0x8517('0xd')]);logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x10'),config[_0x8517('0x8')]['ip'],config[_0x8517('0x8')][_0x8517('0xd')]));}function errorHandler(_0x12388f){if(_0x12388f&&_0x12388f['name']&&_0x12388f[_0x8517('0x11')]){logger[_0x8517('0x12')](util[_0x8517('0xf')](_0x8517('0x13'),_0x12388f[_0x8517('0x14')],_0x12388f['message']));}else{logger[_0x8517('0x12')](util[_0x8517('0xf')](_0x8517('0x15'),_0x12388f[_0x8517('0x16')]));}}function closeHandler(){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x17'),this[_0x8517('0x18')],this[_0x8517('0x19')],this[_0x8517('0x1a')],this[_0x8517('0x1b')],this[_0x8517('0x1c')]));try{createSquareReport(this);}catch(_0x50e2de){logger[_0x8517('0x12')](_0x50e2de[_0x8517('0x16')]);}}function timeoutHandler(){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x1d'),this[_0x8517('0x18')],this[_0x8517('0x19')],this['callerid'],this[_0x8517('0x1b')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x8517('0xf')](_0x8517('0x1e'),this[_0x8517('0x18')],this[_0x8517('0x19')],this[_0x8517('0x1a')],this[_0x8517('0x1b')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x2dd1df){return parser[_0x8517('0x1f')](_0x2dd1df,{'object':!![]})[_0x8517('0x20')][_0x8517('0x21')];}function addVertex(_0x3a5f0b,_0x2e6e47,_0x5f02ee){_0x2e6e47[_0x8517('0x22')]=_0x5f02ee;if(_0x2e6e47[_0x8517('0x23')]('retry')){_0x2e6e47[_0x8517('0x24')]=parseInt(_0x2e6e47[_0x8517('0x25')],0xa);}_0x3a5f0b[_0x8517('0x26')](_['omit'](_0x2e6e47,_0x8517('0x27')));}function initGraph(_0x572ce4,_0x2880b6){var _0x2a2b7e=new Graph();for(var _0x448211 in _0x572ce4){if(_0x572ce4[_0x8517('0x23')](_0x448211)){if(_[_0x8517('0x28')](_0x572ce4[_0x448211])){for(var _0x300e3f=0x0;_0x300e3f<_0x572ce4[_0x448211]['length'];_0x300e3f+=0x1){addVertex(_0x2a2b7e,_0x572ce4[_0x448211][_0x300e3f],_0x448211);}}else{addVertex(_0x2a2b7e,_0x572ce4[_0x448211],_0x448211);}}}for(var _0x39764e=0x0;_0x39764e<_0x2880b6['length'];_0x39764e+=0x1){if(_0x2880b6[_0x39764e][_0x8517('0x29')]&&_0x2880b6[_0x39764e][_0x8517('0x2a')]){_0x2a2b7e[_0x8517('0x2b')](_0x2880b6[_0x39764e][_0x8517('0x29')],_0x2880b6[_0x39764e][_0x8517('0x2a')],_0x2880b6[_0x39764e][_0x8517('0x2c')]);}}return _0x2a2b7e;}function getSquareProject(_0x4c691f,_0x20ec0a){rpc['getSquareProject'](_0x4c691f)[_0x8517('0x2d')](function(_0x4b9983){_0x20ec0a(null,_0x4b9983);})[_0x8517('0x2e')](function(_0x2d360c){_0x20ec0a(null,_0x2d360c);});}function createSquareReport(_0x3cf945,_0x14eb04){rpc[_0x8517('0x2f')](_0x3cf945)[_0x8517('0x2d')](function(_0x647d81){if(_0x14eb04){_0x14eb04(null,_0x647d81);}})['catch'](function(_0x3e8f81){if(_0x14eb04){_0x14eb04(null,_0x3e8f81);}});}function setChannelVariables(_0x1031b3){for(var _0x773e3c in _0x1031b3){if(_0x1031b3['hasOwnProperty'](_0x773e3c)){if(_0x773e3c['indexOf']('agi_')===0x0){_0x1031b3[_0x773e3c[_0x8517('0x30')](0x4)]=_0x1031b3[_0x773e3c];delete _0x1031b3[_0x773e3c];}}}}function getLogFromObject(_0x4102b4){return util[_0x8517('0x31')](_0x4102b4,{'showHidden':![],'depth':null});}function agiHandler(_0x2abad4){var _0x5ed2a9,_0x254566,_0x5d9d04,_0x19dd26,_0x234da4;logger[_0x8517('0x32')]('variables',JSON[_0x8517('0x33')](_0x2abad4,null,0x2));logger['info'](util[_0x8517('0xf')](_0x8517('0x34'),_0x2abad4['arg_1'],_0x2abad4['calleridname'],_0x2abad4[_0x8517('0x1a')],_0x2abad4[_0x8517('0x1b')],_0x2abad4[_0x8517('0x1c')]));_0x2abad4['on'](_0x8517('0x12'),errorHandler);_0x2abad4['on']('close',closeHandler);_0x2abad4['on']('timeout',timeoutHandler);_0x2abad4[_0x8517('0x35')]=![];_0x2abad4['on'](_0x8517('0x36'),hangupHandler);var _0x1835ac=getSquareProject['sync'](null,_0x2abad4[_0x8517('0x18')]);if(_0x1835ac){if(_0x1835ac[_0x8517('0x37')]){_0x5ed2a9=getRoot(_0x1835ac['production']);if(_0x5ed2a9&&_0x5ed2a9[_0x8517('0x38')]){logger[_0x8517('0x32')](_0x8517('0x21'),JSON[_0x8517('0x33')](_0x5ed2a9,null,0x2));_0x2abad4['joinAt']=moment()[_0x8517('0xf')](_0x8517('0x39'));_0x254566=initGraph(_[_0x8517('0x3a')](_0x5ed2a9,_0x8517('0x27')),_0x5ed2a9[_0x8517('0x27')]);_0x5d9d04=new Vertices(_0x2abad4,rpc,mailRpc);logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x3b'),_0x2abad4[_0x8517('0x18')],_0x2abad4[_0x8517('0x19')],_0x2abad4[_0x8517('0x1a')],_0x2abad4[_0x8517('0x1b')],_0x2abad4[_0x8517('0x1c')]));_0x254566['traverseBFS'](_0x5ed2a9['start']['id'],function(_0x3f1219){try{_0x3f1219=_0x5d9d04[_0x8517('0x3c')](_0x3f1219);logger[_0x8517('0x32')](_0x8517('0x3d'),JSON[_0x8517('0x33')](_0x3f1219,null,0x2));if(_0x3f1219['agicommand']===_0x8517('0x3e')){logger[_0x8517('0xe')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x2abad4[_0x8517('0x3f')]=_0x3f1219[_0x8517('0x3f')]||_0x2abad4[_0x8517('0x3f')];_0x2abad4[_0x8517('0x40')]=_0x3f1219['extension'];_0x2abad4[_0x8517('0x41')]=_0x3f1219[_0x8517('0x41')]?_0x3f1219['priority']-0x1:0x1;return null;}else if(_0x3f1219&&_0x5d9d04[_0x3f1219[_0x8517('0x22')]]){_0x234da4=_0x5d9d04[_0x3f1219[_0x8517('0x22')]](_0x3f1219);logger[_0x8517('0xe')]('response',JSON[_0x8517('0x33')](_0x234da4,null,0x2));if(_0x234da4&&_0x234da4[_0x8517('0x42')]===AGI_CODE_SUCCESS&&_0x234da4[_0x8517('0x43')]!==AGI_RESULT_ERROR&&!_0x2abad4[_0x8517('0x35')]){logger[_0x8517('0x32')](_0x8517('0x44'),getLogFromObject(_0x234da4));return _[_0x8517('0x45')](_0x234da4['result'])?null:_0x234da4[_0x8517('0x43')][_0x8517('0x46')]();}else{logger['error'](_0x8517('0x44'),getLogFromObject(_0x234da4));return null;}}else{logger[_0x8517('0x12')](_0x8517('0x47'));return null;}}catch(_0x333553){logger[_0x8517('0x12')](_0x333553[_0x8517('0x16')]);return null;}});if(_0x5ed2a9['finally']){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x48'),_0x2abad4['arg_1'],_0x2abad4[_0x8517('0x19')],_0x2abad4[_0x8517('0x1a')],_0x2abad4['dnid'],_0x2abad4[_0x8517('0x1c')]));_0x254566[_0x8517('0x49')](_0x5ed2a9['finally']['id'],function(_0x54b346){try{_0x54b346=_0x5d9d04['clear'](_0x54b346);logger[_0x8517('0x32')](_0x8517('0x3d'),JSON['stringify'](_0x54b346,null,0x2));if(_0x54b346&&_0x5d9d04[_0x54b346[_0x8517('0x22')]]){_0x234da4=_0x5d9d04[_0x54b346['agicommand']](_0x54b346);if(_0x234da4){logger['debug'](_0x8517('0x44'),getLogFromObject(_0x234da4));return _[_0x8517('0x45')](_0x234da4[_0x8517('0x43')])?null:_0x234da4[_0x8517('0x43')]['toString']();}else{logger[_0x8517('0x12')](_0x8517('0x44'),getLogFromObject(_0x234da4));return null;}}else{logger[_0x8517('0x12')]('agicommand\x20not\x20found');return null;}}catch(_0x15102f){logger[_0x8517('0x12')](_0x15102f[_0x8517('0x16')]);return null;}});}logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x4a'),_0x2abad4[_0x8517('0x18')],_0x2abad4['calleridname'],_0x2abad4[_0x8517('0x1a')],_0x2abad4['dnid'],_0x2abad4['uniqueid']));logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x4b'),_0x2abad4[_0x8517('0x3f')],_0x2abad4['extension'],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1));_0x2abad4[_0x8517('0x4c')](_0x2abad4['context'],_0x2abad4['extension'],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1);_0x2abad4[_0x8517('0x4d')]();}}else{logger[_0x8517('0x12')](util['format'](_0x8517('0x4e'),_0x2abad4['arg_1']));_0x2abad4[_0x8517('0x4c')](_0x2abad4[_0x8517('0x3f')],_0x2abad4[_0x8517('0x40')],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1);_0x2abad4[_0x8517('0x4d')]();}}else{logger[_0x8517('0x12')](util[_0x8517('0xf')](_0x8517('0x4f'),_0x2abad4[_0x8517('0x18')]));_0x2abad4['continueAt'](_0x2abad4['context'],_0x2abad4[_0x8517('0x40')],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1);_0x2abad4[_0x8517('0x4d')]();}}function main(){var _0x5e82ab;return utilLicense[_0x8517('0x50')]()[_0x8517('0x2d')](function(_0x445f9b){if(_0x445f9b){if(_0x445f9b['voice']){if(_0x445f9b['callysquare']&&_0x445f9b[_0x8517('0x51')]>0x0){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x52'),_0x445f9b[_0x8517('0x51')]));_0x5e82ab=_0x445f9b[_0x8517('0x51')];}else{logger[_0x8517('0xe')](_0x8517('0x53'));}}else{logger[_0x8517('0xe')](_0x8517('0x54'));_0x5e82ab=-0x1;}}})[_0x8517('0x2e')](function(_0x3c5462){logger[_0x8517('0x12')](_0x8517('0x55'),_0x3c5462[_0x8517('0x16')]);})[_0x8517('0x56')](function(){var _0x5c3932=require(_0x8517('0x57'))(config[_0x8517('0x8')][_0x8517('0xd')],config[_0x8517('0x8')]['ip'],_0x5e82ab);_0x5c3932['on'](_0x8517('0x12'),errorHandler);_0x5c3932['on'](_0x8517('0x58'),listeningHandler);_0x5c3932['on'](_0x8517('0x59'),connectionHandler);_0x5c3932['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 1c4b885..3e1d946 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x3ff14e,_0x24cd81){var _0x161499=function(_0xfe60d4){while(--_0xfe60d4){_0x3ff14e['push'](_0x3ff14e['shift']());}};_0x161499(++_0x24cd81);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x20bde8,_0x5a58d4){var _0x5f9432=function(_0x2f854c){while(--_0x2f854c){_0x20bde8['push'](_0x20bde8['shift']());}};_0x5f9432(++_0x5a58d4);}(_0x814b,0x1a2));var _0xb814=function(_0x31880d,_0x4f0ff3){_0x31880d=_0x31880d-0x0;var _0x423823=_0x814b[_0x31880d];return _0x423823;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 2380ea7..c05e169 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(_0x1e3162,_0x366118){var _0x53e351=function(_0x2e9117){while(--_0x2e9117){_0x1e3162['push'](_0x1e3162['shift']());}};_0x53e351(++_0x366118);}(_0x5f2f,0x73));var _0xf5f2=function(_0x911a3f,_0x5e22fd){_0x911a3f=_0x911a3f-0x0;var _0x501401=_0x5f2f[_0x911a3f];return _0x501401;};'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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x3005bb,_0xe9520d){var _0x2f866b=function(_0x10c253){while(--_0x10c253){_0x3005bb['push'](_0x3005bb['shift']());}};_0x2f866b(++_0xe9520d);}(_0x7a54,0x106));var _0x47a5=function(_0x11b83a,_0x1909db){_0x11b83a=_0x11b83a-0x0;var _0x4f686f=_0x7a54[_0x11b83a];return _0x4f686f;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 0764505..7026a98 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 _0x4959=['getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','ShowPause','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','util','jayson/promise','http','request','then','error','message','result','catch','getSquareProject','production','Smtp','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue'];(function(_0x2ae894,_0x26ecca){var _0x324d01=function(_0xb1dfcc){while(--_0xb1dfcc){_0x2ae894['push'](_0x2ae894['shift']());}};_0x324d01(++_0x26ecca);}(_0x4959,0x9b));var _0x9495=function(_0x3076b9,_0x5930c9){_0x3076b9=_0x3076b9-0x0;var _0x55fe34=_0x4959[_0x3076b9];return _0x55fe34;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x9495('0x0'));var util=require(_0x9495('0x1'));var jayson=require(_0x9495('0x2'));var client=jayson['client'][_0x9495('0x3')]({'port':0x2329});function request(_0x3144b5,_0xc4582d){return new BPromise(function(_0x180fb5,_0x53009d){return client[_0x9495('0x4')](_0x3144b5,_0xc4582d)[_0x9495('0x5')](function(_0x2c716d){if(_0x2c716d[_0x9495('0x6')]){return _0x53009d(_0x2c716d[_0x9495('0x6')][_0x9495('0x7')]);}else{return _0x180fb5(_0x2c716d[_0x9495('0x8')]);}})[_0x9495('0x9')](function(_0x313c2f){return _0x53009d(_0x313c2f);});});}exports[_0x9495('0xa')]=function(_0x6b1466){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x6b1466},'attributes':[_0x9495('0xb')]}});};exports['getMailAccountById']=function(_0x4b53aa){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4b53aa},'include':[{'model':'MailServerOut','as':_0x9495('0xc')}],'attributes':['id',_0x9495('0xd'),_0x9495('0xe')]}});};exports[_0x9495('0xf')]=function(_0x27d334){return request(_0x9495('0x10'),{'options':{'where':{'id':_0x27d334},'attributes':[_0x9495('0xd')]}});};exports[_0x9495('0x11')]=function(_0xa22215){return request(_0x9495('0x12'),{'options':{'where':{'id':_0xa22215},'attributes':[_0x9495('0xd')]}});};exports[_0x9495('0x13')]=function(_0x3ab519){return request(_0x9495('0x14'),{'options':{'where':{'id':_0x3ab519},'attributes':[_0x9495('0xd')]}});};exports[_0x9495('0x15')]=function(_0x583db3){return request(_0x9495('0x16'),{'options':{'where':{'id':_0x583db3},'attributes':[_0x9495('0x17')]}});};exports[_0x9495('0x18')]=function(_0xcfc1e8){return request(_0x9495('0x19'),{'options':{'where':{'id':_0xcfc1e8},'attributes':['name']}});};exports[_0x9495('0x1a')]=function(_0x16a07e){return request(_0x9495('0x1b'),{'options':{'where':{'id':_0x16a07e},'attributes':[_0x9495('0xd')]}});};exports[_0x9495('0x1c')]=function(_0x502562){return request(_0x9495('0x1d'),{'options':{'where':{'id':_0x502562},'attributes':[_0x9495('0x1e')]}});};exports['getIntervalById']=function(_0x4c80ef){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x4c80ef},'include':[{'model':'Interval','as':_0x9495('0x1f')}]}});};exports[_0x9495('0x20')]=function(_0x95e617){return request(_0x9495('0x21'),{'options':{'where':{'id':_0x95e617},'attributes':['id',_0x9495('0xd')]}});};exports[_0x9495('0x22')]=function(_0x214747){return request(_0x9495('0x23'),{'body':_0x214747});};exports[_0x9495('0x24')]=function(_0x4053bb){return request('CreateSquareDetailsReport',{'body':_0x4053bb});};exports[_0x9495('0x25')]=function(_0x45dedf){return request(_0x9495('0x26'),{'body':_[_0x9495('0x27')](_0x45dedf,{'project_name':_0x45dedf[_0x9495('0x28')],'prev_project_name':_0x45dedf[_0x9495('0x29')]||'','is_subproject':_0x45dedf[_0x9495('0x29')]?!![]:![],'leaveAt':moment()[_0x9495('0x2a')](_0x9495('0x2b'))})});};exports['createSquareRecording']=function(_0x224e5e){return request(_0x9495('0x2c'),{'body':_0x224e5e});};exports[_0x9495('0x2d')]=function(_0x1e200d){return request(_0x9495('0x2e'),{'body':_0x1e200d});};exports[_0x9495('0x2f')]=function(_0xaa5ab4){return request(_0x9495('0x30'),{'options':{'raw':![],'where':{'phone':_0xaa5ab4['phone'],'ListId':_0xaa5ab4[_0x9495('0x31')]}}})[_0x9495('0x5')](function(_0x2438db){if(_0x2438db){return _0x2438db;}return request(_0x9495('0x32'),{'body':_0xaa5ab4});});};exports['getPauseById']=function(_0xbaa782){return request(_0x9495('0x33'),{'options':{'where':{'id':_0xbaa782},'attributes':[_0x9495('0xd')]}});};exports['agentLogin']=function(_0x42761e,_0x1cae34){return request(_0x9495('0x34'),{'body':{'interface':_0x1cae34},'options':{'where':_0x42761e}});};exports[_0x9495('0x35')]=function(_0xcbfbee,_0x2fdb30,_0x4770ed){return request('PauseUser',{'body':{'type':_0x2fdb30,'uniqueid':_0x4770ed},'options':{'where':_0xcbfbee}});};exports[_0x9495('0x36')]=function(_0x1d641b){return request(_0x9495('0x37'),{'body':{},'options':{'where':_0x1d641b}});};exports[_0x9495('0x38')]=function(_0x520f71){return request(_0x9495('0x39'),{'body':{},'options':{'where':_0x520f71}});}; \ No newline at end of file +var _0xf603=['moment','lodash','jayson/promise','client','http','error','message','result','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','bluebird'];(function(_0x2636db,_0x3ca186){var _0x5b2acf=function(_0x3b290e){while(--_0x3b290e){_0x2636db['push'](_0x2636db['shift']());}};_0x5b2acf(++_0x3ca186);}(_0xf603,0xeb));var _0x3f60=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0xf603[_0xca1f0e];return _0x35e4ef;};'use strict';var BPromise=require(_0x3f60('0x0'));var moment=require(_0x3f60('0x1'));var _=require(_0x3f60('0x2'));var util=require('util');var jayson=require(_0x3f60('0x3'));var client=jayson[_0x3f60('0x4')][_0x3f60('0x5')]({'port':0x2329});function request(_0x112cf5,_0x24aafb){return new BPromise(function(_0x553e8b,_0x1b914a){return client['request'](_0x112cf5,_0x24aafb)['then'](function(_0x2910c7){if(_0x2910c7[_0x3f60('0x6')]){return _0x1b914a(_0x2910c7[_0x3f60('0x6')][_0x3f60('0x7')]);}else{return _0x553e8b(_0x2910c7[_0x3f60('0x8')]);}})[_0x3f60('0x9')](function(_0x59b737){return _0x1b914a(_0x59b737);});});}exports[_0x3f60('0xa')]=function(_0x33dcc8){return request(_0x3f60('0xb'),{'options':{'raw':![],'where':{'name':_0x33dcc8},'attributes':[_0x3f60('0xc')]}});};exports['getMailAccountById']=function(_0x54f45d){return request(_0x3f60('0xd'),{'options':{'raw':![],'where':{'id':_0x54f45d},'include':[{'model':_0x3f60('0xe'),'as':_0x3f60('0xf')}],'attributes':['id','name',_0x3f60('0x10')]}});};exports[_0x3f60('0x11')]=function(_0xad12ff){return request('ShowSquareProject',{'options':{'where':{'id':_0xad12ff},'attributes':[_0x3f60('0x12')]}});};exports[_0x3f60('0x13')]=function(_0x77961f){return request(_0x3f60('0x14'),{'options':{'where':{'id':_0x77961f},'attributes':[_0x3f60('0x12')]}});};exports[_0x3f60('0x15')]=function(_0x17b9c8){return request(_0x3f60('0x16'),{'options':{'where':{'id':_0x17b9c8},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x596e4d){return request(_0x3f60('0x17'),{'options':{'where':{'id':_0x596e4d},'attributes':[_0x3f60('0x18')]}});};exports[_0x3f60('0x19')]=function(_0x23c96e){return request(_0x3f60('0x1a'),{'options':{'where':{'id':_0x23c96e},'attributes':[_0x3f60('0x12')]}});};exports[_0x3f60('0x1b')]=function(_0x163b55){return request(_0x3f60('0x1c'),{'options':{'where':{'id':_0x163b55},'attributes':['name']}});};exports[_0x3f60('0x1d')]=function(_0x2996d9){return request(_0x3f60('0x1e'),{'options':{'where':{'id':_0x2996d9},'attributes':[_0x3f60('0x1f')]}});};exports['getIntervalById']=function(_0x48b0cf){return request(_0x3f60('0x20'),{'options':{'raw':![],'where':{'id':_0x48b0cf},'include':[{'model':_0x3f60('0x21'),'as':_0x3f60('0x22')}]}});};exports[_0x3f60('0x23')]=function(_0x4af884){return request(_0x3f60('0x24'),{'options':{'where':{'id':_0x4af884},'attributes':['id',_0x3f60('0x12')]}});};exports['createSmsMessage']=function(_0x5b08a3){return request(_0x3f60('0x25'),{'body':_0x5b08a3});};exports[_0x3f60('0x26')]=function(_0x13c089){return request(_0x3f60('0x27'),{'body':_0x13c089});};exports['createSquareReport']=function(_0x448603){return request(_0x3f60('0x28'),{'body':_[_0x3f60('0x29')](_0x448603,{'project_name':_0x448603[_0x3f60('0x2a')],'prev_project_name':_0x448603[_0x3f60('0x2b')]||'','is_subproject':_0x448603[_0x3f60('0x2b')]?!![]:![],'leaveAt':moment()[_0x3f60('0x2c')](_0x3f60('0x2d'))})});};exports[_0x3f60('0x2e')]=function(_0xca67ed){return request('CreateSquareRecording',{'body':_0xca67ed});};exports[_0x3f60('0x2f')]=function(_0x37aafb){return request(_0x3f60('0x30'),{'body':_0x37aafb});};exports[_0x3f60('0x31')]=function(_0x42dc63){return request(_0x3f60('0x32'),{'options':{'raw':![],'where':{'phone':_0x42dc63['phone'],'ListId':_0x42dc63[_0x3f60('0x33')]}}})[_0x3f60('0x34')](function(_0x44ea75){if(_0x44ea75){return _0x44ea75;}return request('CreateCmContact',{'body':_0x42dc63});});};exports['getPauseById']=function(_0x4a7243){return request('ShowPause',{'options':{'where':{'id':_0x4a7243},'attributes':[_0x3f60('0x12')]}});};exports[_0x3f60('0x35')]=function(_0x175fad,_0x40deab){return request(_0x3f60('0x36'),{'body':{'interface':_0x40deab},'options':{'where':_0x175fad}});};exports[_0x3f60('0x37')]=function(_0x52d88b,_0x46271a,_0x4e0fd0){return request(_0x3f60('0x38'),{'body':{'type':_0x46271a,'uniqueid':_0x4e0fd0},'options':{'where':_0x52d88b}});};exports[_0x3f60('0x39')]=function(_0x345e25){return request(_0x3f60('0x3a'),{'body':{},'options':{'where':_0x345e25}});};exports['agentLogout']=function(_0xc0198b){return request('LogoutUser',{'body':{},'options':{'where':_0xc0198b}});}; \ 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 6aa409b..b169e3f 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 _0x80d9=['./polly','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x80d9,0x15c));var _0x980d=function(_0x2950e0,_0x12d4d0){_0x2950e0=_0x2950e0-0x0;var _0x1bae5a=_0x80d9[_0x2950e0];return _0x1bae5a;};var polly=require(_0x980d('0x0'));var lex=require('./lex');module[_0x980d('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x8ce3=['./lex','./polly'];(function(_0x5a609d,_0x5ceef8){var _0x184849=function(_0x4db0dc){while(--_0x4db0dc){_0x5a609d['push'](_0x5a609d['shift']());}};_0x184849(++_0x5ceef8);}(_0x8ce3,0xc3));var _0x38ce=function(_0x2338ae,_0x1896f8){_0x2338ae=_0x2338ae-0x0;var _0x4adad9=_0x8ce3[_0x2338ae];return _0x4adad9;};var polly=require(_0x38ce('0x0'));var lex=require(_0x38ce('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 271a25d..bab5cba 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 _0xf25a=['exports','./lib/api'];(function(_0xc26e6d,_0x2886f0){var _0x4f49f0=function(_0xa1f8d2){while(--_0xa1f8d2){_0xc26e6d['push'](_0xc26e6d['shift']());}};_0x4f49f0(++_0x2886f0);}(_0xf25a,0x195));var _0xaf25=function(_0x5dba61,_0x3e9920){_0x5dba61=_0x5dba61-0x0;var _0x4850e7=_0xf25a[_0x5dba61];return _0x4850e7;};'use strict';var lex=require(_0xaf25('0x0'));module[_0xaf25('0x1')]=function(_0x130bc0,_0x5860fc,_0x5d0949,_0x651cae,_0x3d4522,_0x4d4252){return lex(_0x130bc0,_0x5860fc,_0x5d0949,_0x651cae,_0x3d4522,_0x4d4252);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x5407e7,_0xeeb808,_0x22ce4b,_0x2a6255,_0x913595,_0xbe8efc){return lex(_0x5407e7,_0xeeb808,_0x22ce4b,_0x2a6255,_0x913595,_0xbe8efc);}; \ 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 799d03d..898b318 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 _0x032b=['slot_','exports','LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots','hasOwnProperty'];(function(_0x15abf8,_0x489073){var _0x22bb38=function(_0x5b6d25){while(--_0x5b6d25){_0x15abf8['push'](_0x15abf8['shift']());}};_0x22bb38(++_0x489073);}(_0x032b,0xd3));var _0xb032=function(_0x56608c,_0x29eb74){_0x56608c=_0x56608c-0x0;var _0x3c7fb0=_0x032b[_0x56608c];return _0x3c7fb0;};'use strict';var BPromise=require(_0xb032('0x0'));var AWS=require(_0xb032('0x1'));function lexResult(_0x1e12f6,_0x463f23){return new BPromise(function(_0x5379d1,_0x1ada7c){_0x1e12f6[_0xb032('0x2')](_0x463f23,function(_0x276c80,_0x37bc12){if(_0x276c80){_0x1ada7c(_0x276c80);}if(_0x37bc12[_0xb032('0x3')]){for(const _0x296b8d in _0x37bc12['slots']){if(_0x37bc12[_0xb032('0x3')][_0xb032('0x4')](_0x296b8d)){var _0x538cad=_0x37bc12[_0xb032('0x3')][_0x296b8d];_0x37bc12[_0xb032('0x5')+_0x296b8d]=_0x538cad;}}}_0x5379d1(_0x37bc12);});});}module[_0xb032('0x6')]=function(_0x3e079b,_0x5102f8,_0x182d7c,_0x28eec8,_0x3ed8d1,_0x21ad5b){var _0x386898=new AWS[(_0xb032('0x7'))]({'accessKeyId':_0x5102f8,'secretAccessKey':_0x182d7c,'region':_0x28eec8});var _0x47001e={'botAlias':_0xb032('0x8'),'botName':_0x21ad5b,'inputText':_0x3ed8d1,'userId':_0x3e079b};return lexResult(_0x386898,_0x47001e);}; \ No newline at end of file +var _0x93a2=['slots','hasOwnProperty','exports','LexRuntime','$LATEST','bluebird'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x93a2,0x13d));var _0x293a=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x93a2[_0x28611e];return _0x530f69;};'use strict';var BPromise=require(_0x293a('0x0'));var AWS=require('aws-sdk');function lexResult(_0x5ca4dd,_0x238621){return new BPromise(function(_0x2c781c,_0x436a9d){_0x5ca4dd['postText'](_0x238621,function(_0x40734e,_0x51f421){if(_0x40734e){_0x436a9d(_0x40734e);}if(_0x51f421[_0x293a('0x1')]){for(const _0x16a9c3 in _0x51f421[_0x293a('0x1')]){if(_0x51f421[_0x293a('0x1')][_0x293a('0x2')](_0x16a9c3)){var _0xad014a=_0x51f421[_0x293a('0x1')][_0x16a9c3];_0x51f421['slot_'+_0x16a9c3]=_0xad014a;}}}_0x2c781c(_0x51f421);});});}module[_0x293a('0x3')]=function(_0x147663,_0x1570e3,_0x54e8ce,_0x449a4f,_0x174027,_0x6fd9f4){var _0x2d16b3=new AWS[(_0x293a('0x4'))]({'accessKeyId':_0x1570e3,'secretAccessKey':_0x54e8ce,'region':_0x449a4f});var _0x3f96b1={'botAlias':_0x293a('0x5'),'botName':_0x6fd9f4,'inputText':_0x174027,'userId':_0x147663};return lexResult(_0x2d16b3,_0x3f96b1);}; \ 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 f05c07e..c2e1b37 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 _0x507a=['./lib/api','exports'];(function(_0x1aa6cd,_0x3d53c3){var _0x1856c5=function(_0x1a00b0){while(--_0x1a00b0){_0x1aa6cd['push'](_0x1aa6cd['shift']());}};_0x1856c5(++_0x3d53c3);}(_0x507a,0x132));var _0xa507=function(_0x4cdce2,_0x527e05){_0x4cdce2=_0x4cdce2-0x0;var _0x54849f=_0x507a[_0x4cdce2];return _0x54849f;};'use strict';var polly=require(_0xa507('0x0'));module[_0xa507('0x1')]=function(_0x2669b3,_0xc141c3,_0x3bf112,_0xd8d935,_0x3ca9ff,_0xf4ff79,_0x2f48b3){return polly(_0x2669b3,_0xc141c3,_0x3bf112,_0xd8d935,_0x3ca9ff,_0xf4ff79,_0x2f48b3);}; \ No newline at end of file +var _0xe36c=['exports'];(function(_0x561bd5,_0x51e9c6){var _0x2d3adb=function(_0x9fe150){while(--_0x9fe150){_0x561bd5['push'](_0x561bd5['shift']());}};_0x2d3adb(++_0x51e9c6);}(_0xe36c,0x155));var _0xce36=function(_0x5aac46,_0xea7e9){_0x5aac46=_0x5aac46-0x0;var _0xe31595=_0xe36c[_0x5aac46];return _0xe31595;};'use strict';var polly=require('./lib/api');module[_0xce36('0x0')]=function(_0x247ba5,_0x2648e3,_0x14904e,_0x176b0b,_0x54854f,_0x426147,_0x39656b){return polly(_0x247ba5,_0x2648e3,_0x14904e,_0x176b0b,_0x54854f,_0x426147,_0x39656b);}; \ 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 19c782e..462579e 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 _0xcf84=['AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x1f7c90,_0x23a49e){var _0x145a29=function(_0x3a49d7){while(--_0x3a49d7){_0x1f7c90['push'](_0x1f7c90['shift']());}};_0x145a29(++_0x23a49e);}(_0xcf84,0x145));var _0x4cf8=function(_0x23a5e8,_0x37faab){_0x23a5e8=_0x23a5e8-0x0;var _0x3a145d=_0xcf84[_0x23a5e8];return _0x3a145d;};'use strict';var fs=require('fs');var path=require(_0x4cf8('0x0'));var BPromise=require(_0x4cf8('0x1'));var rs=require(_0x4cf8('0x2'));var AWS=require(_0x4cf8('0x3'));function pollyResult(_0x373ec2,_0x504e87,_0x117575){return new BPromise(function(_0x588a00,_0x141cba){_0x373ec2[_0x4cf8('0x4')](_0x504e87,function(_0x59d310,_0x575373){if(_0x59d310){_0x141cba(_0x59d310);}else if(_0x575373){if(_0x575373[_0x4cf8('0x5')]instanceof Buffer){fs[_0x4cf8('0x6')](_0x117575,_0x575373[_0x4cf8('0x5')],function(_0x17787b){if(_0x17787b){_0x141cba(_0x17787b);}else{_0x588a00();}});}else{_0x141cba(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x141cba(new Error(_0x4cf8('0x7')));}});});}module[_0x4cf8('0x8')]=function(_0x17d74b,_0x2b4f81,_0x459911,_0x227af1,_0x304efd,_0x3c12fc,_0x29de27){var _0x28798e=new AWS['Polly']({'accessKeyId':_0x17d74b,'secretAccessKey':_0x2b4f81,'region':_0x459911});var _0x1c69e1={'Text':_0x304efd,'TextType':_0x3c12fc||_0x4cf8('0x9'),'OutputFormat':'mp3','VoiceId':_0x227af1};return pollyResult(_0x28798e,_0x1c69e1,_0x29de27);}; \ No newline at end of file +var _0x90ae=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x4aa750,_0x38fd9e){var _0x88a245=function(_0x1bc27a){while(--_0x1bc27a){_0x4aa750['push'](_0x4aa750['shift']());}};_0x88a245(++_0x38fd9e);}(_0x90ae,0xca));var _0xe90a=function(_0x253810,_0x40726e){_0x253810=_0x253810-0x0;var _0x1b440d=_0x90ae[_0x253810];return _0x1b440d;};'use strict';var fs=require('fs');var path=require(_0xe90a('0x0'));var BPromise=require(_0xe90a('0x1'));var rs=require(_0xe90a('0x2'));var AWS=require(_0xe90a('0x3'));function pollyResult(_0x34a9bb,_0x5873d7,_0x4e88d3){return new BPromise(function(_0x58bff2,_0x1a8db4){_0x34a9bb[_0xe90a('0x4')](_0x5873d7,function(_0x44084b,_0x12a6d5){if(_0x44084b){_0x1a8db4(_0x44084b);}else if(_0x12a6d5){if(_0x12a6d5[_0xe90a('0x5')]instanceof Buffer){fs[_0xe90a('0x6')](_0x4e88d3,_0x12a6d5['AudioStream'],function(_0x370a3e){if(_0x370a3e){_0x1a8db4(_0x370a3e);}else{_0x58bff2();}});}else{_0x1a8db4(new Error(_0xe90a('0x7')));}}else{_0x1a8db4(new Error(_0xe90a('0x8')));}});});}module[_0xe90a('0x9')]=function(_0x4a9f18,_0x5475f9,_0x55ecad,_0xa1d1b3,_0x2b9ca5,_0x427221,_0xb66e1a){var _0x558ac5=new AWS[(_0xe90a('0xa'))]({'accessKeyId':_0x4a9f18,'secretAccessKey':_0x5475f9,'region':_0x55ecad});var _0x25b679={'Text':_0x2b9ca5,'TextType':_0x427221||_0xe90a('0xb'),'OutputFormat':_0xe90a('0xc'),'VoiceId':_0xa1d1b3};return pollyResult(_0x558ac5,_0x25b679,_0xb66e1a);}; \ 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 397d0fe..6a78e61 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 _0x2ea3=['./lib/api'];(function(_0x4f1353,_0x52eb24){var _0x531375=function(_0xef34b){while(--_0xef34b){_0x4f1353['push'](_0x4f1353['shift']());}};_0x531375(++_0x52eb24);}(_0x2ea3,0x127));var _0x32ea=function(_0x2535cd,_0x5a1201){_0x2535cd=_0x2535cd-0x0;var _0x59271f=_0x2ea3[_0x2535cd];return _0x59271f;};'use strict';var asr=require(_0x32ea('0x0'));module['exports']=function(_0x4b7fe6,_0x2124c3,_0x42dbdd,_0x4c5946){return asr(_0x4b7fe6,_0x2124c3,_0x42dbdd);}; \ No newline at end of file +var _0x4b3f=['exports'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0x4b3f,0x155));var _0xf4b3=function(_0x495bba,_0x565d63){_0x495bba=_0x495bba-0x0;var _0x3bb5ea=_0x4b3f[_0x495bba];return _0x3bb5ea;};'use strict';var asr=require('./lib/api');module[_0xf4b3('0x0')]=function(_0x3f6ac3,_0x2b0729,_0x33b94e,_0x4cba07){return asr(_0x3f6ac3,_0x2b0729,_0x33b94e);}; \ 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 a397a4f..47c843d 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 _0xcc17=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','exports','length'];(function(_0x1cbea1,_0x5bab17){var _0x110924=function(_0x25c434){while(--_0x25c434){_0x1cbea1['push'](_0x1cbea1['shift']());}};_0x110924(++_0x5bab17);}(_0xcc17,0x1d8));var _0x7cc1=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0xcc17[_0x11a962];return _0x55d423;};'use strict';var url=require(_0x7cc1('0x0'));var BPromise=require(_0x7cc1('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x7cc1('0x2')]=function(_0x1564bb,_0x9ca8a0,_0x483b2f){return new BPromise(function(_0x4c35fb,_0x4aed73){var _0x164aad;if(typeof _0x1564bb!=='string'||_0x1564bb[_0x7cc1('0x3')]===0x0){return _0x4aed73(_0x7cc1('0x4'));}if(typeof _0x9ca8a0!=='string'||_0x9ca8a0[_0x7cc1('0x3')]===0x0){return _0x4aed73(_0x7cc1('0x5'));}if(typeof _0x483b2f!==_0x7cc1('0x6')&&(typeof _0x483b2f!==_0x7cc1('0x7')||_0x483b2f[_0x7cc1('0x3')]===0x0)){return _0x4aed73('lang\x20should\x20be\x20a\x20string');}try{_0x164aad=fs[_0x7cc1('0x8')](_0x1564bb)[_0x7cc1('0x9')](_0x7cc1('0xa'));}catch(_0x4ec041){return _0x4aed73(_0x4ec041);}return _0x4c35fb({'method':_0x7cc1('0xb'),'uri':host+_0x7cc1('0xc')+_0x9ca8a0,'body':{'config':{'encoding':_0x7cc1('0xd'),'sampleRateHertz':'8000','languageCode':_0x483b2f},'audio':{'content':_0x164aad}},'json':!![]});});}; \ No newline at end of file +var _0x74e1=['bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x74e1,0x193));var _0x174e=function(_0x333c95,_0x3cd7d8){_0x333c95=_0x333c95-0x0;var _0x231487=_0x74e1[_0x333c95];return _0x231487;};'use strict';var url=require('url');var BPromise=require(_0x174e('0x0'));var fs=require('fs');var host=_0x174e('0x1');module[_0x174e('0x2')]=function(_0x5e419b,_0x320151,_0x13f530){return new BPromise(function(_0x1e32bf,_0x4d7b1b){var _0x12250e;if(typeof _0x5e419b!==_0x174e('0x3')||_0x5e419b['length']===0x0){return _0x4d7b1b(_0x174e('0x4'));}if(typeof _0x320151!==_0x174e('0x3')||_0x320151['length']===0x0){return _0x4d7b1b(_0x174e('0x5'));}if(typeof _0x13f530!==_0x174e('0x6')&&(typeof _0x13f530!==_0x174e('0x3')||_0x13f530['length']===0x0)){return _0x4d7b1b(_0x174e('0x7'));}try{_0x12250e=fs['readFileSync'](_0x5e419b)[_0x174e('0x8')](_0x174e('0x9'));}catch(_0x3c9e43){return _0x4d7b1b(_0x3c9e43);}return _0x1e32bf({'method':'POST','uri':host+_0x174e('0xa')+_0x320151,'body':{'config':{'encoding':_0x174e('0xb'),'sampleRateHertz':_0x174e('0xc'),'languageCode':_0x13f530},'audio':{'content':_0x12250e}},'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 719d1d5..81d9054 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 _0x553d=['./asr'];(function(_0x1dcda0,_0x1da2c6){var _0x49ba52=function(_0x286334){while(--_0x286334){_0x1dcda0['push'](_0x1dcda0['shift']());}};_0x49ba52(++_0x1da2c6);}(_0x553d,0x192));var _0xd553=function(_0x30303e,_0x2622c8){_0x30303e=_0x30303e-0x0;var _0x7cd862=_0x553d[_0x30303e];return _0x7cd862;};var asr=require(_0xd553('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x4feb=['./asr','exports'];(function(_0x4b5d20,_0x57e93b){var _0x2600c8=function(_0x43786d){while(--_0x43786d){_0x4b5d20['push'](_0x4b5d20['shift']());}};_0x2600c8(++_0x57e93b);}(_0x4feb,0x190));var _0xb4fe=function(_0x171ca6,_0x2f8f9d){_0x171ca6=_0x171ca6-0x0;var _0x244768=_0x4feb[_0x171ca6];return _0x244768;};var asr=require(_0xb4fe('0x0'));module[_0xb4fe('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 5e4bf3b..aa18d19 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 _0x3025=['length','text\x20length\x20limit\x20reached','goggleTTS\x20path','googleASR','map','alternatives','join','results','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','googleDialogflow','textRequest','result','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','name','intent','displayName','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','text:synthesize','resolve','generate','.mp3','from','writeFile','googleCloudTTS\x20path','googleTTS','utf8','POST','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a'];(function(_0x4c1ec2,_0x4f42b7){var _0x3f6f1c=function(_0xc82652){while(--_0xc82652){_0x4c1ec2['push'](_0x4c1ec2['shift']());}};_0x3f6f1c(++_0x4f42b7);}(_0x3025,0x157));var _0x5302=function(_0x39ecab,_0x4f57d3){_0x39ecab=_0x39ecab-0x0;var _0x511fe=_0x3025[_0x39ecab];return _0x511fe;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x5302('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x5302('0x1'));var https=require(_0x5302('0x2'));var md5=require(_0x5302('0x3'));var path=require('path');var querystring=require(_0x5302('0x4'));var rp=require(_0x5302('0x5'));var rs=require(_0x5302('0x6'));var sox=require(_0x5302('0x7'));var tts=require(_0x5302('0x8'));var urlParse=require(_0x5302('0x9'))[_0x5302('0xa')];var util=require('util');var aws=require(_0x5302('0xb'));var google=require('./google');var sestek=require(_0x5302('0xc'));var tilde=require(_0x5302('0xd'));var logger=require(_0x5302('0xe'))(_0x5302('0xf'));var ISPEECH_API=_0x5302('0x10');function downloadFile(_0x45795d,_0x58b102){return new BPromise(function(_0x16a1dd,_0x1befc1){var _0x5ba521=urlParse(_0x45795d);var _0x3a2342=_0x5ba521[_0x5302('0x11')]===_0x5302('0x12')?https:http;var _0x1c872f={'host':_0x5ba521[_0x5302('0x13')],'path':_0x5ba521[_0x5302('0x14')],'headers':{'user-agent':_0x5302('0x15')}};_0x3a2342[_0x5302('0x16')](_0x1c872f,function(_0xeb44e7){if(_0xeb44e7[_0x5302('0x17')]!==0xc8){logger[_0x5302('0x18')](_0x5302('0x19')+_0x45795d+_0x5302('0x1a')+_0xeb44e7[_0x5302('0x17')]+'\x20('+_0xeb44e7['statusMessage']+')');_0x1befc1(new Error(_0x5302('0x19')+_0x45795d+_0x5302('0x1a')+_0xeb44e7['statusCode']+'\x20('+_0xeb44e7[_0x5302('0x1b')]+')'));return;}var _0x211650=fs[_0x5302('0x1c')](_0x58b102);_0x211650['on'](_0x5302('0x1d'),function(){logger[_0x5302('0x1e')](_0x5302('0x1f'));_0x211650[_0x5302('0x20')](_0x16a1dd);});_0x211650['on'](_0x5302('0x18'),function(_0x114c46){fs[_0x5302('0x21')](_0x58b102);logger['error'](_0x5302('0x22'),_0x114c46);_0x1befc1(_0x114c46);});_0xeb44e7[_0x5302('0x23')](_0x211650);})['on'](_0x5302('0x18'),function(_0x33a008){logger['error'](_0x33a008);_0x1befc1(_0x33a008);})[_0x5302('0x24')]();});}function uploadFile(_0x38b1de){return new BPromise(function(_0x3cc0d5,_0x32a27c){var _0x2d1722=urlParse(_0x38b1de);var _0x55f22d=_0x2d1722[_0x5302('0x11')]===_0x5302('0x12')?https:http;var _0x3fae6b={'host':_0x2d1722['host'],'path':_0x2d1722[_0x5302('0x14')],'headers':{'user-agent':_0x5302('0x15')}};_0x55f22d['get'](_0x3fae6b,function(_0x3fff38){if(_0x3fff38[_0x5302('0x17')]!==0xc8){_0x32a27c(new Error(_0x5302('0x19')+_0x38b1de+_0x5302('0x1a')+_0x3fff38['statusCode']+'\x20('+_0x3fff38['statusMessage']+')'));return;}var _0xb7a6b4='';_0x3fff38['on'](_0x5302('0x25'),function(_0x5a12b8){_0xb7a6b4+=_0x5a12b8;});_0x3fff38['on']('end',function(){_0x3cc0d5(_0xb7a6b4);});})['on']('error',function(_0x3fefb0){_0x32a27c(_0x3fefb0);})['end']();});}function convertFile(_0x1d0366,_0x7ff290){return new BPromise(function(_0x3b86fb,_0x204396){var _0x57b97c=sox[_0x5302('0x26')](_0x1d0366,_0x7ff290,{'sampleRate':0x1f40,'format':_0x5302('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x57b97c['on'](_0x5302('0x18'),function(_0x1032ec){logger['error'](_0x5302('0x28'),_0x1032ec);_0x204396(_0x1032ec);});_0x57b97c['on'](_0x5302('0x24'),function(){logger[_0x5302('0x1e')](_0x5302('0x29'));_0x3b86fb();});_0x57b97c[_0x5302('0x2a')]();});}function base64Decode(_0x219e6f,_0x1881dc){var _0x5b7c64=path['resolve'](__dirname,_0x5302('0x2b'),rs['generate'](0x4)+_0x5302('0x2c'));fs[_0x5302('0x2d')](_0x5b7c64,_0x219e6f,_0x5302('0x2e'));return convertFile(_0x5b7c64,_0x1881dc)[_0x5302('0x2f')](function(){try{fs[_0x5302('0x21')](_0x5b7c64);fs[_0x5302('0x30')](_0x1881dc,_0x5302('0x31'));}catch(_0x6e46d3){logger[_0x5302('0x18')](_0x6e46d3);}return _0x1881dc[_0x5302('0x32')]('.')[0x0];});}function base64Encode(_0x463100){var _0x3c56b5=fs[_0x5302('0x33')](_0x463100);return new Buffer(_0x3c56b5)['toString'](_0x5302('0x2e'));}exports[_0x5302('0x34')]=function(_0x434257,_0xc4db2d,_0x46d43f,_0x37da63,_0x4dbec9,_0x167cd2){var _0x59323a,_0xa6c234;var _0x28d05a=_0x5302('0x35');var _0x3e2662='?key='+_0x434257;var _0x5794d4={};if(_0xc4db2d===_0x5302('0x36')){_0x5794d4['input']={'ssml':_0x46d43f};}else{_0x5794d4[_0x5302('0x37')]={'text':_0x46d43f};};_0x5794d4[_0x5302('0x38')]={'languageCode':_0x37da63,'ssmlGender':_0x4dbec9};_0x5794d4['audioConfig']={'audioEncoding':_0x5302('0x39'),'sampleRateHertz':0x1f40};var _0x3b0f54={'url':_0x28d05a+_0x5302('0x3a')+_0x3e2662,'method':'POST','json':!![],'body':_0x5794d4};return rp(_0x3b0f54)[_0x5302('0x2f')](function(_0x24c7cb){return new BPromise(function(_0x40d9b6,_0x343f24){_0x59323a=path[_0x5302('0x3b')](__dirname,'tmp',rs[_0x5302('0x3c')](0x4)+_0x5302('0x3d'));var _0x41419d=Buffer[_0x5302('0x3e')](_0x24c7cb['audioContent'],'base64');return fs[_0x5302('0x3f')](_0x59323a,_0x41419d,function(_0x5c40e6){_0x343f24(_0x5c40e6);},function(_0x183326){fs[_0x5302('0x30')](_0x59323a,_0x5302('0x31'));_0x40d9b6(_0x183326);});});})[_0x5302('0x2f')](function(_0x3a3300){_0xa6c234=path[_0x5302('0x3b')](__dirname,_0x5302('0x2b'),rs[_0x5302('0x3c')](0x4)+_0x5302('0x2c'));return convertFile(_0x59323a,_0xa6c234);})[_0x5302('0x2f')](function(){try{fs[_0x5302('0x21')](_0x59323a);fs[_0x5302('0x30')](_0xa6c234,_0x5302('0x31'));}catch(_0x1c00fb){logger[_0x5302('0x18')](_0x1c00fb);}logger['info'](_0x5302('0x40'),_0xa6c234['split']('.')[0x0]);return _0xa6c234[_0x5302('0x32')]('.')[0x0];});};exports[_0x5302('0x41')]=function(_0xec9bc3,_0x5757fc){var _0xab5f9='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x5da5ec,_0x4ca619;var _0x2165a6;var _0x5d8c47={'encoding':_0x5302('0x42'),'method':_0x5302('0x43'),'timeout':0x2710,'url':_0xab5f9,'headers':{'Content-Type':_0x5302('0x44')},'body':'f.req='+encodeURIComponent(JSON[_0x5302('0x45')]([[[_0x5302('0x46'),JSON['stringify']([_0xec9bc3,_0x5757fc||'en',![],_0x5302('0x47')]),null,_0x5302('0x48')]]]))};return rp(_0x5d8c47)[_0x5302('0x2f')](function(_0x1617e2){try{_0x2165a6=eval(_0x1617e2['slice'](0x5))[0x0][0x2];}catch(_0x3e0288){throw new Error(_0x5302('0x49')+_0x1617e2[_0x5302('0x25')]);}if(!_0x2165a6){if(_0xec9bc3[_0x5302('0x4a')]>0xc8){throw new Error(_0x5302('0x4b'));}else{throw new Error('lang\x20\x22'+_0x5757fc+'\x22\x20might\x20not\x20exist');}}try{_0x2165a6=eval(_0x2165a6)[0x0];}catch(_0x37c33d){throw new Error(_0x5302('0x49')+res[_0x5302('0x25')]);}const _0x166522=_0x2165a6;_0x5da5ec=path[_0x5302('0x3b')](__dirname,_0x5302('0x2b'),rs[_0x5302('0x3c')](0x4)+'.mp3');fs['writeFileSync'](_0x5da5ec,_0x2165a6,{'encoding':_0x5302('0x2e')});_0x4ca619=path['resolve'](__dirname,_0x5302('0x2b'),rs['generate'](0x4)+_0x5302('0x2c'));return convertFile(_0x5da5ec,_0x4ca619);})[_0x5302('0x2f')](function(){try{fs['unlink'](_0x5da5ec);fs[_0x5302('0x30')](_0x4ca619,'777');}catch(_0x22d77f){logger[_0x5302('0x18')](_0x22d77f);}logger[_0x5302('0x1e')](_0x5302('0x4c'),_0x4ca619[_0x5302('0x32')]('.')[0x0]);return _0x4ca619['split']('.')[0x0];});};exports[_0x5302('0x4d')]=function(_0x2ed058,_0x15e2e2,_0x25c315){return google['asr'](_0x2ed058,_0x15e2e2,_0x25c315)[_0x5302('0x2f')](function(_0xc4d916){logger['info'](_0xc4d916['uri']);return rp(_0xc4d916);})['then'](function(_0x532470){var _0x4a465d='';var _0x3dabe8=0x0;try{fs[_0x5302('0x21')](_0x2ed058);}catch(_0x5eee2e){logger['error'](_0x5eee2e);}if(_0x532470&&_0x532470['results']){_0x4a465d=_0x532470['results'][_0x5302('0x4e')](function(_0x1fc7b1){return _0x1fc7b1&&_0x1fc7b1['alternatives'][0x0]&&_0x1fc7b1[_0x5302('0x4f')][0x0]['transcript']?_0x1fc7b1[_0x5302('0x4f')][0x0]['transcript']:'';})[_0x5302('0x50')]('\x0a');_0x3dabe8=_0x532470[_0x5302('0x51')][_0x5302('0x4e')](function(_0x4a2d32){return _0x4a2d32&&_0x4a2d32[_0x5302('0x4f')][0x0]&&_0x4a2d32[_0x5302('0x4f')][0x0][_0x5302('0x52')]?_0x4a2d32['alternatives'][0x0][_0x5302('0x52')]:0x0;})[_0x5302('0x50')]('\x0a');}logger['info']('googleASR\x20transcription',_0x4a465d);logger['info'](_0x5302('0x53'),_0x3dabe8);return{'transcript':_0x4a465d,'confidence':_0x3dabe8};})[_0x5302('0x54')](function(_0x383b1d){logger['error'](_0x5302('0x55'),_0x383b1d['statusCode'],_0x383b1d['name'],_0x383b1d['message']);});};exports[_0x5302('0x56')]=function(_0x4c3445,_0x4e53e9,_0x5ebccb,_0xad246c){var _0x4df45c=apiai(_0x4e53e9,{'language':_0xad246c||'en'});return _0x4df45c[_0x5302('0x57')](_0x5ebccb,{'sessionId':md5(_0x4c3445)})[_0x5302('0x2f')](function(_0x3e13dc){logger[_0x5302('0x1e')](JSON[_0x5302('0x45')](_0x3e13dc));return{'source':_0x3e13dc[_0x5302('0x58')]['source'],'resolvedQuery':_0x3e13dc[_0x5302('0x58')][_0x5302('0x59')],'action':_0x3e13dc[_0x5302('0x58')]['action'],'actionIncomplete':_0x3e13dc[_0x5302('0x58')][_0x5302('0x5a')],'speech':_0x3e13dc[_0x5302('0x58')][_0x5302('0x5b')][_0x5302('0x5c')],'score':_0x3e13dc['result'][_0x5302('0x5d')],'statusCode':_0x3e13dc[_0x5302('0x5e')][_0x5302('0x5f')],'endConversation':_0x3e13dc[_0x5302('0x58')][_0x5302('0x60')][_0x5302('0x61')]||![],'isFallbackIntent':_0x3e13dc['result'][_0x5302('0x60')][_0x5302('0x62')]};});};exports[_0x5302('0x63')]=function(_0x2e3621,_0x94a1f3,_0x1a1804,_0x392bf8,_0x5d45cf,_0x5907d5){var _0x5718ce=_0x392bf8[_0x5302('0x64')](/\\n/g,'\x0a');var _0x5c37db={'credentials':{'private_key':_0x5718ce,'client_email':_0x1a1804}};var _0x57f232=new dialogflow[(_0x5302('0x65'))](_0x5c37db);var _0x3d4488=_0x57f232[_0x5302('0x66')](_0x94a1f3,md5(_0x2e3621));var _0x345ac1={'session':_0x3d4488,'queryInput':{'text':{'text':_0x5d45cf,'languageCode':_0x5907d5}}};return _0x57f232[_0x5302('0x67')](_0x345ac1)[_0x5302('0x2f')](function(_0x1ae150){if(_0x1ae150&&_0x1ae150['length']){logger['info'](_0x5302('0x68'),JSON['stringify'](_0x1ae150));var _0x15bf30=_0x1ae150[0x0];if(_0x15bf30){var _0x498d51={'action':_0x15bf30[_0x5302('0x69')][_0x5302('0x6a')],'allRequiredParamsPresent':_0x15bf30['queryResult'][_0x5302('0x6b')],'endConversation':_0x15bf30['queryResult'][_0x5302('0x6c')]&&_0x15bf30['queryResult'][_0x5302('0x6c')][_0x5302('0x6d')]?_0x15bf30['queryResult'][_0x5302('0x6c')][_0x5302('0x6d')]['end_conversation'][_0x5302('0x6e')]:![],'fulfillmentText':_0x15bf30['queryResult'][_0x5302('0x6f')],'intentName':_0x15bf30[_0x5302('0x69')]['intent'][_0x5302('0x70')],'intentDisplayName':_0x15bf30[_0x5302('0x69')][_0x5302('0x71')][_0x5302('0x72')],'isFallbackIntent':_0x15bf30[_0x5302('0x69')][_0x5302('0x71')]['isFallback'],'languageCode':_0x15bf30[_0x5302('0x69')]['languageCode'],'queryText':_0x15bf30[_0x5302('0x69')]['queryText'],'responseId':_0x15bf30[_0x5302('0x73')],'score':_0x15bf30[_0x5302('0x69')][_0x5302('0x74')],'speech':_0x15bf30[_0x5302('0x69')][_0x5302('0x6f')],'providerResponse':JSON[_0x5302('0x45')](_0x1ae150)};return _0x498d51;}}});};exports[_0x5302('0x75')]=function(_0x591dbe,_0x21bbf4,_0x559910,_0x18b56b){return tilde['asr'](_0x591dbe,_0x21bbf4,_0x559910,_0x18b56b)[_0x5302('0x2f')](function(_0x1b6b4b){try{fs['unlink'](_0x591dbe);}catch(_0x243f72){logger[_0x5302('0x18')](_0x243f72);}logger['info'](_0x5302('0x76'),_0x1b6b4b['transcript']);logger[_0x5302('0x1e')](_0x5302('0x77'),_0x1b6b4b['confidence']);return _0x1b6b4b;});};exports[_0x5302('0x78')]=function(_0x42e9e3,_0x12dbd5,_0x164025,_0x506554,_0x68d9e6,_0x356d55){var _0x109412=path[_0x5302('0x3b')](__dirname,_0x5302('0x2b'),rs[_0x5302('0x3c')](0x4)+'.mp3');var _0x4722a7;return aws['polly'](_0x42e9e3,_0x12dbd5,_0x164025,_0x506554,_0x68d9e6,_0x356d55,_0x109412)[_0x5302('0x2f')](function(){_0x4722a7=path[_0x5302('0x3b')](__dirname,_0x5302('0x2b'),rs[_0x5302('0x3c')](0x4)+'.wav');return convertFile(_0x109412,_0x4722a7);})[_0x5302('0x2f')](function(){try{fs[_0x5302('0x21')](_0x109412);fs[_0x5302('0x30')](_0x4722a7,_0x5302('0x31'));}catch(_0x3d114f){logger[_0x5302('0x18')](_0x3d114f);}return _0x4722a7[_0x5302('0x32')]('.')[0x0];});};exports[_0x5302('0x79')]=function(_0x190045,_0x521e16,_0xfb75f2,_0x239570,_0x2f850a,_0x5e8dde){return aws[_0x5302('0x7a')](_0x190045,_0x521e16,_0xfb75f2,_0x239570,_0x2f850a,_0x5e8dde)[_0x5302('0x2f')](function(_0x1df81f){logger['info'](JSON[_0x5302('0x45')](_0x1df81f));return _0x1df81f;});};exports[_0x5302('0x7b')]=function(_0xcca16b,_0x21ecc3,_0x29bf8c,_0x24e1f1){var _0x13a9e5=util['format'](_0x5302('0x7c'),ISPEECH_API,_0xcca16b,encodeURIComponent(_0x21ecc3),_0x29bf8c,_0x24e1f1);var _0x5679e3=path[_0x5302('0x3b')](__dirname,_0x5302('0x2b'),rs[_0x5302('0x3c')](0x4)+_0x5302('0x3d'));var _0x4efa2e;return downloadFile(_0x13a9e5,_0x5679e3)[_0x5302('0x2f')](function(){_0x4efa2e=path[_0x5302('0x3b')](__dirname,_0x5302('0x2b'),rs[_0x5302('0x3c')](0x4)+_0x5302('0x2c'));return convertFile(_0x5679e3,_0x4efa2e);})[_0x5302('0x2f')](function(){try{fs['unlink'](_0x5679e3);fs['chmodSync'](_0x4efa2e,_0x5302('0x31'));}catch(_0x1b2bd3){logger[_0x5302('0x18')](_0x1b2bd3);}return _0x4efa2e['split']('.')[0x0];});};exports[_0x5302('0x7d')]=function(_0x4ddec2,_0x3c0b04,_0x42d34e,_0x5c718f){var _0x418438=util[_0x5302('0x7e')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3c0b04,_0x42d34e,base64Encode(_0x4ddec2),_0x5c718f?util[_0x5302('0x7e')](_0x5302('0x7f'),encodeURIComponent(_0x5c718f)):_0x5302('0x80'));return uploadFile(_0x418438)[_0x5302('0x2f')](function(_0x5e6762){return querystring['parse'](_0x5e6762);});};exports[_0x5302('0x81')]=function(_0x391bc6,_0x560440){return sestek[_0x5302('0x82')](_0x391bc6,_0x560440)[_0x5302('0x2f')](function(_0x41f75c){logger[_0x5302('0x1e')](JSON[_0x5302('0x45')](_0x41f75c));var _0x45d7e0={'speech':_0x41f75c[_0x5302('0x83')],'action':_0x41f75c['channelData']?_0x41f75c[_0x5302('0x84')][_0x5302('0x85')]:undefined,'actiondata':_0x41f75c[_0x5302('0x84')]?_0x41f75c[_0x5302('0x84')][_0x5302('0x86')]:undefined};if(_0x41f75c['channelData']&&_0x41f75c[_0x5302('0x84')][_0x5302('0x87')]){return base64Decode(_0x41f75c[_0x5302('0x84')]['AudioFromTts'][_0x5302('0x88')],path[_0x5302('0x3b')](__dirname,_0x5302('0x2b'),rs[_0x5302('0x3c')](0x4)+_0x5302('0x2c')))[_0x5302('0x2f')](function(_0x5a54b9){_0x45d7e0[_0x5302('0x89')]=_0x5a54b9;return _0x45d7e0;});}return _0x45d7e0;});};exports[_0x5302('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0xe3bb=['finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','text:synthesize','generate','.mp3','from','audioContent','base64','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','resolvedQuery','action','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','intent','displayName','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','path','querystring','randomstring','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','info','finish\x20download\x20file','unlink','pipe','end','protocol','data','transcode','wav'];(function(_0x4933a4,_0x4d91b7){var _0x122350=function(_0x20e855){while(--_0x20e855){_0x4933a4['push'](_0x4933a4['shift']());}};_0x122350(++_0x4d91b7);}(_0xe3bb,0x16a));var _0xbe3b=function(_0xe9a431,_0x1e7009){_0xe9a431=_0xe9a431-0x0;var _0x591b10=_0xe3bb[_0xe9a431];return _0x591b10;};'use strict';var apiai=require(_0xbe3b('0x0'));var BPromise=require(_0xbe3b('0x1'));var dialogflow=require(_0xbe3b('0x2'));var fs=require('fs');var http=require(_0xbe3b('0x3'));var https=require(_0xbe3b('0x4'));var md5=require('md5');var path=require(_0xbe3b('0x5'));var querystring=require(_0xbe3b('0x6'));var rp=require('request-promise');var rs=require(_0xbe3b('0x7'));var sox=require('sox');var tts=require(_0xbe3b('0x8'));var urlParse=require(_0xbe3b('0x9'))[_0xbe3b('0xa')];var util=require(_0xbe3b('0xb'));var aws=require(_0xbe3b('0xc'));var google=require(_0xbe3b('0xd'));var sestek=require(_0xbe3b('0xe'));var tilde=require(_0xbe3b('0xf'));var logger=require(_0xbe3b('0x10'))(_0xbe3b('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x55cd26,_0x34cd01){return new BPromise(function(_0x590abb,_0x356c36){var _0x28f10a=urlParse(_0x55cd26);var _0x5c1bab=_0x28f10a['protocol']===_0xbe3b('0x12')?https:http;var _0x146d8e={'host':_0x28f10a[_0xbe3b('0x13')],'path':_0x28f10a[_0xbe3b('0x5')],'headers':{'user-agent':_0xbe3b('0x14')}};_0x5c1bab[_0xbe3b('0x15')](_0x146d8e,function(_0x570480){if(_0x570480[_0xbe3b('0x16')]!==0xc8){logger[_0xbe3b('0x17')](_0xbe3b('0x18')+_0x55cd26+'\x20failed,\x20status\x20code\x20=\x20'+_0x570480[_0xbe3b('0x16')]+'\x20('+_0x570480[_0xbe3b('0x19')]+')');_0x356c36(new Error(_0xbe3b('0x18')+_0x55cd26+_0xbe3b('0x1a')+_0x570480['statusCode']+'\x20('+_0x570480[_0xbe3b('0x19')]+')'));return;}var _0x1418e9=fs[_0xbe3b('0x1b')](_0x34cd01);_0x1418e9['on']('finish',function(){logger[_0xbe3b('0x1c')](_0xbe3b('0x1d'));_0x1418e9['close'](_0x590abb);});_0x1418e9['on'](_0xbe3b('0x17'),function(_0x5950ec){fs[_0xbe3b('0x1e')](_0x34cd01);logger[_0xbe3b('0x17')]('download\x20error',_0x5950ec);_0x356c36(_0x5950ec);});_0x570480[_0xbe3b('0x1f')](_0x1418e9);})['on'](_0xbe3b('0x17'),function(_0x15efa3){logger[_0xbe3b('0x17')](_0x15efa3);_0x356c36(_0x15efa3);})[_0xbe3b('0x20')]();});}function uploadFile(_0x5d923f){return new BPromise(function(_0x2a3bbf,_0xf3a233){var _0x21ffba=urlParse(_0x5d923f);var _0x10255d=_0x21ffba[_0xbe3b('0x21')]===_0xbe3b('0x12')?https:http;var _0xb6bf36={'host':_0x21ffba[_0xbe3b('0x13')],'path':_0x21ffba[_0xbe3b('0x5')],'headers':{'user-agent':_0xbe3b('0x14')}};_0x10255d[_0xbe3b('0x15')](_0xb6bf36,function(_0xab744f){if(_0xab744f['statusCode']!==0xc8){_0xf3a233(new Error('request\x20to\x20'+_0x5d923f+_0xbe3b('0x1a')+_0xab744f[_0xbe3b('0x16')]+'\x20('+_0xab744f[_0xbe3b('0x19')]+')'));return;}var _0x2edd50='';_0xab744f['on'](_0xbe3b('0x22'),function(_0x478c67){_0x2edd50+=_0x478c67;});_0xab744f['on']('end',function(){_0x2a3bbf(_0x2edd50);});})['on']('error',function(_0x35df00){_0xf3a233(_0x35df00);})[_0xbe3b('0x20')]();});}function convertFile(_0x23e018,_0x4be6d2){return new BPromise(function(_0x2f3d92,_0x3ee9f7){var _0x1a9ffd=sox[_0xbe3b('0x23')](_0x23e018,_0x4be6d2,{'sampleRate':0x1f40,'format':_0xbe3b('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1a9ffd['on'](_0xbe3b('0x17'),function(_0x406f32){logger['error']('error\x20convert',_0x406f32);_0x3ee9f7(_0x406f32);});_0x1a9ffd['on'](_0xbe3b('0x20'),function(){logger[_0xbe3b('0x1c')](_0xbe3b('0x25'));_0x2f3d92();});_0x1a9ffd[_0xbe3b('0x26')]();});}function base64Decode(_0x3c5e05,_0x1ded44){var _0x3bf90c=path[_0xbe3b('0x27')](__dirname,_0xbe3b('0x28'),rs['generate'](0x4)+_0xbe3b('0x29'));fs[_0xbe3b('0x2a')](_0x3bf90c,_0x3c5e05,'base64');return convertFile(_0x3bf90c,_0x1ded44)[_0xbe3b('0x2b')](function(){try{fs[_0xbe3b('0x1e')](_0x3bf90c);fs[_0xbe3b('0x2c')](_0x1ded44,_0xbe3b('0x2d'));}catch(_0x42194a){logger[_0xbe3b('0x17')](_0x42194a);}return _0x1ded44[_0xbe3b('0x2e')]('.')[0x0];});}function base64Encode(_0x5505c7){var _0x1e8398=fs[_0xbe3b('0x2f')](_0x5505c7);return new Buffer(_0x1e8398)[_0xbe3b('0x30')]('base64');}exports[_0xbe3b('0x31')]=function(_0x3cb2fe,_0x29cd08,_0x3f3177,_0x176a39,_0x31f4f9,_0x2d5f33){var _0x2019ec,_0x572ede;var _0x74773=_0xbe3b('0x32');var _0x2549ac=_0xbe3b('0x33')+_0x3cb2fe;var _0x4528ff={};if(_0x29cd08===_0xbe3b('0x34')){_0x4528ff[_0xbe3b('0x35')]={'ssml':_0x3f3177};}else{_0x4528ff[_0xbe3b('0x35')]={'text':_0x3f3177};};_0x4528ff['voice']={'languageCode':_0x176a39,'ssmlGender':_0x31f4f9};_0x4528ff[_0xbe3b('0x36')]={'audioEncoding':_0xbe3b('0x37'),'sampleRateHertz':0x1f40};var _0x503c41={'url':_0x74773+_0xbe3b('0x38')+_0x2549ac,'method':'POST','json':!![],'body':_0x4528ff};return rp(_0x503c41)[_0xbe3b('0x2b')](function(_0x5e8ab1){return new BPromise(function(_0x2d413e,_0x57a15c){_0x2019ec=path[_0xbe3b('0x27')](__dirname,_0xbe3b('0x28'),rs[_0xbe3b('0x39')](0x4)+_0xbe3b('0x3a'));var _0x58a982=Buffer[_0xbe3b('0x3b')](_0x5e8ab1[_0xbe3b('0x3c')],_0xbe3b('0x3d'));return fs['writeFile'](_0x2019ec,_0x58a982,function(_0x258ea9){_0x57a15c(_0x258ea9);},function(_0x5ea704){fs[_0xbe3b('0x2c')](_0x2019ec,'777');_0x2d413e(_0x5ea704);});});})['then'](function(_0x10704d){_0x572ede=path[_0xbe3b('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xbe3b('0x29'));return convertFile(_0x2019ec,_0x572ede);})[_0xbe3b('0x2b')](function(){try{fs[_0xbe3b('0x1e')](_0x2019ec);fs[_0xbe3b('0x2c')](_0x572ede,_0xbe3b('0x2d'));}catch(_0x3ec291){logger[_0xbe3b('0x17')](_0x3ec291);}logger[_0xbe3b('0x1c')](_0xbe3b('0x3e'),_0x572ede['split']('.')[0x0]);return _0x572ede['split']('.')[0x0];});};exports[_0xbe3b('0x3f')]=function(_0x5a5162,_0x37a62d){var _0x8022fc=_0xbe3b('0x40');var _0x50c9d1,_0x2c109a;var _0x54aced;var _0x128e55={'encoding':_0xbe3b('0x41'),'method':_0xbe3b('0x42'),'timeout':0x2710,'url':_0x8022fc,'headers':{'Content-Type':_0xbe3b('0x43')},'body':_0xbe3b('0x44')+encodeURIComponent(JSON[_0xbe3b('0x45')]([[['jQ1olc',JSON['stringify']([_0x5a5162,_0x37a62d||'en',![],_0xbe3b('0x46')]),null,_0xbe3b('0x47')]]]))};return rp(_0x128e55)[_0xbe3b('0x2b')](function(_0x2be5b3){try{_0x54aced=eval(_0x2be5b3[_0xbe3b('0x48')](0x5))[0x0][0x2];}catch(_0x54b823){throw new Error('parse\x20response\x20failed:\x0a'+_0x2be5b3[_0xbe3b('0x22')]);}if(!_0x54aced){if(_0x5a5162[_0xbe3b('0x49')]>0xc8){throw new Error(_0xbe3b('0x4a'));}else{throw new Error('lang\x20\x22'+_0x37a62d+_0xbe3b('0x4b'));}}try{_0x54aced=eval(_0x54aced)[0x0];}catch(_0x499a86){throw new Error(_0xbe3b('0x4c')+res[_0xbe3b('0x22')]);}const _0x2b7ae0=_0x54aced;_0x50c9d1=path[_0xbe3b('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xbe3b('0x3a'));fs['writeFileSync'](_0x50c9d1,_0x54aced,{'encoding':'base64'});_0x2c109a=path[_0xbe3b('0x27')](__dirname,_0xbe3b('0x28'),rs[_0xbe3b('0x39')](0x4)+'.wav');return convertFile(_0x50c9d1,_0x2c109a);})['then'](function(){try{fs[_0xbe3b('0x1e')](_0x50c9d1);fs[_0xbe3b('0x2c')](_0x2c109a,_0xbe3b('0x2d'));}catch(_0x2f1f98){logger[_0xbe3b('0x17')](_0x2f1f98);}logger[_0xbe3b('0x1c')]('goggleTTS\x20path',_0x2c109a[_0xbe3b('0x2e')]('.')[0x0]);return _0x2c109a['split']('.')[0x0];});};exports[_0xbe3b('0x4d')]=function(_0x5e4581,_0x24d1d7,_0x3bba5c){return google[_0xbe3b('0x4e')](_0x5e4581,_0x24d1d7,_0x3bba5c)['then'](function(_0x10305c){logger[_0xbe3b('0x1c')](_0x10305c[_0xbe3b('0x4f')]);return rp(_0x10305c);})['then'](function(_0x224a48){var _0x159428='';var _0x5b750b=0x0;try{fs['unlink'](_0x5e4581);}catch(_0x32b66f){logger['error'](_0x32b66f);}if(_0x224a48&&_0x224a48[_0xbe3b('0x50')]){_0x159428=_0x224a48['results'][_0xbe3b('0x51')](function(_0x7d6f){return _0x7d6f&&_0x7d6f[_0xbe3b('0x52')][0x0]&&_0x7d6f['alternatives'][0x0][_0xbe3b('0x53')]?_0x7d6f[_0xbe3b('0x52')][0x0][_0xbe3b('0x53')]:'';})['join']('\x0a');_0x5b750b=_0x224a48['results'][_0xbe3b('0x51')](function(_0x7f0f9a){return _0x7f0f9a&&_0x7f0f9a[_0xbe3b('0x52')][0x0]&&_0x7f0f9a[_0xbe3b('0x52')][0x0][_0xbe3b('0x54')]?_0x7f0f9a[_0xbe3b('0x52')][0x0][_0xbe3b('0x54')]:0x0;})[_0xbe3b('0x55')]('\x0a');}logger[_0xbe3b('0x1c')](_0xbe3b('0x56'),_0x159428);logger['info'](_0xbe3b('0x57'),_0x5b750b);return{'transcript':_0x159428,'confidence':_0x5b750b};})['catch'](function(_0x5d1e5f){logger['error'](_0xbe3b('0x58'),_0x5d1e5f[_0xbe3b('0x16')],_0x5d1e5f[_0xbe3b('0x59')],_0x5d1e5f[_0xbe3b('0x5a')]);});};exports[_0xbe3b('0x5b')]=function(_0x30354a,_0x4ddbe1,_0x3b5014,_0x1122f5){var _0x2240de=apiai(_0x4ddbe1,{'language':_0x1122f5||'en'});return _0x2240de['textRequest'](_0x3b5014,{'sessionId':md5(_0x30354a)})[_0xbe3b('0x2b')](function(_0x1f6ea3){logger['info'](JSON[_0xbe3b('0x45')](_0x1f6ea3));return{'source':_0x1f6ea3[_0xbe3b('0x5c')][_0xbe3b('0x5d')],'resolvedQuery':_0x1f6ea3[_0xbe3b('0x5c')][_0xbe3b('0x5e')],'action':_0x1f6ea3['result'][_0xbe3b('0x5f')],'actionIncomplete':_0x1f6ea3[_0xbe3b('0x5c')]['actionIncomplete'],'speech':_0x1f6ea3[_0xbe3b('0x5c')]['fulfillment']['speech'],'score':_0x1f6ea3[_0xbe3b('0x5c')]['score'],'statusCode':_0x1f6ea3[_0xbe3b('0x60')][_0xbe3b('0x61')],'endConversation':_0x1f6ea3[_0xbe3b('0x5c')][_0xbe3b('0x62')]['endConversation']||![],'isFallbackIntent':_0x1f6ea3[_0xbe3b('0x5c')][_0xbe3b('0x62')][_0xbe3b('0x63')]};});};exports[_0xbe3b('0x64')]=function(_0x4ad4d5,_0x37f3be,_0x318247,_0x4a0c48,_0x44c7a5,_0x12b1ca){var _0x150852=_0x4a0c48[_0xbe3b('0x65')](/\\n/g,'\x0a');var _0xbd7ec6={'credentials':{'private_key':_0x150852,'client_email':_0x318247}};var _0x32c8c6=new dialogflow[(_0xbe3b('0x66'))](_0xbd7ec6);var _0x53862b=_0x32c8c6[_0xbe3b('0x67')](_0x37f3be,md5(_0x4ad4d5));var _0x5936a4={'session':_0x53862b,'queryInput':{'text':{'text':_0x44c7a5,'languageCode':_0x12b1ca}}};return _0x32c8c6[_0xbe3b('0x68')](_0x5936a4)[_0xbe3b('0x2b')](function(_0x14e073){if(_0x14e073&&_0x14e073['length']){logger[_0xbe3b('0x1c')](_0xbe3b('0x69'),JSON[_0xbe3b('0x45')](_0x14e073));var _0x41929e=_0x14e073[0x0];if(_0x41929e){var _0x50fa1b={'action':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x5f')],'allRequiredParamsPresent':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x6b')],'endConversation':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x6c')]&&_0x41929e['queryResult'][_0xbe3b('0x6c')][_0xbe3b('0x6d')]?_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x6c')][_0xbe3b('0x6d')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x41929e[_0xbe3b('0x6a')]['fulfillmentText'],'intentName':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x6e')][_0xbe3b('0x59')],'intentDisplayName':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x6e')][_0xbe3b('0x6f')],'isFallbackIntent':_0x41929e['queryResult']['intent'][_0xbe3b('0x70')],'languageCode':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x71')],'queryText':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x72')],'responseId':_0x41929e[_0xbe3b('0x73')],'score':_0x41929e[_0xbe3b('0x6a')]['intentDetectionConfidence'],'speech':_0x41929e['queryResult']['fulfillmentText'],'providerResponse':JSON[_0xbe3b('0x45')](_0x14e073)};return _0x50fa1b;}}});};exports[_0xbe3b('0x74')]=function(_0x21ecce,_0x4611aa,_0x53a2c2,_0x5cf0d9){return tilde['asr'](_0x21ecce,_0x4611aa,_0x53a2c2,_0x5cf0d9)[_0xbe3b('0x2b')](function(_0x18250c){try{fs[_0xbe3b('0x1e')](_0x21ecce);}catch(_0x1b0a4e){logger[_0xbe3b('0x17')](_0x1b0a4e);}logger[_0xbe3b('0x1c')](_0xbe3b('0x75'),_0x18250c['transcript']);logger[_0xbe3b('0x1c')](_0xbe3b('0x76'),_0x18250c[_0xbe3b('0x54')]);return _0x18250c;});};exports[_0xbe3b('0x77')]=function(_0x552668,_0x2c0f02,_0x2a10b5,_0x2f9f34,_0x5401cc,_0x1bbc70){var _0x5466af=path[_0xbe3b('0x27')](__dirname,'tmp',rs[_0xbe3b('0x39')](0x4)+'.mp3');var _0x4c1461;return aws[_0xbe3b('0x78')](_0x552668,_0x2c0f02,_0x2a10b5,_0x2f9f34,_0x5401cc,_0x1bbc70,_0x5466af)['then'](function(){_0x4c1461=path[_0xbe3b('0x27')](__dirname,_0xbe3b('0x28'),rs[_0xbe3b('0x39')](0x4)+_0xbe3b('0x29'));return convertFile(_0x5466af,_0x4c1461);})[_0xbe3b('0x2b')](function(){try{fs['unlink'](_0x5466af);fs[_0xbe3b('0x2c')](_0x4c1461,_0xbe3b('0x2d'));}catch(_0x50b25f){logger[_0xbe3b('0x17')](_0x50b25f);}return _0x4c1461[_0xbe3b('0x2e')]('.')[0x0];});};exports[_0xbe3b('0x79')]=function(_0x3362df,_0x71198a,_0x51157c,_0x5b3403,_0x4ea5d0,_0x3f0219){return aws['lex'](_0x3362df,_0x71198a,_0x51157c,_0x5b3403,_0x4ea5d0,_0x3f0219)['then'](function(_0x3b5e76){logger[_0xbe3b('0x1c')](JSON[_0xbe3b('0x45')](_0x3b5e76));return _0x3b5e76;});};exports['ispeechTTS']=function(_0x5d32ec,_0x34e0a6,_0x5b6e6c,_0x41d076){var _0x13b380=util[_0xbe3b('0x7a')](_0xbe3b('0x7b'),ISPEECH_API,_0x5d32ec,encodeURIComponent(_0x34e0a6),_0x5b6e6c,_0x41d076);var _0x2a453a=path[_0xbe3b('0x27')](__dirname,_0xbe3b('0x28'),rs['generate'](0x4)+_0xbe3b('0x3a'));var _0x2b2568;return downloadFile(_0x13b380,_0x2a453a)['then'](function(){_0x2b2568=path[_0xbe3b('0x27')](__dirname,_0xbe3b('0x28'),rs['generate'](0x4)+_0xbe3b('0x29'));return convertFile(_0x2a453a,_0x2b2568);})['then'](function(){try{fs[_0xbe3b('0x1e')](_0x2a453a);fs[_0xbe3b('0x2c')](_0x2b2568,_0xbe3b('0x2d'));}catch(_0x59fd0f){logger[_0xbe3b('0x17')](_0x59fd0f);}return _0x2b2568[_0xbe3b('0x2e')]('.')[0x0];});};exports[_0xbe3b('0x7c')]=function(_0x2dcc12,_0x2008fc,_0x39a9ec,_0x1ce423){var _0xb0795d=util[_0xbe3b('0x7a')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x2008fc,_0x39a9ec,base64Encode(_0x2dcc12),_0x1ce423?util[_0xbe3b('0x7a')]('model=%s',encodeURIComponent(_0x1ce423)):_0xbe3b('0x7d'));return uploadFile(_0xb0795d)[_0xbe3b('0x2b')](function(_0x18b6af){return querystring[_0xbe3b('0xa')](_0x18b6af);});};exports[_0xbe3b('0x7e')]=function(_0x483f76,_0x535ea4){return sestek[_0xbe3b('0x7f')](_0x483f76,_0x535ea4)['then'](function(_0x423f15){logger[_0xbe3b('0x1c')](JSON[_0xbe3b('0x45')](_0x423f15));var _0x2ebdf9={'speech':_0x423f15['text'],'action':_0x423f15[_0xbe3b('0x80')]?_0x423f15[_0xbe3b('0x80')]['CustomAction']:undefined,'actiondata':_0x423f15[_0xbe3b('0x80')]?_0x423f15['channelData'][_0xbe3b('0x81')]:undefined};if(_0x423f15[_0xbe3b('0x80')]&&_0x423f15['channelData'][_0xbe3b('0x82')]){return base64Decode(_0x423f15[_0xbe3b('0x80')][_0xbe3b('0x82')]['Data'],path[_0xbe3b('0x27')](__dirname,'tmp',rs[_0xbe3b('0x39')](0x4)+'.wav'))[_0xbe3b('0x2b')](function(_0x3a1160){_0x2ebdf9[_0xbe3b('0x83')]=_0x3a1160;return _0x2ebdf9;});}return _0x2ebdf9;});};exports[_0xbe3b('0x84')]=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 2dea8e6..7cf8ca4 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 _0x7a34=['exports','./nda'];(function(_0x394a3e,_0x1c95af){var _0x363065=function(_0x55ba23){while(--_0x55ba23){_0x394a3e['push'](_0x394a3e['shift']());}};_0x363065(++_0x1c95af);}(_0x7a34,0x93));var _0x47a3=function(_0x9814be,_0x194fc3){_0x9814be=_0x9814be-0x0;var _0x536d82=_0x7a34[_0x9814be];return _0x536d82;};var nda=require(_0x47a3('0x0'));module[_0x47a3('0x1')]={'nda':nda}; \ No newline at end of file +var _0x61ac=['./nda'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x61ac,0x1c4));var _0xc61a=function(_0x3116d6,_0x2d574f){_0x3116d6=_0x3116d6-0x0;var _0x18729d=_0x61ac[_0x3116d6];return _0x18729d;};var nda=require(_0xc61a('0x0'));module['exports']={'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 9f25ada..34d75a7 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 _0x6151=['message','Nda','callerid','calleridname','dnid','project','body','channelData','ProjectName','ndagenerate_audio','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','ndauth_url','/token','username','POST'];(function(_0x3e407c,_0x5eaa24){var _0x34ba4c=function(_0x565b50){while(--_0x565b50){_0x3e407c['push'](_0x3e407c['shift']());}};_0x34ba4c(++_0x5eaa24);}(_0x6151,0x1de));var _0x1615=function(_0x1c5e2f,_0x372a8d){_0x1c5e2f=_0x1c5e2f-0x0;var _0x5defd1=_0x6151[_0x1c5e2f];return _0x5defd1;};'use strict';var rp=require(_0x1615('0x0'));var url=require('url');var logger=require('../../../../../config/logger')('agi');module['exports']=function(_0x2abea1,_0x41f0e7){var _0xb2e9b0={'method':'POST','uri':url['resolve'](_0x41f0e7[_0x1615('0x1')],_0x1615('0x2')),'form':{'grant_type':'password','username':_0x41f0e7[_0x1615('0x3')],'password':_0x41f0e7['password']},'json':!![]};return rp(_0xb2e9b0)['then'](function(_0x3dca2d){var _0x59d70a={'method':_0x1615('0x4'),'uri':url['resolve'](_0x41f0e7['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x41f0e7['ndaactivity_type']||_0x1615('0x5'),'channelId':_0x1615('0x6'),'conversation':{'id':_0x2abea1['uniqueid']},'from':{'id':_0x2abea1[_0x1615('0x7')],'name':_0x2abea1[_0x1615('0x8')]},'recipient':{'id':_0x2abea1[_0x1615('0x9')],'name':_0x2abea1['extension']},'text':_0x41f0e7['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x3dca2d['access_token']},'json':!![]};if(_0x41f0e7[_0x1615('0xa')]){_0x59d70a[_0x1615('0xb')][_0x1615('0xc')][_0x1615('0xd')]=_0x41f0e7[_0x1615('0xa')];}if(_0x41f0e7[_0x1615('0xe')]=='1'){_0x59d70a[_0x1615('0xb')][_0x1615('0xc')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x41f0e7[_0x1615('0xf')]){_0x59d70a[_0x1615('0xb')]['channelData'][_0x1615('0x10')]=_0x41f0e7['custom_action'];if(_0x41f0e7[_0x1615('0x11')]){_0x59d70a[_0x1615('0xb')][_0x1615('0xc')][_0x1615('0x12')]=_0x41f0e7[_0x1615('0x11')];}}logger[_0x1615('0x13')](JSON[_0x1615('0x14')](_0x59d70a));return rp(_0x59d70a);});}; \ No newline at end of file +var _0xc1c7=['message','Nda','uniqueid','calleridname','dnid','text','Bearer\x20','access_token','channelData','ProjectName','project','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','body','CustomActionData','info','request-promise','../../../../../config/logger','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x54e672,_0x250030){var _0x4b18f7=function(_0x1a4ce8){while(--_0x1a4ce8){_0x54e672['push'](_0x54e672['shift']());}};_0x4b18f7(++_0x250030);}(_0xc1c7,0x1c6));var _0x7c1c=function(_0x505977,_0x3bdddd){_0x505977=_0x505977-0x0;var _0x1a55e4=_0xc1c7[_0x505977];return _0x1a55e4;};'use strict';var rp=require(_0x7c1c('0x0'));var url=require('url');var logger=require(_0x7c1c('0x1'))('agi');module['exports']=function(_0x327cef,_0x2de404){var _0x52237c={'method':_0x7c1c('0x2'),'uri':url[_0x7c1c('0x3')](_0x2de404['ndauth_url'],_0x7c1c('0x4')),'form':{'grant_type':_0x7c1c('0x5'),'username':_0x2de404[_0x7c1c('0x6')],'password':_0x2de404['password']},'json':!![]};return rp(_0x52237c)[_0x7c1c('0x7')](function(_0x509daa){var _0x3d0dda={'method':_0x7c1c('0x2'),'uri':url['resolve'](_0x2de404[_0x7c1c('0x8')],_0x7c1c('0x9')),'body':{'type':_0x2de404['ndaactivity_type']||_0x7c1c('0xa'),'channelId':_0x7c1c('0xb'),'conversation':{'id':_0x327cef[_0x7c1c('0xc')]},'from':{'id':_0x327cef['callerid'],'name':_0x327cef[_0x7c1c('0xd')]},'recipient':{'id':_0x327cef[_0x7c1c('0xe')],'name':_0x327cef['extension']},'text':_0x2de404[_0x7c1c('0xf')],'channelData':{}},'headers':{'Authorization':_0x7c1c('0x10')+_0x509daa[_0x7c1c('0x11')]},'json':!![]};if(_0x2de404['project']){_0x3d0dda['body'][_0x7c1c('0x12')][_0x7c1c('0x13')]=_0x2de404[_0x7c1c('0x14')];}if(_0x2de404['ndagenerate_audio']=='1'){_0x3d0dda['body'][_0x7c1c('0x12')][_0x7c1c('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7c1c('0x16')};}if(_0x2de404['custom_action']){_0x3d0dda['body'][_0x7c1c('0x12')][_0x7c1c('0x17')]=_0x2de404[_0x7c1c('0x18')];if(_0x2de404[_0x7c1c('0x19')]){_0x3d0dda[_0x7c1c('0x1a')][_0x7c1c('0x12')][_0x7c1c('0x1b')]=_0x2de404[_0x7c1c('0x19')];}}logger[_0x7c1c('0x1c')](JSON['stringify'](_0x3d0dda));return rp(_0x3d0dda);});}; \ 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 27e91a7..b585920 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 _0xfbd3=['exports','./lib/api'];(function(_0x47f229,_0xc8de87){var _0xb77d88=function(_0x281625){while(--_0x281625){_0x47f229['push'](_0x47f229['shift']());}};_0xb77d88(++_0xc8de87);}(_0xfbd3,0x11f));var _0x3fbd=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xfbd3[_0x13d07a];return _0x5ee0ee;};'use strict';var asr=require(_0x3fbd('0x0'));module[_0x3fbd('0x1')]=function(_0x4cd4a8,_0x26d226,_0x40606a,_0x4669af){return asr(_0x4cd4a8,_0x26d226,_0x40606a,_0x4669af);}; \ No newline at end of file +var _0x9ed6=['./lib/api','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9ed6,0x9a));var _0x69ed=function(_0x450c0e,_0x12ebac){_0x450c0e=_0x450c0e-0x0;var _0xb60092=_0x9ed6[_0x450c0e];return _0xb60092;};'use strict';var asr=require(_0x69ed('0x0'));module[_0x69ed('0x1')]=function(_0x37d2d5,_0x2bf51e,_0x2a5ed3,_0xa9327){return asr(_0x37d2d5,_0x2bf51e,_0x2a5ed3,_0xa9327);}; \ 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 841fcf1..0e53c9a 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 _0xf6e1=['Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.'];(function(_0x187efb,_0xcaa75){var _0x4d72f9=function(_0x2d9697){while(--_0x2d9697){_0x187efb['push'](_0x187efb['shift']());}};_0x4d72f9(++_0xcaa75);}(_0xf6e1,0x183));var _0x1f6e=function(_0x3ca3a0,_0x3e2c2b){_0x3ca3a0=_0x3ca3a0-0x0;var _0x1a429c=_0xf6e1[_0x3ca3a0];return _0x1a429c;};'use strict';var BPromise=require(_0x1f6e('0x0'));var _=require(_0x1f6e('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x1f6e('0x2'));var crypto=require(_0x1f6e('0x3'));var logger=require(_0x1f6e('0x4'))(_0x1f6e('0x5'));module[_0x1f6e('0x6')]=function(_0x1d735e,_0x1c60a7,_0x29317d,_0x57045b){return new BPromise(function(_0xd61c77,_0x1f5e3c){logger[_0x1f6e('0x7')](_0x1f6e('0x8'),_0x57045b||_0x1f6e('0x9'));var _0xa82ab0=new WebSocket(_0x57045b||_0x1f6e('0x9'),{'perMessageDeflate':![]});var _0x4836a7='';var _0x54ae40='0';var _0x2d4199='1';var _0x104447=_0x1f6e('0xa');function _0x4c4319(_0x2061bd){var _0x3305a8=crypto['createHash'](_0x1f6e('0xb'));_0x3305a8[_0x1f6e('0xc')](_0x2061bd);return _0x3305a8['digest'](_0x1f6e('0xd'));}function _0x1b1535(){try{logger[_0x1f6e('0x7')](_0x1f6e('0xe'));var _0x58ea41=moment()[_0x1f6e('0xf')]();var _0x2010fd=_0x4c4319(_0x58ea41+_0x1c60a7+_0x29317d);_0xa82ab0[_0x1f6e('0x10')](JSON[_0x1f6e('0x11')]({'appID':_0x1c60a7,'timestamp':_0x58ea41,'appKey':_0x2010fd}));var _0x401b4b=fs[_0x1f6e('0x12')](_0x1d735e);_0x401b4b['on']('data',function(_0x578724){_0xa82ab0[_0x1f6e('0x10')](_0x578724);});_0x401b4b['on']('close',function(){_0xa82ab0[_0x1f6e('0x10')]('EOS');});}catch(_0x2a3202){logger[_0x1f6e('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0x1f6e('0x11')](_0x2a3202));_0xa82ab0[_0x1f6e('0x14')]();}}function _0xacb84f(_0x2100ff){try{if(_0x2100ff){var _0x4c6a45=JSON[_0x1f6e('0x15')](_0x2100ff);switch(_0x4c6a45['status']){case 0x0:if(_0x4c6a45[_0x1f6e('0x16')]){if(_0x4c6a45['result'][_0x1f6e('0x17')]){logger[_0x1f6e('0x7')](_0x1f6e('0x18'),JSON[_0x1f6e('0x11')](_0x4c6a45[_0x1f6e('0x16')][_0x1f6e('0x19')]));_0x4836a7=_0x4c6a45['result'][_0x1f6e('0x19')][0x0][_0x1f6e('0x1a')];_0x54ae40=_0x4c6a45[_0x1f6e('0x16')][_0x1f6e('0x19')][0x0][_0x1f6e('0x1b')];_0x2d4199='0';_0x104447=_0x1f6e('0x1c');_0xa82ab0[_0x1f6e('0x14')]();}}break;case 0x1:logger[_0x1f6e('0x7')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2d4199='1';_0x104447=_0x1f6e('0xa');break;case 0x2:logger[_0x1f6e('0x7')](_0x1f6e('0x1d'));_0x2d4199='2';_0x104447=_0x1f6e('0x1d');break;case 0x9:logger[_0x1f6e('0x7')](_0x1f6e('0x1e'));_0x2d4199='9';_0x104447=_0x1f6e('0x1e');break;case 0xa:logger[_0x1f6e('0x7')](_0x1f6e('0x1f'));_0x2d4199='10';_0x104447='Authentication\x20failed.';break;case 0xb:logger['info'](_0x1f6e('0x20'));_0x2d4199='11';_0x104447='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2d10ac){logger['error'](_0x1f6e('0x21'),JSON[_0x1f6e('0x11')](_0x2d10ac));_0xa82ab0[_0x1f6e('0x14')]();}}function _0x247a55(){logger[_0x1f6e('0x7')](_0x1f6e('0x22'));_0xd61c77({'transcript':_0x4836a7,'confidence':_0x54ae40,'status':_0x2d4199,'status_message':_0x104447});}function _0x248603(_0x24ec6f){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x1f6e('0x23')](_0x24ec6f)){logger[_0x1f6e('0x13')](_[_0x1f6e('0x24')](_0x24ec6f)?JSON[_0x1f6e('0x11')](_0x24ec6f):_0x24ec6f);}}_0xa82ab0['on']('open',_0x1b1535);_0xa82ab0['on']('message',_0xacb84f);_0xa82ab0['on'](_0x1f6e('0x25'),_0x247a55);_0xa82ab0['on'](_0x1f6e('0x13'),_0x248603);});}; \ No newline at end of file +var _0x74ae=['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','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x74ae,0x7c));var _0xe74a=function(_0x2ad228,_0x16483a){_0x2ad228=_0x2ad228-0x0;var _0x512c22=_0x74ae[_0x2ad228];return _0x512c22;};'use strict';var BPromise=require(_0xe74a('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe74a('0x1'));var crypto=require(_0xe74a('0x2'));var logger=require(_0xe74a('0x3'))('agi');module[_0xe74a('0x4')]=function(_0x274250,_0x4d126e,_0xf68193,_0x425197){return new BPromise(function(_0x5dbb8a,_0x39985b){logger[_0xe74a('0x5')](_0xe74a('0x6'),_0x425197||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4b7ea9=new WebSocket(_0x425197||_0xe74a('0x7'),{'perMessageDeflate':![]});var _0xaf5a75='';var _0x50f458='0';var _0x5c29ee='1';var _0x55256a=_0xe74a('0x8');function _0x15018a(_0x5177a7){var _0xdb5252=crypto['createHash']('sha1');_0xdb5252[_0xe74a('0x9')](_0x5177a7);return _0xdb5252['digest'](_0xe74a('0xa'));}function _0x336c8c(){try{logger[_0xe74a('0x5')](_0xe74a('0xb'));var _0x470b57=moment()[_0xe74a('0xc')]();var _0x384b35=_0x15018a(_0x470b57+_0x4d126e+_0xf68193);_0x4b7ea9[_0xe74a('0xd')](JSON[_0xe74a('0xe')]({'appID':_0x4d126e,'timestamp':_0x470b57,'appKey':_0x384b35}));var _0x3ce096=fs[_0xe74a('0xf')](_0x274250);_0x3ce096['on']('data',function(_0x5b809f){_0x4b7ea9[_0xe74a('0xd')](_0x5b809f);});_0x3ce096['on'](_0xe74a('0x10'),function(){_0x4b7ea9['send'](_0xe74a('0x11'));});}catch(_0x5cd2e1){logger[_0xe74a('0x12')](_0xe74a('0x13'),JSON[_0xe74a('0xe')](_0x5cd2e1));_0x4b7ea9[_0xe74a('0x14')]();}}function _0x59df3f(_0xcd62b5){try{if(_0xcd62b5){var _0x2cf0f4=JSON[_0xe74a('0x15')](_0xcd62b5);switch(_0x2cf0f4[_0xe74a('0x16')]){case 0x0:if(_0x2cf0f4['result']){if(_0x2cf0f4[_0xe74a('0x17')][_0xe74a('0x18')]){logger['info'](_0xe74a('0x19'),JSON[_0xe74a('0xe')](_0x2cf0f4[_0xe74a('0x17')][_0xe74a('0x1a')]));_0xaf5a75=_0x2cf0f4[_0xe74a('0x17')]['hypotheses'][0x0][_0xe74a('0x1b')];_0x50f458=_0x2cf0f4['result'][_0xe74a('0x1a')][0x0]['likelihood'];_0x5c29ee='0';_0x55256a=_0xe74a('0x1c');_0x4b7ea9[_0xe74a('0x14')]();}}break;case 0x1:logger[_0xe74a('0x5')](_0xe74a('0x8'));_0x5c29ee='1';_0x55256a=_0xe74a('0x8');break;case 0x2:logger[_0xe74a('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x5c29ee='2';_0x55256a=_0xe74a('0x1d');break;case 0x9:logger[_0xe74a('0x5')](_0xe74a('0x1e'));_0x5c29ee='9';_0x55256a=_0xe74a('0x1e');break;case 0xa:logger[_0xe74a('0x5')](_0xe74a('0x1f'));_0x5c29ee='10';_0x55256a='Authentication\x20failed.';break;case 0xb:logger[_0xe74a('0x5')](_0xe74a('0x20'));_0x5c29ee='11';_0x55256a=_0xe74a('0x20');}}}catch(_0x518c6d){logger['error'](_0xe74a('0x21'),JSON[_0xe74a('0xe')](_0x518c6d));_0x4b7ea9['terminate']();}}function _0x39aa2c(){logger[_0xe74a('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x5dbb8a({'transcript':_0xaf5a75,'confidence':_0x50f458,'status':_0x5c29ee,'status_message':_0x55256a});}function _0x5b5a21(_0x82af72){logger[_0xe74a('0x12')](_0xe74a('0x22'));if(!_[_0xe74a('0x23')](_0x82af72)){logger['error'](_['isObject'](_0x82af72)?JSON[_0xe74a('0xe')](_0x82af72):_0x82af72);}}_0x4b7ea9['on'](_0xe74a('0x24'),_0x336c8c);_0x4b7ea9['on'](_0xe74a('0x25'),_0x59df3f);_0x4b7ea9['on']('close',_0x39aa2c);_0x4b7ea9['on'](_0xe74a('0x12'),_0x5b5a21);});}; \ 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 0333383..054362b 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 _0x6f75=['exports','./asr'];(function(_0x1b636e,_0x257769){var _0x2ee0f3=function(_0x4da6e7){while(--_0x4da6e7){_0x1b636e['push'](_0x1b636e['shift']());}};_0x2ee0f3(++_0x257769);}(_0x6f75,0x71));var _0x56f7=function(_0xec642,_0x1027c6){_0xec642=_0xec642-0x0;var _0x5c81ef=_0x6f75[_0xec642];return _0x5c81ef;};var asr=require(_0x56f7('0x0'));module[_0x56f7('0x1')]={'asr':asr}; \ No newline at end of file +var _0x21fd=['./asr','exports'];(function(_0x539ce4,_0x1d0195){var _0x35b55b=function(_0x19491d){while(--_0x19491d){_0x539ce4['push'](_0x539ce4['shift']());}};_0x35b55b(++_0x1d0195);}(_0x21fd,0x1e2));var _0xd21f=function(_0x2fa150,_0x57ec48){_0x2fa150=_0x2fa150-0x0;var _0x3a67e6=_0x21fd[_0x2fa150];return _0x3a67e6;};var asr=require(_0xd21f('0x0'));module[_0xd21f('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 378a477..97bab5c 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 _0x92f0=['events','./error','./channel','call','emit','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','error','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','nextTick','net'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x92f0,0x10d));var _0x092f=function(_0x3ef8f7,_0x35359a){_0x3ef8f7=_0x3ef8f7-0x0;var _0x3b097e=_0x92f0[_0x3ef8f7];return _0x3b097e;};'use strict';var util=require('util');var net=require(_0x092f('0x0'));var EventEmitter=require(_0x092f('0x1'))['EventEmitter'];var AGIError=require(_0x092f('0x2'));var AGIChannel=require(_0x092f('0x3'));var AGIServer=function(_0x5e9f2c,_0x47f54d,_0x16bf0b){var _0x2db72b=this,_0x5e9f2c=_0x5e9f2c||0x11dd,_0x47f54d=_0x47f54d||'127.0.0.1',_0x2996b0=null,_0x2b6dcb=0x0;EventEmitter[_0x092f('0x4')](_0x2db72b);function _0x542b99(){if(!_0x5e9f2c){_0x2db72b[_0x092f('0x5')]('error',new AGIError(_0x092f('0x6')));return![];}_0x2996b0=net['createServer']();_0x2996b0[_0x092f('0x7')](_0x5e9f2c,_0x47f54d);_0x2996b0['on']('listening',function(){_0x2db72b[_0x092f('0x5')](_0x092f('0x8'));});_0x2996b0['on'](_0x092f('0x9'),function(_0x5c04d9){_0x2996b0[_0x092f('0xa')](function(_0x2569cb,_0x2f58c5){if(_0x2569cb){_0x2db72b[_0x092f('0x5')](_0x092f('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x2569cb));}else if(_0x16bf0b&&_0x16bf0b<0x0){_0x2db72b[_0x092f('0x5')](_0x092f('0xb'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5c04d9[_0x092f('0xc')]();}else if(_0x16bf0b&&_0x16bf0b>0x0&&_0x16bf0b<_0x2f58c5){_0x2b6dcb+=0x1;_0x2db72b[_0x092f('0x5')](_0x092f('0xb'),new AGIError(_0x092f('0xd'),_0x2b6dcb));_0x5c04d9[_0x092f('0xc')]();}else{var _0x3b1f34=new AGIChannel(_0x5c04d9);_0x3b1f34['on'](_0x092f('0xe'),function(){_0x2db72b[_0x092f('0x5')]('connection',_0x3b1f34);});}});});_0x2996b0['on'](_0x092f('0xb'),function(_0x346c68){_0x2db72b[_0x092f('0x5')](_0x092f('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x346c68['code']));});_0x2996b0['on'](_0x092f('0xf'),function(){_0x2db72b[_0x092f('0x5')](_0x092f('0xf'),new AGIError(_0x092f('0x10')));});}process[_0x092f('0x11')](function(){_0x542b99();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3ae5bc,_0x3820ac,_0x2c4f47){return new AGIServer(_0x3ae5bc,_0x3820ac,_0x2c4f47);}; \ No newline at end of file +var _0x7ec2=['listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','nextTick','inherits','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen'];(function(_0x5e76d9,_0x480643){var _0x391309=function(_0x351622){while(--_0x351622){_0x5e76d9['push'](_0x5e76d9['shift']());}};_0x391309(++_0x480643);}(_0x7ec2,0x15c));var _0x27ec=function(_0x1d8ff0,_0x16ef8f){_0x1d8ff0=_0x1d8ff0-0x0;var _0x3f572e=_0x7ec2[_0x1d8ff0];return _0x3f572e;};'use strict';var util=require(_0x27ec('0x0'));var net=require(_0x27ec('0x1'));var EventEmitter=require(_0x27ec('0x2'))['EventEmitter'];var AGIError=require(_0x27ec('0x3'));var AGIChannel=require(_0x27ec('0x4'));var AGIServer=function(_0x53ad30,_0x45b293,_0x340231){var _0x3e1120=this,_0x53ad30=_0x53ad30||0x11dd,_0x45b293=_0x45b293||_0x27ec('0x5'),_0x2f5fcb=null,_0x2ac546=0x0;EventEmitter[_0x27ec('0x6')](_0x3e1120);function _0x1ad634(){if(!_0x53ad30){_0x3e1120[_0x27ec('0x7')](_0x27ec('0x8'),new AGIError(_0x27ec('0x9')));return![];}_0x2f5fcb=net[_0x27ec('0xa')]();_0x2f5fcb[_0x27ec('0xb')](_0x53ad30,_0x45b293);_0x2f5fcb['on'](_0x27ec('0xc'),function(){_0x3e1120[_0x27ec('0x7')](_0x27ec('0xc'));});_0x2f5fcb['on'](_0x27ec('0xd'),function(_0x2abdc6){_0x2f5fcb[_0x27ec('0xe')](function(_0x56c2af,_0x21952a){if(_0x56c2af){_0x3e1120[_0x27ec('0x7')](_0x27ec('0x8'),new AGIError(_0x27ec('0xf'),_0x56c2af));}else if(_0x340231&&_0x340231<0x0){_0x3e1120['emit'](_0x27ec('0x8'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x2abdc6[_0x27ec('0x10')]();}else if(_0x340231&&_0x340231>0x0&&_0x340231<_0x21952a){_0x2ac546+=0x1;_0x3e1120[_0x27ec('0x7')](_0x27ec('0x8'),new AGIError(_0x27ec('0x11'),_0x2ac546));_0x2abdc6[_0x27ec('0x10')]();}else{var _0x14cde9=new AGIChannel(_0x2abdc6);_0x14cde9['on'](_0x27ec('0x12'),function(){_0x3e1120['emit'](_0x27ec('0xd'),_0x14cde9);});}});});_0x2f5fcb['on'](_0x27ec('0x8'),function(_0x486dae){_0x3e1120['emit'](_0x27ec('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x486dae[_0x27ec('0x13')]));});_0x2f5fcb['on'](_0x27ec('0x14'),function(){_0x3e1120[_0x27ec('0x7')](_0x27ec('0x14'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x27ec('0x15')](function(){_0x1ad634();});};util[_0x27ec('0x16')](AGIServer,EventEmitter);module[_0x27ec('0x17')]=function(_0x5ac6cd,_0x37210b,_0x16dc74){return new AGIServer(_0x5ac6cd,_0x37210b,_0x16dc74);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 662578b..4822fc7 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 _0xaa02=['context','extension','accountcode','arg_1','createSquareMessage','isEmpty','callback_','lastName','isNil','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','key','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','Amy','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','uri','clone','hasOwnProperty','recursiveNodeIndex','isPlainObject','isString','replaceAllVariables','%s.%s','length','saveRestApiResult','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','minutes','createCmContact','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','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','tildeASR','TildeASR\x20Result\x20%s','gotoc','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','user','bcc','subject','service','host','port','secure','authentication','pass','sendMail\x20message','account_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','shelljs','odbc','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUserById','getTrunkById','getSound','getSoundById','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','info','query','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname'];(function(_0x3fe067,_0x42464f){var _0x3018a8=function(_0x50588f){while(--_0x50588f){_0x3fe067['push'](_0x3fe067['shift']());}};_0x3018a8(++_0x42464f);}(_0xaa02,0x18f));var _0x2aa0=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xaa02[_0x36c5b0];return _0xf19333;};'use strict';var fs=require('fs');var path=require(_0x2aa0('0x0'));var util=require(_0x2aa0('0x1'));var _=require(_0x2aa0('0x2'));var sh=require(_0x2aa0('0x3'));var odbc=require(_0x2aa0('0x4'))();var rs=require('randomstring');var moment=require(_0x2aa0('0x5'));var Mustache=require(_0x2aa0('0x6'));var rp=require(_0x2aa0('0x7'));var logger=require('../../config/logger')(_0x2aa0('0x8'));var config=require(_0x2aa0('0x9'));var scripts=require(_0x2aa0('0xa'));var FILES_PATH=_0x2aa0('0xb');var recursiveMapAttributes=[_0x2aa0('0xc'),_0x2aa0('0xd')];var verticesWithRetry=['menu',_0x2aa0('0xe'),'getsecretdigits'];var AGIVertices=function(_0x4bd5bd,_0x45b620,_0x2aa4e9){this[_0x2aa0('0xf')]=_0x4bd5bd;this[_0x2aa0('0x10')]=_0x45b620;this[_0x2aa0('0x11')]=_0x2aa4e9;};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x13')]=function(_0x101578,_0x2c07d5){this[_0x2aa0('0x10')][_0x2aa0('0x14')](_0x101578)[_0x2aa0('0x15')](function(_0x17507d){_0x2c07d5(null,_0x17507d?_0x17507d[_0x2aa0('0x16')]:![]);})['catch'](function(_0x4c5d1e){_0x2c07d5(_0x4c5d1e);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x17')]=function(_0x2d04f8,_0x1b7f24){this[_0x2aa0('0x10')][_0x2aa0('0x18')](_0x2d04f8)[_0x2aa0('0x15')](function(_0x3b3f56){_0x1b7f24(null,_0x3b3f56?_0x3b3f56[_0x2aa0('0x16')]:![]);})[_0x2aa0('0x19')](function(_0x28f7d6){_0x1b7f24(_0x28f7d6);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x1a')]=function(_0xc9b7d,_0x1beb9a){this['rpc'][_0x2aa0('0x1b')](_0xc9b7d)[_0x2aa0('0x15')](function(_0x51510f){_0x1beb9a(null,_0x51510f?_0x51510f[_0x2aa0('0x16')]:![]);})[_0x2aa0('0x19')](function(_0x34a2c7){_0x1beb9a(_0x34a2c7);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x1c')]=function(_0x3ea4dc,_0x4b27b0){this[_0x2aa0('0x10')]['getSquareOdbcById'](_0x3ea4dc)['then'](function(_0x2ffa91){_0x4b27b0(null,_0x2ffa91?_0x2ffa91[_0x2aa0('0x1d')]:![]);})[_0x2aa0('0x19')](function(_0x3b7bf4){_0x4b27b0(_0x3b7bf4);});};AGIVertices['prototype']['getUser']=function(_0x592bdc,_0x46f718){this[_0x2aa0('0x10')][_0x2aa0('0x1e')](_0x592bdc)[_0x2aa0('0x15')](function(_0x422bc1){_0x46f718(null,_0x422bc1?_0x422bc1[_0x2aa0('0x16')]:![]);})[_0x2aa0('0x19')](function(_0x5659b6){_0x46f718(_0x5659b6);});};AGIVertices[_0x2aa0('0x12')]['getTrunk']=function(_0x2f624f,_0x569287){this[_0x2aa0('0x10')][_0x2aa0('0x1f')](_0x2f624f)[_0x2aa0('0x15')](function(_0x2a72c9){_0x569287(null,_0x2a72c9?_0x2a72c9['name']:![]);})[_0x2aa0('0x19')](function(_0x2d2c03){_0x569287(_0x2d2c03);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x20')]=function(_0x59573c,_0xdb8db6){var _0x239330=this;this[_0x2aa0('0x10')][_0x2aa0('0x21')](_0x59573c)[_0x2aa0('0x15')](function(_0xbd2391){_0xdb8db6(null,_0xbd2391?_0x239330['getSoundPath'](_0xbd2391['save_name']):![]);})[_0x2aa0('0x19')](function(_0x245507){_0xdb8db6(_0x245507);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x22')]=function(_0x12401a,_0x461286){this[_0x2aa0('0x10')]['getMailAccountById'](_0x12401a)[_0x2aa0('0x15')](function(_0x18e4b1){_0x461286(null,_0x18e4b1?_0x18e4b1:![]);})[_0x2aa0('0x19')](function(_0x1bb54a){_0x461286(_0x1bb54a);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x23')]=function(_0x61c60b,_0xcb5732,_0x58440c){this[_0x2aa0('0x11')][_0x2aa0('0x23')](_0x61c60b,_0xcb5732)[_0x2aa0('0x15')](function(){_0x58440c(null);})[_0x2aa0('0x19')](function(_0x565370){_0x58440c(_0x565370);});};AGIVertices['prototype'][_0x2aa0('0x24')]=function(_0x2aae83,_0xfc9ad1){this[_0x2aa0('0x10')][_0x2aa0('0x25')](_0x2aae83)[_0x2aa0('0x15')](function(_0x13450c){if(_0x13450c){if(_0x13450c[_0x2aa0('0x26')]){_0xfc9ad1(null,[_0x13450c[_0x2aa0('0x27')]]);}else{_0xfc9ad1(null,_[_0x2aa0('0x28')](_0x13450c[_0x2aa0('0x29')],'interval'));}}else{_0xfc9ad1(null,![]);}})[_0x2aa0('0x19')](function(_0xc3e220){_0xfc9ad1(_0xc3e220);});};AGIVertices[_0x2aa0('0x12')]['getSoundPath']=function(_0x5c2b8b){return util[_0x2aa0('0x2a')](_0x2aa0('0x2b'),FILES_PATH,_0x5c2b8b);};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x2c')]=function(_0x1a5737,_0x40b55c,_0x4a0750){odbc['open'](_0x1a5737,function(_0x200307){if(_0x200307){logger[_0x2aa0('0x2d')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x200307);_0x4a0750(_0x200307);}else{logger[_0x2aa0('0x2e')]('ODBC\x20connection\x20successfully');odbc[_0x2aa0('0x2f')](_0x40b55c,function(_0x12a8bc,_0x53893f){if(_0x12a8bc){logger[_0x2aa0('0x2e')]('Error\x20executing\x20query\x20%s',_0x40b55c);_0x4a0750(_0x12a8bc);}else{logger[_0x2aa0('0x2e')](_0x2aa0('0x30'),_0x40b55c);odbc[_0x2aa0('0x31')](function(_0x81dc94){if(_0x81dc94){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x81dc94);}_0x4a0750(null,_0x53893f);});}});}});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x32')]=function(_0x447a25,_0x299b1e){this[_0x2aa0('0x10')][_0x2aa0('0x33')](_0x447a25)[_0x2aa0('0x15')](function(_0x160d60){_0x299b1e(null,_0x160d60?_0x160d60:![]);})['catch'](function(_0x2d389f){_0x299b1e(_0x2d389f);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x34')]=function(_0x5434f5,_0xc31711){this[_0x2aa0('0x10')][_0x2aa0('0x34')](_0x5434f5)['then'](function(_0x48982e){_0xc31711(null,_0x48982e);})[_0x2aa0('0x19')](function(_0x453b04){_0xc31711(_0x453b04);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x35')]=function(_0x1ae87e,_0x4d3646,_0x479086){this[_0x2aa0('0x10')][_0x2aa0('0x35')]({'uniqueid':this[_0x2aa0('0xf')][_0x2aa0('0x36')],'node':_0x1ae87e[_0x2aa0('0x37')],'application':_0x1ae87e[_0x2aa0('0x38')],'data':_0x4d3646||null,'project_name':this['channel']['arg_1'],'callerid':this['channel'][_0x2aa0('0x39')]})[_0x2aa0('0x15')](function(_0x49731b){if(_0x479086){_0x479086(null,_0x49731b);}})[_0x2aa0('0x19')](function(_0x4495b5){if(_0x479086){_0x479086(_0x4495b5);}});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x3a')]=function(_0x1457b7,_0x122251,_0x2fafaa,_0x259c65){this[_0x2aa0('0x10')][_0x2aa0('0x3a')]({'uniqueid':this[_0x2aa0('0xf')][_0x2aa0('0x36')],'callerid':this[_0x2aa0('0xf')][_0x2aa0('0x39')],'calleridname':this['channel'][_0x2aa0('0x3b')],'context':this[_0x2aa0('0xf')][_0x2aa0('0x3c')],'extension':this[_0x2aa0('0xf')][_0x2aa0('0x3d')],'priority':this[_0x2aa0('0xf')]['priority'],'accountcode':this[_0x2aa0('0xf')][_0x2aa0('0x3e')],'dnid':this[_0x2aa0('0xf')]['dnid'],'projectName':this[_0x2aa0('0xf')][_0x2aa0('0x3f')],'saveName':_0x122251,'filename':_0x1457b7['file']||_0x122251,'savePath':_0x2fafaa})[_0x2aa0('0x15')](function(_0x14d68a){_0x259c65(null,_0x14d68a);})['catch'](function(_0x4200fc){_0x259c65(_0x4200fc);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x40')]=function(_0x3799b7,_0x23bda2,_0x43366a,_0x5a191a,_0x2e5736){this['rpc'][_0x2aa0('0x40')]({'uniqueid':this[_0x2aa0('0xf')][_0x2aa0('0x36')],'body':_0x3799b7,'direction':_0x23bda2,'providerName':_0x43366a,'providerResponse':_0x5a191a})[_0x2aa0('0x15')](function(_0x5eb117){if(_0x2e5736){_0x2e5736(null,_0x5eb117);}})[_0x2aa0('0x19')](function(_0x5a0fb0){if(_0x2e5736){_0x2e5736(_0x5a0fb0);}});};AGIVertices['prototype']['createCmContact']=function(_0x4843b2,_0x5c5a1a){this[_0x2aa0('0x10')]['createCmContact']({'firstName':_[_0x2aa0('0x41')](_0x4843b2[_0x2aa0('0x16')])||_['isNil'](_0x4843b2[_0x2aa0('0x16')])?_0x2aa0('0x42')+Math['random']():_0x4843b2[_0x2aa0('0x16')],'lastName':_['isEmpty'](_0x4843b2[_0x2aa0('0x43')])||_[_0x2aa0('0x44')](_0x4843b2[_0x2aa0('0x43')])?null:_0x4843b2[_0x2aa0('0x43')],'phone':_0x4843b2[_0x2aa0('0x45')],'ListId':_0x4843b2['list_id'],'scheduledat':_0x4843b2[_0x2aa0('0x46')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x2aa0('0x47'),'description':_0x2aa0('0x48')+_0x4843b2[_0x2aa0('0x46')]['toString'](),'priority':_0x4843b2[_0x2aa0('0x49')]})[_0x2aa0('0x15')](function(_0x194858){_0x5c5a1a(null,_0x194858);})[_0x2aa0('0x19')](function(_0x5781ae){_0x5c5a1a(_0x5781ae);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x4a')]=function(_0x49da44,_0x5d91e2){this[_0x2aa0('0x10')][_0x2aa0('0x4b')](_0x49da44)['then'](function(_0x2b9b13){_0x5d91e2(null,_0x2b9b13?_0x2b9b13[_0x2aa0('0x16')]:![]);})[_0x2aa0('0x19')](function(_0x1c741f){_0x5d91e2(_0x1c741f);});};AGIVertices[_0x2aa0('0x12')]['agentPause']=function(_0x69781d,_0xbda87a,_0x5135db){var _0x445300={'role':_0x2aa0('0x4c')};_0x445300[_0x69781d]=this[_0x2aa0('0xf')][_0x2aa0('0x39')];this['rpc'][_0x2aa0('0x4d')](_0x445300,_0xbda87a,this[_0x2aa0('0xf')][_0x2aa0('0x36')])[_0x2aa0('0x15')](function(_0x5171bb){_0x5135db(null,_[_0x2aa0('0x44')](_0x5171bb)?![]:!![]);})[_0x2aa0('0x19')](function(_0x19107b){logger[_0x2aa0('0x2d')](_0x19107b);_0x5135db(null,![]);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x4e')]=function(_0x3c9d20,_0xc653b1){var _0x330f2d={'role':_0x2aa0('0x4c')};_0x330f2d[_0x3c9d20]=this[_0x2aa0('0xf')][_0x2aa0('0x39')];this[_0x2aa0('0x10')][_0x2aa0('0x4e')](_0x330f2d)['then'](function(_0x2291b3){_0xc653b1(null,_[_0x2aa0('0x44')](_0x2291b3)?![]:!![]);})[_0x2aa0('0x19')](function(_0x4b4e99){logger['error'](_0x4b4e99);_0xc653b1(null,![]);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x4f')]=function(_0x4acd2b,_0x62a108){var _0x3f056c={'role':_0x2aa0('0x4c')};_0x3f056c[_0x4acd2b]=this[_0x2aa0('0xf')][_0x2aa0('0x39')];this[_0x2aa0('0x10')][_0x2aa0('0x4f')](_0x3f056c)[_0x2aa0('0x15')](function(_0x7af933){_0x62a108(null,_[_0x2aa0('0x44')](_0x7af933)?![]:!![]);})[_0x2aa0('0x19')](function(_0x2000ef){logger[_0x2aa0('0x2d')](_0x2000ef);_0x62a108(null,![]);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x50')]=function(_0x29a333,_0x3b7f02){var _0x4f0e8f={'role':_0x2aa0('0x4c')};_0x4f0e8f[_0x29a333]=this[_0x2aa0('0xf')][_0x2aa0('0x39')];var _0x4ea1fb=_0x29a333!=_0x2aa0('0x51')?util[_0x2aa0('0x2a')](_0x2aa0('0x52'),_0x2aa0('0x53'),this['channel']['callerid']):undefined;this[_0x2aa0('0x10')][_0x2aa0('0x50')](_0x4f0e8f,_0x4ea1fb)[_0x2aa0('0x15')](function(_0x42b196){_0x3b7f02(null,_['isNil'](_0x42b196)?![]:!![]);})['catch'](function(_0x808196){logger[_0x2aa0('0x2d')](_0x808196);_0x3b7f02(null,![]);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x54')]=function(_0x8c9d7f,_0x13fe0f){sh['exec'](_[_0x2aa0('0x55')](_0x8c9d7f),function(_0x16f230,_0x1a38a0){var _0xb0bf67=_0x1a38a0[_0x2aa0('0x56')](/(\r\n|\n|\r)/gm,'');_0x13fe0f(null,_0xb0bf67);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x57')]=function(_0x151709,_0x5a4c3b){scripts[_0x2aa0('0x57')](_0x151709[_0x2aa0('0x58')],_0x151709[_0x2aa0('0x59')]||_0x2aa0('0x5a'),_0x151709[_0x2aa0('0x5a')],_0x151709['languageCode']||_0x2aa0('0x5b'),_0x151709[_0x2aa0('0x5c')]||_0x2aa0('0x5d'),_0x151709['audioEncoding']||'MP3')[_0x2aa0('0x15')](function(_0x31ad24){_0x5a4c3b(null,_0x31ad24);})['catch'](function(_0x2dea51){_0x5a4c3b(_0x2dea51);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x5e')]=function(_0x2b60e5,_0x44529b){scripts['googleTTS'](_0x2b60e5[_0x2aa0('0x5a')],_0x2b60e5[_0x2aa0('0x5f')]||'en',0x1)['then'](function(_0xd86adc){_0x44529b(null,_0xd86adc);})[_0x2aa0('0x19')](function(_0x3fc7b6){_0x44529b(_0x3fc7b6);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x60')]=function(_0x31999c,_0x5eed2d){var _0x236230={'uri':_0x31999c[_0x2aa0('0x61')],'method':_0x31999c[_0x2aa0('0x62')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x31999c[_0x2aa0('0x63')])===_0x2aa0('0x64')&&parseInt(_0x31999c[_0x2aa0('0x63')])>=0x1?parseInt(_0x31999c[_0x2aa0('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x2aa0('0x65')]([_0x2aa0('0x66'),'PUT'],_0x236230['method'][_0x2aa0('0x67')]())){try{_0x236230[_0x2aa0('0x68')]=_0x31999c[_0x2aa0('0xd')]?JSON['parse'](_0x31999c[_0x2aa0('0xd')]):{};}catch(_0x2a95de){logger[_0x2aa0('0x2d')](_0x2aa0('0x69'),_0x2a95de);}}try{_0x236230[_0x2aa0('0x6a')]=_0x31999c[_0x2aa0('0xc')]?JSON[_0x2aa0('0x6b')](_0x31999c['rawHeaders']):{};}catch(_0x43d8df){logger['error'](_0x2aa0('0x6c'),_0x43d8df);}if(_0x31999c[_0x2aa0('0x6d')]){try{var _0xc71f97=require(_0x31999c[_0x2aa0('0x6d')])[_0x2aa0('0x6e')](this,_0x236230);_0x236230['uri']=Mustache[_0x2aa0('0x6f')](_0x31999c[_0x2aa0('0x61')],_0xc71f97,{},['$$','$$']);if(_0x236230['headers']){_0x236230[_0x2aa0('0x6a')]=JSON[_0x2aa0('0x6b')](Mustache[_0x2aa0('0x6f')](JSON[_0x2aa0('0x70')](_0x236230[_0x2aa0('0x6a')]),_0xc71f97,{},['$$','$$']));}if(_0x236230[_0x2aa0('0x68')]){_0x236230[_0x2aa0('0x68')]=JSON[_0x2aa0('0x6b')](Mustache[_0x2aa0('0x6f')](JSON['stringify'](_0x236230['body']),_0xc71f97,{},['$$','$$']));}}catch(_0xeb67fe){logger[_0x2aa0('0x2d')](_0x2aa0('0x71'),_0xeb67fe);}}rp(_0x236230)['then'](function(_0x16e63e){var _0x35c457={'statusCode':_0x16e63e[_0x2aa0('0x72')]||0xc8,'statusMessage':_0x16e63e[_0x2aa0('0x73')]||'OK','headers':_0x16e63e[_0x2aa0('0x6a')]||{},'body':_0x16e63e['body']||{}};_0x5eed2d(null,_0x35c457);})[_0x2aa0('0x19')](function(_0x21fb38){var _0x1a6fa0={'statusCode':_0x21fb38['statusCode']||0x1f4,'statusMessage':_0x21fb38[_0x2aa0('0x74')]||_0x2aa0('0x75'),'headers':_0x21fb38[_0x2aa0('0x76')][_0x2aa0('0x6a')]||{},'body':_0x21fb38[_0x2aa0('0x76')][_0x2aa0('0x68')]||{}};_0x5eed2d(null,_0x1a6fa0);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x77')]=function(_0x386d2e,_0x5c7e22){scripts[_0x2aa0('0x77')](this[_0x2aa0('0xf')][_0x2aa0('0x36')],_0x386d2e['key'],_0x386d2e['text'],_0x386d2e[_0x2aa0('0x78')]||'en')[_0x2aa0('0x15')](function(_0x57feaf){_0x5c7e22(null,_0x57feaf);})[_0x2aa0('0x19')](function(_0x11dda2){_0x5c7e22(_0x11dda2);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x79')]=function(_0x1e88c2,_0x587bb5){scripts[_0x2aa0('0x79')](this[_0x2aa0('0xf')][_0x2aa0('0x36')],_0x1e88c2['dialogflowV2_project_id'],_0x1e88c2[_0x2aa0('0x7a')],_0x1e88c2[_0x2aa0('0x7b')],_0x1e88c2[_0x2aa0('0x5a')],_0x1e88c2[_0x2aa0('0x7c')]||'en')[_0x2aa0('0x15')](function(_0x5f1f1d){_0x587bb5(null,_0x5f1f1d);})[_0x2aa0('0x19')](function(_0x2beef4){_0x587bb5(_0x2beef4);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x7d')]=function(_0x5d020e,_0x13c5c1){scripts[_0x2aa0('0x7d')](this[_0x2aa0('0xf')],_0x5d020e)[_0x2aa0('0x15')](function(_0x50cf8b){_0x13c5c1(null,_0x50cf8b);})[_0x2aa0('0x19')](function(_0x31fa0b){_0x13c5c1(_0x31fa0b);});};AGIVertices[_0x2aa0('0x12')]['ispeechTTS']=function(_0x13f2a7,_0x5048b3){scripts[_0x2aa0('0x7e')](_0x13f2a7['key'],_0x13f2a7[_0x2aa0('0x5a')],_0x13f2a7[_0x2aa0('0x7f')]||_0x2aa0('0x5b'),_0x13f2a7['speed'])[_0x2aa0('0x15')](function(_0x205c5d){_0x5048b3(null,_0x205c5d);})[_0x2aa0('0x19')](function(_0x583462){_0x5048b3(_0x583462);});};AGIVertices[_0x2aa0('0x12')]['ispeechASR']=function(_0x40ee3e,_0x528328,_0x44749e){scripts[_0x2aa0('0x80')](_0x528328,_0x40ee3e[_0x2aa0('0x81')],_0x40ee3e[_0x2aa0('0x82')]||_0x2aa0('0x5b'),this[_0x2aa0('0x83')](_0x40ee3e[_0x2aa0('0x84')])?_0x40ee3e[_0x2aa0('0x84')]:undefined)['then'](function(_0x10af91){_0x44749e(null,_0x10af91);})[_0x2aa0('0x19')](function(_0x54387f){_0x44749e(_0x54387f);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x85')]=function(_0x47508b,_0x3dbb12){scripts[_0x2aa0('0x85')](_0x47508b['aws_access_key_id'],_0x47508b['aws_secret_access_key'],_0x47508b[_0x2aa0('0x86')],_0x47508b['aws_polly_voice']||_0x2aa0('0x87'),_0x47508b[_0x2aa0('0x5a')],_0x47508b[_0x2aa0('0x88')]||_0x2aa0('0x5a'))[_0x2aa0('0x15')](function(_0x2f9e3f){_0x3dbb12(null,_0x2f9e3f);})['catch'](function(_0x3575aa){_0x3dbb12(_0x3575aa);});};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x89')]=function(_0x9ca324,_0x2edff5){scripts[_0x2aa0('0x89')](this[_0x2aa0('0xf')]['uniqueid'],_0x9ca324[_0x2aa0('0x8a')],_0x9ca324[_0x2aa0('0x8b')],_0x9ca324[_0x2aa0('0x8c')],_0x9ca324[_0x2aa0('0x5a')],_0x9ca324[_0x2aa0('0x8d')])['then'](function(_0x5b95dd){_0x2edff5(null,_0x5b95dd);})[_0x2aa0('0x19')](function(_0x2a0eff){_0x2edff5(_0x2a0eff);});};AGIVertices['prototype'][_0x2aa0('0x8e')]=function(_0x8caaea,_0x12a5b3,_0x269184){scripts[_0x2aa0('0x8e')](_0x12a5b3,_0x8caaea['key'],_0x8caaea[_0x2aa0('0x8f')]||_0x2aa0('0x5b'))['then'](function(_0x28737b){_0x269184(null,_0x28737b);})['catch'](function(_0x5bc7f3){_0x269184(_0x5bc7f3);});};AGIVertices[_0x2aa0('0x12')]['tildeASR']=function(_0x160a28,_0x35b5dc,_0x35a370){scripts['tildeASR'](_0x35b5dc,_0x160a28[_0x2aa0('0x90')],_0x160a28[_0x2aa0('0x91')],_0x160a28[_0x2aa0('0x92')])[_0x2aa0('0x15')](function(_0x3ea7e3){_0x35a370(null,_0x3ea7e3);})[_0x2aa0('0x19')](function(_0x1ab31e){_0x35a370(_0x1ab31e);});};AGIVertices[_0x2aa0('0x12')]['clear']=function(_0x2a7a4c){var _0x3736a9=_[_0x2aa0('0x65')](verticesWithRetry,_0x2a7a4c[_0x2aa0('0x38')])?_0x2a7a4c:_[_0x2aa0('0x93')](_0x2a7a4c);for(var _0x2559e8 in _0x3736a9){if(_0x3736a9[_0x2aa0('0x94')](_0x2559e8)){if(_0x3736a9[_0x2559e8]&&_['isString'](_0x3736a9[_0x2559e8])){if(_[_0x2aa0('0x65')](recursiveMapAttributes,_0x2559e8)){_0x3736a9[_0x2559e8]=this['replaceObjectAllVariables'](_0x3736a9[_0x2559e8]);}else{_0x3736a9[_0x2559e8]=this['replaceAllVariables'](_0x3736a9[_0x2559e8]);}}}}return _0x3736a9;};AGIVertices['prototype'][_0x2aa0('0x95')]=function(_0x39ad1a){for(var _0x2ce4e5 in _0x39ad1a){if(_0x39ad1a[_0x2aa0('0x94')](_0x2ce4e5)){if(_[_0x2aa0('0x96')](_0x39ad1a[_0x2ce4e5])){this[_0x2aa0('0x95')](_0x39ad1a[_0x2ce4e5]);}else if(_['isArray'](_0x39ad1a[_0x2ce4e5])){for(var _0x3e1680=0x0;_0x3e1680<_0x39ad1a[_0x2ce4e5]['length'];_0x3e1680++){this[_0x2aa0('0x95')](_0x39ad1a[_0x2ce4e5][_0x3e1680]);}}else if(_[_0x2aa0('0x97')](_0x39ad1a[_0x2ce4e5])){_0x39ad1a[_0x2ce4e5]=this[_0x2aa0('0x98')](_0x39ad1a[_0x2ce4e5]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x37fae1,_0x12fc6a){for(var _0x5dbdcc in _0x37fae1){if(_0x37fae1['hasOwnProperty'](_0x5dbdcc)){if(_[_0x2aa0('0x96')](_0x37fae1[_0x5dbdcc])){if(!_[_0x2aa0('0x41')](_0x37fae1[_0x5dbdcc])){this['saveRestApiResult'](_0x37fae1[_0x5dbdcc],util[_0x2aa0('0x2a')](_0x2aa0('0x99'),_0x12fc6a,_0x5dbdcc));}}else if(_['isArray'](_0x37fae1[_0x5dbdcc])){for(var _0x5ac987=0x0;_0x5ac987<_0x37fae1[_0x5dbdcc][_0x2aa0('0x9a')];_0x5ac987++){this[_0x2aa0('0x9b')](_0x37fae1[_0x5dbdcc][_0x5ac987],util[_0x2aa0('0x2a')](_0x2aa0('0x99'),_0x12fc6a,_0x5dbdcc+'['+_0x5ac987+']'));}}else{if(!_[_0x2aa0('0x44')](_0x37fae1[_0x5dbdcc])){this[_0x2aa0('0xf')]['setVariable'](util[_0x2aa0('0x2a')](_0x2aa0('0x99'),_0x12fc6a,_0x5dbdcc),_0x37fae1[_0x5dbdcc]);}}}}};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x9c')]=function(_0x3e30c8){try{var _0x33fd61=JSON[_0x2aa0('0x6b')](_0x3e30c8);this[_0x2aa0('0x95')](_0x33fd61);return JSON[_0x2aa0('0x70')](_0x33fd61);}catch(_0x5152bb){return this[_0x2aa0('0x98')](_0x3e30c8);}};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x98')]=function(_0x19312a){var _0x5c7641=_0x19312a[_0x2aa0('0x9d')]('{');for(var _0x27e1e3=0x1;_0x27e1e3<_0x5c7641[_0x2aa0('0x9a')];_0x27e1e3+=0x1){var _0x27a01d=_0x5c7641[_0x27e1e3][_0x2aa0('0x9d')]('}');if(_0x27a01d['length']>0x1){_0x19312a=_0x19312a[_0x2aa0('0x9e')]('{'+_0x27a01d[0x0]+'}',this[_0x2aa0('0xf')]['getVariable'](_0x27a01d[0x0])[_0x2aa0('0x9f')]||_0x27a01d[0x0]);}}if(_0x5c7641['length']===0x1){return _0x19312a['toString']();}return this[_0x2aa0('0x98')](_0x19312a);};AGIVertices['prototype'][_0x2aa0('0xa0')]=function(_0x4c4a99,_0x1d2e7e){var _0x3e1d2b=this[_0x2aa0('0xf')][_0x2aa0('0x13')](_0x4c4a99);if(_0x3e1d2b[_0x2aa0('0xa1')]===-0x1){return _0x3e1d2b;}logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0xa2'),_0x1d2e7e,_0x3e1d2b[_0x2aa0('0x9f')]));return this['channel'][_0x2aa0('0xa3')](_0x1d2e7e,_0x3e1d2b[_0x2aa0('0x9f')]);};AGIVertices[_0x2aa0('0x12')]['isConfigured']=function(_0x4b3c18){return _0x4b3c18&&_0x4b3c18!=='0'&&_0x4b3c18!=='-1'&&_0x4b3c18!=='';};AGIVertices['prototype'][_0x2aa0('0xa4')]=function(_0x48b147){this[_0x2aa0('0x35')]['sync'](this,_0x48b147,'-');_0x48b147[_0x2aa0('0xa5')]=_0x48b147[_0x2aa0('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x41ce62){logger[_0x2aa0('0x2e')](util['format'](_0x2aa0('0xa6'),_0x41ce62[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x41ce62[_0x2aa0('0x5a')])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0xa8'));}var _0xf0d5c4='\x22'+_0x41ce62['text']+'\x22';if(this[_0x2aa0('0x83')](_0x41ce62[_0x2aa0('0x76')])){_0xf0d5c4+=','+_0x41ce62[_0x2aa0('0x76')];}var _0x1ea28b=this[_0x2aa0('0xf')][_0x2aa0('0xa9')](_0x2aa0('0xaa'),_0xf0d5c4);if(_0x1ea28b['result']===-0x1){return _0x1ea28b;}return this[_0x2aa0('0xf')]['noop'](util[_0x2aa0('0x2a')](_0x2aa0('0xab'),_0xf0d5c4));};AGIVertices[_0x2aa0('0x12')]['mrcprecog']=function(_0x377ea7){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0xac'),_0x377ea7[_0x2aa0('0x37')]));if(!this['isConfigured'](_0x377ea7[_0x2aa0('0xad')])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0xae'));}var _0x322a58=_0x377ea7[_0x2aa0('0xad')];if(this[_0x2aa0('0x83')](_0x377ea7[_0x2aa0('0x76')])){_0x322a58+=','+_0x377ea7[_0x2aa0('0x76')];}var _0x1e9a11=this[_0x2aa0('0xf')][_0x2aa0('0xa9')](_0x2aa0('0xaf'),_0x322a58);if(_0x1e9a11['result']===-0x1){return _0x1e9a11;}var _0xe64daf=this['getAndSetVariable'](_0x2aa0('0xb0'),_0x2aa0('0xb1'));if(_0xe64daf[_0x2aa0('0xa1')]===-0x1){return _0xe64daf;}var _0xc69a52=this[_0x2aa0('0xa0')]('RECOG_INPUT()',_0x2aa0('0xb2'));if(_0xc69a52[_0x2aa0('0xa1')]===-0x1){return _0xc69a52;}var _0x341731=this['getAndSetVariable']('RECOG_INSTANCE()',_0x2aa0('0xb3'));if(_0x341731[_0x2aa0('0xa1')]===-0x1){return _0x341731;}return this['channel']['noop'](util['format'](_0x2aa0('0xb4'),_0x322a58));};AGIVertices[_0x2aa0('0x12')]['agi']=function(_0x4457eb){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0xb5'),_0x4457eb[_0x2aa0('0x37')]));return this[_0x2aa0('0xf')][_0x2aa0('0x8')]([_0x4457eb['command'],_0x4457eb['args']]);};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0xb6')]=function(_0x5bad6d){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0xb7'),_0x5bad6d[_0x2aa0('0x37')]));if(this[_0x2aa0('0x83')](_0x5bad6d['timeout'])){logger['info'](util[_0x2aa0('0x2a')](_0x2aa0('0xb8'),_0x5bad6d[_0x2aa0('0x63')]));var _0x9cdf4b=this['channel'][_0x2aa0('0xb9')](_0x5bad6d[_0x2aa0('0x63')]);if(_0x9cdf4b['result']===-0x1){return _0x9cdf4b;}}return this[_0x2aa0('0xf')][_0x2aa0('0xb6')]();};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x47')]=function(_0x44a673){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0xba'),_0x44a673[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x44a673[_0x2aa0('0xbb')])){return this['channel'][_0x2aa0('0x2d')](_0x44a673,_0x2aa0('0xbc'));}_0x44a673[_0x2aa0('0x46')]=moment();if(this[_0x2aa0('0x83')](_0x44a673[_0x2aa0('0xbd')])){_0x44a673['scheduledAt']=moment()['add'](_0x44a673[_0x2aa0('0xbd')],_0x2aa0('0xbe'));}if(!this['isConfigured'](_0x44a673[_0x2aa0('0x49')])){_0x44a673[_0x2aa0('0x49')]=0x2;}this[_0x2aa0('0xbf')][_0x2aa0('0x6e')](this,_0x44a673);return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0xc0'),_0x44a673[_0x2aa0('0x45')],_0x44a673[_0x2aa0('0xbb')],_0x44a673['scheduledAt']));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0xc1')]=function(_0x3ffca2){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0xc2'),_0x3ffca2[_0x2aa0('0x37')]));var _0x488266=this['channel'][_0x2aa0('0xa9')](_0x3ffca2[_0x2aa0('0xc3')],_0x3ffca2['options']);if(_0x488266[_0x2aa0('0xa1')]===-0x1){return _0x488266;}return this['channel'][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0xc4'),_0x3ffca2[_0x2aa0('0xc3')],_0x3ffca2[_0x2aa0('0x76')]));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0xc5')]=function(_0x1fc2f1){logger['info'](util[_0x2aa0('0x2a')](_0x2aa0('0xc6'),_0x1fc2f1['label']));if(!this['isConfigured'](_0x1fc2f1[_0x2aa0('0x5a')])){return this['channel'][_0x2aa0('0xa7')]('no\x20text\x20configured');}var _0x3835c4='\x22'+_0x1fc2f1[_0x2aa0('0x5a')]+'\x22';if(this[_0x2aa0('0x83')](_0x1fc2f1[_0x2aa0('0x76')])){_0x3835c4+=','+_0x1fc2f1[_0x2aa0('0x76')];}var _0x17be92=this[_0x2aa0('0xf')][_0x2aa0('0xa9')]('MRCPSynth',_0x3835c4);if(_0x17be92[_0x2aa0('0xa1')]===-0x1){return _0x17be92;}return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0xab'),_0x3835c4));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0xc7')]=function(_0x758913){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0xc8'),_0x758913[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x758913['text'])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')]('no\x20text\x20configured');}var _0x5e28f4='\x22'+_0x758913['text']+'\x22';if(this[_0x2aa0('0x83')](_0x758913[_0x2aa0('0x76')])){_0x5e28f4+=','+_0x758913[_0x2aa0('0x76')];}var _0x32cedf=this[_0x2aa0('0xf')][_0x2aa0('0xa9')](_0x2aa0('0xaa'),_0x5e28f4);if(_0x32cedf[_0x2aa0('0xa1')]===-0x1){return _0x32cedf;}return this[_0x2aa0('0xf')]['noop'](util[_0x2aa0('0x2a')](_0x2aa0('0xab'),_0x5e28f4));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0xc9')]=function(_0x2b2fc3){logger['info'](util['format'](_0x2aa0('0xca'),_0x2b2fc3['label']));if(!this[_0x2aa0('0x83')](_0x2b2fc3[_0x2aa0('0xad')])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')]('no\x20grammar\x20configured');}var _0x1cebe6=_0x2b2fc3[_0x2aa0('0xad')];if(this[_0x2aa0('0x83')](_0x2b2fc3[_0x2aa0('0x76')])){_0x1cebe6+=','+_0x2b2fc3[_0x2aa0('0x76')];}var _0x1c562f=this[_0x2aa0('0xf')]['exec'](_0x2aa0('0xaf'),_0x1cebe6);if(_0x1c562f['result']===-0x1){return _0x1c562f;}var _0x3ce0ed=this[_0x2aa0('0xa0')](_0x2aa0('0xb0'),_0x2aa0('0xcb'));if(_0x3ce0ed[_0x2aa0('0xa1')]===-0x1){return _0x3ce0ed;}var _0x34e0cf=this[_0x2aa0('0xa0')](_0x2aa0('0xcc'),_0x2aa0('0xcd'));if(_0x34e0cf['result']===-0x1){return _0x34e0cf;}var _0x3246f6=this[_0x2aa0('0xa0')](_0x2aa0('0xce'),_0x2aa0('0xcf'));if(_0x3246f6[_0x2aa0('0xa1')]===-0x1){return _0x3246f6;}return this[_0x2aa0('0xf')]['noop'](util[_0x2aa0('0x2a')](_0x2aa0('0xb4'),_0x1cebe6));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0xd0')]=function(_0x15a92e){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x15a92e[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x15a92e[_0x2aa0('0xad')])){return this[_0x2aa0('0xf')]['noop']('no\x20grammar\x20configured');}var _0x20966d=_0x15a92e[_0x2aa0('0xad')];if(this[_0x2aa0('0x83')](_0x15a92e[_0x2aa0('0x76')])){_0x20966d+=','+_0x15a92e[_0x2aa0('0x76')];}var _0x644f53=this[_0x2aa0('0xf')][_0x2aa0('0xa9')](_0x2aa0('0xaf'),_0x20966d);if(_0x644f53[_0x2aa0('0xa1')]===-0x1){return _0x644f53;}var _0x3e9ff2=this[_0x2aa0('0xa0')](_0x2aa0('0xb0'),_0x2aa0('0xd1'));if(_0x3e9ff2[_0x2aa0('0xa1')]===-0x1){return _0x3e9ff2;}var _0x3a1798=this[_0x2aa0('0xa0')]('RECOG_INPUT()',_0x2aa0('0xd2'));if(_0x3a1798['result']===-0x1){return _0x3a1798;}var _0x2da857=this[_0x2aa0('0xa0')](_0x2aa0('0xce'),_0x2aa0('0xd3'));if(_0x2da857[_0x2aa0('0xa1')]===-0x1){return _0x2da857;}return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x20966d));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0xd4')]=function(_0x618b2b){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0xd5'),_0x618b2b[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x618b2b[_0x2aa0('0xd6')])){return this[_0x2aa0('0xf')]['error'](_0x618b2b,'no\x20database\x20selected');}var _0x43400d=this[_0x2aa0('0x1c')][_0x2aa0('0x6e')](this,_0x618b2b[_0x2aa0('0xd6')]);if(!_0x43400d){return this[_0x2aa0('0xf')]['error'](_0x618b2b,_0x2aa0('0xd7'));}if(!this['isConfigured'](_0x618b2b[_0x2aa0('0x2f')])){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x618b2b,_0x2aa0('0xd8'));}var _0x4e5842=_0x618b2b[_0x2aa0('0x2f')][_0x2aa0('0x56')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x2aa0('0xa7')](util['format']('query:\x20%s',_0x4e5842));var _0x2a67df=this['getQueryOdbc']['sync'](this,_0x43400d,_0x4e5842);this[_0x2aa0('0x35')][_0x2aa0('0x6e')](this,_0x618b2b,_0x4e5842);if(!this[_0x2aa0('0x83')](_0x618b2b['variable_id'])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0xd9'));}var _0x26210d=this['getVariable'][_0x2aa0('0x6e')](this,_0x618b2b[_0x2aa0('0xda')]);if(!_0x26210d){return this[_0x2aa0('0xf')]['error'](_0x618b2b,_0x2aa0('0xdb'));}var _0x968a3=this;_0x2a67df[_0x2aa0('0xdc')](function(_0x2f9b2d,_0x3de9fe){Object[_0x2aa0('0xdd')](_0x2f9b2d)[_0x2aa0('0xdc')](function(_0x2cff5c){_0x968a3[_0x2aa0('0xf')][_0x2aa0('0xa3')](util['format']('%s[%s][%s]',_0x26210d,_0x3de9fe,_0x2cff5c),_0x2f9b2d[_0x2cff5c]);});});this[_0x2aa0('0xf')][_0x2aa0('0xa3')](util[_0x2aa0('0x2a')]('%s_ROWS_COUNT',_0x26210d),_0x2a67df[_0x2aa0('0x9a')]);return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util['format'](_0x2aa0('0xde'),_0x26210d));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0xdf')]=function(_0x57370c){logger[_0x2aa0('0xe0')](util[_0x2aa0('0x2a')](_0x2aa0('0xe1'),_0x57370c[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x57370c[_0x2aa0('0xe2')])){return this['channel'][_0x2aa0('0x2d')](_0x57370c,_0x2aa0('0xe3'));}var _0x4048bc=this[_0x2aa0('0xe4')]['sync'](this,_0x57370c['sip_id']);if(!_0x4048bc){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x57370c,_0x2aa0('0xe5'));}var _0x25b18b=this[_0x2aa0('0xf')]['exec']('DIAL',[util['format'](_0x2aa0('0xe6'),_0x4048bc),_0x57370c[_0x2aa0('0x63')],_0x57370c[_0x2aa0('0xe7')],_0x57370c[_0x2aa0('0x61')]]);if(_0x25b18b[_0x2aa0('0xa1')]===-0x1){return _0x25b18b;}return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util['format'](_0x2aa0('0xe8'),_0x2aa0('0xe9')));};AGIVertices['prototype']['dialogflow']=function(_0x10c871){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x10c871[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x10c871['key'])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0xea'));}if(!this[_0x2aa0('0x83')](_0x10c871['text'])){return this['channel'][_0x2aa0('0xa7')](_0x2aa0('0xa8'));}this[_0x2aa0('0xf')][_0x2aa0('0xeb')]=!![];this[_0x2aa0('0x35')](_0x10c871);this[_0x2aa0('0x40')](_0x10c871['text'],'in','','');this[_0x2aa0('0xf')]['noop'](util[_0x2aa0('0x2a')](_0x2aa0('0xec'),_0x10c871[_0x2aa0('0x5a')]));var _0x2d3234=this[_0x2aa0('0x77')][_0x2aa0('0x6e')](this,_0x10c871);if(_0x2d3234){for(var _0x184138 in _0x2d3234){if(_0x2d3234[_0x2aa0('0x94')](_0x184138)){this[_0x2aa0('0xf')][_0x2aa0('0xa3')](util[_0x2aa0('0x2a')](_0x2aa0('0xed'),_0x184138[_0x2aa0('0x67')]()),_0x2d3234[_0x184138]);}}this['createSquareMessage'](_0x2d3234['speech'],_0x2aa0('0xee'),'dialogflow','');return this[_0x2aa0('0xf')]['noop'](util[_0x2aa0('0x2a')]('Dialogflow\x20Result\x20%s',_0x2d3234[_0x2aa0('0xef')]));}return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x10c871,_0x2aa0('0xf0'));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0xf1')]=function(_0x181251){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0xf2'),_0x181251[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x181251['dialogflowV2_project_id'])){return this[_0x2aa0('0xf')]['noop'](_0x2aa0('0xf3'));}if(!this[_0x2aa0('0x83')](_0x181251[_0x2aa0('0x7a')])){return this['channel'][_0x2aa0('0xa7')](_0x2aa0('0xf4'));}if(!this[_0x2aa0('0x83')](_0x181251[_0x2aa0('0x7b')])){return this['channel'][_0x2aa0('0xa7')](_0x2aa0('0xf5'));}if(!this[_0x2aa0('0x83')](_0x181251['dialogflowV2_language'])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0xf6'));}if(!this['isConfigured'](_0x181251[_0x2aa0('0x5a')])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0xa8'));}this[_0x2aa0('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x181251);this['createSquareMessage'](_0x181251[_0x2aa0('0x5a')],'in','','');this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0xf7'),_0x181251[_0x2aa0('0x5a')]));var _0x5198e6=this[_0x2aa0('0x79')][_0x2aa0('0x6e')](this,_0x181251);if(_0x5198e6){for(var _0x3bc64b in _0x5198e6){if(_0x5198e6[_0x2aa0('0x94')](_0x3bc64b)){if(_0x3bc64b!=='providerResponse'){this[_0x2aa0('0xf')]['setVariable'](util[_0x2aa0('0x2a')](_0x2aa0('0xed'),_0x3bc64b[_0x2aa0('0x67')]()),_0x5198e6[_0x3bc64b]);}}}this['createSquareMessage'](_0x5198e6['speech'],_0x2aa0('0xee'),_0x2aa0('0xf1'),_0x5198e6[_0x2aa0('0xf8')]);return this['channel']['noop'](util['format'](_0x2aa0('0xf9'),_0x5198e6[_0x2aa0('0xef')]));}return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x181251,_0x2aa0('0xfa'));};AGIVertices['prototype'][_0x2aa0('0xfb')]=function(_0x53765b){logger['info'](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x53765b[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x53765b[_0x2aa0('0xfc')])){return this['channel']['noop']('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x53765b[_0x2aa0('0xfd')])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0xfe'));}if(!this[_0x2aa0('0x83')](_0x53765b['password'])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0xff'));}if(!this[_0x2aa0('0x83')](_0x53765b[_0x2aa0('0x100')])){return this[_0x2aa0('0xf')]['noop'](_0x2aa0('0xa8'));}this[_0x2aa0('0xf')]['bot']=!![];this[_0x2aa0('0x35')](_0x53765b);this[_0x2aa0('0x40')](_0x53765b[_0x2aa0('0x5a')],'in','','');this[_0x2aa0('0xf')]['noop'](util[_0x2aa0('0x2a')](_0x2aa0('0x101'),_0x53765b['text']));var _0x11db89=this['sestekNDA'][_0x2aa0('0x6e')](this,_0x53765b);if(_0x11db89){for(var _0x5909de in _0x11db89){if(_0x11db89[_0x2aa0('0x94')](_0x5909de)){this[_0x2aa0('0xf')][_0x2aa0('0xa3')](util[_0x2aa0('0x2a')](_0x2aa0('0x102'),_0x5909de[_0x2aa0('0x67')]()),_0x11db89[_0x5909de]);}}this['createSquareMessage'](_0x11db89[_0x2aa0('0xef')],'out',_0x2aa0('0xfb'),'');if(_0x11db89['audiofile']){this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x11db89[_0x2aa0('0x103')]));var _0x14e1dc=this['channel']['streamFile'](_0x11db89[_0x2aa0('0x103')]);try{fs[_0x2aa0('0x104')](_0x11db89[_0x2aa0('0x103')]+'.wav');}catch(_0x370275){logger[_0x2aa0('0x2d')](_0x370275);}return _0x14e1dc;}else{return this[_0x2aa0('0xf')]['noop'](util[_0x2aa0('0x2a')](_0x2aa0('0x105'),_0x11db89[_0x2aa0('0xef')]));}}return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x53765b,_0x2aa0('0x106'));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x107')]=function(_0x163b56){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x108'),_0x163b56[_0x2aa0('0x37')]));return this['channel'][_0x2aa0('0xa7')](_0x2aa0('0x107'));};AGIVertices[_0x2aa0('0x12')]['ext_dial']=function(_0x428ddb){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x428ddb[_0x2aa0('0x37')]));var _0x3d3d2c='';if(_0x428ddb['trunk_id']){if(!this['isConfigured'](_0x428ddb[_0x2aa0('0x109')])){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x428ddb,_0x2aa0('0x10a'));}else{var _0x594d67=parseInt(_0x428ddb[_0x2aa0('0x109')],0xa);if(isNaN(_0x594d67)){_0x3d3d2c=_0x428ddb[_0x2aa0('0x109')];}else{_0x3d3d2c=this[_0x2aa0('0x10b')][_0x2aa0('0x6e')](this,_0x428ddb[_0x2aa0('0x109')]);if(!_0x3d3d2c){return this[_0x2aa0('0xf')]['error'](_0x428ddb,_0x2aa0('0x10c'));}}}}else if(_0x428ddb['trunk_name']){_0x3d3d2c=_0x428ddb[_0x2aa0('0x10d')];}else{return this['channel'][_0x2aa0('0x2d')](_0x428ddb,_0x2aa0('0x10a'));}var _0x5a3936=this[_0x2aa0('0xf')][_0x2aa0('0xa9')](_0x2aa0('0xe9'),[util[_0x2aa0('0x2a')](_0x2aa0('0x10e'),_0x3d3d2c,_0x428ddb[_0x2aa0('0x45')]),_0x428ddb[_0x2aa0('0x63')],_0x428ddb[_0x2aa0('0xe7')],_0x428ddb[_0x2aa0('0x61')]]);if(_0x5a3936[_0x2aa0('0xa1')]===-0x1){return _0x5a3936;}return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0xe8'),_0x2aa0('0xe9')));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x10f')]=function(_0x2ae064){logger['info'](util['format'](_0x2aa0('0x110'),_0x2ae064[_0x2aa0('0x37')]));return this[_0x2aa0('0xf')]['noop'](_0x2aa0('0x10f'));};AGIVertices[_0x2aa0('0x12')]['getdigits']=function(_0x17f0b9){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x17f0b9[_0x2aa0('0x37')]));if(_0x17f0b9[_0x2aa0('0xa5')]===0x0){return this['maxRetry'](_0x17f0b9);}_0x17f0b9[_0x2aa0('0xa5')]-=0x1;if(!this[_0x2aa0('0x83')](_0x17f0b9[_0x2aa0('0x111')])){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x17f0b9,_0x2aa0('0x112'));}var _0x2e0bf9=this[_0x2aa0('0x20')][_0x2aa0('0x6e')](this,_0x17f0b9[_0x2aa0('0x111')]);if(!_0x2e0bf9){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x17f0b9,_0x2aa0('0x113'));}if(!this['isConfigured'](_0x17f0b9[_0x2aa0('0xda')])){return this[_0x2aa0('0xf')]['error'](_0x2aa0('0xd9'));}var _0x50d4fa=this[_0x2aa0('0xf')][_0x2aa0('0x114')](_0x2e0bf9,_0x17f0b9[_0x2aa0('0x115')],_0x17f0b9[_0x2aa0('0x116')]);var _0x4e925b=_0x50d4fa[_0x2aa0('0xa1')]?_0x50d4fa[_0x2aa0('0xa1')]['toString']():'';logger[_0x2aa0('0x2e')](_0x2aa0('0x117'),JSON[_0x2aa0('0x70')](_0x50d4fa));if(_0x50d4fa[_0x2aa0('0xa1')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x17f0b9,_0x4e925b);return _0x50d4fa;}else if(_0x50d4fa['extra']===_0x2aa0('0x63')){_0x50d4fa[_0x2aa0('0xa1')]=_0x4e925b[_0x2aa0('0x9a')]>=parseInt(_0x17f0b9[_0x2aa0('0x118')])?'x':'i';}else{_0x50d4fa[_0x2aa0('0xa1')]=_0x4e925b[_0x2aa0('0x9a')]>=parseInt(_0x17f0b9[_0x2aa0('0x118')])&&_0x4e925b['length']<=parseInt(_0x17f0b9['maxdigit'])?'x':'i';}var _0x515b9=this[_0x2aa0('0x13')][_0x2aa0('0x6e')](this,_0x17f0b9[_0x2aa0('0xda')]);if(!_0x515b9){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x17f0b9,_0x2aa0('0xdb'));}this[_0x2aa0('0xf')][_0x2aa0('0xa3')](_0x515b9,_0x4e925b);if(this[_0x2aa0('0x83')](_0x17f0b9[_0x2aa0('0x119')])){var _0x36c1e4=parseInt(_0x17f0b9[_0x2aa0('0x119')],0xa);var _0x189647=rs[_0x2aa0('0x11a')]({'charset':'*','length':_0x36c1e4});var _0x1e35b6=_0x4e925b[_0x2aa0('0x9a')];if(_0x1e35b6>0x0){if(_0x1e35b6>_0x36c1e4){this[_0x2aa0('0x35')][_0x2aa0('0x6e')](this,_0x17f0b9,_0x17f0b9[_0x2aa0('0x11b')]===_0x2aa0('0x11c')?_0x189647+_0x4e925b['substr'](_0x36c1e4):_0x4e925b[_0x2aa0('0x11d')](0x0,_0x1e35b6-_0x36c1e4)+_0x189647);}else{this[_0x2aa0('0x35')]['sync'](this,_0x17f0b9,rs[_0x2aa0('0x11a')]({'charset':'*','length':_0x1e35b6}));}}else{this['createSquareDetailsReport']['sync'](this,_0x17f0b9,'');}}else{this[_0x2aa0('0x35')][_0x2aa0('0x6e')](this,_0x17f0b9,_0x4e925b);}return _0x50d4fa;};AGIVertices['prototype'][_0x2aa0('0x11e')]=function(_0x4ec2b5){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x11f'),_0x4ec2b5[_0x2aa0('0x37')]));return this[_0x2aa0('0xe')](_0x4ec2b5);};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x120')]=function(_0x817141){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x121'),_0x817141[_0x2aa0('0x37')]));this[_0x2aa0('0x35')]['sync'](this,_0x817141,_0x817141[_0x2aa0('0x122')]);return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x123'),_0x817141[_0x2aa0('0x122')]));};AGIVertices[_0x2aa0('0x12')]['awspolly']=function(_0xa617cc){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x124'),_0xa617cc['label']));if(!this[_0x2aa0('0x83')](_0xa617cc[_0x2aa0('0x8a')])||!this[_0x2aa0('0x83')](_0xa617cc[_0x2aa0('0x8b')])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0x125'));}if(!this[_0x2aa0('0x83')](_0xa617cc['text'])){return this['channel'][_0x2aa0('0xa7')](_0x2aa0('0xa8'));}this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x126'),_0xa617cc['text']));var _0x3b5ffa=this[_0x2aa0('0x85')][_0x2aa0('0x6e')](this,_0xa617cc);if(_0x3b5ffa){this[_0x2aa0('0xf')]['noop'](util[_0x2aa0('0x2a')]('aws\x20Polly\x20%s\x20file\x20created',_0x3b5ffa));var _0x452fd5=this[_0x2aa0('0xf')][_0x2aa0('0x127')](_0x3b5ffa);try{fs[_0x2aa0('0x104')](_0x3b5ffa+_0x2aa0('0x128'));}catch(_0x3060a4){logger[_0x2aa0('0x2d')](_0x3060a4);}return _0x452fd5;}return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0xa617cc,_0x2aa0('0x129'));};AGIVertices['prototype'][_0x2aa0('0x12a')]=function(_0x49cc70){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x12b'),_0x49cc70[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x49cc70[_0x2aa0('0x8a')])||!this[_0x2aa0('0x83')](_0x49cc70[_0x2aa0('0x8b')])){return this[_0x2aa0('0xf')]['noop'](_0x2aa0('0x125'));}if(!this[_0x2aa0('0x83')](_0x49cc70[_0x2aa0('0x8d')])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0x12c'));}if(!this[_0x2aa0('0x83')](_0x49cc70[_0x2aa0('0x5a')])){return this['channel'][_0x2aa0('0xa7')](_0x2aa0('0xa8'));}this[_0x2aa0('0xf')][_0x2aa0('0xeb')]=!![];this[_0x2aa0('0x35')](_0x49cc70);this['createSquareMessage'](_0x49cc70[_0x2aa0('0x5a')],'in','','');this['channel'][_0x2aa0('0xa7')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x49cc70[_0x2aa0('0x5a')]));var _0x2e6155=this[_0x2aa0('0x89')][_0x2aa0('0x6e')](this,_0x49cc70);if(_0x2e6155){for(var _0x14814b in _0x2e6155){if(_0x2e6155[_0x2aa0('0x94')](_0x14814b)&&_[_0x2aa0('0x97')](_0x2e6155[_0x14814b])){this[_0x2aa0('0xf')][_0x2aa0('0xa3')](util[_0x2aa0('0x2a')]('AWS_LEX_%s',_0x14814b['toUpperCase']()),_0x2e6155[_0x14814b]);}}if(_[_0x2aa0('0x44')](_0x2e6155[_0x2aa0('0x74')])){return this['channel']['noop'](_0x2aa0('0x12d'));}else{this['createSquareMessage'](_0x2e6155[_0x2aa0('0x74')],_0x2aa0('0xee'),_0x2aa0('0x12e'),'');return this['channel']['noop'](util[_0x2aa0('0x2a')](_0x2aa0('0x12f'),_0x2e6155[_0x2aa0('0x74')]));}}return this[_0x2aa0('0xf')]['error'](_0x49cc70,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0x2aa0('0x130')]=function(_0x1d4c79){logger['info'](util[_0x2aa0('0x2a')](_0x2aa0('0x131'),_0x1d4c79['label'],_0x1d4c79[_0x2aa0('0x63')]));if(!this[_0x2aa0('0x83')](_0x1d4c79[_0x2aa0('0x81')])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0xea'));}var _0x1a179=_0x2aa0('0x132');var _0x43bb4c=util[_0x2aa0('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x42f635=util[_0x2aa0('0x2a')]('%s.%s',_0x43bb4c,_0x1a179);var _0x3f8338=!![];if(_0x1d4c79['beep']===_0x2aa0('0x133')){_0x3f8338=![];}var _0x4e12db=this['channel'][_0x2aa0('0x134')](_0x43bb4c,_0x1a179,_0x1d4c79[_0x2aa0('0x135')],_0x1d4c79[_0x2aa0('0x63')],undefined,_0x3f8338);if(_0x4e12db['result']!==-0x1){this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x136'),_0x42f635));var _0x2f5aa3=this['googleASR'][_0x2aa0('0x6e')](this,_0x1d4c79,_0x42f635);if(_0x2f5aa3){for(var _0x317d2a in _0x2f5aa3){if(_0x2f5aa3[_0x2aa0('0x94')](_0x317d2a)){this[_0x2aa0('0xf')][_0x2aa0('0xa3')](util[_0x2aa0('0x2a')](_0x2aa0('0x137'),_0x317d2a[_0x2aa0('0x67')]()),_0x2f5aa3[_0x317d2a]);}}return this[_0x2aa0('0xf')]['noop'](util['format'](_0x2aa0('0x138'),JSON[_0x2aa0('0x70')](_0x2f5aa3)));}}return _0x4e12db;};AGIVertices[_0x2aa0('0x12')]['tildeasr']=function(_0x2f7c91){logger['info'](util[_0x2aa0('0x2a')](_0x2aa0('0x139'),_0x2f7c91[_0x2aa0('0x37')]));if(!this['isConfigured'](_0x2f7c91[_0x2aa0('0x90')])){return this[_0x2aa0('0xf')]['noop'](_0x2aa0('0x13a'));}if(!this[_0x2aa0('0x83')](_0x2f7c91['appsecret'])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')]('no\x20appsecret\x20configured');}var _0x54476d=_0x2aa0('0x132');var _0x249b6b=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x2aa0('0x11a')](0x4));var _0x2a2aa5=util[_0x2aa0('0x2a')](_0x2aa0('0x99'),_0x249b6b,_0x54476d);var _0x2d987b=!![];if(_0x2f7c91['beep']===_0x2aa0('0x133')){_0x2d987b=![];}var _0x29cd39=this[_0x2aa0('0xf')][_0x2aa0('0x134')](_0x249b6b,_0x54476d,_0x2f7c91[_0x2aa0('0x135')],_0x2f7c91['timeout'],undefined,_0x2d987b);if(_0x29cd39['result']!==-0x1){this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util['format'](_0x2aa0('0x13b'),_0x2a2aa5));var _0x99acda=this[_0x2aa0('0x13c')][_0x2aa0('0x6e')](this,_0x2f7c91,_0x2a2aa5);if(_0x99acda){for(var _0x120336 in _0x99acda){if(_0x99acda['hasOwnProperty'](_0x120336)){this[_0x2aa0('0xf')]['setVariable'](util[_0x2aa0('0x2a')]('TILDE_ASR_%s',_0x120336['toUpperCase']()),_0x99acda[_0x120336]);}}return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x13d'),JSON[_0x2aa0('0x70')](_0x99acda)));}}return _0x29cd39;};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x13e')]=function(_0x3b72a8){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3b72a8[_0x2aa0('0x37')]));return this[_0x2aa0('0xf')][_0x2aa0('0x13f')](_0x3b72a8[_0x2aa0('0x3c')],_0x3b72a8[_0x2aa0('0x3d')],_0x3b72a8['priority']);};AGIVertices[_0x2aa0('0x12')]['gotoif']=function(_0x4d627d){logger['info'](util[_0x2aa0('0x2a')](_0x2aa0('0x140'),_0x4d627d[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x4d627d[_0x2aa0('0x141')])){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x4d627d,_0x2aa0('0x142'));}try{var _0xda3650=eval(_0x4d627d['condition'])?_0x2aa0('0x143'):_0x2aa0('0x144');this['channel'][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x145'),_0x4d627d['condition'],_0xda3650));return{'code':0xc8,'result':_0xda3650};}catch(_0x4aba85){return{'code':0xc8,'result':_0x2aa0('0x144')};}};AGIVertices[_0x2aa0('0x12')]['gotoiftime']=function(_0x3d717d){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x3d717d[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x3d717d[_0x2aa0('0x146')])){return this[_0x2aa0('0xf')]['error'](_0x3d717d,'no\x20interval\x20configured');}var _0x32921b=this['getIntervals'][_0x2aa0('0x6e')](this,_0x3d717d['interval_id']);if(!_0x32921b){return this[_0x2aa0('0xf')]['error'](_0x3d717d,_0x2aa0('0x147'));}for(var _0x6696aa=0x0;_0x6696aa<_0x32921b[_0x2aa0('0x9a')];_0x6696aa+=0x1){var _0x373fad=this['channel']['getVariable'](util[_0x2aa0('0x2a')]('IFTIME(%s?true:false)',_0x32921b[_0x6696aa]));if(_0x373fad[_0x2aa0('0xa1')]===-0x1){return _0x373fad;}logger['info'](util[_0x2aa0('0x2a')](_0x2aa0('0x148'),_0x32921b[_0x6696aa],_0x373fad[_0x2aa0('0x9f')]));if(_0x373fad[_0x2aa0('0x9f')]==='true'){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x148'),_0x32921b[_0x6696aa],_0x2aa0('0x143')));this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util['format'](_0x2aa0('0x148'),_0x32921b[_0x6696aa],'true'));return{'code':0xc8,'result':_0x2aa0('0x143')};}else{logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x148'),_0x32921b[_0x6696aa],_0x2aa0('0x144')));this[_0x2aa0('0xf')]['noop'](util['format'](_0x2aa0('0x148'),_0x32921b[_0x6696aa],_0x2aa0('0x144')));}}return{'code':0xc8,'result':_0x2aa0('0x144')};};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x149')]=function(_0x1d72a2){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x14a'),_0x1d72a2[_0x2aa0('0x37')]));return this[_0x2aa0('0xf')][_0x2aa0('0x149')]();};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x14b')]=function(_0x37f4e5){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x14c'),_0x37f4e5[_0x2aa0('0x37')]));if(!this['isConfigured'](_0x37f4e5[_0x2aa0('0x81')])){return this['channel'][_0x2aa0('0xa7')](_0x2aa0('0xea'));}var _0x3d7899=_0x2aa0('0x132');var _0x1a6e69=util[_0x2aa0('0x2a')](_0x2aa0('0x14d'),FILES_PATH,rs[_0x2aa0('0x11a')](0x4));var _0x4ccd85=util['format'](_0x2aa0('0x99'),_0x1a6e69,_0x3d7899);var _0x2aad68=!![];if(_0x37f4e5['beep']===_0x2aa0('0x133')){_0x2aad68=![];}var _0x4ad91e=this[_0x2aa0('0xf')]['recordFile'](_0x1a6e69,_0x3d7899,_0x37f4e5[_0x2aa0('0x135')],_0x37f4e5[_0x2aa0('0x63')],undefined,_0x2aad68);if(_0x4ad91e['result']!==-0x1){this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x14e'),_0x4ccd85));var _0x1c4ce8=this['ispeechASR']['sync'](this,_0x37f4e5,_0x4ccd85);if(_0x1c4ce8){for(var _0x12bb14 in _0x1c4ce8){if(_0x1c4ce8[_0x2aa0('0x94')](_0x12bb14)){this['channel'][_0x2aa0('0xa3')](util['format']('ISPEECH_ASR_%s',_0x12bb14[_0x2aa0('0x67')]()),_0x1c4ce8[_0x12bb14]);}}return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x14f'),JSON[_0x2aa0('0x70')](_0x1c4ce8)));}}return _0x4ad91e;};AGIVertices[_0x2aa0('0x12')]['ispeechtts']=function(_0x2a90a3){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x150'),_0x2a90a3[_0x2aa0('0x37')]));if(!this['isConfigured'](_0x2a90a3[_0x2aa0('0x81')])){return this[_0x2aa0('0xf')]['noop'](_0x2aa0('0xea'));}if(!this[_0x2aa0('0x83')](_0x2a90a3[_0x2aa0('0x5a')])){return this[_0x2aa0('0xf')]['noop']('no\x20text\x20configured');}this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x151'),_0x2a90a3[_0x2aa0('0x5a')]));var _0x3ed3d2=this[_0x2aa0('0x7e')][_0x2aa0('0x6e')](this,_0x2a90a3);if(_0x3ed3d2){this['channel'][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')]('ispeech\x20%s\x20file\x20created',_0x3ed3d2));var _0x597780=this[_0x2aa0('0xf')][_0x2aa0('0x127')](_0x3ed3d2,_0x2a90a3[_0x2aa0('0x135')]);try{fs[_0x2aa0('0x104')](_0x3ed3d2+_0x2aa0('0x128'));}catch(_0x2de6f2){logger['error'](_0x2de6f2);}return _0x597780;}return this[_0x2aa0('0xf')]['error'](_0x2a90a3,_0x2aa0('0x152'));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x153')]=function(_0x3fb283){logger[_0x2aa0('0x2e')](util['format'](_0x2aa0('0x154'),_0x3fb283['label']));if(!this[_0x2aa0('0x83')](_0x3fb283[_0x2aa0('0x155')])){return this['channel'][_0x2aa0('0x2d')](_0x3fb283,_0x2aa0('0x156'));}logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x157'),this[_0x2aa0('0xf')]['callerid'],_0x3fb283[_0x2aa0('0x155')]));var _0x34a19e=this[_0x2aa0('0x50')]['sync'](this,_0x3fb283['findBy']);if(_0x34a19e){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x2aa0('0xf')][_0x2aa0('0x39')],_0x3fb283[_0x2aa0('0x155')]));this['channel']['noop'](util[_0x2aa0('0x2a')](_0x2aa0('0x158'),this[_0x2aa0('0xf')][_0x2aa0('0x39')],_0x3fb283[_0x2aa0('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x2aa0('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2aa0('0xf')]['callerid'],_0x3fb283[_0x2aa0('0x155')]));this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2aa0('0xf')][_0x2aa0('0x39')],_0x3fb283['findBy']));return{'code':0xc8,'result':_0x2aa0('0x159')};}};AGIVertices[_0x2aa0('0x12')]['logout']=function(_0x23977f){logger[_0x2aa0('0x2e')](util['format'](_0x2aa0('0x15a'),_0x23977f[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x23977f[_0x2aa0('0x155')])){return this['channel'][_0x2aa0('0x2d')](_0x23977f,_0x2aa0('0x156'));}logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x157'),this[_0x2aa0('0xf')][_0x2aa0('0x39')],_0x23977f['findBy']));var _0x3e8a22=this[_0x2aa0('0x4f')][_0x2aa0('0x6e')](this,_0x23977f['findBy']);if(_0x3e8a22){logger['info'](util[_0x2aa0('0x2a')](_0x2aa0('0x158'),this['channel'][_0x2aa0('0x39')],_0x23977f[_0x2aa0('0x155')]));this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x158'),this[_0x2aa0('0xf')]['callerid'],_0x23977f[_0x2aa0('0x155')]));return{'code':0xc8,'result':_0x2aa0('0x15b')};}else{logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x15c'),this[_0x2aa0('0xf')]['callerid'],_0x23977f[_0x2aa0('0x155')]));this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x15c'),this[_0x2aa0('0xf')][_0x2aa0('0x39')],_0x23977f[_0x2aa0('0x155')]));return{'code':0xc8,'result':_0x2aa0('0x159')};}};AGIVertices['prototype'][_0x2aa0('0x15d')]=function(_0x3f0252){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x15e'),_0x3f0252[_0x2aa0('0x37')]));if(!this['isConfigured'](_0x3f0252[_0x2aa0('0x15f')])){return this['channel'][_0x2aa0('0x2d')](_0x3f0252,_0x2aa0('0x160'));}this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x161'),_0x3f0252[_0x2aa0('0x15f')]));var _0x55439d=eval(_0x3f0252[_0x2aa0('0x15f')]);if(!this[_0x2aa0('0x83')](_0x3f0252[_0x2aa0('0xda')])){return this['channel'][_0x2aa0('0xa7')](_0x2aa0('0xd9'));}var _0x444933=this[_0x2aa0('0x13')][_0x2aa0('0x6e')](this,_0x3f0252['variable_id']);if(!_0x444933){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x3f0252,'no\x20variable\x20found');}if(_[_0x2aa0('0x162')](_0x55439d)){var _0x11f35e=this;_0x55439d[_0x2aa0('0xdc')](function(_0x2a87bf,_0x1c43b6){_0x11f35e['channel'][_0x2aa0('0xa3')](util[_0x2aa0('0x2a')](_0x2aa0('0x163'),_0x444933,_0x1c43b6),_0x2a87bf);});return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')]('variable\x20%s[key]\x20set',_0x444933));}else{return this[_0x2aa0('0xf')][_0x2aa0('0xa3')](_0x444933,_0x55439d);}};AGIVertices['prototype'][_0x2aa0('0x164')]=function(_0x4285fd){logger['info'](util['format'](_0x2aa0('0x165'),_0x4285fd['label']));if(_0x4285fd[_0x2aa0('0xa5')]===0x0){return this[_0x2aa0('0xa4')](_0x4285fd);}_0x4285fd[_0x2aa0('0xa5')]-=0x1;if(!this[_0x2aa0('0x83')](_0x4285fd[_0x2aa0('0x111')])){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x4285fd,'no\x20file\x20audio\x20selected');}var _0x35c263=this['getSound'][_0x2aa0('0x6e')](this,_0x4285fd[_0x2aa0('0x111')]);if(!_0x35c263){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x4285fd,_0x2aa0('0x113'));}var _0x33e9ce=this['channel'][_0x2aa0('0x114')](_0x35c263,_0x4285fd[_0x2aa0('0x115')],_0x4285fd['digit']);var _0x20e0f6=_0x33e9ce['result'];if(_0x33e9ce[_0x2aa0('0xa1')]===-0x1){this['createSquareDetailsReport'][_0x2aa0('0x6e')](this,_0x4285fd,'-1');return _0x33e9ce;}else if(_0x33e9ce[_0x2aa0('0x9f')]===_0x2aa0('0x63')){_0x33e9ce[_0x2aa0('0xa1')]=_0x33e9ce[_0x2aa0('0xa1')][_0x2aa0('0x9a')]>0x0?_0x33e9ce[_0x2aa0('0xa1')]:'t';}else if(_[_0x2aa0('0x41')](_0x33e9ce[_0x2aa0('0xa1')])){_0x33e9ce[_0x2aa0('0xa1')]='#';_0x20e0f6='#';}if(!this[_0x2aa0('0x83')](_0x4285fd[_0x2aa0('0xda')])){this['channel'][_0x2aa0('0xa7')](_0x2aa0('0xd9'));}else{var _0x525b28=this[_0x2aa0('0x13')][_0x2aa0('0x6e')](this,_0x4285fd['variable_id']);if(!_0x525b28){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x4285fd,_0x2aa0('0xdb'));}this[_0x2aa0('0xf')][_0x2aa0('0xa3')](_0x525b28,_0x20e0f6);}this['createSquareDetailsReport'][_0x2aa0('0x6e')](this,_0x4285fd,_0x20e0f6);return _0x33e9ce;};AGIVertices['prototype'][_0x2aa0('0xa7')]=function(_0x1b3643){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x1b3643[_0x2aa0('0x37')]));return this['channel']['noop'](_0x1b3643[_0x2aa0('0x166')]||_0x1b3643[_0x2aa0('0x37')]);};AGIVertices['prototype'][_0x2aa0('0x167')]=function(_0x478fdc){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x168'),_0x478fdc[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x478fdc[_0x2aa0('0x155')])){return this[_0x2aa0('0xf')]['error'](_0x478fdc,_0x2aa0('0x156'));}logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x157'),this[_0x2aa0('0xf')][_0x2aa0('0x39')],_0x478fdc['findBy']));var _0x3f2826=this['getPause'][_0x2aa0('0x6e')](this,_0x478fdc[_0x2aa0('0x169')]);var _0x42c050=this[_0x2aa0('0x4d')]['sync'](this,_0x478fdc[_0x2aa0('0x155')],_0x3f2826);if(_0x42c050){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2aa0('0xf')][_0x2aa0('0x39')],_0x478fdc[_0x2aa0('0x155')]));this['channel'][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x158'),this[_0x2aa0('0xf')][_0x2aa0('0x39')],_0x478fdc['findBy']));return{'code':0xc8,'result':_0x2aa0('0x15b')};}else{logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x15c'),this[_0x2aa0('0xf')][_0x2aa0('0x39')],_0x478fdc['findBy']));this['channel']['noop'](util[_0x2aa0('0x2a')](_0x2aa0('0x158'),this[_0x2aa0('0xf')]['callerid'],_0x478fdc[_0x2aa0('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x2aa0('0x16a')]=function(_0xd4164a){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0xd4164a['label']));if(!this[_0x2aa0('0x83')](_0xd4164a['file_id'])){return this['channel'][_0x2aa0('0x2d')](_0xd4164a,_0x2aa0('0x112'));}var _0x204897=this[_0x2aa0('0x20')][_0x2aa0('0x6e')](this,_0xd4164a['file_id']);if(!_0x204897){return this['channel']['error'](_0xd4164a,_0x2aa0('0x113'));}var _0x2e2bb8=this[_0x2aa0('0xf')][_0x2aa0('0xa9')]('PLAYBACK',[_0x204897,_0xd4164a[_0x2aa0('0xe7')]]);if(_0x2e2bb8[_0x2aa0('0xa1')]===-0x1){return _0x2e2bb8;}return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x204897));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x16b')]=function(_0x163b55){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x16c'),_0x163b55['label']));if(!this[_0x2aa0('0x83')](_0x163b55[_0x2aa0('0x16d')])){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x163b55,'no\x20queue\x20selected');}var _0x31b08b='';var _0x295c44=parseInt(_0x163b55[_0x2aa0('0x16d')],0xa);if(isNaN(_0x295c44)){_0x31b08b=_0x163b55['queue_id'];}else{_0x31b08b=this['getVoiceQueue'][_0x2aa0('0x6e')](this,_0x163b55[_0x2aa0('0x16d')]);if(!_0x31b08b){return this['channel'][_0x2aa0('0x2d')](_0x163b55,'no\x20queue\x20found');}}var _0x5386d8='';if(this[_0x2aa0('0x83')](_0x163b55['file_id'])){var _0x32b3e7=this[_0x2aa0('0x20')]['sync'](this,_0x163b55[_0x2aa0('0x111')]);if(_0x32b3e7){_0x5386d8=_0x32b3e7;}}this[_0x2aa0('0x35')][_0x2aa0('0x6e')](this,_0x163b55,_0x31b08b);if(_0x163b55[_0x2aa0('0xe7')][_0x2aa0('0x16e')]('x')<0x0){_0x163b55[_0x2aa0('0xe7')]+='x';}if(_0x163b55[_0x2aa0('0xe7')][_0x2aa0('0x16e')]('X')<0x0){_0x163b55[_0x2aa0('0xe7')]+='X';}this[_0x2aa0('0xf')][_0x2aa0('0xa3')](_0x2aa0('0x16f'),_0x31b08b?_0x31b08b[_0x2aa0('0x170')]():'');var _0xf81391=this[_0x2aa0('0xf')][_0x2aa0('0xa9')]('QUEUE',[_0x31b08b,_0x163b55['opts'],_0x163b55[_0x2aa0('0x61')],_0x5386d8,_0x163b55[_0x2aa0('0x63')],_0x163b55['agi'],_0x163b55[_0x2aa0('0x171')],_0x163b55[_0x2aa0('0x172')],'',_0x163b55[_0x2aa0('0x173')]]);if(_0xf81391[_0x2aa0('0xa1')]===-0x1){return _0xf81391;}return this['channel'][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0xc4'),_0x2aa0('0x174'),_0x31b08b));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x175')]=function(_0x30441e){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x176'),_0x30441e[_0x2aa0('0x37')]));var _0x3b6b22=_0x30441e[_0x2aa0('0x177')]||_0x2aa0('0x132');var _0x28c0f2=util[_0x2aa0('0x2a')](_0x2aa0('0x178'),this['channel']['uniqueid'],rs[_0x2aa0('0x11a')](0x5));var _0x91648=util[_0x2aa0('0x2a')](_0x2aa0('0x179'),FILES_PATH,_0x28c0f2,_0x3b6b22);var _0x1d5192=util['format'](_0x2aa0('0x14d'),FILES_PATH,_0x28c0f2);this[_0x2aa0('0x3a')][_0x2aa0('0x6e')](this,_0x30441e,_0x28c0f2,_0x91648);this[_0x2aa0('0xf')]['setVariable'](_0x2aa0('0x17a'),_0x28c0f2);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x1d5192,_0x3b6b22,_0x30441e['escape_digits'],_0x30441e[_0x2aa0('0x63')]);return this[_0x2aa0('0xf')]['recordFile'](_0x1d5192,_0x3b6b22,_0x30441e[_0x2aa0('0x17b')],_0x30441e[_0x2aa0('0x63')],undefined,!![]);};AGIVertices[_0x2aa0('0x12')]['restapi']=function(_0x5800ad){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x17c'),_0x5800ad['label']));if(!this[_0x2aa0('0x83')](_0x5800ad[_0x2aa0('0x61')])){return this[_0x2aa0('0xf')]['noop'](_0x2aa0('0x17d'));}var _0x7acba3=this[_0x2aa0('0x60')][_0x2aa0('0x6e')](this,_0x5800ad);logger[_0x2aa0('0x2e')](util['format'](_0x2aa0('0x17e'),util['inspect'](_0x7acba3,{'showHidden':![],'depth':null})));if(!this[_0x2aa0('0x83')](_0x5800ad[_0x2aa0('0xda')])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x3b5587=this[_0x2aa0('0x13')][_0x2aa0('0x6e')](this,_0x5800ad[_0x2aa0('0xda')]);if(!_0x3b5587){return this['channel'][_0x2aa0('0x2d')](_0x5800ad,_0x2aa0('0xdb'));}this[_0x2aa0('0xf')]['setVariable'](util['format'](_0x2aa0('0x17f'),_0x3b5587),_0x7acba3[_0x2aa0('0x72')]?_0x7acba3[_0x2aa0('0x72')]:_0x2aa0('0x180'));this['channel'][_0x2aa0('0xa3')](util[_0x2aa0('0x2a')](_0x2aa0('0x181'),_0x3b5587),_0x7acba3[_0x2aa0('0x73')]?_0x7acba3[_0x2aa0('0x73')]:'OK');if(_0x7acba3['body']){try{this[_0x2aa0('0x9b')](_0x7acba3[_0x2aa0('0x68')],_0x3b5587);}catch(_0x14d4f4){logger['error'](util[_0x2aa0('0x2a')](_0x2aa0('0x182'),_0x3b5587));}}return this[_0x2aa0('0xf')]['noop'](util[_0x2aa0('0x2a')](_0x2aa0('0xde'),_0x3b5587));};AGIVertices['prototype']['saydigits']=function(_0x5a297b){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x183'),_0x5a297b[_0x2aa0('0x37')]));return this[_0x2aa0('0xf')][_0x2aa0('0x184')](_0x5a297b[_0x2aa0('0x185')]['replace'](/\s+/g,''),_0x5a297b[_0x2aa0('0x17b')]);};AGIVertices['prototype'][_0x2aa0('0x186')]=function(_0x39eb93){logger['info'](util[_0x2aa0('0x2a')](_0x2aa0('0x187'),_0x39eb93[_0x2aa0('0x37')]));return this[_0x2aa0('0xf')][_0x2aa0('0x188')](_0x39eb93['number'][_0x2aa0('0x56')](/\s+/g,''),_0x39eb93[_0x2aa0('0x17b')]);};AGIVertices['prototype'][_0x2aa0('0x189')]=function(_0x37356a){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x18a'),_0x37356a[_0x2aa0('0x37')]));return this[_0x2aa0('0xf')][_0x2aa0('0x18b')](_0x37356a[_0x2aa0('0x5a')],_0x37356a[_0x2aa0('0x17b')]);};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x18c')]=function(_0x23507f){logger['info'](util[_0x2aa0('0x2a')](_0x2aa0('0x18d'),_0x23507f[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0x23507f['account_id'])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0x18e'));}var _0xe402f8=this[_0x2aa0('0x22')]['sync'](this,_0x23507f['account_id']);if(!_0xe402f8||!_0xe402f8[_0x2aa0('0x18f')]){return this['channel'][_0x2aa0('0x2d')](_0x23507f,_0x2aa0('0x190'));}var _0x1a64a9={'from':util[_0x2aa0('0x2a')]('\x22%s\x22\x20<%s>',_0xe402f8['name'],_0xe402f8['email']||_0xe402f8[_0x2aa0('0x18f')][_0x2aa0('0x191')]),'to':_0x23507f['to']||'','cc':_0x23507f['cc']||'','bcc':_0x23507f[_0x2aa0('0x192')]||'','subject':_0x23507f[_0x2aa0('0x193')],'html':_0x23507f[_0x2aa0('0x5a')],'text':_0x23507f[_0x2aa0('0x5a')]};var _0x42419b={'tls':{'rejectUnauthorized':![]}};if(_0xe402f8[_0x2aa0('0x18f')][_0x2aa0('0x194')]){_0x42419b[_0x2aa0('0x194')]=_0xe402f8['Smtp'][_0x2aa0('0x194')];}else{_0x42419b[_0x2aa0('0x195')]=_0xe402f8[_0x2aa0('0x18f')][_0x2aa0('0x195')];_0x42419b['port']=_0xe402f8[_0x2aa0('0x18f')][_0x2aa0('0x196')];_0x42419b['secure']=_0xe402f8[_0x2aa0('0x18f')][_0x2aa0('0x197')];}if(_0xe402f8[_0x2aa0('0x18f')][_0x2aa0('0x198')]){_0x42419b['auth']={'user':_0xe402f8[_0x2aa0('0x18f')][_0x2aa0('0x191')],'pass':_0xe402f8[_0x2aa0('0x18f')][_0x2aa0('0x199')]};}if(this[_0x2aa0('0x83')](_0x23507f['template_id'])){}logger[_0x2aa0('0xe0')](_0x2aa0('0x19a'),JSON[_0x2aa0('0x70')](_0x1a64a9));this['createSquareDetailsReport'][_0x2aa0('0x6e')](this,_0x23507f,_0x23507f[_0x2aa0('0x19b')]);this['channel'][_0x2aa0('0xa7')](util['format'](_0x2aa0('0x19c'),_0xe402f8[_0x2aa0('0x16')]));this['sendMailMessage'][_0x2aa0('0x6e')](this,_0x42419b,_0x1a64a9);return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0x19d'));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x19e')]=function(_0x17db22){logger['info'](util[_0x2aa0('0x2a')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x17db22[_0x2aa0('0x37')]));return this['channel'][_0x2aa0('0xa7')](_0x2aa0('0x19f'));};AGIVertices['prototype'][_0x2aa0('0x1a0')]=function(_0x57e4c2){logger['info'](util[_0x2aa0('0x2a')](_0x2aa0('0x1a1'),_0x57e4c2[_0x2aa0('0x37')]));if(!this['isConfigured'](_0x57e4c2[_0x2aa0('0x1a2')])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0x1a3'));}var _0x227be0=this[_0x2aa0('0x32')][_0x2aa0('0x6e')](this,_0x57e4c2[_0x2aa0('0x1a2')]);if(!_0x227be0){return this[_0x2aa0('0xf')]['error'](_0x57e4c2,'no\x20sms\x20account\x20found');}var _0x2f48cc={'body':_0x57e4c2[_0x2aa0('0x1a4')],'phone':_0x57e4c2['to']||'','SmsAccountId':_0x227be0['id']};logger[_0x2aa0('0xe0')](_0x2aa0('0x1a5'),JSON[_0x2aa0('0x70')](_0x2f48cc));this[_0x2aa0('0x35')][_0x2aa0('0x6e')](this,_0x57e4c2,_0x57e4c2[_0x2aa0('0x1a2')]);this['channel'][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x227be0['name']));this['createSmsMessage'][_0x2aa0('0x6e')](this,_0x2f48cc);return this[_0x2aa0('0xf')]['noop'](_0x2aa0('0x1a6'));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x1a7')]=function(_0x129422){logger['info'](util[_0x2aa0('0x2a')](_0x2aa0('0x1a8'),_0x129422['label']));if(!this[_0x2aa0('0x83')](_0x129422[_0x2aa0('0xda')])){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x129422,_0x2aa0('0x1a9'));}var _0x4a0bb8=this[_0x2aa0('0x13')][_0x2aa0('0x6e')](this,_0x129422[_0x2aa0('0xda')]);if(!_0x4a0bb8){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x129422,_0x2aa0('0xdb'));}return this[_0x2aa0('0xf')][_0x2aa0('0xa3')](_0x4a0bb8,_0x129422['variable_value']);};AGIVertices['prototype']['start']=function(_0x498f7e){logger[_0x2aa0('0x2e')](util['format'](_0x2aa0('0x1aa'),_0x498f7e[_0x2aa0('0x37')]));this[_0x2aa0('0xf')][_0x2aa0('0xa7')]('START\x20CALLY\x20SQUARE');if(_0x498f7e[_0x2aa0('0xb6')]===_0x2aa0('0x1ab')){this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0x1ac'));return this[_0x2aa0('0xf')][_0x2aa0('0xb6')]();}return this[_0x2aa0('0xf')][_0x2aa0('0xa7')]('Skipped\x20Answer');};AGIVertices[_0x2aa0('0x12')]['subproject']=function(_0x5af145){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x1ad'),_0x5af145['label']));if(!this[_0x2aa0('0x83')](_0x5af145[_0x2aa0('0x1ae')])){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x5af145,'no\x20subproject\x20selected');}var _0x204e70=this[_0x2aa0('0x1a')][_0x2aa0('0x6e')](this,_0x5af145[_0x2aa0('0x1ae')]);if(!this[_0x2aa0('0x83')](_0x204e70)){return this['channel'][_0x2aa0('0x2d')](_0x5af145,util[_0x2aa0('0x2a')](_0x2aa0('0x1af'),_0x5af145[_0x2aa0('0x1ae')]));}if(_0x204e70===this['channel']['arg_1']){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x5af145,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x2aa0('0x35')][_0x2aa0('0x6e')](this,_0x5af145,_0x204e70);var _0x4ed12d=this[_0x2aa0('0xf')][_0x2aa0('0xa9')](_0x2aa0('0x1b0'),util['format'](_0x2aa0('0x1b1'),config['agi'][_0x2aa0('0x195')]||_0x2aa0('0x1b2'),_0x204e70,this[_0x2aa0('0xf')][_0x2aa0('0x3f')]));if(_0x4ed12d[_0x2aa0('0xa1')]===-0x1){return _0x4ed12d;}return this['channel']['noop'](util[_0x2aa0('0x2a')](_0x2aa0('0xc4'),_0x2aa0('0x1b0'),_0x204e70));};AGIVertices['prototype'][_0x2aa0('0x1b3')]=function(_0x477ff6){logger[_0x2aa0('0x2e')](util['format'](_0x2aa0('0x1b4'),_0x477ff6[_0x2aa0('0x37')]));var _0x4e29dc=this['shellCommand'][_0x2aa0('0x6e')](this,_0x477ff6[_0x2aa0('0x1b5')]);this[_0x2aa0('0x35')][_0x2aa0('0x6e')](this,_0x477ff6,_0x477ff6[_0x2aa0('0x1b5')]);if(this['isConfigured'](_0x477ff6['variable_id'])){var _0x9efab=this['getVariable'][_0x2aa0('0x6e')](this,_0x477ff6[_0x2aa0('0xda')]);if(_0x9efab){this[_0x2aa0('0xf')][_0x2aa0('0xa3')](_0x9efab,_0x4e29dc);return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x1b6'),_0x477ff6[_0x2aa0('0x1b5')],_0x9efab));}}return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util['format'](_0x2aa0('0x1b7'),_0x477ff6[_0x2aa0('0x1b5')]));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x1b8')]=function(_0x304cb0){logger['info'](util[_0x2aa0('0x2a')](_0x2aa0('0x1b9'),_0x304cb0[_0x2aa0('0x37')]));_0x304cb0['text']=_0x304cb0[_0x2aa0('0x5a')][_0x2aa0('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x304cb0[_0x2aa0('0x58')])){return this[_0x2aa0('0xf')][_0x2aa0('0xa7')](_0x2aa0('0x1ba'));}if(!this[_0x2aa0('0x83')](_0x304cb0[_0x2aa0('0x5a')])){return this[_0x2aa0('0xf')]['noop'](_0x2aa0('0xa8'));}this[_0x2aa0('0xf')]['noop'](util[_0x2aa0('0x2a')](_0x2aa0('0x1bb'),_0x304cb0[_0x2aa0('0x5a')]));var _0x1bb7c7=this['googleCloudTTS']['sync'](this,_0x304cb0);if(_0x1bb7c7){this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x1bc'),_0x1bb7c7));var _0x5f54ff=this[_0x2aa0('0xf')][_0x2aa0('0x127')](_0x1bb7c7);try{fs[_0x2aa0('0x104')](_0x1bb7c7+'.wav');}catch(_0xb9661a){logger['error'](_0xb9661a);}return _0x5f54ff;}return this['channel'][_0x2aa0('0x2d')](_0x304cb0,_0x2aa0('0x1bd'));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x1be')]=function(_0x5c6a07){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x1bf'),_0x5c6a07[_0x2aa0('0x37')]));_0x5c6a07['text']=_0x5c6a07[_0x2aa0('0x5a')][_0x2aa0('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5c6a07['text'])){return this[_0x2aa0('0xf')]['noop']('no\x20text\x20configured');}this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x1c0'),_0x5c6a07['text']));var _0x3e2a15=this[_0x2aa0('0x5e')][_0x2aa0('0x6e')](this,_0x5c6a07);if(_0x3e2a15){this['channel'][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x1c1'),_0x3e2a15));var _0x1b18cc=this[_0x2aa0('0xf')][_0x2aa0('0x127')](_0x3e2a15);try{fs[_0x2aa0('0x104')](_0x3e2a15+_0x2aa0('0x128'));}catch(_0x5233ae){logger[_0x2aa0('0x2d')](_0x5233ae);}return _0x1b18cc;}return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x5c6a07,_0x2aa0('0x1c2'));};AGIVertices['prototype'][_0x2aa0('0x1c3')]=function(_0x2d8ba1){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x1c4'),_0x2d8ba1['label']));if(!this['isConfigured'](_0x2d8ba1[_0x2aa0('0x155')])){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0x2d8ba1,_0x2aa0('0x156'));}logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x157'),this['channel'][_0x2aa0('0x39')],_0x2d8ba1['findBy']));var _0x2fa9bb=this[_0x2aa0('0x4e')][_0x2aa0('0x6e')](this,_0x2d8ba1[_0x2aa0('0x155')]);if(_0x2fa9bb){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x158'),this['channel'][_0x2aa0('0x39')],_0x2d8ba1['findBy']));this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x158'),this[_0x2aa0('0xf')][_0x2aa0('0x39')],_0x2d8ba1[_0x2aa0('0x155')]));return{'code':0xc8,'result':_0x2aa0('0x15b')};}else{logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2aa0('0xf')][_0x2aa0('0x39')],_0x2d8ba1[_0x2aa0('0x155')]));this[_0x2aa0('0xf')][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0x15c'),this['channel'][_0x2aa0('0x39')],_0x2d8ba1['findBy']));return{'code':0xc8,'result':_0x2aa0('0x159')};}};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x1c5')]=function(_0x507789){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x1c6'),_0x507789['label']));var _0x585a47=this[_0x2aa0('0xf')][_0x2aa0('0xa9')](_0x2aa0('0x1c7'),[_0x507789['mailbox'],_0x507789['options']]);if(_0x585a47[_0x2aa0('0xa1')]===-0x1){return _0x585a47;}return this['channel'][_0x2aa0('0xa7')](util[_0x2aa0('0x2a')](_0x2aa0('0xc4'),_0x2aa0('0x1c7'),_0x507789['mailbox']));};AGIVertices[_0x2aa0('0x12')][_0x2aa0('0x1c8')]=function(_0xc44e8e){logger[_0x2aa0('0x2e')](util[_0x2aa0('0x2a')](_0x2aa0('0x1c9'),_0xc44e8e[_0x2aa0('0x37')]));if(!this[_0x2aa0('0x83')](_0xc44e8e[_0x2aa0('0xda')])){return this[_0x2aa0('0xf')][_0x2aa0('0x2d')](_0xc44e8e,_0x2aa0('0x1a9'));}var _0x83c25f=this[_0x2aa0('0x13')][_0x2aa0('0x6e')](this,_0xc44e8e[_0x2aa0('0xda')]);if(!_0x83c25f){return this['channel'][_0x2aa0('0x2d')](_0xc44e8e,_0x2aa0('0xdb'));}var _0x9c7343=this[_0x2aa0('0xf')][_0x2aa0('0x13')](_0x83c25f);return{'code':0xc8,'result':_0x9c7343['extra']?_0x9c7343[_0x2aa0('0x9f')]:'-'};};String[_0x2aa0('0x12')]['replaceAll']=function(_0x448673,_0xf90712){return this[_0x2aa0('0x9d')](_0x448673)['join'](_0xf90712);};module[_0x2aa0('0x1ca')]=AGIVertices; \ No newline at end of file +var _0x289e=['number','includes','POST','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','parse','render','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isArray','length','isPlainObject','saveRestApiResult','%s.%s','setVariable','split','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','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','scheduledAt','delay','phone','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','SIP/%s','opts','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','toUpperCase','speech','dialogflow','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','out','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%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','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','appid','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','getPause','pause_id','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','subproject','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','unlink','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','success','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','replaceAll','exports','path','util','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','then','getSquareProjectById','getSquareOdbcById','getUser','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','google_tts_language','url','method','timeout'];(function(_0x578b5f,_0xcdfbb0){var _0x521772=function(_0x75a9e9){while(--_0x75a9e9){_0x578b5f['push'](_0x578b5f['shift']());}};_0x521772(++_0xcdfbb0);}(_0x289e,0x160));var _0xe289=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x289e[_0x64aff8];return _0x5488a3;};'use strict';var fs=require('fs');var path=require(_0xe289('0x0'));var util=require(_0xe289('0x1'));var _=require('lodash');var sh=require(_0xe289('0x2'));var odbc=require(_0xe289('0x3'))();var rs=require(_0xe289('0x4'));var moment=require('moment');var Mustache=require(_0xe289('0x5'));var rp=require(_0xe289('0x6'));var logger=require(_0xe289('0x7'))(_0xe289('0x8'));var config=require('../../config/environment');var scripts=require(_0xe289('0x9'));var FILES_PATH=_0xe289('0xa');var recursiveMapAttributes=[_0xe289('0xb'),_0xe289('0xc')];var verticesWithRetry=[_0xe289('0xd'),_0xe289('0xe'),_0xe289('0xf')];var AGIVertices=function(_0x384249,_0x2bbc45,_0x28d925){this['channel']=_0x384249;this[_0xe289('0x10')]=_0x2bbc45;this[_0xe289('0x11')]=_0x28d925;};AGIVertices['prototype'][_0xe289('0x12')]=function(_0x3ed099,_0x3f621b){this[_0xe289('0x10')][_0xe289('0x13')](_0x3ed099)['then'](function(_0x41ef2c){_0x3f621b(null,_0x41ef2c?_0x41ef2c[_0xe289('0x14')]:![]);})[_0xe289('0x15')](function(_0x4895fd){_0x3f621b(_0x4895fd);});};AGIVertices[_0xe289('0x16')][_0xe289('0x17')]=function(_0x4a770d,_0x31355b){this[_0xe289('0x10')]['getVoiceQueueById'](_0x4a770d)[_0xe289('0x18')](function(_0x182fa7){_0x31355b(null,_0x182fa7?_0x182fa7[_0xe289('0x14')]:![]);})[_0xe289('0x15')](function(_0x363e69){_0x31355b(_0x363e69);});};AGIVertices['prototype']['getSquareProject']=function(_0x49476b,_0xc6a2b2){this[_0xe289('0x10')][_0xe289('0x19')](_0x49476b)[_0xe289('0x18')](function(_0x189f2f){_0xc6a2b2(null,_0x189f2f?_0x189f2f['name']:![]);})['catch'](function(_0x26d7dc){_0xc6a2b2(_0x26d7dc);});};AGIVertices[_0xe289('0x16')]['getSquareOdbc']=function(_0x42c030,_0x3b8328){this[_0xe289('0x10')][_0xe289('0x1a')](_0x42c030)[_0xe289('0x18')](function(_0x56f15b){_0x3b8328(null,_0x56f15b?_0x56f15b['dsn']:![]);})[_0xe289('0x15')](function(_0x57cd7a){_0x3b8328(_0x57cd7a);});};AGIVertices[_0xe289('0x16')][_0xe289('0x1b')]=function(_0x337e2a,_0x4fe2f3){this[_0xe289('0x10')][_0xe289('0x1c')](_0x337e2a)[_0xe289('0x18')](function(_0x427d6c){_0x4fe2f3(null,_0x427d6c?_0x427d6c[_0xe289('0x14')]:![]);})['catch'](function(_0x5a2c49){_0x4fe2f3(_0x5a2c49);});};AGIVertices[_0xe289('0x16')][_0xe289('0x1d')]=function(_0x403d81,_0x3e3a1c){this[_0xe289('0x10')]['getTrunkById'](_0x403d81)[_0xe289('0x18')](function(_0x1ab93c){_0x3e3a1c(null,_0x1ab93c?_0x1ab93c[_0xe289('0x14')]:![]);})[_0xe289('0x15')](function(_0x31e444){_0x3e3a1c(_0x31e444);});};AGIVertices[_0xe289('0x16')][_0xe289('0x1e')]=function(_0x286f1f,_0x52c099){var _0x2ea5a3=this;this[_0xe289('0x10')]['getSoundById'](_0x286f1f)[_0xe289('0x18')](function(_0x4fb6c9){_0x52c099(null,_0x4fb6c9?_0x2ea5a3[_0xe289('0x1f')](_0x4fb6c9[_0xe289('0x20')]):![]);})[_0xe289('0x15')](function(_0x4a86f1){_0x52c099(_0x4a86f1);});};AGIVertices[_0xe289('0x16')][_0xe289('0x21')]=function(_0x438b7a,_0x33b58c){this['rpc']['getMailAccountById'](_0x438b7a)[_0xe289('0x18')](function(_0x145227){_0x33b58c(null,_0x145227?_0x145227:![]);})['catch'](function(_0x4ab22d){_0x33b58c(_0x4ab22d);});};AGIVertices[_0xe289('0x16')]['sendMailMessage']=function(_0x595938,_0x596b7a,_0x16ade9){this[_0xe289('0x11')][_0xe289('0x22')](_0x595938,_0x596b7a)[_0xe289('0x18')](function(){_0x16ade9(null);})[_0xe289('0x15')](function(_0x535d82){_0x16ade9(_0x535d82);});};AGIVertices[_0xe289('0x16')][_0xe289('0x23')]=function(_0x309d0c,_0x48e873){this[_0xe289('0x10')][_0xe289('0x24')](_0x309d0c)[_0xe289('0x18')](function(_0x39f3bd){if(_0x39f3bd){if(_0x39f3bd[_0xe289('0x25')]){_0x48e873(null,[_0x39f3bd[_0xe289('0x26')]]);}else{_0x48e873(null,_[_0xe289('0x27')](_0x39f3bd[_0xe289('0x28')],_0xe289('0x26')));}}else{_0x48e873(null,![]);}})[_0xe289('0x15')](function(_0x33345d){_0x48e873(_0x33345d);});};AGIVertices[_0xe289('0x16')]['getSoundPath']=function(_0x3a0a14){return util[_0xe289('0x29')](_0xe289('0x2a'),FILES_PATH,_0x3a0a14);};AGIVertices[_0xe289('0x16')][_0xe289('0x2b')]=function(_0x5a9e52,_0x467255,_0x310bb8){odbc[_0xe289('0x2c')](_0x5a9e52,function(_0x24b1b7){if(_0x24b1b7){logger[_0xe289('0x2d')](_0xe289('0x2e'),_0x24b1b7);_0x310bb8(_0x24b1b7);}else{logger[_0xe289('0x2f')](_0xe289('0x30'));odbc[_0xe289('0x31')](_0x467255,function(_0x3d90e6,_0x33fa0a){if(_0x3d90e6){logger[_0xe289('0x2f')](_0xe289('0x32'),_0x467255);_0x310bb8(_0x3d90e6);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x467255);odbc[_0xe289('0x33')](function(_0x113850){if(_0x113850){logger[_0xe289('0x2d')](_0xe289('0x34'),_0x113850);}_0x310bb8(null,_0x33fa0a);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x225917,_0x22baa8){this[_0xe289('0x10')][_0xe289('0x35')](_0x225917)[_0xe289('0x18')](function(_0x481796){_0x22baa8(null,_0x481796?_0x481796:![]);})[_0xe289('0x15')](function(_0x35850e){_0x22baa8(_0x35850e);});};AGIVertices['prototype']['createSmsMessage']=function(_0x3580b2,_0xa79d5c){this['rpc']['createSmsMessage'](_0x3580b2)['then'](function(_0x4da425){_0xa79d5c(null,_0x4da425);})[_0xe289('0x15')](function(_0x3e8267){_0xa79d5c(_0x3e8267);});};AGIVertices[_0xe289('0x16')][_0xe289('0x36')]=function(_0x1c9be7,_0x460664,_0x79387a){this[_0xe289('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0xe289('0x37')][_0xe289('0x38')],'node':_0x1c9be7[_0xe289('0x39')],'application':_0x1c9be7[_0xe289('0x3a')],'data':_0x460664||null,'project_name':this[_0xe289('0x37')][_0xe289('0x3b')],'callerid':this[_0xe289('0x37')][_0xe289('0x3c')]})[_0xe289('0x18')](function(_0x53c4ed){if(_0x79387a){_0x79387a(null,_0x53c4ed);}})[_0xe289('0x15')](function(_0x36e872){if(_0x79387a){_0x79387a(_0x36e872);}});};AGIVertices['prototype'][_0xe289('0x3d')]=function(_0x4ac6bd,_0x36af32,_0x25fe27,_0xc2b81d){this[_0xe289('0x10')]['createSquareRecording']({'uniqueid':this[_0xe289('0x37')][_0xe289('0x38')],'callerid':this[_0xe289('0x37')]['callerid'],'calleridname':this[_0xe289('0x37')]['calleridname'],'context':this[_0xe289('0x37')][_0xe289('0x3e')],'extension':this[_0xe289('0x37')][_0xe289('0x3f')],'priority':this[_0xe289('0x37')][_0xe289('0x40')],'accountcode':this[_0xe289('0x37')][_0xe289('0x41')],'dnid':this['channel'][_0xe289('0x42')],'projectName':this[_0xe289('0x37')]['arg_1'],'saveName':_0x36af32,'filename':_0x4ac6bd[_0xe289('0x43')]||_0x36af32,'savePath':_0x25fe27})[_0xe289('0x18')](function(_0x534fd9){_0xc2b81d(null,_0x534fd9);})[_0xe289('0x15')](function(_0x443c77){_0xc2b81d(_0x443c77);});};AGIVertices[_0xe289('0x16')][_0xe289('0x44')]=function(_0x176699,_0x505c80,_0x1cab48,_0x44e976,_0x25aa3c){this[_0xe289('0x10')][_0xe289('0x44')]({'uniqueid':this['channel'][_0xe289('0x38')],'body':_0x176699,'direction':_0x505c80,'providerName':_0x1cab48,'providerResponse':_0x44e976})[_0xe289('0x18')](function(_0x451b21){if(_0x25aa3c){_0x25aa3c(null,_0x451b21);}})[_0xe289('0x15')](function(_0x4a80d4){if(_0x25aa3c){_0x25aa3c(_0x4a80d4);}});};AGIVertices[_0xe289('0x16')]['createCmContact']=function(_0x5bd0e9,_0x517d1c){this[_0xe289('0x10')][_0xe289('0x45')]({'firstName':_[_0xe289('0x46')](_0x5bd0e9[_0xe289('0x14')])||_[_0xe289('0x47')](_0x5bd0e9[_0xe289('0x14')])?_0xe289('0x48')+Math[_0xe289('0x49')]():_0x5bd0e9[_0xe289('0x14')],'lastName':_[_0xe289('0x46')](_0x5bd0e9['lastName'])||_['isNil'](_0x5bd0e9[_0xe289('0x4a')])?null:_0x5bd0e9[_0xe289('0x4a')],'phone':_0x5bd0e9['phone'],'ListId':_0x5bd0e9['list_id'],'scheduledat':_0x5bd0e9['scheduledAt'],'callbackUniqueid':this[_0xe289('0x37')][_0xe289('0x38')],'tags':_0xe289('0x4b'),'description':_0xe289('0x4c')+_0x5bd0e9['scheduledAt']['toString'](),'priority':_0x5bd0e9[_0xe289('0x4d')]})[_0xe289('0x18')](function(_0x1348aa){_0x517d1c(null,_0x1348aa);})[_0xe289('0x15')](function(_0x428e40){_0x517d1c(_0x428e40);});};AGIVertices[_0xe289('0x16')]['getPause']=function(_0x292eaf,_0x1fba16){this[_0xe289('0x10')][_0xe289('0x4e')](_0x292eaf)[_0xe289('0x18')](function(_0x407358){_0x1fba16(null,_0x407358?_0x407358[_0xe289('0x14')]:![]);})[_0xe289('0x15')](function(_0x2668e8){_0x1fba16(_0x2668e8);});};AGIVertices[_0xe289('0x16')]['agentPause']=function(_0x9df78c,_0x2874f5,_0x264137){var _0x59e83c={'role':_0xe289('0x4f')};_0x59e83c[_0x9df78c]=this[_0xe289('0x37')][_0xe289('0x3c')];this[_0xe289('0x10')][_0xe289('0x50')](_0x59e83c,_0x2874f5,this[_0xe289('0x37')][_0xe289('0x38')])['then'](function(_0x31fbe1){_0x264137(null,_[_0xe289('0x47')](_0x31fbe1)?![]:!![]);})[_0xe289('0x15')](function(_0x2a3b79){logger[_0xe289('0x2d')](_0x2a3b79);_0x264137(null,![]);});};AGIVertices['prototype'][_0xe289('0x51')]=function(_0x188b99,_0x4a14d8){var _0x2e15a7={'role':_0xe289('0x4f')};_0x2e15a7[_0x188b99]=this[_0xe289('0x37')][_0xe289('0x3c')];this[_0xe289('0x10')][_0xe289('0x51')](_0x2e15a7)['then'](function(_0x25e4ea){_0x4a14d8(null,_['isNil'](_0x25e4ea)?![]:!![]);})[_0xe289('0x15')](function(_0x26043b){logger[_0xe289('0x2d')](_0x26043b);_0x4a14d8(null,![]);});};AGIVertices['prototype'][_0xe289('0x52')]=function(_0x2e864d,_0x3415a4){var _0x420202={'role':_0xe289('0x4f')};_0x420202[_0x2e864d]=this['channel'][_0xe289('0x3c')];this[_0xe289('0x10')][_0xe289('0x52')](_0x420202)['then'](function(_0x43242b){_0x3415a4(null,_[_0xe289('0x47')](_0x43242b)?![]:!![]);})[_0xe289('0x15')](function(_0x335c87){logger[_0xe289('0x2d')](_0x335c87);_0x3415a4(null,![]);});};AGIVertices[_0xe289('0x16')][_0xe289('0x53')]=function(_0x4860c6,_0x2276c2){var _0x2cad94={'role':_0xe289('0x4f')};_0x2cad94[_0x4860c6]=this[_0xe289('0x37')][_0xe289('0x3c')];var _0x133790=_0x4860c6!=_0xe289('0x54')?util['format'](_0xe289('0x55'),_0xe289('0x56'),this['channel'][_0xe289('0x3c')]):undefined;this[_0xe289('0x10')]['agentLogin'](_0x2cad94,_0x133790)[_0xe289('0x18')](function(_0x5d1114){_0x2276c2(null,_['isNil'](_0x5d1114)?![]:!![]);})[_0xe289('0x15')](function(_0x2b3ad4){logger[_0xe289('0x2d')](_0x2b3ad4);_0x2276c2(null,![]);});};AGIVertices[_0xe289('0x16')][_0xe289('0x57')]=function(_0x594013,_0x580f91){sh[_0xe289('0x58')](_[_0xe289('0x59')](_0x594013),function(_0x132cc3,_0x455d18){var _0x1f9f4f=_0x455d18[_0xe289('0x5a')](/(\r\n|\n|\r)/gm,'');_0x580f91(null,_0x1f9f4f);});};AGIVertices['prototype'][_0xe289('0x5b')]=function(_0x714569,_0x19fa27){scripts[_0xe289('0x5b')](_0x714569['apiKey'],_0x714569['google_cloud_tts_text_type']||_0xe289('0x5c'),_0x714569[_0xe289('0x5c')],_0x714569[_0xe289('0x5d')]||_0xe289('0x5e'),_0x714569[_0xe289('0x5f')]||'MALE',_0x714569[_0xe289('0x60')]||_0xe289('0x61'))[_0xe289('0x18')](function(_0x1d0da3){_0x19fa27(null,_0x1d0da3);})[_0xe289('0x15')](function(_0x2d149f){_0x19fa27(_0x2d149f);});};AGIVertices[_0xe289('0x16')]['googleTTS']=function(_0x58d976,_0x251dee){scripts['googleTTS'](_0x58d976[_0xe289('0x5c')],_0x58d976[_0xe289('0x62')]||'en',0x1)['then'](function(_0x124d8c){_0x251dee(null,_0x124d8c);})['catch'](function(_0xce1e2b){_0x251dee(_0xce1e2b);});};AGIVertices[_0xe289('0x16')]['restAPI']=function(_0x4a1864,_0x2c1240){var _0x3f45df={'uri':_0x4a1864[_0xe289('0x63')],'method':_0x4a1864[_0xe289('0x64')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4a1864[_0xe289('0x65')])===_0xe289('0x66')&&parseInt(_0x4a1864['timeout'])>=0x1?parseInt(_0x4a1864[_0xe289('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xe289('0x67')]([_0xe289('0x68'),'PUT'],_0x3f45df[_0xe289('0x64')]['toUpperCase']())){try{_0x3f45df[_0xe289('0x69')]=_0x4a1864[_0xe289('0xc')]?JSON['parse'](_0x4a1864['rawBody']):{};}catch(_0x1fba0b){logger[_0xe289('0x2d')](_0xe289('0x6a'),_0x1fba0b);}}try{_0x3f45df[_0xe289('0x6b')]=_0x4a1864[_0xe289('0xb')]?JSON['parse'](_0x4a1864[_0xe289('0xb')]):{};}catch(_0x52b84b){logger[_0xe289('0x2d')](_0xe289('0x6c'),_0x52b84b);}if(_0x4a1864[_0xe289('0x6d')]){try{var _0x1254e0=require(_0x4a1864['computedVariables'])['sync'](this,_0x3f45df);_0x3f45df[_0xe289('0x6e')]=Mustache['render'](_0x4a1864[_0xe289('0x63')],_0x1254e0,{},['$$','$$']);if(_0x3f45df[_0xe289('0x6b')]){_0x3f45df[_0xe289('0x6b')]=JSON[_0xe289('0x6f')](Mustache[_0xe289('0x70')](JSON[_0xe289('0x71')](_0x3f45df[_0xe289('0x6b')]),_0x1254e0,{},['$$','$$']));}if(_0x3f45df[_0xe289('0x69')]){_0x3f45df[_0xe289('0x69')]=JSON[_0xe289('0x6f')](Mustache[_0xe289('0x70')](JSON[_0xe289('0x71')](_0x3f45df[_0xe289('0x69')]),_0x1254e0,{},['$$','$$']));}}catch(_0x22800f){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x22800f);}}rp(_0x3f45df)[_0xe289('0x18')](function(_0x1862dc){var _0x100975={'statusCode':_0x1862dc[_0xe289('0x72')]||0xc8,'statusMessage':_0x1862dc['statusMessage']||'OK','headers':_0x1862dc[_0xe289('0x6b')]||{},'body':_0x1862dc['body']||{}};_0x2c1240(null,_0x100975);})[_0xe289('0x15')](function(_0x326b68){var _0x425a3a={'statusCode':_0x326b68[_0xe289('0x72')]||0x1f4,'statusMessage':_0x326b68[_0xe289('0x73')]||_0xe289('0x74'),'headers':_0x326b68[_0xe289('0x75')][_0xe289('0x6b')]||{},'body':_0x326b68['options'][_0xe289('0x69')]||{}};_0x2c1240(null,_0x425a3a);});};AGIVertices[_0xe289('0x16')][_0xe289('0x76')]=function(_0x3a82cb,_0xff2df){scripts['googleDialogflow'](this[_0xe289('0x37')][_0xe289('0x38')],_0x3a82cb[_0xe289('0x77')],_0x3a82cb[_0xe289('0x5c')],_0x3a82cb['dialogflow_language']||'en')[_0xe289('0x18')](function(_0x5e2ef0){_0xff2df(null,_0x5e2ef0);})['catch'](function(_0x2eb1dc){_0xff2df(_0x2eb1dc);});};AGIVertices[_0xe289('0x16')][_0xe289('0x78')]=function(_0x1e9a76,_0x35cacb){scripts['googleDialogflowV2'](this[_0xe289('0x37')][_0xe289('0x38')],_0x1e9a76[_0xe289('0x79')],_0x1e9a76[_0xe289('0x7a')],_0x1e9a76[_0xe289('0x7b')],_0x1e9a76[_0xe289('0x5c')],_0x1e9a76[_0xe289('0x7c')]||'en')[_0xe289('0x18')](function(_0x51b561){_0x35cacb(null,_0x51b561);})[_0xe289('0x15')](function(_0x4cd98d){_0x35cacb(_0x4cd98d);});};AGIVertices['prototype'][_0xe289('0x7d')]=function(_0x3bebf8,_0x5ac4bc){scripts[_0xe289('0x7d')](this[_0xe289('0x37')],_0x3bebf8)[_0xe289('0x18')](function(_0x1cece1){_0x5ac4bc(null,_0x1cece1);})['catch'](function(_0x1fa4d4){_0x5ac4bc(_0x1fa4d4);});};AGIVertices[_0xe289('0x16')][_0xe289('0x7e')]=function(_0x175ad6,_0xcc00f9){scripts[_0xe289('0x7e')](_0x175ad6[_0xe289('0x77')],_0x175ad6[_0xe289('0x5c')],_0x175ad6[_0xe289('0x7f')]||_0xe289('0x5e'),_0x175ad6[_0xe289('0x80')])[_0xe289('0x18')](function(_0x32a5c0){_0xcc00f9(null,_0x32a5c0);})[_0xe289('0x15')](function(_0x157d41){_0xcc00f9(_0x157d41);});};AGIVertices[_0xe289('0x16')][_0xe289('0x81')]=function(_0x21c249,_0x5c822c,_0x39d2af){scripts[_0xe289('0x81')](_0x5c822c,_0x21c249[_0xe289('0x77')],_0x21c249[_0xe289('0x82')]||_0xe289('0x5e'),this[_0xe289('0x83')](_0x21c249['model'])?_0x21c249[_0xe289('0x84')]:undefined)['then'](function(_0x15aedb){_0x39d2af(null,_0x15aedb);})[_0xe289('0x15')](function(_0x1011f9){_0x39d2af(_0x1011f9);});};AGIVertices[_0xe289('0x16')][_0xe289('0x85')]=function(_0x45b902,_0x387942){scripts[_0xe289('0x85')](_0x45b902[_0xe289('0x86')],_0x45b902[_0xe289('0x87')],_0x45b902['aws_polly_region'],_0x45b902[_0xe289('0x88')]||_0xe289('0x89'),_0x45b902['text'],_0x45b902[_0xe289('0x8a')]||_0xe289('0x5c'))[_0xe289('0x18')](function(_0xefcf15){_0x387942(null,_0xefcf15);})[_0xe289('0x15')](function(_0x5ab3ff){_0x387942(_0x5ab3ff);});};AGIVertices[_0xe289('0x16')][_0xe289('0x8b')]=function(_0x577890,_0x3da7f9){scripts[_0xe289('0x8b')](this[_0xe289('0x37')][_0xe289('0x38')],_0x577890['aws_access_key_id'],_0x577890[_0xe289('0x87')],_0x577890[_0xe289('0x8c')],_0x577890[_0xe289('0x5c')],_0x577890[_0xe289('0x8d')])[_0xe289('0x18')](function(_0x3934a4){_0x3da7f9(null,_0x3934a4);})['catch'](function(_0x22d2fc){_0x3da7f9(_0x22d2fc);});};AGIVertices[_0xe289('0x16')]['googleASR']=function(_0xfce37b,_0x28c4b1,_0x2fdd98){scripts[_0xe289('0x8e')](_0x28c4b1,_0xfce37b[_0xe289('0x77')],_0xfce37b[_0xe289('0x8f')]||_0xe289('0x5e'))['then'](function(_0x182b88){_0x2fdd98(null,_0x182b88);})[_0xe289('0x15')](function(_0x507ab5){_0x2fdd98(_0x507ab5);});};AGIVertices[_0xe289('0x16')][_0xe289('0x90')]=function(_0x21ffa5,_0x143afc,_0x423730){scripts['tildeASR'](_0x143afc,_0x21ffa5['appid'],_0x21ffa5[_0xe289('0x91')],_0x21ffa5[_0xe289('0x6e')])['then'](function(_0x39b4c5){_0x423730(null,_0x39b4c5);})['catch'](function(_0x34a04e){_0x423730(_0x34a04e);});};AGIVertices['prototype'][_0xe289('0x92')]=function(_0x43a52f){var _0x3c7891=_[_0xe289('0x67')](verticesWithRetry,_0x43a52f['agicommand'])?_0x43a52f:_['clone'](_0x43a52f);for(var _0x23f2df in _0x3c7891){if(_0x3c7891[_0xe289('0x93')](_0x23f2df)){if(_0x3c7891[_0x23f2df]&&_[_0xe289('0x94')](_0x3c7891[_0x23f2df])){if(_['includes'](recursiveMapAttributes,_0x23f2df)){_0x3c7891[_0x23f2df]=this['replaceObjectAllVariables'](_0x3c7891[_0x23f2df]);}else{_0x3c7891[_0x23f2df]=this[_0xe289('0x95')](_0x3c7891[_0x23f2df]);}}}}return _0x3c7891;};AGIVertices[_0xe289('0x16')][_0xe289('0x96')]=function(_0x3f997c){for(var _0x497b63 in _0x3f997c){if(_0x3f997c[_0xe289('0x93')](_0x497b63)){if(_['isPlainObject'](_0x3f997c[_0x497b63])){this[_0xe289('0x96')](_0x3f997c[_0x497b63]);}else if(_[_0xe289('0x97')](_0x3f997c[_0x497b63])){for(var _0x430152=0x0;_0x430152<_0x3f997c[_0x497b63][_0xe289('0x98')];_0x430152++){this[_0xe289('0x96')](_0x3f997c[_0x497b63][_0x430152]);}}else if(_[_0xe289('0x94')](_0x3f997c[_0x497b63])){_0x3f997c[_0x497b63]=this[_0xe289('0x95')](_0x3f997c[_0x497b63]);}}}};AGIVertices[_0xe289('0x16')]['saveRestApiResult']=function(_0x2d6386,_0x2ca8dd){for(var _0x20b089 in _0x2d6386){if(_0x2d6386['hasOwnProperty'](_0x20b089)){if(_[_0xe289('0x99')](_0x2d6386[_0x20b089])){if(!_[_0xe289('0x46')](_0x2d6386[_0x20b089])){this[_0xe289('0x9a')](_0x2d6386[_0x20b089],util[_0xe289('0x29')]('%s.%s',_0x2ca8dd,_0x20b089));}}else if(_[_0xe289('0x97')](_0x2d6386[_0x20b089])){for(var _0x251192=0x0;_0x251192<_0x2d6386[_0x20b089][_0xe289('0x98')];_0x251192++){this[_0xe289('0x9a')](_0x2d6386[_0x20b089][_0x251192],util[_0xe289('0x29')](_0xe289('0x9b'),_0x2ca8dd,_0x20b089+'['+_0x251192+']'));}}else{if(!_[_0xe289('0x47')](_0x2d6386[_0x20b089])){this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')]('%s.%s',_0x2ca8dd,_0x20b089),_0x2d6386[_0x20b089]);}}}}};AGIVertices[_0xe289('0x16')]['replaceObjectAllVariables']=function(_0x59fdd1){try{var _0x31d98c=JSON[_0xe289('0x6f')](_0x59fdd1);this[_0xe289('0x96')](_0x31d98c);return JSON[_0xe289('0x71')](_0x31d98c);}catch(_0x1ab593){return this['replaceAllVariables'](_0x59fdd1);}};AGIVertices[_0xe289('0x16')]['replaceAllVariables']=function(_0x4fe2d4){var _0x1a973f=_0x4fe2d4['split']('{');for(var _0x6fe901=0x1;_0x6fe901<_0x1a973f['length'];_0x6fe901+=0x1){var _0xeea03c=_0x1a973f[_0x6fe901][_0xe289('0x9d')]('}');if(_0xeea03c[_0xe289('0x98')]>0x1){_0x4fe2d4=_0x4fe2d4['replaceAll']('{'+_0xeea03c[0x0]+'}',this[_0xe289('0x37')][_0xe289('0x12')](_0xeea03c[0x0])[_0xe289('0x9e')]||_0xeea03c[0x0]);}}if(_0x1a973f[_0xe289('0x98')]===0x1){return _0x4fe2d4[_0xe289('0x9f')]();}return this['replaceAllVariables'](_0x4fe2d4);};AGIVertices[_0xe289('0x16')][_0xe289('0xa0')]=function(_0x13b589,_0x113608){var _0x25e7bf=this[_0xe289('0x37')][_0xe289('0x12')](_0x13b589);if(_0x25e7bf[_0xe289('0xa1')]===-0x1){return _0x25e7bf;}logger['info'](util[_0xe289('0x29')](_0xe289('0xa2'),_0x113608,_0x25e7bf[_0xe289('0x9e')]));return this[_0xe289('0x37')][_0xe289('0x9c')](_0x113608,_0x25e7bf[_0xe289('0x9e')]);};AGIVertices[_0xe289('0x16')][_0xe289('0x83')]=function(_0x3beedc){return _0x3beedc&&_0x3beedc!=='0'&&_0x3beedc!=='-1'&&_0x3beedc!=='';};AGIVertices['prototype'][_0xe289('0xa3')]=function(_0x48843a){this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x48843a,'-');_0x48843a[_0xe289('0xa5')]=_0x48843a[_0xe289('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x5ee0e9){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xa6'),_0x5ee0e9[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x5ee0e9[_0xe289('0x5c')])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0xa8'));}var _0x5bf5ca='\x22'+_0x5ee0e9[_0xe289('0x5c')]+'\x22';if(this[_0xe289('0x83')](_0x5ee0e9[_0xe289('0x75')])){_0x5bf5ca+=','+_0x5ee0e9[_0xe289('0x75')];}var _0x384436=this[_0xe289('0x37')]['exec'](_0xe289('0xa9'),_0x5bf5ca);if(_0x384436[_0xe289('0xa1')]===-0x1){return _0x384436;}return this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0xaa'),_0x5bf5ca));};AGIVertices[_0xe289('0x16')][_0xe289('0xab')]=function(_0x535fa0){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x535fa0[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x535fa0['grammar'])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20grammar\x20configured');}var _0x10c910=_0x535fa0[_0xe289('0xac')];if(this[_0xe289('0x83')](_0x535fa0[_0xe289('0x75')])){_0x10c910+=','+_0x535fa0['options'];}var _0x223b46=this['channel'][_0xe289('0x58')](_0xe289('0xad'),_0x10c910);if(_0x223b46[_0xe289('0xa1')]===-0x1){return _0x223b46;}var _0x3bbbbc=this[_0xe289('0xa0')](_0xe289('0xae'),_0xe289('0xaf'));if(_0x3bbbbc['result']===-0x1){return _0x3bbbbc;}var _0x412b78=this['getAndSetVariable'](_0xe289('0xb0'),_0xe289('0xb1'));if(_0x412b78[_0xe289('0xa1')]===-0x1){return _0x412b78;}var _0x565f2c=this[_0xe289('0xa0')](_0xe289('0xb2'),_0xe289('0xb3'));if(_0x565f2c[_0xe289('0xa1')]===-0x1){return _0x565f2c;}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0xb4'),_0x10c910));};AGIVertices['prototype'][_0xe289('0x8')]=function(_0x7cc5f6){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xb5'),_0x7cc5f6[_0xe289('0x39')]));return this[_0xe289('0x37')]['agi']([_0x7cc5f6[_0xe289('0xb6')],_0x7cc5f6[_0xe289('0xb7')]]);};AGIVertices[_0xe289('0x16')][_0xe289('0xb8')]=function(_0xe51a0d){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xb9'),_0xe51a0d[_0xe289('0x39')]));if(this['isConfigured'](_0xe51a0d[_0xe289('0x65')])){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xba'),_0xe51a0d['timeout']));var _0x3eb117=this[_0xe289('0x37')][_0xe289('0xbb')](_0xe51a0d[_0xe289('0x65')]);if(_0x3eb117[_0xe289('0xa1')]===-0x1){return _0x3eb117;}}return this[_0xe289('0x37')]['answer']();};AGIVertices[_0xe289('0x16')][_0xe289('0x4b')]=function(_0x51ea1f){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xbc'),_0x51ea1f[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x51ea1f['list_id'])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x51ea1f,'no\x20list\x20selected');}_0x51ea1f[_0xe289('0xbd')]=moment();if(this[_0xe289('0x83')](_0x51ea1f[_0xe289('0xbe')])){_0x51ea1f['scheduledAt']=moment()['add'](_0x51ea1f[_0xe289('0xbe')],'minutes');}if(!this[_0xe289('0x83')](_0x51ea1f[_0xe289('0x4d')])){_0x51ea1f[_0xe289('0x4d')]=0x2;}this['createCmContact'][_0xe289('0xa4')](this,_0x51ea1f);return this[_0xe289('0x37')][_0xe289('0xa7')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x51ea1f[_0xe289('0xbf')],_0x51ea1f['list_id'],_0x51ea1f[_0xe289('0xbd')]));};AGIVertices[_0xe289('0x16')]['custom_app']=function(_0x4c7c9a){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x4c7c9a['label']));var _0x296611=this['channel'][_0xe289('0x58')](_0x4c7c9a[_0xe289('0xc0')],_0x4c7c9a[_0xe289('0x75')]);if(_0x296611[_0xe289('0xa1')]===-0x1){return _0x296611;}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')]('Executed\x20command\x20%s\x20%s',_0x4c7c9a[_0xe289('0xc0')],_0x4c7c9a['options']));};AGIVertices['prototype'][_0xe289('0xc1')]=function(_0x14a739){logger[_0xe289('0x2f')](util['format'](_0xe289('0xc2'),_0x14a739[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x14a739[_0xe289('0x5c')])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20text\x20configured');}var _0x5ed5d4='\x22'+_0x14a739['text']+'\x22';if(this['isConfigured'](_0x14a739[_0xe289('0x75')])){_0x5ed5d4+=','+_0x14a739[_0xe289('0x75')];}var _0x23938d=this[_0xe289('0x37')][_0xe289('0x58')](_0xe289('0xa9'),_0x5ed5d4);if(_0x23938d['result']===-0x1){return _0x23938d;}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0xaa'),_0x5ed5d4));};AGIVertices[_0xe289('0x16')][_0xe289('0xc3')]=function(_0x2ac707){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x2ac707[_0xe289('0x39')]));if(!this['isConfigured'](_0x2ac707['text'])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0xa8'));}var _0x293b77='\x22'+_0x2ac707[_0xe289('0x5c')]+'\x22';if(this[_0xe289('0x83')](_0x2ac707['options'])){_0x293b77+=','+_0x2ac707[_0xe289('0x75')];}var _0x21be04=this[_0xe289('0x37')]['exec'](_0xe289('0xa9'),_0x293b77);if(_0x21be04[_0xe289('0xa1')]===-0x1){return _0x21be04;}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0xaa'),_0x293b77));};AGIVertices[_0xe289('0x16')][_0xe289('0xc4')]=function(_0x32e39c){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xc5'),_0x32e39c[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x32e39c[_0xe289('0xac')])){return this['channel']['noop'](_0xe289('0xc6'));}var _0x3fb2f1=_0x32e39c[_0xe289('0xac')];if(this[_0xe289('0x83')](_0x32e39c[_0xe289('0x75')])){_0x3fb2f1+=','+_0x32e39c[_0xe289('0x75')];}var _0x51ed36=this['channel'][_0xe289('0x58')]('MRCPRecog',_0x3fb2f1);if(_0x51ed36[_0xe289('0xa1')]===-0x1){return _0x51ed36;}var _0x47260b=this[_0xe289('0xa0')](_0xe289('0xae'),_0xe289('0xc7'));if(_0x47260b[_0xe289('0xa1')]===-0x1){return _0x47260b;}var _0x29ef76=this[_0xe289('0xa0')]('RECOG_INPUT()',_0xe289('0xc8'));if(_0x29ef76[_0xe289('0xa1')]===-0x1){return _0x29ef76;}var _0x2b8607=this['getAndSetVariable'](_0xe289('0xb2'),_0xe289('0xc9'));if(_0x2b8607[_0xe289('0xa1')]===-0x1){return _0x2b8607;}return this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0xb4'),_0x3fb2f1));};AGIVertices['prototype']['sestekasr']=function(_0x20987e){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x20987e[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x20987e[_0xe289('0xac')])){return this['channel'][_0xe289('0xa7')](_0xe289('0xc6'));}var _0x1fb119=_0x20987e['grammar'];if(this[_0xe289('0x83')](_0x20987e[_0xe289('0x75')])){_0x1fb119+=','+_0x20987e[_0xe289('0x75')];}var _0x364410=this[_0xe289('0x37')]['exec'](_0xe289('0xad'),_0x1fb119);if(_0x364410[_0xe289('0xa1')]===-0x1){return _0x364410;}var _0x5ddeef=this[_0xe289('0xa0')](_0xe289('0xae'),_0xe289('0xca'));if(_0x5ddeef[_0xe289('0xa1')]===-0x1){return _0x5ddeef;}var _0x52943f=this[_0xe289('0xa0')](_0xe289('0xb0'),_0xe289('0xcb'));if(_0x52943f['result']===-0x1){return _0x52943f;}var _0x438977=this[_0xe289('0xa0')](_0xe289('0xb2'),_0xe289('0xcc'));if(_0x438977[_0xe289('0xa1')]===-0x1){return _0x438977;}return this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1fb119));};AGIVertices[_0xe289('0x16')][_0xe289('0xcd')]=function(_0x53de89){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x53de89[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x53de89[_0xe289('0xce')])){return this['channel'][_0xe289('0x2d')](_0x53de89,_0xe289('0xcf'));}var _0x56d7ed=this[_0xe289('0xd0')][_0xe289('0xa4')](this,_0x53de89[_0xe289('0xce')]);if(!_0x56d7ed){return this[_0xe289('0x37')]['error'](_0x53de89,_0xe289('0xd1'));}if(!this[_0xe289('0x83')](_0x53de89[_0xe289('0x31')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x53de89,'no\x20query\x20configured');}var _0x2cda0b=_0x53de89[_0xe289('0x31')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')]('query:\x20%s',_0x2cda0b));var _0x301a0a=this['getQueryOdbc'][_0xe289('0xa4')](this,_0x56d7ed,_0x2cda0b);this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x53de89,_0x2cda0b);if(!this[_0xe289('0x83')](_0x53de89[_0xe289('0xd2')])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0xd3'));}var _0x2135b7=this['getVariable'][_0xe289('0xa4')](this,_0x53de89[_0xe289('0xd2')]);if(!_0x2135b7){return this[_0xe289('0x37')]['error'](_0x53de89,_0xe289('0xd4'));}var _0x1434df=this;_0x301a0a[_0xe289('0xd5')](function(_0x43f4c6,_0x426e0c){Object[_0xe289('0xd6')](_0x43f4c6)[_0xe289('0xd5')](function(_0xca47b6){_0x1434df[_0xe289('0x37')][_0xe289('0x9c')](util['format'](_0xe289('0xd7'),_0x2135b7,_0x426e0c,_0xca47b6),_0x43f4c6[_0xca47b6]);});});this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')](_0xe289('0xd8'),_0x2135b7),_0x301a0a[_0xe289('0x98')]);return this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')]('variable\x20%s\x20set',_0x2135b7));};AGIVertices[_0xe289('0x16')][_0xe289('0xd9')]=function(_0x4cb226){logger[_0xe289('0xda')](util[_0xe289('0x29')](_0xe289('0xdb'),_0x4cb226[_0xe289('0x39')]));if(!this['isConfigured'](_0x4cb226[_0xe289('0xdc')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x4cb226,'no\x20user\x20selected');}var _0x2672c9=this[_0xe289('0x1b')]['sync'](this,_0x4cb226['sip_id']);if(!_0x2672c9){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x4cb226,'no\x20user\x20found');}var _0x32b09f=this[_0xe289('0x37')][_0xe289('0x58')](_0xe289('0xdd'),[util[_0xe289('0x29')](_0xe289('0xde'),_0x2672c9),_0x4cb226[_0xe289('0x65')],_0x4cb226[_0xe289('0xdf')],_0x4cb226['url']]);if(_0x32b09f[_0xe289('0xa1')]===-0x1){return _0x32b09f;}return this['channel']['noop'](util[_0xe289('0x29')]('Executed\x20command\x20%s',_0xe289('0xdd')));};AGIVertices[_0xe289('0x16')]['dialogflow']=function(_0x240ec0){logger[_0xe289('0x2f')](util['format'](_0xe289('0xe0'),_0x240ec0[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x240ec0[_0xe289('0x77')])){return this['channel'][_0xe289('0xa7')](_0xe289('0xe1'));}if(!this[_0xe289('0x83')](_0x240ec0[_0xe289('0x5c')])){return this['channel'][_0xe289('0xa7')](_0xe289('0xa8'));}this['channel'][_0xe289('0xe2')]=!![];this[_0xe289('0x36')](_0x240ec0);this[_0xe289('0x44')](_0x240ec0[_0xe289('0x5c')],'in','','');this[_0xe289('0x37')]['noop'](util['format']('Trying\x20Dialogflow:\x20%s',_0x240ec0[_0xe289('0x5c')]));var _0x538daa=this[_0xe289('0x76')][_0xe289('0xa4')](this,_0x240ec0);if(_0x538daa){for(var _0x35e9ef in _0x538daa){if(_0x538daa[_0xe289('0x93')](_0x35e9ef)){this['channel'][_0xe289('0x9c')](util[_0xe289('0x29')](_0xe289('0xe3'),_0x35e9ef[_0xe289('0xe4')]()),_0x538daa[_0x35e9ef]);}}this[_0xe289('0x44')](_0x538daa[_0xe289('0xe5')],'out',_0xe289('0xe6'),'');return this[_0xe289('0x37')]['noop'](util['format'](_0xe289('0xe7'),_0x538daa['speech']));}return this[_0xe289('0x37')][_0xe289('0x2d')](_0x240ec0,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xe289('0xe8')]=function(_0x28dcbe){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xe9'),_0x28dcbe[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x28dcbe['dialogflowV2_project_id'])){return this[_0xe289('0x37')]['noop']('no\x20project_id\x20configured');}if(!this[_0xe289('0x83')](_0x28dcbe['client_email'])){return this['channel'][_0xe289('0xa7')](_0xe289('0xea'));}if(!this['isConfigured'](_0x28dcbe[_0xe289('0x7b')])){return this['channel'][_0xe289('0xa7')](_0xe289('0xeb'));}if(!this[_0xe289('0x83')](_0x28dcbe[_0xe289('0x7c')])){return this['channel'][_0xe289('0xa7')](_0xe289('0xec'));}if(!this['isConfigured'](_0x28dcbe[_0xe289('0x5c')])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20text\x20configured');}this[_0xe289('0x37')][_0xe289('0xe2')]=!![];this[_0xe289('0x36')](_0x28dcbe);this[_0xe289('0x44')](_0x28dcbe[_0xe289('0x5c')],'in','','');this[_0xe289('0x37')][_0xe289('0xa7')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x28dcbe[_0xe289('0x5c')]));var _0x2e3a9d=this[_0xe289('0x78')][_0xe289('0xa4')](this,_0x28dcbe);if(_0x2e3a9d){for(var _0x46e283 in _0x2e3a9d){if(_0x2e3a9d[_0xe289('0x93')](_0x46e283)){if(_0x46e283!==_0xe289('0xed')){this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')]('DIALOGFLOW_%s',_0x46e283['toUpperCase']()),_0x2e3a9d[_0x46e283]);}}}this[_0xe289('0x44')](_0x2e3a9d['speech'],'out',_0xe289('0xe8'),_0x2e3a9d[_0xe289('0xed')]);return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0xee'),_0x2e3a9d[_0xe289('0xe5')]));}return this['channel'][_0xe289('0x2d')](_0x28dcbe,_0xe289('0xef'));};AGIVertices[_0xe289('0x16')][_0xe289('0xf0')]=function(_0xaee5a0){logger['info'](util[_0xe289('0x29')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xaee5a0['label']));if(!this[_0xe289('0x83')](_0xaee5a0[_0xe289('0xf1')])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xe289('0x83')](_0xaee5a0['username'])){return this[_0xe289('0x37')]['noop']('no\x20username\x20configured');}if(!this[_0xe289('0x83')](_0xaee5a0['password'])){return this['channel'][_0xe289('0xa7')](_0xe289('0xf2'));}if(!this[_0xe289('0x83')](_0xaee5a0[_0xe289('0xf3')])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0xa8'));}this[_0xe289('0x37')][_0xe289('0xe2')]=!![];this[_0xe289('0x36')](_0xaee5a0);this[_0xe289('0x44')](_0xaee5a0['text'],'in','','');this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0xf4'),_0xaee5a0[_0xe289('0x5c')]));var _0x1a86ea=this[_0xe289('0x7d')]['sync'](this,_0xaee5a0);if(_0x1a86ea){for(var _0xf31b7d in _0x1a86ea){if(_0x1a86ea[_0xe289('0x93')](_0xf31b7d)){this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')]('SESTEK_NDA_%s',_0xf31b7d['toUpperCase']()),_0x1a86ea[_0xf31b7d]);}}this[_0xe289('0x44')](_0x1a86ea[_0xe289('0xe5')],_0xe289('0xf5'),_0xe289('0xf0'),'');if(_0x1a86ea['audiofile']){this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0xf6'),_0x1a86ea[_0xe289('0xf7')]));var _0x5ef00d=this[_0xe289('0x37')][_0xe289('0xf8')](_0x1a86ea[_0xe289('0xf7')]);try{fs['unlink'](_0x1a86ea[_0xe289('0xf7')]+_0xe289('0xf9'));}catch(_0xd65aad){logger['error'](_0xd65aad);}return _0x5ef00d;}else{return this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0xfa'),_0x1a86ea[_0xe289('0xe5')]));}}return this['channel']['error'](_0xaee5a0,_0xe289('0xfb'));};AGIVertices[_0xe289('0x16')][_0xe289('0xfc')]=function(_0x23d021){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xfd'),_0x23d021[_0xe289('0x39')]));return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0xfc'));};AGIVertices[_0xe289('0x16')][_0xe289('0xfe')]=function(_0x231f80){logger['info'](util[_0xe289('0x29')](_0xe289('0xff'),_0x231f80[_0xe289('0x39')]));var _0x1bed74='';if(_0x231f80[_0xe289('0x100')]){if(!this[_0xe289('0x83')](_0x231f80[_0xe289('0x100')])){return this[_0xe289('0x37')]['error'](_0x231f80,'no\x20trunk\x20selected');}else{var _0x2f7948=parseInt(_0x231f80[_0xe289('0x100')],0xa);if(isNaN(_0x2f7948)){_0x1bed74=_0x231f80[_0xe289('0x100')];}else{_0x1bed74=this[_0xe289('0x1d')][_0xe289('0xa4')](this,_0x231f80['trunk_id']);if(!_0x1bed74){return this['channel']['error'](_0x231f80,_0xe289('0x101'));}}}}else if(_0x231f80[_0xe289('0x102')]){_0x1bed74=_0x231f80[_0xe289('0x102')];}else{return this[_0xe289('0x37')][_0xe289('0x2d')](_0x231f80,_0xe289('0x103'));}var _0x38f16d=this['channel']['exec'](_0xe289('0xdd'),[util[_0xe289('0x29')](_0xe289('0x104'),_0x1bed74,_0x231f80[_0xe289('0xbf')]),_0x231f80[_0xe289('0x65')],_0x231f80[_0xe289('0xdf')],_0x231f80['url']]);if(_0x38f16d[_0xe289('0xa1')]===-0x1){return _0x38f16d;}return this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0x105'),'DIAL'));};AGIVertices['prototype'][_0xe289('0x106')]=function(_0x56346f){logger['info'](util[_0xe289('0x29')](_0xe289('0x107'),_0x56346f[_0xe289('0x39')]));return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x106'));};AGIVertices[_0xe289('0x16')][_0xe289('0xe')]=function(_0x17168d){logger['info'](util[_0xe289('0x29')](_0xe289('0x108'),_0x17168d[_0xe289('0x39')]));if(_0x17168d[_0xe289('0xa5')]===0x0){return this[_0xe289('0xa3')](_0x17168d);}_0x17168d[_0xe289('0xa5')]-=0x1;if(!this[_0xe289('0x83')](_0x17168d[_0xe289('0x109')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x17168d,_0xe289('0x10a'));}var _0x1e873a=this[_0xe289('0x1e')][_0xe289('0xa4')](this,_0x17168d[_0xe289('0x109')]);if(!_0x1e873a){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x17168d,_0xe289('0x10b'));}if(!this[_0xe289('0x83')](_0x17168d[_0xe289('0xd2')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0xe289('0xd3'));}var _0x1591d2=this[_0xe289('0x37')][_0xe289('0x10c')](_0x1e873a,_0x17168d[_0xe289('0x10d')],_0x17168d[_0xe289('0x10e')]);var _0x2b1f66=_0x1591d2[_0xe289('0xa1')]?_0x1591d2[_0xe289('0xa1')]['toString']():'';logger[_0xe289('0x2f')](_0xe289('0x10f'),JSON[_0xe289('0x71')](_0x1591d2));if(_0x1591d2[_0xe289('0xa1')]===-0x1){this['createSquareDetailsReport'][_0xe289('0xa4')](this,_0x17168d,_0x2b1f66);return _0x1591d2;}else if(_0x1591d2[_0xe289('0x9e')]===_0xe289('0x65')){_0x1591d2[_0xe289('0xa1')]=_0x2b1f66['length']>=parseInt(_0x17168d[_0xe289('0x110')])?'x':'i';}else{_0x1591d2[_0xe289('0xa1')]=_0x2b1f66[_0xe289('0x98')]>=parseInt(_0x17168d[_0xe289('0x110')])&&_0x2b1f66[_0xe289('0x98')]<=parseInt(_0x17168d['maxdigit'])?'x':'i';}var _0x5b038d=this[_0xe289('0x12')][_0xe289('0xa4')](this,_0x17168d[_0xe289('0xd2')]);if(!_0x5b038d){return this['channel']['error'](_0x17168d,_0xe289('0xd4'));}this[_0xe289('0x37')][_0xe289('0x9c')](_0x5b038d,_0x2b1f66);if(this[_0xe289('0x83')](_0x17168d[_0xe289('0x111')])){var _0x33d5a5=parseInt(_0x17168d[_0xe289('0x111')],0xa);var _0x3c4ca4=rs[_0xe289('0x112')]({'charset':'*','length':_0x33d5a5});var _0x333774=_0x2b1f66[_0xe289('0x98')];if(_0x333774>0x0){if(_0x333774>_0x33d5a5){this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x17168d,_0x17168d[_0xe289('0x113')]===_0xe289('0x114')?_0x3c4ca4+_0x2b1f66[_0xe289('0x115')](_0x33d5a5):_0x2b1f66['substr'](0x0,_0x333774-_0x33d5a5)+_0x3c4ca4);}else{this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x17168d,rs[_0xe289('0x112')]({'charset':'*','length':_0x333774}));}}else{this['createSquareDetailsReport'][_0xe289('0xa4')](this,_0x17168d,'');}}else{this[_0xe289('0x36')]['sync'](this,_0x17168d,_0x2b1f66);}return _0x1591d2;};AGIVertices[_0xe289('0x16')][_0xe289('0xf')]=function(_0x377e7a){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x377e7a[_0xe289('0x39')]));return this[_0xe289('0xe')](_0x377e7a);};AGIVertices[_0xe289('0x16')][_0xe289('0x116')]=function(_0x325d26){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x117'),_0x325d26[_0xe289('0x39')]));this['createSquareDetailsReport'][_0xe289('0xa4')](this,_0x325d26,_0x325d26[_0xe289('0x118')]);return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')]('GOAL\x20%s',_0x325d26[_0xe289('0x118')]));};AGIVertices[_0xe289('0x16')]['awspolly']=function(_0x4ead22){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x119'),_0x4ead22[_0xe289('0x39')]));if(!this['isConfigured'](_0x4ead22['aws_access_key_id'])||!this[_0xe289('0x83')](_0x4ead22['aws_secret_access_key'])){return this[_0xe289('0x37')]['noop'](_0xe289('0x11a'));}if(!this[_0xe289('0x83')](_0x4ead22[_0xe289('0x5c')])){return this['channel'][_0xe289('0xa7')]('no\x20text\x20configured');}this[_0xe289('0x37')]['noop'](util['format'](_0xe289('0x11b'),_0x4ead22[_0xe289('0x5c')]));var _0x4d6f38=this[_0xe289('0x85')][_0xe289('0xa4')](this,_0x4ead22);if(_0x4d6f38){this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0x11c'),_0x4d6f38));var _0x889302=this[_0xe289('0x37')]['streamFile'](_0x4d6f38);try{fs['unlink'](_0x4d6f38+_0xe289('0xf9'));}catch(_0x1fb301){logger[_0xe289('0x2d')](_0x1fb301);}return _0x889302;}return this['channel']['error'](_0x4ead22,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xe289('0x16')][_0xe289('0x11d')]=function(_0x55ea8a){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x11e'),_0x55ea8a[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x55ea8a[_0xe289('0x86')])||!this['isConfigured'](_0x55ea8a[_0xe289('0x87')])){return this[_0xe289('0x37')]['noop'](_0xe289('0x11a'));}if(!this[_0xe289('0x83')](_0x55ea8a[_0xe289('0x8d')])){return this['channel'][_0xe289('0xa7')]('no\x20bot\x20name\x20configured');}if(!this[_0xe289('0x83')](_0x55ea8a['text'])){return this['channel'][_0xe289('0xa7')](_0xe289('0xa8'));}this[_0xe289('0x37')][_0xe289('0xe2')]=!![];this['createSquareDetailsReport'](_0x55ea8a);this[_0xe289('0x44')](_0x55ea8a['text'],'in','','');this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x11f'),_0x55ea8a[_0xe289('0x5c')]));var _0x41d44a=this[_0xe289('0x8b')][_0xe289('0xa4')](this,_0x55ea8a);if(_0x41d44a){for(var _0xcbc06f in _0x41d44a){if(_0x41d44a[_0xe289('0x93')](_0xcbc06f)&&_[_0xe289('0x94')](_0x41d44a[_0xcbc06f])){this['channel'][_0xe289('0x9c')](util[_0xe289('0x29')]('AWS_LEX_%s',_0xcbc06f[_0xe289('0xe4')]()),_0x41d44a[_0xcbc06f]);}}if(_[_0xe289('0x47')](_0x41d44a['message'])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x120'));}else{this['createSquareMessage'](_0x41d44a[_0xe289('0x73')],'out','amazonlex','');return this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x121'),_0x41d44a[_0xe289('0x73')]));}}return this[_0xe289('0x37')]['error'](_0x55ea8a,_0xe289('0x122'));};AGIVertices[_0xe289('0x16')][_0xe289('0x123')]=function(_0x1ba456){logger['info'](util[_0xe289('0x29')](_0xe289('0x124'),_0x1ba456[_0xe289('0x39')],_0x1ba456[_0xe289('0x65')]));if(!this['isConfigured'](_0x1ba456['key'])){return this['channel']['noop'](_0xe289('0xe1'));}var _0x363287=_0xe289('0x125');var _0x460903=util['format'](_0xe289('0x126'),FILES_PATH,rs[_0xe289('0x112')](0x4));var _0xf5a473=util[_0xe289('0x29')](_0xe289('0x9b'),_0x460903,_0x363287);var _0x43e3d2=!![];if(_0x1ba456['beep']===_0xe289('0x127')){_0x43e3d2=![];}var _0x923d48=this[_0xe289('0x37')][_0xe289('0x128')](_0x460903,_0x363287,_0x1ba456['intKey'],_0x1ba456[_0xe289('0x65')],undefined,_0x43e3d2);if(_0x923d48[_0xe289('0xa1')]!==-0x1){this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x129'),_0xf5a473));var _0x683aae=this['googleASR'][_0xe289('0xa4')](this,_0x1ba456,_0xf5a473);if(_0x683aae){for(var _0x3b7f51 in _0x683aae){if(_0x683aae[_0xe289('0x93')](_0x3b7f51)){this[_0xe289('0x37')]['setVariable'](util[_0xe289('0x29')](_0xe289('0x12a'),_0x3b7f51[_0xe289('0xe4')]()),_0x683aae[_0x3b7f51]);}}return this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x12b'),JSON[_0xe289('0x71')](_0x683aae)));}}return _0x923d48;};AGIVertices['prototype']['tildeasr']=function(_0x3f3a06){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x3f3a06[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x3f3a06[_0xe289('0x12c')])){return this['channel']['noop']('no\x20appid\x20configured');}if(!this[_0xe289('0x83')](_0x3f3a06[_0xe289('0x91')])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x12d'));}var _0x569197='wav';var _0x32d2c1=util[_0xe289('0x29')](_0xe289('0x126'),FILES_PATH,rs[_0xe289('0x112')](0x4));var _0x10dd2b=util[_0xe289('0x29')]('%s.%s',_0x32d2c1,_0x569197);var _0x3b6bfd=!![];if(_0x3f3a06['beep']===_0xe289('0x127')){_0x3b6bfd=![];}var _0x45720e=this[_0xe289('0x37')][_0xe289('0x128')](_0x32d2c1,_0x569197,_0x3f3a06[_0xe289('0x12e')],_0x3f3a06[_0xe289('0x65')],undefined,_0x3b6bfd);if(_0x45720e[_0xe289('0xa1')]!==-0x1){this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x12f'),_0x10dd2b));var _0xeed44e=this[_0xe289('0x90')][_0xe289('0xa4')](this,_0x3f3a06,_0x10dd2b);if(_0xeed44e){for(var _0x2b1ad0 in _0xeed44e){if(_0xeed44e['hasOwnProperty'](_0x2b1ad0)){this['channel']['setVariable'](util[_0xe289('0x29')](_0xe289('0x130'),_0x2b1ad0['toUpperCase']()),_0xeed44e[_0x2b1ad0]);}}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x131'),JSON[_0xe289('0x71')](_0xeed44e)));}}return _0x45720e;};AGIVertices[_0xe289('0x16')][_0xe289('0x132')]=function(_0x1adb55){logger[_0xe289('0x2f')](util['format'](_0xe289('0x133'),_0x1adb55['label']));return this['channel']['continueAt'](_0x1adb55['context'],_0x1adb55['extension'],_0x1adb55['priority']);};AGIVertices[_0xe289('0x16')][_0xe289('0x134')]=function(_0x4c489f){logger['info'](util[_0xe289('0x29')](_0xe289('0x135'),_0x4c489f['label']));if(!this[_0xe289('0x83')](_0x4c489f[_0xe289('0x136')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x4c489f,_0xe289('0x137'));}try{var _0x1df61b=eval(_0x4c489f[_0xe289('0x136')])?_0xe289('0x138'):_0xe289('0x139');this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4c489f[_0xe289('0x136')],_0x1df61b));return{'code':0xc8,'result':_0x1df61b};}catch(_0x188c8f){return{'code':0xc8,'result':_0xe289('0x139')};}};AGIVertices[_0xe289('0x16')][_0xe289('0x13a')]=function(_0xe9ee3e){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x13b'),_0xe9ee3e[_0xe289('0x39')]));if(!this['isConfigured'](_0xe9ee3e[_0xe289('0x13c')])){return this['channel'][_0xe289('0x2d')](_0xe9ee3e,_0xe289('0x13d'));}var _0x3fc40f=this[_0xe289('0x23')][_0xe289('0xa4')](this,_0xe9ee3e[_0xe289('0x13c')]);if(!_0x3fc40f){return this[_0xe289('0x37')]['error'](_0xe9ee3e,_0xe289('0x13e'));}for(var _0x19174b=0x0;_0x19174b<_0x3fc40f[_0xe289('0x98')];_0x19174b+=0x1){var _0x1e8b82=this[_0xe289('0x37')]['getVariable'](util[_0xe289('0x29')](_0xe289('0x13f'),_0x3fc40f[_0x19174b]));if(_0x1e8b82['result']===-0x1){return _0x1e8b82;}logger['info'](util[_0xe289('0x29')]('IFTIME\x20%s\x20%s',_0x3fc40f[_0x19174b],_0x1e8b82[_0xe289('0x9e')]));if(_0x1e8b82[_0xe289('0x9e')]==='true'){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('IFTIME\x20%s\x20%s',_0x3fc40f[_0x19174b],_0xe289('0x138')));this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')]('IFTIME\x20%s\x20%s',_0x3fc40f[_0x19174b],_0xe289('0x138')));return{'code':0xc8,'result':'true'};}else{logger[_0xe289('0x2f')](util['format'](_0xe289('0x140'),_0x3fc40f[_0x19174b],_0xe289('0x139')));this[_0xe289('0x37')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x3fc40f[_0x19174b],_0xe289('0x139')));}}return{'code':0xc8,'result':_0xe289('0x139')};};AGIVertices[_0xe289('0x16')][_0xe289('0x141')]=function(_0x525dd8){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x525dd8[_0xe289('0x39')]));return this[_0xe289('0x37')][_0xe289('0x141')]();};AGIVertices['prototype'][_0xe289('0x142')]=function(_0x3c86cd){logger[_0xe289('0x2f')](util['format'](_0xe289('0x143'),_0x3c86cd[_0xe289('0x39')]));if(!this['isConfigured'](_0x3c86cd[_0xe289('0x77')])){return this['channel'][_0xe289('0xa7')](_0xe289('0xe1'));}var _0x432486=_0xe289('0x125');var _0x3ac4d4=util[_0xe289('0x29')](_0xe289('0x126'),FILES_PATH,rs[_0xe289('0x112')](0x4));var _0x4ae58b=util[_0xe289('0x29')](_0xe289('0x9b'),_0x3ac4d4,_0x432486);var _0x2d3bb0=!![];if(_0x3c86cd['beep']===_0xe289('0x127')){_0x2d3bb0=![];}var _0x5d3acf=this[_0xe289('0x37')][_0xe289('0x128')](_0x3ac4d4,_0x432486,_0x3c86cd['intKey'],_0x3c86cd[_0xe289('0x65')],undefined,_0x2d3bb0);if(_0x5d3acf[_0xe289('0xa1')]!==-0x1){this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x144'),_0x4ae58b));var _0x347f33=this[_0xe289('0x81')][_0xe289('0xa4')](this,_0x3c86cd,_0x4ae58b);if(_0x347f33){for(var _0x36cb0e in _0x347f33){if(_0x347f33[_0xe289('0x93')](_0x36cb0e)){this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')]('ISPEECH_ASR_%s',_0x36cb0e['toUpperCase']()),_0x347f33[_0x36cb0e]);}}return this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x145'),JSON[_0xe289('0x71')](_0x347f33)));}}return _0x5d3acf;};AGIVertices[_0xe289('0x16')][_0xe289('0x146')]=function(_0x1d9857){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x147'),_0x1d9857[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x1d9857['key'])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x1d9857[_0xe289('0x5c')])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20text\x20configured');}this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x148'),_0x1d9857[_0xe289('0x5c')]));var _0x5c18a7=this['ispeechTTS'][_0xe289('0xa4')](this,_0x1d9857);if(_0x5c18a7){this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x144'),_0x5c18a7));var _0x5620c2=this[_0xe289('0x37')][_0xe289('0xf8')](_0x5c18a7,_0x1d9857[_0xe289('0x12e')]);try{fs['unlink'](_0x5c18a7+_0xe289('0xf9'));}catch(_0x42d38b){logger[_0xe289('0x2d')](_0x42d38b);}return _0x5620c2;}return this[_0xe289('0x37')]['error'](_0x1d9857,_0xe289('0x149'));};AGIVertices[_0xe289('0x16')][_0xe289('0x14a')]=function(_0x22d49f){logger[_0xe289('0x2f')](util['format'](_0xe289('0x14b'),_0x22d49f['label']));if(!this[_0xe289('0x83')](_0x22d49f[_0xe289('0x14c')])){return this['channel'][_0xe289('0x2d')](_0x22d49f,_0xe289('0x14d'));}logger['info'](util[_0xe289('0x29')](_0xe289('0x14e'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x22d49f[_0xe289('0x14c')]));var _0x4b45ee=this['agentLogin'][_0xe289('0xa4')](this,_0x22d49f[_0xe289('0x14c')]);if(_0x4b45ee){logger[_0xe289('0x2f')](util['format'](_0xe289('0x14f'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x22d49f[_0xe289('0x14c')]));this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe289('0x37')][_0xe289('0x3c')],_0x22d49f['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xe289('0x2f')](util['format'](_0xe289('0x150'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x22d49f['findBy']));this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x150'),this['channel'][_0xe289('0x3c')],_0x22d49f[_0xe289('0x14c')]));return{'code':0xc8,'result':_0xe289('0x151')};}};AGIVertices[_0xe289('0x16')]['logout']=function(_0x537081){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x152'),_0x537081['label']));if(!this[_0xe289('0x83')](_0x537081['findBy'])){return this[_0xe289('0x37')]['error'](_0x537081,_0xe289('0x14d'));}logger[_0xe289('0x2f')](util['format'](_0xe289('0x14e'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x537081[_0xe289('0x14c')]));var _0x280ea3=this[_0xe289('0x52')][_0xe289('0xa4')](this,_0x537081[_0xe289('0x14c')]);if(_0x280ea3){logger['info'](util['format'](_0xe289('0x14f'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x537081[_0xe289('0x14c')]));this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x14f'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x537081['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xe289('0x2f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe289('0x37')][_0xe289('0x3c')],_0x537081[_0xe289('0x14c')]));this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x150'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x537081['findBy']));return{'code':0xc8,'result':_0xe289('0x151')};}};AGIVertices[_0xe289('0x16')][_0xe289('0x153')]=function(_0xac151){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0xac151[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0xac151[_0xe289('0x154')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0xac151,_0xe289('0x155'));}this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x156'),_0xac151[_0xe289('0x154')]));var _0x14c71b=eval(_0xac151[_0xe289('0x154')]);if(!this[_0xe289('0x83')](_0xac151[_0xe289('0xd2')])){return this[_0xe289('0x37')]['noop'](_0xe289('0xd3'));}var _0x1ea3cc=this[_0xe289('0x12')][_0xe289('0xa4')](this,_0xac151[_0xe289('0xd2')]);if(!_0x1ea3cc){return this[_0xe289('0x37')][_0xe289('0x2d')](_0xac151,'no\x20variable\x20found');}if(_[_0xe289('0x97')](_0x14c71b)){var _0x31733a=this;_0x14c71b[_0xe289('0xd5')](function(_0x34d629,_0x4db5fc){_0x31733a[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')](_0xe289('0x157'),_0x1ea3cc,_0x4db5fc),_0x34d629);});return this['channel'][_0xe289('0xa7')](util['format'](_0xe289('0x158'),_0x1ea3cc));}else{return this[_0xe289('0x37')]['setVariable'](_0x1ea3cc,_0x14c71b);}};AGIVertices['prototype'][_0xe289('0xd')]=function(_0x5cf548){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x159'),_0x5cf548['label']));if(_0x5cf548[_0xe289('0xa5')]===0x0){return this[_0xe289('0xa3')](_0x5cf548);}_0x5cf548[_0xe289('0xa5')]-=0x1;if(!this[_0xe289('0x83')](_0x5cf548[_0xe289('0x109')])){return this['channel'][_0xe289('0x2d')](_0x5cf548,_0xe289('0x10a'));}var _0x29f7bc=this[_0xe289('0x1e')][_0xe289('0xa4')](this,_0x5cf548[_0xe289('0x109')]);if(!_0x29f7bc){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x5cf548,_0xe289('0x10b'));}var _0xadf18=this[_0xe289('0x37')]['getData'](_0x29f7bc,_0x5cf548[_0xe289('0x10d')],_0x5cf548[_0xe289('0x15a')]);var _0x3a05e3=_0xadf18[_0xe289('0xa1')];if(_0xadf18[_0xe289('0xa1')]===-0x1){this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x5cf548,'-1');return _0xadf18;}else if(_0xadf18['extra']===_0xe289('0x65')){_0xadf18['result']=_0xadf18[_0xe289('0xa1')]['length']>0x0?_0xadf18[_0xe289('0xa1')]:'t';}else if(_[_0xe289('0x46')](_0xadf18['result'])){_0xadf18[_0xe289('0xa1')]='#';_0x3a05e3='#';}if(!this['isConfigured'](_0x5cf548[_0xe289('0xd2')])){this['channel'][_0xe289('0xa7')](_0xe289('0xd3'));}else{var _0x3810fb=this['getVariable'][_0xe289('0xa4')](this,_0x5cf548[_0xe289('0xd2')]);if(!_0x3810fb){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x5cf548,'no\x20variable\x20found');}this[_0xe289('0x37')][_0xe289('0x9c')](_0x3810fb,_0x3a05e3);}this['createSquareDetailsReport'][_0xe289('0xa4')](this,_0x5cf548,_0x3a05e3);return _0xadf18;};AGIVertices[_0xe289('0x16')][_0xe289('0xa7')]=function(_0x2d2b5d){logger['info'](util[_0xe289('0x29')](_0xe289('0x15b'),_0x2d2b5d['label']));return this[_0xe289('0x37')][_0xe289('0xa7')](_0x2d2b5d[_0xe289('0x15c')]||_0x2d2b5d['label']);};AGIVertices[_0xe289('0x16')]['pause']=function(_0x4a7d13){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4a7d13[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x4a7d13[_0xe289('0x14c')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x4a7d13,_0xe289('0x14d'));}logger['info'](util[_0xe289('0x29')](_0xe289('0x14e'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x4a7d13['findBy']));var _0x165452=this[_0xe289('0x15d')][_0xe289('0xa4')](this,_0x4a7d13[_0xe289('0x15e')]);var _0x55f572=this[_0xe289('0x50')][_0xe289('0xa4')](this,_0x4a7d13['findBy'],_0x165452);if(_0x55f572){logger['info'](util[_0xe289('0x29')](_0xe289('0x14f'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x4a7d13[_0xe289('0x14c')]));this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x14f'),this['channel'][_0xe289('0x3c')],_0x4a7d13[_0xe289('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe289('0x2f')](util[_0xe289('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe289('0x37')][_0xe289('0x3c')],_0x4a7d13[_0xe289('0x14c')]));this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x14f'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x4a7d13[_0xe289('0x14c')]));return{'code':0xc8,'result':_0xe289('0x151')};}};AGIVertices[_0xe289('0x16')]['playback']=function(_0x14f809){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x14f809[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x14f809[_0xe289('0x109')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x14f809,'no\x20file\x20audio\x20selected');}var _0x278e70=this[_0xe289('0x1e')][_0xe289('0xa4')](this,_0x14f809[_0xe289('0x109')]);if(!_0x278e70){return this['channel'][_0xe289('0x2d')](_0x14f809,_0xe289('0x10b'));}var _0x35690b=this[_0xe289('0x37')][_0xe289('0x58')](_0xe289('0x15f'),[_0x278e70,_0x14f809[_0xe289('0xdf')]]);if(_0x35690b[_0xe289('0xa1')]===-0x1){return _0x35690b;}return this['channel']['noop'](util[_0xe289('0x29')](_0xe289('0x160'),_0xe289('0x15f'),_0x278e70));};AGIVertices['prototype'][_0xe289('0x161')]=function(_0x16c453){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x16c453[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x16c453[_0xe289('0x162')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x16c453,_0xe289('0x163'));}var _0x54f97b='';var _0x45e87f=parseInt(_0x16c453[_0xe289('0x162')],0xa);if(isNaN(_0x45e87f)){_0x54f97b=_0x16c453[_0xe289('0x162')];}else{_0x54f97b=this[_0xe289('0x17')][_0xe289('0xa4')](this,_0x16c453[_0xe289('0x162')]);if(!_0x54f97b){return this['channel'][_0xe289('0x2d')](_0x16c453,_0xe289('0x164'));}}var _0x1a5522='';if(this[_0xe289('0x83')](_0x16c453[_0xe289('0x109')])){var _0x506e7a=this[_0xe289('0x1e')][_0xe289('0xa4')](this,_0x16c453[_0xe289('0x109')]);if(_0x506e7a){_0x1a5522=_0x506e7a;}}this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x16c453,_0x54f97b);if(_0x16c453[_0xe289('0xdf')][_0xe289('0x165')]('x')<0x0){_0x16c453[_0xe289('0xdf')]+='x';}if(_0x16c453[_0xe289('0xdf')][_0xe289('0x165')]('X')<0x0){_0x16c453['opts']+='X';}this['channel'][_0xe289('0x9c')](_0xe289('0x166'),_0x54f97b?_0x54f97b[_0xe289('0x167')]():'');var _0x1e382e=this[_0xe289('0x37')][_0xe289('0x58')](_0xe289('0x168'),[_0x54f97b,_0x16c453[_0xe289('0xdf')],_0x16c453[_0xe289('0x63')],_0x1a5522,_0x16c453[_0xe289('0x65')],_0x16c453[_0xe289('0x8')],_0x16c453['macro'],_0x16c453[_0xe289('0x169')],'',_0x16c453[_0xe289('0x16a')]]);if(_0x1e382e[_0xe289('0xa1')]===-0x1){return _0x1e382e;}return this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0x160'),_0xe289('0x168'),_0x54f97b));};AGIVertices[_0xe289('0x16')][_0xe289('0x16b')]=function(_0x1108d8){logger['info'](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1108d8['label']));var _0xa9486a=_0x1108d8['recordingFormat']||'wav';var _0x3c5dd9=util[_0xe289('0x29')](_0xe289('0x16c'),this['channel']['uniqueid'],rs[_0xe289('0x112')](0x5));var _0x8ce89c=util[_0xe289('0x29')](_0xe289('0x16d'),FILES_PATH,_0x3c5dd9,_0xa9486a);var _0x5da923=util[_0xe289('0x29')](_0xe289('0x126'),FILES_PATH,_0x3c5dd9);this[_0xe289('0x3d')][_0xe289('0xa4')](this,_0x1108d8,_0x3c5dd9,_0x8ce89c);this[_0xe289('0x37')][_0xe289('0x9c')]('RECORDING_SAVENAME',_0x3c5dd9);logger[_0xe289('0x2f')](_0xe289('0x16e'),_0x5da923,_0xa9486a,_0x1108d8[_0xe289('0x16f')],_0x1108d8['timeout']);return this[_0xe289('0x37')][_0xe289('0x128')](_0x5da923,_0xa9486a,_0x1108d8[_0xe289('0x16f')],_0x1108d8[_0xe289('0x65')],undefined,!![]);};AGIVertices[_0xe289('0x16')]['restapi']=function(_0x1639eb){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1639eb[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x1639eb[_0xe289('0x63')])){return this['channel']['noop'](_0xe289('0x170'));}var _0x18ab88=this[_0xe289('0x171')][_0xe289('0xa4')](this,_0x1639eb);logger[_0xe289('0x2f')](util['format'](_0xe289('0x172'),util[_0xe289('0x173')](_0x18ab88,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1639eb['variable_id'])){return this['channel'][_0xe289('0xa7')](_0xe289('0x174'));}var _0x169d33=this[_0xe289('0x12')][_0xe289('0xa4')](this,_0x1639eb['variable_id']);if(!_0x169d33){return this['channel'][_0xe289('0x2d')](_0x1639eb,_0xe289('0xd4'));}this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')](_0xe289('0x175'),_0x169d33),_0x18ab88[_0xe289('0x72')]?_0x18ab88['statusCode']:'200');this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')](_0xe289('0x176'),_0x169d33),_0x18ab88[_0xe289('0x177')]?_0x18ab88[_0xe289('0x177')]:'OK');if(_0x18ab88[_0xe289('0x69')]){try{this[_0xe289('0x9a')](_0x18ab88[_0xe289('0x69')],_0x169d33);}catch(_0xff0942){logger['error'](util[_0xe289('0x29')](_0xe289('0x178'),_0x169d33));}}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x179'),_0x169d33));};AGIVertices['prototype'][_0xe289('0x17a')]=function(_0xdde782){logger['info'](util[_0xe289('0x29')](_0xe289('0x17b'),_0xdde782['label']));return this[_0xe289('0x37')]['sayDigits'](_0xdde782['digits'][_0xe289('0x5a')](/\s+/g,''),_0xdde782[_0xe289('0x16f')]);};AGIVertices['prototype'][_0xe289('0x17c')]=function(_0x3dc2d2){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x17d'),_0x3dc2d2[_0xe289('0x39')]));return this[_0xe289('0x37')]['sayNumber'](_0x3dc2d2[_0xe289('0x66')][_0xe289('0x5a')](/\s+/g,''),_0x3dc2d2[_0xe289('0x16f')]);};AGIVertices['prototype'][_0xe289('0x17e')]=function(_0x48b132){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x17f'),_0x48b132['label']));return this[_0xe289('0x37')][_0xe289('0x180')](_0x48b132[_0xe289('0x5c')],_0x48b132[_0xe289('0x16f')]);};AGIVertices['prototype'][_0xe289('0x181')]=function(_0x3369ba){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x182'),_0x3369ba['label']));if(!this['isConfigured'](_0x3369ba[_0xe289('0x183')])){return this['channel']['noop'](_0xe289('0x184'));}var _0x3f8f5c=this['getMailAccount'][_0xe289('0xa4')](this,_0x3369ba[_0xe289('0x183')]);if(!_0x3f8f5c||!_0x3f8f5c[_0xe289('0x185')]){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x3369ba,_0xe289('0x186'));}var _0x1f1ff4={'from':util[_0xe289('0x29')]('\x22%s\x22\x20<%s>',_0x3f8f5c[_0xe289('0x14')],_0x3f8f5c[_0xe289('0x187')]||_0x3f8f5c['Smtp'][_0xe289('0x188')]),'to':_0x3369ba['to']||'','cc':_0x3369ba['cc']||'','bcc':_0x3369ba['bcc']||'','subject':_0x3369ba[_0xe289('0x189')],'html':_0x3369ba[_0xe289('0x5c')],'text':_0x3369ba[_0xe289('0x5c')]};var _0x45e8a2={'tls':{'rejectUnauthorized':![]}};if(_0x3f8f5c[_0xe289('0x185')][_0xe289('0x18a')]){_0x45e8a2[_0xe289('0x18a')]=_0x3f8f5c[_0xe289('0x185')][_0xe289('0x18a')];}else{_0x45e8a2[_0xe289('0x18b')]=_0x3f8f5c['Smtp'][_0xe289('0x18b')];_0x45e8a2[_0xe289('0x18c')]=_0x3f8f5c['Smtp'][_0xe289('0x18c')];_0x45e8a2[_0xe289('0x18d')]=_0x3f8f5c[_0xe289('0x185')][_0xe289('0x18d')];}if(_0x3f8f5c[_0xe289('0x185')][_0xe289('0x18e')]){_0x45e8a2[_0xe289('0x18f')]={'user':_0x3f8f5c[_0xe289('0x185')][_0xe289('0x188')],'pass':_0x3f8f5c[_0xe289('0x185')][_0xe289('0x190')]};}if(this[_0xe289('0x83')](_0x3369ba[_0xe289('0x191')])){}logger[_0xe289('0xda')](_0xe289('0x192'),JSON['stringify'](_0x1f1ff4));this[_0xe289('0x36')]['sync'](this,_0x3369ba,_0x3369ba[_0xe289('0x183')]);this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0x193'),_0x3f8f5c[_0xe289('0x14')]));this[_0xe289('0x22')][_0xe289('0xa4')](this,_0x45e8a2,_0x1f1ff4);return this['channel'][_0xe289('0xa7')](_0xe289('0x194'));};AGIVertices['prototype'][_0xe289('0x195')]=function(_0x33712b){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x196'),_0x33712b[_0xe289('0x39')]));return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x197'));};AGIVertices[_0xe289('0x16')]['sendSMS']=function(_0x32a999){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x32a999[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x32a999[_0xe289('0x198')])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20sms\x20account\x20configured');}var _0x45314a=this['getSmsAccount'][_0xe289('0xa4')](this,_0x32a999[_0xe289('0x198')]);if(!_0x45314a){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x32a999,_0xe289('0x199'));}var _0x1c25bf={'body':_0x32a999[_0xe289('0x19a')],'phone':_0x32a999['to']||'','SmsAccountId':_0x45314a['id']};logger[_0xe289('0xda')](_0xe289('0x19b'),JSON['stringify'](_0x1c25bf));this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x32a999,_0x32a999[_0xe289('0x198')]);this[_0xe289('0x37')]['noop'](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x45314a[_0xe289('0x14')]));this[_0xe289('0x19c')][_0xe289('0xa4')](this,_0x1c25bf);return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x19d'));};AGIVertices['prototype'][_0xe289('0x19e')]=function(_0x6dadab){logger['info'](util[_0xe289('0x29')](_0xe289('0x19f'),_0x6dadab[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x6dadab[_0xe289('0xd2')])){return this[_0xe289('0x37')]['error'](_0x6dadab,_0xe289('0x1a0'));}var _0x28e084=this[_0xe289('0x12')][_0xe289('0xa4')](this,_0x6dadab[_0xe289('0xd2')]);if(!_0x28e084){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x6dadab,_0xe289('0xd4'));}return this[_0xe289('0x37')][_0xe289('0x9c')](_0x28e084,_0x6dadab['variable_value']);};AGIVertices[_0xe289('0x16')][_0xe289('0x1a1')]=function(_0xd3d408){logger['info'](util[_0xe289('0x29')](_0xe289('0x1a2'),_0xd3d408[_0xe289('0x39')]));this[_0xe289('0x37')][_0xe289('0xa7')]('START\x20CALLY\x20SQUARE');if(_0xd3d408[_0xe289('0xb8')]===_0xe289('0x1a3')){this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x1a4'));return this[_0xe289('0x37')][_0xe289('0xb8')]();}return this[_0xe289('0x37')][_0xe289('0xa7')]('Skipped\x20Answer');};AGIVertices[_0xe289('0x16')][_0xe289('0x1a5')]=function(_0x218b83){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x218b83[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x218b83[_0xe289('0x1a6')])){return this['channel'][_0xe289('0x2d')](_0x218b83,_0xe289('0x1a7'));}var _0x77be02=this[_0xe289('0x1a8')]['sync'](this,_0x218b83['project_id']);if(!this[_0xe289('0x83')](_0x77be02)){return this[_0xe289('0x37')]['error'](_0x218b83,util['format'](_0xe289('0x1a9'),_0x218b83[_0xe289('0x1a6')]));}if(_0x77be02===this[_0xe289('0x37')][_0xe289('0x3b')]){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x218b83,_0xe289('0x1aa'));}this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x218b83,_0x77be02);var _0x5dc587=this['channel'][_0xe289('0x58')]('AGI',util[_0xe289('0x29')](_0xe289('0x1ab'),config[_0xe289('0x8')][_0xe289('0x18b')]||_0xe289('0x1ac'),_0x77be02,this[_0xe289('0x37')][_0xe289('0x3b')]));if(_0x5dc587['result']===-0x1){return _0x5dc587;}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x160'),_0xe289('0x1ad'),_0x77be02));};AGIVertices[_0xe289('0x16')]['system']=function(_0x1621fb){logger[_0xe289('0x2f')](util['format'](_0xe289('0x1ae'),_0x1621fb[_0xe289('0x39')]));var _0x2d5d51=this[_0xe289('0x57')][_0xe289('0xa4')](this,_0x1621fb[_0xe289('0xb6')]);this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x1621fb,_0x1621fb[_0xe289('0xb6')]);if(this[_0xe289('0x83')](_0x1621fb[_0xe289('0xd2')])){var _0x5a0862=this[_0xe289('0x12')][_0xe289('0xa4')](this,_0x1621fb[_0xe289('0xd2')]);if(_0x5a0862){this[_0xe289('0x37')][_0xe289('0x9c')](_0x5a0862,_0x2d5d51);return this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x1af'),_0x1621fb[_0xe289('0xb6')],_0x5a0862));}}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x1b0'),_0x1621fb['command']));};AGIVertices[_0xe289('0x16')]['google_cloud_tts']=function(_0x4ddab6){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x1b1'),_0x4ddab6[_0xe289('0x39')]));_0x4ddab6[_0xe289('0x5c')]=_0x4ddab6[_0xe289('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4ddab6[_0xe289('0x1b2')])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x1b3'));}if(!this[_0xe289('0x83')](_0x4ddab6[_0xe289('0x5c')])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0xa8'));}this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x1b4'),_0x4ddab6[_0xe289('0x5c')]));var _0x1d8fd8=this[_0xe289('0x5b')][_0xe289('0xa4')](this,_0x4ddab6);if(_0x1d8fd8){this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x1b5'),_0x1d8fd8));var _0x121c21=this[_0xe289('0x37')][_0xe289('0xf8')](_0x1d8fd8);try{fs[_0xe289('0x1b6')](_0x1d8fd8+_0xe289('0xf9'));}catch(_0x3ce53d){logger['error'](_0x3ce53d);}return _0x121c21;}return this[_0xe289('0x37')][_0xe289('0x2d')](_0x4ddab6,_0xe289('0x1b7'));};AGIVertices[_0xe289('0x16')][_0xe289('0x1b8')]=function(_0x5b82e2){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x1b9'),_0x5b82e2[_0xe289('0x39')]));_0x5b82e2[_0xe289('0x5c')]=_0x5b82e2[_0xe289('0x5c')][_0xe289('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe289('0x83')](_0x5b82e2[_0xe289('0x5c')])){return this[_0xe289('0x37')]['noop'](_0xe289('0xa8'));}this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x1ba'),_0x5b82e2[_0xe289('0x5c')]));var _0x490199=this[_0xe289('0x1bb')]['sync'](this,_0x5b82e2);if(_0x490199){this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x1bc'),_0x490199));var _0x36ba9b=this['channel'][_0xe289('0xf8')](_0x490199);try{fs['unlink'](_0x490199+_0xe289('0xf9'));}catch(_0x2adf1a){logger[_0xe289('0x2d')](_0x2adf1a);}return _0x36ba9b;}return this[_0xe289('0x37')][_0xe289('0x2d')](_0x5b82e2,_0xe289('0x1bd'));};AGIVertices['prototype'][_0xe289('0x1be')]=function(_0x1f3209){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1f3209[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x1f3209['findBy'])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x1f3209,_0xe289('0x14d'));}logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x14e'),this['channel']['callerid'],_0x1f3209[_0xe289('0x14c')]));var _0x586185=this[_0xe289('0x51')][_0xe289('0xa4')](this,_0x1f3209[_0xe289('0x14c')]);if(_0x586185){logger['info'](util[_0xe289('0x29')](_0xe289('0x14f'),this['channel']['callerid'],_0x1f3209[_0xe289('0x14c')]));this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x14f'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x1f3209[_0xe289('0x14c')]));return{'code':0xc8,'result':_0xe289('0x1bf')};}else{logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x150'),this[_0xe289('0x37')]['callerid'],_0x1f3209[_0xe289('0x14c')]));this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x150'),this[_0xe289('0x37')]['callerid'],_0x1f3209[_0xe289('0x14c')]));return{'code':0xc8,'result':_0xe289('0x151')};}};AGIVertices[_0xe289('0x16')]['voicemail']=function(_0x283fb5){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x1c0'),_0x283fb5[_0xe289('0x39')]));var _0x3fee81=this[_0xe289('0x37')][_0xe289('0x58')](_0xe289('0x1c1'),[_0x283fb5[_0xe289('0x1c2')],_0x283fb5[_0xe289('0x75')]]);if(_0x3fee81['result']===-0x1){return _0x3fee81;}return this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x160'),_0xe289('0x1c1'),_0x283fb5['mailbox']));};AGIVertices[_0xe289('0x16')][_0xe289('0x1c3')]=function(_0x2b9b4a){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2b9b4a[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x2b9b4a[_0xe289('0xd2')])){return this['channel'][_0xe289('0x2d')](_0x2b9b4a,'no\x20variable\x20selected');}var _0x35d246=this['getVariable'][_0xe289('0xa4')](this,_0x2b9b4a[_0xe289('0xd2')]);if(!_0x35d246){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x2b9b4a,_0xe289('0xd4'));}var _0x192b5d=this[_0xe289('0x37')][_0xe289('0x12')](_0x35d246);return{'code':0xc8,'result':_0x192b5d[_0xe289('0x9e')]?_0x192b5d[_0xe289('0x9e')]:'-'};};String['prototype'][_0xe289('0x1c4')]=function(_0x34b72e,_0x2e7121){return this[_0xe289('0x9d')](_0x34b72e)['join'](_0x2e7121);};module[_0xe289('0x1c5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c336cb4..777e6a9 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 _0x0a9a=['acw','../rpc/user','voiceQueues','agents','timers','agentconnect','bind','hanguprequest','syncHangupRequest','syncHangup','attendedtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','../ami','../../../config/logger'];(function(_0x5b2a0e,_0x52138d){var _0x101d74=function(_0x1ad662){while(--_0x1ad662){_0x5b2a0e['push'](_0x5b2a0e['shift']());}};_0x101d74(++_0x52138d);}(_0x0a9a,0x183));var _0xa0a9=function(_0x3a6bbc,_0x53a938){_0x3a6bbc=_0x3a6bbc-0x0;var _0x48ab76=_0x0a9a[_0x3a6bbc];return _0x48ab76;};'use strict';var util=require('util');var _=require(_0xa0a9('0x0'));var moment=require('moment');var ami=require(_0xa0a9('0x1'));var logger=require(_0xa0a9('0x2'))(_0xa0a9('0x3'));var RpcUser=require(_0xa0a9('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x317a94){this[_0xa0a9('0x5')]=_0x317a94['voiceQueues'];this[_0xa0a9('0x6')]=_0x317a94[_0xa0a9('0x6')];this[_0xa0a9('0x7')]=_0x317a94[_0xa0a9('0x7')];this['channels']={};ami['on'](_0xa0a9('0x8'),this['syncAgentConnect'][_0xa0a9('0x9')](this));ami['on'](_0xa0a9('0xa'),this[_0xa0a9('0xb')][_0xa0a9('0x9')](this));ami['on']('hangup',this[_0xa0a9('0xc')][_0xa0a9('0x9')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xa0a9('0x9')](this));ami['on'](_0xa0a9('0xd'),this['syncAttendedTransfer'][_0xa0a9('0x9')](this));ami['on']('blindtransfer',this[_0xa0a9('0xe')]['bind'](this));ami['on'](_0xa0a9('0xf'),this[_0xa0a9('0x10')][_0xa0a9('0x9')](this));}function getDiff(_0x35e7cd){var _0x13833c=moment()['milliseconds'](0x0);var _0x1f3f23=moment(_0x35e7cd)[_0xa0a9('0x11')](0x0);return _0x13833c[_0xa0a9('0x12')](_0x1f3f23,_0xa0a9('0x13'));}Acw[_0xa0a9('0x14')][_0xa0a9('0x15')]=function(_0x5a6693){try{var _0x176faa=this;var _0x48c315=this['channels'][_0x5a6693][_0xa0a9('0x16')];var _0x9f5abd=this[_0xa0a9('0x17')][_0x5a6693][_0xa0a9('0x18')];var _0x568409=this[_0xa0a9('0x5')][_0x9f5abd];var _0x126401=![];var _0x33eb8f=_0xa0a9('0x19');if(_0x568409[_0xa0a9('0x1a')]){if(_0x568409[_0xa0a9('0x1b')]['name']){_0x126401=!![];_0x33eb8f=_0x568409[_0xa0a9('0x1b')][_0xa0a9('0x1c')];}}ami['Action']({'action':'QueuePause','interface':_0x48c315,'paused':!![],'reason':_0x33eb8f})[_0xa0a9('0x1d')](function(_0x1f6955){if(_0x176faa[_0xa0a9('0x6')][_0x48c315]){return RpcUser['getAgent'](_0x176faa[_0xa0a9('0x6')][_0x48c315]['id'])['then'](function(_0x1fb36b){if(_0x1fb36b&&!_0x1fb36b['voicePause']){logger[_0xa0a9('0x1e')](_0xa0a9('0x1f'),_0x5a6693,_0x48c315,_0x9f5abd);var _0x2f0b14=_0x176faa[_0xa0a9('0x17')][_0x5a6693]['attended']&&_0x176faa[_0xa0a9('0x17')][_0x5a6693]['destlinkedid']?_0x176faa[_0xa0a9('0x17')][_0x5a6693][_0xa0a9('0x20')]:_0x5a6693;return RpcUser[_0xa0a9('0x21')](_0x176faa[_0xa0a9('0x6')][_0x48c315],_0x33eb8f,_0x2f0b14)['then'](function(_0x7c1502){if(!_0x126401){_0x176faa[_0xa0a9('0x7')][_0x48c315]={};logger[_0xa0a9('0x1e')](_0xa0a9('0x22'),_0x5a6693,_0x176faa['voiceQueues'][_0x9f5abd][_0xa0a9('0x23')],_0x48c315,_0x9f5abd);_0x176faa[_0xa0a9('0x7')][_0x48c315][_0xa0a9('0x24')]=setTimeout(_0x176faa['stopAcw']['bind'](_0x176faa,_0x48c315),_0x176faa[_0xa0a9('0x5')][_0x9f5abd][_0xa0a9('0x23')]*0x3e8);_0x176faa[_0xa0a9('0x7')][_0x48c315][_0xa0a9('0x25')]=moment()[_0xa0a9('0x26')](_0xa0a9('0x27'));_0x176faa[_0xa0a9('0x7')][_0x48c315][_0xa0a9('0x28')]=_0x5a6693;_0x176faa[_0xa0a9('0x7')][_0x48c315][_0xa0a9('0x18')]=_0x9f5abd;_0x176faa[_0xa0a9('0x7')][_0x48c315]['updateAcw']=function(){var _0x1f6178=getDiff(_0x176faa[_0xa0a9('0x7')][_0x48c315]['lastPauseAt']);clearTimeout(_0x176faa[_0xa0a9('0x7')][_0x48c315][_0xa0a9('0x24')]);_0x176faa['timers'][_0x48c315]['timer']=![];RpcVoiceAgentReport[_0xa0a9('0x29')]({'acwtime':_0x1f6178},_0x176faa['timers'][_0x48c315]['uniqueid'],_0x48c315)[_0xa0a9('0x1d')](function(_0x104936){logger[_0xa0a9('0x1e')](_0xa0a9('0x2a'),_0x5a6693,_0x1f6178,_0x104936);})[_0xa0a9('0x2b')](function(_0x12bdcc){logger[_0xa0a9('0x2c')]('[%s][UPDATE][ERRORS:%s]',_0x5a6693,_0x12bdcc);});delete _0x176faa[_0xa0a9('0x7')][_0x48c315];};}});}else{logger[_0xa0a9('0x1e')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x5a6693,_0x48c315,_0x9f5abd);}});}})[_0xa0a9('0x2b')](function(_0x2f98f6){logger[_0xa0a9('0x2c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5a6693,_0x176faa['voiceQueues'][_0x9f5abd][_0xa0a9('0x23')],_0x48c315,_0x9f5abd);})[_0xa0a9('0x2d')](function(){delete _0x176faa[_0xa0a9('0x17')][_0x5a6693];});}catch(_0x42fd7a){logger['error'](_0xa0a9('0x2e'),_0x42fd7a[_0xa0a9('0x2f')]);}};Acw[_0xa0a9('0x14')]['stopAcw']=function(_0x2a4587){try{var _0x3c74ea=this;if(_0x3c74ea[_0xa0a9('0x7')][_0x2a4587]){_0x3c74ea['timers'][_0x2a4587][_0xa0a9('0x24')]=![];var _0x2ed673=_0x3c74ea[_0xa0a9('0x7')][_0x2a4587][_0xa0a9('0x28')];var _0x2e11dc=_0x3c74ea[_0xa0a9('0x7')][_0x2a4587][_0xa0a9('0x18')];var _0xcf2461=_0x3c74ea[_0xa0a9('0x5')][_0x2e11dc][_0xa0a9('0x23')];logger[_0xa0a9('0x1e')](_0xa0a9('0x30'),_0x2a4587);RpcUser[_0xa0a9('0x31')](this[_0xa0a9('0x6')][_0x2a4587]);RpcVoiceAgentReport[_0xa0a9('0x29')]({'acwtime':_0xcf2461,'agentacw':!![]},_0x2ed673,_0x2a4587)[_0xa0a9('0x1d')](function(_0x868447){logger['info'](_0xa0a9('0x2a'),_0x2ed673,_0xcf2461,_0x868447);})[_0xa0a9('0x2b')](function(_0x3d3769){logger['error'](_0xa0a9('0x32'),_0x2ed673,_0x3d3769);});}else{logger[_0xa0a9('0x2c')](_0xa0a9('0x33'),_0x2a4587);if(_0x3c74ea[_0xa0a9('0x7')]){logger['info'](_0xa0a9('0x34'),JSON[_0xa0a9('0x35')](_0x3c74ea[_0xa0a9('0x7')]));}}}catch(_0x17c40b){logger[_0xa0a9('0x2c')]('[ACW][STOP]\x20%s',_0x17c40b[_0xa0a9('0x2f')]);}};Acw[_0xa0a9('0x14')][_0xa0a9('0x36')]=function(_0x32d926){try{if(this[_0xa0a9('0x5')][_0x32d926['queue']]&&(this[_0xa0a9('0x5')][_0x32d926[_0xa0a9('0x18')]][_0xa0a9('0x3')]||this[_0xa0a9('0x5')][_0x32d926[_0xa0a9('0x18')]]['mandatoryDisposition'])){if(this[_0xa0a9('0x6')][_0x32d926[_0xa0a9('0x16')]]){this['channels'][_0x32d926['uniqueid']]={'queue':_0x32d926[_0xa0a9('0x18')],'interface':_0x32d926[_0xa0a9('0x16')],'destlinkedid':_0x32d926[_0xa0a9('0x20')]};}}}catch(_0x1db92b){logger['error'](_0xa0a9('0x37'),_0x1db92b[_0xa0a9('0x2f')]);}};Acw[_0xa0a9('0x14')][_0xa0a9('0x10')]=function(_0x3e1d61){try{if(this[_0xa0a9('0x5')][_0x3e1d61[_0xa0a9('0x18')]]&&(this[_0xa0a9('0x5')][_0x3e1d61[_0xa0a9('0x18')]][_0xa0a9('0x3')]||this[_0xa0a9('0x5')][_0x3e1d61[_0xa0a9('0x18')]][_0xa0a9('0x1a')])){if(this[_0xa0a9('0x6')][_0x3e1d61[_0xa0a9('0x16')]]){this[_0xa0a9('0x17')][_0x3e1d61[_0xa0a9('0x28')]]={'queue':_0x3e1d61['queue'],'interface':_0x3e1d61[_0xa0a9('0x16')]};}}}catch(_0x4906c6){logger[_0xa0a9('0x2c')](_0xa0a9('0x38'),_0x4906c6[_0xa0a9('0x2f')]);}};Acw[_0xa0a9('0x14')][_0xa0a9('0xb')]=function(_0x1bf5c8){try{if(this[_0xa0a9('0x17')][_0x1bf5c8[_0xa0a9('0x28')]]&&_[_0xa0a9('0x39')](this['channels'][_0x1bf5c8[_0xa0a9('0x28')]][_0xa0a9('0x3a')])){logger[_0xa0a9('0x1e')]('[%s][HANGUP:UNIQUEID]',_0x1bf5c8[_0xa0a9('0x28')]);this[_0xa0a9('0x15')](_0x1bf5c8[_0xa0a9('0x28')]);}else if(this['channels'][_0x1bf5c8[_0xa0a9('0x3b')]]&&_[_0xa0a9('0x39')](this[_0xa0a9('0x17')][_0x1bf5c8[_0xa0a9('0x3b')]]['attended'])){logger[_0xa0a9('0x1e')](_0xa0a9('0x3c'),_0x1bf5c8[_0xa0a9('0x3b')]);this[_0xa0a9('0x15')](_0x1bf5c8[_0xa0a9('0x3b')]);}}catch(_0x41128b){logger[_0xa0a9('0x2c')]('[ACW][syncHangupRequest]\x20%s',_0x41128b[_0xa0a9('0x2f')]);}};Acw[_0xa0a9('0x14')]['syncHangup']=function(_0x2cbd5e){try{if(this[_0xa0a9('0x17')][_0x2cbd5e[_0xa0a9('0x28')]]&&this['channels'][_0x2cbd5e['uniqueid']][_0xa0a9('0x3a')]){logger[_0xa0a9('0x1e')](_0xa0a9('0x3d'),_0x2cbd5e[_0xa0a9('0x28')]);this['startAcw'](_0x2cbd5e['uniqueid']);}else if(this[_0xa0a9('0x17')][_0x2cbd5e[_0xa0a9('0x3b')]]&&this['channels'][_0x2cbd5e['linkedid']][_0xa0a9('0x3a')]){logger[_0xa0a9('0x1e')](_0xa0a9('0x3e'),_0x2cbd5e[_0xa0a9('0x3b')]);this[_0xa0a9('0x15')](_0x2cbd5e[_0xa0a9('0x3b')]);}}catch(_0x24af09){logger[_0xa0a9('0x2c')](_0xa0a9('0x3f'),_0x24af09[_0xa0a9('0x2f')]);}};Acw[_0xa0a9('0x14')]['syncAttendedTransfer']=function(_0x39070f){try{if(!_[_0xa0a9('0x40')](this[_0xa0a9('0x17')][_0x39070f['transfereeuniqueid']])){this[_0xa0a9('0x15')](_0x39070f[_0xa0a9('0x41')]);if(this[_0xa0a9('0x17')][_0x39070f['secondtransfereruniqueid']]){this[_0xa0a9('0x17')][_0x39070f[_0xa0a9('0x42')]][_0xa0a9('0x3a')]=!![];this[_0xa0a9('0x17')][_0x39070f[_0xa0a9('0x43')]]=this[_0xa0a9('0x17')][_0x39070f[_0xa0a9('0x42')]];delete this['channels'][_0x39070f[_0xa0a9('0x42')]];}}else if(!_[_0xa0a9('0x40')](this[_0xa0a9('0x17')][_0x39070f[_0xa0a9('0x43')]])){this[_0xa0a9('0x15')](_0x39070f[_0xa0a9('0x43')]);if(this[_0xa0a9('0x17')][_0x39070f['origtransfereruniqueid']]){this['channels'][_0x39070f['origtransfereruniqueid']][_0xa0a9('0x3a')]=!![];this['channels'][_0x39070f[_0xa0a9('0x41')]]=this['channels'][_0x39070f[_0xa0a9('0x44')]];delete this[_0xa0a9('0x17')][_0x39070f[_0xa0a9('0x44')]];}}}catch(_0x2f7ab4){logger[_0xa0a9('0x2c')](_0xa0a9('0x45'),_0x2f7ab4[_0xa0a9('0x2f')]);}};Acw[_0xa0a9('0x14')]['syncBlindTransfer']=function(_0x5968ce){try{if(this[_0xa0a9('0x17')][_0x5968ce['transfereruniqueid']]){logger[_0xa0a9('0x1e')](_0xa0a9('0x46'),JSON[_0xa0a9('0x35')](_0x5968ce['transfereruniqueid']));this[_0xa0a9('0x15')](_0x5968ce['transfereruniqueid']);}else if(this[_0xa0a9('0x17')][_0x5968ce[_0xa0a9('0x47')]]){logger[_0xa0a9('0x1e')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xa0a9('0x35')](_0x5968ce['transfererlinkedid']));this[_0xa0a9('0x15')](_0x5968ce['transfererlinkedid']);}}catch(_0x2f253d){logger['error'](_0xa0a9('0x48'),_0x2f253d[_0xa0a9('0x2f')]);}};Acw[_0xa0a9('0x14')][_0xa0a9('0x49')]=function(_0x9dba0b){try{if(this[_0xa0a9('0x5')][_0x9dba0b['queue']]&&this[_0xa0a9('0x5')][_0x9dba0b[_0xa0a9('0x18')]][_0xa0a9('0x4a')]==='all'){if(this[_0xa0a9('0x6')][_0x9dba0b[_0xa0a9('0x16')]]){logger[_0xa0a9('0x1e')](_0xa0a9('0x4b'),_0x9dba0b[_0xa0a9('0x28')],_0x9dba0b['interface'],_0x9dba0b[_0xa0a9('0x18')]);return RpcUser[_0xa0a9('0x21')](this[_0xa0a9('0x6')][_0x9dba0b[_0xa0a9('0x16')]],_0xa0a9('0x4c'),_0x9dba0b[_0xa0a9('0x28')]);}}}catch(_0x3139b3){logger[_0xa0a9('0x2c')](_0xa0a9('0x4d'),_0x3139b3[_0xa0a9('0x2f')]);}};module['exports']=Acw; \ No newline at end of file +var _0xf3cd=['../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','message','stopAcw','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami'];(function(_0x2af026,_0x1c7509){var _0x274528=function(_0x363d85){while(--_0x363d85){_0x2af026['push'](_0x2af026['shift']());}};_0x274528(++_0x1c7509);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0xf3cd[_0x5a1a51];return _0x47edd7;};'use strict';var util=require(_0xdf3c('0x0'));var _=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var ami=require(_0xdf3c('0x3'));var logger=require(_0xdf3c('0x4'))(_0xdf3c('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xdf3c('0x6'));function Acw(_0x71b446){this[_0xdf3c('0x7')]=_0x71b446['voiceQueues'];this[_0xdf3c('0x8')]=_0x71b446[_0xdf3c('0x8')];this[_0xdf3c('0x9')]=_0x71b446[_0xdf3c('0x9')];this[_0xdf3c('0xa')]={};ami['on'](_0xdf3c('0xb'),this['syncAgentConnect'][_0xdf3c('0xc')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0xd'),this['syncHangup'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0xe'),this[_0xdf3c('0xf')][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x10'),this[_0xdf3c('0x11')][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x12'),this['syncBlindTransfer'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x13'),this[_0xdf3c('0x14')][_0xdf3c('0xc')](this));}function getDiff(_0x59e431){var _0x2ae4ad=moment()[_0xdf3c('0x15')](0x0);var _0x13ea5f=moment(_0x59e431)['milliseconds'](0x0);return _0x2ae4ad[_0xdf3c('0x16')](_0x13ea5f,_0xdf3c('0x17'));}Acw[_0xdf3c('0x18')][_0xdf3c('0x19')]=function(_0x21e587){try{var _0x1a7a5a=this;var _0x305ea5=this[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x1a')];var _0x5d3991=this['channels'][_0x21e587][_0xdf3c('0x1b')];var _0x465e7d=this[_0xdf3c('0x7')][_0x5d3991];var _0x18d4ec=![];var _0x1e2690=_0xdf3c('0x1c');if(_0x465e7d[_0xdf3c('0x1d')]){if(_0x465e7d[_0xdf3c('0x1e')][_0xdf3c('0x1f')]){_0x18d4ec=!![];_0x1e2690=_0x465e7d[_0xdf3c('0x1e')][_0xdf3c('0x1f')];}}ami[_0xdf3c('0x20')]({'action':_0xdf3c('0x21'),'interface':_0x305ea5,'paused':!![],'reason':_0x1e2690})['then'](function(_0x4d620f){if(_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5]){return RpcUser['getAgent'](_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5]['id'])[_0xdf3c('0x22')](function(_0x36552e){if(_0x36552e&&!_0x36552e[_0xdf3c('0x23')]){logger[_0xdf3c('0x24')](_0xdf3c('0x25'),_0x21e587,_0x305ea5,_0x5d3991);var _0x50d8ca=_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x26')]&&_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x27')]?_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x27')]:_0x21e587;return RpcUser[_0xdf3c('0x28')](_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5],_0x1e2690,_0x50d8ca)[_0xdf3c('0x22')](function(_0x1adee4){if(!_0x18d4ec){_0x1a7a5a['timers'][_0x305ea5]={};logger[_0xdf3c('0x24')](_0xdf3c('0x29'),_0x21e587,_0x1a7a5a['voiceQueues'][_0x5d3991][_0xdf3c('0x2a')],_0x305ea5,_0x5d3991);_0x1a7a5a['timers'][_0x305ea5]['timer']=setTimeout(_0x1a7a5a['stopAcw'][_0xdf3c('0xc')](_0x1a7a5a,_0x305ea5),_0x1a7a5a[_0xdf3c('0x7')][_0x5d3991]['acwTimeout']*0x3e8);_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x2b')]=moment()[_0xdf3c('0x2c')](_0xdf3c('0x2d'));_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5]['uniqueid']=_0x21e587;_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x1b')]=_0x5d3991;_0x1a7a5a['timers'][_0x305ea5]['updateAcw']=function(){var _0x1f1d8a=getDiff(_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x2b')]);clearTimeout(_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x2e')]);_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x2e')]=![];RpcVoiceAgentReport[_0xdf3c('0x2f')]({'acwtime':_0x1f1d8a},_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x30')],_0x305ea5)[_0xdf3c('0x22')](function(_0x522e5f){logger[_0xdf3c('0x24')](_0xdf3c('0x31'),_0x21e587,_0x1f1d8a,_0x522e5f);})[_0xdf3c('0x32')](function(_0x2287f){logger['error'](_0xdf3c('0x33'),_0x21e587,_0x2287f);});delete _0x1a7a5a[_0xdf3c('0x9')][_0x305ea5];};}});}else{logger[_0xdf3c('0x24')](_0xdf3c('0x34'),_0x21e587,_0x305ea5,_0x5d3991);}});}})['catch'](function(_0x474564){logger[_0xdf3c('0x35')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x21e587,_0x1a7a5a['voiceQueues'][_0x5d3991][_0xdf3c('0x2a')],_0x305ea5,_0x5d3991);})['finally'](function(){delete _0x1a7a5a[_0xdf3c('0xa')][_0x21e587];});}catch(_0x5e8130){logger['error']('[ACW][START]\x20%s',_0x5e8130[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x37')]=function(_0x29b5b7){try{var _0x54c25f=this;if(_0x54c25f['timers'][_0x29b5b7]){_0x54c25f[_0xdf3c('0x9')][_0x29b5b7]['timer']=![];var _0x46e40f=_0x54c25f[_0xdf3c('0x9')][_0x29b5b7][_0xdf3c('0x30')];var _0xcdd731=_0x54c25f[_0xdf3c('0x9')][_0x29b5b7][_0xdf3c('0x1b')];var _0x1c7335=_0x54c25f[_0xdf3c('0x7')][_0xcdd731][_0xdf3c('0x2a')];logger['info'](_0xdf3c('0x38'),_0x29b5b7);RpcUser['saveUnpause'](this['agents'][_0x29b5b7]);RpcVoiceAgentReport[_0xdf3c('0x2f')]({'acwtime':_0x1c7335,'agentacw':!![]},_0x46e40f,_0x29b5b7)['then'](function(_0xccce51){logger['info'](_0xdf3c('0x31'),_0x46e40f,_0x1c7335,_0xccce51);})[_0xdf3c('0x32')](function(_0x1c6dee){logger[_0xdf3c('0x35')](_0xdf3c('0x33'),_0x46e40f,_0x1c6dee);});}else{logger[_0xdf3c('0x35')](_0xdf3c('0x39'),_0x29b5b7);if(_0x54c25f[_0xdf3c('0x9')]){logger[_0xdf3c('0x24')](_0xdf3c('0x3a'),JSON[_0xdf3c('0x3b')](_0x54c25f[_0xdf3c('0x9')]));}}}catch(_0x57e0ab){logger['error'](_0xdf3c('0x3c'),_0x57e0ab['message']);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x3d')]=function(_0x46194d){try{if(this[_0xdf3c('0x7')][_0x46194d['queue']]&&(this['voiceQueues'][_0x46194d[_0xdf3c('0x1b')]][_0xdf3c('0x5')]||this[_0xdf3c('0x7')][_0x46194d['queue']][_0xdf3c('0x1d')])){if(this[_0xdf3c('0x8')][_0x46194d[_0xdf3c('0x1a')]]){this[_0xdf3c('0xa')][_0x46194d['uniqueid']]={'queue':_0x46194d[_0xdf3c('0x1b')],'interface':_0x46194d[_0xdf3c('0x1a')],'destlinkedid':_0x46194d[_0xdf3c('0x27')]};}}}catch(_0x3f4d7f){logger[_0xdf3c('0x35')]('[ACW][syncAgentConnect]\x20%s',_0x3f4d7f[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x14')]=function(_0x2456cf){try{if(this[_0xdf3c('0x7')][_0x2456cf[_0xdf3c('0x1b')]]&&(this['voiceQueues'][_0x2456cf['queue']][_0xdf3c('0x5')]||this[_0xdf3c('0x7')][_0x2456cf['queue']]['mandatoryDisposition'])){if(this[_0xdf3c('0x8')][_0x2456cf[_0xdf3c('0x1a')]]){this[_0xdf3c('0xa')][_0x2456cf[_0xdf3c('0x30')]]={'queue':_0x2456cf[_0xdf3c('0x1b')],'interface':_0x2456cf[_0xdf3c('0x1a')]};}}}catch(_0x466ea1){logger[_0xdf3c('0x35')](_0xdf3c('0x3e'),_0x466ea1['message']);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x3f')]=function(_0x1c293d){try{if(this[_0xdf3c('0xa')][_0x1c293d[_0xdf3c('0x30')]]&&_[_0xdf3c('0x40')](this[_0xdf3c('0xa')][_0x1c293d['uniqueid']][_0xdf3c('0x26')])){logger['info'](_0xdf3c('0x41'),_0x1c293d['uniqueid']);this[_0xdf3c('0x19')](_0x1c293d[_0xdf3c('0x30')]);}else if(this[_0xdf3c('0xa')][_0x1c293d[_0xdf3c('0x42')]]&&_['isUndefined'](this['channels'][_0x1c293d['linkedid']][_0xdf3c('0x26')])){logger['info'](_0xdf3c('0x43'),_0x1c293d[_0xdf3c('0x42')]);this[_0xdf3c('0x19')](_0x1c293d[_0xdf3c('0x42')]);}}catch(_0x3b17d9){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x3b17d9[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')]['syncHangup']=function(_0x3b215d){try{if(this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x30')]]&&this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x30')]][_0xdf3c('0x26')]){logger[_0xdf3c('0x24')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x3b215d['uniqueid']);this[_0xdf3c('0x19')](_0x3b215d[_0xdf3c('0x30')]);}else if(this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x42')]]&&this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x42')]][_0xdf3c('0x26')]){logger[_0xdf3c('0x24')](_0xdf3c('0x44'),_0x3b215d[_0xdf3c('0x42')]);this[_0xdf3c('0x19')](_0x3b215d['linkedid']);}}catch(_0x1eebcf){logger['error']('[ACW][syncHangup]\x20%s',_0x1eebcf['message']);}};Acw['prototype']['syncAttendedTransfer']=function(_0x1afc6c){try{if(!_[_0xdf3c('0x45')](this['channels'][_0x1afc6c[_0xdf3c('0x46')]])){this[_0xdf3c('0x19')](_0x1afc6c['transfereeuniqueid']);if(this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]]){this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]][_0xdf3c('0x26')]=!![];this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x48')]]=this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]];delete this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]];}}else if(!_['isNil'](this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x48')]])){this[_0xdf3c('0x19')](_0x1afc6c['transfertargetuniqueid']);if(this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x49')]]){this[_0xdf3c('0xa')][_0x1afc6c['origtransfereruniqueid']][_0xdf3c('0x26')]=!![];this[_0xdf3c('0xa')][_0x1afc6c['transfereeuniqueid']]=this[_0xdf3c('0xa')][_0x1afc6c['origtransfereruniqueid']];delete this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x49')]];}}}catch(_0x163adc){logger[_0xdf3c('0x35')](_0xdf3c('0x4a'),_0x163adc[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x4b')]=function(_0x2922d8){try{if(this[_0xdf3c('0xa')][_0x2922d8[_0xdf3c('0x4c')]]){logger[_0xdf3c('0x24')](_0xdf3c('0x4d'),JSON[_0xdf3c('0x3b')](_0x2922d8[_0xdf3c('0x4c')]));this[_0xdf3c('0x19')](_0x2922d8[_0xdf3c('0x4c')]);}else if(this['channels'][_0x2922d8['transfererlinkedid']]){logger[_0xdf3c('0x24')](_0xdf3c('0x4e'),JSON[_0xdf3c('0x3b')](_0x2922d8['transfererlinkedid']));this[_0xdf3c('0x19')](_0x2922d8['transfererlinkedid']);}}catch(_0x574852){logger[_0xdf3c('0x35')](_0xdf3c('0x4f'),_0x574852[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0xf')]=function(_0x9b7034){try{if(this[_0xdf3c('0x7')][_0x9b7034[_0xdf3c('0x1b')]]&&this[_0xdf3c('0x7')][_0x9b7034[_0xdf3c('0x1b')]][_0xdf3c('0x50')]===_0xdf3c('0x51')){if(this[_0xdf3c('0x8')][_0x9b7034['interface']]){logger[_0xdf3c('0x24')](_0xdf3c('0x52'),_0x9b7034[_0xdf3c('0x30')],_0x9b7034[_0xdf3c('0x1a')],_0x9b7034[_0xdf3c('0x1b')]);return RpcUser['savePause'](this[_0xdf3c('0x8')][_0x9b7034[_0xdf3c('0x1a')]],_0xdf3c('0x53'),_0x9b7034[_0xdf3c('0x30')]);}}}catch(_0x1efa9c){logger[_0xdf3c('0x35')](_0xdf3c('0x54'),_0x1efa9c[_0xdf3c('0x36')]);}};module[_0xdf3c('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 060dbac..f485f02 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 _0x2ebc=['catch','log','close','exports','asterisk-manager','moment','lodash','../../config/logger','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then'];(function(_0x1e440c,_0x3b2ca5){var _0x3cfab5=function(_0x905734){while(--_0x905734){_0x1e440c['push'](_0x1e440c['shift']());}};_0x3cfab5(++_0x3b2ca5);}(_0x2ebc,0x11c));var _0xc2eb=function(_0xf8685d,_0x10f4a4){_0xf8685d=_0xf8685d-0x0;var _0x38680a=_0x2ebc[_0xf8685d];return _0x38680a;};'use strict';var Manager=require(_0xc2eb('0x0'));var BPromise=require('bluebird');var moment=require(_0xc2eb('0x1'));var util=require('util');var _=require(_0xc2eb('0x2'));var logger=require(_0xc2eb('0x3'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0xc2eb('0x4')][_0xc2eb('0x5')],config[_0xc2eb('0x4')]['ip'],config[_0xc2eb('0x4')][_0xc2eb('0x6')],config[_0xc2eb('0x4')][_0xc2eb('0x7')],!![]);ami[_0xc2eb('0x8')]();ami[_0xc2eb('0x9')]=BPromise[_0xc2eb('0xa')](ami[_0xc2eb('0xb')]);function error(_0xde1906){logger[_0xc2eb('0xc')](util[_0xc2eb('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xc2eb('0x4')][_0xc2eb('0x6')],config[_0xc2eb('0x4')]['ip'],config[_0xc2eb('0x4')][_0xc2eb('0x5')],util[_0xc2eb('0xe')](_0xde1906,![],null)));}function close(){logger['error'](util[_0xc2eb('0xd')](_0xc2eb('0xf'),config['asterisk'][_0xc2eb('0x6')],config[_0xc2eb('0x4')]['ip'],config['asterisk'][_0xc2eb('0x5')]));}ami[_0xc2eb('0x10')]=function(){return function(){return ami[_0xc2eb('0x9')]({'action':_0xc2eb('0x11')});};};ami[_0xc2eb('0x12')]=function(){return function(){return ami[_0xc2eb('0x9')]({'action':'devicestatelist'});};};ami[_0xc2eb('0x13')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xc2eb('0x14')]=function(){return function(){return ami[_0xc2eb('0x9')]({'action':_0xc2eb('0x15')});};};ami[_0xc2eb('0x16')]=function(){return function(){return ami[_0xc2eb('0x9')]({'action':'coreshowchannels'});};};function connect(_0x56adb3){logger[_0xc2eb('0x17')](util[_0xc2eb('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xc2eb('0x4')][_0xc2eb('0x6')],config['asterisk']['ip'],config[_0xc2eb('0x4')][_0xc2eb('0x5')]));ami['once'](_0xc2eb('0xc'),error);ami[_0xc2eb('0x18')]('close',close);}ami['on']('connect',connect);ami['on'](_0xc2eb('0x19'),function(_0x575835){logger[_0xc2eb('0x17')](util[_0xc2eb('0xd')](_0xc2eb('0x1a'),config['asterisk']['username'],config[_0xc2eb('0x4')]['ip'],config[_0xc2eb('0x4')][_0xc2eb('0x5')],util[_0xc2eb('0xe')](_0x575835,![],null)));});ami['on'](_0xc2eb('0x1b'),function(_0x8885e1){logger[_0xc2eb('0x17')](util[_0xc2eb('0xd')](_0xc2eb('0x1c'),config['asterisk'][_0xc2eb('0x6')],config[_0xc2eb('0x4')]['ip'],config['asterisk'][_0xc2eb('0x5')]));return BPromise[_0xc2eb('0x1d')]()[_0xc2eb('0x1e')](ami['actionSipShowRegistry']())[_0xc2eb('0x1e')](ami[_0xc2eb('0x12')]())[_0xc2eb('0x1e')](ami[_0xc2eb('0x13')]())[_0xc2eb('0x1e')](ami[_0xc2eb('0x14')]())[_0xc2eb('0x1e')](ami['actionCoreShowChannels']())[_0xc2eb('0x1f')](function(_0x27977f){console[_0xc2eb('0x20')](_0x27977f);});});ami[_0xc2eb('0x18')](_0xc2eb('0xc'),error);ami[_0xc2eb('0x18')](_0xc2eb('0x21'),close);module[_0xc2eb('0x22')]=ami; \ No newline at end of file +var _0x5585=['Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionSipShowRegistry','actionQueueSummary','catch','close','moment','util','lodash','../../config/logger','ami','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','info'];(function(_0x713492,_0x33a7fc){var _0x55eab8=function(_0x233a06){while(--_0x233a06){_0x713492['push'](_0x713492['shift']());}};_0x55eab8(++_0x33a7fc);}(_0x5585,0x173));var _0x5558=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5585[_0x13d07a];return _0x5ee0ee;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x5558('0x0'));var util=require(_0x5558('0x1'));var _=require(_0x5558('0x2'));var logger=require(_0x5558('0x3'))(_0x5558('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x5558('0x5')]['port'],config['asterisk']['ip'],config[_0x5558('0x5')][_0x5558('0x6')],config[_0x5558('0x5')][_0x5558('0x7')],!![]);ami[_0x5558('0x8')]();ami[_0x5558('0x9')]=BPromise[_0x5558('0xa')](ami[_0x5558('0xb')]);function error(_0x2a5329){logger[_0x5558('0xc')](util[_0x5558('0xd')](_0x5558('0xe'),config['asterisk']['username'],config[_0x5558('0x5')]['ip'],config[_0x5558('0x5')][_0x5558('0xf')],util[_0x5558('0x10')](_0x2a5329,![],null)));}function close(){logger[_0x5558('0xc')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x5558('0x6')],config['asterisk']['ip'],config[_0x5558('0x5')][_0x5558('0xf')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x5558('0x9')]({'action':_0x5558('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x5558('0x9')]({'action':'devicestatelist'});};};ami[_0x5558('0x12')]=function(){return function(){return ami[_0x5558('0x9')]({'action':_0x5558('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x5558('0x14')]=function(){return function(){return ami[_0x5558('0x9')]({'action':'coreshowchannels'});};};function connect(_0x4077c2){logger['info'](util['format'](_0x5558('0x15'),config[_0x5558('0x5')][_0x5558('0x6')],config['asterisk']['ip'],config[_0x5558('0x5')][_0x5558('0xf')]));ami[_0x5558('0x16')](_0x5558('0xc'),error);ami[_0x5558('0x16')]('close',close);}ami['on']('connect',connect);ami['on'](_0x5558('0x17'),function(_0x201725){logger[_0x5558('0x18')](util[_0x5558('0xd')](_0x5558('0x19'),config[_0x5558('0x5')][_0x5558('0x6')],config[_0x5558('0x5')]['ip'],config[_0x5558('0x5')][_0x5558('0xf')],util[_0x5558('0x10')](_0x201725,![],null)));});ami['on'](_0x5558('0x1a'),function(_0x3f643d){logger['info'](util[_0x5558('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x5558('0x5')][_0x5558('0x6')],config[_0x5558('0x5')]['ip'],config[_0x5558('0x5')][_0x5558('0xf')]));return BPromise[_0x5558('0x1b')]()[_0x5558('0x1c')](ami[_0x5558('0x1d')]())[_0x5558('0x1c')](ami['actionDeviceStateList']())[_0x5558('0x1c')](ami['actionSipPeerStatus']())[_0x5558('0x1c')](ami[_0x5558('0x1e')]())[_0x5558('0x1c')](ami['actionCoreShowChannels']())[_0x5558('0x1f')](function(_0x122447){console['log'](_0x122447);});});ami[_0x5558('0x16')]('error',error);ami['once'](_0x5558('0x20'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index a6a8b05..2cd2225 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 _0xb8cd=['error','catch','memberReport','exports','jayson/promise','bluebird','ami','client','http','Request','request','debug','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb8cd,0x108));var _0xdb8c=function(_0x357500,_0x16ebef){_0x357500=_0x357500-0x0;var _0x5611e0=_0xb8cd[_0x357500];return _0x5611e0;};'use strict';var jayson=require(_0xdb8c('0x0'));var BPromise=require(_0xdb8c('0x1'));var logger=require('../../config/logger')(_0xdb8c('0x2'));var client=jayson[_0xdb8c('0x3')][_0xdb8c('0x4')]({'port':0x2329});client[_0xdb8c('0x5')]=function(_0x4ba0eb,_0x2f6c19){return new BPromise(function(_0x3f9467,_0x44485a){return client[_0xdb8c('0x6')](_0x4ba0eb,_0x2f6c19)['then'](function(_0x387236){logger[_0xdb8c('0x7')](_0xdb8c('0x8'),'memberReport',_0x4ba0eb,_0x2f6c19,_0x387236);if(_0x387236[_0xdb8c('0x9')]){logger[_0xdb8c('0x9')](_0xdb8c('0x8'),'memberReport',_0x4ba0eb,_0x387236[_0xdb8c('0x9')]['message'],_0x2f6c19);return _0x44485a(_0x387236[_0xdb8c('0x9')]['message']);}else{return _0x3f9467(_0x387236['result']);}})[_0xdb8c('0xa')](function(_0x35bfa2){logger['error']('rpc',_0xdb8c('0xb'),_0x4ba0eb,_0x35bfa2,_0x2f6c19);return _0x44485a(_0x35bfa2);});});};module[_0xdb8c('0xc')]=client; \ No newline at end of file +var _0x0305=['http','Request','request','then','debug','memberReport','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','ami','client'];(function(_0x34b51e,_0x1c88fb){var _0x1c3756=function(_0x55a07f){while(--_0x55a07f){_0x34b51e['push'](_0x34b51e['shift']());}};_0x1c3756(++_0x1c88fb);}(_0x0305,0x171));var _0x5030=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0x0305[_0x138d06];return _0x1a01eb;};'use strict';var jayson=require(_0x5030('0x0'));var BPromise=require(_0x5030('0x1'));var logger=require(_0x5030('0x2'))(_0x5030('0x3'));var client=jayson[_0x5030('0x4')][_0x5030('0x5')]({'port':0x2329});client[_0x5030('0x6')]=function(_0x3ec1e0,_0x42f192){return new BPromise(function(_0x527ab4,_0x3e369b){return client[_0x5030('0x7')](_0x3ec1e0,_0x42f192)[_0x5030('0x8')](function(_0x4f359f){logger[_0x5030('0x9')]('rpc',_0x5030('0xa'),_0x3ec1e0,_0x42f192,_0x4f359f);if(_0x4f359f[_0x5030('0xb')]){logger[_0x5030('0xb')](_0x5030('0xc'),'memberReport',_0x3ec1e0,_0x4f359f[_0x5030('0xb')][_0x5030('0xd')],_0x42f192);return _0x3e369b(_0x4f359f[_0x5030('0xb')][_0x5030('0xd')]);}else{return _0x527ab4(_0x4f359f[_0x5030('0xe')]);}})[_0x5030('0xf')](function(_0x1ab29c){logger['error']('rpc',_0x5030('0xa'),_0x3ec1e0,_0x1ab29c,_0x42f192);return _0x3e369b(_0x1ab29c);});});};module[_0x5030('0x10')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 49050cb..07a33ab 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 _0x9861=['prototype','getCaller','format','dialCutDigit','exports','util','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname'];(function(_0x2095fa,_0x271fab){var _0x9db1c1=function(_0x5f282d){while(--_0x5f282d){_0x2095fa['push'](_0x2095fa['shift']());}};_0x9db1c1(++_0x271fab);}(_0x9861,0x176));var _0x1986=function(_0x266391,_0xd18f61){_0x266391=_0x266391-0x0;var _0x25a2c6=_0x9861[_0x266391];return _0x25a2c6;};'use strict';var util=require(_0x1986('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x3989f2,_0x372b6c,_0x240f75){var _0x3ddc92='';if(!_[_0x1986('0x1')](_0x372b6c)&&_0x1986('0x2')===typeof _0x372b6c){_0x3ddc92+=_0x372b6c;}if(!_['isNil'](_0x240f75)&&_0x1986('0x2')===typeof _0x240f75){_0x3ddc92+='\x20'+_0x240f75;}if(_0x3ddc92!==''){return _0x3ddc92;}return _0x3989f2;}function Action(_0x279741,_0x1b56d6,_0x17ccbf){this[_0x1986('0x3')]=_0x279741;this[_0x1986('0x4')]=_0x17ccbf||undefined;this[_0x1986('0x5')]=checkNameSurname(_0x1b56d6[_0x1986('0x6')][_0x1986('0x7')],_0x1b56d6[_0x1986('0x6')]['firstName'],_0x1b56d6[_0x1986('0x6')][_0x1986('0x8')]);this[_0x1986('0x9')]=_0x1b56d6[_0x1986('0x6')]['phone'];this[_0x1986('0xa')]=_0x279741[_0x1986('0x5')];this['active']=_0x1b56d6[_0x1986('0xb')]||![];this['type']=_0x279741['type'];this[_0x1986('0xc')]=_0x279741[_0x1986('0xc')]||0x3;this[_0x1986('0xd')]=_0x1b56d6[_0x1986('0xd')];this[_0x1986('0xe')]=_0x1b56d6[_0x1986('0xe')];this[_0x1986('0xf')]=_0x1b56d6[_0x1986('0xf')];this[_0x1986('0x10')]=_0x1b56d6[_0x1986('0x10')];this['countnosuchnumberretry']=_0x1b56d6['countnosuchnumberretry'];this[_0x1986('0x11')]=_0x1b56d6[_0x1986('0x11')];this['countabandonedretry']=_0x1b56d6[_0x1986('0x12')];this[_0x1986('0x13')]=_0x1b56d6[_0x1986('0x13')];this[_0x1986('0x14')]=_0x1b56d6[_0x1986('0x14')];this[_0x1986('0x15')]=_0x1b56d6[_0x1986('0x15')];this[_0x1986('0x16')]=_0x1b56d6[_0x1986('0x16')];this[_0x1986('0x17')]=_0x1b56d6[_0x1986('0x17')];this[_0x1986('0x18')]=_0x1b56d6[_0x1986('0x18')];this[_0x1986('0x19')]=_0x1b56d6['CampaignId'];this[_0x1986('0x1a')]=_0x1b56d6['id'];this[_0x1986('0x1b')]=_0x1b56d6['Contact'][_0x1986('0x1c')]||'';this[_0x1986('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1986('0x1e')]=_0x1b56d6[_0x1986('0x1e')];this[_0x1986('0x1f')]=_0x1b56d6['callbackuniqueid'];this[_0x1986('0x20')]=_0x1b56d6[_0x1986('0x20')];this[_0x1986('0x21')]=_0x1b56d6['recallme'];this[_0x1986('0x22')]='';this[_0x1986('0x23')]='';}Action[_0x1986('0x24')][_0x1986('0x25')]=function(){return util[_0x1986('0x26')]('\x22%s\x22\x20<%s>',this[_0x1986('0x5')],this['voiceQueue'][_0x1986('0x27')]>0x0?this[_0x1986('0x9')]['substring'](this[_0x1986('0x3')][_0x1986('0x27')]):this[_0x1986('0x9')]);};Action['prototype']['getQueue']=function(){return this[_0x1986('0xa')];};module[_0x1986('0x28')]=Action; \ No newline at end of file +var _0x8093=['\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum'];(function(_0x2e5ed9,_0x1c8dd3){var _0x5d5cdb=function(_0x48bab8){while(--_0x48bab8){_0x2e5ed9['push'](_0x2e5ed9['shift']());}};_0x5d5cdb(++_0x1c8dd3);}(_0x8093,0xa9));var _0x3809=function(_0x71c2ac,_0x32eb1f){_0x71c2ac=_0x71c2ac-0x0;var _0x47582e=_0x8093[_0x71c2ac];return _0x47582e;};'use strict';var util=require(_0x3809('0x0'));var _=require(_0x3809('0x1'));var moment=require(_0x3809('0x2'));function checkNameSurname(_0xdce24e,_0x315a70,_0x2150f9){var _0x50ee50='';if(!_[_0x3809('0x3')](_0x315a70)&&_0x3809('0x4')===typeof _0x315a70){_0x50ee50+=_0x315a70;}if(!_[_0x3809('0x3')](_0x2150f9)&&_0x3809('0x4')===typeof _0x2150f9){_0x50ee50+='\x20'+_0x2150f9;}if(_0x50ee50!==''){return _0x50ee50;}return _0xdce24e;}function Action(_0x349776,_0x17ab0b,_0x29d5dc){this[_0x3809('0x5')]=_0x349776;this[_0x3809('0x6')]=_0x29d5dc||undefined;this[_0x3809('0x7')]=checkNameSurname(_0x17ab0b[_0x3809('0x8')][_0x3809('0x9')],_0x17ab0b['Contact'][_0x3809('0xa')],_0x17ab0b[_0x3809('0x8')][_0x3809('0xb')]);this[_0x3809('0xc')]=_0x17ab0b['Contact']['phone'];this[_0x3809('0xd')]=_0x349776['name'];this[_0x3809('0xe')]=_0x17ab0b['active']||![];this['type']=_0x349776[_0x3809('0xf')];this[_0x3809('0x10')]=_0x349776[_0x3809('0x10')]||0x3;this['scheduledat']=_0x17ab0b[_0x3809('0x11')];this[_0x3809('0x12')]=_0x17ab0b[_0x3809('0x12')];this['countcongestionretry']=_0x17ab0b['countcongestionretry'];this['countnoanswerretry']=_0x17ab0b[_0x3809('0x13')];this[_0x3809('0x14')]=_0x17ab0b[_0x3809('0x14')];this['countdropretry']=_0x17ab0b[_0x3809('0x15')];this['countabandonedretry']=_0x17ab0b[_0x3809('0x16')];this[_0x3809('0x17')]=_0x17ab0b[_0x3809('0x17')];this[_0x3809('0x18')]=_0x17ab0b[_0x3809('0x18')];this[_0x3809('0x19')]=_0x17ab0b['ContactId'];this['ListId']=_0x17ab0b['ListId'];this['UserId']=_0x17ab0b['UserId'];this['VoiceQueueId']=_0x17ab0b['VoiceQueueId'];this[_0x3809('0x1a')]=_0x17ab0b['CampaignId'];this[_0x3809('0x1b')]=_0x17ab0b['id'];this['ContactFirstName']=_0x17ab0b[_0x3809('0x8')][_0x3809('0xa')]||'';this[_0x3809('0x1c')]=moment()[_0x3809('0x1d')](_0x3809('0x1e'));this['callback']=_0x17ab0b[_0x3809('0x1f')];this[_0x3809('0x20')]=_0x17ab0b[_0x3809('0x20')];this[_0x3809('0x21')]=_0x17ab0b[_0x3809('0x21')];this[_0x3809('0x22')]=_0x17ab0b[_0x3809('0x22')];this[_0x3809('0x23')]='';this['originatecalleridname']='';}Action['prototype']['getCaller']=function(){return util[_0x3809('0x1d')](_0x3809('0x24'),this[_0x3809('0x7')],this['voiceQueue'][_0x3809('0x25')]>0x0?this['number'][_0x3809('0x26')](this[_0x3809('0x5')][_0x3809('0x25')]):this[_0x3809('0xc')]);};Action[_0x3809('0x27')]['getQueue']=function(){return this['queue'];};module[_0x3809('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 8be2ad8..b1cef90 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 _0xc3a4=['countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','state','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0xc3a4,0x13c));var _0x4c3a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc3a4[_0xfae23b];return _0x200640;};'use strict';var util=require(_0x4c3a('0x0'));var _=require(_0x4c3a('0x1'));var moment=require('moment');function getSeconds(_0x2d88c2,_0x2fd6f1){var _0x9d18ca=moment(_0x2d88c2)['milliseconds'](0x0);var _0x6c55e6=moment(_0x2fd6f1)[_0x4c3a('0x2')](0x0);return _0x9d18ca[_0x4c3a('0x3')](_0x6c55e6,_0x4c3a('0x4'));}function AgentComplete(_0x3d4409,_0x3a4d50){this[_0x4c3a('0x5')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x3d4409['scheduledat'];this['type']=_0x3d4409[_0x4c3a('0x6')];this['campaigntype']=_0x3d4409[_0x4c3a('0x6')]==='outbound'?_0x4c3a('0x7'):_0x3d4409[_0x4c3a('0x6')];this[_0x4c3a('0x8')]=_0x3d4409[_0x4c3a('0x8')];this['countcongestionretry']=_0x3d4409[_0x4c3a('0x9')];this[_0x4c3a('0xa')]=_0x3d4409[_0x4c3a('0xa')];this[_0x4c3a('0xb')]=_0x3d4409[_0x4c3a('0x8')]+_0x3d4409[_0x4c3a('0x9')]+_0x3d4409['countnoanswerretry']+_0x3d4409['countnosuchnumberretry']+_0x3d4409['countdropretry']+_0x3d4409[_0x4c3a('0xc')]+_0x3d4409[_0x4c3a('0xd')]+_0x3d4409['countagentrejectretry'];this['countnosuchnumberretry']=_0x3d4409['countnosuchnumberretry'];this[_0x4c3a('0xe')]=_0x3d4409['countdropretry'];this['countabandonedretry']=_0x3d4409[_0x4c3a('0xc')];this[_0x4c3a('0xd')]=_0x3d4409[_0x4c3a('0xd')];this[_0x4c3a('0xf')]=_0x3d4409['countagentrejectretry'];this[_0x4c3a('0x10')]=_0x3a4d50[_0x4c3a('0x10')];this[_0x4c3a('0x11')]=_0x3d4409[_0x4c3a('0x12')];this[_0x4c3a('0x13')]=_0x3d4409['number'];this[_0x4c3a('0x14')]=_0x3d4409[_0x4c3a('0x14')];this['responsetime']=_0x3d4409['responsetime'];this[_0x4c3a('0x15')]=_0x3d4409[_0x4c3a('0x15')];this[_0x4c3a('0x16')]=moment()['format'](_0x4c3a('0x17'));this[_0x4c3a('0x18')]=getSeconds(_0x3d4409[_0x4c3a('0x19')],_0x3d4409[_0x4c3a('0x14')]);this[_0x4c3a('0x1a')]=getSeconds(_0x3d4409['answertime'],_0x3d4409[_0x4c3a('0x19')]);this[_0x4c3a('0x1b')]=getSeconds(this[_0x4c3a('0x16')],_0x3d4409['answertime']);this[_0x4c3a('0x7')]=_0x3a4d50[_0x4c3a('0x7')];this[_0x4c3a('0x1c')]=_0x3a4d50[_0x4c3a('0x1c')];this[_0x4c3a('0x1d')]=_0x3a4d50[_0x4c3a('0x1d')];this[_0x4c3a('0x1e')]=_0x3d4409[_0x4c3a('0x1e')];this['callbackuniqueid']=_0x3d4409[_0x4c3a('0x1f')];this[_0x4c3a('0x20')]=_0x3d4409[_0x4c3a('0x20')];this[_0x4c3a('0x21')]=_0x3d4409[_0x4c3a('0x21')];this[_0x4c3a('0x22')]=_0x3d4409[_0x4c3a('0x22')];this[_0x4c3a('0x23')]=_0x3d4409[_0x4c3a('0x23')];this[_0x4c3a('0x24')]=_0x3d4409[_0x4c3a('0x24')];this[_0x4c3a('0x25')]=_0x3d4409[_0x4c3a('0x25')];this['CampaignId']=_0x3d4409['CampaignId'];this[_0x4c3a('0x26')]=_0x3d4409[_0x4c3a('0x26')]||'';this['originatecalleridname']=_0x3d4409[_0x4c3a('0x27')]||'';}module[_0x4c3a('0x28')]=AgentComplete; \ No newline at end of file +var _0x1816=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','state','statedesc','scheduledat','type','campaigntype'];(function(_0x512a0a,_0x1f89e3){var _0x521fdf=function(_0x4d6ed0){while(--_0x4d6ed0){_0x512a0a['push'](_0x512a0a['shift']());}};_0x521fdf(++_0x1f89e3);}(_0x1816,0xb2));var _0x6181=function(_0x205134,_0x902ca4){_0x205134=_0x205134-0x0;var _0x43ed74=_0x1816[_0x205134];return _0x43ed74;};'use strict';var util=require(_0x6181('0x0'));var _=require(_0x6181('0x1'));var moment=require(_0x6181('0x2'));function getSeconds(_0x2e53c2,_0x3cecb5){var _0x2c7fd8=moment(_0x2e53c2)['milliseconds'](0x0);var _0x4be4a5=moment(_0x3cecb5)[_0x6181('0x3')](0x0);return _0x2c7fd8[_0x6181('0x4')](_0x4be4a5,'seconds');}function AgentComplete(_0x4c6d9b,_0x288003){this[_0x6181('0x5')]=0x4;this[_0x6181('0x6')]='Answer';this[_0x6181('0x7')]=_0x4c6d9b['scheduledat'];this[_0x6181('0x8')]=_0x4c6d9b[_0x6181('0x8')];this[_0x6181('0x9')]=_0x4c6d9b[_0x6181('0x8')]==='outbound'?'queue':_0x4c6d9b[_0x6181('0x8')];this['countbusyretry']=_0x4c6d9b[_0x6181('0xa')];this[_0x6181('0xb')]=_0x4c6d9b['countcongestionretry'];this['countnoanswerretry']=_0x4c6d9b[_0x6181('0xc')];this[_0x6181('0xd')]=_0x4c6d9b[_0x6181('0xa')]+_0x4c6d9b[_0x6181('0xb')]+_0x4c6d9b[_0x6181('0xc')]+_0x4c6d9b[_0x6181('0xe')]+_0x4c6d9b[_0x6181('0xf')]+_0x4c6d9b[_0x6181('0x10')]+_0x4c6d9b[_0x6181('0x11')]+_0x4c6d9b[_0x6181('0x12')];this[_0x6181('0xe')]=_0x4c6d9b[_0x6181('0xe')];this[_0x6181('0xf')]=_0x4c6d9b['countdropretry'];this[_0x6181('0x10')]=_0x4c6d9b[_0x6181('0x10')];this[_0x6181('0x11')]=_0x4c6d9b['countmachineretry'];this[_0x6181('0x12')]=_0x4c6d9b[_0x6181('0x12')];this[_0x6181('0x13')]=_0x288003[_0x6181('0x13')];this[_0x6181('0x14')]=_0x4c6d9b[_0x6181('0x15')];this[_0x6181('0x16')]=_0x4c6d9b[_0x6181('0x17')];this[_0x6181('0x18')]=_0x4c6d9b[_0x6181('0x18')];this[_0x6181('0x19')]=_0x4c6d9b['responsetime'];this['answertime']=_0x4c6d9b[_0x6181('0x1a')];this[_0x6181('0x1b')]=moment()[_0x6181('0x1c')](_0x6181('0x1d'));this[_0x6181('0x1e')]=getSeconds(_0x4c6d9b['responsetime'],_0x4c6d9b[_0x6181('0x18')]);this[_0x6181('0x1f')]=getSeconds(_0x4c6d9b['answertime'],_0x4c6d9b[_0x6181('0x19')]);this[_0x6181('0x20')]=getSeconds(this[_0x6181('0x1b')],_0x4c6d9b[_0x6181('0x1a')]);this['queue']=_0x288003[_0x6181('0x21')];this[_0x6181('0x22')]=_0x288003['membername'];this[_0x6181('0x23')]=_0x288003[_0x6181('0x23')];this['callback']=_0x4c6d9b['callback'];this[_0x6181('0x24')]=_0x4c6d9b[_0x6181('0x24')];this[_0x6181('0x25')]=_0x4c6d9b[_0x6181('0x25')];this[_0x6181('0x26')]=_0x4c6d9b['recallme'];this[_0x6181('0x27')]=_0x4c6d9b[_0x6181('0x27')];this[_0x6181('0x28')]=_0x4c6d9b['ListId'];this[_0x6181('0x29')]=_0x4c6d9b[_0x6181('0x29')];this[_0x6181('0x2a')]=_0x4c6d9b['VoiceQueueId'];this[_0x6181('0x2b')]=_0x4c6d9b['CampaignId'];this[_0x6181('0x2c')]=_0x4c6d9b[_0x6181('0x2c')]||'';this[_0x6181('0x2d')]=_0x4c6d9b['originatecalleridname']||'';}module[_0x6181('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 6cd0a94..2a1cc82 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 _0x5eba=['exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5eba,0x1e2));var _0xa5eb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5eba[_0x2dafbe];return _0x58a45a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xa5eb('0x0'));function getSeconds(_0x351c7d,_0x268908){var _0x4cd46e=moment(_0x351c7d)['milliseconds'](0x0);var _0x31b4ac=moment(_0x268908)[_0xa5eb('0x1')](0x0);return _0x4cd46e[_0xa5eb('0x2')](_0x31b4ac,_0xa5eb('0x3'));}function Final(_0x46c2f5){this[_0xa5eb('0x4')]=_0x46c2f5[_0xa5eb('0x4')];this[_0xa5eb('0x5')]=_0x46c2f5[_0xa5eb('0x5')];this[_0xa5eb('0x6')]=_0x46c2f5[_0xa5eb('0x6')];this[_0xa5eb('0x7')]=_0x46c2f5[_0xa5eb('0x6')]==='outbound'?_0xa5eb('0x8'):_0x46c2f5['type'];this[_0xa5eb('0x9')]=_0x46c2f5[_0xa5eb('0x9')];this[_0xa5eb('0xa')]=_0x46c2f5[_0xa5eb('0xa')];this[_0xa5eb('0xb')]=_0x46c2f5['countnoanswerretry'];this[_0xa5eb('0xc')]=_0x46c2f5[_0xa5eb('0x9')]+_0x46c2f5['countcongestionretry']+_0x46c2f5[_0xa5eb('0xb')]+_0x46c2f5[_0xa5eb('0xd')]+_0x46c2f5[_0xa5eb('0xe')]+_0x46c2f5[_0xa5eb('0xf')]+_0x46c2f5[_0xa5eb('0x10')]+_0x46c2f5[_0xa5eb('0x11')];this['countnosuchnumberretry']=_0x46c2f5[_0xa5eb('0xd')];this[_0xa5eb('0xe')]=_0x46c2f5[_0xa5eb('0xe')];this[_0xa5eb('0xf')]=_0x46c2f5[_0xa5eb('0xf')];this[_0xa5eb('0x10')]=_0x46c2f5[_0xa5eb('0x10')];this['countagentrejectretry']=_0x46c2f5['countagentrejectretry'];this[_0xa5eb('0x8')]=_0x46c2f5[_0xa5eb('0x8')];this['calleridname']=_0x46c2f5[_0xa5eb('0x12')];this[_0xa5eb('0x13')]=_0x46c2f5[_0xa5eb('0x13')];this[_0xa5eb('0x14')]=_0x46c2f5[_0xa5eb('0x14')];this[_0xa5eb('0x15')]=_0x46c2f5[_0xa5eb('0x15')];this['endtime']=_0x46c2f5[_0xa5eb('0x15')];this[_0xa5eb('0x16')]=_0x46c2f5[_0xa5eb('0x16')]||0x0;this[_0xa5eb('0x17')]=_0x46c2f5[_0xa5eb('0x17')]||0x0;this['talktime']=_0x46c2f5[_0xa5eb('0x18')]||0x0;this[_0xa5eb('0x19')]=_0x46c2f5[_0xa5eb('0x19')];this[_0xa5eb('0x1a')]=_0x46c2f5[_0xa5eb('0x1a')];this[_0xa5eb('0x1b')]=_0x46c2f5[_0xa5eb('0x1b')];this['recallme']=_0x46c2f5[_0xa5eb('0x1c')];this[_0xa5eb('0x1d')]=_0x46c2f5[_0xa5eb('0x1d')];this[_0xa5eb('0x1e')]=_0x46c2f5['ListId'];this['UserId']=_0x46c2f5[_0xa5eb('0x1f')];this[_0xa5eb('0x20')]=_0x46c2f5[_0xa5eb('0x20')];this[_0xa5eb('0x21')]=_0x46c2f5[_0xa5eb('0x21')];this[_0xa5eb('0x22')]=_0x46c2f5[_0xa5eb('0x22')]||'';this[_0xa5eb('0x23')]=_0x46c2f5[_0xa5eb('0x23')]||'';}module[_0xa5eb('0x24')]=Final; \ No newline at end of file +var _0xed5a=['CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x53b165,_0x2ab643){var _0x5c416e=function(_0x702bfa){while(--_0x702bfa){_0x53b165['push'](_0x53b165['shift']());}};_0x5c416e(++_0x2ab643);}(_0xed5a,0xed));var _0xaed5=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0xed5a[_0x2e8418];return _0x548fe6;};'use strict';var util=require(_0xaed5('0x0'));var _=require(_0xaed5('0x1'));var moment=require(_0xaed5('0x2'));function getSeconds(_0x50c9dd,_0x97fd83){var _0x1bb6ea=moment(_0x50c9dd)[_0xaed5('0x3')](0x0);var _0x396006=moment(_0x97fd83)[_0xaed5('0x3')](0x0);return _0x1bb6ea[_0xaed5('0x4')](_0x396006,_0xaed5('0x5'));}function Final(_0x57dd57){this[_0xaed5('0x6')]=_0x57dd57[_0xaed5('0x6')];this[_0xaed5('0x7')]=_0x57dd57[_0xaed5('0x7')];this[_0xaed5('0x8')]=_0x57dd57[_0xaed5('0x8')];this[_0xaed5('0x9')]=_0x57dd57['type']===_0xaed5('0xa')?_0xaed5('0xb'):_0x57dd57[_0xaed5('0x8')];this[_0xaed5('0xc')]=_0x57dd57[_0xaed5('0xc')];this['countcongestionretry']=_0x57dd57['countcongestionretry'];this[_0xaed5('0xd')]=_0x57dd57[_0xaed5('0xd')];this['countglobal']=_0x57dd57['countbusyretry']+_0x57dd57[_0xaed5('0xe')]+_0x57dd57[_0xaed5('0xd')]+_0x57dd57[_0xaed5('0xf')]+_0x57dd57[_0xaed5('0x10')]+_0x57dd57['countabandonedretry']+_0x57dd57['countmachineretry']+_0x57dd57[_0xaed5('0x11')];this[_0xaed5('0xf')]=_0x57dd57[_0xaed5('0xf')];this['countdropretry']=_0x57dd57['countdropretry'];this['countabandonedretry']=_0x57dd57[_0xaed5('0x12')];this[_0xaed5('0x13')]=_0x57dd57['countmachineretry'];this['countagentrejectretry']=_0x57dd57[_0xaed5('0x11')];this[_0xaed5('0xb')]=_0x57dd57[_0xaed5('0xb')];this[_0xaed5('0x14')]=_0x57dd57[_0xaed5('0x14')];this['calleridnum']=_0x57dd57[_0xaed5('0x15')];this[_0xaed5('0x16')]=_0x57dd57[_0xaed5('0x16')];this[_0xaed5('0x17')]=_0x57dd57[_0xaed5('0x17')];this[_0xaed5('0x18')]=_0x57dd57['responsetime'];this[_0xaed5('0x19')]=_0x57dd57['ringtime']||0x0;this[_0xaed5('0x1a')]=_0x57dd57[_0xaed5('0x1a')]||0x0;this[_0xaed5('0x1b')]=_0x57dd57[_0xaed5('0x1b')]||0x0;this[_0xaed5('0x1c')]=_0x57dd57[_0xaed5('0x1c')];this[_0xaed5('0x1d')]=_0x57dd57['callbackuniqueid'];this[_0xaed5('0x1e')]=_0x57dd57[_0xaed5('0x1e')];this[_0xaed5('0x1f')]=_0x57dd57[_0xaed5('0x1f')];this[_0xaed5('0x20')]=_0x57dd57[_0xaed5('0x20')];this[_0xaed5('0x21')]=_0x57dd57[_0xaed5('0x21')];this[_0xaed5('0x22')]=_0x57dd57[_0xaed5('0x22')];this[_0xaed5('0x23')]=_0x57dd57[_0xaed5('0x23')];this[_0xaed5('0x24')]=_0x57dd57['CampaignId'];this[_0xaed5('0x25')]=_0x57dd57[_0xaed5('0x25')]||'';this['originatecalleridname']=_0x57dd57[_0xaed5('0x26')]||'';}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 6e8103d..635a54d 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 _0x6ed8=['countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','IVR','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x230770,_0x215f3a){var _0x2fefee=function(_0x3bc509){while(--_0x3bc509){_0x230770['push'](_0x230770['shift']());}};_0x2fefee(++_0x215f3a);}(_0x6ed8,0x171));var _0x86ed=function(_0x1b4e2e,_0x3cfa9d){_0x1b4e2e=_0x1b4e2e-0x0;var _0x35be71=_0x6ed8[_0x1b4e2e];return _0x35be71;};'use strict';var util=require(_0x86ed('0x0'));var _=require(_0x86ed('0x1'));var moment=require('moment');function getSeconds(_0x5c388a,_0x3c9cfa){var _0x356f24=moment(_0x5c388a)['milliseconds'](0x0);var _0x3316d2=moment(_0x3c9cfa)[_0x86ed('0x2')](0x0);return _0x356f24[_0x86ed('0x3')](_0x3316d2,_0x86ed('0x4'));}function Hangup(_0x2c730a,_0x4a576b){this[_0x86ed('0x5')]=0x4;this[_0x86ed('0x6')]='Answer';this[_0x86ed('0x7')]=_0x2c730a[_0x86ed('0x7')];this['type']=_0x2c730a[_0x86ed('0x8')];this[_0x86ed('0x9')]=_0x2c730a[_0x86ed('0x8')]===_0x86ed('0xa')?_0x86ed('0xb'):_0x2c730a[_0x86ed('0x8')];this[_0x86ed('0xc')]=_0x2c730a[_0x86ed('0xc')];this[_0x86ed('0xd')]=_0x2c730a[_0x86ed('0xd')];this[_0x86ed('0xe')]=_0x2c730a[_0x86ed('0xe')];this['countglobal']=_0x2c730a[_0x86ed('0xc')]+_0x2c730a[_0x86ed('0xd')]+_0x2c730a[_0x86ed('0xe')]+_0x2c730a['countnosuchnumberretry']+_0x2c730a[_0x86ed('0xf')]+_0x2c730a[_0x86ed('0x10')]+_0x2c730a[_0x86ed('0x11')]+_0x2c730a[_0x86ed('0x12')];this[_0x86ed('0x13')]=_0x2c730a[_0x86ed('0x13')];this[_0x86ed('0xf')]=_0x2c730a[_0x86ed('0xf')];this['countabandonedretry']=_0x2c730a[_0x86ed('0x10')];this[_0x86ed('0x11')]=_0x2c730a[_0x86ed('0x11')];this[_0x86ed('0x12')]=_0x2c730a[_0x86ed('0x12')];this[_0x86ed('0x14')]=_0x4a576b[_0x86ed('0x14')];this[_0x86ed('0x15')]=_0x2c730a[_0x86ed('0x16')];this[_0x86ed('0x17')]=_0x2c730a['number'];this[_0x86ed('0x18')]=_0x2c730a['starttime'];this['responsetime']=_0x2c730a['responsetime'];this[_0x86ed('0x19')]=moment()[_0x86ed('0x1a')](_0x86ed('0x1b'));this[_0x86ed('0x1c')]=getSeconds(_0x2c730a[_0x86ed('0x1d')],_0x2c730a['starttime']);this[_0x86ed('0x1e')]=0x0;this[_0x86ed('0x1f')]=getSeconds(this[_0x86ed('0x19')],_0x2c730a['responsetime']);this['queue']=_0x2c730a['queue'];this['membername']=_0x86ed('0x20');this[_0x86ed('0x21')]=_0x4a576b['cause-txt'];this['callback']=_0x2c730a['callback'];this[_0x86ed('0x22')]=_0x2c730a[_0x86ed('0x22')];this[_0x86ed('0x23')]=_0x2c730a[_0x86ed('0x23')];this[_0x86ed('0x24')]=_0x2c730a[_0x86ed('0x24')];this[_0x86ed('0x25')]=_0x2c730a['ContactId'];this['ListId']=_0x2c730a[_0x86ed('0x26')];this['UserId']=_0x2c730a[_0x86ed('0x27')];this['VoiceQueueId']=_0x2c730a[_0x86ed('0x28')];this['CampaignId']=_0x2c730a[_0x86ed('0x29')];}module[_0x86ed('0x2a')]=Hangup; \ No newline at end of file +var _0xa6e8=['exports','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId'];(function(_0x3fc09b,_0x5ddd34){var _0x2d8977=function(_0xa9246c){while(--_0xa9246c){_0x3fc09b['push'](_0x3fc09b['shift']());}};_0x2d8977(++_0x5ddd34);}(_0xa6e8,0x161));var _0x8a6e=function(_0x52f873,_0x18faef){_0x52f873=_0x52f873-0x0;var _0x361912=_0xa6e8[_0x52f873];return _0x361912;};'use strict';var util=require('util');var _=require(_0x8a6e('0x0'));var moment=require(_0x8a6e('0x1'));function getSeconds(_0x9915a1,_0x512ebc){var _0x5c1adf=moment(_0x9915a1)[_0x8a6e('0x2')](0x0);var _0x5f4b99=moment(_0x512ebc)[_0x8a6e('0x2')](0x0);return _0x5c1adf[_0x8a6e('0x3')](_0x5f4b99,_0x8a6e('0x4'));}function Hangup(_0x217270,_0x549ee5){this[_0x8a6e('0x5')]=0x4;this['statedesc']=_0x8a6e('0x6');this[_0x8a6e('0x7')]=_0x217270['scheduledat'];this[_0x8a6e('0x8')]=_0x217270['type'];this[_0x8a6e('0x9')]=_0x217270[_0x8a6e('0x8')]===_0x8a6e('0xa')?_0x8a6e('0xb'):_0x217270[_0x8a6e('0x8')];this[_0x8a6e('0xc')]=_0x217270['countbusyretry'];this[_0x8a6e('0xd')]=_0x217270[_0x8a6e('0xd')];this['countnoanswerretry']=_0x217270[_0x8a6e('0xe')];this[_0x8a6e('0xf')]=_0x217270[_0x8a6e('0xc')]+_0x217270[_0x8a6e('0xd')]+_0x217270[_0x8a6e('0xe')]+_0x217270['countnosuchnumberretry']+_0x217270[_0x8a6e('0x10')]+_0x217270[_0x8a6e('0x11')]+_0x217270[_0x8a6e('0x12')]+_0x217270[_0x8a6e('0x13')];this[_0x8a6e('0x14')]=_0x217270[_0x8a6e('0x14')];this['countdropretry']=_0x217270[_0x8a6e('0x10')];this['countabandonedretry']=_0x217270[_0x8a6e('0x11')];this[_0x8a6e('0x12')]=_0x217270[_0x8a6e('0x12')];this[_0x8a6e('0x13')]=_0x217270[_0x8a6e('0x13')];this['uniqueid']=_0x549ee5[_0x8a6e('0x15')];this[_0x8a6e('0x16')]=_0x217270[_0x8a6e('0x17')];this[_0x8a6e('0x18')]=_0x217270[_0x8a6e('0x19')];this[_0x8a6e('0x1a')]=_0x217270['starttime'];this['responsetime']=_0x217270[_0x8a6e('0x1b')];this[_0x8a6e('0x1c')]=moment()[_0x8a6e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8a6e('0x1e')]=getSeconds(_0x217270[_0x8a6e('0x1b')],_0x217270[_0x8a6e('0x1a')]);this[_0x8a6e('0x1f')]=0x0;this[_0x8a6e('0x20')]=getSeconds(this[_0x8a6e('0x1c')],_0x217270[_0x8a6e('0x1b')]);this[_0x8a6e('0xb')]=_0x217270[_0x8a6e('0xb')];this[_0x8a6e('0x21')]='IVR';this[_0x8a6e('0x22')]=_0x549ee5['cause-txt'];this['callback']=_0x217270[_0x8a6e('0x23')];this[_0x8a6e('0x24')]=_0x217270[_0x8a6e('0x24')];this[_0x8a6e('0x25')]=_0x217270[_0x8a6e('0x25')];this[_0x8a6e('0x26')]=_0x217270[_0x8a6e('0x26')];this[_0x8a6e('0x27')]=_0x217270[_0x8a6e('0x27')];this['ListId']=_0x217270[_0x8a6e('0x28')];this[_0x8a6e('0x29')]=_0x217270[_0x8a6e('0x29')];this['VoiceQueueId']=_0x217270['VoiceQueueId'];this['CampaignId']=_0x217270[_0x8a6e('0x2a')];}module[_0x8a6e('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 6a07b95..c1a8cc6 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 _0xd19d=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x45bdae,_0x41eb62){var _0xcb8501=function(_0xb8ed1f){while(--_0xb8ed1f){_0x45bdae['push'](_0x45bdae['shift']());}};_0xcb8501(++_0x41eb62);}(_0xd19d,0x79));var _0xdd19=function(_0x3414fa,_0x30f564){_0x3414fa=_0x3414fa-0x0;var _0x2bd392=_0xd19d[_0x3414fa];return _0x2bd392;};'use strict';var util=require(_0xdd19('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x5ba885,_0x4fceb9){var _0x154b03=moment(_0x5ba885)[_0xdd19('0x1')](0x0);var _0xdc2b87=moment(_0x4fceb9)['milliseconds'](0x0);return _0x154b03[_0xdd19('0x2')](_0xdc2b87,'seconds');}function History(_0x229e9b){this[_0xdd19('0x3')]=_0x229e9b[_0xdd19('0x3')];this[_0xdd19('0x4')]=_0x229e9b[_0xdd19('0x4')]||undefined;this[_0xdd19('0x5')]=_0x229e9b[_0xdd19('0x5')];this['campaigntype']=_0x229e9b[_0xdd19('0x5')]===_0xdd19('0x6')?_0xdd19('0x7'):_0x229e9b['type'];this[_0xdd19('0x8')]=_0x229e9b[_0xdd19('0x8')];this['countcongestionretry']=_0x229e9b['countcongestionretry'];this[_0xdd19('0x9')]=_0x229e9b['countnoanswerretry'];this[_0xdd19('0xa')]=_0x229e9b[_0xdd19('0x8')]+_0x229e9b[_0xdd19('0xb')]+_0x229e9b[_0xdd19('0x9')]+_0x229e9b['countnosuchnumberretry']+_0x229e9b[_0xdd19('0xc')]+_0x229e9b[_0xdd19('0xd')]+_0x229e9b['countmachineretry']+_0x229e9b['countagentrejectretry'];this[_0xdd19('0xe')]=_0x229e9b['countnosuchnumberretry'];this[_0xdd19('0xc')]=_0x229e9b['countdropretry'];this['countabandonedretry']=_0x229e9b[_0xdd19('0xd')];this[_0xdd19('0xf')]=_0x229e9b[_0xdd19('0xf')];this['countagentrejectretry']=_0x229e9b['countagentrejectretry'];this['queue']=_0x229e9b[_0xdd19('0x7')];this[_0xdd19('0x10')]=_0x229e9b[_0xdd19('0x11')];this[_0xdd19('0x12')]=_0x229e9b[_0xdd19('0x13')];this[_0xdd19('0x14')]=_0x229e9b[_0xdd19('0x14')];this[_0xdd19('0x15')]=_0x229e9b['responsetime'];this['endtime']=_0x229e9b['responsetime'];this[_0xdd19('0x16')]=getSeconds(_0x229e9b[_0xdd19('0x15')],_0x229e9b[_0xdd19('0x14')]);this[_0xdd19('0x17')]=0x0;this[_0xdd19('0x18')]=0x0;this['callback']=_0x229e9b[_0xdd19('0x19')];this['callbackuniqueid']=_0x229e9b[_0xdd19('0x1a')];this[_0xdd19('0x1b')]=_0x229e9b[_0xdd19('0x1b')];this[_0xdd19('0x1c')]=_0x229e9b['recallme'];this['ContactId']=_0x229e9b[_0xdd19('0x1d')];this[_0xdd19('0x1e')]=_0x229e9b[_0xdd19('0x1e')];this[_0xdd19('0x1f')]=_0x229e9b[_0xdd19('0x1f')];this[_0xdd19('0x20')]=_0x229e9b['VoiceQueueId'];this[_0xdd19('0x21')]=_0x229e9b[_0xdd19('0x21')];this[_0xdd19('0x22')]=_0x229e9b['originatecalleridnum']||'';this['originatecalleridname']=_0x229e9b[_0xdd19('0x23')]||'';}module[_0xdd19('0x24')]=History; \ No newline at end of file +var _0x9dc3=['countmachineretry','countagentrejectretry','countdropretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry'];(function(_0x385413,_0x10110a){var _0x3edf85=function(_0x33861c){while(--_0x33861c){_0x385413['push'](_0x385413['shift']());}};_0x3edf85(++_0x10110a);}(_0x9dc3,0xa5));var _0x39dc=function(_0x21e708,_0x1808ea){_0x21e708=_0x21e708-0x0;var _0x2ead69=_0x9dc3[_0x21e708];return _0x2ead69;};'use strict';var util=require(_0x39dc('0x0'));var _=require(_0x39dc('0x1'));var moment=require(_0x39dc('0x2'));function getSeconds(_0x5719f8,_0x5682d4){var _0x9bfb49=moment(_0x5719f8)[_0x39dc('0x3')](0x0);var _0x3a05cc=moment(_0x5682d4)[_0x39dc('0x3')](0x0);return _0x9bfb49[_0x39dc('0x4')](_0x3a05cc,_0x39dc('0x5'));}function History(_0x5104f3){this[_0x39dc('0x6')]=_0x5104f3[_0x39dc('0x6')];this[_0x39dc('0x7')]=_0x5104f3[_0x39dc('0x7')]||undefined;this[_0x39dc('0x8')]=_0x5104f3[_0x39dc('0x8')];this['campaigntype']=_0x5104f3['type']==='outbound'?_0x39dc('0x9'):_0x5104f3[_0x39dc('0x8')];this[_0x39dc('0xa')]=_0x5104f3[_0x39dc('0xa')];this[_0x39dc('0xb')]=_0x5104f3[_0x39dc('0xb')];this[_0x39dc('0xc')]=_0x5104f3[_0x39dc('0xc')];this['countglobal']=_0x5104f3[_0x39dc('0xa')]+_0x5104f3[_0x39dc('0xb')]+_0x5104f3[_0x39dc('0xc')]+_0x5104f3[_0x39dc('0xd')]+_0x5104f3['countdropretry']+_0x5104f3[_0x39dc('0xe')]+_0x5104f3[_0x39dc('0xf')]+_0x5104f3[_0x39dc('0x10')];this['countnosuchnumberretry']=_0x5104f3[_0x39dc('0xd')];this[_0x39dc('0x11')]=_0x5104f3[_0x39dc('0x11')];this[_0x39dc('0xe')]=_0x5104f3[_0x39dc('0xe')];this['countmachineretry']=_0x5104f3[_0x39dc('0xf')];this[_0x39dc('0x10')]=_0x5104f3[_0x39dc('0x10')];this[_0x39dc('0x9')]=_0x5104f3[_0x39dc('0x9')];this[_0x39dc('0x12')]=_0x5104f3[_0x39dc('0x13')];this['calleridnum']=_0x5104f3[_0x39dc('0x14')];this[_0x39dc('0x15')]=_0x5104f3['starttime'];this['responsetime']=_0x5104f3[_0x39dc('0x16')];this[_0x39dc('0x17')]=_0x5104f3[_0x39dc('0x16')];this[_0x39dc('0x18')]=getSeconds(_0x5104f3['responsetime'],_0x5104f3[_0x39dc('0x15')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x39dc('0x19')]=_0x5104f3[_0x39dc('0x19')];this[_0x39dc('0x1a')]=_0x5104f3[_0x39dc('0x1a')];this[_0x39dc('0x1b')]=_0x5104f3[_0x39dc('0x1b')];this[_0x39dc('0x1c')]=_0x5104f3[_0x39dc('0x1c')];this['ContactId']=_0x5104f3[_0x39dc('0x1d')];this['ListId']=_0x5104f3[_0x39dc('0x1e')];this[_0x39dc('0x1f')]=_0x5104f3['UserId'];this[_0x39dc('0x20')]=_0x5104f3[_0x39dc('0x20')];this[_0x39dc('0x21')]=_0x5104f3[_0x39dc('0x21')];this[_0x39dc('0x22')]=_0x5104f3[_0x39dc('0x22')]||'';this[_0x39dc('0x23')]=_0x5104f3[_0x39dc('0x23')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index d48bb67..25afff5 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 _0x33ee=['\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','erlangCalls','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','startMethodPredictive','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','tryOriginatePredictive','reachable','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','--------\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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\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','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','bluebird','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','originateresponse','syncAgentComplete','custom:queuesummary','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','pTalking','sumDuration','sumHoldTime','total','unmanaged','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','md5','format','voice:queue:%s','type','campaign:ivr:%s','campaign:save','info','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','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','waiting','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','prototype','loopClearZombieChannels','[uniqueid]','[actions]','enqueue','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','resolve','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','VoiceQueueId','CampaignId','isSuccess','Success','isTrunkReachable','active','SIP/%s','status','isNil','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','MACHINE','Machine','membername','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','createStateFinal','reason\x2019\x20machine....','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','reason','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','actionid','stateinterface','locked','queueBooked','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','paused','idHopper','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','checkIfTime','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','loggedIn','dialGlobalInterval','dialTimezone','syncCampaigns','\x5cw{0,','pow','random','match','object','Contact','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE'];(function(_0x8a3018,_0x585282){var _0x5f0741=function(_0x5be611){while(--_0x5be611){_0x8a3018['push'](_0x8a3018['shift']());}};_0x5f0741(++_0x585282);}(_0x33ee,0xa8));var _0xe33e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x33ee[_0x4b369d];return _0x571a98;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xe33e('0x0'));var uuid=require('uuid');var moment=require(_0xe33e('0x1'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xe33e('0x2'));var ut=require(_0xe33e('0x3'));var config=require(_0xe33e('0x4'));var logger=require(_0xe33e('0x5'))(_0xe33e('0x6'));var loggerBooked=require(_0xe33e('0x5'))(_0xe33e('0x7'));var loggerPredictive=require('../../../config/logger')(_0xe33e('0x8'));var loggerPredictiveCalls=require(_0xe33e('0x5'))(_0xe33e('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xe33e('0xa'));var ami=require(_0xe33e('0xb'));config['redis']=_[_0xe33e('0xc')](config[_0xe33e('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0xe33e('0xe'))(new Redis(config[_0xe33e('0xd')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xe33e('0xf'));var cmHopperBlack=require(_0xe33e('0x10'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0xe33e('0x11'));var Final=require(_0xe33e('0x12'));var AgentComplete=require(_0xe33e('0x13'));var QueueCallerAbandon=require(_0xe33e('0x14'));var Hangup=require(_0xe33e('0x15'));var ipAgi=process[_0xe33e('0x16')][_0xe33e('0x17')]||_0xe33e('0x18');var strategy={'rrmemory':_0xe33e('0x19'),'roundrobin':_0xe33e('0x1a')};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x14eedf){this[_0xe33e('0x1b')]=this[_0xe33e('0x1b')]?this[_0xe33e('0x1b')][_0xe33e('0x1c')](_0x14eedf):_0x14eedf();};function Dialer(_0x4d8760,_0x4d3dfe){this[_0xe33e('0x1d')]=new Sequence();this[_0xe33e('0x1e')]=_0x4d3dfe;this[_0xe33e('0x1f')]=_0x4d8760['voiceQueues'];this['campaigns']=_0x4d8760[_0xe33e('0x20')];this[_0xe33e('0x21')]=_0x4d8760[_0xe33e('0x21')];this['trunks']=_0x4d8760[_0xe33e('0x22')];this[_0xe33e('0x23')]=config[_0xe33e('0x23')]||0x2;this['channels']={};this[_0xe33e('0x24')]={};this[_0xe33e('0x25')]={};this[_0xe33e('0x26')]={};this['optionPredictive']={};this[_0xe33e('0x27')]={};this[_0xe33e('0x28')]={};this[_0xe33e('0x29')]={};this['queueBooked']={};this[_0xe33e('0x2a')]={};ami['on'](_0xe33e('0x2b'),this[_0xe33e('0x2c')]['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0xe33e('0x2d')](this));ami['on'](_0xe33e('0x2e'),this['syncOriginateResponse'][_0xe33e('0x2d')](this));ami['on']('agentcomplete',this[_0xe33e('0x2f')]['bind'](this));ami['on'](_0xe33e('0x30'),this[_0xe33e('0xa')][_0xe33e('0x2d')](this));ami['on']('hangup',this[_0xe33e('0x31')][_0xe33e('0x2d')](this));ami['on']('newexten',this[_0xe33e('0x32')][_0xe33e('0x2d')](this));ami['on'](_0xe33e('0x33'),this[_0xe33e('0x34')][_0xe33e('0x2d')](this));ami['on'](_0xe33e('0x35'),this[_0xe33e('0x36')][_0xe33e('0x2d')](this));ami['on'](_0xe33e('0x37'),this[_0xe33e('0x38')][_0xe33e('0x2d')](this));this[_0xe33e('0x39')]();this['loopClearZombieChannels']();}function isNotNull(_0x102a73){return _0x102a73!==null&&!_[_0xe33e('0x3a')](_0x102a73);}function checkIsLoggedIn(_0x1c5efc,_0x24e403){return function(){if(_0x24e403<=0x0){_0x1c5efc[_0xe33e('0x3b')]=_0xe33e('0x3c');throw _0x1c5efc[_0xe33e('0x3d')]+_0xe33e('0x3e');}};}function isActive(_0x180134){return _0x180134;}function checkIsActive(_0x16b057,_0x5cf98c){return function(){if(!isActive(_0x5cf98c)){_0x16b057['message']=_0xe33e('0x3f');throw _0x16b057['name']+_0xe33e('0x40');}};}function checkInterval(_0x1d6160){return function(){if(!isNotNull(_0x1d6160[_0xe33e('0x41')])){_0x1d6160[_0xe33e('0x3b')]=_0xe33e('0x42');throw _0x1d6160[_0xe33e('0x3d')]+_0xe33e('0x43');}if(!isNotNull(_0x1d6160[_0xe33e('0x41')][_0xe33e('0x44')])){_0x1d6160[_0xe33e('0x3b')]=_0xe33e('0x42');throw _0x1d6160[_0xe33e('0x3d')]+_0xe33e('0x43');}if(!isNotNull(_[_0xe33e('0x45')](_0x1d6160[_0xe33e('0x41')][_0xe33e('0x44')]))){_0x1d6160[_0xe33e('0x3b')]=_0xe33e('0x42');throw _0x1d6160[_0xe33e('0x3d')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0xf81819,_0x576715,_0x234383){return{'action':_0xf81819,'response':_0x576715,'message':_0x234383,'stack':_0x234383};}function myreject(_0x471dac){return function(_0x2cfac0){return _0x471dac(msgResponse(_0xe33e('0x46'),_0xe33e('0x47'),JSON[_0xe33e('0x48')](_0x2cfac0)));};}function getSeconds(_0x2d2b17,_0x1d2178){var _0x1ac268=moment(_0x2d2b17)[_0xe33e('0x49')](0x0);var _0x289a06=moment(_0x1d2178)[_0xe33e('0x49')](0x0);return _0x1ac268[_0xe33e('0x4a')](_0x289a06,_0xe33e('0x4b'));}function emit(_0x322342,_0x2fcad4,_0x29da85){io['to'](_0x322342)[_0xe33e('0x4c')](_0x2fcad4,_0x29da85);}function emitVoiceQueueSummary(_0x31181f){if(_0x31181f['type']===_0xe33e('0x4d')){var _0x2e3939={'id':_0x31181f['id'],'name':_0x31181f[_0xe33e('0x3d')],'strategy':_0x31181f[_0xe33e('0x4e')],'answered':_0x31181f[_0xe33e('0x4f')],'available':_0x31181f[_0xe33e('0x50')],'loggedIn':_0x31181f['loggedIn'],'pTalking':_0x31181f[_0xe33e('0x51')],'sumBillable':_0x31181f['sumBillable'],'sumDuration':_0x31181f[_0xe33e('0x52')],'sumHoldTime':_0x31181f[_0xe33e('0x53')]||0x0,'talking':_0x31181f['talking'],'total':_0x31181f[_0xe33e('0x54')],'type':_0x31181f['type'],'unmanaged':_0x31181f[_0xe33e('0x55')],'abandoned':_0x31181f[_0xe33e('0x56')],'waiting':_0x31181f['waiting'],'loggedInDb':_0x31181f[_0xe33e('0x57')],'dialActive':_0x31181f['dialActive'],'dialMethod':_0x31181f[_0xe33e('0x58')],'dialOriginateCallerIdName':_0x31181f[_0xe33e('0x59')],'dialOriginateCallerIdNumber':_0x31181f[_0xe33e('0x5a')],'dialOriginateTimeout':_0x31181f[_0xe33e('0x5b')],'dialPrefix':_0x31181f[_0xe33e('0x5c')],'outboundAnswerAgiCallsDay':_0x31181f[_0xe33e('0x5d')],'outboundAnswerCallsDay':_0x31181f[_0xe33e('0x5e')],'outboundBlacklistCallsDay':_0x31181f[_0xe33e('0x5f')],'outboundBusyCallsDay':_0x31181f[_0xe33e('0x60')],'outboundCongestionCallsDay':_0x31181f['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x31181f[_0xe33e('0x61')],'outboundDropCallsDayCallersExit':_0x31181f[_0xe33e('0x62')],'outboundDropCallsDayTimeout':_0x31181f[_0xe33e('0x63')],'outboundNoAnswerCallsDay':_0x31181f[_0xe33e('0x64')],'outboundNoSuchCallsDay':_0x31181f[_0xe33e('0x65')],'outboundOriginateFailureCallsDay':_0x31181f['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x31181f['outboundReCallsDay'],'outboundRejectCallsDay':_0x31181f[_0xe33e('0x66')],'outboundUnknownCallsDay':_0x31181f[_0xe33e('0x67')],'predictiveIntervalAnsweredCalls':_0x31181f[_0xe33e('0x68')],'predictiveIntervalAvgHoldtime':_0x31181f[_0xe33e('0x69')],'predictiveIntervalAvgTalktime':_0x31181f[_0xe33e('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x31181f[_0xe33e('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x31181f[_0xe33e('0x6c')],'predictiveIntervalErlangCalls':_0x31181f[_0xe33e('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x31181f[_0xe33e('0x6e')],'predictiveIntervalHitRate':_0x31181f[_0xe33e('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x31181f[_0xe33e('0x70')],'predictiveIntervalPauses':_0x31181f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x31181f[_0xe33e('0x71')],'predictiveIntervalTotalCalls':_0x31181f[_0xe33e('0x72')],'message':_0x31181f[_0xe33e('0x3b')],'originated':_0x31181f[_0xe33e('0x73')],'erlangCalls':_0x31181f['erlangCalls'],'erlangCallToSecond':_0x31181f[_0xe33e('0x74')],'erlangAbandonmentRate':_0x31181f[_0xe33e('0x75')],'erlangBusyFactor':_0x31181f[_0xe33e('0x76')],'startPredictive':_0x31181f['startPredictive'],'startProgressive':_0x31181f[_0xe33e('0x28')]};if(_0x31181f[_0xe33e('0x77')]){_0x2e3939['Trunk']={'id':_0x31181f['Trunk']['id'],'name':_0x31181f[_0xe33e('0x77')][_0xe33e('0x3d')],'active':_0x31181f[_0xe33e('0x77')]['active'],'callerid':_0x31181f[_0xe33e('0x77')][_0xe33e('0x78')]};}if(_0x31181f[_0xe33e('0x41')]){_0x2e3939[_0xe33e('0x41')]={'id':_0x31181f['Interval']['id'],'name':_0x31181f['Interval'][_0xe33e('0x3d')]};}var _0x22c242=md5(JSON[_0xe33e('0x48')](_0x2e3939));if(_0x31181f[_0xe33e('0x79')]!==_0x22c242){_0x31181f[_0xe33e('0x79')]=_0x22c242;emit(util[_0xe33e('0x7a')](_0xe33e('0x7b'),_0x2e3939[_0xe33e('0x3d')]),'voice_queue:save',_0x2e3939);}}}function emitCampaignSummary(_0x1f741c){if(_0x1f741c[_0xe33e('0x7c')]==='ivr'){emit(util[_0xe33e('0x7a')](_0xe33e('0x7d'),_0x1f741c[_0xe33e('0x3d')]),_0xe33e('0x7e'),_0x1f741c);}}function checkGetDataPredictive(_0x150f91){if(isNotNull(_0x150f91)&&!_[_0xe33e('0x45')](_0x150f91)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xe33e('0x7f')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x150f91[_0xe33e('0x72')]);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x80'),_0x150f91['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x81'),_0x150f91['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x82'),_0x150f91[_0xe33e('0x6b')]);loggerPredictive[_0xe33e('0x7f')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x150f91[_0xe33e('0x69')]);loggerPredictive['info'](_0xe33e('0x83'),_0x150f91['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0xe33e('0x84'));if(_0x150f91[_0xe33e('0x72')]>0x0){if(!_[_0xe33e('0x3a')](_0x150f91[_0xe33e('0x6a')])&&_0x150f91[_0xe33e('0x6a')]>0x0){return!![];}loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x85'));if(!_[_0xe33e('0x3a')](_0x150f91[_0xe33e('0x69')])&&_0x150f91[_0xe33e('0x69')]>0x0){return!![];}loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x86'));}else{loggerPredictive['info'](_0xe33e('0x87'));}}else{loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x88'));}return![];}function mergeDataErlangB(_0x336880){return function(_0x87b42b){loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x89'));loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x8a'),_0x87b42b['erlangCalls']);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x8b'),_0x87b42b['erlangCallToSecond']);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x8c'),_0x87b42b[_0xe33e('0x75')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x87b42b[_0xe33e('0x76')]);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x8c'),_0x87b42b[_0xe33e('0x75')]);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x84'));_[_0xe33e('0x8d')](_0x336880,_0x87b42b);};}function getDiff(_0xfb0dc5){var _0x52d522=moment()[_0xe33e('0x49')](0x0);var _0x17ae6e=moment(_0xfb0dc5)[_0xe33e('0x49')](0x0);return _0x52d522['diff'](_0x17ae6e,_0xe33e('0x4b'));}function ifInterval(_0x1de1f1,_0x1250cc){if(_[_0xe33e('0x3a')](_0x1250cc)){return![];}return getDiff(_0x1250cc)<_0x1de1f1*0x3c;}function freeVariablesPredictive(_0x2fbc2e){if(isNotNull(_0x2fbc2e)){if(!_[_0xe33e('0x3a')](_0x2fbc2e[_0xe33e('0x28')])){_0x2fbc2e[_0xe33e('0x28')]=undefined;loggerPredictive[_0xe33e('0x7f')](_0x2fbc2e[_0xe33e('0x3d')],_0xe33e('0x8e'));}if(!_[_0xe33e('0x3a')](_0x2fbc2e[_0xe33e('0x27')])){_0x2fbc2e['startPredictive']=undefined;loggerPredictive['info'](_0x2fbc2e[_0xe33e('0x3d')],_0xe33e('0x8f'));}if(!_[_0xe33e('0x3a')](_0x2fbc2e[_0xe33e('0x90')])){clearInterval(_0x2fbc2e['handlePredictive']);_0x2fbc2e[_0xe33e('0x90')]=undefined;loggerPredictive[_0xe33e('0x7f')](_0x2fbc2e['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x57020c,_0x243fa2){if(_0x243fa2===0x0){return 0x0;}var _0x182c78=0x1;for(var _0x37efe3=0x1;_0x37efe3<=_0x243fa2;_0x37efe3+=0x1){_0x182c78=0x1+_0x182c78*_0x37efe3/_0x57020c;}return 0x1/_0x182c78;}function isVoiceQueueOutbound(_0x6b6d37){return _0x6b6d37===_0xe33e('0x4d');}function isNotPreview(_0x2c3ac9){return _0x2c3ac9!==_0xe33e('0x1e');}function isCampaignIvr(_0x12adcd){return _0x12adcd===_0xe33e('0x91');}function getCallerId(_0x106c35,_0x5954ee,_0x4658f3){if(!_['isUndefined'](_0x4658f3)&&typeof _0x4658f3===_0xe33e('0x92')&&!_[_0xe33e('0x45')](_0x4658f3)){if(!_[_0xe33e('0x3a')](_0x5954ee)&&typeof _0x5954ee===_0xe33e('0x92')&&!_['isEmpty'](_0x5954ee)){return util[_0xe33e('0x7a')]('\x22%s\x22\x20<%s>',_0x5954ee,_0x4658f3);}return util[_0xe33e('0x7a')](_0xe33e('0x93'),_0x4658f3,_0x4658f3);}if(!_[_0xe33e('0x3a')](_0x106c35)&&typeof _0x106c35===_0xe33e('0x92')&&!_['isEmpty'](_0x106c35)){return _0x106c35;}return _0xe33e('0x94');}function loggerCatchQueueSummary(_0x60539e,_0x3d6a47){return function(_0x25a5cc){freeVariablesPredictive(_0x3d6a47);emitVoiceQueueSummary(_0x3d6a47);emitCampaignSummary(_0x3d6a47);loggerSyncQueueSummary['error'](_0x60539e,util[_0xe33e('0x95')](_0x25a5cc,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4494fd,_0x460af7){return function(_0x166efa){loggerPredictive[_0xe33e('0x96')](_0x460af7[_0xe33e('0x3d')],_0x4494fd);loggerPredictive['error'](_0x166efa[_0xe33e('0x97')]);freeVariablesPredictive(_0x460af7);};}function loggerCatch(_0x1710ac){return function(_0x4bd88b){logger[_0xe33e('0x96')](_0x1710ac,util[_0xe33e('0x95')](_0x4bd88b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1d124c){return _0x1d124c&&!_['isUndefined'](_0x1d124c)&&_0x1d124c[_0xe33e('0x98')]>0x0;}function decremetOriginate(_0x3a63d3){if(!_['isUndefined'](_0x3a63d3)&&_0x3a63d3!==null){if(typeof _0x3a63d3[_0xe33e('0x73')]!==_0xe33e('0x99')){if(_0x3a63d3['originated']>0x0){_0x3a63d3['originated']-=0x1;}else{logger[_0xe33e('0x96')](_0xe33e('0x9a'));}}}else{logger[_0xe33e('0x96')](_0xe33e('0x9b'));}}function checkContactLowerLimitOriginate(_0x3bc38f,_0x3b9d2d,_0x10f5ad){if(_0x3b9d2d>_0x10f5ad){for(var _0xe9930a=0x0;_0xe9930a<_0x3b9d2d-_0x10f5ad;_0xe9930a+=0x1){decremetOriginate(_0x3bc38f);}}}function loggerGetContactDialer(_0x19f8df,_0x307b43,_0x46c47e){return function(_0x3b10d3){checkContactLowerLimitOriginate(_0x307b43,_0x46c47e,0x0);logger[_0xe33e('0x96')](_0x19f8df,util['inspect'](_0x3b10d3,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x282159){return function(_0x53d36c){if(isNotNull(_0x53d36c)&&isNotNull(_0x53d36c[0x0])){if(_0x53d36c[0x0][_0xe33e('0x9c')]>0x0){_0x282159[_0xe33e('0x3b')]=_0xe33e('0x9d');logger[_0xe33e('0x7f')](_0xe33e('0x9e')+_0x282159[_0xe33e('0x3d')],_0x53d36c[0x0][_0xe33e('0x9c')],_0xe33e('0x9f'));}else{_0x282159['message']=_0xe33e('0xa0');logger[_0xe33e('0x7f')](_0xe33e('0xa1')+_0x282159['name']);}}};}function notSendMessagesQueue(_0x487a99){if(_0x487a99[_0xe33e('0xa2')]){freeVariablesPredictive(_0x487a99);if(_0x487a99[_0xe33e('0x73')]===0x0&&_0x487a99[_0xe33e('0xa3')]===0x0&&_0x487a99[_0xe33e('0xa4')]===0x0&&(_0x487a99[_0xe33e('0x51')]||0x0)===0x0){_0x487a99['sendMessageOneNotActive']=![];_0x487a99['available']=0x0;_0x487a99['message']=_0xe33e('0x3f');loggerSyncQueueSummary[_0xe33e('0x96')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x487a99[_0xe33e('0x3d')],_0xe33e('0xa5'));}else{_0x487a99[_0xe33e('0x3b')]=_0xe33e('0xa6');loggerSyncQueueSummary['error'](_0xe33e('0xa7'),_0x487a99['name'],_0xe33e('0xa8'));}emitVoiceQueueSummary(_0x487a99);}}function notSendMessagesCampaign(_0x25ec5f){if(_0x25ec5f[_0xe33e('0xa2')]){if(_0x25ec5f[_0xe33e('0x73')]===0x0){_0x25ec5f[_0xe33e('0xa2')]=![];_0x25ec5f[_0xe33e('0x3b')]=_0xe33e('0x3f');loggerSyncQueueSummary[_0xe33e('0x96')](_0xe33e('0xa9'),_0x25ec5f[_0xe33e('0x3d')],'is\x20not\x20active');}else{_0x25ec5f[_0xe33e('0x3b')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xe33e('0x96')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x25ec5f[_0xe33e('0x3d')],_0xe33e('0xa8'));}emitCampaignSummary(_0x25ec5f);}}function createObjHistory(_0x3b9c1e,_0x5f3d46,_0x5eeb16,_0x3de7ee,_0x1005db){_0x3b9c1e[_0xe33e('0x3b')]=_0x5eeb16;var _0x3b6a72=new Action(_0x3b9c1e,_0x5f3d46);var _0x150002=new History(_0x3b6a72);_0x150002[_0xe33e('0xaa')]=_0x3de7ee;_0x150002[_0xe33e('0xab')]=_0x1005db;_0x150002[_0xe33e('0xac')]=_0x3b6a72[_0xe33e('0xad')];return _0x150002;}Dialer[_0xe33e('0xae')][_0xe33e('0xaf')]=function(){var _0x536b97=this;setInterval(function(){_0x536b97['clearZombieChannels'](_0x536b97[_0xe33e('0x26')],_0xe33e('0xb0'));_0x536b97['clearZombieChannels'](_0x536b97[_0xe33e('0x24')],_0xe33e('0xb1'));},0x32c8);};Dialer[_0xe33e('0xae')]['clearZombieChannels']=function(_0xdce903,_0x334681){var _0x4d617b=this;for(var _0x36a412 in _0xdce903){if(typeof _0xdce903[_0x36a412]!==_0xe33e('0x99')){this[_0xe33e('0x1d')][_0xe33e('0xb2')](function(){if(!_['isNil'](_0xdce903[_0x36a412])){return ami['Action']({'action':'status','channel':_0xdce903[_0x36a412][_0xe33e('0xb3')]})['catch'](function(_0x25390f){if(_0x25390f[_0xe33e('0x3b')]===_0xe33e('0xb4')){setTimeout(function(){if(_0xdce903[_0x36a412]&&_0xdce903[_0x36a412][_0xe33e('0x7c')]!=='ivr'){_0x4d617b[_0xe33e('0xb5')](_0x4d617b[_0xe33e('0x1f')][_0xdce903[_0x36a412][_0xe33e('0xb6')]]);logger[_0xe33e('0x96')](_0xe33e('0xb7'),_0x334681,_0x36a412,_0xdce903[_0x36a412][_0xe33e('0xb6')]);delete _0xdce903[_0x36a412];}if(_0xdce903[_0x36a412]&&_0xdce903[_0x36a412][_0xe33e('0x7c')]===_0xe33e('0x91')){_0x4d617b[_0xe33e('0xb5')](_0x4d617b[_0xe33e('0x20')][_0xdce903[_0x36a412][_0xe33e('0xb6')]]);logger[_0xe33e('0x96')]('[Dialer][checkChannel][ivr]',_0x334681,_0x36a412,_0xdce903[_0x36a412][_0xe33e('0xb6')]);delete _0xdce903[_0x36a412];}},0x2328);}});}});}}};Dialer[_0xe33e('0xae')][_0xe33e('0xb8')]=function(_0x51663d){return BPromise['resolve']()['then'](cmHopper['countReScheduled'](_0x51663d))[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xba')));};Dialer[_0xe33e('0xae')][_0xe33e('0xbb')]=function(_0x10e1f8){return BPromise['resolve']()[_0xe33e('0xbc')](cmHopperBlack['checkIsBlackList'](_0x10e1f8))['catch'](loggerCatch(_0xe33e('0xbd')));};Dialer[_0xe33e('0xae')][_0xe33e('0xbe')]=function(_0x2e04d1){return BPromise[_0xe33e('0xbf')]()[_0xe33e('0xbc')](cmHopperBlack['checkIsBlackListIvr'](_0x2e04d1))[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xc0')));};Dialer[_0xe33e('0xae')][_0xe33e('0xc1')]=function(_0x239ac7){return BPromise[_0xe33e('0xbf')]()[_0xe33e('0xbc')](cmHopperHistory['avgHandleTime'](_0x239ac7))[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xc2')));};Dialer['prototype'][_0xe33e('0xc3')]=function(_0x274446){return BPromise[_0xe33e('0xbf')]()[_0xe33e('0xbc')](cmHopper['rescheduleContact'](_0x274446))[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xc4')));};Dialer[_0xe33e('0xae')][_0xe33e('0xc5')]=function(_0x168ed0,_0x275ee7,_0x4db012){return BPromise['resolve']()[_0xe33e('0xbc')](cmHopper[_0xe33e('0xc5')](_0x168ed0,_0x275ee7,_0x4db012))[_0xe33e('0xb9')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xe33e('0xae')][_0xe33e('0xc6')]=function(_0x4dbb69,_0x9643bb,_0x11f99e,_0x56331b){return BPromise[_0xe33e('0xbf')]()[_0xe33e('0xbc')](cmHopper[_0xe33e('0xc6')](_0x4dbb69,_0x9643bb,_0x11f99e,_0x56331b))[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xc7')));};Dialer[_0xe33e('0xae')][_0xe33e('0xc8')]=function(_0x2a3822,_0x41b52b,_0x384487){return BPromise[_0xe33e('0xbf')]()[_0xe33e('0xbc')](cmHopper['getContactDialerIvr'](_0x2a3822,_0x41b52b,_0x384487))[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xc7')));};Dialer[_0xe33e('0xae')]['getVoiceQueueRtPauses']=function(_0x1877ad){return BPromise[_0xe33e('0xbf')]()['then'](voiceQueueRt[_0xe33e('0xc9')](_0x1877ad))[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xca')));};Dialer['prototype'][_0xe33e('0xcb')]=function(_0x5cdbd7){return BPromise['resolve']()[_0xe33e('0xbc')](cmHopper[_0xe33e('0xcb')](_0x5cdbd7))[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xcc')));};Dialer['prototype'][_0xe33e('0xcd')]=function(_0x282cfb){return BPromise[_0xe33e('0xbf')]()['then'](cmHopperHistory['createHistory'](_0x282cfb))['catch'](loggerCatch(_0xe33e('0xce')));};Dialer['prototype'][_0xe33e('0xb5')]=function(_0x2ba347){if(!_[_0xe33e('0x3a')](_0x2ba347)&&_0x2ba347!==null){if(typeof _0x2ba347[_0xe33e('0x73')]!=='undefined'){if(_0x2ba347[_0xe33e('0x73')]>0x0){_0x2ba347[_0xe33e('0x73')]-=0x1;}else{logger['error'](_0xe33e('0xcf'));}}}else{logger[_0xe33e('0x96')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xe33e('0xae')][_0xe33e('0xd0')]=function(_0x4fb4cc,_0x27412a){var _0x197ed8=this;return function(_0x1bb26f){_0x197ed8['updateOriginated'](_0x27412a);logger[_0xe33e('0x96')](_0x4fb4cc,util[_0xe33e('0x95')](_0x1bb26f,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xe33e('0xd1')]=function(_0x250c62,_0x12b93a,_0x1735cf){var _0x1e2659={'state':0x19,'statedesc':_0xe33e('0xd2')};this['updateOriginated'](_0x12b93a);this[_0xe33e('0xd3')](_['merge'](_0x1e2659,_[_0xe33e('0xd4')](_0x1735cf,['ContactId',_0xe33e('0xd5'),'UserId',_0xe33e('0xd6'),_0xe33e('0xd7')])),'[emptyContact][createHistory]','[emptyContact]');logger['error'](_0x250c62);};Dialer[_0xe33e('0xae')][_0xe33e('0xd8')]=function(_0x1bc953){return _0x1bc953===_0xe33e('0xd9');};Dialer['prototype'][_0xe33e('0xda')]=function(_0x2f3c9a){return!_[_0xe33e('0x3a')](_0x2f3c9a)&&_0x2f3c9a&&!_[_0xe33e('0x3a')](_0x2f3c9a[_0xe33e('0x3d')])&&!_[_0xe33e('0x3a')](_0x2f3c9a[_0xe33e('0xdb')])&&_0x2f3c9a[_0xe33e('0xdb')]&&(this[_0xe33e('0x22')][util['format'](_0xe33e('0xdc'),_0x2f3c9a[_0xe33e('0x3d')])]['status']==='reachable'||this[_0xe33e('0x22')][util['format'](_0xe33e('0xdc'),_0x2f3c9a[_0xe33e('0x3d')])][_0xe33e('0xdd')]==='unmonitored');};Dialer[_0xe33e('0xae')][_0xe33e('0xd3')]=function(_0xd06782,_0x45144d,_0x19b14f){this[_0xe33e('0xcd')](_0xd06782)['catch'](loggerCatch(_0x45144d));this[_0xe33e('0xcb')](_0xd06782)[_0xe33e('0xb9')](loggerCatch(_0x19b14f));};Dialer['prototype'][_0xe33e('0x34')]=function(_0x153439){var _0x1339b6=this[_0xe33e('0x26')][_0x153439['uniqueid']];var _0x28e98a;if(!_[_0xe33e('0xde')](_0x153439)&&!_['isNil'](_0x153439['variable'])&&!_[_0xe33e('0xde')](_0x153439['variable'][_0xe33e('0xdf')])&&_0x153439[_0xe33e('0xe0')]===_0xe33e('0xe1')&&_0x1339b6){if(_0x1339b6[_0xe33e('0x7c')]!==_0xe33e('0x91')&&this['voiceQueues'][_0x1339b6[_0xe33e('0xb6')]][_0xe33e('0xe2')]&&_0x153439[_0xe33e('0xe3')]===_0xe33e('0xe4')){delete this['uniqueId'][_0x153439[_0xe33e('0xe5')]];this[_0xe33e('0xb5')](this[_0xe33e('0x1f')][_0x1339b6[_0xe33e('0xb6')]]);this[_0xe33e('0x1f')][_0x1339b6[_0xe33e('0xb6')]][_0xe33e('0x5e')]+=0x1;this[_0xe33e('0x1f')][_0x1339b6[_0xe33e('0xb6')]][_0xe33e('0x5d')]+=0x1;_0x28e98a=new Hangup(_0x1339b6,_0x153439);_0x28e98a['state']=0x12;_0x28e98a[_0xe33e('0xab')]=_0xe33e('0xe6');_0x28e98a['membername']=_0xe33e('0xe7');this['saveInDb'](_0x28e98a,_0xe33e('0xe8'),'[syncHangupInAMD]');}if(_0x1339b6[_0xe33e('0x7c')]!=='ivr'&&this[_0xe33e('0x1f')][_0x1339b6[_0xe33e('0xb6')]][_0xe33e('0xe2')]&&_0x153439['value']===_0xe33e('0xe9')){var _0x713bd4=this;return new BPromise(function(_0x1b2c00,_0x3215a9){delete _0x713bd4[_0xe33e('0x26')][_0x153439[_0xe33e('0xe5')]];_0x713bd4[_0xe33e('0xb5')](_0x713bd4['voiceQueues'][_0x1339b6[_0xe33e('0xb6')]]);_0x713bd4[_0xe33e('0x1f')][_0x1339b6[_0xe33e('0xb6')]][_0xe33e('0x5e')]+=0x1;_0x713bd4[_0xe33e('0x1f')][_0x1339b6[_0xe33e('0xb6')]][_0xe33e('0x5d')]+=0x1;var _0x31589e=_0x713bd4[_0xe33e('0x1f')][_0x1339b6[_0xe33e('0xb6')]];var _0x1b59dc=new Hangup(_0x1339b6,_0x153439);_0x1b59dc['state']=0x13;_0x1b59dc['statedesc']=_0xe33e('0xea');_0x1b59dc[_0xe33e('0xeb')]='AMD';_0x1b59dc[_0xe33e('0xec')]+=0x1;_0x1b59dc[_0xe33e('0xed')]+=0x1;_0x1b59dc['amd']=!![];_0x713bd4['createHistory'](_0x1b59dc)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xee')));if(_0x1b59dc[_0xe33e('0xef')]+_0x1b59dc[_0xe33e('0xf0')]+_0x1b59dc[_0xe33e('0xf1')]+_0x1b59dc[_0xe33e('0xf2')]+_0x1b59dc[_0xe33e('0xf3')]+_0x1b59dc[_0xe33e('0xf4')]+_0x1b59dc[_0xe33e('0xec')]+_0x1b59dc[_0xe33e('0xf5')]>=_0x31589e[_0xe33e('0xf6')]){_0x713bd4[_0xe33e('0xf7')](_0x1b59dc,_0x1b2c00,_0x3215a9,_0xe33e('0xf8'));}else{if(_0x1b59dc[_0xe33e('0xec')]>=_0x31589e[_0xe33e('0xf9')]){_0x713bd4['createStateFinal'](_0x1b59dc,_0x1b2c00,_0x3215a9,'reason\x2019\x20machine....');}else{_0x713bd4['rescheduleContact']({'active':![],'countmachineretry':_0x1b59dc['countmachineretry'],'scheduledat':moment()[_0xe33e('0xfa')](_0x31589e[_0xe33e('0xfb')],'minutes')[_0xe33e('0x7a')](_0xe33e('0xfc')),'ContactId':_0x1b59dc[_0xe33e('0xfd')],'ListId':_0x1b59dc['ListId'],'VoiceQueueId':_0x1b59dc[_0xe33e('0xd6')]||undefined,'CampaignId':_0x1b59dc[_0xe33e('0xd7')]||undefined})['catch'](loggerCatch(_0xe33e('0xfe')));_0x1b2c00({'reschedule':0x1});}}});}if(_0x1339b6[_0xe33e('0x7c')]===_0xe33e('0x91')&&this[_0xe33e('0x20')][_0x1339b6[_0xe33e('0xb6')]][_0xe33e('0xe2')]&&_0x153439[_0xe33e('0xe3')]===_0xe33e('0xe4')){delete this[_0xe33e('0x26')][_0x153439[_0xe33e('0xe5')]];this[_0xe33e('0xb5')](this['campaigns'][_0x1339b6['queue']]);_0x28e98a=new Hangup(_0x1339b6,_0x153439);_0x28e98a['state']=0x12;_0x28e98a['statedesc']=_0xe33e('0xe6');_0x28e98a[_0xe33e('0xeb')]=_0xe33e('0xe7');this['saveInDb'](_0x28e98a,'[syncHangupInAMDIvr][createHistory]',_0xe33e('0xff'));}if(_0x1339b6['type']===_0xe33e('0x91')&&this[_0xe33e('0x20')][_0x1339b6[_0xe33e('0xb6')]][_0xe33e('0xe2')]&&_0x153439[_0xe33e('0xe3')]===_0xe33e('0xe9')){var _0x713bd4=this;return new BPromise(function(_0x5547f3,_0x5257f6){delete _0x713bd4['uniqueId'][_0x153439[_0xe33e('0xe5')]];_0x713bd4[_0xe33e('0xb5')](_0x713bd4[_0xe33e('0x20')][_0x1339b6[_0xe33e('0xb6')]]);_0x713bd4[_0xe33e('0x20')][_0x1339b6[_0xe33e('0xb6')]][_0xe33e('0x5e')]+=0x1;_0x713bd4['campaigns'][_0x1339b6[_0xe33e('0xb6')]][_0xe33e('0x5d')]+=0x1;var _0x29978e=_0x713bd4[_0xe33e('0x20')][_0x1339b6[_0xe33e('0xb6')]];var _0x46cd1e=new Hangup(_0x1339b6,_0x153439);_0x46cd1e[_0xe33e('0xaa')]=0x13;_0x46cd1e['statedesc']=_0xe33e('0xea');_0x46cd1e[_0xe33e('0xeb')]=_0xe33e('0xe7');_0x46cd1e['countmachineretry']+=0x1;_0x46cd1e[_0xe33e('0xed')]+=0x1;_0x46cd1e['amd']=!![];_0x713bd4[_0xe33e('0xcd')](_0x46cd1e)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xee')));if(_0x46cd1e[_0xe33e('0xef')]+_0x46cd1e[_0xe33e('0xf0')]+_0x46cd1e[_0xe33e('0xf1')]+_0x46cd1e['countnosuchnumberretry']+_0x46cd1e[_0xe33e('0xf3')]+_0x46cd1e[_0xe33e('0xf4')]+_0x46cd1e['countmachineretry']+_0x46cd1e[_0xe33e('0xf5')]>=_0x29978e[_0xe33e('0xf6')]){_0x713bd4[_0xe33e('0xf7')](_0x46cd1e,_0x5547f3,_0x5257f6,_0xe33e('0xf8'));}else{if(_0x46cd1e[_0xe33e('0xec')]>=_0x29978e[_0xe33e('0xf9')]){_0x713bd4[_0xe33e('0x100')](_0x46cd1e,_0x5547f3,_0x5257f6,_0xe33e('0x101'));}else{_0x713bd4[_0xe33e('0xc3')]({'active':![],'countmachineretry':_0x46cd1e['countmachineretry'],'scheduledat':moment()['add'](_0x29978e[_0xe33e('0xfb')],_0xe33e('0x102'))[_0xe33e('0x7a')](_0xe33e('0xfc')),'ContactId':_0x46cd1e['ContactId'],'ListId':_0x46cd1e[_0xe33e('0xd5')],'VoiceQueueId':_0x46cd1e[_0xe33e('0xd6')]||undefined,'CampaignId':_0x46cd1e[_0xe33e('0xd7')]||undefined})[_0xe33e('0xb9')](loggerCatch('[rescheduleContact][Machine]'));_0x5547f3({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xe33e('0x31')]=function(_0x448b49){var _0x519e02=this[_0xe33e('0x26')][_0x448b49[_0xe33e('0xe5')]];var _0xd5bc13=this;var _0x7c8de7;if(_0x519e02&&_0x519e02[_0xe33e('0x7c')]===_0xe33e('0x91')){delete this[_0xe33e('0x26')][_0x448b49[_0xe33e('0xe5')]];this['updateOriginated'](this['campaigns'][_0x519e02[_0xe33e('0xb6')]]);this['campaigns'][_0x519e02['queue']][_0xe33e('0x103')]+=0x1;_0x7c8de7=new Hangup(_0x519e02,_0x448b49);this['createHistory'](_0x7c8de7)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x104')));this['moveContactManagedDialer'](_0x7c8de7)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x105')));}if(_0x519e02&&_0x519e02[_0xe33e('0x7c')]!==_0xe33e('0x91')&&isNotNull(this[_0xe33e('0x1f')][_0x519e02['queue']][_0xe33e('0x106')])){delete this[_0xe33e('0x26')][_0x448b49['uniqueid']];this[_0xe33e('0xb5')](this[_0xe33e('0x1f')][_0x519e02[_0xe33e('0xb6')]]);this[_0xe33e('0x1f')][_0x519e02[_0xe33e('0xb6')]][_0xe33e('0x5e')]+=0x1;this[_0xe33e('0x1f')][_0x519e02[_0xe33e('0xb6')]][_0xe33e('0x5d')]+=0x1;_0x7c8de7=new Hangup(_0x519e02,_0x448b49);_0x7c8de7[_0xe33e('0xaa')]=0x10;_0x7c8de7[_0xe33e('0xab')]='AnswerAGI';_0x7c8de7[_0xe33e('0xeb')]=_0xe33e('0x107');this[_0xe33e('0xcd')](_0x7c8de7)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x104')));this[_0xe33e('0xcb')](_0x7c8de7)['catch'](loggerCatch(_0xe33e('0x105')));}if(_0x519e02&&_0x519e02['type']!==_0xe33e('0x91')&&!isNotNull(this['voiceQueues'][_0x519e02[_0xe33e('0xb6')]][_0xe33e('0x106')])){delete this[_0xe33e('0x26')][_0x448b49[_0xe33e('0xe5')]];this['updateOriginated'](this[_0xe33e('0x1f')][_0x519e02['queue']]);this[_0xe33e('0x1f')][_0x519e02[_0xe33e('0xb6')]][_0xe33e('0x67')]+=0x1;_0x7c8de7=new Hangup(_0x519e02,_0x448b49);_0x7c8de7[_0xe33e('0xaa')]=0xc;_0x7c8de7['statedesc']=_0x448b49[_0xe33e('0x108')];_0x7c8de7['membername']=_0xe33e('0x109');this[_0xe33e('0xcd')](_0x7c8de7)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xe33e('0xcb')](_0x7c8de7)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x105')));}};Dialer[_0xe33e('0xae')][_0xe33e('0x2f')]=function(_0x267217){var _0x14a7a3=this[_0xe33e('0x26')][_0x267217[_0xe33e('0xe5')]];var _0xb4262=this;if(this[_0xe33e('0x1f')][_0x267217[_0xe33e('0xb6')]]){if(_0x14a7a3&&_0x14a7a3[_0xe33e('0x7c')]!==_0xe33e('0x91')){delete this[_0xe33e('0x26')][_0x267217[_0xe33e('0xe5')]];this['voiceQueues'][_0x267217[_0xe33e('0xb6')]]['outboundAnswerCallsDay']+=0x1;var _0x318448=new AgentComplete(_0x14a7a3,_0x267217);if(_0x267217[_0xe33e('0x10a')]===_0xe33e('0x10b')){_0x318448[_0xe33e('0x10c')]=this['voiceQueues'][_0x267217[_0xe33e('0xb6')]]['dialQueueProject2']&&this[_0xe33e('0x1f')][_0x267217[_0xe33e('0xb6')]]['dialAgiAfterHangupAgent']?moment()[_0xe33e('0x7a')](_0xe33e('0xfc')):undefined;}this[_0xe33e('0xcd')](_0x318448)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x10d')));this[_0xe33e('0xcb')](_0x318448)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x10e')));}}};Dialer['prototype'][_0xe33e('0x2c')]=function(_0x4f028a){if(this['voiceQueues'][_0x4f028a[_0xe33e('0xb6')]]){if(this[_0xe33e('0x26')][_0x4f028a['uniqueid']]&&this[_0xe33e('0x26')][_0x4f028a[_0xe33e('0xe5')]][_0xe33e('0x7c')]!==_0xe33e('0x91')){this[_0xe33e('0xb5')](this[_0xe33e('0x1f')][_0x4f028a[_0xe33e('0xb6')]]);this[_0xe33e('0x26')][_0x4f028a[_0xe33e('0xe5')]]['answertime']=moment()[_0xe33e('0x7a')](_0xe33e('0xfc'));}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x3942a9){this[_0xe33e('0xcd')](_0x3942a9)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x10d')));this[_0xe33e('0xcb')](_0x3942a9)['catch'](loggerCatch(_0xe33e('0x10f')));};Dialer[_0xe33e('0xae')][_0xe33e('0x110')]=function(_0x8cfdc7){var _0x3dc04a=this[_0xe33e('0x26')][_0x8cfdc7['uniqueid']];var _0x233f38=this;if(this[_0xe33e('0x1f')][_0x8cfdc7[_0xe33e('0xb6')]]){if(_0x3dc04a&&_0x3dc04a['type']!==_0xe33e('0x91')){delete this[_0xe33e('0x26')][_0x8cfdc7[_0xe33e('0xe5')]];this[_0xe33e('0xb5')](this[_0xe33e('0x1f')][_0x8cfdc7[_0xe33e('0xb6')]]);_0x3dc04a[_0xe33e('0x111')]=moment()['format'](_0xe33e('0xfc'));var _0x9ed937=new QueueCallerAbandon(_0x3dc04a,_0x8cfdc7);if(getSeconds(_0x3dc04a[_0xe33e('0x111')],_0x3dc04a[_0xe33e('0x112')])>=_0x3dc04a[_0xe33e('0x113')]){this[_0xe33e('0x1f')][_0x8cfdc7[_0xe33e('0xb6')]][_0xe33e('0x6c')]+=0x1;this['voiceQueues'][_0x8cfdc7[_0xe33e('0xb6')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xe33e('0x1f')][_0x8cfdc7['queue']][_0xe33e('0x6e')]+=0x1;_0x9ed937[_0xe33e('0xaa')]=0xa;_0x9ed937[_0xe33e('0xab')]=_0xe33e('0x114');_0x9ed937[_0xe33e('0x115')]=_0xe33e('0x116');_0x9ed937[_0xe33e('0x10c')]=this[_0xe33e('0x1f')][_0x8cfdc7[_0xe33e('0xb6')]][_0xe33e('0x117')]?moment()[_0xe33e('0x7a')](_0xe33e('0xfc')):undefined;_0x9ed937[_0xe33e('0xf3')]+=0x1;_0x9ed937[_0xe33e('0xed')]+=0x1;if(_0x9ed937['countdropretry']>=this['voiceQueues'][_0x8cfdc7[_0xe33e('0xb6')]][_0xe33e('0x118')]){this[_0xe33e('0x119')](_0x9ed937);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x9ed937[_0xe33e('0xf3')],'scheduledat':moment()['add'](this[_0xe33e('0x1f')][_0x8cfdc7[_0xe33e('0xb6')]][_0xe33e('0x11a')],_0xe33e('0x102'))[_0xe33e('0x7a')](_0xe33e('0xfc')),'ContactId':_0x3dc04a['ContactId'],'ListId':_0x3dc04a[_0xe33e('0xd5')],'VoiceQueueId':_0x3dc04a['VoiceQueueId']||undefined,'CampaignId':_0x3dc04a['CampaignId']||undefined})['catch'](loggerCatch(_0xe33e('0x11b')));var _0x5e933c=new History(_0x9ed937);_0x5e933c['state']=0xa;_0x5e933c[_0xe33e('0xab')]=_0xe33e('0x114');_0x5e933c[_0xe33e('0xad')]=moment()[_0xe33e('0x7a')](_0xe33e('0xfc'));_0x5e933c['endtime']=_0x5e933c[_0xe33e('0xad')];_0x5e933c[_0xe33e('0x11c')]=_0x9ed937['calleridname'];_0x5e933c[_0xe33e('0x11d')]=_0x9ed937[_0xe33e('0x11d')];this[_0xe33e('0xcd')](_0x5e933c)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x11e')));}}else{this['voiceQueues'][_0x8cfdc7['queue']][_0xe33e('0x6b')]+=0x1;this['voiceQueues'][_0x8cfdc7[_0xe33e('0xb6')]][_0xe33e('0x62')]+=0x1;_0x9ed937[_0xe33e('0xaa')]=0xb;_0x9ed937[_0xe33e('0xab')]='Abandoned';_0x9ed937[_0xe33e('0x115')]=_0xe33e('0x11f');_0x9ed937['countabandonedretry']+=0x1;_0x9ed937[_0xe33e('0xed')]+=0x1;if(_0x9ed937[_0xe33e('0xf4')]>=this[_0xe33e('0x1f')][_0x8cfdc7[_0xe33e('0xb6')]]['dialAbandonedMaxRetry']){this[_0xe33e('0x119')](_0x9ed937);}else{this[_0xe33e('0xc3')]({'active':![],'countabandonedretry':_0x9ed937[_0xe33e('0xf4')],'scheduledat':moment()[_0xe33e('0xfa')](this[_0xe33e('0x1f')][_0x8cfdc7[_0xe33e('0xb6')]][_0xe33e('0x120')],'minutes')[_0xe33e('0x7a')](_0xe33e('0xfc')),'ContactId':_0x3dc04a['ContactId'],'ListId':_0x3dc04a[_0xe33e('0xd5')],'VoiceQueueId':_0x3dc04a['VoiceQueueId']||undefined,'CampaignId':_0x3dc04a[_0xe33e('0xd7')]||undefined})['catch'](loggerCatch(_0xe33e('0x121')));var _0x5e933c=new History(_0x9ed937);_0x5e933c[_0xe33e('0xaa')]=0xb;_0x5e933c[_0xe33e('0xab')]=_0xe33e('0x122');_0x5e933c[_0xe33e('0xad')]=moment()['format'](_0xe33e('0xfc'));_0x5e933c['endtime']=_0x5e933c[_0xe33e('0xad')];_0x5e933c[_0xe33e('0x11c')]=_0x9ed937[_0xe33e('0x11c')];_0x5e933c[_0xe33e('0x11d')]=_0x9ed937[_0xe33e('0x11d')];this[_0xe33e('0xcd')](_0x5e933c)[_0xe33e('0xb9')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xe33e('0xae')]['syncNewExten']=function(_0x1962eb){if(this[_0xe33e('0x24')][_0x1962eb[_0xe33e('0xe5')]]){this[_0xe33e('0x24')][_0x1962eb[_0xe33e('0xe5')]]['channel']=_0x1962eb[_0xe33e('0xb3')];}if(this[_0xe33e('0x26')][_0x1962eb[_0xe33e('0xe5')]]){this[_0xe33e('0x26')][_0x1962eb['uniqueid']][_0xe33e('0xb3')]=_0x1962eb[_0xe33e('0xb3')];}};Dialer[_0xe33e('0xae')][_0xe33e('0x36')]=function(_0xfd17d1){if(strategy[this[_0xe33e('0x1f')][this[_0xe33e('0x24')][_0xfd17d1[_0xe33e('0x123')]][_0xe33e('0xb6')]][_0xe33e('0x4e')]]===_0xe33e('0x1a')){if(this['actions'][_0xfd17d1['actionid']]&&_[_0xe33e('0xde')](this[_0xe33e('0x24')][_0xfd17d1['actionid']]['locked'])&&_0xfd17d1[_0xe33e('0xdd')]==='1'&&_0xfd17d1['paused']==='0'){if(this[_0xe33e('0x21')][_0xfd17d1[_0xe33e('0x124')]]){if(!this[_0xe33e('0x21')][_0xfd17d1['stateinterface']][_0xe33e('0x125')]){this[_0xe33e('0x21')][_0xfd17d1[_0xe33e('0x124')]][_0xe33e('0x125')]=!![];this['actions'][_0xfd17d1['actionid']][_0xe33e('0x125')]=!![];this[_0xe33e('0x24')][_0xfd17d1[_0xe33e('0x123')]][_0xe33e('0x124')]=_0xfd17d1[_0xe33e('0x124')];}}}}else if((strategy[this[_0xe33e('0x1f')][this['actions'][_0xfd17d1[_0xe33e('0x123')]]['queue']][_0xe33e('0x4e')]]||_0xe33e('0x19'))===_0xe33e('0x19')){if(this[_0xe33e('0x24')][_0xfd17d1[_0xe33e('0x123')]]){if(this['agents'][_0xfd17d1['stateinterface']]){this[_0xe33e('0x24')][_0xfd17d1['actionid']][_0xe33e('0x124')]=_0xfd17d1[_0xe33e('0x124')];if(_[_0xe33e('0xde')](this['queueBooked'][this[_0xe33e('0x24')][_0xfd17d1[_0xe33e('0x123')]]['queue']])){this[_0xe33e('0x126')][this['actions'][_0xfd17d1[_0xe33e('0x123')]][_0xe33e('0xb6')]]=[];}this[_0xe33e('0x126')][this[_0xe33e('0x24')][_0xfd17d1['actionid']][_0xe33e('0xb6')]]['push'](_[_0xe33e('0x8d')](_[_0xe33e('0xd4')](this[_0xe33e('0x24')][_0xfd17d1['actionid']],['idHopper',_0xe33e('0x124')]),{'status':_0xfd17d1['status'],'paused':_0xfd17d1['paused']}));}}}};function unlockQueueStatus(_0x391c91,_0x30fcb6){setTimeout(function(){if(_[_0xe33e('0x3a')](_0x391c91[_0xe33e('0x127')])){loggerBooked[_0xe33e('0x96')](_0xe33e('0x128'),_0x30fcb6);}_0x391c91[_0xe33e('0x127')]=!![];loggerBooked['info'](_0xe33e('0x129'),_0x30fcb6,JSON['stringify'](_['pick'](_0x391c91,[_0xe33e('0x3d'),_0xe33e('0x127')])));},0x1f3);}Dialer[_0xe33e('0xae')][_0xe33e('0x38')]=function(_0x36b58d){var _0x147c24=this;var _0x7a5c9e=_0x147c24['voiceQueues'][_0x147c24['actions'][_0x36b58d[_0xe33e('0x123')]][_0xe33e('0xb6')]];if(strategy[this['voiceQueues'][this[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]][_0xe33e('0xb6')]][_0xe33e('0x4e')]]===_0xe33e('0x1a')){if(this[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]]&&this['actions'][_0x36b58d[_0xe33e('0x123')]][_0xe33e('0x124')]){this[_0xe33e('0x1e')][_0xe33e('0x12a')](this[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]]['idHopper'],this[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]][_0xe33e('0x124')])[_0xe33e('0xb9')](function(_0x4957b4){logger[_0xe33e('0x96')](_0xe33e('0x12b'),util['inspect'](_0x4957b4,{'showHidden':![],'depth':null}));})[_0xe33e('0x1c')](function(){_0x147c24[_0xe33e('0xb5')](_0x147c24['voiceQueues'][_0x147c24[_0xe33e('0x24')][_0x36b58d['actionid']][_0xe33e('0xb6')]]);_0x147c24[_0xe33e('0x21')][_0x147c24[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]]['stateinterface']][_0xe33e('0x125')]=![];delete _0x147c24[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]];unlockQueueStatus(_0x7a5c9e);});}else{this[_0xe33e('0xb5')](this[_0xe33e('0x1f')][this[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]][_0xe33e('0xb6')]]);this[_0xe33e('0xc3')]({'active':![],'ContactId':this[_0xe33e('0x24')][_0x36b58d['actionid']][_0xe33e('0xfd')],'ListId':this[_0xe33e('0x24')][_0x36b58d['actionid']][_0xe33e('0xd5')],'VoiceQueueId':this['actions'][_0x36b58d[_0xe33e('0x123')]][_0xe33e('0xd6')]||undefined,'CampaignId':this['actions'][_0x36b58d['actionid']]['CampaignId']||undefined})[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x12c')));delete this[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]];unlockQueueStatus(_0x7a5c9e);}}else if((strategy[this[_0xe33e('0x1f')][this['actions'][_0x36b58d[_0xe33e('0x123')]][_0xe33e('0xb6')]][_0xe33e('0x4e')]]||'rrmemory')===_0xe33e('0x19')){var _0x14610a;if(this['actions'][_0x36b58d['actionid']]&&!_[_0xe33e('0x45')](this[_0xe33e('0x126')][this[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]][_0xe33e('0xb6')]])){if(this[_0xe33e('0x2a')][_0x147c24[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]]['queue']]){this[_0xe33e('0x2a')][_0x147c24[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]][_0xe33e('0xb6')]]=this[_0xe33e('0x2a')][this['actions'][_0x36b58d[_0xe33e('0x123')]]['queue']]?this[_0xe33e('0x2a')][this[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]]['queue']]:this[_0xe33e('0x126')][this[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]]['queue']]?this['queueBooked'][this[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]][_0xe33e('0xb6')]][_0xe33e('0x12d')]||0x0:0x0;}this[_0xe33e('0x126')][this[_0xe33e('0x24')][_0x36b58d[_0xe33e('0x123')]][_0xe33e('0xb6')]][_0xe33e('0x12d')]=this['queueBookedRR'][this['actions'][_0x36b58d[_0xe33e('0x123')]][_0xe33e('0xb6')]];for(var _0x3cfa2f=0x0;_0x3cfa2f=0x0;})[_0xe33e('0xb9')](myreject(_0x3f8585)));}}else{_0x3c6aa0[_0xe33e('0x143')](ami[_0xe33e('0x144')]({'action':_0xe33e('0x145'),'command':util[_0xe33e('0x7a')](_0xe33e('0x146'),_0x4e46ed,!_[_0xe33e('0x3a')](config[_0xe33e('0x140')][_0x2939b6])?_0x2939b6:'')})['then'](function(_0x1862c7){return _0x1862c7[_0xe33e('0x148')][_0xe33e('0x149')](_0xe33e('0x14a'))>=0x0;})[_0xe33e('0xb9')](myreject(_0x3f8585)));}BPromise[_0xe33e('0x14b')](_0x3c6aa0)[_0xe33e('0xbc')](function(_0xd9a602){var _0x492f26=_[_0xe33e('0x14c')](_0xd9a602);if(_0x492f26){return _0x96003b(_0x492f26);}else{_0xf420b7[_0xe33e('0x3b')]=_0x373a46?_0xe33e('0x14d'):_0xe33e('0x14e');return _0x3f8585(msgResponse(_0xe33e('0x14f'),_0xe33e('0x13e'),_0xe33e('0x150')+_0x373a46+'\x20'+_0x598012+_0xe33e('0x151')+util[_0xe33e('0x95')](_0x4e46ed,{'showHidden':![],'depth':null})+_0xe33e('0x152')+_0x2939b6));}})[_0xe33e('0xb9')](function(_0x56fb63){return _0x3f8585(msgResponse('ifTime','Failure',JSON[_0xe33e('0x48')](_0x56fb63)));});});};Dialer[_0xe33e('0xae')][_0xe33e('0x153')]=function(_0x2f2a3e){var _0x1beaff=this;return function(){switch(_0x2f2a3e[_0xe33e('0x58')]){case _0xe33e('0x154'):freeVariablesPredictive(_0x2f2a3e);_0x1beaff[_0xe33e('0x155')](_0x2f2a3e,0x1);break;case _0xe33e('0x156'):freeVariablesPredictive(_0x2f2a3e);_0x1beaff[_0xe33e('0x155')](_0x2f2a3e,_0x2f2a3e[_0xe33e('0x157')]);break;case _0xe33e('0x8'):_0x1beaff[_0xe33e('0x8')](_0x2f2a3e);break;case _0xe33e('0x7'):freeVariablesPredictive(_0x2f2a3e);_0x1beaff[_0xe33e('0x155')](_0x2f2a3e,0x1);break;default:freeVariablesPredictive(_0x2f2a3e);logger[_0xe33e('0x96')]('Queue',_0x2f2a3e[_0xe33e('0x3d')],_0xe33e('0x158'));}};};Dialer[_0xe33e('0xae')][_0xe33e('0x159')]=function(_0x5effba){var _0xfc741d=this;return function(){_0xfc741d[_0xe33e('0x15a')](_0x5effba);};};Dialer['prototype'][_0xe33e('0xa')]=function(_0x3db3c3){var _0x35dc76=this;if(isNotPreview(_0x3db3c3['dialMethod'])){if(isVoiceQueueOutbound(_0x3db3c3['type'])&&isActive(_0x3db3c3[_0xe33e('0x15b')])){_0x3db3c3[_0xe33e('0xa2')]=!![];BPromise[_0xe33e('0xbf')]()[_0xe33e('0xbc')](checkIsLoggedIn(_0x3db3c3,_0x3db3c3[_0xe33e('0x15c')]))[_0xe33e('0xbc')](checkIsActive(_0x3db3c3,_0x3db3c3['dialActive']))[_0xe33e('0xbc')](checkInterval(_0x3db3c3))[_0xe33e('0xbc')](_0x35dc76[_0xe33e('0x137')](_0x3db3c3))[_0xe33e('0xbc')](_0x35dc76[_0xe33e('0x139')](_0x3db3c3[_0xe33e('0x15d')],_0x3db3c3['dialTimezone'],_0x3db3c3[_0xe33e('0x3d')],_0x3db3c3))[_0xe33e('0xbc')](_0x35dc76['checkIfTimeIntervals'](_0x3db3c3[_0xe33e('0x41')],_0x3db3c3[_0xe33e('0x15e')],_0x3db3c3['name'],_0x3db3c3))['then'](_0x35dc76[_0xe33e('0x153')](_0x3db3c3))[_0xe33e('0xb9')](loggerCatchQueueSummary('[syncQueueSummary]',_0x3db3c3));}else{notSendMessagesQueue(_0x3db3c3);}}else{freeVariablesPredictive(_0x3db3c3);}};Dialer[_0xe33e('0xae')][_0xe33e('0x15f')]=function(){var _0x115999=this;var _0x599c4f;for(var _0x5e8732 in this['campaigns']){if(typeof this[_0xe33e('0x20')][_0x5e8732]!==_0xe33e('0x99')){_0x599c4f=this['campaigns'][_0x5e8732];if(isCampaignIvr(_0x599c4f['type'])&&isActive(_0x599c4f[_0xe33e('0xdb')])){_0x599c4f[_0xe33e('0xa2')]=!![];BPromise[_0xe33e('0xbf')]()[_0xe33e('0xbc')](checkIsActive(_0x599c4f,_0x599c4f[_0xe33e('0xdb')]))[_0xe33e('0xbc')](checkInterval(_0x599c4f))[_0xe33e('0xbc')](_0x115999[_0xe33e('0x137')](_0x599c4f))[_0xe33e('0xbc')](_0x115999[_0xe33e('0x139')](_0x599c4f[_0xe33e('0x15d')],_0x599c4f['dialTimezone'],_0x599c4f[_0xe33e('0x3d')],_0x599c4f))[_0xe33e('0xbc')](_0x115999[_0xe33e('0x13a')](_0x599c4f[_0xe33e('0x41')],_0x599c4f[_0xe33e('0x15e')],_0x599c4f[_0xe33e('0x3d')],_0x599c4f))[_0xe33e('0xbc')](_0x115999[_0xe33e('0x159')](_0x599c4f))[_0xe33e('0xb9')](loggerCatchQueueSummary('[syncCampaigns]',_0x599c4f));}else{notSendMessagesCampaign(_0x599c4f);}}}};function getCallerIdRandom(_0x6f3f8c,_0x250877){var _0x4ffffa;var _0x449266;var _0x20a797;if(_0x250877<=0x0){_0x250877=0x1;}_0x4ffffa=new RegExp(_0xe33e('0x160')+_0x250877+'}$');_0x449266=Math[_0xe33e('0x161')](0xa,_0x250877-0x1);_0x20a797=Math[_0xe33e('0x161')](0xa,_0x250877)-0x1;return util[_0xe33e('0x7a')]('%s',_['replace'](_0x6f3f8c,_0x4ffffa,_[_0xe33e('0x162')](_0x449266,_0x20a797)));}function extractCalleridName(_0x4fc233){var _0x54c2ae=_0x4fc233[_0xe33e('0x163')](/"(.*?)"/);return _0x54c2ae?_0x54c2ae[0x1]:_0x4fc233;}function extractCalleridNumber(_0x3f0736){var _0x118835=_0x3f0736[_0xe33e('0x163')](/<(.*?)>/);return _0x118835?_0x118835[0x1]:_0x3f0736;}Dialer['prototype']['actionOriginate']=function(_0x3a073c,_0x5df84a){var _0x54dc93=this;var _0x4fa593=uuid['v4']();this[_0xe33e('0x24')][_0x4fa593]=new Action(_0x3a073c,_0x5df84a,_0x4fa593);return new BPromise(function(_0xb32f98,_0x24a6b6){if(_[_0xe33e('0x3a')](_0x3a073c)&&typeof _0x3a073c!==_0xe33e('0x164')){return _0x24a6b6(msgResponse('originate',_0xe33e('0x13e'),'voiceQueue\x20is\x20undefine'));}if(_[_0xe33e('0x3a')](_0x5df84a[_0xe33e('0x165')]['phone'])||_0x5df84a[_0xe33e('0x165')][_0xe33e('0x166')]===null){return _0x24a6b6(msgResponse(_0xe33e('0x167'),_0xe33e('0x13e'),'contact\x20is\x20undefine'));}var _0x52de89={'XMD-CALLERID':_0x54dc93[_0xe33e('0x24')][_0x4fa593][_0xe33e('0x168')](),'XMD-AGI':_0x3a073c[_0xe33e('0x106')]?util[_0xe33e('0x7a')](_0xe33e('0x169'),ipAgi,_0x3a073c[_0xe33e('0x106')]):'NONE','XMD-AGIAFTER':_0x3a073c[_0xe33e('0x117')]?util[_0xe33e('0x7a')](_0xe33e('0x169'),ipAgi,_0x3a073c[_0xe33e('0x117')]):_0xe33e('0x16a'),'XMD-QUEUE':_0x3a073c[_0xe33e('0x7c')]===_0xe33e('0x4d')?util[_0xe33e('0x7a')](_0xe33e('0x16b'),_0x3a073c['name'],_0x3a073c[_0xe33e('0x16c')]||'',_0x3a073c[_0xe33e('0x16d')]?'c':'',_0x3a073c['dialQueueTimeout']||0x3):_0xe33e('0x16a'),'XMD-CONTACTID':_0x5df84a[_0xe33e('0xfd')],'XMD-CDRTYPE':_0xe33e('0x6'),'CALLERID(all)':_0x54dc93[_0xe33e('0x24')][_0x4fa593][_0xe33e('0x168')](),'XMD-AMD':_0x3a073c[_0xe33e('0xe2')]?_0xe33e('0x16e'):_0xe33e('0x16a'),'XMD-DESTINATION':_0xe33e('0xe1')};if(_0x3a073c[_0xe33e('0xe2')]){_0x52de89[_0xe33e('0x16f')]=_0x3a073c[_0xe33e('0x170')]||0x9c4;_0x52de89[_0xe33e('0x171')]=_0x3a073c[_0xe33e('0x172')]||0x5dc;_0x52de89['XMD-AMDAFTERGREETINGSILENCE']=_0x3a073c['dialAMDAfterGreetingSilence']||0x320;_0x52de89['XMD-AMDTOTALANALYSISTIME']=_0x3a073c['dialAMDTotalAnalysisTime']||0x1388;_0x52de89['XMD-AMDMINWORDLENGTH']=_0x3a073c['dialAMDMinWordLength']||0x64;_0x52de89['XMD-AMDBETWEENWORDSSILENCE']=_0x3a073c[_0xe33e('0x173')]||0x32;_0x52de89[_0xe33e('0x174')]=_0x3a073c[_0xe33e('0x175')]||0x3;_0x52de89[_0xe33e('0x176')]=_0x3a073c[_0xe33e('0x177')]||0x100;_0x52de89[_0xe33e('0x178')]=_0x3a073c['dialAMDMaximumWordLength']||0x1388;}if(_0x3a073c['type']==='outbound'){_0x52de89[_0xe33e('0x179')]=_0x5df84a[_0xe33e('0xd6')];}else{_0x52de89[_0xe33e('0x17a')]=_0x5df84a[_0xe33e('0xd7')];}for(var _0x15aa23 in _0x5df84a[_0xe33e('0x165')]){if(typeof _0x5df84a[_0xe33e('0x165')][_0x15aa23]!==_0xe33e('0x99')){if(isNotNull(_0x5df84a[_0xe33e('0x165')][_0x15aa23])&&_0x15aa23!=='id'&&_0x15aa23!==_0xe33e('0x17b')&&_0x15aa23!=='createdAt'&&_0x15aa23!==_0xe33e('0x17c')){_0x52de89[util['format']('%s%s',_0xe33e('0x17d'),_[_0xe33e('0x17e')](_0x15aa23))]=_0x5df84a[_0xe33e('0x165')][_0x15aa23];}}}var _0x2dce52=_0x54dc93['isTrunkReachable'](_0x3a073c[_0xe33e('0x77')])?getCallerId(_0x3a073c[_0xe33e('0x77')][_0xe33e('0x78')],_0x3a073c[_0xe33e('0x59')],_0x3a073c['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3a073c[_0xe33e('0x5a')],_0x3a073c['dialRandomLastDigitCallerIdNumber']):_0x3a073c[_0xe33e('0x5a')]):getCallerId(_[_0xe33e('0xde')](_0x3a073c[_0xe33e('0x138')])?_0x3a073c['Trunk'][_0xe33e('0x78')]:_0x3a073c['TrunkBackup']['callerid'],_0x3a073c[_0xe33e('0x59')],_0x3a073c['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3a073c[_0xe33e('0x5a')],_0x3a073c[_0xe33e('0x17f')]):_0x3a073c[_0xe33e('0x5a')]);if(_0x2dce52){_0x52de89[_0xe33e('0x180')]=_0x54dc93[_0xe33e('0x24')][_0x4fa593]['originatecalleridname']=extractCalleridName(_0x2dce52);_0x52de89['XMD-ORIGINATECALLERIDNUM']=_0x54dc93['actions'][_0x4fa593]['originatecalleridnum']=extractCalleridNumber(_0x2dce52);}return ami['Action']({'actionid':_0x4fa593,'action':_0xe33e('0x167'),'channel':_0x54dc93[_0xe33e('0xda')](_0x3a073c[_0xe33e('0x77')])?util['format'](_0xe33e('0x181'),_0x3a073c[_0xe33e('0x77')][_0xe33e('0x3d')],isNotNull(_0x3a073c[_0xe33e('0x5c')])?_0x3a073c[_0xe33e('0x5c')][_0xe33e('0x182')]()||'':'',_0x3a073c[_0xe33e('0x183')]>0x0?_0x5df84a['Contact'][_0xe33e('0x166')][_0xe33e('0x184')](_0x3a073c[_0xe33e('0x183')]):_0x5df84a[_0xe33e('0x165')][_0xe33e('0x166')]):util[_0xe33e('0x7a')](_0xe33e('0x181'),_['isNil'](_0x3a073c[_0xe33e('0x138')])?_0x3a073c['Trunk']['name']:_0x3a073c['TrunkBackup']['name'],isNotNull(_0x3a073c[_0xe33e('0x5c')])?_0x3a073c[_0xe33e('0x5c')][_0xe33e('0x182')]()||'':'',_0x3a073c[_0xe33e('0x183')]>0x0?_0x5df84a[_0xe33e('0x165')][_0xe33e('0x166')][_0xe33e('0x184')](_0x3a073c[_0xe33e('0x183')]):_0x5df84a[_0xe33e('0x165')][_0xe33e('0x166')]),'callerid':_0x2dce52,'Exten':_0xe33e('0xe1'),'Context':_0xe33e('0x185'),'Priority':'1','variable':_0x52de89,'timeout':(_0x3a073c[_0xe33e('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4fa593})['then'](function(_0x55816b){return _0xb32f98(_0x55816b);})['catch'](function(_0x56030a){_0x3a073c[_0xe33e('0x186')]+=0x1;var _0x247161=new History(_0x54dc93['actions'][_0x4fa593]);logger[_0xe33e('0x96')](util[_0xe33e('0x7a')](_0xe33e('0x187'),JSON[_0xe33e('0x48')](_0x56030a)));_0x247161[_0xe33e('0xaa')]=0xe;_0x247161[_0xe33e('0xab')]=_0xe33e('0x188');_0x247161[_0xe33e('0xad')]=moment()[_0xe33e('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x247161[_0xe33e('0xac')]=_0x247161[_0xe33e('0xad')];_0x54dc93[_0xe33e('0xcd')](_0x247161)[_0xe33e('0xb9')](loggerCatch('[originate][error]'));_0x54dc93[_0xe33e('0xcb')](_0x247161)[_0xe33e('0xb9')](loggerCatch('[originate][error]'))[_0xe33e('0x1c')](function(){delete _0x54dc93['actions'][_0x4fa593];return _0x24a6b6(msgResponse(_0xe33e('0x167'),_0xe33e('0x47'),_0xe33e('0x189')));});});});};Dialer[_0xe33e('0xae')][_0xe33e('0x18a')]=function(_0x2a6736){var _0x525788=this[_0xe33e('0x24')][_0x2a6736['actionid']];if(_0x525788){delete this['actions'][_0x2a6736[_0xe33e('0x123')]];_0x525788[_0xe33e('0x112')]=moment()['format'](_0xe33e('0xfc'));var _0x4c8946=_0x525788[_0xe33e('0x7c')]===_0xe33e('0x91')?this['campaigns'][_0x525788['queue']]:this[_0xe33e('0x1f')][_0x525788[_0xe33e('0x18b')]()];if(!this[_0xe33e('0xd8')](_0x2a6736[_0xe33e('0x18c')])){this[_0xe33e('0xb5')](_0x4c8946);return this[_0xe33e('0x18d')](_0x525788,_0x4c8946,_0x2a6736)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x18e')));}this[_0xe33e('0x26')][_0x2a6736[_0xe33e('0xe5')]]=_0x525788;}};Dialer[_0xe33e('0xae')][_0xe33e('0x18f')]=function(_0x50734f,_0x31df9e,_0x8b8d6a){var _0x4924af=new History(_0x31df9e);if(_0x4924af[_0xe33e('0xef')]+_0x4924af[_0xe33e('0xf0')]+_0x4924af[_0xe33e('0xf1')]+_0x4924af['countnosuchnumberretry']+_0x4924af[_0xe33e('0xf3')]+_0x4924af[_0xe33e('0xf4')]+_0x4924af[_0xe33e('0xec')]+_0x4924af['countagentrejectretry']>=_0x8b8d6a[_0xe33e('0xf6')]-0x1){return!![];}switch(_0x50734f){case 0x3:if(_0x4924af['countnoanswerretry']>=_0x8b8d6a[_0xe33e('0x190')]-0x1){return!![];}this[_0xe33e('0xc3')]({'active':![],'countnoanswerretry':_0x4924af[_0xe33e('0xf1')]+=0x1,'scheduledat':moment()[_0xe33e('0xfa')](_0x8b8d6a[_0xe33e('0x191')],_0xe33e('0x102'))['format'](_0xe33e('0xfc')),'ContactId':_0x4924af['ContactId'],'ListId':_0x4924af[_0xe33e('0xd5')],'VoiceQueueId':_0x4924af[_0xe33e('0xd6')]||undefined,'CampaignId':_0x4924af['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x4924af[_0xe33e('0xef')]>=_0x8b8d6a['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x4924af[_0xe33e('0xef')]+=0x1,'scheduledat':moment()[_0xe33e('0xfa')](_0x8b8d6a[_0xe33e('0x192')],_0xe33e('0x102'))[_0xe33e('0x7a')](_0xe33e('0xfc')),'ContactId':_0x4924af[_0xe33e('0xfd')],'ListId':_0x4924af[_0xe33e('0xd5')],'VoiceQueueId':_0x4924af[_0xe33e('0xd6')]||undefined,'CampaignId':_0x4924af[_0xe33e('0xd7')]||undefined})[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x193')));break;case 0x8:if(_0x4924af[_0xe33e('0xf0')]>=_0x8b8d6a['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x4924af[_0xe33e('0xf0')]+=0x1,'scheduledat':moment()[_0xe33e('0xfa')](_0x8b8d6a[_0xe33e('0x194')],'minutes')[_0xe33e('0x7a')](_0xe33e('0xfc')),'ContactId':_0x4924af['ContactId'],'ListId':_0x4924af[_0xe33e('0xd5')],'VoiceQueueId':_0x4924af[_0xe33e('0xd6')]||undefined,'CampaignId':_0x4924af['CampaignId']||undefined})[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x195')));break;case 0x0:if(_0x4924af['countnosuchnumberretry']>=_0x8b8d6a[_0xe33e('0x196')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x4924af[_0xe33e('0xf2')]+=0x1,'scheduledat':moment()[_0xe33e('0xfa')](_0x8b8d6a[_0xe33e('0x197')],_0xe33e('0x102'))['format'](_0xe33e('0xfc')),'ContactId':_0x4924af[_0xe33e('0xfd')],'ListId':_0x4924af[_0xe33e('0xd5')],'VoiceQueueId':_0x4924af[_0xe33e('0xd6')]||undefined,'CampaignId':_0x4924af[_0xe33e('0xd7')]||undefined})[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x198')));}break;case 0xa:if(_0x4924af[_0xe33e('0xf3')]>=_0x8b8d6a['dialDropMaxRetry']-0x1){return!![];}this[_0xe33e('0xc3')]({'active':![],'countdropretry':_0x4924af[_0xe33e('0xf3')]+=0x1,'scheduledat':moment()[_0xe33e('0xfa')](_0x8b8d6a[_0xe33e('0x11a')],_0xe33e('0x102'))[_0xe33e('0x7a')](_0xe33e('0xfc')),'ContactId':_0x4924af[_0xe33e('0xfd')],'ListId':_0x4924af[_0xe33e('0xd5')],'VoiceQueueId':_0x4924af[_0xe33e('0xd6')]||undefined,'CampaignId':_0x4924af[_0xe33e('0xd7')]||undefined})[_0xe33e('0xb9')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x4924af[_0xe33e('0xf4')]>=_0x8b8d6a[_0xe33e('0x199')]-0x1){return!![];}this[_0xe33e('0xc3')]({'active':![],'countabandonedretry':_0x4924af[_0xe33e('0xf4')]+=0x1,'scheduledat':moment()[_0xe33e('0xfa')](_0x8b8d6a[_0xe33e('0x120')],_0xe33e('0x102'))[_0xe33e('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4924af[_0xe33e('0xfd')],'ListId':_0x4924af[_0xe33e('0xd5')],'VoiceQueueId':_0x4924af[_0xe33e('0xd6')]||undefined,'CampaignId':_0x4924af[_0xe33e('0xd7')]||undefined})[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x121')));break;case 0x13:if(_0x4924af[_0xe33e('0xec')]>=_0x8b8d6a['dialMachineMaxRetry']-0x1){return!![];}this[_0xe33e('0xc3')]({'active':![],'countmachineretry':_0x4924af[_0xe33e('0xec')]+=0x1,'scheduledat':moment()[_0xe33e('0xfa')](_0x8b8d6a[_0xe33e('0xfb')],_0xe33e('0x102'))[_0xe33e('0x7a')](_0xe33e('0xfc')),'ContactId':_0x4924af[_0xe33e('0xfd')],'ListId':_0x4924af[_0xe33e('0xd5')],'VoiceQueueId':_0x4924af[_0xe33e('0xd6')]||undefined,'CampaignId':_0x4924af[_0xe33e('0xd7')]||undefined})[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xfe')));break;case 0x14:if(_0x4924af[_0xe33e('0xf5')]>=_0x8b8d6a[_0xe33e('0x19a')]-0x1){return!![];}this[_0xe33e('0xc3')]({'active':![],'countagentrejectretry':_0x4924af['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xe33e('0xfa')](_0x8b8d6a[_0xe33e('0x19b')],_0xe33e('0x102'))[_0xe33e('0x7a')](_0xe33e('0xfc')),'ContactId':_0x4924af['ContactId'],'ListId':_0x4924af[_0xe33e('0xd5')],'VoiceQueueId':_0x4924af[_0xe33e('0xd6')]||undefined,'CampaignId':_0x4924af[_0xe33e('0xd7')]||undefined})[_0xe33e('0xb9')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0xe33e('0x18d')]=function(_0x12b8c6,_0x2f67b3,_0xa05c98){var _0x5354ef=this;var _0x1e3f30=new History(_0x12b8c6);return new BPromise(function(_0x2ba2fa,_0x181c8e){if(_[_0xe33e('0x3a')](_0x2f67b3)&&typeof _0x2f67b3!==_0xe33e('0x164')){return _0x181c8e(msgResponse(_0xe33e('0x19c'),_0xe33e('0x13e'),_0xe33e('0x19d')));}if(_['isUndefined'](_0xa05c98)&&typeof _0xa05c98!==_0xe33e('0x164')){return _0x181c8e(msgResponse('[callProgressDetecting]',_0xe33e('0x13e'),_0xe33e('0x19e')));}switch(_0xa05c98[_0xe33e('0x10a')]){case'0':_0x2f67b3['outboundNoSuchCallsDay']+=0x1;_0x1e3f30[_0xe33e('0xaa')]=0x0;_0x1e3f30[_0xe33e('0xab')]='NoSuchNumber';_0x1e3f30[_0xe33e('0xf2')]+=0x1;_0x1e3f30[_0xe33e('0xed')]+=0x1;ami['emit'](_0xe33e('0x19f'),ut[_0xe33e('0x1a0')](_0x12b8c6,_0xe33e('0x1a1')));_0x5354ef[_0xe33e('0xcd')](_0x1e3f30)[_0xe33e('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5354ef[_0xe33e('0x18f')](0x0,_0x12b8c6,_0x2f67b3)){if(_0x1e3f30[_0xe33e('0xf2')]>=_0x2f67b3[_0xe33e('0x196')]){_0x5354ef[_0xe33e('0x100')](_0x1e3f30,_0x2ba2fa,_0x181c8e,'reason\x200\x20no\x20such\x20number....');}else{_0x5354ef['stateGlobal'](_0x1e3f30,_0x2ba2fa,_0x181c8e,_0xe33e('0x1a2'));}}break;case'3':_0x2f67b3[_0xe33e('0x64')]+=0x1;_0x1e3f30[_0xe33e('0xaa')]=0x3;_0x1e3f30['statedesc']='NoAnswer';_0x1e3f30[_0xe33e('0xf1')]+=0x1;_0x1e3f30['countglobal']+=0x1;ami[_0xe33e('0x4c')]('custom:agentnoanswer',ut[_0xe33e('0x1a0')](_0x12b8c6,_0xe33e('0x1a3')));_0x5354ef['createHistory'](_0x1e3f30)['catch'](loggerCatch(_0xe33e('0x1a4')));if(_0x5354ef[_0xe33e('0x18f')](0x3,_0x12b8c6,_0x2f67b3)){if(_0x1e3f30[_0xe33e('0xf1')]>=_0x2f67b3[_0xe33e('0x190')]){_0x5354ef[_0xe33e('0x100')](_0x1e3f30,_0x2ba2fa,_0x181c8e,_0xe33e('0x1a5'));}else{_0x5354ef[_0xe33e('0xf7')](_0x1e3f30,_0x2ba2fa,_0x181c8e,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x2f67b3[_0xe33e('0x60')]+=0x1;_0x1e3f30['state']=0x5;_0x1e3f30['statedesc']=_0xe33e('0x1a6');_0x1e3f30[_0xe33e('0xef')]+=0x1;_0x1e3f30[_0xe33e('0xed')]+=0x1;ami[_0xe33e('0x4c')](_0xe33e('0x1a7'),ut[_0xe33e('0x1a0')](_0x12b8c6,_0xe33e('0x1a8')));_0x5354ef[_0xe33e('0xcd')](_0x1e3f30)['catch'](loggerCatch(_0xe33e('0x1a9')));if(_0x5354ef['checkRetriveMax'](0x5,_0x12b8c6,_0x2f67b3)){if(_0x1e3f30[_0xe33e('0xef')]>=_0x2f67b3[_0xe33e('0x1aa')]){_0x5354ef[_0xe33e('0x100')](_0x1e3f30,_0x2ba2fa,_0x181c8e,_0xe33e('0x1ab'));}else{_0x5354ef[_0xe33e('0xf7')](_0x1e3f30,_0x2ba2fa,_0x181c8e,_0xe33e('0x1ab'));}}break;case'8':_0x2f67b3[_0xe33e('0x1ac')]+=0x1;_0x1e3f30['state']=0x8;_0x1e3f30[_0xe33e('0xab')]=_0xe33e('0x1ad');_0x1e3f30[_0xe33e('0xf0')]+=0x1;_0x1e3f30[_0xe33e('0xed')]+=0x1;ami[_0xe33e('0x4c')]('custom:agentcongestion',ut[_0xe33e('0x1a0')](_0x12b8c6,_0xe33e('0x1ae')));_0x5354ef[_0xe33e('0xcd')](_0x1e3f30)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x1af')));if(_0x5354ef['checkRetriveMax'](0x8,_0x12b8c6,_0x2f67b3)){if(_0x1e3f30['countcongestionretry']>=_0x2f67b3[_0xe33e('0x1b0')]){_0x5354ef[_0xe33e('0x100')](_0x1e3f30,_0x2ba2fa,_0x181c8e,'reason\x208\x20congestion');}else{_0x5354ef[_0xe33e('0xf7')](_0x1e3f30,_0x2ba2fa,_0x181c8e,_0xe33e('0x1b1'));}}break;case'11':_0x2f67b3[_0xe33e('0x1b2')]+=0x1;_0x1e3f30['state']=0xb;_0x1e3f30['statedesc']=_0xe33e('0x122');_0x1e3f30[_0xe33e('0xf4')]+=0x1;_0x1e3f30[_0xe33e('0xed')]+=0x1;_0x5354ef[_0xe33e('0xcd')](_0x1e3f30)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x1b3')));if(_0x5354ef[_0xe33e('0x18f')](0xb,_0x12b8c6,_0x2f67b3)){if(_0x1e3f30[_0xe33e('0xf4')]>=_0x2f67b3[_0xe33e('0x199')]){_0x5354ef[_0xe33e('0x100')](_0x1e3f30,_0x2ba2fa,_0x181c8e,'reason\x2011\x20abandoned');}else{_0x5354ef['stateGlobal'](_0x1e3f30,_0x2ba2fa,_0x181c8e,_0xe33e('0x1b4'));}}break;case'20':_0x2f67b3[_0xe33e('0x66')]+=0x1;_0x1e3f30[_0xe33e('0xaa')]=0x14;_0x1e3f30['statedesc']=_0xe33e('0x1b5');_0x1e3f30[_0xe33e('0xf5')]+=0x1;_0x1e3f30[_0xe33e('0xed')]+=0x1;ami[_0xe33e('0x4c')](_0xe33e('0x1b6'),ut[_0xe33e('0x1a0')](_0x12b8c6,'agentreject'));_0x5354ef[_0xe33e('0xcd')](_0x1e3f30)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x1b7')));if(_0x5354ef[_0xe33e('0x18f')](0x14,_0x12b8c6,_0x2f67b3)){if(_0x1e3f30['countagentrejectretry']>=_0x2f67b3[_0xe33e('0x19a')]){_0x5354ef[_0xe33e('0x100')](_0x1e3f30,_0x2ba2fa,_0x181c8e,'reason\x2020\x20agentreject');}else{_0x5354ef[_0xe33e('0xf7')](_0x1e3f30,_0x2ba2fa,_0x181c8e,_0xe33e('0x1b8'));}}break;default:_0x2f67b3[_0xe33e('0x67')]+=0x1;_0x1e3f30[_0xe33e('0xaa')]=0xc;_0x1e3f30[_0xe33e('0xab')]=_0xa05c98[_0xe33e('0x10a')];_0x5354ef[_0xe33e('0xcd')](_0x1e3f30)[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x1b9')));if(_0x5354ef['checkRetriveMax'](_0xa05c98['reason'],_0x12b8c6,_0x2f67b3)){if(_0x1e3f30[_0xe33e('0xef')]+_0x1e3f30['countcongestionretry']+_0x1e3f30['countnoanswerretry']+_0x1e3f30[_0xe33e('0xf2')]+_0x1e3f30[_0xe33e('0xf3')]+_0x1e3f30['countabandonedretry']+_0x1e3f30['countmachineretry']+_0x1e3f30[_0xe33e('0xf5')]>=_0x2f67b3['dialGlobalMaxRetry']){_0x5354ef[_0xe33e('0xf7')](_0x1e3f30,_0x2ba2fa,_0x181c8e,_0xa05c98[_0xe33e('0x10a')]);}else{_0x5354ef[_0xe33e('0x100')](_0x1e3f30,_0x2ba2fa,_0x181c8e,_0xa05c98[_0xe33e('0x10a')]);}}}});};Dialer[_0xe33e('0xae')][_0xe33e('0xf7')]=function(_0x518ca5,_0x489399,_0x56b14f,_0x28199b){var _0x46f3ef=new Final(_0x518ca5);_0x46f3ef[_0xe33e('0xaa')]=0xf;_0x46f3ef[_0xe33e('0xab')]='Global';this['createStateFinal'](_0x46f3ef,_0x489399,_0x56b14f,_0x28199b);};Dialer['prototype'][_0xe33e('0x100')]=function(_0x16b2ad,_0x4b8077,_0x14e7b0,_0x85c418){this['moveContactManagedDialer'](_0x16b2ad)['then'](function(){return _0x4b8077(msgResponse(_0xe33e('0x19c'),_0xe33e('0xd9'),_0x85c418));})[_0xe33e('0xb9')](function(){return _0x14e7b0(msgResponse(_0xe33e('0x1ba'),_0xe33e('0x13e'),_0xe33e('0x1bb')));});};Dialer[_0xe33e('0xae')][_0xe33e('0x8')]=function(_0xd92208){var _0xb02f0=_0xd92208[_0xe33e('0x1bc')]/0x64;var _0x48b66c=_0xd92208[_0xe33e('0x63')]/(_0xd92208[_0xe33e('0x63')]+_0xd92208[_0xe33e('0x5e')]);var _0x56b6a9=Math[_0xe33e('0x1bd')](_0xd92208[_0xe33e('0x71')]*(_0xd92208['predictiveIntervalMaxThreshold']/0x64));var _0x271600=Math['round'](_0xd92208[_0xe33e('0x71')]*(_0xd92208[_0xe33e('0x1be')]/0x64));var _0x183212=_0xd92208[_0xe33e('0x50')]+_0xd92208['talking'];var _0xebabe9=Math[_0xe33e('0x1bf')](_0xd92208[_0xe33e('0x1c0')]*_0xd92208[_0xe33e('0x75')]*_0xd92208[_0xe33e('0x6f')]*_0xd92208[_0xe33e('0x70')]);if(_[_0xe33e('0x3a')](_0xd92208[_0xe33e('0x28')])){if(!_[_0xe33e('0x3a')](_0xd92208[_0xe33e('0x27')])){_0xd92208['startPredictive']=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xe33e('0x3a')](_0xd92208['handlePredictive'])){loggerPredictive[_0xe33e('0x96')](_0xe33e('0x1c1'),_0xe33e('0x1c2'));clearInterval(_0xd92208[_0xe33e('0x90')]);_0xd92208[_0xe33e('0x90')]=undefined;}_0xd92208[_0xe33e('0x28')]=moment()['format'](_0xe33e('0xfc'));loggerPredictive[_0xe33e('0x7f')](_0xd92208['name'],_0xe33e('0x1c3'),_0xd92208['startProgressive']);this[_0xe33e('0x155')](_0xd92208,0x1);}else if(ifInterval(_0xd92208[_0xe33e('0x1c4')],_0xd92208['startProgressive'])){this['handlePower'](_0xd92208,0x1);loggerPredictiveCalls[_0xe33e('0x7f')](_0xe33e('0x1c5'),_0xd92208['startProgressive'],_0xd92208[_0xe33e('0x3d')]);_0xd92208[_0xe33e('0x1c0')]=0x0;_0xd92208['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0xb02f0<_0x48b66c&&_0xd92208[_0xe33e('0x1c6')]===_0xe33e('0x1c7')){freeVariablesPredictive(_0xd92208);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x1c8'),_0xe33e('0x1c9'),_0x48b66c,_0xe33e('0x28'),_0xd92208[_0xe33e('0x3d')]);}else if(_0xebabe9<_0xd92208['predictiveIntervalErlangCallsDroppedCalls']&&_0xd92208['dialPredictiveOptimization']===_0xe33e('0x1c7')){freeVariablesPredictive(_0xd92208);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x1ca'),_0xe33e('0x1cb'),_0xebabe9,_0xe33e('0x1cc'),_0xd92208[_0xe33e('0x6e')],_0xe33e('0x28'),_0xd92208[_0xe33e('0x3d')]);}else if(!ifInterval(_0xd92208[_0xe33e('0x1c4')],_0xd92208['startProgressive'])&&_[_0xe33e('0x3a')](_0xd92208[_0xe33e('0x27')])&&!_[_0xe33e('0x3a')](_0xd92208[_0xe33e('0x28')])){_0xd92208['startPredictive']=moment()[_0xe33e('0x7a')](_0xe33e('0xfc'));loggerPredictive[_0xe33e('0x7f')](_0xd92208[_0xe33e('0x3d')],_0xe33e('0x1cd'),_0xd92208['startPredictive']);this[_0xe33e('0xc1')](_0xd92208[_0xe33e('0x1c4')])[_0xe33e('0xbc')](this[_0xe33e('0x1ce')](_0xd92208))['then'](mergeDataErlangB(_0xd92208))[_0xe33e('0xbc')](this['startMethodPredictive'](_0xd92208))[_0xe33e('0xb9')](loggerCatchPredictive(_0xe33e('0x1cf'),_0xd92208));}else if(!ifInterval(_0xd92208[_0xe33e('0x1c4')],_0xd92208[_0xe33e('0x27')])){_0xd92208[_0xe33e('0x6e')]=0x0;_0xd92208['startPredictive']=moment()[_0xe33e('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xe33e('0x7f')](_0xd92208[_0xe33e('0x3d')],_0xe33e('0x1d0'),_0xd92208[_0xe33e('0x27')]);clearInterval(_0xd92208[_0xe33e('0x90')]);_0xd92208[_0xe33e('0x90')]=undefined;this[_0xe33e('0xc1')](_0xd92208[_0xe33e('0x1c4')])[_0xe33e('0xbc')](this[_0xe33e('0x1ce')](_0xd92208))['then'](mergeDataErlangB(_0xd92208))['then'](this['startMethodPredictive'](_0xd92208))['catch'](loggerCatchPredictive(_0xe33e('0x1d1'),_0xd92208));}else if(_0xd92208['predictiveIntervalAvailable']&&_0x183212<_0xd92208['predictiveIntervalAvailable']-_0x271600){freeVariablesPredictive(_0xd92208);loggerPredictive[_0xe33e('0x7f')](_0xd92208[_0xe33e('0x3d')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x183212,_0xe33e('0x1d2'),_0xd92208[_0xe33e('0x71')],'-',_0x271600,'=',_0xd92208[_0xe33e('0x71')]-_0x271600,')');}else if(_0xd92208['predictiveIntervalAvailable']&&_0x183212>_0xd92208['predictiveIntervalAvailable']+_0x56b6a9){freeVariablesPredictive(_0xd92208);loggerPredictive[_0xe33e('0x7f')](_0xd92208[_0xe33e('0x3d')],_0xe33e('0x1d3'),_0x183212,')\x20are\x20more\x20than\x20threshold\x20(',_0xd92208[_0xe33e('0x71')],'+',_0x56b6a9,'=',_0xd92208[_0xe33e('0x71')]+_0x56b6a9,')');}};Dialer[_0xe33e('0xae')][_0xe33e('0x1ce')]=function(_0x565baf){var _0x15b1fe=this;return function(_0x940ef2){return new BPromise(function(_0x5a2eb5,_0x299570){_['merge'](_0x565baf,_0x940ef2[0x0]);if(checkGetDataPredictive(_0x940ef2[0x0])){var _0x4f926c=_0x565baf[_0xe33e('0x71')]=_0x565baf[_0xe33e('0xa3')]+_0x565baf[_0xe33e('0x50')];var _0xef1bb2=_0x565baf['dialPredictiveInterval']*0x3c;var _0x290424=_0x940ef2[0x0][_0xe33e('0x6a')]+_0x940ef2[0x0][_0xe33e('0x69')];var _0x15ca6f=(_0x940ef2[0x0][_0xe33e('0x68')]+_0x940ef2[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x940ef2[0x0][_0xe33e('0x6b')])/_0x940ef2[0x0][_0xe33e('0x72')];_0x565baf[_0xe33e('0x6f')]=_0x15ca6f>0x0?_0x15ca6f:0x1;switch(_0x565baf[_0xe33e('0x1c6')]){case'dropRate':var _0xbc1168=_0x565baf['dialPredictiveOptimizationPercentage']/0x64;return _0x15b1fe['abandonmentRate'](_0x4f926c,_0xef1bb2,_0x290424,_0x15ca6f,_0xbc1168)[_0xe33e('0xbc')](function(_0x4e248a){return _0x5a2eb5(_0x4e248a);});case _0xe33e('0x1d4'):var _0x565779=_0x565baf[_0xe33e('0x1bc')]/0x64;return _0x15b1fe[_0xe33e('0x1d5')](_0x4f926c,_0xef1bb2,_0x290424,_0x15ca6f,_0x565779)[_0xe33e('0xbc')](function(_0x5308e0){return _0x5a2eb5(_0x5308e0);});default:return _0x299570(msgResponse(_0xe33e('0x1d6'),'Failure',_0xe33e('0x1d7')));}}else{return _0x299570(msgResponse(_0xe33e('0x1d6'),_0xe33e('0x13e'),_0xe33e('0x1d8')));}});};};Dialer[_0xe33e('0xae')]['getDataPredictiveOld']=function(_0x3b4d59){var _0x105b82=this;return function(_0x3b6cad){return new BPromise(function(_0x34bded,_0x201b32){_[_0xe33e('0x8d')](_0x3b4d59,_0x3b6cad[0x0]);if(checkGetDataPredictive(_0x3b6cad[0x0])){loggerPredictive[_0xe33e('0x7f')](JSON['stringify'](_0x3b6cad[0x0]));if(_0x3b4d59[_0xe33e('0x1c6')]==='dropRate'){return _0x105b82['getVoiceQueueRtPauses'](_0x3b4d59['id'])[_0xe33e('0xbc')](function(_0x8ad8a5){var _0x494ace=_0x3b4d59[_0xe33e('0x15c')]-_0x8ad8a5[0x0][_0xe33e('0x1d9')];var _0x1758d8=_0x3b4d59[_0xe33e('0x1c4')]*0x3c;var _0x431529=_0x3b6cad[0x0][_0xe33e('0x6a')]+_0x3b6cad[0x0]['predictiveIntervalAvgHoldtime'];var _0x3ab1c0=(_0x3b6cad[0x0]['predictiveIntervalAnsweredCalls']+_0x3b6cad[0x0][_0xe33e('0x6c')]+_0x3b6cad[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3b6cad[0x0][_0xe33e('0x72')];var _0x116dd5=_0x3b4d59['dialPredictiveOptimizationPercentage']/0x64;_0x3b4d59[_0xe33e('0x1da')]=_0x8ad8a5[0x0][_0xe33e('0x1d9')]||0x0;_0x3b4d59[_0xe33e('0x6f')]=_0x3ab1c0>0x0?_0x3ab1c0:0x1;return _0x105b82['abandonmentRate'](_0x494ace,_0x1758d8,_0x431529,_0x3ab1c0,_0x116dd5);})[_0xe33e('0xbc')](function(_0x8725ed){return _0x34bded(_0x8725ed);})[_0xe33e('0xb9')](function(_0x3cf7ab){return _0x201b32(msgResponse(_0xe33e('0x1db'),_0xe33e('0x13e'),JSON[_0xe33e('0x48')](_0x3cf7ab)));});}if(_0x3b4d59[_0xe33e('0x1c6')]==='agentBusyFactor'){return _0x105b82[_0xe33e('0xc9')](_0x3b4d59['id'])[_0xe33e('0xbc')](function(_0x5481c9){var _0xa2a826=_0x3b4d59[_0xe33e('0x15c')]-_0x5481c9[0x0][_0xe33e('0x1d9')];var _0x21b0d3=_0x3b4d59[_0xe33e('0x1c4')]*0x3c;var _0x4b56c9=_0x3b6cad[0x0][_0xe33e('0x6a')]+_0x3b6cad[0x0][_0xe33e('0x69')];var _0x9df157=(_0x3b6cad[0x0]['predictiveIntervalAnsweredCalls']+_0x3b6cad[0x0][_0xe33e('0x6c')]+_0x3b6cad[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3b6cad[0x0]['predictiveIntervalTotalCalls'];var _0x90f143=_0x3b4d59[_0xe33e('0x1bc')]/0x64;_0x3b4d59[_0xe33e('0x1da')]=_0x5481c9[0x0]['outboundQueuePauses']||0x0;_0x3b4d59[_0xe33e('0x6f')]=_0x9df157>0x0?_0x9df157:0x1;return _0x105b82['busyFactor'](_0xa2a826,_0x21b0d3,_0x4b56c9,_0x9df157,_0x90f143);})['then'](function(_0x2ec30e){return _0x34bded(_0x2ec30e);})[_0xe33e('0xb9')](function(_0x14ddf8){return _0x201b32(msgResponse(_0xe33e('0x1db'),'Failure',JSON[_0xe33e('0x48')](_0x14ddf8)));});}}else{return _0x201b32(msgResponse(_0xe33e('0x1d6'),_0xe33e('0x13e'),'check\x20failure'));}});};};Dialer[_0xe33e('0xae')][_0xe33e('0x1dc')]=function(_0x4c09c0){var _0x4ba9ff=this;return function(){var _0x419105=0x0;var _0x505c52=Math[_0xe33e('0x1bf')](_0x4c09c0[_0xe33e('0x74')]*0x3e8);if(_0x505c52>0x0){_0x505c52=_0x505c52<0x64?0x64:_0x505c52;loggerPredictive[_0xe33e('0x7f')](_0x4c09c0['name'],'one\x20call\x20every:',_0x505c52,'milliseconds');_0x4c09c0[_0xe33e('0x90')]=setInterval(function(){_0x4ba9ff[_0xe33e('0x90')](_0x4c09c0);loggerPredictiveCalls[_0xe33e('0x7f')](_0xe33e('0x1dd'),_0x419105+=0x1);},_0x505c52);}else{loggerPredictive[_0xe33e('0x7f')](_0x4c09c0[_0xe33e('0x3d')],_0xe33e('0x1de'));}};};Dialer[_0xe33e('0xae')][_0xe33e('0x1df')]=function(_0x3a560d,_0x401815){var _0x4308e6=this;return function(_0x898ccd){if(_['isEmpty'](_0x898ccd)){if(_['isNil'](_0x401815['UserId'])||!_0x401815['recallme']){if(_0x3a560d[_0xe33e('0x58')]==='booked'){_0x3a560d[_0xe33e('0x127')]=_['isUndefined'](_0x3a560d['queueStatusComplete'])?!![]:_0x3a560d['queueStatusComplete'];var _0x42bda9=uuid['v4']();_0x4308e6['actions'][_0x42bda9]=new Action(_0x3a560d,_0x401815,_0x42bda9);loggerBooked[_0xe33e('0x7f')](_0xe33e('0x1e0'),_0x42bda9,'queueStatusComplete:\x20',JSON[_0xe33e('0x48')](_0x3a560d['queueStatusComplete']),_0xe33e('0x1e1'),_0x3a560d[_0xe33e('0x3d')]);if(_0x3a560d[_0xe33e('0x127')]){_0x3a560d['queueStatusComplete']=![];_0x4308e6[_0xe33e('0x126')][_0x4308e6[_0xe33e('0x24')][_0x42bda9][_0xe33e('0xb6')]]=[];ami['Action']({'actionid':_0x42bda9,'action':_0xe33e('0x1e2'),'queue':_0x3a560d[_0xe33e('0x3d')]})[_0xe33e('0xb9')](function(){_0x4308e6[_0xe33e('0xb5')](_0x3a560d);_0x4308e6[_0xe33e('0xc3')]({'active':![],'ContactId':_0x4308e6[_0xe33e('0x24')][_0x42bda9][_0xe33e('0xfd')],'ListId':_0x4308e6['actions'][_0x42bda9][_0xe33e('0xd5')],'VoiceQueueId':_0x4308e6[_0xe33e('0x24')][_0x42bda9]['VoiceQueueId']||undefined,'CampaignId':_0x4308e6[_0xe33e('0x24')][_0x42bda9][_0xe33e('0xd7')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4308e6[_0xe33e('0x24')][_0x42bda9];});}else{loggerBooked[_0xe33e('0x7f')](_0xe33e('0x1e3'),JSON[_0xe33e('0x48')](_0x3a560d[_0xe33e('0x127')]),_0xe33e('0x1e1'),_0x3a560d[_0xe33e('0x3d')]);_0x4308e6['updateOriginated'](_0x3a560d);_0x4308e6[_0xe33e('0xc3')]({'active':![],'ContactId':_0x4308e6[_0xe33e('0x24')][_0x42bda9][_0xe33e('0xfd')],'ListId':_0x4308e6[_0xe33e('0x24')][_0x42bda9][_0xe33e('0xd5')],'VoiceQueueId':_0x4308e6[_0xe33e('0x24')][_0x42bda9][_0xe33e('0xd6')]||undefined,'CampaignId':_0x4308e6[_0xe33e('0x24')][_0x42bda9][_0xe33e('0xd7')]||undefined})[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x1e4')));delete _0x4308e6[_0xe33e('0x24')][_0x42bda9];}}else{return _0x4308e6[_0xe33e('0x1e5')](_0x3a560d,_0x401815);}}else{if(getDiff(_0x401815['scheduledat'])<_0x3a560d['dialRecallMeTimeout']*0x3c){if(_0x401815[_0xe33e('0x1e6')]&&!_0x401815[_0xe33e('0x1e6')][_0xe33e('0x1e7')]){_0x4308e6[_0xe33e('0x1e')]['run'](_0x401815['id'])[_0xe33e('0x1c')](function(){_0x4308e6[_0xe33e('0xb5')](_0x3a560d);});}else{_0x4308e6['unlockContact']({'active':![]},_0x401815['id'],0x1)[_0xe33e('0x1c')](function(){_0x4308e6['updateOriginated'](_0x3a560d);});}}else{_0x3a560d['outboundReCallsDay']+=0x1;_0x4308e6[_0xe33e('0xb5')](_0x3a560d);if(_0x3a560d[_0xe33e('0x1e8')]){_0x4308e6['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x401815[_0xe33e('0xfd')],'ListId':_0x401815[_0xe33e('0xd5')],'VoiceQueueId':_0x401815['VoiceQueueId']||undefined,'CampaignId':_0x401815[_0xe33e('0xd7')]||undefined})[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x1e9')));_0x4308e6[_0xe33e('0xcd')](createObjHistory(_0x3a560d,_0x401815,'RECALLINQUEUE',0x17,_0xe33e('0x1ea')))[_0xe33e('0xb9')](loggerCatch(_0xe33e('0x1eb')));}else{_0x4308e6[_0xe33e('0xd3')](createObjHistory(_0x3a560d,_0x401815,'RECALLFAILEDTIMEOUT',0x16,_0xe33e('0x1ec')),_0xe33e('0x1ed'),_0xe33e('0x1ee'));}}}}else{_0x3a560d['outboundBlacklistCallsDay']+=0x1;_0x4308e6['saveInDb'](createObjHistory(_0x3a560d,_0x401815,_0xe33e('0x1ef'),0xd,_0xe33e('0x1f0')),_0xe33e('0x1f1'),'[Originate][MoveBlacklist]');throw _0xe33e('0x1f2');}};};Dialer[_0xe33e('0xae')][_0xe33e('0x15a')]=function(_0x4ade86){var _0x5810d3=this;var _0x3c5731=_0x4ade86[_0xe33e('0x1f3')]-_0x4ade86[_0xe33e('0x73')]-_0x4ade86[_0xe33e('0x1f4')];emitCampaignSummary(_0x4ade86);if(_0x3c5731>0x0){if(_0x3c5731>this['maxNumberOriginate']){_0x3c5731=this[_0xe33e('0x23')];}_0x4ade86[_0xe33e('0x1f4')]+=_0x3c5731;this[_0xe33e('0xc8')](_0x4ade86['id'],_0x3c5731,_0x4ade86['dialOrderByScheduledAt'])[_0xe33e('0xbc')](function(_0x43947d){_0x4ade86[_0xe33e('0x1f4')]-=_0x3c5731;_0x4ade86[_0xe33e('0x1f4')]=_0x4ade86['temp']>0x0?_0x4ade86['temp']:0x0;if(!checkContactEmpty(_0x43947d)){_0x4ade86[_0xe33e('0x3b')]=_0xe33e('0xa0');logger[_0xe33e('0x7f')](_0xe33e('0x1f5')+_0x4ade86[_0xe33e('0x3d')]);}else{_0x4ade86[_0xe33e('0x73')]+=_0x43947d[_0xe33e('0x98')];_0x4ade86[_0xe33e('0x3b')]=_0xe33e('0x1f6');for(var _0x227348=0x0;_0x227348<_0x43947d['length'];_0x227348+=0x1){_0x4ade86[_0xe33e('0x1f7')]+=0x1;if(_[_0xe33e('0xde')](_0x43947d[_0x227348])||_['isNil'](_0x43947d[_0x227348][_0xe33e('0x165')])||_['isNil'](_0x43947d[_0x227348][_0xe33e('0x165')][_0xe33e('0x166')])){_0x5810d3[_0xe33e('0xd1')](_0xe33e('0x1f8'),_0x4ade86,_0x43947d[_0x227348]);}else{_0x5810d3[_0xe33e('0xbe')](_['pick'](_0x43947d[_0x227348],['CampaignId',_0xe33e('0x1f9')]))[_0xe33e('0xbc')](_0x5810d3[_0xe33e('0x1df')](_0x4ade86,_0x43947d[_0x227348]))[_0xe33e('0xb9')](_0x5810d3[_0xe33e('0xd0')](_0xe33e('0x1fa'),_0x4ade86));}}}})[_0xe33e('0xb9')](loggerGetContactDialer(_0xe33e('0x1fb'),_0x4ade86,_0x3c5731));}};Dialer[_0xe33e('0xae')][_0xe33e('0x155')]=function(_0x66a1ea,_0x1974e9){var _0x1fafd3=this;var _0xd8cb12=[];var _0x2c548e=_0x1974e9>=0x1?_0x1974e9:0x1;if(_0x66a1ea[_0xe33e('0x58')]==='booked'){_0x2c548e=0x1;}var _0x2fb253=Math['floor'](_0x66a1ea[_0xe33e('0x50')]*_0x2c548e)-_0x66a1ea[_0xe33e('0x73')]-_0x66a1ea[_0xe33e('0x1f4')];emitVoiceQueueSummary(_0x66a1ea);if(_0x66a1ea[_0xe33e('0x1fc')]>0x0){var _0x1a59ba=_0x66a1ea[_0xe33e('0x1fc')]-_0x66a1ea['originated']-_0x66a1ea[_0xe33e('0xa3')]-_0x66a1ea[_0xe33e('0x1f4')]-_0x66a1ea[_0xe33e('0x51')];if(_0x2fb253>_0x1a59ba){_0x2fb253=_0x1a59ba;}}if(_0x2fb253>0x0){if(_0x66a1ea[_0xe33e('0x58')]===_0xe33e('0x7')){_0x2fb253=0x1;}if(_0x2fb253>this[_0xe33e('0x23')]){_0x2fb253=this[_0xe33e('0x23')];}_0x66a1ea['temp']+=_0x2fb253;for(var _0x5ba02e in this[_0xe33e('0x21')]){if(typeof this[_0xe33e('0x21')][_0x5ba02e]!==_0xe33e('0x99')){if(this['agents'][_0x5ba02e][_0xe33e('0xaa')]===_0xe33e('0x1fd')&&this[_0xe33e('0x21')][_0x5ba02e][_0xe33e('0xdd')]==='reachable'){_0xd8cb12[_0xe33e('0x143')](this['agents'][_0x5ba02e]['id']);}}}this[_0xe33e('0xc6')](_0x66a1ea['id'],_0xd8cb12,_0x2fb253,_0x66a1ea[_0xe33e('0x1fe')])['then'](function(_0x4d27cf){_0x66a1ea['temp']-=_0x2fb253;_0x66a1ea[_0xe33e('0x1f4')]=_0x66a1ea[_0xe33e('0x1f4')]>0x0?_0x66a1ea[_0xe33e('0x1f4')]:0x0;if(!checkContactEmpty(_0x4d27cf)){_0x1fafd3[_0xe33e('0xb8')](_0x66a1ea)[_0xe33e('0xbc')](sendMessageReschedule(_0x66a1ea))[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xba')));}else{_0x66a1ea[_0xe33e('0x73')]+=_0x4d27cf[_0xe33e('0x98')];_0x66a1ea[_0xe33e('0x3b')]=_0x66a1ea['dialMethod']==='booked'?_0xe33e('0x16e'):_0xe33e('0x1f6');for(var _0x571a83=0x0;_0x571a83<_0x4d27cf[_0xe33e('0x98')];_0x571a83+=0x1){if(_[_0xe33e('0xde')](_0x4d27cf[_0x571a83])||_[_0xe33e('0xde')](_0x4d27cf[_0x571a83][_0xe33e('0x165')])||_[_0xe33e('0xde')](_0x4d27cf[_0x571a83][_0xe33e('0x165')][_0xe33e('0x166')])){_0x1fafd3[_0xe33e('0xd1')](_0xe33e('0x1f8'),_0x66a1ea,_0x4d27cf[_0x571a83]);}else{_0x1fafd3[_0xe33e('0xbb')](_['pick'](_0x4d27cf[_0x571a83],[_0xe33e('0xd6'),_0xe33e('0x1f9')]))[_0xe33e('0xbc')](_0x1fafd3[_0xe33e('0x1df')](_0x66a1ea,_0x4d27cf[_0x571a83]))[_0xe33e('0xb9')](_0x1fafd3['loggerHandler'](_0xe33e('0x1f8'),_0x66a1ea));}}}})[_0xe33e('0xb9')](loggerGetContactDialer('[getContactDialer2]',_0x66a1ea,_0x2fb253));}};Dialer['prototype']['handlePredictive']=function(_0x15fb49){if(_0x15fb49[_0xe33e('0x1fc')]>0x0){var _0x2b9596=_0x15fb49[_0xe33e('0x1fc')]-_0x15fb49['originated']-_0x15fb49[_0xe33e('0xa3')];if(_0x2b9596>0x0){this[_0xe33e('0x1ff')](_0x15fb49);}else{loggerPredictiveCalls[_0xe33e('0x7f')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x15fb49);}};Dialer[_0xe33e('0xae')]['tryOriginatePredictive']=function(_0x2f9df8){var _0x2a98e7=this;var _0x2f6e0b=[];_0x2f9df8[_0xe33e('0x73')]+=0x1;for(var _0x327f94 in this[_0xe33e('0x21')]){if(typeof this[_0xe33e('0x21')][_0x327f94]!==_0xe33e('0x99')){if(this[_0xe33e('0x21')][_0x327f94][_0xe33e('0xaa')]==='not_inuse'&&this[_0xe33e('0x21')][_0x327f94][_0xe33e('0xdd')]===_0xe33e('0x200')){_0x2f6e0b[_0xe33e('0x143')](this[_0xe33e('0x21')][_0x327f94]['id']);}}}this[_0xe33e('0xc6')](_0x2f9df8['id'],_0x2f6e0b,0x1,_0x2f9df8[_0xe33e('0x1fe')])[_0xe33e('0xbc')](function(_0x5d2a40){if(!checkContactEmpty(_0x5d2a40)){checkContactLowerLimitOriginate(_0x2f9df8,0x1,0x0);_0x2a98e7[_0xe33e('0xb8')](_0x2f9df8)[_0xe33e('0xbc')](sendMessageReschedule(_0x2f9df8))[_0xe33e('0xb9')](loggerCatch(_0xe33e('0xba')));}else{_0x2f9df8[_0xe33e('0x3b')]='RUNNING';if(_[_0xe33e('0xde')](_0x5d2a40[0x0])||_[_0xe33e('0xde')](_0x5d2a40[0x0]['Contact'])||_[_0xe33e('0xde')](_0x5d2a40[0x0][_0xe33e('0x165')][_0xe33e('0x166')])){_0x2a98e7[_0xe33e('0xd1')](_0xe33e('0x1f8'),_0x2f9df8,_0x5d2a40[0x0]);}else{_0x2a98e7[_0xe33e('0xbb')](_[_0xe33e('0xd4')](_0x5d2a40[0x0],['VoiceQueueId','Contact.phone']))[_0xe33e('0xbc')](_0x2a98e7[_0xe33e('0x1df')](_0x2f9df8,_0x5d2a40[0x0]))[_0xe33e('0xb9')](_0x2a98e7['loggerHandler'](_0xe33e('0x201'),_0x2f9df8));}}})[_0xe33e('0xb9')](loggerGetContactDialer(_0xe33e('0x202'),_0x2f9df8,0x1));emitVoiceQueueSummary(_0x2f9df8);};Dialer[_0xe33e('0xae')][_0xe33e('0x203')]=function(_0x1d7865,_0x599f2e,_0x32e45d,_0x876cdc,_0x287575,_0x440c16){loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x204'));loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x205'),_0x1d7865);loggerPredictive[_0xe33e('0x7f')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x599f2e);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x32e45d);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x206'),_0x876cdc);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x207'),_0x287575);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x84'));return new BPromise(function(_0x549bd0,_0x2f5d4e){if(_0x1d7865<=0x0||isNaN(_0x1d7865)){return _0x2f5d4e(msgResponse(_0xe33e('0x208'),_0xe33e('0x47'),_0xe33e('0x209')+_0x1d7865));}if(_0x32e45d<=0x0||isNaN(_0x32e45d)){return _0x2f5d4e(msgResponse(_0xe33e('0x208'),_0xe33e('0x47'),_0xe33e('0x20a')+_0x32e45d));}if(_0x876cdc<=0x0||isNaN(_0x876cdc)){return _0x2f5d4e(msgResponse('[abandonmentRate]','Error',_0xe33e('0x20b')+_0x876cdc));}if(_0x599f2e<=0x0||isNaN(_0x599f2e)){return _0x2f5d4e(msgResponse(_0xe33e('0x208'),_0xe33e('0x47'),'interval\x20=\x20'+_0x599f2e));}if(_0x287575<=0x0||isNaN(_0x287575)){return _0x2f5d4e(msgResponse(_0xe33e('0x208'),_0xe33e('0x47'),_0xe33e('0x20c')+_0x287575));}_0x440c16=_0x440c16||0x0;var _0x356387=0x1/_0x32e45d;var _0x755f5=0x0;var _0x26a6dc=0x0;var _0x4c6dd3=0x0;var _0x43d262=0x0;for(var _0x19c4ff=0x0;_0x4c6dd3<_0x287575;_0x19c4ff+=0x1){_0x26a6dc=_0x19c4ff/_0x599f2e;_0x755f5=(_0x876cdc*_0x26a6dc+_0x440c16)/_0x356387;_0x4c6dd3=erlangb(_0x755f5,_0x1d7865);_0x43d262=_0x755f5/_0x1d7865*(0x1-erlangb(_0x755f5,_0x1d7865));}return _0x549bd0({'erlangCalls':_0x19c4ff,'erlangCallToSecond':_0x599f2e/_0x19c4ff,'erlangAbandonmentRate':_0x4c6dd3,'erlangBusyFactor':_0x43d262});});};Dialer[_0xe33e('0xae')]['busyFactor']=function(_0x1e516b,_0x572099,_0x513f06,_0x482ecc,_0x1b2e5e,_0x124563){loggerPredictive[_0xe33e('0x7f')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x205'),_0x1e516b);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x20d'),_0x572099);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x20e'),_0x513f06);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x206'),_0x482ecc);loggerPredictive[_0xe33e('0x7f')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b2e5e);loggerPredictive[_0xe33e('0x7f')](_0xe33e('0x84'));return new BPromise(function(_0xdcd8a7,_0x18aad2){if(_0x1e516b<=0x0||isNaN(_0x1e516b)){return _0x18aad2(msgResponse(_0xe33e('0x20f'),_0xe33e('0x47'),'m\x20=\x20'+_0x1e516b));}if(_0x513f06<=0x0||isNaN(_0x513f06)){return _0x18aad2(msgResponse(_0xe33e('0x20f'),_0xe33e('0x47'),_0xe33e('0x20a')+_0x513f06));}if(_0x482ecc<=0x0||isNaN(_0x482ecc)){return _0x18aad2(msgResponse(_0xe33e('0x20f'),_0xe33e('0x47'),'p\x20=\x20'+_0x482ecc));}if(_0x572099<=0x0||isNaN(_0x572099)){return _0x18aad2(msgResponse(_0xe33e('0x20f'),_0xe33e('0x47'),_0xe33e('0x210')+_0x572099));}if(_0x1b2e5e<=0x0||isNaN(_0x1b2e5e)){return _0x18aad2(msgResponse('[busyFactor]',_0xe33e('0x47'),_0xe33e('0x211')+_0x1b2e5e));}_0x124563=_0x124563||0x0;var _0x411e1f=0x1/_0x513f06;var _0x1d3065=0x0;var _0x106caa=0x0;var _0x2759e1=0x0;var _0x34c3aa=0x0;for(var _0x40c05d=0x0;_0x34c3aa<_0x1b2e5e;_0x40c05d+=0x1){_0x106caa=_0x40c05d/_0x572099;_0x1d3065=(_0x482ecc*_0x106caa+_0x124563)/_0x411e1f;_0x2759e1=erlangb(_0x1d3065,_0x1e516b);_0x34c3aa=_0x1d3065/_0x1e516b*(0x1-erlangb(_0x1d3065,_0x1e516b));}return _0xdcd8a7({'erlangCalls':_0x40c05d,'erlangCallToSecond':_0x572099/_0x40c05d,'erlangAbandonmentRate':_0x2759e1,'erlangBusyFactor':_0x34c3aa});});};module[_0xe33e('0x212')]=Dialer; \ No newline at end of file +var _0xfb4f=['XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','outboundNoSuchCallsDay','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','predictiveIntervalDroppedCallsCallersExit','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','not_inuse','dialOrderByScheduledAt','RUNNING','Contact.phone','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','ivr','format','campaign:ivr:%s','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','talking','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','statedesc','endtime','starttime','prototype','clearZombieChannels','actions','isNil','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','variable','amdstatus','exten','dialAMDActive','HANGUP','HangupInAMD','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','state','AMD','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','Machine','countbusyretry','countcongestionretry','stateGlobal','ContactId','[syncHangupIvr]','AnswerAGI','AGI','[syncHangupIvr][createHistory]','dialQueueProject','Unknow','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','timezones','content','push','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber'];(function(_0x4accb7,_0x282f2b){var _0x167b88=function(_0xea568d){while(--_0xea568d){_0x4accb7['push'](_0x4accb7['shift']());}};_0x167b88(++_0x282f2b);}(_0xfb4f,0x8c));var _0xffb4=function(_0x1e65bf,_0x1fdc3c){_0x1e65bf=_0x1e65bf-0x0;var _0x852b7a=_0xfb4f[_0x1e65bf];return _0x852b7a;};'use strict';var util=require(_0xffb4('0x0'));var _=require(_0xffb4('0x1'));var BPromise=require(_0xffb4('0x2'));var uuid=require(_0xffb4('0x3'));var moment=require(_0xffb4('0x4'));var rr=require('rr');var md5=require(_0xffb4('0x5'));var Redis=require(_0xffb4('0x6'));var ut=require(_0xffb4('0x7'));var config=require('../../../config/environment/');var logger=require(_0xffb4('0x8'))(_0xffb4('0x9'));var loggerBooked=require(_0xffb4('0x8'))(_0xffb4('0xa'));var loggerPredictive=require('../../../config/logger')(_0xffb4('0xb'));var loggerPredictiveCalls=require(_0xffb4('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xffb4('0x8'))(_0xffb4('0xc'));var ami=require(_0xffb4('0xd'));config[_0xffb4('0xe')]=_[_0xffb4('0xf')](config[_0xffb4('0xe')],{'host':_0xffb4('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xffb4('0xe')]));var cmHopper=require(_0xffb4('0x11'));var cmHopperHistory=require(_0xffb4('0x12'));var cmHopperBlack=require(_0xffb4('0x13'));var voiceQueueRt=require(_0xffb4('0x14'));var Action=require(_0xffb4('0x15'));var History=require(_0xffb4('0x16'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xffb4('0x17'));var Hangup=require(_0xffb4('0x18'));var ipAgi=process[_0xffb4('0x19')][_0xffb4('0x1a')]||_0xffb4('0x1b');var strategy={'rrmemory':_0xffb4('0x1c'),'roundrobin':_0xffb4('0x1d')};var Sequence=function(){};Sequence['prototype'][_0xffb4('0x1e')]=function(_0x1bde87){this['tail']=this[_0xffb4('0x1f')]?this[_0xffb4('0x1f')][_0xffb4('0x20')](_0x1bde87):_0x1bde87();};function Dialer(_0x38381d,_0x42c9b8){this[_0xffb4('0x21')]=new Sequence();this[_0xffb4('0x22')]=_0x42c9b8;this[_0xffb4('0x23')]=_0x38381d[_0xffb4('0x23')];this['campaigns']=_0x38381d[_0xffb4('0x24')];this[_0xffb4('0x25')]=_0x38381d[_0xffb4('0x25')];this[_0xffb4('0x26')]=_0x38381d[_0xffb4('0x26')];this[_0xffb4('0x27')]=config['maxNumberOriginate']||0x2;this[_0xffb4('0x28')]={};this['actions']={};this['contactsId']={};this[_0xffb4('0x29')]={};this['optionPredictive']={};this[_0xffb4('0x2a')]={};this[_0xffb4('0x2b')]={};this[_0xffb4('0x2c')]={};this[_0xffb4('0x2d')]={};this[_0xffb4('0x2e')]={};ami['on'](_0xffb4('0x2f'),this['syncAgentConnect'][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x31'),this[_0xffb4('0x32')][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x33'),this[_0xffb4('0x34')][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x35'),this['syncAgentComplete'][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x36'),this[_0xffb4('0xc')][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x37'),this[_0xffb4('0x38')]['bind'](this));ami['on'](_0xffb4('0x39'),this[_0xffb4('0x3a')][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x3b'),this[_0xffb4('0x3c')][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x3d'),this[_0xffb4('0x3e')][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x3f'),this[_0xffb4('0x40')]['bind'](this));this[_0xffb4('0x41')]();this[_0xffb4('0x42')]();}function isNotNull(_0x71b359){return _0x71b359!==null&&!_[_0xffb4('0x43')](_0x71b359);}function checkIsLoggedIn(_0x1d2af3,_0x527d14){return function(){if(_0x527d14<=0x0){_0x1d2af3[_0xffb4('0x44')]='AGENTS_NOT_LOGGED';throw _0x1d2af3[_0xffb4('0x45')]+_0xffb4('0x46');}};}function isActive(_0x193318){return _0x193318;}function checkIsActive(_0x459020,_0x3fed71){return function(){if(!isActive(_0x3fed71)){_0x459020['message']=_0xffb4('0x47');throw _0x459020[_0xffb4('0x45')]+'\x20NOT\x20Active';}};}function checkInterval(_0x1e7feb){return function(){if(!isNotNull(_0x1e7feb[_0xffb4('0x48')])){_0x1e7feb['message']=_0xffb4('0x49');throw _0x1e7feb['name']+_0xffb4('0x4a');}if(!isNotNull(_0x1e7feb[_0xffb4('0x48')][_0xffb4('0x4b')])){_0x1e7feb[_0xffb4('0x44')]='INTERVAL_IS_NULL';throw _0x1e7feb[_0xffb4('0x45')]+_0xffb4('0x4a');}if(!isNotNull(_['isEmpty'](_0x1e7feb['Interval'][_0xffb4('0x4b')]))){_0x1e7feb[_0xffb4('0x44')]=_0xffb4('0x49');throw _0x1e7feb['name']+_0xffb4('0x4a');}};}function msgResponse(_0x333ad2,_0x591bbb,_0xb7dc11){return{'action':_0x333ad2,'response':_0x591bbb,'message':_0xb7dc11,'stack':_0xb7dc11};}function myreject(_0x337a48){return function(_0x4f80e7){return _0x337a48(msgResponse('[ifTime][Action]',_0xffb4('0x4c'),JSON[_0xffb4('0x4d')](_0x4f80e7)));};}function getSeconds(_0x295271,_0x25adbc){var _0x13991c=moment(_0x295271)[_0xffb4('0x4e')](0x0);var _0x2daf07=moment(_0x25adbc)['milliseconds'](0x0);return _0x13991c[_0xffb4('0x4f')](_0x2daf07,_0xffb4('0x50'));}function emit(_0x429832,_0x4b4ee1,_0x4c4368){io['to'](_0x429832)[_0xffb4('0x51')](_0x4b4ee1,_0x4c4368);}function emitVoiceQueueSummary(_0x1e5fc5){if(_0x1e5fc5[_0xffb4('0x52')]===_0xffb4('0x53')){var _0x43982e={'id':_0x1e5fc5['id'],'name':_0x1e5fc5[_0xffb4('0x45')],'strategy':_0x1e5fc5[_0xffb4('0x54')],'answered':_0x1e5fc5[_0xffb4('0x55')],'available':_0x1e5fc5[_0xffb4('0x56')],'loggedIn':_0x1e5fc5[_0xffb4('0x57')],'pTalking':_0x1e5fc5[_0xffb4('0x58')],'sumBillable':_0x1e5fc5[_0xffb4('0x59')],'sumDuration':_0x1e5fc5['sumDuration'],'sumHoldTime':_0x1e5fc5[_0xffb4('0x5a')]||0x0,'talking':_0x1e5fc5['talking'],'total':_0x1e5fc5[_0xffb4('0x5b')],'type':_0x1e5fc5['type'],'unmanaged':_0x1e5fc5[_0xffb4('0x5c')],'abandoned':_0x1e5fc5[_0xffb4('0x5d')],'waiting':_0x1e5fc5[_0xffb4('0x5e')],'loggedInDb':_0x1e5fc5[_0xffb4('0x5f')],'dialActive':_0x1e5fc5[_0xffb4('0x60')],'dialMethod':_0x1e5fc5[_0xffb4('0x61')],'dialOriginateCallerIdName':_0x1e5fc5[_0xffb4('0x62')],'dialOriginateCallerIdNumber':_0x1e5fc5[_0xffb4('0x63')],'dialOriginateTimeout':_0x1e5fc5[_0xffb4('0x64')],'dialPrefix':_0x1e5fc5[_0xffb4('0x65')],'outboundAnswerAgiCallsDay':_0x1e5fc5[_0xffb4('0x66')],'outboundAnswerCallsDay':_0x1e5fc5[_0xffb4('0x67')],'outboundBlacklistCallsDay':_0x1e5fc5[_0xffb4('0x68')],'outboundBusyCallsDay':_0x1e5fc5['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1e5fc5[_0xffb4('0x69')],'outboundDropCallsDayACS':_0x1e5fc5['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1e5fc5[_0xffb4('0x6a')],'outboundDropCallsDayTimeout':_0x1e5fc5[_0xffb4('0x6b')],'outboundNoAnswerCallsDay':_0x1e5fc5[_0xffb4('0x6c')],'outboundNoSuchCallsDay':_0x1e5fc5['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1e5fc5['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1e5fc5[_0xffb4('0x6d')],'outboundRejectCallsDay':_0x1e5fc5['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1e5fc5[_0xffb4('0x6e')],'predictiveIntervalAnsweredCalls':_0x1e5fc5[_0xffb4('0x6f')],'predictiveIntervalAvgHoldtime':_0x1e5fc5[_0xffb4('0x70')],'predictiveIntervalAvgTalktime':_0x1e5fc5['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1e5fc5['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1e5fc5['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1e5fc5[_0xffb4('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x1e5fc5[_0xffb4('0x72')],'predictiveIntervalHitRate':_0x1e5fc5[_0xffb4('0x73')],'predictiveIntervalMultiplicativeFactor':_0x1e5fc5[_0xffb4('0x74')],'predictiveIntervalPauses':_0x1e5fc5[_0xffb4('0x75')],'predictiveIntervalAvailable':_0x1e5fc5[_0xffb4('0x76')],'predictiveIntervalTotalCalls':_0x1e5fc5[_0xffb4('0x77')],'message':_0x1e5fc5[_0xffb4('0x44')],'originated':_0x1e5fc5[_0xffb4('0x78')],'erlangCalls':_0x1e5fc5[_0xffb4('0x79')],'erlangCallToSecond':_0x1e5fc5[_0xffb4('0x7a')],'erlangAbandonmentRate':_0x1e5fc5[_0xffb4('0x7b')],'erlangBusyFactor':_0x1e5fc5[_0xffb4('0x7c')],'startPredictive':_0x1e5fc5[_0xffb4('0x2a')],'startProgressive':_0x1e5fc5['startProgressive']};if(_0x1e5fc5['Trunk']){_0x43982e[_0xffb4('0x7d')]={'id':_0x1e5fc5[_0xffb4('0x7d')]['id'],'name':_0x1e5fc5[_0xffb4('0x7d')]['name'],'active':_0x1e5fc5['Trunk']['active'],'callerid':_0x1e5fc5[_0xffb4('0x7d')][_0xffb4('0x7e')]};}if(_0x1e5fc5[_0xffb4('0x48')]){_0x43982e[_0xffb4('0x48')]={'id':_0x1e5fc5['Interval']['id'],'name':_0x1e5fc5[_0xffb4('0x48')][_0xffb4('0x45')]};}var _0x1f46cc=md5(JSON[_0xffb4('0x4d')](_0x43982e));if(_0x1e5fc5[_0xffb4('0x5')]!==_0x1f46cc){_0x1e5fc5[_0xffb4('0x5')]=_0x1f46cc;emit(util['format']('voice:queue:%s',_0x43982e[_0xffb4('0x45')]),'voice_queue:save',_0x43982e);}}}function emitCampaignSummary(_0x293dd3){if(_0x293dd3['type']===_0xffb4('0x7f')){emit(util[_0xffb4('0x80')](_0xffb4('0x81'),_0x293dd3[_0xffb4('0x45')]),_0xffb4('0x82'),_0x293dd3);}}function checkGetDataPredictive(_0x529baa){if(isNotNull(_0x529baa)&&!_[_0xffb4('0x83')](_0x529baa)){loggerPredictive['info'](_0xffb4('0x84'));loggerPredictive[_0xffb4('0x85')](_0xffb4('0x86'),_0x529baa['predictiveIntervalTotalCalls']);loggerPredictive[_0xffb4('0x85')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x529baa['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xffb4('0x85')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x529baa[_0xffb4('0x87')]);loggerPredictive[_0xffb4('0x85')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x529baa['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x88'),_0x529baa[_0xffb4('0x70')]);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x89'),_0x529baa['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0xffb4('0x8a'));if(_0x529baa[_0xffb4('0x77')]>0x0){if(!_['isUndefined'](_0x529baa['predictiveIntervalAvgTalktime'])&&_0x529baa[_0xffb4('0x8b')]>0x0){return!![];}loggerPredictive['info'](_0xffb4('0x8c'));if(!_[_0xffb4('0x43')](_0x529baa[_0xffb4('0x70')])&&_0x529baa['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xffb4('0x85')](_0xffb4('0x8d'));}else{loggerPredictive[_0xffb4('0x85')](_0xffb4('0x8e'));}}else{loggerPredictive[_0xffb4('0x85')](_0xffb4('0x8f'));}return![];}function mergeDataErlangB(_0x20f964){return function(_0x1748c7){loggerPredictive[_0xffb4('0x85')](_0xffb4('0x90'));loggerPredictive[_0xffb4('0x85')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1748c7['erlangCalls']);loggerPredictive[_0xffb4('0x85')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1748c7[_0xffb4('0x7a')]);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x91'),_0x1748c7['erlangAbandonmentRate']);loggerPredictive[_0xffb4('0x85')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1748c7['erlangBusyFactor']);loggerPredictive['info'](_0xffb4('0x91'),_0x1748c7[_0xffb4('0x7b')]);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x8a'));_[_0xffb4('0x92')](_0x20f964,_0x1748c7);};}function getDiff(_0x432446){var _0x3f98f6=moment()['milliseconds'](0x0);var _0x3fb291=moment(_0x432446)[_0xffb4('0x4e')](0x0);return _0x3f98f6['diff'](_0x3fb291,_0xffb4('0x50'));}function ifInterval(_0x35fe6d,_0x2956a5){if(_[_0xffb4('0x43')](_0x2956a5)){return![];}return getDiff(_0x2956a5)<_0x35fe6d*0x3c;}function freeVariablesPredictive(_0x32e2c1){if(isNotNull(_0x32e2c1)){if(!_[_0xffb4('0x43')](_0x32e2c1[_0xffb4('0x2b')])){_0x32e2c1[_0xffb4('0x2b')]=undefined;loggerPredictive[_0xffb4('0x85')](_0x32e2c1[_0xffb4('0x45')],_0xffb4('0x93'));}if(!_['isUndefined'](_0x32e2c1[_0xffb4('0x2a')])){_0x32e2c1[_0xffb4('0x2a')]=undefined;loggerPredictive[_0xffb4('0x85')](_0x32e2c1[_0xffb4('0x45')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x32e2c1[_0xffb4('0x94')])){clearInterval(_0x32e2c1['handlePredictive']);_0x32e2c1[_0xffb4('0x94')]=undefined;loggerPredictive[_0xffb4('0x85')](_0x32e2c1[_0xffb4('0x45')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x20b0da,_0x33226a){if(_0x33226a===0x0){return 0x0;}var _0xb37c2e=0x1;for(var _0x4fc781=0x1;_0x4fc781<=_0x33226a;_0x4fc781+=0x1){_0xb37c2e=0x1+_0xb37c2e*_0x4fc781/_0x20b0da;}return 0x1/_0xb37c2e;}function isVoiceQueueOutbound(_0x32f8d2){return _0x32f8d2===_0xffb4('0x53');}function isNotPreview(_0x5ec851){return _0x5ec851!==_0xffb4('0x22');}function isCampaignIvr(_0x5cad72){return _0x5cad72===_0xffb4('0x7f');}function getCallerId(_0x2fe574,_0x5b4b7d,_0x1705d5){if(!_[_0xffb4('0x43')](_0x1705d5)&&typeof _0x1705d5===_0xffb4('0x95')&&!_[_0xffb4('0x83')](_0x1705d5)){if(!_[_0xffb4('0x43')](_0x5b4b7d)&&typeof _0x5b4b7d===_0xffb4('0x95')&&!_[_0xffb4('0x83')](_0x5b4b7d)){return util[_0xffb4('0x80')](_0xffb4('0x96'),_0x5b4b7d,_0x1705d5);}return util[_0xffb4('0x80')](_0xffb4('0x96'),_0x1705d5,_0x1705d5);}if(!_[_0xffb4('0x43')](_0x2fe574)&&typeof _0x2fe574===_0xffb4('0x95')&&!_[_0xffb4('0x83')](_0x2fe574)){return _0x2fe574;}return _0xffb4('0x97');}function loggerCatchQueueSummary(_0x268afb,_0x261cb9){return function(_0x414064){freeVariablesPredictive(_0x261cb9);emitVoiceQueueSummary(_0x261cb9);emitCampaignSummary(_0x261cb9);loggerSyncQueueSummary[_0xffb4('0x98')](_0x268afb,util[_0xffb4('0x99')](_0x414064,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5d513f,_0x3b29b9){return function(_0xe17e86){loggerPredictive[_0xffb4('0x98')](_0x3b29b9['name'],_0x5d513f);loggerPredictive[_0xffb4('0x98')](_0xe17e86[_0xffb4('0x9a')]);freeVariablesPredictive(_0x3b29b9);};}function loggerCatch(_0xe102f1){return function(_0x8e8088){logger['error'](_0xe102f1,util['inspect'](_0x8e8088,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x35bbfe){return _0x35bbfe&&!_[_0xffb4('0x43')](_0x35bbfe)&&_0x35bbfe[_0xffb4('0x9b')]>0x0;}function decremetOriginate(_0x3b6567){if(!_['isUndefined'](_0x3b6567)&&_0x3b6567!==null){if(typeof _0x3b6567[_0xffb4('0x78')]!==_0xffb4('0x9c')){if(_0x3b6567[_0xffb4('0x78')]>0x0){_0x3b6567[_0xffb4('0x78')]-=0x1;}else{logger[_0xffb4('0x98')](_0xffb4('0x9d'));}}}else{logger[_0xffb4('0x98')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x4afb0d,_0x48ea84,_0x41cd17){if(_0x48ea84>_0x41cd17){for(var _0x4f30c4=0x0;_0x4f30c4<_0x48ea84-_0x41cd17;_0x4f30c4+=0x1){decremetOriginate(_0x4afb0d);}}}function loggerGetContactDialer(_0x4f92b2,_0xac9c8,_0x340166){return function(_0x52454c){checkContactLowerLimitOriginate(_0xac9c8,_0x340166,0x0);logger[_0xffb4('0x98')](_0x4f92b2,util[_0xffb4('0x99')](_0x52454c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x27c2c0){return function(_0x24a2fe){if(isNotNull(_0x24a2fe)&&isNotNull(_0x24a2fe[0x0])){if(_0x24a2fe[0x0][_0xffb4('0x9e')]>0x0){_0x27c2c0[_0xffb4('0x44')]='RESCHEDULED_CONTACTS';logger[_0xffb4('0x85')](_0xffb4('0x9f')+_0x27c2c0['name'],_0x24a2fe[0x0]['contactsRescheduled'],_0xffb4('0xa0'));}else{_0x27c2c0['message']=_0xffb4('0xa1');logger[_0xffb4('0x85')]('[getContactDialer2][Empty]'+_0x27c2c0['name']);}}};}function notSendMessagesQueue(_0x21cf5a){if(_0x21cf5a[_0xffb4('0xa2')]){freeVariablesPredictive(_0x21cf5a);if(_0x21cf5a['originated']===0x0&&_0x21cf5a[_0xffb4('0xa3')]===0x0&&_0x21cf5a[_0xffb4('0x5e')]===0x0&&(_0x21cf5a['pTalking']||0x0)===0x0){_0x21cf5a[_0xffb4('0xa2')]=![];_0x21cf5a[_0xffb4('0x56')]=0x0;_0x21cf5a[_0xffb4('0x44')]=_0xffb4('0x47');loggerSyncQueueSummary[_0xffb4('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x21cf5a[_0xffb4('0x45')],_0xffb4('0xa4'));}else{_0x21cf5a[_0xffb4('0x44')]=_0xffb4('0xa5');loggerSyncQueueSummary[_0xffb4('0x98')](_0xffb4('0xa6'),_0x21cf5a['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x21cf5a);}}function notSendMessagesCampaign(_0x235fbf){if(_0x235fbf[_0xffb4('0xa2')]){if(_0x235fbf[_0xffb4('0x78')]===0x0){_0x235fbf['sendMessageOneNotActive']=![];_0x235fbf['message']=_0xffb4('0x47');loggerSyncQueueSummary['error'](_0xffb4('0xa7'),_0x235fbf[_0xffb4('0x45')],'is\x20not\x20active');}else{_0x235fbf[_0xffb4('0x44')]=_0xffb4('0xa5');loggerSyncQueueSummary['error'](_0xffb4('0xa7'),_0x235fbf[_0xffb4('0x45')],_0xffb4('0xa8'));}emitCampaignSummary(_0x235fbf);}}function createObjHistory(_0x266bf3,_0x1efc58,_0x1b66ea,_0x4f11d7,_0x28aa24){_0x266bf3[_0xffb4('0x44')]=_0x1b66ea;var _0x2c4d96=new Action(_0x266bf3,_0x1efc58);var _0x1c6244=new History(_0x2c4d96);_0x1c6244['state']=_0x4f11d7;_0x1c6244[_0xffb4('0xa9')]=_0x28aa24;_0x1c6244[_0xffb4('0xaa')]=_0x2c4d96[_0xffb4('0xab')];return _0x1c6244;}Dialer[_0xffb4('0xac')][_0xffb4('0x42')]=function(){var _0x32ae97=this;setInterval(function(){_0x32ae97[_0xffb4('0xad')](_0x32ae97['uniqueId'],'[uniqueid]');_0x32ae97['clearZombieChannels'](_0x32ae97[_0xffb4('0xae')],'[actions]');},0x32c8);};Dialer[_0xffb4('0xac')][_0xffb4('0xad')]=function(_0x3a828b,_0x1fa4b0){var _0x49e184=this;for(var _0xe1c1b7 in _0x3a828b){if(typeof _0x3a828b[_0xe1c1b7]!==_0xffb4('0x9c')){this[_0xffb4('0x21')][_0xffb4('0x1e')](function(){if(!_[_0xffb4('0xaf')](_0x3a828b[_0xe1c1b7])){return ami[_0xffb4('0xb0')]({'action':_0xffb4('0xb1'),'channel':_0x3a828b[_0xe1c1b7][_0xffb4('0xb2')]})[_0xffb4('0xb3')](function(_0x1e35b6){if(_0x1e35b6['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x3a828b[_0xe1c1b7]&&_0x3a828b[_0xe1c1b7]['type']!==_0xffb4('0x7f')){_0x49e184[_0xffb4('0xb4')](_0x49e184[_0xffb4('0x23')][_0x3a828b[_0xe1c1b7][_0xffb4('0xb5')]]);logger['error']('[Dialer][checkChannel]',_0x1fa4b0,_0xe1c1b7,_0x3a828b[_0xe1c1b7][_0xffb4('0xb5')]);delete _0x3a828b[_0xe1c1b7];}if(_0x3a828b[_0xe1c1b7]&&_0x3a828b[_0xe1c1b7][_0xffb4('0x52')]==='ivr'){_0x49e184['updateOriginated'](_0x49e184[_0xffb4('0x24')][_0x3a828b[_0xe1c1b7][_0xffb4('0xb5')]]);logger[_0xffb4('0x98')](_0xffb4('0xb6'),_0x1fa4b0,_0xe1c1b7,_0x3a828b[_0xe1c1b7][_0xffb4('0xb5')]);delete _0x3a828b[_0xe1c1b7];}},0x2328);}});}});}}};Dialer[_0xffb4('0xac')][_0xffb4('0xb7')]=function(_0x47af1f){return BPromise['resolve']()[_0xffb4('0xb8')](cmHopper[_0xffb4('0xb7')](_0x47af1f))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xb9')));};Dialer[_0xffb4('0xac')][_0xffb4('0xba')]=function(_0x58e393){return BPromise[_0xffb4('0xbb')]()[_0xffb4('0xb8')](cmHopperBlack[_0xffb4('0xba')](_0x58e393))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xbc')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x51d675){return BPromise['resolve']()['then'](cmHopperBlack[_0xffb4('0xbd')](_0x51d675))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xbe')));};Dialer['prototype'][_0xffb4('0xbf')]=function(_0xacdeea){return BPromise['resolve']()[_0xffb4('0xb8')](cmHopperHistory[_0xffb4('0xc0')](_0xacdeea))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xc1')));};Dialer[_0xffb4('0xac')][_0xffb4('0xc2')]=function(_0x436ffd){return BPromise['resolve']()[_0xffb4('0xb8')](cmHopper[_0xffb4('0xc2')](_0x436ffd))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xc3')));};Dialer['prototype'][_0xffb4('0xc4')]=function(_0x4a4c1a,_0x575e83,_0x6cf15a){return BPromise[_0xffb4('0xbb')]()[_0xffb4('0xb8')](cmHopper[_0xffb4('0xc4')](_0x4a4c1a,_0x575e83,_0x6cf15a))[_0xffb4('0xb3')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xffb4('0xac')][_0xffb4('0xc5')]=function(_0x28024a,_0x2b96ee,_0x206376,_0x4f5b0a){return BPromise[_0xffb4('0xbb')]()['then'](cmHopper[_0xffb4('0xc5')](_0x28024a,_0x2b96ee,_0x206376,_0x4f5b0a))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xc6')));};Dialer[_0xffb4('0xac')][_0xffb4('0xc7')]=function(_0x19333e,_0x19dbea,_0x245f0e){return BPromise[_0xffb4('0xbb')]()['then'](cmHopper[_0xffb4('0xc7')](_0x19333e,_0x19dbea,_0x245f0e))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xc6')));};Dialer[_0xffb4('0xac')][_0xffb4('0xc8')]=function(_0x44a522){return BPromise[_0xffb4('0xbb')]()['then'](voiceQueueRt[_0xffb4('0xc8')](_0x44a522))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xc9')));};Dialer[_0xffb4('0xac')][_0xffb4('0xca')]=function(_0x4b67f2){return BPromise[_0xffb4('0xbb')]()['then'](cmHopper[_0xffb4('0xca')](_0x4b67f2))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xcb')));};Dialer[_0xffb4('0xac')][_0xffb4('0xcc')]=function(_0x4cc73a){return BPromise['resolve']()[_0xffb4('0xb8')](cmHopperHistory[_0xffb4('0xcc')](_0x4cc73a))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xcd')));};Dialer[_0xffb4('0xac')][_0xffb4('0xb4')]=function(_0x132cae){if(!_[_0xffb4('0x43')](_0x132cae)&&_0x132cae!==null){if(typeof _0x132cae[_0xffb4('0x78')]!==_0xffb4('0x9c')){if(_0x132cae['originated']>0x0){_0x132cae[_0xffb4('0x78')]-=0x1;}else{logger[_0xffb4('0x98')](_0xffb4('0xce'));}}}else{logger['error'](_0xffb4('0xcf'));}};Dialer[_0xffb4('0xac')][_0xffb4('0xd0')]=function(_0x40a372,_0xa72f17){var _0x2eba89=this;return function(_0x2e319f){_0x2eba89[_0xffb4('0xb4')](_0xa72f17);logger['error'](_0x40a372,util[_0xffb4('0x99')](_0x2e319f,{'showHidden':![],'depth':null}));};};Dialer[_0xffb4('0xac')][_0xffb4('0xd1')]=function(_0x1cc701,_0x237eae,_0x5ca9be){var _0x15c9c4={'state':0x19,'statedesc':_0xffb4('0xd2')};this[_0xffb4('0xb4')](_0x237eae);this['saveInDb'](_['merge'](_0x15c9c4,_[_0xffb4('0xd3')](_0x5ca9be,['ContactId',_0xffb4('0xd4'),_0xffb4('0xd5'),_0xffb4('0xd6'),_0xffb4('0xd7')])),_0xffb4('0xd8'),_0xffb4('0xd9'));logger['error'](_0x1cc701);};Dialer['prototype'][_0xffb4('0xda')]=function(_0x38945f){return _0x38945f===_0xffb4('0xdb');};Dialer[_0xffb4('0xac')][_0xffb4('0xdc')]=function(_0x23fe4c){return!_[_0xffb4('0x43')](_0x23fe4c)&&_0x23fe4c&&!_[_0xffb4('0x43')](_0x23fe4c[_0xffb4('0x45')])&&!_[_0xffb4('0x43')](_0x23fe4c[_0xffb4('0xdd')])&&_0x23fe4c[_0xffb4('0xdd')]&&(this[_0xffb4('0x26')][util[_0xffb4('0x80')](_0xffb4('0xde'),_0x23fe4c['name'])]['status']===_0xffb4('0xdf')||this[_0xffb4('0x26')][util['format'](_0xffb4('0xde'),_0x23fe4c['name'])][_0xffb4('0xb1')]===_0xffb4('0xe0'));};Dialer[_0xffb4('0xac')][_0xffb4('0xe1')]=function(_0x4a4052,_0x1bebaa,_0x3a7174){this['createHistory'](_0x4a4052)['catch'](loggerCatch(_0x1bebaa));this[_0xffb4('0xca')](_0x4a4052)[_0xffb4('0xb3')](loggerCatch(_0x3a7174));};Dialer[_0xffb4('0xac')][_0xffb4('0x3c')]=function(_0x17638f){var _0x312f47=this['uniqueId'][_0x17638f[_0xffb4('0xe2')]];var _0x5c5624;if(!_[_0xffb4('0xaf')](_0x17638f)&&!_['isNil'](_0x17638f['variable'])&&!_[_0xffb4('0xaf')](_0x17638f[_0xffb4('0xe3')][_0xffb4('0xe4')])&&_0x17638f[_0xffb4('0xe5')]==='xcally-motion-dialer'&&_0x312f47){if(_0x312f47[_0xffb4('0x52')]!==_0xffb4('0x7f')&&this[_0xffb4('0x23')][_0x312f47['queue']][_0xffb4('0xe6')]&&_0x17638f['value']===_0xffb4('0xe7')){delete this[_0xffb4('0x29')][_0x17638f[_0xffb4('0xe2')]];this[_0xffb4('0xb4')](this[_0xffb4('0x23')][_0x312f47[_0xffb4('0xb5')]]);this[_0xffb4('0x23')][_0x312f47[_0xffb4('0xb5')]][_0xffb4('0x67')]+=0x1;this[_0xffb4('0x23')][_0x312f47[_0xffb4('0xb5')]][_0xffb4('0x66')]+=0x1;_0x5c5624=new Hangup(_0x312f47,_0x17638f);_0x5c5624['state']=0x12;_0x5c5624['statedesc']=_0xffb4('0xe8');_0x5c5624[_0xffb4('0xe9')]='AMD';this[_0xffb4('0xe1')](_0x5c5624,_0xffb4('0xea'),_0xffb4('0xeb'));}if(_0x312f47[_0xffb4('0x52')]!==_0xffb4('0x7f')&&this[_0xffb4('0x23')][_0x312f47[_0xffb4('0xb5')]][_0xffb4('0xe6')]&&_0x17638f[_0xffb4('0xec')]===_0xffb4('0xed')){var _0x3be4d3=this;return new BPromise(function(_0x3b7638,_0x2ac7a8){delete _0x3be4d3[_0xffb4('0x29')][_0x17638f[_0xffb4('0xe2')]];_0x3be4d3['updateOriginated'](_0x3be4d3[_0xffb4('0x23')][_0x312f47[_0xffb4('0xb5')]]);_0x3be4d3[_0xffb4('0x23')][_0x312f47[_0xffb4('0xb5')]]['outboundAnswerCallsDay']+=0x1;_0x3be4d3['voiceQueues'][_0x312f47[_0xffb4('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x31797c=_0x3be4d3[_0xffb4('0x23')][_0x312f47['queue']];var _0x5dc29e=new Hangup(_0x312f47,_0x17638f);_0x5dc29e[_0xffb4('0xee')]=0x13;_0x5dc29e[_0xffb4('0xa9')]='Machine';_0x5dc29e[_0xffb4('0xe9')]=_0xffb4('0xef');_0x5dc29e[_0xffb4('0xf0')]+=0x1;_0x5dc29e[_0xffb4('0xf1')]+=0x1;_0x5dc29e[_0xffb4('0xf2')]=!![];_0x3be4d3['createHistory'](_0x5dc29e)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xf3')));if(_0x5dc29e['countbusyretry']+_0x5dc29e['countcongestionretry']+_0x5dc29e[_0xffb4('0xf4')]+_0x5dc29e[_0xffb4('0xf5')]+_0x5dc29e[_0xffb4('0xf6')]+_0x5dc29e[_0xffb4('0xf7')]+_0x5dc29e[_0xffb4('0xf0')]+_0x5dc29e[_0xffb4('0xf8')]>=_0x31797c[_0xffb4('0xf9')]){_0x3be4d3['stateGlobal'](_0x5dc29e,_0x3b7638,_0x2ac7a8,_0xffb4('0xfa'));}else{if(_0x5dc29e[_0xffb4('0xf0')]>=_0x31797c[_0xffb4('0xfb')]){_0x3be4d3[_0xffb4('0xfc')](_0x5dc29e,_0x3b7638,_0x2ac7a8,_0xffb4('0xfd'));}else{_0x3be4d3['rescheduleContact']({'active':![],'countmachineretry':_0x5dc29e['countmachineretry'],'scheduledat':moment()[_0xffb4('0xfe')](_0x31797c[_0xffb4('0xff')],_0xffb4('0x100'))['format'](_0xffb4('0x101')),'ContactId':_0x5dc29e['ContactId'],'ListId':_0x5dc29e[_0xffb4('0xd4')],'VoiceQueueId':_0x5dc29e[_0xffb4('0xd6')]||undefined,'CampaignId':_0x5dc29e['CampaignId']||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x102')));_0x3b7638({'reschedule':0x1});}}});}if(_0x312f47[_0xffb4('0x52')]===_0xffb4('0x7f')&&this['campaigns'][_0x312f47[_0xffb4('0xb5')]]['dialAMDActive']&&_0x17638f[_0xffb4('0xec')]===_0xffb4('0xe7')){delete this[_0xffb4('0x29')][_0x17638f['uniqueid']];this[_0xffb4('0xb4')](this['campaigns'][_0x312f47['queue']]);_0x5c5624=new Hangup(_0x312f47,_0x17638f);_0x5c5624[_0xffb4('0xee')]=0x12;_0x5c5624[_0xffb4('0xa9')]=_0xffb4('0xe8');_0x5c5624[_0xffb4('0xe9')]=_0xffb4('0xef');this[_0xffb4('0xe1')](_0x5c5624,'[syncHangupInAMDIvr][createHistory]',_0xffb4('0x103'));}if(_0x312f47[_0xffb4('0x52')]===_0xffb4('0x7f')&&this[_0xffb4('0x24')][_0x312f47[_0xffb4('0xb5')]]['dialAMDActive']&&_0x17638f[_0xffb4('0xec')]===_0xffb4('0xed')){var _0x3be4d3=this;return new BPromise(function(_0x1b4e75,_0x490fad){delete _0x3be4d3[_0xffb4('0x29')][_0x17638f['uniqueid']];_0x3be4d3['updateOriginated'](_0x3be4d3[_0xffb4('0x24')][_0x312f47[_0xffb4('0xb5')]]);_0x3be4d3[_0xffb4('0x24')][_0x312f47[_0xffb4('0xb5')]][_0xffb4('0x67')]+=0x1;_0x3be4d3[_0xffb4('0x24')][_0x312f47['queue']][_0xffb4('0x66')]+=0x1;var _0xbff707=_0x3be4d3[_0xffb4('0x24')][_0x312f47['queue']];var _0x3070e2=new Hangup(_0x312f47,_0x17638f);_0x3070e2[_0xffb4('0xee')]=0x13;_0x3070e2[_0xffb4('0xa9')]=_0xffb4('0x104');_0x3070e2[_0xffb4('0xe9')]='AMD';_0x3070e2[_0xffb4('0xf0')]+=0x1;_0x3070e2[_0xffb4('0xf1')]+=0x1;_0x3070e2['amd']=!![];_0x3be4d3[_0xffb4('0xcc')](_0x3070e2)['catch'](loggerCatch(_0xffb4('0xf3')));if(_0x3070e2[_0xffb4('0x105')]+_0x3070e2[_0xffb4('0x106')]+_0x3070e2['countnoanswerretry']+_0x3070e2[_0xffb4('0xf5')]+_0x3070e2[_0xffb4('0xf6')]+_0x3070e2['countabandonedretry']+_0x3070e2[_0xffb4('0xf0')]+_0x3070e2[_0xffb4('0xf8')]>=_0xbff707['dialGlobalMaxRetry']){_0x3be4d3[_0xffb4('0x107')](_0x3070e2,_0x1b4e75,_0x490fad,_0xffb4('0xfa'));}else{if(_0x3070e2['countmachineretry']>=_0xbff707[_0xffb4('0xfb')]){_0x3be4d3[_0xffb4('0xfc')](_0x3070e2,_0x1b4e75,_0x490fad,_0xffb4('0xfd'));}else{_0x3be4d3[_0xffb4('0xc2')]({'active':![],'countmachineretry':_0x3070e2[_0xffb4('0xf0')],'scheduledat':moment()[_0xffb4('0xfe')](_0xbff707[_0xffb4('0xff')],_0xffb4('0x100'))['format'](_0xffb4('0x101')),'ContactId':_0x3070e2[_0xffb4('0x108')],'ListId':_0x3070e2[_0xffb4('0xd4')],'VoiceQueueId':_0x3070e2[_0xffb4('0xd6')]||undefined,'CampaignId':_0x3070e2[_0xffb4('0xd7')]||undefined})['catch'](loggerCatch(_0xffb4('0x102')));_0x1b4e75({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xffb4('0x38')]=function(_0xfe6a40){var _0x586e9a=this[_0xffb4('0x29')][_0xfe6a40[_0xffb4('0xe2')]];var _0x50cdd6=this;var _0x1ba099;if(_0x586e9a&&_0x586e9a['type']===_0xffb4('0x7f')){delete this['uniqueId'][_0xfe6a40['uniqueid']];this[_0xffb4('0xb4')](this[_0xffb4('0x24')][_0x586e9a['queue']]);this[_0xffb4('0x24')][_0x586e9a['queue']]['ivrAnswerCallsDay']+=0x1;_0x1ba099=new Hangup(_0x586e9a,_0xfe6a40);this[_0xffb4('0xcc')](_0x1ba099)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xffb4('0xca')](_0x1ba099)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x109')));}if(_0x586e9a&&_0x586e9a[_0xffb4('0x52')]!=='ivr'&&isNotNull(this[_0xffb4('0x23')][_0x586e9a[_0xffb4('0xb5')]]['dialQueueProject'])){delete this[_0xffb4('0x29')][_0xfe6a40[_0xffb4('0xe2')]];this[_0xffb4('0xb4')](this['voiceQueues'][_0x586e9a[_0xffb4('0xb5')]]);this['voiceQueues'][_0x586e9a[_0xffb4('0xb5')]][_0xffb4('0x67')]+=0x1;this[_0xffb4('0x23')][_0x586e9a[_0xffb4('0xb5')]][_0xffb4('0x66')]+=0x1;_0x1ba099=new Hangup(_0x586e9a,_0xfe6a40);_0x1ba099['state']=0x10;_0x1ba099[_0xffb4('0xa9')]=_0xffb4('0x10a');_0x1ba099[_0xffb4('0xe9')]=_0xffb4('0x10b');this[_0xffb4('0xcc')](_0x1ba099)['catch'](loggerCatch(_0xffb4('0x10c')));this['moveContactManagedDialer'](_0x1ba099)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x109')));}if(_0x586e9a&&_0x586e9a[_0xffb4('0x52')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x586e9a[_0xffb4('0xb5')]][_0xffb4('0x10d')])){delete this[_0xffb4('0x29')][_0xfe6a40[_0xffb4('0xe2')]];this[_0xffb4('0xb4')](this[_0xffb4('0x23')][_0x586e9a[_0xffb4('0xb5')]]);this['voiceQueues'][_0x586e9a[_0xffb4('0xb5')]][_0xffb4('0x6e')]+=0x1;_0x1ba099=new Hangup(_0x586e9a,_0xfe6a40);_0x1ba099[_0xffb4('0xee')]=0xc;_0x1ba099[_0xffb4('0xa9')]=_0xfe6a40['cause-txt'];_0x1ba099[_0xffb4('0xe9')]=_0xffb4('0x10e');this[_0xffb4('0xcc')](_0x1ba099)[_0xffb4('0xb3')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xffb4('0xca')](_0x1ba099)['catch'](loggerCatch(_0xffb4('0x109')));}};Dialer[_0xffb4('0xac')]['syncAgentComplete']=function(_0x1401ce){var _0x5a3916=this[_0xffb4('0x29')][_0x1401ce['uniqueid']];var _0xfaf477=this;if(this['voiceQueues'][_0x1401ce[_0xffb4('0xb5')]]){if(_0x5a3916&&_0x5a3916[_0xffb4('0x52')]!==_0xffb4('0x7f')){delete this[_0xffb4('0x29')][_0x1401ce[_0xffb4('0xe2')]];this['voiceQueues'][_0x1401ce[_0xffb4('0xb5')]]['outboundAnswerCallsDay']+=0x1;var _0x422cb4=new AgentComplete(_0x5a3916,_0x1401ce);if(_0x1401ce[_0xffb4('0x10f')]==='agent'){_0x422cb4[_0xffb4('0x110')]=this[_0xffb4('0x23')][_0x1401ce[_0xffb4('0xb5')]][_0xffb4('0x111')]&&this[_0xffb4('0x23')][_0x1401ce[_0xffb4('0xb5')]]['dialAgiAfterHangupAgent']?moment()[_0xffb4('0x80')](_0xffb4('0x101')):undefined;}this['createHistory'](_0x422cb4)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x112')));this['moveContactManagedDialer'](_0x422cb4)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x113')));}}};Dialer[_0xffb4('0xac')][_0xffb4('0x114')]=function(_0x67f66d){if(this['voiceQueues'][_0x67f66d[_0xffb4('0xb5')]]){if(this[_0xffb4('0x29')][_0x67f66d['uniqueid']]&&this[_0xffb4('0x29')][_0x67f66d['uniqueid']]['type']!=='ivr'){this[_0xffb4('0xb4')](this[_0xffb4('0x23')][_0x67f66d[_0xffb4('0xb5')]]);this[_0xffb4('0x29')][_0x67f66d[_0xffb4('0xe2')]]['answertime']=moment()['format'](_0xffb4('0x101'));}}};Dialer['prototype'][_0xffb4('0x115')]=function(_0x58db6c){this[_0xffb4('0xcc')](_0x58db6c)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x112')));this[_0xffb4('0xca')](_0x58db6c)[_0xffb4('0xb3')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xffb4('0xac')][_0xffb4('0x32')]=function(_0x442e8a){var _0xc444ec=this['uniqueId'][_0x442e8a[_0xffb4('0xe2')]];var _0x1ee99d=this;if(this['voiceQueues'][_0x442e8a['queue']]){if(_0xc444ec&&_0xc444ec[_0xffb4('0x52')]!==_0xffb4('0x7f')){delete this[_0xffb4('0x29')][_0x442e8a[_0xffb4('0xe2')]];this[_0xffb4('0xb4')](this['voiceQueues'][_0x442e8a['queue']]);_0xc444ec[_0xffb4('0x116')]=moment()['format'](_0xffb4('0x101'));var _0x55e7f7=new QueueCallerAbandon(_0xc444ec,_0x442e8a);if(getSeconds(_0xc444ec['droptime'],_0xc444ec[_0xffb4('0x117')])>=_0xc444ec[_0xffb4('0x118')]){this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]][_0xffb4('0x87')]+=0x1;this[_0xffb4('0x23')][_0x442e8a['queue']][_0xffb4('0x6b')]+=0x1;this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]][_0xffb4('0x72')]+=0x1;_0x55e7f7['state']=0xa;_0x55e7f7[_0xffb4('0xa9')]=_0xffb4('0x119');_0x55e7f7[_0xffb4('0x11a')]=_0xffb4('0x11b');_0x55e7f7[_0xffb4('0x110')]=this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]]['dialQueueProject2']?moment()[_0xffb4('0x80')](_0xffb4('0x101')):undefined;_0x55e7f7['countdropretry']+=0x1;_0x55e7f7[_0xffb4('0xf1')]+=0x1;if(_0x55e7f7[_0xffb4('0xf6')]>=this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]][_0xffb4('0x11c')]){this[_0xffb4('0x115')](_0x55e7f7);}else{this[_0xffb4('0xc2')]({'active':![],'countdropretry':_0x55e7f7[_0xffb4('0xf6')],'scheduledat':moment()['add'](this[_0xffb4('0x23')][_0x442e8a['queue']]['dialDropRetryFrequency'],_0xffb4('0x100'))['format'](_0xffb4('0x101')),'ContactId':_0xc444ec[_0xffb4('0x108')],'ListId':_0xc444ec[_0xffb4('0xd4')],'VoiceQueueId':_0xc444ec[_0xffb4('0xd6')]||undefined,'CampaignId':_0xc444ec[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x11d')));var _0x57b260=new History(_0x55e7f7);_0x57b260[_0xffb4('0xee')]=0xa;_0x57b260[_0xffb4('0xa9')]='Drop';_0x57b260[_0xffb4('0xab')]=moment()[_0xffb4('0x80')](_0xffb4('0x101'));_0x57b260['endtime']=_0x57b260[_0xffb4('0xab')];_0x57b260['calleridname']=_0x55e7f7[_0xffb4('0x11e')];_0x57b260[_0xffb4('0x11f')]=_0x55e7f7[_0xffb4('0x11f')];this[_0xffb4('0xcc')](_0x57b260)[_0xffb4('0xb3')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]][_0xffb4('0x6a')]+=0x1;_0x55e7f7[_0xffb4('0xee')]=0xb;_0x55e7f7[_0xffb4('0xa9')]=_0xffb4('0x120');_0x55e7f7[_0xffb4('0x11a')]=_0xffb4('0x121');_0x55e7f7[_0xffb4('0xf7')]+=0x1;_0x55e7f7[_0xffb4('0xf1')]+=0x1;if(_0x55e7f7[_0xffb4('0xf7')]>=this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]][_0xffb4('0x122')]){this[_0xffb4('0x115')](_0x55e7f7);}else{this[_0xffb4('0xc2')]({'active':![],'countabandonedretry':_0x55e7f7[_0xffb4('0xf7')],'scheduledat':moment()['add'](this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]][_0xffb4('0x123')],_0xffb4('0x100'))[_0xffb4('0x80')](_0xffb4('0x101')),'ContactId':_0xc444ec['ContactId'],'ListId':_0xc444ec[_0xffb4('0xd4')],'VoiceQueueId':_0xc444ec['VoiceQueueId']||undefined,'CampaignId':_0xc444ec['CampaignId']||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x124')));var _0x57b260=new History(_0x55e7f7);_0x57b260[_0xffb4('0xee')]=0xb;_0x57b260[_0xffb4('0xa9')]=_0xffb4('0x120');_0x57b260[_0xffb4('0xab')]=moment()[_0xffb4('0x80')]('YYYY-MM-DD\x20HH:mm:ss');_0x57b260['endtime']=_0x57b260[_0xffb4('0xab')];_0x57b260['calleridname']=_0x55e7f7[_0xffb4('0x11e')];_0x57b260[_0xffb4('0x11f')]=_0x55e7f7['calleridnum'];this[_0xffb4('0xcc')](_0x57b260)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x125')));}}}}};Dialer[_0xffb4('0xac')][_0xffb4('0x3a')]=function(_0x2f40ee){if(this[_0xffb4('0xae')][_0x2f40ee[_0xffb4('0xe2')]]){this[_0xffb4('0xae')][_0x2f40ee[_0xffb4('0xe2')]][_0xffb4('0xb2')]=_0x2f40ee['channel'];}if(this[_0xffb4('0x29')][_0x2f40ee['uniqueid']]){this['uniqueId'][_0x2f40ee[_0xffb4('0xe2')]]['channel']=_0x2f40ee[_0xffb4('0xb2')];}};Dialer[_0xffb4('0xac')][_0xffb4('0x3e')]=function(_0x5e9edf){if(strategy[this[_0xffb4('0x23')][this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]]['queue']][_0xffb4('0x54')]]===_0xffb4('0x1d')){if(this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]]&&_[_0xffb4('0xaf')](this[_0xffb4('0xae')][_0x5e9edf['actionid']]['locked'])&&_0x5e9edf['status']==='1'&&_0x5e9edf[_0xffb4('0x127')]==='0'){if(this[_0xffb4('0x25')][_0x5e9edf[_0xffb4('0x128')]]){if(!this[_0xffb4('0x25')][_0x5e9edf['stateinterface']][_0xffb4('0x129')]){this['agents'][_0x5e9edf[_0xffb4('0x128')]][_0xffb4('0x129')]=!![];this[_0xffb4('0xae')][_0x5e9edf['actionid']][_0xffb4('0x129')]=!![];this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]][_0xffb4('0x128')]=_0x5e9edf[_0xffb4('0x128')];}}}}else if((strategy[this[_0xffb4('0x23')][this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]][_0xffb4('0xb5')]][_0xffb4('0x54')]]||_0xffb4('0x1c'))===_0xffb4('0x1c')){if(this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]]){if(this['agents'][_0x5e9edf[_0xffb4('0x128')]]){this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]]['stateinterface']=_0x5e9edf[_0xffb4('0x128')];if(_[_0xffb4('0xaf')](this[_0xffb4('0x2d')][this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]][_0xffb4('0xb5')]])){this['queueBooked'][this[_0xffb4('0xae')][_0x5e9edf['actionid']][_0xffb4('0xb5')]]=[];}this['queueBooked'][this['actions'][_0x5e9edf[_0xffb4('0x126')]]['queue']]['push'](_[_0xffb4('0x92')](_[_0xffb4('0xd3')](this['actions'][_0x5e9edf[_0xffb4('0x126')]],[_0xffb4('0x12a'),'stateinterface']),{'status':_0x5e9edf['status'],'paused':_0x5e9edf[_0xffb4('0x127')]}));}}}};function unlockQueueStatus(_0x549dd3,_0x17de1f){setTimeout(function(){if(_[_0xffb4('0x43')](_0x549dd3['queueStatusComplete'])){loggerBooked['error'](_0xffb4('0x12b'),_0x17de1f);}_0x549dd3[_0xffb4('0x12c')]=!![];loggerBooked[_0xffb4('0x85')](_0xffb4('0x12d'),_0x17de1f,JSON[_0xffb4('0x4d')](_[_0xffb4('0xd3')](_0x549dd3,[_0xffb4('0x45'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xffb4('0xac')][_0xffb4('0x40')]=function(_0x1e9947){var _0x4f49b1=this;var _0x5d0e38=_0x4f49b1['voiceQueues'][_0x4f49b1[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]];if(strategy[this['voiceQueues'][this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]][_0xffb4('0x54')]]===_0xffb4('0x1d')){if(this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]]&&this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0x128')]){this[_0xffb4('0x22')][_0xffb4('0x12e')](this[_0xffb4('0xae')][_0x1e9947['actionid']][_0xffb4('0x12a')],this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0x128')])[_0xffb4('0xb3')](function(_0x17f793){logger[_0xffb4('0x98')](_0xffb4('0x12f'),util[_0xffb4('0x99')](_0x17f793,{'showHidden':![],'depth':null}));})['finally'](function(){_0x4f49b1[_0xffb4('0xb4')](_0x4f49b1[_0xffb4('0x23')][_0x4f49b1[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]]);_0x4f49b1[_0xffb4('0x25')][_0x4f49b1[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]]['stateinterface']][_0xffb4('0x129')]=![];delete _0x4f49b1[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]];unlockQueueStatus(_0x5d0e38);});}else{this[_0xffb4('0xb4')](this[_0xffb4('0x23')][this['actions'][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]]);this[_0xffb4('0xc2')]({'active':![],'ContactId':this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0x108')],'ListId':this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xd4')],'VoiceQueueId':this['actions'][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xd6')]||undefined,'CampaignId':this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xd7')]||undefined})['catch'](loggerCatch(_0xffb4('0x130')));delete this['actions'][_0x1e9947[_0xffb4('0x126')]];unlockQueueStatus(_0x5d0e38);}}else if((strategy[this['voiceQueues'][this['actions'][_0x1e9947['actionid']]['queue']][_0xffb4('0x54')]]||'rrmemory')===_0xffb4('0x1c')){var _0x5e8e13;if(this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]]&&!_[_0xffb4('0x83')](this[_0xffb4('0x2d')][this[_0xffb4('0xae')][_0x1e9947['actionid']][_0xffb4('0xb5')]])){if(this[_0xffb4('0x2e')][_0x4f49b1[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]]){this[_0xffb4('0x2e')][_0x4f49b1['actions'][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]]=this[_0xffb4('0x2e')][this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]]?this['queueBookedRR'][this[_0xffb4('0xae')][_0x1e9947['actionid']][_0xffb4('0xb5')]]:this[_0xffb4('0x2d')][this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]]?this[_0xffb4('0x2d')][this['actions'][_0x1e9947['actionid']][_0xffb4('0xb5')]][_0xffb4('0x131')]||0x0:0x0;}this[_0xffb4('0x2d')][this['actions'][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]][_0xffb4('0x131')]=this['queueBookedRR'][this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]];for(var _0x254478=0x0;_0x254478=0x0;})['catch'](myreject(_0x4334de)));}}else{_0x4f06d6[_0xffb4('0x14c')](ami[_0xffb4('0xb0')]({'action':_0xffb4('0x147'),'command':util['format'](_0xffb4('0x148'),_0x5aed26,!_[_0xffb4('0x43')](config['timezones'][_0xda15c9])?_0xda15c9:'')})[_0xffb4('0xb8')](function(_0x460590){return _0x460590[_0xffb4('0x14b')][_0xffb4('0x14d')](_0xffb4('0x14e'))>=0x0;})['catch'](myreject(_0x4334de)));}BPromise[_0xffb4('0x14f')](_0x4f06d6)[_0xffb4('0xb8')](function(_0x45f475){var _0x376aee=_[_0xffb4('0x150')](_0x45f475);if(_0x376aee){return _0xee19db(_0x376aee);}else{_0xa4d956[_0xffb4('0x44')]=_0x336625?_0xffb4('0x151'):_0xffb4('0x152');return _0x4334de(msgResponse('[ifTime][promiseAll]',_0xffb4('0x140'),'Global:\x20'+_0x336625+'\x20'+_0x388e3e+_0xffb4('0x153')+util[_0xffb4('0x99')](_0x5aed26,{'showHidden':![],'depth':null})+_0xffb4('0x154')+_0xda15c9));}})[_0xffb4('0xb3')](function(_0xc86a26){return _0x4334de(msgResponse(_0xffb4('0x13f'),_0xffb4('0x140'),JSON['stringify'](_0xc86a26)));});});};Dialer[_0xffb4('0xac')][_0xffb4('0x155')]=function(_0x306618){var _0x4154c2=this;return function(){switch(_0x306618[_0xffb4('0x61')]){case _0xffb4('0x156'):freeVariablesPredictive(_0x306618);_0x4154c2[_0xffb4('0x157')](_0x306618,0x1);break;case _0xffb4('0x158'):freeVariablesPredictive(_0x306618);_0x4154c2[_0xffb4('0x157')](_0x306618,_0x306618[_0xffb4('0x159')]);break;case _0xffb4('0xb'):_0x4154c2[_0xffb4('0xb')](_0x306618);break;case _0xffb4('0xa'):freeVariablesPredictive(_0x306618);_0x4154c2[_0xffb4('0x157')](_0x306618,0x1);break;default:freeVariablesPredictive(_0x306618);logger['error'](_0xffb4('0x15a'),_0x306618[_0xffb4('0x45')],_0xffb4('0x15b'));}};};Dialer['prototype']['launchHandleIvr']=function(_0x1e0a2e){var _0x57c357=this;return function(){_0x57c357[_0xffb4('0x15c')](_0x1e0a2e);};};Dialer[_0xffb4('0xac')][_0xffb4('0xc')]=function(_0x37f0c8){var _0x84258=this;if(isNotPreview(_0x37f0c8[_0xffb4('0x61')])){if(isVoiceQueueOutbound(_0x37f0c8[_0xffb4('0x52')])&&isActive(_0x37f0c8[_0xffb4('0x60')])){_0x37f0c8['sendMessageOneNotActive']=!![];BPromise[_0xffb4('0xbb')]()[_0xffb4('0xb8')](checkIsLoggedIn(_0x37f0c8,_0x37f0c8[_0xffb4('0x57')]))[_0xffb4('0xb8')](checkIsActive(_0x37f0c8,_0x37f0c8[_0xffb4('0x60')]))['then'](checkInterval(_0x37f0c8))[_0xffb4('0xb8')](_0x84258[_0xffb4('0x13b')](_0x37f0c8))['then'](_0x84258['checkIfTime'](_0x37f0c8[_0xffb4('0x15d')],_0x37f0c8[_0xffb4('0x15e')],_0x37f0c8[_0xffb4('0x45')],_0x37f0c8))[_0xffb4('0xb8')](_0x84258[_0xffb4('0x15f')](_0x37f0c8[_0xffb4('0x48')],_0x37f0c8[_0xffb4('0x15e')],_0x37f0c8[_0xffb4('0x45')],_0x37f0c8))[_0xffb4('0xb8')](_0x84258[_0xffb4('0x155')](_0x37f0c8))['catch'](loggerCatchQueueSummary(_0xffb4('0x160'),_0x37f0c8));}else{notSendMessagesQueue(_0x37f0c8);}}else{freeVariablesPredictive(_0x37f0c8);}};Dialer[_0xffb4('0xac')][_0xffb4('0x13a')]=function(){var _0x8e05db=this;var _0x2f50a7;for(var _0x495823 in this[_0xffb4('0x24')]){if(typeof this[_0xffb4('0x24')][_0x495823]!==_0xffb4('0x9c')){_0x2f50a7=this['campaigns'][_0x495823];if(isCampaignIvr(_0x2f50a7[_0xffb4('0x52')])&&isActive(_0x2f50a7[_0xffb4('0xdd')])){_0x2f50a7[_0xffb4('0xa2')]=!![];BPromise[_0xffb4('0xbb')]()[_0xffb4('0xb8')](checkIsActive(_0x2f50a7,_0x2f50a7['active']))[_0xffb4('0xb8')](checkInterval(_0x2f50a7))[_0xffb4('0xb8')](_0x8e05db[_0xffb4('0x13b')](_0x2f50a7))[_0xffb4('0xb8')](_0x8e05db['checkIfTime'](_0x2f50a7[_0xffb4('0x15d')],_0x2f50a7[_0xffb4('0x15e')],_0x2f50a7[_0xffb4('0x45')],_0x2f50a7))['then'](_0x8e05db[_0xffb4('0x15f')](_0x2f50a7[_0xffb4('0x48')],_0x2f50a7[_0xffb4('0x15e')],_0x2f50a7[_0xffb4('0x45')],_0x2f50a7))[_0xffb4('0xb8')](_0x8e05db['launchHandleIvr'](_0x2f50a7))[_0xffb4('0xb3')](loggerCatchQueueSummary(_0xffb4('0x161'),_0x2f50a7));}else{notSendMessagesCampaign(_0x2f50a7);}}}};function getCallerIdRandom(_0x198664,_0x518aac){var _0x273bc3;var _0x124080;var _0x20c64c;if(_0x518aac<=0x0){_0x518aac=0x1;}_0x273bc3=new RegExp('\x5cw{0,'+_0x518aac+'}$');_0x124080=Math['pow'](0xa,_0x518aac-0x1);_0x20c64c=Math[_0xffb4('0x162')](0xa,_0x518aac)-0x1;return util[_0xffb4('0x80')]('%s',_[_0xffb4('0x163')](_0x198664,_0x273bc3,_[_0xffb4('0x164')](_0x124080,_0x20c64c)));}function extractCalleridName(_0x89c6ac){var _0x5e8050=_0x89c6ac['match'](/"(.*?)"/);return _0x5e8050?_0x5e8050[0x1]:_0x89c6ac;}function extractCalleridNumber(_0x133892){var _0x255b68=_0x133892[_0xffb4('0x165')](/<(.*?)>/);return _0x255b68?_0x255b68[0x1]:_0x133892;}Dialer[_0xffb4('0xac')][_0xffb4('0x166')]=function(_0x4f49b3,_0x1aaf03){var _0x2152a4=this;var _0x3d4b97=uuid['v4']();this['actions'][_0x3d4b97]=new Action(_0x4f49b3,_0x1aaf03,_0x3d4b97);return new BPromise(function(_0x55e7d3,_0x48c2bd){if(_[_0xffb4('0x43')](_0x4f49b3)&&typeof _0x4f49b3!==_0xffb4('0x167')){return _0x48c2bd(msgResponse(_0xffb4('0x168'),_0xffb4('0x140'),_0xffb4('0x169')));}if(_[_0xffb4('0x43')](_0x1aaf03['Contact'][_0xffb4('0x16a')])||_0x1aaf03[_0xffb4('0x16b')]['phone']===null){return _0x48c2bd(msgResponse(_0xffb4('0x168'),_0xffb4('0x140'),_0xffb4('0x16c')));}var _0x227bcd={'XMD-CALLERID':_0x2152a4[_0xffb4('0xae')][_0x3d4b97][_0xffb4('0x16d')](),'XMD-AGI':_0x4f49b3['dialQueueProject']?util['format'](_0xffb4('0x16e'),ipAgi,_0x4f49b3[_0xffb4('0x10d')]):_0xffb4('0x16f'),'XMD-AGIAFTER':_0x4f49b3['dialQueueProject2']?util[_0xffb4('0x80')](_0xffb4('0x16e'),ipAgi,_0x4f49b3['dialQueueProject2']):_0xffb4('0x16f'),'XMD-QUEUE':_0x4f49b3['type']==='outbound'?util[_0xffb4('0x80')](_0xffb4('0x170'),_0x4f49b3[_0xffb4('0x45')],_0x4f49b3[_0xffb4('0x171')]||'',_0x4f49b3[_0xffb4('0x172')]?'c':'',_0x4f49b3[_0xffb4('0x118')]||0x3):_0xffb4('0x16f'),'XMD-CONTACTID':_0x1aaf03[_0xffb4('0x108')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2152a4['actions'][_0x3d4b97][_0xffb4('0x16d')](),'XMD-AMD':_0x4f49b3[_0xffb4('0xe6')]?_0xffb4('0x173'):_0xffb4('0x16f'),'XMD-DESTINATION':_0xffb4('0x174')};if(_0x4f49b3[_0xffb4('0xe6')]){_0x227bcd[_0xffb4('0x175')]=_0x4f49b3[_0xffb4('0x176')]||0x9c4;_0x227bcd['XMD-AMDGREETING']=_0x4f49b3[_0xffb4('0x177')]||0x5dc;_0x227bcd[_0xffb4('0x178')]=_0x4f49b3[_0xffb4('0x179')]||0x320;_0x227bcd[_0xffb4('0x17a')]=_0x4f49b3[_0xffb4('0x17b')]||0x1388;_0x227bcd[_0xffb4('0x17c')]=_0x4f49b3[_0xffb4('0x17d')]||0x64;_0x227bcd[_0xffb4('0x17e')]=_0x4f49b3[_0xffb4('0x17f')]||0x32;_0x227bcd[_0xffb4('0x180')]=_0x4f49b3[_0xffb4('0x181')]||0x3;_0x227bcd[_0xffb4('0x182')]=_0x4f49b3[_0xffb4('0x183')]||0x100;_0x227bcd[_0xffb4('0x184')]=_0x4f49b3[_0xffb4('0x185')]||0x1388;}if(_0x4f49b3[_0xffb4('0x52')]===_0xffb4('0x53')){_0x227bcd[_0xffb4('0x186')]=_0x1aaf03['VoiceQueueId'];}else{_0x227bcd['XMD-CAMPAIGNID']=_0x1aaf03[_0xffb4('0xd7')];}for(var _0x5e57a5 in _0x1aaf03[_0xffb4('0x16b')]){if(typeof _0x1aaf03[_0xffb4('0x16b')][_0x5e57a5]!=='undefined'){if(isNotNull(_0x1aaf03[_0xffb4('0x16b')][_0x5e57a5])&&_0x5e57a5!=='id'&&_0x5e57a5!==_0xffb4('0x187')&&_0x5e57a5!=='createdAt'&&_0x5e57a5!==_0xffb4('0x188')){_0x227bcd[util[_0xffb4('0x80')](_0xffb4('0x189'),_0xffb4('0x18a'),_[_0xffb4('0x18b')](_0x5e57a5))]=_0x1aaf03['Contact'][_0x5e57a5];}}}var _0x69a293=_0x2152a4['isTrunkReachable'](_0x4f49b3['Trunk'])?getCallerId(_0x4f49b3['Trunk']['callerid'],_0x4f49b3[_0xffb4('0x62')],_0x4f49b3['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4f49b3[_0xffb4('0x63')],_0x4f49b3['dialRandomLastDigitCallerIdNumber']):_0x4f49b3['dialOriginateCallerIdNumber']):getCallerId(_[_0xffb4('0xaf')](_0x4f49b3['TrunkBackup'])?_0x4f49b3[_0xffb4('0x7d')]['callerid']:_0x4f49b3['TrunkBackup']['callerid'],_0x4f49b3[_0xffb4('0x62')],_0x4f49b3[_0xffb4('0x18c')]>0x0?getCallerIdRandom(_0x4f49b3[_0xffb4('0x63')],_0x4f49b3['dialRandomLastDigitCallerIdNumber']):_0x4f49b3[_0xffb4('0x63')]);if(_0x69a293){_0x227bcd['XMD-ORIGINATECALLERIDNAME']=_0x2152a4[_0xffb4('0xae')][_0x3d4b97]['originatecalleridname']=extractCalleridName(_0x69a293);_0x227bcd[_0xffb4('0x18d')]=_0x2152a4['actions'][_0x3d4b97][_0xffb4('0x18e')]=extractCalleridNumber(_0x69a293);}return ami[_0xffb4('0xb0')]({'actionid':_0x3d4b97,'action':_0xffb4('0x168'),'channel':_0x2152a4[_0xffb4('0xdc')](_0x4f49b3[_0xffb4('0x7d')])?util['format'](_0xffb4('0x18f'),_0x4f49b3['Trunk'][_0xffb4('0x45')],isNotNull(_0x4f49b3['dialPrefix'])?_0x4f49b3[_0xffb4('0x65')][_0xffb4('0x190')]()||'':'',_0x4f49b3['dialCutDigit']>0x0?_0x1aaf03['Contact'][_0xffb4('0x16a')][_0xffb4('0x191')](_0x4f49b3[_0xffb4('0x192')]):_0x1aaf03[_0xffb4('0x16b')][_0xffb4('0x16a')]):util[_0xffb4('0x80')](_0xffb4('0x18f'),_[_0xffb4('0xaf')](_0x4f49b3[_0xffb4('0x13c')])?_0x4f49b3[_0xffb4('0x7d')][_0xffb4('0x45')]:_0x4f49b3[_0xffb4('0x13c')][_0xffb4('0x45')],isNotNull(_0x4f49b3[_0xffb4('0x65')])?_0x4f49b3[_0xffb4('0x65')][_0xffb4('0x190')]()||'':'',_0x4f49b3[_0xffb4('0x192')]>0x0?_0x1aaf03[_0xffb4('0x16b')][_0xffb4('0x16a')][_0xffb4('0x191')](_0x4f49b3[_0xffb4('0x192')]):_0x1aaf03[_0xffb4('0x16b')][_0xffb4('0x16a')]),'callerid':_0x69a293,'Exten':_0xffb4('0x174'),'Context':_0xffb4('0x193'),'Priority':'1','variable':_0x227bcd,'timeout':(_0x4f49b3[_0xffb4('0x64')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3d4b97})[_0xffb4('0xb8')](function(_0xea328){return _0x55e7d3(_0xea328);})['catch'](function(_0x5742ad){_0x4f49b3[_0xffb4('0x194')]+=0x1;var _0x47bda0=new History(_0x2152a4['actions'][_0x3d4b97]);logger[_0xffb4('0x98')](util[_0xffb4('0x80')]('[originateError]:\x20%s',JSON[_0xffb4('0x4d')](_0x5742ad)));_0x47bda0[_0xffb4('0xee')]=0xe;_0x47bda0[_0xffb4('0xa9')]=_0xffb4('0x195');_0x47bda0[_0xffb4('0xab')]=moment()[_0xffb4('0x80')](_0xffb4('0x101'));_0x47bda0[_0xffb4('0xaa')]=_0x47bda0[_0xffb4('0xab')];_0x2152a4[_0xffb4('0xcc')](_0x47bda0)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x196')));_0x2152a4['moveContactManagedDialer'](_0x47bda0)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x196')))[_0xffb4('0x20')](function(){delete _0x2152a4[_0xffb4('0xae')][_0x3d4b97];return _0x48c2bd(msgResponse(_0xffb4('0x168'),_0xffb4('0x4c'),_0xffb4('0x197')));});});});};Dialer['prototype'][_0xffb4('0x34')]=function(_0x5df423){var _0x171dfa=this['actions'][_0x5df423['actionid']];if(_0x171dfa){delete this['actions'][_0x5df423[_0xffb4('0x126')]];_0x171dfa[_0xffb4('0x117')]=moment()[_0xffb4('0x80')](_0xffb4('0x101'));var _0x46ca3c=_0x171dfa[_0xffb4('0x52')]==='ivr'?this[_0xffb4('0x24')][_0x171dfa['queue']]:this[_0xffb4('0x23')][_0x171dfa[_0xffb4('0x198')]()];if(!this[_0xffb4('0xda')](_0x5df423[_0xffb4('0x199')])){this['updateOriginated'](_0x46ca3c);return this['callProgressDetecting'](_0x171dfa,_0x46ca3c,_0x5df423)[_0xffb4('0xb3')](loggerCatch('[callProgressDetecting]\x20'));}this[_0xffb4('0x29')][_0x5df423[_0xffb4('0xe2')]]=_0x171dfa;}};Dialer['prototype'][_0xffb4('0x19a')]=function(_0x116eef,_0x23f342,_0x5b7731){var _0x186a87=new History(_0x23f342);if(_0x186a87[_0xffb4('0x105')]+_0x186a87[_0xffb4('0x106')]+_0x186a87['countnoanswerretry']+_0x186a87[_0xffb4('0xf5')]+_0x186a87[_0xffb4('0xf6')]+_0x186a87[_0xffb4('0xf7')]+_0x186a87[_0xffb4('0xf0')]+_0x186a87[_0xffb4('0xf8')]>=_0x5b7731['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x116eef){case 0x3:if(_0x186a87[_0xffb4('0xf4')]>=_0x5b7731[_0xffb4('0x19b')]-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countnoanswerretry':_0x186a87[_0xffb4('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x5b7731[_0xffb4('0x19c')],_0xffb4('0x100'))[_0xffb4('0x80')](_0xffb4('0x101')),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87['ListId'],'VoiceQueueId':_0x186a87[_0xffb4('0xd6')]||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x186a87[_0xffb4('0x105')]>=_0x5b7731[_0xffb4('0x19d')]-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countbusyretry':_0x186a87[_0xffb4('0x105')]+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731[_0xffb4('0x19e')],'minutes')[_0xffb4('0x80')](_0xffb4('0x101')),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87[_0xffb4('0xd4')],'VoiceQueueId':_0x186a87[_0xffb4('0xd6')]||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x19f')));break;case 0x8:if(_0x186a87['countcongestionretry']>=_0x5b7731[_0xffb4('0x1a0')]-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countcongestionretry':_0x186a87[_0xffb4('0x106')]+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731[_0xffb4('0x1a1')],_0xffb4('0x100'))[_0xffb4('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87['ListId'],'VoiceQueueId':_0x186a87['VoiceQueueId']||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1a2')));break;case 0x0:if(_0x186a87[_0xffb4('0xf5')]>=_0x5b7731[_0xffb4('0x1a3')]-0x1){return!![];}else{this[_0xffb4('0xc2')]({'active':![],'countnosuchnumberretry':_0x186a87[_0xffb4('0xf5')]+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731[_0xffb4('0x1a4')],'minutes')[_0xffb4('0x80')](_0xffb4('0x101')),'ContactId':_0x186a87['ContactId'],'ListId':_0x186a87[_0xffb4('0xd4')],'VoiceQueueId':_0x186a87[_0xffb4('0xd6')]||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})['catch'](loggerCatch(_0xffb4('0x1a5')));}break;case 0xa:if(_0x186a87['countdropretry']>=_0x5b7731['dialDropMaxRetry']-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countdropretry':_0x186a87['countdropretry']+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731[_0xffb4('0x1a6')],'minutes')[_0xffb4('0x80')](_0xffb4('0x101')),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87[_0xffb4('0xd4')],'VoiceQueueId':_0x186a87['VoiceQueueId']||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x11d')));break;case 0xb:if(_0x186a87[_0xffb4('0xf7')]>=_0x5b7731[_0xffb4('0x122')]-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countabandonedretry':_0x186a87[_0xffb4('0xf7')]+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731['dialAbandonedRetryFrequency'],_0xffb4('0x100'))[_0xffb4('0x80')](_0xffb4('0x101')),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87[_0xffb4('0xd4')],'VoiceQueueId':_0x186a87[_0xffb4('0xd6')]||undefined,'CampaignId':_0x186a87['CampaignId']||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x124')));break;case 0x13:if(_0x186a87[_0xffb4('0xf0')]>=_0x5b7731[_0xffb4('0xfb')]-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countmachineretry':_0x186a87[_0xffb4('0xf0')]+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731['dialMachineRetryFrequency'],_0xffb4('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87['ListId'],'VoiceQueueId':_0x186a87['VoiceQueueId']||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x102')));break;case 0x14:if(_0x186a87['countagentrejectretry']>=_0x5b7731['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countagentrejectretry':_0x186a87[_0xffb4('0xf8')]+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731[_0xffb4('0x1a7')],_0xffb4('0x100'))[_0xffb4('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87[_0xffb4('0xd4')],'VoiceQueueId':_0x186a87['VoiceQueueId']||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1a8')));break;default:return!![];}};Dialer['prototype'][_0xffb4('0x1a9')]=function(_0x215805,_0x1d58dd,_0x46ba7d){var _0x1b8082=this;var _0x47e28f=new History(_0x215805);return new BPromise(function(_0x475ea3,_0x46712a){if(_['isUndefined'](_0x1d58dd)&&typeof _0x1d58dd!==_0xffb4('0x167')){return _0x46712a(msgResponse('[callProgressDetecting]','Failure','entity\x20is\x20undefine'));}if(_[_0xffb4('0x43')](_0x46ba7d)&&typeof _0x46ba7d!==_0xffb4('0x167')){return _0x46712a(msgResponse(_0xffb4('0x1aa'),_0xffb4('0x140'),'evt\x20is\x20undefine'));}switch(_0x46ba7d['reason']){case'0':_0x1d58dd[_0xffb4('0x1ab')]+=0x1;_0x47e28f[_0xffb4('0xee')]=0x0;_0x47e28f[_0xffb4('0xa9')]='NoSuchNumber';_0x47e28f['countnosuchnumberretry']+=0x1;_0x47e28f[_0xffb4('0xf1')]+=0x1;ami[_0xffb4('0x51')](_0xffb4('0x1ac'),ut[_0xffb4('0x1ad')](_0x215805,_0xffb4('0x1ae')));_0x1b8082['createHistory'](_0x47e28f)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xf3')));if(_0x1b8082[_0xffb4('0x19a')](0x0,_0x215805,_0x1d58dd)){if(_0x47e28f[_0xffb4('0xf5')]>=_0x1d58dd[_0xffb4('0x1a3')]){_0x1b8082['createStateFinal'](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1af'));}else{_0x1b8082[_0xffb4('0x107')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1af'));}}break;case'3':_0x1d58dd[_0xffb4('0x6c')]+=0x1;_0x47e28f[_0xffb4('0xee')]=0x3;_0x47e28f['statedesc']='NoAnswer';_0x47e28f[_0xffb4('0xf4')]+=0x1;_0x47e28f[_0xffb4('0xf1')]+=0x1;ami[_0xffb4('0x51')]('custom:agentnoanswer',ut['buildObj'](_0x215805,_0xffb4('0x1b0')));_0x1b8082[_0xffb4('0xcc')](_0x47e28f)['catch'](loggerCatch(_0xffb4('0x1b1')));if(_0x1b8082[_0xffb4('0x19a')](0x3,_0x215805,_0x1d58dd)){if(_0x47e28f['countnoanswerretry']>=_0x1d58dd[_0xffb4('0x19b')]){_0x1b8082[_0xffb4('0xfc')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1b2'));}else{_0x1b8082[_0xffb4('0x107')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1b2'));}}break;case'5':_0x1d58dd[_0xffb4('0x1b3')]+=0x1;_0x47e28f[_0xffb4('0xee')]=0x5;_0x47e28f[_0xffb4('0xa9')]=_0xffb4('0x1b4');_0x47e28f[_0xffb4('0x105')]+=0x1;_0x47e28f['countglobal']+=0x1;ami[_0xffb4('0x51')](_0xffb4('0x1b5'),ut[_0xffb4('0x1ad')](_0x215805,_0xffb4('0x1b6')));_0x1b8082[_0xffb4('0xcc')](_0x47e28f)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1b7')));if(_0x1b8082[_0xffb4('0x19a')](0x5,_0x215805,_0x1d58dd)){if(_0x47e28f[_0xffb4('0x105')]>=_0x1d58dd[_0xffb4('0x19d')]){_0x1b8082[_0xffb4('0xfc')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1b8'));}else{_0x1b8082[_0xffb4('0x107')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1b8'));}}break;case'8':_0x1d58dd[_0xffb4('0x69')]+=0x1;_0x47e28f[_0xffb4('0xee')]=0x8;_0x47e28f[_0xffb4('0xa9')]='Congestion';_0x47e28f[_0xffb4('0x106')]+=0x1;_0x47e28f[_0xffb4('0xf1')]+=0x1;ami[_0xffb4('0x51')]('custom:agentcongestion',ut[_0xffb4('0x1ad')](_0x215805,'congestion'));_0x1b8082[_0xffb4('0xcc')](_0x47e28f)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1b9')));if(_0x1b8082[_0xffb4('0x19a')](0x8,_0x215805,_0x1d58dd)){if(_0x47e28f[_0xffb4('0x106')]>=_0x1d58dd[_0xffb4('0x1a0')]){_0x1b8082[_0xffb4('0xfc')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1ba'));}else{_0x1b8082[_0xffb4('0x107')](_0x47e28f,_0x475ea3,_0x46712a,'reason\x208\x20congestion');}}break;case'11':_0x1d58dd['outboundAbandonedCallsDay']+=0x1;_0x47e28f[_0xffb4('0xee')]=0xb;_0x47e28f['statedesc']=_0xffb4('0x120');_0x47e28f[_0xffb4('0xf7')]+=0x1;_0x47e28f['countglobal']+=0x1;_0x1b8082[_0xffb4('0xcc')](_0x47e28f)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x125')));if(_0x1b8082['checkRetriveMax'](0xb,_0x215805,_0x1d58dd)){if(_0x47e28f[_0xffb4('0xf7')]>=_0x1d58dd[_0xffb4('0x122')]){_0x1b8082[_0xffb4('0xfc')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1bb'));}else{_0x1b8082[_0xffb4('0x107')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1bb'));}}break;case'20':_0x1d58dd[_0xffb4('0x1bc')]+=0x1;_0x47e28f[_0xffb4('0xee')]=0x14;_0x47e28f[_0xffb4('0xa9')]=_0xffb4('0x1bd');_0x47e28f['countagentrejectretry']+=0x1;_0x47e28f[_0xffb4('0xf1')]+=0x1;ami[_0xffb4('0x51')]('custom:agentreject',ut['buildObj'](_0x215805,_0xffb4('0x1be')));_0x1b8082[_0xffb4('0xcc')](_0x47e28f)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1b8082[_0xffb4('0x19a')](0x14,_0x215805,_0x1d58dd)){if(_0x47e28f[_0xffb4('0xf8')]>=_0x1d58dd['dialAgentRejectMaxRetry']){_0x1b8082['createStateFinal'](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1bf'));}else{_0x1b8082[_0xffb4('0x107')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1bf'));}}break;default:_0x1d58dd['outboundUnknownCallsDay']+=0x1;_0x47e28f[_0xffb4('0xee')]=0xc;_0x47e28f[_0xffb4('0xa9')]=_0x46ba7d['reason'];_0x1b8082[_0xffb4('0xcc')](_0x47e28f)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1c0')));if(_0x1b8082[_0xffb4('0x19a')](_0x46ba7d[_0xffb4('0x10f')],_0x215805,_0x1d58dd)){if(_0x47e28f[_0xffb4('0x105')]+_0x47e28f['countcongestionretry']+_0x47e28f[_0xffb4('0xf4')]+_0x47e28f['countnosuchnumberretry']+_0x47e28f[_0xffb4('0xf6')]+_0x47e28f['countabandonedretry']+_0x47e28f['countmachineretry']+_0x47e28f['countagentrejectretry']>=_0x1d58dd[_0xffb4('0xf9')]){_0x1b8082['stateGlobal'](_0x47e28f,_0x475ea3,_0x46712a,_0x46ba7d[_0xffb4('0x10f')]);}else{_0x1b8082[_0xffb4('0xfc')](_0x47e28f,_0x475ea3,_0x46712a,_0x46ba7d[_0xffb4('0x10f')]);}}}});};Dialer[_0xffb4('0xac')]['stateGlobal']=function(_0x37540d,_0xd4fe1f,_0x4d32d9,_0x4872dd){var _0x47b3d7=new Final(_0x37540d);_0x47b3d7[_0xffb4('0xee')]=0xf;_0x47b3d7[_0xffb4('0xa9')]=_0xffb4('0x1c1');this[_0xffb4('0xfc')](_0x47b3d7,_0xd4fe1f,_0x4d32d9,_0x4872dd);};Dialer['prototype'][_0xffb4('0xfc')]=function(_0x398ce7,_0x3660cd,_0x2383df,_0x26c3bd){this['moveContactManagedDialer'](_0x398ce7)['then'](function(){return _0x3660cd(msgResponse(_0xffb4('0x1aa'),'Success',_0x26c3bd));})[_0xffb4('0xb3')](function(){return _0x2383df(msgResponse(_0xffb4('0x1c2'),_0xffb4('0x140'),_0xffb4('0x1c3')));});};Dialer[_0xffb4('0xac')][_0xffb4('0xb')]=function(_0x94073d){var _0x52b9d8=_0x94073d['dialPredictiveOptimizationPercentage']/0x64;var _0x4134e2=_0x94073d['outboundDropCallsDayTimeout']/(_0x94073d[_0xffb4('0x6b')]+_0x94073d[_0xffb4('0x67')]);var _0x1e00a8=Math['round'](_0x94073d[_0xffb4('0x76')]*(_0x94073d[_0xffb4('0x1c4')]/0x64));var _0x203a3f=Math[_0xffb4('0x1c5')](_0x94073d['predictiveIntervalAvailable']*(_0x94073d['predictiveIntervalMinThreshold']/0x64));var _0x1427bb=_0x94073d[_0xffb4('0x56')]+_0x94073d[_0xffb4('0xa3')];var _0x3ecdc=Math['floor'](_0x94073d[_0xffb4('0x79')]*_0x94073d[_0xffb4('0x7b')]*_0x94073d[_0xffb4('0x73')]*_0x94073d[_0xffb4('0x74')]);if(_[_0xffb4('0x43')](_0x94073d['startProgressive'])){if(!_[_0xffb4('0x43')](_0x94073d[_0xffb4('0x2a')])){_0x94073d[_0xffb4('0x2a')]=undefined;loggerPredictive[_0xffb4('0x98')](_0xffb4('0x1c6'),_0xffb4('0x1c7'));}if(!_['isUndefined'](_0x94073d[_0xffb4('0x94')])){loggerPredictive[_0xffb4('0x98')](_0xffb4('0x1c6'),_0xffb4('0x1c8'));clearInterval(_0x94073d[_0xffb4('0x94')]);_0x94073d[_0xffb4('0x94')]=undefined;}_0x94073d[_0xffb4('0x2b')]=moment()['format'](_0xffb4('0x101'));loggerPredictive['info'](_0x94073d[_0xffb4('0x45')],'collection\x20data\x20in\x20progressive\x20at',_0x94073d['startProgressive']);this['handlePower'](_0x94073d,0x1);}else if(ifInterval(_0x94073d[_0xffb4('0x1c9')],_0x94073d[_0xffb4('0x2b')])){this['handlePower'](_0x94073d,0x1);loggerPredictiveCalls[_0xffb4('0x85')]('[startMethodPredictive][StartProgressive][Loop]',_0x94073d[_0xffb4('0x2b')],_0x94073d[_0xffb4('0x45')]);_0x94073d[_0xffb4('0x79')]=0x0;_0x94073d[_0xffb4('0x72')]=0x0;}else if(_0x52b9d8<_0x4134e2&&_0x94073d[_0xffb4('0x1ca')]===_0xffb4('0x1cb')){freeVariablesPredictive(_0x94073d);loggerPredictive[_0xffb4('0x85')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xffb4('0x1cc'),_0x4134e2,_0xffb4('0x2b'),_0x94073d[_0xffb4('0x45')]);}else if(_0x3ecdc<_0x94073d[_0xffb4('0x72')]&&_0x94073d[_0xffb4('0x1ca')]===_0xffb4('0x1cb')){freeVariablesPredictive(_0x94073d);loggerPredictive['info'](_0xffb4('0x1cd'),_0xffb4('0x1ce'),_0x3ecdc,_0xffb4('0x1cf'),_0x94073d[_0xffb4('0x72')],_0xffb4('0x2b'),_0x94073d['name']);}else if(!ifInterval(_0x94073d['dialPredictiveInterval'],_0x94073d[_0xffb4('0x2b')])&&_[_0xffb4('0x43')](_0x94073d['startPredictive'])&&!_[_0xffb4('0x43')](_0x94073d[_0xffb4('0x2b')])){_0x94073d[_0xffb4('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xffb4('0x85')](_0x94073d[_0xffb4('0x45')],'started\x20in\x20predictive\x20at',_0x94073d[_0xffb4('0x2a')]);this['averageHandleTime'](_0x94073d['dialPredictiveInterval'])[_0xffb4('0xb8')](this[_0xffb4('0x1d0')](_0x94073d))[_0xffb4('0xb8')](mergeDataErlangB(_0x94073d))[_0xffb4('0xb8')](this[_0xffb4('0x1d1')](_0x94073d))[_0xffb4('0xb3')](loggerCatchPredictive(_0xffb4('0x1d2'),_0x94073d));}else if(!ifInterval(_0x94073d['dialPredictiveInterval'],_0x94073d[_0xffb4('0x2a')])){_0x94073d[_0xffb4('0x72')]=0x0;_0x94073d['startPredictive']=moment()[_0xffb4('0x80')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xffb4('0x85')](_0x94073d[_0xffb4('0x45')],'recalculate\x20predictive\x20at',_0x94073d['startPredictive']);clearInterval(_0x94073d[_0xffb4('0x94')]);_0x94073d[_0xffb4('0x94')]=undefined;this['averageHandleTime'](_0x94073d[_0xffb4('0x1c9')])['then'](this[_0xffb4('0x1d0')](_0x94073d))['then'](mergeDataErlangB(_0x94073d))['then'](this[_0xffb4('0x1d1')](_0x94073d))[_0xffb4('0xb3')](loggerCatchPredictive(_0xffb4('0x1d3'),_0x94073d));}else if(_0x94073d[_0xffb4('0x76')]&&_0x1427bb<_0x94073d[_0xffb4('0x76')]-_0x203a3f){freeVariablesPredictive(_0x94073d);loggerPredictive[_0xffb4('0x85')](_0x94073d[_0xffb4('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1427bb,_0xffb4('0x1d4'),_0x94073d[_0xffb4('0x76')],'-',_0x203a3f,'=',_0x94073d[_0xffb4('0x76')]-_0x203a3f,')');}else if(_0x94073d[_0xffb4('0x76')]&&_0x1427bb>_0x94073d[_0xffb4('0x76')]+_0x1e00a8){freeVariablesPredictive(_0x94073d);loggerPredictive[_0xffb4('0x85')](_0x94073d[_0xffb4('0x45')],_0xffb4('0x1d5'),_0x1427bb,_0xffb4('0x1d6'),_0x94073d[_0xffb4('0x76')],'+',_0x1e00a8,'=',_0x94073d[_0xffb4('0x76')]+_0x1e00a8,')');}};Dialer['prototype']['getDataPredictive']=function(_0x2fc3fa){var _0x5124f8=this;return function(_0xf43be4){return new BPromise(function(_0xf97f17,_0x57669d){_[_0xffb4('0x92')](_0x2fc3fa,_0xf43be4[0x0]);if(checkGetDataPredictive(_0xf43be4[0x0])){var _0x3ff149=_0x2fc3fa[_0xffb4('0x76')]=_0x2fc3fa['talking']+_0x2fc3fa[_0xffb4('0x56')];var _0x43ce66=_0x2fc3fa[_0xffb4('0x1c9')]*0x3c;var _0x4a618c=_0xf43be4[0x0]['predictiveIntervalAvgTalktime']+_0xf43be4[0x0][_0xffb4('0x70')];var _0x16b8f2=(_0xf43be4[0x0][_0xffb4('0x6f')]+_0xf43be4[0x0][_0xffb4('0x87')]+_0xf43be4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xf43be4[0x0]['predictiveIntervalTotalCalls'];_0x2fc3fa[_0xffb4('0x73')]=_0x16b8f2>0x0?_0x16b8f2:0x1;switch(_0x2fc3fa['dialPredictiveOptimization']){case _0xffb4('0x1cb'):var _0x2a0091=_0x2fc3fa[_0xffb4('0x1d7')]/0x64;return _0x5124f8[_0xffb4('0x1d8')](_0x3ff149,_0x43ce66,_0x4a618c,_0x16b8f2,_0x2a0091)['then'](function(_0x549708){return _0xf97f17(_0x549708);});case _0xffb4('0x1d9'):var _0xcd8e3e=_0x2fc3fa['dialPredictiveOptimizationPercentage']/0x64;return _0x5124f8['busyFactor'](_0x3ff149,_0x43ce66,_0x4a618c,_0x16b8f2,_0xcd8e3e)[_0xffb4('0xb8')](function(_0x2e472f){return _0xf97f17(_0x2e472f);});default:return _0x57669d(msgResponse(_0xffb4('0x1da'),_0xffb4('0x140'),_0xffb4('0x1db')));}}else{return _0x57669d(msgResponse(_0xffb4('0x1da'),_0xffb4('0x140'),_0xffb4('0x1dc')));}});};};Dialer[_0xffb4('0xac')]['getDataPredictiveOld']=function(_0x3d7e96){var _0x44a408=this;return function(_0x1a4c1d){return new BPromise(function(_0x3176df,_0x24a498){_['merge'](_0x3d7e96,_0x1a4c1d[0x0]);if(checkGetDataPredictive(_0x1a4c1d[0x0])){loggerPredictive['info'](JSON[_0xffb4('0x4d')](_0x1a4c1d[0x0]));if(_0x3d7e96[_0xffb4('0x1ca')]===_0xffb4('0x1cb')){return _0x44a408[_0xffb4('0xc8')](_0x3d7e96['id'])[_0xffb4('0xb8')](function(_0x56e108){var _0x46bdff=_0x3d7e96[_0xffb4('0x57')]-_0x56e108[0x0][_0xffb4('0x1dd')];var _0x310f79=_0x3d7e96[_0xffb4('0x1c9')]*0x3c;var _0x157051=_0x1a4c1d[0x0][_0xffb4('0x8b')]+_0x1a4c1d[0x0][_0xffb4('0x70')];var _0x3d814f=(_0x1a4c1d[0x0][_0xffb4('0x6f')]+_0x1a4c1d[0x0][_0xffb4('0x87')]+_0x1a4c1d[0x0][_0xffb4('0x1de')])/_0x1a4c1d[0x0]['predictiveIntervalTotalCalls'];var _0x23666e=_0x3d7e96[_0xffb4('0x1d7')]/0x64;_0x3d7e96[_0xffb4('0x75')]=_0x56e108[0x0][_0xffb4('0x1dd')]||0x0;_0x3d7e96[_0xffb4('0x73')]=_0x3d814f>0x0?_0x3d814f:0x1;return _0x44a408[_0xffb4('0x1d8')](_0x46bdff,_0x310f79,_0x157051,_0x3d814f,_0x23666e);})['then'](function(_0xa646d4){return _0x3176df(_0xa646d4);})['catch'](function(_0xc86205){return _0x24a498(msgResponse(_0xffb4('0x1df'),_0xffb4('0x140'),JSON[_0xffb4('0x4d')](_0xc86205)));});}if(_0x3d7e96['dialPredictiveOptimization']===_0xffb4('0x1d9')){return _0x44a408[_0xffb4('0xc8')](_0x3d7e96['id'])[_0xffb4('0xb8')](function(_0x15dde8){var _0x9b0278=_0x3d7e96[_0xffb4('0x57')]-_0x15dde8[0x0]['outboundQueuePauses'];var _0x4fc42a=_0x3d7e96['dialPredictiveInterval']*0x3c;var _0x4f4eb9=_0x1a4c1d[0x0][_0xffb4('0x8b')]+_0x1a4c1d[0x0][_0xffb4('0x70')];var _0x1cc9cd=(_0x1a4c1d[0x0][_0xffb4('0x6f')]+_0x1a4c1d[0x0][_0xffb4('0x87')]+_0x1a4c1d[0x0][_0xffb4('0x1de')])/_0x1a4c1d[0x0][_0xffb4('0x77')];var _0x5bcb77=_0x3d7e96[_0xffb4('0x1d7')]/0x64;_0x3d7e96[_0xffb4('0x75')]=_0x15dde8[0x0][_0xffb4('0x1dd')]||0x0;_0x3d7e96['predictiveIntervalHitRate']=_0x1cc9cd>0x0?_0x1cc9cd:0x1;return _0x44a408[_0xffb4('0x1e0')](_0x9b0278,_0x4fc42a,_0x4f4eb9,_0x1cc9cd,_0x5bcb77);})[_0xffb4('0xb8')](function(_0x1a2fa1){return _0x3176df(_0x1a2fa1);})[_0xffb4('0xb3')](function(_0x6d652){return _0x24a498(msgResponse('[CatchErlangB]','Failure',JSON[_0xffb4('0x4d')](_0x6d652)));});}}else{return _0x24a498(msgResponse(_0xffb4('0x1da'),'Failure',_0xffb4('0x1dc')));}});};};Dialer[_0xffb4('0xac')]['startMethodPredictive']=function(_0x568eb8){var _0x414555=this;return function(){var _0x2f58b1=0x0;var _0x362af4=Math['floor'](_0x568eb8['erlangCallToSecond']*0x3e8);if(_0x362af4>0x0){_0x362af4=_0x362af4<0x64?0x64:_0x362af4;loggerPredictive['info'](_0x568eb8['name'],_0xffb4('0x1e1'),_0x362af4,_0xffb4('0x4e'));_0x568eb8[_0xffb4('0x94')]=setInterval(function(){_0x414555[_0xffb4('0x94')](_0x568eb8);loggerPredictiveCalls[_0xffb4('0x85')](_0xffb4('0x1e2'),_0x2f58b1+=0x1);},_0x362af4);}else{loggerPredictive[_0xffb4('0x85')](_0x568eb8[_0xffb4('0x45')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xffb4('0xac')][_0xffb4('0x1e3')]=function(_0x3aab60,_0x14586b){var _0x12acde=this;return function(_0x1b26d8){if(_['isEmpty'](_0x1b26d8)){if(_['isNil'](_0x14586b[_0xffb4('0xd5')])||!_0x14586b[_0xffb4('0x1e4')]){if(_0x3aab60[_0xffb4('0x61')]===_0xffb4('0xa')){_0x3aab60['queueStatusComplete']=_['isUndefined'](_0x3aab60[_0xffb4('0x12c')])?!![]:_0x3aab60[_0xffb4('0x12c')];var _0x20c7ed=uuid['v4']();_0x12acde[_0xffb4('0xae')][_0x20c7ed]=new Action(_0x3aab60,_0x14586b,_0x20c7ed);loggerBooked[_0xffb4('0x85')](_0xffb4('0x1e5'),_0x20c7ed,_0xffb4('0x1e6'),JSON['stringify'](_0x3aab60[_0xffb4('0x12c')]),_0xffb4('0x1e7'),_0x3aab60[_0xffb4('0x45')]);if(_0x3aab60[_0xffb4('0x12c')]){_0x3aab60[_0xffb4('0x12c')]=![];_0x12acde['queueBooked'][_0x12acde[_0xffb4('0xae')][_0x20c7ed][_0xffb4('0xb5')]]=[];ami['Action']({'actionid':_0x20c7ed,'action':_0xffb4('0x1e8'),'queue':_0x3aab60[_0xffb4('0x45')]})[_0xffb4('0xb3')](function(){_0x12acde[_0xffb4('0xb4')](_0x3aab60);_0x12acde[_0xffb4('0xc2')]({'active':![],'ContactId':_0x12acde['actions'][_0x20c7ed][_0xffb4('0x108')],'ListId':_0x12acde['actions'][_0x20c7ed][_0xffb4('0xd4')],'VoiceQueueId':_0x12acde['actions'][_0x20c7ed][_0xffb4('0xd6')]||undefined,'CampaignId':_0x12acde[_0xffb4('0xae')][_0x20c7ed]['CampaignId']||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1e9')));delete _0x12acde[_0xffb4('0xae')][_0x20c7ed];});}else{loggerBooked[_0xffb4('0x85')](_0xffb4('0x1ea'),JSON[_0xffb4('0x4d')](_0x3aab60[_0xffb4('0x12c')]),_0xffb4('0x1e7'),_0x3aab60[_0xffb4('0x45')]);_0x12acde['updateOriginated'](_0x3aab60);_0x12acde[_0xffb4('0xc2')]({'active':![],'ContactId':_0x12acde[_0xffb4('0xae')][_0x20c7ed][_0xffb4('0x108')],'ListId':_0x12acde[_0xffb4('0xae')][_0x20c7ed][_0xffb4('0xd4')],'VoiceQueueId':_0x12acde[_0xffb4('0xae')][_0x20c7ed][_0xffb4('0xd6')]||undefined,'CampaignId':_0x12acde['actions'][_0x20c7ed][_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1e9')));delete _0x12acde[_0xffb4('0xae')][_0x20c7ed];}}else{return _0x12acde[_0xffb4('0x166')](_0x3aab60,_0x14586b);}}else{if(getDiff(_0x14586b[_0xffb4('0x1eb')])<_0x3aab60[_0xffb4('0x1ec')]*0x3c){if(_0x14586b[_0xffb4('0x1ed')]&&!_0x14586b['Agent'][_0xffb4('0x1ee')]){_0x12acde['preview'][_0xffb4('0x12e')](_0x14586b['id'])['finally'](function(){_0x12acde[_0xffb4('0xb4')](_0x3aab60);});}else{_0x12acde[_0xffb4('0xc4')]({'active':![]},_0x14586b['id'],0x1)['finally'](function(){_0x12acde[_0xffb4('0xb4')](_0x3aab60);});}}else{_0x3aab60[_0xffb4('0x6d')]+=0x1;_0x12acde[_0xffb4('0xb4')](_0x3aab60);if(_0x3aab60[_0xffb4('0x1ef')]){_0x12acde[_0xffb4('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x14586b['ContactId'],'ListId':_0x14586b['ListId'],'VoiceQueueId':_0x14586b['VoiceQueueId']||undefined,'CampaignId':_0x14586b[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1f0')));_0x12acde['createHistory'](createObjHistory(_0x3aab60,_0x14586b,_0xffb4('0x1f1'),0x17,_0xffb4('0x1f2')))['catch'](loggerCatch(_0xffb4('0x1f3')));}else{_0x12acde['saveInDb'](createObjHistory(_0x3aab60,_0x14586b,_0xffb4('0x1f4'),0x16,'RecallFailedTimeout'),_0xffb4('0x1f5'),'[Originate][HistoryRecallClose]');}}}}else{_0x3aab60[_0xffb4('0x68')]+=0x1;_0x12acde['saveInDb'](createObjHistory(_0x3aab60,_0x14586b,_0xffb4('0x1f6'),0xd,_0xffb4('0x1f7')),'[Originate][historyBlacklist]',_0xffb4('0x1f8'));throw _0xffb4('0x1f9');}};};Dialer[_0xffb4('0xac')][_0xffb4('0x15c')]=function(_0x493431){var _0x266125=this;var _0x14615b=_0x493431[_0xffb4('0x1fa')]-_0x493431[_0xffb4('0x78')]-_0x493431['temp'];emitCampaignSummary(_0x493431);if(_0x14615b>0x0){if(_0x14615b>this[_0xffb4('0x27')]){_0x14615b=this[_0xffb4('0x27')];}_0x493431['temp']+=_0x14615b;this['getContactDialerIvr'](_0x493431['id'],_0x14615b,_0x493431['dialOrderByScheduledAt'])[_0xffb4('0xb8')](function(_0x5cd013){_0x493431[_0xffb4('0x1fb')]-=_0x14615b;_0x493431['temp']=_0x493431['temp']>0x0?_0x493431[_0xffb4('0x1fb')]:0x0;if(!checkContactEmpty(_0x5cd013)){_0x493431[_0xffb4('0x44')]='AVAILABLE_CONTACTS_FINISHED';logger['info']('[getContactCampaign2][Empty]'+_0x493431[_0xffb4('0x45')]);}else{_0x493431[_0xffb4('0x78')]+=_0x5cd013[_0xffb4('0x9b')];_0x493431['message']='RUNNING';for(var _0x133cff=0x0;_0x133cff<_0x5cd013[_0xffb4('0x9b')];_0x133cff+=0x1){_0x493431['ivrTotalCallsDays']+=0x1;if(_[_0xffb4('0xaf')](_0x5cd013[_0x133cff])||_[_0xffb4('0xaf')](_0x5cd013[_0x133cff][_0xffb4('0x16b')])||_[_0xffb4('0xaf')](_0x5cd013[_0x133cff][_0xffb4('0x16b')]['phone'])){_0x266125['emptyContact'](_0xffb4('0x1fc'),_0x493431,_0x5cd013[_0x133cff]);}else{_0x266125['checkIsBlackListIvr'](_[_0xffb4('0xd3')](_0x5cd013[_0x133cff],['CampaignId','Contact.phone']))['then'](_0x266125[_0xffb4('0x1e3')](_0x493431,_0x5cd013[_0x133cff]))[_0xffb4('0xb3')](_0x266125[_0xffb4('0xd0')](_0xffb4('0x1fd'),_0x493431));}}}})[_0xffb4('0xb3')](loggerGetContactDialer(_0xffb4('0x1fe'),_0x493431,_0x14615b));}};Dialer[_0xffb4('0xac')][_0xffb4('0x157')]=function(_0x1f1397,_0x29f4cd){var _0x983b7b=this;var _0x3ce9fa=[];var _0x8a8a9e=_0x29f4cd>=0x1?_0x29f4cd:0x1;if(_0x1f1397[_0xffb4('0x61')]===_0xffb4('0xa')){_0x8a8a9e=0x1;}var _0x217789=Math[_0xffb4('0x1ff')](_0x1f1397[_0xffb4('0x56')]*_0x8a8a9e)-_0x1f1397[_0xffb4('0x78')]-_0x1f1397['temp'];emitVoiceQueueSummary(_0x1f1397);if(_0x1f1397['dialLimitQueue']>0x0){var _0x50166d=_0x1f1397[_0xffb4('0x200')]-_0x1f1397[_0xffb4('0x78')]-_0x1f1397[_0xffb4('0xa3')]-_0x1f1397[_0xffb4('0x1fb')]-_0x1f1397[_0xffb4('0x58')];if(_0x217789>_0x50166d){_0x217789=_0x50166d;}}if(_0x217789>0x0){if(_0x1f1397['dialMethod']==='booked'){_0x217789=0x1;}if(_0x217789>this[_0xffb4('0x27')]){_0x217789=this[_0xffb4('0x27')];}_0x1f1397[_0xffb4('0x1fb')]+=_0x217789;for(var _0x18a7ef in this[_0xffb4('0x25')]){if(typeof this[_0xffb4('0x25')][_0x18a7ef]!=='undefined'){if(this[_0xffb4('0x25')][_0x18a7ef]['state']===_0xffb4('0x201')&&this[_0xffb4('0x25')][_0x18a7ef][_0xffb4('0xb1')]===_0xffb4('0xdf')){_0x3ce9fa['push'](this['agents'][_0x18a7ef]['id']);}}}this['getContactDialer'](_0x1f1397['id'],_0x3ce9fa,_0x217789,_0x1f1397[_0xffb4('0x202')])[_0xffb4('0xb8')](function(_0x594574){_0x1f1397[_0xffb4('0x1fb')]-=_0x217789;_0x1f1397[_0xffb4('0x1fb')]=_0x1f1397[_0xffb4('0x1fb')]>0x0?_0x1f1397[_0xffb4('0x1fb')]:0x0;if(!checkContactEmpty(_0x594574)){_0x983b7b[_0xffb4('0xb7')](_0x1f1397)[_0xffb4('0xb8')](sendMessageReschedule(_0x1f1397))[_0xffb4('0xb3')](loggerCatch('[countReScheduled]\x20'));}else{_0x1f1397[_0xffb4('0x78')]+=_0x594574[_0xffb4('0x9b')];_0x1f1397[_0xffb4('0x44')]=_0x1f1397[_0xffb4('0x61')]==='booked'?_0xffb4('0x173'):_0xffb4('0x203');for(var _0x970c0e=0x0;_0x970c0e<_0x594574[_0xffb4('0x9b')];_0x970c0e+=0x1){if(_[_0xffb4('0xaf')](_0x594574[_0x970c0e])||_['isNil'](_0x594574[_0x970c0e][_0xffb4('0x16b')])||_[_0xffb4('0xaf')](_0x594574[_0x970c0e][_0xffb4('0x16b')][_0xffb4('0x16a')])){_0x983b7b[_0xffb4('0xd1')](_0xffb4('0x1fc'),_0x1f1397,_0x594574[_0x970c0e]);}else{_0x983b7b[_0xffb4('0xba')](_[_0xffb4('0xd3')](_0x594574[_0x970c0e],[_0xffb4('0xd6'),_0xffb4('0x204')]))[_0xffb4('0xb8')](_0x983b7b['checkContactBlack'](_0x1f1397,_0x594574[_0x970c0e]))[_0xffb4('0xb3')](_0x983b7b[_0xffb4('0xd0')](_0xffb4('0x1fc'),_0x1f1397));}}}})[_0xffb4('0xb3')](loggerGetContactDialer(_0xffb4('0x205'),_0x1f1397,_0x217789));}};Dialer['prototype'][_0xffb4('0x94')]=function(_0x395e84){if(_0x395e84[_0xffb4('0x200')]>0x0){var _0x4ad42d=_0x395e84[_0xffb4('0x200')]-_0x395e84[_0xffb4('0x78')]-_0x395e84[_0xffb4('0xa3')];if(_0x4ad42d>0x0){this['tryOriginatePredictive'](_0x395e84);}else{loggerPredictiveCalls['info'](_0xffb4('0x206'));}}else{this[_0xffb4('0x207')](_0x395e84);}};Dialer['prototype'][_0xffb4('0x207')]=function(_0x50c0aa){var _0x161445=this;var _0x14fc4b=[];_0x50c0aa[_0xffb4('0x78')]+=0x1;for(var _0xa82467 in this['agents']){if(typeof this[_0xffb4('0x25')][_0xa82467]!==_0xffb4('0x9c')){if(this[_0xffb4('0x25')][_0xa82467]['state']===_0xffb4('0x201')&&this[_0xffb4('0x25')][_0xa82467][_0xffb4('0xb1')]===_0xffb4('0xdf')){_0x14fc4b[_0xffb4('0x14c')](this[_0xffb4('0x25')][_0xa82467]['id']);}}}this[_0xffb4('0xc5')](_0x50c0aa['id'],_0x14fc4b,0x1,_0x50c0aa[_0xffb4('0x202')])['then'](function(_0x55348d){if(!checkContactEmpty(_0x55348d)){checkContactLowerLimitOriginate(_0x50c0aa,0x1,0x0);_0x161445[_0xffb4('0xb7')](_0x50c0aa)[_0xffb4('0xb8')](sendMessageReschedule(_0x50c0aa))['catch'](loggerCatch(_0xffb4('0xb9')));}else{_0x50c0aa[_0xffb4('0x44')]=_0xffb4('0x203');if(_[_0xffb4('0xaf')](_0x55348d[0x0])||_[_0xffb4('0xaf')](_0x55348d[0x0][_0xffb4('0x16b')])||_[_0xffb4('0xaf')](_0x55348d[0x0][_0xffb4('0x16b')][_0xffb4('0x16a')])){_0x161445[_0xffb4('0xd1')](_0xffb4('0x1fc'),_0x50c0aa,_0x55348d[0x0]);}else{_0x161445[_0xffb4('0xba')](_['pick'](_0x55348d[0x0],[_0xffb4('0xd6'),'Contact.phone']))[_0xffb4('0xb8')](_0x161445[_0xffb4('0x1e3')](_0x50c0aa,_0x55348d[0x0]))['catch'](_0x161445['loggerHandler'](_0xffb4('0x208'),_0x50c0aa));}}})[_0xffb4('0xb3')](loggerGetContactDialer(_0xffb4('0x209'),_0x50c0aa,0x1));emitVoiceQueueSummary(_0x50c0aa);};Dialer[_0xffb4('0xac')]['abandonmentRate']=function(_0xa38edf,_0x9dfdaa,_0x4b451b,_0x15738b,_0xab1b23,_0x4fe162){loggerPredictive[_0xffb4('0x85')](_0xffb4('0x20a'));loggerPredictive[_0xffb4('0x85')](_0xffb4('0x20b'),_0xa38edf);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x20c'),_0x9dfdaa);loggerPredictive['info'](_0xffb4('0x20d'),_0x4b451b);loggerPredictive[_0xffb4('0x85')]('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',_0x15738b);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x20e'),_0xab1b23);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x8a'));return new BPromise(function(_0x4d2e07,_0x2ac770){if(_0xa38edf<=0x0||isNaN(_0xa38edf)){return _0x2ac770(msgResponse(_0xffb4('0x20f'),'Error','m\x20=\x20'+_0xa38edf));}if(_0x4b451b<=0x0||isNaN(_0x4b451b)){return _0x2ac770(msgResponse(_0xffb4('0x20f'),'Error',_0xffb4('0x210')+_0x4b451b));}if(_0x15738b<=0x0||isNaN(_0x15738b)){return _0x2ac770(msgResponse(_0xffb4('0x20f'),_0xffb4('0x4c'),_0xffb4('0x211')+_0x15738b));}if(_0x9dfdaa<=0x0||isNaN(_0x9dfdaa)){return _0x2ac770(msgResponse(_0xffb4('0x20f'),_0xffb4('0x4c'),_0xffb4('0x212')+_0x9dfdaa));}if(_0xab1b23<=0x0||isNaN(_0xab1b23)){return _0x2ac770(msgResponse(_0xffb4('0x20f'),_0xffb4('0x4c'),'Amax\x20=\x20'+_0xab1b23));}_0x4fe162=_0x4fe162||0x0;var _0x1cbc0d=0x1/_0x4b451b;var _0x120c7a=0x0;var _0x51b0a4=0x0;var _0x11a96b=0x0;var _0xeb759c=0x0;for(var _0x1de0a3=0x0;_0x11a96b<_0xab1b23;_0x1de0a3+=0x1){_0x51b0a4=_0x1de0a3/_0x9dfdaa;_0x120c7a=(_0x15738b*_0x51b0a4+_0x4fe162)/_0x1cbc0d;_0x11a96b=erlangb(_0x120c7a,_0xa38edf);_0xeb759c=_0x120c7a/_0xa38edf*(0x1-erlangb(_0x120c7a,_0xa38edf));}return _0x4d2e07({'erlangCalls':_0x1de0a3,'erlangCallToSecond':_0x9dfdaa/_0x1de0a3,'erlangAbandonmentRate':_0x11a96b,'erlangBusyFactor':_0xeb759c});});};Dialer[_0xffb4('0xac')][_0xffb4('0x1e0')]=function(_0x52627e,_0x70593f,_0x1e141e,_0x48bd0b,_0x36fb66,_0x57e5da){loggerPredictive[_0xffb4('0x85')](_0xffb4('0x213'));loggerPredictive[_0xffb4('0x85')]('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',_0x52627e);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x70593f);loggerPredictive['info'](_0xffb4('0x20d'),_0x1e141e);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x214'),_0x48bd0b);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x215'),_0x36fb66);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x8a'));return new BPromise(function(_0x45aebc,_0x5603bd){if(_0x52627e<=0x0||isNaN(_0x52627e)){return _0x5603bd(msgResponse(_0xffb4('0x216'),_0xffb4('0x4c'),'m\x20=\x20'+_0x52627e));}if(_0x1e141e<=0x0||isNaN(_0x1e141e)){return _0x5603bd(msgResponse(_0xffb4('0x216'),'Error','Ts\x20=\x20'+_0x1e141e));}if(_0x48bd0b<=0x0||isNaN(_0x48bd0b)){return _0x5603bd(msgResponse(_0xffb4('0x216'),_0xffb4('0x4c'),_0xffb4('0x211')+_0x48bd0b));}if(_0x70593f<=0x0||isNaN(_0x70593f)){return _0x5603bd(msgResponse(_0xffb4('0x216'),'Error',_0xffb4('0x212')+_0x70593f));}if(_0x36fb66<=0x0||isNaN(_0x36fb66)){return _0x5603bd(msgResponse('[busyFactor]',_0xffb4('0x4c'),_0xffb4('0x217')+_0x36fb66));}_0x57e5da=_0x57e5da||0x0;var _0x30a466=0x1/_0x1e141e;var _0xadc7f6=0x0;var _0x23e1bc=0x0;var _0x2a194f=0x0;var _0x303b31=0x0;for(var _0x5bb3e3=0x0;_0x303b31<_0x36fb66;_0x5bb3e3+=0x1){_0x23e1bc=_0x5bb3e3/_0x70593f;_0xadc7f6=(_0x48bd0b*_0x23e1bc+_0x57e5da)/_0x30a466;_0x2a194f=erlangb(_0xadc7f6,_0x52627e);_0x303b31=_0xadc7f6/_0x52627e*(0x1-erlangb(_0xadc7f6,_0x52627e));}return _0x45aebc({'erlangCalls':_0x5bb3e3,'erlangCallToSecond':_0x70593f/_0x5bb3e3,'erlangAbandonmentRate':_0x2a194f,'erlangBusyFactor':_0x303b31});});};module[_0xffb4('0x218')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index f831a60..f7fee9b 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 _0xa40f=['droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime'];(function(_0x496e59,_0x462efe){var _0x5704b8=function(_0x3ba5a1){while(--_0x3ba5a1){_0x496e59['push'](_0x496e59['shift']());}};_0x5704b8(++_0x462efe);}(_0xa40f,0x108));var _0xfa40=function(_0x50f617,_0x4ebb6a){_0x50f617=_0x50f617-0x0;var _0x5c52fb=_0xa40f[_0x50f617];return _0x5c52fb;};'use strict';var util=require(_0xfa40('0x0'));var _=require('lodash');var moment=require(_0xfa40('0x1'));function getSeconds(_0x170be9,_0x2dd63f){var _0xbfa3b3=moment(_0x170be9)[_0xfa40('0x2')](0x0);var _0x579e64=moment(_0x2dd63f)[_0xfa40('0x2')](0x0);return _0xbfa3b3[_0xfa40('0x3')](_0x579e64,_0xfa40('0x4'));}function QueueCallerAbandon(_0x36daff,_0x3e6d6a){this['scheduledat']=_0x36daff[_0xfa40('0x5')];this[_0xfa40('0x6')]=_0x36daff[_0xfa40('0x6')];this[_0xfa40('0x7')]=_0x36daff[_0xfa40('0x6')]==='outbound'?_0xfa40('0x8'):_0x36daff[_0xfa40('0x6')];this[_0xfa40('0x9')]=_0x36daff[_0xfa40('0x9')];this['countcongestionretry']=_0x36daff['countcongestionretry'];this['countnoanswerretry']=_0x36daff[_0xfa40('0xa')];this[_0xfa40('0xb')]=_0x36daff[_0xfa40('0x9')]+_0x36daff[_0xfa40('0xc')]+_0x36daff[_0xfa40('0xa')]+_0x36daff[_0xfa40('0xd')]+_0x36daff[_0xfa40('0xe')]+_0x36daff[_0xfa40('0xf')]+_0x36daff[_0xfa40('0x10')]+_0x36daff[_0xfa40('0x11')];this['countnosuchnumberretry']=_0x36daff['countnosuchnumberretry'];this[_0xfa40('0xe')]=_0x36daff[_0xfa40('0xe')];this[_0xfa40('0xf')]=_0x36daff[_0xfa40('0xf')];this['countmachineretry']=_0x36daff[_0xfa40('0x10')];this[_0xfa40('0x11')]=_0x36daff[_0xfa40('0x11')];this[_0xfa40('0x12')]=_0x3e6d6a[_0xfa40('0x12')];this[_0xfa40('0x13')]=_0x36daff[_0xfa40('0x14')];this['calleridnum']=_0x36daff['number'];this[_0xfa40('0x15')]=_0x36daff[_0xfa40('0x15')];this['responsetime']=_0x36daff[_0xfa40('0x16')];this[_0xfa40('0x17')]=_0x36daff[_0xfa40('0x17')];this[_0xfa40('0x18')]=this['droptime'];this[_0xfa40('0x19')]=getSeconds(_0x36daff[_0xfa40('0x16')],_0x36daff[_0xfa40('0x15')]);this[_0xfa40('0x1a')]=getSeconds(this['droptime'],_0x36daff[_0xfa40('0x16')]);this['talktime']=0x0;this['queue']=_0x3e6d6a[_0xfa40('0x8')];this[_0xfa40('0x1b')]=_0x3e6d6a[_0xfa40('0x1c')];this['reason']=_0x3e6d6a[_0xfa40('0x1d')];this[_0xfa40('0x1e')]=_0x36daff['callback'];this[_0xfa40('0x1f')]=_0x36daff[_0xfa40('0x1f')];this[_0xfa40('0x20')]=_0x36daff[_0xfa40('0x20')];this[_0xfa40('0x21')]=_0x36daff[_0xfa40('0x21')];this[_0xfa40('0x22')]=_0x36daff[_0xfa40('0x22')];this[_0xfa40('0x23')]=_0x36daff[_0xfa40('0x23')];this[_0xfa40('0x24')]=_0x36daff[_0xfa40('0x24')];this[_0xfa40('0x25')]=_0x36daff['VoiceQueueId'];this[_0xfa40('0x26')]=_0x36daff['CampaignId'];this[_0xfa40('0x27')]=_0x36daff['originatecalleridnum']||'';this[_0xfa40('0x28')]=_0x36daff[_0xfa40('0x28')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xb905=['countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x4ac2d2,_0x547088){var _0x175eda=function(_0x2afeeb){while(--_0x2afeeb){_0x4ac2d2['push'](_0x4ac2d2['shift']());}};_0x175eda(++_0x547088);}(_0xb905,0x174));var _0x5b90=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb905[_0x397e5f];return _0x5302b8;};'use strict';var util=require('util');var _=require(_0x5b90('0x0'));var moment=require(_0x5b90('0x1'));function getSeconds(_0xae0d6a,_0x287d3c){var _0x36eb0f=moment(_0xae0d6a)[_0x5b90('0x2')](0x0);var _0x1b21c5=moment(_0x287d3c)[_0x5b90('0x2')](0x0);return _0x36eb0f[_0x5b90('0x3')](_0x1b21c5,_0x5b90('0x4'));}function QueueCallerAbandon(_0xe42da0,_0x3eacef){this[_0x5b90('0x5')]=_0xe42da0[_0x5b90('0x5')];this[_0x5b90('0x6')]=_0xe42da0['type'];this[_0x5b90('0x7')]=_0xe42da0[_0x5b90('0x6')]===_0x5b90('0x8')?_0x5b90('0x9'):_0xe42da0[_0x5b90('0x6')];this[_0x5b90('0xa')]=_0xe42da0[_0x5b90('0xa')];this[_0x5b90('0xb')]=_0xe42da0['countcongestionretry'];this[_0x5b90('0xc')]=_0xe42da0[_0x5b90('0xc')];this[_0x5b90('0xd')]=_0xe42da0['countbusyretry']+_0xe42da0[_0x5b90('0xb')]+_0xe42da0['countnoanswerretry']+_0xe42da0[_0x5b90('0xe')]+_0xe42da0['countdropretry']+_0xe42da0[_0x5b90('0xf')]+_0xe42da0['countmachineretry']+_0xe42da0['countagentrejectretry'];this['countnosuchnumberretry']=_0xe42da0[_0x5b90('0xe')];this[_0x5b90('0x10')]=_0xe42da0[_0x5b90('0x10')];this[_0x5b90('0xf')]=_0xe42da0[_0x5b90('0xf')];this[_0x5b90('0x11')]=_0xe42da0[_0x5b90('0x11')];this[_0x5b90('0x12')]=_0xe42da0[_0x5b90('0x12')];this[_0x5b90('0x13')]=_0x3eacef[_0x5b90('0x13')];this[_0x5b90('0x14')]=_0xe42da0['name'];this[_0x5b90('0x15')]=_0xe42da0[_0x5b90('0x16')];this[_0x5b90('0x17')]=_0xe42da0[_0x5b90('0x17')];this[_0x5b90('0x18')]=_0xe42da0[_0x5b90('0x18')];this[_0x5b90('0x19')]=_0xe42da0['droptime'];this['endtime']=this[_0x5b90('0x19')];this[_0x5b90('0x1a')]=getSeconds(_0xe42da0[_0x5b90('0x18')],_0xe42da0[_0x5b90('0x17')]);this[_0x5b90('0x1b')]=getSeconds(this['droptime'],_0xe42da0[_0x5b90('0x18')]);this[_0x5b90('0x1c')]=0x0;this[_0x5b90('0x9')]=_0x3eacef[_0x5b90('0x9')];this['membername']=_0x3eacef[_0x5b90('0x1d')];this['reason']=_0x3eacef[_0x5b90('0x1e')];this[_0x5b90('0x1f')]=_0xe42da0[_0x5b90('0x1f')];this[_0x5b90('0x20')]=_0xe42da0['callbackuniqueid'];this['callbackat']=_0xe42da0[_0x5b90('0x21')];this['recallme']=_0xe42da0[_0x5b90('0x22')];this[_0x5b90('0x23')]=_0xe42da0[_0x5b90('0x23')];this[_0x5b90('0x24')]=_0xe42da0[_0x5b90('0x24')];this['UserId']=_0xe42da0[_0x5b90('0x25')];this['VoiceQueueId']=_0xe42da0[_0x5b90('0x26')];this[_0x5b90('0x27')]=_0xe42da0[_0x5b90('0x27')];this[_0x5b90('0x28')]=_0xe42da0[_0x5b90('0x28')]||'';this[_0x5b90('0x29')]=_0xe42da0['originatecalleridname']||'';}module[_0x5b90('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index a270ada..216e38b 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 _0xaaca=['name','fax','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid','channel','format','tech','Trunk'];(function(_0x35b195,_0x8893d5){var _0x2433bf=function(_0x22be07){while(--_0x22be07){_0x35b195['push'](_0x35b195['shift']());}};_0x2433bf(++_0x8893d5);}(_0xaaca,0x19c));var _0xaaac=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0xaaca[_0x95942];return _0x6d7f81;};'use strict';var util=require(_0xaaac('0x0'));var _=require(_0xaaac('0x1'));var moment=require(_0xaaac('0x2'));function Action(_0x41059d,_0x475d29,_0x115970){this[_0xaaac('0x3')]=_0x41059d||undefined;this[_0xaaac('0x4')]=util[_0xaaac('0x5')]('%s/%s/%s',_0x475d29[_0xaaac('0x6')],_0x475d29[_0xaaac('0x7')][_0xaaac('0x8')],_0x115970[_0xaaac('0x9')]);this['localstationid']=_0x475d29['localstationid'];this['headerinfo']=_0x475d29[_0xaaac('0xa')];this[_0xaaac('0xb')]=_0x115970['path'];this[_0xaaac('0xc')]=_0x115970[_0xaaac('0xc')];}module[_0xaaac('0xd')]=Action; \ No newline at end of file +var _0xd13f=['exports','util','lodash','moment','uniqueid','channel','tech','Trunk','fax','localstationid','headerinfo','path','AttachmentId'];(function(_0x19685f,_0x15e119){var _0x25c05d=function(_0xe56243){while(--_0xe56243){_0x19685f['push'](_0x19685f['shift']());}};_0x25c05d(++_0x15e119);}(_0xd13f,0x1a1));var _0xfd13=function(_0x2f11b9,_0x235692){_0x2f11b9=_0x2f11b9-0x0;var _0x49397c=_0xd13f[_0x2f11b9];return _0x49397c;};'use strict';var util=require(_0xfd13('0x0'));var _=require(_0xfd13('0x1'));var moment=require(_0xfd13('0x2'));function Action(_0x3091a1,_0x491cec,_0x49c5a3){this[_0xfd13('0x3')]=_0x3091a1||undefined;this[_0xfd13('0x4')]=util['format']('%s/%s/%s',_0x491cec[_0xfd13('0x5')],_0x491cec[_0xfd13('0x6')]['name'],_0x49c5a3[_0xfd13('0x7')]);this[_0xfd13('0x8')]=_0x491cec['localstationid'];this[_0xfd13('0x9')]=_0x491cec[_0xfd13('0x9')];this['path']=_0x49c5a3[_0xfd13('0xa')];this[_0xfd13('0xb')]=_0x49c5a3[_0xfd13('0xb')];}module[_0xfd13('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 0cd3eab..ef885aa 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 _0xfdbe=['isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','uuid','path','tiff2pdf','./util/gs','fax','../ami','./channel','./util/util','./action','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xfdbe,0x15a));var _0xefdb=function(_0x584da8,_0x4944c4){_0x584da8=_0x584da8-0x0;var _0x4da924=_0xfdbe[_0x584da8];return _0x4da924;};'use strict';var util=require(_0xefdb('0x0'));var _=require(_0xefdb('0x1'));var BPromise=require('bluebird');var uuid=require(_0xefdb('0x2'));var moment=require('moment');var path=require(_0xefdb('0x3'));var tiff2pdf=require(_0xefdb('0x4'));var gs=require(_0xefdb('0x5'));var logger=require('../../../config/logger')(_0xefdb('0x6'));var ami=require(_0xefdb('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0xefdb('0x8'));var ut=require(_0xefdb('0x9'));var Action=require(_0xefdb('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xefdb('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x50a138){this[_0xefdb('0xc')]={};this[_0xefdb('0xd')]=_0x50a138[_0xefdb('0xd')];this[_0xefdb('0xe')]=_0x50a138[_0xefdb('0xe')];this[_0xefdb('0xf')]={};ami['on'](_0xefdb('0x10'),this[_0xefdb('0x11')][_0xefdb('0x12')](this));ami['on']('varset',this[_0xefdb('0x13')]['bind'](this));ami['on'](_0xefdb('0x14'),this['syncNewState'][_0xefdb('0x12')](this));ami['on'](_0xefdb('0x15'),this[_0xefdb('0x16')][_0xefdb('0x12')](this));ami['on'](_0xefdb('0x17'),this[_0xefdb('0x18')][_0xefdb('0x12')](this));ami['on'](_0xefdb('0x19'),this[_0xefdb('0x1a')]['bind'](this));ami['on'](_0xefdb('0x1b'),this[_0xefdb('0x1c')][_0xefdb('0x12')](this));ami['on'](_0xefdb('0x1d'),this[_0xefdb('0x1e')][_0xefdb('0x12')](this));}Fax[_0xefdb('0x1f')][_0xefdb('0x11')]=function(_0x30ad2d){if(_0x30ad2d[_0xefdb('0x20')]==='from-voip-provider'){for(var _0x30d3b3 in this['faxAccounts']){if(this[_0xefdb('0xd')][_0xefdb('0x21')](_0x30d3b3)){if(_0x30ad2d['exten']===this[_0xefdb('0xd')][_0x30d3b3][_0xefdb('0x22')]){this[_0xefdb('0xc')][_0x30ad2d[_0xefdb('0x23')]]={};this['channels'][_0x30ad2d['uniqueid']][_0xefdb('0x24')]=_0x30ad2d[_0xefdb('0x24')];this[_0xefdb('0xc')][_0x30ad2d[_0xefdb('0x23')]]['id']=this['faxAccounts'][_0x30d3b3]['id'];this[_0xefdb('0xc')][_0x30ad2d['uniqueid']][_0xefdb('0x25')]=this[_0xefdb('0xd')][_0x30d3b3][_0xefdb('0x25')];logger['info'](_0x30ad2d[_0xefdb('0x23')],'\x20syncNewchannel\x20');}}}}if(this[_0xefdb('0xf')][_0x30ad2d[_0xefdb('0x23')]]){this[_0xefdb('0xc')][_0x30ad2d[_0xefdb('0x23')]]={};this[_0xefdb('0xc')][_0x30ad2d['uniqueid']][_0xefdb('0x24')]=_0x30ad2d['channel'];logger[_0xefdb('0x26')](_0x30ad2d['uniqueid'],_0xefdb('0x27'));}};Fax[_0xefdb('0x1f')][_0xefdb('0x13')]=function(_0x2dd55e){if(this['channels'][_0x2dd55e[_0xefdb('0x23')]]){for(var _0x5cab40 in _0x2dd55e[_0xefdb('0x28')]){if(_0x2dd55e[_0xefdb('0x28')]['hasOwnProperty'](_0x5cab40)){this[_0xefdb('0xc')][_0x2dd55e['uniqueid']][_0x5cab40]=_0x2dd55e[_0xefdb('0x29')];}}}};Fax[_0xefdb('0x1f')][_0xefdb('0x2a')]=function(_0x2639b3){if(this['channels'][_0x2639b3['uniqueid']]){this['channels'][_0x2639b3[_0xefdb('0x23')]][_0xefdb('0x2b')]=_0x2639b3[_0xefdb('0x2b')];this[_0xefdb('0xc')][_0x2639b3[_0xefdb('0x23')]][_0xefdb('0x2c')]=_0x2639b3['channelstatedesc'];}};Fax[_0xefdb('0x1f')][_0xefdb('0x16')]=function(_0xe600b1){if(this[_0xefdb('0xc')][_0xe600b1['uniqueid']]){for(var _0x1297a4 in _0xe600b1['variable']){if(_0xe600b1[_0xefdb('0x28')][_0xefdb('0x21')](_0x1297a4)){this[_0xefdb('0xc')][_0xe600b1['uniqueid']][_0x1297a4]=_0xe600b1['value'];}}}};Fax[_0xefdb('0x1f')][_0xefdb('0x18')]=function(_0x53981b){if(this[_0xefdb('0xc')][_0x53981b['uniqueid']]){this['channels'][_0x53981b[_0xefdb('0x23')]]['operation']=_0x53981b[_0xefdb('0x2d')];this[_0xefdb('0xc')][_0x53981b['uniqueid']][_0xefdb('0x2e')]=_0x53981b[_0xefdb('0x2e')];this[_0xefdb('0xc')][_0x53981b[_0xefdb('0x23')]]['localstationid']=_0x53981b['localstationid'];this['channels'][_0x53981b[_0xefdb('0x23')]]['filename']=_0x53981b['filename'];logger[_0xefdb('0x26')](_0x53981b['uniqueid'],_0xefdb('0x2f'));}};Fax[_0xefdb('0x1f')]['syncReceiveFax']=function(_0x3abf29){var _0x1d658f=this;if(this[_0xefdb('0xc')][_0x3abf29[_0xefdb('0x23')]]){var _0x6afd79=this[_0xefdb('0xc')][_0x3abf29[_0xefdb('0x23')]]['id'];this[_0xefdb('0xc')][_0x3abf29[_0xefdb('0x23')]][_0xefdb('0x30')]=_0x3abf29['remotestationid'];this[_0xefdb('0xc')][_0x3abf29[_0xefdb('0x23')]][_0xefdb('0x31')]=_0x3abf29[_0xefdb('0x31')];this[_0xefdb('0xc')][_0x3abf29[_0xefdb('0x23')]]['localstationid']=_0x3abf29[_0xefdb('0x22')];this[_0xefdb('0xc')][_0x3abf29[_0xefdb('0x23')]]['resolution']=_0x3abf29['resolution'];this[_0xefdb('0xc')][_0x3abf29[_0xefdb('0x23')]]['transferrate']=_0x3abf29[_0xefdb('0x32')];this[_0xefdb('0xc')][_0x3abf29[_0xefdb('0x23')]][_0xefdb('0x33')]=_0x3abf29[_0xefdb('0x33')];this['channels'][_0x3abf29[_0xefdb('0x23')]][_0xefdb('0x34')]=_0x3abf29[_0xefdb('0x34')];if(this['channels'][_0x3abf29['uniqueid']][_0xefdb('0x31')]>0x0){tiff2pdf(_0x3abf29[_0xefdb('0x33')],_0xefdb('0x35'),function(_0x5c506a){logger['info'](_0x3abf29[_0xefdb('0x23')],_0xefdb('0x36'),_0x5c506a[_0xefdb('0x37')]);attachment[_0xefdb('0x38')]({'name':path['parse'](_0x3abf29[_0xefdb('0x33')])[_0xefdb('0x25')],'basename':path[_0xefdb('0x39')](_0x3abf29['filename'])[_0xefdb('0x25')]+_0xefdb('0x3a'),'type':'application/pdf'})[_0xefdb('0x3b')](function(_0x1d9111){faxAccount['notify'](_0x6afd79,{'from':_0x3abf29[_0xefdb('0x34')],'mapKey':_0xefdb('0x6'),'body':path[_0xefdb('0x39')](_0x3abf29[_0xefdb('0x33')])[_0xefdb('0x25')]+_0xefdb('0x3a'),'AttachmentId':_0x1d9111['id']})[_0xefdb('0x3c')](function(_0x3d02c1){logger[_0xefdb('0x3d')](_0x3abf29[_0xefdb('0x23')],_0xefdb('0x3e'),JSON[_0xefdb('0x3f')](_0x3d02c1));});})[_0xefdb('0x3c')](function(_0x13f832){logger['error'](_0x3abf29['uniqueid'],_0xefdb('0x40'),JSON[_0xefdb('0x3f')](_0x13f832));});});}logger[_0xefdb('0x26')](_0x3abf29[_0xefdb('0x23')],_0xefdb('0x40'));}};Fax[_0xefdb('0x1f')][_0xefdb('0x1e')]=function(_0x6d8bea){if(this['actions'][_0x6d8bea[_0xefdb('0x23')]]){_[_0xefdb('0x41')](this['channels'][_0x6d8bea[_0xefdb('0x23')]],_[_0xefdb('0x42')](_0x6d8bea,['response','reason']));}};function updateStatus(_0x165378){if(_0x165378[_0xefdb('0x43')]){faxMessage[_0xefdb('0x44')](_0x165378['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0xefdb('0x3b')](function(_0x354d55){ut[_0xefdb('0x45')]('[Fax][Message][Error][Updated]',_0x354d55);})[_0xefdb('0x3c')](function(_0x5f49d7){ut[_0xefdb('0x45')](_0xefdb('0x46'),_0x5f49d7);});}else{ut[_0xefdb('0x45')](_0xefdb('0x47'));}}Fax[_0xefdb('0x1f')][_0xefdb('0x48')]=function(_0x2830a0,_0x3e8378,_0x508c55){var _0x3bbc58=this;var _0x12fc1f={};if(_0x3e8378){_0x12fc1f={'read':_0x3e8378};}else{_0x12fc1f={'failMessage':_0x508c55};}if(this[_0xefdb('0xf')][_0x2830a0][_0xefdb('0x43')]){faxMessage[_0xefdb('0x44')](this[_0xefdb('0xf')][_0x2830a0][_0xefdb('0x43')],_0x12fc1f)[_0xefdb('0x3b')](function(_0x4fde5b){ut[_0xefdb('0x45')](_0xefdb('0x49'),_0x4fde5b);})['catch'](function(_0x3acdb0){ut[_0xefdb('0x45')](_0xefdb('0x4a'),_0x3acdb0);})[_0xefdb('0x4b')](function(){delete _0x3bbc58[_0xefdb('0xc')][_0x2830a0];delete _0x3bbc58[_0xefdb('0xf')][_0x2830a0];});}else{ut[_0xefdb('0x45')](_0xefdb('0x4c'));delete this['channels'][_0x2830a0];delete this[_0xefdb('0xf')][_0x2830a0];}};Fax['prototype'][_0xefdb('0x1c')]=function(_0x203b7c){var _0x473fd9=this;if(this[_0xefdb('0xc')][_0x203b7c[_0xefdb('0x23')]]){if(this[_0xefdb('0xf')][_0x203b7c[_0xefdb('0x23')]]){this[_0xefdb('0xc')][_0x203b7c['uniqueid']]['id']=this[_0xefdb('0xf')][_0x203b7c[_0xefdb('0x23')]]['id'];this[_0xefdb('0xc')][_0x203b7c['uniqueid']][_0xefdb('0x25')]=this[_0xefdb('0xf')][_0x203b7c[_0xefdb('0x23')]][_0xefdb('0x25')];}logger[_0xefdb('0x26')](_0x203b7c[_0xefdb('0x23')],this[_0xefdb('0xf')][_0x203b7c['uniqueid']]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0xefdb('0x3f')](this['channels'][_0x203b7c[_0xefdb('0x23')]]));if(this[_0xefdb('0xf')][_0x203b7c[_0xefdb('0x23')]]){if(this[_0xefdb('0xc')][_0x203b7c[_0xefdb('0x23')]][_0xefdb('0x4d')]>0x0&&this[_0xefdb('0xc')][_0x203b7c[_0xefdb('0x23')]][_0xefdb('0x17')]===_0xefdb('0x4e')){this[_0xefdb('0x48')](_0x203b7c['uniqueid'],!![]);}else{this[_0xefdb('0x48')](_0x203b7c[_0xefdb('0x23')],![],this['channels'][_0x203b7c[_0xefdb('0x23')]][_0xefdb('0x4f')]?_0xefdb('0x50')+this['channels'][_0x203b7c[_0xefdb('0x23')]][_0xefdb('0x4f')]:_0xefdb('0x51'));}}}};Fax[_0xefdb('0x1f')][_0xefdb('0x52')]=function(_0x6ad373){var _0x5f54cf=this;return new BPromise(function(_0x42aa2c,_0x4fad9d){_0x5f54cf[_0xefdb('0x53')](_0x6ad373,_0x5f54cf['faxAccounts'][_0x6ad373[_0xefdb('0x54')]])['then'](function(_0x16bd2d){ut[_0xefdb('0x45')](_0xefdb('0x55'),_0x16bd2d);_0x42aa2c(ut[_0xefdb('0x37')](_0xefdb('0x56')));})[_0xefdb('0x3c')](function(_0x4a5ec7){ut[_0xefdb('0x45')](_0xefdb('0x57'),_0x4a5ec7);updateStatus(_0x6ad373);_0x4fad9d(ut[_0xefdb('0x37')](_0xefdb('0x58')));});});};Fax['prototype']['checkAfterSend']=function(_0x2191ca){var _0x1fd043=this;return new BPromise(function(_0x43a726,_0x67b82f){var _0x28b231=_0x1fd043['checkTrunk'](_0x1fd043[_0xefdb('0xd')][_0x2191ca[_0xefdb('0x54')]]['Trunk'],_0x2191ca);if(_0x28b231[_0xefdb('0x59')]){_0x43a726(ut[_0xefdb('0x37')](_0xefdb('0x5a')));}else{_0x67b82f(ut[_0xefdb('0x37')](_0x28b231['message']));}});};function originate(_0x17e9e7,_0x2f922f,_0x173018){return new BPromise(function(_0x41dd5d,_0x37f432){if(_0x173018){var _0x5320a2=util[_0xefdb('0x5b')](_0xefdb('0x5c'),path[_0xefdb('0x39')](_0x17e9e7[_0xefdb('0x3')])[_0xefdb('0x25')],_0x17e9e7[_0xefdb('0x3')]);gs[_0xefdb('0x5d')](_0x5320a2)[_0xefdb('0x3b')](function(){_0x17e9e7['path']=util[_0xefdb('0x5b')](_0xefdb('0x5e'),path[_0xefdb('0x39')](_0x17e9e7['path'])[_0xefdb('0x5f')],path[_0xefdb('0x39')](_0x17e9e7[_0xefdb('0x3')])['name']);_0x2f922f[_0xefdb('0x60')]=_0x17e9e7['path'];ut[_0xefdb('0x45')]('Convert\x20pdf\x20to\x20tif','');ami[_0xefdb('0x61')](ut['variablesAction'](_0x17e9e7,_0x2f922f))[_0xefdb('0x3b')](function(_0x3b2649){_0x41dd5d(_0x3b2649);})[_0xefdb('0x3c')](function(_0x91afc8){_0x37f432(_0x91afc8);});})[_0xefdb('0x3c')](function(_0x42a52d){_0x37f432(_0x42a52d);});}else{ami[_0xefdb('0x61')](ut[_0xefdb('0x62')](_0x17e9e7,_0x2f922f))['then'](function(_0x41dbaa){_0x41dd5d(_0x41dbaa);})[_0xefdb('0x3c')](function(_0xb12753){_0x37f432(_0xb12753);});}});}Fax[_0xefdb('0x1f')][_0xefdb('0x53')]=function(_0x2bb7ce,_0x3d6f84){var _0x1b6c59=this;return new BPromise(function(_0x48365e,_0x1662b7){var _0x48effc=uuid['v4']();var _0x5085cb=ut[_0xefdb('0x63')](_0x2bb7ce,_0x3d6f84);_0x1b6c59[_0xefdb('0xf')][_0x48effc]=new Action(_0x48effc,_0x3d6f84,_0x2bb7ce);var _0x2b59ea=_0x1b6c59[_0xefdb('0xf')][_0x48effc];if(path[_0xefdb('0x39')](_0x2bb7ce[_0xefdb('0x3')])[_0xefdb('0x64')]==='.pdf'){originate(_0x2b59ea,_0x5085cb,!![])['then'](function(_0x462ccf){_0x48365e(_0x462ccf);})[_0xefdb('0x3c')](function(_0x402bbd){_0x1662b7(_0x402bbd);});}else{originate(_0x2b59ea,_0x5085cb,![])[_0xefdb('0x3b')](function(_0x197b33){_0x48365e(_0x197b33);})[_0xefdb('0x3c')](function(_0x5dc13a){_0x1662b7(_0x5dc13a);});}});};Fax[_0xefdb('0x1f')][_0xefdb('0x65')]=function(_0x391009){return!_[_0xefdb('0x66')](_0x391009)&&!_[_0xefdb('0x66')](_0x391009[_0xefdb('0x25')])&&!_[_0xefdb('0x66')](_0x391009[_0xefdb('0x67')])&&_0x391009['active']&&!_[_0xefdb('0x66')](this['trunks'][util['format'](_0xefdb('0x68'),_0x391009[_0xefdb('0x25')])])&&!_[_0xefdb('0x66')](this[_0xefdb('0xe')][util[_0xefdb('0x5b')](_0xefdb('0x68'),_0x391009['name'])]['status'])&&(this[_0xefdb('0xe')][util['format'](_0xefdb('0x68'),_0x391009['name'])][_0xefdb('0x2e')]===_0xefdb('0x69')||this[_0xefdb('0xe')][util['format'](_0xefdb('0x68'),_0x391009[_0xefdb('0x25')])][_0xefdb('0x2e')]==='unmonitored');};Fax[_0xefdb('0x1f')][_0xefdb('0x6a')]=function(_0xb36dd2,_0x4a8f81){if(!this[_0xefdb('0x65')](_0xb36dd2)){ut[_0xefdb('0x45')](_0xefdb('0x6b'),_[_0xefdb('0x66')](_0xb36dd2)?'':_0xb36dd2['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xefdb('0x6c')};}if(_[_0xefdb('0x66')](_0x4a8f81[_0xefdb('0x6')])){ut[_0xefdb('0x45')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xefdb('0x3f')](_0x4a8f81));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xefdb('0x66')](_0x4a8f81[_0xefdb('0x3')])){ut[_0xefdb('0x45')](_0xefdb('0x6d'),JSON[_0xefdb('0x3f')](_0x4a8f81));return{'isValid':![],'message':_0xefdb('0x6e')};}return{'isValid':!![],'message':_0xefdb('0x6f')};};module['exports']=Fax; \ No newline at end of file +var _0xbb48=['pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','syncHangup','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','format','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','syncNewState','faxstatus','syncReceiveFax','hangup','originateresponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','channelstate','channelstatedesc','syncNewExten','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse'];(function(_0x2f981b,_0x3283b8){var _0x61f72e=function(_0x18249d){while(--_0x18249d){_0x2f981b['push'](_0x2f981b['shift']());}};_0x61f72e(++_0x3283b8);}(_0xbb48,0x1ee));var _0x8bb4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbb48[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0x8bb4('0x0'));var _=require(_0x8bb4('0x1'));var BPromise=require(_0x8bb4('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x8bb4('0x3'));var tiff2pdf=require(_0x8bb4('0x4'));var gs=require('./util/gs');var logger=require(_0x8bb4('0x5'))(_0x8bb4('0x6'));var ami=require(_0x8bb4('0x7'));var rpcDb=require(_0x8bb4('0x8'));var Channel=require(_0x8bb4('0x9'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x8bb4('0xa'));var attachment=require(_0x8bb4('0xb'));var faxMessage=require(_0x8bb4('0xc'));function Fax(_0x481f2e){this[_0x8bb4('0xd')]={};this['faxAccounts']=_0x481f2e[_0x8bb4('0xe')];this[_0x8bb4('0xf')]=_0x481f2e[_0x8bb4('0xf')];this[_0x8bb4('0x10')]={};ami['on']('newchannel',this[_0x8bb4('0x11')][_0x8bb4('0x12')](this));ami['on'](_0x8bb4('0x13'),this[_0x8bb4('0x14')][_0x8bb4('0x12')](this));ami['on']('newstate',this[_0x8bb4('0x15')][_0x8bb4('0x12')](this));ami['on']('newexten',this['syncNewExten'][_0x8bb4('0x12')](this));ami['on'](_0x8bb4('0x16'),this['syncFaxStatus']['bind'](this));ami['on']('receivefax',this[_0x8bb4('0x17')]['bind'](this));ami['on'](_0x8bb4('0x18'),this['syncHangup'][_0x8bb4('0x12')](this));ami['on'](_0x8bb4('0x19'),this['syncOriginateResponse'][_0x8bb4('0x12')](this));}Fax['prototype'][_0x8bb4('0x11')]=function(_0x136b35){if(_0x136b35[_0x8bb4('0x1a')]===_0x8bb4('0x1b')){for(var _0x16b5db in this[_0x8bb4('0xe')]){if(this['faxAccounts'][_0x8bb4('0x1c')](_0x16b5db)){if(_0x136b35[_0x8bb4('0x1d')]===this[_0x8bb4('0xe')][_0x16b5db][_0x8bb4('0x1e')]){this['channels'][_0x136b35[_0x8bb4('0x1f')]]={};this[_0x8bb4('0xd')][_0x136b35[_0x8bb4('0x1f')]][_0x8bb4('0x20')]=_0x136b35[_0x8bb4('0x20')];this['channels'][_0x136b35[_0x8bb4('0x1f')]]['id']=this[_0x8bb4('0xe')][_0x16b5db]['id'];this[_0x8bb4('0xd')][_0x136b35[_0x8bb4('0x1f')]][_0x8bb4('0x21')]=this[_0x8bb4('0xe')][_0x16b5db][_0x8bb4('0x21')];logger[_0x8bb4('0x22')](_0x136b35['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x136b35['uniqueid']]){this[_0x8bb4('0xd')][_0x136b35[_0x8bb4('0x1f')]]={};this[_0x8bb4('0xd')][_0x136b35['uniqueid']]['channel']=_0x136b35[_0x8bb4('0x20')];logger[_0x8bb4('0x22')](_0x136b35[_0x8bb4('0x1f')],_0x8bb4('0x23'));}};Fax[_0x8bb4('0x24')][_0x8bb4('0x14')]=function(_0x19167f){if(this[_0x8bb4('0xd')][_0x19167f[_0x8bb4('0x1f')]]){for(var _0x79064b in _0x19167f[_0x8bb4('0x25')]){if(_0x19167f[_0x8bb4('0x25')][_0x8bb4('0x1c')](_0x79064b)){this[_0x8bb4('0xd')][_0x19167f[_0x8bb4('0x1f')]][_0x79064b]=_0x19167f['value'];}}}};Fax[_0x8bb4('0x24')]['syncNewState']=function(_0x44e601){if(this[_0x8bb4('0xd')][_0x44e601[_0x8bb4('0x1f')]]){this[_0x8bb4('0xd')][_0x44e601[_0x8bb4('0x1f')]]['channelstate']=_0x44e601[_0x8bb4('0x26')];this[_0x8bb4('0xd')][_0x44e601[_0x8bb4('0x1f')]][_0x8bb4('0x27')]=_0x44e601[_0x8bb4('0x27')];}};Fax[_0x8bb4('0x24')][_0x8bb4('0x28')]=function(_0x3cc63b){if(this[_0x8bb4('0xd')][_0x3cc63b[_0x8bb4('0x1f')]]){for(var _0x10cb8b in _0x3cc63b[_0x8bb4('0x25')]){if(_0x3cc63b[_0x8bb4('0x25')][_0x8bb4('0x1c')](_0x10cb8b)){this[_0x8bb4('0xd')][_0x3cc63b[_0x8bb4('0x1f')]][_0x10cb8b]=_0x3cc63b[_0x8bb4('0x29')];}}}};Fax['prototype'][_0x8bb4('0x2a')]=function(_0xfdefb2){if(this[_0x8bb4('0xd')][_0xfdefb2['uniqueid']]){this[_0x8bb4('0xd')][_0xfdefb2['uniqueid']][_0x8bb4('0x2b')]=_0xfdefb2[_0x8bb4('0x2b')];this['channels'][_0xfdefb2[_0x8bb4('0x1f')]][_0x8bb4('0x2c')]=_0xfdefb2[_0x8bb4('0x2c')];this['channels'][_0xfdefb2[_0x8bb4('0x1f')]][_0x8bb4('0x1e')]=_0xfdefb2['localstationid'];this[_0x8bb4('0xd')][_0xfdefb2[_0x8bb4('0x1f')]][_0x8bb4('0x2d')]=_0xfdefb2[_0x8bb4('0x2d')];logger[_0x8bb4('0x22')](_0xfdefb2[_0x8bb4('0x1f')],_0x8bb4('0x2e'));}};Fax[_0x8bb4('0x24')][_0x8bb4('0x17')]=function(_0x1b9abb){var _0x4d1906=this;if(this[_0x8bb4('0xd')][_0x1b9abb[_0x8bb4('0x1f')]]){var _0x63ff7a=this[_0x8bb4('0xd')][_0x1b9abb[_0x8bb4('0x1f')]]['id'];this[_0x8bb4('0xd')][_0x1b9abb[_0x8bb4('0x1f')]]['remotestationid']=_0x1b9abb['remotestationid'];this[_0x8bb4('0xd')][_0x1b9abb[_0x8bb4('0x1f')]][_0x8bb4('0x2f')]=_0x1b9abb[_0x8bb4('0x2f')];this[_0x8bb4('0xd')][_0x1b9abb[_0x8bb4('0x1f')]][_0x8bb4('0x1e')]=_0x1b9abb[_0x8bb4('0x1e')];this['channels'][_0x1b9abb[_0x8bb4('0x1f')]][_0x8bb4('0x30')]=_0x1b9abb['resolution'];this[_0x8bb4('0xd')][_0x1b9abb[_0x8bb4('0x1f')]][_0x8bb4('0x31')]=_0x1b9abb[_0x8bb4('0x31')];this[_0x8bb4('0xd')][_0x1b9abb['uniqueid']][_0x8bb4('0x2d')]=_0x1b9abb[_0x8bb4('0x2d')];this['channels'][_0x1b9abb[_0x8bb4('0x1f')]][_0x8bb4('0x32')]=_0x1b9abb['calleridnum'];if(this['channels'][_0x1b9abb[_0x8bb4('0x1f')]][_0x8bb4('0x2f')]>0x0){tiff2pdf(_0x1b9abb[_0x8bb4('0x2d')],_0x8bb4('0x33'),function(_0x3d8d1e){logger[_0x8bb4('0x22')](_0x1b9abb[_0x8bb4('0x1f')],_0x8bb4('0x34'),_0x3d8d1e[_0x8bb4('0x35')]);attachment[_0x8bb4('0x36')]({'name':path[_0x8bb4('0x37')](_0x1b9abb[_0x8bb4('0x2d')])[_0x8bb4('0x21')],'basename':path[_0x8bb4('0x37')](_0x1b9abb['filename'])['name']+_0x8bb4('0x38'),'type':_0x8bb4('0x39')})[_0x8bb4('0x3a')](function(_0xc4db04){faxAccount[_0x8bb4('0x3b')](_0x63ff7a,{'from':_0x1b9abb[_0x8bb4('0x32')],'mapKey':_0x8bb4('0x6'),'body':path[_0x8bb4('0x37')](_0x1b9abb[_0x8bb4('0x2d')])[_0x8bb4('0x21')]+_0x8bb4('0x38'),'AttachmentId':_0xc4db04['id']})[_0x8bb4('0x3c')](function(_0xa67980){logger[_0x8bb4('0x3d')](_0x1b9abb[_0x8bb4('0x1f')],_0x8bb4('0x3e'),JSON[_0x8bb4('0x3f')](_0xa67980));});})[_0x8bb4('0x3c')](function(_0x5acaa4){logger[_0x8bb4('0x3d')](_0x1b9abb['uniqueid'],_0x8bb4('0x40'),JSON['stringify'](_0x5acaa4));});});}logger[_0x8bb4('0x22')](_0x1b9abb[_0x8bb4('0x1f')],_0x8bb4('0x40'));}};Fax['prototype'][_0x8bb4('0x41')]=function(_0x46f96c){if(this['actions'][_0x46f96c[_0x8bb4('0x1f')]]){_['merge'](this['channels'][_0x46f96c['uniqueid']],_[_0x8bb4('0x42')](_0x46f96c,['response',_0x8bb4('0x43')]));}};function updateStatus(_0xed2af0){if(_0xed2af0['AttachmentId']){faxMessage[_0x8bb4('0x44')](_0xed2af0[_0x8bb4('0x45')],{'failMessage':_0x8bb4('0x46')})['then'](function(_0x181a5a){ut['logger'](_0x8bb4('0x47'),_0x181a5a);})[_0x8bb4('0x3c')](function(_0x314ae6){ut[_0x8bb4('0x48')](_0x8bb4('0x49'),_0x314ae6);});}else{ut[_0x8bb4('0x48')](_0x8bb4('0x4a'));}}Fax[_0x8bb4('0x24')][_0x8bb4('0x4b')]=function(_0x4cfa41,_0x45d5de,_0x18c48d){var _0x34a05c=this;var _0x4e88fd={};if(_0x45d5de){_0x4e88fd={'read':_0x45d5de};}else{_0x4e88fd={'failMessage':_0x18c48d};}if(this['actions'][_0x4cfa41][_0x8bb4('0x45')]){faxMessage[_0x8bb4('0x44')](this['actions'][_0x4cfa41][_0x8bb4('0x45')],_0x4e88fd)[_0x8bb4('0x3a')](function(_0x393501){ut['logger'](_0x8bb4('0x4c'),_0x393501);})['catch'](function(_0x279aeb){ut[_0x8bb4('0x48')](_0x8bb4('0x4d'),_0x279aeb);})['finally'](function(){delete _0x34a05c[_0x8bb4('0xd')][_0x4cfa41];delete _0x34a05c[_0x8bb4('0x10')][_0x4cfa41];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x8bb4('0xd')][_0x4cfa41];delete this[_0x8bb4('0x10')][_0x4cfa41];}};Fax[_0x8bb4('0x24')][_0x8bb4('0x4e')]=function(_0x439b41){var _0x1d8c63=this;if(this[_0x8bb4('0xd')][_0x439b41[_0x8bb4('0x1f')]]){if(this[_0x8bb4('0x10')][_0x439b41[_0x8bb4('0x1f')]]){this['channels'][_0x439b41[_0x8bb4('0x1f')]]['id']=this[_0x8bb4('0x10')][_0x439b41[_0x8bb4('0x1f')]]['id'];this['channels'][_0x439b41[_0x8bb4('0x1f')]]['name']=this[_0x8bb4('0x10')][_0x439b41[_0x8bb4('0x1f')]][_0x8bb4('0x21')];}logger[_0x8bb4('0x22')](_0x439b41[_0x8bb4('0x1f')],this[_0x8bb4('0x10')][_0x439b41['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x8bb4('0x4f'),JSON[_0x8bb4('0x3f')](this[_0x8bb4('0xd')][_0x439b41[_0x8bb4('0x1f')]]));if(this['actions'][_0x439b41[_0x8bb4('0x1f')]]){if(this[_0x8bb4('0xd')][_0x439b41['uniqueid']]['faxpages']>0x0&&this[_0x8bb4('0xd')][_0x439b41['uniqueid']][_0x8bb4('0x16')]===_0x8bb4('0x50')){this[_0x8bb4('0x4b')](_0x439b41['uniqueid'],!![]);}else{this['updateStatus'](_0x439b41[_0x8bb4('0x1f')],![],this[_0x8bb4('0xd')][_0x439b41[_0x8bb4('0x1f')]][_0x8bb4('0x51')]?_0x8bb4('0x52')+this[_0x8bb4('0xd')][_0x439b41[_0x8bb4('0x1f')]]['faxstatusstring']:_0x8bb4('0x53'));}}}};Fax[_0x8bb4('0x24')][_0x8bb4('0x54')]=function(_0x4942b9){var _0x227047=this;return new BPromise(function(_0x265ee0,_0xceaffc){_0x227047[_0x8bb4('0x55')](_0x4942b9,_0x227047[_0x8bb4('0xe')][_0x4942b9[_0x8bb4('0x56')]])[_0x8bb4('0x3a')](function(_0x2a5164){ut[_0x8bb4('0x48')]('[Fax][execOriginate][success]',_0x2a5164);_0x265ee0(ut['message'](_0x8bb4('0x57')));})[_0x8bb4('0x3c')](function(_0x256978){ut['logger'](_0x8bb4('0x58'),_0x256978);updateStatus(_0x4942b9);_0xceaffc(ut[_0x8bb4('0x35')](_0x8bb4('0x59')));});});};Fax[_0x8bb4('0x24')]['checkAfterSend']=function(_0x134222){var _0x1a8ef3=this;return new BPromise(function(_0xafd00d,_0x1c366f){var _0x249571=_0x1a8ef3[_0x8bb4('0x5a')](_0x1a8ef3[_0x8bb4('0xe')][_0x134222[_0x8bb4('0x56')]][_0x8bb4('0x5b')],_0x134222);if(_0x249571[_0x8bb4('0x5c')]){_0xafd00d(ut[_0x8bb4('0x35')]('Trunk\x20Reachable'));}else{_0x1c366f(ut[_0x8bb4('0x35')](_0x249571[_0x8bb4('0x35')]));}});};function originate(_0x404670,_0x5161ec,_0x497630){return new BPromise(function(_0x40c88e,_0x3e6303){if(_0x497630){var _0x563d7b=util['format'](_0x8bb4('0x5d'),path[_0x8bb4('0x37')](_0x404670[_0x8bb4('0x3')])[_0x8bb4('0x21')],_0x404670[_0x8bb4('0x3')]);gs[_0x8bb4('0x5e')](_0x563d7b)[_0x8bb4('0x3a')](function(){_0x404670['path']=util['format'](_0x8bb4('0x5f'),path[_0x8bb4('0x37')](_0x404670[_0x8bb4('0x3')])['dir'],path[_0x8bb4('0x37')](_0x404670[_0x8bb4('0x3')])['name']);_0x5161ec['XMF-PATH']=_0x404670[_0x8bb4('0x3')];ut[_0x8bb4('0x48')](_0x8bb4('0x60'),'');ami[_0x8bb4('0x61')](ut[_0x8bb4('0x62')](_0x404670,_0x5161ec))[_0x8bb4('0x3a')](function(_0x151ddd){_0x40c88e(_0x151ddd);})[_0x8bb4('0x3c')](function(_0x11cdfd){_0x3e6303(_0x11cdfd);});})['catch'](function(_0x2e886f){_0x3e6303(_0x2e886f);});}else{ami[_0x8bb4('0x61')](ut[_0x8bb4('0x62')](_0x404670,_0x5161ec))[_0x8bb4('0x3a')](function(_0x5189a9){_0x40c88e(_0x5189a9);})[_0x8bb4('0x3c')](function(_0x3d4d5e){_0x3e6303(_0x3d4d5e);});}});}Fax[_0x8bb4('0x24')][_0x8bb4('0x55')]=function(_0x25878d,_0x4833ff){var _0x3bf833=this;return new BPromise(function(_0x57f3f6,_0x11b510){var _0x374de5=uuid['v4']();var _0x42353c=ut[_0x8bb4('0x63')](_0x25878d,_0x4833ff);_0x3bf833['actions'][_0x374de5]=new Action(_0x374de5,_0x4833ff,_0x25878d);var _0xfed03=_0x3bf833['actions'][_0x374de5];if(path[_0x8bb4('0x37')](_0x25878d['path'])['ext']===_0x8bb4('0x38')){originate(_0xfed03,_0x42353c,!![])[_0x8bb4('0x3a')](function(_0x3bc257){_0x57f3f6(_0x3bc257);})[_0x8bb4('0x3c')](function(_0x5024b6){_0x11b510(_0x5024b6);});}else{originate(_0xfed03,_0x42353c,![])[_0x8bb4('0x3a')](function(_0x131db8){_0x57f3f6(_0x131db8);})['catch'](function(_0x3f49c8){_0x11b510(_0x3f49c8);});}});};Fax[_0x8bb4('0x24')][_0x8bb4('0x64')]=function(_0x1c0131){return!_['isNil'](_0x1c0131)&&!_[_0x8bb4('0x65')](_0x1c0131[_0x8bb4('0x21')])&&!_['isNil'](_0x1c0131[_0x8bb4('0x66')])&&_0x1c0131['active']&&!_[_0x8bb4('0x65')](this[_0x8bb4('0xf')][util['format']('SIP/%s',_0x1c0131[_0x8bb4('0x21')])])&&!_[_0x8bb4('0x65')](this[_0x8bb4('0xf')][util[_0x8bb4('0x67')]('SIP/%s',_0x1c0131[_0x8bb4('0x21')])]['status'])&&(this[_0x8bb4('0xf')][util[_0x8bb4('0x67')](_0x8bb4('0x68'),_0x1c0131['name'])][_0x8bb4('0x2c')]==='reachable'||this[_0x8bb4('0xf')][util['format'](_0x8bb4('0x68'),_0x1c0131[_0x8bb4('0x21')])][_0x8bb4('0x2c')]===_0x8bb4('0x69'));};Fax[_0x8bb4('0x24')][_0x8bb4('0x5a')]=function(_0x187cff,_0x1356cb){if(!this[_0x8bb4('0x64')](_0x187cff)){ut['logger'](_0x8bb4('0x6a'),_[_0x8bb4('0x65')](_0x187cff)?'':_0x187cff[_0x8bb4('0x21')]+_0x8bb4('0x6b'));return{'isValid':![],'message':_0x8bb4('0x6c')};}if(_['isNil'](_0x1356cb[_0x8bb4('0x6')])){ut[_0x8bb4('0x48')](_0x8bb4('0x6d'),JSON[_0x8bb4('0x3f')](_0x1356cb));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x8bb4('0x65')](_0x1356cb['path'])){ut[_0x8bb4('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x8bb4('0x3f')](_0x1356cb));return{'isValid':![],'message':_0x8bb4('0x6e')};}return{'isValid':!![],'message':_0x8bb4('0x6f')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 24b6f54..0a962ec 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 _0x284c=['resolve','then','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x284c,0x12b));var _0xc284=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x284c[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0xc284('0x0'));var BPromise=require('bluebird');var logger=require(_0xc284('0x1'))(_0xc284('0x2'));var _=require(_0xc284('0x3'));var faxAccount=require(_0xc284('0x4'));function loggerCatch(_0x5c7793){return function(_0x2de497){logger[_0xc284('0x5')](_0x5c7793,util[_0xc284('0x6')](_0x2de497,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2df6c7,_0x5574cd){return BPromise[_0xc284('0x7')]()[_0xc284('0x8')](faxAccount['notify'](_0x2df6c7,_0x5574cd))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x25ff=['[Notify]\x20','util','bluebird','../../../config/logger','preview','error','inspect','notify','then','catch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x25ff,0x19b));var _0xf25f=function(_0x4ec96f,_0x56b6c1){_0x4ec96f=_0x4ec96f-0x0;var _0x1790ab=_0x25ff[_0x4ec96f];return _0x1790ab;};'use strict';var util=require(_0xf25f('0x0'));var BPromise=require(_0xf25f('0x1'));var logger=require(_0xf25f('0x2'))(_0xf25f('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x477a57){return function(_0x1d7422){logger[_0xf25f('0x4')](_0x477a57,util[_0xf25f('0x5')](_0x1d7422,{'showHidden':![],'depth':null}));};}exports[_0xf25f('0x6')]=function(_0x288778,_0x4a58ff){return BPromise['resolve']()[_0xf25f('0x7')](faxAccount[_0xf25f('0x6')](_0x288778,_0x4a58ff))[_0xf25f('0x8')](loggerCatch(_0xf25f('0x9')));}; \ 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 362797c..9e52248 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 _0xf39a=['../../../../config/logger','fax','child_process','exec','execute','info','Exec\x20gs','util'];(function(_0xa6b91b,_0x2139b4){var _0x2987d7=function(_0x188983){while(--_0x188983){_0xa6b91b['push'](_0xa6b91b['shift']());}};_0x2987d7(++_0x2139b4);}(_0xf39a,0x1c7));var _0xaf39=function(_0x1cd4a5,_0x4fee1c){_0x1cd4a5=_0x1cd4a5-0x0;var _0x32a9a0=_0xf39a[_0x1cd4a5];return _0x32a9a0;};'use strict';var util=require(_0xaf39('0x0'));var logger=require(_0xaf39('0x1'))(_0xaf39('0x2'));var BPromise=require('bluebird');var exec=require(_0xaf39('0x3'))[_0xaf39('0x4')];exports[_0xaf39('0x5')]=function(_0x5b34b8){return new BPromise(function(_0x5a28ba,_0x501e18){exec(_0x5b34b8,function(_0x3a1e6b,_0x362553,_0x3c3a32){logger[_0xaf39('0x6')](_0xaf39('0x7'),_0x362553);if(_0x3a1e6b){logger[_0xaf39('0x6')](_0xaf39('0x7'),'\x20Error\x20:',util['inspect'](_0x3a1e6b,{'showHidden':![],'depth':null}),_0x362553,_0x3c3a32);_0x501e18(_0x3a1e6b);}_0x5a28ba(_0x362553);});});}; \ No newline at end of file +var _0xf015=['child_process','exec','Exec\x20gs','info','\x20Error\x20:','inspect','util','fax'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xf015,0xde));var _0x5f01=function(_0x2178ce,_0x1432f4){_0x2178ce=_0x2178ce-0x0;var _0x21b3f4=_0xf015[_0x2178ce];return _0x21b3f4;};'use strict';var util=require(_0x5f01('0x0'));var logger=require('../../../../config/logger')(_0x5f01('0x1'));var BPromise=require('bluebird');var exec=require(_0x5f01('0x2'))[_0x5f01('0x3')];exports['execute']=function(_0x4c2556){return new BPromise(function(_0x3c1fa6,_0x4fb9e0){exec(_0x4c2556,function(_0x2176c9,_0x460efc,_0xb0ecd6){logger['info'](_0x5f01('0x4'),_0x460efc);if(_0x2176c9){logger[_0x5f01('0x5')]('Exec\x20gs',_0x5f01('0x6'),util[_0x5f01('0x7')](_0x2176c9,{'showHidden':![],'depth':null}),_0x460efc,_0xb0ecd6);_0x4fb9e0(_0x2176c9);}_0x3c1fa6(_0x460efc);});});}; \ 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 fd16f6e..4cf3c58 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 _0xa9e0=['message','logger','info','inspect','minrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','headerinfo','util','lodash','moment'];(function(_0x48046,_0x1fe4a2){var _0x51cceb=function(_0x2d155f){while(--_0x2d155f){_0x48046['push'](_0x48046['shift']());}};_0x51cceb(++_0x1fe4a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var logger=require('../../../../config/logger')('fax');exports[_0x0a9e('0x3')]=function(_0x4ce2f1){return{'message':_0x4ce2f1};};exports[_0x0a9e('0x4')]=function(_0x432180,_0x2ab90b){logger[_0x0a9e('0x5')](_0x432180,util[_0x0a9e('0x6')](_0x2ab90b,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x219af0,_0x441e3a){var _0x2cc193={'XMF-ECM':_0x441e3a['ecm'],'XMF-HEADERINFO':_0x441e3a['headerinfo'],'XMF-MINRATE':_0x441e3a[_0x0a9e('0x7')],'XMF-MAXRATE':_0x441e3a['maxrate'],'XMF-MODEM':util['format'](_0x0a9e('0x8'),_0x441e3a[_0x0a9e('0x9')]),'XMF-GATEWAY':_0x441e3a[_0x0a9e('0xa')],'XMF-FAXDETECT':_0x441e3a[_0x0a9e('0xb')],'XMF-T38TIMEOUT':_0x441e3a[_0x0a9e('0xc')],'XMF-LOCALSTATIONID':_0x441e3a[_0x0a9e('0xd')],'XMF-PATH':_0x219af0['path']};return _0x2cc193;};exports['variablesAction']=function(_0x527cdd,_0x4cfe67){return{'actionid':_0x527cdd[_0x0a9e('0xe')],'action':_0x0a9e('0xf'),'channel':_0x527cdd[_0x0a9e('0x10')],'Exten':_0x0a9e('0x11'),'Context':_0x0a9e('0x12'),'Priority':'1','callerid':util[_0x0a9e('0x13')]('\x22%s\x22\x20<%s>',_0x527cdd[_0x0a9e('0x14')]?_0x527cdd[_0x0a9e('0x14')]:'',_0x527cdd[_0x0a9e('0xd')]),'variable':_0x4cfe67,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x527cdd[_0x0a9e('0xe')]};}; \ No newline at end of file +var _0xbb53=['modem','faxdetect','path','variablesAction','originate','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','moment','../../../../config/logger','fax','message','logger','addVariables','ecm','format','\x22%s\x22'];(function(_0x10f85c,_0x380466){var _0x5c7bf9=function(_0x4ee701){while(--_0x4ee701){_0x10f85c['push'](_0x10f85c['shift']());}};_0x5c7bf9(++_0x380466);}(_0xbb53,0x121));var _0x3bb5=function(_0x298a45,_0xcd5946){_0x298a45=_0x298a45-0x0;var _0x3182f0=_0xbb53[_0x298a45];return _0x3182f0;};'use strict';var util=require(_0x3bb5('0x0'));var _=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var logger=require(_0x3bb5('0x3'))(_0x3bb5('0x4'));exports[_0x3bb5('0x5')]=function(_0x414da7){return{'message':_0x414da7};};exports[_0x3bb5('0x6')]=function(_0x83e44b,_0x450d9e){logger['info'](_0x83e44b,util['inspect'](_0x450d9e,{'showHidden':![],'depth':null}));};exports[_0x3bb5('0x7')]=function(_0x2460b0,_0x28aa7d){var _0x157e04={'XMF-ECM':_0x28aa7d[_0x3bb5('0x8')],'XMF-HEADERINFO':_0x28aa7d['headerinfo'],'XMF-MINRATE':_0x28aa7d['minrate'],'XMF-MAXRATE':_0x28aa7d['maxrate'],'XMF-MODEM':util[_0x3bb5('0x9')](_0x3bb5('0xa'),_0x28aa7d[_0x3bb5('0xb')]),'XMF-GATEWAY':_0x28aa7d['gateway'],'XMF-FAXDETECT':_0x28aa7d[_0x3bb5('0xc')],'XMF-T38TIMEOUT':_0x28aa7d['t38timeout'],'XMF-LOCALSTATIONID':_0x28aa7d['localstationid'],'XMF-PATH':_0x2460b0[_0x3bb5('0xd')]};return _0x157e04;};exports[_0x3bb5('0xe')]=function(_0x5cfc6b,_0xe00ace){return{'actionid':_0x5cfc6b['uniqueid'],'action':_0x3bb5('0xf'),'channel':_0x5cfc6b['channel'],'Exten':'xcally-motion-fax','Context':_0x3bb5('0x10'),'Priority':'1','callerid':util[_0x3bb5('0x9')](_0x3bb5('0x11'),_0x5cfc6b['headerinfo']?_0x5cfc6b[_0x3bb5('0x12')]:'',_0x5cfc6b[_0x3bb5('0x13')]),'variable':_0xe00ace,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5cfc6b['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 587e338..8c9eb5d 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 _0x6878=['hour','get','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','getSettings','catch','log','listen','sync','bluebird','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/setting','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365'];(function(_0x1f8652,_0x2e8015){var _0x2b7ebd=function(_0x399b08){while(--_0x399b08){_0x1f8652['push'](_0x1f8652['shift']());}};_0x2b7ebd(++_0x2e8015);}(_0x6878,0x198));var _0x8687=function(_0x4147d4,_0x4f8274){_0x4147d4=_0x4147d4-0x0;var _0x32a9f4=_0x6878[_0x4147d4];return _0x32a9f4;};'use strict';var BPromise=require(_0x8687('0x0'));var util=require('util');var moment=require(_0x8687('0x1'));var server=require(_0x8687('0x2'));var Realtime=require(_0x8687('0x3'));var Report=require(_0x8687('0x4'));var Acw=require('./acw');var Trigger=require(_0x8687('0x5'));var Dialer=require(_0x8687('0x6'));var Preview=require(_0x8687('0x7'));var Fax=require(_0x8687('0x8'));var user=require(_0x8687('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x8687('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x8687('0xb'));var trigger=require(_0x8687('0xc'));var template=require(_0x8687('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x8687('0xe'));var faxAccount=require(_0x8687('0xf'));var setting=require(_0x8687('0x10'));var zendesk=require(_0x8687('0x11'));var salesforce=require(_0x8687('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x8687('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x8687('0x14'));var vtiger=require(_0x8687('0x15'));var freshsales=require(_0x8687('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x8687('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x8687('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x8687('0x19')](_0x8687('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x8687('0x1a')]()[_0x8687('0x1b')](user[_0x8687('0x1c')]())[_0x8687('0x1b')](realtime[_0x8687('0x1d')]())[_0x8687('0x1b')](user['getTelephones']())['then'](realtime[_0x8687('0x1e')]())[_0x8687('0x1b')](trunk[_0x8687('0x1f')]())[_0x8687('0x1b')](realtime[_0x8687('0x20')]())[_0x8687('0x1b')](voiceQueue[_0x8687('0x21')]())[_0x8687('0x1b')](realtime['initVoiceQueues']())[_0x8687('0x1b')](trigger[_0x8687('0x22')]())[_0x8687('0x1b')](realtime[_0x8687('0x23')]())['then'](template['getTemplates']())[_0x8687('0x1b')](realtime[_0x8687('0x24')]())[_0x8687('0x1b')](zendesk[_0x8687('0x25')]())[_0x8687('0x1b')](realtime[_0x8687('0x26')]())[_0x8687('0x1b')](salesforce[_0x8687('0x27')]())[_0x8687('0x1b')](realtime['initSalesforceAccounts']())[_0x8687('0x1b')](sugarcrm[_0x8687('0x28')]())[_0x8687('0x1b')](realtime[_0x8687('0x29')]())[_0x8687('0x1b')](freshdesk[_0x8687('0x2a')]())['then'](realtime[_0x8687('0x2b')]())[_0x8687('0x1b')](desk[_0x8687('0x2c')]())[_0x8687('0x1b')](realtime[_0x8687('0x2d')]())[_0x8687('0x1b')](zoho[_0x8687('0x2e')]())[_0x8687('0x1b')](realtime[_0x8687('0x2f')]())[_0x8687('0x1b')](vtiger[_0x8687('0x30')]())[_0x8687('0x1b')](realtime[_0x8687('0x31')]())[_0x8687('0x1b')](freshsales[_0x8687('0x32')]())['then'](realtime[_0x8687('0x33')]())[_0x8687('0x1b')](servicenow[_0x8687('0x34')]())[_0x8687('0x1b')](realtime['initServicenowAccounts']())[_0x8687('0x1b')](dynamics365[_0x8687('0x35')]())['then'](realtime[_0x8687('0x36')]())[_0x8687('0x1b')](campaign[_0x8687('0x37')]())[_0x8687('0x1b')](realtime[_0x8687('0x38')]())['then'](voiceExtension[_0x8687('0x39')]())[_0x8687('0x1b')](realtime[_0x8687('0x3a')]())[_0x8687('0x1b')](faxAccount[_0x8687('0x3b')]())[_0x8687('0x1b')](realtime[_0x8687('0x3c')]())[_0x8687('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x8687('0x1a')]()[_0x8687('0x1b')](voiceQueueReport['getVoiceQueueReports']())[_0x8687('0x1b')](realtime[_0x8687('0x3d')]())[_0x8687('0x1b')](cmHopperHistory[_0x8687('0x3e')]())['then'](realtime[_0x8687('0x3f')]())[_0x8687('0x1b')](cmHopperHistory[_0x8687('0x40')]())[_0x8687('0x1b')](realtime[_0x8687('0x41')]())[_0x8687('0x1b')](voiceCallReport['getVoiceCallReports']())[_0x8687('0x1b')](realtime[_0x8687('0x42')]())['then'](setting[_0x8687('0x43')]())[_0x8687('0x1b')](realtime['initSettings']())[_0x8687('0x1b')](function(_0x2ea3cb){})[_0x8687('0x44')](function(_0x4e92e1){console[_0x8687('0x45')](_0x4e92e1);});}function main(){return server[_0x8687('0x46')](realtime,preview,fax)[_0x8687('0x1b')](function(_0x11cdc8){return initRealtime();})[_0x8687('0x1b')](function(){return initParams();})['then'](function(){report[_0x8687('0x47')]();setInterval(initRealtime,0x1388);})[_0x8687('0x44')](function(_0x3c7bea){console[_0x8687('0x45')](_0x3c7bea);});}main(); \ No newline at end of file +var _0xa362=['initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','initSettings','catch','log','sync','bluebird','util','moment','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./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/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates'];(function(_0xac7190,_0x3afa96){var _0x20e3b8=function(_0x2b5802){while(--_0x2b5802){_0xac7190['push'](_0xac7190['shift']());}};_0x20e3b8(++_0x3afa96);}(_0xa362,0x195));var _0x2a36=function(_0x19120a,_0x2495bf){_0x19120a=_0x19120a-0x0;var _0x18a3da=_0xa362[_0x19120a];return _0x18a3da;};'use strict';var BPromise=require(_0x2a36('0x0'));var util=require(_0x2a36('0x1'));var moment=require(_0x2a36('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x2a36('0x3'));var Acw=require(_0x2a36('0x4'));var Trigger=require(_0x2a36('0x5'));var Dialer=require(_0x2a36('0x6'));var Preview=require(_0x2a36('0x7'));var Fax=require('./fax');var user=require(_0x2a36('0x8'));var voiceQueue=require(_0x2a36('0x9'));var voiceQueueReport=require(_0x2a36('0xa'));var voiceCallReport=require(_0x2a36('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0x2a36('0xc'));var template=require(_0x2a36('0xd'));var cmHopperHistory=require(_0x2a36('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x2a36('0xf'));var setting=require('./rpc/setting');var zendesk=require(_0x2a36('0x10'));var salesforce=require(_0x2a36('0x11'));var sugarcrm=require(_0x2a36('0x12'));var freshdesk=require(_0x2a36('0x13'));var desk=require(_0x2a36('0x14'));var zoho=require(_0x2a36('0x15'));var vtiger=require(_0x2a36('0x16'));var freshsales=require(_0x2a36('0x17'));var servicenow=require(_0x2a36('0x18'));var dynamics365=require(_0x2a36('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()[_0x2a36('0x1a')](_0x2a36('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x2a36('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x2a36('0x1c')](user[_0x2a36('0x1d')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x1e')]())[_0x2a36('0x1c')](user[_0x2a36('0x1f')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x20')]())[_0x2a36('0x1c')](trunk['getTrunks']())[_0x2a36('0x1c')](realtime[_0x2a36('0x21')]())[_0x2a36('0x1c')](voiceQueue[_0x2a36('0x22')]())['then'](realtime[_0x2a36('0x23')]())[_0x2a36('0x1c')](trigger[_0x2a36('0x24')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x25')]())[_0x2a36('0x1c')](template[_0x2a36('0x26')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x27')]())['then'](zendesk[_0x2a36('0x28')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x29')]())['then'](salesforce[_0x2a36('0x2a')]())['then'](realtime[_0x2a36('0x2b')]())[_0x2a36('0x1c')](sugarcrm[_0x2a36('0x2c')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x2d')]())[_0x2a36('0x1c')](freshdesk['getFreshdeskAccounts']())[_0x2a36('0x1c')](realtime[_0x2a36('0x2e')]())[_0x2a36('0x1c')](desk[_0x2a36('0x2f')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x30')]())[_0x2a36('0x1c')](zoho[_0x2a36('0x31')]())['then'](realtime['initZohoAccounts']())[_0x2a36('0x1c')](vtiger[_0x2a36('0x32')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x33')]())[_0x2a36('0x1c')](freshsales[_0x2a36('0x34')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x35')]())[_0x2a36('0x1c')](servicenow[_0x2a36('0x36')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x37')]())[_0x2a36('0x1c')](dynamics365[_0x2a36('0x38')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x39')]())[_0x2a36('0x1c')](campaign[_0x2a36('0x3a')]())[_0x2a36('0x1c')](realtime['initCampaigns']())[_0x2a36('0x1c')](voiceExtension[_0x2a36('0x3b')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x3c')]())['then'](faxAccount[_0x2a36('0x3d')]())[_0x2a36('0x1c')](realtime['initFaxAccounts']())[_0x2a36('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0x2a36('0x3e')]()[_0x2a36('0x1c')](voiceQueueReport[_0x2a36('0x3f')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x40')]())['then'](cmHopperHistory[_0x2a36('0x41')]())['then'](realtime[_0x2a36('0x42')]())[_0x2a36('0x1c')](cmHopperHistory[_0x2a36('0x43')]())['then'](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x2a36('0x44')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x45')]())['then'](setting['getSettings']())[_0x2a36('0x1c')](realtime[_0x2a36('0x46')]())[_0x2a36('0x1c')](function(_0xc46fd1){})[_0x2a36('0x47')](function(_0xe9127b){console[_0x2a36('0x48')](_0xe9127b);});}function main(){return server['listen'](realtime,preview,fax)[_0x2a36('0x1c')](function(_0x2584bf){return initRealtime();})['then'](function(){return initParams();})[_0x2a36('0x1c')](function(){report[_0x2a36('0x49')]();setInterval(initRealtime,0x1388);})[_0x2a36('0x47')](function(_0x595c4b){console['log'](_0x595c4b);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 729c70b..1248675 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 _0x2371=['redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','interface','stringify','format','user:%s','emit','user:save','user:presence','util','moment','md5','ioredis','../../../config/environment'];(function(_0x4e988c,_0x23fb60){var _0x1305ce=function(_0x564e1b){while(--_0x564e1b){_0x4e988c['push'](_0x4e988c['shift']());}};_0x1305ce(++_0x23fb60);}(_0x2371,0x163));var _0x1237=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x2371[_0x429948];return _0x35d5d1;};'use strict';var _=require('lodash');var util=require(_0x1237('0x0'));var moment=require(_0x1237('0x1'));var md5=require(_0x1237('0x2'));var Redis=require(_0x1237('0x3'));var config=require(_0x1237('0x4'));config['redis']=_['defaults'](config[_0x1237('0x5')],{'host':_0x1237('0x6'),'port':0x18eb});var io=require(_0x1237('0x7'))(new Redis(config[_0x1237('0x5')]));function Agent(_0x30546e){this['id']=_0x30546e['id']||0x0;this[_0x1237('0x8')]=_0x30546e[_0x1237('0x8')]||'';this[_0x1237('0x9')]=_0x30546e[_0x1237('0x9')]||'';this[_0x1237('0xa')]=_0x30546e['accountcode']||'';this[_0x1237('0xb')]=_0x30546e[_0x1237('0xb')]||'';this[_0x1237('0xc')]=_0x1237('0xd');this[_0x1237('0xe')]=0x0;this[_0x1237('0xf')]='unknown';this[_0x1237('0x10')]='';this[_0x1237('0x11')]='';this['mobile']='';this['interface']='';this['online']=_0x30546e[_0x1237('0x12')]||![];this[_0x1237('0x13')]='unknown';this[_0x1237('0x14')]=0x0;this[_0x1237('0x15')]='';this[_0x1237('0x16')]='';this[_0x1237('0x17')]=![];this[_0x1237('0x18')]=![];this[_0x1237('0x2')]='';}Agent[_0x1237('0x19')][_0x1237('0x1a')]=function(_0x16171c){var _0x1e854e;if(_0x16171c&&_0x16171c[_0x1237('0xc')]){_0x1e854e=_0x16171c[_0x1237('0xc')][_0x1237('0x1b')]();switch(_0x1e854e){case _0x1237('0x1c'):_0x1e854e=_0x1237('0x1d');break;case _0x1237('0x1e'):_0x1e854e='talking';break;}}if(_0x1e854e&&this[_0x1237('0x13')]!==_0x1e854e||_0x16171c[_0x1237('0x1f')]){this['voiceStatusTime']=_[_0x1237('0x20')](moment()['format']('x'));}if(_0x1e854e){this[_0x1237('0x13')]=_0x1e854e;}var _0xe0e640={'id':this['id'],'name':this[_0x1237('0x8')],'email':this['email'],'accountcode':this[_0x1237('0xa')],'fullname':this[_0x1237('0xb')],'state':this['state'],'stateTime':this[_0x1237('0xe')],'status':this['status'],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x1237('0x13')],'voiceStatusTime':this[_0x1237('0x14')],'voiceStatusCallerIdNumber':this[_0x1237('0x15')],'voiceStatusQueue':this[_0x1237('0x16')],'interface':this[_0x1237('0x21')],'onhold':this['onhold']};var _0x58e7b2=md5(JSON[_0x1237('0x22')](_0xe0e640));if(this[_0x1237('0x2')]!==_0x58e7b2){this[_0x1237('0x2')]=_0x58e7b2;io['to'](util[_0x1237('0x23')](_0x1237('0x24'),_0xe0e640['name']))[_0x1237('0x25')](_0x1237('0x26'),_0xe0e640);io[_0x1237('0x25')](_0x1237('0x27'),_0xe0e640);}};module['exports']=Agent; \ No newline at end of file +var _0x516b=['localhost','name','email','accountcode','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','talking','statePause','toNumber','format','fullname','stringify','emit','user:save','user:presence','exports','lodash','util','ioredis','../../../config/environment','redis'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x516b,0x181));var _0xb516=function(_0x83c6f5,_0x3b1182){_0x83c6f5=_0x83c6f5-0x0;var _0x37b68c=_0x516b[_0x83c6f5];return _0x37b68c;};'use strict';var _=require(_0xb516('0x0'));var util=require(_0xb516('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0xb516('0x2'));var config=require(_0xb516('0x3'));config[_0xb516('0x4')]=_['defaults'](config[_0xb516('0x4')],{'host':_0xb516('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb516('0x4')]));function Agent(_0x3c0d45){this['id']=_0x3c0d45['id']||0x0;this[_0xb516('0x6')]=_0x3c0d45[_0xb516('0x6')]||'';this[_0xb516('0x7')]=_0x3c0d45[_0xb516('0x7')]||'';this['accountcode']=_0x3c0d45[_0xb516('0x8')]||'';this['fullname']=_0x3c0d45['fullname']||'';this[_0xb516('0x9')]=_0xb516('0xa');this[_0xb516('0xb')]=0x0;this[_0xb516('0xc')]=_0xb516('0xa');this[_0xb516('0xd')]='';this[_0xb516('0xe')]='';this[_0xb516('0xf')]='';this[_0xb516('0x10')]='';this[_0xb516('0x11')]=_0x3c0d45[_0xb516('0x11')]||![];this[_0xb516('0x12')]=_0xb516('0xa');this[_0xb516('0x13')]=0x0;this[_0xb516('0x14')]='';this[_0xb516('0x15')]='';this[_0xb516('0x16')]=![];this[_0xb516('0x17')]=![];this[_0xb516('0x18')]='';}Agent[_0xb516('0x19')][_0xb516('0x1a')]=function(_0x4f5716){var _0x589f5b;if(_0x4f5716&&_0x4f5716['state']){_0x589f5b=_0x4f5716[_0xb516('0x9')][_0xb516('0x1b')]();switch(_0x589f5b){case _0xb516('0x1c'):_0x589f5b='idle';break;case'inuse':_0x589f5b=_0xb516('0x1d');break;}}if(_0x589f5b&&this[_0xb516('0x12')]!==_0x589f5b||_0x4f5716[_0xb516('0x1e')]){this[_0xb516('0x13')]=_[_0xb516('0x1f')](moment()[_0xb516('0x20')]('x'));}if(_0x589f5b){this[_0xb516('0x12')]=_0x589f5b;}var _0x29d6d1={'id':this['id'],'name':this[_0xb516('0x6')],'email':this[_0xb516('0x7')],'accountcode':this[_0xb516('0x8')],'fullname':this[_0xb516('0x21')],'state':this[_0xb516('0x9')],'stateTime':this[_0xb516('0xb')],'status':this['status'],'address':this[_0xb516('0xd')],'online':this[_0xb516('0x11')],'voiceStatus':this[_0xb516('0x12')],'voiceStatusTime':this[_0xb516('0x13')],'voiceStatusCallerIdNumber':this[_0xb516('0x14')],'voiceStatusQueue':this[_0xb516('0x15')],'interface':this[_0xb516('0x10')],'onhold':this[_0xb516('0x16')]};var _0x4c12f9=md5(JSON[_0xb516('0x22')](_0x29d6d1));if(this[_0xb516('0x18')]!==_0x4c12f9){this[_0xb516('0x18')]=_0x4c12f9;io['to'](util[_0xb516('0x20')]('user:%s',_0x29d6d1[_0xb516('0x6')]))[_0xb516('0x23')](_0xb516('0x24'),_0x29d6d1);io['emit'](_0xb516('0x25'),_0x29d6d1);}};module[_0xb516('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 39cdac6..63137d8 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 _0x5aaa=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','originated','temp','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5aaa,0x1cd));var _0xa5aa=function(_0x355932,_0x4760d5){_0x355932=_0x355932-0x0;var _0x5518ca=_0x5aaa[_0x355932];return _0x5518ca;};'use strict';function Campaign(_0x2a1b3b){this['id']=_0x2a1b3b['id']||0x0;this[_0xa5aa('0x0')]=_0x2a1b3b[_0xa5aa('0x0')]||'';this[_0xa5aa('0x1')]=_0x2a1b3b[_0xa5aa('0x1')]||'campaign';this[_0xa5aa('0x2')]=0x0;this[_0xa5aa('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xa5aa('0x4')]=0x0;this['message']='';this[_0xa5aa('0x5')]=!![];this[_0xa5aa('0x6')]=_0x2a1b3b[_0xa5aa('0x6')];this[_0xa5aa('0x7')]=_0x2a1b3b[_0xa5aa('0x7')];this[_0xa5aa('0x8')]=_0x2a1b3b['dialTimezone']||null;this['dialGlobalInterval']=_0x2a1b3b[_0xa5aa('0x9')]?_0x2a1b3b['dialGlobalInterval']:null;this[_0xa5aa('0xa')]=_0x2a1b3b[_0xa5aa('0xa')];this['dialOriginateCallerIdNumber']=_0x2a1b3b[_0xa5aa('0xb')];this[_0xa5aa('0xc')]=_0x2a1b3b[_0xa5aa('0xc')]||0x1e;this[_0xa5aa('0xd')]=_0x2a1b3b[_0xa5aa('0xd')];this[_0xa5aa('0xe')]=_0x2a1b3b[_0xa5aa('0xe')];this['dialBusyMaxRetry']=_0x2a1b3b['dialBusyMaxRetry'];this[_0xa5aa('0xf')]=_0x2a1b3b[_0xa5aa('0xf')];this['dialNoAnswerMaxRetry']=_0x2a1b3b['dialNoAnswerMaxRetry'];this[_0xa5aa('0x10')]=_0x2a1b3b[_0xa5aa('0x10')];this[_0xa5aa('0x11')]=_0x2a1b3b[_0xa5aa('0x11')];this[_0xa5aa('0x12')]=_0x2a1b3b['dialNoSuchNumberMaxRetry']||0x3;this[_0xa5aa('0x13')]=_0x2a1b3b[_0xa5aa('0x13')]||0x96;this[_0xa5aa('0x14')]=_0x2a1b3b[_0xa5aa('0x14')]||0x3;this['dialDropRetryFrequency']=_0x2a1b3b['dialDropRetryFrequency']||0x96;this[_0xa5aa('0x15')]=_0x2a1b3b[_0xa5aa('0x15')]||0x3;this['dialAbandonedRetryFrequency']=_0x2a1b3b[_0xa5aa('0x16')]||0x96;this[_0xa5aa('0x17')]=_0x2a1b3b['dialMachineMaxRetry']||0x3;this[_0xa5aa('0x18')]=_0x2a1b3b[_0xa5aa('0x18')]||0x96;this['dialAgentRejectMaxRetry']=_0x2a1b3b[_0xa5aa('0x19')]||0x3;this[_0xa5aa('0x1a')]=_0x2a1b3b[_0xa5aa('0x1a')]||0x96;this[_0xa5aa('0x1b')]=_0x2a1b3b['dialOrderByScheduledAt']||'DESC';this[_0xa5aa('0x1c')]=_0x2a1b3b['dialPrefix']||undefined;this[_0xa5aa('0x1d')]=_0x2a1b3b[_0xa5aa('0x1d')]||undefined;this[_0xa5aa('0x1e')]=_0x2a1b3b[_0xa5aa('0x1e')]||undefined;this[_0xa5aa('0x1f')]=_0x2a1b3b[_0xa5aa('0x1f')]?_0x2a1b3b[_0xa5aa('0x1f')]:undefined;this[_0xa5aa('0x20')]=_0x2a1b3b['Trunk']?_0x2a1b3b[_0xa5aa('0x20')]:undefined;this['Interval']=_0x2a1b3b[_0xa5aa('0x21')]?_0x2a1b3b['Interval']:undefined;this['SquareProject']=_0x2a1b3b['SquareProject']?_0x2a1b3b[_0xa5aa('0x22')]:undefined;this['dialQueueProject']=_0x2a1b3b[_0xa5aa('0x22')]?_0x2a1b3b['SquareProject'][_0xa5aa('0x0')]:undefined;this[_0xa5aa('0x23')]=_0x2a1b3b[_0xa5aa('0x23')]||![];this[_0xa5aa('0x24')]=_0x2a1b3b['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x2a1b3b['dialAMDGreeting'];this[_0xa5aa('0x25')]=_0x2a1b3b['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x2a1b3b[_0xa5aa('0x26')];this[_0xa5aa('0x27')]=_0x2a1b3b[_0xa5aa('0x27')];this[_0xa5aa('0x28')]=_0x2a1b3b[_0xa5aa('0x28')];this[_0xa5aa('0x29')]=_0x2a1b3b['dialAMDMaximumNumberOfWords'];this[_0xa5aa('0x2a')]=_0x2a1b3b[_0xa5aa('0x2a')];this['dialAMDMaximumWordLength']=_0x2a1b3b['dialAMDMaximumWordLength'];}module[_0xa5aa('0x2b')]=Campaign; \ No newline at end of file +var _0x724c=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject'];(function(_0x39b7d8,_0xa44989){var _0x42d6dd=function(_0x2922ab){while(--_0x2922ab){_0x39b7d8['push'](_0x39b7d8['shift']());}};_0x42d6dd(++_0xa44989);}(_0x724c,0x10a));var _0xc724=function(_0x19f985,_0x45960b){_0x19f985=_0x19f985-0x0;var _0x3bb1a1=_0x724c[_0x19f985];return _0x3bb1a1;};'use strict';function Campaign(_0x325063){this['id']=_0x325063['id']||0x0;this[_0xc724('0x0')]=_0x325063['name']||'';this[_0xc724('0x1')]=_0x325063[_0xc724('0x1')]||_0xc724('0x2');this[_0xc724('0x3')]=0x0;this[_0xc724('0x4')]=0x0;this[_0xc724('0x5')]=0x0;this[_0xc724('0x6')]=0x0;this['message']='';this[_0xc724('0x7')]=!![];this[_0xc724('0x8')]=_0x325063[_0xc724('0x8')];this[_0xc724('0x9')]=_0x325063[_0xc724('0x9')];this[_0xc724('0xa')]=_0x325063[_0xc724('0xa')]||null;this[_0xc724('0xb')]=_0x325063[_0xc724('0xb')]?_0x325063[_0xc724('0xb')]:null;this[_0xc724('0xc')]=_0x325063[_0xc724('0xc')];this[_0xc724('0xd')]=_0x325063[_0xc724('0xd')];this['dialOriginateTimeout']=_0x325063[_0xc724('0xe')]||0x1e;this[_0xc724('0xf')]=_0x325063[_0xc724('0xf')];this[_0xc724('0x10')]=_0x325063[_0xc724('0x10')];this[_0xc724('0x11')]=_0x325063[_0xc724('0x11')];this['dialBusyRetryFrequency']=_0x325063['dialBusyRetryFrequency'];this[_0xc724('0x12')]=_0x325063[_0xc724('0x12')];this[_0xc724('0x13')]=_0x325063[_0xc724('0x13')];this[_0xc724('0x14')]=_0x325063[_0xc724('0x14')];this['dialNoSuchNumberMaxRetry']=_0x325063[_0xc724('0x15')]||0x3;this[_0xc724('0x16')]=_0x325063[_0xc724('0x16')]||0x96;this[_0xc724('0x17')]=_0x325063[_0xc724('0x17')]||0x3;this[_0xc724('0x18')]=_0x325063['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x325063[_0xc724('0x19')]||0x3;this[_0xc724('0x1a')]=_0x325063[_0xc724('0x1a')]||0x96;this[_0xc724('0x1b')]=_0x325063[_0xc724('0x1b')]||0x3;this[_0xc724('0x1c')]=_0x325063['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x325063[_0xc724('0x1d')]||0x3;this[_0xc724('0x1e')]=_0x325063['dialAgentRejectRetryFrequency']||0x96;this[_0xc724('0x1f')]=_0x325063[_0xc724('0x1f')]||_0xc724('0x20');this[_0xc724('0x21')]=_0x325063[_0xc724('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x325063[_0xc724('0x22')]||undefined;this['dialCutDigit']=_0x325063[_0xc724('0x23')]||undefined;this[_0xc724('0x24')]=_0x325063['TrunkBackup']?_0x325063[_0xc724('0x24')]:undefined;this[_0xc724('0x25')]=_0x325063[_0xc724('0x25')]?_0x325063[_0xc724('0x25')]:undefined;this[_0xc724('0x26')]=_0x325063[_0xc724('0x26')]?_0x325063[_0xc724('0x26')]:undefined;this[_0xc724('0x27')]=_0x325063['SquareProject']?_0x325063[_0xc724('0x27')]:undefined;this['dialQueueProject']=_0x325063['SquareProject']?_0x325063[_0xc724('0x27')]['name']:undefined;this[_0xc724('0x28')]=_0x325063[_0xc724('0x28')]||![];this[_0xc724('0x29')]=_0x325063[_0xc724('0x29')];this[_0xc724('0x2a')]=_0x325063[_0xc724('0x2a')];this[_0xc724('0x2b')]=_0x325063['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x325063[_0xc724('0x2c')];this['dialAMDMinWordLength']=_0x325063[_0xc724('0x2d')];this['dialAMDBetweenWordsSilence']=_0x325063[_0xc724('0x2e')];this[_0xc724('0x2f')]=_0x325063[_0xc724('0x2f')];this[_0xc724('0x30')]=_0x325063['dialAMDSilenceThreshold'];this[_0xc724('0x31')]=_0x325063['dialAMDMaximumWordLength'];}module[_0xc724('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index cfdd69a..548beec 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 _0xd506=['lastdata','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','endtime','unmanaged','lastapplication'];(function(_0x9b06e9,_0x599760){var _0x46067e=function(_0x12dcf4){while(--_0x12dcf4){_0x9b06e9['push'](_0x9b06e9['shift']());}};_0x46067e(++_0x599760);}(_0xd506,0x7a));var _0x6d50=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xd506[_0x278e3c];return _0x3e2d9b;};'use strict';function Channel(){this[_0x6d50('0x0')]=null;this[_0x6d50('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0x6d50('0x2')]='';this[_0x6d50('0x3')]=undefined;this[_0x6d50('0x4')]=undefined;this[_0x6d50('0x5')]=0x0;this[_0x6d50('0x6')]='';this[_0x6d50('0x7')]=0x0;this[_0x6d50('0x8')]=0x0;this[_0x6d50('0x9')]=0x0;this['answered']=![];this['answertime']=null;this[_0x6d50('0xa')]=null;this[_0x6d50('0xb')]=![];this['abandoned']=![];this[_0x6d50('0xc')]='';this[_0x6d50('0xd')]='';this['duration']=0x0;this[_0x6d50('0xe')]=0x0;this[_0x6d50('0xf')]=0x0;this[_0x6d50('0x10')]=null;this['tag']=null;this[_0x6d50('0x11')]=null;this[_0x6d50('0x12')]=![];this[_0x6d50('0x13')]=null;this[_0x6d50('0x14')]=null;this[_0x6d50('0x15')]=[];this[_0x6d50('0x16')]=undefined;this[_0x6d50('0x17')]=undefined;this[_0x6d50('0x18')]=undefined;this[_0x6d50('0x19')]=0x0;}module[_0x6d50('0x1a')]=Channel; \ No newline at end of file +var _0x7a2c=['transfercalleridnum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','monitor','queue','monitors'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x293aab,_0x3cc42c){_0x293aab=_0x293aab-0x0;var _0x3ee752=_0x7a2c[_0x293aab];return _0x3ee752;};'use strict';function Channel(){this[_0xc7a2('0x0')]=null;this['channel']='';this[_0xc7a2('0x1')]='';this[_0xc7a2('0x2')]=0x0;this[_0xc7a2('0x3')]='';this[_0xc7a2('0x4')]=undefined;this[_0xc7a2('0x5')]=undefined;this[_0xc7a2('0x6')]=0x0;this[_0xc7a2('0x7')]='';this[_0xc7a2('0x8')]=0x0;this['linkedid']=0x0;this[_0xc7a2('0x9')]=0x0;this[_0xc7a2('0xa')]=![];this['answertime']=null;this['endtime']=null;this['unmanaged']=![];this[_0xc7a2('0xb')]=![];this[_0xc7a2('0xc')]='';this[_0xc7a2('0xd')]='';this[_0xc7a2('0xe')]=0x0;this['billableseconds']=0x0;this[_0xc7a2('0xf')]=0x0;this[_0xc7a2('0x10')]=null;this[_0xc7a2('0x11')]=null;this['disposition']=null;this[_0xc7a2('0x12')]=![];this['monitorFilename']=null;this[_0xc7a2('0x13')]=null;this[_0xc7a2('0x14')]=[];this[_0xc7a2('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xc7a2('0x16')]=undefined;this[_0xc7a2('0x17')]=0x0;}module[_0xc7a2('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 985bac8..3e6c2c9 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 _0x106f=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x888a02,_0x5df389){var _0xedd786=function(_0x580694){while(--_0x580694){_0x888a02['push'](_0x888a02['shift']());}};_0xedd786(++_0x5df389);}(_0x106f,0x162));var _0xf106=function(_0x473411,_0xc8f76f){_0x473411=_0x473411-0x0;var _0x2a923d=_0x106f[_0x473411];return _0x2a923d;};'use strict';function DeskAccount(_0x6b4dfa){this['id']=_0x6b4dfa['id']||0x0;this[_0xf106('0x0')]=_0x6b4dfa['name']||'';this[_0xf106('0x1')]=_0x6b4dfa[_0xf106('0x1')]||'';this['remoteUri']=_0x6b4dfa[_0xf106('0x2')]||'';this['authType']=_0x6b4dfa[_0xf106('0x3')]||'';this[_0xf106('0x4')]=_0x6b4dfa[_0xf106('0x4')]||'';this[_0xf106('0x5')]=_0x6b4dfa[_0xf106('0x5')]||'';this[_0xf106('0x6')]=_0x6b4dfa[_0xf106('0x6')]||'';this['token']=_0x6b4dfa[_0xf106('0x7')]||'';this[_0xf106('0x8')]=_0x6b4dfa['tokenSecret']||'';this['type']=_0x6b4dfa['type']||'';this['serverUrl']=_0x6b4dfa['serverUrl']||'';this[_0xf106('0x9')]=_0x6b4dfa[_0xf106('0x9')]||{};}module[_0xf106('0xa')]=DeskAccount; \ No newline at end of file +var _0xea81=['exports','name','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0xea81,0x1ed));var _0x1ea8=function(_0x2a8079,_0x1ebafd){_0x2a8079=_0x2a8079-0x0;var _0x25e337=_0xea81[_0x2a8079];return _0x25e337;};'use strict';function DeskAccount(_0x202267){this['id']=_0x202267['id']||0x0;this[_0x1ea8('0x0')]=_0x202267[_0x1ea8('0x0')]||'';this[_0x1ea8('0x1')]=_0x202267['username']||'';this['remoteUri']=_0x202267[_0x1ea8('0x2')]||'';this[_0x1ea8('0x3')]=_0x202267[_0x1ea8('0x3')]||'';this[_0x1ea8('0x4')]=_0x202267[_0x1ea8('0x4')]||'';this['consumerKey']=_0x202267['consumerKey']||'';this['consumerSecret']=_0x202267[_0x1ea8('0x5')]||'';this[_0x1ea8('0x6')]=_0x202267[_0x1ea8('0x6')]||'';this[_0x1ea8('0x7')]=_0x202267['tokenSecret']||'';this[_0x1ea8('0x8')]=_0x202267[_0x1ea8('0x8')]||'';this[_0x1ea8('0x9')]=_0x202267[_0x1ea8('0x9')]||'';this[_0x1ea8('0xa')]=_0x202267['Configurations']||{};}module[_0x1ea8('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index d664f18..ed4211b 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 _0xa832=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password'];(function(_0x44120e,_0x2b67b5){var _0x28f0e2=function(_0x3e1976){while(--_0x3e1976){_0x44120e['push'](_0x44120e['shift']());}};_0x28f0e2(++_0x2b67b5);}(_0xa832,0x13d));var _0x2a83=function(_0x3d1daa,_0x26c8b3){_0x3d1daa=_0x3d1daa-0x0;var _0x24bc34=_0xa832[_0x3d1daa];return _0x24bc34;};'use strict';function Dynamics365Account(_0x477a40){this['id']=_0x477a40['id']||0x0;this[_0x2a83('0x0')]=_0x477a40['name']||'';this['username']=_0x477a40[_0x2a83('0x1')]||'';this[_0x2a83('0x2')]=_0x477a40[_0x2a83('0x2')]||'';this[_0x2a83('0x3')]=_0x477a40['remoteUri']||'';this['tenantId']=_0x477a40[_0x2a83('0x4')]||'';this[_0x2a83('0x5')]=_0x477a40[_0x2a83('0x5')]||'';this[_0x2a83('0x6')]=_0x477a40[_0x2a83('0x6')]||{};this['serverUrl']=_0x477a40[_0x2a83('0x7')]||'';this[_0x2a83('0x8')]=_0x477a40['Configurations']||{};}module[_0x2a83('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x8c90=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports'];(function(_0x328f92,_0x5cf212){var _0x2ff6e2=function(_0x49d9cf){while(--_0x49d9cf){_0x328f92['push'](_0x328f92['shift']());}};_0x2ff6e2(++_0x5cf212);}(_0x8c90,0x14a));var _0x08c9=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x8c90[_0x56482c];return _0x5aae7a;};'use strict';function Dynamics365Account(_0x282d86){this['id']=_0x282d86['id']||0x0;this['name']=_0x282d86[_0x08c9('0x0')]||'';this[_0x08c9('0x1')]=_0x282d86['username']||'';this[_0x08c9('0x2')]=_0x282d86[_0x08c9('0x2')]||'';this[_0x08c9('0x3')]=_0x282d86['remoteUri']||'';this[_0x08c9('0x4')]=_0x282d86[_0x08c9('0x4')]||'';this[_0x08c9('0x5')]=_0x282d86[_0x08c9('0x5')]||'';this[_0x08c9('0x6')]=_0x282d86[_0x08c9('0x6')]||{};this[_0x08c9('0x7')]=_0x282d86[_0x08c9('0x7')]||'';this[_0x08c9('0x8')]=_0x282d86[_0x08c9('0x8')]||{};}module[_0x08c9('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index a1ff9fd..2ef71ff 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 _0x2feb=['tech','SIP','Trunk','ListId','key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x51bce4,_0x4f6388){var _0x235fe6=function(_0xe761da){while(--_0xe761da){_0x51bce4['push'](_0x51bce4['shift']());}};_0x235fe6(++_0x4f6388);}(_0x2feb,0x7d));var _0xb2fe=function(_0x4c6e4a,_0x263ab8){_0x4c6e4a=_0x4c6e4a-0x0;var _0x3d69f4=_0x2feb[_0x4c6e4a];return _0x3d69f4;};'use strict';function FaxAccount(_0x3deb50){this['id']=_0x3deb50['id']||0x0;this['name']=_0x3deb50['name']||'';this[_0xb2fe('0x0')]=_0x3deb50[_0xb2fe('0x0')];this[_0xb2fe('0x1')]=_0x3deb50[_0xb2fe('0x1')];this[_0xb2fe('0x2')]=_0x3deb50[_0xb2fe('0x2')];this[_0xb2fe('0x3')]=_0x3deb50[_0xb2fe('0x3')];this[_0xb2fe('0x4')]=_0x3deb50['minrate']||0x960;this[_0xb2fe('0x5')]=_0x3deb50[_0xb2fe('0x5')]||0x3840;this[_0xb2fe('0x6')]=_0x3deb50[_0xb2fe('0x6')]||_0xb2fe('0x7');this[_0xb2fe('0x8')]=_0x3deb50['gateway']||'no';this[_0xb2fe('0x9')]=_0x3deb50[_0xb2fe('0x9')]||'no';this['t38timeout']=_0x3deb50[_0xb2fe('0xa')]||0x1388;this[_0xb2fe('0xb')]=_0x3deb50[_0xb2fe('0xb')]||_0xb2fe('0xc');this[_0xb2fe('0xd')]=_0x3deb50[_0xb2fe('0xd')]?_0x3deb50[_0xb2fe('0xd')]:undefined;this[_0xb2fe('0xe')]=_0x3deb50[_0xb2fe('0xe')];this['key']=_0x3deb50[_0xb2fe('0xf')];}module[_0xb2fe('0x10')]=FaxAccount; \ No newline at end of file +var _0x2901=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name'];(function(_0x5ac527,_0x33fe40){var _0x91a28f=function(_0x4755ec){while(--_0x4755ec){_0x5ac527['push'](_0x5ac527['shift']());}};_0x91a28f(++_0x33fe40);}(_0x2901,0xfe));var _0x1290=function(_0x146a3f,_0x53a76f){_0x146a3f=_0x146a3f-0x0;var _0x10e034=_0x2901[_0x146a3f];return _0x10e034;};'use strict';function FaxAccount(_0x3bde33){this['id']=_0x3bde33['id']||0x0;this[_0x1290('0x0')]=_0x3bde33[_0x1290('0x0')]||'';this[_0x1290('0x1')]=_0x3bde33[_0x1290('0x1')];this[_0x1290('0x2')]=_0x3bde33[_0x1290('0x2')];this[_0x1290('0x3')]=_0x3bde33[_0x1290('0x3')];this[_0x1290('0x4')]=_0x3bde33[_0x1290('0x4')];this[_0x1290('0x5')]=_0x3bde33['minrate']||0x960;this[_0x1290('0x6')]=_0x3bde33[_0x1290('0x6')]||0x3840;this[_0x1290('0x7')]=_0x3bde33[_0x1290('0x7')]||_0x1290('0x8');this[_0x1290('0x9')]=_0x3bde33[_0x1290('0x9')]||'no';this[_0x1290('0xa')]=_0x3bde33[_0x1290('0xa')]||'no';this[_0x1290('0xb')]=_0x3bde33[_0x1290('0xb')]||0x1388;this[_0x1290('0xc')]=_0x3bde33[_0x1290('0xc')]||_0x1290('0xd');this[_0x1290('0xe')]=_0x3bde33[_0x1290('0xe')]?_0x3bde33['Trunk']:undefined;this[_0x1290('0xf')]=_0x3bde33[_0x1290('0xf')];this[_0x1290('0x10')]=_0x3bde33['key'];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index ae65bea..f3118ab 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 _0xcf86=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf86,0x148));var _0x6cf8=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xcf86[_0x36eaaa];return _0x461349;};'use strict';function FreshdeskAccount(_0x380f71){this['id']=_0x380f71['id']||0x0;this['name']=_0x380f71[_0x6cf8('0x0')]||'';this[_0x6cf8('0x1')]=_0x380f71[_0x6cf8('0x1')]||'';this[_0x6cf8('0x2')]=_0x380f71[_0x6cf8('0x3')]||'';this[_0x6cf8('0x4')]=_0x380f71[_0x6cf8('0x4')]||'';this[_0x6cf8('0x5')]=_0x380f71[_0x6cf8('0x5')]||'';this[_0x6cf8('0x6')]=_0x380f71[_0x6cf8('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x932c=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x383cb6,_0x2dcf05){var _0x577362=function(_0x4160eb){while(--_0x4160eb){_0x383cb6['push'](_0x383cb6['shift']());}};_0x577362(++_0x2dcf05);}(_0x932c,0xad));var _0xc932=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0x932c[_0x2a4fe2];return _0x225c4a;};'use strict';function FreshdeskAccount(_0x1a3372){this['id']=_0x1a3372['id']||0x0;this['name']=_0x1a3372[_0xc932('0x0')]||'';this['username']=_0x1a3372[_0xc932('0x1')]||'';this['apiKey']=_0x1a3372['token']||'';this[_0xc932('0x2')]=_0x1a3372[_0xc932('0x2')]||'';this[_0xc932('0x3')]=_0x1a3372['serverUrl']||'';this[_0xc932('0x4')]=_0x1a3372[_0xc932('0x4')]||{};}module[_0xc932('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 3113aea..2578e20 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 _0xd204=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x25a65c,_0x177595){var _0x24f1ae=function(_0x308fd2){while(--_0x308fd2){_0x25a65c['push'](_0x25a65c['shift']());}};_0x24f1ae(++_0x177595);}(_0xd204,0x7b));var _0x4d20=function(_0x42e5c3,_0x9e019){_0x42e5c3=_0x42e5c3-0x0;var _0xd947a0=_0xd204[_0x42e5c3];return _0xd947a0;};'use strict';function FreshsalesAccount(_0x444720){this['id']=_0x444720['id']||0x0;this[_0x4d20('0x0')]=_0x444720[_0x4d20('0x0')]||'';this['username']=_0x444720[_0x4d20('0x1')]||'';this[_0x4d20('0x2')]=_0x444720[_0x4d20('0x3')]||'';this[_0x4d20('0x4')]=_0x444720[_0x4d20('0x4')]||'';this['serverUrl']=_0x444720[_0x4d20('0x5')]||'';this['Configurations']=_0x444720[_0x4d20('0x6')]||{};}module[_0x4d20('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x7715=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x54adc4,_0x16e4fc){var _0xe49111=function(_0x451f2b){while(--_0x451f2b){_0x54adc4['push'](_0x54adc4['shift']());}};_0xe49111(++_0x16e4fc);}(_0x7715,0x1de));var _0x5771=function(_0x15f3ae,_0x433f70){_0x15f3ae=_0x15f3ae-0x0;var _0x5c6fc9=_0x7715[_0x15f3ae];return _0x5c6fc9;};'use strict';function FreshsalesAccount(_0x55bab4){this['id']=_0x55bab4['id']||0x0;this[_0x5771('0x0')]=_0x55bab4[_0x5771('0x0')]||'';this['username']=_0x55bab4[_0x5771('0x1')]||'';this[_0x5771('0x2')]=_0x55bab4[_0x5771('0x3')]||'';this[_0x5771('0x4')]=_0x55bab4['remoteUri']||'';this[_0x5771('0x5')]=_0x55bab4[_0x5771('0x5')]||'';this[_0x5771('0x6')]=_0x55bab4['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index e18643b..1b6109e 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 _0xef5a=['context','exten','priority','holdtime','assigned','lastAssignedTo','variables','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode'];(function(_0x4d52db,_0x2ed74d){var _0x4f1a8b=function(_0x4ed67e){while(--_0x4ed67e){_0x4d52db['push'](_0x4d52db['shift']());}};_0x4f1a8b(++_0x2ed74d);}(_0xef5a,0x102));var _0xaef5=function(_0x3d5749,_0x175d3c){_0x3d5749=_0x3d5749-0x0;var _0x2f2353=_0xef5a[_0x3d5749];return _0x2f2353;};'use strict';function QueueReport(){this[_0xaef5('0x0')]=_0xaef5('0x1');this[_0xaef5('0x2')]='';this[_0xaef5('0x3')]='';this['calleridname']='';this[_0xaef5('0x4')]='';this['queuecallerjoinAt']=null;this[_0xaef5('0x5')]=null;this[_0xaef5('0x6')]=0x1;this['count']=0x1;this[_0xaef5('0x7')]=![];this[_0xaef5('0x8')]=null;this[_0xaef5('0x9')]=![];this[_0xaef5('0xa')]=null;this[_0xaef5('0xb')]=![];this[_0xaef5('0xc')]=null;this[_0xaef5('0xd')]=0x1;this['channel']='';this[_0xaef5('0xe')]='';this[_0xaef5('0xf')]='';this[_0xaef5('0x10')]='';this[_0xaef5('0x11')]='';this[_0xaef5('0x12')]='';this[_0xaef5('0x13')]='';this[_0xaef5('0x14')]=0x0;this[_0xaef5('0x15')]=![];this[_0xaef5('0x16')]='';this['mohtime']=0x0;this[_0xaef5('0x17')]={};}module[_0xaef5('0x18')]=QueueReport; \ No newline at end of file +var _0xa57c=['connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum'];(function(_0xd0fcb0,_0x289863){var _0x38f584=function(_0x9d108f){while(--_0x9d108f){_0xd0fcb0['push'](_0xd0fcb0['shift']());}};_0x38f584(++_0x289863);}(_0xa57c,0x150));var _0xca57=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xa57c[_0x1cc8fe];return _0x230054;};'use strict';function QueueReport(){this[_0xca57('0x0')]=_0xca57('0x1');this[_0xca57('0x2')]='';this['calleridnum']='';this[_0xca57('0x3')]='';this[_0xca57('0x4')]='';this[_0xca57('0x5')]=null;this['queuecallerleaveAt']=null;this[_0xca57('0x6')]=0x1;this[_0xca57('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xca57('0x8')]=null;this['queuecallercomplete']=![];this[_0xca57('0x9')]=null;this[_0xca57('0xa')]=![];this[_0xca57('0xb')]=null;this['originalposition']=0x1;this[_0xca57('0xc')]='';this[_0xca57('0xd')]='';this[_0xca57('0xe')]='';this[_0xca57('0xf')]='';this[_0xca57('0x10')]='';this[_0xca57('0x11')]='';this[_0xca57('0x12')]='';this[_0xca57('0x13')]=0x0;this[_0xca57('0x14')]=![];this[_0xca57('0x15')]='';this[_0xca57('0x16')]=0x0;this[_0xca57('0x17')]={};}module[_0xca57('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index dc74c1a..fe686a3 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 _0x09db=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x20b371,_0x27595d){var _0x4b5181=function(_0x44b894){while(--_0x44b894){_0x20b371['push'](_0x20b371['shift']());}};_0x4b5181(++_0x27595d);}(_0x09db,0x178));var _0xb09d=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x09db[_0x43d11d];return _0x38cd08;};'use strict';function SalesforceAccount(_0x17a63a){this['id']=_0x17a63a['id']||0x0;this['name']=_0x17a63a[_0xb09d('0x0')]||'';this['username']=_0x17a63a[_0xb09d('0x1')]||'';this['remoteUri']=_0x17a63a[_0xb09d('0x2')]||'';this[_0xb09d('0x3')]=_0x17a63a['password']||'';this[_0xb09d('0x4')]=_0x17a63a[_0xb09d('0x4')]||'';this[_0xb09d('0x5')]=_0x17a63a[_0xb09d('0x5')]||'';this[_0xb09d('0x6')]=_0x17a63a[_0xb09d('0x6')]||'';this[_0xb09d('0x7')]=_0x17a63a[_0xb09d('0x7')]||_0xb09d('0x8');this[_0xb09d('0x9')]=_0x17a63a[_0xb09d('0x9')]||'';this[_0xb09d('0xa')]=_0x17a63a[_0xb09d('0xa')]||{};}module[_0xb09d('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x3913=['securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x3913,0xcb));var _0x3391=function(_0x25b8d4,_0x45283){_0x25b8d4=_0x25b8d4-0x0;var _0x1273c2=_0x3913[_0x25b8d4];return _0x1273c2;};'use strict';function SalesforceAccount(_0x1ffec6){this['id']=_0x1ffec6['id']||0x0;this['name']=_0x1ffec6[_0x3391('0x0')]||'';this[_0x3391('0x1')]=_0x1ffec6['username']||'';this[_0x3391('0x2')]=_0x1ffec6['remoteUri']||'';this[_0x3391('0x3')]=_0x1ffec6[_0x3391('0x3')]||'';this[_0x3391('0x4')]=_0x1ffec6['clientId']||'';this['clientSecret']=_0x1ffec6[_0x3391('0x5')]||'';this['securityToken']=_0x1ffec6[_0x3391('0x6')]||'';this[_0x3391('0x7')]=_0x1ffec6[_0x3391('0x7')]||'integrationTab';this[_0x3391('0x8')]=_0x1ffec6[_0x3391('0x8')]||'';this[_0x3391('0x9')]=_0x1ffec6['Configurations']||{};}module[_0x3391('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 2131911..ca4245f 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 _0x6553=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x63a213,_0x22e72e){var _0x331731=function(_0xcbcc70){while(--_0xcbcc70){_0x63a213['push'](_0x63a213['shift']());}};_0x331731(++_0x22e72e);}(_0x6553,0x13d));var _0x3655=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x6553[_0x1035c1];return _0x308d67;};'use strict';function ServicenowAccount(_0x1dabab){this['id']=_0x1dabab['id']||0x0;this[_0x3655('0x0')]=_0x1dabab[_0x3655('0x0')]||'';this[_0x3655('0x1')]=_0x1dabab[_0x3655('0x1')]||'';this['password']=_0x1dabab[_0x3655('0x2')]||'';this[_0x3655('0x3')]=_0x1dabab[_0x3655('0x3')]||'';this['serverUrl']=_0x1dabab[_0x3655('0x4')]||'';this['Configurations']=_0x1dabab[_0x3655('0x5')]||{};}module[_0x3655('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xec83=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xec83,0xfa));var _0x3ec8=function(_0x39609a,_0x28a563){_0x39609a=_0x39609a-0x0;var _0xecd92=_0xec83[_0x39609a];return _0xecd92;};'use strict';function ServicenowAccount(_0x154387){this['id']=_0x154387['id']||0x0;this[_0x3ec8('0x0')]=_0x154387[_0x3ec8('0x0')]||'';this[_0x3ec8('0x1')]=_0x154387[_0x3ec8('0x1')]||'';this[_0x3ec8('0x2')]=_0x154387[_0x3ec8('0x2')]||'';this[_0x3ec8('0x3')]=_0x154387[_0x3ec8('0x3')]||'';this[_0x3ec8('0x4')]=_0x154387[_0x3ec8('0x4')]||'';this[_0x3ec8('0x5')]=_0x154387['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index acd25e9..c14558c 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 _0xd88c=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xd88c,0x102));var _0xcd88=function(_0x39304b,_0x30a033){_0x39304b=_0x39304b-0x0;var _0x21160c=_0xd88c[_0x39304b];return _0x21160c;};'use strict';function SugarcrmAccount(_0x295f1f){this['id']=_0x295f1f['id']||0x0;this['name']=_0x295f1f[_0xcd88('0x0')]||'';this[_0xcd88('0x1')]=_0x295f1f['username']||'';this[_0xcd88('0x2')]=_0x295f1f['password']||'';this[_0xcd88('0x3')]=_0x295f1f['remoteUri']||'';this[_0xcd88('0x4')]=_0x295f1f[_0xcd88('0x4')]||'';this[_0xcd88('0x5')]=_0x295f1f['Configurations']||{};}module[_0xcd88('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xfbcc=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x2248b5,_0x3174ad){var _0x2d88e6=function(_0x34e698){while(--_0x34e698){_0x2248b5['push'](_0x2248b5['shift']());}};_0x2d88e6(++_0x3174ad);}(_0xfbcc,0x11c));var _0xcfbc=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0xfbcc[_0x28f1de];return _0x5b5dad;};'use strict';function SugarcrmAccount(_0x3700ad){this['id']=_0x3700ad['id']||0x0;this[_0xcfbc('0x0')]=_0x3700ad[_0xcfbc('0x0')]||'';this[_0xcfbc('0x1')]=_0x3700ad[_0xcfbc('0x1')]||'';this[_0xcfbc('0x2')]=_0x3700ad['password']||'';this[_0xcfbc('0x3')]=_0x3700ad[_0xcfbc('0x3')]||'';this['serverUrl']=_0x3700ad[_0xcfbc('0x4')]||'';this['Configurations']=_0x3700ad[_0xcfbc('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 9da0902..f62dff8 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 _0x4f46=['exports','name','accountcode','unknown','stateTime','status','address'];(function(_0x293c3b,_0x51bea3){var _0x8401a2=function(_0x48354c){while(--_0x48354c){_0x293c3b['push'](_0x293c3b['shift']());}};_0x8401a2(++_0x51bea3);}(_0x4f46,0x151));var _0x64f4=function(_0x4fb797,_0x200ee6){_0x4fb797=_0x4fb797-0x0;var _0x34e096=_0x4f46[_0x4fb797];return _0x34e096;};'use strict';function Telephone(_0x538b59){this['id']=_0x538b59['id']||0x0;this[_0x64f4('0x0')]=_0x538b59[_0x64f4('0x0')]||'';this[_0x64f4('0x1')]=_0x538b59[_0x64f4('0x1')]||'';this['state']=_0x64f4('0x2');this[_0x64f4('0x3')]=0x0;this[_0x64f4('0x4')]=_0x64f4('0x2');this[_0x64f4('0x5')]='';}module[_0x64f4('0x6')]=Telephone; \ No newline at end of file +var _0x3165=['exports','name','accountcode','unknown','status'];(function(_0x5f50b5,_0xa8db83){var _0x54c383=function(_0x381334){while(--_0x381334){_0x5f50b5['push'](_0x5f50b5['shift']());}};_0x54c383(++_0xa8db83);}(_0x3165,0x15a));var _0x5316=function(_0x3c5016,_0x4a2958){_0x3c5016=_0x3c5016-0x0;var _0x291b45=_0x3165[_0x3c5016];return _0x291b45;};'use strict';function Telephone(_0x4317df){this['id']=_0x4317df['id']||0x0;this[_0x5316('0x0')]=_0x4317df[_0x5316('0x0')]||'';this[_0x5316('0x1')]=_0x4317df[_0x5316('0x1')]||'';this['state']=_0x5316('0x2');this['stateTime']=0x0;this[_0x5316('0x3')]=_0x5316('0x2');this['address']='';}module[_0x5316('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 557e175..fa80bf4 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 _0x6a6c=['exports','name','html'];(function(_0x458fbd,_0x4feabc){var _0x758791=function(_0x413606){while(--_0x413606){_0x458fbd['push'](_0x458fbd['shift']());}};_0x758791(++_0x4feabc);}(_0x6a6c,0x18a));var _0xc6a6=function(_0x2d4123,_0x209f60){_0x2d4123=_0x2d4123-0x0;var _0x347773=_0x6a6c[_0x2d4123];return _0x347773;};'use strict';function template(_0x2cd7de){this['id']=_0x2cd7de['id']||0x0;this[_0xc6a6('0x0')]=_0x2cd7de[_0xc6a6('0x0')]||'';this[_0xc6a6('0x1')]=_0x2cd7de[_0xc6a6('0x1')]||'';}module[_0xc6a6('0x2')]=template; \ No newline at end of file +var _0x665c=['html','exports','name'];(function(_0x493628,_0x489b08){var _0x418e5d=function(_0x47c83d){while(--_0x47c83d){_0x493628['push'](_0x493628['shift']());}};_0x418e5d(++_0x489b08);}(_0x665c,0x1a9));var _0xc665=function(_0x37c814,_0x1a1e55){_0x37c814=_0x37c814-0x0;var _0x48a3ca=_0x665c[_0x37c814];return _0x48a3ca;};'use strict';function template(_0x3d3c5b){this['id']=_0x3d3c5b['id']||0x0;this[_0xc665('0x0')]=_0x3d3c5b[_0xc665('0x0')]||'';this[_0xc665('0x1')]=_0x3d3c5b[_0xc665('0x1')]||'';}module[_0xc665('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 5a5b18e..1172080 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(_0x27502a,_0x4ff243){var _0x3cbb94=function(_0x2dd23b){while(--_0x2dd23b){_0x27502a['push'](_0x27502a['shift']());}};_0x3cbb94(++_0x4ff243);}(_0xedd9,0xfc));var _0x9edd=function(_0x1e0203,_0x568b28){_0x1e0203=_0x1e0203-0x0;var _0x25ff8c=_0xedd9[_0x1e0203];return _0x25ff8c;};'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 _0x34e8=['channel','voice','status','AllConditions','AnyConditions','Actions','name'];(function(_0x25ad66,_0x46e4dc){var _0x141bc4=function(_0x3a7f8e){while(--_0x3a7f8e){_0x25ad66['push'](_0x25ad66['shift']());}};_0x141bc4(++_0x46e4dc);}(_0x34e8,0x12c));var _0x834e=function(_0x53b8d0,_0x4c310){_0x53b8d0=_0x53b8d0-0x0;var _0x1afd17=_0x34e8[_0x53b8d0];return _0x1afd17;};'use strict';function Trigger(_0x26715f){this['id']=_0x26715f['id']||0x0;this[_0x834e('0x0')]=_0x26715f[_0x834e('0x0')]||'';this[_0x834e('0x1')]=_0x26715f['channel']||_0x834e('0x2');this[_0x834e('0x3')]=_0x26715f[_0x834e('0x3')]||![];this[_0x834e('0x4')]=_0x26715f[_0x834e('0x4')]||[];this[_0x834e('0x5')]=_0x26715f[_0x834e('0x5')]||[];this['Actions']=_0x26715f[_0x834e('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 420cc8b..6608355 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 _0x505c=['address','exports','active','name','state','unknown','stateTime','status','registry','split','port','domain','domainport','refresh','registrationtime'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x505c,0x1a6));var _0xc505=function(_0x42cce6,_0x88baf4){_0x42cce6=_0x42cce6-0x0;var _0x408ca9=_0x505c[_0x42cce6];return _0x408ca9;};'use strict';function Trunk(_0x1f38db){this['id']=_0x1f38db['id']||0x0;this[_0xc505('0x0')]=_0x1f38db[_0xc505('0x0')]||![];this[_0xc505('0x1')]=_0x1f38db['name']||'';this[_0xc505('0x2')]=_0xc505('0x3');this[_0xc505('0x4')]=0x0;this[_0xc505('0x5')]=_0xc505('0x3');this[_0xc505('0x6')]=_0x1f38db[_0xc505('0x6')]&&_0x1f38db['registry']['indexOf'](':')?_0x1f38db[_0xc505('0x6')][_0xc505('0x7')](':')[0x0]:'';this['host']='';this[_0xc505('0x8')]='';this[_0xc505('0x9')]='';this[_0xc505('0xa')]='';this[_0xc505('0xb')]='';this['stateRegistry']=_0xc505('0x3');this[_0xc505('0xc')]='';this[_0xc505('0xd')]='';}module[_0xc505('0xe')]=Trunk; \ No newline at end of file +var _0x96dd=['indexOf','split','host','port','domain','refresh','registrationtime','address','exports','active','name','state','unknown','status','registry'];(function(_0x453a05,_0x102018){var _0xc42c7d=function(_0x39f5a3){while(--_0x39f5a3){_0x453a05['push'](_0x453a05['shift']());}};_0xc42c7d(++_0x102018);}(_0x96dd,0x162));var _0xd96d=function(_0x1a9a45,_0x1739c5){_0x1a9a45=_0x1a9a45-0x0;var _0xf20875=_0x96dd[_0x1a9a45];return _0xf20875;};'use strict';function Trunk(_0x4cdd11){this['id']=_0x4cdd11['id']||0x0;this[_0xd96d('0x0')]=_0x4cdd11[_0xd96d('0x0')]||![];this[_0xd96d('0x1')]=_0x4cdd11[_0xd96d('0x1')]||'';this[_0xd96d('0x2')]=_0xd96d('0x3');this['stateTime']=0x0;this[_0xd96d('0x4')]='unknown';this[_0xd96d('0x5')]=_0x4cdd11['registry']&&_0x4cdd11['registry'][_0xd96d('0x6')](':')?_0x4cdd11[_0xd96d('0x5')][_0xd96d('0x7')](':')[0x0]:'';this[_0xd96d('0x8')]='';this[_0xd96d('0x9')]='';this[_0xd96d('0xa')]='';this['domainport']='';this[_0xd96d('0xb')]='';this['stateRegistry']=_0xd96d('0x3');this[_0xd96d('0xc')]='';this[_0xd96d('0xd')]='';}module[_0xd96d('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 55fb884..4f5da8a 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 _0xaa07=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0xaa07,0xd9));var _0x7aa0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xaa07[_0x2641f9];return _0x585741;};'use strict';function voiceExtension(_0x49b54a){this['id']=_0x49b54a['id']||0x0;this[_0x7aa0('0x0')]=_0x49b54a[_0x7aa0('0x0')]||'';this['recordingFormat']=_0x49b54a[_0x7aa0('0x1')]||'none';this[_0x7aa0('0x2')]=_0x49b54a[_0x7aa0('0x2')]||![];}module[_0x7aa0('0x3')]=voiceExtension; \ No newline at end of file +var _0x3d87=['recordingFormat','exten'];(function(_0x2a4eab,_0x3b3089){var _0x55af80=function(_0x1d22da){while(--_0x1d22da){_0x2a4eab['push'](_0x2a4eab['shift']());}};_0x55af80(++_0x3b3089);}(_0x3d87,0x191));var _0x73d8=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x3d87[_0x550d12];return _0x12103d;};'use strict';function voiceExtension(_0x4e450a){this['id']=_0x4e450a['id']||0x0;this[_0x73d8('0x0')]=_0x4e450a[_0x73d8('0x0')]||'';this[_0x73d8('0x1')]=_0x4e450a[_0x73d8('0x1')]||'none';this['mandatoryDisposition']=_0x4e450a['mandatoryDisposition']||![];}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 c21d018..1a9258a 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 _0x0db8=['predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','inuse','busy','invalid','unavailable','ringing','ringinuse','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','total','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit'];(function(_0x3c318b,_0x49085c){var _0x1573bb=function(_0x259373){while(--_0x259373){_0x3c318b['push'](_0x3c318b['shift']());}};_0x1573bb(++_0x49085c);}(_0x0db8,0x176));var _0x80db=function(_0x4e10bf,_0x559938){_0x4e10bf=_0x4e10bf-0x0;var _0x3c0c88=_0x0db8[_0x4e10bf];return _0x3c0c88;};'use strict';var statusDesc=['unknown','not_inuse',_0x80db('0x0'),_0x80db('0x1'),_0x80db('0x2'),_0x80db('0x3'),_0x80db('0x4'),_0x80db('0x5'),'onhold'];var monitorFormat={'wav':_0x80db('0x6'),'wav49':_0x80db('0x7'),'gsm':'gsm'};var strategy={'rrmemory':_0x80db('0x8'),'roundrobin':_0x80db('0x9')};function VoiceQueue(_0x548d9c){this['id']=_0x548d9c['id']||0x0;this[_0x80db('0xa')]=_0x548d9c[_0x80db('0xa')]||'';this[_0x80db('0xb')]=_0x548d9c[_0x80db('0xb')]||'';this[_0x80db('0xc')]=_0x548d9c['type']||_0x80db('0xd');this['waiting']=0x0;this['talking']=0x0;this[_0x80db('0xe')]=0x0;this[_0x80db('0xf')]=0x0;this[_0x80db('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x80db('0x11')]=0x0;this[_0x80db('0x12')]=0x0;this[_0x80db('0x13')]=0x0;this[_0x80db('0x14')]=0x0;this[_0x80db('0x15')]=0x0;this[_0x80db('0x16')]=_0x548d9c['acw']||![];this[_0x80db('0x17')]=_0x548d9c['acwTimeout']||0xa;this[_0x80db('0x18')]=_0x548d9c[_0x80db('0x18')]||'no';this[_0x80db('0x19')]=!![];this['message']='';this['originated']=0x0;this[_0x80db('0x1a')]=0x0;this[_0x80db('0x1b')]=_0x548d9c[_0x80db('0x1b')]||null;this[_0x80db('0x1c')]=_0x548d9c[_0x80db('0x1c')]?_0x548d9c[_0x80db('0x1c')]:null;this[_0x80db('0x1d')]=_0x548d9c['dialActive'];this[_0x80db('0x1e')]=_0x548d9c[_0x80db('0x1e')]||_0x80db('0x1f');this[_0x80db('0x20')]=_0x548d9c[_0x80db('0x20')]||0x0;this[_0x80db('0x21')]=_0x548d9c[_0x80db('0x21')]||0x0;this[_0x80db('0x22')]=_0x548d9c[_0x80db('0x22')]||0x1;this['dialPredictiveOptimization']=_0x548d9c[_0x80db('0x23')]||_0x80db('0x24');this[_0x80db('0x25')]=_0x548d9c[_0x80db('0x25')]||0.03;this[_0x80db('0x26')]=_0x548d9c[_0x80db('0x26')]||0x258;this['dialOriginateCallerIdName']=_0x548d9c[_0x80db('0x27')]||_0x80db('0x28');this[_0x80db('0x29')]=_0x548d9c['dialOriginateCallerIdNumber']||_0x80db('0x28');this[_0x80db('0x2a')]=_0x548d9c[_0x80db('0x2a')]||0x1e;this['dialQueueOptions']=_0x548d9c[_0x80db('0x2b')]||_0x80db('0x2c');this[_0x80db('0x2d')]=_0x548d9c[_0x80db('0x2d')]||0x3;this[_0x80db('0x2e')]=_0x548d9c[_0x80db('0x2e')]||undefined;this[_0x80db('0x2f')]=_0x548d9c['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x548d9c[_0x80db('0x30')]||0x96;this['dialBusyMaxRetry']=_0x548d9c[_0x80db('0x31')]||0x3;this[_0x80db('0x32')]=_0x548d9c[_0x80db('0x32')]||0x96;this[_0x80db('0x33')]=_0x548d9c['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x548d9c[_0x80db('0x34')]||0x96;this[_0x80db('0x35')]=_0x548d9c['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x548d9c[_0x80db('0x36')]||0x96;this[_0x80db('0x37')]=_0x548d9c[_0x80db('0x37')]||0x3;this[_0x80db('0x38')]=_0x548d9c['dialDropRetryFrequency']||0x96;this[_0x80db('0x39')]=_0x548d9c['dialAbandonedMaxRetry']||0x3;this[_0x80db('0x3a')]=_0x548d9c[_0x80db('0x3a')]||0x96;this['dialMachineMaxRetry']=_0x548d9c[_0x80db('0x3b')]||0x3;this[_0x80db('0x3c')]=_0x548d9c[_0x80db('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x548d9c[_0x80db('0x3d')]||0x3;this[_0x80db('0x3e')]=_0x548d9c[_0x80db('0x3e')]||0x96;this[_0x80db('0x3f')]=_0x548d9c[_0x80db('0x3f')]||0x4;this[_0x80db('0x40')]=_0x548d9c[_0x80db('0x40')]?_0x548d9c[_0x80db('0x40')]:undefined;this[_0x80db('0x41')]=_0x548d9c[_0x80db('0x41')]?_0x548d9c[_0x80db('0x41')]:undefined;this[_0x80db('0x42')]=_0x548d9c[_0x80db('0x42')]||undefined;this['Interval']=_0x548d9c[_0x80db('0x43')]?_0x548d9c[_0x80db('0x43')]:undefined;this[_0x80db('0x44')]=_0x548d9c[_0x80db('0x44')]||_0x80db('0x45');this[_0x80db('0x46')]=_0x548d9c[_0x80db('0x46')]||undefined;this[_0x80db('0x47')]=_0x548d9c[_0x80db('0x47')]||undefined;this[_0x80db('0x48')]=strategy[_0x548d9c[_0x80db('0x48')]]||_0x80db('0x8');this['queueStatusComplete']=!![];this[_0x80db('0x49')]=_0x548d9c[_0x80db('0x49')]||![];this[_0x80db('0x4a')]=_0x548d9c[_0x80db('0x4a')];this[_0x80db('0x4b')]=_0x548d9c[_0x80db('0x4b')];this[_0x80db('0x4c')]=_0x548d9c[_0x80db('0x4c')];this[_0x80db('0x4d')]=_0x548d9c[_0x80db('0x4d')];this[_0x80db('0x4e')]=_0x548d9c[_0x80db('0x4e')];this[_0x80db('0x4f')]=_0x548d9c['dialAMDBetweenWordsSilence'];this[_0x80db('0x50')]=_0x548d9c[_0x80db('0x50')];this['dialAMDSilenceThreshold']=_0x548d9c[_0x80db('0x51')];this[_0x80db('0x52')]=_0x548d9c[_0x80db('0x52')];this['outboundRejectCallsDay']=0x0;this[_0x80db('0x53')]=0x0;this['timeout']=_0x548d9c[_0x80db('0x54')];this['outboundAnswerCallsDay']=0x0;this[_0x80db('0x55')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x80db('0x56')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x80db('0x57')]=0x0;this[_0x80db('0x58')]=0x0;this[_0x80db('0x59')]=0x0;this[_0x80db('0x5a')]=0x0;this[_0x80db('0x5b')]=0x0;this[_0x80db('0x5c')]=0x0;this[_0x80db('0x5d')]=0x0;this[_0x80db('0x5e')]=0x0;this[_0x80db('0x5f')]=undefined;this[_0x80db('0x60')]=undefined;this[_0x80db('0x61')]=undefined;this[_0x80db('0x62')]=1.05;this[_0x80db('0x63')]=0x0;this[_0x80db('0x64')]=0x0;this[_0x80db('0x65')]=0x0;this[_0x80db('0x66')]=0x0;this[_0x80db('0x67')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x80db('0x68')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x80db('0x69')]=_0x548d9c[_0x80db('0x6a')]||0x14;this[_0x80db('0x6b')]=_0x548d9c['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x80db('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this[_0x80db('0x6d')]=0x0;this[_0x80db('0x6e')]=0x0;this[_0x80db('0x6f')]=_0x548d9c[_0x80db('0x6f')]||0x1e;this[_0x80db('0x70')]=_0x548d9c[_0x80db('0x70')]||![];this[_0x80db('0x71')]=_0x548d9c[_0x80db('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x548d9c[_0x80db('0x72')]||![];this[_0x80db('0x73')]=_0x548d9c[_0x80db('0x73')]||![];this[_0x80db('0xb')]=monitorFormat[_0x548d9c[_0x80db('0xb')]]?monitorFormat[_0x548d9c[_0x80db('0xb')]]:undefined;this[_0x80db('0x74')]=_0x548d9c['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x548d9c['mandatoryDispositionPause']?_0x548d9c[_0x80db('0x75')]:undefined;}module[_0x80db('0x76')]=VoiceQueue; \ No newline at end of file +var _0x325b=['outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','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','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay'];(function(_0xc82d1a,_0x145c50){var _0x32fad2=function(_0x232731){while(--_0x232731){_0xc82d1a['push'](_0xc82d1a['shift']());}};_0x32fad2(++_0x145c50);}(_0x325b,0x11f));var _0xb325=function(_0x6040a,_0x22c596){_0x6040a=_0x6040a-0x0;var _0x1fd1cf=_0x325b[_0x6040a];return _0x1fd1cf;};'use strict';var statusDesc=[_0xb325('0x0'),'not_inuse','inuse','busy',_0xb325('0x1'),_0xb325('0x2'),_0xb325('0x3'),_0xb325('0x4'),_0xb325('0x5')];var monitorFormat={'wav':_0xb325('0x6'),'wav49':_0xb325('0x7'),'gsm':_0xb325('0x8')};var strategy={'rrmemory':_0xb325('0x9'),'roundrobin':_0xb325('0xa')};function VoiceQueue(_0x4110b0){this['id']=_0x4110b0['id']||0x0;this[_0xb325('0xb')]=_0x4110b0[_0xb325('0xb')]||'';this[_0xb325('0xc')]=_0x4110b0['monitor_format']||'';this[_0xb325('0xd')]=_0x4110b0[_0xb325('0xd')]||_0xb325('0xe');this[_0xb325('0xf')]=0x0;this[_0xb325('0x10')]=0x0;this[_0xb325('0x11')]=0x0;this[_0xb325('0x12')]=0x0;this[_0xb325('0x13')]=0x0;this['sumHoldTime']=0x0;this[_0xb325('0x14')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xb325('0x15')]=0x0;this[_0xb325('0x16')]=0x0;this[_0xb325('0x17')]=_0x4110b0[_0xb325('0x17')]||![];this['acwTimeout']=_0x4110b0[_0xb325('0x18')]||0xa;this['autopause']=_0x4110b0[_0xb325('0x19')]||'no';this[_0xb325('0x1a')]=!![];this[_0xb325('0x1b')]='';this[_0xb325('0x1c')]=0x0;this[_0xb325('0x1d')]=0x0;this['dialTimezone']=_0x4110b0['dialTimezone']||null;this['dialGlobalInterval']=_0x4110b0[_0xb325('0x1e')]?_0x4110b0[_0xb325('0x1e')]:null;this[_0xb325('0x1f')]=_0x4110b0[_0xb325('0x1f')];this[_0xb325('0x20')]=_0x4110b0[_0xb325('0x20')]||_0xb325('0x21');this[_0xb325('0x22')]=_0x4110b0['dialLimitChannel']||0x0;this[_0xb325('0x23')]=_0x4110b0[_0xb325('0x23')]||0x0;this[_0xb325('0x24')]=_0x4110b0[_0xb325('0x24')]||0x1;this[_0xb325('0x25')]=_0x4110b0[_0xb325('0x25')]||_0xb325('0x26');this[_0xb325('0x27')]=_0x4110b0[_0xb325('0x27')]||0.03;this[_0xb325('0x28')]=_0x4110b0[_0xb325('0x28')]||0x258;this[_0xb325('0x29')]=_0x4110b0[_0xb325('0x29')]||'anonymous';this[_0xb325('0x2a')]=_0x4110b0[_0xb325('0x2a')]||'anonymous';this[_0xb325('0x2b')]=_0x4110b0['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x4110b0['dialQueueOptions']||_0xb325('0x2c');this[_0xb325('0x2d')]=_0x4110b0[_0xb325('0x2d')]||0x3;this[_0xb325('0x2e')]=_0x4110b0[_0xb325('0x2e')]||undefined;this[_0xb325('0x2f')]=_0x4110b0[_0xb325('0x2f')]||0x3;this['dialCongestionRetryFrequency']=_0x4110b0['dialCongestionRetryFrequency']||0x96;this[_0xb325('0x30')]=_0x4110b0['dialBusyMaxRetry']||0x3;this[_0xb325('0x31')]=_0x4110b0['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x4110b0[_0xb325('0x32')]||0x3;this['dialNoAnswerRetryFrequency']=_0x4110b0[_0xb325('0x33')]||0x96;this[_0xb325('0x34')]=_0x4110b0[_0xb325('0x34')]||0x3;this[_0xb325('0x35')]=_0x4110b0[_0xb325('0x35')]||0x96;this[_0xb325('0x36')]=_0x4110b0[_0xb325('0x36')]||0x3;this[_0xb325('0x37')]=_0x4110b0[_0xb325('0x37')]||0x96;this['dialAbandonedMaxRetry']=_0x4110b0[_0xb325('0x38')]||0x3;this[_0xb325('0x39')]=_0x4110b0['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x4110b0[_0xb325('0x3a')]||0x3;this[_0xb325('0x3b')]=_0x4110b0[_0xb325('0x3b')]||0x96;this['dialAgentRejectMaxRetry']=_0x4110b0[_0xb325('0x3c')]||0x3;this[_0xb325('0x3d')]=_0x4110b0[_0xb325('0x3d')]||0x96;this[_0xb325('0x3e')]=_0x4110b0[_0xb325('0x3e')]||0x4;this[_0xb325('0x3f')]=_0x4110b0[_0xb325('0x3f')]?_0x4110b0['Trunk']:undefined;this[_0xb325('0x40')]=_0x4110b0[_0xb325('0x40')]?_0x4110b0['TrunkBackup']:undefined;this[_0xb325('0x41')]=_0x4110b0[_0xb325('0x41')]||undefined;this['Interval']=_0x4110b0[_0xb325('0x42')]?_0x4110b0['Interval']:undefined;this[_0xb325('0x43')]=_0x4110b0[_0xb325('0x43')]||_0xb325('0x44');this[_0xb325('0x45')]=_0x4110b0[_0xb325('0x45')]||undefined;this[_0xb325('0x46')]=_0x4110b0[_0xb325('0x46')]||undefined;this['strategy']=strategy[_0x4110b0[_0xb325('0x47')]]||'rrmemory';this[_0xb325('0x48')]=!![];this[_0xb325('0x49')]=_0x4110b0['dialAMDActive']||![];this[_0xb325('0x4a')]=_0x4110b0[_0xb325('0x4a')];this['dialAMDGreeting']=_0x4110b0[_0xb325('0x4b')];this[_0xb325('0x4c')]=_0x4110b0['dialAMDAfterGreetingSilence'];this[_0xb325('0x4d')]=_0x4110b0[_0xb325('0x4d')];this['dialAMDMinWordLength']=_0x4110b0['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x4110b0[_0xb325('0x4e')];this[_0xb325('0x4f')]=_0x4110b0['dialAMDMaximumNumberOfWords'];this[_0xb325('0x50')]=_0x4110b0[_0xb325('0x50')];this[_0xb325('0x51')]=_0x4110b0[_0xb325('0x51')];this['outboundRejectCallsDay']=0x0;this[_0xb325('0x52')]=0x0;this[_0xb325('0x53')]=_0x4110b0[_0xb325('0x53')];this[_0xb325('0x54')]=0x0;this[_0xb325('0x55')]=0x0;this[_0xb325('0x56')]=0x0;this[_0xb325('0x57')]=0x0;this[_0xb325('0x58')]=0x0;this[_0xb325('0x59')]=0x0;this[_0xb325('0x5a')]=0x0;this[_0xb325('0x5b')]=0x0;this[_0xb325('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xb325('0x5d')]=0x0;this[_0xb325('0x5e')]=0x0;this[_0xb325('0x5f')]=0x0;this[_0xb325('0x60')]=0x0;this[_0xb325('0x61')]=undefined;this['startPredictive']=undefined;this[_0xb325('0x62')]=undefined;this[_0xb325('0x63')]=1.05;this[_0xb325('0x64')]=0x0;this[_0xb325('0x65')]=0x0;this[_0xb325('0x66')]=0x0;this[_0xb325('0x67')]=0x0;this[_0xb325('0x68')]=0x0;this[_0xb325('0x69')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xb325('0x6a')]=0x0;this[_0xb325('0x6b')]=_0x4110b0['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xb325('0x6c')]=_0x4110b0[_0xb325('0x6d')]||0xa;this[_0xb325('0x6e')]=0x0;this[_0xb325('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xb325('0x70')]=0x0;this[_0xb325('0x71')]=0x0;this[_0xb325('0x72')]=0x0;this[_0xb325('0x73')]=0x0;this[_0xb325('0x74')]=_0x4110b0[_0xb325('0x74')]||0x1e;this['dialRecallInQueue']=_0x4110b0[_0xb325('0x75')]||![];this[_0xb325('0x76')]=_0x4110b0['dialQueueProject2']||undefined;this[_0xb325('0x77')]=_0x4110b0['dialAgiAfterHangupClient']||![];this[_0xb325('0x78')]=_0x4110b0[_0xb325('0x78')]||![];this[_0xb325('0xc')]=monitorFormat[_0x4110b0[_0xb325('0xc')]]?monitorFormat[_0x4110b0[_0xb325('0xc')]]:undefined;this[_0xb325('0x79')]=_0x4110b0[_0xb325('0x79')]||![];this['mandatoryDispositionPause']=_0x4110b0[_0xb325('0x7a')]?_0x4110b0['mandatoryDispositionPause']:undefined;}module[_0xb325('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 4e10aee..8303023 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 _0x2f27=['name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x12077e,_0x6150fd){var _0x40db84=function(_0xeea91){while(--_0xeea91){_0x12077e['push'](_0x12077e['shift']());}};_0x40db84(++_0x6150fd);}(_0x2f27,0x168));var _0x72f2=function(_0x170297,_0x11654b){_0x170297=_0x170297-0x0;var _0x221b93=_0x2f27[_0x170297];return _0x221b93;};'use strict';function VtigerAccount(_0x4e28b7){this['id']=_0x4e28b7['id']||0x0;this[_0x72f2('0x0')]=_0x4e28b7[_0x72f2('0x0')]||'';this[_0x72f2('0x1')]=_0x4e28b7['username']||'';this[_0x72f2('0x2')]=_0x4e28b7[_0x72f2('0x2')]||'';this[_0x72f2('0x3')]=_0x4e28b7[_0x72f2('0x3')]||'';this[_0x72f2('0x4')]=_0x4e28b7[_0x72f2('0x4')]||'';this[_0x72f2('0x5')]=_0x4e28b7[_0x72f2('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x02be=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0x02be,0xfe));var _0xe02b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x02be[_0x2d7f0e];return _0x110b07;};'use strict';function VtigerAccount(_0x15abad){this['id']=_0x15abad['id']||0x0;this[_0xe02b('0x0')]=_0x15abad[_0xe02b('0x0')]||'';this['username']=_0x15abad[_0xe02b('0x1')]||'';this['accessKey']=_0x15abad[_0xe02b('0x2')]||'';this[_0xe02b('0x3')]=_0x15abad['remoteUri']||'';this[_0xe02b('0x4')]=_0x15abad[_0xe02b('0x4')]||'';this['Configurations']=_0x15abad[_0xe02b('0x5')]||{};}module[_0xe02b('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 ffdbc5d..da49cf5 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 _0x2ef3=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x424f9a,_0xd6d092){var _0x52d6bc=function(_0x102595){while(--_0x102595){_0x424f9a['push'](_0x424f9a['shift']());}};_0x52d6bc(++_0xd6d092);}(_0x2ef3,0xba));var _0x32ef=function(_0x15c0f1,_0x227d39){_0x15c0f1=_0x15c0f1-0x0;var _0x57d464=_0x2ef3[_0x15c0f1];return _0x57d464;};'use strict';function ZendeskAccount(_0x4d5ac8){this['id']=_0x4d5ac8['id']||0x0;this[_0x32ef('0x0')]=_0x4d5ac8[_0x32ef('0x0')]||'';this[_0x32ef('0x1')]=_0x4d5ac8[_0x32ef('0x1')]||'';this[_0x32ef('0x2')]=_0x4d5ac8['password']||'';this[_0x32ef('0x3')]=_0x4d5ac8[_0x32ef('0x3')]||'';this['remoteUri']=_0x4d5ac8[_0x32ef('0x4')]||'';this[_0x32ef('0x5')]=_0x4d5ac8['authType']||'';this['type']=_0x4d5ac8[_0x32ef('0x6')]||_0x32ef('0x7');this[_0x32ef('0x8')]=_0x4d5ac8[_0x32ef('0x8')]||'';this[_0x32ef('0x9')]=_0x4d5ac8[_0x32ef('0x9')]||{};}module[_0x32ef('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x249565,_0x2a026a){_0x249565=_0x249565-0x0;var _0x43dee8=_0x0b0e[_0x249565];return _0x43dee8;};'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 d0a4653..a138a1e 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 _0x4f3c=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x489354,_0x57c4c0){var _0x174f92=function(_0x478c51){while(--_0x478c51){_0x489354['push'](_0x489354['shift']());}};_0x174f92(++_0x57c4c0);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x574dea,_0x4cf209){_0x574dea=_0x574dea-0x0;var _0x3ed444=_0x4f3c[_0x574dea];return _0x3ed444;};'use strict';function ZohoAccount(_0x574379){this['id']=_0x574379['id']||0x0;this[_0xc4f3('0x0')]=_0x574379[_0xc4f3('0x0')]||'';this[_0xc4f3('0x1')]=_0x574379[_0xc4f3('0x1')]||'';this[_0xc4f3('0x2')]=_0x574379[_0xc4f3('0x2')]||'';this[_0xc4f3('0x3')]=_0x574379[_0xc4f3('0x3')]||'';this[_0xc4f3('0x4')]=_0x574379['clientId']||'';this['clientSecret']=_0x574379[_0xc4f3('0x5')]||'';this[_0xc4f3('0x6')]=_0x574379[_0xc4f3('0x6')]||'';this[_0xc4f3('0x7')]=_0x574379[_0xc4f3('0x7')]||'';this[_0xc4f3('0x8')]=_0x574379[_0xc4f3('0x8')]||'';this[_0xc4f3('0x9')]=_0x574379[_0xc4f3('0x9')]||{};}module[_0xc4f3('0xa')]=ZohoAccount; \ No newline at end of file +var _0xbbbc=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x2ba5b7,_0x5d9343){_0x2ba5b7=_0x2ba5b7-0x0;var _0x1f334e=_0xbbbc[_0x2ba5b7];return _0x1f334e;};'use strict';function ZohoAccount(_0x372caa){this['id']=_0x372caa['id']||0x0;this[_0xcbbb('0x0')]=_0x372caa[_0xcbbb('0x0')]||'';this[_0xcbbb('0x1')]=_0x372caa[_0xcbbb('0x1')]||'';this[_0xcbbb('0x2')]=_0x372caa[_0xcbbb('0x2')]||'';this['zone']=_0x372caa[_0xcbbb('0x3')]||'';this[_0xcbbb('0x4')]=_0x372caa[_0xcbbb('0x4')]||'';this[_0xcbbb('0x5')]=_0x372caa[_0xcbbb('0x5')]||'';this['serverUrl']=_0x372caa[_0xcbbb('0x6')]||'';this[_0xcbbb('0x7')]=_0x372caa[_0xcbbb('0x7')]||'';this[_0xcbbb('0x8')]=_0x372caa[_0xcbbb('0x8')]||'';this[_0xcbbb('0x9')]=_0x372caa[_0xcbbb('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 ee67414..e225098 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 _0x64bf=['util','lodash','isNil','string','uniqueid','idContact','queue','type','campaigntype','Agent','channelAgent','membername','format','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number'];(function(_0x2db065,_0x3da6a1){var _0x2b364f=function(_0x10b50c){while(--_0x10b50c){_0x2db065['push'](_0x2db065['shift']());}};_0x2b364f(++_0x3da6a1);}(_0x64bf,0x1ae));var _0xf64b=function(_0x5bfb0c,_0x3f4480){_0x5bfb0c=_0x5bfb0c-0x0;var _0xfb8bbf=_0x64bf[_0x5bfb0c];return _0xfb8bbf;};'use strict';var util=require(_0xf64b('0x0'));var _=require(_0xf64b('0x1'));var moment=require('moment');function checkNameSurname(_0x1ac1bd,_0x1799e2,_0x3177fb){var _0xa83fc2='';if(!_[_0xf64b('0x2')](_0x1799e2)&&_0xf64b('0x3')===typeof _0x1799e2){_0xa83fc2+=_0x1799e2;}if(!_[_0xf64b('0x2')](_0x3177fb)&&'string'===typeof _0x3177fb){_0xa83fc2+='\x20'+_0x3177fb;}if(_0xa83fc2!==''){return _0xa83fc2;}return _0x1ac1bd;}function Action(_0x1fff20,_0x36235f,_0x438a2a,_0x2caab3,_0x2e1bcf){this[_0xf64b('0x4')]=_0x438a2a||undefined;this[_0xf64b('0x5')]=_0x1fff20['id'];this[_0xf64b('0x6')]=_0x36235f['name'];this[_0xf64b('0x7')]=_0x36235f[_0xf64b('0x7')];this[_0xf64b('0x8')]=_0xf64b('0x6');this['dialAnswer']=![];this['membername']=_[_0xf64b('0x2')](_0x1fff20[_0xf64b('0x9')])?undefined:_0x1fff20[_0xf64b('0x9')]['name'];this[_0xf64b('0xa')]=this[_0xf64b('0xb')]?util[_0xf64b('0xc')]('SIP/%s',this[_0xf64b('0xb')]):_0x2caab3||undefined;this[_0xf64b('0xd')]=checkNameSurname(_0x1fff20['Contact'][_0xf64b('0xe')],_0x1fff20[_0xf64b('0xf')][_0xf64b('0x10')],_0x1fff20['Contact'][_0xf64b('0x11')]);this['active']=_0x1fff20[_0xf64b('0x12')]||![];this[_0xf64b('0x13')]=_0x1fff20[_0xf64b('0xf')]['phone'];this[_0xf64b('0x14')]=_0x1fff20[_0xf64b('0x14')];this[_0xf64b('0x15')]=_0x1fff20[_0xf64b('0x15')]||0x0;this[_0xf64b('0x16')]=_0x1fff20[_0xf64b('0x16')]||0x0;this[_0xf64b('0x17')]=_0x1fff20['countnoanswerretry']||0x0;this[_0xf64b('0x18')]=(_0x1fff20['countbusyretry']||0x0)+(_0x1fff20[_0xf64b('0x16')]||0x0)+(_0x1fff20[_0xf64b('0x17')]||0x0)+(_0x1fff20[_0xf64b('0x19')]||0x0)+(_0x1fff20[_0xf64b('0x1a')]||0x0)+(_0x1fff20['countabandonedretry']||0x0)+(_0x1fff20[_0xf64b('0x1b')]||0x0)+(_0x1fff20[_0xf64b('0x1c')]||0x0);this[_0xf64b('0x19')]=_0x1fff20[_0xf64b('0x19')]||0x0;this[_0xf64b('0x1a')]=_0x1fff20[_0xf64b('0x1a')]||0x0;this[_0xf64b('0x1d')]=_0x1fff20[_0xf64b('0x1d')]||0x0;this[_0xf64b('0x1b')]=_0x1fff20['countmachineretry']||0x0;this[_0xf64b('0x1c')]=_0x1fff20[_0xf64b('0x1c')]||0x0;this['callback']=_0x1fff20[_0xf64b('0x1e')];this[_0xf64b('0x1f')]=_0x1fff20[_0xf64b('0x1f')];this[_0xf64b('0x20')]=_0x1fff20[_0xf64b('0x20')];this[_0xf64b('0x21')]=_0x1fff20[_0xf64b('0x21')];this[_0xf64b('0x22')]=_0x1fff20[_0xf64b('0x22')];this['ListId']=_0x1fff20[_0xf64b('0x23')];this[_0xf64b('0x24')]=_[_0xf64b('0x2')](_0x1fff20[_0xf64b('0x9')])?_0x1fff20['UserId']:_0x1fff20[_0xf64b('0x9')]['id'];this[_0xf64b('0x25')]=_0x1fff20[_0xf64b('0x25')];this[_0xf64b('0x26')]='';this['originatecalleridname']='';}Action[_0xf64b('0x27')][_0xf64b('0x28')]=function(){return util[_0xf64b('0xc')](_0xf64b('0x29'),this[_0xf64b('0xd')],this[_0xf64b('0x2a')]);};module['exports']=Action; \ No newline at end of file +var _0x2de9=['countnosuchnumberretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry'];(function(_0x1b7d4c,_0x3ef822){var _0xaf9bc6=function(_0xb3ea5d){while(--_0xb3ea5d){_0x1b7d4c['push'](_0x1b7d4c['shift']());}};_0xaf9bc6(++_0x3ef822);}(_0x2de9,0x1c7));var _0x92de=function(_0x22eb92,_0x4740d0){_0x22eb92=_0x22eb92-0x0;var _0x5917e7=_0x2de9[_0x22eb92];return _0x5917e7;};'use strict';var util=require('util');var _=require(_0x92de('0x0'));var moment=require(_0x92de('0x1'));function checkNameSurname(_0x1ca732,_0x162738,_0x3017f9){var _0x2c9326='';if(!_['isNil'](_0x162738)&&'string'===typeof _0x162738){_0x2c9326+=_0x162738;}if(!_[_0x92de('0x2')](_0x3017f9)&&_0x92de('0x3')===typeof _0x3017f9){_0x2c9326+='\x20'+_0x3017f9;}if(_0x2c9326!==''){return _0x2c9326;}return _0x1ca732;}function Action(_0x3be062,_0x2b3a2a,_0x2b5606,_0x5c81ca,_0x132382){this[_0x92de('0x4')]=_0x2b5606||undefined;this[_0x92de('0x5')]=_0x3be062['id'];this[_0x92de('0x6')]=_0x2b3a2a[_0x92de('0x7')];this[_0x92de('0x8')]=_0x2b3a2a[_0x92de('0x8')];this[_0x92de('0x9')]=_0x92de('0x6');this['dialAnswer']=![];this[_0x92de('0xa')]=_[_0x92de('0x2')](_0x3be062[_0x92de('0xb')])?undefined:_0x3be062[_0x92de('0xb')]['name'];this[_0x92de('0xc')]=this[_0x92de('0xa')]?util[_0x92de('0xd')](_0x92de('0xe'),this[_0x92de('0xa')]):_0x5c81ca||undefined;this['calleridname']=checkNameSurname(_0x3be062['Contact'][_0x92de('0xf')],_0x3be062[_0x92de('0x10')][_0x92de('0x11')],_0x3be062[_0x92de('0x10')][_0x92de('0x12')]);this[_0x92de('0x13')]=_0x3be062[_0x92de('0x13')]||![];this[_0x92de('0x14')]=_0x3be062[_0x92de('0x10')][_0x92de('0xf')];this[_0x92de('0x15')]=_0x3be062[_0x92de('0x15')];this['countbusyretry']=_0x3be062[_0x92de('0x16')]||0x0;this[_0x92de('0x17')]=_0x3be062[_0x92de('0x17')]||0x0;this['countnoanswerretry']=_0x3be062[_0x92de('0x18')]||0x0;this[_0x92de('0x19')]=(_0x3be062[_0x92de('0x16')]||0x0)+(_0x3be062[_0x92de('0x17')]||0x0)+(_0x3be062['countnoanswerretry']||0x0)+(_0x3be062['countnosuchnumberretry']||0x0)+(_0x3be062[_0x92de('0x1a')]||0x0)+(_0x3be062['countabandonedretry']||0x0)+(_0x3be062[_0x92de('0x1b')]||0x0)+(_0x3be062[_0x92de('0x1c')]||0x0);this[_0x92de('0x1d')]=_0x3be062[_0x92de('0x1d')]||0x0;this['countdropretry']=_0x3be062['countdropretry']||0x0;this[_0x92de('0x1e')]=_0x3be062['countabandonedretry']||0x0;this[_0x92de('0x1b')]=_0x3be062['countmachineretry']||0x0;this[_0x92de('0x1c')]=_0x3be062[_0x92de('0x1c')]||0x0;this[_0x92de('0x1f')]=_0x3be062[_0x92de('0x1f')];this[_0x92de('0x20')]=_0x3be062[_0x92de('0x20')];this['callbackat']=_0x3be062[_0x92de('0x21')];this[_0x92de('0x22')]=_0x3be062[_0x92de('0x22')];this[_0x92de('0x23')]=_0x3be062['ContactId'];this[_0x92de('0x24')]=_0x3be062[_0x92de('0x24')];this[_0x92de('0x25')]=_['isNil'](_0x3be062[_0x92de('0xb')])?_0x3be062['UserId']:_0x3be062[_0x92de('0xb')]['id'];this[_0x92de('0x26')]=_0x3be062[_0x92de('0x26')];this[_0x92de('0x27')]='';this['originatecalleridname']='';}Action[_0x92de('0x28')][_0x92de('0x29')]=function(){return util[_0x92de('0xd')](_0x92de('0x2a'),this[_0x92de('0x2b')],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 80e52c2..522b898 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 _0x27f3=['rescheduleContact','scheduledAt','countnosuchnumberretry','unlockAgent','activeContact','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','acw','custom:agentConnectPreview','custom:agentcomplete','complete','total','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','execCall','SIP/%s/%s%s','trim','substring','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','info','voice:queue:%s','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','booked','hasOwnProperty','recallMe','clearZombieChannel','enqueue','isNil','Queue','queue','originated:\x20','dialAnswer','pick','UserId','ListId','Action','status','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','catch','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','setMessage','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry'];(function(_0x2923b8,_0x1dba92){var _0x25659a=function(_0x12c8d8){while(--_0x12c8d8){_0x2923b8['push'](_0x2923b8['shift']());}};_0x25659a(++_0x1dba92);}(_0x27f3,0x1e9));var _0x327f=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x27f3[_0xdbe2de];return _0x2facd7;};'use strict';var util=require(_0x327f('0x0'));var _=require(_0x327f('0x1'));var BPromise=require('bluebird');var uuid=require(_0x327f('0x2'));var moment=require(_0x327f('0x3'));var md5=require('md5');var Redis=require(_0x327f('0x4'));var config=require('../../../config/environment');var logger=require(_0x327f('0x5'))(_0x327f('0x6'));var loggerAction=require(_0x327f('0x5'))(_0x327f('0x7'));var ami=require(_0x327f('0x8'));var rpcDb=require(_0x327f('0x9'));var Action=require(_0x327f('0xa'));var ut=require(_0x327f('0xb'));config['redis']=_[_0x327f('0xc')](config[_0x327f('0xd')],{'host':_0x327f('0xe'),'port':0x18eb});var io=require(_0x327f('0xf'))(new Redis(config[_0x327f('0xd')]));var Sequence=function(){};Sequence[_0x327f('0x10')]['enqueue']=function(_0x25295d){this[_0x327f('0x11')]=this[_0x327f('0x11')]?this[_0x327f('0x11')][_0x327f('0x12')](_0x25295d):_0x25295d();};function Preview(_0xb2fd19){this[_0x327f('0x13')]=new Sequence();this[_0x327f('0x14')]=_0xb2fd19['voiceQueues'];this[_0x327f('0x15')]=_0xb2fd19[_0x327f('0x15')];this[_0x327f('0x16')]={};this[_0x327f('0x17')]=_0xb2fd19[_0x327f('0x17')];this[_0x327f('0x18')]=0x0;ami['on'](_0x327f('0x19'),this[_0x327f('0x1a')]['bind'](this));ami['on']('hangup',this[_0x327f('0x1b')][_0x327f('0x1c')](this));ami['on'](_0x327f('0x1d'),this[_0x327f('0x1e')][_0x327f('0x1c')](this));ami['on'](_0x327f('0x1f'),this[_0x327f('0x20')][_0x327f('0x1c')](this));ami['on'](_0x327f('0x21'),this[_0x327f('0x22')][_0x327f('0x1c')](this));ami['on']('varset',this[_0x327f('0x23')][_0x327f('0x1c')](this));ami['on'](_0x327f('0x24'),this[_0x327f('0x25')][_0x327f('0x1c')](this));ami['on'](_0x327f('0x26'),this[_0x327f('0x27')][_0x327f('0x1c')](this));this[_0x327f('0x28')](this[_0x327f('0x14')]);}function emit(_0x57b1e5,_0x2c18e8,_0x445586){io['to'](_0x57b1e5)['emit'](_0x2c18e8,_0x445586);}function emitCampaignPreview(_0xacf0e3){if(_0xacf0e3[_0x327f('0x29')]===_0x327f('0x2a')){var _0x4742ab={'id':_0xacf0e3['id'],'name':_0xacf0e3[_0x327f('0x2b')],'strategy':_0xacf0e3['strategy'],'answered':_0xacf0e3[_0x327f('0x2c')],'available':_0xacf0e3[_0x327f('0x2d')],'loggedIn':_0xacf0e3[_0x327f('0x2e')],'pTalking':_0xacf0e3[_0x327f('0x2f')],'sumBillable':_0xacf0e3[_0x327f('0x30')],'sumDuration':_0xacf0e3[_0x327f('0x31')],'sumHoldTime':_0xacf0e3[_0x327f('0x32')]||0x0,'talking':_0xacf0e3[_0x327f('0x33')],'total':_0xacf0e3['total'],'type':_0xacf0e3[_0x327f('0x29')],'unmanaged':_0xacf0e3[_0x327f('0x34')],'abandoned':_0xacf0e3[_0x327f('0x35')],'waiting':_0xacf0e3[_0x327f('0x36')],'loggedInDb':_0xacf0e3[_0x327f('0x37')],'dialActive':_0xacf0e3[_0x327f('0x38')],'dialMethod':_0xacf0e3[_0x327f('0x39')],'dialOriginateCallerIdName':_0xacf0e3['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xacf0e3[_0x327f('0x3a')],'dialOriginateTimeout':_0xacf0e3[_0x327f('0x3b')],'dialPrefix':_0xacf0e3[_0x327f('0x3c')],'outboundAnswerAgiCallsDay':_0xacf0e3['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0xacf0e3[_0x327f('0x3d')],'outboundBlacklistCallsDay':_0xacf0e3[_0x327f('0x3e')],'outboundBusyCallsDay':_0xacf0e3[_0x327f('0x3f')],'outboundCongestionCallsDay':_0xacf0e3[_0x327f('0x40')],'outboundDropCallsDayACS':_0xacf0e3[_0x327f('0x41')],'outboundDropCallsDayCallersExit':_0xacf0e3[_0x327f('0x42')],'outboundDropCallsDayTimeout':_0xacf0e3[_0x327f('0x43')],'outboundNoAnswerCallsDay':_0xacf0e3['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xacf0e3['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0xacf0e3[_0x327f('0x44')],'outboundReCallsDay':_0xacf0e3['outboundReCallsDay'],'outboundRejectCallsDay':_0xacf0e3[_0x327f('0x45')],'outboundUnknownCallsDay':_0xacf0e3['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0xacf0e3[_0x327f('0x46')],'predictiveIntervalAnsweredCalls':_0xacf0e3['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xacf0e3['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0xacf0e3[_0x327f('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0xacf0e3[_0x327f('0x48')],'predictiveIntervalDroppedCallsTimeout':_0xacf0e3[_0x327f('0x49')],'predictiveIntervalErlangCalls':_0xacf0e3[_0x327f('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0xacf0e3['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xacf0e3[_0x327f('0x4b')],'predictiveIntervalMultiplicativeFactor':_0xacf0e3[_0x327f('0x4c')],'predictiveIntervalPauses':_0xacf0e3[_0x327f('0x4d')],'predictiveIntervalAvailable':_0xacf0e3[_0x327f('0x4e')],'predictiveIntervalTotalCalls':_0xacf0e3[_0x327f('0x4f')],'message':_0xacf0e3[_0x327f('0x50')],'originated':_0xacf0e3[_0x327f('0x51')],'erlangCalls':_0xacf0e3['erlangCalls'],'erlangCallToSecond':_0xacf0e3[_0x327f('0x52')],'erlangAbandonmentRate':_0xacf0e3[_0x327f('0x53')],'erlangBusyFactor':_0xacf0e3[_0x327f('0x54')],'startPredictive':_0xacf0e3[_0x327f('0x55')],'startProgressive':_0xacf0e3[_0x327f('0x56')]};if(_0xacf0e3['Trunk']){_0x4742ab[_0x327f('0x57')]={'id':_0xacf0e3[_0x327f('0x57')]['id'],'name':_0xacf0e3['Trunk']['name'],'active':_0xacf0e3[_0x327f('0x57')][_0x327f('0x58')],'callerid':_0xacf0e3[_0x327f('0x57')][_0x327f('0x59')]};}if(_0xacf0e3[_0x327f('0x5a')]){_0x4742ab['Interval']={'id':_0xacf0e3[_0x327f('0x5a')]['id'],'name':_0xacf0e3['Interval'][_0x327f('0x2b')]};}var _0x396e54=md5(JSON[_0x327f('0x5b')](_0x4742ab));if(_0xacf0e3[_0x327f('0x5c')]!==_0x396e54){_0xacf0e3[_0x327f('0x5c')]=_0x396e54;emit(util[_0x327f('0x5d')]('voice:queue:%s',_0x4742ab[_0x327f('0x2b')]),'voice_queue:save',_0x4742ab);}}}function emitVoiceQueueChannelRemove(_0x5bcebd){logger[_0x327f('0x5e')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x5bcebd));emit(util[_0x327f('0x5d')](_0x327f('0x5f'),_0x5bcebd[_0x327f('0x2b')]),'voice_queue_channel:remove',_0x5bcebd);this[_0x327f('0x60')](_0x327f('0x61'),_0x5bcebd);}function notSendMessagesQueue(_0x1dcce4){if(_0x1dcce4[_0x327f('0x62')]){if(_0x1dcce4[_0x327f('0x51')]===0x0&&_0x1dcce4[_0x327f('0x2f')]===0x0){_0x1dcce4['sendMessageOneNotActive']=![];_0x1dcce4[_0x327f('0x2d')]=0x0;_0x1dcce4[_0x327f('0x63')]=0x0;_0x1dcce4[_0x327f('0x50')]='NOT_ACTIVE';ut[_0x327f('0x64')](_0x327f('0x65'),_0x1dcce4['name']+'\x20is\x20not\x20active');}else{_0x1dcce4['message']=_0x327f('0x66');ut[_0x327f('0x64')](_0x327f('0x65'),_0x1dcce4[_0x327f('0x2b')]+_0x327f('0x67'));}emitCampaignPreview(_0x1dcce4);}}Preview['prototype'][_0x327f('0x28')]=function(){var _0x315093=this;setInterval(function(){_0x315093[_0x327f('0x68')]();},0x7cf);};Preview[_0x327f('0x10')]['syncCampaigns']=function(){var _0x59a4f8=this[_0x327f('0x14')];this[_0x327f('0x18')]+=0x1;for(var _0x5d26d8 in _0x59a4f8){if(_0x59a4f8['hasOwnProperty'](_0x5d26d8)&&(_0x59a4f8[_0x5d26d8][_0x327f('0x39')]==='preview'||_0x59a4f8[_0x5d26d8][_0x327f('0x39')]===_0x327f('0x69'))&&_0x59a4f8[_0x5d26d8]['type']===_0x327f('0x2a')){if(this[_0x327f('0x18')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x59a4f8[_0x327f('0x6a')](_0x5d26d8)&&_0x59a4f8[_0x5d26d8][_0x327f('0x39')]===_0x327f('0x6')&&_0x59a4f8[_0x5d26d8][_0x327f('0x29')]==='outbound'){if(_0x59a4f8[_0x5d26d8][_0x327f('0x38')]){this['setMessage'](_0x59a4f8[_0x5d26d8]);this[_0x327f('0x6b')](_0x59a4f8[_0x5d26d8]);}else{notSendMessagesQueue(_0x59a4f8[_0x5d26d8]);}}}};Preview[_0x327f('0x10')][_0x327f('0x6c')]=function(_0x355216){var _0x13f261=this;this['sequence'][_0x327f('0x6d')](function(){if(!_[_0x327f('0x6e')](_0x13f261[_0x327f('0x16')][_0x355216])){loggerAction[_0x327f('0x5e')]('[clearZombieChannels][talking]',_0x355216,_0x327f('0x6f'),_0x13f261[_0x327f('0x16')][_0x355216][_0x327f('0x70')],_0x327f('0x71'),JSON[_0x327f('0x5b')](_0x13f261['campaignsPreview'][_0x13f261['actions'][_0x355216][_0x327f('0x70')]][_0x327f('0x51')]),'pTalking:\x20',JSON[_0x327f('0x5b')](_0x13f261[_0x327f('0x14')][_0x13f261[_0x327f('0x16')][_0x355216]['queue']][_0x327f('0x2f')]),JSON[_0x327f('0x5b')](_0x13f261[_0x327f('0x16')][_0x355216][_0x327f('0x72')]),JSON[_0x327f('0x5b')](_[_0x327f('0x73')](_0x13f261[_0x327f('0x16')][_0x355216],['contactId',_0x327f('0x74'),'VoiceQueueId',_0x327f('0x75')])));return ami[_0x327f('0x76')]({'action':_0x327f('0x77'),'channel':_0x13f261[_0x327f('0x16')][_0x355216]['channel']})['catch'](function(_0x403e13){if(_0x403e13[_0x327f('0x50')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x13f261['actions'][_0x355216]){ut['updateOriginated'](_0x13f261[_0x327f('0x14')][_0x13f261[_0x327f('0x16')][_0x355216]['queue']],_0x327f('0x78'));if(_0x13f261['actions'][_0x355216][_0x327f('0x72')]===!![]){ut[_0x327f('0x79')](_0x13f261[_0x327f('0x14')][_0x13f261[_0x327f('0x16')][_0x355216][_0x327f('0x70')]],_0x327f('0x78'));ut[_0x327f('0x7a')]('[Dialer][checkChannel][pTalking][Preview]'+_0x355216,_0x13f261['actions'][_0x355216][_0x327f('0x70')]);}ut['loggerError'](_0x327f('0x7b')+_0x355216,_0x13f261[_0x327f('0x16')][_0x355216]['queue']);delete _0x13f261[_0x327f('0x16')][_0x355216];}},0x2328);}});}});};Preview[_0x327f('0x10')]['clearZombieChannels']=function(){var _0x5f3784=this;loggerAction[_0x327f('0x5e')]('[action]',_['size'](this[_0x327f('0x16')]));for(var _0x4e7616 in this[_0x327f('0x16')]){if(_0x5f3784[_0x327f('0x16')][_0x327f('0x6a')](_0x4e7616)){_0x5f3784[_0x327f('0x6c')](_0x4e7616);}}};Preview[_0x327f('0x10')][_0x327f('0x6b')]=function(_0x4d0abd){var _0x16a375=this;rpcDb[_0x327f('0x7c')](_0x4d0abd['id'],ut['agentReadyId'](this[_0x327f('0x17')]))['then'](function(_0x21d855){if(!_[_0x327f('0x6e')](_0x21d855)){for(var _0x234d2d=0x0;_0x234d2d<_0x21d855[_0x327f('0x7d')];_0x234d2d+=0x1){if(ut[_0x327f('0x7e')](_0x21d855[_0x234d2d][_0x327f('0x7f')])<_0x4d0abd[_0x327f('0x80')]*0x3c){if(_0x21d855[_0x234d2d][_0x327f('0x81')]&&!_0x21d855[_0x234d2d][_0x327f('0x81')][_0x327f('0x82')]){_0x16a375[_0x327f('0x83')](_0x21d855[_0x234d2d]['id'])[_0x327f('0x84')](ut['logger2']('[RecallMe]'))[_0x327f('0x85')](ut[_0x327f('0x86')](_0x327f('0x87')));}else{rpcDb[_0x327f('0x88')](_0x21d855[_0x234d2d]['id']);}}else{var _0x511b11=new Action(_0x21d855[_0x234d2d],_0x4d0abd);_0x511b11[_0x327f('0x89')]=moment()[_0x327f('0x5d')](_0x327f('0x8a'));_0x4d0abd['outboundReCallsDay']+=0x1;ut[_0x327f('0x8b')](_0x511b11,0x17,'RecallInQueue');if(_0x4d0abd[_0x327f('0x8c')]){rpcDb[_0x327f('0x8d')](ut[_0x327f('0x8e')](_0x21d855[_0x234d2d]));rpcDb[_0x327f('0x8f')](_0x511b11,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x327f('0x8b')](_0x511b11,0x16,_0x327f('0x90'));rpcDb[_0x327f('0x8f')](_0x511b11,_0x327f('0x91'));rpcDb[_0x327f('0x92')](_0x511b11,'[HistoryRecallClose]');}}}}})['catch'](ut[_0x327f('0x86')]('[getContactRecallMe]'));};Preview[_0x327f('0x10')][_0x327f('0x93')]=function(_0x5079d1){_0x5079d1[_0x327f('0x62')]=!![];if(ut['IsNotLoggedIn'](_0x5079d1[_0x327f('0x2e')])){_0x5079d1['message']=_0x327f('0x94');}else if(!ut[_0x327f('0x95')](_0x5079d1[_0x327f('0x38')])){_0x5079d1[_0x327f('0x50')]=_0x327f('0x96');}else if(!this[_0x327f('0x97')](_0x5079d1[_0x327f('0x57')])){if(!this['isTrunkReachable'](_0x5079d1[_0x327f('0x98')])){_0x5079d1[_0x327f('0x50')]=_0x327f('0x99');}else{_0x5079d1['message']='ACTIVE';}}else{_0x5079d1[_0x327f('0x50')]=_0x327f('0x9a');}emitCampaignPreview(_0x5079d1);};Preview['prototype'][_0x327f('0x9b')]=function(_0x1eeddd,_0x22d6ce,_0x1f084f){var _0x49756c=this;var _0x23e5bc=this[_0x327f('0x16')][_0x22d6ce];var _0x182a70=this['campaignsPreview'][_0x23e5bc['queue']];var _0x552753;if(_0x182a70){switch(_0x1f084f){case'1':_0x182a70[_0x327f('0x9c')]+=0x1;_0x23e5bc['countnosuchnumberretry']+=0x1;_0x23e5bc[_0x327f('0x9d')]=ut[_0x327f('0x9e')](_0x23e5bc);ut[_0x327f('0x8b')](_0x23e5bc,0x0,_0x327f('0x9f'));ami[_0x327f('0x60')](_0x327f('0xa0'),ut[_0x327f('0xa1')](_0x23e5bc,_0x327f('0xa2')));rpcDb[_0x327f('0x8f')](_0x23e5bc,_0x327f('0xa3'));if(ut[_0x327f('0x9e')](_0x23e5bc)>=_0x182a70[_0x327f('0xa4')]){_0x552753=ut[_0x327f('0xa5')](_0x23e5bc,0xf,_0x327f('0xa6'));rpcDb[_0x327f('0x92')](_0x552753,_0x327f('0xa7'));}else{if(_0x23e5bc['countnosuchnumberretry']>=_0x182a70[_0x327f('0xa8')]){rpcDb['createCustomerFinal'](_0x23e5bc,_0x327f('0xa7'));}else{rpcDb[_0x327f('0xa9')](ut[_0x327f('0xaa')](_0x23e5bc,_0x327f('0xab'),_0x182a70['dialNoSuchNumberRetryFrequency']),_0x23e5bc[_0x327f('0xac')],_0x23e5bc[_0x327f('0xad')]);}}delete this['actions'][_0x1eeddd[_0x327f('0xae')]];break;case _0x327f('0xaf'):var _0x21b01b=moment()[_0x327f('0x5d')](_0x327f('0x8a'));_0x23e5bc['responsetime']=_0x21b01b;_0x23e5bc[_0x327f('0xb0')]=_0x21b01b;_0x23e5bc['dialAnswer']=!![];_0x182a70[_0x327f('0x2f')]+=0x1;logger[_0x327f('0x5e')](_0x327f('0xb1'),_0x23e5bc[_0x327f('0xb2')],_0x327f('0xb3'),_0x182a70[_0x327f('0x2b')],_0x327f('0xb4'),_0x182a70['pTalking']);ami[_0x327f('0x60')]('custom:agentconnect',ut['buildObj'](_0x23e5bc,'connect',this[_0x327f('0x14')][_0x23e5bc[_0x327f('0x70')]]));if(_0x182a70[_0x327f('0xb5')]){ami[_0x327f('0x60')](_0x327f('0xb6'),ut['buildAcw'](_0x23e5bc));}break;case'16':ami['emit'](_0x327f('0xb7'),ut[_0x327f('0xa1')](_0x23e5bc,_0x327f('0xb8'),this[_0x327f('0x14')][_0x23e5bc[_0x327f('0x70')]]));emitVoiceQueueChannelRemove(ut[_0x327f('0xa1')](_0x23e5bc,'complete'));_0x182a70[_0x327f('0x3d')]+=0x1;_0x182a70[_0x327f('0xb9')]+=0x1;_0x182a70['answered']+=0x1;ut['decrementTalkink'](_0x182a70,'[16]');_0x23e5bc['countglobal']=ut[_0x327f('0x9e')](_0x23e5bc);ut[_0x327f('0x8b')](_0x23e5bc,0x4,'Answer');rpcDb[_0x327f('0x8f')](_0x23e5bc,_0x327f('0xba'));rpcDb['createCustomerFinal'](_0x23e5bc,_0x327f('0xbb'));rpcDb[_0x327f('0xbc')](_0x23e5bc);_0x182a70[_0x327f('0x31')]+=_0x23e5bc[_0x327f('0xbd')];_0x182a70['sumBillable']+=_0x23e5bc['talktime'];logger[_0x327f('0x5e')](_0x327f('0xbe'),_0x23e5bc[_0x327f('0xb2')],_0x327f('0xb3'),_0x182a70['name'],_0x327f('0xb4'),_0x182a70['pTalking']);delete this[_0x327f('0x16')][_0x1eeddd['linkedid']];break;case _0x327f('0xbf'):_0x182a70[_0x327f('0x3f')]+=0x1;_0x23e5bc[_0x327f('0xc0')]+=0x1;_0x23e5bc[_0x327f('0x9d')]=ut[_0x327f('0x9e')](_0x23e5bc);ut[_0x327f('0x8b')](_0x23e5bc,0x5,_0x327f('0xc1'));ami['emit']('custom:agentbusy',ut['buildObj'](_0x23e5bc,'busy'));rpcDb[_0x327f('0x8f')](_0x23e5bc,_0x327f('0xc2'));if(ut['totalGlobal'](_0x23e5bc)>=_0x182a70[_0x327f('0xa4')]){_0x552753=ut[_0x327f('0xa5')](_0x23e5bc,0xf,'Global');rpcDb[_0x327f('0x92')](_0x552753,_0x327f('0xc3'));}else{if(_0x23e5bc[_0x327f('0xc0')]>=_0x182a70[_0x327f('0xc4')]){rpcDb[_0x327f('0x92')](_0x23e5bc,_0x327f('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0x327f('0xaa')](_0x23e5bc,_0x327f('0xc0'),_0x182a70[_0x327f('0xc5')]),_0x23e5bc[_0x327f('0xac')],_0x23e5bc[_0x327f('0xad')]);}}break;case _0x327f('0xc6'):_0x182a70[_0x327f('0xc7')]+=0x1;_0x23e5bc[_0x327f('0xc8')]+=0x1;_0x23e5bc[_0x327f('0x9d')]=ut[_0x327f('0x9e')](_0x23e5bc);ut[_0x327f('0x8b')](_0x23e5bc,0x3,'NoAnswer');ami[_0x327f('0x60')](_0x327f('0xc9'),ut['buildObj'](_0x23e5bc,_0x327f('0xca')));rpcDb[_0x327f('0x8f')](_0x23e5bc,_0x327f('0xcb'));if(ut[_0x327f('0x9e')](_0x23e5bc)>=_0x182a70[_0x327f('0xa4')]){_0x552753=ut['cloneAction'](_0x23e5bc,0xf,_0x327f('0xa6'));rpcDb['createCustomerFinal'](_0x552753,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x23e5bc['countnoanswerretry']>=_0x182a70['dialNoAnswerMaxRetry']){rpcDb[_0x327f('0x92')](_0x23e5bc,_0x327f('0xcb'));}else{rpcDb['rescheduleContact'](ut[_0x327f('0xaa')](_0x23e5bc,_0x327f('0xc8'),_0x182a70[_0x327f('0xcc')]),_0x23e5bc[_0x327f('0xac')],_0x23e5bc['activeContact']);}}break;case _0x327f('0xcd'):_0x182a70[_0x327f('0x40')]+=0x1;_0x23e5bc[_0x327f('0xce')]+=0x1;_0x23e5bc[_0x327f('0x9d')]=ut[_0x327f('0x9e')](_0x23e5bc);ut[_0x327f('0x8b')](_0x23e5bc,0x8,_0x327f('0xcf'));ami[_0x327f('0x60')](_0x327f('0xd0'),ut[_0x327f('0xa1')](_0x23e5bc,'congestion'));rpcDb[_0x327f('0x8f')](_0x23e5bc,_0x327f('0xd1'));if(ut[_0x327f('0x9e')](_0x23e5bc)>=_0x182a70[_0x327f('0xa4')]){_0x552753=ut[_0x327f('0xa5')](_0x23e5bc,0xf,_0x327f('0xa6'));rpcDb['createCustomerFinal'](_0x552753,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x23e5bc[_0x327f('0xce')]>=_0x182a70[_0x327f('0xd2')]){rpcDb['createCustomerFinal'](_0x23e5bc,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x327f('0xa9')](ut[_0x327f('0xaa')](_0x23e5bc,'countcongestionretry',_0x182a70[_0x327f('0xc5')]),_0x23e5bc[_0x327f('0xac')],_0x23e5bc[_0x327f('0xad')]);}}break;case'CANCEL':_0x182a70['outboundRejectCallsDay']+=0x1;_0x23e5bc['countagentrejectretry']+=0x1;_0x23e5bc[_0x327f('0x9d')]=ut['totalGlobal'](_0x23e5bc);ut[_0x327f('0x8b')](_0x23e5bc,0x14,'AgentReject');ami['emit']('custom:agentreject',ut[_0x327f('0xa1')](_0x23e5bc,'agentreject'));rpcDb[_0x327f('0x8f')](_0x23e5bc,_0x327f('0xd3'));if(ut[_0x327f('0x9e')](_0x23e5bc)>=_0x182a70[_0x327f('0xa4')]){_0x552753=ut['cloneAction'](_0x23e5bc,0x14,_0x327f('0xd4'));rpcDb[_0x327f('0x92')](_0x552753,_0x327f('0xd5'));}else{if(_0x23e5bc[_0x327f('0xd6')]>=_0x182a70[_0x327f('0xd7')]){rpcDb[_0x327f('0x92')](_0x23e5bc,_0x327f('0xd5'));}else{rpcDb[_0x327f('0xa9')](ut[_0x327f('0xaa')](_0x23e5bc,_0x327f('0xd6'),_0x182a70[_0x327f('0xd8')]),_0x23e5bc[_0x327f('0xac')],_0x23e5bc['activeContact']);}}break;case _0x327f('0xd9'):_0x182a70['outboundAbandonedCallsDay']+=0x1;_0x23e5bc['countabandonedretry']+=0x1;_0x23e5bc[_0x327f('0x9d')]=ut[_0x327f('0x9e')](_0x23e5bc);ut[_0x327f('0x8b')](_0x23e5bc,0xb,_0x327f('0xda'));rpcDb[_0x327f('0x8f')](_0x23e5bc,_0x327f('0xdb'));if(ut[_0x327f('0x9e')](_0x23e5bc)>=_0x182a70[_0x327f('0xa4')]){_0x552753=ut['cloneAction'](_0x23e5bc,0xf,'Global');rpcDb['createCustomerFinal'](_0x552753,_0x327f('0xdb'));}else{if(_0x23e5bc[_0x327f('0xdc')]>=_0x182a70[_0x327f('0xdd')]){rpcDb[_0x327f('0x92')](_0x23e5bc,_0x327f('0xdb'));}else{rpcDb[_0x327f('0xa9')](ut[_0x327f('0xaa')](_0x23e5bc,_0x327f('0xde'),_0x182a70[_0x327f('0xdf')]),_0x23e5bc[_0x327f('0xac')],_0x23e5bc[_0x327f('0xad')]);}}break;default:if(_0x23e5bc['dialAnswer']){ut[_0x327f('0x79')](_0x182a70,_0x327f('0xe0'));ut['loggerError'](_0x327f('0xe1')+_0x182a70[_0x327f('0x2b')],_0x1eeddd);}_0x182a70['outboundUnknownCallsDay']+=0x1;_0x23e5bc[_0x327f('0x9d')]=ut[_0x327f('0x9e')](_0x23e5bc);ut[_0x327f('0x8b')](_0x23e5bc,0xc,_0x1eeddd[_0x327f('0xe2')]||_0x1eeddd[_0x327f('0xe3')]);rpcDb['createCustomerHistory'](_0x23e5bc,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x23e5bc)>=_0x182a70[_0x327f('0xa4')]){_0x552753=ut[_0x327f('0xa5')](_0x23e5bc,0xf,_0x327f('0xa6'));rpcDb[_0x327f('0x92')](_0x552753,_0x327f('0xe4'));}else{rpcDb['createCustomerFinal'](_0x23e5bc,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x327f('0x16')][_0x1eeddd[_0x327f('0xae')]];}if(!(_0x23e5bc['dialAnswer']&&_0x1f084f==='16')){ut['updateOriginated'](_0x182a70,_0x327f('0xe5'));logger[_0x327f('0x5e')](_0x327f('0xe6'),_0x23e5bc[_0x327f('0xb2')],_0x327f('0xb3'),_0x182a70[_0x327f('0x2b')],'originated:\x20',_0x182a70[_0x327f('0x51')]);}if(_0x1f084f!==_0x327f('0xaf')){delete this['actions'][_0x1eeddd[_0x327f('0xae')]];delete this['actions'][_0x1eeddd[_0x327f('0xe7')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x1b196e,_0x34dfc6,_0xb928a2){if(_[_0x327f('0xe8')](_0x34dfc6)&&_0x327f('0xe9')!==typeof _0x34dfc6){return;}if(_[_0x327f('0xe8')](_0xb928a2)&&'object'!==typeof _0xb928a2){return;}switch(_0xb928a2[_0x327f('0xea')]){case'0':ut[_0x327f('0xeb')](_0x1b196e,0x0,'NoSuchNumber');rpcDb[_0x327f('0xec')](_0x1b196e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x327f('0xeb')](_0x1b196e,0x3,_0x327f('0xed'));rpcDb[_0x327f('0xec')](_0x1b196e,_0x327f('0xee'));break;case'5':ut[_0x327f('0xeb')](_0x1b196e,0x5,_0x327f('0xc1'));rpcDb['createAgentHistory'](_0x1b196e,_0x327f('0xef'));break;case'8':ut[_0x327f('0xeb')](_0x1b196e,0x8,_0x327f('0xcf'));rpcDb[_0x327f('0xec')](_0x1b196e,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x327f('0xeb')](_0x1b196e,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x1b196e,_0x327f('0xf0'));break;default:ut['logAgent'](_0x1b196e,0xc,_0xb928a2['reason']);rpcDb[_0x327f('0xec')](_0x1b196e,_0x327f('0xf1'));}ut['updateOriginated'](_0x34dfc6,_0x327f('0xf2'));logger['info'](_0x327f('0xf3'),_0x1b196e[_0x327f('0xb2')],_0x327f('0xb3'),_0x34dfc6[_0x327f('0x2b')],_0x327f('0x71'),_0x34dfc6['originated']);delete this[_0x327f('0x16')][_0x1b196e[_0x327f('0xb2')]];};Preview['prototype']['checkInBlack']=function(_0x35fede,_0xfe0968,_0x36fca6,_0x349a79,_0x4bc976){var _0xa3e624=this;return new BPromise(function(_0x79af30,_0x21efe6){if(_['isNil'](_0xfe0968)||_['isNil'](_0xfe0968[_0x327f('0xf4')])||_[_0x327f('0x6e')](_0xfe0968[_0x327f('0xf4')][_0x327f('0xf5')])||_[_0x327f('0x6e')](_0xfe0968[_0x327f('0xf6')])){_0x21efe6(ut['message'](_0x327f('0xf7'),_0x349a79,_0x4bc976));return;}var _0x5bcaa3=uuid['v4']();var _0x4f9ffd=_0xa3e624[_0x327f('0x14')][_0xfe0968[_0x327f('0x6f')][_0x327f('0x2b')]];var _0x20550d=_0x36fca6?_0xa3e624[_0x327f('0x17')][_0x36fca6]['id']:undefined;_0xa3e624['actions'][_0x5bcaa3]=new Action(_0xfe0968,_0x4f9ffd,_0x5bcaa3,_0x36fca6,_0x20550d);var _0x224cdc=_0xa3e624['actions'][_0x5bcaa3];_0x224cdc[_0x327f('0xac')]=_0x349a79;_0x224cdc[_0x327f('0xad')]=_0x4bc976;_0x224cdc[_0x327f('0xf8')]=_0x36fca6;if(_[_0x327f('0xf9')](_0x35fede)){_0xa3e624['execCall'](_0x224cdc,_0x4f9ffd,_0xfe0968,_0x36fca6)[_0x327f('0x84')](function(_0x17a985){logger[_0x327f('0x5e')](_0x327f('0xfa'),_0x327f('0xfb')+_0x224cdc[_0x327f('0x70')]+_0x327f('0xfc')+_0x224cdc[_0x327f('0xfd')],JSON[_0x327f('0x5b')](_0x17a985));ami[_0x327f('0x60')]('custom:agentcalled',ut[_0x327f('0xa1')](_0x224cdc,_0x327f('0xfe'),_0xa3e624[_0x327f('0x14')][_0x224cdc['queue']]));_0x79af30(ut['message'](_0x327f('0xff')));})[_0x327f('0x85')](function(_0x2ce0ff){ut[_0x327f('0x64')](_0x327f('0x100'),_0x2ce0ff);_0x21efe6(ut[_0x327f('0x50')](_0x327f('0x101'),_0x349a79,_0x4bc976));});}else{_0x4f9ffd['outboundBlacklistCallsDay']+=0x1;ut[_0x327f('0x102')](_0x224cdc);rpcDb[_0x327f('0x103')](_0x224cdc,'[Blacklist][error]');delete _0xa3e624[_0x327f('0x16')][_0x5bcaa3];_0x21efe6(ut[_0x327f('0x50')](_0x327f('0x104'),_0x349a79,_0x4bc976));}});};Preview[_0x327f('0x10')][_0x327f('0x97')]=function(_0xecffac){return!_[_0x327f('0x6e')](_0xecffac)&&!_['isNil'](_0xecffac[_0x327f('0x2b')])&&!_[_0x327f('0x6e')](_0xecffac[_0x327f('0x58')])&&_0xecffac['active']&&!_[_0x327f('0x6e')](this[_0x327f('0x15')][util[_0x327f('0x5d')]('SIP/%s',_0xecffac['name'])])&&!_[_0x327f('0x6e')](this[_0x327f('0x15')][util['format']('SIP/%s',_0xecffac[_0x327f('0x2b')])][_0x327f('0x77')])&&(this['trunks'][util[_0x327f('0x5d')](_0x327f('0x105'),_0xecffac['name'])][_0x327f('0x77')]===_0x327f('0x106')||this[_0x327f('0x15')][util[_0x327f('0x5d')]('SIP/%s',_0xecffac[_0x327f('0x2b')])][_0x327f('0x77')]===_0x327f('0x107'));};Preview['prototype']['run']=function(_0x452f3b,_0x328563){var _0xe5f821=this;return new BPromise(function(_0x1fa537,_0x426c1c){_0xe5f821[_0x327f('0x108')](_0x452f3b,_0x328563)[_0x327f('0x84')](function(_0x41025a){_0x1fa537(_['pick'](_0x41025a,['message']));})[_0x327f('0x85')](function(_0x1a6b6f){if(_0x1a6b6f['unlock']){rpcDb[_0x327f('0x109')](_0x452f3b);}if(_0x1a6b6f[_0x327f('0x58')]){rpcDb[_0x327f('0x88')](_0x452f3b);}_0x426c1c(_['pick'](_0x1a6b6f,[_0x327f('0x50')]));});});};Preview[_0x327f('0x10')][_0x327f('0x108')]=function(_0xc2124a,_0x41ae56){var _0x56bd88=this;return new BPromise(function(_0x39ba6e,_0x263328){var _0x13ffeb,_0x55e845;rpcDb[_0x327f('0x10a')](_0xc2124a)[_0x327f('0x84')](function(_0x53610b){if(!_[_0x327f('0x6e')](_0x53610b[0x0])){_0x55e845=_0x53610b[0x0][_0x327f('0x10b')]?![]:!![];_0x13ffeb=_0x53610b[0x0][_0x327f('0x10b')]?!![]:![];_0x13ffeb=_0x41ae56?!![]:_0x13ffeb;}var _0x4ce9f7=_0x56bd88[_0x327f('0x10c')](_0x53610b);if(_0x4ce9f7['isValid']){rpcDb[_0x327f('0x10d')](_[_0x327f('0x73')](_0x53610b[0x0],[_0x327f('0xf6'),_0x327f('0x10e')]))[_0x327f('0x84')](function(_0x16040c){_0x56bd88['checkInBlack'](_0x16040c,_0x53610b[0x0],_0x41ae56,_0x55e845,_0x13ffeb)[_0x327f('0x84')](function(_0x34295f){_0x39ba6e(_0x34295f);})[_0x327f('0x85')](function(_0x58785d){_0x263328(_0x58785d);});})[_0x327f('0x85')](function(_0x30edc5){ut['logger'](_0x327f('0x10f'),_0x30edc5);_0x263328(ut['message'](_0x327f('0x110'),_0x55e845,_0x13ffeb));});}else{_0x263328(ut['message'](_0x4ce9f7['message'],_0x55e845,_0x13ffeb));}})[_0x327f('0x85')](function(_0x494e25){ut[_0x327f('0x64')](_0x327f('0x111'),_0x494e25);_0x263328(ut[_0x327f('0x50')](_0x327f('0x110'),![],!![]));});});};Preview[_0x327f('0x10')]['validateContact']=function(_0x3085a2){if(_['isNil'](_0x3085a2)||_[_0x327f('0xf9')](_0x3085a2)||!_[_0x327f('0x6e')](_0x3085a2[0x0][_0x327f('0x81')])&&_[_0x327f('0x6e')](_0x3085a2[0x0][_0x327f('0x81')][_0x327f('0x2b')])){ut[_0x327f('0x64')]('[Preview][validateContact][Empty\x20Contact]',_0x3085a2);return{'isValid':![],'message':_0x327f('0x112')};}var _0x3842af=this[_0x327f('0x14')][_0x3085a2[0x0]['Queue'][_0x327f('0x2b')]];_0x3842af[_0x327f('0x50')]=_0x327f('0x9a');if(_[_0x327f('0x6e')](_0x3842af)){ut[_0x327f('0x64')](_0x327f('0x113'),_0x3842af);return{'isValid':![],'message':_0x327f('0x114')};}if(!this[_0x327f('0x97')](_0x3842af[_0x327f('0x57')])){ut[_0x327f('0x64')](_0x327f('0x115'),'campaign\x20Name:\x20'+_0x3842af[_0x327f('0x2b')]+_0x327f('0x116'));if(!this[_0x327f('0x97')](_0x3842af[_0x327f('0x98')])){ut[_0x327f('0x64')](_0x327f('0x115'),_0x3842af[_0x327f('0x2b')]+_0x327f('0x117'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x327f('0x95')](_0x3842af['dialActive'])){ut[_0x327f('0x64')]('[Preview][validateContact][Campaign\x20Active]',_0x3842af[_0x327f('0x2b')]+_0x327f('0x118'));return{'isValid':![],'message':_0x327f('0x119')+_0x3842af[_0x327f('0x2b')]+_0x327f('0x118')};}return{'isValid':!![],'message':_0x327f('0x11a')};};Preview['prototype'][_0x327f('0x11b')]=function(_0x4960c5,_0xf8c75e,_0x4dc47e,_0x7d64fd){var _0x21e061=this;return new BPromise(function(_0x30cfa5,_0x508e4b){var _0x166039=_0x4960c5[_0x327f('0xb2')];var _0x5ab86a=_0x21e061[_0x327f('0x97')](_0xf8c75e[_0x327f('0x57')])?util['format'](_0x327f('0x11c'),_0xf8c75e[_0x327f('0x57')]['name'],_[_0x327f('0x6e')](_0xf8c75e[_0x327f('0x3c')])?'':_0xf8c75e[_0x327f('0x3c')][_0x327f('0x11d')]()||'',_0xf8c75e['dialCutDigit']>0x0?_0x4dc47e[_0x327f('0xf4')][_0x327f('0xf5')][_0x327f('0x11e')](_0xf8c75e[_0x327f('0x11f')]):_0x4dc47e[_0x327f('0xf4')][_0x327f('0xf5')]):util[_0x327f('0x5d')](_0x327f('0x11c'),_[_0x327f('0x6e')](_0xf8c75e[_0x327f('0x98')])?_0xf8c75e['Trunk']['name']:_0xf8c75e[_0x327f('0x98')][_0x327f('0x2b')],_[_0x327f('0x6e')](_0xf8c75e[_0x327f('0x3c')])?'':_0xf8c75e['dialPrefix'][_0x327f('0x11d')]()||'',_0xf8c75e[_0x327f('0x11f')]>0x0?_0x4dc47e[_0x327f('0xf4')][_0x327f('0xf5')][_0x327f('0x11e')](_0xf8c75e[_0x327f('0x11f')]):_0x4dc47e[_0x327f('0xf4')][_0x327f('0xf5')]);var _0x4f0112=_0x21e061['isTrunkReachable'](_0xf8c75e[_0x327f('0x57')])?ut[_0x327f('0x120')](_0xf8c75e['Trunk']['callerid'],_0xf8c75e[_0x327f('0x121')],_0xf8c75e[_0x327f('0x122')]>0x0?ut[_0x327f('0x123')](_0xf8c75e[_0x327f('0x3a')],_0xf8c75e['dialRandomLastDigitCallerIdNumber']):_0xf8c75e['dialOriginateCallerIdNumber']):ut[_0x327f('0x120')](_[_0x327f('0x6e')](_0xf8c75e[_0x327f('0x98')])?_0xf8c75e[_0x327f('0x57')][_0x327f('0x59')]:_0xf8c75e['TrunkBackup']['callerid'],_0xf8c75e[_0x327f('0x121')],_0xf8c75e[_0x327f('0x122')]>0x0?ut[_0x327f('0x123')](_0xf8c75e[_0x327f('0x3a')],_0xf8c75e['dialRandomLastDigitCallerIdNumber']):_0xf8c75e['dialOriginateCallerIdNumber']);if(_0x4f0112){_0x4960c5[_0x327f('0x124')]=ut[_0x327f('0x125')](_0x4f0112);_0x4960c5[_0x327f('0x126')]=ut[_0x327f('0x127')](_0x4f0112);}var _0x112e54=ut[_0x327f('0x128')](_0xf8c75e,_0x4dc47e,_0x5ab86a,_0x4f0112,_0x166039,_0x4960c5);_['merge'](_0x4960c5,ut[_0x327f('0x129')](_0x112e54));_0x4960c5[_0x327f('0x89')]=moment()[_0x327f('0x5d')](_0x327f('0x8a'));ami[_0x327f('0x76')](ut[_0x327f('0x12a')](_0x4960c5,_0xf8c75e,_0x112e54,_0x4960c5[_0x327f('0xad')],_0x7d64fd))['then'](function(_0x23ebd4){_0xf8c75e[_0x327f('0x51')]+=0x1;logger[_0x327f('0x5e')](_0x327f('0x12b'),_0x166039,_0x327f('0xb3'),_0xf8c75e[_0x327f('0x2b')],_0x327f('0x71'),_0xf8c75e[_0x327f('0x51')]);_0x30cfa5(_0x23ebd4);})[_0x327f('0x85')](function(_0x59d268){ut[_0x327f('0xeb')](_0x4960c5,0xe,'OriginateError');rpcDb[_0x327f('0xec')](_0x4960c5,_0x327f('0x12c'));_0x508e4b(_0x59d268);});});};Preview['prototype'][_0x327f('0x22')]=function(_0x2dc55e){if(this['actions'][_0x2dc55e[_0x327f('0xae')]]){this[_0x327f('0x16')][_0x2dc55e[_0x327f('0xae')]][_0x327f('0x12d')]=_0x2dc55e[_0x327f('0x12d')];}};Preview[_0x327f('0x10')]['syncOriginateResponse']=function(_0x2dcbc0){var _0x4bc3f1=this;var _0x3d9fe9=this[_0x327f('0x16')][_0x2dcbc0[_0x327f('0x12e')]];if(_0x3d9fe9){if(_0x3d9fe9['lookAgent']&&this[_0x327f('0x17')][_0x3d9fe9['lookAgent']]){ut[_0x327f('0x12f')](_0x3d9fe9,this[_0x327f('0x17')][_0x3d9fe9[_0x327f('0xf8')]][_0x327f('0x2b')],this['agents'][_0x3d9fe9['lookAgent']]['id']);}var _0x227e3b=_[_0x327f('0x130')](_0x3d9fe9);_0x227e3b[_0x327f('0x131')]=moment()[_0x327f('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x27cc39=_0x4bc3f1[_0x327f('0x14')][_0x3d9fe9[_0x327f('0x70')]];if(ut[_0x327f('0x132')](_0x2dcbc0[_0x327f('0x133')])){if(_0x3d9fe9[_0x327f('0xac')]){rpcDb['unlockContact'](_0x3d9fe9[_0x327f('0xfd')]);}if(_0x3d9fe9[_0x327f('0xad')]){rpcDb[_0x327f('0x88')](_0x3d9fe9['idContact']);}ami[_0x327f('0x60')](_0x327f('0x134'),ut[_0x327f('0xa1')](_0x3d9fe9,_0x327f('0x135'),this[_0x327f('0x14')][_0x3d9fe9[_0x327f('0x70')]]));this[_0x327f('0x136')](_0x227e3b,_0x27cc39,_0x2dcbc0);}else{_0x3d9fe9[_0x327f('0x89')]=moment()[_0x327f('0x5d')](_0x327f('0x8a'));ut[_0x327f('0xeb')](_0x227e3b,0x4,'Answer');rpcDb['createAgentHistory'](_0x227e3b,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x327f('0x10')][_0x327f('0x1b')]=function(_0x2e2e47){var _0x58c266=this;var _0x552ddf=this[_0x327f('0x16')][_0x2e2e47[_0x327f('0xae')]];var _0x5a5df7;if(_0x552ddf){_0x5a5df7=this[_0x327f('0x14')][_0x552ddf[_0x327f('0x70')]];logger[_0x327f('0x5e')](_0x327f('0x137'),_0x2e2e47['linkedid'],'\x20Queue',_0x5a5df7[_0x327f('0x2b')],_0x327f('0xb4'),_0x5a5df7[_0x327f('0x2f')]);}if(this['actions'][_0x2e2e47['linkedid']]&&_0x2e2e47[_0x327f('0xae')]!==_0x2e2e47[_0x327f('0xb2')]){if(_0x2e2e47[_0x327f('0x138')]==='16'&&this[_0x327f('0x16')][_0x2e2e47['linkedid']]['dialAnswer']){this[_0x327f('0x9b')](_0x2e2e47,_0x2e2e47['linkedid'],_0x2e2e47[_0x327f('0x138')]);}else if(this[_0x327f('0x16')][_0x2e2e47[_0x327f('0xae')]][_0x327f('0x72')]){logger['info']('[syncHangup][talking][cause]',_0x2e2e47[_0x327f('0xae')],_0x2e2e47[_0x327f('0x138')],'\x20Queue',_0x5a5df7[_0x327f('0x2b')],_0x327f('0xb4'),_0x5a5df7[_0x327f('0x2f')]);this[_0x327f('0x9b')](_0x2e2e47,_0x2e2e47['linkedid'],_0x2e2e47[_0x327f('0x138')]);}}else if(_0x552ddf&&_[_0x327f('0x6e')](_0x552ddf[_0x327f('0x139')])&&_0x5a5df7[_0x327f('0x13a')]&&_0x2e2e47[_0x327f('0xae')]===_0x2e2e47[_0x327f('0xb2')]&&_[_0x327f('0x6e')](_0x2e2e47['reason'])&&_0x2e2e47[_0x327f('0x138')]==='16'&&_0x2e2e47['channelstate']==='6'&&_['isUndefined'](_0x552ddf[_0x327f('0x13b')])){if(_0x552ddf[_0x327f('0xac')]){rpcDb['unlockContact'](_0x552ddf['idContact']);}if(_0x552ddf[_0x327f('0xad')]){rpcDb[_0x327f('0x88')](_0x552ddf[_0x327f('0xfd')]);}_0x2e2e47[_0x327f('0xea')]='22';this[_0x327f('0x136')](_0x552ddf,_0x5a5df7,_0x2e2e47);}else if(_0x552ddf&&_0x552ddf['transfer']){if(_0x2e2e47[_0x327f('0x138')]==='16'&&this[_0x327f('0x16')][_0x2e2e47[_0x327f('0xae')]][_0x327f('0x72')]){logger[_0x327f('0x5e')]('[syncHangup][talking][transfer]',_0x2e2e47[_0x327f('0xae')],_0x2e2e47['cause'],_0x327f('0xb3'),_0x5a5df7['name'],'pTalking:\x20',_0x5a5df7[_0x327f('0x2f')]);this[_0x327f('0x9b')](_0x2e2e47,_0x2e2e47[_0x327f('0xae')],_0x2e2e47[_0x327f('0x138')]);}else if(this[_0x327f('0x16')][_0x2e2e47[_0x327f('0xae')]][_0x327f('0x72')]){logger[_0x327f('0x5e')](_0x327f('0x13c'),_0x2e2e47['linkedid'],_0x2e2e47[_0x327f('0x138')],_0x327f('0xb3'),_0x5a5df7[_0x327f('0x2b')],_0x327f('0xb4'),_0x5a5df7['pTalking']);this[_0x327f('0x9b')](_0x2e2e47,_0x2e2e47[_0x327f('0xae')],_0x2e2e47[_0x327f('0x138')]);}}};Preview[_0x327f('0x10')][_0x327f('0x20')]=function(_0x54bd68){if(this[_0x327f('0x16')][_0x54bd68[_0x327f('0xe7')]]&&_0x54bd68[_0x327f('0xe7')]!==_0x54bd68[_0x327f('0x13d')]){this['callProgressDetectingCustomer'](_0x54bd68,_0x54bd68['destlinkedid'],_0x54bd68[_0x327f('0xe3')]);}};Preview[_0x327f('0x10')][_0x327f('0x1e')]=function(_0xf83800){if(this[_0x327f('0x16')][_0xf83800[_0x327f('0xae')]]&&_0xf83800[_0x327f('0xae')]!==_0xf83800[_0x327f('0xb2')]&&!this[_0x327f('0x16')][_0xf83800[_0x327f('0xae')]][_0x327f('0x72')]){if(_0xf83800[_0x327f('0x138')]==='1'){this[_0x327f('0x9b')](_0xf83800,_0xf83800[_0x327f('0xae')],_0xf83800[_0x327f('0x138')]);}}};Preview['prototype'][_0x327f('0x13e')]=function(_0x520d72,_0x2cadab,_0x34fd37){if(this[_0x327f('0x16')][_0x520d72]){if(_[_0x327f('0x6e')](this['actions'][_0x520d72][_0x327f('0x13f')])){this[_0x327f('0x16')][_0x520d72][_0x327f('0x13f')]={};}this[_0x327f('0x16')][_0x520d72][_0x327f('0x13f')][_0x2cadab]=_0x34fd37;}};Preview[_0x327f('0x10')]['syncVarSet']=function(_0x35b83d){try{if(!_[_0x327f('0x6e')](_0x35b83d)){if(ut[_0x327f('0x140')](_[_0x327f('0x141')](_0x35b83d[_0x327f('0x142')])[0x0])){this[_0x327f('0x13e')](_0x35b83d[_0x327f('0xb2')],_[_0x327f('0x141')](_0x35b83d[_0x327f('0x142')])[0x0],_0x35b83d[_0x327f('0x143')]);}}}catch(_0x1240be){logger[_0x327f('0x144')](_0x327f('0x145'),util['inspect'](_0x1240be,{'showHidden':![],'depth':null}));}};Preview[_0x327f('0x10')][_0x327f('0x25')]=function(_0x4a6222){if(_0x4a6222){if(this[_0x327f('0x16')][_0x4a6222[_0x327f('0x146')]]){this['actions'][_0x4a6222['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x327f('0x10')]['syncBlindTransfer']=function(_0x24a6cd){if(_0x24a6cd){if(this[_0x327f('0x16')][_0x24a6cd[_0x327f('0x147')]]){this[_0x327f('0x16')][_0x24a6cd[_0x327f('0x147')]]['transfer']=!![];}}};module[_0x327f('0x148')]=Preview; \ No newline at end of file +var _0xd48e=['dialBusyMaxRetry','scheduledAt','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','dialBusyRetryFrequency','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','reachable','unmonitored','run','execRun','unlock','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','phone','substring','dialCutDigit','SIP/%s/%s%s','trim','getCallerId','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','actionid','logLookAgent','clone','responsetime','isFailure','unlockContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','[syncHangup][talking][cause]','cause','statedesc','dialQueueProject','channelstate','transfer','destlinkedid','syncHangupRequest','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','socket.io-emitter','prototype','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','outbound','name','strategy','answered','available','pTalking','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','message','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','type','clearZombieChannels','setMessage','recallMe','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','isNil','getDiff','scheduledat','Agent','voicePause','then','logger2','[RecallMe]','catch','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','cloneAction','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','countnosuchnumberretry','activeContact','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','[syncHangup][talking][decrement]','linkedid','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','Global'];(function(_0x516a57,_0xcdc773){var _0x597896=function(_0x240636){while(--_0x240636){_0x516a57['push'](_0x516a57['shift']());}};_0x597896(++_0xcdc773);}(_0xd48e,0x93));var _0xed48=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xd48e[_0x2064e5];return _0x21a233;};'use strict';var util=require('util');var _=require(_0xed48('0x0'));var BPromise=require(_0xed48('0x1'));var uuid=require(_0xed48('0x2'));var moment=require(_0xed48('0x3'));var md5=require(_0xed48('0x4'));var Redis=require('ioredis');var config=require(_0xed48('0x5'));var logger=require(_0xed48('0x6'))(_0xed48('0x7'));var loggerAction=require('../../../config/logger')(_0xed48('0x8'));var ami=require(_0xed48('0x9'));var rpcDb=require(_0xed48('0xa'));var Action=require('./action');var ut=require(_0xed48('0xb'));config[_0xed48('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xed48('0xd'))(new Redis(config[_0xed48('0xc')]));var Sequence=function(){};Sequence[_0xed48('0xe')]['enqueue']=function(_0x4864aa){this[_0xed48('0xf')]=this[_0xed48('0xf')]?this[_0xed48('0xf')]['finally'](_0x4864aa):_0x4864aa();};function Preview(_0x23b0fb){this[_0xed48('0x10')]=new Sequence();this[_0xed48('0x11')]=_0x23b0fb[_0xed48('0x12')];this[_0xed48('0x13')]=_0x23b0fb[_0xed48('0x13')];this[_0xed48('0x14')]={};this[_0xed48('0x15')]=_0x23b0fb[_0xed48('0x15')];this[_0xed48('0x16')]=0x0;ami['on'](_0xed48('0x17'),this[_0xed48('0x18')][_0xed48('0x19')](this));ami['on']('hangup',this[_0xed48('0x1a')]['bind'](this));ami['on'](_0xed48('0x1b'),this['syncHangupRequest']['bind'](this));ami['on'](_0xed48('0x1c'),this[_0xed48('0x1d')][_0xed48('0x19')](this));ami['on'](_0xed48('0x1e'),this[_0xed48('0x1f')]['bind'](this));ami['on'](_0xed48('0x20'),this['syncVarSet'][_0xed48('0x19')](this));ami['on']('attendedtransfer',this[_0xed48('0x21')][_0xed48('0x19')](this));ami['on'](_0xed48('0x22'),this['syncBlindTransfer']['bind'](this));this[_0xed48('0x23')](this[_0xed48('0x11')]);}function emit(_0x225d0f,_0x54288f,_0x216906){io['to'](_0x225d0f)[_0xed48('0x24')](_0x54288f,_0x216906);}function emitCampaignPreview(_0x19d897){if(_0x19d897['type']===_0xed48('0x25')){var _0x1bda45={'id':_0x19d897['id'],'name':_0x19d897[_0xed48('0x26')],'strategy':_0x19d897[_0xed48('0x27')],'answered':_0x19d897[_0xed48('0x28')],'available':_0x19d897[_0xed48('0x29')],'loggedIn':_0x19d897['loggedIn'],'pTalking':_0x19d897[_0xed48('0x2a')],'sumBillable':_0x19d897['sumBillable'],'sumDuration':_0x19d897[_0xed48('0x2b')],'sumHoldTime':_0x19d897[_0xed48('0x2c')]||0x0,'talking':_0x19d897[_0xed48('0x2d')],'total':_0x19d897['total'],'type':_0x19d897['type'],'unmanaged':_0x19d897[_0xed48('0x2e')],'abandoned':_0x19d897[_0xed48('0x2f')],'waiting':_0x19d897[_0xed48('0x30')],'loggedInDb':_0x19d897[_0xed48('0x31')],'dialActive':_0x19d897[_0xed48('0x32')],'dialMethod':_0x19d897[_0xed48('0x33')],'dialOriginateCallerIdName':_0x19d897[_0xed48('0x34')],'dialOriginateCallerIdNumber':_0x19d897['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x19d897[_0xed48('0x35')],'dialPrefix':_0x19d897[_0xed48('0x36')],'outboundAnswerAgiCallsDay':_0x19d897[_0xed48('0x37')],'outboundAnswerCallsDay':_0x19d897['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x19d897[_0xed48('0x38')],'outboundBusyCallsDay':_0x19d897[_0xed48('0x39')],'outboundCongestionCallsDay':_0x19d897['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x19d897[_0xed48('0x3a')],'outboundDropCallsDayCallersExit':_0x19d897['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x19d897['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x19d897[_0xed48('0x3b')],'outboundNoSuchCallsDay':_0x19d897['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x19d897['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x19d897[_0xed48('0x3c')],'outboundRejectCallsDay':_0x19d897[_0xed48('0x3d')],'outboundUnknownCallsDay':_0x19d897[_0xed48('0x3e')],'outboundAbandonedCallsDay':_0x19d897['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x19d897[_0xed48('0x3f')],'predictiveIntervalAvgHoldtime':_0x19d897[_0xed48('0x40')],'predictiveIntervalAvgTalktime':_0x19d897[_0xed48('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x19d897[_0xed48('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x19d897['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x19d897['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x19d897[_0xed48('0x43')],'predictiveIntervalHitRate':_0x19d897['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x19d897[_0xed48('0x44')],'predictiveIntervalPauses':_0x19d897[_0xed48('0x45')],'predictiveIntervalAvailable':_0x19d897[_0xed48('0x46')],'predictiveIntervalTotalCalls':_0x19d897[_0xed48('0x47')],'message':_0x19d897['message'],'originated':_0x19d897['originated'],'erlangCalls':_0x19d897[_0xed48('0x48')],'erlangCallToSecond':_0x19d897[_0xed48('0x49')],'erlangAbandonmentRate':_0x19d897[_0xed48('0x4a')],'erlangBusyFactor':_0x19d897[_0xed48('0x4b')],'startPredictive':_0x19d897[_0xed48('0x4c')],'startProgressive':_0x19d897[_0xed48('0x4d')]};if(_0x19d897[_0xed48('0x4e')]){_0x1bda45[_0xed48('0x4e')]={'id':_0x19d897[_0xed48('0x4e')]['id'],'name':_0x19d897[_0xed48('0x4e')][_0xed48('0x26')],'active':_0x19d897[_0xed48('0x4e')]['active'],'callerid':_0x19d897[_0xed48('0x4e')][_0xed48('0x4f')]};}if(_0x19d897[_0xed48('0x50')]){_0x1bda45[_0xed48('0x50')]={'id':_0x19d897[_0xed48('0x50')]['id'],'name':_0x19d897[_0xed48('0x50')][_0xed48('0x26')]};}var _0x170936=md5(JSON[_0xed48('0x51')](_0x1bda45));if(_0x19d897[_0xed48('0x4')]!==_0x170936){_0x19d897['md5']=_0x170936;emit(util[_0xed48('0x52')](_0xed48('0x53'),_0x1bda45[_0xed48('0x26')]),_0xed48('0x54'),_0x1bda45);}}}function emitVoiceQueueChannelRemove(_0x5426c4){logger[_0xed48('0x55')](_0xed48('0x56'),JSON['stringify'](_0x5426c4));emit(util[_0xed48('0x52')](_0xed48('0x53'),_0x5426c4[_0xed48('0x26')]),'voice_queue_channel:remove',_0x5426c4);this['emit'](_0xed48('0x57'),_0x5426c4);}function notSendMessagesQueue(_0x47e3ed){if(_0x47e3ed[_0xed48('0x58')]){if(_0x47e3ed[_0xed48('0x59')]===0x0&&_0x47e3ed[_0xed48('0x2a')]===0x0){_0x47e3ed[_0xed48('0x58')]=![];_0x47e3ed[_0xed48('0x29')]=0x0;_0x47e3ed[_0xed48('0x5a')]=0x0;_0x47e3ed[_0xed48('0x5b')]=_0xed48('0x5c');ut[_0xed48('0x5d')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x47e3ed[_0xed48('0x26')]+_0xed48('0x5e'));}else{_0x47e3ed[_0xed48('0x5b')]=_0xed48('0x5f');ut[_0xed48('0x5d')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x47e3ed[_0xed48('0x26')]+_0xed48('0x60'));}emitCampaignPreview(_0x47e3ed);}}Preview[_0xed48('0xe')][_0xed48('0x23')]=function(){var _0x1a3c55=this;setInterval(function(){_0x1a3c55[_0xed48('0x61')]();},0x7cf);};Preview[_0xed48('0xe')][_0xed48('0x61')]=function(){var _0x1d4d1d=this[_0xed48('0x11')];this[_0xed48('0x16')]+=0x1;for(var _0x3f7239 in _0x1d4d1d){if(_0x1d4d1d[_0xed48('0x62')](_0x3f7239)&&(_0x1d4d1d[_0x3f7239][_0xed48('0x33')]===_0xed48('0x7')||_0x1d4d1d[_0x3f7239][_0xed48('0x33')]===_0xed48('0x63'))&&_0x1d4d1d[_0x3f7239][_0xed48('0x64')]==='outbound'){if(this[_0xed48('0x16')]>0x7){this[_0xed48('0x16')]=0x0;this[_0xed48('0x65')]();}}if(_0x1d4d1d[_0xed48('0x62')](_0x3f7239)&&_0x1d4d1d[_0x3f7239][_0xed48('0x33')]===_0xed48('0x7')&&_0x1d4d1d[_0x3f7239]['type']===_0xed48('0x25')){if(_0x1d4d1d[_0x3f7239]['dialActive']){this[_0xed48('0x66')](_0x1d4d1d[_0x3f7239]);this[_0xed48('0x67')](_0x1d4d1d[_0x3f7239]);}else{notSendMessagesQueue(_0x1d4d1d[_0x3f7239]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x26da97){var _0x5950c3=this;this[_0xed48('0x10')]['enqueue'](function(){if(!_['isNil'](_0x5950c3['actions'][_0x26da97])){loggerAction[_0xed48('0x55')](_0xed48('0x68'),_0x26da97,_0xed48('0x69'),_0x5950c3[_0xed48('0x14')][_0x26da97][_0xed48('0x6a')],_0xed48('0x6b'),JSON['stringify'](_0x5950c3['campaignsPreview'][_0x5950c3[_0xed48('0x14')][_0x26da97][_0xed48('0x6a')]][_0xed48('0x59')]),_0xed48('0x6c'),JSON[_0xed48('0x51')](_0x5950c3[_0xed48('0x11')][_0x5950c3['actions'][_0x26da97][_0xed48('0x6a')]]['pTalking']),JSON['stringify'](_0x5950c3['actions'][_0x26da97][_0xed48('0x6d')]),JSON[_0xed48('0x51')](_[_0xed48('0x6e')](_0x5950c3[_0xed48('0x14')][_0x26da97],[_0xed48('0x6f'),_0xed48('0x70'),_0xed48('0x71'),_0xed48('0x72')])));return ami[_0xed48('0x73')]({'action':_0xed48('0x74'),'channel':_0x5950c3[_0xed48('0x14')][_0x26da97][_0xed48('0x75')]})['catch'](function(_0x3f7deb){if(_0x3f7deb[_0xed48('0x5b')]===_0xed48('0x76')){setTimeout(function(){if(_0x5950c3[_0xed48('0x14')][_0x26da97]){ut[_0xed48('0x77')](_0x5950c3[_0xed48('0x11')][_0x5950c3[_0xed48('0x14')][_0x26da97][_0xed48('0x6a')]],_0xed48('0x78'));if(_0x5950c3[_0xed48('0x14')][_0x26da97][_0xed48('0x6d')]===!![]){ut[_0xed48('0x79')](_0x5950c3[_0xed48('0x11')][_0x5950c3[_0xed48('0x14')][_0x26da97]['queue']],'[clearZombieChannel]');ut['loggerError'](_0xed48('0x7a')+_0x26da97,_0x5950c3[_0xed48('0x14')][_0x26da97][_0xed48('0x6a')]);}ut[_0xed48('0x7b')](_0xed48('0x7c')+_0x26da97,_0x5950c3['actions'][_0x26da97]['queue']);delete _0x5950c3[_0xed48('0x14')][_0x26da97];}},0x2328);}});}});};Preview[_0xed48('0xe')][_0xed48('0x65')]=function(){var _0x59c282=this;loggerAction[_0xed48('0x55')](_0xed48('0x7d'),_[_0xed48('0x7e')](this[_0xed48('0x14')]));for(var _0x15503d in this['actions']){if(_0x59c282[_0xed48('0x14')]['hasOwnProperty'](_0x15503d)){_0x59c282[_0xed48('0x7f')](_0x15503d);}}};Preview[_0xed48('0xe')][_0xed48('0x67')]=function(_0x448061){var _0x47263d=this;rpcDb[_0xed48('0x80')](_0x448061['id'],ut['agentReadyId'](this[_0xed48('0x15')]))['then'](function(_0x405aca){if(!_[_0xed48('0x81')](_0x405aca)){for(var _0x27746e=0x0;_0x27746e<_0x405aca['length'];_0x27746e+=0x1){if(ut[_0xed48('0x82')](_0x405aca[_0x27746e][_0xed48('0x83')])<_0x448061['dialRecallMeTimeout']*0x3c){if(_0x405aca[_0x27746e][_0xed48('0x84')]&&!_0x405aca[_0x27746e]['Agent'][_0xed48('0x85')]){_0x47263d['run'](_0x405aca[_0x27746e]['id'])[_0xed48('0x86')](ut[_0xed48('0x87')](_0xed48('0x88')))[_0xed48('0x89')](ut['logger2'](_0xed48('0x88')));}else{rpcDb['disableContact'](_0x405aca[_0x27746e]['id']);}}else{var _0x1ac814=new Action(_0x405aca[_0x27746e],_0x448061);_0x1ac814[_0xed48('0x8a')]=moment()[_0xed48('0x52')](_0xed48('0x8b'));_0x448061[_0xed48('0x3c')]+=0x1;ut[_0xed48('0x8c')](_0x1ac814,0x17,_0xed48('0x8d'));if(_0x448061[_0xed48('0x8e')]){rpcDb['rescheduleContactInQueue'](ut[_0xed48('0x8f')](_0x405aca[_0x27746e]));rpcDb['createCustomerHistory'](_0x1ac814,_0xed48('0x90'));}else{ut['logCustomer'](_0x1ac814,0x16,_0xed48('0x91'));rpcDb[_0xed48('0x92')](_0x1ac814,_0xed48('0x93'));rpcDb[_0xed48('0x94')](_0x1ac814,_0xed48('0x93'));}}}}})[_0xed48('0x89')](ut['logger2']('[getContactRecallMe]'));};Preview['prototype'][_0xed48('0x66')]=function(_0x51abc3){_0x51abc3['sendMessageOneNotActive']=!![];if(ut[_0xed48('0x95')](_0x51abc3['loggedIn'])){_0x51abc3[_0xed48('0x5b')]=_0xed48('0x96');}else if(!ut[_0xed48('0x97')](_0x51abc3[_0xed48('0x32')])){_0x51abc3['message']='NOT_ACTIVE';}else if(!this[_0xed48('0x98')](_0x51abc3['Trunk'])){if(!this[_0xed48('0x98')](_0x51abc3['TrunkBackup'])){_0x51abc3[_0xed48('0x5b')]=_0xed48('0x99');}else{_0x51abc3['message']=_0xed48('0x9a');}}else{_0x51abc3['message']=_0xed48('0x9a');}emitCampaignPreview(_0x51abc3);};Preview[_0xed48('0xe')][_0xed48('0x9b')]=function(_0x9a7dcc,_0x7440f9,_0x34cf18){var _0x14b452=this;var _0x22a7d8=this['actions'][_0x7440f9];var _0x55d50c=this[_0xed48('0x11')][_0x22a7d8[_0xed48('0x6a')]];var _0x146bbe;if(_0x55d50c){switch(_0x34cf18){case'1':_0x55d50c[_0xed48('0x9c')]+=0x1;_0x22a7d8['countnosuchnumberretry']+=0x1;_0x22a7d8[_0xed48('0x9d')]=ut[_0xed48('0x9e')](_0x22a7d8);ut[_0xed48('0x8c')](_0x22a7d8,0x0,'NoSuchNumber');ami[_0xed48('0x24')](_0xed48('0x9f'),ut[_0xed48('0xa0')](_0x22a7d8,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x22a7d8,_0xed48('0xa1'));if(ut[_0xed48('0x9e')](_0x22a7d8)>=_0x55d50c['dialGlobalMaxRetry']){_0x146bbe=ut[_0xed48('0xa2')](_0x22a7d8,0xf,'Global');rpcDb['createCustomerFinal'](_0x146bbe,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x22a7d8['countnosuchnumberretry']>=_0x55d50c[_0xed48('0xa3')]){rpcDb[_0xed48('0x94')](_0x22a7d8,_0xed48('0xa4'));}else{rpcDb[_0xed48('0xa5')](ut['scheduledAt'](_0x22a7d8,_0xed48('0xa6'),_0x55d50c['dialNoSuchNumberRetryFrequency']),_0x22a7d8['unlockAgent'],_0x22a7d8[_0xed48('0xa7')]);}}delete this[_0xed48('0x14')][_0x9a7dcc['linkedid']];break;case'ANSWER':var _0x350391=moment()[_0xed48('0x52')](_0xed48('0x8b'));_0x22a7d8['responsetime']=_0x350391;_0x22a7d8[_0xed48('0xa8')]=_0x350391;_0x22a7d8['dialAnswer']=!![];_0x55d50c[_0xed48('0x2a')]+=0x1;logger[_0xed48('0x55')](_0xed48('0xa9'),_0x22a7d8[_0xed48('0xaa')],_0xed48('0xab'),_0x55d50c[_0xed48('0x26')],'pTalking:\x20',_0x55d50c[_0xed48('0x2a')]);ami[_0xed48('0x24')](_0xed48('0xac'),ut[_0xed48('0xa0')](_0x22a7d8,_0xed48('0xad'),this['campaignsPreview'][_0x22a7d8[_0xed48('0x6a')]]));if(_0x55d50c[_0xed48('0xae')]){ami['emit']('custom:agentConnectPreview',ut[_0xed48('0xaf')](_0x22a7d8));}break;case'16':ami[_0xed48('0x24')](_0xed48('0xb0'),ut[_0xed48('0xa0')](_0x22a7d8,_0xed48('0xb1'),this[_0xed48('0x11')][_0x22a7d8['queue']]));emitVoiceQueueChannelRemove(ut[_0xed48('0xa0')](_0x22a7d8,_0xed48('0xb1')));_0x55d50c[_0xed48('0xb2')]+=0x1;_0x55d50c['total']+=0x1;_0x55d50c['answered']+=0x1;ut['decrementTalkink'](_0x55d50c,_0xed48('0xb3'));_0x22a7d8['countglobal']=ut[_0xed48('0x9e')](_0x22a7d8);ut['logCustomer'](_0x22a7d8,0x4,_0xed48('0xb4'));rpcDb[_0xed48('0x92')](_0x22a7d8,_0xed48('0xb5'));rpcDb[_0xed48('0x94')](_0x22a7d8,_0xed48('0xb6'));rpcDb['crateCustomerReportQueue'](_0x22a7d8);_0x55d50c['sumDuration']+=_0x22a7d8['talktime'];_0x55d50c['sumBillable']+=_0x22a7d8['talktime'];logger['info'](_0xed48('0xb7'),_0x22a7d8['uniqueid'],_0xed48('0xab'),_0x55d50c[_0xed48('0x26')],_0xed48('0x6c'),_0x55d50c[_0xed48('0x2a')]);delete this[_0xed48('0x14')][_0x9a7dcc[_0xed48('0xb8')]];break;case'BUSY':_0x55d50c[_0xed48('0x39')]+=0x1;_0x22a7d8[_0xed48('0xb9')]+=0x1;_0x22a7d8[_0xed48('0x9d')]=ut['totalGlobal'](_0x22a7d8);ut[_0xed48('0x8c')](_0x22a7d8,0x5,_0xed48('0xba'));ami[_0xed48('0x24')](_0xed48('0xbb'),ut[_0xed48('0xa0')](_0x22a7d8,'busy'));rpcDb[_0xed48('0x92')](_0x22a7d8,_0xed48('0xbc'));if(ut[_0xed48('0x9e')](_0x22a7d8)>=_0x55d50c['dialGlobalMaxRetry']){_0x146bbe=ut[_0xed48('0xa2')](_0x22a7d8,0xf,_0xed48('0xbd'));rpcDb[_0xed48('0x94')](_0x146bbe,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x22a7d8['countbusyretry']>=_0x55d50c[_0xed48('0xbe')]){rpcDb['createCustomerFinal'](_0x22a7d8,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0xed48('0xbf')](_0x22a7d8,_0xed48('0xb9'),_0x55d50c['dialBusyRetryFrequency']),_0x22a7d8[_0xed48('0xc0')],_0x22a7d8[_0xed48('0xa7')]);}}break;case _0xed48('0xc1'):_0x55d50c[_0xed48('0x3b')]+=0x1;_0x22a7d8[_0xed48('0xc2')]+=0x1;_0x22a7d8['countglobal']=ut[_0xed48('0x9e')](_0x22a7d8);ut[_0xed48('0x8c')](_0x22a7d8,0x3,_0xed48('0xc3'));ami[_0xed48('0x24')](_0xed48('0xc4'),ut[_0xed48('0xa0')](_0x22a7d8,_0xed48('0xc5')));rpcDb[_0xed48('0x92')](_0x22a7d8,_0xed48('0xc6'));if(ut[_0xed48('0x9e')](_0x22a7d8)>=_0x55d50c[_0xed48('0xc7')]){_0x146bbe=ut[_0xed48('0xa2')](_0x22a7d8,0xf,'Global');rpcDb[_0xed48('0x94')](_0x146bbe,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x22a7d8[_0xed48('0xc2')]>=_0x55d50c[_0xed48('0xc8')]){rpcDb[_0xed48('0x94')](_0x22a7d8,_0xed48('0xc6'));}else{rpcDb['rescheduleContact'](ut[_0xed48('0xbf')](_0x22a7d8,_0xed48('0xc2'),_0x55d50c[_0xed48('0xc9')]),_0x22a7d8[_0xed48('0xc0')],_0x22a7d8[_0xed48('0xa7')]);}}break;case'CONGESTION':_0x55d50c[_0xed48('0xca')]+=0x1;_0x22a7d8[_0xed48('0xcb')]+=0x1;_0x22a7d8[_0xed48('0x9d')]=ut[_0xed48('0x9e')](_0x22a7d8);ut[_0xed48('0x8c')](_0x22a7d8,0x8,_0xed48('0xcc'));ami['emit'](_0xed48('0xcd'),ut['buildObj'](_0x22a7d8,_0xed48('0xce')));rpcDb[_0xed48('0x92')](_0x22a7d8,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xed48('0x9e')](_0x22a7d8)>=_0x55d50c[_0xed48('0xc7')]){_0x146bbe=ut[_0xed48('0xa2')](_0x22a7d8,0xf,_0xed48('0xbd'));rpcDb[_0xed48('0x94')](_0x146bbe,_0xed48('0xcf'));}else{if(_0x22a7d8[_0xed48('0xcb')]>=_0x55d50c['dialCongestionMaxRetry']){rpcDb[_0xed48('0x94')](_0x22a7d8,_0xed48('0xd0'));}else{rpcDb['rescheduleContact'](ut[_0xed48('0xbf')](_0x22a7d8,_0xed48('0xcb'),_0x55d50c[_0xed48('0xd1')]),_0x22a7d8['unlockAgent'],_0x22a7d8[_0xed48('0xa7')]);}}break;case _0xed48('0xd2'):_0x55d50c[_0xed48('0x3d')]+=0x1;_0x22a7d8[_0xed48('0xd3')]+=0x1;_0x22a7d8[_0xed48('0x9d')]=ut[_0xed48('0x9e')](_0x22a7d8);ut['logCustomer'](_0x22a7d8,0x14,'AgentReject');ami[_0xed48('0x24')](_0xed48('0xd4'),ut[_0xed48('0xa0')](_0x22a7d8,_0xed48('0xd5')));rpcDb[_0xed48('0x92')](_0x22a7d8,_0xed48('0xd6'));if(ut['totalGlobal'](_0x22a7d8)>=_0x55d50c[_0xed48('0xc7')]){_0x146bbe=ut[_0xed48('0xa2')](_0x22a7d8,0x14,_0xed48('0xd7'));rpcDb[_0xed48('0x94')](_0x146bbe,_0xed48('0xd8'));}else{if(_0x22a7d8[_0xed48('0xd3')]>=_0x55d50c[_0xed48('0xd9')]){rpcDb[_0xed48('0x94')](_0x22a7d8,_0xed48('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0xed48('0xbf')](_0x22a7d8,_0xed48('0xd3'),_0x55d50c[_0xed48('0xda')]),_0x22a7d8[_0xed48('0xc0')],_0x22a7d8[_0xed48('0xa7')]);}}break;case _0xed48('0xdb'):_0x55d50c[_0xed48('0xdc')]+=0x1;_0x22a7d8[_0xed48('0xdd')]+=0x1;_0x22a7d8[_0xed48('0x9d')]=ut['totalGlobal'](_0x22a7d8);ut['logCustomer'](_0x22a7d8,0xb,_0xed48('0xde'));rpcDb['createCustomerHistory'](_0x22a7d8,_0xed48('0xdf'));if(ut[_0xed48('0x9e')](_0x22a7d8)>=_0x55d50c[_0xed48('0xc7')]){_0x146bbe=ut['cloneAction'](_0x22a7d8,0xf,'Global');rpcDb[_0xed48('0x94')](_0x146bbe,_0xed48('0xdf'));}else{if(_0x22a7d8['countabandonedetry']>=_0x55d50c[_0xed48('0xe0')]){rpcDb[_0xed48('0x94')](_0x22a7d8,_0xed48('0xdf'));}else{rpcDb[_0xed48('0xa5')](ut['scheduledAt'](_0x22a7d8,_0xed48('0xdd'),_0x55d50c[_0xed48('0xe1')]),_0x22a7d8[_0xed48('0xc0')],_0x22a7d8[_0xed48('0xa7')]);}}break;default:if(_0x22a7d8[_0xed48('0x6d')]){ut[_0xed48('0x79')](_0x55d50c,_0xed48('0xe2'));ut[_0xed48('0x7b')](_0xed48('0xe3')+_0x55d50c['name'],_0x9a7dcc);}_0x55d50c['outboundUnknownCallsDay']+=0x1;_0x22a7d8[_0xed48('0x9d')]=ut[_0xed48('0x9e')](_0x22a7d8);ut[_0xed48('0x8c')](_0x22a7d8,0xc,_0x9a7dcc['cause-txt']||_0x9a7dcc[_0xed48('0xe4')]);rpcDb[_0xed48('0x92')](_0x22a7d8,_0xed48('0xe5'));if(ut[_0xed48('0x9e')](_0x22a7d8)>=_0x55d50c[_0xed48('0xc7')]){_0x146bbe=ut[_0xed48('0xa2')](_0x22a7d8,0xf,_0xed48('0xbd'));rpcDb['createCustomerFinal'](_0x146bbe,_0xed48('0xe6'));}else{rpcDb['createCustomerFinal'](_0x22a7d8,_0xed48('0xe6'));}delete this['actions'][_0x9a7dcc['linkedid']];}if(!(_0x22a7d8[_0xed48('0x6d')]&&_0x34cf18==='16')){ut[_0xed48('0x77')](_0x55d50c,'[callProgressDetectingCustomer]');logger[_0xed48('0x55')](_0xed48('0xe7'),_0x22a7d8['uniqueid'],_0xed48('0xab'),_0x55d50c['name'],'originated:\x20',_0x55d50c[_0xed48('0x59')]);}if(_0x34cf18!=='ANSWER'){delete this[_0xed48('0x14')][_0x9a7dcc[_0xed48('0xb8')]];delete this[_0xed48('0x14')][_0x9a7dcc['destlinkedid']];}}};Preview[_0xed48('0xe')][_0xed48('0xe8')]=function(_0x48c7ae,_0x196e92,_0x476e7e){if(_[_0xed48('0xe9')](_0x196e92)&&_0xed48('0xea')!==typeof _0x196e92){return;}if(_[_0xed48('0xe9')](_0x476e7e)&&_0xed48('0xea')!==typeof _0x476e7e){return;}switch(_0x476e7e[_0xed48('0xeb')]){case'0':ut[_0xed48('0xec')](_0x48c7ae,0x0,_0xed48('0xed'));rpcDb[_0xed48('0xee')](_0x48c7ae,_0xed48('0xef'));break;case'3':ut['logAgent'](_0x48c7ae,0x3,_0xed48('0xc3'));rpcDb[_0xed48('0xee')](_0x48c7ae,_0xed48('0xf0'));break;case'5':ut['logAgent'](_0x48c7ae,0x5,'Busy');rpcDb[_0xed48('0xee')](_0x48c7ae,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xed48('0xec')](_0x48c7ae,0x8,_0xed48('0xcc'));rpcDb['createAgentHistory'](_0x48c7ae,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xed48('0xec')](_0x48c7ae,0x16,_0xed48('0xf1'));rpcDb[_0xed48('0xee')](_0x48c7ae,_0xed48('0xf2'));break;default:ut[_0xed48('0xec')](_0x48c7ae,0xc,_0x476e7e[_0xed48('0xeb')]);rpcDb['createAgentHistory'](_0x48c7ae,_0xed48('0xf3'));}ut['updateOriginated'](_0x196e92,_0xed48('0xf4'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x48c7ae['uniqueid'],_0xed48('0xab'),_0x196e92[_0xed48('0x26')],_0xed48('0x6b'),_0x196e92['originated']);delete this['actions'][_0x48c7ae[_0xed48('0xaa')]];};Preview[_0xed48('0xe')][_0xed48('0xf5')]=function(_0x271f65,_0x4e77ff,_0x33695e,_0x4ac284,_0x1d8999){var _0x15e0d8=this;return new BPromise(function(_0x36955c,_0x56f6c8){if(_[_0xed48('0x81')](_0x4e77ff)||_[_0xed48('0x81')](_0x4e77ff['Contact'])||_[_0xed48('0x81')](_0x4e77ff[_0xed48('0xf6')]['phone'])||_[_0xed48('0x81')](_0x4e77ff[_0xed48('0x71')])){_0x56f6c8(ut['message'](_0xed48('0xf7'),_0x4ac284,_0x1d8999));return;}var _0x457267=uuid['v4']();var _0x1b9deb=_0x15e0d8['campaignsPreview'][_0x4e77ff[_0xed48('0x69')][_0xed48('0x26')]];var _0x1d9279=_0x33695e?_0x15e0d8['agents'][_0x33695e]['id']:undefined;_0x15e0d8[_0xed48('0x14')][_0x457267]=new Action(_0x4e77ff,_0x1b9deb,_0x457267,_0x33695e,_0x1d9279);var _0x439916=_0x15e0d8[_0xed48('0x14')][_0x457267];_0x439916['unlockAgent']=_0x4ac284;_0x439916[_0xed48('0xa7')]=_0x1d8999;_0x439916[_0xed48('0xf8')]=_0x33695e;if(_[_0xed48('0xf9')](_0x271f65)){_0x15e0d8[_0xed48('0xfa')](_0x439916,_0x1b9deb,_0x4e77ff,_0x33695e)['then'](function(_0x4b92a1){logger[_0xed48('0x55')](_0xed48('0xfb'),_0xed48('0xfc')+_0x439916[_0xed48('0x6a')]+_0xed48('0xfd')+_0x439916[_0xed48('0xfe')],JSON[_0xed48('0x51')](_0x4b92a1));ami['emit'](_0xed48('0xff'),ut[_0xed48('0xa0')](_0x439916,'called',_0x15e0d8[_0xed48('0x11')][_0x439916[_0xed48('0x6a')]]));_0x36955c(ut[_0xed48('0x5b')](_0xed48('0x100')));})[_0xed48('0x89')](function(_0x361103){ut['logger'](_0xed48('0x101'),_0x361103);_0x56f6c8(ut['message']('Call\x20failed',_0x4ac284,_0x1d8999));});}else{_0x1b9deb[_0xed48('0x38')]+=0x1;ut[_0xed48('0x102')](_0x439916);rpcDb[_0xed48('0x103')](_0x439916,_0xed48('0x104'));delete _0x15e0d8[_0xed48('0x14')][_0x457267];_0x56f6c8(ut[_0xed48('0x5b')]('Contact\x20in\x20black\x20List',_0x4ac284,_0x1d8999));}});};Preview[_0xed48('0xe')]['isTrunkReachable']=function(_0x53787a){return!_['isNil'](_0x53787a)&&!_[_0xed48('0x81')](_0x53787a[_0xed48('0x26')])&&!_[_0xed48('0x81')](_0x53787a[_0xed48('0x105')])&&_0x53787a[_0xed48('0x105')]&&!_['isNil'](this['trunks'][util[_0xed48('0x52')](_0xed48('0x106'),_0x53787a['name'])])&&!_[_0xed48('0x81')](this[_0xed48('0x13')][util[_0xed48('0x52')](_0xed48('0x106'),_0x53787a[_0xed48('0x26')])]['status'])&&(this[_0xed48('0x13')][util[_0xed48('0x52')](_0xed48('0x106'),_0x53787a[_0xed48('0x26')])][_0xed48('0x74')]===_0xed48('0x107')||this[_0xed48('0x13')][util[_0xed48('0x52')](_0xed48('0x106'),_0x53787a[_0xed48('0x26')])][_0xed48('0x74')]===_0xed48('0x108'));};Preview[_0xed48('0xe')][_0xed48('0x109')]=function(_0x2cc591,_0x1e14db){var _0xce3c3e=this;return new BPromise(function(_0x3e9fa1,_0x4380e9){_0xce3c3e[_0xed48('0x10a')](_0x2cc591,_0x1e14db)[_0xed48('0x86')](function(_0x241a4c){_0x3e9fa1(_[_0xed48('0x6e')](_0x241a4c,['message']));})[_0xed48('0x89')](function(_0x164e46){if(_0x164e46[_0xed48('0x10b')]){rpcDb['unlockContact'](_0x2cc591);}if(_0x164e46[_0xed48('0x105')]){rpcDb[_0xed48('0x10c')](_0x2cc591);}_0x4380e9(_[_0xed48('0x6e')](_0x164e46,[_0xed48('0x5b')]));});});};Preview[_0xed48('0xe')]['execRun']=function(_0xe30c1e,_0x47d0b6){var _0xbac73a=this;return new BPromise(function(_0x240355,_0x5c43ce){var _0x8dfdfa,_0x56463e;rpcDb[_0xed48('0x10d')](_0xe30c1e)['then'](function(_0x1cf341){if(!_[_0xed48('0x81')](_0x1cf341[0x0])){_0x56463e=_0x1cf341[0x0][_0xed48('0x10e')]?![]:!![];_0x8dfdfa=_0x1cf341[0x0][_0xed48('0x10e')]?!![]:![];_0x8dfdfa=_0x47d0b6?!![]:_0x8dfdfa;}var _0x18b6a4=_0xbac73a[_0xed48('0x10f')](_0x1cf341);if(_0x18b6a4[_0xed48('0x110')]){rpcDb[_0xed48('0x111')](_[_0xed48('0x6e')](_0x1cf341[0x0],[_0xed48('0x71'),_0xed48('0x112')]))['then'](function(_0x5db77b){_0xbac73a[_0xed48('0xf5')](_0x5db77b,_0x1cf341[0x0],_0x47d0b6,_0x56463e,_0x8dfdfa)[_0xed48('0x86')](function(_0x3b438b){_0x240355(_0x3b438b);})[_0xed48('0x89')](function(_0x5cd9f7){_0x5c43ce(_0x5cd9f7);});})['catch'](function(_0x3e2644){ut[_0xed48('0x5d')](_0xed48('0x113'),_0x3e2644);_0x5c43ce(ut[_0xed48('0x5b')](_0xed48('0x114'),_0x56463e,_0x8dfdfa));});}else{_0x5c43ce(ut[_0xed48('0x5b')](_0x18b6a4['message'],_0x56463e,_0x8dfdfa));}})[_0xed48('0x89')](function(_0x491863){ut[_0xed48('0x5d')](_0xed48('0x115'),_0x491863);_0x5c43ce(ut[_0xed48('0x5b')](_0xed48('0x114'),![],!![]));});});};Preview[_0xed48('0xe')][_0xed48('0x10f')]=function(_0x1ad89f){if(_['isNil'](_0x1ad89f)||_[_0xed48('0xf9')](_0x1ad89f)||!_[_0xed48('0x81')](_0x1ad89f[0x0][_0xed48('0x84')])&&_[_0xed48('0x81')](_0x1ad89f[0x0][_0xed48('0x84')][_0xed48('0x26')])){ut['logger'](_0xed48('0x116'),_0x1ad89f);return{'isValid':![],'message':_0xed48('0x117')};}var _0x7f6a36=this[_0xed48('0x11')][_0x1ad89f[0x0]['Queue'][_0xed48('0x26')]];_0x7f6a36['message']=_0xed48('0x9a');if(_[_0xed48('0x81')](_0x7f6a36)){ut[_0xed48('0x5d')](_0xed48('0x118'),_0x7f6a36);return{'isValid':![],'message':_0xed48('0x119')};}if(!this[_0xed48('0x98')](_0x7f6a36[_0xed48('0x4e')])){ut[_0xed48('0x5d')](_0xed48('0x11a'),_0xed48('0x11b')+_0x7f6a36[_0xed48('0x26')]+_0xed48('0x11c'));if(!this['isTrunkReachable'](_0x7f6a36[_0xed48('0x11d')])){ut[_0xed48('0x5d')](_0xed48('0x11a'),_0x7f6a36[_0xed48('0x26')]+_0xed48('0x11e'));return{'isValid':![],'message':_0xed48('0x11f')};}}if(!ut[_0xed48('0x97')](_0x7f6a36[_0xed48('0x32')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x7f6a36[_0xed48('0x26')]+_0xed48('0x120'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x7f6a36[_0xed48('0x26')]+_0xed48('0x120')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xed48('0xe')][_0xed48('0xfa')]=function(_0x5c2c0e,_0x5ae624,_0x54c72e,_0x573eca){var _0x4ec06c=this;return new BPromise(function(_0x10e7b8,_0x3ae977){var _0x42ecfa=_0x5c2c0e[_0xed48('0xaa')];var _0x121030=_0x4ec06c[_0xed48('0x98')](_0x5ae624[_0xed48('0x4e')])?util[_0xed48('0x52')]('SIP/%s/%s%s',_0x5ae624[_0xed48('0x4e')]['name'],_['isNil'](_0x5ae624['dialPrefix'])?'':_0x5ae624['dialPrefix']['trim']()||'',_0x5ae624['dialCutDigit']>0x0?_0x54c72e[_0xed48('0xf6')][_0xed48('0x121')][_0xed48('0x122')](_0x5ae624[_0xed48('0x123')]):_0x54c72e['Contact'][_0xed48('0x121')]):util['format'](_0xed48('0x124'),_[_0xed48('0x81')](_0x5ae624['TrunkBackup'])?_0x5ae624['Trunk'][_0xed48('0x26')]:_0x5ae624['TrunkBackup'][_0xed48('0x26')],_['isNil'](_0x5ae624[_0xed48('0x36')])?'':_0x5ae624[_0xed48('0x36')][_0xed48('0x125')]()||'',_0x5ae624['dialCutDigit']>0x0?_0x54c72e['Contact'][_0xed48('0x121')]['substring'](_0x5ae624['dialCutDigit']):_0x54c72e[_0xed48('0xf6')][_0xed48('0x121')]);var _0x34feb8=_0x4ec06c[_0xed48('0x98')](_0x5ae624['Trunk'])?ut[_0xed48('0x126')](_0x5ae624[_0xed48('0x4e')][_0xed48('0x4f')],_0x5ae624[_0xed48('0x34')],_0x5ae624[_0xed48('0x127')]>0x0?ut['getCallerIdRandom'](_0x5ae624['dialOriginateCallerIdNumber'],_0x5ae624[_0xed48('0x127')]):_0x5ae624[_0xed48('0x128')]):ut[_0xed48('0x126')](_[_0xed48('0x81')](_0x5ae624['TrunkBackup'])?_0x5ae624[_0xed48('0x4e')][_0xed48('0x4f')]:_0x5ae624[_0xed48('0x11d')][_0xed48('0x4f')],_0x5ae624['dialOriginateCallerIdName'],_0x5ae624[_0xed48('0x127')]>0x0?ut['getCallerIdRandom'](_0x5ae624[_0xed48('0x128')],_0x5ae624[_0xed48('0x127')]):_0x5ae624[_0xed48('0x128')]);if(_0x34feb8){_0x5c2c0e[_0xed48('0x129')]=ut['extractCalleridName'](_0x34feb8);_0x5c2c0e[_0xed48('0x12a')]=ut[_0xed48('0x12b')](_0x34feb8);}var _0x515719=ut[_0xed48('0x12c')](_0x5ae624,_0x54c72e,_0x121030,_0x34feb8,_0x42ecfa,_0x5c2c0e);_[_0xed48('0x12d')](_0x5c2c0e,ut[_0xed48('0x12e')](_0x515719));_0x5c2c0e[_0xed48('0x8a')]=moment()[_0xed48('0x52')](_0xed48('0x8b'));ami['Action'](ut[_0xed48('0x12f')](_0x5c2c0e,_0x5ae624,_0x515719,_0x5c2c0e[_0xed48('0xa7')],_0x573eca))['then'](function(_0x19a090){_0x5ae624['originated']+=0x1;logger[_0xed48('0x55')](_0xed48('0x130'),_0x42ecfa,_0xed48('0xab'),_0x5ae624[_0xed48('0x26')],_0xed48('0x6b'),_0x5ae624[_0xed48('0x59')]);_0x10e7b8(_0x19a090);})['catch'](function(_0x181825){ut['logAgent'](_0x5c2c0e,0xe,_0xed48('0x131'));rpcDb[_0xed48('0xee')](_0x5c2c0e,'[originateFailure][logOriginateFailure]');_0x3ae977(_0x181825);});});};Preview['prototype'][_0xed48('0x1f')]=function(_0x356efb){if(this['actions'][_0x356efb['linkedid']]){this[_0xed48('0x14')][_0x356efb['linkedid']][_0xed48('0x75')]=_0x356efb[_0xed48('0x75')];}};Preview[_0xed48('0xe')][_0xed48('0x18')]=function(_0x24ad35){var _0x1910c4=this;var _0x587748=this['actions'][_0x24ad35[_0xed48('0x132')]];if(_0x587748){if(_0x587748[_0xed48('0xf8')]&&this[_0xed48('0x15')][_0x587748[_0xed48('0xf8')]]){ut[_0xed48('0x133')](_0x587748,this[_0xed48('0x15')][_0x587748[_0xed48('0xf8')]][_0xed48('0x26')],this[_0xed48('0x15')][_0x587748[_0xed48('0xf8')]]['id']);}var _0x381d3a=_[_0xed48('0x134')](_0x587748);_0x381d3a[_0xed48('0x135')]=moment()[_0xed48('0x52')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2ec9f1=_0x1910c4[_0xed48('0x11')][_0x587748[_0xed48('0x6a')]];if(ut[_0xed48('0x136')](_0x24ad35['response'])){if(_0x587748[_0xed48('0xc0')]){rpcDb[_0xed48('0x137')](_0x587748[_0xed48('0xfe')]);}if(_0x587748['activeContact']){rpcDb[_0xed48('0x10c')](_0x587748['idContact']);}ami[_0xed48('0x24')](_0xed48('0x138'),ut[_0xed48('0xa0')](_0x587748,_0xed48('0x139'),this[_0xed48('0x11')][_0x587748['queue']]));this['callProgressDetectingAgent'](_0x381d3a,_0x2ec9f1,_0x24ad35);}else{_0x587748['starttime']=moment()[_0xed48('0x52')](_0xed48('0x8b'));ut[_0xed48('0xec')](_0x381d3a,0x4,_0xed48('0xb4'));rpcDb[_0xed48('0xee')](_0x381d3a,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xed48('0xe')][_0xed48('0x1a')]=function(_0x47550e){var _0x160712=this;var _0x2d250c=this['actions'][_0x47550e['linkedid']];var _0x5e3cd9;if(_0x2d250c){_0x5e3cd9=this['campaignsPreview'][_0x2d250c[_0xed48('0x6a')]];logger[_0xed48('0x55')](_0xed48('0x13a'),_0x47550e[_0xed48('0xb8')],'\x20Queue',_0x5e3cd9[_0xed48('0x26')],_0xed48('0x6c'),_0x5e3cd9[_0xed48('0x2a')]);}if(this[_0xed48('0x14')][_0x47550e[_0xed48('0xb8')]]&&_0x47550e[_0xed48('0xb8')]!==_0x47550e['uniqueid']){if(_0x47550e['cause']==='16'&&this[_0xed48('0x14')][_0x47550e[_0xed48('0xb8')]]['dialAnswer']){this[_0xed48('0x9b')](_0x47550e,_0x47550e[_0xed48('0xb8')],_0x47550e['cause']);}else if(this[_0xed48('0x14')][_0x47550e[_0xed48('0xb8')]]['dialAnswer']){logger[_0xed48('0x55')](_0xed48('0x13b'),_0x47550e[_0xed48('0xb8')],_0x47550e[_0xed48('0x13c')],'\x20Queue',_0x5e3cd9['name'],_0xed48('0x6c'),_0x5e3cd9[_0xed48('0x2a')]);this[_0xed48('0x9b')](_0x47550e,_0x47550e[_0xed48('0xb8')],_0x47550e['cause']);}}else if(_0x2d250c&&_[_0xed48('0x81')](_0x2d250c[_0xed48('0x13d')])&&_0x5e3cd9[_0xed48('0x13e')]&&_0x47550e[_0xed48('0xb8')]===_0x47550e[_0xed48('0xaa')]&&_[_0xed48('0x81')](_0x47550e[_0xed48('0xeb')])&&_0x47550e[_0xed48('0x13c')]==='16'&&_0x47550e[_0xed48('0x13f')]==='6'&&_['isUndefined'](_0x2d250c[_0xed48('0x140')])){if(_0x2d250c[_0xed48('0xc0')]){rpcDb[_0xed48('0x137')](_0x2d250c[_0xed48('0xfe')]);}if(_0x2d250c[_0xed48('0xa7')]){rpcDb[_0xed48('0x10c')](_0x2d250c['idContact']);}_0x47550e[_0xed48('0xeb')]='22';this['callProgressDetectingAgent'](_0x2d250c,_0x5e3cd9,_0x47550e);}else if(_0x2d250c&&_0x2d250c[_0xed48('0x140')]){if(_0x47550e['cause']==='16'&&this[_0xed48('0x14')][_0x47550e[_0xed48('0xb8')]][_0xed48('0x6d')]){logger['info']('[syncHangup][talking][transfer]',_0x47550e[_0xed48('0xb8')],_0x47550e[_0xed48('0x13c')],_0xed48('0xab'),_0x5e3cd9['name'],_0xed48('0x6c'),_0x5e3cd9[_0xed48('0x2a')]);this[_0xed48('0x9b')](_0x47550e,_0x47550e[_0xed48('0xb8')],_0x47550e[_0xed48('0x13c')]);}else if(this[_0xed48('0x14')][_0x47550e['linkedid']]['dialAnswer']){logger[_0xed48('0x55')](_0xed48('0x13b'),_0x47550e[_0xed48('0xb8')],_0x47550e[_0xed48('0x13c')],_0xed48('0xab'),_0x5e3cd9[_0xed48('0x26')],_0xed48('0x6c'),_0x5e3cd9[_0xed48('0x2a')]);this[_0xed48('0x9b')](_0x47550e,_0x47550e[_0xed48('0xb8')],_0x47550e['cause']);}}};Preview[_0xed48('0xe')][_0xed48('0x1d')]=function(_0x573434){if(this[_0xed48('0x14')][_0x573434[_0xed48('0x141')]]&&_0x573434[_0xed48('0x141')]!==_0x573434['destuniqueid']){this[_0xed48('0x9b')](_0x573434,_0x573434[_0xed48('0x141')],_0x573434[_0xed48('0xe4')]);}};Preview[_0xed48('0xe')][_0xed48('0x142')]=function(_0x387f8d){if(this[_0xed48('0x14')][_0x387f8d['linkedid']]&&_0x387f8d[_0xed48('0xb8')]!==_0x387f8d[_0xed48('0xaa')]&&!this[_0xed48('0x14')][_0x387f8d[_0xed48('0xb8')]][_0xed48('0x6d')]){if(_0x387f8d[_0xed48('0x13c')]==='1'){this[_0xed48('0x9b')](_0x387f8d,_0x387f8d[_0xed48('0xb8')],_0x387f8d['cause']);}}};Preview['prototype'][_0xed48('0x143')]=function(_0x576da0,_0x55cbec,_0x5acc37){if(this[_0xed48('0x14')][_0x576da0]){if(_['isNil'](this[_0xed48('0x14')][_0x576da0][_0xed48('0x144')])){this[_0xed48('0x14')][_0x576da0][_0xed48('0x144')]={};}this[_0xed48('0x14')][_0x576da0][_0xed48('0x144')][_0x55cbec]=_0x5acc37;}};Preview['prototype'][_0xed48('0x145')]=function(_0x57f8d8){try{if(!_['isNil'](_0x57f8d8)){if(ut[_0xed48('0x146')](_[_0xed48('0x147')](_0x57f8d8[_0xed48('0x148')])[0x0])){this[_0xed48('0x143')](_0x57f8d8[_0xed48('0xaa')],_['keys'](_0x57f8d8['variable'])[0x0],_0x57f8d8[_0xed48('0x149')]);}}}catch(_0xdb8bdb){logger[_0xed48('0x14a')](_0xed48('0x14b'),util[_0xed48('0x14c')](_0xdb8bdb,{'showHidden':![],'depth':null}));}};Preview[_0xed48('0xe')]['syncAttendedTransfer']=function(_0x1b3a3e){if(_0x1b3a3e){if(this[_0xed48('0x14')][_0x1b3a3e[_0xed48('0x14d')]]){this[_0xed48('0x14')][_0x1b3a3e[_0xed48('0x14d')]][_0xed48('0x140')]=!![];}}};Preview[_0xed48('0xe')][_0xed48('0x14e')]=function(_0x5682d3){if(_0x5682d3){if(this[_0xed48('0x14')][_0x5682d3[_0xed48('0x14f')]]){this['actions'][_0x5682d3[_0xed48('0x14f')]]['transfer']=!![];}}};module[_0xed48('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index f31881a..ded0878 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 _0x4b84=['xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','inspect','resolve','catch','[createHistory]\x20','then','createHistory','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0x4b84,0x1cc));var _0x44b8=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x4b84[_0x576e2b];return _0x46461a;};'use strict';var util=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x44b8('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x44b8('0x3'));var cmHopperBlack=require(_0x44b8('0x4'));var voiceQueueRt=require(_0x44b8('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x55f25d){return function(_0x996a8b){logger['error'](_0x55f25d,util[_0x44b8('0x6')](_0x996a8b,{'showHidden':![],'depth':null}));};}function create(_0x5947f7){return BPromise[_0x44b8('0x7')]()['then'](cmHopperHistory['createHistory'](_0x5947f7))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x9')));}function createAgent(_0x30ebc3){return BPromise['resolve']()[_0x44b8('0xa')](agentReportPreview[_0x44b8('0xb')](_0x30ebc3))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x9')));}function moveContact(_0x24dd10){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper['moveContactManagedDialer'](_0x24dd10,!![]))[_0x44b8('0x8')](loggerCatch(_0x44b8('0xc')));}exports['checkIsBlackList']=function(_0x194230){return BPromise['resolve']()[_0x44b8('0xa')](cmHopperBlack[_0x44b8('0xd')](_0x194230))['catch'](loggerCatch(_0x44b8('0xe')));};exports['getContactPreview']=function(_0x54fa95){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper[_0x44b8('0xf')](_0x54fa95))[_0x44b8('0x8')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x5d6349,_0x3fe9fb){create(_0x5d6349)['catch'](loggerCatch(_0x3fe9fb));moveContact(_0x5d6349)[_0x44b8('0x8')](loggerCatch(_0x3fe9fb));};exports[_0x44b8('0x10')]=function(_0x55e258,_0x36743e){createAgent(_0x55e258)[_0x44b8('0x8')](loggerCatch(_0x36743e));};exports['createCustomerHistory']=function(_0x89bc30,_0x3f4688){create(_0x89bc30)['catch'](loggerCatch(_0x3f4688));};exports[_0x44b8('0x11')]=function(_0x8b4301,_0xebfe79){moveContact(_0x8b4301)[_0x44b8('0x8')](loggerCatch(_0xebfe79));};exports[_0x44b8('0x12')]=function(_0x369c09,_0x452f2f,_0x9b0536){if(_0x452f2f){_0x369c09[_0x44b8('0x13')]=null;}if(_0x9b0536){_0x369c09[_0x44b8('0x14')]=![];}return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper['rescheduleContact'](_0x369c09))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x15')));};exports[_0x44b8('0x16')]=function(_0x1418db){return BPromise[_0x44b8('0x7')]()['then'](cmHopper[_0x44b8('0x16')](_0x1418db))['catch'](loggerCatch(_0x44b8('0x17')));};exports[_0x44b8('0x18')]=function(_0x25a0c1){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper['unlockContact']({'UserId':null},_0x25a0c1,0x1))[_0x44b8('0x8')](loggerCatch('[unlockContact]\x20'));};exports[_0x44b8('0x19')]=function(_0x350482){return BPromise['resolve']()[_0x44b8('0xa')](cmHopper[_0x44b8('0x18')]({'active':![]},_0x350482,0x1))[_0x44b8('0x8')](loggerCatch('[activeContact]\x20'));};exports[_0x44b8('0x1a')]=function(_0x242342){var _0x53d9c7={};_0x53d9c7[_0x44b8('0x1b')]=_0x242342['type'];_0x53d9c7[_0x44b8('0x1c')]=_0x242342['uniqueid'];_0x53d9c7['calleridnum']=_0x242342['calleridnum'];_0x53d9c7[_0x44b8('0x1d')]=_0x242342[_0x44b8('0x1d')];_0x53d9c7[_0x44b8('0x1e')]=_0x242342[_0x44b8('0x1e')];_0x53d9c7[_0x44b8('0x1f')]=_0x242342[_0x44b8('0x20')];_0x53d9c7[_0x44b8('0x21')]=_0x242342[_0x44b8('0x20')];_0x53d9c7[_0x44b8('0x22')]=0x1;_0x53d9c7[_0x44b8('0x23')]=_0x242342[_0x44b8('0x24')];_0x53d9c7[_0x44b8('0x25')]=_0x242342[_0x44b8('0x26')];_0x53d9c7['context']=_0x44b8('0x27');_0x53d9c7['exten']=_0x44b8('0x28');_0x53d9c7[_0x44b8('0x29')]=0x0;_0x53d9c7[_0x44b8('0x2a')]=0x1;_0x53d9c7[_0x44b8('0x2b')]=_0x242342[_0x44b8('0x26')];_0x53d9c7['queuecallerexitreason']=_0x44b8('0x2c');return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](voiceQueueReport[_0x44b8('0x2d')](_0x53d9c7))[_0x44b8('0x8')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x44b8('0x2e')]=function(_0x400edc,_0x1a30fc){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper[_0x44b8('0x2e')](_0x400edc,_0x1a30fc))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x2f')));};exports[_0x44b8('0x30')]=function(_0x181761){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper[_0x44b8('0x12')](_0x181761,!![],!![]))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x31')));}; \ No newline at end of file +var _0x5089=['rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/voiceQueueReport','inspect','then','createHistory','[createHistory]\x20','resolve','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','from-sip','exten','xcally-motion-preview','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x4ca796,_0x10dc47){var _0x171f87=function(_0x198d29){while(--_0x198d29){_0x4ca796['push'](_0x4ca796['shift']());}};_0x171f87(++_0x10dc47);}(_0x5089,0x1bb));var _0x9508=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x5089[_0x2a8860];return _0x2f47a4;};'use strict';var util=require(_0x9508('0x0'));var BPromise=require(_0x9508('0x1'));var logger=require('../../../config/logger')(_0x9508('0x2'));var _=require(_0x9508('0x3'));var cmHopper=require(_0x9508('0x4'));var cmHopperFinal=require(_0x9508('0x5'));var cmHopperHistory=require(_0x9508('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x9508('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x9508('0x8'));function loggerCatch(_0x4538dd){return function(_0x257318){logger['error'](_0x4538dd,util[_0x9508('0x9')](_0x257318,{'showHidden':![],'depth':null}));};}function create(_0x42d13a){return BPromise['resolve']()[_0x9508('0xa')](cmHopperHistory[_0x9508('0xb')](_0x42d13a))['catch'](loggerCatch(_0x9508('0xc')));}function createAgent(_0x5c9dc9){return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](agentReportPreview[_0x9508('0xb')](_0x5c9dc9))[_0x9508('0xe')](loggerCatch(_0x9508('0xc')));}function moveContact(_0x317f6e){return BPromise['resolve']()[_0x9508('0xa')](cmHopper['moveContactManagedDialer'](_0x317f6e,!![]))[_0x9508('0xe')](loggerCatch(_0x9508('0xf')));}exports['checkIsBlackList']=function(_0x11dc7f){return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](cmHopperBlack[_0x9508('0x10')](_0x11dc7f))['catch'](loggerCatch(_0x9508('0x11')));};exports[_0x9508('0x12')]=function(_0x51c80b){return BPromise[_0x9508('0xd')]()['then'](cmHopper[_0x9508('0x12')](_0x51c80b))[_0x9508('0xe')](loggerCatch(_0x9508('0x13')));};exports[_0x9508('0xb')]=function(_0x127340,_0x343802){create(_0x127340)[_0x9508('0xe')](loggerCatch(_0x343802));moveContact(_0x127340)[_0x9508('0xe')](loggerCatch(_0x343802));};exports['createAgentHistory']=function(_0x22ba9c,_0x378749){createAgent(_0x22ba9c)[_0x9508('0xe')](loggerCatch(_0x378749));};exports[_0x9508('0x14')]=function(_0x23c30e,_0x22a9fe){create(_0x23c30e)['catch'](loggerCatch(_0x22a9fe));};exports['createCustomerFinal']=function(_0x17e43c,_0x47f7a2){moveContact(_0x17e43c)[_0x9508('0xe')](loggerCatch(_0x47f7a2));};exports['rescheduleContact']=function(_0x3ba927,_0x22ff69,_0x226f29){if(_0x22ff69){_0x3ba927[_0x9508('0x15')]=null;}if(_0x226f29){_0x3ba927[_0x9508('0x16')]=![];}return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](cmHopper['rescheduleContact'](_0x3ba927))['catch'](loggerCatch(_0x9508('0x17')));};exports[_0x9508('0x18')]=function(_0x39e6b0){return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](cmHopper[_0x9508('0x18')](_0x39e6b0))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x9508('0x19')]=function(_0x55cc4d){return BPromise['resolve']()[_0x9508('0xa')](cmHopper['unlockContact']({'UserId':null},_0x55cc4d,0x1))['catch'](loggerCatch(_0x9508('0x1a')));};exports[_0x9508('0x1b')]=function(_0x57c7ae){return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](cmHopper[_0x9508('0x19')]({'active':![]},_0x57c7ae,0x1))[_0x9508('0xe')](loggerCatch(_0x9508('0x1c')));};exports[_0x9508('0x1d')]=function(_0x15c32e){var _0x1daca0={};_0x1daca0[_0x9508('0x1e')]=_0x15c32e[_0x9508('0x1e')];_0x1daca0[_0x9508('0x1f')]=_0x15c32e['uniqueid'];_0x1daca0[_0x9508('0x20')]=_0x15c32e[_0x9508('0x20')];_0x1daca0[_0x9508('0x21')]=_0x15c32e['calleridname'];_0x1daca0[_0x9508('0x22')]=_0x15c32e[_0x9508('0x22')];_0x1daca0['queuecallerjoinAt']=_0x15c32e[_0x9508('0x23')];_0x1daca0[_0x9508('0x24')]=_0x15c32e['answertime'];_0x1daca0[_0x9508('0x25')]=0x1;_0x1daca0[_0x9508('0x26')]=_0x15c32e[_0x9508('0x27')];_0x1daca0[_0x9508('0x28')]=_0x15c32e['membername'];_0x1daca0['context']=_0x9508('0x29');_0x1daca0[_0x9508('0x2a')]=_0x9508('0x2b');_0x1daca0['holdtime']=0x0;_0x1daca0['assigned']=0x1;_0x1daca0[_0x9508('0x2c')]=_0x15c32e[_0x9508('0x2d')];_0x1daca0[_0x9508('0x2e')]=_0x9508('0x2f');return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](voiceQueueReport[_0x9508('0x30')](_0x1daca0))[_0x9508('0xe')](loggerCatch(_0x9508('0x31')));};exports[_0x9508('0x32')]=function(_0x4a34d2,_0x17ca13){return BPromise[_0x9508('0xd')]()['then'](cmHopper[_0x9508('0x32')](_0x4a34d2,_0x17ca13))[_0x9508('0xe')](loggerCatch(_0x9508('0x33')));};exports[_0x9508('0x34')]=function(_0x282f83){return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](cmHopper[_0x9508('0x35')](_0x282f83,!![],!![]))[_0x9508('0xe')](loggerCatch(_0x9508('0x36')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 2272f95..81a3cda 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 _0xc37e=['dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','ringtime','starttime','membername','logCustomer','YYYY-MM-DD\x20HH:mm:ss','talktime','answertime','isFailure','Failure','variablesAction','RECALL','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','clone','Global','scheduledAt','active','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','mandatoryDisposition','queue','interface','status','reachable','getDiff','createBody','CampaignId','filterKey','type','dialAnswer','scheduledat','countglobal','callback','callbackat','recallme','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc37e,0x1f4));var _0xec37=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc37e[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0xec37('0x0'));var _=require('lodash');var moment=require(_0xec37('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xec37('0x2')][_0xec37('0x3')]||_0xec37('0x4');function getSeconds(_0x15cd37,_0xf3dc8a){var _0x1ffe16=moment(_0x15cd37)[_0xec37('0x5')](0x0);var _0x3dabb4=moment(_0xf3dc8a)[_0xec37('0x5')](0x0);return _0x1ffe16[_0xec37('0x6')](_0x3dabb4,_0xec37('0x7'));}exports[_0xec37('0x8')]=function(_0x54424){return function(_0x28a326){logger[_0xec37('0x9')](_0x54424,util[_0xec37('0xa')](_0x28a326,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2debbc,_0x519083){logger[_0xec37('0xb')](_0x2debbc,util[_0xec37('0xa')](_0x519083,{'showHidden':![],'depth':null}));};exports[_0xec37('0xc')]=function(_0x1133b8,_0x481372){logger[_0xec37('0x9')](_0x1133b8,util[_0xec37('0xa')](_0x481372,{'showHidden':![],'depth':null}));};exports[_0xec37('0xd')]=function(_0x3a8a74){return function(_0x53d967){logger['info'](_0x3a8a74,util[_0xec37('0xa')](_0x53d967,{'showHidden':![],'depth':null}));};};exports[_0xec37('0xe')]=function(_0x45c6ec,_0x1e290c,_0x278be8){return{'message':_0x45c6ec,'unlock':_0x1e290c,'active':_0x278be8};};exports[_0xec37('0xf')]=function(_0x27dde0,_0x4a3e6c,_0x25266e){if(!_[_0xec37('0x10')](_0x25266e)&&'string'===typeof _0x25266e&&!_[_0xec37('0x11')](_0x25266e)){if(!_[_0xec37('0x10')](_0x4a3e6c)&&'string'===typeof _0x4a3e6c&&!_[_0xec37('0x11')](_0x4a3e6c)){return util[_0xec37('0x12')]('\x22%s\x22\x20<%s>',_0x4a3e6c,_0x25266e);}return util[_0xec37('0x12')](_0xec37('0x13'),_0x25266e,_0x25266e);}if(!_['isUndefined'](_0x27dde0)&&_0xec37('0x14')===typeof _0x27dde0&&!_['isEmpty'](_0x27dde0)){return _0x27dde0;}return _0xec37('0x15');};exports['isActive']=function(_0x4fb97b){if(_[_0xec37('0x16')](_0x4fb97b)){return![];}return _0x4fb97b;};exports[_0xec37('0x17')]=function(_0x4d9833,_0x3dcd16,_0x3a2e2c,_0x2423f8,_0x34268f,_0x4fb84e){var _0x353ea3={'XMD-QUEUE':_0x3dcd16[_0xec37('0x18')]?_0x3dcd16['Queue'][_0xec37('0x19')]:'','XMD-CALLERID':_0x2423f8,'XMD-CALLERID-PREVIEW':_0x4fb84e?util['format'](_0xec37('0x13'),_0x4fb84e[_0xec37('0x1a')],_0x4fb84e[_0xec37('0x1b')]):_0x2423f8,'XMD-DIALID':_0x34268f,'XMD-CONTACTID':_0x3dcd16['ContactId'],'XMD-CDRTYPE':_0xec37('0x1c'),'CALLERID(all)':_0x2423f8,'XMD-VOICEQUEUEID':_0x3dcd16[_0xec37('0x1d')],'XMD-DIALCHANNEL':_0x3a2e2c,'XMD-DIALTIMEOUT':_0x4d9833[_0xec37('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xec37('0x12')](_0xec37('0x1f'),_0x4d9833[_0xec37('0x20')]?'g':'',_[_0xec37('0x11')](_0x4d9833[_0xec37('0x21')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4d9833[_0xec37('0x22')]||'','XMD-AGI':_0x4d9833[_0xec37('0x23')]?util[_0xec37('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4d9833['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x4d9833['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4d9833['dialQueueProject2']):_0xec37('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x4fb84e?_0x4fb84e[_0xec37('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x4fb84e?_0x4fb84e[_0xec37('0x26')]:'','XMD-DESTINATION':_0xec37('0x27')};if(!_[_0xec37('0x11')](_0x4d9833[_0xec37('0x21')])){_0x353ea3[util[_0xec37('0x12')]('%s',_0xec37('0x28'))]=_0x4d9833[_0xec37('0x21')];_0x353ea3[util[_0xec37('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x34268f;}if(_0x3dcd16&&_0x3dcd16[_0xec37('0x29')]){for(var _0x332512 in _0x3dcd16[_0xec37('0x29')]){if(_0x3dcd16[_0xec37('0x29')]['hasOwnProperty'](_0x332512)){if(!_['isNil'](_0x3dcd16[_0xec37('0x29')][_0x332512])&&_0x332512!=='id'&&_0x332512!==_0xec37('0x2a')&&_0x332512!==_0xec37('0x2b')&&_0x332512!==_0xec37('0x2c')){_0x353ea3[util[_0xec37('0x12')](_0xec37('0x2d'),_0xec37('0x2e'),_[_0xec37('0x2f')](_0x332512))]=_0x3dcd16[_0xec37('0x29')][_0x332512];}}}}return _0x353ea3;};exports['toLowerVariables']=function(_0x281df8){var _0x10c4b5={};for(var _0x45360b in _0x281df8){if(_0x281df8[_0xec37('0x30')](_0x45360b)){_0x10c4b5[util[_0xec37('0x12')]('%s',_[_0xec37('0x31')](_0x45360b))]=_0x281df8[_0x45360b];}}return{'variables':_0x10c4b5};};exports[_0xec37('0x32')]=function(_0x1c2887,_0x5eab11){if(!_[_0xec37('0x16')](_0x1c2887)){if(_0x1c2887[_0xec37('0x30')]('originated')){if(_0x1c2887[_0xec37('0x33')]>0x0){_0x1c2887[_0xec37('0x33')]-=0x1;}else{logger[_0xec37('0x9')](_0xec37('0x34'),_0x5eab11);}}}else{logger[_0xec37('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5eab11);}};exports[_0xec37('0x35')]=function(_0x2b1ab3){var _0x39410a=moment()[_0xec37('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b1ab3[_0xec37('0x36')]=0xd;_0x2b1ab3[_0xec37('0x37')]=_0xec37('0x38');_0x2b1ab3['starttime']=_0x39410a;_0x2b1ab3[_0xec37('0x39')]=_0x39410a;_0x2b1ab3[_0xec37('0x3a')]=_0x39410a;};exports['logAgent']=function(_0x55aa4d,_0x6f7f15,_0x5eb0f1){var _0x50f49e=moment()[_0xec37('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x55aa4d[_0xec37('0x36')]=_0x6f7f15;_0x55aa4d[_0xec37('0x37')]=_0x5eb0f1;_0x55aa4d[_0xec37('0x39')]=_0x50f49e;_0x55aa4d[_0xec37('0x3b')]=getSeconds(_0x55aa4d[_0xec37('0x39')],_0x55aa4d[_0xec37('0x3c')]);};exports['logLookAgent']=function(_0x4580f3,_0x16e3ad,_0x48553d){_0x4580f3[_0xec37('0x3d')]=_0x16e3ad;_0x4580f3['UserId']=_0x48553d;};exports[_0xec37('0x3e')]=function(_0x228686,_0x2202e2,_0x538d0f){var _0x3566b1=moment()['format'](_0xec37('0x3f'));_0x228686['state']=_0x2202e2;_0x228686['statedesc']=_0x538d0f;_0x228686['responsetime']=_0x228686['responsetime']?_0x228686['responsetime']:_0x3566b1;_0x228686['endtime']=_0x228686[_0xec37('0x3a')]?_0x228686[_0xec37('0x3a')]:_0x3566b1;_0x228686[_0xec37('0x3b')]=getSeconds(_0x228686[_0xec37('0x39')]||0x0,_0x228686['starttime']||0x0);_0x228686[_0xec37('0x40')]=_0x228686[_0xec37('0x41')]?getSeconds(_0x228686[_0xec37('0x3a')],_0x228686['answertime']):0x0;};exports[_0xec37('0x42')]=function(_0x1e0091){return _0x1e0091===_0xec37('0x43');};exports[_0xec37('0x44')]=function(_0x518f84,_0x33c195,_0x52bf0d,_0x3ef228,_0x281344){var _0x1950dd=_0x3ef228?_0xec37('0x45'):_0x518f84[_0xec37('0x1a')];_0x1950dd=_0x281344?'BOOKED':_0x1950dd;return{'actionid':_0x518f84['uniqueid'],'action':_0xec37('0x46'),'channel':_0x518f84[_0xec37('0x47')],'callerid':util[_0xec37('0x12')](_0xec37('0x13'),_0x1950dd,_0x518f84[_0xec37('0x1b')]),'Exten':_0xec37('0x27'),'Context':_0xec37('0x48'),'Priority':'1','variable':_0x52bf0d,'timeout':(_0x33c195[_0xec37('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x518f84[_0xec37('0x4a')]};};exports[_0xec37('0x4b')]=function(_0x5f0c3d){return _0x5f0c3d[_0xec37('0x4c')]+_0x5f0c3d[_0xec37('0x4d')]+_0x5f0c3d[_0xec37('0x4e')]+_0x5f0c3d['countagentrejectretry']+_0x5f0c3d['countnosuchnumberretry'];};exports['cloneAction']=function(_0x13d326){var _0x23a772=_[_0xec37('0x4f')](_0x13d326);_0x23a772[_0xec37('0x36')]=0xf;_0x23a772[_0xec37('0x37')]=_0xec37('0x50');return _0x23a772;};exports[_0xec37('0x51')]=function(_0x7305dd,_0x539737,_0x58b08e){var _0x59a397={};_0x59a397[_0x539737]=_0x7305dd[_0x539737];_0x59a397[_0xec37('0x52')]=![];_0x59a397['scheduledat']=moment()[_0xec37('0x53')](_0x58b08e,_0xec37('0x54'))[_0xec37('0x12')](_0xec37('0x3f'));_0x59a397[_0xec37('0x55')]=_0x7305dd[_0xec37('0x55')];_0x59a397[_0xec37('0x56')]=_0x7305dd[_0xec37('0x56')];_0x59a397[_0xec37('0x1d')]=_0x7305dd[_0xec37('0x1d')]||undefined;return _0x59a397;};exports[_0xec37('0x57')]=function(_0x47e930,_0x4e39c5){if(!_[_0xec37('0x16')](_0x47e930)){if(_0x47e930[_0xec37('0x58')]>0x0){_0x47e930['pTalking']-=0x1;}else{logger[_0xec37('0x9')](_0x4e39c5,_0xec37('0x59'));}}else{logger['error'](_0x4e39c5,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xec37('0x5a')]=function(_0x456765){if(_0x456765<=0x0){return!![];}return![];};exports[_0xec37('0x5b')]=function(_0x37f957,_0x2b8eeb,_0x2e5c0a){_0x37f957['lastevent']=_0x2b8eeb;_0x37f957[_0xec37('0x19')]=_0x37f957['queue'];_0x37f957['interface']=_0x37f957[_0xec37('0x47')];if(_0x2e5c0a){_0x37f957[_0xec37('0x5c')]=_0x2e5c0a[_0xec37('0x5c')];}return _0x37f957;};exports['buildAcw']=function(_0x2bb4d4){var _0x1b6ad3={};_0x1b6ad3[_0xec37('0x5d')]=_0x2bb4d4[_0xec37('0x5d')];_0x1b6ad3[_0xec37('0x5e')]=_0x2bb4d4[_0xec37('0x47')];_0x1b6ad3['uniqueid']=_0x2bb4d4[_0xec37('0x4a')];return _0x1b6ad3;};exports['agentReadyId']=function(_0x4812e1){var _0x13870c=[];for(var _0x4d6923 in _0x4812e1){if(_0x4812e1['hasOwnProperty'](_0x4d6923)){if(!_[_0xec37('0x16')](_0x4812e1[_0x4d6923])&&_0x4812e1[_0x4d6923][_0xec37('0x36')]==='not_inuse'&&_0x4812e1[_0x4d6923][_0xec37('0x5f')]===_0xec37('0x60')){_0x13870c['push'](_0x4812e1[_0x4d6923]['id']);}}}return _0x13870c;};exports[_0xec37('0x61')]=function(_0x42a778){var _0xd98f95=moment()[_0xec37('0x5')](0x0);var _0xc67dd9=moment(_0x42a778)[_0xec37('0x5')](0x0);return _0xd98f95[_0xec37('0x6')](_0xc67dd9,_0xec37('0x7'));};exports[_0xec37('0x62')]=function(_0x3950cd){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3950cd[_0xec37('0x55')],'ListId':_0x3950cd['ListId'],'VoiceQueueId':_0x3950cd[_0xec37('0x1d')]||undefined,'CampaignId':_0x3950cd[_0xec37('0x63')]||undefined};};exports[_0xec37('0x64')]=function(_0x281486){if(_0x281486==='uniqueid'||_0x281486==='idContact'||_0x281486==='queue'||_0x281486===_0xec37('0x65')||_0x281486==='campaigntype'||_0x281486===_0xec37('0x66')||_0x281486===_0xec37('0x3d')||_0x281486===_0xec37('0x47')||_0x281486===_0xec37('0x1a')||_0x281486==='active'||_0x281486===_0xec37('0x1b')||_0x281486===_0xec37('0x67')||_0x281486===_0xec37('0x4c')||_0x281486===_0xec37('0x4d')||_0x281486===_0xec37('0x4e')||_0x281486===_0xec37('0x68')||_0x281486===_0xec37('0x69')||_0x281486==='callbackuniqueid'||_0x281486===_0xec37('0x6a')||_0x281486===_0xec37('0x6b')||_0x281486==='ContactId'||_0x281486===_0xec37('0x56')||_0x281486==='UserId'||_0x281486===_0xec37('0x1d')||_0x281486==='sipcallid'||_0x281486==='xmd-voicequeueid'||_0x281486===_0xec37('0x6c')||_0x281486==='xmd-phone'||_0x281486===_0xec37('0x6d')||_0x281486===_0xec37('0x6e')||_0x281486===_0xec37('0x6f')||_0x281486===_0xec37('0x70')||_0x281486===_0xec37('0x71')||_0x281486==='xmd-dialchannel'||_0x281486==='xmd-contactid'||_0x281486===_0xec37('0x72')||_0x281486===_0xec37('0x73')||_0x281486===_0xec37('0x74')||_0x281486==='xmd-agi'||_0x281486===_0xec37('0x75')||_0x281486===_0xec37('0x76')||_0x281486==='rtpaudioqosjitter'||_0x281486===_0xec37('0x77')||_0x281486===_0xec37('0x78')||_0x281486===_0xec37('0x79')||_0x281486===_0xec37('0x7a')||_0x281486===_0xec37('0x7b')||_0x281486==='rtpaudioqos'||_0x281486===_0xec37('0x76')||_0x281486==='rtpaudioqosjitter'||_0x281486===_0xec37('0x77')||_0x281486==='rtpaudioqosloss'||_0x281486===_0xec37('0x79')||_0x281486===_0xec37('0x7a')||_0x281486===_0xec37('0x7b')||_0x281486===_0xec37('0x7c')||_0x281486==='bridgepvtcallid'||_0x281486==='state'||_0x281486===_0xec37('0x37')){return![];}return!![];};exports[_0xec37('0x7d')]=function(_0x19332e,_0x436004){var _0x5a1c80,_0x27266b,_0x383fd5;if(_0x436004<=0x0){_0x436004=0x1;}_0x5a1c80=new RegExp(_0xec37('0x7e')+_0x436004+'}$');_0x27266b=Math[_0xec37('0x7f')](0xa,_0x436004-0x1);_0x383fd5=Math['pow'](0xa,_0x436004)-0x1;return util[_0xec37('0x12')]('%s',_[_0xec37('0x80')](_0x19332e,_0x5a1c80,_[_0xec37('0x81')](_0x27266b,_0x383fd5)));};exports[_0xec37('0x82')]=function(_0x2a92d2){var _0x1dcbb3=_0x2a92d2[_0xec37('0x83')](/"(.*?)"/);return _0x1dcbb3?_0x1dcbb3[0x1]:_0x2a92d2;};exports[_0xec37('0x84')]=function(_0x1db993){var _0x389928=_0x1db993[_0xec37('0x83')](/<(.*?)>/);return _0x389928?_0x389928[0x1]:_0x1db993;}; \ No newline at end of file +var _0xc9c3=['NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','variablesAction','calleridname','uniqueid','channelAgent','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','name','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','getDiff','createBody','idContact','dialAnswer','active','countglobal','callback','callbackuniqueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitterbridged','bridgepeer','\x5cw{0,','pow','replace','match','extractCalleridNumber','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isNil','Queue','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22'];(function(_0x4ceeb9,_0x43ffe0){var _0x8f988e=function(_0x55df27){while(--_0x55df27){_0x4ceeb9['push'](_0x4ceeb9['shift']());}};_0x8f988e(++_0x43ffe0);}(_0xc9c3,0x159));var _0x3c9c=function(_0x4d4df3,_0xd59407){_0x4d4df3=_0x4d4df3-0x0;var _0x3af292=_0xc9c3[_0x4d4df3];return _0x3af292;};'use strict';var util=require('util');var _=require(_0x3c9c('0x0'));var moment=require(_0x3c9c('0x1'));var logger=require(_0x3c9c('0x2'))('preview');var ipAgi=process[_0x3c9c('0x3')][_0x3c9c('0x4')]||_0x3c9c('0x5');function getSeconds(_0x33af29,_0x599f49){var _0xb5ccc=moment(_0x33af29)['milliseconds'](0x0);var _0x15df8f=moment(_0x599f49)[_0x3c9c('0x6')](0x0);return _0xb5ccc[_0x3c9c('0x7')](_0x15df8f,_0x3c9c('0x8'));}exports[_0x3c9c('0x9')]=function(_0x2f564e){return function(_0x426d37){logger[_0x3c9c('0xa')](_0x2f564e,util['inspect'](_0x426d37,{'showHidden':![],'depth':null}));};};exports[_0x3c9c('0xb')]=function(_0x5359c5,_0x1619f2){logger[_0x3c9c('0xc')](_0x5359c5,util[_0x3c9c('0xd')](_0x1619f2,{'showHidden':![],'depth':null}));};exports[_0x3c9c('0xe')]=function(_0x398b98,_0x1c1129){logger[_0x3c9c('0xa')](_0x398b98,util[_0x3c9c('0xd')](_0x1c1129,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x102b8e){return function(_0x34befb){logger['info'](_0x102b8e,util[_0x3c9c('0xd')](_0x34befb,{'showHidden':![],'depth':null}));};};exports[_0x3c9c('0xf')]=function(_0x3f7803,_0x51f4c8,_0x40d10b){return{'message':_0x3f7803,'unlock':_0x51f4c8,'active':_0x40d10b};};exports[_0x3c9c('0x10')]=function(_0x4a1e4f,_0x8ae2eb,_0x2e6003){if(!_[_0x3c9c('0x11')](_0x2e6003)&&_0x3c9c('0x12')===typeof _0x2e6003&&!_['isEmpty'](_0x2e6003)){if(!_[_0x3c9c('0x11')](_0x8ae2eb)&&_0x3c9c('0x12')===typeof _0x8ae2eb&&!_[_0x3c9c('0x13')](_0x8ae2eb)){return util[_0x3c9c('0x14')](_0x3c9c('0x15'),_0x8ae2eb,_0x2e6003);}return util[_0x3c9c('0x14')](_0x3c9c('0x15'),_0x2e6003,_0x2e6003);}if(!_[_0x3c9c('0x11')](_0x4a1e4f)&&'string'===typeof _0x4a1e4f&&!_[_0x3c9c('0x13')](_0x4a1e4f)){return _0x4a1e4f;}return'\x22\x22\x20<>';};exports['isActive']=function(_0xdfa957){if(_[_0x3c9c('0x16')](_0xdfa957)){return![];}return _0xdfa957;};exports['addVariables']=function(_0x273930,_0x33bf38,_0x4911a5,_0xa6ea8d,_0x482668,_0x50df03){var _0x39b41f={'XMD-QUEUE':_0x33bf38[_0x3c9c('0x17')]?_0x33bf38[_0x3c9c('0x17')]['name']:'','XMD-CALLERID':_0xa6ea8d,'XMD-CALLERID-PREVIEW':_0x50df03?util['format'](_0x3c9c('0x15'),_0x50df03['calleridname'],_0x50df03[_0x3c9c('0x18')]):_0xa6ea8d,'XMD-DIALID':_0x482668,'XMD-CONTACTID':_0x33bf38[_0x3c9c('0x19')],'XMD-CDRTYPE':_0x3c9c('0x1a'),'CALLERID(all)':_0xa6ea8d,'XMD-VOICEQUEUEID':_0x33bf38[_0x3c9c('0x1b')],'XMD-DIALCHANNEL':_0x4911a5,'XMD-DIALTIMEOUT':_0x273930['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x3c9c('0x1c'),_0x273930[_0x3c9c('0x1d')]?'g':'',_[_0x3c9c('0x13')](_0x273930[_0x3c9c('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x273930['dialPreviewUrl']||'','XMD-AGI':_0x273930[_0x3c9c('0x1f')]?util[_0x3c9c('0x14')](_0x3c9c('0x20'),ipAgi,_0x273930[_0x3c9c('0x1f')]):_0x3c9c('0x21'),'XMD-AGIAFTER':_0x273930['dialQueueProject2']?util[_0x3c9c('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x273930[_0x3c9c('0x1d')]):_0x3c9c('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x50df03?_0x50df03['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x50df03?_0x50df03[_0x3c9c('0x22')]:'','XMD-DESTINATION':_0x3c9c('0x23')};if(!_['isEmpty'](_0x273930[_0x3c9c('0x1e')])){_0x39b41f[util['format']('%s',_0x3c9c('0x24'))]=_0x273930['monitor_format'];_0x39b41f[util['format']('%s',_0x3c9c('0x25'))]=_0x482668;}if(_0x33bf38&&_0x33bf38[_0x3c9c('0x26')]){for(var _0x15d533 in _0x33bf38[_0x3c9c('0x26')]){if(_0x33bf38[_0x3c9c('0x26')][_0x3c9c('0x27')](_0x15d533)){if(!_[_0x3c9c('0x16')](_0x33bf38[_0x3c9c('0x26')][_0x15d533])&&_0x15d533!=='id'&&_0x15d533!=='tags'&&_0x15d533!=='createdAt'&&_0x15d533!==_0x3c9c('0x28')){_0x39b41f[util[_0x3c9c('0x14')](_0x3c9c('0x29'),_0x3c9c('0x2a'),_[_0x3c9c('0x2b')](_0x15d533))]=_0x33bf38['Contact'][_0x15d533];}}}}return _0x39b41f;};exports['toLowerVariables']=function(_0x55f86){var _0x1d6c50={};for(var _0x1d4fc0 in _0x55f86){if(_0x55f86['hasOwnProperty'](_0x1d4fc0)){_0x1d6c50[util[_0x3c9c('0x14')]('%s',_[_0x3c9c('0x2c')](_0x1d4fc0))]=_0x55f86[_0x1d4fc0];}}return{'variables':_0x1d6c50};};exports[_0x3c9c('0x2d')]=function(_0x260ea9,_0x2933c0){if(!_[_0x3c9c('0x16')](_0x260ea9)){if(_0x260ea9[_0x3c9c('0x27')](_0x3c9c('0x2e'))){if(_0x260ea9[_0x3c9c('0x2e')]>0x0){_0x260ea9['originated']-=0x1;}else{logger[_0x3c9c('0xa')](_0x3c9c('0x2f'),_0x2933c0);}}}else{logger[_0x3c9c('0xa')](_0x3c9c('0x30'),_0x2933c0);}};exports[_0x3c9c('0x31')]=function(_0x304a1d){var _0x299ba2=moment()[_0x3c9c('0x14')](_0x3c9c('0x32'));_0x304a1d[_0x3c9c('0x33')]=0xd;_0x304a1d['statedesc']=_0x3c9c('0x34');_0x304a1d[_0x3c9c('0x35')]=_0x299ba2;_0x304a1d[_0x3c9c('0x36')]=_0x299ba2;_0x304a1d[_0x3c9c('0x37')]=_0x299ba2;};exports[_0x3c9c('0x38')]=function(_0x4e7529,_0x178361,_0xe29dd8){var _0x5e3fcb=moment()[_0x3c9c('0x14')](_0x3c9c('0x32'));_0x4e7529['state']=_0x178361;_0x4e7529[_0x3c9c('0x39')]=_0xe29dd8;_0x4e7529[_0x3c9c('0x36')]=_0x5e3fcb;_0x4e7529[_0x3c9c('0x3a')]=getSeconds(_0x4e7529['responsetime'],_0x4e7529[_0x3c9c('0x35')]);};exports[_0x3c9c('0x3b')]=function(_0x6c1c6a,_0x312fd9,_0x4b169f){_0x6c1c6a[_0x3c9c('0x3c')]=_0x312fd9;_0x6c1c6a[_0x3c9c('0x3d')]=_0x4b169f;};exports[_0x3c9c('0x3e')]=function(_0x5bd6fb,_0x525712,_0x1062ba){var _0x13592a=moment()[_0x3c9c('0x14')](_0x3c9c('0x32'));_0x5bd6fb[_0x3c9c('0x33')]=_0x525712;_0x5bd6fb[_0x3c9c('0x39')]=_0x1062ba;_0x5bd6fb['responsetime']=_0x5bd6fb[_0x3c9c('0x36')]?_0x5bd6fb[_0x3c9c('0x36')]:_0x13592a;_0x5bd6fb[_0x3c9c('0x37')]=_0x5bd6fb[_0x3c9c('0x37')]?_0x5bd6fb[_0x3c9c('0x37')]:_0x13592a;_0x5bd6fb[_0x3c9c('0x3a')]=getSeconds(_0x5bd6fb[_0x3c9c('0x36')]||0x0,_0x5bd6fb[_0x3c9c('0x35')]||0x0);_0x5bd6fb[_0x3c9c('0x3f')]=_0x5bd6fb[_0x3c9c('0x40')]?getSeconds(_0x5bd6fb[_0x3c9c('0x37')],_0x5bd6fb[_0x3c9c('0x40')]):0x0;};exports['isFailure']=function(_0xc5db8b){return _0xc5db8b==='Failure';};exports[_0x3c9c('0x41')]=function(_0x2b55cd,_0x1a67c8,_0x4f1788,_0x222e0d,_0x4fbd0d){var _0x13e29e=_0x222e0d?'RECALL':_0x2b55cd[_0x3c9c('0x42')];_0x13e29e=_0x4fbd0d?'BOOKED':_0x13e29e;return{'actionid':_0x2b55cd[_0x3c9c('0x43')],'action':'originate','channel':_0x2b55cd[_0x3c9c('0x44')],'callerid':util[_0x3c9c('0x14')]('\x22%s\x22\x20<%s>',_0x13e29e,_0x2b55cd[_0x3c9c('0x18')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x4f1788,'timeout':(_0x1a67c8['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2b55cd[_0x3c9c('0x43')]};};exports[_0x3c9c('0x45')]=function(_0x3d75bb){return _0x3d75bb[_0x3c9c('0x46')]+_0x3d75bb[_0x3c9c('0x47')]+_0x3d75bb[_0x3c9c('0x48')]+_0x3d75bb[_0x3c9c('0x49')]+_0x3d75bb[_0x3c9c('0x4a')];};exports[_0x3c9c('0x4b')]=function(_0x4f4769){var _0x4bfd01=_[_0x3c9c('0x4c')](_0x4f4769);_0x4bfd01['state']=0xf;_0x4bfd01[_0x3c9c('0x39')]=_0x3c9c('0x4d');return _0x4bfd01;};exports[_0x3c9c('0x4e')]=function(_0x3478c7,_0x332f4d,_0x4258b9){var _0x15c6bb={};_0x15c6bb[_0x332f4d]=_0x3478c7[_0x332f4d];_0x15c6bb['active']=![];_0x15c6bb[_0x3c9c('0x4f')]=moment()[_0x3c9c('0x50')](_0x4258b9,_0x3c9c('0x51'))['format'](_0x3c9c('0x32'));_0x15c6bb['ContactId']=_0x3478c7[_0x3c9c('0x19')];_0x15c6bb[_0x3c9c('0x52')]=_0x3478c7[_0x3c9c('0x52')];_0x15c6bb[_0x3c9c('0x1b')]=_0x3478c7['VoiceQueueId']||undefined;return _0x15c6bb;};exports['decrementTalkink']=function(_0x54df41,_0x2eae62){if(!_[_0x3c9c('0x16')](_0x54df41)){if(_0x54df41[_0x3c9c('0x53')]>0x0){_0x54df41['pTalking']-=0x1;}else{logger[_0x3c9c('0xa')](_0x2eae62,_0x3c9c('0x54'));}}else{logger[_0x3c9c('0xa')](_0x2eae62,_0x3c9c('0x55'));}};exports['IsNotLoggedIn']=function(_0x5d3d44){if(_0x5d3d44<=0x0){return!![];}return![];};exports['buildObj']=function(_0x19c4aa,_0x4fc6ee,_0x218c30){_0x19c4aa['lastevent']=_0x4fc6ee;_0x19c4aa[_0x3c9c('0x56')]=_0x19c4aa[_0x3c9c('0x57')];_0x19c4aa[_0x3c9c('0x58')]=_0x19c4aa[_0x3c9c('0x44')];if(_0x218c30){_0x19c4aa[_0x3c9c('0x59')]=_0x218c30[_0x3c9c('0x59')];}return _0x19c4aa;};exports[_0x3c9c('0x5a')]=function(_0x540ef6){var _0x36b578={};_0x36b578['queue']=_0x540ef6[_0x3c9c('0x57')];_0x36b578[_0x3c9c('0x58')]=_0x540ef6[_0x3c9c('0x44')];_0x36b578[_0x3c9c('0x43')]=_0x540ef6[_0x3c9c('0x43')];return _0x36b578;};exports[_0x3c9c('0x5b')]=function(_0x1cb2d5){var _0x20606c=[];for(var _0x3a6537 in _0x1cb2d5){if(_0x1cb2d5[_0x3c9c('0x27')](_0x3a6537)){if(!_[_0x3c9c('0x16')](_0x1cb2d5[_0x3a6537])&&_0x1cb2d5[_0x3a6537][_0x3c9c('0x33')]===_0x3c9c('0x5c')&&_0x1cb2d5[_0x3a6537]['status']===_0x3c9c('0x5d')){_0x20606c['push'](_0x1cb2d5[_0x3a6537]['id']);}}}return _0x20606c;};exports[_0x3c9c('0x5e')]=function(_0x591d0f){var _0x1bec2c=moment()['milliseconds'](0x0);var _0x1bb534=moment(_0x591d0f)[_0x3c9c('0x6')](0x0);return _0x1bec2c[_0x3c9c('0x7')](_0x1bb534,'seconds');};exports[_0x3c9c('0x5f')]=function(_0x191316){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x191316['ContactId'],'ListId':_0x191316[_0x3c9c('0x52')],'VoiceQueueId':_0x191316['VoiceQueueId']||undefined,'CampaignId':_0x191316['CampaignId']||undefined};};exports['filterKey']=function(_0x26dbb4){if(_0x26dbb4==='uniqueid'||_0x26dbb4===_0x3c9c('0x60')||_0x26dbb4==='queue'||_0x26dbb4==='type'||_0x26dbb4==='campaigntype'||_0x26dbb4===_0x3c9c('0x61')||_0x26dbb4===_0x3c9c('0x3c')||_0x26dbb4===_0x3c9c('0x44')||_0x26dbb4===_0x3c9c('0x42')||_0x26dbb4===_0x3c9c('0x62')||_0x26dbb4===_0x3c9c('0x18')||_0x26dbb4===_0x3c9c('0x4f')||_0x26dbb4===_0x3c9c('0x46')||_0x26dbb4===_0x3c9c('0x47')||_0x26dbb4===_0x3c9c('0x48')||_0x26dbb4===_0x3c9c('0x63')||_0x26dbb4===_0x3c9c('0x64')||_0x26dbb4===_0x3c9c('0x65')||_0x26dbb4==='callbackat'||_0x26dbb4==='recallme'||_0x26dbb4===_0x3c9c('0x19')||_0x26dbb4==='ListId'||_0x26dbb4===_0x3c9c('0x3d')||_0x26dbb4===_0x3c9c('0x1b')||_0x26dbb4==='sipcallid'||_0x26dbb4==='xmd-voicequeueid'||_0x26dbb4===_0x3c9c('0x66')||_0x26dbb4===_0x3c9c('0x67')||_0x26dbb4===_0x3c9c('0x68')||_0x26dbb4===_0x3c9c('0x69')||_0x26dbb4===_0x3c9c('0x6a')||_0x26dbb4==='xmd-dialoptions'||_0x26dbb4===_0x3c9c('0x6b')||_0x26dbb4===_0x3c9c('0x6c')||_0x26dbb4===_0x3c9c('0x6d')||_0x26dbb4===_0x3c9c('0x6e')||_0x26dbb4===_0x3c9c('0x6f')||_0x26dbb4===_0x3c9c('0x70')||_0x26dbb4==='xmd-agi'||_0x26dbb4==='rtpaudioqos'||_0x26dbb4===_0x3c9c('0x71')||_0x26dbb4===_0x3c9c('0x72')||_0x26dbb4==='rtpaudioqosjitterbridged'||_0x26dbb4===_0x3c9c('0x73')||_0x26dbb4==='rtpaudioqoslossbridged'||_0x26dbb4===_0x3c9c('0x74')||_0x26dbb4===_0x3c9c('0x75')||_0x26dbb4===_0x3c9c('0x76')||_0x26dbb4===_0x3c9c('0x71')||_0x26dbb4===_0x3c9c('0x72')||_0x26dbb4===_0x3c9c('0x77')||_0x26dbb4==='rtpaudioqosloss'||_0x26dbb4==='rtpaudioqoslossbridged'||_0x26dbb4===_0x3c9c('0x74')||_0x26dbb4===_0x3c9c('0x75')||_0x26dbb4===_0x3c9c('0x78')||_0x26dbb4==='bridgepvtcallid'||_0x26dbb4===_0x3c9c('0x33')||_0x26dbb4===_0x3c9c('0x39')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3f4a8e,_0x5c7e08){var _0xbb9e99,_0x572863,_0x246c97;if(_0x5c7e08<=0x0){_0x5c7e08=0x1;}_0xbb9e99=new RegExp(_0x3c9c('0x79')+_0x5c7e08+'}$');_0x572863=Math[_0x3c9c('0x7a')](0xa,_0x5c7e08-0x1);_0x246c97=Math[_0x3c9c('0x7a')](0xa,_0x5c7e08)-0x1;return util[_0x3c9c('0x14')]('%s',_[_0x3c9c('0x7b')](_0x3f4a8e,_0xbb9e99,_['random'](_0x572863,_0x246c97)));};exports['extractCalleridName']=function(_0x10240c){var _0x233006=_0x10240c[_0x3c9c('0x7c')](/"(.*?)"/);return _0x233006?_0x233006[0x1]:_0x10240c;};exports[_0x3c9c('0x7d')]=function(_0x41e091){var _0x35ee24=_0x41e091[_0x3c9c('0x7c')](/<(.*?)>/);return _0x35ee24?_0x35ee24[0x1]:_0x41e091;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 5755d6c..a0344ea 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(_0x1bee37,_0x3bff05){var _0xae2e94=function(_0x32f7b9){while(--_0x32f7b9){_0x1bee37['push'](_0x1bee37['shift']());}};_0xae2e94(++_0x3bff05);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f06fa,_0x31c38b){_0x4f06fa=_0x4f06fa-0x0;var _0x25c1a1=_0xb10b[_0x4f06fa];return _0x25c1a1;};'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 _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x5c46ee,_0x44af29){var _0x56eb24=function(_0x3b124f){while(--_0x3b124f){_0x5c46ee['push'](_0x5c46ee['shift']());}};_0x56eb24(++_0x44af29);}(_0x7a54,0x106));var _0x47a5=function(_0x1e27df,_0x156d10){_0x1e27df=_0x1e27df-0x0;var _0x31cb10=_0x7a54[_0x1e27df];return _0x31cb10;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 19a6c5a..49cf161 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 _0x7cfb=['unmanaged','abandoned','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks','trunks','initVoiceQueues','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','servicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','../model/agent','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','sugarcrmAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','answered'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x7cfb,0xa9));var _0xb7cf=function(_0x548202,_0x5243f6){_0x548202=_0x548202-0x0;var _0x4574d7=_0x7cfb[_0x548202];return _0x4574d7;};'use strict';var BPromise=require(_0xb7cf('0x0'));var util=require(_0xb7cf('0x1'));var _=require(_0xb7cf('0x2'));var moment=require('moment');var Agent=require(_0xb7cf('0x3'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xb7cf('0x4'));var Template=require(_0xb7cf('0x5'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xb7cf('0x6'));var ZendeskAccount=require(_0xb7cf('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xb7cf('0x8'));var SugarcrmAccount=require(_0xb7cf('0x9'));var ZohoAccount=require(_0xb7cf('0xa'));var DeskAccount=require(_0xb7cf('0xb'));var VtigerAccount=require(_0xb7cf('0xc'));var ServicenowAccount=require(_0xb7cf('0xd'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xb7cf('0xe'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xb7cf('0xf')]={};this[_0xb7cf('0x10')]={};this['trunks']={};this[_0xb7cf('0x11')]={};this[_0xb7cf('0x12')]={};this[_0xb7cf('0x13')]={};this[_0xb7cf('0x14')]={};this[_0xb7cf('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xb7cf('0x16')]={};this[_0xb7cf('0x17')]={};this[_0xb7cf('0x18')]={};this[_0xb7cf('0x19')]={};this[_0xb7cf('0x1a')]={};this[_0xb7cf('0x1b')]={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0xb7cf('0x1c')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this['deskAccounts']={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0xb7cf('0x1d')]={};this[_0xb7cf('0x1e')]={};this['faxAccounts']={};};function freeIsNotKey(_0x34354d,_0x404db5,_0x34cafe){var _0x49f3db=_[_0xb7cf('0x1f')](_0x34354d,function(_0x48adab,_0xaa8810){return _0x48adab[_0x34cafe];});for(var _0x3ebe60 in _0x404db5){if(_0x404db5[_0xb7cf('0x20')](_0x3ebe60)){if(!_0x49f3db[_0x3ebe60]){delete _0x404db5[_0x3ebe60];}}}}function freeIsNotKeySip(_0x43f123,_0x3af6e0){var _0x57cb73=_[_0xb7cf('0x1f')](_0x43f123,function(_0x12aa58,_0x279923){return util[_0xb7cf('0x21')](_0xb7cf('0x22'),_0x12aa58[_0xb7cf('0x23')]);});for(var _0x396b73 in _0x3af6e0){if(_0x3af6e0[_0xb7cf('0x20')](_0x396b73)){if(!_0x57cb73[_0x396b73]){delete _0x3af6e0[_0x396b73];}}}}function freeIsNotKeyAgent(_0x29f811,_0x8a8083){var _0x508d3c=_['mapKeys'](_0x29f811,function(_0x1952d5,_0x4ae5dd){var _0x4d077b=_[_0xb7cf('0x24')](_0x1952d5[_0xb7cf('0x25')])?util[_0xb7cf('0x21')](_0xb7cf('0x22'),_0x1952d5[_0xb7cf('0x23')]):_0x1952d5['interface'];return _0x4d077b;});for(var _0x32cdfd in _0x8a8083){if(_0x8a8083[_0xb7cf('0x20')](_0x32cdfd)){if(!_0x508d3c[_0x32cdfd]){delete _0x8a8083[_0x32cdfd];}}}}function clearVoiceCallReports(_0x50dcee){_0x50dcee[_0xb7cf('0x26')]=0x0;_0x50dcee['answered']=0x0;_0x50dcee[_0xb7cf('0x27')]=0x0;_0x50dcee[_0xb7cf('0x28')]=0x0;_0x50dcee[_0xb7cf('0x29')]=0x0;}function clearCampaigns(_0x866abd){if(!_['isEmpty'](_0x866abd)){for(var _0x53689c in _0x866abd){if(_0x866abd[_0xb7cf('0x20')](_0x53689c)){_0x866abd[_0x53689c][_0xb7cf('0x2a')]=0x0;_0x866abd[_0x53689c][_0xb7cf('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x1b0ae2){if(!_['isEmpty'](_0x1b0ae2)){for(var _0x1c708a in _0x1b0ae2){if(_0x1b0ae2[_0xb7cf('0x20')](_0x1c708a)){_0x1b0ae2[_0x1c708a]['total']=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x2c')]=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x2d')]=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x2e')]=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x27')]=0x0;_0x1b0ae2[_0x1c708a]['sumDuration']=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x29')]=0x0;_0x1b0ae2[_0x1c708a]['outboundAnswerAgiCallsDay']=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x2f')]=0x0;_0x1b0ae2[_0x1c708a]['outboundBusyCallsDay']=0x0;_0x1b0ae2[_0x1c708a]['outboundCongestionCallsDay']=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x30')]=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x31')]=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x32')]=0x0;_0x1b0ae2[_0x1c708a]['outboundDropCallsDayCallersExit']=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x33')]=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x34')]=0x0;_0x1b0ae2[_0x1c708a]['outboundRejectCallsDay']=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x35')]=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x36')]=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x37')]=0x0;_0x1b0ae2[_0x1c708a][_0xb7cf('0x38')]=!![];}}}}Realtime[_0xb7cf('0x39')]['mergeFromDatabase']=function(_0x4ac28b,_0x4f4214){for(var _0x3ada31 in _0x4f4214){if(_0x4ac28b[_0xb7cf('0x20')](_0x3ada31)){_0x4ac28b[_0x3ada31]=_0x4f4214[_0x3ada31];}}};Realtime[_0xb7cf('0x39')][_0xb7cf('0x3a')]=function(){var _0x46eb26=this;return function(_0x4118fd){if(_0x4118fd){freeIsNotKeyAgent(_0x4118fd,_0x46eb26[_0xb7cf('0xf')]);for(var _0x4d531c=0x0,_0x44a0e6={},_0x21ebad={};_0x4d531c<_0x4118fd[_0xb7cf('0x3b')];_0x4d531c+=0x1){_0x44a0e6=_0x4118fd[_0x4d531c];var _0x55c3c1=_[_0xb7cf('0x24')](_0x44a0e6[_0xb7cf('0x25')])?util[_0xb7cf('0x21')](_0xb7cf('0x22'),_0x44a0e6[_0xb7cf('0x23')]):_0x44a0e6['interface'];if(_[_0xb7cf('0x3c')](_0x46eb26['agents'][_0x55c3c1])){_0x46eb26['agents'][_0x55c3c1]=new Agent(_0x44a0e6);}else{_0x46eb26[_0xb7cf('0x3d')](_0x46eb26['agents'][_0x55c3c1],_0x44a0e6);}}}return _0x46eb26['agents'];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x3e')]=function(){var _0x1b317d=this;return function(_0x92023){if(_0x92023){freeIsNotKeySip(_0x92023,_0x1b317d[_0xb7cf('0x10')]);for(var _0x28769f=0x0,_0x4039bc={},_0x19f29e={};_0x28769f<_0x92023[_0xb7cf('0x3b')];_0x28769f+=0x1){_0x4039bc=_0x92023[_0x28769f];if(_[_0xb7cf('0x3c')](_0x1b317d[_0xb7cf('0x10')][util[_0xb7cf('0x21')](_0xb7cf('0x22'),_0x4039bc[_0xb7cf('0x23')])])){_0x1b317d[_0xb7cf('0x10')][util[_0xb7cf('0x21')](_0xb7cf('0x22'),_0x4039bc['name'])]=new Telephone(_0x4039bc);}else{_0x1b317d[_0xb7cf('0x3d')](_0x1b317d['telephones'][util[_0xb7cf('0x21')](_0xb7cf('0x22'),_0x4039bc[_0xb7cf('0x23')])],_0x4039bc);}}}return _0x1b317d['telephones'];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x3f')]=function(){var _0x2a8055=this;return function(_0x541125){if(_0x541125){freeIsNotKeySip(_0x541125,_0x2a8055[_0xb7cf('0x40')]);for(var _0x52614b=0x0,_0x18d5ff={},_0x5bf03c={};_0x52614b<_0x541125['length'];_0x52614b+=0x1){_0x18d5ff=_0x541125[_0x52614b];if(_[_0xb7cf('0x3c')](_0x2a8055[_0xb7cf('0x40')][util[_0xb7cf('0x21')]('SIP/%s',_0x18d5ff[_0xb7cf('0x23')])])){_0x2a8055[_0xb7cf('0x40')][util[_0xb7cf('0x21')](_0xb7cf('0x22'),_0x18d5ff[_0xb7cf('0x23')])]=new Trunk(_0x18d5ff);}else{_0x2a8055[_0xb7cf('0x3d')](_0x2a8055[_0xb7cf('0x40')][util['format']('SIP/%s',_0x18d5ff[_0xb7cf('0x23')])],_0x18d5ff);}}}return _0x2a8055['trunks'];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x41')]=function(){var _0x5c8070=this;return function(_0x4d822f){if(_0x4d822f){freeIsNotKey(_0x4d822f,_0x5c8070[_0xb7cf('0x11')],_0xb7cf('0x23'));for(var _0x9106bb=0x0,_0x3a6369={},_0x9c2387={};_0x9106bb<_0x4d822f[_0xb7cf('0x3b')];_0x9106bb+=0x1){_0x3a6369=_0x4d822f[_0x9106bb];if(_[_0xb7cf('0x3c')](_0x5c8070[_0xb7cf('0x11')][_0x3a6369['name']])){_0x5c8070[_0xb7cf('0x11')][_0x3a6369[_0xb7cf('0x23')]]=new VoiceQueue(_0x3a6369);}else{_0x5c8070[_0xb7cf('0x3d')](_0x5c8070[_0xb7cf('0x11')][_0x3a6369[_0xb7cf('0x23')]],_0x3a6369);}}}return _0x5c8070['voiceQueues'];};};Realtime[_0xb7cf('0x39')]['initTriggers']=function(){var _0x2dabf3=this;return function(_0x15644a){if(_0x15644a){freeIsNotKey(_0x15644a,_0x2dabf3[_0xb7cf('0x12')],'id');for(var _0x341378=0x0,_0x4883e5={},_0xab3bf3={};_0x341378<_0x15644a[_0xb7cf('0x3b')];_0x341378+=0x1){_0x4883e5=_0x15644a[_0x341378];if(_[_0xb7cf('0x3c')](_0x2dabf3['triggers'][_0x4883e5['id']])){_0x2dabf3[_0xb7cf('0x12')][_0x4883e5['id']]=new Trigger(_0x4883e5);}else{_0x2dabf3[_0xb7cf('0x3d')](_0x2dabf3['triggers'][_0x4883e5['id']],_0x4883e5);}}}return _0x2dabf3[_0xb7cf('0x12')];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x42')]=function(){var _0x25c1bc=this;return function(_0x3e01bb){if(_0x3e01bb){freeIsNotKey(_0x3e01bb,_0x25c1bc[_0xb7cf('0x14')],'id');for(var _0x5cb3a7=0x0,_0x878451={},_0x169061={};_0x5cb3a7<_0x3e01bb[_0xb7cf('0x3b')];_0x5cb3a7+=0x1){_0x878451=_0x3e01bb[_0x5cb3a7];if(_[_0xb7cf('0x3c')](_0x25c1bc[_0xb7cf('0x14')][_0x878451['id']])){_0x25c1bc[_0xb7cf('0x14')][_0x878451['id']]=new Template(_0x878451);}else{_0x25c1bc[_0xb7cf('0x3d')](_0x25c1bc[_0xb7cf('0x14')][_0x878451['id']],_0x878451);}}}return _0x25c1bc[_0xb7cf('0x14')];};};Realtime['prototype'][_0xb7cf('0x43')]=function(){var _0x5affaf=this;return function(_0x5eb4ce){if(_0x5eb4ce){freeIsNotKey(_0x5eb4ce,_0x5affaf[_0xb7cf('0x44')],'id');for(var _0x302a68=0x0,_0x24adbb={},_0x4a487c={};_0x302a68<_0x5eb4ce[_0xb7cf('0x3b')];_0x302a68+=0x1){_0x24adbb=_0x5eb4ce[_0x302a68];if(_[_0xb7cf('0x3c')](_0x5affaf[_0xb7cf('0x44')][_0x24adbb['id']])){_0x5affaf['zendeskAccounts'][_0x24adbb['id']]=new ZendeskAccount(_0x24adbb);}else{_0x5affaf['mergeFromDatabase'](_0x5affaf[_0xb7cf('0x44')][_0x24adbb['id']],_0x24adbb);}}}return _0x5affaf[_0xb7cf('0x44')];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x45')]=function(){var _0x1985e8=this;return function(_0x42a5fa){if(_0x42a5fa){freeIsNotKey(_0x42a5fa,_0x1985e8[_0xb7cf('0x46')],'id');for(var _0x91a326=0x0,_0x131a0c={},_0x5591df={};_0x91a326<_0x42a5fa['length'];_0x91a326+=0x1){_0x131a0c=_0x42a5fa[_0x91a326];if(_[_0xb7cf('0x3c')](_0x1985e8[_0xb7cf('0x46')][_0x131a0c['id']])){_0x1985e8[_0xb7cf('0x46')][_0x131a0c['id']]=new SalesforceAccount(_0x131a0c);}else{_0x1985e8['mergeFromDatabase'](_0x1985e8['salesforceAccounts'][_0x131a0c['id']],_0x131a0c);}}}return _0x1985e8[_0xb7cf('0x46')];};};Realtime[_0xb7cf('0x39')]['initFreshdeskAccounts']=function(){var _0x363422=this;return function(_0x54914a){if(_0x54914a){freeIsNotKey(_0x54914a,_0x363422['freshdeskAccounts'],'id');for(var _0x5baec2=0x0,_0x1d65e9={},_0x333d73={};_0x5baec2<_0x54914a['length'];_0x5baec2+=0x1){_0x1d65e9=_0x54914a[_0x5baec2];if(_['isUndefined'](_0x363422['freshdeskAccounts'][_0x1d65e9['id']])){_0x363422[_0xb7cf('0x47')][_0x1d65e9['id']]=new FreshdeskAccount(_0x1d65e9);}else{_0x363422[_0xb7cf('0x3d')](_0x363422[_0xb7cf('0x47')][_0x1d65e9['id']],_0x1d65e9);}}}return _0x363422[_0xb7cf('0x47')];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x48')]=function(){var _0x5107ac=this;return function(_0x39e262){if(_0x39e262){freeIsNotKey(_0x39e262,_0x5107ac[_0xb7cf('0x49')],'id');for(var _0x11e471=0x0,_0x5bcb06={},_0x220efb={};_0x11e471<_0x39e262[_0xb7cf('0x3b')];_0x11e471+=0x1){_0x5bcb06=_0x39e262[_0x11e471];if(_[_0xb7cf('0x3c')](_0x5107ac[_0xb7cf('0x49')][_0x5bcb06['id']])){_0x5107ac[_0xb7cf('0x49')][_0x5bcb06['id']]=new ZohoAccount(_0x5bcb06);}else{_0x5107ac[_0xb7cf('0x3d')](_0x5107ac[_0xb7cf('0x49')][_0x5bcb06['id']],_0x5bcb06);}}}return _0x5107ac[_0xb7cf('0x49')];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x4a')]=function(){var _0x3d906d=this;return function(_0x5daec0){if(_0x5daec0){freeIsNotKey(_0x5daec0,_0x3d906d[_0xb7cf('0x4b')],'id');for(var _0x14da46=0x0,_0x467d6f={},_0x2cbc5d={};_0x14da46<_0x5daec0['length'];_0x14da46+=0x1){_0x467d6f=_0x5daec0[_0x14da46];if(_['isUndefined'](_0x3d906d['deskAccounts'][_0x467d6f['id']])){_0x3d906d[_0xb7cf('0x4b')][_0x467d6f['id']]=new DeskAccount(_0x467d6f);}else{_0x3d906d[_0xb7cf('0x3d')](_0x3d906d['deskAccounts'][_0x467d6f['id']],_0x467d6f);}}}return _0x3d906d[_0xb7cf('0x4b')];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x4c')]=function(){var _0x5639fe=this;return function(_0x28db9e){if(_0x28db9e){freeIsNotKey(_0x28db9e,_0x5639fe['sugarcrmAccounts'],'id');for(var _0x4f852e=0x0,_0xccd19d={},_0x40f756={};_0x4f852e<_0x28db9e[_0xb7cf('0x3b')];_0x4f852e+=0x1){_0xccd19d=_0x28db9e[_0x4f852e];if(_['isUndefined'](_0x5639fe[_0xb7cf('0x1c')][_0xccd19d['id']])){_0x5639fe['sugarcrmAccounts'][_0xccd19d['id']]=new SugarcrmAccount(_0xccd19d);}else{_0x5639fe[_0xb7cf('0x3d')](_0x5639fe[_0xb7cf('0x1c')][_0xccd19d['id']],_0xccd19d);}}}return _0x5639fe[_0xb7cf('0x1c')];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x4d')]=function(){var _0x2fab02=this;return function(_0x2dc603){if(_0x2dc603){freeIsNotKey(_0x2dc603,_0x2fab02[_0xb7cf('0x4e')],'id');for(var _0x360250=0x0,_0x19ea51={},_0x53e55={};_0x360250<_0x2dc603[_0xb7cf('0x3b')];_0x360250+=0x1){_0x19ea51=_0x2dc603[_0x360250];if(_[_0xb7cf('0x3c')](_0x2fab02[_0xb7cf('0x4e')][_0x19ea51['id']])){_0x2fab02['vtigerAccounts'][_0x19ea51['id']]=new VtigerAccount(_0x19ea51);}else{_0x2fab02[_0xb7cf('0x3d')](_0x2fab02[_0xb7cf('0x4e')][_0x19ea51['id']],_0x19ea51);}}}return _0x2fab02[_0xb7cf('0x4e')];};};Realtime[_0xb7cf('0x39')]['initServicenowAccounts']=function(){var _0x35bcbb=this;return function(_0x269d8b){if(_0x269d8b){freeIsNotKey(_0x269d8b,_0x35bcbb[_0xb7cf('0x4f')],'id');for(var _0x551a8c=0x0,_0x2bce75={},_0x3eeaf0={};_0x551a8c<_0x269d8b[_0xb7cf('0x3b')];_0x551a8c+=0x1){_0x2bce75=_0x269d8b[_0x551a8c];if(_[_0xb7cf('0x3c')](_0x35bcbb[_0xb7cf('0x4f')][_0x2bce75['id']])){_0x35bcbb[_0xb7cf('0x4f')][_0x2bce75['id']]=new ServicenowAccount(_0x2bce75);}else{_0x35bcbb[_0xb7cf('0x3d')](_0x35bcbb[_0xb7cf('0x4f')][_0x2bce75['id']],_0x2bce75);}}}return _0x35bcbb['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x4ef66d=this;return function(_0x558d4d){if(_0x558d4d){freeIsNotKey(_0x558d4d,_0x4ef66d['dynamics365Accounts'],'id');for(var _0x70cde3=0x0,_0x201861={},_0x32f1ba={};_0x70cde3<_0x558d4d[_0xb7cf('0x3b')];_0x70cde3+=0x1){_0x201861=_0x558d4d[_0x70cde3];if(_[_0xb7cf('0x3c')](_0x4ef66d[_0xb7cf('0x1d')][_0x201861['id']])){_0x4ef66d[_0xb7cf('0x1d')][_0x201861['id']]=new Dynamics365Account(_0x201861);}else{_0x4ef66d['mergeFromDatabase'](_0x4ef66d[_0xb7cf('0x1d')][_0x201861['id']],_0x201861);}}}return _0x4ef66d[_0xb7cf('0x1d')];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x50')]=function(){var _0x2d8f2b=this;return function(_0x5580d5){if(_0x5580d5){freeIsNotKey(_0x5580d5,_0x2d8f2b['freshsalesAccounts'],'id');for(var _0x4c0978=0x0,_0x49352b={},_0x22d70a={};_0x4c0978<_0x5580d5[_0xb7cf('0x3b')];_0x4c0978+=0x1){_0x49352b=_0x5580d5[_0x4c0978];if(_[_0xb7cf('0x3c')](_0x2d8f2b[_0xb7cf('0x1e')][_0x49352b['id']])){_0x2d8f2b[_0xb7cf('0x1e')][_0x49352b['id']]=new FreshsalesAccount(_0x49352b);}else{_0x2d8f2b[_0xb7cf('0x3d')](_0x2d8f2b[_0xb7cf('0x1e')][_0x49352b['id']],_0x49352b);}}}return _0x2d8f2b[_0xb7cf('0x1e')];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x51')]=function(){var _0x249e3c=this;return function(_0x4111b5){for(var _0x5993de=0x0;_0x5993de<_0x4111b5[_0xb7cf('0x3b')];_0x5993de+=0x1){_['merge'](_0x249e3c[_0xb7cf('0x11')][_0x4111b5[_0x5993de][_0xb7cf('0x23')]],_0x4111b5[_0x5993de]);}return _0x249e3c['voiceQueues'];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x52')]=function(){var _0x4f5812=this;return function(_0x5de0d6){clearVoiceQueues(_0x4f5812[_0xb7cf('0x11')]);if(_0x5de0d6){_0x5de0d6=_[_0xb7cf('0x53')](_0x5de0d6,'uniqueid');for(var _0xea2e64 in _0x5de0d6){if(_0x5de0d6[_0xb7cf('0x20')](_0xea2e64)){var _0x3f22d2={};for(var _0x590fba=0x0;_0x590fba<_0x5de0d6[_0xea2e64][_0xb7cf('0x3b')];_0x590fba+=0x1){var _0x1f51b6=_0x5de0d6[_0xea2e64][_0x590fba][_0xb7cf('0x54')];if(_0x4f5812[_0xb7cf('0x11')][_0x1f51b6]){if(_0x5de0d6[_0xea2e64][_0x590fba][_0xb7cf('0x55')]){_0x4f5812[_0xb7cf('0x11')][_0x1f51b6][_0xb7cf('0x2d')]+=0x1;}if(_0x5de0d6[_0xea2e64][_0x590fba][_0xb7cf('0x56')]){_0x4f5812[_0xb7cf('0x11')][_0x1f51b6][_0xb7cf('0x2e')]+=0x1;}_0x4f5812[_0xb7cf('0x11')][_0x1f51b6][_0xb7cf('0x27')]+=moment(_0x5de0d6[_0xea2e64][_0x590fba][_0xb7cf('0x57')])[_0xb7cf('0x58')](moment(_0x5de0d6[_0xea2e64][_0x590fba][_0xb7cf('0x59')]),'seconds')||0x0;if(_0x590fba===_0x5de0d6[_0xea2e64][_0xb7cf('0x3b')]-0x1){_0x4f5812['voiceQueues'][_0x1f51b6][_0xb7cf('0x28')]+=moment(_0x5de0d6[_0xea2e64][_0x590fba][_0xb7cf('0x5a')]||_0x5de0d6[_0xea2e64][_0x590fba][_0xb7cf('0x5b')]||_0x5de0d6[_0xea2e64][_0x590fba][_0xb7cf('0x5c')])[_0xb7cf('0x58')](moment(_0x5de0d6[_0xea2e64][_0x590fba][_0xb7cf('0x59')]),_0xb7cf('0x5d'))||0x0;_0x4f5812['voiceQueues'][_0x1f51b6][_0xb7cf('0x26')]+=0x1;if(_0x5de0d6[_0xea2e64][_0x590fba][_0xb7cf('0x5e')]){_0x4f5812['voiceQueues'][_0x1f51b6][_0xb7cf('0x2c')]+=0x1;_0x4f5812['voiceQueues'][_0x1f51b6][_0xb7cf('0x29')]+=moment(_0x5de0d6[_0xea2e64][_0x590fba]['queuecallercompleteAt'])['diff'](moment(_0x5de0d6[_0xea2e64][_0x590fba][_0xb7cf('0x57')]),_0xb7cf('0x5d'))||0x0;}}else{_0x4f5812[_0xb7cf('0x11')][_0x1f51b6][_0xb7cf('0x28')]+=_0x4f5812[_0xb7cf('0x11')][_0x1f51b6][_0xb7cf('0x27')]||0x0;}}}}}}return _0x4f5812[_0xb7cf('0x11')];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x5f')]=function(){var _0x31582f=this;return function(_0x8e8aaa){clearVoiceCallReports(_0x31582f[_0xb7cf('0x15')]);if(_0x8e8aaa){for(var _0x424fe4=0x0;_0x424fe4<_0x8e8aaa[_0xb7cf('0x3b')];_0x424fe4+=0x1){_0x31582f[_0xb7cf('0x15')][_0xb7cf('0x26')]+=0x1;_0x31582f[_0xb7cf('0x15')][_0xb7cf('0x28')]+=_0x8e8aaa[_0x424fe4][_0xb7cf('0x60')];if(_0x8e8aaa[_0x424fe4][_0xb7cf('0x61')]===_0xb7cf('0x62')){_0x31582f['outbound'][_0xb7cf('0x2c')]+=0x1;_0x31582f[_0xb7cf('0x15')][_0xb7cf('0x27')]+=_0x8e8aaa[_0x424fe4]['duration']-_0x8e8aaa[_0x424fe4]['billableseconds']||0x0;_0x31582f[_0xb7cf('0x15')][_0xb7cf('0x29')]+=_0x8e8aaa[_0x424fe4]['billableseconds'];}}}return _0x31582f[_0xb7cf('0x15')];};};Realtime[_0xb7cf('0x39')]['initCampaigns']=function(){var _0x3ce197=this;return function(_0x4b3ca2){if(_0x4b3ca2){freeIsNotKey(_0x4b3ca2,_0x3ce197[_0xb7cf('0x13')],_0xb7cf('0x23'));for(var _0x5b4e71=0x0,_0x48c4e8={};_0x5b4e71<_0x4b3ca2[_0xb7cf('0x3b')];_0x5b4e71+=0x1){_0x48c4e8=_0x4b3ca2[_0x5b4e71];if(_['isUndefined'](_0x3ce197[_0xb7cf('0x13')][_0x48c4e8[_0xb7cf('0x23')]])){_0x3ce197[_0xb7cf('0x13')][_0x48c4e8['name']]=new Campaign(_0x48c4e8);}else{_0x3ce197[_0xb7cf('0x3d')](_0x3ce197[_0xb7cf('0x13')][_0x48c4e8[_0xb7cf('0x23')]],_0x48c4e8);_0x3ce197[_0xb7cf('0x13')][_0x48c4e8[_0xb7cf('0x23')]][_0xb7cf('0x63')]=_0x48c4e8[_0xb7cf('0x64')]?_0x48c4e8[_0xb7cf('0x64')][_0xb7cf('0x23')]:undefined;}}}return _0x3ce197[_0xb7cf('0x13')];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x65')]=function(){var _0x21f2a7=this;return function(_0x2b3b72){if(_0x2b3b72){freeIsNotKey(_0x2b3b72,_0x21f2a7['voiceExtensions'],'id');for(var _0x4b2ed8=0x0,_0x53b194={};_0x4b2ed8<_0x2b3b72[_0xb7cf('0x3b')];_0x4b2ed8+=0x1){_0x53b194=_0x2b3b72[_0x4b2ed8];if(_[_0xb7cf('0x3c')](_0x21f2a7[_0xb7cf('0x16')][_0x53b194['id']])){_0x21f2a7[_0xb7cf('0x16')][_0x53b194['id']]=new VoiceExtension(_0x53b194);}else{_0x21f2a7[_0xb7cf('0x3d')](_0x21f2a7['voiceExtensions'][_0x53b194['id']],_0x53b194);}}}return _0x21f2a7['voiceExtensions'];};};Realtime[_0xb7cf('0x39')][_0xb7cf('0x66')]=function(){var _0x16b2e1=this;return function(_0x25d19d){clearCampaigns(_0x16b2e1[_0xb7cf('0x13')]);for(var _0x351c9b=0x0;_0x351c9b<_0x25d19d[_0xb7cf('0x3b')];_0x351c9b+=0x1){_[_0xb7cf('0x67')](_0x16b2e1['campaigns'][_0x25d19d[_0x351c9b][_0xb7cf('0x23')]],_0x25d19d[_0x351c9b]);}return _0x16b2e1[_0xb7cf('0x13')];};};Realtime['prototype'][_0xb7cf('0x68')]=function(){var _0x3ae437=this;return function(_0x172e2f){if(_0x172e2f){freeIsNotKey(_0x172e2f,_0x3ae437['faxAccounts'],'id');for(var _0x2c34f6=0x0,_0x409360={},_0x13b818={};_0x2c34f6<_0x172e2f[_0xb7cf('0x3b')];_0x2c34f6+=0x1){_0x409360=_0x172e2f[_0x2c34f6];if(_['isUndefined'](_0x3ae437[_0xb7cf('0x69')][_0x409360['id']])){_0x3ae437[_0xb7cf('0x69')][_0x409360['id']]=new FaxAccount(_0x409360);}else{_0x3ae437[_0xb7cf('0x3d')](_0x3ae437['faxAccounts'][_0x409360['id']],_0x409360);}}}return _0x3ae437[_0xb7cf('0x69')];};};Realtime[_0xb7cf('0x39')]['initSettings']=function(){var _0x1b095b=this;return function(_0x4d48a7){_0x1b095b[_0xb7cf('0x1b')]=_0x4d48a7;return _0x1b095b[_0xb7cf('0x1b')];};};module[_0xb7cf('0x6a')]=Realtime; \ No newline at end of file +var _0x7fd6=['groupBy','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','seconds','diff','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','initSettings','bluebird','lodash','moment','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','campaigns','templates','outbound','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','isNil','initTelephones','length','isUndefined','trunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x7fd6,0x157));var _0x67fd=function(_0x2ccc66,_0x313d87){_0x2ccc66=_0x2ccc66-0x0;var _0x3fa5a0=_0x7fd6[_0x2ccc66];return _0x3fa5a0;};'use strict';var BPromise=require(_0x67fd('0x0'));var util=require('util');var _=require(_0x67fd('0x1'));var moment=require(_0x67fd('0x2'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0x67fd('0x3'));var VoiceQueue=require(_0x67fd('0x4'));var Trigger=require(_0x67fd('0x5'));var Template=require('../model/template');var Campaign=require(_0x67fd('0x6'));var VoiceExtension=require(_0x67fd('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x67fd('0x8'));var FreshdeskAccount=require(_0x67fd('0x9'));var SugarcrmAccount=require(_0x67fd('0xa'));var ZohoAccount=require(_0x67fd('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x67fd('0xc'));var ServicenowAccount=require(_0x67fd('0xd'));var Dynamics365Account=require(_0x67fd('0xe'));var FreshsalesAccount=require(_0x67fd('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x67fd('0x10')]={};this[_0x67fd('0x11')]={};this['trunks']={};this[_0x67fd('0x12')]={};this[_0x67fd('0x13')]={};this[_0x67fd('0x14')]={};this[_0x67fd('0x15')]={};this[_0x67fd('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0x67fd('0x17')]={};this[_0x67fd('0x18')]={};this[_0x67fd('0x19')]={};this[_0x67fd('0x1a')]={};this[_0x67fd('0x1b')]={};this[_0x67fd('0x1c')]={};this[_0x67fd('0x1d')]={};this[_0x67fd('0x1e')]={};this[_0x67fd('0x1f')]={};this[_0x67fd('0x20')]={};this[_0x67fd('0x21')]={};this[_0x67fd('0x22')]={};this[_0x67fd('0x23')]={};this[_0x67fd('0x24')]={};this['faxAccounts']={};};function freeIsNotKey(_0x5f7748,_0x2f24dd,_0x38c3cf){var _0x1c2d61=_[_0x67fd('0x25')](_0x5f7748,function(_0x5de0c3,_0x2c3b8a){return _0x5de0c3[_0x38c3cf];});for(var _0x4db317 in _0x2f24dd){if(_0x2f24dd['hasOwnProperty'](_0x4db317)){if(!_0x1c2d61[_0x4db317]){delete _0x2f24dd[_0x4db317];}}}}function freeIsNotKeySip(_0x5b82b4,_0x1de592){var _0x4a6378=_[_0x67fd('0x25')](_0x5b82b4,function(_0x1c6b7d,_0x2b71b8){return util[_0x67fd('0x26')](_0x67fd('0x27'),_0x1c6b7d[_0x67fd('0x28')]);});for(var _0x2d26c0 in _0x1de592){if(_0x1de592[_0x67fd('0x29')](_0x2d26c0)){if(!_0x4a6378[_0x2d26c0]){delete _0x1de592[_0x2d26c0];}}}}function freeIsNotKeyAgent(_0x37c28c,_0x1dc53f){var _0xba1eb8=_[_0x67fd('0x25')](_0x37c28c,function(_0x3cf29e,_0x22c08d){var _0x11113e=_['isNil'](_0x3cf29e[_0x67fd('0x2a')])?util[_0x67fd('0x26')](_0x67fd('0x27'),_0x3cf29e['name']):_0x3cf29e[_0x67fd('0x2a')];return _0x11113e;});for(var _0x26c642 in _0x1dc53f){if(_0x1dc53f[_0x67fd('0x29')](_0x26c642)){if(!_0xba1eb8[_0x26c642]){delete _0x1dc53f[_0x26c642];}}}}function clearVoiceCallReports(_0x30c49e){_0x30c49e[_0x67fd('0x2b')]=0x0;_0x30c49e[_0x67fd('0x2c')]=0x0;_0x30c49e[_0x67fd('0x2d')]=0x0;_0x30c49e[_0x67fd('0x2e')]=0x0;_0x30c49e[_0x67fd('0x2f')]=0x0;}function clearCampaigns(_0x52e638){if(!_['isEmpty'](_0x52e638)){for(var _0x37e83e in _0x52e638){if(_0x52e638[_0x67fd('0x29')](_0x37e83e)){_0x52e638[_0x37e83e]['ivrTotalCallsDays']=0x0;_0x52e638[_0x37e83e]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x49c080){if(!_[_0x67fd('0x30')](_0x49c080)){for(var _0x177966 in _0x49c080){if(_0x49c080[_0x67fd('0x29')](_0x177966)){_0x49c080[_0x177966][_0x67fd('0x2b')]=0x0;_0x49c080[_0x177966][_0x67fd('0x2c')]=0x0;_0x49c080[_0x177966]['unmanaged']=0x0;_0x49c080[_0x177966][_0x67fd('0x31')]=0x0;_0x49c080[_0x177966][_0x67fd('0x2d')]=0x0;_0x49c080[_0x177966][_0x67fd('0x2e')]=0x0;_0x49c080[_0x177966][_0x67fd('0x2f')]=0x0;_0x49c080[_0x177966][_0x67fd('0x32')]=0x0;_0x49c080[_0x177966][_0x67fd('0x33')]=0x0;_0x49c080[_0x177966][_0x67fd('0x34')]=0x0;_0x49c080[_0x177966]['outboundCongestionCallsDay']=0x0;_0x49c080[_0x177966]['outboundNoSuchCallsDay']=0x0;_0x49c080[_0x177966][_0x67fd('0x35')]=0x0;_0x49c080[_0x177966]['outboundDropCallsDayTimeout']=0x0;_0x49c080[_0x177966][_0x67fd('0x36')]=0x0;_0x49c080[_0x177966][_0x67fd('0x37')]=0x0;_0x49c080[_0x177966][_0x67fd('0x38')]=0x0;_0x49c080[_0x177966][_0x67fd('0x39')]=0x0;_0x49c080[_0x177966][_0x67fd('0x3a')]=0x0;_0x49c080[_0x177966]['outboundAnswerAgiCallsDay']=0x0;_0x49c080[_0x177966]['outboundAnswerCallsDay']=0x0;_0x49c080[_0x177966][_0x67fd('0x3b')]=!![];}}}}Realtime['prototype'][_0x67fd('0x3c')]=function(_0x1e12bd,_0x4c45ec){for(var _0x4af7fb in _0x4c45ec){if(_0x1e12bd[_0x67fd('0x29')](_0x4af7fb)){_0x1e12bd[_0x4af7fb]=_0x4c45ec[_0x4af7fb];}}};Realtime[_0x67fd('0x3d')][_0x67fd('0x3e')]=function(){var _0x183f83=this;return function(_0x80c441){if(_0x80c441){freeIsNotKeyAgent(_0x80c441,_0x183f83[_0x67fd('0x10')]);for(var _0x596ec4=0x0,_0x5883eb={},_0x36b1fc={};_0x596ec4<_0x80c441['length'];_0x596ec4+=0x1){_0x5883eb=_0x80c441[_0x596ec4];var _0x1d0223=_[_0x67fd('0x3f')](_0x5883eb[_0x67fd('0x2a')])?util[_0x67fd('0x26')]('SIP/%s',_0x5883eb[_0x67fd('0x28')]):_0x5883eb[_0x67fd('0x2a')];if(_['isUndefined'](_0x183f83['agents'][_0x1d0223])){_0x183f83[_0x67fd('0x10')][_0x1d0223]=new Agent(_0x5883eb);}else{_0x183f83[_0x67fd('0x3c')](_0x183f83[_0x67fd('0x10')][_0x1d0223],_0x5883eb);}}}return _0x183f83[_0x67fd('0x10')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x40')]=function(){var _0x2e9ab9=this;return function(_0x2aeb2f){if(_0x2aeb2f){freeIsNotKeySip(_0x2aeb2f,_0x2e9ab9[_0x67fd('0x11')]);for(var _0x45a87e=0x0,_0x1d31c8={},_0xaae7df={};_0x45a87e<_0x2aeb2f[_0x67fd('0x41')];_0x45a87e+=0x1){_0x1d31c8=_0x2aeb2f[_0x45a87e];if(_[_0x67fd('0x42')](_0x2e9ab9[_0x67fd('0x11')][util['format']('SIP/%s',_0x1d31c8[_0x67fd('0x28')])])){_0x2e9ab9[_0x67fd('0x11')][util['format']('SIP/%s',_0x1d31c8[_0x67fd('0x28')])]=new Telephone(_0x1d31c8);}else{_0x2e9ab9[_0x67fd('0x3c')](_0x2e9ab9[_0x67fd('0x11')][util['format']('SIP/%s',_0x1d31c8[_0x67fd('0x28')])],_0x1d31c8);}}}return _0x2e9ab9['telephones'];};};Realtime[_0x67fd('0x3d')]['initTrunks']=function(){var _0x2310fc=this;return function(_0x40e15f){if(_0x40e15f){freeIsNotKeySip(_0x40e15f,_0x2310fc[_0x67fd('0x43')]);for(var _0x198d6a=0x0,_0x3651bb={},_0x122ddc={};_0x198d6a<_0x40e15f['length'];_0x198d6a+=0x1){_0x3651bb=_0x40e15f[_0x198d6a];if(_['isUndefined'](_0x2310fc[_0x67fd('0x43')][util[_0x67fd('0x26')](_0x67fd('0x27'),_0x3651bb[_0x67fd('0x28')])])){_0x2310fc[_0x67fd('0x43')][util[_0x67fd('0x26')](_0x67fd('0x27'),_0x3651bb[_0x67fd('0x28')])]=new Trunk(_0x3651bb);}else{_0x2310fc[_0x67fd('0x3c')](_0x2310fc[_0x67fd('0x43')][util[_0x67fd('0x26')](_0x67fd('0x27'),_0x3651bb[_0x67fd('0x28')])],_0x3651bb);}}}return _0x2310fc['trunks'];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x44')]=function(){var _0x4ed13a=this;return function(_0x5aa153){if(_0x5aa153){freeIsNotKey(_0x5aa153,_0x4ed13a[_0x67fd('0x12')],_0x67fd('0x28'));for(var _0x21d49d=0x0,_0x4ac874={},_0x1ed8fc={};_0x21d49d<_0x5aa153['length'];_0x21d49d+=0x1){_0x4ac874=_0x5aa153[_0x21d49d];if(_[_0x67fd('0x42')](_0x4ed13a[_0x67fd('0x12')][_0x4ac874[_0x67fd('0x28')]])){_0x4ed13a[_0x67fd('0x12')][_0x4ac874[_0x67fd('0x28')]]=new VoiceQueue(_0x4ac874);}else{_0x4ed13a[_0x67fd('0x3c')](_0x4ed13a['voiceQueues'][_0x4ac874[_0x67fd('0x28')]],_0x4ac874);}}}return _0x4ed13a[_0x67fd('0x12')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x45')]=function(){var _0x21edf2=this;return function(_0xa0effa){if(_0xa0effa){freeIsNotKey(_0xa0effa,_0x21edf2[_0x67fd('0x13')],'id');for(var _0x53600c=0x0,_0x327217={},_0x221eef={};_0x53600c<_0xa0effa[_0x67fd('0x41')];_0x53600c+=0x1){_0x327217=_0xa0effa[_0x53600c];if(_[_0x67fd('0x42')](_0x21edf2['triggers'][_0x327217['id']])){_0x21edf2[_0x67fd('0x13')][_0x327217['id']]=new Trigger(_0x327217);}else{_0x21edf2['mergeFromDatabase'](_0x21edf2[_0x67fd('0x13')][_0x327217['id']],_0x327217);}}}return _0x21edf2['triggers'];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x46')]=function(){var _0x2fd995=this;return function(_0x105acd){if(_0x105acd){freeIsNotKey(_0x105acd,_0x2fd995[_0x67fd('0x15')],'id');for(var _0x38ad78=0x0,_0x4c5101={},_0x501baf={};_0x38ad78<_0x105acd[_0x67fd('0x41')];_0x38ad78+=0x1){_0x4c5101=_0x105acd[_0x38ad78];if(_[_0x67fd('0x42')](_0x2fd995[_0x67fd('0x15')][_0x4c5101['id']])){_0x2fd995[_0x67fd('0x15')][_0x4c5101['id']]=new Template(_0x4c5101);}else{_0x2fd995[_0x67fd('0x3c')](_0x2fd995[_0x67fd('0x15')][_0x4c5101['id']],_0x4c5101);}}}return _0x2fd995['templates'];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x47')]=function(){var _0x57fceb=this;return function(_0x1fb6b9){if(_0x1fb6b9){freeIsNotKey(_0x1fb6b9,_0x57fceb[_0x67fd('0x1b')],'id');for(var _0x23a9e4=0x0,_0x3ab0e7={},_0x27dda0={};_0x23a9e4<_0x1fb6b9[_0x67fd('0x41')];_0x23a9e4+=0x1){_0x3ab0e7=_0x1fb6b9[_0x23a9e4];if(_[_0x67fd('0x42')](_0x57fceb[_0x67fd('0x1b')][_0x3ab0e7['id']])){_0x57fceb['zendeskAccounts'][_0x3ab0e7['id']]=new ZendeskAccount(_0x3ab0e7);}else{_0x57fceb[_0x67fd('0x3c')](_0x57fceb[_0x67fd('0x1b')][_0x3ab0e7['id']],_0x3ab0e7);}}}return _0x57fceb[_0x67fd('0x1b')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x48')]=function(){var _0x2a8854=this;return function(_0x51724c){if(_0x51724c){freeIsNotKey(_0x51724c,_0x2a8854[_0x67fd('0x1c')],'id');for(var _0x50fc88=0x0,_0x50b0a5={},_0x124bb7={};_0x50fc88<_0x51724c['length'];_0x50fc88+=0x1){_0x50b0a5=_0x51724c[_0x50fc88];if(_[_0x67fd('0x42')](_0x2a8854['salesforceAccounts'][_0x50b0a5['id']])){_0x2a8854['salesforceAccounts'][_0x50b0a5['id']]=new SalesforceAccount(_0x50b0a5);}else{_0x2a8854[_0x67fd('0x3c')](_0x2a8854[_0x67fd('0x1c')][_0x50b0a5['id']],_0x50b0a5);}}}return _0x2a8854[_0x67fd('0x1c')];};};Realtime[_0x67fd('0x3d')]['initFreshdeskAccounts']=function(){var _0x55c6f1=this;return function(_0xb6dfa0){if(_0xb6dfa0){freeIsNotKey(_0xb6dfa0,_0x55c6f1[_0x67fd('0x1e')],'id');for(var _0x4c2da1=0x0,_0x51060f={},_0x2c4acb={};_0x4c2da1<_0xb6dfa0['length'];_0x4c2da1+=0x1){_0x51060f=_0xb6dfa0[_0x4c2da1];if(_['isUndefined'](_0x55c6f1[_0x67fd('0x1e')][_0x51060f['id']])){_0x55c6f1[_0x67fd('0x1e')][_0x51060f['id']]=new FreshdeskAccount(_0x51060f);}else{_0x55c6f1['mergeFromDatabase'](_0x55c6f1['freshdeskAccounts'][_0x51060f['id']],_0x51060f);}}}return _0x55c6f1[_0x67fd('0x1e')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x49')]=function(){var _0x5b5311=this;return function(_0x1286b4){if(_0x1286b4){freeIsNotKey(_0x1286b4,_0x5b5311[_0x67fd('0x1f')],'id');for(var _0x1dfecd=0x0,_0x2b270f={},_0x2b4185={};_0x1dfecd<_0x1286b4[_0x67fd('0x41')];_0x1dfecd+=0x1){_0x2b270f=_0x1286b4[_0x1dfecd];if(_[_0x67fd('0x42')](_0x5b5311[_0x67fd('0x1f')][_0x2b270f['id']])){_0x5b5311[_0x67fd('0x1f')][_0x2b270f['id']]=new ZohoAccount(_0x2b270f);}else{_0x5b5311[_0x67fd('0x3c')](_0x5b5311[_0x67fd('0x1f')][_0x2b270f['id']],_0x2b270f);}}}return _0x5b5311[_0x67fd('0x1f')];};};Realtime[_0x67fd('0x3d')]['initDeskAccounts']=function(){var _0x3cccb2=this;return function(_0x31c78e){if(_0x31c78e){freeIsNotKey(_0x31c78e,_0x3cccb2['deskAccounts'],'id');for(var _0x486a5a=0x0,_0xd5b81a={},_0x428d6f={};_0x486a5a<_0x31c78e[_0x67fd('0x41')];_0x486a5a+=0x1){_0xd5b81a=_0x31c78e[_0x486a5a];if(_[_0x67fd('0x42')](_0x3cccb2['deskAccounts'][_0xd5b81a['id']])){_0x3cccb2[_0x67fd('0x20')][_0xd5b81a['id']]=new DeskAccount(_0xd5b81a);}else{_0x3cccb2[_0x67fd('0x3c')](_0x3cccb2['deskAccounts'][_0xd5b81a['id']],_0xd5b81a);}}}return _0x3cccb2['deskAccounts'];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x4a')]=function(){var _0x25e5e8=this;return function(_0x143399){if(_0x143399){freeIsNotKey(_0x143399,_0x25e5e8[_0x67fd('0x1d')],'id');for(var _0x50ccc6=0x0,_0x598bd4={},_0x3db679={};_0x50ccc6<_0x143399[_0x67fd('0x41')];_0x50ccc6+=0x1){_0x598bd4=_0x143399[_0x50ccc6];if(_[_0x67fd('0x42')](_0x25e5e8[_0x67fd('0x1d')][_0x598bd4['id']])){_0x25e5e8['sugarcrmAccounts'][_0x598bd4['id']]=new SugarcrmAccount(_0x598bd4);}else{_0x25e5e8['mergeFromDatabase'](_0x25e5e8[_0x67fd('0x1d')][_0x598bd4['id']],_0x598bd4);}}}return _0x25e5e8['sugarcrmAccounts'];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x4b')]=function(){var _0x18e701=this;return function(_0x12a71d){if(_0x12a71d){freeIsNotKey(_0x12a71d,_0x18e701[_0x67fd('0x21')],'id');for(var _0x50ac0c=0x0,_0x497861={},_0x3ce042={};_0x50ac0c<_0x12a71d[_0x67fd('0x41')];_0x50ac0c+=0x1){_0x497861=_0x12a71d[_0x50ac0c];if(_[_0x67fd('0x42')](_0x18e701['vtigerAccounts'][_0x497861['id']])){_0x18e701[_0x67fd('0x21')][_0x497861['id']]=new VtigerAccount(_0x497861);}else{_0x18e701['mergeFromDatabase'](_0x18e701['vtigerAccounts'][_0x497861['id']],_0x497861);}}}return _0x18e701[_0x67fd('0x21')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x4c')]=function(){var _0x515e8a=this;return function(_0x4633d6){if(_0x4633d6){freeIsNotKey(_0x4633d6,_0x515e8a[_0x67fd('0x22')],'id');for(var _0x9a5c20=0x0,_0x46f78a={},_0x39770b={};_0x9a5c20<_0x4633d6['length'];_0x9a5c20+=0x1){_0x46f78a=_0x4633d6[_0x9a5c20];if(_[_0x67fd('0x42')](_0x515e8a[_0x67fd('0x22')][_0x46f78a['id']])){_0x515e8a[_0x67fd('0x22')][_0x46f78a['id']]=new ServicenowAccount(_0x46f78a);}else{_0x515e8a[_0x67fd('0x3c')](_0x515e8a[_0x67fd('0x22')][_0x46f78a['id']],_0x46f78a);}}}return _0x515e8a[_0x67fd('0x22')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x4d')]=function(){var _0x640ef8=this;return function(_0x429eae){if(_0x429eae){freeIsNotKey(_0x429eae,_0x640ef8[_0x67fd('0x23')],'id');for(var _0x5caed1=0x0,_0x502644={},_0x3d4aba={};_0x5caed1<_0x429eae[_0x67fd('0x41')];_0x5caed1+=0x1){_0x502644=_0x429eae[_0x5caed1];if(_['isUndefined'](_0x640ef8['dynamics365Accounts'][_0x502644['id']])){_0x640ef8[_0x67fd('0x23')][_0x502644['id']]=new Dynamics365Account(_0x502644);}else{_0x640ef8[_0x67fd('0x3c')](_0x640ef8[_0x67fd('0x23')][_0x502644['id']],_0x502644);}}}return _0x640ef8[_0x67fd('0x23')];};};Realtime[_0x67fd('0x3d')]['initFreshsalesAccounts']=function(){var _0x366b96=this;return function(_0x1aef0f){if(_0x1aef0f){freeIsNotKey(_0x1aef0f,_0x366b96[_0x67fd('0x24')],'id');for(var _0x369737=0x0,_0x46b8f1={},_0x2be1b5={};_0x369737<_0x1aef0f['length'];_0x369737+=0x1){_0x46b8f1=_0x1aef0f[_0x369737];if(_[_0x67fd('0x42')](_0x366b96['freshsalesAccounts'][_0x46b8f1['id']])){_0x366b96[_0x67fd('0x24')][_0x46b8f1['id']]=new FreshsalesAccount(_0x46b8f1);}else{_0x366b96[_0x67fd('0x3c')](_0x366b96['freshsalesAccounts'][_0x46b8f1['id']],_0x46b8f1);}}}return _0x366b96[_0x67fd('0x24')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x4e')]=function(){var _0xd8c0a0=this;return function(_0x2625e8){for(var _0x49b775=0x0;_0x49b775<_0x2625e8['length'];_0x49b775+=0x1){_[_0x67fd('0x4f')](_0xd8c0a0[_0x67fd('0x12')][_0x2625e8[_0x49b775][_0x67fd('0x28')]],_0x2625e8[_0x49b775]);}return _0xd8c0a0[_0x67fd('0x12')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x50')]=function(){var _0x454405=this;return function(_0x370d23){clearVoiceQueues(_0x454405[_0x67fd('0x12')]);if(_0x370d23){_0x370d23=_[_0x67fd('0x51')](_0x370d23,'uniqueid');for(var _0x23288b in _0x370d23){if(_0x370d23[_0x67fd('0x29')](_0x23288b)){var _0x5dae2f={};for(var _0x568a98=0x0;_0x568a98<_0x370d23[_0x23288b][_0x67fd('0x41')];_0x568a98+=0x1){var _0x3ca737=_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x52')];if(_0x454405[_0x67fd('0x12')][_0x3ca737]){if(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x53')]){_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x54')]+=0x1;}if(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x55')]){_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x31')]+=0x1;}_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x2d')]+=moment(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x56')])['diff'](moment(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x57')]),'seconds')||0x0;if(_0x568a98===_0x370d23[_0x23288b][_0x67fd('0x41')]-0x1){_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x2e')]+=moment(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x58')]||_0x370d23[_0x23288b][_0x568a98]['queuecallerabandonAt']||_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x59')])['diff'](moment(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x57')]),_0x67fd('0x5a'))||0x0;_0x454405[_0x67fd('0x12')][_0x3ca737]['total']+=0x1;if(_0x370d23[_0x23288b][_0x568a98]['queuecallercomplete']){_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x2c')]+=0x1;_0x454405['voiceQueues'][_0x3ca737][_0x67fd('0x2f')]+=moment(_0x370d23[_0x23288b][_0x568a98]['queuecallercompleteAt'])[_0x67fd('0x5b')](moment(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x56')]),_0x67fd('0x5a'))||0x0;}}else{_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x2e')]+=_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x2d')]||0x0;}}}}}}return _0x454405['voiceQueues'];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x5c')]=function(){var _0x269624=this;return function(_0x3c22c9){clearVoiceCallReports(_0x269624[_0x67fd('0x16')]);if(_0x3c22c9){for(var _0x4a6f80=0x0;_0x4a6f80<_0x3c22c9[_0x67fd('0x41')];_0x4a6f80+=0x1){_0x269624[_0x67fd('0x16')][_0x67fd('0x2b')]+=0x1;_0x269624[_0x67fd('0x16')][_0x67fd('0x2e')]+=_0x3c22c9[_0x4a6f80][_0x67fd('0x5d')];if(_0x3c22c9[_0x4a6f80][_0x67fd('0x5e')]===_0x67fd('0x5f')){_0x269624[_0x67fd('0x16')][_0x67fd('0x2c')]+=0x1;_0x269624['outbound'][_0x67fd('0x2d')]+=_0x3c22c9[_0x4a6f80][_0x67fd('0x5d')]-_0x3c22c9[_0x4a6f80]['billableseconds']||0x0;_0x269624[_0x67fd('0x16')][_0x67fd('0x2f')]+=_0x3c22c9[_0x4a6f80][_0x67fd('0x60')];}}}return _0x269624[_0x67fd('0x16')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x61')]=function(){var _0xeda87c=this;return function(_0x19feb3){if(_0x19feb3){freeIsNotKey(_0x19feb3,_0xeda87c[_0x67fd('0x14')],'name');for(var _0x58e10d=0x0,_0x48b5f8={};_0x58e10d<_0x19feb3[_0x67fd('0x41')];_0x58e10d+=0x1){_0x48b5f8=_0x19feb3[_0x58e10d];if(_['isUndefined'](_0xeda87c['campaigns'][_0x48b5f8[_0x67fd('0x28')]])){_0xeda87c[_0x67fd('0x14')][_0x48b5f8[_0x67fd('0x28')]]=new Campaign(_0x48b5f8);}else{_0xeda87c[_0x67fd('0x3c')](_0xeda87c[_0x67fd('0x14')][_0x48b5f8[_0x67fd('0x28')]],_0x48b5f8);_0xeda87c[_0x67fd('0x14')][_0x48b5f8[_0x67fd('0x28')]][_0x67fd('0x62')]=_0x48b5f8['SquareProject']?_0x48b5f8[_0x67fd('0x63')][_0x67fd('0x28')]:undefined;}}}return _0xeda87c['campaigns'];};};Realtime['prototype'][_0x67fd('0x64')]=function(){var _0x597b07=this;return function(_0x55f5af){if(_0x55f5af){freeIsNotKey(_0x55f5af,_0x597b07['voiceExtensions'],'id');for(var _0x2d56bb=0x0,_0x13ad54={};_0x2d56bb<_0x55f5af['length'];_0x2d56bb+=0x1){_0x13ad54=_0x55f5af[_0x2d56bb];if(_['isUndefined'](_0x597b07[_0x67fd('0x65')][_0x13ad54['id']])){_0x597b07['voiceExtensions'][_0x13ad54['id']]=new VoiceExtension(_0x13ad54);}else{_0x597b07[_0x67fd('0x3c')](_0x597b07[_0x67fd('0x65')][_0x13ad54['id']],_0x13ad54);}}}return _0x597b07[_0x67fd('0x65')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x66')]=function(){var _0xea1750=this;return function(_0x18366e){clearCampaigns(_0xea1750[_0x67fd('0x14')]);for(var _0x29814e=0x0;_0x29814e<_0x18366e[_0x67fd('0x41')];_0x29814e+=0x1){_[_0x67fd('0x4f')](_0xea1750[_0x67fd('0x14')][_0x18366e[_0x29814e][_0x67fd('0x28')]],_0x18366e[_0x29814e]);}return _0xea1750[_0x67fd('0x14')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x67')]=function(){var _0x48670e=this;return function(_0x1518bf){if(_0x1518bf){freeIsNotKey(_0x1518bf,_0x48670e[_0x67fd('0x68')],'id');for(var _0x51dd5d=0x0,_0x1b297c={},_0x4bb5d1={};_0x51dd5d<_0x1518bf[_0x67fd('0x41')];_0x51dd5d+=0x1){_0x1b297c=_0x1518bf[_0x51dd5d];if(_[_0x67fd('0x42')](_0x48670e[_0x67fd('0x68')][_0x1b297c['id']])){_0x48670e[_0x67fd('0x68')][_0x1b297c['id']]=new FaxAccount(_0x1b297c);}else{_0x48670e[_0x67fd('0x3c')](_0x48670e[_0x67fd('0x68')][_0x1b297c['id']],_0x1b297c);}}}return _0x48670e[_0x67fd('0x68')];};};Realtime['prototype'][_0x67fd('0x69')]=function(){var _0x566d2f=this;return function(_0x10a896){_0x566d2f[_0x67fd('0x1a')]=_0x10a896;return _0x566d2f[_0x67fd('0x1a')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 50e026a..c0bfebd 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 _0x7cbb=['YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','format','create','match','voiceCallReport','destination','exten','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','startsWith','substring','indexOf','mobile','phone','lastIndexOf','isNil','transfererlinkedid','exports','lodash','moment','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','SIP/%s','length','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0x7cbb,0x187));var _0xb7cb=function(_0x4f0e2f,_0x328451){_0x4f0e2f=_0x4f0e2f-0x0;var _0x32bdfb=_0x7cbb[_0x4f0e2f];return _0x32bdfb;};'use strict';var _=require(_0xb7cb('0x0'));var moment=require(_0xb7cb('0x1'));var util=require('util');var config=require(_0xb7cb('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xb7cb('0x3'));var RpcVoiceCallReport=require(_0xb7cb('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xb7cb('0x5'));var RpcVoiceQueueReport=require(_0xb7cb('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xb7cb('0x7'));var VoiceQueueReport=require(_0xb7cb('0x8'));var VoiceCallReport=require(_0xb7cb('0x9'));var VoiceAgentReport=require(_0xb7cb('0xa'));var VoiceDialReport=require(_0xb7cb('0xb'));var UserReport=require('./userReport');function Report(_0x4d5186){this[_0xb7cb('0xc')]=_0x4d5186;this[_0xb7cb('0xd')]=_0x4d5186['agents'];this[_0xb7cb('0xe')]=_0x4d5186[_0xb7cb('0xe')];}Report[_0xb7cb('0xf')][_0xb7cb('0x10')]=function(_0x513462){var _0xaf420f=new VoiceQueueReport(this[_0xb7cb('0xc')]);var _0x420c78=new VoiceAgentReport(this[_0xb7cb('0xc')]);var _0x16ae84=new VoiceDialReport(this[_0xb7cb('0xc')]);var _0x45aa9b=new VoiceCallReport(this[_0xb7cb('0xc')]);var _0x27353b=new UserReport(this[_0xb7cb('0xc')]);if(config['xdr']&&config[_0xb7cb('0x11')]['disabled']){ami['on'](_0xb7cb('0x12'),this[_0xb7cb('0x13')][_0xb7cb('0x14')](this));ami['on'](_0xb7cb('0x15'),this['voiceCallReport']['bind'](this));ami['on'](_0xb7cb('0x16'),this['voiceAgentReport'][_0xb7cb('0x14')](this));ami['on'](_0xb7cb('0x17'),this[_0xb7cb('0x18')][_0xb7cb('0x14')](this));ami['on']('blindtransfer',this[_0xb7cb('0x19')][_0xb7cb('0x14')](this));ami['on'](_0xb7cb('0x1a'),this[_0xb7cb('0x1b')][_0xb7cb('0x14')](this));}};Report[_0xb7cb('0xf')][_0xb7cb('0x1c')]=function(_0x30616b){var _0x1a4a77;_0x1a4a77=_[_0xb7cb('0x1d')](this[_0xb7cb('0xd')],function(_0x48863d){return _0x48863d[_0xb7cb('0x1e')]==_0x30616b||_0x48863d[_0xb7cb('0x1f')]==_0x30616b;});if(_['isNil'](_0x1a4a77)){var _0x5b2027=_[_0xb7cb('0x1d')](this['telephones'],function(_0xbf3f23){return _0xbf3f23['accountcode']==_0x30616b||_0xbf3f23[_0xb7cb('0x1f')]==_0x30616b;});if(_0x5b2027){_0x1a4a77=_[_0xb7cb('0x1d')](this[_0xb7cb('0xd')],function(_0xcb01e2){return _0xcb01e2['interface']==util['format'](_0xb7cb('0x20'),_0x5b2027[_0xb7cb('0x1f')]);});}}return _0x1a4a77;};Report[_0xb7cb('0xf')]['voiceQueueReport']=function(_0x3ac262){for(var _0x2f863c=0x0;_0x2f863c<_0x3ac262[_0xb7cb('0x21')];_0x2f863c+=0x1){var _0x59a448=this['findAgent'](_0x3ac262[_0x2f863c]['connectedlinenum']);if(_0x59a448){_0x3ac262[_0x2f863c][_0xb7cb('0x1e')]=_0x59a448[_0xb7cb('0x1e')];_0x3ac262[_0x2f863c][_0xb7cb('0x22')]=!![];_0x3ac262[_0x2f863c][_0xb7cb('0x23')]=_0x59a448[_0xb7cb('0x1f')];_0x3ac262[_0x2f863c]['interface']=_['isNil'](_0x59a448[_0xb7cb('0x24')])?util['format']('SIP/%s',_0x59a448['name']):_0x59a448[_0xb7cb('0x24')];if(_0x3ac262[_0x2f863c][_0xb7cb('0x25')]){_0x3ac262[_0x2f863c][_0xb7cb('0x26')]=moment()['format'](_0xb7cb('0x27'));}if(_0x3ac262[_0x2f863c][_0xb7cb('0x28')]){_0x3ac262[_0x2f863c][_0xb7cb('0x29')]=moment()[_0xb7cb('0x2a')](_0xb7cb('0x27'));}RpcMemberReport['voiceQueueReport'](_0x3ac262[_0x2f863c]);}RpcVoiceQueueReport[_0xb7cb('0x2b')](_0x3ac262[_0x2f863c]);}};function extractCalleridNumber(_0x36d9ec){var _0x321d80=_0x36d9ec[_0xb7cb('0x2c')](/<(.*?)>/);return _0x321d80?_0x321d80[0x1]:_0x36d9ec;}Report['prototype'][_0xb7cb('0x2d')]=function(_0x32b32e){_0x32b32e[_0xb7cb('0x2e')]=_0x32b32e[_0xb7cb('0x2e')]||_0x32b32e[_0xb7cb('0x2f')];if(_0x32b32e['type']==_0xb7cb('0x30')){_0x32b32e[_0xb7cb('0x31')]=_0xb7cb('0x32');_0x32b32e[_0xb7cb('0x33')]=_0x32b32e[_0xb7cb('0x32')];if(_0x32b32e[_0xb7cb('0x34')]==_0xb7cb('0x35')){_0x32b32e['accountcode']='';_0x32b32e[_0xb7cb('0x2e')]=extractCalleridNumber(_0x32b32e[_0xb7cb('0x36')]);}else if(_0x32b32e[_0xb7cb('0x34')]=='from-sip'){if(_0x32b32e['destination']==_0xb7cb('0x37')){_0x32b32e['destination']=extractCalleridNumber(_0x32b32e[_0xb7cb('0x38')]);_0x32b32e[_0xb7cb('0x39')]=_0x32b32e[_0xb7cb('0x3a')];_0x32b32e[_0xb7cb('0x3b')]=[_0x32b32e[_0xb7cb('0x3c')],_0x32b32e[_0xb7cb('0x3c')]=_0x32b32e[_0xb7cb('0x3b')]][0x0];_0x32b32e[_0xb7cb('0x36')]=_0x32b32e['calleridpreview'];}else{_0x32b32e[_0xb7cb('0x2e')]=_0x32b32e[_0xb7cb('0x39')];_0x32b32e[_0xb7cb('0x39')]=_0x32b32e['originatecalleridnum'];if(_0x32b32e[_0xb7cb('0x3d')]==_0xb7cb('0x3e')){_0x32b32e[_0xb7cb('0x1e')]=_0x32b32e[_0xb7cb('0x3f')];}else{_0x32b32e[_0xb7cb('0x1e')]='';}}}}else{_0x32b32e[_0xb7cb('0x36')]=util[_0xb7cb('0x2a')](_0xb7cb('0x40'),_0x32b32e[_0xb7cb('0x41')],_0x32b32e[_0xb7cb('0x39')]);}if(RpcVoiceTransferReport[_0xb7cb('0x42')][_0x32b32e[_0xb7cb('0x43')]]){var _0x3e2c73=RpcVoiceTransferReport[_0xb7cb('0x42')][_0x32b32e[_0xb7cb('0x43')]];_0x3e2c73['transfereelinkedid']=_0x32b32e[_0xb7cb('0x44')];RpcVoiceTransferReport['blindTransfer'](_0x3e2c73);delete RpcVoiceTransferReport[_0xb7cb('0x42')][_0x32b32e[_0xb7cb('0x43')]];}RpcVoiceCallReport[_0xb7cb('0x2b')](_0x32b32e);if(_0x32b32e[_0xb7cb('0x45')]){for(var _0x4318e5=0x0;_0x4318e5<_0x32b32e[_0xb7cb('0x46')][_0xb7cb('0x21')];_0x4318e5+=0x1){_0x32b32e[_0xb7cb('0x47')]=_0x32b32e[_0xb7cb('0x46')][_0x4318e5][_0xb7cb('0x48')];_0x32b32e[_0xb7cb('0x49')]=_0x32b32e['monitors'][_0x4318e5]['createdAt'];if(_0x32b32e[_0xb7cb('0x2f')]==_0xb7cb('0x37')){_0x32b32e[_0xb7cb('0x39')]=_0x32b32e[_0xb7cb('0x3f')];_0x32b32e['calleridname']=_0x32b32e[_0xb7cb('0x4a')];_0x32b32e[_0xb7cb('0x3f')]=_0x32b32e[_0xb7cb('0x1e')];_0x32b32e[_0xb7cb('0x4a')]=_0x32b32e[_0xb7cb('0x4b')];_0x32b32e['exten']=_0x32b32e['originatecalleridnum'];}else if(_0x32b32e['exten']==_0xb7cb('0x4c')){_0x32b32e['calleridnum']=_0x32b32e[_0xb7cb('0x2e')];_0x32b32e[_0xb7cb('0x2f')]=_0x32b32e[_0xb7cb('0x3a')];}RpcVoiceRecording['create'](_0x32b32e);}}};Report['prototype']['voiceAgentReport']=function(_0x3b5956){if(_['isArray'](_0x3b5956)){_0x3b5956['forEach'](function(_0x7b7809){RpcVoiceAgentReport[_0xb7cb('0x2b')](_0x7b7809);});}else{RpcVoiceAgentReport[_0xb7cb('0x2b')](_0x3b5956);}};Report[_0xb7cb('0xf')][_0xb7cb('0x18')]=function(_0x4b93c7){RpcVoiceDialReport['create'](_0x4b93c7);var _0xed07e6;var _0x54e8be;var _0x2c0edf=_0x4b93c7[_0xb7cb('0x3c')];if(_[_0xb7cb('0x4d')](_0x2c0edf,'Local')){_0x54e8be=_0x2c0edf[_0xb7cb('0x4e')](_0x2c0edf['indexOf']('/')+0x1,_0x2c0edf[_0xb7cb('0x4f')]('@'));_0xed07e6=_[_0xb7cb('0x1d')](this['agents'],function(_0x28f11e){return _0x28f11e[_0xb7cb('0x50')]==_0x54e8be||_0x28f11e[_0xb7cb('0x51')]==_0x54e8be||_0x28f11e[_0xb7cb('0x1e')]==_0x54e8be;});}else{_0x54e8be=_0x2c0edf[_0xb7cb('0x4e')](_0x2c0edf['indexOf']('/')+0x1,_0x2c0edf[_0xb7cb('0x52')]('-'));_0xed07e6=this[_0xb7cb('0x1c')](_0x54e8be);}if(_0xed07e6){_0x4b93c7[_0xb7cb('0x24')]=_[_0xb7cb('0x53')](_0xed07e6[_0xb7cb('0x24')])?util[_0xb7cb('0x2a')]('SIP/%s',_0xed07e6[_0xb7cb('0x1f')]):_0xed07e6[_0xb7cb('0x24')];_0x4b93c7[_0xb7cb('0x4b')]=_0xed07e6[_0xb7cb('0x1f')];_0x4b93c7[_0xb7cb('0x1e')]=_0xed07e6['accountcode'];RpcMemberReport[_0xb7cb('0x18')](_0x4b93c7);}};Report[_0xb7cb('0xf')][_0xb7cb('0x19')]=function(_0x49e37a){RpcVoiceTransferReport[_0xb7cb('0x42')][_0x49e37a[_0xb7cb('0x54')]]=_0x49e37a;};Report[_0xb7cb('0xf')][_0xb7cb('0x1b')]=function(_0x37e526){RpcVoiceTransferReport['attendedTransfer'](_0x37e526);};module[_0xb7cb('0x55')]=Report; \ No newline at end of file +var _0x690c=['util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','agents','accountcode','isNil','interface','format','SIP/%s','name','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','type','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','channel','destinationchannel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','monitor','monitors','monitorFilename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','substring','indexOf','mobile','phone','lastIndexOf','exports','lodash','moment'];(function(_0x36a88a,_0x190ec7){var _0x57200c=function(_0x4302c4){while(--_0x4302c4){_0x36a88a['push'](_0x36a88a['shift']());}};_0x57200c(++_0x190ec7);}(_0x690c,0x1b6));var _0xc690=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x690c[_0x3bb5b4];return _0x586c60;};'use strict';var _=require(_0xc690('0x0'));var moment=require(_0xc690('0x1'));var util=require(_0xc690('0x2'));var config=require(_0xc690('0x3'));var ami=require(_0xc690('0x4'));var RpcVoiceAgentReport=require(_0xc690('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xc690('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xc690('0x7'));var RpcVoiceRecording=require(_0xc690('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xc690('0x9'));var VoiceCallReport=require(_0xc690('0xa'));var VoiceAgentReport=require(_0xc690('0xb'));var VoiceDialReport=require(_0xc690('0xc'));var UserReport=require(_0xc690('0xd'));function Report(_0x54e284){this[_0xc690('0xe')]=_0x54e284;this['agents']=_0x54e284['agents'];this[_0xc690('0xf')]=_0x54e284[_0xc690('0xf')];}Report[_0xc690('0x10')][_0xc690('0x11')]=function(_0x574b80){var _0xdc0391=new VoiceQueueReport(this[_0xc690('0xe')]);var _0x22f7eb=new VoiceAgentReport(this[_0xc690('0xe')]);var _0x3738c6=new VoiceDialReport(this[_0xc690('0xe')]);var _0xf8e87f=new VoiceCallReport(this[_0xc690('0xe')]);var _0x27029e=new UserReport(this[_0xc690('0xe')]);if(config['xdr']&&config[_0xc690('0x12')][_0xc690('0x13')]){ami['on']('custom:voiceQueueReport',this[_0xc690('0x14')]['bind'](this));ami['on'](_0xc690('0x15'),this[_0xc690('0x16')][_0xc690('0x17')](this));ami['on'](_0xc690('0x18'),this['voiceAgentReport'][_0xc690('0x17')](this));ami['on']('custom:voiceDialReport',this[_0xc690('0x19')][_0xc690('0x17')](this));ami['on'](_0xc690('0x1a'),this[_0xc690('0x1b')][_0xc690('0x17')](this));ami['on'](_0xc690('0x1c'),this[_0xc690('0x1d')][_0xc690('0x17')](this));}};Report[_0xc690('0x10')][_0xc690('0x1e')]=function(_0x27b239){var _0x2133e9;_0x2133e9=_[_0xc690('0x1f')](this[_0xc690('0x20')],function(_0x4d3568){return _0x4d3568[_0xc690('0x21')]==_0x27b239||_0x4d3568['name']==_0x27b239;});if(_[_0xc690('0x22')](_0x2133e9)){var _0x10e146=_['find'](this[_0xc690('0xf')],function(_0x1d26b0){return _0x1d26b0['accountcode']==_0x27b239||_0x1d26b0['name']==_0x27b239;});if(_0x10e146){_0x2133e9=_[_0xc690('0x1f')](this[_0xc690('0x20')],function(_0x116bc7){return _0x116bc7[_0xc690('0x23')]==util[_0xc690('0x24')](_0xc690('0x25'),_0x10e146[_0xc690('0x26')]);});}}return _0x2133e9;};Report[_0xc690('0x10')][_0xc690('0x14')]=function(_0x509892){for(var _0x5c3476=0x0;_0x5c3476<_0x509892[_0xc690('0x27')];_0x5c3476+=0x1){var _0x4bfb46=this[_0xc690('0x1e')](_0x509892[_0x5c3476][_0xc690('0x28')]);if(_0x4bfb46){_0x509892[_0x5c3476][_0xc690('0x21')]=_0x4bfb46[_0xc690('0x21')];_0x509892[_0x5c3476][_0xc690('0x29')]=!![];_0x509892[_0x5c3476][_0xc690('0x2a')]=_0x4bfb46[_0xc690('0x26')];_0x509892[_0x5c3476]['interface']=_[_0xc690('0x22')](_0x4bfb46['interface'])?util['format'](_0xc690('0x25'),_0x4bfb46[_0xc690('0x26')]):_0x4bfb46[_0xc690('0x23')];if(_0x509892[_0x5c3476][_0xc690('0x2b')]){_0x509892[_0x5c3476][_0xc690('0x2c')]=moment()[_0xc690('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x509892[_0x5c3476][_0xc690('0x2d')]){_0x509892[_0x5c3476][_0xc690('0x2e')]=moment()[_0xc690('0x24')](_0xc690('0x2f'));}RpcMemberReport[_0xc690('0x14')](_0x509892[_0x5c3476]);}RpcVoiceQueueReport[_0xc690('0x30')](_0x509892[_0x5c3476]);}};function extractCalleridNumber(_0x104705){var _0x190dbd=_0x104705[_0xc690('0x31')](/<(.*?)>/);return _0x190dbd?_0x190dbd[0x1]:_0x104705;}Report[_0xc690('0x10')][_0xc690('0x16')]=function(_0x3475af){_0x3475af['destination']=_0x3475af[_0xc690('0x32')]||_0x3475af['exten'];if(_0x3475af[_0xc690('0x33')]=='dialer'){_0x3475af['lastapplication']=_0xc690('0x34');_0x3475af[_0xc690('0x35')]=_0x3475af[_0xc690('0x34')];if(_0x3475af[_0xc690('0x36')]==_0xc690('0x37')){_0x3475af[_0xc690('0x21')]='';_0x3475af[_0xc690('0x32')]=extractCalleridNumber(_0x3475af[_0xc690('0x38')]);}else if(_0x3475af[_0xc690('0x36')]==_0xc690('0x39')){if(_0x3475af[_0xc690('0x32')]==_0xc690('0x3a')){_0x3475af[_0xc690('0x32')]=extractCalleridNumber(_0x3475af[_0xc690('0x3b')]);_0x3475af[_0xc690('0x3c')]=_0x3475af['originatecalleridnum'];_0x3475af['destinationchannel']=[_0x3475af[_0xc690('0x3d')],_0x3475af[_0xc690('0x3d')]=_0x3475af[_0xc690('0x3e')]][0x0];_0x3475af[_0xc690('0x38')]=_0x3475af[_0xc690('0x3b')];}else{_0x3475af[_0xc690('0x32')]=_0x3475af[_0xc690('0x3c')];_0x3475af[_0xc690('0x3c')]=_0x3475af[_0xc690('0x3f')];if(_0x3475af[_0xc690('0x40')]==_0xc690('0x41')){_0x3475af[_0xc690('0x21')]=_0x3475af['connectedlinenum'];}else{_0x3475af[_0xc690('0x21')]='';}}}}else{_0x3475af['callerid']=util[_0xc690('0x24')](_0xc690('0x42'),_0x3475af[_0xc690('0x43')],_0x3475af[_0xc690('0x3c')]);}if(RpcVoiceTransferReport[_0xc690('0x44')][_0x3475af[_0xc690('0x45')]]){var _0x2b9666=RpcVoiceTransferReport[_0xc690('0x44')][_0x3475af[_0xc690('0x45')]];_0x2b9666[_0xc690('0x46')]=_0x3475af['uniqueid'];RpcVoiceTransferReport[_0xc690('0x1b')](_0x2b9666);delete RpcVoiceTransferReport['transfers'][_0x3475af['linkedid']];}RpcVoiceCallReport[_0xc690('0x30')](_0x3475af);if(_0x3475af[_0xc690('0x47')]){for(var _0x5f2d5d=0x0;_0x5f2d5d<_0x3475af[_0xc690('0x48')][_0xc690('0x27')];_0x5f2d5d+=0x1){_0x3475af[_0xc690('0x49')]=_0x3475af['monitors'][_0x5f2d5d]['filename'];_0x3475af[_0xc690('0x4a')]=_0x3475af['monitors'][_0x5f2d5d][_0xc690('0x4a')];if(_0x3475af[_0xc690('0x4b')]=='xcally-motion-preview'){_0x3475af[_0xc690('0x3c')]=_0x3475af[_0xc690('0x28')];_0x3475af['calleridname']=_0x3475af[_0xc690('0x4c')];_0x3475af[_0xc690('0x28')]=_0x3475af[_0xc690('0x21')];_0x3475af[_0xc690('0x4c')]=_0x3475af[_0xc690('0x4d')];_0x3475af[_0xc690('0x4b')]=_0x3475af[_0xc690('0x3f')];}else if(_0x3475af[_0xc690('0x4b')]==_0xc690('0x4e')){_0x3475af[_0xc690('0x3c')]=_0x3475af['destination'];_0x3475af[_0xc690('0x4b')]=_0x3475af[_0xc690('0x3f')];}RpcVoiceRecording['create'](_0x3475af);}}};Report['prototype'][_0xc690('0x4f')]=function(_0x1e6407){if(_[_0xc690('0x50')](_0x1e6407)){_0x1e6407[_0xc690('0x51')](function(_0x285f8d){RpcVoiceAgentReport[_0xc690('0x30')](_0x285f8d);});}else{RpcVoiceAgentReport[_0xc690('0x30')](_0x1e6407);}};Report[_0xc690('0x10')][_0xc690('0x19')]=function(_0x50b8f3){RpcVoiceDialReport[_0xc690('0x30')](_0x50b8f3);var _0x2a065c;var _0x3be6ff;var _0x24d581=_0x50b8f3[_0xc690('0x3d')];if(_['startsWith'](_0x24d581,'Local')){_0x3be6ff=_0x24d581[_0xc690('0x52')](_0x24d581['indexOf']('/')+0x1,_0x24d581[_0xc690('0x53')]('@'));_0x2a065c=_['find'](this[_0xc690('0x20')],function(_0x1bd2d6){return _0x1bd2d6[_0xc690('0x54')]==_0x3be6ff||_0x1bd2d6[_0xc690('0x55')]==_0x3be6ff||_0x1bd2d6[_0xc690('0x21')]==_0x3be6ff;});}else{_0x3be6ff=_0x24d581['substring'](_0x24d581['indexOf']('/')+0x1,_0x24d581[_0xc690('0x56')]('-'));_0x2a065c=this['findAgent'](_0x3be6ff);}if(_0x2a065c){_0x50b8f3[_0xc690('0x23')]=_['isNil'](_0x2a065c[_0xc690('0x23')])?util['format'](_0xc690('0x25'),_0x2a065c[_0xc690('0x26')]):_0x2a065c[_0xc690('0x23')];_0x50b8f3[_0xc690('0x4d')]=_0x2a065c[_0xc690('0x26')];_0x50b8f3[_0xc690('0x21')]=_0x2a065c['accountcode'];RpcMemberReport[_0xc690('0x19')](_0x50b8f3);}};Report[_0xc690('0x10')]['blindTransfer']=function(_0x3431e0){RpcVoiceTransferReport['transfers'][_0x3431e0['transfererlinkedid']]=_0x3431e0;};Report[_0xc690('0x10')][_0xc690('0x1d')]=function(_0x29e5ec){RpcVoiceTransferReport[_0xc690('0x1d')](_0x29e5ec);};module[_0xc690('0x57')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 18d8d2c..73ae194 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 _0xc965=['syncRealtimeShow','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','trunks','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','local','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','substring','indexOf','phone','updateStatusRealtime','syncPeerStatus','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','bluebird','ami','../ami','defaults','redis','localhost','agents','telephones','syncRegistry','registry','bind','syncDeviceState','peerstatus','then','catch','error','[userReport][sipshowregistry]','resolve','[userReport][devicestatelist]','inspect','actionSipPeerStatus','prototype'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xc965,0x6f));var _0x5c96=function(_0x383494,_0x2070d2){_0x383494=_0x383494-0x0;var _0x2485e5=_0xc965[_0x383494];return _0x2485e5;};'use strict';var _=require(_0x5c96('0x0'));var moment=require('moment');var util=require('util');var Redis=require('ioredis');var BPromise=require(_0x5c96('0x1'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x5c96('0x2'));var ami=require(_0x5c96('0x3'));config['redis']=_[_0x5c96('0x4')](config[_0x5c96('0x5')],{'host':_0x5c96('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5c96('0x5')]));function UserReport(_0x33edd9){this['trunks']=_0x33edd9['trunks'];this[_0x5c96('0x7')]=_0x33edd9[_0x5c96('0x7')];this[_0x5c96('0x8')]=_0x33edd9[_0x5c96('0x8')];ami['on']('registryentry',this[_0x5c96('0x9')]['bind'](this));ami['on'](_0x5c96('0xa'),this[_0x5c96('0x9')][_0x5c96('0xb')](this));ami['on']('devicestatechange',this[_0x5c96('0xc')][_0x5c96('0xb')](this));ami['on'](_0x5c96('0xd'),this['syncPeerStatus'][_0x5c96('0xb')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()[_0x5c96('0xe')](ami['actionSipShowRegistry']())[_0x5c96('0xf')](function(_0x4f795d){logger[_0x5c96('0x10')](_0x5c96('0x11'),util['inspect'](_0x4f795d,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x5c96('0x12')]()[_0x5c96('0xe')](ami['actionDeviceStateList']())[_0x5c96('0xf')](function(_0x506326){logger[_0x5c96('0x10')](_0x5c96('0x13'),util[_0x5c96('0x14')](_0x506326,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami[_0x5c96('0x15')]())['catch'](function(_0x59e196){logger[_0x5c96('0x10')]('[userReport][sippeerstatus]',util[_0x5c96('0x14')](_0x59e196,{'showHidden':![],'depth':null}));});}UserReport[_0x5c96('0x16')][_0x5c96('0x17')]=function(){setInterval(function(){BPromise['resolve']()[_0x5c96('0xe')](showSipRegistrations())['then'](listDeviceStates())[_0x5c96('0xe')](showPeersStatus());},0x32c8);};UserReport[_0x5c96('0x16')][_0x5c96('0x18')]=function(_0x59353e){return _0x59353e!==null&&!_[_0x5c96('0x19')](_0x59353e);};UserReport['prototype'][_0x5c96('0x1a')]=function(_0x14fac7,_0x367b2e,_0x147732){io['to'](_0x14fac7)['emit'](_0x367b2e,_0x147732);};UserReport['prototype'][_0x5c96('0x9')]=function(_0x1d9801){try{if(this[_0x5c96('0x18')](_0x1d9801)){logger[_0x5c96('0x1b')](_0x5c96('0x1c'),_0x1d9801[_0x5c96('0x1d')],_0x1d9801[_0x5c96('0x1e')]);logger[_0x5c96('0x1f')](_0x5c96('0x20'),util[_0x5c96('0x14')](_0x1d9801,{'showHidden':![],'depth':null}));var _0x2fb54c=_[_0x5c96('0x21')](this[_0x5c96('0x22')],{'registry':_0x1d9801[_0x5c96('0x1d')]});if(_0x2fb54c){_0x1d9801[_0x5c96('0x23')]=_0x1d9801[_0x5c96('0x1e')];_[_0x5c96('0x24')](_0x2fb54c,_[_0x5c96('0x25')](_0x1d9801,[_0x5c96('0x26'),'actionid',_0x5c96('0x1d'),_0x5c96('0x1e')]));logger[_0x5c96('0x1f')](_0x5c96('0x27'),util[_0x5c96('0x14')](_0x2fb54c,{'showHidden':![],'depth':null}));this[_0x5c96('0x1a')](util[_0x5c96('0x28')](_0x5c96('0x29'),_0x2fb54c[_0x5c96('0x2a')]),'trunk:save',_0x2fb54c);}}}catch(_0x3736ff){logger['error'](_0x5c96('0x20'),util[_0x5c96('0x14')](_0x3736ff,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x5c96('0xc')]=function(_0x5c07a3){try{if(this[_0x5c96('0x18')](_0x5c07a3)){logger[_0x5c96('0x1b')](_0x5c96('0x2b'),_0x5c07a3[_0x5c96('0x2c')],_0x5c07a3[_0x5c96('0x1e')]);logger['debug'](_0x5c96('0x2d'),util[_0x5c96('0x14')](_0x5c07a3,{'showHidden':![],'depth':null}));if(this[_0x5c96('0x7')][_0x5c07a3[_0x5c96('0x2c')]]){if(!this[_0x5c96('0x7')][_0x5c07a3['device']]['local']||_0x5c07a3[_0x5c96('0x1e')][_0x5c96('0x2e')]()=='inuse'){this[_0x5c96('0x7')][_0x5c07a3[_0x5c96('0x2c')]][_0x5c96('0x2f')]=![];if(this[_0x5c96('0x7')][_0x5c07a3['device']][_0x5c96('0x1e')]!==_0x5c07a3[_0x5c96('0x1e')][_0x5c96('0x2e')]()){this[_0x5c96('0x7')][_0x5c07a3[_0x5c96('0x2c')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this[_0x5c96('0x7')][_0x5c07a3[_0x5c96('0x2c')]][_0x5c96('0x1e')]=_0x5c07a3['state'][_0x5c96('0x2e')]();this[_0x5c96('0x7')][_0x5c07a3[_0x5c96('0x2c')]]['updateStatusRealtime'](_0x5c07a3);}}else if(this[_0x5c96('0x8')][_0x5c07a3[_0x5c96('0x2c')]]){if(this['telephones'][_0x5c07a3[_0x5c96('0x2c')]][_0x5c96('0x1e')]!==_0x5c07a3['state'][_0x5c96('0x2e')]()){this[_0x5c96('0x8')][_0x5c07a3[_0x5c96('0x2c')]][_0x5c96('0x30')]=_[_0x5c96('0x31')](moment()[_0x5c96('0x28')]('x'));}this[_0x5c96('0x8')][_0x5c07a3['device']]['state']=_0x5c07a3[_0x5c96('0x1e')]['toLowerCase']();logger['debug'](_0x5c96('0x32'),util[_0x5c96('0x14')](this['telephones'][_0x5c07a3[_0x5c96('0x2c')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x5c96('0x28')](_0x5c96('0x33'),this[_0x5c96('0x8')][_0x5c07a3[_0x5c96('0x2c')]][_0x5c96('0x2a')]),_0x5c96('0x34'),this[_0x5c96('0x8')][_0x5c07a3[_0x5c96('0x2c')]]);}else if(this[_0x5c96('0x22')][_0x5c07a3[_0x5c96('0x2c')]]){if(this['trunks'][_0x5c07a3[_0x5c96('0x2c')]][_0x5c96('0x1e')]!==_0x5c07a3[_0x5c96('0x1e')][_0x5c96('0x2e')]()){this[_0x5c96('0x22')][_0x5c07a3[_0x5c96('0x2c')]][_0x5c96('0x30')]=_[_0x5c96('0x31')](moment()[_0x5c96('0x28')]('x'));}this[_0x5c96('0x22')][_0x5c07a3['device']][_0x5c96('0x1e')]=_0x5c07a3[_0x5c96('0x1e')][_0x5c96('0x2e')]();logger[_0x5c96('0x1f')](_0x5c96('0x35'),util['inspect'](this[_0x5c96('0x22')][_0x5c07a3[_0x5c96('0x2c')]],{'showHidden':![],'depth':null}));this[_0x5c96('0x1a')](util['format'](_0x5c96('0x29'),this[_0x5c96('0x22')][_0x5c07a3[_0x5c96('0x2c')]]['name']),'trunk:save',this[_0x5c96('0x22')][_0x5c07a3[_0x5c96('0x2c')]]);}else if(_['startsWith'](_0x5c07a3['device'],'Local')){var _0x1b9c9b=_0x5c07a3['device'];var _0x2d9a3b=_0x1b9c9b[_0x5c96('0x36')](_0x1b9c9b[_0x5c96('0x37')]('/')+0x1,_0x1b9c9b[_0x5c96('0x37')]('@'));var _0x34e9d6=_[_0x5c96('0x21')](this[_0x5c96('0x7')],function(_0xc920e){return _0xc920e['mobile']==_0x2d9a3b||_0xc920e[_0x5c96('0x38')]==_0x2d9a3b||_0xc920e['accountcode']==_0x2d9a3b;});if(_0x34e9d6){if(_0x34e9d6['state']!==_0x5c07a3[_0x5c96('0x1e')][_0x5c96('0x2e')]()){_0x34e9d6[_0x5c96('0x30')]=_[_0x5c96('0x31')](moment()['format']('x'));}_0x34e9d6['state']=_0x5c07a3['state'][_0x5c96('0x2e')]();_0x34e9d6[_0x5c96('0x2f')]=!![];_0x34e9d6[_0x5c96('0x39')](_0x5c07a3);}}}}catch(_0xe3c4f7){logger[_0x5c96('0x10')]('[userReport][devicestatechange]',util[_0x5c96('0x14')](_0xe3c4f7,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x5c96('0x3a')]=function(_0x1d83ad){try{if(this[_0x5c96('0x18')](_0x1d83ad)&&this[_0x5c96('0x18')](_0x1d83ad[_0x5c96('0xd')])){logger[_0x5c96('0x1b')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x1d83ad['peer'],_0x1d83ad[_0x5c96('0x3b')],_0x1d83ad[_0x5c96('0xd')]);logger[_0x5c96('0x1f')](_0x5c96('0x3c'),util[_0x5c96('0x14')](_0x1d83ad,{'showHidden':![],'depth':null}));if(this[_0x5c96('0x7')][_0x1d83ad[_0x5c96('0x3d')]]){if(!this[_0x5c96('0x7')][_0x1d83ad[_0x5c96('0x3d')]][_0x5c96('0x2f')]||_0x1d83ad[_0x5c96('0xd')]['toLowerCase']()==_0x5c96('0x3e')){this[_0x5c96('0x7')][_0x1d83ad[_0x5c96('0x3d')]][_0x5c96('0x2f')]=![];this['agents'][_0x1d83ad[_0x5c96('0x3d')]][_0x5c96('0x3f')]=_0x1d83ad[_0x5c96('0xd')][_0x5c96('0x2e')]();this[_0x5c96('0x7')][_0x1d83ad[_0x5c96('0x3d')]]['address']=_0x1d83ad[_0x5c96('0x3b')];this[_0x5c96('0x7')][_0x1d83ad[_0x5c96('0x3d')]][_0x5c96('0x39')](_0x1d83ad);}}else if(this['telephones'][_0x1d83ad[_0x5c96('0x3d')]]){this[_0x5c96('0x8')][_0x1d83ad[_0x5c96('0x3d')]]['status']=_0x1d83ad[_0x5c96('0xd')][_0x5c96('0x2e')]();this[_0x5c96('0x8')][_0x1d83ad[_0x5c96('0x3d')]][_0x5c96('0x3b')]=_0x1d83ad[_0x5c96('0x3b')];logger['debug'](_0x5c96('0x40'),util[_0x5c96('0x14')](this['telephones'][_0x1d83ad[_0x5c96('0x3d')]],{'showHidden':![],'depth':null}));this[_0x5c96('0x1a')](util['format'](_0x5c96('0x33'),this['telephones'][_0x1d83ad['peer']][_0x5c96('0x2a')]),_0x5c96('0x34'),this[_0x5c96('0x8')][_0x1d83ad['peer']]);}else if(this['trunks'][_0x1d83ad[_0x5c96('0x3d')]]){this[_0x5c96('0x22')][_0x1d83ad[_0x5c96('0x3d')]][_0x5c96('0x3f')]=_0x1d83ad[_0x5c96('0xd')][_0x5c96('0x2e')]();this['trunks'][_0x1d83ad[_0x5c96('0x3d')]][_0x5c96('0x3b')]=_0x1d83ad['address'];logger[_0x5c96('0x1f')](_0x5c96('0x41'),util[_0x5c96('0x14')](this[_0x5c96('0x22')][_0x1d83ad[_0x5c96('0x3d')]],{'showHidden':![],'depth':null}));this[_0x5c96('0x1a')](util[_0x5c96('0x28')](_0x5c96('0x29'),this[_0x5c96('0x22')][_0x1d83ad[_0x5c96('0x3d')]]['name']),'trunk:save',this[_0x5c96('0x22')][_0x1d83ad['peer']]);}}}catch(_0x2058b5){logger[_0x5c96('0x10')](_0x5c96('0x3c'),util['inspect'](_0x2058b5,{'showHidden':![],'depth':null}));}};module[_0x5c96('0x42')]=UserReport; \ No newline at end of file +var _0xdf89=['resolve','then','catch','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','syncRegistry','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','stateRegistry','omit','event','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','find','mobile','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','lodash','moment','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow'];(function(_0x237c45,_0x55cf99){var _0x2942f6=function(_0x45a615){while(--_0x45a615){_0x237c45['push'](_0x237c45['shift']());}};_0x2942f6(++_0x55cf99);}(_0xdf89,0x19c));var _0x9df8=function(_0x13c686,_0x3b87f1){_0x13c686=_0x13c686-0x0;var _0x137fc0=_0xdf89[_0x13c686];return _0x137fc0;};'use strict';var _=require(_0x9df8('0x0'));var moment=require(_0x9df8('0x1'));var util=require('util');var Redis=require(_0x9df8('0x2'));var BPromise=require('bluebird');var config=require(_0x9df8('0x3'));var logger=require(_0x9df8('0x4'))('ami');var ami=require(_0x9df8('0x5'));config[_0x9df8('0x6')]=_[_0x9df8('0x7')](config[_0x9df8('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9df8('0x8'))(new Redis(config['redis']));function UserReport(_0xe6bb35){this[_0x9df8('0x9')]=_0xe6bb35[_0x9df8('0x9')];this[_0x9df8('0xa')]=_0xe6bb35[_0x9df8('0xa')];this[_0x9df8('0xb')]=_0xe6bb35[_0x9df8('0xb')];ami['on'](_0x9df8('0xc'),this['syncRegistry'][_0x9df8('0xd')](this));ami['on'](_0x9df8('0xe'),this['syncRegistry'][_0x9df8('0xd')](this));ami['on'](_0x9df8('0xf'),this[_0x9df8('0x10')]['bind'](this));ami['on'](_0x9df8('0x11'),this[_0x9df8('0x12')]['bind'](this));return this[_0x9df8('0x13')]();}function showSipRegistrations(){Promise[_0x9df8('0x14')]()[_0x9df8('0x15')](ami['actionSipShowRegistry']())[_0x9df8('0x16')](function(_0x31d0b7){logger['error']('[userReport][sipshowregistry]',util[_0x9df8('0x17')](_0x31d0b7,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x9df8('0x14')]()[_0x9df8('0x15')](ami[_0x9df8('0x18')]())[_0x9df8('0x16')](function(_0x457aa9){logger[_0x9df8('0x19')](_0x9df8('0x1a'),util[_0x9df8('0x17')](_0x457aa9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x9df8('0x14')]()[_0x9df8('0x15')](ami[_0x9df8('0x1b')]())[_0x9df8('0x16')](function(_0x2d7162){logger[_0x9df8('0x19')](_0x9df8('0x1c'),util[_0x9df8('0x17')](_0x2d7162,{'showHidden':![],'depth':null}));});}UserReport[_0x9df8('0x1d')][_0x9df8('0x13')]=function(){setInterval(function(){BPromise[_0x9df8('0x14')]()[_0x9df8('0x15')](showSipRegistrations())['then'](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x5f49d5){return _0x5f49d5!==null&&!_[_0x9df8('0x1e')](_0x5f49d5);};UserReport[_0x9df8('0x1d')][_0x9df8('0x1f')]=function(_0x346c81,_0x23bd59,_0x4bfe62){io['to'](_0x346c81)[_0x9df8('0x1f')](_0x23bd59,_0x4bfe62);};UserReport[_0x9df8('0x1d')][_0x9df8('0x20')]=function(_0x217b48){try{if(this[_0x9df8('0x21')](_0x217b48)){logger[_0x9df8('0x22')](_0x9df8('0x23'),_0x217b48[_0x9df8('0x24')],_0x217b48[_0x9df8('0x25')]);logger['debug']('[userReport][registry]',util[_0x9df8('0x17')](_0x217b48,{'showHidden':![],'depth':null}));var _0x2cf770=_['find'](this[_0x9df8('0x9')],{'registry':_0x217b48[_0x9df8('0x24')]});if(_0x2cf770){_0x217b48[_0x9df8('0x26')]=_0x217b48[_0x9df8('0x25')];_['merge'](_0x2cf770,_[_0x9df8('0x27')](_0x217b48,[_0x9df8('0x28'),'actionid',_0x9df8('0x24'),_0x9df8('0x25')]));logger[_0x9df8('0x29')](_0x9df8('0x2a'),util[_0x9df8('0x17')](_0x2cf770,{'showHidden':![],'depth':null}));this[_0x9df8('0x1f')](util[_0x9df8('0x2b')](_0x9df8('0x2c'),_0x2cf770[_0x9df8('0x2d')]),_0x9df8('0x2e'),_0x2cf770);}}}catch(_0x187f7e){logger[_0x9df8('0x19')]('[userReport][registry]',util[_0x9df8('0x17')](_0x187f7e,{'showHidden':![],'depth':null}));}};UserReport[_0x9df8('0x1d')][_0x9df8('0x10')]=function(_0x23bd71){try{if(this[_0x9df8('0x21')](_0x23bd71)){logger[_0x9df8('0x22')](_0x9df8('0x2f'),_0x23bd71['device'],_0x23bd71[_0x9df8('0x25')]);logger[_0x9df8('0x29')](_0x9df8('0x30'),util[_0x9df8('0x17')](_0x23bd71,{'showHidden':![],'depth':null}));if(this['agents'][_0x23bd71[_0x9df8('0x31')]]){if(!this[_0x9df8('0xa')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x32')]||_0x23bd71[_0x9df8('0x25')]['toLowerCase']()==_0x9df8('0x33')){this[_0x9df8('0xa')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x32')]=![];if(this[_0x9df8('0xa')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x25')]!==_0x23bd71[_0x9df8('0x25')][_0x9df8('0x34')]()){this['agents'][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x35')]=_[_0x9df8('0x36')](moment()[_0x9df8('0x2b')]('x'));}this['agents'][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x25')]=_0x23bd71[_0x9df8('0x25')][_0x9df8('0x34')]();this['agents'][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x37')](_0x23bd71);}}else if(this['telephones'][_0x23bd71['device']]){if(this[_0x9df8('0xb')][_0x23bd71['device']]['state']!==_0x23bd71[_0x9df8('0x25')][_0x9df8('0x34')]()){this[_0x9df8('0xb')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x35')]=_[_0x9df8('0x36')](moment()[_0x9df8('0x2b')]('x'));}this[_0x9df8('0xb')][_0x23bd71['device']][_0x9df8('0x25')]=_0x23bd71['state'][_0x9df8('0x34')]();logger['debug'](_0x9df8('0x38'),util[_0x9df8('0x17')](this['telephones'][_0x23bd71[_0x9df8('0x31')]],{'showHidden':![],'depth':null}));this[_0x9df8('0x1f')](util['format']('telephone:%s',this[_0x9df8('0xb')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x2d')]),_0x9df8('0x39'),this[_0x9df8('0xb')][_0x23bd71['device']]);}else if(this['trunks'][_0x23bd71[_0x9df8('0x31')]]){if(this[_0x9df8('0x9')][_0x23bd71[_0x9df8('0x31')]]['state']!==_0x23bd71['state'][_0x9df8('0x34')]()){this[_0x9df8('0x9')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x35')]=_[_0x9df8('0x36')](moment()[_0x9df8('0x2b')]('x'));}this[_0x9df8('0x9')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x25')]=_0x23bd71[_0x9df8('0x25')]['toLowerCase']();logger[_0x9df8('0x29')](_0x9df8('0x3a'),util[_0x9df8('0x17')](this[_0x9df8('0x9')][_0x23bd71[_0x9df8('0x31')]],{'showHidden':![],'depth':null}));this[_0x9df8('0x1f')](util[_0x9df8('0x2b')](_0x9df8('0x2c'),this[_0x9df8('0x9')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x2d')]),_0x9df8('0x2e'),this[_0x9df8('0x9')][_0x23bd71['device']]);}else if(_[_0x9df8('0x3b')](_0x23bd71[_0x9df8('0x31')],_0x9df8('0x3c'))){var _0x4ee054=_0x23bd71[_0x9df8('0x31')];var _0x4a0e2c=_0x4ee054[_0x9df8('0x3d')](_0x4ee054[_0x9df8('0x3e')]('/')+0x1,_0x4ee054['indexOf']('@'));var _0x19472d=_[_0x9df8('0x3f')](this['agents'],function(_0x2bafc5){return _0x2bafc5[_0x9df8('0x40')]==_0x4a0e2c||_0x2bafc5['phone']==_0x4a0e2c||_0x2bafc5[_0x9df8('0x41')]==_0x4a0e2c;});if(_0x19472d){if(_0x19472d[_0x9df8('0x25')]!==_0x23bd71['state'][_0x9df8('0x34')]()){_0x19472d[_0x9df8('0x35')]=_['toNumber'](moment()['format']('x'));}_0x19472d['state']=_0x23bd71[_0x9df8('0x25')][_0x9df8('0x34')]();_0x19472d[_0x9df8('0x32')]=!![];_0x19472d['updateStatusRealtime'](_0x23bd71);}}}}catch(_0x2c938a){logger['error'](_0x9df8('0x30'),util['inspect'](_0x2c938a,{'showHidden':![],'depth':null}));}};UserReport[_0x9df8('0x1d')][_0x9df8('0x12')]=function(_0x458b3f){try{if(this[_0x9df8('0x21')](_0x458b3f)&&this[_0x9df8('0x21')](_0x458b3f[_0x9df8('0x11')])){logger[_0x9df8('0x22')](_0x9df8('0x42'),_0x458b3f[_0x9df8('0x43')],_0x458b3f[_0x9df8('0x44')],_0x458b3f[_0x9df8('0x11')]);logger[_0x9df8('0x29')](_0x9df8('0x45'),util[_0x9df8('0x17')](_0x458b3f,{'showHidden':![],'depth':null}));if(this[_0x9df8('0xa')][_0x458b3f['peer']]){if(!this['agents'][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x32')]||_0x458b3f[_0x9df8('0x11')][_0x9df8('0x34')]()=='registered'){this[_0x9df8('0xa')][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x32')]=![];this[_0x9df8('0xa')][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x46')]=_0x458b3f['peerstatus'][_0x9df8('0x34')]();this[_0x9df8('0xa')][_0x458b3f[_0x9df8('0x43')]]['address']=_0x458b3f['address'];this[_0x9df8('0xa')][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x37')](_0x458b3f);}}else if(this[_0x9df8('0xb')][_0x458b3f[_0x9df8('0x43')]]){this['telephones'][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x46')]=_0x458b3f[_0x9df8('0x11')]['toLowerCase']();this[_0x9df8('0xb')][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x44')]=_0x458b3f[_0x9df8('0x44')];logger[_0x9df8('0x29')](_0x9df8('0x47'),util[_0x9df8('0x17')](this[_0x9df8('0xb')][_0x458b3f[_0x9df8('0x43')]],{'showHidden':![],'depth':null}));this[_0x9df8('0x1f')](util['format']('telephone:%s',this[_0x9df8('0xb')][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x2d')]),_0x9df8('0x39'),this[_0x9df8('0xb')][_0x458b3f[_0x9df8('0x43')]]);}else if(this[_0x9df8('0x9')][_0x458b3f[_0x9df8('0x43')]]){this['trunks'][_0x458b3f[_0x9df8('0x43')]]['status']=_0x458b3f[_0x9df8('0x11')][_0x9df8('0x34')]();this[_0x9df8('0x9')][_0x458b3f[_0x9df8('0x43')]]['address']=_0x458b3f[_0x9df8('0x44')];logger[_0x9df8('0x29')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x9df8('0x17')](this['trunks'][_0x458b3f[_0x9df8('0x43')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x9df8('0x2b')](_0x9df8('0x2c'),this[_0x9df8('0x9')][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x2d')]),_0x9df8('0x2e'),this[_0x9df8('0x9')][_0x458b3f[_0x9df8('0x43')]]);}}}catch(_0x6f540d){logger[_0x9df8('0x19')](_0x9df8('0x45'),util[_0x9df8('0x17')](_0x6f540d,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 1fa145d..3cefbcc 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 _0xdf18=['debug','uniqueid','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','destchannelstate','lastevent','connect','merge','agents','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','talktime','acw','acwTimeout','interface','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','voiceQueues','variables','agentcalled','agentconnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdf18,0x1ae));var _0x8df1=function(_0xb07424,_0x3093b0){_0xb07424=_0xb07424-0x0;var _0x45e1a2=_0xdf18[_0xb07424];return _0x45e1a2;};'use strict';var _=require(_0x8df1('0x0'));var moment=require(_0x8df1('0x1'));var util=require('util');var Redis=require(_0x8df1('0x2'));var config=require(_0x8df1('0x3'));var logger=require(_0x8df1('0x4'))(_0x8df1('0x5'));var ami=require(_0x8df1('0x6'));config[_0x8df1('0x7')]=_[_0x8df1('0x8')](config['redis'],{'host':_0x8df1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8df1('0x7')]));function VoiceAgentReport(_0x112436){this['channels']={};this[_0x8df1('0xa')]=_0x112436[_0x8df1('0xa')];this['agents']=_0x112436['agents'];this[_0x8df1('0xb')]={};ami['on'](_0x8df1('0xc'),this['syncAgentCalled']['bind'](this));ami['on'](_0x8df1('0xd'),this['syncAgentConnect'][_0x8df1('0xe')](this));ami['on'](_0x8df1('0xf'),this[_0x8df1('0x10')][_0x8df1('0xe')](this));ami['on'](_0x8df1('0x11'),this[_0x8df1('0x12')][_0x8df1('0xe')](this));ami['on'](_0x8df1('0x13'),this[_0x8df1('0x14')][_0x8df1('0xe')](this));ami['on'](_0x8df1('0x15'),this[_0x8df1('0x16')][_0x8df1('0xe')](this));ami['on'](_0x8df1('0x17'),this['syncHangup'][_0x8df1('0xe')](this));ami['on']('musiconholdstart',this[_0x8df1('0x18')][_0x8df1('0xe')](this));ami['on']('musiconholdstop',this[_0x8df1('0x19')][_0x8df1('0xe')](this));ami['on'](_0x8df1('0x1a'),this[_0x8df1('0x1b')][_0x8df1('0xe')](this));ami['on'](_0x8df1('0x1c'),this['syncBlindTransfer'][_0x8df1('0xe')](this));}VoiceAgentReport[_0x8df1('0x1d')][_0x8df1('0x1e')]=function(_0x393aa7,_0xa7bc86,_0x4111f4){io['to'](_0x393aa7)['emit'](_0xa7bc86,_0x4111f4);};VoiceAgentReport[_0x8df1('0x1d')][_0x8df1('0x1f')]=function(_0x15c62f){return _0x15c62f!==null&&!_[_0x8df1('0x20')](_0x15c62f);};VoiceAgentReport['prototype'][_0x8df1('0x21')]=function(_0x4cea09){try{if(this['isNotNull'](_0x4cea09)){logger[_0x8df1('0x22')](_0x8df1('0x23'),_0x4cea09['uniqueid'],_0x4cea09[_0x8df1('0x24')],_0x4cea09[_0x8df1('0x25')]);logger[_0x8df1('0x26')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x4cea09[_0x8df1('0x27')],util[_0x8df1('0x28')](_0x4cea09,{'showHidden':![],'depth':null}));if(_[_0x8df1('0x20')](this[_0x8df1('0x29')][_0x4cea09['uniqueid']])){this['channels'][_0x4cea09[_0x8df1('0x27')]]={};}if(_['isUndefined'](this[_0x8df1('0x29')][_0x4cea09[_0x8df1('0x27')]][_0x4cea09['destuniqueid']])){this['channels'][_0x4cea09['uniqueid']][_0x4cea09[_0x8df1('0x25')]]={'agentcalledAt':moment()[_0x8df1('0x2a')](_0x8df1('0x2b')),'lastevent':_0x8df1('0x2c'),'mandatoryDisposition':this[_0x8df1('0xa')][_0x4cea09['queue']]?this[_0x8df1('0xa')][_0x4cea09[_0x8df1('0x2d')]][_0x8df1('0x2e')]||![]:![],'type':this[_0x8df1('0xa')][_0x4cea09[_0x8df1('0x2d')]]?this[_0x8df1('0xa')][_0x4cea09[_0x8df1('0x2d')]][_0x8df1('0x2f')]||_0x8df1('0x30'):'inbound','variables':this[_0x8df1('0xb')][_0x4cea09[_0x8df1('0x27')]]};}_['merge'](this[_0x8df1('0x29')][_0x4cea09['uniqueid']][_0x4cea09[_0x8df1('0x25')]],_[_0x8df1('0x31')](_0x4cea09,[_0x8df1('0x32'),_0x8df1('0x33')]));logger[_0x8df1('0x26')](_0x8df1('0x34'),_0x4cea09[_0x8df1('0x27')],util['inspect'](this[_0x8df1('0x29')][_0x4cea09['uniqueid']][_0x4cea09['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x8df1('0x1e')](_0x8df1('0x35'),this['channels'][_0x4cea09[_0x8df1('0x27')]][_0x4cea09[_0x8df1('0x25')]]);logger['debug'](_0x8df1('0x36'),_0x4cea09[_0x8df1('0x27')],util[_0x8df1('0x28')](this[_0x8df1('0x29')][_0x4cea09[_0x8df1('0x27')]][_0x4cea09[_0x8df1('0x25')]],{'showHidden':![],'depth':null}));this[_0x8df1('0x1e')](util[_0x8df1('0x2a')](_0x8df1('0x37'),_0x4cea09[_0x8df1('0x24')]),_0x8df1('0x38'),this[_0x8df1('0x29')][_0x4cea09[_0x8df1('0x27')]][_0x4cea09['destuniqueid']]);}}catch(_0x2a8c9e){logger[_0x8df1('0x39')]('[%s][voiceAgentReport][agentcalled]',_0x4cea09['uniqueid'],util[_0x8df1('0x28')](_0x2a8c9e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8df1('0x1d')][_0x8df1('0x3a')]=function(_0x184db2){try{if(this[_0x8df1('0x1f')](_0x184db2)){if(this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]]){logger['debug']('[%s][voiceAgentReport][agentconnect]\x20event:',_0x184db2['uniqueid'],util[_0x8df1('0x28')](_0x184db2,{'showHidden':![],'depth':null}));for(var _0x3b8192 in this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]]){if(this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]]['hasOwnProperty'](_0x3b8192)){if(_0x184db2[_0x8df1('0x25')]===_0x3b8192){logger[_0x8df1('0x22')](_0x8df1('0x3b'),_0x184db2[_0x8df1('0x27')],_0x184db2[_0x8df1('0x24')],_0x184db2[_0x8df1('0x25')]);this[_0x8df1('0x29')][_0x184db2['uniqueid']][_0x3b8192][_0x8df1('0x3c')]=moment()[_0x8df1('0x2a')](_0x8df1('0x2b'));this[_0x8df1('0x29')][_0x184db2['uniqueid']][_0x3b8192][_0x8df1('0x3d')]=_0x184db2['connectedlinename'];this['channels'][_0x184db2[_0x8df1('0x27')]][_0x3b8192]['connectedlinenum']=_0x184db2['connectedlinenum'];this['channels'][_0x184db2[_0x8df1('0x27')]][_0x3b8192][_0x8df1('0x3e')]=_0x184db2[_0x8df1('0x3e')];this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x3b8192]['destchannelstatedesc']=_0x184db2['destchannelstatedesc'];this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x3b8192]['holdtime']=_0x184db2['holdtime'];this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x3b8192][_0x8df1('0x3f')]=_0x8df1('0x40');_[_0x8df1('0x41')](this[_0x8df1('0x42')][_0x184db2['interface']],_[_0x8df1('0x43')](_0x184db2,[_0x8df1('0x2d'),'destconnectedlinenum']));logger[_0x8df1('0x26')](_0x8df1('0x44'),_0x184db2['uniqueid'],util[_0x8df1('0x28')](this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x184db2[_0x8df1('0x25')]],{'showHidden':![],'depth':null}));ami[_0x8df1('0x1e')](_0x8df1('0x45'),this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x184db2['destuniqueid']]);logger[_0x8df1('0x26')](_0x8df1('0x46'),_0x184db2[_0x8df1('0x27')],util[_0x8df1('0x28')](this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x184db2[_0x8df1('0x25')]],{'showHidden':![],'depth':null}));this[_0x8df1('0x1e')](util[_0x8df1('0x2a')](_0x8df1('0x37'),_0x184db2[_0x8df1('0x24')]),_0x8df1('0x47'),this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x184db2[_0x8df1('0x25')]]);}else if(!this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x3b8192][_0x8df1('0xf')]&&!this[_0x8df1('0x29')][_0x184db2['uniqueid']][_0x3b8192][_0x8df1('0x13')]){logger[_0x8df1('0x22')](_0x8df1('0x48'),_0x184db2[_0x8df1('0x27')],this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x3b8192][_0x8df1('0x24')],_0x3b8192);this['channels'][_0x184db2[_0x8df1('0x27')]][_0x3b8192]['agentringnoanswer']=!![];this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x3b8192][_0x8df1('0x49')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x184db2['uniqueid']][_0x3b8192][_0x8df1('0x4a')]=_0x184db2['destuniqueid'];this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x3b8192][_0x8df1('0x4b')]=_0x184db2[_0x8df1('0x24')];this[_0x8df1('0x29')][_0x184db2['uniqueid']][_0x3b8192][_0x8df1('0x3f')]=_0x8df1('0x4c');this[_0x8df1('0x29')][_0x184db2['uniqueid']][_0x3b8192][_0x8df1('0x4d')]=_0x8df1('0x4c');logger['debug'](_0x8df1('0x4e'),_0x184db2['uniqueid'],util[_0x8df1('0x28')](this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x3b8192],{'showHidden':![],'depth':null}));ami['emit'](_0x8df1('0x4f'),this[_0x8df1('0x29')][_0x184db2[_0x8df1('0x27')]][_0x3b8192]);}}}}}}catch(_0x21dfef){logger[_0x8df1('0x39')](_0x8df1('0x50'),_0x184db2['uniqueid'],util[_0x8df1('0x28')](_0x21dfef,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8df1('0x1d')][_0x8df1('0x10')]=function(_0x2afa03){try{if(this[_0x8df1('0x1f')](_0x2afa03)){logger[_0x8df1('0x26')](_0x8df1('0x51'),_0x2afa03[_0x8df1('0x27')],util[_0x8df1('0x28')](_0x2afa03,{'showHidden':![],'depth':null}));if(this[_0x8df1('0x29')][_0x2afa03[_0x8df1('0x27')]]&&this[_0x8df1('0x29')][_0x2afa03[_0x8df1('0x27')]][_0x2afa03[_0x8df1('0x25')]]){logger['info'](_0x8df1('0x52'),_0x2afa03[_0x8df1('0x27')],_0x2afa03['membername'],_0x2afa03[_0x8df1('0x25')]);this['channels'][_0x2afa03[_0x8df1('0x27')]][_0x2afa03['destuniqueid']][_0x8df1('0xf')]=!![];this[_0x8df1('0x29')][_0x2afa03[_0x8df1('0x27')]][_0x2afa03[_0x8df1('0x25')]][_0x8df1('0x49')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2afa03[_0x8df1('0x27')]][_0x2afa03[_0x8df1('0x25')]]['lastevent']=_0x8df1('0x53');this[_0x8df1('0x29')][_0x2afa03[_0x8df1('0x27')]][_0x2afa03[_0x8df1('0x25')]]['reason']=_0x8df1('0x53');logger[_0x8df1('0x26')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x2afa03['uniqueid'],util['inspect'](this[_0x8df1('0x29')][_0x2afa03['uniqueid']][_0x2afa03[_0x8df1('0x25')]],{'showHidden':![],'depth':null}));ami[_0x8df1('0x1e')](_0x8df1('0x54'),this[_0x8df1('0x29')][_0x2afa03['uniqueid']][_0x2afa03['destuniqueid']]);}}}catch(_0x34c210){logger['error'](_0x8df1('0x55'),_0x2afa03['uniqueid'],util[_0x8df1('0x28')](_0x34c210,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8df1('0x1d')][_0x8df1('0x12')]=function(_0x5f4a2d){try{if(this['isNotNull'](_0x5f4a2d)){logger[_0x8df1('0x26')](_0x8df1('0x56'),_0x5f4a2d['uniqueid'],util[_0x8df1('0x28')](_0x5f4a2d,{'showHidden':![],'depth':null}));if(this[_0x8df1('0x29')][_0x5f4a2d['uniqueid']]){for(var _0x1fea18 in this[_0x8df1('0x29')][_0x5f4a2d[_0x8df1('0x27')]]){if(this[_0x8df1('0x29')][_0x5f4a2d[_0x8df1('0x27')]][_0x8df1('0x57')](_0x1fea18)&&!this[_0x8df1('0x29')][_0x5f4a2d[_0x8df1('0x27')]][_0x1fea18][_0x8df1('0xf')]&&!this['channels'][_0x5f4a2d[_0x8df1('0x27')]][_0x1fea18][_0x8df1('0x13')]){logger[_0x8df1('0x22')](_0x8df1('0x58'),_0x5f4a2d[_0x8df1('0x27')],this[_0x8df1('0x29')][_0x5f4a2d[_0x8df1('0x27')]][_0x1fea18]['membername'],_0x1fea18);this[_0x8df1('0x29')][_0x5f4a2d[_0x8df1('0x27')]][_0x1fea18][_0x8df1('0xf')]=!![];this[_0x8df1('0x29')][_0x5f4a2d['uniqueid']][_0x1fea18][_0x8df1('0x49')]=moment()[_0x8df1('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8df1('0x29')][_0x5f4a2d['uniqueid']][_0x1fea18][_0x8df1('0x3f')]=_0x8df1('0x59');this[_0x8df1('0x29')][_0x5f4a2d['uniqueid']][_0x1fea18]['reason']=_0x8df1('0x59');logger[_0x8df1('0x26')](_0x8df1('0x5a'),_0x5f4a2d[_0x8df1('0x27')],util['inspect'](this['channels'][_0x5f4a2d[_0x8df1('0x27')]][_0x1fea18],{'showHidden':![],'depth':null}));ami[_0x8df1('0x1e')]('custom:agentqueuecallerabandon',this[_0x8df1('0x29')][_0x5f4a2d[_0x8df1('0x27')]][_0x1fea18]);}}}}}catch(_0x5b7c0e){logger[_0x8df1('0x39')](_0x8df1('0x5b'),_0x5f4a2d['uniqueid'],util[_0x8df1('0x28')](_0x5b7c0e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8df1('0x1d')][_0x8df1('0x14')]=function(_0x433de8){try{if(this['isNotNull'](_0x433de8)){logger['debug'](_0x8df1('0x5c'),_0x433de8[_0x8df1('0x27')],util[_0x8df1('0x28')](_0x433de8,{'showHidden':![],'depth':null}));if(this[_0x8df1('0x29')][_0x433de8[_0x8df1('0x27')]]){for(var _0x14c6b8 in this[_0x8df1('0x29')][_0x433de8['uniqueid']]){if(this[_0x8df1('0x29')][_0x433de8[_0x8df1('0x27')]][_0x8df1('0x57')](_0x14c6b8)){if(this[_0x8df1('0x29')][_0x433de8['uniqueid']][_0x14c6b8]['agentconnectAt']&&!this[_0x8df1('0x29')][_0x433de8['uniqueid']][_0x14c6b8][_0x8df1('0x13')]){logger[_0x8df1('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x433de8[_0x8df1('0x27')],this[_0x8df1('0x29')][_0x433de8[_0x8df1('0x27')]][_0x14c6b8][_0x8df1('0x24')],_0x14c6b8);this[_0x8df1('0x29')][_0x433de8[_0x8df1('0x27')]][_0x14c6b8][_0x8df1('0x13')]=!![];this[_0x8df1('0x29')][_0x433de8[_0x8df1('0x27')]][_0x14c6b8][_0x8df1('0x5d')]=moment()[_0x8df1('0x2a')](_0x8df1('0x2b'));this[_0x8df1('0x29')][_0x433de8[_0x8df1('0x27')]][_0x14c6b8]['lastevent']=_0x8df1('0x5e');this[_0x8df1('0x29')][_0x433de8[_0x8df1('0x27')]][_0x14c6b8][_0x8df1('0x4d')]=_0x433de8['reason']==_0x8df1('0x5f')?'agent':_0x433de8[_0x8df1('0x4d')];this[_0x8df1('0x29')][_0x433de8['uniqueid']][_0x14c6b8]['talktime']=_0x433de8[_0x8df1('0x60')];if(this[_0x8df1('0xa')][_0x433de8['queue']]&&this[_0x8df1('0xa')][_0x433de8['queue']][_0x8df1('0x61')]){this[_0x8df1('0x29')][_0x433de8[_0x8df1('0x27')]][_0x14c6b8]['acwtime']=this[_0x8df1('0xa')][_0x433de8[_0x8df1('0x2d')]][_0x8df1('0x62')];this[_0x8df1('0x29')][_0x433de8[_0x8df1('0x27')]][_0x14c6b8]['agentacw']=!![];}this[_0x8df1('0x42')][_0x433de8['interface']]=_[_0x8df1('0x31')](this[_0x8df1('0x42')][_0x433de8[_0x8df1('0x63')]],[_0x8df1('0x2d'),_0x8df1('0x64')]);logger[_0x8df1('0x26')](_0x8df1('0x65'),_0x433de8[_0x8df1('0x27')],util[_0x8df1('0x28')](this['channels'][_0x433de8[_0x8df1('0x27')]][_0x14c6b8],{'showHidden':![],'depth':null}));ami['emit'](_0x8df1('0x66'),this[_0x8df1('0x29')][_0x433de8['uniqueid']][_0x14c6b8]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x433de8[_0x8df1('0x27')],util['inspect'](this[_0x8df1('0x29')][_0x433de8[_0x8df1('0x27')]][_0x14c6b8],{'showHidden':![],'depth':null}));this[_0x8df1('0x1e')](util[_0x8df1('0x2a')](_0x8df1('0x37'),_0x433de8[_0x8df1('0x24')]),_0x8df1('0x67'),this[_0x8df1('0x29')][_0x433de8[_0x8df1('0x27')]][_0x14c6b8]);}}}}}}catch(_0x26b83b){logger[_0x8df1('0x39')]('[%s][voiceAgentReport][agentcomplete]',_0x433de8[_0x8df1('0x27')],util[_0x8df1('0x28')](_0x26b83b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x1a5947){try{if(this[_0x8df1('0x1f')](_0x1a5947)){logger[_0x8df1('0x26')](_0x8df1('0x68'),_0x1a5947[_0x8df1('0x27')],util[_0x8df1('0x28')](_0x1a5947,{'showHidden':![],'depth':null}));this[_0x8df1('0x69')](_0x1a5947['uniqueid'],_[_0x8df1('0x6a')](_0x1a5947[_0x8df1('0x6b')])[0x0],_0x1a5947['value']);if(this['channels'][_0x1a5947[_0x8df1('0x27')]]){for(var _0x35e9bc in this['channels'][_0x1a5947[_0x8df1('0x27')]]){if(this[_0x8df1('0x29')][_0x1a5947['uniqueid']][_0x8df1('0x57')](_0x35e9bc)){logger[_0x8df1('0x22')](_0x8df1('0x6c'),_0x1a5947[_0x8df1('0x27')],_0x35e9bc,_[_0x8df1('0x6a')](_0x1a5947[_0x8df1('0x6b')])[0x0],_0x1a5947[_0x8df1('0x6d')]);if(_[_0x8df1('0x20')](this['channels'][_0x1a5947[_0x8df1('0x27')]][_0x35e9bc][_0x8df1('0xb')])){this[_0x8df1('0x29')][_0x1a5947['uniqueid']][_0x35e9bc][_0x8df1('0xb')]={};}this['channels'][_0x1a5947[_0x8df1('0x27')]][_0x35e9bc][_0x8df1('0xb')]=this[_0x8df1('0xb')][_0x1a5947['uniqueid']];}}}}}catch(_0xefac3f){logger[_0x8df1('0x39')](_0x8df1('0x6e'),_0x1a5947['uniqueid'],util[_0x8df1('0x28')](_0xefac3f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8df1('0x1d')][_0x8df1('0x69')]=function(_0x508ebb,_0xd28327,_0x3b9437){var _0x1062f8=[_0x8df1('0x6f'),'rtpaudioqosbridged',_0x8df1('0x70'),_0x8df1('0x71'),_0x8df1('0x72'),_0x8df1('0x73'),_0x8df1('0x74'),'rtpaudioqosrttbridged',_0x8df1('0x75'),_0x8df1('0x76'),_0x8df1('0x77'),_0x8df1('0x78'),_0x8df1('0x79'),_0x8df1('0x7a'),_0x8df1('0x7b'),_0x8df1('0x7c'),_0x8df1('0x24'),_0x8df1('0x7d'),'memberrealtime'];if(!_[_0x8df1('0x7e')](_0xd28327)&&!_[_0x8df1('0x7f')](_0x1062f8,_0xd28327)){if(_[_0x8df1('0x20')](this['variables'][_0x508ebb])){this['variables'][_0x508ebb]={};}this[_0x8df1('0xb')][_0x508ebb][_0xd28327]=_0x3b9437;}};VoiceAgentReport['prototype'][_0x8df1('0x80')]=function(_0x3bc155){try{if(this[_0x8df1('0x1f')](_0x3bc155)){logger[_0x8df1('0x26')](_0x8df1('0x81'),_0x3bc155[_0x8df1('0x27')],util[_0x8df1('0x28')](_0x3bc155,{'showHidden':![],'depth':null}));if(this[_0x8df1('0x29')][_0x3bc155[_0x8df1('0x27')]]){for(var _0x192c85 in this[_0x8df1('0x29')][_0x3bc155[_0x8df1('0x27')]]){if(this[_0x8df1('0x29')][_0x3bc155['uniqueid']][_0x8df1('0x57')](_0x192c85)){if(this['channels'][_0x3bc155[_0x8df1('0x27')]][_0x192c85][_0x8df1('0x4d')]=='transfer'&&this['channels'][_0x3bc155['uniqueid']][_0x192c85]['agentcomplete']){logger['info'](_0x8df1('0x82'),_0x3bc155[_0x8df1('0x27')],_0x192c85);this[_0x8df1('0x29')][_0x3bc155[_0x8df1('0x27')]][_0x192c85][_0x8df1('0x5d')]=moment()[_0x8df1('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x8df1('0x26')](_0x8df1('0x83'),_0x3bc155[_0x8df1('0x27')],util['inspect'](_[_0x8df1('0x84')](this[_0x8df1('0x29')][_0x3bc155['uniqueid']]),{'showHidden':![],'depth':null}));ami['emit'](_0x8df1('0x85'),_[_0x8df1('0x84')](this[_0x8df1('0x29')][_0x3bc155['uniqueid']]));delete this[_0x8df1('0x29')][_0x3bc155['uniqueid']];}if(this[_0x8df1('0xb')][_0x3bc155['uniqueid']]){delete this[_0x8df1('0xb')][_0x3bc155[_0x8df1('0x27')]];}}}catch(_0x570f61){logger[_0x8df1('0x39')](_0x8df1('0x86'),_0x3bc155['uniqueid'],util['inspect'](_0x570f61,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8df1('0x1d')]['syncAttendedTransfer']=function(_0x4a5680){try{if(this[_0x8df1('0x1f')](_0x4a5680)){logger[_0x8df1('0x26')](_0x8df1('0x87'),_0x4a5680['uniqueid'],util[_0x8df1('0x28')](_0x4a5680,{'showHidden':![],'depth':null}));if(this[_0x8df1('0x29')][_0x4a5680[_0x8df1('0x88')]]){for(var _0x351827 in this['channels'][_0x4a5680[_0x8df1('0x88')]]){if(this['channels'][_0x4a5680[_0x8df1('0x88')]][_0x8df1('0x57')](_0x351827)){if(_0x4a5680[_0x8df1('0x89')]===_0x351827){logger[_0x8df1('0x22')](_0x8df1('0x8a'),_0x4a5680[_0x8df1('0x27')],this[_0x8df1('0x29')][_0x4a5680[_0x8df1('0x88')]][_0x351827][_0x8df1('0x24')],_0x351827);var _0x50bba4=moment();this[_0x8df1('0x29')][_0x4a5680['transfereeuniqueid']][_0x351827]['agentcomplete']=!![];this[_0x8df1('0x29')][_0x4a5680[_0x8df1('0x88')]][_0x351827][_0x8df1('0x5d')]=moment()[_0x8df1('0x2a')](_0x8df1('0x2b'));this[_0x8df1('0x29')][_0x4a5680[_0x8df1('0x88')]][_0x351827][_0x8df1('0x3f')]=_0x8df1('0x5e');this[_0x8df1('0x29')][_0x4a5680['transfereeuniqueid']][_0x351827][_0x8df1('0x4d')]='transfer';this['channels'][_0x4a5680['transfereeuniqueid']][_0x351827][_0x8df1('0x60')]=_0x50bba4['diff'](this[_0x8df1('0x29')][_0x4a5680[_0x8df1('0x88')]][_0x351827][_0x8df1('0x3c')],_0x8df1('0x8b'));}}}}if(this[_0x8df1('0x29')][_0x4a5680[_0x8df1('0x8c')]]){var _0x4c4ac6=this[_0x8df1('0x29')][_0x4a5680[_0x8df1('0x8c')]];this[_0x8df1('0x29')][_0x4a5680['secondtransfereruniqueid']]=this[_0x8df1('0x29')][_0x4a5680[_0x8df1('0x88')]];this[_0x8df1('0x29')][_0x4a5680[_0x8df1('0x88')]]=_0x4c4ac6;}}}catch(_0x43d9b7){logger[_0x8df1('0x39')](_0x8df1('0x8d'),_0x4a5680[_0x8df1('0x27')],util[_0x8df1('0x28')](_0x43d9b7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8df1('0x1d')][_0x8df1('0x8e')]=function(_0xcf34f6){try{if(this['isNotNull'](_0xcf34f6)){logger[_0x8df1('0x26')](_0x8df1('0x8f'),_0xcf34f6['uniqueid'],util[_0x8df1('0x28')](_0xcf34f6,{'showHidden':![],'depth':null}));if(this[_0x8df1('0x29')][_0xcf34f6[_0x8df1('0x88')]]){for(var _0x3ed54b in this[_0x8df1('0x29')][_0xcf34f6[_0x8df1('0x88')]]){if(this[_0x8df1('0x29')][_0xcf34f6[_0x8df1('0x88')]][_0x8df1('0x57')](_0x3ed54b)){if(_0xcf34f6[_0x8df1('0x90')]===_0x3ed54b){logger[_0x8df1('0x22')](_0x8df1('0x91'),_0xcf34f6[_0x8df1('0x27')],this['channels'][_0xcf34f6[_0x8df1('0x88')]][_0x3ed54b][_0x8df1('0x24')],_0x3ed54b);var _0x561134=moment();this['channels'][_0xcf34f6[_0x8df1('0x88')]][_0x3ed54b][_0x8df1('0x13')]=!![];this['channels'][_0xcf34f6[_0x8df1('0x88')]][_0x3ed54b][_0x8df1('0x5d')]=_0x561134;this[_0x8df1('0x29')][_0xcf34f6[_0x8df1('0x88')]][_0x3ed54b][_0x8df1('0x3f')]=_0x8df1('0x5e');this[_0x8df1('0x29')][_0xcf34f6[_0x8df1('0x88')]][_0x3ed54b][_0x8df1('0x4d')]=_0x8df1('0x5f');this['channels'][_0xcf34f6['transfereeuniqueid']][_0x3ed54b]['talktime']=_0x561134[_0x8df1('0x92')](this[_0x8df1('0x29')][_0xcf34f6[_0x8df1('0x88')]][_0x3ed54b][_0x8df1('0x3c')],_0x8df1('0x8b'));}}}}}}catch(_0x48ff91){logger['error']('[%s][voiceAgentReport][blindtransfer]',_0xcf34f6[_0x8df1('0x27')],util[_0x8df1('0x28')](_0x48ff91,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8df1('0x1d')][_0x8df1('0x18')]=function(_0x2986eb){var _0xc88aac='';try{if(this[_0x8df1('0x1f')](_0x2986eb)){logger['debug'](_0x8df1('0x93'),_0x2986eb[_0x8df1('0x27')],util[_0x8df1('0x28')](_0x2986eb,{'showHidden':![],'depth':null}));if(_0x2986eb[_0x8df1('0x94')]){_0xc88aac=_0x2986eb[_0x8df1('0x94')]['substring'](0x0,_0x2986eb[_0x8df1('0x94')][_0x8df1('0x95')]('-'));if(this['agents'][_0xc88aac]){logger[_0x8df1('0x22')](_0x8df1('0x96'),_0x2986eb['uniqueid'],_0xc88aac);this[_0x8df1('0x42')][_0xc88aac][_0x8df1('0x97')]=!![];}}}}catch(_0x3c5016){logger[_0x8df1('0x39')]('[%s][voiceAgentReport][musiconholdstart]',_0x2986eb[_0x8df1('0x27')],util[_0x8df1('0x28')](_0x3c5016,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8df1('0x1d')][_0x8df1('0x19')]=function(_0x3f0ab1){var _0x159d52='';try{if(this['isNotNull'](_0x3f0ab1)){logger[_0x8df1('0x26')](_0x8df1('0x98'),_0x3f0ab1['uniqueid'],util[_0x8df1('0x28')](_0x3f0ab1,{'showHidden':![],'depth':null}));if(_0x3f0ab1['channel']){_0x159d52=_0x3f0ab1[_0x8df1('0x94')][_0x8df1('0x99')](0x0,_0x3f0ab1[_0x8df1('0x94')]['lastIndexOf']('-'));if(this['agents'][_0x159d52]){logger[_0x8df1('0x22')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3f0ab1[_0x8df1('0x27')],_0x159d52);this[_0x8df1('0x42')][_0x159d52]['onhold']=![];}}}}catch(_0x2e839e){logger[_0x8df1('0x39')](_0x8df1('0x9a'),_0x3f0ab1[_0x8df1('0x27')],util['inspect'](_0x2e839e,{'showHidden':![],'depth':null}));}};module[_0x8df1('0x9b')]=VoiceAgentReport; \ No newline at end of file +var _0xd01f=['agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','moment','util','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','user:%s','user:called','error','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere'];(function(_0xeba30e,_0x1526dc){var _0x55d491=function(_0x226e04){while(--_0x226e04){_0xeba30e['push'](_0xeba30e['shift']());}};_0x55d491(++_0x1526dc);}(_0xd01f,0x17b));var _0xfd01=function(_0xb1bd,_0x48532c){_0xb1bd=_0xb1bd-0x0;var _0x18c10a=_0xd01f[_0xb1bd];return _0x18c10a;};'use strict';var _=require('lodash');var moment=require(_0xfd01('0x0'));var util=require(_0xfd01('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xfd01('0x2'))(_0xfd01('0x3'));var ami=require(_0xfd01('0x4'));config[_0xfd01('0x5')]=_[_0xfd01('0x6')](config[_0xfd01('0x5')],{'host':_0xfd01('0x7'),'port':0x18eb});var io=require(_0xfd01('0x8'))(new Redis(config['redis']));function VoiceAgentReport(_0x15072b){this[_0xfd01('0x9')]={};this[_0xfd01('0xa')]=_0x15072b[_0xfd01('0xa')];this[_0xfd01('0xb')]=_0x15072b[_0xfd01('0xb')];this[_0xfd01('0xc')]={};ami['on']('agentcalled',this[_0xfd01('0xd')]['bind'](this));ami['on'](_0xfd01('0xe'),this[_0xfd01('0xf')][_0xfd01('0x10')](this));ami['on'](_0xfd01('0x11'),this['syncAgentRingNoAnswer'][_0xfd01('0x10')](this));ami['on'](_0xfd01('0x12'),this[_0xfd01('0x13')]['bind'](this));ami['on'](_0xfd01('0x14'),this[_0xfd01('0x15')][_0xfd01('0x10')](this));ami['on'](_0xfd01('0x16'),this['syncVarSet']['bind'](this));ami['on'](_0xfd01('0x17'),this[_0xfd01('0x18')]['bind'](this));ami['on'](_0xfd01('0x19'),this[_0xfd01('0x1a')]['bind'](this));ami['on'](_0xfd01('0x1b'),this[_0xfd01('0x1c')][_0xfd01('0x10')](this));ami['on'](_0xfd01('0x1d'),this['syncAttendedTransfer'][_0xfd01('0x10')](this));ami['on'](_0xfd01('0x1e'),this[_0xfd01('0x1f')][_0xfd01('0x10')](this));}VoiceAgentReport[_0xfd01('0x20')]['emit']=function(_0x53f97e,_0x5344fd,_0x59e61e){io['to'](_0x53f97e)[_0xfd01('0x21')](_0x5344fd,_0x59e61e);};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x22')]=function(_0x557828){return _0x557828!==null&&!_[_0xfd01('0x23')](_0x557828);};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0xd')]=function(_0x5a11ec){try{if(this['isNotNull'](_0x5a11ec)){logger[_0xfd01('0x24')](_0xfd01('0x25'),_0x5a11ec[_0xfd01('0x26')],_0x5a11ec[_0xfd01('0x27')],_0x5a11ec['destuniqueid']);logger['debug'](_0xfd01('0x28'),_0x5a11ec[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x5a11ec,{'showHidden':![],'depth':null}));if(_[_0xfd01('0x23')](this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]])){this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]]={};}if(_[_0xfd01('0x23')](this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]][_0x5a11ec[_0xfd01('0x2a')]])){this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]][_0x5a11ec[_0xfd01('0x2a')]]={'agentcalledAt':moment()[_0xfd01('0x2b')](_0xfd01('0x2c')),'lastevent':_0xfd01('0x2d'),'mandatoryDisposition':this[_0xfd01('0xa')][_0x5a11ec[_0xfd01('0x2e')]]?this['voiceQueues'][_0x5a11ec[_0xfd01('0x2e')]][_0xfd01('0x2f')]||![]:![],'type':this[_0xfd01('0xa')][_0x5a11ec[_0xfd01('0x2e')]]?this[_0xfd01('0xa')][_0x5a11ec[_0xfd01('0x2e')]][_0xfd01('0x30')]||_0xfd01('0x31'):_0xfd01('0x31'),'variables':this[_0xfd01('0xc')][_0x5a11ec[_0xfd01('0x26')]]};}_[_0xfd01('0x32')](this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]][_0x5a11ec[_0xfd01('0x2a')]],_[_0xfd01('0x33')](_0x5a11ec,[_0xfd01('0x34'),_0xfd01('0x35')]));logger[_0xfd01('0x36')](_0xfd01('0x37'),_0x5a11ec[_0xfd01('0x26')],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]][_0x5a11ec['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xfd01('0x21')](_0xfd01('0x38'),this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]][_0x5a11ec[_0xfd01('0x2a')]]);logger[_0xfd01('0x36')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x5a11ec[_0xfd01('0x26')],util['inspect'](this[_0xfd01('0x9')][_0x5a11ec['uniqueid']][_0x5a11ec['destuniqueid']],{'showHidden':![],'depth':null}));this[_0xfd01('0x21')](util[_0xfd01('0x2b')](_0xfd01('0x39'),_0x5a11ec[_0xfd01('0x27')]),_0xfd01('0x3a'),this['channels'][_0x5a11ec[_0xfd01('0x26')]][_0x5a11ec[_0xfd01('0x2a')]]);}}catch(_0x2fb37f){logger[_0xfd01('0x3b')]('[%s][voiceAgentReport][agentcalled]',_0x5a11ec[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x2fb37f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0xf')]=function(_0x40e856){try{if(this['isNotNull'](_0x40e856)){if(this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]]){logger[_0xfd01('0x36')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x40e856['uniqueid'],util[_0xfd01('0x29')](_0x40e856,{'showHidden':![],'depth':null}));for(var _0x376212 in this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]]){if(this[_0xfd01('0x9')][_0x40e856['uniqueid']][_0xfd01('0x3c')](_0x376212)){if(_0x40e856[_0xfd01('0x2a')]===_0x376212){logger['info'](_0xfd01('0x3d'),_0x40e856[_0xfd01('0x26')],_0x40e856[_0xfd01('0x27')],_0x40e856[_0xfd01('0x2a')]);this[_0xfd01('0x9')][_0x40e856['uniqueid']][_0x376212][_0xfd01('0x3e')]=moment()['format'](_0xfd01('0x2c'));this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x3f')]=_0x40e856[_0xfd01('0x3f')];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x40')]=_0x40e856[_0xfd01('0x40')];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212]['destchannelstate']=_0x40e856[_0xfd01('0x41')];this['channels'][_0x40e856[_0xfd01('0x26')]][_0x376212]['destchannelstatedesc']=_0x40e856[_0xfd01('0x42')];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x43')]=_0x40e856[_0xfd01('0x43')];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x44')]=_0xfd01('0x45');_[_0xfd01('0x32')](this[_0xfd01('0xb')][_0x40e856[_0xfd01('0x46')]],_[_0xfd01('0x47')](_0x40e856,[_0xfd01('0x2e'),_0xfd01('0x48')]));logger[_0xfd01('0x36')](_0xfd01('0x49'),_0x40e856['uniqueid'],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x40e856[_0xfd01('0x2a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentconnect',this['channels'][_0x40e856[_0xfd01('0x26')]][_0x40e856[_0xfd01('0x2a')]]);logger[_0xfd01('0x36')](_0xfd01('0x4a'),_0x40e856[_0xfd01('0x26')],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0x40e856['uniqueid']][_0x40e856[_0xfd01('0x2a')]],{'showHidden':![],'depth':null}));this[_0xfd01('0x21')](util['format'](_0xfd01('0x39'),_0x40e856[_0xfd01('0x27')]),_0xfd01('0x4b'),this[_0xfd01('0x9')][_0x40e856['uniqueid']][_0x40e856[_0xfd01('0x2a')]]);}else if(!this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212]['agentringnoanswer']&&!this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x14')]){logger[_0xfd01('0x24')](_0xfd01('0x4c'),_0x40e856[_0xfd01('0x26')],this['channels'][_0x40e856['uniqueid']][_0x376212][_0xfd01('0x27')],_0x376212);this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x11')]=!![];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x4d')]=moment()[_0xfd01('0x2b')](_0xfd01('0x2c'));this['channels'][_0x40e856['uniqueid']][_0x376212][_0xfd01('0x4e')]=_0x40e856[_0xfd01('0x2a')];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212]['answeredelsewheremembername']=_0x40e856['membername'];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x44')]=_0xfd01('0x4f');this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x50')]='answered_elsewhere';logger[_0xfd01('0x36')](_0xfd01('0x51'),_0x40e856[_0xfd01('0x26')],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212],{'showHidden':![],'depth':null}));ami[_0xfd01('0x21')]('custom:agentansweredelsewhere',this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212]);}}}}}}catch(_0x3aa6eb){logger[_0xfd01('0x3b')](_0xfd01('0x52'),_0x40e856[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x3aa6eb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x53')]=function(_0x1e98d7){try{if(this[_0xfd01('0x22')](_0x1e98d7)){logger[_0xfd01('0x36')](_0xfd01('0x54'),_0x1e98d7[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x1e98d7,{'showHidden':![],'depth':null}));if(this[_0xfd01('0x9')][_0x1e98d7[_0xfd01('0x26')]]&&this[_0xfd01('0x9')][_0x1e98d7[_0xfd01('0x26')]][_0x1e98d7['destuniqueid']]){logger[_0xfd01('0x24')](_0xfd01('0x55'),_0x1e98d7[_0xfd01('0x26')],_0x1e98d7[_0xfd01('0x27')],_0x1e98d7[_0xfd01('0x2a')]);this['channels'][_0x1e98d7[_0xfd01('0x26')]][_0x1e98d7[_0xfd01('0x2a')]][_0xfd01('0x11')]=!![];this['channels'][_0x1e98d7[_0xfd01('0x26')]][_0x1e98d7[_0xfd01('0x2a')]][_0xfd01('0x4d')]=moment()[_0xfd01('0x2b')](_0xfd01('0x2c'));this['channels'][_0x1e98d7[_0xfd01('0x26')]][_0x1e98d7['destuniqueid']]['lastevent']=_0xfd01('0x56');this[_0xfd01('0x9')][_0x1e98d7['uniqueid']][_0x1e98d7[_0xfd01('0x2a')]][_0xfd01('0x50')]=_0xfd01('0x56');logger[_0xfd01('0x36')](_0xfd01('0x57'),_0x1e98d7[_0xfd01('0x26')],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0x1e98d7[_0xfd01('0x26')]][_0x1e98d7['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xfd01('0x21')](_0xfd01('0x58'),this['channels'][_0x1e98d7[_0xfd01('0x26')]][_0x1e98d7[_0xfd01('0x2a')]]);}}}catch(_0xb35248){logger[_0xfd01('0x3b')](_0xfd01('0x59'),_0x1e98d7[_0xfd01('0x26')],util[_0xfd01('0x29')](_0xb35248,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x13')]=function(_0x1e1328){try{if(this[_0xfd01('0x22')](_0x1e1328)){logger[_0xfd01('0x36')](_0xfd01('0x5a'),_0x1e1328[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x1e1328,{'showHidden':![],'depth':null}));if(this['channels'][_0x1e1328[_0xfd01('0x26')]]){for(var _0x4286ad in this[_0xfd01('0x9')][_0x1e1328['uniqueid']]){if(this[_0xfd01('0x9')][_0x1e1328['uniqueid']][_0xfd01('0x3c')](_0x4286ad)&&!this[_0xfd01('0x9')][_0x1e1328[_0xfd01('0x26')]][_0x4286ad][_0xfd01('0x11')]&&!this[_0xfd01('0x9')][_0x1e1328[_0xfd01('0x26')]][_0x4286ad]['agentcomplete']){logger[_0xfd01('0x24')](_0xfd01('0x5b'),_0x1e1328[_0xfd01('0x26')],this[_0xfd01('0x9')][_0x1e1328[_0xfd01('0x26')]][_0x4286ad][_0xfd01('0x27')],_0x4286ad);this['channels'][_0x1e1328[_0xfd01('0x26')]][_0x4286ad][_0xfd01('0x11')]=!![];this[_0xfd01('0x9')][_0x1e1328[_0xfd01('0x26')]][_0x4286ad]['agentringnoanswerAt']=moment()[_0xfd01('0x2b')](_0xfd01('0x2c'));this[_0xfd01('0x9')][_0x1e1328[_0xfd01('0x26')]][_0x4286ad]['lastevent']=_0xfd01('0x5c');this['channels'][_0x1e1328[_0xfd01('0x26')]][_0x4286ad][_0xfd01('0x50')]=_0xfd01('0x5c');logger[_0xfd01('0x36')](_0xfd01('0x5d'),_0x1e1328['uniqueid'],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0x1e1328['uniqueid']][_0x4286ad],{'showHidden':![],'depth':null}));ami[_0xfd01('0x21')]('custom:agentqueuecallerabandon',this['channels'][_0x1e1328[_0xfd01('0x26')]][_0x4286ad]);}}}}}catch(_0x57cd1c){logger[_0xfd01('0x3b')](_0xfd01('0x5e'),_0x1e1328[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x57cd1c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x15')]=function(_0xc1f6e0){try{if(this['isNotNull'](_0xc1f6e0)){logger[_0xfd01('0x36')](_0xfd01('0x5f'),_0xc1f6e0[_0xfd01('0x26')],util[_0xfd01('0x29')](_0xc1f6e0,{'showHidden':![],'depth':null}));if(this['channels'][_0xc1f6e0[_0xfd01('0x26')]]){for(var _0x1a6755 in this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]]){if(this['channels'][_0xc1f6e0[_0xfd01('0x26')]][_0xfd01('0x3c')](_0x1a6755)){if(this['channels'][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755][_0xfd01('0x3e')]&&!this['channels'][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755]['agentcomplete']){logger[_0xfd01('0x24')](_0xfd01('0x60'),_0xc1f6e0[_0xfd01('0x26')],this['channels'][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755][_0xfd01('0x27')],_0x1a6755);this['channels'][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755][_0xfd01('0x14')]=!![];this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755][_0xfd01('0x61')]=moment()[_0xfd01('0x2b')](_0xfd01('0x2c'));this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755][_0xfd01('0x44')]=_0xfd01('0x62');this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755]['reason']=_0xc1f6e0[_0xfd01('0x50')]==_0xfd01('0x63')?'agent':_0xc1f6e0[_0xfd01('0x50')];this['channels'][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755]['talktime']=_0xc1f6e0[_0xfd01('0x64')];if(this[_0xfd01('0xa')][_0xc1f6e0[_0xfd01('0x2e')]]&&this['voiceQueues'][_0xc1f6e0['queue']][_0xfd01('0x65')]){this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755][_0xfd01('0x66')]=this[_0xfd01('0xa')][_0xc1f6e0[_0xfd01('0x2e')]][_0xfd01('0x67')];this[_0xfd01('0x9')][_0xc1f6e0['uniqueid']][_0x1a6755][_0xfd01('0x68')]=!![];}this['agents'][_0xc1f6e0['interface']]=_[_0xfd01('0x33')](this[_0xfd01('0xb')][_0xc1f6e0['interface']],[_0xfd01('0x2e'),_0xfd01('0x48')]);logger['debug'](_0xfd01('0x69'),_0xc1f6e0[_0xfd01('0x26')],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0xc1f6e0['uniqueid']][_0x1a6755],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755]);logger[_0xfd01('0x36')](_0xfd01('0x6a'),_0xc1f6e0['uniqueid'],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755],{'showHidden':![],'depth':null}));this[_0xfd01('0x21')](util['format'](_0xfd01('0x39'),_0xc1f6e0[_0xfd01('0x27')]),_0xfd01('0x6b'),this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755]);}}}}}}catch(_0x1b21fb){logger[_0xfd01('0x3b')](_0xfd01('0x6c'),_0xc1f6e0[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x1b21fb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x62d054){try{if(this[_0xfd01('0x22')](_0x62d054)){logger['debug'](_0xfd01('0x6d'),_0x62d054[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x62d054,{'showHidden':![],'depth':null}));this[_0xfd01('0x6e')](_0x62d054[_0xfd01('0x26')],_[_0xfd01('0x6f')](_0x62d054[_0xfd01('0x70')])[0x0],_0x62d054[_0xfd01('0x71')]);if(this['channels'][_0x62d054[_0xfd01('0x26')]]){for(var _0x21214d in this[_0xfd01('0x9')][_0x62d054['uniqueid']]){if(this['channels'][_0x62d054[_0xfd01('0x26')]][_0xfd01('0x3c')](_0x21214d)){logger['info'](_0xfd01('0x72'),_0x62d054['uniqueid'],_0x21214d,_[_0xfd01('0x6f')](_0x62d054['variable'])[0x0],_0x62d054[_0xfd01('0x71')]);if(_['isUndefined'](this[_0xfd01('0x9')][_0x62d054[_0xfd01('0x26')]][_0x21214d]['variables'])){this['channels'][_0x62d054[_0xfd01('0x26')]][_0x21214d]['variables']={};}this[_0xfd01('0x9')][_0x62d054[_0xfd01('0x26')]][_0x21214d][_0xfd01('0xc')]=this[_0xfd01('0xc')][_0x62d054[_0xfd01('0x26')]];}}}}}catch(_0xab6eaa){logger[_0xfd01('0x3b')]('[%s][voiceAgentReport][varset]',_0x62d054[_0xfd01('0x26')],util[_0xfd01('0x29')](_0xab6eaa,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x6e')]=function(_0x2fae98,_0x1e5db4,_0x29cdb5){var _0x30cc0e=[_0xfd01('0x73'),'rtpaudioqosbridged','rtpaudioqosjitter',_0xfd01('0x74'),_0xfd01('0x75'),'rtpaudioqoslossbridged',_0xfd01('0x76'),_0xfd01('0x77'),_0xfd01('0x78'),_0xfd01('0x79'),'bridgepeer','bridgepvtcallid',_0xfd01('0x7a'),_0xfd01('0x7b'),_0xfd01('0x7c'),_0xfd01('0x7d'),_0xfd01('0x27'),_0xfd01('0x7e'),'memberrealtime'];if(!_['isNil'](_0x1e5db4)&&!_[_0xfd01('0x7f')](_0x30cc0e,_0x1e5db4)){if(_['isUndefined'](this[_0xfd01('0xc')][_0x2fae98])){this['variables'][_0x2fae98]={};}this[_0xfd01('0xc')][_0x2fae98][_0x1e5db4]=_0x29cdb5;}};VoiceAgentReport['prototype'][_0xfd01('0x18')]=function(_0x56f3bf){try{if(this[_0xfd01('0x22')](_0x56f3bf)){logger['debug'](_0xfd01('0x80'),_0x56f3bf['uniqueid'],util[_0xfd01('0x29')](_0x56f3bf,{'showHidden':![],'depth':null}));if(this[_0xfd01('0x9')][_0x56f3bf['uniqueid']]){for(var _0x1740ff in this[_0xfd01('0x9')][_0x56f3bf[_0xfd01('0x26')]]){if(this[_0xfd01('0x9')][_0x56f3bf[_0xfd01('0x26')]][_0xfd01('0x3c')](_0x1740ff)){if(this[_0xfd01('0x9')][_0x56f3bf[_0xfd01('0x26')]][_0x1740ff][_0xfd01('0x50')]=='transfer'&&this[_0xfd01('0x9')][_0x56f3bf['uniqueid']][_0x1740ff]['agentcomplete']){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x56f3bf[_0xfd01('0x26')],_0x1740ff);this[_0xfd01('0x9')][_0x56f3bf[_0xfd01('0x26')]][_0x1740ff][_0xfd01('0x61')]=moment()['format'](_0xfd01('0x2c'));}}}logger[_0xfd01('0x36')](_0xfd01('0x81'),_0x56f3bf['uniqueid'],util[_0xfd01('0x29')](_[_0xfd01('0x82')](this[_0xfd01('0x9')][_0x56f3bf['uniqueid']]),{'showHidden':![],'depth':null}));ami['emit'](_0xfd01('0x83'),_[_0xfd01('0x82')](this['channels'][_0x56f3bf[_0xfd01('0x26')]]));delete this[_0xfd01('0x9')][_0x56f3bf[_0xfd01('0x26')]];}if(this[_0xfd01('0xc')][_0x56f3bf[_0xfd01('0x26')]]){delete this[_0xfd01('0xc')][_0x56f3bf['uniqueid']];}}}catch(_0x1c3bc3){logger[_0xfd01('0x3b')](_0xfd01('0x84'),_0x56f3bf[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x1c3bc3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x85')]=function(_0x1facce){try{if(this[_0xfd01('0x22')](_0x1facce)){logger[_0xfd01('0x36')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x1facce[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x1facce,{'showHidden':![],'depth':null}));if(this[_0xfd01('0x9')][_0x1facce['transfereeuniqueid']]){for(var _0x14d07c in this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]]){if(this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]][_0xfd01('0x3c')](_0x14d07c)){if(_0x1facce[_0xfd01('0x87')]===_0x14d07c){logger[_0xfd01('0x24')](_0xfd01('0x88'),_0x1facce[_0xfd01('0x26')],this[_0xfd01('0x9')][_0x1facce['transfereeuniqueid']][_0x14d07c][_0xfd01('0x27')],_0x14d07c);var _0x24ed82=moment();this['channels'][_0x1facce[_0xfd01('0x86')]][_0x14d07c][_0xfd01('0x14')]=!![];this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]][_0x14d07c][_0xfd01('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1facce[_0xfd01('0x86')]][_0x14d07c]['lastevent']=_0xfd01('0x62');this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]][_0x14d07c][_0xfd01('0x50')]='transfer';this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]][_0x14d07c][_0xfd01('0x64')]=_0x24ed82[_0xfd01('0x89')](this['channels'][_0x1facce[_0xfd01('0x86')]][_0x14d07c][_0xfd01('0x3e')],_0xfd01('0x8a'));}}}}if(this[_0xfd01('0x9')][_0x1facce['secondtransfereruniqueid']]){var _0x8ea67a=this['channels'][_0x1facce[_0xfd01('0x8b')]];this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x8b')]]=this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]];this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]]=_0x8ea67a;}}}catch(_0x37abcf){logger[_0xfd01('0x3b')]('[%s][voiceAgentReport][attendedtransfer]',_0x1facce[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x37abcf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')]['syncBlindTransfer']=function(_0x2b3323){try{if(this[_0xfd01('0x22')](_0x2b3323)){logger[_0xfd01('0x36')](_0xfd01('0x8c'),_0x2b3323[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x2b3323,{'showHidden':![],'depth':null}));if(this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]]){for(var _0x55871f in this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]]){if(this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0xfd01('0x3c')](_0x55871f)){if(_0x2b3323[_0xfd01('0x8d')]===_0x55871f){logger[_0xfd01('0x24')](_0xfd01('0x8e'),_0x2b3323[_0xfd01('0x26')],this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0x55871f]['membername'],_0x55871f);var _0x40c828=moment();this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0x55871f][_0xfd01('0x14')]=!![];this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0x55871f][_0xfd01('0x61')]=_0x40c828;this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0x55871f][_0xfd01('0x44')]=_0xfd01('0x62');this[_0xfd01('0x9')][_0x2b3323['transfereeuniqueid']][_0x55871f][_0xfd01('0x50')]='transfer';this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0x55871f][_0xfd01('0x64')]=_0x40c828[_0xfd01('0x89')](this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0x55871f][_0xfd01('0x3e')],_0xfd01('0x8a'));}}}}}}catch(_0x3b9233){logger[_0xfd01('0x3b')]('[%s][voiceAgentReport][blindtransfer]',_0x2b3323[_0xfd01('0x26')],util['inspect'](_0x3b9233,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x1a')]=function(_0x535e39){var _0x5c3cbd='';try{if(this['isNotNull'](_0x535e39)){logger['debug'](_0xfd01('0x8f'),_0x535e39['uniqueid'],util['inspect'](_0x535e39,{'showHidden':![],'depth':null}));if(_0x535e39[_0xfd01('0x90')]){_0x5c3cbd=_0x535e39[_0xfd01('0x90')][_0xfd01('0x91')](0x0,_0x535e39[_0xfd01('0x90')][_0xfd01('0x92')]('-'));if(this[_0xfd01('0xb')][_0x5c3cbd]){logger[_0xfd01('0x24')](_0xfd01('0x93'),_0x535e39[_0xfd01('0x26')],_0x5c3cbd);this[_0xfd01('0xb')][_0x5c3cbd][_0xfd01('0x94')]=!![];}}}}catch(_0x5c87d4){logger[_0xfd01('0x3b')](_0xfd01('0x95'),_0x535e39['uniqueid'],util[_0xfd01('0x29')](_0x5c87d4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfd01('0x1c')]=function(_0x2ae576){var _0x5a458d='';try{if(this[_0xfd01('0x22')](_0x2ae576)){logger[_0xfd01('0x36')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x2ae576[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x2ae576,{'showHidden':![],'depth':null}));if(_0x2ae576['channel']){_0x5a458d=_0x2ae576['channel']['substring'](0x0,_0x2ae576[_0xfd01('0x90')][_0xfd01('0x92')]('-'));if(this['agents'][_0x5a458d]){logger[_0xfd01('0x24')](_0xfd01('0x96'),_0x2ae576[_0xfd01('0x26')],_0x5a458d);this[_0xfd01('0xb')][_0x5a458d][_0xfd01('0x94')]=![];}}}}catch(_0x28eb0b){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x2ae576['uniqueid'],util[_0xfd01('0x29')](_0x28eb0b,{'showHidden':![],'depth':null}));}};module[_0xfd01('0x97')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index e3dc87a..b849a23 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 _0x6292=['BLIND','transfererchannel','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','mohtime','[%s][voiceCallReport][musiconholdstop]','bluebird','lodash','moment','util','path','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','settings','blindTransfers','coreshowchannel','syncNewExten','newexten','bind','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','inspect','isUndefined','prototype','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridnum','debug','uniqueid','linkedid','merge','pick','keys','error','[%s][voiceCallReport][newcallerid]','syncNewChannel','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','split','accountcode','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','subtract','duration','seconds','includes','lastdata','startsWith','cdr(','match','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','from-sip','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','stopRecordingOnTransfer','transferType','isEmpty','StopMixMonitor','catch','webbar:stopmonitors','event','type','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transferconnectedlinenum'];(function(_0x5f2ad4,_0x5799a4){var _0xe8edc3=function(_0x2246bc){while(--_0x2246bc){_0x5f2ad4['push'](_0x5f2ad4['shift']());}};_0xe8edc3(++_0x5799a4);}(_0x6292,0x19d));var _0x2629=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x6292[_0x2f2360];return _0x1cc8d3;};'use strict';var BPromise=require(_0x2629('0x0'));var _=require(_0x2629('0x1'));var moment=require(_0x2629('0x2'));var util=require(_0x2629('0x3'));var path=require(_0x2629('0x4'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x2629('0x5'))(_0x2629('0x6'));var ami=require(_0x2629('0x7'));var Channel=require(_0x2629('0x8'));var statusDesc=[_0x2629('0x9'),_0x2629('0xa'),_0x2629('0xb'),_0x2629('0xc'),'invalid','unavailable','ringing',_0x2629('0xd'),_0x2629('0xe')];var applications=[_0x2629('0xf'),_0x2629('0x10'),_0x2629('0x11'),_0x2629('0x12'),_0x2629('0x13'),_0x2629('0x14')];var dispositions=[_0x2629('0x15'),_0x2629('0x16'),_0x2629('0x16'),_0x2629('0x15'),_0x2629('0x15'),_0x2629('0x15'),_0x2629('0x17'),_0x2629('0x18'),'FAILED',_0x2629('0x16'),_0x2629('0x16')];var actions={};config['redis']=_['defaults'](config[_0x2629('0x19')],{'host':_0x2629('0x1a'),'port':0x18eb});var io=require(_0x2629('0x1b'))(new Redis(config[_0x2629('0x19')]));function VoiceCallReport(_0x4f273a){this[_0x2629('0x1c')]=_0x4f273a[_0x2629('0x1c')];this[_0x2629('0x1d')]=_0x4f273a[_0x2629('0x1d')];this['settings']=_0x4f273a[_0x2629('0x1e')];this[_0x2629('0x1f')]={};ami['on'](_0x2629('0x20'),this[_0x2629('0x21')]['bind'](this));ami['on'](_0x2629('0x22'),this[_0x2629('0x21')]['bind'](this));ami['on']('newchannel',this['syncNewChannel'][_0x2629('0x23')](this));ami['on'](_0x2629('0x24'),this['syncNewState'][_0x2629('0x23')](this));ami['on'](_0x2629('0x25'),this[_0x2629('0x26')][_0x2629('0x23')](this));ami['on'](_0x2629('0x27'),this[_0x2629('0x28')][_0x2629('0x23')](this));ami['on'](_0x2629('0x29'),this[_0x2629('0x2a')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x2629('0x2b'),this[_0x2629('0x2c')]['bind'](this));ami['on'](_0x2629('0x2d'),this[_0x2629('0x2e')][_0x2629('0x23')](this));ami['on'](_0x2629('0x2f'),this['syncMusicOnHoldStop'][_0x2629('0x23')](this));try{logger[_0x2629('0x30')](_0x2629('0x31'));ami[_0x2629('0x32')]();}catch(_0x41c6d5){logger['error']('[voiceCallReport][coreshowchannels]',util[_0x2629('0x33')](_0x41c6d5,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x316b25){return _0x316b25!==null&&!_[_0x2629('0x34')](_0x316b25);};VoiceCallReport[_0x2629('0x35')][_0x2629('0x36')]=function(_0x34c753,_0x43db6b,_0x42565f){io['to'](_0x34c753)['emit'](_0x43db6b,_0x42565f);};VoiceCallReport[_0x2629('0x35')][_0x2629('0x2a')]=function(_0x14b04b){try{if(this[_0x2629('0x37')](_0x14b04b)){logger[_0x2629('0x30')](_0x2629('0x38'),_0x14b04b['uniqueid'],_0x14b04b['calleridname'],_0x14b04b[_0x2629('0x39')]);logger[_0x2629('0x3a')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x14b04b[_0x2629('0x3b')],util[_0x2629('0x33')](_0x14b04b,{'showHidden':![],'depth':null}));if(_0x14b04b[_0x2629('0x3b')]===_0x14b04b[_0x2629('0x3c')]){if(!_[_0x2629('0x34')](this[_0x2629('0x1c')][_0x14b04b[_0x2629('0x3b')]])){_[_0x2629('0x3d')](this[_0x2629('0x1c')][_0x14b04b[_0x2629('0x3b')]],_[_0x2629('0x3e')](_0x14b04b,_[_0x2629('0x3f')](this[_0x2629('0x1c')][_0x14b04b['uniqueid']])));}}}}catch(_0x2f6ecb){logger[_0x2629('0x40')](_0x2629('0x41'),_0x14b04b[_0x2629('0x3b')],util[_0x2629('0x33')](_0x2f6ecb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2629('0x35')][_0x2629('0x42')]=function(_0x3f29c4){try{if(this[_0x2629('0x37')](_0x3f29c4)){logger[_0x2629('0x3a')]('[%s][voiceCallReport][newchannel]\x20event:',_0x3f29c4['uniqueid'],util[_0x2629('0x33')](_0x3f29c4,{'showHidden':![],'depth':null}));if(_0x3f29c4[_0x2629('0x3b')]===_0x3f29c4[_0x2629('0x3c')]&&_0x3f29c4[_0x2629('0x43')]!=_0x2629('0x44')){if(_[_0x2629('0x34')](this[_0x2629('0x1c')][_0x3f29c4[_0x2629('0x3b')]])){logger['info'](_0x2629('0x45'),_0x3f29c4['uniqueid'],_0x3f29c4[_0x2629('0x46')],_0x3f29c4[_0x2629('0x47')]);this[_0x2629('0x1c')][_0x3f29c4['uniqueid']]=new Channel();this[_0x2629('0x1c')][_0x3f29c4[_0x2629('0x3b')]][_0x2629('0x48')]=moment()['format'](_0x2629('0x49'));this[_0x2629('0x1c')][_0x3f29c4['uniqueid']][_0x2629('0x4a')]=dispositions[_[_0x2629('0x4b')](_0x3f29c4[_0x2629('0x4c')])];_[_0x2629('0x3d')](this['channels'][_0x3f29c4[_0x2629('0x3b')]],_[_0x2629('0x3e')](_0x3f29c4,_[_0x2629('0x3f')](this['channels'][_0x3f29c4[_0x2629('0x3b')]])));if(_0x3f29c4[_0x2629('0x46')]==='from-sip'){if(this[_0x2629('0x1d')][_0x3f29c4[_0x2629('0x43')][_0x2629('0x4d')]('-')[0x0]]){this[_0x2629('0x1d')][_0x3f29c4['channel'][_0x2629('0x4d')]('-')[0x0]]['destconnectedlinenum']=_0x3f29c4['exten'];logger[_0x2629('0x3a')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x3f29c4[_0x2629('0x3b')],util[_0x2629('0x33')]({'destaccountcode':this[_0x2629('0x1d')][_0x3f29c4[_0x2629('0x43')]['split']('-')[0x0]][_0x2629('0x4e')],'destconnectedlinenum':_0x3f29c4[_0x2629('0x47')]},{'showHidden':![],'depth':null}));this[_0x2629('0x36')](util[_0x2629('0x4f')](_0x2629('0x50'),this[_0x2629('0x1d')][_0x3f29c4[_0x2629('0x43')][_0x2629('0x4d')]('-')[0x0]][_0x2629('0x51')]),_0x2629('0x52'),{'destaccountcode':this['agents'][_0x3f29c4['channel'][_0x2629('0x4d')]('-')[0x0]][_0x2629('0x4e')],'destconnectedlinenum':_0x3f29c4[_0x2629('0x47')]});}}}}}}catch(_0x2ac169){logger[_0x2629('0x40')](_0x2629('0x53'),_0x3f29c4[_0x2629('0x3b')],util[_0x2629('0x33')](_0x2ac169,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2629('0x21')]=function(_0x28eeeb){try{if(this[_0x2629('0x37')](_0x28eeeb)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x28eeeb[_0x2629('0x3b')],util[_0x2629('0x33')](_0x28eeeb,{'showHidden':![],'depth':null}));if(_0x28eeeb[_0x2629('0x3b')]===_0x28eeeb[_0x2629('0x3c')]&&_0x28eeeb['exten']!='h'&&_0x28eeeb[_0x2629('0x43')]!=_0x2629('0x44')){_0x28eeeb[_0x2629('0x54')]=_0x28eeeb[_0x2629('0x54')][_0x2629('0x55')]();_0x28eeeb[_0x2629('0x56')]=(_0x28eeeb[_0x2629('0x57')]||_0x28eeeb[_0x2629('0x56')])[_0x2629('0x55')]();logger[_0x2629('0x30')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x28eeeb['uniqueid'],_0x28eeeb[_0x2629('0x54')],_0x28eeeb[_0x2629('0x56')]);if(_['isUndefined'](this[_0x2629('0x1c')][_0x28eeeb['uniqueid']])){this['channels'][_0x28eeeb[_0x2629('0x3b')]]=new Channel();this[_0x2629('0x1c')][_0x28eeeb[_0x2629('0x3b')]][_0x2629('0x48')]=_0x28eeeb['duration']?moment()[_0x2629('0x58')](moment[_0x2629('0x59')](_0x28eeeb[_0x2629('0x59')])['seconds'](),_0x2629('0x5a'))[_0x2629('0x4f')](_0x2629('0x49')):moment()['format'](_0x2629('0x49'));this[_0x2629('0x1c')][_0x28eeeb['uniqueid']][_0x2629('0x4a')]=_0x2629('0x15');}_[_0x2629('0x3d')](this['channels'][_0x28eeeb[_0x2629('0x3b')]],_[_0x2629('0x3e')](_0x28eeeb,_[_0x2629('0x3f')](this[_0x2629('0x1c')][_0x28eeeb[_0x2629('0x3b')]])));if(_[_0x2629('0x5b')](applications,_0x28eeeb[_0x2629('0x54')])){this[_0x2629('0x1c')][_0x28eeeb[_0x2629('0x3b')]]['lastapplication']=_0x28eeeb[_0x2629('0x54')];this[_0x2629('0x1c')][_0x28eeeb[_0x2629('0x3b')]][_0x2629('0x5c')]=_0x28eeeb[_0x2629('0x56')];if(_0x28eeeb[_0x2629('0x54')]==='set'&&_[_0x2629('0x5d')](_0x28eeeb[_0x2629('0x56')],_0x2629('0x5e'))){var _0x3d7f0c=_0x28eeeb['applicationdata'][_0x2629('0x4d')]('=');var _0x5056d4=_0x3d7f0c[0x0][_0x2629('0x5f')](/cdr\((.*)\)/);if(_0x5056d4){this[_0x2629('0x1c')][_0x28eeeb[_0x2629('0x3b')]][_0x5056d4[0x1]]=_0x3d7f0c[0x1];}}else if(_0x28eeeb[_0x2629('0x54')]===_0x2629('0x10')){this['channels'][_0x28eeeb[_0x2629('0x3b')]]['queue']=_0x28eeeb[_0x2629('0x56')][_0x2629('0x4d')](',')[0x0];}}}}}catch(_0xd2633){logger[_0x2629('0x40')]('[%s][voiceCallReport][newexten]',_0x28eeeb[_0x2629('0x3b')],util['inspect'](_0xd2633,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2629('0x60')]=function(_0x102357){try{if(this[_0x2629('0x37')](_0x102357)){logger[_0x2629('0x30')](_0x2629('0x61'),_0x102357['uniqueid'],_0x102357['linkedid'],_0x102357[_0x2629('0x62')],_0x102357[_0x2629('0x39')]);logger[_0x2629('0x3a')]('[%s][voiceCallReport][newstate]\x20event:',_0x102357['uniqueid'],util[_0x2629('0x33')](_0x102357,{'showHidden':![],'depth':null}));if(_0x102357[_0x2629('0x3b')]!==_0x102357[_0x2629('0x3c')]){if(this[_0x2629('0x1c')][_0x102357[_0x2629('0x3c')]]){if(_0x102357[_0x2629('0x4c')]==='6'){if(!this[_0x2629('0x1c')][_0x102357[_0x2629('0x3c')]][_0x2629('0x63')]){var _0x51ee17=moment();this[_0x2629('0x1c')][_0x102357[_0x2629('0x3c')]][_0x2629('0x63')]=!![];this['channels'][_0x102357[_0x2629('0x3c')]][_0x2629('0x64')]=_0x51ee17['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x2629('0x1c')][_0x102357[_0x2629('0x3c')]]['starttime']){this[_0x2629('0x1c')][_0x102357[_0x2629('0x3c')]][_0x2629('0x65')]=_0x51ee17[_0x2629('0x66')](this['channels'][_0x102357[_0x2629('0x3c')]][_0x2629('0x48')],_0x2629('0x5a'));}}this[_0x2629('0x1c')][_0x102357[_0x2629('0x3c')]]['linkedid']=_0x102357[_0x2629('0x3b')];if(_0x102357[_0x2629('0x39')]!==_0x2629('0x67')){this['channels'][_0x102357[_0x2629('0x3c')]][_0x2629('0x68')]=_0x102357[_0x2629('0x39')];}this[_0x2629('0x1c')][_0x102357[_0x2629('0x3c')]]['connectedlinename']=_0x102357[_0x2629('0x62')];this[_0x2629('0x1c')][_0x102357[_0x2629('0x3c')]][_0x2629('0x69')]=_0x102357[_0x2629('0x43')];this[_0x2629('0x1c')][_0x102357[_0x2629('0x3c')]][_0x2629('0x4a')]=dispositions[_[_0x2629('0x4b')](_0x102357['channelstate'])];if(this[_0x2629('0x1d')][_0x102357['channel'][_0x2629('0x4d')]('-')[0x0]]){this[_0x2629('0x1c')][_0x102357[_0x2629('0x3c')]][_0x2629('0x6a')]=this[_0x2629('0x1d')][_0x102357[_0x2629('0x43')][_0x2629('0x4d')]('-')[0x0]]['id'];this[_0x2629('0x1c')][_0x102357[_0x2629('0x3c')]]['membername']=this[_0x2629('0x1d')][_0x102357[_0x2629('0x43')][_0x2629('0x4d')]('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x102357[_0x2629('0x3b')]]){if(_0x102357['channelstate']==='6'){if(this['agents'][_0x102357[_0x2629('0x43')][_0x2629('0x4d')]('-')[0x0]]){this[_0x2629('0x1c')][_0x102357[_0x2629('0x3b')]][_0x2629('0x6a')]=this[_0x2629('0x1d')][_0x102357[_0x2629('0x43')][_0x2629('0x4d')]('-')[0x0]]['id'];this[_0x2629('0x1c')][_0x102357['uniqueid']][_0x2629('0x6b')]=this[_0x2629('0x1d')][_0x102357[_0x2629('0x43')]['split']('-')[0x0]][_0x2629('0x51')];}}}}}}catch(_0x57efac){logger[_0x2629('0x40')](_0x2629('0x6c'),_0x102357[_0x2629('0x3b')],util[_0x2629('0x33')](_0x57efac,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2629('0x6d')]=function(_0x5d32da,_0x369eb3){try{if(this['channels'][_0x5d32da]){logger[_0x2629('0x30')](_0x2629('0x6e'),_0x5d32da,_0x369eb3);this['channels'][_0x5d32da][_0x2629('0x6f')]=!![];if(_[_0x2629('0x70')](_0x369eb3,_0x2629('0x71'))){_0x369eb3=_0x369eb3[_0x2629('0x72')](_0x2629('0x71'),_0x2629('0x73'));}this[_0x2629('0x1c')][_0x5d32da][_0x2629('0x74')]=_0x369eb3;var _0xf728c3=_[_0x2629('0x75')](this[_0x2629('0x1c')][_0x5d32da][_0x2629('0x76')],{'filename':_0x369eb3});if(_[_0x2629('0x77')](_0xf728c3)){this[_0x2629('0x1c')][_0x5d32da]['monitors'][_0x2629('0x78')]({'filename':_0x369eb3,'createdAt':moment()['format'](_0x2629('0x49')),'mixmonitorid':'','status':_0x2629('0x79')});}}}catch(_0x240623){logger[_0x2629('0x40')](_0x2629('0x7a'),_0x5d32da,util['inspect'](_0x240623,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2629('0x26')]=function(_0x3c2da7){try{if(this[_0x2629('0x37')](_0x3c2da7)){logger[_0x2629('0x3a')](_0x2629('0x7b'),_0x3c2da7[_0x2629('0x3b')],util[_0x2629('0x33')](_0x3c2da7,{'showHidden':![],'depth':null}));if(this[_0x2629('0x1c')][_0x3c2da7['uniqueid']]&&_0x3c2da7['channel']!=_0x2629('0x44')){if(this['isNotNull'](_0x3c2da7[_0x2629('0x7c')])){if(this[_0x2629('0x37')](_0x3c2da7['variable'][_0x2629('0x7d')])){logger[_0x2629('0x30')](_0x2629('0x7e'),_0x3c2da7[_0x2629('0x3b')],_0x3c2da7[_0x2629('0x7f')]);this[_0x2629('0x6d')](_0x3c2da7['uniqueid'],_0x3c2da7['value']);}else if(this[_0x2629('0x37')](_0x3c2da7[_0x2629('0x7c')]['xmd-phone'])){logger[_0x2629('0x30')](_0x2629('0x80'),_0x3c2da7[_0x2629('0x3b')],_0x3c2da7[_0x2629('0x7f')]);this[_0x2629('0x1c')][_0x3c2da7['uniqueid']][_0x2629('0x39')]=_0x3c2da7[_0x2629('0x7f')];}else if(this[_0x2629('0x37')](_0x3c2da7['variable'][_0x2629('0x81')])){logger[_0x2629('0x30')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x3c2da7[_0x2629('0x3b')],_0x3c2da7[_0x2629('0x7f')]);this[_0x2629('0x1c')][_0x3c2da7[_0x2629('0x3b')]][_0x2629('0x82')]=_0x3c2da7[_0x2629('0x7f')];}else if(this[_0x2629('0x37')](_0x3c2da7[_0x2629('0x7c')][_0x2629('0x83')])){logger[_0x2629('0x30')](_0x2629('0x84'),_0x3c2da7[_0x2629('0x3b')],_0x3c2da7[_0x2629('0x7f')]);this[_0x2629('0x1c')][_0x3c2da7[_0x2629('0x3b')]]['type']=_0x3c2da7[_0x2629('0x7f')];}else if(this['isNotNull'](_0x3c2da7['variable'][_0x2629('0x85')])){logger[_0x2629('0x30')](_0x2629('0x86'),_0x3c2da7['uniqueid'],_0x3c2da7[_0x2629('0x7f')][_0x2629('0x4d')](',')[0x0]);this[_0x2629('0x1c')][_0x3c2da7[_0x2629('0x3b')]][_0x2629('0x10')]=_0x3c2da7[_0x2629('0x7f')]['split'](',')[0x0];}else if(this[_0x2629('0x37')](_0x3c2da7[_0x2629('0x7c')][_0x2629('0x87')])){logger['info'](_0x2629('0x88'),_0x3c2da7['uniqueid'],_0x3c2da7[_0x2629('0x7f')]);this[_0x2629('0x1c')][_0x3c2da7[_0x2629('0x3b')]][_0x2629('0x89')]=_0x3c2da7[_0x2629('0x7f')];}else if(this[_0x2629('0x37')](_0x3c2da7[_0x2629('0x7c')]['xmd-destination'])){logger[_0x2629('0x30')](_0x2629('0x8a'),_0x3c2da7[_0x2629('0x3b')],_0x3c2da7[_0x2629('0x7f')]);this[_0x2629('0x1c')][_0x3c2da7[_0x2629('0x3b')]][_0x2629('0x8b')]=_0x3c2da7[_0x2629('0x7f')];}else if(this[_0x2629('0x37')](_0x3c2da7[_0x2629('0x7c')][_0x2629('0x8c')])){logger[_0x2629('0x30')](_0x2629('0x8d'),_0x3c2da7[_0x2629('0x3b')],_0x3c2da7['value']);this[_0x2629('0x1c')][_0x3c2da7[_0x2629('0x3b')]][_0x2629('0x8e')]=_0x3c2da7[_0x2629('0x7f')];}else if(this[_0x2629('0x37')](_0x3c2da7[_0x2629('0x7c')]['xmcs-queue'])){logger[_0x2629('0x30')](_0x2629('0x8f'),_0x3c2da7[_0x2629('0x3b')],_0x3c2da7[_0x2629('0x7f')]);this[_0x2629('0x1c')][_0x3c2da7[_0x2629('0x3b')]]['queue']=_0x3c2da7[_0x2629('0x7f')];}else if(this[_0x2629('0x37')](_0x3c2da7[_0x2629('0x7c')][_0x2629('0x90')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x3c2da7[_0x2629('0x3b')],_0x3c2da7[_0x2629('0x7f')]);this[_0x2629('0x1c')][_0x3c2da7[_0x2629('0x3b')]][_0x2629('0x91')]=_0x3c2da7[_0x2629('0x7f')];}}}else if(this[_0x2629('0x37')](_0x3c2da7['variable']['mixmonitor_filename'])){if(_0x3c2da7[_0x2629('0x7f')]){var _0x5b8e2d=path[_0x2629('0x92')](_0x3c2da7[_0x2629('0x7f')])[_0x2629('0x51')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5b8e2d,_0x3c2da7[_0x2629('0x7f')]);this['syncMixMonitorFilename'](_0x5b8e2d,_0x3c2da7[_0x2629('0x7f')]);}}else if(this['channels'][_0x3c2da7['linkedid']]){if(this[_0x2629('0x37')](_0x3c2da7[_0x2629('0x7c')])){if(this[_0x2629('0x37')](_0x3c2da7[_0x2629('0x7c')][_0x2629('0x90')])){logger['info'](_0x2629('0x93'),_0x3c2da7['linkedid'],_0x3c2da7[_0x2629('0x7f')]);this['channels'][_0x3c2da7['linkedid']][_0x2629('0x94')]=_0x3c2da7[_0x2629('0x7f')];}}}}}catch(_0x159f91){logger['error'](_0x2629('0x95'),_0x3c2da7['uniqueid'],util[_0x2629('0x33')](_0x159f91,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2629('0x35')][_0x2629('0x28')]=function(_0x1043ab){try{if(this[_0x2629('0x37')](_0x1043ab)){logger[_0x2629('0x3a')]('[%s][voiceCallReport][hangup]\x20event:',_0x1043ab['uniqueid'],util['inspect'](_0x1043ab,{'showHidden':![],'depth':null}));if(this[_0x2629('0x1c')][_0x1043ab['uniqueid']]){logger[_0x2629('0x30')](_0x2629('0x96'),_0x1043ab[_0x2629('0x3b')],_0x1043ab[_0x2629('0x97')]);var _0x14d174=moment();this['channels'][_0x1043ab['uniqueid']][_0x2629('0x98')]=_0x14d174[_0x2629('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2629('0x1c')][_0x1043ab[_0x2629('0x3b')]][_0x2629('0x59')]=_0x14d174[_0x2629('0x66')](this[_0x2629('0x1c')][_0x1043ab[_0x2629('0x3b')]][_0x2629('0x48')],_0x2629('0x5a'));if(this[_0x2629('0x1c')][_0x1043ab['uniqueid']][_0x2629('0x63')]){this[_0x2629('0x1c')][_0x1043ab['uniqueid']][_0x2629('0x99')]=_0x14d174[_0x2629('0x66')](this[_0x2629('0x1c')][_0x1043ab[_0x2629('0x3b')]]['answertime'],_0x2629('0x5a'));this['channels'][_0x1043ab[_0x2629('0x3b')]][_0x2629('0x65')]=this['channels'][_0x1043ab[_0x2629('0x3b')]][_0x2629('0x59')]-this[_0x2629('0x1c')][_0x1043ab[_0x2629('0x3b')]][_0x2629('0x99')];}if(_0x1043ab[_0x2629('0x46')]===_0x2629('0x9a')){if(this[_0x2629('0x1d')][_0x1043ab[_0x2629('0x43')][_0x2629('0x4d')]('-')[0x0]]){this[_0x2629('0x1d')][_0x1043ab['channel']['split']('-')[0x0]]=_['omit'](this[_0x2629('0x1d')][_0x1043ab[_0x2629('0x43')]['split']('-')[0x0]],[_0x2629('0x9b')]);logger[_0x2629('0x3a')](_0x2629('0x9c'),_0x1043ab[_0x2629('0x3b')],util['inspect']({'destaccountcode':this['agents'][_0x1043ab[_0x2629('0x43')][_0x2629('0x4d')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x2629('0x36')](util[_0x2629('0x4f')](_0x2629('0x50'),this['agents'][_0x1043ab[_0x2629('0x43')][_0x2629('0x4d')]('-')[0x0]][_0x2629('0x51')]),_0x2629('0x9d'),{'destaccountcode':this[_0x2629('0x1d')][_0x1043ab[_0x2629('0x43')]['split']('-')[0x0]][_0x2629('0x4e')]});}}var _0x5d6793=this;Promise[_0x2629('0x9e')]()[_0x2629('0x9f')](function(){if(!_0x5d6793['settings'][_0x2629('0xa0')])return;var _0xf0e5d=_0x5d6793[_0x2629('0x1c')][_0x1043ab[_0x2629('0x3b')]];if(typeof _0xf0e5d[_0x2629('0xa1')]==='undefined')return;if(_[_0x2629('0xa2')](_0xf0e5d[_0x2629('0x76')]))return;return ami['Action']({'action':_0x2629('0xa3'),'channel':_0xf0e5d[_0x2629('0x69')]})[_0x2629('0xa4')](function(){})['finally'](function(){io[_0x2629('0x36')](_0x2629('0xa5'),{'agentId':_0x5d6793[_0x2629('0x1d')][_0xf0e5d[_0x2629('0x69')][_0x2629('0x4d')]('-')[0x0]]['id'],'uniqueid':_0xf0e5d['uniqueid']});});})[_0x2629('0x9f')](function(){if(_0x1043ab[_0x2629('0xa6')]==='BlindTransfer'){_0x5d6793[_0x2629('0x1f')][_0x1043ab['uniqueid']]=_0x5d6793[_0x2629('0x1c')][_0x1043ab['uniqueid']];}else{if(_0x5d6793[_0x2629('0x1c')][_0x1043ab['uniqueid']][_0x2629('0xa7')]===_0x2629('0xa8')&&_0x5d6793[_0x2629('0x1f')][_0x1043ab[_0x2629('0x3b')]]){_0x5d6793[_0x2629('0x1c')][_0x1043ab[_0x2629('0x3b')]][_0x2629('0x3b')]=[_0x5d6793[_0x2629('0x1c')][_0x1043ab[_0x2629('0x3b')]][_0x2629('0x3c')],_0x5d6793[_0x2629('0x1c')][_0x1043ab[_0x2629('0x3b')]][_0x2629('0x3c')]=_0x5d6793[_0x2629('0x1c')][_0x1043ab[_0x2629('0x3b')]][_0x2629('0x3b')]][0x0];delete _0x5d6793[_0x2629('0x1f')][_0x1043ab[_0x2629('0x3b')]];}}logger[_0x2629('0x3a')](_0x2629('0xa9'),_0x1043ab['uniqueid'],util['inspect'](_0x5d6793[_0x2629('0x1c')][_0x1043ab['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x2629('0xaa'),_0x5d6793[_0x2629('0x1c')][_0x1043ab[_0x2629('0x3b')]]);delete _0x5d6793[_0x2629('0x1c')][_0x1043ab[_0x2629('0x3b')]];});}}}catch(_0x2eb302){logger[_0x2629('0x40')](_0x2629('0xab'),_0x1043ab[_0x2629('0x3b')],util[_0x2629('0x33')](_0x2eb302,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2629('0x35')][_0x2629('0xac')]=function(_0x25960e){try{if(this['isNotNull'](_0x25960e)){logger[_0x2629('0x30')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x25960e[_0x2629('0x3b')],_0x25960e['origtransferercalleridnum'],_0x25960e[_0x2629('0xad')]);logger[_0x2629('0x3a')](_0x2629('0xae'),_0x25960e[_0x2629('0x3b')],util[_0x2629('0x33')](_0x25960e,{'showHidden':![],'depth':null}));if(this['channels'][_0x25960e[_0x2629('0xaf')]]){this[_0x2629('0x1c')][_0x25960e[_0x2629('0xaf')]][_0x2629('0xb0')]=_0x25960e[_0x2629('0xb1')];this[_0x2629('0x1c')][_0x25960e[_0x2629('0xaf')]]['transferconnectedlinenum']=_0x25960e['transfertargetcalleridnum'];if(this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb2')]]){var _0x55934f=this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb2')]];this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb2')]]=this[_0x2629('0x1c')][_0x25960e['transfereeuniqueid']];this[_0x2629('0x1c')][_0x25960e[_0x2629('0xaf')]]=_0x55934f;}}else if(this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb3')]]){this['channels'][_0x25960e[_0x2629('0xb3')]][_0x2629('0xb0')]=_0x25960e[_0x2629('0xb1')];this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb3')]]['transferconnectedlinenum']=_0x25960e['transfertargetcalleridnum'];if(this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb4')]]){var _0x55934f=this[_0x2629('0x1c')][_0x25960e['origtransfereruniqueid']];this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb4')]]=this[_0x2629('0x1c')][_0x25960e['transfertargetuniqueid']];this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb3')]]=_0x55934f;}}if(this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb4')]]&&this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb2')]]){var _0x483f79=_[_0x2629('0xb5')]([this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb4')]],this[_0x2629('0x1c')][_0x25960e['secondtransfereruniqueid']]],function(_0x1bb938){return _0x1bb938[_0x2629('0xa7')]===_0x2629('0xa8')&&_0x1bb938[_0x2629('0xb6')];});if(_0x483f79){if(this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb4')]][_0x2629('0xa7')]!==_0x2629('0xa8'))this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb4')]][_0x2629('0xa1')]='ATTENDED';if(this[_0x2629('0x1c')][_0x25960e[_0x2629('0xb2')]][_0x2629('0xa7')]!==_0x2629('0xa8'))this[_0x2629('0x1c')][_0x25960e['secondtransfereruniqueid']][_0x2629('0xa1')]=_0x2629('0xb7');}}}}catch(_0x49d577){logger[_0x2629('0x40')](_0x2629('0xb8'),_0x25960e[_0x2629('0x3b')],util[_0x2629('0x33')](_0x49d577,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2629('0x35')][_0x2629('0x2c')]=function(_0x1f5da5){try{if(this['isNotNull'](_0x1f5da5)){logger[_0x2629('0x30')](_0x2629('0xb9'),_0x1f5da5[_0x2629('0x3b')],_0x1f5da5[_0x2629('0xba')],_0x1f5da5[_0x2629('0xbb')]);logger[_0x2629('0x3a')](_0x2629('0xbc'),_0x1f5da5[_0x2629('0x3b')],util[_0x2629('0x33')](_0x1f5da5,{'showHidden':![],'depth':null}));if(this[_0x2629('0x1c')][_0x1f5da5[_0x2629('0xaf')]]){this[_0x2629('0x1c')][_0x1f5da5[_0x2629('0xaf')]][_0x2629('0xb0')]=_0x1f5da5[_0x2629('0xba')];this[_0x2629('0x1c')][_0x1f5da5[_0x2629('0xaf')]][_0x2629('0xbd')]=_0x1f5da5['extension'];this[_0x2629('0x1c')][_0x1f5da5[_0x2629('0xaf')]][_0x2629('0xa1')]=_0x2629('0xbe');this[_0x2629('0x28')]({'event':'BlindTransfer','uniqueid':_0x1f5da5['transfereeuniqueid'],'context':_0x1f5da5[_0x2629('0x46')],'channel':_0x1f5da5[_0x2629('0xbf')]});}else{this[_0x2629('0x1c')][_0x1f5da5['transfereruniqueid']][_0x2629('0xa1')]=_0x2629('0xbe');}}}catch(_0x485b78){logger[_0x2629('0x40')]('[%s][voiceCallReport][blindtransfer]',_0x1f5da5[_0x2629('0x3b')],util[_0x2629('0x33')](_0x485b78,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2629('0x35')][_0x2629('0x2e')]=function(_0x3cb82a){try{if(this[_0x2629('0x37')](_0x3cb82a)){logger[_0x2629('0x3a')](_0x2629('0xc0'),_0x3cb82a[_0x2629('0x3b')],util[_0x2629('0x33')](_0x3cb82a,{'showHidden':![],'depth':null}));if(this[_0x2629('0x1c')][_0x3cb82a['uniqueid']]){if(!_[_0x2629('0x77')](this[_0x2629('0x1c')][_0x3cb82a['uniqueid']][_0x2629('0x64')])){this[_0x2629('0x1c')][_0x3cb82a[_0x2629('0x3b')]]['mohstarttime']=moment()[_0x2629('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x2629('0x30')](_0x2629('0xc1'),_0x3cb82a[_0x2629('0x3b')],this[_0x2629('0x1c')][_0x3cb82a['uniqueid']][_0x2629('0xc2')]);}}}}catch(_0x2bd613){logger['error'](_0x2629('0xc3'),_0x3cb82a[_0x2629('0x3b')],util[_0x2629('0x33')](_0x2bd613,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2629('0x35')][_0x2629('0xc4')]=function(_0x46b5cb){try{if(this[_0x2629('0x37')](_0x46b5cb)){logger[_0x2629('0x3a')](_0x2629('0xc5'),_0x46b5cb[_0x2629('0x3b')],util['inspect'](_0x46b5cb,{'showHidden':![],'depth':null}));if(this[_0x2629('0x1c')][_0x46b5cb['uniqueid']]){if(!_['isNil'](this[_0x2629('0x1c')][_0x46b5cb['uniqueid']]['mohstarttime'])){this[_0x2629('0x1c')][_0x46b5cb[_0x2629('0x3b')]]['mohtime']+=moment()[_0x2629('0xc6')](0x0)[_0x2629('0x66')](this[_0x2629('0x1c')][_0x46b5cb[_0x2629('0x3b')]][_0x2629('0xc2')],'seconds');logger[_0x2629('0x30')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x46b5cb[_0x2629('0x3b')],this[_0x2629('0x1c')][_0x46b5cb[_0x2629('0x3b')]][_0x2629('0xc7')]);delete this[_0x2629('0x1c')][_0x46b5cb[_0x2629('0x3b')]][_0x2629('0xc2')];}}}}catch(_0x458e93){logger['error'](_0x2629('0xc8'),_0x46b5cb['uniqueid'],util[_0x2629('0x33')](_0x458e93,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x77d4=['[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','not_inuse','inuse','busy','invalid','ringing','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','localhost','socket.io-emitter','channels','agents','settings','blindTransfers','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','inspect','linkedid','isUndefined','merge','pick','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','context','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','starttime','subtract','duration','seconds','disposition','includes','lastapplication','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','UserId','membername','name','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitors','push','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','type','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','then','stopRecordingOnTransfer','transferType','undefined','isEmpty','Action','catch','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum'];(function(_0x1363e7,_0x1e578b){var _0x1498c6=function(_0x481f13){while(--_0x481f13){_0x1363e7['push'](_0x1363e7['shift']());}};_0x1498c6(++_0x1e578b);}(_0x77d4,0x197));var _0x477d=function(_0x16b51e,_0x30cb17){_0x16b51e=_0x16b51e-0x0;var _0x27b91a=_0x77d4[_0x16b51e];return _0x27b91a;};'use strict';var BPromise=require(_0x477d('0x0'));var _=require(_0x477d('0x1'));var moment=require(_0x477d('0x2'));var util=require(_0x477d('0x3'));var path=require(_0x477d('0x4'));var Redis=require(_0x477d('0x5'));var config=require(_0x477d('0x6'));var logger=require(_0x477d('0x7'))(_0x477d('0x8'));var ami=require(_0x477d('0x9'));var Channel=require(_0x477d('0xa'));var statusDesc=['unknown',_0x477d('0xb'),_0x477d('0xc'),_0x477d('0xd'),_0x477d('0xe'),'unavailable',_0x477d('0xf'),'ringinuse','onhold'];var applications=[_0x477d('0x10'),_0x477d('0x11'),_0x477d('0x12'),_0x477d('0x13'),_0x477d('0x14'),_0x477d('0x15')];var dispositions=['NO\x20ANSWER','FAILED','FAILED',_0x477d('0x16'),'NO\x20ANSWER',_0x477d('0x16'),_0x477d('0x17'),_0x477d('0x18'),_0x477d('0x19'),_0x477d('0x19'),_0x477d('0x19')];var actions={};config[_0x477d('0x1a')]=_['defaults'](config[_0x477d('0x1a')],{'host':_0x477d('0x1b'),'port':0x18eb});var io=require(_0x477d('0x1c'))(new Redis(config['redis']));function VoiceCallReport(_0x343b3c){this[_0x477d('0x1d')]=_0x343b3c[_0x477d('0x1d')];this[_0x477d('0x1e')]=_0x343b3c[_0x477d('0x1e')];this[_0x477d('0x1f')]=_0x343b3c['settings'];this[_0x477d('0x20')]={};ami['on']('coreshowchannel',this[_0x477d('0x21')][_0x477d('0x22')](this));ami['on'](_0x477d('0x23'),this['syncNewExten']['bind'](this));ami['on']('newchannel',this[_0x477d('0x24')][_0x477d('0x22')](this));ami['on'](_0x477d('0x25'),this[_0x477d('0x26')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0x477d('0x22')](this));ami['on']('hangup',this[_0x477d('0x27')][_0x477d('0x22')](this));ami['on'](_0x477d('0x28'),this['syncNewCallerId'][_0x477d('0x22')](this));ami['on'](_0x477d('0x29'),this[_0x477d('0x2a')][_0x477d('0x22')](this));ami['on'](_0x477d('0x2b'),this[_0x477d('0x2c')][_0x477d('0x22')](this));ami['on'](_0x477d('0x2d'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x477d('0x2e'),this['syncMusicOnHoldStop'][_0x477d('0x22')](this));try{logger[_0x477d('0x2f')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x477d('0x30')]();}catch(_0x46e58c){logger[_0x477d('0x31')](_0x477d('0x32'),util['inspect'](_0x46e58c,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x477d('0x33')][_0x477d('0x34')]=function(_0x53aefa){return _0x53aefa!==null&&!_['isUndefined'](_0x53aefa);};VoiceCallReport[_0x477d('0x33')]['emit']=function(_0x3a30ae,_0x12254e,_0x2aea57){io['to'](_0x3a30ae)[_0x477d('0x35')](_0x12254e,_0x2aea57);};VoiceCallReport[_0x477d('0x33')][_0x477d('0x36')]=function(_0x1ceffa){try{if(this[_0x477d('0x34')](_0x1ceffa)){logger['info'](_0x477d('0x37'),_0x1ceffa[_0x477d('0x38')],_0x1ceffa[_0x477d('0x39')],_0x1ceffa[_0x477d('0x3a')]);logger[_0x477d('0x3b')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x1ceffa[_0x477d('0x38')],util[_0x477d('0x3c')](_0x1ceffa,{'showHidden':![],'depth':null}));if(_0x1ceffa[_0x477d('0x38')]===_0x1ceffa[_0x477d('0x3d')]){if(!_[_0x477d('0x3e')](this[_0x477d('0x1d')][_0x1ceffa[_0x477d('0x38')]])){_[_0x477d('0x3f')](this[_0x477d('0x1d')][_0x1ceffa[_0x477d('0x38')]],_[_0x477d('0x40')](_0x1ceffa,_[_0x477d('0x41')](this[_0x477d('0x1d')][_0x1ceffa['uniqueid']])));}}}}catch(_0x495da9){logger[_0x477d('0x31')](_0x477d('0x42'),_0x1ceffa[_0x477d('0x38')],util[_0x477d('0x3c')](_0x495da9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0x24')]=function(_0x26c926){try{if(this[_0x477d('0x34')](_0x26c926)){logger[_0x477d('0x3b')](_0x477d('0x43'),_0x26c926['uniqueid'],util[_0x477d('0x3c')](_0x26c926,{'showHidden':![],'depth':null}));if(_0x26c926[_0x477d('0x38')]===_0x26c926['linkedid']&&_0x26c926[_0x477d('0x44')]!=_0x477d('0x45')){if(_[_0x477d('0x3e')](this[_0x477d('0x1d')][_0x26c926[_0x477d('0x38')]])){logger['info'](_0x477d('0x46'),_0x26c926[_0x477d('0x38')],_0x26c926['context'],_0x26c926[_0x477d('0x47')]);this[_0x477d('0x1d')][_0x26c926['uniqueid']]=new Channel();this[_0x477d('0x1d')][_0x26c926[_0x477d('0x38')]]['starttime']=moment()[_0x477d('0x48')](_0x477d('0x49'));this[_0x477d('0x1d')][_0x26c926[_0x477d('0x38')]]['disposition']=dispositions[_[_0x477d('0x4a')](_0x26c926[_0x477d('0x4b')])];_[_0x477d('0x3f')](this['channels'][_0x26c926[_0x477d('0x38')]],_[_0x477d('0x40')](_0x26c926,_['keys'](this['channels'][_0x26c926[_0x477d('0x38')]])));if(_0x26c926[_0x477d('0x4c')]==='from-sip'){if(this[_0x477d('0x1e')][_0x26c926[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]]){this['agents'][_0x26c926[_0x477d('0x44')]['split']('-')[0x0]]['destconnectedlinenum']=_0x26c926[_0x477d('0x47')];logger['debug'](_0x477d('0x4e'),_0x26c926[_0x477d('0x38')],util[_0x477d('0x3c')]({'destaccountcode':this[_0x477d('0x1e')][_0x26c926[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]][_0x477d('0x4f')],'destconnectedlinenum':_0x26c926[_0x477d('0x47')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x477d('0x48')](_0x477d('0x50'),this[_0x477d('0x1e')][_0x26c926[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]]['name']),_0x477d('0x51'),{'destaccountcode':this[_0x477d('0x1e')][_0x26c926[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]][_0x477d('0x4f')],'destconnectedlinenum':_0x26c926[_0x477d('0x47')]});}}}}}}catch(_0xd664c3){logger['error'](_0x477d('0x52'),_0x26c926[_0x477d('0x38')],util['inspect'](_0xd664c3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0x21')]=function(_0x170a0b){try{if(this['isNotNull'](_0x170a0b)){logger[_0x477d('0x3b')](_0x477d('0x53'),_0x170a0b[_0x477d('0x38')],util[_0x477d('0x3c')](_0x170a0b,{'showHidden':![],'depth':null}));if(_0x170a0b[_0x477d('0x38')]===_0x170a0b[_0x477d('0x3d')]&&_0x170a0b['exten']!='h'&&_0x170a0b['channel']!=_0x477d('0x45')){_0x170a0b[_0x477d('0x54')]=_0x170a0b[_0x477d('0x54')][_0x477d('0x55')]();_0x170a0b[_0x477d('0x56')]=(_0x170a0b['appdata']||_0x170a0b['applicationdata'])[_0x477d('0x55')]();logger[_0x477d('0x2f')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x170a0b[_0x477d('0x38')],_0x170a0b['application'],_0x170a0b[_0x477d('0x56')]);if(_[_0x477d('0x3e')](this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]])){this[_0x477d('0x1d')][_0x170a0b['uniqueid']]=new Channel();this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]][_0x477d('0x57')]=_0x170a0b['duration']?moment()[_0x477d('0x58')](moment[_0x477d('0x59')](_0x170a0b[_0x477d('0x59')])[_0x477d('0x5a')](),_0x477d('0x5a'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x477d('0x48')](_0x477d('0x49'));this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]][_0x477d('0x5b')]='NO\x20ANSWER';}_['merge'](this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]],_[_0x477d('0x40')](_0x170a0b,_[_0x477d('0x41')](this['channels'][_0x170a0b['uniqueid']])));if(_[_0x477d('0x5c')](applications,_0x170a0b[_0x477d('0x54')])){this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]][_0x477d('0x5d')]=_0x170a0b['application'];this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]]['lastdata']=_0x170a0b[_0x477d('0x56')];if(_0x170a0b['application']===_0x477d('0x10')&&_[_0x477d('0x5e')](_0x170a0b[_0x477d('0x56')],_0x477d('0x5f'))){var _0x218e81=_0x170a0b['applicationdata']['split']('=');var _0x1194fa=_0x218e81[0x0][_0x477d('0x60')](/cdr\((.*)\)/);if(_0x1194fa){this['channels'][_0x170a0b[_0x477d('0x38')]][_0x1194fa[0x1]]=_0x218e81[0x1];}}else if(_0x170a0b[_0x477d('0x54')]===_0x477d('0x11')){this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]]['queue']=_0x170a0b[_0x477d('0x56')][_0x477d('0x4d')](',')[0x0];}}}}}catch(_0x4504e8){logger[_0x477d('0x31')](_0x477d('0x61'),_0x170a0b[_0x477d('0x38')],util[_0x477d('0x3c')](_0x4504e8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x477d('0x26')]=function(_0x54eb9b){try{if(this[_0x477d('0x34')](_0x54eb9b)){logger[_0x477d('0x2f')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x54eb9b[_0x477d('0x38')],_0x54eb9b[_0x477d('0x3d')],_0x54eb9b[_0x477d('0x39')],_0x54eb9b['calleridnum']);logger[_0x477d('0x3b')](_0x477d('0x62'),_0x54eb9b['uniqueid'],util['inspect'](_0x54eb9b,{'showHidden':![],'depth':null}));if(_0x54eb9b['uniqueid']!==_0x54eb9b['linkedid']){if(this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]]){if(_0x54eb9b[_0x477d('0x4b')]==='6'){if(!this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x63')]){var _0x2ca1b3=moment();this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x63')]=!![];this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x64')]=_0x2ca1b3[_0x477d('0x48')](_0x477d('0x49'));if(this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]]['starttime']){this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x65')]=_0x2ca1b3[_0x477d('0x66')](this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]]['starttime'],'seconds');}}this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]]['linkedid']=_0x54eb9b[_0x477d('0x38')];if(_0x54eb9b['calleridnum']!=='xcally-motion-preview'){this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]]['connectedlinenum']=_0x54eb9b['calleridnum'];}this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x67')]=_0x54eb9b[_0x477d('0x39')];this['channels'][_0x54eb9b['linkedid']][_0x477d('0x68')]=_0x54eb9b[_0x477d('0x44')];this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x5b')]=dispositions[_[_0x477d('0x4a')](_0x54eb9b[_0x477d('0x4b')])];if(this[_0x477d('0x1e')][_0x54eb9b['channel'][_0x477d('0x4d')]('-')[0x0]]){this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x69')]=this[_0x477d('0x1e')][_0x54eb9b['channel'][_0x477d('0x4d')]('-')[0x0]]['id'];this['channels'][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x6a')]=this[_0x477d('0x1e')][_0x54eb9b[_0x477d('0x44')]['split']('-')[0x0]][_0x477d('0x6b')];}}}}else{if(this['channels'][_0x54eb9b[_0x477d('0x38')]]){if(_0x54eb9b[_0x477d('0x4b')]==='6'){if(this[_0x477d('0x1e')][_0x54eb9b['channel'][_0x477d('0x4d')]('-')[0x0]]){this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x38')]]['UserId']=this[_0x477d('0x1e')][_0x54eb9b['channel'][_0x477d('0x4d')]('-')[0x0]]['id'];this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x38')]]['membername']=this['agents'][_0x54eb9b[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]][_0x477d('0x6b')];}}}}}}catch(_0x2c5221){logger['error'](_0x477d('0x6c'),_0x54eb9b[_0x477d('0x38')],util['inspect'](_0x2c5221,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0x6d')]=function(_0x51047e,_0x2ebbfd){try{if(this[_0x477d('0x1d')][_0x51047e]){logger[_0x477d('0x2f')](_0x477d('0x6e'),_0x51047e,_0x2ebbfd);this[_0x477d('0x1d')][_0x51047e][_0x477d('0x6f')]=!![];if(_[_0x477d('0x70')](_0x2ebbfd,_0x477d('0x71'))){_0x2ebbfd=_0x2ebbfd['replace'](_0x477d('0x71'),_0x477d('0x72'));}this[_0x477d('0x1d')][_0x51047e]['monitorFilename']=_0x2ebbfd;var _0x49319d=_['find'](this[_0x477d('0x1d')][_0x51047e][_0x477d('0x73')],{'filename':_0x2ebbfd});if(_['isNil'](_0x49319d)){this[_0x477d('0x1d')][_0x51047e][_0x477d('0x73')][_0x477d('0x74')]({'filename':_0x2ebbfd,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0x241c49){logger[_0x477d('0x31')](_0x477d('0x75'),_0x51047e,util[_0x477d('0x3c')](_0x241c49,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0x76')]=function(_0x80e4e0){try{if(this[_0x477d('0x34')](_0x80e4e0)){logger[_0x477d('0x3b')](_0x477d('0x77'),_0x80e4e0[_0x477d('0x38')],util[_0x477d('0x3c')](_0x80e4e0,{'showHidden':![],'depth':null}));if(this[_0x477d('0x1d')][_0x80e4e0[_0x477d('0x38')]]&&_0x80e4e0['channel']!=_0x477d('0x45')){if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')])){if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x79')])){logger[_0x477d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')]);this[_0x477d('0x6d')](_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')]);}else if(this['isNotNull'](_0x80e4e0[_0x477d('0x78')][_0x477d('0x7b')])){logger[_0x477d('0x2f')](_0x477d('0x7c'),_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')]);this[_0x477d('0x1d')][_0x80e4e0[_0x477d('0x38')]][_0x477d('0x3a')]=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x7d')])){logger['info'](_0x477d('0x7e'),_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')]);this[_0x477d('0x1d')][_0x80e4e0[_0x477d('0x38')]][_0x477d('0x7f')]=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0['variable'][_0x477d('0x80')])){logger[_0x477d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')]);this[_0x477d('0x1d')][_0x80e4e0['uniqueid']][_0x477d('0x81')]=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')]['xmd-queue'])){logger[_0x477d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')][_0x477d('0x4d')](',')[0x0]);this[_0x477d('0x1d')][_0x80e4e0[_0x477d('0x38')]][_0x477d('0x11')]=_0x80e4e0[_0x477d('0x7a')]['split'](',')[0x0];}else if(this[_0x477d('0x34')](_0x80e4e0['variable']['xmd-originatecalleridnum'])){logger[_0x477d('0x2f')](_0x477d('0x82'),_0x80e4e0[_0x477d('0x38')],_0x80e4e0['value']);this['channels'][_0x80e4e0[_0x477d('0x38')]]['originatecalleridnum']=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x83')])){logger[_0x477d('0x2f')](_0x477d('0x84'),_0x80e4e0['uniqueid'],_0x80e4e0['value']);this[_0x477d('0x1d')][_0x80e4e0[_0x477d('0x38')]][_0x477d('0x85')]=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x86')])){logger['info'](_0x477d('0x87'),_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')]);this[_0x477d('0x1d')][_0x80e4e0['uniqueid']][_0x477d('0x88')]=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x89')])){logger[_0x477d('0x2f')](_0x477d('0x8a'),_0x80e4e0[_0x477d('0x38')],_0x80e4e0['value']);this['channels'][_0x80e4e0[_0x477d('0x38')]]['queue']=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x8b')])){logger['info'](_0x477d('0x8c'),_0x80e4e0['uniqueid'],_0x80e4e0[_0x477d('0x7a')]);this['channels'][_0x80e4e0['uniqueid']]['sipcalluniqueid']=_0x80e4e0['value'];}}}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x79')])){if(_0x80e4e0[_0x477d('0x7a')]){var _0x34c30c=path[_0x477d('0x8d')](_0x80e4e0[_0x477d('0x7a')])[_0x477d('0x6b')];logger['info'](_0x477d('0x8e'),_0x34c30c,_0x80e4e0[_0x477d('0x7a')]);this['syncMixMonitorFilename'](_0x34c30c,_0x80e4e0[_0x477d('0x7a')]);}}else if(this[_0x477d('0x1d')][_0x80e4e0['linkedid']]){if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')])){if(this[_0x477d('0x34')](_0x80e4e0['variable'][_0x477d('0x8b')])){logger[_0x477d('0x2f')](_0x477d('0x8c'),_0x80e4e0['linkedid'],_0x80e4e0[_0x477d('0x7a')]);this['channels'][_0x80e4e0[_0x477d('0x3d')]][_0x477d('0x8f')]=_0x80e4e0[_0x477d('0x7a')];}}}}}catch(_0x581fc8){logger[_0x477d('0x31')](_0x477d('0x90'),_0x80e4e0['uniqueid'],util['inspect'](_0x581fc8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0x27')]=function(_0x183aa8){try{if(this[_0x477d('0x34')](_0x183aa8)){logger[_0x477d('0x3b')](_0x477d('0x91'),_0x183aa8[_0x477d('0x38')],util[_0x477d('0x3c')](_0x183aa8,{'showHidden':![],'depth':null}));if(this[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]]){logger[_0x477d('0x2f')](_0x477d('0x92'),_0x183aa8[_0x477d('0x38')],_0x183aa8[_0x477d('0x93')]);var _0xc5b6d4=moment();this[_0x477d('0x1d')][_0x183aa8['uniqueid']]['endtime']=_0xc5b6d4[_0x477d('0x48')](_0x477d('0x49'));this['channels'][_0x183aa8[_0x477d('0x38')]][_0x477d('0x59')]=_0xc5b6d4[_0x477d('0x66')](this[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]][_0x477d('0x57')],_0x477d('0x5a'));if(this[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]]['answered']){this[_0x477d('0x1d')][_0x183aa8['uniqueid']]['billableseconds']=_0xc5b6d4[_0x477d('0x66')](this[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]][_0x477d('0x64')],_0x477d('0x5a'));this[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]][_0x477d('0x65')]=this[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]][_0x477d('0x59')]-this['channels'][_0x183aa8[_0x477d('0x38')]]['billableseconds'];}if(_0x183aa8[_0x477d('0x4c')]==='from-sip'){if(this[_0x477d('0x1e')][_0x183aa8['channel'][_0x477d('0x4d')]('-')[0x0]]){this[_0x477d('0x1e')][_0x183aa8[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]]=_[_0x477d('0x94')](this['agents'][_0x183aa8[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0x477d('0x95'),_0x183aa8['uniqueid'],util[_0x477d('0x3c')]({'destaccountcode':this['agents'][_0x183aa8[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]][_0x477d('0x4f')]},{'showHidden':![],'depth':null}));this[_0x477d('0x35')](util[_0x477d('0x48')]('user:%s',this['agents'][_0x183aa8['channel'][_0x477d('0x4d')]('-')[0x0]][_0x477d('0x6b')]),'user:agentcomplete',{'destaccountcode':this[_0x477d('0x1e')][_0x183aa8[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]]['accountcode']});}}var _0x5a3428=this;Promise['resolve']()[_0x477d('0x96')](function(){if(!_0x5a3428[_0x477d('0x1f')][_0x477d('0x97')])return;var _0x751702=_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]];if(typeof _0x751702[_0x477d('0x98')]===_0x477d('0x99'))return;if(_[_0x477d('0x9a')](_0x751702['monitors']))return;return ami[_0x477d('0x9b')]({'action':'StopMixMonitor','channel':_0x751702[_0x477d('0x68')]})[_0x477d('0x9c')](function(){})[_0x477d('0x9d')](function(){io[_0x477d('0x35')](_0x477d('0x9e'),{'agentId':_0x5a3428[_0x477d('0x1e')][_0x751702[_0x477d('0x68')]['split']('-')[0x0]]['id'],'uniqueid':_0x751702[_0x477d('0x38')]});});})[_0x477d('0x96')](function(){if(_0x183aa8['event']===_0x477d('0x9f')){_0x5a3428[_0x477d('0x20')][_0x183aa8[_0x477d('0x38')]]=_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]];}else{if(_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]]['type']===_0x477d('0xa0')&&_0x5a3428[_0x477d('0x20')][_0x183aa8[_0x477d('0x38')]]){_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]]['uniqueid']=[_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]][_0x477d('0x3d')],_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]][_0x477d('0x3d')]=_0x5a3428['channels'][_0x183aa8[_0x477d('0x38')]][_0x477d('0x38')]][0x0];delete _0x5a3428[_0x477d('0x20')][_0x183aa8[_0x477d('0x38')]];}}logger[_0x477d('0x3b')](_0x477d('0xa1'),_0x183aa8['uniqueid'],util[_0x477d('0x3c')](_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]],{'showHidden':![],'depth':null}));ami['emit'](_0x477d('0xa2'),_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]]);delete _0x5a3428[_0x477d('0x1d')][_0x183aa8['uniqueid']];});}}}catch(_0x219e38){logger[_0x477d('0x31')](_0x477d('0xa3'),_0x183aa8['uniqueid'],util[_0x477d('0x3c')](_0x219e38,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x477d('0x2a')]=function(_0x1c6f04){try{if(this[_0x477d('0x34')](_0x1c6f04)){logger['info'](_0x477d('0xa4'),_0x1c6f04[_0x477d('0x38')],_0x1c6f04['origtransferercalleridnum'],_0x1c6f04[_0x477d('0xa5')]);logger[_0x477d('0x3b')](_0x477d('0xa6'),_0x1c6f04[_0x477d('0x38')],util[_0x477d('0x3c')](_0x1c6f04,{'showHidden':![],'depth':null}));if(this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xa7')]]){this['channels'][_0x1c6f04[_0x477d('0xa7')]][_0x477d('0xa8')]=_0x1c6f04[_0x477d('0xa9')];this['channels'][_0x1c6f04[_0x477d('0xa7')]][_0x477d('0xaa')]=_0x1c6f04[_0x477d('0xa5')];if(this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xab')]]){var _0x3435ad=this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xab')]];this[_0x477d('0x1d')][_0x1c6f04['secondtransfereruniqueid']]=this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xa7')]];this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xa7')]]=_0x3435ad;}}else if(this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xac')]]){this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xac')]]['transfercalleridnum']=_0x1c6f04[_0x477d('0xa9')];this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xac')]][_0x477d('0xaa')]=_0x1c6f04[_0x477d('0xa5')];if(this[_0x477d('0x1d')][_0x1c6f04['origtransfereruniqueid']]){var _0x3435ad=this['channels'][_0x1c6f04[_0x477d('0xad')]];this['channels'][_0x1c6f04['origtransfereruniqueid']]=this['channels'][_0x1c6f04[_0x477d('0xac')]];this[_0x477d('0x1d')][_0x1c6f04['transfertargetuniqueid']]=_0x3435ad;}}if(this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xad')]]&&this[_0x477d('0x1d')][_0x1c6f04['secondtransfereruniqueid']]){var _0x2a2f7c=_['some']([this['channels'][_0x1c6f04[_0x477d('0xad')]],this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xab')]]],function(_0x5f56a7){return _0x5f56a7[_0x477d('0x81')]===_0x477d('0xa0')&&_0x5f56a7[_0x477d('0xae')];});if(_0x2a2f7c){if(this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xad')]][_0x477d('0x81')]!==_0x477d('0xa0'))this['channels'][_0x1c6f04['origtransfereruniqueid']]['transferType']=_0x477d('0xaf');if(this[_0x477d('0x1d')][_0x1c6f04['secondtransfereruniqueid']][_0x477d('0x81')]!=='outbound')this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xab')]][_0x477d('0x98')]='ATTENDED';}}}}catch(_0x1d1d39){logger[_0x477d('0x31')](_0x477d('0xb0'),_0x1c6f04['uniqueid'],util[_0x477d('0x3c')](_0x1d1d39,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0x2c')]=function(_0x43ff47){try{if(this['isNotNull'](_0x43ff47)){logger[_0x477d('0x2f')](_0x477d('0xb1'),_0x43ff47['uniqueid'],_0x43ff47[_0x477d('0xb2')],_0x43ff47[_0x477d('0xb3')]);logger[_0x477d('0x3b')](_0x477d('0xb4'),_0x43ff47['uniqueid'],util[_0x477d('0x3c')](_0x43ff47,{'showHidden':![],'depth':null}));if(this['channels'][_0x43ff47[_0x477d('0xa7')]]){this[_0x477d('0x1d')][_0x43ff47[_0x477d('0xa7')]][_0x477d('0xa8')]=_0x43ff47[_0x477d('0xb2')];this[_0x477d('0x1d')][_0x43ff47[_0x477d('0xa7')]][_0x477d('0xaa')]=_0x43ff47[_0x477d('0xb3')];this[_0x477d('0x1d')][_0x43ff47[_0x477d('0xa7')]][_0x477d('0x98')]=_0x477d('0xb5');this[_0x477d('0x27')]({'event':_0x477d('0x9f'),'uniqueid':_0x43ff47[_0x477d('0xa7')],'context':_0x43ff47[_0x477d('0x4c')],'channel':_0x43ff47[_0x477d('0xb6')]});}else{this['channels'][_0x43ff47['transfereruniqueid']][_0x477d('0x98')]='BLIND';}}}catch(_0x2a26a0){logger['error'](_0x477d('0xb7'),_0x43ff47[_0x477d('0x38')],util['inspect'](_0x2a26a0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0xb8')]=function(_0x5f0054){try{if(this['isNotNull'](_0x5f0054)){logger[_0x477d('0x3b')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x5f0054[_0x477d('0x38')],util[_0x477d('0x3c')](_0x5f0054,{'showHidden':![],'depth':null}));if(this['channels'][_0x5f0054[_0x477d('0x38')]]){if(!_['isNil'](this[_0x477d('0x1d')][_0x5f0054[_0x477d('0x38')]][_0x477d('0x64')])){this['channels'][_0x5f0054['uniqueid']][_0x477d('0xb9')]=moment()[_0x477d('0x48')]('YYYY-MM-DD\x20HH:mm:ss');logger['info'](_0x477d('0xba'),_0x5f0054[_0x477d('0x38')],this[_0x477d('0x1d')][_0x5f0054['uniqueid']][_0x477d('0xb9')]);}}}}catch(_0x5f45ef){logger['error'](_0x477d('0xbb'),_0x5f0054[_0x477d('0x38')],util['inspect'](_0x5f45ef,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0xbc')]=function(_0x7e4b9b){try{if(this[_0x477d('0x34')](_0x7e4b9b)){logger[_0x477d('0x3b')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x7e4b9b[_0x477d('0x38')],util[_0x477d('0x3c')](_0x7e4b9b,{'showHidden':![],'depth':null}));if(this[_0x477d('0x1d')][_0x7e4b9b[_0x477d('0x38')]]){if(!_['isNil'](this['channels'][_0x7e4b9b['uniqueid']]['mohstarttime'])){this['channels'][_0x7e4b9b[_0x477d('0x38')]][_0x477d('0xbd')]+=moment()['milliseconds'](0x0)[_0x477d('0x66')](this['channels'][_0x7e4b9b[_0x477d('0x38')]][_0x477d('0xb9')],'seconds');logger[_0x477d('0x2f')](_0x477d('0xbe'),_0x7e4b9b['uniqueid'],this[_0x477d('0x1d')][_0x7e4b9b[_0x477d('0x38')]][_0x477d('0xbd')]);delete this[_0x477d('0x1d')][_0x7e4b9b[_0x477d('0x38')]][_0x477d('0xb9')];}}}}catch(_0x5d07da){logger[_0x477d('0x31')]('[%s][voiceCallReport][musiconholdstop]',_0x7e4b9b[_0x477d('0x38')],util['inspect'](_0x5d07da,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 1e7a7fa..d6c9ea1 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 _0xa867=['debug','inspect','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','channels','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','connect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','value','variable','isUndefined','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','syncHangup','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','seconds','lastevent','complete','total','answertime','answered','holdtime','starttime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','moment','util','ioredis','ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','variables','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','syncVarSet','prototype','emit','isNotNull'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xa867,0x1ea));var _0x7a86=function(_0x214b4e,_0x7b0e03){_0x214b4e=_0x214b4e-0x0;var _0x295033=_0xa867[_0x214b4e];return _0x295033;};'use strict';var _=require('lodash');var moment=require(_0x7a86('0x0'));var util=require(_0x7a86('0x1'));var Redis=require(_0x7a86('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x7a86('0x3'));var ami=require('../ami');config[_0x7a86('0x4')]=_[_0x7a86('0x5')](config[_0x7a86('0x4')],{'host':_0x7a86('0x6'),'port':0x18eb});var io=require(_0x7a86('0x7'))(new Redis(config[_0x7a86('0x4')]));function VoiceDialReport(_0x463caf){this['channels']=_0x463caf[_0x7a86('0x8')];this[_0x7a86('0x9')]=_0x463caf[_0x7a86('0x9')];this[_0x7a86('0xa')]={};ami['on'](_0x7a86('0xb'),this[_0x7a86('0xc')]['bind'](this));ami['on'](_0x7a86('0xd'),this[_0x7a86('0xe')][_0x7a86('0xf')](this));ami['on']('varset',this[_0x7a86('0x10')][_0x7a86('0xf')](this));ami['on']('hangup',this['syncHangup'][_0x7a86('0xf')](this));}VoiceDialReport[_0x7a86('0x11')]['isNotNull']=function(_0x1ba9ce){return _0x1ba9ce!==null&&!_['isUndefined'](_0x1ba9ce);};VoiceDialReport[_0x7a86('0x11')]['emit']=function(_0x30cae7,_0x3438f5,_0x491f13){io['to'](_0x30cae7)[_0x7a86('0x12')](_0x3438f5,_0x491f13);};VoiceDialReport[_0x7a86('0x11')]['syncDialBegin']=function(_0x18598f){try{if(this[_0x7a86('0x13')](_0x18598f)){logger[_0x7a86('0x14')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x18598f['uniqueid'],util[_0x7a86('0x15')](_0x18598f,{'showHidden':![],'depth':null}));if(this['channels'][_0x18598f[_0x7a86('0x16')]]){_[_0x7a86('0x17')](this['channels'][_0x18598f[_0x7a86('0x16')]],{'starttime':moment()[_0x7a86('0x18')](_0x7a86('0x19')),'lastevent':_0x7a86('0x1a'),'interface':_0x18598f[_0x7a86('0x1b')][_0x7a86('0x1c')](0x0,_0x18598f[_0x7a86('0x1b')][_0x7a86('0x1d')]('-')),'membername':_0x18598f['channel'][_0x7a86('0x1c')](_0x18598f[_0x7a86('0x1b')]['lastIndexOf']('/')+0x1,_0x18598f['channel']['lastIndexOf']('-'))},_[_0x7a86('0x1e')](_0x18598f,['event',_0x7a86('0x1f')]));logger[_0x7a86('0x20')](_0x7a86('0x21'),_0x18598f[_0x7a86('0x16')],this[_0x7a86('0x22')][_0x18598f[_0x7a86('0x16')]][_0x7a86('0x23')],this[_0x7a86('0x22')][_0x18598f[_0x7a86('0x16')]]['interface']);logger[_0x7a86('0x14')](_0x7a86('0x24'),_0x18598f['uniqueid'],util[_0x7a86('0x15')](this[_0x7a86('0x22')][_0x18598f[_0x7a86('0x16')]],{'showHidden':![],'depth':null}));this[_0x7a86('0x12')](_0x7a86('0x25'),_0x7a86('0x26'),this[_0x7a86('0x22')][_0x18598f['uniqueid']]);logger[_0x7a86('0x14')](_0x7a86('0x27'),_0x18598f[_0x7a86('0x16')],util[_0x7a86('0x15')](this[_0x7a86('0x22')][_0x18598f[_0x7a86('0x16')]],{'showHidden':![],'depth':null}));ami['emit'](_0x7a86('0x28'),this['channels'][_0x18598f['uniqueid']]);}}}catch(_0x4b2347){logger[_0x7a86('0x29')](_0x7a86('0x2a'),_0x18598f[_0x7a86('0x16')],util[_0x7a86('0x15')](_0x4b2347,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7a86('0x11')][_0x7a86('0xe')]=function(_0x5897d3){try{if(this[_0x7a86('0x13')](_0x5897d3)){logger[_0x7a86('0x14')](_0x7a86('0x2b'),_0x5897d3[_0x7a86('0x16')],util[_0x7a86('0x15')](_0x5897d3,{'showHidden':![],'depth':null}));if(this[_0x7a86('0x22')][_0x5897d3[_0x7a86('0x16')]]){this[_0x7a86('0x22')][_0x5897d3['uniqueid']][_0x7a86('0x2c')]=_0x5897d3[_0x7a86('0x2c')];if(_0x5897d3[_0x7a86('0x2c')]===_0x7a86('0x2d')){this[_0x7a86('0x22')][_0x5897d3['uniqueid']][_0x7a86('0x2e')]=_0x5897d3[_0x7a86('0x2e')];this['channels'][_0x5897d3['uniqueid']]['connectedlinename']=_0x5897d3[_0x7a86('0x2f')];this[_0x7a86('0x22')][_0x5897d3[_0x7a86('0x16')]]['answertime']=moment()['format'](_0x7a86('0x19'));this[_0x7a86('0x22')][_0x5897d3[_0x7a86('0x16')]]['lastevent']=_0x7a86('0x30');logger[_0x7a86('0x20')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x5897d3[_0x7a86('0x16')],_0x5897d3['channel']['substring'](_0x5897d3[_0x7a86('0x1b')][_0x7a86('0x1d')]('/')+0x1,_0x5897d3[_0x7a86('0x1b')]['lastIndexOf']('-')));logger[_0x7a86('0x14')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x5897d3[_0x7a86('0x16')],util[_0x7a86('0x15')](this[_0x7a86('0x22')][_0x5897d3[_0x7a86('0x16')]],{'showHidden':![],'depth':null}));ami[_0x7a86('0x12')]('custom:dialconnect',this[_0x7a86('0x22')][_0x5897d3[_0x7a86('0x16')]]);}logger['debug'](_0x7a86('0x31'),_0x5897d3[_0x7a86('0x16')],util[_0x7a86('0x15')](this['channels'][_0x5897d3['uniqueid']],{'showHidden':![],'depth':null}));this[_0x7a86('0x12')]('voice:outbound','voice_outbound_channel:save',this[_0x7a86('0x22')][_0x5897d3[_0x7a86('0x16')]]);}}}catch(_0x4fa094){logger[_0x7a86('0x29')](_0x7a86('0x32'),_0x5897d3[_0x7a86('0x16')],util[_0x7a86('0x15')](_0x4fa094,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7a86('0x11')][_0x7a86('0x10')]=function(_0x26d352){try{if(this[_0x7a86('0x13')](_0x26d352)){logger[_0x7a86('0x14')](_0x7a86('0x33'),_0x26d352[_0x7a86('0x16')],util[_0x7a86('0x15')](_0x26d352,{'showHidden':![],'depth':null}));this[_0x7a86('0x34')](_0x26d352[_0x7a86('0x16')],_['keys'](_0x26d352['variable'])[0x0],_0x26d352[_0x7a86('0x35')]);if(this['isNotNull'](_0x26d352[_0x7a86('0x36')])&&this['isNotNull'](_0x26d352[_0x7a86('0x36')]['outboundrouteid'])){if(_[_0x7a86('0x37')](this[_0x7a86('0x22')][_0x26d352[_0x7a86('0x16')]])){this[_0x7a86('0x22')][_0x26d352[_0x7a86('0x16')]]={'routeId':_0x26d352[_0x7a86('0x35')],'variables':this[_0x7a86('0xa')][_0x26d352[_0x7a86('0x16')]]};logger[_0x7a86('0x20')](_0x7a86('0x38'),_0x26d352[_0x7a86('0x16')],_0x26d352[_0x7a86('0x36')][_0x7a86('0x39')],_[_0x7a86('0x3a')](_0x26d352[_0x7a86('0x36')])[0x0],_0x26d352[_0x7a86('0x35')]);logger[_0x7a86('0x14')](_0x7a86('0x3b'),_0x26d352[_0x7a86('0x16')],util[_0x7a86('0x15')](this[_0x7a86('0x22')][_0x26d352['uniqueid']],{'showHidden':![],'depth':null}));this[_0x7a86('0x12')](_0x7a86('0x25'),_0x7a86('0x26'),this[_0x7a86('0x22')][_0x26d352[_0x7a86('0x16')]]);}}}}catch(_0x6fd48a){logger['error']('[%s][voiceDialReport][varset]',_0x26d352[_0x7a86('0x16')],util[_0x7a86('0x15')](_0x6fd48a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7a86('0x11')][_0x7a86('0x34')]=function(_0xded560,_0x3b75a1,_0x5c5260){var _0x5319ac=[_0x7a86('0x3c'),_0x7a86('0x3d'),_0x7a86('0x3e'),_0x7a86('0x3f'),'rtpaudioqosloss',_0x7a86('0x40'),_0x7a86('0x41'),_0x7a86('0x42'),'sipcallid',_0x7a86('0x43'),_0x7a86('0x44'),'bridgepvtcallid','membercalls',_0x7a86('0x45'),_0x7a86('0x46'),_0x7a86('0x47'),_0x7a86('0x23'),_0x7a86('0x48'),_0x7a86('0x49')];if(!_['isNil'](_0x3b75a1)&&!_['includes'](_0x5319ac,_0x3b75a1)){if(_[_0x7a86('0x37')](this[_0x7a86('0xa')][_0xded560])){this[_0x7a86('0xa')][_0xded560]={};}this['variables'][_0xded560][_0x3b75a1]=_0x5c5260;}};VoiceDialReport['prototype'][_0x7a86('0x4a')]=function(_0x16ddd6){try{if(this[_0x7a86('0x13')](_0x16ddd6)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x16ddd6[_0x7a86('0x16')],util[_0x7a86('0x15')](_0x16ddd6,{'showHidden':![],'depth':null}));if(this['channels'][_0x16ddd6[_0x7a86('0x16')]]){logger[_0x7a86('0x20')](_0x7a86('0x4b'),_0x16ddd6[_0x7a86('0x16')],_0x16ddd6[_0x7a86('0x4c')]);this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]][_0x7a86('0x4d')]=moment()[_0x7a86('0x18')](_0x7a86('0x19'));this['channels'][_0x16ddd6[_0x7a86('0x16')]][_0x7a86('0x4e')]=moment(this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]][_0x7a86('0x4d')])[_0x7a86('0x4f')](this['channels'][_0x16ddd6[_0x7a86('0x16')]]['starttime'],_0x7a86('0x50'));this['channels'][_0x16ddd6['uniqueid']][_0x7a86('0x51')]=_0x7a86('0x52');this[_0x7a86('0x9')][_0x7a86('0x53')]+=0x1;if(this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]][_0x7a86('0x54')]){this[_0x7a86('0x9')][_0x7a86('0x55')]+=0x1;this[_0x7a86('0x22')][_0x16ddd6['uniqueid']][_0x7a86('0x56')]=moment(this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]][_0x7a86('0x54')])[_0x7a86('0x4f')](this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]][_0x7a86('0x57')],'seconds');this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]][_0x7a86('0x58')]=moment(this['channels'][_0x16ddd6[_0x7a86('0x16')]][_0x7a86('0x4d')])[_0x7a86('0x4f')](this['channels'][_0x16ddd6[_0x7a86('0x16')]]['answertime'],_0x7a86('0x50'));this[_0x7a86('0x9')][_0x7a86('0x59')]+=this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]][_0x7a86('0x56')]||0x0;this[_0x7a86('0x9')][_0x7a86('0x5a')]+=this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]][_0x7a86('0x58')];}this[_0x7a86('0x9')][_0x7a86('0x5b')]+=this[_0x7a86('0x22')][_0x16ddd6['uniqueid']]['duration'];logger['debug'](_0x7a86('0x5c'),_0x16ddd6[_0x7a86('0x16')],util[_0x7a86('0x15')](this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]],{'showHidden':![],'depth':null}));ami[_0x7a86('0x12')](_0x7a86('0x5d'),this[_0x7a86('0x22')][_0x16ddd6['uniqueid']]);logger[_0x7a86('0x14')](_0x7a86('0x5e'),_0x16ddd6[_0x7a86('0x16')],util['inspect'](this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]],{'showHidden':![],'depth':null}));ami[_0x7a86('0x12')]('custom:dialend',this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]]);logger[_0x7a86('0x14')](_0x7a86('0x5f'),_0x16ddd6[_0x7a86('0x16')],util[_0x7a86('0x15')](this['channels'][_0x16ddd6[_0x7a86('0x16')]],{'showHidden':![],'depth':null}));this[_0x7a86('0x12')](_0x7a86('0x25'),_0x7a86('0x60'),this[_0x7a86('0x9')]);logger[_0x7a86('0x20')](_0x7a86('0x61'),JSON[_0x7a86('0x62')](this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]]));logger[_0x7a86('0x14')](_0x7a86('0x63'),_0x16ddd6['uniqueid'],util[_0x7a86('0x15')](this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]],{'showHidden':![],'depth':null}));this['emit'](_0x7a86('0x25'),_0x7a86('0x64'),this['channels'][_0x16ddd6[_0x7a86('0x16')]]);delete this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x16')]];}else if(this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x65')]]){this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x65')]][_0x7a86('0x16')]=this[_0x7a86('0x22')][_0x16ddd6[_0x7a86('0x65')]]['destuniqueid'];}if(this[_0x7a86('0xa')][_0x16ddd6[_0x7a86('0x16')]]){delete this[_0x7a86('0xa')][_0x16ddd6['uniqueid']];}}}catch(_0x2f2866){logger[_0x7a86('0x29')]('[%s][voiceDialReport][hangup]',_0x16ddd6['uniqueid'],util[_0x7a86('0x15')](_0x2f2866,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xa6c9=['[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','util','ioredis','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','value','variable','outboundrouteid','isUndefined','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','holdtime','sumBillable','billableseconds','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice_outbound:save'];(function(_0x3f8d65,_0x10e95c){var _0x29031d=function(_0x4edad5){while(--_0x4edad5){_0x3f8d65['push'](_0x3f8d65['shift']());}};_0x29031d(++_0x10e95c);}(_0xa6c9,0x1b0));var _0x9a6c=function(_0x222502,_0x57f0b4){_0x222502=_0x222502-0x0;var _0x6bbafd=_0xa6c9[_0x222502];return _0x6bbafd;};'use strict';var _=require(_0x9a6c('0x0'));var moment=require('moment');var util=require(_0x9a6c('0x1'));var Redis=require(_0x9a6c('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require(_0x9a6c('0x3'));config[_0x9a6c('0x4')]=_[_0x9a6c('0x5')](config[_0x9a6c('0x4')],{'host':_0x9a6c('0x6'),'port':0x18eb});var io=require(_0x9a6c('0x7'))(new Redis(config[_0x9a6c('0x4')]));function VoiceDialReport(_0x4e68d3){this[_0x9a6c('0x8')]=_0x4e68d3[_0x9a6c('0x9')];this[_0x9a6c('0xa')]=_0x4e68d3['outbound'];this[_0x9a6c('0xb')]={};ami['on'](_0x9a6c('0xc'),this[_0x9a6c('0xd')][_0x9a6c('0xe')](this));ami['on'](_0x9a6c('0xf'),this[_0x9a6c('0x10')][_0x9a6c('0xe')](this));ami['on'](_0x9a6c('0x11'),this[_0x9a6c('0x12')][_0x9a6c('0xe')](this));ami['on'](_0x9a6c('0x13'),this[_0x9a6c('0x14')][_0x9a6c('0xe')](this));}VoiceDialReport[_0x9a6c('0x15')][_0x9a6c('0x16')]=function(_0x2dbafc){return _0x2dbafc!==null&&!_['isUndefined'](_0x2dbafc);};VoiceDialReport[_0x9a6c('0x15')][_0x9a6c('0x17')]=function(_0x4ff88b,_0x4e6434,_0x4886ee){io['to'](_0x4ff88b)[_0x9a6c('0x17')](_0x4e6434,_0x4886ee);};VoiceDialReport[_0x9a6c('0x15')]['syncDialBegin']=function(_0x4079b3){try{if(this[_0x9a6c('0x16')](_0x4079b3)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x4079b3[_0x9a6c('0x18')],util['inspect'](_0x4079b3,{'showHidden':![],'depth':null}));if(this[_0x9a6c('0x8')][_0x4079b3['uniqueid']]){_[_0x9a6c('0x19')](this[_0x9a6c('0x8')][_0x4079b3[_0x9a6c('0x18')]],{'starttime':moment()[_0x9a6c('0x1a')](_0x9a6c('0x1b')),'lastevent':'called','interface':_0x4079b3['channel']['substring'](0x0,_0x4079b3[_0x9a6c('0x1c')][_0x9a6c('0x1d')]('-')),'membername':_0x4079b3[_0x9a6c('0x1c')][_0x9a6c('0x1e')](_0x4079b3[_0x9a6c('0x1c')][_0x9a6c('0x1d')]('/')+0x1,_0x4079b3['channel'][_0x9a6c('0x1d')]('-'))},_[_0x9a6c('0x1f')](_0x4079b3,[_0x9a6c('0x20'),'privilege']));logger[_0x9a6c('0x21')](_0x9a6c('0x22'),_0x4079b3['uniqueid'],this['channels'][_0x4079b3['uniqueid']]['membername'],this['channels'][_0x4079b3[_0x9a6c('0x18')]][_0x9a6c('0x23')]);logger[_0x9a6c('0x24')](_0x9a6c('0x25'),_0x4079b3[_0x9a6c('0x18')],util[_0x9a6c('0x26')](this[_0x9a6c('0x8')][_0x4079b3[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));this['emit'](_0x9a6c('0x27'),_0x9a6c('0x28'),this['channels'][_0x4079b3[_0x9a6c('0x18')]]);logger[_0x9a6c('0x24')](_0x9a6c('0x29'),_0x4079b3['uniqueid'],util[_0x9a6c('0x26')](this[_0x9a6c('0x8')][_0x4079b3[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));ami[_0x9a6c('0x17')](_0x9a6c('0x2a'),this[_0x9a6c('0x8')][_0x4079b3[_0x9a6c('0x18')]]);}}}catch(_0x3ee54d){logger[_0x9a6c('0x2b')](_0x9a6c('0x2c'),_0x4079b3[_0x9a6c('0x18')],util[_0x9a6c('0x26')](_0x3ee54d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9a6c('0x15')]['syncDialEnd']=function(_0x2cc9ed){try{if(this[_0x9a6c('0x16')](_0x2cc9ed)){logger[_0x9a6c('0x24')](_0x9a6c('0x2d'),_0x2cc9ed[_0x9a6c('0x18')],util[_0x9a6c('0x26')](_0x2cc9ed,{'showHidden':![],'depth':null}));if(this['channels'][_0x2cc9ed['uniqueid']]){this[_0x9a6c('0x8')][_0x2cc9ed[_0x9a6c('0x18')]][_0x9a6c('0x2e')]=_0x2cc9ed[_0x9a6c('0x2e')];if(_0x2cc9ed['dialstatus']===_0x9a6c('0x2f')){this[_0x9a6c('0x8')][_0x2cc9ed[_0x9a6c('0x18')]]['connectedlinenum']=_0x2cc9ed['connectedlinenum'];this[_0x9a6c('0x8')][_0x2cc9ed[_0x9a6c('0x18')]]['connectedlinename']=_0x2cc9ed['connectedlinename'];this['channels'][_0x2cc9ed[_0x9a6c('0x18')]][_0x9a6c('0x30')]=moment()[_0x9a6c('0x1a')](_0x9a6c('0x1b'));this['channels'][_0x2cc9ed[_0x9a6c('0x18')]][_0x9a6c('0x31')]=_0x9a6c('0x32');logger[_0x9a6c('0x21')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x2cc9ed['uniqueid'],_0x2cc9ed[_0x9a6c('0x1c')]['substring'](_0x2cc9ed[_0x9a6c('0x1c')][_0x9a6c('0x1d')]('/')+0x1,_0x2cc9ed[_0x9a6c('0x1c')][_0x9a6c('0x1d')]('-')));logger[_0x9a6c('0x24')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x2cc9ed['uniqueid'],util[_0x9a6c('0x26')](this[_0x9a6c('0x8')][_0x2cc9ed[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialconnect',this[_0x9a6c('0x8')][_0x2cc9ed[_0x9a6c('0x18')]]);}logger[_0x9a6c('0x24')](_0x9a6c('0x33'),_0x2cc9ed['uniqueid'],util[_0x9a6c('0x26')](this['channels'][_0x2cc9ed[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));this[_0x9a6c('0x17')](_0x9a6c('0x27'),_0x9a6c('0x28'),this[_0x9a6c('0x8')][_0x2cc9ed[_0x9a6c('0x18')]]);}}}catch(_0x345557){logger['error'](_0x9a6c('0x34'),_0x2cc9ed[_0x9a6c('0x18')],util[_0x9a6c('0x26')](_0x345557,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9a6c('0x15')][_0x9a6c('0x12')]=function(_0x425894){try{if(this['isNotNull'](_0x425894)){logger['debug'](_0x9a6c('0x35'),_0x425894['uniqueid'],util[_0x9a6c('0x26')](_0x425894,{'showHidden':![],'depth':null}));this['addVariable'](_0x425894[_0x9a6c('0x18')],_['keys'](_0x425894['variable'])[0x0],_0x425894[_0x9a6c('0x36')]);if(this[_0x9a6c('0x16')](_0x425894[_0x9a6c('0x37')])&&this[_0x9a6c('0x16')](_0x425894[_0x9a6c('0x37')][_0x9a6c('0x38')])){if(_[_0x9a6c('0x39')](this[_0x9a6c('0x8')][_0x425894['uniqueid']])){this[_0x9a6c('0x8')][_0x425894[_0x9a6c('0x18')]]={'routeId':_0x425894[_0x9a6c('0x36')],'variables':this[_0x9a6c('0xb')][_0x425894['uniqueid']]};logger['info'](_0x9a6c('0x3a'),_0x425894[_0x9a6c('0x18')],_0x425894[_0x9a6c('0x37')][_0x9a6c('0x38')],_['keys'](_0x425894[_0x9a6c('0x37')])[0x0],_0x425894[_0x9a6c('0x36')]);logger[_0x9a6c('0x24')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x425894[_0x9a6c('0x18')],util[_0x9a6c('0x26')](this['channels'][_0x425894[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));this[_0x9a6c('0x17')](_0x9a6c('0x27'),_0x9a6c('0x28'),this['channels'][_0x425894[_0x9a6c('0x18')]]);}}}}catch(_0x168c41){logger[_0x9a6c('0x2b')](_0x9a6c('0x3b'),_0x425894[_0x9a6c('0x18')],util[_0x9a6c('0x26')](_0x168c41,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9a6c('0x15')][_0x9a6c('0x3c')]=function(_0x363b7a,_0x398976,_0x4a9adf){var _0x2770c5=[_0x9a6c('0x3d'),_0x9a6c('0x3e'),_0x9a6c('0x3f'),_0x9a6c('0x40'),_0x9a6c('0x41'),_0x9a6c('0x42'),_0x9a6c('0x43'),_0x9a6c('0x44'),_0x9a6c('0x45'),_0x9a6c('0x46'),_0x9a6c('0x47'),_0x9a6c('0x48'),_0x9a6c('0x49'),_0x9a6c('0x4a'),_0x9a6c('0x4b'),_0x9a6c('0x4c'),_0x9a6c('0x4d'),'memberpenalty',_0x9a6c('0x4e')];if(!_[_0x9a6c('0x4f')](_0x398976)&&!_[_0x9a6c('0x50')](_0x2770c5,_0x398976)){if(_['isUndefined'](this[_0x9a6c('0xb')][_0x363b7a])){this[_0x9a6c('0xb')][_0x363b7a]={};}this[_0x9a6c('0xb')][_0x363b7a][_0x398976]=_0x4a9adf;}};VoiceDialReport[_0x9a6c('0x15')][_0x9a6c('0x14')]=function(_0x110a11){try{if(this[_0x9a6c('0x16')](_0x110a11)){logger[_0x9a6c('0x24')](_0x9a6c('0x51'),_0x110a11[_0x9a6c('0x18')],util[_0x9a6c('0x26')](_0x110a11,{'showHidden':![],'depth':null}));if(this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]]){logger[_0x9a6c('0x21')](_0x9a6c('0x52'),_0x110a11[_0x9a6c('0x18')],_0x110a11[_0x9a6c('0x53')]);this[_0x9a6c('0x8')][_0x110a11['uniqueid']][_0x9a6c('0x54')]=moment()[_0x9a6c('0x1a')](_0x9a6c('0x1b'));this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x55')]=moment(this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]]['endtime'])[_0x9a6c('0x56')](this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x57')],_0x9a6c('0x58'));this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x31')]=_0x9a6c('0x59');this[_0x9a6c('0xa')][_0x9a6c('0x5a')]+=0x1;if(this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x30')]){this['outbound']['answered']+=0x1;this['channels'][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x5b')]=moment(this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x30')])[_0x9a6c('0x56')](this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x57')],_0x9a6c('0x58'));this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]]['billableseconds']=moment(this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]]['endtime'])[_0x9a6c('0x56')](this['channels'][_0x110a11['uniqueid']][_0x9a6c('0x30')],_0x9a6c('0x58'));this['outbound']['sumHoldTime']+=this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x5b')]||0x0;this['outbound'][_0x9a6c('0x5c')]+=this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x5d')];}this[_0x9a6c('0xa')]['sumDuration']+=this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x55')];logger[_0x9a6c('0x24')](_0x9a6c('0x5e'),_0x110a11[_0x9a6c('0x18')],util[_0x9a6c('0x26')](this['channels'][_0x110a11['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x9a6c('0x17')](_0x9a6c('0x5f'),this['channels'][_0x110a11['uniqueid']]);logger[_0x9a6c('0x24')](_0x9a6c('0x60'),_0x110a11[_0x9a6c('0x18')],util[_0x9a6c('0x26')](this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));ami[_0x9a6c('0x17')]('custom:dialend',this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]]);logger[_0x9a6c('0x24')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x110a11[_0x9a6c('0x18')],util[_0x9a6c('0x26')](this['channels'][_0x110a11['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x9a6c('0x27'),_0x9a6c('0x61'),this[_0x9a6c('0xa')]);logger[_0x9a6c('0x21')](_0x9a6c('0x62'),JSON[_0x9a6c('0x63')](this[_0x9a6c('0x8')][_0x110a11['uniqueid']]));logger['debug'](_0x9a6c('0x64'),_0x110a11[_0x9a6c('0x18')],util[_0x9a6c('0x26')](this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));this['emit'](_0x9a6c('0x27'),_0x9a6c('0x65'),this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]]);delete this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]];}else if(this['channels'][_0x110a11[_0x9a6c('0x66')]]){this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x66')]]['uniqueid']=this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x66')]][_0x9a6c('0x67')];}if(this[_0x9a6c('0xb')][_0x110a11[_0x9a6c('0x18')]]){delete this[_0x9a6c('0xb')][_0x110a11[_0x9a6c('0x18')]];}}}catch(_0x36a15a){logger[_0x9a6c('0x2b')](_0x9a6c('0x68'),_0x110a11[_0x9a6c('0x18')],util[_0x9a6c('0x26')](_0x36a15a,{'showHidden':![],'depth':null}));}};module[_0x9a6c('0x69')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 9a46b26..b309da6 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 _0x4ded=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','diff','seconds','sumDuration','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','transferuniqueid','ATTENDED','secondtransfereruniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','ATTENDEDTRANSFER','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][musiconholdstop]','exports','lodash','moment','util','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','queueStatusComplete','unlockRR','channels','isNil','status','catch','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','name','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','voice_queue_presence:remove','type','strategy','available','loggedIn','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','[voiceQueueReport][queues]','loopQueueSummary','Action','then','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','callers','waiting','toNumber','loggedin','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','[%s][voiceQueueReport][queuecallerjoin]','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','lastAssignedTo','emitVoiceQueueChannelRemove','[%s][voiceQueueReport][queuecallerabandon]','syncQueueCallerLeave','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','syncAgentConnect','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','toLowerCase','linkedid','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','value','variable','queuestatus','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','varset','queueposition','EXITWITHKEY'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x4ded,0x116));var _0xd4de=function(_0x4e98c0,_0x974eff){_0x4e98c0=_0x4e98c0-0x0;var _0x204481=_0x4ded[_0x4e98c0];return _0x204481;};'use strict';var _=require(_0xd4de('0x0'));var moment=require(_0xd4de('0x1'));var util=require(_0xd4de('0x2'));var md5=require(_0xd4de('0x3'));var Redis=require(_0xd4de('0x4'));var config=require(_0xd4de('0x5'));var logger=require(_0xd4de('0x6'))(_0xd4de('0x7'));var ami=require(_0xd4de('0x8'));var QueueReport=require(_0xd4de('0x9'));config[_0xd4de('0xa')]=_[_0xd4de('0xb')](config['redis'],{'host':_0xd4de('0xc'),'port':0x18eb});var io=require(_0xd4de('0xd'))(new Redis(config[_0xd4de('0xa')]));var Sequence=function(){};Sequence[_0xd4de('0xe')][_0xd4de('0xf')]=function(_0x1e8c35){this['tail']=this[_0xd4de('0x10')]?this['tail']['finally'](_0x1e8c35):_0x1e8c35();};function VoiceQueueReport(_0x4b0876){this[_0xd4de('0x11')]=new Sequence();this[_0xd4de('0x12')]={};this['agents']=_0x4b0876['agents'];this['channels']=_0x4b0876[_0xd4de('0x13')];this['voiceQueues']=_0x4b0876[_0xd4de('0x14')];this[_0xd4de('0x15')]=!![];this[_0xd4de('0x16')]=_0x4b0876[_0xd4de('0x16')];this[_0xd4de('0x17')]={};ami['on'](_0xd4de('0x18'),this[_0xd4de('0x19')][_0xd4de('0x1a')](this));ami['on'](_0xd4de('0x1b'),this[_0xd4de('0x1c')][_0xd4de('0x1a')](this));ami['on'](_0xd4de('0x1d'),this[_0xd4de('0x1e')][_0xd4de('0x1a')](this));ami['on'](_0xd4de('0x1f'),this[_0xd4de('0x20')][_0xd4de('0x1a')](this));ami['on']('queuecallerleave',this['syncQueueCallerLeave'][_0xd4de('0x1a')](this));ami['on'](_0xd4de('0x21'),this[_0xd4de('0x22')][_0xd4de('0x1a')](this));ami['on']('agentconnect',this['syncAgentConnect'][_0xd4de('0x1a')](this));ami['on']('varset',this[_0xd4de('0x23')][_0xd4de('0x1a')](this));ami['on']('hangup',this[_0xd4de('0x24')]['bind'](this));ami['on'](_0xd4de('0x25'),this[_0xd4de('0x26')][_0xd4de('0x1a')](this));ami['on'](_0xd4de('0x27'),this['syncMusicOnHoldStart'][_0xd4de('0x1a')](this));ami['on'](_0xd4de('0x28'),this[_0xd4de('0x29')][_0xd4de('0x1a')](this));ami['on'](_0xd4de('0x2a'),this[_0xd4de('0x2b')][_0xd4de('0x1a')](this));ami['on'](_0xd4de('0x2c'),this[_0xd4de('0x2d')][_0xd4de('0x1a')](this));this['loopQueueSummary']();this[_0xd4de('0x2e')]();}function clearChannels(_0x88a0b9){if(!_[_0xd4de('0x2f')](_0x88a0b9)){for(var _0x22970c in _0x88a0b9){if(_0x88a0b9[_0xd4de('0x30')](_0x22970c)){delete _0x88a0b9[_0x22970c];}}}}function clearCampaigns(_0x984904){if(!_[_0xd4de('0x2f')](_0x984904)){for(var _0x36308c in _0x984904){if(_0x984904[_0xd4de('0x30')](_0x36308c)){_0x984904[_0x36308c][_0xd4de('0x31')]=0x0;}}}}function clearVoiceQueues(_0x2ea712){if(!_[_0xd4de('0x2f')](_0x2ea712)){for(var _0x586126 in _0x2ea712){if(_0x2ea712[_0xd4de('0x30')](_0x586126)){_0x2ea712[_0x586126][_0xd4de('0x31')]=0x0;_0x2ea712[_0x586126]['talking']=0x0;_0x2ea712[_0x586126][_0xd4de('0x32')]=0x0;_0x2ea712[_0x586126]['waiting']=0x0;_0x2ea712[_0x586126][_0xd4de('0x33')]=!![];}}}}function clearAgentBooked(_0x32e407){if(!_[_0xd4de('0x2f')](_0x32e407)){for(var _0x4fa53a in _0x32e407){if(_0x32e407[_0xd4de('0x30')](_0x4fa53a)){_0x32e407[_0x4fa53a][_0xd4de('0x34')]=!![];}}}}VoiceQueueReport[_0xd4de('0xe')]['clearZombieChannels']=function(){var _0x3615b8=this;for(var _0x1804c7 in this['channels']){if(this['channels']['hasOwnProperty'](_0x1804c7)&&!this[_0xd4de('0x35')][_0x1804c7]['switch']){this[_0xd4de('0x11')][_0xd4de('0xf')](function(){if(!_[_0xd4de('0x36')](_0x3615b8[_0xd4de('0x35')][_0x1804c7])){return ami['Action']({'action':_0xd4de('0x37'),'channel':_0x3615b8[_0xd4de('0x35')][_0x1804c7]['channel']})[_0xd4de('0x38')](function(_0x1d86fc){if(_0x1d86fc['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x3615b8[_0xd4de('0x35')][_0x1804c7]){delete _0x3615b8[_0xd4de('0x35')][_0x1804c7];logger[_0xd4de('0x39')](_0xd4de('0x3a'),_0x1804c7,util['inspect'](_0x1d86fc,{'showHidden':![],'depth':null}));}if(_0x3615b8[_0xd4de('0x12')][_0x1804c7]){delete _0x3615b8[_0xd4de('0x12')][_0x1804c7];logger['error'](_0xd4de('0x3b'),_0x1804c7,util[_0xd4de('0x3c')](_0x1d86fc,{'showHidden':![],'depth':null}));}if(_0x3615b8[_0xd4de('0x17')][_0x1804c7]){delete _0x3615b8[_0xd4de('0x17')][_0x1804c7];logger[_0xd4de('0x39')](_0xd4de('0x3d'),_0x1804c7,util['inspect'](_0x1d86fc,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xd4de('0x26')]=function(){logger[_0xd4de('0x39')](_0xd4de('0x3e'));clearChannels(this['channels']);this[_0xd4de('0x3f')](this[_0xd4de('0x12')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0xd4de('0x14')]);clearCampaigns(this[_0xd4de('0x16')]);};VoiceQueueReport[_0xd4de('0xe')][_0xd4de('0x3f')]=function(_0x4c5898){var _0x53d7dc=this;if(!_[_0xd4de('0x2f')](_0x4c5898)){for(var _0x541777 in _0x4c5898){if(_0x4c5898[_0xd4de('0x30')](_0x541777)){_0x53d7dc['emitVoiceQueueChannelRemove'](_0x4c5898[_0x541777],_0xd4de('0x40'));delete _0x4c5898[_0x541777];}}}};VoiceQueueReport[_0xd4de('0xe')][_0xd4de('0x41')]=function(_0x1e1937,_0x4e6843,_0x21209d){io['to'](_0x1e1937)['emit'](_0x4e6843,_0x21209d);};VoiceQueueReport[_0xd4de('0xe')][_0xd4de('0x42')]=function(_0x7f17b9,_0x4517a6){logger[_0xd4de('0x43')](_0xd4de('0x44')+_0x4517a6+_0xd4de('0x45'),_0x7f17b9['uniqueid'],util[_0xd4de('0x3c')](_0x7f17b9,{'showHidden':![],'depth':null}));this[_0xd4de('0x41')](util[_0xd4de('0x46')](_0xd4de('0x47'),_0x7f17b9[_0xd4de('0x48')]),'voice_queue_channel:save',_0x7f17b9);io[_0xd4de('0x41')](_0xd4de('0x49'),_0x7f17b9);};VoiceQueueReport[_0xd4de('0xe')]['emitVoiceQueueChannelRemove']=function(_0x3eaa14,_0x1f2ff4){logger[_0xd4de('0x43')]('[%s][voiceQueueReport]['+_0x1f2ff4+_0xd4de('0x4a'),_0x3eaa14[_0xd4de('0x4b')],util[_0xd4de('0x3c')](_0x3eaa14,{'showHidden':![],'depth':null}));this[_0xd4de('0x41')](util[_0xd4de('0x46')](_0xd4de('0x47'),_0x3eaa14[_0xd4de('0x48')]),'voice_queue_channel:remove',_0x3eaa14);io[_0xd4de('0x41')](_0xd4de('0x4c'),_0x3eaa14);};VoiceQueueReport[_0xd4de('0xe')]['emitVoiceQueueSummary']=function(_0x307edd,_0xa0f7a5){if(_0x307edd[_0xd4de('0x4d')]==='inbound'){var _0x5c704a={'id':_0x307edd['id'],'name':_0x307edd[_0xd4de('0x48')],'strategy':_0x307edd[_0xd4de('0x4e')],'answered':_0x307edd['answered'],'available':_0x307edd[_0xd4de('0x4f')],'loggedIn':_0x307edd[_0xd4de('0x50')],'pTalking':_0x307edd[_0xd4de('0x32')],'sumBillable':_0x307edd[_0xd4de('0x51')],'sumDuration':_0x307edd['sumDuration'],'sumHoldTime':_0x307edd[_0xd4de('0x52')]||0x0,'talking':_0x307edd[_0xd4de('0x53')],'total':_0x307edd[_0xd4de('0x54')],'type':_0x307edd[_0xd4de('0x4d')],'unmanaged':_0x307edd[_0xd4de('0x55')],'abandoned':_0x307edd[_0xd4de('0x56')],'waiting':_0x307edd['waiting']};if(_0x307edd[_0xd4de('0x57')]){_0x5c704a[_0xd4de('0x57')]={'id':_0x307edd[_0xd4de('0x57')]['id'],'name':_0x307edd[_0xd4de('0x57')][_0xd4de('0x48')],'active':_0x307edd[_0xd4de('0x57')][_0xd4de('0x58')],'callerid':_0x307edd[_0xd4de('0x57')][_0xd4de('0x59')]};}if(_0x307edd[_0xd4de('0x5a')]){_0x5c704a['Interval']={'id':_0x307edd[_0xd4de('0x5a')]['id'],'name':_0x307edd[_0xd4de('0x5a')][_0xd4de('0x48')]};}var _0x518bfe=md5(JSON[_0xd4de('0x5b')](_0x5c704a));if(_0x307edd[_0xd4de('0x3')]!==_0x518bfe){_0x307edd[_0xd4de('0x3')]=_0x518bfe;logger[_0xd4de('0x43')](_0xd4de('0x5c')+_0xa0f7a5+_0xd4de('0x5d'),util[_0xd4de('0x3c')](_0x5c704a,{'showHidden':![],'depth':null}));this[_0xd4de('0x41')](util[_0xd4de('0x46')](_0xd4de('0x47'),_0x5c704a['name']),_0xd4de('0x5e'),_0x5c704a);}}};VoiceQueueReport[_0xd4de('0xe')][_0xd4de('0x5f')]=function(_0x9bf50d){return _0x9bf50d!==null&&!_[_0xd4de('0x60')](_0x9bf50d);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x2b88bb=this;setInterval(function(){_0x2b88bb[_0xd4de('0x61')]();ami['Action']({'action':'queues'})[_0xd4de('0x38')](function(_0x368081){logger[_0xd4de('0x39')](_0xd4de('0x62'),util[_0xd4de('0x3c')](_0x368081,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xd4de('0xe')][_0xd4de('0x63')]=function(){var _0x4801de=this;setInterval(function(){if(_0x4801de[_0xd4de('0x15')]){return ami[_0xd4de('0x64')]({'action':_0xd4de('0x18')})[_0xd4de('0x65')](function(_0x56c13e){_0x4801de[_0xd4de('0x15')]=![];})[_0xd4de('0x38')](function(_0x45a7b7){logger[_0xd4de('0x39')](_0xd4de('0x66'),util[_0xd4de('0x3c')](_0x45a7b7,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0xd4de('0x19')]=function(_0x5896c5){try{if(this['isNotNull'](_0x5896c5)&&this[_0xd4de('0x5f')](_0x5896c5[_0xd4de('0x67')])){logger[_0xd4de('0x43')](_0xd4de('0x68'),util['inspect'](_0x5896c5,{'showHidden':![],'depth':null}));if(this[_0xd4de('0x14')][_0x5896c5[_0xd4de('0x67')]]){logger[_0xd4de('0x69')](_0xd4de('0x6a'),_0x5896c5[_0xd4de('0x67')]);var _0x4bb7df=_['countBy'](this['channels'],_0xd4de('0x67'))[_0x5896c5[_0xd4de('0x67')]]||0x0;var _0x33933f=_0x4bb7df-_0x5896c5[_0xd4de('0x6b')];if(this['voiceQueues'][_0x5896c5[_0xd4de('0x67')]][_0xd4de('0x6c')]!==_[_0xd4de('0x6d')](_0x5896c5[_0xd4de('0x6b')])||this['voiceQueues'][_0x5896c5[_0xd4de('0x67')]][_0xd4de('0x50')]!==_[_0xd4de('0x6d')](_0x5896c5[_0xd4de('0x6e')])||this['voiceQueues'][_0x5896c5['queue']]['available']!==_[_0xd4de('0x6d')](_0x5896c5[_0xd4de('0x4f')])||this[_0xd4de('0x14')][_0x5896c5['queue']][_0xd4de('0x53')]!==_0x33933f){this[_0xd4de('0x14')][_0x5896c5[_0xd4de('0x67')]]['waiting']=_[_0xd4de('0x6d')](_0x5896c5['callers']);this[_0xd4de('0x14')][_0x5896c5[_0xd4de('0x67')]][_0xd4de('0x50')]=_[_0xd4de('0x6d')](_0x5896c5[_0xd4de('0x6e')]);this[_0xd4de('0x14')][_0x5896c5[_0xd4de('0x67')]][_0xd4de('0x4f')]=_['toNumber'](_0x5896c5[_0xd4de('0x4f')]);this['voiceQueues'][_0x5896c5[_0xd4de('0x67')]][_0xd4de('0x53')]=_0x33933f>0x0?_0x33933f:0x0;this['voiceQueues'][_0x5896c5[_0xd4de('0x67')]][_0xd4de('0x53')]=this[_0xd4de('0x14')][_0x5896c5[_0xd4de('0x67')]][_0xd4de('0x53')]>_[_0xd4de('0x6d')](_0x5896c5[_0xd4de('0x6e')])?_[_0xd4de('0x6d')](_0x5896c5[_0xd4de('0x6e')]):this[_0xd4de('0x14')][_0x5896c5[_0xd4de('0x67')]][_0xd4de('0x53')];this[_0xd4de('0x6f')](this['voiceQueues'][_0x5896c5[_0xd4de('0x67')]],_0xd4de('0x18'));}logger[_0xd4de('0x43')](_0xd4de('0x70'),util[_0xd4de('0x3c')](this[_0xd4de('0x14')][_0x5896c5[_0xd4de('0x67')]],{'showHidden':![],'depth':null}));ami[_0xd4de('0x41')]('custom:queuesummary',this[_0xd4de('0x14')][_0x5896c5['queue']]);}}}catch(_0x59b936){logger['error'](_0xd4de('0x66'),util[_0xd4de('0x3c')](_0x59b936,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x5348bd){logger['debug'](_0xd4de('0x71'),util['inspect'](_0x5348bd,{'showHidden':![],'depth':null}));this[_0xd4de('0x15')]=!![];};VoiceQueueReport['prototype'][_0xd4de('0x1e')]=function(_0x223b1a){try{if(this['isNotNull'](_0x223b1a)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x223b1a['uniqueid'],util[_0xd4de('0x3c')](_0x223b1a,{'showHidden':![],'depth':null}));if(_[_0xd4de('0x60')](this[_0xd4de('0x12')][_0x223b1a[_0xd4de('0x4b')]])){this[_0xd4de('0x12')][_0x223b1a[_0xd4de('0x4b')]]=[];this['channels'][_0x223b1a['uniqueid']]={};}var _0x53cbd9=new QueueReport();_0x53cbd9[_0xd4de('0x48')]=_0x223b1a[_0xd4de('0x67')];_0x53cbd9['type']=this[_0xd4de('0x14')][_0x53cbd9['name']]&&this[_0xd4de('0x14')][_0x53cbd9['name']][_0xd4de('0x4d')]?this[_0xd4de('0x14')][_0x53cbd9['name']][_0xd4de('0x4d')]||'inbound':_0xd4de('0x72');_0x53cbd9[_0xd4de('0x67')]=_0x223b1a[_0xd4de('0x67')];_0x53cbd9[_0xd4de('0x73')]=moment()['format'](_0xd4de('0x74'));_0x53cbd9[_0xd4de('0x75')]=_0x223b1a[_0xd4de('0x75')];_0x53cbd9[_0xd4de('0x76')]=_0x223b1a[_0xd4de('0x76')];_0x53cbd9[_0xd4de('0x4b')]=_0x223b1a[_0xd4de('0x4b')];logger[_0xd4de('0x69')](_0xd4de('0x77'),_0x53cbd9[_0xd4de('0x48')],_0x53cbd9[_0xd4de('0x4d')]);_[_0xd4de('0x78')](_0x53cbd9,_[_0xd4de('0x79')](_0x223b1a,_['keys'](_0x53cbd9)));this[_0xd4de('0x12')][_0x223b1a['uniqueid']]['push'](_0x53cbd9);this[_0xd4de('0x35')][_0x223b1a[_0xd4de('0x4b')]]=_0x53cbd9;this['emitVoiceQueueChannelSave'](_0x53cbd9,_0xd4de('0x1d'));}}catch(_0x249012){logger[_0xd4de('0x39')](_0xd4de('0x7a'),_0x223b1a['uniqueid'],util[_0xd4de('0x3c')](_0x249012,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd4de('0xe')][_0xd4de('0x20')]=function(_0x2e81df){try{if(this[_0xd4de('0x5f')](_0x2e81df)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x2e81df['uniqueid'],util['inspect'](_0x2e81df,{'showHidden':![],'depth':null}));if(this[_0xd4de('0x12')][_0x2e81df['uniqueid']]){var _0x302c7d=_['last'](this[_0xd4de('0x12')][_0x2e81df[_0xd4de('0x4b')]]);_0x302c7d[_0xd4de('0x7b')]=![];_0x302c7d[_0xd4de('0x7c')]=null;_0x302c7d[_0xd4de('0x7d')]=_0x2e81df[_0xd4de('0x7d')];_0x302c7d[_0xd4de('0x7e')]=_0x2e81df[_0xd4de('0x7e')];_0x302c7d['queuecallerabandon']=!![];_0x302c7d[_0xd4de('0x7f')]=moment()[_0xd4de('0x46')](_0xd4de('0x74'));_0x302c7d[_0xd4de('0x80')]='ABANDONED';_0x302c7d[_0xd4de('0x81')]=null;logger[_0xd4de('0x69')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x302c7d[_0xd4de('0x48')],_0x302c7d[_0xd4de('0x4d')]);this[_0xd4de('0x35')][_0x2e81df[_0xd4de('0x4b')]]=_0x302c7d;this[_0xd4de('0x82')](_0x302c7d,_0xd4de('0x1f'));}}}catch(_0x8314b5){logger[_0xd4de('0x39')](_0xd4de('0x83'),_0x2e81df[_0xd4de('0x4b')],util[_0xd4de('0x3c')](_0x8314b5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd4de('0x84')]=function(_0x5c2d1c){try{if(this[_0xd4de('0x5f')](_0x5c2d1c)){logger[_0xd4de('0x43')](_0xd4de('0x85'),_0x5c2d1c['uniqueid'],util[_0xd4de('0x3c')](_0x5c2d1c,{'showHidden':![],'depth':null}));if(this[_0xd4de('0x12')][_0x5c2d1c['uniqueid']]){var _0xf2b048=_[_0xd4de('0x86')](this[_0xd4de('0x12')][_0x5c2d1c[_0xd4de('0x4b')]]);_0xf2b048[_0xd4de('0x87')]=moment()[_0xd4de('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0xf2b048[_0xd4de('0x88')]=_0x5c2d1c[_0xd4de('0x88')];_0xf2b048['connectedlinename']=_0x5c2d1c[_0xd4de('0x89')];logger[_0xd4de('0x69')](_0xd4de('0x8a'),_0xf2b048[_0xd4de('0x48')],_0xf2b048['type'],_0x5c2d1c['connectedlinenum'],_0x5c2d1c[_0xd4de('0x89')]);this[_0xd4de('0x35')][_0x5c2d1c[_0xd4de('0x4b')]]=_0xf2b048;this[_0xd4de('0x42')](_0xf2b048,'queuecallerleave');}}}catch(_0x11dd1a){logger[_0xd4de('0x39')](_0xd4de('0x85'),_0x5c2d1c[_0xd4de('0x4b')],util['inspect'](_0x11dd1a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd4de('0x8b')]=function(_0x4f7ead){try{if(this[_0xd4de('0x5f')](_0x4f7ead)){logger[_0xd4de('0x43')](_0xd4de('0x8c'),_0x4f7ead[_0xd4de('0x4b')],util['inspect'](_0x4f7ead,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4f7ead[_0xd4de('0x4b')]]){var _0x1a1abd=_['last'](this['queueReports'][_0x4f7ead[_0xd4de('0x4b')]]);_0x1a1abd[_0xd4de('0x7b')]=!![];_0x1a1abd[_0xd4de('0x80')]='COMPLETEDBYAGENT';logger[_0xd4de('0x69')](_0xd4de('0x8d'),_0x1a1abd['name'],_0x1a1abd[_0xd4de('0x4d')]);}}}catch(_0x5d32bb){logger[_0xd4de('0x39')](_0xd4de('0x8c'),_0x4f7ead['uniqueid'],util[_0xd4de('0x3c')](_0x5d32bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd4de('0xe')][_0xd4de('0x22')]=function(_0x1493bc){try{if(this[_0xd4de('0x5f')](_0x1493bc)){logger[_0xd4de('0x43')]('[%s][voiceQueueReport][agentcomplete]',_0x1493bc[_0xd4de('0x4b')],util[_0xd4de('0x3c')](_0x1493bc,{'showHidden':![],'depth':null}));if(this[_0xd4de('0x12')][_0x1493bc[_0xd4de('0x4b')]]){var _0x7a34e9=_[_0xd4de('0x86')](this['queueReports'][_0x1493bc[_0xd4de('0x4b')]]);_0x7a34e9['queuecallerabandon']=![];_0x7a34e9[_0xd4de('0x7f')]=null;_0x7a34e9[_0xd4de('0x8e')]=!![];_0x7a34e9[_0xd4de('0x81')]=_0x1493bc[_0xd4de('0x8f')];_0x7a34e9[_0xd4de('0x7d')]=_0x1493bc[_0xd4de('0x7d')];_0x7a34e9[_0xd4de('0x7b')]=!![];_0x7a34e9[_0xd4de('0x90')]=![];_0x7a34e9[_0xd4de('0x91')]=null;if(!_0x7a34e9[_0xd4de('0x92')]){if(_0x1493bc[_0xd4de('0x93')]==_0xd4de('0x92')){_0x7a34e9[_0xd4de('0x80')]=_0xd4de('0x94');logger['info'](_0xd4de('0x95'),_0x7a34e9[_0xd4de('0x48')],_0x7a34e9[_0xd4de('0x4d')]);}else{if(_[_0xd4de('0x96')](_0x1493bc[_0xd4de('0x97')][_0xd4de('0x98')](),'local/')){if(this[_0xd4de('0x12')][_0x1493bc[_0xd4de('0x99')]]){var _0x1e5350=_[_0xd4de('0x86')](this['queueReports'][_0x1493bc['linkedid']]);_0x1e5350[_0xd4de('0x7b')]=![];_0x1e5350['queuecallerexit']=!![];_0x1e5350['queuecallerexitAt']=moment(_0x7a34e9['queuecallerjoinAt'])['add'](_0x1493bc['holdtime'],'seconds')['format'](_0xd4de('0x74'));_0x1e5350[_0xd4de('0x80')]=_0xd4de('0x9a');_0x1e5350['transfer']=!![];_0x1e5350[_0xd4de('0x9b')]=_0xd4de('0x9c');_0x1e5350[_0xd4de('0x9d')]=_0x1493bc[_0xd4de('0x9e')];_0x1e5350['transferuniqueid']=_0x1493bc[_0xd4de('0x4b')];logger[_0xd4de('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x1e5350[_0xd4de('0x48')],_0x1e5350[_0xd4de('0x4d')]);var _0x290b69=this[_0xd4de('0x12')][_0x1493bc[_0xd4de('0x99')]];this[_0xd4de('0x12')][_0x1493bc[_0xd4de('0x99')]]=this[_0xd4de('0x12')][_0x1493bc[_0xd4de('0x4b')]];this['queueReports'][_0x1493bc[_0xd4de('0x4b')]]=_0x290b69;}}else{_0x7a34e9[_0xd4de('0x80')]=_0xd4de('0x9f')+_0x1493bc[_0xd4de('0x93')][_0xd4de('0xa0')]();logger[_0xd4de('0x69')](_0xd4de('0xa1'),_0x7a34e9[_0xd4de('0x48')],_0x7a34e9[_0xd4de('0x4d')],_0x7a34e9[_0xd4de('0x80')]);}}}this[_0xd4de('0x35')][_0x1493bc['uniqueid']]=_0x7a34e9;this[_0xd4de('0x82')](_0x7a34e9,'agentcomplete');}}}catch(_0xaadddc){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x1493bc['uniqueid'],util[_0xd4de('0x3c')](_0xaadddc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd4de('0xe')][_0xd4de('0x23')]=function(_0x5e3d62){try{if(this[_0xd4de('0x5f')](_0x5e3d62)){logger[_0xd4de('0x43')](_0xd4de('0xa2'),_0x5e3d62['uniqueid'],util[_0xd4de('0x3c')](_0x5e3d62,{'showHidden':![],'depth':null}));this[_0xd4de('0xa3')](_0x5e3d62[_0xd4de('0x4b')],_['keys'](_0x5e3d62['variable'])[0x0],_0x5e3d62[_0xd4de('0xa4')]);if(this['queueReports'][_0x5e3d62['uniqueid']]){var _0x3241c4=_[_0xd4de('0x86')](this[_0xd4de('0x12')][_0x5e3d62['uniqueid']]);if(_0x3241c4){if(this['isNotNull'](_0x5e3d62[_0xd4de('0xa5')])&&this['isNotNull'](_0x5e3d62['variable'][_0xd4de('0xa6')])){switch(_0x5e3d62[_0xd4de('0xa4')]){case _0xd4de('0xa7'):_0x3241c4[_0xd4de('0x90')]=![];_0x3241c4[_0xd4de('0x91')]=null;break;case _0xd4de('0xa8'):_0x3241c4[_0xd4de('0xa9')]=_0xd4de('0xaa');_0x3241c4[_0xd4de('0x90')]=!![];_0x3241c4['queuecallerexitAt']=moment()[_0xd4de('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x3241c4[_0xd4de('0x87')]=moment()[_0xd4de('0x46')](_0xd4de('0x74'));logger[_0xd4de('0x43')](_0xd4de('0xab'),_0x5e3d62['uniqueid'],util['inspect'](_0x3241c4,{'showHidden':![],'depth':null}));ami['emit'](_0xd4de('0xac'),_0x3241c4);break;default:_0x3241c4['queuecallerexit']=!![];_0x3241c4['queuecallerexitAt']=moment()[_0xd4de('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x3241c4['queuecallerleaveAt']=moment()[_0xd4de('0x46')](_0xd4de('0x74'));}_0x3241c4[_0xd4de('0x1f')]=![];_0x3241c4[_0xd4de('0x7f')]=null;_0x3241c4[_0xd4de('0x80')]=_0x5e3d62[_0xd4de('0xa4')];this['channels'][_0x5e3d62[_0xd4de('0x4b')]]=_0x3241c4;this[_0xd4de('0x82')](_0x3241c4,_0xd4de('0xad'));}else if(this[_0xd4de('0x5f')](_0x5e3d62['variable'])&&this[_0xd4de('0x5f')](_0x5e3d62[_0xd4de('0xa5')][_0xd4de('0xae')])){if(!_0x3241c4['queuecallerabandon']){_0x3241c4['queuecallerexit']=!![];_0x3241c4[_0xd4de('0x91')]=moment()[_0xd4de('0x46')](_0xd4de('0x74'));_0x3241c4[_0xd4de('0x80')]=_0xd4de('0xaf');_0x3241c4['queuecallerleaveAt']=moment()['format'](_0xd4de('0x74'));this['channels'][_0x5e3d62[_0xd4de('0x4b')]]=_0x3241c4;}}logger[_0xd4de('0x69')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x5e3d62['uniqueid'],_0x3241c4[_0xd4de('0x48')],_0x3241c4['type'],_['keys'](_0x5e3d62[_0xd4de('0xa5')])[0x0],_0x5e3d62[_0xd4de('0xa4')]);_0x3241c4[_0xd4de('0x17')]=this['variables'][_0x5e3d62[_0xd4de('0x4b')]];}}}}catch(_0x4f85fc){logger[_0xd4de('0x39')]('[%s][voiceQueueReport][varset]',_0x5e3d62[_0xd4de('0x4b')],util['inspect'](_0x4f85fc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x4bb753,_0x3a25ac,_0x48db80){var _0x4f57b6=[_0xd4de('0xb0'),_0xd4de('0xb1'),_0xd4de('0xb2'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xd4de('0xb3'),_0xd4de('0xb4'),'rtpaudioqosrttbridged',_0xd4de('0xb5'),_0xd4de('0xb6'),_0xd4de('0xb7'),_0xd4de('0xb8'),'membercalls',_0xd4de('0xb9'),_0xd4de('0xba'),_0xd4de('0xbb'),_0xd4de('0x8f'),_0xd4de('0xbc'),_0xd4de('0xbd')];if(!_[_0xd4de('0x36')](_0x3a25ac)&&!_[_0xd4de('0xbe')](_0x4f57b6,_0x3a25ac)){if(_[_0xd4de('0x60')](this[_0xd4de('0x17')][_0x4bb753])){this[_0xd4de('0x17')][_0x4bb753]={};}this[_0xd4de('0x17')][_0x4bb753][_0x3a25ac]=_0x48db80;}};VoiceQueueReport[_0xd4de('0xe')]['syncHangup']=function(_0x16031e){try{if(this[_0xd4de('0x5f')](_0x16031e)){logger[_0xd4de('0x43')](_0xd4de('0xbf'),_0x16031e['uniqueid'],util[_0xd4de('0x3c')](_0x16031e,{'showHidden':![],'depth':null}));if(this[_0xd4de('0x12')][_0x16031e[_0xd4de('0x4b')]]){for(var _0x3ce1ba=0x0,_0x4f8aef={};_0x3ce1ba0x0?_0x4d3930:0x0;this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]][_0x297a('0x31')]=this['voiceQueues'][_0x149b75[_0x297a('0x64')]][_0x297a('0x31')]>_[_0x297a('0x66')](_0x149b75['loggedin'])?_['toNumber'](_0x149b75[_0x297a('0x69')]):this['voiceQueues'][_0x149b75['queue']][_0x297a('0x31')];this[_0x297a('0x6a')](this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]],_0x297a('0x17'));}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x297a('0x3f')](this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]],{'showHidden':![],'depth':null}));ami[_0x297a('0x4a')](_0x297a('0x6b'),this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]]);}}}catch(_0x5aa1f1){logger[_0x297a('0x3d')](_0x297a('0x6c'),util[_0x297a('0x3f')](_0x5aa1f1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x6d')]=function(_0x56af63){logger[_0x297a('0x46')](_0x297a('0x6e'),util[_0x297a('0x3f')](_0x56af63,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x1a')]=function(_0x584c17){try{if(this[_0x297a('0x60')](_0x584c17)){logger[_0x297a('0x46')](_0x297a('0x6f'),_0x584c17[_0x297a('0x47')],util[_0x297a('0x3f')](_0x584c17,{'showHidden':![],'depth':null}));if(_[_0x297a('0x61')](this[_0x297a('0x40')][_0x584c17[_0x297a('0x47')]])){this['queueReports'][_0x584c17[_0x297a('0x47')]]=[];this[_0x297a('0x11')][_0x584c17['uniqueid']]={};}var _0x260cdc=new QueueReport();_0x260cdc['name']=_0x584c17[_0x297a('0x64')];_0x260cdc[_0x297a('0x4f')]=this[_0x297a('0x13')][_0x260cdc[_0x297a('0x49')]]&&this['voiceQueues'][_0x260cdc[_0x297a('0x49')]]['type']?this['voiceQueues'][_0x260cdc[_0x297a('0x49')]]['type']||_0x297a('0x50'):_0x297a('0x50');_0x260cdc['queue']=_0x584c17['queue'];_0x260cdc[_0x297a('0x70')]=moment()[_0x297a('0x5e')](_0x297a('0x71'));_0x260cdc[_0x297a('0x72')]=_0x584c17[_0x297a('0x72')];_0x260cdc[_0x297a('0x73')]=_0x584c17['count'];_0x260cdc[_0x297a('0x47')]=_0x584c17['uniqueid'];logger['info'](_0x297a('0x74'),_0x260cdc[_0x297a('0x49')],_0x260cdc[_0x297a('0x4f')]);_[_0x297a('0x75')](_0x260cdc,_[_0x297a('0x76')](_0x584c17,_[_0x297a('0x77')](_0x260cdc)));this[_0x297a('0x40')][_0x584c17[_0x297a('0x47')]]['push'](_0x260cdc);this[_0x297a('0x11')][_0x584c17[_0x297a('0x47')]]=_0x260cdc;this['emitVoiceQueueChannelSave'](_0x260cdc,'queuecallerjoin');}}catch(_0x5bb15b){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x584c17['uniqueid'],util[_0x297a('0x3f')](_0x5bb15b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x1b')]=function(_0x5ba0d8){try{if(this[_0x297a('0x60')](_0x5ba0d8)){logger[_0x297a('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5ba0d8[_0x297a('0x47')],util['inspect'](_0x5ba0d8,{'showHidden':![],'depth':null}));if(this[_0x297a('0x40')][_0x5ba0d8[_0x297a('0x47')]]){var _0x5915f1=_[_0x297a('0x78')](this[_0x297a('0x40')][_0x5ba0d8['uniqueid']]);_0x5915f1[_0x297a('0x79')]=![];_0x5915f1['queuecallercompleteAt']=null;_0x5915f1['holdtime']=_0x5ba0d8['holdtime'];_0x5915f1[_0x297a('0x7a')]=_0x5ba0d8[_0x297a('0x7a')];_0x5915f1[_0x297a('0x7b')]=!![];_0x5915f1['queuecallerabandonAt']=moment()[_0x297a('0x5e')](_0x297a('0x71'));_0x5915f1[_0x297a('0x7c')]='ABANDONED';_0x5915f1[_0x297a('0x7d')]=null;logger[_0x297a('0x7e')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5915f1['name'],_0x5915f1[_0x297a('0x4f')]);this[_0x297a('0x11')][_0x5ba0d8[_0x297a('0x47')]]=_0x5915f1;this[_0x297a('0x45')](_0x5915f1,'queuecallerabandon');}}}catch(_0x445f52){logger[_0x297a('0x3d')](_0x297a('0x7f'),_0x5ba0d8[_0x297a('0x47')],util[_0x297a('0x3f')](_0x445f52,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')]['syncQueueCallerLeave']=function(_0x3ac2b9){try{if(this[_0x297a('0x60')](_0x3ac2b9)){logger['debug'](_0x297a('0x80'),_0x3ac2b9[_0x297a('0x47')],util[_0x297a('0x3f')](_0x3ac2b9,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3ac2b9[_0x297a('0x47')]]){var _0x1ec354=_[_0x297a('0x78')](this[_0x297a('0x40')][_0x3ac2b9[_0x297a('0x47')]]);_0x1ec354[_0x297a('0x81')]=moment()[_0x297a('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ec354[_0x297a('0x82')]=_0x3ac2b9[_0x297a('0x82')];_0x1ec354['connectedlinename']=_0x3ac2b9[_0x297a('0x83')];logger[_0x297a('0x7e')](_0x297a('0x84'),_0x1ec354[_0x297a('0x49')],_0x1ec354[_0x297a('0x4f')],_0x3ac2b9[_0x297a('0x82')],_0x3ac2b9[_0x297a('0x83')]);this[_0x297a('0x11')][_0x3ac2b9[_0x297a('0x47')]]=_0x1ec354;this['emitVoiceQueueChannelSave'](_0x1ec354,_0x297a('0x85'));}}}catch(_0x1e83ed){logger['error'](_0x297a('0x80'),_0x3ac2b9[_0x297a('0x47')],util[_0x297a('0x3f')](_0x1e83ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')]['syncAgentConnect']=function(_0x5c7c83){try{if(this[_0x297a('0x60')](_0x5c7c83)){logger[_0x297a('0x46')](_0x297a('0x86'),_0x5c7c83['uniqueid'],util['inspect'](_0x5c7c83,{'showHidden':![],'depth':null}));if(this[_0x297a('0x40')][_0x5c7c83[_0x297a('0x47')]]){var _0x4dcbe3=_[_0x297a('0x78')](this[_0x297a('0x40')][_0x5c7c83[_0x297a('0x47')]]);_0x4dcbe3[_0x297a('0x79')]=!![];_0x4dcbe3[_0x297a('0x7c')]=_0x297a('0x87');logger[_0x297a('0x7e')](_0x297a('0x88'),_0x4dcbe3[_0x297a('0x49')],_0x4dcbe3[_0x297a('0x4f')]);}}}catch(_0x44ca94){logger[_0x297a('0x3d')](_0x297a('0x86'),_0x5c7c83[_0x297a('0x47')],util[_0x297a('0x3f')](_0x44ca94,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x297a('0x89')]=function(_0x75cf07){try{if(this['isNotNull'](_0x75cf07)){logger[_0x297a('0x46')](_0x297a('0x8a'),_0x75cf07[_0x297a('0x47')],util[_0x297a('0x3f')](_0x75cf07,{'showHidden':![],'depth':null}));if(this[_0x297a('0x40')][_0x75cf07[_0x297a('0x47')]]){var _0x269901=_[_0x297a('0x78')](this[_0x297a('0x40')][_0x75cf07[_0x297a('0x47')]]);_0x269901[_0x297a('0x7b')]=![];_0x269901[_0x297a('0x8b')]=null;_0x269901['assigned']=!![];_0x269901[_0x297a('0x7d')]=_0x75cf07[_0x297a('0x8c')];_0x269901[_0x297a('0x8d')]=_0x75cf07[_0x297a('0x8d')];_0x269901[_0x297a('0x79')]=!![];_0x269901[_0x297a('0x8e')]=![];_0x269901[_0x297a('0x8f')]=null;if(!_0x269901[_0x297a('0x90')]){if(_0x75cf07[_0x297a('0x91')]==_0x297a('0x90')){_0x269901['queuecallerexitreason']='COMPLETED';logger[_0x297a('0x7e')](_0x297a('0x92'),_0x269901[_0x297a('0x49')],_0x269901[_0x297a('0x4f')]);}else{if(_[_0x297a('0x93')](_0x75cf07['channel'][_0x297a('0x94')](),_0x297a('0x95'))){if(this[_0x297a('0x40')][_0x75cf07[_0x297a('0x96')]]){var _0x1fae6b=_['last'](this['queueReports'][_0x75cf07[_0x297a('0x96')]]);_0x1fae6b[_0x297a('0x79')]=![];_0x1fae6b['queuecallerexit']=!![];_0x1fae6b[_0x297a('0x8f')]=moment(_0x269901[_0x297a('0x70')])[_0x297a('0x97')](_0x75cf07['holdtime'],_0x297a('0x98'))[_0x297a('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1fae6b[_0x297a('0x7c')]=_0x297a('0x99');_0x1fae6b['transfer']=!![];_0x1fae6b[_0x297a('0x9a')]=_0x297a('0x9b');_0x1fae6b['transferexten']=_0x75cf07[_0x297a('0x9c')];_0x1fae6b['transferuniqueid']=_0x75cf07[_0x297a('0x47')];logger[_0x297a('0x7e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x1fae6b[_0x297a('0x49')],_0x1fae6b[_0x297a('0x4f')]);var _0x4dc2d0=this[_0x297a('0x40')][_0x75cf07[_0x297a('0x96')]];this[_0x297a('0x40')][_0x75cf07[_0x297a('0x96')]]=this[_0x297a('0x40')][_0x75cf07['uniqueid']];this[_0x297a('0x40')][_0x75cf07[_0x297a('0x47')]]=_0x4dc2d0;}}else{_0x269901[_0x297a('0x7c')]='COMPLETEDBY'+_0x75cf07[_0x297a('0x91')][_0x297a('0x9d')]();logger['info'](_0x297a('0x9e'),_0x269901['name'],_0x269901[_0x297a('0x4f')],_0x269901[_0x297a('0x7c')]);}}}this[_0x297a('0x11')][_0x75cf07[_0x297a('0x47')]]=_0x269901;this[_0x297a('0x45')](_0x269901,_0x297a('0x1d'));}}}catch(_0x24a40a){logger['error'](_0x297a('0x8a'),_0x75cf07[_0x297a('0x47')],util[_0x297a('0x3f')](_0x24a40a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')]['syncVarSet']=function(_0x2296b0){try{if(this[_0x297a('0x60')](_0x2296b0)){logger[_0x297a('0x46')](_0x297a('0x9f'),_0x2296b0[_0x297a('0x47')],util[_0x297a('0x3f')](_0x2296b0,{'showHidden':![],'depth':null}));this[_0x297a('0xa0')](_0x2296b0[_0x297a('0x47')],_['keys'](_0x2296b0[_0x297a('0xa1')])[0x0],_0x2296b0[_0x297a('0xa2')]);if(this[_0x297a('0x40')][_0x2296b0[_0x297a('0x47')]]){var _0x366e1a=_['last'](this[_0x297a('0x40')][_0x2296b0[_0x297a('0x47')]]);if(_0x366e1a){if(this[_0x297a('0x60')](_0x2296b0[_0x297a('0xa1')])&&this[_0x297a('0x60')](_0x2296b0[_0x297a('0xa1')]['queuestatus'])){switch(_0x2296b0[_0x297a('0xa2')]){case _0x297a('0xa3'):_0x366e1a['queuecallerexit']=![];_0x366e1a[_0x297a('0x8f')]=null;break;case _0x297a('0xa4'):_0x366e1a[_0x297a('0xa5')]=_0x297a('0xa6');_0x366e1a[_0x297a('0x8e')]=!![];_0x366e1a['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x366e1a['queuecallerleaveAt']=moment()[_0x297a('0x5e')](_0x297a('0x71'));logger[_0x297a('0x46')](_0x297a('0xa7'),_0x2296b0[_0x297a('0x47')],util[_0x297a('0x3f')](_0x366e1a,{'showHidden':![],'depth':null}));ami[_0x297a('0x4a')]('custom:timeout',_0x366e1a);break;default:_0x366e1a[_0x297a('0x8e')]=!![];_0x366e1a[_0x297a('0x8f')]=moment()['format'](_0x297a('0x71'));_0x366e1a[_0x297a('0x81')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x366e1a['queuecallerabandon']=![];_0x366e1a['queuecallerabandonAt']=null;_0x366e1a[_0x297a('0x7c')]=_0x2296b0[_0x297a('0xa2')];this['channels'][_0x2296b0[_0x297a('0x47')]]=_0x366e1a;this['emitVoiceQueueChannelRemove'](_0x366e1a,_0x297a('0x20'));}else if(this['isNotNull'](_0x2296b0[_0x297a('0xa1')])&&this[_0x297a('0x60')](_0x2296b0[_0x297a('0xa1')][_0x297a('0xa8')])){if(!_0x366e1a[_0x297a('0x7b')]){_0x366e1a[_0x297a('0x8e')]=!![];_0x366e1a[_0x297a('0x8f')]=moment()[_0x297a('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x366e1a[_0x297a('0x7c')]=_0x297a('0xa9');_0x366e1a[_0x297a('0x81')]=moment()[_0x297a('0x5e')](_0x297a('0x71'));this[_0x297a('0x11')][_0x2296b0[_0x297a('0x47')]]=_0x366e1a;}}logger[_0x297a('0x7e')](_0x297a('0xaa'),_0x2296b0[_0x297a('0x47')],_0x366e1a[_0x297a('0x49')],_0x366e1a[_0x297a('0x4f')],_[_0x297a('0x77')](_0x2296b0[_0x297a('0xa1')])[0x0],_0x2296b0['value']);_0x366e1a[_0x297a('0x16')]=this[_0x297a('0x16')][_0x2296b0['uniqueid']];}}}}catch(_0x1093be){logger[_0x297a('0x3d')](_0x297a('0x9f'),_0x2296b0[_0x297a('0x47')],util[_0x297a('0x3f')](_0x1093be,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')][_0x297a('0xa0')]=function(_0x13d639,_0x4083b7,_0x280545){var _0x472050=['rtpaudioqos',_0x297a('0xab'),_0x297a('0xac'),_0x297a('0xad'),_0x297a('0xae'),'rtpaudioqoslossbridged',_0x297a('0xaf'),_0x297a('0xb0'),_0x297a('0xb1'),'sipuri',_0x297a('0xb2'),_0x297a('0xb3'),_0x297a('0xb4'),'memberdynamic',_0x297a('0xb5'),'memberlastcall',_0x297a('0x8c'),_0x297a('0xb6'),_0x297a('0xb7')];if(!_[_0x297a('0x37')](_0x4083b7)&&!_['includes'](_0x472050,_0x4083b7)){if(_[_0x297a('0x61')](this[_0x297a('0x16')][_0x13d639])){this[_0x297a('0x16')][_0x13d639]={};}this[_0x297a('0x16')][_0x13d639][_0x4083b7]=_0x280545;}};VoiceQueueReport['prototype'][_0x297a('0x23')]=function(_0x4052a7){try{if(this[_0x297a('0x60')](_0x4052a7)){logger['debug'](_0x297a('0xb8'),_0x4052a7['uniqueid'],util[_0x297a('0x3f')](_0x4052a7,{'showHidden':![],'depth':null}));if(this[_0x297a('0x40')][_0x4052a7[_0x297a('0x47')]]){for(var _0x219f63=0x0,_0x531f8a={};_0x219f63=0x0?moment(_0x412c5a[_0x621b('0x1b')])['diff'](_0x412c5a[_0x621b('0x1a')],_0x621b('0x1c')):null,'data1':_0x621b('0x1d'),'data2':_0x412c5a['accountcode'],'data3':_0x412c5a[_0x621b('0x13')],'data4':_0x412c5a[_0x621b('0x1e')]||null,'role':_0x621b('0x15'),'internal':_0x412c5a[_0x621b('0x16')]?_[_0x621b('0x17')](_0x412c5a['accountcode']):undefined,'uniqueid':_0x412c5a[_0x621b('0x18')]},'log':_0x621b('0x7')});}; \ No newline at end of file +var _0x7c4a=['accountcode','toNumber','uniqueid','starttime','endtime','outbound','dialstring','moment','lodash','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent'];(function(_0x5f323a,_0x51b23e){var _0xb3417f=function(_0x3d51ad){while(--_0x3d51ad){_0x5f323a['push'](_0x5f323a['shift']());}};_0xb3417f(++_0x51b23e);}(_0x7c4a,0x103));var _0xa7c4=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0x7c4a[_0x51b1a5];return _0x15c738;};'use strict';var moment=require(_0xa7c4('0x0'));var _=require(_0xa7c4('0x1'));var util=require('util');var client=require('../client');exports[_0xa7c4('0x2')]=function(_0x3dfa7c){var _0x26efa1=_0x3dfa7c['queuecallercompleteAt']||_0x3dfa7c[_0xa7c4('0x3')];return client[_0xa7c4('0x4')](_0xa7c4('0x5'),{'body':{'channel':_0xa7c4('0x6'),'membername':_0x3dfa7c[_0xa7c4('0x7')],'interface':_[_0xa7c4('0x8')](_0x3dfa7c[_0xa7c4('0x9')])?util[_0xa7c4('0xa')](_0xa7c4('0xb'),_0x3dfa7c[_0xa7c4('0x7')]):_0x3dfa7c[_0xa7c4('0x9')],'type':_0xa7c4('0xc'),'enterAt':_0x3dfa7c[_0xa7c4('0xd')],'exitAt':_0x26efa1,'duration':moment(_0x26efa1)[_0xa7c4('0xe')](_0x3dfa7c[_0xa7c4('0xd')],_0xa7c4('0xf')),'data1':_0xa7c4('0x10'),'data2':_0x3dfa7c[_0xa7c4('0x11')],'data3':_0x3dfa7c[_0xa7c4('0x12')],'data4':null,'data5':_0x3dfa7c[_0xa7c4('0x13')],'role':_0xa7c4('0x14'),'internal':_0x3dfa7c[_0xa7c4('0x15')]?_[_0xa7c4('0x16')](_0x3dfa7c[_0xa7c4('0x15')]):undefined,'uniqueid':_0x3dfa7c[_0xa7c4('0x17')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x628c61){return client[_0xa7c4('0x4')](_0xa7c4('0x5'),{'body':{'channel':_0xa7c4('0x6'),'membername':_0x628c61['membername'],'interface':_0x628c61['interface'],'type':_0xa7c4('0xc'),'enterAt':_0x628c61[_0xa7c4('0x18')],'exitAt':_0x628c61[_0xa7c4('0x19')],'duration':moment(_0x628c61['endtime'])[_0xa7c4('0xe')](_0x628c61[_0xa7c4('0x18')],_0xa7c4('0xf'))>=0x0?moment(_0x628c61[_0xa7c4('0x19')])[_0xa7c4('0xe')](_0x628c61[_0xa7c4('0x18')],'seconds'):null,'data1':_0xa7c4('0x1a'),'data2':_0x628c61['accountcode'],'data3':_0x628c61[_0xa7c4('0x12')],'data4':_0x628c61[_0xa7c4('0x1b')]||null,'role':_0xa7c4('0x14'),'internal':_0x628c61['accountcode']?_['toNumber'](_0x628c61[_0xa7c4('0x15')]):undefined,'uniqueid':_0x628c61[_0xa7c4('0x17')]},'log':_0xa7c4('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index e1a445c..2ee5b55 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2725=['ShowSetting','../client','getSettings','Request'];(function(_0x4167f8,_0x112702){var _0x3d0609=function(_0x27d462){while(--_0x27d462){_0x4167f8['push'](_0x4167f8['shift']());}};_0x3d0609(++_0x112702);}(_0x2725,0x1d1));var _0x5272=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x2725[_0x57014b];return _0x2b258a;};'use strict';var client=require(_0x5272('0x0'));exports[_0x5272('0x1')]=function(){return function(){return client[_0x5272('0x2')](_0x5272('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':'GetSettings'});};}; \ No newline at end of file +var _0x5a72=['Request','ShowSetting','stopRecordingOnTransfer','GetSettings','getSettings'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5a72,0x68));var _0x25a7=function(_0x5f3ca5,_0x33cb82){_0x5f3ca5=_0x5f3ca5-0x0;var _0x216633=_0x5a72[_0x5f3ca5];return _0x216633;};'use strict';var client=require('../client');exports[_0x25a7('0x0')]=function(){return function(){return client[_0x25a7('0x1')](_0x25a7('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x25a7('0x3')]},'log':_0x25a7('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 2bbc7f0..d84e9ff 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 _0xa902=['name','../client','getTemplates','Request'];(function(_0x188333,_0x42e977){var _0x4d980b=function(_0x290f22){while(--_0x290f22){_0x188333['push'](_0x188333['shift']());}};_0x4d980b(++_0x42e977);}(_0xa902,0x8d));var _0x2a90=function(_0x596257,_0x458cea){_0x596257=_0x596257-0x0;var _0x186cac=_0xa902[_0x596257];return _0x186cac;};'use strict';var client=require(_0x2a90('0x0'));exports[_0x2a90('0x1')]=function(_0x416198){return function(_0x3a1839){return client[_0x2a90('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x2a90('0x3'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x9c2c=['../client','getTemplates','GetTemplate','html'];(function(_0x5b9bbb,_0x2bdece){var _0x2a0245=function(_0x5c1751){while(--_0x5c1751){_0x5b9bbb['push'](_0x5b9bbb['shift']());}};_0x2a0245(++_0x2bdece);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc9c2('0x0'));exports[_0xc9c2('0x1')]=function(_0x4ac695){return function(_0x507004){return client['Request'](_0xc9c2('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xc9c2('0x3')]},'log':_0xc9c2('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c1a4932..452fc23 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 _0x1770=['GetTrigger','name','status','Condition','AllConditions','operator','value','field','Action','action','data1','data3','data4','data5','data6','data7','../client','getTriggers','Request'];(function(_0x5093fe,_0x4a7240){var _0x353bfa=function(_0x248902){while(--_0x248902){_0x5093fe['push'](_0x5093fe['shift']());}};_0x353bfa(++_0x4a7240);}(_0x1770,0xce));var _0x0177=function(_0x16ca8e,_0x60f267){_0x16ca8e=_0x16ca8e-0x0;var _0x4c560e=_0x1770[_0x16ca8e];return _0x4c560e;};'use strict';var client=require(_0x0177('0x0'));exports[_0x0177('0x1')]=function(_0x67aa80){return function(_0x726724){return client[_0x0177('0x2')](_0x0177('0x3'),{'options':{'raw':![],'attributes':['id',_0x0177('0x4'),'channel',_0x0177('0x5')],'include':[{'model':_0x0177('0x6'),'as':_0x0177('0x7'),'attributes':['id','field',_0x0177('0x8'),_0x0177('0x9')]},{'model':_0x0177('0x6'),'as':'AnyConditions','attributes':['id',_0x0177('0xa'),_0x0177('0x8'),_0x0177('0x9')]},{'model':_0x0177('0xb'),'as':'Actions','attributes':['id',_0x0177('0xc'),_0x0177('0xd'),'data2',_0x0177('0xe'),_0x0177('0xf'),_0x0177('0x10'),_0x0177('0x11'),_0x0177('0x12')]}]},'log':_0x0177('0x3')});};}; \ No newline at end of file +var _0x450c=['operator','Condition','Action','Actions','action','data1','data2','data6','data7','../client','getTriggers','Request','name','channel','field'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x450c,0x90));var _0xc450=function(_0x2eedc9,_0x152395){_0x2eedc9=_0x2eedc9-0x0;var _0x4fd912=_0x450c[_0x2eedc9];return _0x4fd912;};'use strict';var client=require(_0xc450('0x0'));exports[_0xc450('0x1')]=function(_0x2b807d){return function(_0x26b4ff){return client[_0xc450('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xc450('0x3'),_0xc450('0x4'),'status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xc450('0x5'),_0xc450('0x6'),'value']},{'model':_0xc450('0x7'),'as':'AnyConditions','attributes':['id','field','operator','value']},{'model':_0xc450('0x8'),'as':_0xc450('0x9'),'attributes':['id',_0xc450('0xa'),_0xc450('0xb'),_0xc450('0xc'),'data3','data4','data5',_0xc450('0xd'),_0xc450('0xe')]}]},'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 c75fece..1eae14d 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 _0xe935=['name','registry','../client','GetTrunk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe935,0x17e));var _0x5e93=function(_0x5df2e0,_0x16313a){_0x5df2e0=_0x5df2e0-0x0;var _0x2a3ade=_0xe935[_0x5df2e0];return _0x2a3ade;};'use strict';var client=require(_0x5e93('0x0'));exports['getTrunks']=function(_0x10a1fa){return function(_0x255ef4){return client['Request'](_0x5e93('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5e93('0x2'),_0x5e93('0x3')]},'log':_0x5e93('0x1')});};}; \ No newline at end of file +var _0x3b7d=['GetTrunk','name','registry','../client'];(function(_0x2daa31,_0x53da57){var _0x38d78f=function(_0x263d5f){while(--_0x263d5f){_0x2daa31['push'](_0x2daa31['shift']());}};_0x38d78f(++_0x53da57);}(_0x3b7d,0x7f));var _0xd3b7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3b7d[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0xd3b7('0x0'));exports['getTrunks']=function(_0x31ac89){return function(_0x44e77a){return client['Request'](_0xd3b7('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd3b7('0x2'),_0xd3b7('0x3')]},'log':_0xd3b7('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index ffd60ec..8254c7b 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 _0x01ae=['savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','../client','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','interface','getTelephones','internal','PauseUser'];(function(_0x36529c,_0x4b98e5){var _0x2a4418=function(_0x417fa9){while(--_0x417fa9){_0x36529c['push'](_0x36529c['shift']());}};_0x2a4418(++_0x4b98e5);}(_0x01ae,0xdd));var _0xe01a=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0x01ae[_0x1ca9e9];return _0x309f3c;};'use strict';var client=require(_0xe01a('0x0'));exports[_0xe01a('0x1')]=function(){return function(){return client[_0xe01a('0x2')](_0xe01a('0x3'),{'options':{'raw':![],'where':{'role':_0xe01a('0x4')},'attributes':['id',_0xe01a('0x5'),_0xe01a('0x6'),_0xe01a('0x7'),_0xe01a('0x8'),_0xe01a('0x9'),_0xe01a('0xa'),_0xe01a('0xb'),_0xe01a('0xc'),_0xe01a('0xd'),_0xe01a('0xe'),'mobile',_0xe01a('0xf')]},'log':_0xe01a('0x1')});};};exports[_0xe01a('0x10')]=function(){return function(){return client[_0xe01a('0x2')](_0xe01a('0x3'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0xe01a('0x5'),_0xe01a('0x7'),_0xe01a('0x11')]},'log':'getTelephones'});};};exports['savePause']=function(_0x33842a,_0x21d409,_0x1764bb){return client[_0xe01a('0x2')](_0xe01a('0x12'),{'body':{'type':_0x21d409,'uniqueid':_0x1764bb},'options':{'where':{'id':_0x33842a['id']}},'log':_0xe01a('0x13')});};exports[_0xe01a('0x14')]=function(_0x450b91){return client[_0xe01a('0x2')](_0xe01a('0x15'),{'body':{},'options':{'where':{'id':_0x450b91['id']}},'log':_0xe01a('0x13')});};exports[_0xe01a('0x16')]=function(_0x358804){return client['Request'](_0xe01a('0x17'),{'options':{'raw':![],'where':{'role':_0xe01a('0x4'),'id':_0x358804},'attributes':['id',_0xe01a('0x5'),_0xe01a('0x6'),_0xe01a('0x7'),_0xe01a('0x8'),'online',_0xe01a('0xa'),_0xe01a('0xb'),_0xe01a('0xc'),'voicePause',_0xe01a('0xf')]},'log':_0xe01a('0x16')});}; \ No newline at end of file +var _0xfe96=['mobile','interface','getTelephones','telephone','savePause','PauseUser','saveUnpause','getAgent','ShowUser','../client','Request','GetUser','agent','name','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone'];(function(_0x220b45,_0x4da80f){var _0x2e1a55=function(_0x250ccd){while(--_0x250ccd){_0x220b45['push'](_0x220b45['shift']());}};_0x2e1a55(++_0x4da80f);}(_0xfe96,0xe5));var _0x6fe9=function(_0x11aeb9,_0x531c0a){_0x11aeb9=_0x11aeb9-0x0;var _0x1c4e08=_0xfe96[_0x11aeb9];return _0x1c4e08;};'use strict';var client=require(_0x6fe9('0x0'));exports['getAgents']=function(){return function(){return client[_0x6fe9('0x1')](_0x6fe9('0x2'),{'options':{'raw':![],'where':{'role':_0x6fe9('0x3')},'attributes':['id',_0x6fe9('0x4'),'email',_0x6fe9('0x5'),_0x6fe9('0x6'),_0x6fe9('0x7'),_0x6fe9('0x8'),_0x6fe9('0x9'),_0x6fe9('0xa'),_0x6fe9('0xb'),_0x6fe9('0xc'),_0x6fe9('0xd'),_0x6fe9('0xe')]},'log':'getAgents'});};};exports[_0x6fe9('0xf')]=function(){return function(){return client[_0x6fe9('0x1')](_0x6fe9('0x2'),{'options':{'raw':!![],'where':{'role':_0x6fe9('0x10')},'attributes':['id',_0x6fe9('0x4'),_0x6fe9('0x5'),'internal']},'log':'getTelephones'});};};exports[_0x6fe9('0x11')]=function(_0x53b685,_0x31685b,_0x586a0e){return client[_0x6fe9('0x1')](_0x6fe9('0x12'),{'body':{'type':_0x31685b,'uniqueid':_0x586a0e},'options':{'where':{'id':_0x53b685['id']}},'log':_0x6fe9('0x11')});};exports[_0x6fe9('0x13')]=function(_0x1c5805){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x1c5805['id']}},'log':_0x6fe9('0x11')});};exports[_0x6fe9('0x14')]=function(_0xd504dc){return client['Request'](_0x6fe9('0x15'),{'options':{'raw':![],'where':{'role':'agent','id':_0xd504dc},'attributes':['id',_0x6fe9('0x4'),'email',_0x6fe9('0x5'),_0x6fe9('0x6'),_0x6fe9('0x7'),_0x6fe9('0x8'),_0x6fe9('0x9'),_0x6fe9('0xa'),_0x6fe9('0xb'),_0x6fe9('0xe')]},'log':_0x6fe9('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 0251227..cf04904 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 _0xf5c8=['CreateVoiceAgentReport','UpdateVoiceAgentReport','Request'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xf5c8,0x155));var _0x8f5c=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0xf5c8[_0x1fd675];return _0x16b554;};'use strict';var client=require('../client');exports['create']=function(_0x43344d){return client[_0x8f5c('0x0')](_0x8f5c('0x1'),{'body':_0x43344d,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x22d3ac,_0x4d5180,_0x1fd118){return client[_0x8f5c('0x0')](_0x8f5c('0x2'),{'body':_0x22d3ac,'options':{'where':{'uniqueid':_0x4d5180,'interface':_0x1fd118,'agentcomplete':!![]}},'log':_0x8f5c('0x2')});}; \ No newline at end of file +var _0x16d2=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0x16d2,0x123));var _0x216d=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x16d2[_0x5471ec];return _0x121d4c;};'use strict';var client=require(_0x216d('0x0'));exports[_0x216d('0x1')]=function(_0x398c34){return client[_0x216d('0x2')](_0x216d('0x3'),{'body':_0x398c34,'log':_0x216d('0x3')});};exports[_0x216d('0x4')]=function(_0x239b49,_0xfd7306,_0x593bb0){return client[_0x216d('0x2')](_0x216d('0x5'),{'body':_0x239b49,'options':{'where':{'uniqueid':_0xfd7306,'interface':_0x593bb0,'agentcomplete':!![]}},'log':_0x216d('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 8a35e92..c73c46b 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 _0x3dfd=['CreateVoiceCallReport','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request'];(function(_0x4631fb,_0x2fafd5){var _0x1db8ab=function(_0x12c635){while(--_0x12c635){_0x4631fb['push'](_0x4631fb['shift']());}};_0x1db8ab(++_0x2fafd5);}(_0x3dfd,0x176));var _0xd3df=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3dfd[_0x57b54c];return _0x59cc19;};'use strict';var moment=require(_0xd3df('0x0'));var util=require(_0xd3df('0x1'));var _=require(_0xd3df('0x2'));var client=require(_0xd3df('0x3'));exports[_0xd3df('0x4')]=function(_0x1250a6){return client[_0xd3df('0x5')](_0xd3df('0x6'),{'body':_['merge'](_0x1250a6,{'source':_0x1250a6['calleridnum'],'destinationcontext':_0x1250a6[_0xd3df('0x7')],'callerid':_0x1250a6[_0xd3df('0x8')],'amaflags':_0xd3df('0x9')}),'log':_0xd3df('0x6')});};exports[_0xd3df('0xa')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0xd3df('0xb')],'createdAt':{'$between':[moment()['startOf'](_0xd3df('0xc'))[_0xd3df('0xd')](_0xd3df('0xe')),moment()[_0xd3df('0xf')](_0xd3df('0xc'))[_0xd3df('0xd')](_0xd3df('0xe'))]}},'attributes':[_0xd3df('0x10'),'disposition',_0xd3df('0x11'),_0xd3df('0x12')]},'log':_0xd3df('0x13')});};}; \ No newline at end of file +var _0x8ba0=['CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','billableseconds','GetVoiceCallReports','moment','lodash','create'];(function(_0x44c50c,_0x3a42bf){var _0xcdf0aa=function(_0x40fdfb){while(--_0x40fdfb){_0x44c50c['push'](_0x44c50c['shift']());}};_0xcdf0aa(++_0x3a42bf);}(_0x8ba0,0x1b6));var _0x08ba=function(_0x590425,_0x11c129){_0x590425=_0x590425-0x0;var _0x5d4b80=_0x8ba0[_0x590425];return _0x5d4b80;};'use strict';var moment=require(_0x08ba('0x0'));var util=require('util');var _=require(_0x08ba('0x1'));var client=require('../client');exports[_0x08ba('0x2')]=function(_0x437885){return client['Request'](_0x08ba('0x3'),{'body':_[_0x08ba('0x4')](_0x437885,{'source':_0x437885[_0x08ba('0x5')],'destinationcontext':_0x437885[_0x08ba('0x6')],'callerid':_0x437885[_0x08ba('0x7')],'amaflags':_0x08ba('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x08ba('0x9')]=function(){return function(){return client[_0x08ba('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x08ba('0xb')],'createdAt':{'$between':[moment()[_0x08ba('0xc')](_0x08ba('0xd'))[_0x08ba('0xe')](_0x08ba('0xf')),moment()[_0x08ba('0x10')]('day')[_0x08ba('0xe')](_0x08ba('0xf'))]}},'attributes':[_0x08ba('0x11'),_0x08ba('0x12'),'duration',_0x08ba('0x13')]},'log':_0x08ba('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 5b1cca8..d6bdfcc 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 _0x1eb5=['../client','create','CreateVoiceDialReport'];(function(_0x1490c7,_0xda74ef){var _0x5eff47=function(_0x4ad6f8){while(--_0x4ad6f8){_0x1490c7['push'](_0x1490c7['shift']());}};_0x5eff47(++_0xda74ef);}(_0x1eb5,0x1a1));var _0x51eb=function(_0x220ab4,_0x12499c){_0x220ab4=_0x220ab4-0x0;var _0x584fd8=_0x1eb5[_0x220ab4];return _0x584fd8;};'use strict';var client=require(_0x51eb('0x0'));exports[_0x51eb('0x1')]=function(_0x1f5bba){return client['Request'](_0x51eb('0x2'),{'body':_0x1f5bba,'log':_0x51eb('0x2')});}; \ No newline at end of file +var _0x1747=['CreateVoiceDialReport','../client','create','Request'];(function(_0x5d4115,_0x12d1c5){var _0x254730=function(_0x7f7d3f){while(--_0x7f7d3f){_0x5d4115['push'](_0x5d4115['shift']());}};_0x254730(++_0x12d1c5);}(_0x1747,0xf5));var _0x7174=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x1747[_0xbf8ebe];return _0x1e25e8;};'use strict';var client=require(_0x7174('0x0'));exports[_0x7174('0x1')]=function(_0x1cc7af){return client[_0x7174('0x2')](_0x7174('0x3'),{'body':_0x1cc7af,'log':_0x7174('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 767b9b2..170c572 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 _0x9173=['../client','getVoiceExtensions','GetVoiceExtension','exten','recordingFormat'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x9173,0xb4));var _0x3917=function(_0x43b45b,_0x2883b5){_0x43b45b=_0x43b45b-0x0;var _0x591f8c=_0x9173[_0x43b45b];return _0x591f8c;};'use strict';var client=require(_0x3917('0x0'));exports[_0x3917('0x1')]=function(){return function(){return client['Request'](_0x3917('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3917('0x3'),_0x3917('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xd1f1=['GetVoiceExtension','exten','../client','getVoiceExtensions','Request'];(function(_0x4739d1,_0x24792e){var _0x47e494=function(_0x3678c2){while(--_0x3678c2){_0x4739d1['push'](_0x4739d1['shift']());}};_0x47e494(++_0x24792e);}(_0xd1f1,0x84));var _0x1d1f=function(_0x3c6310,_0x13601d){_0x3c6310=_0x3c6310-0x0;var _0x320122=_0xd1f1[_0x3c6310];return _0x320122;};'use strict';var client=require(_0x1d1f('0x0'));exports[_0x1d1f('0x1')]=function(){return function(){return client[_0x1d1f('0x2')](_0x1d1f('0x3'),{'options':{'raw':!![],'attributes':['id',_0x1d1f('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x1d1f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 70c823a..05b2c12 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 _0x5fc2=['timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','GetVoiceQueue','acw','autopause','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength'];(function(_0x381306,_0x4a3435){var _0x4a8256=function(_0x39d4bf){while(--_0x39d4bf){_0x381306['push'](_0x381306['shift']());}};_0x4a8256(++_0x4a3435);}(_0x5fc2,0x106));var _0x25fc=function(_0x3920b4,_0x4cd07a){_0x3920b4=_0x3920b4-0x0;var _0x1ef94f=_0x5fc2[_0x3920b4];return _0x1ef94f;};'use strict';var client=require(_0x25fc('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x25fc('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x25fc('0x2'),'acwTimeout',_0x25fc('0x3'),_0x25fc('0x4'),'type',_0x25fc('0x5'),'dialMethod',_0x25fc('0x6'),_0x25fc('0x7'),'dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x25fc('0x8'),_0x25fc('0x9'),_0x25fc('0xa'),_0x25fc('0xb'),_0x25fc('0xc'),_0x25fc('0xd'),_0x25fc('0xe'),_0x25fc('0xf'),_0x25fc('0x10'),_0x25fc('0x11'),_0x25fc('0x12'),'dialNoAnswerRetryFrequency',_0x25fc('0x13'),_0x25fc('0x14'),'dialGlobalInterval',_0x25fc('0x15'),'dialCheckDuplicateType','dialAMDActive',_0x25fc('0x16'),_0x25fc('0x17'),'dialAMDAfterGreetingSilence',_0x25fc('0x18'),'dialAMDMinWordLength',_0x25fc('0x19'),_0x25fc('0x1a'),'dialAMDSilenceThreshold',_0x25fc('0x1b'),_0x25fc('0x1c'),_0x25fc('0x1d'),_0x25fc('0x1e'),_0x25fc('0x1f'),_0x25fc('0x20'),_0x25fc('0x21'),'dialQueueProject2',_0x25fc('0x4'),_0x25fc('0x22'),_0x25fc('0x23'),'dialCutDigit',_0x25fc('0x24'),_0x25fc('0x25'),_0x25fc('0x26'),_0x25fc('0x27'),_0x25fc('0x28'),_0x25fc('0x29'),_0x25fc('0x2a'),_0x25fc('0x2b'),_0x25fc('0x2c'),_0x25fc('0x2d'),_0x25fc('0x2e'),'dialPredictiveIntervalMaxThreshold',_0x25fc('0x2f')],'include':[{'model':_0x25fc('0x30'),'as':_0x25fc('0x30'),'attributes':['id',_0x25fc('0x31'),_0x25fc('0x32'),_0x25fc('0x33')]},{'model':_0x25fc('0x34'),'as':_0x25fc('0x35'),'attributes':['id','name']},{'model':'Trunk','as':_0x25fc('0x36'),'attributes':['id',_0x25fc('0x31'),'callerid',_0x25fc('0x33')]},{'model':_0x25fc('0x37'),'as':'Interval','attributes':['id',_0x25fc('0x31')],'include':[{'model':'Interval','as':_0x25fc('0x38'),'attributes':['id','name',_0x25fc('0x39')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x1007=['dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','../client','getVoiceQueues','Request','name','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength'];(function(_0x38c4bf,_0xcde6f){var _0x46f923=function(_0x3709b2){while(--_0x3709b2){_0x38c4bf['push'](_0x38c4bf['shift']());}};_0x46f923(++_0xcde6f);}(_0x1007,0x1b9));var _0x7100=function(_0x407765,_0x239591){_0x407765=_0x407765-0x0;var _0x42887b=_0x1007[_0x407765];return _0x42887b;};'use strict';var client=require(_0x7100('0x0'));exports[_0x7100('0x1')]=function(){return function(){return client[_0x7100('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x7100('0x3'),'acw','acwTimeout',_0x7100('0x4'),_0x7100('0x5'),_0x7100('0x6'),_0x7100('0x7'),_0x7100('0x8'),'dialLimitChannel',_0x7100('0x9'),'dialPowerLevel','dialPredictiveOptimization',_0x7100('0xa'),_0x7100('0xb'),_0x7100('0xc'),_0x7100('0xd'),'dialOriginateTimeout',_0x7100('0xe'),'dialQueueTimeout',_0x7100('0xf'),_0x7100('0x10'),'dialCongestionRetryFrequency',_0x7100('0x11'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x7100('0x12'),_0x7100('0x13'),'dialTimezone','dialGlobalInterval','dialPrefix',_0x7100('0x14'),_0x7100('0x15'),_0x7100('0x16'),'dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0x7100('0x17'),_0x7100('0x18'),_0x7100('0x19'),'dialAMDSilenceThreshold',_0x7100('0x1a'),'timeout',_0x7100('0x1b'),_0x7100('0x1c'),_0x7100('0x1d'),_0x7100('0x1e'),_0x7100('0x1f'),_0x7100('0x20'),_0x7100('0x5'),_0x7100('0x21'),_0x7100('0x22'),_0x7100('0x23'),_0x7100('0x24'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x7100('0x25'),_0x7100('0x26'),_0x7100('0x27'),_0x7100('0x28'),_0x7100('0x29'),_0x7100('0x2a'),'dialAgentRejectRetryFrequency',_0x7100('0x2b'),_0x7100('0x2c'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x7100('0x2d'),'as':'Trunk','attributes':['id',_0x7100('0x3'),_0x7100('0x2e'),_0x7100('0x2f')]},{'model':_0x7100('0x30'),'as':_0x7100('0x31'),'attributes':['id',_0x7100('0x3')]},{'model':_0x7100('0x2d'),'as':_0x7100('0x32'),'attributes':['id',_0x7100('0x3'),_0x7100('0x2e'),_0x7100('0x2f')]},{'model':_0x7100('0x33'),'as':'Interval','attributes':['id',_0x7100('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x7100('0x3'),'interval']}]}]},'log':_0x7100('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 6808129..f28171c 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 _0x0c9d=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallerexitAt','queuecallerabandon','GetVoiceQueueReports','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport'];(function(_0x1104e3,_0x17cca6){var _0x4a3032=function(_0x247c86){while(--_0x247c86){_0x1104e3['push'](_0x1104e3['shift']());}};_0x4a3032(++_0x17cca6);}(_0x0c9d,0x14f));var _0xd0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9d[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xd0c9('0x0'));var _=require(_0xd0c9('0x1'));var client=require(_0xd0c9('0x2'));exports['create']=function(_0xa4e72){return client[_0xd0c9('0x3')]('CreateVoiceQueueReport',{'body':_0xa4e72,'log':_0xd0c9('0x4')});};exports[_0xd0c9('0x5')]=function(){return function(){return client[_0xd0c9('0x3')](_0xd0c9('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xd0c9('0x7')](_0xd0c9('0x8'))[_0xd0c9('0x9')](_0xd0c9('0xa')),moment()[_0xd0c9('0xb')](_0xd0c9('0x8'))[_0xd0c9('0x9')](_0xd0c9('0xa'))]}},'attributes':[_0xd0c9('0xc'),'queue',_0xd0c9('0xd'),_0xd0c9('0xe'),'queuecallercomplete','queuecallercompleteAt','queuecallerexit',_0xd0c9('0xf'),_0xd0c9('0x10'),'queuecallerabandonAt']},'log':_0xd0c9('0x11')});};}; \ No newline at end of file +var _0x2129=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','GetVoiceQueueReports','lodash','../client','Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete'];(function(_0x2053aa,_0x3df40e){var _0x30f5bb=function(_0x1b3f36){while(--_0x1b3f36){_0x2053aa['push'](_0x2053aa['shift']());}};_0x30f5bb(++_0x3df40e);}(_0x2129,0x1ea));var _0x9212=function(_0x480812,_0x54a455){_0x480812=_0x480812-0x0;var _0x112ce4=_0x2129[_0x480812];return _0x112ce4;};'use strict';var moment=require('moment');var _=require(_0x9212('0x0'));var client=require(_0x9212('0x1'));exports['create']=function(_0x1cc3c4){return client[_0x9212('0x2')](_0x9212('0x3'),{'body':_0x1cc3c4,'log':'CreateVoiceQueueReport'});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x9212('0x2')](_0x9212('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x9212('0x5')](_0x9212('0x6'))[_0x9212('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x9212('0x8')](_0x9212('0x6'))[_0x9212('0x7')](_0x9212('0x9'))]}},'attributes':['uniqueid',_0x9212('0xa'),_0x9212('0xb'),_0x9212('0xc'),_0x9212('0xd'),_0x9212('0xe'),_0x9212('0xf'),_0x9212('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':_0x9212('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index ba4b797..d67ea4b 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 _0x7f27=['../client','Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7f27,0x100));var _0x77f2=function(_0x48ffdf,_0x18d2d3){_0x48ffdf=_0x48ffdf-0x0;var _0x481a49=_0x7f27[_0x48ffdf];return _0x481a49;};'use strict';var client=require(_0x77f2('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4ae673){return function(){return client[_0x77f2('0x1')](_0x77f2('0x2'),{'options':{'where':{'VoiceQueueId':_0x4ae673,'paused':!![]},'raw':!![]},'log':_0x77f2('0x3')});};}; \ No newline at end of file +var _0xc47a=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xc47a,0x1ab));var _0xac47=function(_0x31c086,_0x48979e){_0x31c086=_0x31c086-0x0;var _0xe6a4e8=_0xc47a[_0x31c086];return _0xe6a4e8;};'use strict';var client=require(_0xac47('0x0'));exports[_0xac47('0x1')]=function(_0x52be44){return function(){return client[_0xac47('0x2')](_0xac47('0x3'),{'options':{'where':{'VoiceQueueId':_0x52be44,'paused':!![]},'raw':!![]},'log':_0xac47('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 6b698b7..e6d8ce9 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 _0x23d6=['merge','lodash','create','Request','CreateVoiceRecording'];(function(_0x1d642c,_0x2fd106){var _0x334d81=function(_0xb93968){while(--_0xb93968){_0x1d642c['push'](_0x1d642c['shift']());}};_0x334d81(++_0x2fd106);}(_0x23d6,0x1be));var _0x623d=function(_0x2e0998,_0x2e4b2c){_0x2e0998=_0x2e0998-0x0;var _0x7ce4bc=_0x23d6[_0x2e0998];return _0x7ce4bc;};'use strict';var _=require(_0x623d('0x0'));var client=require('../client');exports[_0x623d('0x1')]=function(_0x58f4ad){return client[_0x623d('0x2')](_0x623d('0x3'),{'body':_[_0x623d('0x4')](_0x58f4ad,{'value':_0x58f4ad['monitorFilename']}),'log':_0x623d('0x3')});}; \ No newline at end of file +var _0xc7c8=['create','Request','CreateVoiceRecording','merge','monitorFilename','lodash','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc7c8,0xc2));var _0x8c7c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc7c8[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x8c7c('0x0'));var client=require(_0x8c7c('0x1'));exports[_0x8c7c('0x2')]=function(_0x4cfe35){return client[_0x8c7c('0x3')](_0x8c7c('0x4'),{'body':_[_0x8c7c('0x5')](_0x4cfe35,{'value':_0x4cfe35[_0x8c7c('0x6')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 4d3b0fb..a14a796 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 _0x6e71=['transfers','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x6e71,0xc2));var _0x16e7=function(_0x3b172c,_0x410dfd){_0x3b172c=_0x3b172c-0x0;var _0x151859=_0x6e71[_0x3b172c];return _0x151859;};'use strict';var client=require(_0x16e7('0x0'));exports[_0x16e7('0x1')]={};exports['blindTransfer']=function(_0x3f7795){return client[_0x16e7('0x2')](_0x16e7('0x3'),{'body':{'result':_0x3f7795['result'],'transfererchannel':_0x3f7795[_0x16e7('0x4')],'transferercalleridnum':_0x3f7795['transferercalleridnum'],'transferercalleridname':_0x3f7795[_0x16e7('0x5')],'transfererconnectedlinenum':_0x3f7795[_0x16e7('0x6')],'transfererconnectedlinename':_0x3f7795[_0x16e7('0x7')],'transfereraccountcode':_0x3f7795[_0x16e7('0x8')],'transferercontext':_0x3f7795[_0x16e7('0x9')],'transfererexten':_0x3f7795[_0x16e7('0xa')],'transfererlinkedid':_0x3f7795[_0x16e7('0xb')],'transfereechannel':_0x3f7795[_0x16e7('0xc')],'transfereecalleridnum':_0x3f7795[_0x16e7('0xd')],'transfereecalleridname':_0x3f7795[_0x16e7('0xe')],'transfereeconnectedlinenum':_0x3f7795['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x3f7795[_0x16e7('0xf')],'transfereeaccountcode':_0x3f7795[_0x16e7('0x10')],'transfereecontext':_0x3f7795[_0x16e7('0x11')],'transfereeexten':_0x3f7795[_0x16e7('0x12')],'transfereelinkedid':_0x3f7795['transfereelinkedid'],'isexternal':_0x3f7795[_0x16e7('0x13')],'context':_0x3f7795['context'],'extension':_0x3f7795['extension'],'type':_0x16e7('0x14')},'log':_0x16e7('0x3')});};exports[_0x16e7('0x15')]=function(_0x4195b3){return client[_0x16e7('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x4195b3['result'],'transfererchannel':_0x4195b3[_0x16e7('0x16')],'transferercalleridnum':_0x4195b3[_0x16e7('0x17')],'transferercalleridname':_0x4195b3[_0x16e7('0x18')],'transfererconnectedlinenum':_0x4195b3[_0x16e7('0x19')],'transfererconnectedlinename':_0x4195b3['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4195b3['origtransfereraccountcode'],'transferercontext':_0x4195b3[_0x16e7('0x1a')],'transfererexten':_0x4195b3['secondtransfererexten'],'transfererlinkedid':_0x4195b3[_0x16e7('0x1b')],'transfereechannel':_0x4195b3['transfertargetchannel'],'transfereecalleridnum':_0x4195b3[_0x16e7('0x1c')],'transfereecalleridname':_0x4195b3[_0x16e7('0x1d')],'transfereeconnectedlinenum':_0x4195b3[_0x16e7('0x1e')],'transfereeconnectedlinename':_0x4195b3[_0x16e7('0x1f')],'transfereeaccountcode':_0x4195b3[_0x16e7('0x20')],'transfereecontext':_0x4195b3[_0x16e7('0x21')],'transfereeexten':_0x4195b3[_0x16e7('0x22')],'transfereelinkedid':_0x4195b3[_0x16e7('0x23')],'isexternal':_0x4195b3['isexternal'],'context':_0x4195b3[_0x16e7('0x24')],'extension':_0x4195b3[_0x16e7('0x25')],'type':_0x16e7('0x26')},'log':_0x16e7('0x3')});}; \ No newline at end of file +var _0x221f=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','isexternal','extension','blind','attendedTransfer','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x4d5d28,_0x26bd9b){var _0x2026b1=function(_0x1fe42c){while(--_0x1fe42c){_0x4d5d28['push'](_0x4d5d28['shift']());}};_0x2026b1(++_0x26bd9b);}(_0x221f,0x1b1));var _0xf221=function(_0x33e4a7,_0x2e80a2){_0x33e4a7=_0x33e4a7-0x0;var _0x598620=_0x221f[_0x33e4a7];return _0x598620;};'use strict';var client=require(_0xf221('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x3d2465){return client[_0xf221('0x1')](_0xf221('0x2'),{'body':{'result':_0x3d2465['result'],'transfererchannel':_0x3d2465[_0xf221('0x3')],'transferercalleridnum':_0x3d2465['transferercalleridnum'],'transferercalleridname':_0x3d2465[_0xf221('0x4')],'transfererconnectedlinenum':_0x3d2465['transfererconnectedlinenum'],'transfererconnectedlinename':_0x3d2465[_0xf221('0x5')],'transfereraccountcode':_0x3d2465[_0xf221('0x6')],'transferercontext':_0x3d2465[_0xf221('0x7')],'transfererexten':_0x3d2465[_0xf221('0x8')],'transfererlinkedid':_0x3d2465[_0xf221('0x9')],'transfereechannel':_0x3d2465[_0xf221('0xa')],'transfereecalleridnum':_0x3d2465[_0xf221('0xb')],'transfereecalleridname':_0x3d2465[_0xf221('0xc')],'transfereeconnectedlinenum':_0x3d2465[_0xf221('0xd')],'transfereeconnectedlinename':_0x3d2465['transfereeconnectedlinename'],'transfereeaccountcode':_0x3d2465[_0xf221('0xe')],'transfereecontext':_0x3d2465[_0xf221('0xf')],'transfereeexten':_0x3d2465['transfereeexten'],'transfereelinkedid':_0x3d2465['transfereelinkedid'],'isexternal':_0x3d2465[_0xf221('0x10')],'context':_0x3d2465['context'],'extension':_0x3d2465[_0xf221('0x11')],'type':_0xf221('0x12')},'log':_0xf221('0x2')});};exports[_0xf221('0x13')]=function(_0x44be4d){return client[_0xf221('0x1')](_0xf221('0x2'),{'body':{'result':_0x44be4d['result'],'transfererchannel':_0x44be4d[_0xf221('0x14')],'transferercalleridnum':_0x44be4d['origtransferercalleridnum'],'transferercalleridname':_0x44be4d['origtransferercalleridname'],'transfererconnectedlinenum':_0x44be4d[_0xf221('0x15')],'transfererconnectedlinename':_0x44be4d[_0xf221('0x16')],'transfereraccountcode':_0x44be4d[_0xf221('0x17')],'transferercontext':_0x44be4d[_0xf221('0x18')],'transfererexten':_0x44be4d[_0xf221('0x19')],'transfererlinkedid':_0x44be4d[_0xf221('0x1a')],'transfereechannel':_0x44be4d[_0xf221('0x1b')],'transfereecalleridnum':_0x44be4d[_0xf221('0x1c')],'transfereecalleridname':_0x44be4d[_0xf221('0x1d')],'transfereeconnectedlinenum':_0x44be4d[_0xf221('0x1e')],'transfereeconnectedlinename':_0x44be4d[_0xf221('0x1f')],'transfereeaccountcode':_0x44be4d[_0xf221('0x20')],'transfereecontext':_0x44be4d['transfertargetcontext'],'transfereeexten':_0x44be4d[_0xf221('0x21')],'transfereelinkedid':_0x44be4d[_0xf221('0x22')],'isexternal':_0x44be4d[_0xf221('0x10')],'context':_0x44be4d[_0xf221('0x23')],'extension':_0x44be4d[_0xf221('0x24')],'type':_0xf221('0x25')},'log':_0xf221('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 1e9ad7f..5746101 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 _0x6377=['outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','values','length','ami\x20disconnected','voicechannel','validate','map','find','channels','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','format','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','resolve','StopMixMonitor','filename','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicequeuechannel','queueChannels','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','lodash','util','jayson/promise','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','timers','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','join','pick','keys','module','Action','then','message','catch','isConnected','command','action','Command','content','hasOwnProperty','voiceQueues','name','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay'];(function(_0x3c2325,_0x21c923){var _0x20a4b4=function(_0x4185c6){while(--_0x4185c6){_0x3c2325['push'](_0x3c2325['shift']());}};_0x20a4b4(++_0x21c923);}(_0x6377,0x162));var _0x7637=function(_0x4316f0,_0x1a45ee){_0x4316f0=_0x4316f0-0x0;var _0x437168=_0x6377[_0x4316f0];return _0x437168;};'use strict';var _=require(_0x7637('0x0'));var util=require(_0x7637('0x1'));var jayson=require(_0x7637('0x2'));var schema=require('validate');var BPromise=require('bluebird');var moment=require('moment');var config=require(_0x7637('0x3'));var properties=require(_0x7637('0x4'));var ami=require(_0x7637('0x5'));exports[_0x7637('0x6')]=function(_0x2159db,_0x3c7ed8,_0x1fe2f9){return new BPromise(function(_0x1a6fc4,_0xa1b15f){var _0x544556={'QueuePause':function(_0x5c84d7){return new Promise(function(_0x2b6fc7,_0x338a39){var _0x38f570=util['format'](_0x7637('0x7'),_0x7637('0x8'),_0x5c84d7['name']);if(_0x2159db[_0x7637('0x9')]&&_0x2159db[_0x7637('0x9')][_0x38f570]&&_0x2159db['timers'][_0x38f570]['timer']){_0x2159db[_0x7637('0x9')][_0x38f570]['updateAcw']();}if(_0x2159db[_0x7637('0xa')][_0x38f570]){_0x2159db['agents'][_0x38f570][_0x7637('0xb')]({'statePause':_0x5c84d7[_0x7637('0xc')]?!![]:![]});}_0x2b6fc7({'code':0xc8,'message':_0x7637('0xd')});});},'Reload':function(_0x5ad158){var _0x3f2ceb=this;return new Promise(function(_0x315c30,_0x5ac9be){if(ami['isConnected']()==![]){return _0x5ac9be(_0x3f2ceb[_0x7637('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x7637('0xf')][_0x7637('0x10')],'ami\x20disconnected'][_0x7637('0x11')]('\x20')));}_0x5ad158=_[_0x7637('0x12')](_0x5ad158,_[_0x7637('0x13')](properties[_0x7637('0x14')]));_0x5ad158['action']='Reload';return ami[_0x7637('0x15')](_0x5ad158)[_0x7637('0x16')](function(_0x112b2b){_0x315c30({'code':0xc8,'message':_0x112b2b[_0x7637('0x17')]});})[_0x7637('0x18')](function(_0x2628d4){_0x5ac9be(_0x3f2ceb[_0x7637('0xe')](0x1f5,_0x2628d4[_0x7637('0x17')]));});});},'Command':function(_0xb4bbf4){var _0x19f3a1=this;return new Promise(function(_0x4057a7,_0x267414){if(ami[_0x7637('0x19')]()==![]){return _0x267414(_0x19f3a1['error'](0x1f4,[config['asterisk']['ip'],config[_0x7637('0xf')]['username'],'ami\x20disconnected'][_0x7637('0x11')]('\x20')));}_0xb4bbf4=_[_0x7637('0x12')](_0xb4bbf4,_0x7637('0x1a'));_0xb4bbf4[_0x7637('0x1b')]=_0x7637('0x1c');return ami[_0x7637('0x15')](_0xb4bbf4)[_0x7637('0x16')](function(_0x304ff0){_0x4057a7({'code':0xc8,'message':_0x304ff0[_0x7637('0x1d')]});})[_0x7637('0x18')](function(_0x57e2f5){_0x267414(_0x19f3a1[_0x7637('0xe')](0x1f5,_0x57e2f5[_0x7637('0x17')]));});});},'VoiceQueues':function(_0x37d55f){return new Promise(function(_0x4a2626,_0x228ef0){var _0x1bde39=[];for(var _0x527dc4 in _0x2159db['voiceQueues']){if(_0x2159db['voiceQueues'][_0x7637('0x1e')](_0x527dc4)){var _0x146082=_0x2159db[_0x7637('0x1f')][_0x527dc4];var _0x5cbd07={'id':_0x146082['id'],'name':_0x146082[_0x7637('0x20')],'strategy':_0x146082[_0x7637('0x21')],'answered':_0x146082['answered'],'available':_0x146082[_0x7637('0x22')],'loggedIn':_0x146082[_0x7637('0x23')],'pTalking':_0x146082[_0x7637('0x24')],'sumBillable':_0x146082[_0x7637('0x25')],'sumDuration':_0x146082['sumDuration'],'sumHoldTime':_0x146082[_0x7637('0x26')]||0x0,'talking':_0x146082[_0x7637('0x27')],'total':_0x146082[_0x7637('0x28')],'type':_0x146082[_0x7637('0x29')],'unmanaged':_0x146082['unmanaged'],'abandoned':_0x146082[_0x7637('0x2a')],'waiting':_0x146082[_0x7637('0x2b')],'loggedInDb':_0x146082[_0x7637('0x2c')]};if(_0x146082['type']===_0x7637('0x2d')){_0x5cbd07['dialActive']=_0x146082['dialActive'];_0x5cbd07[_0x7637('0x2e')]=_0x146082[_0x7637('0x2e')];_0x5cbd07[_0x7637('0x2f')]=_0x146082[_0x7637('0x2f')];_0x5cbd07[_0x7637('0x30')]=_0x146082['dialOriginateCallerIdNumber'];_0x5cbd07[_0x7637('0x31')]=_0x146082['dialOriginateTimeout'];_0x5cbd07[_0x7637('0x32')]=_0x146082[_0x7637('0x32')];_0x5cbd07['outboundAnswerAgiCallsDay']=_0x146082[_0x7637('0x33')];_0x5cbd07['outboundAnswerCallsDay']=_0x146082[_0x7637('0x34')];_0x5cbd07[_0x7637('0x35')]=_0x146082['outboundBlacklistCallsDay'];_0x5cbd07['outboundBusyCallsDay']=_0x146082[_0x7637('0x36')];_0x5cbd07[_0x7637('0x37')]=_0x146082[_0x7637('0x37')];_0x5cbd07[_0x7637('0x38')]=_0x146082['outboundDropCallsDayACS'];_0x5cbd07['outboundDropCallsDayCallersExit']=_0x146082[_0x7637('0x39')];_0x5cbd07[_0x7637('0x3a')]=_0x146082[_0x7637('0x3a')];_0x5cbd07['outboundNoAnswerCallsDay']=_0x146082[_0x7637('0x3b')];_0x5cbd07[_0x7637('0x3c')]=_0x146082['outboundNoSuchCallsDay'];_0x5cbd07[_0x7637('0x3d')]=_0x146082['outboundOriginateFailureCallsDay'];_0x5cbd07['outboundReCallsDay']=_0x146082[_0x7637('0x3e')];_0x5cbd07[_0x7637('0x3f')]=_0x146082[_0x7637('0x3f')];_0x5cbd07['outboundUnknownCallsDay']=_0x146082['outboundUnknownCallsDay'];_0x5cbd07[_0x7637('0x40')]=_0x146082[_0x7637('0x40')];_0x5cbd07[_0x7637('0x41')]=_0x146082['predictiveIntervalAvgHoldtime'];_0x5cbd07['predictiveIntervalAvgTalktime']=_0x146082[_0x7637('0x42')];_0x5cbd07[_0x7637('0x43')]=_0x146082[_0x7637('0x43')];_0x5cbd07['predictiveIntervalDroppedCallsTimeout']=_0x146082[_0x7637('0x44')];_0x5cbd07[_0x7637('0x45')]=_0x146082[_0x7637('0x45')];_0x5cbd07[_0x7637('0x46')]=_0x146082[_0x7637('0x46')];_0x5cbd07[_0x7637('0x47')]=_0x146082[_0x7637('0x47')];_0x5cbd07[_0x7637('0x48')]=_0x146082[_0x7637('0x48')];_0x5cbd07[_0x7637('0x49')]=_0x146082['predictiveIntervalPauses'];_0x5cbd07[_0x7637('0x4a')]=_0x146082[_0x7637('0x4a')];_0x5cbd07[_0x7637('0x4b')]=_0x146082[_0x7637('0x4b')];_0x5cbd07['message']=_0x146082[_0x7637('0x17')];_0x5cbd07[_0x7637('0x4c')]=_0x146082[_0x7637('0x4c')];_0x5cbd07['erlangCalls']=_0x146082[_0x7637('0x4d')];_0x5cbd07[_0x7637('0x4e')]=_0x146082[_0x7637('0x4e')];_0x5cbd07['erlangAbandonmentRate']=_0x146082[_0x7637('0x4f')];_0x5cbd07[_0x7637('0x50')]=_0x146082[_0x7637('0x50')];_0x5cbd07[_0x7637('0x51')]=_0x146082[_0x7637('0x51')];_0x5cbd07[_0x7637('0x52')]=_0x146082[_0x7637('0x52')];}if(_0x146082['Trunk']){_0x5cbd07['Trunk']={'id':_0x146082[_0x7637('0x53')]['id'],'name':_0x146082[_0x7637('0x53')][_0x7637('0x20')],'active':_0x146082[_0x7637('0x53')][_0x7637('0x54')],'callerid':_0x146082[_0x7637('0x53')]['callerid']};}if(_0x146082[_0x7637('0x55')]){_0x5cbd07[_0x7637('0x55')]={'id':_0x146082[_0x7637('0x55')]['id'],'name':_0x146082[_0x7637('0x55')][_0x7637('0x20')]};}_0x1bde39[_0x7637('0x56')](_0x5cbd07);}}_0x4a2626({'count':_0x1bde39['length'],'rows':_0x1bde39});});},'VoiceChannels':function(_0x448254){return new Promise(function(_0x2269f1,_0x4c4b93){var _0x5e4dbf=_[_0x7637('0x57')](_0x2159db['channels']);_0x2269f1({'count':_0x5e4dbf[_0x7637('0x58')],'rows':_0x5e4dbf});});},'VoiceChannelMixMonitor':function(_0x3bb754){var _0x4e3c9d=this;return new Promise(function(_0x348c08,_0x4bb974){if(ami['isConnected']()==![]){return _0x4bb974(_0x4e3c9d['error'](0x1f4,[config[_0x7637('0xf')]['ip'],config[_0x7637('0xf')]['username'],_0x7637('0x59')][_0x7637('0x11')]('\x20')));}var _0x59568f=schema(properties[_0x7637('0x5a')])[_0x7637('0x5b')](_0x3bb754);if(_0x59568f[_0x7637('0x58')]>0x0){return _0x4bb974(_0x4e3c9d[_0x7637('0xe')](0x1f4,_[_0x7637('0x5c')](_0x59568f,'message')[_0x7637('0x11')](',\x20')));}var _0x34a3e1=_[_0x7637('0x5d')](_0x2159db[_0x7637('0x5e')],{'uniqueid':_0x3bb754[_0x7637('0x5f')]});if(_0x34a3e1&&_0x34a3e1[_0x7637('0x60')]){var _0x14ba8f=util['format'](_0x7637('0x61'),_0x3bb754['filename']||_0x3bb754[_0x7637('0x5f')],_0x3bb754['format']||_0x7637('0x62'));return ami[_0x7637('0x15')]({'action':_0x7637('0x63'),'channel':_0x34a3e1[_0x7637('0x60')],'file':_0x14ba8f,'options':_0x7637('0x64')})[_0x7637('0x16')](function(_0x41b81b){var _0x471157=_[_0x7637('0x5d')](_0x34a3e1['monitors'],{'filename':_0x7637('0x65')+_0x14ba8f[_0x7637('0x66')]()});if(_[_0x7637('0x67')](_0x471157)){_0x34a3e1[_0x7637('0x68')]['push']({'filename':_0x7637('0x65')+_0x14ba8f[_0x7637('0x66')](),'createdAt':moment()[_0x7637('0x69')](_0x7637('0x6a')),'mixmonitorid':_0x41b81b[_0x7637('0x6b')],'status':_0x7637('0x6c')});}else{_0x471157[_0x7637('0x6b')]=_0x41b81b[_0x7637('0x6b')];_0x471157[_0x7637('0x6d')]='rec';}_0x348c08({'code':0xc8,'message':[_0x3bb754['uniqueid'],'MixMonitor\x20Success',_0x41b81b[_0x7637('0x6b')]][_0x7637('0x11')]('\x20'),'mixmonitorid':_0x41b81b['mixmonitorid']});})[_0x7637('0x18')](function(_0x1ed65a){_0x4bb974(_0x4e3c9d[_0x7637('0xe')](0x1f5,[_0x3bb754[_0x7637('0x5f')],_0x1ed65a[_0x7637('0x17')][_0x7637('0x66')]()]['join']('\x20')));});}else{return _0x4bb974(_0x4e3c9d['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x3c9b59){var _0x3c92c8=this;return new Promise(function(_0xfb2cc5,_0x5a23ef){if(ami[_0x7637('0x19')]()==![]){return _0x5a23ef(_0x3c92c8['error'](0x1f4,[config['asterisk']['ip'],config[_0x7637('0xf')][_0x7637('0x10')],_0x7637('0x59')][_0x7637('0x11')]('\x20')));}var _0x6bc762=schema(properties[_0x7637('0x5a')])[_0x7637('0x5b')](_0x3c9b59);if(_0x6bc762[_0x7637('0x58')]>0x0){return _0x5a23ef(_0x3c92c8[_0x7637('0xe')](0x1f4,_['map'](_0x6bc762,'message')[_0x7637('0x11')](',\x20')));}var _0x552505=_[_0x7637('0x5d')](_0x2159db['channels'],{'uniqueid':_0x3c9b59[_0x7637('0x5f')]});if(_0x552505){return BPromise[_0x7637('0x6e')]()['then'](function(){if(_0x552505[_0x7637('0x60')]){return ami[_0x7637('0x15')]({'action':_0x7637('0x6f'),'channel':_0x552505[_0x7637('0x60')],'mixmonitorid':_0x3c9b59['mixmonitorid']})[_0x7637('0x18')](function(_0x1f9963){});}})[_0x7637('0x16')](function(){if(_0x552505['destinationchannel']){return ami[_0x7637('0x15')]({'action':_0x7637('0x6f'),'channel':_0x552505['destinationchannel'],'mixmonitorid':_0x3c9b59[_0x7637('0x6b')]})[_0x7637('0x18')](function(_0x33aade){});}})[_0x7637('0x16')](function(_0x5c730a){var _0x443ffc=_[_0x7637('0x5d')](_0x552505[_0x7637('0x68')],{'mixmonitorid':_0x3c9b59[_0x7637('0x6b')]});if(_0x443ffc){_0x443ffc['status']='stop';}})['then'](function(){var _0x2a5305=util['format'](_0x7637('0x61'),_0x3c9b59[_0x7637('0x70')]||_0x3c9b59[_0x7637('0x5f')],_0x3c9b59['format']||_0x7637('0x62'));var _0x184bd5=_['find'](_0x552505[_0x7637('0x68')],{'filename':_0x7637('0x65')+_0x2a5305[_0x7637('0x66')]()});if(_0x184bd5){_0x184bd5[_0x7637('0x6d')]=_0x7637('0x71');}})[_0x7637('0x16')](function(){_0xfb2cc5({'code':0xc8,'message':[_0x3c9b59[_0x7637('0x5f')],_0x7637('0x72')][_0x7637('0x11')]('\x20')});})[_0x7637('0x18')](function(_0x200e50){_0x5a23ef(_0x3c92c8['error'](0x1f5,[_0x3c9b59[_0x7637('0x5f')],_0x200e50[_0x7637('0x17')][_0x7637('0x66')]()]['join']('\x20')));});}else{return _0x5a23ef(_0x3c92c8[_0x7637('0xe')](0x1f5,_0x7637('0x73')));}});},'VoiceQueuesChannels':function(_0x4b4a8b){return new Promise(function(_0x5743a3,_0x2f3de3){var _0x4b3067=_[_0x7637('0x57')](_0x2159db['queueChannels']);_0x5743a3({'count':_0x4b3067[_0x7637('0x58')],'rows':_0x4b3067});});},'VoiceQueuesChannel':function(_0x45f471){var _0x374025=this;return new Promise(function(_0xa5e3ed,_0x21cb25){var _0x4957aa=schema(properties[_0x7637('0x74')])[_0x7637('0x5b')](_0x45f471);if(_0x4957aa[_0x7637('0x58')]>0x0){return _0x21cb25(_0x374025[_0x7637('0xe')](0x1f4,_['map'](_0x4957aa,_0x7637('0x17'))[_0x7637('0x11')](',\x20')));}var _0x2a4342=_[_0x7637('0x5d')](_0x2159db['queueChannels'],{'uniqueid':_0x45f471[_0x7637('0x5f')]});if(_0x2a4342){_0xa5e3ed(_0x2a4342);}else{return _0x21cb25(_0x374025['error'](0x1f5,_0x7637('0x73')));}});},'VoiceQueuesChannelHangup':function(_0x584257){var _0x43e8b2=this;return new Promise(function(_0x39d814,_0x340213){if(ami[_0x7637('0x19')]()==![]){return _0x340213(_0x43e8b2[_0x7637('0xe')](0x1f4,[config[_0x7637('0xf')]['ip'],config['asterisk']['username'],_0x7637('0x59')][_0x7637('0x11')]('\x20')));}var _0x4e9dfc=schema(properties['voicequeuechannelhangup'])[_0x7637('0x5b')](_0x584257);if(_0x4e9dfc[_0x7637('0x58')]>0x0){return _0x340213(_0x43e8b2[_0x7637('0xe')](0x1f4,_[_0x7637('0x5c')](_0x4e9dfc,_0x7637('0x17'))[_0x7637('0x11')](',\x20')));}var _0x3c729c=_['find'](_0x2159db[_0x7637('0x75')],{'uniqueid':_0x584257['uniqueid']});if(_0x3c729c&&_0x3c729c[_0x7637('0x60')]){return ami[_0x7637('0x15')]({'action':'Hangup','channel':_0x3c729c[_0x7637('0x60')]})[_0x7637('0x16')](function(_0x5874c8){_0x39d814({'code':0xc8,'message':[_0x584257[_0x7637('0x5f')],_0x5874c8[_0x7637('0x17')][_0x7637('0x66')]()][_0x7637('0x11')]('\x20')});})[_0x7637('0x18')](function(_0x2a30f6){_0x340213(_0x43e8b2[_0x7637('0xe')](0x1f5,[_0x584257[_0x7637('0x5f')],_0x2a30f6[_0x7637('0x17')][_0x7637('0x66')]()]['join']('\x20')));});}else{return _0x340213(_0x43e8b2[_0x7637('0xe')](0x1f5,_0x7637('0x73')));}});},'VoiceQueuesChannelRedirect':function(_0x210e23){var _0x2946eb=this;return new Promise(function(_0x514228,_0x3ce382){if(ami[_0x7637('0x19')]()==![]){return _0x3ce382(_0x2946eb[_0x7637('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x7637('0xf')][_0x7637('0x10')],_0x7637('0x59')][_0x7637('0x11')]('\x20')));}var _0x5972ce=schema(properties[_0x7637('0x76')])[_0x7637('0x5b')](_0x210e23);if(_0x5972ce[_0x7637('0x58')]>0x0){return _0x3ce382(_0x2946eb[_0x7637('0xe')](0x1f4,_[_0x7637('0x5c')](_0x5972ce,'message')[_0x7637('0x11')](',\x20')));}var _0x16d8ab=_['find'](_0x2159db[_0x7637('0x75')],{'uniqueid':_0x210e23[_0x7637('0x5f')]});if(_0x16d8ab&&_0x16d8ab['channel']){return ami[_0x7637('0x15')]({'action':_0x7637('0x77'),'channel':_0x16d8ab['channel'],'exten':_0x210e23['exten'],'context':_0x210e23[_0x7637('0x78')]||_0x16d8ab['context'],'priority':0x1})[_0x7637('0x16')](function(_0x218ef9){_0x514228({'code':0xc8,'message':[_0x210e23[_0x7637('0x5f')],_0x218ef9[_0x7637('0x17')][_0x7637('0x66')]()]['join']('\x20')});})[_0x7637('0x18')](function(_0x1722ec){_0x3ce382(_0x2946eb['error'](0x1f5,[_0x210e23['uniqueid'],_0x1722ec['message'][_0x7637('0x66')]()][_0x7637('0x11')]('\x20')));});}else{return _0x3ce382(_0x2946eb[_0x7637('0xe')](0x1f5,_0x7637('0x73')));}});},'Agents':function(_0x4677d9){return new Promise(function(_0x3fc85e,_0x406bb6){var _0x515a51=_[_0x7637('0x57')](_0x2159db[_0x7637('0xa')]);_0x3fc85e({'count':_0x515a51['length'],'rows':_0x515a51});});},'Telephones':function(_0x7491d1){return new Promise(function(_0x2f819d,_0x43940a){var _0x39fa76=_['values'](_0x2159db[_0x7637('0x79')]);_0x2f819d({'count':_0x39fa76[_0x7637('0x58')],'rows':_0x39fa76});});},'Trunks':function(_0x58cdeb){return new Promise(function(_0x475142,_0x1b6857){var _0x72b6d6=_[_0x7637('0x57')](_0x2159db[_0x7637('0x7a')]);_0x475142({'count':_0x72b6d6[_0x7637('0x58')],'rows':_0x72b6d6});});},'OutboundChannels':function(_0x42db7){return new Promise(function(_0x454817,_0x5aeb7f){var _0x5f3fb8=_[_0x7637('0x57')](_0x2159db[_0x7637('0x7b')]);_0x454817({'count':_0x5f3fb8[_0x7637('0x58')],'rows':_0x5f3fb8});});},'Outbound':function(_0x23a19e){return new Promise(function(_0x3e882e,_0x111df6){_0x3e882e(_0x2159db[_0x7637('0x2d')]);});},'Campaigns':function(_0x51b437){return new Promise(function(_0x428aa1,_0x2646f0){var _0x252a25=_[_0x7637('0x57')](_0x2159db[_0x7637('0x7c')]);_0x428aa1({'count':_0x252a25['length'],'rows':_0x252a25});});},'VoiceQueuesPreview':function(_0x23008e){var _0x1d5ece=this;return new Promise(function(_0x54c53b,_0x538283){_0x3c7ed8[_0x7637('0x7d')](_0x23008e['id'])['then'](function(_0x206bba){_0x54c53b({'code':0xc8,'message':_0x206bba[_0x7637('0x17')]});})[_0x7637('0x18')](function(_0x44b6ca){_0x538283(_0x1d5ece[_0x7637('0xe')](0x1f4,_0x44b6ca['message']));});});},'EventManager':function(_0x3c36e6){var _0x1b0cb8=this;return new Promise(function(_0x1ced8b,_0x4427a5){if(!_0x3c36e6['event']){return _0x4427a5(_0x1b0cb8['error'](0x1f4,_0x7637('0x7e')));}ami[_0x7637('0x7f')](_0x7637('0x80')+_0x3c36e6[_0x7637('0x81')],_0x3c36e6[_0x7637('0x17')]);_0x1ced8b({'code':0xc8,'message':_0x3c36e6});});},'FaxAccounts':function(_0x89d684){return new Promise(function(_0x883f4b,_0x299b16){var _0x12c186=_['values'](_0x2159db[_0x7637('0x82')]);_0x883f4b({'count':_0x12c186[_0x7637('0x58')],'rows':_0x12c186});});},'SendFax':function(_0x12cb92){var _0x118705=this;return new Promise(function(_0x2007be,_0x55d7f5){_0x1fe2f9[_0x7637('0x83')](_0x12cb92)[_0x7637('0x16')](function(_0x38b20f){_0x2007be({'code':0xc8,'message':_0x38b20f['message']});})[_0x7637('0x18')](function(_0x3d4c5d){_0x55d7f5(_0x118705[_0x7637('0xe')](0x1f4,_0x3d4c5d[_0x7637('0x17')]));});});},'CheckAfterSend':function(_0x1e8c82){var _0x172d77=this;return new Promise(function(_0x4dcac8,_0xd8e0e5){_0x1fe2f9[_0x7637('0x84')](_0x1e8c82)['then'](function(_0x9e9ca6){_0x4dcac8({'code':0xc8,'message':_0x9e9ca6[_0x7637('0x17')]});})[_0x7637('0x18')](function(_0x5ec6a4){_0xd8e0e5(_0x172d77['error'](0x1f4,_0x5ec6a4['message']));});});}};var _0xcac3d0=jayson[_0x7637('0x85')](_0x544556)['http']();_0xcac3d0['on'](_0x7637('0xe'),function(_0x3b32de){return _0xa1b15f(_0x3b32de);});_0xcac3d0[_0x7637('0x6')](0x232a,_0x7637('0x86'),function(){console[_0x7637('0x87')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x1a6fc4('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x7585=['rec','MixMonitor\x20Success','catch','Channel\x20doesn\x27t\x20exist','StopMixMonitor','stop','wav','status','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','join','pick','keys','module','action','Reload','Action','message','error','isConnected','ami\x20disconnected','command','Command','then','content','hasOwnProperty','voiceQueues','available','pTalking','sumBillable','talking','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','push','length','values','channels','voicechannel','map','uniqueid','channel','ai(mixmonitorid)','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7585,0x1b0));var _0x5758=function(_0x1655cd,_0x18e34f){_0x1655cd=_0x1655cd-0x0;var _0x6c6065=_0x7585[_0x1655cd];return _0x6c6065;};'use strict';var _=require('lodash');var util=require(_0x5758('0x0'));var jayson=require(_0x5758('0x1'));var schema=require(_0x5758('0x2'));var BPromise=require(_0x5758('0x3'));var moment=require(_0x5758('0x4'));var config=require(_0x5758('0x5'));var properties=require(_0x5758('0x6'));var ami=require(_0x5758('0x7'));exports[_0x5758('0x8')]=function(_0x195a6c,_0x55ee6c,_0x1fedfd){return new BPromise(function(_0x518696,_0x40c99c){var _0x1cd473={'QueuePause':function(_0x43e4d2){return new Promise(function(_0x55fccc,_0x5da05d){var _0x6d2daa=util[_0x5758('0x9')](_0x5758('0xa'),_0x5758('0xb'),_0x43e4d2[_0x5758('0xc')]);if(_0x195a6c[_0x5758('0xd')]&&_0x195a6c[_0x5758('0xd')][_0x6d2daa]&&_0x195a6c[_0x5758('0xd')][_0x6d2daa]['timer']){_0x195a6c[_0x5758('0xd')][_0x6d2daa][_0x5758('0xe')]();}if(_0x195a6c[_0x5758('0xf')][_0x6d2daa]){_0x195a6c[_0x5758('0xf')][_0x6d2daa][_0x5758('0x10')]({'statePause':_0x43e4d2[_0x5758('0x11')]?!![]:![]});}_0x55fccc({'code':0xc8,'message':_0x5758('0x12')});});},'Reload':function(_0x1a93f9){var _0x430eb6=this;return new Promise(function(_0x1c2510,_0x1247b0){if(ami['isConnected']()==![]){return _0x1247b0(_0x430eb6['error'](0x1f4,[config[_0x5758('0x13')]['ip'],config[_0x5758('0x13')][_0x5758('0x14')],'ami\x20disconnected'][_0x5758('0x15')]('\x20')));}_0x1a93f9=_[_0x5758('0x16')](_0x1a93f9,_[_0x5758('0x17')](properties[_0x5758('0x18')]));_0x1a93f9[_0x5758('0x19')]=_0x5758('0x1a');return ami[_0x5758('0x1b')](_0x1a93f9)['then'](function(_0x335cd5){_0x1c2510({'code':0xc8,'message':_0x335cd5[_0x5758('0x1c')]});})['catch'](function(_0x24616e){_0x1247b0(_0x430eb6[_0x5758('0x1d')](0x1f5,_0x24616e[_0x5758('0x1c')]));});});},'Command':function(_0x4a3e40){var _0x3444fd=this;return new Promise(function(_0x3bc22f,_0x45e2b2){if(ami[_0x5758('0x1e')]()==![]){return _0x45e2b2(_0x3444fd[_0x5758('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0x5758('0x13')]['username'],_0x5758('0x1f')]['join']('\x20')));}_0x4a3e40=_['pick'](_0x4a3e40,_0x5758('0x20'));_0x4a3e40[_0x5758('0x19')]=_0x5758('0x21');return ami[_0x5758('0x1b')](_0x4a3e40)[_0x5758('0x22')](function(_0x1c5f9e){_0x3bc22f({'code':0xc8,'message':_0x1c5f9e[_0x5758('0x23')]});})['catch'](function(_0x50a691){_0x45e2b2(_0x3444fd[_0x5758('0x1d')](0x1f5,_0x50a691['message']));});});},'VoiceQueues':function(_0xc7bbb5){return new Promise(function(_0x2907d6,_0x15dce7){var _0xf36fce=[];for(var _0x3c9b99 in _0x195a6c['voiceQueues']){if(_0x195a6c['voiceQueues'][_0x5758('0x24')](_0x3c9b99)){var _0x461092=_0x195a6c[_0x5758('0x25')][_0x3c9b99];var _0x1ba7aa={'id':_0x461092['id'],'name':_0x461092[_0x5758('0xc')],'strategy':_0x461092['strategy'],'answered':_0x461092['answered'],'available':_0x461092[_0x5758('0x26')],'loggedIn':_0x461092['loggedIn'],'pTalking':_0x461092[_0x5758('0x27')],'sumBillable':_0x461092[_0x5758('0x28')],'sumDuration':_0x461092['sumDuration'],'sumHoldTime':_0x461092['sumHoldTime']||0x0,'talking':_0x461092[_0x5758('0x29')],'total':_0x461092['total'],'type':_0x461092[_0x5758('0x2a')],'unmanaged':_0x461092[_0x5758('0x2b')],'abandoned':_0x461092[_0x5758('0x2c')],'waiting':_0x461092[_0x5758('0x2d')],'loggedInDb':_0x461092[_0x5758('0x2e')]};if(_0x461092[_0x5758('0x2a')]==='outbound'){_0x1ba7aa[_0x5758('0x2f')]=_0x461092[_0x5758('0x2f')];_0x1ba7aa[_0x5758('0x30')]=_0x461092[_0x5758('0x30')];_0x1ba7aa[_0x5758('0x31')]=_0x461092[_0x5758('0x31')];_0x1ba7aa['dialOriginateCallerIdNumber']=_0x461092['dialOriginateCallerIdNumber'];_0x1ba7aa['dialOriginateTimeout']=_0x461092[_0x5758('0x32')];_0x1ba7aa[_0x5758('0x33')]=_0x461092[_0x5758('0x33')];_0x1ba7aa['outboundAnswerAgiCallsDay']=_0x461092[_0x5758('0x34')];_0x1ba7aa['outboundAnswerCallsDay']=_0x461092[_0x5758('0x35')];_0x1ba7aa[_0x5758('0x36')]=_0x461092['outboundBlacklistCallsDay'];_0x1ba7aa[_0x5758('0x37')]=_0x461092['outboundBusyCallsDay'];_0x1ba7aa[_0x5758('0x38')]=_0x461092['outboundCongestionCallsDay'];_0x1ba7aa[_0x5758('0x39')]=_0x461092[_0x5758('0x39')];_0x1ba7aa['outboundDropCallsDayCallersExit']=_0x461092[_0x5758('0x3a')];_0x1ba7aa['outboundDropCallsDayTimeout']=_0x461092['outboundDropCallsDayTimeout'];_0x1ba7aa['outboundNoAnswerCallsDay']=_0x461092[_0x5758('0x3b')];_0x1ba7aa['outboundNoSuchCallsDay']=_0x461092['outboundNoSuchCallsDay'];_0x1ba7aa[_0x5758('0x3c')]=_0x461092['outboundOriginateFailureCallsDay'];_0x1ba7aa[_0x5758('0x3d')]=_0x461092[_0x5758('0x3d')];_0x1ba7aa[_0x5758('0x3e')]=_0x461092[_0x5758('0x3e')];_0x1ba7aa['outboundUnknownCallsDay']=_0x461092[_0x5758('0x3f')];_0x1ba7aa[_0x5758('0x40')]=_0x461092[_0x5758('0x40')];_0x1ba7aa[_0x5758('0x41')]=_0x461092[_0x5758('0x41')];_0x1ba7aa[_0x5758('0x42')]=_0x461092[_0x5758('0x42')];_0x1ba7aa[_0x5758('0x43')]=_0x461092['predictiveIntervalDroppedCallsCallersExit'];_0x1ba7aa[_0x5758('0x44')]=_0x461092[_0x5758('0x44')];_0x1ba7aa[_0x5758('0x45')]=_0x461092[_0x5758('0x45')];_0x1ba7aa['predictiveIntervalErlangCallsDroppedCalls']=_0x461092['predictiveIntervalErlangCallsDroppedCalls'];_0x1ba7aa[_0x5758('0x46')]=_0x461092[_0x5758('0x46')];_0x1ba7aa[_0x5758('0x47')]=_0x461092[_0x5758('0x47')];_0x1ba7aa[_0x5758('0x48')]=_0x461092['predictiveIntervalPauses'];_0x1ba7aa[_0x5758('0x49')]=_0x461092[_0x5758('0x49')];_0x1ba7aa[_0x5758('0x4a')]=_0x461092[_0x5758('0x4a')];_0x1ba7aa[_0x5758('0x1c')]=_0x461092['message'];_0x1ba7aa[_0x5758('0x4b')]=_0x461092['originated'];_0x1ba7aa[_0x5758('0x4c')]=_0x461092[_0x5758('0x4c')];_0x1ba7aa[_0x5758('0x4d')]=_0x461092['erlangCallToSecond'];_0x1ba7aa[_0x5758('0x4e')]=_0x461092[_0x5758('0x4e')];_0x1ba7aa[_0x5758('0x4f')]=_0x461092[_0x5758('0x4f')];_0x1ba7aa[_0x5758('0x50')]=_0x461092[_0x5758('0x50')];_0x1ba7aa['startProgressive']=_0x461092['startProgressive'];}if(_0x461092['Trunk']){_0x1ba7aa[_0x5758('0x51')]={'id':_0x461092['Trunk']['id'],'name':_0x461092['Trunk'][_0x5758('0xc')],'active':_0x461092[_0x5758('0x51')]['active'],'callerid':_0x461092[_0x5758('0x51')][_0x5758('0x52')]};}if(_0x461092[_0x5758('0x53')]){_0x1ba7aa[_0x5758('0x53')]={'id':_0x461092['Interval']['id'],'name':_0x461092[_0x5758('0x53')][_0x5758('0xc')]};}_0xf36fce[_0x5758('0x54')](_0x1ba7aa);}}_0x2907d6({'count':_0xf36fce[_0x5758('0x55')],'rows':_0xf36fce});});},'VoiceChannels':function(_0x3602cd){return new Promise(function(_0x214161,_0x9abb98){var _0x5113bd=_[_0x5758('0x56')](_0x195a6c[_0x5758('0x57')]);_0x214161({'count':_0x5113bd['length'],'rows':_0x5113bd});});},'VoiceChannelMixMonitor':function(_0x4f115e){var _0x40364f=this;return new Promise(function(_0x288fc3,_0x5ca527){if(ami[_0x5758('0x1e')]()==![]){return _0x5ca527(_0x40364f[_0x5758('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0x5758('0x13')][_0x5758('0x14')],_0x5758('0x1f')][_0x5758('0x15')]('\x20')));}var _0x3fed37=schema(properties[_0x5758('0x58')])[_0x5758('0x2')](_0x4f115e);if(_0x3fed37[_0x5758('0x55')]>0x0){return _0x5ca527(_0x40364f['error'](0x1f4,_[_0x5758('0x59')](_0x3fed37,'message')[_0x5758('0x15')](',\x20')));}var _0x25e6c3=_['find'](_0x195a6c[_0x5758('0x57')],{'uniqueid':_0x4f115e[_0x5758('0x5a')]});if(_0x25e6c3&&_0x25e6c3[_0x5758('0x5b')]){var _0x319423=util[_0x5758('0x9')]('%s.%s',_0x4f115e['filename']||_0x4f115e[_0x5758('0x5a')],_0x4f115e[_0x5758('0x9')]||'wav');return ami[_0x5758('0x1b')]({'action':'MixMonitor','channel':_0x25e6c3[_0x5758('0x5b')],'file':_0x319423,'options':_0x5758('0x5c')})[_0x5758('0x22')](function(_0x2b990a){var _0x5558f1=_[_0x5758('0x5d')](_0x25e6c3[_0x5758('0x5e')],{'filename':_0x5758('0x5f')+_0x319423[_0x5758('0x60')]()});if(_[_0x5758('0x61')](_0x5558f1)){_0x25e6c3[_0x5758('0x5e')][_0x5758('0x54')]({'filename':_0x5758('0x5f')+_0x319423['toLowerCase'](),'createdAt':moment()['format'](_0x5758('0x62')),'mixmonitorid':_0x2b990a[_0x5758('0x63')],'status':_0x5758('0x64')});}else{_0x5558f1[_0x5758('0x63')]=_0x2b990a[_0x5758('0x63')];_0x5558f1['status']=_0x5758('0x64');}_0x288fc3({'code':0xc8,'message':[_0x4f115e[_0x5758('0x5a')],_0x5758('0x65'),_0x2b990a[_0x5758('0x63')]][_0x5758('0x15')]('\x20'),'mixmonitorid':_0x2b990a[_0x5758('0x63')]});})[_0x5758('0x66')](function(_0x1c639b){_0x5ca527(_0x40364f['error'](0x1f5,[_0x4f115e[_0x5758('0x5a')],_0x1c639b[_0x5758('0x1c')][_0x5758('0x60')]()][_0x5758('0x15')]('\x20')));});}else{return _0x5ca527(_0x40364f['error'](0x1f5,_0x5758('0x67')));}});},'VoiceChannelStopMixMonitor':function(_0x4ef7ed){var _0x194b23=this;return new Promise(function(_0x28c45d,_0x32d907){if(ami['isConnected']()==![]){return _0x32d907(_0x194b23[_0x5758('0x1d')](0x1f4,[config[_0x5758('0x13')]['ip'],config['asterisk']['username'],_0x5758('0x1f')][_0x5758('0x15')]('\x20')));}var _0x41c7bf=schema(properties['voicechannel'])[_0x5758('0x2')](_0x4ef7ed);if(_0x41c7bf['length']>0x0){return _0x32d907(_0x194b23[_0x5758('0x1d')](0x1f4,_[_0x5758('0x59')](_0x41c7bf,_0x5758('0x1c'))[_0x5758('0x15')](',\x20')));}var _0x13579a=_[_0x5758('0x5d')](_0x195a6c['channels'],{'uniqueid':_0x4ef7ed['uniqueid']});if(_0x13579a){return BPromise['resolve']()[_0x5758('0x22')](function(){if(_0x13579a[_0x5758('0x5b')]){return ami[_0x5758('0x1b')]({'action':_0x5758('0x68'),'channel':_0x13579a[_0x5758('0x5b')],'mixmonitorid':_0x4ef7ed[_0x5758('0x63')]})['catch'](function(_0xf0ecac){});}})[_0x5758('0x22')](function(){if(_0x13579a['destinationchannel']){return ami['Action']({'action':_0x5758('0x68'),'channel':_0x13579a['destinationchannel'],'mixmonitorid':_0x4ef7ed[_0x5758('0x63')]})[_0x5758('0x66')](function(_0x4f66fd){});}})[_0x5758('0x22')](function(_0x438f9f){var _0x19ecdb=_[_0x5758('0x5d')](_0x13579a['monitors'],{'mixmonitorid':_0x4ef7ed['mixmonitorid']});if(_0x19ecdb){_0x19ecdb['status']=_0x5758('0x69');}})[_0x5758('0x22')](function(){var _0x495f59=util[_0x5758('0x9')]('%s.%s',_0x4ef7ed['filename']||_0x4ef7ed[_0x5758('0x5a')],_0x4ef7ed[_0x5758('0x9')]||_0x5758('0x6a'));var _0x1f4958=_[_0x5758('0x5d')](_0x13579a['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x495f59['toLowerCase']()});if(_0x1f4958){_0x1f4958[_0x5758('0x6b')]=_0x5758('0x69');}})[_0x5758('0x22')](function(){_0x28c45d({'code':0xc8,'message':[_0x4ef7ed[_0x5758('0x5a')],_0x5758('0x6c')][_0x5758('0x15')]('\x20')});})[_0x5758('0x66')](function(_0x344495){_0x32d907(_0x194b23[_0x5758('0x1d')](0x1f5,[_0x4ef7ed[_0x5758('0x5a')],_0x344495[_0x5758('0x1c')][_0x5758('0x60')]()]['join']('\x20')));});}else{return _0x32d907(_0x194b23[_0x5758('0x1d')](0x1f5,_0x5758('0x67')));}});},'VoiceQueuesChannels':function(_0xd1a1b6){return new Promise(function(_0x507785,_0x36b170){var _0x2c1667=_[_0x5758('0x56')](_0x195a6c[_0x5758('0x6d')]);_0x507785({'count':_0x2c1667[_0x5758('0x55')],'rows':_0x2c1667});});},'VoiceQueuesChannel':function(_0x57f529){var _0x4a7a94=this;return new Promise(function(_0x2acc93,_0x105f9f){var _0x113c77=schema(properties[_0x5758('0x6e')])[_0x5758('0x2')](_0x57f529);if(_0x113c77[_0x5758('0x55')]>0x0){return _0x105f9f(_0x4a7a94[_0x5758('0x1d')](0x1f4,_[_0x5758('0x59')](_0x113c77,_0x5758('0x1c'))['join'](',\x20')));}var _0x5eea5f=_[_0x5758('0x5d')](_0x195a6c[_0x5758('0x6d')],{'uniqueid':_0x57f529['uniqueid']});if(_0x5eea5f){_0x2acc93(_0x5eea5f);}else{return _0x105f9f(_0x4a7a94[_0x5758('0x1d')](0x1f5,_0x5758('0x67')));}});},'VoiceQueuesChannelHangup':function(_0x39d47f){var _0x465a5f=this;return new Promise(function(_0x39bc2d,_0x4d0570){if(ami[_0x5758('0x1e')]()==![]){return _0x4d0570(_0x465a5f[_0x5758('0x1d')](0x1f4,[config[_0x5758('0x13')]['ip'],config[_0x5758('0x13')][_0x5758('0x14')],'ami\x20disconnected'][_0x5758('0x15')]('\x20')));}var _0x36f051=schema(properties[_0x5758('0x6f')])['validate'](_0x39d47f);if(_0x36f051[_0x5758('0x55')]>0x0){return _0x4d0570(_0x465a5f[_0x5758('0x1d')](0x1f4,_[_0x5758('0x59')](_0x36f051,_0x5758('0x1c'))[_0x5758('0x15')](',\x20')));}var _0x3a1d3a=_[_0x5758('0x5d')](_0x195a6c['queueChannels'],{'uniqueid':_0x39d47f[_0x5758('0x5a')]});if(_0x3a1d3a&&_0x3a1d3a['channel']){return ami[_0x5758('0x1b')]({'action':_0x5758('0x70'),'channel':_0x3a1d3a[_0x5758('0x5b')]})[_0x5758('0x22')](function(_0x2c8d82){_0x39bc2d({'code':0xc8,'message':[_0x39d47f[_0x5758('0x5a')],_0x2c8d82['message'][_0x5758('0x60')]()]['join']('\x20')});})['catch'](function(_0x5a10f3){_0x4d0570(_0x465a5f['error'](0x1f5,[_0x39d47f[_0x5758('0x5a')],_0x5a10f3[_0x5758('0x1c')][_0x5758('0x60')]()]['join']('\x20')));});}else{return _0x4d0570(_0x465a5f[_0x5758('0x1d')](0x1f5,_0x5758('0x67')));}});},'VoiceQueuesChannelRedirect':function(_0x15fd6b){var _0x40c6d7=this;return new Promise(function(_0x5583b3,_0x4875ef){if(ami['isConnected']()==![]){return _0x4875ef(_0x40c6d7[_0x5758('0x1d')](0x1f4,[config[_0x5758('0x13')]['ip'],config[_0x5758('0x13')][_0x5758('0x14')],_0x5758('0x1f')][_0x5758('0x15')]('\x20')));}var _0x26b52f=schema(properties[_0x5758('0x71')])[_0x5758('0x2')](_0x15fd6b);if(_0x26b52f[_0x5758('0x55')]>0x0){return _0x4875ef(_0x40c6d7[_0x5758('0x1d')](0x1f4,_[_0x5758('0x59')](_0x26b52f,_0x5758('0x1c'))[_0x5758('0x15')](',\x20')));}var _0x10e090=_['find'](_0x195a6c[_0x5758('0x6d')],{'uniqueid':_0x15fd6b['uniqueid']});if(_0x10e090&&_0x10e090[_0x5758('0x5b')]){return ami['Action']({'action':_0x5758('0x72'),'channel':_0x10e090[_0x5758('0x5b')],'exten':_0x15fd6b[_0x5758('0x73')],'context':_0x15fd6b['context']||_0x10e090[_0x5758('0x74')],'priority':0x1})[_0x5758('0x22')](function(_0x5517a3){_0x5583b3({'code':0xc8,'message':[_0x15fd6b[_0x5758('0x5a')],_0x5517a3[_0x5758('0x1c')][_0x5758('0x60')]()]['join']('\x20')});})[_0x5758('0x66')](function(_0x1435e1){_0x4875ef(_0x40c6d7[_0x5758('0x1d')](0x1f5,[_0x15fd6b[_0x5758('0x5a')],_0x1435e1[_0x5758('0x1c')][_0x5758('0x60')]()]['join']('\x20')));});}else{return _0x4875ef(_0x40c6d7['error'](0x1f5,_0x5758('0x67')));}});},'Agents':function(_0x489bc2){return new Promise(function(_0x388a42,_0x881e2c){var _0x592050=_[_0x5758('0x56')](_0x195a6c[_0x5758('0xf')]);_0x388a42({'count':_0x592050[_0x5758('0x55')],'rows':_0x592050});});},'Telephones':function(_0x339b83){return new Promise(function(_0x5c653a,_0x3c6580){var _0x325e6f=_[_0x5758('0x56')](_0x195a6c[_0x5758('0x75')]);_0x5c653a({'count':_0x325e6f['length'],'rows':_0x325e6f});});},'Trunks':function(_0xbbc3ac){return new Promise(function(_0x589999,_0x3cd24d){var _0x3ae096=_['values'](_0x195a6c[_0x5758('0x76')]);_0x589999({'count':_0x3ae096[_0x5758('0x55')],'rows':_0x3ae096});});},'OutboundChannels':function(_0x240a14){return new Promise(function(_0x3cef47,_0xa5ac16){var _0x1df9dc=_[_0x5758('0x56')](_0x195a6c[_0x5758('0x77')]);_0x3cef47({'count':_0x1df9dc['length'],'rows':_0x1df9dc});});},'Outbound':function(_0x17c7e8){return new Promise(function(_0x23cce6,_0x578516){_0x23cce6(_0x195a6c['outbound']);});},'Campaigns':function(_0x2e4229){return new Promise(function(_0x481ef0,_0x47c6df){var _0x4c58b1=_[_0x5758('0x56')](_0x195a6c[_0x5758('0x78')]);_0x481ef0({'count':_0x4c58b1[_0x5758('0x55')],'rows':_0x4c58b1});});},'VoiceQueuesPreview':function(_0x41d24a){var _0x30eb9a=this;return new Promise(function(_0x111349,_0x43c811){_0x55ee6c[_0x5758('0x79')](_0x41d24a['id'])[_0x5758('0x22')](function(_0x3859a4){_0x111349({'code':0xc8,'message':_0x3859a4[_0x5758('0x1c')]});})['catch'](function(_0x587db1){_0x43c811(_0x30eb9a[_0x5758('0x1d')](0x1f4,_0x587db1[_0x5758('0x1c')]));});});},'EventManager':function(_0x50697a){var _0x3c0ca4=this;return new Promise(function(_0x3958bc,_0x2af14b){if(!_0x50697a[_0x5758('0x7a')]){return _0x2af14b(_0x3c0ca4[_0x5758('0x1d')](0x1f4,_0x5758('0x7b')));}ami[_0x5758('0x7c')](_0x5758('0x7d')+_0x50697a[_0x5758('0x7a')],_0x50697a['message']);_0x3958bc({'code':0xc8,'message':_0x50697a});});},'FaxAccounts':function(_0x4dd9fd){return new Promise(function(_0x1f2667,_0x3d2438){var _0x501099=_[_0x5758('0x56')](_0x195a6c[_0x5758('0x7e')]);_0x1f2667({'count':_0x501099[_0x5758('0x55')],'rows':_0x501099});});},'SendFax':function(_0x5b4f68){var _0x383368=this;return new Promise(function(_0x26b9c0,_0xc3a0bd){_0x1fedfd[_0x5758('0x7f')](_0x5b4f68)[_0x5758('0x22')](function(_0x1d2de8){_0x26b9c0({'code':0xc8,'message':_0x1d2de8[_0x5758('0x1c')]});})[_0x5758('0x66')](function(_0x139dd2){_0xc3a0bd(_0x383368['error'](0x1f4,_0x139dd2[_0x5758('0x1c')]));});});},'CheckAfterSend':function(_0x10ea21){var _0x5cb9bc=this;return new Promise(function(_0x358386,_0x40c657){_0x1fedfd[_0x5758('0x80')](_0x10ea21)['then'](function(_0x5f10cc){_0x358386({'code':0xc8,'message':_0x5f10cc['message']});})[_0x5758('0x66')](function(_0x3a07af){_0x40c657(_0x5cb9bc[_0x5758('0x1d')](0x1f4,_0x3a07af[_0x5758('0x1c')]));});});}};var _0x3e5b58=jayson['server'](_0x1cd473)[_0x5758('0x81')]();_0x3e5b58['on'](_0x5758('0x1d'),function(_0x2254cc){return _0x40c99c(_0x2254cc);});_0x3e5b58[_0x5758('0x8')](0x232a,'127.0.0.1',function(){console[_0x5758('0x82')](_0x5758('0x83'),0x232a);return _0x518696(_0x5758('0x84')+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 dda42c5..6d2bfd8 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 _0x0c13=['merge','lodash','bluebird','ioredis','../../../../config/environment','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','then','isEmpty','length','info','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','','destcalleridname','Unknown','resolve','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','trigger:%s','action','toLowerCase'];(function(_0x14a408,_0x275ed){var _0x81577d=function(_0x374106){while(--_0x374106){_0x14a408['push'](_0x14a408['shift']());}};_0x81577d(++_0x275ed);}(_0x0c13,0x10f));var _0x30c1=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x0c13[_0x32f9ca];return _0x52e083;};'use strict';var _=require(_0x30c1('0x0'));var BPromise=require(_0x30c1('0x1'));var Redis=require(_0x30c1('0x2'));var util=require('util');var config=require(_0x30c1('0x3'));var logger=require('../../../../config/logger')(_0x30c1('0x4'));var cmContactRpc=require(_0x30c1('0x5'));config[_0x30c1('0x6')]=_['defaults'](config[_0x30c1('0x6')],{'host':_0x30c1('0x7'),'port':0x18eb});var io=require(_0x30c1('0x8'))(new Redis(config[_0x30c1('0x6')]));function emit(_0x1181fa,_0x4cc60b,_0x257223,_0x2f9c86,_0x17bc44){logger['info'](_0x30c1('0x9'),_0x1181fa,_0x4cc60b['id'],_0x257223,_0x2f9c86,JSON[_0x30c1('0xa')](_0x17bc44));io['to'](_0x257223)['emit'](_0x2f9c86,_0x17bc44);}exports['exec']=function(_0x4566f9,_0x45564d,_0x562a43,_0x4ccc8d){var _0x5dfcd4,_0x4f8588;var _0x213806={};var _0x14ae67=Number(_0x562a43[_0x30c1('0xb')]);var _0x380500=_0x562a43[_0x30c1('0xc')]?Boolean(Number(_0x562a43[_0x30c1('0xc')])):![];var _0x2a16b8;if(_0x4ccc8d[_0x30c1('0xd')]){_0x213806['id']=_0x4ccc8d[_0x30c1('0xd')];}if(!_0x213806['id']){_0x213806[_0x30c1('0xe')]=_0x14ae67;_0x2a16b8=_0x562a43[_0x30c1('0xf')]&&_0x562a43[_0x30c1('0xf')]!=='0'?_0x562a43[_0x30c1('0xf')][_0x30c1('0x10')](','):[_0x30c1('0x11')];_0x213806[_0x30c1('0x12')]=_[_0x30c1('0x13')](_0x2a16b8,function(_0x3c689e){var _0x4dd326={};_0x4dd326[_0x3c689e]=_0x4ccc8d['routeId']?_0x4ccc8d[_0x30c1('0x14')]:_0x4ccc8d[_0x30c1('0x15')];return _0x4dd326;});}var _0x46ddde=['id',_0x30c1('0x16'),_0x30c1('0x17'),_0x30c1('0x11'),'mobile',_0x30c1('0x18'),_0x30c1('0xe'),_0x30c1('0x19'),_0x30c1('0x1a'),_0x30c1('0x1b')];var _0x332f30=_[_0x30c1('0x1c')](_0x46ddde,_0x2a16b8);BPromise['resolve']()[_0x30c1('0x1d')](cmContactRpc['getContacts']({'attributes':_0x332f30,'where':_0x213806}))[_0x30c1('0x1d')](function(_0x3dd234){_0x4f8588=_0x3dd234;if(!_[_0x30c1('0x1e')](_0x4f8588)){if(_0x4f8588[_0x30c1('0x1f')]===0x1){_0x5dfcd4=_0x4f8588[0x0];logger[_0x30c1('0x20')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x4ccc8d['uniqueid'],_0x45564d['id'],_0x5dfcd4['id']);}else{logger[_0x30c1('0x20')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4ccc8d[_0x30c1('0x21')],_0x45564d['id'],_[_0x30c1('0x13')](_0x4f8588,'id')[_0x30c1('0x22')](','));}return;}else{logger['info'](_0x30c1('0x23'),_0x4ccc8d['uniqueid'],_0x45564d['id']);var _0x448a86={'ListId':_0x14ae67};var _0x4314c3=_0x562a43[_0x30c1('0x24')]&&_0x562a43[_0x30c1('0x24')]!=='0'?_0x562a43[_0x30c1('0x24')]:_0x30c1('0x11');if(_0x380500){logger[_0x30c1('0x20')](_0x30c1('0x25'),_0x4ccc8d[_0x30c1('0x21')],_0x45564d['id']);_0x448a86[_0x4314c3]=_[_0x30c1('0x26')](_0x4ccc8d[_0x30c1('0x27')])?_0x4ccc8d[_0x30c1('0x15')]:_0x4ccc8d[_0x30c1('0x14')];if(_[_0x30c1('0x26')](_0x4ccc8d[_0x30c1('0x27')])){_0x448a86['firstName']=_0x4ccc8d[_0x30c1('0x28')]&&_0x4ccc8d[_0x30c1('0x28')]!==_0x30c1('0x29')?_0x4ccc8d[_0x30c1('0x28')]:'Unknown';}else{_0x448a86['firstName']=_0x4ccc8d[_0x30c1('0x2a')]&&_0x4ccc8d[_0x30c1('0x2a')]!==_0x30c1('0x29')?_0x4ccc8d['destcalleridname']:_0x30c1('0x2b');}return BPromise[_0x30c1('0x2c')]()[_0x30c1('0x1d')](cmContactRpc['createContact'](_0x448a86))[_0x30c1('0x1d')](function(_0x3867da){_0x5dfcd4=_0x3867da;_0x4f8588['push'](_0x3867da);if(_0x5dfcd4){logger[_0x30c1('0x20')](_0x30c1('0x2d'),_0x4ccc8d[_0x30c1('0x21')],_0x45564d['id'],_0x5dfcd4['id']);}return;});}else{logger[_0x30c1('0x20')](_0x30c1('0x2e'),_0x4ccc8d[_0x30c1('0x21')],_0x45564d['id']);_0x448a86[_0x4314c3]=_[_0x30c1('0x26')](_0x4ccc8d[_0x30c1('0x27')])?_0x4ccc8d[_0x30c1('0x15')]:_0x4ccc8d['destcalleridnum'];if(_[_0x30c1('0x26')](_0x4ccc8d[_0x30c1('0x27')])){_0x448a86[_0x30c1('0x16')]=_0x4ccc8d[_0x30c1('0x28')]&&_0x4ccc8d[_0x30c1('0x28')]!==_0x30c1('0x29')?_0x4ccc8d[_0x30c1('0x28')]:_0x30c1('0x2b');}else{_0x448a86[_0x30c1('0x16')]=_0x4ccc8d[_0x30c1('0x2a')]&&_0x4ccc8d[_0x30c1('0x2a')]!==_0x30c1('0x29')?_0x4ccc8d['destcalleridname']:_0x30c1('0x2b');}_0x5dfcd4=_0x448a86;_0x4f8588[_0x30c1('0x2f')](_0x448a86);return;}}})[_0x30c1('0x1d')](function(){if(_0x4566f9){emit(_0x4ccc8d['uniqueid'],_0x45564d,util[_0x30c1('0x30')](_0x30c1('0x31'),_0x4566f9['name']),util[_0x30c1('0x30')](_0x30c1('0x32'),_0x562a43[_0x30c1('0x33')][_0x30c1('0x34')]()),{'evt':_[_0x30c1('0x35')](_0x4ccc8d,{'autoCreate':_0x380500}),'contact':_0x5dfcd4===undefined?{}:_0x5dfcd4,'contacts':_0x4f8588[_0x30c1('0x1f')]===0x0?undefined:_0x4f8588});}});}; \ No newline at end of file +var _0x5221=['mobile','fax','ListId','updatedAt','union','resolve','getContacts','then','isEmpty','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','calleridname','Unknown','firstName','destcalleridname','','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','data3','split','phone','map','routeId','destcalleridnum','lastName'];(function(_0x444bd5,_0x1150da){var _0x3fe6c7=function(_0x2336da){while(--_0x2336da){_0x444bd5['push'](_0x444bd5['shift']());}};_0x3fe6c7(++_0x1150da);}(_0x5221,0x1f0));var _0x1522=function(_0x5f1332,_0x4d2792){_0x5f1332=_0x5f1332-0x0;var _0x5d3947=_0x5221[_0x5f1332];return _0x5d3947;};'use strict';var _=require(_0x1522('0x0'));var BPromise=require(_0x1522('0x1'));var Redis=require(_0x1522('0x2'));var util=require(_0x1522('0x3'));var config=require(_0x1522('0x4'));var logger=require(_0x1522('0x5'))(_0x1522('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x1522('0x7')]=_[_0x1522('0x8')](config[_0x1522('0x7')],{'host':_0x1522('0x9'),'port':0x18eb});var io=require(_0x1522('0xa'))(new Redis(config['redis']));function emit(_0x23077a,_0x190e49,_0xd25db0,_0x307c31,_0xb8b723){logger[_0x1522('0xb')](_0x1522('0xc'),_0x23077a,_0x190e49['id'],_0xd25db0,_0x307c31,JSON[_0x1522('0xd')](_0xb8b723));io['to'](_0xd25db0)[_0x1522('0xe')](_0x307c31,_0xb8b723);}exports[_0x1522('0xf')]=function(_0xca9cf0,_0x132029,_0x35829f,_0x1f5c80){var _0x132317,_0x3966aa;var _0x1b71a7={};var _0x5cd81f=Number(_0x35829f[_0x1522('0x10')]);var _0x3e5060=_0x35829f[_0x1522('0x11')]?Boolean(Number(_0x35829f['data2'])):![];var _0x3e4f0b;if(_0x1f5c80[_0x1522('0x12')]){_0x1b71a7['id']=_0x1f5c80['xmd-contactid'];}if(!_0x1b71a7['id']){_0x1b71a7['ListId']=_0x5cd81f;_0x3e4f0b=_0x35829f['data3']&&_0x35829f[_0x1522('0x13')]!=='0'?_0x35829f[_0x1522('0x13')][_0x1522('0x14')](','):[_0x1522('0x15')];_0x1b71a7['$or']=_[_0x1522('0x16')](_0x3e4f0b,function(_0x4c43d9){var _0x2b0c21={};_0x2b0c21[_0x4c43d9]=_0x1f5c80[_0x1522('0x17')]?_0x1f5c80[_0x1522('0x18')]:_0x1f5c80['calleridnum'];return _0x2b0c21;});}var _0x5c4fba=['id','firstName',_0x1522('0x19'),_0x1522('0x15'),_0x1522('0x1a'),_0x1522('0x1b'),_0x1522('0x1c'),'createdAt','scheduledAt',_0x1522('0x1d')];var _0x319b92=_[_0x1522('0x1e')](_0x5c4fba,_0x3e4f0b);BPromise[_0x1522('0x1f')]()['then'](cmContactRpc[_0x1522('0x20')]({'attributes':_0x319b92,'where':_0x1b71a7}))[_0x1522('0x21')](function(_0x75ee5b){_0x3966aa=_0x75ee5b;if(!_[_0x1522('0x22')](_0x3966aa)){if(_0x3966aa['length']===0x1){_0x132317=_0x3966aa[0x0];logger[_0x1522('0xb')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1f5c80[_0x1522('0x23')],_0x132029['id'],_0x132317['id']);}else{logger[_0x1522('0xb')](_0x1522('0x24'),_0x1f5c80['uniqueid'],_0x132029['id'],_[_0x1522('0x16')](_0x3966aa,'id')[_0x1522('0x25')](','));}return;}else{logger[_0x1522('0xb')](_0x1522('0x26'),_0x1f5c80[_0x1522('0x23')],_0x132029['id']);var _0x23b9cd={'ListId':_0x5cd81f};var _0x1bdbf8=_0x35829f['data4']&&_0x35829f['data4']!=='0'?_0x35829f[_0x1522('0x27')]:_0x1522('0x15');if(_0x3e5060){logger[_0x1522('0xb')](_0x1522('0x28'),_0x1f5c80[_0x1522('0x23')],_0x132029['id']);_0x23b9cd[_0x1bdbf8]=_[_0x1522('0x29')](_0x1f5c80[_0x1522('0x17')])?_0x1f5c80[_0x1522('0x2a')]:_0x1f5c80[_0x1522('0x18')];if(_['isNil'](_0x1f5c80[_0x1522('0x17')])){_0x23b9cd['firstName']=_0x1f5c80[_0x1522('0x2b')]&&_0x1f5c80[_0x1522('0x2b')]!==''?_0x1f5c80['calleridname']:_0x1522('0x2c');}else{_0x23b9cd[_0x1522('0x2d')]=_0x1f5c80[_0x1522('0x2e')]&&_0x1f5c80['destcalleridname']!==_0x1522('0x2f')?_0x1f5c80[_0x1522('0x2e')]:_0x1522('0x2c');}return BPromise['resolve']()['then'](cmContactRpc['createContact'](_0x23b9cd))[_0x1522('0x21')](function(_0x2087e1){_0x132317=_0x2087e1;_0x3966aa[_0x1522('0x30')](_0x2087e1);if(_0x132317){logger[_0x1522('0xb')](_0x1522('0x31'),_0x1f5c80['uniqueid'],_0x132029['id'],_0x132317['id']);}return;});}else{logger['info'](_0x1522('0x32'),_0x1f5c80[_0x1522('0x23')],_0x132029['id']);_0x23b9cd[_0x1bdbf8]=_['isNil'](_0x1f5c80['routeId'])?_0x1f5c80[_0x1522('0x2a')]:_0x1f5c80['destcalleridnum'];if(_[_0x1522('0x29')](_0x1f5c80[_0x1522('0x17')])){_0x23b9cd['firstName']=_0x1f5c80['calleridname']&&_0x1f5c80[_0x1522('0x2b')]!==_0x1522('0x2f')?_0x1f5c80['calleridname']:_0x1522('0x2c');}else{_0x23b9cd['firstName']=_0x1f5c80['destcalleridname']&&_0x1f5c80[_0x1522('0x2e')]!==_0x1522('0x2f')?_0x1f5c80[_0x1522('0x2e')]:'Unknown';}_0x132317=_0x23b9cd;_0x3966aa[_0x1522('0x30')](_0x23b9cd);return;}}})[_0x1522('0x21')](function(){if(_0xca9cf0){emit(_0x1f5c80[_0x1522('0x23')],_0x132029,util[_0x1522('0x33')](_0x1522('0x34'),_0xca9cf0[_0x1522('0x35')]),util['format'](_0x1522('0x36'),_0x35829f[_0x1522('0x37')][_0x1522('0x38')]()),{'evt':_['merge'](_0x1f5c80,{'autoCreate':_0x3e5060}),'contact':_0x132317===undefined?{}:_0x132317,'contacts':_0x3966aa[_0x1522('0x39')]===0x0?undefined:_0x3966aa});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index c21415e..7e28af2 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 _0x1177=['isNil','data3','data4','uriLocation','windowWidth','data5','800','windowHeight','600','data6','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','toLowerCase','jscripty','trigger:%s','contactmanager','exec','integration','routeId','urlforward','buildUri','parse','query','search','replace','AllConditions','every','channel','AnyConditions','some','field','chat','operator','value','ChatWebsiteId','upperFirst','AccountId','message','queue','agent','membername','lastevent','exports','lodash','url','mustache','./urlforward','./integration','./cmContact','./script','../../../config/logger','redis','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','emit','info','clone','checkTriggers','prototype','hasOwnProperty','status','checkTrigger','merge','Actions','length','interface','action','data1','TemplateId','data2','html','render','uri'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0x1177,0x10b));var _0x7117=function(_0x3104e6,_0x1eccc9){_0x3104e6=_0x3104e6-0x0;var _0x23c383=_0x1177[_0x3104e6];return _0x23c383;};'use strict';var util=require('util');var _=require(_0x7117('0x0'));var url=require(_0x7117('0x1'));var Mustache=require(_0x7117('0x2'));var Redis=require('ioredis');var urlforward=require(_0x7117('0x3'));var integration=require(_0x7117('0x4'));var cmContact=require(_0x7117('0x5'));var script=require(_0x7117('0x6'));var config=require('../../../config/environment');var logger=require(_0x7117('0x7'))('trigger');var ami=require('../ami');config[_0x7117('0x8')]=_['defaults'](config[_0x7117('0x8')],{'host':_0x7117('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var operators={'equals':function(_0x22f1e7,_0x17a044){return _0x22f1e7==_0x17a044;},'not_equals':function(_0x58ccc4,_0x1ab680){return _0x58ccc4!=_0x1ab680;}};var barAndWebActions=[_0x7117('0xa'),_0x7117('0x1'),_0x7117('0xb')];function Trigger(_0x2e85f2){this[_0x7117('0xc')]=_0x2e85f2[_0x7117('0xc')];this[_0x7117('0xd')]=_0x2e85f2[_0x7117('0xd')];this[_0x7117('0xe')]=_0x2e85f2[_0x7117('0xe')];this[_0x7117('0xf')]=_0x2e85f2[_0x7117('0xf')];this['voiceExtensions']=_0x2e85f2[_0x7117('0x10')];this[_0x7117('0x11')]=_0x2e85f2[_0x7117('0x11')];this[_0x7117('0x12')]=_0x2e85f2[_0x7117('0x12')];this[_0x7117('0x13')]=_0x2e85f2[_0x7117('0x13')];this['sugarcrmAccounts']=_0x2e85f2['sugarcrmAccounts'];this[_0x7117('0x14')]=_0x2e85f2[_0x7117('0x14')];this['deskAccounts']=_0x2e85f2[_0x7117('0x15')];this[_0x7117('0x16')]=_0x2e85f2[_0x7117('0x16')];this[_0x7117('0x17')]=_0x2e85f2[_0x7117('0x17')];this[_0x7117('0x18')]=_0x2e85f2['dynamics365Accounts'];this[_0x7117('0x19')]=_0x2e85f2[_0x7117('0x19')];this[_0x7117('0x1a')]={'zendesk':this[_0x7117('0x11')],'salesforce':this[_0x7117('0x13')],'freshdesk':this[_0x7117('0x12')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x7117('0x14')],'desk':this[_0x7117('0x15')],'vtiger':this[_0x7117('0x16')],'dynamics365':this[_0x7117('0x18')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x7117('0x17')]};ami['on'](_0x7117('0x1b'),this[_0x7117('0x1c')][_0x7117('0x1d')](this));ami['on']('custom:agentconnect',this[_0x7117('0x1c')]['bind'](this));ami['on'](_0x7117('0x1e'),this['syncCustomEvent'][_0x7117('0x1d')](this));ami['on'](_0x7117('0x1f'),this[_0x7117('0x1c')][_0x7117('0x1d')](this));ami['on'](_0x7117('0x20'),this['syncCustomEvent'][_0x7117('0x1d')](this));ami['on']('custom:agentnoanswer',this[_0x7117('0x1c')][_0x7117('0x1d')](this));ami['on'](_0x7117('0x21'),this[_0x7117('0x1c')][_0x7117('0x1d')](this));ami['on'](_0x7117('0x22'),this[_0x7117('0x1c')]['bind'](this));ami['on'](_0x7117('0x23'),this['syncCustomEvent']['bind'](this));ami['on'](_0x7117('0x24'),this[_0x7117('0x1c')][_0x7117('0x1d')](this));ami['on'](_0x7117('0x25'),this[_0x7117('0x1c')][_0x7117('0x1d')](this));ami['on'](_0x7117('0x26'),this['syncAgentDial'][_0x7117('0x1d')](this));ami['on']('custom:dialconnect',this[_0x7117('0x27')][_0x7117('0x1d')](this));ami['on']('custom:dialend',this[_0x7117('0x27')][_0x7117('0x1d')](this));ami['on'](_0x7117('0x28'),this['syncCustomEvent'][_0x7117('0x1d')](this));ami['on']('custom:closedinteraction',this[_0x7117('0x1c')][_0x7117('0x1d')](this));ami['on'](_0x7117('0x29'),this[_0x7117('0x1c')][_0x7117('0x1d')](this));ami['on'](_0x7117('0x2a'),this[_0x7117('0x1c')][_0x7117('0x1d')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0x7117('0x2b'),this['syncCustomEvent']['bind'](this));}Trigger['prototype'][_0x7117('0x2c')]=function(_0x35a00d,_0x2443ed,_0x28bf53){logger[_0x7117('0x2d')](_0x35a00d,_0x2443ed,JSON['stringify'](_0x28bf53));io['to'](_0x35a00d)[_0x7117('0x2c')](_0x2443ed,_0x28bf53);};Trigger['prototype'][_0x7117('0x1c')]=function(_0x297180){var _0x3764ba=_[_0x7117('0x2e')](_0x297180);this[_0x7117('0x2f')](_0x3764ba);};Trigger[_0x7117('0x30')][_0x7117('0x27')]=function(_0x1fe55a){if(this[_0x7117('0xd')][_0x1fe55a['interface']]){this['syncCustomEvent'](_0x1fe55a);}};Trigger['prototype']['checkTriggers']=function(_0x7e224f){var _0x212153;for(var _0xdb1e02 in this['triggers']){if(this['triggers'][_0x7117('0x31')](_0xdb1e02)){if(this[_0x7117('0xc')][_0xdb1e02][_0x7117('0x32')]){_0x212153=this[_0x7117('0x33')](this[_0x7117('0xc')][_0xdb1e02],_0x7e224f);if(_0x212153){_[_0x7117('0x34')](_0x7e224f,_0x7e224f['variables']);for(var _0x25c381=0x0,_0x206e7f,_0x512785,_0x89e5da;_0x25c3810x0){_0x526dc3=_[_0xf369('0x28')](_0x534238,_0x434bf9);}return _0x526dc3;}function getCustomFields(_0x417cb2,_0x1889ee){var _0x1453f9=[];var _0x20c746={'custom_fields':{}};if(_0x417cb2[_0xf369('0x27')]>0x0){_['forEach'](_0x417cb2,function(_0x36d5c5){if(_['includes']([_0xf369('0x29'),_0xf369('0x2a')],_0x36d5c5[_0xf369('0x2b')])&&_0x36d5c5[_0xf369('0x2c')]&&!_0x36d5c5['customField']){_0x20c746[_0x36d5c5['nameField'][_0xf369('0x2d')]()]=_0x36d5c5[_0xf369('0x2e')]['toString']();}else if(_[_0xf369('0x2f')](['string',_0xf369('0x2a')],_0x36d5c5['type'])&&_0x36d5c5['idField']&&_0x36d5c5[_0xf369('0x30')]){_0x20c746[_0xf369('0x31')][_0x36d5c5[_0xf369('0x32')]]=_0x36d5c5[_0xf369('0x2e')][_0xf369('0x33')]();}else if(_0x36d5c5[_0xf369('0x2b')]===_0xf369('0x34')&&_0x36d5c5[_0xf369('0x35')]&&_0x36d5c5[_0xf369('0x32')]&&_0x36d5c5[_0xf369('0x30')]){_0x1889ee[_0x36d5c5['variableName']]&&(_0x20c746[_0xf369('0x31')][_0x36d5c5[_0xf369('0x32')]]=_0x1889ee[_0x36d5c5[_0xf369('0x35')]][_0xf369('0x33')]());}else if(_0x36d5c5[_0xf369('0x2b')]==='customVariable'&&_0x36d5c5[_0xf369('0x36')]&&_0x36d5c5['Variable'][_0xf369('0x37')]&&_0x36d5c5['idField']&&_0x36d5c5[_0xf369('0x30')]){_0x1889ee[_0x36d5c5['Variable'][_0xf369('0x37')][_0xf369('0x2d')]()]&&(_0x20c746[_0xf369('0x31')][_0x36d5c5['idField']]=_0x1889ee[_0x36d5c5[_0xf369('0x36')][_0xf369('0x37')][_0xf369('0x2d')]()]['toString']());}});}if(_0x20c746[_0xf369('0x38')]){_0x20c746['priority']=Number(_0x20c746['priority']);}return _0x20c746;}function getTicket(_0x493fec,_0x10fab3,_0x3a1c0a,_0x576a9c,_0x1f23c0){logger[_0xf369('0xc')](_0xf369('0x39'));var _0x270e4b=_['merge']({'subject':intUtil[_0xf369('0x3a')](_0x576a9c[_0xf369('0x3b')],_0x1f23c0,'\x20'),'type':_0xf369('0x3c'),'status':_0xf369('0x3d'),'labels':['xCALLY',_0xf369('0x3e'),_0xf369('0x3f')][_0xf369('0x40')](getTags(_0x576a9c['Tags'],_0xf369('0x37'))),'description':intUtil['getString'](_0x576a9c[_0xf369('0x41')],_0x1f23c0,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf369('0xe')](_0xf369('0x42'),_0x10fab3['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0xf369('0x3a')](_0x576a9c[_0xf369('0x41')],_0x1f23c0,'\x0a')}},getCustomFields(_0x576a9c[_0xf369('0x43')],_0x1f23c0));return request({'uri':util[_0xf369('0xe')](_0xf369('0x44'),_0x493fec[_0xf369('0xf')],_0x3a1c0a['id']),'method':_0xf369('0x25'),'body':_0x270e4b});}exports[_0xf369('0x45')]=function(_0x64f8da,_0xfc2582,_0x29c243,_0x45a160,_0x27b222,_0x4194be){var _0x479b79,_0x5b3e29;_0x4194be[_0xf369('0xf')]=intUtil[_0xf369('0x46')](_0x4194be[_0xf369('0xf')]);_0x4194be[_0xf369('0x47')]=intUtil[_0xf369('0x46')](_0x4194be[_0xf369('0x47')]);if(_0x27b222&&_0x27b222[_0xf369('0x48')]){logger[_0xf369('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0xfc2582[_0xf369('0x49')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4194be[_0xf369('0x47')],_0xfc2582[_0xf369('0x4a')],md5(_0xfc2582[_0xf369('0x4a')]));}else{_0xfc2582[_0xf369('0x49')]='';}headers[_0xf369('0x4b')]=getAuth(_0x4194be);return getUser(_0x4194be,_0x45a160[_0xf369('0x4c')])['then'](function(_0x57d08e){_0x479b79=_0x57d08e;logger[_0xf369('0xc')](_0xf369('0x4d'),_0x479b79['id']);return getEndUser(_0x4194be,_0xfc2582['calleridname'],_0xfc2582[_0xf369('0x4e')]);})[_0xf369('0x10')](function(_0xef4d82){_0x5b3e29=_0xef4d82;logger[_0xf369('0xc')]('The\x20Enduser\x20ID\x20is:',_0x5b3e29['id']);return getTicket(_0x4194be,_0x479b79,_0x5b3e29,_0x29c243,_0xfc2582);})[_0xf369('0x10')](function(_0x256572){if(_0x256572){logger[_0xf369('0xc')](_0xf369('0x4f'));logger[_0xf369('0xc')]('The\x20Ticket\x20ID\x20is:',_0x256572['id']);switch(_0x4194be[_0xf369('0x2b')]){case'integrationTab':logger['info']('[QUEUE]',_0xf369('0x50'));emit(util[_0xf369('0xe')](_0xf369('0x51'),_0x45a160[_0xf369('0x37')]),_0xf369('0x52'),{'recordId':_0x256572['id']});break;case'newTab':logger['info'](_0xf369('0x53'),_0xf369('0x54'));emit(util[_0xf369('0xe')](_0xf369('0x51'),_0x45a160['name']),_0xf369('0x55'),{'uri':util[_0xf369('0xe')](_0xf369('0x56'),_0x256572['id'])});break;default:logger['error']('[QUEUE]',_0xf369('0x57'));}}})[_0xf369('0x58')](function(_0x26bfa7){console[_0xf369('0x59')](_0x26bfa7);logger[_0xf369('0x59')](_0xf369('0x53'),JSON[_0xf369('0x5a')](_0x26bfa7));});};exports[_0xf369('0x5b')]=function(_0x36e6eb,_0x38541c,_0x44c4bb,_0x45a73e,_0x53652d,_0x4d3ed6,_0x54a7ec){var _0x571afe,_0x1f61a1;_0x4d3ed6[_0xf369('0xf')]=intUtil[_0xf369('0x46')](_0x4d3ed6[_0xf369('0xf')]);_0x4d3ed6[_0xf369('0x47')]=intUtil[_0xf369('0x46')](_0x4d3ed6[_0xf369('0x47')]);if(_0x54a7ec&&_0x54a7ec[_0xf369('0x5c')]&&_0x54a7ec['recordingFormat']!==_0xf369('0x5d')){logger[_0xf369('0xc')](_0xf369('0x5e'),_0xf369('0x5f'));_0x38541c[_0xf369('0x49')]=util[_0xf369('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4d3ed6[_0xf369('0x47')],_0x38541c[_0xf369('0x4a')],md5(_0x38541c[_0xf369('0x4a')]));}headers[_0xf369('0x4b')]=getAuth(_0x4d3ed6);return getUser(_0x4d3ed6,_0x45a73e['email'])[_0xf369('0x10')](function(_0x5a3501){_0x571afe=_0x5a3501;logger[_0xf369('0xc')](_0xf369('0x4d'),_0x571afe['id']);return getEndUser(_0x4d3ed6,_0x38541c[_0xf369('0x60')],_0x38541c[_0xf369('0x61')]);})['then'](function(_0x15c570){_0x1f61a1=_0x15c570;logger[_0xf369('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1f61a1['id']);return getTicket(_0x4d3ed6,_0x571afe,_0x1f61a1,_0x44c4bb,_0x38541c);})[_0xf369('0x10')](function(_0x1ef3c4){if(_0x1ef3c4){logger['info']('Ticket\x20created!');logger[_0xf369('0xc')](_0xf369('0x62'),_0x1ef3c4['id']);switch(_0x4d3ed6['type']){case _0xf369('0x63'):logger[_0xf369('0xc')](_0xf369('0x53'),_0xf369('0x50'));emit(util[_0xf369('0xe')](_0xf369('0x51'),_0x45a73e['name']),'trigger:desk:display',{'recordId':_0x1ef3c4['id']});break;case'newTab':logger[_0xf369('0xc')](_0xf369('0x53'),_0xf369('0x54'));emit(util['format']('user:%s',_0x45a73e[_0xf369('0x37')]),_0xf369('0x55'),{'uri':util[_0xf369('0xe')]('%s/agent/tickets/%s',_0x4d3ed6['remoteUri'],_0x1ef3c4['id'])});break;default:logger[_0xf369('0x59')]('[OUTBOUND]',_0xf369('0x57'));}}})[_0xf369('0x58')](function(_0x2eb0fa){logger[_0xf369('0x59')](_0xf369('0x5e'),JSON['stringify'](_0x2eb0fa));});};exports[_0xf369('0x64')]=function(_0x462a42,_0x26b3a7,_0x5094c4,_0x3917ef,_0x3afb9b,_0x38cccf){var _0x12c0a8,_0x519dd9;_0x38cccf[_0xf369('0xf')]=intUtil['stripTrailingSlash'](_0x38cccf[_0xf369('0xf')]);_0x38cccf[_0xf369('0x47')]=intUtil[_0xf369('0x46')](_0x38cccf['serverUrl']);if(_0x3afb9b&&_0x3afb9b[_0xf369('0x48')]){logger[_0xf369('0xc')]('['+_0x26b3a7[_0xf369('0x65')][_0xf369('0x66')]()+']',_0xf369('0x5f'));_0x26b3a7['recordingURL']=util[_0xf369('0xe')](_0xf369('0x67'),_0x38cccf[_0xf369('0x47')],_0x26b3a7['uniqueid'],md5(_0x26b3a7[_0xf369('0x4a')]));}else{_0x26b3a7[_0xf369('0x49')]='';}headers['Authorization']=getAuth(_0x38cccf);return getUser(_0x38cccf)[_0xf369('0x10')](function(_0x3de600){_0x12c0a8=_0x3de600;logger[_0xf369('0xc')](_0xf369('0x4d'),_0x12c0a8['id']);return getEndUser(_0x38cccf,_0x26b3a7[_0xf369('0x68')],_0x26b3a7[_0xf369('0x4e')]);})[_0xf369('0x10')](function(_0x5c21c4){_0x519dd9=_0x5c21c4;logger['info'](_0xf369('0x69'),_0x519dd9['id']);return getTicket(_0x38cccf,_0x12c0a8,_0x519dd9,_0x5094c4,_0x26b3a7);})[_0xf369('0x10')](function(_0x32edb3){if(_0x32edb3){logger[_0xf369('0xc')](_0xf369('0x4f'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x32edb3['id']);}})['catch'](function(_0x110585){logger[_0xf369('0x59')]('['+_0x26b3a7[_0xf369('0x65')][_0xf369('0x66')]()+']',JSON[_0xf369('0x5a')](_0x110585));});}; \ No newline at end of file +var _0x27dc=['then','total_entries','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','[HTTP]','GET','authType','basic','username','password','token','%s/token:%s','Basic\x20%s','toString','%s/customers/search','Enduser\x20found!','%s/customers','POST','work','length','map','includes','picklist','type','nameField','customField','content','string','idField','variable','variableName','custom_fields','customVariable','Variable','toLowerCase','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','concat','Tags','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','stringify','recordingFormat','none','Recording\x20is\x20enabled!','Authorization','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/agent/tickets/%s','[OUTBOUND]','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','info','%s/users','remoteUri'];(function(_0xe336be,_0x157730){var _0x25c2f5=function(_0x1e1b9b){while(--_0x1e1b9b){_0xe336be['push'](_0xe336be['shift']());}};_0x25c2f5(++_0x157730);}(_0x27dc,0x132));var _0xc27d=function(_0x464765,_0x36f76f){_0x464765=_0x464765-0x0;var _0x3d8f7c=_0x27dc[_0x464765];return _0x3d8f7c;};'use strict';var _=require(_0xc27d('0x0'));var rp=require(_0xc27d('0x1'));var md5=require('md5');var util=require(_0xc27d('0x2'));var Redis=require(_0xc27d('0x3'));var intUtil=require(_0xc27d('0x4'));var config=require(_0xc27d('0x5'));var logger=require(_0xc27d('0x6'))(_0xc27d('0x7'));config[_0xc27d('0x8')]=_[_0xc27d('0x9')](config[_0xc27d('0x8')],{'host':_0xc27d('0xa'),'port':0x18eb});var io=require(_0xc27d('0xb'))(new Redis(config[_0xc27d('0x8')]));function emit(_0x26cb39,_0x9b4e35,_0x3996d1){io['to'](_0x26cb39)[_0xc27d('0xc')](_0x9b4e35,_0x3996d1);}var headers={'Content-Type':'application/json','Accept':_0xc27d('0xd')};function getUser(_0x709d4b,_0x2dd47e){if(intUtil[_0xc27d('0xe')](_0x2dd47e)===!![]){logger[_0xc27d('0xf')]('Getting\x20agent\x20with\x20email',_0x2dd47e);return request({'uri':util['format'](_0xc27d('0x10'),_0x709d4b[_0xc27d('0x11')])})[_0xc27d('0x12')](function(_0x4a39ad){if(_0x4a39ad[_0xc27d('0x13')]){return _['find'](_0x4a39ad[_0xc27d('0x14')][_0xc27d('0x15')],{'email':_0x2dd47e});}})[_0xc27d('0x12')](function(_0x5659b3){if(_0x5659b3){logger[_0xc27d('0xf')](_0xc27d('0x16'));return _0x5659b3;}else{logger[_0xc27d('0xf')](_0xc27d('0x17'));return request({'uri':util[_0xc27d('0x18')]('%s/users/me',_0x709d4b[_0xc27d('0x11')])});}});}else{logger[_0xc27d('0xf')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me',_0x709d4b[_0xc27d('0x11')])});}}function request(_0x98c09){logger['debug'](_0xc27d('0x19'),JSON['stringify'](_0x98c09));return rp(_[_0xc27d('0x9')](_0x98c09,{'method':_0xc27d('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x5aa1ab){var _0x587fde;if(_0x5aa1ab[_0xc27d('0x1b')]===_0xc27d('0x1c')){_0x587fde=util[_0xc27d('0x18')]('%s:%s',_0x5aa1ab[_0xc27d('0x1d')],_0x5aa1ab[_0xc27d('0x1e')]);}else if(_0x5aa1ab[_0xc27d('0x1b')]===_0xc27d('0x1f')){_0x587fde=util[_0xc27d('0x18')](_0xc27d('0x20'),_0x5aa1ab['username'],_0x5aa1ab[_0xc27d('0x1f')]);}return util[_0xc27d('0x18')](_0xc27d('0x21'),new Buffer(_0x587fde)[_0xc27d('0x22')]('base64'));}function getEndUser(_0x55ada3,_0x1edf9e,_0x11eeed){logger[_0xc27d('0xf')]('Searching\x20enduser\x20with\x20phone',_0x11eeed);return request({'uri':util[_0xc27d('0x18')](_0xc27d('0x23'),_0x55ada3[_0xc27d('0x11')]),'qs':{'phone':_0x11eeed}})[_0xc27d('0x12')](function(_0x80447a){if(_0x80447a['total_entries']){logger[_0xc27d('0xf')](_0xc27d('0x24'));return _0x80447a[_0xc27d('0x14')][_0xc27d('0x15')][0x0];}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xc27d('0x18')](_0xc27d('0x25'),_0x55ada3[_0xc27d('0x11')]),'method':_0xc27d('0x26'),'body':{'first_name':_0x1edf9e,'title':_0x1edf9e,'phone_numbers':[{'type':_0xc27d('0x27'),'value':_0x11eeed}]}});}});}function getTags(_0x111495,_0x43164a){var _0x5d186f=[];if(_0x111495&&_0x111495[_0xc27d('0x28')]>0x0){_0x5d186f=_[_0xc27d('0x29')](_0x111495,_0x43164a);}return _0x5d186f;}function getCustomFields(_0x4ae993,_0x576b9a){var _0xa707bf=[];var _0x277eb2={'custom_fields':{}};if(_0x4ae993[_0xc27d('0x28')]>0x0){_['forEach'](_0x4ae993,function(_0xbf0fcb){if(_[_0xc27d('0x2a')](['string',_0xc27d('0x2b')],_0xbf0fcb[_0xc27d('0x2c')])&&_0xbf0fcb[_0xc27d('0x2d')]&&!_0xbf0fcb[_0xc27d('0x2e')]){_0x277eb2[_0xbf0fcb['nameField']['toLowerCase']()]=_0xbf0fcb[_0xc27d('0x2f')]['toString']();}else if(_['includes']([_0xc27d('0x30'),_0xc27d('0x2b')],_0xbf0fcb[_0xc27d('0x2c')])&&_0xbf0fcb[_0xc27d('0x31')]&&_0xbf0fcb[_0xc27d('0x2e')]){_0x277eb2['custom_fields'][_0xbf0fcb[_0xc27d('0x31')]]=_0xbf0fcb['content'][_0xc27d('0x22')]();}else if(_0xbf0fcb[_0xc27d('0x2c')]===_0xc27d('0x32')&&_0xbf0fcb[_0xc27d('0x33')]&&_0xbf0fcb[_0xc27d('0x31')]&&_0xbf0fcb[_0xc27d('0x2e')]){_0x576b9a[_0xbf0fcb['variableName']]&&(_0x277eb2[_0xc27d('0x34')][_0xbf0fcb[_0xc27d('0x31')]]=_0x576b9a[_0xbf0fcb[_0xc27d('0x33')]]['toString']());}else if(_0xbf0fcb[_0xc27d('0x2c')]===_0xc27d('0x35')&&_0xbf0fcb[_0xc27d('0x36')]&&_0xbf0fcb[_0xc27d('0x36')]['name']&&_0xbf0fcb[_0xc27d('0x31')]&&_0xbf0fcb[_0xc27d('0x2e')]){_0x576b9a[_0xbf0fcb['Variable']['name'][_0xc27d('0x37')]()]&&(_0x277eb2[_0xc27d('0x34')][_0xbf0fcb['idField']]=_0x576b9a[_0xbf0fcb[_0xc27d('0x36')][_0xc27d('0x38')][_0xc27d('0x37')]()][_0xc27d('0x22')]());}});}if(_0x277eb2[_0xc27d('0x39')]){_0x277eb2[_0xc27d('0x39')]=Number(_0x277eb2['priority']);}return _0x277eb2;}function getTicket(_0x379102,_0x174641,_0x442eda,_0x9250a3,_0x3fce6e){logger[_0xc27d('0xf')](_0xc27d('0x3a'));var _0x4159c4=_[_0xc27d('0x3b')]({'subject':intUtil[_0xc27d('0x3c')](_0x9250a3['Subjects'],_0x3fce6e,'\x20'),'type':_0xc27d('0x3d'),'status':_0xc27d('0x3e'),'labels':[_0xc27d('0x3f'),_0xc27d('0x40'),'CTI'][_0xc27d('0x41')](getTags(_0x9250a3[_0xc27d('0x42')],_0xc27d('0x38'))),'description':intUtil['getString'](_0x9250a3[_0xc27d('0x43')],_0x3fce6e,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x174641['id']),'class':_0xc27d('0x44')}},'message':{'direction':'in','body':intUtil[_0xc27d('0x3c')](_0x9250a3[_0xc27d('0x43')],_0x3fce6e,'\x0a')}},getCustomFields(_0x9250a3[_0xc27d('0x45')],_0x3fce6e));return request({'uri':util[_0xc27d('0x18')](_0xc27d('0x46'),_0x379102[_0xc27d('0x11')],_0x442eda['id']),'method':_0xc27d('0x26'),'body':_0x4159c4});}exports[_0xc27d('0x47')]=function(_0x559202,_0x2ccd2e,_0x179d32,_0x36f775,_0x2a551a,_0x433b5e){var _0x32b582,_0x3ae39d;_0x433b5e[_0xc27d('0x11')]=intUtil[_0xc27d('0x48')](_0x433b5e[_0xc27d('0x11')]);_0x433b5e[_0xc27d('0x49')]=intUtil[_0xc27d('0x48')](_0x433b5e[_0xc27d('0x49')]);if(_0x2a551a&&_0x2a551a[_0xc27d('0x4a')]){logger[_0xc27d('0xf')](_0xc27d('0x4b'),'Recording\x20is\x20enabled!');_0x2ccd2e[_0xc27d('0x4c')]=util[_0xc27d('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x433b5e[_0xc27d('0x49')],_0x2ccd2e[_0xc27d('0x4d')],md5(_0x2ccd2e[_0xc27d('0x4d')]));}else{_0x2ccd2e[_0xc27d('0x4c')]='';}headers['Authorization']=getAuth(_0x433b5e);return getUser(_0x433b5e,_0x36f775[_0xc27d('0x4e')])[_0xc27d('0x12')](function(_0x2847e7){_0x32b582=_0x2847e7;logger[_0xc27d('0xf')](_0xc27d('0x4f'),_0x32b582['id']);return getEndUser(_0x433b5e,_0x2ccd2e[_0xc27d('0x50')],_0x2ccd2e[_0xc27d('0x51')]);})[_0xc27d('0x12')](function(_0x2c65aa){_0x3ae39d=_0x2c65aa;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3ae39d['id']);return getTicket(_0x433b5e,_0x32b582,_0x3ae39d,_0x179d32,_0x2ccd2e);})['then'](function(_0x34f43e){if(_0x34f43e){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x34f43e['id']);switch(_0x433b5e[_0xc27d('0x2c')]){case _0xc27d('0x52'):logger[_0xc27d('0xf')](_0xc27d('0x4b'),_0xc27d('0x53'));emit(util['format'](_0xc27d('0x54'),_0x36f775['name']),_0xc27d('0x55'),{'recordId':_0x34f43e['id']});break;case _0xc27d('0x56'):logger['info'](_0xc27d('0x4b'),_0xc27d('0x57'));emit(util[_0xc27d('0x18')](_0xc27d('0x54'),_0x36f775[_0xc27d('0x38')]),'trigger:browser:url',{'uri':util[_0xc27d('0x18')](_0xc27d('0x58'),_0x34f43e['id'])});break;default:logger[_0xc27d('0x59')](_0xc27d('0x4b'),_0xc27d('0x5a'));}}})[_0xc27d('0x5b')](function(_0x54581c){console[_0xc27d('0x59')](_0x54581c);logger['error'](_0xc27d('0x4b'),JSON[_0xc27d('0x5c')](_0x54581c));});};exports['outbound']=function(_0x296b16,_0x86ad8,_0x14175a,_0x55c4b6,_0x240d14,_0x5e421c,_0x2a8437){var _0xfc3145,_0x59713e;_0x5e421c[_0xc27d('0x11')]=intUtil[_0xc27d('0x48')](_0x5e421c[_0xc27d('0x11')]);_0x5e421c[_0xc27d('0x49')]=intUtil['stripTrailingSlash'](_0x5e421c[_0xc27d('0x49')]);if(_0x2a8437&&_0x2a8437[_0xc27d('0x5d')]&&_0x2a8437[_0xc27d('0x5d')]!==_0xc27d('0x5e')){logger[_0xc27d('0xf')]('[OUTBOUND]',_0xc27d('0x5f'));_0x86ad8[_0xc27d('0x4c')]=util[_0xc27d('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e421c[_0xc27d('0x49')],_0x86ad8[_0xc27d('0x4d')],md5(_0x86ad8[_0xc27d('0x4d')]));}headers[_0xc27d('0x60')]=getAuth(_0x5e421c);return getUser(_0x5e421c,_0x55c4b6['email'])[_0xc27d('0x12')](function(_0x18e147){_0xfc3145=_0x18e147;logger['info']('The\x20User\x20ID\x20is:',_0xfc3145['id']);return getEndUser(_0x5e421c,_0x86ad8['destcalleridname'],_0x86ad8[_0xc27d('0x61')]);})['then'](function(_0x479f80){_0x59713e=_0x479f80;logger[_0xc27d('0xf')](_0xc27d('0x62'),_0x59713e['id']);return getTicket(_0x5e421c,_0xfc3145,_0x59713e,_0x14175a,_0x86ad8);})[_0xc27d('0x12')](function(_0x4dc8f3){if(_0x4dc8f3){logger[_0xc27d('0xf')](_0xc27d('0x63'));logger[_0xc27d('0xf')](_0xc27d('0x64'),_0x4dc8f3['id']);switch(_0x5e421c['type']){case _0xc27d('0x52'):logger[_0xc27d('0xf')](_0xc27d('0x4b'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xc27d('0x18')](_0xc27d('0x54'),_0x55c4b6[_0xc27d('0x38')]),_0xc27d('0x55'),{'recordId':_0x4dc8f3['id']});break;case _0xc27d('0x56'):logger[_0xc27d('0xf')](_0xc27d('0x4b'),_0xc27d('0x57'));emit(util['format']('user:%s',_0x55c4b6[_0xc27d('0x38')]),_0xc27d('0x65'),{'uri':util[_0xc27d('0x18')](_0xc27d('0x66'),_0x5e421c['remoteUri'],_0x4dc8f3['id'])});break;default:logger[_0xc27d('0x59')](_0xc27d('0x67'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xc27d('0x5b')](function(_0x4f547f){logger[_0xc27d('0x59')]('[OUTBOUND]',JSON[_0xc27d('0x5c')](_0x4f547f));});};exports[_0xc27d('0x68')]=function(_0x4cf3bf,_0x143c72,_0x4fd085,_0x568aac,_0x104415,_0x56476c){var _0x188cb6,_0x4807b0;_0x56476c[_0xc27d('0x11')]=intUtil['stripTrailingSlash'](_0x56476c[_0xc27d('0x11')]);_0x56476c[_0xc27d('0x49')]=intUtil[_0xc27d('0x48')](_0x56476c[_0xc27d('0x49')]);if(_0x104415&&_0x104415[_0xc27d('0x4a')]){logger[_0xc27d('0xf')]('['+_0x143c72[_0xc27d('0x69')][_0xc27d('0x6a')]()+']',_0xc27d('0x5f'));_0x143c72[_0xc27d('0x4c')]=util[_0xc27d('0x18')](_0xc27d('0x6b'),_0x56476c[_0xc27d('0x49')],_0x143c72['uniqueid'],md5(_0x143c72['uniqueid']));}else{_0x143c72[_0xc27d('0x4c')]='';}headers['Authorization']=getAuth(_0x56476c);return getUser(_0x56476c)[_0xc27d('0x12')](function(_0x1d60ea){_0x188cb6=_0x1d60ea;logger[_0xc27d('0xf')](_0xc27d('0x4f'),_0x188cb6['id']);return getEndUser(_0x56476c,_0x143c72[_0xc27d('0x50')],_0x143c72[_0xc27d('0x51')]);})[_0xc27d('0x12')](function(_0x2dff1c){_0x4807b0=_0x2dff1c;logger[_0xc27d('0xf')](_0xc27d('0x62'),_0x4807b0['id']);return getTicket(_0x56476c,_0x188cb6,_0x4807b0,_0x4fd085,_0x143c72);})[_0xc27d('0x12')](function(_0x5befe5){if(_0x5befe5){logger[_0xc27d('0xf')]('Ticket\x20created!');logger[_0xc27d('0xf')]('The\x20Ticket\x20ID\x20is:',_0x5befe5['id']);}})[_0xc27d('0x5b')](function(_0x1fbf4d){logger[_0xc27d('0x59')]('['+_0x143c72['lastevent'][_0xc27d('0x6a')]()+']',JSON['stringify'](_0x1fbf4d));});}; \ 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 a0e1413..978e10e 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 _0xed5c=['phonecall','phonecalls','assign','callDirection','queue','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','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!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','remoteUri','username','password','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','validateEmail','email','userEmail','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','customField','idField','indexOf','content','ticketType','incidents','getString','Subjects','Descriptions','/contacts(','/systemusers('];(function(_0x3d9f7c,_0x3041c0){var _0x172891=function(_0xe9686c){while(--_0xe9686c){_0x3d9f7c['push'](_0x3d9f7c['shift']());}};_0x172891(++_0x3041c0);}(_0xed5c,0x81));var _0xced5=function(_0x4f4d2d,_0x297cb7){_0x4f4d2d=_0x4f4d2d-0x0;var _0x3b5771=_0xed5c[_0x4f4d2d];return _0x3b5771;};'use strict';var _=require(_0xced5('0x0'));var BPromise=require(_0xced5('0x1'));var rp=require(_0xced5('0x2'));var util=require(_0xced5('0x3'));var intUtil=require(_0xced5('0x4'));var md5=require(_0xced5('0x5'));var Redis=require(_0xced5('0x6'));var logger=require(_0xced5('0x7'))(_0xced5('0x8'));var config=require(_0xced5('0x9'));config['redis']=_[_0xced5('0xa')](config[_0xced5('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xced5('0xb')]));function getAuthToken(_0xc738da,_0x2857d8,_0x2113e4){var _0x36f59d={'method':'POST','uri':_0x2857d8,'form':{'client_id':_0xc738da['clientId'],'resource':_0xc738da[_0xced5('0xc')],'username':_0xc738da[_0xced5('0xd')],'password':_0xc738da[_0xced5('0xe')],'grant_type':_0xced5('0xe'),'client_secret':_0xc738da['clientSecret']},'json':!![]};return rp(_0x36f59d)[_0xced5('0xf')](function(_0x4f59de){return _0x4f59de[_0xced5('0x10')];})[_0xced5('0x11')](function(_0x4b8279){logger[_0xced5('0x12')]('['+[_0x2113e4['toUpperCase']()]+_0xced5('0x13'));return _0x4b8279[_0xced5('0x14')];});}function getUser(_0x32ef97,_0x3a003f,_0x341473,_0x14341d,_0x32b90a,_0x4bee02){return new BPromise(function(_0x4b2533,_0x23ca09){return getAuthToken(_0x3a003f,_0x14341d,_0x4bee02)[_0xced5('0xf')](function(_0x2f4e9a){var _0x5e5346={'method':'GET','uri':_0x32b90a+_0xced5('0x15'),'headers':{'Authorization':_0xced5('0x16')+_0x2f4e9a,'OData-Version':_0xced5('0x17')},'json':!![]};return rp(_0x5e5346);})[_0xced5('0xf')](function(_0x17e4eb){var _0x13928f=_0x17e4eb['value'];var _0x29a3ba=![];var _0x153e29=null;if(!_['isNil'](_0x341473)){if(intUtil[_0xced5('0x18')](_0x341473[_0xced5('0x19')])){_0x32ef97[_0xced5('0x1a')]=_0x341473['email'];for(_0x153e29=0x0;_0x153e29<_0x13928f[_0xced5('0x1b')];_0x153e29++){if(_0x13928f[_0x153e29][_0xced5('0x1c')]===_0x341473[_0xced5('0x19')]&&!_0x13928f[_0x153e29]['isdisabled']){_0x29a3ba=!![];logger[_0xced5('0x1d')]('['+[_0x4bee02[_0xced5('0x1e')]()]+_0xced5('0x1f')+_0x13928f[_0x153e29][_0xced5('0x20')]+'!');_0x32ef97[_0xced5('0x21')]=_0x13928f[_0x153e29][_0xced5('0x20')];}}}}if(!_0x29a3ba){logger['info']('['+[_0x4bee02[_0xced5('0x1e')]()]+_0xced5('0x22'));_0x32ef97[_0xced5('0x1a')]=_0x3a003f[_0xced5('0xd')];for(_0x153e29=0x0;_0x153e29<_0x13928f[_0xced5('0x1b')];_0x153e29++){if(_0x13928f[_0x153e29][_0xced5('0x1c')]===_0x3a003f[_0xced5('0xd')]){_0x32ef97[_0xced5('0x21')]=_0x13928f[_0x153e29][_0xced5('0x20')];}}}_0x4b2533(_0x32ef97);})[_0xced5('0x11')](function(_0x480a76){_0x23ca09(_0x480a76[_0xced5('0x14')]);});});}function createEndUser(_0x548cbb,_0x92ac47,_0x4de26f,_0x58706e,_0x1620f8,_0x2cd6c4){return new BPromise(function(_0x4419f3,_0x2e4774){return getAuthToken(_0x92ac47,_0x4de26f,_0x2cd6c4)[_0xced5('0xf')](function(_0x26790a){var _0x3a6539=_0x2cd6c4[_0xced5('0x23')]()===_0xced5('0x24')?_0x1620f8[_0xced5('0x25')]:_0x1620f8[_0xced5('0x26')];var _0x57d410={'method':_0xced5('0x27'),'uri':_0x58706e+_0xced5('0x28'),'body':{'telephone1':_0x3a6539,'fullname':_0x3a6539,'firstname':_0x3a6539,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x548cbb['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x26790a,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x57d410);})[_0xced5('0xf')](function(_0x2f7cd4){var _0x9d2fee=_0x2f7cd4[_0xced5('0x29')][_0xced5('0x2a')];var _0x48cb5b=_0x9d2fee[_0xced5('0x2b')](_0x9d2fee['lastIndexOf']('(')+0x1,_0x9d2fee[_0xced5('0x2c')](')'));_0x548cbb[_0xced5('0x2d')]=_0x48cb5b;_0x4419f3(_0x548cbb);})['catch'](function(_0x5d8f4f){_0x2e4774(_0x5d8f4f[_0xced5('0x14')]);});});}function getEndUser(_0x579b4a,_0x2faacb,_0x3bd7d5,_0xbe5a94,_0x316745,_0x1c4734){return new BPromise(function(_0x1dc754,_0x16a817){return getAuthToken(_0x2faacb,_0x3bd7d5,_0x1c4734)['then'](function(_0x1f49b5){var _0x213569={'method':'GET','uri':_0xbe5a94+_0xced5('0x2e'),'headers':{'Authorization':_0xced5('0x16')+_0x1f49b5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x213569);})[_0xced5('0xf')](function(_0x4701b6){var _0x5410dd=null;if(_0x4701b6){var _0x2d2166=_0x4701b6['value'];var _0x280281=![];for(_0x5410dd=0x0;_0x5410dd<_0x2d2166['length'];_0x5410dd++){var _0x80ec1=_0x1c4734[_0xced5('0x23')]()==='outbound'?_0x316745['destcalleridnum']:_0x316745[_0xced5('0x26')];if(_0x2d2166[_0x5410dd][_0xced5('0x2f')]===_0x80ec1){_0x280281=!![];_0x579b4a['enduserId']=_0x2d2166[_0x5410dd][_0xced5('0x30')];}}if(_0x280281){_0x1dc754(_0x579b4a);}else{return createEndUser(_0x579b4a,_0x2faacb,_0x3bd7d5,_0xbe5a94,_0x316745,_0x1c4734)[_0xced5('0xf')](function(_0x5a8906){logger[_0xced5('0x1d')]('['+[_0x1c4734[_0xced5('0x1e')]()]+_0xced5('0x31'),_0x5a8906['enduserId']);_0x1dc754(_0x5a8906);});}}else{return createEndUser(_0x579b4a,_0x2faacb,_0x3bd7d5,_0xbe5a94,_0x316745,_0x1c4734)[_0xced5('0xf')](function(_0x1f4434){logger[_0xced5('0x1d')]('['+[_0x1c4734['toUpperCase']()]+_0xced5('0x32'),_0x1f4434[_0xced5('0x2d')]);_0x1dc754(_0x1f4434);});}});});}function getCustomFields(_0x2bb6b6,_0x5523c5,_0x2ead52){var _0x570413={};if(_0x2bb6b6[_0xced5('0x1b')]>0x0){_[_0xced5('0x33')](_0x2bb6b6,function(_0x92a00c){if(_[_0xced5('0x34')]([_0xced5('0x35'),_0xced5('0x36')],_0x92a00c[_0xced5('0x37')])&&_0x92a00c['nameField']&&!_0x92a00c[_0xced5('0x38')]){var _0x16ca31=_0x92a00c[_0xced5('0x39')]['toLowerCase']();var _0xcb27ea=_0x16ca31['substring'](0x0,_0x16ca31[_0xced5('0x3a')]('_'));var _0x3592de=_0x16ca31[_0xced5('0x2b')](_0x16ca31[_0xced5('0x3a')]('_')+0x1);if(_0xcb27ea===_0x2ead52){_0x570413[_0x3592de]=_0x92a00c[_0xced5('0x3b')];}}});}return _0x570413;}function getTicket(_0x294aac,_0x1eda0d,_0x5c46f6,_0x38272a,_0x4c3885,_0x466e6a,_0x1ce3a7){return new BPromise(function(_0x52b20e,_0x2f2a57){var _0x3ea0e7;return getAuthToken(_0x1eda0d,_0x5c46f6,_0x1ce3a7)[_0xced5('0xf')](function(_0x8d0f83){if(_0x466e6a[_0xced5('0x3c')]==='incident'){_0x3ea0e7={'method':'POST','uri':_0x38272a+_0xced5('0x3d'),'body':Object['assign']({},{'title':intUtil[_0xced5('0x3e')](_0x466e6a[_0xced5('0x3f')],_0x4c3885,'\x20'),'description':intUtil[_0xced5('0x3e')](_0x466e6a[_0xced5('0x40')],_0x4c3885,'\x0a'),'customerid_contact@odata.bind':_0xced5('0x41')+_0x294aac[_0xced5('0x2d')]+')','ownerid@odata.bind':_0xced5('0x42')+_0x294aac[_0xced5('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x466e6a['Fields'],_0x4c3885,_0x466e6a['ticketType'])),'headers':{'Authorization':_0xced5('0x16')+_0x8d0f83,'OData-Version':_0xced5('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x466e6a[_0xced5('0x3c')]===_0xced5('0x43')){_0x3ea0e7={'method':_0xced5('0x27'),'uri':_0x38272a+_0xced5('0x44'),'body':Object[_0xced5('0x45')]({},{'subject':intUtil[_0xced5('0x3e')](_0x466e6a[_0xced5('0x3f')],_0x4c3885,'\x20'),'phonenumber':String(_0x4c3885[_0xced5('0x26')]),'description':intUtil[_0xced5('0x3e')](_0x466e6a[_0xced5('0x40')],_0x4c3885,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x294aac[_0xced5('0x2d')]+')','ownerid@odata.bind':_0xced5('0x42')+_0x294aac[_0xced5('0x21')]+')','directioncode':_0x294aac[_0xced5('0x46')]===_0xced5('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xced5('0x42')+_0x294aac['userId']+')','participationtypemask':_0x294aac[_0xced5('0x46')]===_0xced5('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0xced5('0x41')+_0x294aac[_0xced5('0x2d')]+')','participationtypemask':_0x294aac[_0xced5('0x46')]===_0xced5('0x47')?0x1:0x2}]},getCustomFields(_0x466e6a[_0xced5('0x48')],_0x4c3885,_0x466e6a[_0xced5('0x3c')])),'headers':{'Authorization':'Bearer\x20'+_0x8d0f83,'OData-Version':_0xced5('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3ea0e7);})[_0xced5('0xf')](function(_0x124f26){var _0x2109fa=_0x124f26[_0xced5('0x29')][_0xced5('0x2a')];var _0x4f2a4f=_0x2109fa['substring'](_0x2109fa[_0xced5('0x2c')]('(')+0x1,_0x2109fa['lastIndexOf'](')'));_0x294aac[_0xced5('0x49')]=_0x4f2a4f;_0x52b20e(_0x294aac);})['catch'](function(_0x1825b8){_0x2f2a57(_0x1825b8['message']);});});}function emit(_0xbefa95,_0xfda45c,_0x29a962,_0x186f9e){var _0xe26279={'uri':util[_0xced5('0x4a')](_0xced5('0x4b'),_0xbefa95,_0x29a962,_0x186f9e)};io['to'](util[_0xced5('0x4a')]('user:%s',_0xfda45c))[_0xced5('0x4c')]('trigger:browser:url',_0xe26279);}exports['cs']=function(_0x365621,_0x24886e,_0x4a47bb,_0x17b028,_0x50e559,_0x462d04,_0xe53b88,_0x3c497f){var _0x320be5={};_0x462d04['remoteUri']=intUtil[_0xced5('0x4d')](_0x462d04[_0xced5('0xc')]);_0x462d04[_0xced5('0x4e')]=intUtil[_0xced5('0x4d')](_0x462d04[_0xced5('0x4e')]);_0x320be5['callDirection']=_0x3c497f===_0xced5('0x47')||_0x3c497f===_0xced5('0x4f')?_0xced5('0x47'):_0xced5('0x24');var _0x44e2b4=util[_0xced5('0x4a')](_0xced5('0x50'),_0x462d04[_0xced5('0xc')]);var _0x30d172=util[_0xced5('0x4a')](_0xced5('0x51'),_0x462d04[_0xced5('0x52')]);var _0xb2458a=util[_0xced5('0x4a')](_0xced5('0x53'),_0x462d04[_0xced5('0x4e')],_0x24886e[_0xced5('0x54')],md5(_0x24886e['uniqueid']));if(_0x50e559&&_0x50e559[_0xced5('0x55')]){logger[_0xced5('0x1d')](_0xced5('0x56'),_0xced5('0x57'));_0x24886e[_0xced5('0x58')]=_0xb2458a;}else if(_0xe53b88&&_0xe53b88[_0xced5('0x59')]&&_0xe53b88['recordingFormat']!==_0xced5('0x5a')){logger['info'](_0xced5('0x5b'),_0xced5('0x57'));_0x24886e[_0xced5('0x58')]=_0xb2458a;}else{_0x24886e[_0xced5('0x58')]='';}return getUser(_0x320be5,_0x462d04,_0x17b028,_0x30d172,_0x44e2b4,_0x3c497f)[_0xced5('0xf')](function(_0x35963f){logger['info']('['+_0x3c497f[_0xced5('0x1e')]()+_0xced5('0x5c'),_0x35963f['userId']);logger[_0xced5('0x1d')]('['+_0x3c497f['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x35963f[_0xced5('0x1a')]);return getEndUser(_0x35963f,_0x462d04,_0x30d172,_0x44e2b4,_0x24886e,_0x3c497f);})[_0xced5('0xf')](function(_0x3722c5){logger[_0xced5('0x1d')]('['+_0x3c497f['toUpperCase']()+_0xced5('0x5d'),_0x3722c5[_0xced5('0x2d')]);logger[_0xced5('0x1d')]('['+_0x3c497f['toUpperCase']()+_0xced5('0x5e'),_0x24886e[_0xced5('0x26')]);return getTicket(_0x3722c5,_0x462d04,_0x30d172,_0x44e2b4,_0x24886e,_0x4a47bb,_0x3c497f);})['then'](function(_0x5bb57e){logger[_0xced5('0x1d')](util[_0xced5('0x4a')]('['+_0x3c497f['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x4a47bb[_0xced5('0x3c')],_0x5bb57e[_0xced5('0x49')]));logger[_0xced5('0x1d')](util['format']('['+_0x3c497f['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x3c497f));if(_0x3c497f!==_0xced5('0x4f')){logger['info']('['+_0x3c497f[_0xced5('0x1e')]()+']',_0xced5('0x5f'));emit(_0x462d04[_0xced5('0xc')],_0x17b028[_0xced5('0x60')],_0x4a47bb[_0xced5('0x3c')],_0x5bb57e['ticketId']);}})[_0xced5('0x11')](function(_0x448a33){logger[_0xced5('0x12')]('['+_0x3c497f['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0xced5('0x61')](_0x448a33,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2e88=['type','nameField','customField','idField','indexOf','content','ticketType','incidents','getString','Fields','phonecall','phonecalls','assign','Subjects','Descriptions','/contacts(','queue','callDirection','format','user:%s','emit','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','./util','md5','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2e88,0x95));var _0x82e8=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0x2e88[_0x184759];return _0xf26d5f;};'use strict';var _=require(_0x82e8('0x0'));var BPromise=require(_0x82e8('0x1'));var rp=require(_0x82e8('0x2'));var util=require(_0x82e8('0x3'));var intUtil=require(_0x82e8('0x4'));var md5=require(_0x82e8('0x5'));var Redis=require('ioredis');var logger=require(_0x82e8('0x6'))(_0x82e8('0x7'));var config=require('../../../../config/environment');config[_0x82e8('0x8')]=_[_0x82e8('0x9')](config['redis'],{'host':_0x82e8('0xa'),'port':0x18eb});var io=require(_0x82e8('0xb'))(new Redis(config[_0x82e8('0x8')]));function getAuthToken(_0x27df44,_0x393c2c,_0x1ecc8f){var _0x1a7d8c={'method':_0x82e8('0xc'),'uri':_0x393c2c,'form':{'client_id':_0x27df44[_0x82e8('0xd')],'resource':_0x27df44[_0x82e8('0xe')],'username':_0x27df44[_0x82e8('0xf')],'password':_0x27df44['password'],'grant_type':_0x82e8('0x10'),'client_secret':_0x27df44[_0x82e8('0x11')]},'json':!![]};return rp(_0x1a7d8c)[_0x82e8('0x12')](function(_0x1f5626){return _0x1f5626[_0x82e8('0x13')];})[_0x82e8('0x14')](function(_0x359489){logger['error']('['+[_0x1ecc8f[_0x82e8('0x15')]()]+_0x82e8('0x16'));return _0x359489[_0x82e8('0x17')];});}function getUser(_0x2cfe6b,_0x192914,_0x5eb2ca,_0x3353e0,_0x2c9569,_0xad6055){return new BPromise(function(_0x46e01e,_0x539d82){return getAuthToken(_0x192914,_0x3353e0,_0xad6055)[_0x82e8('0x12')](function(_0x461744){var _0x3253d2={'method':_0x82e8('0x18'),'uri':_0x2c9569+_0x82e8('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x461744,'OData-Version':_0x82e8('0x1a')},'json':!![]};return rp(_0x3253d2);})[_0x82e8('0x12')](function(_0x574ba2){var _0x1a776d=_0x574ba2[_0x82e8('0x1b')];var _0x16cb41=![];var _0x380f44=null;if(!_[_0x82e8('0x1c')](_0x5eb2ca)){if(intUtil[_0x82e8('0x1d')](_0x5eb2ca[_0x82e8('0x1e')])){_0x2cfe6b['userEmail']=_0x5eb2ca[_0x82e8('0x1e')];for(_0x380f44=0x0;_0x380f44<_0x1a776d[_0x82e8('0x1f')];_0x380f44++){if(_0x1a776d[_0x380f44][_0x82e8('0x20')]===_0x5eb2ca[_0x82e8('0x1e')]&&!_0x1a776d[_0x380f44][_0x82e8('0x21')]){_0x16cb41=!![];logger['info']('['+[_0xad6055[_0x82e8('0x15')]()]+']\x20Agent\x20found\x20'+_0x1a776d[_0x380f44][_0x82e8('0x22')]+'!');_0x2cfe6b[_0x82e8('0x23')]=_0x1a776d[_0x380f44][_0x82e8('0x22')];}}}}if(!_0x16cb41){logger[_0x82e8('0x24')]('['+[_0xad6055[_0x82e8('0x15')]()]+_0x82e8('0x25'));_0x2cfe6b[_0x82e8('0x26')]=_0x192914['username'];for(_0x380f44=0x0;_0x380f44<_0x1a776d[_0x82e8('0x1f')];_0x380f44++){if(_0x1a776d[_0x380f44]['internalemailaddress']===_0x192914['username']){_0x2cfe6b['userId']=_0x1a776d[_0x380f44][_0x82e8('0x22')];}}}_0x46e01e(_0x2cfe6b);})['catch'](function(_0x1ebc4e){_0x539d82(_0x1ebc4e[_0x82e8('0x17')]);});});}function createEndUser(_0xeff996,_0x488b06,_0x2751e1,_0x476602,_0x336015,_0x2400c5){return new BPromise(function(_0x247096,_0x5b2833){return getAuthToken(_0x488b06,_0x2751e1,_0x2400c5)['then'](function(_0x220d51){var _0xe5ea6f=_0x2400c5[_0x82e8('0x27')]()===_0x82e8('0x28')?_0x336015[_0x82e8('0x29')]:_0x336015[_0x82e8('0x2a')];var _0x14450e={'method':_0x82e8('0xc'),'uri':_0x476602+_0x82e8('0x2b'),'body':{'telephone1':_0xe5ea6f,'fullname':_0xe5ea6f,'firstname':_0xe5ea6f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x82e8('0x2c')+_0xeff996[_0x82e8('0x23')]+')'},'headers':{'Authorization':_0x82e8('0x2d')+_0x220d51,'OData-Version':_0x82e8('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x14450e);})['then'](function(_0x435b62){var _0x3ff82d=_0x435b62[_0x82e8('0x2e')][_0x82e8('0x2f')];var _0x27bbfc=_0x3ff82d[_0x82e8('0x30')](_0x3ff82d[_0x82e8('0x31')]('(')+0x1,_0x3ff82d[_0x82e8('0x31')](')'));_0xeff996[_0x82e8('0x32')]=_0x27bbfc;_0x247096(_0xeff996);})[_0x82e8('0x14')](function(_0x1ed0f5){_0x5b2833(_0x1ed0f5['message']);});});}function getEndUser(_0x3e4548,_0x305d86,_0x19ed65,_0x3453ba,_0x472875,_0x18ee10){return new BPromise(function(_0xa88631,_0x25a944){return getAuthToken(_0x305d86,_0x19ed65,_0x18ee10)['then'](function(_0x42bcac){var _0x4aa077={'method':_0x82e8('0x18'),'uri':_0x3453ba+_0x82e8('0x33'),'headers':{'Authorization':'Bearer\x20'+_0x42bcac,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4aa077);})[_0x82e8('0x12')](function(_0x49c21f){var _0x1b78b9=null;if(_0x49c21f){var _0x1a35a8=_0x49c21f[_0x82e8('0x1b')];var _0x1c95a3=![];for(_0x1b78b9=0x0;_0x1b78b9<_0x1a35a8[_0x82e8('0x1f')];_0x1b78b9++){var _0x14f4b5=_0x18ee10[_0x82e8('0x27')]()===_0x82e8('0x28')?_0x472875[_0x82e8('0x29')]:_0x472875[_0x82e8('0x2a')];if(_0x1a35a8[_0x1b78b9][_0x82e8('0x34')]===_0x14f4b5){_0x1c95a3=!![];_0x3e4548[_0x82e8('0x32')]=_0x1a35a8[_0x1b78b9]['contactid'];}}if(_0x1c95a3){_0xa88631(_0x3e4548);}else{return createEndUser(_0x3e4548,_0x305d86,_0x19ed65,_0x3453ba,_0x472875,_0x18ee10)[_0x82e8('0x12')](function(_0x12a7fd){logger[_0x82e8('0x24')]('['+[_0x18ee10['toUpperCase']()]+_0x82e8('0x35'),_0x12a7fd[_0x82e8('0x32')]);_0xa88631(_0x12a7fd);});}}else{return createEndUser(_0x3e4548,_0x305d86,_0x19ed65,_0x3453ba,_0x472875,_0x18ee10)[_0x82e8('0x12')](function(_0x4e67ac){logger[_0x82e8('0x24')]('['+[_0x18ee10[_0x82e8('0x15')]()]+_0x82e8('0x36'),_0x4e67ac[_0x82e8('0x32')]);_0xa88631(_0x4e67ac);});}});});}function getCustomFields(_0x2ed217,_0x1d2208,_0xd480b){var _0x4a5522={};if(_0x2ed217[_0x82e8('0x1f')]>0x0){_[_0x82e8('0x37')](_0x2ed217,function(_0x137525){if(_[_0x82e8('0x38')]([_0x82e8('0x39'),_0x82e8('0x3a')],_0x137525[_0x82e8('0x3b')])&&_0x137525[_0x82e8('0x3c')]&&!_0x137525[_0x82e8('0x3d')]){var _0x795b3a=_0x137525[_0x82e8('0x3e')][_0x82e8('0x27')]();var _0xa3f746=_0x795b3a[_0x82e8('0x30')](0x0,_0x795b3a[_0x82e8('0x3f')]('_'));var _0x4fba12=_0x795b3a[_0x82e8('0x30')](_0x795b3a['indexOf']('_')+0x1);if(_0xa3f746===_0xd480b){_0x4a5522[_0x4fba12]=_0x137525[_0x82e8('0x40')];}}});}return _0x4a5522;}function getTicket(_0x2da19b,_0x8428e1,_0xc996f7,_0x3ff396,_0x3643a9,_0x57ea58,_0x3882c2){return new BPromise(function(_0x58a619,_0xa47699){var _0xe86921;return getAuthToken(_0x8428e1,_0xc996f7,_0x3882c2)[_0x82e8('0x12')](function(_0x3b6996){if(_0x57ea58[_0x82e8('0x41')]==='incident'){_0xe86921={'method':'POST','uri':_0x3ff396+_0x82e8('0x42'),'body':Object['assign']({},{'title':intUtil[_0x82e8('0x43')](_0x57ea58['Subjects'],_0x3643a9,'\x20'),'description':intUtil['getString'](_0x57ea58['Descriptions'],_0x3643a9,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x2da19b[_0x82e8('0x32')]+')','ownerid@odata.bind':_0x82e8('0x2c')+_0x2da19b['userId']+')','caseorigincode':'1'},getCustomFields(_0x57ea58[_0x82e8('0x44')],_0x3643a9,_0x57ea58[_0x82e8('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x3b6996,'OData-Version':_0x82e8('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x57ea58['ticketType']===_0x82e8('0x45')){_0xe86921={'method':_0x82e8('0xc'),'uri':_0x3ff396+_0x82e8('0x46'),'body':Object[_0x82e8('0x47')]({},{'subject':intUtil[_0x82e8('0x43')](_0x57ea58[_0x82e8('0x48')],_0x3643a9,'\x20'),'phonenumber':String(_0x3643a9['calleridnum']),'description':intUtil[_0x82e8('0x43')](_0x57ea58[_0x82e8('0x49')],_0x3643a9,'\x0a'),'regardingobjectid_contact@odata.bind':_0x82e8('0x4a')+_0x2da19b[_0x82e8('0x32')]+')','ownerid@odata.bind':'/systemusers('+_0x2da19b[_0x82e8('0x23')]+')','directioncode':_0x2da19b['callDirection']===_0x82e8('0x4b')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2da19b[_0x82e8('0x23')]+')','participationtypemask':_0x2da19b[_0x82e8('0x4c')]===_0x82e8('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x2da19b[_0x82e8('0x32')]+')','participationtypemask':_0x2da19b['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x57ea58[_0x82e8('0x44')],_0x3643a9,_0x57ea58[_0x82e8('0x41')])),'headers':{'Authorization':_0x82e8('0x2d')+_0x3b6996,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xe86921);})[_0x82e8('0x12')](function(_0x529ac8){var _0x5735a2=_0x529ac8['headers']['odata-entityid'];var _0x386cea=_0x5735a2[_0x82e8('0x30')](_0x5735a2[_0x82e8('0x31')]('(')+0x1,_0x5735a2[_0x82e8('0x31')](')'));_0x2da19b['ticketId']=_0x386cea;_0x58a619(_0x2da19b);})[_0x82e8('0x14')](function(_0x7b1c26){_0xa47699(_0x7b1c26[_0x82e8('0x17')]);});});}function emit(_0x3017ee,_0x2a9e89,_0xcc763c,_0x51714e){var _0x2aab48={'uri':util[_0x82e8('0x4d')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3017ee,_0xcc763c,_0x51714e)};io['to'](util['format'](_0x82e8('0x4e'),_0x2a9e89))[_0x82e8('0x4f')]('trigger:browser:url',_0x2aab48);}exports['cs']=function(_0x11f04e,_0x400274,_0x4be0aa,_0x26ca3d,_0x473129,_0x4a8497,_0x1334c9,_0x5958b5){var _0x44b89f={};_0x4a8497['remoteUri']=intUtil[_0x82e8('0x50')](_0x4a8497[_0x82e8('0xe')]);_0x4a8497['serverUrl']=intUtil[_0x82e8('0x50')](_0x4a8497['serverUrl']);_0x44b89f[_0x82e8('0x4c')]=_0x5958b5==='queue'||_0x5958b5===_0x82e8('0x51')?'queue':_0x82e8('0x28');var _0x19d645=util['format'](_0x82e8('0x52'),_0x4a8497[_0x82e8('0xe')]);var _0x56b579=util['format'](_0x82e8('0x53'),_0x4a8497['tenantId']);var _0x26a7e7=util[_0x82e8('0x4d')](_0x82e8('0x54'),_0x4a8497[_0x82e8('0x55')],_0x400274[_0x82e8('0x56')],md5(_0x400274[_0x82e8('0x56')]));if(_0x473129&&_0x473129[_0x82e8('0x57')]){logger[_0x82e8('0x24')](_0x82e8('0x58'),'Recording\x20is\x20enabled!');_0x400274[_0x82e8('0x59')]=_0x26a7e7;}else if(_0x1334c9&&_0x1334c9['recordingFormat']&&_0x1334c9['recordingFormat']!==_0x82e8('0x5a')){logger[_0x82e8('0x24')](_0x82e8('0x5b'),_0x82e8('0x5c'));_0x400274['recordingURL']=_0x26a7e7;}else{_0x400274[_0x82e8('0x59')]='';}return getUser(_0x44b89f,_0x4a8497,_0x26ca3d,_0x56b579,_0x19d645,_0x5958b5)[_0x82e8('0x12')](function(_0x404deb){logger[_0x82e8('0x24')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x5d'),_0x404deb[_0x82e8('0x23')]);logger[_0x82e8('0x24')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x5e'),_0x404deb[_0x82e8('0x26')]);return getEndUser(_0x404deb,_0x4a8497,_0x56b579,_0x19d645,_0x400274,_0x5958b5);})[_0x82e8('0x12')](function(_0x169cb0){logger[_0x82e8('0x24')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x5f'),_0x169cb0['enduserId']);logger[_0x82e8('0x24')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x60'),_0x400274[_0x82e8('0x2a')]);return getTicket(_0x169cb0,_0x4a8497,_0x56b579,_0x19d645,_0x400274,_0x4be0aa,_0x5958b5);})[_0x82e8('0x12')](function(_0x1a5d62){logger[_0x82e8('0x24')](util[_0x82e8('0x4d')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x61'),_0x4be0aa[_0x82e8('0x41')],_0x1a5d62['ticketId']));logger[_0x82e8('0x24')](util[_0x82e8('0x4d')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x62'),_0x5958b5));if(_0x5958b5!==_0x82e8('0x51')){logger[_0x82e8('0x24')]('['+_0x5958b5[_0x82e8('0x15')]()+']',_0x82e8('0x63'));emit(_0x4a8497[_0x82e8('0xe')],_0x26ca3d[_0x82e8('0x64')],_0x4be0aa[_0x82e8('0x41')],_0x1a5d62[_0x82e8('0x65')]);}})[_0x82e8('0x14')](function(_0xcc79cb){logger[_0x82e8('0x66')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x67'),util['inspect'](_0xcc79cb,{'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 7325f00..b73bab7 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 _0x7a27=['toUpperCase','lastevent','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','then','validateEmail','%s/api/v2/agents','length','find','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Basic\x20%s','apiKey','base64','debug','stringify','GET','map','forEach','includes','type','nameField','customField','content','toString','string','picklist','idField','push','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','monitor_format'];(function(_0xfcdc2e,_0x4ce4af){var _0x3920a7=function(_0x41e209){while(--_0x41e209){_0xfcdc2e['push'](_0xfcdc2e['shift']());}};_0x3920a7(++_0x4ce4af);}(_0x7a27,0x172));var _0x77a2=function(_0x848749,_0x24be02){_0x848749=_0x848749-0x0;var _0x525877=_0x7a27[_0x848749];return _0x525877;};'use strict';var _=require(_0x77a2('0x0'));var rp=require(_0x77a2('0x1'));var md5=require(_0x77a2('0x2'));var util=require(_0x77a2('0x3'));var Redis=require('ioredis');var intUtil=require(_0x77a2('0x4'));var config=require(_0x77a2('0x5'));var logger=require(_0x77a2('0x6'))(_0x77a2('0x7'));config['redis']=_[_0x77a2('0x8')](config[_0x77a2('0x9')],{'host':_0x77a2('0xa'),'port':0x18eb});var io=require(_0x77a2('0xb'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x144d6e,_0xedb0bf,_0x333c9e){io['to'](_0x144d6e)[_0x77a2('0xc')](_0xedb0bf,_0x333c9e);}function getTicket(_0x1379b0,_0x4cd0d8,_0x170171,_0x4b766e,_0x4f6950){logger[_0x77a2('0xd')](_0x77a2('0xe'));var _0x4a8f86=_['merge']({'responder_id':_0x4cd0d8['id'],'requester_id':_0x170171['id'],'name':util[_0x77a2('0xf')](_0x77a2('0x10'),_0x4f6950[_0x77a2('0x11')]),'phone':_0x4f6950[_0x77a2('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x77a2('0x13')](_0x4b766e[_0x77a2('0x14')],_0x4f6950,'\x20'),'description':intUtil['getString'](_0x4b766e[_0x77a2('0x15')],_0x4f6950,_0x77a2('0x16')),'tags':getTags(_0x4b766e['Tags'],_0x77a2('0x17'))},getCustomFields(_0x4b766e['Fields'],_0x4f6950));_0x4a8f86[_0x77a2('0x18')]=_[_0x77a2('0x19')](_['keyBy'](_0x4a8f86[_0x77a2('0x18')],'id'),_0x77a2('0x1a'));return request({'uri':util['format'](_0x77a2('0x1b'),_0x1379b0[_0x77a2('0x1c')]),'method':'POST','body':_0x4a8f86})[_0x77a2('0x1d')](function(_0x8b8873){logger[_0x77a2('0xd')]('Ticket\x20created!');return _0x8b8873;});}function getUser(_0x403b03,_0x76196d){if(intUtil[_0x77a2('0x1e')](_0x76196d)){return request({'uri':util[_0x77a2('0xf')](_0x77a2('0x1f'),_0x403b03[_0x77a2('0x1c')]),'qs':{'email':_0x76196d}})[_0x77a2('0x1d')](function(_0x37f6af){if(_0x37f6af[_0x77a2('0x20')]){logger[_0x77a2('0xd')]('Agent\x20found!');return _[_0x77a2('0x21')](_0x37f6af,function(_0x655995){return _0x655995['contact'][_0x77a2('0x22')]===_0x76196d;});}else{logger[_0x77a2('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x77a2('0xf')](_0x77a2('0x23'),_0x403b03[_0x77a2('0x1c')])})[_0x77a2('0x1d')](function(_0x38ba){logger[_0x77a2('0xd')]('Admin\x20account\x20selected.');return _0x38ba;});}});}else{logger[_0x77a2('0xd')](_0x77a2('0x24'));return request({'uri':util[_0x77a2('0xf')]('%s/api/v2/agents/me',_0x403b03[_0x77a2('0x1c')])})['then'](function(_0xd6245d){logger[_0x77a2('0xd')](_0x77a2('0x25'));return _0xd6245d;});}}function getEndUser(_0x26d77a,_0x3dca97,_0x5004f6){logger[_0x77a2('0xd')](_0x77a2('0x26'),_0x5004f6);return request({'uri':util['format'](_0x77a2('0x27'),_0x26d77a['remoteUri']),'qs':{'phone':_0x5004f6}})['then'](function(_0x57fe4a){if(_0x57fe4a[_0x77a2('0x20')]){logger['info']('Enduser\x20found!');return _[_0x77a2('0x21')](_0x57fe4a,{'phone':_0x5004f6});}else{logger['info'](_0x77a2('0x28'));return request({'uri':util[_0x77a2('0xf')]('%s/api/v2/contacts',_0x26d77a[_0x77a2('0x1c')]),'method':_0x77a2('0x29'),'body':{'name':_0x3dca97,'phone':_0x5004f6}})[_0x77a2('0x1d')](function(_0x77dd40){logger[_0x77a2('0xd')]('Enduser\x20created.');return _0x77dd40;});}});}function getAuth(_0x392252){return util[_0x77a2('0xf')](_0x77a2('0x2a'),new Buffer(_0x392252[_0x77a2('0x2b')]+':X')['toString'](_0x77a2('0x2c')));}function request(_0x4b72e8){logger[_0x77a2('0x2d')]('[HTTP]',JSON[_0x77a2('0x2e')](_0x4b72e8));return rp(_[_0x77a2('0x8')](_0x4b72e8,{'method':_0x77a2('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x42eebb,_0x6b4a8b){var _0x47d752=[];if(_0x42eebb&&_0x42eebb['length']>0x0){_0x47d752=_[_0x77a2('0x30')](_0x42eebb,_0x6b4a8b);}return _0x47d752;}function getCustomFields(_0x1dd57f,_0x2c6644){var _0x4a7094=[];var _0x4d8ecf={'custom_fields':[]};if(_0x1dd57f['length']>0x0){_[_0x77a2('0x31')](_0x1dd57f,function(_0x50577c){if(_[_0x77a2('0x32')](['string','picklist'],_0x50577c[_0x77a2('0x33')])&&_0x50577c[_0x77a2('0x34')]&&!_0x50577c[_0x77a2('0x35')]){_0x4d8ecf[_0x50577c[_0x77a2('0x34')]['toLowerCase']()]=_0x50577c[_0x77a2('0x36')][_0x77a2('0x37')]();}else if(_[_0x77a2('0x32')]([_0x77a2('0x38'),_0x77a2('0x39')],_0x50577c[_0x77a2('0x33')])&&_0x50577c[_0x77a2('0x3a')]&&_0x50577c['customField']){_0x4d8ecf['custom_fields'][_0x77a2('0x3b')]({'id':_0x50577c[_0x77a2('0x3a')],'value':_0x50577c[_0x77a2('0x36')]['toString']()});}else if(_0x50577c['type']==='variable'&&_0x50577c[_0x77a2('0x3c')]&&_0x50577c[_0x77a2('0x3a')]&&_0x50577c[_0x77a2('0x35')]){_0x2c6644[_0x50577c[_0x77a2('0x3c')]]&&_0x4d8ecf[_0x77a2('0x18')]['push']({'id':_0x50577c[_0x77a2('0x3a')],'value':_0x2c6644[_0x50577c['variableName']][_0x77a2('0x37')]()});}else if(_0x50577c[_0x77a2('0x33')]===_0x77a2('0x3d')&&_0x50577c[_0x77a2('0x3e')]&&_0x50577c['Variable']['name']&&_0x50577c[_0x77a2('0x3a')]&&_0x50577c[_0x77a2('0x35')]){_0x2c6644[_0x50577c['Variable'][_0x77a2('0x17')]['toLowerCase']()]&&_0x4d8ecf[_0x77a2('0x18')]['push']({'id':_0x50577c[_0x77a2('0x3a')],'value':_0x2c6644[_0x50577c[_0x77a2('0x3e')][_0x77a2('0x17')][_0x77a2('0x3f')]()][_0x77a2('0x37')]()});}});}return _0x4d8ecf;}exports[_0x77a2('0x40')]=function(_0x10d1a0,_0x52a640,_0x54fc04,_0x1a922a,_0x152ad0,_0x14f8c7){var _0x1dc71c,_0x461a62;_0x14f8c7[_0x77a2('0x1c')]=intUtil[_0x77a2('0x41')](_0x14f8c7[_0x77a2('0x1c')]);_0x14f8c7[_0x77a2('0x42')]=intUtil['stripTrailingSlash'](_0x14f8c7[_0x77a2('0x42')]);if(_0x152ad0&&_0x152ad0['monitor_format']){logger[_0x77a2('0xd')](_0x77a2('0x43'),_0x77a2('0x44'));_0x52a640[_0x77a2('0x45')]=util[_0x77a2('0xf')](_0x77a2('0x46'),_0x14f8c7[_0x77a2('0x42')],_0x52a640[_0x77a2('0x47')],md5(_0x52a640[_0x77a2('0x47')]));}else{_0x52a640['recordingURL']='';}headers[_0x77a2('0x48')]=getAuth(_0x14f8c7);return getUser(_0x14f8c7,_0x1a922a[_0x77a2('0x22')])[_0x77a2('0x1d')](function(_0x5e5b5d){_0x1dc71c=_0x5e5b5d;logger[_0x77a2('0xd')]('The\x20User\x20ID\x20is:',_0x1dc71c['id']);return getEndUser(_0x14f8c7,_0x52a640[_0x77a2('0x11')],_0x52a640[_0x77a2('0x12')]);})[_0x77a2('0x1d')](function(_0x534024){_0x461a62=_0x534024;logger[_0x77a2('0xd')](_0x77a2('0x49'),_0x461a62['id']);return getTicket(_0x14f8c7,_0x1dc71c,_0x461a62,_0x54fc04,_0x52a640);})[_0x77a2('0x1d')](function(_0x42d03b){if(_0x42d03b&&_0x42d03b['id']){logger[_0x77a2('0xd')](_0x77a2('0x4a'));logger[_0x77a2('0xd')]('The\x20Ticket\x20ID\x20is:',_0x42d03b['id']);logger[_0x77a2('0xd')]('[QUEUE]',_0x77a2('0x4b'));emit(util[_0x77a2('0xf')](_0x77a2('0x4c'),_0x1a922a[_0x77a2('0x17')]),_0x77a2('0x4d'),{'uri':util[_0x77a2('0xf')](_0x77a2('0x4e'),_0x14f8c7[_0x77a2('0x1c')],_0x42d03b['id'])});}})[_0x77a2('0x4f')](function(_0x475f5c){logger[_0x77a2('0x50')](_0x77a2('0x43'),JSON['stringify'](_0x475f5c));});};exports['outbound']=function(_0x2f1027,_0x51a08c,_0x10ce49,_0x5b1592,_0x1b5ca5,_0x28e8cd,_0x595557){var _0x45d18c,_0xafb4e8;_0x28e8cd[_0x77a2('0x1c')]=intUtil[_0x77a2('0x41')](_0x28e8cd[_0x77a2('0x1c')]);_0x28e8cd['serverUrl']=intUtil[_0x77a2('0x41')](_0x28e8cd['serverUrl']);if(_0x595557&&_0x595557[_0x77a2('0x51')]&&_0x595557[_0x77a2('0x51')]!==_0x77a2('0x52')){logger[_0x77a2('0xd')](_0x77a2('0x53'),_0x77a2('0x44'));_0x51a08c[_0x77a2('0x45')]=util[_0x77a2('0xf')](_0x77a2('0x46'),_0x28e8cd[_0x77a2('0x42')],_0x51a08c[_0x77a2('0x47')],md5(_0x51a08c[_0x77a2('0x47')]));}headers['Authorization']=getAuth(_0x28e8cd);return getUser(_0x28e8cd,_0x5b1592[_0x77a2('0x22')])[_0x77a2('0x1d')](function(_0x30f8af){_0x45d18c=_0x30f8af;logger[_0x77a2('0xd')](_0x77a2('0x54'),_0x45d18c['id']);return getEndUser(_0x28e8cd,_0x51a08c[_0x77a2('0x55')],_0x51a08c[_0x77a2('0x56')]);})[_0x77a2('0x1d')](function(_0x17ff28){_0xafb4e8=_0x17ff28;logger['info'](_0x77a2('0x49'),_0xafb4e8['id']);return getTicket(_0x28e8cd,_0x45d18c,_0xafb4e8,_0x10ce49,_0x51a08c);})[_0x77a2('0x1d')](function(_0x4aedb0){if(_0x4aedb0&&_0x4aedb0['id']){logger[_0x77a2('0xd')]('Ticket\x20created!');logger[_0x77a2('0xd')](_0x77a2('0x57'),_0x4aedb0['id']);logger[_0x77a2('0xd')]('[OUTBOUND]',_0x77a2('0x4b'));emit(util[_0x77a2('0xf')](_0x77a2('0x4c'),_0x5b1592[_0x77a2('0x17')]),_0x77a2('0x4d'),{'uri':util[_0x77a2('0xf')]('%s/helpdesk/tickets/%d',_0x28e8cd['remoteUri'],_0x4aedb0['id'])});}})[_0x77a2('0x4f')](function(_0x1af224){logger[_0x77a2('0x50')](_0x77a2('0x53'),JSON['stringify'](_0x1af224));});};exports[_0x77a2('0x58')]=function(_0x1a63e1,_0x3b4013,_0x3f5fdf,_0x5981ce,_0x1b7b21,_0x5b3b69){var _0x53e6c6,_0x474f59;_0x5b3b69[_0x77a2('0x1c')]=intUtil[_0x77a2('0x41')](_0x5b3b69[_0x77a2('0x1c')]);_0x5b3b69['serverUrl']=intUtil[_0x77a2('0x41')](_0x5b3b69['serverUrl']);if(_0x1b7b21&&_0x1b7b21[_0x77a2('0x59')]){logger[_0x77a2('0xd')]('['+_0x3b4013['lastevent'][_0x77a2('0x5a')]()+']',_0x77a2('0x44'));_0x3b4013['recordingURL']=util['format'](_0x77a2('0x46'),_0x5b3b69[_0x77a2('0x42')],_0x3b4013[_0x77a2('0x47')],md5(_0x3b4013[_0x77a2('0x47')]));}else{_0x3b4013[_0x77a2('0x45')]='';}headers['Authorization']=getAuth(_0x5b3b69);return getUser(_0x5b3b69,'')[_0x77a2('0x1d')](function(_0x1c4a13){_0x53e6c6=_0x1c4a13;logger[_0x77a2('0xd')](_0x77a2('0x54'),_0x53e6c6['id']);return getEndUser(_0x5b3b69,_0x3b4013[_0x77a2('0x11')],_0x3b4013[_0x77a2('0x12')]);})[_0x77a2('0x1d')](function(_0x3dc837){_0x474f59=_0x3dc837;logger[_0x77a2('0xd')](_0x77a2('0x49'),_0x474f59['id']);return getTicket(_0x5b3b69,_0x53e6c6,_0x474f59,_0x3f5fdf,_0x3b4013);})[_0x77a2('0x1d')](function(_0x3ae4e2){if(_0x3ae4e2){logger[_0x77a2('0xd')](_0x77a2('0x4a'));logger[_0x77a2('0xd')](_0x77a2('0x57'),_0x3ae4e2['id']);}})[_0x77a2('0x4f')](function(_0x56880a){logger[_0x77a2('0x50')]('['+_0x3b4013[_0x77a2('0x5b')]['toUpperCase']()+']',JSON[_0x77a2('0x2e')](_0x56880a));});}; \ No newline at end of file +var _0x6ce1=['user:%s','%s/helpdesk/tickets/%d','error','unmanaged','lastevent','Authorization','Ticket\x20created!','toUpperCase','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','then','%s/api/v2/agents','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','push','Variable','name','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:'];(function(_0x469f30,_0x1c9d41){var _0x5b131d=function(_0x58f0d3){while(--_0x58f0d3){_0x469f30['push'](_0x469f30['shift']());}};_0x5b131d(++_0x1c9d41);}(_0x6ce1,0xca));var _0x16ce=function(_0x2203da,_0xc38ef3){_0x2203da=_0x2203da-0x0;var _0x3af6e4=_0x6ce1[_0x2203da];return _0x3af6e4;};'use strict';var _=require('lodash');var rp=require(_0x16ce('0x0'));var md5=require(_0x16ce('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x16ce('0x2'));var config=require(_0x16ce('0x3'));var logger=require(_0x16ce('0x4'))(_0x16ce('0x5'));config[_0x16ce('0x6')]=_[_0x16ce('0x7')](config[_0x16ce('0x6')],{'host':_0x16ce('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x16ce('0x6')]));var headers={'Content-Type':_0x16ce('0x9'),'Accept':_0x16ce('0x9')};function emit(_0x4845d9,_0x3d812e,_0x190192){io['to'](_0x4845d9)[_0x16ce('0xa')](_0x3d812e,_0x190192);}function getTicket(_0x266296,_0x29c8c,_0x4af52b,_0x51b4ce,_0x460287){logger[_0x16ce('0xb')](_0x16ce('0xc'));var _0x4ed6fa=_[_0x16ce('0xd')]({'responder_id':_0x29c8c['id'],'requester_id':_0x4af52b['id'],'name':util[_0x16ce('0xe')](_0x16ce('0xf'),_0x460287['calleridname']),'phone':_0x460287[_0x16ce('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x16ce('0x11')](_0x51b4ce[_0x16ce('0x12')],_0x460287,'\x20'),'description':intUtil['getString'](_0x51b4ce[_0x16ce('0x13')],_0x460287,_0x16ce('0x14')),'tags':getTags(_0x51b4ce[_0x16ce('0x15')],'name')},getCustomFields(_0x51b4ce[_0x16ce('0x16')],_0x460287));_0x4ed6fa[_0x16ce('0x17')]=_[_0x16ce('0x18')](_[_0x16ce('0x19')](_0x4ed6fa[_0x16ce('0x17')],'id'),_0x16ce('0x1a'));return request({'uri':util[_0x16ce('0xe')](_0x16ce('0x1b'),_0x266296[_0x16ce('0x1c')]),'method':'POST','body':_0x4ed6fa})[_0x16ce('0x1d')](function(_0x3b4f10){logger[_0x16ce('0xb')]('Ticket\x20created!');return _0x3b4f10;});}function getUser(_0x2fca85,_0x2305cd){if(intUtil['validateEmail'](_0x2305cd)){return request({'uri':util['format'](_0x16ce('0x1e'),_0x2fca85[_0x16ce('0x1c')]),'qs':{'email':_0x2305cd}})[_0x16ce('0x1d')](function(_0x269e79){if(_0x269e79['length']){logger[_0x16ce('0xb')](_0x16ce('0x1f'));return _[_0x16ce('0x20')](_0x269e79,function(_0x412a3b){return _0x412a3b[_0x16ce('0x21')]['email']===_0x2305cd;});}else{logger[_0x16ce('0xb')](_0x16ce('0x22'));return request({'uri':util[_0x16ce('0xe')](_0x16ce('0x23'),_0x2fca85['remoteUri'])})['then'](function(_0x433b61){logger[_0x16ce('0xb')](_0x16ce('0x24'));return _0x433b61;});}});}else{logger[_0x16ce('0xb')](_0x16ce('0x25'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x2fca85[_0x16ce('0x1c')])})[_0x16ce('0x1d')](function(_0x1a8330){logger[_0x16ce('0xb')](_0x16ce('0x24'));return _0x1a8330;});}}function getEndUser(_0x118bac,_0x9e1135,_0xd37af2){logger[_0x16ce('0xb')](_0x16ce('0x26'),_0xd37af2);return request({'uri':util[_0x16ce('0xe')]('%s/api/v2/contacts',_0x118bac[_0x16ce('0x1c')]),'qs':{'phone':_0xd37af2}})['then'](function(_0x15fe7a){if(_0x15fe7a[_0x16ce('0x27')]){logger['info'](_0x16ce('0x28'));return _[_0x16ce('0x20')](_0x15fe7a,{'phone':_0xd37af2});}else{logger['info'](_0x16ce('0x29'));return request({'uri':util[_0x16ce('0xe')](_0x16ce('0x2a'),_0x118bac[_0x16ce('0x1c')]),'method':_0x16ce('0x2b'),'body':{'name':_0x9e1135,'phone':_0xd37af2}})['then'](function(_0x22a677){logger['info'](_0x16ce('0x2c'));return _0x22a677;});}});}function getAuth(_0x43da6b){return util['format'](_0x16ce('0x2d'),new Buffer(_0x43da6b[_0x16ce('0x2e')]+':X')[_0x16ce('0x2f')](_0x16ce('0x30')));}function request(_0x29bbf2){logger[_0x16ce('0x31')](_0x16ce('0x32'),JSON[_0x16ce('0x33')](_0x29bbf2));return rp(_['defaults'](_0x29bbf2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x38f0f7,_0x1d1994){var _0x3e8c82=[];if(_0x38f0f7&&_0x38f0f7['length']>0x0){_0x3e8c82=_[_0x16ce('0x34')](_0x38f0f7,_0x1d1994);}return _0x3e8c82;}function getCustomFields(_0x565482,_0x3a23a8){var _0x331f3e=[];var _0x51cf97={'custom_fields':[]};if(_0x565482[_0x16ce('0x27')]>0x0){_[_0x16ce('0x35')](_0x565482,function(_0x32e28b){if(_[_0x16ce('0x36')]([_0x16ce('0x37'),_0x16ce('0x38')],_0x32e28b[_0x16ce('0x39')])&&_0x32e28b[_0x16ce('0x3a')]&&!_0x32e28b[_0x16ce('0x3b')]){_0x51cf97[_0x32e28b[_0x16ce('0x3a')][_0x16ce('0x3c')]()]=_0x32e28b[_0x16ce('0x3d')][_0x16ce('0x2f')]();}else if(_[_0x16ce('0x36')]([_0x16ce('0x37'),_0x16ce('0x38')],_0x32e28b[_0x16ce('0x39')])&&_0x32e28b[_0x16ce('0x3e')]&&_0x32e28b[_0x16ce('0x3b')]){_0x51cf97[_0x16ce('0x17')]['push']({'id':_0x32e28b['idField'],'value':_0x32e28b['content'][_0x16ce('0x2f')]()});}else if(_0x32e28b['type']===_0x16ce('0x3f')&&_0x32e28b[_0x16ce('0x40')]&&_0x32e28b[_0x16ce('0x3e')]&&_0x32e28b[_0x16ce('0x3b')]){_0x3a23a8[_0x32e28b[_0x16ce('0x40')]]&&_0x51cf97[_0x16ce('0x17')][_0x16ce('0x41')]({'id':_0x32e28b[_0x16ce('0x3e')],'value':_0x3a23a8[_0x32e28b[_0x16ce('0x40')]][_0x16ce('0x2f')]()});}else if(_0x32e28b['type']==='customVariable'&&_0x32e28b[_0x16ce('0x42')]&&_0x32e28b[_0x16ce('0x42')][_0x16ce('0x43')]&&_0x32e28b['idField']&&_0x32e28b[_0x16ce('0x3b')]){_0x3a23a8[_0x32e28b[_0x16ce('0x42')][_0x16ce('0x43')][_0x16ce('0x3c')]()]&&_0x51cf97[_0x16ce('0x17')][_0x16ce('0x41')]({'id':_0x32e28b['idField'],'value':_0x3a23a8[_0x32e28b[_0x16ce('0x42')]['name'][_0x16ce('0x3c')]()]['toString']()});}});}return _0x51cf97;}exports['queue']=function(_0x653e48,_0x440198,_0x16b73b,_0x427bc1,_0x79ed06,_0x2c3f8c){var _0x1d9667,_0x398010;_0x2c3f8c[_0x16ce('0x1c')]=intUtil[_0x16ce('0x44')](_0x2c3f8c[_0x16ce('0x1c')]);_0x2c3f8c[_0x16ce('0x45')]=intUtil[_0x16ce('0x44')](_0x2c3f8c[_0x16ce('0x45')]);if(_0x79ed06&&_0x79ed06['monitor_format']){logger[_0x16ce('0xb')](_0x16ce('0x46'),_0x16ce('0x47'));_0x440198[_0x16ce('0x48')]=util['format'](_0x16ce('0x49'),_0x2c3f8c[_0x16ce('0x45')],_0x440198[_0x16ce('0x4a')],md5(_0x440198[_0x16ce('0x4a')]));}else{_0x440198[_0x16ce('0x48')]='';}headers['Authorization']=getAuth(_0x2c3f8c);return getUser(_0x2c3f8c,_0x427bc1['email'])[_0x16ce('0x1d')](function(_0x240612){_0x1d9667=_0x240612;logger[_0x16ce('0xb')](_0x16ce('0x4b'),_0x1d9667['id']);return getEndUser(_0x2c3f8c,_0x440198[_0x16ce('0x4c')],_0x440198[_0x16ce('0x10')]);})['then'](function(_0x3e700f){_0x398010=_0x3e700f;logger[_0x16ce('0xb')]('The\x20Enduser\x20ID\x20is:',_0x398010['id']);return getTicket(_0x2c3f8c,_0x1d9667,_0x398010,_0x16b73b,_0x440198);})[_0x16ce('0x1d')](function(_0x4ca98b){if(_0x4ca98b&&_0x4ca98b['id']){logger[_0x16ce('0xb')]('Ticket\x20created!');logger[_0x16ce('0xb')](_0x16ce('0x4d'),_0x4ca98b['id']);logger[_0x16ce('0xb')](_0x16ce('0x46'),_0x16ce('0x4e'));emit(util[_0x16ce('0xe')]('user:%s',_0x427bc1[_0x16ce('0x43')]),_0x16ce('0x4f'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x2c3f8c[_0x16ce('0x1c')],_0x4ca98b['id'])});}})[_0x16ce('0x50')](function(_0x4cda15){logger['error'](_0x16ce('0x46'),JSON['stringify'](_0x4cda15));});};exports[_0x16ce('0x51')]=function(_0x4a3caa,_0x32f60a,_0x310cf6,_0x32cbcf,_0x5a4b98,_0x2e498c,_0x2b4b9f){var _0x3ee88a,_0x5e2f79;_0x2e498c[_0x16ce('0x1c')]=intUtil['stripTrailingSlash'](_0x2e498c[_0x16ce('0x1c')]);_0x2e498c[_0x16ce('0x45')]=intUtil['stripTrailingSlash'](_0x2e498c[_0x16ce('0x45')]);if(_0x2b4b9f&&_0x2b4b9f['recordingFormat']&&_0x2b4b9f[_0x16ce('0x52')]!==_0x16ce('0x53')){logger[_0x16ce('0xb')](_0x16ce('0x54'),'Recording\x20is\x20enabled!');_0x32f60a[_0x16ce('0x48')]=util[_0x16ce('0xe')](_0x16ce('0x49'),_0x2e498c[_0x16ce('0x45')],_0x32f60a[_0x16ce('0x4a')],md5(_0x32f60a['uniqueid']));}headers['Authorization']=getAuth(_0x2e498c);return getUser(_0x2e498c,_0x32cbcf[_0x16ce('0x55')])[_0x16ce('0x1d')](function(_0x1759ad){_0x3ee88a=_0x1759ad;logger[_0x16ce('0xb')](_0x16ce('0x4b'),_0x3ee88a['id']);return getEndUser(_0x2e498c,_0x32f60a[_0x16ce('0x56')],_0x32f60a[_0x16ce('0x57')]);})[_0x16ce('0x1d')](function(_0x272a10){_0x5e2f79=_0x272a10;logger[_0x16ce('0xb')](_0x16ce('0x58'),_0x5e2f79['id']);return getTicket(_0x2e498c,_0x3ee88a,_0x5e2f79,_0x310cf6,_0x32f60a);})['then'](function(_0x41449b){if(_0x41449b&&_0x41449b['id']){logger[_0x16ce('0xb')]('Ticket\x20created!');logger[_0x16ce('0xb')](_0x16ce('0x4d'),_0x41449b['id']);logger[_0x16ce('0xb')](_0x16ce('0x54'),_0x16ce('0x4e'));emit(util[_0x16ce('0xe')](_0x16ce('0x59'),_0x32cbcf['name']),_0x16ce('0x4f'),{'uri':util[_0x16ce('0xe')](_0x16ce('0x5a'),_0x2e498c['remoteUri'],_0x41449b['id'])});}})[_0x16ce('0x50')](function(_0x1c838a){logger[_0x16ce('0x5b')](_0x16ce('0x54'),JSON[_0x16ce('0x33')](_0x1c838a));});};exports[_0x16ce('0x5c')]=function(_0x1aca85,_0x11f96f,_0x568351,_0x22fe19,_0x3d15fe,_0x507c2e){var _0x153ba7,_0x4ff78b;_0x507c2e[_0x16ce('0x1c')]=intUtil['stripTrailingSlash'](_0x507c2e[_0x16ce('0x1c')]);_0x507c2e['serverUrl']=intUtil['stripTrailingSlash'](_0x507c2e['serverUrl']);if(_0x3d15fe&&_0x3d15fe['monitor_format']){logger[_0x16ce('0xb')]('['+_0x11f96f[_0x16ce('0x5d')]['toUpperCase']()+']',_0x16ce('0x47'));_0x11f96f[_0x16ce('0x48')]=util[_0x16ce('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x507c2e[_0x16ce('0x45')],_0x11f96f['uniqueid'],md5(_0x11f96f[_0x16ce('0x4a')]));}else{_0x11f96f[_0x16ce('0x48')]='';}headers[_0x16ce('0x5e')]=getAuth(_0x507c2e);return getUser(_0x507c2e,'')[_0x16ce('0x1d')](function(_0x40829a){_0x153ba7=_0x40829a;logger[_0x16ce('0xb')](_0x16ce('0x4b'),_0x153ba7['id']);return getEndUser(_0x507c2e,_0x11f96f['calleridname'],_0x11f96f[_0x16ce('0x10')]);})[_0x16ce('0x1d')](function(_0x416127){_0x4ff78b=_0x416127;logger['info'](_0x16ce('0x58'),_0x4ff78b['id']);return getTicket(_0x507c2e,_0x153ba7,_0x4ff78b,_0x568351,_0x11f96f);})[_0x16ce('0x1d')](function(_0x168e83){if(_0x168e83){logger['info'](_0x16ce('0x5f'));logger['info'](_0x16ce('0x4d'),_0x168e83['id']);}})[_0x16ce('0x50')](function(_0x3e75f0){logger[_0x16ce('0x5b')]('['+_0x11f96f[_0x16ce('0x5d')][_0x16ce('0x60')]()+']',JSON[_0x16ce('0x33')](_0x3e75f0));});}; \ 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 888c99d..8e3df5e 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 _0xf767=['emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','adminEmail','username','toLowerCase','outbound','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','error','toUpperCase','Getting\x20user\x20list','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','Requested\x20Resource\x20not\x20Found','catch','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','user:%s'];(function(_0x5665cc,_0x3a52d6){var _0xcd39c5=function(_0x3fbd1c){while(--_0x3fbd1c){_0x5665cc['push'](_0x5665cc['shift']());}};_0xcd39c5(++_0x3a52d6);}(_0xf767,0x76));var _0x7f76=function(_0xba1760,_0x191969){_0xba1760=_0xba1760-0x0;var _0x1f3143=_0xf767[_0xba1760];return _0x1f3143;};'use strict';var _=require('lodash');var rp=require(_0x7f76('0x0'));var md5=require(_0x7f76('0x1'));var util=require(_0x7f76('0x2'));var moment=require(_0x7f76('0x3'));var Promise=require(_0x7f76('0x4'));var Redis=require('ioredis');var intUtil=require(_0x7f76('0x5'));var config=require(_0x7f76('0x6'));var logger=require(_0x7f76('0x7'))(_0x7f76('0x8'));config['redis']=_[_0x7f76('0x9')](config[_0x7f76('0xa')],{'host':_0x7f76('0xb'),'port':0x18eb});var io=require(_0x7f76('0xc'))(new Redis(config[_0x7f76('0xa')]));function getAdminId(_0x5acfee,_0x8b5dce,_0x109950,_0x35d28d){return new Promise(function(_0x15dcd9,_0x4c5f88){var _0x247403=![];var _0x5dc8aa={'method':_0x7f76('0xd'),'uri':_0x35d28d+_0x7f76('0xe'),'json':!![]};_0x5dc8aa[_0x7f76('0xf')]=_0x109950;logger[_0x7f76('0x10')](_0x7f76('0x11'));return rp(_0x5dc8aa)[_0x7f76('0x12')](function(_0x4b48a0){if(_0x4b48a0){var _0xd08392=_0x4b48a0[_0x7f76('0x13')];var _0x47403b=null;for(_0x47403b=0x0;_0x47403b<_0xd08392[_0x7f76('0x14')];_0x47403b++){if(_0xd08392[_0x47403b][_0x7f76('0x15')]===_0x5acfee['adminEmail']){_0x5acfee[_0x7f76('0x16')]=_0xd08392[_0x47403b]['id'];_0x247403=!![];}}if(_0x247403){logger['info'](_0x7f76('0x17'),_0x5acfee[_0x7f76('0x16')]);_0x15dcd9(_0x5acfee);}else{_0x4c5f88({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4c5f88({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0xe81aa9){logger[_0x7f76('0x18')]('['+[_0x8b5dce[_0x7f76('0x19')]()]+']',_0xe81aa9['message']);_0x4c5f88(_0xe81aa9);});});}function getUser(_0x3d32e6,_0x522a2c,_0x629c46){return function(_0x3ceb6a){return new Promise(function(_0x431076,_0x4802ff){var _0x4f1c15={'method':'GET','uri':_0x629c46+'/api/selector/owners','json':!![]};_0x4f1c15['headers']=_0x522a2c;logger[_0x7f76('0x10')](_0x7f76('0x1a'));return rp(_0x4f1c15)[_0x7f76('0x12')](function(_0x21c2ca){if(_0x21c2ca){var _0x54610a=_0x21c2ca[_0x7f76('0x13')];var _0x557c0f=![];var _0x38c4d6=null;if(_0x3ceb6a[_0x7f76('0x1b')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x3ceb6a[_0x7f76('0x1b')]);_0x3ceb6a[_0x7f76('0x1c')]=_0x3ceb6a['agentEmail'];for(_0x38c4d6=0x0;_0x38c4d6<_0x54610a[_0x7f76('0x14')];_0x38c4d6++){if(_0x54610a[_0x38c4d6]['email']===_0x3ceb6a[_0x7f76('0x1b')]){_0x557c0f=!![];_0x3ceb6a[_0x7f76('0x1d')]=_0x54610a[_0x38c4d6]['id'];logger[_0x7f76('0x10')](_0x7f76('0x1e'),_0x3ceb6a[_0x7f76('0x1d')]);}}}if(!_0x557c0f){logger['info'](_0x7f76('0x1f'));_0x3ceb6a['userEmail']=_0x3ceb6a['adminEmail'];_0x3ceb6a[_0x7f76('0x1d')]=_0x3ceb6a[_0x7f76('0x16')];_0x557c0f=!![];}if(_0x557c0f){_0x431076(_0x3ceb6a);}else{_0x4802ff({'statusCode':0x194,'message':_0x7f76('0x20')});}}else{_0x4802ff({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x7f76('0x21')](function(_0x1347bf){logger[_0x7f76('0x18')]('['+[_0x3d32e6[_0x7f76('0x19')]()]+']',_0x1347bf[_0x7f76('0x22')]);_0x4802ff(_0x1347bf);});});};}function searchContact(_0x5811eb,_0x13f3c9,_0xd6584d,_0x523d7a){return new Promise(function(_0x4ee0b0,_0xe459de){var _0x58829a={'method':_0x7f76('0xd'),'headers':_0x13f3c9,'uri':_0x5811eb+_0x7f76('0x23')+_0x523d7a+_0x7f76('0x24')+_0xd6584d+_0x7f76('0x25'),'json':!![]};rp(_0x58829a)[_0x7f76('0x12')](function(_0x22f8c6){var _0x503223=_[_0x7f76('0x26')](_0x22f8c6[_0x7f76('0x27')][_0x7f76('0x27')],[_0xd6584d,_0x523d7a]);_0x4ee0b0(_0x503223);})[_0x7f76('0x21')](function(_0x5eb5cf){_0xe459de(_0x5eb5cf);});});}function getEndUser(_0x3e4df4,_0xa087db,_0x3aacba){return function(_0x4d7a2f){return new Promise(function(_0x208ced,_0x419dad){logger[_0x7f76('0x10')](util[_0x7f76('0x28')](_0x7f76('0x29'),_0x4d7a2f[_0x7f76('0x2a')]));searchContact(_0x3aacba,_0xa087db,_0x7f76('0x2b'),_0x4d7a2f[_0x7f76('0x2a')])[_0x7f76('0x12')](function(_0x371e05){if(_0x371e05){_0x4d7a2f[_0x7f76('0x2c')]=_0x371e05['id'];logger[_0x7f76('0x10')](_0x7f76('0x2d'),_0x4d7a2f['endUserId']);return _0x208ced(_0x4d7a2f);}searchContact(_0x3aacba,_0xa087db,_0x7f76('0x2e'),_0x4d7a2f[_0x7f76('0x2a')])[_0x7f76('0x12')](function(_0x19dfe0){if(_0x19dfe0){_0x4d7a2f[_0x7f76('0x2c')]=_0x19dfe0['id'];logger[_0x7f76('0x10')](_0x7f76('0x2f'),_0x4d7a2f[_0x7f76('0x2c')]);return _0x208ced(_0x4d7a2f);}createEndUser(_0x4d7a2f,_0x3e4df4,_0xa087db,_0x3aacba)['then'](function(_0x1d742c){logger['info']('Contact\x20created:',_0x1d742c[_0x7f76('0x2c')]);return _0x208ced(_0x1d742c);});});})['catch'](function(_0x37b9d7){_0x419dad(_0x37b9d7);});});};}function createEndUser(_0x165a1e,_0x539c90,_0x3dbcc3,_0x516806){return new Promise(function(_0x4c437f,_0x818d98){var _0x205223=moment();var _0x445d2d={'method':_0x7f76('0x30'),'uri':_0x516806+_0x7f76('0x31'),'body':{'contact':{'last_name':_0x165a1e['contactNumber'],'work_number':_0x165a1e[_0x7f76('0x2a')],'mobile_number':_0x165a1e[_0x7f76('0x2a')],'owner_id':_0x165a1e['userId'],'created_at':_0x205223['format'](_0x7f76('0x32'))}},'json':!![]};_0x445d2d['headers']=_0x3dbcc3;logger[_0x7f76('0x10')](_0x7f76('0x33'));return rp(_0x445d2d)[_0x7f76('0x12')](function(_0x4ddbab){_0x165a1e[_0x7f76('0x2c')]=_0x4ddbab[_0x7f76('0x34')]['id'];_0x4c437f(_0x165a1e);})[_0x7f76('0x21')](function(_0x3d9bbe){logger[_0x7f76('0x18')]('['+[_0x539c90[_0x7f76('0x19')]()]+']',_0x3d9bbe['message']);_0x818d98(_0x3d9bbe['message']);});});}function getTicket(_0x218370,_0x669d8b,_0x2dd20c,_0x331f75,_0xc8f757){return function(_0x15c5ba){logger[_0x7f76('0x10')](_0x7f76('0x35'));return new Promise(function(_0x211cb3,_0x63fef4){var _0x812ee2=moment();var _0x313d37={'method':_0x7f76('0x30'),'uri':_0x2dd20c+_0x7f76('0x36'),'body':{'title':intUtil[_0x7f76('0x37')](_0x331f75[_0x7f76('0x38')],_0xc8f757,'\x20'),'description':intUtil[_0x7f76('0x37')](_0x331f75[_0x7f76('0x39')],_0xc8f757,'\x0a'),'owner_id':_0x15c5ba['userId'],'creater_id':_0x15c5ba[_0x7f76('0x16')],'targetable_id':_0x15c5ba[_0x7f76('0x2c')],'targetable_type':_0x7f76('0x3a'),'created_at':_0x812ee2['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x812ee2[_0x7f76('0x3b')](0x1e,'m')['format'](_0x7f76('0x32'))},'json':!![]};_0x313d37['headers']=_0x669d8b;return rp(_0x313d37)['then'](function(_0x2237ed){_0x15c5ba[_0x7f76('0x3c')]=_0x2237ed[_0x7f76('0x3d')]['id'];logger[_0x7f76('0x10')](_0x7f76('0x3e'),_0x15c5ba[_0x7f76('0x3c')]);_0x211cb3(_0x15c5ba);})[_0x7f76('0x21')](function(_0x3588e2){logger[_0x7f76('0x18')]('['+[_0x218370[_0x7f76('0x19')]()]+']',_0x3588e2[_0x7f76('0x22')]);_0x63fef4(_0x3588e2[_0x7f76('0x22')]);});});};}function emit(_0x12f609,_0x28701e,_0x5b62ef){var _0x450c49={'uri':_0x12f609+'/contacts/'+_0x5b62ef};io['to'](util[_0x7f76('0x28')](_0x7f76('0x3f'),_0x28701e))[_0x7f76('0x40')](_0x7f76('0x41'),_0x450c49);}exports['cs']=function(_0x487b1f,_0x16ffcd,_0x442ba9,_0x107ff6,_0x25094b,_0x54785e,_0x3ddd3c,_0xd87fe7){var _0x53f77a={};var _0x163307={'Authorization':_0x7f76('0x42')+_0x54785e[_0x7f76('0x43')]};_0x54785e['remoteUri']=intUtil[_0x7f76('0x44')](_0x54785e[_0x7f76('0x45')]);_0x54785e[_0x7f76('0x46')]=intUtil[_0x7f76('0x44')](_0x54785e[_0x7f76('0x46')]);var _0x398a90=_0x54785e[_0x7f76('0x45')];_0x53f77a[_0x7f76('0x47')]=_0x54785e[_0x7f76('0x48')];_0x53f77a[_0x7f76('0x2a')]=_0xd87fe7[_0x7f76('0x49')]()===_0x7f76('0x4a')?_0x16ffcd['destcalleridnum']:_0x16ffcd[_0x7f76('0x4b')];_0x53f77a['callDirection']=_0xd87fe7===_0x7f76('0x4c')||_0xd87fe7===_0x7f76('0x4d')?_0x7f76('0x4c'):'outbound';if(_0x107ff6){_0x53f77a[_0x7f76('0x1b')]=_0x107ff6[_0x7f76('0x15')];}var _0x48ceb1=util[_0x7f76('0x28')](_0x7f76('0x4e'),_0x54785e[_0x7f76('0x46')],_0x16ffcd[_0x7f76('0x4f')],md5(_0x16ffcd[_0x7f76('0x4f')]));if(_0x25094b&&_0x25094b[_0x7f76('0x50')]){logger[_0x7f76('0x10')](_0x7f76('0x51'),_0x7f76('0x52'));_0x16ffcd['recordingURL']=_0x48ceb1;}else if(_0x3ddd3c&&_0x3ddd3c['recordingFormat']&&_0x3ddd3c[_0x7f76('0x53')]!==_0x7f76('0x54')){logger[_0x7f76('0x10')](_0x7f76('0x55'),_0x7f76('0x52'));_0x16ffcd[_0x7f76('0x56')]=_0x48ceb1;}else{_0x16ffcd[_0x7f76('0x56')]='';}return getAdminId(_0x53f77a,_0xd87fe7,_0x163307,_0x398a90)[_0x7f76('0x12')](getUser(_0xd87fe7,_0x163307,_0x398a90))[_0x7f76('0x12')](getEndUser(_0xd87fe7,_0x163307,_0x398a90))['then'](getTicket(_0xd87fe7,_0x163307,_0x398a90,_0x442ba9,_0x16ffcd))[_0x7f76('0x12')](function(_0x2aca95){logger[_0x7f76('0x10')](util[_0x7f76('0x28')](_0x7f76('0x57'),_0x2aca95[_0x7f76('0x3c')]));if(_0xd87fe7!==_0x7f76('0x4d')){logger['info']('['+[_0xd87fe7[_0x7f76('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x398a90,_0x107ff6[_0x7f76('0x58')],_0x2aca95[_0x7f76('0x2c')]);}})[_0x7f76('0x21')](function(_0x4644b2){logger[_0x7f76('0x18')]('['+[_0xd87fe7[_0x7f76('0x19')]()]+_0x7f76('0x59'),util[_0x7f76('0x5a')](_0x4644b2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9efe=['add','Task\x20created:','ticketId','/contacts/','user:%s','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','headers','contact','toUpperCase','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9efe,0xca));var _0xe9ef=function(_0x3653c7,_0xadb356){_0x3653c7=_0x3653c7-0x0;var _0x58a021=_0x9efe[_0x3653c7];return _0x58a021;};'use strict';var _=require('lodash');var rp=require(_0xe9ef('0x0'));var md5=require(_0xe9ef('0x1'));var util=require(_0xe9ef('0x2'));var moment=require(_0xe9ef('0x3'));var Promise=require(_0xe9ef('0x4'));var Redis=require('ioredis');var intUtil=require(_0xe9ef('0x5'));var config=require(_0xe9ef('0x6'));var logger=require(_0xe9ef('0x7'))(_0xe9ef('0x8'));config[_0xe9ef('0x9')]=_[_0xe9ef('0xa')](config[_0xe9ef('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x40ffdc,_0x2f7280,_0x39dfc9,_0x502e42){return new Promise(function(_0x51b634,_0x55d349){var _0x4f4122=![];var _0x341d45={'method':_0xe9ef('0xb'),'uri':_0x502e42+_0xe9ef('0xc'),'json':!![]};_0x341d45['headers']=_0x39dfc9;logger[_0xe9ef('0xd')](_0xe9ef('0xe'));return rp(_0x341d45)[_0xe9ef('0xf')](function(_0x42184b){if(_0x42184b){var _0x245811=_0x42184b[_0xe9ef('0x10')];var _0x58df0a=null;for(_0x58df0a=0x0;_0x58df0a<_0x245811[_0xe9ef('0x11')];_0x58df0a++){if(_0x245811[_0x58df0a][_0xe9ef('0x12')]===_0x40ffdc[_0xe9ef('0x13')]){_0x40ffdc[_0xe9ef('0x14')]=_0x245811[_0x58df0a]['id'];_0x4f4122=!![];}}if(_0x4f4122){logger[_0xe9ef('0xd')]('Admin\x20found:',_0x40ffdc[_0xe9ef('0x14')]);_0x51b634(_0x40ffdc);}else{_0x55d349({'statusCode':0x194,'message':_0xe9ef('0x15')});}}else{_0x55d349({'statusCode':0x194,'message':_0xe9ef('0x15')});}})[_0xe9ef('0x16')](function(_0x2c7f15){logger['error']('['+[_0x2f7280['toUpperCase']()]+']',_0x2c7f15[_0xe9ef('0x17')]);_0x55d349(_0x2c7f15);});});}function getUser(_0x5b9d02,_0x8ed5e3,_0x168f62){return function(_0x3c94c3){return new Promise(function(_0x50a8d7,_0x104f82){var _0x1f1fad={'method':_0xe9ef('0xb'),'uri':_0x168f62+_0xe9ef('0xc'),'json':!![]};_0x1f1fad['headers']=_0x8ed5e3;logger[_0xe9ef('0xd')]('Getting\x20user\x20list');return rp(_0x1f1fad)['then'](function(_0x17a46b){if(_0x17a46b){var _0x446728=_0x17a46b['users'];var _0x3d4780=![];var _0x275012=null;if(_0x3c94c3[_0xe9ef('0x18')]!==null){logger['info'](_0xe9ef('0x19'),_0x3c94c3[_0xe9ef('0x18')]);_0x3c94c3[_0xe9ef('0x1a')]=_0x3c94c3[_0xe9ef('0x18')];for(_0x275012=0x0;_0x275012<_0x446728[_0xe9ef('0x11')];_0x275012++){if(_0x446728[_0x275012]['email']===_0x3c94c3[_0xe9ef('0x18')]){_0x3d4780=!![];_0x3c94c3[_0xe9ef('0x1b')]=_0x446728[_0x275012]['id'];logger[_0xe9ef('0xd')](_0xe9ef('0x1c'),_0x3c94c3[_0xe9ef('0x1b')]);}}}if(!_0x3d4780){logger[_0xe9ef('0xd')](_0xe9ef('0x1d'));_0x3c94c3['userEmail']=_0x3c94c3[_0xe9ef('0x13')];_0x3c94c3['userId']=_0x3c94c3['adminId'];_0x3d4780=!![];}if(_0x3d4780){_0x50a8d7(_0x3c94c3);}else{_0x104f82({'statusCode':0x194,'message':_0xe9ef('0x15')});}}else{_0x104f82({'statusCode':0x194,'message':_0xe9ef('0x15')});}})[_0xe9ef('0x16')](function(_0x13a500){logger[_0xe9ef('0x1e')]('['+[_0x5b9d02['toUpperCase']()]+']',_0x13a500[_0xe9ef('0x17')]);_0x104f82(_0x13a500);});});};}function searchContact(_0x3bedc4,_0x368a5d,_0x2da474,_0x1ea8af){return new Promise(function(_0x31d562,_0x3866c){var _0x837724={'method':_0xe9ef('0xb'),'headers':_0x368a5d,'uri':_0x3bedc4+_0xe9ef('0x1f')+_0x1ea8af+_0xe9ef('0x20')+_0x2da474+_0xe9ef('0x21'),'json':!![]};rp(_0x837724)['then'](function(_0x2f5e2e){var _0x5ad8d5=_[_0xe9ef('0x22')](_0x2f5e2e[_0xe9ef('0x23')][_0xe9ef('0x23')],[_0x2da474,_0x1ea8af]);_0x31d562(_0x5ad8d5);})[_0xe9ef('0x16')](function(_0x3175bd){_0x3866c(_0x3175bd);});});}function getEndUser(_0x2ff42b,_0x11acab,_0x3509bc){return function(_0x302904){return new Promise(function(_0x517eec,_0x1a963f){logger['info'](util['format'](_0xe9ef('0x24'),_0x302904[_0xe9ef('0x25')]));searchContact(_0x3509bc,_0x11acab,_0xe9ef('0x26'),_0x302904[_0xe9ef('0x25')])[_0xe9ef('0xf')](function(_0x1fa509){if(_0x1fa509){_0x302904[_0xe9ef('0x27')]=_0x1fa509['id'];logger[_0xe9ef('0xd')](_0xe9ef('0x28'),_0x302904[_0xe9ef('0x27')]);return _0x517eec(_0x302904);}searchContact(_0x3509bc,_0x11acab,_0xe9ef('0x29'),_0x302904[_0xe9ef('0x25')])['then'](function(_0x80cddb){if(_0x80cddb){_0x302904[_0xe9ef('0x27')]=_0x80cddb['id'];logger[_0xe9ef('0xd')](_0xe9ef('0x2a'),_0x302904['endUserId']);return _0x517eec(_0x302904);}createEndUser(_0x302904,_0x2ff42b,_0x11acab,_0x3509bc)[_0xe9ef('0xf')](function(_0x3d28ac){logger[_0xe9ef('0xd')](_0xe9ef('0x2b'),_0x3d28ac[_0xe9ef('0x27')]);return _0x517eec(_0x3d28ac);});});})[_0xe9ef('0x16')](function(_0x10b3c6){_0x1a963f(_0x10b3c6);});});};}function createEndUser(_0x17de02,_0x201ec3,_0xf0b690,_0x4325c3){return new Promise(function(_0x10c487,_0x3ea6c0){var _0x439dca=moment();var _0x2617ca={'method':_0xe9ef('0x2c'),'uri':_0x4325c3+_0xe9ef('0x2d'),'body':{'contact':{'last_name':_0x17de02[_0xe9ef('0x25')],'work_number':_0x17de02[_0xe9ef('0x25')],'mobile_number':_0x17de02[_0xe9ef('0x25')],'owner_id':_0x17de02[_0xe9ef('0x1b')],'created_at':_0x439dca[_0xe9ef('0x2e')](_0xe9ef('0x2f'))}},'json':!![]};_0x2617ca[_0xe9ef('0x30')]=_0xf0b690;logger[_0xe9ef('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2617ca)[_0xe9ef('0xf')](function(_0x3d3ff7){_0x17de02['endUserId']=_0x3d3ff7[_0xe9ef('0x31')]['id'];_0x10c487(_0x17de02);})['catch'](function(_0x3db316){logger[_0xe9ef('0x1e')]('['+[_0x201ec3[_0xe9ef('0x32')]()]+']',_0x3db316[_0xe9ef('0x17')]);_0x3ea6c0(_0x3db316['message']);});});}function getTicket(_0x326733,_0xa80c48,_0xa34665,_0x125fb7,_0x287fbd){return function(_0x4a4124){logger['info'](_0xe9ef('0x33'));return new Promise(function(_0x6c7258,_0x4021f8){var _0x22b0c8=moment();var _0x366e1c={'method':_0xe9ef('0x2c'),'uri':_0xa34665+_0xe9ef('0x34'),'body':{'title':intUtil[_0xe9ef('0x35')](_0x125fb7['Subjects'],_0x287fbd,'\x20'),'description':intUtil[_0xe9ef('0x35')](_0x125fb7[_0xe9ef('0x36')],_0x287fbd,'\x0a'),'owner_id':_0x4a4124['userId'],'creater_id':_0x4a4124[_0xe9ef('0x14')],'targetable_id':_0x4a4124[_0xe9ef('0x27')],'targetable_type':_0xe9ef('0x37'),'created_at':_0x22b0c8[_0xe9ef('0x2e')](_0xe9ef('0x2f')),'due_date':_0x22b0c8[_0xe9ef('0x38')](0x1e,'m')[_0xe9ef('0x2e')](_0xe9ef('0x2f'))},'json':!![]};_0x366e1c[_0xe9ef('0x30')]=_0xa80c48;return rp(_0x366e1c)[_0xe9ef('0xf')](function(_0x5c930e){_0x4a4124['ticketId']=_0x5c930e['task']['id'];logger[_0xe9ef('0xd')](_0xe9ef('0x39'),_0x4a4124[_0xe9ef('0x3a')]);_0x6c7258(_0x4a4124);})['catch'](function(_0x50beaa){logger[_0xe9ef('0x1e')]('['+[_0x326733['toUpperCase']()]+']',_0x50beaa[_0xe9ef('0x17')]);_0x4021f8(_0x50beaa['message']);});});};}function emit(_0xf9ba94,_0x1f843a,_0x352240){var _0x880370={'uri':_0xf9ba94+_0xe9ef('0x3b')+_0x352240};io['to'](util[_0xe9ef('0x2e')](_0xe9ef('0x3c'),_0x1f843a))['emit']('trigger:browser:url',_0x880370);}exports['cs']=function(_0x55becf,_0x2c5b67,_0x5862bd,_0x2aac75,_0x58dc05,_0x3f4f04,_0x17735b,_0x358c3c){var _0x29ed7d={};var _0x30759e={'Authorization':_0xe9ef('0x3d')+_0x3f4f04[_0xe9ef('0x3e')]};_0x3f4f04['remoteUri']=intUtil['stripTrailingSlash'](_0x3f4f04[_0xe9ef('0x3f')]);_0x3f4f04[_0xe9ef('0x40')]=intUtil[_0xe9ef('0x41')](_0x3f4f04[_0xe9ef('0x40')]);var _0xae54b0=_0x3f4f04[_0xe9ef('0x3f')];_0x29ed7d[_0xe9ef('0x13')]=_0x3f4f04[_0xe9ef('0x42')];_0x29ed7d['contactNumber']=_0x358c3c[_0xe9ef('0x43')]()===_0xe9ef('0x44')?_0x2c5b67[_0xe9ef('0x45')]:_0x2c5b67[_0xe9ef('0x46')];_0x29ed7d[_0xe9ef('0x47')]=_0x358c3c===_0xe9ef('0x48')||_0x358c3c==='unmanaged'?_0xe9ef('0x48'):_0xe9ef('0x44');if(_0x2aac75){_0x29ed7d[_0xe9ef('0x18')]=_0x2aac75[_0xe9ef('0x12')];}var _0x2e5a3a=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f4f04[_0xe9ef('0x40')],_0x2c5b67[_0xe9ef('0x49')],md5(_0x2c5b67[_0xe9ef('0x49')]));if(_0x58dc05&&_0x58dc05[_0xe9ef('0x4a')]){logger[_0xe9ef('0xd')]('[QUEUE]',_0xe9ef('0x4b'));_0x2c5b67[_0xe9ef('0x4c')]=_0x2e5a3a;}else if(_0x17735b&&_0x17735b[_0xe9ef('0x4d')]&&_0x17735b[_0xe9ef('0x4d')]!==_0xe9ef('0x4e')){logger[_0xe9ef('0xd')](_0xe9ef('0x4f'),_0xe9ef('0x4b'));_0x2c5b67[_0xe9ef('0x4c')]=_0x2e5a3a;}else{_0x2c5b67['recordingURL']='';}return getAdminId(_0x29ed7d,_0x358c3c,_0x30759e,_0xae54b0)[_0xe9ef('0xf')](getUser(_0x358c3c,_0x30759e,_0xae54b0))['then'](getEndUser(_0x358c3c,_0x30759e,_0xae54b0))[_0xe9ef('0xf')](getTicket(_0x358c3c,_0x30759e,_0xae54b0,_0x5862bd,_0x2c5b67))[_0xe9ef('0xf')](function(_0x4e7f6a){logger[_0xe9ef('0xd')](util['format'](_0xe9ef('0x50'),_0x4e7f6a[_0xe9ef('0x3a')]));if(_0x358c3c!==_0xe9ef('0x51')){logger[_0xe9ef('0xd')]('['+[_0x358c3c['toUpperCase']()]+']',_0xe9ef('0x52'));emit(_0xae54b0,_0x2aac75[_0xe9ef('0x53')],_0x4e7f6a['endUserId']);}})[_0xe9ef('0x16')](function(_0x5bd0b5){logger[_0xe9ef('0x1e')]('['+[_0x358c3c[_0xe9ef('0x32')]()]+_0xe9ef('0x54'),util[_0xe9ef('0x55')](_0x5bd0b5,{'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 ed53566..5bbdfb8 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 _0x8603=['zendesk','salesforce','sugarcrm','freshdesk','zoho','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./dynamics365'];(function(_0x464963,_0x157151){var _0x4ca642=function(_0x204bbc){while(--_0x204bbc){_0x464963['push'](_0x464963['shift']());}};_0x4ca642(++_0x157151);}(_0x8603,0x190));var _0x3860=function(_0x1841c1,_0x5645e2){_0x1841c1=_0x1841c1-0x0;var _0xa1db6a=_0x8603[_0x1841c1];return _0xa1db6a;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var zendesk=require(_0x3860('0x1'));var salesforce=require(_0x3860('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x3860('0x3'));var desk=require(_0x3860('0x4'));var vtiger=require(_0x3860('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x3860('0x6'));var freshsales=require('./freshsales');var integrations=[_0x3860('0x7'),_0x3860('0x8'),_0x3860('0x9'),_0x3860('0xa'),_0x3860('0xb'),'desk','vtiger','dynamics365',_0x3860('0xc'),_0x3860('0xd')];exports['exec']=function(_0x2fb169,_0x38737e,_0x5909b8,_0x101263,_0x45ba50,_0x4cd35d){if(_0x5909b8){if(_[_0x3860('0xe')](integrations,_0x2fb169[_0x3860('0xf')]['toLowerCase']())){try{var _0x405510=null;var _0x8ad61d='';var _0x2428f6=_0x5909b8[_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]()];if(_0x2428f6){var _0x21ae4e=_0x2428f6[_0x2fb169[_0x3860('0x11')]];if(_0x21ae4e){var _0x12b23b=_[_0x3860('0x12')](_0x21ae4e[_0x3860('0x13')],{'id':parseInt(_0x2fb169['data3'],0xa)});if(_0x12b23b){if(_0x101263){if(_0x45ba50&&_0x38737e[_0x3860('0x14')]){_0x8ad61d=_0x3860('0x14');}else if(_0x38737e[_0x3860('0x15')]){_0x8ad61d=_0x3860('0x16');}else{console[_0x3860('0x17')](_0x3860('0x18'),_0x38737e);}}else{_0x8ad61d=_0x3860('0x19');}switch(_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]()){case _0x3860('0x7'):zendesk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x8'):salesforce[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x9'):sugarcrm[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case'freshdesk':freshdesk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case'zoho':zoho[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x1a'):desk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x1b'):vtiger[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0xc'):freshsales['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;case'servicenow':servicenow['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;case _0x3860('0x1c'):dynamics365['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;default:console[_0x3860('0x17')](_0x3860('0x1d'));}}else{_0x405510=require(_0x3860('0x1e'))(_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]());_0x405510[_0x3860('0x1f')](_0x3860('0x20'),util[_0x3860('0x21')](_0x3860('0x22'),_0x2fb169[_0x3860('0xf')][_0x3860('0x10')](),_0x2fb169[_0x3860('0x23')]));}}else{_0x405510=require(_0x3860('0x1e'))(_0x2fb169[_0x3860('0xf')]['toLowerCase']());_0x405510[_0x3860('0x1f')](_0x3860('0x20'),util[_0x3860('0x21')](_0x3860('0x24'),_0x2fb169[_0x3860('0xf')]['toLowerCase'](),_0x2fb169[_0x3860('0x11')]));}}else{}}catch(_0x568515){console['error'](_0x568515);}}}}; \ No newline at end of file +var _0x0b0e=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','unmanaged','freshdesk','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./zoho'];(function(_0x404aac,_0x5a1a38){var _0x35a7e4=function(_0x1781fa){while(--_0x1781fa){_0x404aac['push'](_0x404aac['shift']());}};_0x35a7e4(++_0x5a1a38);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x0b0e[_0x5ce3c8];return _0xa76867;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var zendesk=require(_0xe0b0('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0xe0b0('0x2'));var freshdesk=require(_0xe0b0('0x3'));var zoho=require(_0xe0b0('0x4'));var desk=require(_0xe0b0('0x5'));var vtiger=require(_0xe0b0('0x6'));var servicenow=require(_0xe0b0('0x7'));var dynamics365=require(_0xe0b0('0x8'));var freshsales=require(_0xe0b0('0x9'));var integrations=[_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'freshdesk','zoho',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'servicenow'];exports[_0xe0b0('0x11')]=function(_0x1dd3b8,_0x553d4f,_0x1fef28,_0x2f32b6,_0x574d96,_0x399320){if(_0x1fef28){if(_[_0xe0b0('0x12')](integrations,_0x1dd3b8[_0xe0b0('0x13')]['toLowerCase']())){try{var _0x3068c0=null;var _0x1c358a='';var _0x3cc19a=_0x1fef28[_0x1dd3b8[_0xe0b0('0x13')][_0xe0b0('0x14')]()];if(_0x3cc19a){var _0x4d2bf7=_0x3cc19a[_0x1dd3b8[_0xe0b0('0x15')]];if(_0x4d2bf7){var _0x154de6=_[_0xe0b0('0x16')](_0x4d2bf7[_0xe0b0('0x17')],{'id':parseInt(_0x1dd3b8[_0xe0b0('0x18')],0xa)});if(_0x154de6){if(_0x2f32b6){if(_0x574d96&&_0x553d4f['queue']){_0x1c358a=_0xe0b0('0x19');}else if(_0x553d4f['routeId']){_0x1c358a=_0xe0b0('0x1a');}else{console[_0xe0b0('0x1b')]('EVENT\x20UNKNOWN',_0x553d4f);}}else{_0x1c358a=_0xe0b0('0x1c');}switch(_0x1dd3b8['data1'][_0xe0b0('0x14')]()){case _0xe0b0('0xa'):zendesk[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'salesforce':salesforce[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'sugarcrm':sugarcrm[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case _0xe0b0('0x1d'):freshdesk[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'zoho':zoho[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'desk':desk[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'vtiger':vtiger[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case _0xe0b0('0x10'):freshsales['cs'](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320,_0x1c358a);break;case'servicenow':servicenow['cs'](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320,_0x1c358a);break;case'dynamics365':dynamics365['cs'](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320,_0x1c358a);break;default:console[_0xe0b0('0x1b')]('unknown\x20integration');}}else{_0x3068c0=require(_0xe0b0('0x1e'))(_0x1dd3b8['data1'][_0xe0b0('0x14')]());_0x3068c0[_0xe0b0('0x1f')](_0xe0b0('0x20'),util[_0xe0b0('0x21')](_0xe0b0('0x22'),_0x1dd3b8['data1']['toLowerCase'](),_0x1dd3b8[_0xe0b0('0x18')]));}}else{_0x3068c0=require('../../../../config/logger')(_0x1dd3b8[_0xe0b0('0x13')][_0xe0b0('0x14')]());_0x3068c0['error'](_0xe0b0('0x20'),util['format'](_0xe0b0('0x23'),_0x1dd3b8['data1'][_0xe0b0('0x14')](),_0x1dd3b8['data2']));}}else{}}catch(_0x3e5c88){console['error'](_0x3e5c88);}}}}; \ 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 6f97bce..3389b1f 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 _0x5fa2=['Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','create','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','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','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','isNil','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','Task','assign','utc','Subjects','getString','Descriptions','ContactId','sobject','validateEmail','find','length','Email','info','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','execute','contact','Contact','lead','Lead','Case','Phone','format'];(function(_0x2acadf,_0x53a147){var _0x23c31c=function(_0x6443f6){while(--_0x6443f6){_0x2acadf['push'](_0x2acadf['shift']());}};_0x23c31c(++_0x53a147);}(_0x5fa2,0x122));var _0x25fa=function(_0x3dc997,_0xccc0e9){_0x3dc997=_0x3dc997-0x0;var _0x221ade=_0x5fa2[_0x3dc997];return _0x221ade;};'use strict';var _=require(_0x25fa('0x0'));var rp=require(_0x25fa('0x1'));var moment=require(_0x25fa('0x2'));var BPromise=require(_0x25fa('0x3'));var md5=require(_0x25fa('0x4'));var jsforce=require(_0x25fa('0x5'));var util=require(_0x25fa('0x6'));var Redis=require(_0x25fa('0x7'));var intUtil=require(_0x25fa('0x8'));var config=require(_0x25fa('0x9'));var logger=require(_0x25fa('0xa'))(_0x25fa('0xb'));config[_0x25fa('0xc')]=_[_0x25fa('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x25fa('0xe'))(new Redis(config['redis']));function emit(_0x1455a4,_0x35a048,_0x29deca){io['to'](_0x1455a4)[_0x25fa('0xf')](_0x35a048,_0x29deca);}function getTicket(_0x5c5369,_0x5c0b15,_0x1f714b,_0x5f417c,_0xc0381a,_0x1edcae,_0x5ef36e,_0x42bbc0){var _0x15fb40={};if(_0x5f417c[_0x25fa('0x10')]===_0x25fa('0x11')){_0x15fb40=Object[_0x25fa('0x12')]({},{'OwnerId':_0x5c0b15['id'],'ActivityDate':moment[_0x25fa('0x13')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x5f417c[_0x25fa('0x14')],_0xc0381a,'\x20'),'Description':intUtil[_0x25fa('0x15')](_0x5f417c[_0x25fa('0x16')],_0xc0381a,'\x0a')},getCustomFields(_0x1edcae,_0xc0381a));if(_0x1f714b){_0x15fb40['WhoId']=_0x1f714b['id'];}}else if(_0x5f417c['ticketType']==='Case'){_0x15fb40=Object[_0x25fa('0x12')]({},{'OwnerId':_0x5c0b15['id'],'Subject':intUtil[_0x25fa('0x15')](_0x5f417c[_0x25fa('0x14')],_0xc0381a,'\x20'),'Description':intUtil[_0x25fa('0x15')](_0x5f417c[_0x25fa('0x16')],_0xc0381a,'\x0a')},getCustomFields(_0x1edcae,_0xc0381a));if(_0x1f714b){_0x15fb40[_0x25fa('0x17')]=_0x1f714b['id'];}}return _0x5ef36e[_0x25fa('0x18')](_0x5f417c[_0x25fa('0x10')])['create'](_0x15fb40);}function getUser(_0x124ba9,_0x378a94,_0x2e1e9b){if(!_['isNil'](_0x378a94)&&intUtil[_0x25fa('0x19')](_0x378a94)){var _0x9d4aca={'Email':_0x378a94};var _0x22c25f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2e1e9b[_0x25fa('0x18')]('User')[_0x25fa('0x1a')](_0x9d4aca,_0x22c25f)['execute']()['then'](function(_0x22187c){if(_0x22187c[_0x25fa('0x1b')]){var _0x4e970f=_[_0x25fa('0x1a')](_0x22187c,function(_0x4b4eeb){return _0x4b4eeb[_0x25fa('0x1c')]===_0x378a94;});if(_0x4e970f){logger[_0x25fa('0x1d')]('Agent\x20%s\x20found.',_0x378a94);return BPromise['resolve']({'id':_0x4e970f['Id'],'name':_0x4e970f[_0x25fa('0x1e')]});}}else{logger[_0x25fa('0x1d')](_0x25fa('0x1f'),_0x378a94);return _0x2e1e9b[_0x25fa('0x20')]()['then'](function(_0x4a9032){return BPromise[_0x25fa('0x21')]({'id':_0x4a9032[_0x25fa('0x22')],'name':_0x4a9032['display_name']});});}});}else{logger['info'](_0x25fa('0x1f'),_0x378a94);return _0x2e1e9b['identity']()[_0x25fa('0x23')](function(_0x5c178e){return BPromise[_0x25fa('0x21')]({'id':_0x5c178e[_0x25fa('0x22')],'name':_0x5c178e['display_name']});});}}function getEndUser(_0x4b9c05,_0x17b246,_0x59f0fc,_0x1ae4c8,_0x44093f){var _0x5f2fbf={'Phone':_0x1ae4c8};var _0x1ee1ed={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x25fa('0x23')](function(){if(_0x17b246['ticketType']===_0x25fa('0x11')){logger[_0x25fa('0x1d')](_0x25fa('0x24'),_0x1ae4c8,_0x17b246['moduleSearch']);switch(_0x17b246['moduleSearch']){case _0x25fa('0x25'):return _0x44093f['sobject']('Contact')[_0x25fa('0x1a')](_0x5f2fbf,_0x1ee1ed)[_0x25fa('0x26')]()[_0x25fa('0x23')](function(_0x48f80d){if(_0x48f80d&&_0x48f80d[_0x25fa('0x1b')]){return _0x48f80d;}else{return _0x44093f[_0x25fa('0x18')]('Lead')[_0x25fa('0x1a')](_0x5f2fbf,_0x1ee1ed);}});case _0x25fa('0x27'):return _0x44093f[_0x25fa('0x18')](_0x25fa('0x28'))['find'](_0x5f2fbf,_0x1ee1ed)['execute']();case _0x25fa('0x29'):return _0x44093f[_0x25fa('0x18')](_0x25fa('0x2a'))[_0x25fa('0x1a')](_0x5f2fbf,_0x1ee1ed);default:return null;}}else if(_0x17b246[_0x25fa('0x10')]===_0x25fa('0x2b')){logger[_0x25fa('0x1d')](_0x25fa('0x24'),_0x1ae4c8,_0x25fa('0x27'));return _0x44093f[_0x25fa('0x18')](_0x25fa('0x28'))['find'](_0x5f2fbf,_0x1ee1ed)[_0x25fa('0x26')]();}})[_0x25fa('0x23')](function(_0x442042){if(_0x442042&&_0x442042[_0x25fa('0x1b')]){var _0x28132a=_[_0x25fa('0x1a')](_0x442042,function(_0x411173){return _0x411173[_0x25fa('0x2c')]===_0x1ae4c8;});if(_0x28132a){return BPromise[_0x25fa('0x21')]({'id':_0x28132a['Id'],'name':_0x28132a[_0x25fa('0x1e')],'phone':_0x28132a['Phone']});}}})[_0x25fa('0x23')](function(_0x2d7d7c){if(_0x2d7d7c){logger[_0x25fa('0x1d')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x1ae4c8);return BPromise[_0x25fa('0x21')](_0x2d7d7c);}else{logger[_0x25fa('0x1d')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x1ae4c8);var _0x3361a9={'LastName':_0x59f0fc!==''?_0x59f0fc:util[_0x25fa('0x2d')](_0x25fa('0x2e'),_0x1ae4c8),'Phone':_0x1ae4c8};if(_0x17b246['moduleCreate']){if(_0x17b246[_0x25fa('0x2f')]==='contact'){logger[_0x25fa('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1ae4c8,_0x17b246[_0x25fa('0x2f')]);}else if(_0x17b246[_0x25fa('0x2f')]==='lead'&&_0x17b246['ticketType']==='Task'){logger[_0x25fa('0x1d')](_0x25fa('0x30'),_0x1ae4c8,_0x17b246[_0x25fa('0x2f')]);_0x3361a9[_0x25fa('0x31')]='No\x20Company';}else{return null;}}return _0x44093f['sobject'](_[_0x25fa('0x32')](_0x17b246[_0x25fa('0x2f')]))[_0x25fa('0x33')](_0x3361a9);}});}function getCustomFields(_0x4e7bcd,_0x18473d){var _0x1073d6={};if(_0x4e7bcd['length']>0x0){_[_0x25fa('0x34')](_0x4e7bcd,function(_0x1582e2){if(_[_0x25fa('0x35')](['string',_0x25fa('0x36')],_0x1582e2[_0x25fa('0x37')])&&_0x1582e2[_0x25fa('0x38')]){_0x1073d6[_0x1582e2[_0x25fa('0x38')]]=_0x1582e2[_0x25fa('0x39')][_0x25fa('0x3a')]();}else if(_0x1582e2[_0x25fa('0x37')]===_0x25fa('0x3b')&&_0x1582e2[_0x25fa('0x3c')]&&_0x1582e2['idField']){_0x18473d[_0x1582e2[_0x25fa('0x3c')]]&&(_0x1073d6[_0x1582e2[_0x25fa('0x38')]]=_0x18473d[_0x1582e2[_0x25fa('0x3c')]]['toString']());}else if(_0x1582e2['type']===_0x25fa('0x3d')&&_0x1582e2[_0x25fa('0x3e')]&&_0x1582e2[_0x25fa('0x3e')][_0x25fa('0x3f')]&&_0x1582e2[_0x25fa('0x38')]){_0x18473d[_0x1582e2[_0x25fa('0x3e')][_0x25fa('0x3f')]['toLowerCase']()]&&(_0x1073d6[_0x1582e2[_0x25fa('0x38')]]=_0x18473d[_0x1582e2[_0x25fa('0x3e')]['name']['toLowerCase']()]['toString']());}});}return _0x1073d6;}function getConnection(_0x5b7476){var _0x27484e=_0x5b7476['password'][_0x25fa('0x40')](_0x5b7476[_0x25fa('0x41')]);var _0x4baf7b=new jsforce[(_0x25fa('0x42'))]({'oauth2':{'loginUrl':_0x5b7476[_0x25fa('0x43')]||_0x25fa('0x44'),'clientId':_0x5b7476[_0x25fa('0x45')],'clientSecret':_0x5b7476[_0x25fa('0x46')]}});return _0x4baf7b[_0x25fa('0x47')](_0x5b7476[_0x25fa('0x48')],_0x27484e)[_0x25fa('0x23')](function(){logger[_0x25fa('0x1d')](_0x25fa('0x49'));return _0x4baf7b;});}exports[_0x25fa('0x4a')]=function(_0x55ccd9,_0x4646dc,_0x28fcd6,_0xe34471,_0x43ecd6,_0x5a73c9){var _0x767f76,_0x368bd1,_0x12ac05,_0x282d03;_0x5a73c9['serverUrl']=intUtil['stripTrailingSlash'](_0x5a73c9[_0x25fa('0x4b')]);_0x5a73c9[_0x25fa('0x43')]=intUtil[_0x25fa('0x4c')](_0x5a73c9[_0x25fa('0x43')]);if(_0x43ecd6&&_0x43ecd6[_0x25fa('0x4d')]){logger[_0x25fa('0x1d')]('[QUEUE]',_0x25fa('0x4e'));_0x4646dc[_0x25fa('0x4f')]=util['format'](_0x25fa('0x50'),_0x5a73c9[_0x25fa('0x4b')],_0x4646dc['uniqueid'],md5(_0x4646dc[_0x25fa('0x51')]));}else{_0x4646dc[_0x25fa('0x4f')]='';}return getConnection(_0x5a73c9)[_0x25fa('0x23')](function(_0x39031d){_0x282d03=_0x39031d;return getUser(_0x5a73c9,_0xe34471['email'],_0x282d03);})[_0x25fa('0x23')](function(_0x469f58){_0x767f76=_0x469f58;return getEndUser(_0x5a73c9,_0x28fcd6,_0x4646dc[_0x25fa('0x52')],_0x4646dc[_0x25fa('0x53')],_0x282d03);})[_0x25fa('0x23')](function(_0x5858d4){_0x368bd1=_0x5858d4;return getTicket(_0x5a73c9,_0x767f76,_0x368bd1,_0x28fcd6,_0x4646dc,_0x28fcd6[_0x25fa('0x54')],_0x282d03,'queue');})[_0x25fa('0x23')](function(_0x39b4f2){_0x12ac05=_0x39b4f2;logger['info'](_0x25fa('0x55'),_0x12ac05['id']);logger[_0x25fa('0x1d')](_0x25fa('0x56'),_0x12ac05['id'],_0xe34471['name'],_0x5a73c9[_0x25fa('0x37')]);switch(_0x5a73c9[_0x25fa('0x37')]){case _0x25fa('0x57'):emit(util['format'](_0x25fa('0x58'),_0xe34471[_0x25fa('0x3f')]),_0x25fa('0x59'),{'recordId':_0x12ac05['id']});break;case _0x25fa('0x5a'):emit(util[_0x25fa('0x2d')](_0x25fa('0x58'),_0xe34471[_0x25fa('0x3f')]),_0x25fa('0x5b'),{'uri':util[_0x25fa('0x2d')](_0x25fa('0x5c'),_0x282d03[_0x25fa('0x5d')],_0x12ac05['id'])});break;default:logger[_0x25fa('0x5e')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x25fa('0x5f')](function(_0x262eef){logger[_0x25fa('0x5e')](_0x25fa('0x60'),JSON[_0x25fa('0x61')](_0x262eef));});};exports[_0x25fa('0x62')]=function(_0x20d823,_0x3fbbf3,_0x16f670,_0x2a82ac,_0x49e4e8,_0x569012,_0x4c8c76){var _0x92761a,_0x230153,_0x3186d2,_0x2e12e7;_0x569012['serverUrl']=intUtil[_0x25fa('0x4c')](_0x569012['serverUrl']);_0x569012[_0x25fa('0x43')]=intUtil[_0x25fa('0x4c')](_0x569012[_0x25fa('0x43')]);if(_0x4c8c76&&_0x4c8c76[_0x25fa('0x63')]&&_0x4c8c76[_0x25fa('0x63')]!==_0x25fa('0x64')){logger[_0x25fa('0x1d')](_0x25fa('0x65'),_0x25fa('0x4e'));_0x3fbbf3['recordingURL']=util[_0x25fa('0x2d')](_0x25fa('0x50'),_0x569012[_0x25fa('0x4b')],_0x3fbbf3[_0x25fa('0x51')],md5(_0x3fbbf3[_0x25fa('0x51')]));}return getConnection(_0x569012)[_0x25fa('0x23')](function(_0x372f14){_0x2e12e7=_0x372f14;return getUser(_0x569012,_0x2a82ac[_0x25fa('0x66')],_0x2e12e7);})['then'](function(_0x6fc964){_0x92761a=_0x6fc964;return getEndUser(_0x569012,_0x16f670,_0x3fbbf3[_0x25fa('0x67')],_0x3fbbf3[_0x25fa('0x68')],_0x2e12e7);})[_0x25fa('0x23')](function(_0x3e073f){_0x230153=_0x3e073f;return getTicket(_0x569012,_0x92761a,_0x230153,_0x16f670,_0x3fbbf3,_0x16f670['Fields'],_0x2e12e7,'outbound');})['then'](function(_0x21cb65){_0x3186d2=_0x21cb65;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x3186d2['id']);logger[_0x25fa('0x1d')](_0x25fa('0x69'),_0x3186d2['id'],_0x2a82ac[_0x25fa('0x3f')],_0x569012[_0x25fa('0x37')]);switch(_0x569012[_0x25fa('0x37')]){case _0x25fa('0x57'):emit(util[_0x25fa('0x2d')](_0x25fa('0x58'),_0x2a82ac[_0x25fa('0x3f')]),_0x25fa('0x59'),{'recordId':_0x3186d2['id']});break;case _0x25fa('0x5a'):emit(util[_0x25fa('0x2d')]('user:%s',_0x2a82ac[_0x25fa('0x3f')]),_0x25fa('0x5b'),{'uri':util[_0x25fa('0x2d')](_0x25fa('0x5c'),_0x2e12e7[_0x25fa('0x5d')],_0x3186d2['id'])});break;default:logger[_0x25fa('0x5e')](_0x25fa('0x65'),_0x25fa('0x6a'));}})[_0x25fa('0x5f')](function(_0x149aa8){logger[_0x25fa('0x5e')]('[OUTBOUND]',JSON[_0x25fa('0x61')](_0x149aa8));});};exports[_0x25fa('0x6b')]=function(_0x4b5557,_0x1e262c,_0x3e1bce,_0x17fd15,_0xdddeb5,_0x46a0b1){var _0x57e223,_0x589eb9,_0x2316b0,_0x5cca8c;_0x46a0b1['serverUrl']=intUtil['stripTrailingSlash'](_0x46a0b1[_0x25fa('0x4b')]);_0x46a0b1['remoteUri']=intUtil[_0x25fa('0x4c')](_0x46a0b1['remoteUri']);if(_0xdddeb5&&_0xdddeb5[_0x25fa('0x4d')]){logger[_0x25fa('0x1d')]('['+_0x1e262c['lastevent']['toUpperCase']()+']',_0x25fa('0x4e'));_0x1e262c['recordingURL']=util[_0x25fa('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x46a0b1['serverUrl'],_0x1e262c[_0x25fa('0x51')],md5(_0x1e262c[_0x25fa('0x51')]));}else{_0x1e262c['recordingURL']='';}return getConnection(_0x46a0b1)['then'](function(_0x3f63e9){_0x5cca8c=_0x3f63e9;if(!_[_0x25fa('0x6c')](_0x17fd15)){return getUser(_0x46a0b1,_0x17fd15[_0x25fa('0x3f')],_0x5cca8c);}else{return getUser(_0x46a0b1,null,_0x5cca8c);}})[_0x25fa('0x23')](function(_0x32c40a){_0x57e223=_0x32c40a;return getEndUser(_0x46a0b1,_0x3e1bce,_0x1e262c[_0x25fa('0x52')],_0x1e262c[_0x25fa('0x53')],_0x5cca8c);})['then'](function(_0x33f975){_0x589eb9=_0x33f975;return getTicket(_0x46a0b1,_0x57e223,_0x589eb9,_0x3e1bce,_0x1e262c,_0x3e1bce[_0x25fa('0x54')],_0x5cca8c);})['then'](function(_0x4d008d){_0x2316b0=_0x4d008d;logger['info']('['+_0x1e262c[_0x25fa('0x6d')][_0x25fa('0x6e')]()+']\x20Ticket\x20%s\x20created.',_0x2316b0['id']);logger['info']('['+_0x1e262c[_0x25fa('0x6d')][_0x25fa('0x6e')]()+_0x25fa('0x6f'),_0x46a0b1['type']);})[_0x25fa('0x5f')](function(_0x4d27a9){logger[_0x25fa('0x5e')]('['+_0x1e262c[_0x25fa('0x6d')][_0x25fa('0x6e')]()+']',JSON[_0x25fa('0x61')](_0x4d27a9));});}; \ No newline at end of file +var _0xe542=['Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','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','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','lead','Company','No\x20Company','upperFirst','includes','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','error','stringify','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','[OUTBOUND]','unmanaged','lastevent','isNil','Fields',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','catch','request-promise','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','assign','getString','Subjects','Descriptions','WhoId','Case','sobject','create','validateEmail','User','execute','length','find','Email','info','Agent\x20%s\x20found.','resolve'];(function(_0x2dc880,_0x213c94){var _0x2bb284=function(_0x4f59a2){while(--_0x4f59a2){_0x2dc880['push'](_0x2dc880['shift']());}};_0x2bb284(++_0x213c94);}(_0xe542,0x131));var _0x2e54=function(_0x2d51cc,_0x2ca3e2){_0x2d51cc=_0x2d51cc-0x0;var _0x3dc46b=_0xe542[_0x2d51cc];return _0x3dc46b;};'use strict';var _=require('lodash');var rp=require(_0x2e54('0x0'));var moment=require(_0x2e54('0x1'));var BPromise=require(_0x2e54('0x2'));var md5=require(_0x2e54('0x3'));var jsforce=require('jsforce');var util=require(_0x2e54('0x4'));var Redis=require(_0x2e54('0x5'));var intUtil=require(_0x2e54('0x6'));var config=require(_0x2e54('0x7'));var logger=require(_0x2e54('0x8'))(_0x2e54('0x9'));config[_0x2e54('0xa')]=_[_0x2e54('0xb')](config[_0x2e54('0xa')],{'host':_0x2e54('0xc'),'port':0x18eb});var io=require(_0x2e54('0xd'))(new Redis(config['redis']));function emit(_0x3c8219,_0x49391d,_0xb6998f){io['to'](_0x3c8219)[_0x2e54('0xe')](_0x49391d,_0xb6998f);}function getTicket(_0x26b137,_0x4af3d7,_0x41c8f1,_0x2780bf,_0x49acc4,_0x2938f1,_0x50a05c,_0x53c0ff){var _0x1bff02={};if(_0x2780bf[_0x2e54('0xf')]===_0x2e54('0x10')){_0x1bff02=Object[_0x2e54('0x11')]({},{'OwnerId':_0x4af3d7['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x2e54('0x12')](_0x2780bf[_0x2e54('0x13')],_0x49acc4,'\x20'),'Description':intUtil['getString'](_0x2780bf[_0x2e54('0x14')],_0x49acc4,'\x0a')},getCustomFields(_0x2938f1,_0x49acc4));if(_0x41c8f1){_0x1bff02[_0x2e54('0x15')]=_0x41c8f1['id'];}}else if(_0x2780bf[_0x2e54('0xf')]===_0x2e54('0x16')){_0x1bff02=Object[_0x2e54('0x11')]({},{'OwnerId':_0x4af3d7['id'],'Subject':intUtil[_0x2e54('0x12')](_0x2780bf[_0x2e54('0x13')],_0x49acc4,'\x20'),'Description':intUtil[_0x2e54('0x12')](_0x2780bf[_0x2e54('0x14')],_0x49acc4,'\x0a')},getCustomFields(_0x2938f1,_0x49acc4));if(_0x41c8f1){_0x1bff02['ContactId']=_0x41c8f1['id'];}}return _0x50a05c[_0x2e54('0x17')](_0x2780bf['ticketType'])[_0x2e54('0x18')](_0x1bff02);}function getUser(_0x722e9e,_0x25bc4f,_0x418260){if(!_['isNil'](_0x25bc4f)&&intUtil[_0x2e54('0x19')](_0x25bc4f)){var _0xe76170={'Email':_0x25bc4f};var _0x19d88b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x418260[_0x2e54('0x17')](_0x2e54('0x1a'))['find'](_0xe76170,_0x19d88b)[_0x2e54('0x1b')]()['then'](function(_0x47fd69){if(_0x47fd69[_0x2e54('0x1c')]){var _0x1843c0=_[_0x2e54('0x1d')](_0x47fd69,function(_0x40e48b){return _0x40e48b[_0x2e54('0x1e')]===_0x25bc4f;});if(_0x1843c0){logger[_0x2e54('0x1f')](_0x2e54('0x20'),_0x25bc4f);return BPromise[_0x2e54('0x21')]({'id':_0x1843c0['Id'],'name':_0x1843c0[_0x2e54('0x22')]});}}else{logger[_0x2e54('0x1f')](_0x2e54('0x23'),_0x25bc4f);return _0x418260[_0x2e54('0x24')]()[_0x2e54('0x25')](function(_0xa7a1c){return BPromise[_0x2e54('0x21')]({'id':_0xa7a1c['user_id'],'name':_0xa7a1c[_0x2e54('0x26')]});});}});}else{logger[_0x2e54('0x1f')](_0x2e54('0x23'),_0x25bc4f);return _0x418260[_0x2e54('0x24')]()[_0x2e54('0x25')](function(_0x289ab3){return BPromise[_0x2e54('0x21')]({'id':_0x289ab3['user_id'],'name':_0x289ab3[_0x2e54('0x26')]});});}}function getEndUser(_0x432c6e,_0x5e63ef,_0x51d94a,_0x36ff37,_0x53d858){var _0x30e685={'Phone':_0x36ff37};var _0x75e884={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2e54('0x21')]()[_0x2e54('0x25')](function(){if(_0x5e63ef[_0x2e54('0xf')]===_0x2e54('0x10')){logger['info'](_0x2e54('0x27'),_0x36ff37,_0x5e63ef[_0x2e54('0x28')]);switch(_0x5e63ef[_0x2e54('0x28')]){case _0x2e54('0x29'):return _0x53d858[_0x2e54('0x17')](_0x2e54('0x2a'))[_0x2e54('0x1d')](_0x30e685,_0x75e884)['execute']()['then'](function(_0x3911f8){if(_0x3911f8&&_0x3911f8[_0x2e54('0x1c')]){return _0x3911f8;}else{return _0x53d858['sobject'](_0x2e54('0x2b'))[_0x2e54('0x1d')](_0x30e685,_0x75e884);}});case _0x2e54('0x2c'):return _0x53d858[_0x2e54('0x17')](_0x2e54('0x2a'))[_0x2e54('0x1d')](_0x30e685,_0x75e884)['execute']();case'lead':return _0x53d858['sobject'](_0x2e54('0x2b'))[_0x2e54('0x1d')](_0x30e685,_0x75e884);default:return null;}}else if(_0x5e63ef[_0x2e54('0xf')]===_0x2e54('0x16')){logger[_0x2e54('0x1f')](_0x2e54('0x27'),_0x36ff37,_0x2e54('0x2c'));return _0x53d858['sobject'](_0x2e54('0x2a'))[_0x2e54('0x1d')](_0x30e685,_0x75e884)['execute']();}})['then'](function(_0x22fa9b){if(_0x22fa9b&&_0x22fa9b[_0x2e54('0x1c')]){var _0x53ee23=_[_0x2e54('0x1d')](_0x22fa9b,function(_0x14a429){return _0x14a429['Phone']===_0x36ff37;});if(_0x53ee23){return BPromise['resolve']({'id':_0x53ee23['Id'],'name':_0x53ee23[_0x2e54('0x22')],'phone':_0x53ee23[_0x2e54('0x2d')]});}}})[_0x2e54('0x25')](function(_0x5d45e6){if(_0x5d45e6){logger[_0x2e54('0x1f')](_0x2e54('0x2e'),_0x36ff37);return BPromise[_0x2e54('0x21')](_0x5d45e6);}else{logger[_0x2e54('0x1f')](_0x2e54('0x2f'),_0x36ff37);var _0x4b686a={'LastName':_0x51d94a!==''?_0x51d94a:util[_0x2e54('0x30')](_0x2e54('0x31'),_0x36ff37),'Phone':_0x36ff37};if(_0x5e63ef['moduleCreate']){if(_0x5e63ef['moduleCreate']===_0x2e54('0x2c')){logger[_0x2e54('0x1f')](_0x2e54('0x32'),_0x36ff37,_0x5e63ef['moduleCreate']);}else if(_0x5e63ef[_0x2e54('0x33')]===_0x2e54('0x34')&&_0x5e63ef[_0x2e54('0xf')]===_0x2e54('0x10')){logger[_0x2e54('0x1f')](_0x2e54('0x32'),_0x36ff37,_0x5e63ef[_0x2e54('0x33')]);_0x4b686a[_0x2e54('0x35')]=_0x2e54('0x36');}else{return null;}}return _0x53d858[_0x2e54('0x17')](_[_0x2e54('0x37')](_0x5e63ef[_0x2e54('0x33')]))[_0x2e54('0x18')](_0x4b686a);}});}function getCustomFields(_0x2dc8e8,_0x616499){var _0x3b16f2={};if(_0x2dc8e8[_0x2e54('0x1c')]>0x0){_['forEach'](_0x2dc8e8,function(_0x4ce88f){if(_[_0x2e54('0x38')](['string',_0x2e54('0x39')],_0x4ce88f['type'])&&_0x4ce88f[_0x2e54('0x3a')]){_0x3b16f2[_0x4ce88f[_0x2e54('0x3a')]]=_0x4ce88f[_0x2e54('0x3b')]['toString']();}else if(_0x4ce88f[_0x2e54('0x3c')]===_0x2e54('0x3d')&&_0x4ce88f['variableName']&&_0x4ce88f['idField']){_0x616499[_0x4ce88f[_0x2e54('0x3e')]]&&(_0x3b16f2[_0x4ce88f['idField']]=_0x616499[_0x4ce88f[_0x2e54('0x3e')]][_0x2e54('0x3f')]());}else if(_0x4ce88f[_0x2e54('0x3c')]===_0x2e54('0x40')&&_0x4ce88f['Variable']&&_0x4ce88f[_0x2e54('0x41')][_0x2e54('0x42')]&&_0x4ce88f[_0x2e54('0x3a')]){_0x616499[_0x4ce88f['Variable'][_0x2e54('0x42')][_0x2e54('0x43')]()]&&(_0x3b16f2[_0x4ce88f[_0x2e54('0x3a')]]=_0x616499[_0x4ce88f[_0x2e54('0x41')]['name']['toLowerCase']()][_0x2e54('0x3f')]());}});}return _0x3b16f2;}function getConnection(_0xf5a2ba){var _0x395c67=_0xf5a2ba[_0x2e54('0x44')][_0x2e54('0x45')](_0xf5a2ba['securityToken']);var _0x11be13=new jsforce[(_0x2e54('0x46'))]({'oauth2':{'loginUrl':_0xf5a2ba[_0x2e54('0x47')]||_0x2e54('0x48'),'clientId':_0xf5a2ba['clientId'],'clientSecret':_0xf5a2ba[_0x2e54('0x49')]}});return _0x11be13[_0x2e54('0x4a')](_0xf5a2ba[_0x2e54('0x4b')],_0x395c67)['then'](function(){logger['info'](_0x2e54('0x4c'));return _0x11be13;});}exports[_0x2e54('0x4d')]=function(_0xbbdf6,_0xa6535e,_0x1996bc,_0x20e092,_0x2b5a9d,_0x48eabe){var _0x21e2d2,_0x4eaf40,_0x537bf1,_0x5b8ce4;_0x48eabe['serverUrl']=intUtil[_0x2e54('0x4e')](_0x48eabe[_0x2e54('0x4f')]);_0x48eabe[_0x2e54('0x47')]=intUtil[_0x2e54('0x4e')](_0x48eabe[_0x2e54('0x47')]);if(_0x2b5a9d&&_0x2b5a9d[_0x2e54('0x50')]){logger[_0x2e54('0x1f')](_0x2e54('0x51'),_0x2e54('0x52'));_0xa6535e[_0x2e54('0x53')]=util[_0x2e54('0x30')](_0x2e54('0x54'),_0x48eabe[_0x2e54('0x4f')],_0xa6535e[_0x2e54('0x55')],md5(_0xa6535e[_0x2e54('0x55')]));}else{_0xa6535e['recordingURL']='';}return getConnection(_0x48eabe)['then'](function(_0x3c1f06){_0x5b8ce4=_0x3c1f06;return getUser(_0x48eabe,_0x20e092[_0x2e54('0x56')],_0x5b8ce4);})[_0x2e54('0x25')](function(_0x4bba65){_0x21e2d2=_0x4bba65;return getEndUser(_0x48eabe,_0x1996bc,_0xa6535e[_0x2e54('0x57')],_0xa6535e[_0x2e54('0x58')],_0x5b8ce4);})[_0x2e54('0x25')](function(_0xabaa69){_0x4eaf40=_0xabaa69;return getTicket(_0x48eabe,_0x21e2d2,_0x4eaf40,_0x1996bc,_0xa6535e,_0x1996bc['Fields'],_0x5b8ce4,_0x2e54('0x4d'));})[_0x2e54('0x25')](function(_0xf82753){_0x537bf1=_0xf82753;logger['info'](_0x2e54('0x59'),_0x537bf1['id']);logger[_0x2e54('0x1f')](_0x2e54('0x5a'),_0x537bf1['id'],_0x20e092[_0x2e54('0x42')],_0x48eabe[_0x2e54('0x3c')]);switch(_0x48eabe[_0x2e54('0x3c')]){case'integrationTab':emit(util[_0x2e54('0x30')]('user:%s',_0x20e092[_0x2e54('0x42')]),_0x2e54('0x5b'),{'recordId':_0x537bf1['id']});break;case'newTab':emit(util[_0x2e54('0x30')](_0x2e54('0x5c'),_0x20e092['name']),_0x2e54('0x5d'),{'uri':util[_0x2e54('0x30')](_0x2e54('0x5e'),_0x5b8ce4['instanceUrl'],_0x537bf1['id'])});break;default:logger[_0x2e54('0x5f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x5ce74e){logger[_0x2e54('0x5f')](_0x2e54('0x51'),JSON[_0x2e54('0x60')](_0x5ce74e));});};exports[_0x2e54('0x61')]=function(_0x3e31cc,_0xb1be16,_0xef587b,_0x2d76c0,_0xc902c,_0x5dd1da,_0x4cc4a7){var _0x37aa3a,_0x2a96d8,_0x4bd924,_0x583360;_0x5dd1da['serverUrl']=intUtil[_0x2e54('0x4e')](_0x5dd1da[_0x2e54('0x4f')]);_0x5dd1da['remoteUri']=intUtil['stripTrailingSlash'](_0x5dd1da[_0x2e54('0x47')]);if(_0x4cc4a7&&_0x4cc4a7[_0x2e54('0x62')]&&_0x4cc4a7[_0x2e54('0x62')]!==_0x2e54('0x63')){logger[_0x2e54('0x1f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xb1be16[_0x2e54('0x53')]=util['format'](_0x2e54('0x54'),_0x5dd1da['serverUrl'],_0xb1be16[_0x2e54('0x55')],md5(_0xb1be16[_0x2e54('0x55')]));}return getConnection(_0x5dd1da)[_0x2e54('0x25')](function(_0x501515){_0x583360=_0x501515;return getUser(_0x5dd1da,_0x2d76c0['email'],_0x583360);})[_0x2e54('0x25')](function(_0x1d1bd0){_0x37aa3a=_0x1d1bd0;return getEndUser(_0x5dd1da,_0xef587b,_0xb1be16[_0x2e54('0x64')],_0xb1be16[_0x2e54('0x65')],_0x583360);})[_0x2e54('0x25')](function(_0xfa99d9){_0x2a96d8=_0xfa99d9;return getTicket(_0x5dd1da,_0x37aa3a,_0x2a96d8,_0xef587b,_0xb1be16,_0xef587b['Fields'],_0x583360,_0x2e54('0x61'));})['then'](function(_0x2ffd1d){_0x4bd924=_0x2ffd1d;logger[_0x2e54('0x1f')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x4bd924['id']);logger[_0x2e54('0x1f')](_0x2e54('0x66'),_0x4bd924['id'],_0x2d76c0[_0x2e54('0x42')],_0x5dd1da['type']);switch(_0x5dd1da['type']){case'integrationTab':emit(util[_0x2e54('0x30')](_0x2e54('0x5c'),_0x2d76c0[_0x2e54('0x42')]),_0x2e54('0x5b'),{'recordId':_0x4bd924['id']});break;case _0x2e54('0x67'):emit(util['format'](_0x2e54('0x5c'),_0x2d76c0[_0x2e54('0x42')]),_0x2e54('0x5d'),{'uri':util[_0x2e54('0x30')](_0x2e54('0x5e'),_0x583360['instanceUrl'],_0x4bd924['id'])});break;default:logger[_0x2e54('0x5f')](_0x2e54('0x68'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x2a2e51){logger[_0x2e54('0x5f')]('[OUTBOUND]',JSON[_0x2e54('0x60')](_0x2a2e51));});};exports[_0x2e54('0x69')]=function(_0x1788d3,_0x39fa20,_0x57ad0f,_0x1126ef,_0x43f6fe,_0x3c44b6){var _0x4793b8,_0x4c9ad9,_0x58e44f,_0x32de8a;_0x3c44b6[_0x2e54('0x4f')]=intUtil[_0x2e54('0x4e')](_0x3c44b6[_0x2e54('0x4f')]);_0x3c44b6[_0x2e54('0x47')]=intUtil[_0x2e54('0x4e')](_0x3c44b6[_0x2e54('0x47')]);if(_0x43f6fe&&_0x43f6fe[_0x2e54('0x50')]){logger[_0x2e54('0x1f')]('['+_0x39fa20[_0x2e54('0x6a')]['toUpperCase']()+']',_0x2e54('0x52'));_0x39fa20[_0x2e54('0x53')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c44b6[_0x2e54('0x4f')],_0x39fa20[_0x2e54('0x55')],md5(_0x39fa20[_0x2e54('0x55')]));}else{_0x39fa20[_0x2e54('0x53')]='';}return getConnection(_0x3c44b6)['then'](function(_0x1ed586){_0x32de8a=_0x1ed586;if(!_[_0x2e54('0x6b')](_0x1126ef)){return getUser(_0x3c44b6,_0x1126ef[_0x2e54('0x42')],_0x32de8a);}else{return getUser(_0x3c44b6,null,_0x32de8a);}})[_0x2e54('0x25')](function(_0x56e19e){_0x4793b8=_0x56e19e;return getEndUser(_0x3c44b6,_0x57ad0f,_0x39fa20[_0x2e54('0x57')],_0x39fa20[_0x2e54('0x58')],_0x32de8a);})[_0x2e54('0x25')](function(_0x18e541){_0x4c9ad9=_0x18e541;return getTicket(_0x3c44b6,_0x4793b8,_0x4c9ad9,_0x57ad0f,_0x39fa20,_0x57ad0f[_0x2e54('0x6c')],_0x32de8a);})['then'](function(_0x24d6e9){_0x58e44f=_0x24d6e9;logger[_0x2e54('0x1f')]('['+_0x39fa20[_0x2e54('0x6a')]['toUpperCase']()+_0x2e54('0x6d'),_0x58e44f['id']);logger[_0x2e54('0x1f')]('['+_0x39fa20[_0x2e54('0x6a')][_0x2e54('0x6e')]()+_0x2e54('0x6f'),_0x3c44b6[_0x2e54('0x3c')]);})[_0x2e54('0x70')](function(_0xe78992){logger['error']('['+_0x39fa20[_0x2e54('0x6a')][_0x2e54('0x6e')]()+']',JSON['stringify'](_0xe78992));});}; \ 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 2c0b6ab..a847be7 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 _0xd943=['label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','user:%s','emit','trigger:browser:url','username','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','picklist','type','nameField','customField','toLowerCase','content','string','idField','toString','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','true','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd943,0x15d));var _0x3d94=function(_0x5b1698,_0x60c31b){_0x5b1698=_0x5b1698-0x0;var _0x4e5a69=_0xd943[_0x5b1698];return _0x4e5a69;};'use strict';var _=require(_0x3d94('0x0'));var Promise=require(_0x3d94('0x1'));var rp=require(_0x3d94('0x2'));var util=require(_0x3d94('0x3'));var md5=require('md5');var Redis=require(_0x3d94('0x4'));var intUtil=require(_0x3d94('0x5'));var config=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));config['redis']=_['defaults'](config[_0x3d94('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x20f4d1,_0x35d36a,_0x5244c3,_0x512766,_0x3984a3,_0x27e381){return new Promise(function(_0x1cc58c,_0x5908a7){var _0x182066={'method':'GET','uri':_0x512766+_0x3d94('0xa')+'&'+_0x3984a3+'&'+_0x27e381,'auth':_0x35d36a,'json':!![]};return rp(_0x182066)[_0x3d94('0xb')](function(_0x5f5041){if(_0x5f5041[_0x3d94('0xc')][_0x3d94('0xd')]>0x0){_0x5244c3[_0x3d94('0xe')]=_0x5f5041[_0x3d94('0xc')][0x0][_0x3d94('0xf')];}logger['info']('['+[_0x20f4d1[_0x3d94('0x10')]()]+_0x3d94('0x11'),_0x5244c3);_0x1cc58c(_0x5244c3);})[_0x3d94('0x12')](function(_0x4c167c){logger[_0x3d94('0x13')]('['+[_0x20f4d1[_0x3d94('0x10')]()]+']',_0x4c167c[_0x3d94('0x14')]);_0x5908a7(_0x4c167c['message']);});});}function getUser(_0x14ea5f,_0x340818,_0x292419,_0x34098e,_0xaf939a){return function(_0xd8efaa){logger[_0x3d94('0x15')]('['+[_0x14ea5f[_0x3d94('0x10')]()]+'],\x20getUser\x20input\x20crm',_0xd8efaa);return new Promise(function(_0x22676a,_0x1a9315){if(intUtil[_0x3d94('0x16')](_0xd8efaa[_0x3d94('0x17')])){var _0x4afc92={'method':_0x3d94('0x18'),'uri':_0x292419+_0x3d94('0x19')+_0xd8efaa['userEmail']+'&'+_0x34098e+'&'+_0xaf939a,'auth':_0x340818,'json':!![]};logger[_0x3d94('0x15')]('['+[_0x14ea5f['toUpperCase']()]+_0x3d94('0x1a'),_0x4afc92);return rp(_0x4afc92)[_0x3d94('0xb')](function(_0x16a6d0){logger[_0x3d94('0x15')]('['+[_0x14ea5f[_0x3d94('0x10')]()]+'],\x20getUser\x20entity',_0x16a6d0);if(_0x16a6d0['result'][_0x3d94('0xd')]>0x0&&String(_0x16a6d0[_0x3d94('0xc')][0x0][_0x3d94('0x1b')])==='true'){_0xd8efaa[_0x3d94('0x1c')]=_0x16a6d0[_0x3d94('0xc')][0x0][_0x3d94('0xf')];}else{_0xd8efaa[_0x3d94('0x1c')]=_0xd8efaa[_0x3d94('0xe')];_0xd8efaa[_0x3d94('0x17')]=_0xd8efaa[_0x3d94('0x1d')];}logger[_0x3d94('0x15')]('['+[_0x14ea5f[_0x3d94('0x10')]()]+_0x3d94('0x1e'),_0xd8efaa);_0x22676a(_0xd8efaa);})[_0x3d94('0x12')](function(_0x192839){logger[_0x3d94('0x13')]('['+[_0x14ea5f[_0x3d94('0x10')]()]+']',_0x192839[_0x3d94('0x14')]);_0x1a9315(_0x192839['message']);});}else{logger[_0x3d94('0x15')]('['+[_0x14ea5f['toUpperCase']()]+_0x3d94('0x1f'));_0xd8efaa[_0x3d94('0x1c')]=_0xd8efaa[_0x3d94('0xe')];_0xd8efaa[_0x3d94('0x17')]=_0xd8efaa[_0x3d94('0x1d')];_0x22676a(_0xd8efaa);}});};}function createEndUser(_0x82b568,_0x401857,_0x47d6ab,_0x584c4a,_0x362642){logger['info']('['+[_0x82b568['toUpperCase']()]+_0x3d94('0x20'),_0x47d6ab);return new Promise(function(_0x58c0d0,_0x19bfd4){var _0xef9644={'method':_0x3d94('0x21'),'uri':_0x584c4a+'sys_user?'+_0x362642,'body':{'user_name':_0x47d6ab[_0x3d94('0x22')],'roles':'user','first_name':_0x47d6ab[_0x3d94('0x22')],'active':'true','date_format':_0x3d94('0x23'),'phone':_0x47d6ab[_0x3d94('0x22')]},'auth':_0x401857,'json':!![]};return rp(_0xef9644)[_0x3d94('0xb')](function(_0x246f88){logger['info']('['+[_0x82b568[_0x3d94('0x10')]()]+'],\x20EndUser\x20schema',_0x246f88[_0x3d94('0xc')]);_0x47d6ab[_0x3d94('0x24')]=_0x246f88['result']['sys_id'];_0x58c0d0(_0x47d6ab);})[_0x3d94('0x12')](function(_0x280c73){logger[_0x3d94('0x13')]('['+[_0x82b568['toUpperCase']()]+']',_0x280c73[_0x3d94('0x14')]);_0x19bfd4(_0x280c73[_0x3d94('0x14')]);});});}function getEndUser(_0x5426bd,_0x242500,_0x23f3fe,_0x35947b,_0xbda334){return function(_0x782c1){logger['info']('['+[_0x5426bd[_0x3d94('0x10')]()]+_0x3d94('0x25'),_0x782c1);return new Promise(function(_0x41579e,_0x52bdb9){var _0xb493f1={'method':_0x3d94('0x18'),'uri':_0x23f3fe+'sys_user?sysparm_query=phone%3D'+_0x782c1['endUserNumber']+'&'+_0x35947b+'&'+_0xbda334,'auth':_0x242500,'json':!![]};return rp(_0xb493f1)[_0x3d94('0xb')](function(_0x3e4d64){if(_0x3e4d64[_0x3d94('0xc')][_0x3d94('0xd')]>0x0){_0x782c1[_0x3d94('0x24')]=_0x3e4d64[_0x3d94('0xc')][0x0][_0x3d94('0xf')];logger[_0x3d94('0x15')]('['+[_0x5426bd[_0x3d94('0x10')]()]+_0x3d94('0x26'),_0x782c1);_0x41579e(_0x782c1);}else{return createEndUser(_0x5426bd,_0x242500,_0x782c1,_0x23f3fe,_0x35947b)['then'](function(_0x6b2b1f){logger[_0x3d94('0x15')]('['+[_0x5426bd[_0x3d94('0x10')]()]+_0x3d94('0x27'),_0x6b2b1f);_0x41579e(_0x6b2b1f);});}})['catch'](function(_0xcf7a73){logger[_0x3d94('0x13')]('['+[_0x5426bd[_0x3d94('0x10')]()]+']',_0xcf7a73[_0x3d94('0x14')]);_0x52bdb9(_0xcf7a73[_0x3d94('0x14')]);});});};}function getCustomFields(_0x4b5a1a,_0x217e5e){var _0x462ab6={};if(_0x4b5a1a[_0x3d94('0xd')]>0x0){_['forEach'](_0x4b5a1a,function(_0x4eee4d){if(_['includes'](['string',_0x3d94('0x28')],_0x4eee4d[_0x3d94('0x29')])&&_0x4eee4d[_0x3d94('0x2a')]&&!_0x4eee4d[_0x3d94('0x2b')]){_0x462ab6[_0x4eee4d[_0x3d94('0x2a')][_0x3d94('0x2c')]()]=_0x4eee4d[_0x3d94('0x2d')]['toString']();}else if(_['includes']([_0x3d94('0x2e'),_0x3d94('0x28')],_0x4eee4d['type'])&&_0x4eee4d[_0x3d94('0x2f')]&&_0x4eee4d['customField']){_0x462ab6[_0x4eee4d[_0x3d94('0x2f')][_0x3d94('0x2c')]()]=_0x4eee4d[_0x3d94('0x2d')][_0x3d94('0x30')]();}else if(_0x4eee4d[_0x3d94('0x29')]==='variable'&&_0x4eee4d[_0x3d94('0x31')]&&_0x4eee4d[_0x3d94('0x2f')]&&_0x4eee4d[_0x3d94('0x2b')]){_0x462ab6[_0x4eee4d['idField'][_0x3d94('0x2c')]()]=_0x217e5e[_0x4eee4d['variableName']]['toString']();}else if(_0x4eee4d[_0x3d94('0x29')]===_0x3d94('0x32')&&_0x4eee4d[_0x3d94('0x33')]&&_0x4eee4d[_0x3d94('0x33')]['name']&&_0x4eee4d[_0x3d94('0x2f')]&&_0x4eee4d['customField']){_0x462ab6[_0x4eee4d[_0x3d94('0x2f')][_0x3d94('0x2c')]()]=_0x217e5e[_0x4eee4d[_0x3d94('0x33')][_0x3d94('0x34')][_0x3d94('0x2c')]()][_0x3d94('0x30')]();}});}return _0x462ab6;}function getTicket(_0x200fe3,_0x4e7bfd,_0x10a377,_0x19dabb,_0x52c82b,_0x53e611){return function(_0xf8632d){logger[_0x3d94('0x15')]('['+[_0x200fe3['toUpperCase']()]+_0x3d94('0x35'),_0xf8632d);return new Promise(function(_0x13fda9,_0x16d505){var _0x395cd9=_0x200fe3[_0x3d94('0x2c')]()===_0x3d94('0x36')?_0xf8632d[_0x3d94('0x1c')]:_0xf8632d[_0x3d94('0x24')];var _0x60279f={'method':_0x3d94('0x21'),'uri':_0x10a377+_0x3d94('0x37')+'?'+_0x53e611,'body':Object[_0x3d94('0x38')]({},{'active':_0x3d94('0x39'),'caller_id':_0x395cd9,'assigned_to':_0xf8632d[_0x3d94('0x1c')],'short_description':intUtil[_0x3d94('0x3a')](_0x19dabb['Subjects'],_0x52c82b,'\x20'),'description':intUtil[_0x3d94('0x3a')](_0x19dabb[_0x3d94('0x3b')],_0x52c82b,'\x0a')},getCustomFields(_0x19dabb[_0x3d94('0x3c')],_0x52c82b)),'auth':_0x4e7bfd,'json':!![]};return rp(_0x60279f)[_0x3d94('0xb')](function(_0x242033){logger[_0x3d94('0x15')]('['+[_0x200fe3[_0x3d94('0x10')]()]+_0x3d94('0x3d'),_0x242033[_0x3d94('0xc')]);_0xf8632d['ticketId']=_0x242033[_0x3d94('0xc')]['sys_id'];_0xf8632d[_0x3d94('0x3e')]=_0x242033[_0x3d94('0xc')]['number'];logger[_0x3d94('0x15')]('['+[_0x200fe3['toUpperCase']()]+']\x20getTicket\x20crm',_0xf8632d);_0x13fda9(_0xf8632d);})[_0x3d94('0x12')](function(_0x47de83){logger[_0x3d94('0x13')]('['+[_0x200fe3[_0x3d94('0x10')]()]+']',_0x47de83['message']);_0x16d505(_0x47de83[_0x3d94('0x14')]);});});};}function createRemoteTag(_0x590f77,_0x598c6a,_0x1a91d9,_0x1fb53e){return new Promise(function(_0xa9f159,_0x3dde77){var _0x1c8f62={'method':_0x3d94('0x21'),'uri':_0x1a91d9+_0x3d94('0x3f')+'?'+_0x1fb53e,'body':{'short_description':_0x590f77,'global':!![],'active':!![],'name':_0x590f77},'auth':_0x598c6a,'json':!![]};return rp(_0x1c8f62)[_0x3d94('0xb')](function(_0xae892){var _0x584e1d=_0xae892[_0x3d94('0xc')][_0x3d94('0xf')];_0xa9f159(_0x584e1d);});});}function getRemoteTag(_0x284fb2,_0x2625e0,_0xe7d1dc,_0x3e1992,_0x39e9db){return new Promise(function(_0x126894,_0x1210b5){var _0x469122={'method':_0x3d94('0x18'),'uri':_0xe7d1dc+'label'+_0x3d94('0x40')+_0x284fb2+'&'+_0x3e1992,'auth':_0x2625e0,'json':!![]};return rp(_0x469122)['then'](function(_0x709841){if(_0x709841[_0x3d94('0xc')][_0x3d94('0xd')]>0x0){var _0x17591b=_0x709841[_0x3d94('0xc')][0x0][_0x3d94('0xf')];_0x126894(_0x17591b);}else{return createRemoteTag(_0x284fb2,_0x2625e0,_0xe7d1dc,_0x3e1992)[_0x3d94('0xb')](function(_0x169aa1){_0x126894(_0x169aa1);});}});});}function assignTagToIncident(_0x9d9ad9,_0x5da38c,_0x519ada,_0x46bff3,_0x4bd97c){return new Promise(function(_0x14160b,_0x38adf9){var _0x557bb4={'method':_0x3d94('0x21'),'uri':_0x519ada+_0x3d94('0x41')+'?'+_0x4bd97c,'body':{'label':_0x9d9ad9,'table':_0x3d94('0x37'),'id_type':_0x3d94('0x42'),'table_key':_0x46bff3[_0x3d94('0x43')],'title':_0x3d94('0x44')+_0x46bff3[_0x3d94('0x3e')],'id_display':_0x46bff3['ticketNumber']},'auth':_0x5da38c,'json':!![]};return rp(_0x557bb4)[_0x3d94('0xb')](function(_0x351ea6){_0x14160b();})[_0x3d94('0x12')](function(){_0x14160b();});});}function manageTags(_0x4b23b5,_0x2d8b49,_0x15bbe2,_0x1d9d6d,_0x33d09a,_0x5cdfb0,_0x5292cc){return new Promise(function(_0x1cbd9a,_0x38b2fa){var _0x4190ef=[];_0x2d8b49[_0x3d94('0x45')](function(_0x4f9e83){_0x4190ef[_0x3d94('0x46')](getRemoteTag(_0x4f9e83,_0x15bbe2,_0x1d9d6d,_0x5cdfb0,_0x5292cc));});return Promise[_0x3d94('0x47')](_0x4190ef)['then'](function(_0x5ba865){if(_0x5ba865[_0x3d94('0xd')]){logger[_0x3d94('0x15')]('['+[_0x4b23b5['toUpperCase']()]+_0x3d94('0x48'),_0x5ba865);var _0x227372=[];_0x5ba865[_0x3d94('0x45')](function(_0x5747a8){_0x227372[_0x3d94('0x46')](assignTagToIncident(_0x5747a8,_0x15bbe2,_0x1d9d6d,_0x33d09a,_0x5cdfb0));});return Promise[_0x3d94('0x47')](_0x227372)['then'](function(){_0x1cbd9a();})['catch'](function(){_0x1cbd9a();});}else{_0x1cbd9a();}});});}function getTags(_0x4e1932,_0x3ac9ea,_0x298474,_0x13544a,_0x37a2e1,_0x196ed6){return function(_0x4ecfa2){return new Promise(function(_0xa13a18,_0x19c7bc){var _0x170d06=[];var _0x1e8e3d=_0x13544a[_0x3d94('0x49')];if(_0x1e8e3d&&_0x1e8e3d[_0x3d94('0xd')]>0x0){_0x170d06=_['map'](_0x1e8e3d,_0x3d94('0x34'));}if(_0x170d06['length']>0x0){return manageTags(_0x4e1932,_0x170d06,_0x3ac9ea,_0x298474,_0x4ecfa2,_0x37a2e1,_0x196ed6)[_0x3d94('0xb')](function(){_0xa13a18(_0x4ecfa2);});}else{_0xa13a18(_0x4ecfa2);}});};}function emit(_0x41d561,_0x437fff,_0x393ac9){var _0x128fdc=_0x3d94('0x4a')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x3d94('0x4b');var _0x4d8d97={'uri':_0x41d561+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x393ac9+_0x128fdc};io['to'](util['format'](_0x3d94('0x4c'),_0x437fff))[_0x3d94('0x4d')](_0x3d94('0x4e'),_0x4d8d97);}exports['cs']=function(_0x396146,_0xb20f94,_0x2e2fb0,_0x3ccb28,_0x34ecc4,_0x5e3480,_0x22917e,_0x5e55a4){var _0x12e279={};var _0x191350={'user':_0x5e3480[_0x3d94('0x4f')],'pass':_0x5e3480['password']};var _0x55084e='sysparm_limit=1';var _0x426ef5=_0x3d94('0x50');_0x5e3480[_0x3d94('0x51')]=intUtil[_0x3d94('0x52')](_0x5e3480[_0x3d94('0x51')]);_0x5e3480['serverUrl']=intUtil['stripTrailingSlash'](_0x5e3480[_0x3d94('0x53')]);var _0x404d36=util[_0x3d94('0x54')]('%s/api/now/table/',_0x5e3480[_0x3d94('0x51')]);_0x12e279['userEmail']=!_[_0x3d94('0x55')](_0x3ccb28)?_0x3ccb28[_0x3d94('0x56')]:null;_0x12e279[_0x3d94('0x1d')]=_0x5e3480[_0x3d94('0x56')];_0x12e279[_0x3d94('0x22')]=_0x5e55a4[_0x3d94('0x2c')]()===_0x3d94('0x36')?_0xb20f94[_0x3d94('0x57')]:_0xb20f94[_0x3d94('0x58')];_0x12e279[_0x3d94('0x59')]=_0x5e55a4===_0x3d94('0x5a')||_0x5e55a4===_0x3d94('0x5b')?_0x3d94('0x5a'):'outbound';var _0x2a6df3=util[_0x3d94('0x54')](_0x3d94('0x5c'),_0x5e3480[_0x3d94('0x53')],_0xb20f94['uniqueid'],md5(_0xb20f94[_0x3d94('0x5d')]));if(_0x34ecc4&&_0x34ecc4['monitor_format']){logger['info'](_0x3d94('0x5e'),'Recording\x20is\x20enabled!');_0xb20f94[_0x3d94('0x5f')]=_0x2a6df3;}else if(_0x22917e&&_0x22917e[_0x3d94('0x60')]&&_0x22917e['recordingFormat']!==_0x3d94('0x61')){logger['info'](_0x3d94('0x62'),_0x3d94('0x63'));_0xb20f94['recordingURL']=_0x2a6df3;}else{_0xb20f94['recordingURL']='';}return getAdminUser(_0x5e55a4,_0x191350,_0x12e279,_0x404d36,_0x426ef5,_0x55084e)['then'](getUser(_0x5e55a4,_0x191350,_0x404d36,_0x426ef5,_0x55084e))[_0x3d94('0xb')](getEndUser(_0x5e55a4,_0x191350,_0x404d36,_0x426ef5,_0x55084e))['then'](getTicket(_0x5e55a4,_0x191350,_0x404d36,_0x2e2fb0,_0xb20f94,_0x426ef5))['then'](function(_0x3a56ee){logger[_0x3d94('0x15')](util[_0x3d94('0x54')](_0x3d94('0x64'),_0x3a56ee['ticketId']));logger[_0x3d94('0x15')](util[_0x3d94('0x54')](_0x3d94('0x65'),_0x5e55a4));if(_0x5e55a4!==_0x3d94('0x5b')){logger[_0x3d94('0x15')]('['+[_0x5e55a4[_0x3d94('0x10')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5e3480[_0x3d94('0x51')],_0x3ccb28[_0x3d94('0x34')],_0x3a56ee[_0x3d94('0x43')]);}})[_0x3d94('0x12')](function(_0x35fee2){logger[_0x3d94('0x13')]('['+[_0x5e55a4[_0x3d94('0x10')]()]+_0x3d94('0x66'),util['inspect'](_0x35fee2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1775=['number','label','label_entry','incident','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','userEmail','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','type','nameField','customField','toLowerCase','content','toString','picklist','idField','variable','variableName','customVariable','Variable','name','outbound','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var Promise=require(_0x5177('0x0'));var rp=require(_0x5177('0x1'));var util=require(_0x5177('0x2'));var md5=require(_0x5177('0x3'));var Redis=require(_0x5177('0x4'));var intUtil=require(_0x5177('0x5'));var config=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));config[_0x5177('0x9')]=_[_0x5177('0xa')](config[_0x5177('0x9')],{'host':_0x5177('0xb'),'port':0x18eb});var io=require(_0x5177('0xc'))(new Redis(config[_0x5177('0x9')]));function getAdminUser(_0x245c12,_0x363611,_0x3ce288,_0x16e7a7,_0x2e5a3b,_0x2c23d8){return new Promise(function(_0x206035,_0x5bdca9){var _0x4ae3d2={'method':_0x5177('0xd'),'uri':_0x16e7a7+_0x5177('0xe')+'&'+_0x2e5a3b+'&'+_0x2c23d8,'auth':_0x363611,'json':!![]};return rp(_0x4ae3d2)[_0x5177('0xf')](function(_0x227316){if(_0x227316[_0x5177('0x10')]['length']>0x0){_0x3ce288[_0x5177('0x11')]=_0x227316[_0x5177('0x10')][0x0][_0x5177('0x12')];}logger[_0x5177('0x13')]('['+[_0x245c12[_0x5177('0x14')]()]+_0x5177('0x15'),_0x3ce288);_0x206035(_0x3ce288);})[_0x5177('0x16')](function(_0x2ec90f){logger[_0x5177('0x17')]('['+[_0x245c12[_0x5177('0x14')]()]+']',_0x2ec90f[_0x5177('0x18')]);_0x5bdca9(_0x2ec90f[_0x5177('0x18')]);});});}function getUser(_0x29cd2c,_0x31aff8,_0x1b32e6,_0x175ca6,_0x2ab5e5){return function(_0x7dba6f){logger[_0x5177('0x13')]('['+[_0x29cd2c['toUpperCase']()]+_0x5177('0x19'),_0x7dba6f);return new Promise(function(_0x41e687,_0x3f5ab5){if(intUtil[_0x5177('0x1a')](_0x7dba6f['userEmail'])){var _0x3e6944={'method':_0x5177('0xd'),'uri':_0x1b32e6+_0x5177('0x1b')+_0x7dba6f['userEmail']+'&'+_0x175ca6+'&'+_0x2ab5e5,'auth':_0x31aff8,'json':!![]};logger[_0x5177('0x13')]('['+[_0x29cd2c['toUpperCase']()]+_0x5177('0x1c'),_0x3e6944);return rp(_0x3e6944)[_0x5177('0xf')](function(_0x219744){logger[_0x5177('0x13')]('['+[_0x29cd2c[_0x5177('0x14')]()]+_0x5177('0x1d'),_0x219744);if(_0x219744[_0x5177('0x10')][_0x5177('0x1e')]>0x0&&String(_0x219744[_0x5177('0x10')][0x0][_0x5177('0x1f')])===_0x5177('0x20')){_0x7dba6f[_0x5177('0x21')]=_0x219744['result'][0x0][_0x5177('0x12')];}else{_0x7dba6f['userId']=_0x7dba6f[_0x5177('0x11')];_0x7dba6f[_0x5177('0x22')]=_0x7dba6f[_0x5177('0x23')];}logger[_0x5177('0x13')]('['+[_0x29cd2c['toUpperCase']()]+_0x5177('0x24'),_0x7dba6f);_0x41e687(_0x7dba6f);})['catch'](function(_0x564139){logger[_0x5177('0x17')]('['+[_0x29cd2c[_0x5177('0x14')]()]+']',_0x564139['message']);_0x3f5ab5(_0x564139[_0x5177('0x18')]);});}else{logger['info']('['+[_0x29cd2c[_0x5177('0x14')]()]+_0x5177('0x25'));_0x7dba6f['userId']=_0x7dba6f[_0x5177('0x11')];_0x7dba6f[_0x5177('0x22')]=_0x7dba6f[_0x5177('0x23')];_0x41e687(_0x7dba6f);}});};}function createEndUser(_0x7f86e,_0xe98ff1,_0x1cef5d,_0x5577bb,_0x498fcd){logger[_0x5177('0x13')]('['+[_0x7f86e[_0x5177('0x14')]()]+_0x5177('0x26'),_0x1cef5d);return new Promise(function(_0x174f7a,_0x2e1985){var _0x8134f9={'method':_0x5177('0x27'),'uri':_0x5577bb+_0x5177('0x28')+_0x498fcd,'body':{'user_name':_0x1cef5d['endUserNumber'],'roles':_0x5177('0x29'),'first_name':_0x1cef5d[_0x5177('0x2a')],'active':'true','date_format':_0x5177('0x2b'),'phone':_0x1cef5d['endUserNumber']},'auth':_0xe98ff1,'json':!![]};return rp(_0x8134f9)[_0x5177('0xf')](function(_0x1a2c46){logger[_0x5177('0x13')]('['+[_0x7f86e['toUpperCase']()]+'],\x20EndUser\x20schema',_0x1a2c46[_0x5177('0x10')]);_0x1cef5d[_0x5177('0x2c')]=_0x1a2c46[_0x5177('0x10')][_0x5177('0x12')];_0x174f7a(_0x1cef5d);})[_0x5177('0x16')](function(_0x282ed9){logger[_0x5177('0x17')]('['+[_0x7f86e[_0x5177('0x14')]()]+']',_0x282ed9['message']);_0x2e1985(_0x282ed9[_0x5177('0x18')]);});});}function getEndUser(_0x1d9afe,_0x570522,_0xa0851d,_0x2a26fc,_0x172196){return function(_0x8727c6){logger[_0x5177('0x13')]('['+[_0x1d9afe[_0x5177('0x14')]()]+'],\x20getEndUser\x20input\x20crm',_0x8727c6);return new Promise(function(_0x40c607,_0x1cb4a0){var _0x28b1d5={'method':_0x5177('0xd'),'uri':_0xa0851d+_0x5177('0x2d')+_0x8727c6[_0x5177('0x2a')]+'&'+_0x2a26fc+'&'+_0x172196,'auth':_0x570522,'json':!![]};return rp(_0x28b1d5)[_0x5177('0xf')](function(_0x5a5a33){if(_0x5a5a33[_0x5177('0x10')][_0x5177('0x1e')]>0x0){_0x8727c6['endUserId']=_0x5a5a33['result'][0x0][_0x5177('0x12')];logger[_0x5177('0x13')]('['+[_0x1d9afe[_0x5177('0x14')]()]+_0x5177('0x2e'),_0x8727c6);_0x40c607(_0x8727c6);}else{return createEndUser(_0x1d9afe,_0x570522,_0x8727c6,_0xa0851d,_0x2a26fc)[_0x5177('0xf')](function(_0x1ea3be){logger[_0x5177('0x13')]('['+[_0x1d9afe[_0x5177('0x14')]()]+_0x5177('0x2f'),_0x1ea3be);_0x40c607(_0x1ea3be);});}})[_0x5177('0x16')](function(_0x16fabc){logger[_0x5177('0x17')]('['+[_0x1d9afe[_0x5177('0x14')]()]+']',_0x16fabc['message']);_0x1cb4a0(_0x16fabc[_0x5177('0x18')]);});});};}function getCustomFields(_0x2a4db1,_0x4e3677){var _0x7341c0={};if(_0x2a4db1['length']>0x0){_[_0x5177('0x30')](_0x2a4db1,function(_0x77e8e3){if(_[_0x5177('0x31')](['string','picklist'],_0x77e8e3[_0x5177('0x32')])&&_0x77e8e3[_0x5177('0x33')]&&!_0x77e8e3[_0x5177('0x34')]){_0x7341c0[_0x77e8e3[_0x5177('0x33')][_0x5177('0x35')]()]=_0x77e8e3[_0x5177('0x36')][_0x5177('0x37')]();}else if(_[_0x5177('0x31')](['string',_0x5177('0x38')],_0x77e8e3['type'])&&_0x77e8e3['idField']&&_0x77e8e3[_0x5177('0x34')]){_0x7341c0[_0x77e8e3[_0x5177('0x39')]['toLowerCase']()]=_0x77e8e3[_0x5177('0x36')]['toString']();}else if(_0x77e8e3['type']===_0x5177('0x3a')&&_0x77e8e3[_0x5177('0x3b')]&&_0x77e8e3[_0x5177('0x39')]&&_0x77e8e3[_0x5177('0x34')]){_0x7341c0[_0x77e8e3[_0x5177('0x39')][_0x5177('0x35')]()]=_0x4e3677[_0x77e8e3[_0x5177('0x3b')]]['toString']();}else if(_0x77e8e3['type']===_0x5177('0x3c')&&_0x77e8e3['Variable']&&_0x77e8e3[_0x5177('0x3d')][_0x5177('0x3e')]&&_0x77e8e3[_0x5177('0x39')]&&_0x77e8e3[_0x5177('0x34')]){_0x7341c0[_0x77e8e3['idField'][_0x5177('0x35')]()]=_0x4e3677[_0x77e8e3[_0x5177('0x3d')][_0x5177('0x3e')][_0x5177('0x35')]()][_0x5177('0x37')]();}});}return _0x7341c0;}function getTicket(_0x10b370,_0x18ff35,_0xa24b4d,_0x1ada68,_0x296a98,_0x3fec49){return function(_0x5e796d){logger[_0x5177('0x13')]('['+[_0x10b370['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x5e796d);return new Promise(function(_0x5bda8a,_0x2f9ff9){var _0x2ce71a=_0x10b370['toLowerCase']()===_0x5177('0x3f')?_0x5e796d[_0x5177('0x21')]:_0x5e796d[_0x5177('0x2c')];var _0x4891fe={'method':_0x5177('0x27'),'uri':_0xa24b4d+'incident'+'?'+_0x3fec49,'body':Object['assign']({},{'active':'true','caller_id':_0x2ce71a,'assigned_to':_0x5e796d[_0x5177('0x21')],'short_description':intUtil[_0x5177('0x40')](_0x1ada68[_0x5177('0x41')],_0x296a98,'\x20'),'description':intUtil['getString'](_0x1ada68['Descriptions'],_0x296a98,'\x0a')},getCustomFields(_0x1ada68[_0x5177('0x42')],_0x296a98)),'auth':_0x18ff35,'json':!![]};return rp(_0x4891fe)['then'](function(_0x262ac4){logger[_0x5177('0x13')]('['+[_0x10b370[_0x5177('0x14')]()]+_0x5177('0x43'),_0x262ac4[_0x5177('0x10')]);_0x5e796d[_0x5177('0x44')]=_0x262ac4[_0x5177('0x10')][_0x5177('0x12')];_0x5e796d[_0x5177('0x45')]=_0x262ac4[_0x5177('0x10')][_0x5177('0x46')];logger[_0x5177('0x13')]('['+[_0x10b370[_0x5177('0x14')]()]+']\x20getTicket\x20crm',_0x5e796d);_0x5bda8a(_0x5e796d);})['catch'](function(_0x29ff0f){logger['error']('['+[_0x10b370[_0x5177('0x14')]()]+']',_0x29ff0f['message']);_0x2f9ff9(_0x29ff0f[_0x5177('0x18')]);});});};}function createRemoteTag(_0x24cb5e,_0x1e838a,_0x55a0b6,_0x5be224){return new Promise(function(_0x19884e,_0x43b5b9){var _0x2eb560={'method':_0x5177('0x27'),'uri':_0x55a0b6+'label'+'?'+_0x5be224,'body':{'short_description':_0x24cb5e,'global':!![],'active':!![],'name':_0x24cb5e},'auth':_0x1e838a,'json':!![]};return rp(_0x2eb560)['then'](function(_0x3f0e89){var _0x131da7=_0x3f0e89[_0x5177('0x10')][_0x5177('0x12')];_0x19884e(_0x131da7);});});}function getRemoteTag(_0x4ad742,_0xc3c118,_0x143aff,_0x3a18ad,_0x589da8){return new Promise(function(_0x2b39ba,_0xe0f87b){var _0x3a39b5={'method':'GET','uri':_0x143aff+_0x5177('0x47')+'?sysparm_query=name%3D'+_0x4ad742+'&'+_0x3a18ad,'auth':_0xc3c118,'json':!![]};return rp(_0x3a39b5)[_0x5177('0xf')](function(_0x39fb92){if(_0x39fb92[_0x5177('0x10')]['length']>0x0){var _0x169a04=_0x39fb92[_0x5177('0x10')][0x0][_0x5177('0x12')];_0x2b39ba(_0x169a04);}else{return createRemoteTag(_0x4ad742,_0xc3c118,_0x143aff,_0x3a18ad)[_0x5177('0xf')](function(_0xc7a59e){_0x2b39ba(_0xc7a59e);});}});});}function assignTagToIncident(_0x74589e,_0x37380c,_0x267599,_0x5ceed2,_0x5d96ce){return new Promise(function(_0x4b5b6b,_0x3bc60b){var _0x18222f={'method':_0x5177('0x27'),'uri':_0x267599+_0x5177('0x48')+'?'+_0x5d96ce,'body':{'label':_0x74589e,'table':_0x5177('0x49'),'id_type':_0x5177('0x4a'),'table_key':_0x5ceed2['ticketId'],'title':'Incident\x20-\x20'+_0x5ceed2[_0x5177('0x45')],'id_display':_0x5ceed2[_0x5177('0x45')]},'auth':_0x37380c,'json':!![]};return rp(_0x18222f)[_0x5177('0xf')](function(_0x336017){_0x4b5b6b();})[_0x5177('0x16')](function(){_0x4b5b6b();});});}function manageTags(_0x1b1778,_0x2d1745,_0xd9c1db,_0xbfb3d7,_0x4d3e8d,_0x25034b,_0x25a0be){return new Promise(function(_0x57e199,_0x194978){var _0x4481b6=[];_0x2d1745['forEach'](function(_0x69c264){_0x4481b6[_0x5177('0x4b')](getRemoteTag(_0x69c264,_0xd9c1db,_0xbfb3d7,_0x25034b,_0x25a0be));});return Promise[_0x5177('0x4c')](_0x4481b6)['then'](function(_0x23b246){if(_0x23b246[_0x5177('0x1e')]){logger['info']('['+[_0x1b1778['toUpperCase']()]+_0x5177('0x4d'),_0x23b246);var _0x4f76d7=[];_0x23b246[_0x5177('0x30')](function(_0x53f599){_0x4f76d7[_0x5177('0x4b')](assignTagToIncident(_0x53f599,_0xd9c1db,_0xbfb3d7,_0x4d3e8d,_0x25034b));});return Promise[_0x5177('0x4c')](_0x4f76d7)['then'](function(){_0x57e199();})[_0x5177('0x16')](function(){_0x57e199();});}else{_0x57e199();}});});}function getTags(_0x3b090d,_0x1975a3,_0x46b63d,_0x41c380,_0x2bf11b,_0x20d476){return function(_0x58ebdd){return new Promise(function(_0x26b733,_0x54aabd){var _0x54c301=[];var _0x94bb14=_0x41c380[_0x5177('0x4e')];if(_0x94bb14&&_0x94bb14['length']>0x0){_0x54c301=_[_0x5177('0x4f')](_0x94bb14,_0x5177('0x3e'));}if(_0x54c301[_0x5177('0x1e')]>0x0){return manageTags(_0x3b090d,_0x54c301,_0x1975a3,_0x46b63d,_0x58ebdd,_0x2bf11b,_0x20d476)[_0x5177('0xf')](function(){_0x26b733(_0x58ebdd);});}else{_0x26b733(_0x58ebdd);}});};}function emit(_0x19b587,_0x128cab,_0xe22e2a){var _0x3b26f4='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x5177('0x50')+_0x5177('0x51');var _0x260475={'uri':_0x19b587+_0x5177('0x52')+_0xe22e2a+_0x3b26f4};io['to'](util[_0x5177('0x53')](_0x5177('0x54'),_0x128cab))['emit'](_0x5177('0x55'),_0x260475);}exports['cs']=function(_0x397b75,_0x36ab31,_0x46d72e,_0x4aa151,_0x2e26c6,_0x95f83a,_0x124935,_0x22da9d){var _0x282cbc={};var _0x5130e6={'user':_0x95f83a[_0x5177('0x56')],'pass':_0x95f83a['password']};var _0x1a6499=_0x5177('0x57');var _0x5e3554=_0x5177('0x58');_0x95f83a[_0x5177('0x59')]=intUtil[_0x5177('0x5a')](_0x95f83a[_0x5177('0x59')]);_0x95f83a['serverUrl']=intUtil[_0x5177('0x5a')](_0x95f83a[_0x5177('0x5b')]);var _0x5b9ba8=util[_0x5177('0x53')]('%s/api/now/table/',_0x95f83a[_0x5177('0x59')]);_0x282cbc[_0x5177('0x22')]=!_[_0x5177('0x5c')](_0x4aa151)?_0x4aa151['email']:null;_0x282cbc['adminEmail']=_0x95f83a[_0x5177('0x5d')];_0x282cbc[_0x5177('0x2a')]=_0x22da9d[_0x5177('0x35')]()===_0x5177('0x3f')?_0x36ab31[_0x5177('0x5e')]:_0x36ab31[_0x5177('0x5f')];_0x282cbc[_0x5177('0x60')]=_0x22da9d===_0x5177('0x61')||_0x22da9d===_0x5177('0x62')?'queue':'outbound';var _0x597a84=util[_0x5177('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x95f83a[_0x5177('0x5b')],_0x36ab31[_0x5177('0x63')],md5(_0x36ab31[_0x5177('0x63')]));if(_0x2e26c6&&_0x2e26c6[_0x5177('0x64')]){logger[_0x5177('0x13')]('[QUEUE]',_0x5177('0x65'));_0x36ab31[_0x5177('0x66')]=_0x597a84;}else if(_0x124935&&_0x124935[_0x5177('0x67')]&&_0x124935['recordingFormat']!==_0x5177('0x68')){logger['info'](_0x5177('0x69'),_0x5177('0x65'));_0x36ab31['recordingURL']=_0x597a84;}else{_0x36ab31[_0x5177('0x66')]='';}return getAdminUser(_0x22da9d,_0x5130e6,_0x282cbc,_0x5b9ba8,_0x5e3554,_0x1a6499)[_0x5177('0xf')](getUser(_0x22da9d,_0x5130e6,_0x5b9ba8,_0x5e3554,_0x1a6499))['then'](getEndUser(_0x22da9d,_0x5130e6,_0x5b9ba8,_0x5e3554,_0x1a6499))['then'](getTicket(_0x22da9d,_0x5130e6,_0x5b9ba8,_0x46d72e,_0x36ab31,_0x5e3554))[_0x5177('0xf')](function(_0x5ea2aa){logger[_0x5177('0x13')](util[_0x5177('0x53')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5ea2aa[_0x5177('0x44')]));logger[_0x5177('0x13')](util[_0x5177('0x53')](_0x5177('0x6a'),_0x22da9d));if(_0x22da9d!==_0x5177('0x62')){logger[_0x5177('0x13')]('['+[_0x22da9d[_0x5177('0x14')]()]+']',_0x5177('0x6b'));emit(_0x95f83a['remoteUri'],_0x4aa151[_0x5177('0x3e')],_0x5ea2aa['ticketId']);}})[_0x5177('0x16')](function(_0x339d5d){logger[_0x5177('0x17')]('['+[_0x22da9d[_0x5177('0x14')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x5177('0x6c')](_0x339d5d,{'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 d8a5ce0..de038c2 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 _0x8bf1=['redis','socket.io-emitter','POST','info','getString','created_by','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','Contacts','parent_name','name','direction','length','variableName','push','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','','Caller\x20-\x20%s','Enduser\x20created.','map','forEach','type','string','customField','nameField','toLowerCase','content','custom_fields','idField','variable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','remoteUri','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','uri','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','contacts','charAt','catch','unmanaged','toUpperCase','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','defaults'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0x8bf1,0xd5));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18bf('0x0'));var rp=require(_0x18bf('0x1'));var BPromise=require(_0x18bf('0x2'));var md5=require(_0x18bf('0x3'));var util=require(_0x18bf('0x4'));var Redis=require(_0x18bf('0x5'));var intUtil=require(_0x18bf('0x6'));var config=require('../../../../config/environment');var logger=require(_0x18bf('0x7'))('sugarcrm');config['redis']=_[_0x18bf('0x8')](config[_0x18bf('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x18bf('0xa'))(new Redis(config[_0x18bf('0x9')]));var def={'method':_0x18bf('0xb'),'json':!![]};function emit(_0x5d2ba2,_0x50e202,_0x9c2ef5){io['to'](_0x5d2ba2)['emit'](_0x50e202,_0x9c2ef5);}function getTicket(_0x59b66c,_0x3f8034,_0x5a51b6,_0x210020,_0x507a65,_0x4b4abb,_0x2148be,_0x21ca7a){logger[_0x18bf('0xc')]('Creating\x20new\x20ticket...');var _0x2cfdc3=new Date();var _0x2c150e=[{'name':'name','value':intUtil[_0x18bf('0xd')](_0x210020['Subjects'],_0x507a65,'\x20')},{'name':'assigned_user_id','value':_0x3f8034['id']},{'name':_0x18bf('0xe'),'value':_0x3f8034['id']},{'name':'description','value':intUtil[_0x18bf('0xd')](_0x210020[_0x18bf('0xf')],_0x507a65,'\x0a')},{'name':_0x18bf('0x10'),'value':_0x2cfdc3['toISOString']()[_0x18bf('0x11')](0x0,0x13)[_0x18bf('0x12')]('T','\x20')},{'name':_0x18bf('0x13'),'value':'0'},{'name':_0x18bf('0x14'),'value':'15'},{'name':'parent_id','value':_0x5a51b6['id']},{'name':'parent_type','value':_0x18bf('0x15')},{'name':_0x18bf('0x16'),'value':_0x5a51b6[_0x18bf('0x17')]},{'name':_0x18bf('0x18'),'value':_0x21ca7a}];if(_0x4b4abb[_0x18bf('0x19')]){_['forEach'](_0x4b4abb,function(_0x432156){if(_0x507a65[_0x432156[_0x18bf('0x1a')]]){_0x2c150e[_0x18bf('0x1b')]({'name':_0x432156['idField'],'value':_0x507a65[_0x432156[_0x18bf('0x1a')]]});}});}return request({'form':{'method':_0x18bf('0x1c'),'input_type':'JSON','response_type':_0x18bf('0x1d'),'rest_data':JSON[_0x18bf('0x1e')]({'session':_0x2148be['id'],'module_name':_0x18bf('0x1f'),'name_value_list':_0x2c150e})}});}function getAuth(_0xf513e6){return util['format'](_0x18bf('0x20'),new Buffer(_0xf513e6[_0x18bf('0x21')]+':X')[_0x18bf('0x22')](_0x18bf('0x23')));}function getServerInfo(_0x5a6884){return request({'form':{'method':_0x18bf('0x24'),'input_type':_0x18bf('0x1d'),'response_type':_0x18bf('0x1d'),'rest_data':JSON[_0x18bf('0x1e')]({'session':_0x5a6884['id']})}});}function getUser(_0x3eaaa5,_0x181510,_0x364d9f){if(!_['isNil'](_0x181510)){logger[_0x18bf('0xc')](_0x18bf('0x25'),_0x181510);return request({'form':{'method':_0x18bf('0x26'),'input_type':_0x18bf('0x1d'),'response_type':_0x18bf('0x1d'),'rest_data':JSON[_0x18bf('0x1e')]({'session':_0x364d9f['id'],'module_name':_0x18bf('0x27'),'query':util[_0x18bf('0x28')](_0x18bf('0x29'),_0x181510),'order_by':'','offset':'0','select_fields':['id',_0x18bf('0x17'),_0x18bf('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x18bf('0x2b')](function(_0x4604aa){if(_0x4604aa[_0x18bf('0x2c')][_0x18bf('0x19')]){var _0x3b9ca9=_[_0x18bf('0x2d')](_0x4604aa[_0x18bf('0x2c')],function(_0x2b2f3f){return _0x2b2f3f['name_value_list'][_0x18bf('0x2a')][_0x18bf('0x2e')]===_0x181510;});if(_0x3b9ca9){logger[_0x18bf('0xc')](_0x18bf('0x2f'));return BPromise['resolve']({'id':_0x3b9ca9['name_value_list']['id'][_0x18bf('0x2e')],'name':_0x3b9ca9[_0x18bf('0x30')][_0x18bf('0x17')][_0x18bf('0x2e')]});}}logger['info'](_0x18bf('0x31'));return BPromise[_0x18bf('0x32')]({'id':_0x364d9f['name_value_list'][_0x18bf('0x33')][_0x18bf('0x2e')],'name':_0x364d9f[_0x18bf('0x30')][_0x18bf('0x2a')][_0x18bf('0x2e')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x18bf('0x32')]({'id':_0x364d9f[_0x18bf('0x30')]['user_id'][_0x18bf('0x2e')],'name':_0x364d9f['name_value_list'][_0x18bf('0x2a')][_0x18bf('0x2e')]});}}function getEndUser(_0x44c6b0,_0x3652fc,_0x5733ce,_0x2df23a){logger[_0x18bf('0xc')](_0x18bf('0x34'),_0x5733ce);return request({'form':{'method':_0x18bf('0x26'),'input_type':'JSON','response_type':_0x18bf('0x1d'),'rest_data':JSON[_0x18bf('0x1e')]({'session':_0x2df23a['id'],'module_name':_0x18bf('0x15'),'query':util[_0x18bf('0x28')](_0x18bf('0x35'),_0x5733ce),'order_by':'','offset':'0','select_fields':['id','name',_0x18bf('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x18bf('0x2b')](function(_0x215be5){if(_0x215be5[_0x18bf('0x2c')][_0x18bf('0x19')]){var _0x1ce299=_[_0x18bf('0x2d')](_0x215be5[_0x18bf('0x2c')],function(_0x4159f4){return _0x4159f4[_0x18bf('0x30')]['phone_home'][_0x18bf('0x2e')]===_0x5733ce;});if(_0x1ce299){logger['info']('Enduser\x20found!');return BPromise[_0x18bf('0x32')]({'id':_0x1ce299[_0x18bf('0x30')]['id']['value'],'name':_0x1ce299[_0x18bf('0x30')]['name'][_0x18bf('0x2e')],'phone':_0x1ce299[_0x18bf('0x30')]['phone_home'][_0x18bf('0x2e')]});}}else{logger[_0x18bf('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x18bf('0x1d'),'response_type':'JSON','rest_data':JSON[_0x18bf('0x1e')]({'session':_0x2df23a['id'],'module_name':_0x18bf('0x15'),'name_value_list':[{'name':'first_name','value':_0x3652fc!==_0x18bf('0x37')?_0x3652fc:util['format'](_0x18bf('0x38'),_0x5733ce)},{'name':_0x18bf('0x36'),'value':_0x5733ce}]})}})[_0x18bf('0x2b')](function(_0x5e6c8b){logger[_0x18bf('0xc')](_0x18bf('0x39'));return BPromise['resolve']({'id':_0x5e6c8b['id'],'name':_0x5e6c8b['entry_list']['first_name'][_0x18bf('0x2e')],'phone':_0x5e6c8b[_0x18bf('0x2c')][_0x18bf('0x36')][_0x18bf('0x2e')]});});}});}function request(_0x344d80){logger['debug']('[HTTP]',JSON[_0x18bf('0x1e')](_0x344d80));return rp(_['merge'](def,_0x344d80));}function getTags(_0x5f5322,_0x407d81){var _0x51f9c2=[];if(_0x5f5322&&_0x5f5322[_0x18bf('0x19')]>0x0){_0x51f9c2=_[_0x18bf('0x3a')](_0x5f5322,_0x407d81);}return _0x51f9c2;}function getCustomFields(_0x584cf4,_0x32101a){var _0x79e9f8=[];var _0x3afd66={'custom_fields':[]};if(_0x584cf4[_0x18bf('0x19')]>0x0){_[_0x18bf('0x3b')](_0x584cf4,function(_0x1342ef){if(_0x1342ef[_0x18bf('0x3c')]===_0x18bf('0x3d')&&_0x1342ef['nameField']&&!_0x1342ef[_0x18bf('0x3e')]){_0x3afd66[_0x1342ef[_0x18bf('0x3f')][_0x18bf('0x40')]()]=_0x1342ef[_0x18bf('0x41')][_0x18bf('0x22')]();}else if(_0x1342ef[_0x18bf('0x3c')]===_0x18bf('0x3d')&&_0x1342ef['idField']&&_0x1342ef[_0x18bf('0x3e')]){_0x3afd66[_0x18bf('0x42')]['push']({'id':_0x1342ef[_0x18bf('0x43')],'value':_0x1342ef[_0x18bf('0x41')]['toString']()});}else if(_0x1342ef['type']===_0x18bf('0x44')&&_0x1342ef[_0x18bf('0x1a')]&&_0x1342ef[_0x18bf('0x43')]&&_0x1342ef[_0x18bf('0x3e')]){_0x32101a[_0x1342ef[_0x18bf('0x1a')]]&&_0x3afd66[_0x18bf('0x42')][_0x18bf('0x1b')]({'id':_0x1342ef[_0x18bf('0x43')],'value':_0x32101a[_0x1342ef[_0x18bf('0x1a')]]['toString']()});}else if(_0x1342ef[_0x18bf('0x3c')]==='customVariable'&&_0x1342ef[_0x18bf('0x45')]&&_0x1342ef[_0x18bf('0x45')][_0x18bf('0x17')]&&_0x1342ef['idField']&&_0x1342ef['customField']){_0x32101a[_0x1342ef['Variable'][_0x18bf('0x17')]['toLowerCase']()]&&_0x3afd66['custom_fields']['push']({'id':_0x1342ef[_0x18bf('0x43')],'value':_0x32101a[_0x1342ef[_0x18bf('0x45')][_0x18bf('0x17')][_0x18bf('0x40')]()][_0x18bf('0x22')]()});}});}return _0x3afd66;}function getConnection(_0x1d1ada){return request({'method':_0x18bf('0xb'),'form':{'method':_0x18bf('0x46'),'input_type':_0x18bf('0x1d'),'response_type':'JSON','rest_data':JSON[_0x18bf('0x1e')]({'user_auth':{'user_name':_0x1d1ada[_0x18bf('0x47')],'password':_0x1d1ada['password'],'encryption':_0x18bf('0x48')},'application':_0x18bf('0x49')})}})[_0x18bf('0x2b')](function(_0xe292e3){var _0x189d0a=_0xe292e3;if(_0x189d0a['id']){def['sessionID']=_0x189d0a['id'];return BPromise[_0x18bf('0x32')](_0x189d0a);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x1d1ada['id']));}});}function setRelationship(_0x2d76b5,_0x4e2b7c,_0x5f4fa4,_0x399247){return request({'form':{'method':_0x18bf('0x4a'),'input_type':_0x18bf('0x1d'),'response_type':'JSON','rest_data':JSON[_0x18bf('0x1e')]({'session':_0x2d76b5['id'],'module_name':'Calls','module_id':_0x5f4fa4['id'],'link_field_name':_0x399247,'related_ids':[_0x4e2b7c['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3ed478,_0x39076c,_0x1fbb8b,_0x3e8d13,_0x3de8ad,_0x309964){var _0x39882c,_0x549869,_0x5accae,_0x215ffa;_0x309964[_0x18bf('0x4b')]=intUtil[_0x18bf('0x4c')](_0x309964['remoteUri']);_0x309964['serverUrl']=intUtil[_0x18bf('0x4c')](_0x309964[_0x18bf('0x4d')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x309964['remoteUri']);if(_0x3de8ad&&_0x3de8ad[_0x18bf('0x4e')]){logger[_0x18bf('0xc')](_0x18bf('0x4f'),_0x18bf('0x50'));_0x39076c['recordingURL']=util[_0x18bf('0x28')](_0x18bf('0x51'),_0x309964[_0x18bf('0x4d')],_0x39076c[_0x18bf('0x52')],md5(_0x39076c[_0x18bf('0x52')]));}else{_0x39076c[_0x18bf('0x53')]='';}return getConnection(_0x309964)[_0x18bf('0x2b')](function(_0x99ac7b){_0x215ffa=_0x99ac7b;return getUser(_0x309964,_0x3e8d13[_0x18bf('0x17')],_0x215ffa);})[_0x18bf('0x2b')](function(_0x4f573f){_0x39882c=_0x4f573f;logger[_0x18bf('0xc')]('The\x20User\x20ID\x20is:',_0x39882c['id']);return getEndUser(_0x309964,_0x39076c[_0x18bf('0x54')],_0x39076c['calleridnum'],_0x215ffa);})[_0x18bf('0x2b')](function(_0x134692){_0x549869=_0x134692;logger['info'](_0x18bf('0x55'),_0x549869['id']);return getTicket(_0x309964,_0x39882c,_0x549869,_0x1fbb8b,_0x39076c,_0x1fbb8b[_0x18bf('0x56')],_0x215ffa,_0x18bf('0x57'));})[_0x18bf('0x2b')](function(_0x175406){_0x5accae=_0x175406;logger['info'](_0x18bf('0x58'));logger[_0x18bf('0xc')]('The\x20Ticket\x20ID\x20is:',_0x5accae['id']);return setRelationship(_0x215ffa,_0x39882c,_0x5accae,'users');})[_0x18bf('0x2b')](function(){return setRelationship(_0x215ffa,_0x549869,_0x5accae,'contacts');})[_0x18bf('0x2b')](function(){return getServerInfo(_0x215ffa);})[_0x18bf('0x2b')](function(_0x400918){var _0x414de6=parseInt(_0x400918[_0x18bf('0x59')]['charAt'](0x0));var _0x450509=util[_0x18bf('0x28')](_0x18bf('0x5a'),_0x309964[_0x18bf('0x4b')],_0x5accae['id']);if(_0x414de6>0x6){_0x450509=util['format'](_0x18bf('0x5b'),_0x309964[_0x18bf('0x4b')],_0x5accae['id']);}logger[_0x18bf('0xc')]('[QUEUE]',_0x18bf('0x5c'));emit(util['format'](_0x18bf('0x5d'),_0x3e8d13[_0x18bf('0x17')]),_0x18bf('0x5e'),{'uri':_0x450509});})['catch'](function(_0x2452f2){logger[_0x18bf('0x5f')](_0x18bf('0x4f'),JSON[_0x18bf('0x1e')](_0x2452f2));});};exports['outbound']=function(_0x82cf67,_0x48ea01,_0x32dc80,_0x2b5133,_0x1dd8ea,_0x698695,_0x29d933){var _0x1e41aa,_0x369567,_0x512e9a,_0x2f1679;_0x698695[_0x18bf('0x4b')]=intUtil[_0x18bf('0x4c')](_0x698695[_0x18bf('0x4b')]);_0x698695[_0x18bf('0x4d')]=intUtil[_0x18bf('0x4c')](_0x698695[_0x18bf('0x4d')]);def[_0x18bf('0x60')]=util['format'](_0x18bf('0x61'),_0x698695[_0x18bf('0x4b')]);if(_0x29d933&&_0x29d933[_0x18bf('0x62')]&&_0x29d933['recordingFormat']!==_0x18bf('0x63')){logger[_0x18bf('0xc')](_0x18bf('0x64'),_0x18bf('0x50'));_0x48ea01['recordingURL']=util[_0x18bf('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x698695[_0x18bf('0x4d')],_0x48ea01[_0x18bf('0x52')],md5(_0x48ea01['uniqueid']));}return getConnection(_0x698695)[_0x18bf('0x2b')](function(_0x5db188){_0x2f1679=_0x5db188;return getUser(_0x698695,_0x2b5133['name'],_0x2f1679);})[_0x18bf('0x2b')](function(_0x111a43){_0x1e41aa=_0x111a43;logger[_0x18bf('0xc')](_0x18bf('0x65'),_0x1e41aa['id']);return getEndUser(_0x698695,_0x48ea01[_0x18bf('0x66')],_0x48ea01[_0x18bf('0x67')],_0x2f1679);})[_0x18bf('0x2b')](function(_0x400c38){_0x369567=_0x400c38;logger['info']('The\x20Enduser\x20ID\x20is:',_0x369567['id']);return getTicket(_0x698695,_0x1e41aa,_0x369567,_0x32dc80,_0x48ea01,_0x32dc80['Fields'],_0x2f1679,'Outbound');})[_0x18bf('0x2b')](function(_0x13c5fd){_0x512e9a=_0x13c5fd;logger[_0x18bf('0xc')](_0x18bf('0x58'));logger[_0x18bf('0xc')](_0x18bf('0x68'),_0x512e9a['id']);return setRelationship(_0x2f1679,_0x1e41aa,_0x512e9a,'users');})[_0x18bf('0x2b')](function(){return setRelationship(_0x2f1679,_0x369567,_0x512e9a,_0x18bf('0x69'));})[_0x18bf('0x2b')](function(){return getServerInfo(_0x2f1679);})[_0x18bf('0x2b')](function(_0x56db9f){var _0x2b9630=parseInt(_0x56db9f[_0x18bf('0x59')][_0x18bf('0x6a')](0x0));var _0x1bb344=util[_0x18bf('0x28')](_0x18bf('0x5a'),_0x698695[_0x18bf('0x4b')],_0x512e9a['id']);if(_0x2b9630>0x6){_0x1bb344=util['format'](_0x18bf('0x5b'),_0x698695[_0x18bf('0x4b')],_0x512e9a['id']);}logger['info'](_0x18bf('0x64'),_0x18bf('0x5c'));emit(util[_0x18bf('0x28')](_0x18bf('0x5d'),_0x2b5133[_0x18bf('0x17')]),_0x18bf('0x5e'),{'uri':_0x1bb344});})[_0x18bf('0x6b')](function(_0x3775d5){logger[_0x18bf('0x5f')](_0x18bf('0x64'),JSON['stringify'](_0x3775d5));});};exports[_0x18bf('0x6c')]=function(_0x36a43e,_0x19bc3c,_0x519adf,_0x3b860b,_0x2fae29,_0x4bc8ed){var _0x755d80,_0x38235e,_0x21e5c1,_0x26c9c5;_0x4bc8ed[_0x18bf('0x4b')]=intUtil[_0x18bf('0x4c')](_0x4bc8ed[_0x18bf('0x4b')]);_0x4bc8ed[_0x18bf('0x4d')]=intUtil[_0x18bf('0x4c')](_0x4bc8ed[_0x18bf('0x4d')]);def[_0x18bf('0x60')]=util['format'](_0x18bf('0x61'),_0x4bc8ed[_0x18bf('0x4b')]);if(_0x2fae29&&_0x2fae29[_0x18bf('0x4e')]){logger[_0x18bf('0xc')]('['+_0x19bc3c['lastevent'][_0x18bf('0x6d')]()+']',_0x18bf('0x50'));_0x19bc3c['recordingURL']=util[_0x18bf('0x28')](_0x18bf('0x51'),_0x4bc8ed[_0x18bf('0x4d')],_0x19bc3c[_0x18bf('0x52')],md5(_0x19bc3c['uniqueid']));}else{_0x19bc3c[_0x18bf('0x53')]='';}return getConnection(_0x4bc8ed)[_0x18bf('0x2b')](function(_0x44941f){_0x26c9c5=_0x44941f;if(!_['isNil'](_0x3b860b)){return getUser(_0x4bc8ed,_0x3b860b[_0x18bf('0x17')],_0x26c9c5);}else{return getUser(_0x4bc8ed,null,_0x26c9c5);}})[_0x18bf('0x2b')](function(_0x2e98a9){_0x755d80=_0x2e98a9;logger[_0x18bf('0xc')](_0x18bf('0x65'),_0x755d80['id']);return getEndUser(_0x4bc8ed,_0x19bc3c['calleridname'],_0x19bc3c[_0x18bf('0x6e')],_0x26c9c5);})[_0x18bf('0x2b')](function(_0x343c06){_0x38235e=_0x343c06;logger[_0x18bf('0xc')](_0x18bf('0x55'),_0x38235e['id']);return getTicket(_0x4bc8ed,_0x755d80,_0x38235e,_0x519adf,_0x19bc3c,_0x519adf[_0x18bf('0x56')],_0x26c9c5,_0x18bf('0x57'));})['then'](function(_0x468802){_0x21e5c1=_0x468802;logger[_0x18bf('0xc')](_0x18bf('0x58'));logger['info'](_0x18bf('0x68'),_0x21e5c1['id']);return setRelationship(_0x26c9c5,_0x755d80,_0x21e5c1,'users');})[_0x18bf('0x2b')](function(){return setRelationship(_0x26c9c5,_0x38235e,_0x21e5c1,_0x18bf('0x69'));})[_0x18bf('0x2b')](function(){return getServerInfo(_0x26c9c5);})['catch'](function(_0x16416d){logger[_0x18bf('0x5f')]('['+_0x19bc3c['lastevent'][_0x18bf('0x6d')]()+']',JSON[_0x18bf('0x1e')](_0x16416d));});}; \ No newline at end of file +var _0x6c54=['../../../../config/environment','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','toISOString','slice','duration_hours','parent_id','parent_type','parent_name','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','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\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','custom_fields','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','stripTrailingSlash','recordingFormat','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','lastevent','toUpperCase','catch','lodash','request-promise','bluebird','md5','util','./util'];(function(_0x17886b,_0x1a26c0){var _0x2f59f6=function(_0x4e8c39){while(--_0x4e8c39){_0x17886b['push'](_0x17886b['shift']());}};_0x2f59f6(++_0x1a26c0);}(_0x6c54,0xe4));var _0x46c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6c54[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x46c5('0x0'));var rp=require(_0x46c5('0x1'));var BPromise=require(_0x46c5('0x2'));var md5=require(_0x46c5('0x3'));var util=require(_0x46c5('0x4'));var Redis=require('ioredis');var intUtil=require(_0x46c5('0x5'));var config=require(_0x46c5('0x6'));var logger=require('../../../../config/logger')(_0x46c5('0x7'));config['redis']=_[_0x46c5('0x8')](config[_0x46c5('0x9')],{'host':_0x46c5('0xa'),'port':0x18eb});var io=require(_0x46c5('0xb'))(new Redis(config[_0x46c5('0x9')]));var def={'method':_0x46c5('0xc'),'json':!![]};function emit(_0x1cd663,_0x5ec9a6,_0x29a76c){io['to'](_0x1cd663)[_0x46c5('0xd')](_0x5ec9a6,_0x29a76c);}function getTicket(_0x28bf02,_0x425611,_0x3988c0,_0x37b3ec,_0x19d73b,_0x368625,_0x36207f,_0x39a703){logger['info'](_0x46c5('0xe'));var _0x4ed004=new Date();var _0x30f025=[{'name':_0x46c5('0xf'),'value':intUtil[_0x46c5('0x10')](_0x37b3ec[_0x46c5('0x11')],_0x19d73b,'\x20')},{'name':_0x46c5('0x12'),'value':_0x425611['id']},{'name':'created_by','value':_0x425611['id']},{'name':_0x46c5('0x13'),'value':intUtil[_0x46c5('0x10')](_0x37b3ec[_0x46c5('0x14')],_0x19d73b,'\x0a')},{'name':'date_start','value':_0x4ed004[_0x46c5('0x15')]()[_0x46c5('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':_0x46c5('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x46c5('0x18'),'value':_0x3988c0['id']},{'name':_0x46c5('0x19'),'value':'Contacts'},{'name':_0x46c5('0x1a'),'value':_0x3988c0['name']},{'name':'direction','value':_0x39a703}];if(_0x368625[_0x46c5('0x1b')]){_[_0x46c5('0x1c')](_0x368625,function(_0x144800){if(_0x19d73b[_0x144800[_0x46c5('0x1d')]]){_0x30f025[_0x46c5('0x1e')]({'name':_0x144800[_0x46c5('0x1f')],'value':_0x19d73b[_0x144800[_0x46c5('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x46c5('0x20'),'response_type':_0x46c5('0x20'),'rest_data':JSON[_0x46c5('0x21')]({'session':_0x36207f['id'],'module_name':_0x46c5('0x22'),'name_value_list':_0x30f025})}});}function getAuth(_0x419ce1){return util[_0x46c5('0x23')](_0x46c5('0x24'),new Buffer(_0x419ce1[_0x46c5('0x25')]+':X')[_0x46c5('0x26')]('base64'));}function getServerInfo(_0x38517f){return request({'form':{'method':_0x46c5('0x27'),'input_type':_0x46c5('0x20'),'response_type':_0x46c5('0x20'),'rest_data':JSON[_0x46c5('0x21')]({'session':_0x38517f['id']})}});}function getUser(_0x19f38c,_0xf19b9c,_0x2ff10f){if(!_[_0x46c5('0x28')](_0xf19b9c)){logger[_0x46c5('0x29')](_0x46c5('0x2a'),_0xf19b9c);return request({'form':{'method':_0x46c5('0x2b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x46c5('0x21')]({'session':_0x2ff10f['id'],'module_name':_0x46c5('0x2c'),'query':util[_0x46c5('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xf19b9c),'order_by':'','offset':'0','select_fields':['id',_0x46c5('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x46c5('0x2d')](function(_0x44cf3e){if(_0x44cf3e[_0x46c5('0x2e')][_0x46c5('0x1b')]){var _0x17a469=_[_0x46c5('0x2f')](_0x44cf3e[_0x46c5('0x2e')],function(_0x3ae6b7){return _0x3ae6b7[_0x46c5('0x30')][_0x46c5('0x31')][_0x46c5('0x32')]===_0xf19b9c;});if(_0x17a469){logger[_0x46c5('0x29')](_0x46c5('0x33'));return BPromise['resolve']({'id':_0x17a469[_0x46c5('0x30')]['id'][_0x46c5('0x32')],'name':_0x17a469['name_value_list'][_0x46c5('0xf')][_0x46c5('0x32')]});}}logger[_0x46c5('0x29')](_0x46c5('0x34'));return BPromise[_0x46c5('0x35')]({'id':_0x2ff10f['name_value_list'][_0x46c5('0x36')][_0x46c5('0x32')],'name':_0x2ff10f['name_value_list'][_0x46c5('0x31')][_0x46c5('0x32')]});});}else{logger[_0x46c5('0x29')](_0x46c5('0x37'));return BPromise[_0x46c5('0x35')]({'id':_0x2ff10f[_0x46c5('0x30')][_0x46c5('0x36')][_0x46c5('0x32')],'name':_0x2ff10f[_0x46c5('0x30')]['user_name']['value']});}}function getEndUser(_0x13b6d2,_0x3cb723,_0x2b2f28,_0x41080b){logger['info'](_0x46c5('0x38'),_0x2b2f28);return request({'form':{'method':_0x46c5('0x2b'),'input_type':'JSON','response_type':_0x46c5('0x20'),'rest_data':JSON['stringify']({'session':_0x41080b['id'],'module_name':'Contacts','query':util[_0x46c5('0x23')](_0x46c5('0x39'),_0x2b2f28),'order_by':'','offset':'0','select_fields':['id',_0x46c5('0xf'),_0x46c5('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x46c5('0x2d')](function(_0x2a9845){if(_0x2a9845['entry_list'][_0x46c5('0x1b')]){var _0xb2a8ce=_['find'](_0x2a9845[_0x46c5('0x2e')],function(_0xbf13de){return _0xbf13de[_0x46c5('0x30')]['phone_home']['value']===_0x2b2f28;});if(_0xb2a8ce){logger[_0x46c5('0x29')]('Enduser\x20found!');return BPromise['resolve']({'id':_0xb2a8ce[_0x46c5('0x30')]['id'][_0x46c5('0x32')],'name':_0xb2a8ce[_0x46c5('0x30')][_0x46c5('0xf')][_0x46c5('0x32')],'phone':_0xb2a8ce[_0x46c5('0x30')][_0x46c5('0x3a')][_0x46c5('0x32')]});}}else{logger[_0x46c5('0x29')](_0x46c5('0x3b'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x46c5('0x20'),'rest_data':JSON['stringify']({'session':_0x41080b['id'],'module_name':_0x46c5('0x3c'),'name_value_list':[{'name':_0x46c5('0x3d'),'value':_0x3cb723!==_0x46c5('0x3e')?_0x3cb723:util[_0x46c5('0x23')](_0x46c5('0x3f'),_0x2b2f28)},{'name':_0x46c5('0x3a'),'value':_0x2b2f28}]})}})[_0x46c5('0x2d')](function(_0x51c788){logger[_0x46c5('0x29')](_0x46c5('0x40'));return BPromise[_0x46c5('0x35')]({'id':_0x51c788['id'],'name':_0x51c788['entry_list']['first_name'][_0x46c5('0x32')],'phone':_0x51c788[_0x46c5('0x2e')][_0x46c5('0x3a')][_0x46c5('0x32')]});});}});}function request(_0x244407){logger[_0x46c5('0x41')](_0x46c5('0x42'),JSON[_0x46c5('0x21')](_0x244407));return rp(_['merge'](def,_0x244407));}function getTags(_0xd4d0fd,_0x4199db){var _0x9db277=[];if(_0xd4d0fd&&_0xd4d0fd['length']>0x0){_0x9db277=_[_0x46c5('0x43')](_0xd4d0fd,_0x4199db);}return _0x9db277;}function getCustomFields(_0x29a252,_0x4e946e){var _0x46af60=[];var _0x2ce23f={'custom_fields':[]};if(_0x29a252[_0x46c5('0x1b')]>0x0){_[_0x46c5('0x1c')](_0x29a252,function(_0x14446d){if(_0x14446d[_0x46c5('0x44')]===_0x46c5('0x45')&&_0x14446d[_0x46c5('0x46')]&&!_0x14446d[_0x46c5('0x47')]){_0x2ce23f[_0x14446d[_0x46c5('0x46')][_0x46c5('0x48')]()]=_0x14446d[_0x46c5('0x49')][_0x46c5('0x26')]();}else if(_0x14446d[_0x46c5('0x44')]===_0x46c5('0x45')&&_0x14446d[_0x46c5('0x1f')]&&_0x14446d['customField']){_0x2ce23f[_0x46c5('0x4a')][_0x46c5('0x1e')]({'id':_0x14446d[_0x46c5('0x1f')],'value':_0x14446d[_0x46c5('0x49')][_0x46c5('0x26')]()});}else if(_0x14446d['type']==='variable'&&_0x14446d['variableName']&&_0x14446d['idField']&&_0x14446d[_0x46c5('0x47')]){_0x4e946e[_0x14446d['variableName']]&&_0x2ce23f[_0x46c5('0x4a')]['push']({'id':_0x14446d['idField'],'value':_0x4e946e[_0x14446d['variableName']]['toString']()});}else if(_0x14446d[_0x46c5('0x44')]==='customVariable'&&_0x14446d['Variable']&&_0x14446d[_0x46c5('0x4b')][_0x46c5('0xf')]&&_0x14446d[_0x46c5('0x1f')]&&_0x14446d[_0x46c5('0x47')]){_0x4e946e[_0x14446d[_0x46c5('0x4b')][_0x46c5('0xf')][_0x46c5('0x48')]()]&&_0x2ce23f[_0x46c5('0x4a')]['push']({'id':_0x14446d['idField'],'value':_0x4e946e[_0x14446d[_0x46c5('0x4b')][_0x46c5('0xf')][_0x46c5('0x48')]()][_0x46c5('0x26')]()});}});}return _0x2ce23f;}function getConnection(_0x34d206){return request({'method':_0x46c5('0xc'),'form':{'method':_0x46c5('0x4c'),'input_type':_0x46c5('0x20'),'response_type':_0x46c5('0x20'),'rest_data':JSON[_0x46c5('0x21')]({'user_auth':{'user_name':_0x34d206[_0x46c5('0x4d')],'password':_0x34d206['password'],'encryption':_0x46c5('0x4e')},'application':_0x46c5('0x4f')})}})[_0x46c5('0x2d')](function(_0x33ab6d){var _0x630573=_0x33ab6d;if(_0x630573['id']){def[_0x46c5('0x50')]=_0x630573['id'];return BPromise['resolve'](_0x630573);}else{throw new Error(util[_0x46c5('0x23')]('Account\x20%d\x20is\x20not\x20valid',_0x34d206['id']));}});}function setRelationship(_0x482cf7,_0x104c53,_0x58ff64,_0x22f552){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x46c5('0x21')]({'session':_0x482cf7['id'],'module_name':'Calls','module_id':_0x58ff64['id'],'link_field_name':_0x22f552,'related_ids':[_0x104c53['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x19f8e9,_0x3dc55c,_0x5a3e0c,_0x190b3b,_0x25a88b,_0x1331c0){var _0x5d68c8,_0x38ba03,_0x14b509,_0xee389c;_0x1331c0['remoteUri']=intUtil['stripTrailingSlash'](_0x1331c0['remoteUri']);_0x1331c0['serverUrl']=intUtil['stripTrailingSlash'](_0x1331c0['serverUrl']);def[_0x46c5('0x51')]=util[_0x46c5('0x23')](_0x46c5('0x52'),_0x1331c0[_0x46c5('0x53')]);if(_0x25a88b&&_0x25a88b[_0x46c5('0x54')]){logger['info'](_0x46c5('0x55'),_0x46c5('0x56'));_0x3dc55c[_0x46c5('0x57')]=util[_0x46c5('0x23')](_0x46c5('0x58'),_0x1331c0[_0x46c5('0x59')],_0x3dc55c[_0x46c5('0x5a')],md5(_0x3dc55c[_0x46c5('0x5a')]));}else{_0x3dc55c[_0x46c5('0x57')]='';}return getConnection(_0x1331c0)['then'](function(_0x21bbb5){_0xee389c=_0x21bbb5;return getUser(_0x1331c0,_0x190b3b['name'],_0xee389c);})['then'](function(_0x4aae7d){_0x5d68c8=_0x4aae7d;logger[_0x46c5('0x29')]('The\x20User\x20ID\x20is:',_0x5d68c8['id']);return getEndUser(_0x1331c0,_0x3dc55c['calleridname'],_0x3dc55c[_0x46c5('0x5b')],_0xee389c);})['then'](function(_0x3f1348){_0x38ba03=_0x3f1348;logger[_0x46c5('0x29')](_0x46c5('0x5c'),_0x38ba03['id']);return getTicket(_0x1331c0,_0x5d68c8,_0x38ba03,_0x5a3e0c,_0x3dc55c,_0x5a3e0c[_0x46c5('0x5d')],_0xee389c,_0x46c5('0x5e'));})[_0x46c5('0x2d')](function(_0x2007b8){_0x14b509=_0x2007b8;logger[_0x46c5('0x29')](_0x46c5('0x5f'));logger['info'](_0x46c5('0x60'),_0x14b509['id']);return setRelationship(_0xee389c,_0x5d68c8,_0x14b509,_0x46c5('0x61'));})[_0x46c5('0x2d')](function(){return setRelationship(_0xee389c,_0x38ba03,_0x14b509,_0x46c5('0x62'));})['then'](function(){return getServerInfo(_0xee389c);})['then'](function(_0x40d160){var _0x429dc9=parseInt(_0x40d160[_0x46c5('0x63')]['charAt'](0x0));var _0x205fab=util[_0x46c5('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1331c0[_0x46c5('0x53')],_0x14b509['id']);if(_0x429dc9>0x6){_0x205fab=util[_0x46c5('0x23')](_0x46c5('0x64'),_0x1331c0[_0x46c5('0x53')],_0x14b509['id']);}logger[_0x46c5('0x29')](_0x46c5('0x55'),_0x46c5('0x65'));emit(util[_0x46c5('0x23')](_0x46c5('0x66'),_0x190b3b['name']),_0x46c5('0x67'),{'uri':_0x205fab});})['catch'](function(_0x267fb7){logger[_0x46c5('0x68')](_0x46c5('0x55'),JSON[_0x46c5('0x21')](_0x267fb7));});};exports[_0x46c5('0x69')]=function(_0x489e3b,_0x4e8a6d,_0x1e7324,_0x2c1658,_0x1dd1a7,_0x2279e0,_0x444dd1){var _0x16befd,_0x55725b,_0x9cd1d5,_0x2450b4;_0x2279e0[_0x46c5('0x53')]=intUtil[_0x46c5('0x6a')](_0x2279e0[_0x46c5('0x53')]);_0x2279e0[_0x46c5('0x59')]=intUtil['stripTrailingSlash'](_0x2279e0[_0x46c5('0x59')]);def[_0x46c5('0x51')]=util[_0x46c5('0x23')](_0x46c5('0x52'),_0x2279e0['remoteUri']);if(_0x444dd1&&_0x444dd1['recordingFormat']&&_0x444dd1[_0x46c5('0x6b')]!=='none'){logger[_0x46c5('0x29')]('[OUTBOUND]',_0x46c5('0x56'));_0x4e8a6d['recordingURL']=util[_0x46c5('0x23')](_0x46c5('0x58'),_0x2279e0[_0x46c5('0x59')],_0x4e8a6d['uniqueid'],md5(_0x4e8a6d[_0x46c5('0x5a')]));}return getConnection(_0x2279e0)[_0x46c5('0x2d')](function(_0x3aaf6f){_0x2450b4=_0x3aaf6f;return getUser(_0x2279e0,_0x2c1658[_0x46c5('0xf')],_0x2450b4);})['then'](function(_0x2844b1){_0x16befd=_0x2844b1;logger[_0x46c5('0x29')](_0x46c5('0x6c'),_0x16befd['id']);return getEndUser(_0x2279e0,_0x4e8a6d['destcalleridname'],_0x4e8a6d[_0x46c5('0x6d')],_0x2450b4);})[_0x46c5('0x2d')](function(_0x3e5f10){_0x55725b=_0x3e5f10;logger[_0x46c5('0x29')](_0x46c5('0x5c'),_0x55725b['id']);return getTicket(_0x2279e0,_0x16befd,_0x55725b,_0x1e7324,_0x4e8a6d,_0x1e7324[_0x46c5('0x5d')],_0x2450b4,_0x46c5('0x6e'));})[_0x46c5('0x2d')](function(_0x1f1936){_0x9cd1d5=_0x1f1936;logger[_0x46c5('0x29')](_0x46c5('0x5f'));logger[_0x46c5('0x29')](_0x46c5('0x60'),_0x9cd1d5['id']);return setRelationship(_0x2450b4,_0x16befd,_0x9cd1d5,'users');})[_0x46c5('0x2d')](function(){return setRelationship(_0x2450b4,_0x55725b,_0x9cd1d5,_0x46c5('0x62'));})[_0x46c5('0x2d')](function(){return getServerInfo(_0x2450b4);})[_0x46c5('0x2d')](function(_0x4e89c3){var _0x16da6c=parseInt(_0x4e89c3[_0x46c5('0x63')][_0x46c5('0x6f')](0x0));var _0x9781ff=util[_0x46c5('0x23')](_0x46c5('0x70'),_0x2279e0[_0x46c5('0x53')],_0x9cd1d5['id']);if(_0x16da6c>0x6){_0x9781ff=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2279e0[_0x46c5('0x53')],_0x9cd1d5['id']);}logger['info'](_0x46c5('0x71'),_0x46c5('0x65'));emit(util['format'](_0x46c5('0x66'),_0x2c1658[_0x46c5('0xf')]),'trigger:browser:url',{'uri':_0x9781ff});})['catch'](function(_0x2b74ea){logger[_0x46c5('0x68')]('[OUTBOUND]',JSON[_0x46c5('0x21')](_0x2b74ea));});};exports['unmanaged']=function(_0x5f2ee1,_0x2a7baa,_0x44787c,_0x14c21b,_0x527664,_0x38dc98){var _0x309e36,_0x3589d7,_0x4eb008,_0x2ad57a;_0x38dc98[_0x46c5('0x53')]=intUtil['stripTrailingSlash'](_0x38dc98['remoteUri']);_0x38dc98[_0x46c5('0x59')]=intUtil[_0x46c5('0x6a')](_0x38dc98['serverUrl']);def[_0x46c5('0x51')]=util['format'](_0x46c5('0x52'),_0x38dc98['remoteUri']);if(_0x527664&&_0x527664[_0x46c5('0x54')]){logger[_0x46c5('0x29')]('['+_0x2a7baa[_0x46c5('0x72')][_0x46c5('0x73')]()+']',_0x46c5('0x56'));_0x2a7baa[_0x46c5('0x57')]=util[_0x46c5('0x23')](_0x46c5('0x58'),_0x38dc98[_0x46c5('0x59')],_0x2a7baa['uniqueid'],md5(_0x2a7baa[_0x46c5('0x5a')]));}else{_0x2a7baa['recordingURL']='';}return getConnection(_0x38dc98)[_0x46c5('0x2d')](function(_0x4cc3cb){_0x2ad57a=_0x4cc3cb;if(!_[_0x46c5('0x28')](_0x14c21b)){return getUser(_0x38dc98,_0x14c21b[_0x46c5('0xf')],_0x2ad57a);}else{return getUser(_0x38dc98,null,_0x2ad57a);}})[_0x46c5('0x2d')](function(_0x11a2c6){_0x309e36=_0x11a2c6;logger[_0x46c5('0x29')](_0x46c5('0x6c'),_0x309e36['id']);return getEndUser(_0x38dc98,_0x2a7baa['calleridname'],_0x2a7baa[_0x46c5('0x5b')],_0x2ad57a);})[_0x46c5('0x2d')](function(_0x1e41d1){_0x3589d7=_0x1e41d1;logger[_0x46c5('0x29')](_0x46c5('0x5c'),_0x3589d7['id']);return getTicket(_0x38dc98,_0x309e36,_0x3589d7,_0x44787c,_0x2a7baa,_0x44787c[_0x46c5('0x5d')],_0x2ad57a,_0x46c5('0x5e'));})['then'](function(_0x2aaf3d){_0x4eb008=_0x2aaf3d;logger[_0x46c5('0x29')](_0x46c5('0x5f'));logger[_0x46c5('0x29')](_0x46c5('0x60'),_0x4eb008['id']);return setRelationship(_0x2ad57a,_0x309e36,_0x4eb008,_0x46c5('0x61'));})['then'](function(){return setRelationship(_0x2ad57a,_0x3589d7,_0x4eb008,_0x46c5('0x62'));})[_0x46c5('0x2d')](function(){return getServerInfo(_0x2ad57a);})[_0x46c5('0x74')](function(_0x28804f){logger[_0x46c5('0x68')]('['+_0x2a7baa[_0x46c5('0x72')][_0x46c5('0x73')]()+']',JSON[_0x46c5('0x21')](_0x28804f));});}; \ 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 090624a..e52341d 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 _0x79c7=['string','content','type','variableName','toString','customVariable','Variable','name','toLowerCase','push','keyValue','keyType','format','key','variable','%s:\x20%s','join','stripTrailingSlash','slice','substring','validateEmail','isNil','lodash','util','getString','length','sortBy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79c7,0xee));var _0x779c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79c7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x779c('0x0'));var util=require(_0x779c('0x1'));exports[_0x779c('0x2')]=function(_0x139043,_0x58ad79,_0x2b9c8c){var _0x4ce7d2=[];if(_0x139043[_0x779c('0x3')]>0x0){var _0x5ddee6=_[_0x779c('0x4')](_0x139043,['id']);for(var _0x5cf775=0x0;_0x5cf775<_0x5ddee6[_0x779c('0x3')];_0x5cf775++){var _0x5db629=_0x5ddee6[_0x5cf775];if(_0x5db629['type']===_0x779c('0x5')){_0x4ce7d2['push'](_0x5db629[_0x779c('0x6')]);}else if(_0x5db629[_0x779c('0x7')]==='variable'&&_0x5db629[_0x779c('0x8')]){_0x58ad79[_0x5db629[_0x779c('0x8')]]&&_0x4ce7d2['push'](_0x58ad79[_0x5db629[_0x779c('0x8')]][_0x779c('0x9')]());}else if(_0x5db629[_0x779c('0x7')]===_0x779c('0xa')&&_0x5db629[_0x779c('0xb')]&&_0x5db629['Variable'][_0x779c('0xc')]){_0x58ad79[_0x5db629[_0x779c('0xb')][_0x779c('0xc')][_0x779c('0xd')]()]&&_0x4ce7d2[_0x779c('0xe')](_0x58ad79[_0x5db629['Variable']['name'][_0x779c('0xd')]()]['toString']());}else if(_0x5db629[_0x779c('0x7')]===_0x779c('0xf')){if(_0x5db629[_0x779c('0x10')]===_0x779c('0x5')&&_0x5db629['key']){_0x4ce7d2[_0x779c('0xe')](util[_0x779c('0x11')]('%s:\x20%s',_0x5db629[_0x779c('0x12')],_0x5db629['keyContent']));}else if(_0x5db629[_0x779c('0x10')]===_0x779c('0x13')&&_0x5db629[_0x779c('0x8')]&&_0x5db629[_0x779c('0x12')]){_0x58ad79[_0x5db629[_0x779c('0x8')]]&&_0x4ce7d2['push'](util[_0x779c('0x11')](_0x779c('0x14'),_0x5db629['key'],_0x58ad79[_0x5db629['variableName']]));}else if(_0x5db629[_0x779c('0x10')]===_0x779c('0xa')&&_0x5db629[_0x779c('0xb')]&&_0x5db629['Variable'][_0x779c('0xc')]&&_0x5db629[_0x779c('0x12')]){_0x58ad79[_0x5db629['Variable'][_0x779c('0xc')][_0x779c('0xd')]()]&&_0x4ce7d2['push'](util['format'](_0x779c('0x14'),_0x5db629[_0x779c('0x12')],_0x58ad79[_0x5db629[_0x779c('0xb')]['name'][_0x779c('0xd')]()]));}}}}return _0x4ce7d2[_0x779c('0x15')](_0x2b9c8c);};exports[_0x779c('0x16')]=function(_0x5c41a6){var _0x35f7d7=_0x5c41a6[_0x779c('0x17')](-0x1);if(_0x35f7d7==='/'){_0x5c41a6=_0x5c41a6[_0x779c('0x18')](0x0,_0x5c41a6['lastIndexOf'](_0x35f7d7));}return _0x5c41a6;};exports[_0x779c('0x19')]=function(_0x4f2847){if(!_[_0x779c('0x1a')](_0x4f2847)&&_0x4f2847!==''){var _0x434610=/^(([^<>()\[\]\\.,;:\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 _0x434610['test'](String(_0x4f2847)[_0x779c('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xa9dc=['push','content','type','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','customVariable','join','slice','substring','lastIndexOf','validateEmail','isNil','test','length','sortBy'];(function(_0x2e2051,_0x2a998b){var _0x4dd8e6=function(_0x5b4b90){while(--_0x5b4b90){_0x2e2051['push'](_0x2e2051['shift']());}};_0x4dd8e6(++_0x2a998b);}(_0xa9dc,0x136));var _0xca9d=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0xa9dc[_0x591cfd];return _0x4d0100;};'use strict';var _=require('lodash');var util=require('util');exports['getString']=function(_0x16c505,_0x3bf543,_0x1cf5c2){var _0x1d122f=[];if(_0x16c505[_0xca9d('0x0')]>0x0){var _0x58d6bb=_[_0xca9d('0x1')](_0x16c505,['id']);for(var _0xef114e=0x0;_0xef114e<_0x58d6bb[_0xca9d('0x0')];_0xef114e++){var _0xa1755e=_0x58d6bb[_0xef114e];if(_0xa1755e['type']==='string'){_0x1d122f[_0xca9d('0x2')](_0xa1755e[_0xca9d('0x3')]);}else if(_0xa1755e[_0xca9d('0x4')]===_0xca9d('0x5')&&_0xa1755e[_0xca9d('0x6')]){_0x3bf543[_0xa1755e[_0xca9d('0x6')]]&&_0x1d122f[_0xca9d('0x2')](_0x3bf543[_0xa1755e[_0xca9d('0x6')]][_0xca9d('0x7')]());}else if(_0xa1755e[_0xca9d('0x4')]==='customVariable'&&_0xa1755e[_0xca9d('0x8')]&&_0xa1755e[_0xca9d('0x8')]['name']){_0x3bf543[_0xa1755e['Variable'][_0xca9d('0x9')][_0xca9d('0xa')]()]&&_0x1d122f[_0xca9d('0x2')](_0x3bf543[_0xa1755e['Variable'][_0xca9d('0x9')][_0xca9d('0xa')]()][_0xca9d('0x7')]());}else if(_0xa1755e[_0xca9d('0x4')]===_0xca9d('0xb')){if(_0xa1755e[_0xca9d('0xc')]===_0xca9d('0xd')&&_0xa1755e[_0xca9d('0xe')]){_0x1d122f[_0xca9d('0x2')](util[_0xca9d('0xf')](_0xca9d('0x10'),_0xa1755e[_0xca9d('0xe')],_0xa1755e[_0xca9d('0x11')]));}else if(_0xa1755e[_0xca9d('0xc')]===_0xca9d('0x5')&&_0xa1755e['variableName']&&_0xa1755e[_0xca9d('0xe')]){_0x3bf543[_0xa1755e['variableName']]&&_0x1d122f[_0xca9d('0x2')](util[_0xca9d('0xf')](_0xca9d('0x10'),_0xa1755e['key'],_0x3bf543[_0xa1755e[_0xca9d('0x6')]]));}else if(_0xa1755e['keyType']===_0xca9d('0x12')&&_0xa1755e[_0xca9d('0x8')]&&_0xa1755e['Variable'][_0xca9d('0x9')]&&_0xa1755e[_0xca9d('0xe')]){_0x3bf543[_0xa1755e['Variable'][_0xca9d('0x9')][_0xca9d('0xa')]()]&&_0x1d122f[_0xca9d('0x2')](util[_0xca9d('0xf')]('%s:\x20%s',_0xa1755e[_0xca9d('0xe')],_0x3bf543[_0xa1755e['Variable']['name'][_0xca9d('0xa')]()]));}}}}return _0x1d122f[_0xca9d('0x13')](_0x1cf5c2);};exports['stripTrailingSlash']=function(_0x579dd1){var _0x32967e=_0x579dd1[_0xca9d('0x14')](-0x1);if(_0x32967e==='/'){_0x579dd1=_0x579dd1[_0xca9d('0x15')](0x0,_0x579dd1[_0xca9d('0x16')](_0x32967e));}return _0x579dd1;};exports[_0xca9d('0x17')]=function(_0x2294cf){if(!_[_0xca9d('0x18')](_0x2294cf)&&_0x2294cf!==''){var _0x2f08a8=/^(([^<>()\[\]\\.,;:\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 _0x2f08a8[_0xca9d('0x19')](String(_0x2294cf)[_0xca9d('0xa')]());}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 77034eb..711c2fe 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 _0x2085=['toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','resolve','result','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','info','Getting\x20agent\x20with\x20email','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','success','Agent\x20found!','email1','last_name','userId','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','Searching\x20end\x20user\x20with\x20phone','GET','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','unmanaged','calleridnum'];(function(_0x3ddf06,_0x551297){var _0x3c00c1=function(_0x3b0ff6){while(--_0x3b0ff6){_0x3ddf06['push'](_0x3ddf06['shift']());}};_0x3c00c1(++_0x551297);}(_0x2085,0x13f));var _0x5208=function(_0x3c62ef,_0x4bb6ab){_0x3c62ef=_0x3c62ef-0x0;var _0x4d44f1=_0x2085[_0x3c62ef];return _0x4d44f1;};'use strict';var _=require(_0x5208('0x0'));var rp=require(_0x5208('0x1'));var BPromise=require(_0x5208('0x2'));var md5=require(_0x5208('0x3'));var util=require(_0x5208('0x4'));var Redis=require(_0x5208('0x5'));var intUtil=require(_0x5208('0x6'));var config=require(_0x5208('0x7'));var logger=require('../../../../config/logger')(_0x5208('0x8'));config[_0x5208('0x9')]=_[_0x5208('0xa')](config[_0x5208('0x9')],{'host':_0x5208('0xb'),'port':0x18eb});var io=require(_0x5208('0xc'))(new Redis(config[_0x5208('0x9')]));function emit(_0x234b0b,_0x31dbb8,_0x54a8ce){io['to'](_0x234b0b)[_0x5208('0xd')](_0x31dbb8,_0x54a8ce);}function getCustomFields(_0x2a5c9f,_0xf2dcaa){var _0x201347={};if(_0x2a5c9f[_0x5208('0xe')]>0x0){_[_0x5208('0xf')](_0x2a5c9f,function(_0x5705ec){if(_[_0x5208('0x10')]([_0x5208('0x11'),_0x5208('0x12')],_0x5705ec[_0x5208('0x13')])&&_0x5705ec[_0x5208('0x14')]){_0x201347[_0x5705ec['idField']]=_0x5705ec['content'][_0x5208('0x15')]();}else if(_0x5705ec[_0x5208('0x13')]===_0x5208('0x16')&&_0x5705ec[_0x5208('0x17')]&&_0x5705ec[_0x5208('0x14')]&&_0xf2dcaa[_0x5705ec[_0x5208('0x17')]]){_0x201347[_0x5705ec['idField']]=_0xf2dcaa[_0x5705ec[_0x5208('0x17')]][_0x5208('0x15')]();}else if(_0x5705ec['type']===_0x5208('0x18')&&_0x5705ec[_0x5208('0x19')]&&_0x5705ec[_0x5208('0x19')][_0x5208('0x1a')]&&_0x5705ec['idField']&&_0xf2dcaa[_0x5705ec['Variable'][_0x5208('0x1a')][_0x5208('0x1b')]()]){_0x201347[_0x5705ec[_0x5208('0x14')]]=_0xf2dcaa[_0x5705ec[_0x5208('0x19')][_0x5208('0x1a')][_0x5208('0x1b')]()][_0x5208('0x15')]();}});}return _0x201347;}function createTicket(_0x100363,_0x141da2,_0x2f2a65,_0x2645cd,_0x46d472,_0x30d2e4,_0x3aa7d6){logger['info']('Creating\x20new\x20ticket...');var _0x466073=_[_0x5208('0x1c')]({'parent_id':'','assigned_user_id':_0x141da2['id'],'ticketpriorities':_0x5208('0x1d'),'ticketstatus':_0x5208('0x1e'),'ticket_title':intUtil[_0x5208('0x1f')](_0x2645cd[_0x5208('0x20')],_0x46d472,'\x20'),'description':intUtil[_0x5208('0x1f')](_0x2645cd[_0x5208('0x21')],_0x46d472,'\x0a'),'contact_id':_0x2f2a65['id']},getCustomFields(_0x30d2e4,_0x46d472));var _0x2b6598={'method':_0x5208('0x22'),'uri':util[_0x5208('0x23')](_0x5208('0x24'),_0x100363[_0x5208('0x25')]),'form':{'operation':_0x5208('0x26'),'username':_0x100363[_0x5208('0x27')],'sessionName':_0x3aa7d6[_0x5208('0x28')],'elementType':_0x5208('0x29'),'element':JSON[_0x5208('0x2a')](_0x466073)},'json':!![]};return request(_0x2b6598)['then'](function(_0x1ac0d3){if(_0x1ac0d3['success']){return BPromise[_0x5208('0x2b')]({'id':_0x1ac0d3[_0x5208('0x2c')]['id']});}else{throw new Error(util[_0x5208('0x23')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON['stringify'](_0x1ac0d3[_0x5208('0x2d')])));}})[_0x5208('0x2e')](function(_0x10bc36){var _0x4c3714=_0x10bc36[_0x5208('0x2f')]||0x1f4;logger[_0x5208('0x2d')](_0x5208('0x30'),'createTicket',_0x4c3714,JSON[_0x5208('0x2a')](_0x10bc36));});}function getUser(_0x5a07e1,_0x54c4fe,_0x2a95a1){if(intUtil['validateEmail'](_0x54c4fe)){logger[_0x5208('0x31')](_0x5208('0x32'),_0x54c4fe);return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x5a07e1['remoteUri']),'qs':{'operation':_0x5208('0x33'),'username':_0x5a07e1['username'],'sessionName':_0x2a95a1['sessionName'],'query':util[_0x5208('0x23')](_0x5208('0x34'),_0x54c4fe)},'json':!![]})[_0x5208('0x35')](function(_0x70bccf){if(_0x70bccf[_0x5208('0x36')]&&_0x70bccf[_0x5208('0x2c')][_0x5208('0xe')]){logger['info'](_0x5208('0x37'));return BPromise[_0x5208('0x2b')]({'id':_0x70bccf['result'][0x0]['id'],'email':_0x70bccf['result'][0x0][_0x5208('0x38')],'name':_0x70bccf[_0x5208('0x2c')][0x0]['first_name']+'\x20'+_0x70bccf['result'][_0x5208('0x39')]});}else{logger[_0x5208('0x31')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x2a95a1[_0x5208('0x3a')],'email':_0x5a07e1[_0x5208('0x27')],'name':'admin'});}})[_0x5208('0x2e')](function(_0x9f9bc2){var _0x3d7373=_0x9f9bc2[_0x5208('0x2f')]||0x1f4;logger[_0x5208('0x2d')](_0x5208('0x30'),'getUser',_0x3d7373,JSON[_0x5208('0x2a')](_0x9f9bc2));});}else{logger['info'](_0x5208('0x3b'));return BPromise[_0x5208('0x2b')]({'id':_0x2a95a1[_0x5208('0x3a')],'email':_0x5a07e1[_0x5208('0x27')],'name':_0x5208('0x3c')})[_0x5208('0x2e')](function(_0xbf49b3){var _0x25d6ed=_0xbf49b3[_0x5208('0x2f')]||0x1f4;logger[_0x5208('0x2d')](_0x5208('0x30'),'getUser',_0x25d6ed,JSON['stringify'](_0xbf49b3));});}}function getEndUser(_0x59c165,_0x3330c6,_0x4e2f0d,_0xf4a545){logger[_0x5208('0x31')](_0x5208('0x3d'),_0x4e2f0d);return request({'method':_0x5208('0x3e'),'uri':util[_0x5208('0x23')](_0x5208('0x24'),_0x59c165[_0x5208('0x25')]),'qs':{'operation':'query','username':_0x59c165['username'],'sessionName':_0xf4a545[_0x5208('0x28')],'query':util['format'](_0x5208('0x3f'),_0x4e2f0d,_0x4e2f0d,_0x4e2f0d,_0x4e2f0d,_0x4e2f0d)},'json':!![]})['then'](function(_0x478d28){if(_0x478d28[_0x5208('0x36')]&&_0x478d28['result'][_0x5208('0xe')]){logger[_0x5208('0x31')](_0x5208('0x40'));return BPromise['resolve']({'id':_0x478d28[_0x5208('0x2c')][0x0]['id'],'name':_0x478d28[_0x5208('0x2c')][0x0][_0x5208('0x41')]+'\x20'+_0x478d28[_0x5208('0x2c')][0x0][_0x5208('0x42')],'phone':_0x4e2f0d});}else{logger[_0x5208('0x31')](_0x5208('0x43'));return request({'method':_0x5208('0x22'),'uri':util[_0x5208('0x23')](_0x5208('0x24'),_0x59c165[_0x5208('0x25')]),'form':{'operation':_0x5208('0x26'),'sessionName':_0xf4a545[_0x5208('0x28')],'elementType':_0x5208('0x44'),'element':JSON[_0x5208('0x2a')]({'lastname':_0x3330c6,'phone':_0x4e2f0d,'assigned_user_id':'\x20'})},'json':!![]})[_0x5208('0x35')](function(_0x213cae){logger[_0x5208('0x31')](_0x5208('0x45'));return BPromise[_0x5208('0x2b')]({'id':_0x213cae[_0x5208('0x2c')]['id'],'name':_0x213cae[_0x5208('0x2c')][_0x5208('0x42')],'phone':_0x213cae[_0x5208('0x2c')][_0x5208('0x46')]});})[_0x5208('0x2e')](function(_0x2a1e87){var _0x433711=_0x2a1e87['statusCode']||0x1f4;logger[_0x5208('0x2d')](_0x5208('0x30'),_0x5208('0x47'),_0x433711,JSON['stringify'](_0x2a1e87));});}});}function getConnection(_0x183977){var _0xfe22af=_0x183977['username'];var _0x1fbe5e=_0x183977['accessKey'];return request({'method':_0x5208('0x3e'),'uri':util[_0x5208('0x23')]('%s/webservice.php',_0x183977['remoteUri']),'qs':{'operation':_0x5208('0x48'),'username':_0xfe22af},'json':!![]})[_0x5208('0x35')](function(_0x8a8c16){if(_0x8a8c16[_0x5208('0x36')]){return request({'method':_0x5208('0x22'),'uri':util[_0x5208('0x23')](_0x5208('0x24'),_0x183977[_0x5208('0x25')]),'form':{'operation':_0x5208('0x49'),'username':_0xfe22af,'accessKey':md5(_0x8a8c16[_0x5208('0x2c')][_0x5208('0x4a')]+_0x1fbe5e)},'json':!![]});}})[_0x5208('0x35')](function(_0x4190da){if(_0x4190da['success']){return BPromise['resolve'](_0x4190da[_0x5208('0x2c')]);}else{throw new Error(util['format'](_0x5208('0x4b'),_0x183977['id']));}})[_0x5208('0x2e')](function(_0x413a03){var _0x40d6bf=_0x413a03[_0x5208('0x2f')]||0x1f4;logger[_0x5208('0x2d')](_0x5208('0x30'),_0x5208('0x4c'),_0x40d6bf,JSON[_0x5208('0x2a')](_0x413a03));});}function request(_0x3f80a9){logger['info'](_0x5208('0x4d'),JSON[_0x5208('0x2a')](_0x3f80a9));return rp(_0x3f80a9);}exports[_0x5208('0x4e')]=function(_0x2fb52d,_0x2e4b60,_0x2b5262,_0x50f5d4,_0x388b81,_0x41f58c){var _0x5a4ae3,_0x5748d7,_0x19898b,_0x4b7463;_0x41f58c[_0x5208('0x25')]=intUtil['stripTrailingSlash'](_0x41f58c[_0x5208('0x25')]);if(_0x388b81&&_0x388b81[_0x5208('0x4f')]){logger[_0x5208('0x31')]('[QUEUE]',_0x5208('0x50'));_0x2e4b60['recordingURL']=util[_0x5208('0x23')](_0x5208('0x51'),_0x41f58c[_0x5208('0x52')],_0x2e4b60['uniqueid'],md5(_0x2e4b60[_0x5208('0x53')]));}else{_0x2e4b60[_0x5208('0x54')]='';}return getConnection(_0x41f58c)[_0x5208('0x35')](function(_0xcfdcdf){_0x4b7463=_0xcfdcdf;return getUser(_0x41f58c,_0x50f5d4['email'],_0x4b7463);})[_0x5208('0x35')](function(_0x212a68){_0x5a4ae3=_0x212a68;logger[_0x5208('0x31')](_0x5208('0x55'),_0x5a4ae3['id']);return getEndUser(_0x41f58c,_0x2e4b60[_0x5208('0x56')],_0x2e4b60['calleridnum'],_0x4b7463);})['then'](function(_0x13c1ba){_0x5748d7=_0x13c1ba;logger[_0x5208('0x31')](_0x5208('0x57'),_0x5748d7['id']);return createTicket(_0x41f58c,_0x5a4ae3,_0x5748d7,_0x2b5262,_0x2e4b60,_0x2b5262[_0x5208('0x58')],_0x4b7463);})['then'](function(_0x8cfcd2){_0x19898b=_0x8cfcd2;logger[_0x5208('0x31')]('Ticket\x20created!');logger[_0x5208('0x31')](_0x5208('0x59'),_0x19898b['id']);var _0x26426c=util[_0x5208('0x23')](_0x5208('0x5a'),_0x41f58c['remoteUri'],_[_0x5208('0x5b')](_0x19898b['id'],'x')[0x1]);logger[_0x5208('0x31')](_0x5208('0x5c'),_0x5208('0x5d'));emit(util[_0x5208('0x23')](_0x5208('0x5e'),_0x50f5d4['name']),_0x5208('0x5f'),{'uri':_0x26426c});})[_0x5208('0x2e')](function(_0x34a303){logger[_0x5208('0x2d')](_0x5208('0x5c'),JSON[_0x5208('0x2a')](_0x34a303));});};exports[_0x5208('0x60')]=function(_0x6dfaff,_0x1152d8,_0x29ca26,_0x38e475,_0x4d18b5,_0x53af25,_0x474f6f){var _0x2ca702,_0x5f2dc4,_0x1a5283,_0x4d1e49;_0x53af25[_0x5208('0x25')]=intUtil[_0x5208('0x61')](_0x53af25[_0x5208('0x25')]);_0x53af25[_0x5208('0x52')]=intUtil[_0x5208('0x61')](_0x53af25[_0x5208('0x52')]);if(_0x474f6f&&_0x474f6f[_0x5208('0x62')]&&_0x474f6f[_0x5208('0x62')]!==_0x5208('0x63')){logger[_0x5208('0x31')](_0x5208('0x64'),'Recording\x20is\x20enabled!');_0x1152d8[_0x5208('0x54')]=util['format'](_0x5208('0x51'),_0x53af25[_0x5208('0x52')],_0x1152d8[_0x5208('0x53')],md5(_0x1152d8[_0x5208('0x53')]));}return getConnection(_0x53af25)[_0x5208('0x35')](function(_0x5e7310){_0x4d1e49=_0x5e7310;return getUser(_0x53af25,_0x38e475['email'],_0x4d1e49);})['then'](function(_0x2d22b7){_0x2ca702=_0x2d22b7;logger[_0x5208('0x31')](_0x5208('0x55'),_0x2ca702['id']);return getEndUser(_0x53af25,_0x1152d8[_0x5208('0x65')],_0x1152d8[_0x5208('0x66')],_0x4d1e49);})[_0x5208('0x35')](function(_0x13e3bb){_0x5f2dc4=_0x13e3bb;logger[_0x5208('0x31')](_0x5208('0x57'),_0x5f2dc4['id']);return createTicket(_0x53af25,_0x2ca702,_0x5f2dc4,_0x29ca26,_0x1152d8,_0x29ca26[_0x5208('0x58')],_0x4d1e49);})[_0x5208('0x35')](function(_0x292915){_0x1a5283=_0x292915;logger[_0x5208('0x31')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x1a5283['id']);var _0x4a562c=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x53af25[_0x5208('0x25')],_[_0x5208('0x5b')](_0x1a5283['id'],'x')[0x1]);logger['info'](_0x5208('0x64'),_0x5208('0x5d'));emit(util[_0x5208('0x23')](_0x5208('0x5e'),_0x38e475[_0x5208('0x1a')]),_0x5208('0x5f'),{'uri':_0x4a562c});})['catch'](function(_0x2978b7){logger[_0x5208('0x2d')](_0x5208('0x64'),JSON['stringify'](_0x2978b7));});};exports[_0x5208('0x67')]=function(_0x1b780f,_0x141534,_0x17be2d,_0x3386ea,_0xeb28dc,_0x3213a2){var _0x411fb5,_0x2218fd,_0x4e13f4,_0x37f1ec;_0x3213a2[_0x5208('0x25')]=intUtil[_0x5208('0x61')](_0x3213a2[_0x5208('0x25')]);_0x3213a2[_0x5208('0x52')]=intUtil[_0x5208('0x61')](_0x3213a2[_0x5208('0x52')]);if(_0xeb28dc&&_0xeb28dc[_0x5208('0x4f')]){logger[_0x5208('0x31')]('['+_0x141534['lastevent']['toUpperCase']()+']',_0x5208('0x50'));_0x141534[_0x5208('0x54')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3213a2[_0x5208('0x52')],_0x141534[_0x5208('0x53')],md5(_0x141534[_0x5208('0x53')]));}else{_0x141534['recordingURL']='';}return getConnection(_0x3213a2)[_0x5208('0x35')](function(_0x43d4f9){_0x37f1ec=_0x43d4f9;return getUser(_0x3213a2,'',_0x37f1ec);})['then'](function(_0x7e37b){_0x411fb5=_0x7e37b;logger[_0x5208('0x31')](_0x5208('0x55'),_0x411fb5['id']);return getEndUser(_0x3213a2,_0x141534[_0x5208('0x56')],_0x141534[_0x5208('0x68')],_0x37f1ec);})[_0x5208('0x35')](function(_0x354695){_0x2218fd=_0x354695;logger[_0x5208('0x31')](_0x5208('0x57'),_0x2218fd['id']);return createTicket(_0x3213a2,_0x411fb5,_0x2218fd,_0x17be2d,_0x141534,_0x17be2d[_0x5208('0x58')],_0x37f1ec);})['then'](function(_0x59b2ee){_0x4e13f4=_0x59b2ee;logger[_0x5208('0x31')]('Ticket\x20created!');logger[_0x5208('0x31')](_0x5208('0x59'),_0x4e13f4['id']);})[_0x5208('0x2e')](function(_0x5ec08a){logger[_0x5208('0x2d')]('['+_0x141534['lastevent'][_0x5208('0x69')]()+']',JSON[_0x5208('0x2a')](_0x5ec08a));});}; \ No newline at end of file +var _0xeb3b=['outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','../../../../config/environment','vTiger','defaults','redis','localhost','socket.io-emitter','emit','length','forEach','includes','string','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','info','Open','getString','Subjects','Descriptions','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','createTicket','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','statusCode','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!','POST','Enduser\x20created.','phone','GET','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','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'];(function(_0x4d4b5d,_0x125422){var _0x43a9c2=function(_0x244967){while(--_0x244967){_0x4d4b5d['push'](_0x4d4b5d['shift']());}};_0x43a9c2(++_0x125422);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x45977c,_0x7eaed0){_0x45977c=_0x45977c-0x0;var _0x399413=_0xeb3b[_0x45977c];return _0x399413;};'use strict';var _=require(_0xbeb3('0x0'));var rp=require(_0xbeb3('0x1'));var BPromise=require(_0xbeb3('0x2'));var md5=require(_0xbeb3('0x3'));var util=require(_0xbeb3('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xbeb3('0x5'));var logger=require('../../../../config/logger')(_0xbeb3('0x6'));config['redis']=_[_0xbeb3('0x7')](config[_0xbeb3('0x8')],{'host':_0xbeb3('0x9'),'port':0x18eb});var io=require(_0xbeb3('0xa'))(new Redis(config[_0xbeb3('0x8')]));function emit(_0x143255,_0x5a6a06,_0x241dbb){io['to'](_0x143255)[_0xbeb3('0xb')](_0x5a6a06,_0x241dbb);}function getCustomFields(_0x2a029e,_0x3b61ac){var _0x443396={};if(_0x2a029e[_0xbeb3('0xc')]>0x0){_[_0xbeb3('0xd')](_0x2a029e,function(_0x567333){if(_[_0xbeb3('0xe')]([_0xbeb3('0xf'),'picklist'],_0x567333[_0xbeb3('0x10')])&&_0x567333[_0xbeb3('0x11')]){_0x443396[_0x567333[_0xbeb3('0x11')]]=_0x567333[_0xbeb3('0x12')][_0xbeb3('0x13')]();}else if(_0x567333[_0xbeb3('0x10')]==='variable'&&_0x567333['variableName']&&_0x567333[_0xbeb3('0x11')]&&_0x3b61ac[_0x567333[_0xbeb3('0x14')]]){_0x443396[_0x567333['idField']]=_0x3b61ac[_0x567333['variableName']][_0xbeb3('0x13')]();}else if(_0x567333[_0xbeb3('0x10')]===_0xbeb3('0x15')&&_0x567333[_0xbeb3('0x16')]&&_0x567333[_0xbeb3('0x16')]['name']&&_0x567333[_0xbeb3('0x11')]&&_0x3b61ac[_0x567333['Variable'][_0xbeb3('0x17')]['toLowerCase']()]){_0x443396[_0x567333['idField']]=_0x3b61ac[_0x567333['Variable'][_0xbeb3('0x17')][_0xbeb3('0x18')]()][_0xbeb3('0x13')]();}});}return _0x443396;}function createTicket(_0x10b15d,_0x5d0689,_0x233a62,_0x821d92,_0xe2cc47,_0x495c0a,_0x4af96f){logger[_0xbeb3('0x19')]('Creating\x20new\x20ticket...');var _0x1d917b=_['merge']({'parent_id':'','assigned_user_id':_0x5d0689['id'],'ticketpriorities':'Normal','ticketstatus':_0xbeb3('0x1a'),'ticket_title':intUtil[_0xbeb3('0x1b')](_0x821d92[_0xbeb3('0x1c')],_0xe2cc47,'\x20'),'description':intUtil['getString'](_0x821d92[_0xbeb3('0x1d')],_0xe2cc47,'\x0a'),'contact_id':_0x233a62['id']},getCustomFields(_0x495c0a,_0xe2cc47));var _0x18ea0f={'method':'POST','uri':util[_0xbeb3('0x1e')](_0xbeb3('0x1f'),_0x10b15d['remoteUri']),'form':{'operation':_0xbeb3('0x20'),'username':_0x10b15d[_0xbeb3('0x21')],'sessionName':_0x4af96f[_0xbeb3('0x22')],'elementType':_0xbeb3('0x23'),'element':JSON[_0xbeb3('0x24')](_0x1d917b)},'json':!![]};return request(_0x18ea0f)[_0xbeb3('0x25')](function(_0x84921a){if(_0x84921a[_0xbeb3('0x26')]){return BPromise[_0xbeb3('0x27')]({'id':_0x84921a['result']['id']});}else{throw new Error(util['format'](_0xbeb3('0x28'),JSON['stringify'](_0x84921a[_0xbeb3('0x29')])));}})[_0xbeb3('0x2a')](function(_0x138adf){var _0x400f65=_0x138adf['statusCode']||0x1f4;logger[_0xbeb3('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xbeb3('0x2b'),_0x400f65,JSON[_0xbeb3('0x24')](_0x138adf));});}function getUser(_0x5bd93d,_0x483198,_0x9b8f13){if(intUtil['validateEmail'](_0x483198)){logger['info']('Getting\x20agent\x20with\x20email',_0x483198);return request({'method':'GET','uri':util[_0xbeb3('0x1e')]('%s/webservice.php',_0x5bd93d[_0xbeb3('0x2c')]),'qs':{'operation':_0xbeb3('0x2d'),'username':_0x5bd93d[_0xbeb3('0x21')],'sessionName':_0x9b8f13[_0xbeb3('0x22')],'query':util[_0xbeb3('0x1e')](_0xbeb3('0x2e'),_0x483198)},'json':!![]})[_0xbeb3('0x25')](function(_0x30fcd4){if(_0x30fcd4[_0xbeb3('0x26')]&&_0x30fcd4[_0xbeb3('0x2f')]['length']){logger[_0xbeb3('0x19')](_0xbeb3('0x30'));return BPromise['resolve']({'id':_0x30fcd4[_0xbeb3('0x2f')][0x0]['id'],'email':_0x30fcd4[_0xbeb3('0x2f')][0x0][_0xbeb3('0x31')],'name':_0x30fcd4[_0xbeb3('0x2f')][0x0]['first_name']+'\x20'+_0x30fcd4[_0xbeb3('0x2f')][_0xbeb3('0x32')]});}else{logger[_0xbeb3('0x19')](_0xbeb3('0x33'));return BPromise[_0xbeb3('0x27')]({'id':_0x9b8f13[_0xbeb3('0x34')],'email':_0x5bd93d[_0xbeb3('0x21')],'name':_0xbeb3('0x35')});}})[_0xbeb3('0x2a')](function(_0x4d0cf3){var _0x106629=_0x4d0cf3['statusCode']||0x1f4;logger[_0xbeb3('0x29')](_0xbeb3('0x36'),_0xbeb3('0x37'),_0x106629,JSON[_0xbeb3('0x24')](_0x4d0cf3));});}else{logger[_0xbeb3('0x19')](_0xbeb3('0x33'));return BPromise[_0xbeb3('0x27')]({'id':_0x9b8f13[_0xbeb3('0x34')],'email':_0x5bd93d['username'],'name':_0xbeb3('0x35')})['catch'](function(_0x59e6df){var _0x547275=_0x59e6df[_0xbeb3('0x38')]||0x1f4;logger[_0xbeb3('0x29')](_0xbeb3('0x36'),_0xbeb3('0x37'),_0x547275,JSON[_0xbeb3('0x24')](_0x59e6df));});}}function getEndUser(_0x40f166,_0x4aefe0,_0x32db2d,_0x40de8d){logger[_0xbeb3('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x32db2d);return request({'method':'GET','uri':util['format'](_0xbeb3('0x1f'),_0x40f166[_0xbeb3('0x2c')]),'qs':{'operation':_0xbeb3('0x2d'),'username':_0x40f166['username'],'sessionName':_0x40de8d[_0xbeb3('0x22')],'query':util['format'](_0xbeb3('0x39'),_0x32db2d,_0x32db2d,_0x32db2d,_0x32db2d,_0x32db2d)},'json':!![]})[_0xbeb3('0x25')](function(_0x12156b){if(_0x12156b[_0xbeb3('0x26')]&&_0x12156b['result']['length']){logger[_0xbeb3('0x19')](_0xbeb3('0x3a'));return BPromise[_0xbeb3('0x27')]({'id':_0x12156b[_0xbeb3('0x2f')][0x0]['id'],'name':_0x12156b[_0xbeb3('0x2f')][0x0][_0xbeb3('0x3b')]+'\x20'+_0x12156b[_0xbeb3('0x2f')][0x0][_0xbeb3('0x3c')],'phone':_0x32db2d});}else{logger['info'](_0xbeb3('0x3d'));return request({'method':_0xbeb3('0x3e'),'uri':util[_0xbeb3('0x1e')](_0xbeb3('0x1f'),_0x40f166[_0xbeb3('0x2c')]),'form':{'operation':_0xbeb3('0x20'),'sessionName':_0x40de8d[_0xbeb3('0x22')],'elementType':'Contacts','element':JSON[_0xbeb3('0x24')]({'lastname':_0x4aefe0,'phone':_0x32db2d,'assigned_user_id':'\x20'})},'json':!![]})[_0xbeb3('0x25')](function(_0x10a356){logger[_0xbeb3('0x19')](_0xbeb3('0x3f'));return BPromise[_0xbeb3('0x27')]({'id':_0x10a356[_0xbeb3('0x2f')]['id'],'name':_0x10a356[_0xbeb3('0x2f')][_0xbeb3('0x3c')],'phone':_0x10a356[_0xbeb3('0x2f')][_0xbeb3('0x40')]});})[_0xbeb3('0x2a')](function(_0x2a229c){var _0x4d14a6=_0x2a229c[_0xbeb3('0x38')]||0x1f4;logger[_0xbeb3('0x29')](_0xbeb3('0x36'),'getEndUser',_0x4d14a6,JSON['stringify'](_0x2a229c));});}});}function getConnection(_0x7985d3){var _0x472adf=_0x7985d3[_0xbeb3('0x21')];var _0xf0fcd6=_0x7985d3['accessKey'];return request({'method':_0xbeb3('0x41'),'uri':util['format']('%s/webservice.php',_0x7985d3[_0xbeb3('0x2c')]),'qs':{'operation':_0xbeb3('0x42'),'username':_0x472adf},'json':!![]})[_0xbeb3('0x25')](function(_0x8eaebd){if(_0x8eaebd['success']){return request({'method':_0xbeb3('0x3e'),'uri':util[_0xbeb3('0x1e')](_0xbeb3('0x1f'),_0x7985d3['remoteUri']),'form':{'operation':_0xbeb3('0x43'),'username':_0x472adf,'accessKey':md5(_0x8eaebd['result']['token']+_0xf0fcd6)},'json':!![]});}})[_0xbeb3('0x25')](function(_0xf8e19d){if(_0xf8e19d[_0xbeb3('0x26')]){return BPromise['resolve'](_0xf8e19d[_0xbeb3('0x2f')]);}else{throw new Error(util[_0xbeb3('0x1e')](_0xbeb3('0x44'),_0x7985d3['id']));}})['catch'](function(_0x2cda0d){var _0x4e74bc=_0x2cda0d[_0xbeb3('0x38')]||0x1f4;logger['error'](_0xbeb3('0x36'),_0xbeb3('0x45'),_0x4e74bc,JSON[_0xbeb3('0x24')](_0x2cda0d));});}function request(_0x3b48e2){logger[_0xbeb3('0x19')](_0xbeb3('0x46'),JSON[_0xbeb3('0x24')](_0x3b48e2));return rp(_0x3b48e2);}exports[_0xbeb3('0x47')]=function(_0x49fded,_0xde022c,_0x2416c0,_0xa852bb,_0x459452,_0x5dd175){var _0x2771e3,_0x17aa74,_0x3f30eb,_0x2c677d;_0x5dd175['remoteUri']=intUtil[_0xbeb3('0x48')](_0x5dd175['remoteUri']);if(_0x459452&&_0x459452[_0xbeb3('0x49')]){logger[_0xbeb3('0x19')](_0xbeb3('0x4a'),'Recording\x20is\x20enabled!');_0xde022c[_0xbeb3('0x4b')]=util[_0xbeb3('0x1e')](_0xbeb3('0x4c'),_0x5dd175[_0xbeb3('0x4d')],_0xde022c[_0xbeb3('0x4e')],md5(_0xde022c[_0xbeb3('0x4e')]));}else{_0xde022c[_0xbeb3('0x4b')]='';}return getConnection(_0x5dd175)[_0xbeb3('0x25')](function(_0x27024e){_0x2c677d=_0x27024e;return getUser(_0x5dd175,_0xa852bb[_0xbeb3('0x4f')],_0x2c677d);})['then'](function(_0x1fcc40){_0x2771e3=_0x1fcc40;logger[_0xbeb3('0x19')](_0xbeb3('0x50'),_0x2771e3['id']);return getEndUser(_0x5dd175,_0xde022c[_0xbeb3('0x51')],_0xde022c[_0xbeb3('0x52')],_0x2c677d);})['then'](function(_0x556550){_0x17aa74=_0x556550;logger[_0xbeb3('0x19')](_0xbeb3('0x53'),_0x17aa74['id']);return createTicket(_0x5dd175,_0x2771e3,_0x17aa74,_0x2416c0,_0xde022c,_0x2416c0['Fields'],_0x2c677d);})[_0xbeb3('0x25')](function(_0x405354){_0x3f30eb=_0x405354;logger[_0xbeb3('0x19')](_0xbeb3('0x54'));logger[_0xbeb3('0x19')](_0xbeb3('0x55'),_0x3f30eb['id']);var _0x15128c=util['format'](_0xbeb3('0x56'),_0x5dd175[_0xbeb3('0x2c')],_[_0xbeb3('0x57')](_0x3f30eb['id'],'x')[0x1]);logger['info'](_0xbeb3('0x4a'),_0xbeb3('0x58'));emit(util['format'](_0xbeb3('0x59'),_0xa852bb[_0xbeb3('0x17')]),_0xbeb3('0x5a'),{'uri':_0x15128c});})[_0xbeb3('0x2a')](function(_0x49f941){logger['error'](_0xbeb3('0x4a'),JSON['stringify'](_0x49f941));});};exports[_0xbeb3('0x5b')]=function(_0x59f2e3,_0x2d36cb,_0x381b28,_0x2ce380,_0x1d9f1a,_0x9d523b,_0x1a53bd){var _0x394406,_0x448fe6,_0xc78a7a,_0x17718a;_0x9d523b[_0xbeb3('0x2c')]=intUtil[_0xbeb3('0x48')](_0x9d523b[_0xbeb3('0x2c')]);_0x9d523b[_0xbeb3('0x4d')]=intUtil[_0xbeb3('0x48')](_0x9d523b[_0xbeb3('0x4d')]);if(_0x1a53bd&&_0x1a53bd[_0xbeb3('0x5c')]&&_0x1a53bd[_0xbeb3('0x5c')]!=='none'){logger[_0xbeb3('0x19')](_0xbeb3('0x5d'),_0xbeb3('0x5e'));_0x2d36cb[_0xbeb3('0x4b')]=util[_0xbeb3('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x9d523b[_0xbeb3('0x4d')],_0x2d36cb['uniqueid'],md5(_0x2d36cb[_0xbeb3('0x4e')]));}return getConnection(_0x9d523b)[_0xbeb3('0x25')](function(_0x2c14d2){_0x17718a=_0x2c14d2;return getUser(_0x9d523b,_0x2ce380[_0xbeb3('0x4f')],_0x17718a);})[_0xbeb3('0x25')](function(_0x394524){_0x394406=_0x394524;logger[_0xbeb3('0x19')](_0xbeb3('0x50'),_0x394406['id']);return getEndUser(_0x9d523b,_0x2d36cb[_0xbeb3('0x5f')],_0x2d36cb[_0xbeb3('0x60')],_0x17718a);})[_0xbeb3('0x25')](function(_0x37a17e){_0x448fe6=_0x37a17e;logger[_0xbeb3('0x19')](_0xbeb3('0x53'),_0x448fe6['id']);return createTicket(_0x9d523b,_0x394406,_0x448fe6,_0x381b28,_0x2d36cb,_0x381b28[_0xbeb3('0x61')],_0x17718a);})[_0xbeb3('0x25')](function(_0x250ada){_0xc78a7a=_0x250ada;logger[_0xbeb3('0x19')](_0xbeb3('0x54'));logger[_0xbeb3('0x19')](_0xbeb3('0x55'),_0xc78a7a['id']);var _0x1dc478=util[_0xbeb3('0x1e')](_0xbeb3('0x56'),_0x9d523b[_0xbeb3('0x2c')],_[_0xbeb3('0x57')](_0xc78a7a['id'],'x')[0x1]);logger[_0xbeb3('0x19')](_0xbeb3('0x5d'),_0xbeb3('0x58'));emit(util[_0xbeb3('0x1e')](_0xbeb3('0x59'),_0x2ce380[_0xbeb3('0x17')]),_0xbeb3('0x5a'),{'uri':_0x1dc478});})[_0xbeb3('0x2a')](function(_0x29865f){logger[_0xbeb3('0x29')]('[OUTBOUND]',JSON[_0xbeb3('0x24')](_0x29865f));});};exports[_0xbeb3('0x62')]=function(_0x519dd9,_0x769a06,_0x1ad47f,_0x3a8eb3,_0x4cc279,_0x5cba9d){var _0x2c2784,_0x32c0ef,_0x30c796,_0xebc0bc;_0x5cba9d[_0xbeb3('0x2c')]=intUtil['stripTrailingSlash'](_0x5cba9d[_0xbeb3('0x2c')]);_0x5cba9d[_0xbeb3('0x4d')]=intUtil[_0xbeb3('0x48')](_0x5cba9d[_0xbeb3('0x4d')]);if(_0x4cc279&&_0x4cc279[_0xbeb3('0x49')]){logger['info']('['+_0x769a06[_0xbeb3('0x63')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x769a06[_0xbeb3('0x4b')]=util['format'](_0xbeb3('0x4c'),_0x5cba9d[_0xbeb3('0x4d')],_0x769a06[_0xbeb3('0x4e')],md5(_0x769a06[_0xbeb3('0x4e')]));}else{_0x769a06[_0xbeb3('0x4b')]='';}return getConnection(_0x5cba9d)[_0xbeb3('0x25')](function(_0x942394){_0xebc0bc=_0x942394;return getUser(_0x5cba9d,'',_0xebc0bc);})['then'](function(_0x28d9ea){_0x2c2784=_0x28d9ea;logger[_0xbeb3('0x19')](_0xbeb3('0x50'),_0x2c2784['id']);return getEndUser(_0x5cba9d,_0x769a06['calleridname'],_0x769a06['calleridnum'],_0xebc0bc);})[_0xbeb3('0x25')](function(_0x48da15){_0x32c0ef=_0x48da15;logger['info']('The\x20Enduser\x20ID\x20is:',_0x32c0ef['id']);return createTicket(_0x5cba9d,_0x2c2784,_0x32c0ef,_0x1ad47f,_0x769a06,_0x1ad47f[_0xbeb3('0x61')],_0xebc0bc);})[_0xbeb3('0x25')](function(_0x9df1c1){_0x30c796=_0x9df1c1;logger[_0xbeb3('0x19')]('Ticket\x20created!');logger['info'](_0xbeb3('0x55'),_0x30c796['id']);})[_0xbeb3('0x2a')](function(_0xa1fe36){logger['error']('['+_0x769a06['lastevent'][_0xbeb3('0x64')]()+']',JSON[_0xbeb3('0x24')](_0xa1fe36));});}; \ 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 d73e1f7..80e84dc 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 _0xf29b=['merge','Tags','name','getString','Subjects','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','%s/token:%s','token','base64','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','custom_fields','push','variableName','customField','toString','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','replace','unmanaged','toUpperCase','lastevent','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xf29b,0x138));var _0xbf29=function(_0x5b3efc,_0x37c8a7){_0x5b3efc=_0x5b3efc-0x0;var _0x5760f7=_0xf29b[_0x5b3efc];return _0x5760f7;};'use strict';var _=require(_0xbf29('0x0'));var rp=require(_0xbf29('0x1'));var md5=require(_0xbf29('0x2'));var util=require(_0xbf29('0x3'));var Redis=require(_0xbf29('0x4'));var intUtil=require('./util');var config=require(_0xbf29('0x5'));var logger=require(_0xbf29('0x6'))(_0xbf29('0x7'));config[_0xbf29('0x8')]=_[_0xbf29('0x9')](config[_0xbf29('0x8')],{'host':_0xbf29('0xa'),'port':0x18eb});var io=require(_0xbf29('0xb'))(new Redis(config[_0xbf29('0x8')]));function emit(_0x549404,_0x53b60b,_0x354341){io['to'](_0x549404)[_0xbf29('0xc')](_0x53b60b,_0x354341);}var headers={'Content-Type':'application/json','Accept':_0xbf29('0xd')};function getTicket(_0x23619a,_0x1cd1fb,_0x141feb,_0x5b41dc,_0x4e93a8){logger[_0xbf29('0xe')](_0xbf29('0xf'));return request({'uri':util[_0xbf29('0x10')]('%s/tickets.json',_0x23619a[_0xbf29('0x11')]),'method':'POST','body':{'ticket':_[_0xbf29('0x12')]({'requester_id':_0x141feb['id'],'submitter_id':_0x1cd1fb?_0x1cd1fb['id']:undefined,'assignee_id':_0x1cd1fb?_0x1cd1fb['id']:undefined,'tags':getTags(_0x5b41dc[_0xbf29('0x13')],_0xbf29('0x14')),'subject':intUtil[_0xbf29('0x15')](_0x5b41dc[_0xbf29('0x16')],_0x4e93a8,'\x20'),'description':intUtil[_0xbf29('0x15')](_0x5b41dc['Descriptions'],_0x4e93a8,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x5b41dc['Descriptions'],_0x4e93a8,'\x0a')}},getCustomFields(_0x5b41dc['Fields'],_0x4e93a8))}})[_0xbf29('0x17')](function(_0x3fbca6){logger[_0xbf29('0xe')](_0xbf29('0x18'));return _0x3fbca6['ticket'];});}function getUser(_0x4adb04,_0x446036){if(intUtil[_0xbf29('0x19')](_0x446036)){logger[_0xbf29('0xe')](_0xbf29('0x1a'),_0x446036);return request({'uri':util[_0xbf29('0x10')](_0xbf29('0x1b'),_0x4adb04[_0xbf29('0x11')]),'qs':{'query':util[_0xbf29('0x10')]('type:user\x20role:agent\x20email:%s',_0x446036)}})[_0xbf29('0x17')](function(_0x2d864d){if(_0x2d864d[_0xbf29('0x1c')]){logger['info'](_0xbf29('0x1d'));return _[_0xbf29('0x1e')](_0x2d864d[_0xbf29('0x1f')],{'email':_0x446036,'role':_0xbf29('0x20')});}else{logger[_0xbf29('0xe')](_0xbf29('0x21'));return request({'uri':util[_0xbf29('0x10')]('%s/users/me.json',_0x4adb04[_0xbf29('0x11')])})[_0xbf29('0x17')](function(_0xd1e0b2){logger['info']('Admin\x20account\x20selected.');return _0xd1e0b2[_0xbf29('0x22')];});}});}else{logger['info'](_0xbf29('0x21'));return request({'uri':util['format'](_0xbf29('0x23'),_0x4adb04[_0xbf29('0x11')])})['then'](function(_0x44106b){logger['info']('Admin\x20account\x20selected.');return _0x44106b[_0xbf29('0x22')];});}}function getEndUser(_0xfdfa10,_0x241c73,_0x1c32c5){logger[_0xbf29('0xe')](_0xbf29('0x24'),_0x1c32c5);return request({'uri':util[_0xbf29('0x10')](_0xbf29('0x1b'),_0xfdfa10[_0xbf29('0x11')]),'qs':{'query':util[_0xbf29('0x10')](_0xbf29('0x25'),_0x1c32c5)}})[_0xbf29('0x17')](function(_0xc7948e){var _0x340255;if(_0xc7948e[_0xbf29('0x1f')]['length']){_0xc7948e[_0xbf29('0x1f')]=_[_0xbf29('0x26')](_0xc7948e[_0xbf29('0x1f')],{'suspended':![],'role':_0xbf29('0x27')});if(_0xc7948e['results'][_0xbf29('0x28')]){_0x340255=_[_0xbf29('0x29')](_0xc7948e[_0xbf29('0x1f')]);}}if(_0x340255){logger[_0xbf29('0xe')](_0xbf29('0x2a'));return _0x340255;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbf29('0x10')](_0xbf29('0x2b'),_0xfdfa10['remoteUri']),'method':_0xbf29('0x2c'),'body':{'user':{'role':'end-user','name':util[_0xbf29('0x10')](_0xbf29('0x2d'),_0x241c73||_0x1c32c5),'phone':_0x1c32c5}}})[_0xbf29('0x17')](function(_0x3bf7ed){logger['info'](_0xbf29('0x2e'));return _0x3bf7ed[_0xbf29('0x22')];});}});}function getAuth(_0x372dc3){var _0x2d1016;if(_0x372dc3['authType']===_0xbf29('0x2f')){_0x2d1016=util[_0xbf29('0x10')](_0xbf29('0x30'),_0x372dc3[_0xbf29('0x31')],_0x372dc3['password']);}else if(_0x372dc3[_0xbf29('0x32')]==='token'){_0x2d1016=util[_0xbf29('0x10')](_0xbf29('0x33'),_0x372dc3[_0xbf29('0x31')],_0x372dc3[_0xbf29('0x34')]);}return util[_0xbf29('0x10')]('Basic\x20%s',new Buffer(_0x2d1016)['toString'](_0xbf29('0x35')));}function request(_0x521fd3){logger['debug'](_0xbf29('0x36'),JSON[_0xbf29('0x37')](_0x521fd3));return rp(_[_0xbf29('0x9')](_0x521fd3,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xf4af29,_0x39fec7){var _0x1437cd=[];if(_0xf4af29&&_0xf4af29[_0xbf29('0x28')]>0x0){_0x1437cd=_[_0xbf29('0x38')](_0xf4af29,_0x39fec7);}return _0x1437cd;}function getCustomFields(_0x3b5707,_0x428ef2){var _0x333765=[];var _0x207963={'custom_fields':[]};if(_0x3b5707[_0xbf29('0x28')]>0x0){_[_0xbf29('0x39')](_0x3b5707,function(_0x186c1b){if(_[_0xbf29('0x3a')]([_0xbf29('0x3b'),_0xbf29('0x3c')],_0x186c1b[_0xbf29('0x3d')])&&_0x186c1b[_0xbf29('0x3e')]&&!_0x186c1b['customField']){_0x207963[_0x186c1b[_0xbf29('0x3e')][_0xbf29('0x3f')]()]=_0x186c1b[_0xbf29('0x40')]['toString']();}else if(_[_0xbf29('0x3a')]([_0xbf29('0x3b'),'picklist'],_0x186c1b[_0xbf29('0x3d')])&&_0x186c1b[_0xbf29('0x41')]&&_0x186c1b['customField']){_0x207963[_0xbf29('0x42')][_0xbf29('0x43')]({'id':_0x186c1b[_0xbf29('0x41')],'value':_0x186c1b['content']['toString']()});}else if(_0x186c1b['type']==='variable'&&_0x186c1b[_0xbf29('0x44')]&&_0x186c1b['idField']&&_0x186c1b[_0xbf29('0x45')]){_0x428ef2[_0x186c1b[_0xbf29('0x44')]]&&_0x207963[_0xbf29('0x42')][_0xbf29('0x43')]({'id':_0x186c1b[_0xbf29('0x41')],'value':_0x428ef2[_0x186c1b['variableName']][_0xbf29('0x46')]()});}else if(_0x186c1b['type']==='customVariable'&&_0x186c1b[_0xbf29('0x47')]&&_0x186c1b[_0xbf29('0x47')][_0xbf29('0x14')]&&_0x186c1b[_0xbf29('0x41')]&&_0x186c1b[_0xbf29('0x45')]){_0x428ef2[_0x186c1b[_0xbf29('0x47')][_0xbf29('0x14')][_0xbf29('0x3f')]()]&&_0x207963[_0xbf29('0x42')][_0xbf29('0x43')]({'id':_0x186c1b[_0xbf29('0x41')],'value':_0x428ef2[_0x186c1b[_0xbf29('0x47')][_0xbf29('0x14')][_0xbf29('0x3f')]()]['toString']()});}});}return _0x207963;}exports[_0xbf29('0x48')]=function(_0x55a7ac,_0x301af5,_0x5be7d4,_0x3360dc,_0x7ecab6,_0x9ce2e9){var _0xe055a5,_0x4ad0ba;_0x9ce2e9['remoteUri']=intUtil[_0xbf29('0x49')](_0x9ce2e9['remoteUri']);_0x9ce2e9[_0xbf29('0x4a')]=intUtil['stripTrailingSlash'](_0x9ce2e9[_0xbf29('0x4a')]);if(_0x7ecab6&&_0x7ecab6[_0xbf29('0x4b')]){logger[_0xbf29('0xe')]('[QUEUE]',_0xbf29('0x4c'));_0x301af5[_0xbf29('0x4d')]=util[_0xbf29('0x10')](_0xbf29('0x4e'),_0x9ce2e9[_0xbf29('0x4a')],_0x301af5['uniqueid'],md5(_0x301af5[_0xbf29('0x4f')]));}else{_0x301af5[_0xbf29('0x4d')]='';}headers[_0xbf29('0x50')]=getAuth(_0x9ce2e9);return getUser(_0x9ce2e9,_0x3360dc[_0xbf29('0x51')])[_0xbf29('0x17')](function(_0x386390){_0xe055a5=_0x386390;logger[_0xbf29('0xe')](_0xbf29('0x52'),_0xe055a5['id']);return getEndUser(_0x9ce2e9,_0x301af5[_0xbf29('0x53')],_0x301af5[_0xbf29('0x54')]);})[_0xbf29('0x17')](function(_0x4f5aec){_0x4ad0ba=_0x4f5aec;logger[_0xbf29('0xe')]('The\x20Enduser\x20ID\x20is:',_0x4ad0ba['id']);return getTicket(_0x9ce2e9,_0xe055a5,_0x4ad0ba,_0x5be7d4,_0x301af5);})[_0xbf29('0x17')](function(_0x786090){if(_0x786090){logger[_0xbf29('0xe')](_0xbf29('0x55'),_0x786090['id']);switch(_0x9ce2e9[_0xbf29('0x3d')]){case _0xbf29('0x56'):logger[_0xbf29('0xe')](_0xbf29('0x57'),_0xbf29('0x58'));return request({'uri':util[_0xbf29('0x10')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x9ce2e9[_0xbf29('0x11')],_0xe055a5['id'],_0x786090['id']),'method':_0xbf29('0x2c')});case _0xbf29('0x59'):logger[_0xbf29('0xe')](_0xbf29('0x57'),_0xbf29('0x5a'));emit(util['format'](_0xbf29('0x5b'),_0x3360dc[_0xbf29('0x14')]),_0xbf29('0x5c'),{'uri':util[_0xbf29('0x10')](_0xbf29('0x5d'),_0x9ce2e9[_0xbf29('0x11')]['replace'](_0xbf29('0x5e'),''),_0x786090['id'])});break;default:logger[_0xbf29('0x5f')]('[QUEUE]',_0xbf29('0x60'));}}})[_0xbf29('0x61')](function(_0x103d5d){logger[_0xbf29('0x5f')](_0xbf29('0x62'),util[_0xbf29('0x63')](_0x103d5d,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x57ebe9,_0xed72a8,_0x1fd577,_0x21739f,_0x4fdc8e,_0x4550ac,_0x4ba045){var _0x2fb056,_0x41d1bc;_0x4550ac[_0xbf29('0x11')]=intUtil[_0xbf29('0x49')](_0x4550ac['remoteUri']);_0x4550ac['serverUrl']=intUtil['stripTrailingSlash'](_0x4550ac[_0xbf29('0x4a')]);if(_0x4ba045&&_0x4ba045[_0xbf29('0x64')]&&_0x4ba045[_0xbf29('0x64')]!==_0xbf29('0x65')){logger['info'](_0xbf29('0x66'),'Recording\x20is\x20enabled!');_0xed72a8[_0xbf29('0x4d')]=util['format'](_0xbf29('0x4e'),_0x4550ac[_0xbf29('0x4a')],_0xed72a8[_0xbf29('0x4f')],md5(_0xed72a8['uniqueid']));}headers[_0xbf29('0x50')]=getAuth(_0x4550ac);return getUser(_0x4550ac,_0x21739f['email'])[_0xbf29('0x17')](function(_0x545953){_0x2fb056=_0x545953;logger[_0xbf29('0xe')](_0xbf29('0x52'),_0x2fb056['id']);return getEndUser(_0x4550ac,_0xed72a8['destcalleridname'],_0xed72a8[_0xbf29('0x67')]);})[_0xbf29('0x17')](function(_0x3e6bad){_0x41d1bc=_0x3e6bad;logger[_0xbf29('0xe')](_0xbf29('0x68'),_0x41d1bc['id']);return getTicket(_0x4550ac,_0x2fb056,_0x41d1bc,_0x1fd577,_0xed72a8);})[_0xbf29('0x17')](function(_0x18772d){if(_0x18772d){logger[_0xbf29('0xe')](_0xbf29('0x55'),_0x18772d['id']);switch(_0x4550ac['type']){case'integrationTab':logger[_0xbf29('0xe')](_0xbf29('0x66'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xbf29('0x10')](_0xbf29('0x69'),_0x4550ac[_0xbf29('0x11')],_0x2fb056['id'],_0x18772d['id']),'method':_0xbf29('0x2c')});case _0xbf29('0x59'):logger['info'](_0xbf29('0x66'),_0xbf29('0x5a'));emit(util['format'](_0xbf29('0x5b'),_0x21739f[_0xbf29('0x14')]),_0xbf29('0x5c'),{'uri':util['format'](_0xbf29('0x5d'),_0x4550ac['remoteUri'][_0xbf29('0x6a')]('/api/v2',''),_0x18772d['id'])});break;default:logger[_0xbf29('0x5f')](_0xbf29('0x66'),_0xbf29('0x60'));}}})[_0xbf29('0x61')](function(_0x564e66){logger[_0xbf29('0x5f')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x564e66,{'showHidden':!![],'depth':null}));});};exports[_0xbf29('0x6b')]=function(_0x3795b6,_0x9ba047,_0x536876,_0x1a2b66,_0x52b3d5,_0x5bbf45){var _0x3dfb18,_0x984b10;_0x5bbf45[_0xbf29('0x11')]=intUtil[_0xbf29('0x49')](_0x5bbf45['remoteUri']);_0x5bbf45[_0xbf29('0x4a')]=intUtil['stripTrailingSlash'](_0x5bbf45[_0xbf29('0x4a')]);if(_0x52b3d5&&_0x52b3d5['monitor_format']){logger[_0xbf29('0xe')]('['+_0x9ba047['lastevent'][_0xbf29('0x6c')]()+']',_0xbf29('0x4c'));_0x9ba047['recordingURL']=util['format'](_0xbf29('0x4e'),_0x5bbf45[_0xbf29('0x4a')],_0x9ba047[_0xbf29('0x4f')],md5(_0x9ba047[_0xbf29('0x4f')]));}else{_0x9ba047[_0xbf29('0x4d')]='';}headers['Authorization']=getAuth(_0x5bbf45);return getUser(_0x5bbf45)[_0xbf29('0x17')](function(_0x3145e8){_0x3dfb18=_0x3145e8;logger['info'](_0xbf29('0x52'),_0x3dfb18['id']);return getEndUser(_0x5bbf45,_0x9ba047[_0xbf29('0x53')],_0x9ba047[_0xbf29('0x54')]);})[_0xbf29('0x17')](function(_0x11410f){_0x984b10=_0x11410f;logger[_0xbf29('0xe')](_0xbf29('0x68'),_0x984b10['id']);return getTicket(_0x5bbf45,_0x3dfb18,_0x984b10,_0x536876,_0x9ba047);})[_0xbf29('0x17')](function(_0x1db286){if(_0x1db286){logger[_0xbf29('0xe')]('The\x20Ticket\x20ID\x20is:',_0x1db286['id']);}})['catch'](function(_0x45504e){logger[_0xbf29('0x5f')]('['+_0x9ba047[_0xbf29('0x6d')][_0xbf29('0x6c')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xbf29('0x63')](_0x45504e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x89ce=['Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','string','nameField','customField','toLowerCase','content','includes','picklist','type','idField','custom_fields','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','inspect','lodash','util','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail'];(function(_0x39475e,_0x4894c1){var _0x1fbaf0=function(_0x26c932){while(--_0x26c932){_0x39475e['push'](_0x39475e['shift']());}};_0x1fbaf0(++_0x4894c1);}(_0x89ce,0x139));var _0xe89c=function(_0x2721e3,_0x58af68){_0x2721e3=_0x2721e3-0x0;var _0x1489cd=_0x89ce[_0x2721e3];return _0x1489cd;};'use strict';var _=require(_0xe89c('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xe89c('0x1'));var Redis=require('ioredis');var intUtil=require(_0xe89c('0x2'));var config=require(_0xe89c('0x3'));var logger=require('../../../../config/logger')('zendesk');config[_0xe89c('0x4')]=_[_0xe89c('0x5')](config[_0xe89c('0x4')],{'host':_0xe89c('0x6'),'port':0x18eb});var io=require(_0xe89c('0x7'))(new Redis(config[_0xe89c('0x4')]));function emit(_0x1d7246,_0x2d5b02,_0x54e057){io['to'](_0x1d7246)[_0xe89c('0x8')](_0x2d5b02,_0x54e057);}var headers={'Content-Type':_0xe89c('0x9'),'Accept':'application/json'};function getTicket(_0x1bd180,_0x4ada3e,_0x3b4c97,_0x544b86,_0x281562){logger[_0xe89c('0xa')](_0xe89c('0xb'));return request({'uri':util[_0xe89c('0xc')](_0xe89c('0xd'),_0x1bd180[_0xe89c('0xe')]),'method':_0xe89c('0xf'),'body':{'ticket':_[_0xe89c('0x10')]({'requester_id':_0x3b4c97['id'],'submitter_id':_0x4ada3e?_0x4ada3e['id']:undefined,'assignee_id':_0x4ada3e?_0x4ada3e['id']:undefined,'tags':getTags(_0x544b86[_0xe89c('0x11')],_0xe89c('0x12')),'subject':intUtil[_0xe89c('0x13')](_0x544b86['Subjects'],_0x281562,'\x20'),'description':intUtil[_0xe89c('0x13')](_0x544b86[_0xe89c('0x14')],_0x281562,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe89c('0x13')](_0x544b86[_0xe89c('0x14')],_0x281562,'\x0a')}},getCustomFields(_0x544b86[_0xe89c('0x15')],_0x281562))}})[_0xe89c('0x16')](function(_0x4be266){logger[_0xe89c('0xa')](_0xe89c('0x17'));return _0x4be266[_0xe89c('0x18')];});}function getUser(_0x139707,_0x1270d7){if(intUtil[_0xe89c('0x19')](_0x1270d7)){logger['info'](_0xe89c('0x1a'),_0x1270d7);return request({'uri':util['format'](_0xe89c('0x1b'),_0x139707['remoteUri']),'qs':{'query':util['format'](_0xe89c('0x1c'),_0x1270d7)}})[_0xe89c('0x16')](function(_0x46bd4e){if(_0x46bd4e[_0xe89c('0x1d')]){logger['info']('Agent\x20found!');return _[_0xe89c('0x1e')](_0x46bd4e[_0xe89c('0x1f')],{'email':_0x1270d7,'role':_0xe89c('0x20')});}else{logger[_0xe89c('0xa')](_0xe89c('0x21'));return request({'uri':util[_0xe89c('0xc')](_0xe89c('0x22'),_0x139707[_0xe89c('0xe')])})[_0xe89c('0x16')](function(_0x2ece87){logger[_0xe89c('0xa')](_0xe89c('0x23'));return _0x2ece87[_0xe89c('0x24')];});}});}else{logger[_0xe89c('0xa')](_0xe89c('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x139707[_0xe89c('0xe')])})['then'](function(_0x29fb18){logger['info']('Admin\x20account\x20selected.');return _0x29fb18[_0xe89c('0x24')];});}}function getEndUser(_0x1c4e7a,_0x1250a5,_0x7ae96d){logger['info'](_0xe89c('0x25'),_0x7ae96d);return request({'uri':util[_0xe89c('0xc')](_0xe89c('0x1b'),_0x1c4e7a[_0xe89c('0xe')]),'qs':{'query':util[_0xe89c('0xc')](_0xe89c('0x26'),_0x7ae96d)}})[_0xe89c('0x16')](function(_0x31cc06){var _0x4c5e4c;if(_0x31cc06[_0xe89c('0x1f')][_0xe89c('0x27')]){_0x31cc06[_0xe89c('0x1f')]=_[_0xe89c('0x28')](_0x31cc06[_0xe89c('0x1f')],{'suspended':![],'role':_0xe89c('0x29')});if(_0x31cc06[_0xe89c('0x1f')]['length']){_0x4c5e4c=_['first'](_0x31cc06[_0xe89c('0x1f')]);}}if(_0x4c5e4c){logger[_0xe89c('0xa')](_0xe89c('0x2a'));return _0x4c5e4c;}else{logger['info'](_0xe89c('0x2b'));return request({'uri':util[_0xe89c('0xc')](_0xe89c('0x2c'),_0x1c4e7a['remoteUri']),'method':_0xe89c('0xf'),'body':{'user':{'role':_0xe89c('0x29'),'name':util[_0xe89c('0xc')]('Caller\x20-\x20%s',_0x1250a5||_0x7ae96d),'phone':_0x7ae96d}}})['then'](function(_0x2211d5){logger[_0xe89c('0xa')](_0xe89c('0x2d'));return _0x2211d5['user'];});}});}function getAuth(_0x2914a8){var _0x108d62;if(_0x2914a8[_0xe89c('0x2e')]===_0xe89c('0x2f')){_0x108d62=util['format'](_0xe89c('0x30'),_0x2914a8[_0xe89c('0x31')],_0x2914a8[_0xe89c('0x2f')]);}else if(_0x2914a8[_0xe89c('0x2e')]==='token'){_0x108d62=util[_0xe89c('0xc')](_0xe89c('0x32'),_0x2914a8[_0xe89c('0x31')],_0x2914a8['token']);}return util[_0xe89c('0xc')](_0xe89c('0x33'),new Buffer(_0x108d62)[_0xe89c('0x34')](_0xe89c('0x35')));}function request(_0x512e2a){logger[_0xe89c('0x36')](_0xe89c('0x37'),JSON[_0xe89c('0x38')](_0x512e2a));return rp(_[_0xe89c('0x5')](_0x512e2a,{'method':_0xe89c('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x3ba8d7,_0x859163){var _0x306aa3=[];if(_0x3ba8d7&&_0x3ba8d7[_0xe89c('0x27')]>0x0){_0x306aa3=_[_0xe89c('0x3a')](_0x3ba8d7,_0x859163);}return _0x306aa3;}function getCustomFields(_0x91cc8b,_0x46c417){var _0x21b97e=[];var _0xdde40={'custom_fields':[]};if(_0x91cc8b['length']>0x0){_['forEach'](_0x91cc8b,function(_0x3f31eb){if(_['includes']([_0xe89c('0x3b'),'picklist'],_0x3f31eb['type'])&&_0x3f31eb[_0xe89c('0x3c')]&&!_0x3f31eb[_0xe89c('0x3d')]){_0xdde40[_0x3f31eb[_0xe89c('0x3c')][_0xe89c('0x3e')]()]=_0x3f31eb[_0xe89c('0x3f')][_0xe89c('0x34')]();}else if(_[_0xe89c('0x40')]([_0xe89c('0x3b'),_0xe89c('0x41')],_0x3f31eb[_0xe89c('0x42')])&&_0x3f31eb[_0xe89c('0x43')]&&_0x3f31eb[_0xe89c('0x3d')]){_0xdde40[_0xe89c('0x44')]['push']({'id':_0x3f31eb[_0xe89c('0x43')],'value':_0x3f31eb[_0xe89c('0x3f')][_0xe89c('0x34')]()});}else if(_0x3f31eb['type']===_0xe89c('0x45')&&_0x3f31eb[_0xe89c('0x46')]&&_0x3f31eb[_0xe89c('0x43')]&&_0x3f31eb[_0xe89c('0x3d')]){_0x46c417[_0x3f31eb[_0xe89c('0x46')]]&&_0xdde40['custom_fields'][_0xe89c('0x47')]({'id':_0x3f31eb['idField'],'value':_0x46c417[_0x3f31eb[_0xe89c('0x46')]][_0xe89c('0x34')]()});}else if(_0x3f31eb[_0xe89c('0x42')]===_0xe89c('0x48')&&_0x3f31eb[_0xe89c('0x49')]&&_0x3f31eb[_0xe89c('0x49')][_0xe89c('0x12')]&&_0x3f31eb[_0xe89c('0x43')]&&_0x3f31eb[_0xe89c('0x3d')]){_0x46c417[_0x3f31eb[_0xe89c('0x49')][_0xe89c('0x12')][_0xe89c('0x3e')]()]&&_0xdde40['custom_fields'][_0xe89c('0x47')]({'id':_0x3f31eb['idField'],'value':_0x46c417[_0x3f31eb[_0xe89c('0x49')]['name']['toLowerCase']()][_0xe89c('0x34')]()});}});}return _0xdde40;}exports[_0xe89c('0x4a')]=function(_0x43d0ea,_0x31b550,_0x1bfa4d,_0x233502,_0x5ecbb0,_0x1fd47c){var _0x186f6b,_0x44a5b7;_0x1fd47c[_0xe89c('0xe')]=intUtil[_0xe89c('0x4b')](_0x1fd47c[_0xe89c('0xe')]);_0x1fd47c[_0xe89c('0x4c')]=intUtil[_0xe89c('0x4b')](_0x1fd47c[_0xe89c('0x4c')]);if(_0x5ecbb0&&_0x5ecbb0[_0xe89c('0x4d')]){logger[_0xe89c('0xa')](_0xe89c('0x4e'),_0xe89c('0x4f'));_0x31b550[_0xe89c('0x50')]=util[_0xe89c('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1fd47c[_0xe89c('0x4c')],_0x31b550[_0xe89c('0x51')],md5(_0x31b550[_0xe89c('0x51')]));}else{_0x31b550[_0xe89c('0x50')]='';}headers[_0xe89c('0x52')]=getAuth(_0x1fd47c);return getUser(_0x1fd47c,_0x233502[_0xe89c('0x53')])['then'](function(_0x502f17){_0x186f6b=_0x502f17;logger[_0xe89c('0xa')](_0xe89c('0x54'),_0x186f6b['id']);return getEndUser(_0x1fd47c,_0x31b550[_0xe89c('0x55')],_0x31b550['calleridnum']);})[_0xe89c('0x16')](function(_0x59498f){_0x44a5b7=_0x59498f;logger[_0xe89c('0xa')](_0xe89c('0x56'),_0x44a5b7['id']);return getTicket(_0x1fd47c,_0x186f6b,_0x44a5b7,_0x1bfa4d,_0x31b550);})[_0xe89c('0x16')](function(_0x3fa13f){if(_0x3fa13f){logger[_0xe89c('0xa')]('The\x20Ticket\x20ID\x20is:',_0x3fa13f['id']);switch(_0x1fd47c[_0xe89c('0x42')]){case _0xe89c('0x57'):logger[_0xe89c('0xa')](_0xe89c('0x4e'),_0xe89c('0x58'));return request({'uri':util[_0xe89c('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1fd47c[_0xe89c('0xe')],_0x186f6b['id'],_0x3fa13f['id']),'method':_0xe89c('0xf')});case _0xe89c('0x59'):logger['info'](_0xe89c('0x4e'),_0xe89c('0x5a'));emit(util['format'](_0xe89c('0x5b'),_0x233502[_0xe89c('0x12')]),_0xe89c('0x5c'),{'uri':util['format'](_0xe89c('0x5d'),_0x1fd47c[_0xe89c('0xe')][_0xe89c('0x5e')](_0xe89c('0x5f'),''),_0x3fa13f['id'])});break;default:logger[_0xe89c('0x60')](_0xe89c('0x4e'),_0xe89c('0x61'));}}})[_0xe89c('0x62')](function(_0x1437bb){logger[_0xe89c('0x60')](_0xe89c('0x63'),util['inspect'](_0x1437bb,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x556470,_0x50ce77,_0x548ea3,_0x1c72c0,_0x523bb5,_0x4885fd,_0xd2cf3){var _0x27d59b,_0x18dafd;_0x4885fd['remoteUri']=intUtil[_0xe89c('0x4b')](_0x4885fd[_0xe89c('0xe')]);_0x4885fd['serverUrl']=intUtil[_0xe89c('0x4b')](_0x4885fd[_0xe89c('0x4c')]);if(_0xd2cf3&&_0xd2cf3[_0xe89c('0x64')]&&_0xd2cf3[_0xe89c('0x64')]!=='none'){logger[_0xe89c('0xa')](_0xe89c('0x65'),_0xe89c('0x4f'));_0x50ce77[_0xe89c('0x50')]=util[_0xe89c('0xc')](_0xe89c('0x66'),_0x4885fd[_0xe89c('0x4c')],_0x50ce77[_0xe89c('0x51')],md5(_0x50ce77[_0xe89c('0x51')]));}headers[_0xe89c('0x52')]=getAuth(_0x4885fd);return getUser(_0x4885fd,_0x1c72c0['email'])[_0xe89c('0x16')](function(_0x1d6d4d){_0x27d59b=_0x1d6d4d;logger['info']('The\x20User\x20ID\x20is:',_0x27d59b['id']);return getEndUser(_0x4885fd,_0x50ce77['destcalleridname'],_0x50ce77[_0xe89c('0x67')]);})[_0xe89c('0x16')](function(_0x30e534){_0x18dafd=_0x30e534;logger['info']('The\x20Enduser\x20ID\x20is:',_0x18dafd['id']);return getTicket(_0x4885fd,_0x27d59b,_0x18dafd,_0x548ea3,_0x50ce77);})['then'](function(_0x286ab3){if(_0x286ab3){logger[_0xe89c('0xa')](_0xe89c('0x68'),_0x286ab3['id']);switch(_0x4885fd[_0xe89c('0x42')]){case _0xe89c('0x57'):logger[_0xe89c('0xa')](_0xe89c('0x65'),_0xe89c('0x58'));return request({'uri':util['format'](_0xe89c('0x69'),_0x4885fd[_0xe89c('0xe')],_0x27d59b['id'],_0x286ab3['id']),'method':_0xe89c('0xf')});case _0xe89c('0x59'):logger[_0xe89c('0xa')](_0xe89c('0x65'),_0xe89c('0x5a'));emit(util[_0xe89c('0xc')]('user:%s',_0x1c72c0[_0xe89c('0x12')]),'trigger:browser:url',{'uri':util[_0xe89c('0xc')]('%s/agent/tickets/%s',_0x4885fd[_0xe89c('0xe')][_0xe89c('0x5e')](_0xe89c('0x5f'),''),_0x286ab3['id'])});break;default:logger[_0xe89c('0x60')](_0xe89c('0x65'),_0xe89c('0x61'));}}})[_0xe89c('0x62')](function(_0x38a312){logger[_0xe89c('0x60')](_0xe89c('0x6a'),util['inspect'](_0x38a312,{'showHidden':!![],'depth':null}));});};exports[_0xe89c('0x6b')]=function(_0x3eb8c1,_0x20eeff,_0x39077e,_0x6f983d,_0x388604,_0x508e2c){var _0x2bbe3e,_0x149e9c;_0x508e2c[_0xe89c('0xe')]=intUtil['stripTrailingSlash'](_0x508e2c['remoteUri']);_0x508e2c['serverUrl']=intUtil[_0xe89c('0x4b')](_0x508e2c[_0xe89c('0x4c')]);if(_0x388604&&_0x388604[_0xe89c('0x4d')]){logger['info']('['+_0x20eeff[_0xe89c('0x6c')][_0xe89c('0x6d')]()+']',_0xe89c('0x4f'));_0x20eeff[_0xe89c('0x50')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x508e2c['serverUrl'],_0x20eeff[_0xe89c('0x51')],md5(_0x20eeff[_0xe89c('0x51')]));}else{_0x20eeff['recordingURL']='';}headers[_0xe89c('0x52')]=getAuth(_0x508e2c);return getUser(_0x508e2c)['then'](function(_0x10d378){_0x2bbe3e=_0x10d378;logger[_0xe89c('0xa')](_0xe89c('0x54'),_0x2bbe3e['id']);return getEndUser(_0x508e2c,_0x20eeff[_0xe89c('0x55')],_0x20eeff[_0xe89c('0x6e')]);})[_0xe89c('0x16')](function(_0x5ec23c){_0x149e9c=_0x5ec23c;logger['info'](_0xe89c('0x56'),_0x149e9c['id']);return getTicket(_0x508e2c,_0x2bbe3e,_0x149e9c,_0x39077e,_0x20eeff);})[_0xe89c('0x16')](function(_0x162726){if(_0x162726){logger[_0xe89c('0xa')](_0xe89c('0x68'),_0x162726['id']);}})['catch'](function(_0x3430e1){logger['error']('['+_0x20eeff[_0xe89c('0x6c')][_0xe89c('0x6d')]()+']'+_0xe89c('0x6f'),util[_0xe89c('0x70')](_0x3430e1,{'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 ff87293..fbdba5d 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 _0x54ef=['access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','info','Agent\x20found!','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','role','first_name','last_name','code','SUCCESS','details','startCase','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','uri','Leads','nothing','contact','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','connect','rejected','Rejected','abandoned','Abandoned','Call_Start_Time','outbound','Inbound','merge','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','destcalleridnum','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','com','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','idField','content','toString','variable','variableName','type','Variable','name','toLowerCase','isNil'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x54ef,0x112));var _0xf54e=function(_0x205330,_0x4b9ee6){_0x205330=_0x205330-0x0;var _0x37d6ae=_0x54ef[_0x205330];return _0x37d6ae;};'use strict';var _=require(_0xf54e('0x0'));var rp=require(_0xf54e('0x1'));var md5=require(_0xf54e('0x2'));var util=require('util');var intUtil=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var Redis=require(_0xf54e('0x5'));var BPromise=require(_0xf54e('0x6'));var config=require(_0xf54e('0x7'));var logger=require(_0xf54e('0x8'))(_0xf54e('0x9'));config['redis']=_['defaults'](config[_0xf54e('0xa')],{'host':_0xf54e('0xb'),'port':0x18eb});var io=require(_0xf54e('0xc'))(new Redis(config['redis']));function emit(_0x27e69b,_0x57a1ce,_0x40a75d){io['to'](_0x27e69b)[_0xf54e('0xd')](_0x57a1ce,_0x40a75d);}function request(_0x47c5e1){logger[_0xf54e('0xe')](_0xf54e('0xf'),JSON[_0xf54e('0x10')](_0x47c5e1));return rp(_0x47c5e1);}function getCustomFields(_0x3ecfb3,_0x5f232a){var _0x558502={};if(_0x3ecfb3[_0xf54e('0x11')]>0x0){_[_0xf54e('0x12')](_0x3ecfb3,function(_0x326eef){if(_['includes']([_0xf54e('0x13'),'picklist'],_0x326eef['type'])&&_0x326eef[_0xf54e('0x14')]){_0x558502[_0x326eef[_0xf54e('0x14')]]=_0x326eef[_0xf54e('0x15')][_0xf54e('0x16')]();}else if(_0x326eef['type']===_0xf54e('0x17')&&_0x326eef[_0xf54e('0x18')]&&_0x326eef[_0xf54e('0x14')]&&_0x5f232a[_0x326eef[_0xf54e('0x18')]]){_0x558502[_0x326eef['idField']]=_0x5f232a[_0x326eef[_0xf54e('0x18')]][_0xf54e('0x16')]();}else if(_0x326eef[_0xf54e('0x19')]==='customVariable'&&_0x326eef['Variable']&&_0x326eef[_0xf54e('0x1a')][_0xf54e('0x1b')]&&_0x326eef[_0xf54e('0x14')]&&_0x5f232a[_0x326eef[_0xf54e('0x1a')][_0xf54e('0x1b')][_0xf54e('0x1c')]()]){_0x558502[_0x326eef[_0xf54e('0x14')]]=_0x5f232a[_0x326eef[_0xf54e('0x1a')][_0xf54e('0x1b')][_0xf54e('0x1c')]()][_0xf54e('0x16')]();}});}return _0x558502;}function getName(_0x50fc66){if(_0x50fc66['indexOf']('\x20')>0x0){var _0x23e14=_0x50fc66['split'](/ (.+)/);if(_0x23e14[0x1]){return _0x23e14;}}return[_0x50fc66,_0x50fc66];}var accountsTokens={};function getAccessToken(_0x3e1556){return new Promise(function(_0x1bfe99,_0x106362){if(!_[_0xf54e('0x1d')](accountsTokens[_0x3e1556['id']])&&!_[_0xf54e('0x1d')](accountsTokens[_0x3e1556['id']][_0xf54e('0x1e')])){if(moment()[_0xf54e('0x1f')](accountsTokens[_0x3e1556['id']][_0xf54e('0x20')])){_0x1bfe99(accountsTokens[_0x3e1556['id']][_0xf54e('0x1e')]);}}var _0x5f9eea;switch(_0x3e1556[_0xf54e('0x21')]){case'US':_0x5f9eea='https://accounts.zoho.com';break;case'AU':_0x5f9eea=_0xf54e('0x22');break;case'EU':_0x5f9eea='https://accounts.zoho.eu';break;case'IN':_0x5f9eea=_0xf54e('0x23');break;case'CN':_0x5f9eea=_0xf54e('0x24');break;default:_0x5f9eea=_0xf54e('0x25');break;}var _0x474b61={'method':_0xf54e('0x26'),'uri':_0x5f9eea+_0xf54e('0x27'),'qs':{'refresh_token':_0x3e1556[_0xf54e('0x28')],'client_id':_0x3e1556[_0xf54e('0x29')],'client_secret':_0x3e1556[_0xf54e('0x2a')],'grant_type':_0xf54e('0x2b')},'json':!![]};return rp(_0x474b61)[_0xf54e('0x2c')](function(_0x39c0ae){accountsTokens[_0x3e1556['id']]={'access_token':_0x39c0ae[_0xf54e('0x1e')],'expires_in':moment()['add'](_0x39c0ae[_0xf54e('0x20')],'seconds')};_0x1bfe99(_0x39c0ae[_0xf54e('0x1e')]);})['catch'](function(_0x15b888){logger[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x15b888[_0xf54e('0x2f')]);_0x106362(_0x15b888);});});}function getUser(_0x25b643,_0x3993e4,_0x36f985,_0x54bd8f){logger['info'](_0xf54e('0x30'));return request({'method':_0xf54e('0x31'),'uri':util[_0xf54e('0x32')](_0xf54e('0x33'),_0x3993e4),'qs':{'type':_0xf54e('0x34')},'headers':{'Authorization':_0xf54e('0x35')+_0x25b643},'json':!![]})[_0xf54e('0x2c')](function(_0x850eb9){if(_0x850eb9[_0xf54e('0x36')]){var _0x12edc3=-0x1;if(_['isArrayLikeObject'](_0x850eb9['users'])){if(!_[_0xf54e('0x1d')](_0x54bd8f)){_0x12edc3=_[_0xf54e('0x37')](_0x850eb9['users'],function(_0x3e319c){return _0x3e319c[_0xf54e('0x38')]===_0x54bd8f;});}if(_0x12edc3>=0x0){logger[_0xf54e('0x39')](_0xf54e('0x3a'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x12edc3=_['findIndex'](_0x850eb9[_0xf54e('0x36')],function(_0xe7e042){return _0xe7e042[_0xf54e('0x3b')][_0xf54e('0x1b')]===_0xf54e('0x3c');});}return _0x850eb9[_0xf54e('0x36')][_0x12edc3];}else{if(_0x850eb9['user']['profile']['name']===_0xf54e('0x3c')){logger[_0xf54e('0x39')]('Using\x20the\x20admin\x20account!');user=_0x850eb9['user'];return user;}else{logger[_0xf54e('0x2d')](_0xf54e('0x3d'),JSON[_0xf54e('0x10')](_0x850eb9));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf54e('0x10')](_0x850eb9));}}}else{logger[_0xf54e('0x2d')]('The\x20failing\x20result\x20is',JSON[_0xf54e('0x10')](_0x850eb9));throw new Error(_0xf54e('0x3e')+JSON[_0xf54e('0x10')](_0x850eb9));}})[_0xf54e('0x3f')](function(_0x12ef97){console[_0xf54e('0x2d')](_0x12ef97);});}function getZohoUser(_0x4e00b7,_0x5d45cf){return new BPromise(function(_0x3d5a68,_0x3c66b3){request(_0x4e00b7)[_0xf54e('0x2c')](function(_0x4b1f84){var _0x4533a2=null;if(_0x4b1f84){_0x4533a2=_0x4b1f84[_0xf54e('0x40')][0x0];_0x4533a2[_0xf54e('0x41')]=_0x5d45cf;}_0x3d5a68(_0x4533a2);})[_0xf54e('0x3f')](function(_0x361e4c){_0x3c66b3(_0x361e4c);});});}function createEndUser(_0x23f297,_0x17c7ec,_0x1345b0,_0x8b4c,_0x2087b3,_0x1c1f0d){var _0x1345b0=getName(_0x1345b0);return request({'method':_0xf54e('0x26'),'uri':_0xf54e('0x42')+_0x17c7ec+_0xf54e('0x43')+_['startCase'](_0x1c1f0d['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1345b0[0x1],'First_Name':_0x1345b0[0x0],'Phone':_0x8b4c,'Owner':{'name':!_['isNil'](_0x2087b3[_0xf54e('0x44')][_0xf54e('0x1b')])?_0x2087b3['role'][_0xf54e('0x1b')]:!_[_0xf54e('0x1d')](_0x2087b3[_0xf54e('0x45')])?_0x2087b3['first_name']+'\x20'+_0x2087b3[_0xf54e('0x46')]:_0x2087b3[_0xf54e('0x46')],'id':_0x2087b3['id']}}]},'headers':{'Authorization':_0xf54e('0x35')+_0x23f297},'json':!![]})[_0xf54e('0x2c')](function(_0x4b1931){if(_0x4b1931&&_0x4b1931[_0xf54e('0x40')][0x0][_0xf54e('0x47')]===_0xf54e('0x48')){var _0x5b4ea1=_0x4b1931['data'][0x0][_0xf54e('0x49')];_0x5b4ea1[_0xf54e('0x41')]=_[_0xf54e('0x4a')](_0x1c1f0d[_0xf54e('0x4b')])+'s';return _0x5b4ea1;}logger[_0xf54e('0x2d')](_0xf54e('0x3d'),JSON['stringify'](data));throw new Error(_0xf54e('0x4c')+JSON['stringify'](data));})[_0xf54e('0x3f')](function(_0x4a7e3b){console[_0xf54e('0x4d')](_0xf54e('0x4e'),_0x4a7e3b);});}function getEndUser(_0x2e08b4,_0x57371d,_0x1af35d,_0x40b21c,_0x12971a,_0x32fb46,_0x3a5a87){var _0x478809={'method':_0xf54e('0x31'),'uri':'','headers':{'Authorization':_0xf54e('0x35')+_0x2e08b4},'json':!![]};switch(_0x3a5a87[_0xf54e('0x4f')]){case _0xf54e('0x50'):_0x478809['uri']=_0xf54e('0x42')+_0x57371d+_0xf54e('0x51')+_0x12971a+'))';return getZohoUser(_0x478809,'Contacts')[_0xf54e('0x2c')](function(_0xd4d956){if(_0xd4d956)return _0xd4d956;_0x478809[_0xf54e('0x52')]=_0xf54e('0x42')+_0x57371d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x12971a+'))';return getZohoUser(_0x478809,_0xf54e('0x53'))[_0xf54e('0x2c')](function(_0x2527f6){if(_0x2527f6)return _0x2527f6;if(_0x3a5a87[_0xf54e('0x4b')]!=_0xf54e('0x54')){return createEndUser(_0x2e08b4,_0x57371d,_0x40b21c,_0x12971a,_0x32fb46,_0x3a5a87);}else{return{};}});});break;case _0xf54e('0x55'):_0x478809[_0xf54e('0x52')]=_0xf54e('0x42')+_0x57371d+_0xf54e('0x51')+_0x12971a+'))';return getZohoUser(_0x478809,_0xf54e('0x56'))[_0xf54e('0x2c')](function(_0x1f4cf8){if(_0x1f4cf8)return _0x1f4cf8;if(_0x3a5a87[_0xf54e('0x4b')]!=_0xf54e('0x54')){return createEndUser(_0x2e08b4,_0x57371d,_0x40b21c,_0x12971a,_0x32fb46,_0x3a5a87);}else{return{};}});break;case _0xf54e('0x57'):_0x478809[_0xf54e('0x52')]=_0xf54e('0x42')+_0x57371d+_0xf54e('0x58')+_0x12971a+'))';return getZohoUser(_0x478809,_0xf54e('0x53'))[_0xf54e('0x2c')](function(_0x4e25e4){if(_0x4e25e4)return _0x4e25e4;if(_0x3a5a87['moduleCreate']!=_0xf54e('0x54')){return createEndUser(_0x2e08b4,_0x57371d,_0x40b21c,_0x12971a,_0x32fb46,_0x3a5a87);}else{return{};}});break;}}function getCall(_0x1106bb,_0x45861b,_0x40557d,_0xba297c,_0x3b7f40,_0x22763f,_0x149d0b,_0x89b811){logger[_0xf54e('0x39')](_0xf54e('0x59'));var _0x59c313={};_0x59c313[_0xf54e('0x5a')]={'name':!_[_0xf54e('0x1d')](_0xba297c[_0xf54e('0x44')][_0xf54e('0x1b')])&&!_[_0xf54e('0x1d')](_0xba297c[_0xf54e('0x3b')][_0xf54e('0x1b')])&&_0xba297c['profile'][_0xf54e('0x1b')]===_0xf54e('0x5b')?_0xba297c[_0xf54e('0x44')]['name']:!_[_0xf54e('0x1d')](_0xba297c['first_name'])?_0xba297c[_0xf54e('0x45')]+'\x20'+_0xba297c[_0xf54e('0x46')]:_0xba297c[_0xf54e('0x46')],'id':_0xba297c['id']};_0x59c313['Subject']=intUtil[_0xf54e('0x5c')](_0x22763f[_0xf54e('0x5d')],_0x149d0b,'\x20');_0x59c313[_0xf54e('0x5e')]=intUtil[_0xf54e('0x5c')](_0x22763f[_0xf54e('0x5f')],_0x149d0b,'\x0a');if(_0x3b7f40[_0xf54e('0x41')]===_0xf54e('0x56')){_0x59c313['Who_Id']={'name':!_['isNil'](_0x3b7f40[_0xf54e('0x60')])?_0x3b7f40[_0xf54e('0x60')]:!_['isNil'](_0x3b7f40[_0xf54e('0x61')])?_0x3b7f40['First_Name']+'\x20'+_0x3b7f40[_0xf54e('0x62')]:_0x3b7f40['Last_Name'],'id':_0x3b7f40['id']};}if(_0x3b7f40[_0xf54e('0x41')]===_0xf54e('0x53')){_0x59c313[_0xf54e('0x63')]={'name':!_[_0xf54e('0x1d')](_0x3b7f40[_0xf54e('0x60')])?_0x3b7f40[_0xf54e('0x60')]:!_['isNil'](_0x3b7f40['First_Name'])?_0x3b7f40[_0xf54e('0x61')]+'\x20'+_0x3b7f40[_0xf54e('0x62')]:_0x3b7f40['Last_Name'],'id':_0x3b7f40['id']};_0x59c313['$se_module']=_[_0xf54e('0x4a')](_0x3b7f40['enduserType']);}if(_0x149d0b[_0xf54e('0x64')]){_0x59c313[_0xf54e('0x65')]=moment[_0xf54e('0x66')](parseInt(_0x149d0b[_0xf54e('0x64')])*0x3e8)[_0xf54e('0x32')](_0xf54e('0x67'));}else if(_0x149d0b[_0xf54e('0x68')]&&_0x149d0b[_0xf54e('0x69')]){_0x59c313[_0xf54e('0x65')]=moment[_0xf54e('0x66')](moment(_0x149d0b[_0xf54e('0x69')],_0xf54e('0x6a'))[_0xf54e('0x6b')](moment(_0x149d0b[_0xf54e('0x6c')],'YYYY-MM-DDTHH:mm:ss')))[_0xf54e('0x32')](_0xf54e('0x67'));}switch(_0x149d0b[_0xf54e('0x6d')]){case _0xf54e('0x6e'):_0x59c313[_0xf54e('0x6f')]='Called';break;case _0xf54e('0x70'):case _0xf54e('0x71'):_0x59c313['Call_Result']='Answered';break;case _0xf54e('0x72'):_0x59c313['Call_Result']=_0xf54e('0x73');break;case _0xf54e('0x74'):_0x59c313[_0xf54e('0x6f')]=_0xf54e('0x75');break;case'timeout':_0x59c313[_0xf54e('0x6f')]='Timeout';default:}_0x59c313[_0xf54e('0x76')]=(_0x89b811===_0xf54e('0x77')?moment(_0x149d0b[_0xf54e('0x6c')])['format'](_0xf54e('0x6a')):moment(_0x149d0b['agentcalledAt'])[_0xf54e('0x32')](_0xf54e('0x6a')))||moment()['format'](_0xf54e('0x6a'));_0x59c313['Call_Type']=_0x89b811||_0xf54e('0x78');_0x59c313=_[_0xf54e('0x79')](_0x59c313,getCustomFields(_0x22763f[_0xf54e('0x7a')],_0x149d0b));return request({'method':_0xf54e('0x26'),'uri':_0xf54e('0x42')+_0x45861b+'/crm/v2/Calls','headers':{'Authorization':_0xf54e('0x35')+_0x1106bb},'body':{'data':[_0x59c313]},'json':!![]})[_0xf54e('0x2c')](function(_0x57db6f){if(_0x57db6f&&_0x57db6f[_0xf54e('0x40')][0x0][_0xf54e('0x47')]==='SUCCESS'){logger[_0xf54e('0x39')](_0xf54e('0x7b'));return{'id':_0x57db6f[_0xf54e('0x40')][0x0]['details']['id']};}})[_0xf54e('0x3f')](function(_0x4ae3d0){logger[_0xf54e('0x39')](_0xf54e('0x7c'),_0x4ae3d0['stack']);console[_0xf54e('0x4d')](_0xf54e('0x7c'),_0x4ae3d0);});}exports[_0xf54e('0x7d')]=function(_0x3bdf23,_0x38bf71,_0xfc1e,_0x27613f,_0x44b6e5,_0x451a1c){var _0x10f6bb,_0x266aed,_0x57b9ba;_0x451a1c[_0xf54e('0x7e')]=intUtil[_0xf54e('0x7f')](_0x451a1c[_0xf54e('0x7e')]);_0x451a1c['serverUrl']=intUtil[_0xf54e('0x7f')](_0x451a1c[_0xf54e('0x80')]);if(_0x44b6e5&&_0x44b6e5[_0xf54e('0x81')]){logger[_0xf54e('0x39')](_0xf54e('0x82'),_0xf54e('0x83'));_0x38bf71[_0xf54e('0x84')]=_0x451a1c['serverUrl']+_0xf54e('0x85')+_0x38bf71[_0xf54e('0x86')]+_0xf54e('0x87')+md5(_0x38bf71['uniqueid']);}else{_0x38bf71[_0xf54e('0x84')]='';}var _0x419ba2=_0x451a1c[_0xf54e('0x7e')]===_0xf54e('0x88')?'eu':'com';return getAccessToken(_0x451a1c)['then'](function(_0x25d05e){_0x57b9ba=_0x25d05e;return getUser(_0x57b9ba,_0x419ba2,_0x451a1c,_0x27613f[_0xf54e('0x38')]);})[_0xf54e('0x2c')](function(_0x2e35a3){_0x10f6bb=_0x2e35a3;logger[_0xf54e('0x39')](_0xf54e('0x89'),_0x10f6bb['id']);return getEndUser(_0x57b9ba,_0x419ba2,_0x451a1c,_0x38bf71[_0xf54e('0x8a')],_0x38bf71[_0xf54e('0x8b')],_0x10f6bb,_0xfc1e);})[_0xf54e('0x2c')](function(_0x205b47){_0x266aed=_0x205b47;return getCall(_0x57b9ba,_0x419ba2,_0x451a1c,_0x10f6bb,_0x266aed,_0xfc1e,_0x38bf71,'Inbound');})[_0xf54e('0x2c')](function(_0x124db1){if(_0x124db1){logger[_0xf54e('0x39')](_0xf54e('0x8c'),_0x124db1['id']);logger['info'](_0xf54e('0x82'),_0xf54e('0x8d'));emit(util[_0xf54e('0x32')](_0xf54e('0x8e'),_0x27613f['name']),_0xf54e('0x8f'),{'uri':_0xf54e('0x90')+_0x451a1c[_0xf54e('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x124db1['id']});}})['catch'](function(_0x3adfed){logger[_0xf54e('0x2d')](_0xf54e('0x82'),JSON[_0xf54e('0x10')](_0x3adfed));});};exports[_0xf54e('0x77')]=function(_0x14b7fc,_0x2b42f5,_0x824202,_0x8093bc,_0x4adf60,_0xa5de47,_0x3edfa0){var _0x4ce10,_0x37a61b,_0x395513;_0xa5de47[_0xf54e('0x7e')]=intUtil[_0xf54e('0x7f')](_0xa5de47[_0xf54e('0x7e')]);_0xa5de47[_0xf54e('0x80')]=intUtil[_0xf54e('0x7f')](_0xa5de47[_0xf54e('0x80')]);if(_0x3edfa0&&_0x3edfa0[_0xf54e('0x91')]&&_0x3edfa0['recordingFormat']!==_0xf54e('0x92')){logger[_0xf54e('0x39')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2b42f5[_0xf54e('0x84')]=_0xa5de47[_0xf54e('0x80')]+_0xf54e('0x85')+_0x2b42f5[_0xf54e('0x86')]+_0xf54e('0x87')+md5(_0x2b42f5[_0xf54e('0x86')]);}var _0x1d1d10=_0xa5de47[_0xf54e('0x7e')]===_0xf54e('0x88')?'eu':'com';return getAccessToken(_0xa5de47)[_0xf54e('0x2c')](function(_0x3c222a){_0x395513=_0x3c222a;return getUser(_0x395513,_0x1d1d10,_0xa5de47,_0x8093bc[_0xf54e('0x38')]);})['then'](function(_0x40f135){_0x4ce10=_0x40f135;logger['info'](_0xf54e('0x89'),_0x4ce10['id']);return getEndUser(_0x395513,_0x1d1d10,_0xa5de47,_0x2b42f5['destcalleridname'],_0x2b42f5[_0xf54e('0x93')],_0x4ce10,_0x824202);})[_0xf54e('0x2c')](function(_0x575486){_0x37a61b=_0x575486;return getCall(_0x395513,_0x1d1d10,_0xa5de47,_0x4ce10,_0x37a61b,_0x824202,_0x2b42f5,'Outbound');})[_0xf54e('0x2c')](function(_0x632240){if(_0x632240){logger[_0xf54e('0x39')](_0xf54e('0x8c'),_0x632240['id']);logger[_0xf54e('0x39')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf54e('0x32')](_0xf54e('0x8e'),_0x8093bc[_0xf54e('0x1b')]),_0xf54e('0x8f'),{'uri':_0xf54e('0x90')+_0xa5de47[_0xf54e('0x7e')]+_0xf54e('0x94')+_0x632240['id']});}})[_0xf54e('0x3f')](function(_0x145906){logger[_0xf54e('0x2d')]('[OUTBOUND]',JSON[_0xf54e('0x10')](_0x145906));});};exports[_0xf54e('0x95')]=function(_0x4d4667,_0x4fd274,_0x20345b,_0x42c049,_0xdc25ce,_0x183867){var _0x393156,_0x5e6713,_0x230757;_0x183867[_0xf54e('0x7e')]=intUtil[_0xf54e('0x7f')](_0x183867[_0xf54e('0x7e')]);_0x183867['serverUrl']=intUtil[_0xf54e('0x7f')](_0x183867[_0xf54e('0x80')]);if(_0xdc25ce&&_0xdc25ce[_0xf54e('0x81')]){logger[_0xf54e('0x39')]('['+_0x4fd274['lastevent'][_0xf54e('0x96')]()+']',_0xf54e('0x83'));_0x4fd274[_0xf54e('0x84')]=_0x183867[_0xf54e('0x80')]+_0xf54e('0x85')+_0x4fd274['uniqueid']+_0xf54e('0x87')+md5(_0x4fd274['uniqueid']);}else{_0x4fd274['recordingURL']='';}var _0x963253=_0x183867[_0xf54e('0x7e')]===_0xf54e('0x88')?'eu':_0xf54e('0x97');return getAccessToken(_0x183867)[_0xf54e('0x2c')](function(_0x239fe7){_0x230757=_0x239fe7;return getUser(_0x230757,_0x963253,_0x183867);})[_0xf54e('0x2c')](function(_0x7ad573){_0x393156=_0x7ad573;logger[_0xf54e('0x39')]('The\x20User\x20ID\x20is:',_0x393156['id']);return getEndUser(_0x230757,_0x963253,_0x183867,_0x4fd274[_0xf54e('0x8a')],_0x4fd274[_0xf54e('0x8b')],_0x393156,_0x20345b);})[_0xf54e('0x2c')](function(_0x971a3e){_0x5e6713=_0x971a3e;return getCall(_0x230757,_0x963253,_0x183867,_0x393156,_0x5e6713,_0x20345b,_0x4fd274,_0xf54e('0x78'));})[_0xf54e('0x2c')](function(_0x485597){if(_0x485597){logger[_0xf54e('0x39')](_0xf54e('0x8c'),_0x485597['id']);}})[_0xf54e('0x3f')](function(_0x2b46d4){logger[_0xf54e('0x2d')]('['+_0x4fd274[_0xf54e('0x6d')]['toUpperCase']()+']',JSON[_0xf54e('0x10')](_0x2b46d4));});}; \ No newline at end of file +var _0x6f7a=['type','variableName','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','access_token','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','catch','data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','enduserType','log','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Who_Id','First_Name','Last_Name','Full_Name','$se_module','Call_Duration','talktime','mm:ss','answertime','utc','endtime','diff','YYYY-MM-DDTHH:mm:ss','lastevent','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','details','err','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','zoho.eu','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','calleridnum','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','length','includes','string','picklist','idField','content','toString'];(function(_0x537e0e,_0x5b1ff6){var _0x34166d=function(_0x5edacb){while(--_0x5edacb){_0x537e0e['push'](_0x537e0e['shift']());}};_0x34166d(++_0x5b1ff6);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0xcc11cd,_0x1a1f78){_0xcc11cd=_0xcc11cd-0x0;var _0x1545af=_0x6f7a[_0xcc11cd];return _0x1545af;};'use strict';var _=require(_0xa6f7('0x0'));var rp=require(_0xa6f7('0x1'));var md5=require(_0xa6f7('0x2'));var util=require(_0xa6f7('0x3'));var intUtil=require('./util');var moment=require(_0xa6f7('0x4'));var Redis=require(_0xa6f7('0x5'));var BPromise=require(_0xa6f7('0x6'));var config=require(_0xa6f7('0x7'));var logger=require(_0xa6f7('0x8'))(_0xa6f7('0x9'));config[_0xa6f7('0xa')]=_[_0xa6f7('0xb')](config[_0xa6f7('0xa')],{'host':_0xa6f7('0xc'),'port':0x18eb});var io=require(_0xa6f7('0xd'))(new Redis(config['redis']));function emit(_0x4b4f9e,_0x30f2a7,_0x2674c9){io['to'](_0x4b4f9e)[_0xa6f7('0xe')](_0x30f2a7,_0x2674c9);}function request(_0x362404){logger[_0xa6f7('0xf')]('[HTTP]',JSON['stringify'](_0x362404));return rp(_0x362404);}function getCustomFields(_0x2fd1d0,_0x225da4){var _0x4e30bc={};if(_0x2fd1d0[_0xa6f7('0x10')]>0x0){_['forEach'](_0x2fd1d0,function(_0x315096){if(_[_0xa6f7('0x11')]([_0xa6f7('0x12'),_0xa6f7('0x13')],_0x315096['type'])&&_0x315096[_0xa6f7('0x14')]){_0x4e30bc[_0x315096['idField']]=_0x315096[_0xa6f7('0x15')][_0xa6f7('0x16')]();}else if(_0x315096[_0xa6f7('0x17')]==='variable'&&_0x315096[_0xa6f7('0x18')]&&_0x315096['idField']&&_0x225da4[_0x315096[_0xa6f7('0x18')]]){_0x4e30bc[_0x315096['idField']]=_0x225da4[_0x315096[_0xa6f7('0x18')]][_0xa6f7('0x16')]();}else if(_0x315096[_0xa6f7('0x17')]==='customVariable'&&_0x315096[_0xa6f7('0x19')]&&_0x315096[_0xa6f7('0x19')][_0xa6f7('0x1a')]&&_0x315096[_0xa6f7('0x14')]&&_0x225da4[_0x315096['Variable']['name'][_0xa6f7('0x1b')]()]){_0x4e30bc[_0x315096['idField']]=_0x225da4[_0x315096[_0xa6f7('0x19')][_0xa6f7('0x1a')]['toLowerCase']()][_0xa6f7('0x16')]();}});}return _0x4e30bc;}function getName(_0xb2cfaa){if(_0xb2cfaa[_0xa6f7('0x1c')]('\x20')>0x0){var _0x35891a=_0xb2cfaa[_0xa6f7('0x1d')](/ (.+)/);if(_0x35891a[0x1]){return _0x35891a;}}return[_0xb2cfaa,_0xb2cfaa];}var accountsTokens={};function getAccessToken(_0x1aa8dc){return new Promise(function(_0x4887ad,_0x3c0c55){if(!_[_0xa6f7('0x1e')](accountsTokens[_0x1aa8dc['id']])&&!_['isNil'](accountsTokens[_0x1aa8dc['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x1aa8dc['id']][_0xa6f7('0x1f')])){_0x4887ad(accountsTokens[_0x1aa8dc['id']][_0xa6f7('0x20')]);}}var _0x566b63;switch(_0x1aa8dc['zone']){case'US':_0x566b63='https://accounts.zoho.com';break;case'AU':_0x566b63=_0xa6f7('0x21');break;case'EU':_0x566b63=_0xa6f7('0x22');break;case'IN':_0x566b63=_0xa6f7('0x23');break;case'CN':_0x566b63='https://accounts.zoho.com.cn';break;default:_0x566b63='https://accounts.zoho.eu';break;}var _0x2f4907={'method':'POST','uri':_0x566b63+'/oauth/v2/token','qs':{'refresh_token':_0x1aa8dc[_0xa6f7('0x24')],'client_id':_0x1aa8dc['clientId'],'client_secret':_0x1aa8dc[_0xa6f7('0x25')],'grant_type':_0xa6f7('0x26')},'json':!![]};return rp(_0x2f4907)[_0xa6f7('0x27')](function(_0x2b4c6c){accountsTokens[_0x1aa8dc['id']]={'access_token':_0x2b4c6c[_0xa6f7('0x20')],'expires_in':moment()['add'](_0x2b4c6c['expires_in'],_0xa6f7('0x28'))};_0x4887ad(_0x2b4c6c[_0xa6f7('0x20')]);})['catch'](function(_0x267917){logger[_0xa6f7('0x29')](_0xa6f7('0x2a'),_0x267917[_0xa6f7('0x2b')]);_0x3c0c55(_0x267917);});});}function getUser(_0x224f5a,_0x10bf77,_0x353de8,_0x54f72c){logger[_0xa6f7('0x2c')](_0xa6f7('0x2d'));return request({'method':_0xa6f7('0x2e'),'uri':util[_0xa6f7('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x10bf77),'qs':{'type':_0xa6f7('0x30')},'headers':{'Authorization':_0xa6f7('0x31')+_0x224f5a},'json':!![]})['then'](function(_0xd6304f){if(_0xd6304f[_0xa6f7('0x32')]){var _0x4d79d8=-0x1;if(_['isArrayLikeObject'](_0xd6304f[_0xa6f7('0x32')])){if(!_[_0xa6f7('0x1e')](_0x54f72c)){_0x4d79d8=_[_0xa6f7('0x33')](_0xd6304f[_0xa6f7('0x32')],function(_0x1e25e0){return _0x1e25e0['email']===_0x54f72c;});}if(_0x4d79d8>=0x0){logger['info'](_0xa6f7('0x34'));}else{logger['info'](_0xa6f7('0x35'));_0x4d79d8=_[_0xa6f7('0x33')](_0xd6304f[_0xa6f7('0x32')],function(_0x237e5d){return _0x237e5d[_0xa6f7('0x36')][_0xa6f7('0x1a')]==='Administrator';});}return _0xd6304f[_0xa6f7('0x32')][_0x4d79d8];}else{if(_0xd6304f[_0xa6f7('0x37')][_0xa6f7('0x36')]['name']===_0xa6f7('0x38')){logger['info'](_0xa6f7('0x35'));user=_0xd6304f[_0xa6f7('0x37')];return user;}else{logger[_0xa6f7('0x29')]('The\x20failing\x20result\x20is',JSON[_0xa6f7('0x39')](_0xd6304f));throw new Error(_0xa6f7('0x3a')+JSON[_0xa6f7('0x39')](_0xd6304f));}}}else{logger[_0xa6f7('0x29')](_0xa6f7('0x3b'),JSON[_0xa6f7('0x39')](_0xd6304f));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa6f7('0x39')](_0xd6304f));}})[_0xa6f7('0x3c')](function(_0xc25a1b){console[_0xa6f7('0x29')](_0xc25a1b);});}function getZohoUser(_0x18d18c,_0x56a773){return new BPromise(function(_0x45acdd,_0x12d966){request(_0x18d18c)['then'](function(_0x1b5213){var _0x33bbd9=null;if(_0x1b5213){_0x33bbd9=_0x1b5213[_0xa6f7('0x3d')][0x0];_0x33bbd9['enduserType']=_0x56a773;}_0x45acdd(_0x33bbd9);})[_0xa6f7('0x3c')](function(_0x36330b){_0x12d966(_0x36330b);});});}function createEndUser(_0x589d94,_0x39349a,_0x13c7c4,_0x3ecb88,_0x14d532,_0x40aaf5){var _0x13c7c4=getName(_0x13c7c4);return request({'method':_0xa6f7('0x3e'),'uri':_0xa6f7('0x3f')+_0x39349a+_0xa6f7('0x40')+_[_0xa6f7('0x41')](_0x40aaf5[_0xa6f7('0x42')])+'s','body':{'data':[{'Last_Name':_0x13c7c4[0x1],'First_Name':_0x13c7c4[0x0],'Phone':_0x3ecb88,'Owner':{'name':!_[_0xa6f7('0x1e')](_0x14d532[_0xa6f7('0x43')][_0xa6f7('0x1a')])?_0x14d532['role']['name']:!_[_0xa6f7('0x1e')](_0x14d532[_0xa6f7('0x44')])?_0x14d532[_0xa6f7('0x44')]+'\x20'+_0x14d532[_0xa6f7('0x45')]:_0x14d532[_0xa6f7('0x45')],'id':_0x14d532['id']}}]},'headers':{'Authorization':_0xa6f7('0x31')+_0x589d94},'json':!![]})[_0xa6f7('0x27')](function(_0x404552){if(_0x404552&&_0x404552[_0xa6f7('0x3d')][0x0][_0xa6f7('0x46')]==='SUCCESS'){var _0x41917c=_0x404552[_0xa6f7('0x3d')][0x0]['details'];_0x41917c[_0xa6f7('0x47')]=_[_0xa6f7('0x41')](_0x40aaf5[_0xa6f7('0x42')])+'s';return _0x41917c;}logger[_0xa6f7('0x29')]('The\x20failing\x20result\x20is',JSON[_0xa6f7('0x39')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0xa6f7('0x3c')](function(_0x1ea7e1){console[_0xa6f7('0x48')](_0xa6f7('0x49'),_0x1ea7e1);});}function getEndUser(_0x386200,_0x1313dc,_0x979a33,_0x5a9e9e,_0x17d934,_0x40dbe6,_0x55cb70){var _0x2026a9={'method':_0xa6f7('0x2e'),'uri':'','headers':{'Authorization':_0xa6f7('0x31')+_0x386200},'json':!![]};switch(_0x55cb70['moduleSearch']){case _0xa6f7('0x4a'):_0x2026a9['uri']=_0xa6f7('0x3f')+_0x1313dc+_0xa6f7('0x4b')+_0x17d934+'))';return getZohoUser(_0x2026a9,_0xa6f7('0x4c'))['then'](function(_0x5df564){if(_0x5df564)return _0x5df564;_0x2026a9[_0xa6f7('0x4d')]='https://www.zohoapis.'+_0x1313dc+_0xa6f7('0x4e')+_0x17d934+'))';return getZohoUser(_0x2026a9,'Leads')['then'](function(_0x1e7089){if(_0x1e7089)return _0x1e7089;if(_0x55cb70[_0xa6f7('0x42')]!=_0xa6f7('0x4f')){return createEndUser(_0x386200,_0x1313dc,_0x5a9e9e,_0x17d934,_0x40dbe6,_0x55cb70);}else{return{};}});});break;case _0xa6f7('0x50'):_0x2026a9[_0xa6f7('0x4d')]=_0xa6f7('0x3f')+_0x1313dc+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x17d934+'))';return getZohoUser(_0x2026a9,_0xa6f7('0x4c'))[_0xa6f7('0x27')](function(_0x58080f){if(_0x58080f)return _0x58080f;if(_0x55cb70[_0xa6f7('0x42')]!='nothing'){return createEndUser(_0x386200,_0x1313dc,_0x5a9e9e,_0x17d934,_0x40dbe6,_0x55cb70);}else{return{};}});break;case _0xa6f7('0x51'):_0x2026a9['uri']='https://www.zohoapis.'+_0x1313dc+_0xa6f7('0x4e')+_0x17d934+'))';return getZohoUser(_0x2026a9,_0xa6f7('0x52'))[_0xa6f7('0x27')](function(_0x2b3de2){if(_0x2b3de2)return _0x2b3de2;if(_0x55cb70[_0xa6f7('0x42')]!='nothing'){return createEndUser(_0x386200,_0x1313dc,_0x5a9e9e,_0x17d934,_0x40dbe6,_0x55cb70);}else{return{};}});break;}}function getCall(_0x340d3f,_0x34de29,_0x5cddc9,_0x4b83f6,_0x5991f9,_0x1d7bcd,_0x1c2099,_0x134dd7){logger['info'](_0xa6f7('0x53'));var _0x5dab05={};_0x5dab05[_0xa6f7('0x54')]={'name':!_[_0xa6f7('0x1e')](_0x4b83f6[_0xa6f7('0x43')][_0xa6f7('0x1a')])&&!_[_0xa6f7('0x1e')](_0x4b83f6['profile']['name'])&&_0x4b83f6[_0xa6f7('0x36')][_0xa6f7('0x1a')]===_0xa6f7('0x55')?_0x4b83f6[_0xa6f7('0x43')]['name']:!_[_0xa6f7('0x1e')](_0x4b83f6[_0xa6f7('0x44')])?_0x4b83f6[_0xa6f7('0x44')]+'\x20'+_0x4b83f6[_0xa6f7('0x45')]:_0x4b83f6[_0xa6f7('0x45')],'id':_0x4b83f6['id']};_0x5dab05[_0xa6f7('0x56')]=intUtil['getString'](_0x1d7bcd[_0xa6f7('0x57')],_0x1c2099,'\x20');_0x5dab05[_0xa6f7('0x58')]=intUtil[_0xa6f7('0x59')](_0x1d7bcd['Descriptions'],_0x1c2099,'\x0a');if(_0x5991f9[_0xa6f7('0x47')]===_0xa6f7('0x4c')){_0x5dab05[_0xa6f7('0x5a')]={'name':!_[_0xa6f7('0x1e')](_0x5991f9['Full_Name'])?_0x5991f9['Full_Name']:!_[_0xa6f7('0x1e')](_0x5991f9[_0xa6f7('0x5b')])?_0x5991f9[_0xa6f7('0x5b')]+'\x20'+_0x5991f9[_0xa6f7('0x5c')]:_0x5991f9[_0xa6f7('0x5c')],'id':_0x5991f9['id']};}if(_0x5991f9[_0xa6f7('0x47')]===_0xa6f7('0x52')){_0x5dab05['What_Id']={'name':!_[_0xa6f7('0x1e')](_0x5991f9[_0xa6f7('0x5d')])?_0x5991f9[_0xa6f7('0x5d')]:!_[_0xa6f7('0x1e')](_0x5991f9[_0xa6f7('0x5b')])?_0x5991f9[_0xa6f7('0x5b')]+'\x20'+_0x5991f9[_0xa6f7('0x5c')]:_0x5991f9[_0xa6f7('0x5c')],'id':_0x5991f9['id']};_0x5dab05[_0xa6f7('0x5e')]=_[_0xa6f7('0x41')](_0x5991f9[_0xa6f7('0x47')]);}if(_0x1c2099['talktime']){_0x5dab05[_0xa6f7('0x5f')]=moment['utc'](parseInt(_0x1c2099[_0xa6f7('0x60')])*0x3e8)['format'](_0xa6f7('0x61'));}else if(_0x1c2099[_0xa6f7('0x62')]&&_0x1c2099['endtime']){_0x5dab05[_0xa6f7('0x5f')]=moment[_0xa6f7('0x63')](moment(_0x1c2099[_0xa6f7('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xa6f7('0x65')](moment(_0x1c2099['starttime'],_0xa6f7('0x66'))))[_0xa6f7('0x2f')]('mm:ss');}switch(_0x1c2099[_0xa6f7('0x67')]){case'called':_0x5dab05[_0xa6f7('0x68')]='Called';break;case _0xa6f7('0x69'):case _0xa6f7('0x6a'):_0x5dab05[_0xa6f7('0x68')]=_0xa6f7('0x6b');break;case _0xa6f7('0x6c'):_0x5dab05[_0xa6f7('0x68')]=_0xa6f7('0x6d');break;case _0xa6f7('0x6e'):_0x5dab05[_0xa6f7('0x68')]=_0xa6f7('0x6f');break;case _0xa6f7('0x70'):_0x5dab05[_0xa6f7('0x68')]='Timeout';default:}_0x5dab05[_0xa6f7('0x71')]=(_0x134dd7===_0xa6f7('0x72')?moment(_0x1c2099[_0xa6f7('0x73')])[_0xa6f7('0x2f')](_0xa6f7('0x66')):moment(_0x1c2099[_0xa6f7('0x74')])[_0xa6f7('0x2f')](_0xa6f7('0x66')))||moment()['format'](_0xa6f7('0x66'));_0x5dab05[_0xa6f7('0x75')]=_0x134dd7||_0xa6f7('0x76');_0x5dab05=_['merge'](_0x5dab05,getCustomFields(_0x1d7bcd[_0xa6f7('0x77')],_0x1c2099));return request({'method':_0xa6f7('0x3e'),'uri':_0xa6f7('0x3f')+_0x34de29+_0xa6f7('0x78'),'headers':{'Authorization':_0xa6f7('0x31')+_0x340d3f},'body':{'data':[_0x5dab05]},'json':!![]})[_0xa6f7('0x27')](function(_0xe97f85){if(_0xe97f85&&_0xe97f85[_0xa6f7('0x3d')][0x0]['code']==='SUCCESS'){logger[_0xa6f7('0x2c')](_0xa6f7('0x79'));return{'id':_0xe97f85['data'][0x0][_0xa6f7('0x7a')]['id']};}})[_0xa6f7('0x3c')](function(_0x1bec76){logger['info'](_0xa6f7('0x7b'),_0x1bec76['stack']);console['log']('err',_0x1bec76);});}exports['queue']=function(_0x522e5d,_0x39ba3d,_0x3502b3,_0x41dc51,_0x5f00a7,_0x849412){var _0x1d3241,_0x40a70c,_0x69c173;_0x849412[_0xa6f7('0x7c')]=intUtil[_0xa6f7('0x7d')](_0x849412[_0xa6f7('0x7c')]);_0x849412[_0xa6f7('0x7e')]=intUtil[_0xa6f7('0x7d')](_0x849412[_0xa6f7('0x7e')]);if(_0x5f00a7&&_0x5f00a7['monitor_format']){logger[_0xa6f7('0x2c')](_0xa6f7('0x7f'),_0xa6f7('0x80'));_0x39ba3d[_0xa6f7('0x81')]=_0x849412[_0xa6f7('0x7e')]+_0xa6f7('0x82')+_0x39ba3d[_0xa6f7('0x83')]+_0xa6f7('0x84')+md5(_0x39ba3d[_0xa6f7('0x83')]);}else{_0x39ba3d[_0xa6f7('0x81')]='';}var _0x5bd6a9=_0x849412['host']==='zoho.eu'?'eu':_0xa6f7('0x85');return getAccessToken(_0x849412)[_0xa6f7('0x27')](function(_0x3ba166){_0x69c173=_0x3ba166;return getUser(_0x69c173,_0x5bd6a9,_0x849412,_0x41dc51['email']);})[_0xa6f7('0x27')](function(_0x36decb){_0x1d3241=_0x36decb;logger['info'](_0xa6f7('0x86'),_0x1d3241['id']);return getEndUser(_0x69c173,_0x5bd6a9,_0x849412,_0x39ba3d[_0xa6f7('0x87')],_0x39ba3d['calleridnum'],_0x1d3241,_0x3502b3);})['then'](function(_0xadf749){_0x40a70c=_0xadf749;return getCall(_0x69c173,_0x5bd6a9,_0x849412,_0x1d3241,_0x40a70c,_0x3502b3,_0x39ba3d,'Inbound');})[_0xa6f7('0x27')](function(_0x1959cb){if(_0x1959cb){logger['info']('The\x20Call\x20ID\x20is:',_0x1959cb['id']);logger[_0xa6f7('0x2c')](_0xa6f7('0x7f'),_0xa6f7('0x88'));emit(util['format'](_0xa6f7('0x89'),_0x41dc51[_0xa6f7('0x1a')]),_0xa6f7('0x8a'),{'uri':_0xa6f7('0x8b')+_0x849412[_0xa6f7('0x7c')]+_0xa6f7('0x8c')+_0x1959cb['id']});}})[_0xa6f7('0x3c')](function(_0x3b03ab){logger[_0xa6f7('0x29')](_0xa6f7('0x7f'),JSON[_0xa6f7('0x39')](_0x3b03ab));});};exports['outbound']=function(_0x426f6e,_0x24de88,_0x2f6866,_0x1f3f99,_0x46e6c4,_0xdf6850,_0x5f0f84){var _0x446ba4,_0x1f0c90,_0x346c8f;_0xdf6850[_0xa6f7('0x7c')]=intUtil[_0xa6f7('0x7d')](_0xdf6850[_0xa6f7('0x7c')]);_0xdf6850['serverUrl']=intUtil['stripTrailingSlash'](_0xdf6850[_0xa6f7('0x7e')]);if(_0x5f0f84&&_0x5f0f84[_0xa6f7('0x8d')]&&_0x5f0f84[_0xa6f7('0x8d')]!==_0xa6f7('0x8e')){logger[_0xa6f7('0x2c')]('[OUTBOUND]',_0xa6f7('0x80'));_0x24de88['recordingURL']=_0xdf6850[_0xa6f7('0x7e')]+_0xa6f7('0x82')+_0x24de88['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x24de88[_0xa6f7('0x83')]);}var _0x4e97fd=_0xdf6850['host']===_0xa6f7('0x8f')?'eu':_0xa6f7('0x85');return getAccessToken(_0xdf6850)[_0xa6f7('0x27')](function(_0x1d43eb){_0x346c8f=_0x1d43eb;return getUser(_0x346c8f,_0x4e97fd,_0xdf6850,_0x1f3f99['email']);})[_0xa6f7('0x27')](function(_0xd2a739){_0x446ba4=_0xd2a739;logger[_0xa6f7('0x2c')](_0xa6f7('0x86'),_0x446ba4['id']);return getEndUser(_0x346c8f,_0x4e97fd,_0xdf6850,_0x24de88[_0xa6f7('0x90')],_0x24de88[_0xa6f7('0x91')],_0x446ba4,_0x2f6866);})['then'](function(_0x3e1f98){_0x1f0c90=_0x3e1f98;return getCall(_0x346c8f,_0x4e97fd,_0xdf6850,_0x446ba4,_0x1f0c90,_0x2f6866,_0x24de88,'Outbound');})['then'](function(_0x1d5e15){if(_0x1d5e15){logger[_0xa6f7('0x2c')]('The\x20Call\x20ID\x20is:',_0x1d5e15['id']);logger[_0xa6f7('0x2c')](_0xa6f7('0x92'),_0xa6f7('0x88'));emit(util['format'](_0xa6f7('0x89'),_0x1f3f99['name']),_0xa6f7('0x8a'),{'uri':_0xa6f7('0x8b')+_0xdf6850['host']+_0xa6f7('0x8c')+_0x1d5e15['id']});}})['catch'](function(_0x1dcf76){logger[_0xa6f7('0x29')]('[OUTBOUND]',JSON[_0xa6f7('0x39')](_0x1dcf76));});};exports[_0xa6f7('0x93')]=function(_0x1afd68,_0x3aa798,_0xb23da6,_0x486eee,_0x6590a0,_0x37b898){var _0x1ecef6,_0x13219e,_0x5c66e6;_0x37b898[_0xa6f7('0x7c')]=intUtil[_0xa6f7('0x7d')](_0x37b898[_0xa6f7('0x7c')]);_0x37b898[_0xa6f7('0x7e')]=intUtil[_0xa6f7('0x7d')](_0x37b898[_0xa6f7('0x7e')]);if(_0x6590a0&&_0x6590a0[_0xa6f7('0x94')]){logger[_0xa6f7('0x2c')]('['+_0x3aa798['lastevent'][_0xa6f7('0x95')]()+']',_0xa6f7('0x80'));_0x3aa798['recordingURL']=_0x37b898[_0xa6f7('0x7e')]+'/api/voice/recordings/'+_0x3aa798[_0xa6f7('0x83')]+_0xa6f7('0x84')+md5(_0x3aa798[_0xa6f7('0x83')]);}else{_0x3aa798[_0xa6f7('0x81')]='';}var _0x1c1884=_0x37b898[_0xa6f7('0x7c')]===_0xa6f7('0x8f')?'eu':_0xa6f7('0x85');return getAccessToken(_0x37b898)['then'](function(_0x5d3f32){_0x5c66e6=_0x5d3f32;return getUser(_0x5c66e6,_0x1c1884,_0x37b898);})[_0xa6f7('0x27')](function(_0x1b79a1){_0x1ecef6=_0x1b79a1;logger[_0xa6f7('0x2c')](_0xa6f7('0x86'),_0x1ecef6['id']);return getEndUser(_0x5c66e6,_0x1c1884,_0x37b898,_0x3aa798['calleridname'],_0x3aa798[_0xa6f7('0x96')],_0x1ecef6,_0xb23da6);})[_0xa6f7('0x27')](function(_0x5b87be){_0x13219e=_0x5b87be;return getCall(_0x5c66e6,_0x1c1884,_0x37b898,_0x1ecef6,_0x13219e,_0xb23da6,_0x3aa798,'Inbound');})[_0xa6f7('0x27')](function(_0x3b8deb){if(_0x3b8deb){logger['info']('The\x20Call\x20ID\x20is:',_0x3b8deb['id']);}})[_0xa6f7('0x3c')](function(_0x2309e0){logger['error']('['+_0x3aa798[_0xa6f7('0x67')]['toUpperCase']()+']',JSON[_0xa6f7('0x39')](_0x2309e0));});}; \ 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 796a88b..3962c48 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(_0x379fe8,_0x1e3e1d){var _0xc51733=function(_0x9d02cb){while(--_0x9d02cb){_0x379fe8['push'](_0x379fe8['shift']());}};_0xc51733(++_0x1e3e1d);}(_0x7a54,0x106));var _0x47a5=function(_0xa966c2,_0x97734a){_0xa966c2=_0xa966c2-0x0;var _0x586414=_0x7a54[_0xa966c2];return _0x586414;};'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(_0x3ea109,_0x57f9b0){var _0x4e1fac=function(_0x16839e){while(--_0x16839e){_0x3ea109['push'](_0x3ea109['shift']());}};_0x4e1fac(++_0x57f9b0);}(_0x7a54,0x106));var _0x47a5=function(_0x2e79b3,_0xd62752){_0x2e79b3=_0x2e79b3-0x0;var _0x43db1a=_0x7a54[_0x2e79b3];return _0x43db1a;};'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 d6be0b8..6776aff 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 _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0xe9855f,_0x2aba4c){var _0x3a0445=function(_0x3c265b){while(--_0x3c265b){_0xe9855f['push'](_0xe9855f['shift']());}};_0x3a0445(++_0x2aba4c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21b200,_0xfce4eb){_0x21b200=_0x21b200-0x0;var _0x399a96=_0x5f2f[_0x21b200];return _0x399a96;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +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(_0x517be4,_0x132cab){var _0x39fd7e=function(_0x14a83e){while(--_0x14a83e){_0x517be4['push'](_0x517be4['shift']());}};_0x39fd7e(++_0x132cab);}(_0x7a54,0x106));var _0x47a5=function(_0x3770a0,_0x355be8){_0x3770a0=_0x3770a0-0x0;var _0x143409=_0x7a54[_0x3770a0];return _0x143409;};'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 40024ff..bdf2fde 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 _0x885a=['debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing','client','Request','request'];(function(_0x53998d,_0x38e7cb){var _0x41ef56=function(_0xaa9c74){while(--_0xaa9c74){_0x53998d['push'](_0x53998d['shift']());}};_0x41ef56(++_0x38e7cb);}(_0x885a,0x180));var _0xa885=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x885a[_0x3e5086];return _0xfeb102;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var client=jayson[_0xa885('0x3')]['http']({'port':0x2329});client[_0xa885('0x4')]=function(_0x1c41b5,_0x2386ec){return new BPromise(function(_0x106e16,_0x108285){return client[_0xa885('0x5')](_0x1c41b5,_0x2386ec)['then'](function(_0x7ac6bd){logger[_0xa885('0x6')](_0xa885('0x7'),'routing',_0x1c41b5,_0x2386ec,_0x7ac6bd);if(_0x7ac6bd[_0xa885('0x8')]){logger[_0xa885('0x8')](_0xa885('0x7'),'routing',_0x1c41b5,_0x7ac6bd[_0xa885('0x8')][_0xa885('0x9')],_0x2386ec);return _0x108285(_0x7ac6bd[_0xa885('0x8')][_0xa885('0x9')]);}else{return _0x106e16(_0x7ac6bd[_0xa885('0xa')]);}})[_0xa885('0xb')](function(_0xcf5f96){logger['error'](_0xa885('0x7'),_0xa885('0x2'),_0x1c41b5,_0xcf5f96,_0x2386ec);return _0x108285(_0xcf5f96);});});};module[_0xa885('0xc')]=client; \ No newline at end of file +var _0x6c32=['../../config/logger','client','Request','request','then','debug','rpc','routing','error','message','result','exports','jayson/promise'];(function(_0x2d1eee,_0x5b5f3a){var _0x2f471c=function(_0x39ac06){while(--_0x39ac06){_0x2d1eee['push'](_0x2d1eee['shift']());}};_0x2f471c(++_0x5b5f3a);}(_0x6c32,0xb5));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var jayson=require(_0x26c3('0x0'));var BPromise=require('bluebird');var logger=require(_0x26c3('0x1'))('routing');var client=jayson[_0x26c3('0x2')]['http']({'port':0x2329});client[_0x26c3('0x3')]=function(_0x2c29dc,_0x5e8a24){return new BPromise(function(_0x4c2de2,_0x16867a){return client[_0x26c3('0x4')](_0x2c29dc,_0x5e8a24)[_0x26c3('0x5')](function(_0x402393){logger[_0x26c3('0x6')](_0x26c3('0x7'),_0x26c3('0x8'),_0x2c29dc,_0x5e8a24,_0x402393);if(_0x402393[_0x26c3('0x9')]){logger[_0x26c3('0x9')](_0x26c3('0x7'),'routing',_0x2c29dc,_0x402393['error'][_0x26c3('0xa')],_0x5e8a24);return _0x16867a(_0x402393['error'][_0x26c3('0xa')]);}else{return _0x4c2de2(_0x402393[_0x26c3('0xb')]);}})['catch'](function(_0x18deda){logger[_0x26c3('0x9')](_0x26c3('0x7'),_0x26c3('0x8'),_0x2c29dc,_0x18deda,_0x5e8a24);return _0x16867a(_0x18deda);});});};module[_0x26c3('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 66a2b5a..8c81aa3 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 _0x1a28=['./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server'];(function(_0x53120c,_0x2fc6f9){var _0x2f699e=function(_0x1e27d0){while(--_0x1e27d0){_0x53120c['push'](_0x53120c['shift']());}};_0x2f699e(++_0x2fc6f9);}(_0x1a28,0x10e));var _0x81a2=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0x1a28[_0x34e752];return _0x7c6347;};'use strict';var BPromise=require(_0x81a2('0x0'));var server=require(_0x81a2('0x1'));var Realtime=require(_0x81a2('0x2'));var EmailChannel=require(_0x81a2('0x3'));var mailAccount=require(_0x81a2('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x81a2('0x5'))['db'];function initRealtime(){return BPromise['resolve']()['then'](mailAccount[_0x81a2('0x6')]())[_0x81a2('0x7')](realtime[_0x81a2('0x8')]())['then'](function(){email[_0x81a2('0x9')](realtime[_0x81a2('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x81a2('0x7')](function(_0x2aa66f){return initRealtime();})[_0x81a2('0x7')](function(_0x4672ce){return db[_0x81a2('0xb')][_0x81a2('0xc')]({'attributes':['id',_0x81a2('0xd')],'raw':!![]});})[_0x81a2('0x7')](function(_0x1f395f){return setInterval(initRealtime,_0x1f395f['loginMailFrequency']*0x3e8);})[_0x81a2('0xe')](function(_0x33ca78){console[_0x81a2('0xf')](_0x33ca78);});}main(); \ No newline at end of file +var _0xdbf5=['refresh','mailAccounts','listen','findOne','loginMailFrequency','catch','./server','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x365b66,_0x2f1e4a){_0x365b66=_0x365b66-0x0;var _0x2da167=_0xdbf5[_0x365b66];return _0x2da167;};'use strict';var BPromise=require('bluebird');var server=require(_0x5dbf('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x5dbf('0x1'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x5dbf('0x2'))['db'];function initRealtime(){return BPromise[_0x5dbf('0x3')]()[_0x5dbf('0x4')](mailAccount[_0x5dbf('0x5')]())[_0x5dbf('0x4')](realtime[_0x5dbf('0x6')]())[_0x5dbf('0x4')](function(){email[_0x5dbf('0x7')](realtime[_0x5dbf('0x8')]);return realtime;});}function main(){return server[_0x5dbf('0x9')](realtime,email)[_0x5dbf('0x4')](function(_0x93e657){return initRealtime();})['then'](function(_0x134810){return db['Setting'][_0x5dbf('0xa')]({'attributes':['id',_0x5dbf('0xb')],'raw':!![]});})[_0x5dbf('0x4')](function(_0x1813bb){return setInterval(initRealtime,_0x1813bb['loginMailFrequency']*0x3e8);})[_0x5dbf('0xc')](function(_0x521a31){console['log'](_0x521a31);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 308e12b..952f789 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 _0xf813=['catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','then'];(function(_0x35ce13,_0x12d22b){var _0x2addc6=function(_0x26494e){while(--_0x26494e){_0x35ce13['push'](_0x35ce13['shift']());}};_0x2addc6(++_0x12d22b);}(_0xf813,0x1a8));var _0x3f81=function(_0x42879f,_0x3b68ed){_0x42879f=_0x42879f-0x0;var _0x328d93=_0xf813[_0x42879f];return _0x328d93;};'use strict';var _=require(_0x3f81('0x0'));var moment=require(_0x3f81('0x1'));var BPromise=require(_0x3f81('0x2'));var md5=require(_0x3f81('0x3'));var Redis=require(_0x3f81('0x4'));var config=require(_0x3f81('0x5'));var logger=require('../../../config/logger')(_0x3f81('0x6'));config[_0x3f81('0x7')]=_[_0x3f81('0x8')](config[_0x3f81('0x7')],{'host':_0x3f81('0x9'),'port':0x18eb});var io=require(_0x3f81('0xa'))(new Redis(config[_0x3f81('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0x3f81('0xb'));var md5Accounts={};function EmailChannel(_0xd345d1){logger[_0x3f81('0xc')](_0x3f81('0xd'));this[_0x3f81('0xe')]=_0xd345d1[_0x3f81('0xe')];this[_0x3f81('0xf')]={};this[_0x3f81('0x10')]=new EmailSmtp();}EmailChannel[_0x3f81('0x11')][_0x3f81('0x12')]=function(_0x1f6e34){var _0x21973a=this['mailAccounts'][_0x1f6e34];var _0x1f1dbe={'id':_0x21973a['id'],'name':_0x21973a[_0x3f81('0x13')],'key':_0x21973a[_0x3f81('0x14')],'active':_0x21973a[_0x3f81('0x15')],'Imap':{'status':_0x21973a[_0x3f81('0x16')][_0x3f81('0x17')],'messageStatus':_0x21973a[_0x3f81('0x16')][_0x3f81('0x18')],'total':_0x21973a['Imap'][_0x3f81('0x19')]}};if(_[_0x3f81('0x1a')](md5Accounts[_0x1f6e34])){md5Accounts[_0x1f6e34]={};}var _0x1eac81=md5(JSON[_0x3f81('0x1b')](_0x1f1dbe));if(md5Accounts[_0x1f6e34][_0x3f81('0x3')]!==_0x1eac81){md5Accounts[_0x1f6e34][_0x3f81('0x3')]=_0x1eac81;io[_0x3f81('0x12')](_0x3f81('0x1c'),_0x1f1dbe);}};EmailChannel['prototype']['refresh']=function(_0x43eb4d){for(var _0x2039c1 in _0x43eb4d){if(_0x43eb4d[_0x3f81('0x1d')](_0x2039c1)){if(_0x43eb4d[_0x2039c1][_0x3f81('0x16')]&&_0x43eb4d[_0x2039c1]['active']){var _0x3ca27f=_0x43eb4d[_0x2039c1][_0x3f81('0x16')];if(!this[_0x3f81('0xf')][_0x3f81('0x1d')](_0x3ca27f['id'])){this[_0x3f81('0xf')][_0x3ca27f['id']]=new EmailImap(_0x3ca27f,_0x43eb4d[_0x2039c1]['email']);this[_0x3f81('0xf')][_0x3ca27f['id']]['on'](_0x3f81('0x1e'),this[_0x3f81('0x1f')][_0x3f81('0x20')](this,_0x2039c1));this['imapAccounts'][_0x3ca27f['id']]['on']('email',this[_0x3f81('0x21')]['bind'](this,_0x2039c1));this[_0x3f81('0xf')][_0x3ca27f['id']]['on'](_0x3f81('0x22'),this[_0x3f81('0x23')][_0x3f81('0x20')](this,_0x2039c1));this[_0x3f81('0xf')][_0x3ca27f['id']]['on'](_0x3f81('0x24'),this[_0x3f81('0x25')][_0x3f81('0x20')](this,_0x2039c1));}}else{if(_[_0x3f81('0x1a')](this[_0x3f81('0xe')][_0x2039c1][_0x3f81('0x16')])){this[_0x3f81('0xe')][_0x2039c1][_0x3f81('0x16')]={};}this[_0x3f81('0xe')][_0x2039c1][_0x3f81('0x16')]['status']=_0x3f81('0x26');this[_0x3f81('0xe')][_0x2039c1]['Imap']['messageStatus']='';this[_0x3f81('0x12')](_0x2039c1);}}}};EmailChannel[_0x3f81('0x11')][_0x3f81('0x1f')]=function(_0x20c0c7,_0x118ad7){if(this[_0x3f81('0xe')][_0x20c0c7]){this['mailAccounts'][_0x20c0c7][_0x3f81('0x16')][_0x3f81('0x17')]=_0x3f81('0x27');this[_0x3f81('0xe')][_0x20c0c7]['Imap'][_0x3f81('0x18')]=_0x118ad7[_0x3f81('0x13')];if(_0x118ad7[_0x3f81('0x28')]){this['mailAccounts'][_0x20c0c7][_0x3f81('0x16')][_0x3f81('0x19')]=_0x118ad7[_0x3f81('0x28')][_0x3f81('0x19')];}return this[_0x3f81('0x12')](_0x20c0c7);}};EmailChannel[_0x3f81('0x11')][_0x3f81('0x21')]=function(_0x3660cb,_0x449cc4){logger[_0x3f81('0xc')](_0x3f81('0x29'),_0x449cc4['firstName'],_0x449cc4['lastName'],_0x449cc4[_0x3f81('0x2a')],_0x3660cb);if(this[_0x3f81('0xe')][_0x3660cb]){return mailAccount['notify'](_0x3660cb,_0x449cc4)[_0x3f81('0x2b')](function(_0x3d1e9b){if(_0x3d1e9b){logger[_0x3f81('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0x3f81('0x2c')](function(_0x1b2274){logger['error'](_0x3f81('0x2d'),JSON['stringify'](_0x1b2274));});}};EmailChannel[_0x3f81('0x11')][_0x3f81('0x23')]=function(_0x42bdda){if(this['mailAccounts'][_0x42bdda]&&this[_0x3f81('0xe')][_0x42bdda]['Imap']){if(this[_0x3f81('0xf')][this[_0x3f81('0xe')][_0x42bdda][_0x3f81('0x16')]['id']]){delete this[_0x3f81('0xf')][this[_0x3f81('0xe')][_0x42bdda][_0x3f81('0x16')]['id']];}this[_0x3f81('0xe')][_0x42bdda][_0x3f81('0x16')][_0x3f81('0x2e')]=moment();this['emit'](_0x42bdda);}};EmailChannel[_0x3f81('0x11')][_0x3f81('0x25')]=function(_0xd0a9db,_0x1eeb7b){if(this['mailAccounts'][_0xd0a9db]){this[_0x3f81('0xe')][_0xd0a9db][_0x3f81('0x16')][_0x3f81('0x17')]=_0x3f81('0x24');this[_0x3f81('0xe')][_0xd0a9db][_0x3f81('0x16')]['messageStatus']=_0x1eeb7b;return this[_0x3f81('0x12')](_0xd0a9db);}};EmailChannel[_0x3f81('0x11')][_0x3f81('0x2f')]=function(_0x1a5da4,_0x101221){return this[_0x3f81('0x10')]['send'](_0x1a5da4,_0x101221);};EmailChannel[_0x3f81('0x11')][_0x3f81('0x30')]=function(_0x255bbe){var _0x38de39=this;if(this[_0x3f81('0xe')][_0x255bbe['id']]){if(_[_0x3f81('0x1a')](this['mailAccounts'][_0x255bbe['id']][_0x3f81('0x31')])){this[_0x3f81('0xe')][_0x255bbe['id']]['Smtp']={};}this[_0x3f81('0xe')][_0x255bbe['id']]['Smtp'][_0x3f81('0x2e')]=moment();return new BPromise(function(_0xd6c594,_0x5dea70){return _0x38de39['smtp']['verify'](_0x255bbe)['then'](function(_0x2be0c8){_0x38de39[_0x3f81('0xe')][_0x255bbe['id']]['Smtp'][_0x3f81('0x17')]=_0x3f81('0x32');_0x38de39[_0x3f81('0xe')][_0x255bbe['id']][_0x3f81('0x31')][_0x3f81('0x18')]='';_0x38de39['emit'](_0x255bbe['id']);_0xd6c594(_0x2be0c8);})[_0x3f81('0x2c')](function(_0x4189e6){_0x38de39[_0x3f81('0xe')][_0x255bbe['id']][_0x3f81('0x31')]['status']='error';_0x38de39['mailAccounts'][_0x255bbe['id']][_0x3f81('0x31')]['messageStatus']=_0x4189e6;_0x38de39['emit'](_0x255bbe['id']);_0x5dea70(_0x4189e6);});});}return this[_0x3f81('0x10')]['verify'](_0x255bbe);};module[_0x3f81('0x33')]=EmailChannel; \ No newline at end of file +var _0x5272=['hasOwnProperty','box','handleImapBox','bind','handleImapEmail','error','handleImapError','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','lastSync','send','Smtp','verify','verified','exports','moment','bluebird','ioredis','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','status','Imap','messageStatus','isNil','md5','refresh'];(function(_0x38e06f,_0x26f857){var _0x5cd1a3=function(_0x408835){while(--_0x408835){_0x38e06f['push'](_0x38e06f['shift']());}};_0x5cd1a3(++_0x26f857);}(_0x5272,0xae));var _0x2527=function(_0x4814d6,_0x40b387){_0x4814d6=_0x4814d6-0x0;var _0x283abe=_0x5272[_0x4814d6];return _0x283abe;};'use strict';var _=require('lodash');var moment=require(_0x2527('0x0'));var BPromise=require(_0x2527('0x1'));var md5=require('md5');var Redis=require(_0x2527('0x2'));var config=require('../../../config/environment');var logger=require(_0x2527('0x3'))(_0x2527('0x4'));config[_0x2527('0x5')]=_[_0x2527('0x6')](config[_0x2527('0x5')],{'host':_0x2527('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2527('0x5')]));var EmailImap=require(_0x2527('0x8'));var EmailSmtp=require(_0x2527('0x9'));var mailAccount=require(_0x2527('0xa'));var md5Accounts={};function EmailChannel(_0x67e197){logger[_0x2527('0xb')](_0x2527('0xc'));this[_0x2527('0xd')]=_0x67e197[_0x2527('0xd')];this[_0x2527('0xe')]={};this[_0x2527('0xf')]=new EmailSmtp();}EmailChannel[_0x2527('0x10')][_0x2527('0x11')]=function(_0x127467){var _0x198822=this[_0x2527('0xd')][_0x127467];var _0x38cc4f={'id':_0x198822['id'],'name':_0x198822['name'],'key':_0x198822[_0x2527('0x12')],'active':_0x198822[_0x2527('0x13')],'Imap':{'status':_0x198822['Imap'][_0x2527('0x14')],'messageStatus':_0x198822[_0x2527('0x15')][_0x2527('0x16')],'total':_0x198822[_0x2527('0x15')]['total']}};if(_[_0x2527('0x17')](md5Accounts[_0x127467])){md5Accounts[_0x127467]={};}var _0x1b6729=md5(JSON['stringify'](_0x38cc4f));if(md5Accounts[_0x127467][_0x2527('0x18')]!==_0x1b6729){md5Accounts[_0x127467][_0x2527('0x18')]=_0x1b6729;io[_0x2527('0x11')]('mailAccount:update',_0x38cc4f);}};EmailChannel[_0x2527('0x10')][_0x2527('0x19')]=function(_0x4d6efa){for(var _0xddbb83 in _0x4d6efa){if(_0x4d6efa[_0x2527('0x1a')](_0xddbb83)){if(_0x4d6efa[_0xddbb83][_0x2527('0x15')]&&_0x4d6efa[_0xddbb83][_0x2527('0x13')]){var _0x431cad=_0x4d6efa[_0xddbb83][_0x2527('0x15')];if(!this[_0x2527('0xe')][_0x2527('0x1a')](_0x431cad['id'])){this[_0x2527('0xe')][_0x431cad['id']]=new EmailImap(_0x431cad,_0x4d6efa[_0xddbb83][_0x2527('0x4')]);this['imapAccounts'][_0x431cad['id']]['on'](_0x2527('0x1b'),this[_0x2527('0x1c')][_0x2527('0x1d')](this,_0xddbb83));this[_0x2527('0xe')][_0x431cad['id']]['on'](_0x2527('0x4'),this[_0x2527('0x1e')][_0x2527('0x1d')](this,_0xddbb83));this[_0x2527('0xe')][_0x431cad['id']]['on']('end',this['handleImapEnd']['bind'](this,_0xddbb83));this[_0x2527('0xe')][_0x431cad['id']]['on'](_0x2527('0x1f'),this[_0x2527('0x20')]['bind'](this,_0xddbb83));}}else{if(_[_0x2527('0x17')](this[_0x2527('0xd')][_0xddbb83]['Imap'])){this[_0x2527('0xd')][_0xddbb83][_0x2527('0x15')]={};}this[_0x2527('0xd')][_0xddbb83]['Imap']['status']=_0x2527('0x21');this[_0x2527('0xd')][_0xddbb83][_0x2527('0x15')]['messageStatus']='';this[_0x2527('0x11')](_0xddbb83);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x2a93a8,_0x250b6c){if(this[_0x2527('0xd')][_0x2a93a8]){this['mailAccounts'][_0x2a93a8][_0x2527('0x15')][_0x2527('0x14')]=_0x2527('0x22');this[_0x2527('0xd')][_0x2a93a8][_0x2527('0x15')][_0x2527('0x16')]=_0x250b6c['name'];if(_0x250b6c[_0x2527('0x23')]){this[_0x2527('0xd')][_0x2a93a8][_0x2527('0x15')][_0x2527('0x24')]=_0x250b6c[_0x2527('0x23')]['total'];}return this[_0x2527('0x11')](_0x2a93a8);}};EmailChannel[_0x2527('0x10')][_0x2527('0x1e')]=function(_0x2fc7db,_0x31eb9b){logger[_0x2527('0xb')](_0x2527('0x25'),_0x31eb9b[_0x2527('0x26')],_0x31eb9b['lastName'],_0x31eb9b['from'],_0x2fc7db);if(this['mailAccounts'][_0x2fc7db]){return mailAccount['notify'](_0x2fc7db,_0x31eb9b)[_0x2527('0x27')](function(_0x33d278){if(_0x33d278){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x2527('0x28')](function(_0x75fd7f){logger['error'](_0x2527('0x29'),JSON[_0x2527('0x2a')](_0x75fd7f));});}};EmailChannel[_0x2527('0x10')][_0x2527('0x2b')]=function(_0x34f107){if(this[_0x2527('0xd')][_0x34f107]&&this[_0x2527('0xd')][_0x34f107]['Imap']){if(this[_0x2527('0xe')][this['mailAccounts'][_0x34f107][_0x2527('0x15')]['id']]){delete this[_0x2527('0xe')][this[_0x2527('0xd')][_0x34f107][_0x2527('0x15')]['id']];}this[_0x2527('0xd')][_0x34f107][_0x2527('0x15')][_0x2527('0x2c')]=moment();this[_0x2527('0x11')](_0x34f107);}};EmailChannel[_0x2527('0x10')][_0x2527('0x20')]=function(_0x17cc8b,_0xe179f7){if(this[_0x2527('0xd')][_0x17cc8b]){this[_0x2527('0xd')][_0x17cc8b][_0x2527('0x15')][_0x2527('0x14')]=_0x2527('0x1f');this[_0x2527('0xd')][_0x17cc8b][_0x2527('0x15')]['messageStatus']=_0xe179f7;return this[_0x2527('0x11')](_0x17cc8b);}};EmailChannel[_0x2527('0x10')]['sendMail']=function(_0x105c3f,_0x518160){return this[_0x2527('0xf')][_0x2527('0x2d')](_0x105c3f,_0x518160);};EmailChannel[_0x2527('0x10')]['verifySmtp']=function(_0x48ee58){var _0x3895b9=this;if(this[_0x2527('0xd')][_0x48ee58['id']]){if(_['isNil'](this['mailAccounts'][_0x48ee58['id']][_0x2527('0x2e')])){this['mailAccounts'][_0x48ee58['id']]['Smtp']={};}this[_0x2527('0xd')][_0x48ee58['id']][_0x2527('0x2e')][_0x2527('0x2c')]=moment();return new BPromise(function(_0x440438,_0x52eb8f){return _0x3895b9[_0x2527('0xf')][_0x2527('0x2f')](_0x48ee58)[_0x2527('0x27')](function(_0x2a11d6){_0x3895b9['mailAccounts'][_0x48ee58['id']]['Smtp'][_0x2527('0x14')]=_0x2527('0x30');_0x3895b9[_0x2527('0xd')][_0x48ee58['id']][_0x2527('0x2e')][_0x2527('0x16')]='';_0x3895b9[_0x2527('0x11')](_0x48ee58['id']);_0x440438(_0x2a11d6);})[_0x2527('0x28')](function(_0x201e64){_0x3895b9[_0x2527('0xd')][_0x48ee58['id']][_0x2527('0x2e')]['status']=_0x2527('0x1f');_0x3895b9[_0x2527('0xd')][_0x48ee58['id']][_0x2527('0x2e')]['messageStatus']=_0x201e64;_0x3895b9['emit'](_0x48ee58['id']);_0x52eb8f(_0x201e64);});});}return this[_0x2527('0xf')]['verify'](_0x48ee58);};module[_0x2527('0x31')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index a4828b4..a22e35e 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 _0xec6a=['parser','handleFetchEnd','handleEnd','textCode','hasOwnProperty','upperFirst','path','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','ready','handleReady','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','password','host','port','tls','required','user','getHost','anonymous@xcally.com','openBox','handleOpenBox','bind','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','once','handleFetchError','error','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser'];(function(_0xa2244a,_0x22e019){var _0x454ec5=function(_0x25e373){while(--_0x25e373){_0xa2244a['push'](_0xa2244a['shift']());}};_0x454ec5(++_0x22e019);}(_0xec6a,0x186));var _0xaec6=function(_0x5567f3,_0x427be8){_0x5567f3=_0x5567f3-0x0;var _0x35e98e=_0xec6a[_0x5567f3];return _0x35e98e;};'use strict';var fs=require('fs');var path=require(_0xaec6('0x0'));var util=require(_0xaec6('0x1'));var Imap=require(_0xaec6('0x2'));var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0xaec6('0x3'))[_0xaec6('0x4')];var Iconv=require(_0xaec6('0x5'))[_0xaec6('0x6')];var EventEmitter=require(_0xaec6('0x7'))[_0xaec6('0x8')];var utils=require('./utils');var logger=require(_0xaec6('0x9'))(_0xaec6('0xa'));function EmailImap(_0x5a8dad,_0x48f71a){this[_0xaec6('0xb')]=_0xaec6('0xc');this[_0xaec6('0xd')]=this[_0xaec6('0xe')](_0x5a8dad,_0x48f71a);this[_0xaec6('0x2')]=new Imap(this[_0xaec6('0xd')]);this['imap']['once'](_0xaec6('0xf'),this[_0xaec6('0x10')]['bind'](this));this[_0xaec6('0x2')]['once']('end',this['handleEnd']['bind'](this));this[_0xaec6('0x2')]['on']('error',this[_0xaec6('0x11')]['bind'](this));this[_0xaec6('0x2')][_0xaec6('0x12')]();}util[_0xaec6('0x13')](EmailImap,EventEmitter);EmailImap[_0xaec6('0x14')][_0xaec6('0xe')]=function(_0x166979,_0x1aaf39){var _0x117828={'connTimeout':_0x166979[_0xaec6('0x15')]?_0x166979[_0xaec6('0x15')]*0x3e8:0x2710,'authTimeout':_0x166979[_0xaec6('0x16')]?_0x166979[_0xaec6('0x16')]*0x3e8:0x1388};if(_[_0xaec6('0x17')](_0x166979[_0xaec6('0x18')])){if(_0x166979[_0xaec6('0x19')]){_0x117828['user']=_0x166979['user'];_0x117828[_0xaec6('0x1a')]=_0x166979[_0xaec6('0x1a')];}_0x117828[_0xaec6('0x1b')]=_0x166979[_0xaec6('0x1b')];_0x117828['port']=_0x166979[_0xaec6('0x1c')]||0x3e1;if(_0x166979[_0xaec6('0x1d')]){_0x117828[_0xaec6('0x1d')]=!![];}else{_0x117828['tls']=![];_0x117828['autotls']=_0xaec6('0x1e');}}else{_0x117828[_0xaec6('0x1f')]=_0x166979[_0xaec6('0x1f')];_0x117828[_0xaec6('0x1a')]=_0x166979[_0xaec6('0x1a')];_0x117828[_0xaec6('0x1b')]=utils[_0xaec6('0x20')](_0x166979[_0xaec6('0x18')]);_0x117828[_0xaec6('0x1c')]=0x3e1;_0x117828[_0xaec6('0x1d')]=!![];}_0x117828[_0xaec6('0xa')]=_0x1aaf39||_0x166979[_0xaec6('0x1f')]||_0xaec6('0x21');return _0x117828;};EmailImap[_0xaec6('0x14')][_0xaec6('0x10')]=function(){this['imap'][_0xaec6('0x22')](this[_0xaec6('0xb')],![],this[_0xaec6('0x23')][_0xaec6('0x24')](this));};EmailImap[_0xaec6('0x14')][_0xaec6('0x23')]=function(_0x2a0ff6,_0x13e675){if(_0x2a0ff6){this['handleError'](_0x2a0ff6,!![]);}else{this[_0xaec6('0x25')](_0xaec6('0x26'),_0x13e675);this[_0xaec6('0x27')]();}};EmailImap[_0xaec6('0x14')][_0xaec6('0x28')]=function(_0x515558){if(_0x515558){this[_0xaec6('0x11')](_0x515558,!![]);}else{this[_0xaec6('0x2')][_0xaec6('0x29')]();}};EmailImap[_0xaec6('0x14')][_0xaec6('0x27')]=function(){this[_0xaec6('0x2')][_0xaec6('0x2a')]([_0xaec6('0x2b')],this['handleReadUnseen']['bind'](this));};EmailImap[_0xaec6('0x14')][_0xaec6('0x2c')]=function(_0x1ac06c,_0x5a0f13){if(_0x1ac06c){this[_0xaec6('0x11')](_0x1ac06c,!![]);}else{if(_0x5a0f13[_0xaec6('0x2d')]){try{var _0x17d436=this[_0xaec6('0x2')][_0xaec6('0x2e')](_0x5a0f13,{'bodies':'','markSeen':!![]});_0x17d436['on'](_0xaec6('0x2f'),this[_0xaec6('0x30')][_0xaec6('0x24')](this));_0x17d436[_0xaec6('0x31')]('error',this[_0xaec6('0x32')][_0xaec6('0x24')](this));_0x17d436[_0xaec6('0x31')](_0xaec6('0x29'),this['handleFetchEnd'][_0xaec6('0x24')](this));}catch(_0x50d13){logger[_0xaec6('0x33')](_0x50d13);}}else{this[_0xaec6('0x2')][_0xaec6('0x34')](!![],this[_0xaec6('0x28')]['bind'](this));}}};EmailImap[_0xaec6('0x14')][_0xaec6('0x30')]=function(_0x2c5255,_0x563116){_0x2c5255['on'](_0xaec6('0x35'),this[_0xaec6('0x36')][_0xaec6('0x24')](this));_0x2c5255[_0xaec6('0x31')]('attributes',this[_0xaec6('0x37')][_0xaec6('0x24')](this));_0x2c5255['once']('end',this[_0xaec6('0x38')]['bind'](this));};EmailImap[_0xaec6('0x14')]['handleMessageBody']=function(_0x18907f,_0x3b8e5a){simpleParser(_0x18907f,{'Iconv':Iconv},this[_0xaec6('0x39')]['bind'](this));};EmailImap[_0xaec6('0x14')][_0xaec6('0x37')]=function(_0x551cc7){};EmailImap[_0xaec6('0x14')][_0xaec6('0x38')]=function(){};EmailImap[_0xaec6('0x14')]['handleSimpleParser']=function(_0x30fc83,_0x2b739a){if(_0x30fc83){logger[_0xaec6('0x33')](_0x30fc83);}else{var _0x2b6e8c=this;utils[_0xaec6('0x3a')](this['account'],_0x2b739a,function(_0x358176){_0x2b6e8c[_0xaec6('0x25')](_0xaec6('0xa'),_0x358176);});}};EmailImap[_0xaec6('0x14')][_0xaec6('0x3b')]=function(){this[_0xaec6('0x2')]['closeBox'](!![],this[_0xaec6('0x28')][_0xaec6('0x24')](this));};EmailImap[_0xaec6('0x14')]['handleFetchError']=function(_0x11a0e5){this[_0xaec6('0x11')](_0x11a0e5);this[_0xaec6('0x2')][_0xaec6('0x34')](!![],this['handleCloseBox'][_0xaec6('0x24')](this));};EmailImap[_0xaec6('0x14')][_0xaec6('0x3c')]=function(){this[_0xaec6('0x25')](_0xaec6('0x29'));};EmailImap['prototype'][_0xaec6('0x11')]=function(_0x55e7af,_0x4ee145){logger[_0xaec6('0x33')](_0xaec6('0x11'),this[_0xaec6('0xd')][_0xaec6('0xa')],JSON['stringify'](_0x55e7af));var _0x1dd594='';if(_0x55e7af){if(_0x55e7af[_0xaec6('0x3d')]){_0x1dd594=_0x55e7af['textCode'];}else{for(var _0x562ea9 in _0x55e7af){if(_0x55e7af[_0xaec6('0x3e')](_0x562ea9)){_0x1dd594+=_[_0xaec6('0x3f')](_0x562ea9)+':\x20'+_0x55e7af[_0x562ea9]+'\x0a';}}}}if(_0x4ee145){this[_0xaec6('0x2')][_0xaec6('0x29')]();}else{this[_0xaec6('0x25')](_0xaec6('0x33'),_0x1dd594);this[_0xaec6('0x25')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0xdcf0=['imap','lodash','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','once','ready','bind','handleEnd','error','handleError','connect','inherits','connTimeout','authentication','user','password','host','port','tls','required','getHost','service','anonymous@xcally.com','handleReady','openBox','mailbox','handleOpenBox','emit','readUnseen','prototype','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcf0,0x16e));var _0x0dcf=function(_0x2a4a6d,_0x2bb1cc){_0x2a4a6d=_0x2a4a6d-0x0;var _0x3e0dd2=_0xdcf0[_0x2a4a6d];return _0x3e0dd2;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0x0dcf('0x0'));var _=require(_0x0dcf('0x1'));var rs=require('randomstring');var simpleParser=require(_0x0dcf('0x2'))[_0x0dcf('0x3')];var Iconv=require(_0x0dcf('0x4'))[_0x0dcf('0x5')];var EventEmitter=require(_0x0dcf('0x6'))[_0x0dcf('0x7')];var utils=require(_0x0dcf('0x8'));var logger=require(_0x0dcf('0x9'))(_0x0dcf('0xa'));function EmailImap(_0x44f09d,_0x543b74){this['mailbox']=_0x0dcf('0xb');this[_0x0dcf('0xc')]=this[_0x0dcf('0xd')](_0x44f09d,_0x543b74);this[_0x0dcf('0x0')]=new Imap(this['account']);this['imap'][_0x0dcf('0xe')](_0x0dcf('0xf'),this['handleReady'][_0x0dcf('0x10')](this));this['imap']['once']('end',this[_0x0dcf('0x11')][_0x0dcf('0x10')](this));this[_0x0dcf('0x0')]['on'](_0x0dcf('0x12'),this[_0x0dcf('0x13')][_0x0dcf('0x10')](this));this[_0x0dcf('0x0')][_0x0dcf('0x14')]();}util[_0x0dcf('0x15')](EmailImap,EventEmitter);EmailImap['prototype'][_0x0dcf('0xd')]=function(_0x1db0e6,_0xfca3a9){var _0x48414e={'connTimeout':_0x1db0e6[_0x0dcf('0x16')]?_0x1db0e6[_0x0dcf('0x16')]*0x3e8:0x2710,'authTimeout':_0x1db0e6['authTimeout']?_0x1db0e6['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x1db0e6['service'])){if(_0x1db0e6[_0x0dcf('0x17')]){_0x48414e[_0x0dcf('0x18')]=_0x1db0e6[_0x0dcf('0x18')];_0x48414e['password']=_0x1db0e6[_0x0dcf('0x19')];}_0x48414e['host']=_0x1db0e6[_0x0dcf('0x1a')];_0x48414e[_0x0dcf('0x1b')]=_0x1db0e6['port']||0x3e1;if(_0x1db0e6[_0x0dcf('0x1c')]){_0x48414e[_0x0dcf('0x1c')]=!![];}else{_0x48414e[_0x0dcf('0x1c')]=![];_0x48414e['autotls']=_0x0dcf('0x1d');}}else{_0x48414e['user']=_0x1db0e6['user'];_0x48414e[_0x0dcf('0x19')]=_0x1db0e6[_0x0dcf('0x19')];_0x48414e[_0x0dcf('0x1a')]=utils[_0x0dcf('0x1e')](_0x1db0e6[_0x0dcf('0x1f')]);_0x48414e[_0x0dcf('0x1b')]=0x3e1;_0x48414e[_0x0dcf('0x1c')]=!![];}_0x48414e[_0x0dcf('0xa')]=_0xfca3a9||_0x1db0e6[_0x0dcf('0x18')]||_0x0dcf('0x20');return _0x48414e;};EmailImap['prototype'][_0x0dcf('0x21')]=function(){this[_0x0dcf('0x0')][_0x0dcf('0x22')](this[_0x0dcf('0x23')],![],this['handleOpenBox'][_0x0dcf('0x10')](this));};EmailImap['prototype'][_0x0dcf('0x24')]=function(_0x5e56ca,_0x431349){if(_0x5e56ca){this[_0x0dcf('0x13')](_0x5e56ca,!![]);}else{this[_0x0dcf('0x25')]('box',_0x431349);this[_0x0dcf('0x26')]();}};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x28')]=function(_0x4a7aff){if(_0x4a7aff){this[_0x0dcf('0x13')](_0x4a7aff,!![]);}else{this[_0x0dcf('0x0')][_0x0dcf('0x29')]();}};EmailImap['prototype'][_0x0dcf('0x26')]=function(){this[_0x0dcf('0x0')][_0x0dcf('0x2a')]([_0x0dcf('0x2b')],this[_0x0dcf('0x2c')]['bind'](this));};EmailImap[_0x0dcf('0x27')]['handleReadUnseen']=function(_0x440d9b,_0x5339bc){if(_0x440d9b){this['handleError'](_0x440d9b,!![]);}else{if(_0x5339bc[_0x0dcf('0x2d')]){try{var _0x3c92b8=this[_0x0dcf('0x0')][_0x0dcf('0x2e')](_0x5339bc,{'bodies':'','markSeen':!![]});_0x3c92b8['on']('message',this[_0x0dcf('0x2f')][_0x0dcf('0x10')](this));_0x3c92b8['once'](_0x0dcf('0x12'),this[_0x0dcf('0x30')][_0x0dcf('0x10')](this));_0x3c92b8[_0x0dcf('0xe')]('end',this[_0x0dcf('0x31')][_0x0dcf('0x10')](this));}catch(_0x57ed5f){logger[_0x0dcf('0x12')](_0x57ed5f);}}else{this[_0x0dcf('0x0')][_0x0dcf('0x32')](!![],this[_0x0dcf('0x28')][_0x0dcf('0x10')](this));}}};EmailImap['prototype'][_0x0dcf('0x2f')]=function(_0x2b876c,_0x41d7a8){_0x2b876c['on'](_0x0dcf('0x33'),this['handleMessageBody'][_0x0dcf('0x10')](this));_0x2b876c[_0x0dcf('0xe')]('attributes',this[_0x0dcf('0x34')][_0x0dcf('0x10')](this));_0x2b876c[_0x0dcf('0xe')](_0x0dcf('0x29'),this['handleMessageEnd'][_0x0dcf('0x10')](this));};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x35')]=function(_0x3404e1,_0x35630a){simpleParser(_0x3404e1,{'Iconv':Iconv},this[_0x0dcf('0x36')][_0x0dcf('0x10')](this));};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x34')]=function(_0x42be00){};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x37')]=function(){};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x36')]=function(_0x59f773,_0x45101f){if(_0x59f773){logger[_0x0dcf('0x12')](_0x59f773);}else{var _0x22c495=this;utils[_0x0dcf('0x38')](this[_0x0dcf('0xc')],_0x45101f,function(_0x4e48cb){_0x22c495['emit'](_0x0dcf('0xa'),_0x4e48cb);});}};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x31')]=function(){this[_0x0dcf('0x0')]['closeBox'](!![],this[_0x0dcf('0x28')][_0x0dcf('0x10')](this));};EmailImap['prototype']['handleFetchError']=function(_0xf67022){this[_0x0dcf('0x13')](_0xf67022);this[_0x0dcf('0x0')][_0x0dcf('0x32')](!![],this[_0x0dcf('0x28')][_0x0dcf('0x10')](this));};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x11')]=function(){this[_0x0dcf('0x25')](_0x0dcf('0x29'));};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x13')]=function(_0x34fec0,_0x264e82){logger[_0x0dcf('0x12')](_0x0dcf('0x13'),this[_0x0dcf('0xc')][_0x0dcf('0xa')],JSON[_0x0dcf('0x39')](_0x34fec0));var _0x10eacb='';if(_0x34fec0){if(_0x34fec0[_0x0dcf('0x3a')]){_0x10eacb=_0x34fec0[_0x0dcf('0x3a')];}else{for(var _0x1c0f86 in _0x34fec0){if(_0x34fec0[_0x0dcf('0x3b')](_0x1c0f86)){_0x10eacb+=_[_0x0dcf('0x3c')](_0x1c0f86)+':\x20'+_0x34fec0[_0x1c0f86]+'\x0a';}}}}if(_0x264e82){this[_0x0dcf('0x0')]['end']();}else{this[_0x0dcf('0x25')]('error',_0x10eacb);this['emit'](_0x0dcf('0x29'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 0a447e4..4a3ea4c 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 _0xa8a0=['bluebird','nodemailer-plugin-inline-base64','prototype','send','use','sendMail','verify','createTransport','toString','exports','nodemailer'];(function(_0x470f4e,_0x2d8125){var _0x5b2643=function(_0x209c5c){while(--_0x209c5c){_0x470f4e['push'](_0x470f4e['shift']());}};_0x5b2643(++_0x2d8125);}(_0xa8a0,0x1ac));var _0x0a8a=function(_0x59cc8c,_0x218863){_0x59cc8c=_0x59cc8c-0x0;var _0x3430b7=_0xa8a0[_0x59cc8c];return _0x3430b7;};'use strict';var nodemailer=require(_0x0a8a('0x0'));var BPromise=require(_0x0a8a('0x1'));var inlineBase64=require(_0x0a8a('0x2'));function EmailSmtp(){}EmailSmtp[_0x0a8a('0x3')][_0x0a8a('0x4')]=function(_0x32b505,_0x4afcf2){return new BPromise(function(_0x3d8fed,_0x51bc62){var _0x2dd374=nodemailer['createTransport'](_0x32b505);_0x2dd374[_0x0a8a('0x5')]('compile',inlineBase64());_0x2dd374[_0x0a8a('0x6')](_0x4afcf2,function(_0x163160,_0x503a22){if(_0x163160){_0x51bc62(_0x163160['toString']());}else{_0x3d8fed(_0x503a22);}});});};EmailSmtp[_0x0a8a('0x3')][_0x0a8a('0x7')]=function(_0x4eff9a){return new BPromise(function(_0x2868c4,_0x2ae326){var _0x32b55c=nodemailer[_0x0a8a('0x8')](_0x4eff9a);_0x32b55c[_0x0a8a('0x7')](function(_0x3cde8b,_0xb59664){if(_0x3cde8b){_0x2ae326(_0x3cde8b[_0x0a8a('0x9')]());}else{if(_0xb59664){_0x2868c4(_0xb59664);}else{_0x2ae326('Not\x20verifired');}}});});};module[_0x0a8a('0xa')]=EmailSmtp; \ No newline at end of file +var _0xfed3=['send','compile','sendMail','verify','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype'];(function(_0x2d39e8,_0x36c897){var _0x487d9d=function(_0x3156b7){while(--_0x3156b7){_0x2d39e8['push'](_0x2d39e8['shift']());}};_0x487d9d(++_0x36c897);}(_0xfed3,0x14c));var _0x3fed=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xfed3[_0x580647];return _0x5f0792;};'use strict';var nodemailer=require(_0x3fed('0x0'));var BPromise=require(_0x3fed('0x1'));var inlineBase64=require(_0x3fed('0x2'));function EmailSmtp(){}EmailSmtp[_0x3fed('0x3')][_0x3fed('0x4')]=function(_0x2ac77e,_0x21b802){return new BPromise(function(_0x3429d9,_0x14ddb4){var _0x503d33=nodemailer['createTransport'](_0x2ac77e);_0x503d33['use'](_0x3fed('0x5'),inlineBase64());_0x503d33[_0x3fed('0x6')](_0x21b802,function(_0x48b8aa,_0x46202c){if(_0x48b8aa){_0x14ddb4(_0x48b8aa['toString']());}else{_0x3429d9(_0x46202c);}});});};EmailSmtp['prototype'][_0x3fed('0x7')]=function(_0x16f363){return new BPromise(function(_0x318342,_0x49316b){var _0x5c0723=nodemailer['createTransport'](_0x16f363);_0x5c0723[_0x3fed('0x7')](function(_0x32a8bf,_0x4a945c){if(_0x32a8bf){_0x49316b(_0x32a8bf['toString']());}else{if(_0x4a945c){_0x318342(_0x4a945c);}else{_0x49316b('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index b6e22e2..14d44e3 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 _0xff55=['message','originCc','originTo','bcc','attach','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','

Empty\x20message

','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','node-tnef','email','../../../config/environment','value','address','anonymous','@xcally.com','head','name','split','length','slice','join','Anonymous','isEmpty','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x1dbe90['pop']():'';}return'';}function getMails(_0x560db2,_0x282877){var _0x40677a='';for(var _0x44e5cd=0x0;_0x44e5cd<_0x282877[_0x5ff5('0x5')]['length'];_0x44e5cd+=0x1){if(_0x282877['value'][_0x44e5cd]['address']!==_0x560db2){if(!_[_0x5ff5('0x10')](_0x40677a)){_0x40677a+=',';}_0x40677a+=_0x282877['value'][_0x44e5cd][_0x5ff5('0xa')]||_0x282877['value'][_0x44e5cd][_0x5ff5('0x6')]||'';_0x40677a+='\x20<';_0x40677a+=_0x282877[_0x5ff5('0x5')][_0x44e5cd][_0x5ff5('0x6')]?_0x282877['value'][_0x44e5cd][_0x5ff5('0x6')]:_0x5ff5('0x7')+random['generate'](0x6)+_0x5ff5('0x8');_0x40677a+='>';}}return _0x40677a;}function parseEmail(_0x56c194,_0xf0090c,_0x1ca54d){if(_0xf0090c[_0x5ff5('0x11')]){var _0x4199d9=/)<[^<]*)*<\/script>/gi;while(_0x4199d9['test'](_0xf0090c[_0x5ff5('0x11')])){_0xf0090c[_0x5ff5('0x11')]=_0xf0090c[_0x5ff5('0x11')][_0x5ff5('0x12')](_0x4199d9,'');}if(_0xf0090c[_0x5ff5('0x11')][_0x5ff5('0x13')](_0x5ff5('0x14'))){var _0x316afd=[];_0xf0090c[_0x5ff5('0x15')][_0x5ff5('0x16')](_0x47ecd7=>{_0x316afd[_0x5ff5('0x17')](_0x47ecd7['filename']);});var _0x9a219b=/]+>/g;var _0x5b42ba=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x457d8d=_0xf0090c[_0x5ff5('0x11')][_0x5ff5('0x12')](_0x5b42ba,_0x5ff5('0x18'));var _0xe8c5b7=_0x457d8d[_0x5ff5('0x12')](_0x9a219b,_0x5ff5('0x19'));for(let _0x582422=0x0;_0x582422<_0x316afd[_0x5ff5('0xc')];_0x582422++){var _0x10a082=_0xe8c5b7[_0x5ff5('0x12')]('_IMG',_0x5ff5('0x1a')+_0x316afd[_0x582422]+_0x5ff5('0x1b'));_0xe8c5b7=_0x10a082;}_0xf0090c[_0x5ff5('0x11')]=_0xe8c5b7;}_0x1ca54d[_0x5ff5('0x1c')]=_0xf0090c[_0x5ff5('0x11')];}else{_0x1ca54d['body']=_0xf0090c[_0x5ff5('0x1d')];}if(_0x1ca54d[_0x5ff5('0x1c')]){_0x1ca54d[_0x5ff5('0x1c')]=_0x1ca54d[_0x5ff5('0x1c')][_0x5ff5('0x12')](/Empty\x20message

';if(_0xacaa7b[_0x5ff5('0x3a')]){for(var _0x288a42=0x0;_0x288a42<_0xacaa7b[_0x5ff5('0x3a')]['length'];_0x288a42++){var _0x3f1e94=_0xacaa7b[_0x5ff5('0x3a')][_0x288a42];_0x462645['message'][_0x5ff5('0x15')]['push']({'filename':_0x3f1e94[_0x5ff5('0x3b')],'content':new Buffer(_0x3f1e94['Data'])});}}}_0x1571d2(parseEmail(_0x2443f4,_0x33ca9b,_0x462645));});}else{_0x33ca9b[_0x5ff5('0x11')]=_0x5ff5('0x3c');_0x1571d2(parseEmail(_0x2443f4,_0x33ca9b,_0x462645));}}else{_0x1571d2(parseEmail(_0x2443f4,_0x33ca9b,_0x462645));}};exports[_0x5ff5('0x3d')]=function(_0x1db427){switch(_0x1db427){case _0x5ff5('0x3e'):return _0x5ff5('0x3f');case'yahoo':return _0x5ff5('0x40');case'hotmail':return _0x5ff5('0x41');case _0x5ff5('0x42'):return _0x5ff5('0x43');}return _0x5ff5('0x44');}; \ No newline at end of file +var _0x5d89=['messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','lodash','moment','randomstring','util','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','length','slice','join','Anonymous','pop','test','html','replace','includes','','body','textAsHtml','0x1?_0x249394[_0x95d8('0x12')]():'';}return'';}function getMails(_0x521f40,_0x51e80b){var _0x59c6a4='';for(var _0x3b715f=0x0;_0x3b715f<_0x51e80b['value']['length'];_0x3b715f+=0x1){if(_0x51e80b[_0x95d8('0x7')][_0x3b715f]['address']!==_0x521f40){if(!_['isEmpty'](_0x59c6a4)){_0x59c6a4+=',';}_0x59c6a4+=_0x51e80b[_0x95d8('0x7')][_0x3b715f][_0x95d8('0xc')]||_0x51e80b[_0x95d8('0x7')][_0x3b715f][_0x95d8('0x8')]||'';_0x59c6a4+='\x20<';_0x59c6a4+=_0x51e80b[_0x95d8('0x7')][_0x3b715f]['address']?_0x51e80b['value'][_0x3b715f][_0x95d8('0x8')]:'anonymous'+random[_0x95d8('0xa')](0x6)+_0x95d8('0xb');_0x59c6a4+='>';}}return _0x59c6a4;}function parseEmail(_0x1bfd84,_0x111d53,_0x2bd8d9){if(_0x111d53['html']){var _0x332740=/)<[^<]*)*<\/script>/gi;while(_0x332740[_0x95d8('0x13')](_0x111d53[_0x95d8('0x14')])){_0x111d53[_0x95d8('0x14')]=_0x111d53['html'][_0x95d8('0x15')](_0x332740,'');}if(_0x111d53[_0x95d8('0x14')][_0x95d8('0x16')](_0x95d8('0x17'))){var _0xb95644=[];_0x111d53['attachments']['forEach'](_0x4c34a2=>{_0xb95644[_0x95d8('0x18')](_0x4c34a2['filename']);});var _0x4a29dd=/]+>/g;var _0x473805=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0xc4b7ec=_0x111d53[_0x95d8('0x14')][_0x95d8('0x15')](_0x473805,_0x95d8('0x19'));var _0x1544ba=_0xc4b7ec[_0x95d8('0x15')](_0x4a29dd,_0x95d8('0x1a'));for(let _0x51f9fc=0x0;_0x51f9fc<_0xb95644[_0x95d8('0xe')];_0x51f9fc++){var _0x10c109=_0x1544ba[_0x95d8('0x15')]('_IMG','\x20[Attachment:\x20'+_0xb95644[_0x51f9fc]+_0x95d8('0x1b'));_0x1544ba=_0x10c109;}_0x111d53[_0x95d8('0x14')]=_0x1544ba;}_0x2bd8d9[_0x95d8('0x1c')]=_0x111d53['html'];}else{_0x2bd8d9[_0x95d8('0x1c')]=_0x111d53[_0x95d8('0x1d')];}if(_0x2bd8d9[_0x95d8('0x1c')]){_0x2bd8d9['body']=_0x2bd8d9['body'][_0x95d8('0x15')](/0x0){if(this[_0x4d1172+_0x568a('0x2b')]>0x0&&this[_0x4d1172+'CurrentCapacity']>=this[_0x4d1172+_0x568a('0x2b')]){return _0x568a('0x2c');}else{return _0x568a('0x2d');}}else{return'idle';}};Agent[_0x568a('0x28')][_0x568a('0x27')]=function(){var _0x1d5329=[_0x568a('0x2e'),_0x568a('0x2f'),_0x568a('0x30'),_0x568a('0x31'),_0x568a('0x32'),_0x568a('0x33')];for(var _0x5721a5=0x0;_0x5721a5<_0x1d5329[_0x568a('0x34')];_0x5721a5+=0x1){var _0x63decd=this[_0x568a('0x29')](_0x1d5329[_0x5721a5]);if(this[_0x1d5329[_0x5721a5]+_0x568a('0x35')]!==_0x63decd){this[_0x1d5329[_0x5721a5]+_0x568a('0x36')]=_[_0x568a('0x37')](moment()['format']('x'));}this[_0x1d5329[_0x5721a5]+_0x568a('0x35')]=_0x63decd;}var _0x3d14ab={'id':this['id'],'name':this[_0x568a('0x6')],'online':this[_0x568a('0x7')],'voicePause':this[_0x568a('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0x568a('0xa')],'smsPause':this[_0x568a('0xc')],'faxPause':this[_0x568a('0xb')],'openchannelPause':this[_0x568a('0xd')],'chatStatus':this[_0x568a('0xe')],'chatStatusTime':this[_0x568a('0xf')],'chatCapacity':this[_0x568a('0x10')],'chatCurrentCapacity':this[_0x568a('0x11')],'mailStatus':this[_0x568a('0x12')],'mailStatusTime':this[_0x568a('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x568a('0x16')],'faxStatus':this[_0x568a('0x17')],'faxStatusTime':this[_0x568a('0x18')],'faxCapacity':this[_0x568a('0x19')],'faxCurrentCapacity':this[_0x568a('0x1a')],'smsStatus':this[_0x568a('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x568a('0x38')],'whatsappStatusTime':this[_0x568a('0x39')],'whatsappCapacity':this[_0x568a('0x1f')],'whatsappCurrentCapacity':this[_0x568a('0x20')],'openchannelStatus':this[_0x568a('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x568a('0x24')],'busy':this[_0x568a('0x25')],'busyQueue':this[_0x568a('0x26')]};var _0x10807d=md5(JSON[_0x568a('0x3a')](_0x3d14ab));if(this['md5']!==_0x10807d){this[_0x568a('0x1')]=_0x10807d;io['emit'](_0x568a('0x3b'),_0x3d14ab);}};module[_0x568a('0x3c')]=Agent; \ No newline at end of file +var _0xb6fa=['whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','fax','sms','whatsapp','length','Status','toNumber','format','faxCapacity','smsStatus','whatsappStatus','openchannelStatusTime','busy','stringify','user:save','lodash','ioredis','defaults','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity'];(function(_0x15af00,_0x5251f7){var _0x233c08=function(_0x1fa601){while(--_0x1fa601){_0x15af00['push'](_0x15af00['shift']());}};_0x233c08(++_0x5251f7);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0xb6fa[_0x102b0c];return _0x9b15ca;};'use strict';var _=require(_0xab6f('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require(_0xab6f('0x1'));var config=require('../../../config/environment');config['redis']=_[_0xab6f('0x2')](config[_0xab6f('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xab6f('0x4'))(new Redis(config[_0xab6f('0x3')]));function Agent(_0x15b2cc){this['id']=_0x15b2cc['id']||0x0;this[_0xab6f('0x5')]=_0x15b2cc[_0xab6f('0x5')]||'';this[_0xab6f('0x6')]=_0x15b2cc[_0xab6f('0x6')]||!![];this[_0xab6f('0x7')]=_0x15b2cc[_0xab6f('0x7')]||![];this[_0xab6f('0x8')]=_0x15b2cc[_0xab6f('0x8')]||![];this[_0xab6f('0x9')]=_0x15b2cc[_0xab6f('0x9')]||![];this[_0xab6f('0xa')]=_0x15b2cc[_0xab6f('0xa')]||![];this[_0xab6f('0xb')]=_0x15b2cc['smsPause']||![];this['openchannelPause']=_0x15b2cc[_0xab6f('0xc')]||![];this[_0xab6f('0xd')]='unknown';this[_0xab6f('0xe')]=0x0;this[_0xab6f('0xf')]=_0x15b2cc[_0xab6f('0xf')]||0x0;this[_0xab6f('0x10')]=0x0;this[_0xab6f('0x11')]=_0xab6f('0x12');this[_0xab6f('0x13')]=0x0;this['mailCapacity']=_0x15b2cc[_0xab6f('0x14')]||0x0;this[_0xab6f('0x15')]=0x0;this[_0xab6f('0x16')]='unknown';this[_0xab6f('0x17')]=0x0;this['faxCapacity']=_0x15b2cc['faxCapacity']||0x0;this[_0xab6f('0x18')]=0x0;this['smsStatus']=_0xab6f('0x12');this[_0xab6f('0x19')]=0x0;this[_0xab6f('0x1a')]=_0x15b2cc['smsCapacity']||0x0;this[_0xab6f('0x1b')]=0x0;this['whatsappStatus']=_0xab6f('0x12');this[_0xab6f('0x1c')]=0x0;this[_0xab6f('0x1d')]=_0x15b2cc[_0xab6f('0x1d')]||0x0;this[_0xab6f('0x1e')]=0x0;this[_0xab6f('0x1f')]=_0xab6f('0x12');this['openchannelStatusTime']=0x0;this[_0xab6f('0x20')]=_0x15b2cc[_0xab6f('0x20')]||0x0;this[_0xab6f('0x21')]=0x0;this['busy']=![];this[_0xab6f('0x22')]=undefined;this[_0xab6f('0x23')]='';this[_0xab6f('0x24')]();}Agent[_0xab6f('0x25')][_0xab6f('0x26')]=function(_0x210d19){if(this[_0x210d19+'CurrentCapacity']>0x0){if(this[_0x210d19+'Capacity']>0x0&&this[_0x210d19+_0xab6f('0x27')]>=this[_0x210d19+_0xab6f('0x28')]){return _0xab6f('0x29');}else{return _0xab6f('0x2a');}}else{return _0xab6f('0x2b');}};Agent[_0xab6f('0x25')][_0xab6f('0x24')]=function(){var _0x5634c5=[_0xab6f('0x2c'),_0xab6f('0x2d'),'openchannel',_0xab6f('0x2e'),_0xab6f('0x2f'),_0xab6f('0x30')];for(var _0x2e10a7=0x0;_0x2e10a7<_0x5634c5[_0xab6f('0x31')];_0x2e10a7+=0x1){var _0x4c2d80=this[_0xab6f('0x26')](_0x5634c5[_0x2e10a7]);if(this[_0x5634c5[_0x2e10a7]+_0xab6f('0x32')]!==_0x4c2d80){this[_0x5634c5[_0x2e10a7]+'StatusTime']=_[_0xab6f('0x33')](moment()[_0xab6f('0x34')]('x'));}this[_0x5634c5[_0x2e10a7]+_0xab6f('0x32')]=_0x4c2d80;}var _0x2f8ebc={'id':this['id'],'name':this[_0xab6f('0x5')],'online':this[_0xab6f('0x6')],'voicePause':this['voicePause'],'chatPause':this[_0xab6f('0x8')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xab6f('0xe')],'chatCapacity':this[_0xab6f('0xf')],'chatCurrentCapacity':this[_0xab6f('0x10')],'mailStatus':this[_0xab6f('0x11')],'mailStatusTime':this[_0xab6f('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xab6f('0x15')],'faxStatus':this[_0xab6f('0x16')],'faxStatusTime':this[_0xab6f('0x17')],'faxCapacity':this[_0xab6f('0x35')],'faxCurrentCapacity':this[_0xab6f('0x18')],'smsStatus':this[_0xab6f('0x36')],'smsStatusTime':this[_0xab6f('0x19')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xab6f('0x1b')],'whatsappStatus':this[_0xab6f('0x37')],'whatsappStatusTime':this[_0xab6f('0x1c')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xab6f('0x1e')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xab6f('0x38')],'openchannelCapacity':this[_0xab6f('0x20')],'openchannelCurrentCapacity':this[_0xab6f('0x21')],'busy':this[_0xab6f('0x39')],'busyQueue':this[_0xab6f('0x22')]};var _0x184cd4=md5(JSON[_0xab6f('0x3a')](_0x2f8ebc));if(this[_0xab6f('0x23')]!==_0x184cd4){this[_0xab6f('0x23')]=_0x184cd4;io['emit'](_0xab6f('0x3b'),_0x2f8ebc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index b32380a..411b508 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 _0x6565=['prototype','_rr','map','updateRealtime','loggedIn','length','online','chatPause','paused','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','util','ioredis','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x1be7e8,_0x4bc327){var _0x1a98f9=function(_0x140ce1){while(--_0x140ce1){_0x1be7e8['push'](_0x1be7e8['shift']());}};_0x1a98f9(++_0x4bc327);}(_0x6565,0x177));var _0x5656=function(_0x170362,_0x1bf09a){_0x170362=_0x170362-0x0;var _0x2fd172=_0x6565[_0x170362];return _0x2fd172;};'use strict';var _=require(_0x5656('0x0'));var md5=require(_0x5656('0x1'));var util=require(_0x5656('0x2'));var Redis=require(_0x5656('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x5656('0x4')](config[_0x5656('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x5656('0x6'))(new Redis(config[_0x5656('0x5')]));function ChatQueue(_0x1dd578){this['id']=_0x1dd578['id']||0x0;this['name']=_0x1dd578[_0x5656('0x7')]||'';this['timeout']=_0x1dd578[_0x5656('0x8')]||0xa;this['strategy']=_0x1dd578[_0x5656('0x9')]||_0x5656('0xa');this[_0x5656('0xb')]=_0x1dd578[_0x5656('0xb')];this[_0x5656('0xc')]={};this[_0x5656('0xd')]=0x0;this['md5']='';this[_0x5656('0xe')]();this['updateRealtime']();}ChatQueue[_0x5656('0xf')]['updateRouting']=function(){var _0x435bfb=this['mapAgentsId'][_0x5656('0x10')];this['mapAgentsId']=_[_0x5656('0x11')](this[_0x5656('0xb')],'id');this['mapAgentsId'][_0x5656('0x10')]=_0x435bfb;};ChatQueue[_0x5656('0xf')][_0x5656('0x12')]=function(){this[_0x5656('0x13')]=0x0;this['paused']=0x0;for(var _0x2012e4=0x0;_0x2012e4=0x0?this[_0x5656('0x18')]:0x0;var _0xc6c127={'id':this['id'],'available':this[_0x5656('0x18')],'loggedIn':this[_0x5656('0x13')],'name':this[_0x5656('0x7')],'paused':this[_0x5656('0x17')],'waiting':this[_0x5656('0xd')]};var _0x5bd5e9=md5(JSON[_0x5656('0x19')](_0xc6c127));if(this['md5']!==_0x5bd5e9){this[_0x5656('0x1')]=_0x5bd5e9;io['to'](util[_0x5656('0x1a')]('chat:queue:%s',_0xc6c127[_0x5656('0x7')]))[_0x5656('0x1b')](_0x5656('0x1c'),_0xc6c127);}};module[_0x5656('0x1d')]=ChatQueue; \ No newline at end of file +var _0x6504=['updateRouting','updateRealtime','_rr','map','paused','length','online','loggedIn','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x22df11,_0x41c82c){var _0x462e82=function(_0x41f528){while(--_0x41f528){_0x22df11['push'](_0x22df11['shift']());}};_0x462e82(++_0x41c82c);}(_0x6504,0x13c));var _0x4650=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6504[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4650('0x0'));var md5=require(_0x4650('0x1'));var util=require('util');var Redis=require(_0x4650('0x2'));var config=require(_0x4650('0x3'));config[_0x4650('0x4')]=_[_0x4650('0x5')](config[_0x4650('0x4')],{'host':_0x4650('0x6'),'port':0x18eb});var io=require(_0x4650('0x7'))(new Redis(config['redis']));function ChatQueue(_0x35e1da){this['id']=_0x35e1da['id']||0x0;this[_0x4650('0x8')]=_0x35e1da[_0x4650('0x8')]||'';this[_0x4650('0x9')]=_0x35e1da['timeout']||0xa;this[_0x4650('0xa')]=_0x35e1da[_0x4650('0xa')]||_0x4650('0xb');this[_0x4650('0xc')]=_0x35e1da['Agents'];this[_0x4650('0xd')]={};this['waiting']=0x0;this[_0x4650('0x1')]='';this[_0x4650('0xe')]();this[_0x4650('0xf')]();}ChatQueue['prototype'][_0x4650('0xe')]=function(){var _0x62aa6e=this['mapAgentsId'][_0x4650('0x10')];this[_0x4650('0xd')]=_[_0x4650('0x11')](this[_0x4650('0xc')],'id');this[_0x4650('0xd')][_0x4650('0x10')]=_0x62aa6e;};ChatQueue['prototype'][_0x4650('0xf')]=function(){this['loggedIn']=0x0;this[_0x4650('0x12')]=0x0;for(var _0x5f1c20=0x0;_0x5f1c20=0x0?this[_0x4650('0x17')]:0x0;var _0x2d7888={'id':this['id'],'available':this[_0x4650('0x17')],'loggedIn':this[_0x4650('0x15')],'name':this[_0x4650('0x8')],'paused':this['paused'],'waiting':this[_0x4650('0x18')]};var _0x3a4e3e=md5(JSON[_0x4650('0x19')](_0x2d7888));if(this[_0x4650('0x1')]!==_0x3a4e3e){this[_0x4650('0x1')]=_0x3a4e3e;io['to'](util[_0x4650('0x1a')](_0x4650('0x1b'),_0x2d7888[_0x4650('0x8')]))[_0x4650('0x1c')](_0x4650('0x1d'),_0x2d7888);}};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 055c187..86c4fa7 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(_0x45bf26,_0x3ac696){var _0x1b2eb9=function(_0x57bcbd){while(--_0x57bcbd){_0x45bf26['push'](_0x45bf26['shift']());}};_0x1b2eb9(++_0x3ac696);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x525e0b,_0x3313bf){var _0x3ab14e=function(_0x4ccba0){while(--_0x4ccba0){_0x525e0b['push'](_0x525e0b['shift']());}};_0x3ab14e(++_0x3313bf);}(_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 diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index cf416f8..c16bf3e 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 _0x0e99=['Intervals','exports','name'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x0e99,0xb9));var _0x90e9=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x0e99[_0x5caf7e];return _0x5c3435;};'use strict';function Interval(_0x455c2e){this['id']=_0x455c2e['id']||0x0;this[_0x90e9('0x0')]=_0x455c2e[_0x90e9('0x0')]||'';this[_0x90e9('0x1')]=_0x455c2e[_0x90e9('0x1')]||{};}module[_0x90e9('0x2')]=Interval; \ No newline at end of file +var _0xc6bb=['name','Intervals','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc6bb,0x147));var _0xbc6b=function(_0x170cb5,_0x5960da){_0x170cb5=_0x170cb5-0x0;var _0x4e7050=_0xc6bb[_0x170cb5];return _0x4e7050;};'use strict';function Interval(_0x23070c){this['id']=_0x23070c['id']||0x0;this['name']=_0x23070c[_0xbc6b('0x0')]||'';this[_0xbc6b('0x1')]=_0x23070c['Intervals']||{};}module[_0xbc6b('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 746192a..1ee9815 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 _0xf628=['ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','prototype','updateRouting','mapAgentsId','_rr','updateRealtime','loggedIn','paused','length','online','mailPause','available','waiting','stringify','emit','lodash','md5','util'];(function(_0x338924,_0x2fd4fa){var _0x493b20=function(_0xf573d0){while(--_0xf573d0){_0x338924['push'](_0x338924['shift']());}};_0x493b20(++_0x2fd4fa);}(_0xf628,0x7f));var _0x8f62=function(_0x4ca140,_0x54ed7e){_0x4ca140=_0x4ca140-0x0;var _0xa31496=_0xf628[_0x4ca140];return _0xa31496;};'use strict';var _=require(_0x8f62('0x0'));var md5=require(_0x8f62('0x1'));var util=require(_0x8f62('0x2'));var Redis=require(_0x8f62('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x8f62('0x4')],{'host':_0x8f62('0x5'),'port':0x18eb});var io=require(_0x8f62('0x6'))(new Redis(config[_0x8f62('0x4')]));function MailQueue(_0x3301d9){this['id']=_0x3301d9['id']||0x0;this['name']=_0x3301d9[_0x8f62('0x7')]||'';this['timeout']=_0x3301d9[_0x8f62('0x8')]||0xa;this[_0x8f62('0x9')]=_0x3301d9['strategy']||_0x8f62('0xa');this[_0x8f62('0xb')]=_0x3301d9[_0x8f62('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x8f62('0xc')][_0x8f62('0xd')]=function(){var _0x53b638=this[_0x8f62('0xe')][_0x8f62('0xf')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x8f62('0xe')][_0x8f62('0xf')]=_0x53b638;};MailQueue[_0x8f62('0xc')][_0x8f62('0x10')]=function(){this[_0x8f62('0x11')]=0x0;this[_0x8f62('0x12')]=0x0;for(var _0x4756a3=0x0;_0x4756a3=0x0?this['available']:0x0;var _0x1aa7d0={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8f62('0x11')],'name':this['name'],'paused':this[_0x8f62('0x12')],'waiting':this[_0x8f62('0x17')]};var _0xb8d46a=md5(JSON[_0x8f62('0x18')](_0x1aa7d0));if(this['md5']!==_0xb8d46a){this[_0x8f62('0x1')]=_0xb8d46a;io['to'](util['format']('mail:queue:%s',_0x1aa7d0['name']))[_0x8f62('0x19')]('mail_queue:save',_0x1aa7d0);}};module['exports']=MailQueue; \ No newline at end of file +var _0xc1b4=['updateRealtime','prototype','_rr','map','loggedIn','paused','online','mailPause','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x151e0b,_0x3bec86){var _0x5d4a5c=function(_0x1567f4){while(--_0x1567f4){_0x151e0b['push'](_0x151e0b['shift']());}};_0x5d4a5c(++_0x3bec86);}(_0xc1b4,0x10a));var _0x4c1b=function(_0x1a4feb,_0x23937c){_0x1a4feb=_0x1a4feb-0x0;var _0x211cd1=_0xc1b4[_0x1a4feb];return _0x211cd1;};'use strict';var _=require(_0x4c1b('0x0'));var md5=require(_0x4c1b('0x1'));var util=require('util');var Redis=require(_0x4c1b('0x2'));var config=require(_0x4c1b('0x3'));config[_0x4c1b('0x4')]=_[_0x4c1b('0x5')](config[_0x4c1b('0x4')],{'host':_0x4c1b('0x6'),'port':0x18eb});var io=require(_0x4c1b('0x7'))(new Redis(config[_0x4c1b('0x4')]));function MailQueue(_0x578c6d){this['id']=_0x578c6d['id']||0x0;this[_0x4c1b('0x8')]=_0x578c6d[_0x4c1b('0x8')]||'';this['timeout']=_0x578c6d['timeout']||0xa;this[_0x4c1b('0x9')]=_0x578c6d[_0x4c1b('0x9')]||'beepall';this[_0x4c1b('0xa')]=_0x578c6d[_0x4c1b('0xa')];this[_0x4c1b('0xb')]={};this[_0x4c1b('0xc')]=0x0;this[_0x4c1b('0x1')]='';this[_0x4c1b('0xd')]();this[_0x4c1b('0xe')]();}MailQueue[_0x4c1b('0xf')]['updateRouting']=function(){var _0x19906e=this['mapAgentsId'][_0x4c1b('0x10')];this[_0x4c1b('0xb')]=_[_0x4c1b('0x11')](this[_0x4c1b('0xa')],'id');this['mapAgentsId'][_0x4c1b('0x10')]=_0x19906e;};MailQueue[_0x4c1b('0xf')][_0x4c1b('0xe')]=function(){this[_0x4c1b('0x12')]=0x0;this[_0x4c1b('0x13')]=0x0;for(var _0x85678b=0x0;_0x85678b=0x0?this[_0x4c1b('0x16')]:0x0;var _0x45412f={'id':this['id'],'available':this[_0x4c1b('0x16')],'loggedIn':this[_0x4c1b('0x12')],'name':this['name'],'paused':this[_0x4c1b('0x13')],'waiting':this[_0x4c1b('0xc')]};var _0x197e5f=md5(JSON['stringify'](_0x45412f));if(this[_0x4c1b('0x1')]!==_0x197e5f){this[_0x4c1b('0x1')]=_0x197e5f;io['to'](util[_0x4c1b('0x17')](_0x4c1b('0x18'),_0x45412f[_0x4c1b('0x8')]))[_0x4c1b('0x19')](_0x4c1b('0x1a'),_0x45412f);}};module[_0x4c1b('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index a4b0c61..0b438c0 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 _0xa992=['../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel_queue:save','exports','lodash','md5','ioredis'];(function(_0x1ee7e4,_0x4ba132){var _0x4a99aa=function(_0x115d2d){while(--_0x115d2d){_0x1ee7e4['push'](_0x1ee7e4['shift']());}};_0x4a99aa(++_0x4ba132);}(_0xa992,0x13c));var _0x2a99=function(_0x4d35f8,_0x4931c1){_0x4d35f8=_0x4d35f8-0x0;var _0x583ede=_0xa992[_0x4d35f8];return _0x583ede;};'use strict';var _=require(_0x2a99('0x0'));var md5=require(_0x2a99('0x1'));var util=require('util');var Redis=require(_0x2a99('0x2'));var config=require(_0x2a99('0x3'));config[_0x2a99('0x4')]=_[_0x2a99('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2a99('0x6'))(new Redis(config[_0x2a99('0x4')]));function OpenchannelQueue(_0x4860bd){this['id']=_0x4860bd['id']||0x0;this[_0x2a99('0x7')]=_0x4860bd['name']||'';this[_0x2a99('0x8')]=_0x4860bd[_0x2a99('0x8')]||0xa;this[_0x2a99('0x9')]=_0x4860bd[_0x2a99('0x9')]||_0x2a99('0xa');this[_0x2a99('0xb')]=_0x4860bd[_0x2a99('0xb')];this[_0x2a99('0xc')]={};this[_0x2a99('0xd')]=0x0;this[_0x2a99('0x1')]='';this['updateRouting']();this[_0x2a99('0xe')]();}OpenchannelQueue[_0x2a99('0xf')][_0x2a99('0x10')]=function(){var _0x2ddc8b=this['mapAgentsId'][_0x2a99('0x11')];this[_0x2a99('0xc')]=_[_0x2a99('0x12')](this[_0x2a99('0xb')],'id');this[_0x2a99('0xc')]['_rr']=_0x2ddc8b;};OpenchannelQueue[_0x2a99('0xf')][_0x2a99('0xe')]=function(){this[_0x2a99('0x13')]=0x0;this[_0x2a99('0x14')]=0x0;for(var _0x2a93ed=0x0;_0x2a93ed=0x0?this['available']:0x0;var _0x328298={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x2a99('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x4b8f63=md5(JSON[_0x2a99('0x19')](_0x328298));if(this[_0x2a99('0x1')]!==_0x4b8f63){this[_0x2a99('0x1')]=_0x4b8f63;io['to'](util[_0x2a99('0x1a')]('openchannel:queue:%s',_0x328298[_0x2a99('0x7')]))['emit'](_0x2a99('0x1b'),_0x328298);}};module[_0x2a99('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x819b=['util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','online','openchannelPause','available','paused','format','openchannel_queue:save','md5'];(function(_0x1ee8a6,_0x5ba991){var _0x55c71e=function(_0x4e5108){while(--_0x4e5108){_0x1ee8a6['push'](_0x1ee8a6['shift']());}};_0x55c71e(++_0x5ba991);}(_0x819b,0x1ed));var _0xb819=function(_0x2e7044,_0x5409b8){_0x2e7044=_0x2e7044-0x0;var _0x26a3c2=_0x819b[_0x2e7044];return _0x26a3c2;};'use strict';var _=require('lodash');var md5=require(_0xb819('0x0'));var util=require(_0xb819('0x1'));var Redis=require(_0xb819('0x2'));var config=require(_0xb819('0x3'));config[_0xb819('0x4')]=_[_0xb819('0x5')](config[_0xb819('0x4')],{'host':_0xb819('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb819('0x4')]));function OpenchannelQueue(_0x1f4f6c){this['id']=_0x1f4f6c['id']||0x0;this[_0xb819('0x7')]=_0x1f4f6c[_0xb819('0x7')]||'';this[_0xb819('0x8')]=_0x1f4f6c[_0xb819('0x8')]||0xa;this[_0xb819('0x9')]=_0x1f4f6c[_0xb819('0x9')]||'beepall';this[_0xb819('0xa')]=_0x1f4f6c[_0xb819('0xa')];this[_0xb819('0xb')]={};this[_0xb819('0xc')]=0x0;this['md5']='';this[_0xb819('0xd')]();this[_0xb819('0xe')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0xe610da=this[_0xb819('0xb')][_0xb819('0xf')];this[_0xb819('0xb')]=_[_0xb819('0x10')](this[_0xb819('0xa')],'id');this[_0xb819('0xb')]['_rr']=_0xe610da;};OpenchannelQueue[_0xb819('0x11')]['updateRealtime']=function(){this[_0xb819('0x12')]=0x0;this['paused']=0x0;for(var _0x4eb04c=0x0;_0x4eb04c=0x0?this[_0xb819('0x16')]:0x0;var _0x102a82={'id':this['id'],'available':this[_0xb819('0x16')],'loggedIn':this[_0xb819('0x12')],'name':this['name'],'paused':this[_0xb819('0x17')],'waiting':this[_0xb819('0xc')]};var _0x56cc81=md5(JSON['stringify'](_0x102a82));if(this[_0xb819('0x0')]!==_0x56cc81){this[_0xb819('0x0')]=_0x56cc81;io['to'](util[_0xb819('0x18')]('openchannel:queue:%s',_0x102a82[_0xb819('0x7')]))['emit'](_0xb819('0x19'),_0x102a82);}};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 fda902f..4018019 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 _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x4bac53,_0x2f9c3f){var _0x2c91a9=function(_0x22d9e6){while(--_0x22d9e6){_0x4bac53['push'](_0x4bac53['shift']());}};_0x2c91a9(++_0x2f9c3f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x28eb5d,_0x46440e){var _0x586331=function(_0xa54929){while(--_0xa54929){_0x28eb5d['push'](_0x28eb5d['shift']());}};_0x586331(++_0x46440e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xb7e7[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index edd8f71..e55787f 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 _0x4887=['prototype','mapAgentsId','_rr','map','loggedIn','Agents','online','paused','available','name','format','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','timeout','strategy','beepall','waiting','updateRouting','updateRealtime'];(function(_0x5d8cb7,_0x2851f7){var _0xece05d=function(_0x33f59e){while(--_0x33f59e){_0x5d8cb7['push'](_0x5d8cb7['shift']());}};_0xece05d(++_0x2851f7);}(_0x4887,0xd1));var _0x7488=function(_0x5e904f,_0x24b54f){_0x5e904f=_0x5e904f-0x0;var _0x8a0a32=_0x4887[_0x5e904f];return _0x8a0a32;};'use strict';var _=require(_0x7488('0x0'));var md5=require(_0x7488('0x1'));var util=require(_0x7488('0x2'));var Redis=require(_0x7488('0x3'));var config=require(_0x7488('0x4'));config['redis']=_[_0x7488('0x5')](config[_0x7488('0x6')],{'host':_0x7488('0x7'),'port':0x18eb});var io=require(_0x7488('0x8'))(new Redis(config[_0x7488('0x6')]));function WhatsappQueue(_0x4b7514){this['id']=_0x4b7514['id']||0x0;this['name']=_0x4b7514['name']||'';this[_0x7488('0x9')]=_0x4b7514[_0x7488('0x9')]||0xa;this[_0x7488('0xa')]=_0x4b7514['strategy']||_0x7488('0xb');this['Agents']=_0x4b7514['Agents'];this['mapAgentsId']={};this[_0x7488('0xc')]=0x0;this[_0x7488('0x1')]='';this[_0x7488('0xd')]();this[_0x7488('0xe')]();}WhatsappQueue[_0x7488('0xf')][_0x7488('0xd')]=function(){var _0x59ea5c=this[_0x7488('0x10')][_0x7488('0x11')];this[_0x7488('0x10')]=_[_0x7488('0x12')](this['Agents'],'id');this[_0x7488('0x10')][_0x7488('0x11')]=_0x59ea5c;};WhatsappQueue[_0x7488('0xf')][_0x7488('0xe')]=function(){this[_0x7488('0x13')]=0x0;this['paused']=0x0;for(var _0x186aa6=0x0;_0x186aa6=0x0?this[_0x7488('0x17')]:0x0;var _0x5d066c={'id':this['id'],'available':this[_0x7488('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x7488('0x18')],'paused':this[_0x7488('0x16')],'waiting':this['waiting']};var _0xf20711=md5(JSON['stringify'](_0x5d066c));if(this[_0x7488('0x1')]!==_0xf20711){this[_0x7488('0x1')]=_0xf20711;io['to'](util[_0x7488('0x19')]('whatsapp:queue:%s',_0x5d066c[_0x7488('0x18')]))[_0x7488('0x1a')](_0x7488('0x1b'),_0x5d066c);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xc6cf=['available','stringify','format','emit','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','loggedIn','paused','online','whatsappPause'];(function(_0x371cda,_0x32825d){var _0xa8927e=function(_0x4b25f2){while(--_0x4b25f2){_0x371cda['push'](_0x371cda['shift']());}};_0xa8927e(++_0x32825d);}(_0xc6cf,0xa6));var _0xfc6c=function(_0x2a2853,_0x56dfb4){_0x2a2853=_0x2a2853-0x0;var _0x2c8741=_0xc6cf[_0x2a2853];return _0x2c8741;};'use strict';var _=require(_0xfc6c('0x0'));var md5=require(_0xfc6c('0x1'));var util=require(_0xfc6c('0x2'));var Redis=require(_0xfc6c('0x3'));var config=require(_0xfc6c('0x4'));config[_0xfc6c('0x5')]=_[_0xfc6c('0x6')](config[_0xfc6c('0x5')],{'host':_0xfc6c('0x7'),'port':0x18eb});var io=require(_0xfc6c('0x8'))(new Redis(config[_0xfc6c('0x5')]));function WhatsappQueue(_0xdbee6e){this['id']=_0xdbee6e['id']||0x0;this[_0xfc6c('0x9')]=_0xdbee6e[_0xfc6c('0x9')]||'';this[_0xfc6c('0xa')]=_0xdbee6e[_0xfc6c('0xa')]||0xa;this[_0xfc6c('0xb')]=_0xdbee6e['strategy']||_0xfc6c('0xc');this[_0xfc6c('0xd')]=_0xdbee6e['Agents'];this[_0xfc6c('0xe')]={};this[_0xfc6c('0xf')]=0x0;this[_0xfc6c('0x1')]='';this['updateRouting']();this[_0xfc6c('0x10')]();}WhatsappQueue[_0xfc6c('0x11')]['updateRouting']=function(){var _0x36744e=this[_0xfc6c('0xe')][_0xfc6c('0x12')];this[_0xfc6c('0xe')]=_['map'](this['Agents'],'id');this[_0xfc6c('0xe')][_0xfc6c('0x12')]=_0x36744e;};WhatsappQueue['prototype'][_0xfc6c('0x10')]=function(){this[_0xfc6c('0x13')]=0x0;this[_0xfc6c('0x14')]=0x0;for(var _0x2905f3=0x0;_0x2905f3=0x0?this[_0xfc6c('0x17')]:0x0;var _0x868584={'id':this['id'],'available':this['available'],'loggedIn':this[_0xfc6c('0x13')],'name':this[_0xfc6c('0x9')],'paused':this['paused'],'waiting':this[_0xfc6c('0xf')]};var _0x50ee72=md5(JSON[_0xfc6c('0x18')](_0x868584));if(this[_0xfc6c('0x1')]!==_0x50ee72){this[_0xfc6c('0x1')]=_0x50ee72;io['to'](util[_0xfc6c('0x19')]('whatsapp:queue:%s',_0x868584['name']))[_0xfc6c('0x1a')]('whatsapp_queue:save',_0x868584);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index ce1615c..df5aa23 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 _0x55ca=['initAgents','length','isUndefined','mergeFromDatabase','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','chatQueues','initSmsQueues','initFaxQueues','faxQueues','exports','bluebird','util','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x55ca,0x126));var _0xa55c=function(_0x26721d,_0x448ba5){_0x26721d=_0x26721d-0x0;var _0x1035c5=_0x55ca[_0x26721d];return _0x1035c5;};'use strict';var BPromise=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0xa55c('0x2'));var OpenchannelQueue=require(_0xa55c('0x3'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0xa55c('0x4'));var MailQueue=require(_0xa55c('0x5'));var FaxQueue=require(_0xa55c('0x6'));var WhatsappQueue=require(_0xa55c('0x7'));var Realtime=function(){this[_0xa55c('0x8')]={};this[_0xa55c('0x9')]={};this[_0xa55c('0xa')]={};this['chatQueues']={};this[_0xa55c('0xb')]={};this[_0xa55c('0xc')]={};this['faxQueues']={};this[_0xa55c('0xd')]={};this[_0xa55c('0xe')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xa55c('0xf')]={};this[_0xa55c('0x10')]={};this[_0xa55c('0x11')]={};};function freeIsNotKey(_0x5d8e5a,_0x31646d,_0xe6d826){var _0x508342=_[_0xa55c('0x12')](_0x5d8e5a,function(_0x3998f7,_0x15eec8){return _0x3998f7[_0xe6d826];});for(var _0x5d47ff in _0x31646d){if(_0x31646d['hasOwnProperty'](_0x5d47ff)){if(!_0x508342[_0x5d47ff]){delete _0x31646d[_0x5d47ff];}}}}Realtime[_0xa55c('0x13')]['mergeFromDatabase']=function(_0x5a3672,_0x59ea8d){for(var _0x18ee85 in _0x59ea8d){if(_0x5a3672[_0xa55c('0x14')](_0x18ee85)){_0x5a3672[_0x18ee85]=_0x59ea8d[_0x18ee85];}}};Realtime[_0xa55c('0x13')][_0xa55c('0x15')]=function(){var _0x458480=this;return function(_0x247e77){if(_0x247e77){freeIsNotKey(_0x247e77,_0x458480['agents'],'id');for(var _0x3ccf65=0x0,_0x3dcf4f={},_0x25934f={};_0x3ccf65<_0x247e77[_0xa55c('0x16')];_0x3ccf65+=0x1){_0x3dcf4f=_0x247e77[_0x3ccf65];if(_[_0xa55c('0x17')](_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']])){_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']]=new Agent(_0x3dcf4f);}else{_0x458480[_0xa55c('0x18')](_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']],_0x3dcf4f);}}}return _0x458480['agents'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x19')]=function(){var _0x461284=this;return function(_0x358b61){if(_0x358b61){freeIsNotKey(_0x358b61,_0x461284[_0xa55c('0x9')],'id');for(var _0x5426e5=0x0,_0x4c0daf={},_0x5f5158={};_0x5426e5<_0x358b61[_0xa55c('0x16')];_0x5426e5+=0x1){_0x4c0daf=_0x358b61[_0x5426e5];if(_[_0xa55c('0x17')](_0x461284[_0xa55c('0x9')][_0x4c0daf['id']])){_0x461284['intervals'][_0x4c0daf['id']]=new Interval(_0x4c0daf);}else{_0x461284[_0xa55c('0x18')](_0x461284[_0xa55c('0x9')][_0x4c0daf['id']],_0x4c0daf);}}}return _0x461284['intervals'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1a')]=function(){var _0x940f28=this;return function(_0x1965f1){if(_0x1965f1){freeIsNotKey(_0x1965f1,_0x940f28[_0xa55c('0xa')],'id');for(var _0x49ed04=0x0,_0x1fc828={},_0x504c24={};_0x49ed04<_0x1965f1['length'];_0x49ed04+=0x1){_0x1fc828=_0x1965f1[_0x49ed04];if(_['isUndefined'](_0x940f28[_0xa55c('0xa')][_0x1fc828['id']])){_0x940f28['openchannelQueues'][_0x1fc828['id']]=new OpenchannelQueue(_0x1fc828);}else{_0x940f28[_0xa55c('0x18')](_0x940f28[_0xa55c('0xa')][_0x1fc828['id']],_0x1fc828);}_0x940f28[_0xa55c('0xa')][_0x1fc828['id']][_0xa55c('0x1b')]();_0x940f28[_0xa55c('0xa')][_0x1fc828['id']][_0xa55c('0x1c')]();}}return _0x940f28[_0xa55c('0xa')];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1d')]=function(){var _0x3cd152=this;return function(_0x1273d7){if(_0x1273d7){freeIsNotKey(_0x1273d7,_0x3cd152['chatQueues'],'id');for(var _0x430d55=0x0,_0x28814f={},_0x1c9f6b={};_0x430d55<_0x1273d7[_0xa55c('0x16')];_0x430d55+=0x1){_0x28814f=_0x1273d7[_0x430d55];if(_['isUndefined'](_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']])){_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']]=new ChatQueue(_0x28814f);}else{_0x3cd152[_0xa55c('0x18')](_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']],_0x28814f);}_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']][_0xa55c('0x1b')]();_0x3cd152['chatQueues'][_0x28814f['id']][_0xa55c('0x1c')]();}}return _0x3cd152['chatQueues'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1f')]=function(){var _0x1cc53e=this;return function(_0x223813){if(_0x223813){freeIsNotKey(_0x223813,_0x1cc53e['smsQueues'],'id');for(var _0x3d28fb=0x0,_0x2096ae={},_0x331e58={};_0x3d28fb<_0x223813[_0xa55c('0x16')];_0x3d28fb+=0x1){_0x2096ae=_0x223813[_0x3d28fb];if(_[_0xa55c('0x17')](_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']])){_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']]=new SmsQueue(_0x2096ae);}else{_0x1cc53e[_0xa55c('0x18')](_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']],_0x2096ae);}_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']][_0xa55c('0x1b')]();_0x1cc53e['smsQueues'][_0x2096ae['id']]['updateRealtime']();}}return _0x1cc53e[_0xa55c('0xb')];};};Realtime[_0xa55c('0x13')]['initMailQueues']=function(){var _0x30fadd=this;return function(_0x2f0110){if(_0x2f0110){freeIsNotKey(_0x2f0110,_0x30fadd[_0xa55c('0xc')],'id');for(var _0x1839ac=0x0,_0x30d4f8={},_0x38ff96={};_0x1839ac<_0x2f0110[_0xa55c('0x16')];_0x1839ac+=0x1){_0x30d4f8=_0x2f0110[_0x1839ac];if(_[_0xa55c('0x17')](_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']])){_0x30fadd['mailQueues'][_0x30d4f8['id']]=new MailQueue(_0x30d4f8);}else{_0x30fadd['mergeFromDatabase'](_0x30fadd['mailQueues'][_0x30d4f8['id']],_0x30d4f8);}_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']][_0xa55c('0x1b')]();_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']]['updateRealtime']();}}return _0x30fadd[_0xa55c('0xc')];};};Realtime['prototype'][_0xa55c('0x20')]=function(){var _0x4ad813=this;return function(_0x18c6f1){if(_0x18c6f1){freeIsNotKey(_0x18c6f1,_0x4ad813[_0xa55c('0x21')],'id');for(var _0x3c0ec1=0x0,_0x4d3eb5={},_0x7c4a47={};_0x3c0ec1<_0x18c6f1[_0xa55c('0x16')];_0x3c0ec1+=0x1){_0x4d3eb5=_0x18c6f1[_0x3c0ec1];if(_['isUndefined'](_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']])){_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']]=new FaxQueue(_0x4d3eb5);}else{_0x4ad813['mergeFromDatabase'](_0x4ad813['faxQueues'][_0x4d3eb5['id']],_0x4d3eb5);}_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']]['updateRouting']();_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']][_0xa55c('0x1c')]();}}return _0x4ad813['faxQueues'];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x4de781=this;return function(_0x3b3308){if(_0x3b3308){freeIsNotKey(_0x3b3308,_0x4de781[_0xa55c('0xd')],'id');for(var _0x429336=0x0,_0x99c4f8={},_0x2d8cbf={};_0x429336<_0x3b3308['length'];_0x429336+=0x1){_0x99c4f8=_0x3b3308[_0x429336];if(_[_0xa55c('0x17')](_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']])){_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]=new WhatsappQueue(_0x99c4f8);}else{_0x4de781[_0xa55c('0x18')](_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']],_0x99c4f8);}_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]['updateRouting']();_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]['updateRealtime']();}}return _0x4de781['whatsappQueues'];};};module[_0xa55c('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(_0x5580d2,_0x53501e){var _0x491093=function(_0x381527){while(--_0x381527){_0x5580d2['push'](_0x5580d2['shift']());}};_0x491093(++_0x53501e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0xf3cd[_0x564821];return _0x2b604d;};'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 9fb3704..8338e24 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 _0xae17=['addTags','addTagsToChatInteraction','update','Request','updateChatInteraction'];(function(_0x342131,_0x1ce627){var _0x30c47a=function(_0x460956){while(--_0x460956){_0x342131['push'](_0x342131['shift']());}};_0x30c47a(++_0x1ce627);}(_0xae17,0xc0));var _0x7ae1=function(_0x3bc361,_0x1ed3d8){_0x3bc361=_0x3bc361-0x0;var _0x3ff050=_0xae17[_0x3bc361];return _0x3ff050;};'use strict';var client=require('../client');exports[_0x7ae1('0x0')]=function(_0x4027d1,_0x3bcc6f){return client[_0x7ae1('0x1')]('UpdateChatInteraction',{'body':_0x3bcc6f,'options':{'where':{'id':_0x4027d1}},'log':_0x7ae1('0x2')});};exports[_0x7ae1('0x3')]=function(_0x2a02d0,_0x5b8b27){return client[_0x7ae1('0x1')]('AddTagsToChatInteraction',{'body':_0x5b8b27,'options':{'where':{'id':_0x2a02d0}},'log':_0x7ae1('0x4')});}; \ No newline at end of file +var _0xb88c=['addTags','Request','AddTagsToChatInteraction','../client','update','UpdateChatInteraction'];(function(_0x4efb67,_0x115532){var _0x44ae10=function(_0x5437c9){while(--_0x5437c9){_0x4efb67['push'](_0x4efb67['shift']());}};_0x44ae10(++_0x115532);}(_0xb88c,0x1dd));var _0xcb88=function(_0x16292c,_0x451724){_0x16292c=_0x16292c-0x0;var _0xfb49b3=_0xb88c[_0x16292c];return _0xfb49b3;};'use strict';var client=require(_0xcb88('0x0'));exports[_0xcb88('0x1')]=function(_0x52cb78,_0x34ccf1){return client['Request'](_0xcb88('0x2'),{'body':_0x34ccf1,'options':{'where':{'id':_0x52cb78}},'log':'updateChatInteraction'});};exports[_0xcb88('0x3')]=function(_0x598459,_0x11bcfa){return client[_0xcb88('0x4')](_0xcb88('0x5'),{'body':_0x11bcfa,'options':{'where':{'id':_0x598459}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 4d7da53..2d6978b 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 _0x952c=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x952c,0xee));var _0xc952=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0x952c[_0x3ccdf8];return _0x243dab;};'use strict';var client=require(_0xc952('0x0'));exports[_0xc952('0x1')]=function(_0x2499fb){return client[_0xc952('0x2')](_0xc952('0x3'),{'body':_0x2499fb,'log':_0xc952('0x4')});}; \ No newline at end of file +var _0x9c7d=['../client','create'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x9c7d,0x66));var _0xd9c7=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c7d[_0x160c73];return _0xd9302;};'use strict';var client=require(_0xd9c7('0x0'));exports[_0xd9c7('0x1')]=function(_0x126abe){return client['Request']('CreateChatMessage',{'body':_0x126abe,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 8a59951..6044790 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 _0x81f2=['Request','name','timeout','Agents','chatPause','../client','getChatQueues'];(function(_0x49268e,_0x44502f){var _0x10eabf=function(_0x275f34){while(--_0x275f34){_0x49268e['push'](_0x49268e['shift']());}};_0x10eabf(++_0x44502f);}(_0x81f2,0x7c));var _0x281f=function(_0x4b3ec4,_0x3c573c){_0x4b3ec4=_0x4b3ec4-0x0;var _0x192836=_0x81f2[_0x4b3ec4];return _0x192836;};'use strict';var client=require(_0x281f('0x0'));exports[_0x281f('0x1')]=function(){return function(){return client[_0x281f('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x281f('0x3'),_0x281f('0x4'),'strategy'],'include':[{'model':'User','as':_0x281f('0x5'),'attributes':['id',_0x281f('0x3'),'online',_0x281f('0x6')]}]},'log':_0x281f('0x1')});};}; \ No newline at end of file +var _0x3ce9=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','online'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3ce9,0xef));var _0x93ce=function(_0x388a5b,_0x176028){_0x388a5b=_0x388a5b-0x0;var _0x3fe853=_0x3ce9[_0x388a5b];return _0x3fe853;};'use strict';var client=require(_0x93ce('0x0'));exports[_0x93ce('0x1')]=function(){return function(){return client[_0x93ce('0x2')](_0x93ce('0x3'),{'options':{'raw':![],'attributes':['id',_0x93ce('0x4'),'timeout','strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x93ce('0x4'),_0x93ce('0x5'),_0x93ce('0x6')]}]},'log':_0x93ce('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 566ffd6..7526c1d 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 _0x956a=['DESC','UpdateChatQueueReport','create','Request','CreateChatQueueReport','update'];(function(_0x625313,_0x4dee14){var _0x3edd75=function(_0x35ca15){while(--_0x35ca15){_0x625313['push'](_0x625313['shift']());}};_0x3edd75(++_0x4dee14);}(_0x956a,0xb6));var _0xa956=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x956a[_0x21a9d9];return _0x46adce;};'use strict';var client=require('../client');exports[_0xa956('0x0')]=function(_0x238805){return client[_0xa956('0x1')](_0xa956('0x2'),{'body':_0x238805,'log':_0xa956('0x2')});};exports[_0xa956('0x3')]=function(_0x331696,_0x38c808){return client['Request']('UpdateChatQueueReport',{'body':_0x38c808,'options':{'where':{'uniqueid':_0x331696},'order':[['id',_0xa956('0x4')]],'limit':0x1},'log':_0xa956('0x5')});}; \ No newline at end of file +var _0xcf95=['create','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x5bbf47,_0x31d1cf){var _0x2446b5=function(_0x33881b){while(--_0x33881b){_0x5bbf47['push'](_0x5bbf47['shift']());}};_0x2446b5(++_0x31d1cf);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5cf9('0x0'));exports[_0x5cf9('0x1')]=function(_0x4a9fcc){return client['Request']('CreateChatQueueReport',{'body':_0x4a9fcc,'log':_0x5cf9('0x2')});};exports[_0x5cf9('0x3')]=function(_0x24097a,_0x102b24){return client['Request'](_0x5cf9('0x4'),{'body':_0x102b24,'options':{'where':{'uniqueid':_0x24097a},'order':[['id',_0x5cf9('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 7dce1c7..2e8b593 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 _0xf826=['UpdateFaxInteraction','updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction','../client','update'];(function(_0x3c0e2c,_0x2a1bbe){var _0xf28c7f=function(_0x385124){while(--_0x385124){_0x3c0e2c['push'](_0x3c0e2c['shift']());}};_0xf28c7f(++_0x2a1bbe);}(_0xf826,0x9f));var _0x6f82=function(_0x21a0c5,_0x586032){_0x21a0c5=_0x21a0c5-0x0;var _0x13d439=_0xf826[_0x21a0c5];return _0x13d439;};'use strict';var client=require(_0x6f82('0x0'));exports[_0x6f82('0x1')]=function(_0x18d89d,_0x512f7f){return client['Request'](_0x6f82('0x2'),{'body':_0x512f7f,'options':{'where':{'id':_0x18d89d}},'log':_0x6f82('0x3')});};exports[_0x6f82('0x4')]=function(_0x4fe4c4,_0x4bf3fd){return client[_0x6f82('0x5')](_0x6f82('0x6'),{'body':_0x4bf3fd,'options':{'where':{'id':_0x4fe4c4}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x8efa=['../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags','Request'];(function(_0x45b9b5,_0x46d85c){var _0x21b0b2=function(_0x29b866){while(--_0x29b866){_0x45b9b5['push'](_0x45b9b5['shift']());}};_0x21b0b2(++_0x46d85c);}(_0x8efa,0x1f2));var _0xa8ef=function(_0x525afa,_0xdf4337){_0x525afa=_0x525afa-0x0;var _0x5ddad6=_0x8efa[_0x525afa];return _0x5ddad6;};'use strict';var client=require(_0xa8ef('0x0'));exports[_0xa8ef('0x1')]=function(_0x254b2c,_0x42a3fc){return client['Request'](_0xa8ef('0x2'),{'body':_0x42a3fc,'options':{'where':{'id':_0x254b2c}},'log':_0xa8ef('0x3')});};exports[_0xa8ef('0x4')]=function(_0x25348e,_0x339098){return client[_0xa8ef('0x5')]('AddTagsToFaxInteraction',{'body':_0x339098,'options':{'where':{'id':_0x25348e}},'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 a6e8e66..37439fd 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 _0xf693=['create','createFaxMessage','../client'];(function(_0x127364,_0x591295){var _0x12c89a=function(_0x38d257){while(--_0x38d257){_0x127364['push'](_0x127364['shift']());}};_0x12c89a(++_0x591295);}(_0xf693,0x119));var _0x3f69=function(_0x20fd86,_0x2a93ad){_0x20fd86=_0x20fd86-0x0;var _0x1a6fb2=_0xf693[_0x20fd86];return _0x1a6fb2;};'use strict';var client=require(_0x3f69('0x0'));exports[_0x3f69('0x1')]=function(_0x3720b6){return client['Request']('CreateFaxMessage',{'body':_0x3720b6,'log':_0x3f69('0x2')});}; \ No newline at end of file +var _0x24bd=['createFaxMessage','Request','CreateFaxMessage'];(function(_0x21c222,_0x406d0a){var _0x5ec82a=function(_0x11084a){while(--_0x11084a){_0x21c222['push'](_0x21c222['shift']());}};_0x5ec82a(++_0x406d0a);}(_0x24bd,0x97));var _0xd24b=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x24bd[_0x4e9628];return _0x27bc8c;};'use strict';var client=require('../client');exports['create']=function(_0x595b41){return client[_0xd24b('0x0')](_0xd24b('0x1'),{'body':_0x595b41,'log':_0xd24b('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 254b428..dd00131 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 _0x79a1=['name','timeout','strategy','Agents','faxPause','../client','getFaxQueues','Request','GetFaxQueue'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x79a1,0x1d9));var _0x179a=function(_0x557e01,_0x224001){_0x557e01=_0x557e01-0x0;var _0x3976f6=_0x79a1[_0x557e01];return _0x3976f6;};'use strict';var client=require(_0x179a('0x0'));exports[_0x179a('0x1')]=function(){return function(){return client[_0x179a('0x2')](_0x179a('0x3'),{'options':{'raw':![],'attributes':['id',_0x179a('0x4'),_0x179a('0x5'),_0x179a('0x6')],'include':[{'model':'User','as':_0x179a('0x7'),'attributes':['id',_0x179a('0x4'),'online',_0x179a('0x8')]}]},'log':_0x179a('0x1')});};}; \ No newline at end of file +var _0xeb9c=['Agents','online','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xeb9c,0x142));var _0xceb9=function(_0x349b1e,_0x114c00){_0x349b1e=_0x349b1e-0x0;var _0x3d1d8c=_0xeb9c[_0x349b1e];return _0x3d1d8c;};'use strict';var client=require(_0xceb9('0x0'));exports[_0xceb9('0x1')]=function(){return function(){return client[_0xceb9('0x2')](_0xceb9('0x3'),{'options':{'raw':![],'attributes':['id',_0xceb9('0x4'),_0xceb9('0x5'),_0xceb9('0x6')],'include':[{'model':_0xceb9('0x7'),'as':_0xceb9('0x8'),'attributes':['id','name',_0xceb9('0x9'),'faxPause']}]},'log':_0xceb9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 3d229d3..aff727f 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 _0x678a=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x3df81d,_0x36cc7c){var _0x48e7b3=function(_0xcfad04){while(--_0xcfad04){_0x3df81d['push'](_0x3df81d['shift']());}};_0x48e7b3(++_0x36cc7c);}(_0x678a,0xde));var _0xa678=function(_0x2c3dbc,_0x9fa31f){_0x2c3dbc=_0x2c3dbc-0x0;var _0x470e38=_0x678a[_0x2c3dbc];return _0x470e38;};'use strict';var client=require('../client');exports[_0xa678('0x0')]=function(_0x13cf1c){return client[_0xa678('0x1')](_0xa678('0x2'),{'body':_0x13cf1c,'log':_0xa678('0x2')});};exports[_0xa678('0x3')]=function(_0x2b6cec,_0x78034a){return client[_0xa678('0x1')](_0xa678('0x4'),{'body':_0x78034a,'options':{'where':{'uniqueid':_0x2b6cec},'order':[['id',_0xa678('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x3b0a=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','create'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x3b0a,0xa9));var _0xa3b0=function(_0x4cec16,_0x5dc82d){_0x4cec16=_0x4cec16-0x0;var _0x34fb1e=_0x3b0a[_0x4cec16];return _0x34fb1e;};'use strict';var client=require('../client');exports[_0xa3b0('0x0')]=function(_0x5f557d){return client[_0xa3b0('0x1')](_0xa3b0('0x2'),{'body':_0x5f557d,'log':_0xa3b0('0x2')});};exports[_0xa3b0('0x3')]=function(_0x5c6332,_0x2c0bfe){return client[_0xa3b0('0x1')](_0xa3b0('0x4'),{'body':_0x2c0bfe,'options':{'where':{'uniqueid':_0x5c6332},'order':[['id','DESC']],'limit':0x1},'log':_0xa3b0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c1d5859..52dc1e9 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 _0x1d2d=['../client','getIntervals','Request','GetInterval','name','Intervals'];(function(_0x3d67b6,_0x3a4255){var _0x3d2fef=function(_0x51aa68){while(--_0x51aa68){_0x3d67b6['push'](_0x3d67b6['shift']());}};_0x3d2fef(++_0x3a4255);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x31c683,_0x19b003){_0x31c683=_0x31c683-0x0;var _0x5e02df=_0x1d2d[_0x31c683];return _0x5e02df;};'use strict';var client=require(_0xd1d2('0x0'));exports[_0xd1d2('0x1')]=function(){return function(){return client[_0xd1d2('0x2')](_0xd1d2('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd1d2('0x4')],'include':[{'model':'Interval','as':_0xd1d2('0x5'),'attributes':['id','name','interval']}]},'log':_0xd1d2('0x1')});};}; \ No newline at end of file +var _0x8603=['GetInterval','Intervals','name','interval','getIntervals','Request'];(function(_0x4cb590,_0x767f92){var _0x2ed677=function(_0x4e4661){while(--_0x4e4661){_0x4cb590['push'](_0x4cb590['shift']());}};_0x2ed677(++_0x767f92);}(_0x8603,0x190));var _0x3860=function(_0x513d65,_0x156ef6){_0x513d65=_0x513d65-0x0;var _0x307aa9=_0x8603[_0x513d65];return _0x307aa9;};'use strict';var client=require('../client');exports[_0x3860('0x0')]=function(){return function(){return client[_0x3860('0x1')](_0x3860('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x3860('0x3'),'attributes':['id',_0x3860('0x4'),_0x3860('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f9a9f9c..ab590e6 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 _0x3ee8=['UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x3ee8,0x1d5));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x83ee('0x0'));exports[_0x83ee('0x1')]=function(_0x2c0083,_0x488d2e){return client[_0x83ee('0x2')](_0x83ee('0x3'),{'body':_0x488d2e,'options':{'where':{'id':_0x2c0083}},'log':_0x83ee('0x4')});};exports[_0x83ee('0x5')]=function(_0xd5691,_0x1c2fe8){return client['Request'](_0x83ee('0x6'),{'body':_0x1c2fe8,'options':{'where':{'id':_0xd5691}},'log':_0x83ee('0x7')});}; \ No newline at end of file +var _0xca05=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0xc04091,_0xd149d1){var _0x23dba2=function(_0xffe26b){while(--_0xffe26b){_0xc04091['push'](_0xc04091['shift']());}};_0x23dba2(++_0xd149d1);}(_0xca05,0x192));var _0x5ca0=function(_0x3e2480,_0x2eed70){_0x3e2480=_0x3e2480-0x0;var _0x652c0=_0xca05[_0x3e2480];return _0x652c0;};'use strict';var client=require('../client');exports[_0x5ca0('0x0')]=function(_0x481e49,_0x4470e9){return client[_0x5ca0('0x1')](_0x5ca0('0x2'),{'body':_0x4470e9,'options':{'where':{'id':_0x481e49}},'log':_0x5ca0('0x3')});};exports[_0x5ca0('0x4')]=function(_0x4a23b2,_0x2ceb5c){return client[_0x5ca0('0x1')](_0x5ca0('0x5'),{'body':_0x2ceb5c,'options':{'where':{'id':_0x4a23b2}},'log':_0x5ca0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index de1c2cc..4eb9bd2 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 _0xe173=['../client','create','Request'];(function(_0x5c768b,_0x5e88a6){var _0x335af8=function(_0x39b04f){while(--_0x39b04f){_0x5c768b['push'](_0x5c768b['shift']());}};_0x335af8(++_0x5e88a6);}(_0xe173,0x18c));var _0x3e17=function(_0xfc5771,_0x4e67b4){_0xfc5771=_0xfc5771-0x0;var _0x36e95f=_0xe173[_0xfc5771];return _0x36e95f;};'use strict';var client=require(_0x3e17('0x0'));exports[_0x3e17('0x1')]=function(_0x453d87){return client[_0x3e17('0x2')]('CreateMailMessage',{'body':_0x453d87,'log':'createMailMessage'});}; \ No newline at end of file +var _0x9342=['Request','CreateMailMessage','../client'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9342,0x77));var _0x2934=function(_0x4ee05b,_0xb06599){_0x4ee05b=_0x4ee05b-0x0;var _0x1135db=_0x9342[_0x4ee05b];return _0x1135db;};'use strict';var client=require(_0x2934('0x0'));exports['create']=function(_0x141342){return client[_0x2934('0x1')](_0x2934('0x2'),{'body':_0x141342,'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 7fd7ad5..eafa0f9 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 _0xf1e8=['online','getMailQueues','../client','Request','GetMailQueue','User','Agents'];(function(_0x1f182f,_0x542dae){var _0x5ed2d9=function(_0x7d4282){while(--_0x7d4282){_0x1f182f['push'](_0x1f182f['shift']());}};_0x5ed2d9(++_0x542dae);}(_0xf1e8,0x167));var _0x8f1e=function(_0x58fb46,_0x33434d){_0x58fb46=_0x58fb46-0x0;var _0x59e16c=_0xf1e8[_0x58fb46];return _0x59e16c;};'use strict';var client=require(_0x8f1e('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x8f1e('0x1')](_0x8f1e('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x8f1e('0x3'),'as':_0x8f1e('0x4'),'attributes':['id','name',_0x8f1e('0x5'),'mailPause']}]},'log':_0x8f1e('0x6')});};}; \ No newline at end of file +var _0xf83e=['strategy','User','Agents','online','mailPause','getMailQueues','../client','Request'];(function(_0x165235,_0x9089bc){var _0x1ab57e=function(_0x54f25d){while(--_0x54f25d){_0x165235['push'](_0x165235['shift']());}};_0x1ab57e(++_0x9089bc);}(_0xf83e,0x76));var _0xef83=function(_0x26764f,_0x43f4e7){_0x26764f=_0x26764f-0x0;var _0x53c715=_0xf83e[_0x26764f];return _0x53c715;};'use strict';var client=require(_0xef83('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xef83('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xef83('0x2')],'include':[{'model':_0xef83('0x3'),'as':_0xef83('0x4'),'attributes':['id','name',_0xef83('0x5'),_0xef83('0x6')]}]},'log':_0xef83('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index c79ec77..44dbad6 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 _0xa4b7=['CreateMailQueueReport','DESC','UpdateMailQueueReport','../client','Request'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xa4b7,0x76));var _0x7a4b=function(_0x166318,_0x3d36ee){_0x166318=_0x166318-0x0;var _0x3d160f=_0xa4b7[_0x166318];return _0x3d160f;};'use strict';var client=require(_0x7a4b('0x0'));exports['create']=function(_0x5566c3){return client[_0x7a4b('0x1')](_0x7a4b('0x2'),{'body':_0x5566c3,'log':_0x7a4b('0x2')});};exports['update']=function(_0x15189f,_0x1fb1c7){return client[_0x7a4b('0x1')]('UpdateMailQueueReport',{'body':_0x1fb1c7,'options':{'where':{'uniqueid':_0x15189f},'order':[['id',_0x7a4b('0x3')]],'limit':0x1},'log':_0x7a4b('0x4')});}; \ No newline at end of file +var _0x70dc=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client'];(function(_0x5e8c25,_0x3dde6d){var _0x1797fb=function(_0xffcea5){while(--_0xffcea5){_0x5e8c25['push'](_0x5e8c25['shift']());}};_0x1797fb(++_0x3dde6d);}(_0x70dc,0x135));var _0xc70d=function(_0x24e24c,_0xebc953){_0x24e24c=_0x24e24c-0x0;var _0x30577f=_0x70dc[_0x24e24c];return _0x30577f;};'use strict';var client=require(_0xc70d('0x0'));exports['create']=function(_0x58880a){return client[_0xc70d('0x1')](_0xc70d('0x2'),{'body':_0x58880a,'log':_0xc70d('0x2')});};exports[_0xc70d('0x3')]=function(_0x10116e,_0x5075ee){return client[_0xc70d('0x1')](_0xc70d('0x4'),{'body':_0x5075ee,'options':{'where':{'uniqueid':_0x10116e},'order':[['id','DESC']],'limit':0x1},'log':_0xc70d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index db3a68e..3938fd9 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 _0x9262=['addTagsToChatInteraction','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x53d492,_0x1cc6ad){var _0x4fca24=function(_0x48c254){while(--_0x48c254){_0x53d492['push'](_0x53d492['shift']());}};_0x4fca24(++_0x1cc6ad);}(_0x9262,0x150));var _0x2926=function(_0x524f69,_0x24570f){_0x524f69=_0x524f69-0x0;var _0x56c7df=_0x9262[_0x524f69];return _0x56c7df;};'use strict';var client=require('../client');exports['update']=function(_0x331bbc,_0x5abaac){return client['Request'](_0x2926('0x0'),{'body':_0x5abaac,'options':{'where':{'id':_0x331bbc}},'log':_0x2926('0x1')});};exports[_0x2926('0x2')]=function(_0x2f8a10,_0x19df25){return client['Request'](_0x2926('0x3'),{'body':_0x19df25,'options':{'where':{'id':_0x2f8a10}},'log':_0x2926('0x4')});}; \ No newline at end of file +var _0x4216=['../client','update','Request','addTagsToChatInteraction'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x4216,0xdc));var _0x6421=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4216[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x6421('0x0'));exports[_0x6421('0x1')]=function(_0x1f56c6,_0x6a1c56){return client[_0x6421('0x2')]('UpdateOpenchannelInteraction',{'body':_0x6a1c56,'options':{'where':{'id':_0x1f56c6}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x451f7c,_0xe1b0ec){return client[_0x6421('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0xe1b0ec,'options':{'where':{'id':_0x451f7c}},'log':_0x6421('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 1a439bc..61defc6 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 _0xdace=['Request','CreateOpenchannelMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdace,0xc5));var _0xedac=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xdace[_0x16d10f];return _0x50c823;};'use strict';var client=require(_0xedac('0x0'));exports['create']=function(_0x1c76b2){return client[_0xedac('0x1')](_0xedac('0x2'),{'body':_0x1c76b2,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0xedd9,0xfc));var _0x9edd=function(_0x6e6e45,_0x1d7bf3){_0x6e6e45=_0x6e6e45-0x0;var _0x5f21e0=_0xedd9[_0x6e6e45];return _0x5f21e0;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 8b56176..83e7f20 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 _0xdcaa=['Request','name','timeout','strategy','User','Agents','online','../client'];(function(_0x4b9014,_0x3b0b76){var _0x53fdce=function(_0xe31f52){while(--_0xe31f52){_0x4b9014['push'](_0x4b9014['shift']());}};_0x53fdce(++_0x3b0b76);}(_0xdcaa,0xf7));var _0xadca=function(_0x121b9c,_0x2b4cfe){_0x121b9c=_0x121b9c-0x0;var _0x2cc3bd=_0xdcaa[_0x121b9c];return _0x2cc3bd;};'use strict';var client=require(_0xadca('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xadca('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xadca('0x2'),_0xadca('0x3'),_0xadca('0x4')],'include':[{'model':_0xadca('0x5'),'as':_0xadca('0x6'),'attributes':['id',_0xadca('0x2'),_0xadca('0x7'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x24b8=['GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x5d536f,_0x3fa5ae){var _0x3c995a=function(_0x5ac807){while(--_0x5ac807){_0x5d536f['push'](_0x5d536f['shift']());}};_0x3c995a(++_0x3fa5ae);}(_0x24b8,0x8a));var _0x824b=function(_0x9c532c,_0x4b0635){_0x9c532c=_0x9c532c-0x0;var _0x462e18=_0x24b8[_0x9c532c];return _0x462e18;};'use strict';var client=require(_0x824b('0x0'));exports[_0x824b('0x1')]=function(){return function(){return client['Request'](_0x824b('0x2'),{'options':{'raw':![],'attributes':['id',_0x824b('0x3'),_0x824b('0x4'),_0x824b('0x5')],'include':[{'model':_0x824b('0x6'),'as':_0x824b('0x7'),'attributes':['id','name',_0x824b('0x8'),_0x824b('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index e80fb3b..2fa2dad 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 _0x1377=['Request','UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport','update'];(function(_0x105e9e,_0x6dd9d3){var _0x2e9bda=function(_0x27fa82){while(--_0x27fa82){_0x105e9e['push'](_0x105e9e['shift']());}};_0x2e9bda(++_0x6dd9d3);}(_0x1377,0xf2));var _0x7137=function(_0x4230c5,_0xe441c){_0x4230c5=_0x4230c5-0x0;var _0x380fe0=_0x1377[_0x4230c5];return _0x380fe0;};'use strict';var client=require(_0x7137('0x0'));exports[_0x7137('0x1')]=function(_0x1c9e95){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x1c9e95,'log':_0x7137('0x2')});};exports[_0x7137('0x3')]=function(_0x1d5549,_0x41c754){return client[_0x7137('0x4')](_0x7137('0x5'),{'body':_0x41c754,'options':{'where':{'uniqueid':_0x1d5549},'order':[['id','DESC']],'limit':0x1},'log':_0x7137('0x5')});}; \ No newline at end of file +var _0x67fd=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','../client','create'];(function(_0x26d02f,_0x12307e){var _0x121816=function(_0x593bd8){while(--_0x593bd8){_0x26d02f['push'](_0x26d02f['shift']());}};_0x121816(++_0x12307e);}(_0x67fd,0xc1));var _0xd67f=function(_0x337182,_0x49b81b){_0x337182=_0x337182-0x0;var _0x2bddf4=_0x67fd[_0x337182];return _0x2bddf4;};'use strict';var client=require(_0xd67f('0x0'));exports[_0xd67f('0x1')]=function(_0x20685d){return client[_0xd67f('0x2')](_0xd67f('0x3'),{'body':_0x20685d,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x55f372,_0x2163b0){return client[_0xd67f('0x2')](_0xd67f('0x4'),{'body':_0x2163b0,'options':{'where':{'uniqueid':_0x55f372},'order':[['id','DESC']],'limit':0x1},'log':_0xd67f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index d01cdc4..7abb198 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 _0x264f=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x42c6d6,_0x522db7){var _0x31da6f=function(_0x1fe8d2){while(--_0x1fe8d2){_0x42c6d6['push'](_0x42c6d6['shift']());}};_0x31da6f(++_0x522db7);}(_0x264f,0x184));var _0xf264=function(_0x5dc0a0,_0x29776c){_0x5dc0a0=_0x5dc0a0-0x0;var _0x341f1d=_0x264f[_0x5dc0a0];return _0x341f1d;};'use strict';var client=require(_0xf264('0x0'));exports[_0xf264('0x1')]=function(_0x451862,_0x3b9336){return client[_0xf264('0x2')](_0xf264('0x3'),{'body':_0x3b9336,'options':{'where':{'id':_0x451862}},'log':_0xf264('0x4')});};exports[_0xf264('0x5')]=function(_0xf54633,_0x1a8b8a){return client[_0xf264('0x2')](_0xf264('0x6'),{'body':_0x1a8b8a,'options':{'where':{'id':_0xf54633}},'log':_0xf264('0x7')});}; \ No newline at end of file +var _0xd050=['../client','Request','UpdateSmsInteraction','addTags'];(function(_0x25b43b,_0x1433bb){var _0xe9a6d9=function(_0x3d5da5){while(--_0x3d5da5){_0x25b43b['push'](_0x25b43b['shift']());}};_0xe9a6d9(++_0x1433bb);}(_0xd050,0x158));var _0x0d05=function(_0x4cde34,_0x54e24c){_0x4cde34=_0x4cde34-0x0;var _0x4cf4d8=_0xd050[_0x4cde34];return _0x4cf4d8;};'use strict';var client=require(_0x0d05('0x0'));exports['update']=function(_0x15b07a,_0x44f20a){return client[_0x0d05('0x1')](_0x0d05('0x2'),{'body':_0x44f20a,'options':{'where':{'id':_0x15b07a}},'log':'updateSmsInteraction'});};exports[_0x0d05('0x3')]=function(_0x1528b9,_0x2c7fa4){return client[_0x0d05('0x1')]('AddTagsToSmsInteraction',{'body':_0x2c7fa4,'options':{'where':{'id':_0x1528b9}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 903bc17..c4ea0ed 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 _0x23c6=['createSmsMessage','CreateSmsMessage'];(function(_0x132659,_0x486e0c){var _0x215fc3=function(_0x3a14e8){while(--_0x3a14e8){_0x132659['push'](_0x132659['shift']());}};_0x215fc3(++_0x486e0c);}(_0x23c6,0xe1));var _0x623c=function(_0xb6c4e7,_0x586793){_0xb6c4e7=_0xb6c4e7-0x0;var _0x3c8b26=_0x23c6[_0xb6c4e7];return _0x3c8b26;};'use strict';var client=require('../client');exports['create']=function(_0x3077bf){return client['Request'](_0x623c('0x0'),{'body':_0x3077bf,'log':_0x623c('0x1')});}; \ No newline at end of file +var _0x6db1=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x3c2e88,_0xf8ed3f){var _0x5536b0=function(_0x173500){while(--_0x173500){_0x3c2e88['push'](_0x3c2e88['shift']());}};_0x5536b0(++_0xf8ed3f);}(_0x6db1,0x13e));var _0x16db=function(_0x3cd161,_0x4dbac3){_0x3cd161=_0x3cd161-0x0;var _0x4bbdbf=_0x6db1[_0x3cd161];return _0x4bbdbf;};'use strict';var client=require(_0x16db('0x0'));exports[_0x16db('0x1')]=function(_0x13e841){return client[_0x16db('0x2')](_0x16db('0x3'),{'body':_0x13e841,'log':_0x16db('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index e7df1d4..56468ad 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 _0x8c7a=['getSmsQueues','Request','GetSmsQueue','name','Agents','online','smsPause','../client'];(function(_0x40b09f,_0x161f4f){var _0x3dbee2=function(_0x135eb7){while(--_0x135eb7){_0x40b09f['push'](_0x40b09f['shift']());}};_0x3dbee2(++_0x161f4f);}(_0x8c7a,0x197));var _0xa8c7=function(_0x302f4e,_0xea6852){_0x302f4e=_0x302f4e-0x0;var _0x37b08a=_0x8c7a[_0x302f4e];return _0x37b08a;};'use strict';var client=require(_0xa8c7('0x0'));exports[_0xa8c7('0x1')]=function(){return function(){return client[_0xa8c7('0x2')](_0xa8c7('0x3'),{'options':{'raw':![],'attributes':['id',_0xa8c7('0x4'),'timeout','strategy'],'include':[{'model':'User','as':_0xa8c7('0x5'),'attributes':['id',_0xa8c7('0x4'),_0xa8c7('0x6'),_0xa8c7('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x4a9a=['timeout','User','Agents','smsPause','getSmsQueues','Request','name'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x4a9a,0x123));var _0xa4a9=function(_0x2ea9b9,_0x43cf28){_0x2ea9b9=_0x2ea9b9-0x0;var _0xff0b58=_0x4a9a[_0x2ea9b9];return _0xff0b58;};'use strict';var client=require('../client');exports[_0xa4a9('0x0')]=function(){return function(){return client[_0xa4a9('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0xa4a9('0x2'),_0xa4a9('0x3'),'strategy'],'include':[{'model':_0xa4a9('0x4'),'as':_0xa4a9('0x5'),'attributes':['id','name','online',_0xa4a9('0x6')]}]},'log':_0xa4a9('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a44077d..0a3f79c 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 _0xb57d=['Request','CreateSmsQueueReport','update','DESC','UpdateSmsQueueReport','../client','create'];(function(_0x134054,_0x22e29c){var _0x480095=function(_0x237d60){while(--_0x237d60){_0x134054['push'](_0x134054['shift']());}};_0x480095(++_0x22e29c);}(_0xb57d,0x18d));var _0xdb57=function(_0x25c044,_0xbd05f8){_0x25c044=_0x25c044-0x0;var _0x558ee5=_0xb57d[_0x25c044];return _0x558ee5;};'use strict';var client=require(_0xdb57('0x0'));exports[_0xdb57('0x1')]=function(_0x267364){return client[_0xdb57('0x2')](_0xdb57('0x3'),{'body':_0x267364,'log':'CreateSmsQueueReport'});};exports[_0xdb57('0x4')]=function(_0x476bfb,_0x155b1){return client[_0xdb57('0x2')]('UpdateSmsQueueReport',{'body':_0x155b1,'options':{'where':{'uniqueid':_0x476bfb},'order':[['id',_0xdb57('0x5')]],'limit':0x1},'log':_0xdb57('0x6')});}; \ No newline at end of file +var _0x49d9=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x49d9,0x13e));var _0x949d=function(_0x514c83,_0x3aab8e){_0x514c83=_0x514c83-0x0;var _0x117031=_0x49d9[_0x514c83];return _0x117031;};'use strict';var client=require(_0x949d('0x0'));exports[_0x949d('0x1')]=function(_0x2b5027){return client[_0x949d('0x2')](_0x949d('0x3'),{'body':_0x2b5027,'log':'CreateSmsQueueReport'});};exports[_0x949d('0x4')]=function(_0x2cb999,_0x29136d){return client[_0x949d('0x2')](_0x949d('0x5'),{'body':_0x29136d,'options':{'where':{'uniqueid':_0x2cb999},'order':[['id','DESC']],'limit':0x1},'log':_0x949d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 858ef0a..e85015b 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 _0x9ce8=['pauseType','lastPauseAt','voicePause','mailPause','faxPause','smsPause','whatsappPause','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','Request','GetUser','agent','name','online'];(function(_0x35fc73,_0xd349d8){var _0x277103=function(_0x3e2cbb){while(--_0x3e2cbb){_0x35fc73['push'](_0x35fc73['shift']());}};_0x277103(++_0xd349d8);}(_0x9ce8,0x9c));var _0x89ce=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x9ce8[_0x3da832];return _0xe602f2;};'use strict';var client=require('../client');exports[_0x89ce('0x0')]=function(){return function(){return client[_0x89ce('0x1')](_0x89ce('0x2'),{'options':{'raw':!![],'where':{'role':_0x89ce('0x3')},'attributes':['id',_0x89ce('0x4'),_0x89ce('0x5'),_0x89ce('0x6'),_0x89ce('0x7'),_0x89ce('0x8'),'chatPause',_0x89ce('0x9'),_0x89ce('0xa'),_0x89ce('0xb'),_0x89ce('0xc'),'openchannelPause','chatCapacity',_0x89ce('0xd'),_0x89ce('0xe'),_0x89ce('0xf'),_0x89ce('0x10'),_0x89ce('0x11')]},'log':_0x89ce('0x0')});};}; \ No newline at end of file +var _0x0e01=['GetUser','voicePause','mailPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request'];(function(_0x163b50,_0x4535e9){var _0x2d8549=function(_0x3532f3){while(--_0x3532f3){_0x163b50['push'](_0x163b50['shift']());}};_0x2d8549(++_0x4535e9);}(_0x0e01,0x89));var _0x10e0=function(_0x1ee72a,_0x22998b){_0x1ee72a=_0x1ee72a-0x0;var _0x26a531=_0x0e01[_0x1ee72a];return _0x26a531;};'use strict';var client=require(_0x10e0('0x0'));exports[_0x10e0('0x1')]=function(){return function(){return client[_0x10e0('0x2')](_0x10e0('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name','online','pauseType','lastPauseAt',_0x10e0('0x4'),'chatPause',_0x10e0('0x5'),'faxPause',_0x10e0('0x6'),_0x10e0('0x7'),_0x10e0('0x8'),_0x10e0('0x9'),_0x10e0('0xa'),_0x10e0('0xb'),_0x10e0('0xc'),_0x10e0('0xd'),'openchannelCapacity']},'log':_0x10e0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index f59beee..32eda95 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 _0xb4e6=['update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x17e4f4,_0x42b69d){var _0x1a1710=function(_0x54e0e4){while(--_0x54e0e4){_0x17e4f4['push'](_0x17e4f4['shift']());}};_0x1a1710(++_0x42b69d);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x325501,_0x5242f6){_0x325501=_0x325501-0x0;var _0x2c1626=_0xb4e6[_0x325501];return _0x2c1626;};'use strict';var client=require(_0x6b4e('0x0'));exports[_0x6b4e('0x1')]=function(_0x3c385b,_0x9babca){return client[_0x6b4e('0x2')](_0x6b4e('0x3'),{'body':_0x9babca,'options':{'where':{'id':_0x3c385b}},'log':'updateWhatsappInteraction'});};exports[_0x6b4e('0x4')]=function(_0x55df8c,_0x1f75ee){return client[_0x6b4e('0x2')](_0x6b4e('0x5'),{'body':_0x1f75ee,'options':{'where':{'id':_0x55df8c}},'log':_0x6b4e('0x6')});}; \ No newline at end of file +var _0xc298=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update'];(function(_0x32fe84,_0x245dfb){var _0x21cf3f=function(_0x11507c){while(--_0x11507c){_0x32fe84['push'](_0x32fe84['shift']());}};_0x21cf3f(++_0x245dfb);}(_0xc298,0x143));var _0x8c29=function(_0x1662a0,_0x2a19cd){_0x1662a0=_0x1662a0-0x0;var _0xbb687f=_0xc298[_0x1662a0];return _0xbb687f;};'use strict';var client=require('../client');exports[_0x8c29('0x0')]=function(_0x19c394,_0x184d9f){return client[_0x8c29('0x1')](_0x8c29('0x2'),{'body':_0x184d9f,'options':{'where':{'id':_0x19c394}},'log':_0x8c29('0x3')});};exports['addTags']=function(_0x9da56d,_0x229bf9){return client[_0x8c29('0x1')](_0x8c29('0x4'),{'body':_0x229bf9,'options':{'where':{'id':_0x9da56d}},'log':_0x8c29('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 3f67794..4d49e8f 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 _0x1d1a=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x1d1a,0x8c));var _0xa1d1=function(_0x1f0d9b,_0x5dfdaf){_0x1f0d9b=_0x1f0d9b-0x0;var _0x27841c=_0x1d1a[_0x1f0d9b];return _0x27841c;};'use strict';var client=require(_0xa1d1('0x0'));exports[_0xa1d1('0x1')]=function(_0x4dc789){return client[_0xa1d1('0x2')](_0xa1d1('0x3'),{'body':_0x4dc789,'log':_0xa1d1('0x4')});}; \ No newline at end of file +var _0x8670=['create','Request','../client'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x8670,0x80));var _0x0867=function(_0x54f3e8,_0x3ed493){_0x54f3e8=_0x54f3e8-0x0;var _0x267b37=_0x8670[_0x54f3e8];return _0x267b37;};'use strict';var client=require(_0x0867('0x0'));exports[_0x0867('0x1')]=function(_0x3217b1){return client[_0x0867('0x2')]('CreateWhatsappMessage',{'body':_0x3217b1,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index d968fd3..0d1a9b3 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 _0xd4f4=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','../client'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x2e6f92,_0x12e5b6){_0x2e6f92=_0x2e6f92-0x0;var _0x4171b5=_0xd4f4[_0x2e6f92];return _0x4171b5;};'use strict';var client=require(_0x4d4f('0x0'));exports[_0x4d4f('0x1')]=function(){return function(){return client[_0x4d4f('0x2')](_0x4d4f('0x3'),{'options':{'raw':![],'attributes':['id',_0x4d4f('0x4'),_0x4d4f('0x5'),_0x4d4f('0x6')],'include':[{'model':_0x4d4f('0x7'),'as':_0x4d4f('0x8'),'attributes':['id',_0x4d4f('0x4'),_0x4d4f('0x9'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xdc9b=['../client','getWhatsappQueues','Request','name','timeout','Agents','whatsappPause'];(function(_0x3a4f0c,_0x308523){var _0x4d7f1b=function(_0x40111c){while(--_0x40111c){_0x3a4f0c['push'](_0x3a4f0c['shift']());}};_0x4d7f1b(++_0x308523);}(_0xdc9b,0x70));var _0xbdc9=function(_0xa61cd1,_0x428179){_0xa61cd1=_0xa61cd1-0x0;var _0x2be4fa=_0xdc9b[_0xa61cd1];return _0x2be4fa;};'use strict';var client=require(_0xbdc9('0x0'));exports[_0xbdc9('0x1')]=function(){return function(){return client[_0xbdc9('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xbdc9('0x3'),_0xbdc9('0x4'),'strategy'],'include':[{'model':'User','as':_0xbdc9('0x5'),'attributes':['id',_0xbdc9('0x3'),'online',_0xbdc9('0x6')]}]},'log':_0xbdc9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index eef701c..da62dd2 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 _0x47be=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','../client'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x47be,0x6b));var _0xe47b=function(_0x29cf89,_0x10ce1f){_0x29cf89=_0x29cf89-0x0;var _0x34ac61=_0x47be[_0x29cf89];return _0x34ac61;};'use strict';var client=require(_0xe47b('0x0'));exports['create']=function(_0x1d609c){return client[_0xe47b('0x1')]('CreateWhatsappQueueReport',{'body':_0x1d609c,'log':_0xe47b('0x2')});};exports['update']=function(_0x156427,_0x18b421){return client[_0xe47b('0x1')](_0xe47b('0x3'),{'body':_0x18b421,'options':{'where':{'uniqueid':_0x156427},'order':[['id','DESC']],'limit':0x1},'log':_0xe47b('0x3')});}; \ No newline at end of file +var _0x1f8c=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create'];(function(_0x17476f,_0x5d16be){var _0x1f71ff=function(_0x3e390e){while(--_0x3e390e){_0x17476f['push'](_0x17476f['shift']());}};_0x1f71ff(++_0x5d16be);}(_0x1f8c,0x1da));var _0xc1f8=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0x1f8c[_0x40ebff];return _0x40122a;};'use strict';var client=require('../client');exports[_0xc1f8('0x0')]=function(_0x41c870){return client['Request'](_0xc1f8('0x1'),{'body':_0x41c870,'log':_0xc1f8('0x1')});};exports[_0xc1f8('0x2')]=function(_0x2c21de,_0x28ea90){return client['Request'](_0xc1f8('0x3'),{'body':_0x28ea90,'options':{'where':{'uniqueid':_0x2c21de},'order':[['id',_0xc1f8('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index b748f20..1c4727a 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 _0x74c8=['name','consequence','length','map','join','stop','find','agents','createQueue','atimeout','channel','START:%s','end','close','rules','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','stack','validate','util','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format'];(function(_0x33aaa1,_0x32b81e){var _0x4ee9b9=function(_0x57f8f6){while(--_0x57f8f6){_0x33aaa1['push'](_0x33aaa1['shift']());}};_0x4ee9b9(++_0x32b81e);}(_0x74c8,0x18a));var _0x874c=function(_0x58c0c5,_0xaa9eb){_0x58c0c5=_0x58c0c5-0x0;var _0x41edf4=_0x74c8[_0x58c0c5];return _0x41edf4;};'use strict';var schema=require(_0x874c('0x0'));var _=require('lodash');var util=require(_0x874c('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x874c('0x2'))(_0x874c('0x3'));var strategy=require(_0x874c('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x874c('0x5')},'timeout':{'type':'number','message':_0x874c('0x6')}});function writeLog(_0x44887d,_0x5506a6,_0x4221f9){return logger[_0x874c('0x7')](util[_0x874c('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x44887d,_0x5506a6[_0x874c('0x9')],_0x4221f9));}function handleFindAgent(_0x12104a){return function(_0x4e896f){return _0x4e896f[_0x874c('0x9')]['toLowerCase']()===_0x12104a['toLowerCase']();};}exports[_0x874c('0xa')]=function(_0xb9ac6e,_0x4eeddb,_0x1a2b7a,_0x515221){return function(_0x16022d){try{var _0x2133fb={'name':_0x4eeddb[0x0],'timeout':_0x4eeddb[0x1]};var _0x171fee=queue['validate'](_0x2133fb,{'typecast':!![]});if(_0x171fee[_0x874c('0xb')]){logger['error']('[%s][AGENT]\x20%s',_0xb9ac6e,_[_0x874c('0xc')](_0x171fee,'message')[_0x874c('0xd')](',\x20'));_0x16022d[_0x874c('0xe')]();}else{var _0x47873e=_[_0x874c('0xf')](_0x1a2b7a[_0x874c('0x10')],handleFindAgent(_0x2133fb['name']));if(_0x47873e){var _0x555970=(_0x2133fb['timeout']||0xa)*0x3e8;var _0x5be51d,_0x2ca8dc;var _0x716f76=seqqueue[_0x874c('0x11')](_0x555970);_0x716f76['id']=_0xb9ac6e;_0x716f76[_0x874c('0x12')]=_0x555970;_0x716f76[_0x874c('0x13')]=_0x515221[_0x874c('0x13')];writeLog(_0xb9ac6e,_0x47873e,util[_0x874c('0x8')](_0x874c('0x14'),_0x555970));_0x1a2b7a['rules'][_0xb9ac6e]['on'](_0x874c('0x15'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0xb9ac6e);clearTimeout(_0x2ca8dc);_0x2ca8dc=undefined;_0x716f76[_0x874c('0x16')]();if(_0x1a2b7a['rules'][_0xb9ac6e]){delete _0x1a2b7a['rules'][_0xb9ac6e];}_0x16022d[_0x874c('0xe')]();});_0x1a2b7a[_0x874c('0x17')][_0xb9ac6e]['on']('complete',function(){if(_0x1a2b7a[_0x874c('0x17')][_0xb9ac6e]){delete _0x1a2b7a[_0x874c('0x17')][_0xb9ac6e];}});_0x2ca8dc=setTimeout(function(){logger[_0x874c('0x7')](_0x874c('0x18'),_0xb9ac6e);clearTimeout(_0x2ca8dc);_0x716f76[_0x874c('0x16')]();_0x16022d[_0x874c('0x19')]();},_0x555970);strategy['agent'](_0x716f76,_0x47873e,_0x1a2b7a,_0x515221);}else{logger['error'](_0x874c('0x1a'),_0xb9ac6e,_0x2133fb[_0x874c('0x9')]);_0x16022d['stop']();}}}catch(_0x56593c){console[_0x874c('0x1b')](_0x56593c);logger[_0x874c('0x1c')](_0x874c('0x1d'),_0xb9ac6e,_0x56593c[_0x874c('0x1e')]);_0x16022d[_0x874c('0xe')]();}};}; \ No newline at end of file +var _0x166e=['[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','createQueue','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log'];(function(_0x75e489,_0x36108f){var _0x4f0398=function(_0x44c449){while(--_0x44c449){_0x75e489['push'](_0x75e489['shift']());}};_0x4f0398(++_0x36108f);}(_0x166e,0x174));var _0xe166=function(_0x3693f6,_0x5af811){_0x3693f6=_0x3693f6-0x0;var _0x4458ad=_0x166e[_0x3693f6];return _0x4458ad;};'use strict';var schema=require(_0xe166('0x0'));var _=require(_0xe166('0x1'));var util=require(_0xe166('0x2'));var seqqueue=require(_0xe166('0x3'));var logger=require('../../../../config/logger')(_0xe166('0x4'));var strategy=require(_0xe166('0x5'));var queue=schema({'name':{'type':_0xe166('0x6'),'required':!![],'message':_0xe166('0x7')},'timeout':{'type':'number','message':_0xe166('0x8')}});function writeLog(_0x399719,_0x4770d7,_0x13bc0d){return logger[_0xe166('0x9')](util['format'](_0xe166('0xa'),_0x399719,_0x4770d7[_0xe166('0xb')],_0x13bc0d));}function handleFindAgent(_0x576471){return function(_0xad8e07){return _0xad8e07['name'][_0xe166('0xc')]()===_0x576471['toLowerCase']();};}exports[_0xe166('0xd')]=function(_0xb693be,_0x26c62d,_0x2301fa,_0x590155){return function(_0x2e313a){try{var _0x3303d4={'name':_0x26c62d[0x0],'timeout':_0x26c62d[0x1]};var _0x2fe5d8=queue[_0xe166('0x0')](_0x3303d4,{'typecast':!![]});if(_0x2fe5d8[_0xe166('0xe')]){logger[_0xe166('0xf')](_0xe166('0x10'),_0xb693be,_['map'](_0x2fe5d8,_0xe166('0x11'))[_0xe166('0x12')](',\x20'));_0x2e313a[_0xe166('0x13')]();}else{var _0x675fd1=_[_0xe166('0x14')](_0x2301fa[_0xe166('0x15')],handleFindAgent(_0x3303d4[_0xe166('0xb')]));if(_0x675fd1){var _0x46e92d=(_0x3303d4['timeout']||0xa)*0x3e8;var _0x5fbc5b,_0x57caac;var _0x1f9efc=seqqueue[_0xe166('0x16')](_0x46e92d);_0x1f9efc['id']=_0xb693be;_0x1f9efc['atimeout']=_0x46e92d;_0x1f9efc['channel']=_0x590155[_0xe166('0x17')];writeLog(_0xb693be,_0x675fd1,util[_0xe166('0x18')](_0xe166('0x19'),_0x46e92d));_0x2301fa[_0xe166('0x1a')][_0xb693be]['on'](_0xe166('0x1b'),function(){logger['info'](_0xe166('0x1c'),_0xb693be);clearTimeout(_0x57caac);_0x57caac=undefined;_0x1f9efc[_0xe166('0x1d')]();if(_0x2301fa['rules'][_0xb693be]){delete _0x2301fa['rules'][_0xb693be];}_0x2e313a[_0xe166('0x13')]();});_0x2301fa[_0xe166('0x1a')][_0xb693be]['on']('complete',function(){if(_0x2301fa[_0xe166('0x1a')][_0xb693be]){delete _0x2301fa[_0xe166('0x1a')][_0xb693be];}});_0x57caac=setTimeout(function(){logger[_0xe166('0x9')](_0xe166('0x1e'),_0xb693be);clearTimeout(_0x57caac);_0x1f9efc[_0xe166('0x1d')]();_0x2e313a[_0xe166('0x1f')]();},_0x46e92d);strategy[_0xe166('0x20')](_0x1f9efc,_0x675fd1,_0x2301fa,_0x590155);}else{logger[_0xe166('0xf')](_0xe166('0x21'),_0xb693be,_0x3303d4[_0xe166('0xb')]);_0x2e313a[_0xe166('0x13')]();}}}catch(_0x329741){console[_0xe166('0x22')](_0x329741);logger[_0xe166('0xf')](_0xe166('0x23'),_0xb693be,_0x329741[_0xe166('0x24')]);_0x2e313a[_0xe166('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index f3b36b1..49409df 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 _0xd97e=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','then','catch','error','[%s][AMAZONLEX]\x20%s','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','providerName','amazonlex','providerResponse','stringify','create','dialogState','moment','aws-sdk','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info'];(function(_0x694103,_0x4801){var _0x1866c5=function(_0x2298ad){while(--_0x2298ad){_0x694103['push'](_0x694103['shift']());}};_0x1866c5(++_0x4801);}(_0xd97e,0x7a));var _0xed97=function(_0x1ddbf5,_0xbd73e2){_0x1ddbf5=_0x1ddbf5-0x0;var _0x4198db=_0xd97e[_0x1ddbf5];return _0x4198db;};'use strict';var _=require('lodash');var moment=require(_0xed97('0x0'));var AWS=require(_0xed97('0x1'));var utils=require(_0xed97('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xed97('0x3')),'openchannelMessage':require(_0xed97('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xed97('0x5')),'faxMessage':require(_0xed97('0x6')),'whatsappMessage':require(_0xed97('0x7'))};exports[_0xed97('0x8')]=function(_0x2df52b,_0x1d03c4){return function(_0x410c69){try{if(!_[_0xed97('0x9')](this[_0xed97('0xa')][_0xed97('0xb')])){logger[_0xed97('0xc')]('[%s][AMAZONLEX]\x20%s',_0x2df52b,_0xed97('0xd'));return _0x410c69[_0xed97('0xe')]();}var _0x17efbe={'ContactId':this[_0xed97('0xf')]['id'],'sentAt':moment()['format'](_0xed97('0x10')),'direction':'out'};if(this[_0xed97('0x11')]===_0xed97('0x12')||this[_0xed97('0x11')]===_0xed97('0x13')){_0x17efbe['phone']=this['interaction'][_0xed97('0x14')];}var _0x52d2bc=this[_0xed97('0x11')];if(_0x52d2bc==='chat'){_0x17efbe[_0xed97('0x15')]=this['account']['id'];}else{_0x17efbe[_[_0xed97('0x16')](_0x52d2bc)+_0xed97('0x17')]=this['account']['id'];}_0x17efbe[_[_0xed97('0x16')](_0x52d2bc)+'InteractionId']=this[_0xed97('0xa')]['id'];if(this[_0xed97('0xa')][_0xed97('0x18')]){var _0x7b8451=_0x1d03c4[0x4];if(!_[_0xed97('0x19')](_0x7b8451)){_0x17efbe[_0xed97('0x1a')]=utils[_0xed97('0x1b')](_0x7b8451,this);return rpc[_0x52d2bc+_0xed97('0x1c')]['create'](_0x17efbe)[_0xed97('0x1d')](function(_0x3591fa){logger[_0xed97('0xc')]('[%s][AMAZONLEX]\x20%s',_0x2df52b,_0x17efbe[_0xed97('0x1a')]);})[_0xed97('0x1e')](function(_0x4a190b){logger[_0xed97('0x1f')](_0xed97('0x20'),_0x2df52b,JSON['stringify'](_0x4a190b));})['finally'](function(){logger[_0xed97('0xc')](_0xed97('0x21'),_0x2df52b);_0x410c69[_0xed97('0x22')]();});}else{logger[_0xed97('0xc')](_0xed97('0x23'),_0x2df52b);_0x410c69[_0xed97('0x22')]();}}else{var _0x2d21ec=this;var _0xdc88c2=new AWS[(_0xed97('0x24'))]({'accessKeyId':_0x1d03c4[0x0],'secretAccessKey':_0x1d03c4[0x1],'region':_0x1d03c4[0x2]});var _0x59780f={'botAlias':'$LATEST','botName':_0x1d03c4[0x3],'inputText':this[_0xed97('0x25')][_0xed97('0x1a')],'userId':this[_0xed97('0x11')]+':'+this[_0xed97('0xa')]['id'][_0xed97('0x26')]()};_0xdc88c2['postText'](_0x59780f,function(_0x77c329,_0x3b6715){if(_0x77c329){logger[_0xed97('0x1f')](_0xed97('0x20'),_0x2df52b,_0x77c329[_0xed97('0x25')]);_0x410c69['next']();}else if(_0x3b6715&&_0x3b6715[_0xed97('0x25')]){_0x2d21ec['body']['amazonlex']=_0x3b6715;_0x17efbe[_0xed97('0x1a')]=_0x3b6715[_0xed97('0x25')];_0x17efbe[_0xed97('0x27')]=_0xed97('0x28');_0x17efbe[_0xed97('0x29')]=JSON[_0xed97('0x2a')](_0x3b6715);return rpc[_0x52d2bc+'Message'][_0xed97('0x2b')](_0x17efbe)[_0xed97('0x1d')](function(_0x3f3ba5){logger[_0xed97('0xc')](_0xed97('0x20'),_0x2df52b,_0x17efbe[_0xed97('0x1a')]);if(_0x3b6715[_0xed97('0x2c')]=='Failed'){_0x410c69[_0xed97('0xe')]();}else{_0x410c69[_0xed97('0x22')]();}})[_0xed97('0x1e')](function(_0x93c6bb){logger['error'](_0xed97('0x20'),_0x2df52b,JSON[_0xed97('0x2a')](_0x93c6bb));_0x410c69[_0xed97('0xe')]();});}else{_0x410c69[_0xed97('0xe')]();}});}}catch(_0x30fb80){logger[_0xed97('0x1f')](_0xed97('0x20'),_0x2df52b,JSON[_0xed97('0x2a')](_0x30fb80));_0x410c69[_0xed97('0x22')]();}};}; \ No newline at end of file +var _0xdb84=['catch','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','body','getMustacheRender','create','then','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','$LATEST','message','amazonlex','providerName','providerResponse','dialogState','Failed'];(function(_0x5d1bd8,_0x1836cb){var _0xa3e236=function(_0x554391){while(--_0x554391){_0x5d1bd8['push'](_0x5d1bd8['shift']());}};_0xa3e236(++_0x1836cb);}(_0xdb84,0x158));var _0x4db8=function(_0x3328fa,_0x6e1c0d){_0x3328fa=_0x3328fa-0x0;var _0x239bfc=_0xdb84[_0x3328fa];return _0x239bfc;};'use strict';var _=require(_0x4db8('0x0'));var moment=require(_0x4db8('0x1'));var AWS=require(_0x4db8('0x2'));var utils=require('./utils');var logger=require(_0x4db8('0x3'))(_0x4db8('0x4'));var rpc={'chatMessage':require(_0x4db8('0x5')),'openchannelMessage':require(_0x4db8('0x6')),'mailMessage':require(_0x4db8('0x7')),'smsMessage':require(_0x4db8('0x8')),'faxMessage':require(_0x4db8('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4db8('0xa')]=function(_0x437e70,_0x55b169){return function(_0x44a51e){try{if(!_[_0x4db8('0xb')](this[_0x4db8('0xc')]['UserId'])){logger[_0x4db8('0xd')](_0x4db8('0xe'),_0x437e70,_0x4db8('0xf'));return _0x44a51e[_0x4db8('0x10')]();}var _0x1dba0f={'ContactId':this[_0x4db8('0x11')]['id'],'sentAt':moment()[_0x4db8('0x12')](_0x4db8('0x13')),'direction':_0x4db8('0x14')};if(this[_0x4db8('0x15')]===_0x4db8('0x16')||this[_0x4db8('0x15')]===_0x4db8('0x17')){_0x1dba0f[_0x4db8('0x18')]=this[_0x4db8('0xc')][_0x4db8('0x18')];}var _0x36acd6=this[_0x4db8('0x15')];if(_0x36acd6===_0x4db8('0x19')){_0x1dba0f[_0x4db8('0x1a')]=this[_0x4db8('0x1b')]['id'];}else{_0x1dba0f[_['upperFirst'](_0x36acd6)+_0x4db8('0x1c')]=this[_0x4db8('0x1b')]['id'];}_0x1dba0f[_[_0x4db8('0x1d')](_0x36acd6)+_0x4db8('0x1e')]=this[_0x4db8('0xc')]['id'];if(this['interaction'][_0x4db8('0x1f')]){var _0x7f0014=_0x55b169[0x4];if(!_['isEmpty'](_0x7f0014)){_0x1dba0f[_0x4db8('0x20')]=utils[_0x4db8('0x21')](_0x7f0014,this);return rpc[_0x36acd6+'Message'][_0x4db8('0x22')](_0x1dba0f)[_0x4db8('0x23')](function(_0x2896f4){logger[_0x4db8('0xd')]('[%s][AMAZONLEX]\x20%s',_0x437e70,_0x1dba0f['body']);})['catch'](function(_0x10052a){logger[_0x4db8('0x24')]('[%s][AMAZONLEX]\x20%s',_0x437e70,JSON[_0x4db8('0x25')](_0x10052a));})[_0x4db8('0x26')](function(){logger[_0x4db8('0xd')](_0x4db8('0x27'),_0x437e70);_0x44a51e['stop']();});}else{logger[_0x4db8('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x437e70);_0x44a51e[_0x4db8('0x28')]();}}else{var _0x2ab762=this;var _0x23399a=new AWS['LexRuntime']({'accessKeyId':_0x55b169[0x0],'secretAccessKey':_0x55b169[0x1],'region':_0x55b169[0x2]});var _0x2df0c5={'botAlias':_0x4db8('0x29'),'botName':_0x55b169[0x3],'inputText':this[_0x4db8('0x2a')][_0x4db8('0x20')],'userId':this[_0x4db8('0x15')]+':'+this['interaction']['id']['toString']()};_0x23399a['postText'](_0x2df0c5,function(_0x209eee,_0x50e5df){if(_0x209eee){logger[_0x4db8('0x24')](_0x4db8('0xe'),_0x437e70,_0x209eee['message']);_0x44a51e[_0x4db8('0x10')]();}else if(_0x50e5df&&_0x50e5df[_0x4db8('0x2a')]){_0x2ab762['body'][_0x4db8('0x2b')]=_0x50e5df;_0x1dba0f[_0x4db8('0x20')]=_0x50e5df[_0x4db8('0x2a')];_0x1dba0f[_0x4db8('0x2c')]=_0x4db8('0x2b');_0x1dba0f[_0x4db8('0x2d')]=JSON[_0x4db8('0x25')](_0x50e5df);return rpc[_0x36acd6+'Message']['create'](_0x1dba0f)[_0x4db8('0x23')](function(_0x4f5092){logger[_0x4db8('0xd')](_0x4db8('0xe'),_0x437e70,_0x1dba0f[_0x4db8('0x20')]);if(_0x50e5df[_0x4db8('0x2e')]==_0x4db8('0x2f')){_0x44a51e[_0x4db8('0x10')]();}else{_0x44a51e['stop']();}})[_0x4db8('0x30')](function(_0xc29af5){logger[_0x4db8('0x24')](_0x4db8('0xe'),_0x437e70,JSON[_0x4db8('0x25')](_0xc29af5));_0x44a51e[_0x4db8('0x10')]();});}else{_0x44a51e[_0x4db8('0x10')]();}});}}catch(_0x220297){logger['error'](_0x4db8('0xe'),_0x437e70,JSON['stringify'](_0x220297));_0x44a51e['stop']();}};}; \ 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 56e51ef..75c0254 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 _0xceed=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','contact','format','out','channel','mail','body','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','service','Smtp','host','port','secure','authentication','pass','inReplyTo','messageId','html','','replace','';_0x34a003[_0xdcee('0x32')]={'Auto-Submitted':_0xdcee('0x33'),'X-Auto-Response-Suppress':'All','Precedence':_0xdcee('0x34')};return mailRpc['sendMailMessage'](_0x355438,_0x34a003)[_0xdcee('0x35')](function(_0x169430){logger[_0xdcee('0x36')](_0xdcee('0x37'),_0xf64ccf);_0x34a003[_0xdcee('0x2c')]=_0x169430[_0xdcee('0x16')]['messageId'];return rpc[_0x5e1d70+_0xdcee('0x23')][_0xdcee('0x38')](_0x34a003);})[_0xdcee('0x35')](function(_0x282188){logger[_0xdcee('0x36')]('[%s][AUTOREPLY]\x20%s',_0xf64ccf,JSON[_0xdcee('0x39')](_0x282188));})[_0xdcee('0x3a')](function(_0x46856c){logger[_0xdcee('0x3b')](_0xdcee('0x3c'),_0xf64ccf,JSON[_0xdcee('0x39')](_0x46856c));})[_0xdcee('0x3d')](function(){_0x31898e[_0xdcee('0xf')]();});}else{return rpc[this['channel']+_0xdcee('0x23')][_0xdcee('0x38')](_0x34a003)[_0xdcee('0x35')](function(_0x43cd44){logger[_0xdcee('0x36')](_0xdcee('0xd'),_0xf64ccf,_0x34a003[_0xdcee('0x15')]);})[_0xdcee('0x3a')](function(_0x1316d9){logger['error']('[%s][AUTOREPLY]\x20%s',_0xf64ccf,JSON[_0xdcee('0x39')](_0x1316d9));})[_0xdcee('0x3d')](function(){_0x31898e['next']();});}}}catch(_0x2fbd3d){logger['error']('[%s][AUTOREPLY]\x20%s',_0xf64ccf,JSON[_0xdcee('0x39')](_0x2fbd3d));_0x31898e['stop']();}};}; \ No newline at end of file +var _0x18f3=['../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','InteractionId','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','','auto-replied','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','Message','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage'];(function(_0x5c6688,_0x7b129){var _0x2104a6=function(_0x381bbc){while(--_0x381bbc){_0x5c6688['push'](_0x5c6688['shift']());}};_0x2104a6(++_0x7b129);}(_0x18f3,0x19f));var _0x318f=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x18f3[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var moment=require(_0x318f('0x0'));var utils=require(_0x318f('0x1'));var logger=require(_0x318f('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x318f('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x318f('0x4')),'faxMessage':require(_0x318f('0x5')),'whatsappMessage':require(_0x318f('0x6'))};var mailRpc=require(_0x318f('0x7'));exports['consequence']=function(_0x5f7340,_0x3579e8){return function(_0x49188c){try{if(_0x3579e8[0x0]==='1'&&(_['isNil'](this[_0x318f('0x8')]['created'])||!this[_0x318f('0x8')][_0x318f('0x9')])){logger[_0x318f('0xa')](_0x318f('0xb'),_0x5f7340,_0x318f('0xc'));return _0x49188c[_0x318f('0xd')]();}var _0x48abee=this[_0x318f('0xe')];var _0x1e9916={'ContactId':this[_0x318f('0xf')]['id'],'sentAt':moment()[_0x318f('0x10')](_0x318f('0x11')),'direction':_0x318f('0x12')};if(this[_0x318f('0xe')]===_0x318f('0x13')){_0x1e9916['body']=utils['getMustacheRender'](_0x3579e8[0x2],this);}else{_0x1e9916[_0x318f('0x14')]=utils[_0x318f('0x15')](_0x3579e8[0x1],this);}if(this[_0x318f('0x16')]){_0x1e9916['to']=this[_0x318f('0x16')][_0x318f('0x17')]||'';if(this[_0x318f('0xe')]===_0x318f('0x13')&&_0x3579e8[0x1]==='1'){_0x1e9916['cc']=this['message']['cc']||'';}_0x1e9916[_0x318f('0x17')]=this['message']['to']||'';_0x1e9916['phone']=this[_0x318f('0x16')][_0x318f('0x18')]||'';_0x1e9916['read']=!![];if(this['message'][_0x318f('0x19')]){_0x1e9916['subject']='';_0x1e9916[_0x318f('0x19')]+=_[_0x318f('0x1a')](this[_0x318f('0x16')][_0x318f('0x19')],_0x318f('0x1b'))?'':'Re:\x20';_0x1e9916[_0x318f('0x19')]+=this[_0x318f('0x16')][_0x318f('0x19')];}}if(this[_0x318f('0xe')]===_0x318f('0x1c')){_0x1e9916[_0x318f('0x1d')]=this[_0x318f('0x1e')]['id'];}else{_0x1e9916[_[_0x318f('0x1f')](this[_0x318f('0xe')])+'AccountId']=this['account']['id'];}_0x1e9916[_[_0x318f('0x1f')](this[_0x318f('0xe')])+_0x318f('0x20')]=this['interaction']['id'];if(rpc[this[_0x318f('0xe')]+'Message']){if(this[_0x318f('0xe')]==='mail'){var _0x47087a={'tls':{'rejectUnauthorized':![]}};if(this[_0x318f('0x1e')][_0x318f('0x21')][_0x318f('0x22')]){_0x47087a[_0x318f('0x22')]=this[_0x318f('0x1e')][_0x318f('0x21')][_0x318f('0x22')];}else{_0x47087a[_0x318f('0x23')]=this[_0x318f('0x1e')][_0x318f('0x21')][_0x318f('0x23')];_0x47087a[_0x318f('0x24')]=this[_0x318f('0x1e')][_0x318f('0x21')][_0x318f('0x24')];_0x47087a[_0x318f('0x25')]=this[_0x318f('0x1e')][_0x318f('0x21')][_0x318f('0x25')];}if(this[_0x318f('0x1e')][_0x318f('0x21')]['authentication']){_0x47087a[_0x318f('0x26')]={'user':this['account'][_0x318f('0x21')][_0x318f('0x27')],'pass':this[_0x318f('0x1e')][_0x318f('0x21')][_0x318f('0x28')]};}_0x1e9916[_0x318f('0x29')]=this[_0x318f('0x16')][_0x318f('0x2a')];_0x1e9916[_0x318f('0x2b')]=_0x318f('0x2c')+_[_0x318f('0x2d')](_0x1e9916[_0x318f('0x14')],_0x318f('0x2e'),']+(>|$)/g,''),'priorityTrue':_0x2f0cf7[0x1],'priorityFalse':_0x2f0cf7[0x2]};var _0x48367b=gotoif[_0xb49d('0x0')](_0x3a5ebf,{'typecast':!![]});if(_0x48367b['length']){logger[_0xb49d('0xa')]('[%s][GOTOIF]\x20%s',_0x327364,_['map'](_0x48367b,_0xb49d('0xb'))[_0xb49d('0xc')](',\x20'));_0x55b33b[_0xb49d('0xd')]();}else{try{var _0x16d1ef=eval('('+_0x3a5ebf[_0xb49d('0xe')]+')');var _0x53b91d=_0x16d1ef?_0x3a5ebf['priorityTrue']:_0x3a5ebf[_0xb49d('0xf')];logger[_0xb49d('0x10')](_0xb49d('0x11'),_0x327364,_0x3a5ebf[_0xb49d('0xe')],_0x16d1ef,_0x53b91d||_0xb49d('0x12'));if(_0x53b91d){var _0x41e16d=_[_0xb49d('0x13')](_0x55b33b['rules'](),{'p':_0x53b91d});if(_0x41e16d>=0x0){logger[_0xb49d('0x10')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x327364,_0x53b91d||_0xb49d('0x12'),_0x41e16d);_0x55b33b[_0xb49d('0x12')](_0x41e16d);}else{logger['info'](_0xb49d('0x14'),_0x327364,_0x53b91d||_0xb49d('0x12'));_0x55b33b[_0xb49d('0xd')]();}}else{_0x55b33b['next']();}}catch(_0x1b3460){logger['error'](_0xb49d('0x15'),_0x327364,_0x1b3460[_0xb49d('0xb')]);_0x55b33b[_0xb49d('0xd')]();}}}catch(_0x5b5571){logger[_0xb49d('0xa')](_0xb49d('0x16'),_0x327364,JSON[_0xb49d('0x17')](_0x5b5571));_0x55b33b[_0xb49d('0xd')]();}};}; \ No newline at end of file +var _0x516c=['string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','message','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20%s','stringify','validate','./utils','../../../../config/logger','routing'];(function(_0x580aa4,_0x2d1c9d){var _0x6cceb1=function(_0x46e42e){while(--_0x46e42e){_0x580aa4['push'](_0x580aa4['shift']());}};_0x6cceb1(++_0x2d1c9d);}(_0x516c,0x10f));var _0xc516=function(_0x239a4f,_0x16427f){_0x239a4f=_0x239a4f-0x0;var _0x59f4f2=_0x516c[_0x239a4f];return _0x59f4f2;};'use strict';var schema=require(_0xc516('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0xc516('0x1'));var logger=require(_0xc516('0x2'))(_0xc516('0x3'));var gotoif=schema({'condition':{'type':_0xc516('0x4'),'required':!![],'message':_0xc516('0x5')},'priorityTrue':{'type':_0xc516('0x6'),'message':_0xc516('0x7')},'priorityFalse':{'type':_0xc516('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xc516('0x8')]=function(_0x4fcbf8,_0x2aa644){return function(_0x510203){try{var _0x298a95={'condition':htmlToText['fromString'](utils[_0xc516('0x9')](_0x2aa644[0x0],this),{'wordwrap':![]})[_0xc516('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2aa644[0x1],'priorityFalse':_0x2aa644[0x2]};var _0x44b47c=gotoif[_0xc516('0x0')](_0x298a95,{'typecast':!![]});if(_0x44b47c[_0xc516('0xb')]){logger[_0xc516('0xc')]('[%s][GOTOIF]\x20%s',_0x4fcbf8,_['map'](_0x44b47c,_0xc516('0xd'))['join'](',\x20'));_0x510203[_0xc516('0xe')]();}else{try{var _0x1a7084=eval('('+_0x298a95[_0xc516('0xf')]+')');var _0x5692ee=_0x1a7084?_0x298a95['priorityTrue']:_0x298a95[_0xc516('0x10')];logger[_0xc516('0x11')](_0xc516('0x12'),_0x4fcbf8,_0x298a95[_0xc516('0xf')],_0x1a7084,_0x5692ee||_0xc516('0x13'));if(_0x5692ee){var _0x13ae2d=_[_0xc516('0x14')](_0x510203['rules'](),{'p':_0x5692ee});if(_0x13ae2d>=0x0){logger[_0xc516('0x11')](_0xc516('0x15'),_0x4fcbf8,_0x5692ee||_0xc516('0x13'),_0x13ae2d);_0x510203[_0xc516('0x13')](_0x13ae2d);}else{logger[_0xc516('0x11')](_0xc516('0x16'),_0x4fcbf8,_0x5692ee||_0xc516('0x13'));_0x510203[_0xc516('0xe')]();}}else{_0x510203[_0xc516('0x13')]();}}catch(_0x6f8a88){logger[_0xc516('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x4fcbf8,_0x6f8a88[_0xc516('0xd')]);_0x510203[_0xc516('0xe')]();}}}catch(_0x29d273){logger[_0xc516('0xc')](_0xc516('0x17'),_0x4fcbf8,JSON[_0xc516('0x18')](_0x29d273));_0x510203[_0xc516('0xe')]();}};}; \ 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 b194370..b946642 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 _0xbdfc=['error','[%s][GOTOP]\x20%s','map','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0x2ed3df,_0x3fde6d){var _0x4f12ba=function(_0x56b410){while(--_0x56b410){_0x2ed3df['push'](_0x2ed3df['shift']());}};_0x4f12ba(++_0x3fde6d);}(_0xbdfc,0x125));var _0xcbdf=function(_0x5bb09b,_0x2053ec){_0x5bb09b=_0x5bb09b-0x0;var _0x51f565=_0xbdfc[_0x5bb09b];return _0x51f565;};'use strict';var schema=require(_0xcbdf('0x0'));var _=require(_0xcbdf('0x1'));var logger=require(_0xcbdf('0x2'))(_0xcbdf('0x3'));var gotop=schema({'priority':{'type':_0xcbdf('0x4'),'required':!![],'message':_0xcbdf('0x5')}});exports[_0xcbdf('0x6')]=function(_0x3c8a27,_0x24c2ba){return function(_0x5ac487){try{var _0x4e4b3a={'priority':_0x24c2ba[0x0]};var _0x27f413=gotop[_0xcbdf('0x0')](_0x4e4b3a,{'typecast':!![]});if(_0x27f413['length']){logger[_0xcbdf('0x7')](_0xcbdf('0x8'),_0x3c8a27,_[_0xcbdf('0x9')](_0x27f413,'message')['join'](',\x20'));_0x5ac487[_0xcbdf('0xa')]();}else{logger['info'](_0xcbdf('0xb'),_0x3c8a27,_0x4e4b3a[_0xcbdf('0xc')]);if(_0x4e4b3a[_0xcbdf('0xc')]){var _0x394a60=_[_0xcbdf('0xd')](_0x5ac487[_0xcbdf('0xe')](),{'p':_0x4e4b3a[_0xcbdf('0xc')]});if(_0x394a60>=0x0){logger['info'](_0xcbdf('0xf'),_0x3c8a27,_0x4e4b3a[_0xcbdf('0xc')]||_0xcbdf('0x10'),_0x394a60);_0x5ac487[_0xcbdf('0x10')](_0x394a60);}else{logger[_0xcbdf('0x11')](_0xcbdf('0x12'),_0x3c8a27,_0x4e4b3a[_0xcbdf('0xc')]||_0xcbdf('0x10'));_0x5ac487[_0xcbdf('0xa')]();}}else{_0x5ac487[_0xcbdf('0x10')]();}}}catch(_0x294714){logger[_0xcbdf('0x7')](_0xcbdf('0x8'),_0x3c8a27,JSON[_0xcbdf('0x13')](_0x294714));_0x5ac487['stop']();}};}; \ No newline at end of file +var _0x5908=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','stringify','lodash','../../../../config/logger','routing','validate','length','error','[%s][GOTOP]\x20%s','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules'];(function(_0x46fc6c,_0x297637){var _0x18694f=function(_0x34e1e0){while(--_0x34e1e0){_0x46fc6c['push'](_0x46fc6c['shift']());}};_0x18694f(++_0x297637);}(_0x5908,0x16c));var _0x8590=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x5908[_0x6cf19c];return _0xce14f3;};'use strict';var schema=require('validate');var _=require(_0x8590('0x0'));var logger=require(_0x8590('0x1'))(_0x8590('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x3518b9,_0x52a2ec){return function(_0x3c67e2){try{var _0x2f889b={'priority':_0x52a2ec[0x0]};var _0x5d1716=gotop[_0x8590('0x3')](_0x2f889b,{'typecast':!![]});if(_0x5d1716[_0x8590('0x4')]){logger[_0x8590('0x5')](_0x8590('0x6'),_0x3518b9,_['map'](_0x5d1716,_0x8590('0x7'))[_0x8590('0x8')](',\x20'));_0x3c67e2[_0x8590('0x9')]();}else{logger['info'](_0x8590('0xa'),_0x3518b9,_0x2f889b[_0x8590('0xb')]);if(_0x2f889b[_0x8590('0xb')]){var _0xa6b0b2=_[_0x8590('0xc')](_0x3c67e2[_0x8590('0xd')](),{'p':_0x2f889b[_0x8590('0xb')]});if(_0xa6b0b2>=0x0){logger['info'](_0x8590('0xe'),_0x3518b9,_0x2f889b[_0x8590('0xb')]||'next',_0xa6b0b2);_0x3c67e2['next'](_0xa6b0b2);}else{logger['info'](_0x8590('0xf'),_0x3518b9,_0x2f889b[_0x8590('0xb')]||'next');_0x3c67e2[_0x8590('0x9')]();}}else{_0x3c67e2[_0x8590('0x10')]();}}}catch(_0x160f3f){logger[_0x8590('0x5')](_0x8590('0x6'),_0x3518b9,JSON[_0x8590('0x11')](_0x160f3f));_0x3c67e2[_0x8590('0x9')]();}};}; \ 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 0534b58..1ef1281 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 _0x6dab=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','contact','channel','chat','ChatWebsiteId','upperFirst','InteractionId','Message','create','then','info','body','next','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x6dab,0xbe));var _0xb6da=function(_0x47fb54,_0x28698c){_0x47fb54=_0x47fb54-0x0;var _0x1139a7=_0x6dab[_0x47fb54];return _0x1139a7;};'use strict';var _=require(_0xb6da('0x0'));var utils=require(_0xb6da('0x1'));var logger=require(_0xb6da('0x2'))(_0xb6da('0x3'));var rpc={'chatMessage':require(_0xb6da('0x4')),'openchannelMessage':require(_0xb6da('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb6da('0x6')),'whatsappMessage':require(_0xb6da('0x7'))};exports['consequence']=function(_0x4b3a22,_0x2a1998){return function(_0x40126f){try{var _0x155601={'body':utils['getMustacheRender'](_0x2a1998[0x0],this),'ContactId':this[_0xb6da('0x8')]['id']};if(this[_0xb6da('0x9')]===_0xb6da('0xa')){_0x155601[_0xb6da('0xb')]=this['account']['id'];}else{_0x155601[_['upperFirst'](this['channel'])+'AccountId']=this['account']['id'];}_0x155601[_[_0xb6da('0xc')](this[_0xb6da('0x9')])+_0xb6da('0xd')]=this['interaction']['id'];if(rpc[this['channel']+_0xb6da('0xe')]){return rpc[this[_0xb6da('0x9')]+_0xb6da('0xe')][_0xb6da('0xf')](_0x155601)[_0xb6da('0x10')](function(_0x2035a5){logger[_0xb6da('0x11')]('[%s][MESSAGE]\x20%s',_0x4b3a22,_0x155601[_0xb6da('0x12')]);_0x40126f[_0xb6da('0x13')]();})['catch'](function(_0x1c66c4){logger[_0xb6da('0x14')](_0xb6da('0x15'),_0x4b3a22,JSON[_0xb6da('0x16')](_0x1c66c4));_0x40126f[_0xb6da('0x17')]();});}}catch(_0x2b477a){logger['error'](_0xb6da('0x15'),_0x4b3a22,JSON[_0xb6da('0x16')](_0x2b477a));_0x40126f[_0xb6da('0x17')]();}};}; \ No newline at end of file +var _0x441a=['Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','stop','error','stringify','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','getMustacheRender','contact','channel','ChatWebsiteId','upperFirst','AccountId','account'];(function(_0x88faed,_0x5b4a9f){var _0x242df2=function(_0x19e40c){while(--_0x19e40c){_0x88faed['push'](_0x88faed['shift']());}};_0x242df2(++_0x5b4a9f);}(_0x441a,0x191));var _0xa441=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x441a[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0xa441('0x0'));var utils=require(_0xa441('0x1'));var logger=require(_0xa441('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa441('0x3')),'mailMessage':require(_0xa441('0x4')),'smsMessage':require(_0xa441('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x814359,_0x19b7dc){return function(_0x1b6b64){try{var _0x1a39e3={'body':utils[_0xa441('0x6')](_0x19b7dc[0x0],this),'ContactId':this[_0xa441('0x7')]['id']};if(this[_0xa441('0x8')]==='chat'){_0x1a39e3[_0xa441('0x9')]=this['account']['id'];}else{_0x1a39e3[_[_0xa441('0xa')](this[_0xa441('0x8')])+_0xa441('0xb')]=this[_0xa441('0xc')]['id'];}_0x1a39e3[_[_0xa441('0xa')](this[_0xa441('0x8')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0xa441('0x8')]+_0xa441('0xd')]){return rpc[this[_0xa441('0x8')]+_0xa441('0xd')][_0xa441('0xe')](_0x1a39e3)[_0xa441('0xf')](function(_0x3aaa34){logger['info'](_0xa441('0x10'),_0x814359,_0x1a39e3[_0xa441('0x11')]);_0x1b6b64[_0xa441('0x12')]();})[_0xa441('0x13')](function(_0x3fdfc9){logger['error']('[%s][MESSAGE]\x20%s',_0x814359,JSON['stringify'](_0x3fdfc9));_0x1b6b64[_0xa441('0x14')]();});}}catch(_0xeb428a){logger[_0xa441('0x15')](_0xa441('0x10'),_0x814359,JSON[_0xa441('0x16')](_0xeb428a));_0x1b6b64['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index e4a7235..90880c1 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 _0x4b46=['stringify','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x403cff,_0x1cf463){var _0x5a7c56=function(_0x1bab9d){while(--_0x1bab9d){_0x403cff['push'](_0x403cff['shift']());}};_0x5a7c56(++_0x1cf463);}(_0x4b46,0xe7));var _0x64b4=function(_0x17c30e,_0x113c2f){_0x17c30e=_0x17c30e-0x0;var _0x1a280b=_0x4b46[_0x17c30e];return _0x1a280b;};'use strict';var utils=require(_0x64b4('0x0'));var logger=require(_0x64b4('0x1'))(_0x64b4('0x2'));exports[_0x64b4('0x3')]=function(_0x5a566c,_0x1ecfd8){return function(_0x1a88a2){try{logger[_0x64b4('0x4')](_0x64b4('0x5'),_0x5a566c,utils[_0x64b4('0x6')](_0x1ecfd8[0x0],this));_0x1a88a2[_0x64b4('0x7')]();}catch(_0x486e3d){logger[_0x64b4('0x8')](_0x64b4('0x5'),_0x5a566c,JSON[_0x64b4('0x9')](_0x486e3d));_0x1a88a2['stop']();}};}; \ No newline at end of file +var _0x0b00=['routing','consequence','[%s][NOOP]\x20%s','error','stop','./utils'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x0b00,0x18b));var _0x00b0=function(_0x53c6e7,_0x505625){_0x53c6e7=_0x53c6e7-0x0;var _0x202c6b=_0x0b00[_0x53c6e7];return _0x202c6b;};'use strict';var utils=require(_0x00b0('0x0'));var logger=require('../../../../config/logger')(_0x00b0('0x1'));exports[_0x00b0('0x2')]=function(_0x555be7,_0x329f34){return function(_0x49f162){try{logger['info'](_0x00b0('0x3'),_0x555be7,utils['getMustacheRender'](_0x329f34[0x0],this));_0x49f162['next']();}catch(_0x3e3aae){logger[_0x00b0('0x4')]('[%s][NOOP]\x20%s',_0x555be7,JSON['stringify'](_0x3e3aae));_0x49f162[_0x00b0('0x5')]();}};}; \ 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 510a35e..136ee21 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 _0x7217=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','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','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0x5dd823,_0x2d7c25){var _0x448a0f=function(_0x29523d){while(--_0x29523d){_0x5dd823['push'](_0x5dd823['shift']());}};_0x448a0f(++_0x2d7c25);}(_0x7217,0x19e));var _0x7721=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x7217[_0x38a7ac];return _0x53061a;};'use strict';var schema=require(_0x7721('0x0'));var _=require('lodash');var util=require(_0x7721('0x1'));var seqqueue=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7721('0x6'));config[_0x7721('0x7')]=_[_0x7721('0x8')](config[_0x7721('0x7')],{'host':_0x7721('0x9'),'port':0x18eb});var io=require(_0x7721('0xa'))(new Redis(config[_0x7721('0x7')]));var attributes=['id',_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf')];function emit(_0xfa8835,_0x138740,_0x2c3986){io['to'](_0xfa8835)['emit'](_0x138740,_0x2c3986);}function emitChannelQueueInteraction(_0x461d1a,_0x29bc8f,_0x8729a6,_0xf78099,_0xa8977c,_0x409b37,_0x1e7fd7,_0x27b36b){var _0x55b4ca=_[_0x7721('0x10')](_0x8729a6);_0x55b4ca[_0x7721('0xb')]=_0x27b36b;_0x55b4ca['queue']=_0x29bc8f;_0x55b4ca[_0x7721('0xc')]=_0xf78099;_0x55b4ca['id']=_0xa8977c;if(_0x409b37){_0x1e7fd7[util[_0x7721('0x11')](_0x7721('0x12'),_0x461d1a)][_0xa8977c]=_[_0x7721('0x13')](_0x55b4ca,attributes);}else{delete _0x1e7fd7[util['format'](_0x7721('0x12'),_0x461d1a)][_0xa8977c];}emit(util[_0x7721('0x11')]('%s:queue:%s',_0x461d1a,_0x29bc8f),util['format']('%s_queue_waiting_interaction:%s',_0x461d1a,_0x409b37?_0x7721('0x14'):_0x7721('0x15')),_[_0x7721('0x13')](_0x55b4ca,attributes));}var rpc={'openchannelQueueReport':require(_0x7721('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7721('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7721('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7721('0x19'),'required':!![],'message':_0x7721('0x1a')},'timeout':{'type':_0x7721('0x1b'),'message':_0x7721('0x1c')}});function startRouting(_0x2286e5,_0x40af90,_0x402820,_0x413263){if(_0x2286e5&&_0x40af90&&_0x402820){_0x40af90[_0x7721('0x1d')]+=0x1;var _0xaeccc4={'uniqueid':_0x2286e5,'from':_0x402820['body']?_0x402820[_0x7721('0x1e')][_0x7721('0xe')]:'','joinAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'ContactId':_0x402820['contact']?_0x402820[_0x7721('0x20')]['id']:null,'ListId':_0x402820['list']?_0x402820[_0x7721('0x21')]['id']:null};_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x24')]=_0x40af90['id']||null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x25')]=_0x402820['interaction']?_0x402820[_0x7721('0x26')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x27')]=_0x402820[_0x7721('0x28')]?_0x402820[_0x7721('0x28')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+(_0x402820[_0x7721('0x23')]!=='chat'?_0x7721('0x29'):'WebsiteId')]=_0x402820['account']?_0x402820[_0x7721('0xc')]['id']:null;logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x2b'),_0x2286e5,_0x40af90[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x402820[_0x7721('0x23')],_0x40af90[_0x7721('0x2c')],_0xaeccc4,_0x402820[_0x7721('0xc')]['name'],_0x402820[_0x7721('0x28')]['id'],!![],_0x413263,_0x40af90['id']);if(rpc[_0x402820[_0x7721('0x23')]+'QueueReport']){return rpc[_0x402820['channel']+_0x7721('0x2d')][_0x7721('0x2e')](_0xaeccc4)['catch'](function(_0x46f772){logger[_0x7721('0x2f')](_0x7721('0x30'));});}}}function stopRouting(_0x58d54b,_0x3d9a32,_0x1ff31b,_0x1492d4){if(_0x58d54b&&_0x3d9a32){_0x3d9a32[_0x7721('0x1d')]-=0x1;var _0xc0f3c4={'leaveAt':moment()['format'](_0x7721('0x1f')),'acceptAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'reason':'accepted'};logger[_0x7721('0x2a')](util[_0x7721('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x58d54b,_0x3d9a32[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x1ff31b['channel'],_0x3d9a32[_0x7721('0x2c')],_0x1ff31b[_0x7721('0x1e')],_0x1ff31b[_0x7721('0xc')][_0x7721('0x2c')],_0x1ff31b[_0x7721('0x28')]['id'],![],_0x1492d4,_0x3d9a32['id']);if(rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')]){return rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')][_0x7721('0x31')](_0x58d54b,_0xc0f3c4)[_0x7721('0x32')](function(_0x5c806d){logger[_0x7721('0x2f')]('update\x20queue\x20report');});}}}function endRouting(_0x212384,_0x35614c,_0x7942f7,_0x1d03de){if(_0x212384&&_0x35614c){_0x35614c[_0x7721('0x1d')]-=0x1;var _0x378ba5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7721('0x33')};logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x34'),_0x212384,_0x35614c['name']));emitChannelQueueInteraction(_0x7942f7[_0x7721('0x23')],_0x35614c['name'],_0x7942f7[_0x7721('0x1e')],_0x7942f7[_0x7721('0xc')]['name'],_0x7942f7[_0x7721('0x28')]['id'],![],_0x1d03de);if(rpc[_0x7942f7[_0x7721('0x23')]+'QueueReport']){return rpc[_0x7942f7['channel']+_0x7721('0x2d')][_0x7721('0x31')](_0x212384,_0x378ba5)[_0x7721('0x32')](function(_0x15e34d){logger['error'](_0x7721('0x35'));});}}}function handleFindQueue(_0x120de9){return function(_0x40ce8c){return _0x40ce8c[_0x7721('0x2c')][_0x7721('0x36')]()===_0x120de9['toLowerCase']();};}exports[_0x7721('0x37')]=function(_0x4a2c28,_0xaa3216,_0x4a5b59,_0x2333b8){return function(_0x15fa2c){try{var _0x231dad={'name':_0xaa3216[0x0],'timeout':_0xaa3216[0x1]};var _0x49e0c5=queue[_0x7721('0x0')](_0x231dad,{'typecast':!![]});if(_0x49e0c5[_0x7721('0x38')]){logger[_0x7721('0x2f')]('[%s][QUEUE]\x20%s',_0x4a2c28,_[_0x7721('0x39')](_0x49e0c5,_0x7721('0x28'))[_0x7721('0x3a')](',\x20'));_0x15fa2c[_0x7721('0x3b')]();}else{var _0x135dbc=_[_0x7721('0x3c')](_0x4a5b59[_0x2333b8[_0x7721('0x23')]+'Queues'],handleFindQueue(_0x231dad['name']));if(_0x135dbc){startRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);var _0x1ac3af=(_0x135dbc[_0x7721('0x33')]||0xa)*0x3e8;var _0x421aae=(_0x231dad[_0x7721('0x33')]||0x14)*0x3e8;var _0x335145,_0x15181b;if(_0x1ac3af>_0x421aae){_0x421aae=_0x1ac3af;}var _0x1d2ea5=seqqueue[_0x7721('0x3d')](_0x1ac3af);_0x1d2ea5['id']=_0x4a2c28;_0x1d2ea5[_0x7721('0x3e')]=_0x1ac3af;_0x1d2ea5[_0x7721('0x3f')]=_0x421aae;_0x1d2ea5['channel']=_0x2333b8['channel'];_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on'](_0x7721('0x41'),function(){logger[_0x7721('0x2a')](_0x7721('0x42'),_0x4a2c28);stopRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x335145=undefined;_0x1d2ea5['close'](!![]);if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59[_0x7721('0x40')][_0x4a2c28];}_0x15fa2c['stop']();});_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on']('complete',function(){if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59['rules'][_0x4a2c28];}});_0x335145=setTimeout(function(){logger[_0x7721('0x2a')](_0x7721('0x43'),_0x4a2c28);endRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x1d2ea5[_0x7721('0x44')](!![]);_0x15fa2c['next']();},_0x421aae);switch(_0x135dbc[_0x7721('0x45')]){case _0x7721('0x46'):strategy['rrmemory'](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);break;default:strategy[_0x7721('0x47')](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);}}else{logger[_0x7721('0x2f')](_0x7721('0x48'),_0x4a2c28,_0x231dad['name']);_0x15fa2c[_0x7721('0x3b')]();}}}catch(_0x5a32b6){console[_0x7721('0x49')](_0x5a32b6);logger[_0x7721('0x2f')](_0x7721('0x4a'),_0x4a2c28,_0x5a32b6[_0x7721('0x4b')]);_0x15fa2c[_0x7721('0x3b')]();}};}; \ 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(_0x53bc10,_0x55f2c5){var _0x5666dc=function(_0x2b07cb){while(--_0x2b07cb){_0x53bc10['push'](_0x53bc10['shift']());}};_0x5666dc(++_0x55f2c5);}(_0x34e8,0x12c));var _0x834e=function(_0x1c7f7e,_0x31200e){_0x1c7f7e=_0x1c7f7e-0x0;var _0x3ea29b=_0x34e8[_0x1c7f7e];return _0x3ea29b;};'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 7139d4c..938ca57 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 _0x14f6=[':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','info','agent','isNil','realtime','agents','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership'];(function(_0x57e8b2,_0x594a83){var _0x210f2c=function(_0x1f520d){while(--_0x1f520d){_0x57e8b2['push'](_0x57e8b2['shift']());}};_0x210f2c(++_0x594a83);}(_0x14f6,0x170));var _0x614f=function(_0x2aea25,_0x563565){_0x2aea25=_0x2aea25-0x0;var _0x2f5167=_0x14f6[_0x2aea25];return _0x2f5167;};'use strict';var _=require(_0x614f('0x0'));var uuid=require(_0x614f('0x1'));var util=require(_0x614f('0x2'));var logger=require(_0x614f('0x3'))(_0x614f('0x4'));var Agent=function(_0x234222,_0x5463dc,_0x4fca86,_0x46d608){this[_0x614f('0x5')]=uuid['v4']();this[_0x614f('0x6')]=_0x234222;this['agent']=_0x5463dc;this['realtime']=_0x4fca86;this[_0x614f('0x4')]=_0x46d608;this[_0x614f('0x6')]['push'](this[_0x614f('0x7')][_0x614f('0x8')](this),this[_0x614f('0x9')][_0x614f('0x8')](this));this[_0x614f('0x6')]['on'](_0x614f('0xa'),this[_0x614f('0x9')]['bind'](this));this['squeue']['on'](_0x614f('0xb'),this[_0x614f('0xc')][_0x614f('0x8')](this));};Agent[_0x614f('0xd')]['push']=function(){this['squeue'][_0x614f('0xe')](this[_0x614f('0x7')][_0x614f('0x8')](this),this['handleTimeout'][_0x614f('0x8')](this));};Agent[_0x614f('0xd')][_0x614f('0xc')]=function(){this[_0x614f('0x9')](!![]);};Agent['prototype'][_0x614f('0x7')]=function(_0x3cb101){logger[_0x614f('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x614f('0x6')]['id'],this[_0x614f('0x10')]['id']);if(_[_0x614f('0x11')](this[_0x614f('0x12')][_0x614f('0x13')][this[_0x614f('0x10')]['id']])){logger[_0x614f('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x614f('0x6')]['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0x614f('0x4')]['forcedOwnership']||util[_0x614f('0x14')](this[_0x614f('0x6')]['id'],this['realtime'][_0x614f('0x13')][this[_0x614f('0x10')]['id']],this[_0x614f('0x6')][_0x614f('0x15')],![])){this['realtime'][_0x614f('0x13')][this[_0x614f('0x10')]['id']][_0x614f('0x16')]=!![];this[_0x614f('0x12')][_0x614f('0x13')][this['agent']['id']][_0x614f('0x17')]=undefined;util[_0x614f('0x18')](this[_0x614f('0x5')],this[_0x614f('0x6')]['id'],this[_0x614f('0x12')][_0x614f('0x13')][this[_0x614f('0x10')]['id']],null,this[_0x614f('0x4')]);util[_0x614f('0x19')](this['squeue']['id'],this[_0x614f('0x12')][_0x614f('0x13')][this[_0x614f('0x10')]['id']],_0x614f('0x1a')+(this['routing'][_0x614f('0x1b')]?_0x614f('0x1c'):''));}else{logger[_0x614f('0xf')](_0x614f('0x1d'),this[_0x614f('0x6')]['id'],this[_0x614f('0x10')]['id']);setTimeout(this[_0x614f('0xe')][_0x614f('0x8')](this),0x3e8);}}};Agent[_0x614f('0xd')][_0x614f('0x9')]=function(_0x2298c0){if(_[_0x614f('0x11')](this[_0x614f('0x12')]['agents'][this[_0x614f('0x10')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x614f('0x6')]['id'],this[_0x614f('0x10')]['id']);}else{logger[_0x614f('0xf')](_0x614f('0x1e'),this[_0x614f('0x6')]['id'],this[_0x614f('0x10')]['id']);util[_0x614f('0x1f')](this[_0x614f('0x5')],this[_0x614f('0x6')]['id'],this[_0x614f('0x12')]['agents'][this[_0x614f('0x10')]['id']],null,this['routing']);this[_0x614f('0x12')]['agents'][this[_0x614f('0x10')]['id']][_0x614f('0x16')]=![];this['realtime']['agents'][this[_0x614f('0x10')]['id']][_0x614f('0x17')]=undefined;util['writeLog'](this[_0x614f('0x6')]['id'],this[_0x614f('0x12')][_0x614f('0x13')][this['agent']['id']],_0x2298c0?'STOP':_0x614f('0x20'));}if(!_0x2298c0){setTimeout(this[_0x614f('0xe')][_0x614f('0x8')](this),0x3e8);}};function agent(_0x36e0b6,_0x414f94,_0x3d0e81,_0xb2275a){return new Agent(_0x36e0b6,_0x414f94,_0x3d0e81,_0xb2275a);}module['exports']=agent; \ No newline at end of file +var _0x2227=['routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','lodash','uuid','./util'];(function(_0x5d73eb,_0x417b0c){var _0x529461=function(_0x2efbeb){while(--_0x2efbeb){_0x5d73eb['push'](_0x5d73eb['shift']());}};_0x529461(++_0x417b0c);}(_0x2227,0x147));var _0x7222=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x2227[_0x568496];return _0x26c5c1;};'use strict';var _=require(_0x7222('0x0'));var uuid=require(_0x7222('0x1'));var util=require(_0x7222('0x2'));var logger=require('../../../../../config/logger')(_0x7222('0x3'));var Agent=function(_0x2cd609,_0x2f93ad,_0x219473,_0x3c6457){this[_0x7222('0x4')]=uuid['v4']();this[_0x7222('0x5')]=_0x2cd609;this['agent']=_0x2f93ad;this[_0x7222('0x6')]=_0x219473;this['routing']=_0x3c6457;this['squeue'][_0x7222('0x7')](this[_0x7222('0x8')][_0x7222('0x9')](this),this[_0x7222('0xa')]['bind'](this));this[_0x7222('0x5')]['on'](_0x7222('0xb'),this[_0x7222('0xa')][_0x7222('0x9')](this));this[_0x7222('0x5')]['on'](_0x7222('0xc'),this[_0x7222('0xd')][_0x7222('0x9')](this));};Agent[_0x7222('0xe')][_0x7222('0x7')]=function(){this[_0x7222('0x5')]['push'](this[_0x7222('0x8')][_0x7222('0x9')](this),this[_0x7222('0xa')][_0x7222('0x9')](this));};Agent[_0x7222('0xe')][_0x7222('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0x7222('0xe')]['handleRun']=function(_0x241957){logger[_0x7222('0xf')](_0x7222('0x10'),this[_0x7222('0x5')]['id'],this[_0x7222('0x11')]['id']);if(_[_0x7222('0x12')](this[_0x7222('0x6')][_0x7222('0x13')][this[_0x7222('0x11')]['id']])){logger[_0x7222('0xf')](_0x7222('0x14'),this[_0x7222('0x5')]['id'],this[_0x7222('0x11')]['id']);setTimeout(this['push'][_0x7222('0x9')](this),0x3e8);}else{if(this[_0x7222('0x3')]['forcedOwnership']||util['isAgentAvailable'](this['squeue']['id'],this['realtime'][_0x7222('0x13')][this[_0x7222('0x11')]['id']],this['squeue'][_0x7222('0x15')],![])){this[_0x7222('0x6')][_0x7222('0x13')][this[_0x7222('0x11')]['id']][_0x7222('0x16')]=!![];this[_0x7222('0x6')][_0x7222('0x13')][this[_0x7222('0x11')]['id']][_0x7222('0x17')]=undefined;util[_0x7222('0x18')](this[_0x7222('0x4')],this[_0x7222('0x5')]['id'],this[_0x7222('0x6')][_0x7222('0x13')][this[_0x7222('0x11')]['id']],null,this[_0x7222('0x3')]);util[_0x7222('0x19')](this[_0x7222('0x5')]['id'],this[_0x7222('0x6')][_0x7222('0x13')][this[_0x7222('0x11')]['id']],_0x7222('0x1a')+(this[_0x7222('0x3')][_0x7222('0x1b')]?':FORCED':''));}else{logger[_0x7222('0xf')](_0x7222('0x1c'),this[_0x7222('0x5')]['id'],this[_0x7222('0x11')]['id']);setTimeout(this[_0x7222('0x7')][_0x7222('0x9')](this),0x3e8);}}};Agent['prototype'][_0x7222('0xa')]=function(_0x282170){if(_[_0x7222('0x12')](this[_0x7222('0x6')][_0x7222('0x13')][this['agent']['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x7222('0x11')]['id']);}else{logger['info'](_0x7222('0x1d'),this['squeue']['id'],this[_0x7222('0x11')]['id']);util[_0x7222('0x1e')](this[_0x7222('0x4')],this[_0x7222('0x5')]['id'],this['realtime'][_0x7222('0x13')][this[_0x7222('0x11')]['id']],null,this[_0x7222('0x3')]);this['realtime']['agents'][this[_0x7222('0x11')]['id']][_0x7222('0x16')]=![];this[_0x7222('0x6')][_0x7222('0x13')][this[_0x7222('0x11')]['id']][_0x7222('0x17')]=undefined;util[_0x7222('0x19')](this[_0x7222('0x5')]['id'],this['realtime'][_0x7222('0x13')][this['agent']['id']],_0x282170?'STOP':_0x7222('0x1f'));}if(!_0x282170){setTimeout(this[_0x7222('0x7')][_0x7222('0x9')](this),0x3e8);}};function agent(_0x247491,_0x5cf76f,_0x9b3855,_0x13cb86){return new Agent(_0x247491,_0x5cf76f,_0x9b3855,_0x13cb86);}module[_0x7222('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 6d9c7c8..3edfd49 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 _0x59a6=['agents','channel','RINGING','busyQueue','name','showNotification','length','info','writeLog','STOP','TIMEOUT','busy','exports','lodash','uuid','./util','routing','notificationId','squeue','queue','handleRun','bind','handleTimeout','timeout','drained','prototype','push','handleDrained','Agents','isNil','realtime','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0x59a6,0x10d));var _0x659a=function(_0x3b369,_0x517dbe){_0x3b369=_0x3b369-0x0;var _0xbe9f0f=_0x59a6[_0x3b369];return _0xbe9f0f;};'use strict';var _=require(_0x659a('0x0'));var uuid=require(_0x659a('0x1'));var util=require(_0x659a('0x2'));var logger=require('../../../../../config/logger')(_0x659a('0x3'));var Beepall=function(_0x16b84f,_0x42117f,_0x128928,_0x159e2d){this[_0x659a('0x4')]=uuid['v4']();this[_0x659a('0x5')]=_0x16b84f;this[_0x659a('0x6')]=_0x42117f;this['realtime']=_0x128928;this[_0x659a('0x3')]=_0x159e2d;this[_0x659a('0x5')]['push'](this[_0x659a('0x7')][_0x659a('0x8')](this),this[_0x659a('0x9')][_0x659a('0x8')](this));this[_0x659a('0x5')]['on'](_0x659a('0xa'),this['handleTimeout'][_0x659a('0x8')](this));this['squeue']['on'](_0x659a('0xb'),this['handleDrained'][_0x659a('0x8')](this));};Beepall[_0x659a('0xc')]['push']=function(){this[_0x659a('0x5')][_0x659a('0xd')](this[_0x659a('0x7')][_0x659a('0x8')](this),this[_0x659a('0x9')][_0x659a('0x8')](this));};Beepall['prototype'][_0x659a('0xe')]=function(_0x9810fd){this[_0x659a('0x9')](!![]);};Beepall[_0x659a('0xc')]['handleRun']=function(_0xbbc2b){var _0x35d5da=!![];if(!_['isNil'](this['queue'])&&!_['isNil'](this[_0x659a('0x6')]['Agents'])&&this[_0x659a('0x6')]['Agents']['length']>0x0){for(var _0x5cb33d=0x0,_0x2b490b;_0x5cb33d0x0){for(var _0xee5ae5=0x0,_0x108400;_0xee5ae50x0&&_0x83e5fd[_0xed6962+_0xd2d4('0x27')]>=_0x83e5fd[_0xed6962+'Capacity']){writeLog(_0x6ecb06,_0x83e5fd,_0xed6962[_0xd2d4('0x28')]()+_0xd2d4('0x29'));return![];}}return!![];};exports[_0xd2d4('0x2a')]=function(_0x578591,_0x292d16,_0x3aeffe,_0x105c5e,_0x588bd6){return sendNotification(!![],_0x578591,_0x292d16,_0x3aeffe,_0x105c5e,_0x588bd6);};exports[_0xd2d4('0x2b')]=function(_0x12b4da,_0x23f520,_0x567389,_0x5afe97,_0x4bc51e){return sendNotification(![],_0x12b4da,_0x23f520,_0x567389,_0x5afe97,_0x4bc51e);};exports[_0xd2d4('0x2c')]=writeLog; \ No newline at end of file +var _0x95b9=['msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','remove','info','isAgentAvailable','busy','BUSY','online','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','showNotification','hideNotification','writeLog','lodash','util','mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','name','user:save','account','notificationSound','notificationShake','body','queue'];(function(_0x3998a6,_0x50be8f){var _0x2d3068=function(_0x4220a5){while(--_0x4220a5){_0x3998a6['push'](_0x3998a6['shift']());}};_0x2d3068(++_0x50be8f);}(_0x95b9,0x10c));var _0x995b=function(_0x20605c,_0x2063cb){_0x20605c=_0x20605c-0x0;var _0xd060f9=_0x95b9[_0x20605c];return _0xd060f9;};'use strict';var _=require(_0x995b('0x0'));var util=require(_0x995b('0x1'));var utils=require('../utils');var Mustache=require(_0x995b('0x2'));var Redis=require('ioredis');var config=require(_0x995b('0x3'));var logger=require(_0x995b('0x4'))(_0x995b('0x5'));config[_0x995b('0x6')]=_[_0x995b('0x7')](config['redis'],{'host':_0x995b('0x8'),'port':0x18eb});var io=require(_0x995b('0x9'))(new Redis(config[_0x995b('0x6')]));function emit(_0x288eab,_0x3bdc1a,_0x416c0c){io['to'](_0x288eab)[_0x995b('0xa')](_0x3bdc1a,_0x416c0c);}function sendNotification(_0x409d1d,_0x422895,_0x140822,_0x6893b0,_0x2a38eb,_0xd5f3df){io['to'](util[_0x995b('0xb')]('user:%s',_0x6893b0[_0x995b('0xc')]))[_0x995b('0xa')](_0x995b('0xd'),_0x6893b0);var _0xd82621=_0xd5f3df||{};var _0x1b0500=_0x140822['split']('.');var _0x23ba85={'uniqueid':_0x422895,'channel':_0x1b0500[0x0],'id':_0x1b0500[0x1],'title':_0x1b0500[0x0]+'\x20interaction','interactionId':_0x1b0500[0x2],'queue':_0x2a38eb?_0x2a38eb[_0x995b('0xc')]:null,'sound':_0xd82621[_0x995b('0xe')][_0x995b('0xf')],'shake':_0xd82621[_0x995b('0xe')][_0x995b('0x10')]};try{if(!_0xd82621[_0x995b('0x11')]){_0xd82621[_0x995b('0x11')]={};}if(_0x2a38eb){_0xd82621[_0x995b('0x11')][_0x995b('0x12')]=_0x2a38eb;}else if(_0xd82621[_0x995b('0x11')]['queue']){delete _0xd82621[_0x995b('0x11')]['queue'];}_0x23ba85[_0x995b('0x13')]=utils[_0x995b('0x14')](_0xd82621['account']['notificationTemplate'],_0xd82621);}catch(_0x364b9d){_0x23ba85['msg']=_0x995b('0x15');logger[_0x995b('0x16')](util[_0x995b('0xb')](_0x995b('0x17'),_0x422895,_0x364b9d[_0x995b('0x18')]));}io['to'](util['format'](_0x995b('0x19'),_0x6893b0[_0x995b('0xc')]))[_0x995b('0xa')](util['format'](_0x995b('0x1a'),_0x409d1d?'save':_0x995b('0x1b')),_0x23ba85);}function writeLog(_0x57dc9b,_0x630e3d,_0xf887fc){return logger[_0x995b('0x1c')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x57dc9b,_0x630e3d['name'],_0xf887fc));}exports[_0x995b('0x1d')]=function(_0x22918c,_0x385175,_0xc314e7,_0x539755){if(_0x385175[_0x995b('0x1e')]){writeLog(_0x22918c,_0x385175,_0x995b('0x1f'));return![];}if(!_0x385175[_0x995b('0x20')]){writeLog(_0x22918c,_0x385175,'OFFLINE');return![];}if(_0x385175[_0xc314e7+_0x995b('0x21')]){writeLog(_0x22918c,_0x385175,_0x995b('0x22'));return![];}if(_0x539755&&_0x385175['hasOwnProperty'](_0xc314e7+_0x995b('0x23'))&&_0x385175[_0x995b('0x24')](_0xc314e7+'CurrentCapacity')){if(_0x385175[_0xc314e7+'Capacity']>0x0&&_0x385175[_0xc314e7+_0x995b('0x25')]>=_0x385175[_0xc314e7+'Capacity']){writeLog(_0x22918c,_0x385175,_0xc314e7['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x995b('0x26')]=function(_0x168954,_0x445358,_0xb34845,_0x401640,_0x599f45){return sendNotification(!![],_0x168954,_0x445358,_0xb34845,_0x401640,_0x599f45);};exports[_0x995b('0x27')]=function(_0x3cac34,_0x151e05,_0x2d9c75,_0x3796a8,_0x36c984){return sendNotification(![],_0x3cac34,_0x151e05,_0x2d9c75,_0x3796a8,_0x36c984);};exports[_0x995b('0x28')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index c291809..8834e59 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 _0x3fe0=['length','error','[%s][SYSTEM]\x20%s','map','message','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate'];(function(_0x5d39ab,_0x29fa0d){var _0x3eb427=function(_0x4195af){while(--_0x4195af){_0x5d39ab['push'](_0x5d39ab['shift']());}};_0x3eb427(++_0x29fa0d);}(_0x3fe0,0x1d5));var _0x03fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fe0[_0x14add3];return _0x4a174f;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require('lodash');var utils=require(_0x03fe('0x0'));var logger=require('../../../../config/logger')(_0x03fe('0x1'));var system=schema({'command':{'type':_0x03fe('0x2'),'required':!![],'message':_0x03fe('0x3')}});exports[_0x03fe('0x4')]=function(_0x4cbe89,_0x2d3509){return function(_0x508c8e){try{var _0x38a6b9={'command':_0x2d3509[0x0]};var _0x22e3d7=system[_0x03fe('0x5')](_0x38a6b9,{'typecast':!![]});if(_0x22e3d7[_0x03fe('0x6')]){logger[_0x03fe('0x7')](_0x03fe('0x8'),_0x4cbe89,_[_0x03fe('0x9')](_0x22e3d7,_0x03fe('0xa'))['join'](',\x20'));logger['info'](_0x03fe('0xb'),_0x4cbe89);_0x508c8e['next']();}else{var _0x567441=this;var _0x5e6f79=utils[_0x03fe('0xc')](_0x2d3509[0x0],this);logger[_0x03fe('0xd')](_0x03fe('0xe'),_0x4cbe89,_0x5e6f79);sh[_0x03fe('0xf')](_[_0x03fe('0x10')](_0x5e6f79),function(_0x12fdcf,_0xef5c2c){logger[_0x03fe('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x4cbe89,_0x12fdcf);if(_0x12fdcf==0x0){var _0x37e8b9=_0xef5c2c['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x03fe('0x11')](_0x2d3509[0x1])||_[_0x03fe('0x12')](_0x2d3509[0x1])){logger[_0x03fe('0xd')](_0x03fe('0x13'),_0x4cbe89);_0x567441[_0x03fe('0x14')][_0x2d3509[0x1]]=_0x37e8b9;}else{logger[_0x03fe('0xd')](_0x03fe('0x15'),_0x4cbe89,_0x2d3509[0x1],_0x37e8b9);_0x567441[_0x03fe('0x14')][_0x2d3509[0x1]]=_0x37e8b9;}}_0x508c8e[_0x03fe('0x16')]();});}}catch(_0x5128ff){logger[_0x03fe('0x7')](_0x03fe('0x8'),_0x4cbe89,_[_0x03fe('0x17')](_0x5128ff)?JSON[_0x03fe('0x18')](_0x5128ff):_0x5128ff);logger[_0x03fe('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4cbe89);_0x508c8e[_0x03fe('0x16')]();}};}; \ No newline at end of file +var _0x0a7a=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','../../../../config/logger','routing','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject'];(function(_0x5c0ff3,_0x4ff210){var _0x38204d=function(_0x16c0ec){while(--_0x16c0ec){_0x5c0ff3['push'](_0x5c0ff3['shift']());}};_0x38204d(++_0x4ff210);}(_0x0a7a,0x121));var _0xa0a7=function(_0x1c6160,_0x2012d7){_0x1c6160=_0x1c6160-0x0;var _0x59c5bf=_0x0a7a[_0x1c6160];return _0x59c5bf;};'use strict';var schema=require(_0xa0a7('0x0'));var sh=require(_0xa0a7('0x1'));var _=require('lodash');var utils=require(_0xa0a7('0x2'));var logger=require(_0xa0a7('0x3'))(_0xa0a7('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x1f3370,_0x3b9f91){return function(_0xcec9e0){try{var _0x125d57={'command':_0x3b9f91[0x0]};var _0xf31729=system['validate'](_0x125d57,{'typecast':!![]});if(_0xf31729[_0xa0a7('0x5')]){logger[_0xa0a7('0x6')](_0xa0a7('0x7'),_0x1f3370,_[_0xa0a7('0x8')](_0xf31729,_0xa0a7('0x9'))[_0xa0a7('0xa')](',\x20'));logger[_0xa0a7('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1f3370);_0xcec9e0[_0xa0a7('0xc')]();}else{var _0x1355f2=this;var _0x3460b4=utils[_0xa0a7('0xd')](_0x3b9f91[0x0],this);logger[_0xa0a7('0xb')](_0xa0a7('0xe'),_0x1f3370,_0x3460b4);sh[_0xa0a7('0xf')](_[_0xa0a7('0x10')](_0x3460b4),function(_0x1c2fa2,_0x5679e9){logger[_0xa0a7('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x1f3370,_0x1c2fa2);if(_0x1c2fa2==0x0){var _0x145809=_0x5679e9['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xa0a7('0x11')](_0x3b9f91[0x1])||_[_0xa0a7('0x12')](_0x3b9f91[0x1])){logger[_0xa0a7('0xb')](_0xa0a7('0x13'),_0x1f3370);_0x1355f2[_0xa0a7('0x14')][_0x3b9f91[0x1]]=_0x145809;}else{logger[_0xa0a7('0xb')](_0xa0a7('0x15'),_0x1f3370,_0x3b9f91[0x1],_0x145809);_0x1355f2[_0xa0a7('0x14')][_0x3b9f91[0x1]]=_0x145809;}}_0xcec9e0['next']();});}}catch(_0x181297){logger[_0xa0a7('0x6')](_0xa0a7('0x7'),_0x1f3370,_[_0xa0a7('0x16')](_0x181297)?JSON['stringify'](_0x181297):_0x181297);logger[_0xa0a7('0xb')](_0xa0a7('0x17'),_0x1f3370);_0xcec9e0[_0xa0a7('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 2338aee..2701d41 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 _0x9708=['validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','isObject'];(function(_0x2f87e5,_0x2e46e9){var _0x21d179=function(_0x3eb2dc){while(--_0x3eb2dc){_0x2f87e5['push'](_0x2f87e5['shift']());}};_0x21d179(++_0x2e46e9);}(_0x9708,0x11e));var _0x8970=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0x9708[_0x2e6dbf];return _0x2680e5;};'use strict';var schema=require(_0x8970('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x8970('0x1')),'smsInteraction':require(_0x8970('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x8970('0x3')),'whatsappInteraction':require(_0x8970('0x4'))};var logger=require(_0x8970('0x5'))(_0x8970('0x6'));var tag=schema({'tag':{'type':_0x8970('0x7'),'required':!![],'message':_0x8970('0x8')}});exports[_0x8970('0x9')]=function(_0xc3fc72,_0x2e191c,_0x54e917,_0x8d33c3){return function(_0x63aaff){try{var _0x5aa675={'tag':_0x2e191c[0x0]};var _0x56e865=tag[_0x8970('0x0')](_0x5aa675,{'typecast':!![]});if(_0x56e865[_0x8970('0xa')]){logger[_0x8970('0xb')](_0x8970('0xc'),_0xc3fc72,_[_0x8970('0xd')](_0x56e865,_0x8970('0xe'))[_0x8970('0xf')](',\x20'));logger['info'](_0x8970('0x10'),_0xc3fc72);_0x63aaff[_0x8970('0x11')]();}else{var _0x51be99={'ids':[_0x2e191c[0x0]]};if(rpc[_0x8d33c3[_0x8970('0x12')]+'Interaction']){rpc[_0x8d33c3['channel']+'Interaction']['addTags'](_0x8d33c3[_0x8970('0x13')]['id'],_0x51be99)[_0x8970('0x14')](function(_0x4f1edc){logger[_0x8970('0x15')](_0x8970('0x16'),_0xc3fc72,_0x2e191c[0x1],_0x8d33c3[_0x8970('0x12')],_0x8d33c3['interaction']['id']);})[_0x8970('0x17')](function(_0xa4241c){logger['error'](_0x8970('0xc'),_0xc3fc72,JSON[_0x8970('0x18')](_0xa4241c));logger[_0x8970('0x15')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xc3fc72);})['finally'](function(){_0x63aaff[_0x8970('0x11')]();});}}}catch(_0x1175d5){logger[_0x8970('0xb')]('[%s][TAG]\x20%s',_0xc3fc72,_[_0x8970('0x19')](_0x1175d5)?JSON[_0x8970('0x18')](_0x1175d5):_0x1175d5);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xc3fc72);_0x63aaff[_0x8970('0x11')]();}};}; \ No newline at end of file +var _0x1d38=['catch','error','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','interaction'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0x1d38,0x18e));var _0x81d3=function(_0x38d90e,_0x300c68){_0x38d90e=_0x38d90e-0x0;var _0x3eae1c=_0x1d38[_0x38d90e];return _0x3eae1c;};'use strict';var schema=require(_0x81d3('0x0'));var _=require(_0x81d3('0x1'));var rpc={'chatInteraction':require(_0x81d3('0x2')),'openchannelInteraction':require(_0x81d3('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x81d3('0x4')),'faxInteraction':require(_0x81d3('0x5')),'whatsappInteraction':require(_0x81d3('0x6'))};var logger=require('../../../../config/logger')(_0x81d3('0x7'));var tag=schema({'tag':{'type':_0x81d3('0x8'),'required':!![],'message':_0x81d3('0x9')}});exports['consequence']=function(_0x316d6e,_0x471f8a,_0x39943c,_0x38b034){return function(_0x80aba0){try{var _0x478b60={'tag':_0x471f8a[0x0]};var _0x5b98d5=tag['validate'](_0x478b60,{'typecast':!![]});if(_0x5b98d5[_0x81d3('0xa')]){logger['error'](_0x81d3('0xb'),_0x316d6e,_[_0x81d3('0xc')](_0x5b98d5,_0x81d3('0xd'))[_0x81d3('0xe')](',\x20'));logger[_0x81d3('0xf')](_0x81d3('0x10'),_0x316d6e);_0x80aba0['next']();}else{var _0x52d9d9={'ids':[_0x471f8a[0x0]]};if(rpc[_0x38b034[_0x81d3('0x11')]+_0x81d3('0x12')]){rpc[_0x38b034[_0x81d3('0x11')]+_0x81d3('0x12')][_0x81d3('0x13')](_0x38b034['interaction']['id'],_0x52d9d9)[_0x81d3('0x14')](function(_0x1cee9f){logger[_0x81d3('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x316d6e,_0x471f8a[0x1],_0x38b034[_0x81d3('0x11')],_0x38b034[_0x81d3('0x15')]['id']);})[_0x81d3('0x16')](function(_0x27b1d1){logger[_0x81d3('0x17')]('[%s][TAG]\x20%s',_0x316d6e,JSON[_0x81d3('0x18')](_0x27b1d1));logger['info'](_0x81d3('0x10'),_0x316d6e);})[_0x81d3('0x19')](function(){_0x80aba0[_0x81d3('0x1a')]();});}}}catch(_0x3436ce){logger[_0x81d3('0x17')]('[%s][TAG]\x20%s',_0x316d6e,_[_0x81d3('0x1b')](_0x3436ce)?JSON[_0x81d3('0x18')](_0x3436ce):_0x3436ce);logger[_0x81d3('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x316d6e);_0x80aba0['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 09ab6b4..995764f 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 _0x6b61=['interaction','list','mustache','exports','render','merge','body','contact','message'];(function(_0x44ec41,_0x4ca51d){var _0x1183b6=function(_0x2c6804){while(--_0x2c6804){_0x44ec41['push'](_0x44ec41['shift']());}};_0x1183b6(++_0x4ca51d);}(_0x6b61,0x16a));var _0x16b6=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0x6b61[_0x37a9d7];return _0x1343d3;};'use strict';var Mustache=require(_0x16b6('0x0'));var _=require('lodash');module[_0x16b6('0x1')]={'getMustacheRender':function(_0x71a55,_0xbeab11){return Mustache[_0x16b6('0x2')](_0x71a55,_[_0x16b6('0x3')](_0xbeab11[_0x16b6('0x4')],{'contact':_0xbeab11[_0x16b6('0x5')],'message':_0xbeab11[_0x16b6('0x6')],'account':_0xbeab11['account'],'interaction':_0xbeab11[_0x16b6('0x7')],'list':_0xbeab11[_0x16b6('0x8')]}))||'';}}; \ No newline at end of file +var _0x769c=['merge','body','contact','message','interaction','list','mustache','exports'];(function(_0x435008,_0x48359c){var _0x1e7065=function(_0x4c4114){while(--_0x4c4114){_0x435008['push'](_0x435008['shift']());}};_0x1e7065(++_0x48359c);}(_0x769c,0x96));var _0xc769=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x769c[_0x46698a];return _0x356db0;};'use strict';var Mustache=require(_0xc769('0x0'));var _=require('lodash');module[_0xc769('0x1')]={'getMustacheRender':function(_0x463db3,_0x4ec370){return Mustache['render'](_0x463db3,_[_0xc769('0x2')](_0x4ec370[_0xc769('0x3')],{'contact':_0x4ec370[_0xc769('0x4')],'message':_0x4ec370[_0xc769('0x5')],'account':_0x4ec370['account'],'interaction':_0x4ec370[_0xc769('0x6')],'list':_0x4ec370[_0xc769('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 2dd9d74..b25dfd1 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 _0xac55=['available','loggedIn','name','mailQueues','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','existsSync','join','app','appdata','split','mail','push','slice','length','dialogflow','dialogflowv2','tag','TagId','%s:%s:%s','./interval','condition','consequence','priority','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','stack','agent','agents','busy','busyQueue','QueueReport','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues'];(function(_0x3c9487,_0x1316d5){var _0x1149c0=function(_0xda3e3f){while(--_0xda3e3f){_0x3c9487['push'](_0x3c9487['shift']());}};_0x1149c0(++_0x1316d5);}(_0xac55,0x1c8));var _0x5ac5=function(_0x39e2be,_0x4b7a04){_0x39e2be=_0x39e2be-0x0;var _0x4a2339=_0xac55[_0x39e2be];return _0x4a2339;};'use strict';var _=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var path=require(_0x5ac5('0x2'));var fs=require('fs');var jayson=require(_0x5ac5('0x3'));var BPromise=require('bluebird');var uuid=require(_0x5ac5('0x4'));var config=require(_0x5ac5('0x5'));var logger=require(_0x5ac5('0x6'))(_0x5ac5('0x7'));var rpc={'openchannelQueueReport':require(_0x5ac5('0x8')),'mailQueueReport':require(_0x5ac5('0x9')),'chatQueueReport':require(_0x5ac5('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x5ac5('0xb'))};var RuleEngine=require(_0x5ac5('0xc'));function getId(_0x2bee03,_0x42551a,_0x455a94){return util[_0x5ac5('0xd')](_0x5ac5('0xe'),_0x2bee03,_0x42551a||0x0,_0x455a94||0x0);}function getIntervals(_0x5b84a3,_0x5ea6f4){var _0x2414f9=[];if(!_[_0x5ac5('0xf')](_0x5ea6f4['IntervalId'])&&!_[_0x5ac5('0xf')](_0x5b84a3[_0x5ea6f4[_0x5ac5('0x10')]])&&!_['isNil'](_0x5b84a3[_0x5ea6f4[_0x5ac5('0x10')]][_0x5ac5('0x11')])){_0x2414f9=_['map'](_0x5b84a3[_0x5ea6f4[_0x5ac5('0x10')]][_0x5ac5('0x11')],_0x5ac5('0x12'));}else if(!_[_0x5ac5('0xf')](_0x5ea6f4[_0x5ac5('0x12')])){_0x2414f9=[_0x5ea6f4['interval']];}return _0x2414f9;}exports[_0x5ac5('0x13')]=function(_0x56db18){_0x56db18[_0x5ac5('0x14')]={};return new BPromise(function(_0x40ee8a,_0x58e6f7){var _0x1633d1={'Start':function(_0x57377b){var _0x2a145d=this;return new Promise(function(_0x340195,_0x30244d){if(_0x57377b){try{var _0x1282be=[];var _0x34a95e=getId(_0x57377b[_0x5ac5('0x15')],_0x57377b[_0x5ac5('0x16')]?_0x57377b['message']['id']:0x0,_0x57377b[_0x5ac5('0x17')]?_0x57377b['interaction']['id']:0x0);if(_0x57377b[_0x5ac5('0x18')]&&_[_0x5ac5('0x19')](_0x57377b['applications'])&&_0x57377b[_0x5ac5('0x18')]['length']){for(var _0x264422=0x0;_0x264422<_0x57377b['applications']['length'];_0x264422+=0x1){var _0x439288=_0x57377b['applications'][_0x264422];if(fs[_0x5ac5('0x1a')](path[_0x5ac5('0x1b')](__dirname,'applications',_0x439288[_0x5ac5('0x1c')]+'.js'))){var _0x29a44c=[];switch(_0x439288[_0x5ac5('0x1c')]['toLowerCase']()){case'autoreply':var _0x1bd881=_0x439288[_0x5ac5('0x1d')][_0x5ac5('0x1e')](',');if(_0x57377b[_0x5ac5('0x15')]===_0x5ac5('0x1f')){_0x29a44c['push'](_0x1bd881[0x0]);_0x29a44c[_0x5ac5('0x20')](_0x1bd881[0x1]);_0x29a44c[_0x5ac5('0x20')](_0x1bd881[_0x5ac5('0x21')](0x2,_0x1bd881[_0x5ac5('0x22')])['join'](','));}else{_0x29a44c[_0x5ac5('0x20')](_0x1bd881[0x0]);_0x29a44c['push'](_0x1bd881[_0x5ac5('0x21')](0x1,_0x1bd881[_0x5ac5('0x22')])[_0x5ac5('0x1b')](','));}break;case _0x5ac5('0x23'):var _0x3ab796=_0x439288[_0x5ac5('0x1d')]['split'](',');_0x29a44c[_0x5ac5('0x20')](_0x3ab796[0x0]);_0x29a44c['push'](_0x3ab796[0x1]);_0x29a44c[_0x5ac5('0x20')](_0x3ab796[_0x5ac5('0x21')](0x2,_0x3ab796[_0x5ac5('0x22')])['join'](','));break;case _0x5ac5('0x24'):var _0x229941=_0x439288[_0x5ac5('0x1d')][_0x5ac5('0x1e')](',');_0x29a44c['push'](_0x229941[0x0]);_0x29a44c[_0x5ac5('0x20')](_0x229941[0x1]);_0x29a44c['push'](_0x229941[0x2]);_0x29a44c[_0x5ac5('0x20')](_0x229941[0x3]);_0x29a44c[_0x5ac5('0x20')](_0x229941[_0x5ac5('0x21')](0x4,_0x229941[_0x5ac5('0x22')])[_0x5ac5('0x1b')](','));break;case'amazonlex':var _0x4c381e=_0x439288[_0x5ac5('0x1d')][_0x5ac5('0x1e')](',');_0x29a44c['push'](_0x4c381e[0x0]);_0x29a44c[_0x5ac5('0x20')](_0x4c381e[0x1]);_0x29a44c['push'](_0x4c381e[0x2]);_0x29a44c[_0x5ac5('0x20')](_0x4c381e[0x3]);_0x29a44c[_0x5ac5('0x20')](_0x4c381e[_0x5ac5('0x21')](0x4,_0x4c381e[_0x5ac5('0x22')])[_0x5ac5('0x1b')](','));break;case'message':_0x29a44c[_0x5ac5('0x20')](_0x439288['appdata']);break;case _0x5ac5('0x25'):_0x29a44c['push'](_0x439288[_0x5ac5('0x26')]);_0x29a44c[_0x5ac5('0x20')](_0x439288['appdata']);break;default:_0x29a44c=_[_0x5ac5('0xf')](_0x439288[_0x5ac5('0x1d')])?[]:_0x439288['appdata']['split'](',');}var _0x1391c5={'id':util[_0x5ac5('0xd')](_0x5ac5('0x27'),_0x34a95e,_0x439288['id'],_0x439288[_0x5ac5('0x1c')]),'condition':require(_0x5ac5('0x28'))[_0x5ac5('0x29')](_0x34a95e,getIntervals(_0x56db18['intervals'],_0x439288),_0x56db18),'consequence':require('./applications/'+_0x439288['app'])[_0x5ac5('0x2a')](_0x34a95e,_0x29a44c,_0x56db18,_0x57377b),'p':_0x439288[_0x5ac5('0x2b')]||0x0};logger['info'](_0x5ac5('0x2c'),_0x1391c5['id'],_0x5ac5('0x2d'),getIntervals(_0x56db18[_0x5ac5('0x2e')],_0x439288)[_0x5ac5('0x1b')](_0x5ac5('0x2f')));_0x1282be[_0x5ac5('0x20')](_0x1391c5);}else{logger[_0x5ac5('0x30')](_0x5ac5('0x31'),path[_0x5ac5('0x1b')](__dirname,'applications',_0x439288[_0x5ac5('0x1c')]+'.js'));}}_0x56db18[_0x5ac5('0x14')][_0x34a95e]=new RuleEngine(_0x1282be);_0x56db18[_0x5ac5('0x14')][_0x34a95e][_0x5ac5('0x32')](_0x57377b,function(_0x3dbb7e){logger[_0x5ac5('0x33')](_0x5ac5('0x34'),JSON[_0x5ac5('0x35')](_0x3dbb7e[_0x5ac5('0x36')]));if(_0x56db18[_0x5ac5('0x14')][_0x34a95e]){_0x56db18['rules'][_0x34a95e][_0x5ac5('0x37')](_0x5ac5('0x38'));}});return _0x340195({'code':0xc8,'message':_0x57377b});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x340195({'code':0xc8,'message':_0x57377b});}}catch(_0x3f9054){logger['error'](_0x3f9054[_0x5ac5('0x39')]);return _0x30244d(_0x2a145d[_0x5ac5('0x30')](0x1f4,_0x3f9054));}}return _0x30244d('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4d84dc){var _0x1e261d=this;return new Promise(function(_0x2097c5,_0x32cc92){if(_0x4d84dc[_0x5ac5('0x3a')]&&_0x4d84dc[_0x5ac5('0x3a')]['id']){if(_0x56db18[_0x5ac5('0x3b')][_0x4d84dc[_0x5ac5('0x3a')]['id']]){_0x56db18['agents'][_0x4d84dc[_0x5ac5('0x3a')]['id']][_0x5ac5('0x3c')]=![];_0x56db18[_0x5ac5('0x3b')][_0x4d84dc[_0x5ac5('0x3a')]['id']][_0x5ac5('0x3d')]=undefined;}}if(_0x4d84dc[_0x5ac5('0x16')]&&_0x4d84dc['message']['id']){try{var _0x6db684=getId(_0x4d84dc[_0x5ac5('0x15')],_0x4d84dc[_0x5ac5('0x16')]?_0x4d84dc[_0x5ac5('0x16')]['id']:0x0,_0x4d84dc['interaction']?_0x4d84dc[_0x5ac5('0x17')]['id']:0x0);if(_0x56db18[_0x5ac5('0x14')][_0x6db684]){_0x56db18[_0x5ac5('0x14')][_0x6db684]['emit']('end');if(rpc[_0x4d84dc[_0x5ac5('0x15')]+_0x5ac5('0x3e')]){rpc[_0x4d84dc[_0x5ac5('0x15')]+_0x5ac5('0x3e')]['update'](_0x6db684,{'UserId':_0x4d84dc[_0x5ac5('0x16')]['UserId']})[_0x5ac5('0x3f')](function(_0x3dfeba){logger['error'](_0x5ac5('0x40'));});}}return _0x2097c5({'code':0xc8,'message':_0x4d84dc});}catch(_0x5f328f){logger[_0x5ac5('0x30')](_0x5f328f[_0x5ac5('0x39')]);return _0x32cc92(_0x1e261d[_0x5ac5('0x30')](0x1f4,_0x5f328f));}}logger['error']('message\x20is\x20empty');return _0x32cc92(_0x1e261d[_0x5ac5('0x30')](0x1f4,_0x5ac5('0x41')));});},'RejectMessage':function(_0xd6ae55){var _0x27357b=this;return new Promise(function(_0xbe6f34,_0x3534ce){if(_0xd6ae55[_0x5ac5('0x3a')]&&_0xd6ae55[_0x5ac5('0x3a')]['id']){try{if(_0x56db18[_0x5ac5('0x3b')][_0xd6ae55['agent']['id']]){_0x56db18[_0x5ac5('0x3b')][_0xd6ae55[_0x5ac5('0x3a')]['id']][_0x5ac5('0x3c')]=![];_0x56db18['agents'][_0xd6ae55['agent']['id']][_0x5ac5('0x3d')]=undefined;}return _0xbe6f34({'code':0xc8,'message':_0xd6ae55});}catch(_0x8168fc){logger[_0x5ac5('0x30')](_0x8168fc['stack']);return _0x3534ce(_0x27357b[_0x5ac5('0x30')](0x1f4,_0x8168fc));}}logger[_0x5ac5('0x30')](_0x5ac5('0x41'));return _0x3534ce(_0x27357b[_0x5ac5('0x30')](0x1f4,_0x5ac5('0x41')));});},'AbandonInteraction':function(_0x327952){var _0x443ce1=this;return new Promise(function(_0x523b11,_0x5ac4e3){if(_0x327952['channel']&&_0x327952[_0x5ac5('0x17')]&&_0x327952[_0x5ac5('0x17')]['id']){try{var _0xc76fbd=getId(_0x327952['channel'],_0x327952[_0x5ac5('0x16')]?_0x327952[_0x5ac5('0x16')]['id']:0x0,_0x327952[_0x5ac5('0x17')]?_0x327952[_0x5ac5('0x17')]['id']:0x0);if(_0x56db18[_0x5ac5('0x14')][_0xc76fbd]){_0x56db18['rules'][_0xc76fbd]['emit']('end');}return _0x523b11({'code':0xc8,'message':_0x327952});}catch(_0x21d99f){logger[_0x5ac5('0x30')](_0x21d99f[_0x5ac5('0x39')]);return _0x5ac4e3(_0x443ce1[_0x5ac5('0x30')](0x1f4,_0x21d99f));}}logger[_0x5ac5('0x30')](_0x5ac5('0x41'));return _0x5ac4e3(_0x443ce1[_0x5ac5('0x30')](0x1f4,_0x5ac5('0x41')));});},'AgentCapacity':function(_0x441270){var _0x42f25a=this;return new Promise(function(_0x16bfcd,_0x13bf73){if(_0x56db18[_0x5ac5('0x3b')][_0x5ac5('0x42')](_0x441270['id'])){for(var _0x285e1d in _0x441270['capacity']){if(_0x441270[_0x5ac5('0x43')][_0x5ac5('0x42')](_0x285e1d)){if(_0x56db18['agents'][_0x441270['id']][_0x5ac5('0x42')](_0x285e1d+_0x5ac5('0x44'))){_0x56db18[_0x5ac5('0x3b')][_0x441270['id']][_0x285e1d+_0x5ac5('0x44')]=parseInt(_0x441270[_0x5ac5('0x43')][_0x285e1d],0xa);}}}_0x56db18[_0x5ac5('0x3b')][_0x441270['id']]['updateRealtime']();return _0x16bfcd({'code':0xc8,'message':_0x56db18[_0x5ac5('0x3b')][_0x441270['id']]});}else{return _0x13bf73(_0x42f25a[_0x5ac5('0x30')](0x1f4,_0x5ac5('0x45')));}});},'Agents':function(_0x4db247){return new Promise(function(_0x26b9d4,_0x44e349){var _0x4dd8be=_[_0x5ac5('0x46')](_0x56db18[_0x5ac5('0x3b')]);_0x26b9d4({'count':_0x4dd8be['length'],'rows':_0x4dd8be});});},'ChatQueues':function(_0x59784e){return new Promise(function(_0x4d1346,_0x277090){var _0x7429bf=[];for(var _0x2bd926 in _0x56db18[_0x5ac5('0x47')]){if(_0x56db18[_0x5ac5('0x47')][_0x5ac5('0x42')](_0x2bd926)){var _0x4ee231=_0x56db18[_0x5ac5('0x47')][_0x2bd926];var _0x41d0a6={'id':_0x4ee231['id'],'available':_0x4ee231[_0x5ac5('0x48')],'loggedIn':_0x4ee231[_0x5ac5('0x49')],'name':_0x4ee231[_0x5ac5('0x4a')],'paused':_0x4ee231['paused'],'waiting':_0x4ee231['waiting']};_0x7429bf['push'](_0x41d0a6);}}_0x4d1346({'count':_0x7429bf[_0x5ac5('0x22')],'rows':_0x7429bf});});},'MailQueues':function(_0x350752){return new Promise(function(_0x334a1c,_0x2b4058){var _0x53bde1=[];for(var _0x16aabd in _0x56db18[_0x5ac5('0x4b')]){if(_0x56db18[_0x5ac5('0x4b')]['hasOwnProperty'](_0x16aabd)){var _0x5f3dfe=_0x56db18['mailQueues'][_0x16aabd];var _0x2190e2={'id':_0x5f3dfe['id'],'available':_0x5f3dfe[_0x5ac5('0x48')],'loggedIn':_0x5f3dfe[_0x5ac5('0x49')],'name':_0x5f3dfe[_0x5ac5('0x4a')],'paused':_0x5f3dfe[_0x5ac5('0x4c')],'waiting':_0x5f3dfe[_0x5ac5('0x4d')]};_0x53bde1['push'](_0x2190e2);}}_0x334a1c({'count':_0x53bde1[_0x5ac5('0x22')],'rows':_0x53bde1});});},'OpenchannelQueues':function(_0x5532d6){return new Promise(function(_0x492179,_0x3eda7f){var _0x30a2b3=[];for(var _0x2b9438 in _0x56db18[_0x5ac5('0x4e')]){if(_0x56db18[_0x5ac5('0x4e')][_0x5ac5('0x42')](_0x2b9438)){var _0xb02e95=_0x56db18[_0x5ac5('0x4e')][_0x2b9438];var _0x474f42={'id':_0xb02e95['id'],'available':_0xb02e95[_0x5ac5('0x48')],'loggedIn':_0xb02e95[_0x5ac5('0x49')],'name':_0xb02e95[_0x5ac5('0x4a')],'paused':_0xb02e95[_0x5ac5('0x4c')],'waiting':_0xb02e95[_0x5ac5('0x4d')]};_0x30a2b3[_0x5ac5('0x20')](_0x474f42);}}_0x492179({'count':_0x30a2b3[_0x5ac5('0x22')],'rows':_0x30a2b3});});},'SmsQueues':function(_0x356f1b){return new Promise(function(_0x447dce,_0x116126){var _0xc95ae5=[];for(var _0x478124 in _0x56db18['smsQueues']){if(_0x56db18[_0x5ac5('0x4f')]['hasOwnProperty'](_0x478124)){var _0x1626fa=_0x56db18['smsQueues'][_0x478124];var _0x27457e={'id':_0x1626fa['id'],'available':_0x1626fa['available'],'loggedIn':_0x1626fa['loggedIn'],'name':_0x1626fa[_0x5ac5('0x4a')],'paused':_0x1626fa['paused'],'waiting':_0x1626fa[_0x5ac5('0x4d')]};_0xc95ae5[_0x5ac5('0x20')](_0x27457e);}}_0x447dce({'count':_0xc95ae5['length'],'rows':_0xc95ae5});});},'FaxQueues':function(_0x337645){return new Promise(function(_0x11c8d4,_0x24c3bd){var _0x3edfe2=[];for(var _0xd80c99 in _0x56db18[_0x5ac5('0x50')]){if(_0x56db18['faxQueues'][_0x5ac5('0x42')](_0xd80c99)){var _0x5b5758=_0x56db18[_0x5ac5('0x50')][_0xd80c99];var _0x2099a6={'id':_0x5b5758['id'],'available':_0x5b5758[_0x5ac5('0x48')],'loggedIn':_0x5b5758['loggedIn'],'name':_0x5b5758[_0x5ac5('0x4a')],'paused':_0x5b5758[_0x5ac5('0x4c')],'waiting':_0x5b5758[_0x5ac5('0x4d')]};_0x3edfe2['push'](_0x2099a6);}}_0x11c8d4({'count':_0x3edfe2[_0x5ac5('0x22')],'rows':_0x3edfe2});});},'WhatsappQueues':function(_0x4552f0){return new Promise(function(_0x36b2c8,_0x1c54f5){var _0x37b1f6=[];for(var _0x5d8aea in _0x56db18['whatsappQueues']){if(_0x56db18[_0x5ac5('0x51')][_0x5ac5('0x42')](_0x5d8aea)){var _0x19aca2=_0x56db18[_0x5ac5('0x51')][_0x5d8aea];var _0x3d9841={'id':_0x19aca2['id'],'available':_0x19aca2[_0x5ac5('0x48')],'loggedIn':_0x19aca2['loggedIn'],'name':_0x19aca2[_0x5ac5('0x4a')],'paused':_0x19aca2[_0x5ac5('0x4c')],'waiting':_0x19aca2[_0x5ac5('0x4d')]};_0x37b1f6[_0x5ac5('0x20')](_0x3d9841);}}_0x36b2c8({'count':_0x37b1f6[_0x5ac5('0x22')],'rows':_0x37b1f6});});},'ChatQueuesWaitingInteractions':function(_0x2a3dfb){return new Promise(function(_0x300fa3,_0x4189c5){var _0x422f43=_[_0x5ac5('0x46')](_0x56db18['chatQueuesWaitingInteractions']);_0x300fa3({'count':_0x422f43[_0x5ac5('0x22')],'rows':_0x422f43});});},'MailQueuesWaitingInteractions':function(_0x173656){return new Promise(function(_0x48cad2,_0x5237be){var _0x5a97f4=_[_0x5ac5('0x46')](_0x56db18[_0x5ac5('0x52')]);_0x48cad2({'count':_0x5a97f4[_0x5ac5('0x22')],'rows':_0x5a97f4});});},'OpenchannelQueuesWaitingInteractions':function(_0x33143d){return new Promise(function(_0x126953,_0xc9f6d8){var _0x5a978f=_[_0x5ac5('0x46')](_0x56db18['openchannelQueuesWaitingInteractions']);_0x126953({'count':_0x5a978f[_0x5ac5('0x22')],'rows':_0x5a978f});});},'SmsQueuesWaitingInteractions':function(_0x816369){return new Promise(function(_0x120a16,_0x110d63){var _0x4f509b=_[_0x5ac5('0x46')](_0x56db18['smsQueuesWaitingInteractions']);_0x120a16({'count':_0x4f509b[_0x5ac5('0x22')],'rows':_0x4f509b});});},'FaxQueuesWaitingInteractions':function(_0x14e3d3){return new Promise(function(_0x65025d,_0x5046e0){var _0x28dd3d=_['values'](_0x56db18[_0x5ac5('0x53')]);_0x65025d({'count':_0x28dd3d[_0x5ac5('0x22')],'rows':_0x28dd3d});});},'WhatsappQueuesWaitingInteractions':function(_0x2b7943){return new Promise(function(_0xdf5bdd,_0x48a775){var _0x4c1a85=_[_0x5ac5('0x46')](_0x56db18['whatsappQueuesWaitingInteractions']);_0xdf5bdd({'count':_0x4c1a85['length'],'rows':_0x4c1a85});});}};var _0x7c2747=jayson[_0x5ac5('0x54')](_0x1633d1)[_0x5ac5('0x55')]();_0x7c2747['on'](_0x5ac5('0x30'),function(_0x5cde48){logger[_0x5ac5('0x30')](JSON[_0x5ac5('0x35')](_0x5cde48));return _0x58e6f7(_0x5cde48);});_0x7c2747[_0x5ac5('0x13')](0x232c,'127.0.0.1',function(){console[_0x5ac5('0x56')](_0x5ac5('0x57'),0x232c);return _0x40ee8a('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x008c=['lodash','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','isArray','applications','length','app','toLowerCase','autoreply','appdata','push','slice','join','dialogflow','dialogflowv2','split','amazonlex','tag','TagId','format','%s:%s:%s','./interval','condition','intervals','consequence','info','Push\x20new\x20rule','\x20|\x20','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busyQueue','interaction','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','mailQueues','name','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:'];(function(_0x5ecd2a,_0xa5a1d7){var _0x406b96=function(_0x5df158){while(--_0x5df158){_0x5ecd2a['push'](_0x5ecd2a['shift']());}};_0x406b96(++_0xa5a1d7);}(_0x008c,0x188));var _0xc008=function(_0x23aeaf,_0x241fa7){_0x23aeaf=_0x23aeaf-0x0;var _0x118109=_0x008c[_0x23aeaf];return _0x118109;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var fs=require('fs');var jayson=require(_0xc008('0x3'));var BPromise=require(_0xc008('0x4'));var uuid=require('uuid');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var rpc={'openchannelQueueReport':require(_0xc008('0x8')),'mailQueueReport':require(_0xc008('0x9')),'chatQueueReport':require(_0xc008('0xa')),'smsQueueReport':require(_0xc008('0xb')),'faxQueueReport':require(_0xc008('0xc')),'whatsappQueueReport':require(_0xc008('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x428fa9,_0x5aa09b,_0x30be38){return util['format']('%s.%s.%s',_0x428fa9,_0x5aa09b||0x0,_0x30be38||0x0);}function getIntervals(_0x27830d,_0x7231b4){var _0x57c46d=[];if(!_['isNil'](_0x7231b4['IntervalId'])&&!_[_0xc008('0xe')](_0x27830d[_0x7231b4[_0xc008('0xf')]])&&!_['isNil'](_0x27830d[_0x7231b4[_0xc008('0xf')]][_0xc008('0x10')])){_0x57c46d=_[_0xc008('0x11')](_0x27830d[_0x7231b4[_0xc008('0xf')]][_0xc008('0x10')],_0xc008('0x12'));}else if(!_[_0xc008('0xe')](_0x7231b4['interval'])){_0x57c46d=[_0x7231b4['interval']];}return _0x57c46d;}exports[_0xc008('0x13')]=function(_0x50c1ab){_0x50c1ab[_0xc008('0x14')]={};return new BPromise(function(_0x4584e1,_0x2073ef){var _0x339ffc={'Start':function(_0x3f0ecf){var _0x5ee00b=this;return new Promise(function(_0x5e894e,_0x4bd0f4){if(_0x3f0ecf){try{var _0x11ef38=[];var _0x15a6ad=getId(_0x3f0ecf[_0xc008('0x15')],_0x3f0ecf[_0xc008('0x16')]?_0x3f0ecf['message']['id']:0x0,_0x3f0ecf['interaction']?_0x3f0ecf['interaction']['id']:0x0);if(_0x3f0ecf['applications']&&_[_0xc008('0x17')](_0x3f0ecf[_0xc008('0x18')])&&_0x3f0ecf['applications'][_0xc008('0x19')]){for(var _0x5906e6=0x0;_0x5906e6<_0x3f0ecf['applications']['length'];_0x5906e6+=0x1){var _0x50261c=_0x3f0ecf[_0xc008('0x18')][_0x5906e6];if(fs['existsSync'](path['join'](__dirname,'applications',_0x50261c['app']+'.js'))){var _0x13a263=[];switch(_0x50261c[_0xc008('0x1a')][_0xc008('0x1b')]()){case _0xc008('0x1c'):var _0x11cc75=_0x50261c[_0xc008('0x1d')]['split'](',');if(_0x3f0ecf[_0xc008('0x15')]==='mail'){_0x13a263['push'](_0x11cc75[0x0]);_0x13a263[_0xc008('0x1e')](_0x11cc75[0x1]);_0x13a263[_0xc008('0x1e')](_0x11cc75[_0xc008('0x1f')](0x2,_0x11cc75[_0xc008('0x19')])['join'](','));}else{_0x13a263['push'](_0x11cc75[0x0]);_0x13a263['push'](_0x11cc75[_0xc008('0x1f')](0x1,_0x11cc75[_0xc008('0x19')])[_0xc008('0x20')](','));}break;case _0xc008('0x21'):var _0x5bebd9=_0x50261c['appdata']['split'](',');_0x13a263['push'](_0x5bebd9[0x0]);_0x13a263['push'](_0x5bebd9[0x1]);_0x13a263[_0xc008('0x1e')](_0x5bebd9[_0xc008('0x1f')](0x2,_0x5bebd9[_0xc008('0x19')])['join'](','));break;case _0xc008('0x22'):var _0x32390d=_0x50261c[_0xc008('0x1d')][_0xc008('0x23')](',');_0x13a263['push'](_0x32390d[0x0]);_0x13a263[_0xc008('0x1e')](_0x32390d[0x1]);_0x13a263[_0xc008('0x1e')](_0x32390d[0x2]);_0x13a263['push'](_0x32390d[0x3]);_0x13a263['push'](_0x32390d['slice'](0x4,_0x32390d[_0xc008('0x19')])[_0xc008('0x20')](','));break;case _0xc008('0x24'):var _0x10889f=_0x50261c[_0xc008('0x1d')][_0xc008('0x23')](',');_0x13a263[_0xc008('0x1e')](_0x10889f[0x0]);_0x13a263[_0xc008('0x1e')](_0x10889f[0x1]);_0x13a263[_0xc008('0x1e')](_0x10889f[0x2]);_0x13a263[_0xc008('0x1e')](_0x10889f[0x3]);_0x13a263[_0xc008('0x1e')](_0x10889f[_0xc008('0x1f')](0x4,_0x10889f['length'])[_0xc008('0x20')](','));break;case _0xc008('0x16'):_0x13a263['push'](_0x50261c[_0xc008('0x1d')]);break;case _0xc008('0x25'):_0x13a263[_0xc008('0x1e')](_0x50261c[_0xc008('0x26')]);_0x13a263[_0xc008('0x1e')](_0x50261c[_0xc008('0x1d')]);break;default:_0x13a263=_[_0xc008('0xe')](_0x50261c[_0xc008('0x1d')])?[]:_0x50261c[_0xc008('0x1d')]['split'](',');}var _0x415b87={'id':util[_0xc008('0x27')](_0xc008('0x28'),_0x15a6ad,_0x50261c['id'],_0x50261c[_0xc008('0x1a')]),'condition':require(_0xc008('0x29'))[_0xc008('0x2a')](_0x15a6ad,getIntervals(_0x50c1ab[_0xc008('0x2b')],_0x50261c),_0x50c1ab),'consequence':require('./applications/'+_0x50261c[_0xc008('0x1a')])[_0xc008('0x2c')](_0x15a6ad,_0x13a263,_0x50c1ab,_0x3f0ecf),'p':_0x50261c['priority']||0x0};logger[_0xc008('0x2d')](_0xc008('0x2e'),_0x415b87['id'],'on\x20interval',getIntervals(_0x50c1ab[_0xc008('0x2b')],_0x50261c)[_0xc008('0x20')](_0xc008('0x2f')));_0x11ef38['push'](_0x415b87);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0xc008('0x20')](__dirname,'applications',_0x50261c[_0xc008('0x1a')]+_0xc008('0x30')));}}_0x50c1ab[_0xc008('0x14')][_0x15a6ad]=new RuleEngine(_0x11ef38);_0x50c1ab[_0xc008('0x14')][_0x15a6ad][_0xc008('0x31')](_0x3f0ecf,function(_0xa381d1){logger[_0xc008('0x2d')](_0xc008('0x32'),JSON[_0xc008('0x33')](_0xa381d1[_0xc008('0x34')]));if(_0x50c1ab[_0xc008('0x14')][_0x15a6ad]){_0x50c1ab[_0xc008('0x14')][_0x15a6ad][_0xc008('0x35')](_0xc008('0x36'));}});return _0x5e894e({'code':0xc8,'message':_0x3f0ecf});}else{logger['info'](_0xc008('0x37'));return _0x5e894e({'code':0xc8,'message':_0x3f0ecf});}}catch(_0x23c4db){logger[_0xc008('0x38')](_0x23c4db[_0xc008('0x39')]);return _0x4bd0f4(_0x5ee00b['error'](0x1f4,_0x23c4db));}}return _0x4bd0f4(_0xc008('0x3a'));});},'AcceptMessage':function(_0x15396b){var _0xc8cb91=this;return new Promise(function(_0x36e7ae,_0x2d142d){if(_0x15396b['agent']&&_0x15396b[_0xc008('0x3b')]['id']){if(_0x50c1ab[_0xc008('0x3c')][_0x15396b[_0xc008('0x3b')]['id']]){_0x50c1ab[_0xc008('0x3c')][_0x15396b[_0xc008('0x3b')]['id']]['busy']=![];_0x50c1ab[_0xc008('0x3c')][_0x15396b[_0xc008('0x3b')]['id']][_0xc008('0x3d')]=undefined;}}if(_0x15396b[_0xc008('0x16')]&&_0x15396b['message']['id']){try{var _0x26cd05=getId(_0x15396b[_0xc008('0x15')],_0x15396b[_0xc008('0x16')]?_0x15396b['message']['id']:0x0,_0x15396b[_0xc008('0x3e')]?_0x15396b['interaction']['id']:0x0);if(_0x50c1ab[_0xc008('0x14')][_0x26cd05]){_0x50c1ab['rules'][_0x26cd05][_0xc008('0x35')](_0xc008('0x3f'));if(rpc[_0x15396b['channel']+_0xc008('0x40')]){rpc[_0x15396b[_0xc008('0x15')]+_0xc008('0x40')]['update'](_0x26cd05,{'UserId':_0x15396b[_0xc008('0x16')][_0xc008('0x41')]})[_0xc008('0x42')](function(_0x44fc5d){logger[_0xc008('0x38')](_0xc008('0x43'));});}}return _0x36e7ae({'code':0xc8,'message':_0x15396b});}catch(_0x59ca2b){logger['error'](_0x59ca2b['stack']);return _0x2d142d(_0xc8cb91[_0xc008('0x38')](0x1f4,_0x59ca2b));}}logger[_0xc008('0x38')](_0xc008('0x44'));return _0x2d142d(_0xc8cb91[_0xc008('0x38')](0x1f4,_0xc008('0x44')));});},'RejectMessage':function(_0x24f6a4){var _0x2cf641=this;return new Promise(function(_0x33be4f,_0x572593){if(_0x24f6a4['agent']&&_0x24f6a4['agent']['id']){try{if(_0x50c1ab[_0xc008('0x3c')][_0x24f6a4[_0xc008('0x3b')]['id']]){_0x50c1ab[_0xc008('0x3c')][_0x24f6a4['agent']['id']][_0xc008('0x45')]=![];_0x50c1ab[_0xc008('0x3c')][_0x24f6a4[_0xc008('0x3b')]['id']][_0xc008('0x3d')]=undefined;}return _0x33be4f({'code':0xc8,'message':_0x24f6a4});}catch(_0x4981b4){logger[_0xc008('0x38')](_0x4981b4[_0xc008('0x39')]);return _0x572593(_0x2cf641[_0xc008('0x38')](0x1f4,_0x4981b4));}}logger[_0xc008('0x38')](_0xc008('0x44'));return _0x572593(_0x2cf641['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x223056){var _0x51cb14=this;return new Promise(function(_0x437fef,_0x36e6f8){if(_0x223056[_0xc008('0x15')]&&_0x223056['interaction']&&_0x223056[_0xc008('0x3e')]['id']){try{var _0x32b435=getId(_0x223056[_0xc008('0x15')],_0x223056[_0xc008('0x16')]?_0x223056[_0xc008('0x16')]['id']:0x0,_0x223056['interaction']?_0x223056[_0xc008('0x3e')]['id']:0x0);if(_0x50c1ab[_0xc008('0x14')][_0x32b435]){_0x50c1ab['rules'][_0x32b435][_0xc008('0x35')](_0xc008('0x3f'));}return _0x437fef({'code':0xc8,'message':_0x223056});}catch(_0x5b5fbf){logger['error'](_0x5b5fbf[_0xc008('0x39')]);return _0x36e6f8(_0x51cb14[_0xc008('0x38')](0x1f4,_0x5b5fbf));}}logger[_0xc008('0x38')](_0xc008('0x44'));return _0x36e6f8(_0x51cb14[_0xc008('0x38')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x57f1f9){var _0x34b72a=this;return new Promise(function(_0x5d815d,_0x3d7cce){if(_0x50c1ab[_0xc008('0x3c')][_0xc008('0x46')](_0x57f1f9['id'])){for(var _0x2f1105 in _0x57f1f9[_0xc008('0x47')]){if(_0x57f1f9[_0xc008('0x47')]['hasOwnProperty'](_0x2f1105)){if(_0x50c1ab[_0xc008('0x3c')][_0x57f1f9['id']][_0xc008('0x46')](_0x2f1105+_0xc008('0x48'))){_0x50c1ab[_0xc008('0x3c')][_0x57f1f9['id']][_0x2f1105+_0xc008('0x48')]=parseInt(_0x57f1f9['capacity'][_0x2f1105],0xa);}}}_0x50c1ab[_0xc008('0x3c')][_0x57f1f9['id']]['updateRealtime']();return _0x5d815d({'code':0xc8,'message':_0x50c1ab['agents'][_0x57f1f9['id']]});}else{return _0x3d7cce(_0x34b72a['error'](0x1f4,_0xc008('0x49')));}});},'Agents':function(_0x1bcbb1){return new Promise(function(_0x5dfb69,_0x5f58d7){var _0x3aeeab=_[_0xc008('0x4a')](_0x50c1ab[_0xc008('0x3c')]);_0x5dfb69({'count':_0x3aeeab['length'],'rows':_0x3aeeab});});},'ChatQueues':function(_0x3587c3){return new Promise(function(_0x1092cb,_0x12ba3f){var _0x1b5a22=[];for(var _0x5baff1 in _0x50c1ab[_0xc008('0x4b')]){if(_0x50c1ab['chatQueues'][_0xc008('0x46')](_0x5baff1)){var _0x422e1f=_0x50c1ab[_0xc008('0x4b')][_0x5baff1];var _0x943c91={'id':_0x422e1f['id'],'available':_0x422e1f[_0xc008('0x4c')],'loggedIn':_0x422e1f[_0xc008('0x4d')],'name':_0x422e1f['name'],'paused':_0x422e1f[_0xc008('0x4e')],'waiting':_0x422e1f['waiting']};_0x1b5a22['push'](_0x943c91);}}_0x1092cb({'count':_0x1b5a22[_0xc008('0x19')],'rows':_0x1b5a22});});},'MailQueues':function(_0x30aa1e){return new Promise(function(_0x56e755,_0xb1befa){var _0xb8ba7=[];for(var _0x3e373e in _0x50c1ab[_0xc008('0x4f')]){if(_0x50c1ab[_0xc008('0x4f')][_0xc008('0x46')](_0x3e373e)){var _0x12973b=_0x50c1ab['mailQueues'][_0x3e373e];var _0x16e052={'id':_0x12973b['id'],'available':_0x12973b[_0xc008('0x4c')],'loggedIn':_0x12973b[_0xc008('0x4d')],'name':_0x12973b[_0xc008('0x50')],'paused':_0x12973b[_0xc008('0x4e')],'waiting':_0x12973b[_0xc008('0x51')]};_0xb8ba7[_0xc008('0x1e')](_0x16e052);}}_0x56e755({'count':_0xb8ba7[_0xc008('0x19')],'rows':_0xb8ba7});});},'OpenchannelQueues':function(_0xbc430a){return new Promise(function(_0x37d193,_0x1bef66){var _0x2b5eb6=[];for(var _0x131b81 in _0x50c1ab[_0xc008('0x52')]){if(_0x50c1ab['openchannelQueues'][_0xc008('0x46')](_0x131b81)){var _0x2e5467=_0x50c1ab[_0xc008('0x52')][_0x131b81];var _0x566dea={'id':_0x2e5467['id'],'available':_0x2e5467[_0xc008('0x4c')],'loggedIn':_0x2e5467[_0xc008('0x4d')],'name':_0x2e5467['name'],'paused':_0x2e5467['paused'],'waiting':_0x2e5467[_0xc008('0x51')]};_0x2b5eb6[_0xc008('0x1e')](_0x566dea);}}_0x37d193({'count':_0x2b5eb6[_0xc008('0x19')],'rows':_0x2b5eb6});});},'SmsQueues':function(_0x39083c){return new Promise(function(_0x1a2ce7,_0x335f00){var _0x238852=[];for(var _0x38191e in _0x50c1ab[_0xc008('0x53')]){if(_0x50c1ab[_0xc008('0x53')][_0xc008('0x46')](_0x38191e)){var _0x490a60=_0x50c1ab[_0xc008('0x53')][_0x38191e];var _0x25a52b={'id':_0x490a60['id'],'available':_0x490a60[_0xc008('0x4c')],'loggedIn':_0x490a60[_0xc008('0x4d')],'name':_0x490a60['name'],'paused':_0x490a60[_0xc008('0x4e')],'waiting':_0x490a60['waiting']};_0x238852[_0xc008('0x1e')](_0x25a52b);}}_0x1a2ce7({'count':_0x238852[_0xc008('0x19')],'rows':_0x238852});});},'FaxQueues':function(_0x419257){return new Promise(function(_0x4ccffe,_0x1c31f5){var _0x2e5e2b=[];for(var _0xa80000 in _0x50c1ab['faxQueues']){if(_0x50c1ab[_0xc008('0x54')]['hasOwnProperty'](_0xa80000)){var _0x50ee03=_0x50c1ab[_0xc008('0x54')][_0xa80000];var _0x23012c={'id':_0x50ee03['id'],'available':_0x50ee03[_0xc008('0x4c')],'loggedIn':_0x50ee03[_0xc008('0x4d')],'name':_0x50ee03['name'],'paused':_0x50ee03[_0xc008('0x4e')],'waiting':_0x50ee03[_0xc008('0x51')]};_0x2e5e2b['push'](_0x23012c);}}_0x4ccffe({'count':_0x2e5e2b[_0xc008('0x19')],'rows':_0x2e5e2b});});},'WhatsappQueues':function(_0x5233bb){return new Promise(function(_0x278cbe,_0x50bfe5){var _0x20d08f=[];for(var _0x498cfb in _0x50c1ab[_0xc008('0x55')]){if(_0x50c1ab[_0xc008('0x55')][_0xc008('0x46')](_0x498cfb)){var _0x47337b=_0x50c1ab['whatsappQueues'][_0x498cfb];var _0x57752c={'id':_0x47337b['id'],'available':_0x47337b[_0xc008('0x4c')],'loggedIn':_0x47337b[_0xc008('0x4d')],'name':_0x47337b[_0xc008('0x50')],'paused':_0x47337b[_0xc008('0x4e')],'waiting':_0x47337b[_0xc008('0x51')]};_0x20d08f[_0xc008('0x1e')](_0x57752c);}}_0x278cbe({'count':_0x20d08f[_0xc008('0x19')],'rows':_0x20d08f});});},'ChatQueuesWaitingInteractions':function(_0x5be2f8){return new Promise(function(_0x3e535b,_0x530c2f){var _0x511477=_['values'](_0x50c1ab[_0xc008('0x56')]);_0x3e535b({'count':_0x511477[_0xc008('0x19')],'rows':_0x511477});});},'MailQueuesWaitingInteractions':function(_0x3b41b0){return new Promise(function(_0x233a85,_0xc2f684){var _0x2e9646=_[_0xc008('0x4a')](_0x50c1ab[_0xc008('0x57')]);_0x233a85({'count':_0x2e9646[_0xc008('0x19')],'rows':_0x2e9646});});},'OpenchannelQueuesWaitingInteractions':function(_0x551d38){return new Promise(function(_0x38b603,_0x1e6055){var _0x2b1b26=_[_0xc008('0x4a')](_0x50c1ab[_0xc008('0x58')]);_0x38b603({'count':_0x2b1b26[_0xc008('0x19')],'rows':_0x2b1b26});});},'SmsQueuesWaitingInteractions':function(_0x23d4ff){return new Promise(function(_0x2edb8e,_0x100dcd){var _0x41ac2a=_[_0xc008('0x4a')](_0x50c1ab[_0xc008('0x59')]);_0x2edb8e({'count':_0x41ac2a['length'],'rows':_0x41ac2a});});},'FaxQueuesWaitingInteractions':function(_0x4e7af3){return new Promise(function(_0x320e1d,_0x3104cd){var _0x41e92e=_['values'](_0x50c1ab[_0xc008('0x5a')]);_0x320e1d({'count':_0x41e92e[_0xc008('0x19')],'rows':_0x41e92e});});},'WhatsappQueuesWaitingInteractions':function(_0x4ed54b){return new Promise(function(_0x50dd7c,_0x4908c8){var _0x3fc44f=_[_0xc008('0x4a')](_0x50c1ab[_0xc008('0x5b')]);_0x50dd7c({'count':_0x3fc44f[_0xc008('0x19')],'rows':_0x3fc44f});});}};var _0x1101b8=jayson[_0xc008('0x5c')](_0x339ffc)[_0xc008('0x5d')]();_0x1101b8['on'](_0xc008('0x38'),function(_0x1161e6){logger[_0xc008('0x38')](JSON['stringify'](_0x1161e6));return _0x2073ef(_0x1161e6);});_0x1101b8['listen'](0x232c,_0xc008('0x5e'),function(){console[_0xc008('0x5f')](_0xc008('0x60'),0x232c);return _0x4584e1(_0xc008('0x61')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 6dc21eb..04eba6a 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 _0x82ca=['request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','util','bluebird','lodash','../../../config/logger','routing','client','http'];(function(_0x36c611,_0x11d67f){var _0x4177fc=function(_0x1c2a15){while(--_0x1c2a15){_0x36c611['push'](_0x36c611['shift']());}};_0x4177fc(++_0x11d67f);}(_0x82ca,0xb6));var _0xa82c=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x82ca[_0x673722];return _0x21249c;};'use strict';var util=require(_0xa82c('0x0'));var BPromise=require(_0xa82c('0x1'));var jayson=require('jayson/promise');var _=require(_0xa82c('0x2'));var logger=require(_0xa82c('0x3'))(_0xa82c('0x4'));var client=jayson[_0xa82c('0x5')][_0xa82c('0x6')]({'port':0x232a});function request(_0x2d4353,_0x3622d8){return new BPromise(function(_0x2e1bd8,_0x461139){return client[_0xa82c('0x7')](_0x2d4353,_0x3622d8)[_0xa82c('0x8')](function(_0x662c6a){if(_0x662c6a['error']){return _0x461139(_0x662c6a[_0xa82c('0x9')][_0xa82c('0xa')]);}else{return _0x2e1bd8(_0x662c6a['result']);}})[_0xa82c('0xb')](function(_0x43db93){return _0x461139(_0x43db93);});});}exports[_0xa82c('0xc')]=function(_0x48acad,_0xb71a4a,_0xfe1d39){return function(_0x28e04f){if(_0xfe1d39[_0xa82c('0xd')]&&!_0xfe1d39[_0xa82c('0xd')][_0x48acad]){logger[_0xa82c('0xe')](_0xa82c('0xf'),_0x48acad);return _0x28e04f[_0xa82c('0x10')]();}var _0x1d2ea1=[];for(var _0x37222e=0x0;_0x37222e<_0xb71a4a['length'];_0x37222e+=0x1){_0x1d2ea1[_0xa82c('0x11')](request(_0xa82c('0x12'),{'command':util[_0xa82c('0x13')](_0xa82c('0x14'),_0xb71a4a[_0x37222e])})[_0xa82c('0x8')](function(_0x13d403){return _0x13d403&&_0x13d403[_0xa82c('0xa')]&&_0x13d403[_0xa82c('0xa')]['indexOf']('true')>=0x0?!![]:![];})[_0xa82c('0xb')](function(_0x5bc081){logger[_0xa82c('0x9')](_0xa82c('0x15'),_0x48acad,_0xb71a4a[_0x37222e]);}));}BPromise[_0xa82c('0x16')](_0x1d2ea1)[_0xa82c('0x8')](function(_0x530902){var _0x8f6097=_['some'](_0x530902);logger[_0xa82c('0xe')](_0xa82c('0x17'),_0x48acad,_0xb71a4a[_0xa82c('0x18')](_0xa82c('0x19')),_0x8f6097);_0x28e04f[_0xa82c('0x1a')](_0x8f6097);})['catch'](function(_0x311977){console['log'](_0x311977);logger[_0xa82c('0x9')](_0xa82c('0x17'),_0x48acad,_0xb71a4a[_0xa82c('0x18')](_0xa82c('0x19')),_0x311977['stack']);_0x28e04f[_0xa82c('0x10')]();});};}; \ No newline at end of file +var _0xaee7=['routing','client','request','then','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','Command','format','iftime\x20%s','indexOf','true','catch','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','bluebird','jayson/promise','lodash'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xaee7,0x192));var _0x7aee=function(_0x24f424,_0x222001){_0x24f424=_0x24f424-0x0;var _0xfa875c=_0xaee7[_0x24f424];return _0xfa875c;};'use strict';var util=require('util');var BPromise=require(_0x7aee('0x0'));var jayson=require(_0x7aee('0x1'));var _=require(_0x7aee('0x2'));var logger=require('../../../config/logger')(_0x7aee('0x3'));var client=jayson[_0x7aee('0x4')]['http']({'port':0x232a});function request(_0x2b4b3b,_0x2e1327){return new BPromise(function(_0x12567a,_0x220fbe){return client[_0x7aee('0x5')](_0x2b4b3b,_0x2e1327)[_0x7aee('0x6')](function(_0x47102b){if(_0x47102b[_0x7aee('0x7')]){return _0x220fbe(_0x47102b['error'][_0x7aee('0x8')]);}else{return _0x12567a(_0x47102b[_0x7aee('0x9')]);}})['catch'](function(_0x56e56e){return _0x220fbe(_0x56e56e);});});}exports[_0x7aee('0xa')]=function(_0x91f7d7,_0x1fe4f4,_0x3127d4){return function(_0x36873e){if(_0x3127d4['rules']&&!_0x3127d4[_0x7aee('0xb')][_0x91f7d7]){logger[_0x7aee('0xc')](_0x7aee('0xd'),_0x91f7d7);return _0x36873e['stop']();}var _0xcc20d0=[];for(var _0x1c890f=0x0;_0x1c890f<_0x1fe4f4['length'];_0x1c890f+=0x1){_0xcc20d0['push'](request(_0x7aee('0xe'),{'command':util[_0x7aee('0xf')](_0x7aee('0x10'),_0x1fe4f4[_0x1c890f])})[_0x7aee('0x6')](function(_0x385f87){return _0x385f87&&_0x385f87[_0x7aee('0x8')]&&_0x385f87[_0x7aee('0x8')][_0x7aee('0x11')](_0x7aee('0x12'))>=0x0?!![]:![];})[_0x7aee('0x13')](function(_0xba80f5){logger[_0x7aee('0x7')]('[%s][INTERVAL]\x20%s',_0x91f7d7,_0x1fe4f4[_0x1c890f]);}));}BPromise[_0x7aee('0x14')](_0xcc20d0)[_0x7aee('0x6')](function(_0x53f179){var _0x51d793=_['some'](_0x53f179);logger['info'](_0x7aee('0x15'),_0x91f7d7,_0x1fe4f4[_0x7aee('0x16')]('\x20|\x20'),_0x51d793);_0x36873e[_0x7aee('0x17')](_0x51d793);})[_0x7aee('0x13')](function(_0x50c412){console[_0x7aee('0x18')](_0x50c412);logger[_0x7aee('0x7')](_0x7aee('0x15'),_0x91f7d7,_0x1fe4f4['join'](_0x7aee('0x19')),_0x50c412[_0x7aee('0x1a')]);_0x36873e['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 9d1f88c..7ccdd36 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 _0xe5dc=['answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','calleridname','agententerreason','transfertargetuniqueid','clone','agentcalledAt','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','util','info','format','queue','membername','interface','calleridnum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','now','lastevent','called','connectedlinenum','connectedlinename','error','[%s][agents][agentcalled]','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid'];(function(_0x2b7577,_0x422c99){var _0x1a7c9b=function(_0x386a67){while(--_0x386a67){_0x2b7577['push'](_0x2b7577['shift']());}};_0x1a7c9b(++_0x422c99);}(_0xe5dc,0x11b));var _0xce5d=function(_0x56bcf8,_0x3f26e0){_0x56bcf8=_0x56bcf8-0x0;var _0x49247c=_0xe5dc[_0x56bcf8];return _0x49247c;};'use strict';var _=require('lodash');var util=require(_0xce5d('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5f3942,_0x174657){utils[_0xce5d('0x1')](util[_0xce5d('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x5f3942['uniqueid'],_0x5f3942['channel'],_0x5f3942[_0xce5d('0x3')],_0x5f3942[_0xce5d('0x4')],_0x5f3942[_0xce5d('0x5')],_0x5f3942[_0xce5d('0x6')],_0x5f3942['connectedlinenum'],_0x5f3942['lastevent']));if(_0x5f3942[_0xce5d('0x3')]){utils[_0xce5d('0x7')](_0x5f3942['queue'])[_0xce5d('0x8')](function(_0x50edd1){if(_0x50edd1){_0x5f3942[_0xce5d('0x9')]=_0x50edd1[_0xce5d('0x9')];_0x5f3942[_0xce5d('0xa')]=_0x5f3942[_0xce5d('0xb')]?_0x50edd1['acw']:![];_0x5f3942['acwtime']=_0x5f3942[_0xce5d('0xa')]?_0x50edd1[_0xce5d('0xc')]:0x0;}utils[_0xce5d('0xd')](_0xce5d('0xe'),_0x5f3942);});}else{utils[_0xce5d('0xd')](_0xce5d('0xe'),_0x5f3942);}if(_0x174657){delete transfers[_0x5f3942[_0xce5d('0xf')]];}else{delete agents[_0x5f3942[_0xce5d('0x10')]];}}exports[_0xce5d('0x11')]=function(_0x412ba8){try{utils[_0xce5d('0x12')](util[_0xce5d('0x2')]('[%s][agents][agentcalled]',_0x412ba8['uniqueid']),_0x412ba8);agents[_0x412ba8[_0xce5d('0x10')]]=_0x412ba8;agents[_0x412ba8[_0xce5d('0x10')]]['agentcalledAt']=utils[_0xce5d('0x13')]();agents[_0x412ba8[_0xce5d('0x10')]][_0xce5d('0x14')]=_0xce5d('0x15');agents[_0x412ba8[_0xce5d('0x10')]][_0xce5d('0x16')]=null;agents[_0x412ba8[_0xce5d('0x10')]][_0xce5d('0x17')]=null;utils['info'](util[_0xce5d('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x412ba8[_0xce5d('0xf')],agents[_0x412ba8[_0xce5d('0x10')]][_0xce5d('0x4')],_0x412ba8[_0xce5d('0x10')]));}catch(_0x159a76){utils[_0xce5d('0x18')](util[_0xce5d('0x2')](_0xce5d('0x19'),_0x412ba8[_0xce5d('0xf')]),_0x159a76);}};exports[_0xce5d('0x1a')]=function(_0x33af10){try{if(!_['isNil'](agents[_0x33af10[_0xce5d('0x10')]])){utils[_0xce5d('0x12')](util[_0xce5d('0x2')](_0xce5d('0x1b'),_0x33af10['uniqueid']),_0x33af10);utils[_0xce5d('0x1')](util[_0xce5d('0x2')](_0xce5d('0x1c'),_0x33af10['uniqueid'],agents[_0x33af10['destuniqueid']]['membername'],_0x33af10[_0xce5d('0x10')]));agents[_0x33af10[_0xce5d('0x10')]][_0xce5d('0x1a')]=!![];agents[_0x33af10[_0xce5d('0x10')]][_0xce5d('0x1d')]=utils[_0xce5d('0x13')]();agents[_0x33af10[_0xce5d('0x10')]]['lastevent']=_0xce5d('0x1e');agents[_0x33af10[_0xce5d('0x10')]][_0xce5d('0x1f')]=_0xce5d('0x1e');agents[_0x33af10[_0xce5d('0x10')]][_0xce5d('0x20')]=_0x33af10[_0xce5d('0x21')]?parseInt(_0x33af10[_0xce5d('0x21')])/0x3e8:0x0;agents[_0x33af10[_0xce5d('0x10')]][_0xce5d('0x22')]=0x0;unanswered[_0xce5d('0x23')](_0x33af10['destuniqueid']);}}catch(_0x3f41b6){utils[_0xce5d('0x18')](util[_0xce5d('0x2')](_0xce5d('0x1b'),_0x33af10[_0xce5d('0xf')]),_0x3f41b6);}};exports['queuecallerabandon']=function(_0x11e978){try{_[_0xce5d('0x24')](agents,function(_0x100d94,_0x27e23c){if(_0x100d94['uniqueid']==_0x11e978['uniqueid']&&!_['includes'](unanswered,_0x100d94[_0xce5d('0x10')])){utils[_0xce5d('0x12')](util[_0xce5d('0x2')](_0xce5d('0x25'),_0x11e978[_0xce5d('0xf')]),_0x11e978);utils[_0xce5d('0x1')](util['format'](_0xce5d('0x26'),_0x11e978[_0xce5d('0xf')],_0x100d94['membername'],_0x100d94['destuniqueid']));_0x100d94[_0xce5d('0x1a')]=!![];_0x100d94[_0xce5d('0x1d')]=utils['now']();_0x100d94[_0xce5d('0x14')]=_0xce5d('0x27');_0x100d94[_0xce5d('0x1f')]=_0xce5d('0x27');_0x100d94[_0xce5d('0x20')]=_0x11e978[_0xce5d('0x20')];_0x100d94[_0xce5d('0x22')]=0x0;writeDB(_0x100d94);}});}catch(_0x17a5b7){utils[_0xce5d('0x18')](util[_0xce5d('0x2')](_0xce5d('0x25'),_0x11e978['uniqueid']),_0x17a5b7);}};exports['agentconnect']=function(_0x1fe7ed){try{if(agents[_0x1fe7ed[_0xce5d('0x10')]]){utils[_0xce5d('0x12')](util[_0xce5d('0x2')](_0xce5d('0x28'),_0x1fe7ed['uniqueid']),_0x1fe7ed);utils[_0xce5d('0x1')](util[_0xce5d('0x2')](_0xce5d('0x29'),_0x1fe7ed[_0xce5d('0xf')],agents[_0x1fe7ed['destuniqueid']][_0xce5d('0x4')],_0x1fe7ed[_0xce5d('0x10')]));agents[_0x1fe7ed[_0xce5d('0x10')]][_0xce5d('0x2a')]=utils[_0xce5d('0x13')]();agents[_0x1fe7ed[_0xce5d('0x10')]][_0xce5d('0x16')]=_0x1fe7ed['connectedlinenum'];agents[_0x1fe7ed[_0xce5d('0x10')]][_0xce5d('0x17')]=_0x1fe7ed[_0xce5d('0x17')];agents[_0x1fe7ed[_0xce5d('0x10')]]['holdtime']=_0x1fe7ed[_0xce5d('0x21')];agents[_0x1fe7ed[_0xce5d('0x10')]][_0xce5d('0x14')]='connect';_[_0xce5d('0x24')](agents,function(_0x185816,_0x1cb560){if(_0x185816[_0xce5d('0x10')]!=_0x1fe7ed[_0xce5d('0x10')]&&_0x185816[_0xce5d('0xf')]==_0x1fe7ed['uniqueid']){_0x185816[_0xce5d('0x22')]=0x0;_0x185816['holdtime']=_0x1fe7ed['ringtime'];_0x185816['agentringnoanswer']=!![];_0x185816[_0xce5d('0x1d')]=utils[_0xce5d('0x13')]();_0x185816[_0xce5d('0x14')]=_0xce5d('0x2b');_0x185816['reason']='answered_elsewhere';_0x185816[_0xce5d('0x2c')]=_0x1fe7ed['destuniqueid'];_0x185816[_0xce5d('0x2d')]=_0x1fe7ed[_0xce5d('0x4')];writeDB(_0x185816);}});}}catch(_0x25bb10){utils[_0xce5d('0x18')](util[_0xce5d('0x2')](_0xce5d('0x28'),_0x1fe7ed['uniqueid']),_0x25bb10);}};exports[_0xce5d('0xb')]=function(_0x5e3cea){try{if(!_['isNil'](agents[_0x5e3cea[_0xce5d('0x10')]])){utils['debug'](util['format'](_0xce5d('0x2e'),_0x5e3cea['uniqueid']),_0x5e3cea);utils[_0xce5d('0x1')](util['format'](_0xce5d('0x2f'),_0x5e3cea[_0xce5d('0xf')],agents[_0x5e3cea['destuniqueid']]['membername'],_0x5e3cea[_0xce5d('0x10')]));agents[_0x5e3cea[_0xce5d('0x10')]]['agentcomplete']=!![];agents[_0x5e3cea['destuniqueid']][_0xce5d('0x30')]=utils[_0xce5d('0x13')]();agents[_0x5e3cea[_0xce5d('0x10')]][_0xce5d('0x22')]=utils['diffTime'](agents[_0x5e3cea[_0xce5d('0x10')]][_0xce5d('0x30')],agents[_0x5e3cea[_0xce5d('0x10')]]['agentconnectAt']);agents[_0x5e3cea['destuniqueid']]['reason']=_0x5e3cea[_0xce5d('0x1f')];agents[_0x5e3cea[_0xce5d('0x10')]][_0xce5d('0x14')]=_0xce5d('0x31');writeDB(agents[_0x5e3cea[_0xce5d('0x10')]]);}}catch(_0x471f3f){utils[_0xce5d('0x18')](util[_0xce5d('0x2')](_0xce5d('0x2e'),_0x5e3cea[_0xce5d('0xf')]),_0x471f3f);}};exports[_0xce5d('0x32')]=function(_0x3d8cf7){try{if(!_[_0xce5d('0x33')](agents[_0x3d8cf7[_0xce5d('0x34')]])){utils[_0xce5d('0x12')](util[_0xce5d('0x2')](_0xce5d('0x35'),_0x3d8cf7[_0xce5d('0xf')]),_0x3d8cf7);utils['info'](util[_0xce5d('0x2')](_0xce5d('0x36'),_0x3d8cf7[_0xce5d('0xf')],agents[_0x3d8cf7[_0xce5d('0x34')]]['membername'],agents[_0x3d8cf7[_0xce5d('0x34')]]['uniqueid']));agents[_0x3d8cf7[_0xce5d('0x34')]]['transfer']=!![];agents[_0x3d8cf7[_0xce5d('0x34')]][_0xce5d('0x37')]=_0xce5d('0x38');agents[_0x3d8cf7[_0xce5d('0x34')]][_0xce5d('0x39')]=_0x3d8cf7[_0xce5d('0x3a')];agents[_0x3d8cf7[_0xce5d('0x34')]][_0xce5d('0x3b')]=agents[_0x3d8cf7[_0xce5d('0x34')]][_0xce5d('0xf')];}}catch(_0x5a8e77){utils[_0xce5d('0x18')](util[_0xce5d('0x2')]('[%s][agents][blindtransfer]',_0x3d8cf7[_0xce5d('0xf')]),_0x5a8e77);}};exports[_0xce5d('0x3c')]=function(_0x5eb7c3){try{utils[_0xce5d('0x12')](util['format'](_0xce5d('0x3d'),_0x5eb7c3['origtransfereruniqueid']),_0x5eb7c3);if(_0x5eb7c3[_0xce5d('0x3e')]==_0x5eb7c3[_0xce5d('0x3f')]){if(!_[_0xce5d('0x33')](agents[_0x5eb7c3[_0xce5d('0x40')]])){utils[_0xce5d('0x1')](util['format'](_0xce5d('0x41'),_0x5eb7c3[_0xce5d('0x3e')],agents[_0x5eb7c3['secondtransfereruniqueid']][_0xce5d('0x4')]));agents[_0x5eb7c3['secondtransfereruniqueid']][_0xce5d('0x42')]=!![];agents[_0x5eb7c3[_0xce5d('0x40')]][_0xce5d('0x37')]=_0xce5d('0x43');agents[_0x5eb7c3['secondtransfereruniqueid']][_0xce5d('0x39')]=_0x5eb7c3[_0xce5d('0x44')];agents[_0x5eb7c3[_0xce5d('0x40')]][_0xce5d('0x3b')]=_0x5eb7c3['origtransfereruniqueid'];}if(_0x5eb7c3[_0xce5d('0x45')]&&agents[_0x5eb7c3['transfereeuniqueid']]){agents[_0x5eb7c3[_0xce5d('0x45')]]['agententerreason']=0x1;transfers[_0x5eb7c3[_0xce5d('0x45')]]=_['clone'](agents[_0x5eb7c3[_0xce5d('0x45')]]);transfers[_0x5eb7c3['transfereeuniqueid']]['calleridnum']=agents[_0x5eb7c3[_0xce5d('0x40')]][_0xce5d('0x6')];transfers[_0x5eb7c3[_0xce5d('0x45')]][_0xce5d('0x46')]=agents[_0x5eb7c3['secondtransfereruniqueid']][_0xce5d('0x46')];transfers[_0x5eb7c3[_0xce5d('0x45')]]['agentcalledAt']=utils[_0xce5d('0x13')]();transfers[_0x5eb7c3[_0xce5d('0x45')]][_0xce5d('0x2a')]=utils['now']();transfers[_0x5eb7c3[_0xce5d('0x45')]]['holdtime']=0x0;transfers[_0x5eb7c3[_0xce5d('0x45')]][_0xce5d('0x47')]=0x2;}}else if(_0x5eb7c3[_0xce5d('0x40')]==_0x5eb7c3['secondtransfererlinkedid']){if(!_[_0xce5d('0x33')](agents[_0x5eb7c3[_0xce5d('0x3e')]])){utils[_0xce5d('0x1')](util[_0xce5d('0x2')](_0xce5d('0x41'),_0x5eb7c3['origtransfereruniqueid'],agents[_0x5eb7c3[_0xce5d('0x3e')]][_0xce5d('0x4')]));agents[_0x5eb7c3[_0xce5d('0x3e')]][_0xce5d('0x42')]=!![];agents[_0x5eb7c3['origtransfereruniqueid']][_0xce5d('0x37')]='ATTENDED';agents[_0x5eb7c3[_0xce5d('0x3e')]]['transferexten']=_0x5eb7c3['secondtransfererexten'];agents[_0x5eb7c3[_0xce5d('0x3e')]][_0xce5d('0x3b')]=_0x5eb7c3[_0xce5d('0x40')];}if(_0x5eb7c3[_0xce5d('0x48')]&&agents[_0x5eb7c3[_0xce5d('0x48')]]){agents[_0x5eb7c3[_0xce5d('0x48')]][_0xce5d('0x47')]=0x1;transfers[_0x5eb7c3[_0xce5d('0x48')]]=_[_0xce5d('0x49')](agents[_0x5eb7c3[_0xce5d('0x48')]]);transfers[_0x5eb7c3[_0xce5d('0x48')]][_0xce5d('0x6')]=agents[_0x5eb7c3['origtransfereruniqueid']]['calleridnum'];transfers[_0x5eb7c3[_0xce5d('0x48')]][_0xce5d('0x46')]=agents[_0x5eb7c3['origtransfereruniqueid']]['calleridname'];transfers[_0x5eb7c3[_0xce5d('0x48')]][_0xce5d('0x4a')]=utils[_0xce5d('0x13')]();transfers[_0x5eb7c3[_0xce5d('0x48')]][_0xce5d('0x2a')]=utils['now']();transfers[_0x5eb7c3[_0xce5d('0x48')]][_0xce5d('0x20')]=0x0;transfers[_0x5eb7c3[_0xce5d('0x48')]]['agententerreason']=0x2;}}}catch(_0x5d3061){utils[_0xce5d('0x18')](util['format']('[%s][agents][attendedtransfer]',_0x5eb7c3['origtransfereruniqueid']),_0x5d3061);}};exports['hangup']=function(_0x29878){try{utils[_0xce5d('0x12')](util[_0xce5d('0x2')](_0xce5d('0x4b'),_0x29878[_0xce5d('0xf')]),_0x29878);if(agents[_0x29878['uniqueid']]&&agents[_0x29878[_0xce5d('0xf')]][_0xce5d('0x1f')]==='timeout'){if(_0x29878[_0xce5d('0x4c')]==='21'){agents[_0x29878[_0xce5d('0xf')]]['reason']=_0xce5d('0x4d');agents[_0x29878[_0xce5d('0xf')]][_0xce5d('0x14')]=_0xce5d('0x4d');}utils[_0xce5d('0x1')](util[_0xce5d('0x2')](_0xce5d('0x4e'),_0x29878['uniqueid'],agents[_0x29878['uniqueid']][_0xce5d('0x4')],agents[_0x29878[_0xce5d('0xf')]][_0xce5d('0x1f')],agents[_0x29878['uniqueid']][_0xce5d('0x14')]));writeDB(agents[_0x29878[_0xce5d('0xf')]]);var _0x16c42a=unanswered[_0xce5d('0x4f')](_0x29878[_0xce5d('0xf')]);if(_0x16c42a>-0x1){unanswered[_0xce5d('0x50')](_0x16c42a,0x1);}}if(transfers[_0x29878[_0xce5d('0xf')]]){transfers[_0x29878[_0xce5d('0xf')]][_0xce5d('0xb')]=!![];transfers[_0x29878[_0xce5d('0xf')]][_0xce5d('0x30')]=utils[_0xce5d('0x13')]();transfers[_0x29878[_0xce5d('0xf')]]['talktime']=utils['diffTime'](transfers[_0x29878[_0xce5d('0xf')]]['agentcompleteAt'],transfers[_0x29878[_0xce5d('0xf')]][_0xce5d('0x2a')]);transfers[_0x29878[_0xce5d('0xf')]]['reason']=_0xce5d('0x51');transfers[_0x29878[_0xce5d('0xf')]][_0xce5d('0x14')]=_0xce5d('0x31');utils[_0xce5d('0x1')](util[_0xce5d('0x2')](_0xce5d('0x4e'),_0x29878['uniqueid'],transfers[_0x29878[_0xce5d('0xf')]][_0xce5d('0x4')],transfers[_0x29878['uniqueid']][_0xce5d('0x1f')],transfers[_0x29878[_0xce5d('0xf')]][_0xce5d('0x14')]));writeDB(transfers[_0x29878['uniqueid']],!![]);}if(agents[_0x29878['uniqueid']]&&agents[_0x29878[_0xce5d('0xf')]][_0xce5d('0x2a')]){agents[_0x29878['uniqueid']][_0xce5d('0xb')]=!![];agents[_0x29878[_0xce5d('0xf')]][_0xce5d('0x30')]=utils[_0xce5d('0x13')]();agents[_0x29878[_0xce5d('0xf')]][_0xce5d('0x22')]=utils['diffTime'](agents[_0x29878['uniqueid']][_0xce5d('0x30')],agents[_0x29878['uniqueid']][_0xce5d('0x2a')]);agents[_0x29878['uniqueid']][_0xce5d('0x1f')]=agents[_0x29878[_0xce5d('0xf')]][_0xce5d('0x42')]?_0xce5d('0x42'):_0xce5d('0x51');agents[_0x29878[_0xce5d('0xf')]][_0xce5d('0x14')]='complete';utils[_0xce5d('0x1')](util[_0xce5d('0x2')](_0xce5d('0x4e'),_0x29878['uniqueid'],agents[_0x29878[_0xce5d('0xf')]]['membername'],agents[_0x29878[_0xce5d('0xf')]][_0xce5d('0x1f')],agents[_0x29878[_0xce5d('0xf')]]['lastevent']));writeDB(agents[_0x29878['uniqueid']]);}}catch(_0x156047){utils[_0xce5d('0x18')](util['format'](_0xce5d('0x4b'),_0x29878['uniqueid']),_0x156047);}}; \ No newline at end of file +var _0x39b3=['lodash','util','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','format','[%s][agents][agentcalled]','now','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','timeout','reason','holdtime','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','[%s][agents][agentconnect]','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheremembername','agentcomplete','isNil','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','agentcalledAt','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent'];(function(_0x4a738e,_0x17f05b){var _0x85f0a3=function(_0x416feb){while(--_0x416feb){_0x4a738e['push'](_0x4a738e['shift']());}};_0x85f0a3(++_0x17f05b);}(_0x39b3,0xa6));var _0x339b=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x39b3[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x339b('0x0'));var util=require(_0x339b('0x1'));var utils=require(_0x339b('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x19e2b4,_0x32dc78){utils[_0x339b('0x3')](util['format'](_0x339b('0x4'),_0x19e2b4[_0x339b('0x5')],_0x19e2b4[_0x339b('0x6')],_0x19e2b4[_0x339b('0x7')],_0x19e2b4[_0x339b('0x8')],_0x19e2b4[_0x339b('0x9')],_0x19e2b4['calleridnum'],_0x19e2b4[_0x339b('0xa')],_0x19e2b4[_0x339b('0xb')]));if(_0x19e2b4[_0x339b('0x7')]){utils[_0x339b('0xc')](_0x19e2b4['queue'])['then'](function(_0x1b0d8b){if(_0x1b0d8b){_0x19e2b4[_0x339b('0xd')]=_0x1b0d8b['type'];_0x19e2b4[_0x339b('0xe')]=_0x19e2b4['agentcomplete']?_0x1b0d8b[_0x339b('0xf')]:![];_0x19e2b4[_0x339b('0x10')]=_0x19e2b4[_0x339b('0xe')]?_0x1b0d8b[_0x339b('0x11')]:0x0;}utils[_0x339b('0x12')](_0x339b('0x13'),_0x19e2b4);});}else{utils[_0x339b('0x12')](_0x339b('0x13'),_0x19e2b4);}if(_0x32dc78){delete transfers[_0x19e2b4[_0x339b('0x5')]];}else{delete agents[_0x19e2b4[_0x339b('0x14')]];}}exports[_0x339b('0x15')]=function(_0x4fcb50){try{utils['debug'](util[_0x339b('0x16')](_0x339b('0x17'),_0x4fcb50[_0x339b('0x5')]),_0x4fcb50);agents[_0x4fcb50[_0x339b('0x14')]]=_0x4fcb50;agents[_0x4fcb50['destuniqueid']]['agentcalledAt']=utils[_0x339b('0x18')]();agents[_0x4fcb50[_0x339b('0x14')]][_0x339b('0xb')]='called';agents[_0x4fcb50[_0x339b('0x14')]]['connectedlinenum']=null;agents[_0x4fcb50[_0x339b('0x14')]]['connectedlinename']=null;utils[_0x339b('0x3')](util[_0x339b('0x16')](_0x339b('0x19'),_0x4fcb50['uniqueid'],agents[_0x4fcb50[_0x339b('0x14')]][_0x339b('0x8')],_0x4fcb50[_0x339b('0x14')]));}catch(_0x175d3d){utils[_0x339b('0x1a')](util[_0x339b('0x16')]('[%s][agents][agentcalled]',_0x4fcb50[_0x339b('0x5')]),_0x175d3d);}};exports[_0x339b('0x1b')]=function(_0x26d915){try{if(!_['isNil'](agents[_0x26d915[_0x339b('0x14')]])){utils[_0x339b('0x1c')](util[_0x339b('0x16')](_0x339b('0x1d'),_0x26d915[_0x339b('0x5')]),_0x26d915);utils['info'](util[_0x339b('0x16')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x26d915[_0x339b('0x5')],agents[_0x26d915[_0x339b('0x14')]]['membername'],_0x26d915[_0x339b('0x14')]));agents[_0x26d915[_0x339b('0x14')]]['agentringnoanswer']=!![];agents[_0x26d915[_0x339b('0x14')]]['agentringnoanswerAt']=utils[_0x339b('0x18')]();agents[_0x26d915[_0x339b('0x14')]][_0x339b('0xb')]=_0x339b('0x1e');agents[_0x26d915['destuniqueid']][_0x339b('0x1f')]=_0x339b('0x1e');agents[_0x26d915[_0x339b('0x14')]][_0x339b('0x20')]=_0x26d915[_0x339b('0x21')]?parseInt(_0x26d915['ringtime'])/0x3e8:0x0;agents[_0x26d915[_0x339b('0x14')]][_0x339b('0x22')]=0x0;unanswered[_0x339b('0x23')](_0x26d915[_0x339b('0x14')]);}}catch(_0x1d8cec){utils[_0x339b('0x1a')](util[_0x339b('0x16')]('[%s][agents][agentringnoanswer]',_0x26d915[_0x339b('0x5')]),_0x1d8cec);}};exports['queuecallerabandon']=function(_0x128a0d){try{_[_0x339b('0x24')](agents,function(_0x187613,_0xa3cc3){if(_0x187613[_0x339b('0x5')]==_0x128a0d['uniqueid']&&!_[_0x339b('0x25')](unanswered,_0x187613[_0x339b('0x14')])){utils[_0x339b('0x1c')](util[_0x339b('0x16')](_0x339b('0x26'),_0x128a0d[_0x339b('0x5')]),_0x128a0d);utils[_0x339b('0x3')](util[_0x339b('0x16')](_0x339b('0x27'),_0x128a0d[_0x339b('0x5')],_0x187613[_0x339b('0x8')],_0x187613['destuniqueid']));_0x187613['agentringnoanswer']=!![];_0x187613[_0x339b('0x28')]=utils['now']();_0x187613[_0x339b('0xb')]=_0x339b('0x29');_0x187613[_0x339b('0x1f')]=_0x339b('0x29');_0x187613[_0x339b('0x20')]=_0x128a0d[_0x339b('0x20')];_0x187613['talktime']=0x0;writeDB(_0x187613);}});}catch(_0x21f97a){utils[_0x339b('0x1a')](util[_0x339b('0x16')](_0x339b('0x26'),_0x128a0d[_0x339b('0x5')]),_0x21f97a);}};exports['agentconnect']=function(_0x3a67b1){try{if(agents[_0x3a67b1[_0x339b('0x14')]]){utils[_0x339b('0x1c')](util['format'](_0x339b('0x2a'),_0x3a67b1[_0x339b('0x5')]),_0x3a67b1);utils[_0x339b('0x3')](util[_0x339b('0x16')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x3a67b1[_0x339b('0x5')],agents[_0x3a67b1[_0x339b('0x14')]][_0x339b('0x8')],_0x3a67b1['destuniqueid']));agents[_0x3a67b1[_0x339b('0x14')]][_0x339b('0x2b')]=utils[_0x339b('0x18')]();agents[_0x3a67b1['destuniqueid']][_0x339b('0xa')]=_0x3a67b1[_0x339b('0xa')];agents[_0x3a67b1[_0x339b('0x14')]]['connectedlinename']=_0x3a67b1[_0x339b('0x2c')];agents[_0x3a67b1['destuniqueid']]['holdtime']=_0x3a67b1[_0x339b('0x21')];agents[_0x3a67b1['destuniqueid']][_0x339b('0xb')]='connect';_[_0x339b('0x24')](agents,function(_0x1a0c9c,_0x5bab88){if(_0x1a0c9c[_0x339b('0x14')]!=_0x3a67b1[_0x339b('0x14')]&&_0x1a0c9c['uniqueid']==_0x3a67b1['uniqueid']){_0x1a0c9c['talktime']=0x0;_0x1a0c9c[_0x339b('0x20')]=_0x3a67b1[_0x339b('0x21')];_0x1a0c9c['agentringnoanswer']=!![];_0x1a0c9c[_0x339b('0x28')]=utils[_0x339b('0x18')]();_0x1a0c9c[_0x339b('0xb')]=_0x339b('0x2d');_0x1a0c9c['reason']=_0x339b('0x2d');_0x1a0c9c['answeredelsewheredestinationuniqueid']=_0x3a67b1[_0x339b('0x14')];_0x1a0c9c[_0x339b('0x2e')]=_0x3a67b1['membername'];writeDB(_0x1a0c9c);}});}}catch(_0x19eaab){utils[_0x339b('0x1a')](util[_0x339b('0x16')](_0x339b('0x2a'),_0x3a67b1['uniqueid']),_0x19eaab);}};exports[_0x339b('0x2f')]=function(_0x2413c9){try{if(!_[_0x339b('0x30')](agents[_0x2413c9[_0x339b('0x14')]])){utils[_0x339b('0x1c')](util['format']('[%s][agents][agentcomplete]',_0x2413c9[_0x339b('0x5')]),_0x2413c9);utils['info'](util[_0x339b('0x16')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2413c9[_0x339b('0x5')],agents[_0x2413c9[_0x339b('0x14')]][_0x339b('0x8')],_0x2413c9[_0x339b('0x14')]));agents[_0x2413c9[_0x339b('0x14')]][_0x339b('0x2f')]=!![];agents[_0x2413c9['destuniqueid']][_0x339b('0x31')]=utils[_0x339b('0x18')]();agents[_0x2413c9[_0x339b('0x14')]]['talktime']=utils[_0x339b('0x32')](agents[_0x2413c9[_0x339b('0x14')]][_0x339b('0x31')],agents[_0x2413c9['destuniqueid']][_0x339b('0x2b')]);agents[_0x2413c9[_0x339b('0x14')]][_0x339b('0x1f')]=_0x2413c9[_0x339b('0x1f')];agents[_0x2413c9['destuniqueid']][_0x339b('0xb')]=_0x339b('0x33');writeDB(agents[_0x2413c9[_0x339b('0x14')]]);}}catch(_0x5ae87f){utils[_0x339b('0x1a')](util['format'](_0x339b('0x34'),_0x2413c9['uniqueid']),_0x5ae87f);}};exports[_0x339b('0x35')]=function(_0x2c2e0c){try{if(!_[_0x339b('0x30')](agents[_0x2c2e0c[_0x339b('0x36')]])){utils[_0x339b('0x1c')](util[_0x339b('0x16')](_0x339b('0x37'),_0x2c2e0c[_0x339b('0x5')]),_0x2c2e0c);utils[_0x339b('0x3')](util[_0x339b('0x16')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2c2e0c[_0x339b('0x5')],agents[_0x2c2e0c['transfereruniqueid']][_0x339b('0x8')],agents[_0x2c2e0c['transfereruniqueid']][_0x339b('0x5')]));agents[_0x2c2e0c[_0x339b('0x36')]][_0x339b('0x38')]=!![];agents[_0x2c2e0c['transfereruniqueid']]['transfertype']='blind';agents[_0x2c2e0c['transfereruniqueid']][_0x339b('0x39')]=_0x2c2e0c['extension'];agents[_0x2c2e0c[_0x339b('0x36')]][_0x339b('0x3a')]=agents[_0x2c2e0c['transfereruniqueid']][_0x339b('0x5')];}}catch(_0x4769fb){utils[_0x339b('0x1a')](util[_0x339b('0x16')](_0x339b('0x37'),_0x2c2e0c[_0x339b('0x5')]),_0x4769fb);}};exports[_0x339b('0x3b')]=function(_0x3d8bbc){try{utils['debug'](util[_0x339b('0x16')](_0x339b('0x3c'),_0x3d8bbc[_0x339b('0x3d')]),_0x3d8bbc);if(_0x3d8bbc[_0x339b('0x3d')]==_0x3d8bbc['origtransfererlinkedid']){if(!_[_0x339b('0x30')](agents[_0x3d8bbc[_0x339b('0x3e')]])){utils['info'](util[_0x339b('0x16')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x3d8bbc[_0x339b('0x3d')],agents[_0x3d8bbc[_0x339b('0x3e')]][_0x339b('0x8')]));agents[_0x3d8bbc['secondtransfereruniqueid']]['transfer']=!![];agents[_0x3d8bbc[_0x339b('0x3e')]][_0x339b('0x3f')]=_0x339b('0x40');agents[_0x3d8bbc[_0x339b('0x3e')]][_0x339b('0x39')]=_0x3d8bbc[_0x339b('0x41')];agents[_0x3d8bbc[_0x339b('0x3e')]][_0x339b('0x3a')]=_0x3d8bbc[_0x339b('0x3d')];}if(_0x3d8bbc[_0x339b('0x42')]&&agents[_0x3d8bbc[_0x339b('0x42')]]){agents[_0x3d8bbc[_0x339b('0x42')]][_0x339b('0x43')]=0x1;transfers[_0x3d8bbc[_0x339b('0x42')]]=_[_0x339b('0x44')](agents[_0x3d8bbc[_0x339b('0x42')]]);transfers[_0x3d8bbc[_0x339b('0x42')]][_0x339b('0x45')]=agents[_0x3d8bbc[_0x339b('0x3e')]][_0x339b('0x45')];transfers[_0x3d8bbc[_0x339b('0x42')]][_0x339b('0x46')]=agents[_0x3d8bbc[_0x339b('0x3e')]]['calleridname'];transfers[_0x3d8bbc['transfereeuniqueid']][_0x339b('0x47')]=utils['now']();transfers[_0x3d8bbc['transfereeuniqueid']][_0x339b('0x2b')]=utils[_0x339b('0x18')]();transfers[_0x3d8bbc[_0x339b('0x42')]][_0x339b('0x20')]=0x0;transfers[_0x3d8bbc[_0x339b('0x42')]][_0x339b('0x43')]=0x2;}}else if(_0x3d8bbc[_0x339b('0x3e')]==_0x3d8bbc['secondtransfererlinkedid']){if(!_[_0x339b('0x30')](agents[_0x3d8bbc[_0x339b('0x3d')]])){utils[_0x339b('0x3')](util[_0x339b('0x16')](_0x339b('0x48'),_0x3d8bbc[_0x339b('0x3d')],agents[_0x3d8bbc['origtransfereruniqueid']][_0x339b('0x8')]));agents[_0x3d8bbc[_0x339b('0x3d')]]['transfer']=!![];agents[_0x3d8bbc[_0x339b('0x3d')]][_0x339b('0x3f')]=_0x339b('0x40');agents[_0x3d8bbc[_0x339b('0x3d')]][_0x339b('0x39')]=_0x3d8bbc[_0x339b('0x49')];agents[_0x3d8bbc[_0x339b('0x3d')]]['transferuniqueid']=_0x3d8bbc[_0x339b('0x3e')];}if(_0x3d8bbc['transfertargetuniqueid']&&agents[_0x3d8bbc['transfertargetuniqueid']]){agents[_0x3d8bbc[_0x339b('0x4a')]][_0x339b('0x43')]=0x1;transfers[_0x3d8bbc[_0x339b('0x4a')]]=_[_0x339b('0x44')](agents[_0x3d8bbc['transfertargetuniqueid']]);transfers[_0x3d8bbc[_0x339b('0x4a')]][_0x339b('0x45')]=agents[_0x3d8bbc[_0x339b('0x3d')]][_0x339b('0x45')];transfers[_0x3d8bbc[_0x339b('0x4a')]][_0x339b('0x46')]=agents[_0x3d8bbc['origtransfereruniqueid']][_0x339b('0x46')];transfers[_0x3d8bbc[_0x339b('0x4a')]]['agentcalledAt']=utils['now']();transfers[_0x3d8bbc[_0x339b('0x4a')]][_0x339b('0x2b')]=utils[_0x339b('0x18')]();transfers[_0x3d8bbc[_0x339b('0x4a')]][_0x339b('0x20')]=0x0;transfers[_0x3d8bbc['transfertargetuniqueid']][_0x339b('0x43')]=0x2;}}}catch(_0x2cfe39){utils['error'](util['format'](_0x339b('0x3c'),_0x3d8bbc['origtransfereruniqueid']),_0x2cfe39);}};exports[_0x339b('0x4b')]=function(_0x200f87){try{utils[_0x339b('0x1c')](util['format'](_0x339b('0x4c'),_0x200f87[_0x339b('0x5')]),_0x200f87);if(agents[_0x200f87[_0x339b('0x5')]]&&agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x1f')]===_0x339b('0x1e')){if(_0x200f87[_0x339b('0x4d')]==='21'){agents[_0x200f87[_0x339b('0x5')]]['reason']=_0x339b('0x4e');agents[_0x200f87[_0x339b('0x5')]][_0x339b('0xb')]=_0x339b('0x4e');}utils['info'](util[_0x339b('0x16')](_0x339b('0x4f'),_0x200f87[_0x339b('0x5')],agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x8')],agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x1f')],agents[_0x200f87[_0x339b('0x5')]][_0x339b('0xb')]));writeDB(agents[_0x200f87[_0x339b('0x5')]]);var _0x54e6c9=unanswered[_0x339b('0x50')](_0x200f87[_0x339b('0x5')]);if(_0x54e6c9>-0x1){unanswered[_0x339b('0x51')](_0x54e6c9,0x1);}}if(transfers[_0x200f87[_0x339b('0x5')]]){transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0x2f')]=!![];transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0x31')]=utils[_0x339b('0x18')]();transfers[_0x200f87[_0x339b('0x5')]]['talktime']=utils[_0x339b('0x32')](transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0x31')],transfers[_0x200f87[_0x339b('0x5')]]['agentconnectAt']);transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0x1f')]='agent';transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0xb')]=_0x339b('0x33');utils['info'](util[_0x339b('0x16')](_0x339b('0x4f'),_0x200f87['uniqueid'],transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0x8')],transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0x1f')],transfers[_0x200f87[_0x339b('0x5')]]['lastevent']));writeDB(transfers[_0x200f87['uniqueid']],!![]);}if(agents[_0x200f87['uniqueid']]&&agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x2b')]){agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x2f')]=!![];agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x31')]=utils[_0x339b('0x18')]();agents[_0x200f87['uniqueid']][_0x339b('0x22')]=utils[_0x339b('0x32')](agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x31')],agents[_0x200f87['uniqueid']][_0x339b('0x2b')]);agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x1f')]=agents[_0x200f87[_0x339b('0x5')]]['transfer']?_0x339b('0x38'):_0x339b('0x52');agents[_0x200f87[_0x339b('0x5')]][_0x339b('0xb')]=_0x339b('0x33');utils[_0x339b('0x3')](util[_0x339b('0x16')](_0x339b('0x4f'),_0x200f87['uniqueid'],agents[_0x200f87[_0x339b('0x5')]]['membername'],agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x1f')],agents[_0x200f87[_0x339b('0x5')]][_0x339b('0xb')]));writeDB(agents[_0x200f87[_0x339b('0x5')]]);}}catch(_0x2b6e96){utils[_0x339b('0x1a')](util['format'](_0x339b('0x4c'),_0x200f87[_0x339b('0x5')]),_0x2b6e96);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 1636bcc..adf6090 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 _0xc45a=['connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','[%s][calls][newchannel]','newstate','debug','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lastdata','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum'];(function(_0x45902a,_0x4f2a19){var _0x2ec763=function(_0x18c3c7){while(--_0x18c3c7){_0x45902a['push'](_0x45902a['shift']());}};_0x2ec763(++_0x4f2a19);}(_0xc45a,0x1ab));var _0xac45=function(_0x87f5f8,_0x18bec5){_0x87f5f8=_0x87f5f8-0x0;var _0x53deeb=_0xc45a[_0x87f5f8];return _0x53deeb;};'use strict';var _=require('lodash');var util=require(_0xac45('0x0'));var utils=require(_0xac45('0x1'));var dispositions=[_0xac45('0x2'),_0xac45('0x3'),'FAILED',_0xac45('0x2'),_0xac45('0x2'),'NO\x20ANSWER',_0xac45('0x4'),'BUSY',_0xac45('0x3'),_0xac45('0x3'),_0xac45('0x3')];var channels={};function writeDB(_0x5ba21c){utils['info'](util[_0xac45('0x5')](_0xac45('0x6'),_0x5ba21c[_0xac45('0x7')],_0x5ba21c[_0xac45('0x8')],_0x5ba21c[_0xac45('0x9')],_0x5ba21c[_0xac45('0xa')],_0x5ba21c[_0xac45('0xb')],_0x5ba21c[_0xac45('0xc')],_0x5ba21c[_0xac45('0xd')],_0x5ba21c[_0xac45('0xe')]));if(_0x5ba21c[_0xac45('0xf')]){utils[_0xac45('0x10')](_0x5ba21c[_0xac45('0xf')])[_0xac45('0x11')](function(_0x45b699){if(_0x45b699){_0x5ba21c[_0xac45('0x12')]=_0x45b699['id'];}utils[_0xac45('0x13')](_0xac45('0x14'),_0x5ba21c);});}else{utils[_0xac45('0x13')](_0xac45('0x14'),_0x5ba21c);}if(channels[_0x5ba21c[_0xac45('0x7')]]){delete channels[_0x5ba21c[_0xac45('0x7')]];}}exports[_0xac45('0x15')]=function(_0x55f276){try{utils['debug'](util[_0xac45('0x5')]('[%s][calls][newchannel]',_0x55f276[_0xac45('0x7')]),_0x55f276);if(_0x55f276[_0xac45('0x7')]==_0x55f276[_0xac45('0x16')]&&_0x55f276[_0xac45('0x8')]!=_0xac45('0x17')){utils[_0xac45('0x18')](util[_0xac45('0x5')](_0xac45('0x19'),_0x55f276['uniqueid'],_0x55f276[_0xac45('0x1a')],_0x55f276[_0xac45('0x1b')]));channels[_0x55f276[_0xac45('0x7')]]={'uniqueid':_0x55f276[_0xac45('0x7')],'accountcode':_0x55f276['accountcode'],'source':_0x55f276['calleridnum'],'destination':_0x55f276[_0xac45('0x1b')],'destinationcontext':_0x55f276['context'],'channel':_0x55f276[_0xac45('0x8')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xac45('0x2'),'amaflags':_0xac45('0x1c')};}}catch(_0x497e4a){utils['error'](util[_0xac45('0x5')](_0xac45('0x1d'),_0x55f276[_0xac45('0x7')]),_0x497e4a);}};exports[_0xac45('0x1e')]=function(_0x2f6b74){try{utils[_0xac45('0x1f')](util[_0xac45('0x5')]('[%s][calls][newstate]',_0x2f6b74[_0xac45('0x7')]),_0x2f6b74);if(!_[_0xac45('0x20')](channels[_0x2f6b74[_0xac45('0x7')]])&&_0x2f6b74[_0xac45('0x21')]==0x6){utils[_0xac45('0x18')](util[_0xac45('0x5')](_0xac45('0x22'),_0x2f6b74[_0xac45('0x7')],_0x2f6b74[_0xac45('0x1a')],_0x2f6b74[_0xac45('0x8')]));if(_[_0xac45('0x20')](channels[_0x2f6b74['uniqueid']][_0xac45('0x23')])){channels[_0x2f6b74[_0xac45('0x7')]][_0xac45('0x23')]=utils[_0xac45('0x24')]();}}else if(!_['isNil'](channels[_0x2f6b74[_0xac45('0x16')]])&&_0x2f6b74[_0xac45('0x21')]==0x6&&_0x2f6b74['context']!=_0xac45('0x25')){utils[_0xac45('0x18')](util['format'](_0xac45('0x26'),_0x2f6b74[_0xac45('0x7')],_0x2f6b74[_0xac45('0x16')],_0x2f6b74['context'],_0x2f6b74[_0xac45('0x8')]));channels[_0x2f6b74[_0xac45('0x16')]]['accountcode']=_0x2f6b74[_0xac45('0xf')];channels[_0x2f6b74[_0xac45('0x16')]][_0xac45('0x27')]=_0x2f6b74[_0xac45('0x8')];if(_[_0xac45('0x20')](channels[_0x2f6b74[_0xac45('0x16')]][_0xac45('0x28')])){channels[_0x2f6b74['linkedid']][_0xac45('0x28')]=utils[_0xac45('0x24')]();}channels[_0x2f6b74[_0xac45('0x16')]][_0xac45('0x29')]=dispositions[_[_0xac45('0x2a')](_0x2f6b74[_0xac45('0x21')])]||_0xac45('0x4');}}catch(_0x5c0c2d){utils[_0xac45('0x2b')](util[_0xac45('0x5')](_0xac45('0x2c'),_0x2f6b74[_0xac45('0x7')]),_0x5c0c2d);}};exports['hangup']=function(_0x5c2fb9){try{if(!_[_0xac45('0x20')](channels[_0x5c2fb9['uniqueid']])){utils['debug'](util['format'](_0xac45('0x2d'),_0x5c2fb9['uniqueid']),_0x5c2fb9);if(_[_0xac45('0x20')](channels[_0x5c2fb9['uniqueid']][_0xac45('0x2e')])){channels[_0x5c2fb9['uniqueid']][_0xac45('0x2e')]=_0x5c2fb9[_0xac45('0x2f')]+'\x20<'+_0x5c2fb9[_0xac45('0xc')]+'>';}utils['info'](util[_0xac45('0x5')](_0xac45('0x30'),_0x5c2fb9[_0xac45('0x7')],channels[_0x5c2fb9[_0xac45('0x7')]][_0xac45('0x2e')],_0x5c2fb9['cause-txt']));channels[_0x5c2fb9[_0xac45('0x7')]][_0xac45('0x31')]=utils[_0xac45('0x24')]();channels[_0x5c2fb9[_0xac45('0x7')]][_0xac45('0x32')]=utils[_0xac45('0x33')](channels[_0x5c2fb9['uniqueid']][_0xac45('0x31')],channels[_0x5c2fb9[_0xac45('0x7')]]['starttime']);channels[_0x5c2fb9[_0xac45('0x7')]]['billableseconds']=channels[_0x5c2fb9[_0xac45('0x7')]]['answertime']?utils[_0xac45('0x33')](channels[_0x5c2fb9[_0xac45('0x7')]][_0xac45('0x31')],channels[_0x5c2fb9[_0xac45('0x7')]]['answertime']):0x0;writeDB(channels[_0x5c2fb9[_0xac45('0x7')]]);}}catch(_0xce3d93){utils['error'](util[_0xac45('0x5')]('[%s][calls][hangup]',_0x5c2fb9['uniqueid']),_0xce3d93);}};exports[_0xac45('0x34')]=function(_0xe42cff){try{if(!_[_0xac45('0x20')](channels[_0xe42cff['localtwolinkedid']])){utils['debug'](util[_0xac45('0x5')](_0xac45('0x35'),_0xe42cff[_0xac45('0x36')]),_0xe42cff);if(channels[_0xe42cff[_0xac45('0x37')]][_0xac45('0x8')]==_0xe42cff[_0xac45('0x38')]){utils[_0xac45('0x18')](util[_0xac45('0x5')](_0xac45('0x39'),_0xe42cff[_0xac45('0x36')],_0xe42cff['localtwolinkedid'],_0xe42cff[_0xac45('0x3a')]));channels[_0xe42cff[_0xac45('0x37')]][_0xac45('0x27')]=_0xe42cff[_0xac45('0x3a')];channels[_0xe42cff[_0xac45('0x37')]][_0xac45('0x3b')]='_attended';}else if(channels[_0xe42cff[_0xac45('0x37')]][_0xac45('0x8')]=_0xe42cff[_0xac45('0x3c')]){utils[_0xac45('0x18')](util['format'](_0xac45('0x39'),_0xe42cff['origtransfereruniqueid'],_0xe42cff[_0xac45('0x37')],_0xe42cff['origtransfererchannel']));channels[_0xe42cff['localtwolinkedid']][_0xac45('0x27')]=_0xe42cff[_0xac45('0x3d')];channels[_0xe42cff[_0xac45('0x37')]]['userfield']=_0xac45('0x3e');}}}catch(_0x29b78b){utils[_0xac45('0x2b')](util[_0xac45('0x5')](_0xac45('0x35'),_0xe42cff[_0xac45('0x36')]),_0x29b78b);}};exports[_0xac45('0x3f')]=function(_0x32d81a){try{if(!_['isNil'](channels[_0x32d81a[_0xac45('0x7')]])){utils[_0xac45('0x1f')](util[_0xac45('0x5')](_0xac45('0x40'),_0x32d81a[_0xac45('0x7')]),_0x32d81a);channels[_0x32d81a[_0xac45('0x7')]][_0xac45('0x41')]=utils[_0xac45('0x24')]();utils[_0xac45('0x18')](util[_0xac45('0x5')](_0xac45('0x42'),_0x32d81a[_0xac45('0x7')],channels[_0x32d81a[_0xac45('0x7')]]['musiconholdstartAt']));}}catch(_0x51dc5a){utils['error'](util[_0xac45('0x5')](_0xac45('0x40'),_0x32d81a[_0xac45('0x7')]),_0x51dc5a);}};exports['musiconholdstop']=function(_0x14a62d){try{if(!_[_0xac45('0x20')](channels[_0x14a62d[_0xac45('0x7')]])){utils[_0xac45('0x1f')](util[_0xac45('0x5')](_0xac45('0x43'),_0x14a62d[_0xac45('0x7')]),_0x14a62d);if(!_[_0xac45('0x20')](channels[_0x14a62d[_0xac45('0x7')]][_0xac45('0x41')])){channels[_0x14a62d[_0xac45('0x7')]][_0xac45('0x44')]+=utils[_0xac45('0x33')](utils[_0xac45('0x24')](),channels[_0x14a62d[_0xac45('0x7')]]['musiconholdstartAt']);utils[_0xac45('0x18')](util[_0xac45('0x5')](_0xac45('0x45'),_0x14a62d[_0xac45('0x7')],channels[_0x14a62d[_0xac45('0x7')]][_0xac45('0x44')]));delete channels[_0x14a62d[_0xac45('0x7')]][_0xac45('0x41')];}}}catch(_0x5ffd60){utils['error'](util[_0xac45('0x5')](_0xac45('0x43'),_0x14a62d['uniqueid']),_0x5ffd60);}};exports[_0xac45('0x46')]=function(_0x519a94){try{if(!_['isNil'](channels[_0x519a94[_0xac45('0x7')]])){utils[_0xac45('0x1f')](util[_0xac45('0x5')]('[%s][calls][varset]',_0x519a94['uniqueid']),_0x519a94);if(!_[_0xac45('0x20')](_0x519a94[_0xac45('0x47')][_0xac45('0x48')])){utils[_0xac45('0x18')](util[_0xac45('0x5')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x519a94['uniqueid'],_0x519a94[_0xac45('0x49')]));channels[_0x519a94[_0xac45('0x7')]][_0xac45('0x4a')]=_0x519a94[_0xac45('0x49')];}if(!_['isNil'](_0x519a94['variable'][_0xac45('0x4b')])){utils[_0xac45('0x18')](util['format'](_0xac45('0x4c'),_0x519a94[_0xac45('0x7')],_0x519a94['value']));channels[_0x519a94[_0xac45('0x7')]][_0xac45('0x4d')]=_0x519a94[_0xac45('0x49')];channels[_0x519a94['uniqueid']][_0xac45('0x2e')]='\x22'+_0x519a94[_0xac45('0x49')]+_0xac45('0x4e')+_0x519a94[_0xac45('0x49')]+'>';}if(!_[_0xac45('0x20')](_0x519a94[_0xac45('0x47')][_0xac45('0x4f')])||!_[_0xac45('0x20')](_0x519a94[_0xac45('0x47')][_0xac45('0x50')])){utils[_0xac45('0x18')](util[_0xac45('0x5')](_0xac45('0x51'),_0x519a94[_0xac45('0x7')],!_[_0xac45('0x20')](_0x519a94['variable']['xmd-callerid-preview'])?_0xac45('0x4f'):_0xac45('0x50'),_0x519a94[_0xac45('0x49')]));channels[_0x519a94[_0xac45('0x7')]][_0xac45('0x2e')]=_0x519a94[_0xac45('0x49')];}if(!_[_0xac45('0x20')](_0x519a94['variable'][_0xac45('0x52')])||!_[_0xac45('0x20')](_0x519a94[_0xac45('0x47')]['xmcs-queue'])){utils['info'](util[_0xac45('0x5')](_0xac45('0x51'),_0x519a94[_0xac45('0x7')],!_[_0xac45('0x20')](_0x519a94[_0xac45('0x47')][_0xac45('0x52')])?_0xac45('0x52'):_0xac45('0x53'),_0x519a94['value']));channels[_0x519a94[_0xac45('0x7')]][_0xac45('0x54')]=_0xac45('0x55');channels[_0x519a94['uniqueid']]['lastdata']=_0x519a94[_0xac45('0x49')];channels[_0x519a94[_0xac45('0x7')]][_0xac45('0x9')]=!![];}if(!_[_0xac45('0x20')](_0x519a94[_0xac45('0x47')][_0xac45('0x56')])){utils[_0xac45('0x18')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x519a94[_0xac45('0x7')],_0x519a94[_0xac45('0x49')]));channels[_0x519a94[_0xac45('0x7')]][_0xac45('0x57')]=_0x519a94[_0xac45('0x49')];}if(!_[_0xac45('0x20')](_0x519a94[_0xac45('0x47')]['xmd-cdrtype'])){utils[_0xac45('0x18')](util['format'](_0xac45('0x58'),_0x519a94['uniqueid'],_0x519a94[_0xac45('0x49')]));channels[_0x519a94[_0xac45('0x7')]]['type']=_0x519a94[_0xac45('0x49')];}if(!_[_0xac45('0x20')](_0x519a94[_0xac45('0x47')]['outboundrouteid'])){utils['info'](util[_0xac45('0x5')](_0xac45('0x59'),_0x519a94['uniqueid'],_0x519a94['value']));channels[_0x519a94[_0xac45('0x7')]][_0xac45('0x5a')]=_0x519a94[_0xac45('0x49')];}if(!_[_0xac45('0x20')](_0x519a94[_0xac45('0x47')][_0xac45('0x5b')])){utils[_0xac45('0x18')](util[_0xac45('0x5')](_0xac45('0x5c'),_0x519a94[_0xac45('0x7')],_0x519a94['value']));channels[_0x519a94[_0xac45('0x7')]][_0xac45('0x5b')]=_0x519a94[_0xac45('0x49')];}}}catch(_0x33abd8){utils['error'](util[_0xac45('0x5')](_0xac45('0x5d'),_0x519a94['uniqueid']),_0x33abd8);}};exports[_0xac45('0x5e')]=function(_0x5edcab){try{if(!_[_0xac45('0x20')](channels[_0x5edcab[_0xac45('0x7')]])){utils[_0xac45('0x1f')](util[_0xac45('0x5')](_0xac45('0x5f'),_0x5edcab[_0xac45('0x7')]),_0x5edcab);utils[_0xac45('0x18')](util[_0xac45('0x5')](_0xac45('0x60'),_0x5edcab['uniqueid'],_0x5edcab['application'],_0x5edcab[_0xac45('0x61')]));if(_0x5edcab[_0xac45('0x62')][_0xac45('0x63')]()==_0xac45('0x64')&&_['startsWith'](_0x5edcab[_0xac45('0x61')][_0xac45('0x63')](),'cdr')){var _0x25c38b=_0x5edcab[_0xac45('0x61')][_0xac45('0x65')]('=');var _0xe799be=_0x25c38b[0x0][_0xac45('0x66')](_0x25c38b[0x0]['lastIndexOf']('(')+0x1,_0x25c38b[0x0][_0xac45('0x67')](')'));var _0x2f82c0=_0x25c38b[0x1];channels[_0x5edcab[_0xac45('0x7')]][_0xe799be]=_0x2f82c0;}if(!_[_0xac45('0x68')]([_0xac45('0x69'),_0xac45('0x6a'),_0xac45('0x6b'),'set',_0xac45('0x6c')],_0x5edcab[_0xac45('0x62')]['toLowerCase']())){channels[_0x5edcab[_0xac45('0x7')]][_0xac45('0x54')]=_0x5edcab[_0xac45('0x62')];channels[_0x5edcab[_0xac45('0x7')]][_0xac45('0x6d')]=_0x5edcab[_0xac45('0x61')];}}}catch(_0x19b4b0){utils[_0xac45('0x2b')](util[_0xac45('0x5')](_0xac45('0x5f'),_0x5edcab[_0xac45('0x7')]),_0x19b4b0);}}; \ No newline at end of file +var _0xe578=['FAILED','ANSWERED','BUSY','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','transfer','destinationchannel','disposition','toNumber','[%s][calls][hangup]','callerid','info','cause-txt','duration','diffTime','starttime','billableseconds','answertime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','variable','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','hangup','noop','gotoif','lodash','util','./utils','NO\x20ANSWER'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xe578,0x1a4));var _0x8e57=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe578[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x8e57('0x0'));var util=require(_0x8e57('0x1'));var utils=require(_0x8e57('0x2'));var dispositions=[_0x8e57('0x3'),_0x8e57('0x4'),_0x8e57('0x4'),_0x8e57('0x3'),_0x8e57('0x3'),_0x8e57('0x3'),_0x8e57('0x5'),_0x8e57('0x6'),'FAILED','FAILED',_0x8e57('0x4')];var channels={};function writeDB(_0x30a379){utils['info'](util[_0x8e57('0x7')](_0x8e57('0x8'),_0x30a379[_0x8e57('0x9')],_0x30a379[_0x8e57('0xa')],_0x30a379[_0x8e57('0xb')],_0x30a379[_0x8e57('0xc')],_0x30a379[_0x8e57('0xd')],_0x30a379[_0x8e57('0xe')],_0x30a379['connectedlinenum'],_0x30a379['lastevent']));if(_0x30a379['accountcode']){utils[_0x8e57('0xf')](_0x30a379[_0x8e57('0x10')])[_0x8e57('0x11')](function(_0x170bdd){if(_0x170bdd){_0x30a379[_0x8e57('0x12')]=_0x170bdd['id'];}utils[_0x8e57('0x13')](_0x8e57('0x14'),_0x30a379);});}else{utils['request']('CreateVoiceCallReport',_0x30a379);}if(channels[_0x30a379[_0x8e57('0x9')]]){delete channels[_0x30a379[_0x8e57('0x9')]];}}exports[_0x8e57('0x15')]=function(_0x323238){try{utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x17'),_0x323238[_0x8e57('0x9')]),_0x323238);if(_0x323238[_0x8e57('0x9')]==_0x323238[_0x8e57('0x18')]&&_0x323238[_0x8e57('0xa')]!=_0x8e57('0x19')){utils['info'](util[_0x8e57('0x7')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x323238[_0x8e57('0x9')],_0x323238['context'],_0x323238['exten']));channels[_0x323238[_0x8e57('0x9')]]={'uniqueid':_0x323238[_0x8e57('0x9')],'accountcode':_0x323238['accountcode'],'source':_0x323238[_0x8e57('0xe')],'destination':_0x323238[_0x8e57('0x1a')],'destinationcontext':_0x323238['context'],'channel':_0x323238[_0x8e57('0xa')],'starttime':utils[_0x8e57('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x8e57('0x3'),'amaflags':_0x8e57('0x1c')};}}catch(_0x3993d7){utils[_0x8e57('0x1d')](util[_0x8e57('0x7')](_0x8e57('0x17'),_0x323238[_0x8e57('0x9')]),_0x3993d7);}};exports[_0x8e57('0x1e')]=function(_0x257695){try{utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x1f'),_0x257695[_0x8e57('0x9')]),_0x257695);if(!_[_0x8e57('0x20')](channels[_0x257695['uniqueid']])&&_0x257695[_0x8e57('0x21')]==0x6){utils['info'](util[_0x8e57('0x7')](_0x8e57('0x22'),_0x257695[_0x8e57('0x9')],_0x257695[_0x8e57('0x23')],_0x257695[_0x8e57('0xa')]));if(_[_0x8e57('0x20')](channels[_0x257695['uniqueid']][_0x8e57('0x24')])){channels[_0x257695['uniqueid']]['systemanswertime']=utils['now']();}}else if(!_[_0x8e57('0x20')](channels[_0x257695[_0x8e57('0x18')]])&&_0x257695['channelstate']==0x6&&_0x257695['context']!=_0x8e57('0x25')){utils['info'](util[_0x8e57('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x257695[_0x8e57('0x9')],_0x257695[_0x8e57('0x18')],_0x257695[_0x8e57('0x23')],_0x257695['channel']));channels[_0x257695[_0x8e57('0x18')]][_0x8e57('0x10')]=_0x257695['accountcode'];channels[_0x257695['linkedid']][_0x8e57('0x26')]=_0x257695[_0x8e57('0xa')];if(_[_0x8e57('0x20')](channels[_0x257695[_0x8e57('0x18')]]['answertime'])){channels[_0x257695[_0x8e57('0x18')]]['answertime']=utils[_0x8e57('0x1b')]();}channels[_0x257695[_0x8e57('0x18')]][_0x8e57('0x27')]=dispositions[_[_0x8e57('0x28')](_0x257695['channelstate'])]||'ANSWERED';}}catch(_0xfa55b2){utils[_0x8e57('0x1d')](util['format']('[%s][calls][newstate]',_0x257695[_0x8e57('0x9')]),_0xfa55b2);}};exports['hangup']=function(_0x3d840d){try{if(!_[_0x8e57('0x20')](channels[_0x3d840d[_0x8e57('0x9')]])){utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x29'),_0x3d840d[_0x8e57('0x9')]),_0x3d840d);if(_['isNil'](channels[_0x3d840d[_0x8e57('0x9')]][_0x8e57('0x2a')])){channels[_0x3d840d[_0x8e57('0x9')]][_0x8e57('0x2a')]=_0x3d840d['calleridname']+'\x20<'+_0x3d840d[_0x8e57('0xe')]+'>';}utils[_0x8e57('0x2b')](util[_0x8e57('0x7')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3d840d['uniqueid'],channels[_0x3d840d[_0x8e57('0x9')]][_0x8e57('0x2a')],_0x3d840d[_0x8e57('0x2c')]));channels[_0x3d840d['uniqueid']]['endtime']=utils[_0x8e57('0x1b')]();channels[_0x3d840d[_0x8e57('0x9')]][_0x8e57('0x2d')]=utils[_0x8e57('0x2e')](channels[_0x3d840d['uniqueid']]['endtime'],channels[_0x3d840d['uniqueid']][_0x8e57('0x2f')]);channels[_0x3d840d[_0x8e57('0x9')]][_0x8e57('0x30')]=channels[_0x3d840d[_0x8e57('0x9')]]['answertime']?utils['diffTime'](channels[_0x3d840d[_0x8e57('0x9')]]['endtime'],channels[_0x3d840d[_0x8e57('0x9')]][_0x8e57('0x31')]):0x0;writeDB(channels[_0x3d840d[_0x8e57('0x9')]]);}}catch(_0x10ca25){utils[_0x8e57('0x1d')](util[_0x8e57('0x7')]('[%s][calls][hangup]',_0x3d840d[_0x8e57('0x9')]),_0x10ca25);}};exports['attendedtransfer']=function(_0x3435bb){try{if(!_[_0x8e57('0x20')](channels[_0x3435bb[_0x8e57('0x32')]])){utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x33'),_0x3435bb[_0x8e57('0x34')]),_0x3435bb);if(channels[_0x3435bb[_0x8e57('0x32')]][_0x8e57('0xa')]==_0x3435bb[_0x8e57('0x35')]){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x36'),_0x3435bb[_0x8e57('0x34')],_0x3435bb[_0x8e57('0x32')],_0x3435bb['secondtransfererchannel']));channels[_0x3435bb[_0x8e57('0x32')]]['destinationchannel']=_0x3435bb[_0x8e57('0x37')];channels[_0x3435bb[_0x8e57('0x32')]]['userfield']=_0x8e57('0x38');}else if(channels[_0x3435bb[_0x8e57('0x32')]]['channel']=_0x3435bb[_0x8e57('0x39')]){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3435bb[_0x8e57('0x34')],_0x3435bb[_0x8e57('0x32')],_0x3435bb['origtransfererchannel']));channels[_0x3435bb[_0x8e57('0x32')]][_0x8e57('0x26')]=_0x3435bb['origtransfererchannel'];channels[_0x3435bb[_0x8e57('0x32')]][_0x8e57('0x3a')]='_attended';}}}catch(_0x198369){utils['error'](util[_0x8e57('0x7')](_0x8e57('0x33'),_0x3435bb[_0x8e57('0x34')]),_0x198369);}};exports[_0x8e57('0x3b')]=function(_0x2d20be){try{if(!_['isNil'](channels[_0x2d20be[_0x8e57('0x9')]])){utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x3c'),_0x2d20be[_0x8e57('0x9')]),_0x2d20be);channels[_0x2d20be[_0x8e57('0x9')]][_0x8e57('0x3d')]=utils[_0x8e57('0x1b')]();utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x3e'),_0x2d20be[_0x8e57('0x9')],channels[_0x2d20be[_0x8e57('0x9')]][_0x8e57('0x3d')]));}}catch(_0x5e4d1b){utils[_0x8e57('0x1d')](util[_0x8e57('0x7')](_0x8e57('0x3c'),_0x2d20be['uniqueid']),_0x5e4d1b);}};exports[_0x8e57('0x3f')]=function(_0x1acd3a){try{if(!_[_0x8e57('0x20')](channels[_0x1acd3a[_0x8e57('0x9')]])){utils['debug'](util['format'](_0x8e57('0x40'),_0x1acd3a[_0x8e57('0x9')]),_0x1acd3a);if(!_[_0x8e57('0x20')](channels[_0x1acd3a[_0x8e57('0x9')]][_0x8e57('0x3d')])){channels[_0x1acd3a['uniqueid']][_0x8e57('0x41')]+=utils[_0x8e57('0x2e')](utils[_0x8e57('0x1b')](),channels[_0x1acd3a[_0x8e57('0x9')]][_0x8e57('0x3d')]);utils[_0x8e57('0x2b')](util['format'](_0x8e57('0x42'),_0x1acd3a[_0x8e57('0x9')],channels[_0x1acd3a[_0x8e57('0x9')]]['mohtime']));delete channels[_0x1acd3a[_0x8e57('0x9')]][_0x8e57('0x3d')];}}}catch(_0x45cfcb){utils['error'](util[_0x8e57('0x7')](_0x8e57('0x40'),_0x1acd3a[_0x8e57('0x9')]),_0x45cfcb);}};exports[_0x8e57('0x43')]=function(_0x2bb06e){try{if(!_['isNil'](channels[_0x2bb06e['uniqueid']])){utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x44'),_0x2bb06e['uniqueid']),_0x2bb06e);if(!_[_0x8e57('0x20')](_0x2bb06e['variable'][_0x8e57('0x45')])){utils['info'](util[_0x8e57('0x7')](_0x8e57('0x46'),_0x2bb06e[_0x8e57('0x9')],_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e['uniqueid']]['source']=_0x2bb06e[_0x8e57('0x47')];}if(!_[_0x8e57('0x20')](_0x2bb06e['variable'][_0x8e57('0x48')])){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x49'),_0x2bb06e[_0x8e57('0x9')],_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e[_0x8e57('0x9')]]['destination']=_0x2bb06e[_0x8e57('0x47')];channels[_0x2bb06e[_0x8e57('0x9')]][_0x8e57('0x2a')]='\x22'+_0x2bb06e[_0x8e57('0x47')]+_0x8e57('0x4a')+_0x2bb06e[_0x8e57('0x47')]+'>';}if(!_[_0x8e57('0x20')](_0x2bb06e[_0x8e57('0x4b')][_0x8e57('0x4c')])||!_[_0x8e57('0x20')](_0x2bb06e[_0x8e57('0x4b')]['xmd-callerid'])){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x4d'),_0x2bb06e[_0x8e57('0x9')],!_[_0x8e57('0x20')](_0x2bb06e[_0x8e57('0x4b')][_0x8e57('0x4c')])?_0x8e57('0x4c'):_0x8e57('0x4e'),_0x2bb06e['value']));channels[_0x2bb06e[_0x8e57('0x9')]]['callerid']=_0x2bb06e[_0x8e57('0x47')];}if(!_['isNil'](_0x2bb06e[_0x8e57('0x4b')]['xmd-queue'])||!_[_0x8e57('0x20')](_0x2bb06e[_0x8e57('0x4b')][_0x8e57('0x4f')])){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x4d'),_0x2bb06e[_0x8e57('0x9')],!_['isNil'](_0x2bb06e['variable'][_0x8e57('0x50')])?_0x8e57('0x50'):_0x8e57('0x4f'),_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e[_0x8e57('0x9')]][_0x8e57('0x51')]='Queue';channels[_0x2bb06e[_0x8e57('0x9')]][_0x8e57('0x52')]=_0x2bb06e[_0x8e57('0x47')];channels[_0x2bb06e['uniqueid']][_0x8e57('0xb')]=!![];}if(!_[_0x8e57('0x20')](_0x2bb06e[_0x8e57('0x4b')]['xmd-contactid'])){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x53'),_0x2bb06e['uniqueid'],_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e[_0x8e57('0x9')]]['ContactId']=_0x2bb06e[_0x8e57('0x47')];}if(!_[_0x8e57('0x20')](_0x2bb06e['variable'][_0x8e57('0x54')])){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x55'),_0x2bb06e[_0x8e57('0x9')],_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e[_0x8e57('0x9')]][_0x8e57('0x56')]=_0x2bb06e[_0x8e57('0x47')];}if(!_['isNil'](_0x2bb06e[_0x8e57('0x4b')][_0x8e57('0x57')])){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x58'),_0x2bb06e[_0x8e57('0x9')],_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e[_0x8e57('0x9')]][_0x8e57('0x59')]=_0x2bb06e[_0x8e57('0x47')];}if(!_[_0x8e57('0x20')](_0x2bb06e['variable'][_0x8e57('0x5a')])){utils['info'](util['format'](_0x8e57('0x5b'),_0x2bb06e[_0x8e57('0x9')],_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e[_0x8e57('0x9')]]['sipcallid']=_0x2bb06e[_0x8e57('0x47')];}}}catch(_0x5b0631){utils[_0x8e57('0x1d')](util['format'](_0x8e57('0x44'),_0x2bb06e[_0x8e57('0x9')]),_0x5b0631);}};exports[_0x8e57('0x5c')]=function(_0x910fc){try{if(!_[_0x8e57('0x20')](channels[_0x910fc[_0x8e57('0x9')]])){utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x5d'),_0x910fc[_0x8e57('0x9')]),_0x910fc);utils[_0x8e57('0x2b')](util[_0x8e57('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x910fc[_0x8e57('0x9')],_0x910fc[_0x8e57('0x5e')],_0x910fc[_0x8e57('0x5f')]));if(_0x910fc['application'][_0x8e57('0x60')]()==_0x8e57('0x61')&&_[_0x8e57('0x62')](_0x910fc['appdata'][_0x8e57('0x60')](),'cdr')){var _0x3496d9=_0x910fc[_0x8e57('0x5f')][_0x8e57('0x63')]('=');var _0x1799d6=_0x3496d9[0x0][_0x8e57('0x64')](_0x3496d9[0x0][_0x8e57('0x65')]('(')+0x1,_0x3496d9[0x0][_0x8e57('0x65')](')'));var _0x448ec6=_0x3496d9[0x1];channels[_0x910fc['uniqueid']][_0x1799d6]=_0x448ec6;}if(!_[_0x8e57('0x66')]([_0x8e57('0x67'),_0x8e57('0x68'),'execif',_0x8e57('0x61'),_0x8e57('0x69')],_0x910fc[_0x8e57('0x5e')][_0x8e57('0x60')]())){channels[_0x910fc[_0x8e57('0x9')]][_0x8e57('0x51')]=_0x910fc['application'];channels[_0x910fc['uniqueid']]['lastdata']=_0x910fc[_0x8e57('0x5f')];}}}catch(_0x3d9de8){utils[_0x8e57('0x1d')](util[_0x8e57('0x7')](_0x8e57('0x5d'),_0x910fc['uniqueid']),_0x3d9de8);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index e98ad5c..077b28d 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 _0x7ca7=['error','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0x7ca7,0x18f));var _0x77ca=function(_0x3d2012,_0x3d02b9){_0x3d2012=_0x3d2012-0x0;var _0x53d542=_0x7ca7[_0x3d2012];return _0x53d542;};'use strict';var utils=require(_0x77ca('0x0'));exports['connect']=function(){utils[_0x77ca('0x1')](_0x77ca('0x2'));};exports[_0x77ca('0x3')]=function(){utils['info'](_0x77ca('0x4'));};exports[_0x77ca('0x5')]=function(){utils[_0x77ca('0x1')]('[core]\x20fullybooted');};exports[_0x77ca('0x6')]=function(_0x23e6f4){utils[_0x77ca('0x6')]('[core]\x20error',_0x23e6f4);};exports['close']=function(){utils[_0x77ca('0x1')](_0x77ca('0x7'));};exports[_0x77ca('0x8')]=function(_0x3f3281){}; \ No newline at end of file +var _0x4790=['fullybooted','error','close','managerevent','./utils','connect','info','shutdown','[core]\x20shutdown'];(function(_0x2cf63a,_0x15d7ae){var _0x21cd67=function(_0x66d99f){while(--_0x66d99f){_0x2cf63a['push'](_0x2cf63a['shift']());}};_0x21cd67(++_0x15d7ae);}(_0x4790,0x1ab));var _0x0479=function(_0x500812,_0x296a3c){_0x500812=_0x500812-0x0;var _0x4add02=_0x4790[_0x500812];return _0x4add02;};'use strict';var utils=require(_0x0479('0x0'));exports[_0x0479('0x1')]=function(){utils[_0x0479('0x2')]('[core]\x20connected');};exports[_0x0479('0x3')]=function(){utils['info'](_0x0479('0x4'));};exports[_0x0479('0x5')]=function(){utils[_0x0479('0x2')]('[core]\x20fullybooted');};exports[_0x0479('0x6')]=function(_0x10423e){utils[_0x0479('0x6')]('[core]\x20error',_0x10423e);};exports[_0x0479('0x7')]=function(){utils[_0x0479('0x2')]('[core]\x20close');};exports[_0x0479('0x8')]=function(_0x13b150){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 10ba65e..4187202 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 _0x711c=['startsWith','appdata','cdr(routeid)','split','error','[%s][dials][varset]','isNil','value','starttime','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','lastevent','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','assign','now','duration','diffTime','endtime','holdtime','answertime','billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','dialstatus','CreateVoiceDialReport','uniqueid','newexten','debug','format','application','toLowerCase','set'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x711c,0x167));var _0xc711=function(_0x9b0539,_0x286e12){_0x9b0539=_0x9b0539-0x0;var _0x5b0350=_0x711c[_0x9b0539];return _0x5b0350;};'use strict';var _=require(_0xc711('0x0'));var util=require(_0xc711('0x1'));var utils=require(_0xc711('0x2'));var dials={};function writeDB(_0x511eb0){utils[_0xc711('0x3')](util['format'](_0xc711('0x4'),_0x511eb0['uniqueid'],_0x511eb0[_0xc711('0x5')],_0x511eb0[_0xc711('0x6')],_0x511eb0[_0xc711('0x7')],_0x511eb0['connectedlinenum'],_0x511eb0[_0xc711('0x8')]));utils['request'](_0xc711('0x9'),_0x511eb0);delete dials[_0x511eb0[_0xc711('0xa')]];}exports[_0xc711('0xb')]=function(_0x1c8182){try{utils[_0xc711('0xc')](util['format']('[%s][dials][newexten]',_0x1c8182[_0xc711('0xa')]),_0x1c8182);utils['info'](util[_0xc711('0xd')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1c8182[_0xc711('0xa')],_0x1c8182['application'],_0x1c8182['appdata']));if(_0x1c8182[_0xc711('0xe')][_0xc711('0xf')]()==_0xc711('0x10')&&_[_0xc711('0x11')](_0x1c8182[_0xc711('0x12')][_0xc711('0xf')](),_0xc711('0x13'))){var _0x56a91c=_0x1c8182[_0xc711('0x12')][_0xc711('0x14')]('=');dials[_0x1c8182[_0xc711('0xa')]]={'routeId':_0x56a91c[0x1]};}}catch(_0x5453f0){utils[_0xc711('0x15')](util[_0xc711('0xd')]('[%s][dials][newexten]',_0x1c8182['uniqueid']),_0x5453f0);}};exports['varset']=function(_0x35fe8d){try{utils['debug'](util[_0xc711('0xd')](_0xc711('0x16'),_0x35fe8d[_0xc711('0xa')]),_0x35fe8d);if(!_[_0xc711('0x17')](_0x35fe8d['variable']['outboundrouteid'])){utils[_0xc711('0x3')](util[_0xc711('0xd')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x35fe8d[_0xc711('0xa')],_0x35fe8d[_0xc711('0x18')]));dials[_0x35fe8d[_0xc711('0xa')]]={'routeId':_0x35fe8d[_0xc711('0x18')]};}}catch(_0x271f0f){utils[_0xc711('0x15')](util[_0xc711('0xd')](_0xc711('0x16'),_0x35fe8d['uniqueid']),_0x271f0f);}};exports['dialbegin']=function(_0xcffa58){try{if(!_['isNil'](dials[_0xcffa58['uniqueid']])){utils[_0xc711('0xc')](util[_0xc711('0xd')]('[%s][dials][dialbegin]',_0xcffa58[_0xc711('0xa')]),_0xcffa58);dials[_0xcffa58['uniqueid']]=_['assign'](dials[_0xcffa58['uniqueid']],_0xcffa58);dials[_0xcffa58['uniqueid']][_0xc711('0x19')]=utils['now']();dials[_0xcffa58[_0xc711('0xa')]]['lastevent']=_0xc711('0x1a');utils[_0xc711('0x3')](util[_0xc711('0xd')](_0xc711('0x1b'),_0xcffa58[_0xc711('0xa')],dials[_0xcffa58[_0xc711('0xa')]][_0xc711('0x19')]));}}catch(_0x3908ed){utils[_0xc711('0x15')](util[_0xc711('0xd')](_0xc711('0x1c'),_0xcffa58[_0xc711('0xa')]),_0x3908ed);}};exports[_0xc711('0x1d')]=function(_0x17136b){try{if(!_[_0xc711('0x17')](dials[_0x17136b['uniqueid']])){utils[_0xc711('0xc')](util['format'](_0xc711('0x1e'),_0x17136b[_0xc711('0xa')]),_0x17136b);dials[_0x17136b[_0xc711('0xa')]]['dialstatus']=_0x17136b[_0xc711('0x8')];if(_0x17136b[_0xc711('0x8')]==_0xc711('0x1f')){dials[_0x17136b[_0xc711('0xa')]]=_['assign'](dials[_0x17136b[_0xc711('0xa')]],_0x17136b);dials[_0x17136b['uniqueid']]['answertime']=utils['now']();dials[_0x17136b[_0xc711('0xa')]][_0xc711('0x20')]='connect';utils[_0xc711('0x3')](util[_0xc711('0xd')](_0xc711('0x21'),_0x17136b[_0xc711('0xa')],_0x17136b[_0xc711('0x8')],dials[_0x17136b[_0xc711('0xa')]]['answertime']));}else{utils[_0xc711('0x3')](util['format'](_0xc711('0x22'),_0x17136b[_0xc711('0xa')],_0x17136b['dialstatus']));}}}catch(_0x3ce408){utils['error'](util[_0xc711('0xd')](_0xc711('0x1e'),_0x17136b['uniqueid']),_0x3ce408);}};exports[_0xc711('0x23')]=function(_0x4513d4){try{if(!_[_0xc711('0x17')](dials[_0x4513d4['uniqueid']])){utils[_0xc711('0xc')](util[_0xc711('0xd')](_0xc711('0x24'),_0x4513d4[_0xc711('0xa')]),_0x4513d4);utils[_0xc711('0x3')](util[_0xc711('0xd')](_0xc711('0x25'),_0x4513d4['uniqueid'],_0x4513d4[_0xc711('0x7')],_0x4513d4['calleridname'],_0x4513d4[_0xc711('0x26')]));dials[_0x4513d4['uniqueid']]=_[_0xc711('0x27')](dials[_0x4513d4[_0xc711('0xa')]],{'endtime':utils[_0xc711('0x28')](),'lastevent':'complete'});dials[_0x4513d4[_0xc711('0xa')]][_0xc711('0x29')]=utils[_0xc711('0x2a')](dials[_0x4513d4[_0xc711('0xa')]][_0xc711('0x2b')],dials[_0x4513d4[_0xc711('0xa')]][_0xc711('0x19')]);dials[_0x4513d4[_0xc711('0xa')]][_0xc711('0x2c')]=utils[_0xc711('0x2a')](dials[_0x4513d4['uniqueid']][_0xc711('0x2d')]||dials[_0x4513d4['uniqueid']]['endtime'],dials[_0x4513d4[_0xc711('0xa')]][_0xc711('0x19')]);dials[_0x4513d4[_0xc711('0xa')]][_0xc711('0x2e')]=dials[_0x4513d4[_0xc711('0xa')]][_0xc711('0x2d')]?utils[_0xc711('0x2a')](dials[_0x4513d4['uniqueid']]['endtime'],dials[_0x4513d4['uniqueid']][_0xc711('0x2d')]):0x0;writeDB(dials[_0x4513d4[_0xc711('0xa')]]);}}catch(_0x1fbea5){utils[_0xc711('0x15')](util[_0xc711('0xd')](_0xc711('0x24'),_0x4513d4[_0xc711('0xa')]),_0x1fbea5);}}; \ No newline at end of file +var _0xb0f1=['./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','debug','[%s][dials][dialbegin]','starttime','now','called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','duration','diffTime','holdtime','endtime','billableseconds','util'];(function(_0x5807cf,_0x49db95){var _0x2cb538=function(_0x23de11){while(--_0x23de11){_0x5807cf['push'](_0x5807cf['shift']());}};_0x2cb538(++_0x49db95);}(_0xb0f1,0x15d));var _0x1b0f=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb0f1[_0x34bc30];return _0x5706de;};'use strict';var _=require('lodash');var util=require(_0x1b0f('0x0'));var utils=require(_0x1b0f('0x1'));var dials={};function writeDB(_0x209363){utils[_0x1b0f('0x2')](util[_0x1b0f('0x3')](_0x1b0f('0x4'),_0x209363[_0x1b0f('0x5')],_0x209363[_0x1b0f('0x6')],_0x209363[_0x1b0f('0x7')],_0x209363[_0x1b0f('0x8')],_0x209363[_0x1b0f('0x9')],_0x209363[_0x1b0f('0xa')]));utils['request'](_0x1b0f('0xb'),_0x209363);delete dials[_0x209363[_0x1b0f('0x5')]];}exports['newexten']=function(_0x15c697){try{utils['debug'](util['format'](_0x1b0f('0xc'),_0x15c697[_0x1b0f('0x5')]),_0x15c697);utils['info'](util[_0x1b0f('0x3')](_0x1b0f('0xd'),_0x15c697[_0x1b0f('0x5')],_0x15c697[_0x1b0f('0xe')],_0x15c697[_0x1b0f('0xf')]));if(_0x15c697[_0x1b0f('0xe')][_0x1b0f('0x10')]()=='set'&&_[_0x1b0f('0x11')](_0x15c697[_0x1b0f('0xf')][_0x1b0f('0x10')](),_0x1b0f('0x12'))){var _0x21207f=_0x15c697[_0x1b0f('0xf')][_0x1b0f('0x13')]('=');dials[_0x15c697['uniqueid']]={'routeId':_0x21207f[0x1]};}}catch(_0x4f253e){utils[_0x1b0f('0x14')](util[_0x1b0f('0x3')]('[%s][dials][newexten]',_0x15c697['uniqueid']),_0x4f253e);}};exports[_0x1b0f('0x15')]=function(_0x11c5b6){try{utils['debug'](util['format'](_0x1b0f('0x16'),_0x11c5b6['uniqueid']),_0x11c5b6);if(!_['isNil'](_0x11c5b6['variable']['outboundrouteid'])){utils[_0x1b0f('0x2')](util[_0x1b0f('0x3')](_0x1b0f('0x17'),_0x11c5b6['uniqueid'],_0x11c5b6[_0x1b0f('0x18')]));dials[_0x11c5b6['uniqueid']]={'routeId':_0x11c5b6['value']};}}catch(_0x2c8df7){utils['error'](util[_0x1b0f('0x3')](_0x1b0f('0x16'),_0x11c5b6[_0x1b0f('0x5')]),_0x2c8df7);}};exports[_0x1b0f('0x19')]=function(_0x1156bb){try{if(!_[_0x1b0f('0x1a')](dials[_0x1156bb['uniqueid']])){utils[_0x1b0f('0x1b')](util[_0x1b0f('0x3')](_0x1b0f('0x1c'),_0x1156bb['uniqueid']),_0x1156bb);dials[_0x1156bb[_0x1b0f('0x5')]]=_['assign'](dials[_0x1156bb[_0x1b0f('0x5')]],_0x1156bb);dials[_0x1156bb[_0x1b0f('0x5')]][_0x1b0f('0x1d')]=utils[_0x1b0f('0x1e')]();dials[_0x1156bb[_0x1b0f('0x5')]]['lastevent']=_0x1b0f('0x1f');utils[_0x1b0f('0x2')](util[_0x1b0f('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x1156bb[_0x1b0f('0x5')],dials[_0x1156bb['uniqueid']]['starttime']));}}catch(_0x53a098){utils[_0x1b0f('0x14')](util[_0x1b0f('0x3')](_0x1b0f('0x1c'),_0x1156bb[_0x1b0f('0x5')]),_0x53a098);}};exports[_0x1b0f('0x20')]=function(_0x460854){try{if(!_[_0x1b0f('0x1a')](dials[_0x460854['uniqueid']])){utils['debug'](util['format'](_0x1b0f('0x21'),_0x460854[_0x1b0f('0x5')]),_0x460854);dials[_0x460854[_0x1b0f('0x5')]][_0x1b0f('0xa')]=_0x460854['dialstatus'];if(_0x460854[_0x1b0f('0xa')]==_0x1b0f('0x22')){dials[_0x460854[_0x1b0f('0x5')]]=_[_0x1b0f('0x23')](dials[_0x460854[_0x1b0f('0x5')]],_0x460854);dials[_0x460854['uniqueid']][_0x1b0f('0x24')]=utils[_0x1b0f('0x1e')]();dials[_0x460854[_0x1b0f('0x5')]][_0x1b0f('0x25')]=_0x1b0f('0x26');utils[_0x1b0f('0x2')](util[_0x1b0f('0x3')](_0x1b0f('0x27'),_0x460854[_0x1b0f('0x5')],_0x460854[_0x1b0f('0xa')],dials[_0x460854[_0x1b0f('0x5')]][_0x1b0f('0x24')]));}else{utils[_0x1b0f('0x2')](util[_0x1b0f('0x3')](_0x1b0f('0x28'),_0x460854[_0x1b0f('0x5')],_0x460854[_0x1b0f('0xa')]));}}}catch(_0x157f39){utils[_0x1b0f('0x14')](util[_0x1b0f('0x3')](_0x1b0f('0x21'),_0x460854[_0x1b0f('0x5')]),_0x157f39);}};exports[_0x1b0f('0x29')]=function(_0x3675f3){try{if(!_['isNil'](dials[_0x3675f3[_0x1b0f('0x5')]])){utils[_0x1b0f('0x1b')](util[_0x1b0f('0x3')](_0x1b0f('0x2a'),_0x3675f3[_0x1b0f('0x5')]),_0x3675f3);utils['info'](util[_0x1b0f('0x3')](_0x1b0f('0x2b'),_0x3675f3[_0x1b0f('0x5')],_0x3675f3[_0x1b0f('0x8')],_0x3675f3[_0x1b0f('0x2c')],_0x3675f3['cause-txt']));dials[_0x3675f3['uniqueid']]=_['assign'](dials[_0x3675f3[_0x1b0f('0x5')]],{'endtime':utils[_0x1b0f('0x1e')](),'lastevent':'complete'});dials[_0x3675f3[_0x1b0f('0x5')]][_0x1b0f('0x2d')]=utils[_0x1b0f('0x2e')](dials[_0x3675f3['uniqueid']]['endtime'],dials[_0x3675f3['uniqueid']]['starttime']);dials[_0x3675f3[_0x1b0f('0x5')]][_0x1b0f('0x2f')]=utils[_0x1b0f('0x2e')](dials[_0x3675f3['uniqueid']][_0x1b0f('0x24')]||dials[_0x3675f3[_0x1b0f('0x5')]][_0x1b0f('0x30')],dials[_0x3675f3[_0x1b0f('0x5')]][_0x1b0f('0x1d')]);dials[_0x3675f3['uniqueid']][_0x1b0f('0x31')]=dials[_0x3675f3[_0x1b0f('0x5')]]['answertime']?utils[_0x1b0f('0x2e')](dials[_0x3675f3['uniqueid']][_0x1b0f('0x30')],dials[_0x3675f3['uniqueid']][_0x1b0f('0x24')]):0x0;writeDB(dials[_0x3675f3['uniqueid']]);}}catch(_0x2dca07){utils[_0x1b0f('0x14')](util[_0x1b0f('0x3')]('[%s][dials][hangup]',_0x3675f3[_0x1b0f('0x5')]),_0x2dca07);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 2ea04d5..6e6ec16 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 _0x9d51=['agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username','keepConnected','xdr','disabled','XDR\x20DISABLED','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]'];(function(_0x387f22,_0xcc7378){var _0x20f675=function(_0x5088b){while(--_0x5088b){_0x387f22['push'](_0x387f22['shift']());}};_0x20f675(++_0xcc7378);}(_0x9d51,0x125));var _0x19d5=function(_0x47a162,_0x1b7ecc){_0x47a162=_0x47a162-0x0;var _0x123b79=_0x9d51[_0x47a162];return _0x123b79;};var AsteriskManager=require(_0x19d5('0x0'));var config=require(_0x19d5('0x1'));var utils=require(_0x19d5('0x2'));var util=require(_0x19d5('0x3'));var ami=new AsteriskManager(config[_0x19d5('0x4')][_0x19d5('0x5')],config[_0x19d5('0x4')]['ip'],config[_0x19d5('0x4')][_0x19d5('0x6')],config[_0x19d5('0x4')]['password'],!![]);ami[_0x19d5('0x7')]();if(config[_0x19d5('0x8')]&&config[_0x19d5('0x8')][_0x19d5('0x9')]){utils['info'](_0x19d5('0xa'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x19d5('0xb'));var recordings=require(_0x19d5('0xc'));var members=require('./members.controller');var dials=require(_0x19d5('0xd'));var transfers=require(_0x19d5('0xe'));var core=require(_0x19d5('0xf'));ami['on'](_0x19d5('0x10'),core[_0x19d5('0x10')]);ami['on'](_0x19d5('0x11'),core[_0x19d5('0x11')]);ami['on'](_0x19d5('0x12'),core[_0x19d5('0x12')]);ami['on'](_0x19d5('0x13'),core[_0x19d5('0x13')]);ami['on'](_0x19d5('0x14'),core[_0x19d5('0x14')]);ami['on'](_0x19d5('0x15'),core[_0x19d5('0x15')]);ami['on'](_0x19d5('0x16'),function(_0x409e3a){try{utils[_0x19d5('0x17')](util[_0x19d5('0x18')](_0x19d5('0x19'),_0x409e3a[_0x19d5('0x1a')]),_0x409e3a);members['devicestatechange'](_0x409e3a);}catch(_0x5517e4){utils[_0x19d5('0x13')](util[_0x19d5('0x18')](_0x19d5('0x19'),_0x409e3a[_0x19d5('0x1a')]),_0x5517e4);}});ami['on']('agentcalled',function(_0x361efb){try{utils['debug'](util['format'](_0x19d5('0x1b'),_0x361efb[_0x19d5('0x1c')]),_0x361efb);agents[_0x19d5('0x1d')](_0x361efb);}catch(_0x57ad6a){utils[_0x19d5('0x13')](util[_0x19d5('0x18')](_0x19d5('0x1b'),_0x361efb[_0x19d5('0x1c')]),_0x57ad6a);}});ami['on'](_0x19d5('0x1e'),function(_0xde17fd){try{utils[_0x19d5('0x17')](util[_0x19d5('0x18')](_0x19d5('0x1f'),_0xde17fd[_0x19d5('0x1c')]),_0xde17fd);agents[_0x19d5('0x1e')](_0xde17fd);}catch(_0x52f02d){utils[_0x19d5('0x13')](util[_0x19d5('0x18')](_0x19d5('0x1f'),_0xde17fd[_0x19d5('0x1c')]),_0x52f02d);}});ami['on'](_0x19d5('0x20'),function(_0xf54e08){try{utils[_0x19d5('0x17')](util[_0x19d5('0x18')](_0x19d5('0x21'),_0xf54e08[_0x19d5('0x1c')]),_0xf54e08);agents[_0x19d5('0x20')](_0xf54e08);queues[_0x19d5('0x20')](_0xf54e08);}catch(_0x416793){utils[_0x19d5('0x13')](util[_0x19d5('0x18')](_0x19d5('0x21'),_0xf54e08[_0x19d5('0x1c')]),_0x416793);}});ami['on'](_0x19d5('0x22'),function(_0x3a46c8){try{utils[_0x19d5('0x17')](util[_0x19d5('0x18')](_0x19d5('0x23'),_0x3a46c8['uniqueid']),_0x3a46c8);agents[_0x19d5('0x22')](_0x3a46c8);queues[_0x19d5('0x22')](_0x3a46c8);members[_0x19d5('0x22')](_0x3a46c8);}catch(_0x17a362){utils['error'](util[_0x19d5('0x18')](_0x19d5('0x23'),_0x3a46c8[_0x19d5('0x1c')]),_0x17a362);}});ami['on'](_0x19d5('0x24'),function(_0x42194b){try{utils['debug'](util[_0x19d5('0x18')](_0x19d5('0x25'),_0x42194b['uniqueid']),_0x42194b);agents['queuecallerabandon'](_0x42194b);queues[_0x19d5('0x24')](_0x42194b);}catch(_0x5506df){utils['error'](util['format'](_0x19d5('0x25'),_0x42194b[_0x19d5('0x1c')]),_0x5506df);}});ami['on'](_0x19d5('0x26'),function(_0x47b81d){try{utils[_0x19d5('0x17')](util[_0x19d5('0x18')]('[%s][index][queuecallerjoin]',_0x47b81d[_0x19d5('0x1c')]),_0x47b81d);queues[_0x19d5('0x26')](_0x47b81d);recordings['queuecallerjoin'](_0x47b81d);}catch(_0x895c16){utils[_0x19d5('0x13')](util[_0x19d5('0x18')](_0x19d5('0x27'),_0x47b81d['uniqueid']),_0x895c16);}});ami['on']('queuecallerleave',function(_0x200cf6){try{utils['debug'](util[_0x19d5('0x18')](_0x19d5('0x28'),_0x200cf6['uniqueid']),_0x200cf6);queues[_0x19d5('0x29')](_0x200cf6);}catch(_0x46e0bf){utils['error'](util['format'](_0x19d5('0x28'),_0x200cf6[_0x19d5('0x1c')]),_0x46e0bf);}});ami['on'](_0x19d5('0x2a'),function(_0x55f92e){try{utils[_0x19d5('0x17')](util['format']('[%s][index][musiconholdstart]',_0x55f92e[_0x19d5('0x1c')]),_0x55f92e);queues[_0x19d5('0x2a')](_0x55f92e);calls[_0x19d5('0x2a')](_0x55f92e);}catch(_0x56b73f){utils[_0x19d5('0x13')](util[_0x19d5('0x18')]('[%s][index][musiconholdstart]',_0x55f92e[_0x19d5('0x1c')]),_0x56b73f);}});ami['on']('musiconholdstop',function(_0xf41679){try{utils['debug'](util['format'](_0x19d5('0x2b'),_0xf41679[_0x19d5('0x1c')]),_0xf41679);queues['musiconholdstop'](_0xf41679);calls['musiconholdstop'](_0xf41679);}catch(_0x248eae){utils[_0x19d5('0x13')](util[_0x19d5('0x18')](_0x19d5('0x2b'),_0xf41679[_0x19d5('0x1c')]),_0x248eae);}});ami['on']('newstate',function(_0x5b234a){try{utils[_0x19d5('0x17')](util['format'](_0x19d5('0x2c'),_0x5b234a[_0x19d5('0x1c')]),_0x5b234a);calls[_0x19d5('0x2d')](_0x5b234a);recordings[_0x19d5('0x2d')](_0x5b234a);}catch(_0xf94dbc){utils[_0x19d5('0x13')](util[_0x19d5('0x18')]('[%s][index][newstate]',_0x5b234a['uniqueid']),_0xf94dbc);}});ami['on'](_0x19d5('0x2e'),function(_0x58d021){try{utils['debug'](util[_0x19d5('0x18')](_0x19d5('0x2f'),_0x58d021['uniqueid']),_0x58d021);calls[_0x19d5('0x2e')](_0x58d021);recordings[_0x19d5('0x2e')](_0x58d021);dials[_0x19d5('0x2e')](_0x58d021);agents[_0x19d5('0x2e')](_0x58d021);queues[_0x19d5('0x2e')](_0x58d021);}catch(_0x59f3e3){utils[_0x19d5('0x13')](util[_0x19d5('0x18')](_0x19d5('0x2f'),_0x58d021[_0x19d5('0x1c')]),_0x59f3e3);}});ami['on'](_0x19d5('0x30'),function(_0x44bbb5){try{utils[_0x19d5('0x17')](util[_0x19d5('0x18')](_0x19d5('0x31'),_0x44bbb5[_0x19d5('0x1c')]),_0x44bbb5);members[_0x19d5('0x30')](_0x44bbb5);}catch(_0xcbb8e7){utils[_0x19d5('0x13')](util[_0x19d5('0x18')](_0x19d5('0x31'),_0x44bbb5[_0x19d5('0x1c')]),_0xcbb8e7);}});ami['on'](_0x19d5('0x32'),function(_0x3a3dfd){try{utils['debug'](util[_0x19d5('0x18')](_0x19d5('0x33'),_0x3a3dfd[_0x19d5('0x1c')]),_0x3a3dfd);queues['blindtransfer'](_0x3a3dfd);agents[_0x19d5('0x32')](_0x3a3dfd);transfers['blindtransfer'](_0x3a3dfd);}catch(_0x59da7b){utils[_0x19d5('0x13')](util['format'](_0x19d5('0x33'),_0x3a3dfd[_0x19d5('0x1c')]),_0x59da7b);}});ami['on'](_0x19d5('0x34'),function(_0x39a77a){try{utils[_0x19d5('0x17')](util[_0x19d5('0x18')](_0x19d5('0x35'),_0x39a77a[_0x19d5('0x36')]),_0x39a77a);queues[_0x19d5('0x34')](_0x39a77a);transfers[_0x19d5('0x34')](_0x39a77a);agents[_0x19d5('0x34')](_0x39a77a);calls[_0x19d5('0x34')](_0x39a77a);}catch(_0x348b10){utils[_0x19d5('0x13')](util['format'](_0x19d5('0x35'),_0x39a77a[_0x19d5('0x36')]),_0x348b10);}});ami['on'](_0x19d5('0x37'),function(_0xdc86bc){try{utils['debug'](util[_0x19d5('0x18')](_0x19d5('0x38'),_0xdc86bc[_0x19d5('0x1c')]),_0xdc86bc);queues['varset'](_0xdc86bc);recordings['varset'](_0xdc86bc);calls[_0x19d5('0x37')](_0xdc86bc);dials[_0x19d5('0x37')](_0xdc86bc);}catch(_0x5320d2){utils[_0x19d5('0x13')](util[_0x19d5('0x18')](_0x19d5('0x38'),_0xdc86bc[_0x19d5('0x1c')]),_0x5320d2);}});ami['on']('newexten',function(_0x3fc3b9){try{utils['debug'](util[_0x19d5('0x18')](_0x19d5('0x39'),_0x3fc3b9[_0x19d5('0x1c')]),_0x3fc3b9);calls[_0x19d5('0x3a')](_0x3fc3b9);recordings['newexten'](_0x3fc3b9);dials[_0x19d5('0x3a')](_0x3fc3b9);}catch(_0x262fd7){utils[_0x19d5('0x13')](util[_0x19d5('0x18')](_0x19d5('0x39'),_0x3fc3b9[_0x19d5('0x1c')]),_0x262fd7);}});ami['on'](_0x19d5('0x3b'),function(_0x30690a){try{utils[_0x19d5('0x17')](util[_0x19d5('0x18')]('[%s][index][newchannel]',_0x30690a[_0x19d5('0x1c')]),_0x30690a);calls['newchannel'](_0x30690a);recordings[_0x19d5('0x3b')](_0x30690a);}catch(_0x321ebd){utils[_0x19d5('0x13')](util[_0x19d5('0x18')](_0x19d5('0x3c'),_0x30690a[_0x19d5('0x1c')]),_0x321ebd);}});ami['on'](_0x19d5('0x3d'),function(_0x2c8f04){try{utils[_0x19d5('0x17')](util['format'](_0x19d5('0x3e'),_0x2c8f04[_0x19d5('0x1c')]),_0x2c8f04);dials['dialbegin'](_0x2c8f04);}catch(_0x55226f){utils[_0x19d5('0x13')](util['format'](_0x19d5('0x3f'),_0x2c8f04[_0x19d5('0x1c')]),_0x55226f);}});ami['on']('dialend',function(_0x3c4761){try{utils[_0x19d5('0x17')](util[_0x19d5('0x18')](_0x19d5('0x40'),_0x3c4761[_0x19d5('0x1c')]),_0x3c4761);dials['dialend'](_0x3c4761);}catch(_0x77a5a3){utils['error'](util['format']('[%s][index][dialend]',_0x3c4761[_0x19d5('0x1c')]),_0x77a5a3);}});} \ No newline at end of file +var _0xd561=['musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','varset','newexten','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','asterisk','port','password','keepConnected','xdr','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','debug','uniqueid','agentcalled','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0xd561,0x155));var _0x1d56=function(_0x145621,_0x1c4ec0){_0x145621=_0x145621-0x0;var _0x4cee99=_0xd561[_0x145621];return _0x4cee99;};var AsteriskManager=require('asterisk-manager');var config=require(_0x1d56('0x0'));var utils=require(_0x1d56('0x1'));var util=require(_0x1d56('0x2'));var ami=new AsteriskManager(config[_0x1d56('0x3')][_0x1d56('0x4')],config['asterisk']['ip'],config[_0x1d56('0x3')]['username'],config['asterisk'][_0x1d56('0x5')],!![]);ami[_0x1d56('0x6')]();if(config[_0x1d56('0x7')]&&config[_0x1d56('0x7')]['disabled']){utils[_0x1d56('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0x1d56('0x9'));var calls=require(_0x1d56('0xa'));var queues=require(_0x1d56('0xb'));var recordings=require(_0x1d56('0xc'));var members=require(_0x1d56('0xd'));var dials=require(_0x1d56('0xe'));var transfers=require(_0x1d56('0xf'));var core=require(_0x1d56('0x10'));ami['on']('connect',core[_0x1d56('0x11')]);ami['on']('shutdown',core[_0x1d56('0x12')]);ami['on'](_0x1d56('0x13'),core[_0x1d56('0x13')]);ami['on'](_0x1d56('0x14'),core[_0x1d56('0x14')]);ami['on'](_0x1d56('0x15'),core[_0x1d56('0x15')]);ami['on'](_0x1d56('0x16'),core['managerevent']);ami['on'](_0x1d56('0x17'),function(_0x2d4cfb){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x19'),_0x2d4cfb[_0x1d56('0x1a')]),_0x2d4cfb);members[_0x1d56('0x17')](_0x2d4cfb);}catch(_0xbed72b){utils[_0x1d56('0x14')](util[_0x1d56('0x18')]('[%s][index][devicestatechange]',_0x2d4cfb[_0x1d56('0x1a')]),_0xbed72b);}});ami['on']('agentcalled',function(_0x331a95){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')]('[%s][index][agentcalled]',_0x331a95[_0x1d56('0x1c')]),_0x331a95);agents[_0x1d56('0x1d')](_0x331a95);}catch(_0x142eb2){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x1e'),_0x331a95['uniqueid']),_0x142eb2);}});ami['on']('agentringnoanswer',function(_0xaf242d){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')](_0x1d56('0x1f'),_0xaf242d[_0x1d56('0x1c')]),_0xaf242d);agents[_0x1d56('0x20')](_0xaf242d);}catch(_0x29a2af){utils[_0x1d56('0x14')](util['format'](_0x1d56('0x1f'),_0xaf242d[_0x1d56('0x1c')]),_0x29a2af);}});ami['on'](_0x1d56('0x21'),function(_0x46df2d){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')](_0x1d56('0x22'),_0x46df2d[_0x1d56('0x1c')]),_0x46df2d);agents[_0x1d56('0x21')](_0x46df2d);queues[_0x1d56('0x21')](_0x46df2d);}catch(_0x2d4baa){utils[_0x1d56('0x14')](util[_0x1d56('0x18')]('[%s][index][agentconnect]',_0x46df2d[_0x1d56('0x1c')]),_0x2d4baa);}});ami['on']('agentcomplete',function(_0x9a91f1){try{utils[_0x1d56('0x1b')](util['format'](_0x1d56('0x23'),_0x9a91f1[_0x1d56('0x1c')]),_0x9a91f1);agents[_0x1d56('0x24')](_0x9a91f1);queues[_0x1d56('0x24')](_0x9a91f1);members[_0x1d56('0x24')](_0x9a91f1);}catch(_0x181fc1){utils[_0x1d56('0x14')](util[_0x1d56('0x18')]('[%s][index][agentcomplete]',_0x9a91f1[_0x1d56('0x1c')]),_0x181fc1);}});ami['on']('queuecallerabandon',function(_0x11b79a){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x25'),_0x11b79a[_0x1d56('0x1c')]),_0x11b79a);agents[_0x1d56('0x26')](_0x11b79a);queues[_0x1d56('0x26')](_0x11b79a);}catch(_0x32b8fe){utils[_0x1d56('0x14')](util['format'](_0x1d56('0x25'),_0x11b79a[_0x1d56('0x1c')]),_0x32b8fe);}});ami['on'](_0x1d56('0x27'),function(_0x1aa565){try{utils[_0x1d56('0x1b')](util['format'](_0x1d56('0x28'),_0x1aa565[_0x1d56('0x1c')]),_0x1aa565);queues[_0x1d56('0x27')](_0x1aa565);recordings['queuecallerjoin'](_0x1aa565);}catch(_0x5c37f0){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x28'),_0x1aa565[_0x1d56('0x1c')]),_0x5c37f0);}});ami['on']('queuecallerleave',function(_0x185b9b){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')](_0x1d56('0x29'),_0x185b9b['uniqueid']),_0x185b9b);queues[_0x1d56('0x2a')](_0x185b9b);}catch(_0x1a0da5){utils[_0x1d56('0x14')](util['format'](_0x1d56('0x29'),_0x185b9b[_0x1d56('0x1c')]),_0x1a0da5);}});ami['on'](_0x1d56('0x2b'),function(_0x870a23){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x2c'),_0x870a23[_0x1d56('0x1c')]),_0x870a23);queues[_0x1d56('0x2b')](_0x870a23);calls[_0x1d56('0x2b')](_0x870a23);}catch(_0x17ed4a){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x2c'),_0x870a23['uniqueid']),_0x17ed4a);}});ami['on'](_0x1d56('0x2d'),function(_0x373929){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')](_0x1d56('0x2e'),_0x373929[_0x1d56('0x1c')]),_0x373929);queues[_0x1d56('0x2d')](_0x373929);calls[_0x1d56('0x2d')](_0x373929);}catch(_0x1dce53){utils[_0x1d56('0x14')](util['format'](_0x1d56('0x2e'),_0x373929['uniqueid']),_0x1dce53);}});ami['on']('newstate',function(_0x3a5f67){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x2f'),_0x3a5f67[_0x1d56('0x1c')]),_0x3a5f67);calls[_0x1d56('0x30')](_0x3a5f67);recordings[_0x1d56('0x30')](_0x3a5f67);}catch(_0x486688){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x2f'),_0x3a5f67['uniqueid']),_0x486688);}});ami['on']('hangup',function(_0x5b4c7f){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x31'),_0x5b4c7f[_0x1d56('0x1c')]),_0x5b4c7f);calls['hangup'](_0x5b4c7f);recordings[_0x1d56('0x32')](_0x5b4c7f);dials[_0x1d56('0x32')](_0x5b4c7f);agents[_0x1d56('0x32')](_0x5b4c7f);queues[_0x1d56('0x32')](_0x5b4c7f);}catch(_0x2f6faa){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x31'),_0x5b4c7f[_0x1d56('0x1c')]),_0x2f6faa);}});ami['on'](_0x1d56('0x33'),function(_0x5e1faa){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x34'),_0x5e1faa[_0x1d56('0x1c')]),_0x5e1faa);members['cdr'](_0x5e1faa);}catch(_0x4e6729){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x34'),_0x5e1faa[_0x1d56('0x1c')]),_0x4e6729);}});ami['on']('blindtransfer',function(_0x39df12){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x35'),_0x39df12[_0x1d56('0x1c')]),_0x39df12);queues[_0x1d56('0x36')](_0x39df12);agents['blindtransfer'](_0x39df12);transfers['blindtransfer'](_0x39df12);}catch(_0x344fe6){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x35'),_0x39df12[_0x1d56('0x1c')]),_0x344fe6);}});ami['on'](_0x1d56('0x37'),function(_0x2cfd97){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')]('[%s][index][attendedtransfer]',_0x2cfd97[_0x1d56('0x38')]),_0x2cfd97);queues['attendedtransfer'](_0x2cfd97);transfers[_0x1d56('0x37')](_0x2cfd97);agents[_0x1d56('0x37')](_0x2cfd97);calls['attendedtransfer'](_0x2cfd97);}catch(_0x1973f4){utils['error'](util[_0x1d56('0x18')]('[%s][index][attendedtransfer]',_0x2cfd97[_0x1d56('0x38')]),_0x1973f4);}});ami['on'](_0x1d56('0x39'),function(_0xd06ba3){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')]('[%s][index][varset]',_0xd06ba3[_0x1d56('0x1c')]),_0xd06ba3);queues[_0x1d56('0x39')](_0xd06ba3);recordings[_0x1d56('0x39')](_0xd06ba3);calls[_0x1d56('0x39')](_0xd06ba3);dials[_0x1d56('0x39')](_0xd06ba3);}catch(_0x3d5cd7){utils[_0x1d56('0x14')](util['format']('[%s][index][varset]',_0xd06ba3[_0x1d56('0x1c')]),_0x3d5cd7);}});ami['on'](_0x1d56('0x3a'),function(_0x5d85d4){try{utils['debug'](util[_0x1d56('0x18')]('[%s][index][newexten]',_0x5d85d4[_0x1d56('0x1c')]),_0x5d85d4);calls[_0x1d56('0x3a')](_0x5d85d4);recordings[_0x1d56('0x3a')](_0x5d85d4);dials['newexten'](_0x5d85d4);}catch(_0x3b837b){utils['error'](util[_0x1d56('0x18')]('[%s][index][newexten]',_0x5d85d4[_0x1d56('0x1c')]),_0x3b837b);}});ami['on'](_0x1d56('0x3b'),function(_0x58b2bc){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')](_0x1d56('0x3c'),_0x58b2bc[_0x1d56('0x1c')]),_0x58b2bc);calls[_0x1d56('0x3b')](_0x58b2bc);recordings['newchannel'](_0x58b2bc);}catch(_0xb66be9){utils['error'](util[_0x1d56('0x18')](_0x1d56('0x3c'),_0x58b2bc[_0x1d56('0x1c')]),_0xb66be9);}});ami['on'](_0x1d56('0x3d'),function(_0x379eb8){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')]('[%s][index][dialbegin]',_0x379eb8[_0x1d56('0x1c')]),_0x379eb8);dials['dialbegin'](_0x379eb8);}catch(_0x3150ef){utils[_0x1d56('0x14')](util[_0x1d56('0x18')]('[%s]dialbegin',_0x379eb8[_0x1d56('0x1c')]),_0x3150ef);}});ami['on'](_0x1d56('0x3e'),function(_0x171349){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')](_0x1d56('0x3f'),_0x171349[_0x1d56('0x1c')]),_0x171349);dials['dialend'](_0x171349);}catch(_0x3480a7){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x3f'),_0x171349['uniqueid']),_0x3480a7);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4dd7af1..58f6c9b 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 _0x71dc=['Queue:','info','format','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','error','[%s][members][writeDB]','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','voice','TALKING','now','agent','isNil','exitAt','duration','diffTime','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer'];(function(_0x585800,_0x3dc805){var _0x1ad88b=function(_0x2968e7){while(--_0x2968e7){_0x585800['push'](_0x585800['shift']());}};_0x1ad88b(++_0x3dc805);}(_0x71dc,0x17c));var _0xc71d=function(_0x49592c,_0x2c1bdf){_0x49592c=_0x49592c-0x0;var _0x4777c7=_0x71dc[_0x49592c];return _0x4777c7;};'use strict';var _=require(_0xc71d('0x0'));var util=require(_0xc71d('0x1'));var utils=require(_0xc71d('0x2'));var members={};var exclude=[_0xc71d('0x3'),_0xc71d('0x4')];function writeDB(_0x2cd914){utils[_0xc71d('0x5')](util[_0xc71d('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2cd914[_0xc71d('0x7')],_0x2cd914[_0xc71d('0x8')],_0x2cd914[_0xc71d('0x9')],_0x2cd914[_0xc71d('0xa')],_0x2cd914[_0xc71d('0xb')],_0x2cd914[_0xc71d('0xc')]));if(_0x2cd914[_0xc71d('0x8')]){utils[_0xc71d('0xd')](_0x2cd914[_0xc71d('0x8')])['then'](function(_0x486496){if(_0x486496){_0x2cd914[_0xc71d('0xb')]=_0x486496[_0xc71d('0xe')];_0x2cd914[_0xc71d('0xf')]=_0x486496[_0xc71d('0xf')];utils[_0xc71d('0x10')](_0xc71d('0x11'),_0x2cd914);}else{utils[_0xc71d('0x12')](_0x2cd914['interface'][_0xc71d('0x13')]('/')[0x1])[_0xc71d('0x14')](function(_0x498077){if(_0x498077){_0x2cd914[_0xc71d('0xb')]=_0x498077[_0xc71d('0xe')];_0x2cd914['internal']=_0x498077[_0xc71d('0xf')];utils[_0xc71d('0x10')](_0xc71d('0x11'),_0x2cd914);}});}})['catch'](function(_0x5c2022){utils[_0xc71d('0x15')](util[_0xc71d('0x6')](_0xc71d('0x16'),_0x2cd914[_0xc71d('0x7')]),_0x5c2022);});}delete members[_0x2cd914[_0xc71d('0x8')]];}function startsWith(_0x13c98f,_0x470633){return _['some'](_0x13c98f,function(_0x1182f6){return _[_0xc71d('0x17')](_0x470633,_0x1182f6);});}exports['devicestatechange']=function(_0x593d00){try{utils[_0xc71d('0x18')](util[_0xc71d('0x6')](_0xc71d('0x19'),members[_0x593d00[_0xc71d('0x1a')]]?members[_0x593d00[_0xc71d('0x1a')]][_0xc71d('0x7')]:_0x593d00['device']),_0x593d00);utils['info'](util[_0xc71d('0x6')](_0xc71d('0x1b'),members[_0x593d00[_0xc71d('0x1a')]]?members[_0x593d00['device']][_0xc71d('0x7')]:_0x593d00['device'],_0x593d00[_0xc71d('0x1c')],_0x593d00[_0xc71d('0x1a')]));switch(_0x593d00[_0xc71d('0x1c')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x593d00['device'])){members[_0x593d00['device']]={'channel':_0xc71d('0x1d'),'interface':_0x593d00[_0xc71d('0x1a')],'type':_0xc71d('0x1e'),'enterAt':utils[_0xc71d('0x1f')](),'role':_0xc71d('0x20')};}break;case'NOT_INUSE':if(!_[_0xc71d('0x21')](members[_0x593d00[_0xc71d('0x1a')]])){members[_0x593d00['device']][_0xc71d('0x22')]=utils[_0xc71d('0x1f')]();members[_0x593d00['device']][_0xc71d('0x23')]=utils[_0xc71d('0x24')](members[_0x593d00['device']][_0xc71d('0x22')],members[_0x593d00[_0xc71d('0x1a')]]['enterAt']);if(members[_0x593d00[_0xc71d('0x1a')]][_0xc71d('0x7')]){writeDB(members[_0x593d00['device']]);}}break;default:break;}}catch(_0x38cc1f){utils[_0xc71d('0x15')](util[_0xc71d('0x6')]('[%s][members][devicestatechange]',members[_0x593d00['device']]?members[_0x593d00[_0xc71d('0x1a')]][_0xc71d('0x7')]:_0x593d00[_0xc71d('0x1a')]),_0x38cc1f);}};exports['agentcomplete']=function(_0x5123ab){try{if(!_[_0xc71d('0x21')](members[_0x5123ab['interface']])){utils[_0xc71d('0x18')](util['format'](_0xc71d('0x25'),_0x5123ab['uniqueid']),_0x5123ab);utils[_0xc71d('0x5')](util[_0xc71d('0x6')](_0xc71d('0x26'),_0x5123ab['uniqueid'],_0x5123ab['interface'],_0x5123ab[_0xc71d('0x27')]));members[_0x5123ab['interface']]=_[_0xc71d('0x28')](members[_0x5123ab[_0xc71d('0x8')]],{'data4':_0x5123ab[_0xc71d('0x27')],'uniqueid':_0x5123ab['uniqueid']});}}catch(_0x28d090){utils[_0xc71d('0x15')](util[_0xc71d('0x6')](_0xc71d('0x25'),_0x5123ab[_0xc71d('0x7')]),_0x28d090);}};exports['cdr']=function(_0x560cec){try{utils[_0xc71d('0x18')](util[_0xc71d('0x6')](_0xc71d('0x29'),_0x560cec[_0xc71d('0x7')]),_0x560cec);if(_0x560cec[_0xc71d('0x9')]){var _0xb9c9b7=_0x560cec[_0xc71d('0x9')][_0xc71d('0x13')]('-')[0x0];if(!_['isNil'](members[_0xb9c9b7])){members[_0xb9c9b7]=_[_0xc71d('0x28')](members[_0xb9c9b7],{'data1':members[_0xb9c9b7][_0xc71d('0x2a')]||_0x560cec[_0xc71d('0xc')],'data2':members[_0xb9c9b7][_0xc71d('0xa')]||_0x560cec[_0xc71d('0x2b')],'data3':members[_0xb9c9b7][_0xc71d('0x2c')]||_0x560cec[_0xc71d('0x2d')],'uniqueid':members[_0xb9c9b7][_0xc71d('0x7')]||_0x560cec[_0xc71d('0x7')]});utils[_0xc71d('0x5')](util[_0xc71d('0x6')](_0xc71d('0x2e'),_0x560cec[_0xc71d('0x7')],members[_0xb9c9b7]['data1'],members[_0xb9c9b7][_0xc71d('0xa')],members[_0xb9c9b7][_0xc71d('0x2c')]));if(members[_0xb9c9b7][_0xc71d('0x22')]){writeDB(members[_0xb9c9b7]);}}}if(_0x560cec[_0xc71d('0x2f')]){var _0x2d47da=_0x560cec['destinationchannel'][_0xc71d('0x13')]('-')[0x0];if(!_['isNil'](members[_0x2d47da])){members[_0x2d47da]=_[_0xc71d('0x28')](members[_0x2d47da],{'data1':members[_0x2d47da]['data1']||_0x560cec[_0xc71d('0xc')],'data2':members[_0x2d47da][_0xc71d('0xa')]||_0x560cec[_0xc71d('0x2b')],'data3':members[_0x2d47da][_0xc71d('0x2c')]||_0x560cec[_0xc71d('0x2d')],'uniqueid':members[_0x2d47da]['uniqueid']||_0x560cec[_0xc71d('0x7')]});utils[_0xc71d('0x5')](util[_0xc71d('0x6')](_0xc71d('0x2e'),_0x560cec[_0xc71d('0x7')],members[_0x2d47da][_0xc71d('0x2a')],members[_0x2d47da][_0xc71d('0xa')],members[_0x2d47da][_0xc71d('0x2c')]));if(members[_0x2d47da]['exitAt']){writeDB(members[_0x2d47da]);}}}}catch(_0x225746){utils[_0xc71d('0x15')](util[_0xc71d('0x6')]('[%s][members][cdr]',_0x560cec[_0xc71d('0x7')]),_0x225746);}}; \ No newline at end of file +var _0x6d5a=['[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','error','format','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','split','assign','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','exitAt','destinationchannel','destination','data2','[%s][members][cdr]','util','./utils','Queue:','info'];(function(_0x39f74b,_0x51bcbc){var _0x11eb7c=function(_0xc0d3f2){while(--_0xc0d3f2){_0x39f74b['push'](_0x39f74b['shift']());}};_0x11eb7c(++_0x51bcbc);}(_0x6d5a,0x98));var _0xa6d5=function(_0x440084,_0x4716f7){_0x440084=_0x440084-0x0;var _0x3ae5ea=_0x6d5a[_0x440084];return _0x3ae5ea;};'use strict';var _=require('lodash');var util=require(_0xa6d5('0x0'));var utils=require(_0xa6d5('0x1'));var members={};var exclude=['Local/_attended@transfer',_0xa6d5('0x2')];function writeDB(_0x47f189){utils[_0xa6d5('0x3')](util['format'](_0xa6d5('0x4'),_0x47f189[_0xa6d5('0x5')],_0x47f189['interface'],_0x47f189['channel'],_0x47f189['data2'],_0x47f189[_0xa6d5('0x6')],_0x47f189[_0xa6d5('0x7')]));if(_0x47f189[_0xa6d5('0x8')]){utils[_0xa6d5('0x9')](_0x47f189[_0xa6d5('0x8')])[_0xa6d5('0xa')](function(_0x2dd54f){if(_0x2dd54f){_0x47f189[_0xa6d5('0x6')]=_0x2dd54f[_0xa6d5('0xb')];_0x47f189[_0xa6d5('0xc')]=_0x2dd54f[_0xa6d5('0xc')];utils[_0xa6d5('0xd')](_0xa6d5('0xe'),_0x47f189);}else{utils[_0xa6d5('0xf')](_0x47f189['interface']['split']('/')[0x1])[_0xa6d5('0xa')](function(_0x584dd6){if(_0x584dd6){_0x47f189[_0xa6d5('0x6')]=_0x584dd6[_0xa6d5('0xb')];_0x47f189['internal']=_0x584dd6[_0xa6d5('0xc')];utils['request'](_0xa6d5('0xe'),_0x47f189);}});}})['catch'](function(_0x52a8c3){utils[_0xa6d5('0x10')](util[_0xa6d5('0x11')](_0xa6d5('0x12'),_0x47f189['uniqueid']),_0x52a8c3);});}delete members[_0x47f189[_0xa6d5('0x8')]];}function startsWith(_0x17ea92,_0x259118){return _[_0xa6d5('0x13')](_0x17ea92,function(_0x2deda8){return _[_0xa6d5('0x14')](_0x259118,_0x2deda8);});}exports['devicestatechange']=function(_0x3ad666){try{utils[_0xa6d5('0x15')](util[_0xa6d5('0x11')](_0xa6d5('0x16'),members[_0x3ad666[_0xa6d5('0x17')]]?members[_0x3ad666['device']]['uniqueid']:_0x3ad666[_0xa6d5('0x17')]),_0x3ad666);utils[_0xa6d5('0x3')](util[_0xa6d5('0x11')](_0xa6d5('0x18'),members[_0x3ad666['device']]?members[_0x3ad666['device']]['uniqueid']:_0x3ad666['device'],_0x3ad666['state'],_0x3ad666[_0xa6d5('0x17')]));switch(_0x3ad666[_0xa6d5('0x19')]){case _0xa6d5('0x1a'):case _0xa6d5('0x1b'):if(!startsWith(exclude,_0x3ad666[_0xa6d5('0x17')])){members[_0x3ad666['device']]={'channel':_0xa6d5('0x1c'),'interface':_0x3ad666[_0xa6d5('0x17')],'type':_0xa6d5('0x1d'),'enterAt':utils[_0xa6d5('0x1e')](),'role':_0xa6d5('0x1f')};}break;case _0xa6d5('0x20'):if(!_[_0xa6d5('0x21')](members[_0x3ad666[_0xa6d5('0x17')]])){members[_0x3ad666['device']]['exitAt']=utils[_0xa6d5('0x1e')]();members[_0x3ad666[_0xa6d5('0x17')]][_0xa6d5('0x22')]=utils[_0xa6d5('0x23')](members[_0x3ad666[_0xa6d5('0x17')]]['exitAt'],members[_0x3ad666[_0xa6d5('0x17')]]['enterAt']);if(members[_0x3ad666[_0xa6d5('0x17')]][_0xa6d5('0x5')]){writeDB(members[_0x3ad666[_0xa6d5('0x17')]]);}}break;default:break;}}catch(_0x514dfd){utils[_0xa6d5('0x10')](util[_0xa6d5('0x11')](_0xa6d5('0x16'),members[_0x3ad666['device']]?members[_0x3ad666[_0xa6d5('0x17')]][_0xa6d5('0x5')]:_0x3ad666[_0xa6d5('0x17')]),_0x514dfd);}};exports[_0xa6d5('0x24')]=function(_0x2280aa){try{if(!_[_0xa6d5('0x21')](members[_0x2280aa[_0xa6d5('0x8')]])){utils[_0xa6d5('0x15')](util[_0xa6d5('0x11')]('[%s][members][agentcomplete]',_0x2280aa['uniqueid']),_0x2280aa);utils['info'](util[_0xa6d5('0x11')](_0xa6d5('0x25'),_0x2280aa[_0xa6d5('0x5')],_0x2280aa[_0xa6d5('0x8')],_0x2280aa[_0xa6d5('0x26')]));members[_0x2280aa['interface']]=_['assign'](members[_0x2280aa['interface']],{'data4':_0x2280aa['queue'],'uniqueid':_0x2280aa[_0xa6d5('0x5')]});}}catch(_0x1d92e0){utils[_0xa6d5('0x10')](util['format'](_0xa6d5('0x27'),_0x2280aa[_0xa6d5('0x5')]),_0x1d92e0);}};exports[_0xa6d5('0x28')]=function(_0x3bb246){try{utils[_0xa6d5('0x15')](util[_0xa6d5('0x11')]('[%s][members][cdr]',_0x3bb246[_0xa6d5('0x5')]),_0x3bb246);if(_0x3bb246['channel']){var _0xeb3cd6=_0x3bb246['channel'][_0xa6d5('0x29')]('-')[0x0];if(!_[_0xa6d5('0x21')](members[_0xeb3cd6])){members[_0xeb3cd6]=_[_0xa6d5('0x2a')](members[_0xeb3cd6],{'data1':members[_0xeb3cd6][_0xa6d5('0x2b')]||_0x3bb246['type'],'data2':members[_0xeb3cd6]['data2']||_0x3bb246[_0xa6d5('0x2c')],'data3':members[_0xeb3cd6][_0xa6d5('0x2d')]||_0x3bb246['destination'],'uniqueid':members[_0xeb3cd6][_0xa6d5('0x5')]||_0x3bb246['uniqueid']});utils['info'](util['format'](_0xa6d5('0x2e'),_0x3bb246[_0xa6d5('0x5')],members[_0xeb3cd6][_0xa6d5('0x2b')],members[_0xeb3cd6]['data2'],members[_0xeb3cd6]['data3']));if(members[_0xeb3cd6][_0xa6d5('0x2f')]){writeDB(members[_0xeb3cd6]);}}}if(_0x3bb246['destinationchannel']){var _0x1ebc12=_0x3bb246[_0xa6d5('0x30')][_0xa6d5('0x29')]('-')[0x0];if(!_['isNil'](members[_0x1ebc12])){members[_0x1ebc12]=_['assign'](members[_0x1ebc12],{'data1':members[_0x1ebc12][_0xa6d5('0x2b')]||_0x3bb246['type'],'data2':members[_0x1ebc12]['data2']||_0x3bb246[_0xa6d5('0x2c')],'data3':members[_0x1ebc12][_0xa6d5('0x2d')]||_0x3bb246[_0xa6d5('0x31')],'uniqueid':members[_0x1ebc12][_0xa6d5('0x5')]||_0x3bb246[_0xa6d5('0x5')]});utils[_0xa6d5('0x3')](util[_0xa6d5('0x11')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3bb246[_0xa6d5('0x5')],members[_0x1ebc12][_0xa6d5('0x2b')],members[_0x1ebc12][_0xa6d5('0x32')],members[_0x1ebc12]['data3']));if(members[_0x1ebc12][_0xa6d5('0x2f')]){writeDB(members[_0x1ebc12]);}}}}catch(_0x2bb5ef){utils['error'](util[_0xa6d5('0x11')](_0xa6d5('0x33'),_0x3bb246[_0xa6d5('0x5')]),_0x2bb5ef);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 7f031e9..36ddfe8 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 _0xa3fe=['transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','mohtime','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','calleridnum','accountcode','queuecallerexitreason','then','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','info','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerjoinAt','position','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','lastAssignedTo','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid'];(function(_0x368280,_0x5213e4){var _0x58e5e3=function(_0x184fac){while(--_0x184fac){_0x368280['push'](_0x368280['shift']());}};_0x58e5e3(++_0x5213e4);}(_0xa3fe,0xd8));var _0xea3f=function(_0x2b1152,_0x4e97e6){_0x2b1152=_0x2b1152-0x0;var _0x2963bd=_0xa3fe[_0x2b1152];return _0x2963bd;};'use strict';var _=require(_0xea3f('0x0'));var util=require('util');var utils=require(_0xea3f('0x1'));var queues={};function writeDB(_0x93b702){utils['info'](util[_0xea3f('0x2')](_0xea3f('0x3'),_0x93b702[_0xea3f('0x4')],_0x93b702['channel'],_0x93b702[_0xea3f('0x5')],_0x93b702['lastAssignedTo'],_0x93b702[_0xea3f('0x6')],_0x93b702[_0xea3f('0x7')],_0x93b702[_0xea3f('0x8')]));if(_0x93b702['queue']){utils['getVoiceQueueByName'](_0x93b702[_0xea3f('0x5')])[_0xea3f('0x9')](function(_0x3c4807){if(_0x3c4807){_0x93b702['type']=_0x3c4807['type'];}utils[_0xea3f('0xa')]('CreateVoiceQueueReport',_0x93b702);});}else{utils['request'](_0xea3f('0xb'),_0x93b702);}if(_0x93b702[_0xea3f('0xc')]){delete queues[_0x93b702[_0xea3f('0xc')]];}else{delete queues[_0x93b702['uniqueid']];}}exports['queuecallerjoin']=function(_0x5c8cd3){try{utils[_0xea3f('0xd')](util[_0xea3f('0x2')](_0xea3f('0xe'),_0x5c8cd3[_0xea3f('0x4')]),_0x5c8cd3);utils['info'](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5c8cd3[_0xea3f('0x4')],_0x5c8cd3[_0xea3f('0x5')],_0x5c8cd3['position']));queues[_0x5c8cd3[_0xea3f('0x4')]]=_[_0xea3f('0xf')](_0x5c8cd3,{'originalposition':_0x5c8cd3['position'],'queuecallerjoinAt':utils[_0xea3f('0x10')](),'mohtime':0x0});}catch(_0x307409){utils[_0xea3f('0x11')](util[_0xea3f('0x2')](_0xea3f('0xe'),_0x5c8cd3[_0xea3f('0x4')]),_0x307409);}};exports[_0xea3f('0x12')]=function(_0x2585f1){try{if(!_[_0xea3f('0x13')](queues[_0x2585f1[_0xea3f('0x4')]])){utils[_0xea3f('0xd')](util[_0xea3f('0x2')](_0xea3f('0x14'),_0x2585f1[_0xea3f('0x4')]),_0x2585f1);if(queues[_0x2585f1[_0xea3f('0x4')]][_0xea3f('0x15')]){if(!queues[_0x2585f1[_0xea3f('0x4')]][_0xea3f('0x16')]&&!queues[_0x2585f1['uniqueid']][_0xea3f('0x17')]){queues[_0x2585f1[_0xea3f('0x4')]][_0xea3f('0x18')]=!![];queues[_0x2585f1[_0xea3f('0x4')]][_0xea3f('0x19')]=utils['now']();queues[_0x2585f1['uniqueid']][_0xea3f('0x8')]=_0xea3f('0x1a');}utils['info'](util[_0xea3f('0x2')](_0xea3f('0x1b'),_0x2585f1[_0xea3f('0x4')],queues[_0x2585f1[_0xea3f('0x4')]]['name'],queues[_0x2585f1['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x2585f1[_0xea3f('0x4')]]);}else if(queues[_0x2585f1[_0xea3f('0x4')]][_0xea3f('0xc')]){utils[_0xea3f('0x1c')](util[_0xea3f('0x2')](_0xea3f('0x1d'),_0x2585f1[_0xea3f('0x4')],queues[_0x2585f1['uniqueid']][_0xea3f('0x1e')],queues[_0x2585f1['uniqueid']][_0xea3f('0xc')]));queues[queues[_0x2585f1[_0xea3f('0x4')]][_0xea3f('0xc')]]=queues[_0x2585f1[_0xea3f('0x4')]];queues[queues[_0x2585f1[_0xea3f('0x4')]]['transfereduniqueid']][_0xea3f('0x1f')]=0x2;delete queues[_0x2585f1['uniqueid']];}}}catch(_0xa1bfcf){utils[_0xea3f('0x11')](util[_0xea3f('0x2')]('[%s][queues][hangup]',_0x2585f1[_0xea3f('0x4')]),_0xa1bfcf);}};exports[_0xea3f('0x20')]=function(_0x59ec90){try{utils[_0xea3f('0xd')](util[_0xea3f('0x2')](_0xea3f('0x21'),_0x59ec90[_0xea3f('0x4')]),_0x59ec90);if(!_[_0xea3f('0x13')](_0x59ec90[_0xea3f('0x22')][_0xea3f('0x23')])&&_0x59ec90[_0xea3f('0x24')][_0xea3f('0x25')]()!==_0xea3f('0x26')){if(!_[_0xea3f('0x13')](queues[_0x59ec90[_0xea3f('0x4')]])){queues[_0x59ec90[_0xea3f('0x4')]][_0xea3f('0x16')]=![];queues[_0x59ec90[_0xea3f('0x4')]][_0xea3f('0x27')]=null;queues[_0x59ec90[_0xea3f('0x4')]][_0xea3f('0x17')]=!![];queues[_0x59ec90[_0xea3f('0x4')]]['queuecallerexitAt']=utils[_0xea3f('0x10')]();queues[_0x59ec90[_0xea3f('0x4')]][_0xea3f('0x8')]=_0x59ec90[_0xea3f('0x24')][_0xea3f('0x25')]();utils[_0xea3f('0x1c')](util[_0xea3f('0x2')](_0xea3f('0x28'),_0x59ec90[_0xea3f('0x4')],queues[_0x59ec90['uniqueid']][_0xea3f('0x1e')],_0x59ec90[_0xea3f('0x24')],queues[_0x59ec90[_0xea3f('0x4')]][_0xea3f('0x8')]));writeDB(queues[_0x59ec90[_0xea3f('0x4')]]);}}else if(!_['isNil'](_0x59ec90['variable'][_0xea3f('0x29')])){if(!_['isNil'](queues[_0x59ec90[_0xea3f('0x4')]])&&!queues[_0x59ec90[_0xea3f('0x4')]][_0xea3f('0x16')]){queues[_0x59ec90[_0xea3f('0x4')]][_0xea3f('0x16')]=![];queues[_0x59ec90[_0xea3f('0x4')]]['queuecallerabandonAt']=null;queues[_0x59ec90[_0xea3f('0x4')]]['queuecallerexit']=!![];queues[_0x59ec90['uniqueid']][_0xea3f('0x2a')]=utils[_0xea3f('0x10')]();queues[_0x59ec90[_0xea3f('0x4')]][_0xea3f('0x8')]=_0xea3f('0x2b');utils[_0xea3f('0x1c')](util[_0xea3f('0x2')](_0xea3f('0x2c'),_0x59ec90[_0xea3f('0x4')],queues[_0x59ec90[_0xea3f('0x4')]][_0xea3f('0x1e')],_0x59ec90[_0xea3f('0x24')],queues[_0x59ec90[_0xea3f('0x4')]]['queuecallerexitreason']));}}}catch(_0xb7d4e5){utils['error'](util[_0xea3f('0x2')](_0xea3f('0x21'),_0x59ec90[_0xea3f('0x4')]),_0xb7d4e5);}};exports[_0xea3f('0x16')]=function(_0x115a60){try{if(!_['isNil'](queues[_0x115a60[_0xea3f('0x4')]])){utils['debug'](util[_0xea3f('0x2')](_0xea3f('0x2d'),_0x115a60[_0xea3f('0x4')]),_0x115a60);queues[_0x115a60[_0xea3f('0x4')]][_0xea3f('0x17')]=![];queues[_0x115a60[_0xea3f('0x4')]][_0xea3f('0x2a')]=null;queues[_0x115a60[_0xea3f('0x4')]][_0xea3f('0x16')]=!![];queues[_0x115a60[_0xea3f('0x4')]][_0xea3f('0x27')]=utils[_0xea3f('0x10')]();queues[_0x115a60[_0xea3f('0x4')]][_0xea3f('0x8')]=_0xea3f('0x2e');utils['info'](util[_0xea3f('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x115a60[_0xea3f('0x4')],queues[_0x115a60['uniqueid']][_0xea3f('0x1e')],queues[_0x115a60[_0xea3f('0x4')]]['queuecallerexitreason']));}}catch(_0x1610ed){utils[_0xea3f('0x11')](util['format'](_0xea3f('0x2d'),_0x115a60[_0xea3f('0x4')]),_0x1610ed);}};exports[_0xea3f('0x2f')]=function(_0x58e8f0){try{if(!_[_0xea3f('0x13')](queues[_0x58e8f0[_0xea3f('0x4')]])){utils[_0xea3f('0xd')](util[_0xea3f('0x2')](_0xea3f('0x30'),_0x58e8f0[_0xea3f('0x4')]),_0x58e8f0);utils[_0xea3f('0x1c')](util[_0xea3f('0x2')](_0xea3f('0x31'),_0x58e8f0[_0xea3f('0x4')],queues[_0x58e8f0[_0xea3f('0x4')]][_0xea3f('0x1e')],_0x58e8f0[_0xea3f('0x32')],_0x58e8f0[_0xea3f('0x33')]));queues[_0x58e8f0['uniqueid']]['queuecallerleave']=!![];queues[_0x58e8f0[_0xea3f('0x4')]]['queuecallerleaveAt']=utils[_0xea3f('0x10')]();queues[_0x58e8f0[_0xea3f('0x4')]]['holdtime']=utils['diffTime'](queues[_0x58e8f0['uniqueid']]['queuecallerleaveAt'],queues[_0x58e8f0[_0xea3f('0x4')]][_0xea3f('0x34')]);queues[_0x58e8f0[_0xea3f('0x4')]][_0xea3f('0x35')]=_0x58e8f0[_0xea3f('0x35')];queues[_0x58e8f0[_0xea3f('0x4')]]['count']=_0x58e8f0[_0xea3f('0x36')];queues[_0x58e8f0['uniqueid']][_0xea3f('0x32')]=_0x58e8f0[_0xea3f('0x32')];queues[_0x58e8f0['uniqueid']][_0xea3f('0x33')]=_0x58e8f0[_0xea3f('0x33')];}}catch(_0x5b0ca1){utils[_0xea3f('0x11')](util[_0xea3f('0x2')](_0xea3f('0x30'),_0x58e8f0[_0xea3f('0x4')]),_0x5b0ca1);}};exports[_0xea3f('0x37')]=function(_0x14920f){try{if(!_[_0xea3f('0x13')](queues[_0x14920f[_0xea3f('0x4')]])){utils[_0xea3f('0xd')](util[_0xea3f('0x2')](_0xea3f('0x38'),_0x14920f[_0xea3f('0x4')]),_0x14920f);utils[_0xea3f('0x1c')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x14920f['uniqueid'],queues[_0x14920f[_0xea3f('0x4')]][_0xea3f('0x1e')],_0x14920f[_0xea3f('0x39')],_0x14920f[_0xea3f('0x3a')]));queues[_0x14920f[_0xea3f('0x4')]][_0xea3f('0x16')]=![];queues[_0x14920f['uniqueid']][_0xea3f('0x16')]=![];queues[_0x14920f[_0xea3f('0x4')]]['queuecallerabandonAt']=null;queues[_0x14920f[_0xea3f('0x4')]]['queuecallerexit']=![];queues[_0x14920f[_0xea3f('0x4')]][_0xea3f('0x8')]=null;queues[_0x14920f[_0xea3f('0x4')]][_0xea3f('0x2a')]=null;queues[_0x14920f[_0xea3f('0x4')]][_0xea3f('0x3b')]=!![];queues[_0x14920f[_0xea3f('0x4')]][_0xea3f('0x7')]=_0x14920f['destaccountcode'];queues[_0x14920f['uniqueid']]['lastAssignedTo']=_0x14920f[_0xea3f('0x39')];}}catch(_0x22def0){utils[_0xea3f('0x11')](util['format'](_0xea3f('0x38'),_0x14920f[_0xea3f('0x4')]),_0x22def0);}};exports['agentcomplete']=function(_0x33ff2d){try{if(!_['isNil'](queues[_0x33ff2d['uniqueid']])){if(queues[_0x33ff2d[_0xea3f('0x4')]]['queuecallerleaveAt']){utils[_0xea3f('0xd')](util[_0xea3f('0x2')](_0xea3f('0x3c'),_0x33ff2d[_0xea3f('0x4')]),_0x33ff2d);queues[_0x33ff2d[_0xea3f('0x4')]]['queuecallerabandon']=![];queues[_0x33ff2d[_0xea3f('0x4')]][_0xea3f('0x16')]=![];queues[_0x33ff2d[_0xea3f('0x4')]][_0xea3f('0x27')]=null;queues[_0x33ff2d[_0xea3f('0x4')]][_0xea3f('0x17')]=![];queues[_0x33ff2d['uniqueid']]['queuecallerexitAt']=null;queues[_0x33ff2d[_0xea3f('0x4')]][_0xea3f('0x3b')]=!![];queues[_0x33ff2d[_0xea3f('0x4')]][_0xea3f('0x3d')]=_0x33ff2d[_0xea3f('0x39')];queues[_0x33ff2d[_0xea3f('0x4')]]['queuecallercomplete']=!![];queues[_0x33ff2d[_0xea3f('0x4')]][_0xea3f('0x19')]=utils[_0xea3f('0x10')]();if(_0x33ff2d[_0xea3f('0x3e')]=='transfer'){if(!queues[_0x33ff2d[_0xea3f('0x4')]][_0xea3f('0x3f')]){queues[_0x33ff2d['uniqueid']][_0xea3f('0x8')]=_0xea3f('0x40');}}else{queues[_0x33ff2d[_0xea3f('0x4')]]['queuecallerexitreason']=_0xea3f('0x41')+_0x33ff2d[_0xea3f('0x3e')]['toUpperCase']();}utils['info'](util[_0xea3f('0x2')](_0xea3f('0x42'),_0x33ff2d[_0xea3f('0x4')],queues[_0x33ff2d[_0xea3f('0x4')]][_0xea3f('0x1e')],_0x33ff2d[_0xea3f('0x39')],queues[_0x33ff2d[_0xea3f('0x4')]][_0xea3f('0x8')]));writeDB(queues[_0x33ff2d[_0xea3f('0x4')]]);}}}catch(_0x329040){utils[_0xea3f('0x11')](util[_0xea3f('0x2')](_0xea3f('0x3c'),_0x33ff2d[_0xea3f('0x4')]),_0x329040);}};exports[_0xea3f('0x43')]=function(_0xb104b0){try{if(!_[_0xea3f('0x13')](queues[_0xb104b0[_0xea3f('0x44')]])){utils[_0xea3f('0xd')](util['format'](_0xea3f('0x45'),_0xb104b0[_0xea3f('0x4')]),_0xb104b0);queues[_0xb104b0['transfereeuniqueid']][_0xea3f('0x3f')]=!![];queues[_0xb104b0[_0xea3f('0x44')]][_0xea3f('0x46')]=_0xea3f('0x47');queues[_0xb104b0[_0xea3f('0x44')]][_0xea3f('0x48')]=_0xb104b0[_0xea3f('0x49')];queues[_0xb104b0[_0xea3f('0x44')]]['transferuniqueid']=_0xb104b0[_0xea3f('0x44')];queues[_0xb104b0[_0xea3f('0x44')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0xea3f('0x1c')](util[_0xea3f('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0xb104b0['uniqueid'],queues[_0xb104b0[_0xea3f('0x44')]]['name'],_0xb104b0[_0xea3f('0x44')],_0xb104b0[_0xea3f('0x49')]));}}catch(_0x555201){utils['error'](util[_0xea3f('0x2')](_0xea3f('0x45'),_0xb104b0['uniqueid']),_0x555201);}};exports[_0xea3f('0x4a')]=function(_0xbf8ab9){try{utils[_0xea3f('0xd')](util[_0xea3f('0x2')](_0xea3f('0x4b'),_0xbf8ab9[_0xea3f('0x4c')]),_0xbf8ab9);if(_0xbf8ab9[_0xea3f('0x4c')]==_0xbf8ab9[_0xea3f('0x4d')]){if(!_[_0xea3f('0x13')](queues[_0xbf8ab9[_0xea3f('0x4e')]])){utils[_0xea3f('0x1c')](util[_0xea3f('0x2')](_0xea3f('0x4f'),_0xbf8ab9[_0xea3f('0x4c')],queues[_0xbf8ab9['secondtransfererlinkedid']][_0xea3f('0x1e')],_0xbf8ab9[_0xea3f('0x50')]));queues[_0xbf8ab9[_0xea3f('0x4e')]][_0xea3f('0x3f')]=!![];queues[_0xbf8ab9[_0xea3f('0x4e')]]['transfertype']='ATTENDED';queues[_0xbf8ab9[_0xea3f('0x4e')]][_0xea3f('0x48')]=_0xbf8ab9['origtransfererexten'];queues[_0xbf8ab9[_0xea3f('0x4e')]][_0xea3f('0x51')]=_0xbf8ab9[_0xea3f('0x4c')];queues[_0xbf8ab9[_0xea3f('0x4e')]][_0xea3f('0x8')]=_0xea3f('0x52');}if(!_[_0xea3f('0x13')](queues[_0xbf8ab9['origtransfererlinkedid']])){if(_0xbf8ab9[_0xea3f('0x53')]&&queues[_0xbf8ab9[_0xea3f('0x53')]]){queues[_0xbf8ab9[_0xea3f('0x53')]][_0xea3f('0x1f')]=0x1;queues[_0xbf8ab9[_0xea3f('0x44')]]=_[_0xea3f('0x54')](queues[_0xbf8ab9[_0xea3f('0x53')]]);queues[_0xbf8ab9['transfereeuniqueid']][_0xea3f('0xc')]=_0xbf8ab9['transfertargetuniqueid'];queues[_0xbf8ab9[_0xea3f('0x44')]]['queuecallerenterreason']=0x2;queues[_0xbf8ab9[_0xea3f('0x44')]][_0xea3f('0x6')]=queues[_0xbf8ab9[_0xea3f('0x4e')]][_0xea3f('0x6')];queues[_0xbf8ab9['transfereeuniqueid']][_0xea3f('0x55')]=queues[_0xbf8ab9[_0xea3f('0x4e')]]['calleridname'];queues[_0xbf8ab9['transfereeuniqueid']][_0xea3f('0x34')]=utils[_0xea3f('0x10')]();queues[_0xbf8ab9[_0xea3f('0x44')]][_0xea3f('0x15')]=utils[_0xea3f('0x10')]();queues[_0xbf8ab9[_0xea3f('0x44')]][_0xea3f('0x56')]=0x0;queues[_0xbf8ab9[_0xea3f('0x44')]]['mohtime']=0x0;utils['info'](util['format'](_0xea3f('0x57'),_0xbf8ab9[_0xea3f('0x4c')],queues[_0xbf8ab9[_0xea3f('0x44')]][_0xea3f('0x1e')],queues[_0xbf8ab9[_0xea3f('0x44')]]['calleridnum'],queues[_0xbf8ab9[_0xea3f('0x44')]][_0xea3f('0x55')]));}else{utils[_0xea3f('0x1c')](util[_0xea3f('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xbf8ab9[_0xea3f('0x4c')],queues[_0xbf8ab9[_0xea3f('0x4d')]][_0xea3f('0x1e')],_0xbf8ab9[_0xea3f('0x4e')]));queues[_0xbf8ab9['origtransfererlinkedid']][_0xea3f('0xc')]=_0xbf8ab9[_0xea3f('0x4e')];}}}else if(_0xbf8ab9[_0xea3f('0x58')]==_0xbf8ab9['secondtransfererlinkedid']){if(!_[_0xea3f('0x13')](queues[_0xbf8ab9[_0xea3f('0x4d')]])){utils[_0xea3f('0x1c')](util[_0xea3f('0x2')](_0xea3f('0x59'),_0xbf8ab9[_0xea3f('0x4c')],queues[_0xbf8ab9[_0xea3f('0x4d')]][_0xea3f('0x1e')],_0xbf8ab9[_0xea3f('0x58')],_0xbf8ab9[_0xea3f('0x5a')]));queues[_0xbf8ab9['origtransfererlinkedid']][_0xea3f('0x3f')]=!![];queues[_0xbf8ab9[_0xea3f('0x4d')]][_0xea3f('0x46')]=_0xea3f('0x5b');queues[_0xbf8ab9['origtransfererlinkedid']][_0xea3f('0x48')]=_0xbf8ab9[_0xea3f('0x5a')];queues[_0xbf8ab9['origtransfererlinkedid']][_0xea3f('0x51')]=_0xbf8ab9[_0xea3f('0x58')];queues[_0xbf8ab9[_0xea3f('0x4d')]][_0xea3f('0x8')]=_0xea3f('0x52');}if(!_[_0xea3f('0x13')](queues[_0xbf8ab9[_0xea3f('0x4e')]])){if(_0xbf8ab9[_0xea3f('0x5c')]&&queues[_0xbf8ab9[_0xea3f('0x5c')]]){queues[_0xbf8ab9[_0xea3f('0x5c')]][_0xea3f('0x1f')]=0x1;queues[_0xbf8ab9[_0xea3f('0x5d')]]=_[_0xea3f('0x54')](queues[_0xbf8ab9[_0xea3f('0x5c')]]);queues[_0xbf8ab9[_0xea3f('0x5d')]][_0xea3f('0xc')]=_0xbf8ab9[_0xea3f('0x5d')];queues[_0xbf8ab9['transfertargetuniqueid']][_0xea3f('0x1f')]=0x2;queues[_0xbf8ab9[_0xea3f('0x5d')]]['calleridnum']=queues[_0xbf8ab9[_0xea3f('0x4d')]][_0xea3f('0x6')];queues[_0xbf8ab9['transfertargetuniqueid']][_0xea3f('0x55')]=queues[_0xbf8ab9['origtransfererlinkedid']]['calleridname'];queues[_0xbf8ab9[_0xea3f('0x5d')]][_0xea3f('0x34')]=utils['now']();queues[_0xbf8ab9['transfertargetuniqueid']][_0xea3f('0x15')]=utils[_0xea3f('0x10')]();queues[_0xbf8ab9['transfertargetuniqueid']][_0xea3f('0x56')]=0x0;queues[_0xbf8ab9[_0xea3f('0x5d')]]['mohtime']=0x0;utils['info'](util[_0xea3f('0x2')](_0xea3f('0x5e'),_0xbf8ab9[_0xea3f('0x4c')],queues[_0xbf8ab9[_0xea3f('0x5d')]][_0xea3f('0x1e')],queues[_0xbf8ab9[_0xea3f('0x5d')]]['transfereduniqueid'],queues[_0xbf8ab9['transfertargetuniqueid']]['calleridnum'],queues[_0xbf8ab9[_0xea3f('0x5d')]][_0xea3f('0x55')]));}else{utils['info'](util[_0xea3f('0x2')](_0xea3f('0x5f'),_0xbf8ab9[_0xea3f('0x4c')],queues[_0xbf8ab9[_0xea3f('0x4e')]][_0xea3f('0x1e')],_0xbf8ab9['origtransfererlinkedid']));queues[_0xbf8ab9['secondtransfererlinkedid']]['transfereduniqueid']=_0xbf8ab9[_0xea3f('0x4d')];}}}}catch(_0x47bf7d){utils[_0xea3f('0x11')](util[_0xea3f('0x2')]('[%s][queues][attendedtransfer]',_0xbf8ab9[_0xea3f('0x4c')]),_0x47bf7d);}};exports['musiconholdstart']=function(_0x5d913b){try{if(!_[_0xea3f('0x13')](queues[_0x5d913b[_0xea3f('0x4')]])){utils[_0xea3f('0xd')](util[_0xea3f('0x2')](_0xea3f('0x60'),_0x5d913b[_0xea3f('0x4')]),_0x5d913b);queues[_0x5d913b[_0xea3f('0x4')]][_0xea3f('0x61')]=utils[_0xea3f('0x10')]();utils[_0xea3f('0x1c')](util['format'](_0xea3f('0x62'),_0x5d913b[_0xea3f('0x4')],queues[_0x5d913b[_0xea3f('0x4')]]['name'],queues[_0x5d913b[_0xea3f('0x4')]][_0xea3f('0x61')]));}}catch(_0x541617){utils[_0xea3f('0x11')](util[_0xea3f('0x2')]('[%s][queues][musiconholdstart]',_0x5d913b['uniqueid']),_0x541617);}};exports[_0xea3f('0x63')]=function(_0x486dc6){try{if(!_[_0xea3f('0x13')](queues[_0x486dc6['uniqueid']])){if(!_['isNil'](queues[_0x486dc6[_0xea3f('0x4')]]['musiconholdstartAt'])){utils[_0xea3f('0xd')](util['format'](_0xea3f('0x64'),_0x486dc6['uniqueid']),_0x486dc6);queues[_0x486dc6['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0xea3f('0x10')](),queues[_0x486dc6[_0xea3f('0x4')]][_0xea3f('0x61')]);utils['info'](util[_0xea3f('0x2')](_0xea3f('0x65'),_0x486dc6[_0xea3f('0x4')],queues[_0x486dc6['uniqueid']][_0xea3f('0x1e')],queues[_0x486dc6[_0xea3f('0x4')]][_0xea3f('0x66')]));delete queues[_0x486dc6['uniqueid']][_0xea3f('0x61')];}}}catch(_0x5d506b){utils[_0xea3f('0x11')](util['format'](_0xea3f('0x64'),_0x486dc6[_0xea3f('0x4')]),_0x5d506b);}}; \ No newline at end of file +var _0x3ef7=['queuecallerexitAt','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','membername','destaccountcode','queuecallerabandonAt','accountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandon'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_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 utils=require(_0x73ef('0x1'));var queues={};function writeDB(_0x1fb7b0){utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x4'),_0x1fb7b0['uniqueid'],_0x1fb7b0[_0x73ef('0x5')],_0x1fb7b0[_0x73ef('0x6')],_0x1fb7b0[_0x73ef('0x7')],_0x1fb7b0[_0x73ef('0x8')],_0x1fb7b0['accountcode'],_0x1fb7b0[_0x73ef('0x9')]));if(_0x1fb7b0[_0x73ef('0x6')]){utils[_0x73ef('0xa')](_0x1fb7b0[_0x73ef('0x6')])[_0x73ef('0xb')](function(_0x4cd5ce){if(_0x4cd5ce){_0x1fb7b0[_0x73ef('0xc')]=_0x4cd5ce[_0x73ef('0xc')];}utils['request'](_0x73ef('0xd'),_0x1fb7b0);});}else{utils[_0x73ef('0xe')](_0x73ef('0xd'),_0x1fb7b0);}if(_0x1fb7b0[_0x73ef('0xf')]){delete queues[_0x1fb7b0[_0x73ef('0xf')]];}else{delete queues[_0x1fb7b0['uniqueid']];}}exports[_0x73ef('0x10')]=function(_0x111ce3){try{utils[_0x73ef('0x11')](util[_0x73ef('0x3')](_0x73ef('0x12'),_0x111ce3[_0x73ef('0x13')]),_0x111ce3);utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x14'),_0x111ce3[_0x73ef('0x13')],_0x111ce3[_0x73ef('0x6')],_0x111ce3[_0x73ef('0x15')]));queues[_0x111ce3[_0x73ef('0x13')]]=_['assign'](_0x111ce3,{'originalposition':_0x111ce3[_0x73ef('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x2d836c){utils[_0x73ef('0x16')](util[_0x73ef('0x3')]('[%s][queues][queuecallerjoin]',_0x111ce3[_0x73ef('0x13')]),_0x2d836c);}};exports[_0x73ef('0x17')]=function(_0x4bccf6){try{if(!_[_0x73ef('0x18')](queues[_0x4bccf6[_0x73ef('0x13')]])){utils[_0x73ef('0x11')](util[_0x73ef('0x3')](_0x73ef('0x19'),_0x4bccf6['uniqueid']),_0x4bccf6);if(queues[_0x4bccf6[_0x73ef('0x13')]]['queuecallerleaveAt']){if(!queues[_0x4bccf6[_0x73ef('0x13')]]['queuecallerabandon']&&!queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0x1a')]){queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0x1b')]=!![];queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0x1c')]=utils[_0x73ef('0x1d')]();queues[_0x4bccf6[_0x73ef('0x13')]]['queuecallerexitreason']=_0x73ef('0x1e');}utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x1f'),_0x4bccf6['uniqueid'],queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0x20')],queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0x9')]));writeDB(queues[_0x4bccf6[_0x73ef('0x13')]]);}else if(queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0xf')]){utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x21'),_0x4bccf6['uniqueid'],queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0x20')],queues[_0x4bccf6['uniqueid']]['transfereduniqueid']));queues[queues[_0x4bccf6[_0x73ef('0x13')]]['transfereduniqueid']]=queues[_0x4bccf6['uniqueid']];queues[queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0xf')]][_0x73ef('0x22')]=0x2;delete queues[_0x4bccf6[_0x73ef('0x13')]];}}}catch(_0x4e7a8b){utils[_0x73ef('0x16')](util['format'](_0x73ef('0x19'),_0x4bccf6['uniqueid']),_0x4e7a8b);}};exports[_0x73ef('0x23')]=function(_0x1b802f){try{utils[_0x73ef('0x11')](util[_0x73ef('0x3')](_0x73ef('0x24'),_0x1b802f[_0x73ef('0x13')]),_0x1b802f);if(!_[_0x73ef('0x18')](_0x1b802f['variable'][_0x73ef('0x25')])&&_0x1b802f[_0x73ef('0x26')][_0x73ef('0x27')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x1b802f[_0x73ef('0x13')]])){queues[_0x1b802f[_0x73ef('0x13')]]['queuecallerabandon']=![];queues[_0x1b802f[_0x73ef('0x13')]]['queuecallerabandonAt']=null;queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x1a')]=!![];queues[_0x1b802f[_0x73ef('0x13')]]['queuecallerexitAt']=utils[_0x73ef('0x1d')]();queues[_0x1b802f[_0x73ef('0x13')]]['queuecallerexitreason']=_0x1b802f[_0x73ef('0x26')][_0x73ef('0x27')]();utils[_0x73ef('0x2')](util['format'](_0x73ef('0x28'),_0x1b802f[_0x73ef('0x13')],queues[_0x1b802f[_0x73ef('0x13')]]['name'],_0x1b802f[_0x73ef('0x26')],queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x9')]));writeDB(queues[_0x1b802f[_0x73ef('0x13')]]);}}else if(!_[_0x73ef('0x18')](_0x1b802f[_0x73ef('0x29')][_0x73ef('0x2a')])){if(!_[_0x73ef('0x18')](queues[_0x1b802f[_0x73ef('0x13')]])&&!queues[_0x1b802f[_0x73ef('0x13')]]['queuecallerabandon']){queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x2b')]=![];queues[_0x1b802f[_0x73ef('0x13')]]['queuecallerabandonAt']=null;queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x1a')]=!![];queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x2c')]=utils[_0x73ef('0x1d')]();queues[_0x1b802f['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils[_0x73ef('0x2')](util[_0x73ef('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x1b802f[_0x73ef('0x13')],queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x20')],_0x1b802f['value'],queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x9')]));}}}catch(_0x376791){utils[_0x73ef('0x16')](util['format'](_0x73ef('0x24'),_0x1b802f[_0x73ef('0x13')]),_0x376791);}};exports[_0x73ef('0x2b')]=function(_0x455d64){try{if(!_[_0x73ef('0x18')](queues[_0x455d64[_0x73ef('0x13')]])){utils[_0x73ef('0x11')](util[_0x73ef('0x3')](_0x73ef('0x2d'),_0x455d64['uniqueid']),_0x455d64);queues[_0x455d64['uniqueid']][_0x73ef('0x1a')]=![];queues[_0x455d64[_0x73ef('0x13')]]['queuecallerexitAt']=null;queues[_0x455d64['uniqueid']][_0x73ef('0x2b')]=!![];queues[_0x455d64[_0x73ef('0x13')]]['queuecallerabandonAt']=utils['now']();queues[_0x455d64['uniqueid']]['queuecallerexitreason']=_0x73ef('0x2e');utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x2f'),_0x455d64[_0x73ef('0x13')],queues[_0x455d64[_0x73ef('0x13')]][_0x73ef('0x20')],queues[_0x455d64['uniqueid']][_0x73ef('0x9')]));}}catch(_0x366e15){utils['error'](util[_0x73ef('0x3')]('[%s][queues][queuecallerabandon]',_0x455d64[_0x73ef('0x13')]),_0x366e15);}};exports['queuecallerleave']=function(_0x4ef667){try{if(!_[_0x73ef('0x18')](queues[_0x4ef667[_0x73ef('0x13')]])){utils['debug'](util[_0x73ef('0x3')](_0x73ef('0x30'),_0x4ef667[_0x73ef('0x13')]),_0x4ef667);utils['info'](util[_0x73ef('0x3')](_0x73ef('0x31'),_0x4ef667['uniqueid'],queues[_0x4ef667[_0x73ef('0x13')]]['name'],_0x4ef667[_0x73ef('0x32')],_0x4ef667[_0x73ef('0x33')]));queues[_0x4ef667[_0x73ef('0x13')]][_0x73ef('0x34')]=!![];queues[_0x4ef667[_0x73ef('0x13')]][_0x73ef('0x35')]=utils['now']();queues[_0x4ef667['uniqueid']]['holdtime']=utils[_0x73ef('0x36')](queues[_0x4ef667['uniqueid']]['queuecallerleaveAt'],queues[_0x4ef667[_0x73ef('0x13')]][_0x73ef('0x37')]);queues[_0x4ef667[_0x73ef('0x13')]][_0x73ef('0x15')]=_0x4ef667['position'];queues[_0x4ef667[_0x73ef('0x13')]][_0x73ef('0x38')]=_0x4ef667[_0x73ef('0x38')];queues[_0x4ef667['uniqueid']][_0x73ef('0x32')]=_0x4ef667[_0x73ef('0x32')];queues[_0x4ef667[_0x73ef('0x13')]]['connectedlinename']=_0x4ef667[_0x73ef('0x33')];}}catch(_0x15fd18){utils[_0x73ef('0x16')](util['format'](_0x73ef('0x30'),_0x4ef667[_0x73ef('0x13')]),_0x15fd18);}};exports['agentconnect']=function(_0x53efb7){try{if(!_[_0x73ef('0x18')](queues[_0x53efb7['uniqueid']])){utils[_0x73ef('0x11')](util[_0x73ef('0x3')]('[%s][queues][agentconnect]',_0x53efb7[_0x73ef('0x13')]),_0x53efb7);utils['info'](util[_0x73ef('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x53efb7[_0x73ef('0x13')],queues[_0x53efb7['uniqueid']][_0x73ef('0x20')],_0x53efb7[_0x73ef('0x39')],_0x53efb7[_0x73ef('0x3a')]));queues[_0x53efb7['uniqueid']][_0x73ef('0x2b')]=![];queues[_0x53efb7[_0x73ef('0x13')]][_0x73ef('0x2b')]=![];queues[_0x53efb7[_0x73ef('0x13')]][_0x73ef('0x3b')]=null;queues[_0x53efb7[_0x73ef('0x13')]]['queuecallerexit']=![];queues[_0x53efb7[_0x73ef('0x13')]]['queuecallerexitreason']=null;queues[_0x53efb7[_0x73ef('0x13')]][_0x73ef('0x2c')]=null;queues[_0x53efb7['uniqueid']]['assigned']=!![];queues[_0x53efb7['uniqueid']][_0x73ef('0x3c')]=_0x53efb7[_0x73ef('0x3a')];queues[_0x53efb7[_0x73ef('0x13')]][_0x73ef('0x7')]=_0x53efb7[_0x73ef('0x39')];}}catch(_0x2fa7e1){utils[_0x73ef('0x16')](util[_0x73ef('0x3')](_0x73ef('0x3d'),_0x53efb7[_0x73ef('0x13')]),_0x2fa7e1);}};exports[_0x73ef('0x3e')]=function(_0x3b74b9){try{if(!_[_0x73ef('0x18')](queues[_0x3b74b9[_0x73ef('0x13')]])){if(queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x35')]){utils['debug'](util['format'](_0x73ef('0x3f'),_0x3b74b9[_0x73ef('0x13')]),_0x3b74b9);queues[_0x3b74b9[_0x73ef('0x13')]]['queuecallerabandon']=![];queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x2b')]=![];queues[_0x3b74b9['uniqueid']][_0x73ef('0x3b')]=null;queues[_0x3b74b9['uniqueid']][_0x73ef('0x1a')]=![];queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x2c')]=null;queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x40')]=!![];queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x7')]=_0x3b74b9['membername'];queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x1b')]=!![];queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x1c')]=utils[_0x73ef('0x1d')]();if(_0x3b74b9[_0x73ef('0x41')]==_0x73ef('0x42')){if(!queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x42')]){queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x9')]=_0x73ef('0x43');}}else{queues[_0x3b74b9['uniqueid']][_0x73ef('0x9')]=_0x73ef('0x44')+_0x3b74b9[_0x73ef('0x41')][_0x73ef('0x27')]();}utils['info'](util['format'](_0x73ef('0x45'),_0x3b74b9[_0x73ef('0x13')],queues[_0x3b74b9['uniqueid']][_0x73ef('0x20')],_0x3b74b9['membername'],queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x9')]));writeDB(queues[_0x3b74b9[_0x73ef('0x13')]]);}}}catch(_0x16b070){utils[_0x73ef('0x16')](util[_0x73ef('0x3')](_0x73ef('0x3f'),_0x3b74b9['uniqueid']),_0x16b070);}};exports[_0x73ef('0x46')]=function(_0x462551){try{if(!_[_0x73ef('0x18')](queues[_0x462551['transfereeuniqueid']])){utils[_0x73ef('0x11')](util['format'](_0x73ef('0x47'),_0x462551['uniqueid']),_0x462551);queues[_0x462551[_0x73ef('0x48')]][_0x73ef('0x42')]=!![];queues[_0x462551[_0x73ef('0x48')]][_0x73ef('0x49')]='BLIND';queues[_0x462551[_0x73ef('0x48')]][_0x73ef('0x4a')]=_0x462551['extension'];queues[_0x462551[_0x73ef('0x48')]][_0x73ef('0x4b')]=_0x462551[_0x73ef('0x48')];queues[_0x462551[_0x73ef('0x48')]][_0x73ef('0x9')]=_0x73ef('0x4c');utils[_0x73ef('0x2')](util['format'](_0x73ef('0x4d'),_0x462551['uniqueid'],queues[_0x462551[_0x73ef('0x48')]][_0x73ef('0x20')],_0x462551[_0x73ef('0x48')],_0x462551['extension']));}}catch(_0x58705c){utils[_0x73ef('0x16')](util[_0x73ef('0x3')](_0x73ef('0x47'),_0x462551[_0x73ef('0x13')]),_0x58705c);}};exports[_0x73ef('0x4e')]=function(_0x1a05df){try{utils['debug'](util[_0x73ef('0x3')](_0x73ef('0x4f'),_0x1a05df[_0x73ef('0x50')]),_0x1a05df);if(_0x1a05df[_0x73ef('0x50')]==_0x1a05df[_0x73ef('0x51')]){if(!_[_0x73ef('0x18')](queues[_0x1a05df[_0x73ef('0x52')]])){utils[_0x73ef('0x2')](util['format'](_0x73ef('0x53'),_0x1a05df['origtransfereruniqueid'],queues[_0x1a05df[_0x73ef('0x52')]][_0x73ef('0x20')],_0x1a05df[_0x73ef('0x54')]));queues[_0x1a05df[_0x73ef('0x52')]][_0x73ef('0x42')]=!![];queues[_0x1a05df[_0x73ef('0x52')]]['transfertype']=_0x73ef('0x55');queues[_0x1a05df[_0x73ef('0x52')]][_0x73ef('0x4a')]=_0x1a05df['origtransfererexten'];queues[_0x1a05df[_0x73ef('0x52')]][_0x73ef('0x4b')]=_0x1a05df[_0x73ef('0x50')];queues[_0x1a05df[_0x73ef('0x52')]][_0x73ef('0x9')]=_0x73ef('0x56');}if(!_[_0x73ef('0x18')](queues[_0x1a05df['origtransfererlinkedid']])){if(_0x1a05df[_0x73ef('0x57')]&&queues[_0x1a05df[_0x73ef('0x57')]]){queues[_0x1a05df[_0x73ef('0x57')]][_0x73ef('0x22')]=0x1;queues[_0x1a05df[_0x73ef('0x48')]]=_[_0x73ef('0x58')](queues[_0x1a05df['transfereelinkedid']]);queues[_0x1a05df[_0x73ef('0x48')]]['transfereduniqueid']=_0x1a05df[_0x73ef('0x59')];queues[_0x1a05df[_0x73ef('0x48')]][_0x73ef('0x22')]=0x2;queues[_0x1a05df['transfereeuniqueid']]['calleridnum']=queues[_0x1a05df['secondtransfererlinkedid']][_0x73ef('0x8')];queues[_0x1a05df['transfereeuniqueid']][_0x73ef('0x5a')]=queues[_0x1a05df[_0x73ef('0x52')]]['calleridname'];queues[_0x1a05df[_0x73ef('0x48')]][_0x73ef('0x37')]=utils[_0x73ef('0x1d')]();queues[_0x1a05df['transfereeuniqueid']][_0x73ef('0x35')]=utils[_0x73ef('0x1d')]();queues[_0x1a05df['transfereeuniqueid']][_0x73ef('0x5b')]=0x0;queues[_0x1a05df['transfereeuniqueid']][_0x73ef('0x5c')]=0x0;utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x5d'),_0x1a05df[_0x73ef('0x50')],queues[_0x1a05df['transfereeuniqueid']]['name'],queues[_0x1a05df[_0x73ef('0x48')]]['calleridnum'],queues[_0x1a05df[_0x73ef('0x48')]][_0x73ef('0x5a')]));}else{utils['info'](util[_0x73ef('0x3')](_0x73ef('0x5e'),_0x1a05df[_0x73ef('0x50')],queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x20')],_0x1a05df[_0x73ef('0x52')]));queues[_0x1a05df['origtransfererlinkedid']][_0x73ef('0xf')]=_0x1a05df[_0x73ef('0x52')];}}}else if(_0x1a05df[_0x73ef('0x5f')]==_0x1a05df['secondtransfererlinkedid']){if(!_[_0x73ef('0x18')](queues[_0x1a05df[_0x73ef('0x51')]])){utils['info'](util['format'](_0x73ef('0x60'),_0x1a05df[_0x73ef('0x50')],queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x20')],_0x1a05df[_0x73ef('0x5f')],_0x1a05df['secondtransfererexten']));queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x42')]=!![];queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x49')]='ATTENDED';queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x4a')]=_0x1a05df['secondtransfererexten'];queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x4b')]=_0x1a05df['secondtransfereruniqueid'];queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x73ef('0x18')](queues[_0x1a05df[_0x73ef('0x52')]])){if(_0x1a05df[_0x73ef('0x61')]&&queues[_0x1a05df[_0x73ef('0x61')]]){queues[_0x1a05df[_0x73ef('0x61')]]['queuecallerenterreason']=0x1;queues[_0x1a05df[_0x73ef('0x59')]]=_[_0x73ef('0x58')](queues[_0x1a05df['transfertargetlinkedid']]);queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0xf')]=_0x1a05df['transfertargetuniqueid'];queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x22')]=0x2;queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x8')]=queues[_0x1a05df[_0x73ef('0x51')]]['calleridnum'];queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x5a')]=queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x5a')];queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x37')]=utils[_0x73ef('0x1d')]();queues[_0x1a05df['transfertargetuniqueid']][_0x73ef('0x35')]=utils[_0x73ef('0x1d')]();queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x5b')]=0x0;queues[_0x1a05df[_0x73ef('0x59')]]['mohtime']=0x0;utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x62'),_0x1a05df[_0x73ef('0x50')],queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x20')],queues[_0x1a05df[_0x73ef('0x59')]]['transfereduniqueid'],queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x8')],queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x5a')]));}else{utils['info'](util[_0x73ef('0x3')](_0x73ef('0x5e'),_0x1a05df[_0x73ef('0x50')],queues[_0x1a05df[_0x73ef('0x52')]][_0x73ef('0x20')],_0x1a05df[_0x73ef('0x51')]));queues[_0x1a05df[_0x73ef('0x52')]]['transfereduniqueid']=_0x1a05df['origtransfererlinkedid'];}}}}catch(_0x31a1ec){utils['error'](util['format'](_0x73ef('0x4f'),_0x1a05df[_0x73ef('0x50')]),_0x31a1ec);}};exports[_0x73ef('0x63')]=function(_0x168136){try{if(!_[_0x73ef('0x18')](queues[_0x168136[_0x73ef('0x13')]])){utils['debug'](util[_0x73ef('0x3')]('[%s][queues][musiconholdstart]',_0x168136[_0x73ef('0x13')]),_0x168136);queues[_0x168136[_0x73ef('0x13')]][_0x73ef('0x64')]=utils[_0x73ef('0x1d')]();utils['info'](util['format'](_0x73ef('0x65'),_0x168136[_0x73ef('0x13')],queues[_0x168136[_0x73ef('0x13')]][_0x73ef('0x20')],queues[_0x168136[_0x73ef('0x13')]][_0x73ef('0x64')]));}}catch(_0x3a3838){utils['error'](util[_0x73ef('0x3')]('[%s][queues][musiconholdstart]',_0x168136[_0x73ef('0x13')]),_0x3a3838);}};exports['musiconholdstop']=function(_0x432532){try{if(!_[_0x73ef('0x18')](queues[_0x432532[_0x73ef('0x13')]])){if(!_[_0x73ef('0x18')](queues[_0x432532[_0x73ef('0x13')]]['musiconholdstartAt'])){utils['debug'](util[_0x73ef('0x3')](_0x73ef('0x66'),_0x432532['uniqueid']),_0x432532);queues[_0x432532['uniqueid']][_0x73ef('0x5c')]+=utils[_0x73ef('0x36')](utils[_0x73ef('0x1d')](),queues[_0x432532[_0x73ef('0x13')]][_0x73ef('0x64')]);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x432532[_0x73ef('0x13')],queues[_0x432532['uniqueid']][_0x73ef('0x20')],queues[_0x432532['uniqueid']][_0x73ef('0x5c')]));delete queues[_0x432532['uniqueid']][_0x73ef('0x64')];}}}catch(_0x28cbf8){utils[_0x73ef('0x16')](util[_0x73ef('0x3')](_0x73ef('0x66'),_0x432532['uniqueid']),_0x28cbf8);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index fa8e31a..92f670b 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 _0xd452=['value','endsWith','.wav49','replace','find','monitors','push','error','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','split','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','format','[%s][recordings][writeDB]','getUserByInternal','accountcode','then','membername','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xd452,0x98));var _0x2d45=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0xd452[_0x594e11];return _0x5418ad;};'use strict';var _=require(_0x2d45('0x0'));var util=require(_0x2d45('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x2e77ec){utils[_0x2d45('0x2')](util[_0x2d45('0x3')](_0x2d45('0x4'),_0x2e77ec['uniqueid']));if(_0x2e77ec['accountcode']){utils[_0x2d45('0x5')](_0x2e77ec[_0x2d45('0x6')])[_0x2d45('0x7')](function(_0x13c884){if(_0x13c884){_0x2e77ec[_0x2d45('0x8')]=_0x13c884[_0x2d45('0x9')];_0x2e77ec['UserId']=_0x13c884['id'];}utils[_0x2d45('0xa')](_0x2d45('0xb'),_0x2e77ec);});}else{utils[_0x2d45('0xa')]('CreateVoiceRecording',_0x2e77ec);}}exports[_0x2d45('0xc')]=function(_0x3135f1){try{utils[_0x2d45('0xd')](util['format'](_0x2d45('0xe'),_0x3135f1[_0x2d45('0xf')]),_0x3135f1);if(_0x3135f1[_0x2d45('0xf')]==_0x3135f1[_0x2d45('0x10')]){utils[_0x2d45('0x2')](util['format'](_0x2d45('0x11'),_0x3135f1['uniqueid'],_0x3135f1[_0x2d45('0x12')],_0x3135f1[_0x2d45('0x13')]));recordings[_0x3135f1[_0x2d45('0xf')]]={'uniqueid':_0x3135f1[_0x2d45('0xf')],'accountcode':_0x3135f1[_0x2d45('0x6')],'exten':_0x3135f1['exten'],'context':_0x3135f1[_0x2d45('0x12')],'channel':_0x3135f1[_0x2d45('0x14')],'monitors':[]};}}catch(_0x1fa480){utils['error'](util[_0x2d45('0x3')](_0x2d45('0xe'),_0x3135f1['uniqueid']),_0x1fa480);}};exports[_0x2d45('0x15')]=function(_0x149894){try{utils[_0x2d45('0xd')](util[_0x2d45('0x3')](_0x2d45('0x16'),_0x149894['uniqueid']),_0x149894);if(!_[_0x2d45('0x17')](recordings[_0x149894[_0x2d45('0xf')]])&&_0x149894[_0x2d45('0x18')]==0x6){utils[_0x2d45('0x2')](util[_0x2d45('0x3')](_0x2d45('0x19'),_0x149894[_0x2d45('0xf')],_0x149894[_0x2d45('0x12')],_0x149894['channel']));}else if(!_[_0x2d45('0x17')](recordings[_0x149894[_0x2d45('0x10')]])&&_0x149894['channelstate']==0x6&&_0x149894[_0x2d45('0x12')]!=_0x2d45('0x1a')){utils[_0x2d45('0x2')](util[_0x2d45('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x149894[_0x2d45('0xf')],_0x149894[_0x2d45('0x10')],_0x149894['context'],_0x149894[_0x2d45('0x14')]));recordings[_0x149894[_0x2d45('0x10')]][_0x2d45('0x6')]=_0x149894[_0x2d45('0x6')];}}catch(_0x5b9085){utils['error'](util[_0x2d45('0x3')](_0x2d45('0x16'),_0x149894[_0x2d45('0xf')]),_0x5b9085);}};exports['varset']=function(_0x344352){try{if(!_['isNil'](_0x344352[_0x2d45('0x1b')])&&!_[_0x2d45('0x17')](_0x344352[_0x2d45('0x1b')][_0x2d45('0x1c')])){utils[_0x2d45('0xd')](util['format'](_0x2d45('0x1d'),_0x344352[_0x2d45('0xf')]),_0x344352);utils['info'](util['format'](_0x2d45('0x1e'),_0x344352[_0x2d45('0xf')],_0x344352['variable'],_0x344352[_0x2d45('0x1f')]));if(_[_0x2d45('0x20')](_0x344352[_0x2d45('0x1f')],_0x2d45('0x21'))){_0x344352[_0x2d45('0x1f')]=_0x344352['value'][_0x2d45('0x22')](_0x2d45('0x21'),'.WAV');}if(recordings[_0x344352['linkedid']]){var _0x291441=_[_0x2d45('0x23')](recordings[_0x344352['linkedid']][_0x2d45('0x24')],{'value':_0x344352[_0x2d45('0x1f')]});if(_[_0x2d45('0x17')](_0x291441)){recordings[_0x344352[_0x2d45('0x10')]][_0x2d45('0x24')][_0x2d45('0x25')]({'value':_0x344352[_0x2d45('0x1f')]});}}}}catch(_0x288b9e){utils[_0x2d45('0x26')](util[_0x2d45('0x3')](_0x2d45('0x1d'),_0x344352[_0x2d45('0xf')]),_0x288b9e);}};exports[_0x2d45('0x27')]=function(_0x4a569b){try{if(!_[_0x2d45('0x17')](recordings[_0x4a569b[_0x2d45('0xf')]])){utils[_0x2d45('0xd')](util[_0x2d45('0x3')](_0x2d45('0x28'),_0x4a569b[_0x2d45('0xf')]),_0x4a569b);utils[_0x2d45('0x2')](util[_0x2d45('0x3')](_0x2d45('0x29'),_0x4a569b[_0x2d45('0xf')],_0x4a569b[_0x2d45('0x2a')],_0x4a569b[_0x2d45('0x2b')],_0x4a569b['cause-txt']));recordings[_0x4a569b[_0x2d45('0xf')]][_0x2d45('0x2a')]=_0x4a569b[_0x2d45('0x2a')];recordings[_0x4a569b[_0x2d45('0xf')]][_0x2d45('0x2b')]=_0x4a569b[_0x2d45('0x2b')];recordings[_0x4a569b[_0x2d45('0xf')]]['connectedlinenum']=_0x4a569b[_0x2d45('0x2c')];recordings[_0x4a569b[_0x2d45('0xf')]]['connectedlinename']=_0x4a569b[_0x2d45('0x2d')];if(recordings[_0x4a569b[_0x2d45('0xf')]][_0x2d45('0x2e')]=='outbound'&&recordings[_0x4a569b[_0x2d45('0xf')]][_0x2d45('0x6')]){recordings[_0x4a569b[_0x2d45('0xf')]][_0x2d45('0x2c')]=recordings[_0x4a569b[_0x2d45('0xf')]]['accountcode'];recordings[_0x4a569b['uniqueid']][_0x2d45('0x2d')]='';}recordings[_0x4a569b[_0x2d45('0xf')]][_0x2d45('0x24')]['forEach'](function(_0x3d0816){var _0x3cfc57=_[_0x2d45('0x2f')](recordings[_0x4a569b[_0x2d45('0xf')]]);_0x3cfc57[_0x2d45('0x1f')]=_0x3d0816[_0x2d45('0x1f')];writeDB(_0x3cfc57);});delete recordings[_0x4a569b[_0x2d45('0xf')]];}}catch(_0x527a95){utils[_0x2d45('0x26')](util[_0x2d45('0x3')]('[%s][recordings][hangup]',_0x4a569b[_0x2d45('0xf')]),_0x527a95);}};exports[_0x2d45('0x30')]=function(_0x49d3f1){try{if(!_['isNil'](recordings[_0x49d3f1[_0x2d45('0xf')]])){utils[_0x2d45('0xd')](util[_0x2d45('0x3')]('[%s][recordings][newexten]',_0x49d3f1[_0x2d45('0xf')]),_0x49d3f1);utils[_0x2d45('0x2')](util[_0x2d45('0x3')](_0x2d45('0x31'),_0x49d3f1[_0x2d45('0xf')],_0x49d3f1[_0x2d45('0x32')],_0x49d3f1[_0x2d45('0x33')]));if(_0x49d3f1[_0x2d45('0x32')]['toLowerCase']()==_0x2d45('0x34')&&_[_0x2d45('0x35')](_0x49d3f1['appdata'][_0x2d45('0x36')](),'cdr')){var _0x4f5d50=_0x49d3f1[_0x2d45('0x33')][_0x2d45('0x37')]('=');var _0x59d007=_0x4f5d50[0x0]['substring'](_0x4f5d50[0x0]['lastIndexOf']('(')+0x1,_0x4f5d50[0x0][_0x2d45('0x38')](')'));var _0x154de4=_0x4f5d50[0x1];recordings[_0x49d3f1[_0x2d45('0xf')]][_0x59d007]=_0x154de4;}}}catch(_0x87b85c){utils[_0x2d45('0x26')](util['format'](_0x2d45('0x39'),_0x49d3f1['uniqueid']),_0x87b85c);}};exports['queuecallerjoin']=function(_0x1a4b7b){try{if(!_[_0x2d45('0x17')](recordings[_0x1a4b7b[_0x2d45('0xf')]])){utils['debug'](util[_0x2d45('0x3')](_0x2d45('0x3a'),_0x1a4b7b[_0x2d45('0xf')]),_0x1a4b7b);utils[_0x2d45('0x2')](util['format'](_0x2d45('0x3b'),_0x1a4b7b['uniqueid'],_0x1a4b7b[_0x2d45('0x3c')]));recordings[_0x1a4b7b[_0x2d45('0xf')]][_0x2d45('0x3c')]=_0x1a4b7b[_0x2d45('0x3c')];}}catch(_0x25382e){utils[_0x2d45('0x26')](util[_0x2d45('0x3')](_0x2d45('0x3a'),_0x1a4b7b[_0x2d45('0xf')]),_0x25382e);}}; \ No newline at end of file +var _0xa1aa=['set','startsWith','split','substring','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','[%s][recordings][queuecallerjoin]','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','CreateVoiceRecording','request','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','error','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase'];(function(_0x446330,_0x2c8a47){var _0x8813ad=function(_0x304c99){while(--_0x304c99){_0x446330['push'](_0x446330['shift']());}};_0x8813ad(++_0x2c8a47);}(_0xa1aa,0x81));var _0xaa1a=function(_0x3570b8,_0x198e02){_0x3570b8=_0x3570b8-0x0;var _0xf481e6=_0xa1aa[_0x3570b8];return _0xf481e6;};'use strict';var _=require(_0xaa1a('0x0'));var util=require(_0xaa1a('0x1'));var utils=require(_0xaa1a('0x2'));var recordings={};function writeDB(_0x4823e4){utils[_0xaa1a('0x3')](util[_0xaa1a('0x4')](_0xaa1a('0x5'),_0x4823e4[_0xaa1a('0x6')]));if(_0x4823e4[_0xaa1a('0x7')]){utils['getUserByInternal'](_0x4823e4[_0xaa1a('0x7')])[_0xaa1a('0x8')](function(_0x4d916c){if(_0x4d916c){_0x4823e4[_0xaa1a('0x9')]=_0x4d916c[_0xaa1a('0xa')];_0x4823e4['UserId']=_0x4d916c['id'];}utils['request'](_0xaa1a('0xb'),_0x4823e4);});}else{utils[_0xaa1a('0xc')](_0xaa1a('0xb'),_0x4823e4);}}exports['newchannel']=function(_0x15b73b){try{utils[_0xaa1a('0xd')](util[_0xaa1a('0x4')](_0xaa1a('0xe'),_0x15b73b['uniqueid']),_0x15b73b);if(_0x15b73b[_0xaa1a('0x6')]==_0x15b73b[_0xaa1a('0xf')]){utils[_0xaa1a('0x3')](util[_0xaa1a('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x15b73b['uniqueid'],_0x15b73b[_0xaa1a('0x10')],_0x15b73b[_0xaa1a('0x11')]));recordings[_0x15b73b['uniqueid']]={'uniqueid':_0x15b73b['uniqueid'],'accountcode':_0x15b73b[_0xaa1a('0x7')],'exten':_0x15b73b['exten'],'context':_0x15b73b['context'],'channel':_0x15b73b[_0xaa1a('0x12')],'monitors':[]};}}catch(_0x535d7d){utils['error'](util[_0xaa1a('0x4')](_0xaa1a('0xe'),_0x15b73b['uniqueid']),_0x535d7d);}};exports['newstate']=function(_0x615231){try{utils['debug'](util[_0xaa1a('0x4')](_0xaa1a('0x13'),_0x615231[_0xaa1a('0x6')]),_0x615231);if(!_[_0xaa1a('0x14')](recordings[_0x615231[_0xaa1a('0x6')]])&&_0x615231[_0xaa1a('0x15')]==0x6){utils['info'](util[_0xaa1a('0x4')](_0xaa1a('0x16'),_0x615231[_0xaa1a('0x6')],_0x615231[_0xaa1a('0x10')],_0x615231[_0xaa1a('0x12')]));}else if(!_[_0xaa1a('0x14')](recordings[_0x615231[_0xaa1a('0xf')]])&&_0x615231['channelstate']==0x6&&_0x615231[_0xaa1a('0x10')]!=_0xaa1a('0x17')){utils['info'](util[_0xaa1a('0x4')](_0xaa1a('0x18'),_0x615231[_0xaa1a('0x6')],_0x615231[_0xaa1a('0xf')],_0x615231['context'],_0x615231[_0xaa1a('0x12')]));recordings[_0x615231[_0xaa1a('0xf')]][_0xaa1a('0x7')]=_0x615231['accountcode'];}}catch(_0x340cde){utils['error'](util[_0xaa1a('0x4')]('[%s][recordings][newstate]',_0x615231[_0xaa1a('0x6')]),_0x340cde);}};exports[_0xaa1a('0x19')]=function(_0x4edcff){try{if(!_[_0xaa1a('0x14')](_0x4edcff[_0xaa1a('0x1a')])&&!_[_0xaa1a('0x14')](_0x4edcff[_0xaa1a('0x1a')][_0xaa1a('0x1b')])){utils[_0xaa1a('0xd')](util[_0xaa1a('0x4')]('[%s][recordings][varset]',_0x4edcff['uniqueid']),_0x4edcff);utils[_0xaa1a('0x3')](util['format'](_0xaa1a('0x1c'),_0x4edcff[_0xaa1a('0x6')],_0x4edcff[_0xaa1a('0x1a')],_0x4edcff['value']));if(_[_0xaa1a('0x1d')](_0x4edcff[_0xaa1a('0x1e')],_0xaa1a('0x1f'))){_0x4edcff['value']=_0x4edcff[_0xaa1a('0x1e')][_0xaa1a('0x20')](_0xaa1a('0x1f'),'.WAV');}if(recordings[_0x4edcff[_0xaa1a('0xf')]]){var _0x2577a5=_['find'](recordings[_0x4edcff[_0xaa1a('0xf')]][_0xaa1a('0x21')],{'value':_0x4edcff[_0xaa1a('0x1e')]});if(_[_0xaa1a('0x14')](_0x2577a5)){recordings[_0x4edcff[_0xaa1a('0xf')]]['monitors'][_0xaa1a('0x22')]({'value':_0x4edcff[_0xaa1a('0x1e')]});}}}}catch(_0x1d2758){utils['error'](util[_0xaa1a('0x4')](_0xaa1a('0x23'),_0x4edcff[_0xaa1a('0x6')]),_0x1d2758);}};exports[_0xaa1a('0x24')]=function(_0x422ed5){try{if(!_[_0xaa1a('0x14')](recordings[_0x422ed5[_0xaa1a('0x6')]])){utils[_0xaa1a('0xd')](util['format'](_0xaa1a('0x25'),_0x422ed5[_0xaa1a('0x6')]),_0x422ed5);utils['info'](util[_0xaa1a('0x4')](_0xaa1a('0x26'),_0x422ed5['uniqueid'],_0x422ed5['calleridnum'],_0x422ed5['calleridname'],_0x422ed5['cause-txt']));recordings[_0x422ed5[_0xaa1a('0x6')]]['calleridnum']=_0x422ed5[_0xaa1a('0x27')];recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x28')]=_0x422ed5[_0xaa1a('0x28')];recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x29')]=_0x422ed5[_0xaa1a('0x29')];recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x2a')]=_0x422ed5[_0xaa1a('0x2a')];if(recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x2b')]==_0xaa1a('0x2c')&&recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x7')]){recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x29')]=recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x7')];recordings[_0x422ed5[_0xaa1a('0x6')]]['connectedlinename']='';}recordings[_0x422ed5['uniqueid']][_0xaa1a('0x21')][_0xaa1a('0x2d')](function(_0x1f91aa){var _0x5ebf9e=_[_0xaa1a('0x2e')](recordings[_0x422ed5['uniqueid']]);_0x5ebf9e[_0xaa1a('0x1e')]=_0x1f91aa[_0xaa1a('0x1e')];writeDB(_0x5ebf9e);});delete recordings[_0x422ed5[_0xaa1a('0x6')]];}}catch(_0x56272f){utils[_0xaa1a('0x2f')](util['format'](_0xaa1a('0x25'),_0x422ed5[_0xaa1a('0x6')]),_0x56272f);}};exports[_0xaa1a('0x30')]=function(_0x1bb11b){try{if(!_[_0xaa1a('0x14')](recordings[_0x1bb11b[_0xaa1a('0x6')]])){utils['debug'](util[_0xaa1a('0x4')](_0xaa1a('0x31'),_0x1bb11b[_0xaa1a('0x6')]),_0x1bb11b);utils['info'](util[_0xaa1a('0x4')](_0xaa1a('0x32'),_0x1bb11b['uniqueid'],_0x1bb11b[_0xaa1a('0x33')],_0x1bb11b[_0xaa1a('0x34')]));if(_0x1bb11b['application'][_0xaa1a('0x35')]()==_0xaa1a('0x36')&&_[_0xaa1a('0x37')](_0x1bb11b[_0xaa1a('0x34')][_0xaa1a('0x35')](),'cdr')){var _0x369768=_0x1bb11b['appdata'][_0xaa1a('0x38')]('=');var _0x49dd38=_0x369768[0x0][_0xaa1a('0x39')](_0x369768[0x0]['lastIndexOf']('(')+0x1,_0x369768[0x0]['lastIndexOf'](')'));var _0x382113=_0x369768[0x1];recordings[_0x1bb11b[_0xaa1a('0x6')]][_0x49dd38]=_0x382113;}}}catch(_0x1a105b){utils[_0xaa1a('0x2f')](util['format'](_0xaa1a('0x31'),_0x1bb11b['uniqueid']),_0x1a105b);}};exports[_0xaa1a('0x3a')]=function(_0x4626e7){try{if(!_[_0xaa1a('0x14')](recordings[_0x4626e7['uniqueid']])){utils[_0xaa1a('0xd')](util[_0xaa1a('0x4')]('[%s][recordings][queuecallerjoin]',_0x4626e7['uniqueid']),_0x4626e7);utils[_0xaa1a('0x3')](util[_0xaa1a('0x4')](_0xaa1a('0x3b'),_0x4626e7[_0xaa1a('0x6')],_0x4626e7['queue']));recordings[_0x4626e7[_0xaa1a('0x6')]]['queue']=_0x4626e7['queue'];}}catch(_0xc4d2c0){utils[_0xaa1a('0x2f')](util['format'](_0xaa1a('0x3c'),_0x4626e7[_0xaa1a('0x6')]),_0xc4d2c0);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 888e63e..44847f3 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 _0x072f=['util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x072f,0xa3));var _0xf072=function(_0x383b1e,_0x277f6f){_0x383b1e=_0x383b1e-0x0;var _0x4d4eac=_0x072f[_0x383b1e];return _0x4d4eac;};'use strict';var _=require(_0xf072('0x0'));var util=require(_0xf072('0x1'));var utils=require(_0xf072('0x2'));function writeDB(_0x51e5f2){utils[_0xf072('0x3')](util[_0xf072('0x4')](_0xf072('0x5'),_0x51e5f2[_0xf072('0x6')]===_0xf072('0x7')?_0x51e5f2[_0xf072('0x8')]:_0x51e5f2['uniqueid'],_0x51e5f2['type']));utils['request'](_0xf072('0x9'),_0x51e5f2);}exports['blindtransfer']=function(_0x2bbdf9){try{utils[_0xf072('0xa')](util[_0xf072('0x4')](_0xf072('0xb'),_0x2bbdf9[_0xf072('0xc')]),_0x2bbdf9);utils[_0xf072('0x3')](util[_0xf072('0x4')](_0xf072('0xd'),_0x2bbdf9[_0xf072('0xc')],_0x2bbdf9[_0xf072('0xe')],_0x2bbdf9[_0xf072('0xf')],_0x2bbdf9['transfereecalleridnum'],_0x2bbdf9[_0xf072('0x10')]));_0x2bbdf9[_0xf072('0x6')]='blind';writeDB(_0x2bbdf9);}catch(_0x27fe8b){utils[_0xf072('0x11')](util['format'](_0xf072('0xb'),_0x2bbdf9[_0xf072('0xc')]),_0x27fe8b);}};exports[_0xf072('0x12')]=function(_0x28b924){try{utils['debug'](util[_0xf072('0x4')](_0xf072('0x13'),_0x28b924[_0xf072('0x8')]),_0x28b924);utils[_0xf072('0x3')](util['format'](_0xf072('0x14'),_0x28b924[_0xf072('0x8')],_0x28b924[_0xf072('0x15')],_0x28b924[_0xf072('0x16')],_0x28b924[_0xf072('0x17')],_0x28b924[_0xf072('0x18')]));_0x28b924=_[_0xf072('0x19')](_0x28b924,{'transfererchannel':_0x28b924['origtransfererchannel'],'transferercalleridnum':_0x28b924[_0xf072('0x15')],'transferercalleridname':_0x28b924[_0xf072('0x16')],'transfererconnectedlinenum':_0x28b924[_0xf072('0x1a')],'transfererconnectedlinename':_0x28b924[_0xf072('0x1b')],'transfereraccountcode':_0x28b924[_0xf072('0x1c')],'transferercontext':_0x28b924['secondtransferercontext'],'transfererexten':_0x28b924[_0xf072('0x1d')],'transfererlinkedid':_0x28b924['origtransfererlinkedid'],'context':_0x28b924[_0xf072('0x1e')],'extension':_0x28b924[_0xf072('0x1f')],'type':_0xf072('0x7')});if(_[_0xf072('0x20')](_0x28b924[_0xf072('0x21')])){_0x28b924=_['assign'](_0x28b924,{'transfereechannel':_0x28b924[_0xf072('0x22')],'transfereecalleridnum':_0x28b924[_0xf072('0x17')],'transfereecalleridname':_0x28b924[_0xf072('0x18')],'transfereeconnectedlinenum':_0x28b924[_0xf072('0x23')],'transfereeconnectedlinename':_0x28b924[_0xf072('0x24')],'transfereeaccountcode':_0x28b924[_0xf072('0x25')],'transfereecontext':_0x28b924[_0xf072('0x26')],'transfereeexten':_0x28b924[_0xf072('0x27')],'transfereelinkedid':_0x28b924[_0xf072('0x28')]});}writeDB(_0x28b924);}catch(_0x37e0d7){utils[_0xf072('0x11')](util[_0xf072('0x4')](_0xf072('0x13'),_0x28b924[_0xf072('0x8')]),_0x37e0d7);}}; \ No newline at end of file +var _0xb714=['[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0xb714,0xe4));var _0x4b71=function(_0x4045ff,_0x46cbcd){_0x4045ff=_0x4045ff-0x0;var _0x5797ac=_0xb714[_0x4045ff];return _0x5797ac;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');function writeDB(_0x443a8a){utils[_0x4b71('0x0')](util['format'](_0x4b71('0x1'),_0x443a8a[_0x4b71('0x2')]===_0x4b71('0x3')?_0x443a8a[_0x4b71('0x4')]:_0x443a8a[_0x4b71('0x5')],_0x443a8a[_0x4b71('0x2')]));utils[_0x4b71('0x6')](_0x4b71('0x7'),_0x443a8a);}exports[_0x4b71('0x8')]=function(_0x5dd8e8){try{utils[_0x4b71('0x9')](util[_0x4b71('0xa')](_0x4b71('0xb'),_0x5dd8e8['uniqueid']),_0x5dd8e8);utils[_0x4b71('0x0')](util[_0x4b71('0xa')](_0x4b71('0xc'),_0x5dd8e8[_0x4b71('0x5')],_0x5dd8e8[_0x4b71('0xd')],_0x5dd8e8[_0x4b71('0xe')],_0x5dd8e8['transfereecalleridnum'],_0x5dd8e8[_0x4b71('0xf')]));_0x5dd8e8['type']='blind';writeDB(_0x5dd8e8);}catch(_0x19c5bf){utils[_0x4b71('0x10')](util[_0x4b71('0xa')]('[%s][transfers][blindtransfer]',_0x5dd8e8['uniqueid']),_0x19c5bf);}};exports[_0x4b71('0x11')]=function(_0x4279ed){try{utils[_0x4b71('0x9')](util['format']('[%s][transfers][attendedtransfer]',_0x4279ed[_0x4b71('0x4')]),_0x4279ed);utils[_0x4b71('0x0')](util['format'](_0x4b71('0x12'),_0x4279ed[_0x4b71('0x4')],_0x4279ed['origtransferercalleridnum'],_0x4279ed[_0x4b71('0x13')],_0x4279ed[_0x4b71('0x14')],_0x4279ed['transfertargetcalleridname']));_0x4279ed=_[_0x4b71('0x15')](_0x4279ed,{'transfererchannel':_0x4279ed[_0x4b71('0x16')],'transferercalleridnum':_0x4279ed[_0x4b71('0x17')],'transferercalleridname':_0x4279ed['origtransferercalleridname'],'transfererconnectedlinenum':_0x4279ed['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4279ed[_0x4b71('0x18')],'transfereraccountcode':_0x4279ed[_0x4b71('0x19')],'transferercontext':_0x4279ed[_0x4b71('0x1a')],'transfererexten':_0x4279ed[_0x4b71('0x1b')],'transfererlinkedid':_0x4279ed[_0x4b71('0x1c')],'context':_0x4279ed[_0x4b71('0x1d')],'extension':_0x4279ed[_0x4b71('0x1e')],'type':_0x4b71('0x3')});if(_['isNil'](_0x4279ed['transfereechannel'])){_0x4279ed=_['assign'](_0x4279ed,{'transfereechannel':_0x4279ed[_0x4b71('0x1f')],'transfereecalleridnum':_0x4279ed[_0x4b71('0x14')],'transfereecalleridname':_0x4279ed[_0x4b71('0x20')],'transfereeconnectedlinenum':_0x4279ed[_0x4b71('0x21')],'transfereeconnectedlinename':_0x4279ed[_0x4b71('0x22')],'transfereeaccountcode':_0x4279ed[_0x4b71('0x23')],'transfereecontext':_0x4279ed[_0x4b71('0x24')],'transfereeexten':_0x4279ed[_0x4b71('0x25')],'transfereelinkedid':_0x4279ed[_0x4b71('0x26')]});}writeDB(_0x4279ed);}catch(_0x5eea90){utils[_0x4b71('0x10')](util[_0x4b71('0xa')](_0x4b71('0x27'),_0x4279ed[_0x4b71('0x4')]),_0x5eea90);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 07eb852..90cf561 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb10b,0x12a));var _0xbb10=function(_0x45ed90,_0x111e0b){_0x45ed90=_0x45ed90-0x0;var _0x47a846=_0xb10b[_0x45ed90];return _0x47a846;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0xb10b[_0x3a13cf];return _0x4817c;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file